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 : I<(outs zprty:$Zd), (ins zprty:$Zn, zprty:$Zm),
1224 asm, "\t$Zd, $Zn, $Zm",
1225 "", []>, Sched<[]> {
1229 let Inst{31-24} = 0b01100101;
1230 let Inst{23-22} = sz;
1232 let Inst{20-16} = Zm;
1233 let Inst{15-13} = 0b000;
1234 let Inst{12-10} = opc;
1239 multiclass sve_fp_3op_u_zd<bits<3> opc, string asm> {
1240 def _H : sve_fp_3op_u_zd<0b01, opc, asm, ZPR16>;
1241 def _S : sve_fp_3op_u_zd<0b10, opc, asm, ZPR32>;
1242 def _D : sve_fp_3op_u_zd<0b11, opc, asm, ZPR64>;
1245 //===----------------------------------------------------------------------===//
1246 // SVE Floating Point Fused Multiply-Add Group
1247 //===----------------------------------------------------------------------===//
1249 class sve_fp_3op_p_zds_a<bits<2> sz, bits<2> opc, string asm, ZPRRegOp zprty>
1250 : I<(outs zprty:$Zda), (ins PPR3bAny:$Pg, zprty:$_Zda, zprty:$Zn, zprty:$Zm),
1251 asm, "\t$Zda, $Pg/m, $Zn, $Zm",
1258 let Inst{31-24} = 0b01100101;
1259 let Inst{23-22} = sz;
1261 let Inst{20-16} = Zm;
1263 let Inst{14-13} = opc;
1264 let Inst{12-10} = Pg;
1266 let Inst{4-0} = Zda;
1268 let Constraints = "$Zda = $_Zda";
1269 let DestructiveInstType = Destructive;
1270 let ElementSize = zprty.ElementSize;
1273 multiclass sve_fp_3op_p_zds_a<bits<2> opc, string asm> {
1274 def _H : sve_fp_3op_p_zds_a<0b01, opc, asm, ZPR16>;
1275 def _S : sve_fp_3op_p_zds_a<0b10, opc, asm, ZPR32>;
1276 def _D : sve_fp_3op_p_zds_a<0b11, opc, asm, ZPR64>;
1279 class sve_fp_3op_p_zds_b<bits<2> sz, bits<2> opc, string asm,
1281 : I<(outs zprty:$Zdn), (ins PPR3bAny:$Pg, zprty:$_Zdn, zprty:$Zm, zprty:$Za),
1282 asm, "\t$Zdn, $Pg/m, $Zm, $Za",
1289 let Inst{31-24} = 0b01100101;
1290 let Inst{23-22} = sz;
1292 let Inst{20-16} = Za;
1294 let Inst{14-13} = opc;
1295 let Inst{12-10} = Pg;
1297 let Inst{4-0} = Zdn;
1299 let Constraints = "$Zdn = $_Zdn";
1300 let DestructiveInstType = Destructive;
1301 let ElementSize = zprty.ElementSize;
1304 multiclass sve_fp_3op_p_zds_b<bits<2> opc, string asm> {
1305 def _H : sve_fp_3op_p_zds_b<0b01, opc, asm, ZPR16>;
1306 def _S : sve_fp_3op_p_zds_b<0b10, opc, asm, ZPR32>;
1307 def _D : sve_fp_3op_p_zds_b<0b11, opc, asm, ZPR64>;
1310 //===----------------------------------------------------------------------===//
1311 // SVE Floating Point Multiply-Add - Indexed Group
1312 //===----------------------------------------------------------------------===//
1314 class sve_fp_fma_by_indexed_elem<bits<2> sz, bit opc, string asm,
1316 ZPRRegOp zprty2, Operand itype>
1317 : I<(outs zprty1:$Zda), (ins zprty1:$_Zda, zprty1:$Zn, zprty2:$Zm, itype:$iop),
1318 asm, "\t$Zda, $Zn, $Zm$iop", "", []>, Sched<[]> {
1321 let Inst{31-24} = 0b01100100;
1322 let Inst{23-22} = sz;
1324 let Inst{15-11} = 0;
1327 let Inst{4-0} = Zda;
1329 let Constraints = "$Zda = $_Zda";
1330 let DestructiveInstType = Destructive;
1331 let ElementSize = ElementSizeNone;
1334 multiclass sve_fp_fma_by_indexed_elem<bit opc, string asm> {
1335 def _H : sve_fp_fma_by_indexed_elem<{0, ?}, opc, asm, ZPR16, ZPR3b16, VectorIndexH> {
1338 let Inst{22} = iop{2};
1339 let Inst{20-19} = iop{1-0};
1340 let Inst{18-16} = Zm;
1342 def _S : sve_fp_fma_by_indexed_elem<0b10, opc, asm, ZPR32, ZPR3b32, VectorIndexS> {
1345 let Inst{20-19} = iop;
1346 let Inst{18-16} = Zm;
1348 def _D : sve_fp_fma_by_indexed_elem<0b11, opc, asm, ZPR64, ZPR4b64, VectorIndexD> {
1352 let Inst{19-16} = Zm;
1357 //===----------------------------------------------------------------------===//
1358 // SVE Floating Point Multiply - Indexed Group
1359 //===----------------------------------------------------------------------===//
1361 class sve_fp_fmul_by_indexed_elem<bits<2> sz, string asm, ZPRRegOp zprty,
1362 ZPRRegOp zprty2, Operand itype>
1363 : I<(outs zprty:$Zd), (ins zprty:$Zn, zprty2:$Zm, itype:$iop),
1364 asm, "\t$Zd, $Zn, $Zm$iop", "", []>, Sched<[]> {
1367 let Inst{31-24} = 0b01100100;
1368 let Inst{23-22} = sz;
1370 let Inst{15-10} = 0b001000;
1375 multiclass sve_fp_fmul_by_indexed_elem<string asm> {
1376 def _H : sve_fp_fmul_by_indexed_elem<{0, ?}, asm, ZPR16, ZPR3b16, VectorIndexH> {
1379 let Inst{22} = iop{2};
1380 let Inst{20-19} = iop{1-0};
1381 let Inst{18-16} = Zm;
1383 def _S : sve_fp_fmul_by_indexed_elem<0b10, asm, ZPR32, ZPR3b32, VectorIndexS> {
1386 let Inst{20-19} = iop;
1387 let Inst{18-16} = Zm;
1389 def _D : sve_fp_fmul_by_indexed_elem<0b11, asm, ZPR64, ZPR4b64, VectorIndexD> {
1393 let Inst{19-16} = Zm;
1397 //===----------------------------------------------------------------------===//
1398 // SVE Floating Point Complex Multiply-Add Group
1399 //===----------------------------------------------------------------------===//
1401 class sve_fp_fcmla<bits<2> sz, string asm, ZPRRegOp zprty>
1402 : I<(outs zprty:$Zda), (ins PPR3bAny:$Pg, zprty:$_Zda, zprty:$Zn, zprty:$Zm,
1403 complexrotateop:$imm),
1404 asm, "\t$Zda, $Pg/m, $Zn, $Zm, $imm",
1405 "", []>, Sched<[]> {
1411 let Inst{31-24} = 0b01100100;
1412 let Inst{23-22} = sz;
1414 let Inst{20-16} = Zm;
1416 let Inst{14-13} = imm;
1417 let Inst{12-10} = Pg;
1419 let Inst{4-0} = Zda;
1421 let Constraints = "$Zda = $_Zda";
1422 let DestructiveInstType = Destructive;
1423 let ElementSize = zprty.ElementSize;
1426 multiclass sve_fp_fcmla<string asm> {
1427 def _H : sve_fp_fcmla<0b01, asm, ZPR16>;
1428 def _S : sve_fp_fcmla<0b10, asm, ZPR32>;
1429 def _D : sve_fp_fcmla<0b11, asm, ZPR64>;
1432 //===----------------------------------------------------------------------===//
1433 // SVE Floating Point Complex Multiply-Add - Indexed Group
1434 //===----------------------------------------------------------------------===//
1436 class sve_fp_fcmla_by_indexed_elem<bits<2> sz, string asm,
1438 ZPRRegOp zprty2, Operand itype>
1439 : I<(outs zprty:$Zda), (ins zprty:$_Zda, zprty:$Zn, zprty2:$Zm, itype:$iop,
1440 complexrotateop:$imm),
1441 asm, "\t$Zda, $Zn, $Zm$iop, $imm",
1442 "", []>, Sched<[]> {
1446 let Inst{31-24} = 0b01100100;
1447 let Inst{23-22} = sz;
1449 let Inst{15-12} = 0b0001;
1450 let Inst{11-10} = imm;
1452 let Inst{4-0} = Zda;
1454 let Constraints = "$Zda = $_Zda";
1455 let DestructiveInstType = Destructive;
1456 let ElementSize = ElementSizeNone;
1459 multiclass sve_fp_fcmla_by_indexed_elem<string asm> {
1460 def _H : sve_fp_fcmla_by_indexed_elem<0b10, asm, ZPR16, ZPR3b16, VectorIndexS> {
1463 let Inst{20-19} = iop;
1464 let Inst{18-16} = Zm;
1466 def _S : sve_fp_fcmla_by_indexed_elem<0b11, asm, ZPR32, ZPR4b32, VectorIndexD> {
1470 let Inst{19-16} = Zm;
1474 //===----------------------------------------------------------------------===//
1475 // SVE Floating Point Complex Addition Group
1476 //===----------------------------------------------------------------------===//
1478 class sve_fp_fcadd<bits<2> sz, string asm, ZPRRegOp zprty>
1479 : I<(outs zprty:$Zdn), (ins PPR3bAny:$Pg, zprty:$_Zdn, zprty:$Zm,
1480 complexrotateopodd:$imm),
1481 asm, "\t$Zdn, $Pg/m, $_Zdn, $Zm, $imm",
1488 let Inst{31-24} = 0b01100100;
1489 let Inst{23-22} = sz;
1490 let Inst{21-17} = 0;
1492 let Inst{15-13} = 0b100;
1493 let Inst{12-10} = Pg;
1495 let Inst{4-0} = Zdn;
1497 let Constraints = "$Zdn = $_Zdn";
1498 let DestructiveInstType = Destructive;
1499 let ElementSize = zprty.ElementSize;
1502 multiclass sve_fp_fcadd<string asm> {
1503 def _H : sve_fp_fcadd<0b01, asm, ZPR16>;
1504 def _S : sve_fp_fcadd<0b10, asm, ZPR32>;
1505 def _D : sve_fp_fcadd<0b11, asm, ZPR64>;
1508 //===----------------------------------------------------------------------===//
1509 // SVE2 Floating Point Convert Group
1510 //===----------------------------------------------------------------------===//
1512 class sve2_fp_convert_precision<bits<4> opc, string asm,
1513 ZPRRegOp zprty1, ZPRRegOp zprty2>
1514 : I<(outs zprty1:$Zd), (ins zprty1:$_Zd, PPR3bAny:$Pg, zprty2:$Zn),
1515 asm, "\t$Zd, $Pg/m, $Zn",
1521 let Inst{31-24} = 0b01100100;
1522 let Inst{23-22} = opc{3-2};
1523 let Inst{21-18} = 0b0010;
1524 let Inst{17-16} = opc{1-0};
1525 let Inst{15-13} = 0b101;
1526 let Inst{12-10} = Pg;
1530 let Constraints = "$Zd = $_Zd";
1533 multiclass sve2_fp_convert_down_narrow<string asm> {
1534 def _StoH : sve2_fp_convert_precision<0b1000, asm, ZPR16, ZPR32>;
1535 def _DtoS : sve2_fp_convert_precision<0b1110, asm, ZPR32, ZPR64>;
1538 multiclass sve2_fp_convert_up_long<string asm> {
1539 def _HtoS : sve2_fp_convert_precision<0b1001, asm, ZPR32, ZPR16>;
1540 def _StoD : sve2_fp_convert_precision<0b1111, asm, ZPR64, ZPR32>;
1543 multiclass sve2_fp_convert_down_odd_rounding<string asm> {
1544 def _DtoS : sve2_fp_convert_precision<0b0010, asm, ZPR32, ZPR64>;
1547 //===----------------------------------------------------------------------===//
1548 // SVE2 Floating Point Pairwise Group
1549 //===----------------------------------------------------------------------===//
1551 class sve2_fp_pairwise_pred<bits<2> sz, bits<3> opc, string asm,
1553 : I<(outs zprty:$Zdn), (ins PPR3bAny:$Pg, zprty:$_Zdn, zprty:$Zm),
1554 asm, "\t$Zdn, $Pg/m, $_Zdn, $Zm",
1560 let Inst{31-24} = 0b01100100;
1561 let Inst{23-22} = sz;
1562 let Inst{21-19} = 0b010;
1563 let Inst{18-16} = opc;
1564 let Inst{15-13} = 0b100;
1565 let Inst{12-10} = Pg;
1567 let Inst{4-0} = Zdn;
1569 let Constraints = "$Zdn = $_Zdn";
1570 let DestructiveInstType = Destructive;
1571 let ElementSize = zprty.ElementSize;
1574 multiclass sve2_fp_pairwise_pred<bits<3> opc, string asm> {
1575 def _H : sve2_fp_pairwise_pred<0b01, opc, asm, ZPR16>;
1576 def _S : sve2_fp_pairwise_pred<0b10, opc, asm, ZPR32>;
1577 def _D : sve2_fp_pairwise_pred<0b11, opc, asm, ZPR64>;
1580 //===----------------------------------------------------------------------===//
1581 // SVE2 Floating Point Widening Multiply-Add - Indexed Group
1582 //===----------------------------------------------------------------------===//
1584 class sve2_fp_mla_long_by_indexed_elem<bits<2> opc, string asm>
1585 : I<(outs ZPR32:$Zda), (ins ZPR32:$_Zda, ZPR16:$Zn, ZPR3b16:$Zm,
1587 asm, "\t$Zda, $Zn, $Zm$iop",
1594 let Inst{31-21} = 0b01100100101;
1595 let Inst{20-19} = iop{2-1};
1596 let Inst{18-16} = Zm;
1597 let Inst{15-14} = 0b01;
1598 let Inst{13} = opc{1};
1600 let Inst{11} = iop{0};
1601 let Inst{10} = opc{0};
1603 let Inst{4-0} = Zda;
1605 let Constraints = "$Zda = $_Zda";
1606 let DestructiveInstType = Destructive;
1607 let ElementSize = ElementSizeNone;
1610 //===----------------------------------------------------------------------===//
1611 // SVE2 Floating Point Widening Multiply-Add Group
1612 //===----------------------------------------------------------------------===//
1614 class sve2_fp_mla_long<bits<2> opc, string asm>
1615 : I<(outs ZPR32:$Zda), (ins ZPR32:$_Zda, ZPR16:$Zn, ZPR16:$Zm),
1616 asm, "\t$Zda, $Zn, $Zm",
1622 let Inst{31-21} = 0b01100100101;
1623 let Inst{20-16} = Zm;
1624 let Inst{15-14} = 0b10;
1625 let Inst{13} = opc{1};
1626 let Inst{12-11} = 0b00;
1627 let Inst{10} = opc{0};
1629 let Inst{4-0} = Zda;
1631 let Constraints = "$Zda = $_Zda";
1632 let DestructiveInstType = Destructive;
1633 let ElementSize = ElementSizeNone;
1636 //===----------------------------------------------------------------------===//
1637 // SVE Stack Allocation Group
1638 //===----------------------------------------------------------------------===//
1640 class sve_int_arith_vl<bit opc, string asm>
1641 : I<(outs GPR64sp:$Rd), (ins GPR64sp:$Rn, simm6_32b:$imm6),
1642 asm, "\t$Rd, $Rn, $imm6",
1648 let Inst{31-23} = 0b000001000;
1651 let Inst{20-16} = Rn;
1652 let Inst{15-11} = 0b01010;
1653 let Inst{10-5} = imm6;
1657 class sve_int_read_vl_a<bit op, bits<5> opc2, string asm>
1658 : I<(outs GPR64:$Rd), (ins simm6_32b:$imm6),
1659 asm, "\t$Rd, $imm6",
1664 let Inst{31-23} = 0b000001001;
1667 let Inst{20-16} = opc2{4-0};
1668 let Inst{15-11} = 0b01010;
1669 let Inst{10-5} = imm6;
1673 //===----------------------------------------------------------------------===//
1674 // SVE Permute - In Lane Group
1675 //===----------------------------------------------------------------------===//
1677 class sve_int_perm_bin_perm_zz<bits<3> opc, bits<2> sz8_64, string asm,
1679 : I<(outs zprty:$Zd), (ins zprty:$Zn, zprty:$Zm),
1680 asm, "\t$Zd, $Zn, $Zm",
1686 let Inst{31-24} = 0b00000101;
1687 let Inst{23-22} = sz8_64;
1689 let Inst{20-16} = Zm;
1690 let Inst{15-13} = 0b011;
1691 let Inst{12-10} = opc;
1696 multiclass sve_int_perm_bin_perm_zz<bits<3> opc, string asm> {
1697 def _B : sve_int_perm_bin_perm_zz<opc, 0b00, asm, ZPR8>;
1698 def _H : sve_int_perm_bin_perm_zz<opc, 0b01, asm, ZPR16>;
1699 def _S : sve_int_perm_bin_perm_zz<opc, 0b10, asm, ZPR32>;
1700 def _D : sve_int_perm_bin_perm_zz<opc, 0b11, asm, ZPR64>;
1703 //===----------------------------------------------------------------------===//
1704 // SVE Floating Point Unary Operations Group
1705 //===----------------------------------------------------------------------===//
1707 class sve_fp_2op_p_zd<bits<7> opc, string asm, RegisterOperand i_zprtype,
1708 RegisterOperand o_zprtype, ElementSizeEnum size>
1709 : I<(outs o_zprtype:$Zd), (ins i_zprtype:$_Zd, PPR3bAny:$Pg, i_zprtype:$Zn),
1710 asm, "\t$Zd, $Pg/m, $Zn",
1716 let Inst{31-24} = 0b01100101;
1717 let Inst{23-22} = opc{6-5};
1719 let Inst{20-16} = opc{4-0};
1720 let Inst{15-13} = 0b101;
1721 let Inst{12-10} = Pg;
1725 let Constraints = "$Zd = $_Zd";
1726 let DestructiveInstType = Destructive;
1727 let ElementSize = size;
1730 multiclass sve_fp_2op_p_zd_HSD<bits<5> opc, string asm> {
1731 def _H : sve_fp_2op_p_zd<{ 0b01, opc }, asm, ZPR16, ZPR16, ElementSizeH>;
1732 def _S : sve_fp_2op_p_zd<{ 0b10, opc }, asm, ZPR32, ZPR32, ElementSizeS>;
1733 def _D : sve_fp_2op_p_zd<{ 0b11, opc }, asm, ZPR64, ZPR64, ElementSizeD>;
1736 multiclass sve2_fp_flogb<string asm> {
1737 def _H : sve_fp_2op_p_zd<0b0011010, asm, ZPR16, ZPR16, ElementSizeH>;
1738 def _S : sve_fp_2op_p_zd<0b0011100, asm, ZPR32, ZPR32, ElementSizeS>;
1739 def _D : sve_fp_2op_p_zd<0b0011110, asm, ZPR64, ZPR64, ElementSizeD>;
1742 //===----------------------------------------------------------------------===//
1743 // SVE Floating Point Unary Operations - Unpredicated Group
1744 //===----------------------------------------------------------------------===//
1746 class sve_fp_2op_u_zd<bits<2> sz, bits<3> opc, string asm,
1748 : I<(outs zprty:$Zd), (ins zprty:$Zn),
1754 let Inst{31-24} = 0b01100101;
1755 let Inst{23-22} = sz;
1756 let Inst{21-19} = 0b001;
1757 let Inst{18-16} = opc;
1758 let Inst{15-10} = 0b001100;
1763 multiclass sve_fp_2op_u_zd<bits<3> opc, string asm> {
1764 def _H : sve_fp_2op_u_zd<0b01, opc, asm, ZPR16>;
1765 def _S : sve_fp_2op_u_zd<0b10, opc, asm, ZPR32>;
1766 def _D : sve_fp_2op_u_zd<0b11, opc, asm, ZPR64>;
1769 //===----------------------------------------------------------------------===//
1770 // SVE Integer Arithmetic - Binary Predicated Group
1771 //===----------------------------------------------------------------------===//
1773 class sve_int_bin_pred_arit_log<bits<2> sz8_64, bits<2> fmt, bits<3> opc,
1774 string asm, ZPRRegOp zprty>
1775 : I<(outs zprty:$Zdn), (ins PPR3bAny:$Pg, zprty:$_Zdn, zprty:$Zm),
1776 asm, "\t$Zdn, $Pg/m, $_Zdn, $Zm", "", []>, Sched<[]> {
1780 let Inst{31-24} = 0b00000100;
1781 let Inst{23-22} = sz8_64;
1783 let Inst{20-19} = fmt;
1784 let Inst{18-16} = opc;
1785 let Inst{15-13} = 0b000;
1786 let Inst{12-10} = Pg;
1788 let Inst{4-0} = Zdn;
1790 let Constraints = "$Zdn = $_Zdn";
1791 let DestructiveInstType = Destructive;
1792 let ElementSize = zprty.ElementSize;
1795 multiclass sve_int_bin_pred_log<bits<3> opc, string asm> {
1796 def _B : sve_int_bin_pred_arit_log<0b00, 0b11, opc, asm, ZPR8>;
1797 def _H : sve_int_bin_pred_arit_log<0b01, 0b11, opc, asm, ZPR16>;
1798 def _S : sve_int_bin_pred_arit_log<0b10, 0b11, opc, asm, ZPR32>;
1799 def _D : sve_int_bin_pred_arit_log<0b11, 0b11, opc, asm, ZPR64>;
1802 multiclass sve_int_bin_pred_arit_0<bits<3> opc, string asm> {
1803 def _B : sve_int_bin_pred_arit_log<0b00, 0b00, opc, asm, ZPR8>;
1804 def _H : sve_int_bin_pred_arit_log<0b01, 0b00, opc, asm, ZPR16>;
1805 def _S : sve_int_bin_pred_arit_log<0b10, 0b00, opc, asm, ZPR32>;
1806 def _D : sve_int_bin_pred_arit_log<0b11, 0b00, opc, asm, ZPR64>;
1809 multiclass sve_int_bin_pred_arit_1<bits<3> opc, string asm> {
1810 def _B : sve_int_bin_pred_arit_log<0b00, 0b01, opc, asm, ZPR8>;
1811 def _H : sve_int_bin_pred_arit_log<0b01, 0b01, opc, asm, ZPR16>;
1812 def _S : sve_int_bin_pred_arit_log<0b10, 0b01, opc, asm, ZPR32>;
1813 def _D : sve_int_bin_pred_arit_log<0b11, 0b01, opc, asm, ZPR64>;
1816 multiclass sve_int_bin_pred_arit_2<bits<3> opc, string asm> {
1817 def _B : sve_int_bin_pred_arit_log<0b00, 0b10, opc, asm, ZPR8>;
1818 def _H : sve_int_bin_pred_arit_log<0b01, 0b10, opc, asm, ZPR16>;
1819 def _S : sve_int_bin_pred_arit_log<0b10, 0b10, opc, asm, ZPR32>;
1820 def _D : sve_int_bin_pred_arit_log<0b11, 0b10, opc, asm, ZPR64>;
1823 // Special case for divides which are not defined for 8b/16b elements.
1824 multiclass sve_int_bin_pred_arit_2_div<bits<3> opc, string asm> {
1825 def _S : sve_int_bin_pred_arit_log<0b10, 0b10, opc, asm, ZPR32>;
1826 def _D : sve_int_bin_pred_arit_log<0b11, 0b10, opc, asm, ZPR64>;
1829 //===----------------------------------------------------------------------===//
1830 // SVE Integer Multiply-Add Group
1831 //===----------------------------------------------------------------------===//
1833 class sve_int_mladdsub_vvv_pred<bits<2> sz8_64, bits<1> opc, string asm,
1835 : I<(outs zprty:$Zdn), (ins PPR3bAny:$Pg, zprty:$_Zdn, zprty:$Zm, zprty:$Za),
1836 asm, "\t$Zdn, $Pg/m, $Zm, $Za",
1843 let Inst{31-24} = 0b00000100;
1844 let Inst{23-22} = sz8_64;
1846 let Inst{20-16} = Zm;
1847 let Inst{15-14} = 0b11;
1849 let Inst{12-10} = Pg;
1851 let Inst{4-0} = Zdn;
1853 let Constraints = "$Zdn = $_Zdn";
1854 let DestructiveInstType = Destructive;
1855 let ElementSize = zprty.ElementSize;
1858 multiclass sve_int_mladdsub_vvv_pred<bits<1> opc, string asm> {
1859 def _B : sve_int_mladdsub_vvv_pred<0b00, opc, asm, ZPR8>;
1860 def _H : sve_int_mladdsub_vvv_pred<0b01, opc, asm, ZPR16>;
1861 def _S : sve_int_mladdsub_vvv_pred<0b10, opc, asm, ZPR32>;
1862 def _D : sve_int_mladdsub_vvv_pred<0b11, opc, asm, ZPR64>;
1865 class sve_int_mlas_vvv_pred<bits<2> sz8_64, bits<1> opc, string asm,
1867 : I<(outs zprty:$Zda), (ins PPR3bAny:$Pg, zprty:$_Zda, zprty:$Zn, zprty:$Zm),
1868 asm, "\t$Zda, $Pg/m, $Zn, $Zm",
1875 let Inst{31-24} = 0b00000100;
1876 let Inst{23-22} = sz8_64;
1878 let Inst{20-16} = Zm;
1879 let Inst{15-14} = 0b01;
1881 let Inst{12-10} = Pg;
1883 let Inst{4-0} = Zda;
1885 let Constraints = "$Zda = $_Zda";
1886 let DestructiveInstType = Destructive;
1887 let ElementSize = zprty.ElementSize;
1890 multiclass sve_int_mlas_vvv_pred<bits<1> opc, string asm> {
1891 def _B : sve_int_mlas_vvv_pred<0b00, opc, asm, ZPR8>;
1892 def _H : sve_int_mlas_vvv_pred<0b01, opc, asm, ZPR16>;
1893 def _S : sve_int_mlas_vvv_pred<0b10, opc, asm, ZPR32>;
1894 def _D : sve_int_mlas_vvv_pred<0b11, opc, asm, ZPR64>;
1897 //===----------------------------------------------------------------------===//
1898 // SVE2 Integer Multiply-Add - Unpredicated Group
1899 //===----------------------------------------------------------------------===//
1901 class sve2_int_mla<bits<2> sz, bits<5> opc, string asm,
1902 ZPRRegOp zprty1, ZPRRegOp zprty2>
1903 : I<(outs zprty1:$Zda), (ins zprty1:$_Zda, zprty2:$Zn, zprty2:$Zm),
1904 asm, "\t$Zda, $Zn, $Zm", "", []>, Sched<[]> {
1908 let Inst{31-24} = 0b01000100;
1909 let Inst{23-22} = sz;
1911 let Inst{20-16} = Zm;
1913 let Inst{14-10} = opc;
1915 let Inst{4-0} = Zda;
1917 let Constraints = "$Zda = $_Zda";
1918 let DestructiveInstType = Destructive;
1919 let ElementSize = ElementSizeNone;
1922 multiclass sve2_int_mla<bit S, string asm> {
1923 def _B : sve2_int_mla<0b00, { 0b1110, S }, asm, ZPR8, ZPR8>;
1924 def _H : sve2_int_mla<0b01, { 0b1110, S }, asm, ZPR16, ZPR16>;
1925 def _S : sve2_int_mla<0b10, { 0b1110, S }, asm, ZPR32, ZPR32>;
1926 def _D : sve2_int_mla<0b11, { 0b1110, S }, asm, ZPR64, ZPR64>;
1929 multiclass sve2_int_mla_long<bits<5> opc, string asm> {
1930 def _H : sve2_int_mla<0b01, opc, asm, ZPR16, ZPR8>;
1931 def _S : sve2_int_mla<0b10, opc, asm, ZPR32, ZPR16>;
1932 def _D : sve2_int_mla<0b11, opc, asm, ZPR64, ZPR32>;
1935 //===----------------------------------------------------------------------===//
1936 // SVE2 Integer Multiply-Add - Indexed Group
1937 //===----------------------------------------------------------------------===//
1939 class sve2_int_mla_by_indexed_elem<bits<2> sz, bits<6> opc, string asm,
1940 ZPRRegOp zprty1, ZPRRegOp zprty2,
1941 ZPRRegOp zprty3, Operand itype>
1942 : I<(outs zprty1:$Zda), (ins zprty1:$_Zda, zprty2:$Zn, zprty3:$Zm, itype:$iop),
1943 asm, "\t$Zda, $Zn, $Zm$iop", "", []>, Sched<[]> {
1946 let Inst{31-24} = 0b01000100;
1947 let Inst{23-22} = sz;
1949 let Inst{15-10} = opc;
1951 let Inst{4-0} = Zda;
1953 let Constraints = "$Zda = $_Zda";
1954 let DestructiveInstType = Destructive;
1955 let ElementSize = ElementSizeNone;
1958 multiclass sve2_int_mla_by_indexed_elem<bits<2> opc, bit S, string asm> {
1959 def _H : sve2_int_mla_by_indexed_elem<{0, ?}, { 0b000, opc, S }, asm, ZPR16, ZPR16, ZPR3b16, VectorIndexH> {
1962 let Inst{22} = iop{2};
1963 let Inst{20-19} = iop{1-0};
1964 let Inst{18-16} = Zm;
1966 def _S : sve2_int_mla_by_indexed_elem<0b10, { 0b000, opc, S }, asm, ZPR32, ZPR32, ZPR3b32, VectorIndexS> {
1969 let Inst{20-19} = iop;
1970 let Inst{18-16} = Zm;
1972 def _D : sve2_int_mla_by_indexed_elem<0b11, { 0b000, opc, S }, asm, ZPR64, ZPR64, ZPR4b64, VectorIndexD> {
1976 let Inst{19-16} = Zm;
1980 //===----------------------------------------------------------------------===//
1981 // SVE2 Integer Multiply-Add Long - Indexed Group
1982 //===----------------------------------------------------------------------===//
1984 multiclass sve2_int_mla_long_by_indexed_elem<bits<4> opc, string asm> {
1985 def _S : sve2_int_mla_by_indexed_elem<0b10, { opc{3}, 0b0, opc{2-1}, ?, opc{0} },
1986 asm, ZPR32, ZPR16, ZPR3b16, VectorIndexH> {
1989 let Inst{20-19} = iop{2-1};
1990 let Inst{18-16} = Zm;
1991 let Inst{11} = iop{0};
1993 def _D : sve2_int_mla_by_indexed_elem<0b11, { opc{3}, 0b0, opc{2-1}, ?, opc{0} },
1994 asm, ZPR64, ZPR32, ZPR4b32, VectorIndexS> {
1997 let Inst{20} = iop{1};
1998 let Inst{19-16} = Zm;
1999 let Inst{11} = iop{0};
2003 //===----------------------------------------------------------------------===//
2004 // SVE Integer Dot Product Group
2005 //===----------------------------------------------------------------------===//
2007 class sve_intx_dot<bit sz, bit U, string asm, ZPRRegOp zprty1,
2009 : I<(outs zprty1:$Zda), (ins zprty1:$_Zda, zprty2:$Zn, zprty2:$Zm), asm,
2010 "\t$Zda, $Zn, $Zm", "", []>, Sched<[]> {
2014 let Inst{31-23} = 0b010001001;
2017 let Inst{20-16} = Zm;
2018 let Inst{15-11} = 0;
2021 let Inst{4-0} = Zda;
2023 let Constraints = "$Zda = $_Zda";
2024 let DestructiveInstType = Destructive;
2025 let ElementSize = zprty1.ElementSize;
2028 multiclass sve_intx_dot<bit opc, string asm> {
2029 def _S : sve_intx_dot<0b0, opc, asm, ZPR32, ZPR8>;
2030 def _D : sve_intx_dot<0b1, opc, asm, ZPR64, ZPR16>;
2033 //===----------------------------------------------------------------------===//
2034 // SVE Integer Dot Product Group - Indexed Group
2035 //===----------------------------------------------------------------------===//
2037 class sve_intx_dot_by_indexed_elem<bit sz, bit U, string asm,
2038 ZPRRegOp zprty1, ZPRRegOp zprty2,
2039 ZPRRegOp zprty3, Operand itype>
2040 : I<(outs zprty1:$Zda), (ins zprty1:$_Zda, zprty2:$Zn, zprty3:$Zm, itype:$iop),
2041 asm, "\t$Zda, $Zn, $Zm$iop",
2042 "", []>, Sched<[]> {
2045 let Inst{31-23} = 0b010001001;
2048 let Inst{15-11} = 0;
2051 let Inst{4-0} = Zda;
2053 let Constraints = "$Zda = $_Zda";
2054 let DestructiveInstType = Destructive;
2055 let ElementSize = ElementSizeNone;
2058 multiclass sve_intx_dot_by_indexed_elem<bit opc, string asm> {
2059 def _S : sve_intx_dot_by_indexed_elem<0b0, opc, asm, ZPR32, ZPR8, ZPR3b8, VectorIndexS> {
2062 let Inst{20-19} = iop;
2063 let Inst{18-16} = Zm;
2065 def _D : sve_intx_dot_by_indexed_elem<0b1, opc, asm, ZPR64, ZPR16, ZPR4b16, VectorIndexD> {
2069 let Inst{19-16} = Zm;
2073 //===----------------------------------------------------------------------===//
2074 // SVE2 Complex Integer Dot Product Group
2075 //===----------------------------------------------------------------------===//
2077 class sve2_complex_int_arith<bits<2> sz, bits<4> opc, string asm,
2078 ZPRRegOp zprty1, ZPRRegOp zprty2>
2079 : I<(outs zprty1:$Zda), (ins zprty1:$_Zda, zprty2:$Zn, zprty2:$Zm,
2080 complexrotateop:$rot),
2081 asm, "\t$Zda, $Zn, $Zm, $rot", "", []>, Sched<[]> {
2086 let Inst{31-24} = 0b01000100;
2087 let Inst{23-22} = sz;
2089 let Inst{20-16} = Zm;
2090 let Inst{15-12} = opc;
2091 let Inst{11-10} = rot;
2093 let Inst{4-0} = Zda;
2095 let Constraints = "$Zda = $_Zda";
2096 let DestructiveInstType = Destructive;
2097 let ElementSize = ElementSizeNone;
2100 multiclass sve2_cintx_dot<string asm> {
2101 def _S : sve2_complex_int_arith<0b10, 0b0001, asm, ZPR32, ZPR8>;
2102 def _D : sve2_complex_int_arith<0b11, 0b0001, asm, ZPR64, ZPR16>;
2105 //===----------------------------------------------------------------------===//
2106 // SVE2 Complex Multiply-Add Group
2107 //===----------------------------------------------------------------------===//
2109 multiclass sve2_int_cmla<bit opc, string asm> {
2110 def _B : sve2_complex_int_arith<0b00, { 0b001, opc }, asm, ZPR8, ZPR8>;
2111 def _H : sve2_complex_int_arith<0b01, { 0b001, opc }, asm, ZPR16, ZPR16>;
2112 def _S : sve2_complex_int_arith<0b10, { 0b001, opc }, asm, ZPR32, ZPR32>;
2113 def _D : sve2_complex_int_arith<0b11, { 0b001, opc }, asm, ZPR64, ZPR64>;
2116 //===----------------------------------------------------------------------===//
2117 // SVE2 Complex Integer Dot Product - Indexed Group
2118 //===----------------------------------------------------------------------===//
2120 class sve2_complex_int_arith_indexed<bits<2> sz, bits<4> opc, string asm,
2121 ZPRRegOp zprty1, ZPRRegOp zprty2,
2122 ZPRRegOp zprty3, Operand itype>
2123 : I<(outs zprty1:$Zda), (ins zprty1:$_Zda, zprty2:$Zn, zprty3:$Zm, itype:$iop,
2124 complexrotateop:$rot),
2125 asm, "\t$Zda, $Zn, $Zm$iop, $rot", "", []>, Sched<[]> {
2129 let Inst{31-24} = 0b01000100;
2130 let Inst{23-22} = sz;
2132 let Inst{15-12} = opc;
2133 let Inst{11-10} = rot;
2135 let Inst{4-0} = Zda;
2137 let Constraints = "$Zda = $_Zda";
2138 let DestructiveInstType = Destructive;
2139 let ElementSize = ElementSizeNone;
2142 multiclass sve2_cintx_dot_by_indexed_elem<string asm> {
2143 def _S : sve2_complex_int_arith_indexed<0b10, 0b0100, asm, ZPR32, ZPR8, ZPR3b8, VectorIndexS> {
2146 let Inst{20-19} = iop;
2147 let Inst{18-16} = Zm;
2149 def _D : sve2_complex_int_arith_indexed<0b11, 0b0100, asm, ZPR64, ZPR16, ZPR4b16, VectorIndexD> {
2153 let Inst{19-16} = Zm;
2157 //===----------------------------------------------------------------------===//
2158 // SVE2 Complex Multiply-Add - Indexed Group
2159 //===----------------------------------------------------------------------===//
2161 multiclass sve2_cmla_by_indexed_elem<bit opc, string asm> {
2162 def _H : sve2_complex_int_arith_indexed<0b10, { 0b011, opc }, asm, ZPR16, ZPR16, ZPR3b16, VectorIndexS> {
2165 let Inst{20-19} = iop;
2166 let Inst{18-16} = Zm;
2168 def _S : sve2_complex_int_arith_indexed<0b11, { 0b011, opc }, asm, ZPR32, ZPR32, ZPR4b32, VectorIndexD> {
2172 let Inst{19-16} = Zm;
2176 //===----------------------------------------------------------------------===//
2177 // SVE2 Integer Multiply - Unpredicated Group
2178 //===----------------------------------------------------------------------===//
2180 class sve2_int_mul<bits<2> sz, bits<3> opc, string asm, ZPRRegOp zprty>
2181 : I<(outs zprty:$Zd), (ins zprty:$Zn, zprty:$Zm),
2182 asm, "\t$Zd, $Zn, $Zm", "", []>, Sched<[]> {
2186 let Inst{31-24} = 0b00000100;
2187 let Inst{23-22} = sz;
2189 let Inst{20-16} = Zm;
2190 let Inst{15-13} = 0b011;
2191 let Inst{12-10} = opc;
2196 multiclass sve2_int_mul<bits<3> opc, string asm> {
2197 def _B : sve2_int_mul<0b00, opc, asm, ZPR8>;
2198 def _H : sve2_int_mul<0b01, opc, asm, ZPR16>;
2199 def _S : sve2_int_mul<0b10, opc, asm, ZPR32>;
2200 def _D : sve2_int_mul<0b11, opc, asm, ZPR64>;
2203 //===----------------------------------------------------------------------===//
2204 // SVE2 Integer Multiply - Indexed Group
2205 //===----------------------------------------------------------------------===//
2207 class sve2_int_mul_by_indexed_elem<bits<2> sz, bits<4> opc, string asm,
2208 ZPRRegOp zprty1, ZPRRegOp zprty2,
2209 ZPRRegOp zprty3, Operand itype>
2210 : I<(outs zprty1:$Zd), (ins zprty2:$Zn, zprty3:$Zm, itype:$iop),
2211 asm, "\t$Zd, $Zn, $Zm$iop", "", []>, Sched<[]> {
2214 let Inst{31-24} = 0b01000100;
2215 let Inst{23-22} = sz;
2217 let Inst{15-14} = 0b11;
2218 let Inst{13-10} = opc;
2223 multiclass sve2_int_mul_by_indexed_elem<bits<4> opc, string asm> {
2224 def _H : sve2_int_mul_by_indexed_elem<{0, ?}, opc, asm, ZPR16, ZPR16, ZPR3b16, VectorIndexH> {
2227 let Inst{22} = iop{2};
2228 let Inst{20-19} = iop{1-0};
2229 let Inst{18-16} = Zm;
2231 def _S : sve2_int_mul_by_indexed_elem<0b10, opc, asm, ZPR32, ZPR32, ZPR3b32, VectorIndexS> {
2234 let Inst{20-19} = iop;
2235 let Inst{18-16} = Zm;
2237 def _D : sve2_int_mul_by_indexed_elem<0b11, opc, asm, ZPR64, ZPR64, ZPR4b64, VectorIndexD> {
2241 let Inst{19-16} = Zm;
2245 multiclass sve2_int_mul_long_by_indexed_elem<bits<3> opc, string asm> {
2246 def _S : sve2_int_mul_by_indexed_elem<0b10, { opc{2-1}, ?, opc{0} }, asm,
2247 ZPR32, ZPR16, ZPR3b16, VectorIndexH> {
2250 let Inst{20-19} = iop{2-1};
2251 let Inst{18-16} = Zm;
2252 let Inst{11} = iop{0};
2254 def _D : sve2_int_mul_by_indexed_elem<0b11, { opc{2-1}, ?, opc{0} }, asm,
2255 ZPR64, ZPR32, ZPR4b32, VectorIndexS> {
2258 let Inst{20} = iop{1};
2259 let Inst{19-16} = Zm;
2260 let Inst{11} = iop{0};
2264 //===----------------------------------------------------------------------===//
2265 // SVE2 Integer - Predicated Group
2266 //===----------------------------------------------------------------------===//
2268 class sve2_int_arith_pred<bits<2> sz, bits<6> opc, string asm,
2270 : I<(outs zprty:$Zdn), (ins PPR3bAny:$Pg, zprty:$_Zdn, zprty:$Zm),
2271 asm, "\t$Zdn, $Pg/m, $_Zdn, $Zm", "", []>, Sched<[]> {
2275 let Inst{31-24} = 0b01000100;
2276 let Inst{23-22} = sz;
2278 let Inst{20-16} = opc{5-1};
2279 let Inst{15-14} = 0b10;
2280 let Inst{13} = opc{0};
2281 let Inst{12-10} = Pg;
2283 let Inst{4-0} = Zdn;
2285 let Constraints = "$Zdn = $_Zdn";
2286 let DestructiveInstType = Destructive;
2287 let ElementSize = zprty.ElementSize;
2290 multiclass sve2_int_arith_pred<bits<6> opc, string asm> {
2291 def _B : sve2_int_arith_pred<0b00, opc, asm, ZPR8>;
2292 def _H : sve2_int_arith_pred<0b01, opc, asm, ZPR16>;
2293 def _S : sve2_int_arith_pred<0b10, opc, asm, ZPR32>;
2294 def _D : sve2_int_arith_pred<0b11, opc, asm, ZPR64>;
2297 class sve2_int_sadd_long_accum_pairwise<bits<2> sz, bit U, string asm,
2298 ZPRRegOp zprty1, ZPRRegOp zprty2>
2299 : I<(outs zprty1:$Zda), (ins PPR3bAny:$Pg, zprty1:$_Zda, zprty2:$Zn),
2300 asm, "\t$Zda, $Pg/m, $Zn", "", []>, Sched<[]> {
2304 let Inst{31-24} = 0b01000100;
2305 let Inst{23-22} = sz;
2306 let Inst{21-17} = 0b00010;
2308 let Inst{15-13} = 0b101;
2309 let Inst{12-10} = Pg;
2311 let Inst{4-0} = Zda;
2313 let Constraints = "$Zda = $_Zda";
2314 let DestructiveInstType = Destructive;
2315 let ElementSize = zprty1.ElementSize;
2318 multiclass sve2_int_sadd_long_accum_pairwise<bit U, string asm> {
2319 def _H : sve2_int_sadd_long_accum_pairwise<0b01, U, asm, ZPR16, ZPR8>;
2320 def _S : sve2_int_sadd_long_accum_pairwise<0b10, U, asm, ZPR32, ZPR16>;
2321 def _D : sve2_int_sadd_long_accum_pairwise<0b11, U, asm, ZPR64, ZPR32>;
2324 class sve2_int_un_pred_arit<bits<2> sz, bit Q, bits<2> opc,
2325 string asm, ZPRRegOp zprty>
2326 : I<(outs zprty:$Zd), (ins zprty:$_Zd, PPR3bAny:$Pg, zprty:$Zn),
2327 asm, "\t$Zd, $Pg/m, $Zn",
2333 let Inst{31-24} = 0b01000100;
2334 let Inst{23-22} = sz;
2335 let Inst{21-20} = 0b00;
2338 let Inst{17-16} = opc;
2339 let Inst{15-13} = 0b101;
2340 let Inst{12-10} = Pg;
2344 let Constraints = "$Zd = $_Zd";
2345 let DestructiveInstType = Destructive;
2346 let ElementSize = zprty.ElementSize;
2349 multiclass sve2_int_un_pred_arit_s<bits<3> opc, string asm> {
2350 def _S : sve2_int_un_pred_arit<0b10, opc{2}, opc{1-0}, asm, ZPR32>;
2353 multiclass sve2_int_un_pred_arit<bits<3> opc, string asm> {
2354 def _B : sve2_int_un_pred_arit<0b00, opc{2}, opc{1-0}, asm, ZPR8>;
2355 def _H : sve2_int_un_pred_arit<0b01, opc{2}, opc{1-0}, asm, ZPR16>;
2356 def _S : sve2_int_un_pred_arit<0b10, opc{2}, opc{1-0}, asm, ZPR32>;
2357 def _D : sve2_int_un_pred_arit<0b11, opc{2}, opc{1-0}, asm, ZPR64>;
2360 //===----------------------------------------------------------------------===//
2361 // SVE2 Widening Integer Arithmetic Group
2362 //===----------------------------------------------------------------------===//
2364 class sve2_wide_int_arith<bits<2> sz, bits<5> opc, string asm,
2365 ZPRRegOp zprty1, ZPRRegOp zprty2, ZPRRegOp zprty3>
2366 : I<(outs zprty1:$Zd), (ins zprty2:$Zn, zprty3:$Zm),
2367 asm, "\t$Zd, $Zn, $Zm", "", []>, Sched<[]> {
2371 let Inst{31-24} = 0b01000101;
2372 let Inst{23-22} = sz;
2374 let Inst{20-16} = Zm;
2376 let Inst{14-10} = opc;
2381 multiclass sve2_wide_int_arith_long<bits<5> opc, string asm> {
2382 def _H : sve2_wide_int_arith<0b01, opc, asm, ZPR16, ZPR8, ZPR8>;
2383 def _S : sve2_wide_int_arith<0b10, opc, asm, ZPR32, ZPR16, ZPR16>;
2384 def _D : sve2_wide_int_arith<0b11, opc, asm, ZPR64, ZPR32, ZPR32>;
2387 multiclass sve2_wide_int_arith_wide<bits<3> opc, string asm> {
2388 def _H : sve2_wide_int_arith<0b01, { 0b10, opc }, asm, ZPR16, ZPR16, ZPR8>;
2389 def _S : sve2_wide_int_arith<0b10, { 0b10, opc }, asm, ZPR32, ZPR32, ZPR16>;
2390 def _D : sve2_wide_int_arith<0b11, { 0b10, opc }, asm, ZPR64, ZPR64, ZPR32>;
2393 multiclass sve2_pmul_long<bits<1> opc, string asm> {
2394 def _H : sve2_wide_int_arith<0b01, {0b1101, opc}, asm, ZPR16, ZPR8, ZPR8>;
2395 def _D : sve2_wide_int_arith<0b11, {0b1101, opc}, asm, ZPR64, ZPR32, ZPR32>;
2398 //===----------------------------------------------------------------------===//
2400 //===----------------------------------------------------------------------===//
2402 class sve2_misc<bits<2> sz, bits<4> opc, string asm,
2403 ZPRRegOp zprty1, ZPRRegOp zprty2>
2404 : I<(outs zprty1:$Zd), (ins zprty2:$Zn, zprty2:$Zm),
2405 asm, "\t$Zd, $Zn, $Zm", "", []>, Sched<[]> {
2409 let Inst{31-24} = 0b01000101;
2410 let Inst{23-22} = sz;
2412 let Inst{20-16} = Zm;
2413 let Inst{15-14} = 0b10;
2414 let Inst{13-10} = opc;
2419 multiclass sve2_misc_bitwise<bits<4> opc, string asm> {
2420 def _B : sve2_misc<0b00, opc, asm, ZPR8, ZPR8>;
2421 def _H : sve2_misc<0b01, opc, asm, ZPR16, ZPR16>;
2422 def _S : sve2_misc<0b10, opc, asm, ZPR32, ZPR32>;
2423 def _D : sve2_misc<0b11, opc, asm, ZPR64, ZPR64>;
2426 multiclass sve2_misc_int_addsub_long_interleaved<bits<2> opc, string asm> {
2427 def _H : sve2_misc<0b01, { 0b00, opc }, asm, ZPR16, ZPR8>;
2428 def _S : sve2_misc<0b10, { 0b00, opc }, asm, ZPR32, ZPR16>;
2429 def _D : sve2_misc<0b11, { 0b00, opc }, asm, ZPR64, ZPR32>;
2432 class sve2_bitwise_xor_interleaved<bits<2> sz, bits<1> opc, string asm,
2433 ZPRRegOp zprty1, ZPRRegOp zprty2>
2434 : I<(outs zprty1:$Zd), (ins zprty1:$_Zd, zprty2:$Zn, zprty2:$Zm),
2435 asm, "\t$Zd, $Zn, $Zm", "", []>, Sched<[]> {
2439 let Inst{31-24} = 0b01000101;
2440 let Inst{23-22} = sz;
2442 let Inst{20-16} = Zm;
2443 let Inst{15-11} = 0b10010;
2448 let Constraints = "$Zd = $_Zd";
2449 let DestructiveInstType = Destructive;
2450 let ElementSize = ElementSizeNone;
2453 multiclass sve2_bitwise_xor_interleaved<bit opc, string asm> {
2454 def _B : sve2_bitwise_xor_interleaved<0b00, opc, asm, ZPR8, ZPR8>;
2455 def _H : sve2_bitwise_xor_interleaved<0b01, opc, asm, ZPR16, ZPR16>;
2456 def _S : sve2_bitwise_xor_interleaved<0b10, opc, asm, ZPR32, ZPR32>;
2457 def _D : sve2_bitwise_xor_interleaved<0b11, opc, asm, ZPR64, ZPR64>;
2460 class sve2_bitwise_shift_left_long<bits<3> tsz8_64, bits<2> opc, string asm,
2461 ZPRRegOp zprty1, ZPRRegOp zprty2,
2463 : I<(outs zprty1:$Zd), (ins zprty2:$Zn, immtype:$imm),
2464 asm, "\t$Zd, $Zn, $imm",
2465 "", []>, Sched<[]> {
2469 let Inst{31-23} = 0b010001010;
2470 let Inst{22} = tsz8_64{2};
2472 let Inst{20-19} = tsz8_64{1-0};
2473 let Inst{18-16} = imm{2-0}; // imm3
2474 let Inst{15-12} = 0b1010;
2475 let Inst{11-10} = opc;
2480 multiclass sve2_bitwise_shift_left_long<bits<2> opc, string asm> {
2481 def _H : sve2_bitwise_shift_left_long<{0,0,1}, opc, asm,
2482 ZPR16, ZPR8, vecshiftL8>;
2483 def _S : sve2_bitwise_shift_left_long<{0,1,?}, opc, asm,
2484 ZPR32, ZPR16, vecshiftL16> {
2485 let Inst{19} = imm{3};
2487 def _D : sve2_bitwise_shift_left_long<{1,?,?}, opc, asm,
2488 ZPR64, ZPR32, vecshiftL32> {
2489 let Inst{20-19} = imm{4-3};
2493 //===----------------------------------------------------------------------===//
2494 // SVE2 Accumulate Group
2495 //===----------------------------------------------------------------------===//
2497 class sve2_int_bin_shift_imm<bits<4> tsz8_64, bit opc, string asm,
2498 ZPRRegOp zprty, Operand immtype>
2499 : I<(outs zprty:$Zd), (ins zprty:$_Zd, zprty:$Zn, immtype:$imm),
2500 asm, "\t$Zd, $Zn, $imm",
2501 "", []>, Sched<[]> {
2505 let Inst{31-24} = 0b01000101;
2506 let Inst{23-22} = tsz8_64{3-2};
2508 let Inst{20-19} = tsz8_64{1-0};
2509 let Inst{18-16} = imm{2-0}; // imm3
2510 let Inst{15-11} = 0b11110;
2515 let Constraints = "$Zd = $_Zd";
2518 multiclass sve2_int_bin_shift_imm_left<bit opc, string asm> {
2519 def _B : sve2_int_bin_shift_imm<{0,0,0,1}, opc, asm, ZPR8, vecshiftL8>;
2520 def _H : sve2_int_bin_shift_imm<{0,0,1,?}, opc, asm, ZPR16, vecshiftL16> {
2521 let Inst{19} = imm{3};
2523 def _S : sve2_int_bin_shift_imm<{0,1,?,?}, opc, asm, ZPR32, vecshiftL32> {
2524 let Inst{20-19} = imm{4-3};
2526 def _D : sve2_int_bin_shift_imm<{1,?,?,?}, opc, asm, ZPR64, vecshiftL64> {
2527 let Inst{22} = imm{5};
2528 let Inst{20-19} = imm{4-3};
2532 multiclass sve2_int_bin_shift_imm_right<bit opc, string asm> {
2533 def _B : sve2_int_bin_shift_imm<{0,0,0,1}, opc, asm, ZPR8, vecshiftR8>;
2534 def _H : sve2_int_bin_shift_imm<{0,0,1,?}, opc, asm, ZPR16, vecshiftR16> {
2535 let Inst{19} = imm{3};
2537 def _S : sve2_int_bin_shift_imm<{0,1,?,?}, opc, asm, ZPR32, vecshiftR32> {
2538 let Inst{20-19} = imm{4-3};
2540 def _D : sve2_int_bin_shift_imm<{1,?,?,?}, opc, asm, ZPR64, vecshiftR64> {
2541 let Inst{22} = imm{5};
2542 let Inst{20-19} = imm{4-3};
2546 class sve2_int_bin_accum_shift_imm<bits<4> tsz8_64, bits<2> opc, string asm,
2547 ZPRRegOp zprty, Operand immtype>
2548 : I<(outs zprty:$Zda), (ins zprty:$_Zda, zprty:$Zn, immtype:$imm),
2549 asm, "\t$Zda, $Zn, $imm",
2550 "", []>, Sched<[]> {
2554 let Inst{31-24} = 0b01000101;
2555 let Inst{23-22} = tsz8_64{3-2};
2557 let Inst{20-19} = tsz8_64{1-0};
2558 let Inst{18-16} = imm{2-0}; // imm3
2559 let Inst{15-12} = 0b1110;
2560 let Inst{11-10} = opc;
2562 let Inst{4-0} = Zda;
2564 let Constraints = "$Zda = $_Zda";
2565 let DestructiveInstType = Destructive;
2566 let ElementSize = ElementSizeNone;
2569 multiclass sve2_int_bin_accum_shift_imm_right<bits<2> opc, string asm> {
2570 def _B : sve2_int_bin_accum_shift_imm<{0,0,0,1}, opc, asm, ZPR8, vecshiftR8>;
2571 def _H : sve2_int_bin_accum_shift_imm<{0,0,1,?}, opc, asm, ZPR16, vecshiftR16> {
2572 let Inst{19} = imm{3};
2574 def _S : sve2_int_bin_accum_shift_imm<{0,1,?,?}, opc, asm, ZPR32, vecshiftR32> {
2575 let Inst{20-19} = imm{4-3};
2577 def _D : sve2_int_bin_accum_shift_imm<{1,?,?,?}, opc, asm, ZPR64, vecshiftR64> {
2578 let Inst{22} = imm{5};
2579 let Inst{20-19} = imm{4-3};
2583 class sve2_int_cadd<bits<2> sz, bit opc, string asm, ZPRRegOp zprty>
2584 : I<(outs zprty:$Zdn), (ins zprty:$_Zdn, zprty:$Zm, complexrotateopodd:$rot),
2585 asm, "\t$Zdn, $_Zdn, $Zm, $rot", "", []>, Sched<[]> {
2589 let Inst{31-24} = 0b01000101;
2590 let Inst{23-22} = sz;
2591 let Inst{21-17} = 0b00000;
2593 let Inst{15-11} = 0b11011;
2596 let Inst{4-0} = Zdn;
2598 let Constraints = "$Zdn = $_Zdn";
2599 let DestructiveInstType = Destructive;
2600 let ElementSize = ElementSizeNone;
2603 multiclass sve2_int_cadd<bit opc, string asm> {
2604 def _B : sve2_int_cadd<0b00, opc, asm, ZPR8>;
2605 def _H : sve2_int_cadd<0b01, opc, asm, ZPR16>;
2606 def _S : sve2_int_cadd<0b10, opc, asm, ZPR32>;
2607 def _D : sve2_int_cadd<0b11, opc, asm, ZPR64>;
2610 class sve2_int_absdiff_accum<bits<2> sz, bits<4> opc, string asm,
2611 ZPRRegOp zprty1, ZPRRegOp zprty2>
2612 : I<(outs zprty1:$Zda), (ins zprty1:$_Zda, zprty2:$Zn, zprty2:$Zm),
2613 asm, "\t$Zda, $Zn, $Zm", "", []>, Sched<[]> {
2617 let Inst{31-24} = 0b01000101;
2618 let Inst{23-22} = sz;
2620 let Inst{20-16} = Zm;
2621 let Inst{15-14} = 0b11;
2622 let Inst{13-10} = opc;
2624 let Inst{4-0} = Zda;
2626 let Constraints = "$Zda = $_Zda";
2627 let DestructiveInstType = Destructive;
2628 let ElementSize = ElementSizeNone;
2631 multiclass sve2_int_absdiff_accum<bit opc, string asm> {
2632 def _B : sve2_int_absdiff_accum<0b00, { 0b111, opc }, asm, ZPR8, ZPR8>;
2633 def _H : sve2_int_absdiff_accum<0b01, { 0b111, opc }, asm, ZPR16, ZPR16>;
2634 def _S : sve2_int_absdiff_accum<0b10, { 0b111, opc }, asm, ZPR32, ZPR32>;
2635 def _D : sve2_int_absdiff_accum<0b11, { 0b111, opc }, asm, ZPR64, ZPR64>;
2638 multiclass sve2_int_absdiff_accum_long<bits<2> opc, string asm> {
2639 def _H : sve2_int_absdiff_accum<0b01, { 0b00, opc }, asm, ZPR16, ZPR8>;
2640 def _S : sve2_int_absdiff_accum<0b10, { 0b00, opc }, asm, ZPR32, ZPR16>;
2641 def _D : sve2_int_absdiff_accum<0b11, { 0b00, opc }, asm, ZPR64, ZPR32>;
2644 multiclass sve2_int_addsub_long_carry<bits<2> opc, string asm> {
2645 def _S : sve2_int_absdiff_accum<{ opc{1}, 0b0 }, { 0b010, opc{0} }, asm,
2647 def _D : sve2_int_absdiff_accum<{ opc{1}, 0b1 }, { 0b010, opc{0} }, asm,
2651 //===----------------------------------------------------------------------===//
2652 // SVE2 Narrowing Group
2653 //===----------------------------------------------------------------------===//
2655 class sve2_int_bin_shift_imm_narrow_bottom<bits<3> tsz8_64, bits<3> opc,
2656 string asm, ZPRRegOp zprty1,
2657 ZPRRegOp zprty2, Operand immtype>
2658 : I<(outs zprty1:$Zd), (ins zprty2:$Zn, immtype:$imm),
2659 asm, "\t$Zd, $Zn, $imm",
2660 "", []>, Sched<[]> {
2664 let Inst{31-23} = 0b010001010;
2665 let Inst{22} = tsz8_64{2};
2667 let Inst{20-19} = tsz8_64{1-0};
2668 let Inst{18-16} = imm{2-0}; // imm3
2669 let Inst{15-14} = 0b00;
2670 let Inst{13-11} = opc;
2676 multiclass sve2_int_bin_shift_imm_right_narrow_bottom<bits<3> opc, string asm> {
2677 def _B : sve2_int_bin_shift_imm_narrow_bottom<{0,0,1}, opc, asm, ZPR8, ZPR16,
2679 def _H : sve2_int_bin_shift_imm_narrow_bottom<{0,1,?}, opc, asm, ZPR16, ZPR32,
2681 let Inst{19} = imm{3};
2683 def _S : sve2_int_bin_shift_imm_narrow_bottom<{1,?,?}, opc, asm, ZPR32, ZPR64,
2685 let Inst{20-19} = imm{4-3};
2689 class sve2_int_bin_shift_imm_narrow_top<bits<3> tsz8_64, bits<3> opc,
2690 string asm, ZPRRegOp zprty1,
2691 ZPRRegOp zprty2, Operand immtype>
2692 : I<(outs zprty1:$Zd), (ins zprty1:$_Zd, zprty2:$Zn, immtype:$imm),
2693 asm, "\t$Zd, $Zn, $imm",
2694 "", []>, Sched<[]> {
2698 let Inst{31-23} = 0b010001010;
2699 let Inst{22} = tsz8_64{2};
2701 let Inst{20-19} = tsz8_64{1-0};
2702 let Inst{18-16} = imm{2-0}; // imm3
2703 let Inst{15-14} = 0b00;
2704 let Inst{13-11} = opc;
2709 let Constraints = "$Zd = $_Zd";
2712 multiclass sve2_int_bin_shift_imm_right_narrow_top<bits<3> opc, string asm> {
2713 def _B : sve2_int_bin_shift_imm_narrow_top<{0,0,1}, opc, asm, ZPR8, ZPR16,
2715 def _H : sve2_int_bin_shift_imm_narrow_top<{0,1,?}, opc, asm, ZPR16, ZPR32,
2717 let Inst{19} = imm{3};
2719 def _S : sve2_int_bin_shift_imm_narrow_top<{1,?,?}, opc, asm, ZPR32, ZPR64,
2721 let Inst{20-19} = imm{4-3};
2725 class sve2_int_addsub_narrow_high_bottom<bits<2> sz, bits<2> opc, string asm,
2726 ZPRRegOp zprty1, ZPRRegOp zprty2>
2727 : I<(outs zprty1:$Zd), (ins zprty2:$Zn, zprty2:$Zm),
2728 asm, "\t$Zd, $Zn, $Zm", "", []>, Sched<[]> {
2732 let Inst{31-24} = 0b01000101;
2733 let Inst{23-22} = sz;
2735 let Inst{20-16} = Zm;
2736 let Inst{15-13} = 0b011;
2737 let Inst{12-11} = opc; // S, R
2738 let Inst{10} = 0b0; // Top
2743 multiclass sve2_int_addsub_narrow_high_bottom<bits<2> opc, string asm> {
2744 def _B : sve2_int_addsub_narrow_high_bottom<0b01, opc, asm, ZPR8, ZPR16>;
2745 def _H : sve2_int_addsub_narrow_high_bottom<0b10, opc, asm, ZPR16, ZPR32>;
2746 def _S : sve2_int_addsub_narrow_high_bottom<0b11, opc, asm, ZPR32, ZPR64>;
2749 class sve2_int_addsub_narrow_high_top<bits<2> sz, bits<2> opc, string asm,
2750 ZPRRegOp zprty1, ZPRRegOp zprty2>
2751 : I<(outs zprty1:$Zd), (ins zprty1:$_Zd, zprty2:$Zn, zprty2:$Zm),
2752 asm, "\t$Zd, $Zn, $Zm", "", []>, Sched<[]> {
2756 let Inst{31-24} = 0b01000101;
2757 let Inst{23-22} = sz;
2759 let Inst{20-16} = Zm;
2760 let Inst{15-13} = 0b011;
2761 let Inst{12-11} = opc; // S, R
2762 let Inst{10} = 0b1; // Top
2766 let Constraints = "$Zd = $_Zd";
2769 multiclass sve2_int_addsub_narrow_high_top<bits<2> opc, string asm> {
2770 def _B : sve2_int_addsub_narrow_high_top<0b01, opc, asm, ZPR8, ZPR16>;
2771 def _H : sve2_int_addsub_narrow_high_top<0b10, opc, asm, ZPR16, ZPR32>;
2772 def _S : sve2_int_addsub_narrow_high_top<0b11, opc, asm, ZPR32, ZPR64>;
2775 class sve2_int_sat_extract_narrow_bottom<bits<3> tsz8_64, bits<2> opc, string asm,
2776 ZPRRegOp zprty1, ZPRRegOp zprty2>
2777 : I<(outs zprty1:$Zd), (ins zprty2:$Zn),
2778 asm, "\t$Zd, $Zn", "", []>, Sched<[]> {
2781 let Inst{31-23} = 0b010001010;
2782 let Inst{22} = tsz8_64{2};
2784 let Inst{20-19} = tsz8_64{1-0};
2785 let Inst{18-13} = 0b000010;
2786 let Inst{12-11} = opc;
2792 multiclass sve2_int_sat_extract_narrow_bottom<bits<2> opc, string asm> {
2793 def _B : sve2_int_sat_extract_narrow_bottom<0b001, opc, asm, ZPR8, ZPR16>;
2794 def _H : sve2_int_sat_extract_narrow_bottom<0b010, opc, asm, ZPR16, ZPR32>;
2795 def _S : sve2_int_sat_extract_narrow_bottom<0b100, opc, asm, ZPR32, ZPR64>;
2798 class sve2_int_sat_extract_narrow_top<bits<3> tsz8_64, bits<2> opc, string asm,
2799 ZPRRegOp zprty1, ZPRRegOp zprty2>
2800 : I<(outs zprty1:$Zd), (ins zprty1:$_Zd, zprty2:$Zn),
2801 asm, "\t$Zd, $Zn", "", []>, Sched<[]> {
2804 let Inst{31-23} = 0b010001010;
2805 let Inst{22} = tsz8_64{2};
2807 let Inst{20-19} = tsz8_64{1-0};
2808 let Inst{18-13} = 0b000010;
2809 let Inst{12-11} = opc;
2814 let Constraints = "$Zd = $_Zd";
2817 multiclass sve2_int_sat_extract_narrow_top<bits<2> opc, string asm> {
2818 def _B : sve2_int_sat_extract_narrow_top<0b001, opc, asm, ZPR8, ZPR16>;
2819 def _H : sve2_int_sat_extract_narrow_top<0b010, opc, asm, ZPR16, ZPR32>;
2820 def _S : sve2_int_sat_extract_narrow_top<0b100, opc, asm, ZPR32, ZPR64>;
2823 //===----------------------------------------------------------------------===//
2824 // SVE Integer Arithmetic - Unary Predicated Group
2825 //===----------------------------------------------------------------------===//
2827 class sve_int_un_pred_arit<bits<2> sz8_64, bits<4> opc,
2828 string asm, ZPRRegOp zprty>
2829 : I<(outs zprty:$Zd), (ins zprty:$_Zd, PPR3bAny:$Pg, zprty:$Zn),
2830 asm, "\t$Zd, $Pg/m, $Zn",
2836 let Inst{31-24} = 0b00000100;
2837 let Inst{23-22} = sz8_64;
2838 let Inst{21-20} = 0b01;
2839 let Inst{19} = opc{0};
2840 let Inst{18-16} = opc{3-1};
2841 let Inst{15-13} = 0b101;
2842 let Inst{12-10} = Pg;
2846 let Constraints = "$Zd = $_Zd";
2847 let DestructiveInstType = Destructive;
2848 let ElementSize = zprty.ElementSize;
2851 multiclass sve_int_un_pred_arit_0<bits<3> opc, string asm,
2852 SDPatternOperator op> {
2853 def _B : sve_int_un_pred_arit<0b00, { opc, 0b0 }, asm, ZPR8>;
2854 def _H : sve_int_un_pred_arit<0b01, { opc, 0b0 }, asm, ZPR16>;
2855 def _S : sve_int_un_pred_arit<0b10, { opc, 0b0 }, asm, ZPR32>;
2856 def _D : sve_int_un_pred_arit<0b11, { opc, 0b0 }, asm, ZPR64>;
2858 def : SVE_3_Op_Pat<nxv16i8, op, nxv16i8, nxv16i1, nxv16i8, !cast<Instruction>(NAME # _B)>;
2859 def : SVE_3_Op_Pat<nxv8i16, op, nxv8i16, nxv8i1, nxv8i16, !cast<Instruction>(NAME # _H)>;
2860 def : SVE_3_Op_Pat<nxv4i32, op, nxv4i32, nxv4i1, nxv4i32, !cast<Instruction>(NAME # _S)>;
2861 def : SVE_3_Op_Pat<nxv2i64, op, nxv2i64, nxv2i1, nxv2i64, !cast<Instruction>(NAME # _D)>;
2864 multiclass sve_int_un_pred_arit_0_h<bits<3> opc, string asm> {
2865 def _H : sve_int_un_pred_arit<0b01, { opc, 0b0 }, asm, ZPR16>;
2866 def _S : sve_int_un_pred_arit<0b10, { opc, 0b0 }, asm, ZPR32>;
2867 def _D : sve_int_un_pred_arit<0b11, { opc, 0b0 }, asm, ZPR64>;
2870 multiclass sve_int_un_pred_arit_0_w<bits<3> opc, string asm> {
2871 def _S : sve_int_un_pred_arit<0b10, { opc, 0b0 }, asm, ZPR32>;
2872 def _D : sve_int_un_pred_arit<0b11, { opc, 0b0 }, asm, ZPR64>;
2875 multiclass sve_int_un_pred_arit_0_d<bits<3> opc, string asm> {
2876 def _D : sve_int_un_pred_arit<0b11, { opc, 0b0 }, asm, ZPR64>;
2879 multiclass sve_int_un_pred_arit_1<bits<3> opc, string asm> {
2880 def _B : sve_int_un_pred_arit<0b00, { opc, 0b1 }, asm, ZPR8>;
2881 def _H : sve_int_un_pred_arit<0b01, { opc, 0b1 }, asm, ZPR16>;
2882 def _S : sve_int_un_pred_arit<0b10, { opc, 0b1 }, asm, ZPR32>;
2883 def _D : sve_int_un_pred_arit<0b11, { opc, 0b1 }, asm, ZPR64>;
2886 multiclass sve_int_un_pred_arit_1_fp<bits<3> opc, string asm> {
2887 def _H : sve_int_un_pred_arit<0b01, { opc, 0b1 }, asm, ZPR16>;
2888 def _S : sve_int_un_pred_arit<0b10, { opc, 0b1 }, asm, ZPR32>;
2889 def _D : sve_int_un_pred_arit<0b11, { opc, 0b1 }, asm, ZPR64>;
2892 //===----------------------------------------------------------------------===//
2893 // SVE Integer Wide Immediate - Unpredicated Group
2894 //===----------------------------------------------------------------------===//
2895 class sve_int_dup_imm<bits<2> sz8_64, string asm,
2896 ZPRRegOp zprty, Operand immtype>
2897 : I<(outs zprty:$Zd), (ins immtype:$imm),
2903 let Inst{31-24} = 0b00100101;
2904 let Inst{23-22} = sz8_64;
2905 let Inst{21-14} = 0b11100011;
2906 let Inst{13} = imm{8}; // sh
2907 let Inst{12-5} = imm{7-0}; // imm8
2910 let isReMaterializable = 1;
2913 multiclass sve_int_dup_imm<string asm> {
2914 def _B : sve_int_dup_imm<0b00, asm, ZPR8, cpy_imm8_opt_lsl_i8>;
2915 def _H : sve_int_dup_imm<0b01, asm, ZPR16, cpy_imm8_opt_lsl_i16>;
2916 def _S : sve_int_dup_imm<0b10, asm, ZPR32, cpy_imm8_opt_lsl_i32>;
2917 def _D : sve_int_dup_imm<0b11, asm, ZPR64, cpy_imm8_opt_lsl_i64>;
2919 def : InstAlias<"mov $Zd, $imm",
2920 (!cast<Instruction>(NAME # _B) ZPR8:$Zd, cpy_imm8_opt_lsl_i8:$imm), 1>;
2921 def : InstAlias<"mov $Zd, $imm",
2922 (!cast<Instruction>(NAME # _H) ZPR16:$Zd, cpy_imm8_opt_lsl_i16:$imm), 1>;
2923 def : InstAlias<"mov $Zd, $imm",
2924 (!cast<Instruction>(NAME # _S) ZPR32:$Zd, cpy_imm8_opt_lsl_i32:$imm), 1>;
2925 def : InstAlias<"mov $Zd, $imm",
2926 (!cast<Instruction>(NAME # _D) ZPR64:$Zd, cpy_imm8_opt_lsl_i64:$imm), 1>;
2928 def : InstAlias<"fmov $Zd, #0.0",
2929 (!cast<Instruction>(NAME # _H) ZPR16:$Zd, 0, 0), 1>;
2930 def : InstAlias<"fmov $Zd, #0.0",
2931 (!cast<Instruction>(NAME # _S) ZPR32:$Zd, 0, 0), 1>;
2932 def : InstAlias<"fmov $Zd, #0.0",
2933 (!cast<Instruction>(NAME # _D) ZPR64:$Zd, 0, 0), 1>;
2936 class sve_int_dup_fpimm<bits<2> sz8_64, Operand fpimmtype,
2937 string asm, ZPRRegOp zprty>
2938 : I<(outs zprty:$Zd), (ins fpimmtype:$imm8),
2939 asm, "\t$Zd, $imm8",
2944 let Inst{31-24} = 0b00100101;
2945 let Inst{23-22} = sz8_64;
2946 let Inst{21-14} = 0b11100111;
2948 let Inst{12-5} = imm8;
2951 let isReMaterializable = 1;
2954 multiclass sve_int_dup_fpimm<string asm> {
2955 def _H : sve_int_dup_fpimm<0b01, fpimm16, asm, ZPR16>;
2956 def _S : sve_int_dup_fpimm<0b10, fpimm32, asm, ZPR32>;
2957 def _D : sve_int_dup_fpimm<0b11, fpimm64, asm, ZPR64>;
2959 def : InstAlias<"fmov $Zd, $imm8",
2960 (!cast<Instruction>(NAME # _H) ZPR16:$Zd, fpimm16:$imm8), 1>;
2961 def : InstAlias<"fmov $Zd, $imm8",
2962 (!cast<Instruction>(NAME # _S) ZPR32:$Zd, fpimm32:$imm8), 1>;
2963 def : InstAlias<"fmov $Zd, $imm8",
2964 (!cast<Instruction>(NAME # _D) ZPR64:$Zd, fpimm64:$imm8), 1>;
2967 class sve_int_arith_imm0<bits<2> sz8_64, bits<3> opc, string asm,
2968 ZPRRegOp zprty, Operand immtype>
2969 : I<(outs zprty:$Zdn), (ins zprty:$_Zdn, immtype:$imm),
2970 asm, "\t$Zdn, $_Zdn, $imm",
2975 let Inst{31-24} = 0b00100101;
2976 let Inst{23-22} = sz8_64;
2977 let Inst{21-19} = 0b100;
2978 let Inst{18-16} = opc;
2979 let Inst{15-14} = 0b11;
2980 let Inst{13} = imm{8}; // sh
2981 let Inst{12-5} = imm{7-0}; // imm8
2982 let Inst{4-0} = Zdn;
2984 let Constraints = "$Zdn = $_Zdn";
2985 let DestructiveInstType = Destructive;
2986 let ElementSize = ElementSizeNone;
2989 multiclass sve_int_arith_imm0<bits<3> opc, string asm> {
2990 def _B : sve_int_arith_imm0<0b00, opc, asm, ZPR8, addsub_imm8_opt_lsl_i8>;
2991 def _H : sve_int_arith_imm0<0b01, opc, asm, ZPR16, addsub_imm8_opt_lsl_i16>;
2992 def _S : sve_int_arith_imm0<0b10, opc, asm, ZPR32, addsub_imm8_opt_lsl_i32>;
2993 def _D : sve_int_arith_imm0<0b11, opc, asm, ZPR64, addsub_imm8_opt_lsl_i64>;
2996 class sve_int_arith_imm<bits<2> sz8_64, bits<6> opc, string asm,
2997 ZPRRegOp zprty, Operand immtype>
2998 : I<(outs zprty:$Zdn), (ins zprty:$_Zdn, immtype:$imm),
2999 asm, "\t$Zdn, $_Zdn, $imm",
3004 let Inst{31-24} = 0b00100101;
3005 let Inst{23-22} = sz8_64;
3006 let Inst{21-16} = opc;
3007 let Inst{15-13} = 0b110;
3008 let Inst{12-5} = imm;
3009 let Inst{4-0} = Zdn;
3011 let Constraints = "$Zdn = $_Zdn";
3012 let DestructiveInstType = Destructive;
3013 let ElementSize = ElementSizeNone;
3016 multiclass sve_int_arith_imm1<bits<2> opc, string asm, Operand immtype> {
3017 def _B : sve_int_arith_imm<0b00, { 0b1010, opc }, asm, ZPR8, immtype>;
3018 def _H : sve_int_arith_imm<0b01, { 0b1010, opc }, asm, ZPR16, immtype>;
3019 def _S : sve_int_arith_imm<0b10, { 0b1010, opc }, asm, ZPR32, immtype>;
3020 def _D : sve_int_arith_imm<0b11, { 0b1010, opc }, asm, ZPR64, immtype>;
3023 multiclass sve_int_arith_imm2<string asm> {
3024 def _B : sve_int_arith_imm<0b00, 0b110000, asm, ZPR8, simm8>;
3025 def _H : sve_int_arith_imm<0b01, 0b110000, asm, ZPR16, simm8>;
3026 def _S : sve_int_arith_imm<0b10, 0b110000, asm, ZPR32, simm8>;
3027 def _D : sve_int_arith_imm<0b11, 0b110000, asm, ZPR64, simm8>;
3030 //===----------------------------------------------------------------------===//
3031 // SVE Bitwise Logical - Unpredicated Group
3032 //===----------------------------------------------------------------------===//
3034 class sve_int_bin_cons_log<bits<2> opc, string asm>
3035 : I<(outs ZPR64:$Zd), (ins ZPR64:$Zn, ZPR64:$Zm),
3036 asm, "\t$Zd, $Zn, $Zm",
3042 let Inst{31-24} = 0b00000100;
3043 let Inst{23-22} = opc{1-0};
3045 let Inst{20-16} = Zm;
3046 let Inst{15-10} = 0b001100;
3051 multiclass sve_int_bin_cons_log<bits<2> opc, string asm> {
3052 def NAME : sve_int_bin_cons_log<opc, asm>;
3054 def : InstAlias<asm # "\t$Zd, $Zn, $Zm",
3055 (!cast<Instruction>(NAME) ZPR8:$Zd, ZPR8:$Zn, ZPR8:$Zm), 1>;
3056 def : InstAlias<asm # "\t$Zd, $Zn, $Zm",
3057 (!cast<Instruction>(NAME) ZPR16:$Zd, ZPR16:$Zn, ZPR16:$Zm), 1>;
3058 def : InstAlias<asm # "\t$Zd, $Zn, $Zm",
3059 (!cast<Instruction>(NAME) ZPR32:$Zd, ZPR32:$Zn, ZPR32:$Zm), 1>;
3062 class sve2_int_bitwise_ternary_op_d<bits<3> opc, string asm>
3063 : I<(outs ZPR64:$Zdn), (ins ZPR64:$_Zdn, ZPR64:$Zm, ZPR64:$Zk),
3064 asm, "\t$Zdn, $_Zdn, $Zm, $Zk",
3070 let Inst{31-24} = 0b00000100;
3071 let Inst{23-22} = opc{2-1};
3073 let Inst{20-16} = Zm;
3074 let Inst{15-11} = 0b00111;
3075 let Inst{10} = opc{0};
3077 let Inst{4-0} = Zdn;
3079 let Constraints = "$Zdn = $_Zdn";
3080 let DestructiveInstType = Destructive;
3081 let ElementSize = ElementSizeNone;
3084 multiclass sve2_int_bitwise_ternary_op<bits<3> opc, string asm> {
3085 def NAME : sve2_int_bitwise_ternary_op_d<opc, asm>;
3087 def : InstAlias<asm # "\t$Zdn, $Zdn, $Zm, $Zk",
3088 (!cast<Instruction>(NAME) ZPR8:$Zdn, ZPR8:$Zm, ZPR8:$Zk), 1>;
3089 def : InstAlias<asm # "\t$Zdn, $Zdn, $Zm, $Zk",
3090 (!cast<Instruction>(NAME) ZPR16:$Zdn, ZPR16:$Zm, ZPR16:$Zk), 1>;
3091 def : InstAlias<asm # "\t$Zdn, $Zdn, $Zm, $Zk",
3092 (!cast<Instruction>(NAME) ZPR32:$Zdn, ZPR32:$Zm, ZPR32:$Zk), 1>;
3095 class sve2_int_rotate_right_imm<bits<4> tsz8_64, string asm,
3096 ZPRRegOp zprty, Operand immtype>
3097 : I<(outs zprty:$Zdn), (ins zprty:$_Zdn, zprty:$Zm, immtype:$imm),
3098 asm, "\t$Zdn, $_Zdn, $Zm, $imm",
3104 let Inst{31-24} = 0b00000100;
3105 let Inst{23-22} = tsz8_64{3-2};
3107 let Inst{20-19} = tsz8_64{1-0};
3108 let Inst{18-16} = imm{2-0}; // imm3
3109 let Inst{15-10} = 0b001101;
3111 let Inst{4-0} = Zdn;
3113 let Constraints = "$Zdn = $_Zdn";
3114 let DestructiveInstType = Destructive;
3115 let ElementSize = ElementSizeNone;
3118 multiclass sve2_int_rotate_right_imm<string asm> {
3119 def _B : sve2_int_rotate_right_imm<{0,0,0,1}, asm, ZPR8, vecshiftR8>;
3120 def _H : sve2_int_rotate_right_imm<{0,0,1,?}, asm, ZPR16, vecshiftR16> {
3121 let Inst{19} = imm{3};
3123 def _S : sve2_int_rotate_right_imm<{0,1,?,?}, asm, ZPR32, vecshiftR32> {
3124 let Inst{20-19} = imm{4-3};
3126 def _D : sve2_int_rotate_right_imm<{1,?,?,?}, asm, ZPR64, vecshiftR64> {
3127 let Inst{22} = imm{5};
3128 let Inst{20-19} = imm{4-3};
3132 //===----------------------------------------------------------------------===//
3133 // SVE Integer Wide Immediate - Predicated Group
3134 //===----------------------------------------------------------------------===//
3136 class sve_int_dup_fpimm_pred<bits<2> sz, Operand fpimmtype,
3137 string asm, ZPRRegOp zprty>
3138 : I<(outs zprty:$Zd), (ins zprty:$_Zd, PPRAny:$Pg, fpimmtype:$imm8),
3139 asm, "\t$Zd, $Pg/m, $imm8",
3145 let Inst{31-24} = 0b00000101;
3146 let Inst{23-22} = sz;
3147 let Inst{21-20} = 0b01;
3148 let Inst{19-16} = Pg;
3149 let Inst{15-13} = 0b110;
3150 let Inst{12-5} = imm8;
3153 let Constraints = "$Zd = $_Zd";
3154 let DestructiveInstType = Destructive;
3155 let ElementSize = zprty.ElementSize;
3158 multiclass sve_int_dup_fpimm_pred<string asm> {
3159 def _H : sve_int_dup_fpimm_pred<0b01, fpimm16, asm, ZPR16>;
3160 def _S : sve_int_dup_fpimm_pred<0b10, fpimm32, asm, ZPR32>;
3161 def _D : sve_int_dup_fpimm_pred<0b11, fpimm64, asm, ZPR64>;
3163 def : InstAlias<"fmov $Zd, $Pg/m, $imm8",
3164 (!cast<Instruction>(NAME # _H) ZPR16:$Zd, PPRAny:$Pg, fpimm16:$imm8), 1>;
3165 def : InstAlias<"fmov $Zd, $Pg/m, $imm8",
3166 (!cast<Instruction>(NAME # _S) ZPR32:$Zd, PPRAny:$Pg, fpimm32:$imm8), 1>;
3167 def : InstAlias<"fmov $Zd, $Pg/m, $imm8",
3168 (!cast<Instruction>(NAME # _D) ZPR64:$Zd, PPRAny:$Pg, fpimm64:$imm8), 1>;
3171 class sve_int_dup_imm_pred<bits<2> sz8_64, bit m, string asm,
3172 ZPRRegOp zprty, string pred_qual, dag iops>
3173 : I<(outs zprty:$Zd), iops,
3174 asm, "\t$Zd, $Pg"#pred_qual#", $imm",
3175 "", []>, Sched<[]> {
3179 let Inst{31-24} = 0b00000101;
3180 let Inst{23-22} = sz8_64;
3181 let Inst{21-20} = 0b01;
3182 let Inst{19-16} = Pg;
3185 let Inst{13} = imm{8}; // sh
3186 let Inst{12-5} = imm{7-0}; // imm8
3189 let DestructiveInstType = Destructive;
3190 let ElementSize = zprty.ElementSize;
3193 multiclass sve_int_dup_imm_pred_merge<string asm> {
3194 let Constraints = "$Zd = $_Zd" in {
3195 def _B : sve_int_dup_imm_pred<0b00, 1, asm, ZPR8, "/m", (ins ZPR8:$_Zd, PPRAny:$Pg, cpy_imm8_opt_lsl_i8:$imm)>;
3196 def _H : sve_int_dup_imm_pred<0b01, 1, asm, ZPR16, "/m", (ins ZPR16:$_Zd, PPRAny:$Pg, cpy_imm8_opt_lsl_i16:$imm)>;
3197 def _S : sve_int_dup_imm_pred<0b10, 1, asm, ZPR32, "/m", (ins ZPR32:$_Zd, PPRAny:$Pg, cpy_imm8_opt_lsl_i32:$imm)>;
3198 def _D : sve_int_dup_imm_pred<0b11, 1, asm, ZPR64, "/m", (ins ZPR64:$_Zd, PPRAny:$Pg, cpy_imm8_opt_lsl_i64:$imm)>;
3201 def : InstAlias<"mov $Zd, $Pg/m, $imm",
3202 (!cast<Instruction>(NAME # _B) ZPR8:$Zd, PPRAny:$Pg, cpy_imm8_opt_lsl_i8:$imm), 1>;
3203 def : InstAlias<"mov $Zd, $Pg/m, $imm",
3204 (!cast<Instruction>(NAME # _H) ZPR16:$Zd, PPRAny:$Pg, cpy_imm8_opt_lsl_i16:$imm), 1>;
3205 def : InstAlias<"mov $Zd, $Pg/m, $imm",
3206 (!cast<Instruction>(NAME # _S) ZPR32:$Zd, PPRAny:$Pg, cpy_imm8_opt_lsl_i32:$imm), 1>;
3207 def : InstAlias<"mov $Zd, $Pg/m, $imm",
3208 (!cast<Instruction>(NAME # _D) ZPR64:$Zd, PPRAny:$Pg, cpy_imm8_opt_lsl_i64:$imm), 1>;
3210 def : InstAlias<"fmov $Zd, $Pg/m, #0.0",
3211 (!cast<Instruction>(NAME # _H) ZPR16:$Zd, PPRAny:$Pg, 0, 0), 0>;
3212 def : InstAlias<"fmov $Zd, $Pg/m, #0.0",
3213 (!cast<Instruction>(NAME # _S) ZPR32:$Zd, PPRAny:$Pg, 0, 0), 0>;
3214 def : InstAlias<"fmov $Zd, $Pg/m, #0.0",
3215 (!cast<Instruction>(NAME # _D) ZPR64:$Zd, PPRAny:$Pg, 0, 0), 0>;
3218 multiclass sve_int_dup_imm_pred_zero<string asm> {
3219 def _B : sve_int_dup_imm_pred<0b00, 0, asm, ZPR8, "/z", (ins PPRAny:$Pg, cpy_imm8_opt_lsl_i8:$imm)>;
3220 def _H : sve_int_dup_imm_pred<0b01, 0, asm, ZPR16, "/z", (ins PPRAny:$Pg, cpy_imm8_opt_lsl_i16:$imm)>;
3221 def _S : sve_int_dup_imm_pred<0b10, 0, asm, ZPR32, "/z", (ins PPRAny:$Pg, cpy_imm8_opt_lsl_i32:$imm)>;
3222 def _D : sve_int_dup_imm_pred<0b11, 0, asm, ZPR64, "/z", (ins PPRAny:$Pg, cpy_imm8_opt_lsl_i64:$imm)>;
3224 def : InstAlias<"mov $Zd, $Pg/z, $imm",
3225 (!cast<Instruction>(NAME # _B) ZPR8:$Zd, PPRAny:$Pg, cpy_imm8_opt_lsl_i8:$imm), 1>;
3226 def : InstAlias<"mov $Zd, $Pg/z, $imm",
3227 (!cast<Instruction>(NAME # _H) ZPR16:$Zd, PPRAny:$Pg, cpy_imm8_opt_lsl_i16:$imm), 1>;
3228 def : InstAlias<"mov $Zd, $Pg/z, $imm",
3229 (!cast<Instruction>(NAME # _S) ZPR32:$Zd, PPRAny:$Pg, cpy_imm8_opt_lsl_i32:$imm), 1>;
3230 def : InstAlias<"mov $Zd, $Pg/z, $imm",
3231 (!cast<Instruction>(NAME # _D) ZPR64:$Zd, PPRAny:$Pg, cpy_imm8_opt_lsl_i64:$imm), 1>;
3234 //===----------------------------------------------------------------------===//
3235 // SVE Integer Compare - Vectors Group
3236 //===----------------------------------------------------------------------===//
3238 class sve_int_cmp<bit cmp_1, bits<2> sz8_64, bits<3> opc, string asm,
3239 PPRRegOp pprty, ZPRRegOp zprty1, ZPRRegOp zprty2>
3240 : I<(outs pprty:$Pd), (ins PPR3bAny:$Pg, zprty1:$Zn, zprty2:$Zm),
3241 asm, "\t$Pd, $Pg/z, $Zn, $Zm",
3248 let Inst{31-24} = 0b00100100;
3249 let Inst{23-22} = sz8_64;
3251 let Inst{20-16} = Zm;
3252 let Inst{15} = opc{2};
3253 let Inst{14} = cmp_1;
3254 let Inst{13} = opc{1};
3255 let Inst{12-10} = Pg;
3257 let Inst{4} = opc{0};
3263 multiclass sve_int_cmp_0<bits<3> opc, string asm> {
3264 def _B : sve_int_cmp<0b0, 0b00, opc, asm, PPR8, ZPR8, ZPR8>;
3265 def _H : sve_int_cmp<0b0, 0b01, opc, asm, PPR16, ZPR16, ZPR16>;
3266 def _S : sve_int_cmp<0b0, 0b10, opc, asm, PPR32, ZPR32, ZPR32>;
3267 def _D : sve_int_cmp<0b0, 0b11, opc, asm, PPR64, ZPR64, ZPR64>;
3270 multiclass sve_int_cmp_0_wide<bits<3> opc, string asm> {
3271 def _B : sve_int_cmp<0b0, 0b00, opc, asm, PPR8, ZPR8, ZPR64>;
3272 def _H : sve_int_cmp<0b0, 0b01, opc, asm, PPR16, ZPR16, ZPR64>;
3273 def _S : sve_int_cmp<0b0, 0b10, opc, asm, PPR32, ZPR32, ZPR64>;
3276 multiclass sve_int_cmp_1_wide<bits<3> opc, string asm> {
3277 def _B : sve_int_cmp<0b1, 0b00, opc, asm, PPR8, ZPR8, ZPR64>;
3278 def _H : sve_int_cmp<0b1, 0b01, opc, asm, PPR16, ZPR16, ZPR64>;
3279 def _S : sve_int_cmp<0b1, 0b10, opc, asm, PPR32, ZPR32, ZPR64>;
3283 //===----------------------------------------------------------------------===//
3284 // SVE Integer Compare - Signed Immediate Group
3285 //===----------------------------------------------------------------------===//
3287 class sve_int_scmp_vi<bits<2> sz8_64, bits<3> opc, string asm, PPRRegOp pprty,
3290 : I<(outs pprty:$Pd), (ins PPR3bAny:$Pg, zprty:$Zn, immtype:$imm5),
3291 asm, "\t$Pd, $Pg/z, $Zn, $imm5",
3298 let Inst{31-24} = 0b00100101;
3299 let Inst{23-22} = sz8_64;
3301 let Inst{20-16} = imm5;
3302 let Inst{15} = opc{2};
3304 let Inst{13} = opc{1};
3305 let Inst{12-10} = Pg;
3307 let Inst{4} = opc{0};
3313 multiclass sve_int_scmp_vi<bits<3> opc, string asm> {
3314 def _B : sve_int_scmp_vi<0b00, opc, asm, PPR8, ZPR8, simm5_32b>;
3315 def _H : sve_int_scmp_vi<0b01, opc, asm, PPR16, ZPR16, simm5_32b>;
3316 def _S : sve_int_scmp_vi<0b10, opc, asm, PPR32, ZPR32, simm5_32b>;
3317 def _D : sve_int_scmp_vi<0b11, opc, asm, PPR64, ZPR64, simm5_64b>;
3321 //===----------------------------------------------------------------------===//
3322 // SVE Integer Compare - Unsigned Immediate Group
3323 //===----------------------------------------------------------------------===//
3325 class sve_int_ucmp_vi<bits<2> sz8_64, bits<2> opc, string asm, PPRRegOp pprty,
3326 ZPRRegOp zprty, Operand immtype>
3327 : I<(outs pprty:$Pd), (ins PPR3bAny:$Pg, zprty:$Zn, immtype:$imm7),
3328 asm, "\t$Pd, $Pg/z, $Zn, $imm7",
3335 let Inst{31-24} = 0b00100100;
3336 let Inst{23-22} = sz8_64;
3338 let Inst{20-14} = imm7;
3339 let Inst{13} = opc{1};
3340 let Inst{12-10} = Pg;
3342 let Inst{4} = opc{0};
3348 multiclass sve_int_ucmp_vi<bits<2> opc, string asm> {
3349 def _B : sve_int_ucmp_vi<0b00, opc, asm, PPR8, ZPR8, imm0_127>;
3350 def _H : sve_int_ucmp_vi<0b01, opc, asm, PPR16, ZPR16, imm0_127>;
3351 def _S : sve_int_ucmp_vi<0b10, opc, asm, PPR32, ZPR32, imm0_127>;
3352 def _D : sve_int_ucmp_vi<0b11, opc, asm, PPR64, ZPR64, imm0_127>;
3356 //===----------------------------------------------------------------------===//
3357 // SVE Integer Compare - Scalars Group
3358 //===----------------------------------------------------------------------===//
3360 class sve_int_cterm<bit sz, bit opc, string asm, RegisterClass rt>
3361 : I<(outs), (ins rt:$Rn, rt:$Rm),
3367 let Inst{31-23} = 0b001001011;
3370 let Inst{20-16} = Rm;
3371 let Inst{15-10} = 0b001000;
3374 let Inst{3-0} = 0b0000;
3379 class sve_int_while_rr<bits<2> sz8_64, bits<4> opc, string asm,
3380 RegisterClass gprty, PPRRegOp pprty>
3381 : I<(outs pprty:$Pd), (ins gprty:$Rn, gprty:$Rm),
3382 asm, "\t$Pd, $Rn, $Rm",
3383 "", []>, Sched<[]> {
3387 let Inst{31-24} = 0b00100101;
3388 let Inst{23-22} = sz8_64;
3390 let Inst{20-16} = Rm;
3391 let Inst{15-13} = 0b000;
3392 let Inst{12-10} = opc{3-1};
3394 let Inst{4} = opc{0};
3400 multiclass sve_int_while4_rr<bits<3> opc, string asm> {
3401 def _B : sve_int_while_rr<0b00, { 0, opc }, asm, GPR32, PPR8>;
3402 def _H : sve_int_while_rr<0b01, { 0, opc }, asm, GPR32, PPR16>;
3403 def _S : sve_int_while_rr<0b10, { 0, opc }, asm, GPR32, PPR32>;
3404 def _D : sve_int_while_rr<0b11, { 0, opc }, asm, GPR32, PPR64>;
3407 multiclass sve_int_while8_rr<bits<3> opc, string asm> {
3408 def _B : sve_int_while_rr<0b00, { 1, opc }, asm, GPR64, PPR8>;
3409 def _H : sve_int_while_rr<0b01, { 1, opc }, asm, GPR64, PPR16>;
3410 def _S : sve_int_while_rr<0b10, { 1, opc }, asm, GPR64, PPR32>;
3411 def _D : sve_int_while_rr<0b11, { 1, opc }, asm, GPR64, PPR64>;
3414 class sve2_int_while_rr<bits<2> sz8_64, bits<1> rw, string asm,
3416 : I<(outs pprty:$Pd), (ins GPR64:$Rn, GPR64:$Rm),
3417 asm, "\t$Pd, $Rn, $Rm",
3418 "", []>, Sched<[]> {
3422 let Inst{31-24} = 0b00100101;
3423 let Inst{23-22} = sz8_64;
3425 let Inst{20-16} = Rm;
3426 let Inst{15-10} = 0b001100;
3434 multiclass sve2_int_while_rr<bits<1> rw, string asm> {
3435 def _B : sve2_int_while_rr<0b00, rw, asm, PPR8>;
3436 def _H : sve2_int_while_rr<0b01, rw, asm, PPR16>;
3437 def _S : sve2_int_while_rr<0b10, rw, asm, PPR32>;
3438 def _D : sve2_int_while_rr<0b11, rw, asm, PPR64>;
3441 //===----------------------------------------------------------------------===//
3442 // SVE Floating Point Fast Reduction Group
3443 //===----------------------------------------------------------------------===//
3445 class sve_fp_fast_red<bits<2> sz, bits<3> opc, string asm,
3446 ZPRRegOp zprty, RegisterClass dstRegClass>
3447 : I<(outs dstRegClass:$Vd), (ins PPR3bAny:$Pg, zprty:$Zn),
3448 asm, "\t$Vd, $Pg, $Zn",
3454 let Inst{31-24} = 0b01100101;
3455 let Inst{23-22} = sz;
3456 let Inst{21-19} = 0b000;
3457 let Inst{18-16} = opc;
3458 let Inst{15-13} = 0b001;
3459 let Inst{12-10} = Pg;
3464 multiclass sve_fp_fast_red<bits<3> opc, string asm> {
3465 def _H : sve_fp_fast_red<0b01, opc, asm, ZPR16, FPR16>;
3466 def _S : sve_fp_fast_red<0b10, opc, asm, ZPR32, FPR32>;
3467 def _D : sve_fp_fast_red<0b11, opc, asm, ZPR64, FPR64>;
3471 //===----------------------------------------------------------------------===//
3472 // SVE Floating Point Accumulating Reduction Group
3473 //===----------------------------------------------------------------------===//
3475 class sve_fp_2op_p_vd<bits<2> sz, bits<3> opc, string asm,
3476 ZPRRegOp zprty, RegisterClass dstRegClass>
3477 : I<(outs dstRegClass:$Vdn), (ins PPR3bAny:$Pg, dstRegClass:$_Vdn, zprty:$Zm),
3478 asm, "\t$Vdn, $Pg, $_Vdn, $Zm",
3485 let Inst{31-24} = 0b01100101;
3486 let Inst{23-22} = sz;
3487 let Inst{21-19} = 0b011;
3488 let Inst{18-16} = opc;
3489 let Inst{15-13} = 0b001;
3490 let Inst{12-10} = Pg;
3492 let Inst{4-0} = Vdn;
3494 let Constraints = "$Vdn = $_Vdn";
3497 multiclass sve_fp_2op_p_vd<bits<3> opc, string asm> {
3498 def _H : sve_fp_2op_p_vd<0b01, opc, asm, ZPR16, FPR16>;
3499 def _S : sve_fp_2op_p_vd<0b10, opc, asm, ZPR32, FPR32>;
3500 def _D : sve_fp_2op_p_vd<0b11, opc, asm, ZPR64, FPR64>;
3503 //===----------------------------------------------------------------------===//
3504 // SVE Floating Point Compare - Vectors Group
3505 //===----------------------------------------------------------------------===//
3507 class sve_fp_3op_p_pd<bits<2> sz, bits<3> opc, string asm, PPRRegOp pprty,
3509 : I<(outs pprty:$Pd), (ins PPR3bAny:$Pg, zprty:$Zn, zprty:$Zm),
3510 asm, "\t$Pd, $Pg/z, $Zn, $Zm",
3517 let Inst{31-24} = 0b01100101;
3518 let Inst{23-22} = sz;
3520 let Inst{20-16} = Zm;
3521 let Inst{15} = opc{2};
3523 let Inst{13} = opc{1};
3524 let Inst{12-10} = Pg;
3526 let Inst{4} = opc{0};
3530 multiclass sve_fp_3op_p_pd<bits<3> opc, string asm> {
3531 def _H : sve_fp_3op_p_pd<0b01, opc, asm, PPR16, ZPR16>;
3532 def _S : sve_fp_3op_p_pd<0b10, opc, asm, PPR32, ZPR32>;
3533 def _D : sve_fp_3op_p_pd<0b11, opc, asm, PPR64, ZPR64>;
3537 //===----------------------------------------------------------------------===//
3538 // SVE Floating Point Compare - with Zero Group
3539 //===----------------------------------------------------------------------===//
3541 class sve_fp_2op_p_pd<bits<2> sz, bits<3> opc, string asm, PPRRegOp pprty,
3543 : I<(outs pprty:$Pd), (ins PPR3bAny:$Pg, zprty:$Zn),
3544 asm, "\t$Pd, $Pg/z, $Zn, #0.0",
3550 let Inst{31-24} = 0b01100101;
3551 let Inst{23-22} = sz;
3552 let Inst{21-18} = 0b0100;
3553 let Inst{17-16} = opc{2-1};
3554 let Inst{15-13} = 0b001;
3555 let Inst{12-10} = Pg;
3557 let Inst{4} = opc{0};
3561 multiclass sve_fp_2op_p_pd<bits<3> opc, string asm> {
3562 def _H : sve_fp_2op_p_pd<0b01, opc, asm, PPR16, ZPR16>;
3563 def _S : sve_fp_2op_p_pd<0b10, opc, asm, PPR32, ZPR32>;
3564 def _D : sve_fp_2op_p_pd<0b11, opc, asm, PPR64, ZPR64>;
3568 //===----------------------------------------------------------------------===//
3569 //SVE Index Generation Group
3570 //===----------------------------------------------------------------------===//
3572 class sve_int_index_ii<bits<2> sz8_64, string asm, ZPRRegOp zprty,
3574 : I<(outs zprty:$Zd), (ins imm_ty:$imm5, imm_ty:$imm5b),
3575 asm, "\t$Zd, $imm5, $imm5b",
3576 "", []>, Sched<[]> {
3580 let Inst{31-24} = 0b00000100;
3581 let Inst{23-22} = sz8_64;
3583 let Inst{20-16} = imm5b;
3584 let Inst{15-10} = 0b010000;
3585 let Inst{9-5} = imm5;
3589 multiclass sve_int_index_ii<string asm> {
3590 def _B : sve_int_index_ii<0b00, asm, ZPR8, simm5_32b>;
3591 def _H : sve_int_index_ii<0b01, asm, ZPR16, simm5_32b>;
3592 def _S : sve_int_index_ii<0b10, asm, ZPR32, simm5_32b>;
3593 def _D : sve_int_index_ii<0b11, asm, ZPR64, simm5_64b>;
3596 class sve_int_index_ir<bits<2> sz8_64, string asm, ZPRRegOp zprty,
3597 RegisterClass srcRegType, Operand imm_ty>
3598 : I<(outs zprty:$Zd), (ins imm_ty:$imm5, srcRegType:$Rm),
3599 asm, "\t$Zd, $imm5, $Rm",
3600 "", []>, Sched<[]> {
3604 let Inst{31-24} = 0b00000100;
3605 let Inst{23-22} = sz8_64;
3607 let Inst{20-16} = Rm;
3608 let Inst{15-10} = 0b010010;
3609 let Inst{9-5} = imm5;
3613 multiclass sve_int_index_ir<string asm> {
3614 def _B : sve_int_index_ir<0b00, asm, ZPR8, GPR32, simm5_32b>;
3615 def _H : sve_int_index_ir<0b01, asm, ZPR16, GPR32, simm5_32b>;
3616 def _S : sve_int_index_ir<0b10, asm, ZPR32, GPR32, simm5_32b>;
3617 def _D : sve_int_index_ir<0b11, asm, ZPR64, GPR64, simm5_64b>;
3620 class sve_int_index_ri<bits<2> sz8_64, string asm, ZPRRegOp zprty,
3621 RegisterClass srcRegType, Operand imm_ty>
3622 : I<(outs zprty:$Zd), (ins srcRegType:$Rn, imm_ty:$imm5),
3623 asm, "\t$Zd, $Rn, $imm5",
3624 "", []>, Sched<[]> {
3628 let Inst{31-24} = 0b00000100;
3629 let Inst{23-22} = sz8_64;
3631 let Inst{20-16} = imm5;
3632 let Inst{15-10} = 0b010001;
3637 multiclass sve_int_index_ri<string asm> {
3638 def _B : sve_int_index_ri<0b00, asm, ZPR8, GPR32, simm5_32b>;
3639 def _H : sve_int_index_ri<0b01, asm, ZPR16, GPR32, simm5_32b>;
3640 def _S : sve_int_index_ri<0b10, asm, ZPR32, GPR32, simm5_32b>;
3641 def _D : sve_int_index_ri<0b11, asm, ZPR64, GPR64, simm5_64b>;
3644 class sve_int_index_rr<bits<2> sz8_64, string asm, ZPRRegOp zprty,
3645 RegisterClass srcRegType>
3646 : I<(outs zprty:$Zd), (ins srcRegType:$Rn, srcRegType:$Rm),
3647 asm, "\t$Zd, $Rn, $Rm",
3648 "", []>, Sched<[]> {
3652 let Inst{31-24} = 0b00000100;
3653 let Inst{23-22} = sz8_64;
3655 let Inst{20-16} = Rm;
3656 let Inst{15-10} = 0b010011;
3661 multiclass sve_int_index_rr<string asm> {
3662 def _B : sve_int_index_rr<0b00, asm, ZPR8, GPR32>;
3663 def _H : sve_int_index_rr<0b01, asm, ZPR16, GPR32>;
3664 def _S : sve_int_index_rr<0b10, asm, ZPR32, GPR32>;
3665 def _D : sve_int_index_rr<0b11, asm, ZPR64, GPR64>;
3668 //===----------------------------------------------------------------------===//
3669 // SVE Bitwise Shift - Predicated Group
3670 //===----------------------------------------------------------------------===//
3671 class sve_int_bin_pred_shift_imm<bits<4> tsz8_64, bits<4> opc, string asm,
3672 ZPRRegOp zprty, Operand immtype,
3673 ElementSizeEnum size>
3674 : I<(outs zprty:$Zdn), (ins PPR3bAny:$Pg, zprty:$_Zdn, immtype:$imm),
3675 asm, "\t$Zdn, $Pg/m, $_Zdn, $imm",
3681 let Inst{31-24} = 0b00000100;
3682 let Inst{23-22} = tsz8_64{3-2};
3683 let Inst{21-20} = 0b00;
3684 let Inst{19-16} = opc;
3685 let Inst{15-13} = 0b100;
3686 let Inst{12-10} = Pg;
3687 let Inst{9-8} = tsz8_64{1-0};
3688 let Inst{7-5} = imm{2-0}; // imm3
3689 let Inst{4-0} = Zdn;
3691 let Constraints = "$Zdn = $_Zdn";
3692 let DestructiveInstType = Destructive;
3693 let ElementSize = size;
3696 multiclass sve_int_bin_pred_shift_imm_left<bits<4> opc, string asm> {
3697 def _B : sve_int_bin_pred_shift_imm<{0,0,0,1}, opc, asm, ZPR8, vecshiftL8,
3699 def _H : sve_int_bin_pred_shift_imm<{0,0,1,?}, opc, asm, ZPR16, vecshiftL16,
3701 let Inst{8} = imm{3};
3703 def _S : sve_int_bin_pred_shift_imm<{0,1,?,?}, opc, asm, ZPR32, vecshiftL32,
3705 let Inst{9-8} = imm{4-3};
3707 def _D : sve_int_bin_pred_shift_imm<{1,?,?,?}, opc, asm, ZPR64, vecshiftL64,
3709 let Inst{22} = imm{5};
3710 let Inst{9-8} = imm{4-3};
3714 multiclass sve_int_bin_pred_shift_imm_right<bits<4> opc, string asm> {
3715 def _B : sve_int_bin_pred_shift_imm<{0,0,0,1}, opc, asm, ZPR8, vecshiftR8,
3717 def _H : sve_int_bin_pred_shift_imm<{0,0,1,?}, opc, asm, ZPR16, vecshiftR16,
3719 let Inst{8} = imm{3};
3721 def _S : sve_int_bin_pred_shift_imm<{0,1,?,?}, opc, asm, ZPR32, vecshiftR32,
3723 let Inst{9-8} = imm{4-3};
3725 def _D : sve_int_bin_pred_shift_imm<{1,?,?,?}, opc, asm, ZPR64, vecshiftR64,
3727 let Inst{22} = imm{5};
3728 let Inst{9-8} = imm{4-3};
3732 class sve_int_bin_pred_shift<bits<2> sz8_64, bit wide, bits<3> opc,
3733 string asm, ZPRRegOp zprty, ZPRRegOp zprty2>
3734 : I<(outs zprty:$Zdn), (ins PPR3bAny:$Pg, zprty:$_Zdn, zprty2:$Zm),
3735 asm, "\t$Zdn, $Pg/m, $_Zdn, $Zm",
3741 let Inst{31-24} = 0b00000100;
3742 let Inst{23-22} = sz8_64;
3743 let Inst{21-20} = 0b01;
3744 let Inst{19} = wide;
3745 let Inst{18-16} = opc;
3746 let Inst{15-13} = 0b100;
3747 let Inst{12-10} = Pg;
3749 let Inst{4-0} = Zdn;
3751 let Constraints = "$Zdn = $_Zdn";
3752 let DestructiveInstType = Destructive;
3753 let ElementSize = zprty.ElementSize;
3756 multiclass sve_int_bin_pred_shift<bits<3> opc, string asm> {
3757 def _B : sve_int_bin_pred_shift<0b00, 0b0, opc, asm, ZPR8, ZPR8>;
3758 def _H : sve_int_bin_pred_shift<0b01, 0b0, opc, asm, ZPR16, ZPR16>;
3759 def _S : sve_int_bin_pred_shift<0b10, 0b0, opc, asm, ZPR32, ZPR32>;
3760 def _D : sve_int_bin_pred_shift<0b11, 0b0, opc, asm, ZPR64, ZPR64>;
3763 multiclass sve_int_bin_pred_shift_wide<bits<3> opc, string asm> {
3764 def _B : sve_int_bin_pred_shift<0b00, 0b1, opc, asm, ZPR8, ZPR64>;
3765 def _H : sve_int_bin_pred_shift<0b01, 0b1, opc, asm, ZPR16, ZPR64>;
3766 def _S : sve_int_bin_pred_shift<0b10, 0b1, opc, asm, ZPR32, ZPR64>;
3769 //===----------------------------------------------------------------------===//
3770 // SVE Shift - Unpredicated Group
3771 //===----------------------------------------------------------------------===//
3773 class sve_int_bin_cons_shift_wide<bits<2> sz8_64, bits<2> opc, string asm,
3775 : I<(outs zprty:$Zd), (ins zprty:$Zn, ZPR64:$Zm),
3776 asm, "\t$Zd, $Zn, $Zm",
3782 let Inst{31-24} = 0b00000100;
3783 let Inst{23-22} = sz8_64;
3785 let Inst{20-16} = Zm;
3786 let Inst{15-12} = 0b1000;
3787 let Inst{11-10} = opc;
3792 multiclass sve_int_bin_cons_shift_wide<bits<2> opc, string asm> {
3793 def _B : sve_int_bin_cons_shift_wide<0b00, opc, asm, ZPR8>;
3794 def _H : sve_int_bin_cons_shift_wide<0b01, opc, asm, ZPR16>;
3795 def _S : sve_int_bin_cons_shift_wide<0b10, opc, asm, ZPR32>;
3798 class sve_int_bin_cons_shift_imm<bits<4> tsz8_64, bits<2> opc, string asm,
3799 ZPRRegOp zprty, Operand immtype>
3800 : I<(outs zprty:$Zd), (ins zprty:$Zn, immtype:$imm),
3801 asm, "\t$Zd, $Zn, $imm",
3802 "", []>, Sched<[]> {
3806 let Inst{31-24} = 0b00000100;
3807 let Inst{23-22} = tsz8_64{3-2};
3809 let Inst{20-19} = tsz8_64{1-0};
3810 let Inst{18-16} = imm{2-0}; // imm3
3811 let Inst{15-12} = 0b1001;
3812 let Inst{11-10} = opc;
3817 multiclass sve_int_bin_cons_shift_imm_left<bits<2> opc, string asm> {
3818 def _B : sve_int_bin_cons_shift_imm<{0,0,0,1}, opc, asm, ZPR8, vecshiftL8>;
3819 def _H : sve_int_bin_cons_shift_imm<{0,0,1,?}, opc, asm, ZPR16, vecshiftL16> {
3820 let Inst{19} = imm{3};
3822 def _S : sve_int_bin_cons_shift_imm<{0,1,?,?}, opc, asm, ZPR32, vecshiftL32> {
3823 let Inst{20-19} = imm{4-3};
3825 def _D : sve_int_bin_cons_shift_imm<{1,?,?,?}, opc, asm, ZPR64, vecshiftL64> {
3826 let Inst{22} = imm{5};
3827 let Inst{20-19} = imm{4-3};
3831 multiclass sve_int_bin_cons_shift_imm_right<bits<2> opc, string asm> {
3832 def _B : sve_int_bin_cons_shift_imm<{0,0,0,1}, opc, asm, ZPR8, vecshiftR8>;
3833 def _H : sve_int_bin_cons_shift_imm<{0,0,1,?}, opc, asm, ZPR16, vecshiftR16> {
3834 let Inst{19} = imm{3};
3836 def _S : sve_int_bin_cons_shift_imm<{0,1,?,?}, opc, asm, ZPR32, vecshiftR32> {
3837 let Inst{20-19} = imm{4-3};
3839 def _D : sve_int_bin_cons_shift_imm<{1,?,?,?}, opc, asm, ZPR64, vecshiftR64> {
3840 let Inst{22} = imm{5};
3841 let Inst{20-19} = imm{4-3};
3844 //===----------------------------------------------------------------------===//
3845 // SVE Memory - Store Group
3846 //===----------------------------------------------------------------------===//
3848 class sve_mem_cst_si<bits<2> msz, bits<2> esz, string asm,
3849 RegisterOperand VecList>
3850 : I<(outs), (ins VecList:$Zt, PPR3bAny:$Pg, GPR64sp:$Rn, simm4s1:$imm4),
3851 asm, "\t$Zt, $Pg, [$Rn, $imm4, mul vl]",
3858 let Inst{31-25} = 0b1110010;
3859 let Inst{24-23} = msz;
3860 let Inst{22-21} = esz;
3862 let Inst{19-16} = imm4;
3863 let Inst{15-13} = 0b111;
3864 let Inst{12-10} = Pg;
3871 multiclass sve_mem_cst_si<bits<2> msz, bits<2> esz, string asm,
3872 RegisterOperand listty, ZPRRegOp zprty>
3874 def NAME : sve_mem_cst_si<msz, esz, asm, listty>;
3876 def : InstAlias<asm # "\t$Zt, $Pg, [$Rn, $imm4, mul vl]",
3877 (!cast<Instruction>(NAME) zprty:$Zt, PPR3bAny:$Pg, GPR64sp:$Rn, simm4s1:$imm4), 0>;
3878 def : InstAlias<asm # "\t$Zt, $Pg, [$Rn]",
3879 (!cast<Instruction>(NAME) zprty:$Zt, PPR3bAny:$Pg, GPR64sp:$Rn, 0), 0>;
3880 def : InstAlias<asm # "\t$Zt, $Pg, [$Rn]",
3881 (!cast<Instruction>(NAME) listty:$Zt, PPR3bAny:$Pg, GPR64sp:$Rn, 0), 1>;
3884 class sve_mem_est_si<bits<2> sz, bits<2> nregs, RegisterOperand VecList,
3885 string asm, Operand immtype>
3886 : I<(outs), (ins VecList:$Zt, PPR3bAny:$Pg, GPR64sp:$Rn, immtype:$imm4),
3887 asm, "\t$Zt, $Pg, [$Rn, $imm4, mul vl]",
3894 let Inst{31-25} = 0b1110010;
3895 let Inst{24-23} = sz;
3896 let Inst{22-21} = nregs;
3898 let Inst{19-16} = imm4;
3899 let Inst{15-13} = 0b111;
3900 let Inst{12-10} = Pg;
3907 multiclass sve_mem_est_si<bits<2> sz, bits<2> nregs, RegisterOperand VecList,
3908 string asm, Operand immtype> {
3909 def NAME : sve_mem_est_si<sz, nregs, VecList, asm, immtype>;
3911 def : InstAlias<asm # "\t$Zt, $Pg, [$Rn]",
3912 (!cast<Instruction>(NAME) VecList:$Zt, PPR3bAny:$Pg, GPR64sp:$Rn, 0), 1>;
3915 class sve_mem_est_ss<bits<2> sz, bits<2> nregs, RegisterOperand VecList,
3916 string asm, RegisterOperand gprty>
3917 : I<(outs), (ins VecList:$Zt, PPR3bAny:$Pg, GPR64sp:$Rn, gprty:$Rm),
3918 asm, "\t$Zt, $Pg, [$Rn, $Rm]",
3925 let Inst{31-25} = 0b1110010;
3926 let Inst{24-23} = sz;
3927 let Inst{22-21} = nregs;
3928 let Inst{20-16} = Rm;
3929 let Inst{15-13} = 0b011;
3930 let Inst{12-10} = Pg;
3937 class sve_mem_cst_ss_base<bits<4> dtype, string asm,
3938 RegisterOperand listty, RegisterOperand gprty>
3939 : I<(outs), (ins listty:$Zt, PPR3bAny:$Pg, GPR64sp:$Rn, gprty:$Rm),
3940 asm, "\t$Zt, $Pg, [$Rn, $Rm]",
3947 let Inst{31-25} = 0b1110010;
3948 let Inst{24-21} = dtype;
3949 let Inst{20-16} = Rm;
3950 let Inst{15-13} = 0b010;
3951 let Inst{12-10} = Pg;
3958 multiclass sve_mem_cst_ss<bits<4> dtype, string asm,
3959 RegisterOperand listty, ZPRRegOp zprty,
3960 RegisterOperand gprty> {
3961 def NAME : sve_mem_cst_ss_base<dtype, asm, listty, gprty>;
3963 def : InstAlias<asm # "\t$Zt, $Pg, [$Rn, $Rm]",
3964 (!cast<Instruction>(NAME) zprty:$Zt, PPR3bAny:$Pg, GPR64sp:$Rn, gprty:$Rm), 0>;
3967 class sve_mem_cstnt_si<bits<2> msz, string asm, RegisterOperand VecList>
3968 : I<(outs), (ins VecList:$Zt, PPR3bAny:$Pg, GPR64sp:$Rn, simm4s1:$imm4),
3969 asm, "\t$Zt, $Pg, [$Rn, $imm4, mul vl]",
3976 let Inst{31-25} = 0b1110010;
3977 let Inst{24-23} = msz;
3978 let Inst{22-20} = 0b001;
3979 let Inst{19-16} = imm4;
3980 let Inst{15-13} = 0b111;
3981 let Inst{12-10} = Pg;
3988 multiclass sve_mem_cstnt_si<bits<2> msz, string asm, RegisterOperand listty,
3990 def NAME : sve_mem_cstnt_si<msz, asm, listty>;
3992 def : InstAlias<asm # "\t$Zt, $Pg, [$Rn]",
3993 (!cast<Instruction>(NAME) zprty:$Zt, PPR3bAny:$Pg, GPR64sp:$Rn, 0), 0>;
3994 def : InstAlias<asm # "\t$Zt, $Pg, [$Rn, $imm4, mul vl]",
3995 (!cast<Instruction>(NAME) zprty:$Zt, PPR3bAny:$Pg, GPR64sp:$Rn, simm4s1:$imm4), 0>;
3996 def : InstAlias<asm # "\t$Zt, $Pg, [$Rn]",
3997 (!cast<Instruction>(NAME) listty:$Zt, PPR3bAny:$Pg, GPR64sp:$Rn, 0), 1>;
4000 class sve_mem_cstnt_ss_base<bits<2> msz, string asm, RegisterOperand listty,
4001 RegisterOperand gprty>
4002 : I<(outs), (ins listty:$Zt, PPR3bAny:$Pg, GPR64sp:$Rn, gprty:$Rm),
4003 asm, "\t$Zt, $Pg, [$Rn, $Rm]",
4010 let Inst{31-25} = 0b1110010;
4011 let Inst{24-23} = msz;
4012 let Inst{22-21} = 0b00;
4013 let Inst{20-16} = Rm;
4014 let Inst{15-13} = 0b011;
4015 let Inst{12-10} = Pg;
4022 multiclass sve_mem_cstnt_ss<bits<2> msz, string asm, RegisterOperand listty,
4023 ZPRRegOp zprty, RegisterOperand gprty> {
4024 def NAME : sve_mem_cstnt_ss_base<msz, asm, listty, gprty>;
4026 def : InstAlias<asm # "\t$Zt, $Pg, [$Rn, $Rm]",
4027 (!cast<Instruction>(NAME) zprty:$Zt, PPR3bAny:$Pg, GPR64sp:$Rn, gprty:$Rm), 0>;
4030 class sve2_mem_sstnt_vs_base<bits<3> opc, string asm,
4031 RegisterOperand listty, ZPRRegOp zprty>
4032 : I<(outs), (ins listty:$Zt, PPR3bAny:$Pg, zprty:$Zn, GPR64:$Rm),
4033 asm, "\t$Zt, $Pg, [$Zn, $Rm]",
4040 let Inst{31-25} = 0b1110010;
4041 let Inst{24-22} = opc;
4043 let Inst{20-16} = Rm;
4044 let Inst{15-13} = 0b001;
4045 let Inst{12-10} = Pg;
4052 multiclass sve2_mem_sstnt_vs<bits<3> opc, string asm,
4053 RegisterOperand listty, ZPRRegOp zprty> {
4054 def _REAL : sve2_mem_sstnt_vs_base<opc, asm, listty, zprty>;
4056 def : InstAlias<asm # "\t$Zt, $Pg, [$Zn, $Rm]",
4057 (!cast<Instruction>(NAME # _REAL) zprty:$Zt, PPR3bAny:$Pg, zprty:$Zn, GPR64:$Rm), 0>;
4058 def : InstAlias<asm # "\t$Zt, $Pg, [$Zn]",
4059 (!cast<Instruction>(NAME # _REAL) zprty:$Zt, PPR3bAny:$Pg, zprty:$Zn, XZR), 0>;
4060 def : InstAlias<asm # "\t$Zt, $Pg, [$Zn]",
4061 (!cast<Instruction>(NAME # _REAL) listty:$Zt, PPR3bAny:$Pg, zprty:$Zn, XZR), 1>;
4064 class sve_mem_sst_sv<bits<3> opc, bit xs, bit scaled, string asm,
4065 RegisterOperand VecList, RegisterOperand zprext>
4066 : I<(outs), (ins VecList:$Zt, PPR3bAny:$Pg, GPR64sp:$Rn, zprext:$Zm),
4067 asm, "\t$Zt, $Pg, [$Rn, $Zm]",
4074 let Inst{31-25} = 0b1110010;
4075 let Inst{24-22} = opc;
4076 let Inst{21} = scaled;
4077 let Inst{20-16} = Zm;
4081 let Inst{12-10} = Pg;
4088 multiclass sve_mem_sst_sv_32_scaled<bits<3> opc, string asm,
4089 RegisterOperand listty,
4091 RegisterOperand sxtw_opnd,
4092 RegisterOperand uxtw_opnd > {
4093 def _UXTW_SCALED : sve_mem_sst_sv<opc, 0, 1, asm, listty, uxtw_opnd>;
4094 def _SXTW_SCALED : sve_mem_sst_sv<opc, 1, 1, asm, listty, sxtw_opnd>;
4096 def : InstAlias<asm # "\t$Zt, $Pg, [$Rn, $Zm]",
4097 (!cast<Instruction>(NAME # _UXTW_SCALED) zprty:$Zt, PPR3bAny:$Pg, GPR64sp:$Rn, uxtw_opnd:$Zm), 0>;
4098 def : InstAlias<asm # "\t$Zt, $Pg, [$Rn, $Zm]",
4099 (!cast<Instruction>(NAME # _SXTW_SCALED) zprty:$Zt, PPR3bAny:$Pg, GPR64sp:$Rn, sxtw_opnd:$Zm), 0>;
4102 multiclass sve_mem_sst_sv_32_unscaled<bits<3> opc, string asm,
4103 RegisterOperand listty,
4105 RegisterOperand sxtw_opnd,
4106 RegisterOperand uxtw_opnd> {
4107 def _UXTW : sve_mem_sst_sv<opc, 0, 0, asm, listty, uxtw_opnd>;
4108 def _SXTW : sve_mem_sst_sv<opc, 1, 0, asm, listty, sxtw_opnd>;
4110 def : InstAlias<asm # "\t$Zt, $Pg, [$Rn, $Zm]",
4111 (!cast<Instruction>(NAME # _UXTW) zprty:$Zt, PPR3bAny:$Pg, GPR64sp:$Rn, uxtw_opnd:$Zm), 0>;
4112 def : InstAlias<asm # "\t$Zt, $Pg, [$Rn, $Zm]",
4113 (!cast<Instruction>(NAME # _SXTW) zprty:$Zt, PPR3bAny:$Pg, GPR64sp:$Rn, sxtw_opnd:$Zm), 0>;
4116 class sve_mem_sst_sv2<bits<2> msz, bit scaled, string asm,
4117 RegisterOperand zprext>
4118 : I<(outs), (ins Z_d:$Zt, PPR3bAny:$Pg, GPR64sp:$Rn, zprext:$Zm),
4119 asm, "\t$Zt, $Pg, [$Rn, $Zm]",
4126 let Inst{31-25} = 0b1110010;
4127 let Inst{24-23} = msz;
4129 let Inst{21} = scaled;
4130 let Inst{20-16} = Zm;
4131 let Inst{15-13} = 0b101;
4132 let Inst{12-10} = Pg;
4139 multiclass sve_mem_sst_sv_64_scaled<bits<2> msz, string asm,
4140 RegisterOperand zprext> {
4141 def "" : sve_mem_sst_sv2<msz, 1, asm, zprext>;
4143 def : InstAlias<asm # "\t$Zt, $Pg, [$Rn, $Zm]",
4144 (!cast<Instruction>(NAME) ZPR64:$Zt, PPR3bAny:$Pg, GPR64sp:$Rn, zprext:$Zm), 0>;
4148 multiclass sve_mem_sst_sv_64_unscaled<bits<2> msz, string asm> {
4149 def "" : sve_mem_sst_sv2<msz, 0, asm, ZPR64ExtLSL8>;
4151 def : InstAlias<asm # "\t$Zt, $Pg, [$Rn, $Zm]",
4152 (!cast<Instruction>(NAME) ZPR64:$Zt, PPR3bAny:$Pg, GPR64sp:$Rn, ZPR64ExtLSL8:$Zm), 0>;
4155 class sve_mem_sst_vi<bits<3> opc, string asm, ZPRRegOp zprty,
4156 RegisterOperand VecList, Operand imm_ty>
4157 : I<(outs), (ins VecList:$Zt, PPR3bAny:$Pg, zprty:$Zn, imm_ty:$imm5),
4158 asm, "\t$Zt, $Pg, [$Zn, $imm5]",
4165 let Inst{31-25} = 0b1110010;
4166 let Inst{24-23} = opc{2-1};
4168 let Inst{21} = opc{0};
4169 let Inst{20-16} = imm5;
4170 let Inst{15-13} = 0b101;
4171 let Inst{12-10} = Pg;
4178 multiclass sve_mem_sst_vi_ptrs<bits<3> opc, string asm, RegisterOperand listty,
4179 ZPRRegOp zprty, Operand imm_ty> {
4180 def _IMM : sve_mem_sst_vi<opc, asm, zprty, listty, imm_ty>;
4182 def : InstAlias<asm # "\t$Zt, $Pg, [$Zn]",
4183 (!cast<Instruction>(NAME # _IMM) zprty:$Zt, PPR3bAny:$Pg, zprty:$Zn, 0), 0>;
4184 def : InstAlias<asm # "\t$Zt, $Pg, [$Zn, $imm5]",
4185 (!cast<Instruction>(NAME # _IMM) zprty:$Zt, PPR3bAny:$Pg, zprty:$Zn, imm_ty:$imm5), 0>;
4186 def : InstAlias<asm # "\t$Zt, $Pg, [$Zn]",
4187 (!cast<Instruction>(NAME # _IMM) listty:$Zt, PPR3bAny:$Pg, zprty:$Zn, 0), 1>;
4190 class sve_mem_z_spill<string asm>
4191 : I<(outs), (ins ZPRAny:$Zt, GPR64sp:$Rn, simm9:$imm9),
4192 asm, "\t$Zt, [$Rn, $imm9, mul vl]",
4198 let Inst{31-22} = 0b1110010110;
4199 let Inst{21-16} = imm9{8-3};
4200 let Inst{15-13} = 0b010;
4201 let Inst{12-10} = imm9{2-0};
4208 multiclass sve_mem_z_spill<string asm> {
4209 def NAME : sve_mem_z_spill<asm>;
4211 def : InstAlias<asm # "\t$Zt, [$Rn]",
4212 (!cast<Instruction>(NAME) ZPRAny:$Zt, GPR64sp:$Rn, 0), 1>;
4215 class sve_mem_p_spill<string asm>
4216 : I<(outs), (ins PPRAny:$Pt, GPR64sp:$Rn, simm9:$imm9),
4217 asm, "\t$Pt, [$Rn, $imm9, mul vl]",
4223 let Inst{31-22} = 0b1110010110;
4224 let Inst{21-16} = imm9{8-3};
4225 let Inst{15-13} = 0b000;
4226 let Inst{12-10} = imm9{2-0};
4234 multiclass sve_mem_p_spill<string asm> {
4235 def NAME : sve_mem_p_spill<asm>;
4237 def : InstAlias<asm # "\t$Pt, [$Rn]",
4238 (!cast<Instruction>(NAME) PPRAny:$Pt, GPR64sp:$Rn, 0), 1>;
4241 //===----------------------------------------------------------------------===//
4242 // SVE Permute - Predicates Group
4243 //===----------------------------------------------------------------------===//
4245 class sve_int_perm_bin_perm_pp<bits<3> opc, bits<2> sz8_64, string asm,
4247 : I<(outs pprty:$Pd), (ins pprty:$Pn, pprty:$Pm),
4248 asm, "\t$Pd, $Pn, $Pm",
4254 let Inst{31-24} = 0b00000101;
4255 let Inst{23-22} = sz8_64;
4256 let Inst{21-20} = 0b10;
4257 let Inst{19-16} = Pm;
4258 let Inst{15-13} = 0b010;
4259 let Inst{12-10} = opc;
4266 multiclass sve_int_perm_bin_perm_pp<bits<3> opc, string asm> {
4267 def _B : sve_int_perm_bin_perm_pp<opc, 0b00, asm, PPR8>;
4268 def _H : sve_int_perm_bin_perm_pp<opc, 0b01, asm, PPR16>;
4269 def _S : sve_int_perm_bin_perm_pp<opc, 0b10, asm, PPR32>;
4270 def _D : sve_int_perm_bin_perm_pp<opc, 0b11, asm, PPR64>;
4273 class sve_int_perm_punpk<bit opc, string asm>
4274 : I<(outs PPR16:$Pd), (ins PPR8:$Pn),
4280 let Inst{31-17} = 0b000001010011000;
4282 let Inst{15-9} = 0b0100000;
4288 multiclass sve_int_perm_punpk<bit opc, string asm, SDPatternOperator op> {
4289 def NAME : sve_int_perm_punpk<opc, asm>;
4291 def : SVE_1_Op_Pat<nxv8i1, op, nxv16i1, !cast<Instruction>(NAME)>;
4292 def : SVE_1_Op_Pat<nxv4i1, op, nxv8i1, !cast<Instruction>(NAME)>;
4293 def : SVE_1_Op_Pat<nxv2i1, op, nxv4i1, !cast<Instruction>(NAME)>;
4296 class sve_int_rdffr_pred<bit s, string asm>
4297 : I<(outs PPR8:$Pd), (ins PPRAny:$Pg),
4298 asm, "\t$Pd, $Pg/z",
4303 let Inst{31-23} = 0b001001010;
4305 let Inst{21-9} = 0b0110001111000;
4310 let Defs = !if(!eq (s, 1), [NZCV], []);
4314 class sve_int_rdffr_unpred<string asm> : I<
4315 (outs PPR8:$Pd), (ins),
4320 let Inst{31-4} = 0b0010010100011001111100000000;
4326 class sve_int_wrffr<string asm>
4327 : I<(outs), (ins PPR8:$Pn),
4332 let Inst{31-9} = 0b00100101001010001001000;
4334 let Inst{4-0} = 0b00000;
4336 let hasSideEffects = 1;
4340 class sve_int_setffr<string asm>
4345 let Inst{31-0} = 0b00100101001011001001000000000000;
4347 let hasSideEffects = 1;
4351 //===----------------------------------------------------------------------===//
4352 // SVE Permute Vector - Predicated Group
4353 //===----------------------------------------------------------------------===//
4355 class sve_int_perm_clast_rz<bits<2> sz8_64, bit ab, string asm,
4356 ZPRRegOp zprty, RegisterClass rt>
4357 : I<(outs rt:$Rdn), (ins PPR3bAny:$Pg, rt:$_Rdn, zprty:$Zm),
4358 asm, "\t$Rdn, $Pg, $_Rdn, $Zm",
4364 let Inst{31-24} = 0b00000101;
4365 let Inst{23-22} = sz8_64;
4366 let Inst{21-17} = 0b11000;
4368 let Inst{15-13} = 0b101;
4369 let Inst{12-10} = Pg;
4371 let Inst{4-0} = Rdn;
4373 let Constraints = "$Rdn = $_Rdn";
4376 multiclass sve_int_perm_clast_rz<bit ab, string asm> {
4377 def _B : sve_int_perm_clast_rz<0b00, ab, asm, ZPR8, GPR32>;
4378 def _H : sve_int_perm_clast_rz<0b01, ab, asm, ZPR16, GPR32>;
4379 def _S : sve_int_perm_clast_rz<0b10, ab, asm, ZPR32, GPR32>;
4380 def _D : sve_int_perm_clast_rz<0b11, ab, asm, ZPR64, GPR64>;
4383 class sve_int_perm_clast_vz<bits<2> sz8_64, bit ab, string asm,
4384 ZPRRegOp zprty, RegisterClass rt>
4385 : I<(outs rt:$Vdn), (ins PPR3bAny:$Pg, rt:$_Vdn, zprty:$Zm),
4386 asm, "\t$Vdn, $Pg, $_Vdn, $Zm",
4392 let Inst{31-24} = 0b00000101;
4393 let Inst{23-22} = sz8_64;
4394 let Inst{21-17} = 0b10101;
4396 let Inst{15-13} = 0b100;
4397 let Inst{12-10} = Pg;
4399 let Inst{4-0} = Vdn;
4401 let Constraints = "$Vdn = $_Vdn";
4404 multiclass sve_int_perm_clast_vz<bit ab, string asm> {
4405 def _B : sve_int_perm_clast_vz<0b00, ab, asm, ZPR8, FPR8>;
4406 def _H : sve_int_perm_clast_vz<0b01, ab, asm, ZPR16, FPR16>;
4407 def _S : sve_int_perm_clast_vz<0b10, ab, asm, ZPR32, FPR32>;
4408 def _D : sve_int_perm_clast_vz<0b11, ab, asm, ZPR64, FPR64>;
4411 class sve_int_perm_clast_zz<bits<2> sz8_64, bit ab, string asm,
4413 : I<(outs zprty:$Zdn), (ins PPR3bAny:$Pg, zprty:$_Zdn, zprty:$Zm),
4414 asm, "\t$Zdn, $Pg, $_Zdn, $Zm",
4420 let Inst{31-24} = 0b00000101;
4421 let Inst{23-22} = sz8_64;
4422 let Inst{21-17} = 0b10100;
4424 let Inst{15-13} = 0b100;
4425 let Inst{12-10} = Pg;
4427 let Inst{4-0} = Zdn;
4429 let Constraints = "$Zdn = $_Zdn";
4430 let DestructiveInstType = Destructive;
4431 let ElementSize = ElementSizeNone;
4434 multiclass sve_int_perm_clast_zz<bit ab, string asm> {
4435 def _B : sve_int_perm_clast_zz<0b00, ab, asm, ZPR8>;
4436 def _H : sve_int_perm_clast_zz<0b01, ab, asm, ZPR16>;
4437 def _S : sve_int_perm_clast_zz<0b10, ab, asm, ZPR32>;
4438 def _D : sve_int_perm_clast_zz<0b11, ab, asm, ZPR64>;
4441 class sve_int_perm_last_r<bits<2> sz8_64, bit ab, string asm,
4442 ZPRRegOp zprty, RegisterClass resultRegType>
4443 : I<(outs resultRegType:$Rd), (ins PPR3bAny:$Pg, zprty:$Zn),
4444 asm, "\t$Rd, $Pg, $Zn",
4450 let Inst{31-24} = 0b00000101;
4451 let Inst{23-22} = sz8_64;
4452 let Inst{21-17} = 0b10000;
4454 let Inst{15-13} = 0b101;
4455 let Inst{12-10} = Pg;
4460 multiclass sve_int_perm_last_r<bit ab, string asm> {
4461 def _B : sve_int_perm_last_r<0b00, ab, asm, ZPR8, GPR32>;
4462 def _H : sve_int_perm_last_r<0b01, ab, asm, ZPR16, GPR32>;
4463 def _S : sve_int_perm_last_r<0b10, ab, asm, ZPR32, GPR32>;
4464 def _D : sve_int_perm_last_r<0b11, ab, asm, ZPR64, GPR64>;
4467 class sve_int_perm_last_v<bits<2> sz8_64, bit ab, string asm,
4468 ZPRRegOp zprty, RegisterClass dstRegtype>
4469 : I<(outs dstRegtype:$Vd), (ins PPR3bAny:$Pg, zprty:$Zn),
4470 asm, "\t$Vd, $Pg, $Zn",
4476 let Inst{31-24} = 0b00000101;
4477 let Inst{23-22} = sz8_64;
4478 let Inst{21-17} = 0b10001;
4480 let Inst{15-13} = 0b100;
4481 let Inst{12-10} = Pg;
4486 multiclass sve_int_perm_last_v<bit ab, string asm> {
4487 def _B : sve_int_perm_last_v<0b00, ab, asm, ZPR8, FPR8>;
4488 def _H : sve_int_perm_last_v<0b01, ab, asm, ZPR16, FPR16>;
4489 def _S : sve_int_perm_last_v<0b10, ab, asm, ZPR32, FPR32>;
4490 def _D : sve_int_perm_last_v<0b11, ab, asm, ZPR64, FPR64>;
4493 class sve_int_perm_splice<bits<2> sz8_64, string asm, ZPRRegOp zprty>
4494 : I<(outs zprty:$Zdn), (ins PPR3bAny:$Pg, zprty:$_Zdn, zprty:$Zm),
4495 asm, "\t$Zdn, $Pg, $_Zdn, $Zm",
4501 let Inst{31-24} = 0b00000101;
4502 let Inst{23-22} = sz8_64;
4503 let Inst{21-13} = 0b101100100;
4504 let Inst{12-10} = Pg;
4506 let Inst{4-0} = Zdn;
4508 let Constraints = "$Zdn = $_Zdn";
4509 let DestructiveInstType = Destructive;
4510 let ElementSize = ElementSizeNone;
4513 multiclass sve_int_perm_splice<string asm> {
4514 def _B : sve_int_perm_splice<0b00, asm, ZPR8>;
4515 def _H : sve_int_perm_splice<0b01, asm, ZPR16>;
4516 def _S : sve_int_perm_splice<0b10, asm, ZPR32>;
4517 def _D : sve_int_perm_splice<0b11, asm, ZPR64>;
4520 class sve2_int_perm_splice_cons<bits<2> sz8_64, string asm,
4521 ZPRRegOp zprty, RegisterOperand VecList>
4522 : I<(outs zprty:$Zd), (ins PPR3bAny:$Pg, VecList:$Zn),
4523 asm, "\t$Zd, $Pg, $Zn",
4529 let Inst{31-24} = 0b00000101;
4530 let Inst{23-22} = sz8_64;
4531 let Inst{21-13} = 0b101101100;
4532 let Inst{12-10} = Pg;
4537 multiclass sve2_int_perm_splice_cons<string asm> {
4538 def _B : sve2_int_perm_splice_cons<0b00, asm, ZPR8, ZZ_b>;
4539 def _H : sve2_int_perm_splice_cons<0b01, asm, ZPR16, ZZ_h>;
4540 def _S : sve2_int_perm_splice_cons<0b10, asm, ZPR32, ZZ_s>;
4541 def _D : sve2_int_perm_splice_cons<0b11, asm, ZPR64, ZZ_d>;
4544 class sve_int_perm_rev<bits<2> sz8_64, bits<2> opc, string asm,
4546 : I<(outs zprty:$Zd), (ins zprty:$_Zd, PPR3bAny:$Pg, zprty:$Zn),
4547 asm, "\t$Zd, $Pg/m, $Zn",
4553 let Inst{31-24} = 0b00000101;
4554 let Inst{23-22} = sz8_64;
4555 let Inst{21-18} = 0b1001;
4556 let Inst{17-16} = opc;
4557 let Inst{15-13} = 0b100;
4558 let Inst{12-10} = Pg;
4562 let Constraints = "$Zd = $_Zd";
4563 let DestructiveInstType = Destructive;
4564 let ElementSize = zprty.ElementSize;
4567 multiclass sve_int_perm_rev_rbit<string asm> {
4568 def _B : sve_int_perm_rev<0b00, 0b11, asm, ZPR8>;
4569 def _H : sve_int_perm_rev<0b01, 0b11, asm, ZPR16>;
4570 def _S : sve_int_perm_rev<0b10, 0b11, asm, ZPR32>;
4571 def _D : sve_int_perm_rev<0b11, 0b11, asm, ZPR64>;
4574 multiclass sve_int_perm_rev_revb<string asm> {
4575 def _H : sve_int_perm_rev<0b01, 0b00, asm, ZPR16>;
4576 def _S : sve_int_perm_rev<0b10, 0b00, asm, ZPR32>;
4577 def _D : sve_int_perm_rev<0b11, 0b00, asm, ZPR64>;
4580 multiclass sve_int_perm_rev_revh<string asm> {
4581 def _S : sve_int_perm_rev<0b10, 0b01, asm, ZPR32>;
4582 def _D : sve_int_perm_rev<0b11, 0b01, asm, ZPR64>;
4585 multiclass sve_int_perm_rev_revw<string asm> {
4586 def _D : sve_int_perm_rev<0b11, 0b10, asm, ZPR64>;
4589 class sve_int_perm_cpy_r<bits<2> sz8_64, string asm, ZPRRegOp zprty,
4590 RegisterClass srcRegType>
4591 : I<(outs zprty:$Zd), (ins zprty:$_Zd, PPR3bAny:$Pg, srcRegType:$Rn),
4592 asm, "\t$Zd, $Pg/m, $Rn",
4598 let Inst{31-24} = 0b00000101;
4599 let Inst{23-22} = sz8_64;
4600 let Inst{21-13} = 0b101000101;
4601 let Inst{12-10} = Pg;
4605 let Constraints = "$Zd = $_Zd";
4606 let DestructiveInstType = Destructive;
4607 let ElementSize = zprty.ElementSize;
4610 multiclass sve_int_perm_cpy_r<string asm> {
4611 def _B : sve_int_perm_cpy_r<0b00, asm, ZPR8, GPR32sp>;
4612 def _H : sve_int_perm_cpy_r<0b01, asm, ZPR16, GPR32sp>;
4613 def _S : sve_int_perm_cpy_r<0b10, asm, ZPR32, GPR32sp>;
4614 def _D : sve_int_perm_cpy_r<0b11, asm, ZPR64, GPR64sp>;
4616 def : InstAlias<"mov $Zd, $Pg/m, $Rn",
4617 (!cast<Instruction>(NAME # _B) ZPR8:$Zd, PPR3bAny:$Pg, GPR32sp:$Rn), 1>;
4618 def : InstAlias<"mov $Zd, $Pg/m, $Rn",
4619 (!cast<Instruction>(NAME # _H) ZPR16:$Zd, PPR3bAny:$Pg, GPR32sp:$Rn), 1>;
4620 def : InstAlias<"mov $Zd, $Pg/m, $Rn",
4621 (!cast<Instruction>(NAME # _S) ZPR32:$Zd, PPR3bAny:$Pg, GPR32sp:$Rn), 1>;
4622 def : InstAlias<"mov $Zd, $Pg/m, $Rn",
4623 (!cast<Instruction>(NAME # _D) ZPR64:$Zd, PPR3bAny:$Pg, GPR64sp:$Rn), 1>;
4626 class sve_int_perm_cpy_v<bits<2> sz8_64, string asm, ZPRRegOp zprty,
4627 RegisterClass srcRegtype>
4628 : I<(outs zprty:$Zd), (ins zprty:$_Zd, PPR3bAny:$Pg, srcRegtype:$Vn),
4629 asm, "\t$Zd, $Pg/m, $Vn",
4635 let Inst{31-24} = 0b00000101;
4636 let Inst{23-22} = sz8_64;
4637 let Inst{21-13} = 0b100000100;
4638 let Inst{12-10} = Pg;
4642 let Constraints = "$Zd = $_Zd";
4643 let DestructiveInstType = Destructive;
4644 let ElementSize = zprty.ElementSize;
4647 multiclass sve_int_perm_cpy_v<string asm> {
4648 def _B : sve_int_perm_cpy_v<0b00, asm, ZPR8, FPR8>;
4649 def _H : sve_int_perm_cpy_v<0b01, asm, ZPR16, FPR16>;
4650 def _S : sve_int_perm_cpy_v<0b10, asm, ZPR32, FPR32>;
4651 def _D : sve_int_perm_cpy_v<0b11, asm, ZPR64, FPR64>;
4653 def : InstAlias<"mov $Zd, $Pg/m, $Vn",
4654 (!cast<Instruction>(NAME # _B) ZPR8:$Zd, PPR3bAny:$Pg, FPR8:$Vn), 1>;
4655 def : InstAlias<"mov $Zd, $Pg/m, $Vn",
4656 (!cast<Instruction>(NAME # _H) ZPR16:$Zd, PPR3bAny:$Pg, FPR16:$Vn), 1>;
4657 def : InstAlias<"mov $Zd, $Pg/m, $Vn",
4658 (!cast<Instruction>(NAME # _S) ZPR32:$Zd, PPR3bAny:$Pg, FPR32:$Vn), 1>;
4659 def : InstAlias<"mov $Zd, $Pg/m, $Vn",
4660 (!cast<Instruction>(NAME # _D) ZPR64:$Zd, PPR3bAny:$Pg, FPR64:$Vn), 1>;
4663 class sve_int_perm_compact<bit sz, string asm, ZPRRegOp zprty>
4664 : I<(outs zprty:$Zd), (ins PPR3bAny:$Pg, zprty:$Zn),
4665 asm, "\t$Zd, $Pg, $Zn",
4671 let Inst{31-23} = 0b000001011;
4673 let Inst{21-13} = 0b100001100;
4674 let Inst{12-10} = Pg;
4679 multiclass sve_int_perm_compact<string asm> {
4680 def _S : sve_int_perm_compact<0b0, asm, ZPR32>;
4681 def _D : sve_int_perm_compact<0b1, asm, ZPR64>;
4685 //===----------------------------------------------------------------------===//
4686 // SVE Memory - Contiguous Load Group
4687 //===----------------------------------------------------------------------===//
4689 class sve_mem_cld_si_base<bits<4> dtype, bit nf, string asm,
4690 RegisterOperand VecList>
4691 : I<(outs VecList:$Zt), (ins PPR3bAny:$Pg, GPR64sp:$Rn, simm4s1:$imm4),
4692 asm, "\t$Zt, $Pg/z, [$Rn, $imm4, mul vl]",
4699 let Inst{31-25} = 0b1010010;
4700 let Inst{24-21} = dtype;
4702 let Inst{19-16} = imm4;
4703 let Inst{15-13} = 0b101;
4704 let Inst{12-10} = Pg;
4709 let Uses = !if(!eq(nf, 1), [FFR], []);
4710 let Defs = !if(!eq(nf, 1), [FFR], []);
4713 multiclass sve_mem_cld_si_base<bits<4> dtype, bit nf, string asm,
4714 RegisterOperand listty, ZPRRegOp zprty> {
4715 def _REAL : sve_mem_cld_si_base<dtype, nf, asm, listty>;
4717 def : InstAlias<asm # "\t$Zt, $Pg/z, [$Rn]",
4718 (!cast<Instruction>(NAME # _REAL) zprty:$Zt, PPR3bAny:$Pg, GPR64sp:$Rn, 0), 0>;
4719 def : InstAlias<asm # "\t$Zt, $Pg/z, [$Rn, $imm4, mul vl]",
4720 (!cast<Instruction>(NAME # _REAL) zprty:$Zt, PPR3bAny:$Pg, GPR64sp:$Rn, simm4s1:$imm4), 0>;
4721 def : InstAlias<asm # "\t$Zt, $Pg/z, [$Rn]",
4722 (!cast<Instruction>(NAME # _REAL) listty:$Zt, PPR3bAny:$Pg, GPR64sp:$Rn, 0), 1>;
4725 multiclass sve_mem_cld_si<bits<4> dtype, string asm, RegisterOperand listty,
4727 : sve_mem_cld_si_base<dtype, 0, asm, listty, zprty>;
4729 class sve_mem_cldnt_si_base<bits<2> msz, string asm, RegisterOperand VecList>
4730 : I<(outs VecList:$Zt), (ins PPR3bAny:$Pg, GPR64sp:$Rn, simm4s1:$imm4),
4731 asm, "\t$Zt, $Pg/z, [$Rn, $imm4, mul vl]",
4738 let Inst{31-25} = 0b1010010;
4739 let Inst{24-23} = msz;
4740 let Inst{22-20} = 0b000;
4741 let Inst{19-16} = imm4;
4742 let Inst{15-13} = 0b111;
4743 let Inst{12-10} = Pg;
4750 multiclass sve_mem_cldnt_si<bits<2> msz, string asm, RegisterOperand listty,
4752 def NAME : sve_mem_cldnt_si_base<msz, asm, listty>;
4754 def : InstAlias<asm # "\t$Zt, $Pg/z, [$Rn]",
4755 (!cast<Instruction>(NAME) zprty:$Zt, PPR3bAny:$Pg, GPR64sp:$Rn, 0), 0>;
4756 def : InstAlias<asm # "\t$Zt, $Pg/z, [$Rn, $imm4, mul vl]",
4757 (!cast<Instruction>(NAME) zprty:$Zt, PPR3bAny:$Pg, GPR64sp:$Rn, simm4s1:$imm4), 0>;
4758 def : InstAlias<asm # "\t$Zt, $Pg/z, [$Rn]",
4759 (!cast<Instruction>(NAME) listty:$Zt, PPR3bAny:$Pg, GPR64sp:$Rn, 0), 1>;
4762 class sve_mem_cldnt_ss_base<bits<2> msz, string asm, RegisterOperand VecList,
4763 RegisterOperand gprty>
4764 : I<(outs VecList:$Zt), (ins PPR3bAny:$Pg, GPR64sp:$Rn, gprty:$Rm),
4765 asm, "\t$Zt, $Pg/z, [$Rn, $Rm]",
4772 let Inst{31-25} = 0b1010010;
4773 let Inst{24-23} = msz;
4774 let Inst{22-21} = 0b00;
4775 let Inst{20-16} = Rm;
4776 let Inst{15-13} = 0b110;
4777 let Inst{12-10} = Pg;
4784 multiclass sve_mem_cldnt_ss<bits<2> msz, string asm, RegisterOperand listty,
4785 ZPRRegOp zprty, RegisterOperand gprty> {
4786 def NAME : sve_mem_cldnt_ss_base<msz, asm, listty, gprty>;
4788 def : InstAlias<asm # "\t$Zt, $Pg/z, [$Rn, $Rm]",
4789 (!cast<Instruction>(NAME) zprty:$Zt, PPR3bAny:$Pg, GPR64sp:$Rn, gprty:$Rm), 0>;
4792 class sve_mem_ldqr_si<bits<2> sz, string asm, RegisterOperand VecList>
4793 : I<(outs VecList:$Zt), (ins PPR3bAny:$Pg, GPR64sp:$Rn, simm4s16:$imm4),
4794 asm, "\t$Zt, $Pg/z, [$Rn, $imm4]", "", []>, Sched<[]> {
4799 let Inst{31-25} = 0b1010010;
4800 let Inst{24-23} = sz;
4801 let Inst{22-20} = 0;
4802 let Inst{19-16} = imm4;
4803 let Inst{15-13} = 0b001;
4804 let Inst{12-10} = Pg;
4811 multiclass sve_mem_ldqr_si<bits<2> sz, string asm, RegisterOperand listty,
4813 def NAME : sve_mem_ldqr_si<sz, asm, listty>;
4814 def : InstAlias<asm # "\t$Zt, $Pg/z, [$Rn]",
4815 (!cast<Instruction>(NAME) listty:$Zt, PPR3bAny:$Pg, GPR64sp:$Rn, 0), 1>;
4816 def : InstAlias<asm # "\t$Zt, $Pg/z, [$Rn]",
4817 (!cast<Instruction>(NAME) zprty:$Zt, PPR3bAny:$Pg, GPR64sp:$Rn, 0), 0>;
4818 def : InstAlias<asm # "\t$Zt, $Pg/z, [$Rn, $imm4]",
4819 (!cast<Instruction>(NAME) zprty:$Zt, PPR3bAny:$Pg, GPR64sp:$Rn, simm4s16:$imm4), 0>;
4822 class sve_mem_ldqr_ss<bits<2> sz, string asm, RegisterOperand VecList,
4823 RegisterOperand gprty>
4824 : I<(outs VecList:$Zt), (ins PPR3bAny:$Pg, GPR64sp:$Rn, gprty:$Rm),
4825 asm, "\t$Zt, $Pg/z, [$Rn, $Rm]", "", []>, Sched<[]> {
4830 let Inst{31-25} = 0b1010010;
4831 let Inst{24-23} = sz;
4832 let Inst{22-21} = 0;
4833 let Inst{20-16} = Rm;
4834 let Inst{15-13} = 0;
4835 let Inst{12-10} = Pg;
4842 multiclass sve_mem_ldqr_ss<bits<2> sz, string asm, RegisterOperand listty,
4843 ZPRRegOp zprty, RegisterOperand gprty> {
4844 def NAME : sve_mem_ldqr_ss<sz, asm, listty, gprty>;
4846 def : InstAlias<asm # "\t$Zt, $Pg/z, [$Rn, $Rm]",
4847 (!cast<Instruction>(NAME) zprty:$Zt, PPR3bAny:$Pg, GPR64sp:$Rn, gprty:$Rm), 0>;
4850 class sve_mem_ld_dup<bits<2> dtypeh, bits<2> dtypel, string asm,
4851 RegisterOperand VecList, Operand immtype>
4852 : I<(outs VecList:$Zt), (ins PPR3bAny:$Pg, GPR64sp:$Rn, immtype:$imm6),
4853 asm, "\t$Zt, $Pg/z, [$Rn, $imm6]",
4860 let Inst{31-25} = 0b1000010;
4861 let Inst{24-23} = dtypeh;
4863 let Inst{21-16} = imm6;
4865 let Inst{14-13} = dtypel;
4866 let Inst{12-10} = Pg;
4873 multiclass sve_mem_ld_dup<bits<2> dtypeh, bits<2> dtypel, string asm,
4874 RegisterOperand zlistty, ZPRRegOp zprty, Operand immtype> {
4875 def NAME : sve_mem_ld_dup<dtypeh, dtypel, asm, zlistty, immtype>;
4877 def : InstAlias<asm # "\t$Zt, $Pg/z, [$Rn]",
4878 (!cast<Instruction>(NAME) zprty:$Zt, PPR3bAny:$Pg, GPR64sp:$Rn, 0), 0>;
4879 def : InstAlias<asm # "\t$Zt, $Pg/z, [$Rn, $imm6]",
4880 (!cast<Instruction>(NAME) zprty:$Zt, PPR3bAny:$Pg, GPR64sp:$Rn, immtype:$imm6), 0>;
4881 def : InstAlias<asm # "\t$Zt, $Pg/z, [$Rn]",
4882 (!cast<Instruction>(NAME) zlistty:$Zt, PPR3bAny:$Pg, GPR64sp:$Rn, 0), 1>;
4885 class sve_mem_cld_ss_base<bits<4> dtype, bit ff, dag iops, string asm,
4886 RegisterOperand VecList>
4887 : I<(outs VecList:$Zt), iops,
4888 asm, "\t$Zt, $Pg/z, [$Rn, $Rm]",
4895 let Inst{31-25} = 0b1010010;
4896 let Inst{24-21} = dtype;
4897 let Inst{20-16} = Rm;
4898 let Inst{15-14} = 0b01;
4900 let Inst{12-10} = Pg;
4905 let Uses = !if(!eq(ff, 1), [FFR], []);
4906 let Defs = !if(!eq(ff, 1), [FFR], []);
4909 multiclass sve_mem_cld_ss<bits<4> dtype, string asm, RegisterOperand listty,
4910 ZPRRegOp zprty, RegisterOperand gprty> {
4911 def "" : sve_mem_cld_ss_base<dtype, 0, (ins PPR3bAny:$Pg, GPR64sp:$Rn, gprty:$Rm),
4914 def : InstAlias<asm # "\t$Zt, $Pg/z, [$Rn, $Rm]",
4915 (!cast<Instruction>(NAME) zprty:$Zt, PPR3bAny:$Pg, GPR64sp:$Rn, gprty:$Rm), 0>;
4918 multiclass sve_mem_cldff_ss<bits<4> dtype, string asm, RegisterOperand listty,
4919 ZPRRegOp zprty, RegisterOperand gprty> {
4920 def _REAL : sve_mem_cld_ss_base<dtype, 1, (ins PPR3bAny:$Pg, GPR64sp:$Rn, gprty:$Rm),
4923 def : InstAlias<asm # "\t$Zt, $Pg/z, [$Rn, $Rm]",
4924 (!cast<Instruction>(NAME # _REAL) zprty:$Zt, PPR3bAny:$Pg, GPR64sp:$Rn, gprty:$Rm), 0>;
4926 def : InstAlias<asm # "\t$Zt, $Pg/z, [$Rn]",
4927 (!cast<Instruction>(NAME # _REAL) listty:$Zt, PPR3bAny:$Pg, GPR64sp:$Rn, XZR), 1>;
4929 def : InstAlias<asm # "\t$Zt, $Pg/z, [$Rn]",
4930 (!cast<Instruction>(NAME # _REAL) zprty:$Zt, PPR3bAny:$Pg, GPR64sp:$Rn, XZR), 0>;
4933 multiclass sve_mem_cldnf_si<bits<4> dtype, string asm, RegisterOperand listty,
4935 : sve_mem_cld_si_base<dtype, 1, asm, listty, zprty>;
4937 class sve_mem_eld_si<bits<2> sz, bits<2> nregs, RegisterOperand VecList,
4938 string asm, Operand immtype>
4939 : I<(outs VecList:$Zt), (ins PPR3bAny:$Pg, GPR64sp:$Rn, immtype:$imm4),
4940 asm, "\t$Zt, $Pg/z, [$Rn, $imm4, mul vl]",
4947 let Inst{31-25} = 0b1010010;
4948 let Inst{24-23} = sz;
4949 let Inst{22-21} = nregs;
4951 let Inst{19-16} = imm4;
4952 let Inst{15-13} = 0b111;
4953 let Inst{12-10} = Pg;
4960 multiclass sve_mem_eld_si<bits<2> sz, bits<2> nregs, RegisterOperand VecList,
4961 string asm, Operand immtype> {
4962 def NAME : sve_mem_eld_si<sz, nregs, VecList, asm, immtype>;
4964 def : InstAlias<asm # "\t$Zt, $Pg/z, [$Rn]",
4965 (!cast<Instruction>(NAME) VecList:$Zt, PPR3bAny:$Pg, GPR64sp:$Rn, 0), 1>;
4968 class sve_mem_eld_ss<bits<2> sz, bits<2> nregs, RegisterOperand VecList,
4969 string asm, RegisterOperand gprty>
4970 : I<(outs VecList:$Zt), (ins PPR3bAny:$Pg, GPR64sp:$Rn, gprty:$Rm),
4971 asm, "\t$Zt, $Pg/z, [$Rn, $Rm]",
4978 let Inst{31-25} = 0b1010010;
4979 let Inst{24-23} = sz;
4980 let Inst{22-21} = nregs;
4981 let Inst{20-16} = Rm;
4982 let Inst{15-13} = 0b110;
4983 let Inst{12-10} = Pg;
4990 //===----------------------------------------------------------------------===//
4991 // SVE Memory - 32-bit Gather and Unsized Contiguous Group
4992 //===----------------------------------------------------------------------===//
4994 // bit xs is '1' if offsets are signed
4995 // bit scaled is '1' if the offsets are scaled
4996 class sve_mem_32b_gld_sv<bits<4> opc, bit xs, bit scaled, string asm,
4997 RegisterOperand zprext>
4998 : I<(outs Z_s:$Zt), (ins PPR3bAny:$Pg, GPR64sp:$Rn, zprext:$Zm),
4999 asm, "\t$Zt, $Pg/z, [$Rn, $Zm]",
5006 let Inst{31-25} = 0b1000010;
5007 let Inst{24-23} = opc{3-2};
5009 let Inst{21} = scaled;
5010 let Inst{20-16} = Zm;
5012 let Inst{14-13} = opc{1-0};
5013 let Inst{12-10} = Pg;
5018 let Defs = !if(!eq(opc{0}, 1), [FFR], []);
5019 let Uses = !if(!eq(opc{0}, 1), [FFR], []);
5022 multiclass sve_mem_32b_gld_sv_32_scaled<bits<4> opc, string asm,
5023 RegisterOperand sxtw_opnd,
5024 RegisterOperand uxtw_opnd> {
5025 def _UXTW_SCALED_REAL : sve_mem_32b_gld_sv<opc, 0, 1, asm, uxtw_opnd>;
5026 def _SXTW_SCALED_REAL : sve_mem_32b_gld_sv<opc, 1, 1, asm, sxtw_opnd>;
5028 def : InstAlias<asm # "\t$Zt, $Pg/z, [$Rn, $Zm]",
5029 (!cast<Instruction>(NAME # _UXTW_SCALED_REAL) ZPR32:$Zt, PPR3bAny:$Pg, GPR64sp:$Rn, uxtw_opnd:$Zm), 0>;
5030 def : InstAlias<asm # "\t$Zt, $Pg/z, [$Rn, $Zm]",
5031 (!cast<Instruction>(NAME # _SXTW_SCALED_REAL) ZPR32:$Zt, PPR3bAny:$Pg, GPR64sp:$Rn, sxtw_opnd:$Zm), 0>;
5034 multiclass sve_mem_32b_gld_vs_32_unscaled<bits<4> opc, string asm,
5035 RegisterOperand sxtw_opnd,
5036 RegisterOperand uxtw_opnd> {
5037 def _UXTW_REAL : sve_mem_32b_gld_sv<opc, 0, 0, asm, uxtw_opnd>;
5038 def _SXTW_REAL : sve_mem_32b_gld_sv<opc, 1, 0, asm, sxtw_opnd>;
5040 def : InstAlias<asm # "\t$Zt, $Pg/z, [$Rn, $Zm]",
5041 (!cast<Instruction>(NAME # _UXTW_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_REAL) ZPR32:$Zt, PPR3bAny:$Pg, GPR64sp:$Rn, sxtw_opnd:$Zm), 0>;
5047 class sve_mem_32b_gld_vi<bits<4> opc, string asm, Operand imm_ty>
5048 : I<(outs Z_s:$Zt), (ins PPR3bAny:$Pg, ZPR32:$Zn, imm_ty:$imm5),
5049 asm, "\t$Zt, $Pg/z, [$Zn, $imm5]",
5056 let Inst{31-25} = 0b1000010;
5057 let Inst{24-23} = opc{3-2};
5058 let Inst{22-21} = 0b01;
5059 let Inst{20-16} = imm5;
5061 let Inst{14-13} = opc{1-0};
5062 let Inst{12-10} = Pg;
5067 let Defs = !if(!eq(opc{0}, 1), [FFR], []);
5068 let Uses = !if(!eq(opc{0}, 1), [FFR], []);
5071 multiclass sve_mem_32b_gld_vi_32_ptrs<bits<4> opc, string asm, Operand imm_ty> {
5072 def _IMM_REAL : sve_mem_32b_gld_vi<opc, asm, imm_ty>;
5074 def : InstAlias<asm # "\t$Zt, $Pg/z, [$Zn]",
5075 (!cast<Instruction>(NAME # _IMM_REAL) ZPR32:$Zt, PPR3bAny:$Pg, ZPR32:$Zn, 0), 0>;
5076 def : InstAlias<asm # "\t$Zt, $Pg/z, [$Zn, $imm5]",
5077 (!cast<Instruction>(NAME # _IMM_REAL) ZPR32:$Zt, PPR3bAny:$Pg, ZPR32:$Zn, imm_ty:$imm5), 0>;
5078 def : InstAlias<asm # "\t$Zt, $Pg/z, [$Zn]",
5079 (!cast<Instruction>(NAME # _IMM_REAL) Z_s:$Zt, PPR3bAny:$Pg, ZPR32:$Zn, 0), 1>;
5082 class sve_mem_prfm_si<bits<2> msz, string asm>
5083 : I<(outs), (ins sve_prfop:$prfop, PPR3bAny:$Pg, GPR64sp:$Rn, simm6s1:$imm6),
5084 asm, "\t$prfop, $Pg, [$Rn, $imm6, mul vl]",
5091 let Inst{31-22} = 0b1000010111;
5092 let Inst{21-16} = imm6;
5094 let Inst{14-13} = msz;
5095 let Inst{12-10} = Pg;
5098 let Inst{3-0} = prfop;
5100 let hasSideEffects = 1;
5103 multiclass sve_mem_prfm_si<bits<2> msz, string asm> {
5104 def NAME : sve_mem_prfm_si<msz, asm>;
5106 def : InstAlias<asm # "\t$prfop, $Pg, [$Rn]",
5107 (!cast<Instruction>(NAME) sve_prfop:$prfop, PPR3bAny:$Pg, GPR64sp:$Rn, 0), 1>;
5110 class sve_mem_prfm_ss<bits<3> opc, string asm, RegisterOperand gprty>
5111 : I<(outs), (ins sve_prfop:$prfop, PPR3bAny:$Pg, GPR64sp:$Rn, gprty:$Rm),
5112 asm, "\t$prfop, $Pg, [$Rn, $Rm]",
5119 let Inst{31-25} = 0b1000010;
5120 let Inst{24-23} = opc{2-1};
5121 let Inst{22-21} = 0b00;
5122 let Inst{20-16} = Rm;
5124 let Inst{14} = opc{0};
5126 let Inst{12-10} = Pg;
5129 let Inst{3-0} = prfop;
5131 let hasSideEffects = 1;
5134 class sve_mem_32b_prfm_sv<bits<2> msz, bit xs, string asm,
5135 RegisterOperand zprext>
5136 : I<(outs), (ins sve_prfop:$prfop, PPR3bAny:$Pg, GPR64sp:$Rn, zprext:$Zm),
5137 asm, "\t$prfop, $Pg, [$Rn, $Zm]",
5144 let Inst{31-23} = 0b100001000;
5147 let Inst{20-16} = Zm;
5149 let Inst{14-13} = msz;
5150 let Inst{12-10} = Pg;
5153 let Inst{3-0} = prfop;
5155 let hasSideEffects = 1;
5158 multiclass sve_mem_32b_prfm_sv_scaled<bits<2> msz, string asm,
5159 RegisterOperand sxtw_opnd,
5160 RegisterOperand uxtw_opnd> {
5161 def _UXTW_SCALED : sve_mem_32b_prfm_sv<msz, 0, asm, uxtw_opnd>;
5162 def _SXTW_SCALED : sve_mem_32b_prfm_sv<msz, 1, asm, sxtw_opnd>;
5165 class sve_mem_32b_prfm_vi<bits<2> msz, string asm, Operand imm_ty>
5166 : I<(outs), (ins sve_prfop:$prfop, PPR3bAny:$Pg, ZPR32:$Zn, imm_ty:$imm5),
5167 asm, "\t$prfop, $Pg, [$Zn, $imm5]",
5174 let Inst{31-25} = 0b1000010;
5175 let Inst{24-23} = msz;
5176 let Inst{22-21} = 0b00;
5177 let Inst{20-16} = imm5;
5178 let Inst{15-13} = 0b111;
5179 let Inst{12-10} = Pg;
5182 let Inst{3-0} = prfop;
5185 multiclass sve_mem_32b_prfm_vi<bits<2> msz, string asm, Operand imm_ty> {
5186 def NAME : sve_mem_32b_prfm_vi<msz, asm, imm_ty>;
5188 def : InstAlias<asm # "\t$prfop, $Pg, [$Zn]",
5189 (!cast<Instruction>(NAME) sve_prfop:$prfop, PPR3bAny:$Pg, ZPR32:$Zn, 0), 1>;
5192 class sve_mem_z_fill<string asm>
5193 : I<(outs ZPRAny:$Zt), (ins GPR64sp:$Rn, simm9:$imm9),
5194 asm, "\t$Zt, [$Rn, $imm9, mul vl]",
5200 let Inst{31-22} = 0b1000010110;
5201 let Inst{21-16} = imm9{8-3};
5202 let Inst{15-13} = 0b010;
5203 let Inst{12-10} = imm9{2-0};
5210 multiclass sve_mem_z_fill<string asm> {
5211 def NAME : sve_mem_z_fill<asm>;
5213 def : InstAlias<asm # "\t$Zt, [$Rn]",
5214 (!cast<Instruction>(NAME) ZPRAny:$Zt, GPR64sp:$Rn, 0), 1>;
5217 class sve_mem_p_fill<string asm>
5218 : I<(outs PPRAny:$Pt), (ins GPR64sp:$Rn, simm9:$imm9),
5219 asm, "\t$Pt, [$Rn, $imm9, mul vl]",
5225 let Inst{31-22} = 0b1000010110;
5226 let Inst{21-16} = imm9{8-3};
5227 let Inst{15-13} = 0b000;
5228 let Inst{12-10} = imm9{2-0};
5236 multiclass sve_mem_p_fill<string asm> {
5237 def NAME : sve_mem_p_fill<asm>;
5239 def : InstAlias<asm # "\t$Pt, [$Rn]",
5240 (!cast<Instruction>(NAME) PPRAny:$Pt, GPR64sp:$Rn, 0), 1>;
5243 class sve2_mem_gldnt_vs_base<bits<5> opc, dag iops, string asm,
5244 RegisterOperand VecList>
5245 : I<(outs VecList:$Zt), iops,
5246 asm, "\t$Zt, $Pg/z, [$Zn, $Rm]",
5254 let Inst{30} = opc{4};
5255 let Inst{29-25} = 0b00010;
5256 let Inst{24-23} = opc{3-2};
5257 let Inst{22-21} = 0b00;
5258 let Inst{20-16} = Rm;
5260 let Inst{14-13} = opc{1-0};
5261 let Inst{12-10} = Pg;
5268 multiclass sve2_mem_gldnt_vs<bits<5> opc, string asm,
5269 RegisterOperand listty, ZPRRegOp zprty> {
5270 def _REAL : sve2_mem_gldnt_vs_base<opc, (ins PPR3bAny:$Pg, zprty:$Zn, GPR64:$Rm),
5273 def : InstAlias<asm # "\t$Zt, $Pg/z, [$Zn, $Rm]",
5274 (!cast<Instruction>(NAME # _REAL) zprty:$Zt, PPR3bAny:$Pg, zprty:$Zn, GPR64:$Rm), 0>;
5275 def : InstAlias<asm # "\t$Zt, $Pg/z, [$Zn]",
5276 (!cast<Instruction>(NAME # _REAL) zprty:$Zt, PPR3bAny:$Pg, zprty:$Zn, XZR), 0>;
5277 def : InstAlias<asm # "\t$Zt, $Pg/z, [$Zn]",
5278 (!cast<Instruction>(NAME # _REAL) listty:$Zt, PPR3bAny:$Pg, zprty:$Zn, XZR), 1>;
5281 //===----------------------------------------------------------------------===//
5282 // SVE Memory - 64-bit Gather Group
5283 //===----------------------------------------------------------------------===//
5285 // bit xs is '1' if offsets are signed
5286 // bit scaled is '1' if the offsets are scaled
5287 // bit lsl is '0' if the offsets are extended (uxtw/sxtw), '1' if shifted (lsl)
5288 class sve_mem_64b_gld_sv<bits<4> opc, bit xs, bit scaled, bit lsl, string asm,
5289 RegisterOperand zprext>
5290 : I<(outs Z_d:$Zt), (ins PPR3bAny:$Pg, GPR64sp:$Rn, zprext:$Zm),
5291 asm, "\t$Zt, $Pg/z, [$Rn, $Zm]",
5298 let Inst{31-25} = 0b1100010;
5299 let Inst{24-23} = opc{3-2};
5301 let Inst{21} = scaled;
5302 let Inst{20-16} = Zm;
5304 let Inst{14-13} = opc{1-0};
5305 let Inst{12-10} = Pg;
5310 let Defs = !if(!eq(opc{0}, 1), [FFR], []);
5311 let Uses = !if(!eq(opc{0}, 1), [FFR], []);
5314 multiclass sve_mem_64b_gld_sv_32_scaled<bits<4> opc, string asm,
5315 RegisterOperand sxtw_opnd,
5316 RegisterOperand uxtw_opnd> {
5317 def _UXTW_SCALED_REAL : sve_mem_64b_gld_sv<opc, 0, 1, 0, asm, uxtw_opnd>;
5318 def _SXTW_SCALED_REAL : sve_mem_64b_gld_sv<opc, 1, 1, 0, asm, sxtw_opnd>;
5320 def : InstAlias<asm # "\t$Zt, $Pg/z, [$Rn, $Zm]",
5321 (!cast<Instruction>(NAME # _UXTW_SCALED_REAL) ZPR64:$Zt, PPR3bAny:$Pg, GPR64sp:$Rn, uxtw_opnd:$Zm), 0>;
5322 def : InstAlias<asm # "\t$Zt, $Pg/z, [$Rn, $Zm]",
5323 (!cast<Instruction>(NAME # _SXTW_SCALED_REAL) ZPR64:$Zt, PPR3bAny:$Pg, GPR64sp:$Rn, sxtw_opnd:$Zm), 0>;
5326 multiclass sve_mem_64b_gld_vs_32_unscaled<bits<4> opc, string asm,
5327 RegisterOperand sxtw_opnd,
5328 RegisterOperand uxtw_opnd> {
5329 def _UXTW_REAL : sve_mem_64b_gld_sv<opc, 0, 0, 0, asm, uxtw_opnd>;
5330 def _SXTW_REAL : sve_mem_64b_gld_sv<opc, 1, 0, 0, asm, sxtw_opnd>;
5332 def : InstAlias<asm # "\t$Zt, $Pg/z, [$Rn, $Zm]",
5333 (!cast<Instruction>(NAME # _UXTW_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_REAL) ZPR64:$Zt, PPR3bAny:$Pg, GPR64sp:$Rn, sxtw_opnd:$Zm), 0>;
5338 multiclass sve_mem_64b_gld_sv2_64_scaled<bits<4> opc, string asm,
5339 RegisterOperand zprext> {
5340 def _SCALED_REAL : sve_mem_64b_gld_sv<opc, 1, 1, 1, asm, zprext>;
5342 def : InstAlias<asm # "\t$Zt, $Pg/z, [$Rn, $Zm]",
5343 (!cast<Instruction>(NAME # _SCALED_REAL) ZPR64:$Zt, PPR3bAny:$Pg, GPR64sp:$Rn, zprext:$Zm), 0>;
5346 multiclass sve_mem_64b_gld_vs2_64_unscaled<bits<4> opc, string asm> {
5347 def _REAL : sve_mem_64b_gld_sv<opc, 1, 0, 1, asm, ZPR64ExtLSL8>;
5349 def : InstAlias<asm # "\t$Zt, $Pg/z, [$Rn, $Zm]",
5350 (!cast<Instruction>(NAME # _REAL) ZPR64:$Zt, PPR3bAny:$Pg, GPR64sp:$Rn, ZPR64ExtLSL8:$Zm), 0>;
5353 class sve_mem_64b_gld_vi<bits<4> opc, string asm, Operand imm_ty>
5354 : I<(outs Z_d:$Zt), (ins PPR3bAny:$Pg, ZPR64:$Zn, imm_ty:$imm5),
5355 asm, "\t$Zt, $Pg/z, [$Zn, $imm5]",
5362 let Inst{31-25} = 0b1100010;
5363 let Inst{24-23} = opc{3-2};
5364 let Inst{22-21} = 0b01;
5365 let Inst{20-16} = imm5;
5367 let Inst{14-13} = opc{1-0};
5368 let Inst{12-10} = Pg;
5373 let Defs = !if(!eq(opc{0}, 1), [FFR], []);
5374 let Uses = !if(!eq(opc{0}, 1), [FFR], []);
5377 multiclass sve_mem_64b_gld_vi_64_ptrs<bits<4> opc, string asm, Operand imm_ty> {
5378 def _IMM_REAL : sve_mem_64b_gld_vi<opc, asm, imm_ty>;
5380 def : InstAlias<asm # "\t$Zt, $Pg/z, [$Zn]",
5381 (!cast<Instruction>(NAME # _IMM_REAL) ZPR64:$Zt, PPR3bAny:$Pg, ZPR64:$Zn, 0), 0>;
5382 def : InstAlias<asm # "\t$Zt, $Pg/z, [$Zn, $imm5]",
5383 (!cast<Instruction>(NAME # _IMM_REAL) ZPR64:$Zt, PPR3bAny:$Pg, ZPR64:$Zn, imm_ty:$imm5), 0>;
5384 def : InstAlias<asm # "\t$Zt, $Pg/z, [$Zn]",
5385 (!cast<Instruction>(NAME # _IMM_REAL) Z_d:$Zt, PPR3bAny:$Pg, ZPR64:$Zn, 0), 1>;
5388 // bit lsl is '0' if the offsets are extended (uxtw/sxtw), '1' if shifted (lsl)
5389 class sve_mem_64b_prfm_sv<bits<2> msz, bit xs, bit lsl, string asm,
5390 RegisterOperand zprext>
5391 : I<(outs), (ins sve_prfop:$prfop, PPR3bAny:$Pg, GPR64sp:$Rn, zprext:$Zm),
5392 asm, "\t$prfop, $Pg, [$Rn, $Zm]",
5399 let Inst{31-23} = 0b110001000;
5402 let Inst{20-16} = Zm;
5404 let Inst{14-13} = msz;
5405 let Inst{12-10} = Pg;
5408 let Inst{3-0} = prfop;
5410 let hasSideEffects = 1;
5413 multiclass sve_mem_64b_prfm_sv_ext_scaled<bits<2> msz, string asm,
5414 RegisterOperand sxtw_opnd,
5415 RegisterOperand uxtw_opnd> {
5416 def _UXTW_SCALED : sve_mem_64b_prfm_sv<msz, 0, 0, asm, uxtw_opnd>;
5417 def _SXTW_SCALED : sve_mem_64b_prfm_sv<msz, 1, 0, asm, sxtw_opnd>;
5420 multiclass sve_mem_64b_prfm_sv_lsl_scaled<bits<2> msz, string asm,
5421 RegisterOperand zprext> {
5422 def NAME : sve_mem_64b_prfm_sv<msz, 1, 1, asm, zprext>;
5426 class sve_mem_64b_prfm_vi<bits<2> msz, string asm, Operand imm_ty>
5427 : I<(outs), (ins sve_prfop:$prfop, PPR3bAny:$Pg, ZPR64:$Zn, imm_ty:$imm5),
5428 asm, "\t$prfop, $Pg, [$Zn, $imm5]",
5435 let Inst{31-25} = 0b1100010;
5436 let Inst{24-23} = msz;
5437 let Inst{22-21} = 0b00;
5438 let Inst{20-16} = imm5;
5439 let Inst{15-13} = 0b111;
5440 let Inst{12-10} = Pg;
5443 let Inst{3-0} = prfop;
5445 let hasSideEffects = 1;
5448 multiclass sve_mem_64b_prfm_vi<bits<2> msz, string asm, Operand imm_ty> {
5449 def NAME : sve_mem_64b_prfm_vi<msz, asm, imm_ty>;
5451 def : InstAlias<asm # "\t$prfop, $Pg, [$Zn]",
5452 (!cast<Instruction>(NAME) sve_prfop:$prfop, PPR3bAny:$Pg, ZPR64:$Zn, 0), 1>;
5456 //===----------------------------------------------------------------------===//
5457 // SVE Compute Vector Address Group
5458 //===----------------------------------------------------------------------===//
5460 class sve_int_bin_cons_misc_0_a<bits<2> opc, bits<2> msz, string asm,
5461 ZPRRegOp zprty, RegisterOperand zprext>
5462 : I<(outs zprty:$Zd), (ins zprty:$Zn, zprext:$Zm),
5463 asm, "\t$Zd, [$Zn, $Zm]",
5469 let Inst{31-24} = 0b00000100;
5470 let Inst{23-22} = opc;
5472 let Inst{20-16} = Zm;
5473 let Inst{15-12} = 0b1010;
5474 let Inst{11-10} = msz;
5479 multiclass sve_int_bin_cons_misc_0_a_uxtw<bits<2> opc, string asm> {
5480 def _0 : sve_int_bin_cons_misc_0_a<opc, 0b00, asm, ZPR64, ZPR64ExtUXTW8>;
5481 def _1 : sve_int_bin_cons_misc_0_a<opc, 0b01, asm, ZPR64, ZPR64ExtUXTW16>;
5482 def _2 : sve_int_bin_cons_misc_0_a<opc, 0b10, asm, ZPR64, ZPR64ExtUXTW32>;
5483 def _3 : sve_int_bin_cons_misc_0_a<opc, 0b11, asm, ZPR64, ZPR64ExtUXTW64>;
5486 multiclass sve_int_bin_cons_misc_0_a_sxtw<bits<2> opc, string asm> {
5487 def _0 : sve_int_bin_cons_misc_0_a<opc, 0b00, asm, ZPR64, ZPR64ExtSXTW8>;
5488 def _1 : sve_int_bin_cons_misc_0_a<opc, 0b01, asm, ZPR64, ZPR64ExtSXTW16>;
5489 def _2 : sve_int_bin_cons_misc_0_a<opc, 0b10, asm, ZPR64, ZPR64ExtSXTW32>;
5490 def _3 : sve_int_bin_cons_misc_0_a<opc, 0b11, asm, ZPR64, ZPR64ExtSXTW64>;
5493 multiclass sve_int_bin_cons_misc_0_a_32_lsl<bits<2> opc, string asm> {
5494 def _0 : sve_int_bin_cons_misc_0_a<opc, 0b00, asm, ZPR32, ZPR32ExtLSL8>;
5495 def _1 : sve_int_bin_cons_misc_0_a<opc, 0b01, asm, ZPR32, ZPR32ExtLSL16>;
5496 def _2 : sve_int_bin_cons_misc_0_a<opc, 0b10, asm, ZPR32, ZPR32ExtLSL32>;
5497 def _3 : sve_int_bin_cons_misc_0_a<opc, 0b11, asm, ZPR32, ZPR32ExtLSL64>;
5500 multiclass sve_int_bin_cons_misc_0_a_64_lsl<bits<2> opc, string asm> {
5501 def _0 : sve_int_bin_cons_misc_0_a<opc, 0b00, asm, ZPR64, ZPR64ExtLSL8>;
5502 def _1 : sve_int_bin_cons_misc_0_a<opc, 0b01, asm, ZPR64, ZPR64ExtLSL16>;
5503 def _2 : sve_int_bin_cons_misc_0_a<opc, 0b10, asm, ZPR64, ZPR64ExtLSL32>;
5504 def _3 : sve_int_bin_cons_misc_0_a<opc, 0b11, asm, ZPR64, ZPR64ExtLSL64>;
5508 //===----------------------------------------------------------------------===//
5509 // SVE Integer Misc - Unpredicated Group
5510 //===----------------------------------------------------------------------===//
5512 class sve_int_bin_cons_misc_0_b<bits<2> sz, string asm, ZPRRegOp zprty>
5513 : I<(outs zprty:$Zd), (ins zprty:$Zn, zprty:$Zm),
5514 asm, "\t$Zd, $Zn, $Zm",
5520 let Inst{31-24} = 0b00000100;
5521 let Inst{23-22} = sz;
5523 let Inst{20-16} = Zm;
5524 let Inst{15-10} = 0b101100;
5529 multiclass sve_int_bin_cons_misc_0_b<string asm> {
5530 def _H : sve_int_bin_cons_misc_0_b<0b01, asm, ZPR16>;
5531 def _S : sve_int_bin_cons_misc_0_b<0b10, asm, ZPR32>;
5532 def _D : sve_int_bin_cons_misc_0_b<0b11, asm, ZPR64>;
5535 class sve_int_bin_cons_misc_0_c<bits<8> opc, string asm, ZPRRegOp zprty>
5536 : I<(outs zprty:$Zd), (ins zprty:$Zn),
5542 let Inst{31-24} = 0b00000100;
5543 let Inst{23-22} = opc{7-6};
5545 let Inst{20-16} = opc{5-1};
5546 let Inst{15-11} = 0b10111;
5547 let Inst{10} = opc{0};
5552 //===----------------------------------------------------------------------===//
5553 // SVE Integer Reduction Group
5554 //===----------------------------------------------------------------------===//
5556 class sve_int_reduce<bits<2> sz8_32, bits<2> fmt, bits<3> opc, string asm,
5557 ZPRRegOp zprty, RegisterClass regtype>
5558 : I<(outs regtype:$Vd), (ins PPR3bAny:$Pg, zprty:$Zn),
5559 asm, "\t$Vd, $Pg, $Zn",
5565 let Inst{31-24} = 0b00000100;
5566 let Inst{23-22} = sz8_32;
5568 let Inst{20-19} = fmt;
5569 let Inst{18-16} = opc;
5570 let Inst{15-13} = 0b001;
5571 let Inst{12-10} = Pg;
5576 multiclass sve_int_reduce_0_saddv<bits<3> opc, string asm> {
5577 def _B : sve_int_reduce<0b00, 0b00, opc, asm, ZPR8, FPR64>;
5578 def _H : sve_int_reduce<0b01, 0b00, opc, asm, ZPR16, FPR64>;
5579 def _S : sve_int_reduce<0b10, 0b00, opc, asm, ZPR32, FPR64>;
5582 multiclass sve_int_reduce_0_uaddv<bits<3> opc, string asm> {
5583 def _B : sve_int_reduce<0b00, 0b00, opc, asm, ZPR8, FPR64>;
5584 def _H : sve_int_reduce<0b01, 0b00, opc, asm, ZPR16, FPR64>;
5585 def _S : sve_int_reduce<0b10, 0b00, opc, asm, ZPR32, FPR64>;
5586 def _D : sve_int_reduce<0b11, 0b00, opc, asm, ZPR64, FPR64>;
5589 multiclass sve_int_reduce_1<bits<3> opc, string asm> {
5590 def _B : sve_int_reduce<0b00, 0b01, opc, asm, ZPR8, FPR8>;
5591 def _H : sve_int_reduce<0b01, 0b01, opc, asm, ZPR16, FPR16>;
5592 def _S : sve_int_reduce<0b10, 0b01, opc, asm, ZPR32, FPR32>;
5593 def _D : sve_int_reduce<0b11, 0b01, opc, asm, ZPR64, FPR64>;
5596 multiclass sve_int_reduce_2<bits<3> opc, string asm> {
5597 def _B : sve_int_reduce<0b00, 0b11, opc, asm, ZPR8, FPR8>;
5598 def _H : sve_int_reduce<0b01, 0b11, opc, asm, ZPR16, FPR16>;
5599 def _S : sve_int_reduce<0b10, 0b11, opc, asm, ZPR32, FPR32>;
5600 def _D : sve_int_reduce<0b11, 0b11, opc, asm, ZPR64, FPR64>;
5603 class sve_int_movprfx_pred<bits<2> sz8_32, bits<3> opc, string asm,
5604 ZPRRegOp zprty, string pg_suffix, dag iops>
5605 : I<(outs zprty:$Zd), iops,
5606 asm, "\t$Zd, $Pg"#pg_suffix#", $Zn",
5612 let Inst{31-24} = 0b00000100;
5613 let Inst{23-22} = sz8_32;
5614 let Inst{21-19} = 0b010;
5615 let Inst{18-16} = opc;
5616 let Inst{15-13} = 0b001;
5617 let Inst{12-10} = Pg;
5621 let ElementSize = zprty.ElementSize;
5624 multiclass sve_int_movprfx_pred_merge<bits<3> opc, string asm> {
5625 let Constraints = "$Zd = $_Zd" in {
5626 def _B : sve_int_movprfx_pred<0b00, opc, asm, ZPR8, "/m",
5627 (ins ZPR8:$_Zd, PPR3bAny:$Pg, ZPR8:$Zn)>;
5628 def _H : sve_int_movprfx_pred<0b01, opc, asm, ZPR16, "/m",
5629 (ins ZPR16:$_Zd, PPR3bAny:$Pg, ZPR16:$Zn)>;
5630 def _S : sve_int_movprfx_pred<0b10, opc, asm, ZPR32, "/m",
5631 (ins ZPR32:$_Zd, PPR3bAny:$Pg, ZPR32:$Zn)>;
5632 def _D : sve_int_movprfx_pred<0b11, opc, asm, ZPR64, "/m",
5633 (ins ZPR64:$_Zd, PPR3bAny:$Pg, ZPR64:$Zn)>;
5637 multiclass sve_int_movprfx_pred_zero<bits<3> opc, string asm> {
5638 def _B : sve_int_movprfx_pred<0b00, opc, asm, ZPR8, "/z",
5639 (ins PPR3bAny:$Pg, ZPR8:$Zn)>;
5640 def _H : sve_int_movprfx_pred<0b01, opc, asm, ZPR16, "/z",
5641 (ins PPR3bAny:$Pg, ZPR16:$Zn)>;
5642 def _S : sve_int_movprfx_pred<0b10, opc, asm, ZPR32, "/z",
5643 (ins PPR3bAny:$Pg, ZPR32:$Zn)>;
5644 def _D : sve_int_movprfx_pred<0b11, opc, asm, ZPR64, "/z",
5645 (ins PPR3bAny:$Pg, ZPR64:$Zn)>;
5648 //===----------------------------------------------------------------------===//
5649 // SVE Propagate Break Group
5650 //===----------------------------------------------------------------------===//
5652 class sve_int_brkp<bits<2> opc, string asm>
5653 : I<(outs PPR8:$Pd), (ins PPRAny:$Pg, PPR8:$Pn, PPR8:$Pm),
5654 asm, "\t$Pd, $Pg/z, $Pn, $Pm",
5661 let Inst{31-24} = 0b00100101;
5663 let Inst{22} = opc{1};
5664 let Inst{21-20} = 0b00;
5665 let Inst{19-16} = Pm;
5666 let Inst{15-14} = 0b11;
5667 let Inst{13-10} = Pg;
5670 let Inst{4} = opc{0};
5673 let Defs = !if(!eq (opc{1}, 1), [NZCV], []);
5677 //===----------------------------------------------------------------------===//
5678 // SVE Partition Break Group
5679 //===----------------------------------------------------------------------===//
5681 class sve_int_brkn<bit S, string asm>
5682 : I<(outs PPR8:$Pdm), (ins PPRAny:$Pg, PPR8:$Pn, PPR8:$_Pdm),
5683 asm, "\t$Pdm, $Pg/z, $Pn, $_Pdm",
5689 let Inst{31-23} = 0b001001010;
5691 let Inst{21-14} = 0b01100001;
5692 let Inst{13-10} = Pg;
5696 let Inst{3-0} = Pdm;
5698 let Constraints = "$Pdm = $_Pdm";
5699 let Defs = !if(!eq (S, 0b1), [NZCV], []);
5702 class sve_int_break<bits<3> opc, string asm, string suffix, dag iops>
5703 : I<(outs PPR8:$Pd), iops,
5704 asm, "\t$Pd, $Pg"#suffix#", $Pn",
5710 let Inst{31-24} = 0b00100101;
5711 let Inst{23-22} = opc{2-1};
5712 let Inst{21-14} = 0b01000001;
5713 let Inst{13-10} = Pg;
5716 let Inst{4} = opc{0};
5719 let Constraints = !if(!eq (opc{0}, 1), "$Pd = $_Pd", "");
5720 let Defs = !if(!eq (opc{1}, 1), [NZCV], []);
5724 multiclass sve_int_break_m<bits<3> opc, string asm> {
5725 def NAME : sve_int_break<opc, asm, "/m", (ins PPR8:$_Pd, PPRAny:$Pg, PPR8:$Pn)>;
5728 multiclass sve_int_break_z<bits<3> opc, string asm> {
5729 def NAME : sve_int_break<opc, asm, "/z", (ins PPRAny:$Pg, PPR8:$Pn)>;
5732 //===----------------------------------------------------------------------===//
5733 // SVE2 String Processing Group
5734 //===----------------------------------------------------------------------===//
5736 class sve2_char_match<bit sz, bit opc, string asm,
5737 PPRRegOp pprty, ZPRRegOp zprty>
5738 : I<(outs pprty:$Pd), (ins PPR3bAny:$Pg, zprty:$Zn, zprty:$Zm),
5739 asm, "\t$Pd, $Pg/z, $Zn, $Zm",
5746 let Inst{31-23} = 0b010001010;
5749 let Inst{20-16} = Zm;
5750 let Inst{15-13} = 0b100;
5751 let Inst{12-10} = Pg;
5759 multiclass sve2_char_match<bit opc, string asm> {
5760 def _B : sve2_char_match<0b0, opc, asm, PPR8, ZPR8>;
5761 def _H : sve2_char_match<0b1, opc, asm, PPR16, ZPR16>;
5764 //===----------------------------------------------------------------------===//
5765 // SVE2 Histogram Computation - Segment Group
5766 //===----------------------------------------------------------------------===//
5768 class sve2_hist_gen_segment<string asm>
5769 : I<(outs ZPR8:$Zd), (ins ZPR8:$Zn, ZPR8:$Zm),
5770 asm, "\t$Zd, $Zn, $Zm",
5776 let Inst{31-21} = 0b01000101001;
5777 let Inst{20-16} = Zm;
5778 let Inst{15-10} = 0b101000;
5783 //===----------------------------------------------------------------------===//
5784 // SVE2 Histogram Computation - Vector Group
5785 //===----------------------------------------------------------------------===//
5787 class sve2_hist_gen_vector<bit sz, string asm, ZPRRegOp zprty>
5788 : I<(outs zprty:$Zd), (ins PPR3bAny:$Pg, zprty:$Zn, zprty:$Zm),
5789 asm, "\t$Zd, $Pg/z, $Zn, $Zm",
5796 let Inst{31-23} = 0b010001011;
5799 let Inst{20-16} = Zm;
5800 let Inst{15-13} = 0b110;
5801 let Inst{12-10} = Pg;
5806 multiclass sve2_hist_gen_vector<string asm> {
5807 def _S : sve2_hist_gen_vector<0b0, asm, ZPR32>;
5808 def _D : sve2_hist_gen_vector<0b1, asm, ZPR64>;
5811 //===----------------------------------------------------------------------===//
5812 // SVE2 Crypto Extensions Group
5813 //===----------------------------------------------------------------------===//
5815 class sve2_crypto_cons_bin_op<bit opc, string asm, ZPRRegOp zprty>
5816 : I<(outs zprty:$Zd), (ins zprty:$Zn, zprty:$Zm),
5817 asm, "\t$Zd, $Zn, $Zm",
5823 let Inst{31-21} = 0b01000101001;
5824 let Inst{20-16} = Zm;
5825 let Inst{15-11} = 0b11110;
5831 class sve2_crypto_des_bin_op<bits<2> opc, string asm, ZPRRegOp zprty>
5832 : I<(outs zprty:$Zdn), (ins zprty:$_Zdn, zprty:$Zm),
5833 asm, "\t$Zdn, $_Zdn, $Zm",
5838 let Inst{31-17} = 0b010001010010001;
5839 let Inst{16} = opc{1};
5840 let Inst{15-11} = 0b11100;
5841 let Inst{10} = opc{0};
5843 let Inst{4-0} = Zdn;
5845 let Constraints = "$Zdn = $_Zdn";
5848 class sve2_crypto_unary_op<bit opc, string asm>
5849 : I<(outs ZPR8:$Zdn), (ins ZPR8:$_Zdn),
5850 asm, "\t$Zdn, $_Zdn",
5854 let Inst{31-11} = 0b010001010010000011100;
5856 let Inst{9-5} = 0b00000;
5857 let Inst{4-0} = Zdn;
5859 let Constraints = "$Zdn = $_Zdn";