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

            Bug ID: 72782
           Summary: AVX512: No support for scalar broadcasts
           Product: gcc
           Version: 7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: wen...@mitsuba-renderer.org
  Target Milestone: ---

AVX512 introduces the ability to do scalar broadcasts, which significantly cuts
down on the number of explicit broadcast instructions in vectorized code. It
looks like the AVX512 code generation backend on GCC does not recognize/make
use of this instruction set feature:

Consider the following snippet:

__m512 addConstant(__m512 arg) {
    return _mm512_add_ps(arg, _mm512_set1_ps(1.f));
}

This is the assembly generated by GCC (HEAD):

__Z11addConstantDv16_f:
LFB4589:
        vbroadcastss    LC0(%rip), %zmm1
        vaddps  %zmm1, %zmm0, %zmm0
        ret

For reference, this is the output generated by Clang:

_Z11addConstantDv16_f:                 ## @_Z11addConstantDv16_f
        vaddps  LCPI0_0(%rip){1to16}, %zmm0, %zmm0
        retq

Reply via email to