mirror of
https://github.com/LuaJIT/LuaJIT.git
synced 2025-02-07 23:24:09 +00:00
x86: Remove x87 support from interpreter.
SSE2 required from now on.
This commit is contained in:
parent
61fb587d2c
commit
57768cd588
11
src/Makefile
11
src/Makefile
@ -42,13 +42,10 @@ CCOPT= -O2 -fomit-frame-pointer
|
||||
#
|
||||
# Target-specific compiler options:
|
||||
#
|
||||
# x86 only: it's recommended to compile at least for i686. Better yet,
|
||||
# compile for an architecture that has SSE2, too (-msse -msse2).
|
||||
#
|
||||
# x86/x64 only: For GCC 4.2 or higher and if you don't intend to distribute
|
||||
# the binaries to a different machine you could also use: -march=native
|
||||
#
|
||||
CCOPT_x86= -march=i686
|
||||
CCOPT_x86= -march=i686 -msse -msse2 -mfpmath=sse
|
||||
CCOPT_x64=
|
||||
CCOPT_arm=
|
||||
CCOPT_ppc=
|
||||
@ -394,11 +391,6 @@ DASM_AFLAGS+= -D VER=$(subst LJ_ARCH_VERSION_,,$(filter LJ_ARCH_VERSION_%,$(subs
|
||||
ifeq (Windows,$(TARGET_SYS))
|
||||
DASM_AFLAGS+= -D WIN
|
||||
endif
|
||||
ifeq (x86,$(TARGET_LJARCH))
|
||||
ifneq (,$(findstring __SSE2__ 1,$(TARGET_TESTARCH)))
|
||||
DASM_AFLAGS+= -D SSE
|
||||
endif
|
||||
else
|
||||
ifeq (x64,$(TARGET_LJARCH))
|
||||
DASM_ARCH= x86
|
||||
else
|
||||
@ -423,7 +415,6 @@ ifeq (ppc,$(TARGET_LJARCH))
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
DASM_FLAGS= $(DASM_XFLAGS) $(DASM_AFLAGS)
|
||||
DASM_DASC= vm_$(DASM_ARCH).dasc
|
||||
|
@ -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,10 +621,6 @@ 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;
|
||||
memcpy(J->param, jit_param_default, sizeof(J->param));
|
||||
lj_dispatch_update(G(L));
|
||||
@ -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;
|
||||
}
|
||||
|
||||
|
@ -1730,7 +1730,7 @@ static void asm_setup_regsp(ASMState *as)
|
||||
break;
|
||||
case IR_FPMATH:
|
||||
#if LJ_TARGET_X86ORX64
|
||||
if (ir->op2 == IRFPM_EXP2) { /* May be joined to lj_vm_pow_sse. */
|
||||
if (ir->op2 == IRFPM_EXP2) { /* May be joined to pow. */
|
||||
ir->prev = REGSP_HINT(RID_XMM0);
|
||||
#if !LJ_64
|
||||
if (as->evenspill < 4) /* Leave room for 16 byte scratch area. */
|
||||
|
18
src/lj_jit.h
18
src/lj_jit.h
@ -14,18 +14,16 @@
|
||||
|
||||
/* CPU-specific JIT engine flags. */
|
||||
#if LJ_TARGET_X86ORX64
|
||||
#define JIT_F_CMOV 0x00000010
|
||||
#define JIT_F_SSE2 0x00000020
|
||||
#define JIT_F_SSE3 0x00000040
|
||||
#define JIT_F_SSE4_1 0x00000080
|
||||
#define JIT_F_P4 0x00000100
|
||||
#define JIT_F_PREFER_IMUL 0x00000200
|
||||
#define JIT_F_SPLIT_XMM 0x00000400
|
||||
#define JIT_F_LEA_AGU 0x00000800
|
||||
#define JIT_F_SSE2 0x00000010
|
||||
#define JIT_F_SSE3 0x00000020
|
||||
#define JIT_F_SSE4_1 0x00000040
|
||||
#define JIT_F_PREFER_IMUL 0x00000080
|
||||
#define JIT_F_SPLIT_XMM 0x00000100
|
||||
#define JIT_F_LEA_AGU 0x00000200
|
||||
|
||||
/* Names for the CPU-specific flags. Must match the order above. */
|
||||
#define JIT_F_CPU_FIRST JIT_F_CMOV
|
||||
#define JIT_F_CPUSTRING "\4CMOV\4SSE2\4SSE3\6SSE4.1\2P4\3AMD\2K8\4ATOM"
|
||||
#define JIT_F_CPU_FIRST JIT_F_SSE2
|
||||
#define JIT_F_CPUSTRING "\4SSE2\4SSE3\6SSE4.1\3AMD\2K8\4ATOM"
|
||||
#elif LJ_TARGET_ARM
|
||||
#define JIT_F_ARMV6_ 0x00000010
|
||||
#define JIT_F_ARMV6T2_ 0x00000020
|
||||
|
@ -49,12 +49,14 @@ LJ_ASMF void lj_vm_exit_handler(void);
|
||||
LJ_ASMF void lj_vm_exit_interp(void);
|
||||
|
||||
/* Internal math helper functions. */
|
||||
#if LJ_TARGET_X86ORX64 || LJ_TARGET_PPC
|
||||
#if LJ_TARGET_PPC
|
||||
#define lj_vm_floor floor
|
||||
#define lj_vm_ceil ceil
|
||||
#else
|
||||
LJ_ASMF double lj_vm_floor(double);
|
||||
#if !LJ_TARGET_X86ORX64
|
||||
LJ_ASMF double lj_vm_ceil(double);
|
||||
#endif
|
||||
#if LJ_TARGET_ARM
|
||||
LJ_ASMF double lj_vm_floor_sf(double);
|
||||
LJ_ASMF double lj_vm_ceil_sf(double);
|
||||
|
@ -35,6 +35,7 @@ if exist minilua.exe.manifest^
|
||||
@if errorlevel 8 goto :X64
|
||||
@set DASMFLAGS=-D WIN -D JIT -D FFI
|
||||
@set LJARCH=x86
|
||||
@set LJCOMPILE=%LJCOMPILE% /arch:SSE2
|
||||
:X64
|
||||
minilua %DASM% -LN %DASMFLAGS% -o host\buildvm_arch.h vm_x86.dasc
|
||||
@if errorlevel 1 goto :BAD
|
||||
|
643
src/vm_x86.dasc
643
src/vm_x86.dasc
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user