[RISCV] Generalize performFP_TO_INTCombine to vectors
authorLuke Lau <luke@igalia.com>
Thu, 12 Jan 2023 12:20:07 +0000 (12:20 +0000)
committerLuke Lau <luke@igalia.com>
Wed, 18 Jan 2023 10:53:24 +0000 (10:53 +0000)
commita0d80c239840ec477dd23071e748e60205ffd6b7
treeb142559fc586a116fe20bb16eaf941bee034f788
parent98b9340c07e59d1a32e28609ad1df9c88cdc6f9f
[RISCV] Generalize performFP_TO_INTCombine to vectors

Like in the scalar domain, combine calls to (fp_to_int (ftrunc X)) on
scalable and fixed-length vectors into a single vfcvt instruction.
For truncating rounds, the static vfcvt.rtz rounding mode is used.
Otherwise use the VFCVT_RM_ variants to set the rounding mode
dynamically.
Closes https://github.com/llvm/llvm-project/issues/56737

Reviewed By: craig.topper

Differential Revision: https://reviews.llvm.org/D141599
llvm/lib/Target/RISCV/RISCVISelLowering.cpp
llvm/lib/Target/RISCV/RISCVISelLowering.h
llvm/lib/Target/RISCV/RISCVInstrInfoVPseudos.td
llvm/lib/Target/RISCV/RISCVInstrInfoVVLPatterns.td
llvm/test/CodeGen/RISCV/rvv/double-round-conv.ll
llvm/test/CodeGen/RISCV/rvv/float-round-conv.ll
llvm/test/CodeGen/RISCV/rvv/half-round-conv.ll