From patchwork Sat Dec 2 06:37:23 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Andrew Pinski (QUIC)" X-Patchwork-Id: 172739 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:bcd1:0:b0:403:3b70:6f57 with SMTP id r17csp1614821vqy; Fri, 1 Dec 2023 22:38:14 -0800 (PST) X-Google-Smtp-Source: AGHT+IEwFTJdYG8VkaQFqY4aWFiVkGk2EWhrYvWUGzk0uOQXqipfuGG7CmUezJJDXkXmTNnl6HxW X-Received: by 2002:ac8:5989:0:b0:41c:c6a6:338f with SMTP id e9-20020ac85989000000b0041cc6a6338fmr1233108qte.53.1701499094291; Fri, 01 Dec 2023 22:38:14 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1701499094; cv=pass; d=google.com; s=arc-20160816; b=IzDj4ktVKCTdYHuqxNgC+bSY+STVjPsqTYUNfBHhsp+C/XfGFJVY0vMTRKAJS99a06 IJl/Fy5BM633m9Zfm6L3qobbpe2vjEApm5QKL1hogSrcWIDryHm6e34emS8aQrJ5Gwx5 krjeYDwIW0KMvbfGMMlFBWnVM0LztDQsekwHWmUqKLkjFF8AubHtAH+/lrg2E241xlEk mY46mmLi3VST72HXnAAp8GDcs/4m8As9P0M7T1rndyvQ+iEQICDBstSKG9lJjzDX4BBN NCPurrIyOHWtVYE3x7ziNZdQPiCAXBfaSs50/aiYgX69RQGGnMjmuWsNwN+WIyAmY6Qx LtQQ== 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:references:in-reply-to:message-id:date:subject:to:from :dkim-signature:arc-filter:dmarc-filter:delivered-to; bh=Gkv7QhbpLRuz6tKS4O2Lyi9JXixTZx0rfdAScjP2xSY=; fh=gk9A5O7Gbglvz1MjrRQ4hZ2i3c68kYkpOZJg1emXh+g=; b=HBsL/3fk5AvEZdcHd1JIUE9WT2DhPXyjnB9rX0GWsHuAvuck1pElLV95YCVTp0V6u1 u5dAmnglo7+o65M/vNhvG0TyqsL/W0lcfr4yl17pfBt4MPLoNLR9AHZiwTJz/GYvzNJi qWJfCQbpNtBGtJ4uIKiKHQjM3eiXP683t3c1MCoFUSz4G0IdycnqrlLgHK513oElp73/ YPgPJf/Mh8U5xS/wGOyJxvJx3/Sd189wnG2ZL9MqPtLL7KyUiTQvTCqI9YsvfSqJs0/a FHKKXIIRB4Cii986V74vHxGdhCjyluX8cmLYxYy21Sx2EVBht9lovkPRNSreuySPMK1B 0dtQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=AdCtySzy; 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=quicinc.com Received: from server2.sourceware.org (server2.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id fc8-20020a05622a488800b004239cba16b8si5157169qtb.80.2023.12.01.22.38.14 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Dec 2023 22:38:14 -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=@quicinc.com header.s=qcppdkim1 header.b=AdCtySzy; 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=quicinc.com Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 988C8385ED72 for ; Sat, 2 Dec 2023 06:38:07 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) by sourceware.org (Postfix) with ESMTPS id 612BC385842E for ; Sat, 2 Dec 2023 06:37:42 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 612BC385842E Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=quicinc.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=quicinc.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 612BC385842E Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=205.220.180.131 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1701499063; cv=none; b=smIknaHXi9hqzq/GGwycND77zsLheS89nuPfNvPVvay8bhXT3aX9WW9HIFva893MiRlNoBQ8P15Sz4iJWYjEjW+jzp9UUF8X3IBtYfwHNsE0zcumkTrG5V7WKIZ6elgWdE7gWHCYWUfN6rNLIFQXhbPD3ITpHbAWz/0WzrDx0ys= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1701499063; c=relaxed/simple; bh=lQMKw+Bdyyl3xsqmehkf4xFk4/9qGKjq9iXkZuz1Dvs=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=RY96dXcrIjovPV5wZjP/wl368zrQFIkeVfsOVpIVXkmhDxJf6viv3krTQsoD5jCDB5Cb5KksqUDkMz8vDmm5pN5qSUp2xrTFKHCKshQ/gEc5zVrI3eYPv8vOnlmSOLr6b5xtWU5RGU2Rp1RYO7JYbh0zTj7OKi4/ga2m+TZR44E= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from pps.filterd (m0279869.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3B26OFIm030020 for ; Sat, 2 Dec 2023 06:37:42 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h=from : to : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=qcppdkim1; bh=Gkv7QhbpLRuz6tKS4O2Lyi9JXixTZx0rfdAScjP2xSY=; b=AdCtySzyBwUOyxLotiUE+SwwZp2mA6206IxoUEps5ADCiLYs8UZ3rXPfpAq6cQg7CO9Q 9a2kmQtOfiQvzFgN+9L4GMFcGJydJ/ew8hvx2N5/Ty1AiJDTWv8dqkR2PitwcQrX9U7m y8g2VSXjocYPnKCHjVduG4HzkkjCiRFNeZoIJjd+9rbXt5EQrgEb4qB09gazwG+8jkXU hJYGvW+nE3LSAEd6PuV7P6vn5msK2oXCNaChIJXoO/OHZa8fc38tm9mLU1L98w8U2o6e HwR+AUwa7dKu6S8N5DjQr7pvtTq7lpOdhxfPY3y75s6jdHuL5UXhnVJqHpeCNFavJ1U/ Ow== Received: from nasanppmta01.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3uqukg09fm-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Sat, 02 Dec 2023 06:37:41 +0000 Received: from nasanex01c.na.qualcomm.com (nasanex01c.na.qualcomm.com [10.45.79.139]) by NASANPPMTA01.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 3B26beAn001611 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Sat, 2 Dec 2023 06:37:40 GMT Received: from hu-apinski-lv.qualcomm.com (10.49.16.6) by nasanex01c.na.qualcomm.com (10.45.79.139) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.40; Fri, 1 Dec 2023 22:37:40 -0800 From: Andrew Pinski To: Subject: [PATCH 1/3] MATCH: Fix zero_one_valued_p's convert pattern Date: Fri, 1 Dec 2023 22:37:23 -0800 Message-ID: <20231202063725.3405094-2-quic_apinski@quicinc.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231202063725.3405094-1-quic_apinski@quicinc.com> References: <20231202063725.3405094-1-quic_apinski@quicinc.com> MIME-Version: 1.0 X-Originating-IP: [10.49.16.6] X-ClientProxiedBy: nalasex01a.na.qualcomm.com (10.47.209.196) To nasanex01c.na.qualcomm.com (10.45.79.139) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-GUID: aeb-XWy1OI8uNFX7NuCb2M5PRmVSoKgu X-Proofpoint-ORIG-GUID: aeb-XWy1OI8uNFX7NuCb2M5PRmVSoKgu 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-02_04,2023-11-30_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 adultscore=0 mlxscore=0 phishscore=0 lowpriorityscore=0 bulkscore=0 impostorscore=0 mlxlogscore=710 priorityscore=1501 suspectscore=0 spamscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311060000 definitions=main-2312020047 X-Spam-Status: No, score=-13.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, SPF_HELO_NONE, SPF_PASS, 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 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: 1784151114275312411 X-GMAIL-MSGID: 1784151114275312411 While working on PR 111972, I was getting a regression due to zero_one_valued_p matching a signed 1 bit integer when it came to convert. This patch fixes that by checking the outer type too. Bootstrapped and tested on x86_64-linux-gnu with no regressions. gcc/ChangeLog: * match.pd (zero_one_valued_p): For convert make sure type is not a signed 1-bit integer. Signed-off-by: Andrew Pinski --- gcc/match.pd | 3 +++ 1 file changed, 3 insertions(+) diff --git a/gcc/match.pd b/gcc/match.pd index 26383e55767..4d554ba4721 100644 --- a/gcc/match.pd +++ b/gcc/match.pd @@ -2247,6 +2247,9 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT) (if (INTEGRAL_TYPE_P (TREE_TYPE (@1)) && (TYPE_UNSIGNED (TREE_TYPE (@1)) || TYPE_PRECISION (TREE_TYPE (@1)) > 1) + && INTEGRAL_TYPE_P (type) + && (TYPE_UNSIGNED (type) + || TYPE_PRECISION (type) > 1) && wi::leu_p (tree_nonzero_bits (@1), 1)))) /* Transform { 0 or 1 } * { 0 or 1 } into { 0 or 1 } & { 0 or 1 }. */ From patchwork Sat Dec 2 06:37:24 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Andrew Pinski (QUIC)" X-Patchwork-Id: 172740 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:bcd1:0:b0:403:3b70:6f57 with SMTP id r17csp1614836vqy; Fri, 1 Dec 2023 22:38:17 -0800 (PST) X-Google-Smtp-Source: AGHT+IFVDUoMjWV6bFCPFtcW72ryJDci6smliVYWzc95XVVqNtGThSUddsPh7+wF68TUDT0p6ON0 X-Received: by 2002:a05:620a:1da9:b0:77e:fba3:81f8 with SMTP id pj41-20020a05620a1da900b0077efba381f8mr748596qkn.142.1701499097535; Fri, 01 Dec 2023 22:38:17 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1701499097; cv=pass; d=google.com; s=arc-20160816; b=OdETEwTrgKqzz60o+Q5nvIETUFnybDqqnDcGH/W5Doq9pAvo2BJLzffrO8sazyfGhG JsJS2pkJ9AJroafxXQ1uGDedLH3SYmGYIhS47s7ekNWaidmq5kawQXJv1/7xUG+SNaUi rOiZIk/lbFt9LrUmv1iijTVXUOPyB2ZsubJgOpCwgfJEN2kwrdpWluPI2r2Ob4mxr17O lwT1q1cHcvSmDSY5avFOvS8B1xIfUon/Cubn9DPwar2lW7nMzE8TKx2s/HQUdI2SOUNB zKNgbUCYrrSYG+ret4oLJWSl8teBLSKz+rBj9W7W5vFSLTkVrfl0TpSItLHomLpOU+km eYVw== 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:references:in-reply-to:message-id:date:subject:to:from :dkim-signature:arc-filter:dmarc-filter:delivered-to; bh=PoScawZgWxZHJwLV9dfNVh17XhS6ftuw30Y3VCee/Yo=; fh=gk9A5O7Gbglvz1MjrRQ4hZ2i3c68kYkpOZJg1emXh+g=; b=uAH0xlh4Fx0sGE3BOJ4F2UzYtvsJG0BuwiY6Cnps3eB1TUdANHjxeV1PI2drINdX4i k4c6djwVLVWxYlqrkdegPicDJmvaQX38hGkyQcJ2Z1wHmBbHBi/+o9WUOpnwM99+W/Au Yrx6QA+aaQk4lsNjaRXwhmMF3pVx5882frjpjWvTfM+PyVF/xxeuivNdfIINCq4Verb7 NDaryxtZB5jwKL9riwzuinFcJw13tacdIrQZ1A899zqS0u/1ymwJCZq+J8lFD5Dkj+QK NsNB7+b8tzDfQoXOQnBYrPhPe0A8RDwhkVA+xwMOLu6NCahsTZ8tRsx/6D+xR9MaaJU5 rUlQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=gS5m0tNB; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: from server2.sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id ay18-20020a05620a179200b00773b543596dsi2881368qkb.423.2023.12.01.22.38.17 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Dec 2023 22:38:17 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=gS5m0tNB; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id B6A513861842 for ; Sat, 2 Dec 2023 06:38:09 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) by sourceware.org (Postfix) with ESMTPS id CC0BD3858438 for ; Sat, 2 Dec 2023 06:37:42 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org CC0BD3858438 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=quicinc.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=quicinc.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org CC0BD3858438 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=205.220.180.131 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1701499063; cv=none; b=VqdzbXjWVolL0C1ZstWbg2NUiOTIgGowgFfj6NnXtHSfgKVt4OaW1m/I54GHzxVDtJcYO6tQ6p0BcdxBc5Vt0CFYBV05jnv753SJZ7mUiRSB+uAxLa5hHzONuSalwwUFFjCbZf9Hv9CCxJbVXFGqdVRvjEVdfHvYBTwp9yefTTI= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1701499063; c=relaxed/simple; bh=VOjpen+VWcrI2wRvRmh9vRe9ZXeZejnWRMOrbkKTXks=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=kLdTGiz6T28/zD58GleXBxt3XozP92rICehOMMEdlgoLkc9WCD0sOCstv2Bv0LWoSvrLI9SMFIc35ct+ZjW0+AIT+LYbjtsj/0cuonaPgA3AXTfDyPvLI5MZTiYBhmPKKsA61UlY2VoUSgA2wHuWfdCqujQq3SVBnLv0//PG+wE= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from pps.filterd (m0279873.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3B26QtVX009545 for ; Sat, 2 Dec 2023 06:37:42 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h=from : to : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=qcppdkim1; bh=PoScawZgWxZHJwLV9dfNVh17XhS6ftuw30Y3VCee/Yo=; b=gS5m0tNBhET+AlMIzRJeCYv5Tn2g8OGONPVB/8CNPUd3gHu+LRGBdGiNz7EtjtAwnAoW FoJtM/etWjeYELyDdu3pNHhOa4peywp/ddYsWjmnqDftMDQcVtEQ2K8nMF613n8pfd0n Ut3JrCb8mydwCRyAqWmbSO8LizwHpNo9nuHtnYtD2xsdXjLkeoVPoqrjvg71MEmuWRqP OQMv8QxW5Nfa0EgyQr6mYTCWvHcTHhOZp9vKizOH5YMzlyUrd/Pa2s1oPaxv7CJPFGbN 7+v/K9JX4TUdSK8i2aaoOLrbzDWexVPB2uXGQqX6OtJ7lyFsCzflZHpxtC/Z6k34ORTl QQ== Received: from nasanppmta05.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3uqsxw0erw-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Sat, 02 Dec 2023 06:37:42 +0000 Received: from nasanex01c.na.qualcomm.com (nasanex01c.na.qualcomm.com [10.45.79.139]) by NASANPPMTA05.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 3B26bfNO021080 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Sat, 2 Dec 2023 06:37:41 GMT Received: from hu-apinski-lv.qualcomm.com (10.49.16.6) by nasanex01c.na.qualcomm.com (10.45.79.139) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.40; Fri, 1 Dec 2023 22:37:40 -0800 From: Andrew Pinski To: Subject: [PATCH 2/3] Remove check of unsigned_char in maybe_undo_optimize_bit_field_compare. Date: Fri, 1 Dec 2023 22:37:24 -0800 Message-ID: <20231202063725.3405094-3-quic_apinski@quicinc.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231202063725.3405094-1-quic_apinski@quicinc.com> References: <20231202063725.3405094-1-quic_apinski@quicinc.com> MIME-Version: 1.0 X-Originating-IP: [10.49.16.6] X-ClientProxiedBy: nalasex01a.na.qualcomm.com (10.47.209.196) To nasanex01c.na.qualcomm.com (10.45.79.139) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-ORIG-GUID: FJYv7g8MDA2qx0CdGnJWMlFGatAmYjl4 X-Proofpoint-GUID: FJYv7g8MDA2qx0CdGnJWMlFGatAmYjl4 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-02_04,2023-11-30_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 phishscore=0 suspectscore=0 mlxscore=0 bulkscore=0 spamscore=0 clxscore=1015 priorityscore=1501 mlxlogscore=697 malwarescore=0 impostorscore=0 adultscore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311060000 definitions=main-2312020047 X-Spam-Status: No, score=-13.0 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, SPF_HELO_NONE, SPF_PASS, 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 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: 1784151117519496535 X-GMAIL-MSGID: 1784151117519496535 From: Andrew Pinski The check for the type seems unnecessary and gets in the way sometimes. Also with a patch I am working on for match.pd, it causes a failure to happen. Before my patch the IR was: _1 = BIT_FIELD_REF ; _2 = _1 & 1; _3 = _2 != 0; _4 = (int) _3; __analyzer_eval (_4); Where _2 was an unsigned char type. And After my patch we have: _1 = BIT_FIELD_REF ; _2 = (int) _1; _3 = _2 & 1; __analyzer_eval (_3); But in this case, the BIT_AND_EXPR is in an int type. OK? Bootstrapped and tested on x86_64-linux-gnu with no regressions. gcc/analyzer/ChangeLog: * region-model-manager.cc (maybe_undo_optimize_bit_field_compare): Remove the check for type being unsigned_char_type_node. --- gcc/analyzer/region-model-manager.cc | 3 --- 1 file changed, 3 deletions(-) diff --git a/gcc/analyzer/region-model-manager.cc b/gcc/analyzer/region-model-manager.cc index 921edc55868..9a17b9d2878 100644 --- a/gcc/analyzer/region-model-manager.cc +++ b/gcc/analyzer/region-model-manager.cc @@ -586,9 +586,6 @@ maybe_undo_optimize_bit_field_compare (tree type, tree cst, const svalue *arg1) { - if (type != unsigned_char_type_node) - return NULL; - const binding_map &map = compound_sval->get_map (); unsigned HOST_WIDE_INT mask = TREE_INT_CST_LOW (cst); /* If "mask" is a contiguous range of set bits, see if the From patchwork Sat Dec 2 06:37:25 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Andrew Pinski (QUIC)" X-Patchwork-Id: 172741 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:bcd1:0:b0:403:3b70:6f57 with SMTP id r17csp1614961vqy; Fri, 1 Dec 2023 22:38:40 -0800 (PST) X-Google-Smtp-Source: AGHT+IHkAJBPAyDiJa3NgeLip7GZ/ST1ulrx8eWgVGhrBCHj9CYaztMz3xavTQ0KfErv0FxBGTWr X-Received: by 2002:a05:620a:14b7:b0:77e:fba3:81ff with SMTP id x23-20020a05620a14b700b0077efba381ffmr863327qkj.149.1701499120210; Fri, 01 Dec 2023 22:38:40 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1701499120; cv=pass; d=google.com; s=arc-20160816; b=AbwWPQR5G60fRctR0bIar5MdRMlUSbfKtc7Xo1bXXY7yS+5OCf86CgGdv6wQJjhc8v 6XUAaclf+ydapgYP6ycEHWpLEaj0/rj/o0ke4sMQ9mclAuqTFzn3XnU1fIN6nIFiGM9l ioQ+K8tcZ8pxq3mhBB7ZC100l1yrQjNE85bBoSgpPRMjEcsO+zeaBRPKccl+teJ7S48D BFWU5VoNF+D/uVn5nt/6K92uXOEpMUe76fz8yRwWQf+tBpSg5NTvGq7JzsNjEDcmOC7g fu8wjG4AO4TKIs9pQQpPRgRzFYtfiHuVhHkj7cUC1oLMDcH+n+bTA3Blvp/xQavbqRNs EMgw== 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:references:in-reply-to:message-id:date:subject:to:from :dkim-signature:arc-filter:dmarc-filter:delivered-to; bh=djFOzD8d25kgglPl04KgqaMW8ZVZS5PNCzz3hq1+qgI=; fh=gk9A5O7Gbglvz1MjrRQ4hZ2i3c68kYkpOZJg1emXh+g=; b=zS/lUS6bkgqhQoIJFI8cVrBYnzdD1qygbprefQihvHFjftPhujlBS+Pq8aq7xgaXG8 4q10IOVvKdshgtPKx+z6uLKWZS2Lo1oqwiElAOy2Q/Fo82Kv1W5uPHbJBF16Uc8Ys+F5 fCOqbGAYi5uhi58V2oUEwpdfruT0QO0u3KJLI6wK2UTu2JvqbJ2WxF8dWmLXgcV6/gYX 9HlrZXmNbSLRRng7pe0oNLtPZn9/0ZmqD9bm2wvGPUyBjtS6FNzWIxj292lk7uveC1YR q+HbJNGUq2Rs7P4+MszlULIn2cBF3n9yUzR3yAZz626rQZT1CHhjifvxqj+z9PGtMa33 vdvw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=CZubQ0fo; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: from server2.sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id e14-20020a05620a014e00b0077efd5a9f39si714127qkn.143.2023.12.01.22.38.40 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Dec 2023 22:38:40 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=CZubQ0fo; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id EE3333856DD4 for ; Sat, 2 Dec 2023 06:38:39 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) by sourceware.org (Postfix) with ESMTPS id 2CF22385828E for ; Sat, 2 Dec 2023 06:37:43 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 2CF22385828E Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=quicinc.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=quicinc.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 2CF22385828E Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=205.220.180.131 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1701499065; cv=none; b=IE6DR1egi8HHgYnRwlN0yPy3MkIJ3IWbOArd5l00KKpVYWT626URAWzKsgbv1vLz21A7DP5zhyHCHH8sj8E6hgFQ+B5/jH0ebUyYroFaZvmCoTN/9TCEtgKZxf/9ha4sjZd12sblmWAYl75lGI58CPD8tGtlyhveZHCrA8TCyQo= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1701499065; c=relaxed/simple; bh=xiiLbw00UWDBInwu79heIMFQ5BySHAVx4z0QTWczY4k=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=W3p8C1XjPxoXAEBYIKSYopcltmc2fMo8IyUwb109Jso1Wz0/ASs7Db+GuhaxV7sip5A9PvCXrZpIZYyh4AWv9iFoRpW1owjt3giMRMGnrlZUNCGiBKuTDdSCvpoc2ZQNN+p+M8TOBpfYrd0nen8JCrsCoqOVSEF0+lK0+ko3/OY= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from pps.filterd (m0279872.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3B26TouL023107 for ; Sat, 2 Dec 2023 06:37:42 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h=from : to : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=qcppdkim1; bh=djFOzD8d25kgglPl04KgqaMW8ZVZS5PNCzz3hq1+qgI=; b=CZubQ0foT2ZxO5ZcOcxu2r/Er1DP80L4M6RedIIcs7kUPEKQth0viJK03GPFu1d8tpFD 6E9z3rL9Hsn3Y2wy/Uf0UbdSi+ejhgUSPAXeZD9ZC99PCAUq3v7dD9pOy57WyXhsm/EY eXF0P6+Fde0wRAyyvLJ2AZhVa1lKALWqgCTVFhs8oqdyglZHFuH4pfyMZc5LWGSK4OpO lxCtS6XhqPOL69jyjSAPJMIleO3N+7rhqgIkv63d6UYwKKorXeaB4V9bXAzZ3U8/zhl3 NCOPfI/8Vdpz7Wm09ppAgphJsd0jagmfuz3JRuWmViLEEPYtY1dQjwVXHGtv8v61xlhF jQ== Received: from nasanppmta04.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3uqvyer5tp-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Sat, 02 Dec 2023 06:37:42 +0000 Received: from nasanex01c.na.qualcomm.com (nasanex01c.na.qualcomm.com [10.45.79.139]) by NASANPPMTA04.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 3B26bfuK026498 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Sat, 2 Dec 2023 06:37:41 GMT Received: from hu-apinski-lv.qualcomm.com (10.49.16.6) by nasanex01c.na.qualcomm.com (10.45.79.139) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.40; Fri, 1 Dec 2023 22:37:41 -0800 From: Andrew Pinski To: Subject: [PATCH 3/3] MATCH: (convert)(zero_one !=/== 0/1) for outer type and zero_one type are the same Date: Fri, 1 Dec 2023 22:37:25 -0800 Message-ID: <20231202063725.3405094-4-quic_apinski@quicinc.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231202063725.3405094-1-quic_apinski@quicinc.com> References: <20231202063725.3405094-1-quic_apinski@quicinc.com> MIME-Version: 1.0 X-Originating-IP: [10.49.16.6] X-ClientProxiedBy: nalasex01a.na.qualcomm.com (10.47.209.196) To nasanex01c.na.qualcomm.com (10.45.79.139) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-ORIG-GUID: qUscBuWaEo-mUKXn4tui3czXrI1TAMdZ X-Proofpoint-GUID: qUscBuWaEo-mUKXn4tui3czXrI1TAMdZ 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-02_03,2023-11-30_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 phishscore=0 impostorscore=0 mlxlogscore=962 bulkscore=0 suspectscore=0 clxscore=1015 spamscore=0 mlxscore=0 malwarescore=0 lowpriorityscore=0 priorityscore=1501 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311060000 definitions=main-2312020047 X-Spam-Status: No, score=-13.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, SPF_HELO_NONE, SPF_PASS, 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 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: 1784151141910314494 X-GMAIL-MSGID: 1784151141910314494 When I moved two_value to match.pd, I removed the check for the {0,+-1} as I had placed it after the {0,+-1} case for cond in match.pd. In the case of {0,+-1} and non boolean, before we would optmize those case to just `(convert)a` but after we would get `(convert)(a != 0)` which was not handled anyways to just `(convert)a`. So this adds a pattern to match `(convert)(zeroone != 0)` and simplify to `(convert)zeroone`. Also this optimizes (convert)(zeroone == 0) into (zeroone^1) if the type match. This can only be done on the gimple level as if zeroone was defined by (a&1), fold will convert (a&1)^1 back into `(convert)(zeroone == 0)` and an infinite loop will happen. Note the testcase pr69270.c needed a slight update due to not matching exactly a scan pattern, this update makes it more robust and will match before and afterwards and if there are other changes in this area too. Note the testcase gcc.target/i386/pr110790-2.c needs a slight update for better code generation in LP64 bit mode. Bootstrapped and tested on x86_64-linux-gnu with no regressions. gcc/ChangeLog: PR tree-optimization/111972 PR tree-optimization/110637 * match.pd (`(convert)(zeroone !=/== CST)`): Match and simplify to ((convert)zeroone){,^1}. gcc/testsuite/ChangeLog: * gcc.dg/tree-ssa/pr110637-1.c: New test. * gcc.dg/tree-ssa/pr110637-2.c: New test. * gcc.dg/tree-ssa/pr110637-3.c: New test. * gcc.dg/tree-ssa/pr111972-1.c: New test. * gcc.dg/tree-ssa/pr69270.c: Update testcase. * gcc.target/i386/pr110790-2.c: Update testcase. Signed-off-by: Andrew Pinski --- gcc/match.pd | 21 +++++++++++++ gcc/testsuite/gcc.dg/tree-ssa/pr110637-1.c | 10 +++++++ gcc/testsuite/gcc.dg/tree-ssa/pr110637-2.c | 13 +++++++++ gcc/testsuite/gcc.dg/tree-ssa/pr110637-3.c | 14 +++++++++ gcc/testsuite/gcc.dg/tree-ssa/pr111972-1.c | 34 ++++++++++++++++++++++ gcc/testsuite/gcc.dg/tree-ssa/pr69270.c | 4 +-- gcc/testsuite/gcc.target/i386/pr110790-2.c | 16 ++++++++-- 7 files changed, 108 insertions(+), 4 deletions(-) create mode 100644 gcc/testsuite/gcc.dg/tree-ssa/pr110637-1.c create mode 100644 gcc/testsuite/gcc.dg/tree-ssa/pr110637-2.c create mode 100644 gcc/testsuite/gcc.dg/tree-ssa/pr110637-3.c create mode 100644 gcc/testsuite/gcc.dg/tree-ssa/pr111972-1.c diff --git a/gcc/match.pd b/gcc/match.pd index 4d554ba4721..656b2c9edda 100644 --- a/gcc/match.pd +++ b/gcc/match.pd @@ -3332,6 +3332,27 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT) (if (INTEGRAL_TYPE_P (TREE_TYPE (@0)) || POINTER_TYPE_P (TREE_TYPE (@0))) (rcmp @0 @1)))) +/* (type)([0,1]@a != 0) -> (type)a + (type)([0,1]@a == 1) -> (type)a + (type)([0,1]@a == 0) -> a ^ 1 + (type)([0,1]@a != 1) -> a ^ 1. */ +(for eqne (eq ne) + (simplify + (convert (eqne zero_one_valued_p@0 INTEGER_CST@1)) + (if ((integer_zerop (@1) || integer_onep (@1))) + (if ((eqne == EQ_EXPR) ^ integer_zerop (@1)) + (convert @0) + /* a^1 can only be produced for gimple as + fold has the exact opposite transformation + for `(X & 1) ^ 1`. + See `Fold ~X & 1 as (X & 1) == 0.` + and `Fold (X ^ 1) & 1 as (X & 1) == 0.` in fold-const.cc. + Only do this if the types match as (type)(a == 0) is + canonical form normally, while `a ^ 1` is canonical when + there is no type change. */ + (if (GIMPLE && types_match (type, TREE_TYPE (@0))) + (bit_xor @0 { build_one_cst (type); } )))))) + /* We can't reassociate at all for saturating types. */ (if (!TYPE_SATURATING (type)) diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr110637-1.c b/gcc/testsuite/gcc.dg/tree-ssa/pr110637-1.c new file mode 100644 index 00000000000..3d03b0992a4 --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/pr110637-1.c @@ -0,0 +1,10 @@ +/* { dg-do compile } */ +/* { dg-options "-O1 -fdump-tree-optimized" } */ +int f(int a) +{ + int b = (a & 1)!=0; + return b; +} + +/* This should be optimized to just return (a & 1); */ +/* { dg-final { scan-tree-dump-not " == " "optimized"} } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr110637-2.c b/gcc/testsuite/gcc.dg/tree-ssa/pr110637-2.c new file mode 100644 index 00000000000..f1c5b90353a --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/pr110637-2.c @@ -0,0 +1,13 @@ +/* { dg-do compile } */ +/* { dg-options "-O1 -fdump-tree-optimized" } */ +int f(int a) +{ + int b = a & 1; + int c = b == 0; + return c; +} + +/* This should be optimized to just return `(a&1) ^ 1` or `(~a) & 1`. */ +/* { dg-final { scan-tree-dump-not " == " "optimized"} } */ +/* { dg-final { scan-tree-dump-times "~a" 1 "optimized"} } */ +/* { dg-final { scan-tree-dump-times " & 1" 1 "optimized"} } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr110637-3.c b/gcc/testsuite/gcc.dg/tree-ssa/pr110637-3.c new file mode 100644 index 00000000000..ce80146d9df --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/pr110637-3.c @@ -0,0 +1,14 @@ +/* { dg-do compile } */ +/* { dg-options "-O1 -fdump-tree-optimized" } */ +int f(int a) +{ + int b = a & 1; + int c = b == 0; + int d = ~a; + int e = d & 1; + return c == e; +} + +/* This should be optimized to just `return 1` */ +/* { dg-final { scan-tree-dump-not " == " "optimized"} } */ +/* { dg-final { scan-tree-dump-times "return 1" 1 "optimized"} } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr111972-1.c b/gcc/testsuite/gcc.dg/tree-ssa/pr111972-1.c new file mode 100644 index 00000000000..0611808ed50 --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/pr111972-1.c @@ -0,0 +1,34 @@ +/* { dg-do compile } */ +/* { dg-options "-O1 -fdump-tree-phiopt" } */ +double +foo() { + long n3 = 3450000, xtra = 7270; + long i,ix; + long j; + double Check; + + /* Section 3, Conditional jumps */ + j = 0; + { + for (ix=0; ix2) j = 0; + else j = 1; + if(j<1) j = 1; + else j = 0; + } + } + } + Check = Check + (double)j; + return Check; +} + +/* the above if statements in loop should be optimized to just `j ^ 1` + and should not be (type)(j != 1). */ +/* { dg-final { scan-tree-dump-not " != 1" "phiopt2"} } */ +/* { dg-final { scan-tree-dump-times " \\^ 1" 1 "phiopt2"} } */ + diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr69270.c b/gcc/testsuite/gcc.dg/tree-ssa/pr69270.c index 0d66cc4383f..b08ec9d6ddb 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/pr69270.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/pr69270.c @@ -7,8 +7,8 @@ /* { dg-final { scan-tree-dump-times "Replaced .bufferstep_\[0-9\]+. with constant .1." 1 "dom3"} } */ /* And some assignments ought to fold down to constants. */ -/* { dg-final { scan-tree-dump-times "Folded to: _\[0-9\]+ = 1;" 1 "dom3"} } */ -/* { dg-final { scan-tree-dump-times "Folded to: _\[0-9\]+ = 0;" 1 "dom3"} } */ +/* { dg-final { scan-tree-dump-times "Folded to: (?:bufferstep)?_\[0-9\]+ = 1;" 1 "dom3"} } */ +/* { dg-final { scan-tree-dump-times "Folded to: (?:bufferstep)?_\[0-9\]+ = 0;" 1 "dom3"} } */ /* The XOR operations should have been optimized to constants. */ /* { dg-final { scan-tree-dump-not "bit_xor" "dom3"} } */ diff --git a/gcc/testsuite/gcc.target/i386/pr110790-2.c b/gcc/testsuite/gcc.target/i386/pr110790-2.c index 8b9d650c6e9..16c73cb7465 100644 --- a/gcc/testsuite/gcc.target/i386/pr110790-2.c +++ b/gcc/testsuite/gcc.target/i386/pr110790-2.c @@ -9,5 +9,17 @@ refmpn_tstbit_bad (mp_srcptr ptr, unsigned long bit) return (((ptr)[(bit)/(32 - 0)] & (((mp_limb_t) 1L) << ((bit)%(32 - 0)))) != 0); } -/* { dg-final { scan-assembler "bt\[ql\]" } } */ -/* { dg-final { scan-assembler "setc" } } */ +/* 32bit produces: + btl %eax, %edx + setc %al + movzbl %al, %eax + */ +/* { dg-final { scan-assembler "bt\[ql\]" { target { ! lp64 } } } } */ +/* { dg-final { scan-assembler "setc" { target { ! lp64 } } } } */ + +/* 64bit produces: + shrq %cl, %rax + andl $1, %eax + */ +/* { dg-final { scan-assembler-times "shrq" 2 { target { lp64 } } } } */ +/* { dg-final { scan-assembler-times "andl" 2 { target { lp64 } } } } */