public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/90304] -O3 vectorization gets worse when code is moved into main()
       [not found] <bug-90304-4@http.gcc.gnu.org/bugzilla/>
@ 2021-07-22 21:46 ` pinskia at gcc dot gnu.org
  2021-07-22 21:48 ` [Bug tree-optimization/90304] -O3 vectorization gets worse when code is inlined pinskia at gcc dot gnu.org
  1 sibling, 0 replies; 2+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-07-22 21:46 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |enhancement

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

* [Bug tree-optimization/90304] -O3 vectorization gets worse when code is inlined
       [not found] <bug-90304-4@http.gcc.gnu.org/bugzilla/>
  2021-07-22 21:46 ` [Bug tree-optimization/90304] -O3 vectorization gets worse when code is moved into main() pinskia at gcc dot gnu.org
@ 2021-07-22 21:48 ` pinskia at gcc dot gnu.org
  1 sibling, 0 replies; 2+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-07-22 21:48 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|-O3 vectorization gets      |-O3 vectorization gets
                   |worse when code is moved    |worse when code is inlined
                   |into main()                 |
           Keywords|                            |alias

--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Testcase:
int* ptr();

int f()
{
    int*__restrict result = ptr();
    int* first = ptr();
    int* second = ptr();

    for (int i = 0; i < 1024; ++i)
        result[i] = first[i] * second[i];
}
__attribute__((noinline))
void func(int*__restrict result, int* first, int* second)
{
    for (int i = 0; i < 1024; ++i)
        result[i] = first[i] * second[i];
}

int g()
{
    func(ptr(), ptr(), ptr());
}

Notice func is vectorized while f is not.

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

end of thread, other threads:[~2021-07-22 21:48 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-90304-4@http.gcc.gnu.org/bugzilla/>
2021-07-22 21:46 ` [Bug tree-optimization/90304] -O3 vectorization gets worse when code is moved into main() pinskia at gcc dot gnu.org
2021-07-22 21:48 ` [Bug tree-optimization/90304] -O3 vectorization gets worse when code is inlined pinskia 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).