]> git.ipfire.org Git - thirdparty/LuaJIT.git/commitdiff
Clean up ARM capability flags. Only set highest arch version.
authorMike Pall <mike>
Sun, 8 Jul 2012 20:20:11 +0000 (22:20 +0200)
committerMike Pall <mike>
Sun, 8 Jul 2012 20:20:11 +0000 (22:20 +0200)
src/lib_jit.c
src/lj_jit.h

index 3687ad760b7ccdc14e1be22601117ebd99d6da4a..ba07ac295df0c3ebeef9077bdcf66cac6672a37b 100644 (file)
@@ -590,27 +590,23 @@ static uint32_t jit_cpudetect(lua_State *L)
 #endif
 #elif LJ_TARGET_ARM
 #if LJ_HASJIT
-  /* Compile-time ARM CPU detection. */
-#if LJ_ARCH_VERSION >= 70
-  flags |= JIT_F_ARMV6|JIT_F_ARMV6T2|JIT_F_ARMV7;
-#elif LJ_ARCH_VERSION >= 61
-  flags |= JIT_F_ARMV6|JIT_F_ARMV6T2;
-#elif LJ_ARCH_VERSION >= 60
-  flags |= JIT_F_ARMV6;
-#endif
-  /* Runtime ARM CPU detection. */
+  int ver = LJ_ARCH_VERSION;  /* Compile-time ARM CPU detection. */
 #if LJ_TARGET_LINUX
-  if (!(flags & JIT_F_ARMV7)) {
+  if (ver < 70) {  /* Runtime ARM CPU detection. */
     struct utsname ut;
     uname(&ut);
     if (strncmp(ut.machine, "armv", 4) == 0) {
       if (ut.machine[4] >= '7')
-       flags |= JIT_F_ARMV6|JIT_F_ARMV6T2|JIT_F_ARMV7;
+       ver = 70;
       else if (ut.machine[4] == '6')
-       flags |= JIT_F_ARMV6;
+       ver = 60;
     }
   }
 #endif
+  flags |= ver >= 70 ? JIT_F_ARMV7 :
+          ver >= 61 ? JIT_F_ARMV6T2_ :
+          ver >= 60 ? JIT_F_ARMV6_ : 0;
+  flags |= LJ_ARCH_HASFPU == 0 ? 0 : ver >= 70 ? JIT_F_VFPV3 : JIT_F_VFPV2;
 #endif
 #elif LJ_TARGET_PPC
 #if LJ_HASJIT
index 517b326496b3045a25bab8ab2bde7de6417b7d06..1ec54fe74fe10ba9cd5dce29100cc904df670440 100644 (file)
 #define JIT_F_CPU_FIRST                JIT_F_CMOV
 #define JIT_F_CPUSTRING                "\4CMOV\4SSE2\4SSE3\6SSE4.1\2P4\3AMD\2K8\4ATOM"
 #elif LJ_TARGET_ARM
-#define JIT_F_ARMV6            0x00000010
-#define JIT_F_ARMV6T2          0x00000020
+#define JIT_F_ARMV6_           0x00000010
+#define JIT_F_ARMV6T2_         0x00000020
 #define JIT_F_ARMV7            0x00000040
+#define JIT_F_VFPV2            0x00000080
+#define JIT_F_VFPV3            0x00000100
+
+#define JIT_F_ARMV6            (JIT_F_ARMV6_|JIT_F_ARMV6T2_|JIT_F_ARMV7)
+#define JIT_F_ARMV6T2          (JIT_F_ARMV6T2_|JIT_F_ARMV7)
+#define JIT_F_VFP              (JIT_F_VFPV2|JIT_F_VFPV3)
 
 /* Names for the CPU-specific flags. Must match the order above. */
-#define JIT_F_CPU_FIRST                JIT_F_ARMV6
-#define JIT_F_CPUSTRING                "\5ARMv6\7ARMv6T2\5ARMv7"
+#define JIT_F_CPU_FIRST                JIT_F_ARMV6_
+#define JIT_F_CPUSTRING                "\5ARMv6\7ARMv6T2\5ARMv7\5VFPv2\5VFPv3"
 #elif LJ_TARGET_PPC
 #define JIT_F_SQRT             0x00000010
 #define JIT_F_ROUND            0x00000020