[PATCH] D113543: [RISCV] Add inline expansion for vector ftrunc/fceil/ffloor.
Craig Topper via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Nov 9 23:39:30 PST 2021
craig.topper created this revision.
craig.topper added reviewers: frasercrmck, rogfer01, HsiangKai, khchen, arcbbb.
Herald added subscribers: VincentWu, luke957, achieveartificialintelligence, StephenFan, vkmr, evandro, luismarques, apazos, sameer.abuasal, s.egerton, Jim, benna, psnobl, jocewei, PkmX, the_o, brucehoult, MartinMosbeck, edward-jones, zzheng, jrtc27, kito-cheng, niosHD, sabuasal, simoncook, johnrusso, rbar, asb, hiraditya.
craig.topper requested review of this revision.
Herald added a subscriber: MaskRay.
Herald added a project: LLVM.
This prevents scalarization of fixed vector operations or crashes
on scalable vectors.
We don't have direct support for these operations. To emulate
ftrunc we can convert to the same sized integer and back to fp using
round to zero. We don't need to do a convert if the value is large
enough to have no fractional bits or is a nan.
The ceil and floor lowering would be better if we changed FRM, but
we don't model FRM correctly yet. So I've used the trunc lowering
with a conditional add or subtract with 1.0 if the truncate rounded
in the wrong direction.
There are also missed opportunities to use masked instructions.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D113543
Files:
llvm/lib/Target/RISCV/RISCVISelLowering.cpp
llvm/test/CodeGen/RISCV/rvv/fceil-sdnode.ll
llvm/test/CodeGen/RISCV/rvv/ffloor-sdnode.ll
llvm/test/CodeGen/RISCV/rvv/fixed-vectors-fp.ll
llvm/test/CodeGen/RISCV/rvv/ftrunc-sdnode.ll
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D113543.386068.patch
Type: text/x-patch
Size: 53567 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211110/885ef66f/attachment.bin>
More information about the llvm-commits
mailing list