[llvm-bugs] [Bug 45610] New: Misoptimizations caused by "[ARM] Fix conditions for lowering to S[LR]I"

via llvm-bugs llvm-bugs at lists.llvm.org
Sun Apr 19 11:32:41 PDT 2020


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

            Bug ID: 45610
           Summary: Misoptimizations caused by "[ARM] Fix conditions for
                    lowering to S[LR]I"
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Backend: AArch64
          Assignee: unassignedbugs at nondot.org
          Reporter: martin at martin.st
                CC: arnaud.degrandmaison at arm.com,
                    llvm-bugs at lists.llvm.org, smithp352 at googlemail.com,
                    Ties.Stuij at arm.com

This commit, "[ARM] Fix conditions for lowering to S[LR]I"
https://reviews.llvm.org/D77387, causes misoptimizations to the following
function:

$ cat test.c
void rgb16to24(const unsigned char *src, unsigned char *dst, int src_size) {
    unsigned char *d = dst;
    const unsigned short *s = (const unsigned short *)src;
    const unsigned short *end = s + src_size / 2;

    while (s < end) {
        unsigned short bgr = *s++;
        *d++ = ((bgr&0xF800)>>8) | ((bgr&0xF800)>>13);
        *d++ = ((bgr&0x07E0)>>3) | ((bgr&0x07E0)>> 9);
        *d++ = ((bgr&0x001F)<<3) | ((bgr&0x001F)>> 2);
    }
}

Compiled e.g. like this:

$ clang -target aarch64-linux-gnu -S -O3 test.c -o test.s

I haven't pinpointed which bit of the change in the output is wrong, but
running the function as part of a testsuite points it out as incorrect.

-- 
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/20200419/9de389ac/attachment.html>


More information about the llvm-bugs mailing list