Re: [PATCH v5 04/17] x86/acrn: Introduce hypercall interfaces

From: Borislav Petkov
Date: Tue Nov 03 2020 - 11:44:50 EST


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?

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.

0 <repeats 12 times>}, v8_int16 = {28836, 16253, 0, 0, 0, 0, 0, 0}, v4_int32 = {1065185444, 0, 0, 0}, v2_int64 = {
1065185444, 0}, uint128 = 1065185444}

Then:

movd %xmm0,%eax
rax 0x3f7d70a4

and that's the hex representation of the 0.99 float.

and that same value goes into %r8d:

mov %eax,%r8d
r8 0x3f7d70a4

:-)

> 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?

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

> Now if only we had time to document what we wrote! We *do* write docs
> to go with new code (maybe not enough always), but no one spends a lot
> of time on documenting the existing compiler, or with a larger view than
> just a single aspect of the compiler. Alas.

The problem every big project has.

Thx.

--
Regards/Gruss,
Boris.

https://people.kernel.org/tglx/notes-about-netiquette