Patchwork [SH] Fix PR57108

login
register
mail settings
Submitter Christian Bruel
Date April 29, 2013, 9:31 a.m.
Message ID <517E3DFD.6000607@st.com>
Download mbox | patch
Permalink /patch/240346/
State New
Headers show

Comments

Christian Bruel - April 29, 2013, 9:31 a.m.
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

OK for 4.7, 4.8 and trunk ?

Thanks
Kaz Kojima - April 29, 2013, 10:22 a.m.
Christian Bruel <christian.bruel@st.com> wrote:
> 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
> 
> OK for 4.7, 4.8 and trunk ?

OK.

Regards,
	kaz

Patch

2013-04-26  Christian Bruel  <christian.bruel@st.com>

	PR target/57108
	* sh.md (tstsi_t_zero_extract_eq): Set mode for operand 0.

2013-04-26  Christian Bruel  <christian.bruel@st.com>

	PR target/57108
	* gcc.target/sh/pr57108.c: New test.

Index: gcc/testsuite/gcc.target/sh/pr57108.c
===================================================================
--- gcc/testsuite/gcc.target/sh/pr57108.c	(revision 0)
+++ gcc/testsuite/gcc.target/sh/pr57108.c	(revision 0)
@@ -0,0 +1,19 @@ 
+/* { dg-do compile { target "sh*-*-*" } } */
+/* { dg-options "-O1" } */
+
+void __assert_func (void) __attribute__ ((__noreturn__)) ;
+
+void ATATransfer (int num, int buffer)
+{
+ int wordCount;
+
+ while (num > 0)
+  {
+    wordCount = num * 512 / sizeof (int);
+
+    ((0 == (buffer & 63)) ? (void)0 : __assert_func () );
+    ((0 == (wordCount & 31)) ? (void)0 : __assert_func ());
+  }
+
+
+ }

Index: gcc/config/sh/sh.md
===================================================================
--- gcc/config/sh/sh.md	(revision 198287)
+++ gcc/config/sh/sh.md	(working copy)
@@ -689,7 +689,7 @@ 
 ;; Extract contiguous bits and compare them against zero.
 (define_insn "tstsi_t_zero_extract_eq"
   [(set (reg:SI T_REG)
-	(eq:SI (zero_extract:SI (match_operand 0 "logical_operand" "z")
+	(eq:SI (zero_extract:SI (match_operand:SI 0 "logical_operand" "z")
 				(match_operand:SI 1 "const_int_operand")
 				(match_operand:SI 2 "const_int_operand"))
 	       (const_int 0)))]