... simplify some conditions and add i?86-*-* target where missing. 2016-11-01 Uros Bizjak <ubiz...@gmail.com>
* lib/target-supports.exp: Normalize order of i?86 and x86_64 targets. Whitespace fixes. (check_effective_target_vect_cmdline_needed): Check is-effective-target ia32 for x86 targets. (check_effective_target_vect_simd_clones): Simplify condition. (check_effective_target_vect_double): Ditto. (check_effective_target_vect_aligned_arrays): Check is-effective-target ia32 for x86 targets. Simplify condition. (check_effective_target_vect_multiple_sizes): Simplify condition. (check_effective_target_sqrt_insn): Add i?86-*-* target. (check_effective_target_sync_int_128): Simplify condition. (check_effective_target_sync_int_128_runtime): Ditto. (check_effective_target_sync_long_long_runtime): Ditto. (check_effective_target_divmod): Add i?86-*-* target. Tested on x86_64-linux-gnu {,-m32} and commited to mainline SVN. Uros.
Index: lib/target-supports.exp =================================================================== --- lib/target-supports.exp (revision 241701) +++ lib/target-supports.exp (working copy) @@ -533,7 +533,7 @@ } if { $test_what == "-fauto-profile" } { - if { ! ([istarget x86_64-*-linux*] || [istarget i?86-*-linux*]) } { + if { !([istarget i?86-*-linux*] || [istarget x86_64-*-linux*]) } { verbose "autofdo only supported on linux" return 0 } @@ -1521,7 +1521,7 @@ 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 x86_64-*-*] || [istarget i?86-*-*]) } { + if { !([istarget i?86-*-*] || [istarget x86_64-*-*]) } { expr 0 } elseif { [istarget i?86-*-solaris2*] } { # The Solaris 2 kernel doesn't save and restore SSE registers @@ -1545,7 +1545,7 @@ 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 x86_64-*-*] || [istarget i?86-*-*]) } { + if { !([istarget i?86-*-*] || [istarget x86_64-*-*]) } { expr 0 } else { # Check that OS has AVX and SSE saving enabled. @@ -1568,7 +1568,7 @@ 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 x86_64-*-*] || [istarget i?86-*-*]) } { + if { !([istarget i?86-*-*] || [istarget x86_64-*-*]) } { expr 0 } else { check_runtime_nocache sse_hw_available { @@ -1668,7 +1668,7 @@ 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 x86_64-*-*] || [istarget i?86-*-*]) } { + if { !([istarget i?86-*-*] || [istarget x86_64-*-*]) } { expr 0 } else { check_runtime_nocache sse2_hw_available { @@ -1691,7 +1691,7 @@ 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 x86_64-*-*] || [istarget i?86-*-*]) } { + if { !([istarget i?86-*-*] || [istarget x86_64-*-*]) } { expr 0 } else { check_runtime_nocache sse4_hw_available { @@ -1714,7 +1714,7 @@ 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 x86_64-*-*] || [istarget i?86-*-*]) } { + if { !([istarget i?86-*-*] || [istarget x86_64-*-*]) } { expr 0 } else { check_runtime_nocache avx_hw_available { @@ -2619,8 +2619,7 @@ return [check_ppc_float128_sw_available] } if { [istarget ia64-*-*] - || [istarget i?86-*-*] - || [istarget x86_64-*-*] } { + || [istarget i?86-*-*] || [istarget x86_64-*-*] } { return 1 } return 0 @@ -2776,9 +2775,8 @@ set et_vect_cmdline_needed_saved 1 if { [istarget alpha*-*-*] || [istarget ia64-*-*] - || (([istarget x86_64-*-*] || [istarget i?86-*-*]) - && ([check_effective_target_x32] - || [check_effective_target_lp64])) + || (([istarget i?86-*-*] || [istarget x86_64-*-*]) + && ![is-effective-target ia32]) || ([istarget powerpc*-*-*] && ([check_effective_target_powerpc_spe] || [check_effective_target_powerpc_altivec])) @@ -2966,16 +2964,15 @@ verbose "check_effective_target_vect_simd_clones: using cached result" 2 } else { set et_vect_simd_clones_saved($et_index) 0 - if { [istarget i?86-*-*] || [istarget x86_64-*-*] } { - # On i?86/x86_64 #pragma omp declare simd builds a sse2, avx, avx2 - # and avx512f clone. Only the right clone for the specified arch - # will be chosen, but still we need to at least be able to assemble - # avx512f. - if { [check_effective_target_avx512f] } { + # On i?86/x86_64 #pragma omp declare simd builds a sse2, avx, + # avx2 and avx512f clone. Only the right clone for the + # specified arch will be chosen, but still we need to at least + # be able to assemble avx512f. + if { (([istarget i?86-*-*] || [istarget x86_64-*-*]) + && [check_effective_target_avx512f]) } { set et_vect_simd_clones_saved($et_index) 1 } } - } verbose "check_effective_target_vect_simd_clones:\ returning $et_vect_simd_clones_saved($et_index)" 2 @@ -4926,18 +4923,14 @@ verbose "check_effective_target_vect_double: using cached result" 2 } else { set et_vect_double_saved($et_index) 0 - if { [istarget i?86-*-*] || [istarget x86_64-*-*] - || [istarget aarch64*-*-*] } { - if { [check_no_compiler_messages vect_double assembly { + if { (([istarget i?86-*-*] || [istarget x86_64-*-*]) + && [check_no_compiler_messages vect_double assembly { #ifdef __tune_atom__ # error No double vectorizer support. #endif - }] } { - set et_vect_double_saved($et_index) 1 - } else { - set et_vect_double_saved($et_index) 0 - } - } elseif { [istarget spu-*-*] + }]) + || [istarget aarch64*-*-*] + || [istarget spu-*-*] || ([istarget powerpc*-*-*] && [check_vsx_hw_available]) || ([istarget mips*-*-*] && [et-is-effective-target mips_msa]) } { @@ -5520,7 +5513,7 @@ verbose "check_effective_target_vect_usad_char: using cached result" 2 } else { set et_vect_usad_char_saved($et_index) 0 - if { ([istarget i?86-*-*] || [istarget x86_64-*-*]) } { + if { [istarget i?86-*-*] || [istarget x86_64-*-*] } { set et_vect_usad_char_saved($et_index) 1 } } @@ -5665,16 +5658,13 @@ proc check_effective_target_vect_aligned_arrays { } { set et_vect_aligned_arrays 0 - if { ([istarget x86_64-*-*] || [istarget i?86-*-*]) } { - if { ([is-effective-target lp64] - && ( ![check_avx_available] - || [check_prefer_avx128])) } { + if { (([istarget i?86-*-*] || [istarget x86_64-*-*]) + && !([is-effective-target ia32] + || ([check_avx_available] && ![check_prefer_avx128]))) + || [istarget spu-*-*] } { set et_vect_aligned_arrays 1 } - } - if [istarget spu-*-*] { - set et_vect_aligned_arrays 1 - } + verbose "check_effective_target_vect_aligned_arrays:\ returning $et_vect_aligned_arrays" 2 return $et_vect_aligned_arrays @@ -6034,15 +6024,12 @@ global et_index set et_vect_multiple_sizes_saved($et_index) 0 - if { ([istarget aarch64*-*-*] - || ([istarget arm*-*-*] && [check_effective_target_arm_neon_ok])) } { + if { [istarget aarch64*-*-*] + || ([istarget arm*-*-*] && [check_effective_target_arm_neon_ok]) + || (([istarget i?86-*-*] || [istarget x86_64-*-*]) + && ([check_avx_available] && ![check_prefer_avx128])) } { set et_vect_multiple_sizes_saved($et_index) 1 } - if { ([istarget x86_64-*-*] || [istarget i?86-*-*]) } { - if { ([check_avx_available] && ![check_prefer_avx128]) } { - set et_vect_multiple_sizes_saved($et_index) 1 - } - } verbose "check_effective_target_vect_multiple_sizes:\ returning $et_vect_multiple_sizes_saved($et_index)" 2 @@ -6104,7 +6091,7 @@ verbose "check_effective_target_hw_sqrt: using cached result" 2 } else { set et_sqrt_insn_saved 0 - if { [istarget x86_64-*-*] + if { [istarget i?86-*-*] || [istarget x86_64-*-*] || [istarget powerpc*-*-*] || [istarget aarch64*-*-*] || ([istarget arm*-*-*] && [check_effective_target_arm_vfp_ok]) } { @@ -6142,8 +6129,8 @@ proc check_effective_target_vect_call_lrint { } { set et_vect_call_lrint 0 - if { ([istarget i?86-*-*] || [istarget x86_64-*-*]) - && [check_effective_target_ilp32] } { + if { (([istarget i?86-*-*] || [istarget x86_64-*-*]) + && [check_effective_target_ilp32]) } { set et_vect_call_lrint 1 } @@ -6417,11 +6404,10 @@ # Return 1 if the target supports atomic operations on "int_128" values. proc check_effective_target_sync_int_128 { } { - if { ([istarget x86_64-*-*] || [istarget i?86-*-*]) - && ![is-effective-target ia32] } { + if { (([istarget i?86-*-*] || [istarget x86_64-*-*]) + && ![is-effective-target ia32]) + || [istarget spu-*-*] } { return 1 - } elseif { [istarget spu-*-*] } { - return 1 } else { return 0 } @@ -6431,9 +6417,9 @@ # and can execute them. proc check_effective_target_sync_int_128_runtime { } { - if { ([istarget x86_64-*-*] || [istarget i?86-*-*]) - && ![is-effective-target ia32] } { - return [check_cached_effective_target sync_int_128_available { + if { (([istarget i?86-*-*] || [istarget x86_64-*-*]) + && ![is-effective-target ia32] + && [check_cached_effective_target sync_int_128_available { check_runtime_nocache sync_int_128_available { #include "cpuid.h" int main () @@ -6444,8 +6430,8 @@ return 1; } } "" - }] - } elseif { [istarget spu-*-*] } { + }]) + || [istarget spu-*-*] } { return 1 } else { return 0 @@ -6458,7 +6444,7 @@ # Note: 32bit s390 targets require -mzarch in dg-options. proc check_effective_target_sync_long_long { } { - if { [istarget x86_64-*-*] || [istarget i?86-*-*]) + if { [istarget i?86-*-*] || [istarget x86_64-*-*]) || [istarget aarch64*-*-*] || [istarget arm*-*-*] || [istarget alpha*-*-*] @@ -6477,8 +6463,8 @@ # 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-*-*] } { - return [check_cached_effective_target sync_long_long_available { + if { (([istarget x86_64-*-*] || [istarget i?86-*-*]) + && [check_cached_effective_target sync_long_long_available { check_runtime_nocache sync_long_long_available { #include "cpuid.h" int main () @@ -6489,11 +6475,10 @@ return 1; } } "" - }] - } elseif { [istarget aarch64*-*-*] } { - return 1 - } elseif { [istarget arm*-*-linux-*] } { - return [check_runtime sync_longlong_runtime { + }]) + || [istarget aarch64*-*-*] + || ([istarget arm*-*-linux-*] + && [check_runtime sync_longlong_runtime { #include <stdlib.h> int main () { @@ -6502,22 +6487,20 @@ if (sizeof (long long) != 8) exit (1); - /* Just check for native; checking for kernel fallback is tricky. */ - asm volatile ("ldrexd r0,r1, [%0]" : : "r" (&l1) : "r0", "r1"); - + /* Just check for native; + checking for kernel fallback is tricky. */ + asm volatile ("ldrexd r0,r1, [%0]" + : : "r" (&l1) : "r0", "r1"); exit (0); } - } "" ] - } elseif { [istarget alpha*-*-*] } { - return 1 - } elseif { ([istarget sparc*-*-*] + } "" ]) + || [istarget alpha*-*-*] + || ([istarget sparc*-*-*] && [check_effective_target_lp64] - && [check_effective_target_ultrasparc_hw]) } { + && [check_effective_target_ultrasparc_hw]) + || [istarget spu-*-*] + || ([istarget powerpc*-*-*] && [check_effective_target_lp64]) } { return 1 - } elseif { [istarget spu-*-*] } { - return 1 - } elseif { [istarget powerpc*-*-*] && [check_effective_target_lp64] } { - return 1 } else { return 0 } @@ -6538,20 +6521,17 @@ || [istarget m68k-*-*] || [istarget powerpc*-*-*] || [istarget rs6000-*-*] - || [istarget s390*-*-*] } { - set et_bswap_saved 1 - } else { - if { [istarget arm*-*-*] + || [istarget s390*-*-*] + || ([istarget arm*-*-*] && [check_no_compiler_messages_nocache arm_v6_or_later object { #if __ARM_ARCH < 6 #error not armv6 or later #endif int i; - } ""] } { + } ""]) } { set et_bswap_saved 1 } } - } verbose "check_effective_target_bswap: returning $et_bswap_saved" 2 return $et_bswap_saved @@ -7228,7 +7208,7 @@ # Return 1 if avx instructions can be compiled. proc check_effective_target_avx { } { - if { !([istarget x86_64-*-*] || [istarget i?86-*-*]) } { + if { !([istarget i?86-*-*] || [istarget x86_64-*-*]) } { return 0 } return [check_no_compiler_messages avx object { @@ -7894,7 +7874,7 @@ global tool global GCC_UNDER_TEST - if { !([istarget x86_64-*-*] || [istarget i?86-*-*]) } { + if { !([istarget i?86-*-*] || [istarget x86_64-*-*]) } { return 0 } @@ -7946,7 +7926,7 @@ global tool global GCC_UNDER_TEST - if { !([istarget x86_64-*-*] || [istarget i?86-*-*]) } { + if { !([istarget i?86-*-*] || [istarget x86_64-*-*]) } { return 0 } @@ -7997,7 +7977,7 @@ global tool global GCC_UNDER_TEST - if { !([istarget x86_64-*-*] || [istarget i?86-*-*]) } { + if { !([istarget i?86-*-*] || [istarget x86_64-*-*]) } { return 0 } @@ -8110,7 +8090,7 @@ #TODO: Add checks for all targets that have either hardware divmod insn # or define libfunc for divmod. if { [istarget arm*-*-*] - || [istarget x86_64-*-*] } { + || [istarget i?86-*-*] || [istarget x86_64-*-*] } { return 1 } return 0