public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/64031] New: Vectorization of max/min is not robust enough
@ 2014-11-23 12:59 jacques-henri.jourdan at inria dot Fr
  2014-11-23 14:08 ` [Bug tree-optimization/64031] " glisse at gcc dot gnu.org
  2023-07-27 13:47 ` [Bug tree-optimization/64031] (un-)conditional execution state is not preserved by PRE/sink rguenth at gcc dot gnu.org
  0 siblings, 2 replies; 3+ messages in thread
From: jacques-henri.jourdan at inria dot Fr @ 2014-11-23 12:59 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 64031
           Summary: Vectorization of max/min is not robust enough
           Product: gcc
           Version: 4.9.3
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jacques-henri.jourdan at inria dot Fr

The following code is sucessfully vectorized (using the minps instruction):

const int SIZE = 1<<15;

void test9(float * b)
{
  unsigned i;

  float *y =__builtin_assume_aligned(b, 16);

  for (i = 0; i < SIZE; i++)
  {
    float f = y[i];
    float f2 = f < f*f ? f : f*f;
    y[i] = f2;
  }
}

But not the following slightly modified version:

void test9(float * b)
{
  unsigned i;

  float *y =__builtin_assume_aligned(b, 16);

  for (i = 0; i < SIZE; i++)
  {
    float f = y[i];
    float f2 = f < f*f ? f : f*f;
    y[i] = f2*f2;
  }
}

Actually, it seems like vectorization of max/min operations fails as soon as
some computation is done with the result of this min/max operation.


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

* [Bug tree-optimization/64031] Vectorization of max/min is not robust enough
  2014-11-23 12:59 [Bug tree-optimization/64031] New: Vectorization of max/min is not robust enough jacques-henri.jourdan at inria dot Fr
@ 2014-11-23 14:08 ` glisse at gcc dot gnu.org
  2023-07-27 13:47 ` [Bug tree-optimization/64031] (un-)conditional execution state is not preserved by PRE/sink rguenth at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: glisse at gcc dot gnu.org @ 2014-11-23 14:08 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Marc Glisse <glisse at gcc dot gnu.org> ---
-ffast-math lets it vectorize (using min directly). Otherwise, for the first
test, ifcvt gives (a<b)?a:b which is vectorized as such, but for the second
test, it doesn't unless we pass -fno-trapping-math. That seems a bit
inconsistent.


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

* [Bug tree-optimization/64031] (un-)conditional execution state is not preserved by PRE/sink
  2014-11-23 12:59 [Bug tree-optimization/64031] New: Vectorization of max/min is not robust enough jacques-henri.jourdan at inria dot Fr
  2014-11-23 14:08 ` [Bug tree-optimization/64031] " glisse at gcc dot gnu.org
@ 2023-07-27 13:47 ` rguenth at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-07-27 13:47 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |14.0
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED

--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> ---
This is now fixed in GCC 14.

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

end of thread, other threads:[~2023-07-27 13:47 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-11-23 12:59 [Bug tree-optimization/64031] New: Vectorization of max/min is not robust enough jacques-henri.jourdan at inria dot Fr
2014-11-23 14:08 ` [Bug tree-optimization/64031] " glisse at gcc dot gnu.org
2023-07-27 13:47 ` [Bug tree-optimization/64031] (un-)conditional execution state is not preserved by PRE/sink 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).