From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-oi1-x229.google.com (mail-oi1-x229.google.com [IPv6:2607:f8b0:4864:20::229]) by sourceware.org (Postfix) with ESMTPS id 06ACC3836E72 for ; Thu, 26 May 2022 16:57:56 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 06ACC3836E72 Received: by mail-oi1-x229.google.com with SMTP id s188so2809591oie.4 for ; Thu, 26 May 2022 09:57:55 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=JUZVaOVrPTiv4BmMZ9IWS5p8L1YavCmZoeISg/R0/7A=; b=Yg1munH58nfHVi2BqHgSdOcSsId9mMqjqm566e3j17ExucmEXc+gG/tomrweh5GxA5 kGVp2ldXMqeIauyfbRbz3IrUFbbKzYohJ8zHT+8DwjcpAB+JwEDzJ7/sLWaFhPGG4+Wr itEVdCmd09o+Q+fGw85dPgLb57QcJV2tGhbevRz8mxipeB6o99prrlQlrwhyEg5k/MwW X44ZvdeApZHsPc/p4Wh475RYd1XphGBFQgVQtwkEYMFjbC0xbBW9PxB+65gXCX7vDuxl F4tYLlXv6nsgEm9LCfRsgkI2j2/sJt6Zn1f8kTWJIidFe63RvJi1fJEh+sPT+ea1D6+I t5MA== X-Gm-Message-State: AOAM53322XBZQzoDC1fMe99mnYoJWB3ZTBlquwnYH8c4M274Nv2cNp1+ k6Vk7ECCd97C0xs63/eQFAZgW6yl5ACZHtyD+WU= X-Google-Smtp-Source: ABdhPJxw3tyaWQY4ETEWjspr2timIDThGfNHx1MWeuWNnsef/VkUN0iiJYDJaU7SKex90I/8+Dy7Z/ztVNCsJWonPkM= X-Received: by 2002:a05:6808:1202:b0:2f9:c7b4:fd56 with SMTP id a2-20020a056808120200b002f9c7b4fd56mr1660809oil.55.1653584275209; Thu, 26 May 2022 09:57:55 -0700 (PDT) MIME-Version: 1.0 References: <87b80e93-0031-d847-9120-ceccd79c1a37@yahoo.co.jp> In-Reply-To: <87b80e93-0031-d847-9120-ceccd79c1a37@yahoo.co.jp> From: Max Filippov Date: Thu, 26 May 2022 09:57:44 -0700 Message-ID: Subject: Re: [PATCH v3 4/5] xtensa: Add setmemsi insn pattern To: "Takayuki 'January June' Suwa" Cc: GCC Patches Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-1.0 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, FROM_LOCAL_NOVOWEL, HK_RANDOM_ENVFROM, HK_RANDOM_FROM, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 26 May 2022 16:57:57 -0000 On Mon, May 23, 2022 at 8:52 AM Takayuki 'January June' Suwa wrote: > > This patch introduces setmemsi insn pattern of two kinds, unrolled loop and > small loop, for fixed small length and constant initialization value. > > gcc/ChangeLog: > > * gcc/config/xtensa/xtensa-protos.h > (xtensa_expand_block_set_unrolled_loop, > xtensa_expand_block_set_small_loop): New prototypes. > * gcc/config/xtensa/xtensa.cc (xtensa_sizeof_MOVI, > xtensa_expand_block_set_unrolled_loop, > xtensa_expand_block_set_small_loop): New functions. > * gcc/config/xtensa/xtensa.md (setmemsi): New expansion pattern. > * gcc/config/xtensa/xtensa.opt (mlongcalls): Add target mask. > --- > gcc/config/xtensa/xtensa-protos.h | 2 + > gcc/config/xtensa/xtensa.cc | 211 ++++++++++++++++++++++++++++++ > gcc/config/xtensa/xtensa.md | 16 +++ > gcc/config/xtensa/xtensa.opt | 2 +- > 4 files changed, 230 insertions(+), 1 deletion(-) With this patch applied for the following test program void f(char *p); void g(void) { char c[72] = {0}; f(c); } the following code is generated with -O2: .text .literal_position .literal .LC0, f@PLT .align 4 .global g .type g, @function g: entry sp, 112 movi.n a10, 0 s32i.n a10, sp, 0 addi.n a9, sp, 4 movi.n a8, 0x11 loop a8, .L2_LEND .L2: s32i.n a10, a9, 0 addi.n a9, a9, 4 .L2_LEND: l32r a8, .LC0 mov.n a10, sp callx8 a8 retw.n The part s32i.n a10, sp, 0 addi.n a9, sp, 4 movi.n a8, 0x11 looks redundant and could be just mov a9, sp movi a8, 0x12 is that something that can be addressed in this patch? -- Thanks. -- Max