File tree 1 file changed +11
-9
lines changed
1 file changed +11
-9
lines changed Original file line number Diff line number Diff line change @@ -1967,21 +1967,23 @@ bool sys::getHostCPUFeatures(StringMap<bool> &Features) {
1967
1967
}
1968
1968
1969
1969
#if defined(__aarch64__)
1970
- // If we have all crypto bits we can add the feature
1971
- if (crypto == (CAP_AES | CAP_PMULL | CAP_SHA1 | CAP_SHA2))
1972
- Features[" crypto" ] = true ;
1970
+ // LLVM has decided some AArch64 CPUs have all the instructions they _may_
1971
+ // have, as opposed to all the instructions they _must_ have, so allow runtime
1972
+ // information to correct us on that.
1973
+ Features[" crypto" ] = (crypto == (CAP_AES | CAP_PMULL | CAP_SHA1 | CAP_SHA2));
1973
1974
#endif
1974
1975
1975
1976
return true ;
1976
1977
}
1977
1978
#elif defined(_WIN32) && (defined(__aarch64__) || defined(_M_ARM64))
1978
1979
bool sys::getHostCPUFeatures (StringMap<bool > &Features) {
1979
- if (IsProcessorFeaturePresent (PF_ARM_NEON_INSTRUCTIONS_AVAILABLE))
1980
- Features[" neon" ] = true ;
1981
- if (IsProcessorFeaturePresent (PF_ARM_V8_CRC32_INSTRUCTIONS_AVAILABLE))
1982
- Features[" crc" ] = true ;
1983
- if (IsProcessorFeaturePresent (PF_ARM_V8_CRYPTO_INSTRUCTIONS_AVAILABLE))
1984
- Features[" crypto" ] = true ;
1980
+ // If we're asking the OS at runtime, believe what the OS says
1981
+ Features[" neon" ] =
1982
+ IsProcessorFeaturePresent (PF_ARM_NEON_INSTRUCTIONS_AVAILABLE);
1983
+ Features[" crc" ] =
1984
+ IsProcessorFeaturePresent (PF_ARM_V8_CRC32_INSTRUCTIONS_AVAILABLE);
1985
+ Features[" crypto" ] =
1986
+ IsProcessorFeaturePresent (PF_ARM_V8_CRYPTO_INSTRUCTIONS_AVAILABLE);
1985
1987
1986
1988
return true ;
1987
1989
}
You can’t perform that action at this time.
0 commit comments