public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
From: Segher Boessenkool <segher@kernel.crashing.org>
To: Xi Ruoyao <xry111@mengyan1223.wang>
Cc: 172060045@hdu.edu.cn, gcc-help <gcc-help@gcc.gnu.org>,
	bin.cheng@linux.alibaba.com, rguenther@suse.de, ook@ucw.cz,
	Jan Hubicka <hubicka@ucw.cz>
Subject: Re: Why vectorization didn't turn on by -O2
Date: Sun, 9 May 2021 08:44:37 -0500	[thread overview]
Message-ID: <20210509134436.GX10366@gate.crashing.org> (raw)
In-Reply-To: <5ac14eb276d81223d2d677593600f37c0fd1ce48.camel@mengyan1223.wang>

On Sun, May 09, 2021 at 12:54:08AM +0800, Xi Ruoyao via Gcc-help wrote:
> On Sat, 2021-05-08 at 20:07 +0800, 172060045@hdu.edu.cn wrote:
> > Recently I noticed that gcc -O2 didn't turn on vectorization
> > optimization, 
> > which it turns on in clang -O2.
> > 
> > Does GCC think it involves the trade-off of space speed, or other
> > considerations?

-O2 is for optimisations that (almost) never degrade code quality.  -O3
is for those that are only beneficial "on average".

> It's just a decision I think.  The "original" reason may be that
> vectorization can make code *slower* on some cases.

Yup.  Vectorisation always causes hugely different code.

> There was some discussion about enabling -ftree-loop-vectorization at -
> O2 for x86, but that was too late (for GCC 9):

AFAIK the current plan is to enable vectorisation at -O2 with a more
conservative cost model.  This will be a generic change, for all
architectures, and hopefully will arrive in GCC 12.


Segher

  reply	other threads:[~2021-05-09 13:45 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-08 12:07 172060045
2021-05-08 16:54 ` Xi Ruoyao
2021-05-09 13:44   ` Segher Boessenkool [this message]
2021-05-10  8:21     ` Richard Biener
2021-05-10  9:11       ` Jan Hubicka
2021-05-10  9:27         ` Segher Boessenkool
2021-05-10 12:10           ` Jan Hubicka
2021-05-10  9:24       ` Segher Boessenkool
2021-05-17 16:03         ` Jan Hubicka
2021-05-17 18:56           ` Richard Sandiford
2021-08-04  8:21             ` Hongtao Liu
2021-08-04  8:22               ` Richard Sandiford
2021-08-04  8:31                 ` Richard Biener
2021-08-04  9:10                   ` Richard Sandiford
2021-08-04  9:56                     ` Segher Boessenkool
2021-08-04 10:22                       ` Richard Sandiford
2021-08-04 21:18                         ` Segher Boessenkool
2021-08-04  9:12                   ` Hongtao Liu
2021-08-11 17:14                   ` Jan Hubicka
2021-08-14 14:22                     ` Jan Hubicka
2021-08-16  8:03                       ` Richard Biener
2021-08-16  3:22                   ` Kewen.Lin
2021-08-16  6:00                     ` Hongtao Liu
2021-08-16  6:09                       ` Hongtao Liu
2021-08-24  2:21                         ` Hongtao Liu
2021-08-04  8:36                 ` Hongtao Liu

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=20210509134436.GX10366@gate.crashing.org \
    --to=segher@kernel.crashing.org \
    --cc=172060045@hdu.edu.cn \
    --cc=bin.cheng@linux.alibaba.com \
    --cc=gcc-help@gcc.gnu.org \
    --cc=hubicka@ucw.cz \
    --cc=ook@ucw.cz \
    --cc=rguenther@suse.de \
    --cc=xry111@mengyan1223.wang \
    /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).