[PATCH] D97130: [RISCV] Have sexti32 also recognize AssertZExt from types smaller than i32.

Jessica Clarke via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 22 14:17:42 PST 2021


jrtc27 added inline comments.


================
Comment at: llvm/lib/Target/RISCV/RISCVInstrInfoF.td:403
 // [u]int->fp. Match GCC and default to using dynamic rounding mode.
-def : Pat<(sint_to_fp (i64 (sexti32 GPR:$rs1))), (FCVT_S_W $rs1, 0b111)>;
+def : Pat<(sint_to_fp (i64 (sexti32 i64:$rs1))), (FCVT_S_W $rs1, 0b111)>;
 def : Pat<(uint_to_fp (i64 (zexti32 GPR:$rs1))), (FCVT_S_WU $rs1, 0b111)>;
----------------
luismarques wrote:
> craig.topper wrote:
> > The i64 instead of GPR here tricks tablegen into not generating extra patterns for RV32.
> I think there would be a benefit in adding this as a code comment. In at least one of the tablegen files, if not all of them.
Does `(i64 GPR:$rs1)` also achieve the same effect like is used on lines 405 and 406? That'd be nicer if it works IMO. Also I think it'd be worthwhile having `zexti32` be consistent with `sexti32` even if not strictly necessary; currently the difference is rather odd.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D97130



More information about the llvm-commits mailing list