diff options
author | Mike Pall <mike> | 2013-02-21 16:56:59 +0100 |
---|---|---|
committer | Mike Pall <mike> | 2013-02-21 16:56:59 +0100 |
commit | 57768cd5882eb8d39c673d9dd8598946ef7c1843 (patch) | |
tree | f3f5663e8fb76b965e704aca33347d72cbfa3532 /src/lib_jit.c | |
parent | 61fb587d2c1646cae4c90990b9c4c1f1bff09e5b (diff) | |
download | luajit-57768cd5882eb8d39c673d9dd8598946ef7c1843.tar.gz luajit-57768cd5882eb8d39c673d9dd8598946ef7c1843.tar.bz2 luajit-57768cd5882eb8d39c673d9dd8598946ef7c1843.zip |
x86: Remove x87 support from interpreter.
SSE2 required from now on.
Diffstat (limited to 'src/lib_jit.c')
-rw-r--r-- | src/lib_jit.c | 22 |
1 files changed, 4 insertions, 18 deletions
diff --git a/src/lib_jit.c b/src/lib_jit.c index 82e68258..1b69caa5 100644 --- a/src/lib_jit.c +++ b/src/lib_jit.c | |||
@@ -538,18 +538,14 @@ static uint32_t jit_cpudetect(lua_State *L) | |||
538 | uint32_t features[4]; | 538 | uint32_t features[4]; |
539 | if (lj_vm_cpuid(0, vendor) && lj_vm_cpuid(1, features)) { | 539 | if (lj_vm_cpuid(0, vendor) && lj_vm_cpuid(1, features)) { |
540 | #if !LJ_HASJIT | 540 | #if !LJ_HASJIT |
541 | #define JIT_F_CMOV 1 | ||
542 | #define JIT_F_SSE2 2 | 541 | #define JIT_F_SSE2 2 |
543 | #endif | 542 | #endif |
544 | flags |= ((features[3] >> 15)&1) * JIT_F_CMOV; | ||
545 | flags |= ((features[3] >> 26)&1) * JIT_F_SSE2; | 543 | flags |= ((features[3] >> 26)&1) * JIT_F_SSE2; |
546 | #if LJ_HASJIT | 544 | #if LJ_HASJIT |
547 | flags |= ((features[2] >> 0)&1) * JIT_F_SSE3; | 545 | flags |= ((features[2] >> 0)&1) * JIT_F_SSE3; |
548 | flags |= ((features[2] >> 19)&1) * JIT_F_SSE4_1; | 546 | flags |= ((features[2] >> 19)&1) * JIT_F_SSE4_1; |
549 | if (vendor[2] == 0x6c65746e) { /* Intel. */ | 547 | if (vendor[2] == 0x6c65746e) { /* Intel. */ |
550 | if ((features[0] & 0x0ff00f00) == 0x00000f00) /* P4. */ | 548 | if ((features[0] & 0x0fff0ff0) == 0x000106c0) /* Atom. */ |
551 | flags |= JIT_F_P4; /* Currently unused. */ | ||
552 | else if ((features[0] & 0x0fff0ff0) == 0x000106c0) /* Atom. */ | ||
553 | flags |= JIT_F_LEA_AGU; | 549 | flags |= JIT_F_LEA_AGU; |
554 | } else if (vendor[2] == 0x444d4163) { /* AMD. */ | 550 | } else if (vendor[2] == 0x444d4163) { /* AMD. */ |
555 | uint32_t fam = (features[0] & 0x0ff00f00); | 551 | uint32_t fam = (features[0] & 0x0ff00f00); |
@@ -562,14 +558,8 @@ static uint32_t jit_cpudetect(lua_State *L) | |||
562 | } | 558 | } |
563 | /* Check for required instruction set support on x86 (unnecessary on x64). */ | 559 | /* Check for required instruction set support on x86 (unnecessary on x64). */ |
564 | #if LJ_TARGET_X86 | 560 | #if LJ_TARGET_X86 |
565 | #if !defined(LUAJIT_CPU_NOCMOV) | ||
566 | if (!(flags & JIT_F_CMOV)) | ||
567 | luaL_error(L, "CPU not supported"); | ||
568 | #endif | ||
569 | #if defined(LUAJIT_CPU_SSE2) | ||
570 | if (!(flags & JIT_F_SSE2)) | 561 | if (!(flags & JIT_F_SSE2)) |
571 | luaL_error(L, "CPU does not support SSE2 (recompile without -DLUAJIT_CPU_SSE2)"); | 562 | luaL_error(L, "CPU with SSE2 required"); |
572 | #endif | ||
573 | #endif | 563 | #endif |
574 | #elif LJ_TARGET_ARM | 564 | #elif LJ_TARGET_ARM |
575 | #if LJ_HASJIT | 565 | #if LJ_HASJIT |
@@ -631,11 +621,7 @@ static void jit_init(lua_State *L) | |||
631 | uint32_t flags = jit_cpudetect(L); | 621 | uint32_t flags = jit_cpudetect(L); |
632 | #if LJ_HASJIT | 622 | #if LJ_HASJIT |
633 | jit_State *J = L2J(L); | 623 | jit_State *J = L2J(L); |
634 | #if LJ_TARGET_X86 | 624 | J->flags = flags | JIT_F_ON | JIT_F_OPT_DEFAULT; |
635 | /* Silently turn off the JIT compiler on CPUs without SSE2. */ | ||
636 | if ((flags & JIT_F_SSE2)) | ||
637 | #endif | ||
638 | J->flags = flags | JIT_F_ON | JIT_F_OPT_DEFAULT; | ||
639 | memcpy(J->param, jit_param_default, sizeof(J->param)); | 625 | memcpy(J->param, jit_param_default, sizeof(J->param)); |
640 | lj_dispatch_update(G(L)); | 626 | lj_dispatch_update(G(L)); |
641 | #else | 627 | #else |
@@ -645,6 +631,7 @@ static void jit_init(lua_State *L) | |||
645 | 631 | ||
646 | LUALIB_API int luaopen_jit(lua_State *L) | 632 | LUALIB_API int luaopen_jit(lua_State *L) |
647 | { | 633 | { |
634 | jit_init(L); | ||
648 | lua_pushliteral(L, LJ_OS_NAME); | 635 | lua_pushliteral(L, LJ_OS_NAME); |
649 | lua_pushliteral(L, LJ_ARCH_NAME); | 636 | lua_pushliteral(L, LJ_ARCH_NAME); |
650 | lua_pushinteger(L, LUAJIT_VERSION_NUM); | 637 | lua_pushinteger(L, LUAJIT_VERSION_NUM); |
@@ -657,7 +644,6 @@ LUALIB_API int luaopen_jit(lua_State *L) | |||
657 | LJ_LIB_REG(L, "jit.opt", jit_opt); | 644 | LJ_LIB_REG(L, "jit.opt", jit_opt); |
658 | #endif | 645 | #endif |
659 | L->top -= 2; | 646 | L->top -= 2; |
660 | jit_init(L); | ||
661 | return 1; | 647 | return 1; |
662 | } | 648 | } |
663 | 649 | ||