2 /* { dg-options "-O2 -mavx512vbmi" } */
3 /* { dg-require-effective-target avx512vbmi } */
7 #include "avx512f-helper.h"
9 #define SIZE (AVX512F_LEN / 8)
13 #include "avx512f-mask-type.h"
18 CALC (char *dst
, char *src1
, char *ind
, char *src2
)
22 for (i
= 0; i
< SIZE
; i
++)
24 unsigned long long offset
= ind
[i
] & (SIZE
- 1);
25 unsigned long long cond
= ind
[i
] & SIZE
;
27 dst
[i
] = cond
? src2
[offset
] : src1
[offset
];
35 UNION_TYPE (AVX512F_LEN
, i_b
) s1
, s2
, res1
, res2
, res3
, ind
;
38 MASK_TYPE mask
= MASK_VALUE
;
40 for (i
= 0; i
< NUM
; i
++)
42 for (j
= 0; j
< SIZE
; j
++)
44 ind
.a
[j
] = i
* (j
<< 1);
45 s1
.a
[j
] = DEFAULT_VALUE
;
46 s2
.a
[j
] = 1.5 * i
* 2 * j
;
48 res1
.a
[j
] = DEFAULT_VALUE
;
49 res2
.a
[j
] = DEFAULT_VALUE
;
50 res3
.a
[j
] = DEFAULT_VALUE
;
53 CALC (res_ref
, s1
.a
, ind
.a
, s2
.a
);
55 res1
.x
= INTRINSIC (_permutex2var_epi8
) (s1
.x
, ind
.x
, s2
.x
);
57 INTRINSIC (_mask_permutex2var_epi8
) (s1
.x
, mask
, ind
.x
, s2
.x
);
59 INTRINSIC (_maskz_permutex2var_epi8
) (mask
, s1
.x
, ind
.x
,
62 if (UNION_CHECK (AVX512F_LEN
, i_b
) (res1
, res_ref
))
65 MASK_MERGE (i_b
) (res_ref
, mask
, SIZE
);
66 if (UNION_CHECK (AVX512F_LEN
, i_b
) (res2
, res_ref
))
69 MASK_ZERO (i_b
) (res_ref
, mask
, SIZE
);
70 if (UNION_CHECK (AVX512F_LEN
, i_b
) (res3
, res_ref
))