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 [216.205.24.124]) by sourceware.org (Postfix) with ESMTP id 12A37395446E for ; Wed, 25 Nov 2020 09:23:38 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 12A37395446E 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-515--riuCxieP_mypDE3P9Y7Mg-1; Wed, 25 Nov 2020 04:23:35 -0500 X-MC-Unique: -riuCxieP_mypDE3P9Y7Mg-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 736F1190B2BF for ; Wed, 25 Nov 2020 09:23:34 +0000 (UTC) Received: from tucnak.zalov.cz (ovpn-113-127.ams2.redhat.com [10.36.113.127]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 1D5555D9C2; Wed, 25 Nov 2020 09:23:33 +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 0AP9NWOB1411454 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Wed, 25 Nov 2020 10:23:32 +0100 Received: (from jakub@localhost) by tucnak.zalov.cz (8.16.1/8.16.1/Submit) id 0AP9NVx51411453; Wed, 25 Nov 2020 10:23:31 +0100 Date: Wed, 25 Nov 2020 10:23:31 +0100 From: Jakub Jelinek To: Jeff Law Cc: Jason Merrill , Jonathan Wakely , gcc-patches@gcc.gnu.org Subject: Re: [PATCH] c++: v2: Add __builtin_bit_cast to implement std::bit_cast [PR93121] Message-ID: <20201125092331.GW3788@tucnak> Reply-To: Jakub Jelinek References: <20200718185056.GN2363@tucnak> <0dda7918-cc7f-3f3f-64c0-34896ef9e15d@redhat.com> <20201102192107.GH3788@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=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-6.0 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, 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: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 25 Nov 2020 09:23:39 -0000 On Tue, Nov 24, 2020 at 05:31:03PM -0700, Jeff Law wrote: > FIrst, do we need to document the new builtin?  I think for builtins that are only meant for libstdc++ as underlying implementation of its documented in the standard APIs we have some cases where we don't document them and other cases where we don't. I can certainly add doc/extend.texi documentation for it. > > --- gcc/fold-const.c.jj 2020-10-15 15:09:49.079725120 +0200 > > +++ gcc/fold-const.c 2020-11-02 17:20:43.784633491 +0100 > > @@ -7998,6 +8083,8 @@ native_encode_initializer (tree init, un > > if (ptr) > > memcpy (ptr + (curpos - o), ptr + (pos - o), > > fieldsize); > > + if (mask) > > + memcpy (mask + curpos, mask + pos, fieldsize); > > } > > else if (!native_encode_initializer (val, > > ptr > Presumably we've already determined that the memcpy won't have an > overlap between the source and destination here? Yes, similar reason why the memcpy above that doesn't overlap. This is when we want to save work, and compute the value bits and mask bits for one element and then just copy it over to all following elements that are initialized with the same value when the index is a RANGE_EXPR. Jakub