LWG 3035. std::allocator's constructors should be constexpr
[official-gcc.git] / gcc / testsuite / gcc.dg / vect / fast-math-vect-call-2.c
blob274ff0f9942c5aff6c6aaca5243ef21bd8708856
1 /* { dg-require-effective-target vect_double } */
3 #include "tree-vect.h"
5 extern long int lrint (double);
6 extern void abort (void);
7 long int a[64];
8 double b[64];
10 __attribute__((noinline, noclone)) void
11 f1 (int n)
13 int i;
14 for (i = 0; i < n; i++)
16 a[4 * i + 0] = lrint (b[4 * i + 0]) + 1;
17 a[4 * i + 1] = lrint (b[4 * i + 1]) + 2;
18 a[4 * i + 2] = lrint (b[4 * i + 2]) + 3;
19 a[4 * i + 3] = lrint (b[4 * i + 3]) + 4;
23 __attribute__((noinline, noclone)) void
24 f2 (int n)
26 int i;
27 for (i = 0; i < 2 * n; i++)
29 a[2 * i + 0] = lrint (b[2 * i + 0]) + 1;
30 a[2 * i + 1] = lrint (b[2 * i + 1]) + 2;
34 __attribute__((noinline, noclone)) void
35 f3 (void)
37 int i;
38 for (i = 0; i < 64; i++)
39 a[i] = lrint (b[i]) + 1;
42 __attribute__((noinline, noclone)) void
43 f4 (int n)
45 int i;
46 for (i = 0; i < n; i++)
48 a[4 * i + 0] = lrint (b[4 * i + 0]);
49 a[4 * i + 1] = lrint (b[4 * i + 1]);
50 a[4 * i + 2] = lrint (b[4 * i + 2]);
51 a[4 * i + 3] = lrint (b[4 * i + 3]);
55 __attribute__((noinline, noclone)) void
56 f5 (int n)
58 int i;
59 for (i = 0; i < 2 * n; i++)
61 a[2 * i + 0] = lrint (b[2 * i + 0]);
62 a[2 * i + 1] = lrint (b[2 * i + 1]);
66 __attribute__((noinline, noclone)) void
67 f6 (void)
69 int i;
70 for (i = 0; i < 64; i++)
71 a[i] = lrint (b[i]);
74 __attribute__((noinline, noclone)) int
75 main1 ()
77 int i;
79 for (i = 0; i < 64; i++)
81 asm ("");
82 b[i] = ((i & 1) ? -4 * i : 4 * i) + 0.25;
84 f1 (16);
85 for (i = 0; i < 64; i++)
86 if (a[i] != ((i & 1) ? -4 * i : 4 * i) + 1 + (i & 3))
87 abort ();
88 else
89 a[i] = 131.25;
90 f2 (16);
91 for (i = 0; i < 64; i++)
92 if (a[i] != ((i & 1) ? -4 * i : 4 * i) + 1 + (i & 1))
93 abort ();
94 else
95 a[i] = 131.25;
96 f3 ();
97 for (i = 0; i < 64; i++)
98 if (a[i] != ((i & 1) ? -4 * i : 4 * i) + 1)
99 abort ();
100 else
101 a[i] = 131.25;
102 f4 (16);
103 for (i = 0; i < 64; i++)
104 if (a[i] != ((i & 1) ? -4 * i : 4 * i))
105 abort ();
106 else
107 a[i] = 131.25;
108 f5 (16);
109 for (i = 0; i < 64; i++)
110 if (a[i] != ((i & 1) ? -4 * i : 4 * i))
111 abort ();
112 else
113 a[i] = 131.25;
114 f6 ();
115 for (i = 0; i < 64; i++)
116 if (a[i] != ((i & 1) ? -4 * i : 4 * i))
117 abort ();
118 return 0;
122 main ()
124 check_vect ();
125 return main1 ();
128 /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 6 "vect" { target vect_call_lrint } } } */
129 /* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 4 "vect" { target vect_call_lrint } } } */