From patchwork Wed Feb 9 09:03:08 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Liu, Hongtao" X-Patchwork-Id: 1590249 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.a=rsa-sha256 header.s=default header.b=XhafocqR; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Received: from sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4Jtv8G6Pwwz9sCD for ; Wed, 9 Feb 2022 20:04:30 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id B84B63858436 for ; Wed, 9 Feb 2022 09:04:28 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B84B63858436 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1644397468; bh=zJ0yyLje2fr/CdodYNnh2chktmiqImDYRCFm43Cz8Ok=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=XhafocqRigmxdwKMiVLr9TsUYG9zST98n7EDxmV4sPf+xnRcdor6fCzSfQSWfuXvk xqcdAUg5ZHtS1JUvK5L84XcUGKjhWvWOUspYn6luVzvxv6jtahE5edN5iHRK0I1eET nbL4WnhRFmgcTpuI74uVrB87k7VgpS2jKIVoRTjE= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by sourceware.org (Postfix) with ESMTPS id 07881385842B for ; Wed, 9 Feb 2022 09:03:17 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 07881385842B X-IronPort-AV: E=McAfee;i="6200,9189,10252"; a="236567101" X-IronPort-AV: E=Sophos;i="5.88,355,1635231600"; d="scan'208";a="236567101" Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Feb 2022 01:03:10 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.88,355,1635231600"; d="scan'208";a="536871000" Received: from scymds01.sc.intel.com ([10.148.94.138]) by fmsmga007.fm.intel.com with ESMTP; 09 Feb 2022 01:03:09 -0800 Received: from shliclel320.sh.intel.com (shliclel320.sh.intel.com [10.239.236.50]) by scymds01.sc.intel.com with ESMTP id 219938bi031600; Wed, 9 Feb 2022 01:03:09 -0800 To: gcc-patches@gcc.gnu.org Subject: [PATCH] [i386] ICE: QImode(not SImode) operand should be passed to gen_vec_initv16qiqi in ashlv16qi3. Date: Wed, 9 Feb 2022 17:03:08 +0800 Message-Id: <20220209090308.96206-1-hongtao.liu@intel.com> X-Mailer: git-send-email 2.18.1 X-Spam-Status: No, score=-12.1 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE 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-Patchwork-Original-From: liuhongt via Gcc-patches From: "Liu, Hongtao" Reply-To: liuhongt Errors-To: gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org Sender: "Gcc-patches" ix86_expand_vector_init expects vals to be a parallel containing values of individual fields which should be either element mode of the vector mode, or a vector mode with the same element mode and smaller number of elements. But in the expander ashlv16qi3, the second operand is SImode which can't be directly passed to gen_vec_initv16qiqi. Bootstrapped on CLX Regtested on x86_64-pc-linux-gnu{-m32\ -mxop\ -mavx2,\ -mxop\ -mavx2}. Don't have machine with xop for native bootstrap, but i think the fix should be ok. Ok for trunk? gcc/ChangeLog: PR target/104451 * config/i386/sse.md (3): lowpart_subreg operands[2] from SImode to QImode. gcc/testsuite/ChangeLog: PR target/104451 * gcc.target/i386/pr104451.c: New test. --- gcc/config/i386/sse.md | 3 ++- gcc/testsuite/gcc.target/i386/pr104451.c | 25 ++++++++++++++++++++++++ 2 files changed, 27 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gcc.target/i386/pr104451.c diff --git a/gcc/config/i386/sse.md b/gcc/config/i386/sse.md index d8cb7b65594..36b35f68349 100644 --- a/gcc/config/i386/sse.md +++ b/gcc/config/i386/sse.md @@ -24153,8 +24153,9 @@ (define_expand "3" negate = true; } par = gen_rtx_PARALLEL (V16QImode, rtvec_alloc (16)); + tmp = lowpart_subreg (QImode, operands[2], SImode); for (i = 0; i < 16; i++) - XVECEXP (par, 0, i) = operands[2]; + XVECEXP (par, 0, i) = tmp; tmp = gen_reg_rtx (V16QImode); emit_insn (gen_vec_initv16qiqi (tmp, par)); diff --git a/gcc/testsuite/gcc.target/i386/pr104451.c b/gcc/testsuite/gcc.target/i386/pr104451.c new file mode 100644 index 00000000000..22f3ad092b3 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr104451.c @@ -0,0 +1,25 @@ +/* { dg-do compile } */ +/* { dg-options "-mavx2 -O" } */ + +typedef char __attribute__((__vector_size__ (16))) V; +typedef unsigned char __attribute__((__vector_size__ (16))) UV; +V v; +UV uv; + +V +foo (long c) +{ + return v << c; +} + +V +foo1 (long c) +{ + return v >> c; +} + +UV +foo2 (unsigned long uc) +{ + return uv >> uc; +}