2015-12-10 Vladimir Makarov <vmakarov@redhat.com>
[official-gcc.git] / gcc / testsuite / gcc.target / i386 / avx512f-vfmsubXXXps-2.c
blob5952f9d14ee2c19018ea98cb6ad8eb4a03ec0964
1 /* { dg-do run } */
2 /* { dg-options "-O2 -mavx512f" } */
3 /* { dg-require-effective-target avx512f } */
5 #define AVX512F
7 #include "avx512f-helper.h"
9 #define SIZE (AVX512F_LEN / 32)
10 #include "avx512f-mask-type.h"
12 static void
13 CALC (float *s1, float *s2, float *s3, float *r)
15 int i;
17 for (i = 0; i < SIZE; i++)
19 r[i] = s1[i] * s2[i] - s3[i];
23 void
24 TEST (void)
26 UNION_TYPE (AVX512F_LEN, ) s1, s2, s3, res1, res2, res3, res4;
27 MASK_TYPE mask = MASK_VALUE;
28 float res_ref1[SIZE];
29 float res_ref2[SIZE];
30 int i, sign = 1;
32 for (i = 0; i < SIZE; i++)
34 s1.a[i] = DEFAULT_VALUE;
35 s2.a[i] = 56.78 * (i + 1) * sign;
36 s3.a[i] = 90.12 * (i + 2) * sign;
37 sign = -sign;
40 #if AVX512F_LEN == 512
41 res1.x = INTRINSIC (_fmsub_ps) (s1.x, s2.x, s3.x);
42 #endif
43 res2.x = INTRINSIC (_mask_fmsub_ps) (s1.x, mask, s2.x, s3.x);
44 res3.x = INTRINSIC (_mask3_fmsub_ps) (s2.x, s3.x, s1.x, mask);
45 res4.x = INTRINSIC (_maskz_fmsub_ps) (mask, s1.x, s2.x, s3.x);
47 CALC (s1.a, s2.a, s3.a, res_ref1);
48 CALC (s2.a, s3.a, s1.a, res_ref2);
50 #if AVX512F_LEN == 512
51 if (UNION_ROUGH_CHECK (AVX512F_LEN, ) (res1, res_ref1, 0.0001))
52 abort ();
53 #endif
55 MASK_MERGE () (res_ref1, mask, SIZE);
56 if (UNION_ROUGH_CHECK (AVX512F_LEN, ) (res2, res_ref1, 0.0001))
57 abort ();
59 MASK_MERGE () (res_ref2, mask, SIZE);
60 if (UNION_ROUGH_CHECK (AVX512F_LEN, ) (res3, res_ref2, 0.0001))
61 abort ();
63 MASK_ZERO () (res_ref1, mask, SIZE);
64 if (UNION_ROUGH_CHECK (AVX512F_LEN, ) (res4, res_ref1, 0.0001))
65 abort ();