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"
15 CALC (float *dst
, float *src1
, int *ind
, float *src2
)
19 for (i
= 0; i
< SIZE
; i
++)
21 unsigned long long offset
= ind
[i
] & (SIZE
- 1);
22 unsigned long long cond
= ind
[i
] & SIZE
;
24 dst
[i
] = cond
? src2
[offset
] : src1
[offset
];
32 UNION_TYPE (AVX512F_LEN
,) s1
, s2
, res
;
33 UNION_TYPE (AVX512F_LEN
, i_d
) ind
;
42 MASK_TYPE mask
= MASK_VALUE
;
44 for (i
= 0; i
< SIZE
; i
++)
46 /* Some of the integer indexes may be interpreted as floating point
47 values in mask-merge mode, that's why we use IND_COPY. */
48 ind
.a
[i
] = ind_copy
[i
].i
= 17 * (i
<< 1);
49 s1
.a
[i
] = 42.5 * i
+ 1;
52 res
.a
[i
] = DEFAULT_VALUE
;
55 CALC (res_ref
, s1
.a
, ind
.a
, s2
.a
);
57 res
.x
= INTRINSIC (_mask2_permutex2var_ps
) (s1
.x
, ind
.x
, mask
, s2
.x
);
59 /* Standard MASK_MERGE cannot be used since VPERMI2PS in mask-merge mode
60 merges vectors of two different types (_m512 and __m512i). */
61 for (k
= 0; k
< SIZE
; k
++)
62 res_ref
[k
] = (mask
& (1LL << k
)) ? res_ref
[k
] : ind_copy
[k
].f
;
64 if (UNION_CHECK (AVX512F_LEN
,) (res
, res_ref
))