[all-commits] [llvm/llvm-project] 2f6beb: [RISCV] Add inline expansion for vector ftrunc/fce...
Craig Topper via All-commits
all-commits at lists.llvm.org
Wed Dec 1 11:25:48 PST 2021
Author: Craig Topper <craig.topper at sifive.com>
Date: 2021-12-01 (Wed, 01 Dec 2021)
[RISCV] Add inline expansion for vector ftrunc/fceil/ffloor.
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.
Reviewed By: frasercrmck
Differential Revision: https://reviews.llvm.org/D113543
More information about the All-commits