[C++ PATCH] Deprecate -ffriend-injection
[official-gcc.git] / gcc / testsuite / c-c++-common / unroll-3.c
blob6cefa7583baaf337dc2c017f934c563daec49e2b
1 /* { dg-do compile } */
2 /* { dg-options "-O -fdisable-tree-cunroll -fdump-rtl-loop2_unroll-details" } */
4 extern void bar (int);
6 int j;
8 void test (void)
10 #pragma GCC unroll 8
11 for (unsigned long i = 1; i <= 8; ++i)
12 bar(i);
13 /* { dg-final { scan-rtl-dump-not "11:.*: note: loop unrolled" "loop2_unroll" } } */
15 #pragma GCC unroll 8
16 for (unsigned long i = 1; i <= 7; ++i)
17 bar(i);
18 /* { dg-final { scan-rtl-dump-not "16:.*: note: loop unrolled" "loop2_unroll" } } */
20 #pragma GCC unroll 8
21 for (unsigned long i = 1; i <= 15; ++i)
22 bar(i);
23 /* { dg-final { scan-rtl-dump "21:.*: note: loop unrolled 7 times" "loop2_unroll" } } */
25 #pragma GCC unroll 8
26 for (unsigned long i = 1; i <= j; ++i)
27 bar(i);
28 /* { dg-final { scan-rtl-dump "26:.*: note: loop unrolled 7 times" "loop2_unroll" } } */
30 #pragma GCC unroll 7
31 for (unsigned long i = 1; i <= j; ++i)
32 bar(i);
33 /* { dg-final { scan-rtl-dump "31:.*: note: loop unrolled 3 times" "loop2_unroll" } } */
35 unsigned long i = 0;
36 #pragma GCC unroll 3
37 do {
38 bar(i);
39 } while (++i < 9);
40 /* { dg-final { scan-rtl-dump "3\[79\]:.*: note: loop unrolled 2 times" "loop2_unroll" } } */