PR target/80969 - Fix ICE with -mabi=ms -mavx512f, reduce wasted space when realignin...
[official-gcc.git] / gcc / testsuite / gcc.target / i386 / avx512f-vmulss-2.c
blob29dc3bf367d98a6baf6eba1521de5d9dd35492d0
1 /* { dg-do run } */
2 /* { dg-options "-O2 -mavx512f" } */
3 /* { dg-require-effective-target avx512f } */
5 #include "avx512f-check.h"
7 #include "avx512f-helper.h"
9 #define SIZE (128 / 32)
10 #include "avx512f-mask-type.h"
12 static void
13 calc_mul (float *r, float *s1, float *s2)
15 r[0] = s1[0] * s2[0];
16 int i;
17 for (i = 1; i < SIZE; i++)
18 r[i] = s1[i];
21 void
22 avx512f_test (void)
24 int i, sign;
25 union128 res1, res2, res3, res4, res5, src1, src2;
26 MASK_TYPE mask = MASK_VALUE;
27 float res_ref[SIZE];
29 sign = -1;
30 for (i = 0; i < SIZE; i++)
32 src1.a[i] = 1.5 + 34.67 * i * sign;
33 src2.a[i] = -22.17 * i * sign + 1.0;
34 sign = sign * -1;
36 for (i = 0; i < SIZE; i++)
38 res1.a[i] = DEFAULT_VALUE;
39 res4.a[i] = DEFAULT_VALUE;
42 res1.x = _mm_mask_mul_ss (res1.x, mask, src1.x, src2.x);
43 res2.x = _mm_maskz_mul_ss (mask, src1.x, src2.x);
44 res3.x = _mm_mul_round_ss (src1.x, src2.x, _MM_FROUND_NO_EXC);
45 res4.x = _mm_mask_mul_round_ss (res4.x, mask, src1.x, src2.x, _MM_FROUND_NO_EXC);
46 res5.x = _mm_maskz_mul_round_ss (mask, src1.x, src2.x, _MM_FROUND_NO_EXC);
48 calc_mul (res_ref, src1.a, src2.a);
50 MASK_MERGE () (res_ref, mask, 1);
51 if (check_union128 (res1, res_ref))
52 abort ();
54 MASK_ZERO () (res_ref, mask, 1);
55 if (check_union128 (res2, res_ref))
56 abort ();
58 calc_mul (res_ref, src1.a, src2.a);
60 if (check_union128 (res3, res_ref))
61 abort();
63 MASK_MERGE () (res_ref, mask, 1);
64 if (check_union128 (res4, res_ref))
65 abort ();
67 MASK_ZERO () (res_ref, mask, 1);
68 if (check_union128 (res5, res_ref))
69 abort ();