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] Use gen_int_mode insead of GEN_INT (trunc_int_for_mode(...))


Hi,

Attached is a patch to use gen_int_mode insead of
GEN_INT (trunc_int_for_mode (...)).

Tested on i686-pc-linux-gnu.  OK to apply?

Kazu Hirata

2005-03-05  Kazu Hirata  <kazu@cs.umass.edu>

	* combine.c (simplify_and_const_int): Use gen_int_mode instead
	of GEN_INT (trunc_int_for_mode (...)).
	* loop-iv.c (iv_number_of_iterations): Likewise.
	* postreload.c (reload_cse_move2add): Likewise.
	* simplify-rtx.c (simplify_const_unary_operation,
	simplify_const_binary_operation): Likewise.
	* stor-layout.c (get_mode_bounds): Likewise.

Index: combine.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/combine.c,v
retrieving revision 1.476
diff -u -d -p -r1.476 combine.c
--- combine.c	28 Feb 2005 18:18:22 -0000	1.476
+++ combine.c	3 Mar 2005 17:00:37 -0000
@@ -8095,7 +8095,7 @@ simplify_and_const_int (rtx x, enum mach
   /* If VAROP is a CONST_INT, then we need to apply the mask in CONSTOP
      to VAROP and return the new constant.  */
   if (GET_CODE (varop) == CONST_INT)
-    return GEN_INT (trunc_int_for_mode (INTVAL (varop) & constop, mode));
+    return gen_int_mode (INTVAL (varop) & constop, mode);
 
   /* See what bits may be nonzero in VAROP.  Unlike the general case of
      a call to nonzero_bits, here we don't care about bits outside
Index: loop-iv.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/loop-iv.c,v
retrieving revision 2.26
diff -u -d -p -r2.26 loop-iv.c
--- loop-iv.c	28 Dec 2004 10:33:39 -0000	2.26
+++ loop-iv.c	3 Mar 2005 17:00:38 -0000
@@ -2369,8 +2369,7 @@ iv_number_of_iterations (struct loop *lo
 
       tmp = simplify_gen_binary (UDIV, mode, tmp1, GEN_INT (d));
       inv = inverse (s, size);
-      inv = trunc_int_for_mode (inv, mode);
-      tmp = simplify_gen_binary (MULT, mode, tmp, GEN_INT (inv));
+      tmp = simplify_gen_binary (MULT, mode, tmp, gen_int_mode (inv, mode));
       desc->niter_expr = simplify_gen_binary (AND, mode, tmp, bound);
     }
   else
Index: postreload.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/postreload.c,v
retrieving revision 2.27
diff -u -d -p -r2.27 postreload.c
--- postreload.c	18 Jan 2005 11:36:16 -0000	2.27
+++ postreload.c	3 Mar 2005 17:00:38 -0000
@@ -1244,10 +1244,8 @@ reload_cse_move2add (rtx first)
 
 	      if (GET_CODE (src) == CONST_INT && reg_base_reg[regno] < 0)
 		{
-		  rtx new_src =
-		    GEN_INT (trunc_int_for_mode (INTVAL (src)
-						 - reg_offset[regno],
-						 GET_MODE (reg)));
+		  rtx new_src = gen_int_mode (INTVAL (src) - reg_offset[regno],
+					      GET_MODE (reg));
 		  /* (set (reg) (plus (reg) (const_int 0))) is not canonical;
 		     use (set (reg) (reg)) instead.
 		     We don't delete this insn, nor do we convert it into a
@@ -1284,9 +1282,8 @@ reload_cse_move2add (rtx first)
 			    {
 			      rtx narrow_reg = gen_rtx_REG (narrow_mode,
 							    REGNO (reg));
-			      rtx narrow_src =
-				GEN_INT (trunc_int_for_mode (INTVAL (src),
-							     narrow_mode));
+			      rtx narrow_src = gen_int_mode (INTVAL (src),
+							     narrow_mode);
 			      rtx new_set =
 				gen_rtx_SET (VOIDmode,
 					     gen_rtx_STRICT_LOW_PART (VOIDmode,
@@ -1335,10 +1332,10 @@ reload_cse_move2add (rtx first)
 		      HOST_WIDE_INT base_offset = reg_offset[REGNO (src)];
 		      HOST_WIDE_INT regno_offset = reg_offset[regno];
 		      rtx new_src =
-			GEN_INT (trunc_int_for_mode (added_offset
-						     + base_offset
-						     - regno_offset,
-						     GET_MODE (reg)));
+			gen_int_mode (added_offset
+				      + base_offset
+				      - regno_offset,
+				      GET_MODE (reg));
 		      int success = 0;
 
 		      if (new_src == const0_rtx)
Index: simplify-rtx.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/simplify-rtx.c,v
retrieving revision 1.231
diff -u -d -p -r1.231 simplify-rtx.c
--- simplify-rtx.c	28 Feb 2005 15:29:34 -0000	1.231
+++ simplify-rtx.c	3 Mar 2005 17:00:38 -0000
@@ -829,9 +829,7 @@ simplify_const_unary_operation (enum rtx
 	  gcc_unreachable ();
 	}
 
-      val = trunc_int_for_mode (val, mode);
-
-      return GEN_INT (val);
+      return gen_int_mode (val, mode);
     }
 
   /* We can do some operations on integer CONST_DOUBLEs.  Also allow
@@ -2491,8 +2489,7 @@ simplify_const_binary_operation (enum rt
 	  gcc_unreachable ();
 	}
 
-      val = trunc_int_for_mode (val, mode);
-      return GEN_INT (val);
+      return gen_int_mode (val, mode);
     }
 
   return NULL_RTX;
Index: stor-layout.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/stor-layout.c,v
retrieving revision 1.223
diff -u -d -p -r1.223 stor-layout.c
--- stor-layout.c	22 Dec 2004 18:51:18 -0000	1.223
+++ stor-layout.c	3 Mar 2005 17:00:39 -0000
@@ -2097,8 +2097,8 @@ get_mode_bounds (enum machine_mode mode,
       max_val = ((unsigned HOST_WIDE_INT) 1 << (size - 1) << 1) - 1;
     }
 
-  *mmin = GEN_INT (trunc_int_for_mode (min_val, target_mode));
-  *mmax = GEN_INT (trunc_int_for_mode (max_val, target_mode));
+  *mmin = gen_int_mode (min_val, target_mode);
+  *mmax = gen_int_mode (max_val, target_mode);
 }
 
 #include "gt-stor-layout.h"


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