[x86] define builtins for "shared" avxneconvert-avx512bf16vl builtins.

Message ID 20221118014522.1989180-1-hongtao.liu@intel.com
State Committed
Commit 183db4fb73a64bc4641604c30cdbbd9d9e8a6ed6
Headers
Series [x86] define builtins for "shared" avxneconvert-avx512bf16vl builtins. |

Commit Message

Liu, Hongtao Nov. 18, 2022, 1:45 a.m. UTC
  This should fix incorrect error when call those builtin with
-mavxneconvert and w/o -mavx512bf16 -mavx512vl.

Bootstrapped and regtested on x86_64-pc-linux-gnu{-m32,}
Ready to push to trunk.

gcc/ChangeLog:

	* config/i386/i386-builtins.cc (def_builtin): Hanlde "shared"
	avx512bf16vl-avxneconvert builtins.

gcc/testsuite/ChangeLog:

	* gcc.target/i386/avxneconvert-1.c: New test.
---
 gcc/config/i386/i386-builtins.cc               |  2 ++
 gcc/testsuite/gcc.target/i386/avxneconvert-1.c | 11 +++++++++++
 2 files changed, 13 insertions(+)
 create mode 100644 gcc/testsuite/gcc.target/i386/avxneconvert-1.c
  

Comments

Jakub Jelinek Nov. 18, 2022, 7:49 a.m. UTC | #1
On Fri, Nov 18, 2022 at 09:45:22AM +0800, liuhongt via Gcc-patches wrote:
> This should fix incorrect error when call those builtin with
> -mavxneconvert and w/o -mavx512bf16 -mavx512vl.
> 
> Bootstrapped and regtested on x86_64-pc-linux-gnu{-m32,}
> Ready to push to trunk.
> 
> gcc/ChangeLog:
> 
> 	* config/i386/i386-builtins.cc (def_builtin): Hanlde "shared"

Just a nit: s/Hanlde/Handle/

> 	avx512bf16vl-avxneconvert builtins.
> 
> gcc/testsuite/ChangeLog:
> 
> 	* gcc.target/i386/avxneconvert-1.c: New test.

	Jakub
  
Hongtao Liu Nov. 18, 2022, 7:53 a.m. UTC | #2
On Fri, Nov 18, 2022 at 3:50 PM Jakub Jelinek <jakub@redhat.com> wrote:
>
> On Fri, Nov 18, 2022 at 09:45:22AM +0800, liuhongt via Gcc-patches wrote:
> > This should fix incorrect error when call those builtin with
> > -mavxneconvert and w/o -mavx512bf16 -mavx512vl.
> >
> > Bootstrapped and regtested on x86_64-pc-linux-gnu{-m32,}
> > Ready to push to trunk.
> >
> > gcc/ChangeLog:
> >
> >       * config/i386/i386-builtins.cc (def_builtin): Hanlde "shared"
>
> Just a nit: s/Hanlde/Handle/
Thanks.
>
> >       avx512bf16vl-avxneconvert builtins.
> >
> > gcc/testsuite/ChangeLog:
> >
> >       * gcc.target/i386/avxneconvert-1.c: New test.
>
>         Jakub
>
  

Patch

diff --git a/gcc/config/i386/i386-builtins.cc b/gcc/config/i386/i386-builtins.cc
index 9412cf1acc8..eacdf072244 100644
--- a/gcc/config/i386/i386-builtins.cc
+++ b/gcc/config/i386/i386-builtins.cc
@@ -285,6 +285,8 @@  def_builtin (HOST_WIDE_INT mask, HOST_WIDE_INT mask2,
 	     avx512vl exist.  */
 	  || (mask2 == OPTION_MASK_ISA2_AVXVNNI)
 	  || (mask2 == OPTION_MASK_ISA2_AVXIFMA)
+	  || (mask2 == (OPTION_MASK_ISA2_AVXNECONVERT
+			| OPTION_MASK_ISA2_AVX512BF16))
 	  || (lang_hooks.builtin_function
 	      == lang_hooks.builtin_function_ext_scope))
 	{
diff --git a/gcc/testsuite/gcc.target/i386/avxneconvert-1.c b/gcc/testsuite/gcc.target/i386/avxneconvert-1.c
new file mode 100644
index 00000000000..2bb129c3f72
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/avxneconvert-1.c
@@ -0,0 +1,11 @@ 
+/* { dg-do compile } */
+/* { dg-options "-mavxneconvert -O2" } */
+
+typedef float v8sf __attribute__((vector_size(32)));
+typedef __bf16 v8bf __attribute__((vector_size(16)));
+
+v8bf
+foo (v8sf a)
+{
+  return __builtin_ia32_cvtneps2bf16_v8sf (a);
+}