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 // They are printed the same way as the imm8 version
226 let PrintMethod = "printT2AddrModeImm8OffsetOperand";
227 let ParserMatchClass =
228 !cast<AsmOperandClass>("t2am_imm7shift"#shift#"OffsetAsmOperand");
229 let EncoderMethod = "getT2ScaledImmOpValue<7,"#shift#">";
230 let DecoderMethod = "DecodeT2Imm7<"#shift#">";
233 // Operands for gather/scatter loads of the form [Rbase, Qoffsets]
234 class MemRegRQOffsetAsmOperand<int shift> : AsmOperandClass {
235 let Name = "MemRegRQS"#shift#"Offset";
236 let PredicateMethod = "isMemRegRQOffset<"#shift#">";
237 let RenderMethod = "addMemRegRQOffsetOperands";
240 def MemRegRQS0OffsetAsmOperand : MemRegRQOffsetAsmOperand<0>;
241 def MemRegRQS1OffsetAsmOperand : MemRegRQOffsetAsmOperand<1>;
242 def MemRegRQS2OffsetAsmOperand : MemRegRQOffsetAsmOperand<2>;
243 def MemRegRQS3OffsetAsmOperand : MemRegRQOffsetAsmOperand<3>;
245 // mve_addr_rq_shift := reg + vreg{ << UXTW #shift}
246 class mve_addr_rq_shift<int shift> : MemOperand {
247 let EncoderMethod = "getMveAddrModeRQOpValue";
248 let PrintMethod = "printMveAddrModeRQOperand<"#shift#">";
249 let ParserMatchClass =
250 !cast<AsmOperandClass>("MemRegRQS"#shift#"OffsetAsmOperand");
251 let DecoderMethod = "DecodeMveAddrModeRQ";
252 let MIOperandInfo = (ops GPRnopc:$base, MQPR:$offsreg);
255 class MemRegQOffsetAsmOperand<int shift> : AsmOperandClass {
256 let Name = "MemRegQS"#shift#"Offset";
257 let PredicateMethod = "isMemRegQOffset<"#shift#">";
258 let RenderMethod = "addMemImmOffsetOperands";
261 def MemRegQS2OffsetAsmOperand : MemRegQOffsetAsmOperand<2>;
262 def MemRegQS3OffsetAsmOperand : MemRegQOffsetAsmOperand<3>;
264 // mve_addr_q_shift := vreg {+ #imm7s2/4}
265 class mve_addr_q_shift<int shift> : MemOperand {
266 let EncoderMethod = "getMveAddrModeQOpValue<"#shift#">";
267 // Can be printed same way as other reg + imm operands
268 let PrintMethod = "printT2AddrModeImm8Operand<false>";
269 let ParserMatchClass =
270 !cast<AsmOperandClass>("MemRegQS"#shift#"OffsetAsmOperand");
271 let DecoderMethod = "DecodeMveAddrModeQ<"#shift#">";
272 let MIOperandInfo = (ops MQPR:$base, i32imm:$imm);
275 // --------- Start of base classes for the instructions themselves
277 class MVE_MI<dag oops, dag iops, InstrItinClass itin, string asm,
278 string ops, string cstr, list<dag> pattern>
279 : Thumb2XI<oops, iops, AddrModeNone, 4, itin, !strconcat(asm, "\t", ops), cstr,
281 Requires<[HasMVEInt]> {
283 let DecoderNamespace = "MVE";
286 // MVE_p is used for most predicated instructions, to add the cluster
287 // of input operands that provides the VPT suffix (none, T or E) and
288 // the input predicate register.
289 class MVE_p<dag oops, dag iops, InstrItinClass itin, string iname,
290 string suffix, string ops, vpred_ops vpred, string cstr,
291 list<dag> pattern=[]>
292 : MVE_MI<oops, !con(iops, (ins vpred:$vp)), itin,
293 // If the instruction has a suffix, like vadd.f32, then the
294 // VPT predication suffix goes before the dot, so the full
295 // name has to be "vadd${vp}.f32".
296 !strconcat(iname, "${vp}",
297 !if(!eq(suffix, ""), "", !strconcat(".", suffix))),
298 ops, !strconcat(cstr, vpred.vpred_constraint), pattern> {
299 let Inst{31-29} = 0b111;
300 let Inst{27-26} = 0b11;
303 class MVE_f<dag oops, dag iops, InstrItinClass itin, string iname,
304 string suffix, string ops, vpred_ops vpred, string cstr,
305 list<dag> pattern=[]>
306 : MVE_p<oops, iops, itin, iname, suffix, ops, vpred, cstr, pattern> {
307 let Predicates = [HasMVEFloat];
310 class MVE_MI_with_pred<dag oops, dag iops, InstrItinClass itin, string asm,
311 string ops, string cstr, list<dag> pattern>
312 : Thumb2I<oops, iops, AddrModeNone, 4, itin, asm, !strconcat("\t", ops), cstr,
314 Requires<[HasV8_1MMainline, HasMVEInt]> {
316 let DecoderNamespace = "MVE";
319 class MVE_VMOV_lane_base<dag oops, dag iops, InstrItinClass itin, string asm,
320 string suffix, string ops, string cstr,
322 : Thumb2I<oops, iops, AddrModeNone, 4, itin, asm,
323 !if(!eq(suffix, ""), "", "." # suffix) # "\t" # ops,
325 Requires<[HasV8_1MMainline, HasMVEInt]> {
327 let DecoderNamespace = "MVE";
330 class MVE_ScalarShift<string iname, dag oops, dag iops, string asm, string cstr,
331 list<dag> pattern=[]>
332 : MVE_MI_with_pred<oops, iops, NoItinerary, iname, asm, cstr, pattern> {
333 let Inst{31-20} = 0b111010100101;
338 class MVE_ScalarShiftSingleReg<string iname, dag iops, string asm, string cstr,
339 list<dag> pattern=[]>
340 : MVE_ScalarShift<iname, (outs rGPR:$RdaDest), iops, asm, cstr, pattern> {
343 let Inst{19-16} = RdaDest{3-0};
346 class MVE_ScalarShiftSRegImm<string iname, bits<2> op5_4, list<dag> pattern=[]>
347 : MVE_ScalarShiftSingleReg<iname, (ins rGPR:$RdaSrc, long_shift:$imm),
348 "$RdaSrc, $imm", "$RdaDest = $RdaSrc", pattern> {
352 let Inst{14-12} = imm{4-2};
353 let Inst{11-8} = 0b1111;
354 let Inst{7-6} = imm{1-0};
355 let Inst{5-4} = op5_4{1-0};
356 let Inst{3-0} = 0b1111;
359 def MVE_SQSHL : MVE_ScalarShiftSRegImm<"sqshl", 0b11>;
360 def MVE_SRSHR : MVE_ScalarShiftSRegImm<"srshr", 0b10>;
361 def MVE_UQSHL : MVE_ScalarShiftSRegImm<"uqshl", 0b00>;
362 def MVE_URSHR : MVE_ScalarShiftSRegImm<"urshr", 0b01>;
364 class MVE_ScalarShiftSRegReg<string iname, bits<2> op5_4, list<dag> pattern=[]>
365 : MVE_ScalarShiftSingleReg<iname, (ins rGPR:$RdaSrc, rGPR:$Rm),
366 "$RdaSrc, $Rm", "$RdaDest = $RdaSrc", pattern> {
369 let Inst{15-12} = Rm{3-0};
370 let Inst{11-8} = 0b1111;
371 let Inst{7-6} = 0b00;
372 let Inst{5-4} = op5_4{1-0};
373 let Inst{3-0} = 0b1101;
376 def MVE_SQRSHR : MVE_ScalarShiftSRegReg<"sqrshr", 0b10>;
377 def MVE_UQRSHL : MVE_ScalarShiftSRegReg<"uqrshl", 0b00>;
379 class MVE_ScalarShiftDoubleReg<string iname, dag iops, string asm,
380 string cstr, list<dag> pattern=[]>
381 : MVE_ScalarShift<iname, (outs tGPREven:$RdaLo, tGPROdd:$RdaHi),
382 iops, asm, cstr, pattern> {
386 let Inst{19-17} = RdaLo{3-1};
387 let Inst{11-9} = RdaHi{3-1};
390 class MVE_ScalarShiftDRegImm<string iname, bits<2> op5_4, bit op16,
391 list<dag> pattern=[]>
392 : MVE_ScalarShiftDoubleReg<
393 iname, (ins tGPREven:$RdaLo_src, tGPROdd:$RdaHi_src, long_shift:$imm),
394 "$RdaLo, $RdaHi, $imm", "$RdaLo = $RdaLo_src,$RdaHi = $RdaHi_src",
400 let Inst{14-12} = imm{4-2};
401 let Inst{7-6} = imm{1-0};
402 let Inst{5-4} = op5_4{1-0};
403 let Inst{3-0} = 0b1111;
406 class MVE_ScalarShiftDRegRegBase<string iname, dag iops, string asm,
407 bit op5, bit op16, list<dag> pattern=[]>
408 : MVE_ScalarShiftDoubleReg<
409 iname, iops, asm, "@earlyclobber $RdaHi,@earlyclobber $RdaLo,"
410 "$RdaLo = $RdaLo_src,$RdaHi = $RdaHi_src",
415 let Inst{15-12} = Rm{3-0};
419 let Inst{3-0} = 0b1101;
421 // Custom decoder method because of the following overlapping encodings:
424 // SQRSHRL and SQRSHR
425 // UQRSHLL and UQRSHL
426 let DecoderMethod = "DecodeMVEOverlappingLongShift";
429 class MVE_ScalarShiftDRegReg<string iname, bit op5, list<dag> pattern=[]>
430 : MVE_ScalarShiftDRegRegBase<
431 iname, (ins tGPREven:$RdaLo_src, tGPROdd:$RdaHi_src, rGPR:$Rm),
432 "$RdaLo, $RdaHi, $Rm", op5, 0b0, pattern> {
437 class MVE_ScalarShiftDRegRegWithSat<string iname, bit op5, list<dag> pattern=[]>
438 : MVE_ScalarShiftDRegRegBase<
439 iname, (ins tGPREven:$RdaLo_src, tGPROdd:$RdaHi_src, rGPR:$Rm, saturateop:$sat),
440 "$RdaLo, $RdaHi, $sat, $Rm", op5, 0b1, pattern> {
446 def MVE_ASRLr : MVE_ScalarShiftDRegReg<"asrl", 0b1, [(set tGPREven:$RdaLo, tGPROdd:$RdaHi,
447 (ARMasrl tGPREven:$RdaLo_src,
448 tGPROdd:$RdaHi_src, rGPR:$Rm))]>;
449 def MVE_ASRLi : MVE_ScalarShiftDRegImm<"asrl", 0b10, ?, [(set tGPREven:$RdaLo, tGPROdd:$RdaHi,
450 (ARMasrl tGPREven:$RdaLo_src,
451 tGPROdd:$RdaHi_src, (i32 imm:$imm)))]>;
452 def MVE_LSLLr : MVE_ScalarShiftDRegReg<"lsll", 0b0, [(set tGPREven:$RdaLo, tGPROdd:$RdaHi,
453 (ARMlsll tGPREven:$RdaLo_src,
454 tGPROdd:$RdaHi_src, rGPR:$Rm))]>;
455 def MVE_LSLLi : MVE_ScalarShiftDRegImm<"lsll", 0b00, ?, [(set tGPREven:$RdaLo, tGPROdd:$RdaHi,
456 (ARMlsll tGPREven:$RdaLo_src,
457 tGPROdd:$RdaHi_src, (i32 imm:$imm)))]>;
458 def MVE_LSRL : MVE_ScalarShiftDRegImm<"lsrl", 0b01, ?, [(set tGPREven:$RdaLo, tGPROdd:$RdaHi,
459 (ARMlsrl tGPREven:$RdaLo_src,
460 tGPROdd:$RdaHi_src, (i32 imm:$imm)))]>;
462 def MVE_SQRSHRL : MVE_ScalarShiftDRegRegWithSat<"sqrshrl", 0b1>;
463 def MVE_SQSHLL : MVE_ScalarShiftDRegImm<"sqshll", 0b11, 0b1>;
464 def MVE_SRSHRL : MVE_ScalarShiftDRegImm<"srshrl", 0b10, 0b1>;
466 def MVE_UQRSHLL : MVE_ScalarShiftDRegRegWithSat<"uqrshll", 0b0>;
467 def MVE_UQSHLL : MVE_ScalarShiftDRegImm<"uqshll", 0b00, 0b1>;
468 def MVE_URSHRL : MVE_ScalarShiftDRegImm<"urshrl", 0b01, 0b1>;
470 // start of mve_rDest instructions
472 class MVE_rDest<dag oops, dag iops, InstrItinClass itin,
473 string iname, string suffix,
474 string ops, string cstr, list<dag> pattern=[]>
475 // Always use vpred_n and not vpred_r: with the output register being
476 // a GPR and not a vector register, there can't be any question of
477 // what to put in its inactive lanes.
478 : MVE_p<oops, iops, itin, iname, suffix, ops, vpred_n, cstr, pattern> {
480 let Inst{25-23} = 0b101;
481 let Inst{11-9} = 0b111;
485 class MVE_VABAV<string suffix, bit U, bits<2> size, list<dag> pattern=[]>
486 : MVE_rDest<(outs rGPR:$Rda), (ins rGPR:$Rda_src, MQPR:$Qn, MQPR:$Qm),
487 NoItinerary, "vabav", suffix, "$Rda, $Qn, $Qm", "$Rda = $Rda_src",
495 let Inst{21-20} = size{1-0};
496 let Inst{19-17} = Qn{2-0};
498 let Inst{15-12} = Rda{3-0};
503 let Inst{3-1} = Qm{2-0};
507 def MVE_VABAVs8 : MVE_VABAV<"s8", 0b0, 0b00>;
508 def MVE_VABAVs16 : MVE_VABAV<"s16", 0b0, 0b01>;
509 def MVE_VABAVs32 : MVE_VABAV<"s32", 0b0, 0b10>;
510 def MVE_VABAVu8 : MVE_VABAV<"u8", 0b1, 0b00>;
511 def MVE_VABAVu16 : MVE_VABAV<"u16", 0b1, 0b01>;
512 def MVE_VABAVu32 : MVE_VABAV<"u32", 0b1, 0b10>;
514 class MVE_VADDV<string iname, string suffix, dag iops, string cstr,
515 bit A, bit U, bits<2> size, list<dag> pattern=[]>
516 : MVE_rDest<(outs tGPREven:$Rda), iops, NoItinerary,
517 iname, suffix, "$Rda, $Qm", cstr, pattern> {
522 let Inst{22-20} = 0b111;
523 let Inst{19-18} = size{1-0};
524 let Inst{17-16} = 0b01;
525 let Inst{15-13} = Rda{3-1};
527 let Inst{8-6} = 0b100;
529 let Inst{3-1} = Qm{2-0};
533 multiclass MVE_VADDV_A<string suffix, bit U, bits<2> size,
534 list<dag> pattern=[]> {
535 def acc : MVE_VADDV<"vaddva", suffix,
536 (ins tGPREven:$Rda_src, MQPR:$Qm), "$Rda = $Rda_src",
537 0b1, U, size, pattern>;
538 def no_acc : MVE_VADDV<"vaddv", suffix,
540 0b0, U, size, pattern>;
543 defm MVE_VADDVs8 : MVE_VADDV_A<"s8", 0b0, 0b00>;
544 defm MVE_VADDVs16 : MVE_VADDV_A<"s16", 0b0, 0b01>;
545 defm MVE_VADDVs32 : MVE_VADDV_A<"s32", 0b0, 0b10>;
546 defm MVE_VADDVu8 : MVE_VADDV_A<"u8", 0b1, 0b00>;
547 defm MVE_VADDVu16 : MVE_VADDV_A<"u16", 0b1, 0b01>;
548 defm MVE_VADDVu32 : MVE_VADDV_A<"u32", 0b1, 0b10>;
550 class MVE_VADDLV<string iname, string suffix, dag iops, string cstr,
551 bit A, bit U, list<dag> pattern=[]>
552 : MVE_rDest<(outs tGPREven:$RdaLo, tGPROdd:$RdaHi), iops, NoItinerary, iname,
553 suffix, "$RdaLo, $RdaHi, $Qm", cstr, pattern> {
559 let Inst{22-20} = RdaHi{3-1};
560 let Inst{19-18} = 0b10;
561 let Inst{17-16} = 0b01;
562 let Inst{15-13} = RdaLo{3-1};
564 let Inst{8-6} = 0b100;
566 let Inst{3-1} = Qm{2-0};
570 multiclass MVE_VADDLV_A<string suffix, bit U, list<dag> pattern=[]> {
571 def acc : MVE_VADDLV<"vaddlva", suffix,
572 (ins tGPREven:$RdaLo_src, tGPROdd:$RdaHi_src, MQPR:$Qm),
573 "$RdaLo = $RdaLo_src,$RdaHi = $RdaHi_src",
575 def no_acc : MVE_VADDLV<"vaddlv", suffix,
581 defm MVE_VADDLVs32 : MVE_VADDLV_A<"s32", 0b0>;
582 defm MVE_VADDLVu32 : MVE_VADDLV_A<"u32", 0b1>;
584 class MVE_VMINMAXNMV<string iname, string suffix, bit sz,
585 bit bit_17, bit bit_7, list<dag> pattern=[]>
586 : MVE_rDest<(outs rGPR:$RdaDest), (ins rGPR:$RdaSrc, MQPR:$Qm),
587 NoItinerary, iname, suffix, "$RdaSrc, $Qm",
588 "$RdaDest = $RdaSrc", pattern> {
593 let Inst{22-20} = 0b110;
594 let Inst{19-18} = 0b11;
595 let Inst{17} = bit_17;
597 let Inst{15-12} = RdaDest{3-0};
600 let Inst{6-5} = 0b00;
601 let Inst{3-1} = Qm{2-0};
604 let Predicates = [HasMVEFloat];
607 multiclass MVE_VMINMAXNMV_fty<string iname, bit bit_7, list<dag> pattern=[]> {
608 def f32 : MVE_VMINMAXNMV<iname, "f32", 0b0, 0b1, bit_7, pattern>;
609 def f16 : MVE_VMINMAXNMV<iname, "f16", 0b1, 0b1, bit_7, pattern>;
612 defm MVE_VMINNMV : MVE_VMINMAXNMV_fty<"vminnmv", 0b1>;
613 defm MVE_VMAXNMV : MVE_VMINMAXNMV_fty<"vmaxnmv", 0b0>;
615 multiclass MVE_VMINMAXNMAV_fty<string iname, bit bit_7, list<dag> pattern=[]> {
616 def f32 : MVE_VMINMAXNMV<iname, "f32", 0b0, 0b0, bit_7, pattern>;
617 def f16 : MVE_VMINMAXNMV<iname, "f16", 0b1, 0b0, bit_7, pattern>;
620 defm MVE_VMINNMAV : MVE_VMINMAXNMAV_fty<"vminnmav", 0b1>;
621 defm MVE_VMAXNMAV : MVE_VMINMAXNMAV_fty<"vmaxnmav", 0b0>;
623 class MVE_VMINMAXV<string iname, string suffix, bit U, bits<2> size,
624 bit bit_17, bit bit_7, list<dag> pattern=[]>
625 : MVE_rDest<(outs rGPR:$RdaDest), (ins rGPR:$RdaSrc, MQPR:$Qm), NoItinerary,
626 iname, suffix, "$RdaSrc, $Qm", "$RdaDest = $RdaSrc", pattern> {
631 let Inst{22-20} = 0b110;
632 let Inst{19-18} = size{1-0};
633 let Inst{17} = bit_17;
635 let Inst{15-12} = RdaDest{3-0};
638 let Inst{6-5} = 0b00;
639 let Inst{3-1} = Qm{2-0};
643 multiclass MVE_VMINMAXV_ty<string iname, bit bit_7, list<dag> pattern=[]> {
644 def s8 : MVE_VMINMAXV<iname, "s8", 0b0, 0b00, 0b1, bit_7>;
645 def s16 : MVE_VMINMAXV<iname, "s16", 0b0, 0b01, 0b1, bit_7>;
646 def s32 : MVE_VMINMAXV<iname, "s32", 0b0, 0b10, 0b1, bit_7>;
647 def u8 : MVE_VMINMAXV<iname, "u8", 0b1, 0b00, 0b1, bit_7>;
648 def u16 : MVE_VMINMAXV<iname, "u16", 0b1, 0b01, 0b1, bit_7>;
649 def u32 : MVE_VMINMAXV<iname, "u32", 0b1, 0b10, 0b1, bit_7>;
652 defm MVE_VMINV : MVE_VMINMAXV_ty<"vminv", 0b1>;
653 defm MVE_VMAXV : MVE_VMINMAXV_ty<"vmaxv", 0b0>;
655 multiclass MVE_VMINMAXAV_ty<string iname, bit bit_7, list<dag> pattern=[]> {
656 def s8 : MVE_VMINMAXV<iname, "s8", 0b0, 0b00, 0b0, bit_7>;
657 def s16 : MVE_VMINMAXV<iname, "s16", 0b0, 0b01, 0b0, bit_7>;
658 def s32 : MVE_VMINMAXV<iname, "s32", 0b0, 0b10, 0b0, bit_7>;
661 defm MVE_VMINAV : MVE_VMINMAXAV_ty<"vminav", 0b1>;
662 defm MVE_VMAXAV : MVE_VMINMAXAV_ty<"vmaxav", 0b0>;
664 class MVE_VMLAMLSDAV<string iname, string suffix, dag iops, string cstr,
665 bit sz, bit bit_28, bit A, bit X, bit bit_8, bit bit_0,
666 list<dag> pattern=[]>
667 : MVE_rDest<(outs tGPREven:$RdaDest), iops, NoItinerary, iname, suffix,
668 "$RdaDest, $Qn, $Qm", cstr, pattern> {
673 let Inst{28} = bit_28;
674 let Inst{22-20} = 0b111;
675 let Inst{19-17} = Qn{2-0};
677 let Inst{15-13} = RdaDest{3-1};
680 let Inst{7-6} = 0b00;
682 let Inst{3-1} = Qm{2-0};
686 multiclass MVE_VMLAMLSDAV_X<string iname, string suffix, dag iops, string cstr,
687 bit sz, bit bit_28, bit A, bit bit_8, bit bit_0,
688 list<dag> pattern=[]> {
689 def _noexch : MVE_VMLAMLSDAV<iname, suffix, iops, cstr, sz,
690 bit_28, A, 0b0, bit_8, bit_0, pattern>;
691 def _exch : MVE_VMLAMLSDAV<iname # "x", suffix, iops, cstr, sz,
692 bit_28, A, 0b1, bit_8, bit_0, pattern>;
695 multiclass MVE_VMLAMLSDAV_XA<string iname, string suffix, bit sz, bit bit_28,
696 bit bit_8, bit bit_0, list<dag> pattern=[]> {
697 defm _noacc : MVE_VMLAMLSDAV_X<iname, suffix, (ins MQPR:$Qn, MQPR:$Qm), "",
698 sz, bit_28, 0b0, bit_8, bit_0, pattern>;
699 defm _acc : MVE_VMLAMLSDAV_X<iname # "a", suffix,
700 (ins tGPREven:$RdaSrc, MQPR:$Qn, MQPR:$Qm),
701 "$RdaDest = $RdaSrc",
702 sz, bit_28, 0b1, bit_8, bit_0, pattern>;
705 multiclass MVE_VMLADAV_multi<string suffix, bit sz, bit U, bit bit_8,
706 list<dag> pattern=[]> {
707 defm "" : MVE_VMLAMLSDAV_XA<"vmladav", suffix, sz, U, bit_8, 0b0, pattern>;
710 defm MVE_VMLADAVs16 : MVE_VMLADAV_multi<"s16", 0b0, 0b0, 0b0>;
711 defm MVE_VMLADAVs32 : MVE_VMLADAV_multi<"s32", 0b1, 0b0, 0b0>;
712 defm MVE_VMLADAVu16 : MVE_VMLADAV_multi<"u16", 0b0, 0b1, 0b0>;
713 defm MVE_VMLADAVu32 : MVE_VMLADAV_multi<"u32", 0b1, 0b1, 0b0>;
715 defm MVE_VMLADAVs8 : MVE_VMLADAV_multi<"s8", 0b0, 0b0, 0b1>;
716 defm MVE_VMLADAVu8 : MVE_VMLADAV_multi<"u8", 0b0, 0b1, 0b1>;
718 // vmlav aliases vmladav
719 foreach acc = ["_acc", "_noacc"] in {
720 foreach suffix = ["s8", "s16", "s32", "u8", "u16", "u32"] in {
721 def : MVEInstAlias<!strconcat("vmlav", !if(!eq(acc, "_acc"), "a", ""),
722 "${vp}.", suffix, "\t$RdaDest, $Qn, $Qm"),
723 (!cast<Instruction>("MVE_VMLADAV"#suffix#acc#"_noexch")
724 tGPREven:$RdaDest, MQPR:$Qn, MQPR:$Qm, vpred_n:$vp)>;
728 multiclass MVE_VMLSDAV_multi<string suffix, bit sz, bit bit_28,
729 list<dag> pattern=[]> {
730 defm "" : MVE_VMLAMLSDAV_XA<"vmlsdav", suffix, sz, bit_28, 0b0, 0b1, pattern>;
733 defm MVE_VMLSDAVs8 : MVE_VMLSDAV_multi<"s8", 0, 0b1>;
734 defm MVE_VMLSDAVs16 : MVE_VMLSDAV_multi<"s16", 0, 0b0>;
735 defm MVE_VMLSDAVs32 : MVE_VMLSDAV_multi<"s32", 1, 0b0>;
737 // Base class for VMLALDAV and VMLSLDAV, VRMLALDAVH, VRMLSLDAVH
738 class MVE_VMLALDAVBase<string iname, string suffix, dag iops, string cstr,
739 bit sz, bit bit_28, bit A, bit X, bit bit_8, bit bit_0,
740 list<dag> pattern=[]>
741 : MVE_rDest<(outs tGPREven:$RdaLoDest, tGPROdd:$RdaHiDest), iops, NoItinerary,
742 iname, suffix, "$RdaLoDest, $RdaHiDest, $Qn, $Qm", cstr, pattern> {
748 let Inst{28} = bit_28;
749 let Inst{22-20} = RdaHiDest{3-1};
750 let Inst{19-17} = Qn{2-0};
752 let Inst{15-13} = RdaLoDest{3-1};
755 let Inst{7-6} = 0b00;
757 let Inst{3-1} = Qm{2-0};
761 multiclass MVE_VMLALDAVBase_X<string iname, string suffix, dag iops,
762 string cstr, bit sz, bit bit_28, bit A,
763 bit bit_8, bit bit_0, list<dag> pattern=[]> {
764 def _noexch : MVE_VMLALDAVBase<iname, suffix, iops, cstr, sz,
765 bit_28, A, 0b0, bit_8, bit_0, pattern>;
766 def _exch : MVE_VMLALDAVBase<iname # "x", suffix, iops, cstr, sz,
767 bit_28, A, 0b1, bit_8, bit_0, pattern>;
770 multiclass MVE_VMLALDAVBase_XA<string iname, string suffix, bit sz, bit bit_28,
771 bit bit_8, bit bit_0, list<dag> pattern=[]> {
772 defm _noacc : MVE_VMLALDAVBase_X<
773 iname, suffix, (ins MQPR:$Qn, MQPR:$Qm), "",
774 sz, bit_28, 0b0, bit_8, bit_0, pattern>;
775 defm _acc : MVE_VMLALDAVBase_X<
776 iname # "a", suffix, (ins tGPREven:$RdaLoSrc, tGPROdd:$RdaHiSrc,
778 "$RdaLoDest = $RdaLoSrc,$RdaHiDest = $RdaHiSrc",
779 sz, bit_28, 0b1, bit_8, bit_0, pattern>;
782 multiclass MVE_VRMLALDAVH_multi<string suffix, bit U, list<dag> pattern=[]> {
783 defm "" : MVE_VMLALDAVBase_XA<
784 "vrmlaldavh", suffix, 0b0, U, 0b1, 0b0, pattern>;
787 defm MVE_VRMLALDAVHs32 : MVE_VRMLALDAVH_multi<"s32", 0>;
788 defm MVE_VRMLALDAVHu32 : MVE_VRMLALDAVH_multi<"u32", 1>;
790 // vrmlalvh aliases for vrmlaldavh
791 def : MVEInstAlias<"vrmlalvh${vp}.s32\t$RdaLo, $RdaHi, $Qn, $Qm",
792 (MVE_VRMLALDAVHs32_noacc_noexch
793 tGPREven:$RdaLo, tGPROdd:$RdaHi,
794 MQPR:$Qn, MQPR:$Qm, vpred_n:$vp)>;
795 def : MVEInstAlias<"vrmlalvha${vp}.s32\t$RdaLo, $RdaHi, $Qn, $Qm",
796 (MVE_VRMLALDAVHs32_acc_noexch
797 tGPREven:$RdaLo, tGPROdd:$RdaHi,
798 MQPR:$Qn, MQPR:$Qm, vpred_n:$vp)>;
799 def : MVEInstAlias<"vrmlalvh${vp}.u32\t$RdaLo, $RdaHi, $Qn, $Qm",
800 (MVE_VRMLALDAVHu32_noacc_noexch
801 tGPREven:$RdaLo, tGPROdd:$RdaHi,
802 MQPR:$Qn, MQPR:$Qm, vpred_n:$vp)>;
803 def : MVEInstAlias<"vrmlalvha${vp}.u32\t$RdaLo, $RdaHi, $Qn, $Qm",
804 (MVE_VRMLALDAVHu32_acc_noexch
805 tGPREven:$RdaLo, tGPROdd:$RdaHi,
806 MQPR:$Qn, MQPR:$Qm, vpred_n:$vp)>;
808 multiclass MVE_VMLALDAV_multi<string suffix, bit sz, bit U,
809 list<dag> pattern=[]> {
810 defm "" : MVE_VMLALDAVBase_XA<"vmlaldav", suffix, sz, U, 0b0, 0b0, pattern>;
813 defm MVE_VMLALDAVs16 : MVE_VMLALDAV_multi<"s16", 0b0, 0b0>;
814 defm MVE_VMLALDAVs32 : MVE_VMLALDAV_multi<"s32", 0b1, 0b0>;
815 defm MVE_VMLALDAVu16 : MVE_VMLALDAV_multi<"u16", 0b0, 0b1>;
816 defm MVE_VMLALDAVu32 : MVE_VMLALDAV_multi<"u32", 0b1, 0b1>;
818 // vmlalv aliases vmlaldav
819 foreach acc = ["_acc", "_noacc"] in {
820 foreach suffix = ["s16", "s32", "u16", "u32"] in {
821 def : MVEInstAlias<!strconcat("vmlalv", !if(!eq(acc, "_acc"), "a", ""),
822 "${vp}.", suffix, "\t$RdaLoDest, $RdaHiDest, $Qn, $Qm"),
823 (!cast<Instruction>("MVE_VMLALDAV"#suffix#acc#"_noexch")
824 tGPREven:$RdaLoDest, tGPROdd:$RdaHiDest,
825 MQPR:$Qn, MQPR:$Qm, vpred_n:$vp)>;
829 multiclass MVE_VMLSLDAV_multi<string iname, string suffix, bit sz,
830 bit bit_28, list<dag> pattern=[]> {
831 defm "" : MVE_VMLALDAVBase_XA<iname, suffix, sz, bit_28, 0b0, 0b1, pattern>;
834 defm MVE_VMLSLDAVs16 : MVE_VMLSLDAV_multi<"vmlsldav", "s16", 0b0, 0b0>;
835 defm MVE_VMLSLDAVs32 : MVE_VMLSLDAV_multi<"vmlsldav", "s32", 0b1, 0b0>;
836 defm MVE_VRMLSLDAVHs32 : MVE_VMLSLDAV_multi<"vrmlsldavh", "s32", 0b0, 0b1>;
838 // end of mve_rDest instructions
840 // start of mve_comp instructions
842 class MVE_comp<InstrItinClass itin, string iname, string suffix,
843 string cstr, list<dag> pattern=[]>
844 : MVE_p<(outs MQPR:$Qd), (ins MQPR:$Qn, MQPR:$Qm), itin, iname, suffix,
845 "$Qd, $Qn, $Qm", vpred_r, cstr, pattern> {
850 let Inst{22} = Qd{3};
851 let Inst{19-17} = Qn{2-0};
853 let Inst{15-13} = Qd{2-0};
855 let Inst{10-9} = 0b11;
858 let Inst{3-1} = Qm{2-0};
862 class MVE_VMINMAXNM<string iname, string suffix, bit sz, bit bit_21,
863 list<dag> pattern=[]>
864 : MVE_comp<NoItinerary, iname, suffix, "", pattern> {
867 let Inst{25-24} = 0b11;
869 let Inst{21} = bit_21;
876 let Predicates = [HasMVEFloat];
879 def MVE_VMAXNMf32 : MVE_VMINMAXNM<"vmaxnm", "f32", 0b0, 0b0>;
880 def MVE_VMAXNMf16 : MVE_VMINMAXNM<"vmaxnm", "f16", 0b1, 0b0>;
882 let Predicates = [HasMVEFloat] in {
883 def : Pat<(v4f32 (fmaxnum (v4f32 MQPR:$val1), (v4f32 MQPR:$val2))),
884 (v4f32 (MVE_VMAXNMf32 (v4f32 MQPR:$val1), (v4f32 MQPR:$val2)))>;
885 def : Pat<(v8f16 (fmaxnum (v8f16 MQPR:$val1), (v8f16 MQPR:$val2))),
886 (v8f16 (MVE_VMAXNMf16 (v8f16 MQPR:$val1), (v8f16 MQPR:$val2)))>;
889 def MVE_VMINNMf32 : MVE_VMINMAXNM<"vminnm", "f32", 0b0, 0b1>;
890 def MVE_VMINNMf16 : MVE_VMINMAXNM<"vminnm", "f16", 0b1, 0b1>;
892 let Predicates = [HasMVEFloat] in {
893 def : Pat<(v4f32 (fminnum (v4f32 MQPR:$val1), (v4f32 MQPR:$val2))),
894 (v4f32 (MVE_VMINNMf32 (v4f32 MQPR:$val1), (v4f32 MQPR:$val2)))>;
895 def : Pat<(v8f16 (fminnum (v8f16 MQPR:$val1), (v8f16 MQPR:$val2))),
896 (v8f16 (MVE_VMINNMf16 (v8f16 MQPR:$val1), (v8f16 MQPR:$val2)))>;
900 class MVE_VMINMAX<string iname, string suffix, bit U, bits<2> size,
901 bit bit_4, list<dag> pattern=[]>
902 : MVE_comp<NoItinerary, iname, suffix, "", pattern> {
905 let Inst{25-24} = 0b11;
907 let Inst{21-20} = size{1-0};
914 multiclass MVE_VMINMAX_all_sizes<string iname, bit bit_4> {
915 def s8 : MVE_VMINMAX<iname, "s8", 0b0, 0b00, bit_4>;
916 def s16 : MVE_VMINMAX<iname, "s16", 0b0, 0b01, bit_4>;
917 def s32 : MVE_VMINMAX<iname, "s32", 0b0, 0b10, bit_4>;
918 def u8 : MVE_VMINMAX<iname, "u8", 0b1, 0b00, bit_4>;
919 def u16 : MVE_VMINMAX<iname, "u16", 0b1, 0b01, bit_4>;
920 def u32 : MVE_VMINMAX<iname, "u32", 0b1, 0b10, bit_4>;
923 defm MVE_VMAX : MVE_VMINMAX_all_sizes<"vmax", 0b0>;
924 defm MVE_VMIN : MVE_VMINMAX_all_sizes<"vmin", 0b1>;
926 let Predicates = [HasMVEInt] in {
927 def : Pat<(v16i8 (smin (v16i8 MQPR:$val1), (v16i8 MQPR:$val2))),
928 (v16i8 (MVE_VMINs8 (v16i8 MQPR:$val1), (v16i8 MQPR:$val2)))>;
929 def : Pat<(v8i16 (smin (v8i16 MQPR:$val1), (v8i16 MQPR:$val2))),
930 (v8i16 (MVE_VMINs16 (v8i16 MQPR:$val1), (v8i16 MQPR:$val2)))>;
931 def : Pat<(v4i32 (smin (v4i32 MQPR:$val1), (v4i32 MQPR:$val2))),
932 (v4i32 (MVE_VMINs32 (v4i32 MQPR:$val1), (v4i32 MQPR:$val2)))>;
934 def : Pat<(v16i8 (smax (v16i8 MQPR:$val1), (v16i8 MQPR:$val2))),
935 (v16i8 (MVE_VMAXs8 (v16i8 MQPR:$val1), (v16i8 MQPR:$val2)))>;
936 def : Pat<(v8i16 (smax (v8i16 MQPR:$val1), (v8i16 MQPR:$val2))),
937 (v8i16 (MVE_VMAXs16 (v8i16 MQPR:$val1), (v8i16 MQPR:$val2)))>;
938 def : Pat<(v4i32 (smax (v4i32 MQPR:$val1), (v4i32 MQPR:$val2))),
939 (v4i32 (MVE_VMAXs32 (v4i32 MQPR:$val1), (v4i32 MQPR:$val2)))>;
941 def : Pat<(v16i8 (umin (v16i8 MQPR:$val1), (v16i8 MQPR:$val2))),
942 (v16i8 (MVE_VMINu8 (v16i8 MQPR:$val1), (v16i8 MQPR:$val2)))>;
943 def : Pat<(v8i16 (umin (v8i16 MQPR:$val1), (v8i16 MQPR:$val2))),
944 (v8i16 (MVE_VMINu16 (v8i16 MQPR:$val1), (v8i16 MQPR:$val2)))>;
945 def : Pat<(v4i32 (umin (v4i32 MQPR:$val1), (v4i32 MQPR:$val2))),
946 (v4i32 (MVE_VMINu32 (v4i32 MQPR:$val1), (v4i32 MQPR:$val2)))>;
948 def : Pat<(v16i8 (umax (v16i8 MQPR:$val1), (v16i8 MQPR:$val2))),
949 (v16i8 (MVE_VMAXu8 (v16i8 MQPR:$val1), (v16i8 MQPR:$val2)))>;
950 def : Pat<(v8i16 (umax (v8i16 MQPR:$val1), (v8i16 MQPR:$val2))),
951 (v8i16 (MVE_VMAXu16 (v8i16 MQPR:$val1), (v8i16 MQPR:$val2)))>;
952 def : Pat<(v4i32 (umax (v4i32 MQPR:$val1), (v4i32 MQPR:$val2))),
953 (v4i32 (MVE_VMAXu32 (v4i32 MQPR:$val1), (v4i32 MQPR:$val2)))>;
956 // end of mve_comp instructions
958 // start of mve_bit instructions
960 class MVE_bit_arith<dag oops, dag iops, string iname, string suffix,
961 string ops, string cstr, list<dag> pattern=[]>
962 : MVE_p<oops, iops, NoItinerary, iname, suffix, ops, vpred_r, cstr, pattern> {
966 let Inst{22} = Qd{3};
967 let Inst{15-13} = Qd{2-0};
969 let Inst{3-1} = Qm{2-0};
972 def MVE_VBIC : MVE_bit_arith<(outs MQPR:$Qd), (ins MQPR:$Qn, MQPR:$Qm),
973 "vbic", "", "$Qd, $Qn, $Qm", ""> {
977 let Inst{25-23} = 0b110;
978 let Inst{21-20} = 0b01;
979 let Inst{19-17} = Qn{2-0};
981 let Inst{12-8} = 0b00001;
988 class MVE_VREV<string iname, string suffix, bits<2> size, bits<2> bit_8_7>
989 : MVE_bit_arith<(outs MQPR:$Qd), (ins MQPR:$Qm), iname,
990 suffix, "$Qd, $Qm", ""> {
993 let Inst{25-23} = 0b111;
994 let Inst{21-20} = 0b11;
995 let Inst{19-18} = size;
996 let Inst{17-16} = 0b00;
997 let Inst{12-9} = 0b0000;
998 let Inst{8-7} = bit_8_7;
1004 def MVE_VREV64_8 : MVE_VREV<"vrev64", "8", 0b00, 0b00>;
1005 def MVE_VREV64_16 : MVE_VREV<"vrev64", "16", 0b01, 0b00>;
1006 def MVE_VREV64_32 : MVE_VREV<"vrev64", "32", 0b10, 0b00>;
1008 def MVE_VREV32_8 : MVE_VREV<"vrev32", "8", 0b00, 0b01>;
1009 def MVE_VREV32_16 : MVE_VREV<"vrev32", "16", 0b01, 0b01>;
1011 def MVE_VREV16_8 : MVE_VREV<"vrev16", "8", 0b00, 0b10>;
1013 let Predicates = [HasMVEInt] in {
1014 def : Pat<(v4i32 (ARMvrev64 (v4i32 MQPR:$src))),
1015 (v4i32 (MVE_VREV64_32 (v4i32 MQPR:$src)))>;
1016 def : Pat<(v8i16 (ARMvrev64 (v8i16 MQPR:$src))),
1017 (v8i16 (MVE_VREV64_16 (v8i16 MQPR:$src)))>;
1018 def : Pat<(v16i8 (ARMvrev64 (v16i8 MQPR:$src))),
1019 (v16i8 (MVE_VREV64_8 (v16i8 MQPR:$src)))>;
1021 def : Pat<(v8i16 (ARMvrev32 (v8i16 MQPR:$src))),
1022 (v8i16 (MVE_VREV32_16 (v8i16 MQPR:$src)))>;
1023 def : Pat<(v16i8 (ARMvrev32 (v16i8 MQPR:$src))),
1024 (v16i8 (MVE_VREV32_8 (v16i8 MQPR:$src)))>;
1026 def : Pat<(v16i8 (ARMvrev16 (v16i8 MQPR:$src))),
1027 (v16i8 (MVE_VREV16_8 (v16i8 MQPR:$src)))>;
1029 def : Pat<(v4f32 (ARMvrev64 (v4f32 MQPR:$src))),
1030 (v4f32 (MVE_VREV64_32 (v4f32 MQPR:$src)))>;
1031 def : Pat<(v8f16 (ARMvrev64 (v8f16 MQPR:$src))),
1032 (v8f16 (MVE_VREV64_16 (v8f16 MQPR:$src)))>;
1033 def : Pat<(v8f16 (ARMvrev32 (v8f16 MQPR:$src))),
1034 (v8f16 (MVE_VREV32_16 (v8f16 MQPR:$src)))>;
1037 def MVE_VMVN : MVE_bit_arith<(outs MQPR:$Qd), (ins MQPR:$Qm),
1038 "vmvn", "", "$Qd, $Qm", ""> {
1040 let Inst{25-23} = 0b111;
1041 let Inst{21-16} = 0b110000;
1042 let Inst{12-6} = 0b0010111;
1047 let Predicates = [HasMVEInt] in {
1048 def : Pat<(v16i8 (vnotq (v16i8 MQPR:$val1))),
1049 (v16i8 (MVE_VMVN (v16i8 MQPR:$val1)))>;
1050 def : Pat<(v8i16 (vnotq (v8i16 MQPR:$val1))),
1051 (v8i16 (MVE_VMVN (v8i16 MQPR:$val1)))>;
1052 def : Pat<(v4i32 (vnotq (v4i32 MQPR:$val1))),
1053 (v4i32 (MVE_VMVN (v4i32 MQPR:$val1)))>;
1054 def : Pat<(v2i64 (vnotq (v2i64 MQPR:$val1))),
1055 (v2i64 (MVE_VMVN (v2i64 MQPR:$val1)))>;
1058 class MVE_bit_ops<string iname, bits<2> bit_21_20, bit bit_28>
1059 : MVE_bit_arith<(outs MQPR:$Qd), (ins MQPR:$Qn, MQPR:$Qm),
1060 iname, "", "$Qd, $Qn, $Qm", ""> {
1063 let Inst{28} = bit_28;
1064 let Inst{25-23} = 0b110;
1065 let Inst{21-20} = bit_21_20;
1066 let Inst{19-17} = Qn{2-0};
1068 let Inst{12-8} = 0b00001;
1069 let Inst{7} = Qn{3};
1075 def MVE_VEOR : MVE_bit_ops<"veor", 0b00, 0b1>;
1076 def MVE_VORN : MVE_bit_ops<"vorn", 0b11, 0b0>;
1077 def MVE_VORR : MVE_bit_ops<"vorr", 0b10, 0b0>;
1078 def MVE_VAND : MVE_bit_ops<"vand", 0b00, 0b0>;
1080 // add ignored suffixes as aliases
1082 foreach s=["s8", "s16", "s32", "u8", "u16", "u32", "i8", "i16", "i32", "f16", "f32"] in {
1083 def : MVEInstAlias<"vbic${vp}." # s # "\t$QdSrc, $QnSrc, $QmSrc",
1084 (MVE_VBIC MQPR:$QdSrc, MQPR:$QnSrc, MQPR:$QmSrc, vpred_r:$vp)>;
1085 def : MVEInstAlias<"veor${vp}." # s # "\t$QdSrc, $QnSrc, $QmSrc",
1086 (MVE_VEOR MQPR:$QdSrc, MQPR:$QnSrc, MQPR:$QmSrc, vpred_r:$vp)>;
1087 def : MVEInstAlias<"vorn${vp}." # s # "\t$QdSrc, $QnSrc, $QmSrc",
1088 (MVE_VORN MQPR:$QdSrc, MQPR:$QnSrc, MQPR:$QmSrc, vpred_r:$vp)>;
1089 def : MVEInstAlias<"vorr${vp}." # s # "\t$QdSrc, $QnSrc, $QmSrc",
1090 (MVE_VORR MQPR:$QdSrc, MQPR:$QnSrc, MQPR:$QmSrc, vpred_r:$vp)>;
1091 def : MVEInstAlias<"vand${vp}." # s # "\t$QdSrc, $QnSrc, $QmSrc",
1092 (MVE_VAND MQPR:$QdSrc, MQPR:$QnSrc, MQPR:$QmSrc, vpred_r:$vp)>;
1095 let Predicates = [HasMVEInt] in {
1096 def : Pat<(v16i8 (and (v16i8 MQPR:$val1), (v16i8 MQPR:$val2))),
1097 (v16i8 (MVE_VAND (v16i8 MQPR:$val1), (v16i8 MQPR:$val2)))>;
1098 def : Pat<(v8i16 (and (v8i16 MQPR:$val1), (v8i16 MQPR:$val2))),
1099 (v8i16 (MVE_VAND (v8i16 MQPR:$val1), (v8i16 MQPR:$val2)))>;
1100 def : Pat<(v4i32 (and (v4i32 MQPR:$val1), (v4i32 MQPR:$val2))),
1101 (v4i32 (MVE_VAND (v4i32 MQPR:$val1), (v4i32 MQPR:$val2)))>;
1102 def : Pat<(v2i64 (and (v2i64 MQPR:$val1), (v2i64 MQPR:$val2))),
1103 (v2i64 (MVE_VAND (v2i64 MQPR:$val1), (v2i64 MQPR:$val2)))>;
1105 def : Pat<(v16i8 (or (v16i8 MQPR:$val1), (v16i8 MQPR:$val2))),
1106 (v16i8 (MVE_VORR (v16i8 MQPR:$val1), (v16i8 MQPR:$val2)))>;
1107 def : Pat<(v8i16 (or (v8i16 MQPR:$val1), (v8i16 MQPR:$val2))),
1108 (v8i16 (MVE_VORR (v8i16 MQPR:$val1), (v8i16 MQPR:$val2)))>;
1109 def : Pat<(v4i32 (or (v4i32 MQPR:$val1), (v4i32 MQPR:$val2))),
1110 (v4i32 (MVE_VORR (v4i32 MQPR:$val1), (v4i32 MQPR:$val2)))>;
1111 def : Pat<(v2i64 (or (v2i64 MQPR:$val1), (v2i64 MQPR:$val2))),
1112 (v2i64 (MVE_VORR (v2i64 MQPR:$val1), (v2i64 MQPR:$val2)))>;
1114 def : Pat<(v16i8 (xor (v16i8 MQPR:$val1), (v16i8 MQPR:$val2))),
1115 (v16i8 (MVE_VEOR (v16i8 MQPR:$val1), (v16i8 MQPR:$val2)))>;
1116 def : Pat<(v8i16 (xor (v8i16 MQPR:$val1), (v8i16 MQPR:$val2))),
1117 (v8i16 (MVE_VEOR (v8i16 MQPR:$val1), (v8i16 MQPR:$val2)))>;
1118 def : Pat<(v4i32 (xor (v4i32 MQPR:$val1), (v4i32 MQPR:$val2))),
1119 (v4i32 (MVE_VEOR (v4i32 MQPR:$val1), (v4i32 MQPR:$val2)))>;
1120 def : Pat<(v2i64 (xor (v2i64 MQPR:$val1), (v2i64 MQPR:$val2))),
1121 (v2i64 (MVE_VEOR (v2i64 MQPR:$val1), (v2i64 MQPR:$val2)))>;
1123 def : Pat<(v16i8 (and (v16i8 MQPR:$val1), (vnotq MQPR:$val2))),
1124 (v16i8 (MVE_VBIC (v16i8 MQPR:$val1), (v16i8 MQPR:$val2)))>;
1125 def : Pat<(v8i16 (and (v8i16 MQPR:$val1), (vnotq MQPR:$val2))),
1126 (v8i16 (MVE_VBIC (v8i16 MQPR:$val1), (v8i16 MQPR:$val2)))>;
1127 def : Pat<(v4i32 (and (v4i32 MQPR:$val1), (vnotq MQPR:$val2))),
1128 (v4i32 (MVE_VBIC (v4i32 MQPR:$val1), (v4i32 MQPR:$val2)))>;
1129 def : Pat<(v2i64 (and (v2i64 MQPR:$val1), (vnotq MQPR:$val2))),
1130 (v2i64 (MVE_VBIC (v2i64 MQPR:$val1), (v2i64 MQPR:$val2)))>;
1132 def : Pat<(v16i8 (or (v16i8 MQPR:$val1), (vnotq MQPR:$val2))),
1133 (v16i8 (MVE_VORN (v16i8 MQPR:$val1), (v16i8 MQPR:$val2)))>;
1134 def : Pat<(v8i16 (or (v8i16 MQPR:$val1), (vnotq MQPR:$val2))),
1135 (v8i16 (MVE_VORN (v8i16 MQPR:$val1), (v8i16 MQPR:$val2)))>;
1136 def : Pat<(v4i32 (or (v4i32 MQPR:$val1), (vnotq MQPR:$val2))),
1137 (v4i32 (MVE_VORN (v4i32 MQPR:$val1), (v4i32 MQPR:$val2)))>;
1138 def : Pat<(v2i64 (or (v2i64 MQPR:$val1), (vnotq MQPR:$val2))),
1139 (v2i64 (MVE_VORN (v2i64 MQPR:$val1), (v2i64 MQPR:$val2)))>;
1142 class MVE_bit_cmode<string iname, string suffix, bits<4> cmode, dag inOps>
1143 : MVE_p<(outs MQPR:$Qd), inOps, NoItinerary,
1144 iname, suffix, "$Qd, $imm", vpred_n, "$Qd = $Qd_src"> {
1148 let Inst{28} = imm{7};
1149 let Inst{27-23} = 0b11111;
1150 let Inst{22} = Qd{3};
1151 let Inst{21-19} = 0b000;
1152 let Inst{18-16} = imm{6-4};
1153 let Inst{15-13} = Qd{2-0};
1155 let Inst{11-8} = cmode;
1156 let Inst{7-6} = 0b01;
1158 let Inst{3-0} = imm{3-0};
1161 class MVE_VORR<string suffix, bits<4> cmode, ExpandImm imm_type>
1162 : MVE_bit_cmode<"vorr", suffix, cmode, (ins MQPR:$Qd_src, imm_type:$imm)> {
1166 def MVE_VORRIZ0v4i32 : MVE_VORR<"i32", 0b0001, expzero00>;
1167 def MVE_VORRIZ0v8i16 : MVE_VORR<"i16", 0b1001, expzero00>;
1168 def MVE_VORRIZ8v4i32 : MVE_VORR<"i32", 0b0011, expzero08>;
1169 def MVE_VORRIZ8v8i16 : MVE_VORR<"i16", 0b1011, expzero08>;
1170 def MVE_VORRIZ16v4i32 : MVE_VORR<"i32", 0b0101, expzero16>;
1171 def MVE_VORRIZ24v4i32 : MVE_VORR<"i32", 0b0111, expzero24>;
1173 def MVE_VORNIZ0v4i32 : MVEAsmPseudo<"vorn${vp}.i32\t$Qd, $imm",
1174 (ins MQPR:$Qd_src, expzero00inv32:$imm, vpred_n:$vp), (outs MQPR:$Qd)>;
1175 def MVE_VORNIZ0v8i16 : MVEAsmPseudo<"vorn${vp}.i16\t$Qd, $imm",
1176 (ins MQPR:$Qd_src, expzero00inv16:$imm, vpred_n:$vp), (outs MQPR:$Qd)>;
1177 def MVE_VORNIZ8v4i32 : MVEAsmPseudo<"vorn${vp}.i32\t$Qd, $imm",
1178 (ins MQPR:$Qd_src, expzero08inv32:$imm, vpred_n:$vp), (outs MQPR:$Qd)>;
1179 def MVE_VORNIZ8v8i16 : MVEAsmPseudo<"vorn${vp}.i16\t$Qd, $imm",
1180 (ins MQPR:$Qd_src, expzero08inv16:$imm, vpred_n:$vp), (outs MQPR:$Qd)>;
1181 def MVE_VORNIZ16v4i32 : MVEAsmPseudo<"vorn${vp}.i32\t$Qd, $imm",
1182 (ins MQPR:$Qd_src, expzero16inv32:$imm, vpred_n:$vp), (outs MQPR:$Qd)>;
1183 def MVE_VORNIZ24v4i32 : MVEAsmPseudo<"vorn${vp}.i32\t$Qd, $imm",
1184 (ins MQPR:$Qd_src, expzero24inv32:$imm, vpred_n:$vp), (outs MQPR:$Qd)>;
1186 def MVE_VMOV : MVEInstAlias<"vmov${vp}\t$Qd, $Qm",
1187 (MVE_VORR MQPR:$Qd, MQPR:$Qm, MQPR:$Qm, vpred_r:$vp)>;
1189 class MVE_VBIC<string suffix, bits<4> cmode, ExpandImm imm_type>
1190 : MVE_bit_cmode<"vbic", suffix, cmode, (ins MQPR:$Qd_src, imm_type:$imm)> {
1194 def MVE_VBICIZ0v4i32 : MVE_VBIC<"i32", 0b0001, expzero00>;
1195 def MVE_VBICIZ0v8i16 : MVE_VBIC<"i16", 0b1001, expzero00>;
1196 def MVE_VBICIZ8v4i32 : MVE_VBIC<"i32", 0b0011, expzero08>;
1197 def MVE_VBICIZ8v8i16 : MVE_VBIC<"i16", 0b1011, expzero08>;
1198 def MVE_VBICIZ16v4i32 : MVE_VBIC<"i32", 0b0101, expzero16>;
1199 def MVE_VBICIZ24v4i32 : MVE_VBIC<"i32", 0b0111, expzero24>;
1201 def MVE_VANDIZ0v4i32 : MVEAsmPseudo<"vand${vp}.i32\t$Qda, $imm",
1202 (ins MQPR:$Qda_src, expzero00inv32:$imm, vpred_n:$vp), (outs MQPR:$Qda)>;
1203 def MVE_VANDIZ0v8i16 : MVEAsmPseudo<"vand${vp}.i16\t$Qda, $imm",
1204 (ins MQPR:$Qda_src, expzero00inv16:$imm, vpred_n:$vp), (outs MQPR:$Qda)>;
1205 def MVE_VANDIZ8v4i32 : MVEAsmPseudo<"vand${vp}.i32\t$Qda, $imm",
1206 (ins MQPR:$Qda_src, expzero08inv32:$imm, vpred_n:$vp), (outs MQPR:$Qda)>;
1207 def MVE_VANDIZ8v8i16 : MVEAsmPseudo<"vand${vp}.i16\t$Qda, $imm",
1208 (ins MQPR:$Qda_src, expzero08inv16:$imm, vpred_n:$vp), (outs MQPR:$Qda)>;
1209 def MVE_VANDIZ16v4i32 : MVEAsmPseudo<"vand${vp}.i32\t$Qda, $imm",
1210 (ins MQPR:$Qda_src, expzero16inv32:$imm, vpred_n:$vp), (outs MQPR:$Qda)>;
1211 def MVE_VANDIZ24v4i32 : MVEAsmPseudo<"vand${vp}.i32\t$Qda, $imm",
1212 (ins MQPR:$Qda_src, expzero24inv32:$imm, vpred_n:$vp), (outs MQPR:$Qda)>;
1214 class MVE_VMOV_lane_direction {
1221 def MVE_VMOV_from_lane : MVE_VMOV_lane_direction {
1223 let oops = (outs rGPR:$Rt);
1224 let iops = (ins MQPR:$Qd);
1225 let ops = "$Rt, $Qd$Idx";
1228 def MVE_VMOV_to_lane : MVE_VMOV_lane_direction {
1230 let oops = (outs MQPR:$Qd);
1231 let iops = (ins MQPR:$Qd_src, rGPR:$Rt);
1232 let ops = "$Qd$Idx, $Rt";
1233 let cstr = "$Qd = $Qd_src";
1236 class MVE_VMOV_lane<string suffix, bit U, dag indexop,
1237 MVE_VMOV_lane_direction dir>
1238 : MVE_VMOV_lane_base<dir.oops, !con(dir.iops, indexop), NoItinerary,
1239 "vmov", suffix, dir.ops, dir.cstr, []> {
1243 let Inst{31-24} = 0b11101110;
1245 let Inst{20} = dir.bit_20;
1246 let Inst{19-17} = Qd{2-0};
1247 let Inst{15-12} = Rt{3-0};
1248 let Inst{11-8} = 0b1011;
1249 let Inst{7} = Qd{3};
1250 let Inst{4-0} = 0b10000;
1253 class MVE_VMOV_lane_32<MVE_VMOV_lane_direction dir>
1254 : MVE_VMOV_lane<"32", 0b0, (ins MVEVectorIndex<4>:$Idx), dir> {
1257 let Inst{6-5} = 0b00;
1258 let Inst{16} = Idx{1};
1259 let Inst{21} = Idx{0};
1261 let Predicates = [HasFPRegsV8_1M];
1264 class MVE_VMOV_lane_16<string suffix, bit U, MVE_VMOV_lane_direction dir>
1265 : MVE_VMOV_lane<suffix, U, (ins MVEVectorIndex<8>:$Idx), dir> {
1269 let Inst{16} = Idx{2};
1270 let Inst{21} = Idx{1};
1271 let Inst{6} = Idx{0};
1274 class MVE_VMOV_lane_8<string suffix, bit U, MVE_VMOV_lane_direction dir>
1275 : MVE_VMOV_lane<suffix, U, (ins MVEVectorIndex<16>:$Idx), dir> {
1278 let Inst{16} = Idx{3};
1279 let Inst{21} = Idx{2};
1280 let Inst{6} = Idx{1};
1281 let Inst{5} = Idx{0};
1284 def MVE_VMOV_from_lane_32 : MVE_VMOV_lane_32< MVE_VMOV_from_lane>;
1285 def MVE_VMOV_to_lane_32 : MVE_VMOV_lane_32< MVE_VMOV_to_lane>;
1286 def MVE_VMOV_from_lane_s16 : MVE_VMOV_lane_16<"s16", 0b0, MVE_VMOV_from_lane>;
1287 def MVE_VMOV_from_lane_u16 : MVE_VMOV_lane_16<"u16", 0b1, MVE_VMOV_from_lane>;
1288 def MVE_VMOV_to_lane_16 : MVE_VMOV_lane_16< "16", 0b0, MVE_VMOV_to_lane>;
1289 def MVE_VMOV_from_lane_s8 : MVE_VMOV_lane_8 < "s8", 0b0, MVE_VMOV_from_lane>;
1290 def MVE_VMOV_from_lane_u8 : MVE_VMOV_lane_8 < "u8", 0b1, MVE_VMOV_from_lane>;
1291 def MVE_VMOV_to_lane_8 : MVE_VMOV_lane_8 < "8", 0b0, MVE_VMOV_to_lane>;
1293 let Predicates = [HasMVEInt] in {
1294 def : Pat<(extractelt (v2f64 MQPR:$src), imm:$lane),
1295 (f64 (EXTRACT_SUBREG MQPR:$src, (DSubReg_f64_reg imm:$lane)))>;
1296 def : Pat<(insertelt (v2f64 MQPR:$src1), DPR:$src2, imm:$lane),
1297 (INSERT_SUBREG (v2f64 (COPY_TO_REGCLASS MQPR:$src1, MQPR)), DPR:$src2, (DSubReg_f64_reg imm:$lane))>;
1299 def : Pat<(extractelt (v4i32 MQPR:$src), imm:$lane),
1301 (i32 (EXTRACT_SUBREG MQPR:$src, (SSubReg_f32_reg imm:$lane))), rGPR)>;
1302 def : Pat<(insertelt (v4i32 MQPR:$src1), rGPR:$src2, imm:$lane),
1303 (MVE_VMOV_to_lane_32 MQPR:$src1, rGPR:$src2, imm:$lane)>;
1305 def : Pat<(vector_insert (v16i8 MQPR:$src1), rGPR:$src2, imm:$lane),
1306 (MVE_VMOV_to_lane_8 MQPR:$src1, rGPR:$src2, imm:$lane)>;
1307 def : Pat<(vector_insert (v8i16 MQPR:$src1), rGPR:$src2, imm:$lane),
1308 (MVE_VMOV_to_lane_16 MQPR:$src1, rGPR:$src2, imm:$lane)>;
1310 def : Pat<(ARMvgetlanes (v16i8 MQPR:$src), imm:$lane),
1311 (MVE_VMOV_from_lane_s8 MQPR:$src, imm:$lane)>;
1312 def : Pat<(ARMvgetlanes (v8i16 MQPR:$src), imm:$lane),
1313 (MVE_VMOV_from_lane_s16 MQPR:$src, imm:$lane)>;
1314 def : Pat<(ARMvgetlaneu (v16i8 MQPR:$src), imm:$lane),
1315 (MVE_VMOV_from_lane_u8 MQPR:$src, imm:$lane)>;
1316 def : Pat<(ARMvgetlaneu (v8i16 MQPR:$src), imm:$lane),
1317 (MVE_VMOV_from_lane_u16 MQPR:$src, imm:$lane)>;
1319 def : Pat<(v16i8 (scalar_to_vector GPR:$src)),
1320 (MVE_VMOV_to_lane_8 (v16i8 (IMPLICIT_DEF)), rGPR:$src, (i32 0))>;
1321 def : Pat<(v8i16 (scalar_to_vector GPR:$src)),
1322 (MVE_VMOV_to_lane_16 (v8i16 (IMPLICIT_DEF)), rGPR:$src, (i32 0))>;
1323 def : Pat<(v4i32 (scalar_to_vector GPR:$src)),
1324 (MVE_VMOV_to_lane_32 (v4i32 (IMPLICIT_DEF)), rGPR:$src, (i32 0))>;
1326 // Floating point patterns, still enabled under HasMVEInt
1327 def : Pat<(extractelt (v4f32 MQPR:$src), imm:$lane),
1328 (COPY_TO_REGCLASS (f32 (EXTRACT_SUBREG MQPR:$src, (SSubReg_f32_reg imm:$lane))), SPR)>;
1329 def : Pat<(insertelt (v4f32 MQPR:$src1), (f32 SPR:$src2), imm:$lane),
1330 (INSERT_SUBREG (v4f32 (COPY_TO_REGCLASS MQPR:$src1, MQPR)), SPR:$src2, (SSubReg_f32_reg imm:$lane))>;
1332 def : Pat<(insertelt (v8f16 MQPR:$src1), HPR:$src2, imm:$lane),
1333 (MVE_VMOV_to_lane_16 MQPR:$src1, (COPY_TO_REGCLASS HPR:$src2, rGPR), imm:$lane)>;
1334 def : Pat<(extractelt (v8f16 MQPR:$src), imm:$lane),
1335 (COPY_TO_REGCLASS (MVE_VMOV_from_lane_u16 MQPR:$src, imm:$lane), HPR)>;
1337 def : Pat<(v4f32 (scalar_to_vector SPR:$src)),
1338 (INSERT_SUBREG (v4f32 (IMPLICIT_DEF)), SPR:$src, ssub_0)>;
1339 def : Pat<(v4f32 (scalar_to_vector GPR:$src)),
1340 (MVE_VMOV_to_lane_32 (v4f32 (IMPLICIT_DEF)), rGPR:$src, (i32 0))>;
1341 def : Pat<(v8f16 (scalar_to_vector HPR:$src)),
1342 (INSERT_SUBREG (v8f16 (IMPLICIT_DEF)), HPR:$src, ssub_0)>;
1343 def : Pat<(v8f16 (scalar_to_vector GPR:$src)),
1344 (MVE_VMOV_to_lane_16 (v8f16 (IMPLICIT_DEF)), rGPR:$src, (i32 0))>;
1347 // end of mve_bit instructions
1349 // start of MVE Integer instructions
1351 class MVE_int<string iname, string suffix, bits<2> size, list<dag> pattern=[]>
1352 : MVE_p<(outs MQPR:$Qd), (ins MQPR:$Qn, MQPR:$Qm), NoItinerary,
1353 iname, suffix, "$Qd, $Qn, $Qm", vpred_r, "", pattern> {
1358 let Inst{22} = Qd{3};
1359 let Inst{21-20} = size;
1360 let Inst{19-17} = Qn{2-0};
1361 let Inst{15-13} = Qd{2-0};
1362 let Inst{7} = Qn{3};
1364 let Inst{5} = Qm{3};
1365 let Inst{3-1} = Qm{2-0};
1368 class MVE_VMULt1<string suffix, bits<2> size, list<dag> pattern=[]>
1369 : MVE_int<"vmul", suffix, size, pattern> {
1372 let Inst{25-23} = 0b110;
1374 let Inst{12-8} = 0b01001;
1379 def MVE_VMULt1i8 : MVE_VMULt1<"i8", 0b00>;
1380 def MVE_VMULt1i16 : MVE_VMULt1<"i16", 0b01>;
1381 def MVE_VMULt1i32 : MVE_VMULt1<"i32", 0b10>;
1383 let Predicates = [HasMVEInt] in {
1384 def : Pat<(v16i8 (mul (v16i8 MQPR:$val1), (v16i8 MQPR:$val2))),
1385 (v16i8 (MVE_VMULt1i8 (v16i8 MQPR:$val1), (v16i8 MQPR:$val2)))>;
1386 def : Pat<(v8i16 (mul (v8i16 MQPR:$val1), (v8i16 MQPR:$val2))),
1387 (v8i16 (MVE_VMULt1i16 (v8i16 MQPR:$val1), (v8i16 MQPR:$val2)))>;
1388 def : Pat<(v4i32 (mul (v4i32 MQPR:$val1), (v4i32 MQPR:$val2))),
1389 (v4i32 (MVE_VMULt1i32 (v4i32 MQPR:$val1), (v4i32 MQPR:$val2)))>;
1392 class MVE_VQxDMULH<string iname, string suffix, bits<2> size, bit rounding,
1393 list<dag> pattern=[]>
1394 : MVE_int<iname, suffix, size, pattern> {
1396 let Inst{28} = rounding;
1397 let Inst{25-23} = 0b110;
1399 let Inst{12-8} = 0b01011;
1404 class MVE_VQDMULH<string suffix, bits<2> size, list<dag> pattern=[]>
1405 : MVE_VQxDMULH<"vqdmulh", suffix, size, 0b0, pattern>;
1406 class MVE_VQRDMULH<string suffix, bits<2> size, list<dag> pattern=[]>
1407 : MVE_VQxDMULH<"vqrdmulh", suffix, size, 0b1, pattern>;
1409 def MVE_VQDMULHi8 : MVE_VQDMULH<"s8", 0b00>;
1410 def MVE_VQDMULHi16 : MVE_VQDMULH<"s16", 0b01>;
1411 def MVE_VQDMULHi32 : MVE_VQDMULH<"s32", 0b10>;
1413 def MVE_VQRDMULHi8 : MVE_VQRDMULH<"s8", 0b00>;
1414 def MVE_VQRDMULHi16 : MVE_VQRDMULH<"s16", 0b01>;
1415 def MVE_VQRDMULHi32 : MVE_VQRDMULH<"s32", 0b10>;
1417 class MVE_VADDSUB<string iname, string suffix, bits<2> size, bit subtract,
1418 list<dag> pattern=[]>
1419 : MVE_int<iname, suffix, size, pattern> {
1421 let Inst{28} = subtract;
1422 let Inst{25-23} = 0b110;
1424 let Inst{12-8} = 0b01000;
1429 class MVE_VADD<string suffix, bits<2> size, list<dag> pattern=[]>
1430 : MVE_VADDSUB<"vadd", suffix, size, 0b0, pattern>;
1431 class MVE_VSUB<string suffix, bits<2> size, list<dag> pattern=[]>
1432 : MVE_VADDSUB<"vsub", suffix, size, 0b1, pattern>;
1434 def MVE_VADDi8 : MVE_VADD<"i8", 0b00>;
1435 def MVE_VADDi16 : MVE_VADD<"i16", 0b01>;
1436 def MVE_VADDi32 : MVE_VADD<"i32", 0b10>;
1438 let Predicates = [HasMVEInt] in {
1439 def : Pat<(v16i8 (add (v16i8 MQPR:$val1), (v16i8 MQPR:$val2))),
1440 (v16i8 (MVE_VADDi8 (v16i8 MQPR:$val1), (v16i8 MQPR:$val2)))>;
1441 def : Pat<(v8i16 (add (v8i16 MQPR:$val1), (v8i16 MQPR:$val2))),
1442 (v8i16 (MVE_VADDi16 (v8i16 MQPR:$val1), (v8i16 MQPR:$val2)))>;
1443 def : Pat<(v4i32 (add (v4i32 MQPR:$val1), (v4i32 MQPR:$val2))),
1444 (v4i32 (MVE_VADDi32 (v4i32 MQPR:$val1), (v4i32 MQPR:$val2)))>;
1447 def MVE_VSUBi8 : MVE_VSUB<"i8", 0b00>;
1448 def MVE_VSUBi16 : MVE_VSUB<"i16", 0b01>;
1449 def MVE_VSUBi32 : MVE_VSUB<"i32", 0b10>;
1451 let Predicates = [HasMVEInt] in {
1452 def : Pat<(v16i8 (sub (v16i8 MQPR:$val1), (v16i8 MQPR:$val2))),
1453 (v16i8 (MVE_VSUBi8 (v16i8 MQPR:$val1), (v16i8 MQPR:$val2)))>;
1454 def : Pat<(v8i16 (sub (v8i16 MQPR:$val1), (v8i16 MQPR:$val2))),
1455 (v8i16 (MVE_VSUBi16 (v8i16 MQPR:$val1), (v8i16 MQPR:$val2)))>;
1456 def : Pat<(v4i32 (sub (v4i32 MQPR:$val1), (v4i32 MQPR:$val2))),
1457 (v4i32 (MVE_VSUBi32 (v4i32 MQPR:$val1), (v4i32 MQPR:$val2)))>;
1460 class MVE_VQADDSUB<string iname, string suffix, bit U, bit subtract,
1461 bits<2> size, list<dag> pattern=[]>
1462 : MVE_int<iname, suffix, size, pattern> {
1465 let Inst{25-23} = 0b110;
1467 let Inst{12-10} = 0b000;
1468 let Inst{9} = subtract;
1474 class MVE_VQADD<string suffix, bit U, bits<2> size, list<dag> pattern=[]>
1475 : MVE_VQADDSUB<"vqadd", suffix, U, 0b0, size, pattern>;
1476 class MVE_VQSUB<string suffix, bit U, bits<2> size, list<dag> pattern=[]>
1477 : MVE_VQADDSUB<"vqsub", suffix, U, 0b1, size, pattern>;
1479 def MVE_VQADDs8 : MVE_VQADD<"s8", 0b0, 0b00>;
1480 def MVE_VQADDs16 : MVE_VQADD<"s16", 0b0, 0b01>;
1481 def MVE_VQADDs32 : MVE_VQADD<"s32", 0b0, 0b10>;
1482 def MVE_VQADDu8 : MVE_VQADD<"u8", 0b1, 0b00>;
1483 def MVE_VQADDu16 : MVE_VQADD<"u16", 0b1, 0b01>;
1484 def MVE_VQADDu32 : MVE_VQADD<"u32", 0b1, 0b10>;
1486 def MVE_VQSUBs8 : MVE_VQSUB<"s8", 0b0, 0b00>;
1487 def MVE_VQSUBs16 : MVE_VQSUB<"s16", 0b0, 0b01>;
1488 def MVE_VQSUBs32 : MVE_VQSUB<"s32", 0b0, 0b10>;
1489 def MVE_VQSUBu8 : MVE_VQSUB<"u8", 0b1, 0b00>;
1490 def MVE_VQSUBu16 : MVE_VQSUB<"u16", 0b1, 0b01>;
1491 def MVE_VQSUBu32 : MVE_VQSUB<"u32", 0b1, 0b10>;
1493 class MVE_VABD_int<string suffix, bit U, bits<2> size, list<dag> pattern=[]>
1494 : MVE_int<"vabd", suffix, size, pattern> {
1497 let Inst{25-23} = 0b110;
1499 let Inst{12-8} = 0b00111;
1504 def MVE_VABDs8 : MVE_VABD_int<"s8", 0b0, 0b00>;
1505 def MVE_VABDs16 : MVE_VABD_int<"s16", 0b0, 0b01>;
1506 def MVE_VABDs32 : MVE_VABD_int<"s32", 0b0, 0b10>;
1507 def MVE_VABDu8 : MVE_VABD_int<"u8", 0b1, 0b00>;
1508 def MVE_VABDu16 : MVE_VABD_int<"u16", 0b1, 0b01>;
1509 def MVE_VABDu32 : MVE_VABD_int<"u32", 0b1, 0b10>;
1511 class MVE_VRHADD<string suffix, bit U, bits<2> size, list<dag> pattern=[]>
1512 : MVE_int<"vrhadd", suffix, size, pattern> {
1515 let Inst{25-23} = 0b110;
1517 let Inst{12-8} = 0b00001;
1522 def MVE_VRHADDs8 : MVE_VRHADD<"s8", 0b0, 0b00>;
1523 def MVE_VRHADDs16 : MVE_VRHADD<"s16", 0b0, 0b01>;
1524 def MVE_VRHADDs32 : MVE_VRHADD<"s32", 0b0, 0b10>;
1525 def MVE_VRHADDu8 : MVE_VRHADD<"u8", 0b1, 0b00>;
1526 def MVE_VRHADDu16 : MVE_VRHADD<"u16", 0b1, 0b01>;
1527 def MVE_VRHADDu32 : MVE_VRHADD<"u32", 0b1, 0b10>;
1529 class MVE_VHADDSUB<string iname, string suffix, bit U, bit subtract,
1530 bits<2> size, list<dag> pattern=[]>
1531 : MVE_int<iname, suffix, size, pattern> {
1534 let Inst{25-23} = 0b110;
1536 let Inst{12-10} = 0b000;
1537 let Inst{9} = subtract;
1543 class MVE_VHADD<string suffix, bit U, bits<2> size,
1544 list<dag> pattern=[]>
1545 : MVE_VHADDSUB<"vhadd", suffix, U, 0b0, size, pattern>;
1546 class MVE_VHSUB<string suffix, bit U, bits<2> size,
1547 list<dag> pattern=[]>
1548 : MVE_VHADDSUB<"vhsub", suffix, U, 0b1, size, pattern>;
1550 def MVE_VHADDs8 : MVE_VHADD<"s8", 0b0, 0b00>;
1551 def MVE_VHADDs16 : MVE_VHADD<"s16", 0b0, 0b01>;
1552 def MVE_VHADDs32 : MVE_VHADD<"s32", 0b0, 0b10>;
1553 def MVE_VHADDu8 : MVE_VHADD<"u8", 0b1, 0b00>;
1554 def MVE_VHADDu16 : MVE_VHADD<"u16", 0b1, 0b01>;
1555 def MVE_VHADDu32 : MVE_VHADD<"u32", 0b1, 0b10>;
1557 def MVE_VHSUBs8 : MVE_VHSUB<"s8", 0b0, 0b00>;
1558 def MVE_VHSUBs16 : MVE_VHSUB<"s16", 0b0, 0b01>;
1559 def MVE_VHSUBs32 : MVE_VHSUB<"s32", 0b0, 0b10>;
1560 def MVE_VHSUBu8 : MVE_VHSUB<"u8", 0b1, 0b00>;
1561 def MVE_VHSUBu16 : MVE_VHSUB<"u16", 0b1, 0b01>;
1562 def MVE_VHSUBu32 : MVE_VHSUB<"u32", 0b1, 0b10>;
1564 class MVE_VDUP<string suffix, bit B, bit E, list<dag> pattern=[]>
1565 : MVE_p<(outs MQPR:$Qd), (ins rGPR:$Rt), NoItinerary,
1566 "vdup", suffix, "$Qd, $Rt", vpred_r, "", pattern> {
1571 let Inst{25-23} = 0b101;
1573 let Inst{21-20} = 0b10;
1574 let Inst{19-17} = Qd{2-0};
1576 let Inst{15-12} = Rt;
1577 let Inst{11-8} = 0b1011;
1578 let Inst{7} = Qd{3};
1581 let Inst{4-0} = 0b10000;
1584 def MVE_VDUP32 : MVE_VDUP<"32", 0b0, 0b0>;
1585 def MVE_VDUP16 : MVE_VDUP<"16", 0b0, 0b1>;
1586 def MVE_VDUP8 : MVE_VDUP<"8", 0b1, 0b0>;
1588 let Predicates = [HasMVEInt] in {
1589 def : Pat<(v16i8 (ARMvdup (i32 rGPR:$elem))),
1590 (MVE_VDUP8 rGPR:$elem)>;
1591 def : Pat<(v8i16 (ARMvdup (i32 rGPR:$elem))),
1592 (MVE_VDUP16 rGPR:$elem)>;
1593 def : Pat<(v4i32 (ARMvdup (i32 rGPR:$elem))),
1594 (MVE_VDUP32 rGPR:$elem)>;
1596 def : Pat<(v4i32 (ARMvduplane (v4i32 MQPR:$src), imm:$lane)),
1597 (MVE_VDUP32 (MVE_VMOV_from_lane_32 MQPR:$src, imm:$lane))>;
1598 // For the 16-bit and 8-bit vduplanes we don't care about the signedness
1599 // of the lane move operation as we only want the lowest 8/16 bits anyway.
1600 def : Pat<(v8i16 (ARMvduplane (v8i16 MQPR:$src), imm:$lane)),
1601 (MVE_VDUP16 (MVE_VMOV_from_lane_u16 MQPR:$src, imm:$lane))>;
1602 def : Pat<(v16i8 (ARMvduplane (v16i8 MQPR:$src), imm:$lane)),
1603 (MVE_VDUP8 (MVE_VMOV_from_lane_u8 MQPR:$src, imm:$lane))>;
1605 def : Pat<(v4f32 (ARMvdup (f32 SPR:$elem))),
1606 (v4f32 (MVE_VDUP32 (i32 (COPY_TO_REGCLASS (f32 SPR:$elem), rGPR))))>;
1607 def : Pat<(v8f16 (ARMvdup (f16 HPR:$elem))),
1608 (v8f16 (MVE_VDUP16 (i32 (COPY_TO_REGCLASS (f16 HPR:$elem), rGPR))))>;
1610 def : Pat<(v4f32 (ARMvduplane (v4f32 MQPR:$src), imm:$lane)),
1611 (MVE_VDUP32 (MVE_VMOV_from_lane_32 MQPR:$src, imm:$lane))>;
1612 def : Pat<(v8f16 (ARMvduplane (v8f16 MQPR:$src), imm:$lane)),
1613 (MVE_VDUP16 (MVE_VMOV_from_lane_u16 MQPR:$src, imm:$lane))>;
1617 class MVEIntSingleSrc<string iname, string suffix, bits<2> size,
1618 list<dag> pattern=[]>
1619 : MVE_p<(outs MQPR:$Qd), (ins MQPR:$Qm), NoItinerary,
1620 iname, suffix, "$Qd, $Qm", vpred_r, "", pattern> {
1624 let Inst{22} = Qd{3};
1625 let Inst{19-18} = size{1-0};
1626 let Inst{15-13} = Qd{2-0};
1627 let Inst{5} = Qm{3};
1628 let Inst{3-1} = Qm{2-0};
1631 class MVE_VCLSCLZ<string iname, string suffix, bits<2> size,
1632 bit count_zeroes, list<dag> pattern=[]>
1633 : MVEIntSingleSrc<iname, suffix, size, pattern> {
1636 let Inst{25-23} = 0b111;
1637 let Inst{21-20} = 0b11;
1638 let Inst{17-16} = 0b00;
1639 let Inst{12-8} = 0b00100;
1640 let Inst{7} = count_zeroes;
1646 def MVE_VCLSs8 : MVE_VCLSCLZ<"vcls", "s8", 0b00, 0b0>;
1647 def MVE_VCLSs16 : MVE_VCLSCLZ<"vcls", "s16", 0b01, 0b0>;
1648 def MVE_VCLSs32 : MVE_VCLSCLZ<"vcls", "s32", 0b10, 0b0>;
1650 def MVE_VCLZs8 : MVE_VCLSCLZ<"vclz", "i8", 0b00, 0b1>;
1651 def MVE_VCLZs16 : MVE_VCLSCLZ<"vclz", "i16", 0b01, 0b1>;
1652 def MVE_VCLZs32 : MVE_VCLSCLZ<"vclz", "i32", 0b10, 0b1>;
1654 class MVE_VABSNEG_int<string iname, string suffix, bits<2> size, bit negate,
1655 list<dag> pattern=[]>
1656 : MVEIntSingleSrc<iname, suffix, size, pattern> {
1659 let Inst{25-23} = 0b111;
1660 let Inst{21-20} = 0b11;
1661 let Inst{17-16} = 0b01;
1662 let Inst{12-8} = 0b00011;
1663 let Inst{7} = negate;
1669 def MVE_VABSs8 : MVE_VABSNEG_int<"vabs", "s8", 0b00, 0b0>;
1670 def MVE_VABSs16 : MVE_VABSNEG_int<"vabs", "s16", 0b01, 0b0>;
1671 def MVE_VABSs32 : MVE_VABSNEG_int<"vabs", "s32", 0b10, 0b0>;
1673 let Predicates = [HasMVEInt] in {
1674 def : Pat<(v16i8 (abs (v16i8 MQPR:$v))),
1675 (v16i8 (MVE_VABSs8 $v))>;
1676 def : Pat<(v8i16 (abs (v8i16 MQPR:$v))),
1677 (v8i16 (MVE_VABSs16 $v))>;
1678 def : Pat<(v4i32 (abs (v4i32 MQPR:$v))),
1679 (v4i32 (MVE_VABSs32 $v))>;
1682 def MVE_VNEGs8 : MVE_VABSNEG_int<"vneg", "s8", 0b00, 0b1>;
1683 def MVE_VNEGs16 : MVE_VABSNEG_int<"vneg", "s16", 0b01, 0b1>;
1684 def MVE_VNEGs32 : MVE_VABSNEG_int<"vneg", "s32", 0b10, 0b1>;
1686 let Predicates = [HasMVEInt] in {
1687 def : Pat<(v16i8 (vnegq (v16i8 MQPR:$v))),
1688 (v16i8 (MVE_VNEGs8 $v))>;
1689 def : Pat<(v8i16 (vnegq (v8i16 MQPR:$v))),
1690 (v8i16 (MVE_VNEGs16 $v))>;
1691 def : Pat<(v4i32 (vnegq (v4i32 MQPR:$v))),
1692 (v4i32 (MVE_VNEGs32 $v))>;
1695 class MVE_VQABSNEG<string iname, string suffix, bits<2> size,
1696 bit negate, list<dag> pattern=[]>
1697 : MVEIntSingleSrc<iname, suffix, size, pattern> {
1700 let Inst{25-23} = 0b111;
1701 let Inst{21-20} = 0b11;
1702 let Inst{17-16} = 0b00;
1703 let Inst{12-8} = 0b00111;
1704 let Inst{7} = negate;
1710 def MVE_VQABSs8 : MVE_VQABSNEG<"vqabs", "s8", 0b00, 0b0>;
1711 def MVE_VQABSs16 : MVE_VQABSNEG<"vqabs", "s16", 0b01, 0b0>;
1712 def MVE_VQABSs32 : MVE_VQABSNEG<"vqabs", "s32", 0b10, 0b0>;
1714 def MVE_VQNEGs8 : MVE_VQABSNEG<"vqneg", "s8", 0b00, 0b1>;
1715 def MVE_VQNEGs16 : MVE_VQABSNEG<"vqneg", "s16", 0b01, 0b1>;
1716 def MVE_VQNEGs32 : MVE_VQABSNEG<"vqneg", "s32", 0b10, 0b1>;
1718 class MVE_mod_imm<string iname, string suffix, bits<4> cmode, bit op,
1719 dag iops, list<dag> pattern=[]>
1720 : MVE_p<(outs MQPR:$Qd), iops, NoItinerary, iname, suffix, "$Qd, $imm",
1721 vpred_r, "", pattern> {
1725 let Inst{28} = imm{7};
1726 let Inst{25-23} = 0b111;
1727 let Inst{22} = Qd{3};
1728 let Inst{21-19} = 0b000;
1729 let Inst{18-16} = imm{6-4};
1730 let Inst{15-13} = Qd{2-0};
1732 let Inst{11-8} = cmode{3-0};
1733 let Inst{7-6} = 0b01;
1736 let Inst{3-0} = imm{3-0};
1738 let DecoderMethod = "DecodeMVEModImmInstruction";
1741 let isReMaterializable = 1 in {
1742 let isAsCheapAsAMove = 1 in {
1743 def MVE_VMOVimmi8 : MVE_mod_imm<"vmov", "i8", {1,1,1,0}, 0b0, (ins nImmSplatI8:$imm)>;
1744 def MVE_VMOVimmi16 : MVE_mod_imm<"vmov", "i16", {1,0,?,0}, 0b0, (ins nImmSplatI16:$imm)> {
1745 let Inst{9} = imm{9};
1747 def MVE_VMOVimmi32 : MVE_mod_imm<"vmov", "i32", {?,?,?,?}, 0b0, (ins nImmVMOVI32:$imm)> {
1748 let Inst{11-8} = imm{11-8};
1750 def MVE_VMOVimmi64 : MVE_mod_imm<"vmov", "i64", {1,1,1,0}, 0b1, (ins nImmSplatI64:$imm)>;
1751 def MVE_VMOVimmf32 : MVE_mod_imm<"vmov", "f32", {1,1,1,1}, 0b0, (ins nImmVMOVF32:$imm)>;
1752 } // let isAsCheapAsAMove = 1
1754 def MVE_VMVNimmi16 : MVE_mod_imm<"vmvn", "i16", {1,0,?,0}, 0b1, (ins nImmSplatI16:$imm)> {
1755 let Inst{9} = imm{9};
1757 def MVE_VMVNimmi32 : MVE_mod_imm<"vmvn", "i32", {?,?,?,?}, 0b1, (ins nImmVMOVI32:$imm)> {
1758 let Inst{11-8} = imm{11-8};
1760 } // let isReMaterializable = 1
1762 let Predicates = [HasMVEInt] in {
1763 def : Pat<(v16i8 (ARMvmovImm timm:$simm)),
1764 (v16i8 (MVE_VMOVimmi8 nImmSplatI8:$simm))>;
1765 def : Pat<(v8i16 (ARMvmovImm timm:$simm)),
1766 (v8i16 (MVE_VMOVimmi16 nImmSplatI16:$simm))>;
1767 def : Pat<(v4i32 (ARMvmovImm timm:$simm)),
1768 (v4i32 (MVE_VMOVimmi32 nImmVMOVI32:$simm))>;
1770 def : Pat<(v8i16 (ARMvmvnImm timm:$simm)),
1771 (v8i16 (MVE_VMVNimmi16 nImmSplatI16:$simm))>;
1772 def : Pat<(v4i32 (ARMvmvnImm timm:$simm)),
1773 (v4i32 (MVE_VMVNimmi32 nImmVMOVI32:$simm))>;
1775 def : Pat<(v4f32 (ARMvmovFPImm timm:$simm)),
1776 (v4f32 (MVE_VMOVimmf32 nImmVMOVF32:$simm))>;
1779 class MVE_VMINMAXA<string iname, string suffix, bits<2> size,
1780 bit bit_12, list<dag> pattern=[]>
1781 : MVE_p<(outs MQPR:$Qd), (ins MQPR:$Qd_src, MQPR:$Qm),
1782 NoItinerary, iname, suffix, "$Qd, $Qm", vpred_n, "$Qd = $Qd_src",
1788 let Inst{25-23} = 0b100;
1789 let Inst{22} = Qd{3};
1790 let Inst{21-20} = 0b11;
1791 let Inst{19-18} = size;
1792 let Inst{17-16} = 0b11;
1793 let Inst{15-13} = Qd{2-0};
1794 let Inst{12} = bit_12;
1795 let Inst{11-6} = 0b111010;
1796 let Inst{5} = Qm{3};
1798 let Inst{3-1} = Qm{2-0};
1802 def MVE_VMAXAs8 : MVE_VMINMAXA<"vmaxa", "s8", 0b00, 0b0>;
1803 def MVE_VMAXAs16 : MVE_VMINMAXA<"vmaxa", "s16", 0b01, 0b0>;
1804 def MVE_VMAXAs32 : MVE_VMINMAXA<"vmaxa", "s32", 0b10, 0b0>;
1806 def MVE_VMINAs8 : MVE_VMINMAXA<"vmina", "s8", 0b00, 0b1>;
1807 def MVE_VMINAs16 : MVE_VMINMAXA<"vmina", "s16", 0b01, 0b1>;
1808 def MVE_VMINAs32 : MVE_VMINMAXA<"vmina", "s32", 0b10, 0b1>;
1810 // end of MVE Integer instructions
1812 // start of mve_imm_shift instructions
1814 def MVE_VSHLC : MVE_p<(outs rGPR:$RdmDest, MQPR:$Qd),
1815 (ins MQPR:$QdSrc, rGPR:$RdmSrc, long_shift:$imm),
1816 NoItinerary, "vshlc", "", "$QdSrc, $RdmSrc, $imm",
1817 vpred_n, "$RdmDest = $RdmSrc,$Qd = $QdSrc"> {
1823 let Inst{25-23} = 0b101;
1824 let Inst{22} = Qd{3};
1826 let Inst{20-16} = imm{4-0};
1827 let Inst{15-13} = Qd{2-0};
1828 let Inst{12-4} = 0b011111100;
1829 let Inst{3-0} = RdmDest{3-0};
1832 class MVE_shift_imm<dag oops, dag iops, string iname, string suffix,
1833 string ops, vpred_ops vpred, string cstr,
1834 list<dag> pattern=[]>
1835 : MVE_p<oops, iops, NoItinerary, iname, suffix, ops, vpred, cstr, pattern> {
1839 let Inst{22} = Qd{3};
1840 let Inst{15-13} = Qd{2-0};
1841 let Inst{5} = Qm{3};
1842 let Inst{3-1} = Qm{2-0};
1845 class MVE_VMOVL<string iname, string suffix, bits<2> sz, bit U,
1846 list<dag> pattern=[]>
1847 : MVE_shift_imm<(outs MQPR:$Qd), (ins MQPR:$Qm),
1848 iname, suffix, "$Qd, $Qm", vpred_r, "",
1851 let Inst{25-23} = 0b101;
1853 let Inst{20-19} = sz{1-0};
1854 let Inst{18-16} = 0b000;
1855 let Inst{11-6} = 0b111101;
1860 multiclass MVE_VMOVL_shift_half<string iname, string suffix, bits<2> sz, bit U,
1861 list<dag> pattern=[]> {
1862 def bh : MVE_VMOVL<!strconcat(iname, "b"), suffix, sz, U, pattern> {
1865 def th : MVE_VMOVL<!strconcat(iname, "t"), suffix, sz, U, pattern> {
1870 defm MVE_VMOVLs8 : MVE_VMOVL_shift_half<"vmovl", "s8", 0b01, 0b0>;
1871 defm MVE_VMOVLu8 : MVE_VMOVL_shift_half<"vmovl", "u8", 0b01, 0b1>;
1872 defm MVE_VMOVLs16 : MVE_VMOVL_shift_half<"vmovl", "s16", 0b10, 0b0>;
1873 defm MVE_VMOVLu16 : MVE_VMOVL_shift_half<"vmovl", "u16", 0b10, 0b1>;
1875 let Predicates = [HasMVEInt] in {
1876 def : Pat<(sext_inreg (v4i32 MQPR:$src), v4i16),
1877 (MVE_VMOVLs16bh MQPR:$src)>;
1878 def : Pat<(sext_inreg (v8i16 MQPR:$src), v8i8),
1879 (MVE_VMOVLs8bh MQPR:$src)>;
1880 def : Pat<(sext_inreg (v4i32 MQPR:$src), v4i8),
1881 (MVE_VMOVLs16bh (MVE_VMOVLs8bh MQPR:$src))>;
1883 // zext_inreg 16 -> 32
1884 def : Pat<(and (v4i32 MQPR:$src), (v4i32 (ARMvmovImm (i32 0xCFF)))),
1885 (MVE_VMOVLu16bh MQPR:$src)>;
1886 // zext_inreg 8 -> 16
1887 def : Pat<(and (v8i16 MQPR:$src), (v8i16 (ARMvmovImm (i32 0x8FF)))),
1888 (MVE_VMOVLu8bh MQPR:$src)>;
1892 class MVE_VSHLL_imm<string iname, string suffix, bit U, bit th,
1893 dag immops, list<dag> pattern=[]>
1894 : MVE_shift_imm<(outs MQPR:$Qd), !con((ins MQPR:$Qm), immops),
1895 iname, suffix, "$Qd, $Qm, $imm", vpred_r, "", pattern> {
1897 let Inst{25-23} = 0b101;
1900 let Inst{11-6} = 0b111101;
1905 // The immediate VSHLL instructions accept shift counts from 1 up to
1906 // the lane width (8 or 16), but the full-width shifts have an
1907 // entirely separate encoding, given below with 'lw' in the name.
1909 class MVE_VSHLL_imm8<string iname, string suffix,
1910 bit U, bit th, list<dag> pattern=[]>
1911 : MVE_VSHLL_imm<iname, suffix, U, th, (ins mve_shift_imm1_7:$imm), pattern> {
1913 let Inst{20-19} = 0b01;
1914 let Inst{18-16} = imm;
1917 class MVE_VSHLL_imm16<string iname, string suffix,
1918 bit U, bit th, list<dag> pattern=[]>
1919 : MVE_VSHLL_imm<iname, suffix, U, th, (ins mve_shift_imm1_15:$imm), pattern> {
1922 let Inst{19-16} = imm;
1925 def MVE_VSHLL_imms8bh : MVE_VSHLL_imm8 <"vshllb", "s8", 0b0, 0b0>;
1926 def MVE_VSHLL_imms8th : MVE_VSHLL_imm8 <"vshllt", "s8", 0b0, 0b1>;
1927 def MVE_VSHLL_immu8bh : MVE_VSHLL_imm8 <"vshllb", "u8", 0b1, 0b0>;
1928 def MVE_VSHLL_immu8th : MVE_VSHLL_imm8 <"vshllt", "u8", 0b1, 0b1>;
1929 def MVE_VSHLL_imms16bh : MVE_VSHLL_imm16<"vshllb", "s16", 0b0, 0b0>;
1930 def MVE_VSHLL_imms16th : MVE_VSHLL_imm16<"vshllt", "s16", 0b0, 0b1>;
1931 def MVE_VSHLL_immu16bh : MVE_VSHLL_imm16<"vshllb", "u16", 0b1, 0b0>;
1932 def MVE_VSHLL_immu16th : MVE_VSHLL_imm16<"vshllt", "u16", 0b1, 0b1>;
1934 class MVE_VSHLL_by_lane_width<string iname, string suffix, bits<2> size,
1935 bit U, string ops, list<dag> pattern=[]>
1936 : MVE_shift_imm<(outs MQPR:$Qd), (ins MQPR:$Qm),
1937 iname, suffix, ops, vpred_r, "", pattern> {
1939 let Inst{25-23} = 0b100;
1940 let Inst{21-20} = 0b11;
1941 let Inst{19-18} = size{1-0};
1942 let Inst{17-16} = 0b01;
1943 let Inst{11-6} = 0b111000;
1948 multiclass MVE_VSHLL_lw<string iname, string suffix, bits<2> sz, bit U,
1949 string ops, list<dag> pattern=[]> {
1950 def bh : MVE_VSHLL_by_lane_width<iname#"b", suffix, sz, U, ops, pattern> {
1953 def th : MVE_VSHLL_by_lane_width<iname#"t", suffix, sz, U, ops, pattern> {
1958 defm MVE_VSHLL_lws8 : MVE_VSHLL_lw<"vshll", "s8", 0b00, 0b0, "$Qd, $Qm, #8">;
1959 defm MVE_VSHLL_lws16 : MVE_VSHLL_lw<"vshll", "s16", 0b01, 0b0, "$Qd, $Qm, #16">;
1960 defm MVE_VSHLL_lwu8 : MVE_VSHLL_lw<"vshll", "u8", 0b00, 0b1, "$Qd, $Qm, #8">;
1961 defm MVE_VSHLL_lwu16 : MVE_VSHLL_lw<"vshll", "u16", 0b01, 0b1, "$Qd, $Qm, #16">;
1963 class MVE_VxSHRN<string iname, string suffix, bit bit_12, bit bit_28,
1964 dag immops, list<dag> pattern=[]>
1965 : MVE_shift_imm<(outs MQPR:$Qd), !con((ins MQPR:$QdSrc, MQPR:$Qm), immops),
1966 iname, suffix, "$Qd, $Qm, $imm", vpred_n, "$Qd = $QdSrc",
1970 let Inst{28} = bit_28;
1971 let Inst{25-23} = 0b101;
1973 let Inst{20-16} = imm{4-0};
1974 let Inst{12} = bit_12;
1975 let Inst{11-6} = 0b111111;
1980 def MVE_VRSHRNi16bh : MVE_VxSHRN<
1981 "vrshrnb", "i16", 0b0, 0b1, (ins shr_imm8:$imm)> {
1982 let Inst{20-19} = 0b01;
1984 def MVE_VRSHRNi16th : MVE_VxSHRN<
1985 "vrshrnt", "i16", 0b1, 0b1,(ins shr_imm8:$imm)> {
1986 let Inst{20-19} = 0b01;
1988 def MVE_VRSHRNi32bh : MVE_VxSHRN<
1989 "vrshrnb", "i32", 0b0, 0b1, (ins shr_imm16:$imm)> {
1992 def MVE_VRSHRNi32th : MVE_VxSHRN<
1993 "vrshrnt", "i32", 0b1, 0b1, (ins shr_imm16:$imm)> {
1997 def MVE_VSHRNi16bh : MVE_VxSHRN<
1998 "vshrnb", "i16", 0b0, 0b0, (ins shr_imm8:$imm)> {
1999 let Inst{20-19} = 0b01;
2001 def MVE_VSHRNi16th : MVE_VxSHRN<
2002 "vshrnt", "i16", 0b1, 0b0, (ins shr_imm8:$imm)> {
2003 let Inst{20-19} = 0b01;
2005 def MVE_VSHRNi32bh : MVE_VxSHRN<
2006 "vshrnb", "i32", 0b0, 0b0, (ins shr_imm16:$imm)> {
2009 def MVE_VSHRNi32th : MVE_VxSHRN<
2010 "vshrnt", "i32", 0b1, 0b0, (ins shr_imm16:$imm)> {
2014 class MVE_VxQRSHRUN<string iname, string suffix, bit bit_28, bit bit_12, dag immops,
2015 list<dag> pattern=[]>
2016 : MVE_shift_imm<(outs MQPR:$Qd), !con((ins MQPR:$QdSrc, MQPR:$Qm), immops),
2017 iname, suffix, "$Qd, $Qm, $imm", vpred_n, "$Qd = $QdSrc",
2021 let Inst{28} = bit_28;
2022 let Inst{25-23} = 0b101;
2024 let Inst{20-16} = imm{4-0};
2025 let Inst{12} = bit_12;
2026 let Inst{11-6} = 0b111111;
2031 def MVE_VQRSHRUNs16bh : MVE_VxQRSHRUN<
2032 "vqrshrunb", "s16", 0b1, 0b0, (ins shr_imm8:$imm)> {
2033 let Inst{20-19} = 0b01;
2035 def MVE_VQRSHRUNs16th : MVE_VxQRSHRUN<
2036 "vqrshrunt", "s16", 0b1, 0b1, (ins shr_imm8:$imm)> {
2037 let Inst{20-19} = 0b01;
2039 def MVE_VQRSHRUNs32bh : MVE_VxQRSHRUN<
2040 "vqrshrunb", "s32", 0b1, 0b0, (ins shr_imm16:$imm)> {
2043 def MVE_VQRSHRUNs32th : MVE_VxQRSHRUN<
2044 "vqrshrunt", "s32", 0b1, 0b1, (ins shr_imm16:$imm)> {
2048 def MVE_VQSHRUNs16bh : MVE_VxQRSHRUN<
2049 "vqshrunb", "s16", 0b0, 0b0, (ins shr_imm8:$imm)> {
2050 let Inst{20-19} = 0b01;
2052 def MVE_VQSHRUNs16th : MVE_VxQRSHRUN<
2053 "vqshrunt", "s16", 0b0, 0b1, (ins shr_imm8:$imm)> {
2054 let Inst{20-19} = 0b01;
2056 def MVE_VQSHRUNs32bh : MVE_VxQRSHRUN<
2057 "vqshrunb", "s32", 0b0, 0b0, (ins shr_imm16:$imm)> {
2060 def MVE_VQSHRUNs32th : MVE_VxQRSHRUN<
2061 "vqshrunt", "s32", 0b0, 0b1, (ins shr_imm16:$imm)> {
2065 class MVE_VxQRSHRN<string iname, string suffix, bit bit_0, bit bit_12,
2066 dag immops, list<dag> pattern=[]>
2067 : MVE_shift_imm<(outs MQPR:$Qd), !con((ins MQPR:$QdSrc, MQPR:$Qm), immops),
2068 iname, suffix, "$Qd, $Qm, $imm", vpred_n, "$Qd = $QdSrc",
2072 let Inst{25-23} = 0b101;
2074 let Inst{20-16} = imm{4-0};
2075 let Inst{12} = bit_12;
2076 let Inst{11-6} = 0b111101;
2078 let Inst{0} = bit_0;
2081 multiclass MVE_VxQRSHRN_types<string iname, bit bit_0, bit bit_12> {
2082 def s16 : MVE_VxQRSHRN<iname, "s16", bit_0, bit_12, (ins shr_imm8:$imm)> {
2084 let Inst{20-19} = 0b01;
2086 def u16 : MVE_VxQRSHRN<iname, "u16", bit_0, bit_12, (ins shr_imm8:$imm)> {
2088 let Inst{20-19} = 0b01;
2090 def s32 : MVE_VxQRSHRN<iname, "s32", bit_0, bit_12, (ins shr_imm16:$imm)> {
2094 def u32 : MVE_VxQRSHRN<iname, "u32", bit_0, bit_12, (ins shr_imm16:$imm)> {
2100 defm MVE_VQRSHRNbh : MVE_VxQRSHRN_types<"vqrshrnb", 0b1, 0b0>;
2101 defm MVE_VQRSHRNth : MVE_VxQRSHRN_types<"vqrshrnt", 0b1, 0b1>;
2102 defm MVE_VQSHRNbh : MVE_VxQRSHRN_types<"vqshrnb", 0b0, 0b0>;
2103 defm MVE_VQSHRNth : MVE_VxQRSHRN_types<"vqshrnt", 0b0, 0b1>;
2105 // end of mve_imm_shift instructions
2107 // start of mve_shift instructions
2109 class MVE_shift_by_vec<string iname, string suffix, bit U,
2110 bits<2> size, bit bit_4, bit bit_8>
2111 : MVE_p<(outs MQPR:$Qd), (ins MQPR:$Qm, MQPR:$Qn), NoItinerary,
2112 iname, suffix, "$Qd, $Qm, $Qn", vpred_r, "", []> {
2113 // Shift instructions which take a vector of shift counts
2119 let Inst{25-24} = 0b11;
2121 let Inst{22} = Qd{3};
2122 let Inst{21-20} = size;
2123 let Inst{19-17} = Qn{2-0};
2125 let Inst{15-13} = Qd{2-0};
2126 let Inst{12-9} = 0b0010;
2127 let Inst{8} = bit_8;
2128 let Inst{7} = Qn{3};
2130 let Inst{5} = Qm{3};
2131 let Inst{4} = bit_4;
2132 let Inst{3-1} = Qm{2-0};
2136 multiclass mve_shift_by_vec_multi<string iname, bit bit_4, bit bit_8> {
2137 def s8 : MVE_shift_by_vec<iname, "s8", 0b0, 0b00, bit_4, bit_8>;
2138 def s16 : MVE_shift_by_vec<iname, "s16", 0b0, 0b01, bit_4, bit_8>;
2139 def s32 : MVE_shift_by_vec<iname, "s32", 0b0, 0b10, bit_4, bit_8>;
2140 def u8 : MVE_shift_by_vec<iname, "u8", 0b1, 0b00, bit_4, bit_8>;
2141 def u16 : MVE_shift_by_vec<iname, "u16", 0b1, 0b01, bit_4, bit_8>;
2142 def u32 : MVE_shift_by_vec<iname, "u32", 0b1, 0b10, bit_4, bit_8>;
2145 defm MVE_VSHL_by_vec : mve_shift_by_vec_multi<"vshl", 0b0, 0b0>;
2146 defm MVE_VQSHL_by_vec : mve_shift_by_vec_multi<"vqshl", 0b1, 0b0>;
2147 defm MVE_VQRSHL_by_vec : mve_shift_by_vec_multi<"vqrshl", 0b1, 0b1>;
2148 defm MVE_VRSHL_by_vec : mve_shift_by_vec_multi<"vrshl", 0b0, 0b1>;
2150 let Predicates = [HasMVEInt] in {
2151 def : Pat<(v4i32 (ARMvshlu (v4i32 MQPR:$Qm), (v4i32 MQPR:$Qn))),
2152 (v4i32 (MVE_VSHL_by_vecu32 (v4i32 MQPR:$Qm), (v4i32 MQPR:$Qn)))>;
2153 def : Pat<(v8i16 (ARMvshlu (v8i16 MQPR:$Qm), (v8i16 MQPR:$Qn))),
2154 (v8i16 (MVE_VSHL_by_vecu16 (v8i16 MQPR:$Qm), (v8i16 MQPR:$Qn)))>;
2155 def : Pat<(v16i8 (ARMvshlu (v16i8 MQPR:$Qm), (v16i8 MQPR:$Qn))),
2156 (v16i8 (MVE_VSHL_by_vecu8 (v16i8 MQPR:$Qm), (v16i8 MQPR:$Qn)))>;
2158 def : Pat<(v4i32 (ARMvshls (v4i32 MQPR:$Qm), (v4i32 MQPR:$Qn))),
2159 (v4i32 (MVE_VSHL_by_vecs32 (v4i32 MQPR:$Qm), (v4i32 MQPR:$Qn)))>;
2160 def : Pat<(v8i16 (ARMvshls (v8i16 MQPR:$Qm), (v8i16 MQPR:$Qn))),
2161 (v8i16 (MVE_VSHL_by_vecs16 (v8i16 MQPR:$Qm), (v8i16 MQPR:$Qn)))>;
2162 def : Pat<(v16i8 (ARMvshls (v16i8 MQPR:$Qm), (v16i8 MQPR:$Qn))),
2163 (v16i8 (MVE_VSHL_by_vecs8 (v16i8 MQPR:$Qm), (v16i8 MQPR:$Qn)))>;
2166 class MVE_shift_with_imm<string iname, string suffix, dag oops, dag iops,
2167 string ops, vpred_ops vpred, string cstr,
2168 list<dag> pattern=[]>
2169 : MVE_p<oops, iops, NoItinerary, iname, suffix, ops, vpred, cstr, pattern> {
2174 let Inst{22} = Qd{3};
2175 let Inst{15-13} = Qd{2-0};
2176 let Inst{12-11} = 0b00;
2177 let Inst{7-6} = 0b01;
2178 let Inst{5} = Qm{3};
2180 let Inst{3-1} = Qm{2-0};
2184 class MVE_VSxI_imm<string iname, string suffix, bit bit_8, dag imm>
2185 : MVE_shift_with_imm<iname, suffix, (outs MQPR:$Qd),
2186 !con((ins MQPR:$Qd_src, MQPR:$Qm), imm),
2187 "$Qd, $Qm, $imm", vpred_n, "$Qd = $Qd_src"> {
2190 let Inst{25-24} = 0b11;
2191 let Inst{21-16} = imm;
2192 let Inst{10-9} = 0b10;
2193 let Inst{8} = bit_8;
2196 def MVE_VSRIimm8 : MVE_VSxI_imm<"vsri", "8", 0b0, (ins shr_imm8:$imm)> {
2197 let Inst{21-19} = 0b001;
2200 def MVE_VSRIimm16 : MVE_VSxI_imm<"vsri", "16", 0b0, (ins shr_imm16:$imm)> {
2201 let Inst{21-20} = 0b01;
2204 def MVE_VSRIimm32 : MVE_VSxI_imm<"vsri", "32", 0b0, (ins shr_imm32:$imm)> {
2208 def MVE_VSLIimm8 : MVE_VSxI_imm<"vsli", "8", 0b1, (ins imm0_7:$imm)> {
2209 let Inst{21-19} = 0b001;
2212 def MVE_VSLIimm16 : MVE_VSxI_imm<"vsli", "16", 0b1, (ins imm0_15:$imm)> {
2213 let Inst{21-20} = 0b01;
2216 def MVE_VSLIimm32 : MVE_VSxI_imm<"vsli", "32", 0b1,(ins imm0_31:$imm)> {
2220 class MVE_VQSHL_imm<string suffix, dag imm>
2221 : MVE_shift_with_imm<"vqshl", suffix, (outs MQPR:$Qd),
2222 !con((ins MQPR:$Qm), imm), "$Qd, $Qm, $imm",
2226 let Inst{25-24} = 0b11;
2227 let Inst{21-16} = imm;
2228 let Inst{10-8} = 0b111;
2231 def MVE_VSLIimms8 : MVE_VQSHL_imm<"s8", (ins imm0_7:$imm)> {
2233 let Inst{21-19} = 0b001;
2236 def MVE_VSLIimmu8 : MVE_VQSHL_imm<"u8", (ins imm0_7:$imm)> {
2238 let Inst{21-19} = 0b001;
2241 def MVE_VSLIimms16 : MVE_VQSHL_imm<"s16", (ins imm0_15:$imm)> {
2243 let Inst{21-20} = 0b01;
2246 def MVE_VSLIimmu16 : MVE_VQSHL_imm<"u16", (ins imm0_15:$imm)> {
2248 let Inst{21-20} = 0b01;
2251 def MVE_VSLIimms32 : MVE_VQSHL_imm<"s32", (ins imm0_31:$imm)> {
2256 def MVE_VSLIimmu32 : MVE_VQSHL_imm<"u32", (ins imm0_31:$imm)> {
2261 class MVE_VQSHLU_imm<string suffix, dag imm>
2262 : MVE_shift_with_imm<"vqshlu", suffix, (outs MQPR:$Qd),
2263 !con((ins MQPR:$Qm), imm), "$Qd, $Qm, $imm",
2268 let Inst{25-24} = 0b11;
2269 let Inst{21-16} = imm;
2270 let Inst{10-8} = 0b110;
2273 def MVE_VQSHLU_imms8 : MVE_VQSHLU_imm<"s8", (ins imm0_7:$imm)> {
2274 let Inst{21-19} = 0b001;
2277 def MVE_VQSHLU_imms16 : MVE_VQSHLU_imm<"s16", (ins imm0_15:$imm)> {
2278 let Inst{21-20} = 0b01;
2281 def MVE_VQSHLU_imms32 : MVE_VQSHLU_imm<"s32", (ins imm0_31:$imm)> {
2285 class MVE_VRSHR_imm<string suffix, dag imm>
2286 : MVE_shift_with_imm<"vrshr", suffix, (outs MQPR:$Qd),
2287 !con((ins MQPR:$Qm), imm), "$Qd, $Qm, $imm",
2291 let Inst{25-24} = 0b11;
2292 let Inst{21-16} = imm;
2293 let Inst{10-8} = 0b010;
2296 def MVE_VRSHR_imms8 : MVE_VRSHR_imm<"s8", (ins shr_imm8:$imm)> {
2298 let Inst{21-19} = 0b001;
2301 def MVE_VRSHR_immu8 : MVE_VRSHR_imm<"u8", (ins shr_imm8:$imm)> {
2303 let Inst{21-19} = 0b001;
2306 def MVE_VRSHR_imms16 : MVE_VRSHR_imm<"s16", (ins shr_imm16:$imm)> {
2308 let Inst{21-20} = 0b01;
2311 def MVE_VRSHR_immu16 : MVE_VRSHR_imm<"u16", (ins shr_imm16:$imm)> {
2313 let Inst{21-20} = 0b01;
2316 def MVE_VRSHR_imms32 : MVE_VRSHR_imm<"s32", (ins shr_imm32:$imm)> {
2321 def MVE_VRSHR_immu32 : MVE_VRSHR_imm<"u32", (ins shr_imm32:$imm)> {
2326 class MVE_VSHR_imm<string suffix, dag imm>
2327 : MVE_shift_with_imm<"vshr", suffix, (outs MQPR:$Qd),
2328 !con((ins MQPR:$Qm), imm), "$Qd, $Qm, $imm",
2332 let Inst{25-24} = 0b11;
2333 let Inst{21-16} = imm;
2334 let Inst{10-8} = 0b000;
2337 def MVE_VSHR_imms8 : MVE_VSHR_imm<"s8", (ins shr_imm8:$imm)> {
2339 let Inst{21-19} = 0b001;
2342 def MVE_VSHR_immu8 : MVE_VSHR_imm<"u8", (ins shr_imm8:$imm)> {
2344 let Inst{21-19} = 0b001;
2347 def MVE_VSHR_imms16 : MVE_VSHR_imm<"s16", (ins shr_imm16:$imm)> {
2349 let Inst{21-20} = 0b01;
2352 def MVE_VSHR_immu16 : MVE_VSHR_imm<"u16", (ins shr_imm16:$imm)> {
2354 let Inst{21-20} = 0b01;
2357 def MVE_VSHR_imms32 : MVE_VSHR_imm<"s32", (ins shr_imm32:$imm)> {
2362 def MVE_VSHR_immu32 : MVE_VSHR_imm<"u32", (ins shr_imm32:$imm)> {
2367 class MVE_VSHL_imm<string suffix, dag imm>
2368 : MVE_shift_with_imm<"vshl", suffix, (outs MQPR:$Qd),
2369 !con((ins MQPR:$Qm), imm), "$Qd, $Qm, $imm",
2374 let Inst{25-24} = 0b11;
2375 let Inst{21-16} = imm;
2376 let Inst{10-8} = 0b101;
2379 def MVE_VSHL_immi8 : MVE_VSHL_imm<"i8", (ins imm0_7:$imm)> {
2380 let Inst{21-19} = 0b001;
2383 def MVE_VSHL_immi16 : MVE_VSHL_imm<"i16", (ins imm0_15:$imm)> {
2384 let Inst{21-20} = 0b01;
2387 def MVE_VSHL_immi32 : MVE_VSHL_imm<"i32", (ins imm0_31:$imm)> {
2391 let Predicates = [HasMVEInt] in {
2392 def : Pat<(v4i32 (ARMvshlImm (v4i32 MQPR:$src), imm0_31:$imm)),
2393 (v4i32 (MVE_VSHL_immi32 (v4i32 MQPR:$src), imm0_31:$imm))>;
2394 def : Pat<(v8i16 (ARMvshlImm (v8i16 MQPR:$src), imm0_15:$imm)),
2395 (v8i16 (MVE_VSHL_immi16 (v8i16 MQPR:$src), imm0_15:$imm))>;
2396 def : Pat<(v16i8 (ARMvshlImm (v16i8 MQPR:$src), imm0_7:$imm)),
2397 (v16i8 (MVE_VSHL_immi8 (v16i8 MQPR:$src), imm0_7:$imm))>;
2399 def : Pat<(v4i32 (ARMvshruImm (v4i32 MQPR:$src), imm0_31:$imm)),
2400 (v4i32 (MVE_VSHR_immu32 (v4i32 MQPR:$src), imm0_31:$imm))>;
2401 def : Pat<(v8i16 (ARMvshruImm (v8i16 MQPR:$src), imm0_15:$imm)),
2402 (v8i16 (MVE_VSHR_immu16 (v8i16 MQPR:$src), imm0_15:$imm))>;
2403 def : Pat<(v16i8 (ARMvshruImm (v16i8 MQPR:$src), imm0_7:$imm)),
2404 (v16i8 (MVE_VSHR_immu8 (v16i8 MQPR:$src), imm0_7:$imm))>;
2406 def : Pat<(v4i32 (ARMvshrsImm (v4i32 MQPR:$src), imm0_31:$imm)),
2407 (v4i32 (MVE_VSHR_imms32 (v4i32 MQPR:$src), imm0_31:$imm))>;
2408 def : Pat<(v8i16 (ARMvshrsImm (v8i16 MQPR:$src), imm0_15:$imm)),
2409 (v8i16 (MVE_VSHR_imms16 (v8i16 MQPR:$src), imm0_15:$imm))>;
2410 def : Pat<(v16i8 (ARMvshrsImm (v16i8 MQPR:$src), imm0_7:$imm)),
2411 (v16i8 (MVE_VSHR_imms8 (v16i8 MQPR:$src), imm0_7:$imm))>;
2414 // end of mve_shift instructions
2416 // start of MVE Floating Point instructions
2418 class MVE_float<string iname, string suffix, dag oops, dag iops, string ops,
2419 vpred_ops vpred, string cstr, list<dag> pattern=[]>
2420 : MVE_f<oops, iops, NoItinerary, iname, suffix, ops, vpred, cstr, pattern> {
2425 let Inst{5} = Qm{3};
2426 let Inst{3-1} = Qm{2-0};
2430 class MVE_VRINT<string rmode, bits<3> op, string suffix, bits<2> size,
2431 list<dag> pattern=[]>
2432 : MVE_float<!strconcat("vrint", rmode), suffix, (outs MQPR:$Qd),
2433 (ins MQPR:$Qm), "$Qd, $Qm", vpred_r, "", pattern> {
2437 let Inst{25-23} = 0b111;
2438 let Inst{22} = Qd{3};
2439 let Inst{21-20} = 0b11;
2440 let Inst{19-18} = size;
2441 let Inst{17-16} = 0b10;
2442 let Inst{15-13} = Qd{2-0};
2443 let Inst{11-10} = 0b01;
2444 let Inst{9-7} = op{2-0};
2449 multiclass MVE_VRINT_ops<string suffix, bits<2> size, list<dag> pattern=[]> {
2450 def N : MVE_VRINT<"n", 0b000, suffix, size, pattern>;
2451 def X : MVE_VRINT<"x", 0b001, suffix, size, pattern>;
2452 def A : MVE_VRINT<"a", 0b010, suffix, size, pattern>;
2453 def Z : MVE_VRINT<"z", 0b011, suffix, size, pattern>;
2454 def M : MVE_VRINT<"m", 0b101, suffix, size, pattern>;
2455 def P : MVE_VRINT<"p", 0b111, suffix, size, pattern>;
2458 defm MVE_VRINTf16 : MVE_VRINT_ops<"f16", 0b01>;
2459 defm MVE_VRINTf32 : MVE_VRINT_ops<"f32", 0b10>;
2461 let Predicates = [HasMVEFloat] in {
2462 def : Pat<(v4f32 (frint (v4f32 MQPR:$val1))),
2463 (v4f32 (MVE_VRINTf32X (v4f32 MQPR:$val1)))>;
2464 def : Pat<(v8f16 (frint (v8f16 MQPR:$val1))),
2465 (v8f16 (MVE_VRINTf16X (v8f16 MQPR:$val1)))>;
2466 def : Pat<(v4f32 (fround (v4f32 MQPR:$val1))),
2467 (v4f32 (MVE_VRINTf32A (v4f32 MQPR:$val1)))>;
2468 def : Pat<(v8f16 (fround (v8f16 MQPR:$val1))),
2469 (v8f16 (MVE_VRINTf16A (v8f16 MQPR:$val1)))>;
2470 def : Pat<(v4f32 (ftrunc (v4f32 MQPR:$val1))),
2471 (v4f32 (MVE_VRINTf32Z (v4f32 MQPR:$val1)))>;
2472 def : Pat<(v8f16 (ftrunc (v8f16 MQPR:$val1))),
2473 (v8f16 (MVE_VRINTf16Z (v8f16 MQPR:$val1)))>;
2474 def : Pat<(v4f32 (ffloor (v4f32 MQPR:$val1))),
2475 (v4f32 (MVE_VRINTf32M (v4f32 MQPR:$val1)))>;
2476 def : Pat<(v8f16 (ffloor (v8f16 MQPR:$val1))),
2477 (v8f16 (MVE_VRINTf16M (v8f16 MQPR:$val1)))>;
2478 def : Pat<(v4f32 (fceil (v4f32 MQPR:$val1))),
2479 (v4f32 (MVE_VRINTf32P (v4f32 MQPR:$val1)))>;
2480 def : Pat<(v8f16 (fceil (v8f16 MQPR:$val1))),
2481 (v8f16 (MVE_VRINTf16P (v8f16 MQPR:$val1)))>;
2484 class MVEFloatArithNeon<string iname, string suffix, bit size,
2485 dag oops, dag iops, string ops,
2486 vpred_ops vpred, string cstr, list<dag> pattern=[]>
2487 : MVE_float<iname, suffix, oops, iops, ops, vpred, cstr, pattern> {
2488 let Inst{20} = size;
2492 class MVE_VMUL_fp<string suffix, bit size, list<dag> pattern=[]>
2493 : MVEFloatArithNeon<"vmul", suffix, size, (outs MQPR:$Qd),
2494 (ins MQPR:$Qn, MQPR:$Qm), "$Qd, $Qn, $Qm", vpred_r, "",
2500 let Inst{25-23} = 0b110;
2501 let Inst{22} = Qd{3};
2503 let Inst{19-17} = Qn{2-0};
2504 let Inst{15-13} = Qd{2-0};
2505 let Inst{12-8} = 0b01101;
2506 let Inst{7} = Qn{3};
2510 def MVE_VMULf32 : MVE_VMUL_fp<"f32", 0b0>;
2511 def MVE_VMULf16 : MVE_VMUL_fp<"f16", 0b1>;
2513 let Predicates = [HasMVEFloat] in {
2514 def : Pat<(v4f32 (fmul (v4f32 MQPR:$val1), (v4f32 MQPR:$val2))),
2515 (v4f32 (MVE_VMULf32 (v4f32 MQPR:$val1), (v4f32 MQPR:$val2)))>;
2516 def : Pat<(v8f16 (fmul (v8f16 MQPR:$val1), (v8f16 MQPR:$val2))),
2517 (v8f16 (MVE_VMULf16 (v8f16 MQPR:$val1), (v8f16 MQPR:$val2)))>;
2520 class MVE_VCMLA<string suffix, bit size, list<dag> pattern=[]>
2521 : MVEFloatArithNeon<"vcmla", suffix, size, (outs MQPR:$Qd),
2522 (ins MQPR:$Qd_src, MQPR:$Qn, MQPR:$Qm, complexrotateop:$rot),
2523 "$Qd, $Qn, $Qm, $rot", vpred_n, "$Qd = $Qd_src", pattern> {
2530 let Inst{24-23} = rot;
2531 let Inst{22} = Qd{3};
2533 let Inst{19-17} = Qn{2-0};
2534 let Inst{15-13} = Qd{2-0};
2535 let Inst{12-8} = 0b01000;
2536 let Inst{7} = Qn{3};
2540 def MVE_VCMLAf16 : MVE_VCMLA<"f16", 0b0>;
2541 def MVE_VCMLAf32 : MVE_VCMLA<"f32", 0b1>;
2543 class MVE_VADDSUBFMA_fp<string iname, string suffix, bit size, bit bit_4,
2544 bit bit_8, bit bit_21, dag iops=(ins),
2545 vpred_ops vpred=vpred_r, string cstr="",
2546 list<dag> pattern=[]>
2547 : MVEFloatArithNeon<iname, suffix, size, (outs MQPR:$Qd),
2548 !con(iops, (ins MQPR:$Qn, MQPR:$Qm)), "$Qd, $Qn, $Qm",
2549 vpred, cstr, pattern> {
2554 let Inst{25-23} = 0b110;
2555 let Inst{22} = Qd{3};
2556 let Inst{21} = bit_21;
2557 let Inst{19-17} = Qn{2-0};
2558 let Inst{15-13} = Qd{2-0};
2559 let Inst{11-9} = 0b110;
2560 let Inst{8} = bit_8;
2561 let Inst{7} = Qn{3};
2562 let Inst{4} = bit_4;
2565 def MVE_VFMAf32 : MVE_VADDSUBFMA_fp<"vfma", "f32", 0b0, 0b1, 0b0, 0b0,
2566 (ins MQPR:$Qd_src), vpred_n, "$Qd = $Qd_src">;
2567 def MVE_VFMAf16 : MVE_VADDSUBFMA_fp<"vfma", "f16", 0b1, 0b1, 0b0, 0b0,
2568 (ins MQPR:$Qd_src), vpred_n, "$Qd = $Qd_src">;
2570 def MVE_VFMSf32 : MVE_VADDSUBFMA_fp<"vfms", "f32", 0b0, 0b1, 0b0, 0b1,
2571 (ins MQPR:$Qd_src), vpred_n, "$Qd = $Qd_src">;
2572 def MVE_VFMSf16 : MVE_VADDSUBFMA_fp<"vfms", "f16", 0b1, 0b1, 0b0, 0b1,
2573 (ins MQPR:$Qd_src), vpred_n, "$Qd = $Qd_src">;
2575 def MVE_VADDf32 : MVE_VADDSUBFMA_fp<"vadd", "f32", 0b0, 0b0, 0b1, 0b0>;
2576 def MVE_VADDf16 : MVE_VADDSUBFMA_fp<"vadd", "f16", 0b1, 0b0, 0b1, 0b0>;
2578 let Predicates = [HasMVEFloat] in {
2579 def : Pat<(v4f32 (fadd (v4f32 MQPR:$val1), (v4f32 MQPR:$val2))),
2580 (v4f32 (MVE_VADDf32 (v4f32 MQPR:$val1), (v4f32 MQPR:$val2)))>;
2581 def : Pat<(v8f16 (fadd (v8f16 MQPR:$val1), (v8f16 MQPR:$val2))),
2582 (v8f16 (MVE_VADDf16 (v8f16 MQPR:$val1), (v8f16 MQPR:$val2)))>;
2585 def MVE_VSUBf32 : MVE_VADDSUBFMA_fp<"vsub", "f32", 0b0, 0b0, 0b1, 0b1>;
2586 def MVE_VSUBf16 : MVE_VADDSUBFMA_fp<"vsub", "f16", 0b1, 0b0, 0b1, 0b1>;
2588 let Predicates = [HasMVEFloat] in {
2589 def : Pat<(v4f32 (fsub (v4f32 MQPR:$val1), (v4f32 MQPR:$val2))),
2590 (v4f32 (MVE_VSUBf32 (v4f32 MQPR:$val1), (v4f32 MQPR:$val2)))>;
2591 def : Pat<(v8f16 (fsub (v8f16 MQPR:$val1), (v8f16 MQPR:$val2))),
2592 (v8f16 (MVE_VSUBf16 (v8f16 MQPR:$val1), (v8f16 MQPR:$val2)))>;
2595 class MVE_VCADD<string suffix, bit size, list<dag> pattern=[]>
2596 : MVEFloatArithNeon<"vcadd", suffix, size, (outs MQPR:$Qd),
2597 (ins MQPR:$Qn, MQPR:$Qm, complexrotateopodd:$rot),
2598 "$Qd, $Qn, $Qm, $rot", vpred_r, "", pattern> {
2607 let Inst{22} = Qd{3};
2609 let Inst{19-17} = Qn{2-0};
2610 let Inst{15-13} = Qd{2-0};
2611 let Inst{12-8} = 0b01000;
2612 let Inst{7} = Qn{3};
2616 def MVE_VCADDf16 : MVE_VCADD<"f16", 0b0>;
2617 def MVE_VCADDf32 : MVE_VCADD<"f32", 0b1>;
2619 class MVE_VABD_fp<string suffix, bit size>
2620 : MVE_float<"vabd", suffix, (outs MQPR:$Qd), (ins MQPR:$Qn, MQPR:$Qm),
2621 "$Qd, $Qn, $Qm", vpred_r, ""> {
2626 let Inst{25-23} = 0b110;
2627 let Inst{22} = Qd{3};
2629 let Inst{20} = size;
2630 let Inst{19-17} = Qn{2-0};
2632 let Inst{15-13} = Qd{2-0};
2633 let Inst{11-8} = 0b1101;
2634 let Inst{7} = Qn{3};
2638 def MVE_VABDf32 : MVE_VABD_fp<"f32", 0b0>;
2639 def MVE_VABDf16 : MVE_VABD_fp<"f16", 0b1>;
2641 class MVE_VCVT_fix<string suffix, bit fsi, bit U, bit op,
2642 Operand imm_operand_type, list<dag> pattern=[]>
2643 : MVE_float<"vcvt", suffix,
2644 (outs MQPR:$Qd), (ins MQPR:$Qm, imm_operand_type:$imm6),
2645 "$Qd, $Qm, $imm6", vpred_r, "", pattern> {
2650 let Inst{25-23} = 0b111;
2651 let Inst{22} = Qd{3};
2653 let Inst{19-16} = imm6{3-0};
2654 let Inst{15-13} = Qd{2-0};
2655 let Inst{11-10} = 0b11;
2661 let DecoderMethod = "DecodeMVEVCVTt1fp";
2664 class MVE_VCVT_imm_asmop<int Bits> : AsmOperandClass {
2665 let PredicateMethod = "isImmediate<1," # Bits # ">";
2666 let DiagnosticString =
2667 "MVE fixed-point immediate operand must be between 1 and " # Bits;
2668 let Name = "MVEVcvtImm" # Bits;
2669 let RenderMethod = "addImmOperands";
2671 class MVE_VCVT_imm<int Bits>: Operand<i32> {
2672 let ParserMatchClass = MVE_VCVT_imm_asmop<Bits>;
2673 let EncoderMethod = "getNEONVcvtImm32OpValue";
2674 let DecoderMethod = "DecodeVCVTImmOperand";
2677 class MVE_VCVT_fix_f32<string suffix, bit U, bit op>
2678 : MVE_VCVT_fix<suffix, 0b1, U, op, MVE_VCVT_imm<32>> {
2679 let Inst{20} = imm6{4};
2681 class MVE_VCVT_fix_f16<string suffix, bit U, bit op>
2682 : MVE_VCVT_fix<suffix, 0b0, U, op, MVE_VCVT_imm<16>> {
2686 def MVE_VCVTf16s16_fix : MVE_VCVT_fix_f16<"f16.s16", 0b0, 0b0>;
2687 def MVE_VCVTs16f16_fix : MVE_VCVT_fix_f16<"s16.f16", 0b0, 0b1>;
2688 def MVE_VCVTf16u16_fix : MVE_VCVT_fix_f16<"f16.u16", 0b1, 0b0>;
2689 def MVE_VCVTu16f16_fix : MVE_VCVT_fix_f16<"u16.f16", 0b1, 0b1>;
2690 def MVE_VCVTf32s32_fix : MVE_VCVT_fix_f32<"f32.s32", 0b0, 0b0>;
2691 def MVE_VCVTs32f32_fix : MVE_VCVT_fix_f32<"s32.f32", 0b0, 0b1>;
2692 def MVE_VCVTf32u32_fix : MVE_VCVT_fix_f32<"f32.u32", 0b1, 0b0>;
2693 def MVE_VCVTu32f32_fix : MVE_VCVT_fix_f32<"u32.f32", 0b1, 0b1>;
2695 class MVE_VCVT_fp_int_anpm<string suffix, bits<2> size, bit op, string anpm,
2696 bits<2> rm, list<dag> pattern=[]>
2697 : MVE_float<!strconcat("vcvt", anpm), suffix, (outs MQPR:$Qd),
2698 (ins MQPR:$Qm), "$Qd, $Qm", vpred_r, "", pattern> {
2702 let Inst{25-23} = 0b111;
2703 let Inst{22} = Qd{3};
2704 let Inst{21-20} = 0b11;
2705 let Inst{19-18} = size;
2706 let Inst{17-16} = 0b11;
2707 let Inst{15-13} = Qd{2-0};
2708 let Inst{12-10} = 0b000;
2714 multiclass MVE_VCVT_fp_int_anpm_multi<string suffix, bits<2> size, bit op,
2715 list<dag> pattern=[]> {
2716 def a : MVE_VCVT_fp_int_anpm<suffix, size, op, "a", 0b00>;
2717 def n : MVE_VCVT_fp_int_anpm<suffix, size, op, "n", 0b01>;
2718 def p : MVE_VCVT_fp_int_anpm<suffix, size, op, "p", 0b10>;
2719 def m : MVE_VCVT_fp_int_anpm<suffix, size, op, "m", 0b11>;
2722 // This defines instructions such as MVE_VCVTu16f16a, with an explicit
2723 // rounding-mode suffix on the mnemonic. The class below will define
2724 // the bare MVE_VCVTu16f16 (with implied rounding toward zero).
2725 defm MVE_VCVTs16f16 : MVE_VCVT_fp_int_anpm_multi<"s16.f16", 0b01, 0b0>;
2726 defm MVE_VCVTu16f16 : MVE_VCVT_fp_int_anpm_multi<"u16.f16", 0b01, 0b1>;
2727 defm MVE_VCVTs32f32 : MVE_VCVT_fp_int_anpm_multi<"s32.f32", 0b10, 0b0>;
2728 defm MVE_VCVTu32f32 : MVE_VCVT_fp_int_anpm_multi<"u32.f32", 0b10, 0b1>;
2730 class MVE_VCVT_fp_int<string suffix, bits<2> size, bits<2> op,
2731 list<dag> pattern=[]>
2732 : MVE_float<"vcvt", suffix, (outs MQPR:$Qd),
2733 (ins MQPR:$Qm), "$Qd, $Qm", vpred_r, "", pattern> {
2737 let Inst{25-23} = 0b111;
2738 let Inst{22} = Qd{3};
2739 let Inst{21-20} = 0b11;
2740 let Inst{19-18} = size;
2741 let Inst{17-16} = 0b11;
2742 let Inst{15-13} = Qd{2-0};
2743 let Inst{12-9} = 0b0011;
2748 // The unsuffixed VCVT for float->int implicitly rounds toward zero,
2749 // which I reflect here in the llvm instruction names
2750 def MVE_VCVTs16f16z : MVE_VCVT_fp_int<"s16.f16", 0b01, 0b10>;
2751 def MVE_VCVTu16f16z : MVE_VCVT_fp_int<"u16.f16", 0b01, 0b11>;
2752 def MVE_VCVTs32f32z : MVE_VCVT_fp_int<"s32.f32", 0b10, 0b10>;
2753 def MVE_VCVTu32f32z : MVE_VCVT_fp_int<"u32.f32", 0b10, 0b11>;
2754 // Whereas VCVT for int->float rounds to nearest
2755 def MVE_VCVTf16s16n : MVE_VCVT_fp_int<"f16.s16", 0b01, 0b00>;
2756 def MVE_VCVTf16u16n : MVE_VCVT_fp_int<"f16.u16", 0b01, 0b01>;
2757 def MVE_VCVTf32s32n : MVE_VCVT_fp_int<"f32.s32", 0b10, 0b00>;
2758 def MVE_VCVTf32u32n : MVE_VCVT_fp_int<"f32.u32", 0b10, 0b01>;
2760 let Predicates = [HasMVEFloat] in {
2761 def : Pat<(v4i32 (fp_to_sint (v4f32 MQPR:$src))),
2762 (v4i32 (MVE_VCVTs32f32z (v4f32 MQPR:$src)))>;
2763 def : Pat<(v4i32 (fp_to_uint (v4f32 MQPR:$src))),
2764 (v4i32 (MVE_VCVTu32f32z (v4f32 MQPR:$src)))>;
2765 def : Pat<(v8i16 (fp_to_sint (v8f16 MQPR:$src))),
2766 (v8i16 (MVE_VCVTs16f16z (v8f16 MQPR:$src)))>;
2767 def : Pat<(v8i16 (fp_to_uint (v8f16 MQPR:$src))),
2768 (v8i16 (MVE_VCVTu16f16z (v8f16 MQPR:$src)))>;
2769 def : Pat<(v4f32 (sint_to_fp (v4i32 MQPR:$src))),
2770 (v4f32 (MVE_VCVTf32s32n (v4i32 MQPR:$src)))>;
2771 def : Pat<(v4f32 (uint_to_fp (v4i32 MQPR:$src))),
2772 (v4f32 (MVE_VCVTf32u32n (v4i32 MQPR:$src)))>;
2773 def : Pat<(v8f16 (sint_to_fp (v8i16 MQPR:$src))),
2774 (v8f16 (MVE_VCVTf16s16n (v8i16 MQPR:$src)))>;
2775 def : Pat<(v8f16 (uint_to_fp (v8i16 MQPR:$src))),
2776 (v8f16 (MVE_VCVTf16u16n (v8i16 MQPR:$src)))>;
2779 class MVE_VABSNEG_fp<string iname, string suffix, bits<2> size, bit negate,
2780 list<dag> pattern=[]>
2781 : MVE_float<iname, suffix, (outs MQPR:$Qd),
2782 (ins MQPR:$Qm), "$Qd, $Qm", vpred_r, "", pattern> {
2786 let Inst{25-23} = 0b111;
2787 let Inst{22} = Qd{3};
2788 let Inst{21-20} = 0b11;
2789 let Inst{19-18} = size;
2790 let Inst{17-16} = 0b01;
2791 let Inst{15-13} = Qd{2-0};
2792 let Inst{11-8} = 0b0111;
2793 let Inst{7} = negate;
2797 def MVE_VABSf16 : MVE_VABSNEG_fp<"vabs", "f16", 0b01, 0b0>;
2798 def MVE_VABSf32 : MVE_VABSNEG_fp<"vabs", "f32", 0b10, 0b0>;
2800 let Predicates = [HasMVEFloat] in {
2801 def : Pat<(v8f16 (fabs MQPR:$src)),
2802 (MVE_VABSf16 MQPR:$src)>;
2803 def : Pat<(v4f32 (fabs MQPR:$src)),
2804 (MVE_VABSf32 MQPR:$src)>;
2807 def MVE_VNEGf16 : MVE_VABSNEG_fp<"vneg", "f16", 0b01, 0b1>;
2808 def MVE_VNEGf32 : MVE_VABSNEG_fp<"vneg", "f32", 0b10, 0b1>;
2810 let Predicates = [HasMVEFloat] in {
2811 def : Pat<(v8f16 (fneg MQPR:$src)),
2812 (MVE_VNEGf16 MQPR:$src)>;
2813 def : Pat<(v4f32 (fneg MQPR:$src)),
2814 (MVE_VNEGf32 MQPR:$src)>;
2817 class MVE_VMAXMINNMA<string iname, string suffix, bit size, bit bit_12,
2818 list<dag> pattern=[]>
2819 : MVE_f<(outs MQPR:$Qd), (ins MQPR:$Qd_src, MQPR:$Qm),
2820 NoItinerary, iname, suffix, "$Qd, $Qm", vpred_n, "$Qd = $Qd_src",
2825 let Inst{28} = size;
2826 let Inst{25-23} = 0b100;
2827 let Inst{22} = Qd{3};
2828 let Inst{21-16} = 0b111111;
2829 let Inst{15-13} = Qd{2-0};
2830 let Inst{12} = bit_12;
2831 let Inst{11-6} = 0b111010;
2832 let Inst{5} = Qm{3};
2834 let Inst{3-1} = Qm{2-0};
2838 def MVE_VMAXNMAf32 : MVE_VMAXMINNMA<"vmaxnma", "f32", 0b0, 0b0>;
2839 def MVE_VMAXNMAf16 : MVE_VMAXMINNMA<"vmaxnma", "f16", 0b1, 0b0>;
2841 def MVE_VMINNMAf32 : MVE_VMAXMINNMA<"vminnma", "f32", 0b0, 0b1>;
2842 def MVE_VMINNMAf16 : MVE_VMAXMINNMA<"vminnma", "f16", 0b1, 0b1>;
2844 // end of MVE Floating Point instructions
2846 // start of MVE compares
2848 class MVE_VCMPqq<string suffix, bit bit_28, bits<2> bits_21_20,
2849 VCMPPredicateOperand predtype, list<dag> pattern=[]>
2850 : MVE_p<(outs VCCR:$P0), (ins MQPR:$Qn, MQPR:$Qm, predtype:$fc),
2851 NoItinerary, "vcmp", suffix, "$fc, $Qn, $Qm", vpred_n, "", pattern> {
2852 // Base class for comparing two vector registers
2857 let Inst{28} = bit_28;
2858 let Inst{25-22} = 0b1000;
2859 let Inst{21-20} = bits_21_20;
2860 let Inst{19-17} = Qn{2-0};
2861 let Inst{16-13} = 0b1000;
2862 let Inst{12} = fc{2};
2863 let Inst{11-8} = 0b1111;
2864 let Inst{7} = fc{0};
2866 let Inst{5} = Qm{3};
2868 let Inst{3-1} = Qm{2-0};
2869 let Inst{0} = fc{1};
2871 let Constraints = "";
2873 // We need a custom decoder method for these instructions because of
2874 // the output VCCR operand, which isn't encoded in the instruction
2875 // bits anywhere (there is only one choice for it) but has to be
2876 // included in the MC operands so that codegen will be able to track
2877 // its data flow between instructions, spill/reload it when
2878 // necessary, etc. There seems to be no way to get the Tablegen
2879 // decoder to emit an operand that isn't affected by any instruction
2881 let DecoderMethod = "DecodeMVEVCMP<false," # predtype.DecoderMethod # ">";
2884 class MVE_VCMPqqf<string suffix, bit size>
2885 : MVE_VCMPqq<suffix, size, 0b11, pred_basic_fp> {
2886 let Predicates = [HasMVEFloat];
2889 class MVE_VCMPqqi<string suffix, bits<2> size>
2890 : MVE_VCMPqq<suffix, 0b1, size, pred_basic_i> {
2895 class MVE_VCMPqqu<string suffix, bits<2> size>
2896 : MVE_VCMPqq<suffix, 0b1, size, pred_basic_u> {
2901 class MVE_VCMPqqs<string suffix, bits<2> size>
2902 : MVE_VCMPqq<suffix, 0b1, size, pred_basic_s> {
2906 def MVE_VCMPf32 : MVE_VCMPqqf<"f32", 0b0>;
2907 def MVE_VCMPf16 : MVE_VCMPqqf<"f16", 0b1>;
2909 def MVE_VCMPi8 : MVE_VCMPqqi<"i8", 0b00>;
2910 def MVE_VCMPi16 : MVE_VCMPqqi<"i16", 0b01>;
2911 def MVE_VCMPi32 : MVE_VCMPqqi<"i32", 0b10>;
2913 def MVE_VCMPu8 : MVE_VCMPqqu<"u8", 0b00>;
2914 def MVE_VCMPu16 : MVE_VCMPqqu<"u16", 0b01>;
2915 def MVE_VCMPu32 : MVE_VCMPqqu<"u32", 0b10>;
2917 def MVE_VCMPs8 : MVE_VCMPqqs<"s8", 0b00>;
2918 def MVE_VCMPs16 : MVE_VCMPqqs<"s16", 0b01>;
2919 def MVE_VCMPs32 : MVE_VCMPqqs<"s32", 0b10>;
2921 class MVE_VCMPqr<string suffix, bit bit_28, bits<2> bits_21_20,
2922 VCMPPredicateOperand predtype, list<dag> pattern=[]>
2923 : MVE_p<(outs VCCR:$P0), (ins MQPR:$Qn, GPRwithZR:$Rm, predtype:$fc),
2924 NoItinerary, "vcmp", suffix, "$fc, $Qn, $Rm", vpred_n, "", pattern> {
2925 // Base class for comparing a vector register with a scalar
2930 let Inst{28} = bit_28;
2931 let Inst{25-22} = 0b1000;
2932 let Inst{21-20} = bits_21_20;
2933 let Inst{19-17} = Qn{2-0};
2934 let Inst{16-13} = 0b1000;
2935 let Inst{12} = fc{2};
2936 let Inst{11-8} = 0b1111;
2937 let Inst{7} = fc{0};
2939 let Inst{5} = fc{1};
2941 let Inst{3-0} = Rm{3-0};
2943 let Constraints = "";
2944 // Custom decoder method, for the same reason as MVE_VCMPqq
2945 let DecoderMethod = "DecodeMVEVCMP<true," # predtype.DecoderMethod # ">";
2948 class MVE_VCMPqrf<string suffix, bit size>
2949 : MVE_VCMPqr<suffix, size, 0b11, pred_basic_fp> {
2950 let Predicates = [HasMVEFloat];
2953 class MVE_VCMPqri<string suffix, bits<2> size>
2954 : MVE_VCMPqr<suffix, 0b1, size, pred_basic_i> {
2959 class MVE_VCMPqru<string suffix, bits<2> size>
2960 : MVE_VCMPqr<suffix, 0b1, size, pred_basic_u> {
2965 class MVE_VCMPqrs<string suffix, bits<2> size>
2966 : MVE_VCMPqr<suffix, 0b1, size, pred_basic_s> {
2970 def MVE_VCMPf32r : MVE_VCMPqrf<"f32", 0b0>;
2971 def MVE_VCMPf16r : MVE_VCMPqrf<"f16", 0b1>;
2973 def MVE_VCMPi8r : MVE_VCMPqri<"i8", 0b00>;
2974 def MVE_VCMPi16r : MVE_VCMPqri<"i16", 0b01>;
2975 def MVE_VCMPi32r : MVE_VCMPqri<"i32", 0b10>;
2977 def MVE_VCMPu8r : MVE_VCMPqru<"u8", 0b00>;
2978 def MVE_VCMPu16r : MVE_VCMPqru<"u16", 0b01>;
2979 def MVE_VCMPu32r : MVE_VCMPqru<"u32", 0b10>;
2981 def MVE_VCMPs8r : MVE_VCMPqrs<"s8", 0b00>;
2982 def MVE_VCMPs16r : MVE_VCMPqrs<"s16", 0b01>;
2983 def MVE_VCMPs32r : MVE_VCMPqrs<"s32", 0b10>;
2985 multiclass unpred_vcmp_z<string suffix, int fc> {
2986 def i8 : Pat<(v16i1 (ARMvcmpz (v16i8 MQPR:$v1), (i32 fc))),
2987 (v16i1 (!cast<Instruction>("MVE_VCMP"#suffix#"8r") (v16i8 MQPR:$v1), ZR, fc))>;
2988 def i16 : Pat<(v8i1 (ARMvcmpz (v8i16 MQPR:$v1), (i32 fc))),
2989 (v8i1 (!cast<Instruction>("MVE_VCMP"#suffix#"16r") (v8i16 MQPR:$v1), ZR, fc))>;
2990 def i32 : Pat<(v4i1 (ARMvcmpz (v4i32 MQPR:$v1), (i32 fc))),
2991 (v4i1 (!cast<Instruction>("MVE_VCMP"#suffix#"32r") (v4i32 MQPR:$v1), ZR, fc))>;
2993 def : Pat<(v16i1 (and (v16i1 VCCR:$p1), (v16i1 (ARMvcmpz (v16i8 MQPR:$v1), (i32 fc))))),
2994 (v16i1 (!cast<Instruction>("MVE_VCMP"#suffix#"8r") (v16i8 MQPR:$v1), ZR, fc, 1, VCCR:$p1))>;
2995 def : Pat<(v8i1 (and (v8i1 VCCR:$p1), (v8i1 (ARMvcmpz (v8i16 MQPR:$v1), (i32 fc))))),
2996 (v8i1 (!cast<Instruction>("MVE_VCMP"#suffix#"16r") (v8i16 MQPR:$v1), ZR, fc, 1, VCCR:$p1))>;
2997 def : Pat<(v4i1 (and (v4i1 VCCR:$p1), (v4i1 (ARMvcmpz (v4i32 MQPR:$v1), (i32 fc))))),
2998 (v4i1 (!cast<Instruction>("MVE_VCMP"#suffix#"32r") (v4i32 MQPR:$v1), ZR, fc, 1, VCCR:$p1))>;
3001 multiclass unpred_vcmp_r<string suffix, int fc> {
3002 def i8 : Pat<(v16i1 (ARMvcmp (v16i8 MQPR:$v1), (v16i8 MQPR:$v2), (i32 fc))),
3003 (v16i1 (!cast<Instruction>("MVE_VCMP"#suffix#"8") (v16i8 MQPR:$v1), (v16i8 MQPR:$v2), fc))>;
3004 def i16 : Pat<(v8i1 (ARMvcmp (v8i16 MQPR:$v1), (v8i16 MQPR:$v2), (i32 fc))),
3005 (v8i1 (!cast<Instruction>("MVE_VCMP"#suffix#"16") (v8i16 MQPR:$v1), (v8i16 MQPR:$v2), fc))>;
3006 def i32 : Pat<(v4i1 (ARMvcmp (v4i32 MQPR:$v1), (v4i32 MQPR:$v2), (i32 fc))),
3007 (v4i1 (!cast<Instruction>("MVE_VCMP"#suffix#"32") (v4i32 MQPR:$v1), (v4i32 MQPR:$v2), fc))>;
3009 def i8r : Pat<(v16i1 (ARMvcmp (v16i8 MQPR:$v1), (v16i8 (ARMvdup GPR:$v2)), (i32 fc))),
3010 (v16i1 (!cast<Instruction>("MVE_VCMP"#suffix#"8r") (v16i8 MQPR:$v1), (i32 GPR:$v2), fc))>;
3011 def i16r : Pat<(v8i1 (ARMvcmp (v8i16 MQPR:$v1), (v8i16 (ARMvdup GPR:$v2)), (i32 fc))),
3012 (v8i1 (!cast<Instruction>("MVE_VCMP"#suffix#"16r") (v8i16 MQPR:$v1), (i32 GPR:$v2), fc))>;
3013 def i32r : Pat<(v4i1 (ARMvcmp (v4i32 MQPR:$v1), (v4i32 (ARMvdup GPR:$v2)), (i32 fc))),
3014 (v4i1 (!cast<Instruction>("MVE_VCMP"#suffix#"32r") (v4i32 MQPR:$v1), (i32 GPR:$v2), fc))>;
3016 def : Pat<(v16i1 (and (v16i1 VCCR:$p1), (v16i1 (ARMvcmp (v16i8 MQPR:$v1), (v16i8 MQPR:$v2), (i32 fc))))),
3017 (v16i1 (!cast<Instruction>("MVE_VCMP"#suffix#"8") (v16i8 MQPR:$v1), (v16i8 MQPR:$v2), fc, 1, VCCR:$p1))>;
3018 def : Pat<(v8i1 (and (v8i1 VCCR:$p1), (v8i1 (ARMvcmp (v8i16 MQPR:$v1), (v8i16 MQPR:$v2), (i32 fc))))),
3019 (v8i1 (!cast<Instruction>("MVE_VCMP"#suffix#"16") (v8i16 MQPR:$v1), (v8i16 MQPR:$v2), fc, 1, VCCR:$p1))>;
3020 def : Pat<(v4i1 (and (v4i1 VCCR:$p1), (v4i1 (ARMvcmp (v4i32 MQPR:$v1), (v4i32 MQPR:$v2), (i32 fc))))),
3021 (v4i1 (!cast<Instruction>("MVE_VCMP"#suffix#"32") (v4i32 MQPR:$v1), (v4i32 MQPR:$v2), fc, 1, VCCR:$p1))>;
3023 def : Pat<(v16i1 (and (v16i1 VCCR:$p1), (v16i1 (ARMvcmp (v16i8 MQPR:$v1), (v16i8 (ARMvdup GPR:$v2)), (i32 fc))))),
3024 (v16i1 (!cast<Instruction>("MVE_VCMP"#suffix#"8r") (v16i8 MQPR:$v1), (i32 GPR:$v2), fc, 1, VCCR:$p1))>;
3025 def : Pat<(v8i1 (and (v8i1 VCCR:$p1), (v8i1 (ARMvcmp (v8i16 MQPR:$v1), (v8i16 (ARMvdup GPR:$v2)), (i32 fc))))),
3026 (v8i1 (!cast<Instruction>("MVE_VCMP"#suffix#"16r") (v8i16 MQPR:$v1), (i32 GPR:$v2), fc, 1, VCCR:$p1))>;
3027 def : Pat<(v4i1 (and (v4i1 VCCR:$p1), (v4i1 (ARMvcmp (v4i32 MQPR:$v1), (v4i32 (ARMvdup GPR:$v2)), (i32 fc))))),
3028 (v4i1 (!cast<Instruction>("MVE_VCMP"#suffix#"32r") (v4i32 MQPR:$v1), (i32 GPR:$v2), fc, 1, VCCR:$p1))>;
3031 multiclass unpred_vcmpf_z<int fc> {
3032 def f16 : Pat<(v8i1 (ARMvcmpz (v8f16 MQPR:$v1), (i32 fc))),
3033 (v8i1 (MVE_VCMPf16r (v8f16 MQPR:$v1), ZR, fc))>;
3034 def f32 : Pat<(v4i1 (ARMvcmpz (v4f32 MQPR:$v1), (i32 fc))),
3035 (v4i1 (MVE_VCMPf32r (v4f32 MQPR:$v1), ZR, fc))>;
3037 def : Pat<(v8i1 (and (v8i1 VCCR:$p1), (v8i1 (ARMvcmpz (v8f16 MQPR:$v1), (i32 fc))))),
3038 (v8i1 (MVE_VCMPf32r (v8f16 MQPR:$v1), ZR, fc, 1, VCCR:$p1))>;
3039 def : Pat<(v4i1 (and (v4i1 VCCR:$p1), (v4i1 (ARMvcmpz (v4f32 MQPR:$v1), (i32 fc))))),
3040 (v4i1 (MVE_VCMPf32r (v4f32 MQPR:$v1), ZR, fc, 1, VCCR:$p1))>;
3043 multiclass unpred_vcmpf_r<int fc> {
3044 def f16 : Pat<(v8i1 (ARMvcmp (v8f16 MQPR:$v1), (v8f16 MQPR:$v2), (i32 fc))),
3045 (v8i1 (MVE_VCMPf16 (v8f16 MQPR:$v1), (v8f16 MQPR:$v2), fc))>;
3046 def f32 : Pat<(v4i1 (ARMvcmp (v4f32 MQPR:$v1), (v4f32 MQPR:$v2), (i32 fc))),
3047 (v4i1 (MVE_VCMPf32 (v4f32 MQPR:$v1), (v4f32 MQPR:$v2), fc))>;
3049 def f16r : Pat<(v8i1 (ARMvcmp (v8f16 MQPR:$v1), (v8f16 (ARMvdup HPR:$v2)), (i32 fc))),
3050 (v8i1 (MVE_VCMPf16r (v8f16 MQPR:$v1), (i32 (COPY_TO_REGCLASS (f16 HPR:$v2), rGPR)), fc))>;
3051 def f32r : Pat<(v4i1 (ARMvcmp (v4f32 MQPR:$v1), (v4f32 (ARMvdup SPR:$v2)), (i32 fc))),
3052 (v4i1 (MVE_VCMPf32r (v4f32 MQPR:$v1), (i32 (COPY_TO_REGCLASS (f32 SPR:$v2), rGPR)), fc))>;
3054 def : Pat<(v8i1 (and (v8i1 VCCR:$p1), (v8i1 (ARMvcmp (v8f16 MQPR:$v1), (v8f16 MQPR:$v2), (i32 fc))))),
3055 (v8i1 (MVE_VCMPf16 (v8f16 MQPR:$v1), (v8f16 MQPR:$v2), fc, 1, VCCR:$p1))>;
3056 def : Pat<(v4i1 (and (v4i1 VCCR:$p1), (v4i1 (ARMvcmp (v4f32 MQPR:$v1), (v4f32 MQPR:$v2), (i32 fc))))),
3057 (v4i1 (MVE_VCMPf32 (v4f32 MQPR:$v1), (v4f32 MQPR:$v2), fc, 1, VCCR:$p1))>;
3059 def : Pat<(v8i1 (and (v8i1 VCCR:$p1), (v8i1 (ARMvcmp (v8f16 MQPR:$v1), (v8f16 (ARMvdup HPR:$v2)), (i32 fc))))),
3060 (v8i1 (MVE_VCMPf16r (v8f16 MQPR:$v1), (i32 (COPY_TO_REGCLASS (f16 HPR:$v2), rGPR)), fc, 1, VCCR:$p1))>;
3061 def : Pat<(v4i1 (and (v4i1 VCCR:$p1), (v4i1 (ARMvcmp (v4f32 MQPR:$v1), (v4f32 (ARMvdup SPR:$v2)), (i32 fc))))),
3062 (v4i1 (MVE_VCMPf32r (v4f32 MQPR:$v1), (i32 (COPY_TO_REGCLASS (f32 SPR:$v2), rGPR)), fc, 1, VCCR:$p1))>;
3065 let Predicates = [HasMVEInt] in {
3066 defm MVE_VCEQZ : unpred_vcmp_z<"i", 0>;
3067 defm MVE_VCNEZ : unpred_vcmp_z<"i", 1>;
3068 defm MVE_VCGEZ : unpred_vcmp_z<"s", 10>;
3069 defm MVE_VCLTZ : unpred_vcmp_z<"s", 11>;
3070 defm MVE_VCGTZ : unpred_vcmp_z<"s", 12>;
3071 defm MVE_VCLEZ : unpred_vcmp_z<"s", 13>;
3072 defm MVE_VCGTUZ : unpred_vcmp_z<"u", 8>;
3073 defm MVE_VCGEUZ : unpred_vcmp_z<"u", 2>;
3075 defm MVE_VCEQ : unpred_vcmp_r<"i", 0>;
3076 defm MVE_VCNE : unpred_vcmp_r<"i", 1>;
3077 defm MVE_VCGE : unpred_vcmp_r<"s", 10>;
3078 defm MVE_VCLT : unpred_vcmp_r<"s", 11>;
3079 defm MVE_VCGT : unpred_vcmp_r<"s", 12>;
3080 defm MVE_VCLE : unpred_vcmp_r<"s", 13>;
3081 defm MVE_VCGTU : unpred_vcmp_r<"u", 8>;
3082 defm MVE_VCGEU : unpred_vcmp_r<"u", 2>;
3085 let Predicates = [HasMVEFloat] in {
3086 defm MVE_VFCEQZ : unpred_vcmpf_z<0>;
3087 defm MVE_VFCNEZ : unpred_vcmpf_z<1>;
3088 defm MVE_VFCGEZ : unpred_vcmpf_z<10>;
3089 defm MVE_VFCLTZ : unpred_vcmpf_z<11>;
3090 defm MVE_VFCGTZ : unpred_vcmpf_z<12>;
3091 defm MVE_VFCLEZ : unpred_vcmpf_z<13>;
3093 defm MVE_VFCEQ : unpred_vcmpf_r<0>;
3094 defm MVE_VFCNE : unpred_vcmpf_r<1>;
3095 defm MVE_VFCGE : unpred_vcmpf_r<10>;
3096 defm MVE_VFCLT : unpred_vcmpf_r<11>;
3097 defm MVE_VFCGT : unpred_vcmpf_r<12>;
3098 defm MVE_VFCLE : unpred_vcmpf_r<13>;
3102 // Extra "worst case" and/or/xor partterns, going into and out of GRP
3103 multiclass two_predops<SDPatternOperator opnode, Instruction insn> {
3104 def v16i1 : Pat<(v16i1 (opnode (v16i1 VCCR:$p1), (v16i1 VCCR:$p2))),
3105 (v16i1 (COPY_TO_REGCLASS
3106 (insn (i32 (COPY_TO_REGCLASS (v16i1 VCCR:$p1), rGPR)),
3107 (i32 (COPY_TO_REGCLASS (v16i1 VCCR:$p2), rGPR))),
3109 def v8i1 : Pat<(v8i1 (opnode (v8i1 VCCR:$p1), (v8i1 VCCR:$p2))),
3110 (v8i1 (COPY_TO_REGCLASS
3111 (insn (i32 (COPY_TO_REGCLASS (v8i1 VCCR:$p1), rGPR)),
3112 (i32 (COPY_TO_REGCLASS (v8i1 VCCR:$p2), rGPR))),
3114 def v4i1 : Pat<(v4i1 (opnode (v4i1 VCCR:$p1), (v4i1 VCCR:$p2))),
3115 (v4i1 (COPY_TO_REGCLASS
3116 (insn (i32 (COPY_TO_REGCLASS (v4i1 VCCR:$p1), rGPR)),
3117 (i32 (COPY_TO_REGCLASS (v4i1 VCCR:$p2), rGPR))),
3121 let Predicates = [HasMVEInt] in {
3122 defm POR : two_predops<or, t2ORRrr>;
3123 defm PAND : two_predops<and, t2ANDrr>;
3124 defm PEOR : two_predops<xor, t2EORrr>;
3127 // Occasionally we need to cast between a i32 and a boolean vector, for
3128 // example when moving between rGPR and VPR.P0 as part of predicate vector
3129 // shuffles. We also sometimes need to cast between different predicate
3130 // vector types (v4i1<>v8i1, etc.) also as part of lowering vector shuffles.
3132 def predicate_cast : SDNode<"ARMISD::PREDICATE_CAST", SDTUnaryOp>;
3134 let Predicates = [HasMVEInt] in {
3135 foreach VT = [ v4i1, v8i1, v16i1 ] in {
3136 def : Pat<(i32 (predicate_cast (VT VCCR:$src))),
3137 (i32 (COPY_TO_REGCLASS (VT VCCR:$src), VCCR))>;
3138 def : Pat<(VT (predicate_cast (i32 VCCR:$src))),
3139 (VT (COPY_TO_REGCLASS (i32 VCCR:$src), VCCR))>;
3141 foreach VT2 = [ v4i1, v8i1, v16i1 ] in
3142 def : Pat<(VT (predicate_cast (VT2 VCCR:$src))),
3143 (VT (COPY_TO_REGCLASS (VT2 VCCR:$src), VCCR))>;
3147 // end of MVE compares
3149 // start of MVE_qDest_qSrc
3151 class MVE_qDest_qSrc<string iname, string suffix, dag oops, dag iops,
3152 string ops, vpred_ops vpred, string cstr,
3153 list<dag> pattern=[]>
3154 : MVE_p<oops, iops, NoItinerary, iname, suffix,
3155 ops, vpred, cstr, pattern> {
3159 let Inst{25-23} = 0b100;
3160 let Inst{22} = Qd{3};
3161 let Inst{15-13} = Qd{2-0};
3162 let Inst{11-9} = 0b111;
3164 let Inst{5} = Qm{3};
3166 let Inst{3-1} = Qm{2-0};
3169 class MVE_VQxDMLxDH<string iname, bit exch, bit round, bit subtract,
3170 string suffix, bits<2> size, list<dag> pattern=[]>
3171 : MVE_qDest_qSrc<iname, suffix, (outs MQPR:$Qd),
3172 (ins MQPR:$Qd_src, MQPR:$Qn, MQPR:$Qm), "$Qd, $Qn, $Qm",
3173 vpred_n, "$Qd = $Qd_src", pattern> {
3176 let Inst{28} = subtract;
3177 let Inst{21-20} = size;
3178 let Inst{19-17} = Qn{2-0};
3180 let Inst{12} = exch;
3182 let Inst{7} = Qn{3};
3183 let Inst{0} = round;
3186 multiclass MVE_VQxDMLxDH_multi<string iname, bit exch,
3187 bit round, bit subtract> {
3188 def s8 : MVE_VQxDMLxDH<iname, exch, round, subtract, "s8", 0b00>;
3189 def s16 : MVE_VQxDMLxDH<iname, exch, round, subtract, "s16", 0b01>;
3190 def s32 : MVE_VQxDMLxDH<iname, exch, round, subtract, "s32", 0b10>;
3193 defm MVE_VQDMLADH : MVE_VQxDMLxDH_multi<"vqdmladh", 0b0, 0b0, 0b0>;
3194 defm MVE_VQDMLADHX : MVE_VQxDMLxDH_multi<"vqdmladhx", 0b1, 0b0, 0b0>;
3195 defm MVE_VQRDMLADH : MVE_VQxDMLxDH_multi<"vqrdmladh", 0b0, 0b1, 0b0>;
3196 defm MVE_VQRDMLADHX : MVE_VQxDMLxDH_multi<"vqrdmladhx", 0b1, 0b1, 0b0>;
3197 defm MVE_VQDMLSDH : MVE_VQxDMLxDH_multi<"vqdmlsdh", 0b0, 0b0, 0b1>;
3198 defm MVE_VQDMLSDHX : MVE_VQxDMLxDH_multi<"vqdmlsdhx", 0b1, 0b0, 0b1>;
3199 defm MVE_VQRDMLSDH : MVE_VQxDMLxDH_multi<"vqrdmlsdh", 0b0, 0b1, 0b1>;
3200 defm MVE_VQRDMLSDHX : MVE_VQxDMLxDH_multi<"vqrdmlsdhx", 0b1, 0b1, 0b1>;
3202 class MVE_VCMUL<string iname, string suffix, bit size, list<dag> pattern=[]>
3203 : MVE_qDest_qSrc<iname, suffix, (outs MQPR:$Qd),
3204 (ins MQPR:$Qn, MQPR:$Qm, complexrotateop:$rot),
3205 "$Qd, $Qn, $Qm, $rot", vpred_r, "", pattern> {
3209 let Inst{28} = size;
3210 let Inst{21-20} = 0b11;
3211 let Inst{19-17} = Qn{2-0};
3213 let Inst{12} = rot{1};
3215 let Inst{7} = Qn{3};
3216 let Inst{0} = rot{0};
3218 let Predicates = [HasMVEFloat];
3221 def MVE_VCMULf16 : MVE_VCMUL<"vcmul", "f16", 0b0>;
3222 def MVE_VCMULf32 : MVE_VCMUL<"vcmul", "f32", 0b1>;
3224 class MVE_VMULL<string iname, string suffix, bit bit_28, bits<2> bits_21_20,
3225 bit T, list<dag> pattern=[]>
3226 : MVE_qDest_qSrc<iname, suffix, (outs MQPR:$Qd),
3227 (ins MQPR:$Qn, MQPR:$Qm), "$Qd, $Qn, $Qm",
3228 vpred_r, "", pattern> {
3233 let Inst{28} = bit_28;
3234 let Inst{21-20} = bits_21_20;
3235 let Inst{19-17} = Qn{2-0};
3239 let Inst{7} = Qn{3};
3243 multiclass MVE_VMULL_multi<string iname, string suffix,
3244 bit bit_28, bits<2> bits_21_20> {
3245 def bh : MVE_VMULL<iname # "b", suffix, bit_28, bits_21_20, 0b0>;
3246 def th : MVE_VMULL<iname # "t", suffix, bit_28, bits_21_20, 0b1>;
3249 // For integer multiplies, bits 21:20 encode size, and bit 28 signedness.
3250 // For polynomial multiplies, bits 21:20 take the unused value 0b11, and
3251 // bit 28 switches to encoding the size.
3253 defm MVE_VMULLs8 : MVE_VMULL_multi<"vmull", "s8", 0b0, 0b00>;
3254 defm MVE_VMULLs16 : MVE_VMULL_multi<"vmull", "s16", 0b0, 0b01>;
3255 defm MVE_VMULLs32 : MVE_VMULL_multi<"vmull", "s32", 0b0, 0b10>;
3256 defm MVE_VMULLu8 : MVE_VMULL_multi<"vmull", "u8", 0b1, 0b00>;
3257 defm MVE_VMULLu16 : MVE_VMULL_multi<"vmull", "u16", 0b1, 0b01>;
3258 defm MVE_VMULLu32 : MVE_VMULL_multi<"vmull", "u32", 0b1, 0b10>;
3259 defm MVE_VMULLp8 : MVE_VMULL_multi<"vmull", "p8", 0b0, 0b11>;
3260 defm MVE_VMULLp16 : MVE_VMULL_multi<"vmull", "p16", 0b1, 0b11>;
3262 class MVE_VxMULH<string iname, string suffix, bit U, bits<2> size,
3263 bit round, list<dag> pattern=[]>
3264 : MVE_qDest_qSrc<iname, suffix, (outs MQPR:$Qd),
3265 (ins MQPR:$Qn, MQPR:$Qm), "$Qd, $Qn, $Qm",
3266 vpred_r, "", pattern> {
3270 let Inst{21-20} = size;
3271 let Inst{19-17} = Qn{2-0};
3273 let Inst{12} = round;
3275 let Inst{7} = Qn{3};
3279 def MVE_VMULHs8 : MVE_VxMULH<"vmulh", "s8", 0b0, 0b00, 0b0>;
3280 def MVE_VMULHs16 : MVE_VxMULH<"vmulh", "s16", 0b0, 0b01, 0b0>;
3281 def MVE_VMULHs32 : MVE_VxMULH<"vmulh", "s32", 0b0, 0b10, 0b0>;
3282 def MVE_VMULHu8 : MVE_VxMULH<"vmulh", "u8", 0b1, 0b00, 0b0>;
3283 def MVE_VMULHu16 : MVE_VxMULH<"vmulh", "u16", 0b1, 0b01, 0b0>;
3284 def MVE_VMULHu32 : MVE_VxMULH<"vmulh", "u32", 0b1, 0b10, 0b0>;
3286 def MVE_VRMULHs8 : MVE_VxMULH<"vrmulh", "s8", 0b0, 0b00, 0b1>;
3287 def MVE_VRMULHs16 : MVE_VxMULH<"vrmulh", "s16", 0b0, 0b01, 0b1>;
3288 def MVE_VRMULHs32 : MVE_VxMULH<"vrmulh", "s32", 0b0, 0b10, 0b1>;
3289 def MVE_VRMULHu8 : MVE_VxMULH<"vrmulh", "u8", 0b1, 0b00, 0b1>;
3290 def MVE_VRMULHu16 : MVE_VxMULH<"vrmulh", "u16", 0b1, 0b01, 0b1>;
3291 def MVE_VRMULHu32 : MVE_VxMULH<"vrmulh", "u32", 0b1, 0b10, 0b1>;
3293 class MVE_VxMOVxN<string iname, string suffix, bit bit_28, bit bit_17,
3294 bits<2> size, bit T, list<dag> pattern=[]>
3295 : MVE_qDest_qSrc<iname, suffix, (outs MQPR:$Qd),
3296 (ins MQPR:$Qd_src, MQPR:$Qm), "$Qd, $Qm",
3297 vpred_n, "$Qd = $Qd_src", pattern> {
3299 let Inst{28} = bit_28;
3300 let Inst{21-20} = 0b11;
3301 let Inst{19-18} = size;
3302 let Inst{17} = bit_17;
3306 let Inst{7} = !if(!eq(bit_17, 0), 1, 0);
3310 multiclass MVE_VxMOVxN_halves<string iname, string suffix,
3311 bit bit_28, bit bit_17, bits<2> size> {
3312 def bh : MVE_VxMOVxN<iname # "b", suffix, bit_28, bit_17, size, 0b0>;
3313 def th : MVE_VxMOVxN<iname # "t", suffix, bit_28, bit_17, size, 0b1>;
3316 defm MVE_VMOVNi16 : MVE_VxMOVxN_halves<"vmovn", "i16", 0b1, 0b0, 0b00>;
3317 defm MVE_VMOVNi32 : MVE_VxMOVxN_halves<"vmovn", "i32", 0b1, 0b0, 0b01>;
3318 defm MVE_VQMOVNs16 : MVE_VxMOVxN_halves<"vqmovn", "s16", 0b0, 0b1, 0b00>;
3319 defm MVE_VQMOVNs32 : MVE_VxMOVxN_halves<"vqmovn", "s32", 0b0, 0b1, 0b01>;
3320 defm MVE_VQMOVNu16 : MVE_VxMOVxN_halves<"vqmovn", "u16", 0b1, 0b1, 0b00>;
3321 defm MVE_VQMOVNu32 : MVE_VxMOVxN_halves<"vqmovn", "u32", 0b1, 0b1, 0b01>;
3322 defm MVE_VQMOVUNs16 : MVE_VxMOVxN_halves<"vqmovun", "s16", 0b0, 0b0, 0b00>;
3323 defm MVE_VQMOVUNs32 : MVE_VxMOVxN_halves<"vqmovun", "s32", 0b0, 0b0, 0b01>;
3325 class MVE_VCVT_ff<string iname, string suffix, bit op, bit T,
3326 list<dag> pattern=[]>
3327 : MVE_qDest_qSrc<iname, suffix, (outs MQPR:$Qd), (ins MQPR:$Qd_src, MQPR:$Qm),
3328 "$Qd, $Qm", vpred_n, "$Qd = $Qd_src", pattern> {
3330 let Inst{21-16} = 0b111111;
3332 let Inst{8-7} = 0b00;
3335 let Predicates = [HasMVEFloat];
3338 multiclass MVE_VCVT_ff_halves<string suffix, bit op> {
3339 def bh : MVE_VCVT_ff<"vcvtb", suffix, op, 0b0>;
3340 def th : MVE_VCVT_ff<"vcvtt", suffix, op, 0b1>;
3343 defm MVE_VCVTf16f32 : MVE_VCVT_ff_halves<"f16.f32", 0b0>;
3344 defm MVE_VCVTf32f16 : MVE_VCVT_ff_halves<"f32.f16", 0b1>;
3346 class MVE_VxCADD<string iname, string suffix, bits<2> size, bit halve,
3347 list<dag> pattern=[]>
3348 : MVE_qDest_qSrc<iname, suffix, (outs MQPR:$Qd),
3349 (ins MQPR:$Qn, MQPR:$Qm, complexrotateopodd:$rot),
3350 "$Qd, $Qn, $Qm, $rot", vpred_r, "",
3355 let Inst{28} = halve;
3356 let Inst{21-20} = size;
3357 let Inst{19-17} = Qn{2-0};
3361 let Inst{7} = Qn{3};
3365 def MVE_VCADDi8 : MVE_VxCADD<"vcadd", "i8", 0b00, 0b1>;
3366 def MVE_VCADDi16 : MVE_VxCADD<"vcadd", "i16", 0b01, 0b1>;
3367 def MVE_VCADDi32 : MVE_VxCADD<"vcadd", "i32", 0b10, 0b1>;
3369 def MVE_VHCADDs8 : MVE_VxCADD<"vhcadd", "s8", 0b00, 0b0>;
3370 def MVE_VHCADDs16 : MVE_VxCADD<"vhcadd", "s16", 0b01, 0b0>;
3371 def MVE_VHCADDs32 : MVE_VxCADD<"vhcadd", "s32", 0b10, 0b0>;
3373 class MVE_VADCSBC<string iname, bit I, bit subtract,
3374 dag carryin, list<dag> pattern=[]>
3375 : MVE_qDest_qSrc<iname, "i32", (outs MQPR:$Qd, cl_FPSCR_NZCV:$carryout),
3376 !con((ins MQPR:$Qn, MQPR:$Qm), carryin),
3377 "$Qd, $Qn, $Qm", vpred_r, "", pattern> {
3380 let Inst{28} = subtract;
3381 let Inst{21-20} = 0b11;
3382 let Inst{19-17} = Qn{2-0};
3386 let Inst{7} = Qn{3};
3389 // Custom decoder method in order to add the FPSCR operand(s), which
3390 // Tablegen won't do right
3391 let DecoderMethod = "DecodeMVEVADCInstruction";
3394 def MVE_VADC : MVE_VADCSBC<"vadc", 0b0, 0b0, (ins cl_FPSCR_NZCV:$carryin)>;
3395 def MVE_VADCI : MVE_VADCSBC<"vadci", 0b1, 0b0, (ins)>;
3397 def MVE_VSBC : MVE_VADCSBC<"vsbc", 0b0, 0b1, (ins cl_FPSCR_NZCV:$carryin)>;
3398 def MVE_VSBCI : MVE_VADCSBC<"vsbci", 0b1, 0b1, (ins)>;
3400 class MVE_VQDMULL<string iname, string suffix, bit size, bit T,
3401 list<dag> pattern=[]>
3402 : MVE_qDest_qSrc<iname, suffix, (outs MQPR:$Qd),
3403 (ins MQPR:$Qn, MQPR:$Qm), "$Qd, $Qn, $Qm",
3404 vpred_r, "", pattern> {
3407 let Inst{28} = size;
3408 let Inst{21-20} = 0b11;
3409 let Inst{19-17} = Qn{2-0};
3413 let Inst{7} = Qn{3};
3417 multiclass MVE_VQDMULL_halves<string suffix, bit size> {
3418 def bh : MVE_VQDMULL<"vqdmullb", suffix, size, 0b0>;
3419 def th : MVE_VQDMULL<"vqdmullt", suffix, size, 0b1>;
3422 defm MVE_VQDMULLs16 : MVE_VQDMULL_halves<"s16", 0b0>;
3423 defm MVE_VQDMULLs32 : MVE_VQDMULL_halves<"s32", 0b1>;
3425 // end of mve_qDest_qSrc
3427 // start of mve_qDest_rSrc
3429 class MVE_qr_base<dag oops, dag iops, InstrItinClass itin, string iname,
3430 string suffix, string ops, vpred_ops vpred, string cstr,
3431 list<dag> pattern=[]>
3432 : MVE_p<oops, iops, NoItinerary, iname, suffix, ops, vpred, cstr, pattern> {
3437 let Inst{25-23} = 0b100;
3438 let Inst{22} = Qd{3};
3439 let Inst{19-17} = Qn{2-0};
3440 let Inst{15-13} = Qd{2-0};
3441 let Inst{11-9} = 0b111;
3442 let Inst{7} = Qn{3};
3445 let Inst{3-0} = Rm{3-0};
3448 class MVE_qDest_rSrc<string iname, string suffix, list<dag> pattern=[]>
3449 : MVE_qr_base<(outs MQPR:$Qd), (ins MQPR:$Qn, rGPR:$Rm),
3450 NoItinerary, iname, suffix, "$Qd, $Qn, $Rm", vpred_r, "",
3453 class MVE_qDestSrc_rSrc<string iname, string suffix, list<dag> pattern=[]>
3454 : MVE_qr_base<(outs MQPR:$Qd), (ins MQPR:$Qd_src, MQPR:$Qn, rGPR:$Rm),
3455 NoItinerary, iname, suffix, "$Qd, $Qn, $Rm", vpred_n, "$Qd = $Qd_src",
3458 class MVE_qDest_single_rSrc<string iname, string suffix, list<dag> pattern=[]>
3459 : MVE_p<(outs MQPR:$Qd), (ins MQPR:$Qd_src, rGPR:$Rm), NoItinerary, iname,
3460 suffix, "$Qd, $Rm", vpred_n, "$Qd = $Qd_src", pattern> {
3464 let Inst{22} = Qd{3};
3465 let Inst{15-13} = Qd{2-0};
3466 let Inst{3-0} = Rm{3-0};
3469 class MVE_VADDSUB_qr<string iname, string suffix, bits<2> size,
3470 bit bit_5, bit bit_12, bit bit_16,
3471 bit bit_28, list<dag> pattern=[]>
3472 : MVE_qDest_rSrc<iname, suffix, pattern> {
3474 let Inst{28} = bit_28;
3475 let Inst{21-20} = size;
3476 let Inst{16} = bit_16;
3477 let Inst{12} = bit_12;
3479 let Inst{5} = bit_5;
3482 multiclass MVE_VADDSUB_qr_sizes<string iname, string suffix,
3483 bit bit_5, bit bit_12, bit bit_16,
3484 bit bit_28, list<dag> pattern=[]> {
3485 def "8" : MVE_VADDSUB_qr<iname, suffix#"8", 0b00,
3486 bit_5, bit_12, bit_16, bit_28>;
3487 def "16" : MVE_VADDSUB_qr<iname, suffix#"16", 0b01,
3488 bit_5, bit_12, bit_16, bit_28>;
3489 def "32" : MVE_VADDSUB_qr<iname, suffix#"32", 0b10,
3490 bit_5, bit_12, bit_16, bit_28>;
3493 defm MVE_VADD_qr_i : MVE_VADDSUB_qr_sizes<"vadd", "i", 0b0, 0b0, 0b1, 0b0>;
3494 defm MVE_VQADD_qr_s : MVE_VADDSUB_qr_sizes<"vqadd", "s", 0b1, 0b0, 0b0, 0b0>;
3495 defm MVE_VQADD_qr_u : MVE_VADDSUB_qr_sizes<"vqadd", "u", 0b1, 0b0, 0b0, 0b1>;
3497 defm MVE_VSUB_qr_i : MVE_VADDSUB_qr_sizes<"vsub", "i", 0b0, 0b1, 0b1, 0b0>;
3498 defm MVE_VQSUB_qr_s : MVE_VADDSUB_qr_sizes<"vqsub", "s", 0b1, 0b1, 0b0, 0b0>;
3499 defm MVE_VQSUB_qr_u : MVE_VADDSUB_qr_sizes<"vqsub", "u", 0b1, 0b1, 0b0, 0b1>;
3501 class MVE_VQDMULL_qr<string iname, string suffix, bit size,
3502 bit T, list<dag> pattern=[]>
3503 : MVE_qDest_rSrc<iname, suffix, pattern> {
3505 let Inst{28} = size;
3506 let Inst{21-20} = 0b11;
3513 multiclass MVE_VQDMULL_qr_halves<string suffix, bit size> {
3514 def bh : MVE_VQDMULL_qr<"vqdmullb", suffix, size, 0b0>;
3515 def th : MVE_VQDMULL_qr<"vqdmullt", suffix, size, 0b1>;
3518 defm MVE_VQDMULL_qr_s16 : MVE_VQDMULL_qr_halves<"s16", 0b0>;
3519 defm MVE_VQDMULL_qr_s32 : MVE_VQDMULL_qr_halves<"s32", 0b1>;
3521 class MVE_VxADDSUB_qr<string iname, string suffix,
3522 bit bit_28, bits<2> bits_21_20, bit subtract,
3523 list<dag> pattern=[]>
3524 : MVE_qDest_rSrc<iname, suffix, pattern> {
3526 let Inst{28} = bit_28;
3527 let Inst{21-20} = bits_21_20;
3529 let Inst{12} = subtract;
3534 def MVE_VHADD_qr_s8 : MVE_VxADDSUB_qr<"vhadd", "s8", 0b0, 0b00, 0b0>;
3535 def MVE_VHADD_qr_s16 : MVE_VxADDSUB_qr<"vhadd", "s16", 0b0, 0b01, 0b0>;
3536 def MVE_VHADD_qr_s32 : MVE_VxADDSUB_qr<"vhadd", "s32", 0b0, 0b10, 0b0>;
3537 def MVE_VHADD_qr_u8 : MVE_VxADDSUB_qr<"vhadd", "u8", 0b1, 0b00, 0b0>;
3538 def MVE_VHADD_qr_u16 : MVE_VxADDSUB_qr<"vhadd", "u16", 0b1, 0b01, 0b0>;
3539 def MVE_VHADD_qr_u32 : MVE_VxADDSUB_qr<"vhadd", "u32", 0b1, 0b10, 0b0>;
3541 def MVE_VHSUB_qr_s8 : MVE_VxADDSUB_qr<"vhsub", "s8", 0b0, 0b00, 0b1>;
3542 def MVE_VHSUB_qr_s16 : MVE_VxADDSUB_qr<"vhsub", "s16", 0b0, 0b01, 0b1>;
3543 def MVE_VHSUB_qr_s32 : MVE_VxADDSUB_qr<"vhsub", "s32", 0b0, 0b10, 0b1>;
3544 def MVE_VHSUB_qr_u8 : MVE_VxADDSUB_qr<"vhsub", "u8", 0b1, 0b00, 0b1>;
3545 def MVE_VHSUB_qr_u16 : MVE_VxADDSUB_qr<"vhsub", "u16", 0b1, 0b01, 0b1>;
3546 def MVE_VHSUB_qr_u32 : MVE_VxADDSUB_qr<"vhsub", "u32", 0b1, 0b10, 0b1>;
3548 let Predicates = [HasMVEFloat] in {
3549 def MVE_VADD_qr_f32 : MVE_VxADDSUB_qr<"vadd", "f32", 0b0, 0b11, 0b0>;
3550 def MVE_VADD_qr_f16 : MVE_VxADDSUB_qr<"vadd", "f16", 0b1, 0b11, 0b0>;
3552 def MVE_VSUB_qr_f32 : MVE_VxADDSUB_qr<"vsub", "f32", 0b0, 0b11, 0b1>;
3553 def MVE_VSUB_qr_f16 : MVE_VxADDSUB_qr<"vsub", "f16", 0b1, 0b11, 0b1>;
3556 class MVE_VxSHL_qr<string iname, string suffix, bit U, bits<2> size,
3557 bit bit_7, bit bit_17, list<dag> pattern=[]>
3558 : MVE_qDest_single_rSrc<iname, suffix, pattern> {
3561 let Inst{25-23} = 0b100;
3562 let Inst{21-20} = 0b11;
3563 let Inst{19-18} = size;
3564 let Inst{17} = bit_17;
3566 let Inst{12-8} = 0b11110;
3567 let Inst{7} = bit_7;
3568 let Inst{6-4} = 0b110;
3571 multiclass MVE_VxSHL_qr_types<string iname, bit bit_7, bit bit_17> {
3572 def s8 : MVE_VxSHL_qr<iname, "s8", 0b0, 0b00, bit_7, bit_17>;
3573 def s16 : MVE_VxSHL_qr<iname, "s16", 0b0, 0b01, bit_7, bit_17>;
3574 def s32 : MVE_VxSHL_qr<iname, "s32", 0b0, 0b10, bit_7, bit_17>;
3575 def u8 : MVE_VxSHL_qr<iname, "u8", 0b1, 0b00, bit_7, bit_17>;
3576 def u16 : MVE_VxSHL_qr<iname, "u16", 0b1, 0b01, bit_7, bit_17>;
3577 def u32 : MVE_VxSHL_qr<iname, "u32", 0b1, 0b10, bit_7, bit_17>;
3580 defm MVE_VSHL_qr : MVE_VxSHL_qr_types<"vshl", 0b0, 0b0>;
3581 defm MVE_VRSHL_qr : MVE_VxSHL_qr_types<"vrshl", 0b0, 0b1>;
3582 defm MVE_VQSHL_qr : MVE_VxSHL_qr_types<"vqshl", 0b1, 0b0>;
3583 defm MVE_VQRSHL_qr : MVE_VxSHL_qr_types<"vqrshl", 0b1, 0b1>;
3585 let Predicates = [HasMVEInt] in {
3586 def : Pat<(v4i32 (ARMvshlu (v4i32 MQPR:$Qm), (v4i32 (ARMvdup GPR:$Rm)))),
3587 (v4i32 (MVE_VSHL_qru32 (v4i32 MQPR:$Qm), GPR:$Rm))>;
3588 def : Pat<(v8i16 (ARMvshlu (v8i16 MQPR:$Qm), (v8i16 (ARMvdup GPR:$Rm)))),
3589 (v8i16 (MVE_VSHL_qru16 (v8i16 MQPR:$Qm), GPR:$Rm))>;
3590 def : Pat<(v16i8 (ARMvshlu (v16i8 MQPR:$Qm), (v16i8 (ARMvdup GPR:$Rm)))),
3591 (v16i8 (MVE_VSHL_qru8 (v16i8 MQPR:$Qm), GPR:$Rm))>;
3593 def : Pat<(v4i32 (ARMvshls (v4i32 MQPR:$Qm), (v4i32 (ARMvdup GPR:$Rm)))),
3594 (v4i32 (MVE_VSHL_qrs32 (v4i32 MQPR:$Qm), GPR:$Rm))>;
3595 def : Pat<(v8i16 (ARMvshls (v8i16 MQPR:$Qm), (v8i16 (ARMvdup GPR:$Rm)))),
3596 (v8i16 (MVE_VSHL_qrs16 (v8i16 MQPR:$Qm), GPR:$Rm))>;
3597 def : Pat<(v16i8 (ARMvshls (v16i8 MQPR:$Qm), (v16i8 (ARMvdup GPR:$Rm)))),
3598 (v16i8 (MVE_VSHL_qrs8 (v16i8 MQPR:$Qm), GPR:$Rm))>;
3601 class MVE_VBRSR<string iname, string suffix, bits<2> size, list<dag> pattern=[]>
3602 : MVE_qDest_rSrc<iname, suffix, pattern> {
3605 let Inst{21-20} = size;
3612 def MVE_VBRSR8 : MVE_VBRSR<"vbrsr", "8", 0b00>;
3613 def MVE_VBRSR16 : MVE_VBRSR<"vbrsr", "16", 0b01>;
3614 def MVE_VBRSR32 : MVE_VBRSR<"vbrsr", "32", 0b10>;
3616 class MVE_VMUL_qr_int<string iname, string suffix,
3617 bits<2> size, list<dag> pattern=[]>
3618 : MVE_qDest_rSrc<iname, suffix, pattern> {
3621 let Inst{21-20} = size;
3628 def MVE_VMUL_qr_i8 : MVE_VMUL_qr_int<"vmul", "i8", 0b00>;
3629 def MVE_VMUL_qr_i16 : MVE_VMUL_qr_int<"vmul", "i16", 0b01>;
3630 def MVE_VMUL_qr_i32 : MVE_VMUL_qr_int<"vmul", "i32", 0b10>;
3632 class MVE_VxxMUL_qr<string iname, string suffix,
3633 bit bit_28, bits<2> bits_21_20, list<dag> pattern=[]>
3634 : MVE_qDest_rSrc<iname, suffix, pattern> {
3636 let Inst{28} = bit_28;
3637 let Inst{21-20} = bits_21_20;
3644 def MVE_VQDMULH_qr_s8 : MVE_VxxMUL_qr<"vqdmulh", "s8", 0b0, 0b00>;
3645 def MVE_VQDMULH_qr_s16 : MVE_VxxMUL_qr<"vqdmulh", "s16", 0b0, 0b01>;
3646 def MVE_VQDMULH_qr_s32 : MVE_VxxMUL_qr<"vqdmulh", "s32", 0b0, 0b10>;
3648 def MVE_VQRDMULH_qr_s8 : MVE_VxxMUL_qr<"vqrdmulh", "s8", 0b1, 0b00>;
3649 def MVE_VQRDMULH_qr_s16 : MVE_VxxMUL_qr<"vqrdmulh", "s16", 0b1, 0b01>;
3650 def MVE_VQRDMULH_qr_s32 : MVE_VxxMUL_qr<"vqrdmulh", "s32", 0b1, 0b10>;
3652 let Predicates = [HasMVEFloat] in {
3653 def MVE_VMUL_qr_f16 : MVE_VxxMUL_qr<"vmul", "f16", 0b1, 0b11>;
3654 def MVE_VMUL_qr_f32 : MVE_VxxMUL_qr<"vmul", "f32", 0b0, 0b11>;
3657 class MVE_VFMAMLA_qr<string iname, string suffix,
3658 bit bit_28, bits<2> bits_21_20, bit S,
3659 list<dag> pattern=[]>
3660 : MVE_qDestSrc_rSrc<iname, suffix, pattern> {
3662 let Inst{28} = bit_28;
3663 let Inst{21-20} = bits_21_20;
3670 def MVE_VMLA_qr_s8 : MVE_VFMAMLA_qr<"vmla", "s8", 0b0, 0b00, 0b0>;
3671 def MVE_VMLA_qr_s16 : MVE_VFMAMLA_qr<"vmla", "s16", 0b0, 0b01, 0b0>;
3672 def MVE_VMLA_qr_s32 : MVE_VFMAMLA_qr<"vmla", "s32", 0b0, 0b10, 0b0>;
3673 def MVE_VMLA_qr_u8 : MVE_VFMAMLA_qr<"vmla", "u8", 0b1, 0b00, 0b0>;
3674 def MVE_VMLA_qr_u16 : MVE_VFMAMLA_qr<"vmla", "u16", 0b1, 0b01, 0b0>;
3675 def MVE_VMLA_qr_u32 : MVE_VFMAMLA_qr<"vmla", "u32", 0b1, 0b10, 0b0>;
3677 def MVE_VMLAS_qr_s8 : MVE_VFMAMLA_qr<"vmlas", "s8", 0b0, 0b00, 0b1>;
3678 def MVE_VMLAS_qr_s16 : MVE_VFMAMLA_qr<"vmlas", "s16", 0b0, 0b01, 0b1>;
3679 def MVE_VMLAS_qr_s32 : MVE_VFMAMLA_qr<"vmlas", "s32", 0b0, 0b10, 0b1>;
3680 def MVE_VMLAS_qr_u8 : MVE_VFMAMLA_qr<"vmlas", "u8", 0b1, 0b00, 0b1>;
3681 def MVE_VMLAS_qr_u16 : MVE_VFMAMLA_qr<"vmlas", "u16", 0b1, 0b01, 0b1>;
3682 def MVE_VMLAS_qr_u32 : MVE_VFMAMLA_qr<"vmlas", "u32", 0b1, 0b10, 0b1>;
3684 let Predicates = [HasMVEFloat] in {
3685 def MVE_VFMA_qr_f16 : MVE_VFMAMLA_qr<"vfma", "f16", 0b1, 0b11, 0b0>;
3686 def MVE_VFMA_qr_f32 : MVE_VFMAMLA_qr<"vfma", "f32", 0b0, 0b11, 0b0>;
3687 def MVE_VFMA_qr_Sf16 : MVE_VFMAMLA_qr<"vfmas", "f16", 0b1, 0b11, 0b1>;
3688 def MVE_VFMA_qr_Sf32 : MVE_VFMAMLA_qr<"vfmas", "f32", 0b0, 0b11, 0b1>;
3691 class MVE_VQDMLAH_qr<string iname, string suffix, bit U, bits<2> size,
3692 bit bit_5, bit bit_12, list<dag> pattern=[]>
3693 : MVE_qDestSrc_rSrc<iname, suffix, pattern> {
3696 let Inst{21-20} = size;
3698 let Inst{12} = bit_12;
3700 let Inst{5} = bit_5;
3703 multiclass MVE_VQDMLAH_qr_types<string iname, bit bit_5, bit bit_12> {
3704 def s8 : MVE_VQDMLAH_qr<iname, "s8", 0b0, 0b00, bit_5, bit_12>;
3705 def s16 : MVE_VQDMLAH_qr<iname, "s16", 0b0, 0b01, bit_5, bit_12>;
3706 def s32 : MVE_VQDMLAH_qr<iname, "s32", 0b0, 0b10, bit_5, bit_12>;
3709 defm MVE_VQDMLAH_qr : MVE_VQDMLAH_qr_types<"vqdmlah", 0b1, 0b0>;
3710 defm MVE_VQRDMLAH_qr : MVE_VQDMLAH_qr_types<"vqrdmlah", 0b0, 0b0>;
3711 defm MVE_VQDMLASH_qr : MVE_VQDMLAH_qr_types<"vqdmlash", 0b1, 0b1>;
3712 defm MVE_VQRDMLASH_qr : MVE_VQDMLAH_qr_types<"vqrdmlash", 0b0, 0b1>;
3714 class MVE_VxDUP<string iname, string suffix, bits<2> size, bit bit_12,
3715 list<dag> pattern=[]>
3716 : MVE_p<(outs MQPR:$Qd, tGPREven:$Rn),
3717 (ins tGPREven:$Rn_src, MVE_VIDUP_imm:$imm), NoItinerary,
3718 iname, suffix, "$Qd, $Rn, $imm", vpred_r, "$Rn = $Rn_src",
3725 let Inst{25-23} = 0b100;
3726 let Inst{22} = Qd{3};
3727 let Inst{21-20} = size;
3728 let Inst{19-17} = Rn{3-1};
3730 let Inst{15-13} = Qd{2-0};
3731 let Inst{12} = bit_12;
3732 let Inst{11-8} = 0b1111;
3733 let Inst{7} = imm{1};
3734 let Inst{6-1} = 0b110111;
3735 let Inst{0} = imm{0};
3738 def MVE_VIDUPu8 : MVE_VxDUP<"vidup", "u8", 0b00, 0b0>;
3739 def MVE_VIDUPu16 : MVE_VxDUP<"vidup", "u16", 0b01, 0b0>;
3740 def MVE_VIDUPu32 : MVE_VxDUP<"vidup", "u32", 0b10, 0b0>;
3742 def MVE_VDDUPu8 : MVE_VxDUP<"vddup", "u8", 0b00, 0b1>;
3743 def MVE_VDDUPu16 : MVE_VxDUP<"vddup", "u16", 0b01, 0b1>;
3744 def MVE_VDDUPu32 : MVE_VxDUP<"vddup", "u32", 0b10, 0b1>;
3746 class MVE_VxWDUP<string iname, string suffix, bits<2> size, bit bit_12,
3747 list<dag> pattern=[]>
3748 : MVE_p<(outs MQPR:$Qd, tGPREven:$Rn),
3749 (ins tGPREven:$Rn_src, tGPROdd:$Rm, MVE_VIDUP_imm:$imm), NoItinerary,
3750 iname, suffix, "$Qd, $Rn, $Rm, $imm", vpred_r, "$Rn = $Rn_src",
3758 let Inst{25-23} = 0b100;
3759 let Inst{22} = Qd{3};
3760 let Inst{21-20} = size;
3761 let Inst{19-17} = Rn{3-1};
3763 let Inst{15-13} = Qd{2-0};
3764 let Inst{12} = bit_12;
3765 let Inst{11-8} = 0b1111;
3766 let Inst{7} = imm{1};
3767 let Inst{6-4} = 0b110;
3768 let Inst{3-1} = Rm{3-1};
3769 let Inst{0} = imm{0};
3772 def MVE_VIWDUPu8 : MVE_VxWDUP<"viwdup", "u8", 0b00, 0b0>;
3773 def MVE_VIWDUPu16 : MVE_VxWDUP<"viwdup", "u16", 0b01, 0b0>;
3774 def MVE_VIWDUPu32 : MVE_VxWDUP<"viwdup", "u32", 0b10, 0b0>;
3776 def MVE_VDWDUPu8 : MVE_VxWDUP<"vdwdup", "u8", 0b00, 0b1>;
3777 def MVE_VDWDUPu16 : MVE_VxWDUP<"vdwdup", "u16", 0b01, 0b1>;
3778 def MVE_VDWDUPu32 : MVE_VxWDUP<"vdwdup", "u32", 0b10, 0b1>;
3780 class MVE_VCTP<string suffix, bits<2> size, list<dag> pattern=[]>
3781 : MVE_p<(outs VCCR:$P0), (ins rGPR:$Rn), NoItinerary, "vctp", suffix,
3782 "$Rn", vpred_n, "", pattern> {
3785 let Inst{28-27} = 0b10;
3786 let Inst{26-22} = 0b00000;
3787 let Inst{21-20} = size;
3788 let Inst{19-16} = Rn{3-0};
3789 let Inst{15-11} = 0b11101;
3790 let Inst{10-0} = 0b00000000001;
3791 let Unpredictable{10-0} = 0b11111111111;
3793 let Constraints = "";
3794 let DecoderMethod = "DecodeMveVCTP";
3797 def MVE_VCTP8 : MVE_VCTP<"8", 0b00>;
3798 def MVE_VCTP16 : MVE_VCTP<"16", 0b01>;
3799 def MVE_VCTP32 : MVE_VCTP<"32", 0b10>;
3800 def MVE_VCTP64 : MVE_VCTP<"64", 0b11>;
3802 // end of mve_qDest_rSrc
3804 // start of coproc mov
3806 class MVE_VMOV_64bit<dag oops, dag iops, bit to_qreg, string ops, string cstr>
3807 : MVE_VMOV_lane_base<oops, !con(iops, (ins MVEPairVectorIndex2:$idx,
3808 MVEPairVectorIndex0:$idx2)),
3809 NoItinerary, "vmov", "", ops, cstr, []> {
3816 let Inst{31-23} = 0b111011000;
3817 let Inst{22} = Qd{3};
3819 let Inst{20} = to_qreg;
3820 let Inst{19-16} = Rt2{3-0};
3821 let Inst{15-13} = Qd{2-0};
3822 let Inst{12-5} = 0b01111000;
3824 let Inst{3-0} = Rt{3-0};
3827 // The assembly syntax for these instructions mentions the vector
3828 // register name twice, e.g.
3830 // vmov q2[2], q2[0], r0, r1
3831 // vmov r0, r1, q2[2], q2[0]
3833 // which needs a bit of juggling with MC operand handling.
3835 // For the move _into_ a vector register, the MC operand list also has
3836 // to mention the register name twice: once as the output, and once as
3837 // an extra input to represent where the unchanged half of the output
3838 // register comes from (when this instruction is used in code
3839 // generation). So we arrange that the first mention of the vector reg
3840 // in the instruction is considered by the AsmMatcher to be the output
3841 // ($Qd), and the second one is the input ($QdSrc). Binding them
3842 // together with the existing 'tie' constraint is enough to enforce at
3843 // register allocation time that they have to be the same register.
3845 // For the move _from_ a vector register, there's no way to get round
3846 // the fact that both instances of that register name have to be
3847 // inputs. They have to be the same register again, but this time, we
3848 // can't use a tie constraint, because that has to be between an
3849 // output and an input operand. So this time, we have to arrange that
3850 // the q-reg appears just once in the MC operand list, in spite of
3851 // being mentioned twice in the asm syntax - which needs a custom
3852 // AsmMatchConverter.
3854 def MVE_VMOV_q_rr : MVE_VMOV_64bit<(outs MQPR:$Qd),
3855 (ins MQPR:$QdSrc, rGPR:$Rt, rGPR:$Rt2),
3856 0b1, "$Qd$idx, $QdSrc$idx2, $Rt, $Rt2",
3858 let DecoderMethod = "DecodeMVEVMOVDRegtoQ";
3861 def MVE_VMOV_rr_q : MVE_VMOV_64bit<(outs rGPR:$Rt, rGPR:$Rt2), (ins MQPR:$Qd),
3862 0b0, "$Rt, $Rt2, $Qd$idx, $Qd$idx2", ""> {
3863 let DecoderMethod = "DecodeMVEVMOVQtoDReg";
3864 let AsmMatchConverter = "cvtMVEVMOVQtoDReg";
3867 // end of coproc mov
3869 // start of MVE interleaving load/store
3871 // Base class for the family of interleaving/deinterleaving
3872 // load/stores with names like VLD20.8 and VST43.32.
3873 class MVE_vldst24_base<bit writeback, bit fourregs, bits<2> stage, bits<2> size,
3874 bit load, dag Oops, dag loadIops, dag wbIops,
3875 string iname, string ops,
3876 string cstr, list<dag> pattern=[]>
3877 : MVE_MI<Oops, !con(loadIops, wbIops), NoItinerary, iname, ops, cstr, pattern> {
3881 let Inst{31-22} = 0b1111110010;
3882 let Inst{21} = writeback;
3883 let Inst{20} = load;
3884 let Inst{19-16} = Rn;
3885 let Inst{15-13} = VQd{2-0};
3886 let Inst{12-9} = 0b1111;
3887 let Inst{8-7} = size;
3888 let Inst{6-5} = stage;
3889 let Inst{4-1} = 0b0000;
3890 let Inst{0} = fourregs;
3893 let mayStore = !eq(load,0);
3896 // A parameter class used to encapsulate all the ways the writeback
3897 // variants of VLD20 and friends differ from the non-writeback ones.
3898 class MVE_vldst24_writeback<bit b, dag Oo, dag Io,
3899 string sy="", string c="", string n=""> {
3905 string id_suffix = n;
3908 // Another parameter class that encapsulates the differences between VLD2x
3910 class MVE_vldst24_nvecs<int n, list<int> s, bit b, RegisterOperand vl> {
3912 list<int> stages = s;
3914 RegisterOperand VecList = vl;
3917 // A third parameter class that distinguishes VLDnn.8 from .16 from .32.
3918 class MVE_vldst24_lanesize<int i, bits<2> b> {
3920 bits<2> sizebits = b;
3923 // A base class for each direction of transfer: one for load, one for
3924 // store. I can't make these a fourth independent parametric tuple
3925 // class, because they have to take the nvecs tuple class as a
3926 // parameter, in order to find the right VecList operand type.
3928 class MVE_vld24_base<MVE_vldst24_nvecs n, bits<2> pat, bits<2> size,
3929 MVE_vldst24_writeback wb, string iname,
3930 list<dag> pattern=[]>
3931 : MVE_vldst24_base<wb.writeback, n.bit0, pat, size, 1,
3932 !con((outs n.VecList:$VQd), wb.Oops),
3933 (ins n.VecList:$VQdSrc), wb.Iops,
3934 iname, "$VQd, $Rn" # wb.syntax,
3935 wb.cstr # ",$VQdSrc = $VQd", pattern>;
3937 class MVE_vst24_base<MVE_vldst24_nvecs n, bits<2> pat, bits<2> size,
3938 MVE_vldst24_writeback wb, string iname,
3939 list<dag> pattern=[]>
3940 : MVE_vldst24_base<wb.writeback, n.bit0, pat, size, 0,
3941 wb.Oops, (ins n.VecList:$VQd), wb.Iops,
3942 iname, "$VQd, $Rn" # wb.syntax,
3945 // Actually define all the interleaving loads and stores, by a series
3946 // of nested foreaches over number of vectors (VLD2/VLD4); stage
3947 // within one of those series (VLDx0/VLDx1/VLDx2/VLDx3); size of
3948 // vector lane; writeback or no writeback.
3949 foreach n = [MVE_vldst24_nvecs<2, [0,1], 0, VecList2Q>,
3950 MVE_vldst24_nvecs<4, [0,1,2,3], 1, VecList4Q>] in
3951 foreach stage = n.stages in
3952 foreach s = [MVE_vldst24_lanesize< 8, 0b00>,
3953 MVE_vldst24_lanesize<16, 0b01>,
3954 MVE_vldst24_lanesize<32, 0b10>] in
3955 foreach wb = [MVE_vldst24_writeback<
3956 1, (outs rGPR:$wb), (ins t2_nosp_addr_offset_none:$Rn),
3957 "!", "$Rn.base = $wb", "_wb">,
3958 MVE_vldst24_writeback<0, (outs), (ins t2_addr_offset_none:$Rn)>] in {
3960 // For each case within all of those foreaches, define the actual
3961 // instructions. The def names are made by gluing together pieces
3962 // from all the parameter classes, and will end up being things like
3963 // MVE_VLD20_8 and MVE_VST43_16_wb.
3965 def "MVE_VLD" # n.nvecs # stage # "_" # s.lanesize # wb.id_suffix
3966 : MVE_vld24_base<n, stage, s.sizebits, wb,
3967 "vld" # n.nvecs # stage # "." # s.lanesize>;
3969 def "MVE_VST" # n.nvecs # stage # "_" # s.lanesize # wb.id_suffix
3970 : MVE_vst24_base<n, stage, s.sizebits, wb,
3971 "vst" # n.nvecs # stage # "." # s.lanesize>;
3974 // end of MVE interleaving load/store
3976 // start of MVE predicable load/store
3978 // A parameter class for the direction of transfer.
3979 class MVE_ldst_direction<bit b, dag Oo, dag Io, string c=""> {
3985 def MVE_ld: MVE_ldst_direction<1, (outs MQPR:$Qd), (ins), ",@earlyclobber $Qd">;
3986 def MVE_st: MVE_ldst_direction<0, (outs), (ins MQPR:$Qd)>;
3988 // A parameter class for the size of memory access in a load.
3989 class MVE_memsz<bits<2> e, int s, AddrMode m, string mn, list<string> types> {
3990 bits<2> encoding = e; // opcode bit(s) for encoding
3991 int shift = s; // shift applied to immediate load offset
3994 // For instruction aliases: define the complete list of type
3995 // suffixes at this size, and the canonical ones for loads and
3997 string MnemonicLetter = mn;
3998 int TypeBits = !shl(8, s);
3999 string CanonLoadSuffix = ".u" # TypeBits;
4000 string CanonStoreSuffix = "." # TypeBits;
4001 list<string> suffixes = !foreach(letter, types, "." # letter # TypeBits);
4004 // Instances of MVE_memsz.
4006 // (memD doesn't need an AddrMode, because those are only for
4007 // contiguous loads, and memD is only used by gather/scatters.)
4008 def MVE_memB: MVE_memsz<0b00, 0, AddrModeT2_i7, "b", ["", "u", "s"]>;
4009 def MVE_memH: MVE_memsz<0b01, 1, AddrModeT2_i7s2, "h", ["", "u", "s", "f"]>;
4010 def MVE_memW: MVE_memsz<0b10, 2, AddrModeT2_i7s4, "w", ["", "u", "s", "f"]>;
4011 def MVE_memD: MVE_memsz<0b11, 3, ?, "d", ["", "u", "s", "f"]>;
4013 // This is the base class for all the MVE loads and stores other than
4014 // the interleaving ones. All the non-interleaving loads/stores share
4015 // the characteristic that they operate on just one vector register,
4016 // so they are VPT-predicable.
4018 // The predication operand is vpred_n, for both loads and stores. For
4019 // store instructions, the reason is obvious: if there is no output
4020 // register, there can't be a need for an input parameter giving the
4021 // output register's previous value. Load instructions also don't need
4022 // that input parameter, because unlike MVE data processing
4023 // instructions, predicated loads are defined to set the inactive
4024 // lanes of the output register to zero, instead of preserving their
4026 class MVE_VLDRSTR_base<MVE_ldst_direction dir, bit U, bit P, bit W, bit opc,
4027 dag oops, dag iops, string asm, string suffix,
4028 string ops, string cstr, list<dag> pattern=[]>
4029 : MVE_p<oops, iops, NoItinerary, asm, suffix, ops, vpred_n, cstr, pattern> {
4037 let Inst{20} = dir.load;
4038 let Inst{15-13} = Qd{2-0};
4040 let Inst{11-9} = 0b111;
4042 let mayLoad = dir.load;
4043 let mayStore = !eq(dir.load,0);
4046 // Contiguous load and store instructions. These come in two main
4047 // categories: same-size loads/stores in which 128 bits of vector
4048 // register is transferred to or from 128 bits of memory in the most
4049 // obvious way, and widening loads / narrowing stores, in which the
4050 // size of memory accessed is less than the size of a vector register,
4051 // so the load instructions sign- or zero-extend each memory value
4052 // into a wider vector lane, and the store instructions truncate
4055 // The instruction mnemonics for these two classes look reasonably
4056 // similar, but the actual encodings are different enough to need two
4057 // separate base classes.
4059 // Contiguous, same size
4060 class MVE_VLDRSTR_cs<MVE_ldst_direction dir, MVE_memsz memsz, bit P, bit W,
4061 dag oops, dag iops, string asm, string suffix,
4062 IndexMode im, string ops, string cstr>
4063 : MVE_VLDRSTR_base<dir, 0, P, W, 1, oops, iops, asm, suffix, ops, cstr> {
4065 let Inst{23} = addr{7};
4066 let Inst{19-16} = addr{11-8};
4067 let Inst{8-7} = memsz.encoding;
4068 let Inst{6-0} = addr{6-0};
4071 // Contiguous, widening/narrowing
4072 class MVE_VLDRSTR_cw<MVE_ldst_direction dir, MVE_memsz memsz, bit U,
4073 bit P, bit W, bits<2> size, dag oops, dag iops,
4074 string asm, string suffix, IndexMode im,
4075 string ops, string cstr>
4076 : MVE_VLDRSTR_base<dir, U, P, W, 0, oops, iops, asm, suffix, ops, cstr> {
4078 let Inst{23} = addr{7};
4079 let Inst{19} = memsz.encoding{0}; // enough to tell 16- from 32-bit
4080 let Inst{18-16} = addr{10-8};
4081 let Inst{8-7} = size;
4082 let Inst{6-0} = addr{6-0};
4087 // Multiclass wrapper on each of the _cw and _cs base classes, to
4088 // generate three writeback modes (none, preindex, postindex).
4090 multiclass MVE_VLDRSTR_cw_m<MVE_ldst_direction dir, MVE_memsz memsz,
4091 string asm, string suffix, bit U, bits<2> size> {
4092 let AM = memsz.AM in {
4093 def "" : MVE_VLDRSTR_cw<
4094 dir, memsz, U, 1, 0, size,
4095 dir.Oops, !con(dir.Iops, (ins taddrmode_imm7<memsz.shift>:$addr)),
4096 asm, suffix, IndexModeNone, "$Qd, $addr", "">;
4098 def _pre : MVE_VLDRSTR_cw<
4099 dir, memsz, U, 1, 1, size,
4100 !con((outs tGPR:$wb), dir.Oops),
4101 !con(dir.Iops, (ins taddrmode_imm7<memsz.shift>:$addr)),
4102 asm, suffix, IndexModePre, "$Qd, $addr!", "$addr.base = $wb"> {
4103 let DecoderMethod = "DecodeMVE_MEM_1_pre<"#memsz.shift#">";
4106 def _post : MVE_VLDRSTR_cw<
4107 dir, memsz, U, 0, 1, size,
4108 !con((outs tGPR:$wb), dir.Oops),
4109 !con(dir.Iops, (ins t_addr_offset_none:$Rn,
4110 t2am_imm7_offset<memsz.shift>:$addr)),
4111 asm, suffix, IndexModePost, "$Qd, $Rn$addr", "$Rn.base = $wb"> {
4113 let Inst{18-16} = Rn{2-0};
4118 multiclass MVE_VLDRSTR_cs_m<MVE_ldst_direction dir, MVE_memsz memsz,
4119 string asm, string suffix> {
4120 let AM = memsz.AM in {
4121 def "" : MVE_VLDRSTR_cs<
4123 dir.Oops, !con(dir.Iops, (ins t2addrmode_imm7<memsz.shift>:$addr)),
4124 asm, suffix, IndexModeNone, "$Qd, $addr", "">;
4126 def _pre : MVE_VLDRSTR_cs<
4128 !con((outs rGPR:$wb), dir.Oops),
4129 !con(dir.Iops, (ins t2addrmode_imm7_pre<memsz.shift>:$addr)),
4130 asm, suffix, IndexModePre, "$Qd, $addr!", "$addr.base = $wb"> {
4131 let DecoderMethod = "DecodeMVE_MEM_2_pre<"#memsz.shift#">";
4134 def _post : MVE_VLDRSTR_cs<
4136 !con((outs rGPR:$wb), dir.Oops),
4137 // We need an !if here to select the base register class,
4138 // because it's legal to write back to SP in a load of this
4139 // type, but not in a store.
4140 !con(dir.Iops, (ins !if(dir.load, t2_addr_offset_none,
4141 t2_nosp_addr_offset_none):$Rn,
4142 t2am_imm7_offset<memsz.shift>:$addr)),
4143 asm, suffix, IndexModePost, "$Qd, $Rn$addr", "$Rn.base = $wb"> {
4145 let Inst{19-16} = Rn{3-0};
4150 // Now actually declare all the contiguous load/stores, via those
4151 // multiclasses. The instruction ids coming out of this are the bare
4152 // names shown in the defm, with _pre or _post appended for writeback,
4153 // e.g. MVE_VLDRBS16, MVE_VSTRB16_pre, MVE_VSTRHU16_post.
4155 defm MVE_VLDRBS16: MVE_VLDRSTR_cw_m<MVE_ld, MVE_memB, "vldrb", "s16", 0, 0b01>;
4156 defm MVE_VLDRBS32: MVE_VLDRSTR_cw_m<MVE_ld, MVE_memB, "vldrb", "s32", 0, 0b10>;
4157 defm MVE_VLDRBU16: MVE_VLDRSTR_cw_m<MVE_ld, MVE_memB, "vldrb", "u16", 1, 0b01>;
4158 defm MVE_VLDRBU32: MVE_VLDRSTR_cw_m<MVE_ld, MVE_memB, "vldrb", "u32", 1, 0b10>;
4159 defm MVE_VLDRHS32: MVE_VLDRSTR_cw_m<MVE_ld, MVE_memH, "vldrh", "s32", 0, 0b10>;
4160 defm MVE_VLDRHU32: MVE_VLDRSTR_cw_m<MVE_ld, MVE_memH, "vldrh", "u32", 1, 0b10>;
4162 defm MVE_VLDRBU8: MVE_VLDRSTR_cs_m<MVE_ld, MVE_memB, "vldrb", "u8">;
4163 defm MVE_VLDRHU16: MVE_VLDRSTR_cs_m<MVE_ld, MVE_memH, "vldrh", "u16">;
4164 defm MVE_VLDRWU32: MVE_VLDRSTR_cs_m<MVE_ld, MVE_memW, "vldrw", "u32">;
4166 defm MVE_VSTRB16: MVE_VLDRSTR_cw_m<MVE_st, MVE_memB, "vstrb", "16", 0, 0b01>;
4167 defm MVE_VSTRB32: MVE_VLDRSTR_cw_m<MVE_st, MVE_memB, "vstrb", "32", 0, 0b10>;
4168 defm MVE_VSTRH32: MVE_VLDRSTR_cw_m<MVE_st, MVE_memH, "vstrh", "32", 0, 0b10>;
4170 defm MVE_VSTRBU8 : MVE_VLDRSTR_cs_m<MVE_st, MVE_memB, "vstrb", "8">;
4171 defm MVE_VSTRHU16: MVE_VLDRSTR_cs_m<MVE_st, MVE_memH, "vstrh", "16">;
4172 defm MVE_VSTRWU32: MVE_VLDRSTR_cs_m<MVE_st, MVE_memW, "vstrw", "32">;
4174 // Gather loads / scatter stores whose address operand is of the form
4175 // [Rn,Qm], i.e. a single GPR as the common base address, plus a
4176 // vector of offset from it. ('Load/store this sequence of elements of
4177 // the same array.')
4179 // Like the contiguous family, these loads and stores can widen the
4180 // loaded values / truncate the stored ones, or they can just
4181 // load/store the same size of memory and vector lane. But unlike the
4182 // contiguous family, there's no particular difference in encoding
4183 // between those two cases.
4185 // This family also comes with the option to scale the offset values
4186 // in Qm by the size of the loaded memory (i.e. to treat them as array
4187 // indices), or not to scale them (to treat them as plain byte offsets
4188 // in memory, so that perhaps the loaded values are unaligned). The
4189 // scaled instructions' address operand in assembly looks like
4190 // [Rn,Qm,UXTW #2] or similar.
4193 class MVE_VLDRSTR_rq<MVE_ldst_direction dir, MVE_memsz memsz, bit U,
4194 bits<2> size, bit os, string asm, string suffix, int shift>
4195 : MVE_VLDRSTR_base<dir, U, 0b0, 0b0, 0, dir.Oops,
4196 !con(dir.Iops, (ins mve_addr_rq_shift<shift>:$addr)),
4197 asm, suffix, "$Qd, $addr", dir.cstr> {
4200 let Inst{19-16} = addr{6-3};
4201 let Inst{8-7} = size;
4202 let Inst{6} = memsz.encoding{1};
4204 let Inst{4} = memsz.encoding{0};
4205 let Inst{3-1} = addr{2-0};
4209 // Multiclass that defines the scaled and unscaled versions of an
4210 // instruction, when the memory size is wider than a byte. The scaled
4211 // version gets the default name like MVE_VLDRBU16_rq; the unscaled /
4212 // potentially unaligned version gets a "_u" suffix, e.g.
4213 // MVE_VLDRBU16_rq_u.
4214 multiclass MVE_VLDRSTR_rq_w<MVE_ldst_direction dir, MVE_memsz memsz,
4215 string asm, string suffix, bit U, bits<2> size> {
4216 def _u : MVE_VLDRSTR_rq<dir, memsz, U, size, 0, asm, suffix, 0>;
4217 def "" : MVE_VLDRSTR_rq<dir, memsz, U, size, 1, asm, suffix, memsz.shift>;
4220 // Subclass of MVE_VLDRSTR_rq with the same API as that multiclass,
4221 // for use when the memory size is one byte, so there's no 'scaled'
4222 // version of the instruction at all. (This is encoded as if it were
4223 // unscaled, but named in the default way with no _u suffix.)
4224 class MVE_VLDRSTR_rq_b<MVE_ldst_direction dir, MVE_memsz memsz,
4225 string asm, string suffix, bit U, bits<2> size>
4226 : MVE_VLDRSTR_rq<dir, memsz, U, size, 0, asm, suffix, 0>;
4228 // Actually define all the loads and stores in this family.
4230 def MVE_VLDRBU8_rq : MVE_VLDRSTR_rq_b<MVE_ld, MVE_memB, "vldrb","u8", 1,0b00>;
4231 def MVE_VLDRBU16_rq: MVE_VLDRSTR_rq_b<MVE_ld, MVE_memB, "vldrb","u16", 1,0b01>;
4232 def MVE_VLDRBS16_rq: MVE_VLDRSTR_rq_b<MVE_ld, MVE_memB, "vldrb","s16", 0,0b01>;
4233 def MVE_VLDRBU32_rq: MVE_VLDRSTR_rq_b<MVE_ld, MVE_memB, "vldrb","u32", 1,0b10>;
4234 def MVE_VLDRBS32_rq: MVE_VLDRSTR_rq_b<MVE_ld, MVE_memB, "vldrb","s32", 0,0b10>;
4236 defm MVE_VLDRHU16_rq: MVE_VLDRSTR_rq_w<MVE_ld, MVE_memH, "vldrh","u16", 1,0b01>;
4237 defm MVE_VLDRHU32_rq: MVE_VLDRSTR_rq_w<MVE_ld, MVE_memH, "vldrh","u32", 1,0b10>;
4238 defm MVE_VLDRHS32_rq: MVE_VLDRSTR_rq_w<MVE_ld, MVE_memH, "vldrh","s32", 0,0b10>;
4239 defm MVE_VLDRWU32_rq: MVE_VLDRSTR_rq_w<MVE_ld, MVE_memW, "vldrw","u32", 1,0b10>;
4240 defm MVE_VLDRDU64_rq: MVE_VLDRSTR_rq_w<MVE_ld, MVE_memD, "vldrd","u64", 1,0b11>;
4242 def MVE_VSTRB8_rq : MVE_VLDRSTR_rq_b<MVE_st, MVE_memB, "vstrb","8", 0,0b00>;
4243 def MVE_VSTRB16_rq : MVE_VLDRSTR_rq_b<MVE_st, MVE_memB, "vstrb","16", 0,0b01>;
4244 def MVE_VSTRB32_rq : MVE_VLDRSTR_rq_b<MVE_st, MVE_memB, "vstrb","32", 0,0b10>;
4246 defm MVE_VSTRH16_rq : MVE_VLDRSTR_rq_w<MVE_st, MVE_memH, "vstrh","16", 0,0b01>;
4247 defm MVE_VSTRH32_rq : MVE_VLDRSTR_rq_w<MVE_st, MVE_memH, "vstrh","32", 0,0b10>;
4248 defm MVE_VSTRW32_rq : MVE_VLDRSTR_rq_w<MVE_st, MVE_memW, "vstrw","32", 0,0b10>;
4249 defm MVE_VSTRD64_rq : MVE_VLDRSTR_rq_w<MVE_st, MVE_memD, "vstrd","64", 0,0b11>;
4251 // Gather loads / scatter stores whose address operand is of the form
4252 // [Qm,#imm], i.e. a vector containing a full base address for each
4253 // loaded item, plus an immediate offset applied consistently to all
4254 // of them. ('Load/store the same field from this vector of pointers
4255 // to a structure type.')
4257 // This family requires the vector lane size to be at least 32 bits
4258 // (so there's room for an address in each lane at all). It has no
4259 // widening/narrowing variants. But it does support preindex
4260 // writeback, in which the address vector is updated to hold the
4261 // addresses actually loaded from.
4264 class MVE_VLDRSTR_qi<MVE_ldst_direction dir, MVE_memsz memsz, bit W, dag wbops,
4265 string asm, string wbAsm, string suffix, string cstr = "">
4266 : MVE_VLDRSTR_base<dir, 1, 1, W, 1, !con(wbops, dir.Oops),
4267 !con(dir.Iops, (ins mve_addr_q_shift<memsz.shift>:$addr)),
4268 asm, suffix, "$Qd, $addr" # wbAsm, cstr # dir.cstr> {
4270 let Inst{23} = addr{7};
4271 let Inst{19-17} = addr{10-8};
4273 let Inst{8} = memsz.encoding{0}; // enough to distinguish 32- from 64-bit
4275 let Inst{6-0} = addr{6-0};
4278 // Multiclass that generates the non-writeback and writeback variants.
4279 multiclass MVE_VLDRSTR_qi_m<MVE_ldst_direction dir, MVE_memsz memsz,
4280 string asm, string suffix> {
4281 def "" : MVE_VLDRSTR_qi<dir, memsz, 0, (outs), asm, "", suffix>;
4282 def _pre : MVE_VLDRSTR_qi<dir, memsz, 1, (outs MQPR:$wb), asm, "!", suffix,
4283 "$addr.base = $wb"> {
4284 let DecoderMethod="DecodeMVE_MEM_3_pre<"#memsz.shift#">";
4288 // Actual instruction definitions.
4289 defm MVE_VLDRWU32_qi: MVE_VLDRSTR_qi_m<MVE_ld, MVE_memW, "vldrw", "u32">;
4290 defm MVE_VLDRDU64_qi: MVE_VLDRSTR_qi_m<MVE_ld, MVE_memD, "vldrd", "u64">;
4291 defm MVE_VSTRW32_qi: MVE_VLDRSTR_qi_m<MVE_st, MVE_memW, "vstrw", "32">;
4292 defm MVE_VSTRD64_qi: MVE_VLDRSTR_qi_m<MVE_st, MVE_memD, "vstrd", "64">;
4294 // Define aliases for all the instructions where memory size and
4295 // vector lane size are the same. These are mnemonic aliases, so they
4296 // apply consistently across all of the above families - contiguous
4297 // loads, and both the rq and qi types of gather/scatter.
4299 // Rationale: As long as you're loading (for example) 16-bit memory
4300 // values into 16-bit vector lanes, you can think of them as signed or
4301 // unsigned integers, fp16 or just raw 16-bit blobs and it makes no
4302 // difference. So we permit all of vldrh.16, vldrh.u16, vldrh.s16,
4303 // vldrh.f16 and treat them all as equivalent to the canonical
4304 // spelling (which happens to be .u16 for loads, and just .16 for
4307 foreach vpt_cond = ["", "t", "e"] in
4308 foreach memsz = [MVE_memB, MVE_memH, MVE_memW, MVE_memD] in
4309 foreach suffix = memsz.suffixes in {
4311 // These foreaches are conceptually ifs, implemented by iterating a
4312 // dummy variable over a list with 0 or 1 elements depending on the
4313 // condition. The idea is to iterate over _nearly_ all the suffixes
4314 // in memsz.suffixes, but omit the one we want all the others to alias.
4316 foreach _ = !if(!ne(suffix, memsz.CanonLoadSuffix), [1], []<int>) in
4317 def : MnemonicAlias<
4318 "vldr" # memsz.MnemonicLetter # vpt_cond # suffix,
4319 "vldr" # memsz.MnemonicLetter # vpt_cond # memsz.CanonLoadSuffix>;
4321 foreach _ = !if(!ne(suffix, memsz.CanonStoreSuffix), [1], []<int>) in
4322 def : MnemonicAlias<
4323 "vstr" # memsz.MnemonicLetter # vpt_cond # suffix,
4324 "vstr" # memsz.MnemonicLetter # vpt_cond # memsz.CanonStoreSuffix>;
4327 // end of MVE predicable load/store
4329 class MVE_VPT<string suffix, bits<2> size, dag iops, string asm, list<dag> pattern=[]>
4330 : MVE_MI<(outs ), iops, NoItinerary, !strconcat("vpt", "${Mk}", ".", suffix), asm, "", pattern> {
4335 let Inst{31-23} = 0b111111100;
4336 let Inst{22} = Mk{3};
4337 let Inst{21-20} = size;
4338 let Inst{19-17} = Qn{2-0};
4340 let Inst{15-13} = Mk{2-0};
4341 let Inst{12} = fc{2};
4342 let Inst{11-8} = 0b1111;
4343 let Inst{7} = fc{0};
4346 let Defs = [VPR, P0];
4349 class MVE_VPTt1<string suffix, bits<2> size, dag iops>
4350 : MVE_VPT<suffix, size, iops, "$fc, $Qn, $Qm"> {
4355 let Inst{5} = Qm{3};
4356 let Inst{3-1} = Qm{2-0};
4357 let Inst{0} = fc{1};
4360 class MVE_VPTt1i<string suffix, bits<2> size>
4361 : MVE_VPTt1<suffix, size,
4362 (ins vpt_mask:$Mk, pred_basic_i:$fc, MQPR:$Qn, MQPR:$Qm)> {
4367 def MVE_VPTv4i32 : MVE_VPTt1i<"i32", 0b10>;
4368 def MVE_VPTv8i16 : MVE_VPTt1i<"i16", 0b01>;
4369 def MVE_VPTv16i8 : MVE_VPTt1i<"i8", 0b00>;
4371 class MVE_VPTt1u<string suffix, bits<2> size>
4372 : MVE_VPTt1<suffix, size,
4373 (ins vpt_mask:$Mk, pred_basic_u:$fc, MQPR:$Qn, MQPR:$Qm)> {
4378 def MVE_VPTv4u32 : MVE_VPTt1u<"u32", 0b10>;
4379 def MVE_VPTv8u16 : MVE_VPTt1u<"u16", 0b01>;
4380 def MVE_VPTv16u8 : MVE_VPTt1u<"u8", 0b00>;
4382 class MVE_VPTt1s<string suffix, bits<2> size>
4383 : MVE_VPTt1<suffix, size,
4384 (ins vpt_mask:$Mk, pred_basic_s:$fc, MQPR:$Qn, MQPR:$Qm)> {
4388 def MVE_VPTv4s32 : MVE_VPTt1s<"s32", 0b10>;
4389 def MVE_VPTv8s16 : MVE_VPTt1s<"s16", 0b01>;
4390 def MVE_VPTv16s8 : MVE_VPTt1s<"s8", 0b00>;
4392 class MVE_VPTt2<string suffix, bits<2> size, dag iops>
4393 : MVE_VPT<suffix, size, iops,
4400 let Inst{5} = fc{1};
4401 let Inst{3-0} = Rm{3-0};
4404 class MVE_VPTt2i<string suffix, bits<2> size>
4405 : MVE_VPTt2<suffix, size,
4406 (ins vpt_mask:$Mk, pred_basic_i:$fc, MQPR:$Qn, GPRwithZR:$Rm)> {
4411 def MVE_VPTv4i32r : MVE_VPTt2i<"i32", 0b10>;
4412 def MVE_VPTv8i16r : MVE_VPTt2i<"i16", 0b01>;
4413 def MVE_VPTv16i8r : MVE_VPTt2i<"i8", 0b00>;
4415 class MVE_VPTt2u<string suffix, bits<2> size>
4416 : MVE_VPTt2<suffix, size,
4417 (ins vpt_mask:$Mk, pred_basic_u:$fc, MQPR:$Qn, GPRwithZR:$Rm)> {
4422 def MVE_VPTv4u32r : MVE_VPTt2u<"u32", 0b10>;
4423 def MVE_VPTv8u16r : MVE_VPTt2u<"u16", 0b01>;
4424 def MVE_VPTv16u8r : MVE_VPTt2u<"u8", 0b00>;
4426 class MVE_VPTt2s<string suffix, bits<2> size>
4427 : MVE_VPTt2<suffix, size,
4428 (ins vpt_mask:$Mk, pred_basic_s:$fc, MQPR:$Qn, GPRwithZR:$Rm)> {
4432 def MVE_VPTv4s32r : MVE_VPTt2s<"s32", 0b10>;
4433 def MVE_VPTv8s16r : MVE_VPTt2s<"s16", 0b01>;
4434 def MVE_VPTv16s8r : MVE_VPTt2s<"s8", 0b00>;
4437 class MVE_VPTf<string suffix, bit size, dag iops, string asm, list<dag> pattern=[]>
4438 : MVE_MI<(outs ), iops, NoItinerary, !strconcat("vpt", "${Mk}", ".", suffix), asm,
4444 let Inst{31-29} = 0b111;
4445 let Inst{28} = size;
4446 let Inst{27-23} = 0b11100;
4447 let Inst{22} = Mk{3};
4448 let Inst{21-20} = 0b11;
4449 let Inst{19-17} = Qn{2-0};
4451 let Inst{15-13} = Mk{2-0};
4452 let Inst{12} = fc{2};
4453 let Inst{11-8} = 0b1111;
4454 let Inst{7} = fc{0};
4458 let Predicates = [HasMVEFloat];
4461 class MVE_VPTft1<string suffix, bit size>
4462 : MVE_VPTf<suffix, size, (ins vpt_mask:$Mk, pred_basic_fp:$fc, MQPR:$Qn, MQPR:$Qm),
4468 let Inst{5} = Qm{3};
4469 let Inst{3-1} = Qm{2-0};
4470 let Inst{0} = fc{1};
4473 def MVE_VPTv4f32 : MVE_VPTft1<"f32", 0b0>;
4474 def MVE_VPTv8f16 : MVE_VPTft1<"f16", 0b1>;
4476 class MVE_VPTft2<string suffix, bit size>
4477 : MVE_VPTf<suffix, size, (ins vpt_mask:$Mk, pred_basic_fp:$fc, MQPR:$Qn, GPRwithZR:$Rm),
4483 let Inst{5} = fc{1};
4484 let Inst{3-0} = Rm{3-0};
4487 def MVE_VPTv4f32r : MVE_VPTft2<"f32", 0b0>;
4488 def MVE_VPTv8f16r : MVE_VPTft2<"f16", 0b1>;
4490 def MVE_VPST : MVE_MI<(outs ), (ins vpt_mask:$Mk), NoItinerary,
4491 !strconcat("vpst", "${Mk}"), "", "", []> {
4494 let Inst{31-23} = 0b111111100;
4495 let Inst{22} = Mk{3};
4496 let Inst{21-16} = 0b110001;
4497 let Inst{15-13} = Mk{2-0};
4498 let Inst{12-0} = 0b0111101001101;
4499 let Unpredictable{12} = 0b1;
4500 let Unpredictable{7} = 0b1;
4501 let Unpredictable{5} = 0b1;
4506 def MVE_VPSEL : MVE_p<(outs MQPR:$Qd), (ins MQPR:$Qn, MQPR:$Qm), NoItinerary,
4507 "vpsel", "", "$Qd, $Qn, $Qm", vpred_n, "", []> {
4513 let Inst{25-23} = 0b100;
4514 let Inst{22} = Qd{3};
4515 let Inst{21-20} = 0b11;
4516 let Inst{19-17} = Qn{2-0};
4518 let Inst{15-13} = Qd{2-0};
4519 let Inst{12-9} = 0b0111;
4521 let Inst{7} = Qn{3};
4523 let Inst{5} = Qm{3};
4525 let Inst{3-1} = Qm{2-0};
4529 foreach suffix = ["s8", "s16", "s32", "u8", "u16", "u32",
4530 "i8", "i16", "i32", "f16", "f32"] in
4531 def : MVEInstAlias<"vpsel${vp}." # suffix # "\t$Qd, $Qn, $Qm",
4532 (MVE_VPSEL MQPR:$Qd, MQPR:$Qn, MQPR:$Qm, vpred_n:$vp)>;
4534 let Predicates = [HasMVEInt] in {
4535 def : Pat<(v16i8 (vselect (v16i1 VCCR:$pred), (v16i8 MQPR:$v1), (v16i8 MQPR:$v2))),
4536 (v16i8 (MVE_VPSEL MQPR:$v1, MQPR:$v2, 0, VCCR:$pred))>;
4537 def : Pat<(v8i16 (vselect (v8i1 VCCR:$pred), (v8i16 MQPR:$v1), (v8i16 MQPR:$v2))),
4538 (v8i16 (MVE_VPSEL MQPR:$v1, MQPR:$v2, 0, VCCR:$pred))>;
4539 def : Pat<(v4i32 (vselect (v4i1 VCCR:$pred), (v4i32 MQPR:$v1), (v4i32 MQPR:$v2))),
4540 (v4i32 (MVE_VPSEL MQPR:$v1, MQPR:$v2, 0, VCCR:$pred))>;
4542 def : Pat<(v8f16 (vselect (v8i1 VCCR:$pred), (v8f16 MQPR:$v1), (v8f16 MQPR:$v2))),
4543 (v8f16 (MVE_VPSEL MQPR:$v1, MQPR:$v2, 0, VCCR:$pred))>;
4544 def : Pat<(v4f32 (vselect (v4i1 VCCR:$pred), (v4f32 MQPR:$v1), (v4f32 MQPR:$v2))),
4545 (v4f32 (MVE_VPSEL MQPR:$v1, MQPR:$v2, 0, VCCR:$pred))>;
4547 def : Pat<(v16i8 (vselect (v16i8 MQPR:$pred), (v16i8 MQPR:$v1), (v16i8 MQPR:$v2))),
4548 (v16i8 (MVE_VPSEL MQPR:$v1, MQPR:$v2, 0,
4549 (MVE_VCMPi8 (v16i8 MQPR:$pred), (MVE_VMOVimmi8 0), 1)))>;
4550 def : Pat<(v8i16 (vselect (v8i16 MQPR:$pred), (v8i16 MQPR:$v1), (v8i16 MQPR:$v2))),
4551 (v8i16 (MVE_VPSEL MQPR:$v1, MQPR:$v2, 0,
4552 (MVE_VCMPi16 (v8i16 MQPR:$pred), (MVE_VMOVimmi16 0), 1)))>;
4553 def : Pat<(v4i32 (vselect (v4i32 MQPR:$pred), (v4i32 MQPR:$v1), (v4i32 MQPR:$v2))),
4554 (v4i32 (MVE_VPSEL MQPR:$v1, MQPR:$v2, 0,
4555 (MVE_VCMPi32 (v4i32 MQPR:$pred), (MVE_VMOVimmi32 0), 1)))>;
4557 def : Pat<(v8f16 (vselect (v8i16 MQPR:$pred), (v8f16 MQPR:$v1), (v8f16 MQPR:$v2))),
4558 (v8f16 (MVE_VPSEL MQPR:$v1, MQPR:$v2, 0,
4559 (MVE_VCMPi16 (v8i16 MQPR:$pred), (MVE_VMOVimmi16 0), 1)))>;
4560 def : Pat<(v4f32 (vselect (v4i32 MQPR:$pred), (v4f32 MQPR:$v1), (v4f32 MQPR:$v2))),
4561 (v4f32 (MVE_VPSEL MQPR:$v1, MQPR:$v2, 0,
4562 (MVE_VCMPi32 (v4i32 MQPR:$pred), (MVE_VMOVimmi32 0), 1)))>;
4565 def : Pat<(v16i8 (zext (v16i1 VCCR:$pred))),
4566 (v16i8 (MVE_VPSEL (MVE_VMOVimmi8 1), (MVE_VMOVimmi8 0), 0, VCCR:$pred))>;
4567 def : Pat<(v8i16 (zext (v8i1 VCCR:$pred))),
4568 (v8i16 (MVE_VPSEL (MVE_VMOVimmi16 1), (MVE_VMOVimmi16 0), 0, VCCR:$pred))>;
4569 def : Pat<(v4i32 (zext (v4i1 VCCR:$pred))),
4570 (v4i32 (MVE_VPSEL (MVE_VMOVimmi32 1), (MVE_VMOVimmi32 0), 0, VCCR:$pred))>;
4572 def : Pat<(v16i8 (sext (v16i1 VCCR:$pred))),
4573 (v16i8 (MVE_VPSEL (MVE_VMOVimmi8 255), (MVE_VMOVimmi8 0), 0, VCCR:$pred))>;
4574 def : Pat<(v8i16 (sext (v8i1 VCCR:$pred))),
4575 (v8i16 (MVE_VPSEL (MVE_VMOVimmi8 255), (MVE_VMOVimmi16 0), 0, VCCR:$pred))>;
4576 def : Pat<(v4i32 (sext (v4i1 VCCR:$pred))),
4577 (v4i32 (MVE_VPSEL (MVE_VMOVimmi8 255), (MVE_VMOVimmi32 0), 0, VCCR:$pred))>;
4579 def : Pat<(v16i8 (anyext (v16i1 VCCR:$pred))),
4580 (v16i8 (MVE_VPSEL (MVE_VMOVimmi8 1), (MVE_VMOVimmi8 0), 0, VCCR:$pred))>;
4581 def : Pat<(v8i16 (anyext (v8i1 VCCR:$pred))),
4582 (v8i16 (MVE_VPSEL (MVE_VMOVimmi16 1), (MVE_VMOVimmi16 0), 0, VCCR:$pred))>;
4583 def : Pat<(v4i32 (anyext (v4i1 VCCR:$pred))),
4584 (v4i32 (MVE_VPSEL (MVE_VMOVimmi32 1), (MVE_VMOVimmi32 0), 0, VCCR:$pred))>;
4587 let Predicates = [HasMVEFloat] in {
4589 // 112 is 1.0 in float
4590 def : Pat<(v4f32 (uint_to_fp (v4i1 VCCR:$pred))),
4591 (v4f32 (MVE_VPSEL (v4f32 (MVE_VMOVimmf32 112)), (v4f32 (MVE_VMOVimmi32 0)), 0, VCCR:$pred))>;
4592 // 2620 in 1.0 in half
4593 def : Pat<(v8f16 (uint_to_fp (v8i1 VCCR:$pred))),
4594 (v8f16 (MVE_VPSEL (v8f16 (MVE_VMOVimmi16 2620)), (v8f16 (MVE_VMOVimmi16 0)), 0, VCCR:$pred))>;
4595 // 240 is -1.0 in float
4596 def : Pat<(v4f32 (sint_to_fp (v4i1 VCCR:$pred))),
4597 (v4f32 (MVE_VPSEL (v4f32 (MVE_VMOVimmf32 240)), (v4f32 (MVE_VMOVimmi32 0)), 0, VCCR:$pred))>;
4598 // 2748 is -1.0 in half
4599 def : Pat<(v8f16 (sint_to_fp (v8i1 VCCR:$pred))),
4600 (v8f16 (MVE_VPSEL (v8f16 (MVE_VMOVimmi16 2748)), (v8f16 (MVE_VMOVimmi16 0)), 0, VCCR:$pred))>;
4602 def : Pat<(v4i1 (fp_to_uint (v4f32 MQPR:$v1))),
4603 (v4i1 (MVE_VCMPf32r (v4f32 MQPR:$v1), ZR, 1))>;
4604 def : Pat<(v8i1 (fp_to_uint (v8f16 MQPR:$v1))),
4605 (v8i1 (MVE_VCMPf16r (v8f16 MQPR:$v1), ZR, 1))>;
4606 def : Pat<(v4i1 (fp_to_sint (v4f32 MQPR:$v1))),
4607 (v4i1 (MVE_VCMPf32r (v4f32 MQPR:$v1), ZR, 1))>;
4608 def : Pat<(v8i1 (fp_to_sint (v8f16 MQPR:$v1))),
4609 (v8i1 (MVE_VCMPf16r (v8f16 MQPR:$v1), ZR, 1))>;
4612 def MVE_VPNOT : MVE_p<(outs VCCR:$P0), (ins VCCR:$P0_in), NoItinerary,
4613 "vpnot", "", "", vpred_n, "", []> {
4614 let Inst{31-0} = 0b11111110001100010000111101001101;
4615 let Unpredictable{19-17} = 0b111;
4616 let Unpredictable{12} = 0b1;
4617 let Unpredictable{7} = 0b1;
4618 let Unpredictable{5} = 0b1;
4620 let Constraints = "";
4621 let DecoderMethod = "DecodeMVEVPNOT";
4624 let Predicates = [HasMVEInt] in {
4625 def : Pat<(v4i1 (xor (v4i1 VCCR:$pred), (v4i1 (predicate_cast (i32 65535))))),
4626 (v4i1 (MVE_VPNOT (v4i1 VCCR:$pred)))>;
4627 def : Pat<(v8i1 (xor (v8i1 VCCR:$pred), (v8i1 (predicate_cast (i32 65535))))),
4628 (v8i1 (MVE_VPNOT (v8i1 VCCR:$pred)))>;
4629 def : Pat<(v16i1 (xor (v16i1 VCCR:$pred), (v16i1 (predicate_cast (i32 65535))))),
4630 (v16i1 (MVE_VPNOT (v16i1 VCCR:$pred)))>;
4634 class MVE_loltp_start<dag iops, string asm, string ops, bits<2> size>
4635 : t2LOL<(outs GPRlr:$LR), iops, asm, ops> {
4637 let Predicates = [HasMVEInt];
4639 let Inst{21-20} = size;
4640 let Inst{19-16} = Rn{3-0};
4644 class MVE_DLSTP<string asm, bits<2> size>
4645 : MVE_loltp_start<(ins rGPR:$Rn), asm, "$LR, $Rn", size> {
4647 let Inst{11-1} = 0b00000000000;
4648 let Unpredictable{10-1} = 0b1111111111;
4651 class MVE_WLSTP<string asm, bits<2> size>
4652 : MVE_loltp_start<(ins rGPR:$Rn, wlslabel_u11:$label),
4653 asm, "$LR, $Rn, $label", size> {
4656 let Inst{11} = label{0};
4657 let Inst{10-1} = label{10-1};
4660 def MVE_DLSTP_8 : MVE_DLSTP<"dlstp.8", 0b00>;
4661 def MVE_DLSTP_16 : MVE_DLSTP<"dlstp.16", 0b01>;
4662 def MVE_DLSTP_32 : MVE_DLSTP<"dlstp.32", 0b10>;
4663 def MVE_DLSTP_64 : MVE_DLSTP<"dlstp.64", 0b11>;
4665 def MVE_WLSTP_8 : MVE_WLSTP<"wlstp.8", 0b00>;
4666 def MVE_WLSTP_16 : MVE_WLSTP<"wlstp.16", 0b01>;
4667 def MVE_WLSTP_32 : MVE_WLSTP<"wlstp.32", 0b10>;
4668 def MVE_WLSTP_64 : MVE_WLSTP<"wlstp.64", 0b11>;
4670 class MVE_loltp_end<dag oops, dag iops, string asm, string ops>
4671 : t2LOL<oops, iops, asm, ops> {
4672 let Predicates = [HasMVEInt];
4673 let Inst{22-21} = 0b00;
4674 let Inst{19-16} = 0b1111;
4678 def MVE_LETP : MVE_loltp_end<(outs GPRlr:$LRout),
4679 (ins GPRlr:$LRin, lelabel_u11:$label),
4680 "letp", "$LRin, $label"> {
4684 let Inst{11} = label{0};
4685 let Inst{10-1} = label{10-1};
4688 def MVE_LCTP : MVE_loltp_end<(outs), (ins pred:$p), "lctp${p}", ""> {
4691 let Inst{11-1} = 0b00000000000;
4692 let Unpredictable{21-20} = 0b11;
4693 let Unpredictable{11-1} = 0b11111111111;
4697 //===----------------------------------------------------------------------===//
4699 //===----------------------------------------------------------------------===//
4701 class MVE_unpred_vector_store_typed<ValueType Ty, Instruction RegImmInst,
4702 PatFrag StoreKind, int shift>
4703 : Pat<(StoreKind (Ty MQPR:$val), t2addrmode_imm7<shift>:$addr),
4704 (RegImmInst (Ty MQPR:$val), t2addrmode_imm7<shift>:$addr)>;
4706 multiclass MVE_unpred_vector_store<Instruction RegImmInst, PatFrag StoreKind,
4708 def : MVE_unpred_vector_store_typed<v16i8, RegImmInst, StoreKind, shift>;
4709 def : MVE_unpred_vector_store_typed<v8i16, RegImmInst, StoreKind, shift>;
4710 def : MVE_unpred_vector_store_typed<v8f16, RegImmInst, StoreKind, shift>;
4711 def : MVE_unpred_vector_store_typed<v4i32, RegImmInst, StoreKind, shift>;
4712 def : MVE_unpred_vector_store_typed<v4f32, RegImmInst, StoreKind, shift>;
4713 def : MVE_unpred_vector_store_typed<v2i64, RegImmInst, StoreKind, shift>;
4714 def : MVE_unpred_vector_store_typed<v2f64, RegImmInst, StoreKind, shift>;
4717 class MVE_unpred_vector_load_typed<ValueType Ty, Instruction RegImmInst,
4718 PatFrag LoadKind, int shift>
4719 : Pat<(Ty (LoadKind t2addrmode_imm7<shift>:$addr)),
4720 (Ty (RegImmInst t2addrmode_imm7<shift>:$addr))>;
4722 multiclass MVE_unpred_vector_load<Instruction RegImmInst, PatFrag LoadKind,
4724 def : MVE_unpred_vector_load_typed<v16i8, RegImmInst, LoadKind, shift>;
4725 def : MVE_unpred_vector_load_typed<v8i16, RegImmInst, LoadKind, shift>;
4726 def : MVE_unpred_vector_load_typed<v8f16, RegImmInst, LoadKind, shift>;
4727 def : MVE_unpred_vector_load_typed<v4i32, RegImmInst, LoadKind, shift>;
4728 def : MVE_unpred_vector_load_typed<v4f32, RegImmInst, LoadKind, shift>;
4729 def : MVE_unpred_vector_load_typed<v2i64, RegImmInst, LoadKind, shift>;
4730 def : MVE_unpred_vector_load_typed<v2f64, RegImmInst, LoadKind, shift>;
4733 let Predicates = [HasMVEInt, IsLE] in {
4734 defm : MVE_unpred_vector_store<MVE_VSTRBU8, byte_alignedstore, 0>;
4735 defm : MVE_unpred_vector_store<MVE_VSTRHU16, hword_alignedstore, 1>;
4736 defm : MVE_unpred_vector_store<MVE_VSTRWU32, alignedstore32, 2>;
4738 defm : MVE_unpred_vector_load<MVE_VLDRBU8, byte_alignedload, 0>;
4739 defm : MVE_unpred_vector_load<MVE_VLDRHU16, hword_alignedload, 1>;
4740 defm : MVE_unpred_vector_load<MVE_VLDRWU32, alignedload32, 2>;
4742 def : Pat<(v16i1 (load t2addrmode_imm7<2>:$addr)),
4743 (v16i1 (VLDR_P0_off t2addrmode_imm7<2>:$addr))>;
4744 def : Pat<(v8i1 (load t2addrmode_imm7<2>:$addr)),
4745 (v8i1 (VLDR_P0_off t2addrmode_imm7<2>:$addr))>;
4746 def : Pat<(v4i1 (load t2addrmode_imm7<2>:$addr)),
4747 (v4i1 (VLDR_P0_off t2addrmode_imm7<2>:$addr))>;
4750 let Predicates = [HasMVEInt, IsBE] in {
4751 def : MVE_unpred_vector_store_typed<v16i8, MVE_VSTRBU8, store, 0>;
4752 def : MVE_unpred_vector_store_typed<v8i16, MVE_VSTRHU16, alignedstore16, 1>;
4753 def : MVE_unpred_vector_store_typed<v8f16, MVE_VSTRHU16, alignedstore16, 1>;
4754 def : MVE_unpred_vector_store_typed<v4i32, MVE_VSTRWU32, alignedstore32, 2>;
4755 def : MVE_unpred_vector_store_typed<v4f32, MVE_VSTRWU32, alignedstore32, 2>;
4757 def : MVE_unpred_vector_load_typed<v16i8, MVE_VLDRBU8, load, 0>;
4758 def : MVE_unpred_vector_load_typed<v8i16, MVE_VLDRHU16, alignedload16, 1>;
4759 def : MVE_unpred_vector_load_typed<v8f16, MVE_VLDRHU16, alignedload16, 1>;
4760 def : MVE_unpred_vector_load_typed<v4i32, MVE_VLDRWU32, alignedload32, 2>;
4761 def : MVE_unpred_vector_load_typed<v4f32, MVE_VLDRWU32, alignedload32, 2>;
4765 // Widening/Narrowing Loads/Stores
4767 let Predicates = [HasMVEInt] in {
4768 def : Pat<(truncstorevi8 (v8i16 MQPR:$val), t2addrmode_imm7<1>:$addr),
4769 (MVE_VSTRB16 MQPR:$val, t2addrmode_imm7<1>:$addr)>;
4770 def : Pat<(truncstorevi8 (v4i32 MQPR:$val), t2addrmode_imm7<1>:$addr),
4771 (MVE_VSTRB32 MQPR:$val, t2addrmode_imm7<1>:$addr)>;
4772 def : Pat<(truncstorevi16 (v4i32 MQPR:$val), t2addrmode_imm7<2>:$addr),
4773 (MVE_VSTRH32 MQPR:$val, t2addrmode_imm7<2>:$addr)>;
4776 multiclass MVEExtLoad<string DestLanes, string DestElemBits,
4777 string SrcElemBits, string SrcElemType,
4779 def _Any : Pat<(!cast<ValueType>("v" # DestLanes # "i" # DestElemBits)
4780 (!cast<PatFrag>("extloadvi" # SrcElemBits) am:$addr)),
4781 (!cast<Instruction>("MVE_VLDR" # SrcElemType # "U" # DestElemBits)
4783 def _Z : Pat<(!cast<ValueType>("v" # DestLanes # "i" # DestElemBits)
4784 (!cast<PatFrag>("zextloadvi" # SrcElemBits) am:$addr)),
4785 (!cast<Instruction>("MVE_VLDR" # SrcElemType # "U" # DestElemBits)
4787 def _S : Pat<(!cast<ValueType>("v" # DestLanes # "i" # DestElemBits)
4788 (!cast<PatFrag>("sextloadvi" # SrcElemBits) am:$addr)),
4789 (!cast<Instruction>("MVE_VLDR" # SrcElemType # "S" # DestElemBits)
4793 let Predicates = [HasMVEInt] in {
4794 defm : MVEExtLoad<"4", "32", "8", "B", t2addrmode_imm7<1>>;
4795 defm : MVEExtLoad<"8", "16", "8", "B", t2addrmode_imm7<1>>;
4796 defm : MVEExtLoad<"4", "32", "16", "H", t2addrmode_imm7<2>>;
4800 // Bit convert patterns
4802 let Predicates = [HasMVEInt] in {
4803 def : Pat<(v2f64 (bitconvert (v2i64 QPR:$src))), (v2f64 QPR:$src)>;
4804 def : Pat<(v2i64 (bitconvert (v2f64 QPR:$src))), (v2i64 QPR:$src)>;
4806 def : Pat<(v4i32 (bitconvert (v4f32 QPR:$src))), (v4i32 QPR:$src)>;
4807 def : Pat<(v4f32 (bitconvert (v4i32 QPR:$src))), (v4f32 QPR:$src)>;
4809 def : Pat<(v8i16 (bitconvert (v8f16 QPR:$src))), (v8i16 QPR:$src)>;
4810 def : Pat<(v8f16 (bitconvert (v8i16 QPR:$src))), (v8f16 QPR:$src)>;
4813 let Predicates = [IsLE,HasMVEInt] in {
4814 def : Pat<(v2f64 (bitconvert (v4f32 QPR:$src))), (v2f64 QPR:$src)>;
4815 def : Pat<(v2f64 (bitconvert (v4i32 QPR:$src))), (v2f64 QPR:$src)>;
4816 def : Pat<(v2f64 (bitconvert (v8f16 QPR:$src))), (v2f64 QPR:$src)>;
4817 def : Pat<(v2f64 (bitconvert (v8i16 QPR:$src))), (v2f64 QPR:$src)>;
4818 def : Pat<(v2f64 (bitconvert (v16i8 QPR:$src))), (v2f64 QPR:$src)>;
4820 def : Pat<(v2i64 (bitconvert (v4f32 QPR:$src))), (v2i64 QPR:$src)>;
4821 def : Pat<(v2i64 (bitconvert (v4i32 QPR:$src))), (v2i64 QPR:$src)>;
4822 def : Pat<(v2i64 (bitconvert (v8f16 QPR:$src))), (v2i64 QPR:$src)>;
4823 def : Pat<(v2i64 (bitconvert (v8i16 QPR:$src))), (v2i64 QPR:$src)>;
4824 def : Pat<(v2i64 (bitconvert (v16i8 QPR:$src))), (v2i64 QPR:$src)>;
4826 def : Pat<(v4f32 (bitconvert (v2f64 QPR:$src))), (v4f32 QPR:$src)>;
4827 def : Pat<(v4f32 (bitconvert (v2i64 QPR:$src))), (v4f32 QPR:$src)>;
4828 def : Pat<(v4f32 (bitconvert (v8f16 QPR:$src))), (v4f32 QPR:$src)>;
4829 def : Pat<(v4f32 (bitconvert (v8i16 QPR:$src))), (v4f32 QPR:$src)>;
4830 def : Pat<(v4f32 (bitconvert (v16i8 QPR:$src))), (v4f32 QPR:$src)>;
4832 def : Pat<(v4i32 (bitconvert (v2f64 QPR:$src))), (v4i32 QPR:$src)>;
4833 def : Pat<(v4i32 (bitconvert (v2i64 QPR:$src))), (v4i32 QPR:$src)>;
4834 def : Pat<(v4i32 (bitconvert (v8f16 QPR:$src))), (v4i32 QPR:$src)>;
4835 def : Pat<(v4i32 (bitconvert (v8i16 QPR:$src))), (v4i32 QPR:$src)>;
4836 def : Pat<(v4i32 (bitconvert (v16i8 QPR:$src))), (v4i32 QPR:$src)>;
4838 def : Pat<(v8f16 (bitconvert (v2f64 QPR:$src))), (v8f16 QPR:$src)>;
4839 def : Pat<(v8f16 (bitconvert (v2i64 QPR:$src))), (v8f16 QPR:$src)>;
4840 def : Pat<(v8f16 (bitconvert (v4f32 QPR:$src))), (v8f16 QPR:$src)>;
4841 def : Pat<(v8f16 (bitconvert (v4i32 QPR:$src))), (v8f16 QPR:$src)>;
4842 def : Pat<(v8f16 (bitconvert (v16i8 QPR:$src))), (v8f16 QPR:$src)>;
4844 def : Pat<(v8i16 (bitconvert (v2f64 QPR:$src))), (v8i16 QPR:$src)>;
4845 def : Pat<(v8i16 (bitconvert (v2i64 QPR:$src))), (v8i16 QPR:$src)>;
4846 def : Pat<(v8i16 (bitconvert (v4f32 QPR:$src))), (v8i16 QPR:$src)>;
4847 def : Pat<(v8i16 (bitconvert (v4i32 QPR:$src))), (v8i16 QPR:$src)>;
4848 def : Pat<(v8i16 (bitconvert (v16i8 QPR:$src))), (v8i16 QPR:$src)>;
4850 def : Pat<(v16i8 (bitconvert (v2f64 QPR:$src))), (v16i8 QPR:$src)>;
4851 def : Pat<(v16i8 (bitconvert (v2i64 QPR:$src))), (v16i8 QPR:$src)>;
4852 def : Pat<(v16i8 (bitconvert (v4f32 QPR:$src))), (v16i8 QPR:$src)>;
4853 def : Pat<(v16i8 (bitconvert (v4i32 QPR:$src))), (v16i8 QPR:$src)>;
4854 def : Pat<(v16i8 (bitconvert (v8f16 QPR:$src))), (v16i8 QPR:$src)>;
4855 def : Pat<(v16i8 (bitconvert (v8i16 QPR:$src))), (v16i8 QPR:$src)>;