]> git.sesse.net Git - ffmpeg/commitdiff
x86: Add CPU flag for the i686 cmov instruction
authorDiego Biurrun <diego@biurrun.de>
Tue, 19 Jun 2012 20:55:26 +0000 (22:55 +0200)
committerDiego Biurrun <diego@biurrun.de>
Sat, 23 Jun 2012 14:21:50 +0000 (16:21 +0200)
libavutil/cpu.c
libavutil/cpu.h
libavutil/x86/cpu.c

index 6532744d2b7397a6cee63b47d7460c022b9565a5..c641106fff5fc7226361a1b7d088cad11d6ee5e6 100644 (file)
@@ -47,7 +47,7 @@ void av_set_cpu_flags_mask(int mask)
 
 int av_parse_cpu_flags(const char *s)
 {
-#define CPUFLAG_MMX2     (AV_CPU_FLAG_MMX      | AV_CPU_FLAG_MMX2)
+#define CPUFLAG_MMX2     (AV_CPU_FLAG_MMX      | AV_CPU_FLAG_MMX2 | AV_CPU_FLAG_CMOV)
 #define CPUFLAG_3DNOW    (AV_CPU_FLAG_3DNOW    | AV_CPU_FLAG_MMX)
 #define CPUFLAG_3DNOWEXT (AV_CPU_FLAG_3DNOWEXT | CPUFLAG_3DNOW)
 #define CPUFLAG_SSE      (AV_CPU_FLAG_SSE      | CPUFLAG_MMX2)
@@ -82,6 +82,7 @@ int av_parse_cpu_flags(const char *s)
         { "fma4"    , NULL, 0, AV_OPT_TYPE_CONST, { CPUFLAG_FMA4         },    .unit = "flags" },
         { "3dnow"   , NULL, 0, AV_OPT_TYPE_CONST, { CPUFLAG_3DNOW        },    .unit = "flags" },
         { "3dnowext", NULL, 0, AV_OPT_TYPE_CONST, { CPUFLAG_3DNOWEXT     },    .unit = "flags" },
+        { "cmov",     NULL, 0, AV_OPT_TYPE_CONST, { AV_CPU_FLAG_CMOV     },    .unit = "flags" },
 #elif ARCH_ARM
         { "armv5te",  NULL, 0, AV_OPT_TYPE_CONST, { AV_CPU_FLAG_ARMV5TE  },    .unit = "flags" },
         { "armv6",    NULL, 0, AV_OPT_TYPE_CONST, { AV_CPU_FLAG_ARMV6    },    .unit = "flags" },
@@ -143,6 +144,7 @@ static const struct {
     { AV_CPU_FLAG_FMA4,      "fma4"       },
     { AV_CPU_FLAG_3DNOW,     "3dnow"      },
     { AV_CPU_FLAG_3DNOWEXT,  "3dnowext"   },
+    { AV_CPU_FLAG_CMOV,      "cmov"       },
 #endif
     { 0 }
 };
index 15c0088b7fe872e54fedc723dd594d4d36451b91..f477c83e13913b5f24e12f583e763b5ef68f74b0 100644 (file)
@@ -40,6 +40,8 @@
 #define AV_CPU_FLAG_AVX          0x4000 ///< AVX functions: requires OS support even if YMM registers aren't used
 #define AV_CPU_FLAG_XOP          0x0400 ///< Bulldozer XOP functions
 #define AV_CPU_FLAG_FMA4         0x0800 ///< Bulldozer FMA4 functions
+#define AV_CPU_FLAG_CMOV         0x1000 ///< i686 cmov
+
 #define AV_CPU_FLAG_ALTIVEC      0x0001 ///< standard
 
 #define AV_CPU_FLAG_ARMV5TE      (1 << 0)
index 2424fe451648645db76801618ff9b449651e9d13..b87d3a3a92ff2359116e5958db9187cb26413a51 100644 (file)
@@ -83,6 +83,8 @@ int ff_get_cpu_flags_x86(void)
         cpuid(1, eax, ebx, ecx, std_caps);
         family = ((eax>>8)&0xf) + ((eax>>20)&0xff);
         model  = ((eax>>4)&0xf) + ((eax>>12)&0xf0);
+        if (std_caps & (1 << 15))
+            rval |= AV_CPU_FLAG_CMOV;
         if (std_caps & (1<<23))
             rval |= AV_CPU_FLAG_MMX;
         if (std_caps & (1<<25))