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

Yeting Kuo via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 19 05:23:08 PST 2023


fakepaper56 added inline comments.


================
Comment at: llvm/lib/Target/RISCV/RISCVISelLowering.cpp:9592
+    // their operand types
+    if (!(VT.getScalarSizeInBits() == SrcVT.getScalarSizeInBits() ||
+          IsNarrowing || IsWidening))
----------------
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.


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