From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1923) id 8ECC53892440; Mon, 4 Jan 2021 19:21:04 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 8ECC53892440 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Philipp Tomsich To: gcc-cvs@gcc.gnu.org Subject: [gcc(refs/vendors/ventana/heads/minor-improvements-for-gcc11)] RISC-V: branch-(not)equals-zero compares against $zero X-Act-Checkin: gcc X-Git-Author: Philipp Tomsich X-Git-Refname: refs/vendors/ventana/heads/minor-improvements-for-gcc11 X-Git-Oldrev: 26450ce5aeab600c3b0ff5cc70b6d9e61205240f X-Git-Newrev: a3bc189dc9add2f3958c294362844bb79fcafc6f Message-Id: <20210104192104.8ECC53892440@sourceware.org> Date: Mon, 4 Jan 2021 19:21:04 +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: Mon, 04 Jan 2021 19:21:04 -0000 https://gcc.gnu.org/g:a3bc189dc9add2f3958c294362844bb79fcafc6f commit a3bc189dc9add2f3958c294362844bb79fcafc6f Author: Philipp Tomsich Date: Sun Aug 30 21:02:36 2020 +0200 RISC-V: branch-(not)equals-zero compares against $zero If we are testing a register or a paradoxical subreg (i.e. anything that is not a partial subreg) for equality/non-equality with zero, we can generate a branch that compares against $zero. This will work for QI, HI, SI and DImode, so we enable this for ANYI. 2020-08-30 gcc/ChangeLog: * config/riscv/riscv.md (*branch_equals_zero): Added pattern. Diff: --- gcc/config/riscv/riscv.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/gcc/config/riscv/riscv.md b/gcc/config/riscv/riscv.md index e6dfc7237cf..4a6037b9646 100644 --- a/gcc/config/riscv/riscv.md +++ b/gcc/config/riscv/riscv.md @@ -1856,6 +1856,19 @@ ;; Conditional branches +(define_insn "*branch_equals_zero" + [(set (pc) + (if_then_else + (match_operator 1 "equality_operator" + [(match_operand:ANYI 2 "register_operand" "r") + (const_int 0)]) + (label_ref (match_operand 0 "" "")) + (pc)))] + "!partial_subreg_p(operands[2])" + "b%C1\t%2,zero,%0" + [(set_attr "type" "branch") + (set_attr "mode" "none")]) + (define_insn "*branch" [(set (pc) (if_then_else