Skip to content

Commit 69835d8

Browse files
[clang][AArch64] Parse more features in getHostCPUFeatures (#146323)
Add parsing of some crypto features to display them properly when -mcpu=native is used
1 parent 8c06d0e commit 69835d8

File tree

4 files changed

+7
-60
lines changed

4 files changed

+7
-60
lines changed

clang/test/Driver/aarch64-mcpu-native.c

Lines changed: 0 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -1,63 +1,4 @@
11
// REQUIRES: aarch64-registered-target,system-linux,aarch64-host
2-
// RUN: export LLVM_CPUINFO=%S/Inputs/cpunative/neoverse-v2
3-
// RUN: %clang --target=aarch64 --print-enabled-extensions -mcpu=native | FileCheck --strict-whitespace --check-prefix=CHECK-FEAT-NV2 --implicit-check-not=FEAT_ %s
4-
5-
// CHECK-FEAT-NV2: Extensions enabled for the given AArch64 target
6-
// CHECK-FEAT-NV2-EMPTY:
7-
// CHECK-FEAT-NV2: Architecture Feature(s) Description
8-
// CHECK-FEAT-NV2: FEAT_AES, FEAT_PMULL Enable AES support
9-
// CHECK-FEAT-NV2: FEAT_AMUv1 Enable Armv8.4-A Activity Monitors extension
10-
// CHECK-FEAT-NV2: FEAT_AdvSIMD Enable Advanced SIMD instructions
11-
// CHECK-FEAT-NV2: FEAT_BF16 Enable BFloat16 Extension
12-
// CHECK-FEAT-NV2: FEAT_BTI Enable Branch Target Identification
13-
// CHECK-FEAT-NV2: FEAT_CCIDX Enable Armv8.3-A Extend of the CCSIDR number of sets
14-
// CHECK-FEAT-NV2: FEAT_CRC32 Enable Armv8.0-A CRC-32 checksum instructions
15-
// CHECK-FEAT-NV2: FEAT_CSV2_2 Enable architectural speculation restriction
16-
// CHECK-FEAT-NV2: FEAT_DIT Enable Armv8.4-A Data Independent Timing instructions
17-
// CHECK-FEAT-NV2: FEAT_DPB Enable Armv8.2-A data Cache Clean to Point of Persistence
18-
// CHECK-FEAT-NV2: FEAT_DPB2 Enable Armv8.5-A Cache Clean to Point of Deep Persistence
19-
// CHECK-FEAT-NV2: FEAT_DotProd Enable dot product support
20-
// CHECK-FEAT-NV2: FEAT_ETE Enable Embedded Trace Extension
21-
// CHECK-FEAT-NV2: FEAT_FCMA Enable Armv8.3-A Floating-point complex number support
22-
// CHECK-FEAT-NV2: FEAT_FHM Enable FP16 FML instructions
23-
// CHECK-FEAT-NV2: FEAT_FP Enable Armv8.0-A Floating Point Extensions
24-
// CHECK-FEAT-NV2: FEAT_FP16 Enable half-precision floating-point data processing
25-
// CHECK-FEAT-NV2: FEAT_FPAC Enable Armv8.3-A Pointer Authentication Faulting enhancement
26-
// CHECK-FEAT-NV2: FEAT_FRINTTS Enable FRInt[32|64][Z|X] instructions that round a floating-point number to an integer (in FP format) forcing it to fit into a 32- or 64-bit int
27-
// CHECK-FEAT-NV2: FEAT_FlagM Enable Armv8.4-A Flag Manipulation instructions
28-
// CHECK-FEAT-NV2: FEAT_FlagM2 Enable alternative NZCV format for floating point comparisons
29-
// CHECK-FEAT-NV2: FEAT_I8MM Enable Matrix Multiply Int8 Extension
30-
// CHECK-FEAT-NV2: FEAT_JSCVT Enable Armv8.3-A JavaScript FP conversion instructions
31-
// CHECK-FEAT-NV2: FEAT_LOR Enable Armv8.1-A Limited Ordering Regions extension
32-
// CHECK-FEAT-NV2: FEAT_LRCPC Enable support for RCPC extension
33-
// CHECK-FEAT-NV2: FEAT_LRCPC2 Enable Armv8.4-A RCPC instructions with Immediate Offsets
34-
// CHECK-FEAT-NV2: FEAT_LSE Enable Armv8.1-A Large System Extension (LSE) atomic instructions
35-
// CHECK-FEAT-NV2: FEAT_LSE2 Enable Armv8.4-A Large System Extension 2 (LSE2) atomicity rules
36-
// CHECK-FEAT-NV2: FEAT_MPAM Enable Armv8.4-A Memory system Partitioning and Monitoring extension
37-
// CHECK-FEAT-NV2: FEAT_MTE, FEAT_MTE2 Enable Memory Tagging Extension
38-
// CHECK-FEAT-NV2: FEAT_NV, FEAT_NV2 Enable Armv8.4-A Nested Virtualization Enchancement
39-
// CHECK-FEAT-NV2: FEAT_PAN Enable Armv8.1-A Privileged Access-Never extension
40-
// CHECK-FEAT-NV2: FEAT_PAN2 Enable Armv8.2-A PAN s1e1R and s1e1W Variants
41-
// CHECK-FEAT-NV2: FEAT_PAuth Enable Armv8.3-A Pointer Authentication extension
42-
// CHECK-FEAT-NV2: FEAT_PMUv3 Enable Armv8.0-A PMUv3 Performance Monitors extension
43-
// CHECK-FEAT-NV2: FEAT_RAS, FEAT_RASv1p1 Enable Armv8.0-A Reliability, Availability and Serviceability Extensions
44-
// CHECK-FEAT-NV2: FEAT_RDM Enable Armv8.1-A Rounding Double Multiply Add/Subtract instructions
45-
// CHECK-FEAT-NV2: FEAT_RNG Enable Random Number generation instructions
46-
// CHECK-FEAT-NV2: FEAT_SB Enable Armv8.5-A Speculation Barrier
47-
// CHECK-FEAT-NV2: FEAT_SEL2 Enable Armv8.4-A Secure Exception Level 2 extension
48-
// CHECK-FEAT-NV2: FEAT_SHA1, FEAT_SHA256 Enable SHA1 and SHA256 support
49-
// CHECK-FEAT-NV2: FEAT_SPE Enable Statistical Profiling extension
50-
// CHECK-FEAT-NV2: FEAT_SPECRES Enable Armv8.5-A execution and data prediction invalidation instructions
51-
// CHECK-FEAT-NV2: FEAT_SSBS, FEAT_SSBS2 Enable Speculative Store Bypass Safe bit
52-
// CHECK-FEAT-NV2: FEAT_SVE Enable Scalable Vector Extension (SVE) instructions
53-
// CHECK-FEAT-NV2: FEAT_SVE2 Enable Scalable Vector Extension 2 (SVE2) instructions
54-
// CHECK-FEAT-NV2: FEAT_SVE_BitPerm Enable bit permutation SVE2 instructions
55-
// CHECK-FEAT-NV2: FEAT_TLBIOS, FEAT_TLBIRANGE Enable Armv8.4-A TLB Range and Maintenance instructions
56-
// CHECK-FEAT-NV2: FEAT_TRBE Enable Trace Buffer Extension
57-
// CHECK-FEAT-NV2: FEAT_TRF Enable Armv8.4-A Trace extension
58-
// CHECK-FEAT-NV2: FEAT_UAO Enable Armv8.2-A UAO PState
59-
// CHECK-FEAT-NV2: FEAT_VHE Enable Armv8.1-A Virtual Host extension
60-
612
// RUN: export LLVM_CPUINFO=%S/Inputs/cpunative/neoverse-n1
623
// RUN: %clang --target=aarch64 --print-enabled-extensions -mcpu=native | FileCheck --strict-whitespace --check-prefix=CHECK-FEAT-NN1 --implicit-check-not=FEAT_ %s
634

clang/test/Driver/print-enabled-extensions/aarch64-grace.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
// REQUIRES: aarch64-registered-target
1+
// REQUIRES: aarch64-registered-target,aarch64-host,system-linux
22
// RUN: %clang --target=aarch64 --print-enabled-extensions -mcpu=grace | FileCheck --strict-whitespace --implicit-check-not=FEAT_ %s
3+
// RUN: env LLVM_CPUINFO=%S/../Inputs/cpunative/grace %clang --target=aarch64 --print-enabled-extensions -mcpu=native | FileCheck --strict-whitespace --implicit-check-not=FEAT_ %s
34

45
// CHECK: Extensions enabled for the given AArch64 target
56
// CHECK-EMPTY:

llvm/lib/TargetParser/Host.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2100,8 +2100,13 @@ const StringMap<bool> sys::getHostCPUFeatures() {
21002100
.Case("fp", "fp-armv8")
21012101
.Case("crc32", "crc")
21022102
.Case("atomics", "lse")
2103+
.Case("sha3", "sha3")
2104+
.Case("sm4", "sm4")
21032105
.Case("sve", "sve")
21042106
.Case("sve2", "sve2")
2107+
.Case("sveaes", "sve-aes")
2108+
.Case("svesha3", "sve-sha3")
2109+
.Case("svesm4", "sve-sm4")
21052110
#else
21062111
.Case("half", "fp16")
21072112
.Case("neon", "neon")

0 commit comments

Comments
 (0)