Skip to content

Commit 61675e2

Browse files
committed
fixup! [AArch64][llvm] Armv9.7-A: Add support for FEAT_CMH and FEAT_LSCP
Oops, forgot to upstream the testcases, and so found I'd missed a bet0 patch from Martin. D'oh!
1 parent 465882c commit 61675e2

File tree

4 files changed

+165
-1
lines changed

4 files changed

+165
-1
lines changed

llvm/lib/Target/AArch64/AArch64InstrFormats.td

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13305,3 +13305,13 @@ multiclass SHUH<string asm> {
1330513305
def NAME : SHUHInst<asm>;
1330613306
def : InstAlias<asm, (!cast<Instruction>(NAME) 0), 1>;
1330713307
}
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+
}

llvm/lib/Target/AArch64/AArch64InstrInfo.td

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11267,7 +11267,8 @@ defm FMMLA : SIMDThreeSameVectorFP8MatrixMul<"fmmla">;
1126711267
//===----------------------------------------------------------------------===//
1126811268

1126911269
let Predicates = [HasCMH] in {
11270-
defm SHUH : SHUH<"shuh">; // Shared Update Hint instruction
11270+
defm SHUH : SHUH<"shuh">; // Shared Update Hint instruction
11271+
def STCPH : STCPHInst<"stcph">; // Store Concurrent Priority Hint instruction
1127111272
}
1127211273

1127311274
include "AArch64InstrAtomics.td"

llvm/lib/Target/AArch64/AArch64SystemOperands.td

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2427,3 +2427,16 @@ def : DC<"CIVAPS", 0b000, 0b0111, 0b1111, 0b001>;
24272427
let Requires = [{ {AArch64::FeaturePoPS, AArch64::FeatureMTE} }] in {
24282428
def : DC<"CIGDVAPS", 0b000, 0b0111, 0b1111, 0b101>;
24292429
}
2430+
2431+
// v9.7a TLBI domains system registers (MemSys)
2432+
foreach n = 0-3 in {
2433+
defvar nb = !cast<bits<3>>(n);
2434+
def : RWSysReg<"VTLBID"#n#"_EL2", 0b11, 0b100, 0b0010, 0b1000, nb>;
2435+
}
2436+
2437+
foreach n = 0-3 in {
2438+
defvar nb = !cast<bits<3>>(n);
2439+
def : RWSysReg<"VTLBIDOS"#n#"_EL2", 0b11, 0b100, 0b0010, 0b1001, nb>;
2440+
}
2441+
2442+
def : ROSysReg<"TLBIDIDR_EL1", 0b11, 0b000, 0b1010, 0b0100, 0b110>;
Lines changed: 140 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,140 @@
1+
// RUN: llvm-mc -triple=aarch64 -show-encoding -mattr=+cmh,+lscp < %s \
2+
// RUN: | FileCheck %s --check-prefixes=CHECK-ENCODING,CHECK-INST
3+
// RUN: not llvm-mc -triple=aarch64 -show-encoding < %s 2>&1 \
4+
// RUN: | FileCheck %s --check-prefix=CHECK-ERROR
5+
// RUN: llvm-mc -triple=aarch64 -filetype=obj -mattr=+all < %s \
6+
// RUN: | llvm-objdump -d --mattr=+cmh,+lscp --no-print-imm-hex - | FileCheck %s --check-prefix=CHECK-INST
7+
// RUN: llvm-mc -triple=aarch64 -filetype=obj -mattr=+all < %s \
8+
// RUN: | llvm-objdump -d --mattr=-cmh,-lscp --no-print-imm-hex - | FileCheck %s --check-prefix=CHECK-UNKNOWN
9+
// Disassemble encoding and check the re-encoding (-show-encoding) matches.
10+
// RUN: llvm-mc -triple=aarch64 -show-encoding -mattr=+cmh,+lscp < %s \
11+
// RUN: | sed '/.text/d' | sed 's/.*encoding: //g' \
12+
// RUN: | llvm-mc -triple=aarch64 -mattr=+cmh,+lscp -disassemble -show-encoding \
13+
// RUN: | FileCheck %s --check-prefixes=CHECK-ENCODING,CHECK-INST
14+
15+
// Armv9.7-A Contention Management Hints (FEAT_CMH).
16+
17+
shuh
18+
// CHECK-INST: shuh
19+
// CHECK-ENCODING: encoding: [0x5f,0x26,0x03,0xd5]
20+
// CHECK-ERROR: error: instruction requires: cmh
21+
// CHECK-UNKNOWN: d503265f hint #50
22+
23+
shuh ph
24+
// CHECK-INST: shuh ph
25+
// CHECK-ENCODING: encoding: [0x7f,0x26,0x03,0xd5]
26+
// CHECK-ERROR: error: instruction requires: cmh
27+
// CHECK-UNKNOWN: d503267f hint #51
28+
29+
stcph
30+
// CHECK-INST: stcph
31+
// CHECK-ENCODING: [0x9f,0x26,0x03,0xd5]
32+
// CHECK-ERROR: error: instruction requires: cmh
33+
// CHECK-UNKNOWN: d503269f hint #52
34+
35+
ldap x0, x1, [x2]
36+
// CHECK-INST: ldap x0, x1, [x2]
37+
// CHECK-ENCODING: encoding: [0x40,0x58,0x41,0xd9]
38+
// CHECK-ERROR: error: instruction requires: lscp
39+
// CHECK-UNKNOWN: d9415840 <unknown>
40+
41+
ldap x0, x1, [x2, #0]
42+
// CHECK-INST: ldap x0, x1, [x2]
43+
// CHECK-ENCODING: encoding: [0x40,0x58,0x41,0xd9]
44+
// CHECK-ERROR: error: instruction requires: lscp
45+
// CHECK-UNKNOWN: d9415840 <unknown>
46+
47+
ldapp x0, x1, [x2]
48+
// CHECK-INST: ldapp x0, x1, [x2]
49+
// CHECK-ENCODING: encoding: [0x40,0x78,0x41,0xd9]
50+
// CHECK-ERROR: error: instruction requires: lscp
51+
// CHECK-UNKNOWN: d9417840 <unknown>
52+
53+
ldapp x0, x1, [x2, #0]
54+
// CHECK-INST: ldapp x0, x1, [x2]
55+
// CHECK-ENCODING: encoding: [0x40,0x78,0x41,0xd9]
56+
// CHECK-ERROR: error: instruction requires: lscp
57+
// CHECK-UNKNOWN: d9417840 <unknown>
58+
59+
stlp x0, x1, [x2, #0]
60+
// CHECK-INST: stlp x0, x1, [x2]
61+
// CHECK-ENCODING: encoding: [0x40,0x58,0x01,0xd9]
62+
// CHECK-ERROR: error: instruction requires: lscp
63+
// CHECK-UNKNOWN: d9015840 <unknown>
64+
65+
stlp x0, x1, [x2]
66+
// CHECK-INST: stlp x0, x1, [x2]
67+
// CHECK-ENCODING: encoding: [0x40,0x58,0x01,0xd9]
68+
// CHECK-ERROR: error: instruction requires: lscp
69+
// CHECK-UNKNOWN: d9015840 <unknown>
70+
71+
mrs x3, VTLBID0_EL2
72+
// CHECK-INST: mrs x3, VTLBID0_EL2
73+
// CHECK-ENCODING: encoding: [0x03,0x28,0x3c,0xd5]
74+
// CHECK-UNKNOWN: d53c2803
75+
mrs x3, VTLBID1_EL2
76+
// CHECK-INST: mrs x3, VTLBID1_EL2
77+
// CHECK-ENCODING: encoding: [0x23,0x28,0x3c,0xd5]
78+
// CHECK-UNKNOWN: d53c2823
79+
mrs x3, VTLBID2_EL2
80+
// CHECK-INST: mrs x3, VTLBID2_EL2
81+
// CHECK-ENCODING: encoding: [0x43,0x28,0x3c,0xd5]
82+
// CHECK-UNKNOWN: d53c2843
83+
mrs x3, VTLBID3_EL2
84+
// CHECK-INST: mrs x3, VTLBID3_EL2
85+
// CHECK-ENCODING: encoding: [0x63,0x28,0x3c,0xd5]
86+
// CHECK-UNKNOWN: d53c2863
87+
mrs x3, VTLBIDOS0_EL2
88+
// CHECK-INST: mrs x3, VTLBIDOS0_EL2
89+
// CHECK-ENCODING: encoding: [0x03,0x29,0x3c,0xd5]
90+
// CHECK-UNKNOWN: d53c2903
91+
mrs x3, VTLBIDOS1_EL2
92+
// CHECK-INST: mrs x3, VTLBIDOS1_EL2
93+
// CHECK-ENCODING: encoding: [0x23,0x29,0x3c,0xd5]
94+
// CHECK-UNKNOWN: d53c2923
95+
mrs x3, VTLBIDOS2_EL2
96+
// CHECK-INST: mrs x3, VTLBIDOS2_EL2
97+
// CHECK-ENCODING: encoding: [0x43,0x29,0x3c,0xd5]
98+
// CHECK-UNKNOWN: d53c2943
99+
mrs x3, VTLBIDOS3_EL2
100+
// CHECK-INST: mrs x3, VTLBIDOS3_EL2
101+
// CHECK-ENCODING: encoding: [0x63,0x29,0x3c,0xd5]
102+
// CHECK-UNKNOWN: d53c2963
103+
mrs x3, TLBIDIDR_EL1
104+
// CHECK-INST: mrs x3, TLBIDIDR_EL1
105+
// CHECK-ENCODING: encoding: [0xc3,0xa4,0x38,0xd5]
106+
// CHECK-UNKNOWN: d538a4c3
107+
108+
msr VTLBID0_EL2, x3
109+
// CHECK-INST: msr VTLBID0_EL2, x3
110+
// CHECK-ENCODING: encoding: [0x03,0x28,0x1c,0xd5]
111+
// CHECK-UNKNOWN: d51c2803
112+
msr VTLBID1_EL2, x3
113+
// CHECK-INST: msr VTLBID1_EL2, x3
114+
// CHECK-ENCODING: encoding: [0x23,0x28,0x1c,0xd5]
115+
// CHECK-UNKNOWN: d51c2823
116+
msr VTLBID2_EL2, x3
117+
// CHECK-INST: msr VTLBID2_EL2, x3
118+
// CHECK-ENCODING: encoding: [0x43,0x28,0x1c,0xd5]
119+
// CHECK-UNKNOWN: d51c2843
120+
msr VTLBID3_EL2, x3
121+
// CHECK-INST: msr VTLBID3_EL2, x3
122+
// CHECK-ENCODING: encoding: [0x63,0x28,0x1c,0xd5]
123+
// CHECK-UNKNOWN: d51c2863
124+
msr VTLBIDOS0_EL2, x3
125+
// CHECK-INST: msr VTLBIDOS0_EL2, x3
126+
// CHECK-ENCODING: encoding: [0x03,0x29,0x1c,0xd5]
127+
// CHECK-UNKNOWN: d51c2903
128+
msr VTLBIDOS1_EL2, x3
129+
// CHECK-INST: msr VTLBIDOS1_EL2, x3
130+
// CHECK-ENCODING: encoding: [0x23,0x29,0x1c,0xd5]
131+
// CHECK-UNKNOWN: d51c2923
132+
msr VTLBIDOS2_EL2, x3
133+
// CHECK-INST: msr VTLBIDOS2_EL2, x3
134+
// CHECK-ENCODING: encoding: [0x43,0x29,0x1c,0xd5]
135+
// CHECK-UNKNOWN: d51c2943
136+
msr VTLBIDOS3_EL2, x3
137+
// CHECK-INST: msr VTLBIDOS3_EL2, x3
138+
// CHECK-ENCODING: encoding: [0x63,0x29,0x1c,0xd5]
139+
// CHECK-UNKNOWN: d51c2963
140+

0 commit comments

Comments
 (0)