From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-yb1-xb2a.google.com (mail-yb1-xb2a.google.com [IPv6:2607:f8b0:4864:20::b2a]) by sourceware.org (Postfix) with ESMTPS id EB28C3858291 for ; Wed, 28 Sep 2022 09:38:37 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org EB28C3858291 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-yb1-xb2a.google.com with SMTP id f189so15234571yba.12 for ; Wed, 28 Sep 2022 02:38:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date; bh=WqQMsF4G5WUxucTBWpfGW1bnCvgILvfQg20sNWiGRig=; b=AIsxiajg8AVU9IYhXm8eewpDgrMGV6rxwmANtQjmt3SboulBvVBqulLDM2kB1ae6GF j0niREIcpeQqOdS3c6IACSHdkLRbD5NrdI983RJjapSgwq7mayvhglaQ9lbeuMMl+3SJ /76TXFJ6jWw1VchSiJuJwnlYhtvi0lgxN8P8gRUGS8RFMgxKckU05banSfLYn4nKnoPt RMH6k0ujsAb65yAo4J0VW0eiQbs3v3CzoL5bfzA7oUDJL3728WEH/b77LPvYh01QSTKT aE6By1IJetKk8dKM2+fKE6NLYnygbCwPIOCQKQuUiCUD7z+YrNFs3o7SCRVev9xYeezs uITA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date; bh=WqQMsF4G5WUxucTBWpfGW1bnCvgILvfQg20sNWiGRig=; b=QpQW9zLefLwVEPoRT65OhuW2RTcJcN3ElCNm6fFWmSVKndEBLkjHzD4ac9oZv/j4QS rrMB4OkHp41I7BOiPNefLaWN0AHd2+1OJ8R79cz5JBgh7/pUZAZu305tyZGTbZHNLtB1 rW6fRBwaeVsfcstYnpW6Q5UxRoijIXdV3zUCbTOek30mZ2JCPEe+NLyfdlJRxUIkZrbJ 1T0VdhcrV3wyGKoeFFtSf8pjl7T5kUMVbz/stZ6SM9Vjvctwo0nh9DE7g5uvpdEgPkfD 5hCMOqi8m/f+rs23D3J6kmUAXnT2+OSNTKrzxUDKv8slJmTDke1PzEoopgrdEotUW29l 9ARA== X-Gm-Message-State: ACrzQf0vmnXhesqvvNIeGsqm6sA1YzqCasbpfzbnUMZJ+STMf4cw4hSI tEe6gclb7Fi4X7fbbKjKudyTo25LdWxdTD9VxDU= X-Google-Smtp-Source: AMsMyM6ad5uIjRj9tGh1A83DJ/ZIjRw75W5vqfquZsGMb1IIAoxWI4I2N1cQ2bBofYHqyeDCGNlkIxkGnXD5kt03Yy4= X-Received: by 2002:a25:d8c5:0:b0:6bc:5178:77aa with SMTP id p188-20020a25d8c5000000b006bc517877aamr3719134ybg.261.1664357917106; Wed, 28 Sep 2022 02:38:37 -0700 (PDT) MIME-Version: 1.0 References: <06f201d89e76$4ddb3210$e9919630$@nextmovesoftware.com> <0b5d2b5d-fccb-ff3d-d1cc-5276e914f6da@gmail.com> In-Reply-To: <0b5d2b5d-fccb-ff3d-d1cc-5276e914f6da@gmail.com> From: Uros Bizjak Date: Wed, 28 Sep 2022 11:38:25 +0200 Message-ID: Subject: Re: [Documentation] Correct RTL documentation: (use (mem ...)) is allowed. To: Jeff Law Cc: gcc-patches@gcc.gnu.org Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-1.4 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: > > This patch is a one line correction/clarification to GCC's current > > RTL documentation that explains a USE of a MEM is permissible. > > > > PR rtl-optimization/99930 is an interesting example on x86_64 where > > the backend generates better code when a USE is a (const) MEM than > > when it is a REG. In fact the backend relies on CSE to propagate the > > MEM (a constant pool reference) into the USE, to enable combine to > > merge/simplify instructions. > > > > This change has been tested with a make bootstrap, but as it might > > provoke a discussion, I've decided to not consider it "obvious". > > Ok for mainline (to document the actual current behavior)? > > > > > > 2022-07-23 Roger Sayle > > > > gcc/ChangeLog > > * doc/rtl.texi (use): Document that the operand may be a MEM. > > Given this is documenting existing behavior and it's not hard to > envision the MEM being useful in this context. OK. I would like to point out at this occasion that there are some issues with (use (mem)) when commutative operands are used. PR95218 has a testcase where the postreload pass simply removed the instruction (see comment #6). It was later found out in comment #17 that commutative operands in (use (...)) statements somehow confuse postreload pass. I have to remove commutative operands from (use (...)) to solve the issue, so either this unfortunate fact should be mentioned in the documentation or the limitation (bug?) should be fixed in the postreload pass. Uros.