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"
13 CALC (long long *src1
, long long *src2
, long long *src3
,
14 long long imm
, long long *r
)
17 long long res
, index
, mask
, one_mask
= 1;
18 long long src1_bit
, src2_bit
, src3_bit
, imm_bit
;
20 for (i
= 0; i
< SIZE
; i
++)
23 for (j
= 0; j
< 64; j
++)
26 src1_bit
= ((src1
[i
] & mask
) >> j
) << 2;
27 src2_bit
= ((src2
[i
] & mask
) >> j
) << 1;
28 src3_bit
= ((src3
[i
] & mask
) >> j
);
29 index
= src1_bit
| src2_bit
| src3_bit
;
30 imm_bit
= (imm
& (one_mask
<< index
)) >> index
;
31 res
= res
| (imm_bit
<< j
);
40 UNION_TYPE (AVX512F_LEN
, i_q
) src2
, src3
, res1
, res2
, res3
;
41 MASK_TYPE mask
= MASK_VALUE
;
42 long long res_ref
[SIZE
];
45 for (i
= 0; i
< SIZE
; i
++)
47 res1
.a
[i
] = DEFAULT_VALUE
;
48 res2
.a
[i
] = DEFAULT_VALUE
;
49 res3
.a
[i
] = DEFAULT_VALUE
;
50 src2
.a
[i
] = 145132 * i
+ 123123;
51 src3
.a
[i
] = 1223 * i
+ 895;
54 CALC (res1
.a
, src2
.a
, src3
.a
, imm
, res_ref
);
56 res1
.x
= INTRINSIC (_ternarylogic_epi64
) (res1
.x
, src2
.x
, src3
.x
,
58 res2
.x
= INTRINSIC (_mask_ternarylogic_epi64
) (res2
.x
, mask
, src2
.x
,
60 res3
.x
= INTRINSIC (_maskz_ternarylogic_epi64
) (mask
, res3
.x
, src2
.x
,
63 if (UNION_CHECK (AVX512F_LEN
, i_q
) (res1
, res_ref
))
66 MASK_MERGE (i_q
) (res_ref
, mask
, SIZE
);
67 if (UNION_CHECK (AVX512F_LEN
, i_q
) (res2
, res_ref
))
70 MASK_ZERO (i_q
) (res_ref
, mask
, SIZE
);
71 if (UNION_CHECK (AVX512F_LEN
, i_q
) (res3
, res_ref
))