public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/103999] New: Vectorizer failed to reduce sum with conversion.
@ 2022-01-13  1:25 crazylht at gmail dot com
  2022-01-13  1:29 ` [Bug tree-optimization/103999] " crazylht at gmail dot com
  2022-01-13  8:35 ` rguenth at gcc dot gnu.org
  0 siblings, 2 replies; 3+ messages in thread
From: crazylht at gmail dot com @ 2022-01-13  1:25 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 103999
           Summary: Vectorizer failed to reduce sum with conversion.
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: crazylht at gmail dot com
  Target Milestone: ---

Vectorizer failed for sum_reduce_cd, but ok for sum_reduce/sum_reduce_cint

float sum_reduce_cd (int n, float* array)
{
    float ans = 0.0f, x;
    for (int i = 0; i != n; i++)
      {
          x = array[i];
          ans += x + 1.0;
      }
    return ans;
}

float sum_reduce (int n, float* array)
{
    float ans = 0.0f, x;
    for (int i = 0; i != n; i++)
      {
          x = array[i];
          ans += x + 1.0f;
      }
    return ans;
}

float sum_reduce_cint (int n, float* array)
{
    int ans = 0;
    float x;
    for (int i = 0; i != n; i++)
      {
          x = array[i];
          ans += (int)(x + 1.0);
      }
    return ans;
}

https://godbolt.org/z/q3McP6d15

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

end of thread, other threads:[~2022-01-13  8:35 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-13  1:25 [Bug tree-optimization/103999] New: Vectorizer failed to reduce sum with conversion crazylht at gmail dot com
2022-01-13  1:29 ` [Bug tree-optimization/103999] " crazylht at gmail dot com
2022-01-13  8:35 ` 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).