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: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected]

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.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to