This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Fix Power soft-float DFP function call handling


This patch fixes decimal floating-point function call and return
handling for soft-float Power, changing the following FAILs to PASSes
in testing for powerpc-linux-gnu.  OK to commit?

FAIL: gdb.base/dfp-test.exp: Backtrace function with correct _Decimal64 arguments.
FAIL: gdb.base/dfp-test.exp: Correct _Decimal64 return value from called function.
FAIL: gdb.base/dfp-test.exp: Backtrace function with correct _Decimal128 arguments.
FAIL: gdb.base/dfp-test.exp: Correct _Decimal128 return value from called function.
FAIL: gdb.base/dfp-test.exp: Call function with mixed decimal float arguments TEST.
FAIL: gdb.base/dfp-test.exp: Call function with mixed decimal float arguments.
FAIL: gdb.base/dfp-test.exp: Call function with many _Decimal64 arguments.
FAIL: gdb.base/dfp-test.exp: Call function with many _Decimal128 arguments.
FAIL: gdb.base/dfp-test.exp: Call function with many mixed decimal float arguments.

2008-06-10  Joseph Myers  <joseph@codesourcery.com>

	* ppc-sysv-tdep.c (ppc_sysv_abi_push_dummy_call): Handle passing
	decimal floating-point values in GPRs for soft-float.
	(do_ppc_sysv_return_value): Handle returning decimal
	floating-point values in GPRs for soft-float.

Index: gdb/ppc-sysv-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/ppc-sysv-tdep.c,v
retrieving revision 1.52
diff -u -p -r1.52 ppc-sysv-tdep.c
--- gdb/ppc-sysv-tdep.c	16 May 2008 12:49:47 -0000	1.52
+++ gdb/ppc-sysv-tdep.c	10 Jun 2008 23:57:00 -0000
@@ -177,13 +177,16 @@ ppc_sysv_abi_push_dummy_call (struct gdb
 	    }
 	  else if (len == 8
 		   && (TYPE_CODE (type) == TYPE_CODE_INT	/* long long */
-		       || TYPE_CODE (type) == TYPE_CODE_FLT))	/* double */
+		       || TYPE_CODE (type) == TYPE_CODE_FLT	/* double */
+		       || (TYPE_CODE (type) == TYPE_CODE_DECFLOAT
+			   && tdep->soft_float)))
 	    {
-	      /* "long long" or soft-float "double" passed in an odd/even
-	         register pair with the low addressed word in the odd
-	         register and the high addressed word in the even
-	         register, or when the registers run out an 8 byte
-	         aligned stack location.  */
+	      /* "long long" or soft-float "double" or "_Decimal64"
+	         passed in an odd/even register pair with the low
+	         addressed word in the odd register and the high
+	         addressed word in the even register, or when the
+	         registers run out an 8 byte aligned stack
+	         location.  */
 	      if (greg > 9)
 		{
 		  /* Just in case GREG was 10.  */
@@ -210,13 +213,16 @@ ppc_sysv_abi_push_dummy_call (struct gdb
 		  greg += 2;
 		}
 	    }
-	  else if (len == 16 && TYPE_CODE (type) == TYPE_CODE_FLT
-		   && (gdbarch_long_double_format (gdbarch)
-		       == floatformats_ibm_long_double))
+	  else if (len == 16
+		   && ((TYPE_CODE (type) == TYPE_CODE_FLT
+			&& (gdbarch_long_double_format (gdbarch)
+			    == floatformats_ibm_long_double))
+		       || (TYPE_CODE (type) == TYPE_CODE_DECFLOAT
+			   && tdep->soft_float)))
 	    {
-	      /* Soft-float IBM long double passed in four consecutive
-		 registers, or on the stack.  The registers are not
-		 necessarily odd/even pairs.  */
+	      /* Soft-float IBM long double or _Decimal128 passed in
+		 four consecutive registers, or on the stack.  The
+		 registers are not necessarily odd/even pairs.  */
 	      if (greg > 7)
 		{
 		  greg = 11;
@@ -596,11 +602,13 @@ do_ppc_sysv_return_value (struct gdbarch
 	}
       return RETURN_VALUE_REGISTER_CONVENTION;
     }
-  if (TYPE_CODE (type) == TYPE_CODE_FLT
-      && TYPE_LENGTH (type) == 16
-      && (gdbarch_long_double_format (gdbarch) == floatformats_ibm_long_double))
+  if (TYPE_LENGTH (type) == 16
+      && ((TYPE_CODE (type) == TYPE_CODE_FLT
+	   && (gdbarch_long_double_format (gdbarch) == floatformats_ibm_long_double))
+	  || (TYPE_CODE (type) == TYPE_CODE_DECFLOAT && tdep->soft_float)))
     {
-      /* Soft-float IBM long double stored in r3, r4, r5, r6.  */
+      /* Soft-float IBM long double or _Decimal128 stored in r3, r4,
+	 r5, r6.  */
       if (readbuf)
 	{
 	  regcache_cooked_read (regcache, tdep->ppc_gp0_regnum + 3, readbuf);
@@ -624,11 +632,14 @@ do_ppc_sysv_return_value (struct gdbarch
       return RETURN_VALUE_REGISTER_CONVENTION;
     }
   if ((TYPE_CODE (type) == TYPE_CODE_INT && TYPE_LENGTH (type) == 8)
-      || (TYPE_CODE (type) == TYPE_CODE_FLT && TYPE_LENGTH (type) == 8))
+      || (TYPE_CODE (type) == TYPE_CODE_FLT && TYPE_LENGTH (type) == 8)
+      || (TYPE_CODE (type) == TYPE_CODE_DECFLOAT && TYPE_LENGTH (type) == 8
+	  && tdep->soft_float))
     {
       if (readbuf)
 	{
-	  /* A long long, or a double stored in the 32 bit r3/r4.  */
+	  /* A long long, double or _Decimal64 stored in the 32 bit
+	     r3/r4.  */
 	  regcache_cooked_read (regcache, tdep->ppc_gp0_regnum + 3,
 				readbuf + 0);
 	  regcache_cooked_read (regcache, tdep->ppc_gp0_regnum + 4,
@@ -636,7 +647,8 @@ do_ppc_sysv_return_value (struct gdbarch
 	}
       if (writebuf)
 	{
-	  /* A long long, or a double stored in the 32 bit r3/r4.  */
+	  /* A long long, double or _Decimal64 stored in the 32 bit
+	     r3/r4.  */
 	  regcache_cooked_write (regcache, tdep->ppc_gp0_regnum + 3,
 				 writebuf + 0);
 	  regcache_cooked_write (regcache, tdep->ppc_gp0_regnum + 4,

-- 
Joseph S. Myers
joseph@codesourcery.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]