[llvm-bugs] [Bug 28965] New: [AArch64] missed opportunity to use conditional select invert (csinv)

via llvm-bugs llvm-bugs at lists.llvm.org
Sat Aug 13 08:39:00 PDT 2016


https://llvm.org/bugs/show_bug.cgi?id=28965

            Bug ID: 28965
           Summary: [AArch64] missed opportunity to use conditional select
                    invert (csinv)
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: Backend: AArch64
          Assignee: unassignedbugs at nondot.org
          Reporter: spatel+llvm at rotateright.com
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

Forking this off of bug 28964:

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 ( https://godbolt.org/g/BW5RJu ) shows:

foo(int):
        cmp     w0, 1
        csinv   w0, w0, wzr, eq
        b       bar(int)

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20160813/82631eb3/attachment.html>


More information about the llvm-bugs mailing list