Skip to content

Commit

Permalink
[RISCV] Remove pseudos for vwcvt.f.x(u) with rounding mode.
Browse files Browse the repository at this point in the history
vwcvt.f.x doesn't use rounding mode. The integer value fits in
the mantissa of a 2x larger FP type so no rounding is required.

I've remove the Uses = [FRM] that is also not needed.

I deleted the isel patterns. Alternatively, we could keep them and
drop the rounding mode immediate. The patterns are currently untested
so I chose to delete them. If they become needed in the future, we
can decide then if we should have the patterns or teach the node
creation to use the non-RM form for widening.

This reverts part of D142102.

Reviewed By: luke

Differential Revision: https://reviews.llvm.org/D154653
  • Loading branch information
topperc committed Jul 7, 2023
1 parent 1882a4e commit 427278d
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 36 deletions.
2 changes: 0 additions & 2 deletions llvm/lib/Target/RISCV/RISCVISelLowering.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14114,8 +14114,6 @@ RISCVTargetLowering::EmitInstrWithCustomInserter(MachineInstr &MI,
// VFWCVT
PseudoVFCVT_RM_CASE(PseudoVFWCVT_RM_XU_F_V, PseudoVFWCVT_XU_F_V);
PseudoVFCVT_RM_CASE(PseudoVFWCVT_RM_X_F_V, PseudoVFWCVT_X_F_V);
PseudoVFCVT_RM_CASE_MF8(PseudoVFWCVT_RM_F_XU_V, PseudoVFWCVT_F_XU_V);
PseudoVFCVT_RM_CASE_MF8(PseudoVFWCVT_RM_F_X_V, PseudoVFWCVT_F_X_V);

// VFNCVT
PseudoVFCVT_RM_CASE_MF8(PseudoVFNCVT_RM_XU_F_W, PseudoVFNCVT_XU_F_W);
Expand Down
16 changes: 0 additions & 16 deletions llvm/lib/Target/RISCV/RISCVInstrInfoVPseudos.td
Original file line number Diff line number Diff line change
Expand Up @@ -3546,18 +3546,6 @@ multiclass VPseudoVWCVTF_V {
}
}

multiclass VPseudoVWCVTF_RM_V {
defvar constraint = "@earlyclobber $rd";
foreach m = MxListW in {
defvar mx = m.MX;
defvar WriteVFWCvtIToFV_MX = !cast<SchedWrite>("WriteVFWCvtIToFV_" # mx);
defvar ReadVFWCvtIToFV_MX = !cast<SchedRead>("ReadVFWCvtIToFV_" # mx);

defm _V : VPseudoConversionRM<m.wvrclass, m.vrclass, m, constraint>,
Sched<[WriteVFWCvtIToFV_MX, ReadVFWCvtIToFV_MX, ReadVMask]>;
}
}

multiclass VPseudoVWCVTD_V {
defvar constraint = "@earlyclobber $rd";
foreach m = MxListFW in {
Expand Down Expand Up @@ -5920,12 +5908,8 @@ defm PseudoVFWCVT_RM_X_F : VPseudoVWCVTI_RM_V;
defm PseudoVFWCVT_RTZ_XU_F : VPseudoVWCVTI_V;
defm PseudoVFWCVT_RTZ_X_F : VPseudoVWCVTI_V;

let Uses = [FRM] in {
defm PseudoVFWCVT_F_XU : VPseudoVWCVTF_V;
defm PseudoVFWCVT_F_X : VPseudoVWCVTF_V;
}
defm PseudoVFWCVT_RM_F_XU : VPseudoVWCVTF_RM_V;
defm PseudoVFWCVT_RM_F_X : VPseudoVWCVTF_RM_V;

defm PseudoVFWCVT_F_F : VPseudoVWCVTD_V;
} // mayRaiseFPException = true
Expand Down
18 changes: 0 additions & 18 deletions llvm/lib/Target/RISCV/RISCVInstrInfoVVLPatterns.td
Original file line number Diff line number Diff line change
Expand Up @@ -1077,21 +1077,6 @@ multiclass VPatWConvertI2FPVL_V<SDPatternOperator vop,
}
}

multiclass VPatWConvertI2FP_RM_VL_V<SDNode vop, string instruction_name> {
foreach vtiToWti = AllWidenableIntToFloatVectors in {
defvar ivti = vtiToWti.Vti;
defvar fwti = vtiToWti.Wti;
let Predicates = !listconcat(GetVTypePredicates<ivti>.Predicates,
GetVTypePredicates<fwti>.Predicates) in
def : Pat<(fwti.Vector (vop (ivti.Vector ivti.RegClass:$rs1),
(ivti.Mask V0), (XLenVT timm:$frm),
VLOpFrag)),
(!cast<Instruction>(instruction_name#"_"#ivti.LMul.MX#"_MASK")
(fwti.Vector (IMPLICIT_DEF)), ivti.RegClass:$rs1,
(ivti.Mask V0), timm:$frm, GPR:$vl, ivti.Log2SEW, TA_MA)>;
}
}

// Narrowing converting

multiclass VPatNConvertFP2IVL_W<SDPatternOperator vop,
Expand Down Expand Up @@ -2054,9 +2039,6 @@ defm : VPatWConvertFP2IVL_V<any_riscv_vfcvt_rtz_x_f_vl, "PseudoVFWCVT_RTZ_X_F_V"
defm : VPatWConvertI2FPVL_V<any_riscv_uint_to_fp_vl, "PseudoVFWCVT_F_XU_V">;
defm : VPatWConvertI2FPVL_V<any_riscv_sint_to_fp_vl, "PseudoVFWCVT_F_X_V">;

defm : VPatWConvertI2FP_RM_VL_V<riscv_vfcvt_rm_f_xu_vl, "PseudoVFWCVT_RM_F_XU_V">;
defm : VPatWConvertI2FP_RM_VL_V<riscv_vfcvt_rm_f_x_vl, "PseudoVFWCVT_RM_F_X_V">;

foreach fvtiToFWti = AllWidenableFloatVectors in {
defvar fvti = fvtiToFWti.Vti;
defvar fwti = fvtiToFWti.Wti;
Expand Down

0 comments on commit 427278d

Please sign in to comment.