[PATCH] D93624: [RISCV] Fix rounding mode in lowering of float operations

Jessica Clarke via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 21 09:46:22 PST 2020


jrtc27 added inline comments.


================
Comment at: llvm/lib/Target/RISCV/RISCVInstrInfoF.td:402
 
-// [u]int->fp. Match GCC and default to using dynamic rounding mode.
-def : Pat<(sint_to_fp (sexti32 GPR:$rs1)), (FCVT_S_W $rs1, 0b111)>;
-def : Pat<(uint_to_fp (zexti32 GPR:$rs1)), (FCVT_S_WU $rs1, 0b111)>;
-def : Pat<(sint_to_fp GPR:$rs1), (FCVT_S_L $rs1, 0b111)>;
-def : Pat<(uint_to_fp GPR:$rs1), (FCVT_S_LU $rs1, 0b111)>;
+// [u]int->fp. Match GCC and default to using rounding mode to nearest even.
+def : Pat<(sint_to_fp (sexti32 GPR:$rs1)), (FCVT_S_W $rs1, 0b000)>;
----------------
craig.topper wrote:
> This comment previously said gcc was using dynamic rounding mode. Now it says gcc uses nearest even. Only one of those statements can be true.
The former was correct.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D93624/new/

https://reviews.llvm.org/D93624



More information about the llvm-commits mailing list