diff mbox

[MIPS] Don't split shifts by default for MIPS16.

Message ID B5E67142681B53468FAF6B7C313565624F4EDCB2@hhmail02.hh.imgtec.org
State New
Headers show

Commit Message

Robert Suchanek May 24, 2016, 2:26 p.m. UTC
Hi,

The following changes the default behaviour of shift splitting
for MIPS16 e.g. the shifts will be split only when used with
undocumented -mno-debugd option that is now switched on by default.

This appears to enable better optimization in certain cases, and hence,
giving slightly better performance.

Ok to apply?

Regards,
Robert

gcc/
	* config/mips/mips.md (<optab><mode>3): Don't split shifts
	when used with -mdebugd.
	* config/mips/mips.opt (mdebugd): Init to 1 by default.
---
 gcc/config/mips/mips.md  | 1 +
 gcc/config/mips/mips.opt | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)

Comments

Maciej W. Rozycki June 9, 2016, 3:45 p.m. UTC | #1
On Tue, 24 May 2016, Robert Suchanek wrote:

> The following changes the default behaviour of shift splitting
> for MIPS16 e.g. the shifts will be split only when used with
> undocumented -mno-debugd option that is now switched on by default.
> 
> This appears to enable better optimization in certain cases, and hence,
> giving slightly better performance.

 Thank you for your contribution, however I have some issues with your 
proposal.

 First of all since TARGET_DEBUG_D_MODE is used across several places I 
think this really should be split into two separate pieces, independently 
reviewed.

 Then we have two parts:

1. The change to the expander is probably all but obviously correct as it 
   complements a similar one applied to the corresponding splitters eons 
   ago (back in 2001), although I wonder why we need to have both the 
   splitters and instructions split manually in the expander in the first 
   place.  Can you please investigatie it?

2. The other change is far from obvious since it flips the splitting 
   default, which has been there since forever (or the addition of MIPS16 
   support back in 1998).  So I think it needs a justification more 
   elaborate than just "certain cases", and perhaps a proper command-line 
   option defined rather than using an obscure debugging hook.  It may 
   also make sense to set the default dynamically from the CPU tuning 
   selected -- if the "certain cases" change from CPU to CPU, that is.  
   Can you please look into it?

  Maciej
diff mbox

Patch

diff --git a/gcc/config/mips/mips.md b/gcc/config/mips/mips.md
index 22f4f0b..01d7edd 100644
--- a/gcc/config/mips/mips.md
+++ b/gcc/config/mips/mips.md
@@ -5602,6 +5602,7 @@  (define_expand "<optab><mode>3"
      be careful not to allocate a new register if we've reached the
      reload pass.  */
   if (TARGET_MIPS16
+      && !TARGET_DEBUG_D_MODE
       && optimize
       && CONST_INT_P (operands[2])
       && INTVAL (operands[2]) > 8
diff --git a/gcc/config/mips/mips.opt b/gcc/config/mips/mips.opt
index 53feb23..b6c839d 100644
--- a/gcc/config/mips/mips.opt
+++ b/gcc/config/mips/mips.opt
@@ -127,7 +127,7 @@  mdebug
 Target Var(TARGET_DEBUG_MODE) Undocumented
 
 mdebugd
-Target Var(TARGET_DEBUG_D_MODE) Undocumented
+Target Var(TARGET_DEBUG_D_MODE) Undocumented Init(1)
 
 meb
 Target Report RejectNegative Mask(BIG_ENDIAN)