public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jeff Law <law@redhat.com>
To: Prathamesh Kulkarni <prathamesh.kulkarni@linaro.org>,
	       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: Mon, 17 Oct 2016 21:16:00 -0000	[thread overview]
Message-ID: <aac42bd1-78e7-9be9-fa01-2aa5f4dbe30b@redhat.com> (raw)
In-Reply-To: <CAAgBjMkqv15VNxN17v9WUeNTU5OgZ3bAmzJQ+u3hHaGbevsVOg@mail.gmail.com>

On 10/15/2016 11:59 PM, Prathamesh Kulkarni wrote:
> This patch is mostly the same as previous one, except it drops
> targeting __udivmoddi4() because it gave undefined reference link
> error for calling __udivmoddi4() on aarch64-linux-gnu. It appears
> aarch64 has hardware insn for DImode div, so __udivmoddi4() isn't
> needed for the target (it was a bug in my patch that called
> __udivmoddi4() even though aarch64 supported hardware div).
This touches on the one high level question I had.  Namely what is the 
code generation strategy if the hardware has a div, but not divmod.

ISTM in that case I think we want to use the div instruction and 
synthesize mod from that result rather than relying on a software 
divmod.  So it looks like you ought to be doing the right thing for that 
case now based on your comment above.
>
> However this makes me wonder if it's guaranteed that __udivmoddi4()
> will be available for a target if it doesn't have hardware div and
> divmod insn and doesn't have target-specific libfunc for DImode
> divmod ? To be conservative, the attached patch doesn't generate call
> to __udivmoddi4.
I don't think that's a safe assumption.  Addition of the divmod routines 
into libgcc is controlled by the target and have to be explicitly added 
AFAICT.

So on a target like the fr30 which has no div or mod insn and doesn't 
define the right bits in libgcc, there is no divmod libcall available. 
(On these targets there's a div libcall and a mod libcall, but not a 
combined one).

I don't even think we have a way of knowing in the compiler if the 
target has enabled divmod support in libgcc.

ISTM that for now we have to limit to cases where we have a divmod 
insn/libcall defined.

jeff

  parent reply	other threads:[~2016-10-17 21:16 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 [this message]
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
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=aac42bd1-78e7-9be9-fa01-2aa5f4dbe30b@redhat.com \
    --to=law@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jim.wilson@linaro.org \
    --cc=kugan.vivekanandarajah@linaro.org \
    --cc=prathamesh.kulkarni@linaro.org \
    --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).