[Bug target/89324] [9 Regression] ICE in extract_constrain_insn, at recog.c:2211 on aarch64

2019-02-22 Thread matmal01 at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89324

Matthew Malcomson  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |FIXED

--- Comment #6 from Matthew Malcomson  ---
Fixed on trunk.

[Bug target/89324] [9 Regression] ICE in extract_constrain_insn, at recog.c:2211 on aarch64

2019-02-22 Thread matmal01 at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89324

--- Comment #5 from Matthew Malcomson  ---
Author: matmal01
Date: Fri Feb 22 16:35:22 2019
New Revision: 269122

URL: https://gcc.gnu.org/viewcvs?rev=269122&root=gcc&view=rev
Log:
Handle stack pointer with SUBS/ADDS instructions.

In general the stack pointer was not handled for many SUBS/ADDS patterns in
aarch64.md.
Both the "extended register" and "immediate" forms allow the stack pointer to
be
used as the source register, while no form allows the stack pointer for the
destination register.

The define_insn patterns generating ADDS/SUBS did not allow the stack pointer
for any operand, while the define_peephole2 patterns that generated RTX to be
matched by these patterns allowed the stack pointer for any operand.

The patterns are fixed by adding the 'k' constraint for the first source
operand
to all define_insns that generate the ADDS/SUBS "extended register" and
"immediate" forms (but not the "shifted register" form).

In peephole optimizations, constraint strings are ignored (see "(gccint) C
Constraint Interface" info node in the documentation), so the decision to act
or
not is based solely on the predicate and condition.
This patch introduces a new predicate "aarch64_general_reg" to be used in
define_peephole2 patterns where only GENERAL_REGS registers are acceptable and
uses that predicate in the peepholes that generate patterns for ADDS/SUBS.

Full bootstrap and regtest done on aarch64-none-linux-gnu.
Regression tests done on aarch64-none-linux-gnu and aarch64-none-elf cross
compiler.

OK for trunk?


gcc/ChangeLog:

2019-02-22  Matthew Malcomson  

PR target/89324
* config/aarch64/aarch64.md: Use aarch64_general_reg predicate on
destination register in peepholes generating patterns for ADDS/SUBS.
(add3_compare0,
*addsi3_compare0_uxtw, add3_compareC,
add3_compareV_imm, add3_compareV,
*adds__,
*subs__,
*adds__shift_,
*subs__shift_,
*adds__multp2, *subs__multp2,
*sub3_compare0, *subsi3_compare0_uxtw,
sub3_compare1): Allow stack pointer for source register.
* config/aarch64/predicates.md (aarch64_general_reg): New predicate.


gcc/testsuite/ChangeLog:

2019-02-22  Matthew Malcomson  

PR target/89324
* gcc.dg/rtl/aarch64/subs_adds_sp.c: New test.
* gfortran.fortran-torture/compile/pr89324.f90: New test.

Added:
trunk/gcc/testsuite/gcc.dg/rtl/aarch64/subs_adds_sp.c
trunk/gcc/testsuite/gfortran.fortran-torture/compile/pr89324.f90
Modified:
trunk/gcc/ChangeLog
trunk/gcc/config/aarch64/aarch64.md
trunk/gcc/config/aarch64/predicates.md
trunk/gcc/testsuite/ChangeLog

[Bug target/89324] [9 Regression] ICE in extract_constrain_insn, at recog.c:2211 on aarch64

2019-02-18 Thread matmal01 at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89324

--- Comment #4 from Matthew Malcomson  ---
There were similar problems in handling the stack pointer with subs/adds
instructions elsewhere in the aarch64 backend.

Patch proposed & being worked on here:
https://gcc.gnu.org/ml/gcc-patches/2019-02/msg01458.html

[Bug target/89324] [9 Regression] ICE in extract_constrain_insn, at recog.c:2211 on aarch64

2019-02-18 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89324

Richard Biener  changed:

   What|Removed |Added

   Priority|P3  |P1
Version|unknown |9.0

[Bug target/89324] [9 Regression] ICE in extract_constrain_insn, at recog.c:2211 on aarch64

2019-02-13 Thread matmal01 at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89324

--- Comment #3 from Matthew Malcomson  ---
(In reply to ktkachov from comment #2)
> The sub3_compare1_imm pattern was introduced for GCC 9. It's probably
> something going wrong with the constraints. Matthew, could you take a look
> please?

On first blush it looks like the define_peephole2 generating this instruction
allows the stack pointer while the 'r' constraint in the pattern doesn't accept
it.

A quick check of only allowing GENERAL_REGS registers in the peephole indeed
stops the generation of this instruction and hence avoids the bug.

I haven't yet checked whether the pattern should allow the stack pointer or
not.

[Bug target/89324] [9 Regression] ICE in extract_constrain_insn, at recog.c:2211 on aarch64

2019-02-13 Thread ktkachov at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89324

ktkachov at gcc dot gnu.org changed:

   What|Removed |Added

 CC||matmal01 at gcc dot gnu.org

--- Comment #2 from ktkachov at gcc dot gnu.org ---
The sub3_compare1_imm pattern was introduced for GCC 9. It's probably
something going wrong with the constraints. Matthew, could you take a look
please?

[Bug target/89324] [9 Regression] ICE in extract_constrain_insn, at recog.c:2211 on aarch64

2019-02-13 Thread ktkachov at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89324

ktkachov at gcc dot gnu.org changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
  Known to work||8.2.1
Summary|ICE in  |[9 Regression] ICE in
   |extract_constrain_insn, at  |extract_constrain_insn, at
   |recog.c:2211 on aarch64 |recog.c:2211 on aarch64
 Ever confirmed|0   |1
  Known to fail||9.0

--- Comment #1 from ktkachov at gcc dot gnu.org ---
Confirmed.