diff mbox

Generate canonical infinity for the Motorola extended real format

Message ID 87zjge388w.fsf@igel.home
State New
Headers show

Commit Message

Andreas Schwab July 12, 2014, 3:30 p.m. UTC
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(+)

Comments

Andreas Schwab July 17, 2014, 8:41 a.m. UTC | #1
Since this only affects m68k I have pushed this now.

Andreas.
diff mbox

Patch

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