summaryrefslogtreecommitdiffstats
path: root/test/CodeGen
diff options
context:
space:
mode:
Diffstat (limited to 'test/CodeGen')
-rw-r--r--test/CodeGen/2008-07-17-no-emit-on-error.c4
-rw-r--r--test/CodeGen/2008-07-22-bitfield-init-after-zero-len-array.c2
-rw-r--r--test/CodeGen/2008-07-30-implicit-initialization.c2
-rw-r--r--test/CodeGen/2008-07-30-redef-of-bitcasted-decl.c2
-rw-r--r--test/CodeGen/2008-08-04-void-pointer-arithmetic.c2
-rw-r--r--test/CodeGen/2008-08-19-cast-of-typedef.c2
-rw-r--r--test/CodeGen/PR2001-bitfield-reload.c5
-rw-r--r--test/CodeGen/arm-arguments.c4
-rw-r--r--test/CodeGen/builtins-ffs_parity_popcount.c15
-rw-r--r--test/CodeGen/builtins-powi.c28
-rw-r--r--test/CodeGen/const-init.c4
-rw-r--r--test/CodeGen/debug-info.c2
-rw-r--r--test/CodeGen/flexible-array-init.c7
-rw-r--r--test/CodeGen/func-return-member.c5
-rw-r--r--test/CodeGen/incomplete-function-type.c6
-rw-r--r--test/CodeGen/rdr-6098585-default-after-caserange.c2
-rw-r--r--test/CodeGen/rdr-6098585-default-fallthrough-to-caserange.c2
-rw-r--r--test/CodeGen/rdr-6098585-empty-case-range.c2
-rw-r--r--test/CodeGen/rdr-6098585-fallthrough-to-empty-range.c2
-rw-r--r--test/CodeGen/rdr-6098585-unsigned-caserange.c2
-rw-r--r--test/CodeGen/stack-protector.c6
-rw-r--r--test/CodeGen/static-order.c5
-rw-r--r--test/CodeGen/switch.c27
-rw-r--r--test/CodeGen/vector.c2
-rw-r--r--test/CodeGen/visibility.c6
25 files changed, 65 insertions, 81 deletions
diff --git a/test/CodeGen/2008-07-17-no-emit-on-error.c b/test/CodeGen/2008-07-17-no-emit-on-error.c
index fbff541..6266b50 100644
--- a/test/CodeGen/2008-07-17-no-emit-on-error.c
+++ b/test/CodeGen/2008-07-17-no-emit-on-error.c
@@ -1,10 +1,14 @@
// RUN: rm -f %t1.bc
+// RUN: clang-cc -DPASS %s -emit-llvm-bc -o %t1.bc
+// RUN: test -f %t1.bc
// RUN: not clang-cc %s -emit-llvm-bc -o %t1.bc
// RUN: not test -f %t1.bc
void f() {
}
+#ifndef PASS
void g() {
*10;
}
+#endif
diff --git a/test/CodeGen/2008-07-22-bitfield-init-after-zero-len-array.c b/test/CodeGen/2008-07-22-bitfield-init-after-zero-len-array.c
index db3c4b2..4aa28f8 100644
--- a/test/CodeGen/2008-07-22-bitfield-init-after-zero-len-array.c
+++ b/test/CodeGen/2008-07-22-bitfield-init-after-zero-len-array.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -triple=i686-apple-darwin9 --emit-llvm -o - %s | FileCheck %s
+// RUN: clang-cc -triple=i686-apple-darwin9 -emit-llvm -o - %s | FileCheck %s
struct et7 {
float lv7[0];
diff --git a/test/CodeGen/2008-07-30-implicit-initialization.c b/test/CodeGen/2008-07-30-implicit-initialization.c
index 9cd5300..b225a14 100644
--- a/test/CodeGen/2008-07-30-implicit-initialization.c
+++ b/test/CodeGen/2008-07-30-implicit-initialization.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -triple i386-unknown-unknown --emit-llvm-bc -o - %s | opt --std-compile-opts | llvm-dis > %t
+// RUN: clang-cc -triple i386-unknown-unknown -emit-llvm-bc -o - %s | opt --std-compile-opts | llvm-dis > %t
// RUN: grep "ret i32" %t | count 2
// RUN: grep "ret i32 0" %t | count 2
// <rdar://problem/6113085>
diff --git a/test/CodeGen/2008-07-30-redef-of-bitcasted-decl.c b/test/CodeGen/2008-07-30-redef-of-bitcasted-decl.c
index c374f8d..9fce0ae 100644
--- a/test/CodeGen/2008-07-30-redef-of-bitcasted-decl.c
+++ b/test/CodeGen/2008-07-30-redef-of-bitcasted-decl.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc --emit-llvm -o - %s
+// RUN: clang-cc -emit-llvm -o - %s
// <rdar://problem/6108358>
/* For posterity, the issue here begins initial "char []" decl for
diff --git a/test/CodeGen/2008-08-04-void-pointer-arithmetic.c b/test/CodeGen/2008-08-04-void-pointer-arithmetic.c
index 22815f3..bd4d8f8 100644
--- a/test/CodeGen/2008-08-04-void-pointer-arithmetic.c
+++ b/test/CodeGen/2008-08-04-void-pointer-arithmetic.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc --emit-llvm -o - %s
+// RUN: clang-cc -emit-llvm -o - %s
// <rdar://problem/6122967>
int f0(void *a, void *b) {
diff --git a/test/CodeGen/2008-08-19-cast-of-typedef.c b/test/CodeGen/2008-08-19-cast-of-typedef.c
index 3db5e90..3435384 100644
--- a/test/CodeGen/2008-08-19-cast-of-typedef.c
+++ b/test/CodeGen/2008-08-19-cast-of-typedef.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc --emit-llvm -o %t %s
+// RUN: clang-cc -emit-llvm -o %t %s
typedef short T[4];
struct s {
diff --git a/test/CodeGen/PR2001-bitfield-reload.c b/test/CodeGen/PR2001-bitfield-reload.c
index 1fef3c5..4dec65f 100644
--- a/test/CodeGen/PR2001-bitfield-reload.c
+++ b/test/CodeGen/PR2001-bitfield-reload.c
@@ -1,6 +1,4 @@
-// RUN: clang-cc -triple i386-unknown-unknown --emit-llvm-bc -o - %s | opt --std-compile-opts | llvm-dis > %t
-// RUN: grep "ret i32" %t | count 1
-// RUN: grep "ret i32 1" %t | count 1
+// RUN: clang-cc -triple i386-unknown-unknown -O3 -emit-llvm -o - %s | FileCheck %s
// PR2001
/* Test that the result of the assignment properly uses the value *in
@@ -13,5 +11,6 @@ static int foo(int i) {
}
int bar() {
+ // CHECK: ret i32 1
return foo(-5) == -1;
}
diff --git a/test/CodeGen/arm-arguments.c b/test/CodeGen/arm-arguments.c
index 3b2c433..945c1f2 100644
--- a/test/CodeGen/arm-arguments.c
+++ b/test/CodeGen/arm-arguments.c
@@ -1,5 +1,5 @@
-// RUN: clang-cc -triple armv7-apple-darwin9 -target-abi=apcs-gnu -emit-llvm -w -o - %s | FileCheck -check-prefix=APCS-GNU %s
-// RUN: clang-cc -triple armv7-apple-darwin9 -target-abi=aapcs -emit-llvm -w -o - %s | FileCheck -check-prefix=AAPCS %s
+// RUN: clang-cc -triple armv7-apple-darwin9 -target-abi apcs-gnu -emit-llvm -w -o - %s | FileCheck -check-prefix=APCS-GNU %s
+// RUN: clang-cc -triple armv7-apple-darwin9 -target-abi aapcs -emit-llvm -w -o - %s | FileCheck -check-prefix=AAPCS %s
// APCS-GNU: define arm_apcscc signext i8 @f0()
// AAPCS: define arm_aapcscc signext i8 @f0()
diff --git a/test/CodeGen/builtins-ffs_parity_popcount.c b/test/CodeGen/builtins-ffs_parity_popcount.c
deleted file mode 100644
index 74e104b..0000000
--- a/test/CodeGen/builtins-ffs_parity_popcount.c
+++ /dev/null
@@ -1,15 +0,0 @@
-// RUN: clang-cc -emit-llvm -o - %s > %t
-// RUN: not grep "__builtin" %t
-
-#include <stdio.h>
-
-void test(int M, long long N) {
- printf("%d %lld: %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d\n",
- M, N,
- __builtin_ffs(M), __builtin_ffsl(M), __builtin_ffsll(M),
- __builtin_parity(M), __builtin_parityl(M), __builtin_parityll(M),
- __builtin_popcount(M), __builtin_popcountl(M), __builtin_popcountll(M),
- __builtin_ffs(N), __builtin_ffsl(N), __builtin_ffsll(N),
- __builtin_parity(N), __builtin_parityl(N), __builtin_parityll(N),
- __builtin_popcount(N), __builtin_popcountl(N), __builtin_popcountll(N));
-}
diff --git a/test/CodeGen/builtins-powi.c b/test/CodeGen/builtins-powi.c
deleted file mode 100644
index 945ec5d..0000000
--- a/test/CodeGen/builtins-powi.c
+++ /dev/null
@@ -1,28 +0,0 @@
-// RUN: clang-cc -emit-llvm -o - %s > %t
-// RUN: not grep "__builtin" %t
-
-#include <stdio.h>
-#include <stdlib.h>
-
-void test(long double a, int b) {
- printf("%Lf**%d: %08x %08x %016Lx\n",
- a, b,
- __builtin_powi(a, b),
- __builtin_powif(a, b),
- __builtin_powil(a, b)
- );
-}
-
-int main() {
- int i;
-
- test(-1,-1LL);
- test(0,0);
- test(1,1);
-
- for (i=0; i<3; i++) {
- test(random(), i);
- }
-
- return 0;
-}
diff --git a/test/CodeGen/const-init.c b/test/CodeGen/const-init.c
index 06cdde9..5f196ca 100644
--- a/test/CodeGen/const-init.c
+++ b/test/CodeGen/const-init.c
@@ -1,6 +1,6 @@
-// RUN: clang-cc -triple i386-pc-linux-gnu -verify -emit-llvm -o - %s | FileCheck %s
+// RUN: clang-cc -triple i386-pc-linux-gnu -ffreestanding -verify -emit-llvm -o - %s | FileCheck %s
-typedef __INTPTR_TYPE__ intptr_t;
+#include <stdint.h>
// Brace-enclosed string array initializers
char a[] = { "asdf" };
diff --git a/test/CodeGen/debug-info.c b/test/CodeGen/debug-info.c
index 856b919..d7a54d6 100644
--- a/test/CodeGen/debug-info.c
+++ b/test/CodeGen/debug-info.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -o %t --emit-llvm -g %s
+// RUN: clang-cc -o %t -emit-llvm -g %s
// RUN: FileCheck --input-file=%t %s
// PR3023
diff --git a/test/CodeGen/flexible-array-init.c b/test/CodeGen/flexible-array-init.c
index 2f0df90..bf8f057 100644
--- a/test/CodeGen/flexible-array-init.c
+++ b/test/CodeGen/flexible-array-init.c
@@ -1,8 +1,7 @@
-// RUN: clang-cc -triple i386-unknown-unknown -emit-llvm -o - %s | grep 7 | count 1
-// RUN: clang-cc -triple i386-unknown-unknown -emit-llvm -o - %s | grep 11 | count 1
-// RUN: clang-cc -triple i386-unknown-unknown -emit-llvm -o - %s | grep 13 | count 1
-// RUN: clang-cc -triple i386-unknown-unknown -emit-llvm -o - %s | grep 15 | count 1
+// RUN: clang-cc -triple i386-unknown-unknown -emit-llvm -o - %s | FileCheck %s
struct { int x; int y[]; } a = { 1, 7, 11 };
+// CHECK: @a = global %0 { i32 1, [2 x i32] [i32 7, i32 11] }
struct { int x; int y[]; } b = { 1, { 13, 15 } };
+// CHECK: @b = global %0 { i32 1, [2 x i32] [i32 13, i32 15] }
diff --git a/test/CodeGen/func-return-member.c b/test/CodeGen/func-return-member.c
index e6fc562..68a48fc 100644
--- a/test/CodeGen/func-return-member.c
+++ b/test/CodeGen/func-return-member.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -emit-llvm < %s 2>&1 | not grep 'cannot codegen this l-value expression yet'
+// RUN: clang-cc -emit-llvm -o - %s | FileCheck %s
struct frk { float _Complex c; int x; };
struct faz { struct frk f; };
@@ -10,14 +10,17 @@ int X;
struct frk F;
float _Complex C;
+// CHECK: define void @bar
void bar(void) {
X = foo().f.f.x;
}
+// CHECK: define void @bun
void bun(void) {
F = foo().f.f;
}
+// CHECK: define void @ban
void ban(void) {
C = foo().f.f.c;
}
diff --git a/test/CodeGen/incomplete-function-type.c b/test/CodeGen/incomplete-function-type.c
index a641268..c760e04 100644
--- a/test/CodeGen/incomplete-function-type.c
+++ b/test/CodeGen/incomplete-function-type.c
@@ -1,4 +1,7 @@
-// RUN: clang-cc -emit-llvm %s -o - | not grep opaque
+// RUN: clang-cc -emit-llvm -o - %s | FileCheck %s
+// CHECK: ModuleID
+// CHECK-NOT: opaque
+// CHECK: define void @f0
enum teste1 test1f(void), (*test1)(void) = test1f;
struct tests2 test2f(), (*test2)() = test2f;
@@ -8,3 +11,4 @@ enum teste1 { TEST1 };
struct tests2 { int x,y,z,a,b,c,d,e,f,g; };
struct tests3 { float x; };
+void f0() {}
diff --git a/test/CodeGen/rdr-6098585-default-after-caserange.c b/test/CodeGen/rdr-6098585-default-after-caserange.c
index 239383a..2c58548 100644
--- a/test/CodeGen/rdr-6098585-default-after-caserange.c
+++ b/test/CodeGen/rdr-6098585-default-after-caserange.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -triple i386-unknown-unknown --emit-llvm-bc -o - %s | opt -std-compile-opts | llvm-dis > %t
+// RUN: clang-cc -triple i386-unknown-unknown -emit-llvm-bc -o - %s | opt -std-compile-opts | llvm-dis > %t
// RUN: grep "ret i32" %t | count 1
// RUN: grep "ret i32 10" %t | count 1
diff --git a/test/CodeGen/rdr-6098585-default-fallthrough-to-caserange.c b/test/CodeGen/rdr-6098585-default-fallthrough-to-caserange.c
index 39a6bc6..257a9d7 100644
--- a/test/CodeGen/rdr-6098585-default-fallthrough-to-caserange.c
+++ b/test/CodeGen/rdr-6098585-default-fallthrough-to-caserange.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -triple i386-unknown-unknown --emit-llvm-bc -o - %s | opt -std-compile-opts | llvm-dis > %t
+// RUN: clang-cc -triple i386-unknown-unknown -emit-llvm-bc -o - %s | opt -std-compile-opts | llvm-dis > %t
// RUN: grep "ret i32 10" %t
// Ensure that this doesn't compile to infinite loop in g() due to
diff --git a/test/CodeGen/rdr-6098585-empty-case-range.c b/test/CodeGen/rdr-6098585-empty-case-range.c
index f80b599..2dd1eaa 100644
--- a/test/CodeGen/rdr-6098585-empty-case-range.c
+++ b/test/CodeGen/rdr-6098585-empty-case-range.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -triple i386-unknown-unknown --emit-llvm-bc -o - %s | opt -std-compile-opts | llvm-dis > %t
+// RUN: clang-cc -triple i386-unknown-unknown -emit-llvm-bc -o - %s | opt -std-compile-opts | llvm-dis > %t
// RUN: grep "ret i32" %t | count 2
// RUN: grep "ret i32 3" %t | count 2
diff --git a/test/CodeGen/rdr-6098585-fallthrough-to-empty-range.c b/test/CodeGen/rdr-6098585-fallthrough-to-empty-range.c
index 6c51a37..c12cf82 100644
--- a/test/CodeGen/rdr-6098585-fallthrough-to-empty-range.c
+++ b/test/CodeGen/rdr-6098585-fallthrough-to-empty-range.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -triple i386-unknown-unknown --emit-llvm-bc -o - %s | opt -std-compile-opts | llvm-dis > %t
+// RUN: clang-cc -triple i386-unknown-unknown -emit-llvm-bc -o - %s | opt -std-compile-opts | llvm-dis > %t
// RUN: grep "ret i32 %" %t
// Make sure return is not constant (if empty range is skipped or miscompiled)
diff --git a/test/CodeGen/rdr-6098585-unsigned-caserange.c b/test/CodeGen/rdr-6098585-unsigned-caserange.c
index 3b4384b..a2b85d9 100644
--- a/test/CodeGen/rdr-6098585-unsigned-caserange.c
+++ b/test/CodeGen/rdr-6098585-unsigned-caserange.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -triple i386-unknown-unknown --emit-llvm-bc -o - %s | opt -std-compile-opts | llvm-dis > %t
+// RUN: clang-cc -triple i386-unknown-unknown -emit-llvm-bc -o - %s | opt -std-compile-opts | llvm-dis > %t
// RUN: grep "ret i32" %t | count 1
// RUN: grep "ret i32 3" %t | count 1
diff --git a/test/CodeGen/stack-protector.c b/test/CodeGen/stack-protector.c
index c29d1f7..5763597 100644
--- a/test/CodeGen/stack-protector.c
+++ b/test/CodeGen/stack-protector.c
@@ -1,8 +1,8 @@
-// RUN: clang-cc -emit-llvm -o - %s -stack-protector=0 | FileCheck -check-prefix=NOSSP %s
+// RUN: clang-cc -emit-llvm -o - %s -stack-protector 0 | FileCheck -check-prefix=NOSSP %s
// NOSSP: define void @test1(i8* %msg) nounwind {
-// RUN: clang-cc -emit-llvm -o - %s -stack-protector=1 | FileCheck -check-prefix=WITHSSP %s
+// RUN: clang-cc -emit-llvm -o - %s -stack-protector 1 | FileCheck -check-prefix=WITHSSP %s
// WITHSSP: define void @test1(i8* %msg) nounwind ssp {
-// RUN: clang-cc -emit-llvm -o - %s -stack-protector=2 | FileCheck -check-prefix=SSPREQ %s
+// RUN: clang-cc -emit-llvm -o - %s -stack-protector 2 | FileCheck -check-prefix=SSPREQ %s
// SSPREQ: define void @test1(i8* %msg) nounwind sspreq {
int printf(const char * _Format, ...);
diff --git a/test/CodeGen/static-order.c b/test/CodeGen/static-order.c
index 243e96b..58340b6 100644
--- a/test/CodeGen/static-order.c
+++ b/test/CodeGen/static-order.c
@@ -1,4 +1,7 @@
-// RUN: clang-cc -emit-llvm -o - %s | not grep "zeroinitializer"
+// RUN: clang-cc -emit-llvm -o - %s | FileCheck %s
+// CHECK: ModuleID
+// CHECK-NOT: zeroinitializer
+// CHECK: define i8* @f
struct s {
int a;
diff --git a/test/CodeGen/switch.c b/test/CodeGen/switch.c
index 3254fbf..96118f6 100644
--- a/test/CodeGen/switch.c
+++ b/test/CodeGen/switch.c
@@ -1,11 +1,11 @@
-// RUN: clang-cc %s -emit-llvm-bc -o - | opt -std-compile-opts -disable-output
+// RUN: clang-cc -triple i386-unknown-unknown -O3 %s -emit-llvm -o - | FileCheck %s
int foo(int i) {
int j = 0;
switch (i) {
case -1:
j = 1; break;
- case 1 :
+ case 1 :
j = 2; break;
case 2:
j = 3; break;
@@ -16,11 +16,10 @@ int foo(int i) {
return j;
}
-
int foo2(int i) {
int j = 0;
switch (i) {
- case 1 :
+ case 1 :
j = 2; break;
case 2 ... 10:
j = 3; break;
@@ -31,7 +30,6 @@ int foo2(int i) {
return j;
}
-
int foo3(int i) {
int j = 0;
switch (i) {
@@ -48,7 +46,7 @@ int foo3(int i) {
}
-int foo4(int i) {
+static int foo4(int i) {
int j = 0;
switch (i) {
case 111:
@@ -65,6 +63,17 @@ int foo4(int i) {
return j;
}
+// CHECK: define i32 @foo4t()
+// CHECK: ret i32 376
+// CHECK: }
+int foo4t() {
+ // 111 + 1 + 222 + 42 = 376
+ return foo4(111) + foo4(99) + foo4(222) + foo4(601);
+}
+
+// CHECK: define void @foo5()
+// CHECK-NOT: switch
+// CHECK: }
void foo5(){
switch(0){
default:
@@ -74,11 +83,17 @@ void foo5(){
}
}
+// CHECK: define void @foo6()
+// CHECK-NOT: switch
+// CHECK: }
void foo6(){
switch(0){
}
}
+// CHECK: define void @foo7()
+// CHECK-NOT: switch
+// CHECK: }
void foo7(){
switch(0){
foo7();
diff --git a/test/CodeGen/vector.c b/test/CodeGen/vector.c
index 2945eba..21a03d0 100644
--- a/test/CodeGen/vector.c
+++ b/test/CodeGen/vector.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -triple i386-apple-darwin9 -mcpu=pentium4 -g -emit-llvm %s -o -
+// RUN: clang-cc -triple i386-apple-darwin9 -mcpu pentium4 -g -emit-llvm %s -o -
typedef short __v4hi __attribute__ ((__vector_size__ (8)));
void test1() {
diff --git a/test/CodeGen/visibility.c b/test/CodeGen/visibility.c
index 7c837ba..c19004a5 100644
--- a/test/CodeGen/visibility.c
+++ b/test/CodeGen/visibility.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -triple i386-unknown-unknown -fvisibility=default -emit-llvm -o %t %s
+// RUN: clang-cc -triple i386-unknown-unknown -fvisibility default -emit-llvm -o %t %s
// RUN: grep '@g_com = common global i32 0' %t
// RUN: grep '@g_def = global i32 0' %t
// RUN: grep '@g_ext = external global i32' %t
@@ -6,7 +6,7 @@
// RUN: grep 'declare void @f_ext()' %t
// RUN: grep 'define internal void @f_deferred()' %t
// RUN: grep 'define i32 @f_def()' %t
-// RUN: clang-cc -triple i386-unknown-unknown -fvisibility=protected -emit-llvm -o %t %s
+// RUN: clang-cc -triple i386-unknown-unknown -fvisibility protected -emit-llvm -o %t %s
// RUN: grep '@g_com = common protected global i32 0' %t
// RUN: grep '@g_def = protected global i32 0' %t
// RUN: grep '@g_ext = external global i32' %t
@@ -14,7 +14,7 @@
// RUN: grep 'declare void @f_ext()' %t
// RUN: grep 'define internal void @f_deferred()' %t
// RUN: grep 'define protected i32 @f_def()' %t
-// RUN: clang-cc -triple i386-unknown-unknown -fvisibility=hidden -emit-llvm -o %t %s
+// RUN: clang-cc -triple i386-unknown-unknown -fvisibility hidden -emit-llvm -o %t %s
// RUN: grep '@g_com = common hidden global i32 0' %t
// RUN: grep '@g_def = hidden global i32 0' %t
// RUN: grep '@g_ext = external global i32' %t
OpenPOWER on IntegriCloud