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 unsigned char vuc;
13 volatile vector unsigned short vus;
14 volatile vector unsigned int vui;
15 volatile vector unsigned long long vul;
16 volatile vector bool char vbc;
17 volatile vector bool short vbs;
18 volatile vector bool int vbi;
19 volatile vector bool long long vbl;
20 volatile vector float vf;
21 volatile vector double vd;
22 
23 volatile signed char sc;
24 volatile signed short ss;
25 volatile signed int si;
26 volatile signed long long sl;
27 volatile unsigned char uc;
28 volatile unsigned short us;
29 volatile unsigned int ui;
30 volatile unsigned long long ul;
31 volatile float f;
32 volatile double d;
33 
34 const void * volatile cptr;
35 const signed char * volatile cptrsc;
36 const signed short * volatile cptrss;
37 const signed int * volatile cptrsi;
38 const signed long long * volatile cptrsl;
39 const unsigned char * volatile cptruc;
40 const unsigned short * volatile cptrus;
41 const unsigned int * volatile cptrui;
42 const unsigned long long * volatile cptrul;
43 const float * volatile cptrf;
44 const double * volatile cptrd;
45 
46 void * volatile ptr;
47 signed char * volatile ptrsc;
48 signed short * volatile ptrss;
49 signed int * volatile ptrsi;
50 signed long long * volatile ptrsl;
51 unsigned char * volatile ptruc;
52 unsigned short * volatile ptrus;
53 unsigned int * volatile ptrui;
54 unsigned long long * volatile ptrul;
55 float * volatile ptrf;
56 double * volatile ptrd;
57 
58 volatile unsigned int len;
59 volatile int idx;
60 int cc;
61 
test_core(void)62 void test_core(void) {
63   vf = vec_gather_element(vf, vui, cptrf, idx);    // expected-error {{no matching function}}
64                                                    // expected-note@vecintrin.h:* 7 {{candidate function not viable}}
65                                                    // expected-note@vecintrin.h:* 1 {{must be a constant integer from 0 to 3}}
66   vf = vec_gather_element(vf, vui, cptrf, -1);     // expected-error {{no matching function}}
67                                                    // expected-note@vecintrin.h:* 7 {{candidate function not viable}}
68                                                    // expected-note@vecintrin.h:* 1 {{must be a constant integer from 0 to 3}}
69   vf = vec_gather_element(vf, vui, cptrf, 4);      // expected-error {{no matching function}}
70                                                    // expected-note@vecintrin.h:* 7 {{candidate function not viable}}
71                                                    // expected-note@vecintrin.h:* 1 {{must be a constant integer from 0 to 3}}
72   vd = vec_gather_element(vd, vul, cptrd, idx);    // expected-error {{no matching function}}
73                                                    // expected-note@vecintrin.h:* 7 {{candidate function not viable}}
74                                                    // expected-note@vecintrin.h:* 1 {{must be a constant integer from 0 to 1}}
75   vd = vec_gather_element(vd, vul, cptrd, -1);     // expected-error {{no matching function}}
76                                                    // expected-note@vecintrin.h:* 7 {{candidate function not viable}}
77                                                    // expected-note@vecintrin.h:* 1 {{must be a constant integer from 0 to 1}}
78   vd = vec_gather_element(vd, vul, cptrd, 2);      // expected-error {{no matching function}}
79                                                    // expected-note@vecintrin.h:* 7 {{candidate function not viable}}
80                                                    // expected-note@vecintrin.h:* 1 {{must be a constant integer from 0 to 1}}
81 
82   vec_scatter_element(vf, vui, ptrf, idx);   // expected-error {{no matching function}}
83                                              // expected-note@vecintrin.h:* 7 {{candidate function not viable}}
84                                              // expected-note@vecintrin.h:* 1 {{must be a constant integer from 0 to 3}}
85   vec_scatter_element(vf, vui, ptrf, -1);    // expected-error {{no matching function}}
86                                              // expected-note@vecintrin.h:* 7 {{candidate function not viable}}
87                                              // expected-note@vecintrin.h:* 1 {{must be a constant integer from 0 to 3}}
88   vec_scatter_element(vf, vui, ptrf, 4);     // expected-error {{no matching function}}
89                                              // expected-note@vecintrin.h:* 7 {{candidate function not viable}}
90                                              // expected-note@vecintrin.h:* 1 {{must be a constant integer from 0 to 3}}
91   vec_scatter_element(vd, vul, ptrd, idx);   // expected-error {{no matching function}}
92                                              // expected-note@vecintrin.h:* 7 {{candidate function not viable}}
93                                              // expected-note@vecintrin.h:* 1 {{must be a constant integer from 0 to 1}}
94   vec_scatter_element(vd, vul, ptrd, -1);    // expected-error {{no matching function}}
95                                              // expected-note@vecintrin.h:* 7 {{candidate function not viable}}
96                                              // expected-note@vecintrin.h:* 1 {{must be a constant integer from 0 to 1}}
97   vec_scatter_element(vd, vul, ptrd, 2);     // expected-error {{no matching function}}
98                                              // expected-note@vecintrin.h:* 7 {{candidate function not viable}}
99                                              // expected-note@vecintrin.h:* 1 {{must be a constant integer from 0 to 1}}
100 
101   vf = vec_splat(vf, idx);   // expected-error {{no matching function}}
102                              // expected-note@vecintrin.h:* 13 {{candidate function not viable}}
103                              // expected-note@vecintrin.h:* 1 {{must be a constant integer from 0 to 3}}
104   vf = vec_splat(vf, -1);    // expected-error {{no matching function}}
105                              // expected-note@vecintrin.h:* 13 {{candidate function not viable}}
106                              // expected-note@vecintrin.h:* 1 {{must be a constant integer from 0 to 3}}
107   vf = vec_splat(vf, 4);     // expected-error {{no matching function}}
108                              // expected-note@vecintrin.h:* 13 {{candidate function not viable}}
109                              // expected-note@vecintrin.h:* 1 {{must be a constant integer from 0 to 3}}
110   vd = vec_splat(vd, idx);   // expected-error {{no matching function}}
111                              // expected-note@vecintrin.h:* 13 {{candidate function not viable}}
112                              // expected-note@vecintrin.h:* 1 {{must be a constant integer from 0 to 1}}
113   vd = vec_splat(vd, -1);    // expected-error {{no matching function}}
114                              // expected-note@vecintrin.h:* 13 {{candidate function not viable}}
115                              // expected-note@vecintrin.h:* 1 {{must be a constant integer from 0 to 1}}
116   vd = vec_splat(vd, 2);     // expected-error {{no matching function}}
117                              // expected-note@vecintrin.h:* 13 {{candidate function not viable}}
118                              // expected-note@vecintrin.h:* 1 {{must be a constant integer from 0 to 1}}
119 }
120 
test_integer(void)121 void test_integer(void) {
122   vf = vec_sld(vf, vf, idx);    // expected-error {{no matching function}}
123                                 // expected-note@vecintrin.h:* 13 {{candidate function not viable}}
124                                 // expected-note@vecintrin.h:* 1 {{must be a constant integer from 0 to 15}}
125   vd = vec_sld(vd, vd, idx);    // expected-error {{no matching function}}
126                                 // expected-note@vecintrin.h:* 13 {{candidate function not viable}}
127                                 // expected-note@vecintrin.h:* 1 {{must be a constant integer from 0 to 15}}
128 
129   vuc = vec_msum_u128(vul, vul, vuc, idx);  // expected-error {{must be a constant integer}}
130   vuc = vec_msum_u128(vul, vul, vuc, -1);   // expected-error-re {{argument value {{.*}} is outside the valid range}}
131   vuc = vec_msum_u128(vul, vul, vuc, 16);   // expected-error-re {{argument value {{.*}} is outside the valid range}}
132 }
133 
test_float(void)134 void test_float(void) {
135   vbi = vec_fp_test_data_class(vf, idx, &cc);   // expected-error {{no matching function}}
136                                                 // expected-note@vecintrin.h:* 1 {{candidate function not viable}}
137                                                 // expected-note@vecintrin.h:* 1 {{must be a constant integer from 0 to 4095}}
138   vbi = vec_fp_test_data_class(vf, -1, &cc);    // expected-error {{no matching function}}
139                                                 // expected-note@vecintrin.h:* 1 {{candidate function not viable}}
140                                                 // expected-note@vecintrin.h:* 1 {{must be a constant integer from 0 to 4095}}
141   vbi = vec_fp_test_data_class(vf, 4096, &cc);  // expected-error {{no matching function}}
142                                                 // expected-note@vecintrin.h:* 1 {{candidate function not viable}}
143                                                 // expected-note@vecintrin.h:* 1 {{must be a constant integer from 0 to 4095}}
144   vbl = vec_fp_test_data_class(vd, idx, &cc);   // expected-error {{no matching function}}
145                                                 // expected-note@vecintrin.h:* 1 {{candidate function not viable}}
146                                                 // expected-note@vecintrin.h:* 1 {{must be a constant integer from 0 to 4095}}
147   vbl = vec_fp_test_data_class(vd, -1, &cc);    // expected-error {{no matching function}}
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   vbl = vec_fp_test_data_class(vd, 4096, &cc);  // expected-error {{no matching function}}
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 }
154