This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Fix a SPARC -mcbcond compare-and-branch out of range failure.


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]