public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug inline-asm/41133] New: Inline Assembler: Constraint A expected different behavior
@ 2009-08-20 19:55 andreas dot freimuth at united-bits dot de
2009-08-20 22:28 ` [Bug inline-asm/41133] " rth at gcc dot gnu dot org
2009-08-21 14:16 ` andreas dot freimuth at united-bits dot de
0 siblings, 2 replies; 3+ messages in thread
From: andreas dot freimuth at united-bits dot de @ 2009-08-20 19:55 UTC (permalink / raw)
To: gcc-bugs
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
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug inline-asm/41133] Inline Assembler: Constraint A expected different behavior
2009-08-20 19:55 [Bug inline-asm/41133] New: Inline Assembler: Constraint A expected different behavior andreas dot freimuth at united-bits dot de
@ 2009-08-20 22:28 ` rth at gcc dot gnu dot org
2009-08-21 14:16 ` andreas dot freimuth at united-bits dot de
1 sibling, 0 replies; 3+ messages in thread
From: rth at gcc dot gnu dot org @ 2009-08-20 22:28 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from rth at gcc dot gnu dot org 2009-08-20 22:28 -------
This is expected. The "A" constraint supposed to be used for a PAIR.
This means 64-bit values in 32-bit code or 128-bit values in 64-bit code.
--
rth at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |INVALID
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41133
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug inline-asm/41133] Inline Assembler: Constraint A expected different behavior
2009-08-20 19:55 [Bug inline-asm/41133] New: Inline Assembler: Constraint A expected different behavior andreas dot freimuth at united-bits dot de
2009-08-20 22:28 ` [Bug inline-asm/41133] " rth at gcc dot gnu dot org
@ 2009-08-21 14:16 ` andreas dot freimuth at united-bits dot de
1 sibling, 0 replies; 3+ messages in thread
From: andreas dot freimuth at united-bits dot de @ 2009-08-21 14:16 UTC (permalink / raw)
To: gcc-bugs
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1324 bytes --]
------- 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
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2009-08-21 14:16 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-08-20 19:55 [Bug inline-asm/41133] New: Inline Assembler: Constraint A expected different behavior andreas dot freimuth at united-bits dot de
2009-08-20 22:28 ` [Bug inline-asm/41133] " rth at gcc dot gnu dot org
2009-08-21 14:16 ` andreas dot freimuth at united-bits dot de
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).