From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx0a-00641c01.pphosted.com (mx0a-00641c01.pphosted.com [205.220.165.146]) by sourceware.org (Postfix) with ESMTPS id 9E4573858030; Wed, 10 Jan 2024 19:41:23 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 9E4573858030 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=gcc.gnu.org Authentication-Results: sourceware.org; spf=fail smtp.mailfrom=gcc.gnu.org ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 9E4573858030 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=205.220.165.146 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1704915685; cv=none; b=XKeYi0fkwOWO/kEPrQOq/BHl/RMvmWrs4y+9bOq7mWePHsj0okRP66GVyJO4K36pdqN0vfhHVOC0WSfNL6G/K0gccnbzINC5auWUgHC6cVdulWTe04mMgfQBgjig86DHMSlrnJgK3f/u1bVM7S1UGqqsYz/R33VZluTZ5So/rmI= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1704915685; c=relaxed/simple; bh=ByVPDZ0I/rEOU0KGf+27iYlz8IfJoYwX11TuFGuYdKQ=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=RENJxWxcrlBKiAD0+Ptn3SJyVTeuwHPAqcQutdvEY4VyQE9smqn97h7pTT8HBsVyWMOFvZD2LnCAQUy44rwXqQt1BM+mdzahZmX2jI30w5b+oNUGqZcNPqEm13n5hFfxjHW5lSrmS5vxQWY9nRZ9s0W1KDhbIxy7CiXSipdCvWg= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from pps.filterd (m0247475.ppops.net [127.0.0.1]) by mx0a-00641c01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 40AJdWls018807; Wed, 10 Jan 2024 19:41:22 GMT Received: from mxout22.s.uw.edu (mxout22.s.uw.edu [128.95.242.222]) by mx0a-00641c01.pphosted.com (PPS) with ESMTPS id 3vj0we0hpk-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 10 Jan 2024 19:41:20 +0000 Received: from smtp.washington.edu (smtp.washington.edu [128.208.60.54]) by mxout22.s.uw.edu (8.14.4+UW20.07/8.14.4+UW22.04) with ESMTP id 40AJegs5006371 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 10 Jan 2024 11:40:42 -0800 X-Auth-Received: from kmatsui-ThinkPad-X1-Carbon-Gen-9.dhcp4.washington.edu ([10.154.74.143]) (authenticated authid=kmatsui) by smtp.washington.edu (8.16.1+UW21.10/8.14.4+UW19.10) with ESMTPSA id 40AJefn9020412 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 10 Jan 2024 11:40:41 -0800 X-UW-Orig-Sender: kmatsui@smtp.washington.edu From: Ken Matsui To: gcc-patches@gcc.gnu.org Cc: libstdc++@gcc.gnu.org, Ken Matsui Subject: [PATCH 00/14] Optimize integral-related type traits Date: Wed, 10 Jan 2024 01:22:51 -0800 Message-ID: <20240110194031.2384005-1-kmatsui@gcc.gnu.org> X-Mailer: git-send-email 2.43.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Proofpoint-ORIG-GUID: pEyTjWwyxESijpCtJfj7pKlvARtEROk6 X-Proofpoint-GUID: pEyTjWwyxESijpCtJfj7pKlvARtEROk6 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.997,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-01-10_10,2024-01-10_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 priorityscore=1501 bulkscore=0 clxscore=1034 lowpriorityscore=0 suspectscore=0 mlxlogscore=233 impostorscore=0 mlxscore=0 phishscore=0 spamscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311290000 definitions=main-2401100156 X-Spam-Status: No, score=-1.0 required=5.0 tests=BAYES_00,DATE_IN_PAST_06_12,JMQ_SPF_NEUTRAL,KAM_DMARC_STATUS,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NEUTRAL,TXREP,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: This patch series implements __is_integral, __is_floating_point, __is_arithmetic, __is_unsigned, __is_signed, and __is_scalar built-in traits and optimizes std::is_integral, std::is_floating_point, std::is_arithmetic, std::is_unsigned, std::is_signed, std::is_scalar, std::is_fundamental, and std::is_compound compilation performance. Here are the benchmark results: std::is_integral: https://github.com/ken-matsui/gcc-bench/blob/main/is_integral.md#wed-jan-10-112014-am-pst-2024 Time: -28.5606%, Peak Mem: -25.0022%, Total Mem: -22.4503% std::is_integral_v: https://github.com/ken-matsui/gcc-bench/blob/main/is_integral_v.md#wed-jan-10-112014-am-pst-2024 Time: -44.9068%, Peak Mem: -37.046%, Total Mem: -36.3088% std::is_floating_point: https://github.com/ken-matsui/gcc-bench/blob/main/is_floating_point.md#wed-jan-10-112014-am-pst-2024 Time: -22.1413%, Peak Mem: -24.9831%, Total Mem: -22.4503% std::is_floating_point_v: https://github.com/ken-matsui/gcc-bench/blob/main/is_floating_point_v.md#wed-jan-10-112014-am-pst-2024 Time: -44.9223%, Peak Mem: -37.0304%, Total Mem: -36.2869% std::is_arithmetic: https://github.com/ken-matsui/gcc-bench/blob/main/is_arithmetic.md#wed-jan-10-112014-am-pst-2024 Time: -67.5805%, Peak Mem: -55.3318%, Total Mem: -58.5106% std::is_arithmetic_v: https://github.com/ken-matsui/gcc-bench/blob/main/is_arithmetic_v.md#wed-jan-10-112014-am-pst-2024 Time: -74.1939%, Peak Mem: -61.3623%, Total Mem: -64.8586% std::is_fundamental: https://github.com/ken-matsui/gcc-bench/blob/main/is_fundamental.md#wed-jan-10-112014-am-pst-2024 Time: -62.5392%, Peak Mem: -49.5002%, Total Mem: -53.3734% std::is_fundamental_v: https://github.com/ken-matsui/gcc-bench/blob/main/is_fundamental_v.md#wed-jan-10-112014-am-pst-2024 Time: -56.9926%, Peak Mem: -49.3151%, Total Mem: -53.8913% std::is_compound: https://github.com/ken-matsui/gcc-bench/blob/main/is_compound.md#wed-jan-10-112014-am-pst-2024 Time: -56.3176%, Peak Mem: -45.7971%, Total Mem: -49.4637% std::is_compound_v: https://github.com/ken-matsui/gcc-bench/blob/main/is_compound_v.md#wed-jan-10-112014-am-pst-2024 Time: -56.0783%, Peak Mem: -47.7484%, Total Mem: -52.5631% std::is_unsigned: https://github.com/ken-matsui/gcc-bench/blob/main/is_unsigned.md#wed-jan-10-112014-am-pst-2024 Time: -75.9165%, Peak Mem: -65.632%, Total Mem: -68.8883% std::is_unsigned_v: https://github.com/ken-matsui/gcc-bench/blob/main/is_unsigned_v.md#wed-jan-10-112014-am-pst-2024 Time: -81.7237%, Peak Mem: -70.1175%, Total Mem: -73.4473% std::is_signed: https://github.com/ken-matsui/gcc-bench/blob/main/is_signed.md#wed-jan-10-112014-am-pst-2024 Time: -72.8341%, Peak Mem: -61.9239%, Total Mem: -64.5455% std::is_signed_v: https://github.com/ken-matsui/gcc-bench/blob/main/is_signed_v.md#wed-jan-10-112014-am-pst-2024 Time: -79.9365%, Peak Mem: -66.9684%, Total Mem: -69.8372% std::is_scalar: https://github.com/ken-matsui/gcc-bench/blob/main/is_scalar.md#wed-jan-10-112014-am-pst-2024 Time: -87.2356%, Peak Mem: -79.0888%, Total Mem: -82.2095% std::is_scalar_v: https://github.com/ken-matsui/gcc-bench/blob/main/is_scalar_v.md#wed-jan-10-112014-am-pst-2024 Time: -89.5349%, Peak Mem: -83.2528%, Total Mem: -85.6074% Ken Matsui (14): c++: Implement __is_integral built-in trait libstdc++: Optimize std::is_integral compilation performance c++: Implement __is_floating_point built-in trait libstdc++: Optimize std::is_floating_point compilation performance c++: Implement __is_arithmetic built-in trait libstdc++: Optimize std::is_arithmetic compilation performance libstdc++: Optimize std::is_fundamental compilation performance libstdc++: Optimize std::is_compound compilation performance c++: Implement __is_unsigned built-in trait libstdc++: Optimize std::is_unsigned compilation performance c++: Implement __is_signed built-in trait libstdc++: Optimize std::is_signed compilation performance c++: Implement __is_scalar built-in trait libstdc++: Optimize std::is_scalar compilation performance gcc/cp/constraint.cc | 18 ++++ gcc/cp/cp-trait.def | 6 ++ gcc/cp/semantics.cc | 65 +++++++++++- gcc/testsuite/g++.dg/ext/has-builtin-1.C | 18 ++++ gcc/testsuite/g++.dg/ext/is_arithmetic.C | 31 ++++++ gcc/testsuite/g++.dg/ext/is_floating_point.C | 43 ++++++++ gcc/testsuite/g++.dg/ext/is_integral.C | 49 +++++++++ gcc/testsuite/g++.dg/ext/is_scalar.C | 28 +++++ gcc/testsuite/g++.dg/ext/is_signed.C | 45 +++++++++ gcc/testsuite/g++.dg/ext/is_unsigned.C | 45 +++++++++ libstdc++-v3/include/std/type_traits | 101 ++++++++++++++++++- 11 files changed, 441 insertions(+), 8 deletions(-) create mode 100644 gcc/testsuite/g++.dg/ext/is_arithmetic.C create mode 100644 gcc/testsuite/g++.dg/ext/is_floating_point.C create mode 100644 gcc/testsuite/g++.dg/ext/is_integral.C create mode 100644 gcc/testsuite/g++.dg/ext/is_scalar.C create mode 100644 gcc/testsuite/g++.dg/ext/is_signed.C create mode 100644 gcc/testsuite/g++.dg/ext/is_unsigned.C -- 2.43.0