[Bug target/91851] [m68k] Convert the backend to MODE_CC so it can be kept in future releases

2019-11-25 Thread bernds at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91851

Bernd Schmidt  changed:

   What|Removed |Added

 Status|UNCONFIRMED |RESOLVED
 Resolution|--- |FIXED

--- Comment #9 from Bernd Schmidt  ---
Fixed.

[Bug target/91851] [m68k] Convert the backend to MODE_CC so it can be kept in future releases

2019-11-25 Thread bernds at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91851

--- Comment #8 from Bernd Schmidt  ---
Author: bernds
Date: Mon Nov 25 12:31:16 2019
New Revision: 278681

URL: https://gcc.gnu.org/viewcvs?rev=278681&root=gcc&view=rev
Log:
Convert m68k to not use cc0

* config/m68k/m68k.c (output_move_himode, output_move_qimode):
Replace code for non-CONST_INT constants with gcc_unreachable.
* config/m68k/m68k.md (cbranchdi): Don't generate individual
compare and test.
(CMPMODE): New mode_iterator.
(cbranchsi4, cbranchqi4, cbranchhi4): Replace expanders with
cbranch4.
(cstoresi4, cstoreqi4, cstorehi4): Replace expanders with
cstore4.
(cmp_68881): Remove 'F' constraint from first comparison
operand.
(bit test insns patterns): Use nonimmediate_operand, not
register_operand, for source operands that allow memory in
their constraints.
(divmodsi4, udivmodsi4, divmodhi4 and related unnamed patterns):
Use register_operand, not nonimmediate_operand, for the
destinations.
(DBCC): New mode_iterator.
(dbcc peepholes): Use it to reduce duplication.
(trap): Use const_true_rtx, not const1_rtx.
* config/m68k/predicates.md (m68k_comparison_operand): Renamed
from m68k_subword_comparison_operand and changed to handle
SImode.

PR target/91851
* config/m68k/m68k-protos.h (output-dbcc_and_branch): Adjust
declaration.
(m68k_init_cc): New declaration.
(m68k_output_compare_di, m68k_output_compare_si)
(m68k_output_compare_hi, m68k_output_compare_qi)
(m68k_output_compare_fp, m68k_output_btst, m68k_output_bftst)
(m68k_find_flags_value, m68k_output_scc, m68k_output_scc_float)
(m68k_output_branch_integer, m68k_output_branch_integer_rev.
m68k_output_branch_float, m68k_output_branch_float_rev):
Likewise.
(valid_dbcc_comparison_p_2, flags_in_68881)
(output_btst): Remove declaration.
* config/m68k/m68k.c (INCLDUE_STRING): Define.
(TARGET_ASM_FINAL_POSTSCAN_INSN): Define.
(valid_dbcc_comparison_p_2, flags_in_68881): Delete functions.
(flags_compare_op0, flags_compare_op1, flags_operand1,
flags_operand2, flags_valid): New static variables.
(m68k_find_flags_value, m68k_init_cc): New functions.
(handle_flags_for_move, m68k_asm_final_postscan_insn,
remember_compare_flags): New static functions.
(output_dbcc_and_branch): New argument CODE.  Use it, and add
PLUS and MINUS to the possible codes.  All callers changed.
(m68k_output_btst): Renamed from output_btst.  Remove OPERANDS
and INSN arguments, add CODE arg.  Return the comparison code
to use.  All callers changed.  Use CODE instead of
next_insn_tests_no_inequality, and replace cc_status management
with changing the return code.
(m68k_rtx_costs): Instead of testing for COMPARE, test for
RTX_COMPARE or RTX_COMM_COMPARE.
(output_move_simode, output_move_qimode): Call
handle_flags_for_move.
(notice_update_cc): Delete function.
(m68k_output_bftst, m68k_output_compare_di, m68k_output_compare_si,
m68k_output_compare_hi, m68k_output_compare_qi,
m68k_output_compare_fp, m68k_output_branch_integer,
m68k_output_branch_integer_rev, m68k_output_scc,
m68k_output_branch_float, m68k_output_branch_float_rev,
m68k_output_scc_float): New functions.
(output_andsi3, output_iorsi3, output_xorsi3): Call CC_STATUS_INIT
once at the start, and set flags_valid and flags_operand1 if the
flags are usable.
* config/m68k/m68k.h (CC_IN_68881, NOTICE_UPDATE_CC,
CC_OVERFLOW_UNUSABLE, CC_NO_CARRY, OUTPUT_JUMP): Remove
definitions.
(CC_STATUS_INIT): Define.
* config/m68k/m68k.md (flags_valid): New define_attr.
(tstdi, tstsi_internal_68020_cf, tstsi_internal, tsthi_internal,
tstqi_internal, tst_68881, tst_cf, cmpdi_internal,
cmpdi, unnamed cmpsi/cmphi/cmpqi patterns, cmpsi_cf,
cmp_68881, cmp_cf, unnamed btst patterns,
tst_bftst_reg, tst_bftst_reg, unnamed scc patterns, scc,
sls, sordered_1, sunordered_1, suneq_1, sunge_1, sungt_1,
sunle_1, sunlt_1, sltgt_1, fsogt_1, fsoge_1, fsolt_1, fsole_1,
bge0_di, blt0_di, beq, bne, bgt, bgtu, blt, bltu, bge, bgeu,
ble, bleu, bordered, bunordered, buneq, bunge, bungt, bunle,
bunlt, bltgt, beq_rev, bne_rev, bgt_rev, bgtu_rev,
blt_rev, bltu_rev, bge_rev, bgeu_rev, ble_rev, bleu_rev,
bordered_rev, bunordered_rev, buneq_rev, bunge_rv, bungt_rev,
bunle_rev, bunlt_rev, bltgt_rev, ctrapdi4, ctrapsi4, ctraphi4,
ctrapqi4, conditional_trap): Delete patterns.
(cbranchdi4_insn): New pattern.
(cbranchdi4): Don't generate cc0 patterns.  When te

[Bug target/91851] [m68k] Convert the backend to MODE_CC so it can be kept in future releases

2019-11-22 Thread mc68k at zetmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91851

mc68k at zetmail dot com changed:

   What|Removed |Added

 CC||mc68k at zetmail dot com

--- Comment #7 from mc68k at zetmail dot com ---
(In reply to Tobias Burnus from comment #6)
> A seemingly independent conversation to ccmode + lra has been posted by
> Coerl [I don't know whether he has a FSF copyright assignment] at
> https://gcc.gnu.org/ml/gcc-patches/2019-11/msg02131.html

what document is required for this?

[Bug target/91851] [m68k] Convert the backend to MODE_CC so it can be kept in future releases

2019-11-22 Thread burnus at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91851

--- Comment #6 from Tobias Burnus  ---
A seemingly independent conversation to ccmode + lra has been posted by Coerl
[I don't know whether he has a FSF copyright assignment] at
https://gcc.gnu.org/ml/gcc-patches/2019-11/msg02131.html

[Bug target/91851] [m68k] Convert the backend to MODE_CC so it can be kept in future releases

2019-11-13 Thread glaubitz at physik dot fu-berlin.de
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91851

--- Comment #5 from John Paul Adrian Glaubitz  ---
(In reply to Tobias Burnus from comment #4)
> Bernd posted the CC0-to-MODE_CC patches for review, cf:
> 
> https://gcc.gnu.org/ml/gcc-patches/2019-11/msg01028.html [0/4]
> https://gcc.gnu.org/ml/gcc-patches/2019-11/msg01029.html [1/4]
> https://gcc.gnu.org/ml/gcc-patches/2019-11/msg01030.html [2/4]
> https://gcc.gnu.org/ml/gcc-patches/2019-11/msg01031.html [3/4]
> https://gcc.gnu.org/ml/gcc-patches/2019-11/msg01032.html [4/4]

Woohoo, awesome. I'm really impressed how fast that was.

> Side remark: once MODE_CC is used, at some point the register allocator
> should also be changed from 'reload' to LRA, cf.
> https://gcc.gnu.org/wiki/LRAIsDefault ; for now, only CC0 was suggested to
> be deprecated in GCC 10 and scheduled for removal in GCC 11, cf.
> https://gcc.gnu.org/ml/gcc-patches/2019-09/msg01256.html – still, getting
> rid of reload is also a goal.

If Bernd could make that switch as well, that would be awesome but since it was
not in the original Bounty I'm not sure it would be fair to ask for that to be
done as well.

[Bug target/91851] [m68k] Convert the backend to MODE_CC so it can be kept in future releases

2019-11-13 Thread burnus at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91851

--- Comment #4 from Tobias Burnus  ---
Bernd posted the CC0-to-MODE_CC patches for review, cf:

https://gcc.gnu.org/ml/gcc-patches/2019-11/msg01028.html [0/4]
https://gcc.gnu.org/ml/gcc-patches/2019-11/msg01029.html [1/4]
https://gcc.gnu.org/ml/gcc-patches/2019-11/msg01030.html [2/4]
https://gcc.gnu.org/ml/gcc-patches/2019-11/msg01031.html [3/4]
https://gcc.gnu.org/ml/gcc-patches/2019-11/msg01032.html [4/4]

Side remark: once MODE_CC is used, at some point the register allocator should
also be changed from 'reload' to LRA, cf. https://gcc.gnu.org/wiki/LRAIsDefault
; for now, only CC0 was suggested to be deprecated in GCC 10 and scheduled for
removal in GCC 11, cf. https://gcc.gnu.org/ml/gcc-patches/2019-09/msg01256.html
– still, getting rid of reload is also a goal.

[Bug target/91851] [m68k] Convert the backend to MODE_CC so it can be kept in future releases

2019-11-11 Thread glaubitz at physik dot fu-berlin.de
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91851

--- Comment #3 from John Paul Adrian Glaubitz  ---
Forgot to mention: The task is considered completed when the necessary changes
have been merged upstream so that m68k will be part of GCC-11 and newer
releases.

[Bug target/91851] [m68k] Convert the backend to MODE_CC so it can be kept in future releases

2019-10-27 Thread glaubitz at physik dot fu-berlin.de
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91851

--- Comment #2 from John Paul Adrian Glaubitz  ---
(In reply to John Paul Adrian Glaubitz from comment #1) 
> > https://wiki.debian.org/M68k/QemuSystemM68k
> 
> The guide is not complete yet, I will finish it throughout next week.

The code has been completed now after a regression in the serial emulation in
qemu-system-m68k was fixed. Following through the guide now yields a fully
usable Debian/m68k system running on an emulated Macintosh Quadra 800.

> The bounty on BountySource.com can be found at:
> 
> > https://www.bountysource.com/issues/80706251-m68k-convert-the-backend-to-mode_cc-so-it-can-be-kept-in-future-releases

The bounty is now at $5000 with 43 backers.

[Bug target/91851] [m68k] Convert the backend to MODE_CC so it can be kept in future releases

2019-09-29 Thread glaubitz at physik dot fu-berlin.de
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91851

--- Comment #1 from John Paul Adrian Glaubitz  ---
I have created a guide which explains how to install Debian inside an emulated
qemu-system-m68k VM:

> https://wiki.debian.org/M68k/QemuSystemM68k

The guide is not complete yet, I will finish it throughout next week.

The bounty on BountySource.com can be found at:

> https://www.bountysource.com/issues/80706251-m68k-convert-the-backend-to-mode_cc-so-it-can-be-kept-in-future-releases