@@ -198,14 +198,8 @@ def vsplati32 : PatFrag<(ops node:$e0),
198
198
(v4i32 (build_vector node:$e0, node:$e0,
199
199
node:$e0, node:$e0))>;
200
200
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">;
209
203
210
204
def vsplati64 : PatFrag<(ops node:$e0),
211
205
(v2i64 (build_vector node:$e0, node:$e0))>;
@@ -217,7 +211,7 @@ def vsplati64_splat_d : PatFrag<(ops node:$e0),
217
211
node:$e0,
218
212
node:$e0,
219
213
node:$e0)),
220
- vsplati64_imm_eq_1 ))))>;
214
+ (vsplat_imm_eq_1) ))))>;
221
215
222
216
def vsplatf32 : PatFrag<(ops node:$e0),
223
217
(v4f32 (build_vector node:$e0, node:$e0,
@@ -352,46 +346,35 @@ def vsplat_maskr_bits_uimm6
352
346
: SplatComplexPattern<vsplat_uimm6, vAny, 1, "selectVSplatMaskR",
353
347
[build_vector, bitconvert]>;
354
348
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
- }]>;
366
349
367
350
def 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)))>;
369
352
def 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)))>;
371
354
def 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)))>;
373
356
def 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) ),
375
358
node:$wt)))>;
376
359
377
360
def 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))>;
379
362
def 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))>;
381
364
def 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))>;
383
366
def 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) ),
385
368
node:$wt))>;
386
369
387
370
def 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))>;
389
372
def 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))>;
391
374
def 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))>;
393
376
def 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) ),
395
378
node:$wt))>;
396
379
397
380
def muladd : PatFrag<(ops node:$wd, node:$ws, node:$wt),
@@ -3842,7 +3825,7 @@ class MSAShiftPat<SDNode Node, ValueType VT, MSAInst Insn, dag Vec> :
3842
3825
(VT (Insn VT:$ws, VT:$wt))>;
3843
3826
3844
3827
class 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)))),
3846
3829
(VT (Insn VT:$ws, VT:$wt))>;
3847
3830
3848
3831
multiclass MSAShiftPats<SDNode Node, string Insn> {
@@ -3861,7 +3844,7 @@ multiclass MSABitPats<SDNode Node, string Insn> {
3861
3844
def : MSABitPat<Node, v16i8, !cast<MSAInst>(Insn#_B), vsplati8imm7>;
3862
3845
def : MSABitPat<Node, v8i16, !cast<MSAInst>(Insn#_H), vsplati16imm15>;
3863
3846
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) ),
3865
3848
(vsplati64imm63 v2i64:$wt))),
3866
3849
(v2i64 (!cast<MSAInst>(Insn#_D) v2i64:$ws, v2i64:$wt))>;
3867
3850
}
@@ -3872,16 +3855,16 @@ defm : MSAShiftPats<sra, "SRA">;
3872
3855
defm : MSABitPats<xor, "BNEG">;
3873
3856
defm : MSABitPats<or, "BSET">;
3874
3857
3875
- def : MSAPat<(and v16i8:$ws, (vnot (shl vsplat_imm_eq_1,
3858
+ def : MSAPat<(and v16i8:$ws, (vnot (shl ( vsplat_imm_eq_1) ,
3876
3859
(vsplati8imm7 v16i8:$wt)))),
3877
3860
(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) ,
3879
3862
(vsplati16imm15 v8i16:$wt)))),
3880
3863
(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) ,
3882
3865
(vsplati32imm31 v4i32:$wt)))),
3883
3866
(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) ),
3885
3868
(vsplati64imm63 v2i64:$wt)))),
3886
3869
(v2i64 (BCLR_D v2i64:$ws, v2i64:$wt))>;
3887
3870
0 commit comments