1 //=-- SVEInstrFormats.td - AArch64 SVE Instruction classes -*- tablegen -*--=//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // AArch64 Scalable Vector Extension (SVE) Instruction Class Definitions.
12 //===----------------------------------------------------------------------===//
14 def SVEPatternOperand : AsmOperandClass {
15 let Name = "SVEPattern";
16 let ParserMethod = "tryParseSVEPattern";
17 let PredicateMethod = "isSVEPattern";
18 let RenderMethod = "addImmOperands";
19 let DiagnosticType = "InvalidSVEPattern";
22 def sve_pred_enum : Operand<i32>, ImmLeaf<i32, [{
23 return (((uint32_t)Imm) < 32);
26 let PrintMethod = "printSVEPattern";
27 let ParserMatchClass = SVEPatternOperand;
30 def SVEPrefetchOperand : AsmOperandClass {
31 let Name = "SVEPrefetch";
32 let ParserMethod = "tryParsePrefetch<true>";
33 let PredicateMethod = "isPrefetch";
34 let RenderMethod = "addPrefetchOperands";
37 def sve_prfop : Operand<i32>, ImmLeaf<i32, [{
38 return (((uint32_t)Imm) <= 15);
40 let PrintMethod = "printPrefetchOp<true>";
41 let ParserMatchClass = SVEPrefetchOperand;
44 class SVELogicalImmOperand<int Width> : AsmOperandClass {
45 let Name = "SVELogicalImm" # Width;
46 let DiagnosticType = "LogicalSecondSource";
47 let PredicateMethod = "isLogicalImm<int" # Width # "_t>";
48 let RenderMethod = "addLogicalImmOperands<int" # Width # "_t>";
51 def sve_logical_imm8 : Operand<i64> {
52 let ParserMatchClass = SVELogicalImmOperand<8>;
53 let PrintMethod = "printLogicalImm<int8_t>";
55 let MCOperandPredicate = [{
58 int64_t Val = AArch64_AM::decodeLogicalImmediate(MCOp.getImm(), 64);
59 return AArch64_AM::isSVEMaskOfIdenticalElements<int8_t>(Val);
63 def sve_logical_imm16 : Operand<i64> {
64 let ParserMatchClass = SVELogicalImmOperand<16>;
65 let PrintMethod = "printLogicalImm<int16_t>";
67 let MCOperandPredicate = [{
70 int64_t Val = AArch64_AM::decodeLogicalImmediate(MCOp.getImm(), 64);
71 return AArch64_AM::isSVEMaskOfIdenticalElements<int16_t>(Val);
75 def sve_logical_imm32 : Operand<i64> {
76 let ParserMatchClass = SVELogicalImmOperand<32>;
77 let PrintMethod = "printLogicalImm<int32_t>";
79 let MCOperandPredicate = [{
82 int64_t Val = AArch64_AM::decodeLogicalImmediate(MCOp.getImm(), 64);
83 return AArch64_AM::isSVEMaskOfIdenticalElements<int32_t>(Val);
87 class SVEPreferredLogicalImmOperand<int Width> : AsmOperandClass {
88 let Name = "SVEPreferredLogicalImm" # Width;
89 let PredicateMethod = "isSVEPreferredLogicalImm<int" # Width # "_t>";
90 let RenderMethod = "addLogicalImmOperands<int" # Width # "_t>";
93 def sve_preferred_logical_imm16 : Operand<i64> {
94 let ParserMatchClass = SVEPreferredLogicalImmOperand<16>;
95 let PrintMethod = "printSVELogicalImm<int16_t>";
97 let MCOperandPredicate = [{
100 int64_t Val = AArch64_AM::decodeLogicalImmediate(MCOp.getImm(), 64);
101 return AArch64_AM::isSVEMaskOfIdenticalElements<int16_t>(Val) &&
102 AArch64_AM::isSVEMoveMaskPreferredLogicalImmediate(Val);
106 def sve_preferred_logical_imm32 : Operand<i64> {
107 let ParserMatchClass = SVEPreferredLogicalImmOperand<32>;
108 let PrintMethod = "printSVELogicalImm<int32_t>";
110 let MCOperandPredicate = [{
113 int64_t Val = AArch64_AM::decodeLogicalImmediate(MCOp.getImm(), 64);
114 return AArch64_AM::isSVEMaskOfIdenticalElements<int32_t>(Val) &&
115 AArch64_AM::isSVEMoveMaskPreferredLogicalImmediate(Val);
119 def sve_preferred_logical_imm64 : Operand<i64> {
120 let ParserMatchClass = SVEPreferredLogicalImmOperand<64>;
121 let PrintMethod = "printSVELogicalImm<int64_t>";
123 let MCOperandPredicate = [{
126 int64_t Val = AArch64_AM::decodeLogicalImmediate(MCOp.getImm(), 64);
127 return AArch64_AM::isSVEMaskOfIdenticalElements<int64_t>(Val) &&
128 AArch64_AM::isSVEMoveMaskPreferredLogicalImmediate(Val);
132 class SVELogicalImmNotOperand<int Width> : AsmOperandClass {
133 let Name = "SVELogicalImm" # Width # "Not";
134 let DiagnosticType = "LogicalSecondSource";
135 let PredicateMethod = "isLogicalImm<int" # Width # "_t>";
136 let RenderMethod = "addLogicalImmNotOperands<int" # Width # "_t>";
139 def sve_logical_imm8_not : Operand<i64> {
140 let ParserMatchClass = SVELogicalImmNotOperand<8>;
143 def sve_logical_imm16_not : Operand<i64> {
144 let ParserMatchClass = SVELogicalImmNotOperand<16>;
147 def sve_logical_imm32_not : Operand<i64> {
148 let ParserMatchClass = SVELogicalImmNotOperand<32>;
151 class SVEShiftedImmOperand<int ElementWidth, string Infix, string Predicate>
153 let Name = "SVE" # Infix # "Imm" # ElementWidth;
154 let DiagnosticType = "Invalid" # Name;
155 let RenderMethod = "addImmWithOptionalShiftOperands<8>";
156 let ParserMethod = "tryParseImmWithOptionalShift";
157 let PredicateMethod = Predicate;
160 def SVECpyImmOperand8 : SVEShiftedImmOperand<8, "Cpy", "isSVECpyImm<int8_t>">;
161 def SVECpyImmOperand16 : SVEShiftedImmOperand<16, "Cpy", "isSVECpyImm<int16_t>">;
162 def SVECpyImmOperand32 : SVEShiftedImmOperand<32, "Cpy", "isSVECpyImm<int32_t>">;
163 def SVECpyImmOperand64 : SVEShiftedImmOperand<64, "Cpy", "isSVECpyImm<int64_t>">;
165 def SVEAddSubImmOperand8 : SVEShiftedImmOperand<8, "AddSub", "isSVEAddSubImm<int8_t>">;
166 def SVEAddSubImmOperand16 : SVEShiftedImmOperand<16, "AddSub", "isSVEAddSubImm<int16_t>">;
167 def SVEAddSubImmOperand32 : SVEShiftedImmOperand<32, "AddSub", "isSVEAddSubImm<int32_t>">;
168 def SVEAddSubImmOperand64 : SVEShiftedImmOperand<64, "AddSub", "isSVEAddSubImm<int64_t>">;
170 class imm8_opt_lsl<int ElementWidth, string printType,
171 AsmOperandClass OpndClass, code Predicate>
172 : Operand<i32>, ImmLeaf<i32, Predicate> {
173 let EncoderMethod = "getImm8OptLsl";
174 let DecoderMethod = "DecodeImm8OptLsl<" # ElementWidth # ">";
175 let PrintMethod = "printImm8OptLsl<" # printType # ">";
176 let ParserMatchClass = OpndClass;
177 let MIOperandInfo = (ops i32imm, i32imm);
180 def cpy_imm8_opt_lsl_i8 : imm8_opt_lsl<8, "int8_t", SVECpyImmOperand8, [{
181 return AArch64_AM::isSVECpyImm<int8_t>(Imm);
183 def cpy_imm8_opt_lsl_i16 : imm8_opt_lsl<16, "int16_t", SVECpyImmOperand16, [{
184 return AArch64_AM::isSVECpyImm<int16_t>(Imm);
186 def cpy_imm8_opt_lsl_i32 : imm8_opt_lsl<32, "int32_t", SVECpyImmOperand32, [{
187 return AArch64_AM::isSVECpyImm<int32_t>(Imm);
189 def cpy_imm8_opt_lsl_i64 : imm8_opt_lsl<64, "int64_t", SVECpyImmOperand64, [{
190 return AArch64_AM::isSVECpyImm<int64_t>(Imm);
193 def addsub_imm8_opt_lsl_i8 : imm8_opt_lsl<8, "uint8_t", SVEAddSubImmOperand8, [{
194 return AArch64_AM::isSVEAddSubImm<int8_t>(Imm);
196 def addsub_imm8_opt_lsl_i16 : imm8_opt_lsl<16, "uint16_t", SVEAddSubImmOperand16, [{
197 return AArch64_AM::isSVEAddSubImm<int16_t>(Imm);
199 def addsub_imm8_opt_lsl_i32 : imm8_opt_lsl<32, "uint32_t", SVEAddSubImmOperand32, [{
200 return AArch64_AM::isSVEAddSubImm<int32_t>(Imm);
202 def addsub_imm8_opt_lsl_i64 : imm8_opt_lsl<64, "uint64_t", SVEAddSubImmOperand64, [{
203 return AArch64_AM::isSVEAddSubImm<int64_t>(Imm);
206 class SVEExactFPImm<string Suffix, string ValA, string ValB> : AsmOperandClass {
207 let Name = "SVEExactFPImmOperand" # Suffix;
208 let DiagnosticType = "Invalid" # Name;
209 let ParserMethod = "tryParseFPImm<false>";
210 let PredicateMethod = "isExactFPImm<" # ValA # ", " # ValB # ">";
211 let RenderMethod = "addExactFPImmOperands<" # ValA # ", " # ValB # ">";
214 class SVEExactFPImmOperand<string Suffix, string ValA, string ValB> : Operand<i32> {
215 let PrintMethod = "printExactFPImm<" # ValA # ", " # ValB # ">";
216 let ParserMatchClass = SVEExactFPImm<Suffix, ValA, ValB>;
219 def sve_fpimm_half_one
220 : SVEExactFPImmOperand<"HalfOne", "AArch64ExactFPImm::half",
221 "AArch64ExactFPImm::one">;
222 def sve_fpimm_half_two
223 : SVEExactFPImmOperand<"HalfTwo", "AArch64ExactFPImm::half",
224 "AArch64ExactFPImm::two">;
225 def sve_fpimm_zero_one
226 : SVEExactFPImmOperand<"ZeroOne", "AArch64ExactFPImm::zero",
227 "AArch64ExactFPImm::one">;
229 def sve_incdec_imm : Operand<i32>, ImmLeaf<i32, [{
230 return (((uint32_t)Imm) > 0) && (((uint32_t)Imm) < 17);
232 let ParserMatchClass = Imm1_16Operand;
233 let EncoderMethod = "getSVEIncDecImm";
234 let DecoderMethod = "DecodeSVEIncDecImm";
237 //===----------------------------------------------------------------------===//
238 // SVE PTrue - These are used extensively throughout the pattern matching so
239 // it's important we define them first.
240 //===----------------------------------------------------------------------===//
242 class sve_int_ptrue<bits<2> sz8_64, bits<3> opc, string asm, PPRRegOp pprty>
243 : I<(outs pprty:$Pd), (ins sve_pred_enum:$pattern),
244 asm, "\t$Pd, $pattern",
249 let Inst{31-24} = 0b00100101;
250 let Inst{23-22} = sz8_64;
251 let Inst{21-19} = 0b011;
252 let Inst{18-17} = opc{2-1};
253 let Inst{16} = opc{0};
254 let Inst{15-10} = 0b111000;
255 let Inst{9-5} = pattern;
259 let Defs = !if(!eq (opc{0}, 1), [NZCV], []);
262 multiclass sve_int_ptrue<bits<3> opc, string asm> {
263 def _B : sve_int_ptrue<0b00, opc, asm, PPR8>;
264 def _H : sve_int_ptrue<0b01, opc, asm, PPR16>;
265 def _S : sve_int_ptrue<0b10, opc, asm, PPR32>;
266 def _D : sve_int_ptrue<0b11, opc, asm, PPR64>;
268 def : InstAlias<asm # "\t$Pd",
269 (!cast<Instruction>(NAME # _B) PPR8:$Pd, 0b11111), 1>;
270 def : InstAlias<asm # "\t$Pd",
271 (!cast<Instruction>(NAME # _H) PPR16:$Pd, 0b11111), 1>;
272 def : InstAlias<asm # "\t$Pd",
273 (!cast<Instruction>(NAME # _S) PPR32:$Pd, 0b11111), 1>;
274 def : InstAlias<asm # "\t$Pd",
275 (!cast<Instruction>(NAME # _D) PPR64:$Pd, 0b11111), 1>;
278 let Predicates = [HasSVE] in {
279 defm PTRUE : sve_int_ptrue<0b000, "ptrue">;
280 defm PTRUES : sve_int_ptrue<0b001, "ptrues">;
284 //===----------------------------------------------------------------------===//
285 // SVE Predicate Count Group
286 //===----------------------------------------------------------------------===//
288 class sve_int_count_r<bits<2> sz8_64, bits<5> opc, string asm,
289 RegisterOperand dty, PPRRegOp pprty, RegisterOperand sty>
290 : I<(outs dty:$Rdn), (ins pprty:$Pg, sty:$_Rdn),
296 let Inst{31-24} = 0b00100101;
297 let Inst{23-22} = sz8_64;
298 let Inst{21-19} = 0b101;
299 let Inst{18-16} = opc{4-2};
300 let Inst{15-11} = 0b10001;
301 let Inst{10-9} = opc{1-0};
305 // Signed 32bit forms require their GPR operand printed.
306 let AsmString = !if(!eq(opc{4,2-0}, 0b0000),
307 !strconcat(asm, "\t$Rdn, $Pg, $_Rdn"),
308 !strconcat(asm, "\t$Rdn, $Pg"));
309 let Constraints = "$Rdn = $_Rdn";
312 multiclass sve_int_count_r_s32<bits<5> opc, string asm> {
313 def _B : sve_int_count_r<0b00, opc, asm, GPR64z, PPR8, GPR64as32>;
314 def _H : sve_int_count_r<0b01, opc, asm, GPR64z, PPR16, GPR64as32>;
315 def _S : sve_int_count_r<0b10, opc, asm, GPR64z, PPR32, GPR64as32>;
316 def _D : sve_int_count_r<0b11, opc, asm, GPR64z, PPR64, GPR64as32>;
319 multiclass sve_int_count_r_u32<bits<5> opc, string asm> {
320 def _B : sve_int_count_r<0b00, opc, asm, GPR32z, PPR8, GPR32z>;
321 def _H : sve_int_count_r<0b01, opc, asm, GPR32z, PPR16, GPR32z>;
322 def _S : sve_int_count_r<0b10, opc, asm, GPR32z, PPR32, GPR32z>;
323 def _D : sve_int_count_r<0b11, opc, asm, GPR32z, PPR64, GPR32z>;
326 multiclass sve_int_count_r_x64<bits<5> opc, string asm> {
327 def _B : sve_int_count_r<0b00, opc, asm, GPR64z, PPR8, GPR64z>;
328 def _H : sve_int_count_r<0b01, opc, asm, GPR64z, PPR16, GPR64z>;
329 def _S : sve_int_count_r<0b10, opc, asm, GPR64z, PPR32, GPR64z>;
330 def _D : sve_int_count_r<0b11, opc, asm, GPR64z, PPR64, GPR64z>;
333 class sve_int_count_v<bits<2> sz8_64, bits<5> opc, string asm,
335 : I<(outs zprty:$Zdn), (ins zprty:$_Zdn, PPRAny:$Pg),
341 let Inst{31-24} = 0b00100101;
342 let Inst{23-22} = sz8_64;
343 let Inst{21-19} = 0b101;
344 let Inst{18-16} = opc{4-2};
345 let Inst{15-11} = 0b10000;
346 let Inst{10-9} = opc{1-0};
350 let Constraints = "$Zdn = $_Zdn";
353 multiclass sve_int_count_v<bits<5> opc, string asm> {
354 def _H : sve_int_count_v<0b01, opc, asm, ZPR16>;
355 def _S : sve_int_count_v<0b10, opc, asm, ZPR32>;
356 def _D : sve_int_count_v<0b11, opc, asm, ZPR64>;
360 //===----------------------------------------------------------------------===//
361 // SVE Element Count Group
362 //===----------------------------------------------------------------------===//
364 class sve_int_countvlv<bits<5> opc, string asm, ZPRRegOp zprty>
365 : I<(outs zprty:$Zdn), (ins zprty:$_Zdn, sve_pred_enum:$pattern, sve_incdec_imm:$imm4),
366 asm, "\t$Zdn, $pattern, mul $imm4",
372 let Inst{31-24} = 0b00000100;
373 let Inst{23-22} = opc{4-3};
375 let Inst{20} = opc{2};
376 let Inst{19-16} = imm4;
377 let Inst{15-12} = 0b1100;
378 let Inst{11-10} = opc{1-0};
379 let Inst{9-5} = pattern;
382 let Constraints = "$Zdn = $_Zdn";
385 multiclass sve_int_countvlv<bits<5> opc, string asm, ZPRRegOp zprty> {
386 def NAME : sve_int_countvlv<opc, asm, zprty>;
388 def : InstAlias<asm # "\t$Zdn, $pattern",
389 (!cast<Instruction>(NAME) zprty:$Zdn, sve_pred_enum:$pattern, 1), 1>;
390 def : InstAlias<asm # "\t$Zdn",
391 (!cast<Instruction>(NAME) zprty:$Zdn, 0b11111, 1), 2>;
394 class sve_int_pred_pattern_a<bits<3> opc, string asm>
395 : I<(outs GPR64:$Rdn), (ins GPR64:$_Rdn, sve_pred_enum:$pattern, sve_incdec_imm:$imm4),
396 asm, "\t$Rdn, $pattern, mul $imm4",
402 let Inst{31-24} = 0b00000100;
403 let Inst{23-22} = opc{2-1};
404 let Inst{21-20} = 0b11;
405 let Inst{19-16} = imm4;
406 let Inst{15-11} = 0b11100;
407 let Inst{10} = opc{0};
408 let Inst{9-5} = pattern;
411 let Constraints = "$Rdn = $_Rdn";
414 multiclass sve_int_pred_pattern_a<bits<3> opc, string asm> {
415 def NAME : sve_int_pred_pattern_a<opc, asm>;
417 def : InstAlias<asm # "\t$Rdn, $pattern",
418 (!cast<Instruction>(NAME) GPR64:$Rdn, sve_pred_enum:$pattern, 1), 1>;
419 def : InstAlias<asm # "\t$Rdn",
420 (!cast<Instruction>(NAME) GPR64:$Rdn, 0b11111, 1), 2>;
423 class sve_int_pred_pattern_b<bits<5> opc, string asm, RegisterOperand dt,
425 : I<(outs dt:$Rdn), (ins st:$_Rdn, sve_pred_enum:$pattern, sve_incdec_imm:$imm4),
426 asm, "\t$Rdn, $pattern, mul $imm4",
432 let Inst{31-24} = 0b00000100;
433 let Inst{23-22} = opc{4-3};
435 let Inst{20} = opc{2};
436 let Inst{19-16} = imm4;
437 let Inst{15-12} = 0b1111;
438 let Inst{11-10} = opc{1-0};
439 let Inst{9-5} = pattern;
442 // Signed 32bit forms require their GPR operand printed.
443 let AsmString = !if(!eq(opc{2,0}, 0b00),
444 !strconcat(asm, "\t$Rdn, $_Rdn, $pattern, mul $imm4"),
445 !strconcat(asm, "\t$Rdn, $pattern, mul $imm4"));
447 let Constraints = "$Rdn = $_Rdn";
450 multiclass sve_int_pred_pattern_b_s32<bits<5> opc, string asm> {
451 def NAME : sve_int_pred_pattern_b<opc, asm, GPR64z, GPR64as32>;
453 def : InstAlias<asm # "\t$Rd, $Rn, $pattern",
454 (!cast<Instruction>(NAME) GPR64z:$Rd, GPR64as32:$Rn, sve_pred_enum:$pattern, 1), 1>;
455 def : InstAlias<asm # "\t$Rd, $Rn",
456 (!cast<Instruction>(NAME) GPR64z:$Rd, GPR64as32:$Rn, 0b11111, 1), 2>;
459 multiclass sve_int_pred_pattern_b_u32<bits<5> opc, string asm> {
460 def NAME : sve_int_pred_pattern_b<opc, asm, GPR32z, GPR32z>;
462 def : InstAlias<asm # "\t$Rdn, $pattern",
463 (!cast<Instruction>(NAME) GPR32z:$Rdn, sve_pred_enum:$pattern, 1), 1>;
464 def : InstAlias<asm # "\t$Rdn",
465 (!cast<Instruction>(NAME) GPR32z:$Rdn, 0b11111, 1), 2>;
468 multiclass sve_int_pred_pattern_b_x64<bits<5> opc, string asm> {
469 def NAME : sve_int_pred_pattern_b<opc, asm, GPR64z, GPR64z>;
471 def : InstAlias<asm # "\t$Rdn, $pattern",
472 (!cast<Instruction>(NAME) GPR64z:$Rdn, sve_pred_enum:$pattern, 1), 1>;
473 def : InstAlias<asm # "\t$Rdn",
474 (!cast<Instruction>(NAME) GPR64z:$Rdn, 0b11111, 1), 2>;
478 //===----------------------------------------------------------------------===//
479 // SVE Permute - Cross Lane Group
480 //===----------------------------------------------------------------------===//
482 class sve_int_perm_dup_r<bits<2> sz8_64, string asm, ZPRRegOp zprty,
483 RegisterClass srcRegType>
484 : I<(outs zprty:$Zd), (ins srcRegType:$Rn),
490 let Inst{31-24} = 0b00000101;
491 let Inst{23-22} = sz8_64;
492 let Inst{21-10} = 0b100000001110;
497 multiclass sve_int_perm_dup_r<string asm> {
498 def _B : sve_int_perm_dup_r<0b00, asm, ZPR8, GPR32sp>;
499 def _H : sve_int_perm_dup_r<0b01, asm, ZPR16, GPR32sp>;
500 def _S : sve_int_perm_dup_r<0b10, asm, ZPR32, GPR32sp>;
501 def _D : sve_int_perm_dup_r<0b11, asm, ZPR64, GPR64sp>;
503 def : InstAlias<"mov $Zd, $Rn",
504 (!cast<Instruction>(NAME # _B) ZPR8:$Zd, GPR32sp:$Rn), 1>;
505 def : InstAlias<"mov $Zd, $Rn",
506 (!cast<Instruction>(NAME # _H) ZPR16:$Zd, GPR32sp:$Rn), 1>;
507 def : InstAlias<"mov $Zd, $Rn",
508 (!cast<Instruction>(NAME # _S) ZPR32:$Zd, GPR32sp:$Rn), 1>;
509 def : InstAlias<"mov $Zd, $Rn",
510 (!cast<Instruction>(NAME # _D) ZPR64:$Zd, GPR64sp:$Rn), 1>;
513 class sve_int_perm_dup_i<bits<5> tsz, Operand immtype, string asm,
515 : I<(outs zprty:$Zd), (ins zprty:$Zn, immtype:$idx),
516 asm, "\t$Zd, $Zn$idx",
522 let Inst{31-24} = 0b00000101;
523 let Inst{23-22} = {?,?}; // imm3h
525 let Inst{20-16} = tsz;
526 let Inst{15-10} = 0b001000;
531 multiclass sve_int_perm_dup_i<string asm> {
532 def _B : sve_int_perm_dup_i<{?,?,?,?,1}, sve_elm_idx_extdup_b, asm, ZPR8> {
533 let Inst{23-22} = idx{5-4};
534 let Inst{20-17} = idx{3-0};
536 def _H : sve_int_perm_dup_i<{?,?,?,1,0}, sve_elm_idx_extdup_h, asm, ZPR16> {
537 let Inst{23-22} = idx{4-3};
538 let Inst{20-18} = idx{2-0};
540 def _S : sve_int_perm_dup_i<{?,?,1,0,0}, sve_elm_idx_extdup_s, asm, ZPR32> {
541 let Inst{23-22} = idx{3-2};
542 let Inst{20-19} = idx{1-0};
544 def _D : sve_int_perm_dup_i<{?,1,0,0,0}, sve_elm_idx_extdup_d, asm, ZPR64> {
545 let Inst{23-22} = idx{2-1};
546 let Inst{20} = idx{0};
548 def _Q : sve_int_perm_dup_i<{1,0,0,0,0}, sve_elm_idx_extdup_q, asm, ZPR128> {
549 let Inst{23-22} = idx{1-0};
552 def : InstAlias<"mov $Zd, $Zn$idx",
553 (!cast<Instruction>(NAME # _B) ZPR8:$Zd, ZPR8:$Zn, sve_elm_idx_extdup_b:$idx), 1>;
554 def : InstAlias<"mov $Zd, $Zn$idx",
555 (!cast<Instruction>(NAME # _H) ZPR16:$Zd, ZPR16:$Zn, sve_elm_idx_extdup_h:$idx), 1>;
556 def : InstAlias<"mov $Zd, $Zn$idx",
557 (!cast<Instruction>(NAME # _S) ZPR32:$Zd, ZPR32:$Zn, sve_elm_idx_extdup_s:$idx), 1>;
558 def : InstAlias<"mov $Zd, $Zn$idx",
559 (!cast<Instruction>(NAME # _D) ZPR64:$Zd, ZPR64:$Zn, sve_elm_idx_extdup_d:$idx), 1>;
560 def : InstAlias<"mov $Zd, $Zn$idx",
561 (!cast<Instruction>(NAME # _Q) ZPR128:$Zd, ZPR128:$Zn, sve_elm_idx_extdup_q:$idx), 1>;
562 def : InstAlias<"mov $Zd, $Bn",
563 (!cast<Instruction>(NAME # _B) ZPR8:$Zd, FPR8asZPR:$Bn, 0), 2>;
564 def : InstAlias<"mov $Zd, $Hn",
565 (!cast<Instruction>(NAME # _H) ZPR16:$Zd, FPR16asZPR:$Hn, 0), 2>;
566 def : InstAlias<"mov $Zd, $Sn",
567 (!cast<Instruction>(NAME # _S) ZPR32:$Zd, FPR32asZPR:$Sn, 0), 2>;
568 def : InstAlias<"mov $Zd, $Dn",
569 (!cast<Instruction>(NAME # _D) ZPR64:$Zd, FPR64asZPR:$Dn, 0), 2>;
570 def : InstAlias<"mov $Zd, $Qn",
571 (!cast<Instruction>(NAME # _Q) ZPR128:$Zd, FPR128asZPR:$Qn, 0), 2>;
575 //===----------------------------------------------------------------------===//
576 // SVE Vector Select Group
577 //===----------------------------------------------------------------------===//
579 class sve_int_sel_vvv<bits<2> sz8_64, string asm, ZPRRegOp zprty>
580 : I<(outs zprty:$Zd), (ins PPRAny:$Pg, zprty:$Zn, zprty:$Zm),
581 asm, "\t$Zd, $Pg, $Zn, $Zm",
588 let Inst{31-24} = 0b00000101;
589 let Inst{23-22} = sz8_64;
591 let Inst{20-16} = Zm;
592 let Inst{15-14} = 0b11;
593 let Inst{13-10} = Pg;
598 multiclass sve_int_sel_vvv<string asm> {
599 def _B : sve_int_sel_vvv<0b00, asm, ZPR8>;
600 def _H : sve_int_sel_vvv<0b01, asm, ZPR16>;
601 def _S : sve_int_sel_vvv<0b10, asm, ZPR32>;
602 def _D : sve_int_sel_vvv<0b11, asm, ZPR64>;
604 def : InstAlias<"mov $Zd, $Pg/m, $Zn",
605 (!cast<Instruction>(NAME # _B) ZPR8:$Zd, PPRAny:$Pg, ZPR8:$Zn, ZPR8:$Zd), 1>;
606 def : InstAlias<"mov $Zd, $Pg/m, $Zn",
607 (!cast<Instruction>(NAME # _H) ZPR16:$Zd, PPRAny:$Pg, ZPR16:$Zn, ZPR16:$Zd), 1>;
608 def : InstAlias<"mov $Zd, $Pg/m, $Zn",
609 (!cast<Instruction>(NAME # _S) ZPR32:$Zd, PPRAny:$Pg, ZPR32:$Zn, ZPR32:$Zd), 1>;
610 def : InstAlias<"mov $Zd, $Pg/m, $Zn",
611 (!cast<Instruction>(NAME # _D) ZPR64:$Zd, PPRAny:$Pg, ZPR64:$Zn, ZPR64:$Zd), 1>;
615 //===----------------------------------------------------------------------===//
616 // SVE Predicate Logical Operations Group
617 //===----------------------------------------------------------------------===//
619 class sve_int_pred_log<bits<4> opc, string asm>
620 : I<(outs PPR8:$Pd), (ins PPRAny:$Pg, PPR8:$Pn, PPR8:$Pm),
621 asm, "\t$Pd, $Pg/z, $Pn, $Pm",
628 let Inst{31-24} = 0b00100101;
629 let Inst{23-22} = opc{3-2};
630 let Inst{21-20} = 0b00;
631 let Inst{19-16} = Pm;
632 let Inst{15-14} = 0b01;
633 let Inst{13-10} = Pg;
634 let Inst{9} = opc{1};
636 let Inst{4} = opc{0};
639 // SEL has no predication qualifier.
640 let AsmString = !if(!eq(opc, 0b0011),
641 !strconcat(asm, "\t$Pd, $Pg, $Pn, $Pm"),
642 !strconcat(asm, "\t$Pd, $Pg/z, $Pn, $Pm"));
644 let Defs = !if(!eq (opc{2}, 1), [NZCV], []);
648 //===----------------------------------------------------------------------===//
649 // SVE Logical Mask Immediate Group
650 //===----------------------------------------------------------------------===//
652 class sve_int_log_imm<bits<2> opc, string asm>
653 : I<(outs ZPR64:$Zdn), (ins ZPR64:$_Zdn, logical_imm64:$imms13),
654 asm, "\t$Zdn, $_Zdn, $imms13",
658 let Inst{31-24} = 0b00000101;
659 let Inst{23-22} = opc;
660 let Inst{21-18} = 0b0000;
661 let Inst{17-5} = imms13;
664 let Constraints = "$Zdn = $_Zdn";
665 let DecoderMethod = "DecodeSVELogicalImmInstruction";
668 multiclass sve_int_log_imm<bits<2> opc, string asm, string alias> {
669 def NAME : sve_int_log_imm<opc, asm>;
671 def : InstAlias<asm # "\t$Zdn, $Zdn, $imm",
672 (!cast<Instruction>(NAME) ZPR8:$Zdn, sve_logical_imm8:$imm), 4>;
673 def : InstAlias<asm # "\t$Zdn, $Zdn, $imm",
674 (!cast<Instruction>(NAME) ZPR16:$Zdn, sve_logical_imm16:$imm), 3>;
675 def : InstAlias<asm # "\t$Zdn, $Zdn, $imm",
676 (!cast<Instruction>(NAME) ZPR32:$Zdn, sve_logical_imm32:$imm), 2>;
678 def : InstAlias<alias # "\t$Zdn, $Zdn, $imm",
679 (!cast<Instruction>(NAME) ZPR8:$Zdn, sve_logical_imm8_not:$imm), 0>;
680 def : InstAlias<alias # "\t$Zdn, $Zdn, $imm",
681 (!cast<Instruction>(NAME) ZPR16:$Zdn, sve_logical_imm16_not:$imm), 0>;
682 def : InstAlias<alias # "\t$Zdn, $Zdn, $imm",
683 (!cast<Instruction>(NAME) ZPR32:$Zdn, sve_logical_imm32_not:$imm), 0>;
684 def : InstAlias<alias # "\t$Zdn, $Zdn, $imm",
685 (!cast<Instruction>(NAME) ZPR64:$Zdn, logical_imm64_not:$imm), 0>;
688 class sve_int_dup_mask_imm<string asm>
689 : I<(outs ZPR64:$Zd), (ins logical_imm64:$imms),
695 let Inst{31-18} = 0b00000101110000;
696 let Inst{17-5} = imms;
699 let isReMaterializable = 1;
700 let DecoderMethod = "DecodeSVELogicalImmInstruction";
703 multiclass sve_int_dup_mask_imm<string asm> {
704 def NAME : sve_int_dup_mask_imm<asm>;
706 def : InstAlias<"dupm $Zd, $imm",
707 (!cast<Instruction>(NAME) ZPR8:$Zd, sve_logical_imm8:$imm), 4>;
708 def : InstAlias<"dupm $Zd, $imm",
709 (!cast<Instruction>(NAME) ZPR16:$Zd, sve_logical_imm16:$imm), 3>;
710 def : InstAlias<"dupm $Zd, $imm",
711 (!cast<Instruction>(NAME) ZPR32:$Zd, sve_logical_imm32:$imm), 2>;
713 // All Zd.b forms have a CPY/DUP equivalent, hence no byte alias here.
714 def : InstAlias<"mov $Zd, $imm",
715 (!cast<Instruction>(NAME) ZPR16:$Zd, sve_preferred_logical_imm16:$imm), 7>;
716 def : InstAlias<"mov $Zd, $imm",
717 (!cast<Instruction>(NAME) ZPR32:$Zd, sve_preferred_logical_imm32:$imm), 6>;
718 def : InstAlias<"mov $Zd, $imm",
719 (!cast<Instruction>(NAME) ZPR64:$Zd, sve_preferred_logical_imm64:$imm), 5>;
722 //===----------------------------------------------------------------------===//
723 // SVE Integer Arithmetic - Unpredicated Group.
724 //===----------------------------------------------------------------------===//
726 class sve_int_bin_cons_arit_0<bits<2> sz8_64, bits<3> opc, string asm,
728 : I<(outs zprty:$Zd), (ins zprty:$Zn, zprty:$Zm),
729 asm, "\t$Zd, $Zn, $Zm",
734 let Inst{31-24} = 0b00000100;
735 let Inst{23-22} = sz8_64;
737 let Inst{20-16} = Zm;
738 let Inst{15-13} = 0b000;
739 let Inst{12-10} = opc;
744 multiclass sve_int_bin_cons_arit_0<bits<3> opc, string asm> {
745 def _B : sve_int_bin_cons_arit_0<0b00, opc, asm, ZPR8>;
746 def _H : sve_int_bin_cons_arit_0<0b01, opc, asm, ZPR16>;
747 def _S : sve_int_bin_cons_arit_0<0b10, opc, asm, ZPR32>;
748 def _D : sve_int_bin_cons_arit_0<0b11, opc, asm, ZPR64>;
751 //===----------------------------------------------------------------------===//
752 // SVE Floating Point Arithmetic - Predicated Group
753 //===----------------------------------------------------------------------===//
755 class sve_fp_2op_i_p_zds<bits<2> sz, bits<3> opc, string asm,
758 : I<(outs zprty:$Zdn), (ins PPR3bAny:$Pg, zprty:$_Zdn, imm_ty:$i1),
759 asm, "\t$Zdn, $Pg/m, $_Zdn, $i1",
765 let Inst{31-24} = 0b01100101;
766 let Inst{23-22} = sz;
767 let Inst{21-19} = 0b011;
768 let Inst{18-16} = opc;
769 let Inst{15-13} = 0b100;
770 let Inst{12-10} = Pg;
771 let Inst{9-6} = 0b0000;
775 let Constraints = "$Zdn = $_Zdn";
778 multiclass sve_fp_2op_i_p_zds<bits<3> opc, string asm, Operand imm_ty> {
779 def _H : sve_fp_2op_i_p_zds<0b01, opc, asm, ZPR16, imm_ty>;
780 def _S : sve_fp_2op_i_p_zds<0b10, opc, asm, ZPR32, imm_ty>;
781 def _D : sve_fp_2op_i_p_zds<0b11, opc, asm, ZPR64, imm_ty>;
784 //===----------------------------------------------------------------------===//
785 // SVE Floating Point Multiply - Indexed Group
786 //===----------------------------------------------------------------------===//
788 class sve_fp_fmul_by_indexed_elem<bits<2> sz, string asm, ZPRRegOp zprty,
789 ZPRRegOp zprty2, Operand itype>
790 : I<(outs zprty:$Zd), (ins zprty:$Zn, zprty2:$Zm, itype:$iop),
791 asm, "\t$Zd, $Zn, $Zm$iop", "", []>, Sched<[]> {
794 let Inst{31-24} = 0b01100100;
795 let Inst{23-22} = sz;
797 let Inst{15-10} = 0b001000;
802 multiclass sve_fp_fmul_by_indexed_elem<string asm> {
803 def _H : sve_fp_fmul_by_indexed_elem<{0, ?}, asm, ZPR16, ZPR3b16, VectorIndexH> {
806 let Inst{22} = iop{2};
807 let Inst{20-19} = iop{1-0};
808 let Inst{18-16} = Zm;
810 def _S : sve_fp_fmul_by_indexed_elem<0b10, asm, ZPR32, ZPR3b32, VectorIndexS> {
813 let Inst{20-19} = iop;
814 let Inst{18-16} = Zm;
816 def _D : sve_fp_fmul_by_indexed_elem<0b11, asm, ZPR64, ZPR4b64, VectorIndexD> {
820 let Inst{19-16} = Zm;
824 //===----------------------------------------------------------------------===//
825 // SVE Floating Point Complex Multiply-Add Group
826 //===----------------------------------------------------------------------===//
828 class sve_fp_fcmla<bits<2> sz, string asm, ZPRRegOp zprty>
829 : I<(outs zprty:$Zda), (ins PPR3bAny:$Pg, zprty:$_Zda, zprty:$Zn, zprty:$Zm,
830 complexrotateop:$imm),
831 asm, "\t$Zda, $Pg/m, $Zn, $Zm, $imm",
838 let Inst{31-24} = 0b01100100;
839 let Inst{23-22} = sz;
841 let Inst{20-16} = Zm;
843 let Inst{14-13} = imm;
844 let Inst{12-10} = Pg;
848 let Constraints = "$Zda = $_Zda";
851 multiclass sve_fp_fcmla<string asm> {
852 def _H : sve_fp_fcmla<0b01, asm, ZPR16>;
853 def _S : sve_fp_fcmla<0b10, asm, ZPR32>;
854 def _D : sve_fp_fcmla<0b11, asm, ZPR64>;
857 //===----------------------------------------------------------------------===//
858 // SVE Floating Point Complex Multiply-Add - Indexed Group
859 //===----------------------------------------------------------------------===//
861 class sve_fp_fcmla_by_indexed_elem<bits<2> sz, string asm,
863 ZPRRegOp zprty2, Operand itype>
864 : I<(outs zprty:$Zda), (ins zprty:$_Zda, zprty:$Zn, zprty2:$Zm, itype:$iop,
865 complexrotateop:$imm),
866 asm, "\t$Zda, $Zn, $Zm$iop, $imm",
871 let Inst{31-24} = 0b01100100;
872 let Inst{23-22} = sz;
874 let Inst{15-12} = 0b0001;
875 let Inst{11-10} = imm;
879 let Constraints = "$Zda = $_Zda";
882 multiclass sve_fp_fcmla_by_indexed_elem<string asm> {
883 def _H : sve_fp_fcmla_by_indexed_elem<0b10, asm, ZPR16, ZPR3b16, VectorIndexS> {
886 let Inst{20-19} = iop;
887 let Inst{18-16} = Zm;
889 def _S : sve_fp_fcmla_by_indexed_elem<0b11, asm, ZPR32, ZPR4b32, VectorIndexD> {
893 let Inst{19-16} = Zm;
897 //===----------------------------------------------------------------------===//
898 // SVE Floating Point Complex Addition Group
899 //===----------------------------------------------------------------------===//
901 class sve_fp_fcadd<bits<2> sz, string asm, ZPRRegOp zprty>
902 : I<(outs zprty:$Zdn), (ins PPR3bAny:$Pg, zprty:$_Zdn, zprty:$Zm,
903 complexrotateopodd:$imm),
904 asm, "\t$Zdn, $Pg/m, $_Zdn, $Zm, $imm",
911 let Inst{31-24} = 0b01100100;
912 let Inst{23-22} = sz;
915 let Inst{15-13} = 0b100;
916 let Inst{12-10} = Pg;
920 let Constraints = "$Zdn = $_Zdn";
923 multiclass sve_fp_fcadd<string asm> {
924 def _H : sve_fp_fcadd<0b01, asm, ZPR16>;
925 def _S : sve_fp_fcadd<0b10, asm, ZPR32>;
926 def _D : sve_fp_fcadd<0b11, asm, ZPR64>;
929 //===----------------------------------------------------------------------===//
930 // SVE Stack Allocation Group
931 //===----------------------------------------------------------------------===//
933 class sve_int_arith_vl<bit opc, string asm>
934 : I<(outs GPR64sp:$Rd), (ins GPR64sp:$Rn, simm6_32b:$imm6),
935 asm, "\t$Rd, $Rn, $imm6",
941 let Inst{31-23} = 0b000001000;
944 let Inst{20-16} = Rn;
945 let Inst{15-11} = 0b01010;
946 let Inst{10-5} = imm6;
950 class sve_int_read_vl_a<bit op, bits<5> opc2, string asm>
951 : I<(outs GPR64:$Rd), (ins simm6_32b:$imm6),
957 let Inst{31-23} = 0b000001001;
960 let Inst{20-16} = opc2{4-0};
961 let Inst{15-11} = 0b01010;
962 let Inst{10-5} = imm6;
966 //===----------------------------------------------------------------------===//
967 // SVE Permute - In Lane Group
968 //===----------------------------------------------------------------------===//
970 class sve_int_perm_bin_perm_zz<bits<3> opc, bits<2> sz8_64, string asm,
972 : I<(outs zprty:$Zd), (ins zprty:$Zn, zprty:$Zm),
973 asm, "\t$Zd, $Zn, $Zm",
979 let Inst{31-24} = 0b00000101;
980 let Inst{23-22} = sz8_64;
982 let Inst{20-16} = Zm;
983 let Inst{15-13} = 0b011;
984 let Inst{12-10} = opc;
989 multiclass sve_int_perm_bin_perm_zz<bits<3> opc, string asm> {
990 def _B : sve_int_perm_bin_perm_zz<opc, 0b00, asm, ZPR8>;
991 def _H : sve_int_perm_bin_perm_zz<opc, 0b01, asm, ZPR16>;
992 def _S : sve_int_perm_bin_perm_zz<opc, 0b10, asm, ZPR32>;
993 def _D : sve_int_perm_bin_perm_zz<opc, 0b11, asm, ZPR64>;
996 //===----------------------------------------------------------------------===//
997 // SVE Floating Point Unary Operations Group
998 //===----------------------------------------------------------------------===//
1000 class sve_fp_2op_p_zd<bits<7> opc, string asm, RegisterOperand i_zprtype,
1001 RegisterOperand o_zprtype>
1002 : I<(outs o_zprtype:$Zd), (ins i_zprtype:$_Zd, PPR3bAny:$Pg, i_zprtype:$Zn),
1003 asm, "\t$Zd, $Pg/m, $Zn",
1009 let Inst{31-24} = 0b01100101;
1010 let Inst{23-22} = opc{6-5};
1012 let Inst{20-16} = opc{4-0};
1013 let Inst{15-13} = 0b101;
1014 let Inst{12-10} = Pg;
1018 let Constraints = "$Zd = $_Zd";
1022 //===----------------------------------------------------------------------===//
1023 // SVE Integer Arithmetic - Binary Predicated Group
1024 //===----------------------------------------------------------------------===//
1026 class sve_int_bin_pred_arit_log<bits<2> sz8_64, bits<2> fmt, bits<3> opc,
1027 string asm, ZPRRegOp zprty>
1028 : I<(outs zprty:$Zdn), (ins PPR3bAny:$Pg, zprty:$_Zdn, zprty:$Zm),
1029 asm, "\t$Zdn, $Pg/m, $_Zdn, $Zm", "", []>, Sched<[]> {
1033 let Inst{31-24} = 0b00000100;
1034 let Inst{23-22} = sz8_64;
1036 let Inst{20-19} = fmt;
1037 let Inst{18-16} = opc;
1038 let Inst{15-13} = 0b000;
1039 let Inst{12-10} = Pg;
1041 let Inst{4-0} = Zdn;
1043 let Constraints = "$Zdn = $_Zdn";
1046 multiclass sve_int_bin_pred_log<bits<3> opc, string asm> {
1047 def _B : sve_int_bin_pred_arit_log<0b00, 0b11, opc, asm, ZPR8>;
1048 def _H : sve_int_bin_pred_arit_log<0b01, 0b11, opc, asm, ZPR16>;
1049 def _S : sve_int_bin_pred_arit_log<0b10, 0b11, opc, asm, ZPR32>;
1050 def _D : sve_int_bin_pred_arit_log<0b11, 0b11, opc, asm, ZPR64>;
1053 multiclass sve_int_bin_pred_arit_0<bits<3> opc, string asm> {
1054 def _B : sve_int_bin_pred_arit_log<0b00, 0b00, opc, asm, ZPR8>;
1055 def _H : sve_int_bin_pred_arit_log<0b01, 0b00, opc, asm, ZPR16>;
1056 def _S : sve_int_bin_pred_arit_log<0b10, 0b00, opc, asm, ZPR32>;
1057 def _D : sve_int_bin_pred_arit_log<0b11, 0b00, opc, asm, ZPR64>;
1060 multiclass sve_int_bin_pred_arit_1<bits<3> opc, string asm> {
1061 def _B : sve_int_bin_pred_arit_log<0b00, 0b01, opc, asm, ZPR8>;
1062 def _H : sve_int_bin_pred_arit_log<0b01, 0b01, opc, asm, ZPR16>;
1063 def _S : sve_int_bin_pred_arit_log<0b10, 0b01, opc, asm, ZPR32>;
1064 def _D : sve_int_bin_pred_arit_log<0b11, 0b01, opc, asm, ZPR64>;
1067 //===----------------------------------------------------------------------===//
1068 // SVE Integer Arithmetic - Unary Predicated Group
1069 //===----------------------------------------------------------------------===//
1071 class sve_int_un_pred_arit_0<bits<2> sz8_64, bits<3> opc, string asm,
1073 : I<(outs zprty:$Zd), (ins zprty:$_Zd, PPR3bAny:$Pg, zprty:$Zn),
1074 asm, "\t$Zd, $Pg/m, $Zn",
1080 let Inst{31-24} = 0b00000100;
1081 let Inst{23-22} = sz8_64;
1082 let Inst{21-19} = 0b010;
1083 let Inst{18-16} = opc;
1084 let Inst{15-13} = 0b101;
1085 let Inst{12-10} = Pg;
1089 let Constraints = "$Zd = $_Zd";
1092 multiclass sve_int_un_pred_arit_0<bits<3> opc, string asm> {
1093 def _B : sve_int_un_pred_arit_0<0b00, opc, asm, ZPR8>;
1094 def _H : sve_int_un_pred_arit_0<0b01, opc, asm, ZPR16>;
1095 def _S : sve_int_un_pred_arit_0<0b10, opc, asm, ZPR32>;
1096 def _D : sve_int_un_pred_arit_0<0b11, opc, asm, ZPR64>;
1099 multiclass sve_int_un_pred_arit_0_h<bits<3> opc, string asm> {
1100 def _H : sve_int_un_pred_arit_0<0b01, opc, asm, ZPR16>;
1101 def _S : sve_int_un_pred_arit_0<0b10, opc, asm, ZPR32>;
1102 def _D : sve_int_un_pred_arit_0<0b11, opc, asm, ZPR64>;
1105 multiclass sve_int_un_pred_arit_0_w<bits<3> opc, string asm> {
1106 def _S : sve_int_un_pred_arit_0<0b10, opc, asm, ZPR32>;
1107 def _D : sve_int_un_pred_arit_0<0b11, opc, asm, ZPR64>;
1110 multiclass sve_int_un_pred_arit_0_d<bits<3> opc, string asm> {
1111 def _D : sve_int_un_pred_arit_0<0b11, opc, asm, ZPR64>;
1115 //===----------------------------------------------------------------------===//
1116 // SVE Integer Wide Immediate - Unpredicated Group
1117 //===----------------------------------------------------------------------===//
1118 class sve_int_dup_imm<bits<2> sz8_64, string asm,
1119 ZPRRegOp zprty, Operand immtype>
1120 : I<(outs zprty:$Zd), (ins immtype:$imm),
1126 let Inst{31-24} = 0b00100101;
1127 let Inst{23-22} = sz8_64;
1128 let Inst{21-14} = 0b11100011;
1129 let Inst{13} = imm{8}; // sh
1130 let Inst{12-5} = imm{7-0}; // imm8
1133 let isReMaterializable = 1;
1136 multiclass sve_int_dup_imm<string asm> {
1137 def _B : sve_int_dup_imm<0b00, asm, ZPR8, cpy_imm8_opt_lsl_i8>;
1138 def _H : sve_int_dup_imm<0b01, asm, ZPR16, cpy_imm8_opt_lsl_i16>;
1139 def _S : sve_int_dup_imm<0b10, asm, ZPR32, cpy_imm8_opt_lsl_i32>;
1140 def _D : sve_int_dup_imm<0b11, asm, ZPR64, cpy_imm8_opt_lsl_i64>;
1142 def : InstAlias<"mov $Zd, $imm",
1143 (!cast<Instruction>(NAME # _B) ZPR8:$Zd, cpy_imm8_opt_lsl_i8:$imm), 1>;
1144 def : InstAlias<"mov $Zd, $imm",
1145 (!cast<Instruction>(NAME # _H) ZPR16:$Zd, cpy_imm8_opt_lsl_i16:$imm), 1>;
1146 def : InstAlias<"mov $Zd, $imm",
1147 (!cast<Instruction>(NAME # _S) ZPR32:$Zd, cpy_imm8_opt_lsl_i32:$imm), 1>;
1148 def : InstAlias<"mov $Zd, $imm",
1149 (!cast<Instruction>(NAME # _D) ZPR64:$Zd, cpy_imm8_opt_lsl_i64:$imm), 1>;
1151 def : InstAlias<"fmov $Zd, #0.0",
1152 (!cast<Instruction>(NAME # _H) ZPR16:$Zd, 0, 0), 1>;
1153 def : InstAlias<"fmov $Zd, #0.0",
1154 (!cast<Instruction>(NAME # _S) ZPR32:$Zd, 0, 0), 1>;
1155 def : InstAlias<"fmov $Zd, #0.0",
1156 (!cast<Instruction>(NAME # _D) ZPR64:$Zd, 0, 0), 1>;
1159 class sve_int_dup_fpimm<bits<2> sz8_64, Operand fpimmtype,
1160 string asm, ZPRRegOp zprty>
1161 : I<(outs zprty:$Zd), (ins fpimmtype:$imm8),
1162 asm, "\t$Zd, $imm8",
1167 let Inst{31-24} = 0b00100101;
1168 let Inst{23-22} = sz8_64;
1169 let Inst{21-14} = 0b11100111;
1171 let Inst{12-5} = imm8;
1174 let isReMaterializable = 1;
1177 multiclass sve_int_dup_fpimm<string asm> {
1178 def _H : sve_int_dup_fpimm<0b01, fpimm16, asm, ZPR16>;
1179 def _S : sve_int_dup_fpimm<0b10, fpimm32, asm, ZPR32>;
1180 def _D : sve_int_dup_fpimm<0b11, fpimm64, asm, ZPR64>;
1182 def : InstAlias<"fmov $Zd, $imm8",
1183 (!cast<Instruction>(NAME # _H) ZPR16:$Zd, fpimm16:$imm8), 1>;
1184 def : InstAlias<"fmov $Zd, $imm8",
1185 (!cast<Instruction>(NAME # _S) ZPR32:$Zd, fpimm32:$imm8), 1>;
1186 def : InstAlias<"fmov $Zd, $imm8",
1187 (!cast<Instruction>(NAME # _D) ZPR64:$Zd, fpimm64:$imm8), 1>;
1190 class sve_int_arith_imm0<bits<2> sz8_64, bits<3> opc, string asm,
1191 ZPRRegOp zprty, Operand immtype>
1192 : I<(outs zprty:$Zdn), (ins zprty:$_Zdn, immtype:$imm),
1193 asm, "\t$Zdn, $_Zdn, $imm",
1198 let Inst{31-24} = 0b00100101;
1199 let Inst{23-22} = sz8_64;
1200 let Inst{21-19} = 0b100;
1201 let Inst{18-16} = opc;
1202 let Inst{15-14} = 0b11;
1203 let Inst{13} = imm{8}; // sh
1204 let Inst{12-5} = imm{7-0}; // imm8
1205 let Inst{4-0} = Zdn;
1207 let Constraints = "$Zdn = $_Zdn";
1210 multiclass sve_int_arith_imm0<bits<3> opc, string asm> {
1211 def _B : sve_int_arith_imm0<0b00, opc, asm, ZPR8, addsub_imm8_opt_lsl_i8>;
1212 def _H : sve_int_arith_imm0<0b01, opc, asm, ZPR16, addsub_imm8_opt_lsl_i16>;
1213 def _S : sve_int_arith_imm0<0b10, opc, asm, ZPR32, addsub_imm8_opt_lsl_i32>;
1214 def _D : sve_int_arith_imm0<0b11, opc, asm, ZPR64, addsub_imm8_opt_lsl_i64>;
1217 class sve_int_arith_imm1<bits<2> sz8_64, bits<2> opc, string asm,
1218 ZPRRegOp zprty, Operand immtype>
1219 : I<(outs zprty:$Zdn), (ins zprty:$_Zdn, immtype:$imm),
1220 asm, "\t$Zdn, $_Zdn, $imm",
1225 let Inst{31-24} = 0b00100101;
1226 let Inst{23-22} = sz8_64;
1227 let Inst{21-18} = 0b1010;
1228 let Inst{17-16} = opc;
1229 let Inst{15-13} = 0b110;
1230 let Inst{12-5} = imm;
1231 let Inst{4-0} = Zdn;
1233 let Constraints = "$Zdn = $_Zdn";
1236 multiclass sve_int_arith_imm1<bits<2> opc, string asm, Operand immtype> {
1237 def _B : sve_int_arith_imm1<0b00, opc, asm, ZPR8, immtype>;
1238 def _H : sve_int_arith_imm1<0b01, opc, asm, ZPR16, immtype>;
1239 def _S : sve_int_arith_imm1<0b10, opc, asm, ZPR32, immtype>;
1240 def _D : sve_int_arith_imm1<0b11, opc, asm, ZPR64, immtype>;
1243 //===----------------------------------------------------------------------===//
1244 // SVE Bitwise Logical - Unpredicated Group
1245 //===----------------------------------------------------------------------===//
1247 class sve_int_bin_cons_log<bits<2> opc, string asm>
1248 : I<(outs ZPR64:$Zd), (ins ZPR64:$Zn, ZPR64:$Zm),
1249 asm, "\t$Zd, $Zn, $Zm",
1255 let Inst{31-24} = 0b00000100;
1256 let Inst{23-22} = opc{1-0};
1258 let Inst{20-16} = Zm;
1259 let Inst{15-10} = 0b001100;
1265 //===----------------------------------------------------------------------===//
1266 // SVE Integer Wide Immediate - Predicated Group
1267 //===----------------------------------------------------------------------===//
1269 class sve_int_dup_fpimm_pred<bits<2> sz, Operand fpimmtype,
1270 string asm, ZPRRegOp zprty>
1271 : I<(outs zprty:$Zd), (ins zprty:$_Zd, PPRAny:$Pg, fpimmtype:$imm8),
1272 asm, "\t$Zd, $Pg/m, $imm8",
1278 let Inst{31-24} = 0b00000101;
1279 let Inst{23-22} = sz;
1280 let Inst{21-20} = 0b01;
1281 let Inst{19-16} = Pg;
1282 let Inst{15-13} = 0b110;
1283 let Inst{12-5} = imm8;
1286 let Constraints = "$Zd = $_Zd";
1289 multiclass sve_int_dup_fpimm_pred<string asm> {
1290 def _H : sve_int_dup_fpimm_pred<0b01, fpimm16, asm, ZPR16>;
1291 def _S : sve_int_dup_fpimm_pred<0b10, fpimm32, asm, ZPR32>;
1292 def _D : sve_int_dup_fpimm_pred<0b11, fpimm64, asm, ZPR64>;
1294 def : InstAlias<"fmov $Zd, $Pg/m, $imm8",
1295 (!cast<Instruction>(NAME # _H) ZPR16:$Zd, PPRAny:$Pg, fpimm16:$imm8), 1>;
1296 def : InstAlias<"fmov $Zd, $Pg/m, $imm8",
1297 (!cast<Instruction>(NAME # _S) ZPR32:$Zd, PPRAny:$Pg, fpimm32:$imm8), 1>;
1298 def : InstAlias<"fmov $Zd, $Pg/m, $imm8",
1299 (!cast<Instruction>(NAME # _D) ZPR64:$Zd, PPRAny:$Pg, fpimm64:$imm8), 1>;
1302 class sve_int_dup_imm_pred<bits<2> sz8_64, bit m, string asm,
1303 ZPRRegOp zprty, string pred_qual, dag iops>
1304 : I<(outs zprty:$Zd), iops,
1305 asm, "\t$Zd, $Pg"#pred_qual#", $imm",
1306 "", []>, Sched<[]> {
1310 let Inst{31-24} = 0b00000101;
1311 let Inst{23-22} = sz8_64;
1312 let Inst{21-20} = 0b01;
1313 let Inst{19-16} = Pg;
1316 let Inst{13} = imm{8}; // sh
1317 let Inst{12-5} = imm{7-0}; // imm8
1321 multiclass sve_int_dup_imm_pred_merge<string asm> {
1322 let Constraints = "$Zd = $_Zd" in {
1323 def _B : sve_int_dup_imm_pred<0b00, 1, asm, ZPR8, "/m", (ins ZPR8:$_Zd, PPRAny:$Pg, cpy_imm8_opt_lsl_i8:$imm)>;
1324 def _H : sve_int_dup_imm_pred<0b01, 1, asm, ZPR16, "/m", (ins ZPR16:$_Zd, PPRAny:$Pg, cpy_imm8_opt_lsl_i16:$imm)>;
1325 def _S : sve_int_dup_imm_pred<0b10, 1, asm, ZPR32, "/m", (ins ZPR32:$_Zd, PPRAny:$Pg, cpy_imm8_opt_lsl_i32:$imm)>;
1326 def _D : sve_int_dup_imm_pred<0b11, 1, asm, ZPR64, "/m", (ins ZPR64:$_Zd, PPRAny:$Pg, cpy_imm8_opt_lsl_i64:$imm)>;
1329 def : InstAlias<"mov $Zd, $Pg/m, $imm",
1330 (!cast<Instruction>(NAME # _B) ZPR8:$Zd, PPRAny:$Pg, cpy_imm8_opt_lsl_i8:$imm), 1>;
1331 def : InstAlias<"mov $Zd, $Pg/m, $imm",
1332 (!cast<Instruction>(NAME # _H) ZPR16:$Zd, PPRAny:$Pg, cpy_imm8_opt_lsl_i16:$imm), 1>;
1333 def : InstAlias<"mov $Zd, $Pg/m, $imm",
1334 (!cast<Instruction>(NAME # _S) ZPR32:$Zd, PPRAny:$Pg, cpy_imm8_opt_lsl_i32:$imm), 1>;
1335 def : InstAlias<"mov $Zd, $Pg/m, $imm",
1336 (!cast<Instruction>(NAME # _D) ZPR64:$Zd, PPRAny:$Pg, cpy_imm8_opt_lsl_i64:$imm), 1>;
1338 def : InstAlias<"fmov $Zd, $Pg/m, #0.0",
1339 (!cast<Instruction>(NAME # _H) ZPR16:$Zd, PPRAny:$Pg, 0, 0), 0>;
1340 def : InstAlias<"fmov $Zd, $Pg/m, #0.0",
1341 (!cast<Instruction>(NAME # _S) ZPR32:$Zd, PPRAny:$Pg, 0, 0), 0>;
1342 def : InstAlias<"fmov $Zd, $Pg/m, #0.0",
1343 (!cast<Instruction>(NAME # _D) ZPR64:$Zd, PPRAny:$Pg, 0, 0), 0>;
1346 multiclass sve_int_dup_imm_pred_zero<string asm> {
1347 def _B : sve_int_dup_imm_pred<0b00, 0, asm, ZPR8, "/z", (ins PPRAny:$Pg, cpy_imm8_opt_lsl_i8:$imm)>;
1348 def _H : sve_int_dup_imm_pred<0b01, 0, asm, ZPR16, "/z", (ins PPRAny:$Pg, cpy_imm8_opt_lsl_i16:$imm)>;
1349 def _S : sve_int_dup_imm_pred<0b10, 0, asm, ZPR32, "/z", (ins PPRAny:$Pg, cpy_imm8_opt_lsl_i32:$imm)>;
1350 def _D : sve_int_dup_imm_pred<0b11, 0, asm, ZPR64, "/z", (ins PPRAny:$Pg, cpy_imm8_opt_lsl_i64:$imm)>;
1352 def : InstAlias<"mov $Zd, $Pg/z, $imm",
1353 (!cast<Instruction>(NAME # _B) ZPR8:$Zd, PPRAny:$Pg, cpy_imm8_opt_lsl_i8:$imm), 1>;
1354 def : InstAlias<"mov $Zd, $Pg/z, $imm",
1355 (!cast<Instruction>(NAME # _H) ZPR16:$Zd, PPRAny:$Pg, cpy_imm8_opt_lsl_i16:$imm), 1>;
1356 def : InstAlias<"mov $Zd, $Pg/z, $imm",
1357 (!cast<Instruction>(NAME # _S) ZPR32:$Zd, PPRAny:$Pg, cpy_imm8_opt_lsl_i32:$imm), 1>;
1358 def : InstAlias<"mov $Zd, $Pg/z, $imm",
1359 (!cast<Instruction>(NAME # _D) ZPR64:$Zd, PPRAny:$Pg, cpy_imm8_opt_lsl_i64:$imm), 1>;
1362 //===----------------------------------------------------------------------===//
1363 // SVE Integer Compare - Vectors Group
1364 //===----------------------------------------------------------------------===//
1366 class sve_int_cmp<bit cmp_1, bits<2> sz8_64, bits<3> opc, string asm,
1367 PPRRegOp pprty, ZPRRegOp zprty1, ZPRRegOp zprty2>
1368 : I<(outs pprty:$Pd), (ins PPR3bAny:$Pg, zprty1:$Zn, zprty2:$Zm),
1369 asm, "\t$Pd, $Pg/z, $Zn, $Zm",
1376 let Inst{31-24} = 0b00100100;
1377 let Inst{23-22} = sz8_64;
1379 let Inst{20-16} = Zm;
1380 let Inst{15} = opc{2};
1381 let Inst{14} = cmp_1;
1382 let Inst{13} = opc{1};
1383 let Inst{12-10} = Pg;
1385 let Inst{4} = opc{0};
1391 multiclass sve_int_cmp_0<bits<3> opc, string asm> {
1392 def _B : sve_int_cmp<0b0, 0b00, opc, asm, PPR8, ZPR8, ZPR8>;
1393 def _H : sve_int_cmp<0b0, 0b01, opc, asm, PPR16, ZPR16, ZPR16>;
1394 def _S : sve_int_cmp<0b0, 0b10, opc, asm, PPR32, ZPR32, ZPR32>;
1395 def _D : sve_int_cmp<0b0, 0b11, opc, asm, PPR64, ZPR64, ZPR64>;
1398 multiclass sve_int_cmp_0_wide<bits<3> opc, string asm> {
1399 def _B : sve_int_cmp<0b0, 0b00, opc, asm, PPR8, ZPR8, ZPR64>;
1400 def _H : sve_int_cmp<0b0, 0b01, opc, asm, PPR16, ZPR16, ZPR64>;
1401 def _S : sve_int_cmp<0b0, 0b10, opc, asm, PPR32, ZPR32, ZPR64>;
1404 multiclass sve_int_cmp_1_wide<bits<3> opc, string asm> {
1405 def _B : sve_int_cmp<0b1, 0b00, opc, asm, PPR8, ZPR8, ZPR64>;
1406 def _H : sve_int_cmp<0b1, 0b01, opc, asm, PPR16, ZPR16, ZPR64>;
1407 def _S : sve_int_cmp<0b1, 0b10, opc, asm, PPR32, ZPR32, ZPR64>;
1411 //===----------------------------------------------------------------------===//
1412 // SVE Integer Compare - Signed Immediate Group
1413 //===----------------------------------------------------------------------===//
1415 class sve_int_scmp_vi<bits<2> sz8_64, bits<3> opc, string asm, PPRRegOp pprty,
1418 : I<(outs pprty:$Pd), (ins PPR3bAny:$Pg, zprty:$Zn, immtype:$imm5),
1419 asm, "\t$Pd, $Pg/z, $Zn, $imm5",
1426 let Inst{31-24} = 0b00100101;
1427 let Inst{23-22} = sz8_64;
1429 let Inst{20-16} = imm5;
1430 let Inst{15} = opc{2};
1432 let Inst{13} = opc{1};
1433 let Inst{12-10} = Pg;
1435 let Inst{4} = opc{0};
1441 multiclass sve_int_scmp_vi<bits<3> opc, string asm> {
1442 def _B : sve_int_scmp_vi<0b00, opc, asm, PPR8, ZPR8, simm5_32b>;
1443 def _H : sve_int_scmp_vi<0b01, opc, asm, PPR16, ZPR16, simm5_32b>;
1444 def _S : sve_int_scmp_vi<0b10, opc, asm, PPR32, ZPR32, simm5_32b>;
1445 def _D : sve_int_scmp_vi<0b11, opc, asm, PPR64, ZPR64, simm5_64b>;
1449 //===----------------------------------------------------------------------===//
1450 // SVE Integer Compare - Unsigned Immediate Group
1451 //===----------------------------------------------------------------------===//
1453 class sve_int_ucmp_vi<bits<2> sz8_64, bits<2> opc, string asm, PPRRegOp pprty,
1454 ZPRRegOp zprty, Operand immtype>
1455 : I<(outs pprty:$Pd), (ins PPR3bAny:$Pg, zprty:$Zn, immtype:$imm7),
1456 asm, "\t$Pd, $Pg/z, $Zn, $imm7",
1463 let Inst{31-24} = 0b00100100;
1464 let Inst{23-22} = sz8_64;
1466 let Inst{20-14} = imm7;
1467 let Inst{13} = opc{1};
1468 let Inst{12-10} = Pg;
1470 let Inst{4} = opc{0};
1476 multiclass sve_int_ucmp_vi<bits<2> opc, string asm> {
1477 def _B : sve_int_ucmp_vi<0b00, opc, asm, PPR8, ZPR8, imm0_127>;
1478 def _H : sve_int_ucmp_vi<0b01, opc, asm, PPR16, ZPR16, imm0_127>;
1479 def _S : sve_int_ucmp_vi<0b10, opc, asm, PPR32, ZPR32, imm0_127>;
1480 def _D : sve_int_ucmp_vi<0b11, opc, asm, PPR64, ZPR64, imm0_127>;
1484 //===----------------------------------------------------------------------===//
1485 // SVE Floating Point Compare - Vectors Group
1486 //===----------------------------------------------------------------------===//
1488 class sve_fp_3op_p_pd<bits<2> sz, bits<3> opc, string asm, PPRRegOp pprty,
1490 : I<(outs pprty:$Pd), (ins PPR3bAny:$Pg, zprty:$Zn, zprty:$Zm),
1491 asm, "\t$Pd, $Pg/z, $Zn, $Zm",
1498 let Inst{31-24} = 0b01100101;
1499 let Inst{23-22} = sz;
1501 let Inst{20-16} = Zm;
1502 let Inst{15} = opc{2};
1504 let Inst{13} = opc{1};
1505 let Inst{12-10} = Pg;
1507 let Inst{4} = opc{0};
1511 multiclass sve_fp_3op_p_pd<bits<3> opc, string asm> {
1512 def _H : sve_fp_3op_p_pd<0b01, opc, asm, PPR16, ZPR16>;
1513 def _S : sve_fp_3op_p_pd<0b10, opc, asm, PPR32, ZPR32>;
1514 def _D : sve_fp_3op_p_pd<0b11, opc, asm, PPR64, ZPR64>;
1518 //===----------------------------------------------------------------------===//
1519 // SVE Floating Point Compare - with Zero Group
1520 //===----------------------------------------------------------------------===//
1522 class sve_fp_2op_p_pd<bits<2> sz, bits<3> opc, string asm, PPRRegOp pprty,
1524 : I<(outs pprty:$Pd), (ins PPR3bAny:$Pg, zprty:$Zn),
1525 asm, "\t$Pd, $Pg/z, $Zn, #0.0",
1531 let Inst{31-24} = 0b01100101;
1532 let Inst{23-22} = sz;
1533 let Inst{21-18} = 0b0100;
1534 let Inst{17-16} = opc{2-1};
1535 let Inst{15-13} = 0b001;
1536 let Inst{12-10} = Pg;
1538 let Inst{4} = opc{0};
1542 multiclass sve_fp_2op_p_pd<bits<3> opc, string asm> {
1543 def _H : sve_fp_2op_p_pd<0b01, opc, asm, PPR16, ZPR16>;
1544 def _S : sve_fp_2op_p_pd<0b10, opc, asm, PPR32, ZPR32>;
1545 def _D : sve_fp_2op_p_pd<0b11, opc, asm, PPR64, ZPR64>;
1549 //===----------------------------------------------------------------------===//
1550 //SVE Index Generation Group
1551 //===----------------------------------------------------------------------===//
1553 class sve_int_index_ii<bits<2> sz8_64, string asm, ZPRRegOp zprty,
1555 : I<(outs zprty:$Zd), (ins imm_ty:$imm5, imm_ty:$imm5b),
1556 asm, "\t$Zd, $imm5, $imm5b",
1557 "", []>, Sched<[]> {
1561 let Inst{31-24} = 0b00000100;
1562 let Inst{23-22} = sz8_64;
1564 let Inst{20-16} = imm5b;
1565 let Inst{15-10} = 0b010000;
1566 let Inst{9-5} = imm5;
1570 multiclass sve_int_index_ii<string asm> {
1571 def _B : sve_int_index_ii<0b00, asm, ZPR8, simm5_32b>;
1572 def _H : sve_int_index_ii<0b01, asm, ZPR16, simm5_32b>;
1573 def _S : sve_int_index_ii<0b10, asm, ZPR32, simm5_32b>;
1574 def _D : sve_int_index_ii<0b11, asm, ZPR64, simm5_64b>;
1577 class sve_int_index_ir<bits<2> sz8_64, string asm, ZPRRegOp zprty,
1578 RegisterClass srcRegType, Operand imm_ty>
1579 : I<(outs zprty:$Zd), (ins imm_ty:$imm5, srcRegType:$Rm),
1580 asm, "\t$Zd, $imm5, $Rm",
1581 "", []>, Sched<[]> {
1585 let Inst{31-24} = 0b00000100;
1586 let Inst{23-22} = sz8_64;
1588 let Inst{20-16} = Rm;
1589 let Inst{15-10} = 0b010010;
1590 let Inst{9-5} = imm5;
1594 multiclass sve_int_index_ir<string asm> {
1595 def _B : sve_int_index_ir<0b00, asm, ZPR8, GPR32, simm5_32b>;
1596 def _H : sve_int_index_ir<0b01, asm, ZPR16, GPR32, simm5_32b>;
1597 def _S : sve_int_index_ir<0b10, asm, ZPR32, GPR32, simm5_32b>;
1598 def _D : sve_int_index_ir<0b11, asm, ZPR64, GPR64, simm5_64b>;
1601 class sve_int_index_ri<bits<2> sz8_64, string asm, ZPRRegOp zprty,
1602 RegisterClass srcRegType, Operand imm_ty>
1603 : I<(outs zprty:$Zd), (ins srcRegType:$Rn, imm_ty:$imm5),
1604 asm, "\t$Zd, $Rn, $imm5",
1605 "", []>, Sched<[]> {
1609 let Inst{31-24} = 0b00000100;
1610 let Inst{23-22} = sz8_64;
1612 let Inst{20-16} = imm5;
1613 let Inst{15-10} = 0b010001;
1618 multiclass sve_int_index_ri<string asm> {
1619 def _B : sve_int_index_ri<0b00, asm, ZPR8, GPR32, simm5_32b>;
1620 def _H : sve_int_index_ri<0b01, asm, ZPR16, GPR32, simm5_32b>;
1621 def _S : sve_int_index_ri<0b10, asm, ZPR32, GPR32, simm5_32b>;
1622 def _D : sve_int_index_ri<0b11, asm, ZPR64, GPR64, simm5_64b>;
1625 class sve_int_index_rr<bits<2> sz8_64, string asm, ZPRRegOp zprty,
1626 RegisterClass srcRegType>
1627 : I<(outs zprty:$Zd), (ins srcRegType:$Rn, srcRegType:$Rm),
1628 asm, "\t$Zd, $Rn, $Rm",
1629 "", []>, Sched<[]> {
1633 let Inst{31-24} = 0b00000100;
1634 let Inst{23-22} = sz8_64;
1636 let Inst{20-16} = Rm;
1637 let Inst{15-10} = 0b010011;
1642 multiclass sve_int_index_rr<string asm> {
1643 def _B : sve_int_index_rr<0b00, asm, ZPR8, GPR32>;
1644 def _H : sve_int_index_rr<0b01, asm, ZPR16, GPR32>;
1645 def _S : sve_int_index_rr<0b10, asm, ZPR32, GPR32>;
1646 def _D : sve_int_index_rr<0b11, asm, ZPR64, GPR64>;
1649 //===----------------------------------------------------------------------===//
1650 // SVE Bitwise Shift - Predicated Group
1651 //===----------------------------------------------------------------------===//
1653 class sve_int_bin_pred_shift_1<bits<2> sz8_64, bits<3> opc, string asm,
1655 : I<(outs zprty:$Zdn), (ins PPR3bAny:$Pg, zprty:$_Zdn, zprty:$Zm),
1656 asm, "\t$Zdn, $Pg/m, $_Zdn, $Zm",
1662 let Inst{31-24} = 0b00000100;
1663 let Inst{23-22} = sz8_64;
1664 let Inst{21-19} = 0b010;
1665 let Inst{18-16} = opc;
1666 let Inst{15-13} = 0b100;
1667 let Inst{12-10} = Pg;
1669 let Inst{4-0} = Zdn;
1671 let Constraints = "$Zdn = $_Zdn";
1674 multiclass sve_int_bin_pred_shift_1<bits<3> opc, string asm> {
1675 def _B : sve_int_bin_pred_shift_1<0b00, opc, asm, ZPR8>;
1676 def _H : sve_int_bin_pred_shift_1<0b01, opc, asm, ZPR16>;
1677 def _S : sve_int_bin_pred_shift_1<0b10, opc, asm, ZPR32>;
1678 def _D : sve_int_bin_pred_shift_1<0b11, opc, asm, ZPR64>;
1682 //===----------------------------------------------------------------------===//
1683 // SVE Shift by Immediate - Unpredicated Group
1684 //===----------------------------------------------------------------------===//
1686 class sve_int_bin_cons_shift_b<bits<4> tsz8_64, bits<2> opc, string asm,
1687 ZPRRegOp zprty, Operand immtype>
1688 : I<(outs zprty:$Zd), (ins zprty:$Zn, immtype:$imm),
1689 asm, "\t$Zd, $Zn, $imm",
1690 "", []>, Sched<[]> {
1694 let Inst{31-24} = 0b00000100;
1695 let Inst{23-22} = tsz8_64{3-2};
1697 let Inst{20-19} = tsz8_64{1-0};
1698 let Inst{18-16} = imm{2-0}; // imm3
1699 let Inst{15-12} = 0b1001;
1700 let Inst{11-10} = opc;
1705 multiclass sve_int_bin_cons_shift_b_left<bits<2> opc, string asm> {
1706 def _B : sve_int_bin_cons_shift_b<{0,0,0,1}, opc, asm, ZPR8, vecshiftL8>;
1707 def _H : sve_int_bin_cons_shift_b<{0,0,1,?}, opc, asm, ZPR16, vecshiftL16> {
1708 let Inst{19} = imm{3};
1710 def _S : sve_int_bin_cons_shift_b<{0,1,?,?}, opc, asm, ZPR32, vecshiftL32> {
1711 let Inst{20-19} = imm{4-3};
1713 def _D : sve_int_bin_cons_shift_b<{1,?,?,?}, opc, asm, ZPR64, vecshiftL64> {
1714 let Inst{22} = imm{5};
1715 let Inst{20-19} = imm{4-3};
1719 multiclass sve_int_bin_cons_shift_b_right<bits<2> opc, string asm> {
1720 def _B : sve_int_bin_cons_shift_b<{0,0,0,1}, opc, asm, ZPR8, vecshiftR8>;
1721 def _H : sve_int_bin_cons_shift_b<{0,0,1,?}, opc, asm, ZPR16, vecshiftR16> {
1722 let Inst{19} = imm{3};
1724 def _S : sve_int_bin_cons_shift_b<{0,1,?,?}, opc, asm, ZPR32, vecshiftR32> {
1725 let Inst{20-19} = imm{4-3};
1727 def _D : sve_int_bin_cons_shift_b<{1,?,?,?}, opc, asm, ZPR64, vecshiftR64> {
1728 let Inst{22} = imm{5};
1729 let Inst{20-19} = imm{4-3};
1732 //===----------------------------------------------------------------------===//
1733 // SVE Memory - Store Group
1734 //===----------------------------------------------------------------------===//
1736 class sve_mem_cst_si<bits<2> msz, bits<2> esz, string asm,
1737 RegisterOperand VecList>
1738 : I<(outs), (ins VecList:$Zt, PPR3bAny:$Pg, GPR64sp:$Rn, simm4s1:$imm4),
1739 asm, "\t$Zt, $Pg, [$Rn, $imm4, mul vl]",
1746 let Inst{31-25} = 0b1110010;
1747 let Inst{24-23} = msz;
1748 let Inst{22-21} = esz;
1750 let Inst{19-16} = imm4;
1751 let Inst{15-13} = 0b111;
1752 let Inst{12-10} = Pg;
1759 multiclass sve_mem_cst_si<bits<2> msz, bits<2> esz, string asm,
1760 RegisterOperand listty, ZPRRegOp zprty>
1762 def NAME : sve_mem_cst_si<msz, esz, asm, listty>;
1764 def : InstAlias<asm # "\t$Zt, $Pg, [$Rn, $imm4, mul vl]",
1765 (!cast<Instruction>(NAME) zprty:$Zt, PPR3bAny:$Pg, GPR64sp:$Rn, simm4s1:$imm4), 0>;
1766 def : InstAlias<asm # "\t$Zt, $Pg, [$Rn]",
1767 (!cast<Instruction>(NAME) zprty:$Zt, PPR3bAny:$Pg, GPR64sp:$Rn, 0), 0>;
1768 def : InstAlias<asm # "\t$Zt, $Pg, [$Rn]",
1769 (!cast<Instruction>(NAME) listty:$Zt, PPR3bAny:$Pg, GPR64sp:$Rn, 0), 1>;
1772 class sve_mem_est_si<bits<2> sz, bits<2> nregs, RegisterOperand VecList,
1773 string asm, Operand immtype>
1774 : I<(outs), (ins VecList:$Zt, PPR3bAny:$Pg, GPR64sp:$Rn, immtype:$imm4),
1775 asm, "\t$Zt, $Pg, [$Rn, $imm4, mul vl]",
1782 let Inst{31-25} = 0b1110010;
1783 let Inst{24-23} = sz;
1784 let Inst{22-21} = nregs;
1786 let Inst{19-16} = imm4;
1787 let Inst{15-13} = 0b111;
1788 let Inst{12-10} = Pg;
1795 multiclass sve_mem_est_si<bits<2> sz, bits<2> nregs, RegisterOperand VecList,
1796 string asm, Operand immtype> {
1797 def NAME : sve_mem_est_si<sz, nregs, VecList, asm, immtype>;
1799 def : InstAlias<asm # "\t$Zt, $Pg, [$Rn]",
1800 (!cast<Instruction>(NAME) VecList:$Zt, PPR3bAny:$Pg, GPR64sp:$Rn, 0), 1>;
1803 class sve_mem_est_ss<bits<2> sz, bits<2> nregs, RegisterOperand VecList,
1804 string asm, RegisterOperand gprty>
1805 : I<(outs), (ins VecList:$Zt, PPR3bAny:$Pg, GPR64sp:$Rn, gprty:$Rm),
1806 asm, "\t$Zt, $Pg, [$Rn, $Rm]",
1813 let Inst{31-25} = 0b1110010;
1814 let Inst{24-23} = sz;
1815 let Inst{22-21} = nregs;
1816 let Inst{20-16} = Rm;
1817 let Inst{15-13} = 0b011;
1818 let Inst{12-10} = Pg;
1825 class sve_mem_cst_ss_base<bits<4> dtype, string asm,
1826 RegisterOperand listty, RegisterOperand gprty>
1827 : I<(outs), (ins listty:$Zt, PPR3bAny:$Pg, GPR64sp:$Rn, gprty:$Rm),
1828 asm, "\t$Zt, $Pg, [$Rn, $Rm]",
1835 let Inst{31-25} = 0b1110010;
1836 let Inst{24-21} = dtype;
1837 let Inst{20-16} = Rm;
1838 let Inst{15-13} = 0b010;
1839 let Inst{12-10} = Pg;
1846 multiclass sve_mem_cst_ss<bits<4> dtype, string asm,
1847 RegisterOperand listty, ZPRRegOp zprty,
1848 RegisterOperand gprty> {
1849 def NAME : sve_mem_cst_ss_base<dtype, asm, listty, gprty>;
1851 def : InstAlias<asm # "\t$Zt, $Pg, [$Rn, $Rm]",
1852 (!cast<Instruction>(NAME) zprty:$Zt, PPR3bAny:$Pg, GPR64sp:$Rn, gprty:$Rm), 0>;
1855 class sve_mem_cstnt_si<bits<2> msz, string asm, RegisterOperand VecList>
1856 : I<(outs), (ins VecList:$Zt, PPR3bAny:$Pg, GPR64sp:$Rn, simm4s1:$imm4),
1857 asm, "\t$Zt, $Pg, [$Rn, $imm4, mul vl]",
1864 let Inst{31-25} = 0b1110010;
1865 let Inst{24-23} = msz;
1866 let Inst{22-20} = 0b001;
1867 let Inst{19-16} = imm4;
1868 let Inst{15-13} = 0b111;
1869 let Inst{12-10} = Pg;
1876 multiclass sve_mem_cstnt_si<bits<2> msz, string asm, RegisterOperand listty,
1878 def NAME : sve_mem_cstnt_si<msz, asm, listty>;
1880 def : InstAlias<asm # "\t$Zt, $Pg, [$Rn]",
1881 (!cast<Instruction>(NAME) zprty:$Zt, PPR3bAny:$Pg, GPR64sp:$Rn, 0), 0>;
1882 def : InstAlias<asm # "\t$Zt, $Pg, [$Rn, $imm4, mul vl]",
1883 (!cast<Instruction>(NAME) zprty:$Zt, PPR3bAny:$Pg, GPR64sp:$Rn, simm4s1:$imm4), 0>;
1884 def : InstAlias<asm # "\t$Zt, $Pg, [$Rn]",
1885 (!cast<Instruction>(NAME) listty:$Zt, PPR3bAny:$Pg, GPR64sp:$Rn, 0), 1>;
1888 class sve_mem_cstnt_ss_base<bits<2> msz, string asm, RegisterOperand listty,
1889 RegisterOperand gprty>
1890 : I<(outs), (ins listty:$Zt, PPR3bAny:$Pg, GPR64sp:$Rn, gprty:$Rm),
1891 asm, "\t$Zt, $Pg, [$Rn, $Rm]",
1898 let Inst{31-25} = 0b1110010;
1899 let Inst{24-23} = msz;
1900 let Inst{22-21} = 0b00;
1901 let Inst{20-16} = Rm;
1902 let Inst{15-13} = 0b011;
1903 let Inst{12-10} = Pg;
1910 multiclass sve_mem_cstnt_ss<bits<2> msz, string asm, RegisterOperand listty,
1911 ZPRRegOp zprty, RegisterOperand gprty> {
1912 def NAME : sve_mem_cstnt_ss_base<msz, asm, listty, gprty>;
1914 def : InstAlias<asm # "\t$Zt, $Pg, [$Rn, $Rm]",
1915 (!cast<Instruction>(NAME) zprty:$Zt, PPR3bAny:$Pg, GPR64sp:$Rn, gprty:$Rm), 0>;
1918 class sve_mem_sst_sv<bits<3> opc, bit xs, bit scaled, string asm,
1919 RegisterOperand VecList, RegisterOperand zprext>
1920 : I<(outs), (ins VecList:$Zt, PPR3bAny:$Pg, GPR64sp:$Rn, zprext:$Zm),
1921 asm, "\t$Zt, $Pg, [$Rn, $Zm]",
1928 let Inst{31-25} = 0b1110010;
1929 let Inst{24-22} = opc;
1930 let Inst{21} = scaled;
1931 let Inst{20-16} = Zm;
1935 let Inst{12-10} = Pg;
1942 multiclass sve_mem_sst_sv_32_scaled<bits<3> opc, string asm,
1943 RegisterOperand listty,
1945 RegisterOperand sxtw_opnd,
1946 RegisterOperand uxtw_opnd > {
1947 def _UXTW_SCALED : sve_mem_sst_sv<opc, 0, 1, asm, listty, uxtw_opnd>;
1948 def _SXTW_SCALED : sve_mem_sst_sv<opc, 1, 1, asm, listty, sxtw_opnd>;
1950 def : InstAlias<asm # "\t$Zt, $Pg, [$Rn, $Zm]",
1951 (!cast<Instruction>(NAME # _UXTW_SCALED) zprty:$Zt, PPR3bAny:$Pg, GPR64sp:$Rn, uxtw_opnd:$Zm), 0>;
1952 def : InstAlias<asm # "\t$Zt, $Pg, [$Rn, $Zm]",
1953 (!cast<Instruction>(NAME # _SXTW_SCALED) zprty:$Zt, PPR3bAny:$Pg, GPR64sp:$Rn, sxtw_opnd:$Zm), 0>;
1956 multiclass sve_mem_sst_sv_32_unscaled<bits<3> opc, string asm,
1957 RegisterOperand listty,
1959 RegisterOperand sxtw_opnd,
1960 RegisterOperand uxtw_opnd> {
1961 def _UXTW : sve_mem_sst_sv<opc, 0, 0, asm, listty, uxtw_opnd>;
1962 def _SXTW : sve_mem_sst_sv<opc, 1, 0, asm, listty, sxtw_opnd>;
1964 def : InstAlias<asm # "\t$Zt, $Pg, [$Rn, $Zm]",
1965 (!cast<Instruction>(NAME # _UXTW) zprty:$Zt, PPR3bAny:$Pg, GPR64sp:$Rn, uxtw_opnd:$Zm), 0>;
1966 def : InstAlias<asm # "\t$Zt, $Pg, [$Rn, $Zm]",
1967 (!cast<Instruction>(NAME # _SXTW) zprty:$Zt, PPR3bAny:$Pg, GPR64sp:$Rn, sxtw_opnd:$Zm), 0>;
1970 class sve_mem_sst_sv2<bits<2> msz, bit scaled, string asm,
1971 RegisterOperand zprext>
1972 : I<(outs), (ins Z_d:$Zt, PPR3bAny:$Pg, GPR64sp:$Rn, zprext:$Zm),
1973 asm, "\t$Zt, $Pg, [$Rn, $Zm]",
1980 let Inst{31-25} = 0b1110010;
1981 let Inst{24-23} = msz;
1983 let Inst{21} = scaled;
1984 let Inst{20-16} = Zm;
1985 let Inst{15-13} = 0b101;
1986 let Inst{12-10} = Pg;
1993 multiclass sve_mem_sst_sv_64_scaled<bits<2> msz, string asm,
1994 RegisterOperand zprext> {
1995 def "" : sve_mem_sst_sv2<msz, 1, asm, zprext>;
1997 def : InstAlias<asm # "\t$Zt, $Pg, [$Rn, $Zm]",
1998 (!cast<Instruction>(NAME) ZPR64:$Zt, PPR3bAny:$Pg, GPR64sp:$Rn, zprext:$Zm), 0>;
2002 multiclass sve_mem_sst_sv_64_unscaled<bits<2> msz, string asm> {
2003 def "" : sve_mem_sst_sv2<msz, 0, asm, ZPR64ExtLSL8>;
2005 def : InstAlias<asm # "\t$Zt, $Pg, [$Rn, $Zm]",
2006 (!cast<Instruction>(NAME) ZPR64:$Zt, PPR3bAny:$Pg, GPR64sp:$Rn, ZPR64ExtLSL8:$Zm), 0>;
2009 class sve_mem_sst_vi<bits<3> opc, string asm, ZPRRegOp zprty,
2010 RegisterOperand VecList, Operand imm_ty>
2011 : I<(outs), (ins VecList:$Zt, PPR3bAny:$Pg, zprty:$Zn, imm_ty:$imm5),
2012 asm, "\t$Zt, $Pg, [$Zn, $imm5]",
2019 let Inst{31-25} = 0b1110010;
2020 let Inst{24-23} = opc{2-1};
2022 let Inst{21} = opc{0};
2023 let Inst{20-16} = imm5;
2024 let Inst{15-13} = 0b101;
2025 let Inst{12-10} = Pg;
2032 multiclass sve_mem_sst_vi_ptrs<bits<3> opc, string asm, RegisterOperand listty,
2033 ZPRRegOp zprty, Operand imm_ty> {
2034 def _IMM : sve_mem_sst_vi<opc, asm, zprty, listty, imm_ty>;
2036 def : InstAlias<asm # "\t$Zt, $Pg, [$Zn]",
2037 (!cast<Instruction>(NAME # _IMM) zprty:$Zt, PPR3bAny:$Pg, zprty:$Zn, 0), 0>;
2038 def : InstAlias<asm # "\t$Zt, $Pg, [$Zn, $imm5]",
2039 (!cast<Instruction>(NAME # _IMM) zprty:$Zt, PPR3bAny:$Pg, zprty:$Zn, imm_ty:$imm5), 0>;
2040 def : InstAlias<asm # "\t$Zt, $Pg, [$Zn]",
2041 (!cast<Instruction>(NAME # _IMM) listty:$Zt, PPR3bAny:$Pg, zprty:$Zn, 0), 1>;
2044 class sve_mem_z_spill<string asm>
2045 : I<(outs), (ins ZPRAny:$Zt, GPR64sp:$Rn, simm9:$imm9),
2046 asm, "\t$Zt, [$Rn, $imm9, mul vl]",
2052 let Inst{31-22} = 0b1110010110;
2053 let Inst{21-16} = imm9{8-3};
2054 let Inst{15-13} = 0b010;
2055 let Inst{12-10} = imm9{2-0};
2062 multiclass sve_mem_z_spill<string asm> {
2063 def NAME : sve_mem_z_spill<asm>;
2065 def : InstAlias<asm # "\t$Zt, [$Rn]",
2066 (!cast<Instruction>(NAME) ZPRAny:$Zt, GPR64sp:$Rn, 0), 1>;
2069 class sve_mem_p_spill<string asm>
2070 : I<(outs), (ins PPRAny:$Pt, GPR64sp:$Rn, simm9:$imm9),
2071 asm, "\t$Pt, [$Rn, $imm9, mul vl]",
2077 let Inst{31-22} = 0b1110010110;
2078 let Inst{21-16} = imm9{8-3};
2079 let Inst{15-13} = 0b000;
2080 let Inst{12-10} = imm9{2-0};
2088 multiclass sve_mem_p_spill<string asm> {
2089 def NAME : sve_mem_p_spill<asm>;
2091 def : InstAlias<asm # "\t$Pt, [$Rn]",
2092 (!cast<Instruction>(NAME) PPRAny:$Pt, GPR64sp:$Rn, 0), 1>;
2095 //===----------------------------------------------------------------------===//
2096 // SVE Permute - Predicates Group
2097 //===----------------------------------------------------------------------===//
2099 class sve_int_perm_bin_perm_pp<bits<3> opc, bits<2> sz8_64, string asm,
2101 : I<(outs pprty:$Pd), (ins pprty:$Pn, pprty:$Pm),
2102 asm, "\t$Pd, $Pn, $Pm",
2108 let Inst{31-24} = 0b00000101;
2109 let Inst{23-22} = sz8_64;
2110 let Inst{21-20} = 0b10;
2111 let Inst{19-16} = Pm;
2112 let Inst{15-13} = 0b010;
2113 let Inst{12-10} = opc;
2120 multiclass sve_int_perm_bin_perm_pp<bits<3> opc, string asm> {
2121 def _B : sve_int_perm_bin_perm_pp<opc, 0b00, asm, PPR8>;
2122 def _H : sve_int_perm_bin_perm_pp<opc, 0b01, asm, PPR16>;
2123 def _S : sve_int_perm_bin_perm_pp<opc, 0b10, asm, PPR32>;
2124 def _D : sve_int_perm_bin_perm_pp<opc, 0b11, asm, PPR64>;
2127 class sve_int_rdffr_pred<bit s, string asm>
2128 : I<(outs PPR8:$Pd), (ins PPRAny:$Pg),
2129 asm, "\t$Pd, $Pg/z",
2134 let Inst{31-23} = 0b001001010;
2136 let Inst{21-9} = 0b0110001111000;
2141 let Defs = !if(!eq (s, 1), [NZCV], []);
2145 class sve_int_rdffr_unpred<string asm> : I<
2146 (outs PPR8:$Pd), (ins),
2151 let Inst{31-4} = 0b0010010100011001111100000000;
2157 class sve_int_wrffr<string asm>
2158 : I<(outs), (ins PPR8:$Pn),
2163 let Inst{31-9} = 0b00100101001010001001000;
2165 let Inst{4-0} = 0b00000;
2167 let hasSideEffects = 1;
2171 class sve_int_setffr<string asm>
2176 let Inst{31-0} = 0b00100101001011001001000000000000;
2178 let hasSideEffects = 1;
2182 //===----------------------------------------------------------------------===//
2183 // SVE Permute Vector - Predicated Group
2184 //===----------------------------------------------------------------------===//
2186 class sve_int_perm_cpy_r<bits<2> sz8_64, string asm, ZPRRegOp zprty,
2187 RegisterClass srcRegType>
2188 : I<(outs zprty:$Zd), (ins zprty:$_Zd, PPR3bAny:$Pg, srcRegType:$Rn),
2189 asm, "\t$Zd, $Pg/m, $Rn",
2195 let Inst{31-24} = 0b00000101;
2196 let Inst{23-22} = sz8_64;
2197 let Inst{21-13} = 0b101000101;
2198 let Inst{12-10} = Pg;
2202 let Constraints = "$Zd = $_Zd";
2205 multiclass sve_int_perm_cpy_r<string asm> {
2206 def _B : sve_int_perm_cpy_r<0b00, asm, ZPR8, GPR32sp>;
2207 def _H : sve_int_perm_cpy_r<0b01, asm, ZPR16, GPR32sp>;
2208 def _S : sve_int_perm_cpy_r<0b10, asm, ZPR32, GPR32sp>;
2209 def _D : sve_int_perm_cpy_r<0b11, asm, ZPR64, GPR64sp>;
2211 def : InstAlias<"mov $Zd, $Pg/m, $Rn",
2212 (!cast<Instruction>(NAME # _B) ZPR8:$Zd, PPR3bAny:$Pg, GPR32sp:$Rn), 1>;
2213 def : InstAlias<"mov $Zd, $Pg/m, $Rn",
2214 (!cast<Instruction>(NAME # _H) ZPR16:$Zd, PPR3bAny:$Pg, GPR32sp:$Rn), 1>;
2215 def : InstAlias<"mov $Zd, $Pg/m, $Rn",
2216 (!cast<Instruction>(NAME # _S) ZPR32:$Zd, PPR3bAny:$Pg, GPR32sp:$Rn), 1>;
2217 def : InstAlias<"mov $Zd, $Pg/m, $Rn",
2218 (!cast<Instruction>(NAME # _D) ZPR64:$Zd, PPR3bAny:$Pg, GPR64sp:$Rn), 1>;
2221 class sve_int_perm_cpy_v<bits<2> sz8_64, string asm, ZPRRegOp zprty,
2222 RegisterClass srcRegtype>
2223 : I<(outs zprty:$Zd), (ins zprty:$_Zd, PPR3bAny:$Pg, srcRegtype:$Vn),
2224 asm, "\t$Zd, $Pg/m, $Vn",
2230 let Inst{31-24} = 0b00000101;
2231 let Inst{23-22} = sz8_64;
2232 let Inst{21-13} = 0b100000100;
2233 let Inst{12-10} = Pg;
2237 let Constraints = "$Zd = $_Zd";
2240 multiclass sve_int_perm_cpy_v<string asm> {
2241 def _B : sve_int_perm_cpy_v<0b00, asm, ZPR8, FPR8>;
2242 def _H : sve_int_perm_cpy_v<0b01, asm, ZPR16, FPR16>;
2243 def _S : sve_int_perm_cpy_v<0b10, asm, ZPR32, FPR32>;
2244 def _D : sve_int_perm_cpy_v<0b11, asm, ZPR64, FPR64>;
2246 def : InstAlias<"mov $Zd, $Pg/m, $Vn",
2247 (!cast<Instruction>(NAME # _B) ZPR8:$Zd, PPR3bAny:$Pg, FPR8:$Vn), 1>;
2248 def : InstAlias<"mov $Zd, $Pg/m, $Vn",
2249 (!cast<Instruction>(NAME # _H) ZPR16:$Zd, PPR3bAny:$Pg, FPR16:$Vn), 1>;
2250 def : InstAlias<"mov $Zd, $Pg/m, $Vn",
2251 (!cast<Instruction>(NAME # _S) ZPR32:$Zd, PPR3bAny:$Pg, FPR32:$Vn), 1>;
2252 def : InstAlias<"mov $Zd, $Pg/m, $Vn",
2253 (!cast<Instruction>(NAME # _D) ZPR64:$Zd, PPR3bAny:$Pg, FPR64:$Vn), 1>;
2256 //===----------------------------------------------------------------------===//
2257 // SVE Memory - Contiguous Load Group
2258 //===----------------------------------------------------------------------===//
2260 class sve_mem_cld_si_base<bits<4> dtype, bit nf, string asm,
2261 RegisterOperand VecList>
2262 : I<(outs VecList:$Zt), (ins PPR3bAny:$Pg, GPR64sp:$Rn, simm4s1:$imm4),
2263 asm, "\t$Zt, $Pg/z, [$Rn, $imm4, mul vl]",
2270 let Inst{31-25} = 0b1010010;
2271 let Inst{24-21} = dtype;
2273 let Inst{19-16} = imm4;
2274 let Inst{15-13} = 0b101;
2275 let Inst{12-10} = Pg;
2280 let Uses = !if(!eq(nf, 1), [FFR], []);
2281 let Defs = !if(!eq(nf, 1), [FFR], []);
2284 multiclass sve_mem_cld_si_base<bits<4> dtype, bit nf, string asm,
2285 RegisterOperand listty, ZPRRegOp zprty> {
2286 def _REAL : sve_mem_cld_si_base<dtype, nf, asm, listty>;
2288 def : InstAlias<asm # "\t$Zt, $Pg/z, [$Rn]",
2289 (!cast<Instruction>(NAME # _REAL) zprty:$Zt, PPR3bAny:$Pg, GPR64sp:$Rn, 0), 0>;
2290 def : InstAlias<asm # "\t$Zt, $Pg/z, [$Rn, $imm4, mul vl]",
2291 (!cast<Instruction>(NAME # _REAL) zprty:$Zt, PPR3bAny:$Pg, GPR64sp:$Rn, simm4s1:$imm4), 0>;
2292 def : InstAlias<asm # "\t$Zt, $Pg/z, [$Rn]",
2293 (!cast<Instruction>(NAME # _REAL) listty:$Zt, PPR3bAny:$Pg, GPR64sp:$Rn, 0), 1>;
2296 multiclass sve_mem_cld_si<bits<4> dtype, string asm, RegisterOperand listty,
2298 : sve_mem_cld_si_base<dtype, 0, asm, listty, zprty>;
2300 class sve_mem_cldnt_si_base<bits<2> msz, string asm, RegisterOperand VecList>
2301 : I<(outs VecList:$Zt), (ins PPR3bAny:$Pg, GPR64sp:$Rn, simm4s1:$imm4),
2302 asm, "\t$Zt, $Pg/z, [$Rn, $imm4, mul vl]",
2309 let Inst{31-25} = 0b1010010;
2310 let Inst{24-23} = msz;
2311 let Inst{22-20} = 0b000;
2312 let Inst{19-16} = imm4;
2313 let Inst{15-13} = 0b111;
2314 let Inst{12-10} = Pg;
2321 multiclass sve_mem_cldnt_si<bits<2> msz, string asm, RegisterOperand listty,
2323 def NAME : sve_mem_cldnt_si_base<msz, asm, listty>;
2325 def : InstAlias<asm # "\t$Zt, $Pg/z, [$Rn]",
2326 (!cast<Instruction>(NAME) zprty:$Zt, PPR3bAny:$Pg, GPR64sp:$Rn, 0), 0>;
2327 def : InstAlias<asm # "\t$Zt, $Pg/z, [$Rn, $imm4, mul vl]",
2328 (!cast<Instruction>(NAME) zprty:$Zt, PPR3bAny:$Pg, GPR64sp:$Rn, simm4s1:$imm4), 0>;
2329 def : InstAlias<asm # "\t$Zt, $Pg/z, [$Rn]",
2330 (!cast<Instruction>(NAME) listty:$Zt, PPR3bAny:$Pg, GPR64sp:$Rn, 0), 1>;
2333 class sve_mem_cldnt_ss_base<bits<2> msz, string asm, RegisterOperand VecList,
2334 RegisterOperand gprty>
2335 : I<(outs VecList:$Zt), (ins PPR3bAny:$Pg, GPR64sp:$Rn, gprty:$Rm),
2336 asm, "\t$Zt, $Pg/z, [$Rn, $Rm]",
2343 let Inst{31-25} = 0b1010010;
2344 let Inst{24-23} = msz;
2345 let Inst{22-21} = 0b00;
2346 let Inst{20-16} = Rm;
2347 let Inst{15-13} = 0b110;
2348 let Inst{12-10} = Pg;
2355 multiclass sve_mem_cldnt_ss<bits<2> msz, string asm, RegisterOperand listty,
2356 ZPRRegOp zprty, RegisterOperand gprty> {
2357 def NAME : sve_mem_cldnt_ss_base<msz, asm, listty, gprty>;
2359 def : InstAlias<asm # "\t$Zt, $Pg/z, [$Rn, $Rm]",
2360 (!cast<Instruction>(NAME) zprty:$Zt, PPR3bAny:$Pg, GPR64sp:$Rn, gprty:$Rm), 0>;
2363 class sve_mem_ldqr_si<bits<2> sz, string asm, RegisterOperand VecList>
2364 : I<(outs VecList:$Zt), (ins PPR3bAny:$Pg, GPR64sp:$Rn, simm4s16:$imm4),
2365 asm, "\t$Zt, $Pg/z, [$Rn, $imm4]", "", []>, Sched<[]> {
2370 let Inst{31-25} = 0b1010010;
2371 let Inst{24-23} = sz;
2372 let Inst{22-20} = 0;
2373 let Inst{19-16} = imm4;
2374 let Inst{15-13} = 0b001;
2375 let Inst{12-10} = Pg;
2382 multiclass sve_mem_ldqr_si<bits<2> sz, string asm, RegisterOperand listty,
2384 def NAME : sve_mem_ldqr_si<sz, asm, listty>;
2385 def : InstAlias<asm # "\t$Zt, $Pg/z, [$Rn]",
2386 (!cast<Instruction>(NAME) listty:$Zt, PPR3bAny:$Pg, GPR64sp:$Rn, 0), 1>;
2387 def : InstAlias<asm # "\t$Zt, $Pg/z, [$Rn]",
2388 (!cast<Instruction>(NAME) zprty:$Zt, PPR3bAny:$Pg, GPR64sp:$Rn, 0), 0>;
2389 def : InstAlias<asm # "\t$Zt, $Pg/z, [$Rn, $imm4]",
2390 (!cast<Instruction>(NAME) zprty:$Zt, PPR3bAny:$Pg, GPR64sp:$Rn, simm4s16:$imm4), 0>;
2393 class sve_mem_ldqr_ss<bits<2> sz, string asm, RegisterOperand VecList,
2394 RegisterOperand gprty>
2395 : I<(outs VecList:$Zt), (ins PPR3bAny:$Pg, GPR64sp:$Rn, gprty:$Rm),
2396 asm, "\t$Zt, $Pg/z, [$Rn, $Rm]", "", []>, Sched<[]> {
2401 let Inst{31-25} = 0b1010010;
2402 let Inst{24-23} = sz;
2403 let Inst{22-21} = 0;
2404 let Inst{20-16} = Rm;
2405 let Inst{15-13} = 0;
2406 let Inst{12-10} = Pg;
2413 multiclass sve_mem_ldqr_ss<bits<2> sz, string asm, RegisterOperand listty,
2414 ZPRRegOp zprty, RegisterOperand gprty> {
2415 def NAME : sve_mem_ldqr_ss<sz, asm, listty, gprty>;
2417 def : InstAlias<asm # "\t$Zt, $Pg/z, [$Rn, $Rm]",
2418 (!cast<Instruction>(NAME) zprty:$Zt, PPR3bAny:$Pg, GPR64sp:$Rn, gprty:$Rm), 0>;
2421 class sve_mem_ld_dup<bits<2> dtypeh, bits<2> dtypel, string asm,
2422 RegisterOperand VecList, Operand immtype>
2423 : I<(outs VecList:$Zt), (ins PPR3bAny:$Pg, GPR64sp:$Rn, immtype:$imm6),
2424 asm, "\t$Zt, $Pg/z, [$Rn, $imm6]",
2431 let Inst{31-25} = 0b1000010;
2432 let Inst{24-23} = dtypeh;
2434 let Inst{21-16} = imm6;
2436 let Inst{14-13} = dtypel;
2437 let Inst{12-10} = Pg;
2444 multiclass sve_mem_ld_dup<bits<2> dtypeh, bits<2> dtypel, string asm,
2445 RegisterOperand zlistty, ZPRRegOp zprty, Operand immtype> {
2446 def NAME : sve_mem_ld_dup<dtypeh, dtypel, asm, zlistty, immtype>;
2448 def : InstAlias<asm # "\t$Zt, $Pg/z, [$Rn]",
2449 (!cast<Instruction>(NAME) zprty:$Zt, PPR3bAny:$Pg, GPR64sp:$Rn, 0), 0>;
2450 def : InstAlias<asm # "\t$Zt, $Pg/z, [$Rn, $imm6]",
2451 (!cast<Instruction>(NAME) zprty:$Zt, PPR3bAny:$Pg, GPR64sp:$Rn, immtype:$imm6), 0>;
2452 def : InstAlias<asm # "\t$Zt, $Pg/z, [$Rn]",
2453 (!cast<Instruction>(NAME) zlistty:$Zt, PPR3bAny:$Pg, GPR64sp:$Rn, 0), 1>;
2456 class sve_mem_cld_ss_base<bits<4> dtype, bit ff, dag iops, string asm,
2457 RegisterOperand VecList>
2458 : I<(outs VecList:$Zt), iops,
2459 asm, "\t$Zt, $Pg/z, [$Rn, $Rm]",
2466 let Inst{31-25} = 0b1010010;
2467 let Inst{24-21} = dtype;
2468 let Inst{20-16} = Rm;
2469 let Inst{15-14} = 0b01;
2471 let Inst{12-10} = Pg;
2476 let Uses = !if(!eq(ff, 1), [FFR], []);
2477 let Defs = !if(!eq(ff, 1), [FFR], []);
2480 multiclass sve_mem_cld_ss<bits<4> dtype, string asm, RegisterOperand listty,
2481 ZPRRegOp zprty, RegisterOperand gprty> {
2482 def "" : sve_mem_cld_ss_base<dtype, 0, (ins PPR3bAny:$Pg, GPR64sp:$Rn, gprty:$Rm),
2485 def : InstAlias<asm # "\t$Zt, $Pg/z, [$Rn, $Rm]",
2486 (!cast<Instruction>(NAME) zprty:$Zt, PPR3bAny:$Pg, GPR64sp:$Rn, gprty:$Rm), 0>;
2489 multiclass sve_mem_cldff_ss<bits<4> dtype, string asm, RegisterOperand listty,
2490 ZPRRegOp zprty, RegisterOperand gprty> {
2491 def _REAL : sve_mem_cld_ss_base<dtype, 1, (ins PPR3bAny:$Pg, GPR64sp:$Rn, gprty:$Rm),
2494 def : InstAlias<asm # "\t$Zt, $Pg/z, [$Rn, $Rm]",
2495 (!cast<Instruction>(NAME # _REAL) zprty:$Zt, PPR3bAny:$Pg, GPR64sp:$Rn, gprty:$Rm), 0>;
2497 def : InstAlias<asm # "\t$Zt, $Pg/z, [$Rn]",
2498 (!cast<Instruction>(NAME # _REAL) listty:$Zt, PPR3bAny:$Pg, GPR64sp:$Rn, XZR), 1>;
2500 def : InstAlias<asm # "\t$Zt, $Pg/z, [$Rn]",
2501 (!cast<Instruction>(NAME # _REAL) zprty:$Zt, PPR3bAny:$Pg, GPR64sp:$Rn, XZR), 0>;
2504 multiclass sve_mem_cldnf_si<bits<4> dtype, string asm, RegisterOperand listty,
2506 : sve_mem_cld_si_base<dtype, 1, asm, listty, zprty>;
2508 class sve_mem_eld_si<bits<2> sz, bits<2> nregs, RegisterOperand VecList,
2509 string asm, Operand immtype>
2510 : I<(outs VecList:$Zt), (ins PPR3bAny:$Pg, GPR64sp:$Rn, immtype:$imm4),
2511 asm, "\t$Zt, $Pg/z, [$Rn, $imm4, mul vl]",
2518 let Inst{31-25} = 0b1010010;
2519 let Inst{24-23} = sz;
2520 let Inst{22-21} = nregs;
2522 let Inst{19-16} = imm4;
2523 let Inst{15-13} = 0b111;
2524 let Inst{12-10} = Pg;
2531 multiclass sve_mem_eld_si<bits<2> sz, bits<2> nregs, RegisterOperand VecList,
2532 string asm, Operand immtype> {
2533 def NAME : sve_mem_eld_si<sz, nregs, VecList, asm, immtype>;
2535 def : InstAlias<asm # "\t$Zt, $Pg/z, [$Rn]",
2536 (!cast<Instruction>(NAME) VecList:$Zt, PPR3bAny:$Pg, GPR64sp:$Rn, 0), 1>;
2539 class sve_mem_eld_ss<bits<2> sz, bits<2> nregs, RegisterOperand VecList,
2540 string asm, RegisterOperand gprty>
2541 : I<(outs VecList:$Zt), (ins PPR3bAny:$Pg, GPR64sp:$Rn, gprty:$Rm),
2542 asm, "\t$Zt, $Pg/z, [$Rn, $Rm]",
2549 let Inst{31-25} = 0b1010010;
2550 let Inst{24-23} = sz;
2551 let Inst{22-21} = nregs;
2552 let Inst{20-16} = Rm;
2553 let Inst{15-13} = 0b110;
2554 let Inst{12-10} = Pg;
2561 //===----------------------------------------------------------------------===//
2562 // SVE Memory - 32-bit Gather and Unsized Contiguous Group
2563 //===----------------------------------------------------------------------===//
2565 // bit xs is '1' if offsets are signed
2566 // bit scaled is '1' if the offsets are scaled
2567 class sve_mem_32b_gld_sv<bits<4> opc, bit xs, bit scaled, string asm,
2568 RegisterOperand zprext>
2569 : I<(outs Z_s:$Zt), (ins PPR3bAny:$Pg, GPR64sp:$Rn, zprext:$Zm),
2570 asm, "\t$Zt, $Pg/z, [$Rn, $Zm]",
2577 let Inst{31-25} = 0b1000010;
2578 let Inst{24-23} = opc{3-2};
2580 let Inst{21} = scaled;
2581 let Inst{20-16} = Zm;
2583 let Inst{14-13} = opc{1-0};
2584 let Inst{12-10} = Pg;
2589 let Defs = !if(!eq(opc{0}, 1), [FFR], []);
2590 let Uses = !if(!eq(opc{0}, 1), [FFR], []);
2593 multiclass sve_mem_32b_gld_sv_32_scaled<bits<4> opc, string asm,
2594 RegisterOperand sxtw_opnd,
2595 RegisterOperand uxtw_opnd> {
2596 def _UXTW_SCALED_REAL : sve_mem_32b_gld_sv<opc, 0, 1, asm, uxtw_opnd>;
2597 def _SXTW_SCALED_REAL : sve_mem_32b_gld_sv<opc, 1, 1, asm, sxtw_opnd>;
2599 def : InstAlias<asm # "\t$Zt, $Pg/z, [$Rn, $Zm]",
2600 (!cast<Instruction>(NAME # _UXTW_SCALED_REAL) ZPR32:$Zt, PPR3bAny:$Pg, GPR64sp:$Rn, uxtw_opnd:$Zm), 0>;
2601 def : InstAlias<asm # "\t$Zt, $Pg/z, [$Rn, $Zm]",
2602 (!cast<Instruction>(NAME # _SXTW_SCALED_REAL) ZPR32:$Zt, PPR3bAny:$Pg, GPR64sp:$Rn, sxtw_opnd:$Zm), 0>;
2605 multiclass sve_mem_32b_gld_vs_32_unscaled<bits<4> opc, string asm,
2606 RegisterOperand sxtw_opnd,
2607 RegisterOperand uxtw_opnd> {
2608 def _UXTW_REAL : sve_mem_32b_gld_sv<opc, 0, 0, asm, uxtw_opnd>;
2609 def _SXTW_REAL : sve_mem_32b_gld_sv<opc, 1, 0, asm, sxtw_opnd>;
2611 def : InstAlias<asm # "\t$Zt, $Pg/z, [$Rn, $Zm]",
2612 (!cast<Instruction>(NAME # _UXTW_REAL) ZPR32:$Zt, PPR3bAny:$Pg, GPR64sp:$Rn, uxtw_opnd:$Zm), 0>;
2613 def : InstAlias<asm # "\t$Zt, $Pg/z, [$Rn, $Zm]",
2614 (!cast<Instruction>(NAME # _SXTW_REAL) ZPR32:$Zt, PPR3bAny:$Pg, GPR64sp:$Rn, sxtw_opnd:$Zm), 0>;
2618 class sve_mem_32b_gld_vi<bits<4> opc, string asm, Operand imm_ty>
2619 : I<(outs Z_s:$Zt), (ins PPR3bAny:$Pg, ZPR32:$Zn, imm_ty:$imm5),
2620 asm, "\t$Zt, $Pg/z, [$Zn, $imm5]",
2627 let Inst{31-25} = 0b1000010;
2628 let Inst{24-23} = opc{3-2};
2629 let Inst{22-21} = 0b01;
2630 let Inst{20-16} = imm5;
2632 let Inst{14-13} = opc{1-0};
2633 let Inst{12-10} = Pg;
2638 let Defs = !if(!eq(opc{0}, 1), [FFR], []);
2639 let Uses = !if(!eq(opc{0}, 1), [FFR], []);
2642 multiclass sve_mem_32b_gld_vi_32_ptrs<bits<4> opc, string asm, Operand imm_ty> {
2643 def _IMM_REAL : sve_mem_32b_gld_vi<opc, asm, imm_ty>;
2645 def : InstAlias<asm # "\t$Zt, $Pg/z, [$Zn]",
2646 (!cast<Instruction>(NAME # _IMM_REAL) ZPR32:$Zt, PPR3bAny:$Pg, ZPR32:$Zn, 0), 0>;
2647 def : InstAlias<asm # "\t$Zt, $Pg/z, [$Zn, $imm5]",
2648 (!cast<Instruction>(NAME # _IMM_REAL) ZPR32:$Zt, PPR3bAny:$Pg, ZPR32:$Zn, imm_ty:$imm5), 0>;
2649 def : InstAlias<asm # "\t$Zt, $Pg/z, [$Zn]",
2650 (!cast<Instruction>(NAME # _IMM_REAL) Z_s:$Zt, PPR3bAny:$Pg, ZPR32:$Zn, 0), 1>;
2653 class sve_mem_prfm_si<bits<2> msz, string asm>
2654 : I<(outs), (ins sve_prfop:$prfop, PPR3bAny:$Pg, GPR64sp:$Rn, simm6s1:$imm6),
2655 asm, "\t$prfop, $Pg, [$Rn, $imm6, mul vl]",
2662 let Inst{31-22} = 0b1000010111;
2663 let Inst{21-16} = imm6;
2665 let Inst{14-13} = msz;
2666 let Inst{12-10} = Pg;
2669 let Inst{3-0} = prfop;
2671 let hasSideEffects = 1;
2674 multiclass sve_mem_prfm_si<bits<2> msz, string asm> {
2675 def NAME : sve_mem_prfm_si<msz, asm>;
2677 def : InstAlias<asm # "\t$prfop, $Pg, [$Rn]",
2678 (!cast<Instruction>(NAME) sve_prfop:$prfop, PPR3bAny:$Pg, GPR64sp:$Rn, 0), 1>;
2681 class sve_mem_prfm_ss<bits<3> opc, string asm, RegisterOperand gprty>
2682 : I<(outs), (ins sve_prfop:$prfop, PPR3bAny:$Pg, GPR64sp:$Rn, gprty:$Rm),
2683 asm, "\t$prfop, $Pg, [$Rn, $Rm]",
2690 let Inst{31-25} = 0b1000010;
2691 let Inst{24-23} = opc{2-1};
2692 let Inst{22-21} = 0b00;
2693 let Inst{20-16} = Rm;
2695 let Inst{14} = opc{0};
2697 let Inst{12-10} = Pg;
2700 let Inst{3-0} = prfop;
2702 let hasSideEffects = 1;
2705 class sve_mem_32b_prfm_sv<bits<2> msz, bit xs, string asm,
2706 RegisterOperand zprext>
2707 : I<(outs), (ins sve_prfop:$prfop, PPR3bAny:$Pg, GPR64sp:$Rn, zprext:$Zm),
2708 asm, "\t$prfop, $Pg, [$Rn, $Zm]",
2715 let Inst{31-23} = 0b100001000;
2718 let Inst{20-16} = Zm;
2720 let Inst{14-13} = msz;
2721 let Inst{12-10} = Pg;
2724 let Inst{3-0} = prfop;
2726 let hasSideEffects = 1;
2729 multiclass sve_mem_32b_prfm_sv_scaled<bits<2> msz, string asm,
2730 RegisterOperand sxtw_opnd,
2731 RegisterOperand uxtw_opnd> {
2732 def _UXTW_SCALED : sve_mem_32b_prfm_sv<msz, 0, asm, uxtw_opnd>;
2733 def _SXTW_SCALED : sve_mem_32b_prfm_sv<msz, 1, asm, sxtw_opnd>;
2736 class sve_mem_32b_prfm_vi<bits<2> msz, string asm, Operand imm_ty>
2737 : I<(outs), (ins sve_prfop:$prfop, PPR3bAny:$Pg, ZPR32:$Zn, imm_ty:$imm5),
2738 asm, "\t$prfop, $Pg, [$Zn, $imm5]",
2745 let Inst{31-25} = 0b1000010;
2746 let Inst{24-23} = msz;
2747 let Inst{22-21} = 0b00;
2748 let Inst{20-16} = imm5;
2749 let Inst{15-13} = 0b111;
2750 let Inst{12-10} = Pg;
2753 let Inst{3-0} = prfop;
2756 multiclass sve_mem_32b_prfm_vi<bits<2> msz, string asm, Operand imm_ty> {
2757 def NAME : sve_mem_32b_prfm_vi<msz, asm, imm_ty>;
2759 def : InstAlias<asm # "\t$prfop, $Pg, [$Zn]",
2760 (!cast<Instruction>(NAME) sve_prfop:$prfop, PPR3bAny:$Pg, ZPR32:$Zn, 0), 1>;
2763 class sve_mem_z_fill<string asm>
2764 : I<(outs ZPRAny:$Zt), (ins GPR64sp:$Rn, simm9:$imm9),
2765 asm, "\t$Zt, [$Rn, $imm9, mul vl]",
2771 let Inst{31-22} = 0b1000010110;
2772 let Inst{21-16} = imm9{8-3};
2773 let Inst{15-13} = 0b010;
2774 let Inst{12-10} = imm9{2-0};
2781 multiclass sve_mem_z_fill<string asm> {
2782 def NAME : sve_mem_z_fill<asm>;
2784 def : InstAlias<asm # "\t$Zt, [$Rn]",
2785 (!cast<Instruction>(NAME) ZPRAny:$Zt, GPR64sp:$Rn, 0), 1>;
2788 class sve_mem_p_fill<string asm>
2789 : I<(outs PPRAny:$Pt), (ins GPR64sp:$Rn, simm9:$imm9),
2790 asm, "\t$Pt, [$Rn, $imm9, mul vl]",
2796 let Inst{31-22} = 0b1000010110;
2797 let Inst{21-16} = imm9{8-3};
2798 let Inst{15-13} = 0b000;
2799 let Inst{12-10} = imm9{2-0};
2807 multiclass sve_mem_p_fill<string asm> {
2808 def NAME : sve_mem_p_fill<asm>;
2810 def : InstAlias<asm # "\t$Pt, [$Rn]",
2811 (!cast<Instruction>(NAME) PPRAny:$Pt, GPR64sp:$Rn, 0), 1>;
2814 //===----------------------------------------------------------------------===//
2815 // SVE Memory - 64-bit Gather Group
2816 //===----------------------------------------------------------------------===//
2818 // bit xs is '1' if offsets are signed
2819 // bit scaled is '1' if the offsets are scaled
2820 // bit lsl is '0' if the offsets are extended (uxtw/sxtw), '1' if shifted (lsl)
2821 class sve_mem_64b_gld_sv<bits<4> opc, bit xs, bit scaled, bit lsl, string asm,
2822 RegisterOperand zprext>
2823 : I<(outs Z_d:$Zt), (ins PPR3bAny:$Pg, GPR64sp:$Rn, zprext:$Zm),
2824 asm, "\t$Zt, $Pg/z, [$Rn, $Zm]",
2831 let Inst{31-25} = 0b1100010;
2832 let Inst{24-23} = opc{3-2};
2834 let Inst{21} = scaled;
2835 let Inst{20-16} = Zm;
2837 let Inst{14-13} = opc{1-0};
2838 let Inst{12-10} = Pg;
2843 let Defs = !if(!eq(opc{0}, 1), [FFR], []);
2844 let Uses = !if(!eq(opc{0}, 1), [FFR], []);
2847 multiclass sve_mem_64b_gld_sv_32_scaled<bits<4> opc, string asm,
2848 RegisterOperand sxtw_opnd,
2849 RegisterOperand uxtw_opnd> {
2850 def _UXTW_SCALED_REAL : sve_mem_64b_gld_sv<opc, 0, 1, 0, asm, uxtw_opnd>;
2851 def _SXTW_SCALED_REAL : sve_mem_64b_gld_sv<opc, 1, 1, 0, asm, sxtw_opnd>;
2853 def : InstAlias<asm # "\t$Zt, $Pg/z, [$Rn, $Zm]",
2854 (!cast<Instruction>(NAME # _UXTW_SCALED_REAL) ZPR64:$Zt, PPR3bAny:$Pg, GPR64sp:$Rn, uxtw_opnd:$Zm), 0>;
2855 def : InstAlias<asm # "\t$Zt, $Pg/z, [$Rn, $Zm]",
2856 (!cast<Instruction>(NAME # _SXTW_SCALED_REAL) ZPR64:$Zt, PPR3bAny:$Pg, GPR64sp:$Rn, sxtw_opnd:$Zm), 0>;
2859 multiclass sve_mem_64b_gld_vs_32_unscaled<bits<4> opc, string asm,
2860 RegisterOperand sxtw_opnd,
2861 RegisterOperand uxtw_opnd> {
2862 def _UXTW_REAL : sve_mem_64b_gld_sv<opc, 0, 0, 0, asm, uxtw_opnd>;
2863 def _SXTW_REAL : sve_mem_64b_gld_sv<opc, 1, 0, 0, asm, sxtw_opnd>;
2865 def : InstAlias<asm # "\t$Zt, $Pg/z, [$Rn, $Zm]",
2866 (!cast<Instruction>(NAME # _UXTW_REAL) ZPR64:$Zt, PPR3bAny:$Pg, GPR64sp:$Rn, uxtw_opnd:$Zm), 0>;
2867 def : InstAlias<asm # "\t$Zt, $Pg/z, [$Rn, $Zm]",
2868 (!cast<Instruction>(NAME # _SXTW_REAL) ZPR64:$Zt, PPR3bAny:$Pg, GPR64sp:$Rn, sxtw_opnd:$Zm), 0>;
2871 multiclass sve_mem_64b_gld_sv2_64_scaled<bits<4> opc, string asm,
2872 RegisterOperand zprext> {
2873 def _SCALED_REAL : sve_mem_64b_gld_sv<opc, 1, 1, 1, asm, zprext>;
2875 def : InstAlias<asm # "\t$Zt, $Pg/z, [$Rn, $Zm]",
2876 (!cast<Instruction>(NAME # _SCALED_REAL) ZPR64:$Zt, PPR3bAny:$Pg, GPR64sp:$Rn, zprext:$Zm), 0>;
2879 multiclass sve_mem_64b_gld_vs2_64_unscaled<bits<4> opc, string asm> {
2880 def _REAL : sve_mem_64b_gld_sv<opc, 1, 0, 1, asm, ZPR64ExtLSL8>;
2882 def : InstAlias<asm # "\t$Zt, $Pg/z, [$Rn, $Zm]",
2883 (!cast<Instruction>(NAME # _REAL) ZPR64:$Zt, PPR3bAny:$Pg, GPR64sp:$Rn, ZPR64ExtLSL8:$Zm), 0>;
2886 class sve_mem_64b_gld_vi<bits<4> opc, string asm, Operand imm_ty>
2887 : I<(outs Z_d:$Zt), (ins PPR3bAny:$Pg, ZPR64:$Zn, imm_ty:$imm5),
2888 asm, "\t$Zt, $Pg/z, [$Zn, $imm5]",
2895 let Inst{31-25} = 0b1100010;
2896 let Inst{24-23} = opc{3-2};
2897 let Inst{22-21} = 0b01;
2898 let Inst{20-16} = imm5;
2900 let Inst{14-13} = opc{1-0};
2901 let Inst{12-10} = Pg;
2906 let Defs = !if(!eq(opc{0}, 1), [FFR], []);
2907 let Uses = !if(!eq(opc{0}, 1), [FFR], []);
2910 multiclass sve_mem_64b_gld_vi_64_ptrs<bits<4> opc, string asm, Operand imm_ty> {
2911 def _IMM_REAL : sve_mem_64b_gld_vi<opc, asm, imm_ty>;
2913 def : InstAlias<asm # "\t$Zt, $Pg/z, [$Zn]",
2914 (!cast<Instruction>(NAME # _IMM_REAL) ZPR64:$Zt, PPR3bAny:$Pg, ZPR64:$Zn, 0), 0>;
2915 def : InstAlias<asm # "\t$Zt, $Pg/z, [$Zn, $imm5]",
2916 (!cast<Instruction>(NAME # _IMM_REAL) ZPR64:$Zt, PPR3bAny:$Pg, ZPR64:$Zn, imm_ty:$imm5), 0>;
2917 def : InstAlias<asm # "\t$Zt, $Pg/z, [$Zn]",
2918 (!cast<Instruction>(NAME # _IMM_REAL) Z_d:$Zt, PPR3bAny:$Pg, ZPR64:$Zn, 0), 1>;
2921 // bit lsl is '0' if the offsets are extended (uxtw/sxtw), '1' if shifted (lsl)
2922 class sve_mem_64b_prfm_sv<bits<2> msz, bit xs, bit lsl, string asm,
2923 RegisterOperand zprext>
2924 : I<(outs), (ins sve_prfop:$prfop, PPR3bAny:$Pg, GPR64sp:$Rn, zprext:$Zm),
2925 asm, "\t$prfop, $Pg, [$Rn, $Zm]",
2932 let Inst{31-23} = 0b110001000;
2935 let Inst{20-16} = Zm;
2937 let Inst{14-13} = msz;
2938 let Inst{12-10} = Pg;
2941 let Inst{3-0} = prfop;
2943 let hasSideEffects = 1;
2946 multiclass sve_mem_64b_prfm_sv_ext_scaled<bits<2> msz, string asm,
2947 RegisterOperand sxtw_opnd,
2948 RegisterOperand uxtw_opnd> {
2949 def _UXTW_SCALED : sve_mem_64b_prfm_sv<msz, 0, 0, asm, uxtw_opnd>;
2950 def _SXTW_SCALED : sve_mem_64b_prfm_sv<msz, 1, 0, asm, sxtw_opnd>;
2953 multiclass sve_mem_64b_prfm_sv_lsl_scaled<bits<2> msz, string asm,
2954 RegisterOperand zprext> {
2955 def NAME : sve_mem_64b_prfm_sv<msz, 1, 1, asm, zprext>;
2959 class sve_mem_64b_prfm_vi<bits<2> msz, string asm, Operand imm_ty>
2960 : I<(outs), (ins sve_prfop:$prfop, PPR3bAny:$Pg, ZPR64:$Zn, imm_ty:$imm5),
2961 asm, "\t$prfop, $Pg, [$Zn, $imm5]",
2968 let Inst{31-25} = 0b1100010;
2969 let Inst{24-23} = msz;
2970 let Inst{22-21} = 0b00;
2971 let Inst{20-16} = imm5;
2972 let Inst{15-13} = 0b111;
2973 let Inst{12-10} = Pg;
2976 let Inst{3-0} = prfop;
2978 let hasSideEffects = 1;
2981 multiclass sve_mem_64b_prfm_vi<bits<2> msz, string asm, Operand imm_ty> {
2982 def NAME : sve_mem_64b_prfm_vi<msz, asm, imm_ty>;
2984 def : InstAlias<asm # "\t$prfop, $Pg, [$Zn]",
2985 (!cast<Instruction>(NAME) sve_prfop:$prfop, PPR3bAny:$Pg, ZPR64:$Zn, 0), 1>;