RE: [PATCH] i386: Add AVX10.1 related macros

2024-01-10 Thread Liu, Hongtao



> -Original Message-
> From: Jiang, Haochen 
> Sent: Wednesday, January 10, 2024 3:35 PM
> To: gcc-patches@gcc.gnu.org
> Cc: Liu, Hongtao ; ubiz...@gmail.com; burnus@net-
> b.de; san...@codesourcery.com
> Subject: [PATCH] i386: Add AVX10.1 related macros
> 
> Hi all,
> 
> This patch aims to add AVX10.1 related macros for libgomp's request. The
> request comes following:
> 
> https://gcc.gnu.org/pipermail/gcc-patches/2024-January/642025.html
> 
> Ok for trunk?
> 
> Thx,
> Haochen
> 
> gcc/ChangeLog:
> 
>   PR target/113288
>   * config/i386/i386-c.cc (ix86_target_macros_internal):
>   Add __AVX10_1__, __AVX10_1_256__ and __AVX10_1_512__.
> ---
>  gcc/config/i386/i386-c.cc | 7 +++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/gcc/config/i386/i386-c.cc b/gcc/config/i386/i386-c.cc index
> c3ae984670b..366b560158a 100644
> --- a/gcc/config/i386/i386-c.cc
> +++ b/gcc/config/i386/i386-c.cc
> @@ -735,6 +735,13 @@ ix86_target_macros_internal (HOST_WIDE_INT
> isa_flag,
>  def_or_undef (parse_in, "__EVEX512__");
>if (isa_flag2 & OPTION_MASK_ISA2_USER_MSR)
>  def_or_undef (parse_in, "__USER_MSR__");
> +  if (isa_flag2 & OPTION_MASK_ISA2_AVX10_1_256)
> +{
> +  def_or_undef (parse_in, "__AVX10_1_256__");
> +  def_or_undef (parse_in, "__AVX10_1__");
I think this is not needed, others LGTM.
> +}
> +  if (isa_flag2 & OPTION_MASK_ISA2_AVX10_1_512)
> +def_or_undef (parse_in, "__AVX10_1_512__");
>if (TARGET_IAMCU)
>  {
>def_or_undef (parse_in, "__iamcu");
> --
> 2.31.1



Re: [PATCH] i386: Add AVX10.1 related macros

2024-01-10 Thread Richard Biener
On Wed, Jan 10, 2024 at 9:01 AM Liu, Hongtao  wrote:
>
>
>
> > -Original Message-
> > From: Jiang, Haochen 
> > Sent: Wednesday, January 10, 2024 3:35 PM
> > To: gcc-patches@gcc.gnu.org
> > Cc: Liu, Hongtao ; ubiz...@gmail.com; burnus@net-
> > b.de; san...@codesourcery.com
> > Subject: [PATCH] i386: Add AVX10.1 related macros
> >
> > Hi all,
> >
> > This patch aims to add AVX10.1 related macros for libgomp's request. The
> > request comes following:
> >
> > https://gcc.gnu.org/pipermail/gcc-patches/2024-January/642025.html
> >
> > Ok for trunk?
> >
> > Thx,
> > Haochen
> >
> > gcc/ChangeLog:
> >
> >   PR target/113288
> >   * config/i386/i386-c.cc (ix86_target_macros_internal):
> >   Add __AVX10_1__, __AVX10_1_256__ and __AVX10_1_512__.
> > ---
> >  gcc/config/i386/i386-c.cc | 7 +++
> >  1 file changed, 7 insertions(+)
> >
> > diff --git a/gcc/config/i386/i386-c.cc b/gcc/config/i386/i386-c.cc index
> > c3ae984670b..366b560158a 100644
> > --- a/gcc/config/i386/i386-c.cc
> > +++ b/gcc/config/i386/i386-c.cc
> > @@ -735,6 +735,13 @@ ix86_target_macros_internal (HOST_WIDE_INT
> > isa_flag,
> >  def_or_undef (parse_in, "__EVEX512__");
> >if (isa_flag2 & OPTION_MASK_ISA2_USER_MSR)
> >  def_or_undef (parse_in, "__USER_MSR__");
> > +  if (isa_flag2 & OPTION_MASK_ISA2_AVX10_1_256)
> > +{
> > +  def_or_undef (parse_in, "__AVX10_1_256__");
> > +  def_or_undef (parse_in, "__AVX10_1__");
> I think this is not needed, others LGTM.

So __AVX10_1_256__ and __AVX10_1_512__ are redundant
with __AVX10_1__ and __EVEX512__, right?

> > +}
> > +  if (isa_flag2 & OPTION_MASK_ISA2_AVX10_1_512)
> > +def_or_undef (parse_in, "__AVX10_1_512__");
> >if (TARGET_IAMCU)
> >  {
> >def_or_undef (parse_in, "__iamcu");
> > --
> > 2.31.1
>


RE: [PATCH] i386: Add AVX10.1 related macros

2024-01-10 Thread Liu, Hongtao


> -Original Message-
> From: Richard Biener 
> Sent: Wednesday, January 10, 2024 5:44 PM
> To: Liu, Hongtao 
> Cc: Jiang, Haochen ; gcc-patches@gcc.gnu.org;
> ubiz...@gmail.com; bur...@net-b.de; san...@codesourcery.com
> Subject: Re: [PATCH] i386: Add AVX10.1 related macros
> 
> On Wed, Jan 10, 2024 at 9:01 AM Liu, Hongtao 
> wrote:
> >
> >
> >
> > > -Original Message-
> > > From: Jiang, Haochen 
> > > Sent: Wednesday, January 10, 2024 3:35 PM
> > > To: gcc-patches@gcc.gnu.org
> > > Cc: Liu, Hongtao ; ubiz...@gmail.com;
> > > burnus@net- b.de; san...@codesourcery.com
> > > Subject: [PATCH] i386: Add AVX10.1 related macros
> > >
> > > Hi all,
> > >
> > > This patch aims to add AVX10.1 related macros for libgomp's request.
> > > The request comes following:
> > >
> > > https://gcc.gnu.org/pipermail/gcc-patches/2024-January/642025.html
> > >
> > > Ok for trunk?
> > >
> > > Thx,
> > > Haochen
> > >
> > > gcc/ChangeLog:
> > >
> > >   PR target/113288
> > >   * config/i386/i386-c.cc (ix86_target_macros_internal):
> > >   Add __AVX10_1__, __AVX10_1_256__ and __AVX10_1_512__.
> > > ---
> > >  gcc/config/i386/i386-c.cc | 7 +++
> > >  1 file changed, 7 insertions(+)
> > >
> > > diff --git a/gcc/config/i386/i386-c.cc b/gcc/config/i386/i386-c.cc
> > > index c3ae984670b..366b560158a 100644
> > > --- a/gcc/config/i386/i386-c.cc
> > > +++ b/gcc/config/i386/i386-c.cc
> > > @@ -735,6 +735,13 @@ ix86_target_macros_internal (HOST_WIDE_INT
> > > isa_flag,
> > >  def_or_undef (parse_in, "__EVEX512__");
> > >if (isa_flag2 & OPTION_MASK_ISA2_USER_MSR)
> > >  def_or_undef (parse_in, "__USER_MSR__");
> > > +  if (isa_flag2 & OPTION_MASK_ISA2_AVX10_1_256)
> > > +{
> > > +  def_or_undef (parse_in, "__AVX10_1_256__");
> > > +  def_or_undef (parse_in, "__AVX10_1__");
> > I think this is not needed, others LGTM.
> 
> So __AVX10_1_256__ and __AVX10_1_512__ are redundant with
> __AVX10_1__ and __EVEX512__, right?
No, I mean __AVX10_1__ is redundant of __AVX10_1_256__ since -mavx10.1 is just 
alias of -mavx10.1-256.
We want explicit __AVX10_1_256__ and __AVX10_1_512__ and don't want mix 
__EVEX512__ with AVX10(They are related in their internal implementation, but 
we don't want the user to control the vector length of avx10 with -mno-evex512, 
-mno-evex512 is supposed for the existing AVX512).
> 
> > > +}
> > > +  if (isa_flag2 & OPTION_MASK_ISA2_AVX10_1_512)
> > > +def_or_undef (parse_in, "__AVX10_1_512__");
> > >if (TARGET_IAMCU)
> > >  {
> > >def_or_undef (parse_in, "__iamcu");
> > > --
> > > 2.31.1
> >


Re: [PATCH] i386: Add AVX10.1 related macros

2024-01-11 Thread Richard Biener
On Thu, Jan 11, 2024 at 2:16 AM Liu, Hongtao  wrote:
>
>
>
> > -Original Message-
> > From: Richard Biener 
> > Sent: Wednesday, January 10, 2024 5:44 PM
> > To: Liu, Hongtao 
> > Cc: Jiang, Haochen ; gcc-patches@gcc.gnu.org;
> > ubiz...@gmail.com; bur...@net-b.de; san...@codesourcery.com
> > Subject: Re: [PATCH] i386: Add AVX10.1 related macros
> >
> > On Wed, Jan 10, 2024 at 9:01 AM Liu, Hongtao 
> > wrote:
> > >
> > >
> > >
> > > > -Original Message-
> > > > From: Jiang, Haochen 
> > > > Sent: Wednesday, January 10, 2024 3:35 PM
> > > > To: gcc-patches@gcc.gnu.org
> > > > Cc: Liu, Hongtao ; ubiz...@gmail.com;
> > > > burnus@net- b.de; san...@codesourcery.com
> > > > Subject: [PATCH] i386: Add AVX10.1 related macros
> > > >
> > > > Hi all,
> > > >
> > > > This patch aims to add AVX10.1 related macros for libgomp's request.
> > > > The request comes following:
> > > >
> > > > https://gcc.gnu.org/pipermail/gcc-patches/2024-January/642025.html
> > > >
> > > > Ok for trunk?
> > > >
> > > > Thx,
> > > > Haochen
> > > >
> > > > gcc/ChangeLog:
> > > >
> > > >   PR target/113288
> > > >   * config/i386/i386-c.cc (ix86_target_macros_internal):
> > > >   Add __AVX10_1__, __AVX10_1_256__ and __AVX10_1_512__.
> > > > ---
> > > >  gcc/config/i386/i386-c.cc | 7 +++
> > > >  1 file changed, 7 insertions(+)
> > > >
> > > > diff --git a/gcc/config/i386/i386-c.cc b/gcc/config/i386/i386-c.cc
> > > > index c3ae984670b..366b560158a 100644
> > > > --- a/gcc/config/i386/i386-c.cc
> > > > +++ b/gcc/config/i386/i386-c.cc
> > > > @@ -735,6 +735,13 @@ ix86_target_macros_internal (HOST_WIDE_INT
> > > > isa_flag,
> > > >  def_or_undef (parse_in, "__EVEX512__");
> > > >if (isa_flag2 & OPTION_MASK_ISA2_USER_MSR)
> > > >  def_or_undef (parse_in, "__USER_MSR__");
> > > > +  if (isa_flag2 & OPTION_MASK_ISA2_AVX10_1_256)
> > > > +{
> > > > +  def_or_undef (parse_in, "__AVX10_1_256__");
> > > > +  def_or_undef (parse_in, "__AVX10_1__");
> > > I think this is not needed, others LGTM.
> >
> > So __AVX10_1_256__ and __AVX10_1_512__ are redundant with
> > __AVX10_1__ and __EVEX512__, right?
> No, I mean __AVX10_1__ is redundant of __AVX10_1_256__ since -mavx10.1 is 
> just alias of -mavx10.1-256.
> We want explicit __AVX10_1_256__ and __AVX10_1_512__ and don't want mix 
> __EVEX512__ with AVX10(They are related in their internal implementation, but 
> we don't want the user to control the vector length of avx10 with 
> -mno-evex512, -mno-evex512 is supposed for the existing AVX512).

Ah, that makes sense.

> > > > +}
> > > > +  if (isa_flag2 & OPTION_MASK_ISA2_AVX10_1_512)
> > > > +def_or_undef (parse_in, "__AVX10_1_512__");
> > > >if (TARGET_IAMCU)
> > > >  {
> > > >def_or_undef (parse_in, "__iamcu");
> > > > --
> > > > 2.31.1
> > >


RE: [PATCH] i386: Add AVX10.1 related macros

2024-01-11 Thread Jiang, Haochen
> -Original Message-
> From: Richard Biener 
> Sent: Thursday, January 11, 2024 4:19 PM
> To: Liu, Hongtao 
> Cc: Jiang, Haochen ; gcc-patches@gcc.gnu.org;
> ubiz...@gmail.com; bur...@net-b.de; san...@codesourcery.com
> Subject: Re: [PATCH] i386: Add AVX10.1 related macros
> 
> On Thu, Jan 11, 2024 at 2:16 AM Liu, Hongtao 
> wrote:
> >
> >
> >
> > > -Original Message-
> > > From: Richard Biener 
> > > Sent: Wednesday, January 10, 2024 5:44 PM
> > > To: Liu, Hongtao 
> > > Cc: Jiang, Haochen ;
> > > gcc-patches@gcc.gnu.org; ubiz...@gmail.com; bur...@net-b.de;
> > > san...@codesourcery.com
> > > Subject: Re: [PATCH] i386: Add AVX10.1 related macros
> > >
> > > On Wed, Jan 10, 2024 at 9:01 AM Liu, Hongtao 
> > > wrote:
> > > >
> > > >
> > > >
> > > > > -Original Message-
> > > > > From: Jiang, Haochen 
> > > > > Sent: Wednesday, January 10, 2024 3:35 PM
> > > > > To: gcc-patches@gcc.gnu.org
> > > > > Cc: Liu, Hongtao ; ubiz...@gmail.com;
> > > > > burnus@net- b.de; san...@codesourcery.com
> > > > > Subject: [PATCH] i386: Add AVX10.1 related macros
> > > > >
> > > > > Hi all,
> > > > >
> > > > > This patch aims to add AVX10.1 related macros for libgomp's request.
> > > > > The request comes following:
> > > > >
> > > > > https://gcc.gnu.org/pipermail/gcc-patches/2024-January/642025.ht
> > > > > ml
> > > > >
> > > > > Ok for trunk?
> > > > >
> > > > > Thx,
> > > > > Haochen
> > > > >
> > > > > gcc/ChangeLog:
> > > > >
> > > > >   PR target/113288
> > > > >   * config/i386/i386-c.cc (ix86_target_macros_internal):
> > > > >   Add __AVX10_1__, __AVX10_1_256__ and __AVX10_1_512__.
> > > > > ---
> > > > >  gcc/config/i386/i386-c.cc | 7 +++
> > > > >  1 file changed, 7 insertions(+)
> > > > >
> > > > > diff --git a/gcc/config/i386/i386-c.cc
> > > > > b/gcc/config/i386/i386-c.cc index c3ae984670b..366b560158a
> > > > > 100644
> > > > > --- a/gcc/config/i386/i386-c.cc
> > > > > +++ b/gcc/config/i386/i386-c.cc
> > > > > @@ -735,6 +735,13 @@ ix86_target_macros_internal
> (HOST_WIDE_INT
> > > > > isa_flag,
> > > > >  def_or_undef (parse_in, "__EVEX512__");
> > > > >if (isa_flag2 & OPTION_MASK_ISA2_USER_MSR)
> > > > >  def_or_undef (parse_in, "__USER_MSR__");
> > > > > +  if (isa_flag2 & OPTION_MASK_ISA2_AVX10_1_256)
> > > > > +{
> > > > > +  def_or_undef (parse_in, "__AVX10_1_256__");
> > > > > +  def_or_undef (parse_in, "__AVX10_1__");
> > > > I think this is not needed, others LGTM.
> > >
> > > So __AVX10_1_256__ and __AVX10_1_512__ are redundant with
> > > __AVX10_1__ and __EVEX512__, right?
> > No, I mean __AVX10_1__ is redundant of __AVX10_1_256__ since -
> mavx10.1 is just alias of -mavx10.1-256.
> > We want explicit __AVX10_1_256__ and __AVX10_1_512__ and don't want
> mix __EVEX512__ with AVX10(They are related in their internal
> implementation, but we don't want the user to control the vector length of
> avx10 with -mno-evex512, -mno-evex512 is supposed for the existing
> AVX512).

Let's keep both of them if we prefer __AVX10_1_256__ since I just found
that LLVM got macro __AVX10_1__.

https://github.com/llvm/llvm-project/pull/67278/files#diff-7435d50346a810555df89deb1f879b767ee985ace43fb3990de17fb23a47f004

in file clang/lib/Basic/Targets/X86.cpp L774-777.

Thx,
Haochen

> 
> Ah, that makes sense.
> 
> > > > > +}
> > > > > +  if (isa_flag2 & OPTION_MASK_ISA2_AVX10_1_512)
> > > > > +def_or_undef (parse_in, "__AVX10_1_512__");
> > > > >if (TARGET_IAMCU)
> > > > >  {
> > > > >def_or_undef (parse_in, "__iamcu");
> > > > > --
> > > > > 2.31.1
> > > >


Re: [PATCH] i386: Add AVX10.1 related macros

2024-01-11 Thread Hongtao Liu
On Fri, Jan 12, 2024 at 10:55 AM Jiang, Haochen  wrote:
>
> > -Original Message-
> > From: Richard Biener 
> > Sent: Thursday, January 11, 2024 4:19 PM
> > To: Liu, Hongtao 
> > Cc: Jiang, Haochen ; gcc-patches@gcc.gnu.org;
> > ubiz...@gmail.com; bur...@net-b.de; san...@codesourcery.com
> > Subject: Re: [PATCH] i386: Add AVX10.1 related macros
> >
> > On Thu, Jan 11, 2024 at 2:16 AM Liu, Hongtao 
> > wrote:
> > >
> > >
> > >
> > > > -Original Message-
> > > > From: Richard Biener 
> > > > Sent: Wednesday, January 10, 2024 5:44 PM
> > > > To: Liu, Hongtao 
> > > > Cc: Jiang, Haochen ;
> > > > gcc-patches@gcc.gnu.org; ubiz...@gmail.com; bur...@net-b.de;
> > > > san...@codesourcery.com
> > > > Subject: Re: [PATCH] i386: Add AVX10.1 related macros
> > > >
> > > > On Wed, Jan 10, 2024 at 9:01 AM Liu, Hongtao 
> > > > wrote:
> > > > >
> > > > >
> > > > >
> > > > > > -Original Message-
> > > > > > From: Jiang, Haochen 
> > > > > > Sent: Wednesday, January 10, 2024 3:35 PM
> > > > > > To: gcc-patches@gcc.gnu.org
> > > > > > Cc: Liu, Hongtao ; ubiz...@gmail.com;
> > > > > > burnus@net- b.de; san...@codesourcery.com
> > > > > > Subject: [PATCH] i386: Add AVX10.1 related macros
> > > > > >
> > > > > > Hi all,
> > > > > >
> > > > > > This patch aims to add AVX10.1 related macros for libgomp's request.
> > > > > > The request comes following:
> > > > > >
> > > > > > https://gcc.gnu.org/pipermail/gcc-patches/2024-January/642025.ht
> > > > > > ml
> > > > > >
> > > > > > Ok for trunk?
> > > > > >
> > > > > > Thx,
> > > > > > Haochen
> > > > > >
> > > > > > gcc/ChangeLog:
> > > > > >
> > > > > >   PR target/113288
> > > > > >   * config/i386/i386-c.cc (ix86_target_macros_internal):
> > > > > >   Add __AVX10_1__, __AVX10_1_256__ and __AVX10_1_512__.
> > > > > > ---
> > > > > >  gcc/config/i386/i386-c.cc | 7 +++
> > > > > >  1 file changed, 7 insertions(+)
> > > > > >
> > > > > > diff --git a/gcc/config/i386/i386-c.cc
> > > > > > b/gcc/config/i386/i386-c.cc index c3ae984670b..366b560158a
> > > > > > 100644
> > > > > > --- a/gcc/config/i386/i386-c.cc
> > > > > > +++ b/gcc/config/i386/i386-c.cc
> > > > > > @@ -735,6 +735,13 @@ ix86_target_macros_internal
> > (HOST_WIDE_INT
> > > > > > isa_flag,
> > > > > >  def_or_undef (parse_in, "__EVEX512__");
> > > > > >if (isa_flag2 & OPTION_MASK_ISA2_USER_MSR)
> > > > > >  def_or_undef (parse_in, "__USER_MSR__");
> > > > > > +  if (isa_flag2 & OPTION_MASK_ISA2_AVX10_1_256)
> > > > > > +{
> > > > > > +  def_or_undef (parse_in, "__AVX10_1_256__");
> > > > > > +  def_or_undef (parse_in, "__AVX10_1__");
> > > > > I think this is not needed, others LGTM.
> > > >
> > > > So __AVX10_1_256__ and __AVX10_1_512__ are redundant with
> > > > __AVX10_1__ and __EVEX512__, right?
> > > No, I mean __AVX10_1__ is redundant of __AVX10_1_256__ since -
> > mavx10.1 is just alias of -mavx10.1-256.
> > > We want explicit __AVX10_1_256__ and __AVX10_1_512__ and don't want
> > mix __EVEX512__ with AVX10(They are related in their internal
> > implementation, but we don't want the user to control the vector length of
> > avx10 with -mno-evex512, -mno-evex512 is supposed for the existing
> > AVX512).
>
> Let's keep both of them if we prefer __AVX10_1_256__ since I just found
> that LLVM got macro __AVX10_1__.
>
> https://github.com/llvm/llvm-project/pull/67278/files#diff-7435d50346a810555df89deb1f879b767ee985ace43fb3990de17fb23a47f004
>
> in file clang/lib/Basic/Targets/X86.cpp L774-777.
Ok.
>
> Thx,
> Haochen
>
> >
> > Ah, that makes sense.
> >
> > > > > > +}
> > > > > > +  if (isa_flag2 & OPTION_MASK_ISA2_AVX10_1_512)
> > > > > > +def_or_undef (parse_in, "__AVX10_1_512__");
> > > > > >if (TARGET_IAMCU)
> > > > > >  {
> > > > > >def_or_undef (parse_in, "__iamcu");
> > > > > > --
> > > > > > 2.31.1
> > > > >



-- 
BR,
Hongtao