From patchwork Sun Jun 18 17:29:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Law X-Patchwork-Id: 1796260 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=2620:52:3:1:0:246e:9693:128c; helo=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=N8dwstHF; dkim-atps=neutral Received: from sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (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 4Qkfz54Fs4z20WT for ; Mon, 19 Jun 2023 03:29:35 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 6AED53858431 for ; Sun, 18 Jun 2023 17:29:33 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 6AED53858431 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1687109373; bh=jbsLngspgJJgEOghLrMVJbFLU1zAqXAv+ax4Cwxs8pk=; h=Date:Subject:To:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=N8dwstHFF094KaGwoyPQOKKFgAk1zmrQU3Po1OgZq0r77/AV5z7mO+sR5+t9aPNfE odq0XN2L5UCMvNK1nI5xtWiZpmDUHlUsA8AHpT1k0SVFvLgZZ1pPqIKM+6y7RH7K/R tQdn+Du4nX5U2YUK8ssX+zZd2sFy5bo5MT6F/t8o= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-pj1-x1032.google.com (mail-pj1-x1032.google.com [IPv6:2607:f8b0:4864:20::1032]) by sourceware.org (Postfix) with ESMTPS id 1550D3858D28 for ; Sun, 18 Jun 2023 17:29:12 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 1550D3858D28 Received: by mail-pj1-x1032.google.com with SMTP id 98e67ed59e1d1-25e8b2931f2so2073110a91.2 for ; Sun, 18 Jun 2023 10:29:12 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687109350; x=1689701350; h=to:subject:from:content-language:user-agent:mime-version:date :message-id:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=jbsLngspgJJgEOghLrMVJbFLU1zAqXAv+ax4Cwxs8pk=; b=VGX9B53v2BxHNGWLKEBscXv8QjYJFhmKBzMMSVwps1I5+xEkg7ozY4qvpBtGEiGPKn IVfvV277pIRFoV4clANgOfBSpfcQvqaqk8VSIDz1eNiiIbY+0O8upIL8qPZkSzZvfS/b wmuVn+L0N2KgiR+fYZYj9FoRGXuI+dH6u84VPqKDpHlmY+kzOnn2nZY5pA91JKpCwzap 4w7k7OdEiia3EXO0MebIJNyFfSW8/iNF/sRJSjYOf98rGb21Ewot1f7rDc+nq/mWkM3m 5AnHE1c9HKeKXKnumQDcAstHKA0ilbc/qmv7ZaKpT3dwrMHaS6rtHbuV5VgnL794jXgI XiQA== X-Gm-Message-State: AC+VfDzivxVeCtUEL6aPjPaSHxSKazkW5b6eCYnd+SJxk+JPD2pwgnzW 9ciiAK7L4vr2fO3n+lzqg2KW5TZqddA= X-Google-Smtp-Source: ACHHUZ4u9uXsgmv+GFySRk9eNEC9LSKCxRJ+ghsUPCsvTCdHjIJZKTZNvVAmGPD8yy8el3iECh8Zlw== X-Received: by 2002:a17:90a:195:b0:25b:c454:a366 with SMTP id 21-20020a17090a019500b0025bc454a366mr7729305pjc.5.1687109349996; Sun, 18 Jun 2023 10:29:09 -0700 (PDT) Received: from [172.31.0.109] ([136.36.130.248]) by smtp.gmail.com with ESMTPSA id w1-20020a17090ac98100b0025bdc3454c6sm4337105pjt.8.2023.06.18.10.29.08 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 18 Jun 2023 10:29:09 -0700 (PDT) Message-ID: <24934666-4ca0-54c0-1811-c47a4ff1e439@gmail.com> Date: Sun, 18 Jun 2023 11:29:08 -0600 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.12.0 Content-Language: en-US Subject: [committed] Fix arc assumption that insns are not re-recognized To: "gcc-patches@gcc.gnu.org" X-Spam-Status: No, score=-8.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, 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: Jeff Law via Gcc-patches From: Jeff Law Reply-To: Jeff Law Errors-To: gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org Sender: "Gcc-patches" Testing the V2 version of Manolis's fold-mem-offsets patch exposed a minor bug in the arc backend. The movsf_insn pattern has constraints which allow storing certain constants to memory. reload/lra will target those alternatives under the right circumstances. However the insn's condition requires that one of the two operands must be a register. Thus if a pass were to force re-recognition of the pattern we can get an unrecognized insn failure. This patch adjusts the conditions to more closely match movsi_insn. More specifically it allows storing a constant into a limited set of memory operands (as defined by the Usc constraint). movqi_insn has the same core problem and gets the same solution. Committed after the tester validated there are no regressions with this patch installed for arc-elf. Jeff commit 0f9bb3e7a4aab95fd449f60b5f891ed9a6e5f352 Author: Jeff Law Date: Sun Jun 18 11:25:12 2023 -0600 Fix arc assumption that insns are not re-recognized Testing the V2 version of Manolis's fold-mem-offsets patch exposed a minor bug in the arc backend. The movsf_insn pattern has constraints which allow storing certain constants to memory. reload/lra will target those alternatives under the right circumstances. However the insn's condition requires that one of the two operands must be a register. Thus if a pass were to force re-recognition of the pattern we can get an unrecognized insn failure. This patch adjusts the conditions to more closely match movsi_insn. More specifically it allows storing a constant into a limited set of memory operands (as defined by the Usc constraint). movqi_insn has the same core problem and gets the same solution. Committed after the tester validated there are not regresisons gcc/ * config/arc/arc.md (movqi_insn): Allow certain constants to be stored into memory in the pattern's condition. (movsf_insn): Similarly. diff --git a/gcc/config/arc/arc.md b/gcc/config/arc/arc.md index c51ce173350..1f122d9507f 100644 --- a/gcc/config/arc/arc.md +++ b/gcc/config/arc/arc.md @@ -705,6 +705,9 @@ (define_insn "*movqi_insn" (match_operand:QI 1 "move_src_operand" "rL,rP,q,P,hCm1,cL, I,?Rac,i,?i,T,q,Usd,Ucm,m,?Rac,c,?Rac,Cm3,i"))] "register_operand (operands[0], QImode) || register_operand (operands[1], QImode) + || (CONSTANT_P (operands[1]) + && (!satisfies_constraint_I (operands[1]) || !optimize_size) + && satisfies_constraint_Usc (operands[0])) || (satisfies_constraint_Cm3 (operands[1]) && memory_operand (operands[0], QImode))" "@ @@ -1363,7 +1366,10 @@ (define_insn "*movsf_insn" [(set (match_operand:SF 0 "move_dest_operand" "=h,h, r,r, q,S,Usc,r,m") (match_operand:SF 1 "move_src_operand" "hCfZ,E,rCfZ,E,Uts,q, E,m,r"))] "register_operand (operands[0], SFmode) - || register_operand (operands[1], SFmode)" + || register_operand (operands[1], SFmode) + || (CONSTANT_P (operands[1]) + && (!satisfies_constraint_I (operands[1]) || !optimize_size) + && satisfies_constraint_Usc (operands[0]))" "@ mov%?\\t%0,%1 mov%?\\t%0,%1 ; %A1