diff options
Diffstat (limited to 'src/lib_jit.c')
-rw-r--r-- | src/lib_jit.c | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/src/lib_jit.c b/src/lib_jit.c index 259a03e1..6e16d45b 100644 --- a/src/lib_jit.c +++ b/src/lib_jit.c | |||
@@ -520,6 +520,10 @@ JIT_PARAMDEF(JIT_PARAMINIT) | |||
520 | }; | 520 | }; |
521 | #endif | 521 | #endif |
522 | 522 | ||
523 | #if LJ_TARGET_ARM && LJ_TARGET_LINUX | ||
524 | #include <sys/utsname.h> | ||
525 | #endif | ||
526 | |||
523 | /* Arch-dependent CPU detection. */ | 527 | /* Arch-dependent CPU detection. */ |
524 | static uint32_t jit_cpudetect(lua_State *L) | 528 | static uint32_t jit_cpudetect(lua_State *L) |
525 | { | 529 | { |
@@ -563,7 +567,27 @@ static uint32_t jit_cpudetect(lua_State *L) | |||
563 | #endif | 567 | #endif |
564 | #endif | 568 | #endif |
565 | #elif LJ_TARGET_ARM | 569 | #elif LJ_TARGET_ARM |
566 | /* NYI */ | 570 | /* Compile-time ARM CPU detection. */ |
571 | #if __ARM_ARCH_7__ || __ARM_ARCH_7A__ || __ARM_ARCH_7R__ | ||
572 | flags |= JIT_F_ARMV6|JIT_F_ARMV6T2|JIT_F_ARMV7; | ||
573 | #elif __ARM_ARCH_6T2__ | ||
574 | flags |= JIT_F_ARMV6|JIT_F_ARMV6T2; | ||
575 | #elif __ARM_ARCH_6__ || __ARM_ARCH_6J__ || __ARM_ARCH_6Z__ || __ARM_ARCH_6ZK__ | ||
576 | flags |= JIT_F_ARMV6; | ||
577 | #endif | ||
578 | /* Runtime ARM CPU detection. */ | ||
579 | #if LJ_TARGET_LINUX | ||
580 | if (!(flags & JIT_F_ARMV7)) { | ||
581 | struct utsname ut; | ||
582 | uname(&ut); | ||
583 | if (strncmp(ut.machine, "armv", 4) == 0) { | ||
584 | if (ut.machine[4] >= '7') | ||
585 | flags |= JIT_F_ARMV6|JIT_F_ARMV6T2|JIT_F_ARMV7; | ||
586 | else if (ut.machine[4] == '6') | ||
587 | flags |= JIT_F_ARMV6; | ||
588 | } | ||
589 | } | ||
590 | #endif | ||
567 | #elif LJ_TARGET_PPC | 591 | #elif LJ_TARGET_PPC |
568 | /* Nothing to do. */ | 592 | /* Nothing to do. */ |
569 | #else | 593 | #else |