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

            Bug ID: 72784
           Summary: AVX512: Assembler failure when compiling on OSX
           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: ---

GCC (HEAD) fails to compile basic AVX512 code on my machine (OSX 10.11.6) which
I'm using to develop for (and emulate) this architecture.

Consider the following small program:

#include <immintrin.h>

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

Compiling yields the following error message at the assembler stage:

$ g++-7 test.cpp -c -o test.s -O3 -mavx512f

/var/folders/lm/4mxv3gx901q6sympjjnzbrb40000gp/T//cc0nXIBi.s:6:2: error:
instruction requires: AVX-512 ISA
        vbroadcastss    LC0(%rip), %zmm1
        ^
/var/folders/lm/4mxv3gx901q6sympjjnzbrb40000gp/T//cc0nXIBi.s:7:2: error:
instruction requires: AVX-512 ISA
        vaddps  %zmm1, %zmm0, %zmm0


This is an interesting interaction between the GCC toolchain and the Clang
assembler which only occurs when developing on OSX. It is possible to work
around the error by specifying an additional option "-Wa,-mavx512f" to the
compiler. However, this is certainly non-ideal, since it is nonstandard
parameter and in fact causes builds on other platforms to fail.

Ideally GCC (on OSX only) would transparently forward the -march=<...> and
-mavx* parameters to the LLVM assembler.

Reply via email to