1 //===-- ARMInstrMVE.td - MVE support for ARM ---------------*- 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 // This file describes the ARM MVE instruction set.
11 //===----------------------------------------------------------------------===//
13 class ExpandImmAsmOp<string shift> : AsmOperandClass {
14 let Name = !strconcat("ExpandImm", shift);
15 let PredicateMethod = !strconcat("isExpImm<", shift, ">");
16 let RenderMethod = "addImmOperands";
18 class InvertedExpandImmAsmOp<string shift, string size> : AsmOperandClass {
19 let Name = !strconcat("InvertedExpandImm", shift, "_", size);
20 let PredicateMethod = !strconcat("isInvertedExpImm<", shift, ",", size, ">");
21 let RenderMethod = "addImmOperands";
24 class ExpandImm<string shift> : Operand<i32> {
25 let ParserMatchClass = ExpandImmAsmOp<shift>;
26 let EncoderMethod = !strconcat("getExpandedImmOpValue<",shift,",false>");
27 let DecoderMethod = !strconcat("DecodeExpandedImmOperand<",shift,">");
28 let PrintMethod = "printExpandedImmOperand";
30 class InvertedExpandImm<string shift, string size> : Operand<i32> {
31 let ParserMatchClass = InvertedExpandImmAsmOp<shift, size>;
32 let EncoderMethod = !strconcat("getExpandedImmOpValue<",shift,",true>");
33 let PrintMethod = "printExpandedImmOperand";
34 // No decoder method needed, because this operand type is only used
35 // by aliases (VAND and VORN)
38 def expzero00 : ExpandImm<"0">;
39 def expzero08 : ExpandImm<"8">;
40 def expzero16 : ExpandImm<"16">;
41 def expzero24 : ExpandImm<"24">;
43 def expzero00inv16 : InvertedExpandImm<"0", "16">;
44 def expzero08inv16 : InvertedExpandImm<"8", "16">;
46 def expzero00inv32 : InvertedExpandImm<"0", "32">;
47 def expzero08inv32 : InvertedExpandImm<"8", "32">;
48 def expzero16inv32 : InvertedExpandImm<"16", "32">;
49 def expzero24inv32 : InvertedExpandImm<"24", "32">;
52 def vpt_mask : Operand<i32> {
53 let PrintMethod = "printVPTMask";
54 let ParserMatchClass = it_mask_asmoperand;
55 let EncoderMethod = "getVPTMaskOpValue";
56 let DecoderMethod = "DecodeVPTMaskOperand";
59 // VPT/VCMP restricted predicate for sign invariant types
60 def pred_restricted_i_asmoperand : AsmOperandClass {
61 let Name = "CondCodeRestrictedI";
62 let RenderMethod = "addITCondCodeOperands";
63 let PredicateMethod = "isITCondCodeRestrictedI";
64 let ParserMethod = "parseITCondCode";
65 let DiagnosticString = "condition code for sign-independent integer "#
66 "comparison must be EQ or NE";
69 // VPT/VCMP restricted predicate for signed types
70 def pred_restricted_s_asmoperand : AsmOperandClass {
71 let Name = "CondCodeRestrictedS";
72 let RenderMethod = "addITCondCodeOperands";
73 let PredicateMethod = "isITCondCodeRestrictedS";
74 let ParserMethod = "parseITCondCode";
75 let DiagnosticString = "condition code for signed integer "#
76 "comparison must be EQ, NE, LT, GT, LE or GE";
79 // VPT/VCMP restricted predicate for unsigned types
80 def pred_restricted_u_asmoperand : AsmOperandClass {
81 let Name = "CondCodeRestrictedU";
82 let RenderMethod = "addITCondCodeOperands";
83 let PredicateMethod = "isITCondCodeRestrictedU";
84 let ParserMethod = "parseITCondCode";
85 let DiagnosticString = "condition code for unsigned integer "#
86 "comparison must be EQ, NE, HS or HI";
89 // VPT/VCMP restricted predicate for floating point
90 def pred_restricted_fp_asmoperand : AsmOperandClass {
91 let Name = "CondCodeRestrictedFP";
92 let RenderMethod = "addITCondCodeOperands";
93 let PredicateMethod = "isITCondCodeRestrictedFP";
94 let ParserMethod = "parseITCondCode";
95 let DiagnosticString = "condition code for floating-point "#
96 "comparison must be EQ, NE, LT, GT, LE or GE";
99 class VCMPPredicateOperand : Operand<i32>;
101 def pred_basic_i : VCMPPredicateOperand {
102 let PrintMethod = "printMandatoryRestrictedPredicateOperand";
103 let ParserMatchClass = pred_restricted_i_asmoperand;
104 let DecoderMethod = "DecodeRestrictedIPredicateOperand";
105 let EncoderMethod = "getRestrictedCondCodeOpValue";
108 def pred_basic_u : VCMPPredicateOperand {
109 let PrintMethod = "printMandatoryRestrictedPredicateOperand";
110 let ParserMatchClass = pred_restricted_u_asmoperand;
111 let DecoderMethod = "DecodeRestrictedUPredicateOperand";
112 let EncoderMethod = "getRestrictedCondCodeOpValue";
115 def pred_basic_s : VCMPPredicateOperand {
116 let PrintMethod = "printMandatoryRestrictedPredicateOperand";
117 let ParserMatchClass = pred_restricted_s_asmoperand;
118 let DecoderMethod = "DecodeRestrictedSPredicateOperand";
119 let EncoderMethod = "getRestrictedCondCodeOpValue";
122 def pred_basic_fp : VCMPPredicateOperand {
123 let PrintMethod = "printMandatoryRestrictedPredicateOperand";
124 let ParserMatchClass = pred_restricted_fp_asmoperand;
125 let DecoderMethod = "DecodeRestrictedFPPredicateOperand";
126 let EncoderMethod = "getRestrictedCondCodeOpValue";
129 // Register list operands for interleaving load/stores
130 def VecList2QAsmOperand : AsmOperandClass {
131 let Name = "VecListTwoMQ";
132 let ParserMethod = "parseVectorList";
133 let RenderMethod = "addMVEVecListOperands";
134 let DiagnosticString = "operand must be a list of two consecutive "#
135 "q-registers in range [q0,q7]";
138 def VecList2Q : RegisterOperand<QQPR, "printMVEVectorListTwoQ"> {
139 let ParserMatchClass = VecList2QAsmOperand;
140 let PrintMethod = "printMVEVectorList<2>";
143 def VecList4QAsmOperand : AsmOperandClass {
144 let Name = "VecListFourMQ";
145 let ParserMethod = "parseVectorList";
146 let RenderMethod = "addMVEVecListOperands";
147 let DiagnosticString = "operand must be a list of four consecutive "#
148 "q-registers in range [q0,q7]";
151 def VecList4Q : RegisterOperand<QQQQPR, "printMVEVectorListFourQ"> {
152 let ParserMatchClass = VecList4QAsmOperand;
153 let PrintMethod = "printMVEVectorList<4>";
156 // taddrmode_imm7 := reg[r0-r7] +/- (imm7 << shift)
157 class TMemImm7ShiftOffsetAsmOperand<int shift> : AsmOperandClass {
158 let Name = "TMemImm7Shift"#shift#"Offset";
159 let PredicateMethod = "isMemImm7ShiftedOffset<"#shift#",ARM::tGPRRegClassID>";
160 let RenderMethod = "addMemImmOffsetOperands";
163 class taddrmode_imm7<int shift> : MemOperand {
164 let ParserMatchClass = TMemImm7ShiftOffsetAsmOperand<shift>;
165 // They are printed the same way as the T2 imm8 version
166 let PrintMethod = "printT2AddrModeImm8Operand<false>";
167 // This can also be the same as the T2 version.
168 let EncoderMethod = "getT2AddrModeImmOpValue<7,"#shift#">";
169 let DecoderMethod = "DecodeTAddrModeImm7<"#shift#">";
170 let MIOperandInfo = (ops tGPR:$base, i32imm:$offsimm);
173 // t2addrmode_imm7 := reg +/- (imm7)
174 class MemImm7ShiftOffsetAsmOperand<int shift> : AsmOperandClass {
175 let Name = "MemImm7Shift"#shift#"Offset";
176 let PredicateMethod = "isMemImm7ShiftedOffset<" # shift #
177 ",ARM::GPRnopcRegClassID>";
178 let RenderMethod = "addMemImmOffsetOperands";
181 def MemImm7Shift0OffsetAsmOperand : MemImm7ShiftOffsetAsmOperand<0>;
182 def MemImm7Shift1OffsetAsmOperand : MemImm7ShiftOffsetAsmOperand<1>;
183 def MemImm7Shift2OffsetAsmOperand : MemImm7ShiftOffsetAsmOperand<2>;
184 class T2AddrMode_Imm7<int shift> : MemOperand,
185 ComplexPattern<i32, 2, "SelectT2AddrModeImm7<"#shift#">", []> {
186 let EncoderMethod = "getT2AddrModeImmOpValue<7,"#shift#">";
187 let DecoderMethod = "DecodeT2AddrModeImm7<"#shift#", 0>";
188 let ParserMatchClass =
189 !cast<AsmOperandClass>("MemImm7Shift"#shift#"OffsetAsmOperand");
190 let MIOperandInfo = (ops GPRnopc:$base, i32imm:$offsimm);
193 class t2addrmode_imm7<int shift> : T2AddrMode_Imm7<shift> {
194 // They are printed the same way as the imm8 version
195 let PrintMethod = "printT2AddrModeImm8Operand<false>";
198 class MemImm7ShiftOffsetWBAsmOperand<int shift> : AsmOperandClass {
199 let Name = "MemImm7Shift"#shift#"OffsetWB";
200 let PredicateMethod = "isMemImm7ShiftedOffset<" # shift #
201 ",ARM::rGPRRegClassID>";
202 let RenderMethod = "addMemImmOffsetOperands";
205 def MemImm7Shift0OffsetWBAsmOperand : MemImm7ShiftOffsetWBAsmOperand<0>;
206 def MemImm7Shift1OffsetWBAsmOperand : MemImm7ShiftOffsetWBAsmOperand<1>;
207 def MemImm7Shift2OffsetWBAsmOperand : MemImm7ShiftOffsetWBAsmOperand<2>;
209 class t2addrmode_imm7_pre<int shift> : T2AddrMode_Imm7<shift> {
210 // They are printed the same way as the imm8 version
211 let PrintMethod = "printT2AddrModeImm8Operand<true>";
212 let ParserMatchClass =
213 !cast<AsmOperandClass>("MemImm7Shift"#shift#"OffsetWBAsmOperand");
214 let DecoderMethod = "DecodeT2AddrModeImm7<"#shift#", 1>";
215 let MIOperandInfo = (ops rGPR:$base, i32imm:$offsim);
218 class t2am_imm7shiftOffsetAsmOperand<int shift>
219 : AsmOperandClass { let Name = "Imm7Shift"#shift; }
220 def t2am_imm7shift0OffsetAsmOperand : t2am_imm7shiftOffsetAsmOperand<0>;
221 def t2am_imm7shift1OffsetAsmOperand : t2am_imm7shiftOffsetAsmOperand<1>;
222 def t2am_imm7shift2OffsetAsmOperand : t2am_imm7shiftOffsetAsmOperand<2>;
224 class t2am_imm7_offset<int shift> : MemOperand,
225 ComplexPattern<i32, 1, "SelectT2AddrModeImm7Offset<"#shift#">",
226 [], [SDNPWantRoot]> {
227 // They are printed the same way as the imm8 version
228 let PrintMethod = "printT2AddrModeImm8OffsetOperand";
229 let ParserMatchClass =
230 !cast<AsmOperandClass>("t2am_imm7shift"#shift#"OffsetAsmOperand");
231 let EncoderMethod = "getT2ScaledImmOpValue<7,"#shift#">";
232 let DecoderMethod = "DecodeT2Imm7<"#shift#">";
235 // Operands for gather/scatter loads of the form [Rbase, Qoffsets]
236 class MemRegRQOffsetAsmOperand<int shift> : AsmOperandClass {
237 let Name = "MemRegRQS"#shift#"Offset";
238 let PredicateMethod = "isMemRegRQOffset<"#shift#">";
239 let RenderMethod = "addMemRegRQOffsetOperands";
242 def MemRegRQS0OffsetAsmOperand : MemRegRQOffsetAsmOperand<0>;
243 def MemRegRQS1OffsetAsmOperand : MemRegRQOffsetAsmOperand<1>;
244 def MemRegRQS2OffsetAsmOperand : MemRegRQOffsetAsmOperand<2>;
245 def MemRegRQS3OffsetAsmOperand : MemRegRQOffsetAsmOperand<3>;
247 // mve_addr_rq_shift := reg + vreg{ << UXTW #shift}
248 class mve_addr_rq_shift<int shift> : MemOperand {
249 let EncoderMethod = "getMveAddrModeRQOpValue";
250 let PrintMethod = "printMveAddrModeRQOperand<"#shift#">";
251 let ParserMatchClass =
252 !cast<AsmOperandClass>("MemRegRQS"#shift#"OffsetAsmOperand");
253 let DecoderMethod = "DecodeMveAddrModeRQ";
254 let MIOperandInfo = (ops GPRnopc:$base, MQPR:$offsreg);
257 class MemRegQOffsetAsmOperand<int shift> : AsmOperandClass {
258 let Name = "MemRegQS"#shift#"Offset";
259 let PredicateMethod = "isMemRegQOffset<"#shift#">";
260 let RenderMethod = "addMemImmOffsetOperands";
263 def MemRegQS2OffsetAsmOperand : MemRegQOffsetAsmOperand<2>;
264 def MemRegQS3OffsetAsmOperand : MemRegQOffsetAsmOperand<3>;
266 // mve_addr_q_shift := vreg {+ #imm7s2/4}
267 class mve_addr_q_shift<int shift> : MemOperand {
268 let EncoderMethod = "getMveAddrModeQOpValue<"#shift#">";
269 // Can be printed same way as other reg + imm operands
270 let PrintMethod = "printT2AddrModeImm8Operand<false>";
271 let ParserMatchClass =
272 !cast<AsmOperandClass>("MemRegQS"#shift#"OffsetAsmOperand");
273 let DecoderMethod = "DecodeMveAddrModeQ<"#shift#">";
274 let MIOperandInfo = (ops MQPR:$base, i32imm:$imm);
277 // --------- Start of base classes for the instructions themselves
279 class MVE_MI<dag oops, dag iops, InstrItinClass itin, string asm,
280 string ops, string cstr, list<dag> pattern>
281 : Thumb2XI<oops, iops, AddrModeNone, 4, itin, !strconcat(asm, "\t", ops), cstr,
283 Requires<[HasMVEInt]> {
285 let DecoderNamespace = "MVE";
288 // MVE_p is used for most predicated instructions, to add the cluster
289 // of input operands that provides the VPT suffix (none, T or E) and
290 // the input predicate register.
291 class MVE_p<dag oops, dag iops, InstrItinClass itin, string iname,
292 string suffix, string ops, vpred_ops vpred, string cstr,
293 list<dag> pattern=[]>
294 : MVE_MI<oops, !con(iops, (ins vpred:$vp)), itin,
295 // If the instruction has a suffix, like vadd.f32, then the
296 // VPT predication suffix goes before the dot, so the full
297 // name has to be "vadd${vp}.f32".
298 !strconcat(iname, "${vp}",
299 !if(!eq(suffix, ""), "", !strconcat(".", suffix))),
300 ops, !strconcat(cstr, vpred.vpred_constraint), pattern> {
301 let Inst{31-29} = 0b111;
302 let Inst{27-26} = 0b11;
305 class MVE_f<dag oops, dag iops, InstrItinClass itin, string iname,
306 string suffix, string ops, vpred_ops vpred, string cstr,
307 list<dag> pattern=[]>
308 : MVE_p<oops, iops, itin, iname, suffix, ops, vpred, cstr, pattern> {
309 let Predicates = [HasMVEFloat];
312 class MVE_MI_with_pred<dag oops, dag iops, InstrItinClass itin, string asm,
313 string ops, string cstr, list<dag> pattern>
314 : Thumb2I<oops, iops, AddrModeNone, 4, itin, asm, !strconcat("\t", ops), cstr,
316 Requires<[HasV8_1MMainline, HasMVEInt]> {
318 let DecoderNamespace = "MVE";
321 class MVE_VMOV_lane_base<dag oops, dag iops, InstrItinClass itin, string asm,
322 string suffix, string ops, string cstr,
324 : Thumb2I<oops, iops, AddrModeNone, 4, itin, asm,
325 !if(!eq(suffix, ""), "", "." # suffix) # "\t" # ops,
327 Requires<[HasV8_1MMainline, HasMVEInt]> {
329 let DecoderNamespace = "MVE";
332 class MVE_ScalarShift<string iname, dag oops, dag iops, string asm, string cstr,
333 list<dag> pattern=[]>
334 : MVE_MI_with_pred<oops, iops, NoItinerary, iname, asm, cstr, pattern> {
335 let Inst{31-20} = 0b111010100101;
340 class MVE_ScalarShiftSingleReg<string iname, dag iops, string asm, string cstr,
341 list<dag> pattern=[]>
342 : MVE_ScalarShift<iname, (outs rGPR:$RdaDest), iops, asm, cstr, pattern> {
345 let Inst{19-16} = RdaDest{3-0};
348 class MVE_ScalarShiftSRegImm<string iname, bits<2> op5_4, list<dag> pattern=[]>
349 : MVE_ScalarShiftSingleReg<iname, (ins rGPR:$RdaSrc, long_shift:$imm),
350 "$RdaSrc, $imm", "$RdaDest = $RdaSrc", pattern> {
354 let Inst{14-12} = imm{4-2};
355 let Inst{11-8} = 0b1111;
356 let Inst{7-6} = imm{1-0};
357 let Inst{5-4} = op5_4{1-0};
358 let Inst{3-0} = 0b1111;
361 def MVE_SQSHL : MVE_ScalarShiftSRegImm<"sqshl", 0b11>;
362 def MVE_SRSHR : MVE_ScalarShiftSRegImm<"srshr", 0b10>;
363 def MVE_UQSHL : MVE_ScalarShiftSRegImm<"uqshl", 0b00>;
364 def MVE_URSHR : MVE_ScalarShiftSRegImm<"urshr", 0b01>;
366 class MVE_ScalarShiftSRegReg<string iname, bits<2> op5_4, list<dag> pattern=[]>
367 : MVE_ScalarShiftSingleReg<iname, (ins rGPR:$RdaSrc, rGPR:$Rm),
368 "$RdaSrc, $Rm", "$RdaDest = $RdaSrc", pattern> {
371 let Inst{15-12} = Rm{3-0};
372 let Inst{11-8} = 0b1111;
373 let Inst{7-6} = 0b00;
374 let Inst{5-4} = op5_4{1-0};
375 let Inst{3-0} = 0b1101;
378 def MVE_SQRSHR : MVE_ScalarShiftSRegReg<"sqrshr", 0b10>;
379 def MVE_UQRSHL : MVE_ScalarShiftSRegReg<"uqrshl", 0b00>;
381 class MVE_ScalarShiftDoubleReg<string iname, dag iops, string asm,
382 string cstr, list<dag> pattern=[]>
383 : MVE_ScalarShift<iname, (outs tGPREven:$RdaLo, tGPROdd:$RdaHi),
384 iops, asm, cstr, pattern> {
388 let Inst{19-17} = RdaLo{3-1};
389 let Inst{11-9} = RdaHi{3-1};
392 class MVE_ScalarShiftDRegImm<string iname, bits<2> op5_4, bit op16,
393 list<dag> pattern=[]>
394 : MVE_ScalarShiftDoubleReg<
395 iname, (ins tGPREven:$RdaLo_src, tGPROdd:$RdaHi_src, long_shift:$imm),
396 "$RdaLo, $RdaHi, $imm", "$RdaLo = $RdaLo_src,$RdaHi = $RdaHi_src",
402 let Inst{14-12} = imm{4-2};
403 let Inst{7-6} = imm{1-0};
404 let Inst{5-4} = op5_4{1-0};
405 let Inst{3-0} = 0b1111;
408 class MVE_ScalarShiftDRegRegBase<string iname, dag iops, string asm,
409 bit op5, bit op16, list<dag> pattern=[]>
410 : MVE_ScalarShiftDoubleReg<
411 iname, iops, asm, "@earlyclobber $RdaHi,@earlyclobber $RdaLo,"
412 "$RdaLo = $RdaLo_src,$RdaHi = $RdaHi_src",
417 let Inst{15-12} = Rm{3-0};
421 let Inst{3-0} = 0b1101;
423 // Custom decoder method because of the following overlapping encodings:
426 // SQRSHRL and SQRSHR
427 // UQRSHLL and UQRSHL
428 let DecoderMethod = "DecodeMVEOverlappingLongShift";
431 class MVE_ScalarShiftDRegReg<string iname, bit op5, list<dag> pattern=[]>
432 : MVE_ScalarShiftDRegRegBase<
433 iname, (ins tGPREven:$RdaLo_src, tGPROdd:$RdaHi_src, rGPR:$Rm),
434 "$RdaLo, $RdaHi, $Rm", op5, 0b0, pattern> {
439 class MVE_ScalarShiftDRegRegWithSat<string iname, bit op5, list<dag> pattern=[]>
440 : MVE_ScalarShiftDRegRegBase<
441 iname, (ins tGPREven:$RdaLo_src, tGPROdd:$RdaHi_src, rGPR:$Rm, saturateop:$sat),
442 "$RdaLo, $RdaHi, $sat, $Rm", op5, 0b1, pattern> {
448 def MVE_ASRLr : MVE_ScalarShiftDRegReg<"asrl", 0b1, [(set tGPREven:$RdaLo, tGPROdd:$RdaHi,
449 (ARMasrl tGPREven:$RdaLo_src,
450 tGPROdd:$RdaHi_src, rGPR:$Rm))]>;
451 def MVE_ASRLi : MVE_ScalarShiftDRegImm<"asrl", 0b10, ?, [(set tGPREven:$RdaLo, tGPROdd:$RdaHi,
452 (ARMasrl tGPREven:$RdaLo_src,
453 tGPROdd:$RdaHi_src, (i32 imm:$imm)))]>;
454 def MVE_LSLLr : MVE_ScalarShiftDRegReg<"lsll", 0b0, [(set tGPREven:$RdaLo, tGPROdd:$RdaHi,
455 (ARMlsll tGPREven:$RdaLo_src,
456 tGPROdd:$RdaHi_src, rGPR:$Rm))]>;
457 def MVE_LSLLi : MVE_ScalarShiftDRegImm<"lsll", 0b00, ?, [(set tGPREven:$RdaLo, tGPROdd:$RdaHi,
458 (ARMlsll tGPREven:$RdaLo_src,
459 tGPROdd:$RdaHi_src, (i32 imm:$imm)))]>;
460 def MVE_LSRL : MVE_ScalarShiftDRegImm<"lsrl", 0b01, ?, [(set tGPREven:$RdaLo, tGPROdd:$RdaHi,
461 (ARMlsrl tGPREven:$RdaLo_src,
462 tGPROdd:$RdaHi_src, (i32 imm:$imm)))]>;
464 def MVE_SQRSHRL : MVE_ScalarShiftDRegRegWithSat<"sqrshrl", 0b1>;
465 def MVE_SQSHLL : MVE_ScalarShiftDRegImm<"sqshll", 0b11, 0b1>;
466 def MVE_SRSHRL : MVE_ScalarShiftDRegImm<"srshrl", 0b10, 0b1>;
468 def MVE_UQRSHLL : MVE_ScalarShiftDRegRegWithSat<"uqrshll", 0b0>;
469 def MVE_UQSHLL : MVE_ScalarShiftDRegImm<"uqshll", 0b00, 0b1>;
470 def MVE_URSHRL : MVE_ScalarShiftDRegImm<"urshrl", 0b01, 0b1>;
472 // start of mve_rDest instructions
474 class MVE_rDest<dag oops, dag iops, InstrItinClass itin,
475 string iname, string suffix,
476 string ops, string cstr, list<dag> pattern=[]>
477 // Always use vpred_n and not vpred_r: with the output register being
478 // a GPR and not a vector register, there can't be any question of
479 // what to put in its inactive lanes.
480 : MVE_p<oops, iops, itin, iname, suffix, ops, vpred_n, cstr, pattern> {
482 let Inst{25-23} = 0b101;
483 let Inst{11-9} = 0b111;
487 class MVE_VABAV<string suffix, bit U, bits<2> size, list<dag> pattern=[]>
488 : MVE_rDest<(outs rGPR:$Rda), (ins rGPR:$Rda_src, MQPR:$Qn, MQPR:$Qm),
489 NoItinerary, "vabav", suffix, "$Rda, $Qn, $Qm", "$Rda = $Rda_src",
497 let Inst{21-20} = size{1-0};
498 let Inst{19-17} = Qn{2-0};
500 let Inst{15-12} = Rda{3-0};
505 let Inst{3-1} = Qm{2-0};
509 def MVE_VABAVs8 : MVE_VABAV<"s8", 0b0, 0b00>;
510 def MVE_VABAVs16 : MVE_VABAV<"s16", 0b0, 0b01>;
511 def MVE_VABAVs32 : MVE_VABAV<"s32", 0b0, 0b10>;
512 def MVE_VABAVu8 : MVE_VABAV<"u8", 0b1, 0b00>;
513 def MVE_VABAVu16 : MVE_VABAV<"u16", 0b1, 0b01>;
514 def MVE_VABAVu32 : MVE_VABAV<"u32", 0b1, 0b10>;
516 class MVE_VADDV<string iname, string suffix, dag iops, string cstr,
517 bit A, bit U, bits<2> size, list<dag> pattern=[]>
518 : MVE_rDest<(outs tGPREven:$Rda), iops, NoItinerary,
519 iname, suffix, "$Rda, $Qm", cstr, pattern> {
524 let Inst{22-20} = 0b111;
525 let Inst{19-18} = size{1-0};
526 let Inst{17-16} = 0b01;
527 let Inst{15-13} = Rda{3-1};
529 let Inst{8-6} = 0b100;
531 let Inst{3-1} = Qm{2-0};
535 multiclass MVE_VADDV_A<string suffix, bit U, bits<2> size,
536 list<dag> pattern=[]> {
537 def acc : MVE_VADDV<"vaddva", suffix,
538 (ins tGPREven:$Rda_src, MQPR:$Qm), "$Rda = $Rda_src",
539 0b1, U, size, pattern>;
540 def no_acc : MVE_VADDV<"vaddv", suffix,
542 0b0, U, size, pattern>;
545 defm MVE_VADDVs8 : MVE_VADDV_A<"s8", 0b0, 0b00>;
546 defm MVE_VADDVs16 : MVE_VADDV_A<"s16", 0b0, 0b01>;
547 defm MVE_VADDVs32 : MVE_VADDV_A<"s32", 0b0, 0b10>;
548 defm MVE_VADDVu8 : MVE_VADDV_A<"u8", 0b1, 0b00>;
549 defm MVE_VADDVu16 : MVE_VADDV_A<"u16", 0b1, 0b01>;
550 defm MVE_VADDVu32 : MVE_VADDV_A<"u32", 0b1, 0b10>;
552 let Predicates = [HasMVEInt] in {
553 def : Pat<(i32 (vecreduce_add (v4i32 MQPR:$src))), (i32 (MVE_VADDVu32no_acc $src))>;
554 def : Pat<(i32 (vecreduce_add (v8i16 MQPR:$src))), (i32 (MVE_VADDVu16no_acc $src))>;
555 def : Pat<(i32 (vecreduce_add (v16i8 MQPR:$src))), (i32 (MVE_VADDVu8no_acc $src))>;
556 def : Pat<(i32 (add (i32 (vecreduce_add (v4i32 MQPR:$src1))), (i32 tGPR:$src2))),
557 (i32 (MVE_VADDVu32acc $src2, $src1))>;
558 def : Pat<(i32 (add (i32 (vecreduce_add (v8i16 MQPR:$src1))), (i32 tGPR:$src2))),
559 (i32 (MVE_VADDVu16acc $src2, $src1))>;
560 def : Pat<(i32 (add (i32 (vecreduce_add (v16i8 MQPR:$src1))), (i32 tGPR:$src2))),
561 (i32 (MVE_VADDVu8acc $src2, $src1))>;
565 class MVE_VADDLV<string iname, string suffix, dag iops, string cstr,
566 bit A, bit U, list<dag> pattern=[]>
567 : MVE_rDest<(outs tGPREven:$RdaLo, tGPROdd:$RdaHi), iops, NoItinerary, iname,
568 suffix, "$RdaLo, $RdaHi, $Qm", cstr, pattern> {
574 let Inst{22-20} = RdaHi{3-1};
575 let Inst{19-18} = 0b10;
576 let Inst{17-16} = 0b01;
577 let Inst{15-13} = RdaLo{3-1};
579 let Inst{8-6} = 0b100;
581 let Inst{3-1} = Qm{2-0};
585 multiclass MVE_VADDLV_A<string suffix, bit U, list<dag> pattern=[]> {
586 def acc : MVE_VADDLV<"vaddlva", suffix,
587 (ins tGPREven:$RdaLo_src, tGPROdd:$RdaHi_src, MQPR:$Qm),
588 "$RdaLo = $RdaLo_src,$RdaHi = $RdaHi_src",
590 def no_acc : MVE_VADDLV<"vaddlv", suffix,
596 defm MVE_VADDLVs32 : MVE_VADDLV_A<"s32", 0b0>;
597 defm MVE_VADDLVu32 : MVE_VADDLV_A<"u32", 0b1>;
599 class MVE_VMINMAXNMV<string iname, string suffix, bit sz,
600 bit bit_17, bit bit_7, list<dag> pattern=[]>
601 : MVE_rDest<(outs rGPR:$RdaDest), (ins rGPR:$RdaSrc, MQPR:$Qm),
602 NoItinerary, iname, suffix, "$RdaSrc, $Qm",
603 "$RdaDest = $RdaSrc", pattern> {
608 let Inst{22-20} = 0b110;
609 let Inst{19-18} = 0b11;
610 let Inst{17} = bit_17;
612 let Inst{15-12} = RdaDest{3-0};
615 let Inst{6-5} = 0b00;
616 let Inst{3-1} = Qm{2-0};
619 let Predicates = [HasMVEFloat];
622 multiclass MVE_VMINMAXNMV_fty<string iname, bit bit_7, list<dag> pattern=[]> {
623 def f32 : MVE_VMINMAXNMV<iname, "f32", 0b0, 0b1, bit_7, pattern>;
624 def f16 : MVE_VMINMAXNMV<iname, "f16", 0b1, 0b1, bit_7, pattern>;
627 defm MVE_VMINNMV : MVE_VMINMAXNMV_fty<"vminnmv", 0b1>;
628 defm MVE_VMAXNMV : MVE_VMINMAXNMV_fty<"vmaxnmv", 0b0>;
630 multiclass MVE_VMINMAXNMAV_fty<string iname, bit bit_7, list<dag> pattern=[]> {
631 def f32 : MVE_VMINMAXNMV<iname, "f32", 0b0, 0b0, bit_7, pattern>;
632 def f16 : MVE_VMINMAXNMV<iname, "f16", 0b1, 0b0, bit_7, pattern>;
635 defm MVE_VMINNMAV : MVE_VMINMAXNMAV_fty<"vminnmav", 0b1>;
636 defm MVE_VMAXNMAV : MVE_VMINMAXNMAV_fty<"vmaxnmav", 0b0>;
638 class MVE_VMINMAXV<string iname, string suffix, bit U, bits<2> size,
639 bit bit_17, bit bit_7, list<dag> pattern=[]>
640 : MVE_rDest<(outs rGPR:$RdaDest), (ins rGPR:$RdaSrc, MQPR:$Qm), NoItinerary,
641 iname, suffix, "$RdaSrc, $Qm", "$RdaDest = $RdaSrc", pattern> {
646 let Inst{22-20} = 0b110;
647 let Inst{19-18} = size{1-0};
648 let Inst{17} = bit_17;
650 let Inst{15-12} = RdaDest{3-0};
653 let Inst{6-5} = 0b00;
654 let Inst{3-1} = Qm{2-0};
658 multiclass MVE_VMINMAXV_ty<string iname, bit bit_7, list<dag> pattern=[]> {
659 def s8 : MVE_VMINMAXV<iname, "s8", 0b0, 0b00, 0b1, bit_7>;
660 def s16 : MVE_VMINMAXV<iname, "s16", 0b0, 0b01, 0b1, bit_7>;
661 def s32 : MVE_VMINMAXV<iname, "s32", 0b0, 0b10, 0b1, bit_7>;
662 def u8 : MVE_VMINMAXV<iname, "u8", 0b1, 0b00, 0b1, bit_7>;
663 def u16 : MVE_VMINMAXV<iname, "u16", 0b1, 0b01, 0b1, bit_7>;
664 def u32 : MVE_VMINMAXV<iname, "u32", 0b1, 0b10, 0b1, bit_7>;
667 defm MVE_VMINV : MVE_VMINMAXV_ty<"vminv", 0b1>;
668 defm MVE_VMAXV : MVE_VMINMAXV_ty<"vmaxv", 0b0>;
670 multiclass MVE_VMINMAXAV_ty<string iname, bit bit_7, list<dag> pattern=[]> {
671 def s8 : MVE_VMINMAXV<iname, "s8", 0b0, 0b00, 0b0, bit_7>;
672 def s16 : MVE_VMINMAXV<iname, "s16", 0b0, 0b01, 0b0, bit_7>;
673 def s32 : MVE_VMINMAXV<iname, "s32", 0b0, 0b10, 0b0, bit_7>;
676 defm MVE_VMINAV : MVE_VMINMAXAV_ty<"vminav", 0b1>;
677 defm MVE_VMAXAV : MVE_VMINMAXAV_ty<"vmaxav", 0b0>;
679 class MVE_VMLAMLSDAV<string iname, string suffix, dag iops, string cstr,
680 bit sz, bit bit_28, bit A, bit X, bit bit_8, bit bit_0,
681 list<dag> pattern=[]>
682 : MVE_rDest<(outs tGPREven:$RdaDest), iops, NoItinerary, iname, suffix,
683 "$RdaDest, $Qn, $Qm", cstr, pattern> {
688 let Inst{28} = bit_28;
689 let Inst{22-20} = 0b111;
690 let Inst{19-17} = Qn{2-0};
692 let Inst{15-13} = RdaDest{3-1};
695 let Inst{7-6} = 0b00;
697 let Inst{3-1} = Qm{2-0};
701 multiclass MVE_VMLAMLSDAV_X<string iname, string suffix, dag iops, string cstr,
702 bit sz, bit bit_28, bit A, bit bit_8, bit bit_0,
703 list<dag> pattern=[]> {
704 def _noexch : MVE_VMLAMLSDAV<iname, suffix, iops, cstr, sz,
705 bit_28, A, 0b0, bit_8, bit_0, pattern>;
706 def _exch : MVE_VMLAMLSDAV<iname # "x", suffix, iops, cstr, sz,
707 bit_28, A, 0b1, bit_8, bit_0, pattern>;
710 multiclass MVE_VMLAMLSDAV_XA<string iname, string suffix, bit sz, bit bit_28,
711 bit bit_8, bit bit_0, list<dag> pattern=[]> {
712 defm _noacc : MVE_VMLAMLSDAV_X<iname, suffix, (ins MQPR:$Qn, MQPR:$Qm), "",
713 sz, bit_28, 0b0, bit_8, bit_0, pattern>;
714 defm _acc : MVE_VMLAMLSDAV_X<iname # "a", suffix,
715 (ins tGPREven:$RdaSrc, MQPR:$Qn, MQPR:$Qm),
716 "$RdaDest = $RdaSrc",
717 sz, bit_28, 0b1, bit_8, bit_0, pattern>;
720 multiclass MVE_VMLADAV_multi<string suffix, bit sz, bit U, bit bit_8,
721 list<dag> pattern=[]> {
722 defm "" : MVE_VMLAMLSDAV_XA<"vmladav", suffix, sz, U, bit_8, 0b0, pattern>;
725 defm MVE_VMLADAVs16 : MVE_VMLADAV_multi<"s16", 0b0, 0b0, 0b0>;
726 defm MVE_VMLADAVs32 : MVE_VMLADAV_multi<"s32", 0b1, 0b0, 0b0>;
727 defm MVE_VMLADAVu16 : MVE_VMLADAV_multi<"u16", 0b0, 0b1, 0b0>;
728 defm MVE_VMLADAVu32 : MVE_VMLADAV_multi<"u32", 0b1, 0b1, 0b0>;
730 defm MVE_VMLADAVs8 : MVE_VMLADAV_multi<"s8", 0b0, 0b0, 0b1>;
731 defm MVE_VMLADAVu8 : MVE_VMLADAV_multi<"u8", 0b0, 0b1, 0b1>;
733 // vmlav aliases vmladav
734 foreach acc = ["_acc", "_noacc"] in {
735 foreach suffix = ["s8", "s16", "s32", "u8", "u16", "u32"] in {
736 def : MVEInstAlias<!strconcat("vmlav", !if(!eq(acc, "_acc"), "a", ""),
737 "${vp}.", suffix, "\t$RdaDest, $Qn, $Qm"),
738 (!cast<Instruction>("MVE_VMLADAV"#suffix#acc#"_noexch")
739 tGPREven:$RdaDest, MQPR:$Qn, MQPR:$Qm, vpred_n:$vp)>;
743 multiclass MVE_VMLSDAV_multi<string suffix, bit sz, bit bit_28,
744 list<dag> pattern=[]> {
745 defm "" : MVE_VMLAMLSDAV_XA<"vmlsdav", suffix, sz, bit_28, 0b0, 0b1, pattern>;
748 defm MVE_VMLSDAVs8 : MVE_VMLSDAV_multi<"s8", 0, 0b1>;
749 defm MVE_VMLSDAVs16 : MVE_VMLSDAV_multi<"s16", 0, 0b0>;
750 defm MVE_VMLSDAVs32 : MVE_VMLSDAV_multi<"s32", 1, 0b0>;
752 // Base class for VMLALDAV and VMLSLDAV, VRMLALDAVH, VRMLSLDAVH
753 class MVE_VMLALDAVBase<string iname, string suffix, dag iops, string cstr,
754 bit sz, bit bit_28, bit A, bit X, bit bit_8, bit bit_0,
755 list<dag> pattern=[]>
756 : MVE_rDest<(outs tGPREven:$RdaLoDest, tGPROdd:$RdaHiDest), iops, NoItinerary,
757 iname, suffix, "$RdaLoDest, $RdaHiDest, $Qn, $Qm", cstr, pattern> {
763 let Inst{28} = bit_28;
764 let Inst{22-20} = RdaHiDest{3-1};
765 let Inst{19-17} = Qn{2-0};
767 let Inst{15-13} = RdaLoDest{3-1};
770 let Inst{7-6} = 0b00;
772 let Inst{3-1} = Qm{2-0};
776 multiclass MVE_VMLALDAVBase_X<string iname, string suffix, dag iops,
777 string cstr, bit sz, bit bit_28, bit A,
778 bit bit_8, bit bit_0, list<dag> pattern=[]> {
779 def _noexch : MVE_VMLALDAVBase<iname, suffix, iops, cstr, sz,
780 bit_28, A, 0b0, bit_8, bit_0, pattern>;
781 def _exch : MVE_VMLALDAVBase<iname # "x", suffix, iops, cstr, sz,
782 bit_28, A, 0b1, bit_8, bit_0, pattern>;
785 multiclass MVE_VMLALDAVBase_XA<string iname, string suffix, bit sz, bit bit_28,
786 bit bit_8, bit bit_0, list<dag> pattern=[]> {
787 defm _noacc : MVE_VMLALDAVBase_X<
788 iname, suffix, (ins MQPR:$Qn, MQPR:$Qm), "",
789 sz, bit_28, 0b0, bit_8, bit_0, pattern>;
790 defm _acc : MVE_VMLALDAVBase_X<
791 iname # "a", suffix, (ins tGPREven:$RdaLoSrc, tGPROdd:$RdaHiSrc,
793 "$RdaLoDest = $RdaLoSrc,$RdaHiDest = $RdaHiSrc",
794 sz, bit_28, 0b1, bit_8, bit_0, pattern>;
797 multiclass MVE_VRMLALDAVH_multi<string suffix, bit U, list<dag> pattern=[]> {
798 defm "" : MVE_VMLALDAVBase_XA<
799 "vrmlaldavh", suffix, 0b0, U, 0b1, 0b0, pattern>;
802 defm MVE_VRMLALDAVHs32 : MVE_VRMLALDAVH_multi<"s32", 0>;
803 defm MVE_VRMLALDAVHu32 : MVE_VRMLALDAVH_multi<"u32", 1>;
805 // vrmlalvh aliases for vrmlaldavh
806 def : MVEInstAlias<"vrmlalvh${vp}.s32\t$RdaLo, $RdaHi, $Qn, $Qm",
807 (MVE_VRMLALDAVHs32_noacc_noexch
808 tGPREven:$RdaLo, tGPROdd:$RdaHi,
809 MQPR:$Qn, MQPR:$Qm, vpred_n:$vp)>;
810 def : MVEInstAlias<"vrmlalvha${vp}.s32\t$RdaLo, $RdaHi, $Qn, $Qm",
811 (MVE_VRMLALDAVHs32_acc_noexch
812 tGPREven:$RdaLo, tGPROdd:$RdaHi,
813 MQPR:$Qn, MQPR:$Qm, vpred_n:$vp)>;
814 def : MVEInstAlias<"vrmlalvh${vp}.u32\t$RdaLo, $RdaHi, $Qn, $Qm",
815 (MVE_VRMLALDAVHu32_noacc_noexch
816 tGPREven:$RdaLo, tGPROdd:$RdaHi,
817 MQPR:$Qn, MQPR:$Qm, vpred_n:$vp)>;
818 def : MVEInstAlias<"vrmlalvha${vp}.u32\t$RdaLo, $RdaHi, $Qn, $Qm",
819 (MVE_VRMLALDAVHu32_acc_noexch
820 tGPREven:$RdaLo, tGPROdd:$RdaHi,
821 MQPR:$Qn, MQPR:$Qm, vpred_n:$vp)>;
823 multiclass MVE_VMLALDAV_multi<string suffix, bit sz, bit U,
824 list<dag> pattern=[]> {
825 defm "" : MVE_VMLALDAVBase_XA<"vmlaldav", suffix, sz, U, 0b0, 0b0, pattern>;
828 defm MVE_VMLALDAVs16 : MVE_VMLALDAV_multi<"s16", 0b0, 0b0>;
829 defm MVE_VMLALDAVs32 : MVE_VMLALDAV_multi<"s32", 0b1, 0b0>;
830 defm MVE_VMLALDAVu16 : MVE_VMLALDAV_multi<"u16", 0b0, 0b1>;
831 defm MVE_VMLALDAVu32 : MVE_VMLALDAV_multi<"u32", 0b1, 0b1>;
833 // vmlalv aliases vmlaldav
834 foreach acc = ["_acc", "_noacc"] in {
835 foreach suffix = ["s16", "s32", "u16", "u32"] in {
836 def : MVEInstAlias<!strconcat("vmlalv", !if(!eq(acc, "_acc"), "a", ""),
837 "${vp}.", suffix, "\t$RdaLoDest, $RdaHiDest, $Qn, $Qm"),
838 (!cast<Instruction>("MVE_VMLALDAV"#suffix#acc#"_noexch")
839 tGPREven:$RdaLoDest, tGPROdd:$RdaHiDest,
840 MQPR:$Qn, MQPR:$Qm, vpred_n:$vp)>;
844 multiclass MVE_VMLSLDAV_multi<string iname, string suffix, bit sz,
845 bit bit_28, list<dag> pattern=[]> {
846 defm "" : MVE_VMLALDAVBase_XA<iname, suffix, sz, bit_28, 0b0, 0b1, pattern>;
849 defm MVE_VMLSLDAVs16 : MVE_VMLSLDAV_multi<"vmlsldav", "s16", 0b0, 0b0>;
850 defm MVE_VMLSLDAVs32 : MVE_VMLSLDAV_multi<"vmlsldav", "s32", 0b1, 0b0>;
851 defm MVE_VRMLSLDAVHs32 : MVE_VMLSLDAV_multi<"vrmlsldavh", "s32", 0b0, 0b1>;
853 // end of mve_rDest instructions
855 // start of mve_comp instructions
857 class MVE_comp<InstrItinClass itin, string iname, string suffix,
858 string cstr, list<dag> pattern=[]>
859 : MVE_p<(outs MQPR:$Qd), (ins MQPR:$Qn, MQPR:$Qm), itin, iname, suffix,
860 "$Qd, $Qn, $Qm", vpred_r, cstr, pattern> {
865 let Inst{22} = Qd{3};
866 let Inst{19-17} = Qn{2-0};
868 let Inst{15-13} = Qd{2-0};
870 let Inst{10-9} = 0b11;
873 let Inst{3-1} = Qm{2-0};
877 class MVE_VMINMAXNM<string iname, string suffix, bit sz, bit bit_21,
878 list<dag> pattern=[]>
879 : MVE_comp<NoItinerary, iname, suffix, "", pattern> {
882 let Inst{25-24} = 0b11;
884 let Inst{21} = bit_21;
891 let Predicates = [HasMVEFloat];
894 def MVE_VMAXNMf32 : MVE_VMINMAXNM<"vmaxnm", "f32", 0b0, 0b0>;
895 def MVE_VMAXNMf16 : MVE_VMINMAXNM<"vmaxnm", "f16", 0b1, 0b0>;
897 let Predicates = [HasMVEFloat] in {
898 def : Pat<(v4f32 (fmaxnum (v4f32 MQPR:$val1), (v4f32 MQPR:$val2))),
899 (v4f32 (MVE_VMAXNMf32 (v4f32 MQPR:$val1), (v4f32 MQPR:$val2)))>;
900 def : Pat<(v8f16 (fmaxnum (v8f16 MQPR:$val1), (v8f16 MQPR:$val2))),
901 (v8f16 (MVE_VMAXNMf16 (v8f16 MQPR:$val1), (v8f16 MQPR:$val2)))>;
904 def MVE_VMINNMf32 : MVE_VMINMAXNM<"vminnm", "f32", 0b0, 0b1>;
905 def MVE_VMINNMf16 : MVE_VMINMAXNM<"vminnm", "f16", 0b1, 0b1>;
907 let Predicates = [HasMVEFloat] in {
908 def : Pat<(v4f32 (fminnum (v4f32 MQPR:$val1), (v4f32 MQPR:$val2))),
909 (v4f32 (MVE_VMINNMf32 (v4f32 MQPR:$val1), (v4f32 MQPR:$val2)))>;
910 def : Pat<(v8f16 (fminnum (v8f16 MQPR:$val1), (v8f16 MQPR:$val2))),
911 (v8f16 (MVE_VMINNMf16 (v8f16 MQPR:$val1), (v8f16 MQPR:$val2)))>;
915 class MVE_VMINMAX<string iname, string suffix, bit U, bits<2> size,
916 bit bit_4, list<dag> pattern=[]>
917 : MVE_comp<NoItinerary, iname, suffix, "", pattern> {
920 let Inst{25-24} = 0b11;
922 let Inst{21-20} = size{1-0};
929 multiclass MVE_VMINMAX_all_sizes<string iname, bit bit_4> {
930 def s8 : MVE_VMINMAX<iname, "s8", 0b0, 0b00, bit_4>;
931 def s16 : MVE_VMINMAX<iname, "s16", 0b0, 0b01, bit_4>;
932 def s32 : MVE_VMINMAX<iname, "s32", 0b0, 0b10, bit_4>;
933 def u8 : MVE_VMINMAX<iname, "u8", 0b1, 0b00, bit_4>;
934 def u16 : MVE_VMINMAX<iname, "u16", 0b1, 0b01, bit_4>;
935 def u32 : MVE_VMINMAX<iname, "u32", 0b1, 0b10, bit_4>;
938 defm MVE_VMAX : MVE_VMINMAX_all_sizes<"vmax", 0b0>;
939 defm MVE_VMIN : MVE_VMINMAX_all_sizes<"vmin", 0b1>;
941 let Predicates = [HasMVEInt] in {
942 def : Pat<(v16i8 (smin (v16i8 MQPR:$val1), (v16i8 MQPR:$val2))),
943 (v16i8 (MVE_VMINs8 (v16i8 MQPR:$val1), (v16i8 MQPR:$val2)))>;
944 def : Pat<(v8i16 (smin (v8i16 MQPR:$val1), (v8i16 MQPR:$val2))),
945 (v8i16 (MVE_VMINs16 (v8i16 MQPR:$val1), (v8i16 MQPR:$val2)))>;
946 def : Pat<(v4i32 (smin (v4i32 MQPR:$val1), (v4i32 MQPR:$val2))),
947 (v4i32 (MVE_VMINs32 (v4i32 MQPR:$val1), (v4i32 MQPR:$val2)))>;
949 def : Pat<(v16i8 (smax (v16i8 MQPR:$val1), (v16i8 MQPR:$val2))),
950 (v16i8 (MVE_VMAXs8 (v16i8 MQPR:$val1), (v16i8 MQPR:$val2)))>;
951 def : Pat<(v8i16 (smax (v8i16 MQPR:$val1), (v8i16 MQPR:$val2))),
952 (v8i16 (MVE_VMAXs16 (v8i16 MQPR:$val1), (v8i16 MQPR:$val2)))>;
953 def : Pat<(v4i32 (smax (v4i32 MQPR:$val1), (v4i32 MQPR:$val2))),
954 (v4i32 (MVE_VMAXs32 (v4i32 MQPR:$val1), (v4i32 MQPR:$val2)))>;
956 def : Pat<(v16i8 (umin (v16i8 MQPR:$val1), (v16i8 MQPR:$val2))),
957 (v16i8 (MVE_VMINu8 (v16i8 MQPR:$val1), (v16i8 MQPR:$val2)))>;
958 def : Pat<(v8i16 (umin (v8i16 MQPR:$val1), (v8i16 MQPR:$val2))),
959 (v8i16 (MVE_VMINu16 (v8i16 MQPR:$val1), (v8i16 MQPR:$val2)))>;
960 def : Pat<(v4i32 (umin (v4i32 MQPR:$val1), (v4i32 MQPR:$val2))),
961 (v4i32 (MVE_VMINu32 (v4i32 MQPR:$val1), (v4i32 MQPR:$val2)))>;
963 def : Pat<(v16i8 (umax (v16i8 MQPR:$val1), (v16i8 MQPR:$val2))),
964 (v16i8 (MVE_VMAXu8 (v16i8 MQPR:$val1), (v16i8 MQPR:$val2)))>;
965 def : Pat<(v8i16 (umax (v8i16 MQPR:$val1), (v8i16 MQPR:$val2))),
966 (v8i16 (MVE_VMAXu16 (v8i16 MQPR:$val1), (v8i16 MQPR:$val2)))>;
967 def : Pat<(v4i32 (umax (v4i32 MQPR:$val1), (v4i32 MQPR:$val2))),
968 (v4i32 (MVE_VMAXu32 (v4i32 MQPR:$val1), (v4i32 MQPR:$val2)))>;
971 // end of mve_comp instructions
973 // start of mve_bit instructions
975 class MVE_bit_arith<dag oops, dag iops, string iname, string suffix,
976 string ops, string cstr, list<dag> pattern=[]>
977 : MVE_p<oops, iops, NoItinerary, iname, suffix, ops, vpred_r, cstr, pattern> {
981 let Inst{22} = Qd{3};
982 let Inst{15-13} = Qd{2-0};
984 let Inst{3-1} = Qm{2-0};
987 def MVE_VBIC : MVE_bit_arith<(outs MQPR:$Qd), (ins MQPR:$Qn, MQPR:$Qm),
988 "vbic", "", "$Qd, $Qn, $Qm", ""> {
992 let Inst{25-23} = 0b110;
993 let Inst{21-20} = 0b01;
994 let Inst{19-17} = Qn{2-0};
996 let Inst{12-8} = 0b00001;
1003 class MVE_VREV<string iname, string suffix, bits<2> size, bits<2> bit_8_7, string cstr="">
1004 : MVE_bit_arith<(outs MQPR:$Qd), (ins MQPR:$Qm), iname,
1005 suffix, "$Qd, $Qm", cstr> {
1008 let Inst{25-23} = 0b111;
1009 let Inst{21-20} = 0b11;
1010 let Inst{19-18} = size;
1011 let Inst{17-16} = 0b00;
1012 let Inst{12-9} = 0b0000;
1013 let Inst{8-7} = bit_8_7;
1019 def MVE_VREV64_8 : MVE_VREV<"vrev64", "8", 0b00, 0b00, "@earlyclobber $Qd">;
1020 def MVE_VREV64_16 : MVE_VREV<"vrev64", "16", 0b01, 0b00, "@earlyclobber $Qd">;
1021 def MVE_VREV64_32 : MVE_VREV<"vrev64", "32", 0b10, 0b00, "@earlyclobber $Qd">;
1023 def MVE_VREV32_8 : MVE_VREV<"vrev32", "8", 0b00, 0b01>;
1024 def MVE_VREV32_16 : MVE_VREV<"vrev32", "16", 0b01, 0b01>;
1026 def MVE_VREV16_8 : MVE_VREV<"vrev16", "8", 0b00, 0b10>;
1028 let Predicates = [HasMVEInt] in {
1029 def : Pat<(v4i32 (ARMvrev64 (v4i32 MQPR:$src))),
1030 (v4i32 (MVE_VREV64_32 (v4i32 MQPR:$src)))>;
1031 def : Pat<(v8i16 (ARMvrev64 (v8i16 MQPR:$src))),
1032 (v8i16 (MVE_VREV64_16 (v8i16 MQPR:$src)))>;
1033 def : Pat<(v16i8 (ARMvrev64 (v16i8 MQPR:$src))),
1034 (v16i8 (MVE_VREV64_8 (v16i8 MQPR:$src)))>;
1036 def : Pat<(v8i16 (ARMvrev32 (v8i16 MQPR:$src))),
1037 (v8i16 (MVE_VREV32_16 (v8i16 MQPR:$src)))>;
1038 def : Pat<(v16i8 (ARMvrev32 (v16i8 MQPR:$src))),
1039 (v16i8 (MVE_VREV32_8 (v16i8 MQPR:$src)))>;
1041 def : Pat<(v16i8 (ARMvrev16 (v16i8 MQPR:$src))),
1042 (v16i8 (MVE_VREV16_8 (v16i8 MQPR:$src)))>;
1044 def : Pat<(v4f32 (ARMvrev64 (v4f32 MQPR:$src))),
1045 (v4f32 (MVE_VREV64_32 (v4f32 MQPR:$src)))>;
1046 def : Pat<(v8f16 (ARMvrev64 (v8f16 MQPR:$src))),
1047 (v8f16 (MVE_VREV64_16 (v8f16 MQPR:$src)))>;
1048 def : Pat<(v8f16 (ARMvrev32 (v8f16 MQPR:$src))),
1049 (v8f16 (MVE_VREV32_16 (v8f16 MQPR:$src)))>;
1052 def MVE_VMVN : MVE_bit_arith<(outs MQPR:$Qd), (ins MQPR:$Qm),
1053 "vmvn", "", "$Qd, $Qm", ""> {
1055 let Inst{25-23} = 0b111;
1056 let Inst{21-16} = 0b110000;
1057 let Inst{12-6} = 0b0010111;
1062 let Predicates = [HasMVEInt] in {
1063 def : Pat<(v16i8 (vnotq (v16i8 MQPR:$val1))),
1064 (v16i8 (MVE_VMVN (v16i8 MQPR:$val1)))>;
1065 def : Pat<(v8i16 (vnotq (v8i16 MQPR:$val1))),
1066 (v8i16 (MVE_VMVN (v8i16 MQPR:$val1)))>;
1067 def : Pat<(v4i32 (vnotq (v4i32 MQPR:$val1))),
1068 (v4i32 (MVE_VMVN (v4i32 MQPR:$val1)))>;
1069 def : Pat<(v2i64 (vnotq (v2i64 MQPR:$val1))),
1070 (v2i64 (MVE_VMVN (v2i64 MQPR:$val1)))>;
1073 class MVE_bit_ops<string iname, bits<2> bit_21_20, bit bit_28>
1074 : MVE_bit_arith<(outs MQPR:$Qd), (ins MQPR:$Qn, MQPR:$Qm),
1075 iname, "", "$Qd, $Qn, $Qm", ""> {
1078 let Inst{28} = bit_28;
1079 let Inst{25-23} = 0b110;
1080 let Inst{21-20} = bit_21_20;
1081 let Inst{19-17} = Qn{2-0};
1083 let Inst{12-8} = 0b00001;
1084 let Inst{7} = Qn{3};
1090 def MVE_VEOR : MVE_bit_ops<"veor", 0b00, 0b1>;
1091 def MVE_VORN : MVE_bit_ops<"vorn", 0b11, 0b0>;
1092 def MVE_VORR : MVE_bit_ops<"vorr", 0b10, 0b0>;
1093 def MVE_VAND : MVE_bit_ops<"vand", 0b00, 0b0>;
1095 // add ignored suffixes as aliases
1097 foreach s=["s8", "s16", "s32", "u8", "u16", "u32", "i8", "i16", "i32", "f16", "f32"] in {
1098 def : MVEInstAlias<"vbic${vp}." # s # "\t$QdSrc, $QnSrc, $QmSrc",
1099 (MVE_VBIC MQPR:$QdSrc, MQPR:$QnSrc, MQPR:$QmSrc, vpred_r:$vp)>;
1100 def : MVEInstAlias<"veor${vp}." # s # "\t$QdSrc, $QnSrc, $QmSrc",
1101 (MVE_VEOR MQPR:$QdSrc, MQPR:$QnSrc, MQPR:$QmSrc, vpred_r:$vp)>;
1102 def : MVEInstAlias<"vorn${vp}." # s # "\t$QdSrc, $QnSrc, $QmSrc",
1103 (MVE_VORN MQPR:$QdSrc, MQPR:$QnSrc, MQPR:$QmSrc, vpred_r:$vp)>;
1104 def : MVEInstAlias<"vorr${vp}." # s # "\t$QdSrc, $QnSrc, $QmSrc",
1105 (MVE_VORR MQPR:$QdSrc, MQPR:$QnSrc, MQPR:$QmSrc, vpred_r:$vp)>;
1106 def : MVEInstAlias<"vand${vp}." # s # "\t$QdSrc, $QnSrc, $QmSrc",
1107 (MVE_VAND MQPR:$QdSrc, MQPR:$QnSrc, MQPR:$QmSrc, vpred_r:$vp)>;
1110 let Predicates = [HasMVEInt] in {
1111 def : Pat<(v16i8 (and (v16i8 MQPR:$val1), (v16i8 MQPR:$val2))),
1112 (v16i8 (MVE_VAND (v16i8 MQPR:$val1), (v16i8 MQPR:$val2)))>;
1113 def : Pat<(v8i16 (and (v8i16 MQPR:$val1), (v8i16 MQPR:$val2))),
1114 (v8i16 (MVE_VAND (v8i16 MQPR:$val1), (v8i16 MQPR:$val2)))>;
1115 def : Pat<(v4i32 (and (v4i32 MQPR:$val1), (v4i32 MQPR:$val2))),
1116 (v4i32 (MVE_VAND (v4i32 MQPR:$val1), (v4i32 MQPR:$val2)))>;
1117 def : Pat<(v2i64 (and (v2i64 MQPR:$val1), (v2i64 MQPR:$val2))),
1118 (v2i64 (MVE_VAND (v2i64 MQPR:$val1), (v2i64 MQPR:$val2)))>;
1120 def : Pat<(v16i8 (or (v16i8 MQPR:$val1), (v16i8 MQPR:$val2))),
1121 (v16i8 (MVE_VORR (v16i8 MQPR:$val1), (v16i8 MQPR:$val2)))>;
1122 def : Pat<(v8i16 (or (v8i16 MQPR:$val1), (v8i16 MQPR:$val2))),
1123 (v8i16 (MVE_VORR (v8i16 MQPR:$val1), (v8i16 MQPR:$val2)))>;
1124 def : Pat<(v4i32 (or (v4i32 MQPR:$val1), (v4i32 MQPR:$val2))),
1125 (v4i32 (MVE_VORR (v4i32 MQPR:$val1), (v4i32 MQPR:$val2)))>;
1126 def : Pat<(v2i64 (or (v2i64 MQPR:$val1), (v2i64 MQPR:$val2))),
1127 (v2i64 (MVE_VORR (v2i64 MQPR:$val1), (v2i64 MQPR:$val2)))>;
1129 def : Pat<(v16i8 (xor (v16i8 MQPR:$val1), (v16i8 MQPR:$val2))),
1130 (v16i8 (MVE_VEOR (v16i8 MQPR:$val1), (v16i8 MQPR:$val2)))>;
1131 def : Pat<(v8i16 (xor (v8i16 MQPR:$val1), (v8i16 MQPR:$val2))),
1132 (v8i16 (MVE_VEOR (v8i16 MQPR:$val1), (v8i16 MQPR:$val2)))>;
1133 def : Pat<(v4i32 (xor (v4i32 MQPR:$val1), (v4i32 MQPR:$val2))),
1134 (v4i32 (MVE_VEOR (v4i32 MQPR:$val1), (v4i32 MQPR:$val2)))>;
1135 def : Pat<(v2i64 (xor (v2i64 MQPR:$val1), (v2i64 MQPR:$val2))),
1136 (v2i64 (MVE_VEOR (v2i64 MQPR:$val1), (v2i64 MQPR:$val2)))>;
1138 def : Pat<(v16i8 (and (v16i8 MQPR:$val1), (vnotq MQPR:$val2))),
1139 (v16i8 (MVE_VBIC (v16i8 MQPR:$val1), (v16i8 MQPR:$val2)))>;
1140 def : Pat<(v8i16 (and (v8i16 MQPR:$val1), (vnotq MQPR:$val2))),
1141 (v8i16 (MVE_VBIC (v8i16 MQPR:$val1), (v8i16 MQPR:$val2)))>;
1142 def : Pat<(v4i32 (and (v4i32 MQPR:$val1), (vnotq MQPR:$val2))),
1143 (v4i32 (MVE_VBIC (v4i32 MQPR:$val1), (v4i32 MQPR:$val2)))>;
1144 def : Pat<(v2i64 (and (v2i64 MQPR:$val1), (vnotq MQPR:$val2))),
1145 (v2i64 (MVE_VBIC (v2i64 MQPR:$val1), (v2i64 MQPR:$val2)))>;
1147 def : Pat<(v16i8 (or (v16i8 MQPR:$val1), (vnotq MQPR:$val2))),
1148 (v16i8 (MVE_VORN (v16i8 MQPR:$val1), (v16i8 MQPR:$val2)))>;
1149 def : Pat<(v8i16 (or (v8i16 MQPR:$val1), (vnotq MQPR:$val2))),
1150 (v8i16 (MVE_VORN (v8i16 MQPR:$val1), (v8i16 MQPR:$val2)))>;
1151 def : Pat<(v4i32 (or (v4i32 MQPR:$val1), (vnotq MQPR:$val2))),
1152 (v4i32 (MVE_VORN (v4i32 MQPR:$val1), (v4i32 MQPR:$val2)))>;
1153 def : Pat<(v2i64 (or (v2i64 MQPR:$val1), (vnotq MQPR:$val2))),
1154 (v2i64 (MVE_VORN (v2i64 MQPR:$val1), (v2i64 MQPR:$val2)))>;
1157 class MVE_bit_cmode<string iname, string suffix, bits<4> cmode, dag inOps>
1158 : MVE_p<(outs MQPR:$Qd), inOps, NoItinerary,
1159 iname, suffix, "$Qd, $imm", vpred_n, "$Qd = $Qd_src"> {
1163 let Inst{28} = imm{7};
1164 let Inst{27-23} = 0b11111;
1165 let Inst{22} = Qd{3};
1166 let Inst{21-19} = 0b000;
1167 let Inst{18-16} = imm{6-4};
1168 let Inst{15-13} = Qd{2-0};
1170 let Inst{11-8} = cmode;
1171 let Inst{7-6} = 0b01;
1173 let Inst{3-0} = imm{3-0};
1176 class MVE_VORR<string suffix, bits<4> cmode, ExpandImm imm_type>
1177 : MVE_bit_cmode<"vorr", suffix, cmode, (ins MQPR:$Qd_src, imm_type:$imm)> {
1181 def MVE_VORRIZ0v4i32 : MVE_VORR<"i32", 0b0001, expzero00>;
1182 def MVE_VORRIZ0v8i16 : MVE_VORR<"i16", 0b1001, expzero00>;
1183 def MVE_VORRIZ8v4i32 : MVE_VORR<"i32", 0b0011, expzero08>;
1184 def MVE_VORRIZ8v8i16 : MVE_VORR<"i16", 0b1011, expzero08>;
1185 def MVE_VORRIZ16v4i32 : MVE_VORR<"i32", 0b0101, expzero16>;
1186 def MVE_VORRIZ24v4i32 : MVE_VORR<"i32", 0b0111, expzero24>;
1188 def MVE_VORNIZ0v4i32 : MVEAsmPseudo<"vorn${vp}.i32\t$Qd, $imm",
1189 (ins MQPR:$Qd_src, expzero00inv32:$imm, vpred_n:$vp), (outs MQPR:$Qd)>;
1190 def MVE_VORNIZ0v8i16 : MVEAsmPseudo<"vorn${vp}.i16\t$Qd, $imm",
1191 (ins MQPR:$Qd_src, expzero00inv16:$imm, vpred_n:$vp), (outs MQPR:$Qd)>;
1192 def MVE_VORNIZ8v4i32 : MVEAsmPseudo<"vorn${vp}.i32\t$Qd, $imm",
1193 (ins MQPR:$Qd_src, expzero08inv32:$imm, vpred_n:$vp), (outs MQPR:$Qd)>;
1194 def MVE_VORNIZ8v8i16 : MVEAsmPseudo<"vorn${vp}.i16\t$Qd, $imm",
1195 (ins MQPR:$Qd_src, expzero08inv16:$imm, vpred_n:$vp), (outs MQPR:$Qd)>;
1196 def MVE_VORNIZ16v4i32 : MVEAsmPseudo<"vorn${vp}.i32\t$Qd, $imm",
1197 (ins MQPR:$Qd_src, expzero16inv32:$imm, vpred_n:$vp), (outs MQPR:$Qd)>;
1198 def MVE_VORNIZ24v4i32 : MVEAsmPseudo<"vorn${vp}.i32\t$Qd, $imm",
1199 (ins MQPR:$Qd_src, expzero24inv32:$imm, vpred_n:$vp), (outs MQPR:$Qd)>;
1201 def MVE_VMOV : MVEInstAlias<"vmov${vp}\t$Qd, $Qm",
1202 (MVE_VORR MQPR:$Qd, MQPR:$Qm, MQPR:$Qm, vpred_r:$vp)>;
1204 class MVE_VBIC<string suffix, bits<4> cmode, ExpandImm imm_type>
1205 : MVE_bit_cmode<"vbic", suffix, cmode, (ins MQPR:$Qd_src, imm_type:$imm)> {
1209 def MVE_VBICIZ0v4i32 : MVE_VBIC<"i32", 0b0001, expzero00>;
1210 def MVE_VBICIZ0v8i16 : MVE_VBIC<"i16", 0b1001, expzero00>;
1211 def MVE_VBICIZ8v4i32 : MVE_VBIC<"i32", 0b0011, expzero08>;
1212 def MVE_VBICIZ8v8i16 : MVE_VBIC<"i16", 0b1011, expzero08>;
1213 def MVE_VBICIZ16v4i32 : MVE_VBIC<"i32", 0b0101, expzero16>;
1214 def MVE_VBICIZ24v4i32 : MVE_VBIC<"i32", 0b0111, expzero24>;
1216 def MVE_VANDIZ0v4i32 : MVEAsmPseudo<"vand${vp}.i32\t$Qda, $imm",
1217 (ins MQPR:$Qda_src, expzero00inv32:$imm, vpred_n:$vp), (outs MQPR:$Qda)>;
1218 def MVE_VANDIZ0v8i16 : MVEAsmPseudo<"vand${vp}.i16\t$Qda, $imm",
1219 (ins MQPR:$Qda_src, expzero00inv16:$imm, vpred_n:$vp), (outs MQPR:$Qda)>;
1220 def MVE_VANDIZ8v4i32 : MVEAsmPseudo<"vand${vp}.i32\t$Qda, $imm",
1221 (ins MQPR:$Qda_src, expzero08inv32:$imm, vpred_n:$vp), (outs MQPR:$Qda)>;
1222 def MVE_VANDIZ8v8i16 : MVEAsmPseudo<"vand${vp}.i16\t$Qda, $imm",
1223 (ins MQPR:$Qda_src, expzero08inv16:$imm, vpred_n:$vp), (outs MQPR:$Qda)>;
1224 def MVE_VANDIZ16v4i32 : MVEAsmPseudo<"vand${vp}.i32\t$Qda, $imm",
1225 (ins MQPR:$Qda_src, expzero16inv32:$imm, vpred_n:$vp), (outs MQPR:$Qda)>;
1226 def MVE_VANDIZ24v4i32 : MVEAsmPseudo<"vand${vp}.i32\t$Qda, $imm",
1227 (ins MQPR:$Qda_src, expzero24inv32:$imm, vpred_n:$vp), (outs MQPR:$Qda)>;
1229 class MVE_VMOV_lane_direction {
1236 def MVE_VMOV_from_lane : MVE_VMOV_lane_direction {
1238 let oops = (outs rGPR:$Rt);
1239 let iops = (ins MQPR:$Qd);
1240 let ops = "$Rt, $Qd$Idx";
1243 def MVE_VMOV_to_lane : MVE_VMOV_lane_direction {
1245 let oops = (outs MQPR:$Qd);
1246 let iops = (ins MQPR:$Qd_src, rGPR:$Rt);
1247 let ops = "$Qd$Idx, $Rt";
1248 let cstr = "$Qd = $Qd_src";
1251 class MVE_VMOV_lane<string suffix, bit U, dag indexop,
1252 MVE_VMOV_lane_direction dir>
1253 : MVE_VMOV_lane_base<dir.oops, !con(dir.iops, indexop), NoItinerary,
1254 "vmov", suffix, dir.ops, dir.cstr, []> {
1258 let Inst{31-24} = 0b11101110;
1260 let Inst{20} = dir.bit_20;
1261 let Inst{19-17} = Qd{2-0};
1262 let Inst{15-12} = Rt{3-0};
1263 let Inst{11-8} = 0b1011;
1264 let Inst{7} = Qd{3};
1265 let Inst{4-0} = 0b10000;
1268 class MVE_VMOV_lane_32<MVE_VMOV_lane_direction dir>
1269 : MVE_VMOV_lane<"32", 0b0, (ins MVEVectorIndex<4>:$Idx), dir> {
1272 let Inst{6-5} = 0b00;
1273 let Inst{16} = Idx{1};
1274 let Inst{21} = Idx{0};
1276 let Predicates = [HasFPRegsV8_1M];
1279 class MVE_VMOV_lane_16<string suffix, bit U, MVE_VMOV_lane_direction dir>
1280 : MVE_VMOV_lane<suffix, U, (ins MVEVectorIndex<8>:$Idx), dir> {
1284 let Inst{16} = Idx{2};
1285 let Inst{21} = Idx{1};
1286 let Inst{6} = Idx{0};
1289 class MVE_VMOV_lane_8<string suffix, bit U, MVE_VMOV_lane_direction dir>
1290 : MVE_VMOV_lane<suffix, U, (ins MVEVectorIndex<16>:$Idx), dir> {
1293 let Inst{16} = Idx{3};
1294 let Inst{21} = Idx{2};
1295 let Inst{6} = Idx{1};
1296 let Inst{5} = Idx{0};
1299 def MVE_VMOV_from_lane_32 : MVE_VMOV_lane_32< MVE_VMOV_from_lane>;
1300 def MVE_VMOV_to_lane_32 : MVE_VMOV_lane_32< MVE_VMOV_to_lane>;
1301 def MVE_VMOV_from_lane_s16 : MVE_VMOV_lane_16<"s16", 0b0, MVE_VMOV_from_lane>;
1302 def MVE_VMOV_from_lane_u16 : MVE_VMOV_lane_16<"u16", 0b1, MVE_VMOV_from_lane>;
1303 def MVE_VMOV_to_lane_16 : MVE_VMOV_lane_16< "16", 0b0, MVE_VMOV_to_lane>;
1304 def MVE_VMOV_from_lane_s8 : MVE_VMOV_lane_8 < "s8", 0b0, MVE_VMOV_from_lane>;
1305 def MVE_VMOV_from_lane_u8 : MVE_VMOV_lane_8 < "u8", 0b1, MVE_VMOV_from_lane>;
1306 def MVE_VMOV_to_lane_8 : MVE_VMOV_lane_8 < "8", 0b0, MVE_VMOV_to_lane>;
1308 let Predicates = [HasMVEInt] in {
1309 def : Pat<(extractelt (v2f64 MQPR:$src), imm:$lane),
1310 (f64 (EXTRACT_SUBREG MQPR:$src, (DSubReg_f64_reg imm:$lane)))>;
1311 def : Pat<(insertelt (v2f64 MQPR:$src1), DPR:$src2, imm:$lane),
1312 (INSERT_SUBREG (v2f64 (COPY_TO_REGCLASS MQPR:$src1, MQPR)), DPR:$src2, (DSubReg_f64_reg imm:$lane))>;
1314 def : Pat<(extractelt (v4i32 MQPR:$src), imm:$lane),
1316 (i32 (EXTRACT_SUBREG MQPR:$src, (SSubReg_f32_reg imm:$lane))), rGPR)>;
1317 def : Pat<(insertelt (v4i32 MQPR:$src1), rGPR:$src2, imm:$lane),
1318 (MVE_VMOV_to_lane_32 MQPR:$src1, rGPR:$src2, imm:$lane)>;
1320 def : Pat<(vector_insert (v16i8 MQPR:$src1), rGPR:$src2, imm:$lane),
1321 (MVE_VMOV_to_lane_8 MQPR:$src1, rGPR:$src2, imm:$lane)>;
1322 def : Pat<(vector_insert (v8i16 MQPR:$src1), rGPR:$src2, imm:$lane),
1323 (MVE_VMOV_to_lane_16 MQPR:$src1, rGPR:$src2, imm:$lane)>;
1325 def : Pat<(ARMvgetlanes (v16i8 MQPR:$src), imm:$lane),
1326 (MVE_VMOV_from_lane_s8 MQPR:$src, imm:$lane)>;
1327 def : Pat<(ARMvgetlanes (v8i16 MQPR:$src), imm:$lane),
1328 (MVE_VMOV_from_lane_s16 MQPR:$src, imm:$lane)>;
1329 def : Pat<(ARMvgetlaneu (v16i8 MQPR:$src), imm:$lane),
1330 (MVE_VMOV_from_lane_u8 MQPR:$src, imm:$lane)>;
1331 def : Pat<(ARMvgetlaneu (v8i16 MQPR:$src), imm:$lane),
1332 (MVE_VMOV_from_lane_u16 MQPR:$src, imm:$lane)>;
1334 def : Pat<(v16i8 (scalar_to_vector GPR:$src)),
1335 (MVE_VMOV_to_lane_8 (v16i8 (IMPLICIT_DEF)), rGPR:$src, (i32 0))>;
1336 def : Pat<(v8i16 (scalar_to_vector GPR:$src)),
1337 (MVE_VMOV_to_lane_16 (v8i16 (IMPLICIT_DEF)), rGPR:$src, (i32 0))>;
1338 def : Pat<(v4i32 (scalar_to_vector GPR:$src)),
1339 (MVE_VMOV_to_lane_32 (v4i32 (IMPLICIT_DEF)), rGPR:$src, (i32 0))>;
1341 // Floating point patterns, still enabled under HasMVEInt
1342 def : Pat<(extractelt (v4f32 MQPR:$src), imm:$lane),
1343 (COPY_TO_REGCLASS (f32 (EXTRACT_SUBREG MQPR:$src, (SSubReg_f32_reg imm:$lane))), SPR)>;
1344 def : Pat<(insertelt (v4f32 MQPR:$src1), (f32 SPR:$src2), imm:$lane),
1345 (INSERT_SUBREG (v4f32 (COPY_TO_REGCLASS MQPR:$src1, MQPR)), SPR:$src2, (SSubReg_f32_reg imm:$lane))>;
1347 def : Pat<(insertelt (v8f16 MQPR:$src1), HPR:$src2, imm:$lane),
1348 (MVE_VMOV_to_lane_16 MQPR:$src1, (COPY_TO_REGCLASS HPR:$src2, rGPR), imm:$lane)>;
1349 def : Pat<(extractelt (v8f16 MQPR:$src), imm_even:$lane),
1350 (EXTRACT_SUBREG MQPR:$src, (SSubReg_f16_reg imm_even:$lane))>;
1351 def : Pat<(extractelt (v8f16 MQPR:$src), imm_odd:$lane),
1353 (VMOVH (EXTRACT_SUBREG MQPR:$src, (SSubReg_f16_reg imm_odd:$lane))),
1356 def : Pat<(v4f32 (scalar_to_vector SPR:$src)),
1357 (INSERT_SUBREG (v4f32 (IMPLICIT_DEF)), SPR:$src, ssub_0)>;
1358 def : Pat<(v4f32 (scalar_to_vector GPR:$src)),
1359 (MVE_VMOV_to_lane_32 (v4f32 (IMPLICIT_DEF)), rGPR:$src, (i32 0))>;
1360 def : Pat<(v8f16 (scalar_to_vector HPR:$src)),
1361 (INSERT_SUBREG (v8f16 (IMPLICIT_DEF)), HPR:$src, ssub_0)>;
1362 def : Pat<(v8f16 (scalar_to_vector GPR:$src)),
1363 (MVE_VMOV_to_lane_16 (v8f16 (IMPLICIT_DEF)), rGPR:$src, (i32 0))>;
1366 // end of mve_bit instructions
1368 // start of MVE Integer instructions
1370 class MVE_int<string iname, string suffix, bits<2> size, list<dag> pattern=[]>
1371 : MVE_p<(outs MQPR:$Qd), (ins MQPR:$Qn, MQPR:$Qm), NoItinerary,
1372 iname, suffix, "$Qd, $Qn, $Qm", vpred_r, "", pattern> {
1377 let Inst{22} = Qd{3};
1378 let Inst{21-20} = size;
1379 let Inst{19-17} = Qn{2-0};
1380 let Inst{15-13} = Qd{2-0};
1381 let Inst{7} = Qn{3};
1383 let Inst{5} = Qm{3};
1384 let Inst{3-1} = Qm{2-0};
1387 class MVE_VMULt1<string suffix, bits<2> size, list<dag> pattern=[]>
1388 : MVE_int<"vmul", suffix, size, pattern> {
1391 let Inst{25-23} = 0b110;
1393 let Inst{12-8} = 0b01001;
1398 def MVE_VMULt1i8 : MVE_VMULt1<"i8", 0b00>;
1399 def MVE_VMULt1i16 : MVE_VMULt1<"i16", 0b01>;
1400 def MVE_VMULt1i32 : MVE_VMULt1<"i32", 0b10>;
1402 let Predicates = [HasMVEInt] in {
1403 def : Pat<(v16i8 (mul (v16i8 MQPR:$val1), (v16i8 MQPR:$val2))),
1404 (v16i8 (MVE_VMULt1i8 (v16i8 MQPR:$val1), (v16i8 MQPR:$val2)))>;
1405 def : Pat<(v8i16 (mul (v8i16 MQPR:$val1), (v8i16 MQPR:$val2))),
1406 (v8i16 (MVE_VMULt1i16 (v8i16 MQPR:$val1), (v8i16 MQPR:$val2)))>;
1407 def : Pat<(v4i32 (mul (v4i32 MQPR:$val1), (v4i32 MQPR:$val2))),
1408 (v4i32 (MVE_VMULt1i32 (v4i32 MQPR:$val1), (v4i32 MQPR:$val2)))>;
1411 class MVE_VQxDMULH<string iname, string suffix, bits<2> size, bit rounding,
1412 list<dag> pattern=[]>
1413 : MVE_int<iname, suffix, size, pattern> {
1415 let Inst{28} = rounding;
1416 let Inst{25-23} = 0b110;
1418 let Inst{12-8} = 0b01011;
1423 class MVE_VQDMULH<string suffix, bits<2> size, list<dag> pattern=[]>
1424 : MVE_VQxDMULH<"vqdmulh", suffix, size, 0b0, pattern>;
1425 class MVE_VQRDMULH<string suffix, bits<2> size, list<dag> pattern=[]>
1426 : MVE_VQxDMULH<"vqrdmulh", suffix, size, 0b1, pattern>;
1428 def MVE_VQDMULHi8 : MVE_VQDMULH<"s8", 0b00>;
1429 def MVE_VQDMULHi16 : MVE_VQDMULH<"s16", 0b01>;
1430 def MVE_VQDMULHi32 : MVE_VQDMULH<"s32", 0b10>;
1432 def MVE_VQRDMULHi8 : MVE_VQRDMULH<"s8", 0b00>;
1433 def MVE_VQRDMULHi16 : MVE_VQRDMULH<"s16", 0b01>;
1434 def MVE_VQRDMULHi32 : MVE_VQRDMULH<"s32", 0b10>;
1436 class MVE_VADDSUB<string iname, string suffix, bits<2> size, bit subtract,
1437 list<dag> pattern=[]>
1438 : MVE_int<iname, suffix, size, pattern> {
1440 let Inst{28} = subtract;
1441 let Inst{25-23} = 0b110;
1443 let Inst{12-8} = 0b01000;
1448 class MVE_VADD<string suffix, bits<2> size, list<dag> pattern=[]>
1449 : MVE_VADDSUB<"vadd", suffix, size, 0b0, pattern>;
1450 class MVE_VSUB<string suffix, bits<2> size, list<dag> pattern=[]>
1451 : MVE_VADDSUB<"vsub", suffix, size, 0b1, pattern>;
1453 def MVE_VADDi8 : MVE_VADD<"i8", 0b00>;
1454 def MVE_VADDi16 : MVE_VADD<"i16", 0b01>;
1455 def MVE_VADDi32 : MVE_VADD<"i32", 0b10>;
1457 let Predicates = [HasMVEInt] in {
1458 def : Pat<(v16i8 (add (v16i8 MQPR:$val1), (v16i8 MQPR:$val2))),
1459 (v16i8 (MVE_VADDi8 (v16i8 MQPR:$val1), (v16i8 MQPR:$val2)))>;
1460 def : Pat<(v8i16 (add (v8i16 MQPR:$val1), (v8i16 MQPR:$val2))),
1461 (v8i16 (MVE_VADDi16 (v8i16 MQPR:$val1), (v8i16 MQPR:$val2)))>;
1462 def : Pat<(v4i32 (add (v4i32 MQPR:$val1), (v4i32 MQPR:$val2))),
1463 (v4i32 (MVE_VADDi32 (v4i32 MQPR:$val1), (v4i32 MQPR:$val2)))>;
1466 def MVE_VSUBi8 : MVE_VSUB<"i8", 0b00>;
1467 def MVE_VSUBi16 : MVE_VSUB<"i16", 0b01>;
1468 def MVE_VSUBi32 : MVE_VSUB<"i32", 0b10>;
1470 let Predicates = [HasMVEInt] in {
1471 def : Pat<(v16i8 (sub (v16i8 MQPR:$val1), (v16i8 MQPR:$val2))),
1472 (v16i8 (MVE_VSUBi8 (v16i8 MQPR:$val1), (v16i8 MQPR:$val2)))>;
1473 def : Pat<(v8i16 (sub (v8i16 MQPR:$val1), (v8i16 MQPR:$val2))),
1474 (v8i16 (MVE_VSUBi16 (v8i16 MQPR:$val1), (v8i16 MQPR:$val2)))>;
1475 def : Pat<(v4i32 (sub (v4i32 MQPR:$val1), (v4i32 MQPR:$val2))),
1476 (v4i32 (MVE_VSUBi32 (v4i32 MQPR:$val1), (v4i32 MQPR:$val2)))>;
1479 class MVE_VQADDSUB<string iname, string suffix, bit U, bit subtract,
1480 bits<2> size, list<dag> pattern=[]>
1481 : MVE_int<iname, suffix, size, pattern> {
1484 let Inst{25-23} = 0b110;
1486 let Inst{12-10} = 0b000;
1487 let Inst{9} = subtract;
1493 class MVE_VQADD<string suffix, bit U, bits<2> size, list<dag> pattern=[]>
1494 : MVE_VQADDSUB<"vqadd", suffix, U, 0b0, size, pattern>;
1495 class MVE_VQSUB<string suffix, bit U, bits<2> size, list<dag> pattern=[]>
1496 : MVE_VQADDSUB<"vqsub", suffix, U, 0b1, size, pattern>;
1498 def MVE_VQADDs8 : MVE_VQADD<"s8", 0b0, 0b00>;
1499 def MVE_VQADDs16 : MVE_VQADD<"s16", 0b0, 0b01>;
1500 def MVE_VQADDs32 : MVE_VQADD<"s32", 0b0, 0b10>;
1501 def MVE_VQADDu8 : MVE_VQADD<"u8", 0b1, 0b00>;
1502 def MVE_VQADDu16 : MVE_VQADD<"u16", 0b1, 0b01>;
1503 def MVE_VQADDu32 : MVE_VQADD<"u32", 0b1, 0b10>;
1505 def MVE_VQSUBs8 : MVE_VQSUB<"s8", 0b0, 0b00>;
1506 def MVE_VQSUBs16 : MVE_VQSUB<"s16", 0b0, 0b01>;
1507 def MVE_VQSUBs32 : MVE_VQSUB<"s32", 0b0, 0b10>;
1508 def MVE_VQSUBu8 : MVE_VQSUB<"u8", 0b1, 0b00>;
1509 def MVE_VQSUBu16 : MVE_VQSUB<"u16", 0b1, 0b01>;
1510 def MVE_VQSUBu32 : MVE_VQSUB<"u32", 0b1, 0b10>;
1512 class MVE_VABD_int<string suffix, bit U, bits<2> size, list<dag> pattern=[]>
1513 : MVE_int<"vabd", suffix, size, pattern> {
1516 let Inst{25-23} = 0b110;
1518 let Inst{12-8} = 0b00111;
1523 def MVE_VABDs8 : MVE_VABD_int<"s8", 0b0, 0b00>;
1524 def MVE_VABDs16 : MVE_VABD_int<"s16", 0b0, 0b01>;
1525 def MVE_VABDs32 : MVE_VABD_int<"s32", 0b0, 0b10>;
1526 def MVE_VABDu8 : MVE_VABD_int<"u8", 0b1, 0b00>;
1527 def MVE_VABDu16 : MVE_VABD_int<"u16", 0b1, 0b01>;
1528 def MVE_VABDu32 : MVE_VABD_int<"u32", 0b1, 0b10>;
1530 class MVE_VRHADD<string suffix, bit U, bits<2> size, list<dag> pattern=[]>
1531 : MVE_int<"vrhadd", suffix, size, pattern> {
1534 let Inst{25-23} = 0b110;
1536 let Inst{12-8} = 0b00001;
1541 def MVE_VRHADDs8 : MVE_VRHADD<"s8", 0b0, 0b00>;
1542 def MVE_VRHADDs16 : MVE_VRHADD<"s16", 0b0, 0b01>;
1543 def MVE_VRHADDs32 : MVE_VRHADD<"s32", 0b0, 0b10>;
1544 def MVE_VRHADDu8 : MVE_VRHADD<"u8", 0b1, 0b00>;
1545 def MVE_VRHADDu16 : MVE_VRHADD<"u16", 0b1, 0b01>;
1546 def MVE_VRHADDu32 : MVE_VRHADD<"u32", 0b1, 0b10>;
1548 class MVE_VHADDSUB<string iname, string suffix, bit U, bit subtract,
1549 bits<2> size, list<dag> pattern=[]>
1550 : MVE_int<iname, suffix, size, pattern> {
1553 let Inst{25-23} = 0b110;
1555 let Inst{12-10} = 0b000;
1556 let Inst{9} = subtract;
1562 class MVE_VHADD<string suffix, bit U, bits<2> size,
1563 list<dag> pattern=[]>
1564 : MVE_VHADDSUB<"vhadd", suffix, U, 0b0, size, pattern>;
1565 class MVE_VHSUB<string suffix, bit U, bits<2> size,
1566 list<dag> pattern=[]>
1567 : MVE_VHADDSUB<"vhsub", suffix, U, 0b1, size, pattern>;
1569 def MVE_VHADDs8 : MVE_VHADD<"s8", 0b0, 0b00>;
1570 def MVE_VHADDs16 : MVE_VHADD<"s16", 0b0, 0b01>;
1571 def MVE_VHADDs32 : MVE_VHADD<"s32", 0b0, 0b10>;
1572 def MVE_VHADDu8 : MVE_VHADD<"u8", 0b1, 0b00>;
1573 def MVE_VHADDu16 : MVE_VHADD<"u16", 0b1, 0b01>;
1574 def MVE_VHADDu32 : MVE_VHADD<"u32", 0b1, 0b10>;
1576 def MVE_VHSUBs8 : MVE_VHSUB<"s8", 0b0, 0b00>;
1577 def MVE_VHSUBs16 : MVE_VHSUB<"s16", 0b0, 0b01>;
1578 def MVE_VHSUBs32 : MVE_VHSUB<"s32", 0b0, 0b10>;
1579 def MVE_VHSUBu8 : MVE_VHSUB<"u8", 0b1, 0b00>;
1580 def MVE_VHSUBu16 : MVE_VHSUB<"u16", 0b1, 0b01>;
1581 def MVE_VHSUBu32 : MVE_VHSUB<"u32", 0b1, 0b10>;
1583 let Predicates = [HasMVEInt] in {
1584 def : Pat<(v16i8 (ARMvshrsImm
1585 (v16i8 (add (v16i8 MQPR:$v1), (v16i8 MQPR:$v2))), 1)),
1587 (v16i8 MQPR:$v1), (v16i8 MQPR:$v2)))>;
1588 def : Pat<(v8i16 (ARMvshrsImm
1589 (v8i16 (add (v8i16 MQPR:$v1), (v8i16 MQPR:$v2))), 1)),
1590 (v8i16 (MVE_VHADDs16
1591 (v8i16 MQPR:$v1), (v8i16 MQPR:$v2)))>;
1592 def : Pat<(v4i32 (ARMvshrsImm
1593 (v4i32 (add (v4i32 MQPR:$v1), (v4i32 MQPR:$v2))), 1)),
1594 (v4i32 (MVE_VHADDs32
1595 (v4i32 MQPR:$v1), (v4i32 MQPR:$v2)))>;
1597 def : Pat<(v16i8 (ARMvshruImm
1598 (v16i8 (add (v16i8 MQPR:$v1), (v16i8 MQPR:$v2))), 1)),
1600 (v16i8 MQPR:$v1), (v16i8 MQPR:$v2)))>;
1601 def : Pat<(v8i16 (ARMvshruImm
1602 (v8i16 (add (v8i16 MQPR:$v1), (v8i16 MQPR:$v2))), 1)),
1603 (v8i16 (MVE_VHADDu16
1604 (v8i16 MQPR:$v1), (v8i16 MQPR:$v2)))>;
1605 def : Pat<(v4i32 (ARMvshruImm
1606 (v4i32 (add (v4i32 MQPR:$v1), (v4i32 MQPR:$v2))), 1)),
1607 (v4i32 (MVE_VHADDu32
1608 (v4i32 MQPR:$v1), (v4i32 MQPR:$v2)))>;
1610 def : Pat<(v16i8 (ARMvshrsImm
1611 (v16i8 (sub (v16i8 MQPR:$v1), (v16i8 MQPR:$v2))), 1)),
1613 (v16i8 MQPR:$v1), (v16i8 MQPR:$v2)))>;
1614 def : Pat<(v8i16 (ARMvshrsImm
1615 (v8i16 (sub (v8i16 MQPR:$v1), (v8i16 MQPR:$v2))), 1)),
1616 (v8i16 (MVE_VHSUBs16
1617 (v8i16 MQPR:$v1), (v8i16 MQPR:$v2)))>;
1618 def : Pat<(v4i32 (ARMvshrsImm
1619 (v4i32 (sub (v4i32 MQPR:$v1), (v4i32 MQPR:$v2))), 1)),
1620 (v4i32 (MVE_VHSUBs32
1621 (v4i32 MQPR:$v1), (v4i32 MQPR:$v2)))>;
1623 def : Pat<(v16i8 (ARMvshruImm
1624 (v16i8 (sub (v16i8 MQPR:$v1), (v16i8 MQPR:$v2))), 1)),
1626 (v16i8 MQPR:$v1), (v16i8 MQPR:$v2)))>;
1627 def : Pat<(v8i16 (ARMvshruImm
1628 (v8i16 (sub (v8i16 MQPR:$v1), (v8i16 MQPR:$v2))), 1)),
1629 (v8i16 (MVE_VHSUBu16
1630 (v8i16 MQPR:$v1), (v8i16 MQPR:$v2)))>;
1631 def : Pat<(v4i32 (ARMvshruImm
1632 (v4i32 (sub (v4i32 MQPR:$v1), (v4i32 MQPR:$v2))), 1)),
1633 (v4i32 (MVE_VHSUBu32
1634 (v4i32 MQPR:$v1), (v4i32 MQPR:$v2)))>;
1637 class MVE_VDUP<string suffix, bit B, bit E, list<dag> pattern=[]>
1638 : MVE_p<(outs MQPR:$Qd), (ins rGPR:$Rt), NoItinerary,
1639 "vdup", suffix, "$Qd, $Rt", vpred_r, "", pattern> {
1644 let Inst{25-23} = 0b101;
1646 let Inst{21-20} = 0b10;
1647 let Inst{19-17} = Qd{2-0};
1649 let Inst{15-12} = Rt;
1650 let Inst{11-8} = 0b1011;
1651 let Inst{7} = Qd{3};
1654 let Inst{4-0} = 0b10000;
1657 def MVE_VDUP32 : MVE_VDUP<"32", 0b0, 0b0>;
1658 def MVE_VDUP16 : MVE_VDUP<"16", 0b0, 0b1>;
1659 def MVE_VDUP8 : MVE_VDUP<"8", 0b1, 0b0>;
1661 let Predicates = [HasMVEInt] in {
1662 def : Pat<(v16i8 (ARMvdup (i32 rGPR:$elem))),
1663 (MVE_VDUP8 rGPR:$elem)>;
1664 def : Pat<(v8i16 (ARMvdup (i32 rGPR:$elem))),
1665 (MVE_VDUP16 rGPR:$elem)>;
1666 def : Pat<(v4i32 (ARMvdup (i32 rGPR:$elem))),
1667 (MVE_VDUP32 rGPR:$elem)>;
1669 def : Pat<(v4i32 (ARMvduplane (v4i32 MQPR:$src), imm:$lane)),
1670 (MVE_VDUP32 (MVE_VMOV_from_lane_32 MQPR:$src, imm:$lane))>;
1671 // For the 16-bit and 8-bit vduplanes we don't care about the signedness
1672 // of the lane move operation as we only want the lowest 8/16 bits anyway.
1673 def : Pat<(v8i16 (ARMvduplane (v8i16 MQPR:$src), imm:$lane)),
1674 (MVE_VDUP16 (MVE_VMOV_from_lane_u16 MQPR:$src, imm:$lane))>;
1675 def : Pat<(v16i8 (ARMvduplane (v16i8 MQPR:$src), imm:$lane)),
1676 (MVE_VDUP8 (MVE_VMOV_from_lane_u8 MQPR:$src, imm:$lane))>;
1678 def : Pat<(v4f32 (ARMvdup (f32 SPR:$elem))),
1679 (v4f32 (MVE_VDUP32 (i32 (COPY_TO_REGCLASS (f32 SPR:$elem), rGPR))))>;
1680 def : Pat<(v8f16 (ARMvdup (f16 HPR:$elem))),
1681 (v8f16 (MVE_VDUP16 (i32 (COPY_TO_REGCLASS (f16 HPR:$elem), rGPR))))>;
1683 def : Pat<(v4f32 (ARMvduplane (v4f32 MQPR:$src), imm:$lane)),
1684 (MVE_VDUP32 (MVE_VMOV_from_lane_32 MQPR:$src, imm:$lane))>;
1685 def : Pat<(v8f16 (ARMvduplane (v8f16 MQPR:$src), imm:$lane)),
1686 (MVE_VDUP16 (MVE_VMOV_from_lane_u16 MQPR:$src, imm:$lane))>;
1690 class MVEIntSingleSrc<string iname, string suffix, bits<2> size,
1691 list<dag> pattern=[]>
1692 : MVE_p<(outs MQPR:$Qd), (ins MQPR:$Qm), NoItinerary,
1693 iname, suffix, "$Qd, $Qm", vpred_r, "", pattern> {
1697 let Inst{22} = Qd{3};
1698 let Inst{19-18} = size{1-0};
1699 let Inst{15-13} = Qd{2-0};
1700 let Inst{5} = Qm{3};
1701 let Inst{3-1} = Qm{2-0};
1704 class MVE_VCLSCLZ<string iname, string suffix, bits<2> size,
1705 bit count_zeroes, list<dag> pattern=[]>
1706 : MVEIntSingleSrc<iname, suffix, size, pattern> {
1709 let Inst{25-23} = 0b111;
1710 let Inst{21-20} = 0b11;
1711 let Inst{17-16} = 0b00;
1712 let Inst{12-8} = 0b00100;
1713 let Inst{7} = count_zeroes;
1719 def MVE_VCLSs8 : MVE_VCLSCLZ<"vcls", "s8", 0b00, 0b0>;
1720 def MVE_VCLSs16 : MVE_VCLSCLZ<"vcls", "s16", 0b01, 0b0>;
1721 def MVE_VCLSs32 : MVE_VCLSCLZ<"vcls", "s32", 0b10, 0b0>;
1723 def MVE_VCLZs8 : MVE_VCLSCLZ<"vclz", "i8", 0b00, 0b1>;
1724 def MVE_VCLZs16 : MVE_VCLSCLZ<"vclz", "i16", 0b01, 0b1>;
1725 def MVE_VCLZs32 : MVE_VCLSCLZ<"vclz", "i32", 0b10, 0b1>;
1727 class MVE_VABSNEG_int<string iname, string suffix, bits<2> size, bit negate,
1728 list<dag> pattern=[]>
1729 : MVEIntSingleSrc<iname, suffix, size, pattern> {
1732 let Inst{25-23} = 0b111;
1733 let Inst{21-20} = 0b11;
1734 let Inst{17-16} = 0b01;
1735 let Inst{12-8} = 0b00011;
1736 let Inst{7} = negate;
1742 def MVE_VABSs8 : MVE_VABSNEG_int<"vabs", "s8", 0b00, 0b0>;
1743 def MVE_VABSs16 : MVE_VABSNEG_int<"vabs", "s16", 0b01, 0b0>;
1744 def MVE_VABSs32 : MVE_VABSNEG_int<"vabs", "s32", 0b10, 0b0>;
1746 let Predicates = [HasMVEInt] in {
1747 def : Pat<(v16i8 (abs (v16i8 MQPR:$v))),
1748 (v16i8 (MVE_VABSs8 $v))>;
1749 def : Pat<(v8i16 (abs (v8i16 MQPR:$v))),
1750 (v8i16 (MVE_VABSs16 $v))>;
1751 def : Pat<(v4i32 (abs (v4i32 MQPR:$v))),
1752 (v4i32 (MVE_VABSs32 $v))>;
1755 def MVE_VNEGs8 : MVE_VABSNEG_int<"vneg", "s8", 0b00, 0b1>;
1756 def MVE_VNEGs16 : MVE_VABSNEG_int<"vneg", "s16", 0b01, 0b1>;
1757 def MVE_VNEGs32 : MVE_VABSNEG_int<"vneg", "s32", 0b10, 0b1>;
1759 let Predicates = [HasMVEInt] in {
1760 def : Pat<(v16i8 (vnegq (v16i8 MQPR:$v))),
1761 (v16i8 (MVE_VNEGs8 $v))>;
1762 def : Pat<(v8i16 (vnegq (v8i16 MQPR:$v))),
1763 (v8i16 (MVE_VNEGs16 $v))>;
1764 def : Pat<(v4i32 (vnegq (v4i32 MQPR:$v))),
1765 (v4i32 (MVE_VNEGs32 $v))>;
1768 class MVE_VQABSNEG<string iname, string suffix, bits<2> size,
1769 bit negate, list<dag> pattern=[]>
1770 : MVEIntSingleSrc<iname, suffix, size, pattern> {
1773 let Inst{25-23} = 0b111;
1774 let Inst{21-20} = 0b11;
1775 let Inst{17-16} = 0b00;
1776 let Inst{12-8} = 0b00111;
1777 let Inst{7} = negate;
1783 def MVE_VQABSs8 : MVE_VQABSNEG<"vqabs", "s8", 0b00, 0b0>;
1784 def MVE_VQABSs16 : MVE_VQABSNEG<"vqabs", "s16", 0b01, 0b0>;
1785 def MVE_VQABSs32 : MVE_VQABSNEG<"vqabs", "s32", 0b10, 0b0>;
1787 def MVE_VQNEGs8 : MVE_VQABSNEG<"vqneg", "s8", 0b00, 0b1>;
1788 def MVE_VQNEGs16 : MVE_VQABSNEG<"vqneg", "s16", 0b01, 0b1>;
1789 def MVE_VQNEGs32 : MVE_VQABSNEG<"vqneg", "s32", 0b10, 0b1>;
1791 class MVE_mod_imm<string iname, string suffix, bits<4> cmode, bit op,
1792 dag iops, list<dag> pattern=[]>
1793 : MVE_p<(outs MQPR:$Qd), iops, NoItinerary, iname, suffix, "$Qd, $imm",
1794 vpred_r, "", pattern> {
1798 let Inst{28} = imm{7};
1799 let Inst{25-23} = 0b111;
1800 let Inst{22} = Qd{3};
1801 let Inst{21-19} = 0b000;
1802 let Inst{18-16} = imm{6-4};
1803 let Inst{15-13} = Qd{2-0};
1805 let Inst{11-8} = cmode{3-0};
1806 let Inst{7-6} = 0b01;
1809 let Inst{3-0} = imm{3-0};
1811 let DecoderMethod = "DecodeMVEModImmInstruction";
1814 let isReMaterializable = 1 in {
1815 let isAsCheapAsAMove = 1 in {
1816 def MVE_VMOVimmi8 : MVE_mod_imm<"vmov", "i8", {1,1,1,0}, 0b0, (ins nImmSplatI8:$imm)>;
1817 def MVE_VMOVimmi16 : MVE_mod_imm<"vmov", "i16", {1,0,?,0}, 0b0, (ins nImmSplatI16:$imm)> {
1818 let Inst{9} = imm{9};
1820 def MVE_VMOVimmi32 : MVE_mod_imm<"vmov", "i32", {?,?,?,?}, 0b0, (ins nImmVMOVI32:$imm)> {
1821 let Inst{11-8} = imm{11-8};
1823 def MVE_VMOVimmi64 : MVE_mod_imm<"vmov", "i64", {1,1,1,0}, 0b1, (ins nImmSplatI64:$imm)>;
1824 def MVE_VMOVimmf32 : MVE_mod_imm<"vmov", "f32", {1,1,1,1}, 0b0, (ins nImmVMOVF32:$imm)>;
1825 } // let isAsCheapAsAMove = 1
1827 def MVE_VMVNimmi16 : MVE_mod_imm<"vmvn", "i16", {1,0,?,0}, 0b1, (ins nImmSplatI16:$imm)> {
1828 let Inst{9} = imm{9};
1830 def MVE_VMVNimmi32 : MVE_mod_imm<"vmvn", "i32", {?,?,?,?}, 0b1, (ins nImmVMOVI32:$imm)> {
1831 let Inst{11-8} = imm{11-8};
1833 } // let isReMaterializable = 1
1835 let Predicates = [HasMVEInt] in {
1836 def : Pat<(v16i8 (ARMvmovImm timm:$simm)),
1837 (v16i8 (MVE_VMOVimmi8 nImmSplatI8:$simm))>;
1838 def : Pat<(v8i16 (ARMvmovImm timm:$simm)),
1839 (v8i16 (MVE_VMOVimmi16 nImmSplatI16:$simm))>;
1840 def : Pat<(v4i32 (ARMvmovImm timm:$simm)),
1841 (v4i32 (MVE_VMOVimmi32 nImmVMOVI32:$simm))>;
1843 def : Pat<(v8i16 (ARMvmvnImm timm:$simm)),
1844 (v8i16 (MVE_VMVNimmi16 nImmSplatI16:$simm))>;
1845 def : Pat<(v4i32 (ARMvmvnImm timm:$simm)),
1846 (v4i32 (MVE_VMVNimmi32 nImmVMOVI32:$simm))>;
1848 def : Pat<(v4f32 (ARMvmovFPImm timm:$simm)),
1849 (v4f32 (MVE_VMOVimmf32 nImmVMOVF32:$simm))>;
1852 class MVE_VMINMAXA<string iname, string suffix, bits<2> size,
1853 bit bit_12, list<dag> pattern=[]>
1854 : MVE_p<(outs MQPR:$Qd), (ins MQPR:$Qd_src, MQPR:$Qm),
1855 NoItinerary, iname, suffix, "$Qd, $Qm", vpred_n, "$Qd = $Qd_src",
1861 let Inst{25-23} = 0b100;
1862 let Inst{22} = Qd{3};
1863 let Inst{21-20} = 0b11;
1864 let Inst{19-18} = size;
1865 let Inst{17-16} = 0b11;
1866 let Inst{15-13} = Qd{2-0};
1867 let Inst{12} = bit_12;
1868 let Inst{11-6} = 0b111010;
1869 let Inst{5} = Qm{3};
1871 let Inst{3-1} = Qm{2-0};
1875 def MVE_VMAXAs8 : MVE_VMINMAXA<"vmaxa", "s8", 0b00, 0b0>;
1876 def MVE_VMAXAs16 : MVE_VMINMAXA<"vmaxa", "s16", 0b01, 0b0>;
1877 def MVE_VMAXAs32 : MVE_VMINMAXA<"vmaxa", "s32", 0b10, 0b0>;
1879 def MVE_VMINAs8 : MVE_VMINMAXA<"vmina", "s8", 0b00, 0b1>;
1880 def MVE_VMINAs16 : MVE_VMINMAXA<"vmina", "s16", 0b01, 0b1>;
1881 def MVE_VMINAs32 : MVE_VMINMAXA<"vmina", "s32", 0b10, 0b1>;
1883 // end of MVE Integer instructions
1885 // start of mve_imm_shift instructions
1887 def MVE_VSHLC : MVE_p<(outs rGPR:$RdmDest, MQPR:$Qd),
1888 (ins MQPR:$QdSrc, rGPR:$RdmSrc, long_shift:$imm),
1889 NoItinerary, "vshlc", "", "$QdSrc, $RdmSrc, $imm",
1890 vpred_n, "$RdmDest = $RdmSrc,$Qd = $QdSrc"> {
1896 let Inst{25-23} = 0b101;
1897 let Inst{22} = Qd{3};
1899 let Inst{20-16} = imm{4-0};
1900 let Inst{15-13} = Qd{2-0};
1901 let Inst{12-4} = 0b011111100;
1902 let Inst{3-0} = RdmDest{3-0};
1905 class MVE_shift_imm<dag oops, dag iops, string iname, string suffix,
1906 string ops, vpred_ops vpred, string cstr,
1907 list<dag> pattern=[]>
1908 : MVE_p<oops, iops, NoItinerary, iname, suffix, ops, vpred, cstr, pattern> {
1912 let Inst{22} = Qd{3};
1913 let Inst{15-13} = Qd{2-0};
1914 let Inst{5} = Qm{3};
1915 let Inst{3-1} = Qm{2-0};
1918 class MVE_VMOVL<string iname, string suffix, bits<2> sz, bit U,
1919 list<dag> pattern=[]>
1920 : MVE_shift_imm<(outs MQPR:$Qd), (ins MQPR:$Qm),
1921 iname, suffix, "$Qd, $Qm", vpred_r, "",
1924 let Inst{25-23} = 0b101;
1926 let Inst{20-19} = sz{1-0};
1927 let Inst{18-16} = 0b000;
1928 let Inst{11-6} = 0b111101;
1933 multiclass MVE_VMOVL_shift_half<string iname, string suffix, bits<2> sz, bit U,
1934 list<dag> pattern=[]> {
1935 def bh : MVE_VMOVL<!strconcat(iname, "b"), suffix, sz, U, pattern> {
1938 def th : MVE_VMOVL<!strconcat(iname, "t"), suffix, sz, U, pattern> {
1943 defm MVE_VMOVLs8 : MVE_VMOVL_shift_half<"vmovl", "s8", 0b01, 0b0>;
1944 defm MVE_VMOVLu8 : MVE_VMOVL_shift_half<"vmovl", "u8", 0b01, 0b1>;
1945 defm MVE_VMOVLs16 : MVE_VMOVL_shift_half<"vmovl", "s16", 0b10, 0b0>;
1946 defm MVE_VMOVLu16 : MVE_VMOVL_shift_half<"vmovl", "u16", 0b10, 0b1>;
1948 let Predicates = [HasMVEInt] in {
1949 def : Pat<(sext_inreg (v4i32 MQPR:$src), v4i16),
1950 (MVE_VMOVLs16bh MQPR:$src)>;
1951 def : Pat<(sext_inreg (v8i16 MQPR:$src), v8i8),
1952 (MVE_VMOVLs8bh MQPR:$src)>;
1953 def : Pat<(sext_inreg (v4i32 MQPR:$src), v4i8),
1954 (MVE_VMOVLs16bh (MVE_VMOVLs8bh MQPR:$src))>;
1956 // zext_inreg 16 -> 32
1957 def : Pat<(and (v4i32 MQPR:$src), (v4i32 (ARMvmovImm (i32 0xCFF)))),
1958 (MVE_VMOVLu16bh MQPR:$src)>;
1959 // zext_inreg 8 -> 16
1960 def : Pat<(and (v8i16 MQPR:$src), (v8i16 (ARMvmovImm (i32 0x8FF)))),
1961 (MVE_VMOVLu8bh MQPR:$src)>;
1965 class MVE_VSHLL_imm<string iname, string suffix, bit U, bit th,
1966 dag immops, list<dag> pattern=[]>
1967 : MVE_shift_imm<(outs MQPR:$Qd), !con((ins MQPR:$Qm), immops),
1968 iname, suffix, "$Qd, $Qm, $imm", vpred_r, "", pattern> {
1970 let Inst{25-23} = 0b101;
1973 let Inst{11-6} = 0b111101;
1978 // The immediate VSHLL instructions accept shift counts from 1 up to
1979 // the lane width (8 or 16), but the full-width shifts have an
1980 // entirely separate encoding, given below with 'lw' in the name.
1982 class MVE_VSHLL_imm8<string iname, string suffix,
1983 bit U, bit th, list<dag> pattern=[]>
1984 : MVE_VSHLL_imm<iname, suffix, U, th, (ins mve_shift_imm1_7:$imm), pattern> {
1986 let Inst{20-19} = 0b01;
1987 let Inst{18-16} = imm;
1990 class MVE_VSHLL_imm16<string iname, string suffix,
1991 bit U, bit th, list<dag> pattern=[]>
1992 : MVE_VSHLL_imm<iname, suffix, U, th, (ins mve_shift_imm1_15:$imm), pattern> {
1995 let Inst{19-16} = imm;
1998 def MVE_VSHLL_imms8bh : MVE_VSHLL_imm8 <"vshllb", "s8", 0b0, 0b0>;
1999 def MVE_VSHLL_imms8th : MVE_VSHLL_imm8 <"vshllt", "s8", 0b0, 0b1>;
2000 def MVE_VSHLL_immu8bh : MVE_VSHLL_imm8 <"vshllb", "u8", 0b1, 0b0>;
2001 def MVE_VSHLL_immu8th : MVE_VSHLL_imm8 <"vshllt", "u8", 0b1, 0b1>;
2002 def MVE_VSHLL_imms16bh : MVE_VSHLL_imm16<"vshllb", "s16", 0b0, 0b0>;
2003 def MVE_VSHLL_imms16th : MVE_VSHLL_imm16<"vshllt", "s16", 0b0, 0b1>;
2004 def MVE_VSHLL_immu16bh : MVE_VSHLL_imm16<"vshllb", "u16", 0b1, 0b0>;
2005 def MVE_VSHLL_immu16th : MVE_VSHLL_imm16<"vshllt", "u16", 0b1, 0b1>;
2007 class MVE_VSHLL_by_lane_width<string iname, string suffix, bits<2> size,
2008 bit U, string ops, list<dag> pattern=[]>
2009 : MVE_shift_imm<(outs MQPR:$Qd), (ins MQPR:$Qm),
2010 iname, suffix, ops, vpred_r, "", pattern> {
2012 let Inst{25-23} = 0b100;
2013 let Inst{21-20} = 0b11;
2014 let Inst{19-18} = size{1-0};
2015 let Inst{17-16} = 0b01;
2016 let Inst{11-6} = 0b111000;
2021 multiclass MVE_VSHLL_lw<string iname, string suffix, bits<2> sz, bit U,
2022 string ops, list<dag> pattern=[]> {
2023 def bh : MVE_VSHLL_by_lane_width<iname#"b", suffix, sz, U, ops, pattern> {
2026 def th : MVE_VSHLL_by_lane_width<iname#"t", suffix, sz, U, ops, pattern> {
2031 defm MVE_VSHLL_lws8 : MVE_VSHLL_lw<"vshll", "s8", 0b00, 0b0, "$Qd, $Qm, #8">;
2032 defm MVE_VSHLL_lws16 : MVE_VSHLL_lw<"vshll", "s16", 0b01, 0b0, "$Qd, $Qm, #16">;
2033 defm MVE_VSHLL_lwu8 : MVE_VSHLL_lw<"vshll", "u8", 0b00, 0b1, "$Qd, $Qm, #8">;
2034 defm MVE_VSHLL_lwu16 : MVE_VSHLL_lw<"vshll", "u16", 0b01, 0b1, "$Qd, $Qm, #16">;
2036 class MVE_VxSHRN<string iname, string suffix, bit bit_12, bit bit_28,
2037 dag immops, list<dag> pattern=[]>
2038 : MVE_shift_imm<(outs MQPR:$Qd), !con((ins MQPR:$QdSrc, MQPR:$Qm), immops),
2039 iname, suffix, "$Qd, $Qm, $imm", vpred_n, "$Qd = $QdSrc",
2043 let Inst{28} = bit_28;
2044 let Inst{25-23} = 0b101;
2046 let Inst{20-16} = imm{4-0};
2047 let Inst{12} = bit_12;
2048 let Inst{11-6} = 0b111111;
2053 def MVE_VRSHRNi16bh : MVE_VxSHRN<
2054 "vrshrnb", "i16", 0b0, 0b1, (ins shr_imm8:$imm)> {
2055 let Inst{20-19} = 0b01;
2057 def MVE_VRSHRNi16th : MVE_VxSHRN<
2058 "vrshrnt", "i16", 0b1, 0b1,(ins shr_imm8:$imm)> {
2059 let Inst{20-19} = 0b01;
2061 def MVE_VRSHRNi32bh : MVE_VxSHRN<
2062 "vrshrnb", "i32", 0b0, 0b1, (ins shr_imm16:$imm)> {
2065 def MVE_VRSHRNi32th : MVE_VxSHRN<
2066 "vrshrnt", "i32", 0b1, 0b1, (ins shr_imm16:$imm)> {
2070 def MVE_VSHRNi16bh : MVE_VxSHRN<
2071 "vshrnb", "i16", 0b0, 0b0, (ins shr_imm8:$imm)> {
2072 let Inst{20-19} = 0b01;
2074 def MVE_VSHRNi16th : MVE_VxSHRN<
2075 "vshrnt", "i16", 0b1, 0b0, (ins shr_imm8:$imm)> {
2076 let Inst{20-19} = 0b01;
2078 def MVE_VSHRNi32bh : MVE_VxSHRN<
2079 "vshrnb", "i32", 0b0, 0b0, (ins shr_imm16:$imm)> {
2082 def MVE_VSHRNi32th : MVE_VxSHRN<
2083 "vshrnt", "i32", 0b1, 0b0, (ins shr_imm16:$imm)> {
2087 class MVE_VxQRSHRUN<string iname, string suffix, bit bit_28, bit bit_12, dag immops,
2088 list<dag> pattern=[]>
2089 : MVE_shift_imm<(outs MQPR:$Qd), !con((ins MQPR:$QdSrc, MQPR:$Qm), immops),
2090 iname, suffix, "$Qd, $Qm, $imm", vpred_n, "$Qd = $QdSrc",
2094 let Inst{28} = bit_28;
2095 let Inst{25-23} = 0b101;
2097 let Inst{20-16} = imm{4-0};
2098 let Inst{12} = bit_12;
2099 let Inst{11-6} = 0b111111;
2104 def MVE_VQRSHRUNs16bh : MVE_VxQRSHRUN<
2105 "vqrshrunb", "s16", 0b1, 0b0, (ins shr_imm8:$imm)> {
2106 let Inst{20-19} = 0b01;
2108 def MVE_VQRSHRUNs16th : MVE_VxQRSHRUN<
2109 "vqrshrunt", "s16", 0b1, 0b1, (ins shr_imm8:$imm)> {
2110 let Inst{20-19} = 0b01;
2112 def MVE_VQRSHRUNs32bh : MVE_VxQRSHRUN<
2113 "vqrshrunb", "s32", 0b1, 0b0, (ins shr_imm16:$imm)> {
2116 def MVE_VQRSHRUNs32th : MVE_VxQRSHRUN<
2117 "vqrshrunt", "s32", 0b1, 0b1, (ins shr_imm16:$imm)> {
2121 def MVE_VQSHRUNs16bh : MVE_VxQRSHRUN<
2122 "vqshrunb", "s16", 0b0, 0b0, (ins shr_imm8:$imm)> {
2123 let Inst{20-19} = 0b01;
2125 def MVE_VQSHRUNs16th : MVE_VxQRSHRUN<
2126 "vqshrunt", "s16", 0b0, 0b1, (ins shr_imm8:$imm)> {
2127 let Inst{20-19} = 0b01;
2129 def MVE_VQSHRUNs32bh : MVE_VxQRSHRUN<
2130 "vqshrunb", "s32", 0b0, 0b0, (ins shr_imm16:$imm)> {
2133 def MVE_VQSHRUNs32th : MVE_VxQRSHRUN<
2134 "vqshrunt", "s32", 0b0, 0b1, (ins shr_imm16:$imm)> {
2138 class MVE_VxQRSHRN<string iname, string suffix, bit bit_0, bit bit_12,
2139 dag immops, list<dag> pattern=[]>
2140 : MVE_shift_imm<(outs MQPR:$Qd), !con((ins MQPR:$QdSrc, MQPR:$Qm), immops),
2141 iname, suffix, "$Qd, $Qm, $imm", vpred_n, "$Qd = $QdSrc",
2145 let Inst{25-23} = 0b101;
2147 let Inst{20-16} = imm{4-0};
2148 let Inst{12} = bit_12;
2149 let Inst{11-6} = 0b111101;
2151 let Inst{0} = bit_0;
2154 multiclass MVE_VxQRSHRN_types<string iname, bit bit_0, bit bit_12> {
2155 def s16 : MVE_VxQRSHRN<iname, "s16", bit_0, bit_12, (ins shr_imm8:$imm)> {
2157 let Inst{20-19} = 0b01;
2159 def u16 : MVE_VxQRSHRN<iname, "u16", bit_0, bit_12, (ins shr_imm8:$imm)> {
2161 let Inst{20-19} = 0b01;
2163 def s32 : MVE_VxQRSHRN<iname, "s32", bit_0, bit_12, (ins shr_imm16:$imm)> {
2167 def u32 : MVE_VxQRSHRN<iname, "u32", bit_0, bit_12, (ins shr_imm16:$imm)> {
2173 defm MVE_VQRSHRNbh : MVE_VxQRSHRN_types<"vqrshrnb", 0b1, 0b0>;
2174 defm MVE_VQRSHRNth : MVE_VxQRSHRN_types<"vqrshrnt", 0b1, 0b1>;
2175 defm MVE_VQSHRNbh : MVE_VxQRSHRN_types<"vqshrnb", 0b0, 0b0>;
2176 defm MVE_VQSHRNth : MVE_VxQRSHRN_types<"vqshrnt", 0b0, 0b1>;
2178 // end of mve_imm_shift instructions
2180 // start of mve_shift instructions
2182 class MVE_shift_by_vec<string iname, string suffix, bit U,
2183 bits<2> size, bit bit_4, bit bit_8>
2184 : MVE_p<(outs MQPR:$Qd), (ins MQPR:$Qm, MQPR:$Qn), NoItinerary,
2185 iname, suffix, "$Qd, $Qm, $Qn", vpred_r, "", []> {
2186 // Shift instructions which take a vector of shift counts
2192 let Inst{25-24} = 0b11;
2194 let Inst{22} = Qd{3};
2195 let Inst{21-20} = size;
2196 let Inst{19-17} = Qn{2-0};
2198 let Inst{15-13} = Qd{2-0};
2199 let Inst{12-9} = 0b0010;
2200 let Inst{8} = bit_8;
2201 let Inst{7} = Qn{3};
2203 let Inst{5} = Qm{3};
2204 let Inst{4} = bit_4;
2205 let Inst{3-1} = Qm{2-0};
2209 multiclass mve_shift_by_vec_multi<string iname, bit bit_4, bit bit_8> {
2210 def s8 : MVE_shift_by_vec<iname, "s8", 0b0, 0b00, bit_4, bit_8>;
2211 def s16 : MVE_shift_by_vec<iname, "s16", 0b0, 0b01, bit_4, bit_8>;
2212 def s32 : MVE_shift_by_vec<iname, "s32", 0b0, 0b10, bit_4, bit_8>;
2213 def u8 : MVE_shift_by_vec<iname, "u8", 0b1, 0b00, bit_4, bit_8>;
2214 def u16 : MVE_shift_by_vec<iname, "u16", 0b1, 0b01, bit_4, bit_8>;
2215 def u32 : MVE_shift_by_vec<iname, "u32", 0b1, 0b10, bit_4, bit_8>;
2218 defm MVE_VSHL_by_vec : mve_shift_by_vec_multi<"vshl", 0b0, 0b0>;
2219 defm MVE_VQSHL_by_vec : mve_shift_by_vec_multi<"vqshl", 0b1, 0b0>;
2220 defm MVE_VQRSHL_by_vec : mve_shift_by_vec_multi<"vqrshl", 0b1, 0b1>;
2221 defm MVE_VRSHL_by_vec : mve_shift_by_vec_multi<"vrshl", 0b0, 0b1>;
2223 let Predicates = [HasMVEInt] in {
2224 def : Pat<(v4i32 (ARMvshlu (v4i32 MQPR:$Qm), (v4i32 MQPR:$Qn))),
2225 (v4i32 (MVE_VSHL_by_vecu32 (v4i32 MQPR:$Qm), (v4i32 MQPR:$Qn)))>;
2226 def : Pat<(v8i16 (ARMvshlu (v8i16 MQPR:$Qm), (v8i16 MQPR:$Qn))),
2227 (v8i16 (MVE_VSHL_by_vecu16 (v8i16 MQPR:$Qm), (v8i16 MQPR:$Qn)))>;
2228 def : Pat<(v16i8 (ARMvshlu (v16i8 MQPR:$Qm), (v16i8 MQPR:$Qn))),
2229 (v16i8 (MVE_VSHL_by_vecu8 (v16i8 MQPR:$Qm), (v16i8 MQPR:$Qn)))>;
2231 def : Pat<(v4i32 (ARMvshls (v4i32 MQPR:$Qm), (v4i32 MQPR:$Qn))),
2232 (v4i32 (MVE_VSHL_by_vecs32 (v4i32 MQPR:$Qm), (v4i32 MQPR:$Qn)))>;
2233 def : Pat<(v8i16 (ARMvshls (v8i16 MQPR:$Qm), (v8i16 MQPR:$Qn))),
2234 (v8i16 (MVE_VSHL_by_vecs16 (v8i16 MQPR:$Qm), (v8i16 MQPR:$Qn)))>;
2235 def : Pat<(v16i8 (ARMvshls (v16i8 MQPR:$Qm), (v16i8 MQPR:$Qn))),
2236 (v16i8 (MVE_VSHL_by_vecs8 (v16i8 MQPR:$Qm), (v16i8 MQPR:$Qn)))>;
2239 class MVE_shift_with_imm<string iname, string suffix, dag oops, dag iops,
2240 string ops, vpred_ops vpred, string cstr,
2241 list<dag> pattern=[]>
2242 : MVE_p<oops, iops, NoItinerary, iname, suffix, ops, vpred, cstr, pattern> {
2247 let Inst{22} = Qd{3};
2248 let Inst{15-13} = Qd{2-0};
2249 let Inst{12-11} = 0b00;
2250 let Inst{7-6} = 0b01;
2251 let Inst{5} = Qm{3};
2253 let Inst{3-1} = Qm{2-0};
2257 class MVE_VSxI_imm<string iname, string suffix, bit bit_8, dag imm>
2258 : MVE_shift_with_imm<iname, suffix, (outs MQPR:$Qd),
2259 !con((ins MQPR:$Qd_src, MQPR:$Qm), imm),
2260 "$Qd, $Qm, $imm", vpred_n, "$Qd = $Qd_src"> {
2263 let Inst{25-24} = 0b11;
2264 let Inst{21-16} = imm;
2265 let Inst{10-9} = 0b10;
2266 let Inst{8} = bit_8;
2269 def MVE_VSRIimm8 : MVE_VSxI_imm<"vsri", "8", 0b0, (ins shr_imm8:$imm)> {
2270 let Inst{21-19} = 0b001;
2273 def MVE_VSRIimm16 : MVE_VSxI_imm<"vsri", "16", 0b0, (ins shr_imm16:$imm)> {
2274 let Inst{21-20} = 0b01;
2277 def MVE_VSRIimm32 : MVE_VSxI_imm<"vsri", "32", 0b0, (ins shr_imm32:$imm)> {
2281 def MVE_VSLIimm8 : MVE_VSxI_imm<"vsli", "8", 0b1, (ins imm0_7:$imm)> {
2282 let Inst{21-19} = 0b001;
2285 def MVE_VSLIimm16 : MVE_VSxI_imm<"vsli", "16", 0b1, (ins imm0_15:$imm)> {
2286 let Inst{21-20} = 0b01;
2289 def MVE_VSLIimm32 : MVE_VSxI_imm<"vsli", "32", 0b1,(ins imm0_31:$imm)> {
2293 class MVE_VQSHL_imm<string suffix, dag imm>
2294 : MVE_shift_with_imm<"vqshl", suffix, (outs MQPR:$Qd),
2295 !con((ins MQPR:$Qm), imm), "$Qd, $Qm, $imm",
2299 let Inst{25-24} = 0b11;
2300 let Inst{21-16} = imm;
2301 let Inst{10-8} = 0b111;
2304 def MVE_VSLIimms8 : MVE_VQSHL_imm<"s8", (ins imm0_7:$imm)> {
2306 let Inst{21-19} = 0b001;
2309 def MVE_VSLIimmu8 : MVE_VQSHL_imm<"u8", (ins imm0_7:$imm)> {
2311 let Inst{21-19} = 0b001;
2314 def MVE_VSLIimms16 : MVE_VQSHL_imm<"s16", (ins imm0_15:$imm)> {
2316 let Inst{21-20} = 0b01;
2319 def MVE_VSLIimmu16 : MVE_VQSHL_imm<"u16", (ins imm0_15:$imm)> {
2321 let Inst{21-20} = 0b01;
2324 def MVE_VSLIimms32 : MVE_VQSHL_imm<"s32", (ins imm0_31:$imm)> {
2329 def MVE_VSLIimmu32 : MVE_VQSHL_imm<"u32", (ins imm0_31:$imm)> {
2334 class MVE_VQSHLU_imm<string suffix, dag imm>
2335 : MVE_shift_with_imm<"vqshlu", suffix, (outs MQPR:$Qd),
2336 !con((ins MQPR:$Qm), imm), "$Qd, $Qm, $imm",
2341 let Inst{25-24} = 0b11;
2342 let Inst{21-16} = imm;
2343 let Inst{10-8} = 0b110;
2346 def MVE_VQSHLU_imms8 : MVE_VQSHLU_imm<"s8", (ins imm0_7:$imm)> {
2347 let Inst{21-19} = 0b001;
2350 def MVE_VQSHLU_imms16 : MVE_VQSHLU_imm<"s16", (ins imm0_15:$imm)> {
2351 let Inst{21-20} = 0b01;
2354 def MVE_VQSHLU_imms32 : MVE_VQSHLU_imm<"s32", (ins imm0_31:$imm)> {
2358 class MVE_VRSHR_imm<string suffix, dag imm>
2359 : MVE_shift_with_imm<"vrshr", suffix, (outs MQPR:$Qd),
2360 !con((ins MQPR:$Qm), imm), "$Qd, $Qm, $imm",
2364 let Inst{25-24} = 0b11;
2365 let Inst{21-16} = imm;
2366 let Inst{10-8} = 0b010;
2369 def MVE_VRSHR_imms8 : MVE_VRSHR_imm<"s8", (ins shr_imm8:$imm)> {
2371 let Inst{21-19} = 0b001;
2374 def MVE_VRSHR_immu8 : MVE_VRSHR_imm<"u8", (ins shr_imm8:$imm)> {
2376 let Inst{21-19} = 0b001;
2379 def MVE_VRSHR_imms16 : MVE_VRSHR_imm<"s16", (ins shr_imm16:$imm)> {
2381 let Inst{21-20} = 0b01;
2384 def MVE_VRSHR_immu16 : MVE_VRSHR_imm<"u16", (ins shr_imm16:$imm)> {
2386 let Inst{21-20} = 0b01;
2389 def MVE_VRSHR_imms32 : MVE_VRSHR_imm<"s32", (ins shr_imm32:$imm)> {
2394 def MVE_VRSHR_immu32 : MVE_VRSHR_imm<"u32", (ins shr_imm32:$imm)> {
2399 class MVE_VSHR_imm<string suffix, dag imm>
2400 : MVE_shift_with_imm<"vshr", suffix, (outs MQPR:$Qd),
2401 !con((ins MQPR:$Qm), imm), "$Qd, $Qm, $imm",
2405 let Inst{25-24} = 0b11;
2406 let Inst{21-16} = imm;
2407 let Inst{10-8} = 0b000;
2410 def MVE_VSHR_imms8 : MVE_VSHR_imm<"s8", (ins shr_imm8:$imm)> {
2412 let Inst{21-19} = 0b001;
2415 def MVE_VSHR_immu8 : MVE_VSHR_imm<"u8", (ins shr_imm8:$imm)> {
2417 let Inst{21-19} = 0b001;
2420 def MVE_VSHR_imms16 : MVE_VSHR_imm<"s16", (ins shr_imm16:$imm)> {
2422 let Inst{21-20} = 0b01;
2425 def MVE_VSHR_immu16 : MVE_VSHR_imm<"u16", (ins shr_imm16:$imm)> {
2427 let Inst{21-20} = 0b01;
2430 def MVE_VSHR_imms32 : MVE_VSHR_imm<"s32", (ins shr_imm32:$imm)> {
2435 def MVE_VSHR_immu32 : MVE_VSHR_imm<"u32", (ins shr_imm32:$imm)> {
2440 class MVE_VSHL_imm<string suffix, dag imm>
2441 : MVE_shift_with_imm<"vshl", suffix, (outs MQPR:$Qd),
2442 !con((ins MQPR:$Qm), imm), "$Qd, $Qm, $imm",
2447 let Inst{25-24} = 0b11;
2448 let Inst{21-16} = imm;
2449 let Inst{10-8} = 0b101;
2452 def MVE_VSHL_immi8 : MVE_VSHL_imm<"i8", (ins imm0_7:$imm)> {
2453 let Inst{21-19} = 0b001;
2456 def MVE_VSHL_immi16 : MVE_VSHL_imm<"i16", (ins imm0_15:$imm)> {
2457 let Inst{21-20} = 0b01;
2460 def MVE_VSHL_immi32 : MVE_VSHL_imm<"i32", (ins imm0_31:$imm)> {
2464 let Predicates = [HasMVEInt] in {
2465 def : Pat<(v4i32 (ARMvshlImm (v4i32 MQPR:$src), imm0_31:$imm)),
2466 (v4i32 (MVE_VSHL_immi32 (v4i32 MQPR:$src), imm0_31:$imm))>;
2467 def : Pat<(v8i16 (ARMvshlImm (v8i16 MQPR:$src), imm0_15:$imm)),
2468 (v8i16 (MVE_VSHL_immi16 (v8i16 MQPR:$src), imm0_15:$imm))>;
2469 def : Pat<(v16i8 (ARMvshlImm (v16i8 MQPR:$src), imm0_7:$imm)),
2470 (v16i8 (MVE_VSHL_immi8 (v16i8 MQPR:$src), imm0_7:$imm))>;
2472 def : Pat<(v4i32 (ARMvshruImm (v4i32 MQPR:$src), imm0_31:$imm)),
2473 (v4i32 (MVE_VSHR_immu32 (v4i32 MQPR:$src), imm0_31:$imm))>;
2474 def : Pat<(v8i16 (ARMvshruImm (v8i16 MQPR:$src), imm0_15:$imm)),
2475 (v8i16 (MVE_VSHR_immu16 (v8i16 MQPR:$src), imm0_15:$imm))>;
2476 def : Pat<(v16i8 (ARMvshruImm (v16i8 MQPR:$src), imm0_7:$imm)),
2477 (v16i8 (MVE_VSHR_immu8 (v16i8 MQPR:$src), imm0_7:$imm))>;
2479 def : Pat<(v4i32 (ARMvshrsImm (v4i32 MQPR:$src), imm0_31:$imm)),
2480 (v4i32 (MVE_VSHR_imms32 (v4i32 MQPR:$src), imm0_31:$imm))>;
2481 def : Pat<(v8i16 (ARMvshrsImm (v8i16 MQPR:$src), imm0_15:$imm)),
2482 (v8i16 (MVE_VSHR_imms16 (v8i16 MQPR:$src), imm0_15:$imm))>;
2483 def : Pat<(v16i8 (ARMvshrsImm (v16i8 MQPR:$src), imm0_7:$imm)),
2484 (v16i8 (MVE_VSHR_imms8 (v16i8 MQPR:$src), imm0_7:$imm))>;
2487 // end of mve_shift instructions
2489 // start of MVE Floating Point instructions
2491 class MVE_float<string iname, string suffix, dag oops, dag iops, string ops,
2492 vpred_ops vpred, string cstr, list<dag> pattern=[]>
2493 : MVE_f<oops, iops, NoItinerary, iname, suffix, ops, vpred, cstr, pattern> {
2498 let Inst{5} = Qm{3};
2499 let Inst{3-1} = Qm{2-0};
2503 class MVE_VRINT<string rmode, bits<3> op, string suffix, bits<2> size,
2504 list<dag> pattern=[]>
2505 : MVE_float<!strconcat("vrint", rmode), suffix, (outs MQPR:$Qd),
2506 (ins MQPR:$Qm), "$Qd, $Qm", vpred_r, "", pattern> {
2510 let Inst{25-23} = 0b111;
2511 let Inst{22} = Qd{3};
2512 let Inst{21-20} = 0b11;
2513 let Inst{19-18} = size;
2514 let Inst{17-16} = 0b10;
2515 let Inst{15-13} = Qd{2-0};
2516 let Inst{11-10} = 0b01;
2517 let Inst{9-7} = op{2-0};
2522 multiclass MVE_VRINT_ops<string suffix, bits<2> size, list<dag> pattern=[]> {
2523 def N : MVE_VRINT<"n", 0b000, suffix, size, pattern>;
2524 def X : MVE_VRINT<"x", 0b001, suffix, size, pattern>;
2525 def A : MVE_VRINT<"a", 0b010, suffix, size, pattern>;
2526 def Z : MVE_VRINT<"z", 0b011, suffix, size, pattern>;
2527 def M : MVE_VRINT<"m", 0b101, suffix, size, pattern>;
2528 def P : MVE_VRINT<"p", 0b111, suffix, size, pattern>;
2531 defm MVE_VRINTf16 : MVE_VRINT_ops<"f16", 0b01>;
2532 defm MVE_VRINTf32 : MVE_VRINT_ops<"f32", 0b10>;
2534 let Predicates = [HasMVEFloat] in {
2535 def : Pat<(v4f32 (frint (v4f32 MQPR:$val1))),
2536 (v4f32 (MVE_VRINTf32X (v4f32 MQPR:$val1)))>;
2537 def : Pat<(v8f16 (frint (v8f16 MQPR:$val1))),
2538 (v8f16 (MVE_VRINTf16X (v8f16 MQPR:$val1)))>;
2539 def : Pat<(v4f32 (fround (v4f32 MQPR:$val1))),
2540 (v4f32 (MVE_VRINTf32A (v4f32 MQPR:$val1)))>;
2541 def : Pat<(v8f16 (fround (v8f16 MQPR:$val1))),
2542 (v8f16 (MVE_VRINTf16A (v8f16 MQPR:$val1)))>;
2543 def : Pat<(v4f32 (ftrunc (v4f32 MQPR:$val1))),
2544 (v4f32 (MVE_VRINTf32Z (v4f32 MQPR:$val1)))>;
2545 def : Pat<(v8f16 (ftrunc (v8f16 MQPR:$val1))),
2546 (v8f16 (MVE_VRINTf16Z (v8f16 MQPR:$val1)))>;
2547 def : Pat<(v4f32 (ffloor (v4f32 MQPR:$val1))),
2548 (v4f32 (MVE_VRINTf32M (v4f32 MQPR:$val1)))>;
2549 def : Pat<(v8f16 (ffloor (v8f16 MQPR:$val1))),
2550 (v8f16 (MVE_VRINTf16M (v8f16 MQPR:$val1)))>;
2551 def : Pat<(v4f32 (fceil (v4f32 MQPR:$val1))),
2552 (v4f32 (MVE_VRINTf32P (v4f32 MQPR:$val1)))>;
2553 def : Pat<(v8f16 (fceil (v8f16 MQPR:$val1))),
2554 (v8f16 (MVE_VRINTf16P (v8f16 MQPR:$val1)))>;
2557 class MVEFloatArithNeon<string iname, string suffix, bit size,
2558 dag oops, dag iops, string ops,
2559 vpred_ops vpred, string cstr, list<dag> pattern=[]>
2560 : MVE_float<iname, suffix, oops, iops, ops, vpred, cstr, pattern> {
2561 let Inst{20} = size;
2565 class MVE_VMUL_fp<string suffix, bit size, list<dag> pattern=[]>
2566 : MVEFloatArithNeon<"vmul", suffix, size, (outs MQPR:$Qd),
2567 (ins MQPR:$Qn, MQPR:$Qm), "$Qd, $Qn, $Qm", vpred_r, "",
2573 let Inst{25-23} = 0b110;
2574 let Inst{22} = Qd{3};
2576 let Inst{19-17} = Qn{2-0};
2577 let Inst{15-13} = Qd{2-0};
2578 let Inst{12-8} = 0b01101;
2579 let Inst{7} = Qn{3};
2583 def MVE_VMULf32 : MVE_VMUL_fp<"f32", 0b0>;
2584 def MVE_VMULf16 : MVE_VMUL_fp<"f16", 0b1>;
2586 let Predicates = [HasMVEFloat] in {
2587 def : Pat<(v4f32 (fmul (v4f32 MQPR:$val1), (v4f32 MQPR:$val2))),
2588 (v4f32 (MVE_VMULf32 (v4f32 MQPR:$val1), (v4f32 MQPR:$val2)))>;
2589 def : Pat<(v8f16 (fmul (v8f16 MQPR:$val1), (v8f16 MQPR:$val2))),
2590 (v8f16 (MVE_VMULf16 (v8f16 MQPR:$val1), (v8f16 MQPR:$val2)))>;
2593 class MVE_VCMLA<string suffix, bit size, list<dag> pattern=[]>
2594 : MVEFloatArithNeon<"vcmla", suffix, size, (outs MQPR:$Qd),
2595 (ins MQPR:$Qd_src, MQPR:$Qn, MQPR:$Qm, complexrotateop:$rot),
2596 "$Qd, $Qn, $Qm, $rot", vpred_n, "$Qd = $Qd_src", pattern> {
2603 let Inst{24-23} = rot;
2604 let Inst{22} = Qd{3};
2606 let Inst{19-17} = Qn{2-0};
2607 let Inst{15-13} = Qd{2-0};
2608 let Inst{12-8} = 0b01000;
2609 let Inst{7} = Qn{3};
2613 def MVE_VCMLAf16 : MVE_VCMLA<"f16", 0b0>;
2614 def MVE_VCMLAf32 : MVE_VCMLA<"f32", 0b1>;
2616 class MVE_VADDSUBFMA_fp<string iname, string suffix, bit size, bit bit_4,
2617 bit bit_8, bit bit_21, dag iops=(ins),
2618 vpred_ops vpred=vpred_r, string cstr="",
2619 list<dag> pattern=[]>
2620 : MVEFloatArithNeon<iname, suffix, size, (outs MQPR:$Qd),
2621 !con(iops, (ins MQPR:$Qn, MQPR:$Qm)), "$Qd, $Qn, $Qm",
2622 vpred, cstr, pattern> {
2627 let Inst{25-23} = 0b110;
2628 let Inst{22} = Qd{3};
2629 let Inst{21} = bit_21;
2630 let Inst{19-17} = Qn{2-0};
2631 let Inst{15-13} = Qd{2-0};
2632 let Inst{11-9} = 0b110;
2633 let Inst{8} = bit_8;
2634 let Inst{7} = Qn{3};
2635 let Inst{4} = bit_4;
2638 def MVE_VFMAf32 : MVE_VADDSUBFMA_fp<"vfma", "f32", 0b0, 0b1, 0b0, 0b0,
2639 (ins MQPR:$Qd_src), vpred_n, "$Qd = $Qd_src">;
2640 def MVE_VFMAf16 : MVE_VADDSUBFMA_fp<"vfma", "f16", 0b1, 0b1, 0b0, 0b0,
2641 (ins MQPR:$Qd_src), vpred_n, "$Qd = $Qd_src">;
2643 def MVE_VFMSf32 : MVE_VADDSUBFMA_fp<"vfms", "f32", 0b0, 0b1, 0b0, 0b1,
2644 (ins MQPR:$Qd_src), vpred_n, "$Qd = $Qd_src">;
2645 def MVE_VFMSf16 : MVE_VADDSUBFMA_fp<"vfms", "f16", 0b1, 0b1, 0b0, 0b1,
2646 (ins MQPR:$Qd_src), vpred_n, "$Qd = $Qd_src">;
2648 let Predicates = [HasMVEFloat, UseFusedMAC] in {
2649 def : Pat<(v8f16 (fadd (v8f16 MQPR:$src1),
2650 (fmul (v8f16 MQPR:$src2),
2651 (v8f16 MQPR:$src3)))),
2652 (v8f16 (MVE_VFMAf16 $src1, $src2, $src3))>;
2653 def : Pat<(v4f32 (fadd (v4f32 MQPR:$src1),
2654 (fmul (v4f32 MQPR:$src2),
2655 (v4f32 MQPR:$src3)))),
2656 (v4f32 (MVE_VFMAf32 $src1, $src2, $src3))>;
2658 def : Pat<(v8f16 (fsub (v8f16 MQPR:$src1),
2659 (fmul (v8f16 MQPR:$src2),
2660 (v8f16 MQPR:$src3)))),
2661 (v8f16 (MVE_VFMSf16 $src1, $src2, $src3))>;
2662 def : Pat<(v4f32 (fsub (v4f32 MQPR:$src1),
2663 (fmul (v4f32 MQPR:$src2),
2664 (v4f32 MQPR:$src3)))),
2665 (v4f32 (MVE_VFMSf32 $src1, $src2, $src3))>;
2668 let Predicates = [HasMVEFloat] in {
2669 def : Pat<(v8f16 (fma (v8f16 MQPR:$src1), (v8f16 MQPR:$src2), (v8f16 MQPR:$src3))),
2670 (v8f16 (MVE_VFMAf16 $src3, $src1, $src2))>;
2671 def : Pat<(v4f32 (fma (v4f32 MQPR:$src1), (v4f32 MQPR:$src2), (v4f32 MQPR:$src3))),
2672 (v4f32 (MVE_VFMAf32 $src3, $src1, $src2))>;
2676 def MVE_VADDf32 : MVE_VADDSUBFMA_fp<"vadd", "f32", 0b0, 0b0, 0b1, 0b0>;
2677 def MVE_VADDf16 : MVE_VADDSUBFMA_fp<"vadd", "f16", 0b1, 0b0, 0b1, 0b0>;
2679 let Predicates = [HasMVEFloat] in {
2680 def : Pat<(v4f32 (fadd (v4f32 MQPR:$val1), (v4f32 MQPR:$val2))),
2681 (v4f32 (MVE_VADDf32 (v4f32 MQPR:$val1), (v4f32 MQPR:$val2)))>;
2682 def : Pat<(v8f16 (fadd (v8f16 MQPR:$val1), (v8f16 MQPR:$val2))),
2683 (v8f16 (MVE_VADDf16 (v8f16 MQPR:$val1), (v8f16 MQPR:$val2)))>;
2686 def MVE_VSUBf32 : MVE_VADDSUBFMA_fp<"vsub", "f32", 0b0, 0b0, 0b1, 0b1>;
2687 def MVE_VSUBf16 : MVE_VADDSUBFMA_fp<"vsub", "f16", 0b1, 0b0, 0b1, 0b1>;
2689 let Predicates = [HasMVEFloat] in {
2690 def : Pat<(v4f32 (fsub (v4f32 MQPR:$val1), (v4f32 MQPR:$val2))),
2691 (v4f32 (MVE_VSUBf32 (v4f32 MQPR:$val1), (v4f32 MQPR:$val2)))>;
2692 def : Pat<(v8f16 (fsub (v8f16 MQPR:$val1), (v8f16 MQPR:$val2))),
2693 (v8f16 (MVE_VSUBf16 (v8f16 MQPR:$val1), (v8f16 MQPR:$val2)))>;
2696 class MVE_VCADD<string suffix, bit size, list<dag> pattern=[]>
2697 : MVEFloatArithNeon<"vcadd", suffix, size, (outs MQPR:$Qd),
2698 (ins MQPR:$Qn, MQPR:$Qm, complexrotateopodd:$rot),
2699 "$Qd, $Qn, $Qm, $rot", vpred_r, "", pattern> {
2708 let Inst{22} = Qd{3};
2710 let Inst{19-17} = Qn{2-0};
2711 let Inst{15-13} = Qd{2-0};
2712 let Inst{12-8} = 0b01000;
2713 let Inst{7} = Qn{3};
2717 def MVE_VCADDf16 : MVE_VCADD<"f16", 0b0>;
2718 def MVE_VCADDf32 : MVE_VCADD<"f32", 0b1>;
2720 class MVE_VABD_fp<string suffix, bit size>
2721 : MVE_float<"vabd", suffix, (outs MQPR:$Qd), (ins MQPR:$Qn, MQPR:$Qm),
2722 "$Qd, $Qn, $Qm", vpred_r, ""> {
2727 let Inst{25-23} = 0b110;
2728 let Inst{22} = Qd{3};
2730 let Inst{20} = size;
2731 let Inst{19-17} = Qn{2-0};
2733 let Inst{15-13} = Qd{2-0};
2734 let Inst{11-8} = 0b1101;
2735 let Inst{7} = Qn{3};
2739 def MVE_VABDf32 : MVE_VABD_fp<"f32", 0b0>;
2740 def MVE_VABDf16 : MVE_VABD_fp<"f16", 0b1>;
2742 class MVE_VCVT_fix<string suffix, bit fsi, bit U, bit op,
2743 Operand imm_operand_type, list<dag> pattern=[]>
2744 : MVE_float<"vcvt", suffix,
2745 (outs MQPR:$Qd), (ins MQPR:$Qm, imm_operand_type:$imm6),
2746 "$Qd, $Qm, $imm6", vpred_r, "", pattern> {
2751 let Inst{25-23} = 0b111;
2752 let Inst{22} = Qd{3};
2754 let Inst{19-16} = imm6{3-0};
2755 let Inst{15-13} = Qd{2-0};
2756 let Inst{11-10} = 0b11;
2762 let DecoderMethod = "DecodeMVEVCVTt1fp";
2765 class MVE_VCVT_imm_asmop<int Bits> : AsmOperandClass {
2766 let PredicateMethod = "isImmediate<1," # Bits # ">";
2767 let DiagnosticString =
2768 "MVE fixed-point immediate operand must be between 1 and " # Bits;
2769 let Name = "MVEVcvtImm" # Bits;
2770 let RenderMethod = "addImmOperands";
2772 class MVE_VCVT_imm<int Bits>: Operand<i32> {
2773 let ParserMatchClass = MVE_VCVT_imm_asmop<Bits>;
2774 let EncoderMethod = "getNEONVcvtImm32OpValue";
2775 let DecoderMethod = "DecodeVCVTImmOperand";
2778 class MVE_VCVT_fix_f32<string suffix, bit U, bit op>
2779 : MVE_VCVT_fix<suffix, 0b1, U, op, MVE_VCVT_imm<32>> {
2780 let Inst{20} = imm6{4};
2782 class MVE_VCVT_fix_f16<string suffix, bit U, bit op>
2783 : MVE_VCVT_fix<suffix, 0b0, U, op, MVE_VCVT_imm<16>> {
2787 def MVE_VCVTf16s16_fix : MVE_VCVT_fix_f16<"f16.s16", 0b0, 0b0>;
2788 def MVE_VCVTs16f16_fix : MVE_VCVT_fix_f16<"s16.f16", 0b0, 0b1>;
2789 def MVE_VCVTf16u16_fix : MVE_VCVT_fix_f16<"f16.u16", 0b1, 0b0>;
2790 def MVE_VCVTu16f16_fix : MVE_VCVT_fix_f16<"u16.f16", 0b1, 0b1>;
2791 def MVE_VCVTf32s32_fix : MVE_VCVT_fix_f32<"f32.s32", 0b0, 0b0>;
2792 def MVE_VCVTs32f32_fix : MVE_VCVT_fix_f32<"s32.f32", 0b0, 0b1>;
2793 def MVE_VCVTf32u32_fix : MVE_VCVT_fix_f32<"f32.u32", 0b1, 0b0>;
2794 def MVE_VCVTu32f32_fix : MVE_VCVT_fix_f32<"u32.f32", 0b1, 0b1>;
2796 class MVE_VCVT_fp_int_anpm<string suffix, bits<2> size, bit op, string anpm,
2797 bits<2> rm, list<dag> pattern=[]>
2798 : MVE_float<!strconcat("vcvt", anpm), suffix, (outs MQPR:$Qd),
2799 (ins MQPR:$Qm), "$Qd, $Qm", vpred_r, "", pattern> {
2803 let Inst{25-23} = 0b111;
2804 let Inst{22} = Qd{3};
2805 let Inst{21-20} = 0b11;
2806 let Inst{19-18} = size;
2807 let Inst{17-16} = 0b11;
2808 let Inst{15-13} = Qd{2-0};
2809 let Inst{12-10} = 0b000;
2815 multiclass MVE_VCVT_fp_int_anpm_multi<string suffix, bits<2> size, bit op,
2816 list<dag> pattern=[]> {
2817 def a : MVE_VCVT_fp_int_anpm<suffix, size, op, "a", 0b00>;
2818 def n : MVE_VCVT_fp_int_anpm<suffix, size, op, "n", 0b01>;
2819 def p : MVE_VCVT_fp_int_anpm<suffix, size, op, "p", 0b10>;
2820 def m : MVE_VCVT_fp_int_anpm<suffix, size, op, "m", 0b11>;
2823 // This defines instructions such as MVE_VCVTu16f16a, with an explicit
2824 // rounding-mode suffix on the mnemonic. The class below will define
2825 // the bare MVE_VCVTu16f16 (with implied rounding toward zero).
2826 defm MVE_VCVTs16f16 : MVE_VCVT_fp_int_anpm_multi<"s16.f16", 0b01, 0b0>;
2827 defm MVE_VCVTu16f16 : MVE_VCVT_fp_int_anpm_multi<"u16.f16", 0b01, 0b1>;
2828 defm MVE_VCVTs32f32 : MVE_VCVT_fp_int_anpm_multi<"s32.f32", 0b10, 0b0>;
2829 defm MVE_VCVTu32f32 : MVE_VCVT_fp_int_anpm_multi<"u32.f32", 0b10, 0b1>;
2831 class MVE_VCVT_fp_int<string suffix, bits<2> size, bits<2> op,
2832 list<dag> pattern=[]>
2833 : MVE_float<"vcvt", suffix, (outs MQPR:$Qd),
2834 (ins MQPR:$Qm), "$Qd, $Qm", vpred_r, "", pattern> {
2838 let Inst{25-23} = 0b111;
2839 let Inst{22} = Qd{3};
2840 let Inst{21-20} = 0b11;
2841 let Inst{19-18} = size;
2842 let Inst{17-16} = 0b11;
2843 let Inst{15-13} = Qd{2-0};
2844 let Inst{12-9} = 0b0011;
2849 // The unsuffixed VCVT for float->int implicitly rounds toward zero,
2850 // which I reflect here in the llvm instruction names
2851 def MVE_VCVTs16f16z : MVE_VCVT_fp_int<"s16.f16", 0b01, 0b10>;
2852 def MVE_VCVTu16f16z : MVE_VCVT_fp_int<"u16.f16", 0b01, 0b11>;
2853 def MVE_VCVTs32f32z : MVE_VCVT_fp_int<"s32.f32", 0b10, 0b10>;
2854 def MVE_VCVTu32f32z : MVE_VCVT_fp_int<"u32.f32", 0b10, 0b11>;
2855 // Whereas VCVT for int->float rounds to nearest
2856 def MVE_VCVTf16s16n : MVE_VCVT_fp_int<"f16.s16", 0b01, 0b00>;
2857 def MVE_VCVTf16u16n : MVE_VCVT_fp_int<"f16.u16", 0b01, 0b01>;
2858 def MVE_VCVTf32s32n : MVE_VCVT_fp_int<"f32.s32", 0b10, 0b00>;
2859 def MVE_VCVTf32u32n : MVE_VCVT_fp_int<"f32.u32", 0b10, 0b01>;
2861 let Predicates = [HasMVEFloat] in {
2862 def : Pat<(v4i32 (fp_to_sint (v4f32 MQPR:$src))),
2863 (v4i32 (MVE_VCVTs32f32z (v4f32 MQPR:$src)))>;
2864 def : Pat<(v4i32 (fp_to_uint (v4f32 MQPR:$src))),
2865 (v4i32 (MVE_VCVTu32f32z (v4f32 MQPR:$src)))>;
2866 def : Pat<(v8i16 (fp_to_sint (v8f16 MQPR:$src))),
2867 (v8i16 (MVE_VCVTs16f16z (v8f16 MQPR:$src)))>;
2868 def : Pat<(v8i16 (fp_to_uint (v8f16 MQPR:$src))),
2869 (v8i16 (MVE_VCVTu16f16z (v8f16 MQPR:$src)))>;
2870 def : Pat<(v4f32 (sint_to_fp (v4i32 MQPR:$src))),
2871 (v4f32 (MVE_VCVTf32s32n (v4i32 MQPR:$src)))>;
2872 def : Pat<(v4f32 (uint_to_fp (v4i32 MQPR:$src))),
2873 (v4f32 (MVE_VCVTf32u32n (v4i32 MQPR:$src)))>;
2874 def : Pat<(v8f16 (sint_to_fp (v8i16 MQPR:$src))),
2875 (v8f16 (MVE_VCVTf16s16n (v8i16 MQPR:$src)))>;
2876 def : Pat<(v8f16 (uint_to_fp (v8i16 MQPR:$src))),
2877 (v8f16 (MVE_VCVTf16u16n (v8i16 MQPR:$src)))>;
2880 class MVE_VABSNEG_fp<string iname, string suffix, bits<2> size, bit negate,
2881 list<dag> pattern=[]>
2882 : MVE_float<iname, suffix, (outs MQPR:$Qd),
2883 (ins MQPR:$Qm), "$Qd, $Qm", vpred_r, "", pattern> {
2887 let Inst{25-23} = 0b111;
2888 let Inst{22} = Qd{3};
2889 let Inst{21-20} = 0b11;
2890 let Inst{19-18} = size;
2891 let Inst{17-16} = 0b01;
2892 let Inst{15-13} = Qd{2-0};
2893 let Inst{11-8} = 0b0111;
2894 let Inst{7} = negate;
2898 def MVE_VABSf16 : MVE_VABSNEG_fp<"vabs", "f16", 0b01, 0b0>;
2899 def MVE_VABSf32 : MVE_VABSNEG_fp<"vabs", "f32", 0b10, 0b0>;
2901 let Predicates = [HasMVEFloat] in {
2902 def : Pat<(v8f16 (fabs MQPR:$src)),
2903 (MVE_VABSf16 MQPR:$src)>;
2904 def : Pat<(v4f32 (fabs MQPR:$src)),
2905 (MVE_VABSf32 MQPR:$src)>;
2908 def MVE_VNEGf16 : MVE_VABSNEG_fp<"vneg", "f16", 0b01, 0b1>;
2909 def MVE_VNEGf32 : MVE_VABSNEG_fp<"vneg", "f32", 0b10, 0b1>;
2911 let Predicates = [HasMVEFloat] in {
2912 def : Pat<(v8f16 (fneg MQPR:$src)),
2913 (MVE_VNEGf16 MQPR:$src)>;
2914 def : Pat<(v4f32 (fneg MQPR:$src)),
2915 (MVE_VNEGf32 MQPR:$src)>;
2918 class MVE_VMAXMINNMA<string iname, string suffix, bit size, bit bit_12,
2919 list<dag> pattern=[]>
2920 : MVE_f<(outs MQPR:$Qd), (ins MQPR:$Qd_src, MQPR:$Qm),
2921 NoItinerary, iname, suffix, "$Qd, $Qm", vpred_n, "$Qd = $Qd_src",
2926 let Inst{28} = size;
2927 let Inst{25-23} = 0b100;
2928 let Inst{22} = Qd{3};
2929 let Inst{21-16} = 0b111111;
2930 let Inst{15-13} = Qd{2-0};
2931 let Inst{12} = bit_12;
2932 let Inst{11-6} = 0b111010;
2933 let Inst{5} = Qm{3};
2935 let Inst{3-1} = Qm{2-0};
2939 def MVE_VMAXNMAf32 : MVE_VMAXMINNMA<"vmaxnma", "f32", 0b0, 0b0>;
2940 def MVE_VMAXNMAf16 : MVE_VMAXMINNMA<"vmaxnma", "f16", 0b1, 0b0>;
2942 def MVE_VMINNMAf32 : MVE_VMAXMINNMA<"vminnma", "f32", 0b0, 0b1>;
2943 def MVE_VMINNMAf16 : MVE_VMAXMINNMA<"vminnma", "f16", 0b1, 0b1>;
2945 // end of MVE Floating Point instructions
2947 // start of MVE compares
2949 class MVE_VCMPqq<string suffix, bit bit_28, bits<2> bits_21_20,
2950 VCMPPredicateOperand predtype, list<dag> pattern=[]>
2951 : MVE_p<(outs VCCR:$P0), (ins MQPR:$Qn, MQPR:$Qm, predtype:$fc),
2952 NoItinerary, "vcmp", suffix, "$fc, $Qn, $Qm", vpred_n, "", pattern> {
2953 // Base class for comparing two vector registers
2958 let Inst{28} = bit_28;
2959 let Inst{25-22} = 0b1000;
2960 let Inst{21-20} = bits_21_20;
2961 let Inst{19-17} = Qn{2-0};
2962 let Inst{16-13} = 0b1000;
2963 let Inst{12} = fc{2};
2964 let Inst{11-8} = 0b1111;
2965 let Inst{7} = fc{0};
2967 let Inst{5} = Qm{3};
2969 let Inst{3-1} = Qm{2-0};
2970 let Inst{0} = fc{1};
2972 let Constraints = "";
2974 // We need a custom decoder method for these instructions because of
2975 // the output VCCR operand, which isn't encoded in the instruction
2976 // bits anywhere (there is only one choice for it) but has to be
2977 // included in the MC operands so that codegen will be able to track
2978 // its data flow between instructions, spill/reload it when
2979 // necessary, etc. There seems to be no way to get the Tablegen
2980 // decoder to emit an operand that isn't affected by any instruction
2982 let DecoderMethod = "DecodeMVEVCMP<false," # predtype.DecoderMethod # ">";
2985 class MVE_VCMPqqf<string suffix, bit size>
2986 : MVE_VCMPqq<suffix, size, 0b11, pred_basic_fp> {
2987 let Predicates = [HasMVEFloat];
2990 class MVE_VCMPqqi<string suffix, bits<2> size>
2991 : MVE_VCMPqq<suffix, 0b1, size, pred_basic_i> {
2996 class MVE_VCMPqqu<string suffix, bits<2> size>
2997 : MVE_VCMPqq<suffix, 0b1, size, pred_basic_u> {
3002 class MVE_VCMPqqs<string suffix, bits<2> size>
3003 : MVE_VCMPqq<suffix, 0b1, size, pred_basic_s> {
3007 def MVE_VCMPf32 : MVE_VCMPqqf<"f32", 0b0>;
3008 def MVE_VCMPf16 : MVE_VCMPqqf<"f16", 0b1>;
3010 def MVE_VCMPi8 : MVE_VCMPqqi<"i8", 0b00>;
3011 def MVE_VCMPi16 : MVE_VCMPqqi<"i16", 0b01>;
3012 def MVE_VCMPi32 : MVE_VCMPqqi<"i32", 0b10>;
3014 def MVE_VCMPu8 : MVE_VCMPqqu<"u8", 0b00>;
3015 def MVE_VCMPu16 : MVE_VCMPqqu<"u16", 0b01>;
3016 def MVE_VCMPu32 : MVE_VCMPqqu<"u32", 0b10>;
3018 def MVE_VCMPs8 : MVE_VCMPqqs<"s8", 0b00>;
3019 def MVE_VCMPs16 : MVE_VCMPqqs<"s16", 0b01>;
3020 def MVE_VCMPs32 : MVE_VCMPqqs<"s32", 0b10>;
3022 class MVE_VCMPqr<string suffix, bit bit_28, bits<2> bits_21_20,
3023 VCMPPredicateOperand predtype, list<dag> pattern=[]>
3024 : MVE_p<(outs VCCR:$P0), (ins MQPR:$Qn, GPRwithZR:$Rm, predtype:$fc),
3025 NoItinerary, "vcmp", suffix, "$fc, $Qn, $Rm", vpred_n, "", pattern> {
3026 // Base class for comparing a vector register with a scalar
3031 let Inst{28} = bit_28;
3032 let Inst{25-22} = 0b1000;
3033 let Inst{21-20} = bits_21_20;
3034 let Inst{19-17} = Qn{2-0};
3035 let Inst{16-13} = 0b1000;
3036 let Inst{12} = fc{2};
3037 let Inst{11-8} = 0b1111;
3038 let Inst{7} = fc{0};
3040 let Inst{5} = fc{1};
3042 let Inst{3-0} = Rm{3-0};
3044 let Constraints = "";
3045 // Custom decoder method, for the same reason as MVE_VCMPqq
3046 let DecoderMethod = "DecodeMVEVCMP<true," # predtype.DecoderMethod # ">";
3049 class MVE_VCMPqrf<string suffix, bit size>
3050 : MVE_VCMPqr<suffix, size, 0b11, pred_basic_fp> {
3051 let Predicates = [HasMVEFloat];
3054 class MVE_VCMPqri<string suffix, bits<2> size>
3055 : MVE_VCMPqr<suffix, 0b1, size, pred_basic_i> {
3060 class MVE_VCMPqru<string suffix, bits<2> size>
3061 : MVE_VCMPqr<suffix, 0b1, size, pred_basic_u> {
3066 class MVE_VCMPqrs<string suffix, bits<2> size>
3067 : MVE_VCMPqr<suffix, 0b1, size, pred_basic_s> {
3071 def MVE_VCMPf32r : MVE_VCMPqrf<"f32", 0b0>;
3072 def MVE_VCMPf16r : MVE_VCMPqrf<"f16", 0b1>;
3074 def MVE_VCMPi8r : MVE_VCMPqri<"i8", 0b00>;
3075 def MVE_VCMPi16r : MVE_VCMPqri<"i16", 0b01>;
3076 def MVE_VCMPi32r : MVE_VCMPqri<"i32", 0b10>;
3078 def MVE_VCMPu8r : MVE_VCMPqru<"u8", 0b00>;
3079 def MVE_VCMPu16r : MVE_VCMPqru<"u16", 0b01>;
3080 def MVE_VCMPu32r : MVE_VCMPqru<"u32", 0b10>;
3082 def MVE_VCMPs8r : MVE_VCMPqrs<"s8", 0b00>;
3083 def MVE_VCMPs16r : MVE_VCMPqrs<"s16", 0b01>;
3084 def MVE_VCMPs32r : MVE_VCMPqrs<"s32", 0b10>;
3086 multiclass unpred_vcmp_z<string suffix, int fc> {
3087 def i8 : Pat<(v16i1 (ARMvcmpz (v16i8 MQPR:$v1), (i32 fc))),
3088 (v16i1 (!cast<Instruction>("MVE_VCMP"#suffix#"8r") (v16i8 MQPR:$v1), ZR, fc))>;
3089 def i16 : Pat<(v8i1 (ARMvcmpz (v8i16 MQPR:$v1), (i32 fc))),
3090 (v8i1 (!cast<Instruction>("MVE_VCMP"#suffix#"16r") (v8i16 MQPR:$v1), ZR, fc))>;
3091 def i32 : Pat<(v4i1 (ARMvcmpz (v4i32 MQPR:$v1), (i32 fc))),
3092 (v4i1 (!cast<Instruction>("MVE_VCMP"#suffix#"32r") (v4i32 MQPR:$v1), ZR, fc))>;
3094 def : Pat<(v16i1 (and (v16i1 VCCR:$p1), (v16i1 (ARMvcmpz (v16i8 MQPR:$v1), (i32 fc))))),
3095 (v16i1 (!cast<Instruction>("MVE_VCMP"#suffix#"8r") (v16i8 MQPR:$v1), ZR, fc, 1, VCCR:$p1))>;
3096 def : Pat<(v8i1 (and (v8i1 VCCR:$p1), (v8i1 (ARMvcmpz (v8i16 MQPR:$v1), (i32 fc))))),
3097 (v8i1 (!cast<Instruction>("MVE_VCMP"#suffix#"16r") (v8i16 MQPR:$v1), ZR, fc, 1, VCCR:$p1))>;
3098 def : Pat<(v4i1 (and (v4i1 VCCR:$p1), (v4i1 (ARMvcmpz (v4i32 MQPR:$v1), (i32 fc))))),
3099 (v4i1 (!cast<Instruction>("MVE_VCMP"#suffix#"32r") (v4i32 MQPR:$v1), ZR, fc, 1, VCCR:$p1))>;
3102 multiclass unpred_vcmp_r<string suffix, int fc> {
3103 def i8 : Pat<(v16i1 (ARMvcmp (v16i8 MQPR:$v1), (v16i8 MQPR:$v2), (i32 fc))),
3104 (v16i1 (!cast<Instruction>("MVE_VCMP"#suffix#"8") (v16i8 MQPR:$v1), (v16i8 MQPR:$v2), fc))>;
3105 def i16 : Pat<(v8i1 (ARMvcmp (v8i16 MQPR:$v1), (v8i16 MQPR:$v2), (i32 fc))),
3106 (v8i1 (!cast<Instruction>("MVE_VCMP"#suffix#"16") (v8i16 MQPR:$v1), (v8i16 MQPR:$v2), fc))>;
3107 def i32 : Pat<(v4i1 (ARMvcmp (v4i32 MQPR:$v1), (v4i32 MQPR:$v2), (i32 fc))),
3108 (v4i1 (!cast<Instruction>("MVE_VCMP"#suffix#"32") (v4i32 MQPR:$v1), (v4i32 MQPR:$v2), fc))>;
3110 def i8r : Pat<(v16i1 (ARMvcmp (v16i8 MQPR:$v1), (v16i8 (ARMvdup GPR:$v2)), (i32 fc))),
3111 (v16i1 (!cast<Instruction>("MVE_VCMP"#suffix#"8r") (v16i8 MQPR:$v1), (i32 GPR:$v2), fc))>;
3112 def i16r : Pat<(v8i1 (ARMvcmp (v8i16 MQPR:$v1), (v8i16 (ARMvdup GPR:$v2)), (i32 fc))),
3113 (v8i1 (!cast<Instruction>("MVE_VCMP"#suffix#"16r") (v8i16 MQPR:$v1), (i32 GPR:$v2), fc))>;
3114 def i32r : Pat<(v4i1 (ARMvcmp (v4i32 MQPR:$v1), (v4i32 (ARMvdup GPR:$v2)), (i32 fc))),
3115 (v4i1 (!cast<Instruction>("MVE_VCMP"#suffix#"32r") (v4i32 MQPR:$v1), (i32 GPR:$v2), fc))>;
3117 def : Pat<(v16i1 (and (v16i1 VCCR:$p1), (v16i1 (ARMvcmp (v16i8 MQPR:$v1), (v16i8 MQPR:$v2), (i32 fc))))),
3118 (v16i1 (!cast<Instruction>("MVE_VCMP"#suffix#"8") (v16i8 MQPR:$v1), (v16i8 MQPR:$v2), fc, 1, VCCR:$p1))>;
3119 def : Pat<(v8i1 (and (v8i1 VCCR:$p1), (v8i1 (ARMvcmp (v8i16 MQPR:$v1), (v8i16 MQPR:$v2), (i32 fc))))),
3120 (v8i1 (!cast<Instruction>("MVE_VCMP"#suffix#"16") (v8i16 MQPR:$v1), (v8i16 MQPR:$v2), fc, 1, VCCR:$p1))>;
3121 def : Pat<(v4i1 (and (v4i1 VCCR:$p1), (v4i1 (ARMvcmp (v4i32 MQPR:$v1), (v4i32 MQPR:$v2), (i32 fc))))),
3122 (v4i1 (!cast<Instruction>("MVE_VCMP"#suffix#"32") (v4i32 MQPR:$v1), (v4i32 MQPR:$v2), fc, 1, VCCR:$p1))>;
3124 def : Pat<(v16i1 (and (v16i1 VCCR:$p1), (v16i1 (ARMvcmp (v16i8 MQPR:$v1), (v16i8 (ARMvdup GPR:$v2)), (i32 fc))))),
3125 (v16i1 (!cast<Instruction>("MVE_VCMP"#suffix#"8r") (v16i8 MQPR:$v1), (i32 GPR:$v2), fc, 1, VCCR:$p1))>;
3126 def : Pat<(v8i1 (and (v8i1 VCCR:$p1), (v8i1 (ARMvcmp (v8i16 MQPR:$v1), (v8i16 (ARMvdup GPR:$v2)), (i32 fc))))),
3127 (v8i1 (!cast<Instruction>("MVE_VCMP"#suffix#"16r") (v8i16 MQPR:$v1), (i32 GPR:$v2), fc, 1, VCCR:$p1))>;
3128 def : Pat<(v4i1 (and (v4i1 VCCR:$p1), (v4i1 (ARMvcmp (v4i32 MQPR:$v1), (v4i32 (ARMvdup GPR:$v2)), (i32 fc))))),
3129 (v4i1 (!cast<Instruction>("MVE_VCMP"#suffix#"32r") (v4i32 MQPR:$v1), (i32 GPR:$v2), fc, 1, VCCR:$p1))>;
3132 multiclass unpred_vcmpf_z<int fc> {
3133 def f16 : Pat<(v8i1 (ARMvcmpz (v8f16 MQPR:$v1), (i32 fc))),
3134 (v8i1 (MVE_VCMPf16r (v8f16 MQPR:$v1), ZR, fc))>;
3135 def f32 : Pat<(v4i1 (ARMvcmpz (v4f32 MQPR:$v1), (i32 fc))),
3136 (v4i1 (MVE_VCMPf32r (v4f32 MQPR:$v1), ZR, fc))>;
3138 def : Pat<(v8i1 (and (v8i1 VCCR:$p1), (v8i1 (ARMvcmpz (v8f16 MQPR:$v1), (i32 fc))))),
3139 (v8i1 (MVE_VCMPf32r (v8f16 MQPR:$v1), ZR, fc, 1, VCCR:$p1))>;
3140 def : Pat<(v4i1 (and (v4i1 VCCR:$p1), (v4i1 (ARMvcmpz (v4f32 MQPR:$v1), (i32 fc))))),
3141 (v4i1 (MVE_VCMPf32r (v4f32 MQPR:$v1), ZR, fc, 1, VCCR:$p1))>;
3144 multiclass unpred_vcmpf_r<int fc> {
3145 def f16 : Pat<(v8i1 (ARMvcmp (v8f16 MQPR:$v1), (v8f16 MQPR:$v2), (i32 fc))),
3146 (v8i1 (MVE_VCMPf16 (v8f16 MQPR:$v1), (v8f16 MQPR:$v2), fc))>;
3147 def f32 : Pat<(v4i1 (ARMvcmp (v4f32 MQPR:$v1), (v4f32 MQPR:$v2), (i32 fc))),
3148 (v4i1 (MVE_VCMPf32 (v4f32 MQPR:$v1), (v4f32 MQPR:$v2), fc))>;
3150 def f16r : Pat<(v8i1 (ARMvcmp (v8f16 MQPR:$v1), (v8f16 (ARMvdup HPR:$v2)), (i32 fc))),
3151 (v8i1 (MVE_VCMPf16r (v8f16 MQPR:$v1), (i32 (COPY_TO_REGCLASS (f16 HPR:$v2), rGPR)), fc))>;
3152 def f32r : Pat<(v4i1 (ARMvcmp (v4f32 MQPR:$v1), (v4f32 (ARMvdup SPR:$v2)), (i32 fc))),
3153 (v4i1 (MVE_VCMPf32r (v4f32 MQPR:$v1), (i32 (COPY_TO_REGCLASS (f32 SPR:$v2), rGPR)), fc))>;
3155 def : Pat<(v8i1 (and (v8i1 VCCR:$p1), (v8i1 (ARMvcmp (v8f16 MQPR:$v1), (v8f16 MQPR:$v2), (i32 fc))))),
3156 (v8i1 (MVE_VCMPf16 (v8f16 MQPR:$v1), (v8f16 MQPR:$v2), fc, 1, VCCR:$p1))>;
3157 def : Pat<(v4i1 (and (v4i1 VCCR:$p1), (v4i1 (ARMvcmp (v4f32 MQPR:$v1), (v4f32 MQPR:$v2), (i32 fc))))),
3158 (v4i1 (MVE_VCMPf32 (v4f32 MQPR:$v1), (v4f32 MQPR:$v2), fc, 1, VCCR:$p1))>;
3160 def : Pat<(v8i1 (and (v8i1 VCCR:$p1), (v8i1 (ARMvcmp (v8f16 MQPR:$v1), (v8f16 (ARMvdup HPR:$v2)), (i32 fc))))),
3161 (v8i1 (MVE_VCMPf16r (v8f16 MQPR:$v1), (i32 (COPY_TO_REGCLASS (f16 HPR:$v2), rGPR)), fc, 1, VCCR:$p1))>;
3162 def : Pat<(v4i1 (and (v4i1 VCCR:$p1), (v4i1 (ARMvcmp (v4f32 MQPR:$v1), (v4f32 (ARMvdup SPR:$v2)), (i32 fc))))),
3163 (v4i1 (MVE_VCMPf32r (v4f32 MQPR:$v1), (i32 (COPY_TO_REGCLASS (f32 SPR:$v2), rGPR)), fc, 1, VCCR:$p1))>;
3166 let Predicates = [HasMVEInt] in {
3167 defm MVE_VCEQZ : unpred_vcmp_z<"i", 0>;
3168 defm MVE_VCNEZ : unpred_vcmp_z<"i", 1>;
3169 defm MVE_VCGEZ : unpred_vcmp_z<"s", 10>;
3170 defm MVE_VCLTZ : unpred_vcmp_z<"s", 11>;
3171 defm MVE_VCGTZ : unpred_vcmp_z<"s", 12>;
3172 defm MVE_VCLEZ : unpred_vcmp_z<"s", 13>;
3173 defm MVE_VCGTUZ : unpred_vcmp_z<"u", 8>;
3174 defm MVE_VCGEUZ : unpred_vcmp_z<"u", 2>;
3176 defm MVE_VCEQ : unpred_vcmp_r<"i", 0>;
3177 defm MVE_VCNE : unpred_vcmp_r<"i", 1>;
3178 defm MVE_VCGE : unpred_vcmp_r<"s", 10>;
3179 defm MVE_VCLT : unpred_vcmp_r<"s", 11>;
3180 defm MVE_VCGT : unpred_vcmp_r<"s", 12>;
3181 defm MVE_VCLE : unpred_vcmp_r<"s", 13>;
3182 defm MVE_VCGTU : unpred_vcmp_r<"u", 8>;
3183 defm MVE_VCGEU : unpred_vcmp_r<"u", 2>;
3186 let Predicates = [HasMVEFloat] in {
3187 defm MVE_VFCEQZ : unpred_vcmpf_z<0>;
3188 defm MVE_VFCNEZ : unpred_vcmpf_z<1>;
3189 defm MVE_VFCGEZ : unpred_vcmpf_z<10>;
3190 defm MVE_VFCLTZ : unpred_vcmpf_z<11>;
3191 defm MVE_VFCGTZ : unpred_vcmpf_z<12>;
3192 defm MVE_VFCLEZ : unpred_vcmpf_z<13>;
3194 defm MVE_VFCEQ : unpred_vcmpf_r<0>;
3195 defm MVE_VFCNE : unpred_vcmpf_r<1>;
3196 defm MVE_VFCGE : unpred_vcmpf_r<10>;
3197 defm MVE_VFCLT : unpred_vcmpf_r<11>;
3198 defm MVE_VFCGT : unpred_vcmpf_r<12>;
3199 defm MVE_VFCLE : unpred_vcmpf_r<13>;
3203 // Extra "worst case" and/or/xor partterns, going into and out of GRP
3204 multiclass two_predops<SDPatternOperator opnode, Instruction insn> {
3205 def v16i1 : Pat<(v16i1 (opnode (v16i1 VCCR:$p1), (v16i1 VCCR:$p2))),
3206 (v16i1 (COPY_TO_REGCLASS
3207 (insn (i32 (COPY_TO_REGCLASS (v16i1 VCCR:$p1), rGPR)),
3208 (i32 (COPY_TO_REGCLASS (v16i1 VCCR:$p2), rGPR))),
3210 def v8i1 : Pat<(v8i1 (opnode (v8i1 VCCR:$p1), (v8i1 VCCR:$p2))),
3211 (v8i1 (COPY_TO_REGCLASS
3212 (insn (i32 (COPY_TO_REGCLASS (v8i1 VCCR:$p1), rGPR)),
3213 (i32 (COPY_TO_REGCLASS (v8i1 VCCR:$p2), rGPR))),
3215 def v4i1 : Pat<(v4i1 (opnode (v4i1 VCCR:$p1), (v4i1 VCCR:$p2))),
3216 (v4i1 (COPY_TO_REGCLASS
3217 (insn (i32 (COPY_TO_REGCLASS (v4i1 VCCR:$p1), rGPR)),
3218 (i32 (COPY_TO_REGCLASS (v4i1 VCCR:$p2), rGPR))),
3222 let Predicates = [HasMVEInt] in {
3223 defm POR : two_predops<or, t2ORRrr>;
3224 defm PAND : two_predops<and, t2ANDrr>;
3225 defm PEOR : two_predops<xor, t2EORrr>;
3228 // Occasionally we need to cast between a i32 and a boolean vector, for
3229 // example when moving between rGPR and VPR.P0 as part of predicate vector
3230 // shuffles. We also sometimes need to cast between different predicate
3231 // vector types (v4i1<>v8i1, etc.) also as part of lowering vector shuffles.
3233 def predicate_cast : SDNode<"ARMISD::PREDICATE_CAST", SDTUnaryOp>;
3235 let Predicates = [HasMVEInt] in {
3236 foreach VT = [ v4i1, v8i1, v16i1 ] in {
3237 def : Pat<(i32 (predicate_cast (VT VCCR:$src))),
3238 (i32 (COPY_TO_REGCLASS (VT VCCR:$src), VCCR))>;
3239 def : Pat<(VT (predicate_cast (i32 VCCR:$src))),
3240 (VT (COPY_TO_REGCLASS (i32 VCCR:$src), VCCR))>;
3242 foreach VT2 = [ v4i1, v8i1, v16i1 ] in
3243 def : Pat<(VT (predicate_cast (VT2 VCCR:$src))),
3244 (VT (COPY_TO_REGCLASS (VT2 VCCR:$src), VCCR))>;
3248 // end of MVE compares
3250 // start of MVE_qDest_qSrc
3252 class MVE_qDest_qSrc<string iname, string suffix, dag oops, dag iops,
3253 string ops, vpred_ops vpred, string cstr,
3254 list<dag> pattern=[]>
3255 : MVE_p<oops, iops, NoItinerary, iname, suffix,
3256 ops, vpred, cstr, pattern> {
3260 let Inst{25-23} = 0b100;
3261 let Inst{22} = Qd{3};
3262 let Inst{15-13} = Qd{2-0};
3263 let Inst{11-9} = 0b111;
3265 let Inst{5} = Qm{3};
3267 let Inst{3-1} = Qm{2-0};
3270 class MVE_VQxDMLxDH<string iname, bit exch, bit round, bit subtract,
3271 string suffix, bits<2> size, list<dag> pattern=[]>
3272 : MVE_qDest_qSrc<iname, suffix, (outs MQPR:$Qd),
3273 (ins MQPR:$Qd_src, MQPR:$Qn, MQPR:$Qm), "$Qd, $Qn, $Qm",
3274 vpred_n, "$Qd = $Qd_src", pattern> {
3277 let Inst{28} = subtract;
3278 let Inst{21-20} = size;
3279 let Inst{19-17} = Qn{2-0};
3281 let Inst{12} = exch;
3283 let Inst{7} = Qn{3};
3284 let Inst{0} = round;
3287 multiclass MVE_VQxDMLxDH_multi<string iname, bit exch,
3288 bit round, bit subtract> {
3289 def s8 : MVE_VQxDMLxDH<iname, exch, round, subtract, "s8", 0b00>;
3290 def s16 : MVE_VQxDMLxDH<iname, exch, round, subtract, "s16", 0b01>;
3291 def s32 : MVE_VQxDMLxDH<iname, exch, round, subtract, "s32", 0b10>;
3294 defm MVE_VQDMLADH : MVE_VQxDMLxDH_multi<"vqdmladh", 0b0, 0b0, 0b0>;
3295 defm MVE_VQDMLADHX : MVE_VQxDMLxDH_multi<"vqdmladhx", 0b1, 0b0, 0b0>;
3296 defm MVE_VQRDMLADH : MVE_VQxDMLxDH_multi<"vqrdmladh", 0b0, 0b1, 0b0>;
3297 defm MVE_VQRDMLADHX : MVE_VQxDMLxDH_multi<"vqrdmladhx", 0b1, 0b1, 0b0>;
3298 defm MVE_VQDMLSDH : MVE_VQxDMLxDH_multi<"vqdmlsdh", 0b0, 0b0, 0b1>;
3299 defm MVE_VQDMLSDHX : MVE_VQxDMLxDH_multi<"vqdmlsdhx", 0b1, 0b0, 0b1>;
3300 defm MVE_VQRDMLSDH : MVE_VQxDMLxDH_multi<"vqrdmlsdh", 0b0, 0b1, 0b1>;
3301 defm MVE_VQRDMLSDHX : MVE_VQxDMLxDH_multi<"vqrdmlsdhx", 0b1, 0b1, 0b1>;
3303 class MVE_VCMUL<string iname, string suffix, bit size, list<dag> pattern=[]>
3304 : MVE_qDest_qSrc<iname, suffix, (outs MQPR:$Qd),
3305 (ins MQPR:$Qn, MQPR:$Qm, complexrotateop:$rot),
3306 "$Qd, $Qn, $Qm, $rot", vpred_r, "", pattern> {
3310 let Inst{28} = size;
3311 let Inst{21-20} = 0b11;
3312 let Inst{19-17} = Qn{2-0};
3314 let Inst{12} = rot{1};
3316 let Inst{7} = Qn{3};
3317 let Inst{0} = rot{0};
3319 let Predicates = [HasMVEFloat];
3322 def MVE_VCMULf16 : MVE_VCMUL<"vcmul", "f16", 0b0>;
3323 def MVE_VCMULf32 : MVE_VCMUL<"vcmul", "f32", 0b1>;
3325 class MVE_VMULL<string iname, string suffix, bit bit_28, bits<2> bits_21_20,
3326 bit T, list<dag> pattern=[]>
3327 : MVE_qDest_qSrc<iname, suffix, (outs MQPR:$Qd),
3328 (ins MQPR:$Qn, MQPR:$Qm), "$Qd, $Qn, $Qm",
3329 vpred_r, "", pattern> {
3334 let Inst{28} = bit_28;
3335 let Inst{21-20} = bits_21_20;
3336 let Inst{19-17} = Qn{2-0};
3340 let Inst{7} = Qn{3};
3344 multiclass MVE_VMULL_multi<string iname, string suffix,
3345 bit bit_28, bits<2> bits_21_20> {
3346 def bh : MVE_VMULL<iname # "b", suffix, bit_28, bits_21_20, 0b0>;
3347 def th : MVE_VMULL<iname # "t", suffix, bit_28, bits_21_20, 0b1>;
3350 // For integer multiplies, bits 21:20 encode size, and bit 28 signedness.
3351 // For polynomial multiplies, bits 21:20 take the unused value 0b11, and
3352 // bit 28 switches to encoding the size.
3354 defm MVE_VMULLs8 : MVE_VMULL_multi<"vmull", "s8", 0b0, 0b00>;
3355 defm MVE_VMULLs16 : MVE_VMULL_multi<"vmull", "s16", 0b0, 0b01>;
3356 defm MVE_VMULLs32 : MVE_VMULL_multi<"vmull", "s32", 0b0, 0b10>;
3357 defm MVE_VMULLu8 : MVE_VMULL_multi<"vmull", "u8", 0b1, 0b00>;
3358 defm MVE_VMULLu16 : MVE_VMULL_multi<"vmull", "u16", 0b1, 0b01>;
3359 defm MVE_VMULLu32 : MVE_VMULL_multi<"vmull", "u32", 0b1, 0b10>;
3360 defm MVE_VMULLp8 : MVE_VMULL_multi<"vmull", "p8", 0b0, 0b11>;
3361 defm MVE_VMULLp16 : MVE_VMULL_multi<"vmull", "p16", 0b1, 0b11>;
3363 class MVE_VxMULH<string iname, string suffix, bit U, bits<2> size,
3364 bit round, list<dag> pattern=[]>
3365 : MVE_qDest_qSrc<iname, suffix, (outs MQPR:$Qd),
3366 (ins MQPR:$Qn, MQPR:$Qm), "$Qd, $Qn, $Qm",
3367 vpred_r, "", pattern> {
3371 let Inst{21-20} = size;
3372 let Inst{19-17} = Qn{2-0};
3374 let Inst{12} = round;
3376 let Inst{7} = Qn{3};
3380 def MVE_VMULHs8 : MVE_VxMULH<"vmulh", "s8", 0b0, 0b00, 0b0>;
3381 def MVE_VMULHs16 : MVE_VxMULH<"vmulh", "s16", 0b0, 0b01, 0b0>;
3382 def MVE_VMULHs32 : MVE_VxMULH<"vmulh", "s32", 0b0, 0b10, 0b0>;
3383 def MVE_VMULHu8 : MVE_VxMULH<"vmulh", "u8", 0b1, 0b00, 0b0>;
3384 def MVE_VMULHu16 : MVE_VxMULH<"vmulh", "u16", 0b1, 0b01, 0b0>;
3385 def MVE_VMULHu32 : MVE_VxMULH<"vmulh", "u32", 0b1, 0b10, 0b0>;
3387 def MVE_VRMULHs8 : MVE_VxMULH<"vrmulh", "s8", 0b0, 0b00, 0b1>;
3388 def MVE_VRMULHs16 : MVE_VxMULH<"vrmulh", "s16", 0b0, 0b01, 0b1>;
3389 def MVE_VRMULHs32 : MVE_VxMULH<"vrmulh", "s32", 0b0, 0b10, 0b1>;
3390 def MVE_VRMULHu8 : MVE_VxMULH<"vrmulh", "u8", 0b1, 0b00, 0b1>;
3391 def MVE_VRMULHu16 : MVE_VxMULH<"vrmulh", "u16", 0b1, 0b01, 0b1>;
3392 def MVE_VRMULHu32 : MVE_VxMULH<"vrmulh", "u32", 0b1, 0b10, 0b1>;
3394 class MVE_VxMOVxN<string iname, string suffix, bit bit_28, bit bit_17,
3395 bits<2> size, bit T, list<dag> pattern=[]>
3396 : MVE_qDest_qSrc<iname, suffix, (outs MQPR:$Qd),
3397 (ins MQPR:$Qd_src, MQPR:$Qm), "$Qd, $Qm",
3398 vpred_n, "$Qd = $Qd_src", pattern> {
3400 let Inst{28} = bit_28;
3401 let Inst{21-20} = 0b11;
3402 let Inst{19-18} = size;
3403 let Inst{17} = bit_17;
3407 let Inst{7} = !if(!eq(bit_17, 0), 1, 0);
3411 multiclass MVE_VxMOVxN_halves<string iname, string suffix,
3412 bit bit_28, bit bit_17, bits<2> size> {
3413 def bh : MVE_VxMOVxN<iname # "b", suffix, bit_28, bit_17, size, 0b0>;
3414 def th : MVE_VxMOVxN<iname # "t", suffix, bit_28, bit_17, size, 0b1>;
3417 defm MVE_VMOVNi16 : MVE_VxMOVxN_halves<"vmovn", "i16", 0b1, 0b0, 0b00>;
3418 defm MVE_VMOVNi32 : MVE_VxMOVxN_halves<"vmovn", "i32", 0b1, 0b0, 0b01>;
3419 defm MVE_VQMOVNs16 : MVE_VxMOVxN_halves<"vqmovn", "s16", 0b0, 0b1, 0b00>;
3420 defm MVE_VQMOVNs32 : MVE_VxMOVxN_halves<"vqmovn", "s32", 0b0, 0b1, 0b01>;
3421 defm MVE_VQMOVNu16 : MVE_VxMOVxN_halves<"vqmovn", "u16", 0b1, 0b1, 0b00>;
3422 defm MVE_VQMOVNu32 : MVE_VxMOVxN_halves<"vqmovn", "u32", 0b1, 0b1, 0b01>;
3423 defm MVE_VQMOVUNs16 : MVE_VxMOVxN_halves<"vqmovun", "s16", 0b0, 0b0, 0b00>;
3424 defm MVE_VQMOVUNs32 : MVE_VxMOVxN_halves<"vqmovun", "s32", 0b0, 0b0, 0b01>;
3426 class MVE_VCVT_ff<string iname, string suffix, bit op, bit T,
3427 list<dag> pattern=[]>
3428 : MVE_qDest_qSrc<iname, suffix, (outs MQPR:$Qd), (ins MQPR:$Qd_src, MQPR:$Qm),
3429 "$Qd, $Qm", vpred_n, "$Qd = $Qd_src", pattern> {
3431 let Inst{21-16} = 0b111111;
3433 let Inst{8-7} = 0b00;
3436 let Predicates = [HasMVEFloat];
3439 multiclass MVE_VCVT_ff_halves<string suffix, bit op> {
3440 def bh : MVE_VCVT_ff<"vcvtb", suffix, op, 0b0>;
3441 def th : MVE_VCVT_ff<"vcvtt", suffix, op, 0b1>;
3444 defm MVE_VCVTf16f32 : MVE_VCVT_ff_halves<"f16.f32", 0b0>;
3445 defm MVE_VCVTf32f16 : MVE_VCVT_ff_halves<"f32.f16", 0b1>;
3447 class MVE_VxCADD<string iname, string suffix, bits<2> size, bit halve,
3448 list<dag> pattern=[]>
3449 : MVE_qDest_qSrc<iname, suffix, (outs MQPR:$Qd),
3450 (ins MQPR:$Qn, MQPR:$Qm, complexrotateopodd:$rot),
3451 "$Qd, $Qn, $Qm, $rot", vpred_r, "",
3456 let Inst{28} = halve;
3457 let Inst{21-20} = size;
3458 let Inst{19-17} = Qn{2-0};
3462 let Inst{7} = Qn{3};
3466 def MVE_VCADDi8 : MVE_VxCADD<"vcadd", "i8", 0b00, 0b1>;
3467 def MVE_VCADDi16 : MVE_VxCADD<"vcadd", "i16", 0b01, 0b1>;
3468 def MVE_VCADDi32 : MVE_VxCADD<"vcadd", "i32", 0b10, 0b1>;
3470 def MVE_VHCADDs8 : MVE_VxCADD<"vhcadd", "s8", 0b00, 0b0>;
3471 def MVE_VHCADDs16 : MVE_VxCADD<"vhcadd", "s16", 0b01, 0b0>;
3472 def MVE_VHCADDs32 : MVE_VxCADD<"vhcadd", "s32", 0b10, 0b0>;
3474 class MVE_VADCSBC<string iname, bit I, bit subtract,
3475 dag carryin, list<dag> pattern=[]>
3476 : MVE_qDest_qSrc<iname, "i32", (outs MQPR:$Qd, cl_FPSCR_NZCV:$carryout),
3477 !con((ins MQPR:$Qn, MQPR:$Qm), carryin),
3478 "$Qd, $Qn, $Qm", vpred_r, "", pattern> {
3481 let Inst{28} = subtract;
3482 let Inst{21-20} = 0b11;
3483 let Inst{19-17} = Qn{2-0};
3487 let Inst{7} = Qn{3};
3490 // Custom decoder method in order to add the FPSCR operand(s), which
3491 // Tablegen won't do right
3492 let DecoderMethod = "DecodeMVEVADCInstruction";
3495 def MVE_VADC : MVE_VADCSBC<"vadc", 0b0, 0b0, (ins cl_FPSCR_NZCV:$carryin)>;
3496 def MVE_VADCI : MVE_VADCSBC<"vadci", 0b1, 0b0, (ins)>;
3498 def MVE_VSBC : MVE_VADCSBC<"vsbc", 0b0, 0b1, (ins cl_FPSCR_NZCV:$carryin)>;
3499 def MVE_VSBCI : MVE_VADCSBC<"vsbci", 0b1, 0b1, (ins)>;
3501 class MVE_VQDMULL<string iname, string suffix, bit size, bit T,
3502 list<dag> pattern=[]>
3503 : MVE_qDest_qSrc<iname, suffix, (outs MQPR:$Qd),
3504 (ins MQPR:$Qn, MQPR:$Qm), "$Qd, $Qn, $Qm",
3505 vpred_r, "", pattern> {
3508 let Inst{28} = size;
3509 let Inst{21-20} = 0b11;
3510 let Inst{19-17} = Qn{2-0};
3514 let Inst{7} = Qn{3};
3518 multiclass MVE_VQDMULL_halves<string suffix, bit size> {
3519 def bh : MVE_VQDMULL<"vqdmullb", suffix, size, 0b0>;
3520 def th : MVE_VQDMULL<"vqdmullt", suffix, size, 0b1>;
3523 defm MVE_VQDMULLs16 : MVE_VQDMULL_halves<"s16", 0b0>;
3524 defm MVE_VQDMULLs32 : MVE_VQDMULL_halves<"s32", 0b1>;
3526 // end of mve_qDest_qSrc
3528 // start of mve_qDest_rSrc
3530 class MVE_qr_base<dag oops, dag iops, InstrItinClass itin, string iname,
3531 string suffix, string ops, vpred_ops vpred, string cstr,
3532 list<dag> pattern=[]>
3533 : MVE_p<oops, iops, NoItinerary, iname, suffix, ops, vpred, cstr, pattern> {
3538 let Inst{25-23} = 0b100;
3539 let Inst{22} = Qd{3};
3540 let Inst{19-17} = Qn{2-0};
3541 let Inst{15-13} = Qd{2-0};
3542 let Inst{11-9} = 0b111;
3543 let Inst{7} = Qn{3};
3546 let Inst{3-0} = Rm{3-0};
3549 class MVE_qDest_rSrc<string iname, string suffix, list<dag> pattern=[]>
3550 : MVE_qr_base<(outs MQPR:$Qd), (ins MQPR:$Qn, rGPR:$Rm),
3551 NoItinerary, iname, suffix, "$Qd, $Qn, $Rm", vpred_r, "",
3554 class MVE_qDestSrc_rSrc<string iname, string suffix, list<dag> pattern=[]>
3555 : MVE_qr_base<(outs MQPR:$Qd), (ins MQPR:$Qd_src, MQPR:$Qn, rGPR:$Rm),
3556 NoItinerary, iname, suffix, "$Qd, $Qn, $Rm", vpred_n, "$Qd = $Qd_src",
3559 class MVE_qDest_single_rSrc<string iname, string suffix, list<dag> pattern=[]>
3560 : MVE_p<(outs MQPR:$Qd), (ins MQPR:$Qd_src, rGPR:$Rm), NoItinerary, iname,
3561 suffix, "$Qd, $Rm", vpred_n, "$Qd = $Qd_src", pattern> {
3565 let Inst{22} = Qd{3};
3566 let Inst{15-13} = Qd{2-0};
3567 let Inst{3-0} = Rm{3-0};
3570 class MVE_VADDSUB_qr<string iname, string suffix, bits<2> size,
3571 bit bit_5, bit bit_12, bit bit_16,
3572 bit bit_28, list<dag> pattern=[]>
3573 : MVE_qDest_rSrc<iname, suffix, pattern> {
3575 let Inst{28} = bit_28;
3576 let Inst{21-20} = size;
3577 let Inst{16} = bit_16;
3578 let Inst{12} = bit_12;
3580 let Inst{5} = bit_5;
3583 multiclass MVE_VADDSUB_qr_sizes<string iname, string suffix,
3584 bit bit_5, bit bit_12, bit bit_16,
3585 bit bit_28, list<dag> pattern=[]> {
3586 def "8" : MVE_VADDSUB_qr<iname, suffix#"8", 0b00,
3587 bit_5, bit_12, bit_16, bit_28>;
3588 def "16" : MVE_VADDSUB_qr<iname, suffix#"16", 0b01,
3589 bit_5, bit_12, bit_16, bit_28>;
3590 def "32" : MVE_VADDSUB_qr<iname, suffix#"32", 0b10,
3591 bit_5, bit_12, bit_16, bit_28>;
3594 defm MVE_VADD_qr_i : MVE_VADDSUB_qr_sizes<"vadd", "i", 0b0, 0b0, 0b1, 0b0>;
3595 defm MVE_VQADD_qr_s : MVE_VADDSUB_qr_sizes<"vqadd", "s", 0b1, 0b0, 0b0, 0b0>;
3596 defm MVE_VQADD_qr_u : MVE_VADDSUB_qr_sizes<"vqadd", "u", 0b1, 0b0, 0b0, 0b1>;
3598 defm MVE_VSUB_qr_i : MVE_VADDSUB_qr_sizes<"vsub", "i", 0b0, 0b1, 0b1, 0b0>;
3599 defm MVE_VQSUB_qr_s : MVE_VADDSUB_qr_sizes<"vqsub", "s", 0b1, 0b1, 0b0, 0b0>;
3600 defm MVE_VQSUB_qr_u : MVE_VADDSUB_qr_sizes<"vqsub", "u", 0b1, 0b1, 0b0, 0b1>;
3602 class MVE_VQDMULL_qr<string iname, string suffix, bit size,
3603 bit T, list<dag> pattern=[]>
3604 : MVE_qDest_rSrc<iname, suffix, pattern> {
3606 let Inst{28} = size;
3607 let Inst{21-20} = 0b11;
3614 multiclass MVE_VQDMULL_qr_halves<string suffix, bit size> {
3615 def bh : MVE_VQDMULL_qr<"vqdmullb", suffix, size, 0b0>;
3616 def th : MVE_VQDMULL_qr<"vqdmullt", suffix, size, 0b1>;
3619 defm MVE_VQDMULL_qr_s16 : MVE_VQDMULL_qr_halves<"s16", 0b0>;
3620 defm MVE_VQDMULL_qr_s32 : MVE_VQDMULL_qr_halves<"s32", 0b1>;
3622 class MVE_VxADDSUB_qr<string iname, string suffix,
3623 bit bit_28, bits<2> bits_21_20, bit subtract,
3624 list<dag> pattern=[]>
3625 : MVE_qDest_rSrc<iname, suffix, pattern> {
3627 let Inst{28} = bit_28;
3628 let Inst{21-20} = bits_21_20;
3630 let Inst{12} = subtract;
3635 def MVE_VHADD_qr_s8 : MVE_VxADDSUB_qr<"vhadd", "s8", 0b0, 0b00, 0b0>;
3636 def MVE_VHADD_qr_s16 : MVE_VxADDSUB_qr<"vhadd", "s16", 0b0, 0b01, 0b0>;
3637 def MVE_VHADD_qr_s32 : MVE_VxADDSUB_qr<"vhadd", "s32", 0b0, 0b10, 0b0>;
3638 def MVE_VHADD_qr_u8 : MVE_VxADDSUB_qr<"vhadd", "u8", 0b1, 0b00, 0b0>;
3639 def MVE_VHADD_qr_u16 : MVE_VxADDSUB_qr<"vhadd", "u16", 0b1, 0b01, 0b0>;
3640 def MVE_VHADD_qr_u32 : MVE_VxADDSUB_qr<"vhadd", "u32", 0b1, 0b10, 0b0>;
3642 def MVE_VHSUB_qr_s8 : MVE_VxADDSUB_qr<"vhsub", "s8", 0b0, 0b00, 0b1>;
3643 def MVE_VHSUB_qr_s16 : MVE_VxADDSUB_qr<"vhsub", "s16", 0b0, 0b01, 0b1>;
3644 def MVE_VHSUB_qr_s32 : MVE_VxADDSUB_qr<"vhsub", "s32", 0b0, 0b10, 0b1>;
3645 def MVE_VHSUB_qr_u8 : MVE_VxADDSUB_qr<"vhsub", "u8", 0b1, 0b00, 0b1>;
3646 def MVE_VHSUB_qr_u16 : MVE_VxADDSUB_qr<"vhsub", "u16", 0b1, 0b01, 0b1>;
3647 def MVE_VHSUB_qr_u32 : MVE_VxADDSUB_qr<"vhsub", "u32", 0b1, 0b10, 0b1>;
3649 let Predicates = [HasMVEFloat] in {
3650 def MVE_VADD_qr_f32 : MVE_VxADDSUB_qr<"vadd", "f32", 0b0, 0b11, 0b0>;
3651 def MVE_VADD_qr_f16 : MVE_VxADDSUB_qr<"vadd", "f16", 0b1, 0b11, 0b0>;
3653 def MVE_VSUB_qr_f32 : MVE_VxADDSUB_qr<"vsub", "f32", 0b0, 0b11, 0b1>;
3654 def MVE_VSUB_qr_f16 : MVE_VxADDSUB_qr<"vsub", "f16", 0b1, 0b11, 0b1>;
3657 class MVE_VxSHL_qr<string iname, string suffix, bit U, bits<2> size,
3658 bit bit_7, bit bit_17, list<dag> pattern=[]>
3659 : MVE_qDest_single_rSrc<iname, suffix, pattern> {
3662 let Inst{25-23} = 0b100;
3663 let Inst{21-20} = 0b11;
3664 let Inst{19-18} = size;
3665 let Inst{17} = bit_17;
3667 let Inst{12-8} = 0b11110;
3668 let Inst{7} = bit_7;
3669 let Inst{6-4} = 0b110;
3672 multiclass MVE_VxSHL_qr_types<string iname, bit bit_7, bit bit_17> {
3673 def s8 : MVE_VxSHL_qr<iname, "s8", 0b0, 0b00, bit_7, bit_17>;
3674 def s16 : MVE_VxSHL_qr<iname, "s16", 0b0, 0b01, bit_7, bit_17>;
3675 def s32 : MVE_VxSHL_qr<iname, "s32", 0b0, 0b10, bit_7, bit_17>;
3676 def u8 : MVE_VxSHL_qr<iname, "u8", 0b1, 0b00, bit_7, bit_17>;
3677 def u16 : MVE_VxSHL_qr<iname, "u16", 0b1, 0b01, bit_7, bit_17>;
3678 def u32 : MVE_VxSHL_qr<iname, "u32", 0b1, 0b10, bit_7, bit_17>;
3681 defm MVE_VSHL_qr : MVE_VxSHL_qr_types<"vshl", 0b0, 0b0>;
3682 defm MVE_VRSHL_qr : MVE_VxSHL_qr_types<"vrshl", 0b0, 0b1>;
3683 defm MVE_VQSHL_qr : MVE_VxSHL_qr_types<"vqshl", 0b1, 0b0>;
3684 defm MVE_VQRSHL_qr : MVE_VxSHL_qr_types<"vqrshl", 0b1, 0b1>;
3686 let Predicates = [HasMVEInt] in {
3687 def : Pat<(v4i32 (ARMvshlu (v4i32 MQPR:$Qm), (v4i32 (ARMvdup GPR:$Rm)))),
3688 (v4i32 (MVE_VSHL_qru32 (v4i32 MQPR:$Qm), GPR:$Rm))>;
3689 def : Pat<(v8i16 (ARMvshlu (v8i16 MQPR:$Qm), (v8i16 (ARMvdup GPR:$Rm)))),
3690 (v8i16 (MVE_VSHL_qru16 (v8i16 MQPR:$Qm), GPR:$Rm))>;
3691 def : Pat<(v16i8 (ARMvshlu (v16i8 MQPR:$Qm), (v16i8 (ARMvdup GPR:$Rm)))),
3692 (v16i8 (MVE_VSHL_qru8 (v16i8 MQPR:$Qm), GPR:$Rm))>;
3694 def : Pat<(v4i32 (ARMvshls (v4i32 MQPR:$Qm), (v4i32 (ARMvdup GPR:$Rm)))),
3695 (v4i32 (MVE_VSHL_qrs32 (v4i32 MQPR:$Qm), GPR:$Rm))>;
3696 def : Pat<(v8i16 (ARMvshls (v8i16 MQPR:$Qm), (v8i16 (ARMvdup GPR:$Rm)))),
3697 (v8i16 (MVE_VSHL_qrs16 (v8i16 MQPR:$Qm), GPR:$Rm))>;
3698 def : Pat<(v16i8 (ARMvshls (v16i8 MQPR:$Qm), (v16i8 (ARMvdup GPR:$Rm)))),
3699 (v16i8 (MVE_VSHL_qrs8 (v16i8 MQPR:$Qm), GPR:$Rm))>;
3702 class MVE_VBRSR<string iname, string suffix, bits<2> size, list<dag> pattern=[]>
3703 : MVE_qDest_rSrc<iname, suffix, pattern> {
3706 let Inst{21-20} = size;
3713 def MVE_VBRSR8 : MVE_VBRSR<"vbrsr", "8", 0b00>;
3714 def MVE_VBRSR16 : MVE_VBRSR<"vbrsr", "16", 0b01>;
3715 def MVE_VBRSR32 : MVE_VBRSR<"vbrsr", "32", 0b10>;
3717 class MVE_VMUL_qr_int<string iname, string suffix,
3718 bits<2> size, list<dag> pattern=[]>
3719 : MVE_qDest_rSrc<iname, suffix, pattern> {
3722 let Inst{21-20} = size;
3729 def MVE_VMUL_qr_i8 : MVE_VMUL_qr_int<"vmul", "i8", 0b00>;
3730 def MVE_VMUL_qr_i16 : MVE_VMUL_qr_int<"vmul", "i16", 0b01>;
3731 def MVE_VMUL_qr_i32 : MVE_VMUL_qr_int<"vmul", "i32", 0b10>;
3733 class MVE_VxxMUL_qr<string iname, string suffix,
3734 bit bit_28, bits<2> bits_21_20, list<dag> pattern=[]>
3735 : MVE_qDest_rSrc<iname, suffix, pattern> {
3737 let Inst{28} = bit_28;
3738 let Inst{21-20} = bits_21_20;
3745 def MVE_VQDMULH_qr_s8 : MVE_VxxMUL_qr<"vqdmulh", "s8", 0b0, 0b00>;
3746 def MVE_VQDMULH_qr_s16 : MVE_VxxMUL_qr<"vqdmulh", "s16", 0b0, 0b01>;
3747 def MVE_VQDMULH_qr_s32 : MVE_VxxMUL_qr<"vqdmulh", "s32", 0b0, 0b10>;
3749 def MVE_VQRDMULH_qr_s8 : MVE_VxxMUL_qr<"vqrdmulh", "s8", 0b1, 0b00>;
3750 def MVE_VQRDMULH_qr_s16 : MVE_VxxMUL_qr<"vqrdmulh", "s16", 0b1, 0b01>;
3751 def MVE_VQRDMULH_qr_s32 : MVE_VxxMUL_qr<"vqrdmulh", "s32", 0b1, 0b10>;
3753 let Predicates = [HasMVEFloat] in {
3754 def MVE_VMUL_qr_f16 : MVE_VxxMUL_qr<"vmul", "f16", 0b1, 0b11>;
3755 def MVE_VMUL_qr_f32 : MVE_VxxMUL_qr<"vmul", "f32", 0b0, 0b11>;
3758 class MVE_VFMAMLA_qr<string iname, string suffix,
3759 bit bit_28, bits<2> bits_21_20, bit S,
3760 list<dag> pattern=[]>
3761 : MVE_qDestSrc_rSrc<iname, suffix, pattern> {
3763 let Inst{28} = bit_28;
3764 let Inst{21-20} = bits_21_20;
3771 def MVE_VMLA_qr_s8 : MVE_VFMAMLA_qr<"vmla", "s8", 0b0, 0b00, 0b0>;
3772 def MVE_VMLA_qr_s16 : MVE_VFMAMLA_qr<"vmla", "s16", 0b0, 0b01, 0b0>;
3773 def MVE_VMLA_qr_s32 : MVE_VFMAMLA_qr<"vmla", "s32", 0b0, 0b10, 0b0>;
3774 def MVE_VMLA_qr_u8 : MVE_VFMAMLA_qr<"vmla", "u8", 0b1, 0b00, 0b0>;
3775 def MVE_VMLA_qr_u16 : MVE_VFMAMLA_qr<"vmla", "u16", 0b1, 0b01, 0b0>;
3776 def MVE_VMLA_qr_u32 : MVE_VFMAMLA_qr<"vmla", "u32", 0b1, 0b10, 0b0>;
3778 def MVE_VMLAS_qr_s8 : MVE_VFMAMLA_qr<"vmlas", "s8", 0b0, 0b00, 0b1>;
3779 def MVE_VMLAS_qr_s16 : MVE_VFMAMLA_qr<"vmlas", "s16", 0b0, 0b01, 0b1>;
3780 def MVE_VMLAS_qr_s32 : MVE_VFMAMLA_qr<"vmlas", "s32", 0b0, 0b10, 0b1>;
3781 def MVE_VMLAS_qr_u8 : MVE_VFMAMLA_qr<"vmlas", "u8", 0b1, 0b00, 0b1>;
3782 def MVE_VMLAS_qr_u16 : MVE_VFMAMLA_qr<"vmlas", "u16", 0b1, 0b01, 0b1>;
3783 def MVE_VMLAS_qr_u32 : MVE_VFMAMLA_qr<"vmlas", "u32", 0b1, 0b10, 0b1>;
3785 let Predicates = [HasMVEInt] in {
3786 def : Pat<(v4i32 (add (v4i32 MQPR:$src1),
3787 (v4i32 (mul (v4i32 MQPR:$src2),
3788 (v4i32 (ARMvdup (i32 rGPR:$x))))))),
3789 (v4i32 (MVE_VMLA_qr_u32 $src1, $src2, $x))>;
3790 def : Pat<(v8i16 (add (v8i16 MQPR:$src1),
3791 (v8i16 (mul (v8i16 MQPR:$src2),
3792 (v8i16 (ARMvdup (i32 rGPR:$x))))))),
3793 (v8i16 (MVE_VMLA_qr_u16 $src1, $src2, $x))>;
3794 def : Pat<(v16i8 (add (v16i8 MQPR:$src1),
3795 (v16i8 (mul (v16i8 MQPR:$src2),
3796 (v16i8 (ARMvdup (i32 rGPR:$x))))))),
3797 (v16i8 (MVE_VMLA_qr_u8 $src1, $src2, $x))>;
3800 let Predicates = [HasMVEFloat] in {
3801 def MVE_VFMA_qr_f16 : MVE_VFMAMLA_qr<"vfma", "f16", 0b1, 0b11, 0b0>;
3802 def MVE_VFMA_qr_f32 : MVE_VFMAMLA_qr<"vfma", "f32", 0b0, 0b11, 0b0>;
3803 def MVE_VFMA_qr_Sf16 : MVE_VFMAMLA_qr<"vfmas", "f16", 0b1, 0b11, 0b1>;
3804 def MVE_VFMA_qr_Sf32 : MVE_VFMAMLA_qr<"vfmas", "f32", 0b0, 0b11, 0b1>;
3807 class MVE_VQDMLAH_qr<string iname, string suffix, bit U, bits<2> size,
3808 bit bit_5, bit bit_12, list<dag> pattern=[]>
3809 : MVE_qDestSrc_rSrc<iname, suffix, pattern> {
3812 let Inst{21-20} = size;
3814 let Inst{12} = bit_12;
3816 let Inst{5} = bit_5;
3819 multiclass MVE_VQDMLAH_qr_types<string iname, bit bit_5, bit bit_12> {
3820 def s8 : MVE_VQDMLAH_qr<iname, "s8", 0b0, 0b00, bit_5, bit_12>;
3821 def s16 : MVE_VQDMLAH_qr<iname, "s16", 0b0, 0b01, bit_5, bit_12>;
3822 def s32 : MVE_VQDMLAH_qr<iname, "s32", 0b0, 0b10, bit_5, bit_12>;
3825 defm MVE_VQDMLAH_qr : MVE_VQDMLAH_qr_types<"vqdmlah", 0b1, 0b0>;
3826 defm MVE_VQRDMLAH_qr : MVE_VQDMLAH_qr_types<"vqrdmlah", 0b0, 0b0>;
3827 defm MVE_VQDMLASH_qr : MVE_VQDMLAH_qr_types<"vqdmlash", 0b1, 0b1>;
3828 defm MVE_VQRDMLASH_qr : MVE_VQDMLAH_qr_types<"vqrdmlash", 0b0, 0b1>;
3830 class MVE_VxDUP<string iname, string suffix, bits<2> size, bit bit_12,
3831 list<dag> pattern=[]>
3832 : MVE_p<(outs MQPR:$Qd, tGPREven:$Rn),
3833 (ins tGPREven:$Rn_src, MVE_VIDUP_imm:$imm), NoItinerary,
3834 iname, suffix, "$Qd, $Rn, $imm", vpred_r, "$Rn = $Rn_src",
3841 let Inst{25-23} = 0b100;
3842 let Inst{22} = Qd{3};
3843 let Inst{21-20} = size;
3844 let Inst{19-17} = Rn{3-1};
3846 let Inst{15-13} = Qd{2-0};
3847 let Inst{12} = bit_12;
3848 let Inst{11-8} = 0b1111;
3849 let Inst{7} = imm{1};
3850 let Inst{6-1} = 0b110111;
3851 let Inst{0} = imm{0};
3854 def MVE_VIDUPu8 : MVE_VxDUP<"vidup", "u8", 0b00, 0b0>;
3855 def MVE_VIDUPu16 : MVE_VxDUP<"vidup", "u16", 0b01, 0b0>;
3856 def MVE_VIDUPu32 : MVE_VxDUP<"vidup", "u32", 0b10, 0b0>;
3858 def MVE_VDDUPu8 : MVE_VxDUP<"vddup", "u8", 0b00, 0b1>;
3859 def MVE_VDDUPu16 : MVE_VxDUP<"vddup", "u16", 0b01, 0b1>;
3860 def MVE_VDDUPu32 : MVE_VxDUP<"vddup", "u32", 0b10, 0b1>;
3862 class MVE_VxWDUP<string iname, string suffix, bits<2> size, bit bit_12,
3863 list<dag> pattern=[]>
3864 : MVE_p<(outs MQPR:$Qd, tGPREven:$Rn),
3865 (ins tGPREven:$Rn_src, tGPROdd:$Rm, MVE_VIDUP_imm:$imm), NoItinerary,
3866 iname, suffix, "$Qd, $Rn, $Rm, $imm", vpred_r, "$Rn = $Rn_src",
3874 let Inst{25-23} = 0b100;
3875 let Inst{22} = Qd{3};
3876 let Inst{21-20} = size;
3877 let Inst{19-17} = Rn{3-1};
3879 let Inst{15-13} = Qd{2-0};
3880 let Inst{12} = bit_12;
3881 let Inst{11-8} = 0b1111;
3882 let Inst{7} = imm{1};
3883 let Inst{6-4} = 0b110;
3884 let Inst{3-1} = Rm{3-1};
3885 let Inst{0} = imm{0};
3888 def MVE_VIWDUPu8 : MVE_VxWDUP<"viwdup", "u8", 0b00, 0b0>;
3889 def MVE_VIWDUPu16 : MVE_VxWDUP<"viwdup", "u16", 0b01, 0b0>;
3890 def MVE_VIWDUPu32 : MVE_VxWDUP<"viwdup", "u32", 0b10, 0b0>;
3892 def MVE_VDWDUPu8 : MVE_VxWDUP<"vdwdup", "u8", 0b00, 0b1>;
3893 def MVE_VDWDUPu16 : MVE_VxWDUP<"vdwdup", "u16", 0b01, 0b1>;
3894 def MVE_VDWDUPu32 : MVE_VxWDUP<"vdwdup", "u32", 0b10, 0b1>;
3896 class MVE_VCTP<string suffix, bits<2> size, list<dag> pattern=[]>
3897 : MVE_p<(outs VCCR:$P0), (ins rGPR:$Rn), NoItinerary, "vctp", suffix,
3898 "$Rn", vpred_n, "", pattern> {
3901 let Inst{28-27} = 0b10;
3902 let Inst{26-22} = 0b00000;
3903 let Inst{21-20} = size;
3904 let Inst{19-16} = Rn{3-0};
3905 let Inst{15-11} = 0b11101;
3906 let Inst{10-0} = 0b00000000001;
3907 let Unpredictable{10-0} = 0b11111111111;
3909 let Constraints = "";
3910 let DecoderMethod = "DecodeMveVCTP";
3913 def MVE_VCTP8 : MVE_VCTP<"8", 0b00>;
3914 def MVE_VCTP16 : MVE_VCTP<"16", 0b01>;
3915 def MVE_VCTP32 : MVE_VCTP<"32", 0b10>;
3916 def MVE_VCTP64 : MVE_VCTP<"64", 0b11>;
3918 // end of mve_qDest_rSrc
3920 // start of coproc mov
3922 class MVE_VMOV_64bit<dag oops, dag iops, bit to_qreg, string ops, string cstr>
3923 : MVE_VMOV_lane_base<oops, !con(iops, (ins MVEPairVectorIndex2:$idx,
3924 MVEPairVectorIndex0:$idx2)),
3925 NoItinerary, "vmov", "", ops, cstr, []> {
3932 let Inst{31-23} = 0b111011000;
3933 let Inst{22} = Qd{3};
3935 let Inst{20} = to_qreg;
3936 let Inst{19-16} = Rt2{3-0};
3937 let Inst{15-13} = Qd{2-0};
3938 let Inst{12-5} = 0b01111000;
3940 let Inst{3-0} = Rt{3-0};
3943 // The assembly syntax for these instructions mentions the vector
3944 // register name twice, e.g.
3946 // vmov q2[2], q2[0], r0, r1
3947 // vmov r0, r1, q2[2], q2[0]
3949 // which needs a bit of juggling with MC operand handling.
3951 // For the move _into_ a vector register, the MC operand list also has
3952 // to mention the register name twice: once as the output, and once as
3953 // an extra input to represent where the unchanged half of the output
3954 // register comes from (when this instruction is used in code
3955 // generation). So we arrange that the first mention of the vector reg
3956 // in the instruction is considered by the AsmMatcher to be the output
3957 // ($Qd), and the second one is the input ($QdSrc). Binding them
3958 // together with the existing 'tie' constraint is enough to enforce at
3959 // register allocation time that they have to be the same register.
3961 // For the move _from_ a vector register, there's no way to get round
3962 // the fact that both instances of that register name have to be
3963 // inputs. They have to be the same register again, but this time, we
3964 // can't use a tie constraint, because that has to be between an
3965 // output and an input operand. So this time, we have to arrange that
3966 // the q-reg appears just once in the MC operand list, in spite of
3967 // being mentioned twice in the asm syntax - which needs a custom
3968 // AsmMatchConverter.
3970 def MVE_VMOV_q_rr : MVE_VMOV_64bit<(outs MQPR:$Qd),
3971 (ins MQPR:$QdSrc, rGPR:$Rt, rGPR:$Rt2),
3972 0b1, "$Qd$idx, $QdSrc$idx2, $Rt, $Rt2",
3974 let DecoderMethod = "DecodeMVEVMOVDRegtoQ";
3977 def MVE_VMOV_rr_q : MVE_VMOV_64bit<(outs rGPR:$Rt, rGPR:$Rt2), (ins MQPR:$Qd),
3978 0b0, "$Rt, $Rt2, $Qd$idx, $Qd$idx2", ""> {
3979 let DecoderMethod = "DecodeMVEVMOVQtoDReg";
3980 let AsmMatchConverter = "cvtMVEVMOVQtoDReg";
3983 // end of coproc mov
3985 // start of MVE interleaving load/store
3987 // Base class for the family of interleaving/deinterleaving
3988 // load/stores with names like VLD20.8 and VST43.32.
3989 class MVE_vldst24_base<bit writeback, bit fourregs, bits<2> stage, bits<2> size,
3990 bit load, dag Oops, dag loadIops, dag wbIops,
3991 string iname, string ops,
3992 string cstr, list<dag> pattern=[]>
3993 : MVE_MI<Oops, !con(loadIops, wbIops), NoItinerary, iname, ops, cstr, pattern> {
3997 let Inst{31-22} = 0b1111110010;
3998 let Inst{21} = writeback;
3999 let Inst{20} = load;
4000 let Inst{19-16} = Rn;
4001 let Inst{15-13} = VQd{2-0};
4002 let Inst{12-9} = 0b1111;
4003 let Inst{8-7} = size;
4004 let Inst{6-5} = stage;
4005 let Inst{4-1} = 0b0000;
4006 let Inst{0} = fourregs;
4009 let mayStore = !eq(load,0);
4012 // A parameter class used to encapsulate all the ways the writeback
4013 // variants of VLD20 and friends differ from the non-writeback ones.
4014 class MVE_vldst24_writeback<bit b, dag Oo, dag Io,
4015 string sy="", string c="", string n=""> {
4021 string id_suffix = n;
4024 // Another parameter class that encapsulates the differences between VLD2x
4026 class MVE_vldst24_nvecs<int n, list<int> s, bit b, RegisterOperand vl> {
4028 list<int> stages = s;
4030 RegisterOperand VecList = vl;
4033 // A third parameter class that distinguishes VLDnn.8 from .16 from .32.
4034 class MVE_vldst24_lanesize<int i, bits<2> b> {
4036 bits<2> sizebits = b;
4039 // A base class for each direction of transfer: one for load, one for
4040 // store. I can't make these a fourth independent parametric tuple
4041 // class, because they have to take the nvecs tuple class as a
4042 // parameter, in order to find the right VecList operand type.
4044 class MVE_vld24_base<MVE_vldst24_nvecs n, bits<2> pat, bits<2> size,
4045 MVE_vldst24_writeback wb, string iname,
4046 list<dag> pattern=[]>
4047 : MVE_vldst24_base<wb.writeback, n.bit0, pat, size, 1,
4048 !con((outs n.VecList:$VQd), wb.Oops),
4049 (ins n.VecList:$VQdSrc), wb.Iops,
4050 iname, "$VQd, $Rn" # wb.syntax,
4051 wb.cstr # ",$VQdSrc = $VQd", pattern>;
4053 class MVE_vst24_base<MVE_vldst24_nvecs n, bits<2> pat, bits<2> size,
4054 MVE_vldst24_writeback wb, string iname,
4055 list<dag> pattern=[]>
4056 : MVE_vldst24_base<wb.writeback, n.bit0, pat, size, 0,
4057 wb.Oops, (ins n.VecList:$VQd), wb.Iops,
4058 iname, "$VQd, $Rn" # wb.syntax,
4061 // Actually define all the interleaving loads and stores, by a series
4062 // of nested foreaches over number of vectors (VLD2/VLD4); stage
4063 // within one of those series (VLDx0/VLDx1/VLDx2/VLDx3); size of
4064 // vector lane; writeback or no writeback.
4065 foreach n = [MVE_vldst24_nvecs<2, [0,1], 0, VecList2Q>,
4066 MVE_vldst24_nvecs<4, [0,1,2,3], 1, VecList4Q>] in
4067 foreach stage = n.stages in
4068 foreach s = [MVE_vldst24_lanesize< 8, 0b00>,
4069 MVE_vldst24_lanesize<16, 0b01>,
4070 MVE_vldst24_lanesize<32, 0b10>] in
4071 foreach wb = [MVE_vldst24_writeback<
4072 1, (outs rGPR:$wb), (ins t2_nosp_addr_offset_none:$Rn),
4073 "!", "$Rn.base = $wb", "_wb">,
4074 MVE_vldst24_writeback<0, (outs), (ins t2_addr_offset_none:$Rn)>] in {
4076 // For each case within all of those foreaches, define the actual
4077 // instructions. The def names are made by gluing together pieces
4078 // from all the parameter classes, and will end up being things like
4079 // MVE_VLD20_8 and MVE_VST43_16_wb.
4081 def "MVE_VLD" # n.nvecs # stage # "_" # s.lanesize # wb.id_suffix
4082 : MVE_vld24_base<n, stage, s.sizebits, wb,
4083 "vld" # n.nvecs # stage # "." # s.lanesize>;
4085 def "MVE_VST" # n.nvecs # stage # "_" # s.lanesize # wb.id_suffix
4086 : MVE_vst24_base<n, stage, s.sizebits, wb,
4087 "vst" # n.nvecs # stage # "." # s.lanesize>;
4090 // end of MVE interleaving load/store
4092 // start of MVE predicable load/store
4094 // A parameter class for the direction of transfer.
4095 class MVE_ldst_direction<bit b, dag Oo, dag Io, string c=""> {
4101 def MVE_ld: MVE_ldst_direction<1, (outs MQPR:$Qd), (ins), ",@earlyclobber $Qd">;
4102 def MVE_st: MVE_ldst_direction<0, (outs), (ins MQPR:$Qd)>;
4104 // A parameter class for the size of memory access in a load.
4105 class MVE_memsz<bits<2> e, int s, AddrMode m, string mn, list<string> types> {
4106 bits<2> encoding = e; // opcode bit(s) for encoding
4107 int shift = s; // shift applied to immediate load offset
4110 // For instruction aliases: define the complete list of type
4111 // suffixes at this size, and the canonical ones for loads and
4113 string MnemonicLetter = mn;
4114 int TypeBits = !shl(8, s);
4115 string CanonLoadSuffix = ".u" # TypeBits;
4116 string CanonStoreSuffix = "." # TypeBits;
4117 list<string> suffixes = !foreach(letter, types, "." # letter # TypeBits);
4120 // Instances of MVE_memsz.
4122 // (memD doesn't need an AddrMode, because those are only for
4123 // contiguous loads, and memD is only used by gather/scatters.)
4124 def MVE_memB: MVE_memsz<0b00, 0, AddrModeT2_i7, "b", ["", "u", "s"]>;
4125 def MVE_memH: MVE_memsz<0b01, 1, AddrModeT2_i7s2, "h", ["", "u", "s", "f"]>;
4126 def MVE_memW: MVE_memsz<0b10, 2, AddrModeT2_i7s4, "w", ["", "u", "s", "f"]>;
4127 def MVE_memD: MVE_memsz<0b11, 3, ?, "d", ["", "u", "s", "f"]>;
4129 // This is the base class for all the MVE loads and stores other than
4130 // the interleaving ones. All the non-interleaving loads/stores share
4131 // the characteristic that they operate on just one vector register,
4132 // so they are VPT-predicable.
4134 // The predication operand is vpred_n, for both loads and stores. For
4135 // store instructions, the reason is obvious: if there is no output
4136 // register, there can't be a need for an input parameter giving the
4137 // output register's previous value. Load instructions also don't need
4138 // that input parameter, because unlike MVE data processing
4139 // instructions, predicated loads are defined to set the inactive
4140 // lanes of the output register to zero, instead of preserving their
4142 class MVE_VLDRSTR_base<MVE_ldst_direction dir, bit U, bit P, bit W, bit opc,
4143 dag oops, dag iops, string asm, string suffix,
4144 string ops, string cstr, list<dag> pattern=[]>
4145 : MVE_p<oops, iops, NoItinerary, asm, suffix, ops, vpred_n, cstr, pattern> {
4153 let Inst{20} = dir.load;
4154 let Inst{15-13} = Qd{2-0};
4156 let Inst{11-9} = 0b111;
4158 let mayLoad = dir.load;
4159 let mayStore = !eq(dir.load,0);
4162 // Contiguous load and store instructions. These come in two main
4163 // categories: same-size loads/stores in which 128 bits of vector
4164 // register is transferred to or from 128 bits of memory in the most
4165 // obvious way, and widening loads / narrowing stores, in which the
4166 // size of memory accessed is less than the size of a vector register,
4167 // so the load instructions sign- or zero-extend each memory value
4168 // into a wider vector lane, and the store instructions truncate
4171 // The instruction mnemonics for these two classes look reasonably
4172 // similar, but the actual encodings are different enough to need two
4173 // separate base classes.
4175 // Contiguous, same size
4176 class MVE_VLDRSTR_cs<MVE_ldst_direction dir, MVE_memsz memsz, bit P, bit W,
4177 dag oops, dag iops, string asm, string suffix,
4178 IndexMode im, string ops, string cstr>
4179 : MVE_VLDRSTR_base<dir, 0, P, W, 1, oops, iops, asm, suffix, ops, cstr> {
4181 let Inst{23} = addr{7};
4182 let Inst{19-16} = addr{11-8};
4183 let Inst{8-7} = memsz.encoding;
4184 let Inst{6-0} = addr{6-0};
4187 // Contiguous, widening/narrowing
4188 class MVE_VLDRSTR_cw<MVE_ldst_direction dir, MVE_memsz memsz, bit U,
4189 bit P, bit W, bits<2> size, dag oops, dag iops,
4190 string asm, string suffix, IndexMode im,
4191 string ops, string cstr>
4192 : MVE_VLDRSTR_base<dir, U, P, W, 0, oops, iops, asm, suffix, ops, cstr> {
4194 let Inst{23} = addr{7};
4195 let Inst{19} = memsz.encoding{0}; // enough to tell 16- from 32-bit
4196 let Inst{18-16} = addr{10-8};
4197 let Inst{8-7} = size;
4198 let Inst{6-0} = addr{6-0};
4203 // Multiclass wrapper on each of the _cw and _cs base classes, to
4204 // generate three writeback modes (none, preindex, postindex).
4206 multiclass MVE_VLDRSTR_cw_m<MVE_ldst_direction dir, MVE_memsz memsz,
4207 string asm, string suffix, bit U, bits<2> size> {
4208 let AM = memsz.AM in {
4209 def "" : MVE_VLDRSTR_cw<
4210 dir, memsz, U, 1, 0, size,
4211 dir.Oops, !con(dir.Iops, (ins taddrmode_imm7<memsz.shift>:$addr)),
4212 asm, suffix, IndexModeNone, "$Qd, $addr", "">;
4214 def _pre : MVE_VLDRSTR_cw<
4215 dir, memsz, U, 1, 1, size,
4216 !con((outs tGPR:$wb), dir.Oops),
4217 !con(dir.Iops, (ins taddrmode_imm7<memsz.shift>:$addr)),
4218 asm, suffix, IndexModePre, "$Qd, $addr!", "$addr.base = $wb"> {
4219 let DecoderMethod = "DecodeMVE_MEM_1_pre<"#memsz.shift#">";
4222 def _post : MVE_VLDRSTR_cw<
4223 dir, memsz, U, 0, 1, size,
4224 !con((outs tGPR:$wb), dir.Oops),
4225 !con(dir.Iops, (ins t_addr_offset_none:$Rn,
4226 t2am_imm7_offset<memsz.shift>:$addr)),
4227 asm, suffix, IndexModePost, "$Qd, $Rn$addr", "$Rn.base = $wb"> {
4229 let Inst{18-16} = Rn{2-0};
4234 multiclass MVE_VLDRSTR_cs_m<MVE_ldst_direction dir, MVE_memsz memsz,
4235 string asm, string suffix> {
4236 let AM = memsz.AM in {
4237 def "" : MVE_VLDRSTR_cs<
4239 dir.Oops, !con(dir.Iops, (ins t2addrmode_imm7<memsz.shift>:$addr)),
4240 asm, suffix, IndexModeNone, "$Qd, $addr", "">;
4242 def _pre : MVE_VLDRSTR_cs<
4244 !con((outs rGPR:$wb), dir.Oops),
4245 !con(dir.Iops, (ins t2addrmode_imm7_pre<memsz.shift>:$addr)),
4246 asm, suffix, IndexModePre, "$Qd, $addr!", "$addr.base = $wb"> {
4247 let DecoderMethod = "DecodeMVE_MEM_2_pre<"#memsz.shift#">";
4250 def _post : MVE_VLDRSTR_cs<
4252 !con((outs rGPR:$wb), dir.Oops),
4253 // We need an !if here to select the base register class,
4254 // because it's legal to write back to SP in a load of this
4255 // type, but not in a store.
4256 !con(dir.Iops, (ins !if(dir.load, t2_addr_offset_none,
4257 t2_nosp_addr_offset_none):$Rn,
4258 t2am_imm7_offset<memsz.shift>:$addr)),
4259 asm, suffix, IndexModePost, "$Qd, $Rn$addr", "$Rn.base = $wb"> {
4261 let Inst{19-16} = Rn{3-0};
4266 // Now actually declare all the contiguous load/stores, via those
4267 // multiclasses. The instruction ids coming out of this are the bare
4268 // names shown in the defm, with _pre or _post appended for writeback,
4269 // e.g. MVE_VLDRBS16, MVE_VSTRB16_pre, MVE_VSTRHU16_post.
4271 defm MVE_VLDRBS16: MVE_VLDRSTR_cw_m<MVE_ld, MVE_memB, "vldrb", "s16", 0, 0b01>;
4272 defm MVE_VLDRBS32: MVE_VLDRSTR_cw_m<MVE_ld, MVE_memB, "vldrb", "s32", 0, 0b10>;
4273 defm MVE_VLDRBU16: MVE_VLDRSTR_cw_m<MVE_ld, MVE_memB, "vldrb", "u16", 1, 0b01>;
4274 defm MVE_VLDRBU32: MVE_VLDRSTR_cw_m<MVE_ld, MVE_memB, "vldrb", "u32", 1, 0b10>;
4275 defm MVE_VLDRHS32: MVE_VLDRSTR_cw_m<MVE_ld, MVE_memH, "vldrh", "s32", 0, 0b10>;
4276 defm MVE_VLDRHU32: MVE_VLDRSTR_cw_m<MVE_ld, MVE_memH, "vldrh", "u32", 1, 0b10>;
4278 defm MVE_VLDRBU8: MVE_VLDRSTR_cs_m<MVE_ld, MVE_memB, "vldrb", "u8">;
4279 defm MVE_VLDRHU16: MVE_VLDRSTR_cs_m<MVE_ld, MVE_memH, "vldrh", "u16">;
4280 defm MVE_VLDRWU32: MVE_VLDRSTR_cs_m<MVE_ld, MVE_memW, "vldrw", "u32">;
4282 defm MVE_VSTRB16: MVE_VLDRSTR_cw_m<MVE_st, MVE_memB, "vstrb", "16", 0, 0b01>;
4283 defm MVE_VSTRB32: MVE_VLDRSTR_cw_m<MVE_st, MVE_memB, "vstrb", "32", 0, 0b10>;
4284 defm MVE_VSTRH32: MVE_VLDRSTR_cw_m<MVE_st, MVE_memH, "vstrh", "32", 0, 0b10>;
4286 defm MVE_VSTRBU8 : MVE_VLDRSTR_cs_m<MVE_st, MVE_memB, "vstrb", "8">;
4287 defm MVE_VSTRHU16: MVE_VLDRSTR_cs_m<MVE_st, MVE_memH, "vstrh", "16">;
4288 defm MVE_VSTRWU32: MVE_VLDRSTR_cs_m<MVE_st, MVE_memW, "vstrw", "32">;
4290 // Gather loads / scatter stores whose address operand is of the form
4291 // [Rn,Qm], i.e. a single GPR as the common base address, plus a
4292 // vector of offset from it. ('Load/store this sequence of elements of
4293 // the same array.')
4295 // Like the contiguous family, these loads and stores can widen the
4296 // loaded values / truncate the stored ones, or they can just
4297 // load/store the same size of memory and vector lane. But unlike the
4298 // contiguous family, there's no particular difference in encoding
4299 // between those two cases.
4301 // This family also comes with the option to scale the offset values
4302 // in Qm by the size of the loaded memory (i.e. to treat them as array
4303 // indices), or not to scale them (to treat them as plain byte offsets
4304 // in memory, so that perhaps the loaded values are unaligned). The
4305 // scaled instructions' address operand in assembly looks like
4306 // [Rn,Qm,UXTW #2] or similar.
4309 class MVE_VLDRSTR_rq<MVE_ldst_direction dir, MVE_memsz memsz, bit U,
4310 bits<2> size, bit os, string asm, string suffix, int shift>
4311 : MVE_VLDRSTR_base<dir, U, 0b0, 0b0, 0, dir.Oops,
4312 !con(dir.Iops, (ins mve_addr_rq_shift<shift>:$addr)),
4313 asm, suffix, "$Qd, $addr", dir.cstr> {
4316 let Inst{19-16} = addr{6-3};
4317 let Inst{8-7} = size;
4318 let Inst{6} = memsz.encoding{1};
4320 let Inst{4} = memsz.encoding{0};
4321 let Inst{3-1} = addr{2-0};
4325 // Multiclass that defines the scaled and unscaled versions of an
4326 // instruction, when the memory size is wider than a byte. The scaled
4327 // version gets the default name like MVE_VLDRBU16_rq; the unscaled /
4328 // potentially unaligned version gets a "_u" suffix, e.g.
4329 // MVE_VLDRBU16_rq_u.
4330 multiclass MVE_VLDRSTR_rq_w<MVE_ldst_direction dir, MVE_memsz memsz,
4331 string asm, string suffix, bit U, bits<2> size> {
4332 def _u : MVE_VLDRSTR_rq<dir, memsz, U, size, 0, asm, suffix, 0>;
4333 def "" : MVE_VLDRSTR_rq<dir, memsz, U, size, 1, asm, suffix, memsz.shift>;
4336 // Subclass of MVE_VLDRSTR_rq with the same API as that multiclass,
4337 // for use when the memory size is one byte, so there's no 'scaled'
4338 // version of the instruction at all. (This is encoded as if it were
4339 // unscaled, but named in the default way with no _u suffix.)
4340 class MVE_VLDRSTR_rq_b<MVE_ldst_direction dir, MVE_memsz memsz,
4341 string asm, string suffix, bit U, bits<2> size>
4342 : MVE_VLDRSTR_rq<dir, memsz, U, size, 0, asm, suffix, 0>;
4344 // Actually define all the loads and stores in this family.
4346 def MVE_VLDRBU8_rq : MVE_VLDRSTR_rq_b<MVE_ld, MVE_memB, "vldrb","u8", 1,0b00>;
4347 def MVE_VLDRBU16_rq: MVE_VLDRSTR_rq_b<MVE_ld, MVE_memB, "vldrb","u16", 1,0b01>;
4348 def MVE_VLDRBS16_rq: MVE_VLDRSTR_rq_b<MVE_ld, MVE_memB, "vldrb","s16", 0,0b01>;
4349 def MVE_VLDRBU32_rq: MVE_VLDRSTR_rq_b<MVE_ld, MVE_memB, "vldrb","u32", 1,0b10>;
4350 def MVE_VLDRBS32_rq: MVE_VLDRSTR_rq_b<MVE_ld, MVE_memB, "vldrb","s32", 0,0b10>;
4352 defm MVE_VLDRHU16_rq: MVE_VLDRSTR_rq_w<MVE_ld, MVE_memH, "vldrh","u16", 1,0b01>;
4353 defm MVE_VLDRHU32_rq: MVE_VLDRSTR_rq_w<MVE_ld, MVE_memH, "vldrh","u32", 1,0b10>;
4354 defm MVE_VLDRHS32_rq: MVE_VLDRSTR_rq_w<MVE_ld, MVE_memH, "vldrh","s32", 0,0b10>;
4355 defm MVE_VLDRWU32_rq: MVE_VLDRSTR_rq_w<MVE_ld, MVE_memW, "vldrw","u32", 1,0b10>;
4356 defm MVE_VLDRDU64_rq: MVE_VLDRSTR_rq_w<MVE_ld, MVE_memD, "vldrd","u64", 1,0b11>;
4358 def MVE_VSTRB8_rq : MVE_VLDRSTR_rq_b<MVE_st, MVE_memB, "vstrb","8", 0,0b00>;
4359 def MVE_VSTRB16_rq : MVE_VLDRSTR_rq_b<MVE_st, MVE_memB, "vstrb","16", 0,0b01>;
4360 def MVE_VSTRB32_rq : MVE_VLDRSTR_rq_b<MVE_st, MVE_memB, "vstrb","32", 0,0b10>;
4362 defm MVE_VSTRH16_rq : MVE_VLDRSTR_rq_w<MVE_st, MVE_memH, "vstrh","16", 0,0b01>;
4363 defm MVE_VSTRH32_rq : MVE_VLDRSTR_rq_w<MVE_st, MVE_memH, "vstrh","32", 0,0b10>;
4364 defm MVE_VSTRW32_rq : MVE_VLDRSTR_rq_w<MVE_st, MVE_memW, "vstrw","32", 0,0b10>;
4365 defm MVE_VSTRD64_rq : MVE_VLDRSTR_rq_w<MVE_st, MVE_memD, "vstrd","64", 0,0b11>;
4367 // Gather loads / scatter stores whose address operand is of the form
4368 // [Qm,#imm], i.e. a vector containing a full base address for each
4369 // loaded item, plus an immediate offset applied consistently to all
4370 // of them. ('Load/store the same field from this vector of pointers
4371 // to a structure type.')
4373 // This family requires the vector lane size to be at least 32 bits
4374 // (so there's room for an address in each lane at all). It has no
4375 // widening/narrowing variants. But it does support preindex
4376 // writeback, in which the address vector is updated to hold the
4377 // addresses actually loaded from.
4380 class MVE_VLDRSTR_qi<MVE_ldst_direction dir, MVE_memsz memsz, bit W, dag wbops,
4381 string asm, string wbAsm, string suffix, string cstr = "">
4382 : MVE_VLDRSTR_base<dir, 1, 1, W, 1, !con(wbops, dir.Oops),
4383 !con(dir.Iops, (ins mve_addr_q_shift<memsz.shift>:$addr)),
4384 asm, suffix, "$Qd, $addr" # wbAsm, cstr # dir.cstr> {
4386 let Inst{23} = addr{7};
4387 let Inst{19-17} = addr{10-8};
4389 let Inst{8} = memsz.encoding{0}; // enough to distinguish 32- from 64-bit
4391 let Inst{6-0} = addr{6-0};
4394 // Multiclass that generates the non-writeback and writeback variants.
4395 multiclass MVE_VLDRSTR_qi_m<MVE_ldst_direction dir, MVE_memsz memsz,
4396 string asm, string suffix> {
4397 def "" : MVE_VLDRSTR_qi<dir, memsz, 0, (outs), asm, "", suffix>;
4398 def _pre : MVE_VLDRSTR_qi<dir, memsz, 1, (outs MQPR:$wb), asm, "!", suffix,
4399 "$addr.base = $wb"> {
4400 let DecoderMethod="DecodeMVE_MEM_3_pre<"#memsz.shift#">";
4404 // Actual instruction definitions.
4405 defm MVE_VLDRWU32_qi: MVE_VLDRSTR_qi_m<MVE_ld, MVE_memW, "vldrw", "u32">;
4406 defm MVE_VLDRDU64_qi: MVE_VLDRSTR_qi_m<MVE_ld, MVE_memD, "vldrd", "u64">;
4407 defm MVE_VSTRW32_qi: MVE_VLDRSTR_qi_m<MVE_st, MVE_memW, "vstrw", "32">;
4408 defm MVE_VSTRD64_qi: MVE_VLDRSTR_qi_m<MVE_st, MVE_memD, "vstrd", "64">;
4410 // Define aliases for all the instructions where memory size and
4411 // vector lane size are the same. These are mnemonic aliases, so they
4412 // apply consistently across all of the above families - contiguous
4413 // loads, and both the rq and qi types of gather/scatter.
4415 // Rationale: As long as you're loading (for example) 16-bit memory
4416 // values into 16-bit vector lanes, you can think of them as signed or
4417 // unsigned integers, fp16 or just raw 16-bit blobs and it makes no
4418 // difference. So we permit all of vldrh.16, vldrh.u16, vldrh.s16,
4419 // vldrh.f16 and treat them all as equivalent to the canonical
4420 // spelling (which happens to be .u16 for loads, and just .16 for
4423 foreach vpt_cond = ["", "t", "e"] in
4424 foreach memsz = [MVE_memB, MVE_memH, MVE_memW, MVE_memD] in
4425 foreach suffix = memsz.suffixes in {
4427 // These foreaches are conceptually ifs, implemented by iterating a
4428 // dummy variable over a list with 0 or 1 elements depending on the
4429 // condition. The idea is to iterate over _nearly_ all the suffixes
4430 // in memsz.suffixes, but omit the one we want all the others to alias.
4432 foreach _ = !if(!ne(suffix, memsz.CanonLoadSuffix), [1], []<int>) in
4433 def : MnemonicAlias<
4434 "vldr" # memsz.MnemonicLetter # vpt_cond # suffix,
4435 "vldr" # memsz.MnemonicLetter # vpt_cond # memsz.CanonLoadSuffix>;
4437 foreach _ = !if(!ne(suffix, memsz.CanonStoreSuffix), [1], []<int>) in
4438 def : MnemonicAlias<
4439 "vstr" # memsz.MnemonicLetter # vpt_cond # suffix,
4440 "vstr" # memsz.MnemonicLetter # vpt_cond # memsz.CanonStoreSuffix>;
4443 // end of MVE predicable load/store
4445 class MVE_VPT<string suffix, bits<2> size, dag iops, string asm, list<dag> pattern=[]>
4446 : MVE_MI<(outs ), iops, NoItinerary, !strconcat("vpt", "${Mk}", ".", suffix), asm, "", pattern> {
4451 let Inst{31-23} = 0b111111100;
4452 let Inst{22} = Mk{3};
4453 let Inst{21-20} = size;
4454 let Inst{19-17} = Qn{2-0};
4456 let Inst{15-13} = Mk{2-0};
4457 let Inst{12} = fc{2};
4458 let Inst{11-8} = 0b1111;
4459 let Inst{7} = fc{0};
4462 let Defs = [VPR, P0];
4465 class MVE_VPTt1<string suffix, bits<2> size, dag iops>
4466 : MVE_VPT<suffix, size, iops, "$fc, $Qn, $Qm"> {
4471 let Inst{5} = Qm{3};
4472 let Inst{3-1} = Qm{2-0};
4473 let Inst{0} = fc{1};
4476 class MVE_VPTt1i<string suffix, bits<2> size>
4477 : MVE_VPTt1<suffix, size,
4478 (ins vpt_mask:$Mk, pred_basic_i:$fc, MQPR:$Qn, MQPR:$Qm)> {
4483 def MVE_VPTv4i32 : MVE_VPTt1i<"i32", 0b10>;
4484 def MVE_VPTv8i16 : MVE_VPTt1i<"i16", 0b01>;
4485 def MVE_VPTv16i8 : MVE_VPTt1i<"i8", 0b00>;
4487 class MVE_VPTt1u<string suffix, bits<2> size>
4488 : MVE_VPTt1<suffix, size,
4489 (ins vpt_mask:$Mk, pred_basic_u:$fc, MQPR:$Qn, MQPR:$Qm)> {
4494 def MVE_VPTv4u32 : MVE_VPTt1u<"u32", 0b10>;
4495 def MVE_VPTv8u16 : MVE_VPTt1u<"u16", 0b01>;
4496 def MVE_VPTv16u8 : MVE_VPTt1u<"u8", 0b00>;
4498 class MVE_VPTt1s<string suffix, bits<2> size>
4499 : MVE_VPTt1<suffix, size,
4500 (ins vpt_mask:$Mk, pred_basic_s:$fc, MQPR:$Qn, MQPR:$Qm)> {
4504 def MVE_VPTv4s32 : MVE_VPTt1s<"s32", 0b10>;
4505 def MVE_VPTv8s16 : MVE_VPTt1s<"s16", 0b01>;
4506 def MVE_VPTv16s8 : MVE_VPTt1s<"s8", 0b00>;
4508 class MVE_VPTt2<string suffix, bits<2> size, dag iops>
4509 : MVE_VPT<suffix, size, iops,
4516 let Inst{5} = fc{1};
4517 let Inst{3-0} = Rm{3-0};
4520 class MVE_VPTt2i<string suffix, bits<2> size>
4521 : MVE_VPTt2<suffix, size,
4522 (ins vpt_mask:$Mk, pred_basic_i:$fc, MQPR:$Qn, GPRwithZR:$Rm)> {
4527 def MVE_VPTv4i32r : MVE_VPTt2i<"i32", 0b10>;
4528 def MVE_VPTv8i16r : MVE_VPTt2i<"i16", 0b01>;
4529 def MVE_VPTv16i8r : MVE_VPTt2i<"i8", 0b00>;
4531 class MVE_VPTt2u<string suffix, bits<2> size>
4532 : MVE_VPTt2<suffix, size,
4533 (ins vpt_mask:$Mk, pred_basic_u:$fc, MQPR:$Qn, GPRwithZR:$Rm)> {
4538 def MVE_VPTv4u32r : MVE_VPTt2u<"u32", 0b10>;
4539 def MVE_VPTv8u16r : MVE_VPTt2u<"u16", 0b01>;
4540 def MVE_VPTv16u8r : MVE_VPTt2u<"u8", 0b00>;
4542 class MVE_VPTt2s<string suffix, bits<2> size>
4543 : MVE_VPTt2<suffix, size,
4544 (ins vpt_mask:$Mk, pred_basic_s:$fc, MQPR:$Qn, GPRwithZR:$Rm)> {
4548 def MVE_VPTv4s32r : MVE_VPTt2s<"s32", 0b10>;
4549 def MVE_VPTv8s16r : MVE_VPTt2s<"s16", 0b01>;
4550 def MVE_VPTv16s8r : MVE_VPTt2s<"s8", 0b00>;
4553 class MVE_VPTf<string suffix, bit size, dag iops, string asm, list<dag> pattern=[]>
4554 : MVE_MI<(outs ), iops, NoItinerary, !strconcat("vpt", "${Mk}", ".", suffix), asm,
4560 let Inst{31-29} = 0b111;
4561 let Inst{28} = size;
4562 let Inst{27-23} = 0b11100;
4563 let Inst{22} = Mk{3};
4564 let Inst{21-20} = 0b11;
4565 let Inst{19-17} = Qn{2-0};
4567 let Inst{15-13} = Mk{2-0};
4568 let Inst{12} = fc{2};
4569 let Inst{11-8} = 0b1111;
4570 let Inst{7} = fc{0};
4574 let Predicates = [HasMVEFloat];
4577 class MVE_VPTft1<string suffix, bit size>
4578 : MVE_VPTf<suffix, size, (ins vpt_mask:$Mk, pred_basic_fp:$fc, MQPR:$Qn, MQPR:$Qm),
4584 let Inst{5} = Qm{3};
4585 let Inst{3-1} = Qm{2-0};
4586 let Inst{0} = fc{1};
4589 def MVE_VPTv4f32 : MVE_VPTft1<"f32", 0b0>;
4590 def MVE_VPTv8f16 : MVE_VPTft1<"f16", 0b1>;
4592 class MVE_VPTft2<string suffix, bit size>
4593 : MVE_VPTf<suffix, size, (ins vpt_mask:$Mk, pred_basic_fp:$fc, MQPR:$Qn, GPRwithZR:$Rm),
4599 let Inst{5} = fc{1};
4600 let Inst{3-0} = Rm{3-0};
4603 def MVE_VPTv4f32r : MVE_VPTft2<"f32", 0b0>;
4604 def MVE_VPTv8f16r : MVE_VPTft2<"f16", 0b1>;
4606 def MVE_VPST : MVE_MI<(outs ), (ins vpt_mask:$Mk), NoItinerary,
4607 !strconcat("vpst", "${Mk}"), "", "", []> {
4610 let Inst{31-23} = 0b111111100;
4611 let Inst{22} = Mk{3};
4612 let Inst{21-16} = 0b110001;
4613 let Inst{15-13} = Mk{2-0};
4614 let Inst{12-0} = 0b0111101001101;
4615 let Unpredictable{12} = 0b1;
4616 let Unpredictable{7} = 0b1;
4617 let Unpredictable{5} = 0b1;
4622 def MVE_VPSEL : MVE_p<(outs MQPR:$Qd), (ins MQPR:$Qn, MQPR:$Qm), NoItinerary,
4623 "vpsel", "", "$Qd, $Qn, $Qm", vpred_n, "", []> {
4629 let Inst{25-23} = 0b100;
4630 let Inst{22} = Qd{3};
4631 let Inst{21-20} = 0b11;
4632 let Inst{19-17} = Qn{2-0};
4634 let Inst{15-13} = Qd{2-0};
4635 let Inst{12-9} = 0b0111;
4637 let Inst{7} = Qn{3};
4639 let Inst{5} = Qm{3};
4641 let Inst{3-1} = Qm{2-0};
4645 foreach suffix = ["s8", "s16", "s32", "u8", "u16", "u32",
4646 "i8", "i16", "i32", "f16", "f32"] in
4647 def : MVEInstAlias<"vpsel${vp}." # suffix # "\t$Qd, $Qn, $Qm",
4648 (MVE_VPSEL MQPR:$Qd, MQPR:$Qn, MQPR:$Qm, vpred_n:$vp)>;
4650 let Predicates = [HasMVEInt] in {
4651 def : Pat<(v16i8 (vselect (v16i1 VCCR:$pred), (v16i8 MQPR:$v1), (v16i8 MQPR:$v2))),
4652 (v16i8 (MVE_VPSEL MQPR:$v1, MQPR:$v2, 0, VCCR:$pred))>;
4653 def : Pat<(v8i16 (vselect (v8i1 VCCR:$pred), (v8i16 MQPR:$v1), (v8i16 MQPR:$v2))),
4654 (v8i16 (MVE_VPSEL MQPR:$v1, MQPR:$v2, 0, VCCR:$pred))>;
4655 def : Pat<(v4i32 (vselect (v4i1 VCCR:$pred), (v4i32 MQPR:$v1), (v4i32 MQPR:$v2))),
4656 (v4i32 (MVE_VPSEL MQPR:$v1, MQPR:$v2, 0, VCCR:$pred))>;
4658 def : Pat<(v8f16 (vselect (v8i1 VCCR:$pred), (v8f16 MQPR:$v1), (v8f16 MQPR:$v2))),
4659 (v8f16 (MVE_VPSEL MQPR:$v1, MQPR:$v2, 0, VCCR:$pred))>;
4660 def : Pat<(v4f32 (vselect (v4i1 VCCR:$pred), (v4f32 MQPR:$v1), (v4f32 MQPR:$v2))),
4661 (v4f32 (MVE_VPSEL MQPR:$v1, MQPR:$v2, 0, VCCR:$pred))>;
4663 def : Pat<(v16i8 (vselect (v16i8 MQPR:$pred), (v16i8 MQPR:$v1), (v16i8 MQPR:$v2))),
4664 (v16i8 (MVE_VPSEL MQPR:$v1, MQPR:$v2, 0,
4665 (MVE_VCMPi8 (v16i8 MQPR:$pred), (MVE_VMOVimmi8 0), 1)))>;
4666 def : Pat<(v8i16 (vselect (v8i16 MQPR:$pred), (v8i16 MQPR:$v1), (v8i16 MQPR:$v2))),
4667 (v8i16 (MVE_VPSEL MQPR:$v1, MQPR:$v2, 0,
4668 (MVE_VCMPi16 (v8i16 MQPR:$pred), (MVE_VMOVimmi16 0), 1)))>;
4669 def : Pat<(v4i32 (vselect (v4i32 MQPR:$pred), (v4i32 MQPR:$v1), (v4i32 MQPR:$v2))),
4670 (v4i32 (MVE_VPSEL MQPR:$v1, MQPR:$v2, 0,
4671 (MVE_VCMPi32 (v4i32 MQPR:$pred), (MVE_VMOVimmi32 0), 1)))>;
4673 def : Pat<(v8f16 (vselect (v8i16 MQPR:$pred), (v8f16 MQPR:$v1), (v8f16 MQPR:$v2))),
4674 (v8f16 (MVE_VPSEL MQPR:$v1, MQPR:$v2, 0,
4675 (MVE_VCMPi16 (v8i16 MQPR:$pred), (MVE_VMOVimmi16 0), 1)))>;
4676 def : Pat<(v4f32 (vselect (v4i32 MQPR:$pred), (v4f32 MQPR:$v1), (v4f32 MQPR:$v2))),
4677 (v4f32 (MVE_VPSEL MQPR:$v1, MQPR:$v2, 0,
4678 (MVE_VCMPi32 (v4i32 MQPR:$pred), (MVE_VMOVimmi32 0), 1)))>;
4681 def : Pat<(v16i8 (zext (v16i1 VCCR:$pred))),
4682 (v16i8 (MVE_VPSEL (MVE_VMOVimmi8 1), (MVE_VMOVimmi8 0), 0, VCCR:$pred))>;
4683 def : Pat<(v8i16 (zext (v8i1 VCCR:$pred))),
4684 (v8i16 (MVE_VPSEL (MVE_VMOVimmi16 1), (MVE_VMOVimmi16 0), 0, VCCR:$pred))>;
4685 def : Pat<(v4i32 (zext (v4i1 VCCR:$pred))),
4686 (v4i32 (MVE_VPSEL (MVE_VMOVimmi32 1), (MVE_VMOVimmi32 0), 0, VCCR:$pred))>;
4688 def : Pat<(v16i8 (sext (v16i1 VCCR:$pred))),
4689 (v16i8 (MVE_VPSEL (MVE_VMOVimmi8 255), (MVE_VMOVimmi8 0), 0, VCCR:$pred))>;
4690 def : Pat<(v8i16 (sext (v8i1 VCCR:$pred))),
4691 (v8i16 (MVE_VPSEL (MVE_VMOVimmi8 255), (MVE_VMOVimmi16 0), 0, VCCR:$pred))>;
4692 def : Pat<(v4i32 (sext (v4i1 VCCR:$pred))),
4693 (v4i32 (MVE_VPSEL (MVE_VMOVimmi8 255), (MVE_VMOVimmi32 0), 0, VCCR:$pred))>;
4695 def : Pat<(v16i8 (anyext (v16i1 VCCR:$pred))),
4696 (v16i8 (MVE_VPSEL (MVE_VMOVimmi8 1), (MVE_VMOVimmi8 0), 0, VCCR:$pred))>;
4697 def : Pat<(v8i16 (anyext (v8i1 VCCR:$pred))),
4698 (v8i16 (MVE_VPSEL (MVE_VMOVimmi16 1), (MVE_VMOVimmi16 0), 0, VCCR:$pred))>;
4699 def : Pat<(v4i32 (anyext (v4i1 VCCR:$pred))),
4700 (v4i32 (MVE_VPSEL (MVE_VMOVimmi32 1), (MVE_VMOVimmi32 0), 0, VCCR:$pred))>;
4702 def : Pat<(v16i1 (trunc (v16i8 MQPR:$v1))),
4703 (v16i1 (MVE_VCMPi32r (v16i8 MQPR:$v1), ZR, 1))>;
4704 def : Pat<(v8i1 (trunc (v8i16 MQPR:$v1))),
4705 (v8i1 (MVE_VCMPi32r (v8i16 MQPR:$v1), ZR, 1))>;
4706 def : Pat<(v4i1 (trunc (v4i32 MQPR:$v1))),
4707 (v4i1 (MVE_VCMPi32r (v4i32 MQPR:$v1), ZR, 1))>;
4710 let Predicates = [HasMVEFloat] in {
4712 // 112 is 1.0 in float
4713 def : Pat<(v4f32 (uint_to_fp (v4i1 VCCR:$pred))),
4714 (v4f32 (MVE_VPSEL (v4f32 (MVE_VMOVimmf32 112)), (v4f32 (MVE_VMOVimmi32 0)), 0, VCCR:$pred))>;
4715 // 2620 in 1.0 in half
4716 def : Pat<(v8f16 (uint_to_fp (v8i1 VCCR:$pred))),
4717 (v8f16 (MVE_VPSEL (v8f16 (MVE_VMOVimmi16 2620)), (v8f16 (MVE_VMOVimmi16 0)), 0, VCCR:$pred))>;
4718 // 240 is -1.0 in float
4719 def : Pat<(v4f32 (sint_to_fp (v4i1 VCCR:$pred))),
4720 (v4f32 (MVE_VPSEL (v4f32 (MVE_VMOVimmf32 240)), (v4f32 (MVE_VMOVimmi32 0)), 0, VCCR:$pred))>;
4721 // 2748 is -1.0 in half
4722 def : Pat<(v8f16 (sint_to_fp (v8i1 VCCR:$pred))),
4723 (v8f16 (MVE_VPSEL (v8f16 (MVE_VMOVimmi16 2748)), (v8f16 (MVE_VMOVimmi16 0)), 0, VCCR:$pred))>;
4725 def : Pat<(v4i1 (fp_to_uint (v4f32 MQPR:$v1))),
4726 (v4i1 (MVE_VCMPf32r (v4f32 MQPR:$v1), ZR, 1))>;
4727 def : Pat<(v8i1 (fp_to_uint (v8f16 MQPR:$v1))),
4728 (v8i1 (MVE_VCMPf16r (v8f16 MQPR:$v1), ZR, 1))>;
4729 def : Pat<(v4i1 (fp_to_sint (v4f32 MQPR:$v1))),
4730 (v4i1 (MVE_VCMPf32r (v4f32 MQPR:$v1), ZR, 1))>;
4731 def : Pat<(v8i1 (fp_to_sint (v8f16 MQPR:$v1))),
4732 (v8i1 (MVE_VCMPf16r (v8f16 MQPR:$v1), ZR, 1))>;
4735 def MVE_VPNOT : MVE_p<(outs VCCR:$P0), (ins VCCR:$P0_in), NoItinerary,
4736 "vpnot", "", "", vpred_n, "", []> {
4737 let Inst{31-0} = 0b11111110001100010000111101001101;
4738 let Unpredictable{19-17} = 0b111;
4739 let Unpredictable{12} = 0b1;
4740 let Unpredictable{7} = 0b1;
4741 let Unpredictable{5} = 0b1;
4743 let Constraints = "";
4744 let DecoderMethod = "DecodeMVEVPNOT";
4747 let Predicates = [HasMVEInt] in {
4748 def : Pat<(v4i1 (xor (v4i1 VCCR:$pred), (v4i1 (predicate_cast (i32 65535))))),
4749 (v4i1 (MVE_VPNOT (v4i1 VCCR:$pred)))>;
4750 def : Pat<(v8i1 (xor (v8i1 VCCR:$pred), (v8i1 (predicate_cast (i32 65535))))),
4751 (v8i1 (MVE_VPNOT (v8i1 VCCR:$pred)))>;
4752 def : Pat<(v16i1 (xor (v16i1 VCCR:$pred), (v16i1 (predicate_cast (i32 65535))))),
4753 (v16i1 (MVE_VPNOT (v16i1 VCCR:$pred)))>;
4757 class MVE_loltp_start<dag iops, string asm, string ops, bits<2> size>
4758 : t2LOL<(outs GPRlr:$LR), iops, asm, ops> {
4760 let Predicates = [HasMVEInt];
4762 let Inst{21-20} = size;
4763 let Inst{19-16} = Rn{3-0};
4767 class MVE_DLSTP<string asm, bits<2> size>
4768 : MVE_loltp_start<(ins rGPR:$Rn), asm, "$LR, $Rn", size> {
4770 let Inst{11-1} = 0b00000000000;
4771 let Unpredictable{10-1} = 0b1111111111;
4774 class MVE_WLSTP<string asm, bits<2> size>
4775 : MVE_loltp_start<(ins rGPR:$Rn, wlslabel_u11:$label),
4776 asm, "$LR, $Rn, $label", size> {
4779 let Inst{11} = label{0};
4780 let Inst{10-1} = label{10-1};
4783 def MVE_DLSTP_8 : MVE_DLSTP<"dlstp.8", 0b00>;
4784 def MVE_DLSTP_16 : MVE_DLSTP<"dlstp.16", 0b01>;
4785 def MVE_DLSTP_32 : MVE_DLSTP<"dlstp.32", 0b10>;
4786 def MVE_DLSTP_64 : MVE_DLSTP<"dlstp.64", 0b11>;
4788 def MVE_WLSTP_8 : MVE_WLSTP<"wlstp.8", 0b00>;
4789 def MVE_WLSTP_16 : MVE_WLSTP<"wlstp.16", 0b01>;
4790 def MVE_WLSTP_32 : MVE_WLSTP<"wlstp.32", 0b10>;
4791 def MVE_WLSTP_64 : MVE_WLSTP<"wlstp.64", 0b11>;
4793 class MVE_loltp_end<dag oops, dag iops, string asm, string ops>
4794 : t2LOL<oops, iops, asm, ops> {
4795 let Predicates = [HasMVEInt];
4796 let Inst{22-21} = 0b00;
4797 let Inst{19-16} = 0b1111;
4801 def MVE_LETP : MVE_loltp_end<(outs GPRlr:$LRout),
4802 (ins GPRlr:$LRin, lelabel_u11:$label),
4803 "letp", "$LRin, $label"> {
4807 let Inst{11} = label{0};
4808 let Inst{10-1} = label{10-1};
4811 def MVE_LCTP : MVE_loltp_end<(outs), (ins pred:$p), "lctp${p}", ""> {
4814 let Inst{11-1} = 0b00000000000;
4815 let Unpredictable{21-20} = 0b11;
4816 let Unpredictable{11-1} = 0b11111111111;
4820 //===----------------------------------------------------------------------===//
4822 //===----------------------------------------------------------------------===//
4824 class MVE_vector_store_typed<ValueType Ty, Instruction RegImmInst,
4825 PatFrag StoreKind, int shift>
4826 : Pat<(StoreKind (Ty MQPR:$val), t2addrmode_imm7<shift>:$addr),
4827 (RegImmInst (Ty MQPR:$val), t2addrmode_imm7<shift>:$addr)>;
4829 multiclass MVE_vector_store<Instruction RegImmInst, PatFrag StoreKind,
4831 def : MVE_vector_store_typed<v16i8, RegImmInst, StoreKind, shift>;
4832 def : MVE_vector_store_typed<v8i16, RegImmInst, StoreKind, shift>;
4833 def : MVE_vector_store_typed<v8f16, RegImmInst, StoreKind, shift>;
4834 def : MVE_vector_store_typed<v4i32, RegImmInst, StoreKind, shift>;
4835 def : MVE_vector_store_typed<v4f32, RegImmInst, StoreKind, shift>;
4836 def : MVE_vector_store_typed<v2i64, RegImmInst, StoreKind, shift>;
4837 def : MVE_vector_store_typed<v2f64, RegImmInst, StoreKind, shift>;
4840 class MVE_vector_load_typed<ValueType Ty, Instruction RegImmInst,
4841 PatFrag LoadKind, int shift>
4842 : Pat<(Ty (LoadKind t2addrmode_imm7<shift>:$addr)),
4843 (Ty (RegImmInst t2addrmode_imm7<shift>:$addr))>;
4845 multiclass MVE_vector_load<Instruction RegImmInst, PatFrag LoadKind,
4847 def : MVE_vector_load_typed<v16i8, RegImmInst, LoadKind, shift>;
4848 def : MVE_vector_load_typed<v8i16, RegImmInst, LoadKind, shift>;
4849 def : MVE_vector_load_typed<v8f16, RegImmInst, LoadKind, shift>;
4850 def : MVE_vector_load_typed<v4i32, RegImmInst, LoadKind, shift>;
4851 def : MVE_vector_load_typed<v4f32, RegImmInst, LoadKind, shift>;
4852 def : MVE_vector_load_typed<v2i64, RegImmInst, LoadKind, shift>;
4853 def : MVE_vector_load_typed<v2f64, RegImmInst, LoadKind, shift>;
4856 class MVE_vector_offset_store_typed<ValueType Ty, Instruction Opcode,
4857 PatFrag StoreKind, int shift>
4858 : Pat<(StoreKind (Ty MQPR:$Rt), tGPR:$Rn, t2am_imm7_offset<shift>:$addr),
4859 (Opcode MQPR:$Rt, tGPR:$Rn, t2am_imm7_offset<shift>:$addr)>;
4861 multiclass MVE_vector_offset_store<Instruction RegImmInst, PatFrag StoreKind,
4863 def : MVE_vector_offset_store_typed<v16i8, RegImmInst, StoreKind, shift>;
4864 def : MVE_vector_offset_store_typed<v8i16, RegImmInst, StoreKind, shift>;
4865 def : MVE_vector_offset_store_typed<v8f16, RegImmInst, StoreKind, shift>;
4866 def : MVE_vector_offset_store_typed<v4i32, RegImmInst, StoreKind, shift>;
4867 def : MVE_vector_offset_store_typed<v4f32, RegImmInst, StoreKind, shift>;
4868 def : MVE_vector_offset_store_typed<v2i64, RegImmInst, StoreKind, shift>;
4869 def : MVE_vector_offset_store_typed<v2f64, RegImmInst, StoreKind, shift>;
4872 def aligned32_pre_store : PatFrag<(ops node:$val, node:$ptr, node:$offset),
4873 (pre_store node:$val, node:$ptr, node:$offset), [{
4874 return cast<StoreSDNode>(N)->getAlignment() >= 4;
4876 def aligned32_post_store : PatFrag<(ops node:$val, node:$ptr, node:$offset),
4877 (post_store node:$val, node:$ptr, node:$offset), [{
4878 return cast<StoreSDNode>(N)->getAlignment() >= 4;
4880 def aligned16_pre_store : PatFrag<(ops node:$val, node:$ptr, node:$offset),
4881 (pre_store node:$val, node:$ptr, node:$offset), [{
4882 return cast<StoreSDNode>(N)->getAlignment() >= 2;
4884 def aligned16_post_store : PatFrag<(ops node:$val, node:$ptr, node:$offset),
4885 (post_store node:$val, node:$ptr, node:$offset), [{
4886 return cast<StoreSDNode>(N)->getAlignment() >= 2;
4889 let Predicates = [HasMVEInt, IsLE] in {
4891 defm : MVE_vector_store<MVE_VSTRBU8, byte_alignedstore, 0>;
4892 defm : MVE_vector_store<MVE_VSTRHU16, hword_alignedstore, 1>;
4893 defm : MVE_vector_store<MVE_VSTRWU32, alignedstore32, 2>;
4896 defm : MVE_vector_load<MVE_VLDRBU8, byte_alignedload, 0>;
4897 defm : MVE_vector_load<MVE_VLDRHU16, hword_alignedload, 1>;
4898 defm : MVE_vector_load<MVE_VLDRWU32, alignedload32, 2>;
4900 // Pre/post inc stores
4901 defm : MVE_vector_offset_store<MVE_VSTRBU8_pre, pre_store, 0>;
4902 defm : MVE_vector_offset_store<MVE_VSTRBU8_post, post_store, 0>;
4903 defm : MVE_vector_offset_store<MVE_VSTRHU16_pre, aligned16_pre_store, 1>;
4904 defm : MVE_vector_offset_store<MVE_VSTRHU16_post, aligned16_post_store, 1>;
4905 defm : MVE_vector_offset_store<MVE_VSTRWU32_pre, aligned32_pre_store, 2>;
4906 defm : MVE_vector_offset_store<MVE_VSTRWU32_post, aligned32_post_store, 2>;
4909 let Predicates = [HasMVEInt, IsBE] in {
4911 def : MVE_vector_store_typed<v16i8, MVE_VSTRBU8, store, 0>;
4912 def : MVE_vector_store_typed<v8i16, MVE_VSTRHU16, alignedstore16, 1>;
4913 def : MVE_vector_store_typed<v8f16, MVE_VSTRHU16, alignedstore16, 1>;
4914 def : MVE_vector_store_typed<v4i32, MVE_VSTRWU32, alignedstore32, 2>;
4915 def : MVE_vector_store_typed<v4f32, MVE_VSTRWU32, alignedstore32, 2>;
4918 def : MVE_vector_load_typed<v16i8, MVE_VLDRBU8, load, 0>;
4919 def : MVE_vector_load_typed<v8i16, MVE_VLDRHU16, alignedload16, 1>;
4920 def : MVE_vector_load_typed<v8f16, MVE_VLDRHU16, alignedload16, 1>;
4921 def : MVE_vector_load_typed<v4i32, MVE_VLDRWU32, alignedload32, 2>;
4922 def : MVE_vector_load_typed<v4f32, MVE_VLDRWU32, alignedload32, 2>;
4924 // Other unaligned loads/stores need to go though a VREV
4925 def : Pat<(v2f64 (load t2addrmode_imm7<0>:$addr)),
4926 (v2f64 (MVE_VREV64_8 (MVE_VLDRBU8 t2addrmode_imm7<0>:$addr)))>;
4927 def : Pat<(v2i64 (load t2addrmode_imm7<0>:$addr)),
4928 (v2i64 (MVE_VREV64_8 (MVE_VLDRBU8 t2addrmode_imm7<0>:$addr)))>;
4929 def : Pat<(v4i32 (load t2addrmode_imm7<0>:$addr)),
4930 (v4i32 (MVE_VREV32_8 (MVE_VLDRBU8 t2addrmode_imm7<0>:$addr)))>;
4931 def : Pat<(v4f32 (load t2addrmode_imm7<0>:$addr)),
4932 (v4f32 (MVE_VREV32_8 (MVE_VLDRBU8 t2addrmode_imm7<0>:$addr)))>;
4933 def : Pat<(v8i16 (load t2addrmode_imm7<0>:$addr)),
4934 (v8i16 (MVE_VREV16_8 (MVE_VLDRBU8 t2addrmode_imm7<0>:$addr)))>;
4935 def : Pat<(v8f16 (load t2addrmode_imm7<0>:$addr)),
4936 (v8f16 (MVE_VREV16_8 (MVE_VLDRBU8 t2addrmode_imm7<0>:$addr)))>;
4937 def : Pat<(store (v2f64 MQPR:$val), t2addrmode_imm7<0>:$addr),
4938 (MVE_VSTRBU8 (MVE_VREV64_8 MQPR:$val), t2addrmode_imm7<0>:$addr)>;
4939 def : Pat<(store (v2i64 MQPR:$val), t2addrmode_imm7<0>:$addr),
4940 (MVE_VSTRBU8 (MVE_VREV64_8 MQPR:$val), t2addrmode_imm7<0>:$addr)>;
4941 def : Pat<(store (v4i32 MQPR:$val), t2addrmode_imm7<0>:$addr),
4942 (MVE_VSTRBU8 (MVE_VREV32_8 MQPR:$val), t2addrmode_imm7<0>:$addr)>;
4943 def : Pat<(store (v4f32 MQPR:$val), t2addrmode_imm7<0>:$addr),
4944 (MVE_VSTRBU8 (MVE_VREV32_8 MQPR:$val), t2addrmode_imm7<0>:$addr)>;
4945 def : Pat<(store (v8i16 MQPR:$val), t2addrmode_imm7<0>:$addr),
4946 (MVE_VSTRBU8 (MVE_VREV16_8 MQPR:$val), t2addrmode_imm7<0>:$addr)>;
4947 def : Pat<(store (v8f16 MQPR:$val), t2addrmode_imm7<0>:$addr),
4948 (MVE_VSTRBU8 (MVE_VREV16_8 MQPR:$val), t2addrmode_imm7<0>:$addr)>;
4950 // Pre/Post inc stores
4951 def : MVE_vector_offset_store_typed<v16i8, MVE_VSTRBU8_pre, pre_store, 0>;
4952 def : MVE_vector_offset_store_typed<v16i8, MVE_VSTRBU8_post, post_store, 0>;
4953 def : MVE_vector_offset_store_typed<v8i16, MVE_VSTRHU16_pre, aligned16_pre_store, 1>;
4954 def : MVE_vector_offset_store_typed<v8i16, MVE_VSTRHU16_post, aligned16_post_store, 1>;
4955 def : MVE_vector_offset_store_typed<v8f16, MVE_VSTRHU16_pre, aligned16_pre_store, 1>;
4956 def : MVE_vector_offset_store_typed<v8f16, MVE_VSTRHU16_post, aligned16_post_store, 1>;
4957 def : MVE_vector_offset_store_typed<v4i32, MVE_VSTRWU32_pre, aligned32_pre_store, 2>;
4958 def : MVE_vector_offset_store_typed<v4i32, MVE_VSTRWU32_post, aligned32_post_store, 2>;
4959 def : MVE_vector_offset_store_typed<v4f32, MVE_VSTRWU32_pre, aligned32_pre_store, 2>;
4960 def : MVE_vector_offset_store_typed<v4f32, MVE_VSTRWU32_post, aligned32_post_store, 2>;
4963 let Predicates = [HasMVEInt] in {
4965 def : Pat<(v16i1 (load t2addrmode_imm7<2>:$addr)),
4966 (v16i1 (VLDR_P0_off t2addrmode_imm7<2>:$addr))>;
4967 def : Pat<(v8i1 (load t2addrmode_imm7<2>:$addr)),
4968 (v8i1 (VLDR_P0_off t2addrmode_imm7<2>:$addr))>;
4969 def : Pat<(v4i1 (load t2addrmode_imm7<2>:$addr)),
4970 (v4i1 (VLDR_P0_off t2addrmode_imm7<2>:$addr))>;
4973 def : Pat<(store (v4i1 VCCR:$val), t2addrmode_imm7<2>:$addr),
4974 (VSTR_P0_off VCCR:$val, t2addrmode_imm7<2>:$addr)>;
4975 def : Pat<(store (v8i1 VCCR:$val), t2addrmode_imm7<2>:$addr),
4976 (VSTR_P0_off VCCR:$val, t2addrmode_imm7<2>:$addr)>;
4977 def : Pat<(store (v16i1 VCCR:$val), t2addrmode_imm7<2>:$addr),
4978 (VSTR_P0_off VCCR:$val, t2addrmode_imm7<2>:$addr)>;
4982 // Widening/Narrowing Loads/Stores
4984 let MinAlignment = 2 in {
4985 def truncstorevi16_align2 : PatFrag<(ops node:$val, node:$ptr),
4986 (truncstorevi16 node:$val, node:$ptr)>;
4987 def post_truncstvi16_align2 : PatFrag<(ops node:$val, node:$base, node:$offset),
4988 (post_truncstvi16 node:$val, node:$base, node:$offset)>;
4989 def pre_truncstvi16_align2 : PatFrag<(ops node:$val, node:$base, node:$offset),
4990 (pre_truncstvi16 node:$val, node:$base, node:$offset)>;
4993 let Predicates = [HasMVEInt] in {
4994 def : Pat<(truncstorevi8 (v8i16 MQPR:$val), t2addrmode_imm7<0>:$addr),
4995 (MVE_VSTRB16 MQPR:$val, t2addrmode_imm7<0>:$addr)>;
4996 def : Pat<(truncstorevi8 (v4i32 MQPR:$val), t2addrmode_imm7<0>:$addr),
4997 (MVE_VSTRB32 MQPR:$val, t2addrmode_imm7<0>:$addr)>;
4998 def : Pat<(truncstorevi16_align2 (v4i32 MQPR:$val), t2addrmode_imm7<1>:$addr),
4999 (MVE_VSTRH32 MQPR:$val, t2addrmode_imm7<1>:$addr)>;
5001 def : Pat<(post_truncstvi8 (v8i16 MQPR:$Rt), tGPR:$Rn, t2am_imm7_offset<0>:$addr),
5002 (MVE_VSTRB16_post MQPR:$Rt, tGPR:$Rn, t2am_imm7_offset<0>:$addr)>;
5003 def : Pat<(post_truncstvi8 (v4i32 MQPR:$Rt), tGPR:$Rn, t2am_imm7_offset<0>:$addr),
5004 (MVE_VSTRB32_post MQPR:$Rt, tGPR:$Rn, t2am_imm7_offset<0>:$addr)>;
5005 def : Pat<(post_truncstvi16_align2 (v4i32 MQPR:$Rt), tGPR:$Rn, t2am_imm7_offset<1>:$addr),
5006 (MVE_VSTRH32_post MQPR:$Rt, tGPR:$Rn, t2am_imm7_offset<1>:$addr)>;
5008 def : Pat<(pre_truncstvi8 (v8i16 MQPR:$Rt), tGPR:$Rn, t2am_imm7_offset<0>:$addr),
5009 (MVE_VSTRB16_pre MQPR:$Rt, tGPR:$Rn, t2am_imm7_offset<0>:$addr)>;
5010 def : Pat<(pre_truncstvi8 (v4i32 MQPR:$Rt), tGPR:$Rn, t2am_imm7_offset<0>:$addr),
5011 (MVE_VSTRB32_pre MQPR:$Rt, tGPR:$Rn, t2am_imm7_offset<0>:$addr)>;
5012 def : Pat<(pre_truncstvi16_align2 (v4i32 MQPR:$Rt), tGPR:$Rn, t2am_imm7_offset<1>:$addr),
5013 (MVE_VSTRH32_pre MQPR:$Rt, tGPR:$Rn, t2am_imm7_offset<1>:$addr)>;
5017 let MinAlignment = 2 in {
5018 def extloadvi16_align2 : PatFrag<(ops node:$ptr), (extloadvi16 node:$ptr)>;
5019 def sextloadvi16_align2 : PatFrag<(ops node:$ptr), (sextloadvi16 node:$ptr)>;
5020 def zextloadvi16_align2 : PatFrag<(ops node:$ptr), (zextloadvi16 node:$ptr)>;
5023 multiclass MVEExtLoad<string DestLanes, string DestElemBits,
5024 string SrcElemBits, string SrcElemType,
5025 string Align, Operand am> {
5026 def _Any : Pat<(!cast<ValueType>("v" # DestLanes # "i" # DestElemBits)
5027 (!cast<PatFrag>("extloadvi" # SrcElemBits # Align) am:$addr)),
5028 (!cast<Instruction>("MVE_VLDR" # SrcElemType # "U" # DestElemBits)
5030 def _Z : Pat<(!cast<ValueType>("v" # DestLanes # "i" # DestElemBits)
5031 (!cast<PatFrag>("zextloadvi" # SrcElemBits # Align) am:$addr)),
5032 (!cast<Instruction>("MVE_VLDR" # SrcElemType # "U" # DestElemBits)
5034 def _S : Pat<(!cast<ValueType>("v" # DestLanes # "i" # DestElemBits)
5035 (!cast<PatFrag>("sextloadvi" # SrcElemBits # Align) am:$addr)),
5036 (!cast<Instruction>("MVE_VLDR" # SrcElemType # "S" # DestElemBits)
5040 let Predicates = [HasMVEInt] in {
5041 defm : MVEExtLoad<"4", "32", "8", "B", "", t2addrmode_imm7<0>>;
5042 defm : MVEExtLoad<"8", "16", "8", "B", "", t2addrmode_imm7<0>>;
5043 defm : MVEExtLoad<"4", "32", "16", "H", "_align2", t2addrmode_imm7<1>>;
5047 // Bit convert patterns
5049 let Predicates = [HasMVEInt] in {
5050 def : Pat<(v2f64 (bitconvert (v2i64 MQPR:$src))), (v2f64 MQPR:$src)>;
5051 def : Pat<(v2i64 (bitconvert (v2f64 MQPR:$src))), (v2i64 MQPR:$src)>;
5053 def : Pat<(v4i32 (bitconvert (v4f32 MQPR:$src))), (v4i32 MQPR:$src)>;
5054 def : Pat<(v4f32 (bitconvert (v4i32 MQPR:$src))), (v4f32 MQPR:$src)>;
5056 def : Pat<(v8i16 (bitconvert (v8f16 MQPR:$src))), (v8i16 MQPR:$src)>;
5057 def : Pat<(v8f16 (bitconvert (v8i16 MQPR:$src))), (v8f16 MQPR:$src)>;
5060 let Predicates = [IsLE,HasMVEInt] in {
5061 def : Pat<(v2f64 (bitconvert (v4f32 MQPR:$src))), (v2f64 MQPR:$src)>;
5062 def : Pat<(v2f64 (bitconvert (v4i32 MQPR:$src))), (v2f64 MQPR:$src)>;
5063 def : Pat<(v2f64 (bitconvert (v8f16 MQPR:$src))), (v2f64 MQPR:$src)>;
5064 def : Pat<(v2f64 (bitconvert (v8i16 MQPR:$src))), (v2f64 MQPR:$src)>;
5065 def : Pat<(v2f64 (bitconvert (v16i8 MQPR:$src))), (v2f64 MQPR:$src)>;
5067 def : Pat<(v2i64 (bitconvert (v4f32 MQPR:$src))), (v2i64 MQPR:$src)>;
5068 def : Pat<(v2i64 (bitconvert (v4i32 MQPR:$src))), (v2i64 MQPR:$src)>;
5069 def : Pat<(v2i64 (bitconvert (v8f16 MQPR:$src))), (v2i64 MQPR:$src)>;
5070 def : Pat<(v2i64 (bitconvert (v8i16 MQPR:$src))), (v2i64 MQPR:$src)>;
5071 def : Pat<(v2i64 (bitconvert (v16i8 MQPR:$src))), (v2i64 MQPR:$src)>;
5073 def : Pat<(v4f32 (bitconvert (v2f64 MQPR:$src))), (v4f32 MQPR:$src)>;
5074 def : Pat<(v4f32 (bitconvert (v2i64 MQPR:$src))), (v4f32 MQPR:$src)>;
5075 def : Pat<(v4f32 (bitconvert (v8f16 MQPR:$src))), (v4f32 MQPR:$src)>;
5076 def : Pat<(v4f32 (bitconvert (v8i16 MQPR:$src))), (v4f32 MQPR:$src)>;
5077 def : Pat<(v4f32 (bitconvert (v16i8 MQPR:$src))), (v4f32 MQPR:$src)>;
5079 def : Pat<(v4i32 (bitconvert (v2f64 MQPR:$src))), (v4i32 MQPR:$src)>;
5080 def : Pat<(v4i32 (bitconvert (v2i64 MQPR:$src))), (v4i32 MQPR:$src)>;
5081 def : Pat<(v4i32 (bitconvert (v8f16 MQPR:$src))), (v4i32 MQPR:$src)>;
5082 def : Pat<(v4i32 (bitconvert (v8i16 MQPR:$src))), (v4i32 MQPR:$src)>;
5083 def : Pat<(v4i32 (bitconvert (v16i8 MQPR:$src))), (v4i32 MQPR:$src)>;
5085 def : Pat<(v8f16 (bitconvert (v2f64 MQPR:$src))), (v8f16 MQPR:$src)>;
5086 def : Pat<(v8f16 (bitconvert (v2i64 MQPR:$src))), (v8f16 MQPR:$src)>;
5087 def : Pat<(v8f16 (bitconvert (v4f32 MQPR:$src))), (v8f16 MQPR:$src)>;
5088 def : Pat<(v8f16 (bitconvert (v4i32 MQPR:$src))), (v8f16 MQPR:$src)>;
5089 def : Pat<(v8f16 (bitconvert (v16i8 MQPR:$src))), (v8f16 MQPR:$src)>;
5091 def : Pat<(v8i16 (bitconvert (v2f64 MQPR:$src))), (v8i16 MQPR:$src)>;
5092 def : Pat<(v8i16 (bitconvert (v2i64 MQPR:$src))), (v8i16 MQPR:$src)>;
5093 def : Pat<(v8i16 (bitconvert (v4f32 MQPR:$src))), (v8i16 MQPR:$src)>;
5094 def : Pat<(v8i16 (bitconvert (v4i32 MQPR:$src))), (v8i16 MQPR:$src)>;
5095 def : Pat<(v8i16 (bitconvert (v16i8 MQPR:$src))), (v8i16 MQPR:$src)>;
5097 def : Pat<(v16i8 (bitconvert (v2f64 MQPR:$src))), (v16i8 MQPR:$src)>;
5098 def : Pat<(v16i8 (bitconvert (v2i64 MQPR:$src))), (v16i8 MQPR:$src)>;
5099 def : Pat<(v16i8 (bitconvert (v4f32 MQPR:$src))), (v16i8 MQPR:$src)>;
5100 def : Pat<(v16i8 (bitconvert (v4i32 MQPR:$src))), (v16i8 MQPR:$src)>;
5101 def : Pat<(v16i8 (bitconvert (v8f16 MQPR:$src))), (v16i8 MQPR:$src)>;
5102 def : Pat<(v16i8 (bitconvert (v8i16 MQPR:$src))), (v16i8 MQPR:$src)>;
5105 let Predicates = [IsBE,HasMVEInt] in {
5106 def : Pat<(v2f64 (bitconvert (v4f32 MQPR:$src))), (v2f64 (MVE_VREV64_32 MQPR:$src))>;
5107 def : Pat<(v2f64 (bitconvert (v4i32 MQPR:$src))), (v2f64 (MVE_VREV64_32 MQPR:$src))>;
5108 def : Pat<(v2f64 (bitconvert (v8f16 MQPR:$src))), (v2f64 (MVE_VREV64_16 MQPR:$src))>;
5109 def : Pat<(v2f64 (bitconvert (v8i16 MQPR:$src))), (v2f64 (MVE_VREV64_16 MQPR:$src))>;
5110 def : Pat<(v2f64 (bitconvert (v16i8 MQPR:$src))), (v2f64 (MVE_VREV64_8 MQPR:$src))>;
5112 def : Pat<(v2i64 (bitconvert (v4f32 MQPR:$src))), (v2i64 (MVE_VREV64_32 MQPR:$src))>;
5113 def : Pat<(v2i64 (bitconvert (v4i32 MQPR:$src))), (v2i64 (MVE_VREV64_32 MQPR:$src))>;
5114 def : Pat<(v2i64 (bitconvert (v8f16 MQPR:$src))), (v2i64 (MVE_VREV64_16 MQPR:$src))>;
5115 def : Pat<(v2i64 (bitconvert (v8i16 MQPR:$src))), (v2i64 (MVE_VREV64_16 MQPR:$src))>;
5116 def : Pat<(v2i64 (bitconvert (v16i8 MQPR:$src))), (v2i64 (MVE_VREV64_8 MQPR:$src))>;
5118 def : Pat<(v4f32 (bitconvert (v2f64 MQPR:$src))), (v4f32 (MVE_VREV64_32 MQPR:$src))>;
5119 def : Pat<(v4f32 (bitconvert (v2i64 MQPR:$src))), (v4f32 (MVE_VREV64_32 MQPR:$src))>;
5120 def : Pat<(v4f32 (bitconvert (v8f16 MQPR:$src))), (v4f32 (MVE_VREV32_16 MQPR:$src))>;
5121 def : Pat<(v4f32 (bitconvert (v8i16 MQPR:$src))), (v4f32 (MVE_VREV32_16 MQPR:$src))>;
5122 def : Pat<(v4f32 (bitconvert (v16i8 MQPR:$src))), (v4f32 (MVE_VREV32_8 MQPR:$src))>;
5124 def : Pat<(v4i32 (bitconvert (v2f64 MQPR:$src))), (v4i32 (MVE_VREV64_32 MQPR:$src))>;
5125 def : Pat<(v4i32 (bitconvert (v2i64 MQPR:$src))), (v4i32 (MVE_VREV64_32 MQPR:$src))>;
5126 def : Pat<(v4i32 (bitconvert (v8f16 MQPR:$src))), (v4i32 (MVE_VREV32_16 MQPR:$src))>;
5127 def : Pat<(v4i32 (bitconvert (v8i16 MQPR:$src))), (v4i32 (MVE_VREV32_16 MQPR:$src))>;
5128 def : Pat<(v4i32 (bitconvert (v16i8 MQPR:$src))), (v4i32 (MVE_VREV32_8 MQPR:$src))>;
5130 def : Pat<(v8f16 (bitconvert (v2f64 MQPR:$src))), (v8f16 (MVE_VREV64_16 MQPR:$src))>;
5131 def : Pat<(v8f16 (bitconvert (v2i64 MQPR:$src))), (v8f16 (MVE_VREV64_16 MQPR:$src))>;
5132 def : Pat<(v8f16 (bitconvert (v4f32 MQPR:$src))), (v8f16 (MVE_VREV32_16 MQPR:$src))>;
5133 def : Pat<(v8f16 (bitconvert (v4i32 MQPR:$src))), (v8f16 (MVE_VREV32_16 MQPR:$src))>;
5134 def : Pat<(v8f16 (bitconvert (v16i8 MQPR:$src))), (v8f16 (MVE_VREV16_8 MQPR:$src))>;
5136 def : Pat<(v8i16 (bitconvert (v2f64 MQPR:$src))), (v8i16 (MVE_VREV64_16 MQPR:$src))>;
5137 def : Pat<(v8i16 (bitconvert (v2i64 MQPR:$src))), (v8i16 (MVE_VREV64_16 MQPR:$src))>;
5138 def : Pat<(v8i16 (bitconvert (v4f32 MQPR:$src))), (v8i16 (MVE_VREV32_16 MQPR:$src))>;
5139 def : Pat<(v8i16 (bitconvert (v4i32 MQPR:$src))), (v8i16 (MVE_VREV32_16 MQPR:$src))>;
5140 def : Pat<(v8i16 (bitconvert (v16i8 MQPR:$src))), (v8i16 (MVE_VREV16_8 MQPR:$src))>;
5142 def : Pat<(v16i8 (bitconvert (v2f64 MQPR:$src))), (v16i8 (MVE_VREV64_8 MQPR:$src))>;
5143 def : Pat<(v16i8 (bitconvert (v2i64 MQPR:$src))), (v16i8 (MVE_VREV64_8 MQPR:$src))>;
5144 def : Pat<(v16i8 (bitconvert (v4f32 MQPR:$src))), (v16i8 (MVE_VREV32_8 MQPR:$src))>;
5145 def : Pat<(v16i8 (bitconvert (v4i32 MQPR:$src))), (v16i8 (MVE_VREV32_8 MQPR:$src))>;
5146 def : Pat<(v16i8 (bitconvert (v8f16 MQPR:$src))), (v16i8 (MVE_VREV16_8 MQPR:$src))>;
5147 def : Pat<(v16i8 (bitconvert (v8i16 MQPR:$src))), (v16i8 (MVE_VREV16_8 MQPR:$src))>;