Skip to content

Commit 892c923

Browse files
committedDec 3, 2014
[SimplifyLibCalls] Enable double to float shrinking for copysign
rdar://19049359 Differential Revision: http://reviews.llvm.org/D6495 llvm-svn: 223269
1 parent 654f2d2 commit 892c923

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed
 

‎llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -2177,6 +2177,7 @@ Value *LibCallSimplifier::optimizeCall(CallInst *CI) {
21772177
if (UnsafeFPShrink && hasFloatVersion(FuncName))
21782178
return optimizeUnaryDoubleFP(CI, Builder, true);
21792179
return nullptr;
2180+
case LibFunc::copysign:
21802181
case LibFunc::fmin:
21812182
case LibFunc::fmax:
21822183
if (hasFloatVersion(FuncName))

‎llvm/test/Transforms/InstCombine/float-shrink-compare.ll

+14
Original file line numberDiff line numberDiff line change
@@ -222,8 +222,22 @@ define i32 @test18(float %x, float %y, float %z) nounwind uwtable {
222222
; CHECK-NEXT: fcmp oeq float %fmaxf, %z
223223
}
224224

225+
define i32 @test19(float %x, float %y, float %z) nounwind uwtable {
226+
%1 = fpext float %x to double
227+
%2 = fpext float %y to double
228+
%3 = call double @copysign(double %1, double %2) nounwind
229+
%4 = fpext float %z to double
230+
%5 = fcmp oeq double %3, %4
231+
%6 = zext i1 %5 to i32
232+
ret i32 %6
233+
; CHECK-LABEL: @test19(
234+
; CHECK-NEXT: %copysignf = call float @copysignf(float %x, float %y)
235+
; CHECK-NEXT: fcmp oeq float %copysignf, %z
236+
}
237+
225238
declare double @fabs(double) nounwind readnone
226239
declare double @ceil(double) nounwind readnone
240+
declare double @copysign(double, double) nounwind readnone
227241
declare double @floor(double) nounwind readnone
228242
declare double @nearbyint(double) nounwind readnone
229243
declare double @rint(double) nounwind readnone

0 commit comments

Comments
 (0)
Please sign in to comment.