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 50D883858C39 for ; Fri, 10 Sep 2021 13:27:20 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 50D883858C39 Received: by mail-vs1-xe35.google.com with SMTP id o124so1574167vsc.6 for ; Fri, 10 Sep 2021 06:27: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=Az1vYxg3yZ61hpgJGHW9BlIyn2AhjCG9Q4CWODw0oGo=; b=kXJ61IJ825HC67ihOKh3CEl/WDnKT1njUTentCnur3uWr3jDH9elM/rbjFVGDu1p6f vro9K6220gYP5zuqQWq2HFsZmNRrr0p69djfBaVylKyXp/mqK794PNzK9d0TYNjUtrVM qzwLUirKglkSlVwfD2jt0OXR/3PsW5vyyEikv8PnOE3tYKKiJ528Kx0J2qKs8af/WXpj uKkLoGm9QdHK1mFGsDz/v1p2dueRhbSnDGZQhPp14vF6GCCTgU8IBDaudkxNYrbQa6Jc QCc18RzTab78XldncS+1L8BPZmYLDvfOvit/6FlHSdJrkX0659WZ1XHjD0Cy1G1vmOSq wVIA== X-Gm-Message-State: AOAM532lwYDitKEAVRX+JPALc/vHObh2hyRL0hcZ6VJpOIeofr+LyDQI yor5OWNRUWWoRTqpSeowkDJangxNFGvn791zHQo= X-Google-Smtp-Source: ABdhPJyJv52iBKvtDTvJF1+7eRxLlTMEhGx+y8CttxxQnlLd2uY9C4zIZWn2DgrBtYiMIT4JZ+yFVVmPcwL4W2wDTc8= X-Received: by 2002:a67:441:: with SMTP id 62mr5710642vse.54.1631280439938; Fri, 10 Sep 2021 06:27:19 -0700 (PDT) MIME-Version: 1.0 References: <20210910125818.334531-1-hongtao.liu@intel.com> <20210910125818.334531-3-hongtao.liu@intel.com> In-Reply-To: From: Hongtao Liu Date: Fri, 10 Sep 2021 21:27:09 +0800 Message-ID: Subject: Re: [PATCH 2/2] validate_subreg before call gen_lowpart to avoid ICE. To: Richard Biener Cc: liuhongt , Michael Meissner , Andrew Waterman , Segher Boessenkool , asolokha@gmx.com, Andreas Schwab , GCC Patches Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-9.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, 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 13:27:21 -0000 On Fri, Sep 10, 2021 at 9:16 PM Richard Biener via Gcc-patches wrote: > > On Fri, Sep 10, 2021 at 2:58 PM liuhongt wrote: > > > > gcc/ChangeLog: > > > > * expmed.c (extract_bit_field_using_extv): validate_subreg > > before call gen_lowpart. > > --- > > gcc/expmed.c | 6 +++++- > > 1 file changed, 5 insertions(+), 1 deletion(-) > > > > diff --git a/gcc/expmed.c b/gcc/expmed.c > > index 3143f38e057..10d62d857a8 100644 > > --- a/gcc/expmed.c > > +++ b/gcc/expmed.c > > @@ -1571,12 +1571,16 @@ extract_bit_field_using_extv (const extraction_insn *extv, rtx op0, > > > > if (GET_MODE (target) != ext_mode) > > { > > + machine_mode tmode = GET_MODE (target); > > /* Don't use LHS paradoxical subreg if explicit truncation is needed > > between the mode of the extraction (word_mode) and the target > > mode. Instead, create a temporary and use convert_move to set > > the target. */ > > if (REG_P (target) > > - && TRULY_NOOP_TRUNCATION_MODES_P (GET_MODE (target), ext_mode)) > > ^^^ > > I wonder if herein lies the problem in that the HFmode "truncation" from SImode > is considered noop? Note the underlying target hook only looks at the mode > precision and thus receives 16 and 32, and thus maybe that > TRULY_NOOP_TRUNCATION_MODES_P query only makes sense for > integer modes? Though the documentation of the hook only talks about > "conversion" of "values" ... > > So maybe a targetm.modes_tieable_p (GET_MODE (target), extmode) check > is missing? According to document, it should be true for targetm.modes_tieable_p(HFmode, SImode) since HFmode can be allocated to gpr. ---------------- This hook returns true if a value of mode mode1 is accessible in mode mode2 without copying ------------------- and also here gen_lowpart (SImode, HFmode, target) is called and hit gcc_assert, not (subreg:HF (reg:SI) 0) > > > + && TRULY_NOOP_TRUNCATION_MODES_P (tmode, ext_mode) > > + && validate_subreg (ext_mode, tmode, > > + target, > > + subreg_lowpart_offset (ext_mode, tmode))) > > { > > target = gen_lowpart (ext_mode, target); > > if (partial_subreg_p (GET_MODE (spec_target), ext_mode)) > > -- > > 2.27.0 > > -- BR, Hongtao