File tree Expand file tree Collapse file tree 1 file changed +11
-9
lines changed Expand file tree Collapse file tree 1 file changed +11
-9
lines changed Original file line number Diff line number Diff line change @@ -1941,9 +1941,10 @@ const StringMap<bool> sys::getHostCPUFeatures() {
1941
1941
}
1942
1942
1943
1943
#if defined(__aarch64__)
1944
- // If we have all crypto bits we can add the feature
1945
- if (crypto == (CAP_AES | CAP_PMULL | CAP_SHA1 | CAP_SHA2))
1946
- Features[" crypto" ] = true ;
1944
+ // LLVM has decided some AArch64 CPUs have all the instructions they _may_
1945
+ // have, as opposed to all the instructions they _must_ have, so allow runtime
1946
+ // information to correct us on that.
1947
+ Features[" crypto" ] = (crypto == (CAP_AES | CAP_PMULL | CAP_SHA1 | CAP_SHA2));
1947
1948
#endif
1948
1949
1949
1950
return Features;
@@ -1952,12 +1953,13 @@ const StringMap<bool> sys::getHostCPUFeatures() {
1952
1953
const StringMap<bool > sys::getHostCPUFeatures () {
1953
1954
StringMap<bool > Features;
1954
1955
1955
- if (IsProcessorFeaturePresent (PF_ARM_NEON_INSTRUCTIONS_AVAILABLE))
1956
- Features[" neon" ] = true ;
1957
- if (IsProcessorFeaturePresent (PF_ARM_V8_CRC32_INSTRUCTIONS_AVAILABLE))
1958
- Features[" crc" ] = true ;
1959
- if (IsProcessorFeaturePresent (PF_ARM_V8_CRYPTO_INSTRUCTIONS_AVAILABLE))
1960
- Features[" crypto" ] = true ;
1956
+ // If we're asking the OS at runtime, believe what the OS says
1957
+ Features[" neon" ] =
1958
+ IsProcessorFeaturePresent (PF_ARM_NEON_INSTRUCTIONS_AVAILABLE);
1959
+ Features[" crc" ] =
1960
+ IsProcessorFeaturePresent (PF_ARM_V8_CRC32_INSTRUCTIONS_AVAILABLE);
1961
+ Features[" crypto" ] =
1962
+ IsProcessorFeaturePresent (PF_ARM_V8_CRYPTO_INSTRUCTIONS_AVAILABLE);
1961
1963
1962
1964
return Features;
1963
1965
}
You can’t perform that action at this time.
0 commit comments