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

            Bug ID: 41173
           Summary: Shifts on non negative numbers
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Scalar Optimizations
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected]

int foo(int x) {
    if (x>=0) {
        unsigned xx = x;
        return xx >> 8;
    } else {
        return x >> 8;
    }
}

foo(int):                               # @foo3(int)
        mov     ecx, edi
        shr     ecx, 8
        mov     eax, edi
        sar     eax, 8
        test    edi, edi
        cmovns  eax, ecx
        ret


Maybe we can simplify foo to use just one shift?

-- 
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