aboutsummaryrefslogtreecommitdiff
path: root/test/CodeGen
diff options
context:
space:
mode:
Diffstat (limited to 'test/CodeGen')
-rw-r--r--test/CodeGen/2009-10-20-GlobalDebug.c4
-rw-r--r--test/CodeGen/builtins.c2
-rw-r--r--test/CodeGen/debug-info.c14
-rw-r--r--test/CodeGen/ext-vector-shuffle.c8
-rw-r--r--test/CodeGen/vector.c31
5 files changed, 50 insertions, 9 deletions
diff --git a/test/CodeGen/2009-10-20-GlobalDebug.c b/test/CodeGen/2009-10-20-GlobalDebug.c
new file mode 100644
index 000000000000..eea3fb5307b4
--- /dev/null
+++ b/test/CodeGen/2009-10-20-GlobalDebug.c
@@ -0,0 +1,4 @@
+// RUN: clang -ccc-host-triple i386-apple-darwin10 -S -g -dA %s -o - | FileCheck %s
+int global;
+// CHECK: asciz "global" ## DW_AT_MIPS_linkage_name
+int main() { return 0;}
diff --git a/test/CodeGen/builtins.c b/test/CodeGen/builtins.c
index ac59b274958a..359d5070ccc1 100644
--- a/test/CodeGen/builtins.c
+++ b/test/CodeGen/builtins.c
@@ -117,7 +117,7 @@ int main() {
-char *strcat(char *a, char const *b) {}
+void strcat() {}
void foo() {
__builtin_strcat(0, 0);
diff --git a/test/CodeGen/debug-info.c b/test/CodeGen/debug-info.c
index beee7ac9b61a..85ad988bc216 100644
--- a/test/CodeGen/debug-info.c
+++ b/test/CodeGen/debug-info.c
@@ -1,10 +1,12 @@
-// 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
void convert(void) {
struct { typeof(0) f0; } v0;
}
+
// PR2784
struct OPAQUE;
typedef struct OPAQUE *PTR;
@@ -19,9 +21,11 @@ struct s0 *f0(struct s0 *a0) {
return a0->p;
}
+
// PR3134
char xpto[];
+
// PR3427
struct foo {
int a;
@@ -29,9 +33,17 @@ struct foo {
};
struct foo bar;
+
// PR4143
struct foo2 {
enum bar *bar;
};
struct foo2 foo2;
+
+
+// Radar 7325611
+// CHECK: "barfoo"
+typedef int barfoo;
+barfoo foo() {
+}
diff --git a/test/CodeGen/ext-vector-shuffle.c b/test/CodeGen/ext-vector-shuffle.c
index f53db945da03..765551596401 100644
--- a/test/CodeGen/ext-vector-shuffle.c
+++ b/test/CodeGen/ext-vector-shuffle.c
@@ -1,6 +1,6 @@
-// RUN: clang-cc %s -emit-llvm -o - | not grep 'extractelement' &&
-// RUN: clang-cc %s -emit-llvm -o - | not grep 'insertelement' &&
-// RUN: clang-cc %s -emit-llvm -o - | grep 'shufflevector'
+// RUN: clang-cc %s -x cl -emit-llvm -o - | not grep 'extractelement' &&
+// RUN: clang-cc %s -x cl -emit-llvm -o - | not grep 'insertelement' &&
+// RUN: clang-cc %s -x cl -emit-llvm -o - | grep 'shufflevector'
typedef __attribute__(( ext_vector_type(2) )) float float2;
typedef __attribute__(( ext_vector_type(4) )) float float4;
@@ -13,3 +13,5 @@ float4 test2(float4 V) {
float2 W = V.ww;
return W.xyxy + W.yxyx;
}
+
+float4 test3(float4 V1, float4 V2) { return (float4)(V1.zw, V2.xy); }
diff --git a/test/CodeGen/vector.c b/test/CodeGen/vector.c
index 5e48fd42b1d0..2945ebaa4d05 100644
--- a/test/CodeGen/vector.c
+++ b/test/CodeGen/vector.c
@@ -1,7 +1,7 @@
-// RUN: clang-cc -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 f() {
+void test1() {
__v4hi A = (__v4hi)0LL;
}
@@ -9,11 +9,34 @@ __v4hi x = {1,2,3};
__v4hi y = {1,2,3,4};
typedef int vty __attribute((vector_size(16)));
-int a() { vty b; return b[2LL]; }
+int test2() { vty b; return b[2LL]; }
// PR4339
typedef float vec4 __attribute__((vector_size(16)));
-void vac ( vec4* a, char b, float c ) {
+void test3 ( vec4* a, char b, float c ) {
(*a)[b] = c;
}
+
+
+
+
+#include <mmintrin.h>
+
+int test4(int argc, char *argv[]) {
+ int array[16] = { 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15 };
+ __m64 *p = (__m64 *)array;
+
+ __m64 accum = _mm_setzero_si64();
+
+ for (int i=0; i<8; ++i)
+ accum = _mm_add_pi32(p[i], accum);
+
+ __m64 accum2 = _mm_unpackhi_pi32(accum, accum);
+ accum = _mm_add_pi32(accum, accum2);
+
+ int result = _mm_cvtsi64_si32(accum);
+ _mm_empty();
+
+ return result;
+}