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]

Re: [2/4] Use tree_to_uhwi when folding (x >> c) << c


On 11/19/13 05:00, Richard Sandiford wrote:
The (x >> c) << c folding has:

	  && tree_fits_shwi_p (arg1)
	  && TREE_INT_CST_LOW (arg1) < prec
	  && tree_fits_shwi_p (TREE_OPERAND (arg0, 1))
	  && TREE_INT_CST_LOW (TREE_OPERAND (arg0, 1)) < prec)

At first glance the use of tree_fits_shwi_p rather than tree_fits_uhwi_p
made me think this allows negative shift counts, but of course TREE_INT_CST_LOW
is unsigned.  I think it'd be clearer to use tree_fits_uhwi_p instead.

Thanks,
Richard


gcc/
	* fold-const.c (fold_binary_loc): Use unsigned rather than signed
	HOST_WIDE_INTs when folding (x >> c) << c.
OK.
jeff


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