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"
13 CALC (int *src1
, int *src2
, int *src3
, int imm
, int *r
)
15 int i
, j
, index
, res
, mask
, one_mask
= 1;
16 int src1_bit
, src2_bit
, src3_bit
, imm_bit
;
18 for (i
= 0; i
< SIZE
; i
++)
21 for (j
= 0; j
< 32; j
++)
24 src1_bit
= ((src1
[i
] & mask
) >> j
) << 2;
25 src2_bit
= ((src2
[i
] & mask
) >> j
) << 1;
26 src3_bit
= ((src3
[i
] & mask
) >> j
);
27 index
= src1_bit
| src2_bit
| src3_bit
;
28 imm_bit
= (imm
& (one_mask
<< index
)) >> index
;
29 res
= res
| (imm_bit
<< j
);
38 UNION_TYPE (AVX512F_LEN
, i_d
) src2
, src3
, res1
, res2
, res3
;
39 MASK_TYPE mask
= MASK_VALUE
;
43 for (i
= 0; i
< SIZE
; i
++)
45 res1
.a
[i
] = DEFAULT_VALUE
;
46 res2
.a
[i
] = DEFAULT_VALUE
;
47 res3
.a
[i
] = DEFAULT_VALUE
;
48 src2
.a
[i
] = 145132 * i
+ 123123;
49 src3
.a
[i
] = 1223 * i
+ 895;
52 CALC (res1
.a
, src2
.a
, src3
.a
, imm
, res_ref
);
54 res1
.x
= INTRINSIC (_ternarylogic_epi32
) (res1
.x
, src2
.x
, src3
.x
,
56 res2
.x
= INTRINSIC (_mask_ternarylogic_epi32
) (res2
.x
, mask
, src2
.x
,
58 res3
.x
= INTRINSIC (_maskz_ternarylogic_epi32
) (mask
, res3
.x
, src2
.x
,
61 if (UNION_CHECK (AVX512F_LEN
, i_d
) (res1
, res_ref
))
64 MASK_MERGE (i_d
) (res_ref
, mask
, SIZE
);
65 if (UNION_CHECK (AVX512F_LEN
, i_d
) (res2
, res_ref
))
68 MASK_ZERO (i_d
) (res_ref
, mask
, SIZE
);
69 if (UNION_CHECK (AVX512F_LEN
, i_d
) (res3
, res_ref
))