forked from OSchip/llvm-project
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
This commit is contained in:
parent
55ef151502
commit
ea3c802887
|
@ -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.
|
||||
|
|
|
@ -93,7 +93,7 @@ define float @fold9(float %f1, float %f2) {
|
|||
ret float %t3
|
||||
|
||||
; CHECK-LABEL: @fold9(
|
||||
; CHECK: fsub fast float 0.000000e+00, %f2
|
||||
; CHECK: fsub fast float -0.000000e+00, %f2
|
||||
}
|
||||
|
||||
; Let C3 = C1 + C2. (f1 + C1) + (f2 + C2) => (f1 + f2) + C3 instead of
|
||||
|
|
Loading…
Reference in New Issue