diff options
author | Hongyu Wang <hongyu.wang@intel.com> | 2024-06-17 10:34:01 +0800 |
---|---|---|
committer | Hongyu Wang <hongyu.wang@intel.com> | 2024-06-20 15:13:45 +0800 |
commit | 4867cc815531ede8bc356a2507f1c35ee6e6399c (patch) | |
tree | 0c52354e967fd7d9a98a0aebf4217a37816ffe26 | |
parent | ccaa39a268bef2a1d8880022696ff2dcaa6af941 (diff) | |
download | gcc-4867cc815531ede8bc356a2507f1c35ee6e6399c.zip gcc-4867cc815531ede8bc356a2507f1c35ee6e6399c.tar.gz gcc-4867cc815531ede8bc356a2507f1c35ee6e6399c.tar.bz2 |
i386: Fix some ISA bit test in option_override
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.
-rw-r--r-- | gcc/config/i386/i386-options.cc | 14 | ||||
-rw-r--r-- | gcc/testsuite/gcc.target/i386/apx-ccmp-2.c | 2 | ||||
-rw-r--r-- | gcc/testsuite/gcc.target/i386/funcspec-56.inc | 2 | ||||
-rw-r--r-- | 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 65c5bad..1ef2c71a 100644 --- a/gcc/config/i386/i386-options.cc +++ b/gcc/config/i386/i386-options.cc @@ -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. */ diff --git a/gcc/testsuite/gcc.target/i386/apx-ccmp-2.c b/gcc/testsuite/gcc.target/i386/apx-ccmp-2.c index 4a07843..192c045 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 c4dc893..e4713ea 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 ea896b7..033c9a5 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" } */ |