1
0
mirror of https://github.com/google/cpu_features.git synced 2025-04-27 15:12:30 +02:00

[NFC] clang-format the code base

This commit is contained in:
Guillaume Chatelet 2023-09-25 07:35:53 +00:00
parent ec7d390a90
commit 8cfb520efb
11 changed files with 101 additions and 97 deletions

View File

@ -36,7 +36,8 @@ typedef struct {
int LASX : 1; // Extension for Loongson Advanced SIMD eXtension
int CRC32 : 1; // Extension for Cyclic Redundancy Check 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 LBT_X86 : 1; // Extension for X86 Binary Translation Extension
int LBT_ARM : 1; // Extension for ARM Binary Translation Extension

View File

@ -21,29 +21,29 @@
CPU_FEATURES_START_CPP_NAMESPACE
typedef struct {
int esan3: 1; // instructions named N3, "backported" to esa-mode
int zarch: 1; // z/Architecture mode active
int stfle: 1; // store-facility-list-extended
int msa: 1; // message-security assist
int ldisp: 1; // long-displacement
int eimm: 1; // extended-immediate
int dfp: 1; // decimal floating point & perform floating point operation
int edat: 1; // huge page support
int etf3eh: 1; // extended-translation facility 3 enhancement
int highgprs: 1; // 64-bit register support for 31-bit processes
int te: 1; // transactional execution
int vx: 1; // vector extension facility
int vxd: 1; // vector-packed-decimal facility
int vxe: 1; // vector-enhancement facility 1
int gs: 1; // guarded-storage facility
int vxe2: 1; // vector-enhancements facility 2
int vxp: 1; // vector-packed-decimal-enhancement facility
int sort: 1; // enhanced-sort facility
int dflt: 1; // deflate-conversion facility
int vxp2: 1; // vector-packed-decimal-enhancement facility 2
int nnpa: 1; // neural network processing assist facility
int pcimio: 1; // PCI mio facility
int sie: 1; // virtualization support
int esan3 : 1; // instructions named N3, "backported" to esa-mode
int zarch : 1; // z/Architecture mode active
int stfle : 1; // store-facility-list-extended
int msa : 1; // message-security assist
int ldisp : 1; // long-displacement
int eimm : 1; // extended-immediate
int dfp : 1; // decimal floating point & perform floating point operation
int edat : 1; // huge page support
int etf3eh : 1; // extended-translation facility 3 enhancement
int highgprs : 1; // 64-bit register support for 31-bit processes
int te : 1; // transactional execution
int vx : 1; // vector extension facility
int vxd : 1; // vector-packed-decimal facility
int vxe : 1; // vector-enhancement facility 1
int gs : 1; // guarded-storage facility
int vxe2 : 1; // vector-enhancements facility 2
int vxp : 1; // vector-packed-decimal-enhancement facility
int sort : 1; // enhanced-sort facility
int dflt : 1; // deflate-conversion facility
int vxp2 : 1; // vector-packed-decimal-enhancement facility 2
int nnpa : 1; // neural network processing assist facility
int pcimio : 1; // PCI mio facility
int sie : 1; // virtualization support
// Make sure to update S390XFeaturesEnum below if you add a field here.
} S390XFeatures;
@ -95,7 +95,8 @@ typedef enum {
S390X_LAST_,
} S390XFeaturesEnum;
int GetS390XFeaturesEnumValue(const S390XFeatures* features, S390XFeaturesEnum value);
int GetS390XFeaturesEnumValue(const S390XFeatures* features,
S390XFeaturesEnum value);
const char* GetS390XFeaturesEnumName(S390XFeaturesEnum);

View File

@ -109,8 +109,8 @@ typedef struct {
int fs_rep_stosb : 1; // Fast short REP STOSB
int fs_rep_cmpsb_scasb : 1; // Fast short REP CMPSB/SCASB
int lam: 1; // Intel Linear Address Mask
int uai: 1; // AMD Upper Address Ignore
int lam : 1; // Intel Linear Address Mask
int uai : 1; // AMD Upper Address Ignore
// Make sure to update X86FeaturesEnum below if you add a field here.
} X86Features;

View File

@ -60,7 +60,8 @@ Aarch64Info GetAarch64Info(void) {
info.features.crc32 = GetDarwinSysCtlByName("hw.optional.armv8_crc32");
info.features.atomics = GetDarwinSysCtlByName("hw.optional.arm.FEAT_LSE");
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.jscvt = GetDarwinSysCtlByName("hw.optional.arm.FEAT_JSCVT");
info.features.fcma = GetDarwinSysCtlByName("hw.optional.arm.FEAT_FCMA");

View File

@ -124,7 +124,6 @@ Aarch64Info GetAarch64Info(void) {
info.features.atomics = GetWindowsIsProcessorFeaturePresent(
PF_ARM_V81_ATOMIC_INSTRUCTIONS_AVAILABLE);
bool is_crypto_available = GetWindowsIsProcessorFeaturePresent(
PF_ARM_V8_CRYPTO_INSTRUCTIONS_AVAILABLE);
info.features.aes = is_crypto_available;

View File

@ -53,7 +53,8 @@
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 key, value;
if (CpuFeatures_StringView_GetAttributeKeyValue(line, &key, &value)) {

View File

@ -68,7 +68,8 @@ static bool HandleS390XLine(const LineResult result,
StringView key, value;
if (CpuFeatures_StringView_GetAttributeKeyValue(line, &key, &value)) {
if (CpuFeatures_StringView_IsEquals(key, str("# processors"))) {
strings->num_processors = CpuFeatures_StringView_ParsePositiveNumber(value);
strings->num_processors =
CpuFeatures_StringView_ParsePositiveNumber(value);
}
}
return !result.eof;

View File

@ -50,8 +50,8 @@ static void DetectFeaturesFromOs(X86Info* info, X86Features* features) {
features->sse4_2 =
GetWindowsIsProcessorFeaturePresent(PF_SSE4_2_INSTRUCTIONS_AVAILABLE);
// do not bother checking PF_AVX*
// cause AVX enabled processor will have XCR0 be exposed and this function will be skipped at all
// Do not bother checking PF_AVX* : AVX enabled processor will have their XCR0
// register exposed and this function will be skipped altogether.
}
#endif // CPU_FEATURES_OS_WINDOWS

View File

@ -212,14 +212,14 @@ DEFINE_ADD_FLAGS(GetMipsFeaturesEnumValue, GetMipsFeaturesEnumName,
DEFINE_ADD_FLAGS(GetPPCFeaturesEnumValue, GetPPCFeaturesEnumName, PPCFeatures,
PPC_LAST_)
#elif defined(CPU_FEATURES_ARCH_S390X)
DEFINE_ADD_FLAGS(GetS390XFeaturesEnumValue, GetS390XFeaturesEnumName, S390XFeatures,
S390X_LAST_)
DEFINE_ADD_FLAGS(GetS390XFeaturesEnumValue, GetS390XFeaturesEnumName,
S390XFeatures, S390X_LAST_)
#elif defined(CPU_FEATURES_ARCH_RISCV)
DEFINE_ADD_FLAGS(GetRiscvFeaturesEnumValue, GetRiscvFeaturesEnumName, RiscvFeatures,
RISCV_LAST_)
DEFINE_ADD_FLAGS(GetRiscvFeaturesEnumValue, GetRiscvFeaturesEnumName,
RiscvFeatures, RISCV_LAST_)
#elif defined(CPU_FEATURES_ARCH_LOONGARCH)
DEFINE_ADD_FLAGS(GetLoongArchFeaturesEnumValue, GetLoongArchFeaturesEnumName, LoongArchFeatures,
LOONGARCH_LAST_)
DEFINE_ADD_FLAGS(GetLoongArchFeaturesEnumValue, GetLoongArchFeaturesEnumName,
LoongArchFeatures, LOONGARCH_LAST_)
#endif
// Prints a json string with characters escaping.