From patchwork Thu Jul 20 18:49:06 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Vladimir Makarov X-Patchwork-Id: 123429 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:c923:0:b0:3e4:2afc:c1 with SMTP id j3csp3315245vqt; Thu, 20 Jul 2023 11:49:57 -0700 (PDT) X-Google-Smtp-Source: APBJJlGQOMdYT5aURmeXdNWNrouSCOHePVUrHWaAiRI9EyLfFfr+tG959aRc6g7D00zpm8UwYEND X-Received: by 2002:a2e:8613:0:b0:2b8:3a1e:eec9 with SMTP id a19-20020a2e8613000000b002b83a1eeec9mr2208133lji.36.1689878996954; Thu, 20 Jul 2023 11:49:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689878996; cv=none; d=google.com; s=arc-20160816; b=coZ0CX+tEY56bmlmrhT1MPqZruNuLmhiMw97vJzQMvZ5rtVHEYKHqsPAL9IgB3fPZG aOWyYXxb5F48MaEAylGG6VnOcuQ/kAU7SbWyImpJ1Lflu8suhRxexIOSiTkmRdoptezJ kWOEVyMqRLD0uOGkcWJxuf2rj864iFhG6RfUEWyEQHkJCxthva2PG1MO8lMR2ObvKMpH nQdjmd2GYB8wbneHjEC8VJ+0NWwN/PUonwcgwOvi/5Ed52dp1hawCUYMW22fZyuYZCvb DDa62rYKWMDAO4Xp/eiy4l4ICug9LZ5GveUjj0XF6bR4GzxQgx/4nzkU84r72mf2vR6f vxag== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:from:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence:content-language :subject:to:user-agent:mime-version:date:message-id:dmarc-filter :delivered-to:dkim-signature:dkim-filter; bh=/4InrndntD7P9cSoCZ12uARDFmVm3BWWROQUEwwe0Jk=; fh=h0vFqS7cujiRJerHy6AGSU55RdXS18Wx8Z1jE0P/K4U=; b=cqVr+qO9vtbhPa4XTA3utc3b8ykDc9srV/Ln/Rjyb0fJFgt07iQczhno6HMQljJWO6 HJAK4hQuNeUVzy//dbQaD0cciC0nu1S/AtVLnyQyoeNBDDrdBz5yIYkXf2yRJjb7TMyv HtbykfR9zhOSDzIzn2mPzMOXyys9pN0Sd6BBAWc8haU9BMd8ATl7Ay/kLhoqTUdvZieb TI+rfUC0Z3YZ30xJUWFs7NPkCFYvgqtwHZM0vL/u/VnSH/tD0YvuiT2MdY42oRAZVgYs UTO1T5eVXcYzulibrMjPZP0jpKJjM8ZdafFsVsi0/iAe5ENxP3Op5XPbiLm6xojEPqen YNnQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=LW1TOa2k; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from server2.sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id l27-20020a1709060e1b00b009886d484ad6si1060673eji.759.2023.07.20.11.49.56 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Jul 2023 11:49:56 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=LW1TOa2k; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id C0BE1385482D for ; Thu, 20 Jul 2023 18:49:55 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C0BE1385482D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1689878995; bh=/4InrndntD7P9cSoCZ12uARDFmVm3BWWROQUEwwe0Jk=; h=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=LW1TOa2kTpwJNArsFsQKez7I+fOBaIAuiPtKh2XMv7jQYPExjKEw0ZyJ3q/lKzJOK QkHS4C5fHcXdUOkP0t05WKf46L6FFbkQoYF2EcLJRyAtDeDG4GrssN7eIuIZt/EK+b nBWnFEBCmcFB+gvmKSgQhKXXzOWmGnSc63X9U7dY= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id 74E8B3858CDB for ; Thu, 20 Jul 2023 18:49:12 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 74E8B3858CDB Received: from mail-qk1-f198.google.com (mail-qk1-f198.google.com [209.85.222.198]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-41-7nyE7t1LMX6J-YZsA3MwVw-1; Thu, 20 Jul 2023 14:49:10 -0400 X-MC-Unique: 7nyE7t1LMX6J-YZsA3MwVw-1 Received: by mail-qk1-f198.google.com with SMTP id af79cd13be357-7673e4eee45so140994385a.0 for ; Thu, 20 Jul 2023 11:49:10 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689878949; x=1690483749; h=subject:from:to:content-language:user-agent:mime-version:date :message-id:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=oWb+lbQ4oE7DOeBB0mDKy+Ej7HFKDC1i4Nx+Aqdjq60=; b=MutNW+26hDwY0UC2fG4WyP0tJTftRKjJ/A5xq6uW3OdTFgMr4SuSD2qTqKBL29dGkL WT6HRRZRGgk06nMSZFBG+6EWVaKl5LAl7iIombqHTB1BjorjIn+oNBqDrmZ2bhBazTBT B0Zp/L1tfxxKAzVH76b5QZ05Dl7Qsmx68v3xxvekLmfJr6ThvjgAJFtHEMnQsOYs5+nx wmSKpCY+K5S3YLOv6za3W9sSmo+R7xtiL5WTj0b6mHnhtcxTAsQb/2Sh0ol7V5xWySSN XV1w09ro20xK3Al+F+jeVpPuqCRsAsNiV+8vlOpoHICDaxmNF2pDOElpKYsZh9Hr4YBw durg== X-Gm-Message-State: ABy/qLYy6hhnkphtMjdrlbMlA4jzUNvUHGy2RvyOvROVT9J0UJwgEWV5 sLkYw0LMLQtIF+/2yB1yp6rq60S0QiOfLKBZZq7vkEkcWnFMhmOvAzWfC7QQcEodOv5vzN/YWpX gcPQUGGhphNZhnTV0o5k6K6bvrcHJlAgEGyeCQINn0Yy8kPlFIwHpXmmcA/AQRM3KnRxBze0h5x 0dMw== X-Received: by 2002:a05:620a:29c1:b0:75b:23a1:3ee with SMTP id s1-20020a05620a29c100b0075b23a103eemr8027811qkp.4.1689878948997; Thu, 20 Jul 2023 11:49:08 -0700 (PDT) X-Received: by 2002:a05:620a:29c1:b0:75b:23a1:3ee with SMTP id s1-20020a05620a29c100b0075b23a103eemr8027791qkp.4.1689878948522; Thu, 20 Jul 2023 11:49:08 -0700 (PDT) Received: from [192.168.1.88] (192-0-143-139.cpe.teksavvy.com. [192.0.143.139]) by smtp.gmail.com with ESMTPSA id j2-20020ae9c202000000b0075b13a89c30sm547436qkg.3.2023.07.20.11.49.07 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 20 Jul 2023 11:49:07 -0700 (PDT) Message-ID: Date: Thu, 20 Jul 2023 14:49:06 -0400 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.12.0 To: "gcc-patches@gcc.gnu.org" , SenthilKumar.Selvaraj@microchip.com Subject: [pushed][LRA]: Exclude reloading of frame pointer in subreg for some cases X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US X-Spam-Status: No, score=-11.5 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham 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-Patchwork-Original-From: Vladimir Makarov via Gcc-patches From: Vladimir Makarov Reply-To: Vladimir Makarov Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1771966559059823364 X-GMAIL-MSGID: 1771966559059823364 The following patch improves code for avr LRA port.  More explanation for the patch can be found in the commit message. The patch was successfully bootstrapped and tested on x86-64, aarch64, and ppc64le. commit 4b8878fbf7b74ea5c3405c9f558df0517036f131 Author: Vladimir N. Makarov Date: Thu Jul 20 14:34:26 2023 -0400 [LRA]: Exclude reloading of frame pointer in subreg for some cases LRA for avr port reloads frame pointer in subreg although we can just simplify the subreg. It results in generation of bad performance code. The following patch fixes this. gcc/ChangeLog: * lra-constraints.cc (simplify_operand_subreg): Check frame pointer simplification. diff --git a/gcc/lra-constraints.cc b/gcc/lra-constraints.cc index 76a155e99c2..f3784cf5a5b 100644 --- a/gcc/lra-constraints.cc +++ b/gcc/lra-constraints.cc @@ -1797,6 +1797,16 @@ simplify_operand_subreg (int nop, machine_mode reg_mode) alter_subreg (curr_id->operand_loc[nop], false); return true; } + auto fp_subreg_can_be_simplified_after_reload_p = [] (machine_mode innermode, + poly_uint64 offset, + machine_mode mode) { + reload_completed = 1; + bool res = simplify_subreg_regno (FRAME_POINTER_REGNUM, + innermode, + offset, mode) >= 0; + reload_completed = 0; + return res; + }; /* Force a reload of the SUBREG_REG if this is a constant or PLUS or if there may be a problem accessing OPERAND in the outer mode. */ @@ -1809,6 +1819,12 @@ simplify_operand_subreg (int nop, machine_mode reg_mode) >= hard_regno_nregs (hard_regno, mode)) && simplify_subreg_regno (hard_regno, innermode, SUBREG_BYTE (operand), mode) < 0 + /* Exclude reloading of frame pointer in subreg if frame pointer can not + be simplified here only because the reload is not finished yet. */ + && (hard_regno != FRAME_POINTER_REGNUM + || !fp_subreg_can_be_simplified_after_reload_p (innermode, + SUBREG_BYTE (operand), + mode)) /* Don't reload subreg for matching reload. It is actually valid subreg in LRA. */ && ! LRA_SUBREG_P (operand))