From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 115592 invoked by alias); 12 Feb 2020 06:54:39 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 115582 invoked by uid 89); 12 Feb 2020 06:54:38 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-21.8 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,MEDICAL_SUBJECT,SPF_PASS autolearn=ham version=3.3.1 spammy= X-HELO: smtp2.axis.com Received: from smtp2.axis.com (HELO smtp2.axis.com) (195.60.68.18) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 12 Feb 2020 06:54:37 +0000 IronPort-SDR: 44vLz4+NkjzQQkTYBgl+CSC7mV/Uz733qFLTg05AmH836jmLG/QGAv1BJU32DJpY+skKq6wUDR U64kXQrqUcWehcdKPbxRF/skqprdIlR91+WtJvxNhR+EJ2ujePifUzIYeNopWMgg0jkD28Xah6 8s4iXu7IbLUwfgJoAHC3xGBTWih2tAADyr+7CDFLsCIrHXdzjl8j0oZB6a5Q8dfj/bh4po6iZF K/BnM1VQWaVpWF/WHt/3ii4+OhcbRWVqakp705H9owwpXHax034mtG/5ZafAGiXC7G6EapDlXN agc= Date: Wed, 12 Feb 2020 06:54:00 -0000 Message-ID: <202002120654.01C6sYjq026507@ignucius.se.axis.com> From: Hans-Peter Nilsson To: Subject: [cris-decc0 4/14] cris.md: Post-reload, split/generate clobberless memory destination moves MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 8BIT Return-Path: hp@axis.com X-IsSubscribed: yes X-SW-Source: 2020-02/txt/msg00698.txt.bz2 * config/cris/cris.md ("movsi"): For memory destination post-reload, generate clobberless variant. ("*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. In preparation for compare-elimination (for it to be obviously useful), we have to have some common insn in-between that doesn't clobber condition-codes. A move to memory is an obvious choice. Note the FIXME: we can do this for a zero source too; later. --- gcc/config/cris/cris.md | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/gcc/config/cris/cris.md b/gcc/config/cris/cris.md index 0b42197a9..3de2f5a13 100644 --- a/gcc/config/cris/cris.md +++ b/gcc/config/cris/cris.md @@ -147,6 +147,7 @@ (define_delay (eq_attr "slottable" "has_return_slot") (not (match_test "dead_or_set_regno_p (insn, CRIS_SRP_REGNUM)"))) (nil) (nil)]) +(define_attr "enabled" "no,yes" (const_string "yes")) ;; Iterator definitions. @@ -445,6 +446,15 @@ (define_expand "movsi" && operands[1] != const0_rtx && can_create_pseudo_p ()) operands[1] = force_reg (SImode, operands[1]); + + /* 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) + { + emit_insn (gen_rtx_SET (operands[0], operands[1])); + DONE; + } }) (define_insn "*movsi_internal" @@ -650,6 +660,43 @@ (define_insn "movsf" move %1,%0 move %1,%0" [(set_attr "slottable" "yes,yes,yes,yes,yes,no,no,no,yes,yes,yes,no,yes,no")]) + +;; Post-reload, for memory destinations, split the clobber-variant and +;; get rid of the clobber. + +(define_split ;; "*mov_tomem_split" + [(set (match_operand:BWD 0 "memory_operand") + (match_operand:BWD 1 "nonmemory_operand")) + (clobber (reg:CC CRIS_CC0_REGNUM))] + "reload_completed" + [(set (match_dup 0) (match_dup 1))] + "") + +;; Exclude moving special-registers to memory from matching for +;; less-than-SImode, as they are SImode only (or actually, the size of +;; the register, but the ones free for "x" are naturally SImode; see +;; special measures taken for reload). +;; This might be a belt-and-suspenders thing, as a move from special +;; register to memory in less-than-SImode should not have made it here. + +(define_mode_attr mov_tomem_enabled + [(SI "yes,yes,yes,yes,yes,yes") + (HI "yes,yes,no,yes,yes,no") + (QI "yes,yes,no,yes,yes,no")]) + +(define_insn "*mov_tomem" + [(set (match_operand:BWD 0 "memory_operand" "=Q>,Q>,Q>,m,m,m") + (match_operand:BWD 1 "nonmemory_operand" "M, r, x, M,r,x"))] + "reload_completed" + "@ + clear %0 + move %1,%0 + move %1,%0 + clear %0 + move %1,%0 + move %1,%0" + [(set_attr "slottable" "yes,yes,yes,no,no,no") + (set_attr "enabled" "")]) ;; Movem patterns. Primarily for use in function prologue and epilogue. ;; Unfortunately, movem stores R0 in the highest memory location, thus -- 2.11.0 brgds, H-P