This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] sh target: bogus operand reference


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]