[PATCH] sh target: bogus operand reference

Samuel Tardieu sam@rfc1149.net
Sat Dec 1 19:49:00 GMT 2007


cmpgeusi_t splitting code compares operand 0 to 0, while this constant
value can only be in operand 1. When compiling the Ada runtime, this leads
to a "cmp/hs #0,r7" instruction which is not valid as "cmp/hs" operands must
be two registers.

This is a regression from 4.2 as the optimization this patch fixes is not
present in the 4.2 branch.

    gcc/
	* config/sh/sh.md (cmpgeusi_t): Immediate operand is operand 1,
	not 0.

Compilation regression tested on a cross-compiler from i686-linux to
sh4-linux.

Ok for trunk?

---
 gcc/config/sh/sh.md |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/gcc/config/sh/sh.md b/gcc/config/sh/sh.md
index 00221cc..d7e2727 100644
--- a/gcc/config/sh/sh.md
+++ b/gcc/config/sh/sh.md
@@ -648,7 +648,7 @@
 		(match_operand:SI 1 "arith_reg_or_0_operand" "rN")))]
   "TARGET_SH1"
   "cmp/hs	%1,%0"
-  "&& operands[0] == CONST0_RTX (SImode)"
+  "&& operands[1] == CONST0_RTX (SImode)"
   [(pc)]
   "
 {
-- 
1.5.3.6



More information about the Gcc-patches mailing list