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.133.124]) by sourceware.org (Postfix) with ESMTPS id 4188C3858D33 for ; Thu, 28 Jul 2022 16:22:58 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 4188C3858D33 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-320-vaTopkWgM8WDuKLvtdeM0A-1; Thu, 28 Jul 2022 12:22:56 -0400 X-MC-Unique: vaTopkWgM8WDuKLvtdeM0A-1 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 6F10A811E75; Thu, 28 Jul 2022 16:22:56 +0000 (UTC) Received: from oldenburg.str.redhat.com (unknown [10.39.192.122]) by smtp.corp.redhat.com (Postfix) with ESMTPS id D04EE492CA2; Thu, 28 Jul 2022 16:22:55 +0000 (UTC) From: Florian Weimer To: Wilco Dijkstra via Libc-alpha Cc: Wilco Dijkstra Subject: Re: [PATCH] Remove atomic-machine headers References: Date: Thu, 28 Jul 2022 18:22:54 +0200 In-Reply-To: (Wilco Dijkstra via Libc-alpha's message of "Thu, 28 Jul 2022 14:30:30 +0000") Message-ID: <87czdpyzoh.fsf@oldenburg.str.redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.85 on 10.11.54.9 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain X-Spam-Status: No, score=-10.9 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, SPF_HELO_NONE, SPF_NONE, 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: 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: Thu, 28 Jul 2022 16:22:59 -0000 * Wilco Dijkstra via Libc-alpha: > diff --git a/configure b/configure > index ff2c406b3b573484c843742d292fc2e0ee0e3008..3efdf45f99af71a482509f559d9de90aa294700c 100755 > --- a/configure > +++ b/configure > @@ -727,6 +727,7 @@ infodir > docdir > oldincludedir > includedir > +runstatedir > localstatedir > sharedstatedir > sysconfdir Spurious difference. > +typedef struct { long long t; } X; > +extern void has_64b_atomics(void); > +void f(void) > +{ > + X x; > + /* Use address of structure with 64-bit type. This avoids incorrect > + implementations which return true even if long long is not 64-bit aligned. > + This works on GCC and LLVM - other cases have bugs and they disagree. */ > + if (__atomic_always_lock_free (sizeof (x), &x)) > + has_64b_atomics(); Can you use _static_assert, given that it's supposed to yield a compile-time constant? I'd be suprised if __atomic_always_lock_free is correct on all glibc-supported architectures, though. > diff --git a/sysdeps/x86/atomic-machine.h b/sysdeps/x86/atomic-machine.h > index 98541a2d06ff5e4aa8c789ab7405215097471971..303458d1296e4b1cd7cd654e0904ace0ffc52fae 100644 > --- a/sysdeps/x86/atomic-machine.h > +++ b/sysdeps/x86/atomic-machine.h > @@ -21,17 +21,6 @@ > > #include /* For mach. */ > > -#ifdef __x86_64__ > -# define __HAVE_64B_ATOMICS 1 > -#else > -/* Since the Pentium, i386 CPUs have supported 64-bit atomics, but the > - i386 psABI supplement provides only 4-byte alignment for uint64_t > - inside structs, so it is currently not possible to use 64-bit > - atomics on this platform. */ > -# define __HAVE_64B_ATOMICS 0 > -#endif > -#define ATOMIC_EXCHANGE_USES_CAS 0 > - > #define atomic_spin_nop() __asm ("pause") > > #endif /* atomic-machine.h */ Please preserve this comment somewhere. Maybe folod it into the configure test example. Thanks, Florian