@@ -1370,12 +1370,37 @@ let mayLoad = 0, mayStore = 0, hasSideEffects = 0, usesCustomInserter = 1,
1370
1370
Constraints = "$rd = $rs1" in
1371
1371
def PseudoVMV_S_X # "_" # m.MX: Pseudo<(outs m.vrclass:$rd),
1372
1372
(ins m.vrclass:$rs1, GPR:$rs2,
1373
- GPR:$vl, ixlenimm:$sew),
1373
+ GPR:$vl, ixlenimm:$sew),
1374
1374
[]>, RISCVVPseudo;
1375
1375
}
1376
1376
}
1377
1377
}
1378
+ } // Predicates = [HasStdExtV]
1379
+
1380
+ //===----------------------------------------------------------------------===//
1381
+ // 17.2. Floating-Point Scalar Move Instructions
1382
+ //===----------------------------------------------------------------------===//
1383
+
1384
+ let Predicates = [HasStdExtV, HasStdExtF] in {
1385
+ let mayLoad = 0, mayStore = 0, hasSideEffects = 0, usesCustomInserter = 1,
1386
+ Uses = [VL, VTYPE] in {
1387
+ foreach m = MxList.m in {
1388
+ let VLMul = m.value in {
1389
+ let SEWIndex = 2, BaseInstr = VFMV_F_S in
1390
+ def PseudoVFMV_F_S # "_" # m.MX : Pseudo<(outs FPR32:$rd),
1391
+ (ins m.vrclass:$rs2,
1392
+ ixlenimm:$sew),
1393
+ []>, RISCVVPseudo;
1394
+ let VLIndex = 3, SEWIndex = 4, BaseInstr = VFMV_S_F,
1395
+ Constraints = "$rd = $rs1" in
1396
+ def PseudoVFMV_S_F # "_" # m.MX : Pseudo<(outs m.vrclass:$rd),
1397
+ (ins m.vrclass:$rs1, FPR32:$rs2,
1398
+ GPR:$vl, ixlenimm:$sew),
1399
+ []>, RISCVVPseudo;
1400
+ }
1401
+ }
1378
1402
}
1403
+ } // Predicates = [HasStdExtV, HasStdExtF]
1379
1404
1380
1405
//===----------------------------------------------------------------------===//
1381
1406
// Patterns.
@@ -1557,3 +1582,34 @@ foreach vti = AllIntegerVectors in {
1557
1582
(vti.Vector $rs1), $rs2, (NoX0 GPR:$vl), vti.SEW)>;
1558
1583
}
1559
1584
} // Predicates = [HasStdExtV]
1585
+
1586
+ //===----------------------------------------------------------------------===//
1587
+ // 17.2. Floating-Point Scalar Move Instructions
1588
+ //===----------------------------------------------------------------------===//
1589
+
1590
+ let Predicates = [HasStdExtV, HasStdExtF] in {
1591
+ foreach fvti = AllFloatVectors in {
1592
+ defvar instr = !cast<Instruction>("PseudoVFMV_F_S_" # fvti.LMul.MX);
1593
+ def : Pat<(fvti.Scalar (int_riscv_vfmv_f_s (fvti.Vector fvti.RegClass:$rs2))),
1594
+ // Floating point instructions with a scalar result will always
1595
+ // generate the result in a register of class FPR32. When dealing
1596
+ // with the f64 variant of a pattern we need to promote the FPR32
1597
+ // subregister generated by the instruction to the FPR64 base
1598
+ // register expected by the type in the pattern
1599
+ !cond(!eq(!cast<string>(fvti.ScalarRegClass),
1600
+ !cast<string>(FPR64)):
1601
+ (SUBREG_TO_REG (i32 -1),
1602
+ (instr $rs2, fvti.SEW), sub_32),
1603
+ !eq(!cast<string>(fvti.ScalarRegClass),
1604
+ !cast<string>(FPR16)):
1605
+ (EXTRACT_SUBREG (instr $rs2, fvti.SEW), sub_16),
1606
+ !eq(1, 1):
1607
+ (instr $rs2, fvti.SEW))>;
1608
+
1609
+ def : Pat<(fvti.Vector (int_riscv_vfmv_s_f (fvti.Vector fvti.RegClass:$rs1),
1610
+ (fvti.Scalar fvti.ScalarRegClass:$rs2), GPR:$vl)),
1611
+ (!cast<Instruction>("PseudoVFMV_S_F_" # fvti.LMul.MX)
1612
+ (fvti.Vector $rs1), ToFPR32<fvti.Scalar, fvti.ScalarRegClass, "rs2">.ret,
1613
+ (NoX0 GPR:$vl), fvti.SEW)>;
1614
+ }
1615
+ } // Predicates = [HasStdExtV, HasStdExtF]
0 commit comments