Index: lib/Transforms/Utils/SimplifyLibCalls.cpp =================================================================== --- lib/Transforms/Utils/SimplifyLibCalls.cpp +++ lib/Transforms/Utils/SimplifyLibCalls.cpp @@ -2196,6 +2196,7 @@ if (UnsafeFPShrink && hasFloatVersion(FuncName)) return optimizeUnaryDoubleFP(CI, Builder, true); return nullptr; + case LibFunc::copysign: case LibFunc::fmin: case LibFunc::fmax: if (hasFloatVersion(FuncName)) Index: test/Transforms/InstCombine/float-shrink-compare.ll =================================================================== --- test/Transforms/InstCombine/float-shrink-compare.ll +++ test/Transforms/InstCombine/float-shrink-compare.ll @@ -234,8 +234,22 @@ ; CHECK-NEXT: fcmp oeq float %fminf, %y } +define i32 @test20(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: @test20( +; 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