[llvm] [NVPTX] fixup incorrect rounding mode for int to float conversion (PR #106600)

Artem Belevich via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 29 11:33:20 PDT 2024


================
@@ -290,15 +290,16 @@ static Instruction *simplifyNvvmIntrinsic(IntrinsicInst *II, InstCombiner &IC) {
     case Intrinsic::nvvm_d2ull_rz:
     case Intrinsic::nvvm_f2ull_rz:
       return {Instruction::FPToUI};
-    case Intrinsic::nvvm_i2d_rz:
-    case Intrinsic::nvvm_i2f_rz:
-    case Intrinsic::nvvm_ll2d_rz:
-    case Intrinsic::nvvm_ll2f_rz:
+    // Integer to floating-point uses RN rounding, not RZ
+    case Intrinsic::nvvm_i2d_rn:
----------------
Artem-B wrote:

`fptoui` has nothing to do with this we're converting into-to-FP here and LLVM IR does specify using the default rounding mode for both `uitofp` and `sitofp`. https://llvm.org/docs/LangRef.html#uitofp-to-instruction

https://github.com/llvm/llvm-project/pull/106600


More information about the llvm-commits mailing list