diff mbox series

i386: Integrate BFmode for Enhanced Vectorization in ix86_preferred_simd_mode

Message ID 20240904013156.1893271-1-admin@levyhsu.com
State New
Headers show
Series i386: Integrate BFmode for Enhanced Vectorization in ix86_preferred_simd_mode | expand

Commit Message

Levy Hsu Sept. 4, 2024, 1:31 a.m. UTC
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(+)

Comments

Hongtao Liu Sept. 5, 2024, 1:36 a.m. UTC | #1
On Wed, Sep 4, 2024 at 9:32 AM Levy Hsu <admin@levyhsu.com> wrote:
>
> 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?
Ok.
>
> 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;
> --
> 2.31.1
>
diff mbox series

Patch

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;