Debian Codegraph @

gcc/testsuite/gcc.target/i386/cond_op_addsubmuldiv_double-2.c

raw
1 /* { dg-do run } */
2 /* { dg-options "-O2 -mavx512vl -mprefer-vector-width=256" } */
3 /* { dg-require-effective-target avx512vl } */
4
5 #define AVX512VL
6 #ifndef CHECK
7 #define CHECK "avx512f-helper.h"
8 #endif
9
10 #include CHECK
11
12 #include "cond_op_addsubmuldiv_double-1.c"
13 #define BINO2(OPNAME, OP) \
14 void \
15 __attribute__ ((noipa,optimize ("O2"))) \
16 foo_o2_##OPNAME () \
17 { \
18 for (int i = 0; i != NUM; i++) \
19 if (b[i] < c[i]) \
20 j[i] = d[i] OP e[i]; \
21 }
22
23
24 BINO2 (add, +);
25 BINO2 (sub, -);
26 BINO2 (mul, *);
27 BINO2 (div, /);
28
29 static void
30 test_256 (void)
31 {
32 int sign = -1;
33 for (int i = 0; i != NUM; i++)
34 {
35 a[i] = 0.0;
36 d[i] = i * 0.5;
37 e[i] = i * i * 0.3 - i * 0.9 + 15.3;
38 b[i] = i * 0.83;
39 c[i] = b[i] + sign;
40 sign *= -1;
41 j[i] = b[i] < c[i] ? 1.0 : 0.0;
42 }
43 foo_add ();
44 foo_o2_add ();
45 for (int i = 0; i != NUM; i++)
46 {
47 if (a[i] != j[i])
48 abort ();
49 a[i] = 0.0;
50 j[i] = b[i] < c[i] ? 1.0 : 0.0;
51 }
52
53 foo_sub ();
54 foo_o2_sub ();
55 for (int i = 0; i != NUM; i++)
56 {
57 if (a[i] != j[i])
58 abort ();
59 a[i] = 0.0;
60 j[i] = b[i] < c[i] ? 1.0 : 0.0;
61 }
62
63 foo_mul ();
64 foo_o2_mul ();
65 for (int i = 0; i != NUM; i++)
66 {
67 if (a[i] != j[i])
68 abort ();
69 a[i] = 0.0;
70 j[i] = b[i] < c[i] ? 1.0 : 0.0;
71 }
72
73 foo_div ();
74 foo_o2_div ();
75 for (int i = 0; i != NUM; i++)
76 {
77 if (a[i] != j[i])
78 abort ();
79 }
80 }
81
82 static void
83 test_128 ()
84 {
85
86 }