xref: /llvm-project/clang/test/CodeGen/SystemZ/builtins-systemz-zvector2-error.c (revision 8424bf207efd89eacf2fe893b67be98d535e1db6)
1 // REQUIRES: systemz-registered-target
2 // RUN: %clang_cc1 -target-cpu z14 -triple s390x-linux-gnu \
3 // RUN: -fzvector -flax-vector-conversions=none \
4 // RUN: -Wall -Wno-unused -Werror -fsyntax-only -verify %s
5 
6 #include <vecintrin.h>
7 
8 volatile vector signed char vsc;
9 volatile vector signed short vss;
10 volatile vector signed int vsi;
11 volatile vector signed long long vsl;
12 volatile vector signed __int128 vslll;
13 volatile vector unsigned char vuc;
14 volatile vector unsigned short vus;
15 volatile vector unsigned int vui;
16 volatile vector unsigned long long vul;
17 volatile vector unsigned __int128 vulll;
18 volatile vector bool char vbc;
19 volatile vector bool short vbs;
20 volatile vector bool int vbi;
21 volatile vector bool long long vbl;
22 volatile vector float vf;
23 volatile vector double vd;
24 
25 volatile signed char sc;
26 volatile signed short ss;
27 volatile signed int si;
28 volatile signed long long sl;
29 volatile unsigned char uc;
30 volatile unsigned short us;
31 volatile unsigned int ui;
32 volatile unsigned long long ul;
33 volatile float f;
34 volatile double d;
35 
36 const void * volatile cptr;
37 const signed char * volatile cptrsc;
38 const signed short * volatile cptrss;
39 const signed int * volatile cptrsi;
40 const signed long long * volatile cptrsl;
41 const unsigned char * volatile cptruc;
42 const unsigned short * volatile cptrus;
43 const unsigned int * volatile cptrui;
44 const unsigned long long * volatile cptrul;
45 const float * volatile cptrf;
46 const double * volatile cptrd;
47 
48 void * volatile ptr;
49 signed char * volatile ptrsc;
50 signed short * volatile ptrss;
51 signed int * volatile ptrsi;
52 signed long long * volatile ptrsl;
53 unsigned char * volatile ptruc;
54 unsigned short * volatile ptrus;
55 unsigned int * volatile ptrui;
56 unsigned long long * volatile ptrul;
57 float * volatile ptrf;
58 double * volatile ptrd;
59 
60 volatile unsigned int len;
61 volatile int idx;
62 int cc;
63 
64 void test_core(void) {
65   vf = vec_gather_element(vf, vui, cptrf, idx);    // expected-error {{no matching function}}
66                                                    // expected-note@vecintrin.h:* 7 {{candidate function not viable}}
67                                                    // expected-note@vecintrin.h:* 1 {{must be a constant integer from 0 to 3}}
68   vf = vec_gather_element(vf, vui, cptrf, -1);     // expected-error {{no matching function}}
69                                                    // expected-note@vecintrin.h:* 7 {{candidate function not viable}}
70                                                    // expected-note@vecintrin.h:* 1 {{must be a constant integer from 0 to 3}}
71   vf = vec_gather_element(vf, vui, cptrf, 4);      // expected-error {{no matching function}}
72                                                    // expected-note@vecintrin.h:* 7 {{candidate function not viable}}
73                                                    // expected-note@vecintrin.h:* 1 {{must be a constant integer from 0 to 3}}
74   vd = vec_gather_element(vd, vul, cptrd, idx);    // expected-error {{no matching function}}
75                                                    // expected-note@vecintrin.h:* 7 {{candidate function not viable}}
76                                                    // expected-note@vecintrin.h:* 1 {{must be a constant integer from 0 to 1}}
77   vd = vec_gather_element(vd, vul, cptrd, -1);     // expected-error {{no matching function}}
78                                                    // expected-note@vecintrin.h:* 7 {{candidate function not viable}}
79                                                    // expected-note@vecintrin.h:* 1 {{must be a constant integer from 0 to 1}}
80   vd = vec_gather_element(vd, vul, cptrd, 2);      // expected-error {{no matching function}}
81                                                    // expected-note@vecintrin.h:* 7 {{candidate function not viable}}
82                                                    // expected-note@vecintrin.h:* 1 {{must be a constant integer from 0 to 1}}
83 
84   vec_scatter_element(vf, vui, ptrf, idx);   // expected-error {{no matching function}}
85                                              // expected-note@vecintrin.h:* 7 {{candidate function not viable}}
86                                              // expected-note@vecintrin.h:* 1 {{must be a constant integer from 0 to 3}}
87   vec_scatter_element(vf, vui, ptrf, -1);    // expected-error {{no matching function}}
88                                              // expected-note@vecintrin.h:* 7 {{candidate function not viable}}
89                                              // expected-note@vecintrin.h:* 1 {{must be a constant integer from 0 to 3}}
90   vec_scatter_element(vf, vui, ptrf, 4);     // expected-error {{no matching function}}
91                                              // expected-note@vecintrin.h:* 7 {{candidate function not viable}}
92                                              // expected-note@vecintrin.h:* 1 {{must be a constant integer from 0 to 3}}
93   vec_scatter_element(vd, vul, ptrd, idx);   // expected-error {{no matching function}}
94                                              // expected-note@vecintrin.h:* 7 {{candidate function not viable}}
95                                              // expected-note@vecintrin.h:* 1 {{must be a constant integer from 0 to 1}}
96   vec_scatter_element(vd, vul, ptrd, -1);    // expected-error {{no matching function}}
97                                              // expected-note@vecintrin.h:* 7 {{candidate function not viable}}
98                                              // expected-note@vecintrin.h:* 1 {{must be a constant integer from 0 to 1}}
99   vec_scatter_element(vd, vul, ptrd, 2);     // expected-error {{no matching function}}
100                                              // expected-note@vecintrin.h:* 7 {{candidate function not viable}}
101                                              // expected-note@vecintrin.h:* 1 {{must be a constant integer from 0 to 1}}
102 
103   vf = vec_splat(vf, idx);   // expected-error {{no matching function}}
104                              // expected-note@vecintrin.h:* 13 {{candidate function not viable}}
105                              // expected-note@vecintrin.h:* 1 {{must be a constant integer from 0 to 3}}
106   vf = vec_splat(vf, -1);    // expected-error {{no matching function}}
107                              // expected-note@vecintrin.h:* 13 {{candidate function not viable}}
108                              // expected-note@vecintrin.h:* 1 {{must be a constant integer from 0 to 3}}
109   vf = vec_splat(vf, 4);     // expected-error {{no matching function}}
110                              // expected-note@vecintrin.h:* 13 {{candidate function not viable}}
111                              // expected-note@vecintrin.h:* 1 {{must be a constant integer from 0 to 3}}
112   vd = vec_splat(vd, idx);   // expected-error {{no matching function}}
113                              // expected-note@vecintrin.h:* 13 {{candidate function not viable}}
114                              // expected-note@vecintrin.h:* 1 {{must be a constant integer from 0 to 1}}
115   vd = vec_splat(vd, -1);    // expected-error {{no matching function}}
116                              // expected-note@vecintrin.h:* 13 {{candidate function not viable}}
117                              // expected-note@vecintrin.h:* 1 {{must be a constant integer from 0 to 1}}
118   vd = vec_splat(vd, 2);     // expected-error {{no matching function}}
119                              // expected-note@vecintrin.h:* 13 {{candidate function not viable}}
120                              // expected-note@vecintrin.h:* 1 {{must be a constant integer from 0 to 1}}
121 }
122 
123 void test_integer(void) {
124   vf = vec_sld(vf, vf, idx); // expected-error {{no matching function}} expected-error {{argument to '__builtin_s390_vsldb' must be a constant integer}}
125                              // expected-note@vecintrin.h:* 15 {{candidate function not viable}}
126                              // expected-note@vecintrin.h:* 1 {{must be a constant integer from 0 to 15}}
127   vd = vec_sld(vd, vd, idx); // expected-error {{no matching function}} expected-error {{argument to '__builtin_s390_vsldb' must be a constant integer}}
128                              // expected-note@vecintrin.h:* 15 {{candidate function not viable}}
129                              // expected-note@vecintrin.h:* 1 {{must be a constant integer from 0 to 15}}
130 
131   vulll = vec_msum(vul, vul, vulll, idx);   // expected-error {{no matching function}} expected-error {{argument to '__builtin_s390_vmslg' must be a constant integer}}
132                                             // expected-note@vecintrin.h:* 1 {{must be a constant integer from 0 to 15}}
133   vulll = vec_msum(vul, vul, vulll, -1);    // expected-error {{no matching function}} expected-error {{argument value -1 is outside the valid range [0, 15]}}
134                                             // expected-note@vecintrin.h:* 1 {{must be a constant integer from 0 to 15}}
135   vulll = vec_msum(vul, vul, vulll, 16);    // expected-error {{no matching function}} expected-error {{argument value 16 is outside the valid range [0, 15]}}
136                                             // expected-note@vecintrin.h:* 1 {{must be a constant integer from 0 to 15}}
137 
138   vuc = vec_msum_u128(vul, vul, vuc, idx);  // expected-error {{no matching function}} expected-error {{argument to '__builtin_s390_vmslg' must be a constant integer}}
139                                             // expected-note@vecintrin.h:* 1 {{must be a constant integer from 0 to 15}}
140   vuc = vec_msum_u128(vul, vul, vuc, -1);   // expected-error {{no matching function}} expected-error {{argument value -1 is outside the valid range [0, 15]}}
141                                             // expected-note@vecintrin.h:* 1 {{must be a constant integer from 0 to 15}}
142   vuc = vec_msum_u128(vul, vul, vuc, 16);   // expected-error {{no matching function}} expected-error {{argument value 16 is outside the valid range [0, 15]}}
143                                             // expected-note@vecintrin.h:* 1 {{must be a constant integer from 0 to 15}}
144 }
145 
146 void test_float(void) {
147   vbi = vec_fp_test_data_class(vf, idx, &cc);  // expected-error {{no matching function}} expected-error {{argument to '__builtin_s390_vftcisb' must be a constant integer}} expected-error {{argument to '__builtin_s390_vftcidb' must be a constant integer}}
148                                                // expected-note@vecintrin.h:* 1 {{candidate function not viable}}
149                                                // expected-note@vecintrin.h:* 1 {{must be a constant integer from 0 to 4095}}
150   vbi = vec_fp_test_data_class(vf, -1, &cc);   // expected-error {{no matching function}} expected-error 2{{argument value -1 is outside the valid range [0, 4095]}}
151                                                // expected-note@vecintrin.h:* 1 {{candidate function not viable}}
152                                                // expected-note@vecintrin.h:* 1 {{must be a constant integer from 0 to 4095}}
153   vbi = vec_fp_test_data_class(vf, 4096, &cc); // expected-error {{no matching function}} expected-error 2{{argument value 4096 is outside the valid range [0, 4095]}}
154                                                // expected-note@vecintrin.h:* 1 {{candidate function not viable}}
155                                                // expected-note@vecintrin.h:* 1 {{must be a constant integer from 0 to 4095}}
156   vbl = vec_fp_test_data_class(vd, idx, &cc);  // expected-error {{no matching function}} expected-error {{argument to '__builtin_s390_vftcisb' must be a constant integer}} expected-error {{argument to '__builtin_s390_vftcidb' must be a constant integer}}
157                                                // expected-note@vecintrin.h:* 1 {{candidate function not viable}}
158                                                // expected-note@vecintrin.h:* 1 {{must be a constant integer from 0 to 4095}}
159   vbl = vec_fp_test_data_class(vd, -1, &cc);   // expected-error {{no matching function}} expected-error 2{{argument value -1 is outside the valid range [0, 4095]}}
160                                                // expected-note@vecintrin.h:* 1 {{candidate function not viable}}
161                                                // expected-note@vecintrin.h:* 1 {{must be a constant integer from 0 to 4095}}
162   vbl = vec_fp_test_data_class(vd, 4096, &cc); // expected-error {{no matching function}} expected-error 2{{argument value 4096 is outside the valid range [0, 4095]}}
163                                                // expected-note@vecintrin.h:* 1 {{candidate function not viable}}
164                                                // expected-note@vecintrin.h:* 1 {{must be a constant integer from 0 to 4095}}
165 }
166