[llvm-bugs] [Bug 51707] New: LLVM 13 Regression: AArch64 llvm.bswap.v2i16 incorrect code

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Sep 1 14:52:00 PDT 2021


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

            Bug ID: 51707
           Summary: LLVM 13 Regression: AArch64 llvm.bswap.v2i16 incorrect
                    code
           Product: new-bugs
           Version: trunk
          Hardware: All
                OS: All
            Status: NEW
          Severity: release blocker
          Priority: P
         Component: new bugs
          Assignee: unassignedbugs at nondot.org
          Reporter: andrew at ziglang.org
                CC: htmldeveloper at gmail.com, llvm-bugs at lists.llvm.org

Created attachment 25216
  --> https://bugs.llvm.org/attachment.cgi?id=25216&action=edit
test.ll

To reproduce:

$HOME/local/llvm13-release/bin/clang-13 -static -o test test.ll  -target
aarch64-linux-musl -fuse-ld=$HOME/local/llvm13-release/bin/ld.lld -nostdlib
memcpy.c
qemu-aarch64 ./test
echo $? # prints 69, but 0 is expected


memcpy.c is produced here for convenience:
==============================
void *memcpy(void *restrict dest, const void *restrict src, unsigned long n) {
        unsigned char *d = dest;
        const unsigned char *s = src;
        for (; n; n--) *d++ = *s++;
        return dest;
}
==============================

This .ll file is derived from a failing zig behavior test case. Here is the
test case extracted for use with llvm-reduce, which produced test.ll in the
above reduction:
==============================
const std = @import("std");

pub fn main() noreturn {
    t(u16, 2, [_]u16{ 0x1234, 0x2345 }, [_]u16{ 0x3412, 0x4523 });
}

fn t(
    comptime I: type,
    comptime n: comptime_int,
    input: std.meta.Vector(n, I),
    expected_vector: std.meta.Vector(n, I),
) noreturn {
    const actual_output: [n]I = @byteSwap(I, input);
    const expected_output: [n]I = expected_vector;
    if (std.mem.eql(I, &actual_output, &expected_output)) {
        std.os.exit(0); // test passes
    }
    std.os.exit(69); // test failure
}
==============================

This is a regression from LLVM 12, where the above test case was passing.

-- 
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/20210901/1868efc2/attachment.html>


More information about the llvm-bugs mailing list