@@ -76,6 +76,8 @@ const (
7676 RDTSCP // RDTSCP Instruction
7777 CX16 // CMPXCHG16B Instruction
7878 SGX // Software Guard Extensions
79+ IBPB // Indirect Branch Restricted Speculation (IBRS) and Indirect Branch Predictor Barrier (IBPB)
80+ STIBP // Single Thread Indirect Branch Predictors
7981
8082 // Performance indicators
8183 SSE2SLOW // SSE2 is supported, but usually not faster
@@ -131,6 +133,8 @@ var flagNames = map[Flags]string{
131133 RDTSCP : "RDTSCP" , // RDTSCP Instruction
132134 CX16 : "CX16" , // CMPXCHG16B Instruction
133135 SGX : "SGX" , // Software Guard Extensions
136+ IBPB : "IBPB" , // Indirect Branch Restricted Speculation and Indirect Branch Predictor Barrier
137+ STIBP : "STIBP" , // Single Thread Indirect Branch Predictors
134138
135139 // Performance indicators
136140 SSE2SLOW : "SSE2SLOW" , // SSE2 supported, but usually not faster
@@ -854,7 +858,7 @@ func support() Flags {
854858
855859 // Check AVX2, AVX2 requires OS support, but BMI1/2 don't.
856860 if mfi >= 7 {
857- _ , ebx , ecx , _ := cpuidex (7 , 0 )
861+ _ , ebx , ecx , edx := cpuidex (7 , 0 )
858862 if (rval & AVX ) != 0 && (ebx & 0x00000020 ) != 0 {
859863 rval |= AVX2
860864 }
@@ -888,6 +892,12 @@ func support() Flags {
888892 if ebx & (1 << 29 ) != 0 {
889893 rval |= SHA
890894 }
895+ if edx & (1 << 26 ) != 0 {
896+ rval |= IBPB
897+ }
898+ if edx & (1 << 27 ) != 0 {
899+ rval |= STIBP
900+ }
891901
892902 // Only detect AVX-512 features if XGETBV is supported
893903 if c & ((1 << 26 )| (1 << 27 )) == (1 << 26 )| (1 << 27 ) {
0 commit comments