Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: jose.marchesi@oracle.com (Jose E. Marchesi)
To: Mark Kettenis <mark.kettenis@xs4all.nl>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH] Fix passing double float complex arguments in sparc64
Date: Tue, 10 Dec 2013 18:46:00 -0000	[thread overview]
Message-ID: <878uvsv8xl.fsf@oracle.com> (raw)
In-Reply-To: <201310231958.r9NJwEje005359@glazunov.sibelius.xs4all.nl> (Mark	Kettenis's message of "Wed, 23 Oct 2013 21:58:14 +0200 (CEST)")


    > 2013-10-15  Jose E. Marchesi  <jose.marchesi@oracle.com>
    > 
    >         * sparc64-tdep.c (sparc64_store_arguments): Do not align complex
    >         double float arguments to 16-byte.
    
    Hi Jose,
    
    A bit of digging around seems to confirm that we shouldn't align
    double complex variables.  However, I think that with your diff we're
    still not storing things in the right registers.

Aye.  Fixed in the amended patch below.

2013-10-15  Jose E. Marchesi  <jose.marchesi@oracle.com>

        * sparc64-tdep.c (sparc64_store_arguments): Do not align complex
        double float arguments to 16-byte in the argument slots.


diff --git a/gdb/sparc64-tdep.c b/gdb/sparc64-tdep.c
index 8bcf418..9767bbe 100644
--- a/gdb/sparc64-tdep.c
+++ b/gdb/sparc64-tdep.c
@@ -831,7 +831,7 @@ sparc64_store_arguments (struct regcache *regcache, int nargs,
                  quad-aligned, and thus a hole might be introduced
                  into the parameter array to force alignment."  Skip
                  an element if necessary.  */
-	      if (num_elements % 2)
+	      if ((num_elements % 2) && sparc64_16_byte_align_p (type))
 		num_elements++;
 	    }
 	  else
@@ -890,7 +890,7 @@ sparc64_store_arguments (struct regcache *regcache, int nargs,
       if (sparc64_structure_or_union_p (type)
 	  || (sparc64_complex_floating_p (type) && len == 32))
 	{
-	  /* Structure or Union arguments.  */
+	  /* Structure, Union or long double Complex arguments.  */
 	  gdb_assert (len <= 16);
 	  memset (buf, 0, sizeof (buf));
 	  valbuf = memcpy (buf, valbuf, len);
@@ -908,7 +908,13 @@ sparc64_store_arguments (struct regcache *regcache, int nargs,
 	  if (element < 16)
 	    sparc64_store_floating_fields (regcache, type, valbuf, element, 0);
 	}
-      else if (sparc64_floating_p (type) || sparc64_complex_floating_p (type))
+      else if (sparc64_complex_floating_p (type))
+	{
+	  /* Float Complex or double Complex arguments.  */
+	  if (element < 16)
+	    regnum = SPARC64_D0_REGNUM + element;
+	}
+      else if (sparc64_floating_p (type))
 	{
 	  /* Floating arguments.  */
 	  if (len == 16)
@@ -950,6 +956,10 @@ sparc64_store_arguments (struct regcache *regcache, int nargs,
       if (regnum != -1)
 	{
 	  regcache_cooked_write (regcache, regnum, valbuf);
+	  if (sparc64_complex_floating_p (type)
+	      && (len == 16)
+	      && (regnum < SPARC64_D10_REGNUM))
+	    regcache_cooked_write (regcache, regnum + 1, valbuf + 8);
 
 	  /* If we're storing the value in a floating-point register,
              also store it in the corresponding %0 register(s).  */


  reply	other threads:[~2013-12-10 18:46 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-15 15:55 Jose E. Marchesi
2013-10-23 19:58 ` Mark Kettenis
2013-12-10 18:46   ` Jose E. Marchesi [this message]
2013-12-11 12:29     ` Jose E. Marchesi
2013-12-11 14:09       ` Jose E. Marchesi
2014-01-23 15:01 Jose E. Marchesi
2014-02-05 19:02 ` Jose E. Marchesi
2014-02-08  2:47   ` Joel Brobecker
2014-02-10 13:22     ` Jose E. Marchesi
2014-02-11  4:45       ` Joel Brobecker
2014-02-11 12:39         ` Jose E. Marchesi

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=878uvsv8xl.fsf@oracle.com \
    --to=jose.marchesi@oracle.com \
    --cc=gdb-patches@sourceware.org \
    --cc=mark.kettenis@xs4all.nl \
    /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