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][3/n] Fix built_int_cst callers with NULL type - expand_shift reorg


Noting that there is a single caller that calls expand_shift with a 
possible non-constant shift value this patch renames expand_shift
to expand_variable_shift and changes expand_shift to take a constant
integer shift amout, updating all callers to drop various variants
of building an integer constant.  Optimizing expand_variable_shift
and expand_shift is possible, but I'll leave that to a followup
and/or somebody else.

Bootstrap and regtest running on x86_64-unknown-linux-gnu, I'll apply
this after it succeeded.

Richard.

2011-04-29  Richard Guenther  <rguenther@suse.de>

	* expr.h (expand_shift): Rename to ...
	(expand_variable_shift): ... this.
	(expand_shift): Take a constant shift amount.
	* expmed.c (expand_shift): Rename to ...
	(expand_variable_shift): ... this.
	(expand_shift): New wrapper around expand_variable_shift.
	* expr.c (convert_move, emit_group_load_1, emit_group_store,
	optimize_bitfield_assignment_op, store_field, expand_expr_real_2,
	expand_expr_real_1, reduce_to_bit_field_precision): Adjust.
	* expmed.c (store_fixed_bit_field, extract_bit_field_1,
	extract_fixed_bit_field, extract_split_bit_field, expand_mult_const,
	expand_mult, expand_widening_mult, expand_mult_highpart_adjust,
	extract_high_half, expand_sdiv_pow2, expand_divmod, emit_cstore,
	emit_store_flag_1, emit_store_flag): Likewise.
	* builtins.c (expand_builtin_signbit): Likewise.
	* calls.c (load_register_parameters): Likewise.
	* function.c (assign_parm_setup_block): Likewise.
	* lower-subreg.c (resolve_shift_zext): Likewise.
	* optabs.c (widen_bswap, expand_abs_nojump,
	expand_one_cmpl_abs_nojump, expand_float): Likewise.
	* spu/spu.c (spu_expand_extv): Likewise.
	* sparc/sparc.c (sparc32_initialize_trampoline): Likewise.

Index: gcc/expr.h
===================================================================
*** gcc/expr.h	(revision 173151)
--- gcc/expr.h	(working copy)
*************** extern rtx expand_call (tree, rtx, int);
*** 488,495 ****
  extern void fixup_tail_calls (void);
  
  #ifdef TREE_CODE
! extern rtx expand_shift (enum tree_code, enum machine_mode, rtx, tree, rtx,
! 			 int);
  extern rtx expand_divmod (int, enum tree_code, enum machine_mode, rtx, rtx,
  			  rtx, int);
  #endif
--- 488,497 ----
  extern void fixup_tail_calls (void);
  
  #ifdef TREE_CODE
! extern rtx expand_variable_shift (enum tree_code, enum machine_mode,
! 				  rtx, tree, rtx, int);
! extern rtx expand_shift (enum tree_code, enum machine_mode, rtx, int, rtx,
! 			     int);
  extern rtx expand_divmod (int, enum tree_code, enum machine_mode, rtx, rtx,
  			  rtx, int);
  #endif
Index: gcc/expr.c
===================================================================
*** gcc/expr.c	(revision 173151)
--- gcc/expr.c	(working copy)
*************** convert_move (rtx to, rtx from, int unsi
*** 616,622 ****
  	{
  	  enum machine_mode intermediate;
  	  rtx tmp;
! 	  tree shift_amount;
  
  	  /* Search for a mode to convert via.  */
  	  for (intermediate = from_mode; intermediate != VOIDmode;
--- 616,622 ----
  	{
  	  enum machine_mode intermediate;
  	  rtx tmp;
! 	  int shift_amount;
  
  	  /* Search for a mode to convert via.  */
  	  for (intermediate = from_mode; intermediate != VOIDmode;
*************** convert_move (rtx to, rtx from, int unsi
*** 636,644 ****
  
  	  /* No suitable intermediate mode.
  	     Generate what we need with	shifts.  */
! 	  shift_amount = build_int_cst (NULL_TREE,
! 					GET_MODE_BITSIZE (to_mode)
! 					- GET_MODE_BITSIZE (from_mode));
  	  from = gen_lowpart (to_mode, force_reg (from_mode, from));
  	  tmp = expand_shift (LSHIFT_EXPR, to_mode, from, shift_amount,
  			      to, unsignedp);
--- 636,643 ----
  
  	  /* No suitable intermediate mode.
  	     Generate what we need with	shifts.  */
! 	  shift_amount = (GET_MODE_BITSIZE (to_mode)
! 			  - GET_MODE_BITSIZE (from_mode));
  	  from = gen_lowpart (to_mode, force_reg (from_mode, from));
  	  tmp = expand_shift (LSHIFT_EXPR, to_mode, from, shift_amount,
  			      to, unsignedp);
*************** emit_group_load_1 (rtx *tmps, rtx dst, r
*** 1753,1759 ****
  
        if (shift)
  	tmps[i] = expand_shift (LSHIFT_EXPR, mode, tmps[i],
! 				build_int_cst (NULL_TREE, shift), tmps[i], 0);
      }
  }
  
--- 1752,1758 ----
  
        if (shift)
  	tmps[i] = expand_shift (LSHIFT_EXPR, mode, tmps[i],
! 				shift, tmps[i], 0);
      }
  }
  
*************** emit_group_store (rtx orig_dst, rtx src,
*** 2050,2057 ****
  	    {
  	      int shift = (bytelen - (ssize - bytepos)) * BITS_PER_UNIT;
  	      tmps[i] = expand_shift (RSHIFT_EXPR, mode, tmps[i],
! 				      build_int_cst (NULL_TREE, shift),
! 				      tmps[i], 0);
  	    }
  	  bytelen = adj_bytelen;
  	}
--- 2049,2055 ----
  	    {
  	      int shift = (bytelen - (ssize - bytepos)) * BITS_PER_UNIT;
  	      tmps[i] = expand_shift (RSHIFT_EXPR, mode, tmps[i],
! 				      shift, tmps[i], 0);
  	    }
  	  bytelen = adj_bytelen;
  	}
*************** optimize_bitfield_assignment_op (unsigne
*** 4052,4059 ****
  	  binop = xor_optab;
  	}
        value = expand_shift (LSHIFT_EXPR, str_mode, value,
! 			    build_int_cst (NULL_TREE, bitpos),
! 			    NULL_RTX, 1);
        result = expand_binop (str_mode, binop, str_rtx,
  			     value, str_rtx, 1, OPTAB_WIDEN);
        if (result != str_rtx)
--- 4050,4056 ----
  	  binop = xor_optab;
  	}
        value = expand_shift (LSHIFT_EXPR, str_mode, value,
! 			    bitpos, NULL_RTX, 1);
        result = expand_binop (str_mode, binop, str_rtx,
  			     value, str_rtx, 1, OPTAB_WIDEN);
        if (result != str_rtx)
*************** optimize_bitfield_assignment_op (unsigne
*** 4087,4094 ****
  			      NULL_RTX);
  	}
        value = expand_shift (LSHIFT_EXPR, GET_MODE (str_rtx), value,
! 			    build_int_cst (NULL_TREE, bitpos),
! 			    NULL_RTX, 1);
        result = expand_binop (GET_MODE (str_rtx), binop, str_rtx,
  			     value, str_rtx, 1, OPTAB_WIDEN);
        if (result != str_rtx)
--- 4084,4090 ----
  			      NULL_RTX);
  	}
        value = expand_shift (LSHIFT_EXPR, GET_MODE (str_rtx), value,
! 			    bitpos, NULL_RTX, 1);
        result = expand_binop (GET_MODE (str_rtx), binop, str_rtx,
  			     value, str_rtx, 1, OPTAB_WIDEN);
        if (result != str_rtx)
*************** store_field (rtx target, HOST_WIDE_INT b
*** 5882,5889 ****
  	  && bitsize < (HOST_WIDE_INT) GET_MODE_BITSIZE (GET_MODE (temp))
  	  && TREE_CODE (TREE_TYPE (exp)) == RECORD_TYPE)
  	temp = expand_shift (RSHIFT_EXPR, GET_MODE (temp), temp,
! 			     size_int (GET_MODE_BITSIZE (GET_MODE (temp))
! 				       - bitsize),
  			     NULL_RTX, 1);
  
        /* Unless MODE is VOIDmode or BLKmode, convert TEMP to
--- 5878,5884 ----
  	  && bitsize < (HOST_WIDE_INT) GET_MODE_BITSIZE (GET_MODE (temp))
  	  && TREE_CODE (TREE_TYPE (exp)) == RECORD_TYPE)
  	temp = expand_shift (RSHIFT_EXPR, GET_MODE (temp), temp,
! 			     GET_MODE_BITSIZE (GET_MODE (temp)) - bitsize,
  			     NULL_RTX, 1);
  
        /* Unless MODE is VOIDmode or BLKmode, convert TEMP to
*************** expand_expr_real_2 (sepops ops, rtx targ
*** 8064,8071 ****
  	target = 0;
        op0 = expand_expr (treeop0, subtarget,
  			 VOIDmode, EXPAND_NORMAL);
!       temp = expand_shift (code, mode, op0, treeop1, target,
! 			   unsignedp);
        if (code == LSHIFT_EXPR)
  	temp = REDUCE_BIT_FIELD (temp);
        return temp;
--- 8059,8066 ----
  	target = 0;
        op0 = expand_expr (treeop0, subtarget,
  			 VOIDmode, EXPAND_NORMAL);
!       temp = expand_variable_shift (code, mode, op0, treeop1, target,
! 				    unsignedp);
        if (code == LSHIFT_EXPR)
  	temp = REDUCE_BIT_FIELD (temp);
        return temp;
*************** expand_expr_real_1 (tree exp, rtx target
*** 8980,8988 ****
  		      }
  		    else
  		      {
! 			tree count
! 			  = build_int_cst (NULL_TREE,
! 					   GET_MODE_BITSIZE (imode) - bitsize);
  
  			op0 = expand_shift (LSHIFT_EXPR, imode, op0, count,
  					    target, 0);
--- 8975,8981 ----
  		      }
  		    else
  		      {
! 			int count = GET_MODE_BITSIZE (imode) - bitsize;
  
  			op0 = expand_shift (LSHIFT_EXPR, imode, op0, count,
  					    target, 0);
*************** expand_expr_real_1 (tree exp, rtx target
*** 9251,9259 ****
  		&& GET_MODE_CLASS (GET_MODE (op0)) == MODE_INT
  		&& bitsize < (HOST_WIDE_INT) GET_MODE_BITSIZE (GET_MODE (op0)))
  	      op0 = expand_shift (LSHIFT_EXPR, GET_MODE (op0), op0,
! 				  size_int (GET_MODE_BITSIZE (GET_MODE (op0))
! 					    - bitsize),
! 				  op0, 1);
  
  	    /* If the result type is BLKmode, store the data into a temporary
  	       of the appropriate type, but with the mode corresponding to the
--- 9244,9251 ----
  		&& GET_MODE_CLASS (GET_MODE (op0)) == MODE_INT
  		&& bitsize < (HOST_WIDE_INT) GET_MODE_BITSIZE (GET_MODE (op0)))
  	      op0 = expand_shift (LSHIFT_EXPR, GET_MODE (op0), op0,
! 				  GET_MODE_BITSIZE (GET_MODE (op0))
! 				  - bitsize, op0, 1);
  
  	    /* If the result type is BLKmode, store the data into a temporary
  	       of the appropriate type, but with the mode corresponding to the
*************** reduce_to_bit_field_precision (rtx exp,
*** 9750,9759 ****
      }
    else
      {
!       tree count = build_int_cst (NULL_TREE,
! 				  GET_MODE_BITSIZE (GET_MODE (exp)) - prec);
!       exp = expand_shift (LSHIFT_EXPR, GET_MODE (exp), exp, count, target, 0);
!       return expand_shift (RSHIFT_EXPR, GET_MODE (exp), exp, count, target, 0);
      }
  }
  
--- 9742,9752 ----
      }
    else
      {
!       int count = GET_MODE_BITSIZE (GET_MODE (exp)) - prec;
!       exp = expand_shift (LSHIFT_EXPR, GET_MODE (exp),
! 			  exp, count, target, 0);
!       return expand_shift (RSHIFT_EXPR, GET_MODE (exp),
! 			   exp, count, target, 0);
      }
  }
  
Index: gcc/expmed.c
===================================================================
*** gcc/expmed.c	(revision 173151)
--- gcc/expmed.c	(working copy)
*************** store_fixed_bit_field (rtx op0, unsigned
*** 916,922 ****
  			      NULL_RTX, 1, OPTAB_LIB_WIDEN);
        if (bitpos > 0)
  	value = expand_shift (LSHIFT_EXPR, mode, value,
! 			      build_int_cst (NULL_TREE, bitpos), NULL_RTX, 1);
      }
  
    /* Now clear the chosen bits in OP0,
--- 916,922 ----
  			      NULL_RTX, 1, OPTAB_LIB_WIDEN);
        if (bitpos > 0)
  	value = expand_shift (LSHIFT_EXPR, mode, value,
! 			      bitpos, NULL_RTX, 1);
      }
  
    /* Now clear the chosen bits in OP0,
*************** extract_bit_field_1 (rtx str_rtx, unsign
*** 1396,1408 ****
  
        /* Signed bit field: sign-extend with two arithmetic shifts.  */
        target = expand_shift (LSHIFT_EXPR, mode, target,
! 			     build_int_cst (NULL_TREE,
! 					    GET_MODE_BITSIZE (mode) - bitsize),
! 			     NULL_RTX, 0);
        return expand_shift (RSHIFT_EXPR, mode, target,
! 			   build_int_cst (NULL_TREE,
! 					  GET_MODE_BITSIZE (mode) - bitsize),
! 			   NULL_RTX, 0);
      }
  
    /* From here on we know the desired field is smaller than a word.  */
--- 1396,1404 ----
  
        /* Signed bit field: sign-extend with two arithmetic shifts.  */
        target = expand_shift (LSHIFT_EXPR, mode, target,
! 			     GET_MODE_BITSIZE (mode) - bitsize, NULL_RTX, 0);
        return expand_shift (RSHIFT_EXPR, mode, target,
! 			   GET_MODE_BITSIZE (mode) - bitsize, NULL_RTX, 0);
      }
  
    /* From here on we know the desired field is smaller than a word.  */
*************** extract_fixed_bit_field (enum machine_mo
*** 1752,1763 ****
  	{
  	  /* If the field does not already start at the lsb,
  	     shift it so it does.  */
- 	  tree amount = build_int_cst (NULL_TREE, bitpos);
  	  /* Maybe propagate the target for the shift.  */
  	  /* But not if we will return it--could confuse integrate.c.  */
  	  rtx subtarget = (target != 0 && REG_P (target) ? target : 0);
  	  if (tmode != mode) subtarget = 0;
! 	  op0 = expand_shift (RSHIFT_EXPR, mode, op0, amount, subtarget, 1);
  	}
        /* Convert the value to the desired mode.  */
        if (mode != tmode)
--- 1748,1758 ----
  	{
  	  /* If the field does not already start at the lsb,
  	     shift it so it does.  */
  	  /* Maybe propagate the target for the shift.  */
  	  /* But not if we will return it--could confuse integrate.c.  */
  	  rtx subtarget = (target != 0 && REG_P (target) ? target : 0);
  	  if (tmode != mode) subtarget = 0;
! 	  op0 = expand_shift (RSHIFT_EXPR, mode, op0, bitpos, subtarget, 1);
  	}
        /* Convert the value to the desired mode.  */
        if (mode != tmode)
*************** extract_fixed_bit_field (enum machine_mo
*** 1791,1808 ****
  
    if (GET_MODE_BITSIZE (mode) != (bitsize + bitpos))
      {
!       tree amount
! 	= build_int_cst (NULL_TREE,
! 			 GET_MODE_BITSIZE (mode) - (bitsize + bitpos));
        /* Maybe propagate the target for the shift.  */
        rtx subtarget = (target != 0 && REG_P (target) ? target : 0);
        op0 = expand_shift (LSHIFT_EXPR, mode, op0, amount, subtarget, 1);
      }
  
    return expand_shift (RSHIFT_EXPR, mode, op0,
! 		       build_int_cst (NULL_TREE,
! 				      GET_MODE_BITSIZE (mode) - bitsize),
! 		       target, 0);
  }
  
  /* Return a constant integer (CONST_INT or CONST_DOUBLE) mask value
--- 1786,1799 ----
  
    if (GET_MODE_BITSIZE (mode) != (bitsize + bitpos))
      {
!       int amount = GET_MODE_BITSIZE (mode) - (bitsize + bitpos);
        /* Maybe propagate the target for the shift.  */
        rtx subtarget = (target != 0 && REG_P (target) ? target : 0);
        op0 = expand_shift (LSHIFT_EXPR, mode, op0, amount, subtarget, 1);
      }
  
    return expand_shift (RSHIFT_EXPR, mode, op0,
! 		       GET_MODE_BITSIZE (mode) - bitsize, target, 0);
  }
  
  /* Return a constant integer (CONST_INT or CONST_DOUBLE) mask value
*************** extract_split_bit_field (rtx op0, unsign
*** 1913,1927 ****
  	{
  	  if (bitsize != bitsdone)
  	    part = expand_shift (LSHIFT_EXPR, word_mode, part,
! 				 build_int_cst (NULL_TREE, bitsize - bitsdone),
! 				 0, 1);
  	}
        else
  	{
  	  if (bitsdone != thissize)
  	    part = expand_shift (LSHIFT_EXPR, word_mode, part,
! 				 build_int_cst (NULL_TREE,
! 						bitsdone - thissize), 0, 1);
  	}
  
        if (first)
--- 1904,1916 ----
  	{
  	  if (bitsize != bitsdone)
  	    part = expand_shift (LSHIFT_EXPR, word_mode, part,
! 				 bitsize - bitsdone, 0, 1);
  	}
        else
  	{
  	  if (bitsdone != thissize)
  	    part = expand_shift (LSHIFT_EXPR, word_mode, part,
! 				 bitsdone - thissize, 0, 1);
  	}
  
        if (first)
*************** extract_split_bit_field (rtx op0, unsign
*** 1940,1950 ****
      return result;
    /* Signed bit field: sign-extend with two arithmetic shifts.  */
    result = expand_shift (LSHIFT_EXPR, word_mode, result,
! 			 build_int_cst (NULL_TREE, BITS_PER_WORD - bitsize),
! 			 NULL_RTX, 0);
    return expand_shift (RSHIFT_EXPR, word_mode, result,
! 		       build_int_cst (NULL_TREE, BITS_PER_WORD - bitsize),
! 		       NULL_RTX, 0);
  }
  
  /* Try to read the low bits of SRC as an rvalue of mode MODE, preserving
--- 1929,1937 ----
      return result;
    /* Signed bit field: sign-extend with two arithmetic shifts.  */
    result = expand_shift (LSHIFT_EXPR, word_mode, result,
! 			 BITS_PER_WORD - bitsize, NULL_RTX, 0);
    return expand_shift (RSHIFT_EXPR, word_mode, result,
! 		       BITS_PER_WORD - bitsize, NULL_RTX, 0);
  }
  
  /* Try to read the low bits of SRC as an rvalue of mode MODE, preserving
*************** expand_dec (rtx target, rtx dec)
*** 2053,2060 ****
     Return the rtx for where the value is.  */
  
  rtx
! expand_shift (enum tree_code code, enum machine_mode mode, rtx shifted,
! 	      tree amount, rtx target, int unsignedp)
  {
    rtx op1, temp = 0;
    int left = (code == LSHIFT_EXPR || code == LROTATE_EXPR);
--- 2040,2047 ----
     Return the rtx for where the value is.  */
  
  rtx
! expand_variable_shift (enum tree_code code, enum machine_mode mode, rtx shifted,
! 		       tree amount, rtx target, int unsignedp)
  {
    rtx op1, temp = 0;
    int left = (code == LSHIFT_EXPR || code == LROTATE_EXPR);
*************** expand_shift (enum tree_code code, enum
*** 2167,2176 ****
  
  	      shifted = force_reg (mode, shifted);
  
! 	      temp = expand_shift (left ? LSHIFT_EXPR : RSHIFT_EXPR,
! 				   mode, shifted, new_amount, 0, 1);
! 	      temp1 = expand_shift (left ? RSHIFT_EXPR : LSHIFT_EXPR,
! 				    mode, shifted, other_amount, subtarget, 1);
  	      return expand_binop (mode, ior_optab, temp, temp1, target,
  				   unsignedp, methods);
  	    }
--- 2154,2164 ----
  
  	      shifted = force_reg (mode, shifted);
  
! 	      temp = expand_variable_shift (left ? LSHIFT_EXPR : RSHIFT_EXPR,
! 					    mode, shifted, new_amount, 0, 1);
! 	      temp1 = expand_variable_shift (left ? RSHIFT_EXPR : LSHIFT_EXPR,
! 					     mode, shifted, other_amount,
! 					     subtarget, 1);
  	      return expand_binop (mode, ior_optab, temp, temp1, target,
  				   unsignedp, methods);
  	    }
*************** expand_shift (enum tree_code code, enum
*** 2213,2218 ****
--- 2201,2224 ----
    gcc_assert (temp);
    return temp;
  }
+ 
+ /* Output a shift instruction for expression code CODE,
+    with SHIFTED being the rtx for the value to shift,
+    and AMOUNT the amount to shift by.
+    Store the result in the rtx TARGET, if that is convenient.
+    If UNSIGNEDP is nonzero, do a logical shift; otherwise, arithmetic.
+    Return the rtx for where the value is.  */
+ 
+ rtx
+ expand_shift (enum tree_code code, enum machine_mode mode, rtx shifted,
+ 	      int amount, rtx target, int unsignedp)
+ {
+   /* ???  With re-writing expand_shift we could avoid going through a
+      tree for the shift amount and directly do GEN_INT (amount).  */
+   return expand_variable_shift (code, mode, shifted,
+ 				build_int_cst (integer_type_node, amount),
+ 				target, unsignedp);
+ }
  
  /* Indicates the type of fixup needed after a constant multiplication.
     BASIC_VARIANT means no fixup is needed, NEGATE_VARIANT means that
*************** expand_mult_const (enum machine_mode mod
*** 2838,2864 ****
        switch (alg->op[opno])
  	{
  	case alg_shift:
! 	  tem = expand_shift (LSHIFT_EXPR, mode, accum,
! 			      build_int_cst (NULL_TREE, log),
! 			      NULL_RTX, 0);
  	  /* REG_EQUAL note will be attached to the following insn.  */
  	  emit_move_insn (accum, tem);
  	  val_so_far <<= log;
  	  break;
  
  	case alg_add_t_m2:
! 	  tem = expand_shift (LSHIFT_EXPR, mode, op0,
! 			      build_int_cst (NULL_TREE, log),
! 			      NULL_RTX, 0);
  	  accum = force_operand (gen_rtx_PLUS (mode, accum, tem),
  				 add_target ? add_target : accum_target);
  	  val_so_far += (HOST_WIDE_INT) 1 << log;
  	  break;
  
  	case alg_sub_t_m2:
! 	  tem = expand_shift (LSHIFT_EXPR, mode, op0,
! 			      build_int_cst (NULL_TREE, log),
! 			      NULL_RTX, 0);
  	  accum = force_operand (gen_rtx_MINUS (mode, accum, tem),
  				 add_target ? add_target : accum_target);
  	  val_so_far -= (HOST_WIDE_INT) 1 << log;
--- 2844,2864 ----
        switch (alg->op[opno])
  	{
  	case alg_shift:
! 	  tem = expand_shift (LSHIFT_EXPR, mode, accum, log, NULL_RTX, 0);
  	  /* REG_EQUAL note will be attached to the following insn.  */
  	  emit_move_insn (accum, tem);
  	  val_so_far <<= log;
  	  break;
  
  	case alg_add_t_m2:
! 	  tem = expand_shift (LSHIFT_EXPR, mode, op0, log, NULL_RTX, 0);
  	  accum = force_operand (gen_rtx_PLUS (mode, accum, tem),
  				 add_target ? add_target : accum_target);
  	  val_so_far += (HOST_WIDE_INT) 1 << log;
  	  break;
  
  	case alg_sub_t_m2:
! 	  tem = expand_shift (LSHIFT_EXPR, mode, op0, log, NULL_RTX, 0);
  	  accum = force_operand (gen_rtx_MINUS (mode, accum, tem),
  				 add_target ? add_target : accum_target);
  	  val_so_far -= (HOST_WIDE_INT) 1 << log;
*************** expand_mult_const (enum machine_mode mod
*** 2866,2874 ****
  
  	case alg_add_t2_m:
  	  accum = expand_shift (LSHIFT_EXPR, mode, accum,
! 				build_int_cst (NULL_TREE, log),
! 				shift_subtarget,
! 				0);
  	  accum = force_operand (gen_rtx_PLUS (mode, accum, op0),
  				 add_target ? add_target : accum_target);
  	  val_so_far = (val_so_far << log) + 1;
--- 2866,2872 ----
  
  	case alg_add_t2_m:
  	  accum = expand_shift (LSHIFT_EXPR, mode, accum,
! 				log, shift_subtarget, 0);
  	  accum = force_operand (gen_rtx_PLUS (mode, accum, op0),
  				 add_target ? add_target : accum_target);
  	  val_so_far = (val_so_far << log) + 1;
*************** expand_mult_const (enum machine_mode mod
*** 2876,2901 ****
  
  	case alg_sub_t2_m:
  	  accum = expand_shift (LSHIFT_EXPR, mode, accum,
! 				build_int_cst (NULL_TREE, log),
! 				shift_subtarget, 0);
  	  accum = force_operand (gen_rtx_MINUS (mode, accum, op0),
  				 add_target ? add_target : accum_target);
  	  val_so_far = (val_so_far << log) - 1;
  	  break;
  
  	case alg_add_factor:
! 	  tem = expand_shift (LSHIFT_EXPR, mode, accum,
! 			      build_int_cst (NULL_TREE, log),
! 			      NULL_RTX, 0);
  	  accum = force_operand (gen_rtx_PLUS (mode, accum, tem),
  				 add_target ? add_target : accum_target);
  	  val_so_far += val_so_far << log;
  	  break;
  
  	case alg_sub_factor:
! 	  tem = expand_shift (LSHIFT_EXPR, mode, accum,
! 			      build_int_cst (NULL_TREE, log),
! 			      NULL_RTX, 0);
  	  accum = force_operand (gen_rtx_MINUS (mode, tem, accum),
  				 (add_target
  				  ? add_target : (optimize ? 0 : tem)));
--- 2874,2894 ----
  
  	case alg_sub_t2_m:
  	  accum = expand_shift (LSHIFT_EXPR, mode, accum,
! 				log, shift_subtarget, 0);
  	  accum = force_operand (gen_rtx_MINUS (mode, accum, op0),
  				 add_target ? add_target : accum_target);
  	  val_so_far = (val_so_far << log) - 1;
  	  break;
  
  	case alg_add_factor:
! 	  tem = expand_shift (LSHIFT_EXPR, mode, accum, log, NULL_RTX, 0);
  	  accum = force_operand (gen_rtx_PLUS (mode, accum, tem),
  				 add_target ? add_target : accum_target);
  	  val_so_far += val_so_far << log;
  	  break;
  
  	case alg_sub_factor:
! 	  tem = expand_shift (LSHIFT_EXPR, mode, accum, log, NULL_RTX, 0);
  	  accum = force_operand (gen_rtx_MINUS (mode, tem, accum),
  				 (add_target
  				  ? add_target : (optimize ? 0 : tem)));
*************** expand_mult (enum machine_mode mode, rtx
*** 3028,3035 ****
  	      int shift = floor_log2 (CONST_DOUBLE_HIGH (op1))
  			  + HOST_BITS_PER_WIDE_INT;
  	      return expand_shift (LSHIFT_EXPR, mode, op0,
! 				   build_int_cst (NULL_TREE, shift),
! 				   target, unsignedp);
  	    }
  	}
  
--- 3021,3027 ----
  	      int shift = floor_log2 (CONST_DOUBLE_HIGH (op1))
  			  + HOST_BITS_PER_WIDE_INT;
  	      return expand_shift (LSHIFT_EXPR, mode, op0,
! 				   shift, target, unsignedp);
  	    }
  	}
  
*************** expand_mult (enum machine_mode mode, rtx
*** 3042,3049 ****
  	  /* Special case powers of two.  */
  	  if (EXACT_POWER_OF_2_OR_ZERO_P (coeff))
  	    return expand_shift (LSHIFT_EXPR, mode, op0,
! 				 build_int_cst (NULL_TREE, floor_log2 (coeff)),
! 				 target, unsignedp);
  
  	  /* Exclude cost of op0 from max_cost to match the cost
  	     calculation of the synth_mult.  */
--- 3034,3040 ----
  	  /* Special case powers of two.  */
  	  if (EXACT_POWER_OF_2_OR_ZERO_P (coeff))
  	    return expand_shift (LSHIFT_EXPR, mode, op0,
! 				 floor_log2 (coeff), target, unsignedp);
  
  	  /* Exclude cost of op0 from max_cost to match the cost
  	     calculation of the synth_mult.  */
*************** expand_widening_mult (enum machine_mode
*** 3123,3130 ****
  	{
  	  op0 = convert_to_mode (mode, op0, this_optab == umul_widen_optab);
  	  return expand_shift (LSHIFT_EXPR, mode, op0,
! 			       build_int_cst (NULL_TREE, floor_log2 (coeff)),
! 			       target, unsignedp);
  	}
  
        /* Exclude cost of op0 from max_cost to match the cost
--- 3114,3120 ----
  	{
  	  op0 = convert_to_mode (mode, op0, this_optab == umul_widen_optab);
  	  return expand_shift (LSHIFT_EXPR, mode, op0,
! 			       floor_log2 (coeff), target, unsignedp);
  	}
  
        /* Exclude cost of op0 from max_cost to match the cost
*************** expand_mult_highpart_adjust (enum machin
*** 3297,3312 ****
    enum rtx_code adj_code = unsignedp ? PLUS : MINUS;
  
    tem = expand_shift (RSHIFT_EXPR, mode, op0,
! 		      build_int_cst (NULL_TREE, GET_MODE_BITSIZE (mode) - 1),
! 		      NULL_RTX, 0);
    tem = expand_and (mode, tem, op1, NULL_RTX);
    adj_operand
      = force_operand (gen_rtx_fmt_ee (adj_code, mode, adj_operand, tem),
  		     adj_operand);
  
    tem = expand_shift (RSHIFT_EXPR, mode, op1,
! 		      build_int_cst (NULL_TREE, GET_MODE_BITSIZE (mode) - 1),
! 		      NULL_RTX, 0);
    tem = expand_and (mode, tem, op0, NULL_RTX);
    target = force_operand (gen_rtx_fmt_ee (adj_code, mode, adj_operand, tem),
  			  target);
--- 3287,3300 ----
    enum rtx_code adj_code = unsignedp ? PLUS : MINUS;
  
    tem = expand_shift (RSHIFT_EXPR, mode, op0,
! 		      GET_MODE_BITSIZE (mode) - 1, NULL_RTX, 0);
    tem = expand_and (mode, tem, op1, NULL_RTX);
    adj_operand
      = force_operand (gen_rtx_fmt_ee (adj_code, mode, adj_operand, tem),
  		     adj_operand);
  
    tem = expand_shift (RSHIFT_EXPR, mode, op1,
! 		      GET_MODE_BITSIZE (mode) - 1, NULL_RTX, 0);
    tem = expand_and (mode, tem, op0, NULL_RTX);
    target = force_operand (gen_rtx_fmt_ee (adj_code, mode, adj_operand, tem),
  			  target);
*************** extract_high_half (enum machine_mode mod
*** 3328,3334 ****
  
    wider_mode = GET_MODE_WIDER_MODE (mode);
    op = expand_shift (RSHIFT_EXPR, wider_mode, op,
! 		     build_int_cst (NULL_TREE, GET_MODE_BITSIZE (mode)), 0, 1);
    return convert_modes (mode, wider_mode, op, 0);
  }
  
--- 3316,3322 ----
  
    wider_mode = GET_MODE_WIDER_MODE (mode);
    op = expand_shift (RSHIFT_EXPR, wider_mode, op,
! 		     GET_MODE_BITSIZE (mode), 0, 1);
    return convert_modes (mode, wider_mode, op, 0);
  }
  
*************** static rtx
*** 3615,3625 ****
  expand_sdiv_pow2 (enum machine_mode mode, rtx op0, HOST_WIDE_INT d)
  {
    rtx temp, label;
-   tree shift;
    int logd;
  
    logd = floor_log2 (d);
-   shift = build_int_cst (NULL_TREE, logd);
  
    if (d == 2
        && BRANCH_COST (optimize_insn_for_speed_p (),
--- 3603,3611 ----
*************** expand_sdiv_pow2 (enum machine_mode mode
*** 3629,3635 ****
        temp = emit_store_flag (temp, LT, op0, const0_rtx, mode, 0, 1);
        temp = expand_binop (mode, add_optab, temp, op0, NULL_RTX,
  			   0, OPTAB_LIB_WIDEN);
!       return expand_shift (RSHIFT_EXPR, mode, temp, shift, NULL_RTX, 0);
      }
  
  #ifdef HAVE_conditional_move
--- 3615,3621 ----
        temp = emit_store_flag (temp, LT, op0, const0_rtx, mode, 0, 1);
        temp = expand_binop (mode, add_optab, temp, op0, NULL_RTX,
  			   0, OPTAB_LIB_WIDEN);
!       return expand_shift (RSHIFT_EXPR, mode, temp, logd, NULL_RTX, 0);
      }
  
  #ifdef HAVE_conditional_move
*************** expand_sdiv_pow2 (enum machine_mode mode
*** 3657,3663 ****
  	  rtx seq = get_insns ();
  	  end_sequence ();
  	  emit_insn (seq);
! 	  return expand_shift (RSHIFT_EXPR, mode, temp2, shift, NULL_RTX, 0);
  	}
        end_sequence ();
      }
--- 3643,3649 ----
  	  rtx seq = get_insns ();
  	  end_sequence ();
  	  emit_insn (seq);
! 	  return expand_shift (RSHIFT_EXPR, mode, temp2, logd, NULL_RTX, 0);
  	}
        end_sequence ();
      }
*************** expand_sdiv_pow2 (enum machine_mode mode
*** 3675,3685 ****
  			     NULL_RTX, 0, OPTAB_LIB_WIDEN);
        else
  	temp = expand_shift (RSHIFT_EXPR, mode, temp,
! 			     build_int_cst (NULL_TREE, ushift),
! 			     NULL_RTX, 1);
        temp = expand_binop (mode, add_optab, temp, op0, NULL_RTX,
  			   0, OPTAB_LIB_WIDEN);
!       return expand_shift (RSHIFT_EXPR, mode, temp, shift, NULL_RTX, 0);
      }
  
    label = gen_label_rtx ();
--- 3661,3670 ----
  			     NULL_RTX, 0, OPTAB_LIB_WIDEN);
        else
  	temp = expand_shift (RSHIFT_EXPR, mode, temp,
! 			     ushift, NULL_RTX, 1);
        temp = expand_binop (mode, add_optab, temp, op0, NULL_RTX,
  			   0, OPTAB_LIB_WIDEN);
!       return expand_shift (RSHIFT_EXPR, mode, temp, logd, NULL_RTX, 0);
      }
  
    label = gen_label_rtx ();
*************** expand_sdiv_pow2 (enum machine_mode mode
*** 3687,3693 ****
    do_cmp_and_jump (temp, const0_rtx, GE, mode, label);
    expand_inc (temp, GEN_INT (d - 1));
    emit_label (label);
!   return expand_shift (RSHIFT_EXPR, mode, temp, shift, NULL_RTX, 0);
  }
  
  /* Emit the code to divide OP0 by OP1, putting the result in TARGET
--- 3672,3678 ----
    do_cmp_and_jump (temp, const0_rtx, GE, mode, label);
    expand_inc (temp, GEN_INT (d - 1));
    emit_label (label);
!   return expand_shift (RSHIFT_EXPR, mode, temp, logd, NULL_RTX, 0);
  }
  
  /* Emit the code to divide OP0 by OP1, putting the result in TARGET
*************** expand_divmod (int rem_flag, enum tree_c
*** 3951,3959 ****
  			  return gen_lowpart (mode, remainder);
  		      }
  		    quotient = expand_shift (RSHIFT_EXPR, compute_mode, op0,
! 					     build_int_cst (NULL_TREE,
! 							    pre_shift),
! 					     tquotient, 1);
  		  }
  		else if (size <= HOST_BITS_PER_WIDE_INT)
  		  {
--- 3936,3942 ----
  			  return gen_lowpart (mode, remainder);
  		      }
  		    quotient = expand_shift (RSHIFT_EXPR, compute_mode, op0,
! 					     pre_shift, tquotient, 1);
  		  }
  		else if (size <= HOST_BITS_PER_WIDE_INT)
  		  {
*************** expand_divmod (int rem_flag, enum tree_c
*** 4005,4019 ****
  			    t2 = force_operand (gen_rtx_MINUS (compute_mode,
  							       op0, t1),
  						NULL_RTX);
! 			    t3 = expand_shift (RSHIFT_EXPR, compute_mode, t2,
! 					       integer_one_node, NULL_RTX, 1);
  			    t4 = force_operand (gen_rtx_PLUS (compute_mode,
  							      t1, t3),
  						NULL_RTX);
  			    quotient = expand_shift
  			      (RSHIFT_EXPR, compute_mode, t4,
! 			       build_int_cst (NULL_TREE, post_shift - 1),
! 			       tquotient, 1);
  			  }
  			else
  			  {
--- 3988,4001 ----
  			    t2 = force_operand (gen_rtx_MINUS (compute_mode,
  							       op0, t1),
  						NULL_RTX);
! 			    t3 = expand_shift (RSHIFT_EXPR, compute_mode,
! 					       t2, 1, NULL_RTX, 1);
  			    t4 = force_operand (gen_rtx_PLUS (compute_mode,
  							      t1, t3),
  						NULL_RTX);
  			    quotient = expand_shift
  			      (RSHIFT_EXPR, compute_mode, t4,
! 			       post_shift - 1, tquotient, 1);
  			  }
  			else
  			  {
*************** expand_divmod (int rem_flag, enum tree_c
*** 4025,4032 ****
  
  			    t1 = expand_shift
  			      (RSHIFT_EXPR, compute_mode, op0,
! 			       build_int_cst (NULL_TREE, pre_shift),
! 			       NULL_RTX, 1);
  			    extra_cost
  			      = (shift_cost[speed][compute_mode][pre_shift]
  				 + shift_cost[speed][compute_mode][post_shift]);
--- 4007,4013 ----
  
  			    t1 = expand_shift
  			      (RSHIFT_EXPR, compute_mode, op0,
! 			       pre_shift, NULL_RTX, 1);
  			    extra_cost
  			      = (shift_cost[speed][compute_mode][pre_shift]
  				 + shift_cost[speed][compute_mode][post_shift]);
*************** expand_divmod (int rem_flag, enum tree_c
*** 4037,4044 ****
  			      goto fail1;
  			    quotient = expand_shift
  			      (RSHIFT_EXPR, compute_mode, t2,
! 			       build_int_cst (NULL_TREE, post_shift),
! 			       tquotient, 1);
  			  }
  		      }
  		  }
--- 4018,4024 ----
  			      goto fail1;
  			    quotient = expand_shift
  			      (RSHIFT_EXPR, compute_mode, t2,
! 			       post_shift, tquotient, 1);
  			  }
  		      }
  		  }
*************** expand_divmod (int rem_flag, enum tree_c
*** 4170,4181 ****
  			  goto fail1;
  			t2 = expand_shift
  			  (RSHIFT_EXPR, compute_mode, t1,
! 			   build_int_cst (NULL_TREE, post_shift),
! 			   NULL_RTX, 0);
  			t3 = expand_shift
  			  (RSHIFT_EXPR, compute_mode, op0,
! 			   build_int_cst (NULL_TREE, size - 1),
! 			   NULL_RTX, 0);
  			if (d < 0)
  			  quotient
  			    = force_operand (gen_rtx_MINUS (compute_mode,
--- 4150,4159 ----
  			  goto fail1;
  			t2 = expand_shift
  			  (RSHIFT_EXPR, compute_mode, t1,
! 			   post_shift, NULL_RTX, 0);
  			t3 = expand_shift
  			  (RSHIFT_EXPR, compute_mode, op0,
! 			   size - 1, NULL_RTX, 0);
  			if (d < 0)
  			  quotient
  			    = force_operand (gen_rtx_MINUS (compute_mode,
*************** expand_divmod (int rem_flag, enum tree_c
*** 4210,4221 ****
  					    NULL_RTX);
  			t3 = expand_shift
  			  (RSHIFT_EXPR, compute_mode, t2,
! 			   build_int_cst (NULL_TREE, post_shift),
! 			   NULL_RTX, 0);
  			t4 = expand_shift
  			  (RSHIFT_EXPR, compute_mode, op0,
! 			   build_int_cst (NULL_TREE, size - 1),
! 			   NULL_RTX, 0);
  			if (d < 0)
  			  quotient
  			    = force_operand (gen_rtx_MINUS (compute_mode,
--- 4188,4197 ----
  					    NULL_RTX);
  			t3 = expand_shift
  			  (RSHIFT_EXPR, compute_mode, t2,
! 			   post_shift, NULL_RTX, 0);
  			t4 = expand_shift
  			  (RSHIFT_EXPR, compute_mode, op0,
! 			   size - 1, NULL_RTX, 0);
  			if (d < 0)
  			  quotient
  			    = force_operand (gen_rtx_MINUS (compute_mode,
*************** expand_divmod (int rem_flag, enum tree_c
*** 4272,4279 ****
  		      }
  		    quotient = expand_shift
  		      (RSHIFT_EXPR, compute_mode, op0,
! 		       build_int_cst (NULL_TREE, pre_shift),
! 		       tquotient, 0);
  		  }
  		else
  		  {
--- 4248,4254 ----
  		      }
  		    quotient = expand_shift
  		      (RSHIFT_EXPR, compute_mode, op0,
! 		       pre_shift, tquotient, 0);
  		  }
  		else
  		  {
*************** expand_divmod (int rem_flag, enum tree_c
*** 4288,4295 ****
  		      {
  			t1 = expand_shift
  			  (RSHIFT_EXPR, compute_mode, op0,
! 			   build_int_cst (NULL_TREE, size - 1),
! 			   NULL_RTX, 0);
  			t2 = expand_binop (compute_mode, xor_optab, op0, t1,
  					   NULL_RTX, 0, OPTAB_WIDEN);
  			extra_cost = (shift_cost[speed][compute_mode][post_shift]
--- 4263,4269 ----
  		      {
  			t1 = expand_shift
  			  (RSHIFT_EXPR, compute_mode, op0,
! 			   size - 1, NULL_RTX, 0);
  			t2 = expand_binop (compute_mode, xor_optab, op0, t1,
  					   NULL_RTX, 0, OPTAB_WIDEN);
  			extra_cost = (shift_cost[speed][compute_mode][post_shift]
*************** expand_divmod (int rem_flag, enum tree_c
*** 4302,4309 ****
  			  {
  			    t4 = expand_shift
  			      (RSHIFT_EXPR, compute_mode, t3,
! 			       build_int_cst (NULL_TREE, post_shift),
! 			       NULL_RTX, 1);
  			    quotient = expand_binop (compute_mode, xor_optab,
  						     t4, t1, tquotient, 0,
  						     OPTAB_WIDEN);
--- 4276,4282 ----
  			  {
  			    t4 = expand_shift
  			      (RSHIFT_EXPR, compute_mode, t3,
! 			       post_shift, NULL_RTX, 1);
  			    quotient = expand_binop (compute_mode, xor_optab,
  						     t4, t1, tquotient, 0,
  						     OPTAB_WIDEN);
*************** expand_divmod (int rem_flag, enum tree_c
*** 4320,4327 ****
  				   0, OPTAB_WIDEN);
  		nsign = expand_shift
  		  (RSHIFT_EXPR, compute_mode, t2,
! 		   build_int_cst (NULL_TREE, size - 1),
! 		   NULL_RTX, 0);
  		t3 = force_operand (gen_rtx_MINUS (compute_mode, t1, nsign),
  				    NULL_RTX);
  		t4 = expand_divmod (0, TRUNC_DIV_EXPR, compute_mode, t3, op1,
--- 4293,4299 ----
  				   0, OPTAB_WIDEN);
  		nsign = expand_shift
  		  (RSHIFT_EXPR, compute_mode, t2,
! 		   size - 1, NULL_RTX, 0);
  		t3 = force_operand (gen_rtx_MINUS (compute_mode, t1, nsign),
  				    NULL_RTX);
  		t4 = expand_divmod (0, TRUNC_DIV_EXPR, compute_mode, t3, op1,
*************** expand_divmod (int rem_flag, enum tree_c
*** 4435,4442 ****
  		rtx t1, t2, t3;
  		unsigned HOST_WIDE_INT d = INTVAL (op1);
  		t1 = expand_shift (RSHIFT_EXPR, compute_mode, op0,
! 				   build_int_cst (NULL_TREE, floor_log2 (d)),
! 				   tquotient, 1);
  		t2 = expand_binop (compute_mode, and_optab, op0,
  				   GEN_INT (d - 1),
  				   NULL_RTX, 1, OPTAB_LIB_WIDEN);
--- 4407,4413 ----
  		rtx t1, t2, t3;
  		unsigned HOST_WIDE_INT d = INTVAL (op1);
  		t1 = expand_shift (RSHIFT_EXPR, compute_mode, op0,
! 				   floor_log2 (d), tquotient, 1);
  		t2 = expand_binop (compute_mode, and_optab, op0,
  				   GEN_INT (d - 1),
  				   NULL_RTX, 1, OPTAB_LIB_WIDEN);
*************** expand_divmod (int rem_flag, enum tree_c
*** 4533,4540 ****
  		rtx t1, t2, t3;
  		unsigned HOST_WIDE_INT d = INTVAL (op1);
  		t1 = expand_shift (RSHIFT_EXPR, compute_mode, op0,
! 				   build_int_cst (NULL_TREE, floor_log2 (d)),
! 				   tquotient, 0);
  		t2 = expand_binop (compute_mode, and_optab, op0,
  				   GEN_INT (d - 1),
  				   NULL_RTX, 1, OPTAB_LIB_WIDEN);
--- 4504,4510 ----
  		rtx t1, t2, t3;
  		unsigned HOST_WIDE_INT d = INTVAL (op1);
  		t1 = expand_shift (RSHIFT_EXPR, compute_mode, op0,
! 				   floor_log2 (d), tquotient, 0);
  		t2 = expand_binop (compute_mode, and_optab, op0,
  				   GEN_INT (d - 1),
  				   NULL_RTX, 1, OPTAB_LIB_WIDEN);
*************** expand_divmod (int rem_flag, enum tree_c
*** 4655,4662 ****
  	    pre_shift = floor_log2 (d & -d);
  	    ml = invert_mod2n (d >> pre_shift, size);
  	    t1 = expand_shift (RSHIFT_EXPR, compute_mode, op0,
! 			       build_int_cst (NULL_TREE, pre_shift),
! 			       NULL_RTX, unsignedp);
  	    quotient = expand_mult (compute_mode, t1,
  				    gen_int_mode (ml, compute_mode),
  				    NULL_RTX, 1);
--- 4625,4631 ----
  	    pre_shift = floor_log2 (d & -d);
  	    ml = invert_mod2n (d >> pre_shift, size);
  	    t1 = expand_shift (RSHIFT_EXPR, compute_mode, op0,
! 			       pre_shift, NULL_RTX, unsignedp);
  	    quotient = expand_mult (compute_mode, t1,
  				    gen_int_mode (ml, compute_mode),
  				    NULL_RTX, 1);
*************** expand_divmod (int rem_flag, enum tree_c
*** 4689,4696 ****
  					  remainder, 1, OPTAB_LIB_WIDEN);
  	      }
  	    tem = plus_constant (op1, -1);
! 	    tem = expand_shift (RSHIFT_EXPR, compute_mode, tem,
! 				integer_one_node, NULL_RTX, 1);
  	    do_cmp_and_jump (remainder, tem, LEU, compute_mode, label);
  	    expand_inc (quotient, const1_rtx);
  	    expand_dec (remainder, op1);
--- 4658,4664 ----
  					  remainder, 1, OPTAB_LIB_WIDEN);
  	      }
  	    tem = plus_constant (op1, -1);
! 	    tem = expand_shift (RSHIFT_EXPR, compute_mode, tem, 1, NULL_RTX, 1);
  	    do_cmp_and_jump (remainder, tem, LEU, compute_mode, label);
  	    expand_inc (quotient, const1_rtx);
  	    expand_dec (remainder, op1);
*************** expand_divmod (int rem_flag, enum tree_c
*** 4715,4727 ****
  	    abs_rem = expand_abs (compute_mode, remainder, NULL_RTX, 1, 0);
  	    abs_op1 = expand_abs (compute_mode, op1, NULL_RTX, 1, 0);
  	    tem = expand_shift (LSHIFT_EXPR, compute_mode, abs_rem,
! 				integer_one_node, NULL_RTX, 1);
  	    do_cmp_and_jump (tem, abs_op1, LTU, compute_mode, label);
  	    tem = expand_binop (compute_mode, xor_optab, op0, op1,
  				NULL_RTX, 0, OPTAB_WIDEN);
  	    mask = expand_shift (RSHIFT_EXPR, compute_mode, tem,
! 				 build_int_cst (NULL_TREE, size - 1),
! 				 NULL_RTX, 0);
  	    tem = expand_binop (compute_mode, xor_optab, mask, const1_rtx,
  				NULL_RTX, 0, OPTAB_WIDEN);
  	    tem = expand_binop (compute_mode, sub_optab, tem, mask,
--- 4683,4694 ----
  	    abs_rem = expand_abs (compute_mode, remainder, NULL_RTX, 1, 0);
  	    abs_op1 = expand_abs (compute_mode, op1, NULL_RTX, 1, 0);
  	    tem = expand_shift (LSHIFT_EXPR, compute_mode, abs_rem,
! 				1, NULL_RTX, 1);
  	    do_cmp_and_jump (tem, abs_op1, LTU, compute_mode, label);
  	    tem = expand_binop (compute_mode, xor_optab, op0, op1,
  				NULL_RTX, 0, OPTAB_WIDEN);
  	    mask = expand_shift (RSHIFT_EXPR, compute_mode, tem,
! 				 size - 1, NULL_RTX, 0);
  	    tem = expand_binop (compute_mode, xor_optab, mask, const1_rtx,
  				NULL_RTX, 0, OPTAB_WIDEN);
  	    tem = expand_binop (compute_mode, sub_optab, tem, mask,
*************** emit_cstore (rtx target, enum insn_code
*** 5090,5096 ****
  	   && (STORE_FLAG_VALUE
  	       & ((HOST_WIDE_INT) 1 << (GET_MODE_BITSIZE (result_mode) - 1))))
      op0 = expand_shift (RSHIFT_EXPR, result_mode, op0,
! 			size_int (GET_MODE_BITSIZE (result_mode) - 1), subtarget,
  			normalizep == 1);
    else
      {
--- 5057,5063 ----
  	   && (STORE_FLAG_VALUE
  	       & ((HOST_WIDE_INT) 1 << (GET_MODE_BITSIZE (result_mode) - 1))))
      op0 = expand_shift (RSHIFT_EXPR, result_mode, op0,
! 			GET_MODE_BITSIZE (result_mode) - 1, subtarget,
  			normalizep == 1);
    else
      {
*************** emit_store_flag_1 (rtx target, enum rtx_
*** 5270,5276 ****
  	   a logical shift from the sign bit to the low-order bit; for
  	   a -1/0 value, we do an arithmetic shift.  */
  	op0 = expand_shift (RSHIFT_EXPR, mode, op0,
! 			    size_int (GET_MODE_BITSIZE (mode) - 1),
  			    subtarget, normalizep != -1);
  
        if (mode != target_mode)
--- 5237,5243 ----
  	   a logical shift from the sign bit to the low-order bit; for
  	   a -1/0 value, we do an arithmetic shift.  */
  	op0 = expand_shift (RSHIFT_EXPR, mode, op0,
! 			    GET_MODE_BITSIZE (mode) - 1,
  			    subtarget, normalizep != -1);
  
        if (mode != target_mode)
*************** emit_store_flag (rtx target, enum rtx_co
*** 5555,5561 ****
  	subtarget = 0;
  
        tem = expand_shift (RSHIFT_EXPR, mode, op0,
! 			  size_int (GET_MODE_BITSIZE (mode) - 1),
  			  subtarget, 0);
        tem = expand_binop (mode, sub_optab, tem, op0, subtarget, 0,
  			  OPTAB_WIDEN);
--- 5522,5528 ----
  	subtarget = 0;
  
        tem = expand_shift (RSHIFT_EXPR, mode, op0,
! 			  GET_MODE_BITSIZE (mode) - 1,
  			  subtarget, 0);
        tem = expand_binop (mode, sub_optab, tem, op0, subtarget, 0,
  			  OPTAB_WIDEN);
*************** emit_store_flag (rtx target, enum rtx_co
*** 5621,5627 ****
  
    if (tem && normalizep)
      tem = expand_shift (RSHIFT_EXPR, mode, tem,
! 			size_int (GET_MODE_BITSIZE (mode) - 1),
  			subtarget, normalizep == 1);
  
    if (tem)
--- 5588,5594 ----
  
    if (tem && normalizep)
      tem = expand_shift (RSHIFT_EXPR, mode, tem,
! 			GET_MODE_BITSIZE (mode) - 1,
  			subtarget, normalizep == 1);
  
    if (tem)
Index: gcc/builtins.c
===================================================================
*** gcc/builtins.c	(revision 173151)
--- gcc/builtins.c	(working copy)
*************** expand_builtin_signbit (tree exp, rtx ta
*** 5423,5430 ****
        /* Perform a logical right shift to place the signbit in the least
  	 significant bit, then truncate the result to the desired mode
  	 and mask just this bit.  */
!       temp = expand_shift (RSHIFT_EXPR, imode, temp,
! 			   build_int_cst (NULL_TREE, bitpos), NULL_RTX, 1);
        temp = gen_lowpart (rmode, temp);
        temp = expand_binop (rmode, and_optab, temp, const1_rtx,
  			   NULL_RTX, 1, OPTAB_LIB_WIDEN);
--- 5423,5429 ----
        /* Perform a logical right shift to place the signbit in the least
  	 significant bit, then truncate the result to the desired mode
  	 and mask just this bit.  */
!       temp = expand_shift (RSHIFT_EXPR, imode, temp, bitpos, NULL_RTX, 1);
        temp = gen_lowpart (rmode, temp);
        temp = expand_binop (rmode, and_optab, temp, const1_rtx,
  			   NULL_RTX, 1, OPTAB_LIB_WIDEN);
Index: gcc/calls.c
===================================================================
*** gcc/calls.c	(revision 173151)
--- gcc/calls.c	(working copy)
*************** load_register_parameters (struct arg_dat
*** 1668,1676 ****
  		     call only uses SIZE bytes at the msb end, but it doesn't
  		     seem worth generating rtl to say that.  */
  		  reg = gen_rtx_REG (word_mode, REGNO (reg));
! 		  x = expand_shift (LSHIFT_EXPR, word_mode, reg,
! 				    build_int_cst (NULL_TREE, shift),
! 				    reg, 1);
  		  if (x != reg)
  		    emit_move_insn (reg, x);
  		}
--- 1668,1674 ----
  		     call only uses SIZE bytes at the msb end, but it doesn't
  		     seem worth generating rtl to say that.  */
  		  reg = gen_rtx_REG (word_mode, REGNO (reg));
! 		  x = expand_shift (LSHIFT_EXPR, word_mode, reg, shift, reg, 1);
  		  if (x != reg)
  		    emit_move_insn (reg, x);
  		}
*************** load_register_parameters (struct arg_dat
*** 1714,1722 ****
  							: LSHIFT_EXPR;
  
  		  emit_move_insn (x, tem);
! 		  x = expand_shift (dir, word_mode, x,
! 				    build_int_cst (NULL_TREE, shift),
! 				    ri, 1);
  		  if (x != ri)
  		    emit_move_insn (ri, x);
  		}
--- 1712,1718 ----
  							: LSHIFT_EXPR;
  
  		  emit_move_insn (x, tem);
! 		  x = expand_shift (dir, word_mode, x, shift, ri, 1);
  		  if (x != ri)
  		    emit_move_insn (ri, x);
  		}
Index: gcc/function.c
===================================================================
*** gcc/function.c	(revision 173151)
--- gcc/function.c	(working copy)
*************** assign_parm_setup_block (struct assign_p
*** 2876,2884 ****
  	      int by = (UNITS_PER_WORD - size) * BITS_PER_UNIT;
  	      rtx reg = gen_rtx_REG (word_mode, REGNO (entry_parm));
  
! 	      x = expand_shift (LSHIFT_EXPR, word_mode, reg,
! 				build_int_cst (NULL_TREE, by),
! 				NULL_RTX, 1);
  	      tem = change_address (mem, word_mode, 0);
  	      emit_move_insn (tem, x);
  	    }
--- 2876,2882 ----
  	      int by = (UNITS_PER_WORD - size) * BITS_PER_UNIT;
  	      rtx reg = gen_rtx_REG (word_mode, REGNO (entry_parm));
  
! 	      x = expand_shift (LSHIFT_EXPR, word_mode, reg, by, NULL_RTX, 1);
  	      tem = change_address (mem, word_mode, 0);
  	      emit_move_insn (tem, x);
  	    }
Index: gcc/lower-subreg.c
===================================================================
*** gcc/lower-subreg.c	(revision 173151)
--- gcc/lower-subreg.c	(working copy)
*************** resolve_shift_zext (rtx insn)
*** 1039,1046 ****
  	src_reg = expand_shift (GET_CODE (op) == ASHIFT ?
  				LSHIFT_EXPR : RSHIFT_EXPR,
  				word_mode, src_reg,
! 				build_int_cst (NULL_TREE,
! 					       shift_count - BITS_PER_WORD),
  				dest_reg, 1);
      }
  
--- 1039,1045 ----
  	src_reg = expand_shift (GET_CODE (op) == ASHIFT ?
  				LSHIFT_EXPR : RSHIFT_EXPR,
  				word_mode, src_reg,
! 				shift_count - BITS_PER_WORD,
  				dest_reg, 1);
      }
  
Index: gcc/optabs.c
===================================================================
*** gcc/optabs.c	(revision 173151)
--- gcc/optabs.c	(working copy)
*************** widen_bswap (enum machine_mode mode, rtx
*** 2453,2460 ****
  
    if (x != 0)
      x = expand_shift (RSHIFT_EXPR, wider_mode, x,
! 		      size_int (GET_MODE_BITSIZE (wider_mode)
! 			        - GET_MODE_BITSIZE (mode)),
  		      NULL_RTX, true);
  
    if (x != 0)
--- 2453,2460 ----
  
    if (x != 0)
      x = expand_shift (RSHIFT_EXPR, wider_mode, x,
! 		      GET_MODE_BITSIZE (wider_mode)
! 		      - GET_MODE_BITSIZE (mode),
  		      NULL_RTX, true);
  
    if (x != 0)
*************** expand_abs_nojump (enum machine_mode mod
*** 3150,3156 ****
  	      	      false) >= 2)
      {
        rtx extended = expand_shift (RSHIFT_EXPR, mode, op0,
! 				   size_int (GET_MODE_BITSIZE (mode) - 1),
  				   NULL_RTX, 0);
  
        temp = expand_binop (mode, xor_optab, extended, op0, target, 0,
--- 3150,3156 ----
  	      	      false) >= 2)
      {
        rtx extended = expand_shift (RSHIFT_EXPR, mode, op0,
! 				   GET_MODE_BITSIZE (mode) - 1,
  				   NULL_RTX, 0);
  
        temp = expand_binop (mode, xor_optab, extended, op0, target, 0,
*************** expand_one_cmpl_abs_nojump (enum machine
*** 3251,3257 ****
  	             false) >= 2)
      {
        rtx extended = expand_shift (RSHIFT_EXPR, mode, op0,
! 				   size_int (GET_MODE_BITSIZE (mode) - 1),
  				   NULL_RTX, 0);
  
        temp = expand_binop (mode, xor_optab, extended, op0, target, 0,
--- 3251,3257 ----
  	             false) >= 2)
      {
        rtx extended = expand_shift (RSHIFT_EXPR, mode, op0,
! 				   GET_MODE_BITSIZE (mode) - 1,
  				   NULL_RTX, 0);
  
        temp = expand_binop (mode, xor_optab, extended, op0, target, 0,
*************** expand_float (rtx to, rtx from, int unsi
*** 4724,4731 ****
  	      emit_label (neglabel);
  	      temp = expand_binop (imode, and_optab, from, const1_rtx,
  				   NULL_RTX, 1, OPTAB_LIB_WIDEN);
! 	      temp1 = expand_shift (RSHIFT_EXPR, imode, from, integer_one_node,
! 				    NULL_RTX, 1);
  	      temp = expand_binop (imode, ior_optab, temp, temp1, temp, 1,
  				   OPTAB_LIB_WIDEN);
  	      expand_float (target, temp, 0);
--- 4724,4730 ----
  	      emit_label (neglabel);
  	      temp = expand_binop (imode, and_optab, from, const1_rtx,
  				   NULL_RTX, 1, OPTAB_LIB_WIDEN);
! 	      temp1 = expand_shift (RSHIFT_EXPR, imode, from, 1, NULL_RTX, 1);
  	      temp = expand_binop (imode, ior_optab, temp, temp1, temp, 1,
  				   OPTAB_LIB_WIDEN);
  	      expand_float (target, temp, 0);
Index: gcc/config/spu/spu.c
===================================================================
*** gcc/config/spu/spu.c	(revision 173151)
--- gcc/config/spu/spu.c	(working copy)
*************** spu_expand_extv (rtx ops[], int unsigned
*** 748,757 ****
      emit_insn (gen_rotlti3 (s0, s0, GEN_INT (start)));
  
    if (128 - width)
!     {
!       tree c = build_int_cst (NULL_TREE, 128 - width);
!       s0 = expand_shift (RSHIFT_EXPR, TImode, s0, c, s0, unsignedp);
!     }
  
    emit_move_insn (dst, s0);
  }
--- 748,754 ----
      emit_insn (gen_rotlti3 (s0, s0, GEN_INT (start)));
  
    if (128 - width)
!     s0 = expand_shift (RSHIFT_EXPR, TImode, s0, 128 - width, s0, unsignedp);
  
    emit_move_insn (dst, s0);
  }
Index: gcc/config/sparc/sparc.c
===================================================================
*** gcc/config/sparc/sparc.c	(revision 173151)
--- gcc/config/sparc/sparc.c	(working copy)
*************** sparc32_initialize_trampoline (rtx m_tra
*** 7836,7851 ****
    emit_move_insn
      (adjust_address (m_tramp, SImode, 0),
       expand_binop (SImode, ior_optab,
! 		   expand_shift (RSHIFT_EXPR, SImode, fnaddr,
! 				 size_int (10), 0, 1),
  		   GEN_INT (trunc_int_for_mode (0x03000000, SImode)),
  		   NULL_RTX, 1, OPTAB_DIRECT));
  
    emit_move_insn
      (adjust_address (m_tramp, SImode, 4),
       expand_binop (SImode, ior_optab,
! 		   expand_shift (RSHIFT_EXPR, SImode, cxt,
! 				 size_int (10), 0, 1),
  		   GEN_INT (trunc_int_for_mode (0x05000000, SImode)),
  		   NULL_RTX, 1, OPTAB_DIRECT));
  
--- 7836,7849 ----
    emit_move_insn
      (adjust_address (m_tramp, SImode, 0),
       expand_binop (SImode, ior_optab,
! 		   expand_shift (RSHIFT_EXPR, SImode, fnaddr, 10, 0, 1),
  		   GEN_INT (trunc_int_for_mode (0x03000000, SImode)),
  		   NULL_RTX, 1, OPTAB_DIRECT));
  
    emit_move_insn
      (adjust_address (m_tramp, SImode, 4),
       expand_binop (SImode, ior_optab,
! 		   expand_shift (RSHIFT_EXPR, SImode, cxt, 10, 0, 1),
  		   GEN_INT (trunc_int_for_mode (0x05000000, SImode)),
  		   NULL_RTX, 1, OPTAB_DIRECT));
  


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