[RISCV] Use ISD::EXTRACT_VECTOR_ELT for Intrinsic::riscv_vfmv_f_s lowering.
authorCraig Topper <craig.topper@sifive.com>
Thu, 12 Jan 2023 02:46:14 +0000 (18:46 -0800)
committerCraig Topper <craig.topper@sifive.com>
Thu, 12 Jan 2023 02:46:14 +0000 (18:46 -0800)
This matches what we do for extractelt from IR for both fixed and
scalable vectors.

This lets us remove a few isel patterns.

llvm/lib/Target/RISCV/RISCVISelLowering.cpp
llvm/lib/Target/RISCV/RISCVInstrInfoVPseudos.td
llvm/lib/Target/RISCV/RISCVInstrInfoVSDPatterns.td

index 4424292f783d7cb16cf835826edbdd9391c7b2b4..74c4bba72ee90158ae527bdfc7e5adb32f4722d9 100644 (file)
@@ -5590,6 +5590,9 @@ SDValue RISCVTargetLowering::LowerINTRINSIC_WO_CHAIN(SDValue Op,
     assert(Op.getValueType() == XLenVT && "Unexpected VT!");
     return DAG.getNode(RISCVISD::VMV_X_S, DL, Op.getValueType(),
                        Op.getOperand(1));
+  case Intrinsic::riscv_vfmv_f_s:
+    return DAG.getNode(ISD::EXTRACT_VECTOR_ELT, DL, Op.getValueType(),
+                       Op.getOperand(1), DAG.getConstant(0, DL, XLenVT));
   case Intrinsic::riscv_vmv_v_x:
     return lowerScalarSplat(Op.getOperand(1), Op.getOperand(2),
                             Op.getOperand(3), Op.getSimpleValueType(), DL, DAG,
index 06e18b0fce6ac8909954936aba021ae8dc9644d6..291fdd93f053767fb5fd1e631b5f4bfa29dda6ed 100644 (file)
@@ -6264,11 +6264,6 @@ foreach vti = AllIntegerVectors in {
 
 let Predicates = [HasVInstructionsAnyF] in {
 foreach fvti = AllFloatVectors in {
-  defvar instr = !cast<Instruction>("PseudoVFMV_"#fvti.ScalarSuffix#"_S_" #
-                                    fvti.LMul.MX);
-  def : Pat<(fvti.Scalar (int_riscv_vfmv_f_s (fvti.Vector fvti.RegClass:$rs2))),
-                         (instr $rs2, fvti.Log2SEW)>;
-
   def : Pat<(fvti.Vector (int_riscv_vfmv_s_f (fvti.Vector fvti.RegClass:$rs1),
                          (fvti.Scalar fvti.ScalarRegClass:$rs2), VLOpFrag)),
             (!cast<Instruction>("PseudoVFMV_S_"#fvti.ScalarSuffix#"_" #
index 7f033e1510f15ade75debf0de86e4aef41c6556c..aec02162a2fd9f5ab6e6adf9c8e8e3d05001d2e6 100644 (file)
@@ -1040,8 +1040,6 @@ foreach vti = AllFloatVectors in {
 
   let AddedComplexity = 2 in {
   // Add complexity to increase the priority of this pattern being matched.
-  def : Pat<(store (vti.Scalar (int_riscv_vfmv_f_s (vti.Vector vti.RegClass:$rs2))), GPR:$rs1),
-            (store_instr vti.RegClass:$rs2, GPR:$rs1, 1, vti.Log2SEW)>;
   def : Pat<(store (extractelt (vti.Vector vti.RegClass:$rs2), 0), GPR:$rs1),
             (store_instr vti.RegClass:$rs2, GPR:$rs1, 1, vti.Log2SEW)>;
   }