From patchwork Sat Dec 23 22:02:41 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ken Matsui X-Patchwork-Id: 18506 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:2483:b0:fb:cd0c:d3e with SMTP id q3csp1882378dyi; Sat, 23 Dec 2023 14:05:29 -0800 (PST) X-Google-Smtp-Source: AGHT+IEQtp47/TsElJprlj4dxzBER/Y/VX/+366vDZXIgoJLZGpsdKQRqVih5NE73H7QYIAyqa9b X-Received: by 2002:a05:620a:4592:b0:781:2067:3710 with SMTP id bp18-20020a05620a459200b0078120673710mr7621600qkb.62.1703369129358; Sat, 23 Dec 2023 14:05:29 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1703369129; cv=pass; d=google.com; s=arc-20160816; b=RL5XyZSr/8E62CnXmjIw2U9xa/iWfqKN6BzV+JjnIiOZX/mGCleuuid+5I6S9Zm/LQ X1q2aixX+BYbRab0TqnHjdUX/APXq1SWUACyvtVLPXf3LTueDpvQV4B0uoQaACNDh2DX QEE5kbe1cvD8q+esbMP0n6yKxoZRkew2hbZ0IH9m46AFbCMWb/yDaO5WaFK/7uTXJd9C 1551g1LvaYIDcEdijlltjVgW03/VwCZMdUBpt/gL/ia5T+kEsmtE2drc25X5OWVTFba/ GI3qR6BGHozpa2Ymk6PlpF5Uec6ueHyYCTcBYDJdxH/0nPs5VOcKIsgpfSTnPahdnqbn INqA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:message-id:date:subject:cc:to:from:arc-filter :dmarc-filter:delivered-to:dkim-signature:dkim-filter; bh=/OlZUgz9Jut6v6PoQy33BlZMHerI5isKSyiBnQ+2JUY=; fh=kSSy/oyUXqQD15FLeKdymIgDBFPFITPA1Gj52CNOxRQ=; b=qVindnsd7fgE235JDPbNzNxtbzqqtrykVStd1u6LlNQE6vfc3golqni+JxQ2qB2R2u MGW7eT5GHJW/chzHj3ivUT0hTJklEuX6KK+0KchUIn353fGfAz4JO1i1LOWP6yOyoSWC uKs6bTXJSG+R/U4D9ZrrTgQdplDPwN/B8eKeSEyupseQ4tIksMO6oqW55x/YAPpuObaB Bp2WT0xiy0opLgkb6pgc9Iwez8AJKN+9wCxhlIwfCMrmHfq+g9fRW+/GK/AfLGibVBvT q49I/9QljjVgqxehM64KQySPLd0TaeT5kCwWZJpeJFmJHTAQ2B9Sm73ZjOTp6f5RMmAD c+mg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=AXE+XTuz; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from server2.sourceware.org (server2.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id h15-20020a05620a13ef00b0077f0e33c196si7298346qkl.223.2023.12.23.14.05.29 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 23 Dec 2023 14:05:29 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=AXE+XTuz; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 09D7A3857BA1 for ; Sat, 23 Dec 2023 22:05:29 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 09D7A3857BA1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1703369129; bh=/OlZUgz9Jut6v6PoQy33BlZMHerI5isKSyiBnQ+2JUY=; h=From:To:Cc:Subject:Date:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From; b=AXE+XTuzdu0lXbSN34KpZiN9yKBgwahCrPE/2dFaU1VSrNw+9XVAOOjmV+OrRHLLo t830AY9ST4hNX0X+Nz8L3wJAsYEt0s9D+5cExp40hmH9MEbuCeDKHkoba6ZtDu0/8C xnbxKyYvLSO2mGVylDebnpsc0ykyrwzUVFQA+RmA= 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 EECE53858C54; Sat, 23 Dec 2023 22:04:45 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org EECE53858C54 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 EECE53858C54 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=1703369088; cv=none; b=HjGUMhyrLsqzCBpsc0zfJgnfmJauzGD+zeaYUXBCL/BAWbXwGLEeoUCU6DXGpr1DWU+/v5V6ABtiLxbGi3YD6+ykV8zf5cW7RXnis2TibyZDho3wlzbuNrXmSPu5JocXAGczyvQBh2mIpuRJB7EqLZ+5q7diXCknDxbM6QoATaQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1703369088; c=relaxed/simple; bh=HfR1++nzv+s1TNjSYg5k3D44eJWrMFDSc3Lnk/NsyOI=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=sHYLFFUMeXvCahsMljm6r3kVvINp3AW7ZpWXDTZg8UIh400PsKpdmhr6IYC909C8hnFU9kkkhpcgBuZ0nFgSkdKY96R9rqgTTtIpu/MXk/jx0Uts3Tb97CacBDZFetynDju+QkQfCRImof4+6AACRps+e4l1xVjOUy4elfESFag= 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 3BNM1HlT013824; Sat, 23 Dec 2023 22:04:45 GMT Received: from mxout25.s.uw.edu (mxout25.s.uw.edu [140.142.234.175]) by mx0a-00641c01.pphosted.com (PPS) with ESMTPS id 3v5r01k6sn-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sat, 23 Dec 2023 22:04:45 +0000 Received: from smtp.washington.edu (smtp.washington.edu [128.208.60.54]) by mxout25.s.uw.edu (8.14.4+UW20.07/8.14.4+UW22.04) with ESMTP id 3BNM4YTR013768 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sat, 23 Dec 2023 14:04:34 -0800 X-Auth-Received: from kmatsui-ThinkPad-X1-Carbon-Gen-9.dhcp4.washington.edu ([10.154.74.194]) (authenticated authid=kmatsui) by smtp.washington.edu (8.16.1+UW21.10/8.14.4+UW19.10) with ESMTPSA id 3BNM4Y23011837 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sat, 23 Dec 2023 14:04:34 -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 v2 0/8] Optimize more type traits Date: Sat, 23 Dec 2023 14:02:41 -0800 Message-ID: <20231223220432.712093-1-kmatsui@gcc.gnu.org> X-Mailer: git-send-email 2.43.0 MIME-Version: 1.0 X-Proofpoint-GUID: nql5LBTSdwAPD4Qd6q7mnMZHrzrpv80J X-Proofpoint-ORIG-GUID: nql5LBTSdwAPD4Qd6q7mnMZHrzrpv80J 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=2023-12-23_10,2023-12-22_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxlogscore=289 adultscore=0 suspectscore=0 priorityscore=1501 impostorscore=0 mlxscore=0 clxscore=1034 lowpriorityscore=0 phishscore=0 spamscore=0 malwarescore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311290000 definitions=main-2312230175 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+ouuuleilei=gmail.com@gcc.gnu.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1786110183244563676 X-GMAIL-MSGID: 1786111987952671555 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% Changes in v2: - Removed testsuite_tr1.h includes from the testcases. 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 | 29 ++++++++ libstdc++-v3/include/std/type_traits | 73 +++++++++++++++++-- 10 files changed, 266 insertions(+), 8 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