mirror of
https://github.com/cuberite/libdeflate.git
synced 2025-08-04 10:16:44 -04:00

If support for CRC32 instructions is detected, set ARM_CPU_FEATURE_CRC32. Also define COMPILER_SUPPORTS_CRC32_TARGET_INTRINSICS when appropriate, and update run_tests.sh to toggle the crc32 feature for testing.
41 lines
860 B
C
41 lines
860 B
C
/*
|
|
* arm/cpu_features.h - feature detection for ARM processors
|
|
*/
|
|
|
|
#ifndef LIB_ARM_CPU_FEATURES_H
|
|
#define LIB_ARM_CPU_FEATURES_H
|
|
|
|
#include "../lib_common.h"
|
|
|
|
#if (defined(__arm__) || defined(__aarch64__)) && \
|
|
defined(__linux__) && \
|
|
COMPILER_SUPPORTS_TARGET_FUNCTION_ATTRIBUTE && \
|
|
!defined(FREESTANDING)
|
|
# define ARM_CPU_FEATURES_ENABLED 1
|
|
#else
|
|
# define ARM_CPU_FEATURES_ENABLED 0
|
|
#endif
|
|
|
|
#if ARM_CPU_FEATURES_ENABLED
|
|
|
|
#define ARM_CPU_FEATURE_NEON 0x00000001
|
|
#define ARM_CPU_FEATURE_PMULL 0x00000002
|
|
#define ARM_CPU_FEATURE_CRC32 0x00000004
|
|
|
|
#define ARM_CPU_FEATURES_KNOWN 0x80000000
|
|
|
|
extern volatile u32 _cpu_features;
|
|
|
|
void setup_cpu_features(void);
|
|
|
|
static inline u32 get_cpu_features(void)
|
|
{
|
|
if (_cpu_features == 0)
|
|
setup_cpu_features();
|
|
return _cpu_features;
|
|
}
|
|
|
|
#endif /* ARM_CPU_FEATURES_ENABLED */
|
|
|
|
#endif /* LIB_ARM_CPU_FEATURES_H */
|