summaryrefslogtreecommitdiff
path: root/src/lib_jit.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib_jit.c')
-rw-r--r--src/lib_jit.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/src/lib_jit.c b/src/lib_jit.c
index 05a79d51..7d5e0aef 100644
--- a/src/lib_jit.c
+++ b/src/lib_jit.c
@@ -615,7 +615,21 @@ static uint32_t jit_cpudetect(lua_State *L)
615#elif LJ_TARGET_PPC || LJ_TARGET_PPCSPE 615#elif LJ_TARGET_PPC || LJ_TARGET_PPCSPE
616 /* Nothing to do. */ 616 /* Nothing to do. */
617#elif LJ_TARGET_MIPS 617#elif LJ_TARGET_MIPS
618 /* NYI */ 618#if LJ_HASJIT
619 /* Compile-time MIPS CPU detection. */
620#if _MIPS_ARCH_MIPS32R2
621 flags |= JIT_F_MIPS32R2;
622#endif
623 /* Runtime MIPS CPU detection. */
624#if defined(__GNUC__)
625 if (!(flags & JIT_F_MIPS32R2)) {
626 int x;
627 /* On MIPS32R1 rotr is treated as srl. rotr r2,r2,1 -> srl r2,r2,1. */
628 __asm__("li $2, 1\n\t.long 0x00221042\n\tmove %0, $2" : "=r"(x) : : "$2");
629 if (x) flags |= JIT_F_MIPS32R2; /* Either 0x80000000 (R2) or 0 (R1). */
630 }
631#endif
632#endif
619#else 633#else
620#error "Missing CPU detection for this architecture" 634#error "Missing CPU detection for this architecture"
621#endif 635#endif