summaryrefslogtreecommitdiff
path: root/src/lib_jit.c
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/lib_jit.c
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/lib_jit.c')
-rw-r--r--src/lib_jit.c20
1 files changed, 8 insertions, 12 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