[llvm] [RISCV][ISel] Fold FSGNJX idioms (PR #100718)
Craig Topper via llvm-commits
llvm-commits at lists.llvm.org
Fri Jul 26 12:30:53 PDT 2024
topperc wrote:
> > > Any reason this can't be done by e.g. instcombine?
> >
> >
> > What IR could InstCombine generate?
>
> We have a llvm.copysign, so wouldn't this just be (copysign X, Y)? Or is there some corner case here I'm missing?
fmul X, (fcopysign 1.0, Y) is multiply X by 1.0 if Y is positive, multiply X by -1.0 if Y is negative. This has the effect of toggling X's sign bit if Y is negative. So its not a copy.
https://github.com/llvm/llvm-project/pull/100718
More information about the llvm-commits
mailing list