From bf71de9423d91ced56ff240ee73e928353a92a0a Mon Sep 17 00:00:00 2001 From: Uros Bizjak Date: Fri, 25 Nov 2011 18:41:44 +0100 Subject: [PATCH] re PR testsuite/51258 (64-bit gcc.dg/atomic-compare-exchange-5.c link failure on 32-bit Solaris/x86) PR testsuite/51258 * lib/target-supports.exp (check_effective_target_sync_int_128_runtime): New procedure. (check_effective_target_sync_long_long_runtime): Ditto. (check_effective_target_sync_long_long): Add arm*-*-*. (check_effective_target_sync_longlong): Remove. * gcc.dg/atomic-op-5.c: Require sync_int_128_runtime effective target. * gcc.dg/atomic-compare-exchange-5.c: Ditto. * gcc.dg/atomic-exchange-5.c: Ditto. * gcc.dg/atomic-load-5.c: Ditto. * gcc.dg/atomic-store-5.c: Ditto. * gcc.dg/simulate-thread/atomic-load-int128.c: Ditto. * gcc.dg/simulate-thread/atomic-other-int128.c: Ditto. * gcc.dg/atomic-op-4.c: Require sync_long_long_runtime effective target. * gcc.dg/atomic-compare-exchange-4.c: Ditto. * gcc.dg/atomic-exchange-4.c: Ditto. * gcc.dg/atomic-load-4.c: Ditto. * gcc.dg/atomic-store-4.c: Ditto. * gcc.dg/di-longlong64-sync-1.c: Ditto. * gcc.dg/di-sync-multithread.c: Ditto. * gcc.dg/simulate-thread/atomic-load-longlong.c: Ditto. * gcc.dg/simulate-thread/atomic-other-longlong.c: Ditto. From-SVN: r181727 --- gcc/ChangeLog | 12 +-- gcc/testsuite/ChangeLog | 33 ++++++- .../gcc.dg/atomic-compare-exchange-4.c | 2 +- .../gcc.dg/atomic-compare-exchange-5.c | 2 +- gcc/testsuite/gcc.dg/atomic-exchange-4.c | 2 +- gcc/testsuite/gcc.dg/atomic-exchange-5.c | 2 +- gcc/testsuite/gcc.dg/atomic-load-4.c | 2 +- gcc/testsuite/gcc.dg/atomic-load-5.c | 2 +- gcc/testsuite/gcc.dg/atomic-op-4.c | 2 +- gcc/testsuite/gcc.dg/atomic-op-5.c | 2 +- gcc/testsuite/gcc.dg/atomic-store-4.c | 2 +- gcc/testsuite/gcc.dg/atomic-store-5.c | 2 +- gcc/testsuite/gcc.dg/di-longlong64-sync-1.c | 2 +- gcc/testsuite/gcc.dg/di-sync-multithread.c | 2 +- .../simulate-thread/atomic-load-int128.c | 2 +- .../simulate-thread/atomic-load-longlong.c | 2 +- .../simulate-thread/atomic-other-int128.c | 2 +- .../simulate-thread/atomic-other-longlong.c | 2 +- gcc/testsuite/lib/target-supports.exp | 90 +++++++++++++------ 19 files changed, 117 insertions(+), 50 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index fc0394d4a36..7dbd9a89c46 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -82,11 +82,12 @@ 2011-11-24 Razya Ladelsky - * tree-data-ref.c (initialize_data_dependence_relation): Update + * tree-data-ref.c (initialize_data_dependence_relation): Update comment for the self dependence case. (compute_self_dependence): Remove. - * tree-vect-data-refs.c (vect_analyze_data_refs): Remove call to - compute_self_dependenc. + * tree-vect-data-refs.c (vect_analyze_data_refs): Remove call to + compute_self_dependenc. + 2011-11-24 Alan Modra * c-decl.c (warn_if_shadowing): Don't warn if shadowed @@ -144,7 +145,7 @@ (sync_compare_and_swap): Remove. (sync_lock_release): Remove. - * config/ia64/ia64.md: Use define_e_enum for UNSPEC_* + * config/ia64/ia64.md: Use define_c_enum for UNSPEC_* and UNSPECV_* constants. 2011-11-22 Tom de Vries @@ -165,7 +166,8 @@ 2011-11-21 Aldy Hernandez * opts.c (finish_options): Do not fail for -fgnu-tm. - * gimple-streamer-out.c (output_gimple_stmt): Handle GIMPLE_TRANSACTION. + * gimple-streamer-out.c (output_gimple_stmt): Handle + GIMPLE_TRANSACTION. * gimple-streamer-in.c (input_gimple_stmt): Same. * lto-cgraph.c (input_overwrite_node): Read tm_clone bit. (lto_output_node): Write tm_clone bit. diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 34d262f3427..e53a713fe48 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,30 @@ +2011-11-25 Uros Bizjak + + PR testsuite/51258 + * lib/target-supports.exp + (check_effective_target_sync_int_128_runtime): New procedure. + (check_effective_target_sync_long_long_runtime): Ditto. + (check_effective_target_sync_long_long): Add arm*-*-*. + (check_effective_target_sync_longlong): Remove. + + * gcc.dg/atomic-op-5.c: Require sync_int_128_runtime effective target. + * gcc.dg/atomic-compare-exchange-5.c: Ditto. + * gcc.dg/atomic-exchange-5.c: Ditto. + * gcc.dg/atomic-load-5.c: Ditto. + * gcc.dg/atomic-store-5.c: Ditto. + * gcc.dg/simulate-thread/atomic-load-int128.c: Ditto. + * gcc.dg/simulate-thread/atomic-other-int128.c: Ditto. + * gcc.dg/atomic-op-4.c: Require sync_long_long_runtime + effective target. + * gcc.dg/atomic-compare-exchange-4.c: Ditto. + * gcc.dg/atomic-exchange-4.c: Ditto. + * gcc.dg/atomic-load-4.c: Ditto. + * gcc.dg/atomic-store-4.c: Ditto. + * gcc.dg/di-longlong64-sync-1.c: Ditto. + * gcc.dg/di-sync-multithread.c: Ditto. + * gcc.dg/simulate-thread/atomic-load-longlong.c: Ditto. + * gcc.dg/simulate-thread/atomic-other-longlong.c: Ditto. + 2011-11-25 Tobias Burnus PR fortran/50408 @@ -12,7 +39,7 @@ PR c/51256 * gcc.dg/atomic-pr51256.c: New. Test error conditions. - + 2011-11-24 Paolo Carlini PR c++/51227 @@ -104,8 +131,8 @@ 2011-11-22 Matthew Gretton-Dann - * gcc.dg/vshift-1.c (main): Call rand instead of random. - * gcc.dg/vshift-3.c (main): Likewise. + * gcc.dg/vshift-1.c (main): Call rand instead of random. + * gcc.dg/vshift-3.c (main): Likewise. 2011-11-22 Iain Sandoe diff --git a/gcc/testsuite/gcc.dg/atomic-compare-exchange-4.c b/gcc/testsuite/gcc.dg/atomic-compare-exchange-4.c index d89e72f8171..2b34f0a56be 100644 --- a/gcc/testsuite/gcc.dg/atomic-compare-exchange-4.c +++ b/gcc/testsuite/gcc.dg/atomic-compare-exchange-4.c @@ -1,7 +1,7 @@ /* Test __atomic routines for existence and proper execution on 8 byte values with each valid memory model. */ /* { dg-do run } */ -/* { dg-require-effective-target sync_long_long } */ +/* { dg-require-effective-target sync_long_long_runtime } */ /* { dg-options "" } */ /* Test the execution of __atomic_compare_exchange_n builtin for a long_long. */ diff --git a/gcc/testsuite/gcc.dg/atomic-compare-exchange-5.c b/gcc/testsuite/gcc.dg/atomic-compare-exchange-5.c index c7390408c7e..4cc0209b33f 100644 --- a/gcc/testsuite/gcc.dg/atomic-compare-exchange-5.c +++ b/gcc/testsuite/gcc.dg/atomic-compare-exchange-5.c @@ -1,7 +1,7 @@ /* Test __atomic routines for existence and proper execution on 16 byte values with each valid memory model. */ /* { dg-do run } */ -/* { dg-require-effective-target sync_int_128 } */ +/* { dg-require-effective-target sync_int_128_runtime } */ /* { dg-options "-mcx16" { target { i?86-*-* x86_64-*-* } } } */ /* Test the execution of __atomic_compare_exchange_n builtin for an int_128. */ diff --git a/gcc/testsuite/gcc.dg/atomic-exchange-4.c b/gcc/testsuite/gcc.dg/atomic-exchange-4.c index f0530fc462c..0c564fd9ba2 100644 --- a/gcc/testsuite/gcc.dg/atomic-exchange-4.c +++ b/gcc/testsuite/gcc.dg/atomic-exchange-4.c @@ -1,7 +1,7 @@ /* Test __atomic routines for existence and proper execution on 8 byte values with each valid memory model. */ /* { dg-do run } */ -/* { dg-require-effective-target sync_long_long } */ +/* { dg-require-effective-target sync_long_long_runtime } */ /* { dg-options "" } */ /* Test the execution of the __atomic_X builtin for a long_long. */ diff --git a/gcc/testsuite/gcc.dg/atomic-exchange-5.c b/gcc/testsuite/gcc.dg/atomic-exchange-5.c index 5a0524059b0..b0c84b17fd3 100644 --- a/gcc/testsuite/gcc.dg/atomic-exchange-5.c +++ b/gcc/testsuite/gcc.dg/atomic-exchange-5.c @@ -1,7 +1,7 @@ /* Test __atomic routines for existence and proper execution on 16 byte values with each valid memory model. */ /* { dg-do run } */ -/* { dg-require-effective-target sync_int_128 } */ +/* { dg-require-effective-target sync_int_128_runtime } */ /* { dg-options "-mcx16" { target { i?86-*-* x86_64-*-* } } } */ /* Test the execution of the __atomic_X builtin for a 16 byte value. */ diff --git a/gcc/testsuite/gcc.dg/atomic-load-4.c b/gcc/testsuite/gcc.dg/atomic-load-4.c index 5cb7659da70..952342949ca 100644 --- a/gcc/testsuite/gcc.dg/atomic-load-4.c +++ b/gcc/testsuite/gcc.dg/atomic-load-4.c @@ -1,7 +1,7 @@ /* Test __atomic routines for existence and proper execution on 8 byte values with each valid memory model. */ /* { dg-do run } */ -/* { dg-require-effective-target sync_long_long } */ +/* { dg-require-effective-target sync_long_long_runtime } */ /* { dg-options "" } */ extern void abort(void); diff --git a/gcc/testsuite/gcc.dg/atomic-load-5.c b/gcc/testsuite/gcc.dg/atomic-load-5.c index 5692d133a43..31d806633e1 100644 --- a/gcc/testsuite/gcc.dg/atomic-load-5.c +++ b/gcc/testsuite/gcc.dg/atomic-load-5.c @@ -1,7 +1,7 @@ /* Test __atomic routines for existence and proper execution on 16 byte values with each valid memory model. */ /* { dg-do run } */ -/* { dg-require-effective-target sync_int_128 } */ +/* { dg-require-effective-target sync_int_128_runtime } */ /* { dg-options "-mcx16" { target { i?86-*-* x86_64-*-* } } } */ extern void abort(void); diff --git a/gcc/testsuite/gcc.dg/atomic-op-4.c b/gcc/testsuite/gcc.dg/atomic-op-4.c index 39650213edf..786b0bb7cf5 100644 --- a/gcc/testsuite/gcc.dg/atomic-op-4.c +++ b/gcc/testsuite/gcc.dg/atomic-op-4.c @@ -1,7 +1,7 @@ /* Test __atomic routines for existence and proper execution on 8 byte values with each valid memory model. */ /* { dg-do run } */ -/* { dg-require-effective-target sync_long_long } */ +/* { dg-require-effective-target sync_long_long_runtime } */ /* { dg-options "" } */ /* Test the execution of the __atomic_*OP builtin routines for long long. */ diff --git a/gcc/testsuite/gcc.dg/atomic-op-5.c b/gcc/testsuite/gcc.dg/atomic-op-5.c index e63ab25877b..e78d8150997 100644 --- a/gcc/testsuite/gcc.dg/atomic-op-5.c +++ b/gcc/testsuite/gcc.dg/atomic-op-5.c @@ -1,7 +1,7 @@ /* Test __atomic routines for existence and proper execution on 16 byte values with each valid memory model. */ /* { dg-do run } */ -/* { dg-require-effective-target sync_int_128 } */ +/* { dg-require-effective-target sync_int_128_runtime } */ /* { dg-options "-mcx16" { target { i?86-*-* x86_64-*-* } } } */ /* Test the execution of the __atomic_*OP builtin routines for an int_128. */ diff --git a/gcc/testsuite/gcc.dg/atomic-store-4.c b/gcc/testsuite/gcc.dg/atomic-store-4.c index f77e1831ad8..c526c5ce185 100644 --- a/gcc/testsuite/gcc.dg/atomic-store-4.c +++ b/gcc/testsuite/gcc.dg/atomic-store-4.c @@ -1,7 +1,7 @@ /* Test __atomic routines for existence and proper execution on 8 byte values with each valid memory model. */ /* { dg-do run } */ -/* { dg-require-effective-target sync_long_long } */ +/* { dg-require-effective-target sync_long_long_runtime } */ /* { dg-options "" } */ /* Test the execution of the __atomic_store_n builtin for a long long. */ diff --git a/gcc/testsuite/gcc.dg/atomic-store-5.c b/gcc/testsuite/gcc.dg/atomic-store-5.c index a21e70c2c6c..763d29e240c 100644 --- a/gcc/testsuite/gcc.dg/atomic-store-5.c +++ b/gcc/testsuite/gcc.dg/atomic-store-5.c @@ -1,7 +1,7 @@ /* Test __atomic routines for existence and proper execution on 16 byte values with each valid memory model. */ /* { dg-do run } */ -/* { dg-require-effective-target sync_int_128 } */ +/* { dg-require-effective-target sync_int_128_runtime } */ /* { dg-options "-mcx16" { target { i?86-*-* x86_64-*-* } } } */ /* Test the execution of the __atomic_store_n builtin for a 16 byte value. */ diff --git a/gcc/testsuite/gcc.dg/di-longlong64-sync-1.c b/gcc/testsuite/gcc.dg/di-longlong64-sync-1.c index 82a4ea24617..9bb31ba649c 100644 --- a/gcc/testsuite/gcc.dg/di-longlong64-sync-1.c +++ b/gcc/testsuite/gcc.dg/di-longlong64-sync-1.c @@ -1,5 +1,5 @@ /* { dg-do run } */ -/* { dg-require-effective-target sync_longlong } */ +/* { dg-require-effective-target sync_long_long_runtime } */ /* { dg-options "-std=gnu99" } */ /* { dg-message "note: '__sync_fetch_and_nand' changed semantics in GCC 4.4" "" { target *-*-* } 0 } */ /* { dg-message "note: '__sync_nand_and_fetch' changed semantics in GCC 4.4" "" { target *-*-* } 0 } */ diff --git a/gcc/testsuite/gcc.dg/di-sync-multithread.c b/gcc/testsuite/gcc.dg/di-sync-multithread.c index c99878ea129..3cd93b0f3f5 100644 --- a/gcc/testsuite/gcc.dg/di-sync-multithread.c +++ b/gcc/testsuite/gcc.dg/di-sync-multithread.c @@ -1,5 +1,5 @@ /* { dg-do run } */ -/* { dg-require-effective-target sync_longlong } */ +/* { dg-require-effective-target sync_long_long_runtime } */ /* { dg-require-effective-target pthread_h } */ /* { dg-require-effective-target pthread } */ /* { dg-options "-pthread -std=gnu99" } */ diff --git a/gcc/testsuite/gcc.dg/simulate-thread/atomic-load-int128.c b/gcc/testsuite/gcc.dg/simulate-thread/atomic-load-int128.c index 3ade0d6fad3..c5aa623e685 100644 --- a/gcc/testsuite/gcc.dg/simulate-thread/atomic-load-int128.c +++ b/gcc/testsuite/gcc.dg/simulate-thread/atomic-load-int128.c @@ -1,5 +1,5 @@ /* { dg-do link } */ -/* { dg-require-effective-target sync_int_128 } */ +/* { dg-require-effective-target sync_int_128_runtime } */ /* { dg-options "-mcx16" { target { x86_64-*-* i?86-*-* } } } */ /* { dg-final { simulate-thread } } */ diff --git a/gcc/testsuite/gcc.dg/simulate-thread/atomic-load-longlong.c b/gcc/testsuite/gcc.dg/simulate-thread/atomic-load-longlong.c index 8bc2eaace65..c555c4c26d9 100644 --- a/gcc/testsuite/gcc.dg/simulate-thread/atomic-load-longlong.c +++ b/gcc/testsuite/gcc.dg/simulate-thread/atomic-load-longlong.c @@ -1,5 +1,5 @@ /* { dg-do link } */ -/* { dg-require-effective-target sync_long_long } */ +/* { dg-require-effective-target sync_long_long_runtime } */ /* { dg-options "" } */ /* { dg-final { simulate-thread } } */ diff --git a/gcc/testsuite/gcc.dg/simulate-thread/atomic-other-int128.c b/gcc/testsuite/gcc.dg/simulate-thread/atomic-other-int128.c index 4898c3bbdda..6aaaa88ef04 100644 --- a/gcc/testsuite/gcc.dg/simulate-thread/atomic-other-int128.c +++ b/gcc/testsuite/gcc.dg/simulate-thread/atomic-other-int128.c @@ -1,5 +1,5 @@ /* { dg-do link } */ -/* { dg-require-effective-target sync_int_128 } */ +/* { dg-require-effective-target sync_int_128_runtime } */ /* { dg-options "-mcx16" { target { x86_64-*-* i?86-*-* } } } */ /* { dg-final { simulate-thread } } */ diff --git a/gcc/testsuite/gcc.dg/simulate-thread/atomic-other-longlong.c b/gcc/testsuite/gcc.dg/simulate-thread/atomic-other-longlong.c index ac4330bd8a4..3cffbb47aae 100644 --- a/gcc/testsuite/gcc.dg/simulate-thread/atomic-other-longlong.c +++ b/gcc/testsuite/gcc.dg/simulate-thread/atomic-other-longlong.c @@ -1,5 +1,5 @@ /* { dg-do link } */ -/* { dg-require-effective-target sync_long_long } */ +/* { dg-require-effective-target sync_long_long_runtime } */ /* { dg-options "" } */ /* { dg-final { simulate-thread } } */ diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp index cd013336bda..49f2d32ecf8 100644 --- a/gcc/testsuite/lib/target-supports.exp +++ b/gcc/testsuite/lib/target-supports.exp @@ -3620,17 +3620,80 @@ proc check_effective_target_sync_int_128 { } { } } +# Return 1 if the target supports atomic operations on "int_128" values +# 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 { + check_runtime_nocache sync_int_128_available { + #include "cpuid.h" + int main () + { + unsigned int eax, ebx, ecx, edx; + if (__get_cpuid (1, &eax, &ebx, &ecx, &edx)) + return !(ecx & bit_CMPXCHG16B); + return 1; + } + } "" + }] + } else { + return 0 + } +} + # Return 1 if the target supports atomic operations on "long long". proc check_effective_target_sync_long_long { } { if { ([istarget x86_64-*-*] || [istarget i?86-*-*]) - && ![is-effective-target ia32] } { + && ![is-effective-target ia32] + || [istarget arm*-*-*] } { return 1 } else { return 0 } } +# Return 1 if the target supports atomic operations on "long long" +# and can execute them. + +proc check_effective_target_sync_long_long_runtime { } { + if { ([istarget x86_64-*-*] || [istarget i?86-*-*]) + && ![is-effective-target ia32] } { + return [check_cached_effective_target sync_long_long_available { + check_runtime_nocache sync_long_long_available { + #include "cpuid.h" + int main () + { + unsigned int eax, ebx, ecx, edx; + if (__get_cpuid (1, &eax, &ebx, &ecx, &edx)) + return !(edx & bit_CMPXCHG8B); + return 1; + } + } "" + }] + } elseif { [istarget arm*-*-linux-gnueabi] } { + return [check_runtime sync_longlong_runtime { + #include + int main () + { + long long l1; + + 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"); + + exit (0); + } + } "" ] + } else { + return 0 + } +} + # Return 1 if the target supports atomic operations on "int" and "long". proc check_effective_target_sync_int_long { } { @@ -3662,31 +3725,6 @@ proc check_effective_target_sync_int_long { } { return $et_sync_int_long_saved } -# Return 1 if the target supports atomic operations on "long long" and can -# execute them -# So far only put checks in for ARM, others may want to add their own -proc check_effective_target_sync_longlong { } { - return [check_runtime sync_longlong_runtime { - #include - int main () - { - long long l1; - - if (sizeof (long long) != 8) - exit (1); - - #ifdef __arm__ - /* Just check for native; checking for kernel fallback is tricky. */ - asm volatile ("ldrexd r0,r1, [%0]" : : "r" (&l1) : "r0", "r1"); - #else - # error "Add other suitable archs here" - #endif - - exit (0); - } - } "" ] -} - # Return 1 if the target supports atomic operations on "char" and "short". proc check_effective_target_sync_char_short { } {