diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 5399239046866a7259259b6e08d6fc74373fb459..6eed4a05fb67bfd31f6e3b2b2b0cd42e4da69e54 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,8 @@
+Sat Apr 10 22:12:12 1999  Jan Hubicka <hubicka@freesoft.cz>
+  
+	* recog.c (constrain_operands): Ignore unary operators when
+	matching operands.  Recognize '5'..'9' as well.
+
 Sat Apr 10 21:53:02 1999  Philipp Thomas  (kthomas@gwdg.de)
 			  Richard Henderson  <rth@cygnus.com>
 
diff --git a/gcc/recog.c b/gcc/recog.c
index 6bceae85a9e7e6f6abcc5a196768db0023c94357..94e7abbffff519e16cf6f3ecb23ba5a47888442e 100644
--- a/gcc/recog.c
+++ b/gcc/recog.c
@@ -2303,11 +2303,8 @@ constrain_operands (strict)
 		earlyclobber[opno] = 1;
 		break;
 
-	      case '0':
-	      case '1':
-	      case '2':
-	      case '3':
-	      case '4':
+	      case '0': case '1': case '2': case '3': case '4':
+	      case '5': case '6': case '7': case '8': case '9':
 		/* This operand must be the same as a previous one.
 		   This kind of constraint is used for instructions such
 		   as add when they take only two operands.
@@ -2319,8 +2316,19 @@ constrain_operands (strict)
 		if (strict < 0)
 		  val = 1;
 		else
-		  val = operands_match_p (recog_operand[c - '0'],
-					  recog_operand[opno]);
+		  {
+		    rtx op1 = recog_operand[c - '0'];
+		    rtx op2 = recog_operand[opno];
+
+	            /* A unary operator may be accepted by the predicate,
+		       but it is irrelevant for matching constraints.  */
+	            if (GET_RTX_CLASS (GET_CODE (op1)) == '1')
+	              op1 = XEXP (op1, 0);
+	            if (GET_RTX_CLASS (GET_CODE (op2)) == '1')
+	              op2 = XEXP (op2, 0);
+
+		    val = operands_match_p (op1, op2);
+		  }
 
 		matching_operands[opno] = c - '0';
 		matching_operands[c - '0'] = opno;