From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1880) id 64A743857C44; Thu, 12 Jan 2023 12:44:56 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 64A743857C44 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1673527496; bh=22nqrnRodY2YCMD59c5L1zrdq4kuwP1pmytlBjPmXWA=; h=From:To:Subject:Date:From; b=uAnieULXUKdBgACMFJAbdmEFp9FkUUQYyWgRVPFbMm7VCL8dMsxkXV7yZLVLi+xVN jCcxN3+xx2yKnsYUqTqDMxnzIqnA88S2RfORHMziHxJRBeMy0GHuCveeAFmqoOXNDj jIYPRGmZFXnyaRW9NNA8Eg1JD1vLkXDtdjMm5RtQ= 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-5121] xtensa: Optimize ctzsi2 and ffssi2 a bit X-Act-Checkin: gcc X-Git-Author: Takayuki 'January June' Suwa X-Git-Refname: refs/heads/master X-Git-Oldrev: bb65bd084a8739feb5b85f87135c531fc8b86572 X-Git-Newrev: 117be79bd84ed21b47588d0cd86d72d5d1757cae Message-Id: <20230112124456.64A743857C44@sourceware.org> Date: Thu, 12 Jan 2023 12:44:56 +0000 (GMT) List-Id: https://gcc.gnu.org/g:117be79bd84ed21b47588d0cd86d72d5d1757cae commit r13-5121-g117be79bd84ed21b47588d0cd86d72d5d1757cae Author: Takayuki 'January June' Suwa Date: Thu Jan 12 13:26:42 2023 +0900 xtensa: Optimize ctzsi2 and ffssi2 a bit This patch saves one byte when the Code Density Option is enabled, gcc/ChangeLog: * config/xtensa/xtensa.md (ctzsi2, ffssi2): Rearrange the emitting codes. Diff: --- gcc/config/xtensa/xtensa.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/gcc/config/xtensa/xtensa.md b/gcc/config/xtensa/xtensa.md index b4989832169..764da63f91c 100644 --- a/gcc/config/xtensa/xtensa.md +++ b/gcc/config/xtensa/xtensa.md @@ -477,8 +477,8 @@ emit_insn (gen_negsi2 (temp, operands[1])); emit_insn (gen_andsi3 (temp, temp, operands[1])); emit_insn (gen_clzsi2 (temp, temp)); - emit_insn (gen_negsi2 (temp, temp)); - emit_insn (gen_addsi3 (operands[0], temp, GEN_INT (31))); + emit_move_insn (operands[0], GEN_INT (31)); + emit_insn (gen_subsi3 (operands[0], operands[0], temp)); DONE; }) @@ -491,8 +491,8 @@ emit_insn (gen_negsi2 (temp, operands[1])); emit_insn (gen_andsi3 (temp, temp, operands[1])); emit_insn (gen_clzsi2 (temp, temp)); - emit_insn (gen_negsi2 (temp, temp)); - emit_insn (gen_addsi3 (operands[0], temp, GEN_INT (32))); + emit_move_insn (operands[0], GEN_INT (32)); + emit_insn (gen_subsi3 (operands[0], operands[0], temp)); DONE; })