i386: Add AVX10.1 related macros

Message ID 20240110073455.1656619-1-haochen.jiang@intel.com
State Committed
Commit 4ab847b354ee9e13e6052f78f49f575eae3abf3f
Headers
Series i386: Add AVX10.1 related macros |

Checks

Context Check Description
linaro-tcwg-bot/tcwg_gcc_build--master-arm success Testing passed
linaro-tcwg-bot/tcwg_gcc_build--master-aarch64 success Testing passed
linaro-tcwg-bot/tcwg_gcc_check--master-arm success Testing passed
linaro-tcwg-bot/tcwg_gcc_check--master-aarch64 success Testing passed

Commit Message

Jiang, Haochen Jan. 10, 2024, 7:34 a.m. UTC
  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(+)
  

Comments

liuhongt Jan. 10, 2024, 7:58 a.m. UTC | #1
> -----Original Message-----
> From: Jiang, Haochen <haochen.jiang@intel.com>
> Sent: Wednesday, January 10, 2024 3:35 PM
> To: gcc-patches@gcc.gnu.org
> Cc: Liu, Hongtao <hongtao.liu@intel.com>; ubizjak@gmail.com; burnus@net-
> b.de; sandra@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
  
Richard Biener Jan. 10, 2024, 9:43 a.m. UTC | #2
On Wed, Jan 10, 2024 at 9:01 AM Liu, Hongtao <hongtao.liu@intel.com> wrote:
>
>
>
> > -----Original Message-----
> > From: Jiang, Haochen <haochen.jiang@intel.com>
> > Sent: Wednesday, January 10, 2024 3:35 PM
> > To: gcc-patches@gcc.gnu.org
> > Cc: Liu, Hongtao <hongtao.liu@intel.com>; ubizjak@gmail.com; burnus@net-
> > b.de; sandra@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
>
  
liuhongt Jan. 11, 2024, 1:16 a.m. UTC | #3
> -----Original Message-----
> From: Richard Biener <richard.guenther@gmail.com>
> Sent: Wednesday, January 10, 2024 5:44 PM
> To: Liu, Hongtao <hongtao.liu@intel.com>
> Cc: Jiang, Haochen <haochen.jiang@intel.com>; gcc-patches@gcc.gnu.org;
> ubizjak@gmail.com; burnus@net-b.de; sandra@codesourcery.com
> Subject: Re: [PATCH] i386: Add AVX10.1 related macros
> 
> On Wed, Jan 10, 2024 at 9:01 AM Liu, Hongtao <hongtao.liu@intel.com>
> wrote:
> >
> >
> >
> > > -----Original Message-----
> > > From: Jiang, Haochen <haochen.jiang@intel.com>
> > > Sent: Wednesday, January 10, 2024 3:35 PM
> > > To: gcc-patches@gcc.gnu.org
> > > Cc: Liu, Hongtao <hongtao.liu@intel.com>; ubizjak@gmail.com;
> > > burnus@net- b.de; sandra@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
> >
  
Richard Biener Jan. 11, 2024, 8:18 a.m. UTC | #4
On Thu, Jan 11, 2024 at 2:16 AM Liu, Hongtao <hongtao.liu@intel.com> wrote:
>
>
>
> > -----Original Message-----
> > From: Richard Biener <richard.guenther@gmail.com>
> > Sent: Wednesday, January 10, 2024 5:44 PM
> > To: Liu, Hongtao <hongtao.liu@intel.com>
> > Cc: Jiang, Haochen <haochen.jiang@intel.com>; gcc-patches@gcc.gnu.org;
> > ubizjak@gmail.com; burnus@net-b.de; sandra@codesourcery.com
> > Subject: Re: [PATCH] i386: Add AVX10.1 related macros
> >
> > On Wed, Jan 10, 2024 at 9:01 AM Liu, Hongtao <hongtao.liu@intel.com>
> > wrote:
> > >
> > >
> > >
> > > > -----Original Message-----
> > > > From: Jiang, Haochen <haochen.jiang@intel.com>
> > > > Sent: Wednesday, January 10, 2024 3:35 PM
> > > > To: gcc-patches@gcc.gnu.org
> > > > Cc: Liu, Hongtao <hongtao.liu@intel.com>; ubizjak@gmail.com;
> > > > burnus@net- b.de; sandra@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
> > >
  
Jiang, Haochen Jan. 12, 2024, 2:54 a.m. UTC | #5
> -----Original Message-----
> From: Richard Biener <richard.guenther@gmail.com>
> Sent: Thursday, January 11, 2024 4:19 PM
> To: Liu, Hongtao <hongtao.liu@intel.com>
> Cc: Jiang, Haochen <haochen.jiang@intel.com>; gcc-patches@gcc.gnu.org;
> ubizjak@gmail.com; burnus@net-b.de; sandra@codesourcery.com
> Subject: Re: [PATCH] i386: Add AVX10.1 related macros
> 
> On Thu, Jan 11, 2024 at 2:16 AM Liu, Hongtao <hongtao.liu@intel.com>
> wrote:
> >
> >
> >
> > > -----Original Message-----
> > > From: Richard Biener <richard.guenther@gmail.com>
> > > Sent: Wednesday, January 10, 2024 5:44 PM
> > > To: Liu, Hongtao <hongtao.liu@intel.com>
> > > Cc: Jiang, Haochen <haochen.jiang@intel.com>;
> > > gcc-patches@gcc.gnu.org; ubizjak@gmail.com; burnus@net-b.de;
> > > sandra@codesourcery.com
> > > Subject: Re: [PATCH] i386: Add AVX10.1 related macros
> > >
> > > On Wed, Jan 10, 2024 at 9:01 AM Liu, Hongtao <hongtao.liu@intel.com>
> > > wrote:
> > > >
> > > >
> > > >
> > > > > -----Original Message-----
> > > > > From: Jiang, Haochen <haochen.jiang@intel.com>
> > > > > Sent: Wednesday, January 10, 2024 3:35 PM
> > > > > To: gcc-patches@gcc.gnu.org
> > > > > Cc: Liu, Hongtao <hongtao.liu@intel.com>; ubizjak@gmail.com;
> > > > > burnus@net- b.de; sandra@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
> > > >
  
Hongtao Liu Jan. 12, 2024, 3:28 a.m. UTC | #6
On Fri, Jan 12, 2024 at 10:55 AM Jiang, Haochen <haochen.jiang@intel.com> wrote:
>
> > -----Original Message-----
> > From: Richard Biener <richard.guenther@gmail.com>
> > Sent: Thursday, January 11, 2024 4:19 PM
> > To: Liu, Hongtao <hongtao.liu@intel.com>
> > Cc: Jiang, Haochen <haochen.jiang@intel.com>; gcc-patches@gcc.gnu.org;
> > ubizjak@gmail.com; burnus@net-b.de; sandra@codesourcery.com
> > Subject: Re: [PATCH] i386: Add AVX10.1 related macros
> >
> > On Thu, Jan 11, 2024 at 2:16 AM Liu, Hongtao <hongtao.liu@intel.com>
> > wrote:
> > >
> > >
> > >
> > > > -----Original Message-----
> > > > From: Richard Biener <richard.guenther@gmail.com>
> > > > Sent: Wednesday, January 10, 2024 5:44 PM
> > > > To: Liu, Hongtao <hongtao.liu@intel.com>
> > > > Cc: Jiang, Haochen <haochen.jiang@intel.com>;
> > > > gcc-patches@gcc.gnu.org; ubizjak@gmail.com; burnus@net-b.de;
> > > > sandra@codesourcery.com
> > > > Subject: Re: [PATCH] i386: Add AVX10.1 related macros
> > > >
> > > > On Wed, Jan 10, 2024 at 9:01 AM Liu, Hongtao <hongtao.liu@intel.com>
> > > > wrote:
> > > > >
> > > > >
> > > > >
> > > > > > -----Original Message-----
> > > > > > From: Jiang, Haochen <haochen.jiang@intel.com>
> > > > > > Sent: Wednesday, January 10, 2024 3:35 PM
> > > > > > To: gcc-patches@gcc.gnu.org
> > > > > > Cc: Liu, Hongtao <hongtao.liu@intel.com>; ubizjak@gmail.com;
> > > > > > burnus@net- b.de; sandra@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
> > > > >
  

Patch

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__");
+    }
+  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");