github.com/Schaudge/grailbase@v0.0.0-20240223061707-44c758a471c0/compress/libdeflate/arm/cpu_features.h (about)

     1  /*
     2   * arm/cpu_features.h - feature detection for ARM processors
     3   */
     4  
     5  #ifndef LIB_ARM_CPU_FEATURES_H
     6  #define LIB_ARM_CPU_FEATURES_H
     7  
     8  #include "../lib_common.h"
     9  
    10  #if (defined(__arm__) || defined(__aarch64__)) && \
    11  	defined(__linux__) && COMPILER_SUPPORTS_TARGET_FUNCTION_ATTRIBUTE
    12  #  define ARM_CPU_FEATURES_ENABLED 1
    13  #else
    14  #  define ARM_CPU_FEATURES_ENABLED 0
    15  #endif
    16  
    17  #if ARM_CPU_FEATURES_ENABLED
    18  
    19  #define ARM_CPU_FEATURE_NEON		0x00000001
    20  #define ARM_CPU_FEATURE_PMULL		0x00000002
    21  
    22  #define ARM_CPU_FEATURES_KNOWN		0x80000000
    23  
    24  extern volatile u32 _cpu_features;
    25  
    26  extern void setup_cpu_features(void);
    27  
    28  static inline u32 get_cpu_features(void)
    29  {
    30  	if (_cpu_features == 0)
    31  		setup_cpu_features();
    32  	return _cpu_features;
    33  }
    34  
    35  #endif /* ARM_CPU_FEATURES_ENABLED */
    36  
    37  #endif /* LIB_ARM_CPU_FEATURES_H */