Chris Lattner | 90997ac | 2007-08-03 16:42:43 +0000 | [diff] [blame^] | 1 | // RUN: clang -emit-llvm %s |
| 2 | |
| 3 | typedef __attribute__(( ocu_vector_type(4) )) float float4; |
| 4 | //typedef __attribute__(( ocu_vector_type(3) )) float float3; |
| 5 | typedef __attribute__(( ocu_vector_type(2) )) float float2; |
| 6 | |
| 7 | |
| 8 | float4 test1(float4 V) { |
| 9 | return V.wzyx+V; |
| 10 | } |
| 11 | |
| 12 | float2 vec2, vec2_2; |
| 13 | float4 vec4, vec4_2; |
| 14 | float f; |
| 15 | |
| 16 | static 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 | |