| 1 | // REQUIRES: powerpc-registered-target |
| 2 | |
| 3 | // RUN: %clang_cc1 -target-feature +altivec -target-feature +power9-vector \ |
| 4 | // RUN: -triple powerpc64-unknown-unknown -fsyntax-only \ |
| 5 | // RUN: -Wall -Werror -verify %s |
| 6 | |
| 7 | // RUN: %clang_cc1 -target-feature +altivec -target-feature +power9-vector \ |
| 8 | // RUN: -triple powerpc64le-unknown-unknown -fsyntax-only \ |
| 9 | // RUN: -Wall -Werror -verify %s |
| 10 | |
| 11 | #include <altivec.h> |
| 12 | |
| 13 | extern vector signed int vsi; |
| 14 | extern vector signed int vui; |
| 15 | extern vector float vf; |
| 16 | extern vector unsigned char vuc; |
| 17 | extern vector signed __int128 vsllli; |
| 18 | |
| 19 | void testInsertWord(void) { |
| 20 | int index = 5; |
| 21 | vector unsigned char v1 = vec_insert4b(vsi, vuc, index); // expected-error {{argument to '__builtin_vsx_insertword' must be a constant integer}} |
| 22 | vector unsigned long long v2 = vec_extract4b(vuc, index); // expected-error {{argument to '__builtin_vsx_extractuword' must be a constant integer}} |
| 23 | } |
| 24 | |
| 25 | void testXXPERMDI(int index) { |
| 26 | vec_xxpermdi(vsi); //expected-error {{too few arguments to function call, expected at least 3, have 1}} |
| 27 | vec_xxpermdi(vsi, vsi, 2, 4); //expected-error {{too many arguments to function call, expected at most 3, have 4}} |
| 28 | vec_xxpermdi(vsi, vsi, index); //expected-error {{argument 3 to '__builtin_vsx_xxpermdi' must be a 2-bit unsigned literal (i.e. 0, 1, 2 or 3)}} |
| 29 | vec_xxpermdi(1, 2, 3); //expected-error {{first two arguments to '__builtin_vsx_xxpermdi' must be vectors}} |
| 30 | vec_xxpermdi(vsi, vuc, 2); //expected-error {{first two arguments to '__builtin_vsx_xxpermdi' must have the same type}} |
| 31 | } |
| 32 | |
| 33 | void testXXSLDWI(int index) { |
| 34 | vec_xxsldwi(vsi); //expected-error {{too few arguments to function call, expected at least 3, have 1}} |
| 35 | vec_xxsldwi(vsi, vsi, 2, 4); //expected-error {{too many arguments to function call, expected at most 3, have 4}} |
| 36 | vec_xxsldwi(vsi, vsi, index); //expected-error {{argument 3 to '__builtin_vsx_xxsldwi' must be a 2-bit unsigned literal (i.e. 0, 1, 2 or 3)}} |
| 37 | vec_xxsldwi(1, 2, 3); //expected-error {{first two arguments to '__builtin_vsx_xxsldwi' must be vectors}} |
| 38 | vec_xxsldwi(vsi, vuc, 2); //expected-error {{first two arguments to '__builtin_vsx_xxsldwi' must have the same type}} |
| 39 | } |
| 40 | |
| 41 | void testCTF(int index) { |
| 42 | vec_ctf(vsi, index); //expected-error {{argument to '__builtin_altivec_vcfsx' must be a constant integer}} |
| 43 | vec_ctf(vui, index); //expected-error {{argument to '__builtin_altivec_vcfsx' must be a constant integer}} |
| 44 | } |
| 45 | |
| 46 | void testVCFSX(int index) { |
| 47 | vec_vcfsx(vsi, index); //expected-error {{argument to '__builtin_altivec_vcfsx' must be a constant integer}} |
| 48 | } |
| 49 | |
| 50 | void testVCFUX(int index) { |
| 51 | vec_vcfux(vui, index); //expected-error {{argument to '__builtin_altivec_vcfux' must be a constant integer}} |
| 52 | } |
| 53 | |
| 54 | void testCTS(int index) { |
| 55 | vec_cts(vf, index); //expected-error {{argument to '__builtin_altivec_vctsxs' must be a constant integer}} |
| 56 | |
| 57 | } |
| 58 | |
| 59 | void testVCTSXS(int index) { |
| 60 | vec_vctsxs(vf, index); //expected-error {{argument to '__builtin_altivec_vctsxs' must be a constant integer}} |
| 61 | } |
| 62 | |
| 63 | void testCTU(int index) { |
| 64 | vec_ctu(vf, index); //expected-error {{argument to '__builtin_altivec_vctuxs' must be a constant integer}} |
| 65 | |
| 66 | } |
| 67 | |
| 68 | void testVCTUXS(int index) { |
| 69 | vec_vctuxs(vf, index); //expected-error {{argument to '__builtin_altivec_vctuxs' must be a constant integer}} |
| 70 | } |
| 71 | |
| 72 | void testUnpack128(int index) { |
| 73 | __builtin_unpack_vector_int128(vsllli, index); //expected-error {{argument to '__builtin_unpack_vector_int128' must be a constant integer}} |
| 74 | __builtin_unpack_vector_int128(vsllli, 5); //expected-error {{argument value 5 is outside the valid range [0, 1]}} |
| 75 | } |
| 76 | |