<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 --- - Clang cannot do LTO with BMI2 instructions"
   href="http://llvm.org/bugs/show_bug.cgi?id=19416">19416</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Clang cannot do LTO with BMI2 instructions
          </td>
        </tr>

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

        <tr>
          <th>Version</th>
          <td>3.4
          </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>LLVM Codegen
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>services@daylenyang.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>Created <span class=""><a href="attachment.cgi?id=12368" name="attach_12368" title="Test file with a BMI2 instruction.">attachment 12368</a> <a href="attachment.cgi?id=12368&action=edit" title="Test file with a BMI2 instruction.">[details]</a></span>
Test file with a BMI2 instruction.

Overview:
Clang cannot do LTO (link time optimization) when there are BMI2 instructions
in the file.

Steps to reproduce:
0. Make sure you have an Intel Haswell processor.
1. Create a simple C program (such as the one attached) that contains a BMI2
intrinsic such as _pext_u32(). Be sure to include <x86intrin.h>.
2. Compile using command: clang -mbmi2 file_name.c
3. Compile using command: clang -mbmi2 -flto file_name.c

Actual results:
Compiling without LTO works great. Compiling using LTO crashes with this error:
LLVM ERROR: Cannot select: intrinsic %llvm.x86.bmi.pext.32
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Expected results:
Clang should be able to compile the file with LTO.

Version:
Apple LLVM version 5.1 (clang-503.0.40) (based on LLVM 3.4svn)
Target: x86_64-apple-darwin13.1.0
Thread model: posix</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>