[Bug inline-asm/41133] New: Inline Assembler: Constraint A expected different behavior

2009-08-20 Thread andreas dot freimuth at united-bits dot de
The documentation of the constraint A says:

"The a and d registers, as a pair (for instructions that return half the result
in one and half in the other)."

So I expect:
asm("/*  dx = 0,  ax = 1 */" :: "A" ((int32_t)1) );
asm("/* edx = 0, eax = 1 */" :: "A" ((int64_t)1) );
//asm("/* rdx = 0, rax = 1 */" :: "A" ((int128_t)1));

but the behavior of gcc is different:
with -m32 switch:
asm("/* eDX = undef, eax = 1 */" :: "A" ((int32_t)1) );
asm("/* edx = 0, eax = 1 */" :: "A" ((int64_t)1) );

with -m64 switch:
asm("/* rDX = undef, eax = 1 */" :: "A" ((int32_t)1) );
asm("/* rDX = undef, rax = 1 */" :: "A" ((int64_t)1) );

so for -m64 there is no difference between a and A


-- 
   Summary: Inline Assembler: Constraint A expected different
behavior
   Product: gcc
   Version: 4.4.1
Status: UNCONFIRMED
  Severity: normal
      Priority: P3
 Component: inline-asm
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: andreas dot freimuth at united-bits dot de
 GCC build triplet: x86_64-linux-gnu
  GCC host triplet: x86_64-linux-gnu
GCC target triplet: x86_64-linux-gnu


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41133



[Bug inline-asm/41133] Inline Assembler: Constraint A expected different behavior

2009-08-21 Thread andreas dot freimuth at united-bits dot de


--- Comment #2 from andreas dot freimuth at united-bits dot de  2009-08-21 
14:16 ---
I supposed that the "A" constraints was introduced to support instructions that
use a combination of d and a registers as parameters. These instructions that
use DX:AX, EDX:EAX and RDX:RAX as source or destination still exists in long
mode. But this support is at least for 64bit code completely lost/broken while
there is no int128_t.

As you said: "The "A" constraint supposed to be used for a _PAIR_."
But as I tried to show, GCC does not use any pair in most cases.
  asm("…" :: "A" (0) ); 
This should initialize the _pair_ to 0, shouldn't it?
But gcc initializes only the lower bits (rAX), not the upper (rDX).
And I assume that rDX is not even in the clobber list(but I was not yet able to
prove that), where it definitely has to be.


So if it is supposed to be used for fixed size values, what means no support
for (e)DX:(e)AX in 32bit(64bit) code, I would expect it to work as
  int64_t EDX_EAX = some_32bit_value;
( int128_t RDX_RAX = some_64bit_or_32bit_value; )
with an implicit typecast to be usable for at least some instruction that use
rDX:rAX as operand.


If this is still considered to be no bug in gcc, then the documentation need to
be fixed.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41133