public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/46009] New: ?: vectorized, very similar if is not
@ 2010-10-13 16:54 jakub at gcc dot gnu.org
  2010-10-13 16:59 ` [Bug tree-optimization/46009] " pinskia at gcc dot gnu.org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: jakub at gcc dot gnu.org @ 2010-10-13 16:54 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46009

           Summary: ?: vectorized, very similar if is not
           Product: gcc
           Version: 4.6.0
            Status: UNCONFIRMED
          Keywords: missed-optimization
          Severity: normal
          Priority: P3
         Component: tree-optimization
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: jakub@gcc.gnu.org
                CC: irar@gcc.gnu.org


void bar (int *);
void foo (int *a, int *b, int *c, int *d)
{
  int e[1024], i, g;
  for (i = 0; i < 1024; i++)
    {
      g = a[i] + b[i] + c[i] * d[i];;
#ifdef WORKS
      e[i] = g < 10 ? 1 : g;
#else
      if (g < 10)
        e[i] = 1;
      else
        e[i] = g;
#endif
    }
  bar (e);
}

is vectorized only if -DWORKS -O3, but not for -O3, although the code is really
identical.  Not sure if ifcvt should handle this, or instead some earlier pass
should detect that both bbs have the same memory destination and change
  if (g_25 <= 9)
    goto <bb 4>;
  else
    goto <bb 5>;

<bb 4>:
  e[i_14] = 1;
  goto <bb 6>;

<bb 5>:
  e[i_14] = g_25;

<bb 6>:

into an unconditional assignment of a PHI result into e[i].


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

end of thread, other threads:[~2011-08-25 15:43 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-10-13 16:54 [Bug tree-optimization/46009] New: ?: vectorized, very similar if is not jakub at gcc dot gnu.org
2010-10-13 16:59 ` [Bug tree-optimization/46009] " pinskia at gcc dot gnu.org
2010-11-03 11:11 ` jakub at gcc dot gnu.org
2010-11-03 12:01 ` jakub at gcc dot gnu.org
2010-11-03 15:19 ` jakub at gcc dot gnu.org
2011-08-25 15:55 ` hjl.tools at gmail dot com

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