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]

[PATCH] Generate canonical infinity for the Motorola extended real format


This patch fixes encode_ieee_extended_motorola to generate the canonical
infinity matching the bit pattern generated by the fpu (in the Motorola
variant of the extended real format the integer bit is ignored on input
and cleared on output, unlike the Intel variant).  This fixes the
ieee/copysign[12].c tests on m68k.

Andreas.

	* real.c (encode_ieee_extended_motorola): Clear integer bit in the
	infinity format.
---
 gcc/real.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/gcc/real.c b/gcc/real.c
index 231fc96..1c2f709 100644
--- a/gcc/real.c
+++ b/gcc/real.c
@@ -3481,6 +3481,11 @@ encode_ieee_extended_motorola (const struct real_format *fmt, long *buf,
   long intermed[3];
   encode_ieee_extended (fmt, intermed, r);
 
+  if (r->cl == rvc_inf)
+    /* For infinity clear the explicit integer bit again, so that the
+       format matches the canonical infinity generated by the FPU.  */
+    intermed[1] = 0;
+
   /* Motorola chips are assumed always to be big-endian.  Also, the
      padding in a Motorola extended real goes between the exponent and
      the mantissa.  At this point the mantissa is entirely within
-- 
2.0.1

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG 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]