From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by sourceware.org (Postfix) with ESMTPS id 066F338356BB for ; Tue, 14 Jun 2022 22:49:29 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 066F338356BB X-IronPort-AV: E=McAfee;i="6400,9594,10378"; a="365110096" X-IronPort-AV: E=Sophos;i="5.91,300,1647327600"; d="scan'208";a="365110096" Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Jun 2022 15:49:27 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.91,300,1647327600"; d="scan'208";a="830686603" Received: from scymds01.sc.intel.com ([10.148.94.138]) by fmsmga006.fm.intel.com with ESMTP; 14 Jun 2022 15:49:27 -0700 Received: from shliclel051.sh.intel.com (shliclel051.sh.intel.com [10.239.236.51]) by scymds01.sc.intel.com with ESMTP id 25EMnQ57032218; Tue, 14 Jun 2022 15:49:27 -0700 From: liuhongt To: gcc-patches@gcc.gnu.org Subject: [PATCH] Fix ICE in extract_insn, at recog.cc:2791 Date: Wed, 15 Jun 2022 06:49:26 +0800 Message-Id: <20220614224926.4779-1-hongtao.liu@intel.com> X-Mailer: git-send-email 2.18.1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-12.6 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_NUMSUBJECT, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE, WEIRD_PORT autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) 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: Tue, 14 Jun 2022 22:49:33 -0000 (In reply to Uroš Bizjak from comment #1) > Instruction does not accept memory operand for operand 3: > > (define_insn_and_split > "*_blendv_ltint" > [(set (match_operand: 0 "register_operand" "=Yr,*x,x") > (unspec: > [(match_operand: 1 "register_operand" "0,0,x") > (match_operand: 2 "vector_operand" "YrBm,*xBm,xm") > (subreg: > (lt:VI48_AVX > (match_operand:VI48_AVX 3 "register_operand" "Yz,Yz,x") > (match_operand:VI48_AVX 4 "const0_operand")) 0)] > UNSPEC_BLENDV))] > > The problematic insn is: > > (define_insn_and_split "*avx_cmp3_ltint_not" > [(set (match_operand:VI48_AVX 0 "register_operand") > (vec_merge:VI48_AVX > (match_operand:VI48_AVX 1 "vector_operand") > (match_operand:VI48_AVX 2 "vector_operand") > (unspec: > [(subreg:VI48_AVX > (not: > (match_operand: 3 "vector_operand")) 0) > (match_operand:VI48_AVX 4 "const0_operand") > (match_operand:SI 5 "const_0_to_7_operand")] > UNSPEC_PCMP)))] > > which gets split to the above pattern. > > In the preparation statements we have: > > if (!MEM_P (operands[3])) > operands[3] = force_reg (mode, operands[3]); > operands[3] = lowpart_subreg (mode, operands[3], mode); > > Which won't fly when operand 3 is memory operand... > Bootstrapped and regtested on x86_64-pc-linux-gnu{-m32,}. Ok for trunk? gcc/ChangeLog: PR target/105953 * config/i386/sse.md (*avx_cmp3_ltint_not): Force_reg operands[3]. gcc/testsuite/ChangeLog: * g++.target/i386/pr105953.C: New test. --- gcc/config/i386/sse.md | 3 +-- gcc/testsuite/g++.target/i386/pr105953.C | 4 ++++ 2 files changed, 5 insertions(+), 2 deletions(-) create mode 100644 gcc/testsuite/g++.target/i386/pr105953.C diff --git a/gcc/config/i386/sse.md b/gcc/config/i386/sse.md index 75609eaf9b7..3e3d96fe087 100644 --- a/gcc/config/i386/sse.md +++ b/gcc/config/i386/sse.md @@ -3643,8 +3643,7 @@ (define_insn_and_split "*avx_cmp3_ltint_not" gen_lowpart (mode, operands[1])); operands[2] = gen_lowpart (mode, operands[2]); - if (!MEM_P (operands[3])) - operands[3] = force_reg (mode, operands[3]); + operands[3] = force_reg (mode, operands[3]); operands[3] = lowpart_subreg (mode, operands[3], mode); }) diff --git a/gcc/testsuite/g++.target/i386/pr105953.C b/gcc/testsuite/g++.target/i386/pr105953.C new file mode 100644 index 00000000000..b423d2dfdae --- /dev/null +++ b/gcc/testsuite/g++.target/i386/pr105953.C @@ -0,0 +1,4 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -mavx512vl -mabi=ms" } */ + +#include "pr100738-1.C" -- 2.18.1