This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug inline-asm/9637] arguments passed/return to asm block via mmx registers trigger failure


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, &param, 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 (&param, &c, sizeof (float));
  c <<= 32;
  return param;
}
Since the crash is fixed I am closing as fixed.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]