From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-vs1-xe2e.google.com (mail-vs1-xe2e.google.com [IPv6:2607:f8b0:4864:20::e2e]) by sourceware.org (Postfix) with ESMTPS id F083E385802F for ; Mon, 4 Sep 2023 15:01:07 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org F083E385802F Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=cs.washington.edu Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=cs.washington.edu Received: by mail-vs1-xe2e.google.com with SMTP id ada2fe7eead31-44d526f96fcso281668137.1 for ; Mon, 04 Sep 2023 08:01:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cs.washington.edu; s=goo201206; t=1693839667; x=1694444467; darn=gcc.gnu.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=R3BgoBC7hCtxYWXYMZai7i75YEnJaxAGf3ibqryi7mw=; b=UiG9/eu+Afx4AugJ8FzblXKJboVA0BIM5F2ZM49iOcEXPfvdjo0PgfduU9I0R59ws+ I6wzex9dvFCPEtP4jjmSfLEBt+RQHFAYWgOtxSQ+Q8DaDDxkpCDzDS4BQ2jIduPyQIbw 2Gcs5Y8EQg849C2tTlmPK7ydvuCWmZuRXkMeo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1693839667; x=1694444467; h=content-transfer-encoding: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=R3BgoBC7hCtxYWXYMZai7i75YEnJaxAGf3ibqryi7mw=; b=fSr2wl65fja7txluYU/TfSZ5KysCXi6NC3EpTP0FeeRbcBo9/rs0UcOiFcX/6/QYBn SKRIiqwlqPdEO2nTXKfOk88qt5HaTL05JJiFDw7HMPNYU00myHaGsq8a+JGq5KCFmLfV UbfCvCMPFFporVD/QtQpSxHjgqCMW24vdRUHQt//jYF4F4u66U9vyV2LkVG9whMeXb1g QJdO8vwv+0aDxiOhtq9hnJ8IopQGXDdz8QEkIkjok/tSFjj1IYCSKP+M3sZTirea+Ure kZvB7+l5aX0K4cBZLb7DIfzT7LfDzwXLIjQCbCrWslkiJBZnV7Msl3N3VZ2lorccmCMN eDmg== X-Gm-Message-State: AOJu0YzHuUHGiWsKaEPcMxciuYrxy8jTtYBf723vr7u1hG0tlk5KZCFL QEocDiVPG+opfnZ0P958bAQpgYz8P412xLrXFfaNnw== X-Google-Smtp-Source: AGHT+IH/E1TmwgQjPnlhx0vKDJVbufBUD2AZSyjQjlFyXWffdcVxzdQLAWtOgf07AmlcLQ2Qok9E0jgFAySmSKMwprs= X-Received: by 2002:a67:fa0b:0:b0:44e:a18a:2507 with SMTP id i11-20020a67fa0b000000b0044ea18a2507mr6105162vsq.0.1693839667292; Mon, 04 Sep 2023 08:01:07 -0700 (PDT) MIME-Version: 1.0 References: <20230708051137.63707-1-kmatsui@gcc.gnu.org> <20230713023731.15571-1-kmatsui@gcc.gnu.org> <20230713023731.15571-3-kmatsui@gcc.gnu.org> In-Reply-To: From: Ken Matsui Date: Mon, 4 Sep 2023 08:00:00 -0700 Message-ID: Subject: [PING][PATCH v10 2/5] libstdc++: Use new built-in trait __is_reference for std::is_reference To: jason@redhat.com Cc: gcc-patches , "libstdc++" , Ken Matsui Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-10.6 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,GIT_PATCH_0,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP 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: Ping for __is_reference built-in. Sincerely, Ken Matsui On Wed, Jul 12, 2023 at 7:56=E2=80=AFPM Ken Matsui wrote: > > Hi, > > Here is the benchmark result for is_reference: > > https://github.com/ken-matsui/gcc-benches/blob/main/is_reference.md#wed-j= ul-12-074702-pm-pdt-2023 > > Time: -8.15593% > Peak Memory Usage: -4.48408% > Total Memory Usage: -8.03783% > > Sincerely, > Ken Matsui > > On Wed, Jul 12, 2023 at 7:39=E2=80=AFPM Ken Matsui = wrote: > > > > This patch gets std::is_reference to dispatch to new built-in trait > > __is_reference. > > > > libstdc++-v3/ChangeLog: > > > > * include/std/type_traits (is_reference): Use __is_reference bu= ilt-in > > trait. > > (is_reference_v): Likewise. > > > > Signed-off-by: Ken Matsui > > --- > > libstdc++-v3/include/std/type_traits | 14 ++++++++++++++ > > 1 file changed, 14 insertions(+) > > > > diff --git a/libstdc++-v3/include/std/type_traits b/libstdc++-v3/includ= e/std/type_traits > > index 0e7a9c9c7f3..2a14df7e5f9 100644 > > --- a/libstdc++-v3/include/std/type_traits > > +++ b/libstdc++-v3/include/std/type_traits > > @@ -639,6 +639,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION > > // Composite type categories. > > > > /// is_reference > > +#if __has_builtin(__is_reference) > > + template > > + struct is_reference > > + : public __bool_constant<__is_reference(_Tp)> > > + { }; > > +#else > > template > > struct is_reference > > : public false_type > > @@ -653,6 +659,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION > > struct is_reference<_Tp&&> > > : public true_type > > { }; > > +#endif > > > > /// is_arithmetic > > template > > @@ -3192,12 +3199,19 @@ template > > inline constexpr bool is_class_v =3D __is_class(_Tp); > > template > > inline constexpr bool is_function_v =3D is_function<_Tp>::value; > > + > > +#if __has_builtin(__is_reference) > > +template > > + inline constexpr bool is_reference_v =3D __is_reference(_Tp); > > +#else > > template > > inline constexpr bool is_reference_v =3D false; > > template > > inline constexpr bool is_reference_v<_Tp&> =3D true; > > template > > inline constexpr bool is_reference_v<_Tp&&> =3D true; > > +#endif > > + > > template > > inline constexpr bool is_arithmetic_v =3D is_arithmetic<_Tp>::value; > > template > > -- > > 2.41.0 > >