Patchwork ARM fixed-point support [2/6]: assembler format for fixed-point constants

login
register
mail settings
Submitter Julian Brown
Date May 13, 2011, 1:57 p.m.
Message ID <20110513145734.0a9f4277@rex.config>
Download mbox | patch
Permalink /patch/95479/
State New
Headers show

Comments

Julian Brown - May 13, 2011, 1:57 p.m.
This patch changes the format used to print fixed-point constants from
hex to decimal. For instance a negative "short fract" fixed-point
constant may be represented as a signed HOST_WIDE_INT from -1 to -128,
which would currently be printed as e.g. 0xfff....ffxx, resulting in a
"bignum truncated to fit" warning from the assembler. This trouble is
avoided if we just print using integers instead, similarly to the way
signed character-constants are emitted elsewhere in the compiler.

Tested along with the rest of the patch series. OK to apply?

Julian

ChangeLog

    * final.c (output_addr_const): Print fixed-point constants as
    decimal not hex (avoiding an assembler overflow warning for
    negative byte constants).
Richard Earnshaw - June 30, 2011, 1:21 p.m.
On 13/05/11 14:57, Julian Brown wrote:
> This patch changes the format used to print fixed-point constants from
> hex to decimal. For instance a negative "short fract" fixed-point
> constant may be represented as a signed HOST_WIDE_INT from -1 to -128,
> which would currently be printed as e.g. 0xfff....ffxx, resulting in a
> "bignum truncated to fit" warning from the assembler. This trouble is
> avoided if we just print using integers instead, similarly to the way
> signed character-constants are emitted elsewhere in the compiler.
> 
> Tested along with the rest of the patch series. OK to apply?
> 
> Julian
> 
> ChangeLog
> 
>     * final.c (output_addr_const): Print fixed-point constants as
>     decimal not hex (avoiding an assembler overflow warning for
>     negative byte constants).
> 

OK (but remove the parenthetical part of the ChangeLog).

R.

Patch

commit 7c169485b6e5b153af02c83e8b858b8613ed7664
Author: Julian Brown <julian@henry8.codesourcery.com>
Date:   Fri May 13 05:44:19 2011 -0700

    Tweak fixed-point constant format.

diff --git a/gcc/final.c b/gcc/final.c
index 7e1ae90..b147ddf 100644
--- a/gcc/final.c
+++ b/gcc/final.c
@@ -3633,8 +3633,7 @@  output_addr_const (FILE *file, rtx x)
       break;
 
     case CONST_FIXED:
-      fprintf (file, HOST_WIDE_INT_PRINT_HEX,
-	       (unsigned HOST_WIDE_INT) CONST_FIXED_VALUE_LOW (x));
+      fprintf (file, HOST_WIDE_INT_PRINT_DEC, CONST_FIXED_VALUE_LOW (x));
       break;
 
     case PLUS: