1 // REQUIRES: systemz-registered-target
2 // RUN: %clang_cc1 -target-cpu z13 -triple s390x-unknown-unknown \
3 // RUN: -Wall -Wno-unused -Werror -fsyntax-only -verify %s
4 
5 typedef __attribute__((vector_size(16))) signed char vec_schar;
6 typedef __attribute__((vector_size(16))) signed short vec_sshort;
7 typedef __attribute__((vector_size(16))) signed int vec_sint;
8 typedef __attribute__((vector_size(16))) signed long long vec_slong;
9 typedef __attribute__((vector_size(16))) unsigned char vec_uchar;
10 typedef __attribute__((vector_size(16))) unsigned short vec_ushort;
11 typedef __attribute__((vector_size(16))) unsigned int vec_uint;
12 typedef __attribute__((vector_size(16))) unsigned long long vec_ulong;
13 typedef __attribute__((vector_size(16))) double vec_double;
14 
15 volatile vec_schar vsc;
16 volatile vec_sshort vss;
17 volatile vec_sint vsi;
18 volatile vec_slong vsl;
19 volatile vec_uchar vuc;
20 volatile vec_ushort vus;
21 volatile vec_uint vui;
22 volatile vec_ulong vul;
23 volatile vec_double vd;
24 
25 volatile unsigned int len;
26 const void * volatile cptr;
27 int cc;
28 
test_core(void)29 void test_core(void) {
30   __builtin_s390_lcbb(cptr, -1);       // expected-error {{argument should be a value from 0 to 15}}
31   __builtin_s390_lcbb(cptr, 16);       // expected-error {{argument should be a value from 0 to 15}}
32   __builtin_s390_lcbb(cptr, len);      // expected-error {{must be a constant integer}}
33 
34   __builtin_s390_vlbb(cptr, -1);       // expected-error {{argument should be a value from 0 to 15}}
35   __builtin_s390_vlbb(cptr, 16);       // expected-error {{argument should be a value from 0 to 15}}
36   __builtin_s390_vlbb(cptr, len);      // expected-error {{must be a constant integer}}
37 
38   __builtin_s390_vpdi(vul, vul, -1);   // expected-error {{argument should be a value from 0 to 15}}
39   __builtin_s390_vpdi(vul, vul, 16);   // expected-error {{argument should be a value from 0 to 15}}
40   __builtin_s390_vpdi(vul, vul, len);  // expected-error {{must be a constant integer}}
41 }
42 
test_integer(void)43 void test_integer(void) {
44   __builtin_s390_verimb(vuc, vuc, vuc, -1);    // expected-error {{argument should be a value from 0 to 255}}
45   __builtin_s390_verimb(vuc, vuc, vuc, 256);   // expected-error {{argument should be a value from 0 to 255}}
46   __builtin_s390_verimb(vuc, vuc, vuc, len);   // expected-error {{must be a constant integer}}
47 
48   __builtin_s390_verimh(vus, vus, vus, -1);    // expected-error {{argument should be a value from 0 to 255}}
49   __builtin_s390_verimh(vus, vus, vus, 256);   // expected-error {{argument should be a value from 0 to 255}}
50   __builtin_s390_verimh(vus, vus, vus, len);   // expected-error {{must be a constant integer}}
51 
52   __builtin_s390_verimf(vui, vui, vui, -1);    // expected-error {{argument should be a value from 0 to 255}}
53   __builtin_s390_verimf(vui, vui, vui, 256);   // expected-error {{argument should be a value from 0 to 255}}
54   __builtin_s390_verimf(vui, vui, vui, len);   // expected-error {{must be a constant integer}}
55 
56   __builtin_s390_verimg(vul, vul, vul, -1);    // expected-error {{argument should be a value from 0 to 255}}
57   __builtin_s390_verimg(vul, vul, vul, 256);   // expected-error {{argument should be a value from 0 to 255}}
58   __builtin_s390_verimg(vul, vul, vul, len);   // expected-error {{must be a constant integer}}
59 
60   __builtin_s390_vsldb(vuc, vuc, -1);          // expected-error {{argument should be a value from 0 to 15}}
61   __builtin_s390_vsldb(vuc, vuc, 16);          // expected-error {{argument should be a value from 0 to 15}}
62   __builtin_s390_vsldb(vuc, vuc, len);         // expected-error {{must be a constant integer}}
63 }
64 
test_string(void)65 void test_string(void) {
66   __builtin_s390_vfaeb(vuc, vuc, -1);               // expected-error {{argument should be a value from 0 to 15}}
67   __builtin_s390_vfaeb(vuc, vuc, 16);               // expected-error {{argument should be a value from 0 to 15}}
68   __builtin_s390_vfaeb(vuc, vuc, len);              // expected-error {{must be a constant integer}}
69 
70   __builtin_s390_vfaeh(vus, vus, -1);               // expected-error {{argument should be a value from 0 to 15}}
71   __builtin_s390_vfaeh(vus, vus, 16);               // expected-error {{argument should be a value from 0 to 15}}
72   __builtin_s390_vfaeh(vus, vus, len);              // expected-error {{must be a constant integer}}
73 
74   __builtin_s390_vfaef(vui, vui, -1);               // expected-error {{argument should be a value from 0 to 15}}
75   __builtin_s390_vfaef(vui, vui, 16);               // expected-error {{argument should be a value from 0 to 15}}
76   __builtin_s390_vfaef(vui, vui, len);              // expected-error {{must be a constant integer}}
77 
78   __builtin_s390_vfaezb(vuc, vuc, -1);              // expected-error {{argument should be a value from 0 to 15}}
79   __builtin_s390_vfaezb(vuc, vuc, 16);              // expected-error {{argument should be a value from 0 to 15}}
80   __builtin_s390_vfaezb(vuc, vuc, len);             // expected-error {{must be a constant integer}}
81 
82   __builtin_s390_vfaezh(vus, vus, -1);              // expected-error {{argument should be a value from 0 to 15}}
83   __builtin_s390_vfaezh(vus, vus, 16);              // expected-error {{argument should be a value from 0 to 15}}
84   __builtin_s390_vfaezh(vus, vus, len);             // expected-error {{must be a constant integer}}
85 
86   __builtin_s390_vfaezf(vui, vui, -1);              // expected-error {{argument should be a value from 0 to 15}}
87   __builtin_s390_vfaezf(vui, vui, 16);              // expected-error {{argument should be a value from 0 to 15}}
88   __builtin_s390_vfaezf(vui, vui, len);             // expected-error {{must be a constant integer}}
89 
90   __builtin_s390_vstrcb(vuc, vuc, vuc, -1);         // expected-error {{argument should be a value from 0 to 15}}
91   __builtin_s390_vstrcb(vuc, vuc, vuc, 16);         // expected-error {{argument should be a value from 0 to 15}}
92   __builtin_s390_vstrcb(vuc, vuc, vuc, len);        // expected-error {{must be a constant integer}}
93 
94   __builtin_s390_vstrch(vus, vus, vus, -1);         // expected-error {{argument should be a value from 0 to 15}}
95   __builtin_s390_vstrch(vus, vus, vus, 16);         // expected-error {{argument should be a value from 0 to 15}}
96   __builtin_s390_vstrch(vus, vus, vus, len);        // expected-error {{must be a constant integer}}
97 
98   __builtin_s390_vstrcf(vui, vui, vui, -1);         // expected-error {{argument should be a value from 0 to 15}}
99   __builtin_s390_vstrcf(vui, vui, vui, 16);         // expected-error {{argument should be a value from 0 to 15}}
100   __builtin_s390_vstrcf(vui, vui, vui, len);        // expected-error {{must be a constant integer}}
101 
102   __builtin_s390_vstrczb(vuc, vuc, vuc, -1);        // expected-error {{argument should be a value from 0 to 15}}
103   __builtin_s390_vstrczb(vuc, vuc, vuc, 16);        // expected-error {{argument should be a value from 0 to 15}}
104   __builtin_s390_vstrczb(vuc, vuc, vuc, len);       // expected-error {{must be a constant integer}}
105 
106   __builtin_s390_vstrczh(vus, vus, vus, -1);        // expected-error {{argument should be a value from 0 to 15}}
107   __builtin_s390_vstrczh(vus, vus, vus, 16);        // expected-error {{argument should be a value from 0 to 15}}
108   __builtin_s390_vstrczh(vus, vus, vus, len);       // expected-error {{must be a constant integer}}
109 
110   __builtin_s390_vstrczf(vui, vui, vui, -1);        // expected-error {{argument should be a value from 0 to 15}}
111   __builtin_s390_vstrczf(vui, vui, vui, 16);        // expected-error {{argument should be a value from 0 to 15}}
112   __builtin_s390_vstrczf(vui, vui, vui, len);       // expected-error {{must be a constant integer}}
113 
114   __builtin_s390_vfaebs(vuc, vuc, -1, &cc);         // expected-error {{argument should be a value from 0 to 15}}
115   __builtin_s390_vfaebs(vuc, vuc, 16, &cc);         // expected-error {{argument should be a value from 0 to 15}}
116   __builtin_s390_vfaebs(vuc, vuc, len, &cc);        // expected-error {{must be a constant integer}}
117 
118   __builtin_s390_vfaehs(vus, vus, -1, &cc);         // expected-error {{argument should be a value from 0 to 15}}
119   __builtin_s390_vfaehs(vus, vus, 16, &cc);         // expected-error {{argument should be a value from 0 to 15}}
120   __builtin_s390_vfaehs(vus, vus, len, &cc);        // expected-error {{must be a constant integer}}
121 
122   __builtin_s390_vfaefs(vui, vui, -1, &cc);         // expected-error {{argument should be a value from 0 to 15}}
123   __builtin_s390_vfaefs(vui, vui, 16, &cc);         // expected-error {{argument should be a value from 0 to 15}}
124   __builtin_s390_vfaefs(vui, vui, len, &cc);        // expected-error {{must be a constant integer}}
125 
126   __builtin_s390_vfaezbs(vuc, vuc, -1, &cc);        // expected-error {{argument should be a value from 0 to 15}}
127   __builtin_s390_vfaezbs(vuc, vuc, 16, &cc);        // expected-error {{argument should be a value from 0 to 15}}
128   __builtin_s390_vfaezbs(vuc, vuc, len, &cc);       // expected-error {{must be a constant integer}}
129 
130   __builtin_s390_vfaezhs(vus, vus, -1, &cc);        // expected-error {{argument should be a value from 0 to 15}}
131   __builtin_s390_vfaezhs(vus, vus, 16, &cc);        // expected-error {{argument should be a value from 0 to 15}}
132   __builtin_s390_vfaezhs(vus, vus, len, &cc);       // expected-error {{must be a constant integer}}
133 
134   __builtin_s390_vfaezfs(vui, vui, -1, &cc);        // expected-error {{argument should be a value from 0 to 15}}
135   __builtin_s390_vfaezfs(vui, vui, 16, &cc);        // expected-error {{argument should be a value from 0 to 15}}
136   __builtin_s390_vfaezfs(vui, vui, len, &cc);       // expected-error {{must be a constant integer}}
137 
138   __builtin_s390_vstrcbs(vuc, vuc, vuc, -1, &cc);   // expected-error {{argument should be a value from 0 to 15}}
139   __builtin_s390_vstrcbs(vuc, vuc, vuc, 16, &cc);   // expected-error {{argument should be a value from 0 to 15}}
140   __builtin_s390_vstrcbs(vuc, vuc, vuc, len, &cc);  // expected-error {{must be a constant integer}}
141 
142   __builtin_s390_vstrchs(vus, vus, vus, -1, &cc);   // expected-error {{argument should be a value from 0 to 15}}
143   __builtin_s390_vstrchs(vus, vus, vus, 16, &cc);   // expected-error {{argument should be a value from 0 to 15}}
144   __builtin_s390_vstrchs(vus, vus, vus, len, &cc);  // expected-error {{must be a constant integer}}
145 
146   __builtin_s390_vstrcfs(vui, vui, vui, -1, &cc);   // expected-error {{argument should be a value from 0 to 15}}
147   __builtin_s390_vstrcfs(vui, vui, vui, 16, &cc);   // expected-error {{argument should be a value from 0 to 15}}
148   __builtin_s390_vstrcfs(vui, vui, vui, len, &cc);  // expected-error {{must be a constant integer}}
149 
150   __builtin_s390_vstrczbs(vuc, vuc, vuc, -1, &cc);  // expected-error {{argument should be a value from 0 to 15}}
151   __builtin_s390_vstrczbs(vuc, vuc, vuc, 16, &cc);  // expected-error {{argument should be a value from 0 to 15}}
152   __builtin_s390_vstrczbs(vuc, vuc, vuc, len, &cc); // expected-error {{must be a constant integer}}
153 
154   __builtin_s390_vstrczhs(vus, vus, vus, -1, &cc);  // expected-error {{argument should be a value from 0 to 15}}
155   __builtin_s390_vstrczhs(vus, vus, vus, 16, &cc);  // expected-error {{argument should be a value from 0 to 15}}
156   __builtin_s390_vstrczhs(vus, vus, vus, len, &cc); // expected-error {{must be a constant integer}}
157 
158   __builtin_s390_vstrczfs(vui, vui, vui, -1, &cc);  // expected-error {{argument should be a value from 0 to 15}}
159   __builtin_s390_vstrczfs(vui, vui, vui, 16, &cc);  // expected-error {{argument should be a value from 0 to 15}}
160   __builtin_s390_vstrczfs(vui, vui, vui, len, &cc); // expected-error {{must be a constant integer}}
161 }
162 
test_float(void)163 void test_float(void) {
164   __builtin_s390_vftcidb(vd, -1, &cc);              // expected-error {{argument should be a value from 0 to 4095}}
165   __builtin_s390_vftcidb(vd, 4096, &cc);            // expected-error {{argument should be a value from 0 to 4095}}
166   __builtin_s390_vftcidb(vd, len, &cc);             // expected-error {{must be a constant integer}}
167 
168   __builtin_s390_vfidb(vd, -1, 0);                  // expected-error {{argument should be a value from 0 to 15}}
169   __builtin_s390_vfidb(vd, 16, 0);                  // expected-error {{argument should be a value from 0 to 15}}
170   __builtin_s390_vfidb(vd, len, 0);                 // expected-error {{must be a constant integer}}
171   __builtin_s390_vfidb(vd, 0, -1);                  // expected-error {{argument should be a value from 0 to 15}}
172   __builtin_s390_vfidb(vd, 0, 16);                  // expected-error {{argument should be a value from 0 to 15}}
173   __builtin_s390_vfidb(vd, 0, len);                 // expected-error {{must be a constant integer}}
174 }
175