public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/98774] New: gcc -O3 does not vectorize multiplication
@ 2021-01-20 22:13 vanyacpp at gmail dot com
  2021-01-21  2:36 ` [Bug tree-optimization/98774] gcc -O3 does not vectorize some operations crazylht at gmail dot com
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: vanyacpp at gmail dot com @ 2021-01-20 22:13 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 98774
           Summary: gcc -O3 does not vectorize multiplication
           Product: gcc
           Version: 10.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: vanyacpp at gmail dot com
  Target Milestone: ---

Created attachment 50014
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=50014&action=edit
nbody-update-velocity.cpp

In the following sample GCC (-O3 -ffast-math) fails to vectorize operations.
The results is that GCC 10.2 does 8 mulsd, while clang 11.0 does 4 mulpd.

struct vec3 { double x, y, z; };

void update_velocities(vec3* __restrict velocity,
                       double const* __restrict mass,
                       vec3 const* __restrict dpos,
                       double const* __restrict mag)
{
    velocity[0] -= dpos[0] * (mass[1] * mag[0]);
    velocity[1] += dpos[0] * (mass[0] * mag[0]);
}

See an attachment for the complete sample.

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

end of thread, other threads:[~2021-09-14 18:28 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-20 22:13 [Bug tree-optimization/98774] New: gcc -O3 does not vectorize multiplication vanyacpp at gmail dot com
2021-01-21  2:36 ` [Bug tree-optimization/98774] gcc -O3 does not vectorize some operations crazylht at gmail dot com
2021-01-21  7:54 ` rguenth at gcc dot gnu.org
2021-01-27 10:24 ` vanyacpp at gmail dot com
2021-09-14 18:21 ` vanyacpp at gmail dot com
2021-09-14 18:28 ` 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).