From patchwork Tue Oct 31 15:47:00 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Makarov X-Patchwork-Id: 160173 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b90f:0:b0:403:3b70:6f57 with SMTP id t15csp332376vqg; Tue, 31 Oct 2023 08:47:34 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGiDAHbBbq3Mk1Eja7p/FFmSbJDyq2jeZEv3XCtJ8VukOkEm3tH+PbC3D2xbuZTLdr4u0z7 X-Received: by 2002:a67:cc1a:0:b0:458:19d4:415e with SMTP id q26-20020a67cc1a000000b0045819d4415emr11396350vsl.1.1698767253639; Tue, 31 Oct 2023 08:47:33 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1698767253; cv=pass; d=google.com; s=arc-20160816; b=chixrm4MNWw/mCXg9k6I11e8iIa58SYKnsdeCr4wMROifgCBCLEmcKg6Hpxq++mNmi cNuz0a1dyAreiWx8HhdYTIV3qaDGQhCeZa6FEL6RRTGaG6AVw8rl212L/Fb6ikngcY0/ graPHgJ/2rrv1L4keCW+s1Gw3kGM9KUmGCY6GhBbs75dB1GmkshpDJw1U5cMhxUnAfNL tT3qDpOVtqDptgp9YRwZVszIo+lv4gFijkZLF+ABlVpl7CnrlOwCehlV3m9ZXbG6AaM4 DGZwcqhBwJutFqiHc57V1ga5wlXoXrhGe3erkS9O02h8Dre6BUpCj91ypVkg4Tn5T4ji qFTA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-language:subject:from :to:user-agent:mime-version:date:message-id:dkim-signature :arc-filter:dmarc-filter:delivered-to; bh=20BPeUjk5sA0uABQxixc7wI9GyWh6SQRT+oixXvDUk0=; fh=XNn3asQvIblazGK92GBt13dVv+YmGV3pBS0JC29ZQco=; b=GKNkEHK11afZxzWyVz1Ikh8PuGBmCLaoO5Fg7Dr3I2liaeKZDopUMC0BjIghZJx1s2 VK53LWcRob7iA8+gFXKhElDfTC8yRNz33k/Ip8GuZdJPlpLHGJmZB3VBDhDGpCnw1zCS h0FJOAeeTEXB8YnKus2FH/A9GFQjLjvOEHdxq9CF2tI7JxRptC8R15K4zT/XKhj0nlPv FqNwmqrV6zhm1Kndo6ukY3F89Nf/zCtbtkErmllaqKax1qLwBMbvRK05gtQSxoRHE392 OwDv9UU4vZYEPuQ9KDKcpezRDRy10UktF9CQnc/cfpvepylySyOhERSm4h+Y+b5i/BXI TqLw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="H+hLhPt/"; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from server2.sourceware.org (server2.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id g7-20020ac85d47000000b0041cbaa0003dsi1362621qtx.202.2023.10.31.08.47.33 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 31 Oct 2023 08:47:33 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="H+hLhPt/"; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id E3ED8385841F for ; Tue, 31 Oct 2023 15:47:32 +0000 (GMT) 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.133.124]) by sourceware.org (Postfix) with ESMTPS id F01FA3858D1E for ; Tue, 31 Oct 2023 15:47:08 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org F01FA3858D1E Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org F01FA3858D1E Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1698767230; cv=none; b=l/MvCOYh80rbqeWKj0bEjM4Jfxh841ogOlLTiglICAAHO5hTIZvR7g9GsF+oMLo0ahF2gjrVH5NbfJi+o7pIqZcMtsxZNEDRC1dlCxRYIWRtssgOCz1pETOjsZbHRizLxLGEtaU6qORBGeAl+YsDfaO7n35yhYq5rrR5mhn9QVE= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1698767230; c=relaxed/simple; bh=20BPeUjk5sA0uABQxixc7wI9GyWh6SQRT+oixXvDUk0=; h=DKIM-Signature:Message-ID:Date:MIME-Version:To:From:Subject; b=Qqfv+ti9FAa82QzItYqKOfS0RJVfZJu7LVVt/WjqntHd/kflguRL2Ry6vzCfPnEa7lVAyXQo3ZMyX/mE0S4LYGwyo3FXYAQifI2CQlhMUkswO+Y2vwaKt3LEfnBa2iXoXg8YwIqJHCbyB1XcIK5v2n1kw/6SJCfVhi2FNAf9M28= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1698767228; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type; bh=20BPeUjk5sA0uABQxixc7wI9GyWh6SQRT+oixXvDUk0=; b=H+hLhPt/deUZzzmqIYK1SGFqUm7+uHTaBMrpDQftSlleKyllElzBbQxC/KdfHE7pw4ckDS 6xcbF+J5EWOo9cSy/bNMO2BkThLl3JtwMtBibjl0ntq9nM+Gt6harcwhZTASXgmgZkUQ4E RCk6H6vjnepjv6qjNejx+GH3qpl/63A= 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-372-o8allUtLPJCEhGioVIkc3Q-1; Tue, 31 Oct 2023 11:47:05 -0400 X-MC-Unique: o8allUtLPJCEhGioVIkc3Q-1 Received: by mail-qk1-f198.google.com with SMTP id af79cd13be357-779f645c74cso719632285a.0 for ; Tue, 31 Oct 2023 08:47:04 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698767223; x=1699372023; 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=4VXRoAhXWJBcBnec1lOVuOr5nU0mqqegwranTE57Bk8=; b=p8C0MfGvT6XgFMmvM2Sx/iT09cYlGO2FevL8j9pq3Um/Z4ngy7/k3WI/asKaF61dKs gS1mrgof9PvJ8K72LsxYzBgUuND5lxrzZ7z8VuPBqpXEnsRK+09wgaEt6Y8WhzTKhrmP EI1ovuFFkgPyscsyEb1OUptRFDLt/Gx0hPWYYcvH4p7vX6KLQp52EYL7Kan2jUO9+8xb +Na8x5KINfWJHn3YoPHQLD8UOZ+Vy8EJtEqNiHhP0VV9+hR4G/18ozxvBv5T9hTQ/DU8 5l3Ht2y3e9AagHgN1eY6bvF1151JIIEYCz/1rEGwFdQW5GKfqI8Ecadqv50TfxZ8bFUf WI+Q== X-Gm-Message-State: AOJu0YzH8xXG5RyM3odCYuC3XPITa/wWqW7u8MMVXDyXixCqbhOxghPq cd3GAhVZ9njzuW/9JoC5ENTBASI5eh083kNzsq34f8160liur3/lZeCmkpVbRO/7UoSn5nhSuXz RZhItyxeLpiDX2zEtwAn5vIkO/EliMHe4GlQaUy7V0SJR7+pcbxL1+aAugsbwQqYlwa+GiKYazJ XLYA== X-Received: by 2002:a05:620a:44d2:b0:767:261d:1ef6 with SMTP id y18-20020a05620a44d200b00767261d1ef6mr15608053qkp.59.1698767222876; Tue, 31 Oct 2023 08:47:02 -0700 (PDT) X-Received: by 2002:a05:620a:44d2:b0:767:261d:1ef6 with SMTP id y18-20020a05620a44d200b00767261d1ef6mr15608031qkp.59.1698767222450; Tue, 31 Oct 2023 08:47:02 -0700 (PDT) Received: from [192.168.1.88] (23-233-12-249.cpe.pppoe.ca. [23.233.12.249]) by smtp.gmail.com with ESMTPSA id op54-20020a05620a537600b007742c6823a3sm600611qkn.108.2023.10.31.08.47.01 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 31 Oct 2023 08:47:01 -0700 (PDT) Message-ID: <27a79c6e-d19f-b6d5-e4ad-b139860cd255@redhat.com> Date: Tue, 31 Oct 2023 11:47:00 -0400 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.13.0 To: "gcc-patches@gcc.gnu.org" From: Vladimir Makarov Subject: [pushed][PR111917][RA]: Fixing LRA cycling for multi-reg variable containing a fixed reg X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US X-Spam-Status: No, score=-11.9 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, 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.30 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 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1781286571549509577 X-GMAIL-MSGID: 1781286571549509577 The following patch fixes https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111971 Successfully bootstrapped and tested on x86-64, aarch64, pp64le. commit df111406b4ea1fe2890e94d51655e571cf260d29 Author: Vladimir N. Makarov Date: Tue Oct 31 10:54:43 2023 -0400 [RA]: Fixing LRA cycling for multi-reg variable containing a fixed reg PR111971 test case uses a multi-reg variable containing a fixed reg. LRA rejects such multi-reg because of this when matching the constraint for an asm insn. The rejection results in LRA cycling. The patch fixes this issue. gcc/ChangeLog: PR rtl-optimization/111971 * lra-constraints.cc: (process_alt_operands): Don't check start hard regs for regs originated from register variables. gcc/testsuite/ChangeLog: PR rtl-optimization/111971 * gcc.target/powerpc/pr111971.c: New test. diff --git a/gcc/lra-constraints.cc b/gcc/lra-constraints.cc index d10a2a3dc51..0607c8be7cb 100644 --- a/gcc/lra-constraints.cc +++ b/gcc/lra-constraints.cc @@ -2609,12 +2609,15 @@ process_alt_operands (int only_alternative) winreg = true; if (REG_P (op)) { + tree decl; if (hard_regno[nop] >= 0 && in_hard_reg_set_p (this_alternative_set, mode, hard_regno[nop]) - && !TEST_HARD_REG_BIT - (this_alternative_exclude_start_hard_regs, - hard_regno[nop])) + && ((REG_ATTRS (op) && (decl = REG_EXPR (op)) != NULL + && VAR_P (decl) && DECL_HARD_REGISTER (decl)) + || !(TEST_HARD_REG_BIT + (this_alternative_exclude_start_hard_regs, + hard_regno[nop])))) win = true; else if (hard_regno[nop] < 0 && in_class_p (op, this_alternative, NULL)) diff --git a/gcc/testsuite/gcc.target/powerpc/pr111971.c b/gcc/testsuite/gcc.target/powerpc/pr111971.c new file mode 100644 index 00000000000..7f058bd4820 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/pr111971.c @@ -0,0 +1,10 @@ +/* { dg-do compile } */ +/* { dg-options "-O2" } */ +void +foo (unsigned long long *a) +{ + register long long d asm ("r0") = 0x24; + long long n; + asm ("mr %0, %1" : "=r"(n) : "r"(d)); + *a++ = n; +}