2 /* { dg-options "-O2 -mavx512f" } */
3 /* { dg-require-effective-target avx512f } */
7 #include "avx512f-helper.h"
9 #define SIZE (AVX512F_LEN / 64)
10 #include "avx512f-mask-type.h"
14 CALC (double *dst
, double *src1
, long long *ind
, double *src2
)
18 for (i
= 0; i
< SIZE
; i
++)
20 unsigned long long offset
= ind
[i
] & (SIZE
- 1);
21 unsigned long long cond
= ind
[i
] & SIZE
;
23 dst
[i
] = cond
? src2
[offset
] : src1
[offset
];
31 UNION_TYPE (AVX512F_LEN
, d
) s1
, s2
, res1
, res2
, res3
;
32 UNION_TYPE (AVX512F_LEN
, i_q
) ind
;
35 MASK_TYPE mask
= MASK_VALUE
;
37 for (i
= 0; i
< SIZE
; i
++)
39 ind
.a
[i
] = 17 * (i
<< 1);
40 s1
.a
[i
] = DEFAULT_VALUE
;
43 res1
.a
[i
] = DEFAULT_VALUE
;
44 res2
.a
[i
] = DEFAULT_VALUE
;
45 res3
.a
[i
] = DEFAULT_VALUE
;
48 CALC (res_ref
, s1
.a
, ind
.a
, s2
.a
);
50 res1
.x
= INTRINSIC (_permutex2var_pd
) (s1
.x
, ind
.x
, s2
.x
);
51 res2
.x
= INTRINSIC (_mask_permutex2var_pd
) (s1
.x
, mask
, ind
.x
, s2
.x
);
53 INTRINSIC (_maskz_permutex2var_pd
) (mask
, s1
.x
, ind
.x
, s2
.x
);
55 if (UNION_CHECK (AVX512F_LEN
, d
) (res1
, res_ref
))
58 MASK_MERGE (d
) (res_ref
, mask
, SIZE
);
59 if (UNION_CHECK (AVX512F_LEN
, d
) (res2
, res_ref
))
62 MASK_ZERO (d
) (res_ref
, mask
, SIZE
);
63 if (UNION_CHECK (AVX512F_LEN
, d
) (res3
, res_ref
))