diff options
Diffstat (limited to 'test/CodeGen')
-rw-r--r-- | test/CodeGen/2008-08-25-incompatible-cond-expr.m | 2 | ||||
-rw-r--r-- | test/CodeGen/2009-01-21-invalid-debug-info.m | 2 | ||||
-rw-r--r-- | test/CodeGen/arm_asm_clobber.c | 2 | ||||
-rw-r--r-- | test/CodeGen/cast-to-union.c | 14 | ||||
-rw-r--r-- | test/CodeGen/decl.c | 61 | ||||
-rw-r--r-- | test/CodeGen/exprs.c | 3 | ||||
-rw-r--r-- | test/CodeGen/function-decay.m | 2 | ||||
-rw-r--r-- | test/CodeGen/object-size.c | 73 | ||||
-rw-r--r-- | test/CodeGen/palignr.c | 19 | ||||
-rw-r--r-- | test/CodeGen/rdr-6732143-dangling-block-reference.m | 2 | ||||
-rw-r--r-- | test/CodeGen/string-init.c | 10 | ||||
-rw-r--r-- | test/CodeGen/vfprintf.c | 8 |
12 files changed, 125 insertions, 73 deletions
diff --git a/test/CodeGen/2008-08-25-incompatible-cond-expr.m b/test/CodeGen/2008-08-25-incompatible-cond-expr.m index 3cc42d8..fa9b197 100644 --- a/test/CodeGen/2008-08-25-incompatible-cond-expr.m +++ b/test/CodeGen/2008-08-25-incompatible-cond-expr.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -emit-llvm -o %t %s +// RUN: clang -cc1 -emit-llvm -o %t %s @protocol P0 @end diff --git a/test/CodeGen/2009-01-21-invalid-debug-info.m b/test/CodeGen/2009-01-21-invalid-debug-info.m index 2662b922..1c1028b 100644 --- a/test/CodeGen/2009-01-21-invalid-debug-info.m +++ b/test/CodeGen/2009-01-21-invalid-debug-info.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -S -g -o %t.s %s +// RUN: clang -cc1 -S -g -o %t.s %s // FIXME: This test case can be removed at some point (since it will // no longer effectively test anything). The reason it was causing diff --git a/test/CodeGen/arm_asm_clobber.c b/test/CodeGen/arm_asm_clobber.c index 34e2517..05eb2e2 100644 --- a/test/CodeGen/arm_asm_clobber.c +++ b/test/CodeGen/arm_asm_clobber.c @@ -1,4 +1,4 @@ -// RUN: clang -ccc-host-triple armv6-unknown-unknown -emit-llvm -S -o %t %s +// RUN: clang-cc -triple armv6-unknown-unknown -emit-llvm -o %t %s void test0(void) { asm volatile("mov r0, r0" :: ); diff --git a/test/CodeGen/cast-to-union.c b/test/CodeGen/cast-to-union.c deleted file mode 100644 index 1f7e045..0000000 --- a/test/CodeGen/cast-to-union.c +++ /dev/null @@ -1,14 +0,0 @@ -// RUN: clang-cc -emit-llvm %s -o - | FileCheck %s -// CHECK: w = global %0 { i32 2, [4 x i8] undef } -// CHECK: y = global %union.u { double 7.300000e+0{{[0]*}}1 } -// CHECK: store i32 351, i32 - -union u { int i; double d; }; - -void foo() { - union u ola = (union u) 351; - union u olb = (union u) 1.0; -} - -union u w = (union u)2; -union u y = (union u)73.0; diff --git a/test/CodeGen/decl.c b/test/CodeGen/decl.c new file mode 100644 index 0000000..f7a001e --- /dev/null +++ b/test/CodeGen/decl.c @@ -0,0 +1,61 @@ +// RUN: clang-cc -emit-llvm < %s | FileCheck %s + +// CHECK: @test1.x = internal constant [12 x i32] [i32 1 +// CHECK: @test2.x = internal constant [13 x i32] [i32 1, +// CHECK: @test5w = global %0 { i32 2, [4 x i8] undef } +// CHECK: @test5y = global %union.test5u { double 7.300000e+0{{[0]*}}1 } + +void test1() { + // This should codegen as a "@test1.x" global. + const int x[] = { 1, 2, 3, 4, 6, 8, 9, 10, 123, 231, 123,23 }; + foo(x); + +// CHECK: @test1() +// CHECK: {{call.*@foo.*@test1.x}} +} + + +// rdar://7346691 +void test2() { + // This should codegen as a "@test2.x" global + memcpy. + int x[] = { 1, 2, 3, 4, 6, 8, 9, 10, 123, 231, 123,23, 24 }; + foo(x); + + // CHECK: @test2() + // CHECK: %x = alloca [13 x i32] + // CHECK: call void @llvm.memcpy + // CHECK: call{{.*}}@foo{{.*}}i32* % +} + + +void test3() { + // This should codegen as a memset. + int x[100] = { 0 }; + foo(x); + + // CHECK: @test3() + // CHECK: %x = alloca [100 x i32] + // CHECK: call void @llvm.memset +} + +void test4(void) { + char a[10] = "asdf"; + char b[10] = { "asdf" }; + // CHECK: @test4() + // CHECK: %a = alloca [10 x i8] + // CHECK: %b = alloca [10 x i8] + // CHECK: call void @llvm.memcpy + // CHECK: call void @llvm.memcpy +} + + +union test5u { int i; double d; }; + +void test5() { + union test5u ola = (union test5u) 351; + union test5u olb = (union test5u) 1.0; +} + +union test5u test5w = (union test5u)2; +union test5u test5y = (union test5u)73.0; + diff --git a/test/CodeGen/exprs.c b/test/CodeGen/exprs.c index a0e5b76..c1a5995 100644 --- a/test/CodeGen/exprs.c +++ b/test/CodeGen/exprs.c @@ -116,3 +116,6 @@ void f9(struct S *x) { foo(((void)1, x->c).tab[0]); } +void f10() { + __builtin_sin(0); +} diff --git a/test/CodeGen/function-decay.m b/test/CodeGen/function-decay.m index 5652fdb..4b8e360 100644 --- a/test/CodeGen/function-decay.m +++ b/test/CodeGen/function-decay.m @@ -1,4 +1,4 @@ -// RUN: clang-cc %s -emit-llvm -o - +// RUN: clang -cc1 %s -emit-llvm -o - @interface I0 @end @implementation I0 diff --git a/test/CodeGen/object-size.c b/test/CodeGen/object-size.c index 038d8f9..45747de 100644 --- a/test/CodeGen/object-size.c +++ b/test/CodeGen/object-size.c @@ -1,4 +1,4 @@ -// RUN: clang-cc -triple x86_64-apple-darwin -S %s -o - | FileCheck %s +// RUN: clang-cc -triple x86_64-apple-darwin -emit-llvm %s -o - | FileCheck %s #define strcpy(dest, src) \ ((__builtin_object_size(dest, 0) != -1ULL) \ @@ -14,113 +14,98 @@ char *gp; int gi, gj; void test1() { - // CHECK: movabsq $59, %rdx - // CHECK-NEXT: movq - // CHECK-NEXT: movq - // CHECK-NEXT: call ___strcpy_chk + // 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) strcpy(&gbuf[4], "Hi there"); } void test2() { - // CHECK: movabsq $63, %rdx - // CHECK-NEXT: movq - // CHECK-NEXT: movq - // CHECK-NEXT: call ___strcpy_chk + // 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) strcpy(gbuf, "Hi there"); } void test3() { - // CHECK: movabsq $0, %rdx - // CHECK-NEXT: movq - // CHECK-NEXT: movq - // CHECK-NEXT: call ___strcpy_chk + // 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) strcpy(&gbuf[100], "Hi there"); } void test4() { - // CHECK: movabsq $0, %rdx - // CHECK-NEXT: movq - // CHECK-NEXT: movq - // CHECK-NEXT: call ___strcpy_chk + // 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) strcpy((char*)(void*)&gbuf[-1], "Hi there"); } void test5() { - // CHECK: movq $-1, %rax - // CHECK-NEXT: cmpq $-1, %rax - // CHECK: call ___inline_strcpy_chk + // CHECK: %tmp = load i8** @gp + // CHECK-NEXT:%0 = call i64 @llvm.objectsize.i64(i8* %tmp, i32 0) + // CHECK-NEXT:%cmp = icmp ne i64 %0, -1 strcpy(gp, "Hi there"); } void test6() { char buf[57]; - // CHECK: movabsq $53, %rdx - // CHECK-NEXT: movq - // CHECK-NEXT: movq - // CHECK-NEXT: call ___strcpy_chk + // CHECK: %call = call i8* @__strcpy_chk(i8* %arrayidx, i8* getelementptr inbounds ([9 x i8]* @.str, i32 0, i32 0), i64 53) strcpy(&buf[4], "Hi there"); } void test7() { int i; - // CHECK-NOT: call ___strcpy_chk - // CHECK: call ___inline_strcpy_chk + // 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)) strcpy((++i, gbuf), "Hi there"); } void test8() { char *buf[50]; - // CHECK-NOT: call ___strcpy_chk - // CHECK: call ___inline_strcpy_chk + // CHECK-NOT: __strcpy_chk + // CHECK: %call = call i8* @__inline_strcpy_chk(i8* %tmp1, i8* getelementptr inbounds ([9 x i8]* @.str, i32 0, i32 0)) strcpy(buf[++gi], "Hi there"); } void test9() { - // CHECK-NOT: call ___strcpy_chk - // CHECK: call ___inline_strcpy_chk + // CHECK-NOT: __strcpy_chk + // CHECK: %call = call i8* @__inline_strcpy_chk(i8* %0, i8* getelementptr inbounds ([9 x i8]* @.str, i32 0, i32 0)) strcpy((char *)((++gi) + gj), "Hi there"); } char **p; void test10() { - // CHECK-NOT: call ___strcpy_chk - // CHECK: call ___inline_strcpy_chk + // CHECK-NOT: __strcpy_chk + // CHECK: %call = call i8* @__inline_strcpy_chk(i8* %tmp1, i8* getelementptr inbounds ([9 x i8]* @.str, i32 0, i32 0)) strcpy(*(++p), "Hi there"); } void test11() { - // CHECK-NOT: call ___strcpy_chk - // CHECK: call ___inline_strcpy_chk + // CHECK-NOT: __strcpy_chk + // CHECK: %call = call i8* @__inline_strcpy_chk(i8* %tmp, i8* getelementptr inbounds ([9 x i8]* @.str, i32 0, i32 0)) strcpy(gp = gbuf, "Hi there"); } void test12() { - // CHECK-NOT: call ___strcpy_chk - // CHECK: call ___inline_strcpy_chk + // CHECK-NOT: __strcpy_chk + // CHECK: %call = call i8* @__inline_strcpy_chk(i8* %ptrincdec, i8* getelementptr inbounds ([9 x i8]* @.str, i32 0, i32 0)) strcpy(++gp, "Hi there"); } void test13() { - // CHECK-NOT: call ___strcpy_chk - // CHECK: call ___inline_strcpy_chk + // CHECK-NOT: __strcpy_chk + // CHECK: %call = call i8* @__inline_strcpy_chk(i8* %tmp, i8* getelementptr inbounds ([9 x i8]* @.str, i32 0, i32 0)) strcpy(gp++, "Hi there"); } void test14() { - // CHECK-NOT: call ___strcpy_chk - // CHECK: call ___inline_strcpy_chk + // CHECK-NOT: __strcpy_chk + // CHECK: %call = call i8* @__inline_strcpy_chk(i8* %ptrincdec, i8* getelementptr inbounds ([9 x i8]* @.str, i32 0, i32 0)) strcpy(--gp, "Hi there"); } void test15() { - // CHECK-NOT: call ___strcpy_chk - // CHECK: call ___inline_strcpy_chk + // CHECK-NOT: __strcpy_chk + // CHECK: %call = call i8* @__inline_strcpy_chk(i8* %tmp, i8* getelementptr inbounds ([9 x i8]* @.str, i32 0, i32 0)) strcpy(gp--, "Hi there"); } void test16() { - // CHECK-NOT: call ___strcpy_chk - // CHECK: call ___inline_strcpy_chk + // CHECK-NOT: __strcpy_chk + // CHECK: %call = call i8* @__inline_strcpy_chk(i8* %tmp1, i8* getelementptr inbounds ([9 x i8]* @.str, i32 0, i32 0)) strcpy(gp += 1, "Hi there"); } diff --git a/test/CodeGen/palignr.c b/test/CodeGen/palignr.c new file mode 100644 index 0000000..41e48bd --- /dev/null +++ b/test/CodeGen/palignr.c @@ -0,0 +1,19 @@ +// RUN: clang-cc %s -triple=i686-apple-darwin -target-feature +ssse3 -O1 -S -o - | FileCheck %s + +#define _mm_alignr_epi8(a, b, n) (__builtin_ia32_palignr128((a), (b), (n))) +#define _mm_alignr_pi8(a, b, n) (__builtin_ia32_palignr((a), (b), (n*8))) +typedef __attribute__((vector_size(8))) int int2; +typedef __attribute__((vector_size(16))) int int4; + +// CHECK: palignr +int2 mmx_align1(int2 a, int2 b) { return _mm_alignr_pi8(a, b, 7); } +// CHECK: palignr +int4 align1(int4 a, int4 b) { return _mm_alignr_epi8(a, b, 15); } +// CHECK: ret +// CHECK: ret +// CHECK-NOT: palignr +int4 align2(int4 a, int4 b) { return _mm_alignr_epi8(a, b, 16); } +// CHECK: psrldq +int4 align3(int4 a, int4 b) { return _mm_alignr_epi8(a, b, 17); } +// CHECK: xorps +int4 align4(int4 a, int4 b) { return _mm_alignr_epi8(a, b, 32); } diff --git a/test/CodeGen/rdr-6732143-dangling-block-reference.m b/test/CodeGen/rdr-6732143-dangling-block-reference.m index 2d1baa6..90641dd 100644 --- a/test/CodeGen/rdr-6732143-dangling-block-reference.m +++ b/test/CodeGen/rdr-6732143-dangling-block-reference.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -triple x86_64-apple-darwin9 -emit-llvm %s -o - +// RUN: clang -cc1 -triple x86_64-apple-darwin9 -emit-llvm %s -o - void f0(id x) { @synchronized (x) { diff --git a/test/CodeGen/string-init.c b/test/CodeGen/string-init.c deleted file mode 100644 index 0cb6aff..0000000 --- a/test/CodeGen/string-init.c +++ /dev/null @@ -1,10 +0,0 @@ -// RUN: clang-cc -emit-llvm %s -o %t -// RUN: grep 'private constant \[10 x i8\]' %t -// RUN: not grep -F "[5 x i8]" %t -// RUN: not grep "store " %t - -void test(void) { - char a[10] = "asdf"; - char b[10] = { "asdf" }; -} - diff --git a/test/CodeGen/vfprintf.c b/test/CodeGen/vfprintf.c new file mode 100644 index 0000000..89261c7 --- /dev/null +++ b/test/CodeGen/vfprintf.c @@ -0,0 +1,8 @@ +// RUN: clang-cc -emit-llvm-only %s + +typedef struct _IO_FILE FILE; +int vfprintf(FILE*restrict,const char*restrict, __builtin_va_list); +void foo(__builtin_va_list ap) { + vfprintf(0, " ", ap); +} + |