aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@gcc.gnu.org>2017-09-07 15:53:09 +0000
committerEric Botcazou <ebotcazou@gcc.gnu.org>2017-09-07 15:53:09 +0000
commit1c49a3ed0c29e904916d794f34364dee95791297 (patch)
tree151ebe3a03fb1e57d9a6d77c08c4d1bfc86bb56d
parentfac519741f39f1741dbf5c88dfc2a8b8e90d0007 (diff)
downloadgcc-1c49a3ed0c29e904916d794f34364dee95791297.zip
gcc-1c49a3ed0c29e904916d794f34364dee95791297.tar.gz
gcc-1c49a3ed0c29e904916d794f34364dee95791297.tar.bz2
re PR bootstrap/80897 (gnat bootstrap broken on SPARC64/Linux)
PR target/80897 * config/sparc/sparc.c (sparc_emit_set_symbolic_const64): Deal with too large offsets. From-SVN: r251847
-rw-r--r--gcc/ChangeLog9
-rw-r--r--gcc/config/sparc/sparc.c18
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gnat.dg/opt67.adb35
-rw-r--r--gcc/testsuite/gnat.dg/opt67_pkg.adb29
-rw-r--r--gcc/testsuite/gnat.dg/opt67_pkg.ads28
6 files changed, 122 insertions, 2 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 138a776..a58252e 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,6 +1,13 @@
+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 Carl Love <cel@us.ibm.com>
- * config/rs6000/vsx.md (define_insn "*stxvl"): Add missing argument to the sldi instruction.
+ * config/rs6000/vsx.md (define_insn "*stxvl"): Add missing argument to
+ the sldi instruction.
2017-09-07 David Edelsohn <dje.gcc@gmail.com>
diff --git a/gcc/config/sparc/sparc.c b/gcc/config/sparc/sparc.c
index 3a532e5..9fe89c0 100644
--- a/gcc/config/sparc/sparc.c
+++ b/gcc/config/sparc/sparc.c
@@ -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;
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 1080030..2ef3b16 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2017-09-07 Eric Botcazou <ebotcazou@adacore.com>
+
+ * gnat.dg/opt67.adb: New test.
+ * gnat.dg/opt67_pkg.ad[sb]: New helper.
+
2017-09-07 Jakub Jelinek <jakub@redhat.com>
PR target/81979
diff --git a/gcc/testsuite/gnat.dg/opt67.adb b/gcc/testsuite/gnat.dg/opt67.adb
new file mode 100644
index 0000000..20590d1
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/opt67.adb
@@ -0,0 +1,35 @@
+-- { dg-do run }
+-- { dg-options "-O" }
+
+with Opt67_Pkg; use Opt67_Pkg;
+
+procedure Opt67 is
+
+ function Predef_Stream_Attr_Spec
+ (Loc : Source_Ptr;
+ Tag_Typ : Entity_Id;
+ Name : TSS_Name_Type) return Node_Id is
+ begin
+ return Predef (Loc, Make_TSS_Name (Tag_Typ, Name), Tag_Typ);
+ end;
+
+ Stream_Op_TSS_Names :
+ constant array (Integer range <>) of TSS_Name_Type :=
+ (TSS_Stream_Read,
+ TSS_Stream_Write,
+ TSS_Stream_Input,
+ TSS_Stream_Output);
+
+ Tag_Typ : constant Entity_Id := Entity_Id(Init);
+ Res : constant Natural := Init;
+ Loc : constant Source_Ptr := Source_Ptr(Init);
+
+begin
+ for Op in Stream_Op_TSS_Names'Range loop
+ if Stream_Operation_OK (Tag_Typ, Stream_Op_TSS_Names (Op)) then
+ Append_To (Res,
+ Predef_Stream_Attr_Spec (Loc, Tag_Typ,
+ Stream_Op_TSS_Names (Op)));
+ end if;
+ end loop;
+end;
diff --git a/gcc/testsuite/gnat.dg/opt67_pkg.adb b/gcc/testsuite/gnat.dg/opt67_pkg.adb
new file mode 100644
index 0000000..4222531
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/opt67_pkg.adb
@@ -0,0 +1,29 @@
+package body Opt67_Pkg is
+
+ function Make_TSS_Name (Typ : Entity_Id; Nam : TNT) return Name_Id is
+ begin
+ return 0;
+ end;
+
+ function Stream_Operation_OK (N : Entity_Id; Name : TNT) return Boolean is
+ begin
+ return True;
+ end;
+
+ procedure Append_To (N1 : Natural; N2 : Node_Id) is
+ begin
+ null;
+ end;
+
+ function Predef (Loc : Source_Ptr; Name : Name_Id; E : Entity_Id)
+ return Node_Id is
+ begin
+ return 0;
+ end;
+
+ function Init return Natural is
+ begin
+ return 0;
+ end;
+
+end Opt67_Pkg;
diff --git a/gcc/testsuite/gnat.dg/opt67_pkg.ads b/gcc/testsuite/gnat.dg/opt67_pkg.ads
new file mode 100644
index 0000000..c253371
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/opt67_pkg.ads
@@ -0,0 +1,28 @@
+package Opt67_Pkg is
+
+ type Source_Ptr is new Natural;
+ type Entity_Id is new Natural;
+ type Node_Id is new Natural;
+ type Name_Id is new Natural;
+
+ type TSS_Name_Type is new String (1 .. 2);
+ subtype TNT is TSS_Name_Type;
+
+ TSS_Stream_Input : constant TNT := "SI";
+ TSS_Stream_Output : constant TNT := "SO";
+ TSS_Stream_Read : constant TNT := "SR";
+ TSS_Stream_Write : constant TNT := "SW";
+ TSS_To_Any : constant TNT := "TA";
+
+ function Make_TSS_Name (Typ : Entity_Id; Nam : TSS_Name_Type) return Name_Id;
+
+ function Stream_Operation_OK (N : Entity_Id; Name : TNT) return Boolean;
+
+ procedure Append_To (N1 : Natural; N2 : Node_Id);
+
+ function Predef (Loc : Source_Ptr; Name : Name_Id; E : Entity_Id)
+ return Node_Id;
+
+ function Init return Natural;
+
+end Opt67_Pkg;