| 1 | // RUN: %clang_cc1 -fsyntax-only -DERR -verify %s |
| 2 | // RUN: %clang_cc1 -fsyntax-only -Wno-error-vec-elem-size -verify %s |
| 3 | // RUN: %clang_cc1 -fsyntax-only -DEXT -DERR -verify %s |
| 4 | // RUN: %clang_cc1 -fsyntax-only -DEXT -Wno-error-vec-elem-size -verify %s |
| 5 | |
| 6 | #ifdef EXT |
| 7 | typedef __attribute__((__ext_vector_type__(8))) char vector_char8; |
| 8 | typedef __attribute__((__ext_vector_type__(8))) short vector_short8; |
| 9 | typedef __attribute__((__ext_vector_type__(8))) int vector_int8; |
| 10 | typedef __attribute__((__ext_vector_type__(8))) unsigned char vector_uchar8; |
| 11 | typedef __attribute__((__ext_vector_type__(8))) unsigned short vector_ushort8; |
| 12 | typedef __attribute__((__ext_vector_type__(8))) unsigned int vector_uint8; |
| 13 | typedef __attribute__((__ext_vector_type__(4))) char vector_char4; |
| 14 | typedef __attribute__((__ext_vector_type__(4))) short vector_short4; |
| 15 | typedef __attribute__((__ext_vector_type__(4))) int vector_int4; |
| 16 | typedef __attribute__((__ext_vector_type__(4))) unsigned char vector_uchar4; |
| 17 | typedef __attribute__((__ext_vector_type__(4))) unsigned short vector_ushort4; |
| 18 | typedef __attribute__((__ext_vector_type__(4))) unsigned int vector_uint4; |
| 19 | #else |
| 20 | typedef __attribute__((vector_size(8))) char vector_char8; |
| 21 | typedef __attribute__((vector_size(16))) short vector_short8; |
| 22 | typedef __attribute__((vector_size(32))) int vector_int8; |
| 23 | typedef __attribute__((vector_size(8))) unsigned char vector_uchar8; |
| 24 | typedef __attribute__((vector_size(16))) unsigned short vector_ushort8; |
| 25 | typedef __attribute__((vector_size(32))) unsigned int vector_uint8; |
| 26 | typedef __attribute__((vector_size(4))) char vector_char4; |
| 27 | typedef __attribute__((vector_size(4))) short vector_short4; |
| 28 | typedef __attribute__((vector_size(16))) int vector_int4; |
| 29 | typedef __attribute__((vector_size(4))) unsigned char vector_uchar4; |
| 30 | typedef __attribute__((vector_size(8))) unsigned short vector_ushort4; |
| 31 | typedef __attribute__((vector_size(16))) unsigned int vector_uint4; |
| 32 | #endif |
| 33 | |
| 34 | char c; |
| 35 | short s; |
| 36 | int i; |
| 37 | unsigned char uc; |
| 38 | unsigned short us; |
| 39 | unsigned int ui; |
| 40 | vector_char8 vc8; |
| 41 | vector_short8 vs8; |
| 42 | vector_int8 vi8; |
| 43 | vector_uchar8 vuc8; |
| 44 | vector_ushort8 vus8; |
| 45 | vector_uint8 vui8; |
| 46 | vector_char4 vc4; |
| 47 | vector_short4 vs4; |
| 48 | vector_int4 vi4; |
| 49 | vector_uchar4 vuc4; |
| 50 | vector_ushort4 vus4; |
| 51 | vector_uint4 vui4; |
| 52 | |
| 53 | void foo() { |
| 54 | vc8 = 1 << vc8; |
| 55 | vuc8 = 1 << vuc8; |
| 56 | vi8 = 1 << vi8; |
| 57 | vui8 = 1 << vui8; |
| 58 | vs8 = 1 << vs8; |
| 59 | vus8 = 1 << vus8; |
| 60 | |
| 61 | vc8 = c << vc8; |
| 62 | vuc8 = i << vuc8; |
| 63 | vi8 = uc << vi8; |
| 64 | vui8 = us << vui8; |
| 65 | vs8 = ui << vs8; |
| 66 | vus8 = 1 << vus8; |
| 67 | |
| 68 | vc8 = vc8 << vc8; |
| 69 | #ifdef ERR |
| 70 | vi8 = vi8 << vuc8; // expected-error {{vector operands do not have the same elements sizes}} |
| 71 | vuc8 = vuc8 << vi8; // expected-error {{vector operands do not have the same elements sizes}} |
| 72 | vus8 = vus8 << vui8; // expected-error {{vector operands do not have the same elements sizes}} |
| 73 | vui8 = vui8 << vs8; // expected-error {{vector operands do not have the same elements sizes}} |
| 74 | #else |
| 75 | vi8 = vi8 << vuc8; // expected-warning {{vector operands do not have the same elements sizes}} |
| 76 | vuc8 = vuc8 << vi8; // expected-warning {{vector operands do not have the same elements sizes}} |
| 77 | vus8 = vus8 << vui8; // expected-warning {{vector operands do not have the same elements sizes}} |
| 78 | vui8 = vui8 << vs8; // expected-warning {{vector operands do not have the same elements sizes}} |
| 79 | #endif |
| 80 | |
| 81 | vc8 <<= vc8; |
| 82 | #ifdef ERR |
| 83 | vi8 <<= vuc8; // expected-error {{vector operands do not have the same elements sizes}} |
| 84 | vuc8 <<= vi8; // expected-error {{vector operands do not have the same elements sizes}} |
| 85 | vus8 <<= vui8; // expected-error {{vector operands do not have the same elements sizes}} |
| 86 | vui8 <<= vs8; // expected-error {{vector operands do not have the same elements sizes}} |
| 87 | #else |
| 88 | vi8 <<= vuc8; // expected-warning {{vector operands do not have the same elements sizes}} |
| 89 | vuc8 <<= vi8; // expected-warning {{vector operands do not have the same elements sizes}} |
| 90 | vus8 <<= vui8; // expected-warning {{vector operands do not have the same elements sizes}} |
| 91 | vui8 <<= vs8; // expected-warning {{vector operands do not have the same elements sizes}} |
| 92 | #endif |
| 93 | |
| 94 | c <<= vc8; // expected-error {{assigning to 'char' from incompatible type}} |
| 95 | i <<= vuc8; // expected-error {{assigning to 'int' from incompatible type}} |
| 96 | uc <<= vi8; // expected-error {{assigning to 'unsigned char' from incompatible type}} |
| 97 | us <<= vui8; // expected-error {{assigning to 'unsigned short' from incompatible type}} |
| 98 | ui <<= vs8; // expected-error {{assigning to 'unsigned int' from incompatible type}} |
| 99 | } |
| 100 | |