blob: 9e904f69ff46a22d3542d1b87cdd9d28b4f36725 [file] [log] [blame]
Chris Lattner90997ac2007-08-03 16:42:43 +00001// RUN: clang -emit-llvm %s
2
3typedef __attribute__(( ocu_vector_type(4) )) float float4;
4//typedef __attribute__(( ocu_vector_type(3) )) float float3;
5typedef __attribute__(( ocu_vector_type(2) )) float float2;
6
7
8float4 test1(float4 V) {
9 return V.wzyx+V;
10}
11
12float2 vec2, vec2_2;
13float4 vec4, vec4_2;
14float f;
15
16static void test2() {
17 vec2 = vec4.rg; // shorten
18 f = vec2.x; // extract elt
19 vec4 = vec4.yyyy; // splat
20
21 vec2.x = f; // insert one.
22 vec2.yx = vec2; // reverse
23}
24
Devang Patela83cc332007-10-24 18:05:48 +000025static void test3(float4 *out) {
26 *out = ((float4) {1.0f, 2.0f, 3.0f, 4.0f });
27}
28
29static void test4(float4 *out) {
30 float a = 1.0f;
31 float b = 2.0f;
32 float c = 3.0f;
33 float d = 4.0f;
34 *out = ((float4) {a,b,c,d});
35}