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

Craig Topper via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 21 09:45:44 PST 2020


craig.topper added a comment.

I don't see a strong reason to change this. Using dynamic is consistent with targets that only have a dynamic mode.

But if we were to change this, shouldn't also update the Zfh extension files half-arith.ll and RISCVInstrInfoZfh.td.



================
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)>;
----------------
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.


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