From patchwork Fri Feb 11 15:52:23 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Makarov X-Patchwork-Id: 1591713 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.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=H4qelOrr; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=8.43.85.97; helo=sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Received: from sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4JwJ6b71jSz9s0r for ; Sat, 12 Feb 2022 02:52:54 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 0C050385800A for ; Fri, 11 Feb 2022 15:52:51 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 0C050385800A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1644594771; bh=gR3+jiD5jpQhopRdefueShp/61OZFRliGZk1zwOpcdE=; h=Date:Subject:To:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=H4qelOrrdve4lcdU5aTx9GMmOBNmZ7mE73PaSDrjTKwaZymFL0vJpQysmtvS5HZGK zhaqNf2VTqFlY+x2P5DBUlCoK9RsZmU9JIEuNw8jjW/iDBKg0/duUajqT9rEOA3qHV R6sOt/Z6Rv1L73HGc+ob0MKB4I7AYVZ7L6+dciD4= 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 C11513858D1E for ; Fri, 11 Feb 2022 15:52:30 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org C11513858D1E Received: from mail-qv1-f71.google.com (mail-qv1-f71.google.com [209.85.219.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-410-zcxE_-jYOz64PpxOfAGc1Q-1; Fri, 11 Feb 2022 10:52:26 -0500 X-MC-Unique: zcxE_-jYOz64PpxOfAGc1Q-1 Received: by mail-qv1-f71.google.com with SMTP id du13-20020a05621409ad00b0042c2949e2c1so6518047qvb.19 for ; Fri, 11 Feb 2022 07:52:26 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent :content-language:from:subject:to; bh=ZBM5xu96cp6NAzSUvagWuiWII/gBYo2J+oVJ8g7yFVw=; b=VymOZ3kd6PxqiqNrjZ8auDuYXlV+I3wSkN4MoznepCUpqGqFIHEpZM6gQF7Xep0au5 iWhSFAzv9Sp9n+0ZahA95L5BkmoqWtTMFXKaNZg4fnJ98QEvZik6kIHdBnHjj17sPXTc QcpWNKDf6mzgqC4oAy+r+x1w6A+YK0mnYuuYM41s74sBbU2o/APh7+kLUlktDHEqJ6zx 1ujo70OYnZZELPHVcweNIVVIjSYx6ZxQH8lDvVf5OKX6p7PhOBRXIb+pfQG4h2vlvwOy z4yTeOgiEDWSwC2ZIkYI9ZFNOna7pQJmh1pzS0WOclGfgR4MtHmfzDgntwxarEAB0kX4 FReg== X-Gm-Message-State: AOAM532KHDJVI1cREzmhsy3EyaQUkR34y9IGtGNPouLQZFoR7+rQYnPX JbXVW1ikxpTGS8TYU650Up4R4zZ8j6ms0pmPyLsklCN3Y1MXDHjKafhwQgTeQScNOuxTll4CmcK 8dIXi6kTs+xLtvpMoDFA4j8jZF38WN79ZKJ8iWGT1sVFK6YWhOQPC23cFi6JodMZ5m+W39A== X-Received: by 2002:ac8:5c8f:: with SMTP id r15mr1535350qta.383.1644594745352; Fri, 11 Feb 2022 07:52:25 -0800 (PST) X-Google-Smtp-Source: ABdhPJwyfV9ApfZ41GaTxIszFaq2D80GTheYgiKdWQcQ/zedSBKwyyCuNCRV1k/sABwyZDkrvq2gOQ== X-Received: by 2002:ac8:5c8f:: with SMTP id r15mr1535333qta.383.1644594745041; Fri, 11 Feb 2022 07:52:25 -0800 (PST) Received: from [192.168.1.113] ([69.165.238.126]) by smtp.gmail.com with ESMTPSA id i13sm11736337qko.91.2022.02.11.07.52.24 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 11 Feb 2022 07:52:24 -0800 (PST) Message-ID: Date: Fri, 11 Feb 2022 10:52:23 -0500 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.3.0 Subject: [committed] [PR104400] LRA: Modify exclude start hard register calculation for insn alternative To: "gcc-patches@gcc.gnu.org" X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US X-Spam-Status: No, score=-12.1 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_LOW, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) 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 solves https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104400 The patch was successfully tested and bootstrapped on x86-64 and aarch64. commit 274a4d29421e73c9b40c1641986c6ed904e20184 Author: Vladimir N. Makarov Date: Fri Feb 11 09:52:14 2022 -0500 [PR104400] LRA: Modify exclude start hard register calculation for insn alternative v850 target has an interesting insn alternative constraint 'e!r' where e denotes even general regs and e is a subset of r. We cannot just make union of exclude start hard registers for e and r and should use only exclude start hard registers of r. The following patch implements this. gcc/ChangeLog: PR rtl-optimization/104400 * lra-constraints.cc (process_alt_operands): Don't make union of this_alternative_exclude_start_hard_regs when reg class in insn alternative covers other reg classes in the same alternative. gcc/testsuite/ChangeLog: PR rtl-optimization/104400 * gcc.target/v850/pr104400.c: New. * gcc.target/v850/v850.exp: New. diff --git a/gcc/lra-constraints.cc b/gcc/lra-constraints.cc index 9cee17479ba..fdff9e0720a 100644 --- a/gcc/lra-constraints.cc +++ b/gcc/lra-constraints.cc @@ -2498,9 +2498,15 @@ process_alt_operands (int only_alternative) if (mode == BLKmode) break; this_alternative = reg_class_subunion[this_alternative][cl]; + if (hard_reg_set_subset_p (this_alternative_set, + reg_class_contents[cl])) + this_alternative_exclude_start_hard_regs + = ira_exclude_class_mode_regs[cl][mode]; + else if (!hard_reg_set_subset_p (reg_class_contents[cl], + this_alternative_set)) + this_alternative_exclude_start_hard_regs + |= ira_exclude_class_mode_regs[cl][mode]; this_alternative_set |= reg_class_contents[cl]; - this_alternative_exclude_start_hard_regs - |= ira_exclude_class_mode_regs[cl][mode]; if (costly_p) { this_costly_alternative diff --git a/gcc/testsuite/gcc.target/v850/pr104400.c b/gcc/testsuite/gcc.target/v850/pr104400.c new file mode 100644 index 00000000000..5d78a77345c --- /dev/null +++ b/gcc/testsuite/gcc.target/v850/pr104400.c @@ -0,0 +1,8 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -mv850e3v5" } */ + +double frob (double r) +{ + r = -r; + return r; +} diff --git a/gcc/testsuite/gcc.target/v850/v850.exp b/gcc/testsuite/gcc.target/v850/v850.exp new file mode 100644 index 00000000000..4e8c745a0b8 --- /dev/null +++ b/gcc/testsuite/gcc.target/v850/v850.exp @@ -0,0 +1,41 @@ +# Copyright (C) 2022 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with GCC; see the file COPYING3. If not see +# . + +# GCC testsuite that uses the `dg.exp' driver. + +# Exit immediately if this isn't an v850 target. +if ![istarget v850*-*-*] then { + return +} + +# Load support procs. +load_lib gcc-dg.exp + +# If a testcase doesn't have special options, use these. +global DEFAULT_CFLAGS +if ![info exists DEFAULT_CFLAGS] then { + set DEFAULT_CFLAGS " -ansi -pedantic-errors" +} + +# Initialize `dg'. +dg-init + +# Main loop. +dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[cS\]]] \ + "" $DEFAULT_CFLAGS + +# All done. +dg-finish