diff mbox

wide-int, reload

Message ID 9340B309-B480-4F10-8A69-FD6A51CEEEB6@comcast.net
State New
Headers show

Commit Message

Mike Stump Nov. 23, 2013, 7:22 p.m. UTC
Richi has asked the we break the wide-int patch so that the individual port and front end maintainers can review their parts without have to go through the entire patch.    This patch covers the reload code.

Ok?
* postreload.c
	(reload_cse_simplify_set): Use wide-int interfaces.
diff mbox

Patch

diff --git a/gcc/postreload.c b/gcc/postreload.c
index b0c6342..7803b33 100644
--- a/gcc/postreload.c
+++ b/gcc/postreload.c
@@ -295,27 +295,27 @@  reload_cse_simplify_set (rtx set, rtx insn)
 #ifdef LOAD_EXTEND_OP
 	  if (extend_op != UNKNOWN)
 	    {
-	      HOST_WIDE_INT this_val;
+	      wide_int result;
 
-	      /* ??? I'm lazy and don't wish to handle CONST_DOUBLE.  Other
-		 constants, such as SYMBOL_REF, cannot be extended.  */
-	      if (!CONST_INT_P (this_rtx))
+	      if (!CONST_SCALAR_INT_P (this_rtx))
 		continue;
 
-	      this_val = INTVAL (this_rtx);
 	      switch (extend_op)
 		{
 		case ZERO_EXTEND:
-		  this_val &= GET_MODE_MASK (GET_MODE (src));
+		  result = wide_int::from (std::make_pair (this_rtx,
+							   GET_MODE (src)),
+					   BITS_PER_WORD, UNSIGNED);
 		  break;
 		case SIGN_EXTEND:
-		  /* ??? In theory we're already extended.  */
-		  if (this_val == trunc_int_for_mode (this_val, GET_MODE (src)))
-		    break;
+		  result = wide_int::from (std::make_pair (this_rtx,
+							   GET_MODE (src)),
+					   BITS_PER_WORD, SIGNED);
+		  break;
 		default:
 		  gcc_unreachable ();
 		}
-	      this_rtx = GEN_INT (this_val);
+	      this_rtx = immed_wide_int_const (result, word_mode);
 	    }
 #endif
 	  this_cost = set_src_cost (this_rtx, speed);