On Thu, Jun 20, 2024 at 3:16 AM Hongyu Wang <hongyu.w...@intel.com> wrote: > > Hi, > > This patch adjusts several new feature check in ix86_option_override_interal > that directly use TARGET_* instead of TARGET_*_P (opts->ix86_isa_flags), > which caused cmdline option overrides target_attribute isa flag. > > Bootstrapped && regtested on x86_64-pc-linux-gnu. > > Ok for trunk? > > 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.
OK. Thanks, Uros. > --- > gcc/config/i386/i386-options.cc | 14 +++++++++----- > gcc/testsuite/gcc.target/i386/apx-ccmp-2.c | 2 +- > gcc/testsuite/gcc.target/i386/funcspec-56.inc | 2 -- > gcc/testsuite/gcc.target/i386/funcspec-6.c | 2 ++ > 4 files changed, 12 insertions(+), 8 deletions(-) > > diff --git a/gcc/config/i386/i386-options.cc b/gcc/config/i386/i386-options.cc > index f2cecc0e254..34adedb3127 100644 > --- a/gcc/config/i386/i386-options.cc > +++ b/gcc/config/i386/i386-options.cc > @@ -2113,15 +2113,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) > @@ -2502,7 +2505,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. */ > diff --git a/gcc/testsuite/gcc.target/i386/apx-ccmp-2.c > b/gcc/testsuite/gcc.target/i386/apx-ccmp-2.c > index 4a0784394c3..192c0458728 100644 > --- a/gcc/testsuite/gcc.target/i386/apx-ccmp-2.c > +++ b/gcc/testsuite/gcc.target/i386/apx-ccmp-2.c > @@ -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) > diff --git a/gcc/testsuite/gcc.target/i386/funcspec-56.inc > b/gcc/testsuite/gcc.target/i386/funcspec-56.inc > index 2a50f5bf67c..8825e88768a 100644 > --- a/gcc/testsuite/gcc.target/i386/funcspec-56.inc > +++ b/gcc/testsuite/gcc.target/i386/funcspec-56.inc > @@ -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"))); > diff --git a/gcc/testsuite/gcc.target/i386/funcspec-6.c > b/gcc/testsuite/gcc.target/i386/funcspec-6.c > index ea896b7ebfd..033c9a50e23 100644 > --- a/gcc/testsuite/gcc.target/i386/funcspec-6.c > +++ b/gcc/testsuite/gcc.target/i386/funcspec-6.c > @@ -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" } */ > -- > 2.31.1 >