(root)/
gcc-13.2.0/
gcc/
testsuite/
gcc.dg/
vect/
vect-103.c
       1  /* Disabling epilogues until we find a better way to deal with scans.  */
       2  /* { dg-additional-options "--param vect-epilogues-nomask=0" } */
       3  /* { dg-require-effective-target vect_int } */
       4  
       5  #include <stdlib.h>
       6  #include <stdarg.h>
       7  #include "tree-vect.h"
       8  
       9  #if VECTOR_BITS > 256
      10  #define NINTS (VECTOR_BITS / 32)
      11  #else
      12  #define NINTS 8
      13  #endif
      14  
      15  #define N (NINTS + 1)
      16  
      17  struct extraction
      18  {
      19    int a[N];
      20    int b[N];
      21  };
      22  
      23  static int a[N] = {1,2,3,4,5,6,7,8,9};
      24  static int b[N] = {17,24,7,0,2,3,4,31,82};
      25  
      26  __attribute__ ((noinline))
      27  int main1 (int x, int y) {
      28    int i;
      29    struct extraction *p;
      30    p = (struct extraction *) malloc (sizeof (struct extraction));
      31  
      32    for (i = 0; i < N; i++)
      33      {
      34        p->a[i] = a[i];
      35        p->b[i] = b[i];
      36        asm volatile ("" ::: "memory");
      37      }
      38  
      39    /* Vectorizable: distance > VF.  */
      40    for (i = 0; i < N; i++)
      41      *((int *)p + x + i) = *((int *)p + x + i + NINTS);
      42  
      43    /* check results: */
      44    if (p->a[0] != a[N - 1])
      45      abort ();
      46    for (i = 1; i < N; i++)
      47      if (p->a[i] != b[i - 1])
      48        abort ();
      49  
      50    return 0;
      51  }
      52  
      53  int main (void)
      54  { 
      55    check_vect ();
      56  
      57    return main1 (0, N);
      58  }
      59  
      60  /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */