From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-oa1-x35.google.com (mail-oa1-x35.google.com [IPv6:2001:4860:4864:20::35]) by sourceware.org (Postfix) with ESMTPS id EC2303858D28 for ; Wed, 6 Jul 2022 19:51:57 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org EC2303858D28 Received: by mail-oa1-x35.google.com with SMTP id 586e51a60fabf-101b4f9e825so22709941fac.5 for ; Wed, 06 Jul 2022 12:51:57 -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=CQ3PRMvoEP0zLMxW/uNQup3A0oeUZsOIcvNYepHlZQ0=; b=8KhbEXPPnzngjiI5tOIjP8X2a3S+ME1akPIUY2KJHKOLu8megv0LDnMQdLoO6DspA1 LNDZpymWvleYxrd/hlSXxbaPh8eK9nWpVgaCsVNmtUHReL9nO2Sv/X5ZtIt5nB2waUAO C3qyCSUDOlBDoQK3nD1m3ld80X4ETvELeo6UzWplqrFc/f18yU7U9Kyunjc/mUxWDNZF Q9/3FEU8yuFvh9YY6oCJlWMVbMZ/kiYy3DM8gj0AZ/jUsK/fx073sdRv0VvLhdKwceYX I7SpsZJYeYvL4dUuIgin1qc6aSJ2nOxwlA5P3CZTyKR7DeD2huzVp5yXrrfT1qBqfKrA Fz3A== X-Gm-Message-State: AJIora9U2c03AIah6ZxpkyXltxFEkWz+CTJSt7LIzpX06e5Sof9jMn2s rc+c1VcAhKdklLlUjfZVuMEZ45mRBkNSwK+Zl/w= X-Google-Smtp-Source: AGRyM1tKCVKQLwdn+nASmSH1OwruRsVm/sPTqyX4OMXC+YszC4pbd8pXXty9ZR9S+kHBGYKfiQoAiIxjy2gLefnSNN0= X-Received: by 2002:a05:6870:ea01:b0:f1:e631:ed6f with SMTP id g1-20020a056870ea0100b000f1e631ed6fmr187507oap.89.1657137117106; Wed, 06 Jul 2022 12:51:57 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Noah Goldstein Date: Wed, 6 Jul 2022 12:51:46 -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.4 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:51:59 -0000 On Wed, Jul 6, 2022 at 12:37 PM Wilco Dijkstra wrote: > > Hi Noah, > > > 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. > > This was only one use in GLIBC so how does adding a private macro help other > software? This idiom doesn't appear common, particularly with a non-constant bit, > but in principle the compiler could be fixed so that it optimizes do_atomic_or2/3 > as well. The usage in this patch is fine. Just seems having an internal API for it provides value given that in the future there may be a need for atomic_bit_set w.o a constant bit and there are non-obvious tricks necessary for doing it right. > > Cheers, > Wilco