Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [PATCH] deal with vector return value for ppc68
@ 2005-10-24 23:47 Paul Gilliam
  2005-11-02 21:59 ` Kevin Buettner
  2005-11-02 22:42 ` [PATCH] " Daniel Jacobowitz
  0 siblings, 2 replies; 12+ messages in thread
From: Paul Gilliam @ 2005-10-24 23:47 UTC (permalink / raw)
  To: gdb-patches

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))
     {


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

end of thread, other threads:[~2005-11-14 22:18 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-10-24 23:47 [PATCH] deal with vector return value for ppc68 Paul Gilliam
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

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