[llvm-bugs] [Bug 28966] New: [AArch64] orr wzr vs. mov

via llvm-bugs llvm-bugs at lists.llvm.org
Sat Aug 13 08:57:11 PDT 2016


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

            Bug ID: 28966
           Summary: [AArch64] orr wzr vs. mov
           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 bug 28965. 

I can't imagine this would make any perf difference in practice, but it
suggests that there's some missing analysis/fold/pattern-matching because
functionally equivalent IR is producing different code:

$ cat cmpsel.ll
define i32 @goo(i32 %x) {
  %cmp = icmp eq i32 %x, 1
  %sel = select i1 %cmp, i32 1, i32 -1
  ret i32 %sel
}

define i32 @hoo(i32 %x) {
  %cmp = icmp ne i32 %x, 1  <--- inverse condition
  %sel = select i1 %cmp, i32 -1, i32 1  <--- swap select operands
  ret i32 %sel
}

$ ./llc -o - cmpsel.ll -mtriple=aarch64
goo:                                    // @goo
    cmp        w0, #1          // =1
    orr    w8, wzr, #0x1
    cneg     w0, w8, ne
    ret
hoo:                                    // @hoo
    cmp        w0, #1          // =1
    mov    w8, #-1
    cneg     w0, w8, eq
    ret

-- 
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/500eef58/attachment.html>


More information about the llvm-bugs mailing list