From patchwork Wed Sep 4 01:31:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Levy Hsu X-Patchwork-Id: 1980397 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; secure) header.d=levyhsu.com header.i=@levyhsu.com header.a=rsa-sha256 header.s=default header.b=mprWis7B; 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 4Wz4jy18FXz1yZ9 for ; Wed, 4 Sep 2024 11:32:37 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 672603860750 for ; Wed, 4 Sep 2024 01:32:35 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from out28-62.mail.aliyun.com (out28-62.mail.aliyun.com [115.124.28.62]) by sourceware.org (Postfix) with ESMTPS id 94B70385C6D1 for ; Wed, 4 Sep 2024 01:32:07 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 94B70385C6D1 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=levyhsu.com Authentication-Results: sourceware.org; spf=fail smtp.mailfrom=levyhsu.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 94B70385C6D1 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=115.124.28.62 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1725413531; cv=none; b=xUalqE/yRKY1TiumIRfoXZVdbLRAnCK5Zcz1r2yh7C2dwrIh5XmWm8xU4FpWIjF2XS1k+QtVZ5VbubmpbeDllVtkt2eu46qhJKwx5ebgGxbd0yhpZ1sIff9qm4ugNBfJ1VRVXyERGsXO6d4Go1tQk9BotCs6+xMNX/gkknTHH38= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1725413531; c=relaxed/simple; bh=xQ0CvMWAfmqiI2wJAxYS50iq5msfHZmMX7noA2r1JiI=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=uVngOBfsQ6+kbLwYXxuBhJJzaTx8zBzZct9US63uFQSevNDu27ZmA8ERcq3y+SfN7PKbcBewFaa9vWlv6vfIo5XMU08SRe43kgN1X4K4HKBluf7R7dqjRkvCkAT0k9jk/MQVArBCdqsq245Xde7MNxSqSyYv3nMCNvEdZS7+dAU= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=levyhsu.com; s=default; t=1725413524; h=From:To:Subject:Date:Message-ID:MIME-Version; bh=s8Y6jUb74xWv1jZ9JJHjCP8LpKb8/JX2fEZSbnBnd54=; b=mprWis7B/kU+S0TO81Na6P7rAbfKL+7edr/vynro1z1owRFXBShpTUZgqiBcnLtMY1ScRTQ1603u0MO7UDKtkjQtF+L8A0JiQby5Iy49Q76yRPwF5BYjW6xy+6KtDsVZXLn+rxG19bbhiFo/i2PvQDobxL1pYXWxX+588MEo3Tfgb8jV67TInnbFD5DkL12i6OujQSjNuzvAEWixPjUJ8f7GL8QGi+yM7YGf1TXoOZUk6ReW4aj2EKmmhYY1g/mU91n6j/wKBbw2mx7ZzKGYDXyqyhgVn6tIck9lzHZVNKQUBMN0u7aiif0ZgoPoH0BmGHr1TWH26+PHanmdhMZorQ== Received: from ip-10-0-136-122.us-west-2.compute.internal(mailfrom:admin@levyhsu.com fp:SMTPD_---.ZA6jwLr_1725413518) by smtp.aliyun-inc.com; Wed, 04 Sep 2024 09:32:01 +0800 From: Levy Hsu To: gcc-patches@gcc.gnu.org Cc: admin@levyhsu.com, liwei.xu@intel.com, crazylht@gmail.com, ubizjak@gmail.com Subject: [PATCH] i386: Integrate BFmode for Enhanced Vectorization in ix86_preferred_simd_mode Date: Wed, 4 Sep 2024 01:31:09 +0000 Message-ID: <20240904013156.1893271-1-admin@levyhsu.com> X-Mailer: git-send-email 2.43.0 MIME-Version: 1.0 X-Spam-Status: No, score=-13.0 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, TXREP, T_SCC_BODY_TEXT_LINE, T_SPF_PERMERROR, UNPARSEABLE_RELAY 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 Hi This change adds BFmode support to the ix86_preferred_simd_mode function enhancing SIMD vectorization for BF16 operations. The update ensures optimized usage of SIMD capabilities improving performance and aligning vector sizes with processor capabilities. Bootstrapped and tested on x86-64-pc-linux-gnu. Ok for trunk? gcc/ChangeLog: * config/i386/i386.cc (ix86_preferred_simd_mode): Add BFmode Support. --- gcc/config/i386/i386.cc | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/gcc/config/i386/i386.cc b/gcc/config/i386/i386.cc index 7af9ceca429..aea138c85ad 100644 --- a/gcc/config/i386/i386.cc +++ b/gcc/config/i386/i386.cc @@ -24570,6 +24570,14 @@ ix86_preferred_simd_mode (scalar_mode mode) } return word_mode; + case E_BFmode: + if (TARGET_AVX512F && TARGET_EVEX512 && !TARGET_PREFER_AVX256) + return V32BFmode; + else if (TARGET_AVX && !TARGET_PREFER_AVX128) + return V16BFmode; + else + return V8BFmode; + case E_SFmode: if (TARGET_AVX512F && TARGET_EVEX512 && !TARGET_PREFER_AVX256) return V16SFmode;