re PR testsuite/51258 (64-bit gcc.dg/atomic-compare-exchange-5.c link failure on...
authorUros Bizjak <uros@gcc.gnu.org>
Fri, 25 Nov 2011 17:41:44 +0000 (18:41 +0100)
committerUros Bizjak <uros@gcc.gnu.org>
Fri, 25 Nov 2011 17:41:44 +0000 (18:41 +0100)
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

19 files changed:
gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/atomic-compare-exchange-4.c
gcc/testsuite/gcc.dg/atomic-compare-exchange-5.c
gcc/testsuite/gcc.dg/atomic-exchange-4.c
gcc/testsuite/gcc.dg/atomic-exchange-5.c
gcc/testsuite/gcc.dg/atomic-load-4.c
gcc/testsuite/gcc.dg/atomic-load-5.c
gcc/testsuite/gcc.dg/atomic-op-4.c
gcc/testsuite/gcc.dg/atomic-op-5.c
gcc/testsuite/gcc.dg/atomic-store-4.c
gcc/testsuite/gcc.dg/atomic-store-5.c
gcc/testsuite/gcc.dg/di-longlong64-sync-1.c
gcc/testsuite/gcc.dg/di-sync-multithread.c
gcc/testsuite/gcc.dg/simulate-thread/atomic-load-int128.c
gcc/testsuite/gcc.dg/simulate-thread/atomic-load-longlong.c
gcc/testsuite/gcc.dg/simulate-thread/atomic-other-int128.c
gcc/testsuite/gcc.dg/simulate-thread/atomic-other-longlong.c
gcc/testsuite/lib/target-supports.exp

index fc0394d4a36c0f6b0cb410b8c7f117edcb3a4bd5..7dbd9a89c464a795177715c2de2f48e7347fd7a3 100644 (file)
 
 2011-11-24  Razya Ladelsky  <razya@il.ibm.com>
 
-       * 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  <amodra@gmail.com>
 
        * c-decl.c (warn_if_shadowing): Don't warn if shadowed
        (sync_compare_and_swap<IMODE>): Remove.
        (sync_lock_release<IMODE>): 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  <tom@codesourcery.com>
 2011-11-21  Aldy Hernandez  <aldyh@redhat.com>
 
        * 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.
index 34d262f3427dfa1ae81d46d7854ece52ca5f9eb2..e53a713fe48239c70b99bd250dc428f0ce702b4f 100644 (file)
@@ -1,3 +1,30 @@
+2011-11-25  Uros Bizjak  <ubizjak@gmail.com>
+
+       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  <burnus@net-b.de>
 
        PR fortran/50408
@@ -12,7 +39,7 @@
 
        PR c/51256
        * gcc.dg/atomic-pr51256.c: New.  Test error conditions.
-       
+
 2011-11-24  Paolo Carlini  <paolo.carlini@oracle.com>
 
        PR c++/51227
 
 2011-11-22  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
 
-        * 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  <iains@gcc.gnu.org>
 
index d89e72f81713d087f7d494c5b38ede20bfbfd653..2b34f0a56be18fb483c590eeb899d8ba81e5e6da 100644 (file)
@@ -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.  */
index c7390408c7ec546973a1ef2953190c761789bd17..4cc0209b33f96f3f78023530bc0029ae521d7f18 100644 (file)
@@ -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.  */
index f0530fc462ce09a59f598acdd9ca378e4bf61bb4..0c564fd9ba27d3f4f11785f474ff3484e717690c 100644 (file)
@@ -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.  */
index 5a0524059b05fd5f6ed34312ee802a74ce14be65..b0c84b17fd32c2f66080dc346fff1919d3eaa36a 100644 (file)
@@ -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.  */
index 5cb7659da70b023abf03a9e3501fc91c2c4c3bff..952342949ca87d4e07635b7fecbe91442cdea824 100644 (file)
@@ -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);
index 5692d133a43078aa1ec93fc67eff84d1bf6aa271..31d806633e1c670e3763b98d01db8a18c47afa90 100644 (file)
@@ -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);
index 39650213edf018aa53d05589901bfdfb00265691..786b0bb7cf58d4f4b5497ea176500145d8429c9e 100644 (file)
@@ -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.  */
index e63ab25877bbd537283346182b077a0b2e4935ba..e78d81509978c57acff5d79109143343fed41a62 100644 (file)
@@ -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.  */
index f77e1831ad8f27440fb1ee52a35ff5b9f27d8f8c..c526c5ce185a0334f3627d0f940e215dead73022 100644 (file)
@@ -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.  */
index a21e70c2c6c82178bda54f9cbe9b059c9fdddd83..763d29e240cfa36bf0ceb3a47c38ffd45d6fffa5 100644 (file)
@@ -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.  */
index 82a4ea246174c705ed363d98dec2c3fdfb967cdf..9bb31ba649cf55372526d1661896576a62979966 100644 (file)
@@ -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 } */
index c99878ea1294cae17d2e11e7c8dfcdd4ee57560d..3cd93b0f3f5d8e1f99fcb8b6ca53654a645d9984 100644 (file)
@@ -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" } */
index 3ade0d6fad39ef0a9eb485032ec4058bcf096529..c5aa623e685153e37982b8e3d34fec4443fcce19 100644 (file)
@@ -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 } } */
 
index 8bc2eaace651dc90ed5580445229bfdc038d9377..c555c4c26d9e971b44ae5d810d6e36dcbbc578cf 100644 (file)
@@ -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 } } */
 
index 4898c3bbddabf6e60d1d43b631bc2be1e0781e73..6aaaa88ef0494632befed5cc8dc72e0feecd4822 100644 (file)
@@ -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 } } */
 
index ac4330bd8a45471fad24fa506fcee67ecf195f27..3cffbb47aae8d1d2a3b0e8b4a0c89b5c3b47c2ca 100644 (file)
@@ -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 } } */
 
index cd013336bdaa62b78cf81a1c9bb10862e5961039..49f2d32ecf8fc8f72fd22da1fb53866bc5fbe054 100644 (file)
@@ -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 <stdlib.h>
+           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 <stdlib.h>
-      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 { } {