summaryrefslogtreecommitdiffstats
path: root/clang/test/CodeGen/ext-vector.c
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2009-01-05 23:10:19 +0000
committerChris Lattner <sabre@nondot.org>2009-01-05 23:10:19 +0000
commit610c87cad6ceddea181c3ab544a1b9c6f2c3029b (patch)
tree051b3d22ebc20d418045e2d290ffd053001a91cf /clang/test/CodeGen/ext-vector.c
parent933d5ffc11cfbe31fdc2a3a63c91fc13a1e2dc0b (diff)
downloadbcm5719-llvm-610c87cad6ceddea181c3ab544a1b9c6f2c3029b.tar.gz
bcm5719-llvm-610c87cad6ceddea181c3ab544a1b9c6f2c3029b.zip
rename these tests to match the attribute.
llvm-svn: 61770
Diffstat (limited to 'clang/test/CodeGen/ext-vector.c')
-rw-r--r--clang/test/CodeGen/ext-vector.c121
1 files changed, 121 insertions, 0 deletions
diff --git a/clang/test/CodeGen/ext-vector.c b/clang/test/CodeGen/ext-vector.c
new file mode 100644
index 00000000000..657b2858535
--- /dev/null
+++ b/clang/test/CodeGen/ext-vector.c
@@ -0,0 +1,121 @@
+// RUN: clang -emit-llvm %s -o %t
+
+typedef __attribute__(( ext_vector_type(4) )) float float4;
+typedef __attribute__(( ext_vector_type(2) )) float float2;
+typedef __attribute__(( ext_vector_type(4) )) int int4;
+
+float4 foo = (float4){ 1.0, 2.0, 3.0, 4.0 };
+
+float4 test1(float4 V) {
+ return V.wzyx+V;
+}
+
+float2 vec2, vec2_2;
+float4 vec4, vec4_2;
+float f;
+
+void test2() {
+ vec2 = vec4.rg; // shorten
+ f = vec2.x; // extract elt
+ vec4 = vec4.yyyy; // splat
+
+ vec2.x = f; // insert one.
+ vec2.yx = vec2; // reverse
+}
+
+void test3(float4 *out) {
+ *out = ((float4) {1.0f, 2.0f, 3.0f, 4.0f });
+}
+
+void test4(float4 *out) {
+ float a = 1.0f;
+ float b = 2.0f;
+ float c = 3.0f;
+ float d = 4.0f;
+ *out = ((float4) {a,b,c,d});
+}
+
+void test5(float4 *out) {
+ float a;
+ float4 b;
+
+ a = 1.0f;
+ b = a;
+ b = b * 5.0f;
+ b = 5.0f * b;
+ b *= a;
+
+ *out = b;
+}
+
+void test6(float4 *ap, float4 *bp, float c) {
+ float4 a = *ap;
+ float4 b = *bp;
+
+ a = a + b;
+ a = a - b;
+ a = a * b;
+ a = a / b;
+
+ a = a + c;
+ a = a - c;
+ a = a * c;
+ a = a / c;
+
+ a += b;
+ a -= b;
+ a *= b;
+ a /= b;
+
+ a += c;
+ a -= c;
+ a *= c;
+ a /= c;
+
+ int4 cmp;
+
+ cmp = a < b;
+ cmp = a <= b;
+ cmp = a < b;
+ cmp = a >= b;
+ cmp = a == b;
+ cmp = a != b;
+}
+
+void test7(int4 *ap, int4 *bp, int c) {
+ int4 a = *ap;
+ int4 b = *bp;
+
+ a = a + b;
+ a = a - b;
+ a = a * b;
+ a = a / b;
+ a = a % b;
+
+ a = a + c;
+ a = a - c;
+ a = a * c;
+ a = a / c;
+ a = a % c;
+
+ a += b;
+ a -= b;
+ a *= b;
+ a /= b;
+ a %= b;
+
+ a += c;
+ a -= c;
+ a *= c;
+ a /= c;
+ a %= c;
+
+ int4 cmp;
+
+ cmp = a < b;
+ cmp = a <= b;
+ cmp = a < b;
+ cmp = a >= b;
+ cmp = a == b;
+ cmp = a != b;
+}
OpenPOWER on IntegriCloud