<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 --- - ExpandInlineAsm is brittle, and uses obsolete register dirflag"
   href="http://llvm.org/bugs/show_bug.cgi?id=17757">17757</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>ExpandInlineAsm is brittle, and uses obsolete register dirflag
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>libraries
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>3.2
          </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>Backend: X86
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>chris@smowton.net
          </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=11464" name="attach_11464" title="Patch">attachment 11464</a> <a href="attachment.cgi?id=11464&action=edit" title="Patch">[details]</a></span>
Patch

X86TargetLowering::ExpandInlineAsm is supposed to raise inline assembly
functions that implement endianness swaps into llvm.bswap intrinsics. However
it only recognises the exact sequence emitted by Clang; Dragonegg (3.2) emits a
somewhat different sequence and thus doesn't get raised, inhibiting some
optimisations.

In particular, the existing function inspects the asm clobber list and expects
exactly "~{cc}", "~{dirflag}", "~{flags}", "~{fpsr}". However, GCC eliminated
{dirflag} as a seperate clobberable pseudo-register in 2006
[<a href="http://gcc.gnu.org/ml/gcc-patches/2006-12/msg00468.html">http://gcc.gnu.org/ml/gcc-patches/2006-12/msg00468.html</a>], and at least in
gcc-4.6 emits some permutation of "~{cc}", "~{flags}", "~{fpsr}". The attached
patch makes the clobber testing less brittle to allow both dragonegg and clang
code to be raised appropriately.</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>