testsuite: Revert to the original version of pr100056.c
[official-gcc.git] / gcc / testsuite / gcc.dg / vect / fast-math-vect-call-2.c
blobc2aabc6357f3355faf87fffecf46b3ad1de65e97
1 /* { dg-require-effective-target vect_double } */
2 /* { dg-additional-options "-ffast-math" } */
3 /* { dg-additional-options "--param vect-epilogues-nomask=0" } */
5 #include "tree-vect.h"
7 extern long int lrint (double);
8 extern void abort (void);
9 long int a[64];
10 double b[64];
12 __attribute__((noinline, noclone)) void
13 f1 (int n)
15 int i;
16 for (i = 0; i < n; i++)
18 a[4 * i + 0] = lrint (b[4 * i + 0]) + 1;
19 a[4 * i + 1] = lrint (b[4 * i + 1]) + 2;
20 a[4 * i + 2] = lrint (b[4 * i + 2]) + 3;
21 a[4 * i + 3] = lrint (b[4 * i + 3]) + 4;
25 __attribute__((noinline, noclone)) void
26 f2 (int n)
28 int i;
29 for (i = 0; i < 2 * n; i++)
31 a[2 * i + 0] = lrint (b[2 * i + 0]) + 1;
32 a[2 * i + 1] = lrint (b[2 * i + 1]) + 2;
36 __attribute__((noinline, noclone)) void
37 f3 (void)
39 int i;
40 for (i = 0; i < 64; i++)
41 a[i] = lrint (b[i]) + 1;
44 __attribute__((noinline, noclone)) void
45 f4 (int n)
47 int i;
48 for (i = 0; i < n; i++)
50 a[4 * i + 0] = lrint (b[4 * i + 0]);
51 a[4 * i + 1] = lrint (b[4 * i + 1]);
52 a[4 * i + 2] = lrint (b[4 * i + 2]);
53 a[4 * i + 3] = lrint (b[4 * i + 3]);
57 __attribute__((noinline, noclone)) void
58 f5 (int n)
60 int i;
61 for (i = 0; i < 2 * n; i++)
63 a[2 * i + 0] = lrint (b[2 * i + 0]);
64 a[2 * i + 1] = lrint (b[2 * i + 1]);
68 __attribute__((noinline, noclone)) void
69 f6 (void)
71 int i;
72 for (i = 0; i < 64; i++)
73 a[i] = lrint (b[i]);
76 __attribute__((noinline, noclone)) int
77 main1 ()
79 int i;
81 for (i = 0; i < 64; i++)
83 asm ("");
84 b[i] = ((i & 1) ? -4 * i : 4 * i) + 0.25;
86 f1 (16);
87 #pragma GCC novector
88 for (i = 0; i < 64; i++)
89 if (a[i] != ((i & 1) ? -4 * i : 4 * i) + 1 + (i & 3))
90 abort ();
91 else
92 a[i] = 131.25;
93 f2 (16);
94 #pragma GCC novector
95 for (i = 0; i < 64; i++)
96 if (a[i] != ((i & 1) ? -4 * i : 4 * i) + 1 + (i & 1))
97 abort ();
98 else
99 a[i] = 131.25;
100 f3 ();
101 #pragma GCC novector
102 for (i = 0; i < 64; i++)
103 if (a[i] != ((i & 1) ? -4 * i : 4 * i) + 1)
104 abort ();
105 else
106 a[i] = 131.25;
107 f4 (16);
108 #pragma GCC novector
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 f5 (16);
115 #pragma GCC novector
116 for (i = 0; i < 64; i++)
117 if (a[i] != ((i & 1) ? -4 * i : 4 * i))
118 abort ();
119 else
120 a[i] = 131.25;
121 f6 ();
122 #pragma GCC novector
123 for (i = 0; i < 64; i++)
124 if (a[i] != ((i & 1) ? -4 * i : 4 * i))
125 abort ();
126 return 0;
130 main ()
132 check_vect ();
133 return main1 ();
136 /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 6 "vect" { target vect_call_lrint } } } */
137 /* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 6 "vect" { target vect_call_lrint } } } */