x86: Remove x87 support from interpreter.

SSE2 required from now on.
This commit is contained in:
Mike Pall
2013-02-21 16:56:59 +01:00
parent 61fb587d2c
commit 57768cd588
7 changed files with 100 additions and 645 deletions

View File

@@ -538,18 +538,14 @@ static uint32_t jit_cpudetect(lua_State *L)
uint32_t features[4];
if (lj_vm_cpuid(0, vendor) && lj_vm_cpuid(1, features)) {
#if !LJ_HASJIT
#define JIT_F_CMOV 1
#define JIT_F_SSE2 2
#endif
flags |= ((features[3] >> 15)&1) * JIT_F_CMOV;
flags |= ((features[3] >> 26)&1) * JIT_F_SSE2;
#if LJ_HASJIT
flags |= ((features[2] >> 0)&1) * JIT_F_SSE3;
flags |= ((features[2] >> 19)&1) * JIT_F_SSE4_1;
if (vendor[2] == 0x6c65746e) { /* Intel. */
if ((features[0] & 0x0ff00f00) == 0x00000f00) /* P4. */
flags |= JIT_F_P4; /* Currently unused. */
else if ((features[0] & 0x0fff0ff0) == 0x000106c0) /* Atom. */
if ((features[0] & 0x0fff0ff0) == 0x000106c0) /* Atom. */
flags |= JIT_F_LEA_AGU;
} else if (vendor[2] == 0x444d4163) { /* AMD. */
uint32_t fam = (features[0] & 0x0ff00f00);
@@ -562,14 +558,8 @@ static uint32_t jit_cpudetect(lua_State *L)
}
/* Check for required instruction set support on x86 (unnecessary on x64). */
#if LJ_TARGET_X86
#if !defined(LUAJIT_CPU_NOCMOV)
if (!(flags & JIT_F_CMOV))
luaL_error(L, "CPU not supported");
#endif
#if defined(LUAJIT_CPU_SSE2)
if (!(flags & JIT_F_SSE2))
luaL_error(L, "CPU does not support SSE2 (recompile without -DLUAJIT_CPU_SSE2)");
#endif
luaL_error(L, "CPU with SSE2 required");
#endif
#elif LJ_TARGET_ARM
#if LJ_HASJIT
@@ -631,11 +621,7 @@ static void jit_init(lua_State *L)
uint32_t flags = jit_cpudetect(L);
#if LJ_HASJIT
jit_State *J = L2J(L);
#if LJ_TARGET_X86
/* Silently turn off the JIT compiler on CPUs without SSE2. */
if ((flags & JIT_F_SSE2))
#endif
J->flags = flags | JIT_F_ON | JIT_F_OPT_DEFAULT;
J->flags = flags | JIT_F_ON | JIT_F_OPT_DEFAULT;
memcpy(J->param, jit_param_default, sizeof(J->param));
lj_dispatch_update(G(L));
#else
@@ -645,6 +631,7 @@ static void jit_init(lua_State *L)
LUALIB_API int luaopen_jit(lua_State *L)
{
jit_init(L);
lua_pushliteral(L, LJ_OS_NAME);
lua_pushliteral(L, LJ_ARCH_NAME);
lua_pushinteger(L, LUAJIT_VERSION_NUM);
@@ -657,7 +644,6 @@ LUALIB_API int luaopen_jit(lua_State *L)
LJ_LIB_REG(L, "jit.opt", jit_opt);
#endif
L->top -= 2;
jit_init(L);
return 1;
}