Clang Project

clang_source_code/test/CodeGen/builtins-systemz-zvector2-error.c
1// REQUIRES: systemz-registered-target
2// RUN: %clang_cc1 -target-cpu z14 -triple s390x-linux-gnu \
3// RUN: -fzvector -fno-lax-vector-conversions \
4// RUN: -Wall -Wno-unused -Werror -fsyntax-only -verify %s
5
6#include <vecintrin.h>
7
8volatile vector signed char vsc;
9volatile vector signed short vss;
10volatile vector signed int vsi;
11volatile vector signed long long vsl;
12volatile vector unsigned char vuc;
13volatile vector unsigned short vus;
14volatile vector unsigned int vui;
15volatile vector unsigned long long vul;
16volatile vector bool char vbc;
17volatile vector bool short vbs;
18volatile vector bool int vbi;
19volatile vector bool long long vbl;
20volatile vector float vf;
21volatile vector double vd;
22
23volatile signed char sc;
24volatile signed short ss;
25volatile signed int si;
26volatile signed long long sl;
27volatile unsigned char uc;
28volatile unsigned short us;
29volatile unsigned int ui;
30volatile unsigned long long ul;
31volatile float f;
32volatile double d;
33
34const void * volatile cptr;
35const signed char * volatile cptrsc;
36const signed short * volatile cptrss;
37const signed int * volatile cptrsi;
38const signed long long * volatile cptrsl;
39const unsigned char * volatile cptruc;
40const unsigned short * volatile cptrus;
41const unsigned int * volatile cptrui;
42const unsigned long long * volatile cptrul;
43const float * volatile cptrf;
44const double * volatile cptrd;
45
46void * volatile ptr;
47signed char * volatile ptrsc;
48signed short * volatile ptrss;
49signed int * volatile ptrsi;
50signed long long * volatile ptrsl;
51unsigned char * volatile ptruc;
52unsigned short * volatile ptrus;
53unsigned int * volatile ptrui;
54unsigned long long * volatile ptrul;
55float * volatile ptrf;
56double * volatile ptrd;
57
58volatile unsigned int len;
59volatile int idx;
60int cc;
61
62void 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
121void 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
134void 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