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.129.124]) by sourceware.org (Postfix) with ESMTPS id EB60838582B0 for ; Wed, 10 Jan 2024 21:19:58 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org EB60838582B0 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 EB60838582B0 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1704921600; cv=none; b=GWkADBdXqwDSihBfpDK1UdCqmM/p8xqdEQi4Cu30MIsqeqqO6yMhWle4bOGOwTSNn5K5dLZ9gxR0796luEc1C20cwnPPYMJe8lDlgHeirCUKYz7BIEmhK2q08+kJ6xAsOLNs78lyzwezZC44QU4wHmTDOGsRlQgU9BGBTkKUYg0= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1704921600; c=relaxed/simple; bh=FnZfc/qFeIVeMTM8ZhH2MgZFc4dfPm/8gzlGkx1n89g=; h=DKIM-Signature:MIME-Version:From:Date:Message-ID:Subject:To; b=R55jRUm6SLwmTM0PXm8LHBnqhQ81UBrLp8BMA30kfPqWdOr51iGVoLF0rW8rwj+QjUlSbrJqqevYOBYEIA9ZwcsZN89qhUceAq4FwplBoSmSJTjpIOvaJkmC+ONa+5vexTuflZlMKuyH0bWf85KUzNxEopiJ5qiwm/KNblYMkSM= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1704921598; 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=96gtFtcJvtOvzCQ+u2JFNJzAIHT0n8bQRac4lQaekxY=; b=JHPTrOsDGFDDaMsoe2/5yo8rQ080WW+YiSMsFgq+9+SZut7V98afp2CNWbH2WZQXNOlg69 Ritai+0QZcunQ2QGJA+0fz8/H1yqvuyNUycEmeVK+iSDzynuUt6cKHSVGBO4AclwDRxFIJ 7lCGG3kd0brVdXIdT2OuWJEc+qbKpl4= Received: from mail-yw1-f200.google.com (mail-yw1-f200.google.com [209.85.128.200]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-299-UJorfW-WOOG2ATaADalKoA-1; Wed, 10 Jan 2024 16:19:57 -0500 X-MC-Unique: UJorfW-WOOG2ATaADalKoA-1 Received: by mail-yw1-f200.google.com with SMTP id 00721157ae682-5f53b4554b6so69505977b3.3 for ; Wed, 10 Jan 2024 13:19:57 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704921597; x=1705526397; 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=96gtFtcJvtOvzCQ+u2JFNJzAIHT0n8bQRac4lQaekxY=; b=vvZfBtE1263XW59mZPwFqGZcxOvNBs5D/3bIi657UvuMTVohvGqlMzoTLR9X+gZIoH cLxC0T6N7Lg7oQQY1b8Omv03hUOxK+BQZ1/bB8bNkhzZxs8qM5f/e+evbU5ej6Dwwl7j 3k7KsyiMSMfJ6Xg4tJwbxbmiHfyGgo8AWnpoyMmSlgL4C054XdqsSLFT8JqMvfA+KBcy yeOuPm0kNlJbHvPGhWShYEdZO6QRhYCt4AkcaMF5Hck5Rbj0QDmBWVeGqzL/G/p/uE+z I7b+kigQIRj0c7itf3MdDrnhZc2FMMoNSM1FjA9Lgk9s/IvVv2G5kP8TgKDyGmOqZe9u tiuw== X-Gm-Message-State: AOJu0Yxo2qETXfvxu3D6ItoBoB9ibT1RbDCwj1Kcodg91fPpqA7OtVP0 x4GxFxWieaVsYjR/6lEzdTaUI4PBmGtfSTBL3S9kA3vSuaWfF/c8rLX9MGb7x+OlleYjKUua1Ml 3ctVGwUX2PP63ZPzIDK/b1MpD/vqdcCUOQFrGRwkGIA== X-Received: by 2002:a81:9151:0:b0:5d7:1940:7d6c with SMTP id i78-20020a819151000000b005d719407d6cmr237729ywg.67.1704921596915; Wed, 10 Jan 2024 13:19:56 -0800 (PST) X-Google-Smtp-Source: AGHT+IH2l5C52kHmDKAwVxWmy6uNIeYq9J4DuSXs5d6S12w9Qo8Q4P7cdN+srmmzW8sf1JEIJcZlCKLLCmpB2HurRC0= X-Received: by 2002:a81:9151:0:b0:5d7:1940:7d6c with SMTP id i78-20020a819151000000b005d719407d6cmr237722ywg.67.1704921596679; Wed, 10 Jan 2024 13:19:56 -0800 (PST) MIME-Version: 1.0 References: <20240110194031.2384005-1-kmatsui@gcc.gnu.org> <20240110194031.2384005-3-kmatsui@gcc.gnu.org> In-Reply-To: <20240110194031.2384005-3-kmatsui@gcc.gnu.org> From: Jonathan Wakely Date: Wed, 10 Jan 2024 21:19:40 +0000 Message-ID: Subject: Re: [PATCH 02/14] libstdc++: Optimize std::is_integral 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.3 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,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:48, Ken Matsui wrote: > > This patch optimizes the compilation performance of std::is_integral > by dispatching to the new __is_integral built-in trait. OK for trunk (if the new built-in gets approved). > > libstdc++-v3/ChangeLog: > > * include/std/type_traits (is_integral): Use __is_integral > built-in trait. > (is_integral_v): Likewise. > > Signed-off-by: Ken Matsui > --- > libstdc++-v3/include/std/type_traits | 15 +++++++++++++++ > 1 file changed, 15 insertions(+) > > diff --git a/libstdc++-v3/include/std/type_traits b/libstdc++-v3/include/std/type_traits > index 1cec0822b73..afa281d9cc4 100644 > --- a/libstdc++-v3/include/std/type_traits > +++ b/libstdc++-v3/include/std/type_traits > @@ -334,6 +334,13 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION > struct is_void > : public true_type { }; > > +#if _GLIBCXX_USE_BUILTIN_TRAIT(__is_integral) > + /// is_integral > + template > + struct is_integral > + : public __bool_constant<__is_integral(_Tp)> > + { }; > +#else > /// @cond undocumented > template > struct __is_integral_helper > @@ -461,6 +468,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION > struct is_integral > : public __is_integral_helper<__remove_cv_t<_Tp>>::type > { }; > +#endif > > /// @cond undocumented > template > @@ -3221,8 +3229,15 @@ template > inline constexpr bool is_void_v = is_void<_Tp>::value; > template > inline constexpr bool is_null_pointer_v = is_null_pointer<_Tp>::value; > + > +#if _GLIBCXX_USE_BUILTIN_TRAIT(__is_integral) > +template > + inline constexpr bool is_integral_v = __is_integral(_Tp); > +#else > template > inline constexpr bool is_integral_v = is_integral<_Tp>::value; > +#endif > + > template > inline constexpr bool is_floating_point_v = is_floating_point<_Tp>::value; > > -- > 2.43.0 >