public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Sheldon Lobo <sheldon.lobo@oracle.com>
To: gcc-patches@gcc.gnu.org
Subject: [PATCH] Fix a SPARC -mcbcond compare-and-branch out of range failure.
Date: Tue, 23 May 2017 17:47:00 -0000	[thread overview]
Message-ID: <1495560958-143246-1-git-send-email-sheldon.lobo@oracle.com> (raw)

The compare-and-branch distance was calculated incorrectly. This occurred
because a -mflat sibcall returned an instruction count of 2 instead of 3.
Fix sparc.md to match the output_sibcall() code in sparc.c.

	* config/sparc/sparc.md: Set the number of instructions correctly
	for -mflat sibcalls, to match output_sibcall().
---
 gcc/ChangeLog             |    5 +++++
 gcc/config/sparc/sparc.md |    3 ++-
 2 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 7ed62bc..5836ac1 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,8 @@
+2017-05-23  Sheldon Lobo  <smlobo@sheldon.us.oracle.com>
+
+	* config/sparc/sparc.md: Set the number of instructions correctly
+	for -mflat sibcalls, to match output_sibcall().
+
 2017-05-18  Michael Meissner  <meissner@linux.vnet.ibm.com>
 
 	PR target/80510
diff --git a/gcc/config/sparc/sparc.md b/gcc/config/sparc/sparc.md
index 29a8bcf..3f970f7 100644
--- a/gcc/config/sparc/sparc.md
+++ b/gcc/config/sparc/sparc.md
@@ -338,7 +338,8 @@
 	     (const_int 2)
 	     (const_int 1))
 	 (eq_attr "type" "sibcall")
-	   (if_then_else (eq_attr "leaf_function" "true")
+	   (if_then_else (ior (eq_attr "leaf_function" "true")
+	                      (eq_attr "flat" "true"))
 	     (if_then_else (eq_attr "empty_delay_slot" "true")
 	       (const_int 3)
 	       (const_int 2))
-- 
1.7.1

             reply	other threads:[~2017-05-23 17:36 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-23 17:47 Sheldon Lobo [this message]
2017-05-24  7:02 ` Eric Botcazou
2017-05-24 13:30   ` Sheldon Lobo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1495560958-143246-1-git-send-email-sheldon.lobo@oracle.com \
    --to=sheldon.lobo@oracle.com \
    --cc=gcc-patches@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).