[llvm-bugs] [Bug 42399] New: InstCombine: shift amount reassociation when doing bit test
    via llvm-bugs 
    llvm-bugs at lists.llvm.org
       
    Tue Jun 25 15:14:18 PDT 2019
    
    
  
https://bugs.llvm.org/show_bug.cgi?id=42399
            Bug ID: 42399
           Summary: InstCombine: shift amount reassociation when doing bit
                    test
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Scalar Optimizations
          Assignee: unassignedbugs at nondot.org
          Reporter: lebedev.ri at gmail.com
                CC: llvm-bugs at lists.llvm.org
https://godbolt.org/z/Kq82aC
https://rise4fun.com/Alive/kBb
bool bad(unsigned x, unsigned y, unsigned skip0, unsigned skip1) {
    x >>= skip0;
    return x & (y << skip1);
}
bool good(unsigned x, unsigned y, unsigned skip0, unsigned skip1) {
    return x & (y << (skip1+skip0));
}
Name: 
Pre: C1+C2 u< 32
%o4 = lshr i32 %x, C1
%o5 = shl i32 %y, C2
%o6 = and i32 %o5, %o4
%r = icmp ne i32 %o6, 0
  =>
%n4 = add i32 C1, C2
%n5 = shl i32 %y, %n4
%n6 = and i32 %n5, %x
%r = icmp ne i32 %n6, 0
Still from real code..
-- 
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/20190625/1ca637af/attachment.html>
    
    
More information about the llvm-bugs
mailing list