aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMike Pall <mike>2012-07-08 22:20:11 +0200
committerMike Pall <mike>2012-07-08 22:20:11 +0200
commitb23a7830d23b80bb3f78ec9a9416d3b8119733e7 (patch)
tree700e11037662d1356342675ebfedfeefcd8de410 /src
parentc00ffcb870cd51849ee2a0f1bf1862ac965026b7 (diff)
downloadluajit-b23a7830d23b80bb3f78ec9a9416d3b8119733e7.tar.gz
luajit-b23a7830d23b80bb3f78ec9a9416d3b8119733e7.tar.bz2
luajit-b23a7830d23b80bb3f78ec9a9416d3b8119733e7.zip
Clean up ARM capability flags. Only set highest arch version.
Diffstat (limited to 'src')
-rw-r--r--src/lib_jit.c20
-rw-r--r--src/lj_jit.h14
2 files changed, 18 insertions, 16 deletions
diff --git a/src/lib_jit.c b/src/lib_jit.c
index 3687ad76..ba07ac29 100644
--- a/src/lib_jit.c
+++ b/src/lib_jit.c
@@ -590,27 +590,23 @@ static uint32_t jit_cpudetect(lua_State *L)
590#endif 590#endif
591#elif LJ_TARGET_ARM 591#elif LJ_TARGET_ARM
592#if LJ_HASJIT 592#if LJ_HASJIT
593 /* Compile-time ARM CPU detection. */ 593 int ver = LJ_ARCH_VERSION; /* Compile-time ARM CPU detection. */
594#if LJ_ARCH_VERSION >= 70
595 flags |= JIT_F_ARMV6|JIT_F_ARMV6T2|JIT_F_ARMV7;
596#elif LJ_ARCH_VERSION >= 61
597 flags |= JIT_F_ARMV6|JIT_F_ARMV6T2;
598#elif LJ_ARCH_VERSION >= 60
599 flags |= JIT_F_ARMV6;
600#endif
601 /* Runtime ARM CPU detection. */
602#if LJ_TARGET_LINUX 594#if LJ_TARGET_LINUX
603 if (!(flags & JIT_F_ARMV7)) { 595 if (ver < 70) { /* Runtime ARM CPU detection. */
604 struct utsname ut; 596 struct utsname ut;
605 uname(&ut); 597 uname(&ut);
606 if (strncmp(ut.machine, "armv", 4) == 0) { 598 if (strncmp(ut.machine, "armv", 4) == 0) {
607 if (ut.machine[4] >= '7') 599 if (ut.machine[4] >= '7')
608 flags |= JIT_F_ARMV6|JIT_F_ARMV6T2|JIT_F_ARMV7; 600 ver = 70;
609 else if (ut.machine[4] == '6') 601 else if (ut.machine[4] == '6')
610 flags |= JIT_F_ARMV6; 602 ver = 60;
611 } 603 }
612 } 604 }
613#endif 605#endif
606 flags |= ver >= 70 ? JIT_F_ARMV7 :
607 ver >= 61 ? JIT_F_ARMV6T2_ :
608 ver >= 60 ? JIT_F_ARMV6_ : 0;
609 flags |= LJ_ARCH_HASFPU == 0 ? 0 : ver >= 70 ? JIT_F_VFPV3 : JIT_F_VFPV2;
614#endif 610#endif
615#elif LJ_TARGET_PPC 611#elif LJ_TARGET_PPC
616#if LJ_HASJIT 612#if LJ_HASJIT
diff --git a/src/lj_jit.h b/src/lj_jit.h
index 517b3264..1ec54fe7 100644
--- a/src/lj_jit.h
+++ b/src/lj_jit.h
@@ -27,13 +27,19 @@
27#define JIT_F_CPU_FIRST JIT_F_CMOV 27#define JIT_F_CPU_FIRST JIT_F_CMOV
28#define JIT_F_CPUSTRING "\4CMOV\4SSE2\4SSE3\6SSE4.1\2P4\3AMD\2K8\4ATOM" 28#define JIT_F_CPUSTRING "\4CMOV\4SSE2\4SSE3\6SSE4.1\2P4\3AMD\2K8\4ATOM"
29#elif LJ_TARGET_ARM 29#elif LJ_TARGET_ARM
30#define JIT_F_ARMV6 0x00000010 30#define JIT_F_ARMV6_ 0x00000010
31#define JIT_F_ARMV6T2 0x00000020 31#define JIT_F_ARMV6T2_ 0x00000020
32#define JIT_F_ARMV7 0x00000040 32#define JIT_F_ARMV7 0x00000040
33#define JIT_F_VFPV2 0x00000080
34#define JIT_F_VFPV3 0x00000100
35
36#define JIT_F_ARMV6 (JIT_F_ARMV6_|JIT_F_ARMV6T2_|JIT_F_ARMV7)
37#define JIT_F_ARMV6T2 (JIT_F_ARMV6T2_|JIT_F_ARMV7)
38#define JIT_F_VFP (JIT_F_VFPV2|JIT_F_VFPV3)
33 39
34/* Names for the CPU-specific flags. Must match the order above. */ 40/* Names for the CPU-specific flags. Must match the order above. */
35#define JIT_F_CPU_FIRST JIT_F_ARMV6 41#define JIT_F_CPU_FIRST JIT_F_ARMV6_
36#define JIT_F_CPUSTRING "\5ARMv6\7ARMv6T2\5ARMv7" 42#define JIT_F_CPUSTRING "\5ARMv6\7ARMv6T2\5ARMv7\5VFPv2\5VFPv3"
37#elif LJ_TARGET_PPC 43#elif LJ_TARGET_PPC
38#define JIT_F_SQRT 0x00000010 44#define JIT_F_SQRT 0x00000010
39#define JIT_F_ROUND 0x00000020 45#define JIT_F_ROUND 0x00000020