diff mbox

[SH,committed] Fix gcc.target/sh/pr54236-2.c failures

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

Commit Message

Oleg Endo May 21, 2015, 12:38 p.m. UTC
On Tue, 2015-05-19 at 10:04 +0200, Oleg Endo wrote:
> Since a recent change to the tree optimizers
> https://gcc.gnu.org/ml/gcc-patches/2015-05/msg00089.html
> some related SH patterns stopped working.  The attached patch fixes
> this.
> 
> Tested briefly with 'make all' and with
> make -k check-gcc RUNTESTFLAGS="sh.exp=pr54236* --target_board=sh-sim
> \{-m2/-ml,-m2/-mb,-m2a/-mb,-m4/-ml,-m4/-mb,-m4a/-ml,-m4a/-mb}"
> 
> Committed as r223346.

This is a follow up patch which fixes two oversights in the above
change.  Tested as above, Committed as r223479.

Cheers,
Oleg

gcc/ChangeLog:
	PR target/54236
	* config/sh/sh.md (*round_int_even): Reject pattern if operands[0] and
	operands[1] are the same.

testsuite/ChangeLog:
	PR target/54236
	* gcc.target/sh/pr54236-2.c: Fix typo in comment.
diff mbox

Patch

Index: gcc/config/sh/sh.md
===================================================================
--- gcc/config/sh/sh.md	(revision 223478)
+++ gcc/config/sh/sh.md	(working copy)
@@ -2011,7 +2011,8 @@ 
 	(and:SI (plus:SI (match_operand:SI 1 "arith_reg_operand")
 			 (const_int 1))
 		(const_int -2)))]
-  "TARGET_SH1 && !TARGET_SH2A && can_create_pseudo_p ()"
+  "TARGET_SH1 && !TARGET_SH2A && can_create_pseudo_p ()
+   && !reg_overlap_mentioned_p (operands[0], operands[1])"
   "#"
   "&& 1"
   [(set (match_dup 0) (const_int -2))
Index: gcc/testsuite/gcc.target/sh/pr54236-2.c
===================================================================
--- gcc/testsuite/gcc.target/sh/pr54236-2.c	(revision 223478)
+++ gcc/testsuite/gcc.target/sh/pr54236-2.c	(working copy)
@@ -133,7 +133,7 @@ 
 test_016 (int a, int b, int c, int d)
 {
   // non-SH2A: 1x add #1, 1x mov #-2, 1x and
-  // SH2A: 1x add #1, 1x blcr #0
+  // SH2A: 1x add #1, 1x bclr #0
   return a + (a & 1);
 }