summaryrefslogtreecommitdiffstats
path: root/test/CodeGen
diff options
context:
space:
mode:
Diffstat (limited to 'test/CodeGen')
-rw-r--r--test/CodeGen/annotate.c8
-rw-r--r--test/CodeGen/complex.c32
-rw-r--r--test/CodeGen/ext-vector.c11
-rw-r--r--test/CodeGen/libcalls.c4
-rw-r--r--test/CodeGen/object-size.c46
5 files changed, 79 insertions, 22 deletions
diff --git a/test/CodeGen/annotate.c b/test/CodeGen/annotate.c
new file mode 100644
index 0000000..84d564a
--- /dev/null
+++ b/test/CodeGen/annotate.c
@@ -0,0 +1,8 @@
+// RUN: %clang_cc1 %s -emit-llvm -o - | FileCheck %s
+
+__attribute((annotate("foo"))) char foo;
+void a(char *a) {
+ __attribute__((annotate("bar"))) static char bar;
+}
+
+// CHECK: @llvm.global.annotations = appending global [2 x %0]
diff --git a/test/CodeGen/complex.c b/test/CodeGen/complex.c
index 8d9c68d..ca60610 100644
--- a/test/CodeGen/complex.c
+++ b/test/CodeGen/complex.c
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -emit-llvm < %s
+// RUN: %clang_cc1 -emit-llvm-only %s
int main(void)
{
@@ -39,6 +39,25 @@ void test3() {
g1 = D + g1;
}
+__complex__ int ci1, ci2;
+__complex__ short cs;
+int i;
+void test3int() {
+ ci1 = ci1 + ci2;
+ ci1 = ci1 - ci2;
+ ci1 = ci1 * ci2;
+ ci1 = +-~ci1;
+
+ i = __real ci1;
+
+ cs += i;
+ // FIXME: Currently unsupported!
+ //D += cf;
+ cs /= ci1;
+ ci1 = ci1 + i;
+ ci1 = i + ci1;
+}
+
void t1() {
(__real__ cf) = 4.0;
}
@@ -59,3 +78,14 @@ void t5() {
float _Complex x = t4();
}
+void t6() {
+ g1++;
+ g1--;
+ ++g1;
+ --g1;
+ ci1++;
+ ci1--;
+ ++ci1;
+ --ci1;
+}
+
diff --git a/test/CodeGen/ext-vector.c b/test/CodeGen/ext-vector.c
index 6215323..daa1826 100644
--- a/test/CodeGen/ext-vector.c
+++ b/test/CodeGen/ext-vector.c
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -emit-llvm %s -o %t
+// RUN: %clang_cc1 -emit-llvm-only %s
typedef __attribute__(( ext_vector_type(4) )) float float4;
typedef __attribute__(( ext_vector_type(2) )) float float2;
@@ -151,3 +151,12 @@ int4 test11a();
int test11() {
return test11a().x;
}
+
+int4 test12(int4 V) {
+ V.xyz = V.zyx;
+ return V;
+}
+
+int4 test13(int4 *V) {
+ return V->zyxw;
+}
diff --git a/test/CodeGen/libcalls.c b/test/CodeGen/libcalls.c
index fe12f4a..a96176a 100644
--- a/test/CodeGen/libcalls.c
+++ b/test/CodeGen/libcalls.c
@@ -1,7 +1,7 @@
-// RUN: %clang_cc1 -emit-llvm -o %t %s -triple i386-unknown-unknown
+// RUN: %clang_cc1 -fmath-errno -emit-llvm -o %t %s -triple i386-unknown-unknown
// RUN: grep "declare " %t | count 6
// RUN: grep "declare " %t | grep "@llvm." | count 1
-// RUN: %clang_cc1 -fno-math-errno -emit-llvm -o %t %s -triple i386-unknown-unknown
+// RUN: %clang_cc1 -emit-llvm -o %t %s -triple i386-unknown-unknown
// RUN: grep "declare " %t | count 6
// RUN: grep "declare " %t | grep -v "@llvm." | count 0
diff --git a/test/CodeGen/object-size.c b/test/CodeGen/object-size.c
index 4947c19..3920ec5 100644
--- a/test/CodeGen/object-size.c
+++ b/test/CodeGen/object-size.c
@@ -14,98 +14,108 @@ char *gp;
int gi, gj;
void test1() {
- // CHECK: %call = call i8* @__strcpy_chk(i8* getelementptr inbounds ([63 x i8]* @gbuf, i32 0, i64 4), i8* getelementptr inbounds ([9 x i8]* @.str, i32 0, i32 0), i64 59)
+ // CHECK: = call i8* @__strcpy_chk(i8* getelementptr inbounds ([63 x i8]* @gbuf, i32 0, i64 4), i8* getelementptr inbounds ([9 x i8]* @.str, i32 0, i32 0), i64 59)
strcpy(&gbuf[4], "Hi there");
}
void test2() {
- // CHECK: %call = call i8* @__strcpy_chk(i8* getelementptr inbounds ([63 x i8]* @gbuf, i32 0, i32 0), i8* getelementptr inbounds ([9 x i8]* @.str, i32 0, i32 0), i64 63)
+ // CHECK: = call i8* @__strcpy_chk(i8* getelementptr inbounds ([63 x i8]* @gbuf, i32 0, i32 0), i8* getelementptr inbounds ([9 x i8]* @.str, i32 0, i32 0), i64 63)
strcpy(gbuf, "Hi there");
}
void test3() {
- // CHECK: %call = call i8* @__strcpy_chk(i8* getelementptr inbounds ([63 x i8]* @gbuf, i64 1, i64 37), i8* getelementptr inbounds ([9 x i8]* @.str, i32 0, i32 0), i64 0)
+ // CHECK: = call i8* @__strcpy_chk(i8* getelementptr inbounds ([63 x i8]* @gbuf, i64 1, i64 37), i8* getelementptr inbounds ([9 x i8]* @.str, i32 0, i32 0), i64 0)
strcpy(&gbuf[100], "Hi there");
}
void test4() {
- // CHECK: %call = call i8* @__strcpy_chk(i8* getelementptr inbounds ([63 x i8]* @gbuf, i32 0, i64 -1), i8* getelementptr inbounds ([9 x i8]* @.str, i32 0, i32 0), i64 0)
+ // CHECK: = call i8* @__strcpy_chk(i8* getelementptr inbounds ([63 x i8]* @gbuf, i32 0, i64 -1), i8* getelementptr inbounds ([9 x i8]* @.str, i32 0, i32 0), i64 0)
strcpy((char*)(void*)&gbuf[-1], "Hi there");
}
void test5() {
- // CHECK: %tmp = load i8** @gp
- // CHECK-NEXT:%0 = call i64 @llvm.objectsize.i64(i8* %tmp, i1 false)
- // CHECK-NEXT:%cmp = icmp ne i64 %0, -1
+ // CHECK: = load i8** @gp
+ // CHECK-NEXT:= call i64 @llvm.objectsize.i64(i8* %{{.*}}, i1 false)
strcpy(gp, "Hi there");
}
void test6() {
char buf[57];
- // CHECK: %call = call i8* @__strcpy_chk(i8* %arrayidx, i8* getelementptr inbounds ([9 x i8]* @.str, i32 0, i32 0), i64 53)
+ // CHECK: = call i8* @__strcpy_chk(i8* %{{.*}}, i8* getelementptr inbounds ([9 x i8]* @.str, i32 0, i32 0), i64 53)
strcpy(&buf[4], "Hi there");
}
void test7() {
int i;
// CHECK-NOT: __strcpy_chk
- // CHECK: %call = call i8* @__inline_strcpy_chk(i8* getelementptr inbounds ([63 x i8]* @gbuf, i32 0, i32 0), i8* getelementptr inbounds ([9 x i8]* @.str, i32 0, i32 0))
+ // CHECK: = call i8* @__inline_strcpy_chk(i8* getelementptr inbounds ([63 x i8]* @gbuf, i32 0, i32 0), i8* getelementptr inbounds ([9 x i8]* @.str, i32 0, i32 0))
strcpy((++i, gbuf), "Hi there");
}
void test8() {
char *buf[50];
// CHECK-NOT: __strcpy_chk
- // CHECK: %call = call i8* @__inline_strcpy_chk(i8* %tmp1, i8* getelementptr inbounds ([9 x i8]* @.str, i32 0, i32 0))
+ // CHECK: = call i8* @__inline_strcpy_chk(i8* %{{.*}}, i8* getelementptr inbounds ([9 x i8]* @.str, i32 0, i32 0))
strcpy(buf[++gi], "Hi there");
}
void test9() {
// CHECK-NOT: __strcpy_chk
- // CHECK: %call = call i8* @__inline_strcpy_chk(i8* %0, i8* getelementptr inbounds ([9 x i8]* @.str, i32 0, i32 0))
+ // CHECK: = call i8* @__inline_strcpy_chk(i8* %{{.*}}, i8* getelementptr inbounds ([9 x i8]* @.str, i32 0, i32 0))
strcpy((char *)((++gi) + gj), "Hi there");
}
char **p;
void test10() {
// CHECK-NOT: __strcpy_chk
- // CHECK: %call = call i8* @__inline_strcpy_chk(i8* %tmp1, i8* getelementptr inbounds ([9 x i8]* @.str, i32 0, i32 0))
+ // CHECK: = call i8* @__inline_strcpy_chk(i8* %{{.*}}, i8* getelementptr inbounds ([9 x i8]* @.str, i32 0, i32 0))
strcpy(*(++p), "Hi there");
}
void test11() {
// CHECK-NOT: __strcpy_chk
- // CHECK: %call = call i8* @__inline_strcpy_chk(i8* %tmp, i8* getelementptr inbounds ([9 x i8]* @.str, i32 0, i32 0))
+ // CHECK: = call i8* @__inline_strcpy_chk(i8* %{{.*}}, i8* getelementptr inbounds ([9 x i8]* @.str, i32 0, i32 0))
strcpy(gp = gbuf, "Hi there");
}
void test12() {
// CHECK-NOT: __strcpy_chk
- // CHECK: %call = call i8* @__inline_strcpy_chk(i8* %ptrincdec, i8* getelementptr inbounds ([9 x i8]* @.str, i32 0, i32 0))
+ // CHECK: = call i8* @__inline_strcpy_chk(i8* %{{.*}}, i8* getelementptr inbounds ([9 x i8]* @.str, i32 0, i32 0))
strcpy(++gp, "Hi there");
}
void test13() {
// CHECK-NOT: __strcpy_chk
- // CHECK: %call = call i8* @__inline_strcpy_chk(i8* %tmp, i8* getelementptr inbounds ([9 x i8]* @.str, i32 0, i32 0))
+ // CHECK: = call i8* @__inline_strcpy_chk(i8* %{{.*}}, i8* getelementptr inbounds ([9 x i8]* @.str, i32 0, i32 0))
strcpy(gp++, "Hi there");
}
void test14() {
// CHECK-NOT: __strcpy_chk
- // CHECK: %call = call i8* @__inline_strcpy_chk(i8* %ptrincdec, i8* getelementptr inbounds ([9 x i8]* @.str, i32 0, i32 0))
+ // CHECK: = call i8* @__inline_strcpy_chk(i8* %{{.*}}, i8* getelementptr inbounds ([9 x i8]* @.str, i32 0, i32 0))
strcpy(--gp, "Hi there");
}
void test15() {
// CHECK-NOT: __strcpy_chk
- // CHECK: %call = call i8* @__inline_strcpy_chk(i8* %tmp, i8* getelementptr inbounds ([9 x i8]* @.str, i32 0, i32 0))
+ // CHECK: = call i8* @__inline_strcpy_chk(i8* %{{..*}}, i8* getelementptr inbounds ([9 x i8]* @.str, i32 0, i32 0))
strcpy(gp--, "Hi there");
}
void test16() {
// CHECK-NOT: __strcpy_chk
- // CHECK: %call = call i8* @__inline_strcpy_chk(i8* %tmp1, i8* getelementptr inbounds ([9 x i8]* @.str, i32 0, i32 0))
+ // CHECK: = call i8* @__inline_strcpy_chk(i8* %{{.*}}, i8* getelementptr inbounds ([9 x i8]* @.str, i32 0, i32 0))
strcpy(gp += 1, "Hi there");
}
+
+void test17() {
+ // CHECK: store i32 -1
+ gi = __builtin_object_size(gp++, 0);
+ // CHECK: store i32 -1
+ gi = __builtin_object_size(gp++, 1);
+ // CHECK: store i32 0
+ gi = __builtin_object_size(gp++, 2);
+ // CHECK: store i32 0
+ gi = __builtin_object_size(gp++, 3);
+}
OpenPOWER on IntegriCloud