From patchwork Wed Nov 15 02:24:10 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: HAO CHEN GUI X-Patchwork-Id: 165140 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:6358:a59:b0:164:83eb:24d7 with SMTP id 25csp2342579rwb; Tue, 14 Nov 2023 18:24:46 -0800 (PST) X-Google-Smtp-Source: AGHT+IFntN4htTLcPTZQpiWl6xrMvk1A5OFzLALfXU17Ybm2FHzilWkGMiPRYPV5X1QxnI28rfhm X-Received: by 2002:a0d:c982:0:b0:598:5bb5:1801 with SMTP id l124-20020a0dc982000000b005985bb51801mr11233236ywd.50.1700015086342; Tue, 14 Nov 2023 18:24:46 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1700015086; cv=pass; d=google.com; s=arc-20160816; b=E5Q6HOeKVqwxLwnkE2A24YCIK8l2Li3FZwD1BqoKlZO0V6os60YZTwEh8W0ssOpWiz eB66aXk2gLw25UQhK241lZt4uTv5OqreG1jyFrFkhnKPNpQZfEGxV6US0tDrtyHdN2md +/b6VX4XbMH3s3n8ZKqygveOkGDIB5u/2q9cmWS5vqexNGldxJBMuHMK8l7iyuV8RHAZ m8R8lJPDtZbMkx7CiGqQb5nepqaQ7216h9amp472HPQJRxprvxTZgkECsMH/7klk0Afo nqx5aQWUrIRaNJd8W8FOUcQyBqWBwv5UkRTVv+7OLl+8R+ydzNxblZGZbigunP0lC11E Y5bg== 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 :subject:from:cc:to:content-language:user-agent:mime-version:date :message-id:dkim-signature:arc-filter:dmarc-filter:delivered-to; bh=5AJKyD9/VqU54X07WEfEM6PKbjnU1v4czMDCeQQexaY=; fh=lLZP3uHhXiSbgwP2B1KoLJRAVcgP5GU+moaWEakPPkg=; b=x4EWzojtdxKIlTtEkei/1Y2GgDFgTn7Vhfz1TGeq8blWZvNKpBt9gw2E8+50GsxyV+ jBD6kqq6eCfmdcvctfH0lDObhpjDcS8x8QJu72wXCBXkvLgY9eSbLWWGS3fjxqoI/WQB ZTfViWJddSJX1EImT03L017bUH5DfEVi5f80J9PAGWI2LFjhtLZ7FO4p4VxYH3ct4qck t99gu4pvdHfIvh3kt/2UPoE9h36ACkliH6OtTinurNgx0DazCVz4HWeLmm+YzkaaKy60 Rk9l+6EO4VbiH/b9vfc1G2MsOYDu0iY9A1PDLRsJZ6vFOwr6+ih0BFFpOYdKMgarxQS+ EIyA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=REcOhzcP; 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=REJECT sp=NONE dis=NONE) header.from=ibm.com Received: from server2.sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id px20-20020a056214051400b0066d20730d37si8044250qvb.111.2023.11.14.18.24.46 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Nov 2023 18:24:46 -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=@ibm.com header.s=pp1 header.b=REcOhzcP; 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=REJECT sp=NONE dis=NONE) header.from=ibm.com Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 1C13F385840E for ; Wed, 15 Nov 2023 02:24:46 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by sourceware.org (Postfix) with ESMTPS id CF1013858CD1 for ; Wed, 15 Nov 2023 02:24:21 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org CF1013858CD1 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=linux.ibm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=linux.ibm.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org CF1013858CD1 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=148.163.156.1 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1700015063; cv=none; b=Oa7Z8GQQzXuGEwlZvAsi8zcqw7n//bpvpodegYMZHBqE54639gZ2xrAjW2byuf3V+/flzO7sSwX41h/6TK8ilb90sUyU4Y8VN1GtSBeeooN/zHnt+A2/ruFcO9I9lCrgDOONKaTaw3ooE6VtEXAVAIOoU6L+qN/umGhSajb+JhM= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1700015063; c=relaxed/simple; bh=7/Vo4W5LNl0MQ35bO0373iUOFKKWfdun30Ackp2zx/c=; h=DKIM-Signature:Message-ID:Date:MIME-Version:To:From:Subject; b=hJpmwT+1TzvjvoeHPRN6qfGTB/FbaWWIU1HmCPoxKVQ09SekozA4HbKXw6Itay78bVtV230aOBHmMd2kdXU6/O2O7tLSnRt+tnhhFa6i3hINkqCU6qvmQ5/UbAwbRYbDBzA4u1KWY7DkKF1inNIGqQKvNZyKu+wixG06IVgBlc4= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from pps.filterd (m0353726.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3AF2G8mJ014616; Wed, 15 Nov 2023 02:24:18 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=message-id : date : mime-version : to : cc : from : subject : content-type : content-transfer-encoding; s=pp1; bh=5AJKyD9/VqU54X07WEfEM6PKbjnU1v4czMDCeQQexaY=; b=REcOhzcPlDbh9jRyfwOlHIUDc+XCpnFggNlBgfoourEMdlJcq//v8Zqmi6x6YoCzjc9z SxZbsBapmGSQftnawNqwyzNl5V/nxk33GT7oKdfWTJRaVw4i8lJFNaEKCPBjkj3QljGR /F5nyyUyAVOGjcCBXeVWoaHBx58SLpcBNl3POz9ZtGBuFU5Vc9b4rb3n1zbMYtRdxeAp QYeAvq7OetBKl+SUNRD9bgWYeJ1JHpGKfkinWS8uuYKXhg+g9eXPxa22zrWHSXv9M8sq 5/nBcgFPE9EEfIsWla+CgK5VnciB52ZWxwog3mmo8v2LqirEVLCR88jus20GP2ub6SFY wg== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3ucmwxgap3-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 15 Nov 2023 02:24:17 +0000 Received: from m0353726.ppops.net (m0353726.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 3AF2GCsq015253; Wed, 15 Nov 2023 02:24:17 GMT Received: from ppma23.wdc07v.mail.ibm.com (5d.69.3da9.ip4.static.sl-reverse.com [169.61.105.93]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3ucmwxganm-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 15 Nov 2023 02:24:17 +0000 Received: from pps.filterd (ppma23.wdc07v.mail.ibm.com [127.0.0.1]) by ppma23.wdc07v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 3AF1TNsk022132; Wed, 15 Nov 2023 02:24:16 GMT Received: from smtprelay04.fra02v.mail.ibm.com ([9.218.2.228]) by ppma23.wdc07v.mail.ibm.com (PPS) with ESMTPS id 3uanekm3gm-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 15 Nov 2023 02:24:16 +0000 Received: from smtpav02.fra02v.mail.ibm.com (smtpav02.fra02v.mail.ibm.com [10.20.54.101]) by smtprelay04.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 3AF2OCdS38208148 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 15 Nov 2023 02:24:12 GMT Received: from smtpav02.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id C5AEA20040; Wed, 15 Nov 2023 02:24:12 +0000 (GMT) Received: from smtpav02.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 2C10920043; Wed, 15 Nov 2023 02:24:11 +0000 (GMT) Received: from [9.200.103.64] (unknown [9.200.103.64]) by smtpav02.fra02v.mail.ibm.com (Postfix) with ESMTP; Wed, 15 Nov 2023 02:24:10 +0000 (GMT) Message-ID: <4d66d2b2-94d7-4955-81a3-83622c00585a@linux.ibm.com> Date: Wed, 15 Nov 2023 10:24:10 +0800 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Content-Language: en-US To: gcc-patches Cc: Segher Boessenkool , David , "Kewen.Lin" , Peter Bergner , Richard Sandiford From: HAO CHEN GUI Subject: [PATCH] Clean up X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: djlWaRb9UhLqMp-orNMumtmyyAfCvvRb X-Proofpoint-GUID: Dbqt7nK1D4KnTAYG59oVn5vGUzIbuQRP X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.987,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-11-15_01,2023-11-14_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 adultscore=0 impostorscore=0 spamscore=0 suspectscore=0 phishscore=0 lowpriorityscore=0 bulkscore=0 priorityscore=1501 clxscore=1015 mlxscore=0 mlxlogscore=605 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311060000 definitions=main-2311150018 X-Spam-Status: No, score=-12.3 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, 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: 1782595019423632284 X-GMAIL-MSGID: 1782595019423632284 Hi, This patch cleans up by_pieces_ninsns and does following things. 1. Do the length and alignment adjustment for by pieces compare when overlap operation is enabled. 2. Remove unnecessary mov_optab checks. Bootstrapped and tested on x86 and powerpc64-linux BE and LE with no regressions. Is this OK for trunk? Thanks Gui Haochen ChangeLog Clean up by_pieces_ninsns The by pieces compare can be implemented by overlapped operations. So it should be taken into consideration when doing the adjustment for overlap operations. The mode returned from widest_fixed_size_mode_for_size is already checked with mov_optab in by_pieces_mode_supported_p called by widest_fixed_size_mode_for_size. So there is no need to check mov_optab again in by_pieces_ninsns. The patch fixes these issues. gcc/ * expr.cc (by_pieces_ninsns): Include by pieces compare when do the adjustment for overlap operations. Remove unnecessary mov_optab check. patch.diff diff --git a/gcc/expr.cc b/gcc/expr.cc index 3e2a678710d..7cb2c935177 100644 --- a/gcc/expr.cc +++ b/gcc/expr.cc @@ -1090,18 +1090,15 @@ by_pieces_ninsns (unsigned HOST_WIDE_INT l, unsigned int align, unsigned HOST_WIDE_INT n_insns = 0; fixed_size_mode mode; - if (targetm.overlap_op_by_pieces_p () && op != COMPARE_BY_PIECES) + if (targetm.overlap_op_by_pieces_p ()) { /* NB: Round up L and ALIGN to the widest integer mode for MAX_SIZE. */ mode = widest_fixed_size_mode_for_size (max_size, op); - if (optab_handler (mov_optab, mode) != CODE_FOR_nothing) - { - unsigned HOST_WIDE_INT up = ROUND_UP (l, GET_MODE_SIZE (mode)); - if (up > l) - l = up; - align = GET_MODE_ALIGNMENT (mode); - } + unsigned HOST_WIDE_INT up = ROUND_UP (l, GET_MODE_SIZE (mode)); + if (up > l) + l = up; + align = GET_MODE_ALIGNMENT (mode); } align = alignment_for_piecewise_move (MOVE_MAX_PIECES, align); @@ -1109,12 +1106,10 @@ by_pieces_ninsns (unsigned HOST_WIDE_INT l, unsigned int align, while (max_size > 1 && l > 0) { mode = widest_fixed_size_mode_for_size (max_size, op); - enum insn_code icode; unsigned int modesize = GET_MODE_SIZE (mode); - icode = optab_handler (mov_optab, mode); - if (icode != CODE_FOR_nothing && align >= GET_MODE_ALIGNMENT (mode)) + if (align >= GET_MODE_ALIGNMENT (mode)) { unsigned HOST_WIDE_INT n_pieces = l / modesize; l %= modesize;