| 1 |
/* Loop2_invariants pass should distinguish register pressures of different |
| 2 |
register classes. In this case, register pressue of INT is high. But |
| 3 |
we can still move the FP invariant out of the loop. */ |
| 4 |
|
| 5 |
/* { dg-do compile { target { { i?86-*-* x86_64-*-* } && lp64 } } } */ |
| 6 |
/* { dg-options "-O2 -fira-loop-pressure -fdump-rtl-loop2_invariant " } */ |
| 7 |
|
| 8 |
float tt; |
| 9 |
extern void foo2 (int *, int *, int *, int *, int *, int *); |
| 10 |
extern int foo3 (int, int, int, int, int, int); |
| 11 |
int foo (int a, int b, int c, int d) |
| 12 |
{ |
| 13 |
int i = a; |
| 14 |
int t1, t2, t3, t4, t5, t6; |
| 15 |
t1 = t2 = t3 = t4 = t5 = t6 = 0; |
| 16 |
|
| 17 |
for (; i > 0; i += c) |
| 18 |
{ |
| 19 |
tt += 123456.0; |
| 20 |
if (d > t1 + t2) |
| 21 |
tt = 3.0; |
| 22 |
foo2 (&t1, &t2, &t3, &t4, &t5, &t6); |
| 23 |
t1 += t3 + t4 + a + b; |
| 24 |
t2 -= t5 - t6 - c - d; |
| 25 |
} |
| 26 |
|
| 27 |
return foo3 (t1, t2, t3, t4, t5, t6); |
| 28 |
} |
| 29 |
|
| 30 |
/* { dg-final { scan-rtl-dump "Decided to move invariant" "loop2_invariant" } } */ |
| 31 |
|