(root)/
gcc-13.2.0/
gcc/
testsuite/
gcc.dg/
vect/
vect-gather-1.c
       1  #include "tree-vect.h"
       2  
       3  #define N 16
       4  
       5  void __attribute__((noipa))
       6  f (int *restrict y, int *restrict x, int *restrict indices)
       7  {
       8    for (int i = 0; i < N; ++i)
       9      {
      10        y[i * 2] = x[indices[i * 2]] + 1;
      11        y[i * 2 + 1] = x[indices[i * 2 + 1]] + 2;
      12      }
      13  }
      14  
      15  int y[N * 2];
      16  int x[N * 2] = {
      17    72704, 52152, 51301, 96681,
      18    57937, 60490, 34504, 60944,
      19    42225, 28333, 88336, 74300,
      20    29250, 20484, 38852, 91536,
      21    86917, 63941, 31590, 21998,
      22    22419, 26974, 28668, 13968,
      23    3451, 20247, 44089, 85521,
      24    22871, 87362, 50555, 85939
      25  };
      26  int indices[N * 2] = {
      27    15, 16, 9, 19,
      28    7, 22, 19, 1,
      29    22, 13, 15, 30,
      30    5, 12, 11, 11,
      31    10, 25, 5, 20,
      32    22, 24, 24, 28,
      33    30, 19, 6, 4,
      34    7, 12, 8, 21
      35  };
      36  int expected[N * 2] = {
      37    91537, 86919, 28334, 22000,
      38    60945, 28670, 21999, 52154,
      39    28669, 20486, 91537, 50557,
      40    60491, 29252, 74301, 74302,
      41    88337, 20249, 60491, 22421,
      42    28669, 3453, 3452, 22873,
      43    50556, 22000, 34505, 57939,
      44    60945, 29252, 42226, 26976
      45  };
      46  
      47  int
      48  main (void)
      49  {
      50    check_vect ();
      51  
      52    f (y, x, indices);
      53    for (int i = 0; i < 32; ++i)
      54      if (y[i] != expected[i])
      55        __builtin_abort ();
      56  
      57    return 0;
      58  }
      59  
      60  /* { dg-final { scan-tree-dump "Loop contains only SLP stmts" vect { target vect_gather_load_ifn } } } */