use -0.0 when creating an fneg instruction
authorSanjay Patel <spatel@rotateright.com>
Fri, 19 Dec 2014 16:44:08 +0000 (16:44 +0000)
committerSanjay Patel <spatel@rotateright.com>
Fri, 19 Dec 2014 16:44:08 +0000 (16:44 +0000)
commit7c5fa5087522e674c6a3b2396437285c62230ed9
tree96472c5006f5e45da2dbc2c280a12effc2c4e623
parent01b07d541bc953c2cf9e2b35523b6941e0bb7981
use -0.0 when creating an fneg instruction

Backends recognize (-0.0 - X) as the canonical form for fneg
and produce better code. Eg, ppc64 with 0.0:

   lis r2, ha16(LCPI0_0)
   lfs f0, lo16(LCPI0_0)(r2)
   fsubs f1, f0, f1
   blr

vs. -0.0:

   fneg f1, f1
   blr

Differential Revision: http://reviews.llvm.org/D6723

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@224583 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Transforms/InstCombine/InstCombineAddSub.cpp
test/Transforms/InstCombine/fast-math.ll