From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id D47D53858D3C for ; Mon, 22 Jan 2024 17:58:45 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org D47D53858D3C Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org D47D53858D3C Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1705946327; cv=none; b=OIN0utatuKVVh6MgMtZ7bF77y81GY+P2iDsS90Q7oJfKLwjHfDE2VJRVy+7X06oCCAsX90pQJMihWdCIXu4gdwf7ce10EZQEqdsyU4Rte3pTf9l/ufViBTLCgiVvLuU4cIsRmckxCOsV6Zd9VuEkPa6DMm8MRSPIaGAH6L1EI2M= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1705946327; c=relaxed/simple; bh=skQtWTszBJ3MPlS07bdfBtwaC8c7OLDJ6JvZiAkZ9KA=; h=DKIM-Signature:Date:From:To:Subject:Message-ID:MIME-Version; b=voAX0bsX8adAW99Gbw9nW8YEdbLBKX2BD0J2uIa0gnwrhK4pPAU0s4sOxnrEcReQyecJg0tjSgexDtI7zBsmsuyDe72SPETxd4UBbEvrg8cX4jGj31IBk7iUyEkajGE0ti2l+MTHpGQKGXT25Qj4bnafvl9iuduJlHNUzT7q1ws= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1705946325; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=EXm8LUlByxkRS/RZe9gTkHL/zFPG1jYj73iyMh1FHNI=; b=Adf4I9RvwC19BRFFDNfBMx62o4vLoDOxXRPRp/UsAAkXWoJ26s/+0Jr4Qp9mfkas27BgqB 1RP04A90lDgmqFZCzcOla04adr/PXApKxa8iLbEaYgtMMTJDZlMBJAymAF3u2g/tFLmnlF LMF7pNbIACY6N0TtbIejj5kMoOnjVB8= Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-267-mg0rPErsNsquFVWqwzCSCw-1; Mon, 22 Jan 2024 12:58:44 -0500 X-MC-Unique: mg0rPErsNsquFVWqwzCSCw-1 Received: by mail-wm1-f71.google.com with SMTP id 5b1f17b1804b1-40e9d6a366aso35334395e9.3 for ; Mon, 22 Jan 2024 09:58:44 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705946323; x=1706551123; h=mime-version:references:message-id:in-reply-to:subject:cc:to:from :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=EXm8LUlByxkRS/RZe9gTkHL/zFPG1jYj73iyMh1FHNI=; b=R+UcDKwlFc5j0x8dcakCyEAAVTSvSH8aa8PA22dJwrPJGagDdnVFp8rr3T9OgG0gR0 rjZyqf+1GnbeclzBkF2mZ46C9xqsqLmTsXHEsIrkXKkZYCCxw0ZfMBuCQ+YQDvtuzIaS 5rOzP+Mm37XOjtClbI/3PPmRgWeokiHCvFZJJjECSooQnG4Yp5ys5WZw26FsJZlshIR2 cNr07crSYhmg+0n1rLXPxSjGfZu57x+5FuPzhiktEUBfC6pw7zPvFf97WLBNWtIr50f2 MviUaLIBhhK9udRYoEDqWz7AH+h3jeJImuc+3Rorf3+AQ2LDfOpVJvJIGD0KvBDo6yoB xRwQ== X-Gm-Message-State: AOJu0YyY16HVlHMOOTWqMLqxSjMqgCxQj2RCucNZuNCxGhqr2OSPT7L9 +SKpt2EhHj8+oP04u/0eDQorMcT7xj8jXbz27uj8c4d4VyJF6Tc5oZu5Usdy4/hcjnhiCAlIDOs Bkw8z6V20/l8X0J+KSAE6cZvV8iEfqm/XWV+N2ghubDRi5KWt+LAYYiUJRQ== X-Received: by 2002:a05:600c:46c7:b0:40e:71e3:139d with SMTP id q7-20020a05600c46c700b0040e71e3139dmr2827895wmo.154.1705946323274; Mon, 22 Jan 2024 09:58:43 -0800 (PST) X-Google-Smtp-Source: AGHT+IFQv1vMlNLkG7fM0Sl6UlLXS2xS0pu8LZcl+ZPCJ+bJ9jqViWhFxqYBAQD5eCFbImEjAglEiw== X-Received: by 2002:a05:600c:46c7:b0:40e:71e3:139d with SMTP id q7-20020a05600c46c700b0040e71e3139dmr2827890wmo.154.1705946322991; Mon, 22 Jan 2024 09:58:42 -0800 (PST) Received: from digraph.polyomino.org.uk (digraph.polyomino.org.uk. [2001:8b0:bf73:93f7::51bb:e332]) by smtp.gmail.com with ESMTPSA id r7-20020a05600c35c700b0040d1bd0e716sm40177838wmq.9.2024.01.22.09.58.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Jan 2024 09:58:42 -0800 (PST) Received: from jsm28 (helo=localhost) by digraph.polyomino.org.uk with local-esmtp (Exim 4.95) (envelope-from ) id 1rRyYw-003cDS-Fh; Mon, 22 Jan 2024 17:58:22 +0000 Date: Mon, 22 Jan 2024 17:58:22 +0000 (UTC) From: Joseph Myers To: Jakub Jelinek cc: libc-alpha@sourceware.org Subject: Re: [PATCH] v2: Use gcc __builtin_stdc_* builtins in stdbit.h if possible In-Reply-To: Message-ID: <1b65b9a1-2ae6-52f-c352-8ae2ba52ee24@redhat.com> References: <7aa693ad-514e-7b7a-8d3-2c59af649ca@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=US-ASCII X-Spam-Status: No, score=-12.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE,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 List-Id: On Mon, 22 Jan 2024, Jakub Jelinek wrote: > When the type-specific macros need to use inline functions, it means > they won't be usable in constant expressions (sure, the standard doesn't > require that). Indeed - usability in constant expressions might wait for a future version of C to have some form of constexpr functions, rather than being expected now. > Anyway, so do you want instead to just use the new GCC builtins only for the > type-generic macros (as done in the following patch, tested like the earlier > one on x86_64), or should the type-specific macros use different > type-specific inlines then which would use the new builtins? I guess if > one can't use them in constant expressions, then the current implementations > of those type-specific macros is just fine. I think just use the new builtins for the type-generic macros. I don't think there's any need to have different implementations of the inline functions. (If any of them don't get compiled to essentially the same code as versions that do use the new builtins, that's best addressed as an optimization improvement in GCC.) > diff --git a/manual/stdbit.texi b/manual/stdbit.texi > index fe41c671d8..0878015cc7 100644 > --- a/manual/stdbit.texi > +++ b/manual/stdbit.texi > @@ -32,7 +32,9 @@ and @code{unsigned long long int}. In addition, there is a > corresponding type-generic macro (not listed below), named the same as > the functions but without any suffix such as @samp{_uc}. The > type-generic macro can only be used with an argument of an unsigned > -integer type with a width of 8, 16, 32 or 64 bits. > +integer type with a width of 8, 16, 32 or 64 bits, or when using > +a compiler with support for stdc builtins such as GCC 14.1 or later > +any unsigned integer type those builtins support. I don't think a reference to "stdc builtins" is very useful for glibc users (but mentioning unsigned __int128 and unsigned _BitInt types as examples supported with GCC 14 would be). -- Joseph S. Myers josmyers@redhat.com