public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/104579] New: vectorizer failed to reduce max & index search together
@ 2022-02-17  7:02 crazylht at gmail dot com
  2022-02-17  7:07 ` [Bug tree-optimization/104579] " crazylht at gmail dot com
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: crazylht at gmail dot com @ 2022-02-17  7:02 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 104579
           Summary: vectorizer failed to reduce max & index search
                    together
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Keywords: missed-optimization
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: crazylht at gmail dot com
  Target Milestone: ---

int max (int *src, int n, int *position)
{
  int maxInt;
  int maxIndex;
  int i;

  maxInt = src[0];
  maxIndex = 0;
  for (i = 1; i < n; i++) {
    if (maxInt < src[i]) {
      maxInt = src[i];
      maxIndex = i;
    }
  }
  *position = maxIndex;
  return (maxInt);
}

GCC can reduce max and index search separately, but not together.

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

end of thread, other threads:[~2022-02-18  0:48 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-17  7:02 [Bug tree-optimization/104579] New: vectorizer failed to reduce max & index search together crazylht at gmail dot com
2022-02-17  7:07 ` [Bug tree-optimization/104579] " crazylht at gmail dot com
2022-02-17  7:35 ` crazylht at gmail dot com
2022-02-17  8:14 ` crazylht at gmail dot com
2022-02-17 10:12 ` rguenth at gcc dot gnu.org
2022-02-17 11:15 ` crazylht at gmail dot com
2022-02-18  0:48 ` 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).