From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-vs1-xe36.google.com (mail-vs1-xe36.google.com [IPv6:2607:f8b0:4864:20::e36]) by sourceware.org (Postfix) with ESMTPS id 5779A3858405 for ; Fri, 10 Sep 2021 13:52:57 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 5779A3858405 Received: by mail-vs1-xe36.google.com with SMTP id i23so1653555vsj.4 for ; Fri, 10 Sep 2021 06:52:57 -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:content-transfer-encoding; bh=53Vaq0bic3wPD3hazAnUbponrHiCnyNmwEZylRWy5us=; b=B5JyQ+ZC4gKLhnvxf9Rn+C6HXFMZ11bPwIwF3EOGsXQR28OAHGV0XTl29tOzG+tGI2 YthkN9GIeA/aJc1d3cQzQ9txus36YKmiubmzaX1nzaySTZ27dxa9aSH9tGf+9u1mdvoV WBBudllbj5WpYrcBKuwHl60E3EBhtN5tiPk/cLijc5+vMPzHbBeow5r/vr32NAUk5qiE wIbNlKbCvlEpOHMIkIL2FhiAehWCFaCW7Pwn4VpWYqZPbUWM97oo1IhjXwlxoG5h5OOv PzIt5vlwoID086hh9w9/oImf1h6kL3HepusdKpf1Tsz8tJXqPtpZ118h9WKqtJ1oV18G Gylw== X-Gm-Message-State: AOAM532VOwbVnlr6L/JyhG9kwFXGIvky5tNXO/helDejSHk7l5j9HE0U DUqIrNxnIcBMPKVFCWF/vrfrJ6oQpvA286s69ho= X-Google-Smtp-Source: ABdhPJw9fJAnWo5jy9cGyv/Z2DKzT2BQWMqcRs3tbuRq50HibIKrCco4LB6C769BOII4v5UmYCVlOTHioLLWarPhoME= X-Received: by 2002:a05:6102:116f:: with SMTP id k15mr1897702vsg.43.1631281976978; Fri, 10 Sep 2021 06:52:56 -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:52:46 +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" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-9.6 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:52:58 -0000 On Fri, Sep 10, 2021 at 9:32 PM Richard Biener wrote: > > On September 10, 2021 3:27:09 PM GMT+02:00, Hongtao Liu wrote: > >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 extracti= on_insn *extv, rtx op0, > >> > > >> > if (GET_MODE (target) !=3D ext_mode) > >> > { > >> > + machine_mode tmode =3D GET_MODE (target); > >> > /* Don't use LHS paradoxical subreg if explicit truncation is= needed > >> > between the mode of the extraction (word_mode) and the targ= et > >> > 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_m= ode)) > >> > >> ^^^ > >> > >> I wonder if herein lies the problem in that the HFmode "truncation" fr= om 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) > > I see. Of course that leads to a suggestion to allow the subreg based on = modes_tieable_p, but then others will know why that's the wrong thing to do= ? allowing subreg based on modes_tieable_p would be too strict=EF=BC=8C it ev= en disallows (subreg SF (reg:SI). > > Richard. > > >> > >> > + && TRULY_NOOP_TRUNCATION_MODES_P (tmode, ext_mode) > >> > + && validate_subreg (ext_mode, tmode, > >> > + target, > >> > + subreg_lowpart_offset (ext_mode, tmode= ))) > >> > { > >> > target =3D gen_lowpart (ext_mode, target); > >> > if (partial_subreg_p (GET_MODE (spec_target), ext_mode)) > >> > -- > >> > 2.27.0 > >> > > > > > > > > --=20 BR, Hongtao