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] = (indices[i * 2] < N * 2
      11  		  ? x[indices[i * 2]] + 1
      12  		  : 1);
      13        y[i * 2 + 1] = (indices[i * 2 + 1] < N * 2
      14  		      ? x[indices[i * 2 + 1]] + 2
      15  		      : 2);
      16      }
      17  }
      18  
      19  int y[N * 2];
      20  int x[N * 2] = {
      21    72704, 52152, 51301, 96681,
      22    57937, 60490, 34504, 60944,
      23    42225, 28333, 88336, 74300,
      24    29250, 20484, 38852, 91536,
      25    86917, 63941, 31590, 21998,
      26    22419, 26974, 28668, 13968,
      27    3451, 20247, 44089, 85521,
      28    22871, 87362, 50555, 85939
      29  };
      30  int indices[N * 2] = {
      31    15, 0x10000, 0xcafe0, 19,
      32    7, 22, 19, 1,
      33    0x20000, 0x70000, 15, 30,
      34    5, 12, 11, 11,
      35    10, 25, 5, 20,
      36    22, 24, 32, 28,
      37    30, 19, 6, 0xabcdef,
      38    7, 12, 8, 21
      39  };
      40  int expected[N * 2] = {
      41    91537, 2, 1, 22000,
      42    60945, 28670, 21999, 52154,
      43    1, 2, 91537, 50557,
      44    60491, 29252, 74301, 74302,
      45    88337, 20249, 60491, 22421,
      46    28669, 3453, 1, 22873,
      47    50556, 22000, 34505, 2,
      48    60945, 29252, 42226, 26976
      49  };
      50  
      51  int
      52  main (void)
      53  {
      54    check_vect ();
      55  
      56    f (y, x, indices);
      57    for (int i = 0; i < 32; ++i)
      58      if (y[i] != expected[i])
      59        __builtin_abort ();
      60  
      61    return 0;
      62  }
      63  
      64  /* { dg-final { scan-tree-dump "Loop contains only SLP stmts" vect { target { vect_gather_load_ifn && vect_masked_load } } } } */