[llvm] r223269 - [SimplifyLibCalls] Enable double to float shrinking for copysign
Matthias Braun
matze at braunis.de
Wed Dec 3 13:46:30 PST 2014
Author: matze
Date: Wed Dec 3 15:46:29 2014
New Revision: 223269
URL: http://llvm.org/viewvc/llvm-project?rev=223269&view=rev
Log:
[SimplifyLibCalls] Enable double to float shrinking for copysign
rdar://19049359
Differential Revision: http://reviews.llvm.org/D6495
Modified:
llvm/trunk/lib/Transforms/Utils/SimplifyLibCalls.cpp
llvm/trunk/test/Transforms/InstCombine/float-shrink-compare.ll
Modified: llvm/trunk/lib/Transforms/Utils/SimplifyLibCalls.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/SimplifyLibCalls.cpp?rev=223269&r1=223268&r2=223269&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Utils/SimplifyLibCalls.cpp (original)
+++ llvm/trunk/lib/Transforms/Utils/SimplifyLibCalls.cpp Wed Dec 3 15:46:29 2014
@@ -2177,6 +2177,7 @@ Value *LibCallSimplifier::optimizeCall(C
if (UnsafeFPShrink && hasFloatVersion(FuncName))
return optimizeUnaryDoubleFP(CI, Builder, true);
return nullptr;
+ case LibFunc::copysign:
case LibFunc::fmin:
case LibFunc::fmax:
if (hasFloatVersion(FuncName))
Modified: llvm/trunk/test/Transforms/InstCombine/float-shrink-compare.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/float-shrink-compare.ll?rev=223269&r1=223268&r2=223269&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/InstCombine/float-shrink-compare.ll (original)
+++ llvm/trunk/test/Transforms/InstCombine/float-shrink-compare.ll Wed Dec 3 15:46:29 2014
@@ -222,8 +222,22 @@ define i32 @test18(float %x, float %y, f
; CHECK-NEXT: fcmp oeq float %fmaxf, %z
}
+define i32 @test19(float %x, float %y, float %z) nounwind uwtable {
+ %1 = fpext float %x to double
+ %2 = fpext float %y to double
+ %3 = call double @copysign(double %1, double %2) nounwind
+ %4 = fpext float %z to double
+ %5 = fcmp oeq double %3, %4
+ %6 = zext i1 %5 to i32
+ ret i32 %6
+; CHECK-LABEL: @test19(
+; CHECK-NEXT: %copysignf = call float @copysignf(float %x, float %y)
+; CHECK-NEXT: fcmp oeq float %copysignf, %z
+}
+
declare double @fabs(double) nounwind readnone
declare double @ceil(double) nounwind readnone
+declare double @copysign(double, double) nounwind readnone
declare double @floor(double) nounwind readnone
declare double @nearbyint(double) nounwind readnone
declare double @rint(double) nounwind readnone
More information about the llvm-commits
mailing list