On 2 January 2017 at 20:37, Martin Liška <mli...@suse.cz> wrote: > On 10/16/2016 07:59 AM, Prathamesh Kulkarni wrote: >> + /* Disable the transform if either is a constant, since >> division-by-constant >> + may have specialized expansion. */ >> + if (CONSTANT_CLASS_P (op1) || CONSTANT_CLASS_P (op2)) >> + return false; > > Hello. > > I've just played a bit with DIVMOD and realized that the DIVMOD optimization > is > disable when either op1 or op2 are constant. Aforementioned hunk contains a > bit strange > comment, where one is not sure that the condition is intentional? Well, since expand_divmod() has specialized expansions for division/mod for few constants, the divmod transform is disabled if one of it's operands is constant. I suppose the check could be made more precise by tracking cases that are handled specially by expand_divmod, but I didn't have a look at that, and simply disabled the transform if one of the operands is a constant.
Thanks, Prathamesh > > Thanks for clarification. > Martin