@@ -209,7 +209,14 @@ def SVE8BitLslImm : ComplexPattern<i32, 2, "SelectSVE8BitLslImm", [imm]>;
209
209
def SVEArithUImmPat : ComplexPattern<i32, 1, "SelectSVEArithImm", []>;
210
210
def SVEArithSImmPat : ComplexPattern<i32, 1, "SelectSVESignedArithImm", []>;
211
211
212
- def SVEShiftImm64 : ComplexPattern<i32, 1, "SelectSVEShiftImm64<0, 64>", []>;
212
+ def SVEShiftImmL8 : ComplexPattern<i32, 1, "SelectSVEShiftImm<0, 7>", []>;
213
+ def SVEShiftImmL16 : ComplexPattern<i32, 1, "SelectSVEShiftImm<0, 15>", []>;
214
+ def SVEShiftImmL32 : ComplexPattern<i32, 1, "SelectSVEShiftImm<0, 31>", []>;
215
+ def SVEShiftImmL64 : ComplexPattern<i32, 1, "SelectSVEShiftImm<0, 63>", []>;
216
+ def SVEShiftImmR8 : ComplexPattern<i32, 1, "SelectSVEShiftImm<1, 8, true>", []>;
217
+ def SVEShiftImmR16 : ComplexPattern<i32, 1, "SelectSVEShiftImm<1, 16, true>", []>;
218
+ def SVEShiftImmR32 : ComplexPattern<i32, 1, "SelectSVEShiftImm<1, 32, true>", []>;
219
+ def SVEShiftImmR64 : ComplexPattern<i32, 1, "SelectSVEShiftImm<1, 64, true>", []>;
213
220
214
221
class SVEExactFPImm<string Suffix, string ValA, string ValB> : AsmOperandClass {
215
222
let Name = "SVEExactFPImmOperand" # Suffix;
@@ -315,11 +322,6 @@ class SVE_1_Op_Imm_OptLsl_Pat<ValueType vt, SDPatternOperator op, ZPRRegOp zprty
315
322
: Pat<(vt (op (vt zprty:$Op1), (vt (AArch64dup (it (cpx i32:$imm, i32:$shift)))))),
316
323
(inst $Op1, i32:$imm, i32:$shift)>;
317
324
318
- class SVE_1_Op_Imm_Shift_Pred_Pat<ValueType vt, ValueType pt, SDPatternOperator op,
319
- ZPRRegOp zprty, Operand ImmTy, Instruction inst>
320
- : Pat<(vt (op (pt (AArch64ptrue 31)), (vt zprty:$Op1), (vt (AArch64dup (ImmTy:$imm))))),
321
- (inst $Op1, ImmTy:$imm)>;
322
-
323
325
class SVE_1_Op_Imm_Arith_Pred_Pat<ValueType vt, ValueType pt, SDPatternOperator op,
324
326
ZPRRegOp zprty, ValueType it, ComplexPattern cpx, Instruction inst>
325
327
: Pat<(vt (op (pt (AArch64ptrue 31)), (vt zprty:$Op1), (vt (AArch64dup (it (cpx i32:$imm)))))),
@@ -409,6 +411,18 @@ class SVE_InReg_Extend<ValueType vt, SDPatternOperator op, ValueType pt,
409
411
: Pat<(vt (op pt:$Pg, vt:$Src, inreg_vt, vt:$PassThru)),
410
412
(inst $PassThru, $Pg, $Src)>;
411
413
414
+ class SVE_Shift_DupImm_Pred_Pat<ValueType vt, SDPatternOperator op,
415
+ ValueType pt, ValueType it,
416
+ ComplexPattern cast, Instruction inst>
417
+ : Pat<(vt (op pt:$Pg, vt:$Rn, (vt (AArch64dup (it (cast i32:$imm)))))),
418
+ (inst $Pg, $Rn, i32:$imm)>;
419
+
420
+ class SVE_Shift_DupImm_All_Active_Pat<ValueType vt, SDPatternOperator op,
421
+ ValueType pt, ValueType it,
422
+ ComplexPattern cast, Instruction inst>
423
+ : Pat<(vt (op (pt (AArch64ptrue 31)), vt:$Rn, (vt (AArch64dup (it (cast i32:$imm)))))),
424
+ (inst $Rn, i32:$imm)>;
425
+
412
426
//
413
427
// Pseudo -> Instruction mappings
414
428
//
@@ -4761,38 +4775,19 @@ class sve_int_bin_pred_shift_imm<bits<4> tsz8_64, bits<4> opc, string asm,
4761
4775
let ElementSize = zprty.ElementSize;
4762
4776
}
4763
4777
4764
- multiclass sve_int_bin_pred_shift_imm_left<bits<4> opc, string asm, string psName=""> {
4765
- def _B : SVEPseudo2Instr<psName # _B, 1>,
4778
+ multiclass sve_int_bin_pred_shift_imm_left<bits<4> opc, string asm, string Ps,
4779
+ SDPatternOperator op = null_frag> {
4780
+ def _B : SVEPseudo2Instr<Ps # _B, 1>,
4766
4781
sve_int_bin_pred_shift_imm<{0,0,0,1}, opc, asm, ZPR8, vecshiftL8>;
4767
- def _H : SVEPseudo2Instr<psName # _H, 1>,
4768
- sve_int_bin_pred_shift_imm<{0,0,1,?}, opc, asm, ZPR16, vecshiftL16> {
4769
- let Inst{8} = imm{3};
4770
- }
4771
- def _S : SVEPseudo2Instr<psName # _S, 1>,
4772
- sve_int_bin_pred_shift_imm<{0,1,?,?}, opc, asm, ZPR32, vecshiftL32> {
4773
- let Inst{9-8} = imm{4-3};
4774
- }
4775
- def _D : SVEPseudo2Instr<psName # _D, 1>,
4776
- sve_int_bin_pred_shift_imm<{1,?,?,?}, opc, asm, ZPR64, vecshiftL64> {
4777
- let Inst{22} = imm{5};
4778
- let Inst{9-8} = imm{4-3};
4779
- }
4780
- }
4781
-
4782
- multiclass sve2_int_bin_pred_shift_imm_left<bits<4> opc, string asm,
4783
- string psName,
4784
- SDPatternOperator op> {
4785
-
4786
- def _B : SVEPseudo2Instr<psName # _B, 1>, sve_int_bin_pred_shift_imm<{0,0,0,1}, opc, asm, ZPR8, vecshiftL8>;
4787
- def _H : SVEPseudo2Instr<psName # _H, 1>,
4782
+ def _H : SVEPseudo2Instr<Ps # _H, 1>,
4788
4783
sve_int_bin_pred_shift_imm<{0,0,1,?}, opc, asm, ZPR16, vecshiftL16> {
4789
4784
let Inst{8} = imm{3};
4790
4785
}
4791
- def _S : SVEPseudo2Instr<psName # _S, 1>,
4786
+ def _S : SVEPseudo2Instr<Ps # _S, 1>,
4792
4787
sve_int_bin_pred_shift_imm<{0,1,?,?}, opc, asm, ZPR32, vecshiftL32> {
4793
4788
let Inst{9-8} = imm{4-3};
4794
4789
}
4795
- def _D : SVEPseudo2Instr<psName # _D, 1>,
4790
+ def _D : SVEPseudo2Instr<Ps # _D, 1>,
4796
4791
sve_int_bin_pred_shift_imm<{1,?,?,?}, opc, asm, ZPR64, vecshiftL64> {
4797
4792
let Inst{22} = imm{5};
4798
4793
let Inst{9-8} = imm{4-3};
@@ -4804,6 +4799,16 @@ multiclass sve2_int_bin_pred_shift_imm_left<bits<4> opc, string asm,
4804
4799
def : SVE_3_Op_Imm_Pat<nxv2i64, op, nxv2i1, nxv2i64, i32, tvecshiftL64, !cast<Instruction>(NAME # _D)>;
4805
4800
}
4806
4801
4802
+ // As above but shift amount takes the form of a "vector immediate".
4803
+ multiclass sve_int_bin_pred_shift_imm_left_dup<bits<4> opc, string asm,
4804
+ string Ps, SDPatternOperator op>
4805
+ : sve_int_bin_pred_shift_imm_left<opc, asm, Ps, null_frag> {
4806
+ def : SVE_Shift_DupImm_Pred_Pat<nxv16i8, op, nxv16i1, i32, SVEShiftImmL8, !cast<Instruction>(NAME # _B)>;
4807
+ def : SVE_Shift_DupImm_Pred_Pat<nxv8i16, op, nxv8i1, i32, SVEShiftImmL16, !cast<Instruction>(NAME # _H)>;
4808
+ def : SVE_Shift_DupImm_Pred_Pat<nxv4i32, op, nxv4i1, i32, SVEShiftImmL32, !cast<Instruction>(NAME # _S)>;
4809
+ def : SVE_Shift_DupImm_Pred_Pat<nxv2i64, op, nxv2i1, i64, SVEShiftImmL64, !cast<Instruction>(NAME # _D)>;
4810
+ }
4811
+
4807
4812
multiclass sve_int_bin_pred_shift_imm_left_zeroing_bhsd<SDPatternOperator op> {
4808
4813
def _ZERO_B : PredTwoOpImmPseudo<NAME # _B, ZPR8, tvecshiftL8, FalseLanesZero>;
4809
4814
def _ZERO_H : PredTwoOpImmPseudo<NAME # _H, ZPR16, tvecshiftL16, FalseLanesZero>;
@@ -4840,6 +4845,16 @@ multiclass sve_int_bin_pred_shift_imm_right<bits<4> opc, string asm, string Ps,
4840
4845
def : SVE_3_Op_Imm_Pat<nxv2i64, op, nxv2i1, nxv2i64, i32, tvecshiftR64, !cast<Instruction>(NAME # _D)>;
4841
4846
}
4842
4847
4848
+ // As above but shift amount takes the form of a "vector immediate".
4849
+ multiclass sve_int_bin_pred_shift_imm_right_dup<bits<4> opc, string asm,
4850
+ string Ps, SDPatternOperator op>
4851
+ : sve_int_bin_pred_shift_imm_right<opc, asm, Ps, null_frag> {
4852
+ def : SVE_Shift_DupImm_Pred_Pat<nxv16i8, op, nxv16i1, i32, SVEShiftImmR8, !cast<Instruction>(NAME # _B)>;
4853
+ def : SVE_Shift_DupImm_Pred_Pat<nxv8i16, op, nxv8i1, i32, SVEShiftImmR16, !cast<Instruction>(NAME # _H)>;
4854
+ def : SVE_Shift_DupImm_Pred_Pat<nxv4i32, op, nxv4i1, i32, SVEShiftImmR32, !cast<Instruction>(NAME # _S)>;
4855
+ def : SVE_Shift_DupImm_Pred_Pat<nxv2i64, op, nxv2i1, i64, SVEShiftImmR64, !cast<Instruction>(NAME # _D)>;
4856
+ }
4857
+
4843
4858
multiclass sve_int_bin_pred_shift_imm_right_zeroing_bhsd<SDPatternOperator op = null_frag> {
4844
4859
def _ZERO_B : PredTwoOpImmPseudo<NAME # _B, ZPR8, vecshiftR8, FalseLanesZero>;
4845
4860
def _ZERO_H : PredTwoOpImmPseudo<NAME # _H, ZPR16, vecshiftR16, FalseLanesZero>;
@@ -4980,10 +4995,10 @@ multiclass sve_int_bin_cons_shift_imm_left<bits<2> opc, string asm,
4980
4995
let Inst{20-19} = imm{4-3};
4981
4996
}
4982
4997
4983
- def : SVE_1_Op_Imm_Shift_Pred_Pat <nxv16i8, nxv16i1, op, ZPR8, vecshiftL8 , !cast<Instruction>(NAME # _B)>;
4984
- def : SVE_1_Op_Imm_Shift_Pred_Pat <nxv8i16, nxv8i1, op, ZPR16, vecshiftL16 , !cast<Instruction>(NAME # _H)>;
4985
- def : SVE_1_Op_Imm_Shift_Pred_Pat <nxv4i32, nxv4i1, op, ZPR32, vecshiftL32 , !cast<Instruction>(NAME # _S)>;
4986
- def : SVE_1_Op_Imm_Arith_Pred_Pat <nxv2i64, nxv2i1, op, ZPR64, i64, SVEShiftImm64 , !cast<Instruction>(NAME # _D)>;
4998
+ def : SVE_Shift_DupImm_All_Active_Pat <nxv16i8, op, nxv16i1, i32, SVEShiftImmL8 , !cast<Instruction>(NAME # _B)>;
4999
+ def : SVE_Shift_DupImm_All_Active_Pat <nxv8i16, op, nxv8i1, i32, SVEShiftImmL16 , !cast<Instruction>(NAME # _H)>;
5000
+ def : SVE_Shift_DupImm_All_Active_Pat <nxv4i32, op, nxv4i1, i32, SVEShiftImmL32 , !cast<Instruction>(NAME # _S)>;
5001
+ def : SVE_Shift_DupImm_All_Active_Pat <nxv2i64, op, nxv2i1, i64, SVEShiftImmL64 , !cast<Instruction>(NAME # _D)>;
4987
5002
}
4988
5003
4989
5004
multiclass sve_int_bin_cons_shift_imm_right<bits<2> opc, string asm,
@@ -5000,10 +5015,10 @@ multiclass sve_int_bin_cons_shift_imm_right<bits<2> opc, string asm,
5000
5015
let Inst{20-19} = imm{4-3};
5001
5016
}
5002
5017
5003
- def : SVE_1_Op_Imm_Shift_Pred_Pat <nxv16i8, nxv16i1, op, ZPR8, vecshiftR8 , !cast<Instruction>(NAME # _B)>;
5004
- def : SVE_1_Op_Imm_Shift_Pred_Pat <nxv8i16, nxv8i1, op, ZPR16, vecshiftR16 , !cast<Instruction>(NAME # _H)>;
5005
- def : SVE_1_Op_Imm_Shift_Pred_Pat <nxv4i32, nxv4i1, op, ZPR32, vecshiftR32 , !cast<Instruction>(NAME # _S)>;
5006
- def : SVE_1_Op_Imm_Arith_Pred_Pat <nxv2i64, nxv2i1, op, ZPR64, i64, SVEShiftImm64 , !cast<Instruction>(NAME # _D)>;
5018
+ def : SVE_Shift_DupImm_All_Active_Pat <nxv16i8, op, nxv16i1, i32, SVEShiftImmR8 , !cast<Instruction>(NAME # _B)>;
5019
+ def : SVE_Shift_DupImm_All_Active_Pat <nxv8i16, op, nxv8i1, i32, SVEShiftImmR16 , !cast<Instruction>(NAME # _H)>;
5020
+ def : SVE_Shift_DupImm_All_Active_Pat <nxv4i32, op, nxv4i1, i32, SVEShiftImmR32 , !cast<Instruction>(NAME # _S)>;
5021
+ def : SVE_Shift_DupImm_All_Active_Pat <nxv2i64, op, nxv2i1, i64, SVEShiftImmR64 , !cast<Instruction>(NAME # _D)>;
5007
5022
}
5008
5023
//===----------------------------------------------------------------------===//
5009
5024
// SVE Memory - Store Group
0 commit comments