From patchwork Thu Sep 5 12:39:46 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Thomas Schwinge X-Patchwork-Id: 1981230 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=baylibre-com.20230601.gappssmtp.com header.i=@baylibre-com.20230601.gappssmtp.com header.a=rsa-sha256 header.s=20230601 header.b=2uWNdQZm; dkim-atps=neutral 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=server2.sourceware.org; envelope-from=gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=patchwork.ozlabs.org) Received: from server2.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 (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4WzzTy6ZjBz1yfv for ; Thu, 5 Sep 2024 22:40:22 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id B81B03865483 for ; Thu, 5 Sep 2024 12:40:20 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wr1-x435.google.com (mail-wr1-x435.google.com [IPv6:2a00:1450:4864:20::435]) by sourceware.org (Postfix) with ESMTPS id 65EE2385843B for ; Thu, 5 Sep 2024 12:39:54 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 65EE2385843B Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=baylibre.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=baylibre.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 65EE2385843B Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::435 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1725539997; cv=none; b=qT131un8pnwKQ8JHJboXh7E3RcAC5CzPXe2i7mXIr+dtesFBlGzUhkJsFao3f8ZTlWLizbArrltXLe/4XQq+2rn85z8q7xiQOJ6Px7eVNvqWFH3vCOZXo5w4DVHDba95zv93OHz4PANwY/Qu8S5XjB4dZIFFI9XdSiSMkHWCt7Y= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1725539997; c=relaxed/simple; bh=xwb88dIFieQaaWk/2j8cjD33MNZz+MBddaydHmHafKA=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=BaThpdC9lUO9LlWDKY2dqD1HPTuQUhqCrcIYTCm8bKYhV4gOXlJmOAZwYvShp84vY5NACcfKr5pxFPVQafpMsdOmZ36nWt1VWZnKfw/soXhT4jkKRq9jSZovBh94Nd8o5KDOAstAdxDNSjl3QcSNwOoiOThGoKNvgGt1SWcEMJo= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-wr1-x435.google.com with SMTP id ffacd0b85a97d-374d29ad8a7so486841f8f.2 for ; Thu, 05 Sep 2024 05:39:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1725539993; x=1726144793; darn=gcc.gnu.org; h=mime-version:message-id:date:user-agent:references:in-reply-to :subject:to:from:from:to:cc:subject:date:message-id:reply-to; bh=0BVxznZh1AZ8/SUprDsP4tyYPRtBR3EdSVdCiuLFDZ0=; b=2uWNdQZmplCfZjd0CDwbVqFI2nrTHW1dvrsUgFORaGCisclt/BZinegqfVBr2MXHqF 7TVV727XhH9IyMMYFWyjL2RVyxu4FZsQDpEmaYze9DVeu8Yhk3cQZhXaUPqdR9ZekqwE QeWS1f7S7HSNz8UTT6kr/hvcqZXjZKrsC19nLCUBZICbEoP/iVs/jeVnSTOHSgP/ESXC 3g09lI25S+qsgjA5yXfbexX4r764U9tOjrHYr/19RmhYRMPr7VsP6Cae+qRhhUPOYxSo i3lUIAcUIr5bJYj861JfVTIZ0d7vNIP/S5Yr8YNUgt61bWOBeCyMocwWODm/YnuvVxGO Mz8A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725539993; x=1726144793; h=mime-version:message-id:date:user-agent:references:in-reply-to :subject:to:from:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=0BVxznZh1AZ8/SUprDsP4tyYPRtBR3EdSVdCiuLFDZ0=; b=JC9RYPgBGHOzm0p8T61KIhFRd/mCaHn6PFBPDZ0u/bu5jAH8+whntlYOyZfuH3V/Eo FRo6rxg8Oi3FZg+Yjt/sWZOl9nuHHbxZYX2kZU2vcsfoTe9mPGxbCEO0OBOHbFTRDIRc awySPxN+0nEvmk7txLIDdRS6/RlTdqSDzJnudYf1C/o5jJqj5MJWK7ucWeZrczDV+QD1 J1Mi1MMaWStPMCJIuZaRbFbe5lLDQWgCKzx0jQKcRw37OaU5QpOQoz4eJpAAvanJz7jH 392vufGsJntyYxuUlzWpexffatfmHl9rGZF5txitLxAsz+15OTLTDi3o5eTwF8CCBRzc jcSQ== X-Forwarded-Encrypted: i=1; AJvYcCWP9swOfZ+K813bmvaC7QGPCW3SX5cr5bF2wFGvQhyKkkquy57EIwXjm+i82YknKFeYjtJ+0KEhqYIqMA==@gcc.gnu.org X-Gm-Message-State: AOJu0YwSTn2IKgBo8ogVGuoU45gNLBZz9KaM0U9FYUa5gaJ4eWp9YnJf lUGU2WcYftKDGCHvL4uG48Qm6FDx+dsPMlaMAPw/twW6bSUhmW3P5UtjliqMZy0kgNcI8PPwEyz 2 X-Google-Smtp-Source: AGHT+IHhGAVDs0lgDPHstXJOPQBBYmTLU7JEhCTLVz4v8YXmBJLXrEoBF33kDZcH0J7hH+H+HQPeew== X-Received: by 2002:adf:f5c4:0:b0:377:6073:48df with SMTP id ffacd0b85a97d-377717f4b50mr3755162f8f.58.1725539992877; Thu, 05 Sep 2024 05:39:52 -0700 (PDT) Received: from euler.schwinge.ddns.net (p200300c8b733b9005e8fc6f38b6af531.dip0.t-ipconnect.de. [2003:c8:b733:b900:5e8f:c6f3:8b6a:f531]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-374c08e07b6sm14027352f8f.63.2024.09.05.05.39.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Sep 2024 05:39:52 -0700 (PDT) From: Thomas Schwinge To: Tom de Vries , gcc-patches@gcc.gnu.org Subject: Enhance 'gcc.target/nvptx/alias-*.c' assembler scanning (was: [committed][nvptx] Use .alias directive for mptx >= 6.3) In-Reply-To: <875xra1dll.fsf@euler.schwinge.ddns.net> References: <20220322134144.GA32400@delia.home> <875xra1dll.fsf@euler.schwinge.ddns.net> User-Agent: Notmuch/0.30+8~g47a4bad (https://notmuchmail.org) Emacs/29.4 (x86_64-pc-linux-gnu) Date: Thu, 05 Sep 2024 14:39:46 +0200 Message-ID: <8734me1dgt.fsf@euler.schwinge.ddns.net> MIME-Version: 1.0 X-Spam-Status: No, score=-11.9 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, GIT_PATCH_0, KAM_SHORT, 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.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org Hi! On 2024-09-05T14:36:54+0200, I wrote: > On 2022-03-22T14:41:46+0100, Tom de Vries via Gcc-patches wrote: >> [nvptx] Use .alias directive for mptx >= 6.3 > >> --- a/gcc/config/nvptx/nvptx.cc >> +++ b/gcc/config/nvptx/nvptx.cc > >> @@ -968,7 +969,8 @@ static void >> write_fn_proto_1 (std::stringstream &s, bool is_defn, >> const char *name, const_tree decl) >> { >> - write_fn_marker (s, is_defn, TREE_PUBLIC (decl), name); >> + if (lookup_attribute ("alias", DECL_ATTRIBUTES (decl)) == NULL) >> + write_fn_marker (s, is_defn, TREE_PUBLIC (decl), name); > > This non-emitting of DECL and DEF linker markers for aliases is > problematic, as I'll discuss in the following. First, to show what currently is (not) happening, I've pushed to trunk branch commit d0f02538494ded78cac12c63f5708a53f5a77bda "Enhance 'gcc.target/nvptx/alias-*.c' assembler scanning", see attached. Grüße Thomas From d0f02538494ded78cac12c63f5708a53f5a77bda Mon Sep 17 00:00:00 2001 From: Thomas Schwinge Date: Wed, 17 Jul 2024 15:27:51 +0200 Subject: [PATCH] Enhance 'gcc.target/nvptx/alias-*.c' assembler scanning ... in order to demonstrate unexpected behavior (XFAILed here). PR target/104957 gcc/testsuite/ * gcc.target/nvptx/alias-1.c: Enhance assembler scanning. * gcc.target/nvptx/alias-2.c: Likewise. * gcc.target/nvptx/alias-3.c: Likewise. * gcc.target/nvptx/alias-4.c: Likewise. * gcc.target/nvptx/alias-to-alias-1.c: Likewise. --- gcc/testsuite/gcc.target/nvptx/alias-1.c | 15 ++++++++++--- gcc/testsuite/gcc.target/nvptx/alias-2.c | 16 ++++++++++---- gcc/testsuite/gcc.target/nvptx/alias-3.c | 15 ++++++++++--- gcc/testsuite/gcc.target/nvptx/alias-4.c | 17 ++++++++++---- .../gcc.target/nvptx/alias-to-alias-1.c | 22 ++++++++++++++----- 5 files changed, 66 insertions(+), 19 deletions(-) diff --git a/gcc/testsuite/gcc.target/nvptx/alias-1.c b/gcc/testsuite/gcc.target/nvptx/alias-1.c index 1c0642b14d9..0fb06495f67 100644 --- a/gcc/testsuite/gcc.target/nvptx/alias-1.c +++ b/gcc/testsuite/gcc.target/nvptx/alias-1.c @@ -23,6 +23,15 @@ main (void) return 0; } -/* { dg-final { scan-assembler-times "\\.alias f,__f;" 1 } } */ -/* { dg-final { scan-assembler-times "\\.visible \\.func __f;" 1 } } */ -/* { dg-final { scan-assembler-times "\\.visible \\.func f;" 1 } } */ +/* { dg-final { scan-assembler-times {(?n)^// BEGIN GLOBAL FUNCTION DECL: __f$} 1 } } + { dg-final { scan-assembler-times {(?n)^\.visible \.func __f;$} 1 } } + { dg-final { scan-assembler-times {(?n)^// BEGIN GLOBAL FUNCTION DEF: __f$} 1 } } + { dg-final { scan-assembler-times {(?n)^\.visible \.func __f$} 1 } } */ + +/* { dg-final { scan-assembler-times {(?n)^// BEGIN GLOBAL FUNCTION DECL: f$} 1 { xfail *-*-* } } } + { dg-final { scan-assembler-times {(?n)^\.visible \.func f;$} 1 } } + { dg-final { scan-assembler-times {(?n)^// BEGIN GLOBAL FUNCTION DEF: f$} 1 { xfail *-*-* } } } + { dg-final { scan-assembler-times {(?n)^\.alias f,__f;$} 1 } } */ + +/* { dg-final { scan-assembler-times {(?n)\tcall __f;$} 0 } } + { dg-final { scan-assembler-times {(?n)\tcall f;$} 1 } } */ diff --git a/gcc/testsuite/gcc.target/nvptx/alias-2.c b/gcc/testsuite/gcc.target/nvptx/alias-2.c index 7a88b6f4f6f..8ae8b5cfaed 100644 --- a/gcc/testsuite/gcc.target/nvptx/alias-2.c +++ b/gcc/testsuite/gcc.target/nvptx/alias-2.c @@ -5,10 +5,18 @@ #include "alias-1.c" +/* Note extern and inlined, so still there. */ +/* { dg-final { scan-assembler-times {(?n)^// BEGIN GLOBAL FUNCTION DECL: __f$} 1 } } + { dg-final { scan-assembler-times {(?n)^\.visible \.func __f;$} 1 } } + { dg-final { scan-assembler-times {(?n)^// BEGIN GLOBAL FUNCTION DEF: __f$} 1 } } + { dg-final { scan-assembler-times {(?n)^\.visible \.func __f$} 1 } } */ + /* Inlined, so no alias. */ -/* { dg-final { scan-assembler-not "\\.alias.*;" } } */ -/* { dg-final { scan-assembler-not "\\.visible \\.func f;" } } */ -/* Note extern and inlined, so still there. */ -/* { dg-final { scan-assembler-times "\\.visible \\.func __f;" 1 } } */ +/* { dg-final { scan-assembler-times {(?n)^// BEGIN GLOBAL FUNCTION DECL: f$} 0 } } + { dg-final { scan-assembler-times {(?n)^\.visible \.func f;$} 0 } } + { dg-final { scan-assembler-times {(?n)^// BEGIN GLOBAL FUNCTION DEF: f$} 0 } } + { dg-final { scan-assembler-times {(?n)^\.alias f,__f;$} 0 } } */ +/* { dg-final { scan-assembler-times {(?n)\tcall __f;$} 0 } } + { dg-final { scan-assembler-times {(?n)\tcall f;$} 0 } } */ diff --git a/gcc/testsuite/gcc.target/nvptx/alias-3.c b/gcc/testsuite/gcc.target/nvptx/alias-3.c index b55ff26269e..1906607f95f 100644 --- a/gcc/testsuite/gcc.target/nvptx/alias-3.c +++ b/gcc/testsuite/gcc.target/nvptx/alias-3.c @@ -25,6 +25,15 @@ main (void) return 0; } -/* { dg-final { scan-assembler-times "\\.alias f,__f;" 1 } } */ -/* { dg-final { scan-assembler-times "\\.func __f;" 1 } } */ -/* { dg-final { scan-assembler-times "\\.func f;" 1 } } */ +/* { dg-final { scan-assembler-times {(?n)^// BEGIN FUNCTION DECL: __f$} 1 } } + { dg-final { scan-assembler-times {(?n)^\.func __f;$} 1 } } + { dg-final { scan-assembler-times {(?n)^// BEGIN FUNCTION DEF: __f$} 1 } } + { dg-final { scan-assembler-times {(?n)^\.func __f$} 1 } } */ + +/* { dg-final { scan-assembler-times {(?n)^// BEGIN FUNCTION DECL: f$} 1 { xfail *-*-* } } } + { dg-final { scan-assembler-times {(?n)^\.func f;$} 1 } } + { dg-final { scan-assembler-times {(?n)^// BEGIN FUNCTION DEF: f$} 1 { xfail *-*-* } } } + { dg-final { scan-assembler-times {(?n)^\.alias f,__f;$} 1 } } */ + +/* { dg-final { scan-assembler-times {(?n)\tcall __f;$} 0 } } + { dg-final { scan-assembler-times {(?n)\tcall f;$} 1 } } */ diff --git a/gcc/testsuite/gcc.target/nvptx/alias-4.c b/gcc/testsuite/gcc.target/nvptx/alias-4.c index b36fa420aa7..98c1d4972b8 100644 --- a/gcc/testsuite/gcc.target/nvptx/alias-4.c +++ b/gcc/testsuite/gcc.target/nvptx/alias-4.c @@ -5,9 +5,18 @@ #include "alias-3.c" +/* Static and inlined, so it's deleted. */ +/* { dg-final { scan-assembler-times {(?n)^// BEGIN FUNCTION DECL: __f$} 0 } } + { dg-final { scan-assembler-times {(?n)^\.visible \.func __f;$} 0 } } + { dg-final { scan-assembler-times {(?n)^// BEGIN FUNCTION DEF: __f$} 0 } } + { dg-final { scan-assembler-times {(?n)^\.visible \.func __f$} 0 } } */ + /* Inlined, so no alias. */ -/* { dg-final { scan-assembler-not "\\.alias.*;" } } */ -/* { dg-final { scan-assembler-not "\\.func f;" } } */ -/* Static and inlined, so it's deleted. */ -/* { dg-final { scan-assembler-not "\\.func __f;" } } */ +/* { dg-final { scan-assembler-times {(?n)^// BEGIN FUNCTION DECL: f$} 0 } } + { dg-final { scan-assembler-times {(?n)^\.visible \.func f;$} 0 } } + { dg-final { scan-assembler-times {(?n)^// BEGIN FUNCTION DEF: f$} 0 } } + { dg-final { scan-assembler-times {(?n)^\.alias f,__f;$} 0 } } */ + +/* { dg-final { scan-assembler-times {(?n)\tcall __f;$} 0 } } + { dg-final { scan-assembler-times {(?n)\tcall f;$} 0 } } */ diff --git a/gcc/testsuite/gcc.target/nvptx/alias-to-alias-1.c b/gcc/testsuite/gcc.target/nvptx/alias-to-alias-1.c index 273baca89c4..ebd62e11964 100644 --- a/gcc/testsuite/gcc.target/nvptx/alias-to-alias-1.c +++ b/gcc/testsuite/gcc.target/nvptx/alias-to-alias-1.c @@ -19,9 +19,21 @@ main (void) return 0; } -/* { dg-final { scan-assembler-times "\\.alias bar,foo;" 1 } } */ -/* { dg-final { scan-assembler-times "\\.visible \\.func foo;" 1 } } */ -/* { dg-final { scan-assembler-times "\\.visible \\.func bar;" 1 } } */ +/* { dg-final { scan-assembler-times {(?n)^// BEGIN GLOBAL FUNCTION DECL: foo$} 1 } } + { dg-final { scan-assembler-times {(?n)^\.visible \.func foo;$} 1 } } + { dg-final { scan-assembler-times {(?n)^// BEGIN GLOBAL FUNCTION DEF: foo$} 1 } } + { dg-final { scan-assembler-times {(?n)^\.visible \.func foo$} 1 } } */ -/* { dg-final { scan-assembler-times "\\.alias baz,bar;" 1 } } */ -/* { dg-final { scan-assembler-times "\\.visible \\.func baz;" 1 } } */ +/* { dg-final { scan-assembler-times {(?n)^// BEGIN GLOBAL FUNCTION DECL: bar$} 1 { xfail *-*-* } } } + { dg-final { scan-assembler-times {(?n)^\.visible \.func bar;$} 1 } } + { dg-final { scan-assembler-times {(?n)^// BEGIN GLOBAL FUNCTION DEF: bar$} 1 { xfail *-*-* } } } + { dg-final { scan-assembler-times {(?n)^\.alias bar,foo;$} 1 } } */ + +/* { dg-final { scan-assembler-times {(?n)^// BEGIN GLOBAL FUNCTION DECL: baz$} 1 { xfail *-*-* } } } + { dg-final { scan-assembler-times {(?n)^\.visible \.func baz;$} 1 } } + { dg-final { scan-assembler-times {(?n)^// BEGIN GLOBAL FUNCTION DEF: baz$} 1 { xfail *-*-* } } } + { dg-final { scan-assembler-times {(?n)^\.alias baz,bar;$} 1 } } */ + +/* { dg-final { scan-assembler-times {(?n)\tcall foo;$} 0 } } + { dg-final { scan-assembler-times {(?n)\tcall bar;$} 0 } } + { dg-final { scan-assembler-times {(?n)\tcall baz;$} 1 } } */ -- 2.34.1