<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 --- - [AArch64] missed opportunity to use conditional select invert (csinv)"
   href="https://llvm.org/bugs/show_bug.cgi?id=28965">28965</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>[AArch64] missed opportunity to use conditional select invert (csinv)
          </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>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>Backend: AArch64
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>spatel+llvm@rotateright.com
          </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>Forking this off of <a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - [SimplifyCFG] failure to sink common function call below if/else"
   href="show_bug.cgi?id=28964">bug 28964</a>:

define i32 @goo(i32 %x) {
  %cmp = icmp eq i32 %x, 1
  %sel = select i1 %cmp, i32 1, i32 -1
  %call = tail call i32 @bar(i32 %sel)
  ret i32 %call
}
declare i32 @bar(i32)

$ ./llc -o - selcall.ll -mtriple=aarch64
...
    cmp        w0, #1          // =1
    orr    w8, wzr, #0x1
    cneg     w0, w8, ne
    b    bar

gcc 4.8 on godbolt ( <a href="https://godbolt.org/g/BW5RJu">https://godbolt.org/g/BW5RJu</a> ) shows:

foo(int):
        cmp     w0, 1
        csinv   w0, w0, wzr, eq
        b       bar(int)</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>