public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] Restore aarch64 support for asm ("# %a0" : : "i" (0)) (PR target/87598)
@ 2018-11-28 23:31 Jakub Jelinek
  2018-12-06 10:56 ` Richard Sandiford
  0 siblings, 1 reply; 2+ messages in thread
From: Jakub Jelinek @ 2018-11-28 23:31 UTC (permalink / raw)
  To: Richard Earnshaw, James Greenhalgh, Marcus Shawcroft; +Cc: gcc-patches

Hi!

As mentioned in the PR, aarch64 used to allow VOIDmode CONST_INTs
as %aN operands, but r255230 started ICEing on it and r257907 turned
that ICE into error (output_operand_lossage).

The following patch restores the previous behavior, by allowing such
CONST_INTs through.  They will fail aarch64_classify_address a few lines
later and so aarch64_print_address_internal will return false and either
cause output_operand_lossage there, or if it is aarch64_print_address,
let the generic code handle the constant.

Bootstrapped/regtested on aarch64-linux on GCCFarm, ok for trunk?

2018-11-29  Jakub Jelinek  <jakub@redhat.com>

	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.

--- gcc/config/aarch64/aarch64.c.jj	2018-11-26 22:21:24.891607602 +0100
+++ gcc/config/aarch64/aarch64.c	2018-11-27 14:16:48.586358824 +0100
@@ -7635,8 +7635,14 @@ aarch64_print_address_internal (FILE *f,
   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
+      && (GET_MODE (x) != VOIDmode
+	  || !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)
--- gcc/testsuite/gcc.target/aarch64/asm-5.c.jj	2018-11-27 14:24:18.774957407 +0100
+++ gcc/testsuite/gcc.target/aarch64/asm-5.c	2018-11-27 14:19:01.290176187 +0100
@@ -0,0 +1,8 @@
+/* PR target/87598 */
+/* { dg-do compile } */
+
+void
+foo (void)
+{
+  __asm__ ("# %a0" : : "i" (0));
+}

	Jakub

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] Restore aarch64 support for asm ("# %a0" : : "i" (0)) (PR target/87598)
  2018-11-28 23:31 [PATCH] Restore aarch64 support for asm ("# %a0" : : "i" (0)) (PR target/87598) Jakub Jelinek
@ 2018-12-06 10:56 ` Richard Sandiford
  0 siblings, 0 replies; 2+ messages in thread
From: Richard Sandiford @ 2018-12-06 10:56 UTC (permalink / raw)
  To: Jakub Jelinek
  Cc: Richard Earnshaw, James Greenhalgh, Marcus Shawcroft, gcc-patches

Jakub Jelinek <jakub@redhat.com> writes:
> Hi!
>
> As mentioned in the PR, aarch64 used to allow VOIDmode CONST_INTs
> as %aN operands, but r255230 started ICEing on it and r257907 turned
> that ICE into error (output_operand_lossage).
>
> The following patch restores the previous behavior, by allowing such
> CONST_INTs through.  They will fail aarch64_classify_address a few lines
> later and so aarch64_print_address_internal will return false and either
> cause output_operand_lossage there, or if it is aarch64_print_address,
> let the generic code handle the constant.
>
> Bootstrapped/regtested on aarch64-linux on GCCFarm, ok for trunk?
>
> 2018-11-29  Jakub Jelinek  <jakub@redhat.com>
>
> 	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.
>
> --- gcc/config/aarch64/aarch64.c.jj	2018-11-26 22:21:24.891607602 +0100
> +++ gcc/config/aarch64/aarch64.c	2018-11-27 14:16:48.586358824 +0100
> @@ -7635,8 +7635,14 @@ aarch64_print_address_internal (FILE *f,
>    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
> +      && (GET_MODE (x) != VOIDmode
> +	  || !CONST_INT_P (x)
> +	  || trunc_int_for_mode (INTVAL (x), Pmode) != INTVAL (x)))
> +    {
> +      output_operand_lossage ("invalid address mode");
> +      return false;
> +    }

The VOIDmode check is redundant, think it would be clearer without.

OK otherwise, thanks.

Richard

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-12-06 10:56 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-11-28 23:31 [PATCH] Restore aarch64 support for asm ("# %a0" : : "i" (0)) (PR target/87598) Jakub Jelinek
2018-12-06 10:56 ` Richard Sandiford

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).