mirror of
https://github.com/google/cpu_features.git
synced 2025-06-30 21:02:34 +02:00
[NFC] clang-format the code base
This commit is contained in:
@ -36,7 +36,8 @@ typedef struct {
|
|||||||
int LASX : 1; // Extension for Loongson Advanced SIMD eXtension
|
int LASX : 1; // Extension for Loongson Advanced SIMD eXtension
|
||||||
int CRC32 : 1; // Extension for Cyclic Redundancy Check Instructions
|
int CRC32 : 1; // Extension for Cyclic Redundancy Check Instructions
|
||||||
int COMPLEX : 1; // Extension for Complex Vector Operation Instructions
|
int COMPLEX : 1; // Extension for Complex Vector Operation Instructions
|
||||||
int CRYPTO : 1; // Extension for Encryption And Decryption Vector Instructions
|
int CRYPTO : 1; // Extension for Encryption And Decryption Vector
|
||||||
|
// Instructions
|
||||||
int LVZ : 1; // Extension for Virtualization
|
int LVZ : 1; // Extension for Virtualization
|
||||||
int LBT_X86 : 1; // Extension for X86 Binary Translation Extension
|
int LBT_X86 : 1; // Extension for X86 Binary Translation Extension
|
||||||
int LBT_ARM : 1; // Extension for ARM Binary Translation Extension
|
int LBT_ARM : 1; // Extension for ARM Binary Translation Extension
|
||||||
|
@ -21,29 +21,29 @@
|
|||||||
CPU_FEATURES_START_CPP_NAMESPACE
|
CPU_FEATURES_START_CPP_NAMESPACE
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
int esan3: 1; // instructions named N3, "backported" to esa-mode
|
int esan3 : 1; // instructions named N3, "backported" to esa-mode
|
||||||
int zarch: 1; // z/Architecture mode active
|
int zarch : 1; // z/Architecture mode active
|
||||||
int stfle: 1; // store-facility-list-extended
|
int stfle : 1; // store-facility-list-extended
|
||||||
int msa: 1; // message-security assist
|
int msa : 1; // message-security assist
|
||||||
int ldisp: 1; // long-displacement
|
int ldisp : 1; // long-displacement
|
||||||
int eimm: 1; // extended-immediate
|
int eimm : 1; // extended-immediate
|
||||||
int dfp: 1; // decimal floating point & perform floating point operation
|
int dfp : 1; // decimal floating point & perform floating point operation
|
||||||
int edat: 1; // huge page support
|
int edat : 1; // huge page support
|
||||||
int etf3eh: 1; // extended-translation facility 3 enhancement
|
int etf3eh : 1; // extended-translation facility 3 enhancement
|
||||||
int highgprs: 1; // 64-bit register support for 31-bit processes
|
int highgprs : 1; // 64-bit register support for 31-bit processes
|
||||||
int te: 1; // transactional execution
|
int te : 1; // transactional execution
|
||||||
int vx: 1; // vector extension facility
|
int vx : 1; // vector extension facility
|
||||||
int vxd: 1; // vector-packed-decimal facility
|
int vxd : 1; // vector-packed-decimal facility
|
||||||
int vxe: 1; // vector-enhancement facility 1
|
int vxe : 1; // vector-enhancement facility 1
|
||||||
int gs: 1; // guarded-storage facility
|
int gs : 1; // guarded-storage facility
|
||||||
int vxe2: 1; // vector-enhancements facility 2
|
int vxe2 : 1; // vector-enhancements facility 2
|
||||||
int vxp: 1; // vector-packed-decimal-enhancement facility
|
int vxp : 1; // vector-packed-decimal-enhancement facility
|
||||||
int sort: 1; // enhanced-sort facility
|
int sort : 1; // enhanced-sort facility
|
||||||
int dflt: 1; // deflate-conversion facility
|
int dflt : 1; // deflate-conversion facility
|
||||||
int vxp2: 1; // vector-packed-decimal-enhancement facility 2
|
int vxp2 : 1; // vector-packed-decimal-enhancement facility 2
|
||||||
int nnpa: 1; // neural network processing assist facility
|
int nnpa : 1; // neural network processing assist facility
|
||||||
int pcimio: 1; // PCI mio facility
|
int pcimio : 1; // PCI mio facility
|
||||||
int sie: 1; // virtualization support
|
int sie : 1; // virtualization support
|
||||||
|
|
||||||
// Make sure to update S390XFeaturesEnum below if you add a field here.
|
// Make sure to update S390XFeaturesEnum below if you add a field here.
|
||||||
} S390XFeatures;
|
} S390XFeatures;
|
||||||
@ -95,7 +95,8 @@ typedef enum {
|
|||||||
S390X_LAST_,
|
S390X_LAST_,
|
||||||
} S390XFeaturesEnum;
|
} S390XFeaturesEnum;
|
||||||
|
|
||||||
int GetS390XFeaturesEnumValue(const S390XFeatures* features, S390XFeaturesEnum value);
|
int GetS390XFeaturesEnumValue(const S390XFeatures* features,
|
||||||
|
S390XFeaturesEnum value);
|
||||||
|
|
||||||
const char* GetS390XFeaturesEnumName(S390XFeaturesEnum);
|
const char* GetS390XFeaturesEnumName(S390XFeaturesEnum);
|
||||||
|
|
||||||
|
@ -109,8 +109,8 @@ typedef struct {
|
|||||||
int fs_rep_stosb : 1; // Fast short REP STOSB
|
int fs_rep_stosb : 1; // Fast short REP STOSB
|
||||||
int fs_rep_cmpsb_scasb : 1; // Fast short REP CMPSB/SCASB
|
int fs_rep_cmpsb_scasb : 1; // Fast short REP CMPSB/SCASB
|
||||||
|
|
||||||
int lam: 1; // Intel Linear Address Mask
|
int lam : 1; // Intel Linear Address Mask
|
||||||
int uai: 1; // AMD Upper Address Ignore
|
int uai : 1; // AMD Upper Address Ignore
|
||||||
// Make sure to update X86FeaturesEnum below if you add a field here.
|
// Make sure to update X86FeaturesEnum below if you add a field here.
|
||||||
} X86Features;
|
} X86Features;
|
||||||
|
|
||||||
|
@ -60,7 +60,8 @@ Aarch64Info GetAarch64Info(void) {
|
|||||||
info.features.crc32 = GetDarwinSysCtlByName("hw.optional.armv8_crc32");
|
info.features.crc32 = GetDarwinSysCtlByName("hw.optional.armv8_crc32");
|
||||||
info.features.atomics = GetDarwinSysCtlByName("hw.optional.arm.FEAT_LSE");
|
info.features.atomics = GetDarwinSysCtlByName("hw.optional.arm.FEAT_LSE");
|
||||||
info.features.fphp = GetDarwinSysCtlByName("hw.optional.arm.FEAT_FP16");
|
info.features.fphp = GetDarwinSysCtlByName("hw.optional.arm.FEAT_FP16");
|
||||||
info.features.asimdhp = GetDarwinSysCtlByName("hw.optional.arm.AdvSIMD_HPFPCvt");
|
info.features.asimdhp =
|
||||||
|
GetDarwinSysCtlByName("hw.optional.arm.AdvSIMD_HPFPCvt");
|
||||||
info.features.asimdrdm = GetDarwinSysCtlByName("hw.optional.arm.FEAT_RDM");
|
info.features.asimdrdm = GetDarwinSysCtlByName("hw.optional.arm.FEAT_RDM");
|
||||||
info.features.jscvt = GetDarwinSysCtlByName("hw.optional.arm.FEAT_JSCVT");
|
info.features.jscvt = GetDarwinSysCtlByName("hw.optional.arm.FEAT_JSCVT");
|
||||||
info.features.fcma = GetDarwinSysCtlByName("hw.optional.arm.FEAT_FCMA");
|
info.features.fcma = GetDarwinSysCtlByName("hw.optional.arm.FEAT_FCMA");
|
||||||
|
@ -124,7 +124,6 @@ Aarch64Info GetAarch64Info(void) {
|
|||||||
info.features.atomics = GetWindowsIsProcessorFeaturePresent(
|
info.features.atomics = GetWindowsIsProcessorFeaturePresent(
|
||||||
PF_ARM_V81_ATOMIC_INSTRUCTIONS_AVAILABLE);
|
PF_ARM_V81_ATOMIC_INSTRUCTIONS_AVAILABLE);
|
||||||
|
|
||||||
|
|
||||||
bool is_crypto_available = GetWindowsIsProcessorFeaturePresent(
|
bool is_crypto_available = GetWindowsIsProcessorFeaturePresent(
|
||||||
PF_ARM_V8_CRYPTO_INSTRUCTIONS_AVAILABLE);
|
PF_ARM_V8_CRYPTO_INSTRUCTIONS_AVAILABLE);
|
||||||
info.features.aes = is_crypto_available;
|
info.features.aes = is_crypto_available;
|
||||||
|
@ -53,7 +53,8 @@
|
|||||||
|
|
||||||
static const LoongArchInfo kEmptyLoongArchInfo;
|
static const LoongArchInfo kEmptyLoongArchInfo;
|
||||||
|
|
||||||
static bool HandleLoongArchLine(const LineResult result, LoongArchInfo* const info) {
|
static bool HandleLoongArchLine(const LineResult result,
|
||||||
|
LoongArchInfo* const info) {
|
||||||
StringView line = result.line;
|
StringView line = result.line;
|
||||||
StringView key, value;
|
StringView key, value;
|
||||||
if (CpuFeatures_StringView_GetAttributeKeyValue(line, &key, &value)) {
|
if (CpuFeatures_StringView_GetAttributeKeyValue(line, &key, &value)) {
|
||||||
|
@ -68,7 +68,8 @@ static bool HandleS390XLine(const LineResult result,
|
|||||||
StringView key, value;
|
StringView key, value;
|
||||||
if (CpuFeatures_StringView_GetAttributeKeyValue(line, &key, &value)) {
|
if (CpuFeatures_StringView_GetAttributeKeyValue(line, &key, &value)) {
|
||||||
if (CpuFeatures_StringView_IsEquals(key, str("# processors"))) {
|
if (CpuFeatures_StringView_IsEquals(key, str("# processors"))) {
|
||||||
strings->num_processors = CpuFeatures_StringView_ParsePositiveNumber(value);
|
strings->num_processors =
|
||||||
|
CpuFeatures_StringView_ParsePositiveNumber(value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return !result.eof;
|
return !result.eof;
|
||||||
|
@ -50,8 +50,8 @@ static void DetectFeaturesFromOs(X86Info* info, X86Features* features) {
|
|||||||
features->sse4_2 =
|
features->sse4_2 =
|
||||||
GetWindowsIsProcessorFeaturePresent(PF_SSE4_2_INSTRUCTIONS_AVAILABLE);
|
GetWindowsIsProcessorFeaturePresent(PF_SSE4_2_INSTRUCTIONS_AVAILABLE);
|
||||||
|
|
||||||
// do not bother checking PF_AVX*
|
// Do not bother checking PF_AVX* : AVX enabled processor will have their XCR0
|
||||||
// cause AVX enabled processor will have XCR0 be exposed and this function will be skipped at all
|
// register exposed and this function will be skipped altogether.
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // CPU_FEATURES_OS_WINDOWS
|
#endif // CPU_FEATURES_OS_WINDOWS
|
||||||
|
@ -212,14 +212,14 @@ DEFINE_ADD_FLAGS(GetMipsFeaturesEnumValue, GetMipsFeaturesEnumName,
|
|||||||
DEFINE_ADD_FLAGS(GetPPCFeaturesEnumValue, GetPPCFeaturesEnumName, PPCFeatures,
|
DEFINE_ADD_FLAGS(GetPPCFeaturesEnumValue, GetPPCFeaturesEnumName, PPCFeatures,
|
||||||
PPC_LAST_)
|
PPC_LAST_)
|
||||||
#elif defined(CPU_FEATURES_ARCH_S390X)
|
#elif defined(CPU_FEATURES_ARCH_S390X)
|
||||||
DEFINE_ADD_FLAGS(GetS390XFeaturesEnumValue, GetS390XFeaturesEnumName, S390XFeatures,
|
DEFINE_ADD_FLAGS(GetS390XFeaturesEnumValue, GetS390XFeaturesEnumName,
|
||||||
S390X_LAST_)
|
S390XFeatures, S390X_LAST_)
|
||||||
#elif defined(CPU_FEATURES_ARCH_RISCV)
|
#elif defined(CPU_FEATURES_ARCH_RISCV)
|
||||||
DEFINE_ADD_FLAGS(GetRiscvFeaturesEnumValue, GetRiscvFeaturesEnumName, RiscvFeatures,
|
DEFINE_ADD_FLAGS(GetRiscvFeaturesEnumValue, GetRiscvFeaturesEnumName,
|
||||||
RISCV_LAST_)
|
RiscvFeatures, RISCV_LAST_)
|
||||||
#elif defined(CPU_FEATURES_ARCH_LOONGARCH)
|
#elif defined(CPU_FEATURES_ARCH_LOONGARCH)
|
||||||
DEFINE_ADD_FLAGS(GetLoongArchFeaturesEnumValue, GetLoongArchFeaturesEnumName, LoongArchFeatures,
|
DEFINE_ADD_FLAGS(GetLoongArchFeaturesEnumValue, GetLoongArchFeaturesEnumName,
|
||||||
LOONGARCH_LAST_)
|
LoongArchFeatures, LOONGARCH_LAST_)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Prints a json string with characters escaping.
|
// Prints a json string with characters escaping.
|
||||||
|
Reference in New Issue
Block a user