From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ot1-x336.google.com (mail-ot1-x336.google.com [IPv6:2607:f8b0:4864:20::336]) by sourceware.org (Postfix) with ESMTPS id 2F39038303ED for ; Sat, 11 Jun 2022 23:13:50 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 2F39038303ED Received: by mail-ot1-x336.google.com with SMTP id c3-20020a9d6843000000b0060c2c63c337so1921824oto.5 for ; Sat, 11 Jun 2022 16:13:50 -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=I39MTyOylwQm1JvQYiWouNiD8HkophAG8F/8ulBB1Kk=; b=1u14AtQ2dk49NbmO8u5Lq6T+Prjyj6wbKEMkm1GyEmB40atZsbvHrlOsdtHWE+Vlcf DROhcltrgplqDfb9TQbD1TBeP2/xKh8OZhRPU8uVmjFhlYCXsKPZUn57jxYwlbdd8x9f 6MqYlKVXHGysBDUoe7zpYYqPeu1XCMMqrrC0BlbVPHxzqET2idCZm64F0AjqRLgWZARD u7vWN70PPrm245uifhn7x/cVSMOBklZRr8NRRwHTIL2ToeUbu43HGsiqJkdnxoPHpuy5 IkiPt0v6jxhsZC9ljGlPXjosLJHZ3h95kWrUNSRaSM0vOmuFV7YkcTiYjleSMR7UDymf alQg== X-Gm-Message-State: AOAM532nGxzfwl/hK8A7slClvLtAq9f8M0f4yCICFwCH/9+pDaTbphp6 jYoaqGhadzV/4Bbomr7WwexhFvd1wgIa7rpxVusRGXXxLu0r/g== X-Google-Smtp-Source: ABdhPJyJ+ubYhAV8OPD7ITXwGNJjmY2mSXjGmz3yydXnt9s47ll7qhKvUkbJOJGSEHKsk8Rvdvjz12KHcM1ge8ZDgfM= X-Received: by 2002:a9d:5c01:0:b0:60b:f1fc:3a04 with SMTP id o1-20020a9d5c01000000b0060bf1fc3a04mr16052090otk.204.1654989229605; Sat, 11 Jun 2022 16:13:49 -0700 (PDT) MIME-Version: 1.0 References: <90af87ac-56ce-a620-ce14-ecbb524b4e57@yahoo.co.jp> In-Reply-To: <90af87ac-56ce-a620-ce14-ecbb524b4e57@yahoo.co.jp> From: Max Filippov Date: Sat, 11 Jun 2022 16:13:38 -0700 Message-ID: Subject: Re: [PATCH 3/4] xtensa: Improve instruction cost estimation and suggestion To: "Takayuki 'January June' Suwa" Cc: GCC Patches Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-0.9 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: Sat, 11 Jun 2022 23:13:51 -0000 On Thu, Jun 9, 2022 at 9:26 PM Takayuki 'January June' Suwa wrote: > > This patch implements a new target-specific relative RTL insn cost function > because of suboptimal cost estimation by default, and fixes several "length" > insn attributes (related to the cost estimation). > > And also introduces a new machine-dependent option "-mextra-l32r-costs=" > that tells implementation-specific InstRAM/ROM access penalty for L32R > instruction to the compiler (in clock-cycle units, 0 by default). > > gcc/ChangeLog: > > * config/xtensa/xtensa.cc (xtensa_rtx_costs): Correct wrong case > for ABS and NEG, add missing case for BSWAP and CLRSB, and > double the costs for integer divisions using libfuncs if > optimizing for speed, in order to take advantage of fast constant > division by multiplication. > (TARGET_INSN_COST): New macro definition. > (xtensa_is_insn_L32R_p, xtensa_insn_cost): New functions for > calculating relative costs of a RTL insns, for both of speed and > size. > * config/xtensa/xtensa.md (return, nop, trap): Correct values of > the attribute "length" that depends on TARGET_DENSITY. > (define_asm_attributes, blockage, frame_blockage): Add missing > attributes. > * config/xtensa/xtensa.opt (-mextra-l32r-costs=): New machine- > dependent option, however, preparatory work for now. > --- > gcc/config/xtensa/xtensa.cc | 116 ++++++++++++++++++++++++++++++++--- > gcc/config/xtensa/xtensa.md | 29 ++++++--- > gcc/config/xtensa/xtensa.opt | 4 ++ > 3 files changed, 134 insertions(+), 15 deletions(-) Regtested for target=xtensa-linux-uclibc, no new regressions. Committed to master. -- Thanks. -- Max