diff options
Diffstat (limited to 'src/runtime/asm_amd64.s')
-rw-r--r-- | src/runtime/asm_amd64.s | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/src/runtime/asm_amd64.s b/src/runtime/asm_amd64.s index 0070e9d203..cb428d6de3 100644 --- a/src/runtime/asm_amd64.s +++ b/src/runtime/asm_amd64.s @@ -75,11 +75,24 @@ no7: TESTL $(1<<5), runtime·cpuid_ebx7(SB) // check for AVX2 bit JEQ noavx2 MOVB $1, runtime·support_avx2(SB) - JMP nocpuinfo + JMP testbmi1 noavx: MOVB $0, runtime·support_avx(SB) noavx2: MOVB $0, runtime·support_avx2(SB) +testbmi1: + // Detect BMI1 and BMI2 extensions as per + // 5.1.16.1 Detection of VEX-encoded GPR Instructions, + // LZCNT and TZCNT, PREFETCHW chapter of [1] + MOVB $0, runtime·support_bmi1(SB) + TESTL $(1<<3), runtime·cpuid_ebx7(SB) // check for BMI1 bit + JEQ testbmi2 + MOVB $1, runtime·support_bmi1(SB) +testbmi2: + MOVB $0, runtime·support_bmi2(SB) + TESTL $(1<<8), runtime·cpuid_ebx7(SB) // check for BMI2 bit + JEQ nocpuinfo + MOVB $1, runtime·support_bmi2(SB) nocpuinfo: // if there is an _cgo_init, call it. |