This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[m68k] Fix formatting of floating point numbers for the assembler
- From: Andreas Schwab <schwab at suse dot de>
- To: gcc-patches at gcc dot gnu dot org
- Date: Wed, 12 Nov 2008 17:34:17 +0100
- Subject: [m68k] Fix formatting of floating point numbers for the assembler
Printing a long that is wider than 32 bits can result in extra sign
extension bits being written out, which causes the assembler to barf
about a value that is too large. Only write exactly 32 bits for each
part of representation. Tested on m68k-linux.
Andreas.
2008-11-12 Andreas Schwab <schwab@suse.de>
* config/m68k/m68k.c (print_operand): Mask off extra extension
bits when writing out the representation of real values.
Index: gcc/config/m68k/m68k.c
===================================================================
--- gcc/config/m68k/m68k.c (revision 141786)
+++ gcc/config/m68k/m68k.c (working copy)
@@ -3888,7 +3888,7 @@ print_operand (FILE *file, rtx op, int l
long l;
REAL_VALUE_FROM_CONST_DOUBLE (r, op);
REAL_VALUE_TO_TARGET_SINGLE (r, l);
- asm_fprintf (file, "%I0x%lx", l);
+ asm_fprintf (file, "%I0x%lx", l & 0xFFFFFFFF);
}
else if (GET_CODE (op) == CONST_DOUBLE && GET_MODE (op) == XFmode)
{
@@ -3896,7 +3896,8 @@ print_operand (FILE *file, rtx op, int l
long l[3];
REAL_VALUE_FROM_CONST_DOUBLE (r, op);
REAL_VALUE_TO_TARGET_LONG_DOUBLE (r, l);
- asm_fprintf (file, "%I0x%lx%08lx%08lx", l[0], l[1], l[2]);
+ asm_fprintf (file, "%I0x%lx%08lx%08lx", l[0] & 0xFFFFFFFF,
+ l[1] & 0xFFFFFFFF, l[2] & 0xFFFFFFFF);
}
else if (GET_CODE (op) == CONST_DOUBLE && GET_MODE (op) == DFmode)
{
@@ -3904,7 +3905,7 @@ print_operand (FILE *file, rtx op, int l
long l[2];
REAL_VALUE_FROM_CONST_DOUBLE (r, op);
REAL_VALUE_TO_TARGET_DOUBLE (r, l);
- asm_fprintf (file, "%I0x%lx%08lx", l[0], l[1]);
+ asm_fprintf (file, "%I0x%lx%08lx", l[0] & 0xFFFFFFFF, l[1] & 0xFFFFFFFF);
}
else
{
--
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
PGP key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."