Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Andreas Jaeger <aj@suse.de>
To: gdb-patches@sourceware.cygnus.com
Subject: Fix float/double return on x86-64
Date: Thu, 26 Jun 2003 05:46:00 -0000	[thread overview]
Message-ID: <u8he6eezrs.fsf@gromit.moeb> (raw)



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


             reply	other threads:[~2003-06-26  5:46 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-06-26  5:46 Andreas Jaeger [this message]
     [not found] <3F0E91CD.1000808@suse.cz>
2003-07-11 12:35 ` Mark Kettenis

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=u8he6eezrs.fsf@gromit.moeb \
    --to=aj@suse.de \
    --cc=gdb-patches@sourceware.cygnus.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox