From 392f6da8971b0beda317fb6433e2d45b2e4d3cc8 Mon Sep 17 00:00:00 2001
From: Zuxy Meng <zuxy.meng@gmail.com>
Date: Fri, 28 Apr 2006 07:46:13 +0000
Subject: [PATCH] Remove unused and unsupported Cyrix's "Extended MMX", Add
 SSE3 support. Patch by Zuxy Meng < zuxy POIS meng AH gmail POIS com >
 Original thread: 04/26/06 13:13: [Ffmpeg-devel] [PATCH] Bug fix,	SSE3
 support in i386/cputest.c and dsputil.h

Originally committed as revision 5326 to svn://svn.ffmpeg.org/ffmpeg/trunk
---
 libavcodec/dsputil.h      |  1 +
 libavcodec/i386/cputest.c | 34 ++++------------------------------
 2 files changed, 5 insertions(+), 30 deletions(-)

diff --git a/libavcodec/dsputil.h b/libavcodec/dsputil.h
index 44e6a9efc7..ce37cf46e5 100644
--- a/libavcodec/dsputil.h
+++ b/libavcodec/dsputil.h
@@ -432,6 +432,7 @@ int mm_support(void);
 #define MM_SSE    0x0008 /* SSE functions */
 #define MM_SSE2   0x0010 /* PIV SSE2 functions */
 #define MM_3DNOWEXT  0x0020 /* AMD 3DNowExt */
+#define MM_SSE3   0x0040 /* Prescott SSE3 functions */
 
 extern int mm_flags;
 
diff --git a/libavcodec/i386/cputest.c b/libavcodec/i386/cputest.c
index 64656c65a5..a66bdbe988 100644
--- a/libavcodec/i386/cputest.c
+++ b/libavcodec/i386/cputest.c
@@ -64,6 +64,8 @@ int mm_support(void)
             rval |= MM_MMXEXT | MM_SSE;
         if (std_caps & (1<<26))
             rval |= MM_SSE2;
+        if (ecx & 1)
+            rval |= MM_SSE3;
     }
 
     cpuid(0x80000000, max_ext_level, ebx, ecx, edx);
@@ -76,38 +78,10 @@ int mm_support(void)
             rval |= MM_3DNOWEXT;
         if (ext_caps & (1<<23))
             rval |= MM_MMX;
+        if (ext_caps & (1<<22))
+            rval |= MM_MMXEXT;
     }
 
-    cpuid(0, eax, ebx, ecx, edx);
-    if (       ebx == 0x68747541 &&
-               edx == 0x69746e65 &&
-               ecx == 0x444d4163) {
-        /* AMD */
-        if(ext_caps & (1<<22))
-            rval |= MM_MMXEXT;
-    } else if (ebx == 0x746e6543 &&
-               edx == 0x48727561 &&
-               ecx == 0x736c7561) {  /*  "CentaurHauls" */
-        /* VIA C3 */
-        if(ext_caps & (1<<24))
-          rval |= MM_MMXEXT;
-    } else if (ebx == 0x69727943 &&
-               edx == 0x736e4978 &&
-               ecx == 0x64616574) {
-        /* Cyrix Section */
-        /* See if extended CPUID level 80000001 is supported */
-        /* The value of CPUID/80000001 for the 6x86MX is undefined
-           according to the Cyrix CPU Detection Guide (Preliminary
-           Rev. 1.01 table 1), so we'll check the value of eax for
-           CPUID/0 to see if standard CPUID level 2 is supported.
-           According to the table, the only CPU which supports level
-           2 is also the only one which supports extended CPUID levels.
-        */
-        if (eax < 2)
-            return rval;
-        if (ext_caps & (1<<24))
-            rval |= MM_MMXEXT;
-    }
 #if 0
     av_log(NULL, AV_LOG_DEBUG, "%s%s%s%s%s%s\n",
         (rval&MM_MMX) ? "MMX ":"",