public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/79726] Missing optimisation: Type conversion not vectorised in simple additive reduction
       [not found] <bug-79726-4@http.gcc.gnu.org/bugzilla/>
@ 2021-02-23 11:00 ` rguenth at gcc dot gnu.org
  0 siblings, 0 replies; only message in thread
From: rguenth at gcc dot gnu.org @ 2021-02-23 11:00 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> ---
It's also a general -ffast-math missed optimization to demote the double
add to a float one.  If you write

double f(double x[]) {
  float p = 1.0;
  for (int i = 0; i < 16; i++)
    p += (float)x[i];
  return p;
}

the loop is vectorized in a way you expect.

Note such demotion can result in +-Inf where it didn't appear before for
example when x[0] is less than float -Inf "+ 1." and thus (float)x[0] is
not representable but (float)(x[0] + 1.) is.

Still "correct" vectorization should also be possible but is not yet
implemented.

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-02-23 11:00 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-79726-4@http.gcc.gnu.org/bugzilla/>
2021-02-23 11:00 ` [Bug tree-optimization/79726] Missing optimisation: Type conversion not vectorised in simple additive reduction 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).