libstdc++: Remove std::__is_pointer and std::__is_scalar [PR115497]
[official-gcc.git] / gcc / testsuite / gcc.target / i386 / avx512f-vrndscaleps-2.c
blob470313d97419ada2314ef982866c801909c64045
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"
11 #include "math.h"
13 static void
14 CALC (float *s, float *r, int imm)
16 int i = 0, rc, m;
17 rc = imm & 0xf;
18 m = imm >> 4;
19 for (i = 0; i < SIZE; i++)
20 switch (rc)
22 case _MM_FROUND_FLOOR:
23 r[i] = floor (s[i] * pow (2, m)) / pow (2, m);
24 break;
25 case _MM_FROUND_CEIL:
26 r[i] = ceil (s[i] * pow (2, m)) / pow (2, m);
27 break;
28 default:
29 abort ();
30 break;
34 void
35 TEST (void)
37 int imm, i, j;
38 UNION_TYPE (AVX512F_LEN,) res1, res2, res3, s;
39 float res_ref[SIZE];
41 MASK_TYPE mask = MASK_VALUE;
43 imm = _MM_FROUND_FLOOR | (7 << 4);
45 for (i = 0; i < 3; i++)
48 for (j = 0; j < SIZE; j++)
50 s.a[j] = j * (j + 12.0231);
51 res1.a[j] = DEFAULT_VALUE;
52 res2.a[j] = DEFAULT_VALUE;
53 res3.a[j] = DEFAULT_VALUE;
56 switch (i)
58 case 0:
59 imm = _MM_FROUND_FLOOR | (7 << 4);
60 res1.x = INTRINSIC (_roundscale_ps) (s.x, imm);
61 res2.x = INTRINSIC (_mask_roundscale_ps) (res2.x, mask, s.x, imm);
62 res3.x = INTRINSIC (_maskz_roundscale_ps) (mask, s.x, imm);
63 break;
64 case 1:
65 imm = _MM_FROUND_FLOOR;
66 res1.x = INTRINSIC (_floor_ps) (s.x);
67 #if AVX512F_LEN == 512
68 res2.x = INTRINSIC (_mask_floor_ps) (res2.x, mask, s.x);
69 #endif
70 break;
71 case 2:
72 imm = _MM_FROUND_CEIL;
73 res1.x = INTRINSIC (_ceil_ps) (s.x);
74 #if AVX512F_LEN == 512
75 res2.x = INTRINSIC (_mask_ceil_ps) (res2.x, mask, s.x);
76 #endif
77 break;
80 CALC (s.a, res_ref, imm);
82 if (UNION_CHECK (AVX512F_LEN,) (res1, res_ref))
83 abort ();
85 MASK_MERGE ()(res_ref, mask, SIZE);
87 #if AVX512F_LEN == 512
88 if (UNION_CHECK (AVX512F_LEN,) (res2, res_ref))
89 abort ();
90 #else
91 if (!i && UNION_CHECK (AVX512F_LEN,) (res2, res_ref))
92 abort ();
93 #endif
95 MASK_ZERO ()(res_ref, mask, SIZE);
97 if (!i && UNION_CHECK (AVX512F_LEN,) (res3, res_ref))
98 abort ();