From patchwork Mon Jul 29 07:57:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Li, Pan2" X-Patchwork-Id: 1965884 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=WtEud7ou; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=8.43.85.97; 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 [8.43.85.97]) (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 4WXW1l1q7Cz1ybY for ; Mon, 29 Jul 2024 17:58:03 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 7ABA63858433 for ; Mon, 29 Jul 2024 07:58:01 +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 [198.175.65.15]) by sourceware.org (Postfix) with ESMTPS id 71A783858408 for ; Mon, 29 Jul 2024 07:57:35 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 71A783858408 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 71A783858408 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=198.175.65.15 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1722239857; cv=none; b=HzozFPNE/TrPZ+zMb3Z6Fh4xh1LVvWMBuWz5YbH5+Vqjn8u9ulWO9DmLaISfzcTv6sTENeY9eQhBUSU1FJ1riAtJPR3yNDfOOOSWrowAgR4399X3ekK8/51Ca2rsrd8VVpdjBb8cxnjHIhDbHz7e1G0ZQY+jo+NzLrdv/jLOY+8= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1722239857; c=relaxed/simple; bh=iz2WQ+KfN/UauKFlYpJui0A0yoDSvWa4W3DbxDM0ND8=; h=DKIM-Signature:From:To:Subject:Date:Message-Id:MIME-Version; b=P7vxmscoOun4Up/bkbZFFzMFeHZm6gLe2U9VTSvleCFFndvNZgx54W0K6MrwE1z52r+AhRp+gAkuW0xVzSeTOP1aeNfsG6OMLCD6ucImvNThf/rSnTbrowWYK1Lzr5kdUYWcXMSSueNG0CUDUWYd+mTRITzRdLAPkjvFfh1S/bg= 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=1722239856; x=1753775856; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=iz2WQ+KfN/UauKFlYpJui0A0yoDSvWa4W3DbxDM0ND8=; b=WtEud7ouwznDulh1KkkB3Q0uT1bSSsNfe2nRU1+rmm8Tj6dP7nawymC3 qeqz4Jik514gscYajDS5OpoCTBrhUjTQATC0U+S4hmLdYgfnRWZqXQrQy /yko3jKmiDnGYTiFDJ4OXgQ7XvUqS0UcVl7yP1hPuo5fDJmR7fohps3aC AQdCZE8TV2JuReqWQt9ZUGFpeqvIsDxVhqkLiPWouqO13LIeFbxQ8Yax4 DjfzILn19YCZPJNi1C+FSLBABDw9oGfdMhL21uwek0/It45INp5po621z fUgiGgXnfjqPZDgX4acX3S3X3paYGZVBiCe9ELm/MBSPGTEk8UKBlYL/D w==; X-CSE-ConnectionGUID: APgY5JDfTPWkpZgx6rZzzQ== X-CSE-MsgGUID: LnhUZA1cSca/xEO/XN1yMg== X-IronPort-AV: E=McAfee;i="6700,10204,11147"; a="23730289" X-IronPort-AV: E=Sophos;i="6.09,245,1716274800"; d="scan'208";a="23730289" Received: from orviesa007.jf.intel.com ([10.64.159.147]) by orvoesa107.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Jul 2024 00:57:34 -0700 X-CSE-ConnectionGUID: DDEAQbCGSVqcGwUGeNZ8gA== X-CSE-MsgGUID: 8X6NtKIUQXWquvIuboOOHg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.09,245,1716274800"; d="scan'208";a="54491265" Received: from shvmail03.sh.intel.com ([10.239.245.20]) by orviesa007.jf.intel.com with ESMTP; 29 Jul 2024 00:57:31 -0700 Received: from pli-ubuntu.sh.intel.com (pli-ubuntu.sh.intel.com [10.239.159.47]) by shvmail03.sh.intel.com (Postfix) with ESMTP id 7D0151005676; Mon, 29 Jul 2024 15:57:29 +0800 (CST) From: pan2.li@intel.com To: gcc-patches@gcc.gnu.org Cc: juzhe.zhong@rivai.ai, kito.cheng@gmail.com, richard.guenther@gmail.com, tamar.christina@arm.com, jeffreyalaw@gmail.com, rdapp.gcc@gmail.com, Pan Li Subject: [PATCH v1] Internal-fn: Handle vector bool type for type strict match mode [PR116103] Date: Mon, 29 Jul 2024 15:57:24 +0800 Message-Id: <20240729075724.3722156-1-pan2.li@intel.com> X-Mailer: git-send-email 2.34.1 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, KAM_SHORT, 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 For some target like target=amdgcn-amdhsa, we need to take care of vector bool types prior to general vector mode types. Or we may have the asm check failure as below. gcc.target/gcn/cond_smax_1.c scan-assembler-times \\tv_cmp_gt_i32\\tvcc, s[0-9]+, v[0-9]+ 80 gcc.target/gcn/cond_smin_1.c scan-assembler-times \\tv_cmp_gt_i32\\tvcc, s[0-9]+, v[0-9]+ 80 gcc.target/gcn/cond_umax_1.c scan-assembler-times \\tv_cmp_gt_i32\\tvcc, s[0-9]+, v[0-9]+ 56 gcc.target/gcn/cond_umin_1.c scan-assembler-times \\tv_cmp_gt_i32\\tvcc, s[0-9]+, v[0-9]+ 56 gcc.dg/tree-ssa/loop-bound-2.c scan-tree-dump-not ivopts "zero if " The below test suites are passed for this patch. 1. The rv64gcv fully regression tests. 2. The x86 bootstrap tests. 3. The x86 fully regression tests. 4. The amdgcn test case as above. gcc/ChangeLog: * internal-fn.cc (type_strictly_matches_mode_p): Add handling for vector bool type. Signed-off-by: Pan Li --- gcc/internal-fn.cc | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/gcc/internal-fn.cc b/gcc/internal-fn.cc index 8a2e07f2f96..086c8be398a 100644 --- a/gcc/internal-fn.cc +++ b/gcc/internal-fn.cc @@ -4171,6 +4171,12 @@ direct_internal_fn_optab (internal_fn fn) static bool type_strictly_matches_mode_p (const_tree type) { + /* For target=amdgcn-amdhsa, we need to take care of vector bool types. + More details see https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116103. */ + if (VECTOR_BOOLEAN_TYPE_P (type) && SCALAR_INT_MODE_P (TYPE_MODE (type)) + && TYPE_PRECISION (TREE_TYPE (type)) == 1) + return true; + if (VECTOR_TYPE_P (type)) return VECTOR_MODE_P (TYPE_MODE (type));