The following fixes ix86_handle_option to properly handle -mno-sse4 which is always handled as -msse4 with value unset. I've verified no other OPT_mno_* is left around.
Bootstrap and regtest running on x86_64-unknown-linux-gnu. This error goes back quite some time, I'm not sure how prevalent the use of -mno-sse4 is. In fact I have no idea why we have OPT_mno_sse4 at all... Hmm: msse4 Target RejectNegative Mask(ISA_SSE4_2) Var(ix86_isa_flags) Save Support MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1 and SSE4.2 built-in functions and code generation. mno-sse4 Target RejectNegative InverseMask(ISA_SSE4_1) Var(ix86_isa_flags) Save Do not support SSE4.1 and SSE4.2 built-in functions and code generation. but we end up building $3 = {opt_index = 2231, warn_message = 0x0, arg = 0x0, orig_option_with_args_text = 0x440d108 "-msse4", canonical_option = { 0x440d108 "-msse4", 0x0, 0x0, 0x0}, canonical_option_num_elements = 1, value = 0, mask = 0, errors = 0} from -mno-sse4 in target("") via ix86_valid_target_attribute_inner_p. OK? Any clarification on what the above is about? Richard. PR target/119549 * common/config/i386/i386-common.cc (ix86_handle_option): Handle OPT_mno_sse4 via OPT_msse4 and looking at value. * gcc.target/i386/pr119549.c: New testcase. --- gcc/common/config/i386/i386-common.cc | 21 ++++++++++++--------- gcc/testsuite/gcc.target/i386/pr119549.c | 15 +++++++++++++++ 2 files changed, 27 insertions(+), 9 deletions(-) create mode 100644 gcc/testsuite/gcc.target/i386/pr119549.c diff --git a/gcc/common/config/i386/i386-common.cc b/gcc/common/config/i386/i386-common.cc index 80aec3244bc..296df3b3230 100644 --- a/gcc/common/config/i386/i386-common.cc +++ b/gcc/common/config/i386/i386-common.cc @@ -1519,15 +1519,18 @@ ix86_handle_option (struct gcc_options *opts, return true; case OPT_msse4: - opts->x_ix86_isa_flags |= OPTION_MASK_ISA_SSE4_SET; - opts->x_ix86_isa_flags_explicit |= OPTION_MASK_ISA_SSE4_SET; - return true; - - case OPT_mno_sse4: - opts->x_ix86_isa_flags &= ~OPTION_MASK_ISA_SSE4_UNSET; - opts->x_ix86_isa_flags_explicit |= OPTION_MASK_ISA_SSE4_UNSET; - opts->x_ix86_isa_flags2 &= ~OPTION_MASK_ISA2_SSE4_UNSET; - opts->x_ix86_isa_flags2_explicit |= OPTION_MASK_ISA2_SSE4_UNSET; + if (value) + { + opts->x_ix86_isa_flags |= OPTION_MASK_ISA_SSE4_SET; + opts->x_ix86_isa_flags_explicit |= OPTION_MASK_ISA_SSE4_SET; + } + else + { + opts->x_ix86_isa_flags &= ~OPTION_MASK_ISA_SSE4_UNSET; + opts->x_ix86_isa_flags_explicit |= OPTION_MASK_ISA_SSE4_UNSET; + opts->x_ix86_isa_flags2 &= ~OPTION_MASK_ISA2_SSE4_UNSET; + opts->x_ix86_isa_flags2_explicit |= OPTION_MASK_ISA2_SSE4_UNSET; + } return true; case OPT_msse4a: diff --git a/gcc/testsuite/gcc.target/i386/pr119549.c b/gcc/testsuite/gcc.target/i386/pr119549.c new file mode 100644 index 00000000000..a465bec3cf0 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr119549.c @@ -0,0 +1,15 @@ +/* { dg-do compile } */ +/* { dg-options "-msse4" } */ + +typedef long long v2di __attribute__((vector_size(16))); + +static inline __attribute__((always_inline)) +int rte_trace_feature_is_enabled() { return 1; } /* { dg-error "inlining failed" } */ + +void __attribute__((target ("no-sse3"))) __attribute__((target ("no-sse4"))) +rte_eal_trace_generic_void_init(void) +{ + if (!rte_trace_feature_is_enabled()) return; + __asm__ volatile ("" : : : "memory"); +} + -- 2.43.0