(root)/
gcc-13.2.0/
gcc/
testsuite/
gcc.dg/
vect/
vect-complex-4.c
       1  /* { dg-require-effective-target vect_int } */
       2  
       3  #include <stdarg.h>
       4  #include "tree-vect.h"
       5  
       6  #define N 16
       7  
       8  struct foostr {
       9    _Complex short f1;
      10    _Complex short f2;
      11  };
      12  
      13  struct foostr a[16] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__))) =
      14    {
      15      11 + 23i, 24 + 22i,
      16      11 + 26i, 24 + 35i,
      17      19 + 20i, 29 + 14i,
      18      23 + 31i, 26 + 30i,
      19      29 + 39i, 24 + 18i,
      20      20 + 32i, 16 + 23i,
      21      13 + 26i, 37 + 34i,
      22      12 + 23i, 26 + 14i,
      23      36 + 14i, 31 + 17i,
      24      35 + 17i, 17 + 36i,
      25      13 + 34i, 19 + 12i,
      26      27 + 34i, 36 + 19i,
      27      21 + 39i, 16 + 33i,
      28      28 + 18i, 39 + 26i,
      29      32 + 27i, 13 + 38i,
      30      35 + 36i, 34 + 28i,
      31    };
      32  
      33  struct foostr b[16] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__))) =
      34    {
      35      37 + 12i, 23 + 15i,
      36      14 + 11i, 13 + 25i,
      37      35 + 29i, 22 + 34i,
      38      24 + 34i, 16 + 39i,
      39      34 + 32i, 26 + 21i,
      40      34 + 36i, 11 + 37i,
      41      25 + 21i, 10 + 39i,
      42      10 + 36i, 35 + 22i,
      43      39 + 29i, 23 + 21i,
      44      34 + 33i, 39 + 14i,
      45      16 + 31i, 32 + 33i,
      46      20 + 14i, 35 + 30i,
      47      26 + 24i, 36 + 37i,
      48      31 + 20i, 32 + 28i,
      49      25 + 27i, 15 + 30i,
      50      10 + 31i, 37 + 37i,
      51    };
      52  struct foostr c[16] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
      53  struct foostr res[N] =
      54    {
      55      48 + 35i, 47 + 37i,
      56      25 + 37i, 37 + 60i,
      57      54 + 49i, 51 + 48i,
      58      47 + 65i, 42 + 69i,
      59      63 + 71i, 50 + 39i,
      60      54 + 68i, 27 + 60i,
      61      38 + 47i, 47 + 73i,
      62      22 + 59i, 61 + 36i,
      63      75 + 43i, 54 + 38i,
      64      69 + 50i, 56 + 50i,
      65      29 + 65i, 51 + 45i,
      66      47 + 48i, 71 + 49i,
      67      47 + 63i, 52 + 70i,
      68      59 + 38i, 71 + 54i,
      69      57 + 54i, 28 + 68i,
      70      45 + 67i, 71 + 65i,
      71    };
      72  
      73  __attribute__ ((noinline)) void
      74  foo (void)
      75  {
      76    int i;
      77  
      78    for (i = 0; i < N; i++)
      79      {
      80        c[i].f1 = a[i].f1 + b[i].f1;
      81        c[i].f2 = a[i].f2 + b[i].f2;
      82      }
      83  
      84  }
      85  
      86  int
      87  main (void)
      88  { 
      89    int i;
      90    check_vect ();
      91    
      92    foo ();
      93  
      94    /* check results:  */
      95    for (i = 0; i < N; i++)
      96      {
      97        if (c[i].f1 != res[i].f1)
      98  	abort ();
      99        if (c[i].f2 != res[i].f2)
     100  	abort ();
     101      }
     102  
     103    return 0;
     104  }
     105  
     106  /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */
     107  /* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 1 "vect" } } */