[PATCH] D142102: [RISCV] Combine FP_TO_INT to vfwcvt/fvncvt

Luke Lau via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 19 08:44:17 PST 2023


luke marked 2 inline comments as done.
luke added inline comments.


================
Comment at: llvm/lib/Target/RISCV/RISCVISelLowering.cpp:9592
+    // their operand types
+    if (!(VT.getScalarSizeInBits() == SrcVT.getScalarSizeInBits() ||
+          IsNarrowing || IsWidening))
----------------
fakepaper56 wrote:
> luke wrote:
> > fakepaper56 wrote:
> > > Is it better to use `VT.getScalarSizeInBits() > SrcVT.getScalarSizeInBits() * 2 || VT.getScalarSizeInBits() * 2 < SrcVT.getScalarSizeInBits()` ?
> > But wouldn't that allow invalid conversions like f32 -> i8?. From what I understand `fwcvt` always widens to a sew of double the size, and `fncvt` half
> >VT.getScalarSizeInBits() > SrcVT.getScalarSizeInBits() * 2 || VT.getScalarSizeInBits() * 2 < SrcVT.getScalarSizeInBits()
> The expression is to deny invalid expression. f32->i8 should be avoided for the expression 8 * 2 = 16 < 32.
Ah sorry, I misunderstood. Updated


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D142102



More information about the llvm-commits mailing list