This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug inline-asm/9637] arguments passed/return to asm block via mmx registers trigger failure
- From: "pinskia at physics dot uc dot edu" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 25 Jul 2003 16:19:27 -0000
- Subject: [Bug inline-asm/9637] arguments passed/return to asm block via mmx registers trigger failure
- References: <20030209185600.9637.pgw99@doc.ic.ac.uk>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=9637
pinskia at physics dot uc dot edu changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |FIXED
------- Additional Comments From pinskia at physics dot uc dot edu 2003-07-25 16:19 -------
The code is invalid, as on the x86 without optimization, gcc does not know that c needs to
be the same register so gcc errors out, the fix is to change "=y"(c) to "+y"(c) (meaning that
it is going to be read and written to) and remove "0"(c).
So:
AMD_sqrt (float param)
{
long long a, b, c;
memcpy (&c, ¶m, sizeof (float));
c >>= 32;
asm("pfrsqrt %y1, %y0 \n\t"
"movq %y2, %y1 \n\t"
"pfmul %y1, %y1 \n\t"
"pfrsqit1 %y1, %y0 \n\t"
"pfrcpit2 %y1, %y2 \n\t"
"pfmul %y0, %y1 \n\t"
: "+y" (c), "=y" (a), "=y" (b));
memcpy (¶m, &c, sizeof (float));
c <<= 32;
return param;
}
Since the crash is fixed I am closing as fixed.