@@ -482,6 +482,8 @@ let Predicates = [HasSVEorSME] in {
482
482
//===----------------------------------------------------------------------===//
483
483
// SVE pattern match helpers.
484
484
//===----------------------------------------------------------------------===//
485
+ def SVEDup0 : ComplexPattern<vAny, 0, "SelectDupZero", []>;
486
+ def SVEDup0Undef : ComplexPattern<vAny, 0, "SelectDupZeroOrUndef", []>;
485
487
486
488
class SVE_1_Op_Pat<ValueType vtd, SDPatternOperator op, ValueType vt1,
487
489
Instruction inst>
@@ -502,6 +504,11 @@ multiclass SVE_1_Op_PassthruUndef_Pat<ValueType vtd, SDPatternOperator op, Value
502
504
(inst $Op3, $Op1, $Op2)>;
503
505
}
504
506
507
+ class SVE_1_Op_PassthruUndefZero_Pat<ValueType vtd, SDPatternOperator op, ValueType pg,
508
+ ValueType vts, Instruction inst>
509
+ : Pat<(vtd (op pg:$Op1, vts:$Op2, (vtd (SVEDup0Undef)))),
510
+ (inst $Op1, $Op2)>;
511
+
505
512
// Used to match FP_ROUND_MERGE_PASSTHRU, which has an additional flag for the
506
513
// type of rounding. This is matched by timm0_1 in pattern below and ignored.
507
514
class SVE_1_Op_Passthru_Round_Pat<ValueType vtd, SDPatternOperator op, ValueType pg,
@@ -517,8 +524,6 @@ multiclass SVE_1_Op_PassthruUndef_Round_Pat<ValueType vtd, SDPatternOperator op,
517
524
(inst $Op3, $Op1, $Op2)>;
518
525
}
519
526
520
- def SVEDup0 : ComplexPattern<vAny, 0, "SelectDupZero", []>;
521
-
522
527
class SVE_1_Op_PassthruZero_Pat<ValueType vtd, SDPatternOperator op, ValueType vt1,
523
528
ValueType vt2, Instruction inst>
524
529
: Pat<(vtd (op (vtd (SVEDup0)), vt1:$Op1, vt2:$Op2)),
@@ -606,8 +611,6 @@ class SVE_4_Op_Imm_Pat<ValueType vtd, SDPatternOperator op, ValueType vt1,
606
611
: Pat<(vtd (op vt1:$Op1, vt2:$Op2, vt3:$Op3, (vt4 ImmTy:$Op4))),
607
612
(inst $Op1, $Op2, $Op3, ImmTy:$Op4)>;
608
613
609
- def SVEDup0Undef : ComplexPattern<vAny, 0, "SelectDupZeroOrUndef", []>;
610
-
611
614
let AddedComplexity = 1 in {
612
615
class SVE_3_Op_Pat_SelZero<ValueType vtd, SDPatternOperator op, ValueType vt1,
613
616
ValueType vt2, ValueType vt3, Instruction inst>
@@ -4820,23 +4823,18 @@ multiclass sve_int_un_pred_arit<bits<3> opc, string asm,
4820
4823
def : SVE_1_Op_Passthru_Pat<nxv8i16, op, nxv8i1, nxv8i16, !cast<Instruction>(NAME # _H)>;
4821
4824
def : SVE_1_Op_Passthru_Pat<nxv4i32, op, nxv4i1, nxv4i32, !cast<Instruction>(NAME # _S)>;
4822
4825
def : SVE_1_Op_Passthru_Pat<nxv2i64, op, nxv2i1, nxv2i64, !cast<Instruction>(NAME # _D)>;
4823
-
4824
- def _B_UNDEF : PredOneOpPassthruPseudo<NAME # _B, ZPR8>;
4825
- def _H_UNDEF : PredOneOpPassthruPseudo<NAME # _H, ZPR16>;
4826
- def _S_UNDEF : PredOneOpPassthruPseudo<NAME # _S, ZPR32>;
4827
- def _D_UNDEF : PredOneOpPassthruPseudo<NAME # _D, ZPR64>;
4828
-
4829
- defm : SVE_1_Op_PassthruUndef_Pat<nxv16i8, op, nxv16i1, nxv16i8, !cast<Pseudo>(NAME # _B_UNDEF)>;
4830
- defm : SVE_1_Op_PassthruUndef_Pat<nxv8i16, op, nxv8i1, nxv8i16, !cast<Pseudo>(NAME # _H_UNDEF)>;
4831
- defm : SVE_1_Op_PassthruUndef_Pat<nxv4i32, op, nxv4i1, nxv4i32, !cast<Pseudo>(NAME # _S_UNDEF)>;
4832
- defm : SVE_1_Op_PassthruUndef_Pat<nxv2i64, op, nxv2i1, nxv2i64, !cast<Pseudo>(NAME # _D_UNDEF)>;
4833
4826
}
4834
4827
4835
- multiclass sve_int_un_pred_arit_z<bits<3> opc, string asm> {
4828
+ multiclass sve_int_un_pred_arit_z<bits<3> opc, string asm, SDPatternOperator op > {
4836
4829
def _B : sve_int_un_pred_arit_z<0b00, { opc, 0b0 }, asm, ZPR8>;
4837
4830
def _H : sve_int_un_pred_arit_z<0b01, { opc, 0b0 }, asm, ZPR16>;
4838
4831
def _S : sve_int_un_pred_arit_z<0b10, { opc, 0b0 }, asm, ZPR32>;
4839
4832
def _D : sve_int_un_pred_arit_z<0b11, { opc, 0b0 }, asm, ZPR64>;
4833
+
4834
+ def : SVE_1_Op_PassthruUndefZero_Pat<nxv16i8, op, nxv16i1, nxv16i8, !cast<Instruction>(NAME # _B)>;
4835
+ def : SVE_1_Op_PassthruUndefZero_Pat<nxv8i16, op, nxv8i1, nxv8i16, !cast<Instruction>(NAME # _H)>;
4836
+ def : SVE_1_Op_PassthruUndefZero_Pat<nxv4i32, op, nxv4i1, nxv4i32, !cast<Instruction>(NAME # _S)>;
4837
+ def : SVE_1_Op_PassthruUndefZero_Pat<nxv2i64, op, nxv2i1, nxv2i64, !cast<Instruction>(NAME # _D)>;
4840
4838
}
4841
4839
4842
4840
multiclass sve_int_un_pred_arit_h<bits<3> opc, string asm,
@@ -4950,7 +4948,22 @@ multiclass sve_int_un_pred_arit_bitwise_fp<bits<3> opc, string asm,
4950
4948
def : SVE_1_Op_Passthru_Pat<nxv4f32, op, nxv4i1, nxv4f32, !cast<Instruction>(NAME # _S)>;
4951
4949
def : SVE_1_Op_Passthru_Pat<nxv2f32, op, nxv2i1, nxv2f32, !cast<Instruction>(NAME # _S)>;
4952
4950
def : SVE_1_Op_Passthru_Pat<nxv2f64, op, nxv2i1, nxv2f64, !cast<Instruction>(NAME # _D)>;
4951
+ }
4953
4952
4953
+ multiclass sve_int_un_pred_arit_bitwise_fp_z<bits<3> opc, string asm, SDPatternOperator op> {
4954
+ def _H : sve_int_un_pred_arit_z<0b01, { opc, 0b1 }, asm, ZPR16>;
4955
+ def _S : sve_int_un_pred_arit_z<0b10, { opc, 0b1 }, asm, ZPR32>;
4956
+ def _D : sve_int_un_pred_arit_z<0b11, { opc, 0b1 }, asm, ZPR64>;
4957
+
4958
+ def : SVE_1_Op_PassthruUndefZero_Pat<nxv8f16, op, nxv8i1, nxv8f16, !cast<Instruction>(NAME # _H)>;
4959
+ def : SVE_1_Op_PassthruUndefZero_Pat<nxv4f16, op, nxv4i1, nxv4f16, !cast<Instruction>(NAME # _H)>;
4960
+ def : SVE_1_Op_PassthruUndefZero_Pat<nxv2f16, op, nxv2i1, nxv2f16, !cast<Instruction>(NAME # _H)>;
4961
+ def : SVE_1_Op_PassthruUndefZero_Pat<nxv4f32, op, nxv4i1, nxv4f32, !cast<Instruction>(NAME # _S)>;
4962
+ def : SVE_1_Op_PassthruUndefZero_Pat<nxv2f32, op, nxv2i1, nxv2f32, !cast<Instruction>(NAME # _S)>;
4963
+ def : SVE_1_Op_PassthruUndefZero_Pat<nxv2f64, op, nxv2i1, nxv2f64, !cast<Instruction>(NAME # _D)>;
4964
+ }
4965
+
4966
+ multiclass sve_fp_un_pred_arit_hsd<SDPatternOperator op> {
4954
4967
def _H_UNDEF : PredOneOpPassthruPseudo<NAME # _H, ZPR16>;
4955
4968
def _S_UNDEF : PredOneOpPassthruPseudo<NAME # _S, ZPR32>;
4956
4969
def _D_UNDEF : PredOneOpPassthruPseudo<NAME # _D, ZPR64>;
@@ -4963,10 +4976,16 @@ multiclass sve_int_un_pred_arit_bitwise_fp<bits<3> opc, string asm,
4963
4976
defm : SVE_1_Op_PassthruUndef_Pat<nxv2f64, op, nxv2i1, nxv2f64, !cast<Pseudo>(NAME # _D_UNDEF)>;
4964
4977
}
4965
4978
4966
- multiclass sve_int_un_pred_arit_bitwise_fp_z<bits<3> opc, string asm> {
4967
- def _H : sve_int_un_pred_arit_z<0b01, { opc, 0b1 }, asm, ZPR16>;
4968
- def _S : sve_int_un_pred_arit_z<0b10, { opc, 0b1 }, asm, ZPR32>;
4969
- def _D : sve_int_un_pred_arit_z<0b11, { opc, 0b1 }, asm, ZPR64>;
4979
+ multiclass sve_int_un_pred_arit_bhsd<SDPatternOperator op> {
4980
+ def _B_UNDEF : PredOneOpPassthruPseudo<NAME # _B, ZPR8>;
4981
+ def _H_UNDEF : PredOneOpPassthruPseudo<NAME # _H, ZPR16>;
4982
+ def _S_UNDEF : PredOneOpPassthruPseudo<NAME # _S, ZPR32>;
4983
+ def _D_UNDEF : PredOneOpPassthruPseudo<NAME # _D, ZPR64>;
4984
+
4985
+ defm : SVE_1_Op_PassthruUndef_Pat<nxv16i8, op, nxv16i1, nxv16i8, !cast<Pseudo>(NAME # _B_UNDEF)>;
4986
+ defm : SVE_1_Op_PassthruUndef_Pat<nxv8i16, op, nxv8i1, nxv8i16, !cast<Pseudo>(NAME # _H_UNDEF)>;
4987
+ defm : SVE_1_Op_PassthruUndef_Pat<nxv4i32, op, nxv4i1, nxv4i32, !cast<Pseudo>(NAME # _S_UNDEF)>;
4988
+ defm : SVE_1_Op_PassthruUndef_Pat<nxv2i64, op, nxv2i1, nxv2i64, !cast<Pseudo>(NAME # _D_UNDEF)>;
4970
4989
}
4971
4990
4972
4991
//===----------------------------------------------------------------------===//
0 commit comments