public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "rguenther at suse dot de" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug tree-optimization/102494] Failure to optimize vector reduction properly especially when using OpenMP
Date: Tue, 28 Sep 2021 07:09:44 +0000	[thread overview]
Message-ID: <bug-102494-4-wNdSCptllF@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-102494-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102494

--- Comment #8 from rguenther at suse dot de <rguenther at suse dot de> ---
On Tue, 28 Sep 2021, crazylht at gmail dot com wrote:

> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102494
> 
> --- Comment #7 from Hongtao.liu <crazylht at gmail dot com> ---
> After supporting v4hi reduce, gimple seems not optimal to convert v8qi to v8hi.
> 
>  6  vector(4) short int vect__21.36;
>  7  vector(4) unsigned short vect__2.31;
>  8  int16_t stmp_r_17.17;
>  9  vector(8) short int vect__16.15;
> 10  int16_t D.2229[8];
> 11  vector(8) short int _50;
> 12  vector(8) short int _51;
> 13  vector(8) short int _52;
> 14  vector(8) short int _53;
> 15  vector(8) short int _54;
> 16  vector(8) short int _55;
> 
> 18  <bb 2> [local count: 189214783]:
> 19  vect__2.31_97 = [vec_unpack_lo_expr] a_90(D);
> 20  vect__2.31_98 = [vec_unpack_hi_expr] a_90(D);
> 21  vect__21.36_105 = VIEW_CONVERT_EXPR<vector(4) short int>(vect__2.31_97);
> 22  vect__21.36_106 = VIEW_CONVERT_EXPR<vector(4) short int>(vect__2.31_98);
> 23  MEM <vector(4) short int> [(short int *)&D.2229] = vect__21.36_105;
> 24  MEM <vector(4) short int> [(short int *)&D.2229 + 8B] = vect__21.36_106;

so the above could possibly use a V8QI -> V8HI conversion, the loop
vectorizer isn't good at producing those though.  And of course the
appropriate conversion optab has to exist.

> 25  vect__16.15_47 = MEM <vector(8) short int> [(short int *)&D.2229];

Here's lack of "CSE" - I do have patches somewhere to turn this into

  vect__16.15_47 = { vect__21.36_105, vect__21.36_106 };

but I'm not sure that's going to be profitable (well, the code as-is
will get a STLF hit).

There's also store-merging that could instead merge the stores
similarly (but then there's no CSE after store-merging so the load
would remain).

  parent reply	other threads:[~2021-09-28  7:09 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-27  0:52 [Bug tree-optimization/102494] New: Failure to optimize out " gabravier at gmail dot com
2021-09-27  1:45 ` [Bug tree-optimization/102494] " pinskia at gcc dot gnu.org
2021-09-27  3:01 ` crazylht at gmail dot com
2021-09-27  5:08 ` [Bug tree-optimization/102494] Failure to optimize " crazylht at gmail dot com
2021-09-27  5:13 ` crazylht at gmail dot com
2021-09-27  5:55 ` crazylht at gmail dot com
2021-09-27  8:47 ` rguenth at gcc dot gnu.org
2021-09-28  6:57 ` crazylht at gmail dot com
2021-09-28  7:09 ` rguenther at suse dot de [this message]
2021-10-08  2:10 ` cvs-commit at gcc dot gnu.org
2021-10-25 21:44 ` peter at cordes dot ca
2021-10-25 22:00 ` peter at cordes dot ca
2021-10-26  8:13 ` crazylht at gmail dot com

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=bug-102494-4-wNdSCptllF@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /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).