@@ -1187,7 +1187,7 @@ multiclass PatShiftXrXr<SDPatternOperator OpNode, string Inst> {
1187
1187
(!cast<LAInst>(Inst#"_D") LASX256:$xj, LASX256:$xk)>;
1188
1188
}
1189
1189
1190
- multiclass PatShiftXrUimm <SDPatternOperator OpNode, string Inst> {
1190
+ multiclass PatShiftXrSplatUimm <SDPatternOperator OpNode, string Inst> {
1191
1191
def : Pat<(OpNode (v32i8 LASX256:$xj), (v32i8 (SplatPat_uimm3 uimm3:$imm))),
1192
1192
(!cast<LAInst>(Inst#"_B") LASX256:$xj, uimm3:$imm)>;
1193
1193
def : Pat<(OpNode (v16i16 LASX256:$xj), (v16i16 (SplatPat_uimm4 uimm4:$imm))),
@@ -1198,6 +1198,17 @@ multiclass PatShiftXrUimm<SDPatternOperator OpNode, string Inst> {
1198
1198
(!cast<LAInst>(Inst#"_D") LASX256:$xj, uimm6:$imm)>;
1199
1199
}
1200
1200
1201
+ multiclass PatShiftXrUimm<SDPatternOperator OpNode, string Inst> {
1202
+ def : Pat<(OpNode(v32i8 LASX256:$vj), uimm3:$imm),
1203
+ (!cast<LAInst>(Inst#"_B") LASX256:$vj, uimm3:$imm)>;
1204
+ def : Pat<(OpNode(v16i16 LASX256:$vj), uimm4:$imm),
1205
+ (!cast<LAInst>(Inst#"_H") LASX256:$vj, uimm4:$imm)>;
1206
+ def : Pat<(OpNode(v8i32 LASX256:$vj), uimm5:$imm),
1207
+ (!cast<LAInst>(Inst#"_W") LASX256:$vj, uimm5:$imm)>;
1208
+ def : Pat<(OpNode(v4i64 LASX256:$vj), uimm6:$imm),
1209
+ (!cast<LAInst>(Inst#"_D") LASX256:$vj, uimm6:$imm)>;
1210
+ }
1211
+
1201
1212
multiclass PatCCXrSimm5<CondCode CC, string Inst> {
1202
1213
def : Pat<(v32i8 (setcc (v32i8 LASX256:$xj),
1203
1214
(v32i8 (SplatPat_simm5 simm5:$imm)), CC)),
@@ -1335,20 +1346,32 @@ def : Pat<(or (v32i8 LASX256:$xj), (v32i8 (SplatPat_uimm8 uimm8:$imm))),
1335
1346
def : Pat<(xor (v32i8 LASX256:$xj), (v32i8 (SplatPat_uimm8 uimm8:$imm))),
1336
1347
(XVXORI_B LASX256:$xj, uimm8:$imm)>;
1337
1348
1349
+ // XVBSLL_V
1350
+ foreach vt = [v32i8, v16i16, v8i32, v4i64, v8f32,
1351
+ v4f64] in def : Pat<(loongarch_vbsll(vt LASX256:$xj), uimm5:$imm),
1352
+ (XVBSLL_V LASX256:$xj, uimm5:$imm)>;
1353
+
1354
+ // XVBSRL_V
1355
+ foreach vt = [v32i8, v16i16, v8i32, v4i64, v8f32,
1356
+ v4f64] in def : Pat<(loongarch_vbsrl(vt LASX256:$xj), uimm5:$imm),
1357
+ (XVBSRL_V LASX256:$xj, uimm5:$imm)>;
1358
+
1338
1359
// XVSLL[I]_{B/H/W/D}
1339
1360
defm : PatXrXr<shl, "XVSLL">;
1340
1361
defm : PatShiftXrXr<shl, "XVSLL">;
1341
- defm : PatShiftXrUimm<shl, "XVSLLI">;
1362
+ defm : PatShiftXrSplatUimm<shl, "XVSLLI">;
1363
+ defm : PatShiftXrUimm<loongarch_vslli, "XVSLLI">;
1342
1364
1343
1365
// XVSRL[I]_{B/H/W/D}
1344
1366
defm : PatXrXr<srl, "XVSRL">;
1345
1367
defm : PatShiftXrXr<srl, "XVSRL">;
1346
- defm : PatShiftXrUimm<srl, "XVSRLI">;
1368
+ defm : PatShiftXrSplatUimm<srl, "XVSRLI">;
1369
+ defm : PatShiftXrUimm<loongarch_vsrli, "XVSRLI">;
1347
1370
1348
1371
// XVSRA[I]_{B/H/W/D}
1349
1372
defm : PatXrXr<sra, "XVSRA">;
1350
1373
defm : PatShiftXrXr<sra, "XVSRA">;
1351
- defm : PatShiftXrUimm <sra, "XVSRAI">;
1374
+ defm : PatShiftXrSplatUimm <sra, "XVSRAI">;
1352
1375
1353
1376
// XVCLZ_{B/H/W/D}
1354
1377
defm : PatXr<ctlz, "XVCLZ">;
0 commit comments