MOVL $0, CX
CPUID
- // If OS support for XMM and YMM is not present
- // support_avx2 will be set back to false later.
- TESTL $(1<<5), BX
- SETNE runtime·support_avx2(SB)
-
TESTL $(1<<9), BX // ERMS
SETNE runtime·support_erms(SB)
// for XMM and YMM OS support.
#ifndef GOOS_nacl
CMPB runtime·support_osxsave(SB), $1
- JNE noavx
+ JNE nocpuinfo
MOVL $0, CX
// For XGETBV, OSXSAVE bit is required and sufficient
XGETBV
ANDL $6, AX
CMPL AX, $6 // Check for OS support of XMM and YMM registers.
- JE nocpuinfo
#endif
-noavx:
- MOVB $0, runtime·support_avx2(SB)
nocpuinfo:
// if there is an _cgo_init, call it to let it
MOVL $0, CX
CPUID
- // If OS support for XMM and YMM is not present
- // support_avx2 will be set back to false later.
- TESTL $(1<<5), BX
- SETNE runtime·support_avx2(SB)
-
TESTL $(1<<9), BX // ERMS
SETNE runtime·support_erms(SB)
osavx:
CMPB runtime·support_osxsave(SB), $1
- JNE noavx
+ JNE nocpuinfo
MOVL $0, CX
// For XGETBV, OSXSAVE bit is required and sufficient
XGETBV
ANDL $6, AX
CMPL AX, $6 // Check for OS support of XMM and YMM registers.
- JE nocpuinfo
-noavx:
- MOVB $0, runtime·support_avx2(SB)
nocpuinfo:
// if there is an _cgo_init, call it.
MOVL $0, CX
CPUID
- // If OS support for XMM and YMM is not present
- // support_avx2 will be set back to false later.
- TESTL $(1<<5), BX
- SETNE runtime·support_avx2(SB)
-
TESTL $(1<<9), BX // ERMS
SETNE runtime·support_erms(SB)
// for XMM and YMM OS support.
#ifndef GOOS_nacl
CMPB runtime·support_osxsave(SB), $1
- JNE noavx
+ JNE nocpuinfo
MOVL $0, CX
// For XGETBV, OSXSAVE bit is required and sufficient
XGETBV
ANDL $6, AX
CMPL AX, $6 // Check for OS support of XMM and YMM registers.
- JE nocpuinfo
#endif
-noavx:
- MOVB $0, runtime·support_avx2(SB)
nocpuinfo:
package runtime
-import "internal/cpu"
+import (
+ "internal/cpu"
+ "unsafe"
+)
+
+// Offsets into internal/cpu records for use in assembly.
+const (
+ offsetX86HasAVX2 = unsafe.Offsetof(cpu.X86.HasAVX2)
+)
var useAVXmemmove bool
// +build !plan9
+#include "go_asm.h"
#include "textflag.h"
// NOTE: Windows externalthreadhandler expects memclr to preserve DX.
JBE _65through128
CMPQ BX, $256
JBE _129through256
- CMPB runtime·support_avx2(SB), $1
+ CMPB internal∕cpu·X86+const_offsetX86HasAVX2(SB), $1
JE loop_preheader_avx2
// TODO: use branch table and BSR to make this just a single dispatch
// TODO: for really big clears, use MOVNTDQ, even without AVX2.
processorVersionInfo uint32
isIntel bool
lfenceBeforeRdtsc bool
- support_avx2 bool
support_erms bool
support_osxsave bool
support_popcnt bool