From patchwork Fri Feb 16 10:16:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jakub Jelinek X-Patchwork-Id: 85872 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 1B646385829F for ; Fri, 16 Feb 2024 10:17:01 +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 8A6ED3858C54 for ; Fri, 16 Feb 2024 10:16:32 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 8A6ED3858C54 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 8A6ED3858C54 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=1708078594; cv=none; b=au18gAa06eD4Cbo5jHDch2rgH2imzr6KA4tfT8U+yWg/462PPyvejGw/ETwftVVq8n7ih8zbgkm0CV/HdOmhTBzgqTIdBMuS9JmBfkVxuTa0k0xMOMv3nVPdKPN+N2IMX/YyaBsC0nM5hQq3ASAEpO/QNynA6CA9rQR6MijKYNM= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1708078594; c=relaxed/simple; bh=v502wD5IO0Ctw5++8hh4Ej3tTGb9pS+ZlML4ICbbysQ=; h=DKIM-Signature:Date:From:To:Subject:Message-ID:MIME-Version; b=kKRgeO7XKBHBPWXa/cBda3bs1e2tpws5Q+9ChaE89RDXVGe7kzFw2o7kETxiOCtDYu3vSZWLbVYaGrqTf8UzkNKHQ8kdHVL8rOaOW4JVDnCJTKA/gj7xPO6Ad4Z/QvNq1tau5JmnVEtZ/0xTFZHOgHYnX9GgukNZGK4i4Z+tFF0= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1708078592; h=from:from:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type; bh=ONu180l47j5sD+TjZjPALcdRQ7AuDvxlu4RLDkl618Y=; b=Uc1VekDGomEuLDwUeSkX0oz7eVYh80icJ76B/2/QLu9/PXW3rSCriMoTp4Ij1fCVW4mYej vr2DU/Q05G+9PHPMhX1eOX9Msl4j12HP/DEMxIuckEUGXE8wfc25KzfxKNY2jTOS3wMLjE YfPlxYIHS6iDo8baHJF5UibgDfhhSQ4= Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-610-y8AFGawDNtqmIUntNgwTGA-1; Fri, 16 Feb 2024 05:16:29 -0500 X-MC-Unique: y8AFGawDNtqmIUntNgwTGA-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 64CD51C0650A; Fri, 16 Feb 2024 10:16:29 +0000 (UTC) Received: from tucnak.zalov.cz (unknown [10.39.192.8]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 0CCA12166B4F; Fri, 16 Feb 2024 10:16:28 +0000 (UTC) Received: from tucnak.zalov.cz (localhost [127.0.0.1]) by tucnak.zalov.cz (8.17.1/8.17.1) with ESMTPS id 41GAGPLq4076446 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Fri, 16 Feb 2024 11:16:26 +0100 Received: (from jakub@localhost) by tucnak.zalov.cz (8.17.1/8.17.1/Submit) id 41GAGNjd4076445; Fri, 16 Feb 2024 11:16:23 +0100 Date: Fri, 16 Feb 2024 11:16:22 +0100 From: Jakub Jelinek To: Richard Biener , Rainer Orth , Mike Stump , Thomas Schwinge Cc: gcc-patches@gcc.gnu.org Subject: [PATCH] testsuite: Fix up lra effective target Message-ID: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.6 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline X-Spam-Status: No, score=-3.8 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, 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.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Jakub Jelinek Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org Hi! Given the recent discussions on IRC started with Andrew P. mentioning that an asm goto outputs test should have { target lra } and the lra effective target in GCC 11/12 only returning 0 for PA and in 13/14 for PA/AVR, while we clearly have 14 other targets which don't support LRA and a couple of further ones which have an -mlra/-mno-lra switch (whatever default they have), seems to me the effective target is quite broken. The following patch rewrites it, such that it has a fast path for heavily used targets which are for years known to use only LRA (just an optimization) plus determines whether it is a LRA target or reload target by scanning the -fdump-rtl-reload-details dump on an empty function, LRA has quite a few always emitted messages in that case while reload has none of those. Tested on x86_64-linux and cross to s390x-linux, for the latter with both make check-gcc RUNTESTFLAGS='--target_board=unix/-mno-lra dg.exp=pr107385.c' where the test is now UNSUPPORTED and make check-gcc RUNTESTFLAGS='--target_board=unix/-mlra dg.exp=pr107385.c' where it fails because I don't have libc around. Ok for trunk? There is one special case, NVPTX, which is a TARGET_NO_REGISTER_ALLOCATION target. I think claiming for it that it is a lra target is strange (even though it effectively returns true for targetm.lra_p ()), unsure if it supports asm goto with outputs or not, if it does and we want to test it, perhaps we should introduce asm_goto_outputs effective target and use lra || nvptx-*-* for that? 2024-02-16 Jakub Jelinek * lib/target-supports.exp (check_effective_target_lra): Rewrite to list some heavily used always LRA targets and otherwise check the -fdump-rtl-reload-details dump for messages specific to LRA. Jakub --- gcc/testsuite/lib/target-supports.exp.jj 2024-02-15 09:51:34.591064180 +0100 +++ gcc/testsuite/lib/target-supports.exp 2024-02-16 10:50:29.986180603 +0100 @@ -13215,10 +13215,17 @@ proc check_effective_target_powerpc_as_p # return 1 if LRA is supported. proc check_effective_target_lra { } { - if { [istarget hppa*-*-*] || [istarget avr-*-*] } { - return 0 + # Start with heavily used targets which are known to always use LRA. + if { [istarget i?86-*-*] || [istarget x86_64-*-*] + || [istarget aarch64*-*-*] || [istarget arm*-*-*] + || [istarget powerpc*-*-*] || [istarget riscv*-*-*] } { + return 1 } - return 1 + + # Otherwise check the reload dump for messages emitted solely by LRA. + return [check_no_messages_and_pattern lra "\\\*{9} Local #1: \\\*{9}" rtl-reload { + void foo (void) {} + } {-O2 -fdump-rtl-reload-details}] ;# LRA notes requires a detailed dump. } # Test whether optimizations are enabled ('__OPTIMIZE__') per the