From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-vs1-xe35.google.com (mail-vs1-xe35.google.com [IPv6:2607:f8b0:4864:20::e35]) by sourceware.org (Postfix) with ESMTPS id 6E35F3858403 for ; Fri, 10 Sep 2021 11:26:00 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 6E35F3858403 Received: by mail-vs1-xe35.google.com with SMTP id a21so1228219vsp.12 for ; Fri, 10 Sep 2021 04:26:00 -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=G/bk/SJouPDoRqk17MPUyM1OFivygCji7bJHE0xkfCk=; b=n73AZSkLFuwnv+s/BHf31QcKhZBcwUL6KhWcHDI047SgceojAiMk2eGma6lfouwwC6 HOBn1DdfycAxnVBIPzmxqyyR9UpTDDxQ1ULoyVsaab3F8oa7izvdTmVRCjJrG8+vZLrV rcTvjP0jMTsQuflJswOxEszT7aATUYIY7wIC3AjG5Lps5cc9RUIljsYJy1HvYbv0hPTT PSliJtztZN4e3KVt++2VcFWkdVjEK5Rp2fy/AaLZIdfVhdD84EI/AHKRyyBTqhHVYRbh igi8DETj3e5mKu5R9KcL/mg6KKAjvW27WlQ14ABbi5gQP/Rdrd4xCDHxS+aSgvKYiEyi o2jA== X-Gm-Message-State: AOAM532FUe2RgIVJhiRT3tMv4CMqCsGQtKvt9FSdo6voUdkvlC85Sr/D zXTZnblySMEsdaU8uWVbA85NBwa3VKCu9kX3BFo= X-Google-Smtp-Source: ABdhPJzJ5/P18lUTL3T8mM3papUF3+l2eOabYl8R2ElelxB4af9GlIRhfMjWyQLT1YSDvoLYCoO5ZKHphjF8m2Yp9QI= X-Received: by 2002:a05:6102:3f12:: with SMTP id k18mr4941859vsv.14.1631273160042; Fri, 10 Sep 2021 04:26:00 -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> In-Reply-To: From: Hongtao Liu Date: Fri, 10 Sep 2021 19:25:48 +0800 Message-ID: Subject: Re: [PATCH] Fix SFmode subreg of DImode and TImode To: Richard Biener Cc: Segher Boessenkool , Michael Meissner , Peter Bergner , Bill Schmidt , GCC Patches , David Edelsohn 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, 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: Fri, 10 Sep 2021 11:26:01 -0000 On Fri, Sep 10, 2021 at 6:54 PM Richard Biener wrote: > > On Fri, Sep 10, 2021 at 5:03 AM Hongtao Liu wrote: > > > > On Fri, Sep 10, 2021 at 7:49 AM Segher Boessenkool > > wrote: > > > > > > On Thu, Sep 09, 2021 at 08:16:16AM +0200, Richard Biener wrote: > > > > > I think we should (longer term) get rid of the overloaded meanings and > > > > > uses of subregs. One fairly simple thing is to make a new rtx code > > > > > "bit_cast" (or is there a nice short more traditional name for it?) > > > > > > > > But subreg _is_ bit_cast. > > > > > > It is not. (subreg:M (reg:N) O) for O>0, little-endian, is not a > > > bit_cast. It is taking a part of a register, or a single register from > > > a multi-register thing. Paradoxicals are not bit-casts either. > > > > > > Subregs from or to (but not both) integer modes are generally bit_cast, > > > yeah. > > > > > > > What is odd to me is that a "disallowed" subreg > > > > like (subreg:SF (reg:TI ..) 0) magically becomes valid (in terms of > > > > validate_subreg) if you rewrite it as (subreg:SF (subreg:SI (reg:TI ..) 0) 0). > > > > Of course that's nested and invalid but just push the inner subreg to a > > > > new pseudo and the thing becomes valid. > > > > > > Bingo. > > > > > > 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 that is not the core problem we had here. The behaviour of the > > > > > generic parts of the compiler was changed, without testing if that > > > > > works on other targets but x86. That is an understandable mistake, it > > > > > takes some experience to know where the morasses are. But this change > > > > > should have been accompanied by testcases exercising the changed code. > > > > > We would have clearly seen there are issues then, simply by watching > > > > > gcc-testresults@ (and/or maintainers are on top of the test results > > > > > anyway). Also, if there were testcases for this, we could have some > > > > > confidence that a change in this area is robust. > > > > > > > > Well, that only works if some maintainers that are familiar enough > > > > with all this chime in ;) > > > > > > Not really. It works always. And it works way better than the > > > pandemonium we now have with broken targets left and right. > > > > > > With testcases anyone can see if any specific target is broken here. > > > > > > > It's stage1 so it's understandable that some > > > > people (like me ...) are tyring to help people making progress even > > > > if that involves trying to decipher 30 years of GCC history in this > > > > area (without much success in the end as we see) ;) > > > > > > Yeah :-) And my thanks to you and everyone involved for tackling this > > > problematic part of GCC, which has been neglected and patched over for > > > way too long. But from that same history it follows that anything you > > > do not super carefully (with testing everywhere) will cause some serious > > Frankly, testing everywhere is too heavy a burden for developers, > > after all, everyone has a limited variety of machines, and may not be > > familiar with using other targets' simulators. > > And back to the problem we were trying to solve at the beginning > > (subreg:HF(reg:SI)), I guess this is not just a problem in x86 > > backend, any backend can encounter similar problems, that's why we > > remove all the weird cases in validate_subreg. > > So can you please revert the change for now? I think we need to go > back to the issue in extract_bit_field - does it somehow work to use > validate_subreg to avoid creating the subreg we ICE on in the first > place and what happens then to code quality? Sure, let me test the patch. > > Thanks, > Richard. > > > > problems. And nonse of these are easy to fix at all -- there is a > > > *reason* targets did this nastiness. > > > > > > > > p.s. Very unrelated... Should we have __builtin_bit_cast for C as well? > > > > > Is there any reason this could not work? > > > > > > Still interested in this btw :-) (And still very unrelated.) > > > > > > > > > Segher > > > > > > > > -- > > BR, > > Hongtao -- BR, Hongtao