This is the mail archive of the 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]

Simplify expmed.c:lshift_value

expmed.c:lshift_value has:

  val = double_int::from_uhwi (INTVAL (value)).zext (bitsize);
  val = val.llshift (bitpos, HOST_BITS_PER_DOUBLE_INT);

but its only caller has already zero-extended INTVAL (value) from BITSIZE,
so we might as well pass that instead of the (value, bitsize) pair.

This isn't really much of a win on its own, but it makes the associated
wide-int change more obvious.

Tested on x86_64-linux-gnu.  OK to install?


	* expmed.c (lshift_value): Take an unsigned HOST_WIDE_INT instead
	of an rtx/bitpos pair.
	(store_fixed_bit_field): Update accordingly.

Index: gcc/expmed.c
--- gcc/expmed.c	2013-09-08 11:52:28.995962127 +0100
+++ gcc/expmed.c	2013-09-08 14:21:49.710092468 +0100
@@ -56,7 +56,7 @@ static rtx extract_fixed_bit_field (enum
 				    unsigned HOST_WIDE_INT,
 				    unsigned HOST_WIDE_INT, rtx, int, bool);
 static rtx mask_rtx (enum machine_mode, int, int, int);
-static rtx lshift_value (enum machine_mode, rtx, int, int);
+static rtx lshift_value (enum machine_mode, unsigned HOST_WIDE_INT, int);
 static rtx extract_split_bit_field (rtx, unsigned HOST_WIDE_INT,
 				    unsigned HOST_WIDE_INT, int);
 static void do_cmp_and_jump (rtx, rtx, enum rtx_code, enum machine_mode, rtx);
@@ -991,7 +991,7 @@ store_fixed_bit_field (rtx op0, unsigned
 	       || (bitsize == HOST_BITS_PER_WIDE_INT && v == -1))
 	all_one = 1;
-      value = lshift_value (mode, value, bitnum, bitsize);
+      value = lshift_value (mode, v, bitnum);
@@ -1862,14 +1862,15 @@ mask_rtx (enum machine_mode mode, int bi
 /* Return a constant integer (CONST_INT or CONST_DOUBLE) rtx with the value
-   VALUE truncated to BITSIZE bits and then shifted left BITPOS bits.  */
+   VALUE << BITPOS.  */
 static rtx
-lshift_value (enum machine_mode mode, rtx value, int bitpos, int bitsize)
+lshift_value (enum machine_mode mode, unsigned HOST_WIDE_INT value,
+	      int bitpos)
   double_int val;
-  val = double_int::from_uhwi (INTVAL (value)).zext (bitsize);
+  val = double_int::from_uhwi (value);
   val = val.llshift (bitpos, HOST_BITS_PER_DOUBLE_INT);
   return immed_double_int_const (val, mode);

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