Require target lra in gcc.dg/pr108095.c
[official-gcc.git] / gcc / testsuite / c-c++-common / scal-to-vec1.c
blob4ffdc59f027ee9a7e9fd645c8d5f403e3e1e9b62
1 /* { dg-do compile } */
2 /* { dg-options "-Wno-long-long" } */
3 /* { dg-options "-Wno-long-long -mabi=altivec" { target { { powerpc*-*-linux* } && ilp32 } } } */
5 #define vector(elcount, type) \
6 __attribute__((vector_size((elcount)*sizeof(type)))) type
8 #define vidx(type, vec, idx) (*((type *) &(vec) + idx))
11 extern float sfl;
12 extern int sint;
13 extern long long sll;
15 int main (int argc, char *argv[]) {
16 vector(8, short) v0 = {(short)argc, 1,2,3,4,5,6,7};
17 vector(8, short) v1;
19 vector(4, float) f0 = {1., 2., 3., 4.};
20 vector(4, float) f1, f2;
22 vector(4, int) i0 = {1,2,3,4};
23 vector(4, int) i1, i2;
26 int i = 12;
27 double d = 3.;
29 v1 = i + v0; /* { dg-error "conversion of scalar \[^\\n\]* to vector" "scalar to vector" { target { ! int16 } } } */
30 v1 = 99999 + v0; /* { dg-error "conversion of scalar \[^\\n\]* to vector" } */
32 f1 = d + f0; /* { dg-error "conversion of scalar \[^\\n\]* to vector" "scalar to vector" { target { large_double } } } */
33 f1 = 1.3 + f0; /* { dg-error "conversion of scalar \[^\\n\]* to vector" "scalar to vector" { target { large_double } } } */
34 f1 = sll + f0; /* { dg-error "conversion of scalar \[^\\n\]* to vector" } */
35 f1 = ((int)998769576) + f0; /* { dg-error "conversion of scalar \[^\\n\]* to vector" "scalar to vector" { target { ! int16 } } } */
37 /* convert.c should take care of this. */
38 i1 = sfl + i0; /* { dg-error "cannot convert value to a vector|invalid operands" } */
39 i1 = 1.5 + i0; /* { dg-error "cannot convert value to a vector|invalid operands" } */
40 v1 = d + v0; /* { dg-error "cannot convert value to a vector|invalid operands" } */
42 return 0;