From patchwork Mon Aug 14 02:16:17 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans-Peter Nilsson X-Patchwork-Id: 135098 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b824:0:b0:3f2:4152:657d with SMTP id z4csp2471917vqi; Sun, 13 Aug 2023 19:16:54 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEd6EStxfg/4eeFsHRJgoTBZL1gOteCta+yzhyRYK3ej77DvrZcaQldLynyP/Adg37TA4sm X-Received: by 2002:a05:6512:1151:b0:4fb:97e8:bc1c with SMTP id m17-20020a056512115100b004fb97e8bc1cmr6855302lfg.54.1691979413811; Sun, 13 Aug 2023 19:16:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691979413; cv=none; d=google.com; s=arc-20160816; b=jhTmBrQsnzGJpcMFK2wZ+oSfLR1r3nNhIf9Gxms2hdHT/F4X4YCGZvcqZw3td2chfD YTLKJipknWprt5K4+1e4IGVTTxGcunvm9daJKBzk8eNRBPlNMe8Dlmmph9hm57WEMPnD WOT9CVpFaBS9W8eTNGtTSvwUvGS6fQssXqBk9YXBUDFzENh8CeJnxOAkHsRc6SrjU5Ak +GLDQVlB97w++gVU9FVS+jVInwfRehcAixjS7CdlHxCDUhuohFtYRO125kYfStOJFhHi HELhwr0VukVU67lNQbH4IdlTaharV2MQXVWkf+CzLxxtSfoXD1t98pqjT0b51bwH2ETM ptdQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:mime-version:user-agent :message-id:subject:cc:to:from:date:dmarc-filter:delivered-to; bh=ObGQ9z9oU0IG4IXW/iLc/rkgypm2waiJmM7ruIghcho=; fh=OwzjbcIAyr+G24y9chVZVFVrYNGwOHAP+MELOkKGgtk=; b=H/szFVdoCkNMY2qqns2DlqRVyZGL/VfzUebntBiecH+ZmO+svb/41xu5x4h0wF+/Tf 3XltZC0BQPjPq1zfI5ZVy/1XPWEuE2o4zIt3ECu5PjcWHe+JmAXQ4v2DBULDznCmn+Z7 anAT/p0l7RPJT2pvrSuLSVmS3zDw3LPSv9LXVFo6zbtDAoNW2qIHu9Ku7ItV6xEbPIDE qFgsncMZLl4PhiJsmr3fCXuFioeN3zvTr+XgV/QyJX5kmkhMZr59i0Crb3K77n3o4Tb3 2jWY8Rnl0k+HFKmDuwFIrbTcO/xHQihk/VfFu4DXwsx6VrUyHNz5f+1wyBMn8U3l3jJE +PAg== ARC-Authentication-Results: i=1; mx.google.com; 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" Received: from server2.sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id e22-20020a056402089600b0052567e6585dsi687568edy.72.2023.08.13.19.16.53 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 13 Aug 2023 19:16:53 -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; 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" Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id E6AD33858416 for ; Mon, 14 Aug 2023 02:16:39 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from arjuna.pair.com (arjuna.pair.com [209.68.5.131]) by sourceware.org (Postfix) with ESMTPS id 7A8073858D39 for ; Mon, 14 Aug 2023 02:16:17 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 7A8073858D39 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=bitrange.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=bitrange.com Received: by arjuna.pair.com (Postfix, from userid 3006) id 222BA8A639; Sun, 13 Aug 2023 22:16:17 -0400 (EDT) Received: from localhost (localhost [127.0.0.1]) by arjuna.pair.com (Postfix) with ESMTP id 1E63B8A56E; Sun, 13 Aug 2023 22:16:17 -0400 (EDT) Date: Sun, 13 Aug 2023 22:16:17 -0400 (EDT) From: Hans-Peter Nilsson X-X-Sender: hp@arjuna.pair.com To: gcc-patches@gcc.gnu.org cc: vmakarov@redhat.com Subject: [committed] MMIX: Handle LRA FP-to-SP-elimination oddity Message-ID: User-Agent: Alpine 2.20.16 (BSF 172 2016-09-29) MIME-Version: 1.0 X-Scanned-By: mailmunge 3.11 on 209.68.5.131 X-Spam-Status: No, score=-9.9 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_STATUS, SPF_HELO_NONE, SPF_PASS, TXREP 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: , Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1774169006019179608 X-GMAIL-MSGID: 1774169006019179608 When LRA is in progress, it can try and validate insns half-way through frame-pointer (FP) to stack-pointer (SP) elimination. Operands have then been substituted where the offset is from the SP elimination but the register is the (hard) frame-pointer: lra-eliminations.cc:lra_eliminate_regs_1:370: rtx to = subst_p ? ep->to_rtx : ep->from_rtx; In this regard reload played nicely. Unfortunately, the frame_pointer_operand predicate in mmix/predicates.md barfs on such an address. This broke the use of the MMIX frame_pointer_operand predicate (and the Yf constraint), used only in the nonlocal_goto_receiver expansion (which is used in e.g. code generated for C++ "catch"). Force MMIX frame_pointer_operand to accept an FP+offset for the duration of lra_in_progress. * config/mmix/predicates.md (frame_pointer_operand): Handle FP+offset when lra_in_progress. --- gcc/config/mmix/predicates.md | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/gcc/config/mmix/predicates.md b/gcc/config/mmix/predicates.md index 4a9b0177a786..64e77fa92d00 100644 --- a/gcc/config/mmix/predicates.md +++ b/gcc/config/mmix/predicates.md @@ -171,4 +171,14 @@ (define_predicate "frame_pointer_operand" (match_code "plus") (match_code "reg" "0") (match_code "const_int" "1") - (match_test "XEXP (op, 0) == stack_pointer_rtx")))) + (ior + (match_test "XEXP (op, 0) == stack_pointer_rtx") + ;; We can temporarily have a FP+offset here, where we (for FP) + ;; accept only FP and the equivalent elimination of SP+offset. + ;; See lra_eliminate_regs_1 in lra-eliminations.cc c:a line 370: + ;; "rtx to = subst_p ? ep->to_rtx : ep->from_rtx;" + (and + (match_test "lra_in_progress") + (ior + (match_test "XEXP (op, 0) == hard_frame_pointer_rtx") + (match_test "XEXP (op, 0) == frame_pointer_rtx")))))))