Chris Lattner | dd17394 | 2010-04-14 03:54:58 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 %s -triple=powerpc-apple-darwin8 -faltivec -verify -pedantic -fsyntax-only |
Nate Begeman | 2ef13e5 | 2009-08-10 23:49:36 +0000 | [diff] [blame] | 2 | |
| 3 | typedef int v4 __attribute((vector_size(16))); |
| 4 | typedef short v8 __attribute((vector_size(16))); |
| 5 | |
| 6 | v8 foo(void) { |
| 7 | v8 a; |
| 8 | v4 b; |
John Thompson | 58f9782 | 2010-04-20 05:01:46 +0000 | [diff] [blame] | 9 | a = (v8){4, 2}; |
Nate Begeman | 2ef13e5 | 2009-08-10 23:49:36 +0000 | [diff] [blame] | 10 | b = (v4)(5, 6, 7, 8, 9); // expected-warning {{excess elements in vector initializer}} |
| 11 | b = (v4)(5, 6, 8, 8.0f); |
| 12 | return (v8){0, 1, 2, 3, 1, 2, 3, 4}; |
| 13 | |
| 14 | // FIXME: test that (type)(fn)(args) still works with -faltivec |
| 15 | // FIXME: test that c++ overloaded commas still work -faltivec |
| 16 | } |
Douglas Gregor | 255210e | 2010-08-06 10:14:59 +0000 | [diff] [blame] | 17 | |
| 18 | void __attribute__((__overloadable__)) f(v4 a) |
| 19 | { |
| 20 | } |
| 21 | |
| 22 | void __attribute__((__overloadable__)) f(int a) |
| 23 | { |
| 24 | } |
| 25 | |
| 26 | void test() |
| 27 | { |
| 28 | v4 vGCC; |
| 29 | vector int vAltiVec; |
| 30 | |
| 31 | f(vAltiVec); |
| 32 | vGCC = vAltiVec; |
| 33 | vGCC = vGCC > vAltiVec; |
| 34 | vAltiVec = 0 ? vGCC : vGCC; |
| 35 | } |