@@ -198,14 +198,8 @@ def vsplati32 : PatFrag<(ops node:$e0),
198198 (v4i32 (build_vector node:$e0, node:$e0,
199199 node:$e0, node:$e0))>;
200200
201- def vsplati64_imm_eq_1 : PatLeaf<(bitconvert (v4i32 (build_vector))), [{
202- APInt Imm;
203- SDNode *BV = N->getOperand(0).getNode();
204- EVT EltTy = N->getValueType(0).getVectorElementType();
205-
206- return selectVSplat(BV, Imm, EltTy.getSizeInBits()) &&
207- Imm.getBitWidth() == EltTy.getSizeInBits() && Imm == 1;
208- }]>;
201+ // Any build_vector that is a constant splat with a value that equals 1
202+ def vsplat_imm_eq_1 : ComplexPattern<vAny, 0, "selectVSplatImmEq1">;
209203
210204def vsplati64 : PatFrag<(ops node:$e0),
211205 (v2i64 (build_vector node:$e0, node:$e0))>;
@@ -217,7 +211,7 @@ def vsplati64_splat_d : PatFrag<(ops node:$e0),
217211 node:$e0,
218212 node:$e0,
219213 node:$e0)),
220- vsplati64_imm_eq_1 ))))>;
214+ (vsplat_imm_eq_1) ))))>;
221215
222216def vsplatf32 : PatFrag<(ops node:$e0),
223217 (v4f32 (build_vector node:$e0, node:$e0,
@@ -352,46 +346,35 @@ def vsplat_maskr_bits_uimm6
352346 : SplatComplexPattern<vsplat_uimm6, vAny, 1, "selectVSplatMaskR",
353347 [build_vector, bitconvert]>;
354348
355- // Any build_vector that is a constant splat with a value that equals 1
356- // FIXME: These should be a ComplexPattern but we can't use them because the
357- // ISel generator requires the uses to have a name, but providing a name
358- // causes other errors ("used in pattern but not operand list")
359- def vsplat_imm_eq_1 : PatLeaf<(build_vector), [{
360- APInt Imm;
361- EVT EltTy = N->getValueType(0).getVectorElementType();
362-
363- return selectVSplat(N, Imm, EltTy.getSizeInBits()) &&
364- Imm.getBitWidth() == EltTy.getSizeInBits() && Imm == 1;
365- }]>;
366349
367350def vbclr_b : PatFrag<(ops node:$ws, node:$wt),
368- (and node:$ws, (vnot (shl vsplat_imm_eq_1, node:$wt)))>;
351+ (and node:$ws, (vnot (shl ( vsplat_imm_eq_1) , node:$wt)))>;
369352def vbclr_h : PatFrag<(ops node:$ws, node:$wt),
370- (and node:$ws, (vnot (shl vsplat_imm_eq_1, node:$wt)))>;
353+ (and node:$ws, (vnot (shl ( vsplat_imm_eq_1) , node:$wt)))>;
371354def vbclr_w : PatFrag<(ops node:$ws, node:$wt),
372- (and node:$ws, (vnot (shl vsplat_imm_eq_1, node:$wt)))>;
355+ (and node:$ws, (vnot (shl ( vsplat_imm_eq_1) , node:$wt)))>;
373356def vbclr_d : PatFrag<(ops node:$ws, node:$wt),
374- (and node:$ws, (vnot (shl (v2i64 vsplati64_imm_eq_1 ),
357+ (and node:$ws, (vnot (shl (v2i64 (vsplat_imm_eq_1) ),
375358 node:$wt)))>;
376359
377360def vbneg_b : PatFrag<(ops node:$ws, node:$wt),
378- (xor node:$ws, (shl vsplat_imm_eq_1, node:$wt))>;
361+ (xor node:$ws, (shl ( vsplat_imm_eq_1) , node:$wt))>;
379362def vbneg_h : PatFrag<(ops node:$ws, node:$wt),
380- (xor node:$ws, (shl vsplat_imm_eq_1, node:$wt))>;
363+ (xor node:$ws, (shl ( vsplat_imm_eq_1) , node:$wt))>;
381364def vbneg_w : PatFrag<(ops node:$ws, node:$wt),
382- (xor node:$ws, (shl vsplat_imm_eq_1, node:$wt))>;
365+ (xor node:$ws, (shl ( vsplat_imm_eq_1) , node:$wt))>;
383366def vbneg_d : PatFrag<(ops node:$ws, node:$wt),
384- (xor node:$ws, (shl (v2i64 vsplati64_imm_eq_1 ),
367+ (xor node:$ws, (shl (v2i64 (vsplat_imm_eq_1) ),
385368 node:$wt))>;
386369
387370def vbset_b : PatFrag<(ops node:$ws, node:$wt),
388- (or node:$ws, (shl vsplat_imm_eq_1, node:$wt))>;
371+ (or node:$ws, (shl ( vsplat_imm_eq_1) , node:$wt))>;
389372def vbset_h : PatFrag<(ops node:$ws, node:$wt),
390- (or node:$ws, (shl vsplat_imm_eq_1, node:$wt))>;
373+ (or node:$ws, (shl ( vsplat_imm_eq_1) , node:$wt))>;
391374def vbset_w : PatFrag<(ops node:$ws, node:$wt),
392- (or node:$ws, (shl vsplat_imm_eq_1, node:$wt))>;
375+ (or node:$ws, (shl ( vsplat_imm_eq_1) , node:$wt))>;
393376def vbset_d : PatFrag<(ops node:$ws, node:$wt),
394- (or node:$ws, (shl (v2i64 vsplati64_imm_eq_1 ),
377+ (or node:$ws, (shl (v2i64 (vsplat_imm_eq_1) ),
395378 node:$wt))>;
396379
397380def muladd : PatFrag<(ops node:$wd, node:$ws, node:$wt),
@@ -3842,7 +3825,7 @@ class MSAShiftPat<SDNode Node, ValueType VT, MSAInst Insn, dag Vec> :
38423825 (VT (Insn VT:$ws, VT:$wt))>;
38433826
38443827class MSABitPat<SDNode Node, ValueType VT, MSAInst Insn, PatFrag Frag> :
3845- MSAPat<(VT (Node VT:$ws, (shl vsplat_imm_eq_1, (Frag VT:$wt)))),
3828+ MSAPat<(VT (Node VT:$ws, (shl ( vsplat_imm_eq_1) , (Frag VT:$wt)))),
38463829 (VT (Insn VT:$ws, VT:$wt))>;
38473830
38483831multiclass MSAShiftPats<SDNode Node, string Insn> {
@@ -3861,7 +3844,7 @@ multiclass MSABitPats<SDNode Node, string Insn> {
38613844 def : MSABitPat<Node, v16i8, !cast<MSAInst>(Insn#_B), vsplati8imm7>;
38623845 def : MSABitPat<Node, v8i16, !cast<MSAInst>(Insn#_H), vsplati16imm15>;
38633846 def : MSABitPat<Node, v4i32, !cast<MSAInst>(Insn#_W), vsplati32imm31>;
3864- def : MSAPat<(Node v2i64:$ws, (shl (v2i64 vsplati64_imm_eq_1 ),
3847+ def : MSAPat<(Node v2i64:$ws, (shl (v2i64 (vsplat_imm_eq_1) ),
38653848 (vsplati64imm63 v2i64:$wt))),
38663849 (v2i64 (!cast<MSAInst>(Insn#_D) v2i64:$ws, v2i64:$wt))>;
38673850}
@@ -3872,16 +3855,16 @@ defm : MSAShiftPats<sra, "SRA">;
38723855defm : MSABitPats<xor, "BNEG">;
38733856defm : MSABitPats<or, "BSET">;
38743857
3875- def : MSAPat<(and v16i8:$ws, (vnot (shl vsplat_imm_eq_1,
3858+ def : MSAPat<(and v16i8:$ws, (vnot (shl ( vsplat_imm_eq_1) ,
38763859 (vsplati8imm7 v16i8:$wt)))),
38773860 (v16i8 (BCLR_B v16i8:$ws, v16i8:$wt))>;
3878- def : MSAPat<(and v8i16:$ws, (vnot (shl vsplat_imm_eq_1,
3861+ def : MSAPat<(and v8i16:$ws, (vnot (shl ( vsplat_imm_eq_1) ,
38793862 (vsplati16imm15 v8i16:$wt)))),
38803863 (v8i16 (BCLR_H v8i16:$ws, v8i16:$wt))>;
3881- def : MSAPat<(and v4i32:$ws, (vnot (shl vsplat_imm_eq_1,
3864+ def : MSAPat<(and v4i32:$ws, (vnot (shl ( vsplat_imm_eq_1) ,
38823865 (vsplati32imm31 v4i32:$wt)))),
38833866 (v4i32 (BCLR_W v4i32:$ws, v4i32:$wt))>;
3884- def : MSAPat<(and v2i64:$ws, (vnot (shl (v2i64 vsplati64_imm_eq_1 ),
3867+ def : MSAPat<(and v2i64:$ws, (vnot (shl (v2i64 (vsplat_imm_eq_1) ),
38853868 (vsplati64imm63 v2i64:$wt)))),
38863869 (v2i64 (BCLR_D v2i64:$ws, v2i64:$wt))>;
38873870
0 commit comments