Alexandre Oliva <ol...@adacore.com> writes:
> On Feb 13, 2025, Alexandre Oliva <ol...@adacore.com> wrote:
>
>> @@ -14108,10 +14113,9 @@ proc dg-require-python-h { args } {
>>  # Return 1 if the target supports heap-trampoline, 0 otherwise.
>>  proc check_effective_target_heap_trampoline {} {
>>      if { [istarget aarch64*-*-linux*]
>> -     || [istarget i?86-*-darwin*]
>> -     || [istarget x86_64-*-darwin*]
>> -     || [istarget i?86-*-linux*]
>> -     || [istarget x86_64-*-linux*] } {
>> +     || { [check_effective_target_x86]
>> +          && { [istarget *-*-darwin*]
>> +               || [istarget *-*-linux*] } } } {
>>      return 1
>>      }
>>      return 0
>
> I used the wrong kind of brackets here, and missed the error that it
> caused.  Here's a corrected patch, retested on x86_64-linux-gnu.
> Ok to install?
>
>
> I got tired of repeating the conditional that recognizes ia32 or
> x86_64, and introduced 'x86' as a shorthand for that, adjusting all
> occurrences in target-supports.exp, to set an example.  I found some
> patterns that recognized i?86* and x86_64*, but I took those as likely
> cut&pastos instead of trying to preserve those weirdnesses.
>
>
> for  gcc/ChangeLog
>
>       * doc/sourcebuild.texi: Add x86 effective target.
>
> for  gcc/testsuite/ChangeLog
>
>       * lib/target-supports.exp (check_effective_target_x86): New.
>       Replace all uses of i?86-*-* and x86_64-*-* in this file.

Thanks for doing this.  How about also replacing all uses of:

   ([check_effective_target_x86])

with:

   [check_effective_target_x86]

OK with that change if there are no objections within 24 hours.

Thanks,
Richard

> ---
>  gcc/doc/sourcebuild.texi              |    3 +
>  gcc/testsuite/lib/target-supports.exp |  188 
> +++++++++++++++++----------------
>  2 files changed, 99 insertions(+), 92 deletions(-)
>
> diff --git a/gcc/doc/sourcebuild.texi b/gcc/doc/sourcebuild.texi
> index 28338324f0724..d44c2e8cbe6a1 100644
> --- a/gcc/doc/sourcebuild.texi
> +++ b/gcc/doc/sourcebuild.texi
> @@ -2798,6 +2798,9 @@ Target supports the execution of @code{user_msr} 
> instructions.
>  @item vect_cmdline_needed
>  Target requires a command line argument to enable a SIMD instruction set.
>  
> +@item x86
> +Target is ia32 or x86_64.
> +
>  @item xorsign
>  Target supports the xorsign optab expansion.
>  
> diff --git a/gcc/testsuite/lib/target-supports.exp 
> b/gcc/testsuite/lib/target-supports.exp
> index 9b5fbe5275613..fbeb2ad3dafa3 100644
> --- a/gcc/testsuite/lib/target-supports.exp
> +++ b/gcc/testsuite/lib/target-supports.exp
> @@ -740,7 +740,7 @@ proc check_profiling_available { test_what } {
>      }
>  
>      if { $test_what == "-fauto-profile" } {
> -     if { !([istarget i?86-*-linux*] || [istarget x86_64-*-linux*]) } {
> +     if { !([check_effective_target_x86] && [istarget *-*-linux*]) } {
>           verbose "autofdo only supported on linux"
>           return 0
>       }
> @@ -2616,17 +2616,23 @@ proc remove_options_for_riscv_zvbb { flags } {
>      return [add_options_for_riscv_z_ext zvbb $flags]
>  }
>  
> +# Return 1 if the target is ia32 or x86_64.
> +
> +proc check_effective_target_x86 { } {
> +    if { ([istarget x86_64-*-*] || [istarget i?86-*-*]) } {
> +     return 1
> +    } else {
> +        return 0
> +    }
> +}
> +
>  # Return 1 if the target OS supports running SSE executables, 0
>  # otherwise.  Cache the result.
>  
>  proc check_sse_os_support_available { } {
>      return [check_cached_effective_target sse_os_support_available {
>       # If this is not the right target then we can skip the test.
> -     if { !([istarget i?86-*-*] || [istarget x86_64-*-*]) } {
> -         expr 0
> -     } else {
> -         expr 1
> -     }
> +     expr [check_effective_target_x86]
>      }]
>  }
>  
> @@ -2636,7 +2642,7 @@ proc check_sse_os_support_available { } {
>  proc check_avx_os_support_available { } {
>      return [check_cached_effective_target avx_os_support_available {
>       # If this is not the right target then we can skip the test.
> -     if { !([istarget i?86-*-*] || [istarget x86_64-*-*]) } {
> +     if { !([check_effective_target_x86]) } {
>           expr 0
>       } else {
>           # Check that OS has AVX and SSE saving enabled.
> @@ -2659,7 +2665,7 @@ proc check_avx_os_support_available { } {
>  proc check_avx512_os_support_available { } {
>      return [check_cached_effective_target avx512_os_support_available {
>       # If this is not the right target then we can skip the test.
> -     if { !([istarget i?86-*-*] || [istarget x86_64-*-*]) } {
> +     if { !([check_effective_target_x86]) } {
>           expr 0
>       } else {
>           # Check that OS has AVX512, AVX and SSE saving enabled.
> @@ -2682,7 +2688,7 @@ proc check_avx512_os_support_available { } {
>  proc check_sse_hw_available { } {
>      return [check_cached_effective_target sse_hw_available {
>       # If this is not the right target then we can skip the test.
> -     if { !([istarget i?86-*-*] || [istarget x86_64-*-*]) } {
> +     if { !([check_effective_target_x86]) } {
>           expr 0
>       } else {
>           check_runtime_nocache sse_hw_available {
> @@ -2706,7 +2712,7 @@ proc check_sse_hw_available { } {
>  proc check_sse2_hw_available { } {
>      return [check_cached_effective_target sse2_hw_available {
>       # If this is not the right target then we can skip the test.
> -     if { !([istarget i?86-*-*] || [istarget x86_64-*-*]) } {
> +     if { !([check_effective_target_x86]) } {
>           expr 0
>       } else {
>           check_runtime_nocache sse2_hw_available {
> @@ -2730,7 +2736,7 @@ proc check_sse2_hw_available { } {
>  proc check_sse4_hw_available { } {
>      return [check_cached_effective_target sse4_hw_available {
>       # If this is not the right target then we can skip the test.
> -     if { !([istarget i?86-*-*] || [istarget x86_64-*-*]) } {
> +     if { !([check_effective_target_x86]) } {
>           expr 0
>       } else {
>           check_runtime_nocache sse4_hw_available {
> @@ -2754,7 +2760,7 @@ proc check_sse4_hw_available { } {
>  proc check_avx_hw_available { } {
>      return [check_cached_effective_target avx_hw_available {
>       # If this is not the right target then we can skip the test.
> -     if { !([istarget i?86-*-*] || [istarget x86_64-*-*]) } {
> +     if { !([check_effective_target_x86]) } {
>           expr 0
>       } else {
>           check_runtime_nocache avx_hw_available {
> @@ -2779,7 +2785,7 @@ proc check_avx_hw_available { } {
>  proc check_avx2_hw_available { } {
>      return [check_cached_effective_target avx2_hw_available {
>       # If this is not the right target then we can skip the test.
> -     if { !([istarget x86_64-*-*] || [istarget i?86-*-*]) } {
> +     if { !([check_effective_target_x86]) } {
>           expr 0
>       } else {
>           check_runtime_nocache avx2_hw_available {
> @@ -2812,7 +2818,7 @@ proc check_avx2_hw_available { } {
>  proc check_avx512f_hw_available { } {
>      return [check_cached_effective_target avx512f_hw_available {
>       # If this is not the right target then we can skip the test.
> -     if { !([istarget x86_64-*-*] || [istarget i?86-*-*]) } {
> +     if { !([check_effective_target_x86]) } {
>           expr 0
>       } else {
>           check_runtime_nocache avx512f_hw_available {
> @@ -2907,8 +2913,8 @@ proc check_effective_target_avx512f_runtime { } {
>  
>  # Return 1 if bmi2 instructions can be compiled.
>  proc check_effective_target_bmi2 { } {
> -    if { !([istarget i?86-*-*] || [istarget x86_64-*-*]) } {
> -     return 0
> +    if { !([check_effective_target_x86]) } {
> +        return 0
>      }
>      return [check_no_compiler_messages bmi2 object {
>       unsigned int
> @@ -4150,7 +4156,7 @@ proc add_options_for_float16 { flags } {
>      if { [istarget arm*-*-*] } {
>       return "$flags -mfp16-format=ieee"
>      }
> -    if { [istarget i?86-*-*] || [istarget x86_64-*-*] } {
> +    if { [check_effective_target_x86] } {
>       return "$flags -msse2 -mfpmath=sse"
>      }
>      return "$flags"
> @@ -4188,7 +4194,7 @@ proc check_effective_target___float128 { } {
>       return [check_ppc_float128_sw_available]
>      }
>      if { [istarget ia64-*-*]
> -      || [istarget i?86-*-*] || [istarget x86_64-*-*] } {
> +      || [check_effective_target_x86] } {
>       return 1
>      }
>      return 0
> @@ -4225,7 +4231,7 @@ proc check_effective_target_bfloat16_runtime {} {
>  }
>  
>  proc add_options_for_bfloat16 { flags } {
> -    if { [istarget i?86-*-*] || [istarget x86_64-*-*] } {
> +    if { [check_effective_target_x86] } {
>       return "$flags -msse2"
>      }
>      return "$flags"
> @@ -4334,7 +4340,7 @@ proc check_effective_target_dfprt { } {
>  
>  proc check_effective_target_dfp_bid { } {
>      if { [istarget aarch64*-*-*]
> -      || [istarget i?86-*-*] || [istarget x86_64-*-*]} {
> +      || [check_effective_target_x86]} {
>       return 1
>      }
>      return 0
> @@ -4425,7 +4431,7 @@ proc check_effective_target_vect_cmdline_needed { } {
>      return [check_cached_effective_target vect_cmdline_needed {
>       if { [istarget alpha*-*-*]
>            || [istarget ia64-*-*]
> -          || (([istarget i?86-*-*] || [istarget x86_64-*-*])
> +          || (([check_effective_target_x86])
>                && ![is-effective-target ia32])
>            || ([istarget powerpc*-*-*]
>                && [check_effective_target_powerpc_altivec])
> @@ -4447,7 +4453,7 @@ proc check_effective_target_vect_cmdline_needed { } {
>  proc check_effective_target_vect_int { } {
>      return [check_cached_effective_target_indexed vect_int {
>        expr {
> -      [istarget i?86-*-*] || [istarget x86_64-*-*]
> +      [check_effective_target_x86]
>        || [istarget powerpc*-*-*]
>        || [istarget amdgcn-*-*]
>        || [istarget sparc*-*-*]
> @@ -4648,7 +4654,7 @@ proc check_effective_target_vect_complex_add_double { } 
> {
>  
>  proc check_effective_target_vect_intfloat_cvt { } {
>      return [check_cached_effective_target_indexed vect_intfloat_cvt {
> -      expr { [istarget i?86-*-*] || [istarget x86_64-*-*]
> +      expr { [check_effective_target_x86]
>            || [istarget powerpc*-*-*]
>            || [is-effective-target arm_neon]
>            || ([istarget mips*-*-*]
> @@ -4667,7 +4673,7 @@ proc check_effective_target_vect_intfloat_cvt { } {
>  
>  proc check_effective_target_vect_doubleint_cvt { } {
>      return [check_cached_effective_target_indexed vect_doubleint_cvt {
> -      expr { (([istarget i?86-*-*] || [istarget x86_64-*-*])
> +      expr { (([check_effective_target_x86])
>              && [check_no_compiler_messages vect_doubleint_cvt assembly {
>                  #ifdef __tune_atom__
>                  # error No double vectorizer support.
> @@ -4690,7 +4696,7 @@ proc check_effective_target_vect_doubleint_cvt { } {
>  
>  proc check_effective_target_vect_intdouble_cvt { } {
>      return [check_cached_effective_target_indexed vect_intdouble_cvt {
> -      expr { (([istarget i?86-*-*] || [istarget x86_64-*-*])
> +      expr { (([check_effective_target_x86])
>             && [check_no_compiler_messages vect_intdouble_cvt assembly {
>                 #ifdef __tune_atom__
>                 # error No double vectorizer support.
> @@ -4727,7 +4733,7 @@ proc check_effective_target_int128 { } {
>  
>  proc check_effective_target_vect_uintfloat_cvt { } {
>      return [check_cached_effective_target_indexed vect_uintfloat_cvt {
> -      expr { [istarget i?86-*-*] || [istarget x86_64-*-*]
> +      expr { [check_effective_target_x86]
>            || [istarget powerpc*-*-*]
>            || [istarget aarch64*-*-*]
>            || [is-effective-target arm_neon]
> @@ -4748,7 +4754,7 @@ proc check_effective_target_vect_uintfloat_cvt { } {
>  
>  proc check_effective_target_vect_floatint_cvt { } {
>      return [check_cached_effective_target_indexed vect_floatint_cvt {
> -      expr { [istarget i?86-*-*] || [istarget x86_64-*-*]
> +      expr { [check_effective_target_x86]
>            || [istarget powerpc*-*-*]
>            || [is-effective-target arm_neon]
>            || ([istarget mips*-*-*]
> @@ -4811,7 +4817,7 @@ proc check_effective_target_vect_simd_clones { } {
>      # specified arch will be chosen, but still we need to at least
>      # be able to assemble avx512f.
>      return [check_cached_effective_target_indexed vect_simd_clones {
> -      expr { (([istarget i?86-*-*] || [istarget x86_64-*-*])
> +      expr { (([check_effective_target_x86])
>             && [check_effective_target_avx512f])
>            || [istarget amdgcn-*-*]
>            || [istarget aarch64*-*-*] }}]
> @@ -7870,7 +7876,7 @@ proc check_effective_target_vect_shift { } {
>      return [check_cached_effective_target_indexed vect_shift {
>        expr {[istarget powerpc*-*-*]
>            || [istarget ia64-*-*]
> -          || [istarget i?86-*-*] || [istarget x86_64-*-*]
> +          || [check_effective_target_x86]
>            || [istarget aarch64*-*-*]
>            || [is-effective-target arm_neon]
>            || ([istarget mips*-*-*]
> @@ -7889,7 +7895,7 @@ proc check_effective_target_vect_shift { } {
>  
>  proc check_effective_target_vect_var_shift { } {
>      return [check_cached_effective_target_indexed vect_var_shift {
> -      expr {(([istarget i?86-*-*] || [istarget x86_64-*-*])
> +      expr {(([check_effective_target_x86])
>            && [check_avx2_available])
>           || [istarget aarch64*-*-*]
>           || ([istarget riscv*-*-*]
> @@ -7900,7 +7906,7 @@ proc check_effective_target_vect_var_shift { } {
>  }
>  
>  proc check_effective_target_whole_vector_shift { } {
> -    if { [istarget i?86-*-*] || [istarget x86_64-*-*]
> +    if { [check_effective_target_x86]
>        || [istarget ia64-*-*]
>        || [istarget aarch64*-*-*]
>        || [istarget powerpc64*-*-*]
> @@ -7941,7 +7947,7 @@ proc check_effective_target_vect_bswap { } {
>  
>  proc check_effective_target_vect_bool_cmp { } {
>      return [check_cached_effective_target_indexed vect_bool_cmp {
> -      expr { [istarget i?86-*-*] || [istarget x86_64-*-*]
> +      expr { [check_effective_target_x86]
>            || [istarget aarch64*-*-*]
>            || [is-effective-target arm_neon]
>            || ([istarget riscv*-*-*]
> @@ -7956,7 +7962,7 @@ proc check_effective_target_vect_bool_cmp { } {
>  proc check_effective_target_vect_char_add { } {
>      return [check_cached_effective_target_indexed vect_char_add {
>        expr {
> -      [istarget i?86-*-*] || [istarget x86_64-*-*]
> +      [check_effective_target_x86]
>        || [istarget powerpc*-*-*]
>        || [istarget amdgcn-*-*]
>        || [istarget ia64-*-*]
> @@ -7996,7 +8002,7 @@ proc check_effective_target_vect_shift_char { } {
>  # This can change for different subtargets so do not cache the result.
>  
>  proc check_effective_target_vect_long { } {
> -    if { [istarget i?86-*-*] || [istarget x86_64-*-*]
> +    if { [check_effective_target_x86]
>        || ([istarget powerpc*-*-*]
>             && [check_effective_target_ilp32])
>        || [is-effective-target arm_neon]
> @@ -8027,7 +8033,7 @@ proc check_effective_target_vect_long { } {
>  
>  proc check_effective_target_vect_float { } {
>      return [check_cached_effective_target_indexed vect_float {
> -      expr { [istarget i?86-*-*] || [istarget x86_64-*-*]
> +      expr { [check_effective_target_x86]
>            || [istarget powerpc*-*-*]
>            || [istarget mips-sde-elf]
>            || [istarget mipsisa64*-*-*]
> @@ -8059,7 +8065,7 @@ proc check_effective_target_vect_float_strict { } {
>  
>  proc check_effective_target_vect_double { } {
>      return [check_cached_effective_target_indexed vect_double {
> -     expr { (([istarget i?86-*-*] || [istarget x86_64-*-*])
> +     expr { (([check_effective_target_x86])
>                && [check_no_compiler_messages vect_double assembly {
>                 #ifdef __tune_atom__
>                 # error No double vectorizer support.
> @@ -8093,7 +8099,7 @@ proc check_effective_target_vect_double_cond_arith { } {
>  
>  proc check_effective_target_vect_long_long { } {
>      return [check_cached_effective_target_indexed vect_long_long {
> -      expr { [istarget i?86-*-*] || [istarget x86_64-*-*]
> +      expr { [check_effective_target_x86]
>            || ([istarget mips*-*-*]
>                && [et-is-effective-target mips_msa])
>            || ([istarget s390*-*-*]
> @@ -8152,7 +8158,7 @@ proc check_effective_target_vect_perm { } {
>        expr { [is-effective-target arm_neon]
>            || [istarget aarch64*-*-*]
>            || [istarget powerpc*-*-*]
> -          || [istarget i?86-*-*] || [istarget x86_64-*-*]
> +          || [check_effective_target_x86]
>            || ([istarget mips*-*-*]
>                && ([et-is-effective-target mpaired_single]
>                    || [et-is-effective-target mips_msa]))
> @@ -8282,7 +8288,7 @@ proc check_effective_target_vect_perm_short { } {
>            || ([istarget aarch64*-*-*]
>                && [is-effective-target aarch64_little_endian])
>            || [istarget powerpc*-*-*]
> -          || (([istarget i?86-*-*] || [istarget x86_64-*-*])
> +          || ([check_effective_target_x86]
>                && [check_ssse3_available])
>            || ([istarget mips*-*-*]
>                 && [et-is-effective-target mips_msa])
> @@ -8310,7 +8316,7 @@ proc check_effective_target_vect_perm3_short { } {
>  
>  proc check_effective_target_xorsign { } {
>      return [check_cached_effective_target_indexed xorsign {
> -      expr { [istarget i?86-*-*] || [istarget x86_64-*-*]
> +      expr { [check_effective_target_x86]
>            || [istarget aarch64*-*-*] || [istarget arm*-*-*] }}]
>  }
>  
> @@ -8322,7 +8328,7 @@ proc check_effective_target_xorsign { } {
>  proc check_effective_target_ifn_copysign { } {
>      return [check_cached_effective_target_indexed ifn_copysign {
>        expr {
> -      (([istarget i?86-*-*] || [istarget x86_64-*-*])
> +      (([check_effective_target_x86])
>          && [is-effective-target sse])
>        || ([istarget loongarch*-*-*]
>            && [check_effective_target_hard_float])
> @@ -8434,7 +8440,7 @@ proc check_effective_target_vect_widen_mult_hi_to_si { 
> } {
>                || [istarget ia64-*-*]
>                || ([istarget aarch64*-*-*]
>                    && ![check_effective_target_aarch64_sve])
> -              || [istarget i?86-*-*] || [istarget x86_64-*-*]
> +              || [check_effective_target_x86]
>                || [is-effective-target arm_neon]
>                || ([istarget s390*-*-*]
>                    && [check_effective_target_s390_vx]))
> @@ -8467,7 +8473,7 @@ proc 
> check_effective_target_vect_widen_mult_hi_to_si_pattern { } {
>        expr { [istarget powerpc*-*-*]
>            || [istarget ia64-*-*]
>            || [istarget loongarch*-*-*]
> -          || [istarget i?86-*-*] || [istarget x86_64-*-*]
> +          || [check_effective_target_x86]
>            || ([is-effective-target arm_neon]
>                && [check_effective_target_arm_little_endian])
>            || ([istarget s390*-*-*]
> @@ -8483,7 +8489,7 @@ proc 
> check_effective_target_vect_widen_mult_hi_to_si_pattern { } {
>  proc check_effective_target_vect_widen_mult_si_to_di_pattern { } {
>      return [check_cached_effective_target_indexed 
> vect_widen_mult_si_to_di_pattern {
>        expr { [istarget ia64-*-*]
> -          || [istarget i?86-*-*] || [istarget x86_64-*-*]
> +          || [check_effective_target_x86]
>            || [istarget loongarch*-*-*]
>            || ([istarget s390*-*-*]
>                && [check_effective_target_s390_vx]) }}]
> @@ -8558,7 +8564,7 @@ proc check_effective_target_vect_sdot_hi { } {
>      return [check_cached_effective_target_indexed vect_sdot_hi {
>        expr { [istarget powerpc*-*-*]
>            || [istarget ia64-*-*]
> -          || [istarget i?86-*-*] || [istarget x86_64-*-*]
> +          || [check_effective_target_x86]
>            || ([istarget mips*-*-*]
>                && [et-is-effective-target mips_msa])
>            || ([istarget riscv*-*-*]
> @@ -8590,8 +8596,7 @@ proc check_effective_target_vect_udot_hi { } {
>  
>  proc check_effective_target_vect_usad_char { } {
>      return [check_cached_effective_target_indexed vect_usad_char {
> -      expr { [istarget i?86-*-*]
> -           || [istarget x86_64-*-*]
> +      expr { [check_effective_target_x86]
>             || ([istarget aarch64*-*-*]
>                 && ![check_effective_target_aarch64_sve])
>             || ([istarget powerpc*-*-*]
> @@ -8640,7 +8645,7 @@ proc check_effective_target_vect_sdiv_pow2_si {} {
>  proc check_effective_target_vect_pack_trunc { } {
>      return [check_cached_effective_target_indexed vect_pack_trunc {
>        expr { [istarget powerpc*-*-*]
> -          || [istarget i?86-*-*] || [istarget x86_64-*-*]
> +          || [check_effective_target_x86]
>            || [istarget aarch64*-*-*]
>            || ([istarget arm*-*-*] && [check_effective_target_arm_neon_ok]
>                && [check_effective_target_arm_little_endian])
> @@ -8663,7 +8668,7 @@ proc check_effective_target_vect_pack_trunc { } {
>  proc check_effective_target_vect_unpack { } {
>      return [check_cached_effective_target_indexed vect_unpack {
>        expr { [istarget powerpc*-*-*]
> -          || [istarget i?86-*-*] || [istarget x86_64-*-*]
> +          || [check_effective_target_x86]
>            || [istarget ia64-*-*]
>            || [istarget aarch64*-*-*]
>            || ([istarget mips*-*-*]
> @@ -8711,7 +8716,7 @@ proc check_effective_target_vect_no_align { } {
>  
>  proc check_effective_target_vect_hw_misalign { } {
>      return [check_cached_effective_target_indexed vect_hw_misalign {
> -     if { [istarget i?86-*-*] || [istarget x86_64-*-*]
> +     if { [check_effective_target_x86]
>            || ([istarget powerpc*-*-*] && [check_p8vector_hw_available])
>            || [istarget aarch64*-*-*]
>            || ([istarget mips*-*-*] && [et-is-effective-target mips_msa])
> @@ -8740,7 +8745,7 @@ proc check_effective_target_vect_hw_misalign { } {
>  
>  proc check_effective_target_vect_aligned_arrays { } {
>      set et_vect_aligned_arrays 0
> -    if { (([istarget i?86-*-*] || [istarget x86_64-*-*])
> +    if { (([check_effective_target_x86])
>         && !([is-effective-target ia32]
>              || ([check_avx_available] && ![check_prefer_avx128]))) } {
>       set et_vect_aligned_arrays 1
> @@ -9352,7 +9357,7 @@ proc check_effective_target_vect_condition { } {
>        expr { [istarget aarch64*-*-*]
>            || [istarget powerpc*-*-*]
>            || [istarget ia64-*-*]
> -          || [istarget i?86-*-*] || [istarget x86_64-*-*]
> +          || [check_effective_target_x86]
>            || ([istarget mips*-*-*]
>                && [et-is-effective-target mips_msa])
>            || ([istarget arm*-*-*]
> @@ -9371,7 +9376,7 @@ proc check_effective_target_vect_condition { } {
>  
>  proc check_effective_target_vect_cond_mixed { } {
>      return [check_cached_effective_target_indexed vect_cond_mixed {
> -      expr { [istarget i?86-*-*] || [istarget x86_64-*-*]
> +      expr { [check_effective_target_x86]
>            || [istarget aarch64*-*-*]
>            || [istarget powerpc*-*-*]
>            || ([istarget arm*-*-*]
> @@ -9393,7 +9398,7 @@ proc check_effective_target_vect_char_mult { } {
>      return [check_cached_effective_target_indexed vect_char_mult {
>        expr { [istarget aarch64*-*-*]
>            || [istarget ia64-*-*]
> -          || [istarget i?86-*-*] || [istarget x86_64-*-*]
> +          || [check_effective_target_x86]
>            || [check_effective_target_arm32]
>            || [check_effective_target_powerpc_altivec]
>            || ([istarget mips*-*-*]
> @@ -9412,7 +9417,7 @@ proc check_effective_target_vect_char_mult { } {
>  proc check_effective_target_vect_short_mult { } {
>      return [check_cached_effective_target_indexed vect_short_mult {
>        expr { [istarget ia64-*-*]
> -          || [istarget i?86-*-*] || [istarget x86_64-*-*]
> +          || [check_effective_target_x86]
>            || [istarget powerpc*-*-*]
>            || [istarget aarch64*-*-*]
>            || [check_effective_target_arm32]
> @@ -9433,7 +9438,7 @@ proc check_effective_target_vect_short_mult { } {
>  proc check_effective_target_vect_int_mult { } {
>      return [check_cached_effective_target_indexed vect_int_mult {
>        expr { [istarget powerpc*-*-*]
> -          || [istarget i?86-*-*] || [istarget x86_64-*-*]
> +          || [check_effective_target_x86]
>            || [istarget ia64-*-*]
>            || [istarget aarch64*-*-*]
>            || ([istarget mips*-*-*]
> @@ -9454,7 +9459,7 @@ proc check_effective_target_vect_int_mult { } {
>  # This can change for different subtargets so do not cache the result.
>  
>  proc check_effective_target_vect_long_mult { } {
> -    if { [istarget i?86-*-*] || [istarget x86_64-*-*]
> +    if { [check_effective_target_x86]
>        || ([istarget powerpc*-*-*]
>             && ([check_effective_target_ilp32]
>                 || ([check_effective_target_powerpc_vsx_ok]
> @@ -9487,7 +9492,7 @@ proc check_effective_target_vect_extract_even_odd { } {
>        expr { [istarget aarch64*-*-*]
>            || [istarget powerpc*-*-*]
>            || [is-effective-target arm_neon]
> -          || [istarget i?86-*-*] || [istarget x86_64-*-*]
> +          || [check_effective_target_x86]
>            || [istarget ia64-*-*]
>            || ([istarget mips*-*-*]
>                && ([et-is-effective-target mips_msa]
> @@ -9507,7 +9512,7 @@ proc check_effective_target_vect_interleave { } {
>        expr { [istarget aarch64*-*-*]
>            || [istarget powerpc*-*-*]
>            || [is-effective-target arm_neon]
> -          || [istarget i?86-*-*] || [istarget x86_64-*-*]
> +          || [check_effective_target_x86]
>            || [istarget ia64-*-*]
>            || ([istarget mips*-*-*]
>                && ([et-is-effective-target mpaired_single]
> @@ -9559,7 +9564,7 @@ proc available_vector_sizes { } {
>      } elseif { [istarget arm*-*-*]
>               && [check_effective_target_arm_neon_ok] } {
>       lappend result 128 64
> -    } elseif { [istarget i?86-*-*] || [istarget x86_64-*-*] } {
> +    } elseif { [check_effective_target_x86] } {
>       if { [check_avx_available] && ![check_prefer_avx128] } {
>           lappend result 256
>       }
> @@ -9637,7 +9642,7 @@ proc check_effective_target_vect32 { } {
>  
>  proc check_effective_target_vect_call_copysignf { } {
>      return [check_cached_effective_target_indexed vect_call_copysignf {
> -      expr { [istarget i?86-*-*] || [istarget x86_64-*-*]
> +      expr { [check_effective_target_x86]
>            || [istarget powerpc*-*-*]
>            || [istarget aarch64*-*-*]
>            || [istarget amdgcn-*-*]
> @@ -9651,7 +9656,7 @@ proc check_effective_target_vect_call_copysignf { } {
>  
>  proc check_effective_target_sqrt_insn { } {
>      return [check_cached_effective_target sqrt_insn {
> -      expr { [istarget i?86-*-*] || [istarget x86_64-*-*]
> +      expr { [check_effective_target_x86]
>            || [check_effective_target_powerpc_sqrt]
>            || [istarget aarch64*-*-*]
>            || ([istarget arm*-*-*] && [check_effective_target_arm_vfp_ok])
> @@ -9677,7 +9682,7 @@ proc add_options_for_sqrt_insn { flags } {
>  proc check_effective_target_vect_call_sqrtf { } {
>      return [check_cached_effective_target_indexed vect_call_sqrtf {
>        expr { [istarget aarch64*-*-*]
> -          || [istarget i?86-*-*] || [istarget x86_64-*-*]
> +          || [check_effective_target_x86]
>            || ([istarget powerpc*-*-*] && [check_vsx_hw_available])
>            || ([istarget s390*-*-*]
>                && [check_effective_target_s390_vx])
> @@ -9692,7 +9697,7 @@ proc check_effective_target_vect_call_sqrtf { } {
>  
>  proc check_effective_target_vect_call_lrint { } {
>      set et_vect_call_lrint 0
> -    if { (([istarget i?86-*-*] || [istarget x86_64-*-*])
> +    if { (([check_effective_target_x86])
>         && [check_effective_target_ilp32])
>        || [istarget amdgcn-*-*]
>        || [istarget loongarch*-*-*] } {
> @@ -9800,7 +9805,7 @@ proc check_effective_target_vect_logical_reduc { } {
>                  || [istarget amdgcn-*-*]
>                  || [check_effective_target_riscv_v]
>                  || [check_effective_target_loongarch_sx]
> -                || [istarget i?86-*-*] || [istarget x86_64-*-*]}]
> +                || [check_effective_target_x86]}]
>  }
>  
>  # Return 1 if the target supports the fold_extract_last optab.
> @@ -9841,7 +9846,7 @@ proc check_effective_target_sync_int_128_runtime { } {
>  # Note: 32bit s390 targets require -mzarch in dg-options.
>  
>  proc check_effective_target_sync_long_long { } {
> -    if { [istarget i?86-*-*] || [istarget x86_64-*-*]
> +    if { [check_effective_target_x86]
>        || [istarget aarch64*-*-*]
>        || [istarget arm*-*-*]
>        || [istarget alpha*-*-*]
> @@ -9959,7 +9964,7 @@ proc check_effective_target_ctzll { } {
>  # Note: 32bit x86 targets require -march=pentium in dg-options.
>  
>  proc check_effective_target_sync_long_long_runtime { } {
> -    if { (([istarget x86_64-*-*] || [istarget i?86-*-*])
> +    if { (([check_effective_target_x86])
>         && [check_cached_effective_target sync_long_long_available {
>             check_runtime_nocache sync_long_long_available {
>                 #include "cpuid.h"
> @@ -10008,7 +10013,7 @@ proc check_effective_target_bswap { } {
>      return [check_cached_effective_target bswap {
>        expr { [istarget aarch64*-*-*]
>            || [istarget alpha*-*-*]
> -          || [istarget i?86-*-*] || [istarget x86_64-*-*]
> +          || [check_effective_target_x86]
>            || [istarget m68k-*-*]
>            || [istarget powerpc*-*-*]
>            || [istarget rs6000-*-*]
> @@ -10036,7 +10041,7 @@ proc check_effective_target_sync_int_long { } {
>  # load-reserved/store-conditional instructions.
>      return [check_cached_effective_target sync_int_long {
>        expr { [istarget ia64-*-*]
> -          || [istarget i?86-*-*] || [istarget x86_64-*-*]
> +          || [check_effective_target_x86]
>            || [istarget aarch64*-*-*]
>            || [istarget alpha*-*-*]
>            || [istarget arm*-*-linux-*]
> @@ -10073,7 +10078,7 @@ proc check_effective_target_sync_char_short { } {
>      return [check_cached_effective_target sync_char_short {
>        expr { [istarget aarch64*-*-*]
>            || [istarget ia64-*-*]
> -          || [istarget i?86-*-*] || [istarget x86_64-*-*]
> +          || [check_effective_target_x86]
>            || [istarget alpha*-*-*]
>            || [istarget arm*-*-linux-*]
>            || [istarget arm*-*-uclinuxfdpiceabi]
> @@ -10670,7 +10675,7 @@ proc check_effective_target_4byte_wchar_t { } {
>  
>  proc check_effective_target_automatic_stack_alignment  { } {
>      # Ordinarily x86 supports automatic stack alignment ...
> -    if { [istarget i?86*-*-*] || [istarget x86_64-*-*] } then {
> +    if { [check_effective_target_x86] } then {
>       if { [istarget *-*-mingw*] || [istarget *-*-cygwin*] } {
>           # ... except Win64 SEH doesn't.  Succeed for Win32 though.
>           return [check_effective_target_ilp32];
> @@ -10792,7 +10797,7 @@ proc check_effective_target_avx512f { } {
>  # Return 1 if avx instructions can be compiled.
>  
>  proc check_effective_target_avx { } {
> -    if { !([istarget i?86-*-*] || [istarget x86_64-*-*]) } {
> +    if { !([check_effective_target_x86]) } {
>       return 0
>      }
>      return [check_no_compiler_messages avx object {
> @@ -11389,7 +11394,7 @@ proc check_effective_target_avx512bw { } {
>  
>  # Return 1 if -Wa,-march=+noavx512bw is supported.
>  proc check_effective_target_assembler_march_noavx512bw {} {
> -    if { [istarget i?86*-*-*] || [istarget x86_64*-*-*] } {
> +    if { [check_effective_target_x86] } {
>       return [check_no_compiler_messages assembler_march_noavx512bw object {
>           void foo (void) {}
>       } "-mno-avx512bw -Wa,-march=+noavx512bw"]
> @@ -12145,7 +12150,7 @@ proc check_vect_support_and_set_flags { } {
>           }
>           set dg-do-what-default compile
>       }
> -    } elseif { [istarget i?86-*-*] || [istarget x86_64-*-*] } {
> +    } elseif { [check_effective_target_x86] } {
>       lappend DEFAULT_VECTCFLAGS "-msse2"
>       if { [check_effective_target_sse2_runtime] } {
>           set dg-do-what-default run
> @@ -12607,7 +12612,7 @@ proc check_effective_target_branch_cost {} {
>        || [istarget csky*-*-*]
>        || [istarget epiphany*-*-*]
>        || [istarget frv*-*-*]
> -      || [istarget i?86-*-*] || [istarget x86_64-*-*]
> +      || [check_effective_target_x86]
>        || [istarget loongarch*-*-*]
>        || [istarget mips*-*-*]
>        || [istarget s390*-*-*]
> @@ -12664,7 +12669,7 @@ proc check_effective_target_pie_copyreloc { } {
>      global tool
>      global GCC_UNDER_TEST
>  
> -    if { !([istarget i?86-*-*] || [istarget x86_64-*-*]) } {
> +    if { !([check_effective_target_x86]) } {
>       return 0
>      }
>  
> @@ -12711,7 +12716,7 @@ proc check_effective_target_code_6_gottpoff_reloc { } 
> {
>      global tool
>      global GCC_UNDER_TEST
>  
> -    if { !([istarget i?86-*-*] || [istarget x86_64-*-*]) } {
> +    if { !([check_effective_target_x86]) } {
>       return 0
>      }
>  
> @@ -12759,7 +12764,7 @@ proc check_effective_target_got32x_reloc { } {
>      global tool
>      global GCC_UNDER_TEST
>  
> -    if { !([istarget i?86-*-*] || [istarget x86_64-*-*]) } {
> +    if { !([check_effective_target_x86]) } {
>       return 0
>      }
>  
> @@ -12807,7 +12812,7 @@ proc check_effective_target_tls_get_addr_via_got { } {
>      global tool
>      global GCC_UNDER_TEST
>  
> -    if { !([istarget i?86-*-*] || [istarget x86_64-*-*]) } {
> +    if { !([check_effective_target_x86]) } {
>       return 0
>      }
>  
> @@ -13015,7 +13020,7 @@ proc check_effective_target_divmod { } {
>      #TODO: Add checks for all targets that have either hardware divmod insn
>      # or define libfunc for divmod.
>      if { [istarget arm*-*-*]
> -      || [istarget i?86-*-*] || [istarget x86_64-*-*]
> +      || [check_effective_target_x86]
>        || [istarget amdgcn-*-*] } {
>       return 1
>      }
> @@ -13171,7 +13176,7 @@ proc check_effective_target_autoincdec { } {
>  #
>  proc check_effective_target_supports_stack_clash_protection { } {
>  
> -    if { [istarget x86_64-*-*] || [istarget i?86-*-*]
> +    if { [check_effective_target_x86] 
>         || [istarget powerpc*-*-*] || [istarget rs6000*-*-*]
>         || [istarget aarch64*-**] || [istarget s390*-*-*]
>         || [istarget loongarch64*-**] || [istarget riscv64*-**] } {
> @@ -13184,7 +13189,7 @@ proc 
> check_effective_target_supports_stack_clash_protection { } {
>  # Note we ignore cases where we apply tail call optimization here.
>  proc check_effective_target_frame_pointer_for_non_leaf { } {
>    # Solaris/x86 defaults to -fno-omit-frame-pointer.
> -  if { [istarget i?86-*-solaris*] || [istarget x86_64-*-solaris*] } {
> +  if { [check_effective_target_x86] && [istarget *-*-solaris*] } {
>      return 1
>    }
>  
> @@ -13236,7 +13241,7 @@ proc check_effective_target_caller_implicit_probes { 
> } {
>  
>    # On x86/x86_64 the call instruction itself pushes the return
>    # address onto the stack.  That is an implicit probe of *sp.
> -  if { [istarget x86_64-*-*] || [istarget i?86-*-*] } {
> +  if { [check_effective_target_x86] } {
>       return 1
>    }
>  
> @@ -13279,7 +13284,7 @@ proc check_effective_target_caller_implicit_probes { 
> } {
>  # stack allocations and make it difficult to elimination loops or residual
>  # allocations for dynamic stack allocations
>  proc check_effective_target_callee_realigns_stack { } {
> -  if { [istarget x86_64-*-*] || [istarget i?86-*-*] } {
> +  if { [check_effective_target_x86] } {
>       return 1
>    }
>    return 0
> @@ -13287,7 +13292,7 @@ proc check_effective_target_callee_realigns_stack { } 
> {
>  
>  # Return 1 if CET instructions can be compiled.
>  proc check_effective_target_cet { } {
> -    if { !([istarget i?86-*-*] || [istarget x86_64-*-*]) } {
> +    if { !([check_effective_target_x86]) } {
>       return 0
>      }
>      return [check_no_compiler_messages cet object {
> @@ -13541,8 +13546,8 @@ proc check_effective_target_llvm_binutils { } {
>  # Return 1 if the compiler supports '-mfentry'.
>  
>  proc check_effective_target_mfentry { } {
> -    if { !([istarget i?86-*-*] || [istarget x86_64-*-*]) } {
> -     return 0
> +    if { !([check_effective_target_x86]) } {
> +        return 0
>      }
>      return [check_no_compiler_messages mfentry object {
>               void foo (void) { }
> @@ -13794,7 +13799,7 @@ proc check_effective_target_powerpc_as_p10_htm { } {
>  
>  proc check_effective_target_lra { } {
>      # Start with heavily used targets which are known to always use LRA.
> -    if { [istarget i?86-*-*] || [istarget x86_64-*-*]
> +    if { [check_effective_target_x86]
>        || [istarget aarch64*-*-*] || [istarget arm*-*-*]
>        || [istarget powerpc*-*-*] || [istarget riscv*-*-*] } {
>       return 1
> @@ -14100,10 +14105,9 @@ proc dg-require-python-h { args } {
>  # Return 1 if the target supports heap-trampoline, 0 otherwise.
>  proc check_effective_target_heap_trampoline {} {
>      if { [istarget aarch64*-*-linux*]
> -      || [istarget i?86-*-darwin*]
> -      || [istarget x86_64-*-darwin*]
> -      || [istarget i?86-*-linux*]
> -      || [istarget x86_64-*-linux*] } {
> +      || ([check_effective_target_x86]
> +          && ([istarget *-*-darwin*]
> +              || [istarget *-*-linux*])) } {
>       return 1
>      }
>      return 0

Reply via email to