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"
14 CALC (float *dst
, float *src1
, int *ind
, float *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
,) s1
, s2
, res
;
32 UNION_TYPE (AVX512F_LEN
, i_d
) ind
;
41 MASK_TYPE mask
= MASK_VALUE
;
43 for (i
= 0; i
< SIZE
; i
++)
45 /* Some of the integer indexes may be interpreted as floating point
46 values in mask-merge mode, that's why we use IND_COPY. */
47 ind
.a
[i
] = ind_copy
[i
].i
= 17 * (i
<< 1);
48 s1
.a
[i
] = 42.5 * i
+ 1;
51 res
.a
[i
] = DEFAULT_VALUE
;
54 CALC (res_ref
, s1
.a
, ind
.a
, s2
.a
);
56 res
.x
= INTRINSIC (_mask2_permutex2var_ps
) (s1
.x
, ind
.x
, mask
, s2
.x
);
58 /* Standard MASK_MERGE cannot be used since VPERMI2PS in mask-merge mode
59 merges vectors of two different types (_m512 and __m512i). */
60 for (k
= 0; k
< SIZE
; k
++)
61 res_ref
[k
] = (mask
& (1LL << k
)) ? res_ref
[k
] : ind_copy
[k
].f
;
63 if (UNION_CHECK (AVX512F_LEN
,) (res
, res_ref
))