diff options
author | Yvan Roux <yvan.roux@linaro.org> | 2016-09-14 11:41:07 +0200 |
---|---|---|
committer | Yvan Roux <yvan.roux@linaro.org> | 2016-09-14 11:41:07 +0200 |
commit | d9bdefc5f03ca6ce9a0fdd4ad62d32330704d660 (patch) | |
tree | 962ab27ba3f8030a48fc1aa4499dc23c58759db1 | |
parent | e1214efb16d937d60b709efd5337d46046b81497 (diff) |
gcc/
Backport from trunk r237475.
2016-06-15 Kyrylo Tkachov <kyrylo.tkachov@arm.com>
* ifcvt.c (bb_ok_for_noce_multiple_sets): Allow simple lowpart
register subregs in SET_SRC.
gcc/testsuite/
Backport from trunk r237475.
2016-06-15 Kyrylo Tkachov <kyrylo.tkachov@arm.com>
* gcc.target/aarch64/ifcvt_multiple_sets_subreg_1.c: New test.
Change-Id: I4ec7ce4a8f1657808d37c8500e10661401ccecf4
-rw-r--r-- | gcc/ifcvt.c | 12 | ||||
-rw-r--r-- | gcc/testsuite/gcc.target/aarch64/ifcvt_multiple_sets_subreg_1.c | 30 |
2 files changed, 39 insertions, 3 deletions
diff --git a/gcc/ifcvt.c b/gcc/ifcvt.c index 95d38107b86..f7f120e04b1 100644 --- a/gcc/ifcvt.c +++ b/gcc/ifcvt.c @@ -3374,9 +3374,15 @@ bb_ok_for_noce_convert_multiple_sets (basic_block test_bb, rtx src = SET_SRC (set); /* We can possibly relax this, but for now only handle REG to REG - moves. This avoids any issues that might come from introducing - loads/stores that might violate data-race-freedom guarantees. */ - if (!(REG_P (src) && REG_P (dest))) + (including subreg) moves. This avoids any issues that might come + from introducing loads/stores that might violate data-race-freedom + guarantees. */ + if (!REG_P (dest)) + return false; + + if (!(REG_P (src) + || (GET_CODE (src) == SUBREG && REG_P (SUBREG_REG (src)) + && subreg_lowpart_p (src)))) return false; /* Destination must be appropriate for a conditional write. */ diff --git a/gcc/testsuite/gcc.target/aarch64/ifcvt_multiple_sets_subreg_1.c b/gcc/testsuite/gcc.target/aarch64/ifcvt_multiple_sets_subreg_1.c new file mode 100644 index 00000000000..ac6ffdcf8de --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/ifcvt_multiple_sets_subreg_1.c @@ -0,0 +1,30 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-rtl-ce1" } */ + +/* Check that the inner if is transformed into CSELs. */ + +int +foo (int *x, int *z, int a) +{ + int b = 0; + int c = 0; + int d = 0; + int i; + + for (i = 0; i < a; i++) + { + if (x[i] < c) + { + b = z[i]; + if (c < b) + { + c = b; + d = i; + } + } + } + + return c + d; +} + +/* { dg-final { scan-rtl-dump "if-conversion succeeded through noce_convert_multiple_sets" "ce1" } } */ |