From 6c801b66fed0da4ab9bb6a7967bffc7e7d9ea970 Mon Sep 17 00:00:00 2001 From: Meador Inge Date: Sat, 10 Nov 2012 03:56:55 +0000 Subject: Add a few more test cases for verifying -fno-builtin. Some holes in testing where discovered while working on the LLVM library call simplifiers. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167661 91177308-0d34-0410-b5e6-96231b3b80d8 --- test/CodeGen/libcalls-fno-builtin.c | 97 +++++++++++++++++++++++++++++++++++++ 1 file changed, 97 insertions(+) diff --git a/test/CodeGen/libcalls-fno-builtin.c b/test/CodeGen/libcalls-fno-builtin.c index ce10759b0c..e7f3ef7b41 100644 --- a/test/CodeGen/libcalls-fno-builtin.c +++ b/test/CodeGen/libcalls-fno-builtin.c @@ -1,11 +1,32 @@ // RUN: %clang_cc1 -S -O3 -fno-builtin -o - %s | FileCheck %s // rdar://10551066 +typedef __SIZE_TYPE__ size_t; + double ceil(double x); double copysign(double,double); double cos(double x); double fabs(double x); double floor(double x); +char *strcat(char *s1, const char *s2); +char *strncat(char *s1, const char *s2, size_t n); +char *strchr(const char *s, int c); +char *strrchr(const char *s, int c); +int strcmp(const char *s1, const char *s2); +int strncmp(const char *s1, const char *s2, size_t n); +char *strcpy(char *s1, const char *s2); +char *stpcpy(char *s1, const char *s2); +char *strncpy(char *s1, const char *s2, size_t n); +size_t strlen(const char *s); +char *strpbrk(const char *s1, const char *s2); +size_t strspn(const char *s1, const char *s2); +double strtod(const char *nptr, char **endptr); +float strtof(const char *nptr, char **endptr); +long double strtold(const char *nptr, char **endptr); +long int strtol(const char *nptr, char **endptr, int base); +long long int strtoll(const char *nptr, char **endptr, int base); +unsigned long int strtoul(const char *nptr, char **endptr, int base); +unsigned long long int strtoull(const char *nptr, char **endptr, int base); double t1(double x) { return ceil(x); } // CHECK: t1 @@ -26,3 +47,79 @@ double t4(double x) { return fabs(x); } double t5(double x) { return floor(x); } // CHECK: t5 // CHECK: floor + +char *t6(char *x) { return strcat(x, ""); } +// CHECK: t6 +// CHECK: strcat + +char *t7(char *x) { return strncat(x, "", 1); } +// CHECK: t7 +// CHECK: strncat + +char *t8(void) { return strchr("hello, world", 'w'); } +// CHECK: t8 +// CHECK: strchr + +char *t9(void) { return strrchr("hello, world", 'w'); } +// CHECK: t9 +// CHECK: strrchr + +int t10(void) { return strcmp("foo", "bar"); } +// CHECK: t10 +// CHECK: strcmp + +int t11(void) { return strncmp("foo", "bar", 3); } +// CHECK: t11 +// CHECK: strncmp + +char *t12(char *x) { return strcpy(x, "foo"); } +// CHECK: t12 +// CHECK: strcpy + +char *t13(char *x) { return stpcpy(x, "foo"); } +// CHECK: t13 +// CHECK: stpcpy + +char *t14(char *x) { return strncpy(x, "foo", 3); } +// CHECK: t14 +// CHECK: strncpy + +size_t t15(void) { return strlen("foo"); } +// CHECK: t15 +// CHECK: strlen + +char *t16(char *x) { return strpbrk(x, ""); } +// CHECK: t16 +// CHECK: strpbrk + +size_t t17(char *x) { return strspn(x, ""); } +// CHECK: t17 +// CHECK: strspn + +double t18(char **x) { return strtod("123.4", x); } +// CHECK: t18 +// CHECK: strtod + +float t19(char **x) { return strtof("123.4", x); } +// CHECK: t19 +// CHECK: strtof + +long double t20(char **x) { return strtold("123.4", x); } +// CHECK: t20 +// CHECK: strtold + +long int t21(char **x) { return strtol("1234", x, 10); } +// CHECK: t21 +// CHECK: strtol + +long int t22(char **x) { return strtoll("1234", x, 10); } +// CHECK: t22 +// CHECK: strtoll + +long int t23(char **x) { return strtoul("1234", x, 10); } +// CHECK: t23 +// CHECK: strtoul + +long int t24(char **x) { return strtoull("1234", x, 10); } +// CHECK: t24 +// CHECK: strtoull -- cgit v1.2.3