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

            Bug ID: 43523
           Summary: [InstCombine] Extract high bits + sext -> Extract high
                    bits with sext
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Scalar Optimizations
          Assignee: unassignedb...@nondot.org
          Reporter: lebedev...@gmail.com
                CC: llvm-bugs@lists.llvm.org

https://godbolt.org/z/qhpAcX

int extract_high_bits_with_signext_BAD(unsigned long data, int nbits) {
    return (int(data >> (64-nbits)) << (32-nbits)) >> (32-nbits);
}
int extract_high_bits_with_signext_GOOD(unsigned long data, int nbits) {
    return (signed long)(data) >> (64-nbits);
}

I'm not sure yet what generalization of the pattern is there,
maybe here i can get away with just looking for that specific pattern..

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to