From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pl1-x633.google.com (mail-pl1-x633.google.com [IPv6:2607:f8b0:4864:20::633]) by sourceware.org (Postfix) with ESMTPS id A69793856082 for ; Mon, 30 May 2022 14:49:13 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org A69793856082 Received: by mail-pl1-x633.google.com with SMTP id w3so10487922plp.13 for ; Mon, 30 May 2022 07:49:13 -0700 (PDT) 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=omy9u7DsCvn3k9XADnmaj4JGzt932qvbx/ADcqjiqP0=; b=UwBnR2CNJwsLC1PtaMPMtl8/O4doPdOUJErBnygeH0jD5eTRue7vxI/gGyzzkjz42V qr2dJXK5xfZ1SodqI2Xr6xLpoJLntxCkmEbBksSoCyYXkqeMI8HqzIZVOEoVRgz0qcy3 VQZ/mPizF8q3hfBKR6e0JxM/2ubCl6iFAjIg6ylDqFp93oCVZ+M5UtAnEp2YOw/uc0+g RQQIBynepWUGaby3w7nlB7UnK6MkP4XUOaF9ftY5OuDroHYEpRPXurgnPE0NEDA3nTME mdolIBZbjdGbObemCn+uKZQTs+NvkPgQymWmocjwrkjbiuXMgIbLboT5SajW8tN+DNxa nagA== X-Gm-Message-State: AOAM5331Dw7RBMT3P/zv/MPPhEKJtKQF5/hnlm+j4oNGJ/V7N83+JxJj 2kEvv/l4m0lPJY0ahkNUFfda0KUJfdzQxA== X-Google-Smtp-Source: ABdhPJybdWHK6BtvYmLbL0yWbicA6thqI+yI9RYNZUqdL+WWT9nVgx+2W1/nGrgDdYMFw2mBoAiagQ== X-Received: by 2002:a17:902:7c8c:b0:161:f5b4:9aa6 with SMTP id y12-20020a1709027c8c00b00161f5b49aa6mr48777140pll.79.1653922151235; Mon, 30 May 2022 07:49:11 -0700 (PDT) Received: from [172.31.0.204] (c-73-63-24-84.hsd1.ut.comcast.net. [73.63.24.84]) by smtp.gmail.com with ESMTPSA id az11-20020a170902a58b00b00161f9e72233sm3327111plb.261.2022.05.30.07.49.10 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 30 May 2022 07:49:10 -0700 (PDT) Message-ID: <1336a156-913a-6deb-4749-755b94819164@gmail.com> Date: Mon, 30 May 2022 08:49:09 -0600 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.9.1 Subject: Re: [PATCH] Make the default rtx_costs of MULT/DIV variants consistent. Content-Language: en-US To: gcc-patches@gcc.gnu.org References: <003901d8742b$a7715db0$f6541910$@nextmovesoftware.com> From: Jeff Law In-Reply-To: <003901d8742b$a7715db0$f6541910$@nextmovesoftware.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.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, 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 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: Mon, 30 May 2022 14:49:15 -0000 On 5/30/2022 7:46 AM, Roger Sayle wrote: > GCC's middle-end provides a default cost model for RTL expressions, for > backends that don't specify their own instruction timings, that can be > summarized as multiplications are COSTS_N_INSNS(4), divisions are > COSTS_N_INSNS(7) and all other operations are COSTS_N_INSNS(1). > This patch tweaks the above definition so that fused-multiply-add > (FMA) and high-part multiplications cost the same as regular > multiplications, > or more importantly aren't (by default) considered less expensive. Likewise > the saturating forms of multiplication and division cost the same as the > regular variants. These values can always be changed by the target, but > the goal is to avoid RTL expansion substituting a suitable operation with > its saturating equivalent because it (accidentally) looks much cheaper. > For example, PR 89845 is about implementing division/modulus via highpart > multiply, which may accidentally look extremely cheap. > > I believe there should be no code generation changes for this patch, > but of course I'm happy to address any adverse changes on rare targets. > This patch has been tested on x86_64-pc-linux-gnu with make bootstrap > and make -k check, both with and without --target_board=unix{-m32}, > with no new failures. Ok for mainline? > > > 2022-05-30 Roger Sayle > > gcc/ChangeLog > * rtlanal.cc (rtx_cost) : Treat FMA, SS_MULT, US_MULT, > SMUL_HIGHPART and UMUL_HIGHPART as having the same cost as MULT. >
: Likewise, SS_DIV and US_DIV have the same default as DIV. OK. Jeff