2 /* { dg-require-effective-target avx2 } */
3 /* { dg-options "-O2 -mavx2" } */
6 #include "avx2-check.h"
9 compute_i64gatherps256 (float *src
,
11 long long *s2
, float *mask
, int scale
, float *r
)
15 for (i
= 0; i
< 4; ++i
)
16 if ((((int *) mask
)[i
] >> 31) & 1)
17 r
[i
] = *(float *) (((unsigned char *) s1
) + s2
[i
] * scale
);
27 union128 res
, src
, mask
;
28 float 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 ((int *) mask
.a
)[i
] = i
% 2 ? 0 : -1;
41 /* About to gather in reverse order,
42 divide by 2 to demonstrate scale */
43 idx
.a
[i
] = (16 - (i
+ 1) * 4) >> 1;
46 res
.x
= _mm256_mask_i64gather_ps (src
.x
, s1
, idx
.x
, mask
.x
, 2);
48 compute_i64gatherps256 (src
.a
, s1
, idx
.a
, mask
.a
, 2, res_ref
);
50 if (check_union128 (res
, res_ref
) != 0)