207
|
1 // RUN: %clang_cc1 %s -verify -fsyntax-only -Weverything -Wno-unused-but-set-variable -std=c++11 -triple x86_64-apple-darwin10
|
150
|
2
|
|
3 // Test the compatibility of clang++'s vector extensions with g++'s vector
|
|
4 // extensions. In comparison to the extensions available in C, the !, ?:, && and
|
|
5 // || operators work on vector types.
|
|
6
|
|
7 typedef long long v2i64 __attribute__((vector_size(16))); // expected-warning {{'long long' is incompatible with C++98}}
|
|
8 typedef int v2i32 __attribute__((vector_size(8)));
|
|
9 typedef short v2i16 __attribute__((vector_size(4)));
|
|
10 typedef char v2i8 __attribute__((vector_size(2)));
|
|
11
|
|
12 typedef unsigned long long v2u64 __attribute__((vector_size(16))); // expected-warning {{'long long' is incompatible with C++98}}
|
|
13 typedef unsigned int v2u32 __attribute__((vector_size(8)));
|
|
14 typedef unsigned short v2u16 __attribute__((vector_size(4)));
|
|
15 typedef unsigned char v2u8 __attribute__((vector_size(2)));
|
|
16
|
|
17 typedef float v4f32 __attribute__((vector_size(16)));
|
|
18 typedef double v2f64 __attribute__((vector_size(16)));
|
|
19 typedef double v4f64 __attribute__((vector_size(32)));
|
|
20 typedef int v4i32 __attribute((vector_size(16)));
|
|
21
|
|
22 void arithmeticTest(void);
|
|
23 void logicTest(void);
|
|
24 void comparisonTest(void);
|
|
25 void floatTestSignedType(char a, short b, int c, long long d); // expected-warning {{'long long' is incompatible with C++98}}
|
|
26 void floatTestUnsignedType(unsigned char a, unsigned short b, unsigned int c,
|
|
27 unsigned long long d); // expected-warning {{'long long' is incompatible with C++98}}
|
|
28 void floatTestConstant(void);
|
|
29 void intTestType(char a, short b, int c, long long d); // expected-warning {{'long long' is incompatible with C++98}}
|
|
30 void intTestTypeUnsigned(unsigned char a, unsigned short b, unsigned int c,
|
|
31 unsigned long long d); // expected-warning {{'long long' is incompatible with C++98}}
|
|
32 void uintTestType(char a, short b, int c, long long d); // expected-warning {{'long long' is incompatible with C++98}}
|
|
33 void uintTestTypeUnsigned(unsigned char a, unsigned short b, unsigned int c,
|
|
34 unsigned long long d); // expected-warning {{'long long' is incompatible with C++98}}
|
|
35 void uintTestConstant(v2u64 v2u64_a, v2u32 v2u32_a, v2u16 v2u16_a, v2u8 v2u8_a);
|
|
36 void intTestConstant(v2i64 v2i64_a, v2i32 v2i32_a, v2i16 v2i16_a, v2i8 v2i8_a);
|
|
37
|
|
38 void arithmeticTest(void) {
|
|
39 v2i64 v2i64_a = (v2i64){0, 1}; // expected-warning {{compound literals are a C99-specific feature}}
|
|
40 v2i64 v2i64_r;
|
|
41
|
|
42 v2i64_r = v2i64_a + 1;
|
|
43 v2i64_r = v2i64_a - 1;
|
|
44 v2i64_r = v2i64_a * 1;
|
|
45 v2i64_r = v2i64_a / 1;
|
|
46 v2i64_r = v2i64_a % 1;
|
|
47
|
|
48 v2i64_r = 1 + v2i64_a;
|
|
49 v2i64_r = 1 - v2i64_a;
|
|
50 v2i64_r = 1 * v2i64_a;
|
|
51 v2i64_r = 1 / v2i64_a;
|
|
52 v2i64_r = 1 % v2i64_a;
|
|
53
|
|
54 v2i64_a += 1;
|
|
55 v2i64_a -= 1;
|
|
56 v2i64_a *= 1;
|
|
57 v2i64_a /= 1;
|
|
58 v2i64_a %= 1;
|
|
59 }
|
|
60
|
|
61 void comparisonTest(void) {
|
|
62 v2i64 v2i64_a = (v2i64){0, 1}; // expected-warning {{compound literals are a C99-specific feature}}
|
|
63 v2i64 v2i64_r;
|
|
64
|
|
65 v2i64_r = v2i64_a == 1;
|
|
66 v2i64_r = v2i64_a != 1;
|
|
67 v2i64_r = v2i64_a < 1;
|
|
68 v2i64_r = v2i64_a > 1;
|
|
69 v2i64_r = v2i64_a <= 1;
|
|
70 v2i64_r = v2i64_a >= 1;
|
|
71
|
|
72 v2i64_r = 1 == v2i64_a;
|
|
73 v2i64_r = 1 != v2i64_a;
|
|
74 v2i64_r = 1 < v2i64_a;
|
|
75 v2i64_r = 1 > v2i64_a;
|
|
76 v2i64_r = 1 <= v2i64_a;
|
|
77 v2i64_r = 1 >= v2i64_a;
|
|
78 }
|
|
79
|
|
80 void logicTest(void) {
|
|
81 v2i64 v2i64_a = (v2i64){0, 1}; // expected-warning {{compound literals are a C99-specific feature}}
|
|
82 v2i64 v2i64_b = (v2i64){2, 1}; // expected-warning {{compound literals are a C99-specific feature}}
|
|
83 v2i64 v2i64_c = (v2i64){3, 1}; // expected-warning {{compound literals are a C99-specific feature}}
|
|
84 v2i64 v2i64_r;
|
|
85
|
207
|
86 v2i64_r = !v2i64_a;
|
150
|
87 v2i64_r = ~v2i64_a;
|
|
88
|
|
89 v2i64_r = v2i64_a ? v2i64_b : v2i64_c;
|
|
90
|
|
91 v2i64_r = v2i64_a & 1;
|
|
92 v2i64_r = v2i64_a | 1;
|
|
93 v2i64_r = v2i64_a ^ 1;
|
|
94
|
|
95 v2i64_r = 1 & v2i64_a;
|
|
96 v2i64_r = 1 | v2i64_a;
|
|
97 v2i64_r = 1 ^ v2i64_a;
|
|
98 v2i64_a &= 1;
|
|
99 v2i64_a |= 1;
|
|
100 v2i64_a ^= 1;
|
|
101
|
|
102 v2i64_r = v2i64_a && 1;
|
|
103 v2i64_r = v2i64_a || 1;
|
|
104
|
|
105 v2i64_r = v2i64_a << 1;
|
|
106 v2i64_r = v2i64_a >> 1;
|
|
107
|
|
108 v2i64_r = 1 << v2i64_a;
|
|
109 v2i64_r = 1 >> v2i64_a;
|
|
110
|
|
111 v2i64_a <<= 1;
|
|
112 v2i64_a >>= 1;
|
|
113 }
|
|
114
|
|
115 // For operations with floating point types, we check that integer constants
|
|
116 // can be respresented, or failing that checking based on the integer types.
|
|
117 void floatTestConstant(void) {
|
|
118 // Test that constants added to floats must be expressible as floating point
|
|
119 // numbers.
|
|
120 v4f32 v4f32_a = {0.4f, 0.4f, 0.4f, 0.4f};
|
|
121 v4f32_a = v4f32_a + 1;
|
|
122 v4f32_a = v4f32_a + 0xFFFFFF;
|
|
123 v4f32_a = v4f32_a + (-1567563LL); // expected-warning {{'long long' is incompatible with C++98}}
|
|
124 v4f32_a = v4f32_a + (16777208);
|
|
125 v4f32_a = v4f32_a + (16777219); // expected-error {{cannot convert between scalar type 'int' and vector type 'v4f32' (vector of 4 'float' values) as implicit conversion would cause truncation}}
|
|
126 }
|
|
127
|
|
128 void floatTestConstantComparison(void);
|
|
129 void doubleTestConstantComparison(void);
|
|
130
|
|
131 void floatTestConstantComparison(void) {
|
|
132 v4f32 v4f32_a = {0.4f, 0.4f, 0.4f, 0.4f};
|
|
133 v4i32 v4i32_r;
|
|
134 v4i32_r = v4f32_a > 0.4f;
|
|
135 v4i32_r = v4f32_a >= 0.4f;
|
|
136 v4i32_r = v4f32_a < 0.4f;
|
|
137 v4i32_r = v4f32_a <= 0.4f;
|
|
138 v4i32_r = v4f32_a == 0.4f; // expected-warning {{comparing floating point with == or != is unsafe}}
|
|
139 v4i32_r = v4f32_a != 0.4f; // expected-warning {{comparing floating point with == or != is unsafe}}
|
|
140 }
|
|
141
|
|
142 void doubleTestConstantComparison(void) {
|
|
143 v2f64 v2f64_a = {0.4, 0.4};
|
|
144 v2i64 v2i64_r;
|
|
145 v2i64_r = v2f64_a > 0.4;
|
|
146 v2i64_r = v2f64_a >= 0.4;
|
|
147 v2i64_r = v2f64_a < 0.4;
|
|
148 v2i64_r = v2f64_a <= 0.4;
|
|
149 v2i64_r = v2f64_a == 0.4; // expected-warning {{comparing floating point with == or != is unsafe}}
|
|
150 v2i64_r = v2f64_a != 0.4; // expected-warning {{comparing floating point with == or != is unsafe}}
|
|
151 }
|
|
152
|
|
153 void floatTestUnsignedType(unsigned char a, unsigned short b, unsigned int c,
|
|
154 unsigned long long d) { // expected-warning {{'long long' is incompatible with C++98}}
|
|
155 v4f32 v4f32_a = {0.4f, 0.4f, 0.4f, 0.4f};
|
|
156 v4f64 v4f64_b = {0.4, 0.4, 0.4, 0.4};
|
|
157
|
|
158 v4f32_a = v4f32_a + a;
|
|
159 v4f32_a = v4f32_a + b;
|
|
160 v4f32_a = v4f32_a + c; // expected-error {{cannot convert between scalar type 'unsigned int' and vector type 'v4f32' (vector of 4 'float' values) as implicit conversion would cause truncation}}
|
|
161 v4f32_a = v4f32_a + d; // expected-error {{cannot convert between scalar type 'unsigned long long' and vector type 'v4f32' (vector of 4 'float' values) as implicit conversion would cause truncation}}
|
|
162
|
|
163 v4f64_b = v4f64_b + a;
|
|
164 v4f64_b = v4f64_b + b;
|
|
165 v4f64_b = v4f64_b + c;
|
|
166 v4f64_b = v4f64_b + d; // expected-error {{cannot convert between scalar type 'unsigned long long' and vector type 'v4f64' (vector of 4 'double' values) as implicit conversion would cause truncation}}
|
|
167 }
|
|
168
|
|
169 void floatTestSignedType(char a, short b, int c, long long d) { // expected-warning {{'long long' is incompatible with C++98}}
|
|
170 v4f32 v4f32_a = {0.4f, 0.4f, 0.4f, 0.4f};
|
|
171 v4f64 v4f64_b = {0.4, 0.4, 0.4, 0.4};
|
|
172
|
|
173 v4f32_a = v4f32_a + a;
|
|
174 v4f32_a = v4f32_a + b;
|
|
175 v4f32_a = v4f32_a + c; // expected-error {{cannot convert between scalar type 'int' and vector type 'v4f32' (vector of 4 'float' values) as implicit conversion would cause truncation}}
|
|
176 v4f32_a = v4f32_a + d; // expected-error {{cannot convert between scalar type 'long long' and vector type 'v4f32' (vector of 4 'float' values) as implicit conversion would cause truncation}}
|
|
177
|
|
178 v4f64_b = v4f64_b + a;
|
|
179 v4f64_b = v4f64_b + b;
|
|
180 v4f64_b = v4f64_b + c;
|
|
181 v4f64_b = v4f64_b + d; // expected-error {{cannot convert between scalar type 'long long' and vector type 'v4f64' (vector of 4 'double' values) as implicit conversion would cause truncation}}
|
|
182 }
|
|
183
|
|
184 void intTestType(char a, short b, int c, long long d) { // expected-warning {{'long long' is incompatible with C++98}}
|
|
185 v2i64 v2i64_a = {1, 2};
|
|
186 v2i32 v2i32_a = {1, 2};
|
|
187 v2i16 v2i16_a = {1, 2};
|
|
188 v2i8 v2i8_a = {1, 2};
|
|
189
|
|
190 v2i64_a = v2i64_a + d;
|
|
191 v2i64_a = v2i64_a + c;
|
|
192 v2i64_a = v2i64_a + b;
|
|
193 v2i64_a = v2i64_a + a;
|
|
194
|
|
195 v2i32_a = v2i32_a + d; // expected-warning {{implicit conversion loses integer precision: 'long long' to 'v2i32' (vector of 2 'int' values)}}
|
|
196 v2i32_a = v2i32_a + c;
|
|
197 v2i32_a = v2i32_a + b;
|
|
198 v2i32_a = v2i32_a + a;
|
|
199
|
|
200 v2i16_a = v2i16_a + d; // expected-error {{cannot convert between scalar type 'long long' and vector type 'v2i16' (vector of 2 'short' values) as implicit conversion would cause truncation}}
|
|
201 v2i16_a = v2i16_a + c; // expected-warning {{implicit conversion loses integer precision: 'int' to 'v2i16' (vector of 2 'short' values)}}
|
|
202 v2i16_a = v2i16_a + b;
|
|
203 v2i16_a = v2i16_a + a;
|
|
204
|
|
205 v2i8_a = v2i8_a + d; // expected-error {{cannot convert between scalar type 'long long' and vector type 'v2i8' (vector of 2 'char' values) as implicit conversion would cause truncation}}
|
|
206 v2i8_a = v2i8_a + c; // expected-error {{cannot convert between scalar type 'int' and vector type 'v2i8' (vector of 2 'char' values) as implicit conversion would cause truncation}}
|
|
207 v2i8_a = v2i8_a + b; // expected-warning {{implicit conversion loses integer precision: 'short' to 'v2i8' (vector of 2 'char' values)}}
|
|
208 v2i8_a = v2i8_a + a;
|
|
209 }
|
|
210
|
|
211 void intTestTypeUnsigned(unsigned char a, unsigned short b, unsigned int c,
|
|
212 unsigned long long d) { // expected-warning {{'long long' is incompatible with C++98}}
|
|
213 v2i64 v2i64_a = {1, 2};
|
|
214 v2i32 v2i32_a = {1, 2};
|
|
215 v2i16 v2i16_a = {1, 2};
|
|
216 v2i8 v2i8_a = {1, 2};
|
|
217
|
|
218 v2i64_a = v2i64_a + d; // expected-error {{cannot convert between scalar type 'unsigned long long' and vector type 'v2i64' (vector of 2 'long long' values) as implicit conversion would cause truncation}}
|
|
219
|
|
220 v2i64_a = v2i64_a + c;
|
|
221 v2i64_a = v2i64_a + b;
|
|
222 v2i64_a = v2i64_a + a;
|
|
223
|
|
224 v2i32_a = v2i32_a + d; // expected-warning {{implicit conversion loses integer precision: 'unsigned long long' to 'v2i32' (vector of 2 'int' values)}}
|
|
225 v2i32_a = v2i32_a + c; // expected-error {{cannot convert between scalar type 'unsigned int' and vector type 'v2i32' (vector of 2 'int' values) as implicit conversion would cause truncation}}
|
|
226 v2i32_a = v2i32_a + b;
|
|
227 v2i32_a = v2i32_a + a;
|
|
228
|
|
229 v2i16_a = v2i16_a + d; // expected-error {{cannot convert between scalar type 'unsigned long long' and vector type 'v2i16' (vector of 2 'short' values) as implicit conversion would cause truncation}}
|
|
230 v2i16_a = v2i16_a + c; // expected-warning {{implicit conversion loses integer precision: 'unsigned int' to 'v2i16' (vector of 2 'short' values)}}
|
|
231 v2i16_a = v2i16_a + b; // expected-error {{cannot convert between scalar type 'unsigned short' and vector type 'v2i16' (vector of 2 'short' values) as implicit conversion would cause truncation}}
|
|
232 v2i16_a = v2i16_a + a;
|
|
233
|
|
234 v2i8_a = v2i8_a + d; // expected-error {{cannot convert between scalar type 'unsigned long long' and vector type 'v2i8' (vector of 2 'char' values) as implicit conversion would cause truncation}}
|
|
235 v2i8_a = v2i8_a + c; // expected-error {{cannot convert between scalar type 'unsigned int' and vector type 'v2i8' (vector of 2 'char' values) as implicit conversion would cause truncation}}
|
|
236 v2i8_a = v2i8_a + b; // expected-warning {{implicit conversion loses integer precision: 'unsigned short' to 'v2i8' (vector of 2 'char' values)}}
|
|
237 v2i8_a = v2i8_a + a; // expected-error {{cannot convert between scalar type 'unsigned char' and vector type 'v2i8' (vector of 2 'char' values) as implicit conversion would cause truncation}}
|
|
238 }
|
|
239
|
|
240 void uintTestType(char a, short b, int c, long long d) { // expected-warning {{'long long' is incompatible with C++98}}
|
|
241 v2u64 v2u64_a = {1, 2};
|
|
242 v2u32 v2u32_a = {1, 2};
|
|
243 v2u16 v2u16_a = {1, 2};
|
|
244 v2u8 v2u8_a = {1, 2};
|
|
245
|
|
246 v2u64_a = v2u64_a + d; // expected-warning {{implicit conversion changes signedness: 'long long' to 'v2u64' (vector of 2 'unsigned long long' values)}}
|
|
247 v2u64_a = v2u64_a + c; // expected-warning {{implicit conversion changes signedness: 'int' to 'v2u64' (vector of 2 'unsigned long long' values)}}
|
|
248 v2u64_a = v2u64_a + b; // expected-warning {{implicit conversion changes signedness: 'short' to 'v2u64' (vector of 2 'unsigned long long' values)}}
|
|
249 v2u64_a = v2u64_a + a; // expected-warning {{implicit conversion changes signedness: 'char' to 'v2u64' (vector of 2 'unsigned long long' values)}}
|
|
250
|
|
251 v2u32_a = v2u32_a + d; // expected-warning {{implicit conversion loses integer precision: 'long long' to 'v2u32' (vector of 2 'unsigned int' values)}}
|
|
252 v2u32_a = v2u32_a + c; // expected-warning {{implicit conversion changes signedness: 'int' to 'v2u32' (vector of 2 'unsigned int' values)}}
|
|
253 v2u32_a = v2u32_a + b; // expected-warning {{implicit conversion changes signedness: 'short' to 'v2u32' (vector of 2 'unsigned int' values)}}
|
|
254 v2u32_a = v2u32_a + a; // expected-warning {{implicit conversion changes signedness: 'char' to 'v2u32' (vector of 2 'unsigned int' values)}}
|
|
255
|
|
256 v2u16_a = v2u16_a + d; // expected-error {{cannot convert between scalar type 'long long' and vector type 'v2u16' (vector of 2 'unsigned short' values) as implicit conversion would cause truncation}}
|
|
257 v2u16_a = v2u16_a + c; // expected-warning {{implicit conversion loses integer precision: 'int' to 'v2u16' (vector of 2 'unsigned short' values)}}
|
|
258 v2u16_a = v2u16_a + b; // expected-warning {{implicit conversion changes signedness: 'short' to 'v2u16' (vector of 2 'unsigned short' values)}}
|
|
259 v2u16_a = v2u16_a + a; // expected-warning {{implicit conversion changes signedness: 'char' to 'v2u16' (vector of 2 'unsigned short' values)}}
|
|
260
|
|
261 v2u8_a = v2u8_a + d; // expected-error {{cannot convert between scalar type 'long long' and vector type 'v2u8' (vector of 2 'unsigned char' values) as implicit conversion would cause truncation}}
|
|
262 v2u8_a = v2u8_a + c; // expected-error {{cannot convert between scalar type 'int' and vector type 'v2u8' (vector of 2 'unsigned char' values) as implicit conversion would cause truncation}}
|
|
263 v2u8_a = v2u8_a + b; // expected-warning {{implicit conversion loses integer precision: 'short' to 'v2u8' (vector of 2 'unsigned char' values)}}
|
|
264 v2u8_a = v2u8_a + a; // expected-warning {{implicit conversion changes signedness: 'char' to 'v2u8' (vector of 2 'unsigned char' values)}}
|
|
265 }
|
|
266
|
|
267 void uintTestTypeUnsigned(unsigned char a, unsigned short b, unsigned int c,
|
|
268 unsigned long long d) { // expected-warning {{'long long' is incompatible with C++98}}
|
|
269 v2u64 v2u64_a = {1, 2};
|
|
270 v2u32 v2u32_a = {1, 2};
|
|
271 v2u16 v2u16_a = {1, 2};
|
|
272 v2u8 v2u8_a = {1, 2};
|
|
273
|
|
274 v2u64_a = v2u64_a + d;
|
|
275 v2u64_a = v2u64_a + c;
|
|
276 v2u64_a = v2u64_a + b;
|
|
277 v2u64_a = v2u64_a + a;
|
|
278
|
|
279 v2u32_a = v2u32_a + d; // expected-warning {{implicit conversion loses integer precision: 'unsigned long long' to 'v2u32' (vector of 2 'unsigned int' values)}}
|
|
280 v2u32_a = v2u32_a + c;
|
|
281 v2u32_a = v2u32_a + b;
|
|
282 v2u32_a = v2u32_a + a;
|
|
283
|
|
284 v2u16_a = v2u16_a + d; // expected-error {{cannot convert between scalar type 'unsigned long long' and vector type 'v2u16' (vector of 2 'unsigned short' values) as implicit conversion would cause truncation}}
|
|
285 v2u16_a = v2u16_a + c; // expected-warning {{implicit conversion loses integer precision: 'unsigned int' to 'v2u16' (vector of 2 'unsigned short' values)}}
|
|
286 v2u16_a = v2u16_a + b;
|
|
287 v2u16_a = v2u16_a + a;
|
|
288
|
|
289 v2u8_a = v2u8_a + d; // expected-error {{cannot convert between scalar type 'unsigned long long' and vector type 'v2u8' (vector of 2 'unsigned char' values) as implicit conversion would cause truncation}}
|
|
290 v2u8_a = v2u8_a + c; // expected-error {{cannot convert between scalar type 'unsigned int' and vector type 'v2u8' (vector of 2 'unsigned char' values) as implicit conversion would cause truncation}}
|
|
291 v2u8_a = v2u8_a + b; // expected-warning {{implicit conversion loses integer precision: 'unsigned short' to 'v2u8' (vector of 2 'unsigned char' values)}}
|
|
292 v2u8_a = v2u8_a + a;
|
|
293 }
|
|
294
|
|
295 void uintTestConstant(v2u64 v2u64_a, v2u32 v2u32_a, v2u16 v2u16_a,
|
|
296 v2u8 v2u8_a) {
|
|
297 v2u64_a = v2u64_a + 0xFFFFFFFFFFFFFFFF;
|
|
298 v2u32_a = v2u32_a + 0xFFFFFFFF;
|
|
299 v2u16_a = v2u16_a + 0xFFFF;
|
|
300 v2u8_a = v2u8_a + 0xFF;
|
|
301
|
|
302 v2u32_a = v2u32_a + 0x1FFFFFFFF; // expected-warning {{implicit conversion from 'long' to 'v2u32' (vector of 2 'unsigned int' values) changes value from 8589934591 to 4294967295}}
|
|
303 v2u16_a = v2u16_a + 0x1FFFF; // expected-warning {{implicit conversion from 'int' to 'v2u16' (vector of 2 'unsigned short' values) changes value from 131071 to 65535}}
|
|
304 v2u8_a = v2u8_a + 0x1FF; // expected-error {{cannot convert between scalar type 'int' and vector type 'v2u8' (vector of 2 'unsigned char' values) as implicit conversion would cause truncation}}
|
|
305 }
|
|
306
|
|
307 void intTestConstant(v2i64 v2i64_a, v2i32 v2i32_a, v2i16 v2i16_a, v2i8 v2i8_a) {
|
|
308 // Legal upper bounds.
|
|
309 v2i64_a = v2i64_a + static_cast<long long>(0x7FFFFFFFFFFFFFFF); // expected-warning {{'long long' is incompatible with C++98}}
|
|
310 v2i32_a = v2i32_a + static_cast<int>(0x7FFFFFFF);
|
|
311 v2i16_a = v2i16_a + static_cast<short>(0x7FFF);
|
|
312 v2i8_a = v2i8_a + static_cast<char>(0x7F);
|
|
313
|
|
314 // Legal lower bounds.
|
|
315 v2i64_a = v2i64_a + (-9223372036854775807);
|
|
316 v2i32_a = v2i32_a + (-2147483648);
|
|
317 v2i16_a = v2i16_a + (-32768);
|
|
318 v2i8_a = v2i8_a + (-128);
|
|
319
|
|
320 // One increment/decrement more than the type can hold
|
|
321 v2i32_a = v2i32_a + 2147483648; // expected-warning {{implicit conversion from 'long' to 'v2i32' (vector of 2 'int' values) changes value from 2147483648 to -2147483648}}
|
|
322 v2i16_a = v2i16_a + 32768; // expected-warning {{implicit conversion from 'int' to 'v2i16' (vector of 2 'short' values) changes value from 32768 to -32768}}
|
|
323 v2i8_a = v2i8_a + 128; // expected-warning {{implicit conversion from 'int' to 'v2i8' (vector of 2 'char' values) changes value from 128 to -128}}
|
|
324
|
|
325 v2i32_a = v2i32_a + (-2147483649); // expected-warning {{implicit conversion from 'long' to 'v2i32' (vector of 2 'int' values) changes value from -2147483649 to 2147483647}}
|
|
326 v2i16_a = v2i16_a + (-32769); // expected-warning {{implicit conversion from 'int' to 'v2i16' (vector of 2 'short' values) changes value from -32769 to 32767}}
|
|
327 v2i8_a = v2i8_a + (-129); // expected-error {{cannot convert between scalar type 'int' and vector type 'v2i8' (vector of 2 'char' values) as implicit conversion would cause truncation}}
|
|
328 }
|