From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ed1-x536.google.com (mail-ed1-x536.google.com [IPv6:2a00:1450:4864:20::536]) by sourceware.org (Postfix) with ESMTPS id 256AB3858C39 for ; Fri, 10 Sep 2021 13:16:08 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 256AB3858C39 Received: by mail-ed1-x536.google.com with SMTP id j13so2422944edv.13 for ; Fri, 10 Sep 2021 06:16:08 -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=kaLNBYiouJR8gD6AcTgDujt2IH9r+Jtk7gVxO6bKKLs=; b=zjRLIa60SesWNXXHPEBMat1ZnJgn/aJaPm/mW+vjRQN9QLliQ2QzcraBtOGXXolVbb mPI3HFc0WxM7QwC7QB1ckvsbRIeRYVFGjH+866YceG11kHJ5NR8hoDcMNOuLVcvAVS3l C0DlDLntTJul04YDqYoLO8fwQOtV/G5XhK5wjGFCN5edOxQeScdCpO7an5zSiSlrIqfB KD+6w3za9386l2kSUw3kzoWEWN6rvuiwet9JJ23O4R6hiMe1eqWfiJyfaGzEq+1EaYSd K279WDt63tytEdAqI/ivDhSr77/jH71kEYzDBJlAeFBNhsj2rlZj6FMHtwrtjwQF+9EJ tDYg== X-Gm-Message-State: AOAM533Q+BG4oUkBSozozixfey4Keo7B2PupI+ZvxjlPwAtp/uzjzscB Og/p7+GWWsUlGCovkvrcomOD2yXGhv2HxRMBMmQ= X-Google-Smtp-Source: ABdhPJypekV+rXVwukKReptNuL05pseJYG6CYiU+ANc3xbRMZDbcRj/xIkshOSvafa95AJg8AOo7ncThj9Aqn9dKxrY= X-Received: by 2002:a50:ed0b:: with SMTP id j11mr8932804eds.97.1631279767089; Fri, 10 Sep 2021 06:16:07 -0700 (PDT) MIME-Version: 1.0 References: <20210910125818.334531-1-hongtao.liu@intel.com> <20210910125818.334531-3-hongtao.liu@intel.com> In-Reply-To: <20210910125818.334531-3-hongtao.liu@intel.com> From: Richard Biener Date: Fri, 10 Sep 2021 15:15:56 +0200 Message-ID: Subject: Re: [PATCH 2/2] validate_subreg before call gen_lowpart to avoid ICE. To: liuhongt Cc: GCC Patches , Michael Meissner , Segher Boessenkool , Jim Wilson , Andreas Schwab , Andrew Waterman , asolokha@gmx.com Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-8.9 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:16:11 -0000 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? > + && 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 >