public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [SPARC] Fix PR target/80897
@ 2017-09-07 15:53 Eric Botcazou
  0 siblings, 0 replies; only message in thread
From: Eric Botcazou @ 2017-09-07 15:53 UTC (permalink / raw)
  To: gcc-patches

[-- Attachment #1: Type: text/plain, Size: 505 bytes --]

This is the Ada bootstrap failure on SPARC64/Linux that I worked around at 
some point; it turns out that we can do something plausible in the back-end.

Tested on SPARC64/Linux, applied on mainline.


2017-09-07  Eric Botcazou  <ebotcazou@adacore.com>

	PR target/80897
	* config/sparc/sparc.c (sparc_emit_set_symbolic_const64): Deal with
	too large offsets.


2017-09-07  Eric Botcazou  <ebotcazou@adacore.com>

	* gnat.dg/opt67.adb: New test.
	* gnat.dg/opt67_pkg.ad[sb]: New helper.

-- 
Eric Botcazou

[-- Attachment #2: pr80897.diff --]
[-- Type: text/x-patch, Size: 1079 bytes --]

Index: config/sparc/sparc.c
===================================================================
--- config/sparc/sparc.c	(revision 251811)
+++ config/sparc/sparc.c	(working copy)
@@ -2159,9 +2159,25 @@ sparc_emit_set_const32 (rtx op0, rtx op1
 void
 sparc_emit_set_symbolic_const64 (rtx op0, rtx op1, rtx temp)
 {
-  rtx temp1, temp2, temp3, temp4, temp5;
+  rtx cst, temp1, temp2, temp3, temp4, temp5;
   rtx ti_temp = 0;
 
+  /* Deal with too large offsets.  */
+  if (GET_CODE (op1) == CONST
+      && GET_CODE (XEXP (op1, 0)) == PLUS
+      && CONST_INT_P (cst = XEXP (XEXP (op1, 0), 1))
+      && trunc_int_for_mode (INTVAL (cst), SImode) != INTVAL (cst))
+    {
+      gcc_assert (!temp);
+      temp1 = gen_reg_rtx (DImode);
+      temp2 = gen_reg_rtx (DImode);
+      sparc_emit_set_const64 (temp2, cst);
+      sparc_emit_set_symbolic_const64 (temp1, XEXP (XEXP (op1, 0), 0),
+				       NULL_RTX);
+      emit_insn (gen_rtx_SET (op0, gen_rtx_PLUS (DImode, temp1, temp2)));
+      return;
+    }
+
   if (temp && GET_MODE (temp) == TImode)
     {
       ti_temp = temp;

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2017-09-07 15:53 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-09-07 15:53 [SPARC] Fix PR target/80897 Eric Botcazou

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