On Tue, Nov 03, 2020 at 05:44:35PM +0100, Borislav Petkov wrote:
> On Mon, Nov 02, 2020 at 05:18:09PM -0600, Segher Boessenkool wrote:
> > That is invalid actually: local register asm as input to an inline asm
> > should use *that* register!
> > 
> > This is all correct until LRA ("reload").  Not that "movl %xmm0,$eax"
> > works, but at least it screams its head off, as it should.
> 
> Screams how?

$ 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'

(This isn't an existing insn IIUC.)

> It builds fine without a single peep with -Wall here.
> 
> Btw, that's a MOVD - not a MOVL. MOVD can do xmm -> gpr moves. And
> singlestepping it with gdb does, well, something, which is clearly
> wrong but nothing complains:
> 
> => 0x555555555131 <main+12>:    movd   %xmm0,%eax
> 
> and %xmm0 has:
> 
> (gdb) p $xmm0
> $2 = {v4_float = {0.99000001, 0, 0, 0}, v2_double = {5.2627153433055495e-315, 
> 0}, v16_int8 = {-92, 112, 125, 63, 
>                 ^^^^^^^^^^
> 
> so that is correct.

The original code had movl.  And movl is needed for GPRs.

> and that same value goes into %r8d:
> 
> mov    %eax,%r8d

Which violates what is required by register asm :-(

> > Yes.  But GCC doing what you should have said instead of doing what you
> > said, is not good.
> 
> Oh well, should I open a low prio bug, would that help?

Sure, thanks!

> I probably should test with the latest gcc first, though...

Yeah...  FWIW, I tested with
x86_64-linux-gcc (GCC) 11.0.0 20201015 (experimental)
so I doubt current ToT will have it fixed, but who knows.

Thanks,


Segher

Reply via email to