[llvm-bugs] [Bug 43523] New: [InstCombine] Extract high bits + sext -> Extract high bits with sext

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Oct 1 06:32:37 PDT 2019


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: unassignedbugs at nondot.org
          Reporter: lebedev.ri at gmail.com
                CC: llvm-bugs at 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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20191001/dbe871b8/attachment.html>


More information about the llvm-bugs mailing list