From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ej1-x62f.google.com (mail-ej1-x62f.google.com [IPv6:2a00:1450:4864:20::62f]) by sourceware.org (Postfix) with ESMTPS id 4684C3857C5E for ; Wed, 5 Aug 2020 14:24:28 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 4684C3857C5E Received: by mail-ej1-x62f.google.com with SMTP id g19so32794556ejc.9 for ; Wed, 05 Aug 2020 07:24:28 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=PTslFEIf65PwccCaq6ORD9A4HHyniX5XatPmlA4ZD8o=; b=F8//AiNPZgV7c+CULBLPhPAAjgp6ZqLAcRVoWR91f6gGigL6yaOoe+wlG+rW9s5ZUm lwcZUg6nDu4RFozw9k0DKKthJ4IkbNCwMD/trZcinRBa2hY5paZ+84j/TATgukNBDUo1 RXOhjyYtw2oVdix7vQTdNIkIumtmXFrFn2DmjYtnb0W9dxWjsQOY6mHcRv3cNR73f4UU CylV5CBmBZznUdl8/fjf6m8V9uKDqaARWgYcZd3C+IdEW5nCWoibApXFzEhS+jjW9ixT 3wT1GyEuAH8dt9MD+U/epuAEOjcL5cSZnTC2T1w87AN8IF8xi3AKnJk1KXS4NruNBd4+ g8ZQ== X-Gm-Message-State: AOAM532xeyctGiiHW9YjiUJO8kJq6Yd0d3tEuhMTbzutgD+07mBS1PH9 x+tvkKItGbWwN3KMV3jlXUO9M7D2SplcMc5FEek= X-Google-Smtp-Source: ABdhPJx7zJCxSDc6IadXS2pM2I8++yIoezpUtLmCtVYvXvQK03g75fEAMpKSu6cMRKWfp531X4EiL+ow9VioGo4Cd2Q= X-Received: by 2002:a17:906:68da:: with SMTP id y26mr3356184ejr.250.1596637467314; Wed, 05 Aug 2020 07:24:27 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Richard Biener Date: Wed, 5 Aug 2020 16:24:15 +0200 Message-ID: Subject: Re: VEC_COND_EXPR optimizations v2 To: Marc Glisse Cc: GCC Patches Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-3.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, KAM_NUMSUBJECT, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=no autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) 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: Wed, 05 Aug 2020 14:24:29 -0000 On Wed, Aug 5, 2020 at 3:33 PM Marc Glisse wrote: > > New version that passed bootstrap+regtest during the night. > > When vector comparisons were forced to use vec_cond_expr, we lost a number of > optimizations (my fault for not adding enough testcases to prevent that). > This patch tries to unwrap vec_cond_expr a bit so some optimizations can > still happen. > > I wasn't planning to add all those transformations together, but adding one > caused a regression, whose fix introduced a second regression, etc. > > Restricting to constant folding would not be sufficient, we also need at > least things like X|0 or X&X. The transformations are quite conservative > with :s and folding only if everything simplifies, we may want to relax > this later. And of course we are going to miss things like a?b:c + a?c:b > -> b+c. > > In terms of number of operations, some transformations turning 2 > VEC_COND_EXPR into VEC_COND_EXPR + BIT_IOR_EXPR + BIT_NOT_EXPR might not look > like a gain... I expect the bit_not disappears in most cases, and > VEC_COND_EXPR looks more costly than a simpler BIT_IOR_EXPR. > > I am a bit confused that with avx512 we get types like "vector(4) > " with :2 and not :1 (is it a hack so true is 1 and not > -1?), but that doesn't matter for this patch. OK. Thanks, Richard. > 2020-08-05 Marc Glisse > > PR tree-optimization/95906 > PR target/70314 > * match.pd ((c ? a : b) op d, (c ? a : b) op (c ? d : e), > (v ? w : 0) ? a : b, c1 ? c2 ? a : b : b): New transformations. > (op (c ? a : b)): Update to match the new transformations. > > * gcc.dg/tree-ssa/andnot-2.c: New file. > * gcc.dg/tree-ssa/pr95906.c: Likewise. > * gcc.target/i386/pr70314.c: Likewise. > > -- > Marc Glisse