Patchwork use immediate_operand in nonmemory_operand

login
register
mail settings
Submitter Nathan Froyd
Date Oct. 11, 2010, 12:58 a.m.
Message ID <20101011005829.GB24720@nightcrawler>
Download mbox | patch
Permalink /patch/67376/
State New
Headers show

Comments

Nathan Froyd - Oct. 11, 2010, 12:58 a.m.
This patch replaces complex conditionals in nonmemory_operand with a
call to immediate_operand, which contains the same conditionals.

Bootstrapped on x86_64-unknown-linux-gnu.  OK to commit?

-Nathan

	* recog.c (nonmemory_operand): Call immediate_operand for
	CONSTANT_P operands.
Richard Henderson - Oct. 11, 2010, 4:07 p.m.
On 10/10/2010 05:58 PM, Nathan Froyd wrote:
> 	* recog.c (nonmemory_operand): Call immediate_operand for
> 	CONSTANT_P operands.

Ok.


r~

Patch

diff --git a/gcc/recog.c b/gcc/recog.c
index 368783f..e16a85c 100644
--- a/gcc/recog.c
+++ b/gcc/recog.c
@@ -1158,24 +1158,7 @@  int
 nonmemory_operand (rtx op, enum machine_mode mode)
 {
   if (CONSTANT_P (op))
-    {
-      /* Don't accept CONST_INT or anything similar
-	 if the caller wants something floating.  */
-      if (GET_MODE (op) == VOIDmode && mode != VOIDmode
-	  && GET_MODE_CLASS (mode) != MODE_INT
-	  && GET_MODE_CLASS (mode) != MODE_PARTIAL_INT)
-	return 0;
-
-      if (CONST_INT_P (op)
-	  && mode != VOIDmode
-	  && trunc_int_for_mode (INTVAL (op), mode) != INTVAL (op))
-	return 0;
-
-      return ((GET_MODE (op) == VOIDmode || GET_MODE (op) == mode
-	       || mode == VOIDmode)
-	      && (! flag_pic || LEGITIMATE_PIC_OPERAND_P (op))
-	      && LEGITIMATE_CONSTANT_P (op));
-    }
+    return immediate_operand (op, mode);
 
   if (GET_MODE (op) != mode && mode != VOIDmode)
     return 0;