public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jeff Law <jeffreyalaw@gmail.com>
To: Richard Biener <rguenther@suse.de>
Cc: gcc-patches@gcc.gnu.org, richard.sandiford@arm.com
Subject: Re: [PATCH] tree-optimization/108724 - vectorized code getting piecewise expanded
Date: Mon, 13 Feb 2023 09:05:05 -0700	[thread overview]
Message-ID: <67a16242-bc88-4ca1-b8b5-432fbafd0330@gmail.com> (raw)
In-Reply-To: <nycvar.YFH.7.77.849.2302131450260.9226@jbgna.fhfr.qr>



On 2/13/23 07:51, Richard Biener wrote:
> On Mon, 13 Feb 2023, Jeff Law wrote:
> 
>>
>>
>> On 2/10/23 04:02, Richard Biener via Gcc-patches wrote:
>>> This fixes an oversight to when removing the hard limits on using
>>> generic vectors for the vectorizer to enable both SLP and BB
>>> vectorization to use those.  The vectorizer relies on vector lowering
>>> to expand plus, minus and negate to bit operations but vector
>>> lowering has a hard limit on the minimum number of elements per
>>> work item.  Vectorizer costs for the testcase at hand work out
>>> to vectorize a loop with just two work items per vector and that
>>> causes element wise expansion and spilling.
>>>
>>> The fix for now is to re-instantiate the hard limit, matching what
>>> vector lowering does.  For the future the way to go is to emit the
>>> lowered sequence directly from the vectorizer instead.
>>>
>>> Bootstrapped and tested on x86_64-unknown-linux-gnu, OK?
>>>
>>> Thanks,
>>> Richard.
>>>
>>>   PR tree-optimization/108724
>>>   * tree-vect-stmts.cc (vectorizable_operation): Avoid
>>>   using word_mode vectors when vector lowering will
>>>   decompose them to elementwise operations.
>>>
>>>   * gcc.target/i386/pr108724.c: New testcase.
>> OK.  Though can't this be a problem with logicals too?  Or is there something
>> special about +- going on here?
> 
> Logical ops do not cross lanes even when using scalar operations on GPRs.
> For +- you have to compute the MSB separately to avoid spilling over to
> the next vector lane.
Oh, yes, makes perfect sense.

jeff

  reply	other threads:[~2023-02-13 16:05 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20230210110247.514FA385B53C@sourceware.org>
2023-02-13 14:39 ` Jeff Law
2023-02-13 14:51   ` Richard Biener
2023-02-13 16:05     ` Jeff Law [this message]
     [not found] <20230210110251.62A5B385B52C@sourceware.org>
2023-02-10 11:18 ` Richard Sandiford
2023-02-10 11:21   ` Richard Biener
2023-02-10 11:02 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=67a16242-bc88-4ca1-b8b5-432fbafd0330@gmail.com \
    --to=jeffreyalaw@gmail.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=rguenther@suse.de \
    --cc=richard.sandiford@arm.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).