public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug inline-asm/97708] New: Inline asm does not use the local register asm specified with register ... asm() as input
@ 2020-11-03 19:58 bp at alien8 dot de
  2020-11-03 20:10 ` [Bug inline-asm/97708] " pinskia at gcc dot gnu.org
                   ` (29 more replies)
  0 siblings, 30 replies; 31+ messages in thread
From: bp at alien8 dot de @ 2020-11-03 19:58 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 97708
           Summary: Inline asm does not use the local register asm
                    specified with register ... asm() as input
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: inline-asm
          Assignee: unassigned at gcc dot gnu.org
          Reporter: bp at alien8 dot de
  Target Milestone: ---

Building the below on x86-64 with gcc9, gcc10 and Segher built with gcc11
20201015:

---
int main(void)
{

        register float foo asm ("xmm0") = 0.99f;

        asm volatile("movl %0, %%r8d\n\t"
                      "vmcall\n\t"
                      :: "g" (foo));

        return 0;
}
---

results in gcc not using the xmm0 register directly as the input register to
the asm statement but does something funky:

0000000000001125 <main>:
    1125:       55                      push   %rbp
    1126:       48 89 e5                mov    %rsp,%rbp
    1129:       f3 0f 10 05 d3 0e 00    movss  0xed3(%rip),%xmm0        # 2004
<_IO_stdin_used+0x4>
    1130:       00 
    1131:       66 0f 7e c0             movd   %xmm0,%eax
    1135:       41 89 c0                mov    %eax,%r8d
    1138:       0f 01 c1                vmcall 

by loading through the %eax GPR and producing wrong code without even a
warning. I'm not saying this example is supposed to make sense but this should
fail instead by trying to compile:

$ cat xmm1.s
        movl %xmm0,%eax

$ x86_64-linux-as xmm1.s -o xmm1.o
xmm1.s: Assembler messages:
xmm1.s:1: Error: unsupported instruction `mov'

and fail the build because plain MOV cannot use an XMM reg as a source.

Thx.

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

end of thread, other threads:[~2020-11-06 13:23 UTC | newest]

Thread overview: 31+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-03 19:58 [Bug inline-asm/97708] New: Inline asm does not use the local register asm specified with register ... asm() as input bp at alien8 dot de
2020-11-03 20:10 ` [Bug inline-asm/97708] " pinskia at gcc dot gnu.org
2020-11-03 20:16 ` bp at alien8 dot de
2020-11-03 20:39 ` segher at gcc dot gnu.org
2020-11-03 20:41 ` pinskia at gcc dot gnu.org
2020-11-03 20:55 ` segher at gcc dot gnu.org
2020-11-03 21:01 ` jakub at gcc dot gnu.org
2020-11-03 21:15 ` bp at alien8 dot de
2020-11-03 22:09 ` jakub at gcc dot gnu.org
2020-11-04  8:29 ` rguenth at gcc dot gnu.org
2020-11-04  8:51 ` jakub at gcc dot gnu.org
2020-11-04 12:13 ` bp at alien8 dot de
2020-11-04 12:20 ` jakub at gcc dot gnu.org
2020-11-04 12:36 ` bp at alien8 dot de
2020-11-04 12:44 ` jakub at gcc dot gnu.org
2020-11-04 12:48 ` jakub at gcc dot gnu.org
2020-11-04 12:55 ` bp at alien8 dot de
2020-11-04 12:58 ` jakub at gcc dot gnu.org
2020-11-04 13:08 ` bp at alien8 dot de
2020-11-04 17:39 ` segher at gcc dot gnu.org
2020-11-04 17:40 ` jakub at gcc dot gnu.org
2020-11-04 17:52 ` segher at gcc dot gnu.org
2020-11-04 17:56 ` jakub at gcc dot gnu.org
2020-11-04 18:17 ` segher at gcc dot gnu.org
2020-11-05 10:30 ` amonakov at gcc dot gnu.org
2020-11-05 11:04 ` jakub at gcc dot gnu.org
2020-11-05 12:18 ` rguenth at gcc dot gnu.org
2020-11-05 16:02 ` segher at gcc dot gnu.org
2020-11-05 20:34 ` segher at gcc dot gnu.org
2020-11-05 20:38 ` segher at gcc dot gnu.org
2020-11-06 13:23 ` amonakov at gcc dot gnu.org

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).