<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 --- - Integrated aarch64 assembler should exchange cmp/cmn given negative immediates"
   href="http://llvm.org/bugs/show_bug.cgi?id=21994">21994</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Integrated aarch64 assembler should exchange cmp/cmn given negative immediates
          </td>
        </tr>

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

        <tr>
          <th>Version</th>
          <td>trunk
          </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: AArch64
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>simon.hosie@arm.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>Given:
foo:
    cmp     x0, #-1
    ret

`clang -c --target=aarch64-linux-gnu -integrated-as cmn_aarch64.s` gives:
cmn_aarch64.s:2:17: error: expected compatible register, symbol or integer in
range [0, 4095]

while `clang -c --target=aarch64-linux-gnu -no-integrated-as cmn_aarch64.s`
succeeds and gives code that disassembles to:
0000000000000000 <foo>:
   0:   b100041f        cmn     x0, #0x1
   4:   d65f03c0        ret

gas appears to accept negative immediates an implicitly changes the cmp to a
cmn to make the instruction legal, while llvm simply rejects the immediate.  I
don't think GCC generates this.  It's just handwritten assembly which stumbles
into the incompatibility.</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>