public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: Andrew Stubbs <ams@codesourcery.com>
To: Richard Biener <richard.guenther@gmail.com>
Cc: GCC Development <gcc@gcc.gnu.org>
Subject: Re: Libgcc divide vectorization question
Date: Wed, 22 Mar 2023 11:02:44 +0000	[thread overview]
Message-ID: <7f227691-7c3d-599b-ed24-6fde2ce3c11d@codesourcery.com> (raw)
In-Reply-To: <CAFiYyc3Mt3apecNwuk3iLTR5GS_DaJ6r=Uw+bsWGS7x1Wh+jZA@mail.gmail.com>

On 22/03/2023 10:09, Richard Biener wrote:
> On Tue, Mar 21, 2023 at 6:00 PM Andrew Stubbs <ams@codesourcery.com> wrote:
>>
>> Hi all,
>>
>> I want to be able to vectorize divide operators (softfp and integer),
>> but amdgcn only has hardware instructions suitable for -ffast-math.
>>
>> We have recently implemented vector versions of all the libm functions,
>> but the libgcc functions aren't builtins and therefore don't use those
>> hooks.
>>
>> What's the best way to achieve this? Add a new __builtin_div (and
>> __builtin_mod) that tree-vectorize can find, perhaps? Or something else?
> 
> What do you want to do?  Vectorize the out-of-line libgcc copy?  Or
> emit inline vectorized code for int/softfp operations?  In the latter
> case just emit the code from the pattern expanders?

I'd like to investigate having vectorized versions of the libgcc 
instruction functions, like we do for libm.

The inline code expansion is certainly an option, but I think there's 
quite a lot of code in those routines. I know how to do that option at 
least (except, maybe not the errno handling without making assumptions 
about the C runtime).

Basically, the -ffast-math instructions will always be the fastest way, 
but the goal is that the default optimization shouldn't just disable 
vectorization entirely for any loop that has a divide in it.

Andrew

  reply	other threads:[~2023-03-22 11:02 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-21 16:59 Andrew Stubbs
2023-03-22 10:09 ` Richard Biener
2023-03-22 11:02   ` Andrew Stubbs [this message]
2023-03-22 13:56     ` Richard Biener
2023-03-22 15:57       ` Andrew Stubbs
2023-03-23  7:24         ` Richard Biener

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=7f227691-7c3d-599b-ed24-6fde2ce3c11d@codesourcery.com \
    --to=ams@codesourcery.com \
    --cc=gcc@gcc.gnu.org \
    --cc=richard.guenther@gmail.com \
    /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).