diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 51244467892..bc0be5ca932 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2016-09-19 Vladimir Makarov + + PR rtl-optimization/77416 + * lra-remat.c (operand_to_remat): Process hard coded insn + registers. + 2016-09-19 Kyrylo Tkachov * simplify-rtx.c (simplify_relational_operation_1): Add transformation diff --git a/gcc/lra-remat.c b/gcc/lra-remat.c index c124d5ba2e1..245c6de6b44 100644 --- a/gcc/lra-remat.c +++ b/gcc/lra-remat.c @@ -370,6 +370,22 @@ operand_to_remat (rtx_insn *insn) + hard_regno_nregs[reg->regno][reg->biggest_mode]))) return -1; } + /* Check hard coded insn registers. */ + for (struct lra_insn_reg *reg = static_id->hard_regs; + reg != NULL; + reg = reg->next) + if (reg->type == OP_INOUT) + return -1; + else if (reg->type == OP_IN) + { + /* Check that there is no output hard reg as the input + one. */ + for (struct lra_insn_reg *reg2 = static_id->hard_regs; + reg2 != NULL; + reg2 = reg2->next) + if (reg2->type == OP_OUT && reg->regno == reg2->regno) + return -1; + } /* Find the rematerialization operand. */ int nop = static_id->n_operands; for (int i = 0; i < nop; i++) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index f7d00480743..29763fd1a16 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2016-09-19 Vladimir Makarov + + PR rtl-optimization/77416 + * gcc.target/powerpc/pr77416.c: New. + 2016-09-19 Patrick Palka PR c++/77639 diff --git a/gcc/testsuite/gcc.target/powerpc/pr77416.c b/gcc/testsuite/gcc.target/powerpc/pr77416.c new file mode 100644 index 00000000000..c87a1987ac5 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/pr77416.c @@ -0,0 +1,34 @@ +/* { dg-do compile { target { powerpc64*-*-*} } } */ +/* { dg-skip-if "" { powerpc64-*-aix* } { "*" } { "" } } */ +/* { dg-skip-if "do not override -mcpu" { powerpc64*-*-* } { "-mcpu=*" } { "-mcpu=power7" } } */ +/* { dg-options "-mcpu=power7 -O2 -m32" } */ +/* { dg-final { scan-assembler-times "addze" 1 } } */ + +extern int fn2 (); +extern void fn3 (); +extern void fn4 (int); +int a, c, d, f, g, h, i, j, k, l, m, n; +struct +{ + int escape; +} *b; +int e[8]; +void +fn1 (int p1, int p2) +{ + int o = a; + for (; f; f++) + { + int p; + if (e[h]) + continue; + if (fn2 (o, d, l, n, p1, i, j, k, 0==0)) + continue; + p = p2; + if (b[g].escape) + p++; + fn3 ("", c, m); + if (k) + fn4 (p); + } +}