Skip to content

Commit af379ff

Browse files
authored
Merge branch 'main' into main
2 parents bfd4ae3 + cab4c68 commit af379ff

39 files changed

+3097
-386
lines changed

clang/test/Driver/aarch64-v97a.c

Lines changed: 34 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,46 @@
66
// RUN: %clang -target aarch64 -mlittle-endian -march=armv9.7-a -### -c %s 2>&1 | FileCheck -check-prefix=GENERICV97A %s
77
// RUN: %clang -target aarch64_be -mlittle-endian -march=armv9.7a -### -c %s 2>&1 | FileCheck -check-prefix=GENERICV97A %s
88
// RUN: %clang -target aarch64_be -mlittle-endian -march=armv9.7-a -### -c %s 2>&1 | FileCheck -check-prefix=GENERICV97A %s
9-
// GENERICV97A: "-cc1"{{.*}} "-triple" "aarch64{{.*}}" "-target-cpu" "generic" "-target-feature" "+v9.7a"{{.*}}
9+
// GENERICV97A: "-cc1"{{.*}} "-triple" "aarch64{{.*}}" "-target-cpu" "generic" "-target-feature" "+v9.7a"{{.*}} "-target-feature" "+sve2p3"
1010

1111
// RUN: %clang -target aarch64_be -march=armv9.7a -### -c %s 2>&1 | FileCheck -check-prefix=GENERICV97A-BE %s
1212
// RUN: %clang -target aarch64_be -march=armv9.7-a -### -c %s 2>&1 | FileCheck -check-prefix=GENERICV97A-BE %s
1313
// RUN: %clang -target aarch64 -mbig-endian -march=armv9.7a -### -c %s 2>&1 | FileCheck -check-prefix=GENERICV97A-BE %s
1414
// RUN: %clang -target aarch64 -mbig-endian -march=armv9.7-a -### -c %s 2>&1 | FileCheck -check-prefix=GENERICV97A-BE %s
1515
// RUN: %clang -target aarch64_be -mbig-endian -march=armv9.7a -### -c %s 2>&1 | FileCheck -check-prefix=GENERICV97A-BE %s
1616
// RUN: %clang -target aarch64_be -mbig-endian -march=armv9.7-a -### -c %s 2>&1 | FileCheck -check-prefix=GENERICV97A-BE %s
17-
// GENERICV97A-BE: "-cc1"{{.*}} "-triple" "aarch64_be{{.*}}" "-target-cpu" "generic" "-target-feature" "+v9.7a"{{.*}}
17+
// GENERICV97A-BE: "-cc1"{{.*}} "-triple" "aarch64_be{{.*}}" "-target-cpu" "generic" "-target-feature" "+v9.7a"{{.*}} "-target-feature" "+sve2p3"
1818

1919
// ===== Features supported on aarch64 =====
20+
21+
// RUN: %clang -target aarch64 -march=armv9.7a+sme2p3 -### -c %s 2>&1 | FileCheck -check-prefix=V97A-SME2p3 %s
22+
// RUN: %clang -target aarch64 -march=armv9.7-a+sme2p3 -### -c %s 2>&1 | FileCheck -check-prefix=V97A-SME2p3 %s
23+
// V97A-SME2p3: "-cc1"{{.*}} "-triple" "aarch64{{.*}}" "-target-cpu" "generic" "-target-feature" "+v9.7a"{{.*}} "-target-feature" "+sme2p3"
24+
25+
// RUN: %clang -target aarch64 -march=armv9.7a+sve2p3 -### -c %s 2>&1 | FileCheck -check-prefix=V97A-SVE2p3 %s
26+
// RUN: %clang -target aarch64 -march=armv9.7-a+sve2p3 -### -c %s 2>&1 | FileCheck -check-prefix=V97A-SVE2p3 %s
27+
// V97A-SVE2p3: "-cc1"{{.*}} "-triple" "aarch64{{.*}}" "-target-cpu" "generic" "-target-feature" "+v9.7a"{{.*}} "-target-feature" "+sve2p3"
28+
29+
// RUN: %clang -target aarch64 -march=armv9.7a+cmh -### -c %s 2>&1 | FileCheck -check-prefix=V97A-CMH %s
30+
// RUN: %clang -target aarch64 -march=armv9.7-a+cmh -### -c %s 2>&1 | FileCheck -check-prefix=V97A-CMH %s
31+
// V97A-CMH: "-cc1"{{.*}} "-triple" "aarch64{{.*}}" "-target-cpu" "generic" "-target-feature" "+v9.7a"{{.*}} "-target-feature" "+cmh"
32+
33+
// RUN: %clang -target aarch64 -march=armv9.7a+lscp -### -c %s 2>&1 | FileCheck -check-prefix=V97A-LSCP %s
34+
// RUN: %clang -target aarch64 -march=armv9.7-a+lscp -### -c %s 2>&1 | FileCheck -check-prefix=V97A-LSCP %s
35+
// V97A-LSCP: "-cc1"{{.*}} "-triple" "aarch64{{.*}}" "-target-cpu" "generic" "-target-feature" "+v9.7a"{{.*}} "-target-feature" "+lscp"
36+
37+
// RUN: %clang -target aarch64 -march=armv9.7a+tlbid -### -c %s 2>&1 | FileCheck -check-prefix=V97A-TLBID %s
38+
// RUN: %clang -target aarch64 -march=armv9.7-a+tlbid -### -c %s 2>&1 | FileCheck -check-prefix=V97A-TLBID %s
39+
// V97A-TLBID: "-cc1"{{.*}} "-triple" "aarch64{{.*}}" "-target-cpu" "generic" "-target-feature" "+v9.7a"{{.*}} "-target-feature" "+tlbid"
40+
41+
// RUN: %clang -target aarch64 -march=armv9.7a+mpamv2 -### -c %s 2>&1 | FileCheck -check-prefix=V97A-MPAMv2 %s
42+
// RUN: %clang -target aarch64 -march=armv9.7-a+mpamv2 -### -c %s 2>&1 | FileCheck -check-prefix=V97A-MPAMv2 %s
43+
// V97A-MPAMv2: "-cc1"{{.*}} "-triple" "aarch64{{.*}}" "-target-cpu" "generic" "-target-feature" "+v9.7a"{{.*}} "-target-feature" "+mpamv2"
44+
45+
// RUN: %clang -target aarch64 -march=armv9.7a+mtetc -### -c %s 2>&1 | FileCheck -check-prefix=V97A-MTETC %s
46+
// RUN: %clang -target aarch64 -march=armv9.7-a+mtetc -### -c %s 2>&1 | FileCheck -check-prefix=V97A-MTETC %s
47+
// V97A-MTETC: "-cc1"{{.*}} "-triple" "aarch64{{.*}}" "-target-cpu" "generic" "-target-feature" "+v9.7a"{{.*}} "-target-feature" "+mtetc"
48+
49+
// RUN: %clang -target aarch64 -march=armv9.7a+gcie -### -c %s 2>&1 | FileCheck -check-prefix=V97A-GCIE %s
50+
// RUN: %clang -target aarch64 -march=armv9.7-a+gcie -### -c %s 2>&1 | FileCheck -check-prefix=V97A-GCIE %s
51+
// V97A-GCIE: "-cc1"{{.*}} "-triple" "aarch64{{.*}}" "-target-cpu" "generic" "-target-feature" "+v9.7a"{{.*}} "-target-feature" "+gcie"

clang/test/Driver/print-supported-extensions-aarch64.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
// CHECK-NEXT: bf16 FEAT_BF16 Enable BFloat16 Extension
99
// CHECK-NEXT: brbe FEAT_BRBE Enable Branch Record Buffer Extension
1010
// CHECK-NEXT: bti FEAT_BTI Enable Branch Target Identification
11+
// CHECK-NEXT: cmh FEAT_CMH Enable Armv9.7-A Contention Management Hints
1112
// CHECK-NEXT: cmpbr FEAT_CMPBR Enable Armv9.6-A base compare and branch instructions
1213
// CHECK-NEXT: fcma FEAT_FCMA Enable Armv8.3-A Floating-point complex number support
1314
// CHECK-NEXT: cpa FEAT_CPA Enable Armv9.5-A Checked Pointer Arithmetic
@@ -31,19 +32,23 @@
3132
// CHECK-NEXT: fp8fma FEAT_FP8FMA Enable Armv9.5-A FP8 multiply-add instructions
3233
// CHECK-NEXT: fprcvt FEAT_FPRCVT Enable Armv9.6-A base convert instructions for SIMD&FP scalar register operands of different input and output sizes
3334
// CHECK-NEXT: fp16 FEAT_FP16 Enable half-precision floating-point data processing
35+
// CHECK-NEXT: gcie FEAT_GCIE Enable GICv5 (Generic Interrupt Controller) CPU Interface Extension
3436
// CHECK-NEXT: gcs FEAT_GCS Enable Armv9.4-A Guarded Call Stack Extension
3537
// CHECK-NEXT: hbc FEAT_HBC Enable Armv8.8-A Hinted Conditional Branches Extension
3638
// CHECK-NEXT: i8mm FEAT_I8MM Enable Matrix Multiply Int8 Extension
3739
// CHECK-NEXT: ite FEAT_ITE Enable Armv9.4-A Instrumentation Extension
3840
// CHECK-NEXT: jscvt FEAT_JSCVT Enable Armv8.3-A JavaScript FP conversion instructions
3941
// CHECK-NEXT: ls64 FEAT_LS64, FEAT_LS64_V, FEAT_LS64_ACCDATA Enable Armv8.7-A LD64B/ST64B Accelerator Extension
42+
// CHECK-NEXT: lscp FEAT_LSCP Enable Armv9.7-A Load-acquire and store-release pair extension
4043
// CHECK-NEXT: lse FEAT_LSE Enable Armv8.1-A Large System Extension (LSE) atomic instructions
4144
// CHECK-NEXT: lse128 FEAT_LSE128 Enable Armv9.4-A 128-bit Atomic instructions
4245
// CHECK-NEXT: lsfe FEAT_LSFE Enable Armv9.6-A base Atomic floating-point in-memory instructions
4346
// CHECK-NEXT: lsui FEAT_LSUI Enable Armv9.6-A unprivileged load/store instructions
4447
// CHECK-NEXT: lut FEAT_LUT Enable Lookup Table instructions
4548
// CHECK-NEXT: mops FEAT_MOPS Enable Armv8.8-A memcpy and memset acceleration instructions
49+
// CHECK-NEXT: mpamv2 FEAT_MPAMv2 Enable Armv9.7-A MPAMv2 Lookaside Buffer Invalidate instructions
4650
// CHECK-NEXT: memtag FEAT_MTE, FEAT_MTE2 Enable Memory Tagging Extension
51+
// CHECK-NEXT: mtetc FEAT_MTETC Enable Virtual Memory Tagging Extension
4752
// CHECK-NEXT: simd FEAT_AdvSIMD Enable Advanced SIMD instructions
4853
// CHECK-NEXT: occmo FEAT_OCCMO Enable Armv9.6-A Outer cacheable cache maintenance operations
4954
// CHECK-NEXT: pauth FEAT_PAuth Enable Armv8.3-A Pointer Authentication extension
@@ -76,6 +81,7 @@
7681
// CHECK-NEXT: sme2 FEAT_SME2 Enable Scalable Matrix Extension 2 (SME2) instructions
7782
// CHECK-NEXT: sme2p1 FEAT_SME2p1 Enable Scalable Matrix Extension 2.1 instructions
7883
// CHECK-NEXT: sme2p2 FEAT_SME2p2 Enable Armv9.6-A Scalable Matrix Extension 2.2 instructions
84+
// CHECK-NEXT: sme2p3 FEAT_SME2p3 Enable Armv9.7-A Scalable Matrix Extension 2.3 instructions
7985
// CHECK-NEXT: profile FEAT_SPE Enable Statistical Profiling extension
8086
// CHECK-NEXT: predres2 FEAT_SPECRES2 Enable Speculation Restriction Instruction
8187
// CHECK-NEXT: ssbs FEAT_SSBS, FEAT_SSBS2 Enable Speculative Store Bypass Safe bit
@@ -101,7 +107,9 @@
101107
// CHECK-NEXT: sve2-sm4 Shorthand for +sve2+sve-sm4
102108
// CHECK-NEXT: sve2p1 FEAT_SVE2p1 Enable Scalable Vector Extension 2.1 instructions
103109
// CHECK-NEXT: sve2p2 FEAT_SVE2p2 Enable Armv9.6-A Scalable Vector Extension 2.2 instructions
110+
// CHECK-NEXT: sve2p3 FEAT_SVE2p3 Enable Armv9.7-A Scalable Vector Extension 2.3 instructions
104111
// CHECK-NEXT: the FEAT_THE Enable Armv8.9-A Translation Hardening Extension
112+
// CHECK-NEXT: tlbid FEAT_TLBID Enable Armv9.7-A TLBI Domains extension
105113
// CHECK-NEXT: tlbiw FEAT_TLBIW Enable Armv9.5-A TLBI VMALL for Dirty State
106114
// CHECK-NEXT: tme FEAT_TME Enable Transactional Memory Extension
107115
// CHECK-NEXT: wfxt FEAT_WFxT Enable Armv8.7-A WFET and WFIT instruction

llvm/lib/Target/AArch64/AArch64.td

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,16 @@ def SVEUnsupported : AArch64Unsupported {
7373
SVE2Unsupported.F);
7474
}
7575

76-
let F = [HasSME2p2, HasSVE2p2_or_SME2p2, HasNonStreamingSVE_or_SME2p2,
77-
HasNonStreamingSVE2p2_or_SME2p2] in
78-
def SME2p2Unsupported : AArch64Unsupported;
76+
def SME2p3Unsupported : AArch64Unsupported {
77+
let F = [HasSVE2p3_or_SME2p3];
78+
}
79+
80+
def SME2p2Unsupported : AArch64Unsupported {
81+
let F = !listconcat([HasSME2p2, HasSVE2p2_or_SME2p2,
82+
HasNonStreamingSVE_or_SME2p2,
83+
HasNonStreamingSVE2p2_or_SME2p2],
84+
SME2p3Unsupported.F);
85+
}
7986

8087
def SME2p1Unsupported : AArch64Unsupported {
8188
let F = !listconcat([HasSME2p1, HasSVE2p1_or_SME2p1,

llvm/lib/Target/AArch64/AArch64Features.td

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -589,6 +589,29 @@ def FeatureSSVE_FEXPA : ExtensionWithMArch<"ssve-fexpa", "SSVE_FEXPA", "FEAT_SSV
589589
// Armv9.7 Architecture Extensions
590590
//===----------------------------------------------------------------------===//
591591

592+
def FeatureCMH : ExtensionWithMArch<"cmh", "CMH", "FEAT_CMH",
593+
"Enable Armv9.7-A Contention Management Hints">;
594+
595+
def FeatureLSCP : ExtensionWithMArch<"lscp", "LSCP", "FEAT_LSCP",
596+
"Enable Armv9.7-A Load-acquire and store-release pair extension">;
597+
598+
def FeatureTLBID: ExtensionWithMArch<"tlbid", "TLBID", "FEAT_TLBID",
599+
"Enable Armv9.7-A TLBI Domains extension">;
600+
601+
def FeatureMPAMv2: ExtensionWithMArch<"mpamv2", "MPAMv2", "FEAT_MPAMv2",
602+
"Enable Armv9.7-A MPAMv2 Lookaside Buffer Invalidate instructions">;
603+
604+
def FeatureMTETC: ExtensionWithMArch<"mtetc", "MTETC", "FEAT_MTETC",
605+
"Enable Virtual Memory Tagging Extension">;
606+
607+
def FeatureGCIE: ExtensionWithMArch<"gcie", "GCIE", "FEAT_GCIE",
608+
"Enable GICv5 (Generic Interrupt Controller) CPU Interface Extension">;
609+
610+
def FeatureSVE2p3 : ExtensionWithMArch<"sve2p3", "SVE2p3", "FEAT_SVE2p3",
611+
"Enable Armv9.7-A Scalable Vector Extension 2.3 instructions", [FeatureSVE2p2]>;
612+
613+
def FeatureSME2p3 : ExtensionWithMArch<"sme2p3", "SME2p3", "FEAT_SME2p3",
614+
"Enable Armv9.7-A Scalable Matrix Extension 2.3 instructions", [FeatureSME2p2]>;
592615

593616
//===----------------------------------------------------------------------===//
594617
// Other Features
@@ -949,8 +972,8 @@ def HasV9_6aOps : Architecture64<9, 6, "a", "v9.6a",
949972
!listconcat(HasV9_5aOps.DefaultExts, [FeatureCMPBR, FeatureFPRCVT, FeatureSVE2p2,
950973
FeatureLSUI, FeatureOCCMO])>;
951974
def HasV9_7aOps : Architecture64<9, 7, "a", "v9.7a",
952-
[HasV9_6aOps],
953-
!listconcat(HasV9_6aOps.DefaultExts, [])>;
975+
[HasV9_6aOps, FeatureSVE2p3],
976+
!listconcat(HasV9_6aOps.DefaultExts, [FeatureSVE2p3])>;
954977
def HasV8_0rOps : Architecture64<8, 0, "r", "v8r",
955978
[ //v8.1
956979
FeatureCRC, FeaturePAN, FeatureLSE, FeatureCONTEXTIDREL2,

llvm/lib/Target/AArch64/AArch64InstrFormats.td

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1894,6 +1894,21 @@ def btihint_op : Operand<i32> {
18941894
}];
18951895
}
18961896

1897+
def CMHPriorityHintOperand : AsmOperandClass {
1898+
let Name = "CMHPriorityHint";
1899+
let ParserMethod = "tryParseCMHPriorityHint";
1900+
}
1901+
1902+
def CMHPriorityHint_op : Operand<i32> {
1903+
let ParserMatchClass = CMHPriorityHintOperand;
1904+
let PrintMethod = "printCMHPriorityHintOp";
1905+
let MCOperandPredicate = [{
1906+
if (!MCOp.isImm())
1907+
return false;
1908+
return AArch64CMHPriorityHint::lookupCMHPriorityHintByEncoding(MCOp.getImm()) != nullptr;
1909+
}];
1910+
}
1911+
18971912
class MRSI : RtSystemI<1, (outs GPR64:$Rt), (ins mrs_sysreg_op:$systemreg),
18981913
"mrs", "\t$Rt, $systemreg"> {
18991914
bits<16> systemreg;
@@ -4636,6 +4651,48 @@ multiclass StorePairOffset<bits<2> opc, bit V, RegisterOperand regtype,
46364651
GPR64sp:$Rn, 0)>;
46374652
}
46384653

4654+
class BaseLoadStoreAcquirePairOffset<bits<4> opc, bit L, dag oops, dag iops,
4655+
string asm>
4656+
: I<oops, iops, asm, "\t$Rt, $Rt2, [$Rn, #0]", "", []> {
4657+
bits<5> Rt;
4658+
bits<5> Rt2;
4659+
bits<5> Rn;
4660+
let Inst{31-23} = 0b110110010;
4661+
let Inst{22} = L;
4662+
let Inst{21} = 0b0;
4663+
let Inst{20-16} = Rt2;
4664+
let Inst{15-12} = opc;
4665+
let Inst{11-10} = 0b10;
4666+
let Inst{9-5} = Rn;
4667+
let Inst{4-0} = Rt;
4668+
}
4669+
4670+
multiclass LoadAcquirePairOffset<bits<4> opc, string asm> {
4671+
let hasSideEffects = 0, mayStore = 0, mayLoad = 1 in
4672+
def i : BaseLoadStoreAcquirePairOffset<opc, 0b1,
4673+
(outs GPR64:$Rt, GPR64:$Rt2),
4674+
(ins GPR64sp:$Rn), asm>,
4675+
Sched<[WriteAtomic, WriteLDHi]>;
4676+
4677+
def : InstAlias<asm # "\t$Rt, $Rt2, [$Rn]",
4678+
(!cast<Instruction>(NAME # "i") GPR64:$Rt, GPR64:$Rt2,
4679+
GPR64sp:$Rn)>;
4680+
}
4681+
4682+
4683+
multiclass StoreAcquirePairOffset<bits<4> opc, string asm> {
4684+
let hasSideEffects = 0, mayLoad = 0, mayStore = 1 in
4685+
def i : BaseLoadStoreAcquirePairOffset<opc, 0b0, (outs),
4686+
(ins GPR64:$Rt, GPR64:$Rt2,
4687+
GPR64sp:$Rn),
4688+
asm>,
4689+
Sched<[WriteSTP]>;
4690+
4691+
def : InstAlias<asm # "\t$Rt, $Rt2, [$Rn]",
4692+
(!cast<Instruction>(NAME # "i") GPR64:$Rt, GPR64:$Rt2,
4693+
GPR64sp:$Rn)>;
4694+
}
4695+
46394696
// (pre-indexed)
46404697
class BaseLoadStorePairPreIdx<bits<2> opc, bit V, bit L, dag oops, dag iops,
46414698
string asm>
@@ -13227,3 +13284,34 @@ multiclass SIMDThreeSameVectorFP8MatrixMul<string asm>{
1322713284
let Predicates = [HasNEON, HasF8F32MM];
1322813285
}
1322913286
}
13287+
13288+
//----------------------------------------------------------------------------
13289+
// Contention Management Hints - FEAT_CMH
13290+
//----------------------------------------------------------------------------
13291+
13292+
class SHUHInst<string asm> : I<
13293+
(outs),
13294+
(ins CMHPriorityHint_op:$priority),
13295+
asm, "\t$priority", "", []>, Sched<[]> {
13296+
bits<1> priority;
13297+
let Inst{31-12} = 0b11010101000000110010;
13298+
let Inst{11-8} = 0b0110;
13299+
let Inst{7-6} = 0b01;
13300+
let Inst{5} = priority;
13301+
let Inst{4-0} = 0b11111;
13302+
}
13303+
13304+
multiclass SHUH<string asm> {
13305+
def NAME : SHUHInst<asm>;
13306+
def : InstAlias<asm, (!cast<Instruction>(NAME) 0), 1>;
13307+
}
13308+
13309+
class STCPHInst<string asm> : I<
13310+
(outs),
13311+
(ins),
13312+
asm, "", "", []>, Sched<[]> {
13313+
let Inst{31-12} = 0b11010101000000110010;
13314+
let Inst{11-8} = 0b0110;
13315+
let Inst{7-5} = 0b100;
13316+
let Inst{4-0} = 0b11111;
13317+
}

0 commit comments

Comments
 (0)