Created
August 25, 2014 22:10
-
-
Save emidoots/294e1a93d3d0f920939f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// avxSupport uses CPUID to check if the CPU supports AVX | |
// func avxSupport() bool | |
// Return: +0(FP) | |
TEXT ·avxSupport(SB),$0 | |
MOVL $0x1, AX | |
CPUID | |
// AND ECX, 0x18000000 | |
BYTE $0x81; BYTE $0xE1; BYTE $0x00; BYTE $0x00; BYTE $0x00; BYTE $0x18; | |
// CMP ECX, 0x18000000 | |
BYTE $0x81; BYTE $0xF9; BYTE $0x00; BYTE $0x00; BYTE $0x00; BYTE $0x18; | |
JNE notSupported | |
MOVB $0x1, ret+0(FP) | |
RET | |
notSupported: | |
MOVB $0x0, ret+0(FP) | |
RET |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Crap, this was 8 years ago? We're getting old. >:(