public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH 0/4] Eliminate cc0 from m68k
@ 2019-11-13 13:08 Bernd Schmidt
  2019-11-13 13:09 ` [PATCH 1/4] Preliminary m68k patches Bernd Schmidt
                   ` (6 more replies)
  0 siblings, 7 replies; 87+ messages in thread
From: Bernd Schmidt @ 2019-11-13 13:08 UTC (permalink / raw)
  To: GCC Patches

This is a set of patches to convert m68k so that it no longer uses cc0.
The approach is to combine cc0 setter/user pairs into cbranch and cstore
patterns. It does not expose the flag register directly. Since m68k is a
target that is not under active development, and probably receives very
limited testing, I felt it was important to make it generate as close to
the same code as previously. Also, given that the target clobbers the
flags for pretty much every move, it seems unlikely that there's much
value to be had from anything more complex. Trying to model every
instruction's effect on the flags would be too error-prone for not
nearly enough gain.

The cc0 machinery allows for eliminating unnecessary comparisons by
examining the effect instructions have on the flags registers. I have
replicated that mechanism with a relatively modest amount of code based
on a final_postscan_insn hook, but it is now opt-in: an instruction
pattern can set the "flags_valid" attribute to a number of possible
values to indicate what effect it has. That should be more reliable (try
git log m68k.md to see recent sprinkling of CC_STATUS_INIT to squash
bugs with the previous mechanism).
We can remember either values where the flags indicate a comparison
against zero (after practically all arithmetic and move insns), or
alternatively record two comparison operands to eliminate identical
compares. I stopped adding optimizations once I found it hard to find
any meaningful differences in generated code. In particular, the
m68k.exp tests which verify that these optimizations are performed all
still pass.

Testing was done with the qemu-system-m68k/debian combination. I do not
have access to Coldfire hardware, and I tried to be somewhat
conservative, for example by not adding "flags_valid" everywhere it
would probably be possible. For someone with access to the hardware, it
should be trivial to add such attributes and test that everything still
works.
I'll have to rerun my final tests because test_summary made a mess of
things, but as far as I am able to tell, there are no regressions, and
the patch set even fixes some failures in libstdc++.

The first and second patch contain the m68k changes. They are separated
only to make the review easier, they were not tested separately (since
the time for a test run is measured in days). The first patch contains
preliminary cleanup and fixes, the second the main cc0 conversion. After
that, there are some changes in the rest of the compiler.


Bernd

^ permalink raw reply	[flat|nested] 87+ messages in thread
* Re: [PATCH 0/4] Eliminate cc0 from m68k
@ 2019-11-17 16:19 Mikael Pettersson
  2019-11-17 16:58 ` Andreas Schwab
  2019-11-21 14:36 ` John Paul Adrian Glaubitz
  0 siblings, 2 replies; 87+ messages in thread
From: Mikael Pettersson @ 2019-11-17 16:19 UTC (permalink / raw)
  To: Bernd Schmidt; +Cc: GCC Patches

On Wed, 13 Nov 2019 14:04:59 +0100, Bernd Schmidt
<bernds_cb1@t-online.de> wrote:
> This is a set of patches to convert m68k so that it no longer uses cc0.

Thank you for doing this.  I attempted a native bootstrap of
gcc-10-20191110 (r278028) plus the five patches posted so far on
m68k-linux (aranym), but it failed in stage 2:

/mnt/scratch/objdir10/./prev-gcc/xg++
-B/mnt/scratch/objdir10/./prev-gcc/
-B/mnt/scratch/install10/m68k-unknown-linux-gnu/bin/ -nostdinc++
-B/mnt/scratch/objdir10/prev-m68k-unknown-linux-gnu/libstdc++-v3/src/.libs
-B/mnt/scratch/objdir10/prev-m68k-unknown-linux-gnu/libstdc++-v3/libsupc++/.libs
 -I/mnt/scratch/objdir10/prev-m68k-unknown-linux-gnu/libstdc++-v3/include/m68k-unknown-linux-gnu
 -I/mnt/scratch/objdir10/prev-m68k-unknown-linux-gnu/libstdc++-v3/include
 -I/mnt/scratch/gcc-10-20191110/libstdc++-v3/libsupc++
-L/mnt/scratch/objdir10/prev-m68k-unknown-linux-gnu/libstdc++-v3/src/.libs
-L/mnt/scratch/objdir10/prev-m68k-unknown-linux-gnu/libstdc++-v3/libsupc++/.libs
-fno-PIE -c   -g -O2 -fno-checking -gtoggle -DIN_GCC
-fno-exceptions -fno-rtti -fasynchronous-unwind-tables -W -Wall
-Wno-narrowing -Wwrite-strings -Wcast-qual -Wno-error=format-diag
-Wmissing-format-attribute -Woverloaded-virtual -pedantic
-Wno-long-long -Wno-variadic-macros -Wno-overlength-strings -Werror
-DHAVE_CONFIG_H -I. -I. -I/mnt/scratch/gcc-10-20191110/gcc
-I/mnt/scratch/gcc-10-20191110/gcc/.
-I/mnt/scratch/gcc-10-20191110/gcc/../include
-I/mnt/scratch/gcc-10-20191110/gcc/../libcpp/include
-I/mnt/scratch/gcc-10-20191110/gcc/../libdecnumber
-I/mnt/scratch/gcc-10-20191110/gcc/../libdecnumber/dpd
-I../libdecnumber -I/mnt/scratch/gcc-10-20191110/gcc/../libbacktrace
-o dbxout.o -MT dbxout.o -MMD -MP -MF ./.deps/dbxout.TPo
/mnt/scratch/gcc-10-20191110/gcc/dbxout.c
/tmp/ccJA1qws.s: Assembler messages:
/tmp/ccJA1qws.s:4828: Error: operands mismatch -- statement `seq %a1' ignored
/tmp/ccJA1qws.s:7344: Error: operands mismatch -- statement `seq %a1' ignored
Makefile:1118: recipe for target 'dbxout.o' failed
make[3]: *** [dbxout.o] Error 1
make[3]: Leaving directory '/mnt/scratch/objdir10/gcc'
Makefile:4740: recipe for target 'all-stage2-gcc' failed
make[2]: *** [all-stage2-gcc] Error 2
make[2]: Leaving directory '/mnt/scratch/objdir10'
Makefile:20204: recipe for target 'stage2-bubble' failed
make[1]: *** [stage2-bubble] Error 2
make[1]: Leaving directory '/mnt/scratch/objdir10'
Makefile:20399: recipe for target 'bootstrap' failed
make: *** [bootstrap] Error 2

An Scc instruction cannot have an address register as destination operand.

I don't have a reduced test case, but the error can be reproduced by
building a cross gcc to m68k-linux and then using that to build a
native gcc for m68k-linux.

/Mikael

^ permalink raw reply	[flat|nested] 87+ messages in thread

end of thread, other threads:[~2019-11-29 17:24 UTC | newest]

Thread overview: 87+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-13 13:08 [PATCH 0/4] Eliminate cc0 from m68k Bernd Schmidt
2019-11-13 13:09 ` [PATCH 1/4] Preliminary m68k patches Bernd Schmidt
2019-11-13 20:37   ` Jeff Law
2019-11-14 12:25     ` Bernd Schmidt
2019-11-17 18:27       ` Jeff Law
2019-11-18 16:52       ` Jeff Law
2019-11-13 13:13 ` [PATCH 2/4] The main m68k cc0 conversion Bernd Schmidt
2019-11-13 13:29   ` Bernd Schmidt
2019-11-17 18:00     ` Jeff Law
     [not found]       ` <5bba50b1-f8de-42fb-1057-208b52c847fb@t-online.de>
2019-11-18 17:42         ` Bernd Schmidt
2019-11-18 17:55           ` Jeff Law
2019-11-23 17:36     ` John Paul Adrian Glaubitz
2019-11-23 19:54       ` Jeff Law
2019-11-23 20:53         ` Oleg Endo
2019-11-24 18:09           ` Jeff Law
2019-11-23 22:34         ` Bernd Schmidt
2019-11-24 10:25           ` Bernd Schmidt
2019-11-25 11:37             ` Andreas Schwab
2019-11-25 12:33               ` Bernd Schmidt
2019-11-25 13:51                 ` Andreas Schwab
2019-11-28 20:00             ` Gunther Nikl
2019-11-28 20:45               ` Bernd Schmidt
2019-11-25 12:34         ` Bernd Schmidt
2019-11-25 12:38           ` John Paul Adrian Glaubitz
2019-11-25 12:39             ` Bernd Schmidt
2019-11-25 12:44               ` John Paul Adrian Glaubitz
2019-11-25 12:40           ` Tobias Burnus
2019-11-25 13:08             ` Bernd Schmidt
2019-11-25 14:42             ` Segher Boessenkool
2019-11-25 14:46               ` John Paul Adrian Glaubitz
2019-11-29 17:32                 ` Segher Boessenkool
2019-11-26  0:49           ` Joseph Myers
2019-11-26  2:22             ` Bernd Schmidt
2019-11-26  2:45               ` Joseph Myers
2019-11-26  5:11                 ` Bernd Schmidt
2019-11-26 23:34                   ` Joseph Myers
2019-11-27  8:45                     ` Richard Biener
2019-11-26  8:04               ` John Paul Adrian Glaubitz
2019-11-13 13:21 ` [PATCH 3/4] Set costs for jumps in combine Bernd Schmidt
2019-11-13 16:26   ` Segher Boessenkool
2019-11-21 13:53     ` Bernd Schmidt
2019-11-22  0:52       ` Segher Boessenkool
2019-11-22  1:09         ` Bernd Schmidt
2019-11-22  2:43         ` Paul Koning
2019-11-22 16:57           ` Segher Boessenkool
2019-11-13 13:24 ` [PATCH 4/4] Fix autoinc cbranch Bernd Schmidt
2019-11-19  0:36   ` Segher Boessenkool
2019-11-24 14:20     ` Bernd Schmidt
2019-11-24 17:48       ` Segher Boessenkool
2019-11-24 19:55         ` Segher Boessenkool
2019-11-24 20:47           ` Bernd Schmidt
2019-11-24 22:20             ` Segher Boessenkool
2019-11-13 18:58 ` [PATCH 0/4] Eliminate cc0 from m68k Segher Boessenkool
2019-11-13 19:07   ` Bernd Schmidt
2019-11-13 19:25     ` Segher Boessenkool
2019-11-15 13:48     ` John Paul Adrian Glaubitz
2019-11-15 14:36       ` John Paul Adrian Glaubitz
2019-11-13 19:41 ` Jeff Law
2019-11-14 15:00   ` Richard Henderson
2019-11-15 13:49 ` Andreas Schwab
2019-11-15 16:34   ` Bernd Schmidt
2019-11-15 16:36     ` Andreas Schwab
2019-11-15 21:41       ` Bernd Schmidt
2019-11-15 22:21         ` Andreas Schwab
2019-11-15 22:22           ` Bernd Schmidt
2019-11-15 22:57             ` Andreas Schwab
2019-11-16  0:17               ` Bernd Schmidt
2019-11-16  8:26                 ` Andreas Schwab
2019-11-16 13:32                   ` Bernd Schmidt
2019-11-16 10:47                 ` Andreas Schwab
2019-11-16 12:16               ` John Paul Adrian Glaubitz
2019-11-17 16:19 Mikael Pettersson
2019-11-17 16:58 ` Andreas Schwab
2019-11-17 18:04   ` Jeff Law
2019-11-17 19:45   ` Mikael Pettersson
2019-11-18 19:39     ` Bernd Schmidt
2019-11-18 20:57       ` Mikael Pettersson
2019-11-20 13:52         ` Mikael Pettersson
2019-11-20 14:29           ` Bernd Schmidt
2019-11-20 16:59             ` Jeff Law
2019-11-20 20:04             ` Mikael Pettersson
2019-11-20 20:29               ` Jeff Law
2019-11-20 20:50               ` Bernd Schmidt
2019-11-20 22:18                 ` Richard Earnshaw
2019-11-21 12:32                   ` Matthias Klose
2019-11-21 14:02                     ` Bernd Schmidt
2019-11-21 14:36 ` John Paul Adrian Glaubitz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).