[gcc]
[official-gcc.git] / gcc / testsuite / gcc.target / i386 / avx512f-vrsqrt14ss-2.c
blob739a852cea648197dbaffe4fc7e9472323a4bf73
1 /* { dg-do run } */
2 /* { dg-options "-mavx512f -O2" } */
3 /* { dg-require-effective-target avx512f } */
5 #include <math.h>
6 #include "avx512f-check.h"
7 #include "avx512f-helper.h"
9 static void
10 compute_vrsqrt14ss (float *s1, float *s2, float *r)
12 r[0] = 1.0 / sqrt (s2[0]);
13 r[1] = s1[1];
14 r[2] = s1[2];
15 r[3] = s1[3];
18 static void
19 avx512f_test (void)
21 union128 s1, s2, res1, res2, res3;
22 __mmask8 m = 0;
23 float res_ref[4];
25 s1.x = _mm_set_ps (-24.43, 68.346, -43.35, 546.46);
26 s2.x = _mm_set_ps (222.222, 333.333, 444.444, 4.0);
28 res1.x = _mm_rsqrt14_ss (s1.x, s2.x);
30 compute_vrsqrt14ss (s1.a, s2.a, res_ref);
32 if (check_fp_union128 (res1, res_ref))
33 abort ();
35 res2.x = _mm_set_ps (5.0, 6.0, 7.0, DEFAULT_VALUE);
36 res2.x = _mm_mask_rsqrt14_ss(res2.x, m, s1.x, s2.x);
38 MASK_MERGE () (res_ref, m, 1);
39 if (checkVf (res2.a, res_ref, 4))
40 abort();
42 res3.x = _mm_maskz_rsqrt14_ss(m, s1.x, s2.x);
44 MASK_ZERO () (res_ref, m, 1);
45 if (checkVf (res3.a, res_ref, 4))
46 abort();