From patchwork Sat Jan 6 05:05:34 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ken Matsui X-Patchwork-Id: 1883172 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.a=rsa-sha256 header.s=default header.b=BMnVc2pv; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=server2.sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4T6Sys6z8lz1yPK for ; Sat, 6 Jan 2024 16:08:37 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id E84233858C29 for ; Sat, 6 Jan 2024 05:08:33 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E84233858C29 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1704517713; bh=tVHwQQMIqCGSbRdtxxFVP3wkiRnk/ZiKYBRn0h4sEXE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=BMnVc2pv+zp19jwf7BKkgCIUU5Z6h6i6FAoQ/K9h76UedOcytkRJY/1zxrVAqV0ie F6y4h8H1qSQECswZk6677k7Ejiveo5ulHY96pDMpNrwmX7ccAEGJaokg8oFd1yHV3D sjtFOstL4HFYvZxvNPRep6g1milAck7MlD2A6pGI= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mx0b-00641c01.pphosted.com (mx0b-00641c01.pphosted.com [205.220.177.146]) by sourceware.org (Postfix) with ESMTPS id 230763858C60; Sat, 6 Jan 2024 05:08:03 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 230763858C60 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 230763858C60 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=205.220.177.146 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1704517685; cv=none; b=cRGGYRlziS6i0XUGf45Ivx0ZiUmiNWfKnlR57Bt2s5dAnf1KZ3MeocrwTbS947HaY4a5Nz6nAInjPXltjK13z/BRQPPdNLZ5yUkp0XiqfCuZx0Ggj9DEHzwUp1Akv9jpG8vqSnWP/HyY8shomFHsISTLA3Dwn9MbAo0yfqWig6s= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1704517685; c=relaxed/simple; bh=IsoBHT5r1IL0SaAJD8MzTV7Wn/3aNvuculYmI80mXE0=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=cXsd7XpcrHZ7iiHztEXN+fVzClS8bMrlfX9vX+u1tXNYeXW8r644pArww9ICMEJx4rpiUAySPMqLAVYOyjm0rWUoASOJCA4tfbyv9wVwiyfDgHJaVhQk6V2Phm2vPvf1LGPQlviTQ4eA6wK40lxowat9VOeUkaAV8vvAO2AEms4= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from pps.filterd (m0247476.ppops.net [127.0.0.1]) by mx0a-00641c01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 40655xgl005706; Sat, 6 Jan 2024 05:08:02 GMT Received: from mxout22.s.uw.edu (mxout22.s.uw.edu [128.95.242.222]) by mx0a-00641c01.pphosted.com (PPS) with ESMTPS id 3vexq30ax2-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sat, 06 Jan 2024 05:08:02 +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 406580Oh007430 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 5 Jan 2024 21:08:00 -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 406580H5000483 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 5 Jan 2024 21:08:00 -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 v3 0/8] Optimize more type traits Date: Fri, 5 Jan 2024 21:05:34 -0800 Message-ID: <20240106050754.3054782-1-kmatsui@gcc.gnu.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20231223220432.712093-1-kmatsui@gcc.gnu.org> References: <20231223220432.712093-1-kmatsui@gcc.gnu.org> MIME-Version: 1.0 X-Proofpoint-ORIG-GUID: LS0yh4JcbHSVAba_HVSJ1QGk9LORYCrm X-Proofpoint-GUID: LS0yh4JcbHSVAba_HVSJ1QGk9LORYCrm 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-05_08,2024-01-05_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxscore=0 clxscore=1034 impostorscore=0 bulkscore=0 spamscore=0 priorityscore=1501 suspectscore=0 malwarescore=0 mlxlogscore=240 adultscore=0 lowpriorityscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311290000 definitions=main-2401060033 X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00, JMQ_SPF_NEUTRAL, KAM_DMARC_STATUS, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, 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 X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org Changes in v3: - Rebased on top of master. - Fixed __is_pointer in cpp_type_traits.h. Changes in v2: - Removed testsuite_tr1.h includes from the testcases. --- This patch series implements __is_const, __is_volatile, __is_pointer, and __is_unbounded_array built-in traits, which were isolated from my previous patch series "Optimize type traits compilation performance" because they contained performance regression. I confirmed that this patch series does not cause any performance regression. The main reason of the performance regression were the exhaustiveness of the benchmarks and the instability of the benchmark results. Here are new benchmark results: is_const: https://github.com/ken-matsui/gcc-bench/blob/main/is_const.md#sat-dec-23-090605-am-pst-2023 time: -4.36603%, peak memory: -0.300891%, total memory: -0.247934% is_volatile_v: https://github.com/ken-matsui/gcc-bench/blob/main/is_volatile_v.md#sat-dec-23-091518-am-pst-2023 time: -4.06816%, peak memory: -0.609298%, total memory: -0.659134% is_pointer: https://github.com/ken-matsui/gcc-bench/blob/main/is_pointer.md#sat-dec-23-124903-pm-pst-2023 time: -2.47124%, peak memory: -2.98207%, total memory: -4.0811% is_unbounded_array_v: https://github.com/ken-matsui/gcc-bench/blob/main/is_unbounded_array_v.md#sat-dec-23-010046-pm-pst-2023 time: -1.50025%, peak memory: -1.07386%, total memory: -2.32394% Ken Matsui (8): c++: Implement __is_const built-in trait libstdc++: Optimize std::is_const compilation performance c++: Implement __is_volatile built-in trait libstdc++: Optimize std::is_volatile compilation performance c++: Implement __is_pointer built-in trait libstdc++: Optimize std::is_pointer compilation performance c++: Implement __is_unbounded_array built-in trait libstdc++: Optimize std::is_unbounded_array compilation performance gcc/cp/constraint.cc | 12 +++ gcc/cp/cp-trait.def | 4 + gcc/cp/semantics.cc | 16 ++++ gcc/testsuite/g++.dg/ext/has-builtin-1.C | 12 +++ gcc/testsuite/g++.dg/ext/is_const.C | 20 +++++ gcc/testsuite/g++.dg/ext/is_pointer.C | 51 +++++++++++++ gcc/testsuite/g++.dg/ext/is_unbounded_array.C | 37 ++++++++++ gcc/testsuite/g++.dg/ext/is_volatile.C | 20 +++++ libstdc++-v3/include/bits/cpp_type_traits.h | 31 +++++++- libstdc++-v3/include/std/type_traits | 73 +++++++++++++++++-- 10 files changed, 267 insertions(+), 9 deletions(-) create mode 100644 gcc/testsuite/g++.dg/ext/is_const.C create mode 100644 gcc/testsuite/g++.dg/ext/is_pointer.C create mode 100644 gcc/testsuite/g++.dg/ext/is_unbounded_array.C create mode 100644 gcc/testsuite/g++.dg/ext/is_volatile.C