(root)/
gcc-13.2.0/
gcc/
testsuite/
gcc.dg/
simd-2.c
       1  /* { dg-do compile } */
       2  /* { dg-options "-Wall" } */
       3  
       4  /* Origin: Aldy Hernandez <aldyh@redhat.com>.  */
       5  /* Purpose: Program to test generic SIMD support.  */
       6  
       7  typedef float __attribute__((vector_size(8))) v2sf;
       8  typedef float __attribute__((vector_size(16))) v4sf;
       9  typedef double __attribute__((vector_size(16))) v2df;
      10  
      11  v4sf a, b;
      12  v2sf c, d;
      13  v2df e;
      14  
      15  double foo;
      16  float foo1;
      17  v2sf foo2;
      18  
      19  void
      20  hanneke ()
      21  {
      22    /* Assignment.  */
      23    a = b;
      24  
      25    /* Assignment of different types.  */
      26    b = c; /* { dg-error "incompatible types when assigning" } */
      27    d = a; /* { dg-error "incompatible types when assigning" } */
      28  
      29    /* Casting between SIMDs of the same size.  */
      30    e = (typeof (e)) a;
      31  
      32    /* Assignment between scalar and SIMD of different size.  */
      33    foo = a; /* { dg-error "incompatible types when assigning" } */
      34  
      35    /* Casted assignment between scalar and SIMD of same size.  */
      36    foo = (typeof (foo)) foo2; /* { dg-error "aggregate value used where a floating-point was expected" } */
      37  
      38    /* Casted assignment between scalar and SIMD of different size.  */
      39    foo1 = (typeof (foo1)) foo2; /* { dg-error "aggregate value used where a floating-point was expected" } */
      40  
      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;
      48  
      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" } */
      54  }