diff options
author | Sanjay Patel <spatel@rotateright.com> | 2014-12-19 16:44:08 +0000 |
---|---|---|
committer | Sanjay Patel <spatel@rotateright.com> | 2014-12-19 16:44:08 +0000 |
commit | ea3c8028871749a289d9d40a13962c0cf90d3c35 (patch) | |
tree | 4054430c163a821c8006a9b74c1de2d8b9c5c7f6 /llvm/lib/Transforms/InstCombine/InstCombineAddSub.cpp | |
parent | 55ef1515021a9dea737bea38468950999945884a (diff) | |
download | bcm5719-llvm-ea3c8028871749a289d9d40a13962c0cf90d3c35.tar.gz bcm5719-llvm-ea3c8028871749a289d9d40a13962c0cf90d3c35.zip |
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
llvm-svn: 224583
Diffstat (limited to 'llvm/lib/Transforms/InstCombine/InstCombineAddSub.cpp')
-rw-r--r-- | llvm/lib/Transforms/InstCombine/InstCombineAddSub.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineAddSub.cpp b/llvm/lib/Transforms/InstCombine/InstCombineAddSub.cpp index 39b71f37f8b..c2d2eec3fc3 100644 --- a/llvm/lib/Transforms/InstCombine/InstCombineAddSub.cpp +++ b/llvm/lib/Transforms/InstCombine/InstCombineAddSub.cpp @@ -759,7 +759,7 @@ Value *FAddCombine::createFSub(Value *Opnd0, Value *Opnd1) { } Value *FAddCombine::createFNeg(Value *V) { - Value *Zero = cast<Value>(ConstantFP::get(V->getType(), 0.0)); + Value *Zero = cast<Value>(ConstantFP::getZeroValueForNegation(V->getType())); Value *NewV = createFSub(Zero, V); if (Instruction *I = dyn_cast<Instruction>(NewV)) createInstPostProc(I, true); // fneg's don't receive instruction numbers. |