public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug inline-asm/99259] New: aarch64 inline asm: miscompilation depending on function parameters order
@ 2021-02-24 19:59 jacob.benoit.1 at gmail dot com
  2021-02-24 20:01 ` [Bug inline-asm/99259] " jacob.benoit.1 at gmail dot com
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: jacob.benoit.1 at gmail dot com @ 2021-02-24 19:59 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99259

            Bug ID: 99259
           Summary: aarch64 inline asm: miscompilation depending on
                    function parameters order
           Product: gcc
           Version: 10.2.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: inline-asm
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jacob.benoit.1 at gmail dot com
  Target Milestone: ---

compiler explorer link: https://godbolt.org/z/9oE5Ta

Note: Clang has the same bug: https://bugs.llvm.org/show_bug.cgi?id=49343

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;
}

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-02-25 17:19 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-24 19:59 [Bug inline-asm/99259] New: aarch64 inline asm: miscompilation depending on function parameters order jacob.benoit.1 at gmail dot com
2021-02-24 20:01 ` [Bug inline-asm/99259] " jacob.benoit.1 at gmail dot com
2021-02-24 20:46 ` jakub at gcc dot gnu.org
2021-02-25 17:19 ` jacob.benoit.1 at gmail dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).