From patchwork Mon Oct 14 11:10:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Li, Pan2" X-Patchwork-Id: 1996825 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=D1ssqSn7; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=server2.sourceware.org; envelope-from=gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=patchwork.ozlabs.org) Received: from server2.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 ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4XRvlC4jtLz1xvx for ; Mon, 14 Oct 2024 22:14:47 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id AF93C385AE7B for ; Mon, 14 Oct 2024 11:14:45 +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 [192.198.163.13]) by sourceware.org (Postfix) with ESMTPS id 46C153858C60 for ; Mon, 14 Oct 2024 11:12:37 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 46C153858C60 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 46C153858C60 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=192.198.163.13 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1728904368; cv=none; b=uBry64Jnaff54JJ2MFFM/L3t2RqduKIyXW1lNS2/lAegqtbKp9c8N/VThFM/Fxor3ReUcVGByX4PmFZ22OEHr3j/jEo6NiQ1HlPRNVoYE6JCfbB4wzVPnHlIbYRzsG7Q/946inYNbWnSDPIJlYU7guR1qZ1l2w5wBuGzPnY5rZ8= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1728904368; c=relaxed/simple; bh=8Jd2+RhjYbh7ewh6LhpjzW9JW8ZLv43Ysbby/RzzTxk=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=aekhtYviSgz0+1l82xizq9MLrRdZx6JaB42+f1QNRNDikAxVyCWo7Rx6mtT5QOLr9bVHL2cSjoM10hbyKJ3dFzUesfgzl4344R4YkfuNAfs5/v2vdwQtik7lxOdLlGfMyLMgAeenNKNPe5eQkDHBXn+NrxybdzQnywGF9XACzXs= 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=1728904358; x=1760440358; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=8Jd2+RhjYbh7ewh6LhpjzW9JW8ZLv43Ysbby/RzzTxk=; b=D1ssqSn786FHAbrRXLznqkkA5tUC8g6N5Y5cRs8qhDXOkkS4q/o/K9mK GmVPWC/9X3l0fcbf9suWNU4tCJBYm47HTnUxJ9PDutBVkepPsEU+5lAoA IJVkI4wjDGQTTlsNOeUiNZsw3+zZF9G5IpT+pT4d4dJjh9QNTKZTS7lSV icjBsMDzUm/nyVF7clyaxcBu3Dc0AzzO9G2vnJM+msqeDyb8K0mzg0axo e7CCNkMCbTfcVw2CTihzPIbCgVsXmbMO8QH0jH2bg+xIeYMYmU23iobmo +/P0amEr9eDZG2MntFsRWfJm9KcRgtNhLbbIpiFh03C4+KlJjjSSjau0+ A==; X-CSE-ConnectionGUID: ZnwbaxvWQyWeRg/vf5CYuQ== X-CSE-MsgGUID: S7JrwT80RDuic6qLiErNwg== X-IronPort-AV: E=McAfee;i="6700,10204,11224"; a="31129481" X-IronPort-AV: E=Sophos;i="6.11,202,1725346800"; d="scan'208";a="31129481" Received: from orviesa001.jf.intel.com ([10.64.159.141]) by fmvoesa107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Oct 2024 04:12:36 -0700 X-CSE-ConnectionGUID: vLi2XU7WQZiepld3PmNLlA== X-CSE-MsgGUID: +iyvDI2dQEmq9qaw0bHm6g== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.11,202,1725346800"; d="scan'208";a="114998491" Received: from panli.sh.intel.com ([10.239.154.73]) by orviesa001.jf.intel.com with ESMTP; 14 Oct 2024 04:12:34 -0700 From: pan2.li@intel.com To: gcc-patches@gcc.gnu.org Cc: richard.guenther@gmail.com, Tamar.Christina@arm.com, juzhe.zhong@rivai.ai, kito.cheng@gmail.com, jeffreyalaw@gmail.com, rdapp.gcc@gmail.com, Pan Li Subject: [PATCH 02/11] Vect: Try the pattern of vector signed integer SAT_TRUNC Date: Mon, 14 Oct 2024 19:10:49 +0800 Message-ID: <20241014111058.1033886-2-pan2.li@intel.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241014111058.1033886-1-pan2.li@intel.com> References: <20241014111058.1033886-1-pan2.li@intel.com> MIME-Version: 1.0 X-Spam-Status: No, score=-11.5 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, SPF_HELO_NONE, SPF_NONE, TXREP 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~incoming=patchwork.ozlabs.org@gcc.gnu.org From: Pan Li Almost the same as vector unsigned integer SAT_TRUNC, try to match the signed version during the vector pattern matching. The below test suites are passed for this patch. * The rv64gcv fully regression test. * The x86 bootstrap test. * The x86 fully regression test. gcc/ChangeLog: * tree-vect-patterns.cc (gimple_signed_integer_sat_trunc): Add new func decl for signed SAT_TRUNC. (vect_recog_sat_trunc_pattern): Try signed match pattern for the SAT_TRUNC. Signed-off-by: Pan Li --- gcc/tree-vect-patterns.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/gcc/tree-vect-patterns.cc b/gcc/tree-vect-patterns.cc index 746f100a084..ce5a528141f 100644 --- a/gcc/tree-vect-patterns.cc +++ b/gcc/tree-vect-patterns.cc @@ -4539,6 +4539,7 @@ extern bool gimple_unsigned_integer_sat_trunc (tree, tree*, tree (*)(tree)); extern bool gimple_signed_integer_sat_add (tree, tree*, tree (*)(tree)); extern bool gimple_signed_integer_sat_sub (tree, tree*, tree (*)(tree)); +extern bool gimple_signed_integer_sat_trunc (tree, tree*, tree (*)(tree)); static gimple * vect_recog_build_binary_gimple_stmt (vec_info *vinfo, stmt_vec_info stmt_info, @@ -4770,7 +4771,8 @@ vect_recog_sat_trunc_pattern (vec_info *vinfo, stmt_vec_info stmt_vinfo, tree lhs = gimple_assign_lhs (last_stmt); tree otype = TREE_TYPE (lhs); - if (gimple_unsigned_integer_sat_trunc (lhs, ops, NULL) + if ((gimple_unsigned_integer_sat_trunc (lhs, ops, NULL) + || gimple_signed_integer_sat_trunc (lhs, ops, NULL)) && type_has_mode_precision_p (otype)) { tree itype = TREE_TYPE (ops[0]);