[llvm-bugs] [Bug 41363] New: ARM backend doesn't realize when behavior of left shift of 32 can be used to eliminate branches

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Apr 3 13:47:35 PDT 2019


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

            Bug ID: 41363
           Summary: ARM backend doesn't realize when behavior of left
                    shift of 32 can be used to eliminate branches
           Product: new-bugs
           Version: 8.0
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: new bugs
          Assignee: unassignedbugs at nondot.org
          Reporter: slandden at gmail.com
                CC: htmldeveloper at gmail.com, llvm-bugs at lists.llvm.org

As documented here, ARM's right shift returns 0 when the shift is greater than
32.
http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0552a/BABJCCDH.html

But llvm doesn't eliminate this branch https://zig.godbolt.org/z/FPt9Nm

export fn shiftrarm(int: u32, shift: u8) u32 {
    if (shift == 0) {
        return 0;
    } else {
        return (int >> @truncate(u5, (32 - shift)));
    }
}

I couldn't find documentation for other widths of shifts.

-- 
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/20190403/4ce57beb/attachment.html>


More information about the llvm-bugs mailing list