mirror of
https://github.com/LuaJIT/LuaJIT.git
synced 2025-02-07 23:24:09 +00:00
x86: Detect BMI2 instruction support.
This commit is contained in:
parent
c24c8e5312
commit
6801e7165c
@ -668,6 +668,11 @@ static uint32_t jit_cpudetect(lua_State *L)
|
|||||||
if (fam >= 0x00000f00) /* K8, K10. */
|
if (fam >= 0x00000f00) /* K8, K10. */
|
||||||
flags |= JIT_F_PREFER_IMUL;
|
flags |= JIT_F_PREFER_IMUL;
|
||||||
}
|
}
|
||||||
|
if (vendor[0] >= 7) {
|
||||||
|
uint32_t xfeatures[4];
|
||||||
|
lj_vm_cpuid(7, xfeatures);
|
||||||
|
flags |= ((xfeatures[1] >> 8)&1) * JIT_F_BMI2;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
/* Check for required instruction set support on x86 (unnecessary on x64). */
|
/* Check for required instruction set support on x86 (unnecessary on x64). */
|
||||||
|
@ -19,10 +19,11 @@
|
|||||||
#define JIT_F_SSE4_1 0x00000040
|
#define JIT_F_SSE4_1 0x00000040
|
||||||
#define JIT_F_PREFER_IMUL 0x00000080
|
#define JIT_F_PREFER_IMUL 0x00000080
|
||||||
#define JIT_F_LEA_AGU 0x00000100
|
#define JIT_F_LEA_AGU 0x00000100
|
||||||
|
#define JIT_F_BMI2 0x00000200
|
||||||
|
|
||||||
/* Names for the CPU-specific flags. Must match the order above. */
|
/* Names for the CPU-specific flags. Must match the order above. */
|
||||||
#define JIT_F_CPU_FIRST JIT_F_SSE2
|
#define JIT_F_CPU_FIRST JIT_F_SSE2
|
||||||
#define JIT_F_CPUSTRING "\4SSE2\4SSE3\6SSE4.1\3AMD\4ATOM"
|
#define JIT_F_CPUSTRING "\4SSE2\4SSE3\6SSE4.1\3AMD\4ATOM\4BMI2"
|
||||||
#elif LJ_TARGET_ARM
|
#elif LJ_TARGET_ARM
|
||||||
#define JIT_F_ARMV6_ 0x00000010
|
#define JIT_F_ARMV6_ 0x00000010
|
||||||
#define JIT_F_ARMV6T2_ 0x00000020
|
#define JIT_F_ARMV6T2_ 0x00000020
|
||||||
|
@ -2639,6 +2639,7 @@ static void build_subroutines(BuildCtx *ctx)
|
|||||||
| mov eax, CARG1d
|
| mov eax, CARG1d
|
||||||
| .if X64WIN; push rsi; mov rsi, CARG2; .endif
|
| .if X64WIN; push rsi; mov rsi, CARG2; .endif
|
||||||
| push rbx
|
| push rbx
|
||||||
|
| xor ecx, ecx
|
||||||
| cpuid
|
| cpuid
|
||||||
| mov [rsi], eax
|
| mov [rsi], eax
|
||||||
| mov [rsi+4], ebx
|
| mov [rsi+4], ebx
|
||||||
|
@ -3026,6 +3026,7 @@ static void build_subroutines(BuildCtx *ctx)
|
|||||||
| mov eax, CARG1d
|
| mov eax, CARG1d
|
||||||
| .if X64WIN; push rsi; mov rsi, CARG2; .endif
|
| .if X64WIN; push rsi; mov rsi, CARG2; .endif
|
||||||
| push rbx
|
| push rbx
|
||||||
|
| xor ecx, ecx
|
||||||
| cpuid
|
| cpuid
|
||||||
| mov [rsi], eax
|
| mov [rsi], eax
|
||||||
| mov [rsi+4], ebx
|
| mov [rsi+4], ebx
|
||||||
@ -3049,6 +3050,7 @@ static void build_subroutines(BuildCtx *ctx)
|
|||||||
| mov eax, [esp+4] // Argument 1 is function number.
|
| mov eax, [esp+4] // Argument 1 is function number.
|
||||||
| push edi
|
| push edi
|
||||||
| push ebx
|
| push ebx
|
||||||
|
| xor ecx, ecx
|
||||||
| cpuid
|
| cpuid
|
||||||
| mov edi, [esp+16] // Argument 2 is result area.
|
| mov edi, [esp+16] // Argument 2 is result area.
|
||||||
| mov [edi], eax
|
| mov [edi], eax
|
||||||
|
Loading…
Reference in New Issue
Block a user