[PATCH] D113543: [RISCV] Add inline expansion for vector ftrunc/fceil/ffloor.

Craig Topper via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 11 08:49:35 PST 2021


craig.topper added a comment.

In D113543#3124563 <https://reviews.llvm.org/D113543#3124563>, @frasercrmck wrote:

> To what extent is this generic code that other targets would benefit from?
>
> I'm also not the most comfortable with floating-point. I was wondering if we could prove these transformations with https://alive2.llvm.org/ce/. I tried something simple but it doesn't recognize `copysign`. That's not to say it's impossible to express that operation in another way, but it's cumbersome.

I think it is generic unless the target doesn't have integer vectors that match their fp vectors. The other issue might be unsupported FP comparisons, but the comparisons used here are the ones used by C comparison operators.

The algorithm I used is the same as this code from gcc https://godbolt.org/z/Eqjnad9fe but using select instead of branches. Though I did change the cmpnle (which is setugt) to setogt so that it matched the compares RISCV supports and was in a position to allow a masked operation. I don't think the input can be NaN there so changing unordered to ordered shouldn't matter.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D113543



More information about the llvm-commits mailing list