<html>
    <head>
      <base href="http://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 --- - BMI intrinsic not recognized?"
   href="http://llvm.org/bugs/show_bug.cgi?id=19431">19431</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>BMI intrinsic not recognized?
          </td>
        </tr>

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

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

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

        <tr>
          <th>OS</th>
          <td>All
          </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>Headers
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>sanjay3.0.0.0@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvmbugs@cs.uiuc.edu
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Using:
$ ./clang -v
clang version 3.5.0 (trunk 206222) (llvm/trunk 206220)
Target: x86_64-apple-darwin13.1.0
Thread model: posix

I tried to generate an x86 bit manipulation instruction (BMI) via its C
intrinsic:
$ cat bmi.c 
#include <x86intrin.h>
int foo(int a) { return _blsmsk_u32(a); }

$ ./clang bmi.c -mbmi -S -o -
bmi.c:2:25: warning: implicit declaration of function '_blsmsk_u32' is invalid
in C99 [-Wimplicit-function-declaration]

The generated asm shows:
    callq    __blsmsk_u32

I confirmed the same behavior with clang 3.2 on Ubuntu 13.04. However, gcc
4.8.2 generates the expected instruction from the same source file and compiler
flags:
blsmsk %edi, %eax

I also confirmed that a BMI2 instruction is generated using the same kind of C
instrinsic (I tested '_bzhi_u32') and "-mbmi2" with both clang versions and
gcc.

Is "-mbmi" no longer the correct feature flag for the BMI ISA?</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>