@@ -93,7 +93,8 @@ const (
9393 AVX512VNNI // AVX-512 Vector Neural Network Instructions
9494 AVX512VP2INTERSECT // AVX-512 Intersect for D/Q
9595 AVX512VPOPCNTDQ // AVX-512 Vector Population Count Doubleword and Quadword
96- AVXSLOW // Indicates the CPU performs 2 128 bit operations instead of one.
96+ AVXSLOW // Indicates the CPU performs 2 128 bit operations instead of one
97+ AVXVNNI // AVX (VEX encoded) VNNI neural network instructions
9798 BMI1 // Bit Manipulation Instruction Set 1
9899 BMI2 // Bit Manipulation Instruction Set 2
99100 CETIBT // Intel CET Indirect Branch Tracking
@@ -102,6 +103,7 @@ const (
102103 CLMUL // Carry-less Multiplication
103104 CLZERO // CLZERO instruction supported
104105 CMOV // i686 CMOV
106+ CMPSB_SCADBS_SHORT // Fast short CMPSB and SCASB
105107 CMPXCHG8 // CMPXCHG8 instruction
106108 CPBOOST // Core Performance Boost
107109 CX16 // CMPXCHG16B Instruction
@@ -114,6 +116,7 @@ const (
114116 FXSROPT // FXSAVE/FXRSTOR optimizations
115117 GFNI // Galois Field New Instructions. May require other features (AVX, AVX512VL,AVX512F) based on usage.
116118 HLE // Hardware Lock Elision
119+ HRESET // If set CPU supports history reset and the IA32_HRESET_ENABLE MSR
117120 HTT // Hyperthreading (enabled)
118121 HWA // Hardware assert supported. Indicates support for MSRC001_10
119122 HYPERVISOR // This bit has been reserved by Intel & AMD for use by hypervisors
@@ -131,6 +134,7 @@ const (
131134 INT_WBINVD // WBINVD/WBNOINVD are interruptible.
132135 INVLPGB // NVLPGB and TLBSYNC instruction supported
133136 LAHF // LAHF/SAHF in long mode
137+ LAM // If set, CPU supports Linear Address Masking
134138 LBRVIRT // LBR virtualization
135139 LZCNT // LZCNT instruction
136140 MCAOVERFLOW // MCA overflow recovery support.
@@ -140,6 +144,7 @@ const (
140144 MOVBE // MOVBE instruction (big-endian)
141145 MOVDIR64B // Move 64 Bytes as Direct Store
142146 MOVDIRI // Move Doubleword as Direct Store
147+ MOVSB_ZL // Fast Zero-Length MOVSB
143148 MPX // Intel MPX (Memory Protection Extensions)
144149 MSRIRC // Instruction Retired Counter MSR available
145150 MSR_PAGEFLUSH // Page Flush MSR available
@@ -176,6 +181,7 @@ const (
176181 SSE4A // AMD Barcelona microarchitecture SSE4a instructions
177182 SSSE3 // Conroe SSSE3 functions
178183 STIBP // Single Thread Indirect Branch Predictors
184+ STOSB_SHORT // Fast short STOSB
179185 SUCCOR // Software uncorrectable error containment and recovery capability.
180186 SVM // AMD Secure Virtual Machine
181187 SVMDA // Indicates support for the SVM decode assists.
@@ -230,7 +236,6 @@ const (
230236 SM3 // SM3 instructions
231237 SM4 // SM4 instructions
232238 SVE // Scalable Vector Extension
233-
234239 // Keep it last. It automatically defines the size of []flagSet
235240 lastID
236241
@@ -1032,7 +1037,6 @@ func support() flagSet {
10321037 // Check AVX2, AVX2 requires OS support, but BMI1/2 don't.
10331038 if mfi >= 7 {
10341039 _ , ebx , ecx , edx := cpuidex (7 , 0 )
1035- eax1 , _ , _ , _ := cpuidex (7 , 1 )
10361040 if fs .inSet (AVX ) && (ebx & 0x00000020 ) != 0 {
10371041 fs .set (AVX2 )
10381042 }
@@ -1049,6 +1053,7 @@ func support() flagSet {
10491053 fs .setIf (ebx & (1 << 18 ) != 0 , RDSEED )
10501054 fs .setIf (ebx & (1 << 19 ) != 0 , ADX )
10511055 fs .setIf (ebx & (1 << 29 ) != 0 , SHA )
1056+
10521057 // CPUID.(EAX=7, ECX=0).ECX
10531058 fs .setIf (ecx & (1 << 5 ) != 0 , WAITPKG )
10541059 fs .setIf (ecx & (1 << 7 ) != 0 , CETSS )
@@ -1071,6 +1076,15 @@ func support() flagSet {
10711076 fs .setIf (edx & (1 << 26 ) != 0 , IBPB )
10721077 fs .setIf (edx & (1 << 27 ) != 0 , STIBP )
10731078
1079+ // CPUID.(EAX=7, ECX=1)
1080+ eax1 , _ , _ , _ := cpuidex (7 , 1 )
1081+ fs .setIf (fs .inSet (AVX ) && eax1 & (1 << 4 ) != 0 , AVXVNNI )
1082+ fs .setIf (eax1 & (1 << 10 ) != 0 , MOVSB_ZL )
1083+ fs .setIf (eax1 & (1 << 11 ) != 0 , STOSB_SHORT )
1084+ fs .setIf (eax1 & (1 << 12 ) != 0 , CMPSB_SCADBS_SHORT )
1085+ fs .setIf (eax1 & (1 << 22 ) != 0 , HRESET )
1086+ fs .setIf (eax1 & (1 << 26 ) != 0 , LAM )
1087+
10741088 // Only detect AVX-512 features if XGETBV is supported
10751089 if c & ((1 << 26 )| (1 << 27 )) == (1 << 26 )| (1 << 27 ) {
10761090 // Check for OS support
0 commit comments