]> granicus.if.org Git - clang/commitdiff
Migrate libcalls-fno-builtin.c test from checking optimized assembly
authorEric Christopher <echristo@gmail.com>
Thu, 24 May 2018 06:00:50 +0000 (06:00 +0000)
committerEric Christopher <echristo@gmail.com>
Thu, 24 May 2018 06:00:50 +0000 (06:00 +0000)
to checking for attributes on the call site - and fix up builtin
functions that we were testing for but not ensuring wouldn't be
optimized by the backend.

Leave one set of asm tests to make sure that we're also communicating
builtin-ness to TLI.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@333154 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/Basic/Builtins.def
test/CodeGen/libcalls-fno-builtin.c

index f4601c4dd1ac2eea8ad74bd6208bc5419be99b5c..da23f928949f9e963881063a7a2f4991adc1d711 100644 (file)
@@ -817,6 +817,13 @@ LIBBUILTIN(exit, "vi",            "fr",    "stdlib.h", ALL_LANGUAGES)
 LIBBUILTIN(_Exit, "vi",           "fr",    "stdlib.h", ALL_LANGUAGES)
 LIBBUILTIN(malloc, "v*z",         "f",     "stdlib.h", ALL_LANGUAGES)
 LIBBUILTIN(realloc, "v*v*z",      "f",     "stdlib.h", ALL_LANGUAGES)
+LIBBUILTIN(strtod, "dcC*c**",     "f",     "stdlib.h", ALL_LANGUAGES)
+LIBBUILTIN(strtof, "fcC*c**",     "f",     "stdlib.h", ALL_LANGUAGES)
+LIBBUILTIN(strtold, "LdcC*c**",   "f",     "stdlib.h", ALL_LANGUAGES)
+LIBBUILTIN(strtol, "LicC*c**i",   "f",     "stdlib.h", ALL_LANGUAGES)
+LIBBUILTIN(strtoll, "LLicC*c**i", "f",     "stdlib.h", ALL_LANGUAGES)
+LIBBUILTIN(strtoul, "ULicC*c**i", "f",     "stdlib.h", ALL_LANGUAGES)
+LIBBUILTIN(strtoull, "ULLicC*c**i", "f",   "stdlib.h", ALL_LANGUAGES)
 // C99 string.h
 LIBBUILTIN(memcpy, "v*v*vC*z",    "f",     "string.h", ALL_LANGUAGES)
 LIBBUILTIN(memcmp, "ivC*vC*z",    "f",     "string.h", ALL_LANGUAGES)
index bc6a4302b01c4027f2698d7ff62c43a91f30fdfa..8515e1d1233370ac27018b7f2adb88b7704518d7 100644 (file)
@@ -1,11 +1,13 @@
-// RUN: %clang_cc1 -S -O3 -fno-builtin -o - %s | FileCheck %s
-// RUN: %clang_cc1 -S -O3 -fno-builtin-ceil -fno-builtin-copysign -fno-builtin-cos \
+// RUN: %clang_cc1 -S -emit-llvm -fno-builtin -o - %s | FileCheck %s
+// RUN: %clang_cc1 -S -emit-llvm -fno-builtin-ceil -fno-builtin-copysign -fno-builtin-cos \
 // RUN:  -fno-builtin-fabs -fno-builtin-floor -fno-builtin-strcat -fno-builtin-strncat \
 // RUN:  -fno-builtin-strchr -fno-builtin-strrchr -fno-builtin-strcmp -fno-builtin-strncmp \
 // RUN:  -fno-builtin-strcpy -fno-builtin-stpcpy -fno-builtin-strncpy -fno-builtin-strlen \
 // RUN:  -fno-builtin-strpbrk -fno-builtin-strspn -fno-builtin-strtod -fno-builtin-strtof \
 // RUN:  -fno-builtin-strtold -fno-builtin-strtol -fno-builtin-strtoll -fno-builtin-strtoul \
 // RUN:  -fno-builtin-strtoull -o - %s | FileCheck %s
+// RUN: %clang_cc1 -S -O3 -fno-builtin -o - %s | FileCheck --check-prefix=ASM %s
+// RUN: %clang_cc1 -S -O3 -fno-builtin-ceil -o - %s | FileCheck --check-prefix=ASM-INDIV %s
 // rdar://10551066
 
 typedef __SIZE_TYPE__ size_t;
@@ -36,97 +38,105 @@ 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
-// CHECK: ceil
+// CHECK-LABEL: t1
+// CHECK: call{{.*}}@ceil{{.*}} [[ATTR:#[0-9]+]]
+
+// ASM: t1
+// ASM: ceil
+
+// ASM-INDIV: t1
+// ASM-INDIV: ceil
 
 double t2(double x, double y) { return copysign(x,y); }
-// CHECK: t2
-// CHECK: copysign
+// CHECK-LABEL: t2
+// CHECK: call{{.*}}@copysign{{.*}} [[ATTR]]
 
 double t3(double x) { return cos(x); }
-// CHECK: t3
-// CHECK: cos
+// CHECK-LABEL: t3
+// CHECK: call{{.*}}@cos{{.*}} [[ATTR]]
 
 double t4(double x) { return fabs(x); }
-// CHECK: t4
-// CHECK: fabs
+// CHECK-LABEL: t4
+// CHECK: call{{.*}}@fabs{{.*}} [[ATTR]]
 
 double t5(double x) { return floor(x); }
-// CHECK: t5
-// CHECK: floor
+// CHECK-LABEL: t5
+// CHECK: call{{.*}}@floor{{.*}} [[ATTR]]
 
 char *t6(char *x) { return strcat(x, ""); }
-// CHECK: t6
-// CHECK: strcat
+// CHECK-LABEL: t6
+// CHECK: call{{.*}}@strcat{{.*}} [[ATTR]]
 
 char *t7(char *x) { return strncat(x, "", 1); }
-// CHECK: t7
-// CHECK: strncat
+// CHECK-LABEL: t7
+// CHECK: call{{.*}}@strncat{{.*}} [[ATTR]]
 
 char *t8(void) { return strchr("hello, world", 'w'); }
-// CHECK: t8
-// CHECK: strchr
+// CHECK-LABEL: t8
+// CHECK: call{{.*}}@strchr{{.*}} [[ATTR]]
 
 char *t9(void) { return strrchr("hello, world", 'w'); }
-// CHECK: t9
-// CHECK: strrchr
+// CHECK-LABEL: t9
+// CHECK: call{{.*}}@strrchr{{.*}} [[ATTR]]
 
 int t10(void) { return strcmp("foo", "bar"); }
-// CHECK: t10
-// CHECK: strcmp
+// CHECK-LABEL: t10
+// CHECK: call{{.*}}@strcmp{{.*}} [[ATTR]]
 
 int t11(void) { return strncmp("foo", "bar", 3); }
-// CHECK: t11
-// CHECK: strncmp
+// CHECK-LABEL: t11
+// CHECK: call{{.*}}@strncmp{{.*}} [[ATTR]]
 
 char *t12(char *x) { return strcpy(x, "foo"); }
-// CHECK: t12
-// CHECK: strcpy
+// CHECK-LABEL: t12
+// CHECK: call{{.*}}@strcpy{{.*}} [[ATTR]]
 
 char *t13(char *x) { return stpcpy(x, "foo"); }
-// CHECK: t13
-// CHECK: stpcpy
+// CHECK-LABEL: t13
+// CHECK: call{{.*}}@stpcpy{{.*}} [[ATTR]]
 
 char *t14(char *x) { return strncpy(x, "foo", 3); }
-// CHECK: t14
-// CHECK: strncpy
+// CHECK-LABEL: t14
+// CHECK: call{{.*}}@strncpy{{.*}} [[ATTR]]
 
 size_t t15(void) { return strlen("foo"); }
-// CHECK: t15
-// CHECK: strlen
+// CHECK-LABEL: t15
+// CHECK: call{{.*}}@strlen{{.*}} [[ATTR]]
 
 char *t16(char *x) { return strpbrk(x, ""); }
-// CHECK: t16
-// CHECK: strpbrk
+// CHECK-LABEL: t16
+// CHECK: call{{.*}}@strpbrk{{.*}} [[ATTR]]
 
 size_t t17(char *x) { return strspn(x, ""); }
-// CHECK: t17
-// CHECK: strspn
+// CHECK-LABEL: t17
+// CHECK: call{{.*}}@strspn{{.*}} [[ATTR]]
 
 double t18(char **x) { return strtod("123.4", x); }
-// CHECK: t18
-// CHECK: strtod
+// CHECK-LABEL: t18
+// CHECK: call{{.*}}@strtod{{.*}} [[ATTR]]
 
 float t19(char **x) { return strtof("123.4", x); }
-// CHECK: t19
-// CHECK: strtof
+// CHECK-LABEL: t19
+// CHECK: call{{.*}}@strtof{{.*}} [[ATTR]]
 
 long double t20(char **x) { return strtold("123.4", x); }
-// CHECK: t20
-// CHECK: strtold
+// CHECK-LABEL: t20
+// CHECK: call{{.*}}@strtold{{.*}} [[ATTR]]
 
 long int t21(char **x) { return strtol("1234", x, 10); }
-// CHECK: t21
-// CHECK: strtol
+// CHECK-LABEL: t21
+// CHECK: call{{.*}}@strtol{{.*}} [[ATTR]]
 
 long int t22(char **x) { return strtoll("1234", x, 10); }
-// CHECK: t22
-// CHECK: strtoll
+// CHECK-LABEL: t22
+// CHECK: call{{.*}}@strtoll{{.*}} [[ATTR]]
 
 long int t23(char **x) { return strtoul("1234", x, 10); }
-// CHECK: t23
-// CHECK: strtoul
+// CHECK-LABEL: t23
+// CHECK: call{{.*}}@strtoul{{.*}} [[ATTR]]
 
 long int t24(char **x) { return strtoull("1234", x, 10); }
-// CHECK: t24
-// CHECK: strtoull
+// CHECK-LABEL: t24
+// CHECK: call{{.*}}@strtoull{{.*}} [[ATTR]]
+
+// CHECK: [[ATTR]] = { nobuiltin }