| 1 |
// RUN: %clang_cc1 %s -triple=powerpc64le-unknown-linux -target-feature +altivec \ |
| 2 |
// RUN: -target-feature +vsx -verify -verify-ignore-unexpected=note -pedantic -fsyntax-only |
| 3 |
// RUN: %clang_cc1 %s -triple=powerpc64le-unknown-linux -target-feature +altivec \ |
| 4 |
// RUN: -target-feature +vsx -verify -verify-ignore-unexpected=note -pedantic -fsyntax-only \ |
| 5 |
// RUN: -target-cpu pwr8 |
| 6 |
|
| 7 |
typedef signed char __v16sc __attribute__((__vector_size__(16))); |
| 8 |
typedef unsigned char __v16uc __attribute__((__vector_size__(16))); |
| 9 |
typedef signed short __v8ss __attribute__((__vector_size__(16))); |
| 10 |
typedef unsigned short __v8us __attribute__((__vector_size__(16))); |
| 11 |
typedef signed int __v4si __attribute__((__vector_size__(16))); |
| 12 |
typedef unsigned int __v4ui __attribute__((__vector_size__(16))); |
| 13 |
typedef signed long long __v2sll __attribute__((__vector_size__(16))); |
| 14 |
typedef unsigned long long __v2ull __attribute__((__vector_size__(16))); |
| 15 |
typedef signed __int128 __v1slll __attribute__((__vector_size__(16))); |
| 16 |
typedef unsigned __int128 __v1ulll __attribute__((__vector_size__(16))); |
| 17 |
typedef float __v4f __attribute__((__vector_size__(16))); |
| 18 |
typedef double __v2d __attribute__((__vector_size__(16))); |
| 19 |
|
| 20 |
__v16sc *__attribute__((__overloadable__)) convert1(vector signed char); |
| 21 |
__v16uc *__attribute__((__overloadable__)) convert1(vector unsigned char); |
| 22 |
__v8ss *__attribute__((__overloadable__)) convert1(vector signed short); |
| 23 |
__v8us *__attribute__((__overloadable__)) convert1(vector unsigned short); |
| 24 |
__v4si *__attribute__((__overloadable__)) convert1(vector signed int); |
| 25 |
__v4ui *__attribute__((__overloadable__)) convert1(vector unsigned int); |
| 26 |
__v2sll *__attribute__((__overloadable__)) convert1(vector signed long long); |
| 27 |
__v4f *__attribute__((__overloadable__)) convert1(vector float); |
| 28 |
__v2d *__attribute__((__overloadable__)) convert1(vector double); |
| 29 |
void __attribute__((__overloadable__)) convert1(vector bool int); |
| 30 |
void __attribute__((__overloadable__)) convert1(vector pixel short); |
| 31 |
|
| 32 |
vector signed char *__attribute__((__overloadable__)) convert2(__v16sc); |
| 33 |
vector unsigned char *__attribute__((__overloadable__)) convert2(__v16uc); |
| 34 |
vector signed short *__attribute__((__overloadable__)) convert2(__v8ss); |
| 35 |
vector unsigned short *__attribute__((__overloadable__)) convert2(__v8us); |
| 36 |
vector signed int *__attribute__((__overloadable__)) convert2(__v4si); |
| 37 |
vector unsigned int *__attribute__((__overloadable__)) convert2(__v4ui); |
| 38 |
vector signed long long *__attribute__((__overloadable__)) convert2(__v2sll); |
| 39 |
vector unsigned long long *__attribute__((__overloadable__)) convert2(__v2ull); |
| 40 |
vector float *__attribute__((__overloadable__)) convert2(__v4f); |
| 41 |
vector double *__attribute__((__overloadable__)) convert2(__v2d); |
| 42 |
|
| 43 |
#ifdef __POWER8_VECTOR__ |
| 44 |
__v1slll *__attribute__((__overloadable__)) convert1(vector signed __int128); |
| 45 |
__v1ulll *__attribute__((__overloadable__)) convert1(vector unsigned __int128); |
| 46 |
__v2ull *__attribute__((__overloadable__)) convert1(vector unsigned long long); |
| 47 |
vector signed __int128 *__attribute__((__overloadable__)) convert2(__v1slll); |
| 48 |
vector unsigned __int128 *__attribute__((__overloadable__)) convert2(__v1ulll); |
| 49 |
#endif |
| 50 |
|
| 51 |
void test(void) { |
| 52 |
__v16sc gv1; |
| 53 |
__v16uc gv2; |
| 54 |
__v8ss gv3; |
| 55 |
__v8us gv4; |
| 56 |
__v4si gv5; |
| 57 |
__v4ui gv6; |
| 58 |
__v2sll gv7; |
| 59 |
__v4f gv11; |
| 60 |
__v2d gv12; |
| 61 |
|
| 62 |
#ifdef __POWER8_VECTOR__ |
| 63 |
__v2ull gv8; |
| 64 |
__v1slll gv9; |
| 65 |
__v1ulll gv10; |
| 66 |
#endif |
| 67 |
|
| 68 |
vector signed char av1; |
| 69 |
vector unsigned char av2; |
| 70 |
vector signed short av3; |
| 71 |
vector unsigned short av4; |
| 72 |
vector signed int av5; |
| 73 |
vector unsigned int av6; |
| 74 |
vector signed long long av7; |
| 75 |
vector unsigned long long av8; |
| 76 |
#ifdef __POWER8_VECTOR__ |
| 77 |
vector signed __int128 av9; |
| 78 |
vector unsigned __int128 av10; |
| 79 |
#endif |
| 80 |
vector float av11; |
| 81 |
vector double av12; |
| 82 |
vector bool int av13; |
| 83 |
vector pixel short av14; |
| 84 |
|
| 85 |
__v16sc *gv1_p = convert1(gv1); |
| 86 |
__v16uc *gv2_p = convert1(gv2); |
| 87 |
__v8ss *gv3_p = convert1(gv3); |
| 88 |
__v8us *gv4_p = convert1(gv4); |
| 89 |
__v4si *gv5_p = convert1(gv5); |
| 90 |
__v4ui *gv6_p = convert1(gv6); |
| 91 |
__v2sll *gv7_p = convert1(gv7); |
| 92 |
#ifdef __POWER8_VECTOR__ |
| 93 |
__v2ull *gv8_p = convert1(gv8); |
| 94 |
__v1slll *gv9_p = convert1(gv9); |
| 95 |
__v1ulll *gv10_p = convert1(gv10); |
| 96 |
#endif |
| 97 |
__v4f *gv11_p = convert1(gv11); |
| 98 |
__v2d *gv12_p = convert1(gv12); |
| 99 |
|
| 100 |
vector signed char *av1_p = convert2(av1); |
| 101 |
vector unsigned char *av2_p = convert2(av2); |
| 102 |
vector signed short *av3_p = convert2(av3); |
| 103 |
vector unsigned short *av4_p = convert2(av4); |
| 104 |
vector signed int *av5_p = convert2(av5); |
| 105 |
vector unsigned int *av6_p = convert2(av6); |
| 106 |
vector signed long long *av7_p = convert2(av7); |
| 107 |
vector unsigned long long *av8_p = convert2(av8); |
| 108 |
#ifdef __POWER8_VECTOR__ |
| 109 |
vector signed __int128 *av9_p = convert2(av9); |
| 110 |
vector unsigned __int128 *av10_p = convert2(av10); |
| 111 |
#endif |
| 112 |
vector float *av11_p = convert2(av11); |
| 113 |
vector double *av12_p = convert2(av12); |
| 114 |
convert2(av13); // expected-error {{call to 'convert2' is ambiguous}} |
| 115 |
convert2(av14); // expected-error {{call to 'convert2' is ambiguous}} |
| 116 |
} |