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: RFC [1/3] divmod transform v2


On 24 October 2016 at 20:23, Jeff Law <law@redhat.com> wrote:
> On 10/24/2016 01:28 AM, Richard Biener wrote:
> [ big snip ]
>
>
>>>>>>
>>>>>>> +
>>>>>>> +  /* Update all statements in stmts.
>>>>>>> +     if stmt is lhs = op1 TRUNC_DIV_EXPR op2, change to lhs =
>>>>>>> REALPART_EXPR<divmod_tmp>
>>>>>>> +     if stmt is lhs = op1 TRUNC_MOD_EXPR op2, change to lhs =
>>>>>>> IMAGPART_EXPR<divmod_tmp>.  */
>>>>>>
>>>>>> I'd just emit a copy from RES to the appropriate lhs operand just
>>>>>> after
>>>>>> the
>>>>>> divmod and delete the now unnecessary TRUNC_DIV_EXPR and
>>>>>> TRUNC_MOD_EXPR
>>>>>> statements.
>>>>>
>>>>>
>>>>> That sounds like a good idea.
>>>>
>>>> Um sorry, not sure if I understood this part.
>>>> For eg:
>>>> t1 = x / y;
>>>> t2 = x % y;
>>>>
>>>> do we want to transform it to:
>>>> complex_tmp = DIVMOD (x, y);
>>>> div_tmp = REALPART_EXPR<complex_tmp>
>>>> mod_tmp = IMAGPART_EXPR<complex_tmp>
>>>
>>>
>>> complex_tmp = DIVMOD (x, y)
>>> t1 = REALPART_EXPR (complex_tmp)
>>> t2 = IMAGPART_EXPR (compex_tmp)
>>>
>>> Then remove the
>>> t1 = x/y
>>> t2 = x%y
>>>
>>>  statements
>>
>>
>> OTOH implementation-wise that's more complicated.
>
> If so, then I wouldn't bother.  I only mention it because I've found that
> model is sometimes easier on the implementation side.  I don't consider it a
> big deal.
Richard and Jeff,
Unless you have any further suggestions on the patch, should I
consider it approved (modulo formatting fixes) ?
I can confirm that the optab_libfunc() issue is solved at least for
the divmod transform with the patch to remove
optab functions for sdivmod_optab and udivmod_optab.

Thanks,
Prathamesh
>
> jeff


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