From: Benjamin Kramer Date: Sun, 19 May 2013 13:28:39 +0000 (+0000) Subject: Move the remaining simplify-libcalls tests to instcombine, merging most of them into... X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=ebe7a52a176daa655ba86646ee267958df8bdc5a;p=oota-llvm.git Move the remaining simplify-libcalls tests to instcombine, merging most of them into a single file. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@182211 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/test/Transforms/InstCombine/PR7357.ll b/test/Transforms/InstCombine/PR7357.ll new file mode 100644 index 00000000000..c397c5ee05e --- /dev/null +++ b/test/Transforms/InstCombine/PR7357.ll @@ -0,0 +1,17 @@ +; RUN: opt < %s "-default-data-layout=e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-n32" -instcombine -S | FileCheck %s +@.str1 = private constant [11 x i8] c"(){};[]&|:\00", align 4 + +; check that simplify libcalls will not replace a call with one calling +; convention with a new call with a different calling convention. + +; CHECK: define arm_aapcscc i32 @foo(i32 %argc) +; CHECK: call arm_aapcscc i8* @strchr +define arm_aapcscc i32 @foo(i32 %argc) nounwind { +bb.nph: + %c = call arm_aapcscc i8* @strchr(i8* getelementptr ([11 x i8]* @.str1, i32 0, +i32 0), i32 %argc) nounwind readonly + %p = ptrtoint i8* %c to i32 + ret i32 %p +} + +declare arm_aapcscc i8* @strchr(i8*, i32) nounwind readonly diff --git a/test/Transforms/InstCombine/float-shrink-compare.ll b/test/Transforms/InstCombine/float-shrink-compare.ll new file mode 100644 index 00000000000..0b93e841dc1 --- /dev/null +++ b/test/Transforms/InstCombine/float-shrink-compare.ll @@ -0,0 +1,179 @@ +; RUN: opt -S -instcombine < %s | FileCheck %s +target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128" +target triple = "x86_64-apple-macosx10.8.0" + +define i32 @test1(float %x, float %y) nounwind uwtable { + %1 = fpext float %x to double + %2 = call double @ceil(double %1) nounwind readnone + %3 = fpext float %y to double + %4 = fcmp oeq double %2, %3 + %5 = zext i1 %4 to i32 + ret i32 %5 +; CHECK: @test1 +; CHECK-NEXT: %ceilf = call float @ceilf(float %x) +; CHECK-NEXT: fcmp oeq float %ceilf, %y +} + +define i32 @test2(float %x, float %y) nounwind uwtable { + %1 = fpext float %x to double + %2 = call double @fabs(double %1) nounwind readnone + %3 = fpext float %y to double + %4 = fcmp oeq double %2, %3 + %5 = zext i1 %4 to i32 + ret i32 %5 +; CHECK: @test2 +; CHECK-NEXT: %fabsf = call float @fabsf(float %x) +; CHECK-NEXT: fcmp oeq float %fabsf, %y +} + +define i32 @test3(float %x, float %y) nounwind uwtable { + %1 = fpext float %x to double + %2 = call double @floor(double %1) nounwind readnone + %3 = fpext float %y to double + %4 = fcmp oeq double %2, %3 + %5 = zext i1 %4 to i32 + ret i32 %5 +; CHECK: @test3 +; CHECK-NEXT: %floorf = call float @floorf(float %x) +; CHECK-NEXT: fcmp oeq float %floorf, %y +} + +define i32 @test4(float %x, float %y) nounwind uwtable { + %1 = fpext float %x to double + %2 = call double @nearbyint(double %1) nounwind + %3 = fpext float %y to double + %4 = fcmp oeq double %2, %3 + %5 = zext i1 %4 to i32 + ret i32 %5 +; CHECK: @test4 +; CHECK-NEXT: %nearbyintf = call float @nearbyintf(float %x) +; CHECK-NEXT: fcmp oeq float %nearbyintf, %y +} + +define i32 @test5(float %x, float %y) nounwind uwtable { + %1 = fpext float %x to double + %2 = call double @rint(double %1) nounwind + %3 = fpext float %y to double + %4 = fcmp oeq double %2, %3 + %5 = zext i1 %4 to i32 + ret i32 %5 +; CHECK: @test5 +; CHECK-NEXT: %rintf = call float @rintf(float %x) +; CHECK-NEXT: fcmp oeq float %rintf, %y +} + +define i32 @test6(float %x, float %y) nounwind uwtable { + %1 = fpext float %x to double + %2 = call double @round(double %1) nounwind readnone + %3 = fpext float %y to double + %4 = fcmp oeq double %2, %3 + %5 = zext i1 %4 to i32 + ret i32 %5 +; CHECK: @test6 +; CHECK-NEXT: %roundf = call float @roundf(float %x) +; CHECK-NEXT: fcmp oeq float %roundf, %y +} + +define i32 @test7(float %x, float %y) nounwind uwtable { + %1 = fpext float %x to double + %2 = call double @trunc(double %1) nounwind + %3 = fpext float %y to double + %4 = fcmp oeq double %2, %3 + %5 = zext i1 %4 to i32 + ret i32 %5 +; CHECK: @test7 +; CHECK-NEXT: %truncf = call float @truncf(float %x) +; CHECK-NEXT: fcmp oeq float %truncf, %y +} + +define i32 @test8(float %x, float %y) nounwind uwtable { + %1 = fpext float %y to double + %2 = fpext float %x to double + %3 = call double @ceil(double %2) nounwind readnone + %4 = fcmp oeq double %1, %3 + %5 = zext i1 %4 to i32 + ret i32 %5 +; CHECK: @test8 +; CHECK-NEXT: %ceilf = call float @ceilf(float %x) +; CHECK-NEXT: fcmp oeq float %ceilf, %y +} + +define i32 @test9(float %x, float %y) nounwind uwtable { + %1 = fpext float %y to double + %2 = fpext float %x to double + %3 = call double @fabs(double %2) nounwind readnone + %4 = fcmp oeq double %1, %3 + %5 = zext i1 %4 to i32 + ret i32 %5 +; CHECK: @test9 +; CHECK-NEXT: %fabsf = call float @fabsf(float %x) +; CHECK-NEXT: fcmp oeq float %fabsf, %y +} + +define i32 @test10(float %x, float %y) nounwind uwtable { + %1 = fpext float %y to double + %2 = fpext float %x to double + %3 = call double @floor(double %2) nounwind readnone + %4 = fcmp oeq double %1, %3 + %5 = zext i1 %4 to i32 + ret i32 %5 +; CHECK: @test10 +; CHECK-NEXT: %floorf = call float @floorf(float %x) +; CHECK-NEXT: fcmp oeq float %floorf, %y +} + +define i32 @test11(float %x, float %y) nounwind uwtable { + %1 = fpext float %y to double + %2 = fpext float %x to double + %3 = call double @nearbyint(double %2) nounwind + %4 = fcmp oeq double %1, %3 + %5 = zext i1 %4 to i32 + ret i32 %5 +; CHECK: @test11 +; CHECK-NEXT: %nearbyintf = call float @nearbyintf(float %x) +; CHECK-NEXT: fcmp oeq float %nearbyintf, %y +} + +define i32 @test12(float %x, float %y) nounwind uwtable { + %1 = fpext float %y to double + %2 = fpext float %x to double + %3 = call double @rint(double %2) nounwind + %4 = fcmp oeq double %1, %3 + %5 = zext i1 %4 to i32 + ret i32 %5 +; CHECK: @test12 +; CHECK-NEXT: %rintf = call float @rintf(float %x) +; CHECK-NEXT: fcmp oeq float %rintf, %y +} + +define i32 @test13(float %x, float %y) nounwind uwtable { + %1 = fpext float %y to double + %2 = fpext float %x to double + %3 = call double @round(double %2) nounwind readnone + %4 = fcmp oeq double %1, %3 + %5 = zext i1 %4 to i32 + ret i32 %5 +; CHECK: @test13 +; CHECK-NEXT: %roundf = call float @roundf(float %x) +; CHECK-NEXT: fcmp oeq float %roundf, %y +} + +define i32 @test14(float %x, float %y) nounwind uwtable { + %1 = fpext float %y to double + %2 = fpext float %x to double + %3 = call double @trunc(double %2) nounwind + %4 = fcmp oeq double %1, %3 + %5 = zext i1 %4 to i32 + ret i32 %5 +; CHECK: @test14 +; CHECK-NEXT: %truncf = call float @truncf(float %x) +; CHECK-NEXT: fcmp oeq float %truncf, %y +} + +declare double @fabs(double) nounwind readnone +declare double @ceil(double) nounwind readnone +declare double @floor(double) nounwind readnone +declare double @nearbyint(double) nounwind readnone +declare double @rint(double) nounwind readnone +declare double @round(double) nounwind readnone +declare double @trunc(double) nounwind readnone diff --git a/test/Transforms/InstCombine/simplify-libcalls.ll b/test/Transforms/InstCombine/simplify-libcalls.ll new file mode 100644 index 00000000000..4f3a506bee3 --- /dev/null +++ b/test/Transforms/InstCombine/simplify-libcalls.ll @@ -0,0 +1,132 @@ +; RUN: opt -S < %s -instcombine | FileCheck %s + +@G = constant [3 x i8] c"%s\00" ; <[3 x i8]*> [#uses=1] + +declare i32 @sprintf(i8*, i8*, ...) + +define void @foo(i8* %P, i32* %X) { + call i32 (i8*, i8*, ...)* @sprintf( i8* %P, i8* getelementptr ([3 x i8]* @G, i32 0, i32 0), i32* %X ) ; :1 [#uses=0] + ret void +} + +; PR1307 +@str = internal constant [5 x i8] c"foog\00" +@str1 = internal constant [8 x i8] c"blahhh!\00" +@str2 = internal constant [5 x i8] c"Ponk\00" + +define i8* @test1() { + %tmp3 = tail call i8* @strchr( i8* getelementptr ([5 x i8]* @str, i32 0, i32 2), i32 103 ) ; [#uses=1] + ret i8* %tmp3 + +; CHECK: @test1 +; CHECK: ret i8* getelementptr inbounds ([5 x i8]* @str, i32 0, i64 3) +} + +declare i8* @strchr(i8*, i32) + +define i8* @test2() { + %tmp3 = tail call i8* @strchr( i8* getelementptr ([8 x i8]* @str1, i32 0, i32 2), i32 0 ) ; [#uses=1] + ret i8* %tmp3 + +; CHECK: @test2 +; CHECK: ret i8* getelementptr inbounds ([8 x i8]* @str1, i32 0, i64 7) +} + +define i8* @test3() { +entry: + %tmp3 = tail call i8* @strchr( i8* getelementptr ([5 x i8]* @str2, i32 0, i32 1), i32 80 ) ; [#uses=1] + ret i8* %tmp3 + +; CHECK: @test3 +; CHECK: ret i8* null +} + +@_2E_str = external constant [5 x i8] ; <[5 x i8]*> [#uses=1] + +declare i32 @memcmp(i8*, i8*, i32) nounwind readonly + +define i1 @PR2341(i8** %start_addr) { +entry: + %tmp4 = load i8** %start_addr, align 4 ; [#uses=1] + %tmp5 = call i32 @memcmp( i8* %tmp4, i8* getelementptr ([5 x i8]* @_2E_str, i32 0, i32 0), i32 4 ) nounwind readonly ; [#uses=1] + %tmp6 = icmp eq i32 %tmp5, 0 ; [#uses=1] + ret i1 %tmp6 + +; CHECK: @PR2341 +; CHECK: i32 +} + +define i32 @PR4284() nounwind { +entry: + %c0 = alloca i8, align 1 ; [#uses=2] + %c2 = alloca i8, align 1 ; [#uses=2] + store i8 64, i8* %c0 + store i8 -127, i8* %c2 + %call = call i32 @memcmp(i8* %c0, i8* %c2, i32 1) ; [#uses=1] + ret i32 %call + +; CHECK: @PR4284 +; CHECK: ret i32 -65 +} + +%struct.__sFILE = type { i8*, i32, i32, i16, i16, %struct.__sbuf, i32, i8*, i32 (i8*)*, i32 (i8*, i8*, i32)*, i64 (i8*, i64, i32)*, i32 (i8*, i8*, i32)*, %struct.__sbuf, i8*, i32, [3 x i8], [1 x i8], %struct.__sbuf, i32, i64, %struct.pthread_mutex*, %struct.pthread*, i32, i32, %union.anon } +%struct.__sbuf = type { i8*, i32, [4 x i8] } +%struct.pthread = type opaque +%struct.pthread_mutex = type opaque +%union.anon = type { i64, [120 x i8] } +@.str13 = external constant [2 x i8] ; <[2 x i8]*> [#uses=1] +@.str14 = external constant [2 x i8] ; <[2 x i8]*> [#uses=1] + +define i32 @PR4641(i32 %argc, i8** %argv) nounwind { +entry: + call void @exit(i32 0) nounwind + %cond392 = select i1 undef, i8* getelementptr ([2 x i8]* @.str13, i32 0, i32 0), i8* getelementptr ([2 x i8]* @.str14, i32 0, i32 0) ; [#uses=1] + %call393 = call %struct.__sFILE* @fopen(i8* undef, i8* %cond392) nounwind ; <%struct.__sFILE*> [#uses=0] + unreachable +} + +declare %struct.__sFILE* @fopen(i8*, i8*) + +declare void @exit(i32) + +define i32 @PR4645() { +entry: + br label %if.then + +lor.lhs.false: ; preds = %while.body + br i1 undef, label %if.then, label %for.cond + +if.then: ; preds = %lor.lhs.false, %while.body + call void @exit(i32 1) + br label %for.cond + +for.cond: ; preds = %for.end, %if.then, %lor.lhs.false + %j.0 = phi i32 [ %inc47, %for.end ], [ 0, %if.then ], [ 0, %lor.lhs.false ] ; [#uses=1] + unreachable + +for.end: ; preds = %for.cond20 + %inc47 = add i32 %j.0, 1 ; [#uses=1] + br label %for.cond +} + +@h = constant [2 x i8] c"h\00" ; <[2 x i8]*> [#uses=1] +@hel = constant [4 x i8] c"hel\00" ; <[4 x i8]*> [#uses=1] +@hello_u = constant [8 x i8] c"hello_u\00" ; <[8 x i8]*> [#uses=1] + +define i32 @MemCpy() { + %h_p = getelementptr [2 x i8]* @h, i32 0, i32 0 + %hel_p = getelementptr [4 x i8]* @hel, i32 0, i32 0 + %hello_u_p = getelementptr [8 x i8]* @hello_u, i32 0, i32 0 + %target = alloca [1024 x i8] + %target_p = getelementptr [1024 x i8]* %target, i32 0, i32 0 + call void @llvm.memcpy.p0i8.p0i8.i32(i8* %target_p, i8* %h_p, i32 2, i32 2, i1 false) + call void @llvm.memcpy.p0i8.p0i8.i32(i8* %target_p, i8* %hel_p, i32 4, i32 4, i1 false) + call void @llvm.memcpy.p0i8.p0i8.i32(i8* %target_p, i8* %hello_u_p, i32 8, i32 8, i1 false) + ret i32 0 + +; CHECK: @MemCpy +; CHECK-NOT: llvm.memcpy +; CHECK: ret i32 0 +} + +declare void @llvm.memcpy.p0i8.p0i8.i32(i8* nocapture, i8* nocapture, i32, i32, i1) nounwind diff --git a/test/Transforms/InstCombine/win-math.ll b/test/Transforms/InstCombine/win-math.ll new file mode 100644 index 00000000000..367e5b80721 --- /dev/null +++ b/test/Transforms/InstCombine/win-math.ll @@ -0,0 +1,275 @@ +; RUN: opt -O2 -S -mtriple=i386-pc-win32 < %s | FileCheck %s -check-prefix=WIN32 +; RUN: opt -O2 -S -mtriple=x86_64-pc-win32 < %s | FileCheck %s -check-prefix=WIN64 +; RUN: opt -O2 -S -mtriple=i386-pc-mingw32 < %s | FileCheck %s -check-prefix=MINGW32 +; RUN: opt -O2 -S -mtriple=x86_64-pc-mingw32 < %s | FileCheck %s -check-prefix=MINGW64 + +; x86 win32 msvcrt does not provide entry points for single-precision libm. +; x86-64 win32 msvcrt does (except for fabsf) +; msvcrt does not provide C99 math, but mingw32 does. + +declare double @acos(double %x) +define float @float_acos(float %x) nounwind readnone { +; WIN32: @float_acos +; WIN32-NOT: float @acosf +; WIN32: double @acos + %1 = fpext float %x to double + %2 = call double @acos(double %1) + %3 = fptrunc double %2 to float + ret float %3 +} + +declare double @asin(double %x) +define float @float_asin(float %x) nounwind readnone { +; WIN32: @float_asin +; WIN32-NOT: float @asinf +; WIN32: double @asin + %1 = fpext float %x to double + %2 = call double @asin(double %1) + %3 = fptrunc double %2 to float + ret float %3 +} + +declare double @atan(double %x) +define float @float_atan(float %x) nounwind readnone { +; WIN32: @float_atan +; WIN32-NOT: float @atanf +; WIN32: double @atan + %1 = fpext float %x to double + %2 = call double @atan(double %1) + %3 = fptrunc double %2 to float + ret float %3 +} + +declare double @atan2(double %x, double %y) +define float @float_atan2(float %x, float %y) nounwind readnone { +; WIN32: @float_atan2 +; WIN32-NOT: float @atan2f +; WIN32: double @atan2 + %1 = fpext float %x to double + %2 = fpext float %y to double + %3 = call double @atan2(double %1, double %2) + %4 = fptrunc double %3 to float + ret float %4 +} + +declare double @ceil(double %x) +define float @float_ceil(float %x) nounwind readnone { +; WIN32: @float_ceil +; WIN32-NOT: float @ceilf +; WIN32: double @ceil +; WIN64: @float_ceil +; WIN64: float @ceilf +; WIN64-NOT: double @ceil +; MINGW32: @float_ceil +; MINGW32: float @ceilf +; MINGW32-NOT: double @ceil +; MINGW64: @float_ceil +; MINGW64: float @ceilf +; MINGW64-NOT: double @ceil + %1 = fpext float %x to double + %2 = call double @ceil(double %1) + %3 = fptrunc double %2 to float + ret float %3 +} + +declare double @_copysign(double %x) +define float @float_copysign(float %x) nounwind readnone { +; WIN32: @float_copysign +; WIN32-NOT: float @copysignf +; WIN32-NOT: float @_copysignf +; WIN32: double @_copysign + %1 = fpext float %x to double + %2 = call double @_copysign(double %1) + %3 = fptrunc double %2 to float + ret float %3 +} + +declare double @cos(double %x) +define float @float_cos(float %x) nounwind readnone { +; WIN32: @float_cos +; WIN32-NOT: float @cosf +; WIN32: double @cos + %1 = fpext float %x to double + %2 = call double @cos(double %1) + %3 = fptrunc double %2 to float + ret float %3 +} + +declare double @cosh(double %x) +define float @float_cosh(float %x) nounwind readnone { +; WIN32: @float_cosh +; WIN32-NOT: float @coshf +; WIN32: double @cosh + %1 = fpext float %x to double + %2 = call double @cosh(double %1) + %3 = fptrunc double %2 to float + ret float %3 +} + +declare double @exp(double %x, double %y) +define float @float_exp(float %x, float %y) nounwind readnone { +; WIN32: @float_exp +; WIN32-NOT: float @expf +; WIN32: double @exp + %1 = fpext float %x to double + %2 = fpext float %y to double + %3 = call double @exp(double %1, double %2) + %4 = fptrunc double %3 to float + ret float %4 +} + +declare double @fabs(double %x, double %y) +define float @float_fabs(float %x, float %y) nounwind readnone { +; WIN32: @float_fabs +; WIN32-NOT: float @fabsf +; WIN32: double @fabs +; WIN64: @float_fabs +; WIN64-NOT: float @fabsf +; WIN64: double @fabs + %1 = fpext float %x to double + %2 = fpext float %y to double + %3 = call double @fabs(double %1, double %2) + %4 = fptrunc double %3 to float + ret float %4 +} + +declare double @floor(double %x) +define float @float_floor(float %x) nounwind readnone { +; WIN32: @float_floor +; WIN32-NOT: float @floorf +; WIN32: double @floor +; WIN64: @float_floor +; WIN64: float @floorf +; WIN64-NOT: double @floor +; MINGW32: @float_floor +; MINGW32: float @floorf +; MINGW32-NOT: double @floor +; MINGW64: @float_floor +; MINGW64: float @floorf +; MINGW64-NOT: double @floor + %1 = fpext float %x to double + %2 = call double @floor(double %1) + %3 = fptrunc double %2 to float + ret float %3 +} + +declare double @fmod(double %x, double %y) +define float @float_fmod(float %x, float %y) nounwind readnone { +; WIN32: @float_fmod +; WIN32-NOT: float @fmodf +; WIN32: double @fmod + %1 = fpext float %x to double + %2 = fpext float %y to double + %3 = call double @fmod(double %1, double %2) + %4 = fptrunc double %3 to float + ret float %4 +} + +declare double @log(double %x) +define float @float_log(float %x) nounwind readnone { +; WIN32: @float_log +; WIN32-NOT: float @logf +; WIN32: double @log + %1 = fpext float %x to double + %2 = call double @log(double %1) + %3 = fptrunc double %2 to float + ret float %3 +} + +declare double @pow(double %x, double %y) +define float @float_pow(float %x, float %y) nounwind readnone { +; WIN32: @float_pow +; WIN32-NOT: float @powf +; WIN32: double @pow + %1 = fpext float %x to double + %2 = fpext float %y to double + %3 = call double @pow(double %1, double %2) + %4 = fptrunc double %3 to float + ret float %4 +} + +declare double @sin(double %x) +define float @float_sin(float %x) nounwind readnone { +; WIN32: @float_sin +; WIN32-NOT: float @sinf +; WIN32: double @sin + %1 = fpext float %x to double + %2 = call double @sin(double %1) + %3 = fptrunc double %2 to float + ret float %3 +} + +declare double @sinh(double %x) +define float @float_sinh(float %x) nounwind readnone { +; WIN32: @float_sinh +; WIN32-NOT: float @sinhf +; WIN32: double @sinh + %1 = fpext float %x to double + %2 = call double @sinh(double %1) + %3 = fptrunc double %2 to float + ret float %3 +} + +declare double @sqrt(double %x) +define float @float_sqrt(float %x) nounwind readnone { +; WIN32: @float_sqrt +; WIN32-NOT: float @sqrtf +; WIN32: double @sqrt +; WIN64: @float_sqrt +; WIN64: float @sqrtf +; WIN64-NOT: double @sqrt +; MINGW32: @float_sqrt +; MINGW32: float @sqrtf +; MINGW32-NOT: double @sqrt +; MINGW64: @float_sqrt +; MINGW64: float @sqrtf +; MINGW64-NOT: double @sqrt + %1 = fpext float %x to double + %2 = call double @sqrt(double %1) + %3 = fptrunc double %2 to float + ret float %3 +} + +declare double @tan(double %x) +define float @float_tan(float %x) nounwind readnone { +; WIN32: @float_tan +; WIN32-NOT: float @tanf +; WIN32: double @tan + %1 = fpext float %x to double + %2 = call double @tan(double %1) + %3 = fptrunc double %2 to float + ret float %3 +} + +declare double @tanh(double %x) +define float @float_tanh(float %x) nounwind readnone { +; WIN32: @float_tanh +; WIN32-NOT: float @tanhf +; WIN32: double @tanh + %1 = fpext float %x to double + %2 = call double @tanh(double %1) + %3 = fptrunc double %2 to float + ret float %3 +} + +; win32 does not have round; mingw32 does +declare double @round(double %x) +define float @float_round(float %x) nounwind readnone { +; WIN32: @float_round +; WIN32-NOT: float @roundf +; WIN32: double @round +; WIN64: @float_round +; WIN64-NOT: float @roundf +; WIN64: double @round +; MINGW32: @float_round +; MINGW32: float @roundf +; MINGW32-NOT: double @round +; MINGW64: @float_round +; MINGW64: float @roundf +; MINGW64-NOT: double @round + %1 = fpext float %x to double + %2 = call double @round(double %1) + %3 = fptrunc double %2 to float + ret float %3 +} + diff --git a/test/Transforms/SimplifyLibCalls/2005-05-20-sprintf-crash.ll b/test/Transforms/SimplifyLibCalls/2005-05-20-sprintf-crash.ll deleted file mode 100644 index 8816579a42f..00000000000 --- a/test/Transforms/SimplifyLibCalls/2005-05-20-sprintf-crash.ll +++ /dev/null @@ -1,11 +0,0 @@ -; RUN: opt < %s -simplify-libcalls -disable-output - -@G = constant [3 x i8] c"%s\00" ; <[3 x i8]*> [#uses=1] - -declare i32 @sprintf(i8*, i8*, ...) - -define void @foo(i8* %P, i32* %X) { - call i32 (i8*, i8*, ...)* @sprintf( i8* %P, i8* getelementptr ([3 x i8]* @G, i32 0, i32 0), i32* %X ) ; :1 [#uses=0] - ret void -} - diff --git a/test/Transforms/SimplifyLibCalls/2007-04-06-strchr-miscompile.ll b/test/Transforms/SimplifyLibCalls/2007-04-06-strchr-miscompile.ll deleted file mode 100644 index ae917f70f4f..00000000000 --- a/test/Transforms/SimplifyLibCalls/2007-04-06-strchr-miscompile.ll +++ /dev/null @@ -1,29 +0,0 @@ -; PR1307 -; RUN: opt < %s -simplify-libcalls -instcombine -S > %t -; RUN: grep "@str,.*i64 3" %t -; RUN: grep "@str1,.*i64 7" %t -; RUN: grep "ret i8.*null" %t -; END. - -@str = internal constant [5 x i8] c"foog\00" -@str1 = internal constant [8 x i8] c"blahhh!\00" -@str2 = internal constant [5 x i8] c"Ponk\00" - -define i8* @test1() { - %tmp3 = tail call i8* @strchr( i8* getelementptr ([5 x i8]* @str, i32 0, i32 2), i32 103 ) ; [#uses=1] - ret i8* %tmp3 -} - -declare i8* @strchr(i8*, i32) - -define i8* @test2() { - %tmp3 = tail call i8* @strchr( i8* getelementptr ([8 x i8]* @str1, i32 0, i32 2), i32 0 ) ; [#uses=1] - ret i8* %tmp3 -} - -define i8* @test3() { -entry: - %tmp3 = tail call i8* @strchr( i8* getelementptr ([5 x i8]* @str2, i32 0, i32 1), i32 80 ) ; [#uses=1] - ret i8* %tmp3 -} - diff --git a/test/Transforms/SimplifyLibCalls/2008-05-19-memcmp.ll b/test/Transforms/SimplifyLibCalls/2008-05-19-memcmp.ll deleted file mode 100644 index b6874322c4c..00000000000 --- a/test/Transforms/SimplifyLibCalls/2008-05-19-memcmp.ll +++ /dev/null @@ -1,14 +0,0 @@ -; RUN: opt < %s -simplify-libcalls -S | grep i32 -; PR2341 - -@_2E_str = external constant [5 x i8] ; <[5 x i8]*> [#uses=1] - -declare i32 @memcmp(i8*, i8*, i32) nounwind readonly - -define i1 @f(i8** %start_addr) { -entry: - %tmp4 = load i8** %start_addr, align 4 ; [#uses=1] - %tmp5 = call i32 @memcmp( i8* %tmp4, i8* getelementptr ([5 x i8]* @_2E_str, i32 0, i32 0), i32 4 ) nounwind readonly ; [#uses=1] - %tmp6 = icmp eq i32 %tmp5, 0 ; [#uses=1] - ret i1 %tmp6 -} diff --git a/test/Transforms/SimplifyLibCalls/2009-05-30-memcmp-byte.ll b/test/Transforms/SimplifyLibCalls/2009-05-30-memcmp-byte.ll deleted file mode 100644 index f4c80ed1327..00000000000 --- a/test/Transforms/SimplifyLibCalls/2009-05-30-memcmp-byte.ll +++ /dev/null @@ -1,14 +0,0 @@ -; RUN: opt < %s -simplify-libcalls -instcombine -S | grep "ret i32 -65" -; PR4284 - -define i32 @test() nounwind { -entry: - %c0 = alloca i8, align 1 ; [#uses=2] - %c2 = alloca i8, align 1 ; [#uses=2] - store i8 64, i8* %c0 - store i8 -127, i8* %c2 - %call = call i32 @memcmp(i8* %c0, i8* %c2, i32 1) ; [#uses=1] - ret i32 %call -} - -declare i32 @memcmp(i8*, i8*, i32) diff --git a/test/Transforms/SimplifyLibCalls/2009-07-28-Exit.ll b/test/Transforms/SimplifyLibCalls/2009-07-28-Exit.ll deleted file mode 100644 index 7af0a261d43..00000000000 --- a/test/Transforms/SimplifyLibCalls/2009-07-28-Exit.ll +++ /dev/null @@ -1,22 +0,0 @@ -; RUN: opt < %s -simplify-libcalls -disable-output -; PR4641 - - %struct.__sFILE = type { i8*, i32, i32, i16, i16, %struct.__sbuf, i32, i8*, i32 (i8*)*, i32 (i8*, i8*, i32)*, i64 (i8*, i64, i32)*, i32 (i8*, i8*, i32)*, %struct.__sbuf, i8*, i32, [3 x i8], [1 x i8], %struct.__sbuf, i32, i64, %struct.pthread_mutex*, %struct.pthread*, i32, i32, %union.anon } - %struct.__sbuf = type { i8*, i32, [4 x i8] } - %struct.pthread = type opaque - %struct.pthread_mutex = type opaque - %union.anon = type { i64, [120 x i8] } -@.str13 = external constant [2 x i8] ; <[2 x i8]*> [#uses=1] -@.str14 = external constant [2 x i8] ; <[2 x i8]*> [#uses=1] - -define i32 @main(i32 %argc, i8** %argv) nounwind { -entry: - call void @exit(i32 0) nounwind - %cond392 = select i1 undef, i8* getelementptr ([2 x i8]* @.str13, i32 0, i32 0), i8* getelementptr ([2 x i8]* @.str14, i32 0, i32 0) ; [#uses=1] - %call393 = call %struct.__sFILE* @fopen(i8* undef, i8* %cond392) nounwind ; <%struct.__sFILE*> [#uses=0] - unreachable -} - -declare %struct.__sFILE* @fopen(i8*, i8*) - -declare void @exit(i32) diff --git a/test/Transforms/SimplifyLibCalls/2009-07-29-Exit2.ll b/test/Transforms/SimplifyLibCalls/2009-07-29-Exit2.ll deleted file mode 100644 index b5a788e0973..00000000000 --- a/test/Transforms/SimplifyLibCalls/2009-07-29-Exit2.ll +++ /dev/null @@ -1,24 +0,0 @@ -; RUN: opt < %s -simplify-libcalls -disable-output -; PR4645 - -define i32 @main() { -entry: - br label %if.then - -lor.lhs.false: ; preds = %while.body - br i1 undef, label %if.then, label %for.cond - -if.then: ; preds = %lor.lhs.false, %while.body - call void @exit(i32 1) - br label %for.cond - -for.cond: ; preds = %for.end, %if.then, %lor.lhs.false - %j.0 = phi i32 [ %inc47, %for.end ], [ 0, %if.then ], [ 0, %lor.lhs.false ] ; [#uses=1] - unreachable - -for.end: ; preds = %for.cond20 - %inc47 = add i32 %j.0, 1 ; [#uses=1] - br label %for.cond -} - -declare void @exit(i32) diff --git a/test/Transforms/SimplifyLibCalls/MemCpy.ll b/test/Transforms/SimplifyLibCalls/MemCpy.ll deleted file mode 100644 index 1faad036a86..00000000000 --- a/test/Transforms/SimplifyLibCalls/MemCpy.ll +++ /dev/null @@ -1,19 +0,0 @@ -; RUN: opt < %s -constprop -instcombine -S | not grep "call.*llvm.memcpy.i32" - -@h = constant [2 x i8] c"h\00" ; <[2 x i8]*> [#uses=1] -@hel = constant [4 x i8] c"hel\00" ; <[4 x i8]*> [#uses=1] -@hello_u = constant [8 x i8] c"hello_u\00" ; <[8 x i8]*> [#uses=1] - -define i32 @main() { - %h_p = getelementptr [2 x i8]* @h, i32 0, i32 0 - %hel_p = getelementptr [4 x i8]* @hel, i32 0, i32 0 - %hello_u_p = getelementptr [8 x i8]* @hello_u, i32 0, i32 0 - %target = alloca [1024 x i8] - %target_p = getelementptr [1024 x i8]* %target, i32 0, i32 0 - call void @llvm.memcpy.p0i8.p0i8.i32(i8* %target_p, i8* %h_p, i32 2, i32 2, i1 false) - call void @llvm.memcpy.p0i8.p0i8.i32(i8* %target_p, i8* %hel_p, i32 4, i32 4, i1 false) - call void @llvm.memcpy.p0i8.p0i8.i32(i8* %target_p, i8* %hello_u_p, i32 8, i32 8, i1 false) - ret i32 0 -} - -declare void @llvm.memcpy.p0i8.p0i8.i32(i8* nocapture, i8* nocapture, i32, i32, i1) nounwind diff --git a/test/Transforms/SimplifyLibCalls/PR7357.ll b/test/Transforms/SimplifyLibCalls/PR7357.ll deleted file mode 100644 index 3529a9cfb1b..00000000000 --- a/test/Transforms/SimplifyLibCalls/PR7357.ll +++ /dev/null @@ -1,16 +0,0 @@ -; RUN: opt < %s "-default-data-layout=e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-n32" -simplify-libcalls -S | FileCheck %s -@.str1 = private constant [11 x i8] c"(){};[]&|:\00", align 4 - -; check that simplify libcalls will not replace a call with one calling -; convention with a new call with a different calling convention. - -; CHECK: define arm_aapcscc i32 @foo(i32 %argc) -; CHECK: call arm_aapcscc i8* @strchr -define arm_aapcscc i32 @foo(i32 %argc) nounwind { -bb.nph: - call arm_aapcscc i8* @strchr(i8* getelementptr ([11 x i8]* @.str1, i32 0, -i32 0), i32 %argc) nounwind readonly - ret i32 0 -} - -declare arm_aapcscc i8* @strchr(i8*, i32) nounwind readonly diff --git a/test/Transforms/SimplifyLibCalls/float-shrink-compare.ll b/test/Transforms/SimplifyLibCalls/float-shrink-compare.ll deleted file mode 100644 index ad54c3e38f1..00000000000 --- a/test/Transforms/SimplifyLibCalls/float-shrink-compare.ll +++ /dev/null @@ -1,179 +0,0 @@ -; RUN: opt -S -simplify-libcalls -instcombine < %s | FileCheck %s -target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128" -target triple = "x86_64-apple-macosx10.8.0" - -define i32 @test1(float %x, float %y) nounwind uwtable { - %1 = fpext float %x to double - %2 = call double @ceil(double %1) nounwind readnone - %3 = fpext float %y to double - %4 = fcmp oeq double %2, %3 - %5 = zext i1 %4 to i32 - ret i32 %5 -; CHECK: @test1 -; CHECK-NEXT: %ceilf = call float @ceilf(float %x) -; CHECK-NEXT: fcmp oeq float %ceilf, %y -} - -define i32 @test2(float %x, float %y) nounwind uwtable { - %1 = fpext float %x to double - %2 = call double @fabs(double %1) nounwind readnone - %3 = fpext float %y to double - %4 = fcmp oeq double %2, %3 - %5 = zext i1 %4 to i32 - ret i32 %5 -; CHECK: @test2 -; CHECK-NEXT: %fabsf = call float @fabsf(float %x) -; CHECK-NEXT: fcmp oeq float %fabsf, %y -} - -define i32 @test3(float %x, float %y) nounwind uwtable { - %1 = fpext float %x to double - %2 = call double @floor(double %1) nounwind readnone - %3 = fpext float %y to double - %4 = fcmp oeq double %2, %3 - %5 = zext i1 %4 to i32 - ret i32 %5 -; CHECK: @test3 -; CHECK-NEXT: %floorf = call float @floorf(float %x) -; CHECK-NEXT: fcmp oeq float %floorf, %y -} - -define i32 @test4(float %x, float %y) nounwind uwtable { - %1 = fpext float %x to double - %2 = call double @nearbyint(double %1) nounwind - %3 = fpext float %y to double - %4 = fcmp oeq double %2, %3 - %5 = zext i1 %4 to i32 - ret i32 %5 -; CHECK: @test4 -; CHECK-NEXT: %nearbyintf = call float @nearbyintf(float %x) -; CHECK-NEXT: fcmp oeq float %nearbyintf, %y -} - -define i32 @test5(float %x, float %y) nounwind uwtable { - %1 = fpext float %x to double - %2 = call double @rint(double %1) nounwind - %3 = fpext float %y to double - %4 = fcmp oeq double %2, %3 - %5 = zext i1 %4 to i32 - ret i32 %5 -; CHECK: @test5 -; CHECK-NEXT: %rintf = call float @rintf(float %x) -; CHECK-NEXT: fcmp oeq float %rintf, %y -} - -define i32 @test6(float %x, float %y) nounwind uwtable { - %1 = fpext float %x to double - %2 = call double @round(double %1) nounwind readnone - %3 = fpext float %y to double - %4 = fcmp oeq double %2, %3 - %5 = zext i1 %4 to i32 - ret i32 %5 -; CHECK: @test6 -; CHECK-NEXT: %roundf = call float @roundf(float %x) -; CHECK-NEXT: fcmp oeq float %roundf, %y -} - -define i32 @test7(float %x, float %y) nounwind uwtable { - %1 = fpext float %x to double - %2 = call double @trunc(double %1) nounwind - %3 = fpext float %y to double - %4 = fcmp oeq double %2, %3 - %5 = zext i1 %4 to i32 - ret i32 %5 -; CHECK: @test7 -; CHECK-NEXT: %truncf = call float @truncf(float %x) -; CHECK-NEXT: fcmp oeq float %truncf, %y -} - -define i32 @test8(float %x, float %y) nounwind uwtable { - %1 = fpext float %y to double - %2 = fpext float %x to double - %3 = call double @ceil(double %2) nounwind readnone - %4 = fcmp oeq double %1, %3 - %5 = zext i1 %4 to i32 - ret i32 %5 -; CHECK: @test8 -; CHECK-NEXT: %ceilf = call float @ceilf(float %x) -; CHECK-NEXT: fcmp oeq float %ceilf, %y -} - -define i32 @test9(float %x, float %y) nounwind uwtable { - %1 = fpext float %y to double - %2 = fpext float %x to double - %3 = call double @fabs(double %2) nounwind readnone - %4 = fcmp oeq double %1, %3 - %5 = zext i1 %4 to i32 - ret i32 %5 -; CHECK: @test9 -; CHECK-NEXT: %fabsf = call float @fabsf(float %x) -; CHECK-NEXT: fcmp oeq float %fabsf, %y -} - -define i32 @test10(float %x, float %y) nounwind uwtable { - %1 = fpext float %y to double - %2 = fpext float %x to double - %3 = call double @floor(double %2) nounwind readnone - %4 = fcmp oeq double %1, %3 - %5 = zext i1 %4 to i32 - ret i32 %5 -; CHECK: @test10 -; CHECK-NEXT: %floorf = call float @floorf(float %x) -; CHECK-NEXT: fcmp oeq float %floorf, %y -} - -define i32 @test11(float %x, float %y) nounwind uwtable { - %1 = fpext float %y to double - %2 = fpext float %x to double - %3 = call double @nearbyint(double %2) nounwind - %4 = fcmp oeq double %1, %3 - %5 = zext i1 %4 to i32 - ret i32 %5 -; CHECK: @test11 -; CHECK-NEXT: %nearbyintf = call float @nearbyintf(float %x) -; CHECK-NEXT: fcmp oeq float %nearbyintf, %y -} - -define i32 @test12(float %x, float %y) nounwind uwtable { - %1 = fpext float %y to double - %2 = fpext float %x to double - %3 = call double @rint(double %2) nounwind - %4 = fcmp oeq double %1, %3 - %5 = zext i1 %4 to i32 - ret i32 %5 -; CHECK: @test12 -; CHECK-NEXT: %rintf = call float @rintf(float %x) -; CHECK-NEXT: fcmp oeq float %rintf, %y -} - -define i32 @test13(float %x, float %y) nounwind uwtable { - %1 = fpext float %y to double - %2 = fpext float %x to double - %3 = call double @round(double %2) nounwind readnone - %4 = fcmp oeq double %1, %3 - %5 = zext i1 %4 to i32 - ret i32 %5 -; CHECK: @test13 -; CHECK-NEXT: %roundf = call float @roundf(float %x) -; CHECK-NEXT: fcmp oeq float %roundf, %y -} - -define i32 @test14(float %x, float %y) nounwind uwtable { - %1 = fpext float %y to double - %2 = fpext float %x to double - %3 = call double @trunc(double %2) nounwind - %4 = fcmp oeq double %1, %3 - %5 = zext i1 %4 to i32 - ret i32 %5 -; CHECK: @test14 -; CHECK-NEXT: %truncf = call float @truncf(float %x) -; CHECK-NEXT: fcmp oeq float %truncf, %y -} - -declare double @fabs(double) nounwind readnone -declare double @ceil(double) nounwind readnone -declare double @floor(double) nounwind readnone -declare double @nearbyint(double) nounwind readnone -declare double @rint(double) nounwind readnone -declare double @round(double) nounwind readnone -declare double @trunc(double) nounwind readnone diff --git a/test/Transforms/SimplifyLibCalls/lit.local.cfg b/test/Transforms/SimplifyLibCalls/lit.local.cfg deleted file mode 100644 index 19eebc0ac7a..00000000000 --- a/test/Transforms/SimplifyLibCalls/lit.local.cfg +++ /dev/null @@ -1 +0,0 @@ -config.suffixes = ['.ll', '.c', '.cpp'] diff --git a/test/Transforms/SimplifyLibCalls/win-math.ll b/test/Transforms/SimplifyLibCalls/win-math.ll deleted file mode 100644 index 367e5b80721..00000000000 --- a/test/Transforms/SimplifyLibCalls/win-math.ll +++ /dev/null @@ -1,275 +0,0 @@ -; RUN: opt -O2 -S -mtriple=i386-pc-win32 < %s | FileCheck %s -check-prefix=WIN32 -; RUN: opt -O2 -S -mtriple=x86_64-pc-win32 < %s | FileCheck %s -check-prefix=WIN64 -; RUN: opt -O2 -S -mtriple=i386-pc-mingw32 < %s | FileCheck %s -check-prefix=MINGW32 -; RUN: opt -O2 -S -mtriple=x86_64-pc-mingw32 < %s | FileCheck %s -check-prefix=MINGW64 - -; x86 win32 msvcrt does not provide entry points for single-precision libm. -; x86-64 win32 msvcrt does (except for fabsf) -; msvcrt does not provide C99 math, but mingw32 does. - -declare double @acos(double %x) -define float @float_acos(float %x) nounwind readnone { -; WIN32: @float_acos -; WIN32-NOT: float @acosf -; WIN32: double @acos - %1 = fpext float %x to double - %2 = call double @acos(double %1) - %3 = fptrunc double %2 to float - ret float %3 -} - -declare double @asin(double %x) -define float @float_asin(float %x) nounwind readnone { -; WIN32: @float_asin -; WIN32-NOT: float @asinf -; WIN32: double @asin - %1 = fpext float %x to double - %2 = call double @asin(double %1) - %3 = fptrunc double %2 to float - ret float %3 -} - -declare double @atan(double %x) -define float @float_atan(float %x) nounwind readnone { -; WIN32: @float_atan -; WIN32-NOT: float @atanf -; WIN32: double @atan - %1 = fpext float %x to double - %2 = call double @atan(double %1) - %3 = fptrunc double %2 to float - ret float %3 -} - -declare double @atan2(double %x, double %y) -define float @float_atan2(float %x, float %y) nounwind readnone { -; WIN32: @float_atan2 -; WIN32-NOT: float @atan2f -; WIN32: double @atan2 - %1 = fpext float %x to double - %2 = fpext float %y to double - %3 = call double @atan2(double %1, double %2) - %4 = fptrunc double %3 to float - ret float %4 -} - -declare double @ceil(double %x) -define float @float_ceil(float %x) nounwind readnone { -; WIN32: @float_ceil -; WIN32-NOT: float @ceilf -; WIN32: double @ceil -; WIN64: @float_ceil -; WIN64: float @ceilf -; WIN64-NOT: double @ceil -; MINGW32: @float_ceil -; MINGW32: float @ceilf -; MINGW32-NOT: double @ceil -; MINGW64: @float_ceil -; MINGW64: float @ceilf -; MINGW64-NOT: double @ceil - %1 = fpext float %x to double - %2 = call double @ceil(double %1) - %3 = fptrunc double %2 to float - ret float %3 -} - -declare double @_copysign(double %x) -define float @float_copysign(float %x) nounwind readnone { -; WIN32: @float_copysign -; WIN32-NOT: float @copysignf -; WIN32-NOT: float @_copysignf -; WIN32: double @_copysign - %1 = fpext float %x to double - %2 = call double @_copysign(double %1) - %3 = fptrunc double %2 to float - ret float %3 -} - -declare double @cos(double %x) -define float @float_cos(float %x) nounwind readnone { -; WIN32: @float_cos -; WIN32-NOT: float @cosf -; WIN32: double @cos - %1 = fpext float %x to double - %2 = call double @cos(double %1) - %3 = fptrunc double %2 to float - ret float %3 -} - -declare double @cosh(double %x) -define float @float_cosh(float %x) nounwind readnone { -; WIN32: @float_cosh -; WIN32-NOT: float @coshf -; WIN32: double @cosh - %1 = fpext float %x to double - %2 = call double @cosh(double %1) - %3 = fptrunc double %2 to float - ret float %3 -} - -declare double @exp(double %x, double %y) -define float @float_exp(float %x, float %y) nounwind readnone { -; WIN32: @float_exp -; WIN32-NOT: float @expf -; WIN32: double @exp - %1 = fpext float %x to double - %2 = fpext float %y to double - %3 = call double @exp(double %1, double %2) - %4 = fptrunc double %3 to float - ret float %4 -} - -declare double @fabs(double %x, double %y) -define float @float_fabs(float %x, float %y) nounwind readnone { -; WIN32: @float_fabs -; WIN32-NOT: float @fabsf -; WIN32: double @fabs -; WIN64: @float_fabs -; WIN64-NOT: float @fabsf -; WIN64: double @fabs - %1 = fpext float %x to double - %2 = fpext float %y to double - %3 = call double @fabs(double %1, double %2) - %4 = fptrunc double %3 to float - ret float %4 -} - -declare double @floor(double %x) -define float @float_floor(float %x) nounwind readnone { -; WIN32: @float_floor -; WIN32-NOT: float @floorf -; WIN32: double @floor -; WIN64: @float_floor -; WIN64: float @floorf -; WIN64-NOT: double @floor -; MINGW32: @float_floor -; MINGW32: float @floorf -; MINGW32-NOT: double @floor -; MINGW64: @float_floor -; MINGW64: float @floorf -; MINGW64-NOT: double @floor - %1 = fpext float %x to double - %2 = call double @floor(double %1) - %3 = fptrunc double %2 to float - ret float %3 -} - -declare double @fmod(double %x, double %y) -define float @float_fmod(float %x, float %y) nounwind readnone { -; WIN32: @float_fmod -; WIN32-NOT: float @fmodf -; WIN32: double @fmod - %1 = fpext float %x to double - %2 = fpext float %y to double - %3 = call double @fmod(double %1, double %2) - %4 = fptrunc double %3 to float - ret float %4 -} - -declare double @log(double %x) -define float @float_log(float %x) nounwind readnone { -; WIN32: @float_log -; WIN32-NOT: float @logf -; WIN32: double @log - %1 = fpext float %x to double - %2 = call double @log(double %1) - %3 = fptrunc double %2 to float - ret float %3 -} - -declare double @pow(double %x, double %y) -define float @float_pow(float %x, float %y) nounwind readnone { -; WIN32: @float_pow -; WIN32-NOT: float @powf -; WIN32: double @pow - %1 = fpext float %x to double - %2 = fpext float %y to double - %3 = call double @pow(double %1, double %2) - %4 = fptrunc double %3 to float - ret float %4 -} - -declare double @sin(double %x) -define float @float_sin(float %x) nounwind readnone { -; WIN32: @float_sin -; WIN32-NOT: float @sinf -; WIN32: double @sin - %1 = fpext float %x to double - %2 = call double @sin(double %1) - %3 = fptrunc double %2 to float - ret float %3 -} - -declare double @sinh(double %x) -define float @float_sinh(float %x) nounwind readnone { -; WIN32: @float_sinh -; WIN32-NOT: float @sinhf -; WIN32: double @sinh - %1 = fpext float %x to double - %2 = call double @sinh(double %1) - %3 = fptrunc double %2 to float - ret float %3 -} - -declare double @sqrt(double %x) -define float @float_sqrt(float %x) nounwind readnone { -; WIN32: @float_sqrt -; WIN32-NOT: float @sqrtf -; WIN32: double @sqrt -; WIN64: @float_sqrt -; WIN64: float @sqrtf -; WIN64-NOT: double @sqrt -; MINGW32: @float_sqrt -; MINGW32: float @sqrtf -; MINGW32-NOT: double @sqrt -; MINGW64: @float_sqrt -; MINGW64: float @sqrtf -; MINGW64-NOT: double @sqrt - %1 = fpext float %x to double - %2 = call double @sqrt(double %1) - %3 = fptrunc double %2 to float - ret float %3 -} - -declare double @tan(double %x) -define float @float_tan(float %x) nounwind readnone { -; WIN32: @float_tan -; WIN32-NOT: float @tanf -; WIN32: double @tan - %1 = fpext float %x to double - %2 = call double @tan(double %1) - %3 = fptrunc double %2 to float - ret float %3 -} - -declare double @tanh(double %x) -define float @float_tanh(float %x) nounwind readnone { -; WIN32: @float_tanh -; WIN32-NOT: float @tanhf -; WIN32: double @tanh - %1 = fpext float %x to double - %2 = call double @tanh(double %1) - %3 = fptrunc double %2 to float - ret float %3 -} - -; win32 does not have round; mingw32 does -declare double @round(double %x) -define float @float_round(float %x) nounwind readnone { -; WIN32: @float_round -; WIN32-NOT: float @roundf -; WIN32: double @round -; WIN64: @float_round -; WIN64-NOT: float @roundf -; WIN64: double @round -; MINGW32: @float_round -; MINGW32: float @roundf -; MINGW32-NOT: double @round -; MINGW64: @float_round -; MINGW64: float @roundf -; MINGW64-NOT: double @round - %1 = fpext float %x to double - %2 = call double @round(double %1) - %3 = fptrunc double %2 to float - ret float %3 -} -