xref: /minix3/external/bsd/llvm/dist/clang/test/CodeGen/libcalls-fno-builtin.c (revision f4a2713ac843a11c696ec80c0a5e3e5d80b4d338)
1*f4a2713aSLionel Sambuc // RUN: %clang_cc1 -S -O3 -fno-builtin -o - %s | FileCheck %s
2*f4a2713aSLionel Sambuc // rdar://10551066
3*f4a2713aSLionel Sambuc 
4*f4a2713aSLionel Sambuc typedef __SIZE_TYPE__ size_t;
5*f4a2713aSLionel Sambuc 
6*f4a2713aSLionel Sambuc double ceil(double x);
7*f4a2713aSLionel Sambuc double copysign(double,double);
8*f4a2713aSLionel Sambuc double cos(double x);
9*f4a2713aSLionel Sambuc double fabs(double x);
10*f4a2713aSLionel Sambuc double floor(double x);
11*f4a2713aSLionel Sambuc char *strcat(char *s1, const char *s2);
12*f4a2713aSLionel Sambuc char *strncat(char *s1, const char *s2, size_t n);
13*f4a2713aSLionel Sambuc char *strchr(const char *s, int c);
14*f4a2713aSLionel Sambuc char *strrchr(const char *s, int c);
15*f4a2713aSLionel Sambuc int strcmp(const char *s1, const char *s2);
16*f4a2713aSLionel Sambuc int strncmp(const char *s1, const char *s2, size_t n);
17*f4a2713aSLionel Sambuc char *strcpy(char *s1, const char *s2);
18*f4a2713aSLionel Sambuc char *stpcpy(char *s1, const char *s2);
19*f4a2713aSLionel Sambuc char *strncpy(char *s1, const char *s2, size_t n);
20*f4a2713aSLionel Sambuc size_t strlen(const char *s);
21*f4a2713aSLionel Sambuc char *strpbrk(const char *s1, const char *s2);
22*f4a2713aSLionel Sambuc size_t strspn(const char *s1, const char *s2);
23*f4a2713aSLionel Sambuc double strtod(const char *nptr, char **endptr);
24*f4a2713aSLionel Sambuc float strtof(const char *nptr, char **endptr);
25*f4a2713aSLionel Sambuc long double strtold(const char *nptr, char **endptr);
26*f4a2713aSLionel Sambuc long int strtol(const char *nptr, char **endptr, int base);
27*f4a2713aSLionel Sambuc long long int strtoll(const char *nptr, char **endptr, int base);
28*f4a2713aSLionel Sambuc unsigned long int strtoul(const char *nptr, char **endptr, int base);
29*f4a2713aSLionel Sambuc unsigned long long int strtoull(const char *nptr, char **endptr, int base);
30*f4a2713aSLionel Sambuc 
t1(double x)31*f4a2713aSLionel Sambuc double t1(double x) { return ceil(x); }
32*f4a2713aSLionel Sambuc // CHECK: t1
33*f4a2713aSLionel Sambuc // CHECK: ceil
34*f4a2713aSLionel Sambuc 
t2(double x,double y)35*f4a2713aSLionel Sambuc double t2(double x, double y) { return copysign(x,y); }
36*f4a2713aSLionel Sambuc // CHECK: t2
37*f4a2713aSLionel Sambuc // CHECK: copysign
38*f4a2713aSLionel Sambuc 
t3(double x)39*f4a2713aSLionel Sambuc double t3(double x) { return cos(x); }
40*f4a2713aSLionel Sambuc // CHECK: t3
41*f4a2713aSLionel Sambuc // CHECK: cos
42*f4a2713aSLionel Sambuc 
t4(double x)43*f4a2713aSLionel Sambuc double t4(double x) { return fabs(x); }
44*f4a2713aSLionel Sambuc // CHECK: t4
45*f4a2713aSLionel Sambuc // CHECK: fabs
46*f4a2713aSLionel Sambuc 
t5(double x)47*f4a2713aSLionel Sambuc double t5(double x) { return floor(x); }
48*f4a2713aSLionel Sambuc // CHECK: t5
49*f4a2713aSLionel Sambuc // CHECK: floor
50*f4a2713aSLionel Sambuc 
t6(char * x)51*f4a2713aSLionel Sambuc char *t6(char *x) { return strcat(x, ""); }
52*f4a2713aSLionel Sambuc // CHECK: t6
53*f4a2713aSLionel Sambuc // CHECK: strcat
54*f4a2713aSLionel Sambuc 
t7(char * x)55*f4a2713aSLionel Sambuc char *t7(char *x) { return strncat(x, "", 1); }
56*f4a2713aSLionel Sambuc // CHECK: t7
57*f4a2713aSLionel Sambuc // CHECK: strncat
58*f4a2713aSLionel Sambuc 
t8(void)59*f4a2713aSLionel Sambuc char *t8(void) { return strchr("hello, world", 'w'); }
60*f4a2713aSLionel Sambuc // CHECK: t8
61*f4a2713aSLionel Sambuc // CHECK: strchr
62*f4a2713aSLionel Sambuc 
t9(void)63*f4a2713aSLionel Sambuc char *t9(void) { return strrchr("hello, world", 'w'); }
64*f4a2713aSLionel Sambuc // CHECK: t9
65*f4a2713aSLionel Sambuc // CHECK: strrchr
66*f4a2713aSLionel Sambuc 
t10(void)67*f4a2713aSLionel Sambuc int t10(void) { return strcmp("foo", "bar"); }
68*f4a2713aSLionel Sambuc // CHECK: t10
69*f4a2713aSLionel Sambuc // CHECK: strcmp
70*f4a2713aSLionel Sambuc 
t11(void)71*f4a2713aSLionel Sambuc int t11(void) { return strncmp("foo", "bar", 3); }
72*f4a2713aSLionel Sambuc // CHECK: t11
73*f4a2713aSLionel Sambuc // CHECK: strncmp
74*f4a2713aSLionel Sambuc 
t12(char * x)75*f4a2713aSLionel Sambuc char *t12(char *x) { return strcpy(x, "foo"); }
76*f4a2713aSLionel Sambuc // CHECK: t12
77*f4a2713aSLionel Sambuc // CHECK: strcpy
78*f4a2713aSLionel Sambuc 
t13(char * x)79*f4a2713aSLionel Sambuc char *t13(char *x) { return stpcpy(x, "foo"); }
80*f4a2713aSLionel Sambuc // CHECK: t13
81*f4a2713aSLionel Sambuc // CHECK: stpcpy
82*f4a2713aSLionel Sambuc 
t14(char * x)83*f4a2713aSLionel Sambuc char *t14(char *x) { return strncpy(x, "foo", 3); }
84*f4a2713aSLionel Sambuc // CHECK: t14
85*f4a2713aSLionel Sambuc // CHECK: strncpy
86*f4a2713aSLionel Sambuc 
t15(void)87*f4a2713aSLionel Sambuc size_t t15(void) { return strlen("foo"); }
88*f4a2713aSLionel Sambuc // CHECK: t15
89*f4a2713aSLionel Sambuc // CHECK: strlen
90*f4a2713aSLionel Sambuc 
t16(char * x)91*f4a2713aSLionel Sambuc char *t16(char *x) { return strpbrk(x, ""); }
92*f4a2713aSLionel Sambuc // CHECK: t16
93*f4a2713aSLionel Sambuc // CHECK: strpbrk
94*f4a2713aSLionel Sambuc 
t17(char * x)95*f4a2713aSLionel Sambuc size_t t17(char *x) { return strspn(x, ""); }
96*f4a2713aSLionel Sambuc // CHECK: t17
97*f4a2713aSLionel Sambuc // CHECK: strspn
98*f4a2713aSLionel Sambuc 
t18(char ** x)99*f4a2713aSLionel Sambuc double t18(char **x) { return strtod("123.4", x); }
100*f4a2713aSLionel Sambuc // CHECK: t18
101*f4a2713aSLionel Sambuc // CHECK: strtod
102*f4a2713aSLionel Sambuc 
t19(char ** x)103*f4a2713aSLionel Sambuc float t19(char **x) { return strtof("123.4", x); }
104*f4a2713aSLionel Sambuc // CHECK: t19
105*f4a2713aSLionel Sambuc // CHECK: strtof
106*f4a2713aSLionel Sambuc 
t20(char ** x)107*f4a2713aSLionel Sambuc long double t20(char **x) { return strtold("123.4", x); }
108*f4a2713aSLionel Sambuc // CHECK: t20
109*f4a2713aSLionel Sambuc // CHECK: strtold
110*f4a2713aSLionel Sambuc 
t21(char ** x)111*f4a2713aSLionel Sambuc long int t21(char **x) { return strtol("1234", x, 10); }
112*f4a2713aSLionel Sambuc // CHECK: t21
113*f4a2713aSLionel Sambuc // CHECK: strtol
114*f4a2713aSLionel Sambuc 
t22(char ** x)115*f4a2713aSLionel Sambuc long int t22(char **x) { return strtoll("1234", x, 10); }
116*f4a2713aSLionel Sambuc // CHECK: t22
117*f4a2713aSLionel Sambuc // CHECK: strtoll
118*f4a2713aSLionel Sambuc 
t23(char ** x)119*f4a2713aSLionel Sambuc long int t23(char **x) { return strtoul("1234", x, 10); }
120*f4a2713aSLionel Sambuc // CHECK: t23
121*f4a2713aSLionel Sambuc // CHECK: strtoul
122*f4a2713aSLionel Sambuc 
t24(char ** x)123*f4a2713aSLionel Sambuc long int t24(char **x) { return strtoull("1234", x, 10); }
124*f4a2713aSLionel Sambuc // CHECK: t24
125*f4a2713aSLionel Sambuc // CHECK: strtoull
126