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: unassignedb...@nondot.org
          Reporter: mar...@martin.st
                CC: arnaud.degrandmai...@arm.com,
                    llvm-bugs@lists.llvm.org, smithp...@googlemail.com,
                    ties.st...@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.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to