diff mbox

[SH] Backport fix of PR 53988 to 4.9/4.8

Message ID 1425838006.27819.138.camel@yam-132-YW-E178-FTW
State New
Headers show

Commit Message

Oleg Endo March 8, 2015, 6:06 p.m. UTC
Hi,

Backporting of the fix went into GCC 5 seems to intrusive for the
released branches.  Hence I'd propose to remove the problematic patterns
altogether, as they can silently generate wrong code.  The attached
patch does that.  Tested briefly with 'make all' and with
make -k check-gcc RUNTESTFLAGS="sh.exp --target_board=sh-sim
\{-m2/-ml,-m2/-mb,-m2a/-mb,-m4/-ml,-m4/-mb,-m4a/-ml,-m4a/-mb}"

Kaz, do you have any objections?

Cheers,
Oleg

gcc/ChangeLog:
	PR target/53988
	* config/sh/sh.md (*tst<mode>_t_zero): Remove insns.

gcc/testsuite/ChangeLog:
	PR target/53988
	* gcc.target/sh/pr53988.c: Mark tests as xfail.

Comments

Kaz Kojima March 8, 2015, 11:53 p.m. UTC | #1
Oleg Endo <oleg.endo@t-online.de> wrote:
> Backporting of the fix went into GCC 5 seems to intrusive for the
> released branches.  Hence I'd propose to remove the problematic patterns
> altogether, as they can silently generate wrong code.  The attached
> patch does that.  Tested briefly with 'make all' and with
> make -k check-gcc RUNTESTFLAGS="sh.exp --target_board=sh-sim
> \{-m2/-ml,-m2/-mb,-m2a/-mb,-m4/-ml,-m4/-mb,-m4a/-ml,-m4a/-mb}"
> 
> Kaz, do you have any objections?

I have no objection.

Regards,
	kaz
Oleg Endo March 10, 2015, 8:18 a.m. UTC | #2
On Mon, 2015-03-09 at 08:53 +0900, Kaz Kojima wrote:
> Oleg Endo <oleg.endo@t-online.de> wrote:
> > Backporting of the fix went into GCC 5 seems to intrusive for the
> > released branches.  Hence I'd propose to remove the problematic patterns
> > altogether, as they can silently generate wrong code.  The attached
> > patch does that.  Tested briefly with 'make all' and with
> > make -k check-gcc RUNTESTFLAGS="sh.exp --target_board=sh-sim
> > \{-m2/-ml,-m2/-mb,-m2a/-mb,-m4/-ml,-m4/-mb,-m4a/-ml,-m4a/-mb}"
> > 
> > Kaz, do you have any objections?
> 
> I have no objection.
> 

Committed as r221305 (4.9) and r221307 (4.8).

Cheers,
Oleg
diff mbox

Patch

Index: gcc/config/sh/sh.md
===================================================================
--- gcc/config/sh/sh.md	(revision 221258)
+++ gcc/config/sh/sh.md	(working copy)
@@ -651,32 +651,6 @@ 
   "tst	#255,%0"
   [(set_attr "type" "mt_group")])
 
-;; This pattern might be risky because it also tests the upper bits and not
-;; only the subreg.  However, it seems that combine will get to this only
-;; when testing sign/zero extended values.  In this case the extended upper
-;; bits do not matter.
-(define_insn "*tst<mode>_t_zero"
-  [(set (reg:SI T_REG)
-	(eq:SI
-	  (subreg:QIHI
-	    (and:SI (match_operand:SI 0 "arith_reg_operand" "%r")
-		    (match_operand:SI 1 "arith_reg_operand" "r")) <lowpart_le>)
-	  (const_int 0)))]
-  "TARGET_SH1 && TARGET_LITTLE_ENDIAN"
-  "tst	%0,%1"
-  [(set_attr "type" "mt_group")])
-
-(define_insn "*tst<mode>_t_zero"
-  [(set (reg:SI T_REG)
-	(eq:SI
-	  (subreg:QIHI
-	    (and:SI (match_operand:SI 0 "arith_reg_operand" "%r")
-		    (match_operand:SI 1 "arith_reg_operand" "r")) <lowpart_be>)
-	  (const_int 0)))]
-  "TARGET_SH1 && TARGET_BIG_ENDIAN"
-  "tst	%0,%1"
-  [(set_attr "type" "mt_group")])
-
 ;; Extract LSB, negate and store in T bit.
 (define_insn "tstsi_t_and_not"
   [(set (reg:SI T_REG)
Index: gcc/testsuite/gcc.target/sh/pr53988.c
===================================================================
--- gcc/testsuite/gcc.target/sh/pr53988.c	(revision 221258)
+++ gcc/testsuite/gcc.target/sh/pr53988.c	(working copy)
@@ -5,9 +5,9 @@ 
 /* { dg-do compile }  */
 /* { dg-options "-O1" } */
 /* { dg-skip-if "" { "sh*-*-*" } { "-m5*"} { "" } }  */
-/* { dg-final { scan-assembler-times "tst\tr" 8 } } */
-/* { dg-final { scan-assembler-not "tst\t#255" } } */
-/* { dg-final { scan-assembler-not "exts|extu|and|movu" } } */
+/* { dg-final { scan-assembler-times "tst\tr" 8 { xfail *-*-*} } }  */
+/* { dg-final { scan-assembler-not "tst\t#255" { xfail *-*-*} } }  */
+/* { dg-final { scan-assembler-not "exts|extu|and|movu" { xfail *-*-*} } }  */
 
 int
 test00 (char* a, char* b, int c, int d)