[llvm-bugs] [Bug 34753] New: [AArch64][CodeGen][CodeSize] Redundant 'and' can be remove with shifts in addr mode

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Sep 27 13:27:37 PDT 2017


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

            Bug ID: 34753
           Summary: [AArch64][CodeGen][CodeSize] Redundant 'and' can be
                    remove with shifts in addr mode
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Backend: AArch64
          Assignee: unassignedbugs at nondot.org
          Reporter: mcrosier at codeaurora.org
                CC: llvm-bugs at lists.llvm.org

Test case:
int test(unsigned long long a, unsigned long long b, int *table) {    
  return table[(a * b) >> 58];  
}

Current assembly:
test:                                   // @test
// BB#0:                                // %entry
        mul x8, x1, x0
        lsr x8, x8, #56
        and x8, x8, #0xfc
        ldr w0, [x2, x8]
        ret

We should be able to remove the 'and' for a code size with as follows:
test:                                   // @test
// BB#0:                                // %entry
        mul x8, x1, x0
        lsr x8, x8, #58
        ldr w0, [x2, x8, lsl#2]
        ret

I'm not interested in pursuing this optimization, but I figured I'd file the
bug, regardless.

-- 
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/20170927/c52fbe36/attachment.html>


More information about the llvm-bugs mailing list