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: pr26026: udiv and umod optimization


On Mon, Feb 06, 2006 at 11:26:29AM -0700, Jeffrey A Law wrote:
> On Sun, 2006-02-05 at 13:03 +1030, Alan Modra wrote:
> >           pat1 = reg->node[i].state % ((MAX_UNSIGNED) 1 << width);
> I'll note that this is something VRP is supposed to handle (the code
> was moved from DOM into VRP a while back).
> 
> VRP should be performing two closely related transformations:
> 
> TRUNC_DIV_EXPR -> RSHIFT_EXPR
> TRUNC_MOD_EXPR -> BIT_AND_EXPR
> 
> We basically require that the first operand be > 0 (which can 
> be derived from the type of propagating range info) and the second
> operand be a power of two (see simplify_stmt_using_ranges).
> 
> So, if VRP isn't performing this transformation on the testcase
> in question, I'd really like to know why.

VRP simplifies cases where the divisor is a constant power of two.  In
this testcase, we have a divisor which is a non-constant power of two.
(It's a constant power of two shifted left a variable amount.)

-- 
Alan Modra
IBM OzLabs - Linux Technology Centre


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