From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pf1-x42a.google.com (mail-pf1-x42a.google.com [IPv6:2607:f8b0:4864:20::42a]) by sourceware.org (Postfix) with ESMTPS id 0AC4D3858C3A for ; Thu, 9 Dec 2021 17:34:13 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 0AC4D3858C3A Received: by mail-pf1-x42a.google.com with SMTP id x5so6137403pfr.0 for ; Thu, 09 Dec 2021 09:34:12 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:references:from:in-reply-to :content-transfer-encoding; bh=jhKAwPCk5SoXsYA12BVcglQmGM/UqHIqWDs+KoZb2JY=; b=nL+GnTVxKokLcvZxSs2jPbFSCgaKm/pTcmeZfwZRuFHpNYpf4sFHqe3xSWL6/NiAvr 24Q37rVwqb2bMX5KIHaaUVdXJnEXEYjhP2mvGM8g2/y1R5CT28ymhhJNknWr9yKKMRwh D818JRbXKWOeplXSdDfV/db0SmffxgoC+kdBGJrnODn8Ou7jmqk51F5syenGE6WdqBFg DjChDpuUTEl4ILX3ly5UgmtW+GfPTkhCmA5XtToWuyUbLGHPPCzHI4gNFQfu+yeB9ou+ Nlejj2ya81uIMOeLGJQHjE2btPieBft4XU+SJ8+yVfs5tMikglrHKMhkKCcDYIBYfY9E 4qcA== X-Gm-Message-State: AOAM533vBtTCpUxOvxYo6yQ92o/j8h25I8JIALF5SZ0KYNb4nBNlG1Sf ZR0tF6DJ4BH0JnhCltKwVC3NT4FtFYT79A== X-Google-Smtp-Source: ABdhPJw2QPyFNffC2LRDj55Vdqjn2CerDKjwWjer45e4eLlLpZGbDZTukjfSN5C954xfUwrcJnjW6A== X-Received: by 2002:a63:d450:: with SMTP id i16mr30694225pgj.439.1639071252095; Thu, 09 Dec 2021 09:34:12 -0800 (PST) Received: from [192.168.1.15] (65-130-86-172.slkc.qwest.net. [65.130.86.172]) by smtp.gmail.com with ESMTPSA id c18sm310700pfl.201.2021.12.09.09.34.11 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 09 Dec 2021 09:34:11 -0800 (PST) Message-ID: <42c217d9-5bc6-ec58-7d0d-5353985b2146@gmail.com> Date: Thu, 9 Dec 2021 10:34:11 -0700 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.3.2 Subject: Re: [PATCH v3 4/7] ifcvt/optabs: Allow using a CC comparison for emit_conditional_move. Content-Language: en-US To: Robin Dapp , gcc-patches@gcc.gnu.org, richard.sandiford@arm.com References: <20211206184352.42264-1-rdapp@linux.ibm.com> <20211206184352.42264-5-rdapp@linux.ibm.com> <4c00d2b4-a1b5-006f-3ca9-9613f3afc26b@linux.ibm.com> From: Jeff Law In-Reply-To: <4c00d2b4-a1b5-006f-3ca9-9613f3afc26b@linux.ibm.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-3.9 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, NICE_REPLY_A, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Dec 2021 17:34:14 -0000 On 12/9/2021 10:20 AM, Robin Dapp wrote: > Hi Jeff, > > thanks for looking into this. NP.  I'd been watching this set evolve and I think it'll help our target as well, so it seemed natural to handle the review :-) > >> What if the condition has a side effect?  Doesn't this drop the side >> effect by converting the conditional move into a simple move? > Hmm, good point, if the condition does more than a CC compare, it might > get tricky as we are not canonicalizing here (on purpose). Is there an > easy way out like checking something like side_effects_p ()? I think if side_effects_p is true, we can just emit the conditional move as-is without trying to collapse it to a simple move.  It should be exceedingly rare to have a side effect in the destination.    Checking side_effects_p will also reject if the destination is volatile MEM, but that should be OK and also exceedingly rare. > > Maybe we should drop this altogether and let the backend deal with it? > It would probably not know what to do and FAIL. I like the idea of collapsing to a simple move if the true/false arms are the same.    Did you see that happen in practice?  If so, I'd like to keep it, but just guard with the !side_effects_p check. jeff