2 /* { dg-options "-O2 -mavx512f" } */
3 /* { dg-require-effective-target avx512f } */
7 #include "avx512f-helper.h"
9 #define SIZE (AVX512F_LEN / 32)
10 #include "avx512f-mask-type.h"
16 #ifndef SELECT4_DEFINED
17 #define SELECT4_DEFINED
19 select4 (int i
, unsigned ctrl
)
28 res
= ((CTRL
& 0x0c) >> 2);
31 res
= ((CTRL
& 0x30) >> 4);
34 res
= ((CTRL
& 0xc0) >> 6);
42 CALC (float *s
, float *r
)
46 for (i
= 0; i
< SIZE
; i
++)
48 r
[i
] = s
[(4 * (i
/ 4)) + select4 (i
, CTRL
)];
55 UNION_TYPE (AVX512F_LEN
,) s1
, res1
, res2
, res3
;
56 MASK_TYPE mask
= MASK_VALUE
;
60 for (i
= 0; i
< SIZE
; i
++)
63 res2
.a
[i
] = DEFAULT_VALUE
;
66 res1
.x
= INTRINSIC (_permute_ps
) (s1
.x
, CTRL
);
67 res2
.x
= INTRINSIC (_mask_permute_ps
) (res2
.x
, mask
, s1
.x
, CTRL
);
68 res3
.x
= INTRINSIC (_maskz_permute_ps
) (mask
, s1
.x
, CTRL
);
72 if (UNION_CHECK (AVX512F_LEN
,) (res1
, res_ref
))
75 MASK_MERGE ()(res_ref
, mask
, SIZE
);
76 if (UNION_CHECK (AVX512F_LEN
,) (res2
, res_ref
))
79 MASK_ZERO ()(res_ref
, mask
, SIZE
);
80 if (UNION_CHECK (AVX512F_LEN
,) (res3
, res_ref
))