PR target/83368
[official-gcc.git] / gcc / testsuite / c-c++-common / unroll-1.c
blobccae250af530c17acbc123dadb6ed11946d3a59f
1 /* { dg-do compile } */
2 /* { dg-options "-O2 -fdump-tree-cunrolli-details -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-tree-dump "11:.*: note: loop with 8 iterations completely unrolled" "cunrolli" } } */
15 #pragma GCC unroll 8
16 for (unsigned long i = 1; i <= 7; ++i)
17 bar(i);
18 /* { dg-final { scan-tree-dump "16:.*: note: loop with 7 iterations completely unrolled" "cunrolli" } } */
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" } } */