From d863d14312412121fc138f607258e7a86e72a7a8 Mon Sep 17 00:00:00 2001 From: Bin Cheng Date: Tue, 30 Oct 2012 02:17:50 +0000 Subject: [PATCH] re PR target/54989 (FAIL: gcc.dg/hoist-register-pressure.c scan-rtl-dump hoist "PRE/HOIST: end of bb .* copying expression" on darwin) PR target/54989 * gcc.dg/hoist-register-pressure-1.c: Rename from hoist-register-pressure.c. Add nonpic condition. * gcc.dg/hoist-register-pressure-2.c: New testcase. From-SVN: r192976 --- gcc/testsuite/ChangeLog | 7 +++++ ...ster-pressure.c => hoist-register-pressure-1.c} | 2 +- gcc/testsuite/gcc.dg/hoist-register-pressure-2.c | 32 ++++++++++++++++++++++ 3 files changed, 40 insertions(+), 1 deletion(-) rename gcc/testsuite/gcc.dg/{hoist-register-pressure.c => hoist-register-pressure-1.c} (92%) create mode 100644 gcc/testsuite/gcc.dg/hoist-register-pressure-2.c diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index f6a8122..627d80d 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,10 @@ +2012-10-30 Bin Cheng + + PR target/54989 + * gcc.dg/hoist-register-pressure-1.c: Rename from + hoist-register-pressure.c. Add nonpic condition. + * gcc.dg/hoist-register-pressure-2.c: New testcase. + 2012-10-29 Jonathan Wakely PR c++/54930 diff --git a/gcc/testsuite/gcc.dg/hoist-register-pressure.c b/gcc/testsuite/gcc.dg/hoist-register-pressure-1.c similarity index 92% rename from gcc/testsuite/gcc.dg/hoist-register-pressure.c rename to gcc/testsuite/gcc.dg/hoist-register-pressure-1.c index 6077f1e..01e5ed4 100644 --- a/gcc/testsuite/gcc.dg/hoist-register-pressure.c +++ b/gcc/testsuite/gcc.dg/hoist-register-pressure-1.c @@ -1,5 +1,5 @@ /* { dg-options "-Os -fdump-rtl-hoist" } */ -/* { dg-final { scan-rtl-dump "PRE/HOIST: end of bb .* copying expression" "hoist" } } */ +/* { dg-final { scan-rtl-dump "PRE/HOIST: end of bb .* copying expression" "hoist" { target { nonpic } } } } */ #define BUF 100 int a[BUF]; diff --git a/gcc/testsuite/gcc.dg/hoist-register-pressure-2.c b/gcc/testsuite/gcc.dg/hoist-register-pressure-2.c new file mode 100644 index 0000000..7f973fe --- /dev/null +++ b/gcc/testsuite/gcc.dg/hoist-register-pressure-2.c @@ -0,0 +1,32 @@ +/* { dg-options "-Os -fdump-rtl-hoist" } */ +/* { dg-final { scan-rtl-dump "PRE/HOIST: end of bb .* copying expression" "hoist" } } */ + +#define BUF 100 +int a[BUF]; + +void com (int); +void bar (int); + +int foo (int x, int y, int z) +{ + /* "x+y" won't be hoisted if "-fira-hoist-pressure" is disabled, + because its rtx_cost is too small. */ + if (z) + { + a[1] = a[0]; + a[2] = a[1]; + a[3] = a[3]; + a[4] = a[5]; + a[5] = a[7]; + a[6] = a[11]; + a[7] = a[13]; + a[8] = a[17]; + com (x+y); + } + else + { + bar (x+y); + } + + return 0; +} -- 2.7.4