1 /* PR target/59501 */
2 /* { dg-do run } */
3 /* { dg-options "-O2 -mavx -mno-accumulate-outgoing-args" } */
4 /* { dg-require-effective-target avx } */
5 
6 #define CHECK_H "avx-check.h"
7 #define TEST avx_test
8 
9 #include CHECK_H
10 
11 typedef double V __attribute__ ((vector_size (32)));
12 
13 __attribute__((noinline, noclone)) V
foo(double * x,unsigned * y)14 foo (double *x, unsigned *y)
15 {
16   V r = { x[y[0]], x[y[1]], x[y[2]], x[y[3]] };
17   return r;
18 }
19 
20 static void
TEST(void)21 TEST (void)
22 {
23   double a[16];
24   unsigned b[4] = { 5, 0, 15, 7 };
25   int i;
26   for (i = 0; i < 16; i++)
27     a[i] = 0.5 + i;
28   V v = foo (a, b);
29   if (v[0] != 5.5 || v[1] != 0.5 || v[2] != 15.5 || v[3] != 7.5)
30     __builtin_abort ();
31 }
32