Mercurial > hg > CbC > CbC_gcc
comparison gcc/testsuite/g++.target/aarch64/sve/acle/general-c++/gnu_vectors_2.C @ 145:1830386684a0
gcc-9.2.0
author | anatofuz |
---|---|
date | Thu, 13 Feb 2020 11:34:05 +0900 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
131:84e7813d76e9 | 145:1830386684a0 |
---|---|
1 // { dg-options "-msve-vector-bits=256 -std=gnu++2a -flax-vector-conversions" } | |
2 | |
3 #include <arm_sve.h> | |
4 | |
5 typedef uint8_t gnu_uint8_t __attribute__ ((vector_size (32))); | |
6 typedef int8_t gnu_int8_t __attribute__ ((vector_size (32))); | |
7 | |
8 void | |
9 f (svuint8_t sve_u1, svint8_t sve_s1, | |
10 gnu_uint8_t gnu_u1, gnu_int8_t gnu_s1, int n, unsigned char uc) | |
11 { | |
12 // Initialization | |
13 | |
14 svuint8_t init_sve_u1 = 0; // { dg-error {cannot convert 'int' to 'svuint8_t' in initialization} } | |
15 svuint8_t init_sve_u2 = {}; | |
16 svuint8_t init_sve_u3 = { sve_u1 }; | |
17 svuint8_t init_sve_u4 = { gnu_u1 }; | |
18 svuint8_t init_sve_u5 = { sve_s1 }; | |
19 svuint8_t init_sve_u6 = { gnu_s1 }; | |
20 svuint8_t init_sve_u7 = { 0 }; // { dg-error {cannot convert 'int' to 'svuint8_t' in initialization} } | |
21 svuint8_t init_sve_u8 = { sve_u1, sve_u1 }; // { dg-error {too many initializers for 'svuint8_t'} } | |
22 svuint8_t init_sve_u9 = { gnu_u1, gnu_u1 }; // { dg-error {too many initializers for 'svuint8_t'} } | |
23 svuint8_t init_sve_u10 {}; | |
24 svuint8_t init_sve_u11 { sve_u1 }; | |
25 svuint8_t init_sve_u12 { gnu_u1 }; | |
26 svuint8_t init_sve_u13 { sve_s1 }; | |
27 svuint8_t init_sve_u14 { gnu_s1 }; | |
28 svuint8_t init_sve_u15 { 0 }; // { dg-error {cannot convert 'int' to 'svuint8_t' in initialization} } | |
29 svuint8_t init_sve_u16 { sve_u1, sve_u1 }; // { dg-error {too many initializers for 'svuint8_t'} } | |
30 svuint8_t init_sve_u17 { gnu_u1, gnu_u1 }; // { dg-error {too many initializers for 'svuint8_t'} } | |
31 svuint8_t init_sve_u18 (0); // { dg-error {cannot convert 'int' to 'svuint8_t' in initialization} } | |
32 svuint8_t init_sve_u19 (sve_u1); | |
33 svuint8_t init_sve_u20 (gnu_u1); | |
34 svuint8_t init_sve_u21 (sve_s1); | |
35 svuint8_t init_sve_u22 (gnu_s1); | |
36 | |
37 gnu_uint8_t init_gnu_u1 = 0; // { dg-error {cannot convert 'int' to 'gnu_uint8_t'[^\n]* in initialization} } | |
38 gnu_uint8_t init_gnu_u2 = {}; | |
39 gnu_uint8_t init_gnu_u3 = { sve_u1 }; // { dg-error {cannot convert 'svuint8_t' to 'unsigned char' in initialization} } | |
40 gnu_uint8_t init_gnu_u4 = { gnu_u1 }; | |
41 gnu_uint8_t init_gnu_u5 = { sve_s1 }; // { dg-error {cannot convert 'svint8_t' to 'unsigned char' in initialization} } | |
42 gnu_uint8_t init_gnu_u6 = { gnu_s1 }; // { dg-error {cannot convert 'gnu_int8_t'[^\n]* to 'unsigned char' in initialization} } | |
43 gnu_uint8_t init_gnu_u7 = { 0 }; | |
44 gnu_uint8_t init_gnu_u8 = { sve_u1, sve_u1 }; // { dg-error {cannot convert 'svuint8_t' to 'unsigned char' in initialization} } | |
45 gnu_uint8_t init_gnu_u9 = { gnu_u1, gnu_u1 }; // { dg-error {cannot convert 'gnu_uint8_t'[^\n]* to 'unsigned char' in initialization} } | |
46 gnu_uint8_t init_gnu_u10 { sve_u1 }; // { dg-error {cannot convert 'svuint8_t' to 'unsigned char' in initialization} } | |
47 gnu_uint8_t init_gnu_u11 { gnu_u1 }; | |
48 gnu_uint8_t init_gnu_u12 { sve_s1 }; // { dg-error {cannot convert 'svint8_t' to 'unsigned char' in initialization} } | |
49 gnu_uint8_t init_gnu_u13 { gnu_s1 }; // { dg-error {cannot convert 'gnu_int8_t'[^\n]* to 'unsigned char' in initialization} } | |
50 gnu_uint8_t init_gnu_u14 { 0 }; | |
51 gnu_uint8_t init_gnu_u15 { sve_u1, sve_u1 }; // { dg-error {cannot convert 'svuint8_t' to 'unsigned char' in initialization} } | |
52 gnu_uint8_t init_gnu_u16 { gnu_u1, gnu_u1 }; // { dg-error {cannot convert 'gnu_uint8_t'[^\n]* to 'unsigned char' in initialization} } | |
53 gnu_uint8_t init_gnu_u17 (0); // { dg-error {cannot convert 'int' to 'gnu_uint8_t'[^\n]* in initialization} } | |
54 gnu_uint8_t init_gnu_u18 (sve_u1); | |
55 gnu_uint8_t init_gnu_u19 (gnu_u1); | |
56 gnu_uint8_t init_gnu_u20 (sve_s1); | |
57 gnu_uint8_t init_gnu_u21 (gnu_s1); | |
58 | |
59 // Compound literals | |
60 | |
61 (svuint8_t) {}; | |
62 (svuint8_t) { 0 }; // { dg-error {cannot convert 'int' to 'svuint8_t' in initialization} } | |
63 (svuint8_t) { sve_u1 }; | |
64 (svuint8_t) { gnu_u1 }; | |
65 (svuint8_t) { sve_s1 }; | |
66 (svuint8_t) { gnu_s1 }; | |
67 (svuint8_t) { sve_u1, sve_u1 }; // { dg-error {too many initializers for 'svuint8_t'} } | |
68 (svuint8_t) { gnu_u1, gnu_u1 }; // { dg-error {too many initializers for 'svuint8_t'} } | |
69 | |
70 (gnu_uint8_t) {}; | |
71 (gnu_uint8_t) { 0 }; | |
72 (gnu_uint8_t) { sve_u1 }; // { dg-error {cannot convert 'svuint8_t' to 'unsigned char' in initialization} } | |
73 (gnu_uint8_t) { gnu_u1 }; | |
74 (gnu_uint8_t) { sve_s1 }; // { dg-error {cannot convert 'svint8_t' to 'unsigned char' in initialization} } | |
75 (gnu_uint8_t) { gnu_s1 }; // { dg-error {cannot convert 'gnu_int8_t'[^\n]* to 'unsigned char' in initialization} } | |
76 (gnu_uint8_t) { sve_u1, sve_u1 }; // { dg-error {cannot convert 'svuint8_t' to 'unsigned char' in initialization} } | |
77 (gnu_uint8_t) { gnu_u1, gnu_u1 }; // { dg-error {cannot convert 'gnu_uint8_t'[^\n]* to 'unsigned char' in initialization} } | |
78 | |
79 // Assignment | |
80 | |
81 sve_u1 = 0; // { dg-error {cannot convert 'int' to 'svuint8_t' in assignment} } | |
82 sve_u1 = sve_u1; | |
83 sve_u1 = gnu_u1; | |
84 sve_u1 = sve_s1; | |
85 sve_u1 = gnu_s1; | |
86 | |
87 gnu_u1 = 0; // { dg-error {cannot convert 'int' to 'gnu_uint8_t'[^\n]* in assignment} } | |
88 gnu_u1 = sve_u1; | |
89 gnu_u1 = gnu_u1; | |
90 gnu_u1 = sve_s1; | |
91 gnu_u1 = gnu_s1; | |
92 | |
93 // Casts | |
94 | |
95 (void) sve_u1; | |
96 (int) sve_u1; // { dg-error {invalid cast from type 'svuint8_t' to type 'int'} } | |
97 (bool) sve_u1; // { dg-error {invalid cast from type 'svuint8_t' to type 'bool'} } | |
98 (svuint8_t) 0; // { dg-error {invalid cast from type 'int' to type 'svuint8_t'} } | |
99 (svuint8_t) n; // { dg-error {invalid cast from type 'int' to type 'svuint8_t'} } | |
100 (svuint8_t) sve_u1; | |
101 (svuint8_t) gnu_u1; | |
102 (svuint8_t) sve_s1; | |
103 (svuint8_t) gnu_s1; | |
104 | |
105 (void) gnu_u1; | |
106 (int) gnu_u1; // { dg-error {cannot convert a vector of type 'gnu_uint8_t'[^\n]* to type 'int'} } | |
107 (bool) gnu_u1; // { dg-error {cannot convert a vector of type 'gnu_uint8_t'[^\n]* to type 'bool'} } | |
108 (gnu_uint8_t) 0; // { dg-error {cannot convert a value of type 'int' to vector type 'gnu_uint8_t'} } | |
109 (gnu_uint8_t) n; // { dg-error {cannot convert a value of type 'int' to vector type 'gnu_uint8_t'} } | |
110 (gnu_uint8_t) sve_u1; | |
111 (gnu_uint8_t) gnu_u1; | |
112 (gnu_uint8_t) sve_s1; | |
113 (gnu_uint8_t) gnu_s1; | |
114 | |
115 // Vector indexing. | |
116 | |
117 sve_u1[0]; // { dg-error {subscripted value is neither array nor pointer} } | |
118 &sve_u1[0]; // { dg-error {subscripted value is neither array nor pointer} } | |
119 | |
120 gnu_u1[0]; | |
121 &gnu_u1[0]; | |
122 | |
123 // Unary vector arithmetic. | |
124 | |
125 +sve_u1; // { dg-error {wrong type argument to unary plus} } | |
126 -sve_u1; // { dg-error {wrong type argument to unary minus} } | |
127 ~sve_u1; // { dg-error {wrong type argument to bit-complement} } | |
128 !sve_u1; // { dg-error {could not convert 'sve_u1' from 'svuint8_t' to 'bool'} } | |
129 // { dg-error {in argument to unary !} "" { target *-*-* } .-1 } | |
130 *sve_u1; // { dg-error {invalid type argument of unary '\*'} } | |
131 __real sve_u1; // { dg-error {wrong type argument to __real} } | |
132 __imag sve_u1; // { dg-error {wrong type argument to __imag} } | |
133 ++sve_u1; // { dg-error {no pre-increment operator for type} } | |
134 --sve_u1; // { dg-error {no pre-decrement operator for type} } | |
135 sve_u1++; // { dg-error {no post-increment operator for type} } | |
136 sve_u1--; // { dg-error {no post-decrement operator for type} } | |
137 | |
138 +gnu_u1; | |
139 -gnu_u1; | |
140 ~gnu_u1; | |
141 !gnu_u1; | |
142 *gnu_u1; // { dg-error {invalid type argument of unary '\*'} } | |
143 __real gnu_u1; // { dg-error {wrong type argument to __real} } | |
144 __imag gnu_u1; // { dg-error {wrong type argument to __imag} } | |
145 ++gnu_u1; | |
146 --gnu_u1; | |
147 gnu_u1++; | |
148 gnu_u1--; | |
149 | |
150 // Vector-vector binary arithmetic. | |
151 | |
152 sve_u1 + sve_u1; // { dg-error {invalid operands of types 'svuint8_t' and 'svuint8_t' to binary 'operator\+'} } | |
153 sve_u1 - sve_u1; // { dg-error {invalid operands of types 'svuint8_t' and 'svuint8_t' to binary 'operator-'} } | |
154 sve_u1 * sve_u1; // { dg-error {invalid operands of types 'svuint8_t' and 'svuint8_t' to binary 'operator\*'} } | |
155 sve_u1 / sve_u1; // { dg-error {invalid operands of types 'svuint8_t' and 'svuint8_t' to binary 'operator/'} } | |
156 sve_u1 % sve_u1; // { dg-error {invalid operands of types 'svuint8_t' and 'svuint8_t' to binary 'operator%'} } | |
157 sve_u1 & sve_u1; // { dg-error {invalid operands of types 'svuint8_t' and 'svuint8_t' to binary 'operator\&'} } | |
158 sve_u1 | sve_u1; // { dg-error {invalid operands of types 'svuint8_t' and 'svuint8_t' to binary 'operator\|'} } | |
159 sve_u1 ^ sve_u1; // { dg-error {invalid operands of types 'svuint8_t' and 'svuint8_t' to binary 'operator\^'} } | |
160 sve_u1 == sve_u1; // { dg-error {invalid operands of types 'svuint8_t' and 'svuint8_t' to binary 'operator=='} } | |
161 sve_u1 != sve_u1; // { dg-error {invalid operands of types 'svuint8_t' and 'svuint8_t' to binary 'operator!='} } | |
162 sve_u1 <= sve_u1; // { dg-error {invalid operands of types 'svuint8_t' and 'svuint8_t' to binary 'operator<='} } | |
163 sve_u1 < sve_u1; // { dg-error {invalid operands of types 'svuint8_t' and 'svuint8_t' to binary 'operator<'} } | |
164 sve_u1 > sve_u1; // { dg-error {invalid operands of types 'svuint8_t' and 'svuint8_t' to binary 'operator>'} } | |
165 sve_u1 >= sve_u1; // { dg-error {invalid operands of types 'svuint8_t' and 'svuint8_t' to binary 'operator>='} } | |
166 sve_u1 <=> sve_u1; // { dg-error {invalid operands of types 'svuint8_t' and 'svuint8_t' to binary 'operator<=>'} } | |
167 sve_u1 << sve_u1; // { dg-error {invalid operands of types 'svuint8_t' and 'svuint8_t' to binary 'operator<<'} } | |
168 sve_u1 >> sve_u1; // { dg-error {invalid operands of types 'svuint8_t' and 'svuint8_t' to binary 'operator>>'} } | |
169 sve_u1 && sve_u1; // { dg-error {could not convert 'sve_u1' from 'svuint8_t' to 'bool'} } | |
170 sve_u1 || sve_u1; // { dg-error {could not convert 'sve_u1' from 'svuint8_t' to 'bool'} } | |
171 | |
172 sve_u1 + gnu_u1; // { dg-error {invalid operands of types 'svuint8_t' and 'gnu_uint8_t'[^\n]* to binary 'operator\+'} } | |
173 sve_u1 - gnu_u1; // { dg-error {invalid operands of types 'svuint8_t' and 'gnu_uint8_t'[^\n]* to binary 'operator-'} } | |
174 sve_u1 * gnu_u1; // { dg-error {invalid operands of types 'svuint8_t' and 'gnu_uint8_t'[^\n]* to binary 'operator\*'} } | |
175 sve_u1 / gnu_u1; // { dg-error {invalid operands of types 'svuint8_t' and 'gnu_uint8_t'[^\n]* to binary 'operator/'} } | |
176 sve_u1 % gnu_u1; // { dg-error {invalid operands of types 'svuint8_t' and 'gnu_uint8_t'[^\n]* to binary 'operator%'} } | |
177 sve_u1 & gnu_u1; // { dg-error {invalid operands of types 'svuint8_t' and 'gnu_uint8_t'[^\n]* to binary 'operator\&'} } | |
178 sve_u1 | gnu_u1; // { dg-error {invalid operands of types 'svuint8_t' and 'gnu_uint8_t'[^\n]* to binary 'operator\|'} } | |
179 sve_u1 ^ gnu_u1; // { dg-error {invalid operands of types 'svuint8_t' and 'gnu_uint8_t'[^\n]* to binary 'operator\^'} } | |
180 sve_u1 == gnu_u1; // { dg-error {invalid operands of types 'svuint8_t' and 'gnu_uint8_t'[^\n]* to binary 'operator=='} } | |
181 sve_u1 != gnu_u1; // { dg-error {invalid operands of types 'svuint8_t' and 'gnu_uint8_t'[^\n]* to binary 'operator!='} } | |
182 sve_u1 <= gnu_u1; // { dg-error {invalid operands of types 'svuint8_t' and 'gnu_uint8_t'[^\n]* to binary 'operator<='} } | |
183 sve_u1 < gnu_u1; // { dg-error {invalid operands of types 'svuint8_t' and 'gnu_uint8_t'[^\n]* to binary 'operator<'} } | |
184 sve_u1 > gnu_u1; // { dg-error {invalid operands of types 'svuint8_t' and 'gnu_uint8_t'[^\n]* to binary 'operator>'} } | |
185 sve_u1 >= gnu_u1; // { dg-error {invalid operands of types 'svuint8_t' and 'gnu_uint8_t'[^\n]* to binary 'operator>='} } | |
186 sve_u1 <=> gnu_u1; // { dg-error {invalid operands of types 'svuint8_t' and 'gnu_uint8_t'[^\n]* to binary 'operator<=>'} } | |
187 sve_u1 << gnu_u1; // { dg-error {invalid operands of types 'svuint8_t' and 'gnu_uint8_t'[^\n]* to binary 'operator<<'} } | |
188 sve_u1 >> gnu_u1; // { dg-error {invalid operands of types 'svuint8_t' and 'gnu_uint8_t'[^\n]* to binary 'operator>>'} } | |
189 sve_u1 && gnu_u1; // { dg-error {could not convert 'sve_u1' from 'svuint8_t' to 'bool'} } | |
190 sve_u1 || gnu_u1; // { dg-error {could not convert 'sve_u1' from 'svuint8_t' to 'bool'} } | |
191 | |
192 gnu_u1 + sve_u1; // { dg-error {invalid operands of types 'gnu_uint8_t'[^\n]* and 'svuint8_t' to binary 'operator\+'} } | |
193 gnu_u1 - sve_u1; // { dg-error {invalid operands of types 'gnu_uint8_t'[^\n]* and 'svuint8_t' to binary 'operator-'} } | |
194 gnu_u1 * sve_u1; // { dg-error {invalid operands of types 'gnu_uint8_t'[^\n]* and 'svuint8_t' to binary 'operator\*'} } | |
195 gnu_u1 / sve_u1; // { dg-error {invalid operands of types 'gnu_uint8_t'[^\n]* and 'svuint8_t' to binary 'operator/'} } | |
196 gnu_u1 % sve_u1; // { dg-error {invalid operands of types 'gnu_uint8_t'[^\n]* and 'svuint8_t' to binary 'operator%'} } | |
197 gnu_u1 & sve_u1; // { dg-error {invalid operands of types 'gnu_uint8_t'[^\n]* and 'svuint8_t' to binary 'operator\&'} } | |
198 gnu_u1 | sve_u1; // { dg-error {invalid operands of types 'gnu_uint8_t'[^\n]* and 'svuint8_t' to binary 'operator\|'} } | |
199 gnu_u1 ^ sve_u1; // { dg-error {invalid operands of types 'gnu_uint8_t'[^\n]* and 'svuint8_t' to binary 'operator\^'} } | |
200 gnu_u1 == sve_u1; // { dg-error {invalid operands of types 'gnu_uint8_t'[^\n]* and 'svuint8_t' to binary 'operator=='} } | |
201 gnu_u1 != sve_u1; // { dg-error {invalid operands of types 'gnu_uint8_t'[^\n]* and 'svuint8_t' to binary 'operator!='} } | |
202 gnu_u1 <= sve_u1; // { dg-error {invalid operands of types 'gnu_uint8_t'[^\n]* and 'svuint8_t' to binary 'operator<='} } | |
203 gnu_u1 < sve_u1; // { dg-error {invalid operands of types 'gnu_uint8_t'[^\n]* and 'svuint8_t' to binary 'operator<'} } | |
204 gnu_u1 > sve_u1; // { dg-error {invalid operands of types 'gnu_uint8_t'[^\n]* and 'svuint8_t' to binary 'operator>'} } | |
205 gnu_u1 >= sve_u1; // { dg-error {invalid operands of types 'gnu_uint8_t'[^\n]* and 'svuint8_t' to binary 'operator>='} } | |
206 gnu_u1 <=> sve_u1; // { dg-error {invalid operands of types 'gnu_uint8_t'[^\n]* and 'svuint8_t' to binary 'operator<=>'} } | |
207 gnu_u1 << sve_u1; // { dg-error {invalid operands of types 'gnu_uint8_t'[^\n]* and 'svuint8_t' to binary 'operator<<'} } | |
208 gnu_u1 >> sve_u1; // { dg-error {invalid operands of types 'gnu_uint8_t'[^\n]* and 'svuint8_t' to binary 'operator>>'} } | |
209 gnu_u1 && sve_u1; // { dg-error {could not convert 'sve_u1' from 'svuint8_t' to 'bool'} } | |
210 gnu_u1 || sve_u1; // { dg-error {could not convert 'sve_u1' from 'svuint8_t' to 'bool'} } | |
211 | |
212 gnu_u1 + gnu_u1; | |
213 gnu_u1 - gnu_u1; | |
214 gnu_u1 * gnu_u1; | |
215 gnu_u1 / gnu_u1; | |
216 gnu_u1 % gnu_u1; | |
217 gnu_u1 & gnu_u1; | |
218 gnu_u1 | gnu_u1; | |
219 gnu_u1 ^ gnu_u1; | |
220 gnu_u1 == gnu_u1; | |
221 gnu_u1 != gnu_u1; | |
222 gnu_u1 <= gnu_u1; | |
223 gnu_u1 < gnu_u1; | |
224 gnu_u1 > gnu_u1; | |
225 gnu_u1 >= gnu_u1; | |
226 // This is a target-independent sorry. There's no ACLE reason why it | |
227 // needs to be kept. | |
228 gnu_u1 <=> gnu_u1; // { dg-message {three-way comparison of vectors} } | |
229 gnu_u1 << gnu_u1; | |
230 gnu_u1 >> gnu_u1; | |
231 gnu_u1 && gnu_u1; | |
232 gnu_u1 || gnu_u1; | |
233 | |
234 // Vector-scalar binary arithmetic. | |
235 | |
236 sve_u1 + 2; // { dg-error {invalid operands of types 'svuint8_t' and 'int' to binary 'operator\+'} } | |
237 sve_u1 - 2; // { dg-error {invalid operands of types 'svuint8_t' and 'int' to binary 'operator-'} } | |
238 sve_u1 * 2; // { dg-error {invalid operands of types 'svuint8_t' and 'int' to binary 'operator\*'} } | |
239 sve_u1 / 2; // { dg-error {invalid operands of types 'svuint8_t' and 'int' to binary 'operator/'} } | |
240 sve_u1 % 2; // { dg-error {invalid operands of types 'svuint8_t' and 'int' to binary 'operator%'} } | |
241 sve_u1 & 2; // { dg-error {invalid operands of types 'svuint8_t' and 'int' to binary 'operator\&'} } | |
242 sve_u1 | 2; // { dg-error {invalid operands of types 'svuint8_t' and 'int' to binary 'operator\|'} } | |
243 sve_u1 ^ 2; // { dg-error {invalid operands of types 'svuint8_t' and 'int' to binary 'operator\^'} } | |
244 sve_u1 == 2; // { dg-error {invalid operands of types 'svuint8_t' and 'int' to binary 'operator=='} } | |
245 sve_u1 != 2; // { dg-error {invalid operands of types 'svuint8_t' and 'int' to binary 'operator!='} } | |
246 sve_u1 <= 2; // { dg-error {invalid operands of types 'svuint8_t' and 'int' to binary 'operator<='} } | |
247 sve_u1 < 2; // { dg-error {invalid operands of types 'svuint8_t' and 'int' to binary 'operator<'} } | |
248 sve_u1 > 2; // { dg-error {invalid operands of types 'svuint8_t' and 'int' to binary 'operator>'} } | |
249 sve_u1 >= 2; // { dg-error {invalid operands of types 'svuint8_t' and 'int' to binary 'operator>='} } | |
250 sve_u1 <=> 2; // { dg-error {invalid operands of types 'svuint8_t' and 'int' to binary 'operator<=>'} } | |
251 sve_u1 << 2; // { dg-error {invalid operands of types 'svuint8_t' and 'int' to binary 'operator<<'} } | |
252 sve_u1 >> 2; // { dg-error {invalid operands of types 'svuint8_t' and 'int' to binary 'operator>>'} } | |
253 sve_u1 && 2; // { dg-error {could not convert 'sve_u1' from 'svuint8_t' to 'bool'} } | |
254 sve_u1 || 2; // { dg-error {could not convert 'sve_u1' from 'svuint8_t' to 'bool'} } | |
255 | |
256 sve_u1 + uc; // { dg-error {invalid operands of types 'svuint8_t' and 'unsigned char' to binary 'operator\+'} } | |
257 sve_u1 - uc; // { dg-error {invalid operands of types 'svuint8_t' and 'unsigned char' to binary 'operator-'} } | |
258 sve_u1 * uc; // { dg-error {invalid operands of types 'svuint8_t' and 'unsigned char' to binary 'operator\*'} } | |
259 sve_u1 / uc; // { dg-error {invalid operands of types 'svuint8_t' and 'unsigned char' to binary 'operator/'} } | |
260 sve_u1 % uc; // { dg-error {invalid operands of types 'svuint8_t' and 'unsigned char' to binary 'operator%'} } | |
261 sve_u1 & uc; // { dg-error {invalid operands of types 'svuint8_t' and 'unsigned char' to binary 'operator\&'} } | |
262 sve_u1 | uc; // { dg-error {invalid operands of types 'svuint8_t' and 'unsigned char' to binary 'operator\|'} } | |
263 sve_u1 ^ uc; // { dg-error {invalid operands of types 'svuint8_t' and 'unsigned char' to binary 'operator\^'} } | |
264 sve_u1 == uc; // { dg-error {invalid operands of types 'svuint8_t' and 'unsigned char' to binary 'operator=='} } | |
265 sve_u1 != uc; // { dg-error {invalid operands of types 'svuint8_t' and 'unsigned char' to binary 'operator!='} } | |
266 sve_u1 <= uc; // { dg-error {invalid operands of types 'svuint8_t' and 'unsigned char' to binary 'operator<='} } | |
267 sve_u1 < uc; // { dg-error {invalid operands of types 'svuint8_t' and 'unsigned char' to binary 'operator<'} } | |
268 sve_u1 > uc; // { dg-error {invalid operands of types 'svuint8_t' and 'unsigned char' to binary 'operator>'} } | |
269 sve_u1 >= uc; // { dg-error {invalid operands of types 'svuint8_t' and 'unsigned char' to binary 'operator>='} } | |
270 sve_u1 <=> uc; // { dg-error {invalid operands of types 'svuint8_t' and 'unsigned char' to binary 'operator<=>'} } | |
271 sve_u1 << uc; // { dg-error {invalid operands of types 'svuint8_t' and 'unsigned char' to binary 'operator<<'} } | |
272 sve_u1 >> uc; // { dg-error {invalid operands of types 'svuint8_t' and 'unsigned char' to binary 'operator>>'} } | |
273 sve_u1 && uc; // { dg-error {could not convert 'sve_u1' from 'svuint8_t' to 'bool'} } | |
274 sve_u1 || uc; // { dg-error {could not convert 'sve_u1' from 'svuint8_t' to 'bool'} } | |
275 | |
276 gnu_u1 + 2; | |
277 gnu_u1 - 2; | |
278 gnu_u1 * 2; | |
279 gnu_u1 / 2; | |
280 gnu_u1 % 2; | |
281 gnu_u1 & 2; | |
282 gnu_u1 | 2; | |
283 gnu_u1 ^ 2; | |
284 gnu_u1 == 2; | |
285 gnu_u1 != 2; | |
286 gnu_u1 <= 2; | |
287 gnu_u1 < 2; | |
288 gnu_u1 > 2; | |
289 gnu_u1 >= 2; | |
290 gnu_u1 <=> 2; // { dg-error {invalid operands of types 'gnu_uint8_t'[^\n]* and 'int' to binary 'operator<=>'} } | |
291 gnu_u1 << 2; | |
292 gnu_u1 >> 2; | |
293 gnu_u1 && 2; | |
294 gnu_u1 || 2; | |
295 | |
296 gnu_u1 + uc; | |
297 gnu_u1 - uc; | |
298 gnu_u1 * uc; | |
299 gnu_u1 / uc; | |
300 gnu_u1 % uc; | |
301 gnu_u1 & uc; | |
302 gnu_u1 | uc; | |
303 gnu_u1 ^ uc; | |
304 gnu_u1 == uc; | |
305 gnu_u1 != uc; | |
306 gnu_u1 <= uc; | |
307 gnu_u1 < uc; | |
308 gnu_u1 > uc; | |
309 gnu_u1 >= uc; | |
310 gnu_u1 <=> uc; // { dg-error {invalid operands of types 'gnu_uint8_t'[^\n]* and 'unsigned char' to binary 'operator<=>'} } | |
311 gnu_u1 << uc; | |
312 gnu_u1 >> uc; | |
313 gnu_u1 && uc; | |
314 gnu_u1 || uc; | |
315 | |
316 // Scalar-vector binary 'operatorarithmetic. | |
317 | |
318 3 + sve_u1; // { dg-error {invalid operands of types 'int' and 'svuint8_t' to binary 'operator\+'} } | |
319 3 - sve_u1; // { dg-error {invalid operands of types 'int' and 'svuint8_t' to binary 'operator-'} } | |
320 3 * sve_u1; // { dg-error {invalid operands of types 'int' and 'svuint8_t' to binary 'operator\*'} } | |
321 3 / sve_u1; // { dg-error {invalid operands of types 'int' and 'svuint8_t' to binary 'operator/'} } | |
322 3 % sve_u1; // { dg-error {invalid operands of types 'int' and 'svuint8_t' to binary 'operator%'} } | |
323 3 & sve_u1; // { dg-error {invalid operands of types 'int' and 'svuint8_t' to binary 'operator\&'} } | |
324 3 | sve_u1; // { dg-error {invalid operands of types 'int' and 'svuint8_t' to binary 'operator\|'} } | |
325 3 ^ sve_u1; // { dg-error {invalid operands of types 'int' and 'svuint8_t' to binary 'operator\^'} } | |
326 3 == sve_u1; // { dg-error {invalid operands of types 'int' and 'svuint8_t' to binary 'operator=='} } | |
327 3 != sve_u1; // { dg-error {invalid operands of types 'int' and 'svuint8_t' to binary 'operator!='} } | |
328 3 <= sve_u1; // { dg-error {invalid operands of types 'int' and 'svuint8_t' to binary 'operator<='} } | |
329 3 <=> sve_u1; // { dg-error {invalid operands of types 'int' and 'svuint8_t' to binary 'operator<=>'} } | |
330 3 < sve_u1; // { dg-error {invalid operands of types 'int' and 'svuint8_t' to binary 'operator<'} } | |
331 3 > sve_u1; // { dg-error {invalid operands of types 'int' and 'svuint8_t' to binary 'operator>'} } | |
332 3 >= sve_u1; // { dg-error {invalid operands of types 'int' and 'svuint8_t' to binary 'operator>='} } | |
333 3 << sve_u1; // { dg-error {invalid operands of types 'int' and 'svuint8_t' to binary 'operator<<'} } | |
334 3 >> sve_u1; // { dg-error {invalid operands of types 'int' and 'svuint8_t' to binary 'operator>>'} } | |
335 3 && sve_u1; // { dg-error {could not convert 'sve_u1' from 'svuint8_t' to 'bool'} } | |
336 3 || sve_u1; // { dg-error {could not convert 'sve_u1' from 'svuint8_t' to 'bool'} } | |
337 | |
338 3 + gnu_u1; | |
339 3 - gnu_u1; | |
340 3 * gnu_u1; | |
341 3 / gnu_u1; | |
342 3 % gnu_u1; | |
343 3 & gnu_u1; | |
344 3 | gnu_u1; | |
345 3 ^ gnu_u1; | |
346 3 == gnu_u1; | |
347 3 != gnu_u1; | |
348 3 <= gnu_u1; | |
349 3 <=> gnu_u1; // { dg-error {invalid operands of types 'int' and 'gnu_uint8_t'[^\n]* to binary 'operator<=>'} } | |
350 3 < gnu_u1; | |
351 3 > gnu_u1; | |
352 3 >= gnu_u1; | |
353 3 << gnu_u1; | |
354 3 >> gnu_u1; | |
355 3 && gnu_u1; | |
356 3 || gnu_u1; | |
357 | |
358 // Mismatched types. | |
359 | |
360 sve_u1 + sve_s1; // { dg-error {invalid operands of types 'svuint8_t' and 'svint8_t' to binary 'operator\+'} } | |
361 sve_u1 - sve_s1; // { dg-error {invalid operands of types 'svuint8_t' and 'svint8_t' to binary 'operator-'} } | |
362 sve_u1 * sve_s1; // { dg-error {invalid operands of types 'svuint8_t' and 'svint8_t' to binary 'operator\*'} } | |
363 sve_u1 / sve_s1; // { dg-error {invalid operands of types 'svuint8_t' and 'svint8_t' to binary 'operator/'} } | |
364 sve_u1 % sve_s1; // { dg-error {invalid operands of types 'svuint8_t' and 'svint8_t' to binary 'operator%'} } | |
365 sve_u1 & sve_s1; // { dg-error {invalid operands of types 'svuint8_t' and 'svint8_t' to binary 'operator\&'} } | |
366 sve_u1 | sve_s1; // { dg-error {invalid operands of types 'svuint8_t' and 'svint8_t' to binary 'operator\|'} } | |
367 sve_u1 ^ sve_s1; // { dg-error {invalid operands of types 'svuint8_t' and 'svint8_t' to binary 'operator\^'} } | |
368 sve_u1 == sve_s1; // { dg-error {invalid operands of types 'svuint8_t' and 'svint8_t' to binary 'operator=='} } | |
369 sve_u1 != sve_s1; // { dg-error {invalid operands of types 'svuint8_t' and 'svint8_t' to binary 'operator!='} } | |
370 sve_u1 <= sve_s1; // { dg-error {invalid operands of types 'svuint8_t' and 'svint8_t' to binary 'operator<='} } | |
371 sve_u1 < sve_s1; // { dg-error {invalid operands of types 'svuint8_t' and 'svint8_t' to binary 'operator<'} } | |
372 sve_u1 > sve_s1; // { dg-error {invalid operands of types 'svuint8_t' and 'svint8_t' to binary 'operator>'} } | |
373 sve_u1 >= sve_s1; // { dg-error {invalid operands of types 'svuint8_t' and 'svint8_t' to binary 'operator>='} } | |
374 sve_u1 <=> sve_s1; // { dg-error {invalid operands of types 'svuint8_t' and 'svint8_t' to binary 'operator<=>'} } | |
375 sve_u1 << sve_s1; // { dg-error {invalid operands of types 'svuint8_t' and 'svint8_t' to binary 'operator<<'} } | |
376 sve_u1 >> sve_s1; // { dg-error {invalid operands of types 'svuint8_t' and 'svint8_t' to binary 'operator>>'} } | |
377 | |
378 sve_u1 + gnu_s1; // { dg-error {invalid operands of types 'svuint8_t' and 'gnu_int8_t'[^\n]* to binary 'operator\+'} } | |
379 sve_u1 - gnu_s1; // { dg-error {invalid operands of types 'svuint8_t' and 'gnu_int8_t'[^\n]* to binary 'operator-'} } | |
380 sve_u1 * gnu_s1; // { dg-error {invalid operands of types 'svuint8_t' and 'gnu_int8_t'[^\n]* to binary 'operator\*'} } | |
381 sve_u1 / gnu_s1; // { dg-error {invalid operands of types 'svuint8_t' and 'gnu_int8_t'[^\n]* to binary 'operator/'} } | |
382 sve_u1 % gnu_s1; // { dg-error {invalid operands of types 'svuint8_t' and 'gnu_int8_t'[^\n]* to binary 'operator%'} } | |
383 sve_u1 & gnu_s1; // { dg-error {invalid operands of types 'svuint8_t' and 'gnu_int8_t'[^\n]* to binary 'operator\&'} } | |
384 sve_u1 | gnu_s1; // { dg-error {invalid operands of types 'svuint8_t' and 'gnu_int8_t'[^\n]* to binary 'operator\|'} } | |
385 sve_u1 ^ gnu_s1; // { dg-error {invalid operands of types 'svuint8_t' and 'gnu_int8_t'[^\n]* to binary 'operator\^'} } | |
386 sve_u1 == gnu_s1; // { dg-error {invalid operands of types 'svuint8_t' and 'gnu_int8_t'[^\n]* to binary 'operator=='} } | |
387 sve_u1 != gnu_s1; // { dg-error {invalid operands of types 'svuint8_t' and 'gnu_int8_t'[^\n]* to binary 'operator!='} } | |
388 sve_u1 <= gnu_s1; // { dg-error {invalid operands of types 'svuint8_t' and 'gnu_int8_t'[^\n]* to binary 'operator<='} } | |
389 sve_u1 < gnu_s1; // { dg-error {invalid operands of types 'svuint8_t' and 'gnu_int8_t'[^\n]* to binary 'operator<'} } | |
390 sve_u1 > gnu_s1; // { dg-error {invalid operands of types 'svuint8_t' and 'gnu_int8_t'[^\n]* to binary 'operator>'} } | |
391 sve_u1 >= gnu_s1; // { dg-error {invalid operands of types 'svuint8_t' and 'gnu_int8_t'[^\n]* to binary 'operator>='} } | |
392 sve_u1 <=> gnu_s1; // { dg-error {invalid operands of types 'svuint8_t' and 'gnu_int8_t'[^\n]* to binary 'operator<=>'} } | |
393 sve_u1 << gnu_s1; // { dg-error {invalid operands of types 'svuint8_t' and 'gnu_int8_t'[^\n]* to binary 'operator<<'} } | |
394 sve_u1 >> gnu_s1; // { dg-error {invalid operands of types 'svuint8_t' and 'gnu_int8_t'[^\n]* to binary 'operator>>'} } | |
395 | |
396 gnu_u1 + sve_s1; // { dg-error {invalid operands of types 'gnu_uint8_t'[^\n]* and 'svint8_t' to binary 'operator\+'} } | |
397 gnu_u1 - sve_s1; // { dg-error {invalid operands of types 'gnu_uint8_t'[^\n]* and 'svint8_t' to binary 'operator-'} } | |
398 gnu_u1 * sve_s1; // { dg-error {invalid operands of types 'gnu_uint8_t'[^\n]* and 'svint8_t' to binary 'operator\*'} } | |
399 gnu_u1 / sve_s1; // { dg-error {invalid operands of types 'gnu_uint8_t'[^\n]* and 'svint8_t' to binary 'operator/'} } | |
400 gnu_u1 % sve_s1; // { dg-error {invalid operands of types 'gnu_uint8_t'[^\n]* and 'svint8_t' to binary 'operator%'} } | |
401 gnu_u1 & sve_s1; // { dg-error {invalid operands of types 'gnu_uint8_t'[^\n]* and 'svint8_t' to binary 'operator\&'} } | |
402 gnu_u1 | sve_s1; // { dg-error {invalid operands of types 'gnu_uint8_t'[^\n]* and 'svint8_t' to binary 'operator\|'} } | |
403 gnu_u1 ^ sve_s1; // { dg-error {invalid operands of types 'gnu_uint8_t'[^\n]* and 'svint8_t' to binary 'operator\^'} } | |
404 gnu_u1 == sve_s1; // { dg-error {invalid operands of types 'gnu_uint8_t'[^\n]* and 'svint8_t' to binary 'operator=='} } | |
405 gnu_u1 != sve_s1; // { dg-error {invalid operands of types 'gnu_uint8_t'[^\n]* and 'svint8_t' to binary 'operator!='} } | |
406 gnu_u1 <= sve_s1; // { dg-error {invalid operands of types 'gnu_uint8_t'[^\n]* and 'svint8_t' to binary 'operator<='} } | |
407 gnu_u1 < sve_s1; // { dg-error {invalid operands of types 'gnu_uint8_t'[^\n]* and 'svint8_t' to binary 'operator<'} } | |
408 gnu_u1 > sve_s1; // { dg-error {invalid operands of types 'gnu_uint8_t'[^\n]* and 'svint8_t' to binary 'operator>'} } | |
409 gnu_u1 >= sve_s1; // { dg-error {invalid operands of types 'gnu_uint8_t'[^\n]* and 'svint8_t' to binary 'operator>='} } | |
410 gnu_u1 <=> sve_s1; // { dg-error {invalid operands of types 'gnu_uint8_t'[^\n]* and 'svint8_t' to binary 'operator<=>'} } | |
411 gnu_u1 << sve_s1; // { dg-error {invalid operands of types 'gnu_uint8_t'[^\n]* and 'svint8_t' to binary 'operator<<'} } | |
412 gnu_u1 >> sve_s1; // { dg-error {invalid operands of types 'gnu_uint8_t'[^\n]* and 'svint8_t' to binary 'operator>>'} } | |
413 | |
414 gnu_u1 + gnu_s1; | |
415 gnu_u1 - gnu_s1; | |
416 gnu_u1 * gnu_s1; | |
417 gnu_u1 / gnu_s1; | |
418 gnu_u1 % gnu_s1; | |
419 gnu_u1 & gnu_s1; | |
420 gnu_u1 | gnu_s1; | |
421 gnu_u1 ^ gnu_s1; | |
422 gnu_u1 == gnu_s1; | |
423 gnu_u1 != gnu_s1; | |
424 gnu_u1 <= gnu_s1; | |
425 gnu_u1 < gnu_s1; | |
426 gnu_u1 > gnu_s1; | |
427 gnu_u1 >= gnu_s1; | |
428 // This is a target-independent sorry. There's no ACLE reason why it | |
429 // needs to be kept. | |
430 gnu_u1 <=> gnu_s1; // { dg-message {three-way comparison of vectors} } | |
431 gnu_u1 << gnu_s1; | |
432 gnu_u1 >> gnu_s1; | |
433 | |
434 // Conditional expressions. | |
435 | |
436 uc ? sve_u1 : sve_u1; | |
437 uc ? gnu_u1 : sve_u1; // { dg-error {operands to '\?:' have different types 'gnu_uint8_t'[^\n]* and 'svuint8_t'} } | |
438 uc ? sve_u1 : gnu_u1; // { dg-error {operands to '\?:' have different types 'svuint8_t' and 'gnu_uint8_t'} } | |
439 uc ? gnu_u1 : gnu_u1; | |
440 | |
441 sve_u1 ? sve_u1 : sve_u1; // { dg-error {could not convert 'sve_u1' from 'svuint8_t' to 'bool'} } | |
442 sve_u1 ? gnu_u1 : sve_u1; // { dg-error {could not convert 'sve_u1' from 'svuint8_t' to 'bool'} } | |
443 sve_u1 ? sve_u1 : gnu_u1; // { dg-error {could not convert 'sve_u1' from 'svuint8_t' to 'bool'} } | |
444 sve_u1 ? gnu_u1 : gnu_u1; // { dg-error {could not convert 'sve_u1' from 'svuint8_t' to 'bool'} } | |
445 sve_u1 ? sve_u1 : uc; // { dg-error {could not convert 'sve_u1' from 'svuint8_t' to 'bool'} } | |
446 sve_u1 ? uc : sve_u1; // { dg-error {could not convert 'sve_u1' from 'svuint8_t' to 'bool'} } | |
447 sve_u1 ? gnu_u1 : uc; // { dg-error {could not convert 'sve_u1' from 'svuint8_t' to 'bool'} } | |
448 sve_u1 ? uc : gnu_u1; // { dg-error {could not convert 'sve_u1' from 'svuint8_t' to 'bool'} } | |
449 | |
450 gnu_u1 ? sve_u1 : sve_u1; // { dg-error {incompatible vector types in conditional expression} } | |
451 gnu_u1 ? gnu_u1 : sve_u1; // { dg-error {incompatible vector types in conditional expression} } | |
452 gnu_u1 ? sve_u1 : gnu_u1; // { dg-error {incompatible vector types in conditional expression} } | |
453 gnu_u1 ? gnu_u1 : gnu_u1; | |
454 gnu_u1 ? sve_u1 : uc; // { dg-error {incompatible vector types in conditional expression} } | |
455 gnu_u1 ? uc : sve_u1; // { dg-error {incompatible vector types in conditional expression} } | |
456 gnu_u1 ? gnu_u1 : uc; | |
457 gnu_u1 ? uc : gnu_u1; | |
458 | |
459 // Vector built-ins. | |
460 | |
461 __builtin_shuffle (sve_u1, sve_u1, sve_u1); // { dg-error {'__builtin_shuffle' last argument must be an integer vector} } | |
462 __builtin_shuffle (sve_u1, gnu_u1, gnu_u1); // { dg-error {'__builtin_shuffle' arguments must be vectors} } | |
463 __builtin_shuffle (gnu_u1, sve_u1, gnu_u1); // { dg-error {'__builtin_shuffle' arguments must be vectors} } | |
464 __builtin_shuffle (gnu_u1, gnu_u1, sve_u1); // { dg-error {'__builtin_shuffle' last argument must be an integer vector} } | |
465 __builtin_shuffle (gnu_u1, gnu_u1, gnu_u1); | |
466 | |
467 __builtin_convertvector (sve_u1, svuint8_t); // { dg-error {'__builtin_convertvector' first argument must be an integer or floating vector} } | |
468 __builtin_convertvector (gnu_u1, svuint8_t); // { dg-error {'__builtin_convertvector' second argument must be an integer or floating vector type} } | |
469 __builtin_convertvector (sve_u1, gnu_uint8_t); // { dg-error {'__builtin_convertvector' first argument must be an integer or floating vector} } | |
470 __builtin_convertvector (gnu_u1, gnu_uint8_t); | |
471 | |
472 // Type queries. | |
473 | |
474 static_assert(__is_literal_type(svuint8_t)); | |
475 static_assert(__is_literal_type(gnu_uint8_t)); | |
476 | |
477 // Pointers. | |
478 | |
479 svuint8_t *sve_ptr1 = &sve_u1; | |
480 svuint8_t *sve_ptr2 = &gnu_u1; // { dg-error {invalid conversion} } | |
481 svuint8_t *sve_ptr3 = &sve_s1; // { dg-error {invalid conversion from 'svint8_t\*' to 'svuint8_t\*'} } | |
482 svuint8_t *sve_ptr4 = &gnu_s1; // { dg-error {invalid conversion from 'gnu_int8_t\*'[^\n]* to 'svuint8_t\*'} } | |
483 | |
484 gnu_uint8_t *gnu_ptr1 = &sve_u1; // { dg-error {invalid conversion} } | |
485 gnu_uint8_t *gnu_ptr2 = &gnu_u1; | |
486 gnu_uint8_t *gnu_ptr3 = &sve_s1; // { dg-error {invalid conversion from 'svint8_t\*' to 'gnu_uint8_t\*'} } | |
487 gnu_uint8_t *gnu_ptr4 = &gnu_s1; // { dg-error {invalid conversion from 'gnu_int8_t\*'[^\n]* to 'gnu_uint8_t\*'} } | |
488 | |
489 // References. | |
490 | |
491 svuint8_t &sve_ref1 = sve_u1; | |
492 svuint8_t &sve_ref2 = gnu_u1; // { dg-error {cannot bind non-const lvalue reference} } | |
493 svuint8_t &sve_ref3 = sve_s1; // { dg-error {cannot bind non-const lvalue reference} } | |
494 svuint8_t &sve_ref4 = gnu_s1; // { dg-error {cannot bind non-const lvalue reference} } | |
495 | |
496 gnu_uint8_t &gnu_ref1 = sve_u1; // { dg-error {cannot bind non-const lvalue reference} } | |
497 gnu_uint8_t &gnu_ref2 = gnu_u1; | |
498 gnu_uint8_t &gnu_ref3 = sve_s1; // { dg-error {cannot bind non-const lvalue reference} } | |
499 gnu_uint8_t &gnu_ref4 = gnu_s1; // { dg-error {cannot bind non-const lvalue reference} } | |
500 } | |
501 | |
502 constexpr svuint8_t const1 (svuint8_t x) { return x; } | |
503 constexpr gnu_uint8_t const2 (gnu_uint8_t x) { return x; } |