gcc/testsuite/gcc.dg/tree-ssa/slsr-18.c
raw| 1 | /* Straight-line strength reduction control flow variation with incr = -1. */ |
| 2 | |
| 3 | /* { dg-do compile } */ |
| 4 | /* { dg-options "-O3 -fdump-tree-optimized" } */ |
| 5 | |
| 6 | int |
| 7 | f (int n, int c, int s) |
| 8 | { |
| 9 | int a1, a2, a3, a4, x1, x2, x3, x4; |
| 10 | |
| 11 | a1 = 4 * s; |
| 12 | x1 = c + a1; |
| 13 | x2 = x3 = x4 = c; |
| 14 | |
| 15 | if (n > 64) |
| 16 | { |
| 17 | a2 = 3 * s; |
| 18 | x2 = c + a2; |
| 19 | a3 = 2 * s; |
| 20 | x3 = c + a3; |
| 21 | } |
| 22 | else |
| 23 | { |
| 24 | a4 = 3 * s; |
| 25 | x4 = c + a4; |
| 26 | } |
| 27 | |
| 28 | return x1 + x2 + x3 + x4; |
| 29 | } |
| 30 | |
| 31 | /* { dg-final { scan-tree-dump-times " \\* " 1 "optimized" } } */ |