From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ej1-x62a.google.com (mail-ej1-x62a.google.com [IPv6:2a00:1450:4864:20::62a]) by sourceware.org (Postfix) with ESMTPS id 7CD1B3857709 for ; Thu, 12 Oct 2023 14:39:05 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 7CD1B3857709 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=linaro.org Received: by mail-ej1-x62a.google.com with SMTP id a640c23a62f3a-9a645e54806so162932666b.0 for ; Thu, 12 Oct 2023 07:39:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697121544; x=1697726344; darn=gcc.gnu.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=Thezp1wu3fHyvrD8xf87RpDMSTE9E3oACMweXQYq/VQ=; b=GchqzicfBcFeyu2kIeMlghuh/IpHs4sp1ZBVoLwz06HtA9inWGHXfy9O9/NprXBjE8 wSPWeWDp/ZdRMbUdpyNs4g33IL6RoWSa9bmkrBVouIhVQ23Bl32umx4CuEnq5fgEG/z6 2tkwF9NKXh6itKNm8zmR2/jFoVFbUn167eNHY3hleE8k+EohBffaPdw1WAonl6dnY4i+ ++tfT2FinnAciUPVSn1GPr3TwOCPl3ULm3O18GaZF1WwA/dbOpAGRsZz/Ka6hO8T5Opy 8xRCeU358Wr3HbadwL/hrwfYAkj0IiXz6L1kj9UoYNmK50eDO9xYVQaFrK/GYxADcRbg aMNg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697121544; x=1697726344; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=Thezp1wu3fHyvrD8xf87RpDMSTE9E3oACMweXQYq/VQ=; b=oI70RbXIt472D4FvPoGEnPhL9xN59tjHqQW3RM9TWygxfso6kQMaK8s+qlYmCvb/73 agCO6bXbOmbwYNK5FL/ijq17P/uiKNTkxYH4sAJx6P6Qo+pb+wbnVnbV8Xz5pNK84P4v rqVZzcivIza2Na/ShdUZ5pBpybKThh/0btUI5i8t7VFk/efM1SPFmMERXDPyqd/x0eUy +QNX+sXZ9l4X8jLZguX6FqYsh689GO5f2Nbu6K1X0IYzFhs0mtNQwuD3LTtQYsr61ODL bQdZ6Ra4VzatVOxZmp5WpR4F2IB3JJh1yZggyCYeBMqonFp2JCKVch9z6JaeVLVDCA3j ZxVg== X-Gm-Message-State: AOJu0YzpAxxa7/RPBPBifuh4K2R3kYd63/T/a9IXrFVdSlP9aA/RbZpf x39TSaaLFv5beVCp+F5RjZ/AOj+/zj4wYaDy6SRw0A== X-Google-Smtp-Source: AGHT+IH37kBSNW6y150PHLtaWdOBmWYC8bn6nEnQ3AUcJP9bikakSbVb0zKf7826aoRNlxK2vlubW/o75Kv3gl2ydLQ= X-Received: by 2002:a17:907:b1b:b0:9b9:ff16:344c with SMTP id h27-20020a1709070b1b00b009b9ff16344cmr18130013ejl.50.1697121544151; Thu, 12 Oct 2023 07:39:04 -0700 (PDT) MIME-Version: 1.0 References: <20230926143439.B589920431@pchp3.se.axis.com> <20231004031136.8B8BA2042A@pchp3.se.axis.com> <20231004151528.2ADB12043D@pchp3.se.axis.com> <20231004170455.76C1A2043D@pchp3.se.axis.com> <20231012022152.2321F203F1@pchp3.se.axis.com> In-Reply-To: <20231012022152.2321F203F1@pchp3.se.axis.com> From: Christophe Lyon Date: Thu, 12 Oct 2023 16:38:54 +0200 Message-ID: Subject: Re: Ping: [PATCH v2 1/2] testsuite: Add dg-require-atomic-cmpxchg-word To: Hans-Peter Nilsson Cc: gcc-patches@gcc.gnu.org, libstdc++@gcc.gnu.org, jwakely@redhat.com Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-10.5 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,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 List-Id: LGTM but I'm not a maintainer ;-) On Thu, 12 Oct 2023 at 04:21, Hans-Peter Nilsson wrote: > > Ping. > > > From: Hans-Peter Nilsson > > Date: Wed, 4 Oct 2023 19:04:55 +0200 > > > > > From: Hans-Peter Nilsson > > > Date: Wed, 4 Oct 2023 17:15:28 +0200 > > > > > New version coming up. > > > > Using pointer-sized int instead of int, > > __atomic_compare_exchange instead of __atomic_exchange, > > renamed to atomic-cmpxchg-word from atomic-exchange, and > > updating a comment that already seemed reasonably well > > placed. > > > > Tested as with v1 1/2. > > > > Ok to commit? > > > > -- >8 -- > > Some targets (armv6-m) support inline atomic load and store, > > i.e. dg-require-thread-fence matches, but not atomic operations like > > compare and exchange. > > > > This directive can be used to replace uses of dg-require-thread-fence > > where an atomic operation is actually used. > > > > * testsuite/lib/dg-options.exp (dg-require-atomic-cmpxchg-word): > > New proc. > > * testsuite/lib/libstdc++.exp (check_v3_target_atomic_cmpxchg_word): > > Ditto. > > --- > > libstdc++-v3/testsuite/lib/dg-options.exp | 9 ++++++ > > libstdc++-v3/testsuite/lib/libstdc++.exp | 37 +++++++++++++++++++++++ > > 2 files changed, 46 insertions(+) > > > > diff --git a/libstdc++-v3/testsuite/lib/dg-options.exp b/libstdc++-v3/testsuite/lib/dg-options.exp > > index 84ad0c65330b..850442b6b7c1 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-cmpxchg-word { args } { > > + if { ![ check_v3_target_atomic_cmpxchg_word ] } { > > + 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..4bedb36dc6f9 100644 > > --- a/libstdc++-v3/testsuite/lib/libstdc++.exp > > +++ b/libstdc++-v3/testsuite/lib/libstdc++.exp > > @@ -1221,6 +1221,43 @@ proc check_v3_target_thread_fence { } { > > }] > > } > > > > +proc check_v3_target_atomic_cmpxchg_word { } { > > + return [check_v3_target_prop_cached et_atomic_cmpxchg_word { > > + global cxxflags > > + global DEFAULT_CXXFLAGS > > + > > + # Set up and link a C++11 test program that depends on > > + # atomic-compare-exchange being available for a pointer-sized > > + # integer. It should be sufficient as gcc can derive all > > + # other operations when a target implements this operation. > > + set src atomic_cmpxchg_word[pid].cc > > + > > + set f [open $src "w"] > > + puts $f " > > + __UINTPTR_TYPE__ i, j, k; > > + int main() { > > + __atomic_compare_exchange (&i, &j, &k, 1, __ATOMIC_SEQ_CST, __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_cmpxchg_word: 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 { > > -- > > 2.30.2 > >