Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* Re: [PATCH] Fix passing double float complex arguments in sparc64
@ 2014-01-23 15:01 Jose E. Marchesi
  2014-02-05 19:02 ` Jose E. Marchesi
  0 siblings, 1 reply; 11+ messages in thread
From: Jose E. Marchesi @ 2014-01-23 15:01 UTC (permalink / raw)
  To: gdb-patches


ping

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..246b7d1 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,14 +956,23 @@ 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_D30_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).  */
          if (regnum >= SPARC64_D0_REGNUM && regnum <= SPARC64_D10_REGNUM)
            {
+             int dregnum = regnum;
              gdb_assert (element < 6);
              regnum = SPARC_O0_REGNUM + element;
              regcache_cooked_write (regcache, regnum, valbuf);
+             if (sparc64_complex_floating_p (type)
+                 && (len == 16)
+                 && (dregnum < SPARC64_D10_REGNUM))
+               regcache_cooked_write (regcache, regnum + 1, valbuf + 8);
            }
          else if (regnum >= SPARC64_Q0_REGNUM && regnum <= SPARC64_Q8_REGNUM)
            {


^ permalink raw reply	[flat|nested] 11+ messages in thread
* [PATCH] Fix passing double float complex arguments in sparc64
@ 2013-10-15 15:55 Jose E. Marchesi
  2013-10-23 19:58 ` Mark Kettenis
  0 siblings, 1 reply; 11+ messages in thread
From: Jose E. Marchesi @ 2013-10-15 15:55 UTC (permalink / raw)
  To: gdb-patches


Hi.

Double float complex objects are not 16-byte aligned in either gcc or
solaris studio.  This patch makes gdb to not align double float complex
arguments in the dummy frame when calling a function.

This makes all the tests in gdb.base/varargs.exp to pass in
sparc64-*-linux-gnu.

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.

Index: sparc64-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/sparc64-tdep.c,v
retrieving revision 1.62
diff -u -r1.62 sparc64-tdep.c
--- sparc64-tdep.c	1 Jan 2013 06:32:51 -0000	1.62
+++ sparc64-tdep.c	15 Oct 2013 15:46:25 -0000
@@ -831,7 +831,7 @@
                  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
@@ -913,7 +913,7 @@
 	  /* Floating arguments.  */
 	  if (len == 16)
 	    {
-	      if (element % 2)
+	      if ((element % 2) && sparc64_16_byte_align_p (type))
 		element++;
 	      if (element < 16)
 		regnum = SPARC64_Q0_REGNUM + element / 2;
@@ -961,7 +961,7 @@
 	    }
 	  else if (regnum >= SPARC64_Q0_REGNUM && regnum <= SPARC64_Q8_REGNUM)
 	    {
-	      gdb_assert (element < 5);
+	      gdb_assert (element < 6);
 	      regnum = SPARC_O0_REGNUM + element;
 	      regcache_cooked_write (regcache, regnum, valbuf);
 	      regcache_cooked_write (regcache, regnum + 1, valbuf + 8);


^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2014-02-11 12:39 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-01-23 15:01 [PATCH] Fix passing double float complex arguments in sparc64 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
  -- strict thread matches above, loose matches on Subject: below --
2013-10-15 15:55 Jose E. Marchesi
2013-10-23 19:58 ` Mark Kettenis
2013-12-10 18:46   ` Jose E. Marchesi
2013-12-11 12:29     ` Jose E. Marchesi
2013-12-11 14:09       ` Jose E. Marchesi

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