This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC 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]

libffi ia64 fixes


This fixes five libffi testsuite failures on ia64, leaving 40 of them, and
adds one additional PASS.

Andreas.

2004-03-07  Andreas Schwab  <schwab@suse.de>

	* src/ia64/ffi.c (ffi_prep_incoming_args_UNIX): Get floating point
	arguments from fp registers only for the first 8 parameter slots.
	Don't convert a float parameter when passed in memory.

--- libffi/src/ia64/ffi.c.~1.5.~	2003-10-23 10:04:20.000000000 +0200
+++ libffi/src/ia64/ffi.c	2004-03-07 19:42:24.000000000 +0100
@@ -196,7 +196,7 @@ ffi_prep_args(struct ia64_args *stack, e
 	      *fp_argp++ = *(float *)(* p_argv);
 	    }
 	  /* Also put it into the integer registers or memory: */
-	    *(UINT64 *) argp = *(UINT32 *)(* p_argv);
+	  *(UINT64 *) argp = *(UINT32 *)(* p_argv);
 	  break;
 
 	case FFI_TYPE_DOUBLE:
@@ -204,7 +204,7 @@ ffi_prep_args(struct ia64_args *stack, e
 	  if (fp_argp - stack->fp_regs < 8)
 	    *fp_argp++ = *(double *)(* p_argv);
 	  /* Also put it into the integer registers or memory: */
-	    *(double *) argp = *(double *)(* p_argv);
+	  *(double *) argp = *(double *)(* p_argv);
 	  break;
 
 	case FFI_TYPE_STRUCT:
@@ -547,7 +547,7 @@ ffi_prep_incoming_args_UNIX(struct ia64_
   register unsigned int i;
   register unsigned int avn;
   register void **p_argv;
-  register unsigned long *argp = args -> out_regs;
+  register long *argp = args -> out_regs;
   unsigned fp_reg_num = 0;
   register ffi_type **p_arg;
 
@@ -576,17 +576,15 @@ ffi_prep_incoming_args_UNIX(struct ia64_
 	case FFI_TYPE_FLOAT:
 	  z = 1;
 	  /* Convert argument back to float in place from the saved value */
-	  if (fp_reg_num < 8) {
+	  if (argp - args->out_regs < 8 && fp_reg_num < 8) {
 	      *(float *)argp = args -> fp_regs[fp_reg_num++];
-	  } else {
-	      *(float *)argp = *(double *)argp;
 	  }
 	  *p_argv = (void *)argp;
 	  break;
 
 	case FFI_TYPE_DOUBLE:
 	  z = 1;
-	  if (fp_reg_num < 8) {
+	  if (argp - args->out_regs < 8 && fp_reg_num < 8) {
 	      *p_argv = args -> fp_regs + fp_reg_num++;
 	  } else {
 	      *p_argv = (void *)argp;
@@ -598,7 +596,8 @@ ffi_prep_incoming_args_UNIX(struct ia64_
 	      size_t sz = (*p_arg)->size;
 	      unsigned short element_type;
               z = ((*p_arg)->size + FFI_SIZEOF_ARG - 1)/FFI_SIZEOF_ARG;
-	      if (is_homogeneous_fp_aggregate(*p_arg, 8, &element_type)) {
+	      if (argp - args->out_regs < 8
+		  && is_homogeneous_fp_aggregate(*p_arg, 8, &element_type)) {
 		int nelements = sz/float_type_size(element_type);
 		if (nelements + fp_reg_num >= 8) {
 		  /* hard case NYI.	*/

-- 
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux AG, Maxfeldstraße 5, 90409 Nürnberg, Germany
Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."


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