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.