2018-05-17 Richard Biener <rguenther@suse.de>
[official-gcc.git] / gcc / testsuite / gcc.target / i386 / avx512f-vminsd-3.c
blobeac806b0f235cdbc0117efdafde301deb9b993c0
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 / 64)
10 #include "avx512f-mask-type.h"
12 static void
13 calc_min (double *r, double *s1, double *s2)
15 r[0] = s1[0] < s2[0] ? s1[0] : s2[0];
16 r[1] = s1[1];
19 void
20 avx512f_test (void)
22 int i, sign;
23 union128d res1, res2, res3, res4, src1, src2;
24 MASK_TYPE mask = 0;
25 double res_ref[SIZE];
27 sign = -1;
28 for (i = 0; i < SIZE; i++)
30 src1.a[i] = 1.5 + 34.67 * i * sign;
31 src2.a[i] = -22.17 * i * sign + 1.0;
32 res1.a[i] = DEFAULT_VALUE;
33 res3.a[i] = DEFAULT_VALUE;
34 sign = sign * -1;
37 res1.x = _mm_mask_min_sd (res1.x, mask, src1.x, src2.x);
38 res2.x = _mm_maskz_min_sd (mask, src1.x, src2.x);
39 res3.x = _mm_mask_min_round_sd (res3.x, mask, src1.x, src2.x, _MM_FROUND_NO_EXC);
40 res4.x = _mm_maskz_min_round_sd (mask, src1.x, src2.x, _MM_FROUND_NO_EXC);
42 calc_min (res_ref, src1.a, src2.a);
44 MASK_MERGE (d) (res_ref, mask, 1);
45 if (check_union128d (res1, res_ref))
46 abort ();
48 MASK_ZERO (d) (res_ref, mask, 1);
49 if (check_union128d (res2, res_ref))
50 abort ();
52 calc_min (res_ref, src1.a, src2.a);
54 MASK_MERGE (d) (res_ref, mask, 1);
55 if (check_union128d (res3, res_ref))
56 abort ();
58 MASK_ZERO (d) (res_ref, mask, 1);
59 if (check_union128d (res4, res_ref))
60 abort ();