Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* Fix float/double return on x86-64
@ 2003-06-26  5:46 Andreas Jaeger
  0 siblings, 0 replies; 2+ messages in thread
From: Andreas Jaeger @ 2003-06-26  5:46 UTC (permalink / raw)
  To: gdb-patches



The appended patch fixes these three failures on x86-64:
FAIL: gdb.base/return.exp: correct value returned double test (known problem with sparc solaris)
FAIL: gdb.base/return2.exp: float value returned successfully
FAIL: gdb.base/return2.exp: double value returned successfully

The code does not handle complex floating point values, I'm not sure
that it's correct there but I decided to fix this issue first.

Ok to commit for both branches?

Andreas

2003-06-25  Andreas Jaeger  <aj@suse.de>

	* x86-64-tdep.c (x86_64_store_return_value): Return double and
	float values in SSE register.


============================================================
Index: src/gdb/x86-64-tdep.c
--- src/gdb/x86-64-tdep.c	15 Jun 2003 11:01:46 -0000	1.79
+++ src/gdb/x86-64-tdep.c	25 Jun 2003 19:10:46 -0000
@@ -712,8 +727,9 @@ x86_64_store_return_value (struct type *
 {
   int len = TYPE_LENGTH (type);
 
-  if (TYPE_CODE_FLT == TYPE_CODE (type))
-    {
+  /* First handle long doubles.  */
+  if (TYPE_CODE_FLT == TYPE_CODE (type) && len == 16)
+    { 
       ULONGEST fstat;
       char buf[FPU_REG_RAW_SIZE];
 
@@ -741,6 +757,12 @@ x86_64_store_return_value (struct type *
          for the tag word is 0x3fff.  */
       regcache_raw_write_unsigned (regcache, FTAG_REGNUM, 0x3fff);
     }
+  else if (TYPE_CODE_FLT == TYPE_CODE (type))
+    {
+      /* Handle double and float variables.  */
+      regcache_cooked_write (regcache,  X86_64_XMM0_REGNUM, valbuf);
+    }
+  /* XXX: What about complex floating point types?  */
   else
     {
       int low_size = REGISTER_RAW_SIZE (0);

-- 
 Andreas Jaeger, SuSE Linux AG, aj@suse.de, http://www.suse.de/~aj
  GPG fingerprint = 93A3 365E CE47 B889 DF7F  FED1 389A 563C C272 A126


^ permalink raw reply	[flat|nested] 2+ messages in thread
[parent not found: <3F0E91CD.1000808@suse.cz>]

end of thread, other threads:[~2003-07-11 12:35 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-06-26  5:46 Fix float/double return on x86-64 Andreas Jaeger
     [not found] <3F0E91CD.1000808@suse.cz>
2003-07-11 12:35 ` Mark Kettenis

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox