From b20b94de3a4c5e00e2aa46bb2750770c4e1f7818 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Fri, 3 Aug 2007 16:42:43 +0000 Subject: [PATCH] testcase for vector element access stuff. llvm-svn: 40783 --- clang/test/CodeGen/ocu-vector.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 clang/test/CodeGen/ocu-vector.c diff --git a/clang/test/CodeGen/ocu-vector.c b/clang/test/CodeGen/ocu-vector.c new file mode 100644 index 000000000000..1c20535a58c9 --- /dev/null +++ b/clang/test/CodeGen/ocu-vector.c @@ -0,0 +1,24 @@ +// RUN: clang -emit-llvm %s + +typedef __attribute__(( ocu_vector_type(4) )) float float4; +//typedef __attribute__(( ocu_vector_type(3) )) float float3; +typedef __attribute__(( ocu_vector_type(2) )) float float2; + + +float4 test1(float4 V) { + return V.wzyx+V; +} + +float2 vec2, vec2_2; +float4 vec4, vec4_2; +float f; + +static void test2() { + vec2 = vec4.rg; // shorten + f = vec2.x; // extract elt + vec4 = vec4.yyyy; // splat + + vec2.x = f; // insert one. + vec2.yx = vec2; // reverse +} +