From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ed1-x534.google.com (mail-ed1-x534.google.com [IPv6:2a00:1450:4864:20::534]) by sourceware.org (Postfix) with ESMTPS id C338D3858D1E; Tue, 8 Nov 2022 14:58:47 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org C338D3858D1E 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-ed1-x534.google.com with SMTP id f7so22859199edc.6; Tue, 08 Nov 2022 06:58:47 -0800 (PST) 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:message-id:reply-to; bh=ICPVf4KcNWyngadQi2omqhv+rZDc3mo+OtOK9KDYUYc=; b=DYi68OjFZpPgPpiEL4A5KErHJNf7xNDAq9Wks0m66RYYuZ4WaC3gAF5H146JaHxFRx uVbve+CZcU2YDj5LPU7i3wSuh6hWoVUQUyVtH/c5tCiO6Ok76sxTYLQkwyTmOmXP9D8h tAWOXWkvsErnyKeXtQuXs0JCbny812Dk7IzgSCFlxy9mL6VC7akG/aMuhXW4gC2XqHa9 HEsbQGXzXAoiFmIyivCxSbtPM2pROx7Od3LCjdbG+p/ZWWtLcHClyYRMCo+67Tpl4D7y njbU6bI98WY00hp9cRaqFhEXTchA6cCwig1aVS8GXS5RHGqf1O1F5LFCtD03ows+QUBl hAtg== 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:message-id :reply-to; bh=ICPVf4KcNWyngadQi2omqhv+rZDc3mo+OtOK9KDYUYc=; b=NXjn5m9Vl/6HJ+bBvhSA1zCxAcWdcCIw2+S4r2AWpgzn88qWVCHpWYFyduVjrwO1wY 6nS52azYeVh5G9gMgplc7OP2dce5Ht5rYz1jL8u/3fqvUKG9/a/oNuyDzPx6RcfRmjRW E5UxuEGc8eAatOwijKgSSp4I8TVn/mBnxqHISiktA0IaWDy+vhgsJOIto400vSgjAZNv oTzrtapPOLpRQcW/t7BAVdAId6PzUddy6U1FIKHNnH5A+kNkOrWe1cllADjz57qECNyH LMDUkU/qq5LhpWrczumALzXoAwTtntHScP+v5322jwZ/nP6faLh/mvrqS2OBNgUMSqyz tQkg== X-Gm-Message-State: ACrzQf0C0v9Ibr0BL2xaDjItLAEJ3ED5E988LVfWyQNjRpeFYdzvn8Vp d5nP7FyGotU7fnBooYPPCTCv/I0YkutjqMIj2UA= X-Google-Smtp-Source: AMsMyM66SlbHGrn87UXXmO3GTbzs27e6ZFZadhsF7LffAJB19GbzGqNzrfNO9FP1MPBt8YS4DRgVJpajsksaQ6SuVDs= X-Received: by 2002:a05:6402:3457:b0:463:2017:ae64 with SMTP id l23-20020a056402345700b004632017ae64mr52427530edc.218.1667919526537; Tue, 08 Nov 2022 06:58:46 -0800 (PST) MIME-Version: 1.0 References: <20220905214437.1275139-1-philipp.tomsich@vrull.eu> <23b39c10b30043318e05a5c44cc76591@huawei.com> <7b6d19fcef784a019c89e77c9917c5a8@huawei.com> In-Reply-To: <7b6d19fcef784a019c89e77c9917c5a8@huawei.com> From: Richard Biener Date: Tue, 8 Nov 2022 15:58:34 +0100 Message-ID: Subject: Re: [PATCH] [PHIOPT] Add A ? B + CST : B match and simplify optimizations To: Zhongyunde Cc: Andrew Pinski , "zhong_1985624@163.com" , "Weiwei (weiwei, Compiler)" , "hongtao.liu@intel.com" , "gcc-patches@gcc.gnu.org" , "Zhangwen(Esan)" Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,KAM_SHORT,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: On Sat, Nov 5, 2022 at 10:03 AM Zhongyunde via Gcc-patches wrote: > > > > -----Original Message----- > > From: Andrew Pinski [mailto:pinskia@gcc.gnu.org] > > Sent: Saturday, November 5, 2022 2:34 PM > > To: Zhongyunde > > Cc: hongtao.liu@intel.com; gcc-patches@gcc.gnu.org; Zhangwen(Esan) > > ; Weiwei (weiwei, Compiler) > > ; zhong_1985624@163.com > > Subject: Re: [PATCH] [PHIOPT] Add A ? B + CST : B match and simplify > > optimizations > > > > On Fri, Nov 4, 2022 at 11:17 PM Zhongyunde > > wrote: > > > > > > hi, > > > This patch is try to fix the issue > > > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107190, > > > would you like to give me some suggestion, thanks. > > > > This seems like a "simplified" version of > > https://gcc.gnu.org/pipermail/gcc-patches/2021-November/584411.html > > which just handles power of 2 constants where we know the cond will be > > removed. > > We could do even more "simplified" of 1 if needed really. > > What is the IR before PHI-OPT? Is it just + 1? > > Thanks for your attention. It is + 4294967296 before PHI-OPT (See detail https://gcc.godbolt.org/z/6zEc6ja1z) > So we should keep matching the power of 2 constants ? > > > Also your pattern can be simplified to use integer_pow2p in the match part > > instead of INTEGER_CST. > > > Apply your comment, thanks How does the patch fix the mentioned bug? match.pd patterns should make things "simpler" but x + (a << C') isn't simpler than a ? x + C : x. It looks you are targeting PHI-OPT here, so maybe instead extend value_replacement to handle this case, it does look similar to the case with neutral/absorbing element there? Richard. > > > Thanks, > > Andrew > >