From patchwork Thu Nov 23 08:00:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Biener X-Patchwork-Id: 168768 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:ce62:0:b0:403:3b70:6f57 with SMTP id o2csp285397vqx; Thu, 23 Nov 2023 00:01:16 -0800 (PST) X-Google-Smtp-Source: AGHT+IGnlFV4ZI+G7Wg2GuQbCn/M3K7ZKWWZzAMKaoTJKAQWh+M+bh5wSp2Bus6mESGXizDvJ6HV X-Received: by 2002:a05:6830:2013:b0:6d6:528f:6548 with SMTP id e19-20020a056830201300b006d6528f6548mr5677786otp.12.1700726476362; Thu, 23 Nov 2023 00:01:16 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1700726476; cv=pass; d=google.com; s=arc-20160816; b=AEOXbSyZz248BaXLBj0BByJXmmcChJxGcI/NuwUmb9LvlMGRYXmAbuKfePDTC9MfqM 0eWgvnuiD3HwhuDijBssk+inPAsdK9IFQ2xyew/wSCgm5YxL1ctBMsgM3T4kzzi/9xM7 v52ywPvY1GSdwKhVenoVIHzmj/iZrkwTq/qmowbKjZZFYRl1joZauE2tvg/5WUugZ/kw lqtufjrzv2vk19vOHRdxydx2qOI7wyvisqaRJM6UJGkP34pu18o98vbaoPaf8JA1pJw4 tpmHShFEhmE5at1NAFM8EeaN19I0OXRZAIw84tSI9UzDdkXQsUSS6X823dHZ34RjU17I mPxQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=message-id:errors-to:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence:mime-version :user-agent:subject:cc:to:from:date:dkim-signature:dkim-signature :arc-filter:dmarc-filter:delivered-to; bh=mh0KBXUKXVL9uAuARAilFLHcvypQ1CdLxv01ts3r5l0=; fh=kxwUQ2Bi4SArK/FZVDDYqEtz2Xd0YfroYaZPOzE5puk=; b=FLr3Afr2+aQpeLudSnxCgFg9RDCNr0QQCgx7st5K0J+gy1mR4itHWIJOmPO6PHEYus NcaCdP2ClnSJ6fDLiBwy+1e8+daK9plAfC/9Vozn8TjIWoGNMaJIlYLBJAy7uAwlEpOQ vziuW29dP0UN+zeeYlRv4hxQbXJYXeTcLfShCBWxZSND0wwKOQ+HXODPGrdEF6kXaIwk Ac4ikbTxvms0WQY1GwaV6IsZLaDl46CXNqscoCfqjQij6X/5OO+hRu1KxCVT3bJ3ymNv 2tv2hpqEfZqEIdThqh0z7At5aaUkRIJRfnjqIuxenlSmKjnG9AM2JGzHAbREcQeLwcr2 qjzQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b="S/0uTu+8"; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519; 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=suse.de Received: from server2.sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id bp14-20020a05621407ee00b0067a0c510152si95510qvb.167.2023.11.23.00.01.16 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Nov 2023 00:01:16 -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=@suse.de header.s=susede2_rsa header.b="S/0uTu+8"; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519; 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=suse.de Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 2449B3858426 for ; Thu, 23 Nov 2023 08:01:16 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by sourceware.org (Postfix) with ESMTPS id E1E033858D33 for ; Thu, 23 Nov 2023 08:00:50 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org E1E033858D33 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=suse.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=suse.de ARC-Filter: OpenARC Filter v1.0.0 sourceware.org E1E033858D33 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=195.135.220.28 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1700726453; cv=none; b=weZJGaPHicbnQDg8/RVJgFGJDhmDy7I2lQ6Yh5hkuLSBaQ5G6bezaCbcGiOe2ZzoqUK+H07GnUQQpJwSN4LEnaiU2gDIYyV0WLtKbVJAVLnirRkREVQ67fQpX1LtTapvKk5HDVvduTQ8GT8WtjfLQYaw7xGiUu2P67CeGJeh2dY= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1700726453; c=relaxed/simple; bh=ZtY0iZYpUVZjLUeQ/ppFoqQfyphGOP9T4zvU4ln5iYE=; h=DKIM-Signature:DKIM-Signature:Date:From:To:Subject:MIME-Version; b=unM1hcEmRJZwWEGPhFy9wWBBg3NYr5tfu2116ZrXxX2stbHsgZTkBhLlKGeIr9ROZS4r/w/KMMja2MX9dtmAw1nRlPLLO7ouO1nbheHzz9nFc7pZM1cR7BfKbUb0EWCN3yIlWr6ZS/6ZoHQ5ghI/agO2I3XOTttP+w/j45VusrY= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out1.suse.de (Postfix) with ESMTP id EC06D21980; Thu, 23 Nov 2023 08:00:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1700726449; h=from:from:reply-to:date:date:to:to:cc:cc:mime-version:mime-version: content-type:content-type; bh=mh0KBXUKXVL9uAuARAilFLHcvypQ1CdLxv01ts3r5l0=; b=S/0uTu+85brNCfxCJJX56eQH6aWqqdOdl4QffFmS5LiBJZn8VeBoaLnGjagOMa4siJ/m5T cbuLOJVykso05zYAd8ecgCfVc/nhgSudWyqSFPZJZpHJNgeVJYuilcaANcLhhWF3imPLRe blQLcIc1La3Q2sJt7rSmPdiPWaX8Qgs= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1700726449; h=from:from:reply-to:date:date:to:to:cc:cc:mime-version:mime-version: content-type:content-type; bh=mh0KBXUKXVL9uAuARAilFLHcvypQ1CdLxv01ts3r5l0=; b=x79CaCq+VTGpt9PgchGc+nDMPZAtgk5kla74JMijKUz91t9M9EWyuhSLEK0aL2M6QBbk6P NWJzwE5u9whqXKCA== Received: from wotan.suse.de (wotan.suse.de [10.160.0.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id DF4BE2C162; Thu, 23 Nov 2023 08:00:49 +0000 (UTC) Date: Thu, 23 Nov 2023 08:00:49 +0000 (UTC) From: Richard Biener To: gcc-patches@gcc.gnu.org cc: Jakub Jelinek , jlaw@ventanamicro.com Subject: [PATCH] middle-end/32667 - document cpymem and memcpy exact overlap requirement User-Agent: Alpine 2.22 (LSU 394 2020-01-19) MIME-Version: 1.0 X-Spamd-Bar: +++++++++++++++++ Authentication-Results: smtp-out1.suse.de; dkim=none; dmarc=none; spf=softfail (smtp-out1.suse.de: 149.44.160.134 is neither permitted nor denied by domain of rguenther@suse.de) smtp.mailfrom=rguenther@suse.de X-Rspamd-Server: rspamd1 X-Spamd-Result: default: False [17.96 / 50.00]; ARC_NA(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[3]; TO_DN_SOME(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(1.20)[suse.de]; R_SPF_SOFTFAIL(4.60)[~all:c]; NEURAL_SPAM_SHORT(3.00)[1.000]; MISSING_MID(2.50)[]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; MX_GOOD(-0.01)[]; NEURAL_SPAM_LONG(3.50)[1.000]; VIOLATED_DIRECT_SPF(3.50)[]; RWL_MAILSPIKE_GOOD(-1.00)[149.44.160.134:from]; FUZZY_BLOCKED(0.00)[rspamd.com]; RCVD_NO_TLS_LAST(0.10)[]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(2.20)[]; MIME_TRACE(0.00)[0:+]; RCVD_COUNT_TWO(0.00)[2]; BAYES_HAM(-1.53)[91.89%] X-Spam-Score: 17.96 X-Rspamd-Queue-Id: EC06D21980 X-Spam-Status: No, score=-10.7 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, MISSING_MID, 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 Message-Id: <20231123080116.2449B3858426@sourceware.org> X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1783340965705035964 X-GMAIL-MSGID: 1783340965705035964 The following amends the cpymem documentation to mention that exact overlap needs to be handled gracefully, also noting that the target runtime is expected to behave the same way. OK? Thanks, Richard. PR middle-end/32667 * md.texi (cpymem): Document that exact overlap of source and destination needs to work. Mention the target runtime may not treat this case as undefined. --- gcc/doc/md.texi | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/gcc/doc/md.texi b/gcc/doc/md.texi index df6725ffc9c..8743b393b3c 100644 --- a/gcc/doc/md.texi +++ b/gcc/doc/md.texi @@ -6915,8 +6915,11 @@ individually copied data units in the block. The @code{cpymem@var{m}} patterns need not give special consideration to the possibility that the source and destination strings might -overlap. These patterns are used to do inline expansion of -@code{__builtin_memcpy}. +overlap. An exeption is the case where source and destination are +equal. These patterns are used to do inline expansion of +@code{__builtin_memcpy}. The target runtime is expected to handle +the case of an exact overlap of source and destination gracefully +as GCC does not consider that undefined behavior. @cindex @code{movmem@var{m}} instruction pattern @item @samp{movmem@var{m}}