gcc/testsuite/gcc.dg/tree-ssa/slsr-16.c
raw| 1 | /* Straight-line strength reduction control flow variation. */ |
| 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 a2, a3, a4, x1, x2, x3, x4; |
| 10 | |
| 11 | x1 = c + s; |
| 12 | a2 = 3 * s; |
| 13 | x2 = c + a2; |
| 14 | x3 = x4 = c; |
| 15 | |
| 16 | if (n > 64) |
| 17 | { |
| 18 | a3 = 5 * s; |
| 19 | x3 = c + a3; |
| 20 | a4 = 7 * s; |
| 21 | x4 = c + a4; |
| 22 | } |
| 23 | |
| 24 | return x1 + x2 + x3 + x4; |
| 25 | } |
| 26 | |
| 27 | /* { dg-final { scan-tree-dump-times " \\* " 1 "optimized" } } */ |