public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] Fix a SPARC -mcbcond compare-and-branch out of range failure.
@ 2017-05-23 17:47 Sheldon Lobo
  2017-05-24  7:02 ` Eric Botcazou
  0 siblings, 1 reply; 3+ messages in thread
From: Sheldon Lobo @ 2017-05-23 17:47 UTC (permalink / raw)
  To: gcc-patches

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

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

* Re: [PATCH] Fix a SPARC -mcbcond compare-and-branch out of range failure.
  2017-05-23 17:47 [PATCH] Fix a SPARC -mcbcond compare-and-branch out of range failure Sheldon Lobo
@ 2017-05-24  7:02 ` Eric Botcazou
  2017-05-24 13:30   ` Sheldon Lobo
  0 siblings, 1 reply; 3+ messages in thread
From: Eric Botcazou @ 2017-05-24  7:02 UTC (permalink / raw)
  To: Sheldon Lobo; +Cc: gcc-patches

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

OK for all active branches, but the ChangeLog entry should be something like:

	* config/sparc/sparc.md (length): Return the correct value for -mflat
	sibcalls to match output_sibcall.

Note that we *never* use a pair of parentheses after function names.

-- 
Eric Botcazou

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

* Re: [PATCH] Fix a SPARC -mcbcond compare-and-branch out of range failure.
  2017-05-24  7:02 ` Eric Botcazou
@ 2017-05-24 13:30   ` Sheldon Lobo
  0 siblings, 0 replies; 3+ messages in thread
From: Sheldon Lobo @ 2017-05-24 13:30 UTC (permalink / raw)
  To: Eric Botcazou; +Cc: gcc-patches

Thanks for the review.

On 05/24/2017 02:52 AM, Eric Botcazou wrote:
>
> OK for all active branches, but the ChangeLog entry should be something like:
>
> 	* config/sparc/sparc.md (length): Return the correct value for -mflat
> 	sibcalls to match output_sibcall.

Will do.

>
> Note that we *never* use a pair of parentheses after function names.
>

Noted for future reference.

Thanks again,
Sheldon

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

end of thread, other threads:[~2017-05-24 13:09 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-23 17:47 [PATCH] Fix a SPARC -mcbcond compare-and-branch out of range failure Sheldon Lobo
2017-05-24  7:02 ` Eric Botcazou
2017-05-24 13:30   ` Sheldon Lobo

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