Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Paul Gilliam <pgilliam@us.ibm.com>
To: gdb-patches@sources.redhat.com
Subject: [PATCH] deal with vector return value for ppc68
Date: Mon, 24 Oct 2005 23:47:00 -0000	[thread overview]
Message-ID: <200510241606.10304.pgilliam@us.ibm.com> (raw)

2005-10-24  Paul Gilliam  <pgilliam@us.ibm.com

        * ppc-sysv-tdep.c (ppc64_sysv_abi_return_value): Copy code from
         ppc_sysv_abi_return_value() to handle a vector return value.

Index: ppc-sysv-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/ppc-sysv-tdep.c,v
retrieving revision 1.31
diff -a -u -p -r1.31 ppc-sysv-tdep.c
--- ppc-sysv-tdep.c     17 Aug 2005 07:44:13 -0000      1.31
+++ ppc-sysv-tdep.c     24 Oct 2005 22:57:31 -0000
@@ -906,11 +906,11 @@ ppc64_sysv_abi_return_value (struct gdba
        }
       return RETURN_VALUE_REGISTER_CONVENTION;
     }
+  /* Integers in r3.  */
   if ((TYPE_CODE (valtype) == TYPE_CODE_INT
        || TYPE_CODE (valtype) == TYPE_CODE_ENUM)
       && TYPE_LENGTH (valtype) <= 8)
     {
-      /* Integers in r3.  */
       if (writebuf != NULL)
        {
          /* Be careful to sign extend the value.  */
@@ -938,24 +938,41 @@ ppc64_sysv_abi_return_value (struct gdba
        regcache_cooked_read (regcache, tdep->ppc_gp0_regnum + 3, readbuf);
       return RETURN_VALUE_REGISTER_CONVENTION;
     }
-  if (TYPE_CODE (valtype) == TYPE_CODE_ARRAY
-      && TYPE_LENGTH (valtype) <= 8
-      && TYPE_CODE (TYPE_TARGET_TYPE (valtype)) == TYPE_CODE_INT
-      && TYPE_LENGTH (TYPE_TARGET_TYPE (valtype)) == 1)
+  /* Array type has more than one use. */
+  if (TYPE_CODE (valtype) == TYPE_CODE_ARRAY)
     {
       /* Small character arrays are returned, right justified, in r3.  */
-      int offset = (register_size (gdbarch, tdep->ppc_gp0_regnum + 3)
-                   - TYPE_LENGTH (valtype));
-      if (writebuf != NULL)
-       regcache_cooked_write_part (regcache, tdep->ppc_gp0_regnum + 3,
-                                   offset, TYPE_LENGTH (valtype), writebuf);
-      if (readbuf != NULL)
-       regcache_cooked_read_part (regcache, tdep->ppc_gp0_regnum + 3,
-                                  offset, TYPE_LENGTH (valtype), readbuf);
-      return RETURN_VALUE_REGISTER_CONVENTION;
+      if (TYPE_LENGTH (valtype) <= 8
+        && TYPE_CODE (TYPE_TARGET_TYPE (valtype)) == TYPE_CODE_INT
+        && TYPE_LENGTH (TYPE_TARGET_TYPE (valtype)) == 1)
+        {
+          int offset = (register_size (gdbarch, tdep->ppc_gp0_regnum + 3)
+                       - TYPE_LENGTH (valtype));
+          if (writebuf != NULL)
+           regcache_cooked_write_part (regcache, tdep->ppc_gp0_regnum + 3,
+                                      offset, TYPE_LENGTH (valtype), writebuf);
+          if (readbuf != NULL)
+           regcache_cooked_read_part (regcache, tdep->ppc_gp0_regnum + 3,
+                                      offset, TYPE_LENGTH (valtype), readbuf);
+          return RETURN_VALUE_REGISTER_CONVENTION;
+        }
+      /* A VMX vector is returned in v2. */
+      if (TYPE_CODE (valtype) == TYPE_CODE_ARRAY
+        && TYPE_VECTOR (valtype) && tdep->ppc_vr0_regnum >= 0)
+        {
+          if (readbuf)
+           {
+             regcache_cooked_read (regcache, tdep->ppc_vr0_regnum+2, readbuf);
+           }
+          if (writebuf)
+            {
+             regcache_cooked_write(regcache, tdep->ppc_vr0_regnum+2, writebuf);
+           }
+          return RETURN_VALUE_REGISTER_CONVENTION;
+        }
     }
   /* Big floating point values get stored in adjacent floating
-     point registers.  */
+     point registers, starting with F1.  */
   if (TYPE_CODE (valtype) == TYPE_CODE_FLT
       && (TYPE_LENGTH (valtype) == 16 || TYPE_LENGTH (valtype) == 32))
     {


             reply	other threads:[~2005-10-24 23:05 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-10-24 23:47 Paul Gilliam [this message]
2005-11-02 21:59 ` Kevin Buettner
2005-11-07 23:33   ` Paul Gilliam
2005-11-08  0:10     ` Paul Gilliam
2005-11-08 17:46     ` Kevin Buettner
2005-11-09  6:56       ` Joel Brobecker
2005-11-09  7:24         ` Kevin Buettner
2005-11-15  4:10           ` [COMMIT (6.4)] " Paul Gilliam
2005-11-15  4:40             ` Paul Gilliam
2005-11-02 22:42 ` [PATCH] " Daniel Jacobowitz
2005-11-03  1:31   ` Mark Kettenis
2005-11-07 21:42     ` [COMMIT] " Paul Gilliam

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=200510241606.10304.pgilliam@us.ibm.com \
    --to=pgilliam@us.ibm.com \
    --cc=gdb-patches@sources.redhat.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