Debian Codegraph @

gcc/testsuite/gcc.target/i386/pr101248.c

raw
1 /* PR target/101248 */
2 /* { dg-do run } */
3 /* { dg-options "-O2 -mavx512vl -std=gnu99" } */
4 /* { dg-require-effective-target avx512vl } */
5 /* { dg-require-effective-target c99_runtime } */
6
7 #define AVX512VL
8 #define AVX512F_LEN 128
9 #define AVX512F_LEN_HALF 128
10
11 #include "avx512f-helper.h"
12
13 #define SIZE (AVX512F_LEN / 64)
14 #include "avx512f-mask-type.h"
15 #include "math_m_pi.h"
16 #include "float.h"
17
18
19 static void
20 CALC (double *r, double dest, double src, long long tbl)
21 {
22 switch (tbl & 0xf)
23 {
24 case 0:
25 *r = dest;
26 break;
27 case 1:
28 *r = src;
29 break;
30 case 2:
31 *r = signbit (src) ? -NAN : NAN;
32 break;
33 case 3:
34 *r = -NAN;
35 break;
36 case 4:
37 *r = -INFINITY;
38 break;
39 case 5:
40 *r = INFINITY;
41 break;
42 case 6:
43 *r = signbit (src) ? -INFINITY : INFINITY;
44 break;
45 case 7:
46 *r = 1.0 / -INFINITY;
47 break;
48 case 8:
49 *r = 0.0;
50 break;
51 case 9:
52 *r = -1.0;
53 break;
54 case 10:
55 *r = 1.0;
56 break;
57 case 11:
58 *r = 1.0 / 2.0;
59 break;
60 case 12:
61 *r = 90.0;
62 break;
63 case 13:
64 *r = M_PI_2;
65 break;
66 case 14:
67 *r = DBL_MAX;
68 break;
69 case 15:
70 *r = -DBL_MAX;
71 break;
72 default:
73 abort ();
74 }
75 }
76
77 void
78 TEST (void)
79 {
80 int i, j;
81 UNION_TYPE (AVX512F_LEN, d) res1, res2, res3, s1;
82 UNION_TYPE (AVX512F_LEN, i_q) s2;
83 double res_ref[SIZE];
84
85
86 float vals[2] = { -10, 10 };
87 int controls[8] = {0, 0x11111111, 0x77777777, 0x88888888,
88 0x99999999, 0xaaaaaaaa, 0xbbbbbbbb, 0xcccccccc};
89
90 MASK_TYPE mask = 1;
91
92 for (i = 0; i < 2; i++)
93 {
94 for (j = 0; j < SIZE; j++)
95 {
96 s1.a[j] = vals[i];
97 s2.a[j] = controls[j];
98 res1.a[j] = DEFAULT_VALUE;
99 res2.a[j] = DEFAULT_VALUE;
100 res3.a[j] = DEFAULT_VALUE;
101
102 CALC (&res_ref[j], res1.a[j], s1.a[j], s2.a[j]);
103 }
104
105 res1.x = INTRINSIC (_fixupimm_pd) (res1.x, s1.x, s2.x, 0);
106 res2.x = INTRINSIC (_mask_fixupimm_pd) (res2.x, mask, s1.x, s2.x, 0);
107 res3.x = INTRINSIC (_maskz_fixupimm_pd) (mask, res3.x, s1.x, s2.x, 0);
108
109 if (UNION_CHECK (AVX512F_LEN, d) (res1, res_ref))
110 abort ();
111
112 MASK_MERGE(d) (res_ref, mask, SIZE);
113 if (UNION_CHECK (AVX512F_LEN, d) (res2, res_ref))
114 abort ();
115 MASK_ZERO(d) (res_ref, mask, SIZE);
116 if (UNION_CHECK (AVX512F_LEN, d) (res3, res_ref))
117 abort ();
118 }
119 }
120
121 void
122 test_256 (void)
123 {}