Split print_rtx into subroutines
[official-gcc.git] / gcc / testsuite / gcc.dg / simd-1.c
blobff45c9c567ed635eb6d4997103d11cd6a92e9415
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 int __attribute__((vector_size (16))) v4si;
8 typedef short __attribute__((vector_size (16))) v8hi;
9 typedef int __attribute__((vector_size (8))) v2si;
10 typedef unsigned int __attribute__((vector_size (16))) uv4si;
12 v4si a, b;
13 v2si c, d;
14 v8hi e;
15 uv4si f;
17 long long foo;
18 int foo1;
19 short foo2 __attribute__((vector_size (8)));
21 void
22 hanneke ()
24 /* Assignment. */
25 a = b;
27 /* Assignment of different types. */
28 b = c; /* { dg-error "incompatible types when assigning" } */
29 d = a; /* { dg-error "incompatible types when assigning" } */
31 /* Casting between SIMDs of the same size. */
32 e = (typeof (e)) a;
34 /* Different signed SIMD assignment. */
35 f = a; /* { dg-message "note: use -flax-vector-conversions to permit conversions between vectors with differing element types or numbers of subparts" } */
36 /* { dg-error "incompatible types when assigning" "" { target *-*-* } 35 } */
38 /* Casted different signed SIMD assignment. */
39 f = (uv4si) a;
41 /* Assignment between scalar and SIMD of different size. */
42 foo = a; /* { dg-error "incompatible types when assigning" } */
44 /* Casted assignment between scalar and SIMD of same size. */
45 foo = (typeof (foo)) foo2;
47 /* Casted assignment between scalar and SIMD of different size. */
48 foo1 = (typeof (foo1)) foo2; /* { dg-error "can't convert a vector of type" } */
50 /* Operators on compatible SIMD types. */
51 a += b + b;
52 a -= b;
53 a *= b;
54 a /= b;
55 a = -b;
57 /* Operators on incompatible SIMD types. */
58 a = b + c; /* { dg-error "invalid operands to binary +" } */
59 a = b - c; /* { dg-error "invalid operands to binary -" } */
60 a = b * c; /* { dg-error "invalid operands to binary *" } */
61 a = b / c; /* { dg-error "invalid operands to binary /" } */