gcc/testsuite/gcc.target/pru/loop-short-2.c
raw| 1 | /* Test LOOP generation for very short loops. */ |
| 2 | |
| 3 | /* { dg-options "-O1 -mloop" } */ |
| 4 | |
| 5 | /* -O1 in the options is significant. Without it do-loop will not be |
| 6 | run. */ |
| 7 | |
| 8 | unsigned int |
| 9 | test_loop (unsigned int n, unsigned int x) |
| 10 | { |
| 11 | unsigned int i; |
| 12 | |
| 13 | if (n >= 0x10000) return 0; |
| 14 | if (!n) return 0; |
| 15 | |
| 16 | /* { dg-final { scan-assembler "loop\\t.L\[0-9\]*, r\[0-9\]*" } } */ |
| 17 | /* { dg-final { scan-assembler "nop" } } */ |
| 18 | for (i = 0; i < n; i++) |
| 19 | x <<= 2; |
| 20 | return x; |
| 21 | } |