diff mbox series

[rs6000] Requested cleanups for BE handling of -mno-speculate-indirect-jumps

Message ID 425ae17f-4bca-0bdb-7728-b99ac6dd1b2c@linux.vnet.ibm.com
State New
Headers show
Series [rs6000] Requested cleanups for BE handling of -mno-speculate-indirect-jumps | expand

Commit Message

Bill Schmidt Jan. 20, 2018, 3:46 a.m. UTC
Hi,

Segher had previously requested some cleanups in https://gcc.gnu.org/ml/gcc-patches/2018-01/msg01605.html.
Due to time pressures, I delayed those, but they are ready now.  Here they are,
bootstrapped and tested on powerpc64le-linux-gnu and powerpc64-linux-gnu.  Is
this okay for trunk?  I don't intend to backport these.

Thanks,
Bill


2018-01-19  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>

	* config/rs6000/rs6000.md (*call_indirect_nonlocal_sysv<mode>):
	Simplify the clause that sets the length attribute.
	(*call_value_indirect_nonlocal_sysv<mode>): Likewise.
	(*sibcall_nonlocal_sysv<mode>): Clean up code block; simplify the
	clause that sets the length attribute.
	(*sibcall_value_nonlocal_sysv<mode>): Likewise.

Comments

Segher Boessenkool Jan. 20, 2018, 5:32 p.m. UTC | #1
Hi!

On Fri, Jan 19, 2018 at 09:46:27PM -0600, Bill Schmidt wrote:
> Segher had previously requested some cleanups in https://gcc.gnu.org/ml/gcc-patches/2018-01/msg01605.html.
> Due to time pressures, I delayed those, but they are ready now.  Here they are,
> bootstrapped and tested on powerpc64le-linux-gnu and powerpc64-linux-gnu.  Is
> this okay for trunk?  I don't intend to backport these.

This is fine for trunk, with one fix (see below).  You may want to hold
off on it until the 7 backports are done, but that's up to you.

> 2018-01-19  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>
> 
> 	* config/rs6000/rs6000.md (*call_indirect_nonlocal_sysv<mode>):
> 	Simplify the clause that sets the length attribute.
> 	(*call_value_indirect_nonlocal_sysv<mode>): Likewise.
> 	(*sibcall_nonlocal_sysv<mode>): Clean up code block; simplify the
> 	clause that sets the length attribute.
> 	(*sibcall_value_nonlocal_sysv<mode>): Likewise.


>  	/* Can use CR0 since it is volatile across sibcalls.  */
> -	return \"crset eq\;beq%T0-\;b $\";
> +	return "crset eq;beq%T0-;b $";

This should still use \; .

>  	/* Can use CR0 since it is volatile across sibcalls.  */
> -	return \"crset eq\;beq%T1-\;b $\";
> +	return "crset eq;beq%T1-;b $";

Same here.

Thanks for the patch,


Segher
diff mbox series

Patch

Index: gcc/config/rs6000/rs6000.md
===================================================================
--- gcc/config/rs6000/rs6000.md	(revision 256894)
+++ gcc/config/rs6000/rs6000.md	(working copy)
@@ -10463,17 +10463,11 @@ 
    (set (attr "length")
 	(cond [(and (eq (symbol_ref "which_alternative") (const_int 0))
 		    (eq (symbol_ref "rs6000_speculate_indirect_jumps")
-			(const_int 1)))
-		  (const_string "4")
-	       (and (eq (symbol_ref "which_alternative") (const_int 0))
-		    (eq (symbol_ref "rs6000_speculate_indirect_jumps")
 			(const_int 0)))
 		  (const_string "8")
-	       (eq (symbol_ref "which_alternative") (const_int 1))
-	          (const_string "4")
 	       (and (eq (symbol_ref "which_alternative") (const_int 2))
-		    (eq (symbol_ref "rs6000_speculate_indirect_jumps")
-			(const_int 1)))
+		    (ne (symbol_ref "rs6000_speculate_indirect_jumps")
+			(const_int 0)))
 		  (const_string "8")
 	       (and (eq (symbol_ref "which_alternative") (const_int 2))
 		    (eq (symbol_ref "rs6000_speculate_indirect_jumps")
@@ -10576,17 +10570,11 @@ 
    (set (attr "length")
 	(cond [(and (eq (symbol_ref "which_alternative") (const_int 0))
 		    (eq (symbol_ref "rs6000_speculate_indirect_jumps")
-			(const_int 1)))
-		  (const_string "4")
-	       (and (eq (symbol_ref "which_alternative") (const_int 0))
-		    (eq (symbol_ref "rs6000_speculate_indirect_jumps")
 			(const_int 0)))
 		  (const_string "8")
-	       (eq (symbol_ref "which_alternative") (const_int 1))
-	          (const_string "4")
 	       (and (eq (symbol_ref "which_alternative") (const_int 2))
-		    (eq (symbol_ref "rs6000_speculate_indirect_jumps")
-			(const_int 1)))
+		    (ne (symbol_ref "rs6000_speculate_indirect_jumps")
+			(const_int 0)))
 		  (const_string "8")
 	       (and (eq (symbol_ref "which_alternative") (const_int 2))
 		    (eq (symbol_ref "rs6000_speculate_indirect_jumps")
@@ -10973,47 +10961,40 @@ 
   "(DEFAULT_ABI == ABI_DARWIN
     || DEFAULT_ABI == ABI_V4)
    && (INTVAL (operands[2]) & CALL_LONG) == 0"
-  "*
 {
   if (INTVAL (operands[2]) & CALL_V4_SET_FP_ARGS)
-    output_asm_insn (\"crxor 6,6,6\", operands);
+    output_asm_insn ("crxor 6,6,6", operands);
 
   else if (INTVAL (operands[2]) & CALL_V4_CLEAR_FP_ARGS)
-    output_asm_insn (\"creqv 6,6,6\", operands);
+    output_asm_insn ("creqv 6,6,6", operands);
 
   if (which_alternative >= 2)
     {
       if (rs6000_speculate_indirect_jumps)
-	return \"b%T0\";
+	return "b%T0";
       else
 	/* Can use CR0 since it is volatile across sibcalls.  */
-	return \"crset eq\;beq%T0-\;b $\";
+	return "crset eq;beq%T0-;b $";
     }
   else if (DEFAULT_ABI == ABI_V4 && flag_pic)
     {
       gcc_assert (!TARGET_SECURE_PLT);
-      return \"b %z0@plt\";
+      return "b %z0@plt";
     }
   else
-    return \"b %z0\";
-}"
+    return "b %z0";
+}
   [(set_attr "type" "branch")
    (set (attr "length")
-	(cond [(eq (symbol_ref "which_alternative") (const_int 0))
-		  (const_string "4")
-	       (eq (symbol_ref "which_alternative") (const_int 1))
+	(cond [(eq (symbol_ref "which_alternative") (const_int 1))
 		  (const_string "8")
 	       (and (eq (symbol_ref "which_alternative") (const_int 2))
 		    (eq (symbol_ref "rs6000_speculate_indirect_jumps")
-			(const_int 1)))
-		  (const_string "4")
-	       (and (eq (symbol_ref "which_alternative") (const_int 2))
-		    (eq (symbol_ref "rs6000_speculate_indirect_jumps")
 			(const_int 0)))
 		  (const_string "12")
 	       (and (eq (symbol_ref "which_alternative") (const_int 3))
-		    (eq (symbol_ref "rs6000_speculate_indirect_jumps")
-			(const_int 1)))
+		    (ne (symbol_ref "rs6000_speculate_indirect_jumps")
+			(const_int 0)))
 		  (const_string "8")
 	       (and (eq (symbol_ref "which_alternative") (const_int 3))
 		    (eq (symbol_ref "rs6000_speculate_indirect_jumps")
@@ -11030,47 +11011,40 @@ 
   "(DEFAULT_ABI == ABI_DARWIN
     || DEFAULT_ABI == ABI_V4)
    && (INTVAL (operands[3]) & CALL_LONG) == 0"
-  "*
 {
   if (INTVAL (operands[3]) & CALL_V4_SET_FP_ARGS)
-    output_asm_insn (\"crxor 6,6,6\", operands);
+    output_asm_insn ("crxor 6,6,6", operands);
 
   else if (INTVAL (operands[3]) & CALL_V4_CLEAR_FP_ARGS)
-    output_asm_insn (\"creqv 6,6,6\", operands);
+    output_asm_insn ("creqv 6,6,6", operands);
 
   if (which_alternative >= 2)
     {
       if (rs6000_speculate_indirect_jumps)
-	return \"b%T1\";
+	return "b%T1";
       else
 	/* Can use CR0 since it is volatile across sibcalls.  */
-	return \"crset eq\;beq%T1-\;b $\";
+	return "crset eq;beq%T1-;b $";
     }
   else if (DEFAULT_ABI == ABI_V4 && flag_pic)
     {
       gcc_assert (!TARGET_SECURE_PLT);
-      return \"b %z1@plt\";
+      return "b %z1@plt";
     }
   else
-    return \"b %z1\";
-}"
+    return "b %z1";
+}
   [(set_attr "type" "branch")
    (set (attr "length")
-	(cond [(eq (symbol_ref "which_alternative") (const_int 0))
-		  (const_string "4")
-	       (eq (symbol_ref "which_alternative") (const_int 1))
+	(cond [(eq (symbol_ref "which_alternative") (const_int 1))
 		  (const_string "8")
 	       (and (eq (symbol_ref "which_alternative") (const_int 2))
 		    (eq (symbol_ref "rs6000_speculate_indirect_jumps")
-			(const_int 1)))
-		  (const_string "4")
-	       (and (eq (symbol_ref "which_alternative") (const_int 2))
-		    (eq (symbol_ref "rs6000_speculate_indirect_jumps")
 			(const_int 0)))
 		  (const_string "12")
 	       (and (eq (symbol_ref "which_alternative") (const_int 3))
-		    (eq (symbol_ref "rs6000_speculate_indirect_jumps")
-			(const_int 1)))
+		    (ne (symbol_ref "rs6000_speculate_indirect_jumps")
+			(const_int 0)))
 		  (const_string "8")
 	       (and (eq (symbol_ref "which_alternative") (const_int 3))
 		    (eq (symbol_ref "rs6000_speculate_indirect_jumps")