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: 1810597 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=8.43.85.97; helo=server2.sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.a=rsa-sha256 header.s=default header.b=vwmRmneg; dkim-atps=neutral Received: from server2.sourceware.org (ip-8-43-85-97.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4R6MDc4ldwz20FK for ; Fri, 21 Jul 2023 04:49:34 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 7DEB7385C6D4 for ; Thu, 20 Jul 2023 18:49:32 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 7DEB7385C6D4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1689878972; bh=/4InrndntD7P9cSoCZ12uARDFmVm3BWWROQUEwwe0Jk=; h=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=vwmRmnegvRHFQ40u9IxE86NsieuouvPjMI09oaEsg+L3zgGmRaSKZGQ3Xg0Ey0hRE M8mmVmqEfe+dND71QjIUAxLMrCgi42IZ7K0hDcg2wEMmz6DMamG3p9ihWe2kAexpn7 RylspngfuVQ2f9VQhdmT2boJ1PGHrc02o2QYmcqI= 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-Google-Smtp-Source: APBJJlFcO8GZoa2Sv9zyX9tgu90CyK4lfWfI8UB4VCIEwfFNtoKbl5A2wtm0MT5kHh8Ps0QZ4/fJQg== 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+incoming=patchwork.ozlabs.org@gcc.gnu.org Sender: "Gcc-patches" 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))