From: Prathamesh Kulkarni <prathamesh.kulkarni@linaro.org>
To: Jeff Law <law@redhat.com>
Cc: gcc Patches <gcc-patches@gcc.gnu.org>,
Richard Biener <rguenther@suse.de>,
Kugan <kugan.vivekanandarajah@linaro.org>,
Jim Wilson <jim.wilson@linaro.org>
Subject: Re: RFC [1/3] divmod transform v2
Date: Wed, 19 Oct 2016 03:31:00 -0000 [thread overview]
Message-ID: <CAAgBjMnoXPkudeR_vYqGnsFeF8NGkD6k9MSWKo3CUUOJU4wCMQ@mail.gmail.com> (raw)
In-Reply-To: <cb43e92a-fcc4-b3cd-b0f4-f7539226c3e9@redhat.com>
On 19 October 2016 at 03:03, Jeff Law <law@redhat.com> wrote:
> On 10/17/2016 11:23 PM, Prathamesh Kulkarni wrote:
>>
>> The divmod transform isn't enabled if target supports hardware div in
>> the same or wider mode even if divmod libfunc is available for the
>> given mode.
>
> Good. That seems like the right thing to do.
>
>> Thanks. I had erroneously assumed __udivimoddi4() was available for
>> all targets because it was defined in libgcc2.c and generated call to
>> it as "last resort" for unsigned DImode case if target didn't support
>> hardware div and divmod insn and didn't have target-specific divmod
>> libfunc for DImode. The reason why it generated undefined reference
>> on aarch64-linux-gnu was because I didn't properly check in the patch
>> if target supported hardware div, and ended up generating call to
>> __udivmoddi4() even though aarch64 has hardware div. I rectified
>> that before posting the patch.
>
> Understood. From a design standpoint, it seems to me like the path where we
> emit a call to udivmod without knowing if its supported by libgcc is broken.
> But if I understand correctly, that's not affected by your changes -- it's
> simply a historical poor decision.
Err no, that poor decision was entirely mine -;) I had wrongly
assumed __udivmoddi4 to be always available
and got surprised when it gave undefined reference error on aarch64
and hence brought it up for discussion.
I removed those parts of the patch that generated call to
__udivmoddi4() before posting the patch upstream.
>
>>>
>>> I don't even think we have a way of knowing in the compiler if the
>>> target has enabled divmod support in libgcc.
>>
>> Well the arm and c6x backends register target-specific divmod libfunc
>> via set_optab_libfunc(). I suppose that's sufficient to know if
>> target has divmod enabled in libgcc ?
>
> It's probably a pretty reasonable assumption that if the target has
> registered a libfunc, the the libfunc ought to be available.
>
>>>
>>> ISTM that for now we have to limit to cases where we have a divmod
>>> insn/libcall defined.
>>
>> Indeed. The transform is enabled only if the target has hardware
>> divmod insn or divmod libfunc (in the libfunc case, no hardware div
>> insn). Please see divmod_candidate_p() in the patch for cases when
>> the transform gets enabled.
>
> Great. Thanks. Hoping to make some progress on the actual patch in the
> next couple days.
Thanks!
Regards,
Prathamesh
>
> jeff
next prev parent reply other threads:[~2016-10-19 3:31 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-10-16 5:59 Prathamesh Kulkarni
2016-10-16 8:38 ` Prathamesh Kulkarni
2016-10-17 21:16 ` Jeff Law
2016-10-18 5:23 ` Prathamesh Kulkarni
2016-10-18 8:26 ` Richard Biener
2016-10-18 8:29 ` Prathamesh Kulkarni
2016-10-18 17:08 ` Jeff Law
2016-10-18 21:33 ` Jeff Law
2016-10-19 3:31 ` Prathamesh Kulkarni [this message]
2016-10-19 19:57 ` Jeff Law
2016-10-20 9:32 ` Richard Biener
2016-10-21 10:35 ` Prathamesh Kulkarni
2016-10-21 20:44 ` Jeff Law
2016-10-24 7:28 ` Richard Biener
2016-10-24 14:53 ` Jeff Law
2016-10-24 15:35 ` Prathamesh Kulkarni
2016-10-24 18:36 ` Jeff Law
2016-10-21 17:50 ` Jeff Law
2016-10-25 8:13 ` Richard Biener
2016-10-25 10:34 ` Prathamesh Kulkarni
2016-10-25 10:48 ` Richard Biener
2016-10-25 12:14 ` Prathamesh Kulkarni
2016-10-25 13:17 ` Richard Biener
2016-10-26 10:17 ` Prathamesh Kulkarni
2016-10-26 10:47 ` Richard Biener
2016-10-28 19:10 ` Prathamesh Kulkarni
2017-01-02 15:07 ` Martin Liška
2017-01-02 19:24 ` Prathamesh Kulkarni
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAAgBjMnoXPkudeR_vYqGnsFeF8NGkD6k9MSWKo3CUUOJU4wCMQ@mail.gmail.com \
--to=prathamesh.kulkarni@linaro.org \
--cc=gcc-patches@gcc.gnu.org \
--cc=jim.wilson@linaro.org \
--cc=kugan.vivekanandarajah@linaro.org \
--cc=law@redhat.com \
--cc=rguenther@suse.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).