mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-19 03:24:09 +00:00
InstCombine: Fix transform to use the swapped predicate.
Thanks Frits! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@128628 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -2855,10 +2855,10 @@ Instruction *InstCombiner::visitFCmpInst(FCmpInst &I) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// fcmp (fneg x), (fneg y) -> fcmp x, y
|
// fcmp pred (fneg x), (fneg y) -> fcmp swap(pred) x, y
|
||||||
Value *X, *Y;
|
Value *X, *Y;
|
||||||
if (match(Op0, m_FNeg(m_Value(X))) && match(Op1, m_FNeg(m_Value(Y))))
|
if (match(Op0, m_FNeg(m_Value(X))) && match(Op1, m_FNeg(m_Value(Y))))
|
||||||
return new FCmpInst(I.getPredicate(), X, Y);
|
return new FCmpInst(I.getSwappedPredicate(), X, Y);
|
||||||
|
|
||||||
// fcmp (fpext x), (fpext y) -> fcmp x, y
|
// fcmp (fpext x), (fpext y) -> fcmp x, y
|
||||||
if (FPExtInst *LHSExt = dyn_cast<FPExtInst>(Op0))
|
if (FPExtInst *LHSExt = dyn_cast<FPExtInst>(Op0))
|
||||||
|
@ -44,7 +44,7 @@ define i1 @test5(float %a) nounwind {
|
|||||||
define i1 @test6(float %x, float %y) nounwind {
|
define i1 @test6(float %x, float %y) nounwind {
|
||||||
%neg1 = fsub float -0.000000e+00, %x
|
%neg1 = fsub float -0.000000e+00, %x
|
||||||
%neg2 = fsub float -0.000000e+00, %y
|
%neg2 = fsub float -0.000000e+00, %y
|
||||||
%cmp = fcmp ogt float %neg1, %neg2
|
%cmp = fcmp olt float %neg1, %neg2
|
||||||
ret i1 %cmp
|
ret i1 %cmp
|
||||||
; CHECK: @test6
|
; CHECK: @test6
|
||||||
; CHECK-NEXT: fcmp ogt float %x, %y
|
; CHECK-NEXT: fcmp ogt float %x, %y
|
||||||
|
Reference in New Issue
Block a user