From patchwork Thu Nov 16 05:36:14 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: liuhongt X-Patchwork-Id: 165698 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b909:0:b0:403:3b70:6f57 with SMTP id t9csp3003699vqg; Wed, 15 Nov 2023 21:38:45 -0800 (PST) X-Google-Smtp-Source: AGHT+IHUWyhdHNPmXuoC0EP0BFU+0Fame63kNp7AOegUlqL/coUCYDM7w6Tdag9S+hWuKkRwAaZB X-Received: by 2002:a05:622a:5cc:b0:41c:e92a:c604 with SMTP id d12-20020a05622a05cc00b0041ce92ac604mr9623577qtb.59.1700113124877; Wed, 15 Nov 2023 21:38:44 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1700113124; cv=pass; d=google.com; s=arc-20160816; b=Kw4UDa9BDyAzYuxWUqb+WH1Pox8UYWOaI0Pd37+dS24mCZwM+1TC8K++FUB/E/9Aj+ cF+2avrXlhb5FWRuXU5LJ9u5hHNy/5LXYr0PGlitzerJbxyq1pWqBaD9P5ZBSqjsYgMR 5+U54oslbX01zbzA/RqZZALy8eHjvNf8/2LHOTKZptmHb8/sEHPJhE01zvUTUbMVarFS lQriuSPQBY7Jw+EN50QdLMpcfP05Ko66RdEVW6abvki2BFvD7Clo+QA3VSxrAG7owhCM yvV7E/OS7OPtGw7RBP+osMb2BTDcr7rlSou+z0p0ISu8EvyZ1os/V+PIvxxjLTttX6Am ANXA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:message-id:date:subject:cc:to:from:dkim-signature :arc-filter:dmarc-filter:delivered-to; bh=RcT279whg9H7jVtOPyxb6BJmYvmLO/9rrraNW2CbXA0=; fh=ChXOctppJn0KECDRINafwUY5xHRufGHaa0Ju9pddrcQ=; b=Eo+5LzLV4ajiq18+aat/UckMUyvTxIGzt7CkHDO/dx6/QZGLO4CKjgq7UnokIDbndM h65bzA/Dp5rMyYs9JvnMt76w4ZvnZ2OPNAnB7hXYoWf6Iex4KwarT0nWMxZdaORrT75T /krxmwdgu+pvuwfWiBxf/nbQBsRunH3Gx+F9gnttrp/yw8TXhSymwyuy3xhN2t+lS3FY AhhxNF7i/pmFhP6KmiNzRPFPuSzEqPZJ/QB8XvkLt9mPE9qRSE6XusvWT0t4NRe1PFaK RLEjE5hrgzTD+Q9sbvS9BNtAxidSixRRniJVC4AE2PNNraY5CwUCm7nEilwxIlFK8ukh K43A== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=EroU5F28; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from server2.sourceware.org (server2.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id y9-20020ac85f49000000b0041985083e84si11224620qta.105.2023.11.15.21.38.44 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Nov 2023 21:38:44 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=EroU5F28; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id A3BE2385DC2E for ; Thu, 16 Nov 2023 05:38:44 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.65]) by sourceware.org (Postfix) with ESMTPS id 6A9AF3858C5F for ; Thu, 16 Nov 2023 05:38:19 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 6A9AF3858C5F Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=intel.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 6A9AF3858C5F Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=134.134.136.65 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1700113101; cv=none; b=tSweiiFJddptuoc/7/rIIsANAqGuZnO9ASegSUITByZz4Krxix6EKt2S0wipvsxEFvxY53vHNyABMFTQfB/PYqqIjsIFVvcDRpcOF/ZrOeh4xcglszNmEub1ns7xv1wU6tqp3E65iH61SJgx4N5JhFwfozB3JGN5SNyJ8mJrQ4Q= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1700113101; c=relaxed/simple; bh=GyCohaYZHZOZm5xF0fe+9TQOX0TGWYFY1HaNXIKJ0+k=; h=DKIM-Signature:From:To:Subject:Date:Message-Id:MIME-Version; b=ROWD5mLGXJnGD4hwSqUfR4kF0kIBp1uWHO3mMsbOsjVcWS4KWldFO7qcxY/PdH/6ILp/wkqoxAviDHHr+WsiARUI4cvgRs7O7Yzrh0aLeQPGwhfPeE6be6F+9vQfy2blL4KgOeEcjQymZu3kV1A9iJCBhUPAWHSRZAzSXstKOGs= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1700113099; x=1731649099; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=GyCohaYZHZOZm5xF0fe+9TQOX0TGWYFY1HaNXIKJ0+k=; b=EroU5F28Czbpmj1ZH+t04Y1W/4GUF84pOfsWb8LIe31/E7KU2IZxodjE fTYsN0VKLYuTZ5eCRTOu0Yz2DgC5oITtvY1QPBVYA3S/h5bdvX9KqgFPM iYRQUHVmLSlQ7Zlh/2rxo1YPknvK9tsnKkBvNkVkaD+uOl6afFOyKnxv/ svtM7OIEnZkddA23gsKmxlJS0Zf8kPibrk3oQiF3Olg5Kot+SjLBABbCR yjfVflQjPubNpJYiaEvxX5hirn0W9LOWKkD0Mh9UYUzczYOqCAUHJJVMA cdEW2SleA99CCFUlUSkeoMwogk/9LlypxSq3WyCM7BC9SjYdE4fszRzTA Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10895"; a="394936320" X-IronPort-AV: E=Sophos;i="6.03,307,1694761200"; d="scan'208";a="394936320" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Nov 2023 21:38:17 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10895"; a="882634762" X-IronPort-AV: E=Sophos;i="6.03,307,1694761200"; d="scan'208";a="882634762" Received: from shvmail03.sh.intel.com ([10.239.245.20]) by fmsmga002.fm.intel.com with ESMTP; 15 Nov 2023 21:38:15 -0800 Received: from shliclel4217.sh.intel.com (shliclel4217.sh.intel.com [10.239.240.127]) by shvmail03.sh.intel.com (Postfix) with ESMTP id 0107E1005679; Thu, 16 Nov 2023 13:38:14 +0800 (CST) From: liuhongt To: gcc-patches@gcc.gnu.org Cc: crazylht@gmail.com, hjl.tools@gmail.com Subject: [PATCH] Fix ICE of unrecognizable insn. Date: Thu, 16 Nov 2023 13:36:14 +0800 Message-Id: <20231116053614.3352917-1-hongtao.liu@intel.com> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 X-Spam-Status: No, score=-12.0 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE 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.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1782697819695113655 X-GMAIL-MSGID: 1782697819695113655 The new added splitter will generate (insn 58 56 59 2 (set (reg:V4HI 20 xmm0 [129]) (vec_duplicate:V4HI (reg:HI 22 xmm2 [123]))) "testcase.c":16:21 -1 But we only have (define_insn "*vec_dupv4hi" [(set (match_operand:V4HI 0 "register_operand" "=y,Yw") (vec_duplicate:V4HI (truncate:HI (match_operand:SI 1 "register_operand" "0,Yw"))))] The patch add patterns for V4HI and V2HI. Bootstrapped and regtested on x86_64-pc-linux-gnu{-m32,}. Ready push to trunk. gcc/ChangeLog: PR target/112532 * config/i386/mmx.md (*vec_dup): Extend for V4HI and V2HI. gcc/testsuite/ChangeLog: * gcc.target/i386/pr112532.c: New test. --- gcc/config/i386/mmx.md | 8 ++++---- gcc/testsuite/gcc.target/i386/pr112532.c | 21 +++++++++++++++++++++ 2 files changed, 25 insertions(+), 4 deletions(-) create mode 100644 gcc/testsuite/gcc.target/i386/pr112532.c diff --git a/gcc/config/i386/mmx.md b/gcc/config/i386/mmx.md index a3d08bb9d3b..e4b89160fc0 100644 --- a/gcc/config/i386/mmx.md +++ b/gcc/config/i386/mmx.md @@ -5277,8 +5277,8 @@ (define_insn "*vec_dupv4hi" (set_attr "mode" "DI,TI")]) (define_insn "*vec_dup" - [(set (match_operand:V4F_64 0 "register_operand" "=Yw") - (vec_duplicate:V4F_64 + [(set (match_operand:V4FI_64 0 "register_operand" "=Yw") + (vec_duplicate:V4FI_64 (match_operand: 1 "register_operand" "Yw")))] "TARGET_MMX_WITH_SSE" "%vpshuflw\t{$0, %1, %0|%0, %1, 0}" @@ -5869,8 +5869,8 @@ (define_insn "*vec_dupv2hi" (set_attr "mode" "TI")]) (define_insn "*vec_dup" - [(set (match_operand:V2F_32 0 "register_operand" "=Yw") - (vec_duplicate:V2F_32 + [(set (match_operand:V2FI_32 0 "register_operand" "=Yw") + (vec_duplicate:V2FI_32 (match_operand: 1 "register_operand" "Yw")))] "TARGET_SSE2" "%vpshuflw\t{$0, %1, %0|%0, %1, 0}" diff --git a/gcc/testsuite/gcc.target/i386/pr112532.c b/gcc/testsuite/gcc.target/i386/pr112532.c new file mode 100644 index 00000000000..690f1d9670d --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr112532.c @@ -0,0 +1,21 @@ +/* { dg-do compile } */ +/* { dg-options "-msse4 -O2" } */ + +typedef char __attribute__((__vector_size__(2))) v16u8; +typedef int __attribute__((__vector_size__(8))) v64u8; +typedef unsigned short __attribute__((__vector_size__(2))) v16u16; +typedef unsigned short __attribute__((__vector_size__(8))) v64u16; +v64u16 foo0_v64u16_0; +int __attribute__((__vector_size__(4 * sizeof(int)))) foo0_v128u32_0; +__attribute__((__vector_size__(8 * sizeof(short)))) unsigned short foo0_v128u16_0; +v16u16 foo0_v16u16_0; +v16u8 foo0() { + v16u16 v16u16_1 = __builtin_shufflevector(__builtin_shufflevector(__builtin_convertvector(foo0_v128u32_0, v64u16),foo0_v16u16_0, 1, 4, 2, 0, 0, 2, 2, 2),foo0_v16u16_0, 7); + foo0_v64u16_0 -= (short)v16u16_1; + v64u16 v64u16_3 = __builtin_shufflevector(v16u16_1, __builtin_shufflevector((v16u16){}, foo0_v128u16_0, 7, 0), 0, 1, 2, 2); + return (union {v16u8 b;}) + {((union { + v64u8 a; + int b; + })(v64u8)v64u16_3).b}.b + (v16u8)v16u16_1; +}