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 ESMTP id 516C9384841A for ; Thu, 24 Jun 2021 14:21:18 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 516C9384841A Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-72-EklgteU0Pyi29_-6TJ6MsQ-1; Thu, 24 Jun 2021 10:21:11 -0400 X-MC-Unique: EklgteU0Pyi29_-6TJ6MsQ-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id E95C81835AC6; Thu, 24 Jun 2021 14:21:09 +0000 (UTC) Received: from tucnak.zalov.cz (ovpn-112-143.ams2.redhat.com [10.36.112.143]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 4B99D5D9C6; Thu, 24 Jun 2021 14:21:09 +0000 (UTC) Received: from tucnak.zalov.cz (localhost [127.0.0.1]) by tucnak.zalov.cz (8.16.1/8.16.1) with ESMTPS id 15OEL54t1297806 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Thu, 24 Jun 2021 16:21:06 +0200 Received: (from jakub@localhost) by tucnak.zalov.cz (8.16.1/8.16.1/Submit) id 15OEL41v1297805; Thu, 24 Jun 2021 16:21:04 +0200 Date: Thu, 24 Jun 2021 16:21:04 +0200 From: Jakub Jelinek To: Jonathan Wakely Cc: Matthias Kretz , gcc Patches , libstdc++ Subject: Re: [PATCH 04/11 v3] libstdc++: Make use of __builtin_bit_cast Message-ID: <20210624142104.GU7746@tucnak> Reply-To: Jakub Jelinek References: <270527782.u9WJ3AIrlG@excalibur> <3553838.ebMzRN9Arp@excalibur> <3315301.e9AK2G76lq@excalibur> <14392010.RDIVbhacDa@minbar> <20210624140837.GT7746@tucnak> MIME-Version: 1.0 In-Reply-To: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Spam-Status: No, score=-5.8 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: libstdc++@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libstdc++ mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Jun 2021 14:21:19 -0000 On Thu, Jun 24, 2021 at 03:11:01PM +0100, Jonathan Wakely wrote: > On Thu, 24 Jun 2021 at 15:08, Jakub Jelinek wrote: > > > > On Thu, Jun 24, 2021 at 04:01:34PM +0200, Matthias Kretz wrote: > > > --- a/libstdc++-v3/include/experimental/bits/simd.h > > > +++ b/libstdc++-v3/include/experimental/bits/simd.h > > > @@ -1598,7 +1598,9 @@ template > > > _GLIBCXX_SIMD_INTRINSIC constexpr _To > > > __bit_cast(const _From __x) > > > { > > > - // TODO: implement with / replace by __builtin_bit_cast ASAP > > > +#if __has_builtin(__builtin_bit_cast) > > > > Shouldn't that use #if _GLIBCXX_HAS_BUILTIN(__builtin_bit_cast) in > > c++config to define a new macro and use that macro here? > > Though it is true that c++config already uses > > #if __has_builtin(__builtin_is_constant_evaluated) > > and so would fail miserably for compilers that don't support __has_builtin > > GCC was the last of our supported compilers to implement > __has_builtin, so for GCC trunk we can assume that it's always > supported. We don't support mixing GCC and libstdc++ versions, so I'm not worried about GCC. At least according to godbolt, already clang 3.0 supports it which is 10 years old, so probably fine too, but ICC 19.0/19.1 still doesn't support it, only ICC 2021 does. And ICC 19.1 seems to be released in October 2020. So, wouldn't it be better not to #undef _GLIBCXX_HAS_BUILTIN, move its definition a little bit earlier and use it also for __builtin_is_constant_evaluated? Jakub