[SPARC] Small fixes and cleanup

Message ID 6151077.RF03MCevhd@polaris
State New
Headers show
Series
  • [SPARC] Small fixes and cleanup
Related show

Commit Message

Eric Botcazou Sept. 28, 2018, 8:47 a.m.
This patch rewrites the implementation of BRANCH_COST to use a table and take 
into account the couple of parameters.  It also fixes out-of-range issues for 
the Compare-and-Branch-on-Condition instructions on Niagara-4 and later, and 
cleans up the handling of MASK_FSMULD.

Bootstrapped/regtested on SPARC/Solaris, applied on the mainline.


2018-09-28  Eric Botcazou  <ebotcazou@adacore.com>

	* config/sparc/sparc-protos.h (sparc_branch_cost): Declare.
	* config/sparc/sparc.h (BRANCH_COST): Call sparc_branch_cost.
	* config/sparc/sparc.c (struct processor_costs): Add branch_cost field.
	(cypress_costs): Set it.
	(supersparc_costs): Likewise.
	(hypersparc_costs): Likewise.
	(leon_cost): Likewise.
	(leon3_costs): Likewise.
	(sparclet_costs): Likewise.
	(ultrasparc_costs): Likewise.
	(ultrasparc_costs): Likewise.
	(niagara_costs): Likewise.
	(niagara2_costs): Likewise.
	(niagara3_costs): Likewise.
	(niagara4_costs): Likewise.
	(niagara7_costs): Likewise.
	(m8_costs): Likewise.
	(TARGET_CAN_FOLLOW_JUMP): Define.
	(pass_work_around_errata::gate): Minor tweak.
	(sparc_option_override): Remove MASK_FSMULD mask for V7 processors.
	Do not set both MASK_VIS4 and MASK_VIS4B for M8 processor.
	Automaitcally clear MASK_FSMULD mask for V7 processors.
	(sparc_can_follow_jump): New static function.
	(output_ubranch): Deal with CROSSING_JUMP_P.
	(sparc_use_sched_lookahead): Rewrite using switch statement.
	(sparc_issue_rate): Reorder.
	(sparc_branch_cost): New function.
testsuite/
	* gcc.target/sparc/20160229-1.c: Minor tweak.
	* gcc.target/sparc/cbcond-2.c: Likewise.
	* gcc.target/sparc/movcc-1.c: Add -mcpu=v9 option.
	* gcc.target/sparc/movcc-2.c: Minor tweak.
	* gcc.target/sparc/overflow-3.c: Likewise.
	* gcc.target/sparc/overflow-4.c: Add -mno-vis4 option.
	* gcc.target/sparc/overflow-5.c: Minor tweak.
	* gcc.target/sparc/setcc-4.c: Add -mno-vis4 option.

-- 
Eric Botcazou

Patch

Index: gcc.target/sparc/20160229-1.c
===================================================================
--- gcc.target/sparc/20160229-1.c	(revision 264525)
+++ gcc.target/sparc/20160229-1.c	(working copy)
@@ -2,8 +2,8 @@ 
 /* Reported by John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de> */
 
 /* { dg-do run } */
-/* { dg-options "-std=gnu99" }
 /* { dg-require-effective-target lp64 } */
+/* { dg-options "-std=gnu99" } */
 
 extern void abort (void);
 
Index: gcc.target/sparc/cbcond-2.c
===================================================================
--- gcc.target/sparc/cbcond-2.c	(revision 264525)
+++ gcc.target/sparc/cbcond-2.c	(working copy)
@@ -1,6 +1,6 @@ 
 /* { dg-do compile } */
-/* { dg-options "-O -mcbcond" } */
 /* { dg-require-effective-target lp64 } */
+/* { dg-options "-O -mcbcond" } */
 
 extern void foo (void);
 extern void bar (void);
Index: gcc.target/sparc/movcc-1.c
===================================================================
--- gcc.target/sparc/movcc-1.c	(revision 264525)
+++ gcc.target/sparc/movcc-1.c	(working copy)
@@ -1,5 +1,5 @@ 
 /* { dg-do compile } */
-/* { dg-options "-O2" } */
+/* { dg-options "-O2 -mcpu=v9" } */
 
 int foo1 (int a)
 {
Index: gcc.target/sparc/movcc-2.c
===================================================================
--- gcc.target/sparc/movcc-2.c	(revision 264525)
+++ gcc.target/sparc/movcc-2.c	(working copy)
@@ -1,6 +1,6 @@ 
 /* { dg-do compile } */
-/* { dg-options "-O2" } */
 /* { dg-require-effective-target lp64 } */
+/* { dg-options "-O2" } */
 
 long foo1 (long a)
 {
Index: gcc.target/sparc/overflow-3.c
===================================================================
--- gcc.target/sparc/overflow-3.c	(revision 264525)
+++ gcc.target/sparc/overflow-3.c	(working copy)
@@ -1,6 +1,6 @@ 
 /* { dg-do compile } */
-/* { dg-options "-O" } */
 /* { dg-require-effective-target lp64 } */
+/* { dg-options "-O" } */
 
 #include <stdbool.h>
 #include <stdint.h>
Index: gcc.target/sparc/overflow-4.c
===================================================================
--- gcc.target/sparc/overflow-4.c	(revision 264525)
+++ gcc.target/sparc/overflow-4.c	(working copy)
@@ -1,6 +1,6 @@ 
 /* { dg-do compile } */
-/* { dg-options "-O -mno-vis3" } */
 /* { dg-require-effective-target lp64 } */
+/* { dg-options "-O -mno-vis3 -mno-vis4" } */
 
 #include <stdbool.h>
 #include <stdint.h>
Index: gcc.target/sparc/overflow-5.c
===================================================================
--- gcc.target/sparc/overflow-5.c	(revision 264525)
+++ gcc.target/sparc/overflow-5.c	(working copy)
@@ -1,6 +1,6 @@ 
 /* { dg-do compile } */
-/* { dg-options "-O -mvis3" } */
 /* { dg-require-effective-target lp64 } */
+/* { dg-options "-O -mvis3" } */
 
 #include <stdbool.h>
 #include <stdint.h>
Index: gcc.target/sparc/setcc-4.c
===================================================================
--- gcc.target/sparc/setcc-4.c	(revision 264525)
+++ gcc.target/sparc/setcc-4.c	(working copy)
@@ -1,6 +1,6 @@ 
 /* { dg-do compile } */
 /* { dg-require-effective-target lp64 } */
-/* { dg-options "-O1 -mno-vis3" } */
+/* { dg-options "-O1 -mno-vis3 -mno-vis4" } */
 
 long neq (long a, long b)
 {