1 //=-- SMEInstrFormats.td - AArch64 SME 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 Matrix Extension (SME) Instruction Class Definitions.
11 //===----------------------------------------------------------------------===//
13 //===----------------------------------------------------------------------===//
15 //===----------------------------------------------------------------------===//
17 class sme_fp_outer_product_inst<bit S, bit sz, MatrixTileOperand za_ty,
18 ZPRRegOp zpr_ty, string mnemonic>
19 : I<(outs za_ty:$ZAda),
20 (ins PPR3bAny:$Pn, PPR3bAny:$Pm, zpr_ty:$Zn, zpr_ty:$Zm),
21 mnemonic, "\t$ZAda, $Pn/m, $Pm/m, $Zn, $Zm",
28 let Inst{31-23} = 0b100000001;
39 class sme_outer_product_fp32<bit S, string mnemonic>
40 : sme_fp_outer_product_inst<S, 0b0, TileOp32, ZPR32, mnemonic> {
46 class sme_outer_product_fp64<bit S, string mnemonic>
47 : sme_fp_outer_product_inst<S, 0b1, TileOp64, ZPR64, mnemonic> {
52 class sme_int_outer_product_inst<bit u0, bit u1, bit S, bit sz,
53 MatrixTileOperand za_ty, ZPRRegOp zpr_ty,
55 : I<(outs za_ty:$ZAda),
56 (ins PPR3bAny:$Pn, PPR3bAny:$Pm, zpr_ty:$Zn, zpr_ty:$Zm),
57 mnemonic, "\t$ZAda, $Pn/m, $Pm/m, $Zn, $Zm",
64 let Inst{31-25} = 0b1010000;
77 class sme_int_outer_product_i32<bits<3> opc, string mnemonic>
78 : sme_int_outer_product_inst<opc{2}, opc{1}, opc{0}, 0b0, TileOp32, ZPR8,
85 class sme_int_outer_product_i64<bits<3> opc, string mnemonic>
86 : sme_int_outer_product_inst<opc{2}, opc{1}, opc{0}, 0b1, TileOp64, ZPR16,
92 class sme_outer_product_widening_inst<bit op, bit S, string mnemonic>
93 : I<(outs TileOp32:$ZAda),
94 (ins PPR3bAny:$Pn, PPR3bAny:$Pm, ZPR16:$Zn, ZPR16:$Zm),
95 mnemonic, "\t$ZAda, $Pn/m, $Pm/m, $Zn, $Zm",
103 let Inst{31-22} = 0b1000000110;
105 let Inst{20-16} = Zm;
106 let Inst{15-13} = Pm;
107 let Inst{12-10} = Pn;
110 let Inst{3-2} = 0b00;
111 let Inst{1-0} = ZAda;
114 multiclass sme_bf16_outer_product<bit S, string mnemonic> {
115 def : sme_outer_product_widening_inst<0b0, S, mnemonic>;
118 multiclass sme_f16_outer_product<bit S, string mnemonic> {
119 def : sme_outer_product_widening_inst<0b1, S, mnemonic>;
122 //===----------------------------------------------------------------------===//
123 // SME Add Vector to Tile
124 //===----------------------------------------------------------------------===//
126 class sme_add_vector_to_tile_inst<bit op, bit V, MatrixTileOperand tile_ty,
127 ZPRRegOp zpr_ty, string mnemonic>
128 : I<(outs tile_ty:$ZAda),
129 (ins PPR3bAny:$Pn, PPR3bAny:$Pm, zpr_ty:$Zn),
130 mnemonic, "\t$ZAda, $Pn/m, $Pm/m, $Zn",
135 let Inst{31-23} = 0b110000001;
137 let Inst{21-17} = 0b01000;
139 let Inst{15-13} = Pm;
140 let Inst{12-10} = Pn;
142 let Inst{4-3} = 0b00;
145 class sme_add_vector_to_tile_u32<bit V, string mnemonic>
146 : sme_add_vector_to_tile_inst<0b0, V, TileOp32, ZPR32, mnemonic> {
149 let Inst{1-0} = ZAda;
152 class sme_add_vector_to_tile_u64<bit V, string mnemonic>
153 : sme_add_vector_to_tile_inst<0b1, V, TileOp64, ZPR64, mnemonic> {
155 let Inst{2-0} = ZAda;
158 //===----------------------------------------------------------------------===//
159 // SME Contiguous Loads
160 //===----------------------------------------------------------------------===//
162 class sme_mem_ld_ss_base<bit Q, bit V, bits<2> msz, dag outs, dag ins,
163 string mnemonic, string argstr>
164 : I<outs, ins, mnemonic, argstr, "", []>, Sched<[]> {
169 let Inst{31-25} = 0b1110000;
171 let Inst{23-22} = msz;
173 let Inst{20-16} = Rm;
175 let Inst{14-13} = Rv;
176 let Inst{12-10} = Pg;
183 class sme_mem_ld_ss_inst<bit Q, bits<2> msz, string mnemonic,
184 MatrixTileVectorOperand tile_ty, bit is_col,
185 Operand imm_ty, RegisterOperand gpr_ty>
186 : sme_mem_ld_ss_base<
187 Q, is_col, msz, (outs tile_ty:$ZAt),
188 (ins MatrixIndexGPR32Op12_15:$Rv, imm_ty:$imm, PPR3bAny:$Pg, GPR64sp:$Rn,
190 mnemonic, "\t\\{$ZAt[$Rv, $imm]\\}, $Pg/z, [$Rn, $Rm]">;
192 multiclass sme_mem_ss_aliases_base<string mnemonic, Instruction inst,
193 MatrixTileVectorOperand tile_ty,
194 Operand imm_ty, RegisterOperand gpr_ty,
195 string pg_suffix=""> {
196 def : InstAlias<mnemonic # "\t$ZAt[$Rv, $imm], $Pg" # pg_suffix # ", [$Rn, $Rm]",
197 (inst tile_ty:$ZAt, MatrixIndexGPR32Op12_15:$Rv, imm_ty:$imm, PPR3bAny:$Pg, GPR64sp:$Rn, gpr_ty:$Rm), 0>;
198 // Default XZR offset aliases
199 def : InstAlias<mnemonic # "\t\\{$ZAt[$Rv, $imm]\\}, $Pg" # pg_suffix # ", [$Rn]",
200 (inst tile_ty:$ZAt, MatrixIndexGPR32Op12_15:$Rv, imm_ty:$imm, PPR3bAny:$Pg, GPR64sp:$Rn, XZR), 1>;
201 def : InstAlias<mnemonic # "\t$ZAt[$Rv, $imm], $Pg" # pg_suffix # ", [$Rn]",
202 (inst tile_ty:$ZAt, MatrixIndexGPR32Op12_15:$Rv, imm_ty:$imm, PPR3bAny:$Pg, GPR64sp:$Rn, XZR), 0>;
205 multiclass sme_mem_ss_aliases<string mnemonic, string inst, bit is_col,
206 string pg_suffix=""> {
207 defm : sme_mem_ss_aliases_base<mnemonic # "b", !cast<Instruction>(inst # _B),
208 !if(is_col, TileVectorOpV8, TileVectorOpH8),
209 sme_elm_idx0_15, GPR64shifted8, pg_suffix>;
210 defm : sme_mem_ss_aliases_base<mnemonic # "h", !cast<Instruction>(inst # _H),
211 !if(is_col, TileVectorOpV16, TileVectorOpH16),
212 sme_elm_idx0_7, GPR64shifted16, pg_suffix>;
213 defm : sme_mem_ss_aliases_base<mnemonic # "w", !cast<Instruction>(inst # _S),
214 !if(is_col, TileVectorOpV32, TileVectorOpH32),
215 sme_elm_idx0_3, GPR64shifted32, pg_suffix>;
216 defm : sme_mem_ss_aliases_base<mnemonic # "d", !cast<Instruction>(inst # _D),
217 !if(is_col, TileVectorOpV64, TileVectorOpH64),
218 sme_elm_idx0_1, GPR64shifted64, pg_suffix>;
219 defm : sme_mem_ss_aliases_base<mnemonic # "q", !cast<Instruction>(inst # _Q),
220 !if(is_col, TileVectorOpV128, TileVectorOpH128),
221 sme_elm_idx0_0, GPR64shifted128, pg_suffix>;
224 multiclass sme_mem_ld_ss_aliases<string inst, bit is_col> {
225 defm NAME : sme_mem_ss_aliases<"ld1", inst, is_col, "/z">;
228 multiclass sme_mem_ld_v_ss<string mnemonic, bit is_col> {
229 def _B : sme_mem_ld_ss_inst<0b0, 0b00, mnemonic # "b",
230 !if(is_col, TileVectorOpV8, TileVectorOpH8),
231 is_col, sme_elm_idx0_15, GPR64shifted8> {
235 def _H : sme_mem_ld_ss_inst<0b0, 0b01, mnemonic # "h",
236 !if(is_col, TileVectorOpV16, TileVectorOpH16),
237 is_col, sme_elm_idx0_7, GPR64shifted16> {
243 def _S : sme_mem_ld_ss_inst<0b0, 0b10, mnemonic # "w",
244 !if(is_col, TileVectorOpV32, TileVectorOpH32),
245 is_col, sme_elm_idx0_3, GPR64shifted32> {
251 def _D : sme_mem_ld_ss_inst<0b0, 0b11, mnemonic # "d",
252 !if(is_col, TileVectorOpV64, TileVectorOpH64),
253 is_col, sme_elm_idx0_1, GPR64shifted64> {
259 def _Q : sme_mem_ld_ss_inst<0b1, 0b11, mnemonic # "q",
260 !if(is_col, TileVectorOpV128, TileVectorOpH128),
261 is_col, sme_elm_idx0_0, GPR64shifted128> {
266 defm : sme_mem_ld_ss_aliases<NAME, is_col>;
269 multiclass sme_mem_ld_ss<string mnemonic> {
270 defm _H : sme_mem_ld_v_ss<mnemonic, /*is_col=*/0b0>;
271 defm _V : sme_mem_ld_v_ss<mnemonic, /*is_col=*/0b1>;
274 //===----------------------------------------------------------------------===//
275 // SME Contiguous Stores
276 //===----------------------------------------------------------------------===//
278 class sme_mem_st_ss_base<bit Q, bit V, bits<2> msz, dag ins,
279 string mnemonic, string argstr>
280 : I<(outs), ins, mnemonic, argstr, "", []>, Sched<[]> {
285 let Inst{31-25} = 0b1110000;
287 let Inst{23-22} = msz;
289 let Inst{20-16} = Rm;
291 let Inst{14-13} = Rv;
292 let Inst{12-10} = Pg;
297 let hasSideEffects = 1;
300 class sme_mem_st_ss_inst<bit Q, bits<2> msz, string mnemonic,
301 MatrixTileVectorOperand tile_ty, bit is_col,
302 Operand imm_ty, RegisterOperand gpr_ty>
303 : sme_mem_st_ss_base<
305 (ins tile_ty:$ZAt, MatrixIndexGPR32Op12_15:$Rv, imm_ty:$imm, PPR3bAny:$Pg,
306 GPR64sp:$Rn, gpr_ty:$Rm),
307 mnemonic, "\t\\{$ZAt[$Rv, $imm]\\}, $Pg, [$Rn, $Rm]">;
309 multiclass sme_mem_st_ss_aliases<string inst, bit is_col> {
310 defm NAME : sme_mem_ss_aliases<"st1", inst, is_col>;
313 multiclass sme_mem_st_v_ss<string mnemonic, bit is_col> {
314 def _B : sme_mem_st_ss_inst<0b0, 0b00, mnemonic # "b",
315 !if(is_col, TileVectorOpV8, TileVectorOpH8),
316 is_col, sme_elm_idx0_15, GPR64shifted8> {
320 def _H : sme_mem_st_ss_inst<0b0, 0b01, mnemonic # "h",
321 !if(is_col, TileVectorOpV16, TileVectorOpH16),
322 is_col, sme_elm_idx0_7, GPR64shifted16> {
328 def _S : sme_mem_st_ss_inst<0b0, 0b10, mnemonic # "w",
329 !if(is_col, TileVectorOpV32, TileVectorOpH32),
330 is_col, sme_elm_idx0_3, GPR64shifted32> {
336 def _D : sme_mem_st_ss_inst<0b0, 0b11, mnemonic # "d",
337 !if(is_col, TileVectorOpV64, TileVectorOpH64),
338 is_col, sme_elm_idx0_1, GPR64shifted64> {
344 def _Q : sme_mem_st_ss_inst<0b1, 0b11, mnemonic # "q",
345 !if(is_col, TileVectorOpV128, TileVectorOpH128),
346 is_col, sme_elm_idx0_0, GPR64shifted128> {
351 defm : sme_mem_st_ss_aliases<NAME, is_col>;
354 multiclass sme_mem_st_ss<string mnemonic> {
355 defm _H : sme_mem_st_v_ss<mnemonic, /*is_col=*/0b0>;
356 defm _V : sme_mem_st_v_ss<mnemonic, /*is_col=*/0b1>;
359 //===----------------------------------------------------------------------===//
360 // SME Save and Restore Array
361 //===----------------------------------------------------------------------===//
363 class sme_spill_fill_inst<bit isStore, dag outs, dag ins, string opcodestr>
364 : I<outs, ins, opcodestr, "\t$ZAt[$Rv, $imm4], [$Rn, $offset, mul vl]", "",
370 let Inst{31-22} = 0b1110000100;
371 let Inst{21} = isStore;
372 let Inst{20-15} = 0b000000;
373 let Inst{14-13} = Rv;
374 let Inst{12-10} = 0b000;
377 let Inst{3-0} = imm4;
379 let mayLoad = !not(isStore);
380 let mayStore = isStore;
383 multiclass sme_spill_fill<bit isStore, dag outs, dag ins, string opcodestr> {
384 def NAME : sme_spill_fill_inst<isStore, outs, ins, opcodestr>;
386 def : InstAlias<opcodestr # "\t$ZAt[$Rv, $imm4], [$Rn]",
387 (!cast<Instruction>(NAME) MatrixOp:$ZAt,
388 MatrixIndexGPR32Op12_15:$Rv, sme_elm_idx0_15:$imm4, GPR64sp:$Rn, 0), 1>;
391 multiclass sme_spill<string opcodestr> {
392 defm NAME : sme_spill_fill<0b1, (outs),
393 (ins MatrixOp:$ZAt, MatrixIndexGPR32Op12_15:$Rv,
394 sme_elm_idx0_15:$imm4, GPR64sp:$Rn,
399 multiclass sme_fill<string opcodestr> {
400 defm NAME : sme_spill_fill<0b0, (outs MatrixOp:$ZAt),
401 (ins MatrixIndexGPR32Op12_15:$Rv,
402 sme_elm_idx0_15:$imm4, GPR64sp:$Rn,
407 //===----------------------------------------------------------------------===//
409 //===----------------------------------------------------------------------===//
411 class sme_vector_to_tile_base<bit Q, bit V, bits<2> sz, dag outs, dag ins,
412 string mnemonic, string argstr>
413 : I<outs, ins, mnemonic, argstr, "", []>, Sched<[]> {
417 let Inst{31-24} = 0b11000000;
418 let Inst{23-22} = sz;
419 let Inst{21-17} = 0b00000;
422 let Inst{14-13} = Rv;
423 let Inst{12-10} = Pg;
428 class sme_vector_to_tile_inst<bit Q, bits<2> sz, MatrixTileVectorOperand tile_ty,
429 bit is_col, Operand imm_ty, ZPRRegOp zpr_ty,
431 : sme_vector_to_tile_base<Q, is_col, sz, (outs tile_ty:$ZAd),
432 (ins MatrixIndexGPR32Op12_15:$Rv, imm_ty:$imm, PPR3bAny:$Pg, zpr_ty:$Zn),
433 mnemonic, "\t$ZAd[$Rv, $imm], $Pg/m, $Zn">;
435 multiclass sme_vector_to_tile_aliases<Instruction inst,
436 MatrixTileVectorOperand tile_ty,
437 ZPRRegOp zpr_ty, Operand imm_ty> {
438 def : InstAlias<"mov\t$ZAd[$Rv, $imm], $Pg/m, $Zn",
439 (inst tile_ty:$ZAd, MatrixIndexGPR32Op12_15:$Rv, imm_ty:$imm, PPR3bAny:$Pg, zpr_ty:$Zn), 1>;
442 multiclass sme_vector_v_to_tile<string mnemonic, bit is_col> {
443 def _B : sme_vector_to_tile_inst<0b0, 0b00, !if(is_col, TileVectorOpV8,
445 is_col, sme_elm_idx0_15, ZPR8, mnemonic> {
449 def _H : sme_vector_to_tile_inst<0b0, 0b01, !if(is_col, TileVectorOpV16,
451 is_col, sme_elm_idx0_7, ZPR16, mnemonic> {
457 def _S : sme_vector_to_tile_inst<0b0, 0b10, !if(is_col, TileVectorOpV32,
459 is_col, sme_elm_idx0_3, ZPR32, mnemonic> {
465 def _D : sme_vector_to_tile_inst<0b0, 0b11, !if(is_col, TileVectorOpV64,
467 is_col, sme_elm_idx0_1, ZPR64, mnemonic> {
473 def _Q : sme_vector_to_tile_inst<0b1, 0b11, !if(is_col, TileVectorOpV128,
475 is_col, sme_elm_idx0_0, ZPR128, mnemonic> {
481 defm : sme_vector_to_tile_aliases<!cast<Instruction>(NAME # _B),
482 !if(is_col, TileVectorOpV8,
484 ZPR8, sme_elm_idx0_15>;
485 defm : sme_vector_to_tile_aliases<!cast<Instruction>(NAME # _H),
486 !if(is_col, TileVectorOpV16,
488 ZPR16, sme_elm_idx0_7>;
489 defm : sme_vector_to_tile_aliases<!cast<Instruction>(NAME # _S),
490 !if(is_col, TileVectorOpV32,
492 ZPR32, sme_elm_idx0_3>;
493 defm : sme_vector_to_tile_aliases<!cast<Instruction>(NAME # _D),
494 !if(is_col, TileVectorOpV64,
496 ZPR64, sme_elm_idx0_1>;
497 defm : sme_vector_to_tile_aliases<!cast<Instruction>(NAME # _Q),
498 !if(is_col, TileVectorOpV128,
500 ZPR128, sme_elm_idx0_0>;
503 multiclass sme_vector_to_tile<string mnemonic> {
504 defm _H : sme_vector_v_to_tile<mnemonic, /*is_col=*/0b0>;
505 defm _V : sme_vector_v_to_tile<mnemonic, /*is_col=*/0b1>;
508 class sme_tile_to_vector_base<bit Q, bit V, bits<2> sz, dag outs, dag ins,
509 string mnemonic, string argstr>
510 : I<outs, ins, mnemonic, argstr, "", []>, Sched<[]> {
514 let Inst{31-24} = 0b11000000;
515 let Inst{23-22} = sz;
516 let Inst{21-17} = 0b00001;
519 let Inst{14-13} = Rv;
520 let Inst{12-10} = Pg;
525 class sme_tile_to_vector_inst<bit Q, bits<2> sz, ZPRRegOp zpr_ty,
526 MatrixTileVectorOperand tile_ty,
527 bit is_col, Operand imm_ty, string mnemonic>
528 : sme_tile_to_vector_base<Q, is_col, sz, (outs zpr_ty:$Zd),
529 (ins PPR3bAny:$Pg, tile_ty:$ZAn, MatrixIndexGPR32Op12_15:$Rv, imm_ty:$imm),
530 mnemonic, "\t$Zd, $Pg/m, $ZAn[$Rv, $imm]">;
532 multiclass sme_tile_to_vector_aliases<Instruction inst, ZPRRegOp zpr_ty,
533 MatrixTileVectorOperand tile_ty,
535 def : InstAlias<"mov\t$Zd, $Pg/m, $ZAn[$Rv, $imm]",
536 (inst zpr_ty:$Zd, PPR3bAny:$Pg, tile_ty:$ZAn, MatrixIndexGPR32Op12_15:$Rv, imm_ty:$imm), 1>;
539 multiclass sme_tile_to_vector_v<string mnemonic, bit is_col> {
540 def _B : sme_tile_to_vector_inst<0b0, 0b00, ZPR8, !if(is_col, TileVectorOpV8,
542 is_col, sme_elm_idx0_15, mnemonic> {
546 def _H : sme_tile_to_vector_inst<0b0, 0b01, ZPR16, !if(is_col, TileVectorOpV16,
548 is_col, sme_elm_idx0_7, mnemonic> {
554 def _S : sme_tile_to_vector_inst<0b0, 0b10, ZPR32, !if(is_col, TileVectorOpV32,
556 is_col, sme_elm_idx0_3, mnemonic> {
562 def _D : sme_tile_to_vector_inst<0b0, 0b11, ZPR64, !if(is_col, TileVectorOpV64,
564 is_col, sme_elm_idx0_1, mnemonic> {
570 def _Q : sme_tile_to_vector_inst<0b1, 0b11, ZPR128, !if(is_col, TileVectorOpV128,
572 is_col, sme_elm_idx0_0, mnemonic> {
577 defm : sme_tile_to_vector_aliases<!cast<Instruction>(NAME # _B), ZPR8,
578 !if(is_col, TileVectorOpV8,
579 TileVectorOpH8), sme_elm_idx0_15>;
580 defm : sme_tile_to_vector_aliases<!cast<Instruction>(NAME # _H), ZPR16,
581 !if(is_col, TileVectorOpV16,
582 TileVectorOpH16), sme_elm_idx0_7>;
583 defm : sme_tile_to_vector_aliases<!cast<Instruction>(NAME # _S), ZPR32,
584 !if(is_col, TileVectorOpV32,
585 TileVectorOpH32), sme_elm_idx0_3>;
586 defm : sme_tile_to_vector_aliases<!cast<Instruction>(NAME # _D), ZPR64,
587 !if(is_col, TileVectorOpV64,
588 TileVectorOpH64), sme_elm_idx0_1>;
589 defm : sme_tile_to_vector_aliases<!cast<Instruction>(NAME # _Q), ZPR128,
590 !if(is_col, TileVectorOpV128,
591 TileVectorOpH128), sme_elm_idx0_0>;
594 multiclass sme_tile_to_vector<string mnemonic> {
595 defm _H : sme_tile_to_vector_v<mnemonic, /*is_col=*/0b0>;
596 defm _V : sme_tile_to_vector_v<mnemonic, /*is_col=*/0b1>;
599 //===----------------------------------------------------------------------===//
601 //===----------------------------------------------------------------------===//
603 class sme_zero_inst<string mnemonic>
604 : I<(outs MatrixTileList:$imm), (ins),
605 mnemonic, "\t$imm", "", []>, Sched<[]> {
607 let Inst{31-8} = 0b110000000000100000000000;
611 multiclass sme_zero<string mnemonic> {
612 def NAME : sme_zero_inst<mnemonic>;
614 def : InstAlias<"zero\t\\{za\\}", (!cast<Instruction>(NAME) 0b11111111), 1>;
615 def : InstAlias<"zero\t\\{za0.h\\}", (!cast<Instruction>(NAME) 0b01010101), 1>;
616 def : InstAlias<"zero\t\\{za1.h\\}", (!cast<Instruction>(NAME) 0b10101010), 1>;
617 def : InstAlias<"zero\t\\{za0.s\\}", (!cast<Instruction>(NAME) 0b00010001), 1>;
618 def : InstAlias<"zero\t\\{za1.s\\}", (!cast<Instruction>(NAME) 0b00100010), 1>;
619 def : InstAlias<"zero\t\\{za2.s\\}", (!cast<Instruction>(NAME) 0b01000100), 1>;
620 def : InstAlias<"zero\t\\{za3.s\\}", (!cast<Instruction>(NAME) 0b10001000), 1>;
621 def : InstAlias<"zero\t\\{za0.s,za1.s\\}", (!cast<Instruction>(NAME) 0b00110011), 1>;
622 def : InstAlias<"zero\t\\{za0.s,za3.s\\}", (!cast<Instruction>(NAME) 0b10011001), 1>;
623 def : InstAlias<"zero\t\\{za1.s,za2.s\\}", (!cast<Instruction>(NAME) 0b01100110), 1>;
624 def : InstAlias<"zero\t\\{za2.s,za3.s\\}", (!cast<Instruction>(NAME) 0b11001100), 1>;
625 def : InstAlias<"zero\t\\{za0.s,za1.s,za2.s\\}", (!cast<Instruction>(NAME) 0b01110111), 1>;
626 def : InstAlias<"zero\t\\{za0.s,za1.s,za3.s\\}", (!cast<Instruction>(NAME) 0b10111011), 1>;
627 def : InstAlias<"zero\t\\{za0.s,za2.s,za3.s\\}", (!cast<Instruction>(NAME) 0b11011101), 1>;
628 def : InstAlias<"zero\t\\{za1.s,za2.s,za3.s\\}", (!cast<Instruction>(NAME) 0b11101110), 1>;
631 //===----------------------------------------------------------------------===//
633 //===----------------------------------------------------------------------===//
635 class sve2_int_perm_revd<string asm>
636 : I<(outs ZPR128:$Zd), (ins ZPR128:$_Zd, PPR3bAny:$Pg, ZPR128:$Zn),
637 asm, "\t$Zd, $Pg/m, $Zn", "", []>,
642 let Inst{31-24} = 0b00000101;
643 let Inst{23-22} = 0b00; // size
644 let Inst{21-13} = 0b101110100;
645 let Inst{12-10} = Pg;
649 let Constraints = "$Zd = $_Zd";
650 let DestructiveInstType = DestructiveUnary;
651 let ElementSize = ZPR128.ElementSize;
654 class sve2_clamp<string asm, bits<2> sz, bit U, ZPRRegOp zpr_ty>
655 : I<(outs zpr_ty:$Zd), (ins zpr_ty:$Zn, zpr_ty:$Zm, zpr_ty:$_Zd),
656 asm, "\t$Zd, $Zn, $Zm", "", []>,
661 let Inst{31-24} = 0b01000100;
662 let Inst{23-22} = sz;
664 let Inst{20-16} = Zm;
665 let Inst{15-11} = 0b11000;
670 let Constraints = "$Zd = $_Zd";
671 let DestructiveInstType = DestructiveOther;
672 let ElementSize = zpr_ty.ElementSize;
675 multiclass sve2_clamp<string asm, bit U> {
676 def _B : sve2_clamp<asm, 0b00, U, ZPR8>;
677 def _H : sve2_clamp<asm, 0b01, U, ZPR16>;
678 def _S : sve2_clamp<asm, 0b10, U, ZPR32>;
679 def _D : sve2_clamp<asm, 0b11, U, ZPR64>;
682 class sve2_int_perm_sel_p<string asm, PPRRegOp ppr_ty, Operand imm_ty>
683 : I<(outs PPRAny:$Pd), (ins PPRAny:$Pn, ppr_ty:$Pm,
684 MatrixIndexGPR32Op12_15:$Rv, imm_ty:$imm),
685 asm, "\t$Pd, $Pn, $Pm[$Rv, $imm]", "", []>,
691 let Inst{31-24} = 0b00100101;
693 let Inst{17-16} = Rv;
694 let Inst{15-14} = 0b01;
695 let Inst{13-10} = Pn;
702 multiclass sve2_int_perm_sel_p<string asm> {
703 def _B : sve2_int_perm_sel_p<asm, PPR8, sme_elm_idx0_15> {
705 let Inst{23-22} = imm{3-2};
706 let Inst{20-19} = imm{1-0};
709 def _H : sve2_int_perm_sel_p<asm, PPR16, sme_elm_idx0_7> {
711 let Inst{23-22} = imm{2-1};
712 let Inst{20} = imm{0};
713 let Inst{19-18} = 0b10;
715 def _S : sve2_int_perm_sel_p<asm, PPR32, sme_elm_idx0_3> {
717 let Inst{23-22} = imm{1-0};
718 let Inst{20-18} = 0b100;
720 def _D : sve2_int_perm_sel_p<asm, PPR64, sme_elm_idx0_1> {
724 let Inst{20-18} = 0b000;