From 634c3ff01847a2b0918d13d85205779075b86c31 Mon Sep 17 00:00:00 2001 From: Vladimir Makarov Date: Tue, 30 Jan 2018 20:28:59 +0000 Subject: [PATCH] re PR target/84112 (powerpc64le ICE in LRA on openjdk) 2018-01-30 Vladimir Makarov PR target/84112 * lra-constraints.c (curr_insn_transform): Process AND in the address. 2018-01-30 Vladimir Makarov PR target/84112 * pr84112.c: New. From-SVN: r257204 --- gcc/ChangeLog | 6 ++++ gcc/lra-constraints.c | 12 +++++++- gcc/testsuite/ChangeLog | 5 ++++ gcc/testsuite/gcc.target/powerpc/pr84112.c | 33 ++++++++++++++++++++++ 4 files changed, 55 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gcc.target/powerpc/pr84112.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index e4c68ffd9f7..56a16496ab8 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2018-01-30 Vladimir Makarov + + PR target/84112 + * lra-constraints.c (curr_insn_transform): Process AND in the + address. + 2018-01-30 Jakub Jelinek PR rtl-optimization/83986 diff --git a/gcc/lra-constraints.c b/gcc/lra-constraints.c index c2443124566..4f5474ebce1 100644 --- a/gcc/lra-constraints.c +++ b/gcc/lra-constraints.c @@ -4216,7 +4216,17 @@ curr_insn_transform (bool check_only_p) GET_MODE_SIZE (GET_MODE (op))); else if (get_reload_reg (OP_IN, Pmode, *loc, rclass, FALSE, "offsetable address", &new_reg)) - lra_emit_move (new_reg, *loc); + { + rtx addr = *loc; + enum rtx_code code = GET_CODE (addr); + + if (code == AND && CONST_INT_P (XEXP (addr, 1))) + /* (and ... (const_int -X)) is used to align to X bytes. */ + addr = XEXP (*loc, 0); + lra_emit_move (new_reg, addr); + if (addr != *loc) + emit_move_insn (new_reg, gen_rtx_AND (GET_MODE (new_reg), new_reg, XEXP (*loc, 1))); + } before = get_insns (); end_sequence (); *loc = new_reg; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 8a8b71664e3..9eae462b87a 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2018-01-30 Vladimir Makarov + + PR target/84112 + * pr84112.c: New. + 2018-01-30 Jakub Jelinek PR rtl-optimization/83986 diff --git a/gcc/testsuite/gcc.target/powerpc/pr84112.c b/gcc/testsuite/gcc.target/powerpc/pr84112.c new file mode 100644 index 00000000000..530ad65b064 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/pr84112.c @@ -0,0 +1,33 @@ +/* { dg-do compile { target powerpc*-*-* } }*/ +/* { dg-options "-mcpu=power8 -O3 -fstack-protector-strong -fpic" } */ + +char *b; +int c, d, e, f; + +void +foo (char *h, int k, int l, int m, int j, int q) +{ + char *i = b; + int n = d; + int s = e; + while (c) + { + for (; j <= 0; j += 12) + { + i[j] = n & k - h[j] >> 31 | q & ~(k - h[j] >> 31); + i[j + 1] = n & l - h[j + 1] >> 31 | q & ~(l - h[j + 1] >> 31); + i[j + 2] = n & m - h[j + 2] >> 31 | s & ~(m - h[j + 2] >> 31); + i[j + 3] = n & k - h[j + 3] >> 31 | q & ~(k - h[j + 3] >> 31); + i[j + 4] = n & l - h[j + 4] >> 31 | q & ~(l - h[j + 4] >> 31); + i[j + 5] = n & m - h[j + 5] >> 31 | s & ~(m - h[j + 5] >> 31); + i[j + 6] = n & k - h[j + 6] >> 31 | q & ~(k - h[j + 6] >> 31); + i[j + 7] = n & l - h[j + 7] >> 31 | q & ~(l - h[j + 7] >> 31); + i[j + 8] = n & m - h[j + 8] >> 31 | s & ~(m - h[j + 8] >> 31); + i[j + 9] = n & k - h[j + 9] >> 31 | q & ~(k - h[j + 9] >> 31); + i[j + 10] = n & l - h[j + 10] >> 31 | q & ~(l - h[j + 10] >> 31); + i[j + 11] = n & m - h[j + 11] >> 31 | s & ~(m - h[j + 11] >> 31); + } + while (j < f) + ; + } +} -- 2.30.2