From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ed1-x530.google.com (mail-ed1-x530.google.com [IPv6:2a00:1450:4864:20::530]) by sourceware.org (Postfix) with ESMTPS id 296F83858296 for ; Mon, 3 Jul 2023 09:12:24 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 296F83858296 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-x530.google.com with SMTP id 4fb4d7f45d1cf-51d9128494cso3805128a12.0 for ; Mon, 03 Jul 2023 02:12:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1688375543; x=1690967543; h=content-transfer-encoding:in-reply-to:from:references:to :content-language:subject:cc:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=bot1l7DT5y3zHhh6orbdIODmCZtXZn14WrBhvweoq7Y=; b=O6Rc8h5RVno5RuBLGXOc9uEwHBVffOxQWc9/0CUfTD3omNxnOTinGYeN/OydxFmNoE LxihECWUyNsPirSE5lgO1/ZlUFzK+0QbfiUMMfOjVODm7bmlkRN271Y8kTIlGJhiRdvO DmjVlo0M1yZC9LiN5eFHBl9Ci2QdOAmnuZw0Brp5kWFccbYFU8J8aEVd6KVVyi/VWoZa 8zUXKaBtzmqIYmCpGHl/n2sha3wqLvgMnrpsDQp+1OF6tjjipwgOYOOE0acjlRp1GB5W j7ZZ6N5RFgRKaUf6a98xAW1GqnGhhN0nkCP4AgvqVQzbTlFF1x1Vm0NSshmzAN1uLeup 3teQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688375543; x=1690967543; h=content-transfer-encoding:in-reply-to:from:references:to :content-language:subject:cc:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=bot1l7DT5y3zHhh6orbdIODmCZtXZn14WrBhvweoq7Y=; b=N2Rteqh7VlMR1kv6Lu4q3AUD0kg3J+e2Mkp0QvEa4zwDaH/rqov77GkibPCInO48ov SYm67PBwzsiFhw2HFpQn9RjnnrWLxSqJ/KodMyFXlxUy9LhoZRW6a10sGKuMrOHwYrBh PfCI7hr2WMKOWDXU1lwVV66UGlFnT7fVHHWF68Z0YWQbic/0FIOWDQJ2xEDeSFGK0wNT Hb9pTgQ3OHrFbX4O5tguWyGtkQ4Cb8caPR0ddQqWcWj09JTWvenqvR45F9/uTdw9BElf OfD0axnJST+l+v/c4KpSDpZL1z0kbybAwnNkDq30rH7AphBx3b4h+SHxHmfAoujrSPEy pzgw== X-Gm-Message-State: ABy/qLYeNkE65a45kmAhKrphJcEJ/Ge9slKw5zN35AEaVEHW3XaacvvE iCpYNOIzHohIBnD81oLef00= X-Google-Smtp-Source: APBJJlF2uet50ECErGwMh1cAoSXw1nfCRpQLFaCjCD0FzUPtYhkEMEKSRzDLDFjQsK6oGFjDDCPDPA== X-Received: by 2002:a05:6402:1606:b0:51e:bc7:585c with SMTP id f6-20020a056402160600b0051e0bc7585cmr2381690edv.41.1688375542569; Mon, 03 Jul 2023 02:12:22 -0700 (PDT) Received: from [192.168.1.23] (ip-046-005-130-086.um12.pools.vodafone-ip.de. [46.5.130.86]) by smtp.gmail.com with ESMTPSA id b15-20020aa7dc0f000000b0051a1ef536c9sm9999079edu.64.2023.07.03.02.12.21 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 03 Jul 2023 02:12:22 -0700 (PDT) Message-ID: Date: Mon, 3 Jul 2023 11:12:21 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.12.0 Cc: rdapp.gcc@gmail.com, Jakub Jelinek , Philipp Tomsich , Andrew Pinski Subject: Re: [PATCH 2/2] ifcvt: Allow more operations in multiple set if conversion Content-Language: en-US To: Manolis Tsamis , gcc-patches@gcc.gnu.org References: <20230701092413.2488806-1-manolis.tsamis@vrull.eu> <20230701092413.2488806-3-manolis.tsamis@vrull.eu> From: Robin Dapp In-Reply-To: <20230701092413.2488806-3-manolis.tsamis@vrull.eu> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-3.3 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: Hi Manolis, that looks like a nice enhancement of what's already possible. The concern I had some years back already was that this function would eventually grow and cannibalize on some of what the other functions in ifcvt already do :) At some point we really should unify but that's not within the scope of this patch. IMHO we're already pretty far towards general "conditional execution" with conditional increments, selects and so on (and the function is still called "_noce") and historically the cond_exec functions would have taken care of that. To my knowledge though, none of the major backends implements anything like (cond_exec ...) anymore and relies on bit-twiddling tricks to generate the conditional instructions. Have you checked whether cond_exec and others could be adjusted to handle the conditional instructions you want to see? They don't perform full cost comparison though but just count. I would expect a bit of discussion around that but from a first look I don't have major concerns. > -/* Return true iff basic block TEST_BB is comprised of only > - (SET (REG) (REG)) insns suitable for conversion to a series > - of conditional moves. Also check that we have more than one set > - (other routines can handle a single set better than we would), and > - fewer than PARAM_MAX_RTL_IF_CONVERSION_INSNS sets. While going > +/* Return true iff basic block TEST_BB is suitable for conversion to a > + series of conditional moves. Also check that we have more than one Might want to change the "conditional moves" while you're at it. > > - if (!((REG_P (src) || CONSTANT_P (src)) > - || (GET_CODE (src) == SUBREG && REG_P (SUBREG_REG (src)) > - && subreg_lowpart_p (src)))) > + /* Allow a wide range of operations and let the costing function decide > + if the conversion is worth it later. */ > + enum rtx_code code = GET_CODE (src); > + if (!(CONSTANT_P (src) > + || code == REG > + || code == SUBREG > + || code == ZERO_EXTEND > + || code == SIGN_EXTEND > + || code == NOT > + || code == NEG > + || code == PLUS > + || code == MINUS > + || code == AND > + || code == IOR > + || code == MULT > + || code == ASHIFT > + || code == ASHIFTRT > + || code == NE > + || code == EQ > + || code == GE > + || code == GT > + || code == LE > + || code == LT > + || code == GEU > + || code == GTU > + || code == LEU > + || code == LTU > + || code == COMPARE)) We're potentially checking many more patterns than before. Maybe it would make sense to ask the backend whether it has a pattern for the respective code? Regards Robin