Add CRC32 detection to arm32

armv8 has 32-bit mode, but it can use crc32 instruction sets even if 32-bit.
This commit is contained in:
Makoto Kato
2019-11-30 15:16:19 +09:00
committed by gnzlbg
parent 7c56404f1a
commit cca9a86637
3 changed files with 6 additions and 1 deletions

View File

@@ -14,4 +14,6 @@ features! {
/// ARM Advanced SIMD (NEON) - Aarch32
@FEATURE: #[unstable(feature = "stdsimd", issue = "27731")] pmull: "pmull";
/// Polynomial Multiply
@FEATURE: #[unstable(feature = "stdsimd", issue = "27731")] crc: "crc";
/// CRC32 (Cyclic Redundancy Check)
}

View File

@@ -15,10 +15,11 @@ pub(crate) fn detect_features() -> cache::Initializer {
// The values are part of the platform-specific [asm/hwcap.h][hwcap]
//
// [hwcap]: https://github.com/torvalds/linux/blob/master/arch/arm64/include/uapi/asm/hwcap.h
// [hwcap]: https://github.com/torvalds/linux/blob/master/arch/arm/include/uapi/asm/hwcap.h
if let Ok(auxv) = auxvec::auxv() {
enable_feature(&mut value, Feature::neon, bit::test(auxv.hwcap, 12));
enable_feature(&mut value, Feature::pmull, bit::test(auxv.hwcap2, 1));
enable_feature(&mut value, Feature::crc, bit::test(auxv.hwcap2, 4));
return value;
}
@@ -29,6 +30,7 @@ pub(crate) fn detect_features() -> cache::Initializer {
c.field("Features").has("neon") && !has_broken_neon(&c),
);
enable_feature(&mut value, Feature::pmull, c.field("Features").has("pmull"));
enable_feature(&mut value, Feature::crc, c.field("Features").has("crc32"));
return value;
}
value