From 12bdaa7d3e94cf30f8ce1750325a245175bdbee5 Mon Sep 17 00:00:00 2001 From: Hans-Peter Nilsson Date: Tue, 28 Jan 2020 00:59:41 +0100 Subject: [PATCH] cris.md: Post-reload, split/generate clobberless zero source moves A separated follow-up to the previous change: Also emit moves from zero as not clobbering condition-codes. (note: actually folded into the previous ChangeLog-entry) gcc: * config/cris/cris.md ("movsi"): For a zero-source post-reload, generate a clobberless variant. ("*mov_fromzero_split"): New split. ("*mov_fromzero"): New insn. --- gcc/ChangeLog | 5 ++++- gcc/config/cris/cris.md | 19 +++++++++++++++++-- 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 6234bd71bdb..b6f7d46adeb 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -43,11 +43,14 @@ * config/cris/cris.h (REVERSIBLE_CC_MODE): Define to true. * config/cris/cris.md ("movsi"): For memory destination - post-reload, generate clobberless variant. + post-reload, generate clobberless variant. Similarly for a + zero-source post-reload. ("*mov_tomem_split"): New split. ("*mov_tomem"): New insn. ("enabled", mov_tomem_enabled): Define and use to exclude "x" -> "Q>m" for less-than-SImode. + ("*mov_fromzero_split"): New split. + ("*mov_fromzero"): New insn. 2020-05-08 Vladimir Makarov diff --git a/gcc/config/cris/cris.md b/gcc/config/cris/cris.md index 3de2f5a136f..bf2cf966387 100644 --- a/gcc/config/cris/cris.md +++ b/gcc/config/cris/cris.md @@ -449,8 +449,9 @@ /* At post-reload time, we'll get here for e.g. split multi-mode insns with a memory destination. Go directly to the clobber-less variant. - FIXME: Also applies to zero source. */ - if (MEM_P (operands[0]) && reload_completed) + FIXME: Also applies to special-register source or destination. */ + if (reload_completed + && (MEM_P (operands[0]) || operands[1] == const0_rtx)) { emit_insn (gen_rtx_SET (operands[0], operands[1])); DONE; @@ -697,6 +698,20 @@ move %1,%0" [(set_attr "slottable" "yes,yes,yes,no,no,no") (set_attr "enabled" "")]) + +(define_split ;; "*mov_fromzero_split" + [(set (match_operand:BWD 0 "register_operand") (const_int 0)) + (clobber (reg:CC CRIS_CC0_REGNUM))] + "reload_completed + && REGNO(operands[0]) <= CRIS_LAST_GENERAL_REGISTER" + [(set (match_dup 0) (const_int 0))] + "") + +(define_insn "*mov_fromzero" + [(set (match_operand:BWD 0 "register_operand" "=r") (const_int 0))] + "reload_completed" + "clear %0" + [(set_attr "slottable" "yes")]) ;; Movem patterns. Primarily for use in function prologue and epilogue. ;; Unfortunately, movem stores R0 in the highest memory location, thus -- 2.30.2