From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2119) id 8C0F339B343C; Fri, 18 Jun 2021 22:05:21 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 8C0F339B343C MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Jeff Law To: gcc-cvs@gcc.gnu.org Subject: [gcc r12-1654] [committed] More useless code elimination on the H8 X-Act-Checkin: gcc X-Git-Author: Jeff Law X-Git-Refname: refs/heads/master X-Git-Oldrev: cb448ade74da1de1633e6ed97f8c5ecbac24b27a X-Git-Newrev: 629cbc682a773e64c4bcb800ea98fb3051cd810c Message-Id: <20210618220521.8C0F339B343C@sourceware.org> Date: Fri, 18 Jun 2021 22:05:21 +0000 (GMT) X-BeenThere: gcc-cvs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 18 Jun 2021 22:05:21 -0000 https://gcc.gnu.org/g:629cbc682a773e64c4bcb800ea98fb3051cd810c commit r12-1654-g629cbc682a773e64c4bcb800ea98fb3051cd810c Author: Jeff Law Date: Fri Jun 18 18:02:16 2021 -0400 [committed] More useless code elimination on the H8 gcc/ * config/h8300/h8300.c (h8300_select_cc_mode): Handle SYMBOL_REF. * config/h8300/logical.md (3 logcial expander): Generate more efficient code when the source can be trivially simplified. Diff: --- gcc/config/h8300/h8300.c | 2 +- gcc/config/h8300/logical.md | 22 +++++++++++++++++++++- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/gcc/config/h8300/h8300.c b/gcc/config/h8300/h8300.c index 1077a2b6ae0..2b88325d2f7 100644 --- a/gcc/config/h8300/h8300.c +++ b/gcc/config/h8300/h8300.c @@ -1950,7 +1950,7 @@ h8300_select_cc_mode (enum rtx_code cond, rtx op0, rtx op1) || GET_CODE (op0) == NEG || GET_CODE (op0) == AND || GET_CODE (op0) == IOR || GET_CODE (op0) == XOR || GET_CODE (op0) == NOT || GET_CODE (op0) == ASHIFT - || GET_CODE (op0) == MULT + || GET_CODE (op0) == MULT || GET_CODE (op0) == SYMBOL_REF || GET_CODE (op0) == SIGN_EXTEND || GET_CODE (op0) == ZERO_EXTEND || REG_P (op0) || MEM_P (op0))) return CCZNmode; diff --git a/gcc/config/h8300/logical.md b/gcc/config/h8300/logical.md index cb4c6384bdf..07d36cf0ef4 100644 --- a/gcc/config/h8300/logical.md +++ b/gcc/config/h8300/logical.md @@ -4,7 +4,27 @@ (logicals:QHSI (match_operand:QHSI 1 "register_operand" "") (match_operand:QHSI 2 "h8300_src_operand" "")))] "" - "") + " + { + enum machine_mode mode = GET_MODE (operands[0]); + /* DImodes are not considered tieable, as a result operations involving + subregs of DImode objects are considered expensive which can prevent + CSE from doing obvious simplifications. + + We may ultimately change what is tieable, but this is an immediate + workaround while we evaluate changes to tieable modes. + + The key in terms of what we want to handle is then the result of + the operation is not a constant. */ + if (( == AND && operands[2] == CONSTM1_RTX (mode)) + || ( == IOR && operands[2] == CONST0_RTX (mode)) + || ( == XOR && operands[2] == CONST0_RTX (mode)) + || (( == AND || == IOR) && operands[1] == operands[2])) + { + emit_move_insn (operands[0], operands[1]); + DONE; + } + }") ;; There's a ton of cleanup to do from here below. ;; ----------------------------------------------------------------------