Rebase.
[official-gcc.git] / gcc / testsuite / gcc.target / i386 / avx512f-vscalefpd-2.c
blobcbfe3de91e682533033375b10c64e903dea8bf96
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 / 64)
10 #include "avx512f-mask-type.h"
11 #include <math.h>
13 void static
14 CALC (double *r, double *s1, double *s2)
16 int i;
17 for (i = 0; i < SIZE; i++)
19 r[i] = ldexp (s1[i], floor (s2[i]));
23 void
24 TEST (void)
26 int i, sign;
27 UNION_TYPE (AVX512F_LEN, d) res1, res2, res3, src1, src2;
28 MASK_TYPE mask = MASK_VALUE;
29 double 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;
36 sign = sign * -1;
38 for (i = 0; i < SIZE; i++)
39 res2.a[i] = DEFAULT_VALUE;
41 res1.x = INTRINSIC (_scalef_pd) (src1.x, src2.x);
42 res2.x = INTRINSIC (_mask_scalef_pd) (res2.x, mask, src1.x, src2.x);
43 res3.x = INTRINSIC (_maskz_scalef_pd) (mask, src1.x, src2.x);
45 CALC (res_ref, src1.a, src2.a);
47 if (UNION_CHECK (AVX512F_LEN, d) (res1, res_ref))
48 abort ();
50 MASK_MERGE (d) (res_ref, mask, SIZE);
51 if (UNION_CHECK (AVX512F_LEN, d) (res2, res_ref))
52 abort ();
54 MASK_ZERO (d) (res_ref, mask, SIZE);
55 if (UNION_CHECK (AVX512F_LEN, d) (res3, res_ref))
56 abort ();