Patchwork Committed, MMIX: fix a port-bug outputting constants, improving test-results.

login
register
mail settings
Submitter Hans-Peter Nilsson
Date Oct. 8, 2012, 12:13 a.m.
Message ID <alpine.BSF.2.00.1210072011260.85288@dair.pair.com>
Download mbox | patch
Permalink /patch/189874/
State New
Headers show

Comments

Hans-Peter Nilsson - Oct. 8, 2012, 12:13 a.m.
Fixing this bug, which effectively caused 0 to be emitted instead of
constants requiring more than one actual insn to generate (through the
base-plus-offset support, kind-of macro insns), i.e. like "LDA
$2,#0lx" instead of "LDA $2,#ffffffffff", gets rid of 193 of the
regressions from (some-early-time) I see for mmix-knuth-mmixware
(regress-234 to regress-41), vastly improving results, somewhat as
follows:

                === gcc Summary ===

-# of expected passes           73786
-# of unexpected failures       918
+# of expected passes           74337
+# of unexpected failures       367

                === g++ Summary ===

-# of expected passes           45504
-# of unexpected failures       174
+# of expected passes           45536
+# of unexpected failures       142

                === objc Summary ===

-# of expected passes           1655
-# of unexpected failures       153
+# of expected passes           2985
+# of unexpected failures       7

                === libstdc++ Summary ===

-# of expected passes           6822
-# of unexpected failures       141
+# of expected passes           6907
+# of unexpected failures       56

It also brings down build+test from (wall-clock) about 7:09:24 to
5:01:46 on a yesteryear x86_64-linux host, mostly from the 17
eliminated timeouts.  (BTW, that's on top of improvements from 9:18:00
that I get from changing the simulator, start-up-files and newlib
low-level support to instrument and optionally require memory to be
explicitly allocated rather than implicitly allocated on access; lots
of eliminated timeouts.  Bugs are also quite a bit easier to diagnose.
Still quite a bit too high; it should be more like 3:30.  I'll post
the mmix-sim.ch when I've diagnosed all of the fallout from those
changes as bugs previously hidden by implicit allocation, rather than
subtle bugs in the new machinery.)

There *are* fall-out regressions with this patch:
+FAIL: objc/execute/exceptions/matcher-1.m execution,  -O0 -fgnu-runtime
+FAIL: objc/execute/exceptions/matcher-1.m execution,  -O1 -fgnu-runtime
+FAIL: objc/execute/exceptions/matcher-1.m execution,  -O2 -fgnu-runtime
+FAIL: objc/execute/exceptions/matcher-1.m execution,  -O3 -fomit-frame-pointer -fgnu-runtime
+FAIL: objc/execute/exceptions/matcher-1.m execution,  -O3 -g -fgnu-runtime
+FAIL: objc/execute/exceptions/matcher-1.m execution,  -Os -fgnu-runtime
but I'm just going to let that slide at the moment.  Not even sorry,
just happy that they're so few.  Before someone starts lecturing
me on knowingly introducing regressions, just don't.

There's also a bug in the assembler for letting "#0lx" through as "#0"
instead of erroring on the "lx".  Later.
Committed.

	* 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.


brgds, H-P

Patch

--- gcc/config/mmix/mmix.c.orig	2012-09-10 01:41:59.000000000 +0200
+++ gcc/config/mmix/mmix.c	2012-10-07 05:11:52.000000000 +0200
@@ -2499,19 +2499,9 @@  mmix_output_shiftvalue_op_from_str (FILE
 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_WID
   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");