From ee970a421d8f006a85f9c34ecb5cc504baf56c1b Mon Sep 17 00:00:00 2001 From: vmakarov Date: Fri, 7 Apr 2017 16:01:50 +0000 Subject: [PATCH] 2017-04-07 Vladimir Makarov PR rtl-optimization/70478 * lra-constraints.c (process_alt_operands): Disfavor alternative insn memory operands. 2017-04-07 Vladimir Makarov PR rtl-optimization/70478 * gcc.target/s390/pr70478.c: New. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@246764 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 6 ++++++ gcc/lra-constraints.c | 15 +++++++++++++++ gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.target/s390/pr70478.c | 8 ++++++++ 4 files changed, 34 insertions(+) create mode 100644 gcc/testsuite/gcc.target/s390/pr70478.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index d68f161ca17..437c99dea47 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2017-04-07 Vladimir Makarov + + PR rtl-optimization/70478 + * lra-constraints.c (process_alt_operands): Disfavor alternative + insn memory operands. + 2017-04-07 Jeff Law * config/iq2000/iq2000.c (final_prescan_insn): Do not separate a diff --git a/gcc/lra-constraints.c b/gcc/lra-constraints.c index 4d986249a6f..9440205b66b 100644 --- a/gcc/lra-constraints.c +++ b/gcc/lra-constraints.c @@ -2685,6 +2685,21 @@ process_alt_operands (int only_alternative) } } + /* When we use memory operand, the insn should read the + value from memory and even if we just wrote a value + into the memory it is costly in comparison with an + insn alternative which does not use memory + (e.g. register or immediate operand). */ + if (no_regs_p && offmemok) + { + if (lra_dump_file != NULL) + fprintf + (lra_dump_file, + " Using memory insn operand %d: reject+=3\n", + nop); + reject += 3; + } + #ifdef SECONDARY_MEMORY_NEEDED /* If reload requires moving value through secondary memory, it will need one more insn at least. */ diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 8b5a5806ea0..94fe5a04af3 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2017-04-07 Vladimir Makarov + + PR rtl-optimization/70478 + * gcc.target/s390/pr70478.c: New. + 2017-04-07 Martin Liska PR target/79889 diff --git a/gcc/testsuite/gcc.target/s390/pr70478.c b/gcc/testsuite/gcc.target/s390/pr70478.c new file mode 100644 index 00000000000..a1f135c2b56 --- /dev/null +++ b/gcc/testsuite/gcc.target/s390/pr70478.c @@ -0,0 +1,8 @@ +/* { dg-do compile } */ +/* { dg-options "-w -O3 -march=z9-109" } */ +/* { dg-final { scan-assembler-not "stg" } } */ + +void foo(unsigned int *a, unsigned char *b) +{ + *a &= *b; +} -- 2.11.4.GIT