From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-oi1-x22c.google.com (mail-oi1-x22c.google.com [IPv6:2607:f8b0:4864:20::22c]) by sourceware.org (Postfix) with ESMTPS id E7BA738582AC for ; Wed, 6 Jul 2022 19:14:49 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org E7BA738582AC Received: by mail-oi1-x22c.google.com with SMTP id t189so20963040oie.8 for ; Wed, 06 Jul 2022 12:14:49 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=JPUYhootywHBSFGwkKpfxxqzM/nRBODBuB3AABcUuFQ=; b=8QTWH8+EA/h1i3URvdPguGb2fI1OvImc+dR1smEa7K79i+3WjkLgbSj2V2Sk9i7wTU nNJD+wGFh0kfriGl+dbjolWVA6uIjh0OLLLrrkrB2Z/ynv8NPEvMe9wcpQsBuzLriAXp vnkQ/O9DqjzekR58J8nAj8BkKujV3BKTDxW/1zi5ov+77Xc30Ksyh0FkyMKxbrlqmx2F bJsQFkUvgLCrY1W/uOEhnBVUxjPcEuxPjxClgWRs/5ayHxAFGV0ATMi+tlsecwzpUKU+ exrknoZ/PpwMVV7EwFgSewz2GfXFIRoI0GaA3ptnK4itKpvuleGOd7S/JhvfUvZ8GNoa H5mQ== X-Gm-Message-State: AJIora85NHVePXYYoBSxYzCQEFHVtcCGdfffIuaG6PjTW95sn0iM1GSy qyAfx7LvvKXVG5fFRAtSCTBvTsXtEw4TDwSc+Qf0Oaom X-Google-Smtp-Source: AGRyM1t79DL1oejJFZLFMQ74WVmb58R/jvhlAV0WKBrSWt3l9vCRPNDc8uD81xdjcH+pEBdXjDBtl0g7XtbiPCgKCfc= X-Received: by 2002:aca:b58a:0:b0:335:5f0f:96c6 with SMTP id e132-20020acab58a000000b003355f0f96c6mr70802oif.175.1657134889170; Wed, 06 Jul 2022 12:14:49 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Noah Goldstein Date: Wed, 6 Jul 2022 12:14:38 -0700 Message-ID: Subject: Re: [PATCH 3/7] Remove atomic_bit_set/bit_test_set To: Wilco Dijkstra Cc: GNU C Library Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-3.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, 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: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Jul 2022 19:14:51 -0000 On Wed, Jul 6, 2022 at 12:00 PM Wilco Dijkstra wrote: > > Hi Noah, > > > > - if (atomic_bit_test_set (&pd->cancelhandling, TERMINATED_BIT) == 0) > > > + if ((atomic_fetch_or_acquire (&pd->cancelhandling, 1 << TERMINATED_BIT) > > > + & (1 << TERMINATED_BIT)) == 0) > > > Can these remain macros that setup the bit_test_set properly but > > use compiler intrinsics? > > The fetch_or above is already written in a way that allows GCC to recognize it > (it's identical to your do_atomic_or0), so I don't see any issue here. However > there is a TERMINATED_BITMASK which might make it more readable. For non-constant shift values it needs to be like atomic_or4/atomic_or5. Since this needs to be set up in a particular way it seems worth it to keep it as a macro that will do it properly. Fine with replacing the underlying atomic op with a compiler intrinsic. > > Cheers, > Wilco