[PATCH] D34579: Fold fneg and fabs like multiplications

Andrew Pinski via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 28 13:26:23 PDT 2017


apinski-cavium added a comment.

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)


Repository:
  rL LLVM

https://reviews.llvm.org/D34579





More information about the llvm-commits mailing list