]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
i386: Fix some ISA bit test in option_override
authorHongyu Wang <hongyu.wang@intel.com>
Mon, 17 Jun 2024 02:34:01 +0000 (10:34 +0800)
committerHongyu Wang <hongyu.wang@intel.com>
Thu, 20 Jun 2024 07:13:45 +0000 (15:13 +0800)
Adjust several new feature check in ix86_option_override_interal that
directly use TARGET_* instead of TARGET_*_P (opts->ix86_isa_flags)
to avoid cmdline option overrides target_attribute isa flag.

gcc/ChangeLog:

* config/i386/i386-options.cc (ix86_option_override_internal):
Use TARGET_*_P (opts->x_ix86_isa_flags*) instead of TARGET_*
for UINTR, LAM and APX_F.

gcc/testsuite/ChangeLog:

* gcc.target/i386/apx-ccmp-2.c: Remove -mno-apxf in option.
* gcc.target/i386/funcspec-56.inc: Drop uintr tests.
* gcc.target/i386/funcspec-6.c: Add uintr tests.

gcc/config/i386/i386-options.cc
gcc/testsuite/gcc.target/i386/apx-ccmp-2.c
gcc/testsuite/gcc.target/i386/funcspec-56.inc
gcc/testsuite/gcc.target/i386/funcspec-6.c

index 65c5bad9c285ea65b29a155f64745015556a1b5a..1ef2c71a7a23945837b2c8352dd59374f70b8280 100644 (file)
@@ -2115,15 +2115,18 @@ ix86_option_override_internal (bool main_args_p,
       opts->x_ix86_stringop_alg = no_stringop;
     }
 
-  if (TARGET_APX_F && !TARGET_64BIT)
+  if (TARGET_APX_F_P (opts->x_ix86_isa_flags2)
+      && !TARGET_64BIT_P (opts->x_ix86_isa_flags))
     error ("%<-mapxf%> is not supported for 32-bit code");
-  else if (opts->x_ix86_apx_features != apx_none && !TARGET_64BIT)
+  else if (opts->x_ix86_apx_features != apx_none
+          && !TARGET_64BIT_P (opts->x_ix86_isa_flags))
     error ("%<-mapx-features=%> option is not supported for 32-bit code");
 
-  if (TARGET_UINTR && !TARGET_64BIT)
+  if (TARGET_UINTR_P (opts->x_ix86_isa_flags2)
+      && !TARGET_64BIT_P (opts->x_ix86_isa_flags))
     error ("%<-muintr%> not supported for 32-bit code");
 
-  if (ix86_lam_type && !TARGET_LP64)
+  if (ix86_lam_type && !TARGET_LP64_P (opts->x_ix86_isa_flags))
     error ("%<-mlam=%> option: [u48|u57] not supported for 32-bit code");
 
   if (!opts->x_ix86_arch_string)
@@ -2504,7 +2507,8 @@ ix86_option_override_internal (bool main_args_p,
   init_machine_status = ix86_init_machine_status;
 
   /* Override APX flag here if ISA bit is set.  */
-  if (TARGET_APX_F && !OPTION_SET_P (ix86_apx_features))
+  if (TARGET_APX_F_P (opts->x_ix86_isa_flags2)
+      && !OPTION_SET_P (ix86_apx_features))
     opts->x_ix86_apx_features = apx_all;
 
   /* Validate -mregparm= value.  */
index 4a0784394c32660ed853489c5cac6db71b8f9d02..192c045872840c23a7b477be77e4aef56ec0550f 100644 (file)
@@ -1,6 +1,6 @@
 /* { dg-do run { target { ! ia32 } } } */
 /* { dg-require-effective-target apxf } */
-/* { dg-options "-O3 -mno-apxf" } */
+/* { dg-options "-O3" } */
 
 __attribute__((noinline, noclone, target("apxf")))
 int foo_apx(int a, int b, int c, int d)
index c4dc89367ef5890d218e3ae9f1f797481a6fbdad..e4713eaa88d44c00815d2299bb9881ab7ec9da18 100644 (file)
@@ -69,7 +69,6 @@ extern void test_avx512vp2intersect (void)    __attribute__((__target__("avx512vp2i
 extern void test_amx_tile (void)               __attribute__((__target__("amx-tile")));
 extern void test_amx_int8 (void)               __attribute__((__target__("amx-int8")));
 extern void test_amx_bf16 (void)               __attribute__((__target__("amx-bf16")));
-extern void test_uintr (void)                  __attribute__((__target__("uintr")));
 extern void test_hreset (void)                 __attribute__((__target__("hreset")));
 extern void test_keylocker (void)              __attribute__((__target__("kl")));
 extern void test_widekl (void)                 __attribute__((__target__("widekl")));
@@ -158,7 +157,6 @@ extern void test_no_avx512vp2intersect (void)       __attribute__((__target__("no-avx5
 extern void test_no_amx_tile (void)            __attribute__((__target__("no-amx-tile")));
 extern void test_no_amx_int8 (void)            __attribute__((__target__("no-amx-int8")));
 extern void test_no_amx_bf16 (void)            __attribute__((__target__("no-amx-bf16")));
-extern void test_no_uintr (void)               __attribute__((__target__("no-uintr")));
 extern void test_no_hreset (void)              __attribute__((__target__("no-hreset")));
 extern void test_no_keylocker (void)           __attribute__((__target__("no-kl")));
 extern void test_no_widekl (void)              __attribute__((__target__("no-widekl")));
index ea896b7ebfdb78d18e8e1f88c95cd3ac8408bbc3..033c9a50e23c0b135127cc40fd7c4dcc49453893 100644 (file)
@@ -4,6 +4,8 @@
 
 #include "funcspec-56.inc"
 
+extern void test_uintr (void)                  __attribute__((__target__("uintr")));
+extern void test_no_uintr (void)               __attribute__((__target__("no-uintr")));
 extern void test_arch_foo (void)               __attribute__((__target__("arch=foo"))); /* { dg-error "bad value" } */
 
 extern void test_tune_foo (void)               __attribute__((__target__("tune=foo"))); /* { dg-error "bad value" } */