From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1880) id 494C13858D35; Thu, 12 Jan 2023 12:44:51 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 494C13858D35 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1673527491; bh=JNClv3gq1UUtYCLMXx0bOVrKcetXl+IXvgi7Eyd/mjQ=; h=From:To:Subject:Date:From; b=xAlEgI9LlmhrowWqy5iTz1ByA7AMCnV0p8wzjqjtYzI4rlBERgq51XdxxlbF6hju6 oWt5ShJRiScfIjjaX8Wy7uwEzAHnEIYwOxIQQ18+/mkqaDtrlixcPmjIuU3nXCX3sC Q+x+vxheL0sKbloICJlDzsRGoBMxCDL9J30vQ3nc= MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Max Filippov To: gcc-cvs@gcc.gnu.org Subject: [gcc r13-5120] xtensa: Tune "*btrue" insn pattern X-Act-Checkin: gcc X-Git-Author: Takayuki 'January June' Suwa X-Git-Refname: refs/heads/master X-Git-Oldrev: dc22cf461278ace754042d9388a62afb002dfa0e X-Git-Newrev: bb65bd084a8739feb5b85f87135c531fc8b86572 Message-Id: <20230112124451.494C13858D35@sourceware.org> Date: Thu, 12 Jan 2023 12:44:51 +0000 (GMT) List-Id: https://gcc.gnu.org/g:bb65bd084a8739feb5b85f87135c531fc8b86572 commit r13-5120-gbb65bd084a8739feb5b85f87135c531fc8b86572 Author: Takayuki 'January June' Suwa Date: Thu Jan 12 13:25:58 2023 +0900 xtensa: Tune "*btrue" insn pattern This branch instruction has short encoding if EQ/NE comparison against immediate zero when the Code Density Option is enabled, but its "length" attribute was only for normal encoding. This patch fixes it. This patch also prevents undesireable replacement the comparison immediate zero of the instruction (short encoding, as mentioned above) with a register that has value of zero (normal encoding) by the postreload pass. gcc/ChangeLog: * config/xtensa/xtensa.md (*btrue): Correct value of the attribute "length" that depends on TARGET_DENSITY and operands, and add '?' character to the register constraint of the compared operand. Diff: --- gcc/config/xtensa/xtensa.md | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/gcc/config/xtensa/xtensa.md b/gcc/config/xtensa/xtensa.md index db1d68ee658..b4989832169 100644 --- a/gcc/config/xtensa/xtensa.md +++ b/gcc/config/xtensa/xtensa.md @@ -1679,7 +1679,7 @@ [(set (pc) (if_then_else (match_operator 3 "branch_operator" [(match_operand:SI 0 "register_operand" "r,r") - (match_operand:SI 1 "branch_operand" "K,r")]) + (match_operand:SI 1 "branch_operand" "K,?r")]) (label_ref (match_operand 2 "" "")) (pc)))] "" @@ -1688,7 +1688,14 @@ } [(set_attr "type" "jump,jump") (set_attr "mode" "none") - (set_attr "length" "3,3")]) + (set (attr "length") + (if_then_else (match_test "TARGET_DENSITY + && CONST_INT_P (operands[1]) + && INTVAL (operands[1]) == 0 + && (GET_CODE (operands[3]) == EQ + || GET_CODE (operands[3]) == NE)") + (const_int 2) + (const_int 3)))]) (define_insn "*ubtrue" [(set (pc)