Lower ARM architecture requirement for CRC32 instructions.

The changes ensure compatibility with compilers targeting ARMv7.
32-bit processors of architecture 8 and higher, or 64-bit processors running in 32-bit mode can have the CRC32 instructions.
With this change we will query the processor instead of the compiler architecture.
This commit is contained in:
2023-09-23 00:53:23 +01:00
parent c392dfa682
commit d4a607345e
4 changed files with 11 additions and 5 deletions

6
simd.c
View File

@@ -198,6 +198,12 @@ int have_arm_crc32(void)
#elif defined(__APPLE__)
return have_crc32_apple();
#else
// Not defined in ARMv7 compilers, even if the CPU has the capability
#ifndef HWCAP2_CRC32
#define HWCAP2_CRC32 (1 << 4)
#endif
return getauxval(AT_HWCAP2) & HWCAP2_CRC32;
#endif
}