PR target/80969 - Fix ICE with -mabi=ms -mavx512f, reduce wasted space when realignin...
[official-gcc.git] / gcc / testsuite / gcc.target / i386 / avx512f-vminss-3.c
blob0ecddd6803ea336bee6f3d9588e1920b8d15e2a9
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_min (float *r, float *s1, float *s2)
15 r[0] = s1[0] < s2[0] ? s1[0] : s2[0];
16 int i;
17 for (i = 1; i < SIZE; i++)
19 r[i] = s1[i];
23 void
24 avx512f_test (void)
26 int i, sign;
27 union128 res1, res2, res3, res4, src1, src2;
28 MASK_TYPE mask = 0;
29 float res_ref[SIZE];
31 sign = -1;
32 for (i = 0; i < SIZE; i++)
34 src1.a[i] = 1.5 + 34.67 * i * sign;
35 src2.a[i] = -22.17 * i * sign + 1.0;
36 res1.a[i] = DEFAULT_VALUE;
37 res3.a[i] = DEFAULT_VALUE;
38 sign = sign * -1;
41 res1.x = _mm_mask_min_ss (res1.x, mask, src1.x, src2.x);
42 res2.x = _mm_maskz_min_ss (mask, src1.x, src2.x);
43 res3.x = _mm_mask_min_round_ss (res3.x, mask, src1.x, src2.x, _MM_FROUND_NO_EXC);
44 res4.x = _mm_maskz_min_round_ss (mask, src1.x, src2.x, _MM_FROUND_NO_EXC);
46 calc_min (res_ref, src1.a, src2.a);
48 MASK_MERGE () (res_ref, mask, 1);
49 if (check_union128 (res1, res_ref))
50 abort ();
52 MASK_ZERO () (res_ref, mask, 1);
53 if (check_union128 (res2, res_ref))
54 abort ();
56 calc_min (res_ref, src1.a, src2.a);
58 MASK_MERGE () (res_ref, mask, 1);
59 if (check_union128 (res3, res_ref))
60 abort ();
62 MASK_ZERO () (res_ref, mask, 1);
63 if (check_union128 (res4, res_ref))
64 abort ();