[llvm] AMDGPU: Add tonearest and towardzero roundings for intrinsic llvm.fptrunc.round (PR #104486)
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Fri Aug 16 11:06:15 PDT 2024
================
@@ -6671,10 +6655,34 @@ SDValue SITargetLowering::getFPExtOrFPRound(SelectionDAG &DAG,
DAG.getTargetConstant(0, DL, MVT::i32));
}
+SDValue SITargetLowering::lowerFPTRUNC_ROUND(SDValue Op,
+ SelectionDAG &DAG) const {
+ if (Op.getOperand(0)->getValueType(0) != MVT::f32)
+ return SDValue();
+
+ // Only support towardzero, tonearest, upward and downward.
+ int RoundMode = Op.getConstantOperandVal(1);
+ if (RoundMode < (int)RoundingMode::TowardZero ||
+ RoundMode > (int)RoundingMode::TowardNegative)
----------------
arsenm wrote:
Same, do exact equality checks for the supported modes
https://github.com/llvm/llvm-project/pull/104486
More information about the llvm-commits
mailing list