Skip to content

Commit 5fc712c

Browse files
[AArch64] Add PMOV aliases with implicit portion index (#76056)
In the latest ISA update the syntax of the PMOV instructions was updated to allow the portion index to be optional, default to zero. https://developer.arm.com/documentation/ddi0602/2023-09/SVE-Instructions/PMOV--to-predicate---Move-predicate-from-vector-?lang=en https://developer.arm.com/documentation/ddi0602/2023-09/SVE-Instructions/PMOV--to-vector---Move-predicate-to-vector-?lang=en
1 parent c054d8f commit 5fc712c

File tree

2 files changed

+48
-0
lines changed

2 files changed

+48
-0
lines changed

llvm/lib/Target/AArch64/SVEInstrFormats.td

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10082,6 +10082,12 @@ multiclass sve2p1_vector_to_pred<string mnemonic, SDPatternOperator Op_lane, SDP
1008210082

1008310083
def : InstAlias<mnemonic # "\t$Pd, $Zn",
1008410084
(!cast<Instruction>(NAME # _B) PPR8:$Pd, ZPRAny:$Zn, 0), 1>;
10085+
def : InstAlias<mnemonic # "\t$Pd, $Zn",
10086+
(!cast<Instruction>(NAME # _H) PPR16:$Pd, ZPRAny:$Zn, 0), 0>;
10087+
def : InstAlias<mnemonic # "\t$Pd, $Zn",
10088+
(!cast<Instruction>(NAME # _S) PPR32:$Pd, ZPRAny:$Zn, 0), 0>;
10089+
def : InstAlias<mnemonic # "\t$Pd, $Zn",
10090+
(!cast<Instruction>(NAME # _D) PPR64:$Pd, ZPRAny:$Zn, 0), 0>;
1008510091

1008610092
// any_lane
1008710093
def : Pat<(nxv16i1 (Op_lane (nxv16i8 ZPRAny:$Zn), (i32 timm32_0_0:$Idx))),
@@ -10143,6 +10149,12 @@ multiclass sve2p1_pred_to_vector<string mnemonic, SDPatternOperator MergeOp,
1014310149

1014410150
def : InstAlias<mnemonic # "\t$Zd, $Pn",
1014510151
(!cast<Instruction>(NAME # _B) ZPRAny:$Zd, 0, PPR8:$Pn), 1>;
10152+
def : InstAlias<mnemonic # "\t$Zd, $Pn",
10153+
(!cast<Instruction>(NAME # _H) ZPRAny:$Zd, 0, PPR16:$Pn), 0>;
10154+
def : InstAlias<mnemonic # "\t$Zd, $Pn",
10155+
(!cast<Instruction>(NAME # _S) ZPRAny:$Zd, 0, PPR32:$Pn), 0>;
10156+
def : InstAlias<mnemonic # "\t$Zd, $Pn",
10157+
(!cast<Instruction>(NAME # _D) ZPRAny:$Zd, 0, PPR64:$Pn), 0>;
1014610158

1014710159
// Merge
1014810160
def : Pat<(nxv8i16 (MergeOp (nxv8i16 ZPRAny:$Zd), (nxv8i1 PPR16:$Pn), (i32 timm32_1_1:$Idx))),

llvm/test/MC/AArch64/SVE2p1/pmov.s

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,12 @@ pmov p0.h, z0[0] // 00000101-00101100-00111000-00000000
2020
// CHECK-ERROR: instruction requires: sme2p1 or sve2p1
2121
// CHECK-UNKNOWN: 052c3800 <unknown>
2222

23+
pmov p0.h, z0 // 00000101-00101100-00111000-00000000
24+
// CHECK-INST: pmov p0.h, z0[0]
25+
// CHECK-ENCODING: [0x00,0x38,0x2c,0x05]
26+
// CHECK-ERROR: instruction requires: sme2p1 or sve2p1
27+
// CHECK-UNKNOWN: 052c3800 <unknown>
28+
2329
pmov p5.h, z10[0] // 00000101-00101100-00111001-01000101
2430
// CHECK-INST: pmov p5.h, z10[0]
2531
// CHECK-ENCODING: [0x45,0x39,0x2c,0x05]
@@ -44,6 +50,12 @@ pmov p0.s, z0[0] // 00000101-01101000-00111000-00000000
4450
// CHECK-ERROR: instruction requires: sme2p1 or sve2p1
4551
// CHECK-UNKNOWN: 05683800 <unknown>
4652

53+
pmov p0.s, z0 // 00000101-01101000-00111000-00000000
54+
// CHECK-INST: pmov p0.s, z0[0]
55+
// CHECK-ENCODING: [0x00,0x38,0x68,0x05]
56+
// CHECK-ERROR: instruction requires: sme2p1 or sve2p1
57+
// CHECK-UNKNOWN: 05683800 <unknown>
58+
4759
pmov p5.s, z10[2] // 00000101-01101100-00111001-01000101
4860
// CHECK-INST: pmov p5.s, z10[2]
4961
// CHECK-ENCODING: [0x45,0x39,0x6c,0x05]
@@ -68,6 +80,12 @@ pmov p0.d, z0[0] // 00000101-10101000-00111000-00000000
6880
// CHECK-ERROR: instruction requires: sme2p1 or sve2p1
6981
// CHECK-UNKNOWN: 05a83800 <unknown>
7082

83+
pmov p0.d, z0 // 00000101-10101000-00111000-00000000
84+
// CHECK-INST: pmov p0.d, z0[0]
85+
// CHECK-ENCODING: [0x00,0x38,0xa8,0x05]
86+
// CHECK-ERROR: instruction requires: sme2p1 or sve2p1
87+
// CHECK-UNKNOWN: 05a83800 <unknown>
88+
7189
pmov p5.d, z10[6] // 00000101-11101100-00111001-01000101
7290
// CHECK-INST: pmov p5.d, z10[6]
7391
// CHECK-ENCODING: [0x45,0x39,0xec,0x05]
@@ -122,6 +140,12 @@ pmov z0[0], p0.h // 00000101-00101101-00111000-00000000
122140
// CHECK-ERROR: instruction requires: sme2p1 or sve2p1
123141
// CHECK-UNKNOWN: 052d3800 <unknown>
124142

143+
pmov z0, p0.h // 00000101-00101101-00111000-00000000
144+
// CHECK-INST: pmov z0[0], p0.h
145+
// CHECK-ENCODING: [0x00,0x38,0x2d,0x05]
146+
// CHECK-ERROR: instruction requires: sme2p1 or sve2p1
147+
// CHECK-UNKNOWN: 052d3800 <unknown>
148+
125149
pmov z21[0], p10.h // 00000101-00101101-00111001-01010101
126150
// CHECK-INST: pmov z21[0], p10.h
127151
// CHECK-ENCODING: [0x55,0x39,0x2d,0x05]
@@ -147,6 +171,12 @@ pmov z0[0], p0.s // 00000101-01101001-00111000-00000000
147171
// CHECK-ERROR: instruction requires: sme2p1 or sve2p1
148172
// CHECK-UNKNOWN: 05693800 <unknown>
149173

174+
pmov z0, p0.s // 00000101-01101001-00111000-00000000
175+
// CHECK-INST: pmov z0[0], p0.s
176+
// CHECK-ENCODING: [0x00,0x38,0x69,0x05]
177+
// CHECK-ERROR: instruction requires: sme2p1 or sve2p1
178+
// CHECK-UNKNOWN: 05693800 <unknown>
179+
150180
pmov z21[2], p10.s // 00000101-01101101-00111001-01010101
151181
// CHECK-INST: pmov z21[2], p10.s
152182
// CHECK-ENCODING: [0x55,0x39,0x6d,0x05]
@@ -171,6 +201,12 @@ pmov z0[0], p0.d // 00000101-10101001-00111000-00000000
171201
// CHECK-ERROR: instruction requires: sme2p1 or sve2p1
172202
// CHECK-UNKNOWN: 05a93800 <unknown>
173203

204+
pmov z0, p0.d // 00000101-10101001-00111000-00000000
205+
// CHECK-INST: pmov z0[0], p0.d
206+
// CHECK-ENCODING: [0x00,0x38,0xa9,0x05]
207+
// CHECK-ERROR: instruction requires: sme2p1 or sve2p1
208+
// CHECK-UNKNOWN: 05a93800 <unknown>
209+
174210
pmov z21[6], p10.d // 00000101-11101101-00111001-01010101
175211
// CHECK-INST: pmov z21[6], p10.d
176212
// CHECK-ENCODING: [0x55,0x39,0xed,0x05]

0 commit comments

Comments
 (0)