diff options
author | Mike Pall <mike> | 2009-12-22 20:27:20 +0100 |
---|---|---|
committer | Mike Pall <mike> | 2009-12-22 20:27:20 +0100 |
commit | 6ce0c90ed642157f019b50ad1eb06246471a47b1 (patch) | |
tree | e3cc5e7207db2167f7f22a64ee4bfc8a93cd6ca5 /src/lib_jit.c | |
parent | a5faa29aa951d4fbd874b24350c315efc1cf3133 (diff) | |
download | luajit-6ce0c90ed642157f019b50ad1eb06246471a47b1.tar.gz luajit-6ce0c90ed642157f019b50ad1eb06246471a47b1.tar.bz2 luajit-6ce0c90ed642157f019b50ad1eb06246471a47b1.zip |
Add build infrastructure for the SSE2-enabled interpreter.
Works on x86 now. Will be enabled by default on x64 (not ready, yet).
Diffstat (limited to 'src/lib_jit.c')
-rw-r--r-- | src/lib_jit.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/src/lib_jit.c b/src/lib_jit.c index 6cd0d0b6..0352fbe5 100644 --- a/src/lib_jit.c +++ b/src/lib_jit.c | |||
@@ -524,10 +524,11 @@ static uint32_t jit_cpudetect(lua_State *L) | |||
524 | if (lj_vm_cpuid(0, vendor) && lj_vm_cpuid(1, features)) { | 524 | if (lj_vm_cpuid(0, vendor) && lj_vm_cpuid(1, features)) { |
525 | #if !LJ_HASJIT | 525 | #if !LJ_HASJIT |
526 | #define JIT_F_CMOV 1 | 526 | #define JIT_F_CMOV 1 |
527 | #define JIT_F_SSE2 2 | ||
527 | #endif | 528 | #endif |
528 | flags |= ((features[3] >> 15)&1) * JIT_F_CMOV; | 529 | flags |= ((features[3] >> 15)&1) * JIT_F_CMOV; |
529 | #if LJ_HASJIT | ||
530 | flags |= ((features[3] >> 26)&1) * JIT_F_SSE2; | 530 | flags |= ((features[3] >> 26)&1) * JIT_F_SSE2; |
531 | #if LJ_HASJIT | ||
531 | flags |= ((features[2] >> 19)&1) * JIT_F_SSE4_1; | 532 | flags |= ((features[2] >> 19)&1) * JIT_F_SSE4_1; |
532 | if (vendor[2] == 0x6c65746e) { /* Intel. */ | 533 | if (vendor[2] == 0x6c65746e) { /* Intel. */ |
533 | if ((features[0] & 0x0ff00f00) == 0x00000f00) /* P4. */ | 534 | if ((features[0] & 0x0ff00f00) == 0x00000f00) /* P4. */ |
@@ -543,13 +544,20 @@ static uint32_t jit_cpudetect(lua_State *L) | |||
543 | } | 544 | } |
544 | #endif | 545 | #endif |
545 | } | 546 | } |
546 | #ifndef LUAJIT_CPU_NOCMOV | 547 | /* Check for required instruction set support on x86. */ |
548 | #if LJ_TARGET_X86 | ||
549 | #if !defined(LUAJIT_CPU_NOCMOV) | ||
547 | if (!(flags & JIT_F_CMOV)) | 550 | if (!(flags & JIT_F_CMOV)) |
548 | luaL_error(L, "Ancient CPU lacks CMOV support (recompile with -DLUAJIT_CPU_NOCMOV)"); | 551 | luaL_error(L, "Ancient CPU lacks CMOV support (recompile with -DLUAJIT_CPU_NOCMOV)"); |
549 | #endif | 552 | #endif |
550 | #if LJ_HASJIT | ||
551 | if (!(flags & JIT_F_SSE2)) | 553 | if (!(flags & JIT_F_SSE2)) |
554 | #if defined(LUAJIT_CPU_SSE2) | ||
555 | luaL_error(L, "CPU does not support SSE2 (recompile without -DLUAJIT_CPU_SSE2)"); | ||
556 | #elif LJ_HASJIT | ||
552 | luaL_error(L, "Sorry, SSE2 CPU support required for this beta release"); | 557 | luaL_error(L, "Sorry, SSE2 CPU support required for this beta release"); |
558 | #else | ||
559 | (void)0; | ||
560 | #endif | ||
553 | #endif | 561 | #endif |
554 | UNUSED(L); | 562 | UNUSED(L); |
555 | #else | 563 | #else |