From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pf1-x434.google.com (mail-pf1-x434.google.com [IPv6:2607:f8b0:4864:20::434]) by sourceware.org (Postfix) with ESMTPS id 48E52385840D for ; Wed, 7 Jun 2023 02:33:46 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 48E52385840D 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-pf1-x434.google.com with SMTP id d2e1a72fcca58-6563ccf5151so4328539b3a.0 for ; Tue, 06 Jun 2023 19:33:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1686105225; x=1688697225; h=content-transfer-encoding:in-reply-to:from:references:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=Q0ZZ2JzS8Xhre9t8Rz2MydjEhp0bxqvE5dHW0mtSliY=; b=FMeVhcrt8EE3Inm0rcTNqvcCy51W4qIhT2Tj5PCCheYrOrSvgb9kaOefQf8bi88p+W n1FMTr8gUV7aRV13RvxR+L6ZzQRfNqDhHGRsOtJWNv7sMG67PnhkXDjKBe/k6C9CtFKb HKFvAV5S8x1NrKTBIoJW0jc2PD7sCHWpleDXdJfq4jhblZ65JxYxlg2MB/jKbnY+qTNf 6eI+2dE0TKtjj0YcGLVYJ12n0mvm3PTEBExz1BOwmKJ4L726TBHSaD2cJvirO10ygVcf d1dw8bdqP7dBAayuLVLvHaIgP8kscRI8D9I5qPgHknhNhaqagT6MR+f/YYGtAj6F/qn1 SeoQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686105225; x=1688697225; h=content-transfer-encoding:in-reply-to:from:references:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=Q0ZZ2JzS8Xhre9t8Rz2MydjEhp0bxqvE5dHW0mtSliY=; b=Swr+gor2NtJvJTG88phg91kiafL+luiF3mfHnoDVFz2yHsLT/hsPvegBJ2+RWV+bXE EmuDeGo1ZHwUTnLskTpJtuCARNpVRPCpk8aoJBBF3172OSQpZo78zVRMF0zvxekJbEqx 8XVIFc2AU6dEh18UipDYT7EVLoT96tP7q+laf7+qG1VNl+WxxlzK2oLL6ZU5g0xKHb/2 zRQGJNRVwFN3KGjYeE7AGzAulfpknmlif6+UWj12K4wJHVin6BCUMulH19Jq/clyM9Cm sjpqbMz1qWzGyiT8kbUjjPsWknDpyCNXVD/lzhzhWTBoAm0sxPWN2bIh8MWfythRpCXO oCYg== X-Gm-Message-State: AC+VfDzKjyzopW5ewTiOeikq/XgOSXF+D8o4blhv8d6eXQdb+TW3lza4 0TPAiixT5jl2CpHNF9NvwczSmpkp8Uo= X-Google-Smtp-Source: ACHHUZ7KiuGJnksrqo9jyDuOLsm1ms66jfl2gQxtYovMX0T30kCYEQTeEwoE7OcD0oGMNuEWkVpUIQ== X-Received: by 2002:a05:6a00:1504:b0:65b:ccb0:8f00 with SMTP id q4-20020a056a00150400b0065bccb08f00mr5134096pfu.4.1686105225044; Tue, 06 Jun 2023 19:33:45 -0700 (PDT) Received: from [172.31.0.109] ([136.36.130.248]) by smtp.gmail.com with ESMTPSA id k3-20020aa790c3000000b0064cca73d911sm4676235pfk.103.2023.06.06.19.33.44 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 06 Jun 2023 19:33:44 -0700 (PDT) Message-ID: <381f6cce-9229-0d83-2518-aac5564bc1c5@gmail.com> Date: Tue, 6 Jun 2023 20:33:43 -0600 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.9.1 Subject: Re: [PATCH 2/2] Add match patterns for `a ? onezero : onezero` where one of the two operands are constant Content-Language: en-US To: Andrew Pinski , gcc-patches@gcc.gnu.org References: <20230607001706.3000011-1-apinski@marvell.com> <20230607001706.3000011-2-apinski@marvell.com> From: Jeff Law In-Reply-To: <20230607001706.3000011-2-apinski@marvell.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.2 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,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 List-Id: On 6/6/23 18:17, Andrew Pinski via Gcc-patches wrote: > This adds a match pattern that are for boolean values > that optimizes `a ? onezero : 0` to `a & onezero` and > `a ? 1 : onezero` to `a | onezero`. > > This was reported a few times and I thought I would finally > add the match pattern for this. > > This hits a few times in GCC itself too. > > Notes on the testcases: > * phi-opt-2.c: This now is optimized to `a & b` in phiopt rather than ifcombine > * phi-opt-25b.c: The test part that was failing was parity which now gets `x & y` treatment. > * ssa-thread-21.c: there is no longer a threading opportunity, so need to disable phiopt. > Note PR 109957 is filed for the now missing optimization in that testcase too. > > gcc/ChangeLog: > > PR tree-optimization/89263 > PR tree-optimization/99069 > PR tree-optimization/20083 > PR tree-optimization/94898 > * match.pd: Add patterns to optimize `a ? onezero : onezero` with > one of the operands are constant. > > gcc/testsuite/ChangeLog: > > * gcc.dg/tree-ssa/phi-opt-2.c: Adjust the testcase. > * gcc.dg/tree-ssa/phi-opt-25b.c: Adjust the testcase. > * gcc.dg/tree-ssa/ssa-thread-21.c: Disable phiopt. > * gcc.dg/tree-ssa/phi-opt-27.c: New test. > * gcc.dg/tree-ssa/phi-opt-28.c: New test. > * gcc.dg/tree-ssa/phi-opt-29.c: New test. > * gcc.dg/tree-ssa/phi-opt-30.c: New test. > * gcc.dg/tree-ssa/phi-opt-31.c: New test. > * gcc.dg/tree-ssa/phi-opt-32.c: New test. OK. tbird rendered the bool0^1 as bool0 to the first power, so I was briefly confused before I realized what was going on. jeff