2 /* { dg-require-effective-target avx2 } */
3 /* { dg-options "-O2 -mavx2" } */
6 #include "avx2-check.h"
9 compute_i32gatherpd256 (double *src
,
11 int *s2
, double *mask
, int scale
, double *r
)
15 for (i
= 0; i
< 4; ++i
)
16 if ((((long long *) mask
)[i
] >> 63) & 1)
17 r
[i
] = *(double *) (((unsigned char *) s1
) + s2
[i
] * scale
);
27 union256d res
, src
, mask
;
28 double s1
[4], res_ref
[4] = { 0 };
30 for (i
= 0; i
< 4; ++i
)
33 s1
[i
] = 2.718281828459045 * (i
+ 1) * (i
+ 2);
35 /* Set src as something different from s1 */
39 ((long long *) mask
.a
)[i
] = i
% 2 ? 0 : -1;
41 /* About to gather in reverse order, divide by 2
42 to demonstrate scale */
43 idx
.a
[i
] = (16 - (i
+ 1) * 8) >> 1;
46 res
.x
= _mm256_mask_i32gather_pd (src
.x
, s1
, idx
.x
, mask
.x
, 2);
48 compute_i32gatherpd256 (src
.a
, s1
, idx
.a
, mask
.a
, 2, res_ref
);
50 if (check_union256d (res
, res_ref
) != 0)