PR tree-optimization/81303
[official-gcc.git] / gcc / testsuite / gcc.dg / simd-2.c
blob13e1caba6cb1c8e9ad0815ea50d95e7c81f8adde
1 /* { dg-do compile } */
2 /* { dg-options "-Wall" } */
4 /* Origin: Aldy Hernandez <aldyh@redhat.com>. */
5 /* Purpose: Program to test generic SIMD support. */
7 typedef float __attribute__((vector_size(8))) v2sf;
8 typedef float __attribute__((vector_size(16))) v4sf;
9 typedef double __attribute__((vector_size(16))) v2df;
11 v4sf a, b;
12 v2sf c, d;
13 v2df e;
15 double foo;
16 float foo1;
17 v2sf foo2;
19 void
20 hanneke ()
22 /* Assignment. */
23 a = b;
25 /* Assignment of different types. */
26 b = c; /* { dg-error "incompatible types when assigning" } */
27 d = a; /* { dg-error "incompatible types when assigning" } */
29 /* Casting between SIMDs of the same size. */
30 e = (typeof (e)) a;
32 /* Assignment between scalar and SIMD of different size. */
33 foo = a; /* { dg-error "incompatible types when assigning" } */
35 /* Casted assignment between scalar and SIMD of same size. */
36 foo = (typeof (foo)) foo2; /* { dg-error "aggregate value used where a float was expected" } */
38 /* Casted assignment between scalar and SIMD of different size. */
39 foo1 = (typeof (foo1)) foo2; /* { dg-error "aggregate value used where a float was expected" } */
41 /* Operators on compatible SIMD types. */
42 a += b + b;
43 a -= b;
44 a *= b;
45 a /= b;
46 a = +b;
47 c = -d;
49 /* Operators on incompatible SIMD types. */
50 a = b + c; /* { dg-error "invalid operands to binary" } */
51 a = b - c; /* { dg-error "invalid operands to binary" } */
52 a = b * c; /* { dg-error "invalid operands to binary" } */
53 a = b / c; /* { dg-error "invalid operands to binary" } */