]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
mmix.c (mmix_output_octa): Don't assume HOST_WIDEST_INT_PRINT_HEX starts with "0x".
authorHans-Peter Nilsson <hp@bitrange.com>
Mon, 8 Oct 2012 00:10:20 +0000 (00:10 +0000)
committerHans-Peter Nilsson <hp@gcc.gnu.org>
Mon, 8 Oct 2012 00:10:20 +0000 (00:10 +0000)
* config/mmix/mmix.c (mmix_output_octa): Don't assume
HOST_WIDEST_INT_PRINT_HEX starts with "0x".  Instead use
HOST_WIDE_INT_PRINT_HEX_PURE, falling back to
HOST_WIDEST_INT_PRINT_UNSIGNED.

From-SVN: r192189

gcc/ChangeLog
gcc/config/mmix/mmix.c

index ef8297d7ed2674aabf76feea812a9b9c322dbbbe..8f944d7fd58167b9274c785dfecb3e9ae14a6355 100644 (file)
@@ -1,3 +1,10 @@
+2012-10-08  Hans-Peter Nilsson  <hp@bitrange.com>
+
+       * config/mmix/mmix.c (mmix_output_octa): Don't assume
+       HOST_WIDEST_INT_PRINT_HEX starts with "0x".  Instead use
+       HOST_WIDE_INT_PRINT_HEX_PURE, falling back to
+       HOST_WIDEST_INT_PRINT_UNSIGNED.
+
 2012-10-07  Richard Sandiford  <rdsandiford@googlemail.com>
 
        * machmode.h (GET_MODE_UNIT_PRECISION): New macro.
index d5d72dfdcadbc6b8116b688e02739063e698ed37..26668e76da8fa07bb393181e92d36a3f8c4a6593 100644 (file)
@@ -2499,19 +2499,9 @@ mmix_output_shiftvalue_op_from_str (FILE *stream,
 static void
 mmix_output_octa (FILE *stream, HOST_WIDEST_INT value, int do_begin_end)
 {
-  /* Snipped from final.c:output_addr_const.  We need to avoid the
-     presumed universal "0x" prefix.  We can do it by replacing "0x" with
-     "#0" here; we must avoid a space in the operands and no, the zero
-     won't cause the number to be assumed in octal format.  */
-  char hex_format[sizeof (HOST_WIDEST_INT_PRINT_HEX)];
-
   if (do_begin_end)
     fprintf (stream, "\tOCTA ");
 
-  strcpy (hex_format, HOST_WIDEST_INT_PRINT_HEX);
-  hex_format[0] = '#';
-  hex_format[1] = '0';
-
   /* Provide a few alternative output formats depending on the number, to
      improve legibility of assembler output.  */
   if ((value < (HOST_WIDEST_INT) 0 && value > (HOST_WIDEST_INT) -10000)
@@ -2520,8 +2510,13 @@ mmix_output_octa (FILE *stream, HOST_WIDEST_INT value, int do_begin_end)
   else if (value > (HOST_WIDEST_INT) 0
           && value < ((HOST_WIDEST_INT) 1 << 31) * 2)
     fprintf (stream, "#%x", (unsigned int) value);
-  else
-    fprintf (stream, hex_format, value);
+  else if (sizeof (HOST_WIDE_INT) == sizeof (HOST_WIDEST_INT))
+    /* We need to avoid the not-so-universal "0x" prefix; we need the
+       pure hex-digits together with the mmixal "#" hex prefix.  */
+    fprintf (stream, "#" HOST_WIDE_INT_PRINT_HEX_PURE,
+            (HOST_WIDE_INT) value);
+  else /* Need to avoid the hex output; there's no ...WIDEST...HEX_PURE.  */
+    fprintf (stream, HOST_WIDEST_INT_PRINT_UNSIGNED, value);
 
   if (do_begin_end)
     fprintf (stream, "\n");