public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/96864] New: loop not vectorized due to cost model
@ 2020-08-31 10:15 crazylht at gmail dot com
  2020-08-31 13:05 ` [Bug target/96864] loop not vectorized due AVX512 condition handling rguenth at gcc dot gnu.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: crazylht at gmail dot com @ 2020-08-31 10:15 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 96864
           Summary: loop not vectorized due to cost model
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: crazylht at gmail dot com
                CC: hjl.tools at gmail dot com
  Target Milestone: ---

cat test.c

---
double d1[1024], d2[1024];
char c1[1024];
int test4(int n)
{
    int i;
    for (int i = 0; i < 1024; i++)
      c1[i] = d1[i] > d2[i] ? c1[i] : 1;
}
---

loop is not vectorized with under -mtune=skylake-avx512 but success with
-mtune=generic

Refer to https://godbolt.org/z/xPGhTh

output of -fopt-info-all

---
Unit growth for small function inlining: 16->16 (0%)

Inlined 0 calls, eliminated 0 functions

test.c:6:5: missed: couldn't vectorize loop
test.c:7:17: missed: not vectorized: no vectype for stmt: _1 = d1[i_13];
 scalar_type: double
test.c:6:5: note: ***** Analysis failed with vector mode V4DF
test.c:6:5: note: ***** Skipping vector mode V32QI, which would repeat the
analysis for V4DF
test.c:3:5: note: vectorized 0 loops in function.
test.c:3:5: note: ***** Analysis failed with vector mode VOID
test.c:7:13: note: ***** Analysis failed with vector mode V4DF
test.c:7:13: note: ***** Skipping vector mode V32QI, which would repeat the
analysis for V4DF
test.c:7:13: note: ***** Analysis failed with vector mode V32QI
test.c:7:13: note: ***** Skipping vector mode V32QI, which would repeat the
analysis for V32QI
test.c:6:5: note: ***** Analysis failed with vector mode V32QI
test.c:6:5: note: ***** Skipping vector mode V32QI, which would repeat the
analysis for V32QI
test.c:6:5: note: ***** Analysis failed with vector mode VOID
test.c:8:1: note: ***** Analysis failed with vector mode VOID
---

Seems problem of cost model.

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

* [Bug target/96864] loop not vectorized due AVX512 condition handling
  2020-08-31 10:15 [Bug target/96864] New: loop not vectorized due to cost model crazylht at gmail dot com
@ 2020-08-31 13:05 ` rguenth at gcc dot gnu.org
  2022-02-15  6:46 ` crazylht at gmail dot com
  2022-02-15  6:46 ` crazylht at gmail dot com
  2 siblings, 0 replies; 4+ messages in thread
From: rguenth at gcc dot gnu.org @ 2020-08-31 13:05 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
            Summary|loop not vectorized due to  |loop not vectorized due
                   |cost model                  |AVX512 condition handling
             Blocks|                            |53947
           Keywords|                            |missed-optimization
             Target|                            |x86_64-*-* i?86-*-*
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2020-08-31

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
t.c:3:5: missed:   not vectorized: relevant stmt not supported: patt_25 =
(<signed-boolean:1>) patt_24;
t.c:6:5: missed:  bad operation or unsupported loop bound.
t.c:6:5: note:  ***** Analysis failed with vector mode V4DF

it's more a bad pattern for condition vectorization and AVX512 it seems.


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53947
[Bug 53947] [meta-bug] vectorizer missed-optimizations

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

* [Bug target/96864] loop not vectorized due AVX512 condition handling
  2020-08-31 10:15 [Bug target/96864] New: loop not vectorized due to cost model crazylht at gmail dot com
  2020-08-31 13:05 ` [Bug target/96864] loop not vectorized due AVX512 condition handling rguenth at gcc dot gnu.org
@ 2022-02-15  6:46 ` crazylht at gmail dot com
  2022-02-15  6:46 ` crazylht at gmail dot com
  2 siblings, 0 replies; 4+ messages in thread
From: crazylht at gmail dot com @ 2022-02-15  6:46 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Hongtao.liu <crazylht at gmail dot com> ---
Fixed in GCC12 by r12-6756-g8bc700f4c3fbe405413db02281ef2918bfa831fc.

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

* [Bug target/96864] loop not vectorized due AVX512 condition handling
  2020-08-31 10:15 [Bug target/96864] New: loop not vectorized due to cost model crazylht at gmail dot com
  2020-08-31 13:05 ` [Bug target/96864] loop not vectorized due AVX512 condition handling rguenth at gcc dot gnu.org
  2022-02-15  6:46 ` crazylht at gmail dot com
@ 2022-02-15  6:46 ` crazylht at gmail dot com
  2 siblings, 0 replies; 4+ messages in thread
From: crazylht at gmail dot com @ 2022-02-15  6:46 UTC (permalink / raw)
  To: gcc-bugs

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

Hongtao.liu <crazylht at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
             Status|NEW                         |RESOLVED

--- Comment #3 from Hongtao.liu <crazylht at gmail dot com> ---
.

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

end of thread, other threads:[~2022-02-15  6:46 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-31 10:15 [Bug target/96864] New: loop not vectorized due to cost model crazylht at gmail dot com
2020-08-31 13:05 ` [Bug target/96864] loop not vectorized due AVX512 condition handling rguenth at gcc dot gnu.org
2022-02-15  6:46 ` crazylht at gmail dot com
2022-02-15  6:46 ` crazylht 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).