1 ; Test that -disable-simplify-libcalls is wired up correctly.
3 ; RUN: opt < %s -passes=instcombine -disable-simplify-libcalls -S | FileCheck %s
5 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"
7 @.str = constant [1 x i8] zeroinitializer, align 1
8 @.str1 = constant [13 x i8] c"hello, world\00", align 1
9 @.str2 = constant [4 x i8] c"foo\00", align 1
10 @.str3 = constant [4 x i8] c"bar\00", align 1
11 @.str4 = constant [6 x i8] c"123.4\00", align 1
12 @.str5 = constant [5 x i8] c"1234\00", align 1
13 @empty = constant [1 x i8] c"\00", align 1
15 declare double @ceil(double)
16 declare double @copysign(double, double)
17 declare double @cos(double)
18 declare double @fabs(double)
19 declare double @floor(double)
20 declare ptr @strcat(ptr, ptr)
21 declare ptr @strncat(ptr, ptr, i32)
22 declare ptr @strchr(ptr, i32)
23 declare ptr @strrchr(ptr, i32)
24 declare i32 @strcmp(ptr, ptr)
25 declare i32 @strncmp(ptr, ptr, i64)
26 declare ptr @strcpy(ptr, ptr)
27 declare ptr @stpcpy(ptr, ptr)
28 declare ptr @strncpy(ptr, ptr, i64)
29 declare i64 @strlen(ptr)
30 declare ptr @strpbrk(ptr, ptr)
31 declare i64 @strspn(ptr, ptr)
32 declare double @strtod(ptr, ptr)
33 declare float @strtof(ptr, ptr)
34 declare x86_fp80 @strtold(ptr, ptr)
35 declare i64 @strtol(ptr, ptr, i32)
36 declare i64 @strtoll(ptr, ptr, i32)
37 declare i64 @strtoul(ptr, ptr, i32)
38 declare i64 @strtoull(ptr, ptr, i32)
39 declare i64 @strcspn(ptr, ptr)
42 declare i32 @ffsl(i64)
43 declare i32 @ffsll(i64)
44 declare i32 @fprintf(ptr, ptr)
45 declare i32 @isascii(i32)
46 declare i32 @isdigit(i32)
47 declare i32 @toascii(i32)
48 declare i64 @labs(i64)
49 declare i64 @llabs(i64)
50 declare i32 @printf(ptr)
51 declare i32 @sprintf(ptr, ptr)
53 define double @t1(double %x) {
55 %ret = call double @ceil(double %x)
57 ; CHECK: call double @ceil
60 define double @t2(double %x, double %y) {
62 %ret = call double @copysign(double %x, double %y)
64 ; CHECK: call double @copysign
67 define double @t3(double %x) {
69 %call = call double @cos(double %x)
71 ; CHECK: call double @cos
74 define double @t4(double %x) {
76 %ret = call double @fabs(double %x)
78 ; CHECK: call double @fabs
81 define double @t5(double %x) {
83 %ret = call double @floor(double %x)
85 ; CHECK: call double @floor
88 define ptr @t6(ptr %x) {
90 %ret = call ptr @strcat(ptr %x, ptr @empty)
92 ; CHECK: call ptr @strcat
95 define ptr @t7(ptr %x) {
97 %ret = call ptr @strncat(ptr %x, ptr @empty, i32 1)
99 ; CHECK: call ptr @strncat
104 %ret = call ptr @strchr(ptr @.str1, i32 119)
106 ; CHECK: call ptr @strchr
111 %ret = call ptr @strrchr(ptr @.str1, i32 119)
113 ; CHECK: call ptr @strrchr
118 %ret = call i32 @strcmp(ptr @.str2, ptr @.str3)
120 ; CHECK: call i32 @strcmp
125 %ret = call i32 @strncmp(ptr @.str2, ptr @.str3, i64 3)
127 ; CHECK: call i32 @strncmp
130 define ptr @t12(ptr %x) {
132 %ret = call ptr @strcpy(ptr %x, ptr @.str2)
134 ; CHECK: call ptr @strcpy
137 define ptr @t13(ptr %x) {
139 %ret = call ptr @stpcpy(ptr %x, ptr @.str2)
141 ; CHECK: call ptr @stpcpy
144 define ptr @t14(ptr %x) {
146 %ret = call ptr @strncpy(ptr %x, ptr @.str2, i64 3)
148 ; CHECK: call ptr @strncpy
153 %ret = call i64 @strlen(ptr @.str2)
155 ; CHECK: call i64 @strlen
158 define ptr @t16(ptr %x) {
160 %ret = call ptr @strpbrk(ptr %x, ptr @.str)
162 ; CHECK: call ptr @strpbrk
165 define i64 @t17(ptr %x) {
167 %ret = call i64 @strspn(ptr %x, ptr @.str)
169 ; CHECK: call i64 @strspn
172 define double @t18(ptr %y) {
174 %ret = call double @strtod(ptr @.str4, ptr %y)
176 ; CHECK: call double @strtod
179 define float @t19(ptr %y) {
181 %ret = call float @strtof(ptr @.str4, ptr %y)
183 ; CHECK: call float @strtof
186 define x86_fp80 @t20(ptr %y) {
188 %ret = call x86_fp80 @strtold(ptr @.str4, ptr %y)
190 ; CHECK: call x86_fp80 @strtold
193 define i64 @t21(ptr %y) {
195 %ret = call i64 @strtol(ptr @.str5, ptr %y, i32 10)
197 ; CHECK: call i64 @strtol
200 define i64 @t22(ptr %y) {
202 %ret = call i64 @strtoll(ptr @.str5, ptr %y, i32 10)
204 ; CHECK: call i64 @strtoll
207 define i64 @t23(ptr %y) {
209 %ret = call i64 @strtoul(ptr @.str5, ptr %y, i32 10)
211 ; CHECK: call i64 @strtoul
214 define i64 @t24(ptr %y) {
216 %ret = call i64 @strtoull(ptr @.str5, ptr %y, i32 10)
218 ; CHECK: call i64 @strtoull
221 define i64 @t25(ptr %y) {
223 %ret = call i64 @strcspn(ptr @empty, ptr %y)
225 ; CHECK: call i64 @strcspn
228 define i32 @t26(i32 %y) {
230 %ret = call i32 @abs(i32 %y)
232 ; CHECK: call i32 @abs
235 define i32 @t27(i32 %y) {
237 %ret = call i32 @ffs(i32 %y)
239 ; CHECK: call i32 @ffs
242 define i32 @t28(i64 %y) {
244 %ret = call i32 @ffsl(i64 %y)
246 ; CHECK: call i32 @ffsl
249 define i32 @t29(i64 %y) {
251 %ret = call i32 @ffsll(i64 %y)
253 ; CHECK: call i32 @ffsll
258 call i32 @fprintf(ptr null, ptr @.str1)
260 ; CHECK: call i32 @fprintf
263 define i32 @t31(i32 %y) {
265 %ret = call i32 @isascii(i32 %y)
267 ; CHECK: call i32 @isascii
270 define i32 @t32(i32 %y) {
272 %ret = call i32 @isdigit(i32 %y)
274 ; CHECK: call i32 @isdigit
277 define i32 @t33(i32 %y) {
279 %ret = call i32 @toascii(i32 %y)
281 ; CHECK: call i32 @toascii
284 define i64 @t34(i64 %y) {
286 %ret = call i64 @labs(i64 %y)
288 ; CHECK: call i64 @labs
291 define i64 @t35(i64 %y) {
293 %ret = call i64 @llabs(i64 %y)
295 ; CHECK: call i64 @llabs
300 call i32 @printf(ptr @empty)
302 ; CHECK: call i32 @printf
305 define void @t37(ptr %x) {
307 call i32 @sprintf(ptr %x, ptr @.str1)
309 ; CHECK: call i32 @sprintf