From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ed1-x52d.google.com (mail-ed1-x52d.google.com [IPv6:2a00:1450:4864:20::52d]) by sourceware.org (Postfix) with ESMTPS id 811C13858006 for ; Mon, 13 Sep 2021 09:03:20 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 811C13858006 Received: by mail-ed1-x52d.google.com with SMTP id z94so7050453ede.8 for ; Mon, 13 Sep 2021 02:03:20 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=4Tr5FHz56eWDrLtcJJiJpUDt7XadlZHzgBOjNNTHvuE=; b=M+toNE+TnsQLczqUDksp8pUIVyI06EXCVjGmjouqEahoqurBzrT0EbN0g/y79euJ1m j+ub0CfQn2iNWw0yq9IAhIGhha8EYwoxAmFc3te0/vIRzygHmecdxscgd9GA0QlZRlsR 79DoIAliqrzK2G5TN7uHht5vDvf8NEeEo9QYv1AwPyCXWTPYYFe/vzmVwNe+ZlBrPo95 WqJBh9sjXOuh67B09wLMMhLpnGpJtwXx8laV53T4pzCp7psY+mmmp6kLsi2rW6SsKJDS CJsiXgSStcs5LbuA1kMgGZBfZrgZxgLGRPIi5eOlDmvaiSVUHy2j0R4WhfQeN2J2wIWb FXCg== X-Gm-Message-State: AOAM533QMMmVZBfwTwOytIRfuStZDt6ax/9494+b/bFdc/NhCN/chnFs RtvjzQocJ91jbkRHIRgCOx8qtiZlJ/0UZBl8pvM= X-Google-Smtp-Source: ABdhPJxBqkjEt8i95yVgC3nGDPpyhgDpJHnR0WL85ZiV0wZkVtjCzwr65mgYYzxKNGttMr1HYAs+V1Xaa+u5uGRVQPk= X-Received: by 2002:aa7:d805:: with SMTP id v5mr11582156edq.3.1631523799314; Mon, 13 Sep 2021 02:03:19 -0700 (PDT) MIME-Version: 1.0 References: <20210907230730.GM1583@gate.crashing.org> <20210908170809.GP1583@gate.crashing.org> <5DBC1101-9DD6-48F8-BC25-F4DD354B4D74@gmail.com> <20210908191602.GQ1583@gate.crashing.org> <20210909234832.GU1583@gate.crashing.org> <20210910150540.GW1583@gate.crashing.org> In-Reply-To: <20210910150540.GW1583@gate.crashing.org> From: Richard Biener Date: Mon, 13 Sep 2021 11:03:08 +0200 Message-ID: Subject: Re: [PATCH] Fix SFmode subreg of DImode and TImode To: Segher Boessenkool Cc: Michael Meissner , GCC Patches , David Edelsohn , Bill Schmidt , Peter Bergner , Will Schmidt Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) 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, 13 Sep 2021 09:03:22 -0000 On Fri, Sep 10, 2021 at 5:07 PM Segher Boessenkool wrote: > > On Fri, Sep 10, 2021 at 12:53:37PM +0200, Richard Biener wrote: > > On Fri, Sep 10, 2021 at 1:50 AM Segher Boessenkool > > wrote: > > > And many targets have strange rules for bit-strings in which modes can > > > be used as bit-strings in which other modes, and at what offsets in > > > which registers. Now perhaps none of that is optimal (I bet it isn't), > > > but changing this without a transition plan simply does not work. > > > > But we _do_ already allow some of them :/ Like > > Yes. And all of this is old and ingrained, and targets depend on the > status quo, so changing this will need more care and planning and > cooperation. It certainly is a worthwhile thing to improve, but it is > not a small project, and it requires a plan. > > > /* ??? Similarly, e.g. with (subreg:DF (reg:TI)). Though store_bit_field > > is the culprit here, and not the backends. */ > > else if (known_ge (osize, regsize) && known_ge (isize, osize)) > > ; > > > > so for the special case where 'regsize' matches osize it would be > > a bit-cast of a full register from int to float. But as written it also > > allows (subreg:XF (reg:TI)) which will likely wreck havoc? > > That does not pass the isize >= osize test? Or maybe I don't know > what XFmode is well enough :-) Hey I can read, I have source, and it > is Friday... TImode is 16 bytes but XFmode is 12. I meant to construct a case which passes all the tests but where definitely such kind of subreg is very odd to be "allowed" by validate_subreg - a target may of course have means to make sense of it (I don't see how x87 would though). > Ah. So XF has different size on 32-bit and on 64-bit, but that doesn't > even matter here. > > > Similar for the omode == word_mode check which allows > > (subreg:DI (reg:TF ..)). That is, the existing special-cases look > > too broad to me - and they probably exist because when validate_subreg > > rejects sth then we can't put it together later when expand split it > > into two subregs and a pseudo ... > > I said it before, and I'll say it again, it is a very important point: > expand should not try to optimise this, *at all*. And not just this, > not *anything*. Expand's job in the current compiler is only to > translate Gimple to RTL, and nothing more. +1 (or +10!), but unfortunately expand _is_ an important part of optimization - in particular when it gets to avoiding stack usage since we can never get rid of all effects of allocating a stack slot. Splitting to multiple insns with pseudos should be fine though, but it at least seems that splitting (subreg:FLOAT (reg:INT)) into (subreg:INT (reg:INT)) (subreg:FLOAT (reg:INT)) isn't always valid. Richard.