[Bug c++/96709] New: cmov and vectorization

g.peterhoff@t-online.de gcc-bugzilla@gcc.gnu.org
Wed Aug 19 14:46:46 GMT 2020


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

            Bug ID: 96709
           Summary: cmov and vectorization
           Product: gcc
           Version: unknown
               URL: https://godbolt.org/z/GKnj17
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: g.peterhoff@t-online.de
  Target Milestone: ---

Hello gcc team,
I noticed 2 problems:
1) the compiler does not generate cmov commands
2) the auto-vectorization is very unreliable

I would like to clarify this using the example of a stable shift-left, see
https://godbolt.org/z/GKnj17
I have implemented several variants for this.

to 1)
Only silent::conditional_move generates a cmov, all other cases do not.

to 2)
- The auto-vectorization only works if the smaller of the two arrays (val and
bit) is at least as large as an sse register, although the values ​​could be
adjusted.
- If vectorization is used at all, often only 128-bit code is generated
(_mm_XXX) instead of 256-bit (avx _mm256_XXX) or larger.
- The 16-bit shift commands from AVX512 (_mmXXX_sllv_epi16) are not used if a
suitable architecture is selected.

The complex shl_attempt_vectorize function works a little better, but not 100%
either. Play around with the array size, the value/shift-types and the
functions!

Best regards
Gero


More information about the Gcc-bugs mailing list