PATCH: PR target/15290: __float128 failed to pass to function properly

H. J. Lu hjl@lucon.org
Wed May 5 18:26:00 GMT 2004


The problem is gcc uses REAL_VALUE_TO_TARGET_LONG_DOUBLE for
__float128. This patch added REAL_VALUE_TO_TARGET_QUAD_DOUBLE
and used it for __float128.


H.J.
-------------- next part --------------
2004-05-03  H.J. Lu  <hongjiu.lu@intel.com>

	* real.h (REAL_VALUE_TO_TARGET_QUAD_DOUBLE): New.

	* doc/tm.texi (REAL_VALUE_TO_TARGET_QUAD_DOUBLE): Documented.

	* config/i386/i386.c (ix86_split_to_parts): Use
	REAL_VALUE_TO_TARGET_QUAD_DOUBLE in TFmode.

--- gcc/config/i386/i386.c.quad	2004-04-27 10:59:01.000000000 -0700
+++ gcc/config/i386/i386.c	2004-05-05 10:51:06.000000000 -0700
@@ -10601,7 +10601,10 @@ ix86_split_to_parts (rtx operand, rtx *p
 	      long l[3];
 
 	      REAL_VALUE_FROM_CONST_DOUBLE (r, operand);
-	      REAL_VALUE_TO_TARGET_LONG_DOUBLE (r, l);
+	      if (mode == TFmode)
+		REAL_VALUE_TO_TARGET_QUAD_DOUBLE (r, l);
+	      else
+		REAL_VALUE_TO_TARGET_LONG_DOUBLE (r, l);
 	      /* Do not use shift by 32 to avoid warning on 32bit systems.  */
 	      if (HOST_BITS_PER_WIDE_INT >= 64)
 	        parts[0]
--- gcc/doc/tm.texi.quad	2004-03-16 08:55:43.000000000 -0800
+++ gcc/doc/tm.texi	2004-05-05 11:01:29.000000000 -0700
@@ -6380,6 +6380,7 @@ of @code{ASM_OUTPUT_DOUBLE} and the like
 @defmac REAL_VALUE_TO_TARGET_SINGLE (@var{x}, @var{l})
 @defmacx REAL_VALUE_TO_TARGET_DOUBLE (@var{x}, @var{l})
 @defmacx REAL_VALUE_TO_TARGET_LONG_DOUBLE (@var{x}, @var{l})
+@defmacx REAL_VALUE_TO_TARGET_QUAD_DOUBLE (@var{x}, @var{l})
 These translate @var{x}, of type @code{REAL_VALUE_TYPE}, to the target's
 floating point representation, and store its bit pattern in the variable
 @var{l}.  For @code{REAL_VALUE_TO_TARGET_SINGLE}, this variable should
@@ -6388,7 +6389,8 @@ be a simple @code{long int}.  For the ot
 the size of the desired target floating point data type: 32 bits of it
 go in each @code{long int} array element.  Each array element holds 32
 bits of the result, even if @code{long int} is wider than 32 bits on the
-host machine.
+host machine. @code{REAL_VALUE_TO_TARGET_QUAD_DOUBLE} is for
+@code{__float128} on supported targets.
 
 The array element values are designed so that you can print them out
 using @code{fprintf} in the order they should appear in the target
--- gcc/real.h.quad	2004-02-23 13:24:16.000000000 -0800
+++ gcc/real.h	2004-05-05 10:49:52.000000000 -0700
@@ -265,6 +265,10 @@ extern const struct real_format real_int
 #define REAL_VALUE_MINUS_ZERO(x)	real_isnegzero (&(x))
 
 /* IN is a REAL_VALUE_TYPE.  OUT is an array of longs.  */
+#define REAL_VALUE_TO_TARGET_QUAD_DOUBLE(IN, OUT)			\
+  real_to_target (OUT, &(IN), mode_for_size (128, MODE_FLOAT, 0))
+
+/* IN is a REAL_VALUE_TYPE.  OUT is an array of longs.  */
 #define REAL_VALUE_TO_TARGET_LONG_DOUBLE(IN, OUT)			\
   real_to_target (OUT, &(IN),						\
 		  mode_for_size (LONG_DOUBLE_TYPE_SIZE, MODE_FLOAT, 0))


More information about the Gcc-patches mailing list