From patchwork Wed Oct 4 02:55:38 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans-Peter Nilsson X-Patchwork-Id: 148147 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2a8e:b0:403:3b70:6f57 with SMTP id in14csp2504930vqb; Tue, 3 Oct 2023 20:55:53 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEYfthzoYhYTGG/sMs370apixyWC9ISsLhA9wSSm0PhAK4kYGTmcinyrE1LV61s9DMQQUFm X-Received: by 2002:a17:906:7496:b0:9ae:72c7:73e6 with SMTP id e22-20020a170906749600b009ae72c773e6mr961003ejl.10.1696391753264; Tue, 03 Oct 2023 20:55:53 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1696391753; cv=pass; d=google.com; s=arc-20160816; b=NzB55qzmZbYGDUxhA7ha2zDe+NFISBA+MLuZ1tOPniYw1iGNUkzKSBv8EGaCGW6umh RM4ZqJA7YfeXFX5SYtwL1q5CRGZ/kFfU/XwIH26rTYNJ/zu+tmDlGECuqEjKCoi43OVB RZzmT1XZNuQ5paA/XpJhftsjEDTsfV7Yuqi94rHyJcOxFKzSeRadkSztJZ72N6Klfw81 B4QAUOwyXdNzhijonkYECbLuQRbU68ME1ExrvCRT2IE7KmhCk0et42IZaqExgoedtxpf +q9T3pbuc+UEnZqpr/pksMVqAMQwJs9a4Vli0fkwzzbXxa0IHGFoGbt/mW+aPRZGHca3 PM7Q== 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:date:message-id:references :content-transfer-encoding:mime-version:subject:in-reply-to:cc:to :from:dkim-signature:dmarc-filter:delivered-to; bh=9gfeX7TKJDmXMU/QbflDA3btbrYM7qEVXKFK019nMQU=; fh=BFUAfP3LrNKiUVnBam/vJbyj6bd7pJEFtISg/wI+450=; b=LFpEgPAWI40Il/tNomY7MRP2ntPGWx+O23XXwryC0sIK+uTZO+AVC3QAPDuKt0JaEC riUdtFBnxFZCMqXW6QYmKEPypBuprrLTvj3/rLK2mornStdgQVKR5gRWZoPgi7Wbpg6q OztvmCeCu+6piFnI1yjPY991Swwp1d23ANtG9g+K9o4O/lRa9ECU91gXUb5PgW3dPrfY t207VxzsLKgLgHB+oLKgg4bRfQMOwjzcq6ebjbxh5Qjbt4RxLFgGfoGQ6xi9Ded9h76j DR82xbvm2QVLFO+Y5R1J5Ws1Lv4UXiSzaUM+EF3QJbwFxxulE9x79mYr+TWWgDyznqE1 Jo8A== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@axis.com header.s=selector1 header.b=euZov3PQ; 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=axis.com Received: from server2.sourceware.org (ip-8-43-85-97.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id kt13-20020a170906aacd00b0099cd6660994si1400055ejb.116.2023.10.03.20.55.52 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Oct 2023 20:55:53 -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=@axis.com header.s=selector1 header.b=euZov3PQ; 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=axis.com Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id E586B3857020 for ; Wed, 4 Oct 2023 02:56:15 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from EUR02-AM0-obe.outbound.protection.outlook.com (mail-am0eur02on2050.outbound.protection.outlook.com [40.107.247.50]) by sourceware.org (Postfix) with ESMTPS id CCB8D3858402; Wed, 4 Oct 2023 02:55:42 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org CCB8D3858402 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=axis.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=axis.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=SopJgrjwKUpt+bYUnaMzp0DANgOaRzmBYOzDyCGy3Q/mmepHJoENolWwbIAkdPd0DmF1Ap7OnpuyX1TUPg4aamplwHJ66gBQ8KDD0EbQKAJFfVn0jbxoAGqiH2dh/qkkIfFX/wdZheNu4AcKtQobim4+LQfhGgX4HnpSLC/9DTr/HCZsM3EwOIITGFw+lfSiw3dwFyDo6Gg08gJ9X9AEZfEgvy+VvDPDFqj2L5mK1cdjSwZLfV4o8HeVon+6DVyTfz1YbKhkkQhTAwWtCWOPxBTjwNMXP/nj0PzNzKIKqnP4eiQ/XoQE/5VPZwtcq5waXQMcnjKvb3cNuTap1F5uFw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=9gfeX7TKJDmXMU/QbflDA3btbrYM7qEVXKFK019nMQU=; b=iWSVH2kppNL5Anz4WkraLqsafsURwpS2sqMDtUgBdUrnf43tF4b5AxdklsFf+63KmLnkuMrXdvEJaKnyfoJbIe75KQYHbBkChfIzpBSH1kD652G+iFB31jdTJJ2M49V/iLk3SqVnafy7n7Yc2n9qCp6rPkViKRkt0G9qeGGOgE2ghXNcToG1HMMZ1pVwkXwkHzvrkNEus/xPLlbMSc006Q39IYHtsU7VGUXSlAcqZO1l3iZa8ys1XSKjnpTHQlYmACQCofDLaJKASaTaoLclj65a0jUuFseQq2Jyc03smITWZnvcFB0cq9C/TcsUVrPEPCMV4xdWTMN29FTra3Lb5g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=fail (sender ip is 195.60.68.100) smtp.rcpttodomain=gcc.gnu.org smtp.mailfrom=axis.com; dmarc=fail (p=none sp=none pct=100) action=none header.from=axis.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=axis.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=9gfeX7TKJDmXMU/QbflDA3btbrYM7qEVXKFK019nMQU=; b=euZov3PQbakjbqoIKAXqkeC6v0c5wXp68pC5vNizi/IBCgN4dn3PENv3Hr3ED2cUlrCMhGMaNxUFZAMjcXaFCPQ4atRBvZyyay+5yE0h0J6rNuzrOyKDCEBqlgIhkiy5ARd+mMZDSzQZhIxK0C5xPIVXqSUXYyli2LOLaYgw+fU= Received: from AS9PR07CA0041.eurprd07.prod.outlook.com (2603:10a6:20b:46b::28) by PAWPR02MB9688.eurprd02.prod.outlook.com (2603:10a6:102:2e3::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6838.28; Wed, 4 Oct 2023 02:55:40 +0000 Received: from AMS0EPF000001A5.eurprd05.prod.outlook.com (2603:10a6:20b:46b:cafe::f3) by AS9PR07CA0041.outlook.office365.com (2603:10a6:20b:46b::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6863.24 via Frontend Transport; Wed, 4 Oct 2023 02:55:40 +0000 X-MS-Exchange-Authentication-Results: spf=fail (sender IP is 195.60.68.100) smtp.mailfrom=axis.com; dkim=none (message not signed) header.d=none;dmarc=fail action=none header.from=axis.com; Received-SPF: Fail (protection.outlook.com: domain of axis.com does not designate 195.60.68.100 as permitted sender) receiver=protection.outlook.com; client-ip=195.60.68.100; helo=mail.axis.com; Received: from mail.axis.com (195.60.68.100) by AMS0EPF000001A5.mail.protection.outlook.com (10.167.16.232) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6838.14 via Frontend Transport; Wed, 4 Oct 2023 02:55:39 +0000 Received: from SE-MAILARCH01W.axis.com (10.20.40.15) by se-mail02w.axis.com (10.20.40.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Wed, 4 Oct 2023 04:55:38 +0200 Received: from se-mail01w.axis.com (10.20.40.7) by SE-MAILARCH01W.axis.com (10.20.40.15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Wed, 4 Oct 2023 04:55:38 +0200 Received: from se-intmail01x.se.axis.com (10.0.5.60) by se-mail01w.axis.com (10.20.40.7) with Microsoft SMTP Server id 15.1.2375.34 via Frontend Transport; Wed, 4 Oct 2023 04:55:38 +0200 Received: from pchp3.se.axis.com (pchp3.se.axis.com [10.88.21.53]) by se-intmail01x.se.axis.com (Postfix) with ESMTP id 4DBCBE98; Wed, 4 Oct 2023 04:55:38 +0200 (CEST) Received: by pchp3.se.axis.com (Postfix, from userid 171) id 489F220439; Wed, 4 Oct 2023 04:55:38 +0200 (CEST) From: Hans-Peter Nilsson To: Christophe Lyon CC: , In-Reply-To: (message from Christophe Lyon on Tue, 3 Oct 2023 15:20:39 +0200) Subject: [PATCH 1/2] testsuite: Add dg-require-atomic-exchange non-atomic code MIME-Version: 1.0 References: <20230926143439.B589920431@pchp3.se.axis.com> Message-ID: <20231004025538.489F220439@pchp3.se.axis.com> Date: Wed, 4 Oct 2023 04:55:38 +0200 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AMS0EPF000001A5:EE_|PAWPR02MB9688:EE_ X-MS-Office365-Filtering-Correlation-Id: 48fc4648-50df-411a-59cb-08dbc4856477 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: uXkJ6LINBs9hRTL0mT4E1Cicit9jePhEr30WjernqjEMds1I8RSXHKwP/+vXvojN+TR3H1PjMjNNALzpIVJeeG4c7XEVt0BJxb1To9HCRKsuxUDJmx5lLDcItMsx1wYrQwzLwkePC8KlRk0HPYywE7beuHwCuV54yKRquy4O/5GFfQZjemC5afpuzfB1u/MhbrNfA/2QrgcN1fhTEGDWW5RK7mU/k+uTEb7wqqdB1/i79xwC4CLHsmfKVAJ5sWWjpol/gA/G3o5YFYKPow0L5FJu9j2H0qRSVgBotU0N0O9tiqYg58QgA1342KcrhmGK5zRUEU8Y/WzE+2+I1dwS6Hy4TP1N/8IT7VTGVuVtzfm9vDR3wSFu8yaGJVi5MAp3pG0Z5DYZuvQLgXDuTYuiZ9E+bYN2QFlG/8QAzB8uDnN1xdqiHapLsyHvIKYqtcxO1+M0MefIz8btUrArThjJDylkF0j6y9HPsV5zHKmp7y5Yyj3GaH+/8LoqDASn+4frywZ5HRAbzwFB834JUAvX+Uv/zjn2F7KhfdcHOvsPGjsGwN9/3zJf4fCL+AjDEbrAaOwphCYM1A8TCfPJfS8Dfx7yw+N7QqNYl+sB+W5R0M4APVMX25G7oVusH5He2JJIN4bHff2IBQ0tLVNs7Me2eDr2ZF+sRxlcN7q+xjFyZLWoidIQGsXd54XRB+o69YeneFwSRBfwLjJCwwqITk2VDn0HzOhOwXwcfASBRnx7Rn6YVqNZH9UE6m+BOIqkOl874iSb8MkMLY25au81LVpxFg== X-Forefront-Antispam-Report: CIP:195.60.68.100; CTRY:SE; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.axis.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230031)(4636009)(396003)(346002)(376002)(136003)(39860400002)(230922051799003)(451199024)(64100799003)(186009)(82310400011)(1800799009)(36840700001)(40470700004)(46966006)(83380400001)(40460700003)(6266002)(336012)(26005)(426003)(1076003)(82740400003)(356005)(81166007)(36860700001)(40480700001)(47076005)(478600001)(41300700001)(4326008)(8676002)(5660300002)(2906002)(33656002)(316002)(54906003)(8936002)(42186006)(6916009)(70206006)(70586007)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: axis.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Oct 2023 02:55:39.7669 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 48fc4648-50df-411a-59cb-08dbc4856477 X-MS-Exchange-CrossTenant-Id: 78703d3c-b907-432f-b066-88f7af9ca3af X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=78703d3c-b907-432f-b066-88f7af9ca3af; Ip=[195.60.68.100]; Helo=[mail.axis.com] X-MS-Exchange-CrossTenant-AuthSource: AMS0EPF000001A5.eurprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAWPR02MB9688 X-Spam-Status: No, score=-11.8 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_PASS, SPF_PASS, 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+ouuuleilei=gmail.com@gcc.gnu.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1778795679486198038 X-GMAIL-MSGID: 1778795679486198038 > From: Christophe Lyon > Date: Tue, 3 Oct 2023 15:20:39 +0200 > Maybe we need a new variant of dg-require-thread-fence ? Yes: many of the dg-require-thread-fence users need something stronger. Tested arm-eabi together with the next patch (2/2) with RUNTESTFLAGS=--target_board=arm-sim/-mthumb/-march=armv6s-m/-mtune=cortex-m0/-mfloat-abi=soft/-mfpu=auto\ conformance.exp=29_atomics/\* (Incidentally, in the patch context is seen dg-require-atomic-builtins which is a misnomer: it should rather be named "dg-require-lock-atomic-builtins-free".) Ok to commit? -- >8 -- Some targets (armv6) support inline atomic load and store, i.e. dg-require-thread-fence matches, but not atomic like atomic exchange. This directive will replace uses of dg-require-thread-fence where an atomic exchange operation is actually used. * testsuite/lib/dg-options.exp (dg-require-atomic-exchange): New proc. * testsuite/lib/libstdc++.exp (check_v3_target_atomic_exchange): Ditto. --- libstdc++-v3/testsuite/lib/dg-options.exp | 9 ++++++ libstdc++-v3/testsuite/lib/libstdc++.exp | 35 +++++++++++++++++++++++ 2 files changed, 44 insertions(+) diff --git a/libstdc++-v3/testsuite/lib/dg-options.exp b/libstdc++-v3/testsuite/lib/dg-options.exp index 84ad0c65330b..b13c2f244c63 100644 --- a/libstdc++-v3/testsuite/lib/dg-options.exp +++ b/libstdc++-v3/testsuite/lib/dg-options.exp @@ -133,6 +133,15 @@ proc dg-require-thread-fence { args } { return } +proc dg-require-atomic-exchange { args } { + if { ![ check_v3_target_atomic_exchange ] } { + upvar dg-do-what dg-do-what + set dg-do-what [list [lindex ${dg-do-what} 0] "N" "P"] + return + } + return +} + proc dg-require-atomic-builtins { args } { if { ![ check_v3_target_atomic_builtins ] } { upvar dg-do-what dg-do-what diff --git a/libstdc++-v3/testsuite/lib/libstdc++.exp b/libstdc++-v3/testsuite/lib/libstdc++.exp index 608056e5068e..481f81711074 100644 --- a/libstdc++-v3/testsuite/lib/libstdc++.exp +++ b/libstdc++-v3/testsuite/lib/libstdc++.exp @@ -1221,6 +1221,41 @@ proc check_v3_target_thread_fence { } { }] } +proc check_v3_target_atomic_exchange { } { + return [check_v3_target_prop_cached et_atomic_exchange { + global cxxflags + global DEFAULT_CXXFLAGS + + # Set up and link a C++11 test program that depends + # on atomic exchange be available for "int". + set src atomic_exchange[pid].cc + + set f [open $src "w"] + puts $f " + int i, j, k; + int main() { + __atomic_exchange (&i, &j, &k, __ATOMIC_SEQ_CST); + return 0; + }" + close $f + + set cxxflags_saved $cxxflags + set cxxflags "$cxxflags $DEFAULT_CXXFLAGS -Werror -std=gnu++11" + + set lines [v3_target_compile $src /dev/null executable ""] + set cxxflags $cxxflags_saved + file delete $src + + if [string match "" $lines] { + # No error message, linking succeeded. + return 1 + } else { + verbose "check_v3_target_atomic_exchange: compilation failed" 2 + return 0 + } + }] +} + # Return 1 if atomics_bool and atomic_int are always lock-free, 0 otherwise. proc check_v3_target_atomic_builtins { } { return [check_v3_target_prop_cached et_atomic_builtins {