[llvm] [ConstantFolding] Fix incorrect nvvm_round folding (PR #151563)
Lewis Crawford via llvm-commits
llvm-commits at lists.llvm.org
Fri Aug 1 02:03:23 PDT 2025
================
@@ -2679,11 +2679,9 @@ static Constant *ConstantFoldScalarCall1(StringRef Name,
case Intrinsic::nvvm_round_ftz_f:
case Intrinsic::nvvm_round_f:
case Intrinsic::nvvm_round_d: {
- // Use APFloat implementation instead of native libm call, as some
- // implementations (e.g. on PPC) do not preserve the sign of negative 0.
bool IsFTZ = nvvm::UnaryMathIntrinsicShouldFTZ(IntrinsicID);
auto V = IsFTZ ? FTZPreserveSign(APF) : APF;
- V.roundToIntegral(APFloat::rmNearestTiesToAway);
+ V.roundToIntegral(APFloat::rmNearestTiesToEven);
----------------
LewisCrawford wrote:
Good suggestion. I've added a comment about this now.
https://github.com/llvm/llvm-project/pull/151563
More information about the llvm-commits
mailing list