2 /* { dg-options "-O2 -mavx512bw -DAVX512BW" } */
3 /* { dg-require-effective-target avx512bw } */
5 #include "avx512f-helper.h"
7 #define DST_SIZE (AVX512F_LEN / 8)
8 #define SRC_SIZE (AVX512F_LEN / 16)
12 #include "avx512f-mask-type.h"
15 EVAL(short_to_char
, AVX512F_LEN
,) (short iVal
)
21 else if (iVal
> CHAR_MAX
)
30 CALC (short *src1
, short *src2
, char *dst
)
35 for (i
= 0; i
< DST_SIZE
; i
++)
37 ptr
= (i
/ 8) % 2 ? src2
: src1
;
38 dst
[i
] = EVAL(short_to_char
, AVX512F_LEN
,) (ptr
[i
% 8 + (i
/ 16) * 8]);
45 UNION_TYPE (AVX512F_LEN
, i_w
) s1
, s2
;
46 UNION_TYPE (AVX512F_LEN
, i_b
) res1
, res2
, res3
;
47 MASK_TYPE mask
= MASK_VALUE
;
48 char dst_ref
[DST_SIZE
];
51 for (i
= 0; i
< DST_SIZE
; i
++)
52 res2
.a
[i
] = DEFAULT_VALUE
;
54 for (i
= 0; i
< SRC_SIZE
; i
++)
60 res1
.x
= INTRINSIC (_packs_epi16
) (s1
.x
, s2
.x
);
61 res2
.x
= INTRINSIC (_mask_packs_epi16
) (res2
.x
, mask
, s1
.x
, s2
.x
);
62 res3
.x
= INTRINSIC (_maskz_packs_epi16
) (mask
, s1
.x
, s2
.x
);
64 CALC (s1
.a
, s2
.a
, dst_ref
);
66 if (UNION_CHECK (AVX512F_LEN
, i_b
) (res1
, dst_ref
))
69 MASK_MERGE (i_b
) (dst_ref
, mask
, DST_SIZE
);
70 if (UNION_CHECK (AVX512F_LEN
, i_b
) (res2
, dst_ref
))
73 MASK_ZERO (i_b
) (dst_ref
, mask
, DST_SIZE
);
74 if (UNION_CHECK (AVX512F_LEN
, i_b
) (res3
, dst_ref
))