]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
i386: Add -mavx10.1 back with 512 bit alias
authorHaochen Jiang <haochen.jiang@intel.com>
Mon, 24 Mar 2025 07:51:16 +0000 (15:51 +0800)
committerHaochen Jiang <haochen.jiang@intel.com>
Mon, 24 Mar 2025 08:01:59 +0000 (16:01 +0800)
When AVX10.1 options are added into GCC 14, E-core is supposed to
support up to 256 bit vector width, while P-core up to 512 bit vector
width. Therefore, we added avx10.1-256 and avx10.1-512 options into
compiler and alias avx10.1 to 256 bit for compatibility since there
will be real platforms with 256 bit only support.

However, all the future platforms will now support 512 bit vector width,
including P-core and E-core. Therefore, we could alias avx10.1 directly
to 512 bit. However, avx10.1 alias to 256 bit has been there in GCC 14.1
and GCC 14.2, so we have to raise a warning since GCC 14.3 for this
behavior change.

While backporting the patch from GCC 15, we choose to only warn when
users use -mavx10.1 option in order not to interrupt the usage of other
options since -mavx10.1-256/512 and -mevex512 will be dropped in GCC 16.
There is no need to warn them this early in GCC 14 to overwhelm users.

gcc/ChangeLog:

* common/config/i386/i386-isas.h: Add avx10.1.
* config/i386/i386-c.cc (ix86_target_macros_internal): Ditto.
* config/i386/i386-options.cc
(ix86_valid_target_attribute_inner_p): Ditto.
* config/i386/i386.opt: Ditto.
* config/i386/i386.opt.urls: Ditto.
* doc/extend.texi: Ditto.
* doc/sourcebuild.texi: Ditto.

gcc/common/config/i386/i386-isas.h
gcc/config/i386/i386-c.cc
gcc/config/i386/i386-options.cc
gcc/config/i386/i386.opt
gcc/config/i386/i386.opt.urls
gcc/doc/extend.texi
gcc/doc/sourcebuild.texi

index 017c795e211dcc08569cfa37647e3a5a989c6c23..cdbc188620ad5fab60d708d11b306cedef908847 100644 (file)
@@ -195,4 +195,5 @@ ISA_NAMES_TABLE_START
   ISA_NAMES_TABLE_ENTRY("usermsr", FEATURE_USER_MSR, P_NONE, "-musermsr")
   ISA_NAMES_TABLE_ENTRY("avx10.1-256", FEATURE_AVX10_1_256, P_AVX10_1_256, "-mavx10.1-256")
   ISA_NAMES_TABLE_ENTRY("avx10.1-512", FEATURE_AVX10_1_512, P_AVX10_1_512, "-mavx10.1-512")
+  ISA_NAMES_TABLE_ENTRY("avx10.1", FEATURE_AVX10_1_512, P_AVX10_1_512, "-mavx10.1")
 ISA_NAMES_TABLE_END
index 07f4936ba9101b84ba0737178e6a48ddcbab532d..0103b8543a1580adf0e6518b51ed708d82b298e9 100644 (file)
@@ -743,10 +743,7 @@ ix86_target_macros_internal (HOST_WIDE_INT isa_flag,
   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__");
-    }
+    def_or_undef (parse_in, "__AVX10_1_256__");
   if (isa_flag2 & OPTION_MASK_ISA2_AVX10_1_512)
     def_or_undef (parse_in, "__AVX10_1_512__");
   if (isa_flag2 & OPTION_MASK_ISA2_APX_F)
index 11c6ddf0f4404ae76746e32e0c1015b34aef4dd7..57c83a9aa1c7298358cb8f9ccbd1a89b71c984cc 100644 (file)
@@ -1137,6 +1137,7 @@ ix86_valid_target_attribute_inner_p (tree fndecl, tree args, char *p_strings[],
     IX86_ATTR_ISA ("usermsr", OPT_musermsr),
     IX86_ATTR_ISA ("avx10.1-256", OPT_mavx10_1_256),
     IX86_ATTR_ISA ("avx10.1-512", OPT_mavx10_1_512),
+    IX86_ATTR_ISA ("avx10.1", OPT_mavx10_1_512),
 
     /* enum options */
     IX86_ATTR_ENUM ("fpmath=", OPT_mfpmath_),
index f99c4e3ae5d939d3f57734fed1f2e789e5500cb7..df95963dd9f059013a6fa8ec2be16f6203e21a12 100644 (file)
@@ -1380,3 +1380,8 @@ mavx10.1-512
 Target Mask(ISA2_AVX10_1_512) Var(ix86_isa_flags2) Save
 Support MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, AVX, AVX2,
 and AVX10.1-512 built-in functions and code generation.
+
+mavx10.1
+Target Alias(mavx10.1-512) Warn(%<-mavx10.1%> is aliased to 512 bit since GCC14.3)
+Support MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, AVX, AVX2,
+and AVX10.1-512 built-in functions and code generation.
index 3ed76635002084703777a5181629eb252b20eacd..81c5bb9a9270a8f13f45d0d44210a998e0c993df 100644 (file)
@@ -615,3 +615,6 @@ UrlSuffix(gcc/x86-Options.html#index-mavx10_002e1-256)
 mavx10.1-512
 UrlSuffix(gcc/x86-Options.html#index-mavx10_002e1-512)
 
+mavx10.1
+UrlSuffix(gcc/x86-Options.html#index-mavx10_002e1)
+
index 8bd30bb2a4686e13d38385b8a2ca791eb6d2fd1a..27fefb30041ee328b8dd7cb5435cf63313986454 100644 (file)
@@ -7395,6 +7395,12 @@ Disable the generation of the AVX10.1 instructions.
 Enable the generation of the AVX10.1 instructions with 512 bit support.
 Disable the generation of the AVX10.1 instructions.
 
+@cindex @code{target("avx10.1")} function attribute, x86
+@item avx10.1
+@itemx no-avx10.1
+Enable the generation of the AVX10.1 instructions with 512 bit support.
+Disable the generation of the AVX10.1 instructions.
+
 @cindex @code{target("cld")} function attribute, x86
 @item cld
 @itemx no-cld
index 5b026cfe073ecfdee9eb288d12fc865ba5bf7c59..23dedef416190883ba74b9af2c8c889b1df63074 100644 (file)
@@ -2549,6 +2549,9 @@ Target supports the execution of @code{avx10.1-256} instructions.
 @item avx10.1-512
 Target supports the execution of @code{avx10.1-512} instructions.
 
+@item avx10.1
+Target supports the execution of @code{avx10.1} instructions.
+
 @item avx2
 Target supports compiling @code{avx2} instructions.