<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - Error: instruction requires: AVX-512 ISA when using -mavx512f"
   href="https://bugs.llvm.org/show_bug.cgi?id=39875">39875</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Error: instruction requires: AVX-512 ISA when using -mavx512f
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>6.0
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>Macintosh
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>MacOS X
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>Tooling
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedclangbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>noloader@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>I think there may be a bad interaction with GCC and the Clang Integrated
Assembler.

$ cat test.cxx
#include <cstdint>
#include <immintrin.h>
int main(int argc, char* argv[])
{
    uint64_t x[8];
    __m512i y = _mm512_load_epi64(x);
    return 0;
}

And then:

$ /opt/local/bin/g++-mp-6 -mavx512f -Wa,-q test.cxx -o test.exe
/tmp/ccSeFrX0.s:20:2: error: instruction requires: AVX-512 ISA
        vmovdqa64       (%rax), %zmm0
        ^
/tmp/ccSeFrX0.s:21:2: error: instruction requires: AVX-512 ISA
        vmovdqa64       %zmm0, -112(%rbp)
        ^

When I look at the *.s file (see below) I don't see any .cpu directives telling
the assembler to accept AVX-512. I guess that means the assembler accepts what
it knows about. But it knows about AVX-512 so it should accept it. So I guess
the original guess is wrong.

-----

$ /opt/local/bin/g++-mp-6 --version
g++-mp-6 (MacPorts gcc6 6.5.0_1) 6.5.0
Copyright (C) 2017 Free Software Foundation, Inc.

I don't know how to print the version of Clang or the integrated assembler when
using `-Wa,-q`.

-----

$ /opt/local/bin/g++-mp-6 -mavx512f -Wa,-q test.cxx -c --save-temps
test.s:20:2: error: instruction requires: AVX-512 ISA
        vmovdqa64       (%rax), %zmm0
        ^
test.s:21:2: error: instruction requires: AVX-512 ISA
        vmovdqa64       %zmm0, -112(%rbp)
        ^

$ cat test.s
        .text
        .globl _main
_main:
LFB3524:
        leaq    8(%rsp), %r10
LCFI0:
        andq    $-64, %rsp
        pushq   -8(%r10)
        pushq   %rbp
LCFI1:
        movq    %rsp, %rbp
        pushq   %r10
LCFI2:
        subq    $112, %rsp
        movl    %edi, -196(%rbp)
        movq    %rsi, -208(%rbp)
        leaq    -192(%rbp), %rax
        movq    %rax, -120(%rbp)
        movq    -120(%rbp), %rax
        vmovdqa64       (%rax), %zmm0
        vmovdqa64       %zmm0, -112(%rbp)
        movl    $0, %eax
        addq    $112, %rsp
        popq    %r10
LCFI3:
        popq    %rbp
        leaq    -8(%r10), %rsp
LCFI4:
        ret
LFE3524:
        .section
__TEXT,__eh_frame,coalesced,no_toc+strip_static_syms+live_support
EH_frame1:
        .set L$set$0,LECIE1-LSCIE1
        .long L$set$0
LSCIE1:
        .long   0
        .byte   0x1
        .ascii "zR\0"
        .byte   0x1
        .byte   0x78
        .byte   0x10
        .byte   0x1
        .byte   0x10
        .byte   0xc
        .byte   0x7
        .byte   0x8
        .byte   0x90
        .byte   0x1
        .align 3
LECIE1:
LSFDE1:
        .set L$set$1,LEFDE1-LASFDE1
        .long L$set$1
LASFDE1:
        .long   LASFDE1-EH_frame1
        .quad   LFB3524-.
        .set L$set$2,LFE3524-LFB3524
        .quad L$set$2
        .byte   0
        .byte   0x4
        .set L$set$3,LCFI0-LFB3524
        .long L$set$3
        .byte   0xc
        .byte   0xa
        .byte   0
        .byte   0x4
        .set L$set$4,LCFI1-LCFI0
        .long L$set$4
        .byte   0x10
        .byte   0x6
        .byte   0x2
        .byte   0x76
        .byte   0
        .byte   0x4
        .set L$set$5,LCFI2-LCFI1
        .long L$set$5
        .byte   0xf
        .byte   0x3
        .byte   0x76
        .byte   0x78
        .byte   0x6
        .byte   0x4
        .set L$set$6,LCFI3-LCFI2
        .long L$set$6
        .byte   0xc
        .byte   0xa
        .byte   0
        .byte   0x4
        .set L$set$7,LCFI4-LCFI3
        .long L$set$7
        .byte   0xc
        .byte   0x7
        .byte   0x8
        .align 3
LEFDE1:
        .constructor
        .destructor
        .align 1
        .subsections_via_symbols</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>