Patchwork [SH] Fix PR57108

login
register
mail settings
Submitter Oleg Endo
Date May 5, 2013, 11:44 a.m.
Message ID <1367754273.19934.9.camel@yam-132-YW-E178-FTW>
Download mbox | patch
Permalink /patch/241507/
State New
Headers show

Comments

Oleg Endo - May 5, 2013, 11:44 a.m.
Hi,

On Mon, 2013-04-29 at 11:31 +0200, Christian Bruel wrote:
> Hello,
> 
> This patches set the correct operand mode for tstsi_t_zero_extract_eq,
> to avoid reload generating a move between a constant and a void register.
> 
> Reg tested for sh-elf. No performance impact

Unfortunately after your patch the test case for PR 49263 showed some
failures for SH2A and SH4A ('tst #imm,R0' insn not utilized in some
cases).

The operand mode in the tstsi_t_zero_extract_eq pattern was void on
purpose to match any mode (at least QI HI SI DI).  The attached patch
fixes that.  
OK for trunk and 4.8 if it passes testing?  (I'd leave 4.7 alone since
it doesn't have the iterators.md).

(BTW, I think the test case for this PR should have went into c-torture
instead of target/sh ...)


Cheers,
Oleg

gcc/ChangeLog:

	PR target/57108
	* config/sh/sh.md (tstsi_t_zero_extract_eq): Use QIHISIDI mode 
	iterator.
Kaz Kojima - May 5, 2013, 1:56 p.m.
Oleg Endo <oleg.endo@t-online.de> wrote:
> The operand mode in the tstsi_t_zero_extract_eq pattern was void on
> purpose to match any mode (at least QI HI SI DI).  The attached patch
> fixes that.  
> OK for trunk and 4.8 if it passes testing?  (I'd leave 4.7 alone since
> it doesn't have the iterators.md).

OK.

> (BTW, I think the test case for this PR should have went into c-torture
> instead of target/sh ...)

Sounds plausible.

Regards,
	kaz

Patch

Index: gcc/config/sh/sh.md
===================================================================
--- gcc/config/sh/sh.md	(revision 198595)
+++ gcc/config/sh/sh.md	(working copy)
@@ -687,9 +687,9 @@ 
   [(set_attr "type" "mt_group")])
 
 ;; Extract contiguous bits and compare them against zero.
-(define_insn "tstsi_t_zero_extract_eq"
+(define_insn "tst<mode>_t_zero_extract_eq"
   [(set (reg:SI T_REG)
-	(eq:SI (zero_extract:SI (match_operand:SI 0 "logical_operand" "z")
+	(eq:SI (zero_extract:SI (match_operand:QIHISIDI 0 "logical_operand" "z")
 				(match_operand:SI 1 "const_int_operand")
 				(match_operand:SI 2 "const_int_operand"))
 	       (const_int 0)))]