From 31460ed2cbcd66d080b7100655ee821384b7a884 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Thu, 6 Dec 2018 13:20:09 +0100 Subject: [PATCH] re PR target/87598 (Rejects "%a0" with constant) PR target/87598 * config/aarch64/aarch64.c (aarch64_print_address_internal): Don't call output_operand_lossage on VOIDmode CONST_INTs. After output_operand_lossage do return false. * gcc.target/aarch64/asm-5.c: New test. From-SVN: r266852 --- gcc/ChangeLog | 7 +++++++ gcc/config/aarch64/aarch64.c | 9 +++++++-- gcc/testsuite/ChangeLog | 3 +++ gcc/testsuite/gcc.target/aarch64/asm-5.c | 8 ++++++++ 4 files changed, 25 insertions(+), 2 deletions(-) create mode 100644 gcc/testsuite/gcc.target/aarch64/asm-5.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 168929181dd..cded91e60be 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2018-12-06 Jakub Jelinek + + PR target/87598 + * config/aarch64/aarch64.c (aarch64_print_address_internal): Don't + call output_operand_lossage on VOIDmode CONST_INTs. After + output_operand_lossage do return false. + 2018-12-06 Richard Biener * df-problems.c (df_rd_local_compute): Use bitmap_release. diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c index 3d597ca95c7..490a2038b8e 100644 --- a/gcc/config/aarch64/aarch64.c +++ b/gcc/config/aarch64/aarch64.c @@ -7635,8 +7635,13 @@ aarch64_print_address_internal (FILE *f, machine_mode mode, rtx x, unsigned int size; /* Check all addresses are Pmode - including ILP32. */ - if (GET_MODE (x) != Pmode) - output_operand_lossage ("invalid address mode"); + if (GET_MODE (x) != Pmode + && (!CONST_INT_P (x) + || trunc_int_for_mode (INTVAL (x), Pmode) != INTVAL (x))) + { + output_operand_lossage ("invalid address mode"); + return false; + } if (aarch64_classify_address (&addr, x, mode, true, type)) switch (addr.type) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 13d2e25a096..bda8476a4ad 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,8 @@ 2018-12-06 Jakub Jelinek + PR target/87598 + * gcc.target/aarch64/asm-5.c: New test. + PR tree-optimization/85726 * gcc.dg/tree-ssa/pr85726-1.c: New test. * gcc.dg/tree-ssa/pr85726-2.c: New test. diff --git a/gcc/testsuite/gcc.target/aarch64/asm-5.c b/gcc/testsuite/gcc.target/aarch64/asm-5.c new file mode 100644 index 00000000000..1a5ebdc48b1 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/asm-5.c @@ -0,0 +1,8 @@ +/* PR target/87598 */ +/* { dg-do compile } */ + +void +foo (void) +{ + __asm__ ("# %a0" : : "i" (0)); +} -- 2.30.2