Skip to content

Commit 0b63699

Browse files
committed
Add comment about cvt.rni
1 parent 40d2346 commit 0b63699

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

llvm/lib/Analysis/ConstantFolding.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2679,6 +2679,9 @@ static Constant *ConstantFoldScalarCall1(StringRef Name,
26792679
case Intrinsic::nvvm_round_ftz_f:
26802680
case Intrinsic::nvvm_round_f:
26812681
case Intrinsic::nvvm_round_d: {
2682+
// nvvm_round is lowered to PTX cvt.rni, which will round to nearest
2683+
// integer, choosing even integer if source is equidistant between two
2684+
// integers, so the semantics are closer to "rint" rather than "round".
26822685
bool IsFTZ = nvvm::UnaryMathIntrinsicShouldFTZ(IntrinsicID);
26832686
auto V = IsFTZ ? FTZPreserveSign(APF) : APF;
26842687
V.roundToIntegral(APFloat::rmNearestTiesToEven);

0 commit comments

Comments
 (0)