2 /* { dg-options "-O2 -mavx512bw -DAVX512BW" } */
3 /* { dg-require-effective-target avx512bw } */
5 #include "avx512f-helper.h"
7 #define SIZE (AVX512F_LEN / 16)
8 #include "avx512f-mask-type.h"
10 CALC (unsigned short *r
, unsigned short *s1
, unsigned short *s2
)
13 for (i
= 0; i
< SIZE
; i
++)
15 int tmp
= (int)s1
[i
] + (int)s2
[i
];
16 if (tmp
> 0xFFFF) tmp
= 0xFFFF;
18 r
[i
] = (unsigned short)tmp
;
26 UNION_TYPE (AVX512F_LEN
, i_w
) res1
, res2
, res3
, src1
, src2
;
27 MASK_TYPE mask
= MASK_VALUE
;
28 unsigned short res_ref
[SIZE
];
30 for (i
= 0; i
< SIZE
; i
++)
32 src1
.a
[i
] = 2 + 7 * i
% 291;
33 src2
.a
[i
] = 3 + 11 * (i
% 377) * i
;
35 for (i
= 0; i
< SIZE
; i
++)
36 res2
.a
[i
] = DEFAULT_VALUE
;
38 res1
.x
= INTRINSIC (_adds_epu16
) (src1
.x
, src2
.x
);
39 res2
.x
= INTRINSIC (_mask_adds_epu16
) (res2
.x
, mask
, src1
.x
, src2
.x
);
40 res3
.x
= INTRINSIC (_maskz_adds_epu16
) (mask
, src1
.x
, src2
.x
);
42 CALC (res_ref
, src1
.a
, src2
.a
);
44 if (UNION_CHECK (AVX512F_LEN
, i_w
) (res1
, res_ref
))
47 MASK_MERGE (i_w
) (res_ref
, mask
, SIZE
);
48 if (UNION_CHECK (AVX512F_LEN
, i_w
) (res2
, res_ref
))
51 MASK_ZERO (i_w
) (res_ref
, mask
, SIZE
);
52 if (UNION_CHECK (AVX512F_LEN
, i_w
) (res3
, res_ref
))