github.com/bir3/gocompiler@v0.9.2202/extra/compress/internal/cpuinfo/cpuinfo_amd64.s (about) 1 // +build !appengine 2 // +build gc 3 // +build !noasm 4 5 #include "textflag.h" 6 #include "funcdata.h" 7 #include "go_asm.h" 8 9 TEXT ·x86extensions(SB), NOSPLIT, $0 10 // 1. determine max EAX value 11 XORQ AX, AX 12 CPUID 13 14 CMPQ AX, $7 15 JB unsupported 16 17 // 2. EAX = 7, ECX = 0 --- see Table 3-8 "Information Returned by CPUID Instruction" 18 MOVQ $7, AX 19 MOVQ $0, CX 20 CPUID 21 22 BTQ $3, BX // bit 3 = BMI1 23 SETCS AL 24 25 BTQ $8, BX // bit 8 = BMI2 26 SETCS AH 27 28 MOVB AL, bmi1+0(FP) 29 MOVB AH, bmi2+1(FP) 30 RET 31 32 unsupported: 33 XORQ AX, AX 34 MOVB AL, bmi1+0(FP) 35 MOVB AL, bmi2+1(FP) 36 RET