From patchwork Thu Jul 25 22:55:01 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andi Kleen X-Patchwork-Id: 1964929 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=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=Zf8H6hLX; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=8.43.85.97; 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 [8.43.85.97]) (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 4WVR7D3WpQz1yY9 for ; Fri, 26 Jul 2024 08:55:35 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 4DFF2385840E for ; Thu, 25 Jul 2024 22:55:33 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.15]) by sourceware.org (Postfix) with ESMTPS id 53A113858C41; Thu, 25 Jul 2024 22:55:08 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 53A113858C41 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=linux.intel.com Authentication-Results: sourceware.org; spf=none smtp.mailfrom=linux.intel.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 53A113858C41 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=198.175.65.15 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1721948110; cv=none; b=e6thTJkTEXHVFXdmO3xwj2Wh09icOZxHYQrR7UEceszTvuADOYyK/sZKe52jOq9X3hhXRVmILW7miuWirI2kEIohYcgmNlCUzRm+A1RlHWjKbanT54kd8cX9CpPaaWJtWr7CXysvVO7Inih2aG0l9YJ6B8rkcJ5E1ubX/R7gAIQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1721948110; c=relaxed/simple; bh=dmK6ay0dWT9+iA0/JyWMG/yXkdBV8cLbdLjcH2r2VSU=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=NZsoQAs/4EvjMTTQ4onqkJSn7oTD+ZA2lr8XoXJWhHyCJBEk1YI5MxjjqxUEutvGseM/02N7oxkp87S70z25b5ffjIaMzQstTFNd0KKFyngk8ig8cT7Kb/9leQA5qPGi7nJfjFeiIGgomoyecfTtKS5wBBLC1l4Q6Os+zxmnXfo= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1721948109; x=1753484109; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=dmK6ay0dWT9+iA0/JyWMG/yXkdBV8cLbdLjcH2r2VSU=; b=Zf8H6hLXNG1i6RA9SzhQFEEP6GwYsqeRls7MxKdVt1NwmDryqNP23qkF Kinp6yPOonmsmanuMihcZJhfZMJko8U/p4drWvxYajGHCdWGhU2qoGKH/ ArZBdkHKypo4jpUrVcmVOUCoSLjyNUQYX1qdRR9Hapsmyml6/P/pT7FN1 IEbDbh7wSBYJ8xWF+ysX2B1IZ+MQALAXnqK8Q3aiNf5Sf6Hsz4GeTncfo xF12sb81DYg8ewUraH+ZwgPBQeeZAhf/rIKKmP1EMraXoCaIcD6125qDt 5VWiboBSav4pX1JSF0cMnOgb5/FDRjBocvg18okoNguMMhEy9DO4YZbak A==; X-CSE-ConnectionGUID: it3pG2AdT7eiSaSmF5Yg7g== X-CSE-MsgGUID: NT3n2K9HQA2ku9rYmWjfVw== X-IronPort-AV: E=McAfee;i="6700,10204,11144"; a="23476149" X-IronPort-AV: E=Sophos;i="6.09,237,1716274800"; d="scan'208";a="23476149" Received: from orviesa005.jf.intel.com ([10.64.159.145]) by orvoesa107.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Jul 2024 15:55:08 -0700 X-CSE-ConnectionGUID: wi46sfHcRo25LXCmQQj/Jg== X-CSE-MsgGUID: b3tB3odWRgW8HOvwpynyjA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.09,237,1716274800"; d="scan'208";a="57875791" Received: from tassilo.jf.intel.com ([10.54.38.190]) by orviesa005-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Jul 2024 15:55:08 -0700 From: Andi Kleen To: gcc-patches@gcc.gnu.org Cc: Andi Kleen Subject: [PATCH v1 1/2] PR116080: Fix tail call dejagnu checks Date: Thu, 25 Jul 2024 15:55:01 -0700 Message-ID: <20240725225502.1550809-1-ak@linux.intel.com> X-Mailer: git-send-email 2.45.2 MIME-Version: 1.0 X-Spam-Status: No, score=-11.1 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_EF, GIT_PATCH_0, SPF_HELO_NONE, SPF_NONE, TXREP 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 From: Andi Kleen - Run the target_effective tail_call checks without optimization to match the actual test cases. - Add an extra check for external tail calls to handle targets like powerpc that cannot tail call between different object files. This one will also cover templates. gcc/testsuite/ChangeLog: PR testsuite/116080 * g++.dg/musttail10.C: Use external tail call target check. * g++.dg/musttail6.C: Dito. * lib/target-supports.exp: Add external_tail_call. Disable optimization for tail call checks. --- gcc/testsuite/g++.dg/musttail10.C | 2 +- gcc/testsuite/g++.dg/musttail6.C | 2 +- gcc/testsuite/lib/target-supports.exp | 14 +++++++++++--- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/gcc/testsuite/g++.dg/musttail10.C b/gcc/testsuite/g++.dg/musttail10.C index ff7fcc7d8755..bd75affa2220 100644 --- a/gcc/testsuite/g++.dg/musttail10.C +++ b/gcc/testsuite/g++.dg/musttail10.C @@ -8,7 +8,7 @@ double g() { [[gnu::musttail]] return f(); } /* { dg-error "cannot tail-cal template __attribute__((noinline, noclone, noipa)) -T g1() { [[gnu::musttail]] return f(); } /* { dg-error "target is not able" "" { target powerpc*-*-* } } */ +T g1() { [[gnu::musttail]] return f(); } /* { dg-error "target is not able" "" { target { external_tail_call } } } */ template __attribute__((noinline, noclone, noipa)) diff --git a/gcc/testsuite/g++.dg/musttail6.C b/gcc/testsuite/g++.dg/musttail6.C index 5c6f69407ddb..81f6d9f3ca77 100644 --- a/gcc/testsuite/g++.dg/musttail6.C +++ b/gcc/testsuite/g++.dg/musttail6.C @@ -1,6 +1,6 @@ /* { dg-do compile { target { struct_tail_call } } } */ +/* { dg-require-effective-target external_tail_call } */ /* A lot of architectures will not build this due to PR115606 and PR115607 */ -/* { dg-skip-if "powerpc does not support sibcall to templates" { powerpc*-*-* } } */ /* { dg-options "-std=gnu++11" } */ /* { dg-additional-options "-fdelayed-branch" { target sparc*-*-* } } */ diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp index d368251ef9a4..0a3946e82d4b 100644 --- a/gcc/testsuite/lib/target-supports.exp +++ b/gcc/testsuite/lib/target-supports.exp @@ -12741,7 +12741,15 @@ proc check_effective_target_tail_call { } { return [check_no_messages_and_pattern tail_call ",SIBCALL" rtl-expand { __attribute__((__noipa__)) void foo (void) { } __attribute__((__noipa__)) void bar (void) { foo(); } - } {-O2 -fdump-rtl-expand-all}] ;# The "SIBCALL" note requires a detailed dump. + } {-fdump-rtl-expand-all}] ;# The "SIBCALL" note requires a detailed dump. +} + +# Return 1 if the target can perform tail-calls for externals +proc check_effective_target_external_tail_call { } { + return [check_no_messages_and_pattern tail_call ",SIBCALL" rtl-expand { + extern __attribute__((__noipa__)) void foo (void); + __attribute__((__noipa__)) void bar (void) { foo(); } + } {-fdump-rtl-expand-all}] ;# The "SIBCALL" note requires a detailed dump. } # Return 1 if the target can perform tail-call optimizations for structures @@ -12751,9 +12759,9 @@ proc check_effective_target_struct_tail_call { } { return [check_no_messages_and_pattern tail_call ",SIBCALL" rtl-expand { // C++ struct foo { int a, b; }; - __attribute__((__noipa__)) struct foo foo (void) { return {}; } + extern __attribute__((__noipa__)) struct foo foo (void); __attribute__((__noipa__)) struct foo bar (void) { return foo(); } - } {-O2 -fdump-rtl-expand-all}] ;# The "SIBCALL" note requires a detailed dump. + } {-fdump-rtl-expand-all}] ;# The "SIBCALL" note requires a detailed dump. } # Return 1 if the target's calling sequence or its ABI