public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/108916] New: Miss vectorization for masked gather w/o restrict qualifier.
@ 2023-02-24  5:08 crazylht at gmail dot com
  2023-02-24  5:10 ` [Bug tree-optimization/108916] " crazylht at gmail dot com
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: crazylht at gmail dot com @ 2023-02-24  5:08 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 108916
           Summary: Miss vectorization for masked gather w/o restrict
                    qualifier.
           Product: gcc
           Version: 13.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: crazylht at gmail dot com
  Target Milestone: ---

void
foo1 (double* __restrict a, long long* b, double* c, long long* d)
{
    for (long long i = 0; i != 10000; i++)
      {
        if (b[i])
          a[i] = 0;
        else
          a[i] = c[d[i]];
      }
}


void
foo2 (double* __restrict a, long long* b, double* __restrict c, long long* d)
{
    for (long long i = 0; i != 10000; i++)
      {
        if (b[i])
          a[i] = 0;
        else
          a[i] = c[d[i]];
      }
}

w/ -Ofast -march=skylake-avx512, foo1 can't be vectorized, but foo2 can, the
only difference between foo1 and foo2 is restrict qualifier for double* c.
But there's already a restrict qualifier for double* __restrict a in both
cases,   why double* __restrict c matters.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug tree-optimization/108916] Miss vectorization for masked gather w/o restrict qualifier.
  2023-02-24  5:08 [Bug tree-optimization/108916] New: Miss vectorization for masked gather w/o restrict qualifier crazylht at gmail dot com
@ 2023-02-24  5:10 ` crazylht at gmail dot com
  2023-02-24  5:24 ` pinskia at gcc dot gnu.org
  2023-02-24 12:59 ` rguenth at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: crazylht at gmail dot com @ 2023-02-24  5:10 UTC (permalink / raw)
  To: gcc-bugs

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

Hongtao.liu <crazylht at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Target|                            |x86_64-*-* i?86-*-*

--- Comment #1 from Hongtao.liu <crazylht at gmail dot com> ---
https://godbolt.org/z/xxMjGhh5e

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug tree-optimization/108916] Miss vectorization for masked gather w/o restrict qualifier.
  2023-02-24  5:08 [Bug tree-optimization/108916] New: Miss vectorization for masked gather w/o restrict qualifier crazylht at gmail dot com
  2023-02-24  5:10 ` [Bug tree-optimization/108916] " crazylht at gmail dot com
@ 2023-02-24  5:24 ` pinskia at gcc dot gnu.org
  2023-02-24 12:59 ` rguenth at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-02-24  5:24 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Blocks|                            |49774, 53947
           Keywords|                            |alias, missed-optimization

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
I thought there was another bug about restrict and only one of the arguments
marked but I can't find it.


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=49774
[Bug 49774] [meta-bug] restrict qualification aliasing issues
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53947
[Bug 53947] [meta-bug] vectorizer missed-optimizations

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug tree-optimization/108916] Miss vectorization for masked gather w/o restrict qualifier.
  2023-02-24  5:08 [Bug tree-optimization/108916] New: Miss vectorization for masked gather w/o restrict qualifier crazylht at gmail dot com
  2023-02-24  5:10 ` [Bug tree-optimization/108916] " crazylht at gmail dot com
  2023-02-24  5:24 ` pinskia at gcc dot gnu.org
@ 2023-02-24 12:59 ` rguenth at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-02-24 12:59 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2023-02-24
             Status|UNCONFIRMED                 |NEW

--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> ---
Should be indeed enough.  ISTR the issue is with if-conversion and .MASK_LOAD
or .MASK_STORE given that we currently cannot annotate function calls with
restrict tags.

And yes, I think there's a duplicate bug.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-02-24 12:59 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-24  5:08 [Bug tree-optimization/108916] New: Miss vectorization for masked gather w/o restrict qualifier crazylht at gmail dot com
2023-02-24  5:10 ` [Bug tree-optimization/108916] " crazylht at gmail dot com
2023-02-24  5:24 ` pinskia at gcc dot gnu.org
2023-02-24 12:59 ` rguenth at gcc dot gnu.org

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).