[PATCH] D34579: Fold fneg and fabs like multiplications

Stanislav Mekhanoshin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 28 13:31:13 PDT 2017


rampitec added a subscriber: apinski-cavium.
rampitec added a comment.

In https://reviews.llvm.org/D34579#794303, @apinski-cavium wrote:

> Note why don't you
>  fold "(select (fcmp X > 0.0), -1.0, 1.0)" into copysign(1.0, X)
>  fold "(select (fcmp X > 0.0), 1.0, -1.0)" into copysign(1.0, -X)
>  ?
>
> I did that for GCC and then optimized:
>  X * copysign(1.0, X) into abs(X)
>  X * copysign(1.0, -X) into -abs(X)


Hm.. That can be an interesting idea too.


Repository:
  rL LLVM

https://reviews.llvm.org/D34579





More information about the llvm-commits mailing list