* gcc.target/i386/pr70021.c: Add -mtune=skylake.
[official-gcc.git] / gcc / testsuite / gcc.target / i386 / avx512bw-vpmulhrsw-2.c
blobeeb826193e9fbc96902cd8064abec7429c6be4bc
1 /* { dg-do run } */
2 /* { dg-options "-O2 -mavx512bw" } */
3 /* { dg-require-effective-target avx512bw } */
5 #define AVX512BW
6 #include "avx512f-helper.h"
8 #define SIZE (AVX512F_LEN / 16)
9 #include "avx512f-mask-type.h"
11 void
12 CALC (short *src1, short *src2, short *dst)
14 int i, t0;
16 for (i = 0; i < SIZE; i++)
18 t0 = (((int) src1[i] * (int) src2[i]) >> 14) + 1;
19 dst[i] = (short) (t0 >> 1);
23 void
24 TEST (void)
26 UNION_TYPE (AVX512F_LEN, i_w) src1, src2, dst1, dst2, dst3;
27 short dst_ref[SIZE];
28 MASK_TYPE mask = MASK_VALUE;
29 int i, sign = -1;
31 for (i = 0; i < SIZE; i++)
33 src1.a[i] = i % 2;
34 src2.a[i] = i * sign;
35 dst2.a[i] = DEFAULT_VALUE;
36 sign = -sign;
39 dst1.x = INTRINSIC (_mulhrs_epi16) (src1.x, src2.x);
40 dst2.x =
41 INTRINSIC (_mask_mulhrs_epi16) (dst2.x, mask, src1.x, src2.x);
42 dst3.x = INTRINSIC (_maskz_mulhrs_epi16) (mask, src1.x, src2.x);
44 CALC (src1.a, src2.a, dst_ref);
46 if (UNION_CHECK (AVX512F_LEN, i_w) (dst1, dst_ref))
47 abort ();
49 MASK_MERGE (i_w) (dst_ref, mask, SIZE);
50 if (UNION_CHECK (AVX512F_LEN, i_w) (dst2, dst_ref))
51 abort ();
53 MASK_ZERO (i_w) (dst_ref, mask, SIZE);
54 if (UNION_CHECK (AVX512F_LEN, i_w) (dst3, dst_ref))
55 abort ();