public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH][AArch64] Fix ILP32 memory access
@ 2017-06-27 13:39 Wilco Dijkstra
  2017-06-27 14:01 ` Richard Earnshaw (lists)
                   ` (2 more replies)
  0 siblings, 3 replies; 14+ messages in thread
From: Wilco Dijkstra @ 2017-06-27 13:39 UTC (permalink / raw)
  To: GCC Patches, James Greenhalgh; +Cc: nd

This patch fixes a failure in gcc.target/aarch64/reload-valid-spoff.c 
triggered by https://gcc.gnu.org/ml/gcc-patches/2017-06/msg01367.html -
it supersedes https://gcc.gnu.org/ml/gcc-patches/2017-06/msg01907.html
as this fixes the root cause of the failure.

In ILP32 all memory accesses must have Pmode as the base address, but
aarch64_expand_mov_immediate wasn't emitting a conversion in one case.
Besides fixing this add an assert that flags any MEM operands that are
not Pmode.

Passes regress (with/without ilp32). OK for commit?

ChangeLog:
2017-06-27  Wilco Dijkstra  <wdijkstr@arm.com>

	* config/aarch64/aarch64 (aarch64_expand_mov_immediate):
	Convert memory address to Pmode.
--
diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c
index 329d244e9cf16dbdf849e5dd02b3999caf0cd5a7..9038748ba049ba589f067f3f04c31704fe673d2c 100644
--- a/gcc/config/aarch64/aarch64.c
+++ b/gcc/config/aarch64/aarch64.c
@@ -1958,6 +1958,8 @@ aarch64_expand_mov_immediate (rtx dest, rtx imm)
 	      gcc_assert (can_create_pseudo_p ());
 	      base = gen_reg_rtx (ptr_mode);
 	      aarch64_expand_mov_immediate (base, XEXP (mem, 0));
+	      if (ptr_mode != Pmode)
+		base = convert_memory_address (Pmode, base);
 	      mem = gen_rtx_MEM (ptr_mode, base);
 	    }
 
@@ -5207,6 +5209,7 @@ aarch64_print_operand (FILE *f, rtx x, int code)
 
 	case MEM:
 	  output_address (GET_MODE (x), XEXP (x, 0));
+	  gcc_assert (GET_MODE (XEXP (x, 0)) == Pmode);
 	  break;
 
 	case CONST:

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

end of thread, other threads:[~2017-07-05 10:02 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-06-27 13:39 [PATCH][AArch64] Fix ILP32 memory access Wilco Dijkstra
2017-06-27 14:01 ` Richard Earnshaw (lists)
2017-06-30 18:22 ` Andreas Schwab
2017-07-04 12:19   ` Wilco Dijkstra
2017-07-04 12:28     ` Andreas Schwab
2017-07-04 12:56     ` Arnaud Charlet
2017-07-04 13:00       ` Ramana Radhakrishnan
2017-07-04 13:36         ` Michael Matz
2017-07-04 13:47           ` Wilco Dijkstra
2017-07-04 13:53             ` Michael Matz
2017-07-04 15:44               ` Ramana Radhakrishnan
2017-07-04 14:01             ` Andreas Schwab
2017-07-05  7:59 ` Andrew Pinski
2017-07-05 10:02   ` Wilco Dijkstra

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).