diff mbox series

[RS6000] Remove unnecessary rtx_equal_p

Message ID 20181113034609.GN29784@bubble.grove.modra.org
State New
Headers show
Series [RS6000] Remove unnecessary rtx_equal_p | expand

Commit Message

Alan Modra Nov. 13, 2018, 3:46 a.m. UTC
REGs are unique.  This patch recognizes that fact, speeding up rs6000
gcc infinitesimally.  Bootstrapped etc. powerpc64le-linux.  OK?

	* gcc/config/rs6000/rs6000.c (rs6000_legitimate_address_p): Replace
	rtx_equal_p call for known REGs with pointer comparison.
	(rs6000_secondary_reload_memory): Likewise.
	(rs6000_secondary_reload_inner): Likewise.

Comments

Alan Modra Nov. 13, 2018, 5 a.m. UTC | #1
On Tue, Nov 13, 2018 at 02:16:09PM +1030, Alan Modra wrote:
> REGs are unique.  This patch recognizes that fact, speeding up rs6000
> gcc infinitesimally.  Bootstrapped etc. powerpc64le-linux.  OK?

Ugh, looking over this old patch again, I don't see how I can claim
that regs in pre_inc/pre_dec/pre_modify are unique.  Patch withdrawn.
Segher Boessenkool Nov. 13, 2018, 12:07 p.m. UTC | #2
On Tue, Nov 13, 2018 at 02:16:09PM +1030, Alan Modra wrote:
> REGs are unique.  This patch recognizes that fact, speeding up rs6000
> gcc infinitesimally.  Bootstrapped etc. powerpc64le-linux.  OK?

Of course, fine for trunk.  Thanks!


Segher


> 	* gcc/config/rs6000/rs6000.c (rs6000_legitimate_address_p): Replace
> 	rtx_equal_p call for known REGs with pointer comparison.
> 	(rs6000_secondary_reload_memory): Likewise.
> 	(rs6000_secondary_reload_inner): Likewise.
diff mbox series

Patch

diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c
index d3355710d91..9c3e0ea3529 100644
--- a/gcc/config/rs6000/rs6000.c
+++ b/gcc/config/rs6000/rs6000.c
@@ -9227,7 +9227,7 @@  rs6000_legitimate_address_p (machine_mode mode, rtx x, bool reg_ok_strict)
 					      reg_ok_strict, false)
 	  || (!avoiding_indexed_address_p (mode)
 	      && legitimate_indexed_address_p (XEXP (x, 1), reg_ok_strict)))
-      && rtx_equal_p (XEXP (XEXP (x, 1), 0), XEXP (x, 0)))
+      && XEXP (XEXP (x, 1), 0) == XEXP (x, 0))
     return 1;
   if (reg_offset_p && !quad_offset_p
       && legitimate_lo_sum_address_p (mode, x, reg_ok_strict))
@@ -19011,7 +19011,7 @@  rs6000_secondary_reload_memory (rtx addr,
       plus_arg1 = XEXP (addr, 1);
       if (!base_reg_operand (reg, GET_MODE (reg))
 	  || GET_CODE (plus_arg1) != PLUS
-	  || !rtx_equal_p (reg, XEXP (plus_arg1, 0)))
+	  || XEXP (plus_arg1, 0) != reg)
 	{
 	  fail_msg = "bad PRE_MODIFY";
 	  extra_cost = -1;
@@ -19748,7 +19748,7 @@  rs6000_secondary_reload_inner (rtx reg, rtx mem, rtx scratch, bool store_p)
       op1 = XEXP (addr, 1);
       if (!base_reg_operand (op0, Pmode)
 	  || GET_CODE (op1) != PLUS
-	  || !rtx_equal_p (op0, XEXP (op1, 0)))
+	  || XEXP (op1, 0) != op0)
 	rs6000_secondary_reload_fail (__LINE__, reg, mem, scratch, store_p);
 
       if ((addr_mask & RELOAD_REG_PRE_MODIFY) == 0)