From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pf1-x431.google.com (mail-pf1-x431.google.com [IPv6:2607:f8b0:4864:20::431]) by sourceware.org (Postfix) with ESMTPS id B83593858CDA for ; Mon, 12 Sep 2022 10:34:25 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org B83593858CDA 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-x431.google.com with SMTP id l65so8171657pfl.8 for ; Mon, 12 Sep 2022 03:34:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; 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; bh=YUk5tgBqbLU9DxvmsS9TtVsSyGOdmj5NmLGqNoZYtN0=; b=Eebkv1SjZTJAEnlTLdjRN4o7NA44kenKq1P2cx2J/CJ4rdZhPHsKBoqwl2Uzppfw2l LyiFva/JWNQT5vAARW9AQ5lYMih1HB5Ke2VOt8+PhlIfztAE/7ixkwVJBkVosZ0y5pUc 3wZwBEYYaT6wHy/rUC64ziS31CuiG4WVoW9gdx2n5NlOPzDs0Z4H4igyPZWJIfk/kaqM gXJtKzd0D8EAe25qiaqrt8608lGQu+ysgPBClqExrfsK5qABkOzjPQokQ8c0796bjkg/ w3Gz7RCdaNyLdjjnAYHb7t/4o8uNsIL8HUrzOskdmGe5b4XMlroLSj56+igyoFG7HFPI UKTg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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; bh=YUk5tgBqbLU9DxvmsS9TtVsSyGOdmj5NmLGqNoZYtN0=; b=l6aal/X5DMogTP9XVk5lYQZZFVA3LNv0Cbq5SGl6aao0x2luII96FKnO9FdCxl9AjT twh3IFHZE7Bz1WQRZh/rwf++fh/rz/PRENdrkPOA9S+7rCHOzMHkhGWfec5a5XmijaY1 tv+JFNaK9wxB8YtOp1ews/lhyNt9JqP2XqZ99gvbxlbdrSPdSnarmW+U3iVOl8mo1vf1 KIdNrB4ht6N4g96wSqCx0XuGUcEKbTpu7eMAqaXvrPe/W40F5xig4eD8vtCpweLt6pGh jCNIOmS8WqJhM03nTyG/SlOICcJiO4nDbJQuDie2HfKOh0oSmGMh4ROD2dacELJsgRl8 kH3w== X-Gm-Message-State: ACgBeo1AP/txXo2eJHt6zIbnfEfhbP0awqZ0DVVyTE9Jwj7HYNT+Dw1f YY6QX0NkjUPV1r9jU5M9uQn5xYg5T/k/qw== X-Google-Smtp-Source: AA6agR5joEU76bNVgokUU26Dg5G515xeHKsMADS/9fK2SjbTzv+9Nl/M9G2GyeEuyXhIBoJB1P7bQA== X-Received: by 2002:a63:5c25:0:b0:435:2b72:cee8 with SMTP id q37-20020a635c25000000b004352b72cee8mr19471878pgb.290.1662978863984; Mon, 12 Sep 2022 03:34:23 -0700 (PDT) Received: from ?IPV6:2601:681:8600:13d0::7e4? ([2601:681:8600:13d0::7e4]) by smtp.gmail.com with ESMTPSA id o5-20020a62cd05000000b00540dd926464sm5050396pfg.31.2022.09.12.03.34.23 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 12 Sep 2022 03:34:23 -0700 (PDT) Message-ID: <597159c3-6e31-0f23-6600-b0afc71d866a@gmail.com> Date: Mon, 12 Sep 2022 04:34:22 -0600 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.2.1 Subject: Re: [PATCH 1/2] Add new target hook: constant_ok_for_cprop_p Content-Language: en-US To: gcc-patches@gcc.gnu.org References: <8220176b-a7db-6ef5-9994-e4744806aafd@yahoo.co.jp> From: Jeff Law In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-3.5 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 9/12/22 01:35, Richard Biener via Gcc-patches wrote: > On Sun, Sep 11, 2022 at 10:51 PM Takayuki 'January June' Suwa via > Gcc-patches wrote: >> Hi, >> >> Many RISC machines, as we know, have some restrictions on placing register-width constants in the source of load-immediate machine instructions, so the target must provide a solution for that in the machine description. >> >> A naive way would be to solve it early, ie. to replace with read constants pooled in memory when expanding to RTL. >> >> Alternatively, a more fancy approach would be to forgo placement in the constant pool until somewhere before the reload/LRA eg. the "split1" pass to give the optimization passes that involve immediates a chance to work. >> >> If we choose the latter, we can expect better results with RTL if-conversion, constant folding, etc., but it often propagates constants that are too large in size to resolve to a simple load-immediate instruction. >> >> This is because constant propagation has no way of telling about it, so this patch provides it. > What does prevent other passes like fwprop, CSE and PRE from doing the > same propagation? Can that be the solution for > constant propagation as well? I would think this should be driven by costing rather than a new hook.  I'm pretty sure we already use costing to determine some of this stuff for CSE/PRE. jeff