Skip to content

Commit 2b426dd

Browse files
momchil-velikovNoumanAmir657
authored andcommitted
[AArch64] Add asssembly/disassembly for FMOP4{A,S} (widening, 2-way, FP16 to FP32) instructions (llvm#113346)
The new instructions are described in https://developer.arm.com/documentation/ddi0602/2024-09/SME-Instructions
1 parent b164ed2 commit 2b426dd

File tree

4 files changed

+460
-0
lines changed

4 files changed

+460
-0
lines changed

llvm/lib/Target/AArch64/AArch64SMEInstrInfo.td

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1020,6 +1020,9 @@ let Predicates = [HasSME2p2] in {
10201020

10211021
defm FMOP4A : sme2_fmop4as_fp32_non_widening<0, "fmop4a">;
10221022
defm FMOP4S : sme2_fmop4as_fp32_non_widening<1, "fmop4s">;
1023+
1024+
defm FMOP4A : sme2_fmop4as_fp16_fp32_widening<0, "fmop4a">;
1025+
defm FMOP4S : sme2_fmop4as_fp16_fp32_widening<1, "fmop4s">;
10231026
} // [HasSME2p2]
10241027

10251028
let Predicates = [HasSME2p2, HasSMEB16B16] in {

llvm/lib/Target/AArch64/SMEInstrFormats.td

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5528,3 +5528,40 @@ multiclass sme2_fmop4as_fp64_non_widening<bit S, string mnemonic> {
55285528
// Multiple vectors
55295529
def _M2Z2Z_D : sme2_fp64_quarter_tile_outer_product<1, 1, S, mnemonic, ZZ_d_mul_r_Lo, ZZ_d_mul_r_Hi>;
55305530
}
5531+
5532+
class sme2_fp16_fp32_quarter_tile_outer_product<bit M, bit N, bit S, string mnemonic, RegisterOperand zn_ty, RegisterOperand zm_ty>
5533+
: I<(outs TileOp32:$ZAda),
5534+
(ins TileOp32:$_ZAda, zn_ty:$Zn, zm_ty:$Zm),
5535+
mnemonic, "\t$ZAda, $Zn, $Zm",
5536+
"", []>, Sched<[]> {
5537+
bits<2> ZAda;
5538+
bits<3> Zn;
5539+
bits<3> Zm;
5540+
5541+
let Inst{31-21} = 0b10000001001;
5542+
let Inst{20} = M;
5543+
let Inst{19-17} = Zm;
5544+
let Inst{16-10} = 0b0000000;
5545+
let Inst{9} = N;
5546+
let Inst{8-6} = Zn;
5547+
let Inst{5} = 0;
5548+
let Inst{4} = S;
5549+
let Inst{3-2} = 0b00;
5550+
let Inst{1-0} = ZAda;
5551+
5552+
let Constraints = "$ZAda = $_ZAda";
5553+
}
5554+
5555+
multiclass sme2_fmop4as_fp16_fp32_widening<bit S, string mnemonic> {
5556+
// Single vectors
5557+
def _MZZ_HtoS : sme2_fp16_fp32_quarter_tile_outer_product<0, 0, S, mnemonic, ZPR16Mul2_Lo, ZPR16Mul2_Hi>;
5558+
5559+
// Multiple and single vectors
5560+
def _M2ZZ_HtoS : sme2_fp16_fp32_quarter_tile_outer_product<0, 1, S, mnemonic, ZZ_h_mul_r_Lo, ZPR16Mul2_Hi>;
5561+
5562+
// Single and multiple vectors
5563+
def _MZ2Z_HtoS : sme2_fp16_fp32_quarter_tile_outer_product<1, 0, S, mnemonic, ZPR16Mul2_Lo, ZZ_h_mul_r_Hi>;
5564+
5565+
// Multiple vectors
5566+
def _M2Z2Z_HtoS : sme2_fp16_fp32_quarter_tile_outer_product<1, 1, S, mnemonic, ZZ_h_mul_r_Lo, ZZ_h_mul_r_Hi>;
5567+
}
Lines changed: 243 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,243 @@
1+
// RUN: not llvm-mc -triple=aarch64 -mattr=+sme2p2 < %s 2>&1 | FileCheck %s
2+
3+
// FMOP4A
4+
5+
// Single vectors
6+
7+
fmop4a za0.d, z0.h, z16.h
8+
// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: invalid matrix operand
9+
10+
fmop4a za4.s, z0.h, z16.h
11+
// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: invalid operand for instruction
12+
13+
fmop4a za0.s, z0.d, z16.h
14+
// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: Invalid restricted vector register
15+
16+
fmop4a za0.s, z15.h, z16.h
17+
// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: Invalid restricted vector register
18+
19+
fmop4a za0.s, z16.h, z16.h
20+
// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: Invalid restricted vector register
21+
22+
fmop4a za0.s, z0.h, z16.d
23+
// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: Invalid restricted vector register, expected even register in z16.h..z30.h
24+
25+
fmop4a za0.s, z12.h, z17.h
26+
// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: Invalid restricted vector register, expected even register in z16.h..z30.h
27+
28+
fmop4a za0.s, z12.h, z14.h
29+
// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: Invalid restricted vector register, expected even register in z16.h..z30.h
30+
31+
fmop4a za0.s, z12.h, z31.h
32+
// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: Invalid restricted vector register, expected even register in z16.h..z30.h
33+
34+
// Single and multiple vectors
35+
36+
fmop4a za0.d, z0.h, {z16.h-z17.h}
37+
// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: invalid matrix operand
38+
39+
fmop4a za4.s, z0.h, {z16.h-z17.h}
40+
// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: invalid operand for instruction
41+
42+
fmop4a za0.s, z0.d, {z16.h-z17.h}
43+
// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: Invalid restricted vector register
44+
45+
fmop4a za0.s, z1.h, {z16.h-z17.h}
46+
// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: Invalid restricted vector register
47+
48+
fmop4a za0.s, z16.h, {z16.h-z17.h}
49+
// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: Invalid restricted vector register
50+
51+
fmop4a za0.s, z0.h, {z16.d-z17.d}
52+
// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: invalid operand for instruction
53+
54+
fmop4a za0.s, z0.h, {z17.h-z18.h}
55+
// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: Invalid vector list, expected list with 2 consecutive SVE vectors in the range z16-z30, where the first vector is a multiple of 2 and with matching element types
56+
57+
fmop4a za0.s, z0.h, {z16.h-z18.h}
58+
// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: invalid operand for instruction
59+
60+
fmop4a za0.s, z0.h, {z12.h-z13.h}
61+
// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: Invalid vector list, expected list with 2 consecutive SVE vectors in the range z16-z30, where the first vector is a multiple of 2 and with matching element types
62+
63+
// Multiple and single vectors
64+
65+
fmop4a za0.d, {z0.h-z1.h}, z16.h
66+
// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: invalid matrix operand
67+
68+
fmop4a za4.s, {z0.h-z1.h}, z16.h
69+
// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: invalid operand for instruction
70+
71+
fmop4a za0.s, {z0.d-z1.h}, z16.h
72+
// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: mismatched register size suffix
73+
74+
fmop4a za0.s, {z1.h-z2.h}, z16.h
75+
// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: Invalid vector list, expected list with 2 consecutive SVE vectors in the range z0-z14, where the first vector is a multiple of 2 and with matching element types
76+
77+
fmop4a za4.s, {z0.h-z2.h}, z16.h
78+
// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: invalid operand for instruction
79+
80+
fmop4a za0.s, {z16.h-z17.h}, z16.h
81+
// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: Invalid vector list, expected list with 2 consecutive SVE vectors in the range z0-z14, where the first vector is a multiple of 2 and with matching element types
82+
83+
fmop4a za0.s, {z0.h-z1.h}, z16.d
84+
// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: Invalid restricted vector register, expected even register in z16.h..z30.h
85+
86+
fmop4a za0.s, {z0.h-z1.h}, z17.h
87+
// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: Invalid restricted vector register, expected even register in z16.h..z30.h
88+
89+
fmop4a za0.s, {z0.h-z1.h}, z12.h
90+
// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: Invalid restricted vector register, expected even register in z16.h..z30.h
91+
92+
// Multiple vectors
93+
94+
fmop4a za0.d, {z0.h-z1.h}, {z16.h-z17.h}
95+
// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: invalid matrix operand
96+
97+
fmop4a za4.s, {z0.h-z1.h}, {z16.h-z17.h}
98+
// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: invalid operand for instruction
99+
100+
fmop4a za0.s, {z0.d-z1.d}, {z16.h-z17.h}
101+
// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: invalid operand for instruction
102+
103+
fmop4a za0.s, {z1.h-z2.h}, {z16.h-z17.h}
104+
// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: Invalid vector list, expected list with 2 consecutive SVE vectors in the range z0-z14, where the first vector is a multiple of 2 and with matching element types
105+
106+
fmop4a za0.s, {z0.h-z2.h}, {z16.h-z17.h}
107+
// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: invalid operand for instruction
108+
109+
fmop4a za0.s, {z18.h-z19.h}, {z16.h-z17.h}
110+
// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: Invalid vector list, expected list with 2 consecutive SVE vectors in the range z0-z14, where the first vector is a multiple of 2 and with matching element types
111+
112+
fmop4a za0.s, {z0.h-z1.h}, {z16.d-z17.d}
113+
// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: invalid operand for instruction
114+
115+
fmop4a za0.s, {z0.h-z1.h}, {z19.h-z20.h}
116+
// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: Invalid vector list, expected list with 2 consecutive SVE vectors in the range z16-z30, where the first vector is a multiple of 2 and with matching element types
117+
118+
fmop4a za0.s, {z0.h-z1.h}, {z18.h-z20.h}
119+
// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: invalid operand for instruction
120+
121+
fmop4a za0.s, {z0.h-z1.h}, {z10.h-z11.h}
122+
// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: Invalid vector list, expected list with 2 consecutive SVE vectors in the range z16-z30, where the first vector is a multiple of 2 and with matching element types
123+
124+
// FMOP4S
125+
126+
// Single vectors
127+
128+
fmop4a za0.d, z0.h, z16.h
129+
// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: invalid matrix operand
130+
131+
fmop4s za4.s, z0.h, z16.h
132+
// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: invalid operand for instruction
133+
134+
fmop4s za0.s, z0.d, z16.h
135+
// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: Invalid restricted vector register
136+
137+
fmop4s za0.s, z15.h, z16.h
138+
// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: Invalid restricted vector register
139+
140+
fmop4s za0.s, z16.h, z16.h
141+
// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: Invalid restricted vector register
142+
143+
fmop4s za0.s, z0.h, z16.d
144+
// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: Invalid restricted vector register, expected even register in z16.h..z30.h
145+
146+
fmop4s za0.s, z12.h, z17.h
147+
// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: Invalid restricted vector register, expected even register in z16.h..z30.h
148+
149+
fmop4s za0.s, z12.h, z14.h
150+
// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: Invalid restricted vector register, expected even register in z16.h..z30.h
151+
152+
fmop4s za0.s, z12.h, z31.h
153+
// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: Invalid restricted vector register, expected even register in z16.h..z30.h
154+
155+
// Single and multiple vectors
156+
157+
fmop4s za0.d, z0.h, {z16.h-z17.h}
158+
// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: invalid matrix operand
159+
160+
fmop4s za4.s, z0.h, {z16.h-z17.h}
161+
// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: invalid operand for instruction
162+
163+
fmop4s za0.s, z0.d, {z16.h-z17.h}
164+
// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: Invalid restricted vector register
165+
166+
fmop4s za0.s, z1.h, {z16.h-z17.h}
167+
// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: Invalid restricted vector register
168+
169+
fmop4s za0.s, z16.h, {z16.h-z17.h}
170+
// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: Invalid restricted vector register
171+
172+
fmop4s za0.s, z0.h, {z16.d-z17.d}
173+
// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: invalid operand for instruction
174+
175+
fmop4s za0.s, z0.h, {z17.h-z18.h}
176+
// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: Invalid vector list, expected list with 2 consecutive SVE vectors in the range z16-z30, where the first vector is a multiple of 2 and with matching element types
177+
178+
fmop4s za0.s, z0.h, {z16.h-z18.h}
179+
// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: invalid operand for instruction
180+
181+
fmop4s za0.s, z0.h, {z12.h-z13.h}
182+
// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: Invalid vector list, expected list with 2 consecutive SVE vectors in the range z16-z30, where the first vector is a multiple of 2 and with matching element types
183+
184+
// Multiple and single vectors
185+
186+
fmop4s za0.d, {z0.h-z1.h}, z16.h
187+
// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: invalid matrix operand
188+
189+
fmop4s za4.s, {z0.h-z1.h}, z16.h
190+
// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: invalid operand for instruction
191+
192+
fmop4s za0.s, {z0.d-z1.h}, z16.h
193+
// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: mismatched register size suffix
194+
195+
fmop4s za0.s, {z1.h-z2.h}, z16.h
196+
// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: Invalid vector list, expected list with 2 consecutive SVE vectors in the range z0-z14, where the first vector is a multiple of 2 and with matching element types
197+
198+
fmop4s za0.s, {z0.h-z2.h}, z16.h
199+
// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: invalid operand for instruction
200+
201+
fmop4s za0.s, {z16.h-z17.h}, z16.h
202+
// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: Invalid vector list, expected list with 2 consecutive SVE vectors in the range z0-z14, where the first vector is a multiple of 2 and with matching element types
203+
204+
fmop4s za0.s, {z0.h-z1.h}, z16.d
205+
// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: Invalid restricted vector register, expected even register in z16.h..z30.h
206+
207+
fmop4s za0.s, {z0.h-z1.h}, z17.h
208+
// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: Invalid restricted vector register, expected even register in z16.h..z30.h
209+
210+
fmop4s za0.s, {z0.h-z1.h}, z12.h
211+
// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: Invalid restricted vector register, expected even register in z16.h..z30.h
212+
213+
// Multiple vectors
214+
215+
fmop4s za0.d, {z0.h-z1.h}, {z16.h-z17.h}
216+
// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: invalid matrix operand
217+
218+
fmop4s za4.s, {z0.h-z1.h}, {z16.h-z17.h}
219+
// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: invalid operand for instruction
220+
221+
fmop4s za0.s, {z0.d-z1.d}, {z16.h-z17.h}
222+
// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: invalid operand for instruction
223+
224+
fmop4s za0.s, {z1.h-z2.h}, {z16.h-z17.h}
225+
// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: Invalid vector list, expected list with 2 consecutive SVE vectors in the range z0-z14, where the first vector is a multiple of 2 and with matching element types
226+
227+
fmop4s za0.s, {z0.h-z2.h}, {z16.h-z17.h}
228+
// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: invalid operand for instruction
229+
230+
fmop4s za0.s, {z18.h-z19.h}, {z16.h-z17.h}
231+
// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: Invalid vector list, expected list with 2 consecutive SVE vectors in the range z0-z14, where the first vector is a multiple of 2 and with matching element types
232+
233+
fmop4s za0.s, {z0.h-z1.h}, {z16.d-z17.d}
234+
// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: invalid operand for instruction
235+
236+
fmop4s za0.s, {z0.h-z1.h}, {z19.h-z20.h}
237+
// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: Invalid vector list, expected list with 2 consecutive SVE vectors in the range z16-z30, where the first vector is a multiple of 2 and with matching element types
238+
239+
fmop4s za0.s, {z0.h-z1.h}, {z18.h-z20.h}
240+
// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: invalid operand for instruction
241+
242+
fmop4s za0.s, {z0.h-z1.h}, {z10.h-z11.h}
243+
// CHECK: [[@LINE-1]]:{{[0-9]+}}: error: Invalid vector list, expected list with 2 consecutive SVE vectors in the range z16-z30, where the first vector is a multiple of 2 and with matching element types

0 commit comments

Comments
 (0)