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 ACDA7386EC2B for ; Wed, 10 Jan 2024 21:23:15 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org ACDA7386EC2B 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 ACDA7386EC2B 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=1704921797; cv=none; b=Wp7fQAx+QxLH/yGEnWzOrYVRLV+qXOG2epzwfoOMSabMOp0VuxTeK+TXK71EaJCh71Aw3YpHqO2U3ZOD19XquQ4wJd8B8ED2iH8y/8dHeKuTEPvQdfIZERKkZ6BvJ+vU/PC+CWTm9OxgNH4VFTv8nRTZRaCfhKqSxBWamlEVYlE= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1704921797; c=relaxed/simple; bh=r0ecmyy7HrPrDDOw0atU5+SoCfHkZbcixVQj7cDNoE0=; h=DKIM-Signature:MIME-Version:From:Date:Message-ID:Subject:To; b=uKwA2K2ZQat6UsTLxA8A9gdCxT8JfrXUd6180FXhznj8Nn47jATqggRbP1/Hkz98CeAJKZXv9byEmVBhrW0oVumGToXCBvPR2HIRAhiQ8IQjR9FysJQKEkv6PMejZt7CY/b3GYIzYIF251O+TUIfJVS8sHacPwwT4DxGZIQJI3c= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1704921795; 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=p4YERoF9+39lJDsJDU2ZpQ/OQvo3nKx5roU68TqJcWQ=; b=A/9cuJOD/XGmDzYmYpp7S1pDZOeb0jHdZV47FMkM9ec6NDZPrK/ZLcIgM4BCWxuuGIFhKF SeIGx8tFUNebzjVUFgDVLzX840JVvuyokDI4CJVEX26RKr9LcRe0coGuJ60E5sVVRYJBTV 3GA1brRzj+2JICE0iWuq3XmD0ZwSUx0= Received: from mail-yb1-f197.google.com (mail-yb1-f197.google.com [209.85.219.197]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-36-wagS853WMsWcArSP4pIwrQ-1; Wed, 10 Jan 2024 16:23:13 -0500 X-MC-Unique: wagS853WMsWcArSP4pIwrQ-1 Received: by mail-yb1-f197.google.com with SMTP id 3f1490d57ef6-dbee47bacb5so5209785276.1 for ; Wed, 10 Jan 2024 13:23:13 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704921793; x=1705526593; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=p4YERoF9+39lJDsJDU2ZpQ/OQvo3nKx5roU68TqJcWQ=; b=K4DXzuBFdWC09A6yF1X6qtQAS8THolzCYA4rqzYJ15mTOrtI3Bt7+ZD9AS81fI89lv HSZBcN52VSHxcFBNNcOUtilJUS+CjjQrIfgA6l7IkOwwlIv7+32CrMVLfjDl9EpYFl38 dRs0oN+sdeJgFaZSDrxvi2XNiS5EgkJPRLL4r9YrNepvpBHC/qmRcuS6bs35Er+8rWjV l+Tcp13cjTGgiGD4+TBJ6hJM5dNDi7vYccGlrYatBPhjblp3mJzSz2PfLlBnnL8TqKIj dWv2dUkpCBUGUFG4jPdaS+qtRuDkvIDrxQzd89jjxC3iCCS+3a6qeoSivcalUbDPA9UY 9HDA== X-Gm-Message-State: AOJu0YzTTJFz8uD+QhHbeOcILnqDceZJ9P+xUEQGEp2pNUloM7sW1LAc qa5Zes//f900Zy0Xq0fs5TyVkhrssJaSh97zsFVJwfCtyoNacff14ekgYoVIrLrIl+aeLmwVu5P r1Zb7ehHJbrnyoC5y/0dgUZFOAFSAG32PHl2Ui6Q/Fg== X-Received: by 2002:a25:5f4e:0:b0:dbe:d55c:8e69 with SMTP id h14-20020a255f4e000000b00dbed55c8e69mr473453ybm.54.1704921793448; Wed, 10 Jan 2024 13:23:13 -0800 (PST) X-Google-Smtp-Source: AGHT+IGD2UIcdWbsJxMxwTIN6y1W1qQN/wwdth1txQ0FfaKkVqNCCmcNN9ovKKNH0UAKPC/u2nQi7uTjSDBMbAwIBpM= X-Received: by 2002:a25:5f4e:0:b0:dbe:d55c:8e69 with SMTP id h14-20020a255f4e000000b00dbed55c8e69mr473446ybm.54.1704921793171; Wed, 10 Jan 2024 13:23:13 -0800 (PST) MIME-Version: 1.0 References: <20240110194031.2384005-1-kmatsui@gcc.gnu.org> <20240110194031.2384005-15-kmatsui@gcc.gnu.org> In-Reply-To: <20240110194031.2384005-15-kmatsui@gcc.gnu.org> From: Jonathan Wakely Date: Wed, 10 Jan 2024 21:22:57 +0000 Message-ID: Subject: Re: [PATCH 14/14] libstdc++: Optimize std::is_scalar compilation performance To: Ken Matsui Cc: gcc-patches@gcc.gnu.org, libstdc++@gcc.gnu.org X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-13.1 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_H3,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 Wed, 10 Jan 2024 at 19:47, Ken Matsui wrote: > > This patch optimizes the compilation performance of std::is_scalar > by dispatching to the new __is_scalar built-in trait. OK for trunk (if the new built-in is approved). > > libstdc++-v3/ChangeLog: > > * include/std/type_traits (is_scalar): Use __is_scalar built-in > trait. > (is_scalar_v): Likewise. > > Signed-off-by: Ken Matsui > --- > libstdc++-v3/include/std/type_traits | 13 +++++++++++++ > 1 file changed, 13 insertions(+) > > diff --git a/libstdc++-v3/include/std/type_traits b/libstdc++-v3/include/std/type_traits > index b917c743aea..9ace6a9f08f 100644 > --- a/libstdc++-v3/include/std/type_traits > +++ b/libstdc++-v3/include/std/type_traits > @@ -775,11 +775,18 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION > struct is_member_pointer; > > /// is_scalar > +#if _GLIBCXX_USE_BUILTIN_TRAIT(__is_scalar) > + template > + struct is_scalar > + : public __bool_constant<__is_scalar(_Tp)> > + { }; > +#else > template > struct is_scalar > : public __or_, is_enum<_Tp>, is_pointer<_Tp>, > is_member_pointer<_Tp>, is_null_pointer<_Tp>>::type > { }; > +#endif > > /// is_compound > template > @@ -3369,8 +3376,14 @@ template > inline constexpr bool is_object_v = is_object<_Tp>::value; > #endif > > +#if _GLIBCXX_USE_BUILTIN_TRAIT(__is_scalar) > +template > + inline constexpr bool is_scalar_v = __is_scalar(_Tp); > +#else > template > inline constexpr bool is_scalar_v = is_scalar<_Tp>::value; > +#endif > + > template > inline constexpr bool is_compound_v = !is_fundamental_v<_Tp>; > > -- > 2.43.0 >