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: [PATCH] Improved signed integer remainder by power of two


On Sun, Jun 27, 2004 at 07:23:31PM -0600, Roger Sayle wrote:
> +       && ashr_optab->handlers[mode].insn_code != CODE_FOR_nothing)
> +     {
> +       rtx signmask = expand_binop (mode, ashr_optab, op0,
> + 				   GEN_INT (GET_MODE_BITSIZE (mode) - 1),
> + 				   NULL_RTX, 0, OPTAB_LIB_WIDEN);
> +       signmask = force_reg (mode, signmask);

I might think this would be better as 

	emit_store_flag (NULL_RTX, LT, op0, const0_rtx, mode, 0, -1);

Doh, except emit_store_flag does not, as I hoped, check to see 
which of the following is cheapest.

	(neg:SI (lt:SI x 0))	// STORE_FLAG_VALUE = 1
	(lt:SI x 0)		// STORE_FLAG_VALUE = -1
	(ashiftrt:SI x 31)

Still, without updating emit_store_flag, you should get the same
results you do now, and it consolidates that knowledge should it
ever be added.


Otherwise it looks good.



r~


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