<html>
    <head>
      <base href="https://llvm.org/bugs/" />
    </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 --- - target attribute doesn't know about avx512vl, can cause compiler crashes"
   href="https://llvm.org/bugs/show_bug.cgi?id=27779">27779</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>target attribute doesn't know about avx512vl, can cause compiler crashes
          </td>
        </tr>

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

        <tr>
          <th>Version</th>
          <td>unspecified
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </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>LLVM Codegen
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>nicolasweber@gmx.de
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>thakis@thakis:~/src/llvm-build$ cat test.cc
#include <x86intrin.h>
__attribute__((target("avx512vl"))) void f_avx512() {
  __mmask8 mask;
  __m256i m;
  _mm256_mask_abs_epi32(m, mask, m);
}
void f() {}

int main() {
  if (__builtin_cpu_supports("avx512vl"))
    f_avx512();
}

thakis@thakis:~/src/llvm-build$ bin/clang -c test.cc
test.cc:10:7: error: invalid cpu feature string for builtin
  if (__builtin_cpu_supports("avx512vl"))
      ^                      ~~~~~~~~~~
1 error generated.


If I change the argument to __builtin_cpu_supports to e.g. "avx", then clang
crashes:

thakis@thakis:~/src/llvm-build$ cat test.cc
#include <x86intrin.h>
__attribute__((target("avx512vl"))) void f_avx512() {
  __mmask8 mask;
  __m256i m;
  _mm256_mask_abs_epi32(m, mask, m);
}
void f() {}

int main() {
  if (__builtin_cpu_supports("avx"))
    f_avx512();
}

thakis@thakis:~/src/llvm-build$ bin/clang -c test.cc
fatal error: error in backend: Cannot select: t19: ch = store<ST32[%5]> t15,
t35, FrameIndex:i64<4>, undef:i64
  t35: v32i8 = bitcast t34
    t34: v4i64,ch = load<LD32[%6]> t15, FrameIndex:i64<7>, undef:i64
      t7: i64 = FrameIndex<7>
      t3: i64 = undef
  t17: i64 = FrameIndex<4>
  t3: i64 = undef
In function: _Z8f_avx512v
clang-3.8: error: clang frontend command failed with exit code 70 (use -v to
see invocation)
clang version 3.9.0 (trunk 268802)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/local/google/home/thakis/src/llvm-build/bin
clang-3.8: note: diagnostic msg: PLEASE submit a bug report to
<a href="http://llvm.org/bugs/">http://llvm.org/bugs/</a> and include the crash backtrace, preprocessed source, and
associated run script.
clang-3.8: note: diagnostic msg: 
********************

PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang-3.8: note: diagnostic msg: /tmp/test-8869f8.cpp
clang-3.8: note: diagnostic msg: /tmp/test-8869f8.sh
clang-3.8: note: diagnostic msg: 

********************</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>