[llvm-bugs] [Bug 49343] New: aarch64 inline asm: miscompilation depending on function parameters order

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Feb 24 11:58:19 PST 2021


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

            Bug ID: 49343
           Summary: aarch64 inline asm: miscompilation depending on
                    function parameters order
           Product: clang
           Version: trunk
          Hardware: Other
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: jacob.benoit.1 at gmail.com
                CC: htmldeveloper at gmail.com, llvm-bugs at lists.llvm.org,
                    neeilans at live.com, richard-llvm at metafoo.co.uk

compiler explorer link: https://godbolt.org/z/e9n49n

code:

#include <arm_neon.h>

// output:
//         smlal   v0.4s, v1.4h, v2.4h  
int32x4_t good(int32x4_t acc, int16x4_t x, int16x4_t y) {
    asm("smlal %[acc].4s, %[x].4h, %[y].4h"
        : [acc]"=w"(acc)
        : [x]"w"(x),
          [y]"w"(y)
        :);
    return acc;
}

// output:
//         smlal   v0.4s, v0.4h, v1.4h
// bug: v0 is used for both x and y arguments!
int32x4_t bad(int16x4_t x, int16x4_t y, int32x4_t acc) {
    asm("smlal %[acc].4s, %[x].4h, %[y].4h"
        : [acc]"=w"(acc)
        : [x]"w"(x),
          [y]"w"(y)
        :);
    return acc;
}

-- 
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/20210224/a2a2bc19/attachment.html>


More information about the llvm-bugs mailing list