1 // REQUIRES: powerpc-registered-target
3 // RUN: %clang_cc1 -target-feature +altivec -target-feature +power9-vector \
4 // RUN: -triple powerpc64-unknown-unknown -fsyntax-only \
5 // RUN: -flax-vector-conversions=integer \
6 // RUN: -Wall -Werror -verify %s
8 // RUN: %clang_cc1 -target-feature +altivec -target-feature +power9-vector \
9 // RUN: -triple powerpc64le-unknown-unknown -fsyntax-only \
10 // RUN: -flax-vector-conversions=integer \
11 // RUN: -Wall -Werror -verify %s
13 // RUN: %clang_cc1 -flax-vector-conversions=none -target-feature +altivec -target-feature +power9-vector \
14 // RUN: -triple powerpc64-unknown-unknown -fsyntax-only \
15 // RUN: -Wall -Werror -verify %s
19 extern vector
signed int vsi
;
20 extern vector
unsigned int vui
;
21 extern vector
float vf
;
22 extern vector
unsigned char vuc
;
23 extern vector
signed __int128 vsllli
;
25 void testInsertWord(void) {
27 vector
unsigned char v1
= vec_insert4b(vui
, vuc
, index
); // expected-error {{argument to '__builtin_vsx_insertword' must be a constant integer}}
28 vector
unsigned long long v2
= vec_extract4b(vuc
, index
); // expected-error {{argument to '__builtin_vsx_extractuword' must be a constant integer}}
31 void testXXPERMDI(int index
) {
32 vec_xxpermdi(vsi
); //expected-error {{too few arguments to function call, expected 3, have 1}}
33 vec_xxpermdi(vsi
, vsi
, 2, 4); //expected-error {{too many arguments to function call, expected 3, have 4}}
34 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)}}
35 vec_xxpermdi(1, 2, 3); //expected-error {{first two arguments to '__builtin_vsx_xxpermdi' must be vectors}}
36 vec_xxpermdi(vsi
, vuc
, 2); //expected-error {{first two arguments to '__builtin_vsx_xxpermdi' must have the same type}}
39 void testXXSLDWI(int index
) {
40 vec_xxsldwi(vsi
); //expected-error {{too few arguments to function call, expected 3, have 1}}
41 vec_xxsldwi(vsi
, vsi
, 2, 4); //expected-error {{too many arguments to function call, expected 3, have 4}}
42 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)}}
43 vec_xxsldwi(1, 2, 3); //expected-error {{first two arguments to '__builtin_vsx_xxsldwi' must be vectors}}
44 vec_xxsldwi(vsi
, vuc
, 2); //expected-error {{first two arguments to '__builtin_vsx_xxsldwi' must have the same type}}
47 void testCTF(int index
) {
48 vec_ctf(vsi
, index
); //expected-error {{argument to '__builtin_altivec_vcfsx' must be a constant integer}} expected-error {{argument to '__builtin_altivec_vcfux' must be a constant integer}}
49 vec_ctf(vui
, index
); //expected-error {{argument to '__builtin_altivec_vcfsx' must be a constant integer}} expected-error {{argument to '__builtin_altivec_vcfux' must be a constant integer}}
52 void testVCFSX(int index
) {
53 vec_vcfsx(vsi
, index
); //expected-error {{argument to '__builtin_altivec_vcfsx' must be a constant integer}}
56 void testVCFUX(int index
) {
57 vec_vcfux(vui
, index
); //expected-error {{argument to '__builtin_altivec_vcfux' must be a constant integer}}
60 void testCTS(int index
) {
61 vec_cts(vf
, index
); //expected-error {{argument to '__builtin_altivec_vctsxs' must be a constant integer}}
65 void testVCTSXS(int index
) {
66 vec_vctsxs(vf
, index
); //expected-error {{argument to '__builtin_altivec_vctsxs' must be a constant integer}}
69 void testCTU(int index
) {
70 vec_ctu(vf
, index
); //expected-error {{argument to '__builtin_altivec_vctuxs' must be a constant integer}}
74 void testVCTUXS(int index
) {
75 vec_vctuxs(vf
, index
); //expected-error {{argument to '__builtin_altivec_vctuxs' must be a constant integer}}
78 void testUnpack128(int index
) {
79 __builtin_unpack_vector_int128(vsllli
, index
); //expected-error {{argument to '__builtin_unpack_vector_int128' must be a constant integer}}
80 __builtin_unpack_vector_int128(vsllli
, 5); //expected-error {{argument value 5 is outside the valid range [0, 1]}}
83 void testDSS(int index
) {
84 vec_dss(index
); //expected-error {{argument to '__builtin_altivec_dss' must be a constant integer}}
85 vec_dss(5); //expected-error {{argument value 5 is outside the valid range [0, 3]}}
88 void testDST(int index
) {
89 vec_dst(&vsi
, index
, index
); //expected-error {{argument to '__builtin_altivec_dst' must be a constant integer}}
90 vec_dst(&vsi
, index
, 5); //expected-error {{argument value 5 is outside the valid range [0, 3]}}
91 vec_dstt(&vsi
, index
, index
); //expected-error {{argument to '__builtin_altivec_dstt' must be a constant integer}}
92 vec_dstt(&vsi
, index
, 5); //expected-error {{argument value 5 is outside the valid range [0, 3]}}
93 vec_dstst(&vsi
, index
, index
); //expected-error {{argument to '__builtin_altivec_dstst' must be a constant integer}}
94 vec_dstst(&vsi
, index
, 5); //expected-error {{argument value 5 is outside the valid range [0, 3]}}
95 vec_dststt(&vsi
, index
, index
); //expected-error {{argument to '__builtin_altivec_dststt' must be a constant integer}}
96 vec_dststt(&vsi
, index
, 5); //expected-error {{argument value 5 is outside the valid range [0, 3]}}