1 //=-- SVEInstrFormats.td - AArch64 SVE Instruction classes -*- tablegen -*--=//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
9 // AArch64 Scalable Vector Extension (SVE) Instruction Class Definitions.
11 //===----------------------------------------------------------------------===//
13 def SVEPatternOperand : AsmOperandClass {
14 let Name = "SVEPattern";
15 let ParserMethod = "tryParseSVEPattern";
16 let PredicateMethod = "isSVEPattern";
17 let RenderMethod = "addImmOperands";
18 let DiagnosticType = "InvalidSVEPattern";
21 def sve_pred_enum : Operand<i32>, ImmLeaf<i32, [{
22 return (((uint32_t)Imm) < 32);
25 let PrintMethod = "printSVEPattern";
26 let ParserMatchClass = SVEPatternOperand;
29 def SVEPrefetchOperand : AsmOperandClass {
30 let Name = "SVEPrefetch";
31 let ParserMethod = "tryParsePrefetch<true>";
32 let PredicateMethod = "isPrefetch";
33 let RenderMethod = "addPrefetchOperands";
36 def sve_prfop : Operand<i32>, ImmLeaf<i32, [{
37 return (((uint32_t)Imm) <= 15);
39 let PrintMethod = "printPrefetchOp<true>";
40 let ParserMatchClass = SVEPrefetchOperand;
43 class SVELogicalImmOperand<int Width> : AsmOperandClass {
44 let Name = "SVELogicalImm" # Width;
45 let DiagnosticType = "LogicalSecondSource";
46 let PredicateMethod = "isLogicalImm<int" # Width # "_t>";
47 let RenderMethod = "addLogicalImmOperands<int" # Width # "_t>";
50 def sve_logical_imm8 : Operand<i64> {
51 let ParserMatchClass = SVELogicalImmOperand<8>;
52 let PrintMethod = "printLogicalImm<int8_t>";
54 let MCOperandPredicate = [{
57 int64_t Val = AArch64_AM::decodeLogicalImmediate(MCOp.getImm(), 64);
58 return AArch64_AM::isSVEMaskOfIdenticalElements<int8_t>(Val);
62 def sve_logical_imm16 : Operand<i64> {
63 let ParserMatchClass = SVELogicalImmOperand<16>;
64 let PrintMethod = "printLogicalImm<int16_t>";
66 let MCOperandPredicate = [{
69 int64_t Val = AArch64_AM::decodeLogicalImmediate(MCOp.getImm(), 64);
70 return AArch64_AM::isSVEMaskOfIdenticalElements<int16_t>(Val);
74 def sve_logical_imm32 : Operand<i64> {
75 let ParserMatchClass = SVELogicalImmOperand<32>;
76 let PrintMethod = "printLogicalImm<int32_t>";
78 let MCOperandPredicate = [{
81 int64_t Val = AArch64_AM::decodeLogicalImmediate(MCOp.getImm(), 64);
82 return AArch64_AM::isSVEMaskOfIdenticalElements<int32_t>(Val);
86 class SVEPreferredLogicalImmOperand<int Width> : AsmOperandClass {
87 let Name = "SVEPreferredLogicalImm" # Width;
88 let PredicateMethod = "isSVEPreferredLogicalImm<int" # Width # "_t>";
89 let RenderMethod = "addLogicalImmOperands<int" # Width # "_t>";
92 def sve_preferred_logical_imm16 : Operand<i64> {
93 let ParserMatchClass = SVEPreferredLogicalImmOperand<16>;
94 let PrintMethod = "printSVELogicalImm<int16_t>";
96 let MCOperandPredicate = [{
99 int64_t Val = AArch64_AM::decodeLogicalImmediate(MCOp.getImm(), 64);
100 return AArch64_AM::isSVEMaskOfIdenticalElements<int16_t>(Val) &&
101 AArch64_AM::isSVEMoveMaskPreferredLogicalImmediate(Val);
105 def sve_preferred_logical_imm32 : Operand<i64> {
106 let ParserMatchClass = SVEPreferredLogicalImmOperand<32>;
107 let PrintMethod = "printSVELogicalImm<int32_t>";
109 let MCOperandPredicate = [{
112 int64_t Val = AArch64_AM::decodeLogicalImmediate(MCOp.getImm(), 64);
113 return AArch64_AM::isSVEMaskOfIdenticalElements<int32_t>(Val) &&
114 AArch64_AM::isSVEMoveMaskPreferredLogicalImmediate(Val);
118 def sve_preferred_logical_imm64 : Operand<i64> {
119 let ParserMatchClass = SVEPreferredLogicalImmOperand<64>;
120 let PrintMethod = "printSVELogicalImm<int64_t>";
122 let MCOperandPredicate = [{
125 int64_t Val = AArch64_AM::decodeLogicalImmediate(MCOp.getImm(), 64);
126 return AArch64_AM::isSVEMaskOfIdenticalElements<int64_t>(Val) &&
127 AArch64_AM::isSVEMoveMaskPreferredLogicalImmediate(Val);
131 class SVELogicalImmNotOperand<int Width> : AsmOperandClass {
132 let Name = "SVELogicalImm" # Width # "Not";
133 let DiagnosticType = "LogicalSecondSource";
134 let PredicateMethod = "isLogicalImm<int" # Width # "_t>";
135 let RenderMethod = "addLogicalImmNotOperands<int" # Width # "_t>";
138 def sve_logical_imm8_not : Operand<i64> {
139 let ParserMatchClass = SVELogicalImmNotOperand<8>;
142 def sve_logical_imm16_not : Operand<i64> {
143 let ParserMatchClass = SVELogicalImmNotOperand<16>;
146 def sve_logical_imm32_not : Operand<i64> {
147 let ParserMatchClass = SVELogicalImmNotOperand<32>;
150 class SVEShiftedImmOperand<int ElementWidth, string Infix, string Predicate>
152 let Name = "SVE" # Infix # "Imm" # ElementWidth;
153 let DiagnosticType = "Invalid" # Name;
154 let RenderMethod = "addImmWithOptionalShiftOperands<8>";
155 let ParserMethod = "tryParseImmWithOptionalShift";
156 let PredicateMethod = Predicate;
159 def SVECpyImmOperand8 : SVEShiftedImmOperand<8, "Cpy", "isSVECpyImm<int8_t>">;
160 def SVECpyImmOperand16 : SVEShiftedImmOperand<16, "Cpy", "isSVECpyImm<int16_t>">;
161 def SVECpyImmOperand32 : SVEShiftedImmOperand<32, "Cpy", "isSVECpyImm<int32_t>">;
162 def SVECpyImmOperand64 : SVEShiftedImmOperand<64, "Cpy", "isSVECpyImm<int64_t>">;
164 def SVEAddSubImmOperand8 : SVEShiftedImmOperand<8, "AddSub", "isSVEAddSubImm<int8_t>">;
165 def SVEAddSubImmOperand16 : SVEShiftedImmOperand<16, "AddSub", "isSVEAddSubImm<int16_t>">;
166 def SVEAddSubImmOperand32 : SVEShiftedImmOperand<32, "AddSub", "isSVEAddSubImm<int32_t>">;
167 def SVEAddSubImmOperand64 : SVEShiftedImmOperand<64, "AddSub", "isSVEAddSubImm<int64_t>">;
169 class imm8_opt_lsl<int ElementWidth, string printType,
170 AsmOperandClass OpndClass, code Predicate>
171 : Operand<i32>, ImmLeaf<i32, Predicate> {
172 let EncoderMethod = "getImm8OptLsl";
173 let DecoderMethod = "DecodeImm8OptLsl<" # ElementWidth # ">";
174 let PrintMethod = "printImm8OptLsl<" # printType # ">";
175 let ParserMatchClass = OpndClass;
176 let MIOperandInfo = (ops i32imm, i32imm);
179 def cpy_imm8_opt_lsl_i8 : imm8_opt_lsl<8, "int8_t", SVECpyImmOperand8, [{
180 return AArch64_AM::isSVECpyImm<int8_t>(Imm);
182 def cpy_imm8_opt_lsl_i16 : imm8_opt_lsl<16, "int16_t", SVECpyImmOperand16, [{
183 return AArch64_AM::isSVECpyImm<int16_t>(Imm);
185 def cpy_imm8_opt_lsl_i32 : imm8_opt_lsl<32, "int32_t", SVECpyImmOperand32, [{
186 return AArch64_AM::isSVECpyImm<int32_t>(Imm);
188 def cpy_imm8_opt_lsl_i64 : imm8_opt_lsl<64, "int64_t", SVECpyImmOperand64, [{
189 return AArch64_AM::isSVECpyImm<int64_t>(Imm);
192 def addsub_imm8_opt_lsl_i8 : imm8_opt_lsl<8, "uint8_t", SVEAddSubImmOperand8, [{
193 return AArch64_AM::isSVEAddSubImm<int8_t>(Imm);
195 def addsub_imm8_opt_lsl_i16 : imm8_opt_lsl<16, "uint16_t", SVEAddSubImmOperand16, [{
196 return AArch64_AM::isSVEAddSubImm<int16_t>(Imm);
198 def addsub_imm8_opt_lsl_i32 : imm8_opt_lsl<32, "uint32_t", SVEAddSubImmOperand32, [{
199 return AArch64_AM::isSVEAddSubImm<int32_t>(Imm);
201 def addsub_imm8_opt_lsl_i64 : imm8_opt_lsl<64, "uint64_t", SVEAddSubImmOperand64, [{
202 return AArch64_AM::isSVEAddSubImm<int64_t>(Imm);
205 class SVEExactFPImm<string Suffix, string ValA, string ValB> : AsmOperandClass {
206 let Name = "SVEExactFPImmOperand" # Suffix;
207 let DiagnosticType = "Invalid" # Name;
208 let ParserMethod = "tryParseFPImm<false>";
209 let PredicateMethod = "isExactFPImm<" # ValA # ", " # ValB # ">";
210 let RenderMethod = "addExactFPImmOperands<" # ValA # ", " # ValB # ">";
213 class SVEExactFPImmOperand<string Suffix, string ValA, string ValB> : Operand<i32> {
214 let PrintMethod = "printExactFPImm<" # ValA # ", " # ValB # ">";
215 let ParserMatchClass = SVEExactFPImm<Suffix, ValA, ValB>;
218 def sve_fpimm_half_one
219 : SVEExactFPImmOperand<"HalfOne", "AArch64ExactFPImm::half",
220 "AArch64ExactFPImm::one">;
221 def sve_fpimm_half_two
222 : SVEExactFPImmOperand<"HalfTwo", "AArch64ExactFPImm::half",
223 "AArch64ExactFPImm::two">;
224 def sve_fpimm_zero_one
225 : SVEExactFPImmOperand<"ZeroOne", "AArch64ExactFPImm::zero",
226 "AArch64ExactFPImm::one">;
228 def sve_incdec_imm : Operand<i32>, ImmLeaf<i32, [{
229 return (((uint32_t)Imm) > 0) && (((uint32_t)Imm) < 17);
231 let ParserMatchClass = Imm1_16Operand;
232 let EncoderMethod = "getSVEIncDecImm";
233 let DecoderMethod = "DecodeSVEIncDecImm";
236 //===----------------------------------------------------------------------===//
237 // SVE PTrue - These are used extensively throughout the pattern matching so
238 // it's important we define them first.
239 //===----------------------------------------------------------------------===//
241 class sve_int_ptrue<bits<2> sz8_64, bits<3> opc, string asm, PPRRegOp pprty>
242 : I<(outs pprty:$Pd), (ins sve_pred_enum:$pattern),
243 asm, "\t$Pd, $pattern",
248 let Inst{31-24} = 0b00100101;
249 let Inst{23-22} = sz8_64;
250 let Inst{21-19} = 0b011;
251 let Inst{18-17} = opc{2-1};
252 let Inst{16} = opc{0};
253 let Inst{15-10} = 0b111000;
254 let Inst{9-5} = pattern;
258 let Defs = !if(!eq (opc{0}, 1), [NZCV], []);
261 multiclass sve_int_ptrue<bits<3> opc, string asm> {
262 def _B : sve_int_ptrue<0b00, opc, asm, PPR8>;
263 def _H : sve_int_ptrue<0b01, opc, asm, PPR16>;
264 def _S : sve_int_ptrue<0b10, opc, asm, PPR32>;
265 def _D : sve_int_ptrue<0b11, opc, asm, PPR64>;
267 def : InstAlias<asm # "\t$Pd",
268 (!cast<Instruction>(NAME # _B) PPR8:$Pd, 0b11111), 1>;
269 def : InstAlias<asm # "\t$Pd",
270 (!cast<Instruction>(NAME # _H) PPR16:$Pd, 0b11111), 1>;
271 def : InstAlias<asm # "\t$Pd",
272 (!cast<Instruction>(NAME # _S) PPR32:$Pd, 0b11111), 1>;
273 def : InstAlias<asm # "\t$Pd",
274 (!cast<Instruction>(NAME # _D) PPR64:$Pd, 0b11111), 1>;
277 let Predicates = [HasSVE] in {
278 defm PTRUE : sve_int_ptrue<0b000, "ptrue">;
279 defm PTRUES : sve_int_ptrue<0b001, "ptrues">;
282 //===----------------------------------------------------------------------===//
283 // SVE pattern match helpers.
284 //===----------------------------------------------------------------------===//
286 class SVE_1_Op_Pat<ValueType vtd, SDPatternOperator op, ValueType vt1,
288 : Pat<(vtd (op vt1:$Op1)),
291 class SVE_3_Op_Pat<ValueType vtd, SDPatternOperator op, ValueType vt1,
292 ValueType vt2, ValueType vt3, Instruction inst>
293 : Pat<(vtd (op vt1:$Op1, vt2:$Op2, vt3:$Op3)),
294 (inst $Op1, $Op2, $Op3)>;
296 //===----------------------------------------------------------------------===//
297 // SVE Predicate Misc Group
298 //===----------------------------------------------------------------------===//
300 class sve_int_pfalse<bits<6> opc, string asm>
301 : I<(outs PPR8:$Pd), (ins),
306 let Inst{31-24} = 0b00100101;
307 let Inst{23-22} = opc{5-4};
308 let Inst{21-19} = 0b011;
309 let Inst{18-16} = opc{3-1};
310 let Inst{15-10} = 0b111001;
311 let Inst{9} = opc{0};
312 let Inst{8-4} = 0b00000;
316 class sve_int_ptest<bits<6> opc, string asm>
317 : I<(outs), (ins PPRAny:$Pg, PPR8:$Pn),
323 let Inst{31-24} = 0b00100101;
324 let Inst{23-22} = opc{5-4};
325 let Inst{21-19} = 0b010;
326 let Inst{18-16} = opc{3-1};
327 let Inst{15-14} = 0b11;
328 let Inst{13-10} = Pg;
329 let Inst{9} = opc{0};
331 let Inst{4-0} = 0b00000;
336 class sve_int_pfirst_next<bits<2> sz8_64, bits<5> opc, string asm,
338 : I<(outs pprty:$Pdn), (ins PPRAny:$Pg, pprty:$_Pdn),
339 asm, "\t$Pdn, $Pg, $_Pdn",
344 let Inst{31-24} = 0b00100101;
345 let Inst{23-22} = sz8_64;
346 let Inst{21-19} = 0b011;
347 let Inst{18-16} = opc{4-2};
348 let Inst{15-11} = 0b11000;
349 let Inst{10-9} = opc{1-0};
354 let Constraints = "$Pdn = $_Pdn";
358 multiclass sve_int_pfirst<bits<5> opc, string asm> {
359 def : sve_int_pfirst_next<0b01, opc, asm, PPR8>;
362 multiclass sve_int_pnext<bits<5> opc, string asm> {
363 def _B : sve_int_pfirst_next<0b00, opc, asm, PPR8>;
364 def _H : sve_int_pfirst_next<0b01, opc, asm, PPR16>;
365 def _S : sve_int_pfirst_next<0b10, opc, asm, PPR32>;
366 def _D : sve_int_pfirst_next<0b11, opc, asm, PPR64>;
369 //===----------------------------------------------------------------------===//
370 // SVE Predicate Count Group
371 //===----------------------------------------------------------------------===//
373 class sve_int_count_r<bits<2> sz8_64, bits<5> opc, string asm,
374 RegisterOperand dty, PPRRegOp pprty, RegisterOperand sty>
375 : I<(outs dty:$Rdn), (ins pprty:$Pg, sty:$_Rdn),
381 let Inst{31-24} = 0b00100101;
382 let Inst{23-22} = sz8_64;
383 let Inst{21-19} = 0b101;
384 let Inst{18-16} = opc{4-2};
385 let Inst{15-11} = 0b10001;
386 let Inst{10-9} = opc{1-0};
390 // Signed 32bit forms require their GPR operand printed.
391 let AsmString = !if(!eq(opc{4,2-0}, 0b0000),
392 !strconcat(asm, "\t$Rdn, $Pg, $_Rdn"),
393 !strconcat(asm, "\t$Rdn, $Pg"));
394 let Constraints = "$Rdn = $_Rdn";
397 multiclass sve_int_count_r_s32<bits<5> opc, string asm> {
398 def _B : sve_int_count_r<0b00, opc, asm, GPR64z, PPR8, GPR64as32>;
399 def _H : sve_int_count_r<0b01, opc, asm, GPR64z, PPR16, GPR64as32>;
400 def _S : sve_int_count_r<0b10, opc, asm, GPR64z, PPR32, GPR64as32>;
401 def _D : sve_int_count_r<0b11, opc, asm, GPR64z, PPR64, GPR64as32>;
404 multiclass sve_int_count_r_u32<bits<5> opc, string asm> {
405 def _B : sve_int_count_r<0b00, opc, asm, GPR32z, PPR8, GPR32z>;
406 def _H : sve_int_count_r<0b01, opc, asm, GPR32z, PPR16, GPR32z>;
407 def _S : sve_int_count_r<0b10, opc, asm, GPR32z, PPR32, GPR32z>;
408 def _D : sve_int_count_r<0b11, opc, asm, GPR32z, PPR64, GPR32z>;
411 multiclass sve_int_count_r_x64<bits<5> opc, string asm> {
412 def _B : sve_int_count_r<0b00, opc, asm, GPR64z, PPR8, GPR64z>;
413 def _H : sve_int_count_r<0b01, opc, asm, GPR64z, PPR16, GPR64z>;
414 def _S : sve_int_count_r<0b10, opc, asm, GPR64z, PPR32, GPR64z>;
415 def _D : sve_int_count_r<0b11, opc, asm, GPR64z, PPR64, GPR64z>;
418 class sve_int_count_v<bits<2> sz8_64, bits<5> opc, string asm,
419 ZPRRegOp zprty, PPRRegOp pprty>
420 : I<(outs zprty:$Zdn), (ins zprty:$_Zdn, pprty:$Pm),
426 let Inst{31-24} = 0b00100101;
427 let Inst{23-22} = sz8_64;
428 let Inst{21-19} = 0b101;
429 let Inst{18-16} = opc{4-2};
430 let Inst{15-11} = 0b10000;
431 let Inst{10-9} = opc{1-0};
435 let Constraints = "$Zdn = $_Zdn";
436 let DestructiveInstType = Destructive;
437 let ElementSize = ElementSizeNone;
440 multiclass sve_int_count_v<bits<5> opc, string asm> {
441 def _H : sve_int_count_v<0b01, opc, asm, ZPR16, PPR16>;
442 def _S : sve_int_count_v<0b10, opc, asm, ZPR32, PPR32>;
443 def _D : sve_int_count_v<0b11, opc, asm, ZPR64, PPR64>;
445 def : InstAlias<asm # "\t$Zdn, $Pm",
446 (!cast<Instruction>(NAME # "_H") ZPR16:$Zdn, PPRAny:$Pm), 0>;
447 def : InstAlias<asm # "\t$Zdn, $Pm",
448 (!cast<Instruction>(NAME # "_S") ZPR32:$Zdn, PPRAny:$Pm), 0>;
449 def : InstAlias<asm # "\t$Zdn, $Pm",
450 (!cast<Instruction>(NAME # "_D") ZPR64:$Zdn, PPRAny:$Pm), 0>;
453 class sve_int_pcount_pred<bits<2> sz8_64, bits<4> opc, string asm,
455 : I<(outs GPR64:$Rd), (ins PPRAny:$Pg, pprty:$Pn),
456 asm, "\t$Rd, $Pg, $Pn",
462 let Inst{31-24} = 0b00100101;
463 let Inst{23-22} = sz8_64;
464 let Inst{21-19} = 0b100;
465 let Inst{18-16} = opc{3-1};
466 let Inst{15-14} = 0b10;
467 let Inst{13-10} = Pg;
468 let Inst{9} = opc{0};
473 multiclass sve_int_pcount_pred<bits<4> opc, string asm> {
474 def _B : sve_int_pcount_pred<0b00, opc, asm, PPR8>;
475 def _H : sve_int_pcount_pred<0b01, opc, asm, PPR16>;
476 def _S : sve_int_pcount_pred<0b10, opc, asm, PPR32>;
477 def _D : sve_int_pcount_pred<0b11, opc, asm, PPR64>;
480 //===----------------------------------------------------------------------===//
481 // SVE Element Count Group
482 //===----------------------------------------------------------------------===//
484 class sve_int_count<bits<3> opc, string asm>
485 : I<(outs GPR64:$Rd), (ins sve_pred_enum:$pattern, sve_incdec_imm:$imm4),
486 asm, "\t$Rd, $pattern, mul $imm4",
492 let Inst{31-24} = 0b00000100;
493 let Inst{23-22} = opc{2-1};
494 let Inst{21-20} = 0b10;
495 let Inst{19-16} = imm4;
496 let Inst{15-11} = 0b11100;
497 let Inst{10} = opc{0};
498 let Inst{9-5} = pattern;
502 multiclass sve_int_count<bits<3> opc, string asm> {
503 def NAME : sve_int_count<opc, asm>;
505 def : InstAlias<asm # "\t$Rd, $pattern",
506 (!cast<Instruction>(NAME) GPR64:$Rd, sve_pred_enum:$pattern, 1), 1>;
507 def : InstAlias<asm # "\t$Rd",
508 (!cast<Instruction>(NAME) GPR64:$Rd, 0b11111, 1), 2>;
511 class sve_int_countvlv<bits<5> opc, string asm, ZPRRegOp zprty>
512 : I<(outs zprty:$Zdn), (ins zprty:$_Zdn, sve_pred_enum:$pattern, sve_incdec_imm:$imm4),
513 asm, "\t$Zdn, $pattern, mul $imm4",
519 let Inst{31-24} = 0b00000100;
520 let Inst{23-22} = opc{4-3};
522 let Inst{20} = opc{2};
523 let Inst{19-16} = imm4;
524 let Inst{15-12} = 0b1100;
525 let Inst{11-10} = opc{1-0};
526 let Inst{9-5} = pattern;
529 let Constraints = "$Zdn = $_Zdn";
530 let DestructiveInstType = Destructive;
531 let ElementSize = ElementSizeNone;
534 multiclass sve_int_countvlv<bits<5> opc, string asm, ZPRRegOp zprty> {
535 def NAME : sve_int_countvlv<opc, asm, zprty>;
537 def : InstAlias<asm # "\t$Zdn, $pattern",
538 (!cast<Instruction>(NAME) zprty:$Zdn, sve_pred_enum:$pattern, 1), 1>;
539 def : InstAlias<asm # "\t$Zdn",
540 (!cast<Instruction>(NAME) zprty:$Zdn, 0b11111, 1), 2>;
543 class sve_int_pred_pattern_a<bits<3> opc, string asm>
544 : I<(outs GPR64:$Rdn), (ins GPR64:$_Rdn, sve_pred_enum:$pattern, sve_incdec_imm:$imm4),
545 asm, "\t$Rdn, $pattern, mul $imm4",
551 let Inst{31-24} = 0b00000100;
552 let Inst{23-22} = opc{2-1};
553 let Inst{21-20} = 0b11;
554 let Inst{19-16} = imm4;
555 let Inst{15-11} = 0b11100;
556 let Inst{10} = opc{0};
557 let Inst{9-5} = pattern;
560 let Constraints = "$Rdn = $_Rdn";
563 multiclass sve_int_pred_pattern_a<bits<3> opc, string asm> {
564 def NAME : sve_int_pred_pattern_a<opc, asm>;
566 def : InstAlias<asm # "\t$Rdn, $pattern",
567 (!cast<Instruction>(NAME) GPR64:$Rdn, sve_pred_enum:$pattern, 1), 1>;
568 def : InstAlias<asm # "\t$Rdn",
569 (!cast<Instruction>(NAME) GPR64:$Rdn, 0b11111, 1), 2>;
572 class sve_int_pred_pattern_b<bits<5> opc, string asm, RegisterOperand dt,
574 : I<(outs dt:$Rdn), (ins st:$_Rdn, sve_pred_enum:$pattern, sve_incdec_imm:$imm4),
575 asm, "\t$Rdn, $pattern, mul $imm4",
581 let Inst{31-24} = 0b00000100;
582 let Inst{23-22} = opc{4-3};
584 let Inst{20} = opc{2};
585 let Inst{19-16} = imm4;
586 let Inst{15-12} = 0b1111;
587 let Inst{11-10} = opc{1-0};
588 let Inst{9-5} = pattern;
591 // Signed 32bit forms require their GPR operand printed.
592 let AsmString = !if(!eq(opc{2,0}, 0b00),
593 !strconcat(asm, "\t$Rdn, $_Rdn, $pattern, mul $imm4"),
594 !strconcat(asm, "\t$Rdn, $pattern, mul $imm4"));
596 let Constraints = "$Rdn = $_Rdn";
599 multiclass sve_int_pred_pattern_b_s32<bits<5> opc, string asm> {
600 def NAME : sve_int_pred_pattern_b<opc, asm, GPR64z, GPR64as32>;
602 def : InstAlias<asm # "\t$Rd, $Rn, $pattern",
603 (!cast<Instruction>(NAME) GPR64z:$Rd, GPR64as32:$Rn, sve_pred_enum:$pattern, 1), 1>;
604 def : InstAlias<asm # "\t$Rd, $Rn",
605 (!cast<Instruction>(NAME) GPR64z:$Rd, GPR64as32:$Rn, 0b11111, 1), 2>;
608 multiclass sve_int_pred_pattern_b_u32<bits<5> opc, string asm> {
609 def NAME : sve_int_pred_pattern_b<opc, asm, GPR32z, GPR32z>;
611 def : InstAlias<asm # "\t$Rdn, $pattern",
612 (!cast<Instruction>(NAME) GPR32z:$Rdn, sve_pred_enum:$pattern, 1), 1>;
613 def : InstAlias<asm # "\t$Rdn",
614 (!cast<Instruction>(NAME) GPR32z:$Rdn, 0b11111, 1), 2>;
617 multiclass sve_int_pred_pattern_b_x64<bits<5> opc, string asm> {
618 def NAME : sve_int_pred_pattern_b<opc, asm, GPR64z, GPR64z>;
620 def : InstAlias<asm # "\t$Rdn, $pattern",
621 (!cast<Instruction>(NAME) GPR64z:$Rdn, sve_pred_enum:$pattern, 1), 1>;
622 def : InstAlias<asm # "\t$Rdn",
623 (!cast<Instruction>(NAME) GPR64z:$Rdn, 0b11111, 1), 2>;
627 //===----------------------------------------------------------------------===//
628 // SVE Permute - Cross Lane Group
629 //===----------------------------------------------------------------------===//
631 class sve_int_perm_dup_r<bits<2> sz8_64, string asm, ZPRRegOp zprty,
632 RegisterClass srcRegType>
633 : I<(outs zprty:$Zd), (ins srcRegType:$Rn),
639 let Inst{31-24} = 0b00000101;
640 let Inst{23-22} = sz8_64;
641 let Inst{21-10} = 0b100000001110;
646 multiclass sve_int_perm_dup_r<string asm> {
647 def _B : sve_int_perm_dup_r<0b00, asm, ZPR8, GPR32sp>;
648 def _H : sve_int_perm_dup_r<0b01, asm, ZPR16, GPR32sp>;
649 def _S : sve_int_perm_dup_r<0b10, asm, ZPR32, GPR32sp>;
650 def _D : sve_int_perm_dup_r<0b11, asm, ZPR64, GPR64sp>;
652 def : InstAlias<"mov $Zd, $Rn",
653 (!cast<Instruction>(NAME # _B) ZPR8:$Zd, GPR32sp:$Rn), 1>;
654 def : InstAlias<"mov $Zd, $Rn",
655 (!cast<Instruction>(NAME # _H) ZPR16:$Zd, GPR32sp:$Rn), 1>;
656 def : InstAlias<"mov $Zd, $Rn",
657 (!cast<Instruction>(NAME # _S) ZPR32:$Zd, GPR32sp:$Rn), 1>;
658 def : InstAlias<"mov $Zd, $Rn",
659 (!cast<Instruction>(NAME # _D) ZPR64:$Zd, GPR64sp:$Rn), 1>;
662 class sve_int_perm_dup_i<bits<5> tsz, Operand immtype, string asm,
664 : I<(outs zprty:$Zd), (ins zprty:$Zn, immtype:$idx),
665 asm, "\t$Zd, $Zn$idx",
671 let Inst{31-24} = 0b00000101;
672 let Inst{23-22} = {?,?}; // imm3h
674 let Inst{20-16} = tsz;
675 let Inst{15-10} = 0b001000;
680 multiclass sve_int_perm_dup_i<string asm> {
681 def _B : sve_int_perm_dup_i<{?,?,?,?,1}, sve_elm_idx_extdup_b, asm, ZPR8> {
682 let Inst{23-22} = idx{5-4};
683 let Inst{20-17} = idx{3-0};
685 def _H : sve_int_perm_dup_i<{?,?,?,1,0}, sve_elm_idx_extdup_h, asm, ZPR16> {
686 let Inst{23-22} = idx{4-3};
687 let Inst{20-18} = idx{2-0};
689 def _S : sve_int_perm_dup_i<{?,?,1,0,0}, sve_elm_idx_extdup_s, asm, ZPR32> {
690 let Inst{23-22} = idx{3-2};
691 let Inst{20-19} = idx{1-0};
693 def _D : sve_int_perm_dup_i<{?,1,0,0,0}, sve_elm_idx_extdup_d, asm, ZPR64> {
694 let Inst{23-22} = idx{2-1};
695 let Inst{20} = idx{0};
697 def _Q : sve_int_perm_dup_i<{1,0,0,0,0}, sve_elm_idx_extdup_q, asm, ZPR128> {
698 let Inst{23-22} = idx{1-0};
701 def : InstAlias<"mov $Zd, $Zn$idx",
702 (!cast<Instruction>(NAME # _B) ZPR8:$Zd, ZPR8:$Zn, sve_elm_idx_extdup_b:$idx), 1>;
703 def : InstAlias<"mov $Zd, $Zn$idx",
704 (!cast<Instruction>(NAME # _H) ZPR16:$Zd, ZPR16:$Zn, sve_elm_idx_extdup_h:$idx), 1>;
705 def : InstAlias<"mov $Zd, $Zn$idx",
706 (!cast<Instruction>(NAME # _S) ZPR32:$Zd, ZPR32:$Zn, sve_elm_idx_extdup_s:$idx), 1>;
707 def : InstAlias<"mov $Zd, $Zn$idx",
708 (!cast<Instruction>(NAME # _D) ZPR64:$Zd, ZPR64:$Zn, sve_elm_idx_extdup_d:$idx), 1>;
709 def : InstAlias<"mov $Zd, $Zn$idx",
710 (!cast<Instruction>(NAME # _Q) ZPR128:$Zd, ZPR128:$Zn, sve_elm_idx_extdup_q:$idx), 1>;
711 def : InstAlias<"mov $Zd, $Bn",
712 (!cast<Instruction>(NAME # _B) ZPR8:$Zd, FPR8asZPR:$Bn, 0), 2>;
713 def : InstAlias<"mov $Zd, $Hn",
714 (!cast<Instruction>(NAME # _H) ZPR16:$Zd, FPR16asZPR:$Hn, 0), 2>;
715 def : InstAlias<"mov $Zd, $Sn",
716 (!cast<Instruction>(NAME # _S) ZPR32:$Zd, FPR32asZPR:$Sn, 0), 2>;
717 def : InstAlias<"mov $Zd, $Dn",
718 (!cast<Instruction>(NAME # _D) ZPR64:$Zd, FPR64asZPR:$Dn, 0), 2>;
719 def : InstAlias<"mov $Zd, $Qn",
720 (!cast<Instruction>(NAME # _Q) ZPR128:$Zd, FPR128asZPR:$Qn, 0), 2>;
723 class sve_int_perm_tbl<bits<2> sz8_64, bits<2> opc, string asm,
724 ZPRRegOp zprty, RegisterOperand VecList>
725 : I<(outs zprty:$Zd), (ins VecList:$Zn, zprty:$Zm),
726 asm, "\t$Zd, $Zn, $Zm",
732 let Inst{31-24} = 0b00000101;
733 let Inst{23-22} = sz8_64;
735 let Inst{20-16} = Zm;
736 let Inst{15-13} = 0b001;
737 let Inst{12-11} = opc;
743 multiclass sve_int_perm_tbl<string asm> {
744 def _B : sve_int_perm_tbl<0b00, 0b10, asm, ZPR8, Z_b>;
745 def _H : sve_int_perm_tbl<0b01, 0b10, asm, ZPR16, Z_h>;
746 def _S : sve_int_perm_tbl<0b10, 0b10, asm, ZPR32, Z_s>;
747 def _D : sve_int_perm_tbl<0b11, 0b10, asm, ZPR64, Z_d>;
749 def : InstAlias<asm # "\t$Zd, $Zn, $Zm",
750 (!cast<Instruction>(NAME # _B) ZPR8:$Zd, ZPR8:$Zn, ZPR8:$Zm), 0>;
751 def : InstAlias<asm # "\t$Zd, $Zn, $Zm",
752 (!cast<Instruction>(NAME # _H) ZPR16:$Zd, ZPR16:$Zn, ZPR16:$Zm), 0>;
753 def : InstAlias<asm # "\t$Zd, $Zn, $Zm",
754 (!cast<Instruction>(NAME # _S) ZPR32:$Zd, ZPR32:$Zn, ZPR32:$Zm), 0>;
755 def : InstAlias<asm # "\t$Zd, $Zn, $Zm",
756 (!cast<Instruction>(NAME # _D) ZPR64:$Zd, ZPR64:$Zn, ZPR64:$Zm), 0>;
759 multiclass sve2_int_perm_tbl<string asm> {
760 def _B : sve_int_perm_tbl<0b00, 0b01, asm, ZPR8, ZZ_b>;
761 def _H : sve_int_perm_tbl<0b01, 0b01, asm, ZPR16, ZZ_h>;
762 def _S : sve_int_perm_tbl<0b10, 0b01, asm, ZPR32, ZZ_s>;
763 def _D : sve_int_perm_tbl<0b11, 0b01, asm, ZPR64, ZZ_d>;
766 class sve2_int_perm_tbx<bits<2> sz8_64, string asm, ZPRRegOp zprty>
767 : I<(outs zprty:$Zd), (ins zprty:$_Zd, zprty:$Zn, zprty:$Zm),
768 asm, "\t$Zd, $Zn, $Zm",
774 let Inst{31-24} = 0b00000101;
775 let Inst{23-22} = sz8_64;
777 let Inst{20-16} = Zm;
778 let Inst{15-10} = 0b001011;
782 let Constraints = "$Zd = $_Zd";
785 multiclass sve2_int_perm_tbx<string asm> {
786 def _B : sve2_int_perm_tbx<0b00, asm, ZPR8>;
787 def _H : sve2_int_perm_tbx<0b01, asm, ZPR16>;
788 def _S : sve2_int_perm_tbx<0b10, asm, ZPR32>;
789 def _D : sve2_int_perm_tbx<0b11, asm, ZPR64>;
792 class sve_int_perm_reverse_z<bits<2> sz8_64, string asm, ZPRRegOp zprty>
793 : I<(outs zprty:$Zd), (ins zprty:$Zn),
799 let Inst{31-24} = 0b00000101;
800 let Inst{23-22} = sz8_64;
801 let Inst{21-10} = 0b111000001110;
806 multiclass sve_int_perm_reverse_z<string asm> {
807 def _B : sve_int_perm_reverse_z<0b00, asm, ZPR8>;
808 def _H : sve_int_perm_reverse_z<0b01, asm, ZPR16>;
809 def _S : sve_int_perm_reverse_z<0b10, asm, ZPR32>;
810 def _D : sve_int_perm_reverse_z<0b11, asm, ZPR64>;
813 class sve_int_perm_reverse_p<bits<2> sz8_64, string asm, PPRRegOp pprty>
814 : I<(outs pprty:$Pd), (ins pprty:$Pn),
820 let Inst{31-24} = 0b00000101;
821 let Inst{23-22} = sz8_64;
822 let Inst{21-9} = 0b1101000100000;
828 multiclass sve_int_perm_reverse_p<string asm> {
829 def _B : sve_int_perm_reverse_p<0b00, asm, PPR8>;
830 def _H : sve_int_perm_reverse_p<0b01, asm, PPR16>;
831 def _S : sve_int_perm_reverse_p<0b10, asm, PPR32>;
832 def _D : sve_int_perm_reverse_p<0b11, asm, PPR64>;
835 class sve_int_perm_unpk<bits<2> sz16_64, bits<2> opc, string asm,
836 ZPRRegOp zprty1, ZPRRegOp zprty2>
837 : I<(outs zprty1:$Zd), (ins zprty2:$Zn),
842 let Inst{31-24} = 0b00000101;
843 let Inst{23-22} = sz16_64;
844 let Inst{21-18} = 0b1100;
845 let Inst{17-16} = opc;
846 let Inst{15-10} = 0b001110;
851 multiclass sve_int_perm_unpk<bits<2> opc, string asm> {
852 def _H : sve_int_perm_unpk<0b01, opc, asm, ZPR16, ZPR8>;
853 def _S : sve_int_perm_unpk<0b10, opc, asm, ZPR32, ZPR16>;
854 def _D : sve_int_perm_unpk<0b11, opc, asm, ZPR64, ZPR32>;
857 class sve_int_perm_insrs<bits<2> sz8_64, string asm, ZPRRegOp zprty,
858 RegisterClass srcRegType>
859 : I<(outs zprty:$Zdn), (ins zprty:$_Zdn, srcRegType:$Rm),
865 let Inst{31-24} = 0b00000101;
866 let Inst{23-22} = sz8_64;
867 let Inst{21-10} = 0b100100001110;
871 let Constraints = "$Zdn = $_Zdn";
872 let DestructiveInstType = Destructive;
873 let ElementSize = ElementSizeNone;
876 multiclass sve_int_perm_insrs<string asm> {
877 def _B : sve_int_perm_insrs<0b00, asm, ZPR8, GPR32>;
878 def _H : sve_int_perm_insrs<0b01, asm, ZPR16, GPR32>;
879 def _S : sve_int_perm_insrs<0b10, asm, ZPR32, GPR32>;
880 def _D : sve_int_perm_insrs<0b11, asm, ZPR64, GPR64>;
883 class sve_int_perm_insrv<bits<2> sz8_64, string asm, ZPRRegOp zprty,
884 RegisterClass srcRegType>
885 : I<(outs zprty:$Zdn), (ins zprty:$_Zdn, srcRegType:$Vm),
891 let Inst{31-24} = 0b00000101;
892 let Inst{23-22} = sz8_64;
893 let Inst{21-10} = 0b110100001110;
897 let Constraints = "$Zdn = $_Zdn";
898 let DestructiveInstType = Destructive;
899 let ElementSize = ElementSizeNone;
902 multiclass sve_int_perm_insrv<string asm> {
903 def _B : sve_int_perm_insrv<0b00, asm, ZPR8, FPR8>;
904 def _H : sve_int_perm_insrv<0b01, asm, ZPR16, FPR16>;
905 def _S : sve_int_perm_insrv<0b10, asm, ZPR32, FPR32>;
906 def _D : sve_int_perm_insrv<0b11, asm, ZPR64, FPR64>;
909 //===----------------------------------------------------------------------===//
910 // SVE Permute - Extract Group
911 //===----------------------------------------------------------------------===//
913 class sve_int_perm_extract_i<string asm>
914 : I<(outs ZPR8:$Zdn), (ins ZPR8:$_Zdn, ZPR8:$Zm, imm0_255:$imm8),
915 asm, "\t$Zdn, $_Zdn, $Zm, $imm8",
920 let Inst{31-21} = 0b00000101001;
921 let Inst{20-16} = imm8{7-3};
922 let Inst{15-13} = 0b000;
923 let Inst{12-10} = imm8{2-0};
927 let Constraints = "$Zdn = $_Zdn";
928 let DestructiveInstType = Destructive;
929 let ElementSize = ElementSizeNone;
932 class sve2_int_perm_extract_i_cons<string asm>
933 : I<(outs ZPR8:$Zd), (ins ZZ_b:$Zn, imm0_255:$imm8),
934 asm, "\t$Zd, $Zn, $imm8",
939 let Inst{31-21} = 0b00000101011;
940 let Inst{20-16} = imm8{7-3};
941 let Inst{15-13} = 0b000;
942 let Inst{12-10} = imm8{2-0};
947 //===----------------------------------------------------------------------===//
948 // SVE Vector Select Group
949 //===----------------------------------------------------------------------===//
951 class sve_int_sel_vvv<bits<2> sz8_64, string asm, ZPRRegOp zprty>
952 : I<(outs zprty:$Zd), (ins PPRAny:$Pg, zprty:$Zn, zprty:$Zm),
953 asm, "\t$Zd, $Pg, $Zn, $Zm",
960 let Inst{31-24} = 0b00000101;
961 let Inst{23-22} = sz8_64;
963 let Inst{20-16} = Zm;
964 let Inst{15-14} = 0b11;
965 let Inst{13-10} = Pg;
970 multiclass sve_int_sel_vvv<string asm> {
971 def _B : sve_int_sel_vvv<0b00, asm, ZPR8>;
972 def _H : sve_int_sel_vvv<0b01, asm, ZPR16>;
973 def _S : sve_int_sel_vvv<0b10, asm, ZPR32>;
974 def _D : sve_int_sel_vvv<0b11, asm, ZPR64>;
976 def : InstAlias<"mov $Zd, $Pg/m, $Zn",
977 (!cast<Instruction>(NAME # _B) ZPR8:$Zd, PPRAny:$Pg, ZPR8:$Zn, ZPR8:$Zd), 1>;
978 def : InstAlias<"mov $Zd, $Pg/m, $Zn",
979 (!cast<Instruction>(NAME # _H) ZPR16:$Zd, PPRAny:$Pg, ZPR16:$Zn, ZPR16:$Zd), 1>;
980 def : InstAlias<"mov $Zd, $Pg/m, $Zn",
981 (!cast<Instruction>(NAME # _S) ZPR32:$Zd, PPRAny:$Pg, ZPR32:$Zn, ZPR32:$Zd), 1>;
982 def : InstAlias<"mov $Zd, $Pg/m, $Zn",
983 (!cast<Instruction>(NAME # _D) ZPR64:$Zd, PPRAny:$Pg, ZPR64:$Zn, ZPR64:$Zd), 1>;
987 //===----------------------------------------------------------------------===//
988 // SVE Predicate Logical Operations Group
989 //===----------------------------------------------------------------------===//
991 class sve_int_pred_log<bits<4> opc, string asm>
992 : I<(outs PPR8:$Pd), (ins PPRAny:$Pg, PPR8:$Pn, PPR8:$Pm),
993 asm, "\t$Pd, $Pg/z, $Pn, $Pm",
1000 let Inst{31-24} = 0b00100101;
1001 let Inst{23-22} = opc{3-2};
1002 let Inst{21-20} = 0b00;
1003 let Inst{19-16} = Pm;
1004 let Inst{15-14} = 0b01;
1005 let Inst{13-10} = Pg;
1006 let Inst{9} = opc{1};
1008 let Inst{4} = opc{0};
1011 // SEL has no predication qualifier.
1012 let AsmString = !if(!eq(opc, 0b0011),
1013 !strconcat(asm, "\t$Pd, $Pg, $Pn, $Pm"),
1014 !strconcat(asm, "\t$Pd, $Pg/z, $Pn, $Pm"));
1016 let Defs = !if(!eq (opc{2}, 1), [NZCV], []);
1020 //===----------------------------------------------------------------------===//
1021 // SVE Logical Mask Immediate Group
1022 //===----------------------------------------------------------------------===//
1024 class sve_int_log_imm<bits<2> opc, string asm>
1025 : I<(outs ZPR64:$Zdn), (ins ZPR64:$_Zdn, logical_imm64:$imms13),
1026 asm, "\t$Zdn, $_Zdn, $imms13",
1027 "", []>, Sched<[]> {
1030 let Inst{31-24} = 0b00000101;
1031 let Inst{23-22} = opc;
1032 let Inst{21-18} = 0b0000;
1033 let Inst{17-5} = imms13;
1034 let Inst{4-0} = Zdn;
1036 let Constraints = "$Zdn = $_Zdn";
1037 let DecoderMethod = "DecodeSVELogicalImmInstruction";
1038 let DestructiveInstType = Destructive;
1039 let ElementSize = ElementSizeNone;
1042 multiclass sve_int_log_imm<bits<2> opc, string asm, string alias> {
1043 def NAME : sve_int_log_imm<opc, asm>;
1045 def : InstAlias<asm # "\t$Zdn, $Zdn, $imm",
1046 (!cast<Instruction>(NAME) ZPR8:$Zdn, sve_logical_imm8:$imm), 4>;
1047 def : InstAlias<asm # "\t$Zdn, $Zdn, $imm",
1048 (!cast<Instruction>(NAME) ZPR16:$Zdn, sve_logical_imm16:$imm), 3>;
1049 def : InstAlias<asm # "\t$Zdn, $Zdn, $imm",
1050 (!cast<Instruction>(NAME) ZPR32:$Zdn, sve_logical_imm32:$imm), 2>;
1052 def : InstAlias<alias # "\t$Zdn, $Zdn, $imm",
1053 (!cast<Instruction>(NAME) ZPR8:$Zdn, sve_logical_imm8_not:$imm), 0>;
1054 def : InstAlias<alias # "\t$Zdn, $Zdn, $imm",
1055 (!cast<Instruction>(NAME) ZPR16:$Zdn, sve_logical_imm16_not:$imm), 0>;
1056 def : InstAlias<alias # "\t$Zdn, $Zdn, $imm",
1057 (!cast<Instruction>(NAME) ZPR32:$Zdn, sve_logical_imm32_not:$imm), 0>;
1058 def : InstAlias<alias # "\t$Zdn, $Zdn, $imm",
1059 (!cast<Instruction>(NAME) ZPR64:$Zdn, logical_imm64_not:$imm), 0>;
1062 class sve_int_dup_mask_imm<string asm>
1063 : I<(outs ZPR64:$Zd), (ins logical_imm64:$imms),
1064 asm, "\t$Zd, $imms",
1069 let Inst{31-18} = 0b00000101110000;
1070 let Inst{17-5} = imms;
1073 let isReMaterializable = 1;
1074 let DecoderMethod = "DecodeSVELogicalImmInstruction";
1077 multiclass sve_int_dup_mask_imm<string asm> {
1078 def NAME : sve_int_dup_mask_imm<asm>;
1080 def : InstAlias<"dupm $Zd, $imm",
1081 (!cast<Instruction>(NAME) ZPR8:$Zd, sve_logical_imm8:$imm), 4>;
1082 def : InstAlias<"dupm $Zd, $imm",
1083 (!cast<Instruction>(NAME) ZPR16:$Zd, sve_logical_imm16:$imm), 3>;
1084 def : InstAlias<"dupm $Zd, $imm",
1085 (!cast<Instruction>(NAME) ZPR32:$Zd, sve_logical_imm32:$imm), 2>;
1087 // All Zd.b forms have a CPY/DUP equivalent, hence no byte alias here.
1088 def : InstAlias<"mov $Zd, $imm",
1089 (!cast<Instruction>(NAME) ZPR16:$Zd, sve_preferred_logical_imm16:$imm), 7>;
1090 def : InstAlias<"mov $Zd, $imm",
1091 (!cast<Instruction>(NAME) ZPR32:$Zd, sve_preferred_logical_imm32:$imm), 6>;
1092 def : InstAlias<"mov $Zd, $imm",
1093 (!cast<Instruction>(NAME) ZPR64:$Zd, sve_preferred_logical_imm64:$imm), 5>;
1096 //===----------------------------------------------------------------------===//
1097 // SVE Integer Arithmetic - Unpredicated Group.
1098 //===----------------------------------------------------------------------===//
1100 class sve_int_bin_cons_arit_0<bits<2> sz8_64, bits<3> opc, string asm,
1102 : I<(outs zprty:$Zd), (ins zprty:$Zn, zprty:$Zm),
1103 asm, "\t$Zd, $Zn, $Zm",
1104 "", []>, Sched<[]> {
1108 let Inst{31-24} = 0b00000100;
1109 let Inst{23-22} = sz8_64;
1111 let Inst{20-16} = Zm;
1112 let Inst{15-13} = 0b000;
1113 let Inst{12-10} = opc;
1118 multiclass sve_int_bin_cons_arit_0<bits<3> opc, string asm> {
1119 def _B : sve_int_bin_cons_arit_0<0b00, opc, asm, ZPR8>;
1120 def _H : sve_int_bin_cons_arit_0<0b01, opc, asm, ZPR16>;
1121 def _S : sve_int_bin_cons_arit_0<0b10, opc, asm, ZPR32>;
1122 def _D : sve_int_bin_cons_arit_0<0b11, opc, asm, ZPR64>;
1125 //===----------------------------------------------------------------------===//
1126 // SVE Floating Point Arithmetic - Predicated Group
1127 //===----------------------------------------------------------------------===//
1129 class sve_fp_2op_i_p_zds<bits<2> sz, bits<3> opc, string asm,
1132 : I<(outs zprty:$Zdn), (ins PPR3bAny:$Pg, zprty:$_Zdn, imm_ty:$i1),
1133 asm, "\t$Zdn, $Pg/m, $_Zdn, $i1",
1139 let Inst{31-24} = 0b01100101;
1140 let Inst{23-22} = sz;
1141 let Inst{21-19} = 0b011;
1142 let Inst{18-16} = opc;
1143 let Inst{15-13} = 0b100;
1144 let Inst{12-10} = Pg;
1145 let Inst{9-6} = 0b0000;
1147 let Inst{4-0} = Zdn;
1149 let Constraints = "$Zdn = $_Zdn";
1150 let DestructiveInstType = Destructive;
1151 let ElementSize = zprty.ElementSize;
1154 multiclass sve_fp_2op_i_p_zds<bits<3> opc, string asm, Operand imm_ty> {
1155 def _H : sve_fp_2op_i_p_zds<0b01, opc, asm, ZPR16, imm_ty>;
1156 def _S : sve_fp_2op_i_p_zds<0b10, opc, asm, ZPR32, imm_ty>;
1157 def _D : sve_fp_2op_i_p_zds<0b11, opc, asm, ZPR64, imm_ty>;
1160 class sve_fp_2op_p_zds<bits<2> sz, bits<4> opc, string asm,
1162 : I<(outs zprty:$Zdn), (ins PPR3bAny:$Pg, zprty:$_Zdn, zprty:$Zm),
1163 asm, "\t$Zdn, $Pg/m, $_Zdn, $Zm",
1169 let Inst{31-24} = 0b01100101;
1170 let Inst{23-22} = sz;
1171 let Inst{21-20} = 0b00;
1172 let Inst{19-16} = opc;
1173 let Inst{15-13} = 0b100;
1174 let Inst{12-10} = Pg;
1176 let Inst{4-0} = Zdn;
1178 let Constraints = "$Zdn = $_Zdn";
1179 let DestructiveInstType = Destructive;
1180 let ElementSize = zprty.ElementSize;
1183 multiclass sve_fp_2op_p_zds<bits<4> opc, string asm> {
1184 def _H : sve_fp_2op_p_zds<0b01, opc, asm, ZPR16>;
1185 def _S : sve_fp_2op_p_zds<0b10, opc, asm, ZPR32>;
1186 def _D : sve_fp_2op_p_zds<0b11, opc, asm, ZPR64>;
1189 class sve_fp_ftmad<bits<2> sz, string asm, ZPRRegOp zprty>
1190 : I<(outs zprty:$Zdn), (ins zprty:$_Zdn, zprty:$Zm, imm0_7:$imm3),
1191 asm, "\t$Zdn, $_Zdn, $Zm, $imm3",
1197 let Inst{31-24} = 0b01100101;
1198 let Inst{23-22} = sz;
1199 let Inst{21-19} = 0b010;
1200 let Inst{18-16} = imm3;
1201 let Inst{15-10} = 0b100000;
1203 let Inst{4-0} = Zdn;
1205 let Constraints = "$Zdn = $_Zdn";
1206 let DestructiveInstType = Destructive;
1207 let ElementSize = ElementSizeNone;
1210 multiclass sve_fp_ftmad<string asm> {
1211 def _H : sve_fp_ftmad<0b01, asm, ZPR16>;
1212 def _S : sve_fp_ftmad<0b10, asm, ZPR32>;
1213 def _D : sve_fp_ftmad<0b11, asm, ZPR64>;
1217 //===----------------------------------------------------------------------===//
1218 // SVE Floating Point Arithmetic - Unpredicated Group
1219 //===----------------------------------------------------------------------===//
1221 class sve_fp_3op_u_zd<bits<2> sz, bits<3> opc, string asm,
1223 ValueType vt, ValueType vt2, SDPatternOperator op>
1224 : I<(outs zprty:$Zd), (ins zprty:$Zn, zprty:$Zm),
1225 asm, "\t$Zd, $Zn, $Zm",
1227 [(set (vt zprty:$Zd), (op (vt zprty:$Zn), (vt2 zprty:$Zm)))]>, Sched<[]> {
1231 let Inst{31-24} = 0b01100101;
1232 let Inst{23-22} = sz;
1234 let Inst{20-16} = Zm;
1235 let Inst{15-13} = 0b000;
1236 let Inst{12-10} = opc;
1241 multiclass sve_fp_3op_u_zd<bits<3> opc, string asm, SDPatternOperator op> {
1242 def _H : sve_fp_3op_u_zd<0b01, opc, asm, ZPR16, nxv8f16, nxv8f16, op>;
1243 def _S : sve_fp_3op_u_zd<0b10, opc, asm, ZPR32, nxv4f32, nxv4f32, op>;
1244 def _D : sve_fp_3op_u_zd<0b11, opc, asm, ZPR64, nxv2f64, nxv2f64, op>;
1247 //===----------------------------------------------------------------------===//
1248 // SVE Floating Point Fused Multiply-Add Group
1249 //===----------------------------------------------------------------------===//
1251 class sve_fp_3op_p_zds_a<bits<2> sz, bits<2> opc, string asm, ZPRRegOp zprty>
1252 : I<(outs zprty:$Zda), (ins PPR3bAny:$Pg, zprty:$_Zda, zprty:$Zn, zprty:$Zm),
1253 asm, "\t$Zda, $Pg/m, $Zn, $Zm",
1260 let Inst{31-24} = 0b01100101;
1261 let Inst{23-22} = sz;
1263 let Inst{20-16} = Zm;
1265 let Inst{14-13} = opc;
1266 let Inst{12-10} = Pg;
1268 let Inst{4-0} = Zda;
1270 let Constraints = "$Zda = $_Zda";
1271 let DestructiveInstType = Destructive;
1272 let ElementSize = zprty.ElementSize;
1275 multiclass sve_fp_3op_p_zds_a<bits<2> opc, string asm> {
1276 def _H : sve_fp_3op_p_zds_a<0b01, opc, asm, ZPR16>;
1277 def _S : sve_fp_3op_p_zds_a<0b10, opc, asm, ZPR32>;
1278 def _D : sve_fp_3op_p_zds_a<0b11, opc, asm, ZPR64>;
1281 class sve_fp_3op_p_zds_b<bits<2> sz, bits<2> opc, string asm,
1283 : I<(outs zprty:$Zdn), (ins PPR3bAny:$Pg, zprty:$_Zdn, zprty:$Zm, zprty:$Za),
1284 asm, "\t$Zdn, $Pg/m, $Zm, $Za",
1291 let Inst{31-24} = 0b01100101;
1292 let Inst{23-22} = sz;
1294 let Inst{20-16} = Za;
1296 let Inst{14-13} = opc;
1297 let Inst{12-10} = Pg;
1299 let Inst{4-0} = Zdn;
1301 let Constraints = "$Zdn = $_Zdn";
1302 let DestructiveInstType = Destructive;
1303 let ElementSize = zprty.ElementSize;
1306 multiclass sve_fp_3op_p_zds_b<bits<2> opc, string asm> {
1307 def _H : sve_fp_3op_p_zds_b<0b01, opc, asm, ZPR16>;
1308 def _S : sve_fp_3op_p_zds_b<0b10, opc, asm, ZPR32>;
1309 def _D : sve_fp_3op_p_zds_b<0b11, opc, asm, ZPR64>;
1312 //===----------------------------------------------------------------------===//
1313 // SVE Floating Point Multiply-Add - Indexed Group
1314 //===----------------------------------------------------------------------===//
1316 class sve_fp_fma_by_indexed_elem<bits<2> sz, bit opc, string asm,
1318 ZPRRegOp zprty2, Operand itype>
1319 : I<(outs zprty1:$Zda), (ins zprty1:$_Zda, zprty1:$Zn, zprty2:$Zm, itype:$iop),
1320 asm, "\t$Zda, $Zn, $Zm$iop", "", []>, Sched<[]> {
1323 let Inst{31-24} = 0b01100100;
1324 let Inst{23-22} = sz;
1326 let Inst{15-11} = 0;
1329 let Inst{4-0} = Zda;
1331 let Constraints = "$Zda = $_Zda";
1332 let DestructiveInstType = Destructive;
1333 let ElementSize = ElementSizeNone;
1336 multiclass sve_fp_fma_by_indexed_elem<bit opc, string asm> {
1337 def _H : sve_fp_fma_by_indexed_elem<{0, ?}, opc, asm, ZPR16, ZPR3b16, VectorIndexH> {
1340 let Inst{22} = iop{2};
1341 let Inst{20-19} = iop{1-0};
1342 let Inst{18-16} = Zm;
1344 def _S : sve_fp_fma_by_indexed_elem<0b10, opc, asm, ZPR32, ZPR3b32, VectorIndexS> {
1347 let Inst{20-19} = iop;
1348 let Inst{18-16} = Zm;
1350 def _D : sve_fp_fma_by_indexed_elem<0b11, opc, asm, ZPR64, ZPR4b64, VectorIndexD> {
1354 let Inst{19-16} = Zm;
1359 //===----------------------------------------------------------------------===//
1360 // SVE Floating Point Multiply - Indexed Group
1361 //===----------------------------------------------------------------------===//
1363 class sve_fp_fmul_by_indexed_elem<bits<2> sz, string asm, ZPRRegOp zprty,
1364 ZPRRegOp zprty2, Operand itype>
1365 : I<(outs zprty:$Zd), (ins zprty:$Zn, zprty2:$Zm, itype:$iop),
1366 asm, "\t$Zd, $Zn, $Zm$iop", "", []>, Sched<[]> {
1369 let Inst{31-24} = 0b01100100;
1370 let Inst{23-22} = sz;
1372 let Inst{15-10} = 0b001000;
1377 multiclass sve_fp_fmul_by_indexed_elem<string asm> {
1378 def _H : sve_fp_fmul_by_indexed_elem<{0, ?}, asm, ZPR16, ZPR3b16, VectorIndexH> {
1381 let Inst{22} = iop{2};
1382 let Inst{20-19} = iop{1-0};
1383 let Inst{18-16} = Zm;
1385 def _S : sve_fp_fmul_by_indexed_elem<0b10, asm, ZPR32, ZPR3b32, VectorIndexS> {
1388 let Inst{20-19} = iop;
1389 let Inst{18-16} = Zm;
1391 def _D : sve_fp_fmul_by_indexed_elem<0b11, asm, ZPR64, ZPR4b64, VectorIndexD> {
1395 let Inst{19-16} = Zm;
1399 //===----------------------------------------------------------------------===//
1400 // SVE Floating Point Complex Multiply-Add Group
1401 //===----------------------------------------------------------------------===//
1403 class sve_fp_fcmla<bits<2> sz, string asm, ZPRRegOp zprty>
1404 : I<(outs zprty:$Zda), (ins PPR3bAny:$Pg, zprty:$_Zda, zprty:$Zn, zprty:$Zm,
1405 complexrotateop:$imm),
1406 asm, "\t$Zda, $Pg/m, $Zn, $Zm, $imm",
1407 "", []>, Sched<[]> {
1413 let Inst{31-24} = 0b01100100;
1414 let Inst{23-22} = sz;
1416 let Inst{20-16} = Zm;
1418 let Inst{14-13} = imm;
1419 let Inst{12-10} = Pg;
1421 let Inst{4-0} = Zda;
1423 let Constraints = "$Zda = $_Zda";
1424 let DestructiveInstType = Destructive;
1425 let ElementSize = zprty.ElementSize;
1428 multiclass sve_fp_fcmla<string asm> {
1429 def _H : sve_fp_fcmla<0b01, asm, ZPR16>;
1430 def _S : sve_fp_fcmla<0b10, asm, ZPR32>;
1431 def _D : sve_fp_fcmla<0b11, asm, ZPR64>;
1434 //===----------------------------------------------------------------------===//
1435 // SVE Floating Point Complex Multiply-Add - Indexed Group
1436 //===----------------------------------------------------------------------===//
1438 class sve_fp_fcmla_by_indexed_elem<bits<2> sz, string asm,
1440 ZPRRegOp zprty2, Operand itype>
1441 : I<(outs zprty:$Zda), (ins zprty:$_Zda, zprty:$Zn, zprty2:$Zm, itype:$iop,
1442 complexrotateop:$imm),
1443 asm, "\t$Zda, $Zn, $Zm$iop, $imm",
1444 "", []>, Sched<[]> {
1448 let Inst{31-24} = 0b01100100;
1449 let Inst{23-22} = sz;
1451 let Inst{15-12} = 0b0001;
1452 let Inst{11-10} = imm;
1454 let Inst{4-0} = Zda;
1456 let Constraints = "$Zda = $_Zda";
1457 let DestructiveInstType = Destructive;
1458 let ElementSize = ElementSizeNone;
1461 multiclass sve_fp_fcmla_by_indexed_elem<string asm> {
1462 def _H : sve_fp_fcmla_by_indexed_elem<0b10, asm, ZPR16, ZPR3b16, VectorIndexS> {
1465 let Inst{20-19} = iop;
1466 let Inst{18-16} = Zm;
1468 def _S : sve_fp_fcmla_by_indexed_elem<0b11, asm, ZPR32, ZPR4b32, VectorIndexD> {
1472 let Inst{19-16} = Zm;
1476 //===----------------------------------------------------------------------===//
1477 // SVE Floating Point Complex Addition Group
1478 //===----------------------------------------------------------------------===//
1480 class sve_fp_fcadd<bits<2> sz, string asm, ZPRRegOp zprty>
1481 : I<(outs zprty:$Zdn), (ins PPR3bAny:$Pg, zprty:$_Zdn, zprty:$Zm,
1482 complexrotateopodd:$imm),
1483 asm, "\t$Zdn, $Pg/m, $_Zdn, $Zm, $imm",
1490 let Inst{31-24} = 0b01100100;
1491 let Inst{23-22} = sz;
1492 let Inst{21-17} = 0;
1494 let Inst{15-13} = 0b100;
1495 let Inst{12-10} = Pg;
1497 let Inst{4-0} = Zdn;
1499 let Constraints = "$Zdn = $_Zdn";
1500 let DestructiveInstType = Destructive;
1501 let ElementSize = zprty.ElementSize;
1504 multiclass sve_fp_fcadd<string asm> {
1505 def _H : sve_fp_fcadd<0b01, asm, ZPR16>;
1506 def _S : sve_fp_fcadd<0b10, asm, ZPR32>;
1507 def _D : sve_fp_fcadd<0b11, asm, ZPR64>;
1510 //===----------------------------------------------------------------------===//
1511 // SVE2 Floating Point Convert Group
1512 //===----------------------------------------------------------------------===//
1514 class sve2_fp_convert_precision<bits<4> opc, string asm,
1515 ZPRRegOp zprty1, ZPRRegOp zprty2>
1516 : I<(outs zprty1:$Zd), (ins zprty1:$_Zd, PPR3bAny:$Pg, zprty2:$Zn),
1517 asm, "\t$Zd, $Pg/m, $Zn",
1523 let Inst{31-24} = 0b01100100;
1524 let Inst{23-22} = opc{3-2};
1525 let Inst{21-18} = 0b0010;
1526 let Inst{17-16} = opc{1-0};
1527 let Inst{15-13} = 0b101;
1528 let Inst{12-10} = Pg;
1532 let Constraints = "$Zd = $_Zd";
1535 multiclass sve2_fp_convert_down_narrow<string asm> {
1536 def _StoH : sve2_fp_convert_precision<0b1000, asm, ZPR16, ZPR32>;
1537 def _DtoS : sve2_fp_convert_precision<0b1110, asm, ZPR32, ZPR64>;
1540 multiclass sve2_fp_convert_up_long<string asm> {
1541 def _HtoS : sve2_fp_convert_precision<0b1001, asm, ZPR32, ZPR16>;
1542 def _StoD : sve2_fp_convert_precision<0b1111, asm, ZPR64, ZPR32>;
1545 multiclass sve2_fp_convert_down_odd_rounding<string asm> {
1546 def _DtoS : sve2_fp_convert_precision<0b0010, asm, ZPR32, ZPR64>;
1549 //===----------------------------------------------------------------------===//
1550 // SVE2 Floating Point Pairwise Group
1551 //===----------------------------------------------------------------------===//
1553 class sve2_fp_pairwise_pred<bits<2> sz, bits<3> opc, string asm,
1555 : I<(outs zprty:$Zdn), (ins PPR3bAny:$Pg, zprty:$_Zdn, zprty:$Zm),
1556 asm, "\t$Zdn, $Pg/m, $_Zdn, $Zm",
1562 let Inst{31-24} = 0b01100100;
1563 let Inst{23-22} = sz;
1564 let Inst{21-19} = 0b010;
1565 let Inst{18-16} = opc;
1566 let Inst{15-13} = 0b100;
1567 let Inst{12-10} = Pg;
1569 let Inst{4-0} = Zdn;
1571 let Constraints = "$Zdn = $_Zdn";
1572 let DestructiveInstType = Destructive;
1573 let ElementSize = zprty.ElementSize;
1576 multiclass sve2_fp_pairwise_pred<bits<3> opc, string asm> {
1577 def _H : sve2_fp_pairwise_pred<0b01, opc, asm, ZPR16>;
1578 def _S : sve2_fp_pairwise_pred<0b10, opc, asm, ZPR32>;
1579 def _D : sve2_fp_pairwise_pred<0b11, opc, asm, ZPR64>;
1582 //===----------------------------------------------------------------------===//
1583 // SVE2 Floating Point Widening Multiply-Add - Indexed Group
1584 //===----------------------------------------------------------------------===//
1586 class sve2_fp_mla_long_by_indexed_elem<bits<2> opc, string asm>
1587 : I<(outs ZPR32:$Zda), (ins ZPR32:$_Zda, ZPR16:$Zn, ZPR3b16:$Zm,
1589 asm, "\t$Zda, $Zn, $Zm$iop",
1596 let Inst{31-21} = 0b01100100101;
1597 let Inst{20-19} = iop{2-1};
1598 let Inst{18-16} = Zm;
1599 let Inst{15-14} = 0b01;
1600 let Inst{13} = opc{1};
1602 let Inst{11} = iop{0};
1603 let Inst{10} = opc{0};
1605 let Inst{4-0} = Zda;
1607 let Constraints = "$Zda = $_Zda";
1608 let DestructiveInstType = Destructive;
1609 let ElementSize = ElementSizeNone;
1612 //===----------------------------------------------------------------------===//
1613 // SVE2 Floating Point Widening Multiply-Add Group
1614 //===----------------------------------------------------------------------===//
1616 class sve2_fp_mla_long<bits<2> opc, string asm>
1617 : I<(outs ZPR32:$Zda), (ins ZPR32:$_Zda, ZPR16:$Zn, ZPR16:$Zm),
1618 asm, "\t$Zda, $Zn, $Zm",
1624 let Inst{31-21} = 0b01100100101;
1625 let Inst{20-16} = Zm;
1626 let Inst{15-14} = 0b10;
1627 let Inst{13} = opc{1};
1628 let Inst{12-11} = 0b00;
1629 let Inst{10} = opc{0};
1631 let Inst{4-0} = Zda;
1633 let Constraints = "$Zda = $_Zda";
1634 let DestructiveInstType = Destructive;
1635 let ElementSize = ElementSizeNone;
1638 //===----------------------------------------------------------------------===//
1639 // SVE Stack Allocation Group
1640 //===----------------------------------------------------------------------===//
1642 class sve_int_arith_vl<bit opc, string asm>
1643 : I<(outs GPR64sp:$Rd), (ins GPR64sp:$Rn, simm6_32b:$imm6),
1644 asm, "\t$Rd, $Rn, $imm6",
1650 let Inst{31-23} = 0b000001000;
1653 let Inst{20-16} = Rn;
1654 let Inst{15-11} = 0b01010;
1655 let Inst{10-5} = imm6;
1659 class sve_int_read_vl_a<bit op, bits<5> opc2, string asm>
1660 : I<(outs GPR64:$Rd), (ins simm6_32b:$imm6),
1661 asm, "\t$Rd, $imm6",
1666 let Inst{31-23} = 0b000001001;
1669 let Inst{20-16} = opc2{4-0};
1670 let Inst{15-11} = 0b01010;
1671 let Inst{10-5} = imm6;
1675 //===----------------------------------------------------------------------===//
1676 // SVE Permute - In Lane Group
1677 //===----------------------------------------------------------------------===//
1679 class sve_int_perm_bin_perm_zz<bits<3> opc, bits<2> sz8_64, string asm,
1681 : I<(outs zprty:$Zd), (ins zprty:$Zn, zprty:$Zm),
1682 asm, "\t$Zd, $Zn, $Zm",
1688 let Inst{31-24} = 0b00000101;
1689 let Inst{23-22} = sz8_64;
1691 let Inst{20-16} = Zm;
1692 let Inst{15-13} = 0b011;
1693 let Inst{12-10} = opc;
1698 multiclass sve_int_perm_bin_perm_zz<bits<3> opc, string asm> {
1699 def _B : sve_int_perm_bin_perm_zz<opc, 0b00, asm, ZPR8>;
1700 def _H : sve_int_perm_bin_perm_zz<opc, 0b01, asm, ZPR16>;
1701 def _S : sve_int_perm_bin_perm_zz<opc, 0b10, asm, ZPR32>;
1702 def _D : sve_int_perm_bin_perm_zz<opc, 0b11, asm, ZPR64>;
1705 //===----------------------------------------------------------------------===//
1706 // SVE Floating Point Unary Operations Group
1707 //===----------------------------------------------------------------------===//
1709 class sve_fp_2op_p_zd<bits<7> opc, string asm, RegisterOperand i_zprtype,
1710 RegisterOperand o_zprtype, ElementSizeEnum size>
1711 : I<(outs o_zprtype:$Zd), (ins i_zprtype:$_Zd, PPR3bAny:$Pg, i_zprtype:$Zn),
1712 asm, "\t$Zd, $Pg/m, $Zn",
1718 let Inst{31-24} = 0b01100101;
1719 let Inst{23-22} = opc{6-5};
1721 let Inst{20-16} = opc{4-0};
1722 let Inst{15-13} = 0b101;
1723 let Inst{12-10} = Pg;
1727 let Constraints = "$Zd = $_Zd";
1728 let DestructiveInstType = Destructive;
1729 let ElementSize = size;
1732 multiclass sve_fp_2op_p_zd_HSD<bits<5> opc, string asm> {
1733 def _H : sve_fp_2op_p_zd<{ 0b01, opc }, asm, ZPR16, ZPR16, ElementSizeH>;
1734 def _S : sve_fp_2op_p_zd<{ 0b10, opc }, asm, ZPR32, ZPR32, ElementSizeS>;
1735 def _D : sve_fp_2op_p_zd<{ 0b11, opc }, asm, ZPR64, ZPR64, ElementSizeD>;
1738 multiclass sve2_fp_flogb<string asm> {
1739 def _H : sve_fp_2op_p_zd<0b0011010, asm, ZPR16, ZPR16, ElementSizeH>;
1740 def _S : sve_fp_2op_p_zd<0b0011100, asm, ZPR32, ZPR32, ElementSizeS>;
1741 def _D : sve_fp_2op_p_zd<0b0011110, asm, ZPR64, ZPR64, ElementSizeD>;
1744 //===----------------------------------------------------------------------===//
1745 // SVE Floating Point Unary Operations - Unpredicated Group
1746 //===----------------------------------------------------------------------===//
1748 class sve_fp_2op_u_zd<bits<2> sz, bits<3> opc, string asm,
1750 : I<(outs zprty:$Zd), (ins zprty:$Zn),
1756 let Inst{31-24} = 0b01100101;
1757 let Inst{23-22} = sz;
1758 let Inst{21-19} = 0b001;
1759 let Inst{18-16} = opc;
1760 let Inst{15-10} = 0b001100;
1765 multiclass sve_fp_2op_u_zd<bits<3> opc, string asm> {
1766 def _H : sve_fp_2op_u_zd<0b01, opc, asm, ZPR16>;
1767 def _S : sve_fp_2op_u_zd<0b10, opc, asm, ZPR32>;
1768 def _D : sve_fp_2op_u_zd<0b11, opc, asm, ZPR64>;
1771 //===----------------------------------------------------------------------===//
1772 // SVE Integer Arithmetic - Binary Predicated Group
1773 //===----------------------------------------------------------------------===//
1775 class sve_int_bin_pred_arit_log<bits<2> sz8_64, bits<2> fmt, bits<3> opc,
1776 string asm, ZPRRegOp zprty>
1777 : I<(outs zprty:$Zdn), (ins PPR3bAny:$Pg, zprty:$_Zdn, zprty:$Zm),
1778 asm, "\t$Zdn, $Pg/m, $_Zdn, $Zm", "", []>, Sched<[]> {
1782 let Inst{31-24} = 0b00000100;
1783 let Inst{23-22} = sz8_64;
1785 let Inst{20-19} = fmt;
1786 let Inst{18-16} = opc;
1787 let Inst{15-13} = 0b000;
1788 let Inst{12-10} = Pg;
1790 let Inst{4-0} = Zdn;
1792 let Constraints = "$Zdn = $_Zdn";
1793 let DestructiveInstType = Destructive;
1794 let ElementSize = zprty.ElementSize;
1797 multiclass sve_int_bin_pred_log<bits<3> opc, string asm> {
1798 def _B : sve_int_bin_pred_arit_log<0b00, 0b11, opc, asm, ZPR8>;
1799 def _H : sve_int_bin_pred_arit_log<0b01, 0b11, opc, asm, ZPR16>;
1800 def _S : sve_int_bin_pred_arit_log<0b10, 0b11, opc, asm, ZPR32>;
1801 def _D : sve_int_bin_pred_arit_log<0b11, 0b11, opc, asm, ZPR64>;
1804 multiclass sve_int_bin_pred_arit_0<bits<3> opc, string asm> {
1805 def _B : sve_int_bin_pred_arit_log<0b00, 0b00, opc, asm, ZPR8>;
1806 def _H : sve_int_bin_pred_arit_log<0b01, 0b00, opc, asm, ZPR16>;
1807 def _S : sve_int_bin_pred_arit_log<0b10, 0b00, opc, asm, ZPR32>;
1808 def _D : sve_int_bin_pred_arit_log<0b11, 0b00, opc, asm, ZPR64>;
1811 multiclass sve_int_bin_pred_arit_1<bits<3> opc, string asm> {
1812 def _B : sve_int_bin_pred_arit_log<0b00, 0b01, opc, asm, ZPR8>;
1813 def _H : sve_int_bin_pred_arit_log<0b01, 0b01, opc, asm, ZPR16>;
1814 def _S : sve_int_bin_pred_arit_log<0b10, 0b01, opc, asm, ZPR32>;
1815 def _D : sve_int_bin_pred_arit_log<0b11, 0b01, opc, asm, ZPR64>;
1818 multiclass sve_int_bin_pred_arit_2<bits<3> opc, string asm> {
1819 def _B : sve_int_bin_pred_arit_log<0b00, 0b10, opc, asm, ZPR8>;
1820 def _H : sve_int_bin_pred_arit_log<0b01, 0b10, opc, asm, ZPR16>;
1821 def _S : sve_int_bin_pred_arit_log<0b10, 0b10, opc, asm, ZPR32>;
1822 def _D : sve_int_bin_pred_arit_log<0b11, 0b10, opc, asm, ZPR64>;
1825 // Special case for divides which are not defined for 8b/16b elements.
1826 multiclass sve_int_bin_pred_arit_2_div<bits<3> opc, string asm> {
1827 def _S : sve_int_bin_pred_arit_log<0b10, 0b10, opc, asm, ZPR32>;
1828 def _D : sve_int_bin_pred_arit_log<0b11, 0b10, opc, asm, ZPR64>;
1831 //===----------------------------------------------------------------------===//
1832 // SVE Integer Multiply-Add Group
1833 //===----------------------------------------------------------------------===//
1835 class sve_int_mladdsub_vvv_pred<bits<2> sz8_64, bits<1> opc, string asm,
1837 : I<(outs zprty:$Zdn), (ins PPR3bAny:$Pg, zprty:$_Zdn, zprty:$Zm, zprty:$Za),
1838 asm, "\t$Zdn, $Pg/m, $Zm, $Za",
1845 let Inst{31-24} = 0b00000100;
1846 let Inst{23-22} = sz8_64;
1848 let Inst{20-16} = Zm;
1849 let Inst{15-14} = 0b11;
1851 let Inst{12-10} = Pg;
1853 let Inst{4-0} = Zdn;
1855 let Constraints = "$Zdn = $_Zdn";
1856 let DestructiveInstType = Destructive;
1857 let ElementSize = zprty.ElementSize;
1860 multiclass sve_int_mladdsub_vvv_pred<bits<1> opc, string asm> {
1861 def _B : sve_int_mladdsub_vvv_pred<0b00, opc, asm, ZPR8>;
1862 def _H : sve_int_mladdsub_vvv_pred<0b01, opc, asm, ZPR16>;
1863 def _S : sve_int_mladdsub_vvv_pred<0b10, opc, asm, ZPR32>;
1864 def _D : sve_int_mladdsub_vvv_pred<0b11, opc, asm, ZPR64>;
1867 class sve_int_mlas_vvv_pred<bits<2> sz8_64, bits<1> opc, string asm,
1869 : I<(outs zprty:$Zda), (ins PPR3bAny:$Pg, zprty:$_Zda, zprty:$Zn, zprty:$Zm),
1870 asm, "\t$Zda, $Pg/m, $Zn, $Zm",
1877 let Inst{31-24} = 0b00000100;
1878 let Inst{23-22} = sz8_64;
1880 let Inst{20-16} = Zm;
1881 let Inst{15-14} = 0b01;
1883 let Inst{12-10} = Pg;
1885 let Inst{4-0} = Zda;
1887 let Constraints = "$Zda = $_Zda";
1888 let DestructiveInstType = Destructive;
1889 let ElementSize = zprty.ElementSize;
1892 multiclass sve_int_mlas_vvv_pred<bits<1> opc, string asm> {
1893 def _B : sve_int_mlas_vvv_pred<0b00, opc, asm, ZPR8>;
1894 def _H : sve_int_mlas_vvv_pred<0b01, opc, asm, ZPR16>;
1895 def _S : sve_int_mlas_vvv_pred<0b10, opc, asm, ZPR32>;
1896 def _D : sve_int_mlas_vvv_pred<0b11, opc, asm, ZPR64>;
1899 //===----------------------------------------------------------------------===//
1900 // SVE2 Integer Multiply-Add - Unpredicated Group
1901 //===----------------------------------------------------------------------===//
1903 class sve2_int_mla<bits<2> sz, bits<5> opc, string asm,
1904 ZPRRegOp zprty1, ZPRRegOp zprty2>
1905 : I<(outs zprty1:$Zda), (ins zprty1:$_Zda, zprty2:$Zn, zprty2:$Zm),
1906 asm, "\t$Zda, $Zn, $Zm", "", []>, Sched<[]> {
1910 let Inst{31-24} = 0b01000100;
1911 let Inst{23-22} = sz;
1913 let Inst{20-16} = Zm;
1915 let Inst{14-10} = opc;
1917 let Inst{4-0} = Zda;
1919 let Constraints = "$Zda = $_Zda";
1920 let DestructiveInstType = Destructive;
1921 let ElementSize = ElementSizeNone;
1924 multiclass sve2_int_mla<bit S, string asm> {
1925 def _B : sve2_int_mla<0b00, { 0b1110, S }, asm, ZPR8, ZPR8>;
1926 def _H : sve2_int_mla<0b01, { 0b1110, S }, asm, ZPR16, ZPR16>;
1927 def _S : sve2_int_mla<0b10, { 0b1110, S }, asm, ZPR32, ZPR32>;
1928 def _D : sve2_int_mla<0b11, { 0b1110, S }, asm, ZPR64, ZPR64>;
1931 multiclass sve2_int_mla_long<bits<5> opc, string asm> {
1932 def _H : sve2_int_mla<0b01, opc, asm, ZPR16, ZPR8>;
1933 def _S : sve2_int_mla<0b10, opc, asm, ZPR32, ZPR16>;
1934 def _D : sve2_int_mla<0b11, opc, asm, ZPR64, ZPR32>;
1937 //===----------------------------------------------------------------------===//
1938 // SVE2 Integer Multiply-Add - Indexed Group
1939 //===----------------------------------------------------------------------===//
1941 class sve2_int_mla_by_indexed_elem<bits<2> sz, bits<6> opc, string asm,
1942 ZPRRegOp zprty1, ZPRRegOp zprty2,
1943 ZPRRegOp zprty3, Operand itype>
1944 : I<(outs zprty1:$Zda), (ins zprty1:$_Zda, zprty2:$Zn, zprty3:$Zm, itype:$iop),
1945 asm, "\t$Zda, $Zn, $Zm$iop", "", []>, Sched<[]> {
1948 let Inst{31-24} = 0b01000100;
1949 let Inst{23-22} = sz;
1951 let Inst{15-10} = opc;
1953 let Inst{4-0} = Zda;
1955 let Constraints = "$Zda = $_Zda";
1956 let DestructiveInstType = Destructive;
1957 let ElementSize = ElementSizeNone;
1960 multiclass sve2_int_mla_by_indexed_elem<bits<2> opc, bit S, string asm> {
1961 def _H : sve2_int_mla_by_indexed_elem<{0, ?}, { 0b000, opc, S }, asm, ZPR16, ZPR16, ZPR3b16, VectorIndexH> {
1964 let Inst{22} = iop{2};
1965 let Inst{20-19} = iop{1-0};
1966 let Inst{18-16} = Zm;
1968 def _S : sve2_int_mla_by_indexed_elem<0b10, { 0b000, opc, S }, asm, ZPR32, ZPR32, ZPR3b32, VectorIndexS> {
1971 let Inst{20-19} = iop;
1972 let Inst{18-16} = Zm;
1974 def _D : sve2_int_mla_by_indexed_elem<0b11, { 0b000, opc, S }, asm, ZPR64, ZPR64, ZPR4b64, VectorIndexD> {
1978 let Inst{19-16} = Zm;
1982 //===----------------------------------------------------------------------===//
1983 // SVE2 Integer Multiply-Add Long - Indexed Group
1984 //===----------------------------------------------------------------------===//
1986 multiclass sve2_int_mla_long_by_indexed_elem<bits<4> opc, string asm> {
1987 def _S : sve2_int_mla_by_indexed_elem<0b10, { opc{3}, 0b0, opc{2-1}, ?, opc{0} },
1988 asm, ZPR32, ZPR16, ZPR3b16, VectorIndexH> {
1991 let Inst{20-19} = iop{2-1};
1992 let Inst{18-16} = Zm;
1993 let Inst{11} = iop{0};
1995 def _D : sve2_int_mla_by_indexed_elem<0b11, { opc{3}, 0b0, opc{2-1}, ?, opc{0} },
1996 asm, ZPR64, ZPR32, ZPR4b32, VectorIndexS> {
1999 let Inst{20} = iop{1};
2000 let Inst{19-16} = Zm;
2001 let Inst{11} = iop{0};
2005 //===----------------------------------------------------------------------===//
2006 // SVE Integer Dot Product Group
2007 //===----------------------------------------------------------------------===//
2009 class sve_intx_dot<bit sz, bit U, string asm, ZPRRegOp zprty1,
2011 : I<(outs zprty1:$Zda), (ins zprty1:$_Zda, zprty2:$Zn, zprty2:$Zm), asm,
2012 "\t$Zda, $Zn, $Zm", "", []>, Sched<[]> {
2016 let Inst{31-23} = 0b010001001;
2019 let Inst{20-16} = Zm;
2020 let Inst{15-11} = 0;
2023 let Inst{4-0} = Zda;
2025 let Constraints = "$Zda = $_Zda";
2026 let DestructiveInstType = Destructive;
2027 let ElementSize = zprty1.ElementSize;
2030 multiclass sve_intx_dot<bit opc, string asm> {
2031 def _S : sve_intx_dot<0b0, opc, asm, ZPR32, ZPR8>;
2032 def _D : sve_intx_dot<0b1, opc, asm, ZPR64, ZPR16>;
2035 //===----------------------------------------------------------------------===//
2036 // SVE Integer Dot Product Group - Indexed Group
2037 //===----------------------------------------------------------------------===//
2039 class sve_intx_dot_by_indexed_elem<bit sz, bit U, string asm,
2040 ZPRRegOp zprty1, ZPRRegOp zprty2,
2041 ZPRRegOp zprty3, Operand itype>
2042 : I<(outs zprty1:$Zda), (ins zprty1:$_Zda, zprty2:$Zn, zprty3:$Zm, itype:$iop),
2043 asm, "\t$Zda, $Zn, $Zm$iop",
2044 "", []>, Sched<[]> {
2047 let Inst{31-23} = 0b010001001;
2050 let Inst{15-11} = 0;
2053 let Inst{4-0} = Zda;
2055 let Constraints = "$Zda = $_Zda";
2056 let DestructiveInstType = Destructive;
2057 let ElementSize = ElementSizeNone;
2060 multiclass sve_intx_dot_by_indexed_elem<bit opc, string asm> {
2061 def _S : sve_intx_dot_by_indexed_elem<0b0, opc, asm, ZPR32, ZPR8, ZPR3b8, VectorIndexS> {
2064 let Inst{20-19} = iop;
2065 let Inst{18-16} = Zm;
2067 def _D : sve_intx_dot_by_indexed_elem<0b1, opc, asm, ZPR64, ZPR16, ZPR4b16, VectorIndexD> {
2071 let Inst{19-16} = Zm;
2075 //===----------------------------------------------------------------------===//
2076 // SVE2 Complex Integer Dot Product Group
2077 //===----------------------------------------------------------------------===//
2079 class sve2_complex_int_arith<bits<2> sz, bits<4> opc, string asm,
2080 ZPRRegOp zprty1, ZPRRegOp zprty2>
2081 : I<(outs zprty1:$Zda), (ins zprty1:$_Zda, zprty2:$Zn, zprty2:$Zm,
2082 complexrotateop:$rot),
2083 asm, "\t$Zda, $Zn, $Zm, $rot", "", []>, Sched<[]> {
2088 let Inst{31-24} = 0b01000100;
2089 let Inst{23-22} = sz;
2091 let Inst{20-16} = Zm;
2092 let Inst{15-12} = opc;
2093 let Inst{11-10} = rot;
2095 let Inst{4-0} = Zda;
2097 let Constraints = "$Zda = $_Zda";
2098 let DestructiveInstType = Destructive;
2099 let ElementSize = ElementSizeNone;
2102 multiclass sve2_cintx_dot<string asm> {
2103 def _S : sve2_complex_int_arith<0b10, 0b0001, asm, ZPR32, ZPR8>;
2104 def _D : sve2_complex_int_arith<0b11, 0b0001, asm, ZPR64, ZPR16>;
2107 //===----------------------------------------------------------------------===//
2108 // SVE2 Complex Multiply-Add Group
2109 //===----------------------------------------------------------------------===//
2111 multiclass sve2_int_cmla<bit opc, string asm> {
2112 def _B : sve2_complex_int_arith<0b00, { 0b001, opc }, asm, ZPR8, ZPR8>;
2113 def _H : sve2_complex_int_arith<0b01, { 0b001, opc }, asm, ZPR16, ZPR16>;
2114 def _S : sve2_complex_int_arith<0b10, { 0b001, opc }, asm, ZPR32, ZPR32>;
2115 def _D : sve2_complex_int_arith<0b11, { 0b001, opc }, asm, ZPR64, ZPR64>;
2118 //===----------------------------------------------------------------------===//
2119 // SVE2 Complex Integer Dot Product - Indexed Group
2120 //===----------------------------------------------------------------------===//
2122 class sve2_complex_int_arith_indexed<bits<2> sz, bits<4> opc, string asm,
2123 ZPRRegOp zprty1, ZPRRegOp zprty2,
2124 ZPRRegOp zprty3, Operand itype>
2125 : I<(outs zprty1:$Zda), (ins zprty1:$_Zda, zprty2:$Zn, zprty3:$Zm, itype:$iop,
2126 complexrotateop:$rot),
2127 asm, "\t$Zda, $Zn, $Zm$iop, $rot", "", []>, Sched<[]> {
2131 let Inst{31-24} = 0b01000100;
2132 let Inst{23-22} = sz;
2134 let Inst{15-12} = opc;
2135 let Inst{11-10} = rot;
2137 let Inst{4-0} = Zda;
2139 let Constraints = "$Zda = $_Zda";
2140 let DestructiveInstType = Destructive;
2141 let ElementSize = ElementSizeNone;
2144 multiclass sve2_cintx_dot_by_indexed_elem<string asm> {
2145 def _S : sve2_complex_int_arith_indexed<0b10, 0b0100, asm, ZPR32, ZPR8, ZPR3b8, VectorIndexS> {
2148 let Inst{20-19} = iop;
2149 let Inst{18-16} = Zm;
2151 def _D : sve2_complex_int_arith_indexed<0b11, 0b0100, asm, ZPR64, ZPR16, ZPR4b16, VectorIndexD> {
2155 let Inst{19-16} = Zm;
2159 //===----------------------------------------------------------------------===//
2160 // SVE2 Complex Multiply-Add - Indexed Group
2161 //===----------------------------------------------------------------------===//
2163 multiclass sve2_cmla_by_indexed_elem<bit opc, string asm> {
2164 def _H : sve2_complex_int_arith_indexed<0b10, { 0b011, opc }, asm, ZPR16, ZPR16, ZPR3b16, VectorIndexS> {
2167 let Inst{20-19} = iop;
2168 let Inst{18-16} = Zm;
2170 def _S : sve2_complex_int_arith_indexed<0b11, { 0b011, opc }, asm, ZPR32, ZPR32, ZPR4b32, VectorIndexD> {
2174 let Inst{19-16} = Zm;
2178 //===----------------------------------------------------------------------===//
2179 // SVE2 Integer Multiply - Unpredicated Group
2180 //===----------------------------------------------------------------------===//
2182 class sve2_int_mul<bits<2> sz, bits<3> opc, string asm, ZPRRegOp zprty>
2183 : I<(outs zprty:$Zd), (ins zprty:$Zn, zprty:$Zm),
2184 asm, "\t$Zd, $Zn, $Zm", "", []>, Sched<[]> {
2188 let Inst{31-24} = 0b00000100;
2189 let Inst{23-22} = sz;
2191 let Inst{20-16} = Zm;
2192 let Inst{15-13} = 0b011;
2193 let Inst{12-10} = opc;
2198 multiclass sve2_int_mul<bits<3> opc, string asm> {
2199 def _B : sve2_int_mul<0b00, opc, asm, ZPR8>;
2200 def _H : sve2_int_mul<0b01, opc, asm, ZPR16>;
2201 def _S : sve2_int_mul<0b10, opc, asm, ZPR32>;
2202 def _D : sve2_int_mul<0b11, opc, asm, ZPR64>;
2205 //===----------------------------------------------------------------------===//
2206 // SVE2 Integer Multiply - Indexed Group
2207 //===----------------------------------------------------------------------===//
2209 class sve2_int_mul_by_indexed_elem<bits<2> sz, bits<4> opc, string asm,
2210 ZPRRegOp zprty1, ZPRRegOp zprty2,
2211 ZPRRegOp zprty3, Operand itype>
2212 : I<(outs zprty1:$Zd), (ins zprty2:$Zn, zprty3:$Zm, itype:$iop),
2213 asm, "\t$Zd, $Zn, $Zm$iop", "", []>, Sched<[]> {
2216 let Inst{31-24} = 0b01000100;
2217 let Inst{23-22} = sz;
2219 let Inst{15-14} = 0b11;
2220 let Inst{13-10} = opc;
2225 multiclass sve2_int_mul_by_indexed_elem<bits<4> opc, string asm> {
2226 def _H : sve2_int_mul_by_indexed_elem<{0, ?}, opc, asm, ZPR16, ZPR16, ZPR3b16, VectorIndexH> {
2229 let Inst{22} = iop{2};
2230 let Inst{20-19} = iop{1-0};
2231 let Inst{18-16} = Zm;
2233 def _S : sve2_int_mul_by_indexed_elem<0b10, opc, asm, ZPR32, ZPR32, ZPR3b32, VectorIndexS> {
2236 let Inst{20-19} = iop;
2237 let Inst{18-16} = Zm;
2239 def _D : sve2_int_mul_by_indexed_elem<0b11, opc, asm, ZPR64, ZPR64, ZPR4b64, VectorIndexD> {
2243 let Inst{19-16} = Zm;
2247 multiclass sve2_int_mul_long_by_indexed_elem<bits<3> opc, string asm> {
2248 def _S : sve2_int_mul_by_indexed_elem<0b10, { opc{2-1}, ?, opc{0} }, asm,
2249 ZPR32, ZPR16, ZPR3b16, VectorIndexH> {
2252 let Inst{20-19} = iop{2-1};
2253 let Inst{18-16} = Zm;
2254 let Inst{11} = iop{0};
2256 def _D : sve2_int_mul_by_indexed_elem<0b11, { opc{2-1}, ?, opc{0} }, asm,
2257 ZPR64, ZPR32, ZPR4b32, VectorIndexS> {
2260 let Inst{20} = iop{1};
2261 let Inst{19-16} = Zm;
2262 let Inst{11} = iop{0};
2266 //===----------------------------------------------------------------------===//
2267 // SVE2 Integer - Predicated Group
2268 //===----------------------------------------------------------------------===//
2270 class sve2_int_arith_pred<bits<2> sz, bits<6> opc, string asm,
2272 : I<(outs zprty:$Zdn), (ins PPR3bAny:$Pg, zprty:$_Zdn, zprty:$Zm),
2273 asm, "\t$Zdn, $Pg/m, $_Zdn, $Zm", "", []>, Sched<[]> {
2277 let Inst{31-24} = 0b01000100;
2278 let Inst{23-22} = sz;
2280 let Inst{20-16} = opc{5-1};
2281 let Inst{15-14} = 0b10;
2282 let Inst{13} = opc{0};
2283 let Inst{12-10} = Pg;
2285 let Inst{4-0} = Zdn;
2287 let Constraints = "$Zdn = $_Zdn";
2288 let DestructiveInstType = Destructive;
2289 let ElementSize = zprty.ElementSize;
2292 multiclass sve2_int_arith_pred<bits<6> opc, string asm> {
2293 def _B : sve2_int_arith_pred<0b00, opc, asm, ZPR8>;
2294 def _H : sve2_int_arith_pred<0b01, opc, asm, ZPR16>;
2295 def _S : sve2_int_arith_pred<0b10, opc, asm, ZPR32>;
2296 def _D : sve2_int_arith_pred<0b11, opc, asm, ZPR64>;
2299 class sve2_int_sadd_long_accum_pairwise<bits<2> sz, bit U, string asm,
2300 ZPRRegOp zprty1, ZPRRegOp zprty2>
2301 : I<(outs zprty1:$Zda), (ins PPR3bAny:$Pg, zprty1:$_Zda, zprty2:$Zn),
2302 asm, "\t$Zda, $Pg/m, $Zn", "", []>, Sched<[]> {
2306 let Inst{31-24} = 0b01000100;
2307 let Inst{23-22} = sz;
2308 let Inst{21-17} = 0b00010;
2310 let Inst{15-13} = 0b101;
2311 let Inst{12-10} = Pg;
2313 let Inst{4-0} = Zda;
2315 let Constraints = "$Zda = $_Zda";
2316 let DestructiveInstType = Destructive;
2317 let ElementSize = zprty1.ElementSize;
2320 multiclass sve2_int_sadd_long_accum_pairwise<bit U, string asm> {
2321 def _H : sve2_int_sadd_long_accum_pairwise<0b01, U, asm, ZPR16, ZPR8>;
2322 def _S : sve2_int_sadd_long_accum_pairwise<0b10, U, asm, ZPR32, ZPR16>;
2323 def _D : sve2_int_sadd_long_accum_pairwise<0b11, U, asm, ZPR64, ZPR32>;
2326 class sve2_int_un_pred_arit<bits<2> sz, bit Q, bits<2> opc,
2327 string asm, ZPRRegOp zprty>
2328 : I<(outs zprty:$Zd), (ins zprty:$_Zd, PPR3bAny:$Pg, zprty:$Zn),
2329 asm, "\t$Zd, $Pg/m, $Zn",
2335 let Inst{31-24} = 0b01000100;
2336 let Inst{23-22} = sz;
2337 let Inst{21-20} = 0b00;
2340 let Inst{17-16} = opc;
2341 let Inst{15-13} = 0b101;
2342 let Inst{12-10} = Pg;
2346 let Constraints = "$Zd = $_Zd";
2347 let DestructiveInstType = Destructive;
2348 let ElementSize = zprty.ElementSize;
2351 multiclass sve2_int_un_pred_arit_s<bits<3> opc, string asm> {
2352 def _S : sve2_int_un_pred_arit<0b10, opc{2}, opc{1-0}, asm, ZPR32>;
2355 multiclass sve2_int_un_pred_arit<bits<3> opc, string asm> {
2356 def _B : sve2_int_un_pred_arit<0b00, opc{2}, opc{1-0}, asm, ZPR8>;
2357 def _H : sve2_int_un_pred_arit<0b01, opc{2}, opc{1-0}, asm, ZPR16>;
2358 def _S : sve2_int_un_pred_arit<0b10, opc{2}, opc{1-0}, asm, ZPR32>;
2359 def _D : sve2_int_un_pred_arit<0b11, opc{2}, opc{1-0}, asm, ZPR64>;
2362 //===----------------------------------------------------------------------===//
2363 // SVE2 Widening Integer Arithmetic Group
2364 //===----------------------------------------------------------------------===//
2366 class sve2_wide_int_arith<bits<2> sz, bits<5> opc, string asm,
2367 ZPRRegOp zprty1, ZPRRegOp zprty2, ZPRRegOp zprty3>
2368 : I<(outs zprty1:$Zd), (ins zprty2:$Zn, zprty3:$Zm),
2369 asm, "\t$Zd, $Zn, $Zm", "", []>, Sched<[]> {
2373 let Inst{31-24} = 0b01000101;
2374 let Inst{23-22} = sz;
2376 let Inst{20-16} = Zm;
2378 let Inst{14-10} = opc;
2383 multiclass sve2_wide_int_arith_long<bits<5> opc, string asm> {
2384 def _H : sve2_wide_int_arith<0b01, opc, asm, ZPR16, ZPR8, ZPR8>;
2385 def _S : sve2_wide_int_arith<0b10, opc, asm, ZPR32, ZPR16, ZPR16>;
2386 def _D : sve2_wide_int_arith<0b11, opc, asm, ZPR64, ZPR32, ZPR32>;
2389 multiclass sve2_wide_int_arith_wide<bits<3> opc, string asm> {
2390 def _H : sve2_wide_int_arith<0b01, { 0b10, opc }, asm, ZPR16, ZPR16, ZPR8>;
2391 def _S : sve2_wide_int_arith<0b10, { 0b10, opc }, asm, ZPR32, ZPR32, ZPR16>;
2392 def _D : sve2_wide_int_arith<0b11, { 0b10, opc }, asm, ZPR64, ZPR64, ZPR32>;
2395 multiclass sve2_pmul_long<bits<1> opc, string asm> {
2396 def _H : sve2_wide_int_arith<0b01, {0b1101, opc}, asm, ZPR16, ZPR8, ZPR8>;
2397 def _D : sve2_wide_int_arith<0b11, {0b1101, opc}, asm, ZPR64, ZPR32, ZPR32>;
2400 //===----------------------------------------------------------------------===//
2402 //===----------------------------------------------------------------------===//
2404 class sve2_misc<bits<2> sz, bits<4> opc, string asm,
2405 ZPRRegOp zprty1, ZPRRegOp zprty2>
2406 : I<(outs zprty1:$Zd), (ins zprty2:$Zn, zprty2:$Zm),
2407 asm, "\t$Zd, $Zn, $Zm", "", []>, Sched<[]> {
2411 let Inst{31-24} = 0b01000101;
2412 let Inst{23-22} = sz;
2414 let Inst{20-16} = Zm;
2415 let Inst{15-14} = 0b10;
2416 let Inst{13-10} = opc;
2421 multiclass sve2_misc_bitwise<bits<4> opc, string asm> {
2422 def _B : sve2_misc<0b00, opc, asm, ZPR8, ZPR8>;
2423 def _H : sve2_misc<0b01, opc, asm, ZPR16, ZPR16>;
2424 def _S : sve2_misc<0b10, opc, asm, ZPR32, ZPR32>;
2425 def _D : sve2_misc<0b11, opc, asm, ZPR64, ZPR64>;
2428 multiclass sve2_misc_int_addsub_long_interleaved<bits<2> opc, string asm> {
2429 def _H : sve2_misc<0b01, { 0b00, opc }, asm, ZPR16, ZPR8>;
2430 def _S : sve2_misc<0b10, { 0b00, opc }, asm, ZPR32, ZPR16>;
2431 def _D : sve2_misc<0b11, { 0b00, opc }, asm, ZPR64, ZPR32>;
2434 class sve2_bitwise_xor_interleaved<bits<2> sz, bits<1> opc, string asm,
2435 ZPRRegOp zprty1, ZPRRegOp zprty2>
2436 : I<(outs zprty1:$Zd), (ins zprty1:$_Zd, zprty2:$Zn, zprty2:$Zm),
2437 asm, "\t$Zd, $Zn, $Zm", "", []>, Sched<[]> {
2441 let Inst{31-24} = 0b01000101;
2442 let Inst{23-22} = sz;
2444 let Inst{20-16} = Zm;
2445 let Inst{15-11} = 0b10010;
2450 let Constraints = "$Zd = $_Zd";
2451 let DestructiveInstType = Destructive;
2452 let ElementSize = ElementSizeNone;
2455 multiclass sve2_bitwise_xor_interleaved<bit opc, string asm> {
2456 def _B : sve2_bitwise_xor_interleaved<0b00, opc, asm, ZPR8, ZPR8>;
2457 def _H : sve2_bitwise_xor_interleaved<0b01, opc, asm, ZPR16, ZPR16>;
2458 def _S : sve2_bitwise_xor_interleaved<0b10, opc, asm, ZPR32, ZPR32>;
2459 def _D : sve2_bitwise_xor_interleaved<0b11, opc, asm, ZPR64, ZPR64>;
2462 class sve2_bitwise_shift_left_long<bits<3> tsz8_64, bits<2> opc, string asm,
2463 ZPRRegOp zprty1, ZPRRegOp zprty2,
2465 : I<(outs zprty1:$Zd), (ins zprty2:$Zn, immtype:$imm),
2466 asm, "\t$Zd, $Zn, $imm",
2467 "", []>, Sched<[]> {
2471 let Inst{31-23} = 0b010001010;
2472 let Inst{22} = tsz8_64{2};
2474 let Inst{20-19} = tsz8_64{1-0};
2475 let Inst{18-16} = imm{2-0}; // imm3
2476 let Inst{15-12} = 0b1010;
2477 let Inst{11-10} = opc;
2482 multiclass sve2_bitwise_shift_left_long<bits<2> opc, string asm> {
2483 def _H : sve2_bitwise_shift_left_long<{0,0,1}, opc, asm,
2484 ZPR16, ZPR8, vecshiftL8>;
2485 def _S : sve2_bitwise_shift_left_long<{0,1,?}, opc, asm,
2486 ZPR32, ZPR16, vecshiftL16> {
2487 let Inst{19} = imm{3};
2489 def _D : sve2_bitwise_shift_left_long<{1,?,?}, opc, asm,
2490 ZPR64, ZPR32, vecshiftL32> {
2491 let Inst{20-19} = imm{4-3};
2495 //===----------------------------------------------------------------------===//
2496 // SVE2 Accumulate Group
2497 //===----------------------------------------------------------------------===//
2499 class sve2_int_bin_shift_imm<bits<4> tsz8_64, bit opc, string asm,
2500 ZPRRegOp zprty, Operand immtype>
2501 : I<(outs zprty:$Zd), (ins zprty:$_Zd, zprty:$Zn, immtype:$imm),
2502 asm, "\t$Zd, $Zn, $imm",
2503 "", []>, Sched<[]> {
2507 let Inst{31-24} = 0b01000101;
2508 let Inst{23-22} = tsz8_64{3-2};
2510 let Inst{20-19} = tsz8_64{1-0};
2511 let Inst{18-16} = imm{2-0}; // imm3
2512 let Inst{15-11} = 0b11110;
2517 let Constraints = "$Zd = $_Zd";
2520 multiclass sve2_int_bin_shift_imm_left<bit opc, string asm> {
2521 def _B : sve2_int_bin_shift_imm<{0,0,0,1}, opc, asm, ZPR8, vecshiftL8>;
2522 def _H : sve2_int_bin_shift_imm<{0,0,1,?}, opc, asm, ZPR16, vecshiftL16> {
2523 let Inst{19} = imm{3};
2525 def _S : sve2_int_bin_shift_imm<{0,1,?,?}, opc, asm, ZPR32, vecshiftL32> {
2526 let Inst{20-19} = imm{4-3};
2528 def _D : sve2_int_bin_shift_imm<{1,?,?,?}, opc, asm, ZPR64, vecshiftL64> {
2529 let Inst{22} = imm{5};
2530 let Inst{20-19} = imm{4-3};
2534 multiclass sve2_int_bin_shift_imm_right<bit opc, string asm> {
2535 def _B : sve2_int_bin_shift_imm<{0,0,0,1}, opc, asm, ZPR8, vecshiftR8>;
2536 def _H : sve2_int_bin_shift_imm<{0,0,1,?}, opc, asm, ZPR16, vecshiftR16> {
2537 let Inst{19} = imm{3};
2539 def _S : sve2_int_bin_shift_imm<{0,1,?,?}, opc, asm, ZPR32, vecshiftR32> {
2540 let Inst{20-19} = imm{4-3};
2542 def _D : sve2_int_bin_shift_imm<{1,?,?,?}, opc, asm, ZPR64, vecshiftR64> {
2543 let Inst{22} = imm{5};
2544 let Inst{20-19} = imm{4-3};
2548 class sve2_int_bin_accum_shift_imm<bits<4> tsz8_64, bits<2> opc, string asm,
2549 ZPRRegOp zprty, Operand immtype>
2550 : I<(outs zprty:$Zda), (ins zprty:$_Zda, zprty:$Zn, immtype:$imm),
2551 asm, "\t$Zda, $Zn, $imm",
2552 "", []>, Sched<[]> {
2556 let Inst{31-24} = 0b01000101;
2557 let Inst{23-22} = tsz8_64{3-2};
2559 let Inst{20-19} = tsz8_64{1-0};
2560 let Inst{18-16} = imm{2-0}; // imm3
2561 let Inst{15-12} = 0b1110;
2562 let Inst{11-10} = opc;
2564 let Inst{4-0} = Zda;
2566 let Constraints = "$Zda = $_Zda";
2567 let DestructiveInstType = Destructive;
2568 let ElementSize = ElementSizeNone;
2571 multiclass sve2_int_bin_accum_shift_imm_right<bits<2> opc, string asm> {
2572 def _B : sve2_int_bin_accum_shift_imm<{0,0,0,1}, opc, asm, ZPR8, vecshiftR8>;
2573 def _H : sve2_int_bin_accum_shift_imm<{0,0,1,?}, opc, asm, ZPR16, vecshiftR16> {
2574 let Inst{19} = imm{3};
2576 def _S : sve2_int_bin_accum_shift_imm<{0,1,?,?}, opc, asm, ZPR32, vecshiftR32> {
2577 let Inst{20-19} = imm{4-3};
2579 def _D : sve2_int_bin_accum_shift_imm<{1,?,?,?}, opc, asm, ZPR64, vecshiftR64> {
2580 let Inst{22} = imm{5};
2581 let Inst{20-19} = imm{4-3};
2585 class sve2_int_cadd<bits<2> sz, bit opc, string asm, ZPRRegOp zprty>
2586 : I<(outs zprty:$Zdn), (ins zprty:$_Zdn, zprty:$Zm, complexrotateopodd:$rot),
2587 asm, "\t$Zdn, $_Zdn, $Zm, $rot", "", []>, Sched<[]> {
2591 let Inst{31-24} = 0b01000101;
2592 let Inst{23-22} = sz;
2593 let Inst{21-17} = 0b00000;
2595 let Inst{15-11} = 0b11011;
2598 let Inst{4-0} = Zdn;
2600 let Constraints = "$Zdn = $_Zdn";
2601 let DestructiveInstType = Destructive;
2602 let ElementSize = ElementSizeNone;
2605 multiclass sve2_int_cadd<bit opc, string asm> {
2606 def _B : sve2_int_cadd<0b00, opc, asm, ZPR8>;
2607 def _H : sve2_int_cadd<0b01, opc, asm, ZPR16>;
2608 def _S : sve2_int_cadd<0b10, opc, asm, ZPR32>;
2609 def _D : sve2_int_cadd<0b11, opc, asm, ZPR64>;
2612 class sve2_int_absdiff_accum<bits<2> sz, bits<4> opc, string asm,
2613 ZPRRegOp zprty1, ZPRRegOp zprty2>
2614 : I<(outs zprty1:$Zda), (ins zprty1:$_Zda, zprty2:$Zn, zprty2:$Zm),
2615 asm, "\t$Zda, $Zn, $Zm", "", []>, Sched<[]> {
2619 let Inst{31-24} = 0b01000101;
2620 let Inst{23-22} = sz;
2622 let Inst{20-16} = Zm;
2623 let Inst{15-14} = 0b11;
2624 let Inst{13-10} = opc;
2626 let Inst{4-0} = Zda;
2628 let Constraints = "$Zda = $_Zda";
2629 let DestructiveInstType = Destructive;
2630 let ElementSize = ElementSizeNone;
2633 multiclass sve2_int_absdiff_accum<bit opc, string asm> {
2634 def _B : sve2_int_absdiff_accum<0b00, { 0b111, opc }, asm, ZPR8, ZPR8>;
2635 def _H : sve2_int_absdiff_accum<0b01, { 0b111, opc }, asm, ZPR16, ZPR16>;
2636 def _S : sve2_int_absdiff_accum<0b10, { 0b111, opc }, asm, ZPR32, ZPR32>;
2637 def _D : sve2_int_absdiff_accum<0b11, { 0b111, opc }, asm, ZPR64, ZPR64>;
2640 multiclass sve2_int_absdiff_accum_long<bits<2> opc, string asm> {
2641 def _H : sve2_int_absdiff_accum<0b01, { 0b00, opc }, asm, ZPR16, ZPR8>;
2642 def _S : sve2_int_absdiff_accum<0b10, { 0b00, opc }, asm, ZPR32, ZPR16>;
2643 def _D : sve2_int_absdiff_accum<0b11, { 0b00, opc }, asm, ZPR64, ZPR32>;
2646 multiclass sve2_int_addsub_long_carry<bits<2> opc, string asm> {
2647 def _S : sve2_int_absdiff_accum<{ opc{1}, 0b0 }, { 0b010, opc{0} }, asm,
2649 def _D : sve2_int_absdiff_accum<{ opc{1}, 0b1 }, { 0b010, opc{0} }, asm,
2653 //===----------------------------------------------------------------------===//
2654 // SVE2 Narrowing Group
2655 //===----------------------------------------------------------------------===//
2657 class sve2_int_bin_shift_imm_narrow_bottom<bits<3> tsz8_64, bits<3> opc,
2658 string asm, ZPRRegOp zprty1,
2659 ZPRRegOp zprty2, Operand immtype>
2660 : I<(outs zprty1:$Zd), (ins zprty2:$Zn, immtype:$imm),
2661 asm, "\t$Zd, $Zn, $imm",
2662 "", []>, Sched<[]> {
2666 let Inst{31-23} = 0b010001010;
2667 let Inst{22} = tsz8_64{2};
2669 let Inst{20-19} = tsz8_64{1-0};
2670 let Inst{18-16} = imm{2-0}; // imm3
2671 let Inst{15-14} = 0b00;
2672 let Inst{13-11} = opc;
2678 multiclass sve2_int_bin_shift_imm_right_narrow_bottom<bits<3> opc, string asm> {
2679 def _B : sve2_int_bin_shift_imm_narrow_bottom<{0,0,1}, opc, asm, ZPR8, ZPR16,
2681 def _H : sve2_int_bin_shift_imm_narrow_bottom<{0,1,?}, opc, asm, ZPR16, ZPR32,
2683 let Inst{19} = imm{3};
2685 def _S : sve2_int_bin_shift_imm_narrow_bottom<{1,?,?}, opc, asm, ZPR32, ZPR64,
2687 let Inst{20-19} = imm{4-3};
2691 class sve2_int_bin_shift_imm_narrow_top<bits<3> tsz8_64, bits<3> opc,
2692 string asm, ZPRRegOp zprty1,
2693 ZPRRegOp zprty2, Operand immtype>
2694 : I<(outs zprty1:$Zd), (ins zprty1:$_Zd, zprty2:$Zn, immtype:$imm),
2695 asm, "\t$Zd, $Zn, $imm",
2696 "", []>, Sched<[]> {
2700 let Inst{31-23} = 0b010001010;
2701 let Inst{22} = tsz8_64{2};
2703 let Inst{20-19} = tsz8_64{1-0};
2704 let Inst{18-16} = imm{2-0}; // imm3
2705 let Inst{15-14} = 0b00;
2706 let Inst{13-11} = opc;
2711 let Constraints = "$Zd = $_Zd";
2714 multiclass sve2_int_bin_shift_imm_right_narrow_top<bits<3> opc, string asm> {
2715 def _B : sve2_int_bin_shift_imm_narrow_top<{0,0,1}, opc, asm, ZPR8, ZPR16,
2717 def _H : sve2_int_bin_shift_imm_narrow_top<{0,1,?}, opc, asm, ZPR16, ZPR32,
2719 let Inst{19} = imm{3};
2721 def _S : sve2_int_bin_shift_imm_narrow_top<{1,?,?}, opc, asm, ZPR32, ZPR64,
2723 let Inst{20-19} = imm{4-3};
2727 class sve2_int_addsub_narrow_high_bottom<bits<2> sz, bits<2> opc, string asm,
2728 ZPRRegOp zprty1, ZPRRegOp zprty2>
2729 : I<(outs zprty1:$Zd), (ins zprty2:$Zn, zprty2:$Zm),
2730 asm, "\t$Zd, $Zn, $Zm", "", []>, Sched<[]> {
2734 let Inst{31-24} = 0b01000101;
2735 let Inst{23-22} = sz;
2737 let Inst{20-16} = Zm;
2738 let Inst{15-13} = 0b011;
2739 let Inst{12-11} = opc; // S, R
2740 let Inst{10} = 0b0; // Top
2745 multiclass sve2_int_addsub_narrow_high_bottom<bits<2> opc, string asm> {
2746 def _B : sve2_int_addsub_narrow_high_bottom<0b01, opc, asm, ZPR8, ZPR16>;
2747 def _H : sve2_int_addsub_narrow_high_bottom<0b10, opc, asm, ZPR16, ZPR32>;
2748 def _S : sve2_int_addsub_narrow_high_bottom<0b11, opc, asm, ZPR32, ZPR64>;
2751 class sve2_int_addsub_narrow_high_top<bits<2> sz, bits<2> opc, string asm,
2752 ZPRRegOp zprty1, ZPRRegOp zprty2>
2753 : I<(outs zprty1:$Zd), (ins zprty1:$_Zd, zprty2:$Zn, zprty2:$Zm),
2754 asm, "\t$Zd, $Zn, $Zm", "", []>, Sched<[]> {
2758 let Inst{31-24} = 0b01000101;
2759 let Inst{23-22} = sz;
2761 let Inst{20-16} = Zm;
2762 let Inst{15-13} = 0b011;
2763 let Inst{12-11} = opc; // S, R
2764 let Inst{10} = 0b1; // Top
2768 let Constraints = "$Zd = $_Zd";
2771 multiclass sve2_int_addsub_narrow_high_top<bits<2> opc, string asm> {
2772 def _B : sve2_int_addsub_narrow_high_top<0b01, opc, asm, ZPR8, ZPR16>;
2773 def _H : sve2_int_addsub_narrow_high_top<0b10, opc, asm, ZPR16, ZPR32>;
2774 def _S : sve2_int_addsub_narrow_high_top<0b11, opc, asm, ZPR32, ZPR64>;
2777 class sve2_int_sat_extract_narrow_bottom<bits<3> tsz8_64, bits<2> opc, string asm,
2778 ZPRRegOp zprty1, ZPRRegOp zprty2>
2779 : I<(outs zprty1:$Zd), (ins zprty2:$Zn),
2780 asm, "\t$Zd, $Zn", "", []>, Sched<[]> {
2783 let Inst{31-23} = 0b010001010;
2784 let Inst{22} = tsz8_64{2};
2786 let Inst{20-19} = tsz8_64{1-0};
2787 let Inst{18-13} = 0b000010;
2788 let Inst{12-11} = opc;
2794 multiclass sve2_int_sat_extract_narrow_bottom<bits<2> opc, string asm> {
2795 def _B : sve2_int_sat_extract_narrow_bottom<0b001, opc, asm, ZPR8, ZPR16>;
2796 def _H : sve2_int_sat_extract_narrow_bottom<0b010, opc, asm, ZPR16, ZPR32>;
2797 def _S : sve2_int_sat_extract_narrow_bottom<0b100, opc, asm, ZPR32, ZPR64>;
2800 class sve2_int_sat_extract_narrow_top<bits<3> tsz8_64, bits<2> opc, string asm,
2801 ZPRRegOp zprty1, ZPRRegOp zprty2>
2802 : I<(outs zprty1:$Zd), (ins zprty1:$_Zd, zprty2:$Zn),
2803 asm, "\t$Zd, $Zn", "", []>, Sched<[]> {
2806 let Inst{31-23} = 0b010001010;
2807 let Inst{22} = tsz8_64{2};
2809 let Inst{20-19} = tsz8_64{1-0};
2810 let Inst{18-13} = 0b000010;
2811 let Inst{12-11} = opc;
2816 let Constraints = "$Zd = $_Zd";
2819 multiclass sve2_int_sat_extract_narrow_top<bits<2> opc, string asm> {
2820 def _B : sve2_int_sat_extract_narrow_top<0b001, opc, asm, ZPR8, ZPR16>;
2821 def _H : sve2_int_sat_extract_narrow_top<0b010, opc, asm, ZPR16, ZPR32>;
2822 def _S : sve2_int_sat_extract_narrow_top<0b100, opc, asm, ZPR32, ZPR64>;
2825 //===----------------------------------------------------------------------===//
2826 // SVE Integer Arithmetic - Unary Predicated Group
2827 //===----------------------------------------------------------------------===//
2829 class sve_int_un_pred_arit<bits<2> sz8_64, bits<4> opc,
2830 string asm, ZPRRegOp zprty>
2831 : I<(outs zprty:$Zd), (ins zprty:$_Zd, PPR3bAny:$Pg, zprty:$Zn),
2832 asm, "\t$Zd, $Pg/m, $Zn",
2838 let Inst{31-24} = 0b00000100;
2839 let Inst{23-22} = sz8_64;
2840 let Inst{21-20} = 0b01;
2841 let Inst{19} = opc{0};
2842 let Inst{18-16} = opc{3-1};
2843 let Inst{15-13} = 0b101;
2844 let Inst{12-10} = Pg;
2848 let Constraints = "$Zd = $_Zd";
2849 let DestructiveInstType = Destructive;
2850 let ElementSize = zprty.ElementSize;
2853 multiclass sve_int_un_pred_arit_0<bits<3> opc, string asm,
2854 SDPatternOperator op> {
2855 def _B : sve_int_un_pred_arit<0b00, { opc, 0b0 }, asm, ZPR8>;
2856 def _H : sve_int_un_pred_arit<0b01, { opc, 0b0 }, asm, ZPR16>;
2857 def _S : sve_int_un_pred_arit<0b10, { opc, 0b0 }, asm, ZPR32>;
2858 def _D : sve_int_un_pred_arit<0b11, { opc, 0b0 }, asm, ZPR64>;
2860 def : SVE_3_Op_Pat<nxv16i8, op, nxv16i8, nxv16i1, nxv16i8, !cast<Instruction>(NAME # _B)>;
2861 def : SVE_3_Op_Pat<nxv8i16, op, nxv8i16, nxv8i1, nxv8i16, !cast<Instruction>(NAME # _H)>;
2862 def : SVE_3_Op_Pat<nxv4i32, op, nxv4i32, nxv4i1, nxv4i32, !cast<Instruction>(NAME # _S)>;
2863 def : SVE_3_Op_Pat<nxv2i64, op, nxv2i64, nxv2i1, nxv2i64, !cast<Instruction>(NAME # _D)>;
2866 multiclass sve_int_un_pred_arit_0_h<bits<3> opc, string asm> {
2867 def _H : sve_int_un_pred_arit<0b01, { opc, 0b0 }, asm, ZPR16>;
2868 def _S : sve_int_un_pred_arit<0b10, { opc, 0b0 }, asm, ZPR32>;
2869 def _D : sve_int_un_pred_arit<0b11, { opc, 0b0 }, asm, ZPR64>;
2872 multiclass sve_int_un_pred_arit_0_w<bits<3> opc, string asm> {
2873 def _S : sve_int_un_pred_arit<0b10, { opc, 0b0 }, asm, ZPR32>;
2874 def _D : sve_int_un_pred_arit<0b11, { opc, 0b0 }, asm, ZPR64>;
2877 multiclass sve_int_un_pred_arit_0_d<bits<3> opc, string asm> {
2878 def _D : sve_int_un_pred_arit<0b11, { opc, 0b0 }, asm, ZPR64>;
2881 multiclass sve_int_un_pred_arit_1<bits<3> opc, string asm,
2882 SDPatternOperator op> {
2883 def _B : sve_int_un_pred_arit<0b00, { opc, 0b1 }, asm, ZPR8>;
2884 def _H : sve_int_un_pred_arit<0b01, { opc, 0b1 }, asm, ZPR16>;
2885 def _S : sve_int_un_pred_arit<0b10, { opc, 0b1 }, asm, ZPR32>;
2886 def _D : sve_int_un_pred_arit<0b11, { opc, 0b1 }, asm, ZPR64>;
2888 def : SVE_3_Op_Pat<nxv16i8, op, nxv16i8, nxv16i1, nxv16i8, !cast<Instruction>(NAME # _B)>;
2889 def : SVE_3_Op_Pat<nxv8i16, op, nxv8i16, nxv8i1, nxv8i16, !cast<Instruction>(NAME # _H)>;
2890 def : SVE_3_Op_Pat<nxv4i32, op, nxv4i32, nxv4i1, nxv4i32, !cast<Instruction>(NAME # _S)>;
2891 def : SVE_3_Op_Pat<nxv2i64, op, nxv2i64, nxv2i1, nxv2i64, !cast<Instruction>(NAME # _D)>;
2893 def : SVE_3_Op_Pat<nxv8i16, op, nxv8i16, nxv8i1, nxv8f16, !cast<Instruction>(NAME # _H)>;
2894 def : SVE_3_Op_Pat<nxv4i32, op, nxv4i32, nxv4i1, nxv4f32, !cast<Instruction>(NAME # _S)>;
2895 def : SVE_3_Op_Pat<nxv2i64, op, nxv2i64, nxv2i1, nxv2f64, !cast<Instruction>(NAME # _D)>;
2898 multiclass sve_int_un_pred_arit_1_fp<bits<3> opc, string asm> {
2899 def _H : sve_int_un_pred_arit<0b01, { opc, 0b1 }, asm, ZPR16>;
2900 def _S : sve_int_un_pred_arit<0b10, { opc, 0b1 }, asm, ZPR32>;
2901 def _D : sve_int_un_pred_arit<0b11, { opc, 0b1 }, asm, ZPR64>;
2904 //===----------------------------------------------------------------------===//
2905 // SVE Integer Wide Immediate - Unpredicated Group
2906 //===----------------------------------------------------------------------===//
2907 class sve_int_dup_imm<bits<2> sz8_64, string asm,
2908 ZPRRegOp zprty, Operand immtype>
2909 : I<(outs zprty:$Zd), (ins immtype:$imm),
2915 let Inst{31-24} = 0b00100101;
2916 let Inst{23-22} = sz8_64;
2917 let Inst{21-14} = 0b11100011;
2918 let Inst{13} = imm{8}; // sh
2919 let Inst{12-5} = imm{7-0}; // imm8
2922 let isReMaterializable = 1;
2925 multiclass sve_int_dup_imm<string asm> {
2926 def _B : sve_int_dup_imm<0b00, asm, ZPR8, cpy_imm8_opt_lsl_i8>;
2927 def _H : sve_int_dup_imm<0b01, asm, ZPR16, cpy_imm8_opt_lsl_i16>;
2928 def _S : sve_int_dup_imm<0b10, asm, ZPR32, cpy_imm8_opt_lsl_i32>;
2929 def _D : sve_int_dup_imm<0b11, asm, ZPR64, cpy_imm8_opt_lsl_i64>;
2931 def : InstAlias<"mov $Zd, $imm",
2932 (!cast<Instruction>(NAME # _B) ZPR8:$Zd, cpy_imm8_opt_lsl_i8:$imm), 1>;
2933 def : InstAlias<"mov $Zd, $imm",
2934 (!cast<Instruction>(NAME # _H) ZPR16:$Zd, cpy_imm8_opt_lsl_i16:$imm), 1>;
2935 def : InstAlias<"mov $Zd, $imm",
2936 (!cast<Instruction>(NAME # _S) ZPR32:$Zd, cpy_imm8_opt_lsl_i32:$imm), 1>;
2937 def : InstAlias<"mov $Zd, $imm",
2938 (!cast<Instruction>(NAME # _D) ZPR64:$Zd, cpy_imm8_opt_lsl_i64:$imm), 1>;
2940 def : InstAlias<"fmov $Zd, #0.0",
2941 (!cast<Instruction>(NAME # _H) ZPR16:$Zd, 0, 0), 1>;
2942 def : InstAlias<"fmov $Zd, #0.0",
2943 (!cast<Instruction>(NAME # _S) ZPR32:$Zd, 0, 0), 1>;
2944 def : InstAlias<"fmov $Zd, #0.0",
2945 (!cast<Instruction>(NAME # _D) ZPR64:$Zd, 0, 0), 1>;
2948 class sve_int_dup_fpimm<bits<2> sz8_64, Operand fpimmtype,
2949 string asm, ZPRRegOp zprty>
2950 : I<(outs zprty:$Zd), (ins fpimmtype:$imm8),
2951 asm, "\t$Zd, $imm8",
2956 let Inst{31-24} = 0b00100101;
2957 let Inst{23-22} = sz8_64;
2958 let Inst{21-14} = 0b11100111;
2960 let Inst{12-5} = imm8;
2963 let isReMaterializable = 1;
2966 multiclass sve_int_dup_fpimm<string asm> {
2967 def _H : sve_int_dup_fpimm<0b01, fpimm16, asm, ZPR16>;
2968 def _S : sve_int_dup_fpimm<0b10, fpimm32, asm, ZPR32>;
2969 def _D : sve_int_dup_fpimm<0b11, fpimm64, asm, ZPR64>;
2971 def : InstAlias<"fmov $Zd, $imm8",
2972 (!cast<Instruction>(NAME # _H) ZPR16:$Zd, fpimm16:$imm8), 1>;
2973 def : InstAlias<"fmov $Zd, $imm8",
2974 (!cast<Instruction>(NAME # _S) ZPR32:$Zd, fpimm32:$imm8), 1>;
2975 def : InstAlias<"fmov $Zd, $imm8",
2976 (!cast<Instruction>(NAME # _D) ZPR64:$Zd, fpimm64:$imm8), 1>;
2979 class sve_int_arith_imm0<bits<2> sz8_64, bits<3> opc, string asm,
2980 ZPRRegOp zprty, Operand immtype>
2981 : I<(outs zprty:$Zdn), (ins zprty:$_Zdn, immtype:$imm),
2982 asm, "\t$Zdn, $_Zdn, $imm",
2987 let Inst{31-24} = 0b00100101;
2988 let Inst{23-22} = sz8_64;
2989 let Inst{21-19} = 0b100;
2990 let Inst{18-16} = opc;
2991 let Inst{15-14} = 0b11;
2992 let Inst{13} = imm{8}; // sh
2993 let Inst{12-5} = imm{7-0}; // imm8
2994 let Inst{4-0} = Zdn;
2996 let Constraints = "$Zdn = $_Zdn";
2997 let DestructiveInstType = Destructive;
2998 let ElementSize = ElementSizeNone;
3001 multiclass sve_int_arith_imm0<bits<3> opc, string asm> {
3002 def _B : sve_int_arith_imm0<0b00, opc, asm, ZPR8, addsub_imm8_opt_lsl_i8>;
3003 def _H : sve_int_arith_imm0<0b01, opc, asm, ZPR16, addsub_imm8_opt_lsl_i16>;
3004 def _S : sve_int_arith_imm0<0b10, opc, asm, ZPR32, addsub_imm8_opt_lsl_i32>;
3005 def _D : sve_int_arith_imm0<0b11, opc, asm, ZPR64, addsub_imm8_opt_lsl_i64>;
3008 class sve_int_arith_imm<bits<2> sz8_64, bits<6> opc, string asm,
3009 ZPRRegOp zprty, Operand immtype>
3010 : I<(outs zprty:$Zdn), (ins zprty:$_Zdn, immtype:$imm),
3011 asm, "\t$Zdn, $_Zdn, $imm",
3016 let Inst{31-24} = 0b00100101;
3017 let Inst{23-22} = sz8_64;
3018 let Inst{21-16} = opc;
3019 let Inst{15-13} = 0b110;
3020 let Inst{12-5} = imm;
3021 let Inst{4-0} = Zdn;
3023 let Constraints = "$Zdn = $_Zdn";
3024 let DestructiveInstType = Destructive;
3025 let ElementSize = ElementSizeNone;
3028 multiclass sve_int_arith_imm1<bits<2> opc, string asm, Operand immtype> {
3029 def _B : sve_int_arith_imm<0b00, { 0b1010, opc }, asm, ZPR8, immtype>;
3030 def _H : sve_int_arith_imm<0b01, { 0b1010, opc }, asm, ZPR16, immtype>;
3031 def _S : sve_int_arith_imm<0b10, { 0b1010, opc }, asm, ZPR32, immtype>;
3032 def _D : sve_int_arith_imm<0b11, { 0b1010, opc }, asm, ZPR64, immtype>;
3035 multiclass sve_int_arith_imm2<string asm> {
3036 def _B : sve_int_arith_imm<0b00, 0b110000, asm, ZPR8, simm8>;
3037 def _H : sve_int_arith_imm<0b01, 0b110000, asm, ZPR16, simm8>;
3038 def _S : sve_int_arith_imm<0b10, 0b110000, asm, ZPR32, simm8>;
3039 def _D : sve_int_arith_imm<0b11, 0b110000, asm, ZPR64, simm8>;
3042 //===----------------------------------------------------------------------===//
3043 // SVE Bitwise Logical - Unpredicated Group
3044 //===----------------------------------------------------------------------===//
3046 class sve_int_bin_cons_log<bits<2> opc, string asm>
3047 : I<(outs ZPR64:$Zd), (ins ZPR64:$Zn, ZPR64:$Zm),
3048 asm, "\t$Zd, $Zn, $Zm",
3054 let Inst{31-24} = 0b00000100;
3055 let Inst{23-22} = opc{1-0};
3057 let Inst{20-16} = Zm;
3058 let Inst{15-10} = 0b001100;
3063 multiclass sve_int_bin_cons_log<bits<2> opc, string asm> {
3064 def NAME : sve_int_bin_cons_log<opc, asm>;
3066 def : InstAlias<asm # "\t$Zd, $Zn, $Zm",
3067 (!cast<Instruction>(NAME) ZPR8:$Zd, ZPR8:$Zn, ZPR8:$Zm), 1>;
3068 def : InstAlias<asm # "\t$Zd, $Zn, $Zm",
3069 (!cast<Instruction>(NAME) ZPR16:$Zd, ZPR16:$Zn, ZPR16:$Zm), 1>;
3070 def : InstAlias<asm # "\t$Zd, $Zn, $Zm",
3071 (!cast<Instruction>(NAME) ZPR32:$Zd, ZPR32:$Zn, ZPR32:$Zm), 1>;
3074 class sve2_int_bitwise_ternary_op_d<bits<3> opc, string asm>
3075 : I<(outs ZPR64:$Zdn), (ins ZPR64:$_Zdn, ZPR64:$Zm, ZPR64:$Zk),
3076 asm, "\t$Zdn, $_Zdn, $Zm, $Zk",
3082 let Inst{31-24} = 0b00000100;
3083 let Inst{23-22} = opc{2-1};
3085 let Inst{20-16} = Zm;
3086 let Inst{15-11} = 0b00111;
3087 let Inst{10} = opc{0};
3089 let Inst{4-0} = Zdn;
3091 let Constraints = "$Zdn = $_Zdn";
3092 let DestructiveInstType = Destructive;
3093 let ElementSize = ElementSizeNone;
3096 multiclass sve2_int_bitwise_ternary_op<bits<3> opc, string asm> {
3097 def NAME : sve2_int_bitwise_ternary_op_d<opc, asm>;
3099 def : InstAlias<asm # "\t$Zdn, $Zdn, $Zm, $Zk",
3100 (!cast<Instruction>(NAME) ZPR8:$Zdn, ZPR8:$Zm, ZPR8:$Zk), 1>;
3101 def : InstAlias<asm # "\t$Zdn, $Zdn, $Zm, $Zk",
3102 (!cast<Instruction>(NAME) ZPR16:$Zdn, ZPR16:$Zm, ZPR16:$Zk), 1>;
3103 def : InstAlias<asm # "\t$Zdn, $Zdn, $Zm, $Zk",
3104 (!cast<Instruction>(NAME) ZPR32:$Zdn, ZPR32:$Zm, ZPR32:$Zk), 1>;
3107 class sve2_int_rotate_right_imm<bits<4> tsz8_64, string asm,
3108 ZPRRegOp zprty, Operand immtype>
3109 : I<(outs zprty:$Zdn), (ins zprty:$_Zdn, zprty:$Zm, immtype:$imm),
3110 asm, "\t$Zdn, $_Zdn, $Zm, $imm",
3116 let Inst{31-24} = 0b00000100;
3117 let Inst{23-22} = tsz8_64{3-2};
3119 let Inst{20-19} = tsz8_64{1-0};
3120 let Inst{18-16} = imm{2-0}; // imm3
3121 let Inst{15-10} = 0b001101;
3123 let Inst{4-0} = Zdn;
3125 let Constraints = "$Zdn = $_Zdn";
3126 let DestructiveInstType = Destructive;
3127 let ElementSize = ElementSizeNone;
3130 multiclass sve2_int_rotate_right_imm<string asm> {
3131 def _B : sve2_int_rotate_right_imm<{0,0,0,1}, asm, ZPR8, vecshiftR8>;
3132 def _H : sve2_int_rotate_right_imm<{0,0,1,?}, asm, ZPR16, vecshiftR16> {
3133 let Inst{19} = imm{3};
3135 def _S : sve2_int_rotate_right_imm<{0,1,?,?}, asm, ZPR32, vecshiftR32> {
3136 let Inst{20-19} = imm{4-3};
3138 def _D : sve2_int_rotate_right_imm<{1,?,?,?}, asm, ZPR64, vecshiftR64> {
3139 let Inst{22} = imm{5};
3140 let Inst{20-19} = imm{4-3};
3144 //===----------------------------------------------------------------------===//
3145 // SVE Integer Wide Immediate - Predicated Group
3146 //===----------------------------------------------------------------------===//
3148 class sve_int_dup_fpimm_pred<bits<2> sz, Operand fpimmtype,
3149 string asm, ZPRRegOp zprty>
3150 : I<(outs zprty:$Zd), (ins zprty:$_Zd, PPRAny:$Pg, fpimmtype:$imm8),
3151 asm, "\t$Zd, $Pg/m, $imm8",
3157 let Inst{31-24} = 0b00000101;
3158 let Inst{23-22} = sz;
3159 let Inst{21-20} = 0b01;
3160 let Inst{19-16} = Pg;
3161 let Inst{15-13} = 0b110;
3162 let Inst{12-5} = imm8;
3165 let Constraints = "$Zd = $_Zd";
3166 let DestructiveInstType = Destructive;
3167 let ElementSize = zprty.ElementSize;
3170 multiclass sve_int_dup_fpimm_pred<string asm> {
3171 def _H : sve_int_dup_fpimm_pred<0b01, fpimm16, asm, ZPR16>;
3172 def _S : sve_int_dup_fpimm_pred<0b10, fpimm32, asm, ZPR32>;
3173 def _D : sve_int_dup_fpimm_pred<0b11, fpimm64, asm, ZPR64>;
3175 def : InstAlias<"fmov $Zd, $Pg/m, $imm8",
3176 (!cast<Instruction>(NAME # _H) ZPR16:$Zd, PPRAny:$Pg, fpimm16:$imm8), 1>;
3177 def : InstAlias<"fmov $Zd, $Pg/m, $imm8",
3178 (!cast<Instruction>(NAME # _S) ZPR32:$Zd, PPRAny:$Pg, fpimm32:$imm8), 1>;
3179 def : InstAlias<"fmov $Zd, $Pg/m, $imm8",
3180 (!cast<Instruction>(NAME # _D) ZPR64:$Zd, PPRAny:$Pg, fpimm64:$imm8), 1>;
3183 class sve_int_dup_imm_pred<bits<2> sz8_64, bit m, string asm,
3184 ZPRRegOp zprty, string pred_qual, dag iops>
3185 : I<(outs zprty:$Zd), iops,
3186 asm, "\t$Zd, $Pg"#pred_qual#", $imm",
3187 "", []>, Sched<[]> {
3191 let Inst{31-24} = 0b00000101;
3192 let Inst{23-22} = sz8_64;
3193 let Inst{21-20} = 0b01;
3194 let Inst{19-16} = Pg;
3197 let Inst{13} = imm{8}; // sh
3198 let Inst{12-5} = imm{7-0}; // imm8
3201 let DestructiveInstType = Destructive;
3202 let ElementSize = zprty.ElementSize;
3205 multiclass sve_int_dup_imm_pred_merge<string asm> {
3206 let Constraints = "$Zd = $_Zd" in {
3207 def _B : sve_int_dup_imm_pred<0b00, 1, asm, ZPR8, "/m", (ins ZPR8:$_Zd, PPRAny:$Pg, cpy_imm8_opt_lsl_i8:$imm)>;
3208 def _H : sve_int_dup_imm_pred<0b01, 1, asm, ZPR16, "/m", (ins ZPR16:$_Zd, PPRAny:$Pg, cpy_imm8_opt_lsl_i16:$imm)>;
3209 def _S : sve_int_dup_imm_pred<0b10, 1, asm, ZPR32, "/m", (ins ZPR32:$_Zd, PPRAny:$Pg, cpy_imm8_opt_lsl_i32:$imm)>;
3210 def _D : sve_int_dup_imm_pred<0b11, 1, asm, ZPR64, "/m", (ins ZPR64:$_Zd, PPRAny:$Pg, cpy_imm8_opt_lsl_i64:$imm)>;
3213 def : InstAlias<"mov $Zd, $Pg/m, $imm",
3214 (!cast<Instruction>(NAME # _B) ZPR8:$Zd, PPRAny:$Pg, cpy_imm8_opt_lsl_i8:$imm), 1>;
3215 def : InstAlias<"mov $Zd, $Pg/m, $imm",
3216 (!cast<Instruction>(NAME # _H) ZPR16:$Zd, PPRAny:$Pg, cpy_imm8_opt_lsl_i16:$imm), 1>;
3217 def : InstAlias<"mov $Zd, $Pg/m, $imm",
3218 (!cast<Instruction>(NAME # _S) ZPR32:$Zd, PPRAny:$Pg, cpy_imm8_opt_lsl_i32:$imm), 1>;
3219 def : InstAlias<"mov $Zd, $Pg/m, $imm",
3220 (!cast<Instruction>(NAME # _D) ZPR64:$Zd, PPRAny:$Pg, cpy_imm8_opt_lsl_i64:$imm), 1>;
3222 def : InstAlias<"fmov $Zd, $Pg/m, #0.0",
3223 (!cast<Instruction>(NAME # _H) ZPR16:$Zd, PPRAny:$Pg, 0, 0), 0>;
3224 def : InstAlias<"fmov $Zd, $Pg/m, #0.0",
3225 (!cast<Instruction>(NAME # _S) ZPR32:$Zd, PPRAny:$Pg, 0, 0), 0>;
3226 def : InstAlias<"fmov $Zd, $Pg/m, #0.0",
3227 (!cast<Instruction>(NAME # _D) ZPR64:$Zd, PPRAny:$Pg, 0, 0), 0>;
3230 multiclass sve_int_dup_imm_pred_zero<string asm> {
3231 def _B : sve_int_dup_imm_pred<0b00, 0, asm, ZPR8, "/z", (ins PPRAny:$Pg, cpy_imm8_opt_lsl_i8:$imm)>;
3232 def _H : sve_int_dup_imm_pred<0b01, 0, asm, ZPR16, "/z", (ins PPRAny:$Pg, cpy_imm8_opt_lsl_i16:$imm)>;
3233 def _S : sve_int_dup_imm_pred<0b10, 0, asm, ZPR32, "/z", (ins PPRAny:$Pg, cpy_imm8_opt_lsl_i32:$imm)>;
3234 def _D : sve_int_dup_imm_pred<0b11, 0, asm, ZPR64, "/z", (ins PPRAny:$Pg, cpy_imm8_opt_lsl_i64:$imm)>;
3236 def : InstAlias<"mov $Zd, $Pg/z, $imm",
3237 (!cast<Instruction>(NAME # _B) ZPR8:$Zd, PPRAny:$Pg, cpy_imm8_opt_lsl_i8:$imm), 1>;
3238 def : InstAlias<"mov $Zd, $Pg/z, $imm",
3239 (!cast<Instruction>(NAME # _H) ZPR16:$Zd, PPRAny:$Pg, cpy_imm8_opt_lsl_i16:$imm), 1>;
3240 def : InstAlias<"mov $Zd, $Pg/z, $imm",
3241 (!cast<Instruction>(NAME # _S) ZPR32:$Zd, PPRAny:$Pg, cpy_imm8_opt_lsl_i32:$imm), 1>;
3242 def : InstAlias<"mov $Zd, $Pg/z, $imm",
3243 (!cast<Instruction>(NAME # _D) ZPR64:$Zd, PPRAny:$Pg, cpy_imm8_opt_lsl_i64:$imm), 1>;
3246 //===----------------------------------------------------------------------===//
3247 // SVE Integer Compare - Vectors Group
3248 //===----------------------------------------------------------------------===//
3250 class sve_int_cmp<bit cmp_1, bits<2> sz8_64, bits<3> opc, string asm,
3251 PPRRegOp pprty, ZPRRegOp zprty1, ZPRRegOp zprty2>
3252 : I<(outs pprty:$Pd), (ins PPR3bAny:$Pg, zprty1:$Zn, zprty2:$Zm),
3253 asm, "\t$Pd, $Pg/z, $Zn, $Zm",
3260 let Inst{31-24} = 0b00100100;
3261 let Inst{23-22} = sz8_64;
3263 let Inst{20-16} = Zm;
3264 let Inst{15} = opc{2};
3265 let Inst{14} = cmp_1;
3266 let Inst{13} = opc{1};
3267 let Inst{12-10} = Pg;
3269 let Inst{4} = opc{0};
3275 multiclass sve_int_cmp_0<bits<3> opc, string asm> {
3276 def _B : sve_int_cmp<0b0, 0b00, opc, asm, PPR8, ZPR8, ZPR8>;
3277 def _H : sve_int_cmp<0b0, 0b01, opc, asm, PPR16, ZPR16, ZPR16>;
3278 def _S : sve_int_cmp<0b0, 0b10, opc, asm, PPR32, ZPR32, ZPR32>;
3279 def _D : sve_int_cmp<0b0, 0b11, opc, asm, PPR64, ZPR64, ZPR64>;
3282 multiclass sve_int_cmp_0_wide<bits<3> opc, string asm> {
3283 def _B : sve_int_cmp<0b0, 0b00, opc, asm, PPR8, ZPR8, ZPR64>;
3284 def _H : sve_int_cmp<0b0, 0b01, opc, asm, PPR16, ZPR16, ZPR64>;
3285 def _S : sve_int_cmp<0b0, 0b10, opc, asm, PPR32, ZPR32, ZPR64>;
3288 multiclass sve_int_cmp_1_wide<bits<3> opc, string asm> {
3289 def _B : sve_int_cmp<0b1, 0b00, opc, asm, PPR8, ZPR8, ZPR64>;
3290 def _H : sve_int_cmp<0b1, 0b01, opc, asm, PPR16, ZPR16, ZPR64>;
3291 def _S : sve_int_cmp<0b1, 0b10, opc, asm, PPR32, ZPR32, ZPR64>;
3295 //===----------------------------------------------------------------------===//
3296 // SVE Integer Compare - Signed Immediate Group
3297 //===----------------------------------------------------------------------===//
3299 class sve_int_scmp_vi<bits<2> sz8_64, bits<3> opc, string asm, PPRRegOp pprty,
3302 : I<(outs pprty:$Pd), (ins PPR3bAny:$Pg, zprty:$Zn, immtype:$imm5),
3303 asm, "\t$Pd, $Pg/z, $Zn, $imm5",
3310 let Inst{31-24} = 0b00100101;
3311 let Inst{23-22} = sz8_64;
3313 let Inst{20-16} = imm5;
3314 let Inst{15} = opc{2};
3316 let Inst{13} = opc{1};
3317 let Inst{12-10} = Pg;
3319 let Inst{4} = opc{0};
3325 multiclass sve_int_scmp_vi<bits<3> opc, string asm> {
3326 def _B : sve_int_scmp_vi<0b00, opc, asm, PPR8, ZPR8, simm5_32b>;
3327 def _H : sve_int_scmp_vi<0b01, opc, asm, PPR16, ZPR16, simm5_32b>;
3328 def _S : sve_int_scmp_vi<0b10, opc, asm, PPR32, ZPR32, simm5_32b>;
3329 def _D : sve_int_scmp_vi<0b11, opc, asm, PPR64, ZPR64, simm5_64b>;
3333 //===----------------------------------------------------------------------===//
3334 // SVE Integer Compare - Unsigned Immediate Group
3335 //===----------------------------------------------------------------------===//
3337 class sve_int_ucmp_vi<bits<2> sz8_64, bits<2> opc, string asm, PPRRegOp pprty,
3338 ZPRRegOp zprty, Operand immtype>
3339 : I<(outs pprty:$Pd), (ins PPR3bAny:$Pg, zprty:$Zn, immtype:$imm7),
3340 asm, "\t$Pd, $Pg/z, $Zn, $imm7",
3347 let Inst{31-24} = 0b00100100;
3348 let Inst{23-22} = sz8_64;
3350 let Inst{20-14} = imm7;
3351 let Inst{13} = opc{1};
3352 let Inst{12-10} = Pg;
3354 let Inst{4} = opc{0};
3360 multiclass sve_int_ucmp_vi<bits<2> opc, string asm> {
3361 def _B : sve_int_ucmp_vi<0b00, opc, asm, PPR8, ZPR8, imm0_127>;
3362 def _H : sve_int_ucmp_vi<0b01, opc, asm, PPR16, ZPR16, imm0_127>;
3363 def _S : sve_int_ucmp_vi<0b10, opc, asm, PPR32, ZPR32, imm0_127>;
3364 def _D : sve_int_ucmp_vi<0b11, opc, asm, PPR64, ZPR64, imm0_127>;
3368 //===----------------------------------------------------------------------===//
3369 // SVE Integer Compare - Scalars Group
3370 //===----------------------------------------------------------------------===//
3372 class sve_int_cterm<bit sz, bit opc, string asm, RegisterClass rt>
3373 : I<(outs), (ins rt:$Rn, rt:$Rm),
3379 let Inst{31-23} = 0b001001011;
3382 let Inst{20-16} = Rm;
3383 let Inst{15-10} = 0b001000;
3386 let Inst{3-0} = 0b0000;
3391 class sve_int_while_rr<bits<2> sz8_64, bits<4> opc, string asm,
3392 RegisterClass gprty, PPRRegOp pprty>
3393 : I<(outs pprty:$Pd), (ins gprty:$Rn, gprty:$Rm),
3394 asm, "\t$Pd, $Rn, $Rm",
3395 "", []>, Sched<[]> {
3399 let Inst{31-24} = 0b00100101;
3400 let Inst{23-22} = sz8_64;
3402 let Inst{20-16} = Rm;
3403 let Inst{15-13} = 0b000;
3404 let Inst{12-10} = opc{3-1};
3406 let Inst{4} = opc{0};
3412 multiclass sve_int_while4_rr<bits<3> opc, string asm> {
3413 def _B : sve_int_while_rr<0b00, { 0, opc }, asm, GPR32, PPR8>;
3414 def _H : sve_int_while_rr<0b01, { 0, opc }, asm, GPR32, PPR16>;
3415 def _S : sve_int_while_rr<0b10, { 0, opc }, asm, GPR32, PPR32>;
3416 def _D : sve_int_while_rr<0b11, { 0, opc }, asm, GPR32, PPR64>;
3419 multiclass sve_int_while8_rr<bits<3> opc, string asm> {
3420 def _B : sve_int_while_rr<0b00, { 1, opc }, asm, GPR64, PPR8>;
3421 def _H : sve_int_while_rr<0b01, { 1, opc }, asm, GPR64, PPR16>;
3422 def _S : sve_int_while_rr<0b10, { 1, opc }, asm, GPR64, PPR32>;
3423 def _D : sve_int_while_rr<0b11, { 1, opc }, asm, GPR64, PPR64>;
3426 class sve2_int_while_rr<bits<2> sz8_64, bits<1> rw, string asm,
3428 : I<(outs pprty:$Pd), (ins GPR64:$Rn, GPR64:$Rm),
3429 asm, "\t$Pd, $Rn, $Rm",
3430 "", []>, Sched<[]> {
3434 let Inst{31-24} = 0b00100101;
3435 let Inst{23-22} = sz8_64;
3437 let Inst{20-16} = Rm;
3438 let Inst{15-10} = 0b001100;
3446 multiclass sve2_int_while_rr<bits<1> rw, string asm> {
3447 def _B : sve2_int_while_rr<0b00, rw, asm, PPR8>;
3448 def _H : sve2_int_while_rr<0b01, rw, asm, PPR16>;
3449 def _S : sve2_int_while_rr<0b10, rw, asm, PPR32>;
3450 def _D : sve2_int_while_rr<0b11, rw, asm, PPR64>;
3453 //===----------------------------------------------------------------------===//
3454 // SVE Floating Point Fast Reduction Group
3455 //===----------------------------------------------------------------------===//
3457 class sve_fp_fast_red<bits<2> sz, bits<3> opc, string asm,
3458 ZPRRegOp zprty, RegisterClass dstRegClass>
3459 : I<(outs dstRegClass:$Vd), (ins PPR3bAny:$Pg, zprty:$Zn),
3460 asm, "\t$Vd, $Pg, $Zn",
3466 let Inst{31-24} = 0b01100101;
3467 let Inst{23-22} = sz;
3468 let Inst{21-19} = 0b000;
3469 let Inst{18-16} = opc;
3470 let Inst{15-13} = 0b001;
3471 let Inst{12-10} = Pg;
3476 multiclass sve_fp_fast_red<bits<3> opc, string asm> {
3477 def _H : sve_fp_fast_red<0b01, opc, asm, ZPR16, FPR16>;
3478 def _S : sve_fp_fast_red<0b10, opc, asm, ZPR32, FPR32>;
3479 def _D : sve_fp_fast_red<0b11, opc, asm, ZPR64, FPR64>;
3483 //===----------------------------------------------------------------------===//
3484 // SVE Floating Point Accumulating Reduction Group
3485 //===----------------------------------------------------------------------===//
3487 class sve_fp_2op_p_vd<bits<2> sz, bits<3> opc, string asm,
3488 ZPRRegOp zprty, RegisterClass dstRegClass>
3489 : I<(outs dstRegClass:$Vdn), (ins PPR3bAny:$Pg, dstRegClass:$_Vdn, zprty:$Zm),
3490 asm, "\t$Vdn, $Pg, $_Vdn, $Zm",
3497 let Inst{31-24} = 0b01100101;
3498 let Inst{23-22} = sz;
3499 let Inst{21-19} = 0b011;
3500 let Inst{18-16} = opc;
3501 let Inst{15-13} = 0b001;
3502 let Inst{12-10} = Pg;
3504 let Inst{4-0} = Vdn;
3506 let Constraints = "$Vdn = $_Vdn";
3509 multiclass sve_fp_2op_p_vd<bits<3> opc, string asm> {
3510 def _H : sve_fp_2op_p_vd<0b01, opc, asm, ZPR16, FPR16>;
3511 def _S : sve_fp_2op_p_vd<0b10, opc, asm, ZPR32, FPR32>;
3512 def _D : sve_fp_2op_p_vd<0b11, opc, asm, ZPR64, FPR64>;
3515 //===----------------------------------------------------------------------===//
3516 // SVE Floating Point Compare - Vectors Group
3517 //===----------------------------------------------------------------------===//
3519 class sve_fp_3op_p_pd<bits<2> sz, bits<3> opc, string asm, PPRRegOp pprty,
3521 : I<(outs pprty:$Pd), (ins PPR3bAny:$Pg, zprty:$Zn, zprty:$Zm),
3522 asm, "\t$Pd, $Pg/z, $Zn, $Zm",
3529 let Inst{31-24} = 0b01100101;
3530 let Inst{23-22} = sz;
3532 let Inst{20-16} = Zm;
3533 let Inst{15} = opc{2};
3535 let Inst{13} = opc{1};
3536 let Inst{12-10} = Pg;
3538 let Inst{4} = opc{0};
3542 multiclass sve_fp_3op_p_pd<bits<3> opc, string asm> {
3543 def _H : sve_fp_3op_p_pd<0b01, opc, asm, PPR16, ZPR16>;
3544 def _S : sve_fp_3op_p_pd<0b10, opc, asm, PPR32, ZPR32>;
3545 def _D : sve_fp_3op_p_pd<0b11, opc, asm, PPR64, ZPR64>;
3549 //===----------------------------------------------------------------------===//
3550 // SVE Floating Point Compare - with Zero Group
3551 //===----------------------------------------------------------------------===//
3553 class sve_fp_2op_p_pd<bits<2> sz, bits<3> opc, string asm, PPRRegOp pprty,
3555 : I<(outs pprty:$Pd), (ins PPR3bAny:$Pg, zprty:$Zn),
3556 asm, "\t$Pd, $Pg/z, $Zn, #0.0",
3562 let Inst{31-24} = 0b01100101;
3563 let Inst{23-22} = sz;
3564 let Inst{21-18} = 0b0100;
3565 let Inst{17-16} = opc{2-1};
3566 let Inst{15-13} = 0b001;
3567 let Inst{12-10} = Pg;
3569 let Inst{4} = opc{0};
3573 multiclass sve_fp_2op_p_pd<bits<3> opc, string asm> {
3574 def _H : sve_fp_2op_p_pd<0b01, opc, asm, PPR16, ZPR16>;
3575 def _S : sve_fp_2op_p_pd<0b10, opc, asm, PPR32, ZPR32>;
3576 def _D : sve_fp_2op_p_pd<0b11, opc, asm, PPR64, ZPR64>;
3580 //===----------------------------------------------------------------------===//
3581 //SVE Index Generation Group
3582 //===----------------------------------------------------------------------===//
3584 class sve_int_index_ii<bits<2> sz8_64, string asm, ZPRRegOp zprty,
3586 : I<(outs zprty:$Zd), (ins imm_ty:$imm5, imm_ty:$imm5b),
3587 asm, "\t$Zd, $imm5, $imm5b",
3588 "", []>, Sched<[]> {
3592 let Inst{31-24} = 0b00000100;
3593 let Inst{23-22} = sz8_64;
3595 let Inst{20-16} = imm5b;
3596 let Inst{15-10} = 0b010000;
3597 let Inst{9-5} = imm5;
3601 multiclass sve_int_index_ii<string asm> {
3602 def _B : sve_int_index_ii<0b00, asm, ZPR8, simm5_32b>;
3603 def _H : sve_int_index_ii<0b01, asm, ZPR16, simm5_32b>;
3604 def _S : sve_int_index_ii<0b10, asm, ZPR32, simm5_32b>;
3605 def _D : sve_int_index_ii<0b11, asm, ZPR64, simm5_64b>;
3608 class sve_int_index_ir<bits<2> sz8_64, string asm, ZPRRegOp zprty,
3609 RegisterClass srcRegType, Operand imm_ty>
3610 : I<(outs zprty:$Zd), (ins imm_ty:$imm5, srcRegType:$Rm),
3611 asm, "\t$Zd, $imm5, $Rm",
3612 "", []>, Sched<[]> {
3616 let Inst{31-24} = 0b00000100;
3617 let Inst{23-22} = sz8_64;
3619 let Inst{20-16} = Rm;
3620 let Inst{15-10} = 0b010010;
3621 let Inst{9-5} = imm5;
3625 multiclass sve_int_index_ir<string asm> {
3626 def _B : sve_int_index_ir<0b00, asm, ZPR8, GPR32, simm5_32b>;
3627 def _H : sve_int_index_ir<0b01, asm, ZPR16, GPR32, simm5_32b>;
3628 def _S : sve_int_index_ir<0b10, asm, ZPR32, GPR32, simm5_32b>;
3629 def _D : sve_int_index_ir<0b11, asm, ZPR64, GPR64, simm5_64b>;
3632 class sve_int_index_ri<bits<2> sz8_64, string asm, ZPRRegOp zprty,
3633 RegisterClass srcRegType, Operand imm_ty>
3634 : I<(outs zprty:$Zd), (ins srcRegType:$Rn, imm_ty:$imm5),
3635 asm, "\t$Zd, $Rn, $imm5",
3636 "", []>, Sched<[]> {
3640 let Inst{31-24} = 0b00000100;
3641 let Inst{23-22} = sz8_64;
3643 let Inst{20-16} = imm5;
3644 let Inst{15-10} = 0b010001;
3649 multiclass sve_int_index_ri<string asm> {
3650 def _B : sve_int_index_ri<0b00, asm, ZPR8, GPR32, simm5_32b>;
3651 def _H : sve_int_index_ri<0b01, asm, ZPR16, GPR32, simm5_32b>;
3652 def _S : sve_int_index_ri<0b10, asm, ZPR32, GPR32, simm5_32b>;
3653 def _D : sve_int_index_ri<0b11, asm, ZPR64, GPR64, simm5_64b>;
3656 class sve_int_index_rr<bits<2> sz8_64, string asm, ZPRRegOp zprty,
3657 RegisterClass srcRegType>
3658 : I<(outs zprty:$Zd), (ins srcRegType:$Rn, srcRegType:$Rm),
3659 asm, "\t$Zd, $Rn, $Rm",
3660 "", []>, Sched<[]> {
3664 let Inst{31-24} = 0b00000100;
3665 let Inst{23-22} = sz8_64;
3667 let Inst{20-16} = Rm;
3668 let Inst{15-10} = 0b010011;
3673 multiclass sve_int_index_rr<string asm> {
3674 def _B : sve_int_index_rr<0b00, asm, ZPR8, GPR32>;
3675 def _H : sve_int_index_rr<0b01, asm, ZPR16, GPR32>;
3676 def _S : sve_int_index_rr<0b10, asm, ZPR32, GPR32>;
3677 def _D : sve_int_index_rr<0b11, asm, ZPR64, GPR64>;
3680 //===----------------------------------------------------------------------===//
3681 // SVE Bitwise Shift - Predicated Group
3682 //===----------------------------------------------------------------------===//
3683 class sve_int_bin_pred_shift_imm<bits<4> tsz8_64, bits<4> opc, string asm,
3684 ZPRRegOp zprty, Operand immtype,
3685 ElementSizeEnum size>
3686 : I<(outs zprty:$Zdn), (ins PPR3bAny:$Pg, zprty:$_Zdn, immtype:$imm),
3687 asm, "\t$Zdn, $Pg/m, $_Zdn, $imm",
3693 let Inst{31-24} = 0b00000100;
3694 let Inst{23-22} = tsz8_64{3-2};
3695 let Inst{21-20} = 0b00;
3696 let Inst{19-16} = opc;
3697 let Inst{15-13} = 0b100;
3698 let Inst{12-10} = Pg;
3699 let Inst{9-8} = tsz8_64{1-0};
3700 let Inst{7-5} = imm{2-0}; // imm3
3701 let Inst{4-0} = Zdn;
3703 let Constraints = "$Zdn = $_Zdn";
3704 let DestructiveInstType = Destructive;
3705 let ElementSize = size;
3708 multiclass sve_int_bin_pred_shift_imm_left<bits<4> opc, string asm> {
3709 def _B : sve_int_bin_pred_shift_imm<{0,0,0,1}, opc, asm, ZPR8, vecshiftL8,
3711 def _H : sve_int_bin_pred_shift_imm<{0,0,1,?}, opc, asm, ZPR16, vecshiftL16,
3713 let Inst{8} = imm{3};
3715 def _S : sve_int_bin_pred_shift_imm<{0,1,?,?}, opc, asm, ZPR32, vecshiftL32,
3717 let Inst{9-8} = imm{4-3};
3719 def _D : sve_int_bin_pred_shift_imm<{1,?,?,?}, opc, asm, ZPR64, vecshiftL64,
3721 let Inst{22} = imm{5};
3722 let Inst{9-8} = imm{4-3};
3726 multiclass sve_int_bin_pred_shift_imm_right<bits<4> opc, string asm> {
3727 def _B : sve_int_bin_pred_shift_imm<{0,0,0,1}, opc, asm, ZPR8, vecshiftR8,
3729 def _H : sve_int_bin_pred_shift_imm<{0,0,1,?}, opc, asm, ZPR16, vecshiftR16,
3731 let Inst{8} = imm{3};
3733 def _S : sve_int_bin_pred_shift_imm<{0,1,?,?}, opc, asm, ZPR32, vecshiftR32,
3735 let Inst{9-8} = imm{4-3};
3737 def _D : sve_int_bin_pred_shift_imm<{1,?,?,?}, opc, asm, ZPR64, vecshiftR64,
3739 let Inst{22} = imm{5};
3740 let Inst{9-8} = imm{4-3};
3744 class sve_int_bin_pred_shift<bits<2> sz8_64, bit wide, bits<3> opc,
3745 string asm, ZPRRegOp zprty, ZPRRegOp zprty2>
3746 : I<(outs zprty:$Zdn), (ins PPR3bAny:$Pg, zprty:$_Zdn, zprty2:$Zm),
3747 asm, "\t$Zdn, $Pg/m, $_Zdn, $Zm",
3753 let Inst{31-24} = 0b00000100;
3754 let Inst{23-22} = sz8_64;
3755 let Inst{21-20} = 0b01;
3756 let Inst{19} = wide;
3757 let Inst{18-16} = opc;
3758 let Inst{15-13} = 0b100;
3759 let Inst{12-10} = Pg;
3761 let Inst{4-0} = Zdn;
3763 let Constraints = "$Zdn = $_Zdn";
3764 let DestructiveInstType = Destructive;
3765 let ElementSize = zprty.ElementSize;
3768 multiclass sve_int_bin_pred_shift<bits<3> opc, string asm> {
3769 def _B : sve_int_bin_pred_shift<0b00, 0b0, opc, asm, ZPR8, ZPR8>;
3770 def _H : sve_int_bin_pred_shift<0b01, 0b0, opc, asm, ZPR16, ZPR16>;
3771 def _S : sve_int_bin_pred_shift<0b10, 0b0, opc, asm, ZPR32, ZPR32>;
3772 def _D : sve_int_bin_pred_shift<0b11, 0b0, opc, asm, ZPR64, ZPR64>;
3775 multiclass sve_int_bin_pred_shift_wide<bits<3> opc, string asm> {
3776 def _B : sve_int_bin_pred_shift<0b00, 0b1, opc, asm, ZPR8, ZPR64>;
3777 def _H : sve_int_bin_pred_shift<0b01, 0b1, opc, asm, ZPR16, ZPR64>;
3778 def _S : sve_int_bin_pred_shift<0b10, 0b1, opc, asm, ZPR32, ZPR64>;
3781 //===----------------------------------------------------------------------===//
3782 // SVE Shift - Unpredicated Group
3783 //===----------------------------------------------------------------------===//
3785 class sve_int_bin_cons_shift_wide<bits<2> sz8_64, bits<2> opc, string asm,
3787 : I<(outs zprty:$Zd), (ins zprty:$Zn, ZPR64:$Zm),
3788 asm, "\t$Zd, $Zn, $Zm",
3794 let Inst{31-24} = 0b00000100;
3795 let Inst{23-22} = sz8_64;
3797 let Inst{20-16} = Zm;
3798 let Inst{15-12} = 0b1000;
3799 let Inst{11-10} = opc;
3804 multiclass sve_int_bin_cons_shift_wide<bits<2> opc, string asm> {
3805 def _B : sve_int_bin_cons_shift_wide<0b00, opc, asm, ZPR8>;
3806 def _H : sve_int_bin_cons_shift_wide<0b01, opc, asm, ZPR16>;
3807 def _S : sve_int_bin_cons_shift_wide<0b10, opc, asm, ZPR32>;
3810 class sve_int_bin_cons_shift_imm<bits<4> tsz8_64, bits<2> opc, string asm,
3811 ZPRRegOp zprty, Operand immtype>
3812 : I<(outs zprty:$Zd), (ins zprty:$Zn, immtype:$imm),
3813 asm, "\t$Zd, $Zn, $imm",
3814 "", []>, Sched<[]> {
3818 let Inst{31-24} = 0b00000100;
3819 let Inst{23-22} = tsz8_64{3-2};
3821 let Inst{20-19} = tsz8_64{1-0};
3822 let Inst{18-16} = imm{2-0}; // imm3
3823 let Inst{15-12} = 0b1001;
3824 let Inst{11-10} = opc;
3829 multiclass sve_int_bin_cons_shift_imm_left<bits<2> opc, string asm> {
3830 def _B : sve_int_bin_cons_shift_imm<{0,0,0,1}, opc, asm, ZPR8, vecshiftL8>;
3831 def _H : sve_int_bin_cons_shift_imm<{0,0,1,?}, opc, asm, ZPR16, vecshiftL16> {
3832 let Inst{19} = imm{3};
3834 def _S : sve_int_bin_cons_shift_imm<{0,1,?,?}, opc, asm, ZPR32, vecshiftL32> {
3835 let Inst{20-19} = imm{4-3};
3837 def _D : sve_int_bin_cons_shift_imm<{1,?,?,?}, opc, asm, ZPR64, vecshiftL64> {
3838 let Inst{22} = imm{5};
3839 let Inst{20-19} = imm{4-3};
3843 multiclass sve_int_bin_cons_shift_imm_right<bits<2> opc, string asm> {
3844 def _B : sve_int_bin_cons_shift_imm<{0,0,0,1}, opc, asm, ZPR8, vecshiftR8>;
3845 def _H : sve_int_bin_cons_shift_imm<{0,0,1,?}, opc, asm, ZPR16, vecshiftR16> {
3846 let Inst{19} = imm{3};
3848 def _S : sve_int_bin_cons_shift_imm<{0,1,?,?}, opc, asm, ZPR32, vecshiftR32> {
3849 let Inst{20-19} = imm{4-3};
3851 def _D : sve_int_bin_cons_shift_imm<{1,?,?,?}, opc, asm, ZPR64, vecshiftR64> {
3852 let Inst{22} = imm{5};
3853 let Inst{20-19} = imm{4-3};
3856 //===----------------------------------------------------------------------===//
3857 // SVE Memory - Store Group
3858 //===----------------------------------------------------------------------===//
3860 class sve_mem_cst_si<bits<2> msz, bits<2> esz, string asm,
3861 RegisterOperand VecList>
3862 : I<(outs), (ins VecList:$Zt, PPR3bAny:$Pg, GPR64sp:$Rn, simm4s1:$imm4),
3863 asm, "\t$Zt, $Pg, [$Rn, $imm4, mul vl]",
3870 let Inst{31-25} = 0b1110010;
3871 let Inst{24-23} = msz;
3872 let Inst{22-21} = esz;
3874 let Inst{19-16} = imm4;
3875 let Inst{15-13} = 0b111;
3876 let Inst{12-10} = Pg;
3883 multiclass sve_mem_cst_si<bits<2> msz, bits<2> esz, string asm,
3884 RegisterOperand listty, ZPRRegOp zprty>
3886 def NAME : sve_mem_cst_si<msz, esz, asm, listty>;
3888 def : InstAlias<asm # "\t$Zt, $Pg, [$Rn, $imm4, mul vl]",
3889 (!cast<Instruction>(NAME) zprty:$Zt, PPR3bAny:$Pg, GPR64sp:$Rn, simm4s1:$imm4), 0>;
3890 def : InstAlias<asm # "\t$Zt, $Pg, [$Rn]",
3891 (!cast<Instruction>(NAME) zprty:$Zt, PPR3bAny:$Pg, GPR64sp:$Rn, 0), 0>;
3892 def : InstAlias<asm # "\t$Zt, $Pg, [$Rn]",
3893 (!cast<Instruction>(NAME) listty:$Zt, PPR3bAny:$Pg, GPR64sp:$Rn, 0), 1>;
3896 class sve_mem_est_si<bits<2> sz, bits<2> nregs, RegisterOperand VecList,
3897 string asm, Operand immtype>
3898 : I<(outs), (ins VecList:$Zt, PPR3bAny:$Pg, GPR64sp:$Rn, immtype:$imm4),
3899 asm, "\t$Zt, $Pg, [$Rn, $imm4, mul vl]",
3906 let Inst{31-25} = 0b1110010;
3907 let Inst{24-23} = sz;
3908 let Inst{22-21} = nregs;
3910 let Inst{19-16} = imm4;
3911 let Inst{15-13} = 0b111;
3912 let Inst{12-10} = Pg;
3919 multiclass sve_mem_est_si<bits<2> sz, bits<2> nregs, RegisterOperand VecList,
3920 string asm, Operand immtype> {
3921 def NAME : sve_mem_est_si<sz, nregs, VecList, asm, immtype>;
3923 def : InstAlias<asm # "\t$Zt, $Pg, [$Rn]",
3924 (!cast<Instruction>(NAME) VecList:$Zt, PPR3bAny:$Pg, GPR64sp:$Rn, 0), 1>;
3927 class sve_mem_est_ss<bits<2> sz, bits<2> nregs, RegisterOperand VecList,
3928 string asm, RegisterOperand gprty>
3929 : I<(outs), (ins VecList:$Zt, PPR3bAny:$Pg, GPR64sp:$Rn, gprty:$Rm),
3930 asm, "\t$Zt, $Pg, [$Rn, $Rm]",
3937 let Inst{31-25} = 0b1110010;
3938 let Inst{24-23} = sz;
3939 let Inst{22-21} = nregs;
3940 let Inst{20-16} = Rm;
3941 let Inst{15-13} = 0b011;
3942 let Inst{12-10} = Pg;
3949 class sve_mem_cst_ss_base<bits<4> dtype, string asm,
3950 RegisterOperand listty, RegisterOperand gprty>
3951 : I<(outs), (ins listty:$Zt, PPR3bAny:$Pg, GPR64sp:$Rn, gprty:$Rm),
3952 asm, "\t$Zt, $Pg, [$Rn, $Rm]",
3959 let Inst{31-25} = 0b1110010;
3960 let Inst{24-21} = dtype;
3961 let Inst{20-16} = Rm;
3962 let Inst{15-13} = 0b010;
3963 let Inst{12-10} = Pg;
3970 multiclass sve_mem_cst_ss<bits<4> dtype, string asm,
3971 RegisterOperand listty, ZPRRegOp zprty,
3972 RegisterOperand gprty> {
3973 def NAME : sve_mem_cst_ss_base<dtype, asm, listty, gprty>;
3975 def : InstAlias<asm # "\t$Zt, $Pg, [$Rn, $Rm]",
3976 (!cast<Instruction>(NAME) zprty:$Zt, PPR3bAny:$Pg, GPR64sp:$Rn, gprty:$Rm), 0>;
3979 class sve_mem_cstnt_si<bits<2> msz, string asm, RegisterOperand VecList>
3980 : I<(outs), (ins VecList:$Zt, PPR3bAny:$Pg, GPR64sp:$Rn, simm4s1:$imm4),
3981 asm, "\t$Zt, $Pg, [$Rn, $imm4, mul vl]",
3988 let Inst{31-25} = 0b1110010;
3989 let Inst{24-23} = msz;
3990 let Inst{22-20} = 0b001;
3991 let Inst{19-16} = imm4;
3992 let Inst{15-13} = 0b111;
3993 let Inst{12-10} = Pg;
4000 multiclass sve_mem_cstnt_si<bits<2> msz, string asm, RegisterOperand listty,
4002 def NAME : sve_mem_cstnt_si<msz, asm, listty>;
4004 def : InstAlias<asm # "\t$Zt, $Pg, [$Rn]",
4005 (!cast<Instruction>(NAME) zprty:$Zt, PPR3bAny:$Pg, GPR64sp:$Rn, 0), 0>;
4006 def : InstAlias<asm # "\t$Zt, $Pg, [$Rn, $imm4, mul vl]",
4007 (!cast<Instruction>(NAME) zprty:$Zt, PPR3bAny:$Pg, GPR64sp:$Rn, simm4s1:$imm4), 0>;
4008 def : InstAlias<asm # "\t$Zt, $Pg, [$Rn]",
4009 (!cast<Instruction>(NAME) listty:$Zt, PPR3bAny:$Pg, GPR64sp:$Rn, 0), 1>;
4012 class sve_mem_cstnt_ss_base<bits<2> msz, string asm, RegisterOperand listty,
4013 RegisterOperand gprty>
4014 : I<(outs), (ins listty:$Zt, PPR3bAny:$Pg, GPR64sp:$Rn, gprty:$Rm),
4015 asm, "\t$Zt, $Pg, [$Rn, $Rm]",
4022 let Inst{31-25} = 0b1110010;
4023 let Inst{24-23} = msz;
4024 let Inst{22-21} = 0b00;
4025 let Inst{20-16} = Rm;
4026 let Inst{15-13} = 0b011;
4027 let Inst{12-10} = Pg;
4034 multiclass sve_mem_cstnt_ss<bits<2> msz, string asm, RegisterOperand listty,
4035 ZPRRegOp zprty, RegisterOperand gprty> {
4036 def NAME : sve_mem_cstnt_ss_base<msz, asm, listty, gprty>;
4038 def : InstAlias<asm # "\t$Zt, $Pg, [$Rn, $Rm]",
4039 (!cast<Instruction>(NAME) zprty:$Zt, PPR3bAny:$Pg, GPR64sp:$Rn, gprty:$Rm), 0>;
4042 class sve2_mem_sstnt_vs_base<bits<3> opc, string asm,
4043 RegisterOperand listty, ZPRRegOp zprty>
4044 : I<(outs), (ins listty:$Zt, PPR3bAny:$Pg, zprty:$Zn, GPR64:$Rm),
4045 asm, "\t$Zt, $Pg, [$Zn, $Rm]",
4052 let Inst{31-25} = 0b1110010;
4053 let Inst{24-22} = opc;
4055 let Inst{20-16} = Rm;
4056 let Inst{15-13} = 0b001;
4057 let Inst{12-10} = Pg;
4064 multiclass sve2_mem_sstnt_vs<bits<3> opc, string asm,
4065 RegisterOperand listty, ZPRRegOp zprty> {
4066 def _REAL : sve2_mem_sstnt_vs_base<opc, asm, listty, zprty>;
4068 def : InstAlias<asm # "\t$Zt, $Pg, [$Zn, $Rm]",
4069 (!cast<Instruction>(NAME # _REAL) zprty:$Zt, PPR3bAny:$Pg, zprty:$Zn, GPR64:$Rm), 0>;
4070 def : InstAlias<asm # "\t$Zt, $Pg, [$Zn]",
4071 (!cast<Instruction>(NAME # _REAL) zprty:$Zt, PPR3bAny:$Pg, zprty:$Zn, XZR), 0>;
4072 def : InstAlias<asm # "\t$Zt, $Pg, [$Zn]",
4073 (!cast<Instruction>(NAME # _REAL) listty:$Zt, PPR3bAny:$Pg, zprty:$Zn, XZR), 1>;
4076 class sve_mem_sst_sv<bits<3> opc, bit xs, bit scaled, string asm,
4077 RegisterOperand VecList, RegisterOperand zprext>
4078 : I<(outs), (ins VecList:$Zt, PPR3bAny:$Pg, GPR64sp:$Rn, zprext:$Zm),
4079 asm, "\t$Zt, $Pg, [$Rn, $Zm]",
4086 let Inst{31-25} = 0b1110010;
4087 let Inst{24-22} = opc;
4088 let Inst{21} = scaled;
4089 let Inst{20-16} = Zm;
4093 let Inst{12-10} = Pg;
4100 multiclass sve_mem_sst_sv_32_scaled<bits<3> opc, string asm,
4101 RegisterOperand listty,
4103 RegisterOperand sxtw_opnd,
4104 RegisterOperand uxtw_opnd > {
4105 def _UXTW_SCALED : sve_mem_sst_sv<opc, 0, 1, asm, listty, uxtw_opnd>;
4106 def _SXTW_SCALED : sve_mem_sst_sv<opc, 1, 1, asm, listty, sxtw_opnd>;
4108 def : InstAlias<asm # "\t$Zt, $Pg, [$Rn, $Zm]",
4109 (!cast<Instruction>(NAME # _UXTW_SCALED) zprty:$Zt, PPR3bAny:$Pg, GPR64sp:$Rn, uxtw_opnd:$Zm), 0>;
4110 def : InstAlias<asm # "\t$Zt, $Pg, [$Rn, $Zm]",
4111 (!cast<Instruction>(NAME # _SXTW_SCALED) zprty:$Zt, PPR3bAny:$Pg, GPR64sp:$Rn, sxtw_opnd:$Zm), 0>;
4114 multiclass sve_mem_sst_sv_32_unscaled<bits<3> opc, string asm,
4115 RegisterOperand listty,
4117 RegisterOperand sxtw_opnd,
4118 RegisterOperand uxtw_opnd> {
4119 def _UXTW : sve_mem_sst_sv<opc, 0, 0, asm, listty, uxtw_opnd>;
4120 def _SXTW : sve_mem_sst_sv<opc, 1, 0, asm, listty, sxtw_opnd>;
4122 def : InstAlias<asm # "\t$Zt, $Pg, [$Rn, $Zm]",
4123 (!cast<Instruction>(NAME # _UXTW) zprty:$Zt, PPR3bAny:$Pg, GPR64sp:$Rn, uxtw_opnd:$Zm), 0>;
4124 def : InstAlias<asm # "\t$Zt, $Pg, [$Rn, $Zm]",
4125 (!cast<Instruction>(NAME # _SXTW) zprty:$Zt, PPR3bAny:$Pg, GPR64sp:$Rn, sxtw_opnd:$Zm), 0>;
4128 class sve_mem_sst_sv2<bits<2> msz, bit scaled, string asm,
4129 RegisterOperand zprext>
4130 : I<(outs), (ins Z_d:$Zt, PPR3bAny:$Pg, GPR64sp:$Rn, zprext:$Zm),
4131 asm, "\t$Zt, $Pg, [$Rn, $Zm]",
4138 let Inst{31-25} = 0b1110010;
4139 let Inst{24-23} = msz;
4141 let Inst{21} = scaled;
4142 let Inst{20-16} = Zm;
4143 let Inst{15-13} = 0b101;
4144 let Inst{12-10} = Pg;
4151 multiclass sve_mem_sst_sv_64_scaled<bits<2> msz, string asm,
4152 RegisterOperand zprext> {
4153 def "" : sve_mem_sst_sv2<msz, 1, asm, zprext>;
4155 def : InstAlias<asm # "\t$Zt, $Pg, [$Rn, $Zm]",
4156 (!cast<Instruction>(NAME) ZPR64:$Zt, PPR3bAny:$Pg, GPR64sp:$Rn, zprext:$Zm), 0>;
4160 multiclass sve_mem_sst_sv_64_unscaled<bits<2> msz, string asm> {
4161 def "" : sve_mem_sst_sv2<msz, 0, asm, ZPR64ExtLSL8>;
4163 def : InstAlias<asm # "\t$Zt, $Pg, [$Rn, $Zm]",
4164 (!cast<Instruction>(NAME) ZPR64:$Zt, PPR3bAny:$Pg, GPR64sp:$Rn, ZPR64ExtLSL8:$Zm), 0>;
4167 class sve_mem_sst_vi<bits<3> opc, string asm, ZPRRegOp zprty,
4168 RegisterOperand VecList, Operand imm_ty>
4169 : I<(outs), (ins VecList:$Zt, PPR3bAny:$Pg, zprty:$Zn, imm_ty:$imm5),
4170 asm, "\t$Zt, $Pg, [$Zn, $imm5]",
4177 let Inst{31-25} = 0b1110010;
4178 let Inst{24-23} = opc{2-1};
4180 let Inst{21} = opc{0};
4181 let Inst{20-16} = imm5;
4182 let Inst{15-13} = 0b101;
4183 let Inst{12-10} = Pg;
4190 multiclass sve_mem_sst_vi_ptrs<bits<3> opc, string asm, RegisterOperand listty,
4191 ZPRRegOp zprty, Operand imm_ty> {
4192 def _IMM : sve_mem_sst_vi<opc, asm, zprty, listty, imm_ty>;
4194 def : InstAlias<asm # "\t$Zt, $Pg, [$Zn]",
4195 (!cast<Instruction>(NAME # _IMM) zprty:$Zt, PPR3bAny:$Pg, zprty:$Zn, 0), 0>;
4196 def : InstAlias<asm # "\t$Zt, $Pg, [$Zn, $imm5]",
4197 (!cast<Instruction>(NAME # _IMM) zprty:$Zt, PPR3bAny:$Pg, zprty:$Zn, imm_ty:$imm5), 0>;
4198 def : InstAlias<asm # "\t$Zt, $Pg, [$Zn]",
4199 (!cast<Instruction>(NAME # _IMM) listty:$Zt, PPR3bAny:$Pg, zprty:$Zn, 0), 1>;
4202 class sve_mem_z_spill<string asm>
4203 : I<(outs), (ins ZPRAny:$Zt, GPR64sp:$Rn, simm9:$imm9),
4204 asm, "\t$Zt, [$Rn, $imm9, mul vl]",
4210 let Inst{31-22} = 0b1110010110;
4211 let Inst{21-16} = imm9{8-3};
4212 let Inst{15-13} = 0b010;
4213 let Inst{12-10} = imm9{2-0};
4220 multiclass sve_mem_z_spill<string asm> {
4221 def NAME : sve_mem_z_spill<asm>;
4223 def : InstAlias<asm # "\t$Zt, [$Rn]",
4224 (!cast<Instruction>(NAME) ZPRAny:$Zt, GPR64sp:$Rn, 0), 1>;
4227 class sve_mem_p_spill<string asm>
4228 : I<(outs), (ins PPRAny:$Pt, GPR64sp:$Rn, simm9:$imm9),
4229 asm, "\t$Pt, [$Rn, $imm9, mul vl]",
4235 let Inst{31-22} = 0b1110010110;
4236 let Inst{21-16} = imm9{8-3};
4237 let Inst{15-13} = 0b000;
4238 let Inst{12-10} = imm9{2-0};
4246 multiclass sve_mem_p_spill<string asm> {
4247 def NAME : sve_mem_p_spill<asm>;
4249 def : InstAlias<asm # "\t$Pt, [$Rn]",
4250 (!cast<Instruction>(NAME) PPRAny:$Pt, GPR64sp:$Rn, 0), 1>;
4253 //===----------------------------------------------------------------------===//
4254 // SVE Permute - Predicates Group
4255 //===----------------------------------------------------------------------===//
4257 class sve_int_perm_bin_perm_pp<bits<3> opc, bits<2> sz8_64, string asm,
4259 : I<(outs pprty:$Pd), (ins pprty:$Pn, pprty:$Pm),
4260 asm, "\t$Pd, $Pn, $Pm",
4266 let Inst{31-24} = 0b00000101;
4267 let Inst{23-22} = sz8_64;
4268 let Inst{21-20} = 0b10;
4269 let Inst{19-16} = Pm;
4270 let Inst{15-13} = 0b010;
4271 let Inst{12-10} = opc;
4278 multiclass sve_int_perm_bin_perm_pp<bits<3> opc, string asm> {
4279 def _B : sve_int_perm_bin_perm_pp<opc, 0b00, asm, PPR8>;
4280 def _H : sve_int_perm_bin_perm_pp<opc, 0b01, asm, PPR16>;
4281 def _S : sve_int_perm_bin_perm_pp<opc, 0b10, asm, PPR32>;
4282 def _D : sve_int_perm_bin_perm_pp<opc, 0b11, asm, PPR64>;
4285 class sve_int_perm_punpk<bit opc, string asm>
4286 : I<(outs PPR16:$Pd), (ins PPR8:$Pn),
4292 let Inst{31-17} = 0b000001010011000;
4294 let Inst{15-9} = 0b0100000;
4300 multiclass sve_int_perm_punpk<bit opc, string asm, SDPatternOperator op> {
4301 def NAME : sve_int_perm_punpk<opc, asm>;
4303 def : SVE_1_Op_Pat<nxv8i1, op, nxv16i1, !cast<Instruction>(NAME)>;
4304 def : SVE_1_Op_Pat<nxv4i1, op, nxv8i1, !cast<Instruction>(NAME)>;
4305 def : SVE_1_Op_Pat<nxv2i1, op, nxv4i1, !cast<Instruction>(NAME)>;
4308 class sve_int_rdffr_pred<bit s, string asm>
4309 : I<(outs PPR8:$Pd), (ins PPRAny:$Pg),
4310 asm, "\t$Pd, $Pg/z",
4315 let Inst{31-23} = 0b001001010;
4317 let Inst{21-9} = 0b0110001111000;
4322 let Defs = !if(!eq (s, 1), [NZCV], []);
4326 class sve_int_rdffr_unpred<string asm> : I<
4327 (outs PPR8:$Pd), (ins),
4332 let Inst{31-4} = 0b0010010100011001111100000000;
4338 class sve_int_wrffr<string asm>
4339 : I<(outs), (ins PPR8:$Pn),
4344 let Inst{31-9} = 0b00100101001010001001000;
4346 let Inst{4-0} = 0b00000;
4348 let hasSideEffects = 1;
4352 class sve_int_setffr<string asm>
4357 let Inst{31-0} = 0b00100101001011001001000000000000;
4359 let hasSideEffects = 1;
4363 //===----------------------------------------------------------------------===//
4364 // SVE Permute Vector - Predicated Group
4365 //===----------------------------------------------------------------------===//
4367 class sve_int_perm_clast_rz<bits<2> sz8_64, bit ab, string asm,
4368 ZPRRegOp zprty, RegisterClass rt>
4369 : I<(outs rt:$Rdn), (ins PPR3bAny:$Pg, rt:$_Rdn, zprty:$Zm),
4370 asm, "\t$Rdn, $Pg, $_Rdn, $Zm",
4376 let Inst{31-24} = 0b00000101;
4377 let Inst{23-22} = sz8_64;
4378 let Inst{21-17} = 0b11000;
4380 let Inst{15-13} = 0b101;
4381 let Inst{12-10} = Pg;
4383 let Inst{4-0} = Rdn;
4385 let Constraints = "$Rdn = $_Rdn";
4388 multiclass sve_int_perm_clast_rz<bit ab, string asm> {
4389 def _B : sve_int_perm_clast_rz<0b00, ab, asm, ZPR8, GPR32>;
4390 def _H : sve_int_perm_clast_rz<0b01, ab, asm, ZPR16, GPR32>;
4391 def _S : sve_int_perm_clast_rz<0b10, ab, asm, ZPR32, GPR32>;
4392 def _D : sve_int_perm_clast_rz<0b11, ab, asm, ZPR64, GPR64>;
4395 class sve_int_perm_clast_vz<bits<2> sz8_64, bit ab, string asm,
4396 ZPRRegOp zprty, RegisterClass rt>
4397 : I<(outs rt:$Vdn), (ins PPR3bAny:$Pg, rt:$_Vdn, zprty:$Zm),
4398 asm, "\t$Vdn, $Pg, $_Vdn, $Zm",
4404 let Inst{31-24} = 0b00000101;
4405 let Inst{23-22} = sz8_64;
4406 let Inst{21-17} = 0b10101;
4408 let Inst{15-13} = 0b100;
4409 let Inst{12-10} = Pg;
4411 let Inst{4-0} = Vdn;
4413 let Constraints = "$Vdn = $_Vdn";
4416 multiclass sve_int_perm_clast_vz<bit ab, string asm> {
4417 def _B : sve_int_perm_clast_vz<0b00, ab, asm, ZPR8, FPR8>;
4418 def _H : sve_int_perm_clast_vz<0b01, ab, asm, ZPR16, FPR16>;
4419 def _S : sve_int_perm_clast_vz<0b10, ab, asm, ZPR32, FPR32>;
4420 def _D : sve_int_perm_clast_vz<0b11, ab, asm, ZPR64, FPR64>;
4423 class sve_int_perm_clast_zz<bits<2> sz8_64, bit ab, string asm,
4425 : I<(outs zprty:$Zdn), (ins PPR3bAny:$Pg, zprty:$_Zdn, zprty:$Zm),
4426 asm, "\t$Zdn, $Pg, $_Zdn, $Zm",
4432 let Inst{31-24} = 0b00000101;
4433 let Inst{23-22} = sz8_64;
4434 let Inst{21-17} = 0b10100;
4436 let Inst{15-13} = 0b100;
4437 let Inst{12-10} = Pg;
4439 let Inst{4-0} = Zdn;
4441 let Constraints = "$Zdn = $_Zdn";
4442 let DestructiveInstType = Destructive;
4443 let ElementSize = ElementSizeNone;
4446 multiclass sve_int_perm_clast_zz<bit ab, string asm> {
4447 def _B : sve_int_perm_clast_zz<0b00, ab, asm, ZPR8>;
4448 def _H : sve_int_perm_clast_zz<0b01, ab, asm, ZPR16>;
4449 def _S : sve_int_perm_clast_zz<0b10, ab, asm, ZPR32>;
4450 def _D : sve_int_perm_clast_zz<0b11, ab, asm, ZPR64>;
4453 class sve_int_perm_last_r<bits<2> sz8_64, bit ab, string asm,
4454 ZPRRegOp zprty, RegisterClass resultRegType>
4455 : I<(outs resultRegType:$Rd), (ins PPR3bAny:$Pg, zprty:$Zn),
4456 asm, "\t$Rd, $Pg, $Zn",
4462 let Inst{31-24} = 0b00000101;
4463 let Inst{23-22} = sz8_64;
4464 let Inst{21-17} = 0b10000;
4466 let Inst{15-13} = 0b101;
4467 let Inst{12-10} = Pg;
4472 multiclass sve_int_perm_last_r<bit ab, string asm> {
4473 def _B : sve_int_perm_last_r<0b00, ab, asm, ZPR8, GPR32>;
4474 def _H : sve_int_perm_last_r<0b01, ab, asm, ZPR16, GPR32>;
4475 def _S : sve_int_perm_last_r<0b10, ab, asm, ZPR32, GPR32>;
4476 def _D : sve_int_perm_last_r<0b11, ab, asm, ZPR64, GPR64>;
4479 class sve_int_perm_last_v<bits<2> sz8_64, bit ab, string asm,
4480 ZPRRegOp zprty, RegisterClass dstRegtype>
4481 : I<(outs dstRegtype:$Vd), (ins PPR3bAny:$Pg, zprty:$Zn),
4482 asm, "\t$Vd, $Pg, $Zn",
4488 let Inst{31-24} = 0b00000101;
4489 let Inst{23-22} = sz8_64;
4490 let Inst{21-17} = 0b10001;
4492 let Inst{15-13} = 0b100;
4493 let Inst{12-10} = Pg;
4498 multiclass sve_int_perm_last_v<bit ab, string asm> {
4499 def _B : sve_int_perm_last_v<0b00, ab, asm, ZPR8, FPR8>;
4500 def _H : sve_int_perm_last_v<0b01, ab, asm, ZPR16, FPR16>;
4501 def _S : sve_int_perm_last_v<0b10, ab, asm, ZPR32, FPR32>;
4502 def _D : sve_int_perm_last_v<0b11, ab, asm, ZPR64, FPR64>;
4505 class sve_int_perm_splice<bits<2> sz8_64, string asm, ZPRRegOp zprty>
4506 : I<(outs zprty:$Zdn), (ins PPR3bAny:$Pg, zprty:$_Zdn, zprty:$Zm),
4507 asm, "\t$Zdn, $Pg, $_Zdn, $Zm",
4513 let Inst{31-24} = 0b00000101;
4514 let Inst{23-22} = sz8_64;
4515 let Inst{21-13} = 0b101100100;
4516 let Inst{12-10} = Pg;
4518 let Inst{4-0} = Zdn;
4520 let Constraints = "$Zdn = $_Zdn";
4521 let DestructiveInstType = Destructive;
4522 let ElementSize = ElementSizeNone;
4525 multiclass sve_int_perm_splice<string asm> {
4526 def _B : sve_int_perm_splice<0b00, asm, ZPR8>;
4527 def _H : sve_int_perm_splice<0b01, asm, ZPR16>;
4528 def _S : sve_int_perm_splice<0b10, asm, ZPR32>;
4529 def _D : sve_int_perm_splice<0b11, asm, ZPR64>;
4532 class sve2_int_perm_splice_cons<bits<2> sz8_64, string asm,
4533 ZPRRegOp zprty, RegisterOperand VecList>
4534 : I<(outs zprty:$Zd), (ins PPR3bAny:$Pg, VecList:$Zn),
4535 asm, "\t$Zd, $Pg, $Zn",
4541 let Inst{31-24} = 0b00000101;
4542 let Inst{23-22} = sz8_64;
4543 let Inst{21-13} = 0b101101100;
4544 let Inst{12-10} = Pg;
4549 multiclass sve2_int_perm_splice_cons<string asm> {
4550 def _B : sve2_int_perm_splice_cons<0b00, asm, ZPR8, ZZ_b>;
4551 def _H : sve2_int_perm_splice_cons<0b01, asm, ZPR16, ZZ_h>;
4552 def _S : sve2_int_perm_splice_cons<0b10, asm, ZPR32, ZZ_s>;
4553 def _D : sve2_int_perm_splice_cons<0b11, asm, ZPR64, ZZ_d>;
4556 class sve_int_perm_rev<bits<2> sz8_64, bits<2> opc, string asm,
4558 : I<(outs zprty:$Zd), (ins zprty:$_Zd, PPR3bAny:$Pg, zprty:$Zn),
4559 asm, "\t$Zd, $Pg/m, $Zn",
4565 let Inst{31-24} = 0b00000101;
4566 let Inst{23-22} = sz8_64;
4567 let Inst{21-18} = 0b1001;
4568 let Inst{17-16} = opc;
4569 let Inst{15-13} = 0b100;
4570 let Inst{12-10} = Pg;
4574 let Constraints = "$Zd = $_Zd";
4575 let DestructiveInstType = Destructive;
4576 let ElementSize = zprty.ElementSize;
4579 multiclass sve_int_perm_rev_rbit<string asm> {
4580 def _B : sve_int_perm_rev<0b00, 0b11, asm, ZPR8>;
4581 def _H : sve_int_perm_rev<0b01, 0b11, asm, ZPR16>;
4582 def _S : sve_int_perm_rev<0b10, 0b11, asm, ZPR32>;
4583 def _D : sve_int_perm_rev<0b11, 0b11, asm, ZPR64>;
4586 multiclass sve_int_perm_rev_revb<string asm> {
4587 def _H : sve_int_perm_rev<0b01, 0b00, asm, ZPR16>;
4588 def _S : sve_int_perm_rev<0b10, 0b00, asm, ZPR32>;
4589 def _D : sve_int_perm_rev<0b11, 0b00, asm, ZPR64>;
4592 multiclass sve_int_perm_rev_revh<string asm> {
4593 def _S : sve_int_perm_rev<0b10, 0b01, asm, ZPR32>;
4594 def _D : sve_int_perm_rev<0b11, 0b01, asm, ZPR64>;
4597 multiclass sve_int_perm_rev_revw<string asm> {
4598 def _D : sve_int_perm_rev<0b11, 0b10, asm, ZPR64>;
4601 class sve_int_perm_cpy_r<bits<2> sz8_64, string asm, ZPRRegOp zprty,
4602 RegisterClass srcRegType>
4603 : I<(outs zprty:$Zd), (ins zprty:$_Zd, PPR3bAny:$Pg, srcRegType:$Rn),
4604 asm, "\t$Zd, $Pg/m, $Rn",
4610 let Inst{31-24} = 0b00000101;
4611 let Inst{23-22} = sz8_64;
4612 let Inst{21-13} = 0b101000101;
4613 let Inst{12-10} = Pg;
4617 let Constraints = "$Zd = $_Zd";
4618 let DestructiveInstType = Destructive;
4619 let ElementSize = zprty.ElementSize;
4622 multiclass sve_int_perm_cpy_r<string asm> {
4623 def _B : sve_int_perm_cpy_r<0b00, asm, ZPR8, GPR32sp>;
4624 def _H : sve_int_perm_cpy_r<0b01, asm, ZPR16, GPR32sp>;
4625 def _S : sve_int_perm_cpy_r<0b10, asm, ZPR32, GPR32sp>;
4626 def _D : sve_int_perm_cpy_r<0b11, asm, ZPR64, GPR64sp>;
4628 def : InstAlias<"mov $Zd, $Pg/m, $Rn",
4629 (!cast<Instruction>(NAME # _B) ZPR8:$Zd, PPR3bAny:$Pg, GPR32sp:$Rn), 1>;
4630 def : InstAlias<"mov $Zd, $Pg/m, $Rn",
4631 (!cast<Instruction>(NAME # _H) ZPR16:$Zd, PPR3bAny:$Pg, GPR32sp:$Rn), 1>;
4632 def : InstAlias<"mov $Zd, $Pg/m, $Rn",
4633 (!cast<Instruction>(NAME # _S) ZPR32:$Zd, PPR3bAny:$Pg, GPR32sp:$Rn), 1>;
4634 def : InstAlias<"mov $Zd, $Pg/m, $Rn",
4635 (!cast<Instruction>(NAME # _D) ZPR64:$Zd, PPR3bAny:$Pg, GPR64sp:$Rn), 1>;
4638 class sve_int_perm_cpy_v<bits<2> sz8_64, string asm, ZPRRegOp zprty,
4639 RegisterClass srcRegtype>
4640 : I<(outs zprty:$Zd), (ins zprty:$_Zd, PPR3bAny:$Pg, srcRegtype:$Vn),
4641 asm, "\t$Zd, $Pg/m, $Vn",
4647 let Inst{31-24} = 0b00000101;
4648 let Inst{23-22} = sz8_64;
4649 let Inst{21-13} = 0b100000100;
4650 let Inst{12-10} = Pg;
4654 let Constraints = "$Zd = $_Zd";
4655 let DestructiveInstType = Destructive;
4656 let ElementSize = zprty.ElementSize;
4659 multiclass sve_int_perm_cpy_v<string asm> {
4660 def _B : sve_int_perm_cpy_v<0b00, asm, ZPR8, FPR8>;
4661 def _H : sve_int_perm_cpy_v<0b01, asm, ZPR16, FPR16>;
4662 def _S : sve_int_perm_cpy_v<0b10, asm, ZPR32, FPR32>;
4663 def _D : sve_int_perm_cpy_v<0b11, asm, ZPR64, FPR64>;
4665 def : InstAlias<"mov $Zd, $Pg/m, $Vn",
4666 (!cast<Instruction>(NAME # _B) ZPR8:$Zd, PPR3bAny:$Pg, FPR8:$Vn), 1>;
4667 def : InstAlias<"mov $Zd, $Pg/m, $Vn",
4668 (!cast<Instruction>(NAME # _H) ZPR16:$Zd, PPR3bAny:$Pg, FPR16:$Vn), 1>;
4669 def : InstAlias<"mov $Zd, $Pg/m, $Vn",
4670 (!cast<Instruction>(NAME # _S) ZPR32:$Zd, PPR3bAny:$Pg, FPR32:$Vn), 1>;
4671 def : InstAlias<"mov $Zd, $Pg/m, $Vn",
4672 (!cast<Instruction>(NAME # _D) ZPR64:$Zd, PPR3bAny:$Pg, FPR64:$Vn), 1>;
4675 class sve_int_perm_compact<bit sz, string asm, ZPRRegOp zprty>
4676 : I<(outs zprty:$Zd), (ins PPR3bAny:$Pg, zprty:$Zn),
4677 asm, "\t$Zd, $Pg, $Zn",
4683 let Inst{31-23} = 0b000001011;
4685 let Inst{21-13} = 0b100001100;
4686 let Inst{12-10} = Pg;
4691 multiclass sve_int_perm_compact<string asm> {
4692 def _S : sve_int_perm_compact<0b0, asm, ZPR32>;
4693 def _D : sve_int_perm_compact<0b1, asm, ZPR64>;
4697 //===----------------------------------------------------------------------===//
4698 // SVE Memory - Contiguous Load Group
4699 //===----------------------------------------------------------------------===//
4701 class sve_mem_cld_si_base<bits<4> dtype, bit nf, string asm,
4702 RegisterOperand VecList>
4703 : I<(outs VecList:$Zt), (ins PPR3bAny:$Pg, GPR64sp:$Rn, simm4s1:$imm4),
4704 asm, "\t$Zt, $Pg/z, [$Rn, $imm4, mul vl]",
4711 let Inst{31-25} = 0b1010010;
4712 let Inst{24-21} = dtype;
4714 let Inst{19-16} = imm4;
4715 let Inst{15-13} = 0b101;
4716 let Inst{12-10} = Pg;
4721 let Uses = !if(!eq(nf, 1), [FFR], []);
4722 let Defs = !if(!eq(nf, 1), [FFR], []);
4725 multiclass sve_mem_cld_si_base<bits<4> dtype, bit nf, string asm,
4726 RegisterOperand listty, ZPRRegOp zprty> {
4727 def _REAL : sve_mem_cld_si_base<dtype, nf, asm, listty>;
4729 def : InstAlias<asm # "\t$Zt, $Pg/z, [$Rn]",
4730 (!cast<Instruction>(NAME # _REAL) zprty:$Zt, PPR3bAny:$Pg, GPR64sp:$Rn, 0), 0>;
4731 def : InstAlias<asm # "\t$Zt, $Pg/z, [$Rn, $imm4, mul vl]",
4732 (!cast<Instruction>(NAME # _REAL) zprty:$Zt, PPR3bAny:$Pg, GPR64sp:$Rn, simm4s1:$imm4), 0>;
4733 def : InstAlias<asm # "\t$Zt, $Pg/z, [$Rn]",
4734 (!cast<Instruction>(NAME # _REAL) listty:$Zt, PPR3bAny:$Pg, GPR64sp:$Rn, 0), 1>;
4737 multiclass sve_mem_cld_si<bits<4> dtype, string asm, RegisterOperand listty,
4739 : sve_mem_cld_si_base<dtype, 0, asm, listty, zprty>;
4741 class sve_mem_cldnt_si_base<bits<2> msz, string asm, RegisterOperand VecList>
4742 : I<(outs VecList:$Zt), (ins PPR3bAny:$Pg, GPR64sp:$Rn, simm4s1:$imm4),
4743 asm, "\t$Zt, $Pg/z, [$Rn, $imm4, mul vl]",
4750 let Inst{31-25} = 0b1010010;
4751 let Inst{24-23} = msz;
4752 let Inst{22-20} = 0b000;
4753 let Inst{19-16} = imm4;
4754 let Inst{15-13} = 0b111;
4755 let Inst{12-10} = Pg;
4762 multiclass sve_mem_cldnt_si<bits<2> msz, string asm, RegisterOperand listty,
4764 def NAME : sve_mem_cldnt_si_base<msz, asm, listty>;
4766 def : InstAlias<asm # "\t$Zt, $Pg/z, [$Rn]",
4767 (!cast<Instruction>(NAME) zprty:$Zt, PPR3bAny:$Pg, GPR64sp:$Rn, 0), 0>;
4768 def : InstAlias<asm # "\t$Zt, $Pg/z, [$Rn, $imm4, mul vl]",
4769 (!cast<Instruction>(NAME) zprty:$Zt, PPR3bAny:$Pg, GPR64sp:$Rn, simm4s1:$imm4), 0>;
4770 def : InstAlias<asm # "\t$Zt, $Pg/z, [$Rn]",
4771 (!cast<Instruction>(NAME) listty:$Zt, PPR3bAny:$Pg, GPR64sp:$Rn, 0), 1>;
4774 class sve_mem_cldnt_ss_base<bits<2> msz, string asm, RegisterOperand VecList,
4775 RegisterOperand gprty>
4776 : I<(outs VecList:$Zt), (ins PPR3bAny:$Pg, GPR64sp:$Rn, gprty:$Rm),
4777 asm, "\t$Zt, $Pg/z, [$Rn, $Rm]",
4784 let Inst{31-25} = 0b1010010;
4785 let Inst{24-23} = msz;
4786 let Inst{22-21} = 0b00;
4787 let Inst{20-16} = Rm;
4788 let Inst{15-13} = 0b110;
4789 let Inst{12-10} = Pg;
4796 multiclass sve_mem_cldnt_ss<bits<2> msz, string asm, RegisterOperand listty,
4797 ZPRRegOp zprty, RegisterOperand gprty> {
4798 def NAME : sve_mem_cldnt_ss_base<msz, asm, listty, gprty>;
4800 def : InstAlias<asm # "\t$Zt, $Pg/z, [$Rn, $Rm]",
4801 (!cast<Instruction>(NAME) zprty:$Zt, PPR3bAny:$Pg, GPR64sp:$Rn, gprty:$Rm), 0>;
4804 class sve_mem_ldqr_si<bits<2> sz, string asm, RegisterOperand VecList>
4805 : I<(outs VecList:$Zt), (ins PPR3bAny:$Pg, GPR64sp:$Rn, simm4s16:$imm4),
4806 asm, "\t$Zt, $Pg/z, [$Rn, $imm4]", "", []>, Sched<[]> {
4811 let Inst{31-25} = 0b1010010;
4812 let Inst{24-23} = sz;
4813 let Inst{22-20} = 0;
4814 let Inst{19-16} = imm4;
4815 let Inst{15-13} = 0b001;
4816 let Inst{12-10} = Pg;
4823 multiclass sve_mem_ldqr_si<bits<2> sz, string asm, RegisterOperand listty,
4825 def NAME : sve_mem_ldqr_si<sz, asm, listty>;
4826 def : InstAlias<asm # "\t$Zt, $Pg/z, [$Rn]",
4827 (!cast<Instruction>(NAME) listty:$Zt, PPR3bAny:$Pg, GPR64sp:$Rn, 0), 1>;
4828 def : InstAlias<asm # "\t$Zt, $Pg/z, [$Rn]",
4829 (!cast<Instruction>(NAME) zprty:$Zt, PPR3bAny:$Pg, GPR64sp:$Rn, 0), 0>;
4830 def : InstAlias<asm # "\t$Zt, $Pg/z, [$Rn, $imm4]",
4831 (!cast<Instruction>(NAME) zprty:$Zt, PPR3bAny:$Pg, GPR64sp:$Rn, simm4s16:$imm4), 0>;
4834 class sve_mem_ldqr_ss<bits<2> sz, string asm, RegisterOperand VecList,
4835 RegisterOperand gprty>
4836 : I<(outs VecList:$Zt), (ins PPR3bAny:$Pg, GPR64sp:$Rn, gprty:$Rm),
4837 asm, "\t$Zt, $Pg/z, [$Rn, $Rm]", "", []>, Sched<[]> {
4842 let Inst{31-25} = 0b1010010;
4843 let Inst{24-23} = sz;
4844 let Inst{22-21} = 0;
4845 let Inst{20-16} = Rm;
4846 let Inst{15-13} = 0;
4847 let Inst{12-10} = Pg;
4854 multiclass sve_mem_ldqr_ss<bits<2> sz, string asm, RegisterOperand listty,
4855 ZPRRegOp zprty, RegisterOperand gprty> {
4856 def NAME : sve_mem_ldqr_ss<sz, asm, listty, gprty>;
4858 def : InstAlias<asm # "\t$Zt, $Pg/z, [$Rn, $Rm]",
4859 (!cast<Instruction>(NAME) zprty:$Zt, PPR3bAny:$Pg, GPR64sp:$Rn, gprty:$Rm), 0>;
4862 class sve_mem_ld_dup<bits<2> dtypeh, bits<2> dtypel, string asm,
4863 RegisterOperand VecList, Operand immtype>
4864 : I<(outs VecList:$Zt), (ins PPR3bAny:$Pg, GPR64sp:$Rn, immtype:$imm6),
4865 asm, "\t$Zt, $Pg/z, [$Rn, $imm6]",
4872 let Inst{31-25} = 0b1000010;
4873 let Inst{24-23} = dtypeh;
4875 let Inst{21-16} = imm6;
4877 let Inst{14-13} = dtypel;
4878 let Inst{12-10} = Pg;
4885 multiclass sve_mem_ld_dup<bits<2> dtypeh, bits<2> dtypel, string asm,
4886 RegisterOperand zlistty, ZPRRegOp zprty, Operand immtype> {
4887 def NAME : sve_mem_ld_dup<dtypeh, dtypel, asm, zlistty, immtype>;
4889 def : InstAlias<asm # "\t$Zt, $Pg/z, [$Rn]",
4890 (!cast<Instruction>(NAME) zprty:$Zt, PPR3bAny:$Pg, GPR64sp:$Rn, 0), 0>;
4891 def : InstAlias<asm # "\t$Zt, $Pg/z, [$Rn, $imm6]",
4892 (!cast<Instruction>(NAME) zprty:$Zt, PPR3bAny:$Pg, GPR64sp:$Rn, immtype:$imm6), 0>;
4893 def : InstAlias<asm # "\t$Zt, $Pg/z, [$Rn]",
4894 (!cast<Instruction>(NAME) zlistty:$Zt, PPR3bAny:$Pg, GPR64sp:$Rn, 0), 1>;
4897 class sve_mem_cld_ss_base<bits<4> dtype, bit ff, dag iops, string asm,
4898 RegisterOperand VecList>
4899 : I<(outs VecList:$Zt), iops,
4900 asm, "\t$Zt, $Pg/z, [$Rn, $Rm]",
4907 let Inst{31-25} = 0b1010010;
4908 let Inst{24-21} = dtype;
4909 let Inst{20-16} = Rm;
4910 let Inst{15-14} = 0b01;
4912 let Inst{12-10} = Pg;
4917 let Uses = !if(!eq(ff, 1), [FFR], []);
4918 let Defs = !if(!eq(ff, 1), [FFR], []);
4921 multiclass sve_mem_cld_ss<bits<4> dtype, string asm, RegisterOperand listty,
4922 ZPRRegOp zprty, RegisterOperand gprty> {
4923 def "" : sve_mem_cld_ss_base<dtype, 0, (ins PPR3bAny:$Pg, GPR64sp:$Rn, gprty:$Rm),
4926 def : InstAlias<asm # "\t$Zt, $Pg/z, [$Rn, $Rm]",
4927 (!cast<Instruction>(NAME) zprty:$Zt, PPR3bAny:$Pg, GPR64sp:$Rn, gprty:$Rm), 0>;
4930 multiclass sve_mem_cldff_ss<bits<4> dtype, string asm, RegisterOperand listty,
4931 ZPRRegOp zprty, RegisterOperand gprty> {
4932 def _REAL : sve_mem_cld_ss_base<dtype, 1, (ins PPR3bAny:$Pg, GPR64sp:$Rn, gprty:$Rm),
4935 def : InstAlias<asm # "\t$Zt, $Pg/z, [$Rn, $Rm]",
4936 (!cast<Instruction>(NAME # _REAL) zprty:$Zt, PPR3bAny:$Pg, GPR64sp:$Rn, gprty:$Rm), 0>;
4938 def : InstAlias<asm # "\t$Zt, $Pg/z, [$Rn]",
4939 (!cast<Instruction>(NAME # _REAL) listty:$Zt, PPR3bAny:$Pg, GPR64sp:$Rn, XZR), 1>;
4941 def : InstAlias<asm # "\t$Zt, $Pg/z, [$Rn]",
4942 (!cast<Instruction>(NAME # _REAL) zprty:$Zt, PPR3bAny:$Pg, GPR64sp:$Rn, XZR), 0>;
4945 multiclass sve_mem_cldnf_si<bits<4> dtype, string asm, RegisterOperand listty,
4947 : sve_mem_cld_si_base<dtype, 1, asm, listty, zprty>;
4949 class sve_mem_eld_si<bits<2> sz, bits<2> nregs, RegisterOperand VecList,
4950 string asm, Operand immtype>
4951 : I<(outs VecList:$Zt), (ins PPR3bAny:$Pg, GPR64sp:$Rn, immtype:$imm4),
4952 asm, "\t$Zt, $Pg/z, [$Rn, $imm4, mul vl]",
4959 let Inst{31-25} = 0b1010010;
4960 let Inst{24-23} = sz;
4961 let Inst{22-21} = nregs;
4963 let Inst{19-16} = imm4;
4964 let Inst{15-13} = 0b111;
4965 let Inst{12-10} = Pg;
4972 multiclass sve_mem_eld_si<bits<2> sz, bits<2> nregs, RegisterOperand VecList,
4973 string asm, Operand immtype> {
4974 def NAME : sve_mem_eld_si<sz, nregs, VecList, asm, immtype>;
4976 def : InstAlias<asm # "\t$Zt, $Pg/z, [$Rn]",
4977 (!cast<Instruction>(NAME) VecList:$Zt, PPR3bAny:$Pg, GPR64sp:$Rn, 0), 1>;
4980 class sve_mem_eld_ss<bits<2> sz, bits<2> nregs, RegisterOperand VecList,
4981 string asm, RegisterOperand gprty>
4982 : I<(outs VecList:$Zt), (ins PPR3bAny:$Pg, GPR64sp:$Rn, gprty:$Rm),
4983 asm, "\t$Zt, $Pg/z, [$Rn, $Rm]",
4990 let Inst{31-25} = 0b1010010;
4991 let Inst{24-23} = sz;
4992 let Inst{22-21} = nregs;
4993 let Inst{20-16} = Rm;
4994 let Inst{15-13} = 0b110;
4995 let Inst{12-10} = Pg;
5002 //===----------------------------------------------------------------------===//
5003 // SVE Memory - 32-bit Gather and Unsized Contiguous Group
5004 //===----------------------------------------------------------------------===//
5006 // bit xs is '1' if offsets are signed
5007 // bit scaled is '1' if the offsets are scaled
5008 class sve_mem_32b_gld_sv<bits<4> opc, bit xs, bit scaled, string asm,
5009 RegisterOperand zprext>
5010 : I<(outs Z_s:$Zt), (ins PPR3bAny:$Pg, GPR64sp:$Rn, zprext:$Zm),
5011 asm, "\t$Zt, $Pg/z, [$Rn, $Zm]",
5018 let Inst{31-25} = 0b1000010;
5019 let Inst{24-23} = opc{3-2};
5021 let Inst{21} = scaled;
5022 let Inst{20-16} = Zm;
5024 let Inst{14-13} = opc{1-0};
5025 let Inst{12-10} = Pg;
5030 let Defs = !if(!eq(opc{0}, 1), [FFR], []);
5031 let Uses = !if(!eq(opc{0}, 1), [FFR], []);
5034 multiclass sve_mem_32b_gld_sv_32_scaled<bits<4> opc, string asm,
5035 RegisterOperand sxtw_opnd,
5036 RegisterOperand uxtw_opnd> {
5037 def _UXTW_SCALED_REAL : sve_mem_32b_gld_sv<opc, 0, 1, asm, uxtw_opnd>;
5038 def _SXTW_SCALED_REAL : sve_mem_32b_gld_sv<opc, 1, 1, asm, sxtw_opnd>;
5040 def : InstAlias<asm # "\t$Zt, $Pg/z, [$Rn, $Zm]",
5041 (!cast<Instruction>(NAME # _UXTW_SCALED_REAL) ZPR32:$Zt, PPR3bAny:$Pg, GPR64sp:$Rn, uxtw_opnd:$Zm), 0>;
5042 def : InstAlias<asm # "\t$Zt, $Pg/z, [$Rn, $Zm]",
5043 (!cast<Instruction>(NAME # _SXTW_SCALED_REAL) ZPR32:$Zt, PPR3bAny:$Pg, GPR64sp:$Rn, sxtw_opnd:$Zm), 0>;
5046 multiclass sve_mem_32b_gld_vs_32_unscaled<bits<4> opc, string asm,
5047 RegisterOperand sxtw_opnd,
5048 RegisterOperand uxtw_opnd> {
5049 def _UXTW_REAL : sve_mem_32b_gld_sv<opc, 0, 0, asm, uxtw_opnd>;
5050 def _SXTW_REAL : sve_mem_32b_gld_sv<opc, 1, 0, asm, sxtw_opnd>;
5052 def : InstAlias<asm # "\t$Zt, $Pg/z, [$Rn, $Zm]",
5053 (!cast<Instruction>(NAME # _UXTW_REAL) ZPR32:$Zt, PPR3bAny:$Pg, GPR64sp:$Rn, uxtw_opnd:$Zm), 0>;
5054 def : InstAlias<asm # "\t$Zt, $Pg/z, [$Rn, $Zm]",
5055 (!cast<Instruction>(NAME # _SXTW_REAL) ZPR32:$Zt, PPR3bAny:$Pg, GPR64sp:$Rn, sxtw_opnd:$Zm), 0>;
5059 class sve_mem_32b_gld_vi<bits<4> opc, string asm, Operand imm_ty>
5060 : I<(outs Z_s:$Zt), (ins PPR3bAny:$Pg, ZPR32:$Zn, imm_ty:$imm5),
5061 asm, "\t$Zt, $Pg/z, [$Zn, $imm5]",
5068 let Inst{31-25} = 0b1000010;
5069 let Inst{24-23} = opc{3-2};
5070 let Inst{22-21} = 0b01;
5071 let Inst{20-16} = imm5;
5073 let Inst{14-13} = opc{1-0};
5074 let Inst{12-10} = Pg;
5079 let Defs = !if(!eq(opc{0}, 1), [FFR], []);
5080 let Uses = !if(!eq(opc{0}, 1), [FFR], []);
5083 multiclass sve_mem_32b_gld_vi_32_ptrs<bits<4> opc, string asm, Operand imm_ty> {
5084 def _IMM_REAL : sve_mem_32b_gld_vi<opc, asm, imm_ty>;
5086 def : InstAlias<asm # "\t$Zt, $Pg/z, [$Zn]",
5087 (!cast<Instruction>(NAME # _IMM_REAL) ZPR32:$Zt, PPR3bAny:$Pg, ZPR32:$Zn, 0), 0>;
5088 def : InstAlias<asm # "\t$Zt, $Pg/z, [$Zn, $imm5]",
5089 (!cast<Instruction>(NAME # _IMM_REAL) ZPR32:$Zt, PPR3bAny:$Pg, ZPR32:$Zn, imm_ty:$imm5), 0>;
5090 def : InstAlias<asm # "\t$Zt, $Pg/z, [$Zn]",
5091 (!cast<Instruction>(NAME # _IMM_REAL) Z_s:$Zt, PPR3bAny:$Pg, ZPR32:$Zn, 0), 1>;
5094 class sve_mem_prfm_si<bits<2> msz, string asm>
5095 : I<(outs), (ins sve_prfop:$prfop, PPR3bAny:$Pg, GPR64sp:$Rn, simm6s1:$imm6),
5096 asm, "\t$prfop, $Pg, [$Rn, $imm6, mul vl]",
5103 let Inst{31-22} = 0b1000010111;
5104 let Inst{21-16} = imm6;
5106 let Inst{14-13} = msz;
5107 let Inst{12-10} = Pg;
5110 let Inst{3-0} = prfop;
5112 let hasSideEffects = 1;
5115 multiclass sve_mem_prfm_si<bits<2> msz, string asm> {
5116 def NAME : sve_mem_prfm_si<msz, asm>;
5118 def : InstAlias<asm # "\t$prfop, $Pg, [$Rn]",
5119 (!cast<Instruction>(NAME) sve_prfop:$prfop, PPR3bAny:$Pg, GPR64sp:$Rn, 0), 1>;
5122 class sve_mem_prfm_ss<bits<3> opc, string asm, RegisterOperand gprty>
5123 : I<(outs), (ins sve_prfop:$prfop, PPR3bAny:$Pg, GPR64sp:$Rn, gprty:$Rm),
5124 asm, "\t$prfop, $Pg, [$Rn, $Rm]",
5131 let Inst{31-25} = 0b1000010;
5132 let Inst{24-23} = opc{2-1};
5133 let Inst{22-21} = 0b00;
5134 let Inst{20-16} = Rm;
5136 let Inst{14} = opc{0};
5138 let Inst{12-10} = Pg;
5141 let Inst{3-0} = prfop;
5143 let hasSideEffects = 1;
5146 class sve_mem_32b_prfm_sv<bits<2> msz, bit xs, string asm,
5147 RegisterOperand zprext>
5148 : I<(outs), (ins sve_prfop:$prfop, PPR3bAny:$Pg, GPR64sp:$Rn, zprext:$Zm),
5149 asm, "\t$prfop, $Pg, [$Rn, $Zm]",
5156 let Inst{31-23} = 0b100001000;
5159 let Inst{20-16} = Zm;
5161 let Inst{14-13} = msz;
5162 let Inst{12-10} = Pg;
5165 let Inst{3-0} = prfop;
5167 let hasSideEffects = 1;
5170 multiclass sve_mem_32b_prfm_sv_scaled<bits<2> msz, string asm,
5171 RegisterOperand sxtw_opnd,
5172 RegisterOperand uxtw_opnd> {
5173 def _UXTW_SCALED : sve_mem_32b_prfm_sv<msz, 0, asm, uxtw_opnd>;
5174 def _SXTW_SCALED : sve_mem_32b_prfm_sv<msz, 1, asm, sxtw_opnd>;
5177 class sve_mem_32b_prfm_vi<bits<2> msz, string asm, Operand imm_ty>
5178 : I<(outs), (ins sve_prfop:$prfop, PPR3bAny:$Pg, ZPR32:$Zn, imm_ty:$imm5),
5179 asm, "\t$prfop, $Pg, [$Zn, $imm5]",
5186 let Inst{31-25} = 0b1000010;
5187 let Inst{24-23} = msz;
5188 let Inst{22-21} = 0b00;
5189 let Inst{20-16} = imm5;
5190 let Inst{15-13} = 0b111;
5191 let Inst{12-10} = Pg;
5194 let Inst{3-0} = prfop;
5197 multiclass sve_mem_32b_prfm_vi<bits<2> msz, string asm, Operand imm_ty> {
5198 def NAME : sve_mem_32b_prfm_vi<msz, asm, imm_ty>;
5200 def : InstAlias<asm # "\t$prfop, $Pg, [$Zn]",
5201 (!cast<Instruction>(NAME) sve_prfop:$prfop, PPR3bAny:$Pg, ZPR32:$Zn, 0), 1>;
5204 class sve_mem_z_fill<string asm>
5205 : I<(outs ZPRAny:$Zt), (ins GPR64sp:$Rn, simm9:$imm9),
5206 asm, "\t$Zt, [$Rn, $imm9, mul vl]",
5212 let Inst{31-22} = 0b1000010110;
5213 let Inst{21-16} = imm9{8-3};
5214 let Inst{15-13} = 0b010;
5215 let Inst{12-10} = imm9{2-0};
5222 multiclass sve_mem_z_fill<string asm> {
5223 def NAME : sve_mem_z_fill<asm>;
5225 def : InstAlias<asm # "\t$Zt, [$Rn]",
5226 (!cast<Instruction>(NAME) ZPRAny:$Zt, GPR64sp:$Rn, 0), 1>;
5229 class sve_mem_p_fill<string asm>
5230 : I<(outs PPRAny:$Pt), (ins GPR64sp:$Rn, simm9:$imm9),
5231 asm, "\t$Pt, [$Rn, $imm9, mul vl]",
5237 let Inst{31-22} = 0b1000010110;
5238 let Inst{21-16} = imm9{8-3};
5239 let Inst{15-13} = 0b000;
5240 let Inst{12-10} = imm9{2-0};
5248 multiclass sve_mem_p_fill<string asm> {
5249 def NAME : sve_mem_p_fill<asm>;
5251 def : InstAlias<asm # "\t$Pt, [$Rn]",
5252 (!cast<Instruction>(NAME) PPRAny:$Pt, GPR64sp:$Rn, 0), 1>;
5255 class sve2_mem_gldnt_vs_base<bits<5> opc, dag iops, string asm,
5256 RegisterOperand VecList>
5257 : I<(outs VecList:$Zt), iops,
5258 asm, "\t$Zt, $Pg/z, [$Zn, $Rm]",
5266 let Inst{30} = opc{4};
5267 let Inst{29-25} = 0b00010;
5268 let Inst{24-23} = opc{3-2};
5269 let Inst{22-21} = 0b00;
5270 let Inst{20-16} = Rm;
5272 let Inst{14-13} = opc{1-0};
5273 let Inst{12-10} = Pg;
5280 multiclass sve2_mem_gldnt_vs<bits<5> opc, string asm,
5281 RegisterOperand listty, ZPRRegOp zprty> {
5282 def _REAL : sve2_mem_gldnt_vs_base<opc, (ins PPR3bAny:$Pg, zprty:$Zn, GPR64:$Rm),
5285 def : InstAlias<asm # "\t$Zt, $Pg/z, [$Zn, $Rm]",
5286 (!cast<Instruction>(NAME # _REAL) zprty:$Zt, PPR3bAny:$Pg, zprty:$Zn, GPR64:$Rm), 0>;
5287 def : InstAlias<asm # "\t$Zt, $Pg/z, [$Zn]",
5288 (!cast<Instruction>(NAME # _REAL) zprty:$Zt, PPR3bAny:$Pg, zprty:$Zn, XZR), 0>;
5289 def : InstAlias<asm # "\t$Zt, $Pg/z, [$Zn]",
5290 (!cast<Instruction>(NAME # _REAL) listty:$Zt, PPR3bAny:$Pg, zprty:$Zn, XZR), 1>;
5293 //===----------------------------------------------------------------------===//
5294 // SVE Memory - 64-bit Gather Group
5295 //===----------------------------------------------------------------------===//
5297 // bit xs is '1' if offsets are signed
5298 // bit scaled is '1' if the offsets are scaled
5299 // bit lsl is '0' if the offsets are extended (uxtw/sxtw), '1' if shifted (lsl)
5300 class sve_mem_64b_gld_sv<bits<4> opc, bit xs, bit scaled, bit lsl, string asm,
5301 RegisterOperand zprext>
5302 : I<(outs Z_d:$Zt), (ins PPR3bAny:$Pg, GPR64sp:$Rn, zprext:$Zm),
5303 asm, "\t$Zt, $Pg/z, [$Rn, $Zm]",
5310 let Inst{31-25} = 0b1100010;
5311 let Inst{24-23} = opc{3-2};
5313 let Inst{21} = scaled;
5314 let Inst{20-16} = Zm;
5316 let Inst{14-13} = opc{1-0};
5317 let Inst{12-10} = Pg;
5322 let Defs = !if(!eq(opc{0}, 1), [FFR], []);
5323 let Uses = !if(!eq(opc{0}, 1), [FFR], []);
5326 multiclass sve_mem_64b_gld_sv_32_scaled<bits<4> opc, string asm,
5327 RegisterOperand sxtw_opnd,
5328 RegisterOperand uxtw_opnd> {
5329 def _UXTW_SCALED_REAL : sve_mem_64b_gld_sv<opc, 0, 1, 0, asm, uxtw_opnd>;
5330 def _SXTW_SCALED_REAL : sve_mem_64b_gld_sv<opc, 1, 1, 0, asm, sxtw_opnd>;
5332 def : InstAlias<asm # "\t$Zt, $Pg/z, [$Rn, $Zm]",
5333 (!cast<Instruction>(NAME # _UXTW_SCALED_REAL) ZPR64:$Zt, PPR3bAny:$Pg, GPR64sp:$Rn, uxtw_opnd:$Zm), 0>;
5334 def : InstAlias<asm # "\t$Zt, $Pg/z, [$Rn, $Zm]",
5335 (!cast<Instruction>(NAME # _SXTW_SCALED_REAL) ZPR64:$Zt, PPR3bAny:$Pg, GPR64sp:$Rn, sxtw_opnd:$Zm), 0>;
5338 multiclass sve_mem_64b_gld_vs_32_unscaled<bits<4> opc, string asm,
5339 RegisterOperand sxtw_opnd,
5340 RegisterOperand uxtw_opnd> {
5341 def _UXTW_REAL : sve_mem_64b_gld_sv<opc, 0, 0, 0, asm, uxtw_opnd>;
5342 def _SXTW_REAL : sve_mem_64b_gld_sv<opc, 1, 0, 0, asm, sxtw_opnd>;
5344 def : InstAlias<asm # "\t$Zt, $Pg/z, [$Rn, $Zm]",
5345 (!cast<Instruction>(NAME # _UXTW_REAL) ZPR64:$Zt, PPR3bAny:$Pg, GPR64sp:$Rn, uxtw_opnd:$Zm), 0>;
5346 def : InstAlias<asm # "\t$Zt, $Pg/z, [$Rn, $Zm]",
5347 (!cast<Instruction>(NAME # _SXTW_REAL) ZPR64:$Zt, PPR3bAny:$Pg, GPR64sp:$Rn, sxtw_opnd:$Zm), 0>;
5350 multiclass sve_mem_64b_gld_sv2_64_scaled<bits<4> opc, string asm,
5351 RegisterOperand zprext> {
5352 def _SCALED_REAL : sve_mem_64b_gld_sv<opc, 1, 1, 1, asm, zprext>;
5354 def : InstAlias<asm # "\t$Zt, $Pg/z, [$Rn, $Zm]",
5355 (!cast<Instruction>(NAME # _SCALED_REAL) ZPR64:$Zt, PPR3bAny:$Pg, GPR64sp:$Rn, zprext:$Zm), 0>;
5358 multiclass sve_mem_64b_gld_vs2_64_unscaled<bits<4> opc, string asm> {
5359 def _REAL : sve_mem_64b_gld_sv<opc, 1, 0, 1, asm, ZPR64ExtLSL8>;
5361 def : InstAlias<asm # "\t$Zt, $Pg/z, [$Rn, $Zm]",
5362 (!cast<Instruction>(NAME # _REAL) ZPR64:$Zt, PPR3bAny:$Pg, GPR64sp:$Rn, ZPR64ExtLSL8:$Zm), 0>;
5365 class sve_mem_64b_gld_vi<bits<4> opc, string asm, Operand imm_ty>
5366 : I<(outs Z_d:$Zt), (ins PPR3bAny:$Pg, ZPR64:$Zn, imm_ty:$imm5),
5367 asm, "\t$Zt, $Pg/z, [$Zn, $imm5]",
5374 let Inst{31-25} = 0b1100010;
5375 let Inst{24-23} = opc{3-2};
5376 let Inst{22-21} = 0b01;
5377 let Inst{20-16} = imm5;
5379 let Inst{14-13} = opc{1-0};
5380 let Inst{12-10} = Pg;
5385 let Defs = !if(!eq(opc{0}, 1), [FFR], []);
5386 let Uses = !if(!eq(opc{0}, 1), [FFR], []);
5389 multiclass sve_mem_64b_gld_vi_64_ptrs<bits<4> opc, string asm, Operand imm_ty> {
5390 def _IMM_REAL : sve_mem_64b_gld_vi<opc, asm, imm_ty>;
5392 def : InstAlias<asm # "\t$Zt, $Pg/z, [$Zn]",
5393 (!cast<Instruction>(NAME # _IMM_REAL) ZPR64:$Zt, PPR3bAny:$Pg, ZPR64:$Zn, 0), 0>;
5394 def : InstAlias<asm # "\t$Zt, $Pg/z, [$Zn, $imm5]",
5395 (!cast<Instruction>(NAME # _IMM_REAL) ZPR64:$Zt, PPR3bAny:$Pg, ZPR64:$Zn, imm_ty:$imm5), 0>;
5396 def : InstAlias<asm # "\t$Zt, $Pg/z, [$Zn]",
5397 (!cast<Instruction>(NAME # _IMM_REAL) Z_d:$Zt, PPR3bAny:$Pg, ZPR64:$Zn, 0), 1>;
5400 // bit lsl is '0' if the offsets are extended (uxtw/sxtw), '1' if shifted (lsl)
5401 class sve_mem_64b_prfm_sv<bits<2> msz, bit xs, bit lsl, string asm,
5402 RegisterOperand zprext>
5403 : I<(outs), (ins sve_prfop:$prfop, PPR3bAny:$Pg, GPR64sp:$Rn, zprext:$Zm),
5404 asm, "\t$prfop, $Pg, [$Rn, $Zm]",
5411 let Inst{31-23} = 0b110001000;
5414 let Inst{20-16} = Zm;
5416 let Inst{14-13} = msz;
5417 let Inst{12-10} = Pg;
5420 let Inst{3-0} = prfop;
5422 let hasSideEffects = 1;
5425 multiclass sve_mem_64b_prfm_sv_ext_scaled<bits<2> msz, string asm,
5426 RegisterOperand sxtw_opnd,
5427 RegisterOperand uxtw_opnd> {
5428 def _UXTW_SCALED : sve_mem_64b_prfm_sv<msz, 0, 0, asm, uxtw_opnd>;
5429 def _SXTW_SCALED : sve_mem_64b_prfm_sv<msz, 1, 0, asm, sxtw_opnd>;
5432 multiclass sve_mem_64b_prfm_sv_lsl_scaled<bits<2> msz, string asm,
5433 RegisterOperand zprext> {
5434 def NAME : sve_mem_64b_prfm_sv<msz, 1, 1, asm, zprext>;
5438 class sve_mem_64b_prfm_vi<bits<2> msz, string asm, Operand imm_ty>
5439 : I<(outs), (ins sve_prfop:$prfop, PPR3bAny:$Pg, ZPR64:$Zn, imm_ty:$imm5),
5440 asm, "\t$prfop, $Pg, [$Zn, $imm5]",
5447 let Inst{31-25} = 0b1100010;
5448 let Inst{24-23} = msz;
5449 let Inst{22-21} = 0b00;
5450 let Inst{20-16} = imm5;
5451 let Inst{15-13} = 0b111;
5452 let Inst{12-10} = Pg;
5455 let Inst{3-0} = prfop;
5457 let hasSideEffects = 1;
5460 multiclass sve_mem_64b_prfm_vi<bits<2> msz, string asm, Operand imm_ty> {
5461 def NAME : sve_mem_64b_prfm_vi<msz, asm, imm_ty>;
5463 def : InstAlias<asm # "\t$prfop, $Pg, [$Zn]",
5464 (!cast<Instruction>(NAME) sve_prfop:$prfop, PPR3bAny:$Pg, ZPR64:$Zn, 0), 1>;
5468 //===----------------------------------------------------------------------===//
5469 // SVE Compute Vector Address Group
5470 //===----------------------------------------------------------------------===//
5472 class sve_int_bin_cons_misc_0_a<bits<2> opc, bits<2> msz, string asm,
5473 ZPRRegOp zprty, RegisterOperand zprext>
5474 : I<(outs zprty:$Zd), (ins zprty:$Zn, zprext:$Zm),
5475 asm, "\t$Zd, [$Zn, $Zm]",
5481 let Inst{31-24} = 0b00000100;
5482 let Inst{23-22} = opc;
5484 let Inst{20-16} = Zm;
5485 let Inst{15-12} = 0b1010;
5486 let Inst{11-10} = msz;
5491 multiclass sve_int_bin_cons_misc_0_a_uxtw<bits<2> opc, string asm> {
5492 def _0 : sve_int_bin_cons_misc_0_a<opc, 0b00, asm, ZPR64, ZPR64ExtUXTW8>;
5493 def _1 : sve_int_bin_cons_misc_0_a<opc, 0b01, asm, ZPR64, ZPR64ExtUXTW16>;
5494 def _2 : sve_int_bin_cons_misc_0_a<opc, 0b10, asm, ZPR64, ZPR64ExtUXTW32>;
5495 def _3 : sve_int_bin_cons_misc_0_a<opc, 0b11, asm, ZPR64, ZPR64ExtUXTW64>;
5498 multiclass sve_int_bin_cons_misc_0_a_sxtw<bits<2> opc, string asm> {
5499 def _0 : sve_int_bin_cons_misc_0_a<opc, 0b00, asm, ZPR64, ZPR64ExtSXTW8>;
5500 def _1 : sve_int_bin_cons_misc_0_a<opc, 0b01, asm, ZPR64, ZPR64ExtSXTW16>;
5501 def _2 : sve_int_bin_cons_misc_0_a<opc, 0b10, asm, ZPR64, ZPR64ExtSXTW32>;
5502 def _3 : sve_int_bin_cons_misc_0_a<opc, 0b11, asm, ZPR64, ZPR64ExtSXTW64>;
5505 multiclass sve_int_bin_cons_misc_0_a_32_lsl<bits<2> opc, string asm> {
5506 def _0 : sve_int_bin_cons_misc_0_a<opc, 0b00, asm, ZPR32, ZPR32ExtLSL8>;
5507 def _1 : sve_int_bin_cons_misc_0_a<opc, 0b01, asm, ZPR32, ZPR32ExtLSL16>;
5508 def _2 : sve_int_bin_cons_misc_0_a<opc, 0b10, asm, ZPR32, ZPR32ExtLSL32>;
5509 def _3 : sve_int_bin_cons_misc_0_a<opc, 0b11, asm, ZPR32, ZPR32ExtLSL64>;
5512 multiclass sve_int_bin_cons_misc_0_a_64_lsl<bits<2> opc, string asm> {
5513 def _0 : sve_int_bin_cons_misc_0_a<opc, 0b00, asm, ZPR64, ZPR64ExtLSL8>;
5514 def _1 : sve_int_bin_cons_misc_0_a<opc, 0b01, asm, ZPR64, ZPR64ExtLSL16>;
5515 def _2 : sve_int_bin_cons_misc_0_a<opc, 0b10, asm, ZPR64, ZPR64ExtLSL32>;
5516 def _3 : sve_int_bin_cons_misc_0_a<opc, 0b11, asm, ZPR64, ZPR64ExtLSL64>;
5520 //===----------------------------------------------------------------------===//
5521 // SVE Integer Misc - Unpredicated Group
5522 //===----------------------------------------------------------------------===//
5524 class sve_int_bin_cons_misc_0_b<bits<2> sz, string asm, ZPRRegOp zprty>
5525 : I<(outs zprty:$Zd), (ins zprty:$Zn, zprty:$Zm),
5526 asm, "\t$Zd, $Zn, $Zm",
5532 let Inst{31-24} = 0b00000100;
5533 let Inst{23-22} = sz;
5535 let Inst{20-16} = Zm;
5536 let Inst{15-10} = 0b101100;
5541 multiclass sve_int_bin_cons_misc_0_b<string asm> {
5542 def _H : sve_int_bin_cons_misc_0_b<0b01, asm, ZPR16>;
5543 def _S : sve_int_bin_cons_misc_0_b<0b10, asm, ZPR32>;
5544 def _D : sve_int_bin_cons_misc_0_b<0b11, asm, ZPR64>;
5547 class sve_int_bin_cons_misc_0_c<bits<8> opc, string asm, ZPRRegOp zprty>
5548 : I<(outs zprty:$Zd), (ins zprty:$Zn),
5554 let Inst{31-24} = 0b00000100;
5555 let Inst{23-22} = opc{7-6};
5557 let Inst{20-16} = opc{5-1};
5558 let Inst{15-11} = 0b10111;
5559 let Inst{10} = opc{0};
5564 //===----------------------------------------------------------------------===//
5565 // SVE Integer Reduction Group
5566 //===----------------------------------------------------------------------===//
5568 class sve_int_reduce<bits<2> sz8_32, bits<2> fmt, bits<3> opc, string asm,
5569 ZPRRegOp zprty, RegisterClass regtype>
5570 : I<(outs regtype:$Vd), (ins PPR3bAny:$Pg, zprty:$Zn),
5571 asm, "\t$Vd, $Pg, $Zn",
5577 let Inst{31-24} = 0b00000100;
5578 let Inst{23-22} = sz8_32;
5580 let Inst{20-19} = fmt;
5581 let Inst{18-16} = opc;
5582 let Inst{15-13} = 0b001;
5583 let Inst{12-10} = Pg;
5588 multiclass sve_int_reduce_0_saddv<bits<3> opc, string asm> {
5589 def _B : sve_int_reduce<0b00, 0b00, opc, asm, ZPR8, FPR64>;
5590 def _H : sve_int_reduce<0b01, 0b00, opc, asm, ZPR16, FPR64>;
5591 def _S : sve_int_reduce<0b10, 0b00, opc, asm, ZPR32, FPR64>;
5594 multiclass sve_int_reduce_0_uaddv<bits<3> opc, string asm> {
5595 def _B : sve_int_reduce<0b00, 0b00, opc, asm, ZPR8, FPR64>;
5596 def _H : sve_int_reduce<0b01, 0b00, opc, asm, ZPR16, FPR64>;
5597 def _S : sve_int_reduce<0b10, 0b00, opc, asm, ZPR32, FPR64>;
5598 def _D : sve_int_reduce<0b11, 0b00, opc, asm, ZPR64, FPR64>;
5601 multiclass sve_int_reduce_1<bits<3> opc, string asm> {
5602 def _B : sve_int_reduce<0b00, 0b01, opc, asm, ZPR8, FPR8>;
5603 def _H : sve_int_reduce<0b01, 0b01, opc, asm, ZPR16, FPR16>;
5604 def _S : sve_int_reduce<0b10, 0b01, opc, asm, ZPR32, FPR32>;
5605 def _D : sve_int_reduce<0b11, 0b01, opc, asm, ZPR64, FPR64>;
5608 multiclass sve_int_reduce_2<bits<3> opc, string asm> {
5609 def _B : sve_int_reduce<0b00, 0b11, opc, asm, ZPR8, FPR8>;
5610 def _H : sve_int_reduce<0b01, 0b11, opc, asm, ZPR16, FPR16>;
5611 def _S : sve_int_reduce<0b10, 0b11, opc, asm, ZPR32, FPR32>;
5612 def _D : sve_int_reduce<0b11, 0b11, opc, asm, ZPR64, FPR64>;
5615 class sve_int_movprfx_pred<bits<2> sz8_32, bits<3> opc, string asm,
5616 ZPRRegOp zprty, string pg_suffix, dag iops>
5617 : I<(outs zprty:$Zd), iops,
5618 asm, "\t$Zd, $Pg"#pg_suffix#", $Zn",
5624 let Inst{31-24} = 0b00000100;
5625 let Inst{23-22} = sz8_32;
5626 let Inst{21-19} = 0b010;
5627 let Inst{18-16} = opc;
5628 let Inst{15-13} = 0b001;
5629 let Inst{12-10} = Pg;
5633 let ElementSize = zprty.ElementSize;
5636 multiclass sve_int_movprfx_pred_merge<bits<3> opc, string asm> {
5637 let Constraints = "$Zd = $_Zd" in {
5638 def _B : sve_int_movprfx_pred<0b00, opc, asm, ZPR8, "/m",
5639 (ins ZPR8:$_Zd, PPR3bAny:$Pg, ZPR8:$Zn)>;
5640 def _H : sve_int_movprfx_pred<0b01, opc, asm, ZPR16, "/m",
5641 (ins ZPR16:$_Zd, PPR3bAny:$Pg, ZPR16:$Zn)>;
5642 def _S : sve_int_movprfx_pred<0b10, opc, asm, ZPR32, "/m",
5643 (ins ZPR32:$_Zd, PPR3bAny:$Pg, ZPR32:$Zn)>;
5644 def _D : sve_int_movprfx_pred<0b11, opc, asm, ZPR64, "/m",
5645 (ins ZPR64:$_Zd, PPR3bAny:$Pg, ZPR64:$Zn)>;
5649 multiclass sve_int_movprfx_pred_zero<bits<3> opc, string asm> {
5650 def _B : sve_int_movprfx_pred<0b00, opc, asm, ZPR8, "/z",
5651 (ins PPR3bAny:$Pg, ZPR8:$Zn)>;
5652 def _H : sve_int_movprfx_pred<0b01, opc, asm, ZPR16, "/z",
5653 (ins PPR3bAny:$Pg, ZPR16:$Zn)>;
5654 def _S : sve_int_movprfx_pred<0b10, opc, asm, ZPR32, "/z",
5655 (ins PPR3bAny:$Pg, ZPR32:$Zn)>;
5656 def _D : sve_int_movprfx_pred<0b11, opc, asm, ZPR64, "/z",
5657 (ins PPR3bAny:$Pg, ZPR64:$Zn)>;
5660 //===----------------------------------------------------------------------===//
5661 // SVE Propagate Break Group
5662 //===----------------------------------------------------------------------===//
5664 class sve_int_brkp<bits<2> opc, string asm>
5665 : I<(outs PPR8:$Pd), (ins PPRAny:$Pg, PPR8:$Pn, PPR8:$Pm),
5666 asm, "\t$Pd, $Pg/z, $Pn, $Pm",
5673 let Inst{31-24} = 0b00100101;
5675 let Inst{22} = opc{1};
5676 let Inst{21-20} = 0b00;
5677 let Inst{19-16} = Pm;
5678 let Inst{15-14} = 0b11;
5679 let Inst{13-10} = Pg;
5682 let Inst{4} = opc{0};
5685 let Defs = !if(!eq (opc{1}, 1), [NZCV], []);
5689 //===----------------------------------------------------------------------===//
5690 // SVE Partition Break Group
5691 //===----------------------------------------------------------------------===//
5693 class sve_int_brkn<bit S, string asm>
5694 : I<(outs PPR8:$Pdm), (ins PPRAny:$Pg, PPR8:$Pn, PPR8:$_Pdm),
5695 asm, "\t$Pdm, $Pg/z, $Pn, $_Pdm",
5701 let Inst{31-23} = 0b001001010;
5703 let Inst{21-14} = 0b01100001;
5704 let Inst{13-10} = Pg;
5708 let Inst{3-0} = Pdm;
5710 let Constraints = "$Pdm = $_Pdm";
5711 let Defs = !if(!eq (S, 0b1), [NZCV], []);
5714 class sve_int_break<bits<3> opc, string asm, string suffix, dag iops>
5715 : I<(outs PPR8:$Pd), iops,
5716 asm, "\t$Pd, $Pg"#suffix#", $Pn",
5722 let Inst{31-24} = 0b00100101;
5723 let Inst{23-22} = opc{2-1};
5724 let Inst{21-14} = 0b01000001;
5725 let Inst{13-10} = Pg;
5728 let Inst{4} = opc{0};
5731 let Constraints = !if(!eq (opc{0}, 1), "$Pd = $_Pd", "");
5732 let Defs = !if(!eq (opc{1}, 1), [NZCV], []);
5736 multiclass sve_int_break_m<bits<3> opc, string asm> {
5737 def NAME : sve_int_break<opc, asm, "/m", (ins PPR8:$_Pd, PPRAny:$Pg, PPR8:$Pn)>;
5740 multiclass sve_int_break_z<bits<3> opc, string asm> {
5741 def NAME : sve_int_break<opc, asm, "/z", (ins PPRAny:$Pg, PPR8:$Pn)>;
5744 //===----------------------------------------------------------------------===//
5745 // SVE2 String Processing Group
5746 //===----------------------------------------------------------------------===//
5748 class sve2_char_match<bit sz, bit opc, string asm,
5749 PPRRegOp pprty, ZPRRegOp zprty>
5750 : I<(outs pprty:$Pd), (ins PPR3bAny:$Pg, zprty:$Zn, zprty:$Zm),
5751 asm, "\t$Pd, $Pg/z, $Zn, $Zm",
5758 let Inst{31-23} = 0b010001010;
5761 let Inst{20-16} = Zm;
5762 let Inst{15-13} = 0b100;
5763 let Inst{12-10} = Pg;
5771 multiclass sve2_char_match<bit opc, string asm> {
5772 def _B : sve2_char_match<0b0, opc, asm, PPR8, ZPR8>;
5773 def _H : sve2_char_match<0b1, opc, asm, PPR16, ZPR16>;
5776 //===----------------------------------------------------------------------===//
5777 // SVE2 Histogram Computation - Segment Group
5778 //===----------------------------------------------------------------------===//
5780 class sve2_hist_gen_segment<string asm>
5781 : I<(outs ZPR8:$Zd), (ins ZPR8:$Zn, ZPR8:$Zm),
5782 asm, "\t$Zd, $Zn, $Zm",
5788 let Inst{31-21} = 0b01000101001;
5789 let Inst{20-16} = Zm;
5790 let Inst{15-10} = 0b101000;
5795 //===----------------------------------------------------------------------===//
5796 // SVE2 Histogram Computation - Vector Group
5797 //===----------------------------------------------------------------------===//
5799 class sve2_hist_gen_vector<bit sz, string asm, ZPRRegOp zprty>
5800 : I<(outs zprty:$Zd), (ins PPR3bAny:$Pg, zprty:$Zn, zprty:$Zm),
5801 asm, "\t$Zd, $Pg/z, $Zn, $Zm",
5808 let Inst{31-23} = 0b010001011;
5811 let Inst{20-16} = Zm;
5812 let Inst{15-13} = 0b110;
5813 let Inst{12-10} = Pg;
5818 multiclass sve2_hist_gen_vector<string asm> {
5819 def _S : sve2_hist_gen_vector<0b0, asm, ZPR32>;
5820 def _D : sve2_hist_gen_vector<0b1, asm, ZPR64>;
5823 //===----------------------------------------------------------------------===//
5824 // SVE2 Crypto Extensions Group
5825 //===----------------------------------------------------------------------===//
5827 class sve2_crypto_cons_bin_op<bit opc, string asm, ZPRRegOp zprty>
5828 : I<(outs zprty:$Zd), (ins zprty:$Zn, zprty:$Zm),
5829 asm, "\t$Zd, $Zn, $Zm",
5835 let Inst{31-21} = 0b01000101001;
5836 let Inst{20-16} = Zm;
5837 let Inst{15-11} = 0b11110;
5843 class sve2_crypto_des_bin_op<bits<2> opc, string asm, ZPRRegOp zprty>
5844 : I<(outs zprty:$Zdn), (ins zprty:$_Zdn, zprty:$Zm),
5845 asm, "\t$Zdn, $_Zdn, $Zm",
5850 let Inst{31-17} = 0b010001010010001;
5851 let Inst{16} = opc{1};
5852 let Inst{15-11} = 0b11100;
5853 let Inst{10} = opc{0};
5855 let Inst{4-0} = Zdn;
5857 let Constraints = "$Zdn = $_Zdn";
5860 class sve2_crypto_unary_op<bit opc, string asm>
5861 : I<(outs ZPR8:$Zdn), (ins ZPR8:$_Zdn),
5862 asm, "\t$Zdn, $_Zdn",
5866 let Inst{31-11} = 0b010001010010000011100;
5868 let Inst{9-5} = 0b00000;
5869 let Inst{4-0} = Zdn;
5871 let Constraints = "$Zdn = $_Zdn";