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 D7EEE3870899 for ; Thu, 13 Jun 2024 12:40:25 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org D7EEE3870899 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 D7EEE3870899 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1718282427; cv=none; b=Tgpjshfpbm89RsqcCebxHEGoZ+EGMtTlQFjhVxlmj0Z5ahnmqpLUVSKsazkw50VXvATHDdrBtOC6IpLz69kW5RbH4nlYfGDONsSzKibqD5oBjf1ipruhxDu8bqumZ7uVW0w4YZj1qVeQWnA4xGP4yT+/2LcqkeyVBQq944cL2qQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1718282427; c=relaxed/simple; bh=k2C3c14YQ6CUT5iIYc/IxHstt9hPgO+HXX3I+n2Q+JE=; h=DKIM-Signature:Date:From:To:Subject:Message-ID:MIME-Version; b=YjpUMHSoos52tqc5chhYYsMFMeBhA4NJiGoEL30yFgjBKJnF2JmtqivneYKYdArfeFbghje7M2hOWtK7WjOitmvpwPtOOF6WoQq9CC+cXW0U76woNy5/kSXdSJfG0vAS5gSHkEUUfylFtDF2RK8aNOwBYMNuvjug1+LUfWtoomM= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1718282425; 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=hh1FlyhkSg+PuWINxiqu55qtCo9dlqOPAUPlDCkW9a8=; b=QFGR3+4mjJC22g61vROP8e9o5wub7FXvDy3hGxavDzFYZx0X0ZCCeeOMIX6rp0+0eMKbcx p1qNUeU0VbQgtkpbJw7wBh+mN1kFZcJ5xKnDjZbhxHVoirf7wOcQS5YLIt/Fr9I6roDs4b 9KnZBldR3CAaWE22857UgskiDUkoC0o= Received: from mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-614-gvwnsfVNMhWVbFVb0sjxAQ-1; Thu, 13 Jun 2024 08:40:21 -0400 X-MC-Unique: gvwnsfVNMhWVbFVb0sjxAQ-1 Received: from mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.15]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 220F3195606A; Thu, 13 Jun 2024 12:40:20 +0000 (UTC) Received: from localhost (unknown [10.39.192.128]) by mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 815631956087; Thu, 13 Jun 2024 12:40:19 +0000 (UTC) Date: Thu, 13 Jun 2024 13:40:18 +0100 From: Jonathan Wakely To: Ken Matsui Cc: gcc-patches@gcc.gnu.org, libstdc++@gcc.gnu.org Subject: Re: [PATCH v26 11/13] libstdc++: Optimize std::rank compilation performance Message-ID: References: <20240510161405.194750-21-kmatsui@gcc.gnu.org> <20240511090130.248174-1-kmatsui@gcc.gnu.org> <20240511090130.248174-11-kmatsui@gcc.gnu.org> MIME-Version: 1.0 In-Reply-To: <20240511090130.248174-11-kmatsui@gcc.gnu.org> X-Clacks-Overhead: GNU Terry Pratchett X-Scanned-By: MIMEDefang 3.0 on 10.30.177.15 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline X-Spam-Status: No, score=-10.8 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,RCVD_IN_SBL_CSS,SPF_HELO_NONE,SPF_NONE,TXREP,T_SCC_BODY_TEXT_LINE autolearn=unavailable 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 11/05/24 02:01 -0700, Ken Matsui wrote: >This patch optimizes the compilation performance of std::rank >by dispatching to the new __array_rank built-in trait. OK, thanks. >libstdc++-v3/ChangeLog: > > * include/std/type_traits (rank): Use __array_rank built-in > trait. > (rank_v): Likewise. > >Signed-off-by: Ken Matsui >--- > libstdc++-v3/include/std/type_traits | 11 +++++++++++ > 1 file changed, 11 insertions(+) > >diff --git a/libstdc++-v3/include/std/type_traits b/libstdc++-v3/include/std/type_traits >index 4cc587d4e08..e9313205550 100644 >--- a/libstdc++-v3/include/std/type_traits >+++ b/libstdc++-v3/include/std/type_traits >@@ -1473,6 +1473,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION > }; > > /// rank >+#if _GLIBCXX_USE_BUILTIN_TRAIT(__array_rank) >+ template >+ struct rank >+ : public integral_constant { }; >+#else > template > struct rank > : public integral_constant { }; >@@ -1484,6 +1489,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION > template > struct rank<_Tp[]> > : public integral_constant::value> { }; >+#endif > > /// extent > template >@@ -3583,12 +3589,17 @@ template > template > inline constexpr size_t alignment_of_v = alignment_of<_Tp>::value; > >+#if _GLIBCXX_USE_BUILTIN_TRAIT(__array_rank) >+template >+ inline constexpr size_t rank_v = __array_rank(_Tp); >+#else > template > inline constexpr size_t rank_v = 0; > template > inline constexpr size_t rank_v<_Tp[_Size]> = 1 + rank_v<_Tp>; > template > inline constexpr size_t rank_v<_Tp[]> = 1 + rank_v<_Tp>; >+#endif > > template > inline constexpr size_t extent_v = 0; >-- >2.44.0 >