From patchwork Thu Nov 7 16:43:20 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joseph Myers X-Patchwork-Id: 289434 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 1ED0C2C008E for ; Fri, 8 Nov 2013 03:43:56 +1100 (EST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:cc:subject:message-id:mime-version:content-type; q=dns; s=default; b=TOnZbyp66OtPaaKxf8TwYTmQTC+Or0nhi8+pJN/xontYU5OvqC QBIzijiIPnfM11tuLfiMug5p9j7DHsSbpz54ImE2fc/yL0NxD6bwPNdOUbZmQCy+ 1oPgUQfX0iFBVUKeVuh3PI4sH+uNWW7nDOJhoJhkzrWsYv6Uo+trnYlFU= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:cc:subject:message-id:mime-version:content-type; s= default; bh=Xz3GsYzSnEQRiziu4be2Rdj4Zto=; b=vOFJV0dlI9xBtJ3jpPDY ouQGUAYtvfgKz+yaYVtD7Twy7dVE/4n/4eHJMltk25EadBKCPj0gLnoXftZIM2Bg juDwGGj7ysPq9TFc8torCAqIjbHpk1IYdtGrT88W7dcdZJx4l9aUwK8LjB6IdO/7 5fK2dwnl8B/oJfPkuXx6v1I= Received: (qmail 21841 invoked by alias); 7 Nov 2013 16:43:45 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 21828 invoked by uid 89); 7 Nov 2013 16:43:45 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=2.3 required=5.0 tests=AWL, BAYES_50, RDNS_NONE, SPAM_SUBJECT, URIBL_BLOCKED autolearn=no version=3.3.2 X-HELO: relay1.mentorg.com Received: from Unknown (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 07 Nov 2013 16:43:41 +0000 Received: from svr-orw-exc-10.mgc.mentorg.com ([147.34.98.58]) by relay1.mentorg.com with esmtp id 1VeSg0-00032x-BM from joseph_myers@mentor.com ; Thu, 07 Nov 2013 08:43:24 -0800 Received: from SVR-IES-FEM-02.mgc.mentorg.com ([137.202.0.106]) by SVR-ORW-EXC-10.mgc.mentorg.com with Microsoft SMTPSVC(6.0.3790.4675); Thu, 7 Nov 2013 08:43:23 -0800 Received: from digraph.polyomino.org.uk (137.202.0.76) by SVR-IES-FEM-02.mgc.mentorg.com (137.202.0.106) with Microsoft SMTP Server id 14.2.247.3; Thu, 7 Nov 2013 16:43:22 +0000 Received: from jsm28 (helo=localhost) by digraph.polyomino.org.uk with local-esmtp (Exim 4.76) (envelope-from ) id 1VeSfw-0006Np-QQ; Thu, 07 Nov 2013 16:43:20 +0000 Date: Thu, 7 Nov 2013 16:43:20 +0000 From: "Joseph S. Myers" To: CC: , , Subject: Clean up atomic tests Message-ID: MIME-Version: 1.0 This patch cleans up various issues with the tests of atomics built-in functions and libatomic functions, in preparation for adapting those tests to add test coverage of stdatomic.h macros. The tests were missing a return type for main (C11 doesn't allow implicit int return types). Some tests were incrementing a variable in one part of an expression and using its value in another part without a sequence point in between. And the libatomic tests shouldn't have been restricted to targets with hardware sync_* support, or adding command-line options to make such support available, since they are built with -fno-inline-atomics anyway to ensure the library functionality is what's tested, and the library is meant to cover all types regardless of what hardware support may be available. Tested for x86_64-unknown-linux-gnu. OK to commit? gcc/testsuite: 2013-11-07 Joseph Myers * gcc.dg/atomic-compare-exchange-1.c, gcc.dg/atomic-compare-exchange-2.c, gcc.dg/atomic-compare-exchange-3.c, gcc.dg/atomic-compare-exchange-4.c, gcc.dg/atomic-compare-exchange-5.c, gcc.dg/atomic-exchange-1.c, gcc.dg/atomic-exchange-2.c, gcc.dg/atomic-exchange-3.c, gcc.dg/atomic-exchange-4.c, gcc.dg/atomic-exchange-5.c, gcc.dg/atomic-fence.c, gcc.dg/atomic-flag.c, gcc.dg/atomic-generic.c, gcc.dg/atomic-invalid.c, gcc.dg/atomic-load-1.c, gcc.dg/atomic-load-2.c, gcc.dg/atomic-load-3.c, gcc.dg/atomic-load-4.c, gcc.dg/atomic-load-5.c, gcc.dg/atomic-lockfree.c, gcc.dg/atomic-noinline.c, gcc.dg/atomic-op-1.c, gcc.dg/atomic-op-2.c, gcc.dg/atomic-op-3.c, gcc.dg/atomic-op-4.c, gcc.dg/atomic-op-5.c, gcc.dg/atomic-param.c, gcc.dg/atomic-store-1.c, gcc.dg/atomic-store-2.c, gcc.dg/atomic-store-3.c, gcc.dg/atomic-store-4.c, gcc.dg/atomic-store-5.c: Declare main as returning int. * gcc.dg/atomic-exchange-1.c, gcc.dg/atomic-exchange-2.c, gcc.dg/atomic-exchange-3.c, gcc.dg/atomic-exchange-4.c, gcc.dg/atomic-exchange-5.c: Separate increments of count from expression using value of count. libatomic: 2013-11-07 Joseph Myers * testsuite/libatomic.c/atomic-compare-exchange-1.c, testsuite/libatomic.c/atomic-compare-exchange-2.c, testsuite/libatomic.c/atomic-compare-exchange-3.c, testsuite/libatomic.c/atomic-compare-exchange-4.c, testsuite/libatomic.c/atomic-compare-exchange-5.c, testsuite/libatomic.c/atomic-exchange-1.c, testsuite/libatomic.c/atomic-exchange-2.c, testsuite/libatomic.c/atomic-exchange-3.c, testsuite/libatomic.c/atomic-exchange-4.c, testsuite/libatomic.c/atomic-exchange-5.c, testsuite/libatomic.c/atomic-generic.c, testsuite/libatomic.c/atomic-load-1.c, testsuite/libatomic.c/atomic-load-2.c, testsuite/libatomic.c/atomic-load-3.c, testsuite/libatomic.c/atomic-load-4.c, testsuite/libatomic.c/atomic-load-5.c, testsuite/libatomic.c/atomic-op-1.c, testsuite/libatomic.c/atomic-op-2.c, testsuite/libatomic.c/atomic-op-3.c, testsuite/libatomic.c/atomic-op-4.c, testsuite/libatomic.c/atomic-op-5.c, testsuite/libatomic.c/atomic-store-1.c, testsuite/libatomic.c/atomic-store-2.c, testsuite/libatomic.c/atomic-store-3.c, testsuite/libatomic.c/atomic-store-4.c, testsuite/libatomic.c/atomic-store-5.c: Declare main as returning int. Do not require built-in sync support or add target-specific options. * testsuite/libatomic.c/atomic-exchange-1.c, testsuite/libatomic.c/atomic-exchange-2.c, testsuite/libatomic.c/atomic-exchange-3.c, testsuite/libatomic.c/atomic-exchange-4.c, testsuite/libatomic.c/atomic-exchange-5.c: Separate increments of count from expression using value of count. Index: gcc/testsuite/gcc.dg/atomic-op-2.c =================================================================== --- gcc/testsuite/gcc.dg/atomic-op-2.c (revision 204508) +++ gcc/testsuite/gcc.dg/atomic-op-2.c (working copy) @@ -528,6 +528,7 @@ abort (); } +int main () { test_fetch_add (); Index: gcc/testsuite/gcc.dg/atomic-compare-exchange-1.c =================================================================== --- gcc/testsuite/gcc.dg/atomic-compare-exchange-1.c (revision 204508) +++ gcc/testsuite/gcc.dg/atomic-compare-exchange-1.c (working copy) @@ -16,6 +16,7 @@ #define STRONG 0 #define WEAK 1 +int main () { Index: gcc/testsuite/gcc.dg/atomic-exchange-3.c =================================================================== --- gcc/testsuite/gcc.dg/atomic-exchange-3.c (revision 204508) +++ gcc/testsuite/gcc.dg/atomic-exchange-3.c (working copy) @@ -9,25 +9,31 @@ int v, count, ret; +int main () { v = 0; count = 0; - if (__atomic_exchange_n (&v, count + 1, __ATOMIC_RELAXED) != count++) + if (__atomic_exchange_n (&v, count + 1, __ATOMIC_RELAXED) != count) abort (); + count++; - if (__atomic_exchange_n (&v, count + 1, __ATOMIC_ACQUIRE) != count++) + if (__atomic_exchange_n (&v, count + 1, __ATOMIC_ACQUIRE) != count) abort (); + count++; - if (__atomic_exchange_n (&v, count + 1, __ATOMIC_RELEASE) != count++) + if (__atomic_exchange_n (&v, count + 1, __ATOMIC_RELEASE) != count) abort (); + count++; - if (__atomic_exchange_n (&v, count + 1, __ATOMIC_ACQ_REL) != count++) + if (__atomic_exchange_n (&v, count + 1, __ATOMIC_ACQ_REL) != count) abort (); + count++; - if (__atomic_exchange_n (&v, count + 1, __ATOMIC_SEQ_CST) != count++) + if (__atomic_exchange_n (&v, count + 1, __ATOMIC_SEQ_CST) != count) abort (); + count++; /* Now test the generic version. */ Index: gcc/testsuite/gcc.dg/atomic-compare-exchange-5.c =================================================================== --- gcc/testsuite/gcc.dg/atomic-compare-exchange-5.c (revision 204508) +++ gcc/testsuite/gcc.dg/atomic-compare-exchange-5.c (working copy) @@ -17,6 +17,7 @@ #define STRONG 0 #define WEAK 1 +int main () { Index: gcc/testsuite/gcc.dg/atomic-load-4.c =================================================================== --- gcc/testsuite/gcc.dg/atomic-load-4.c (revision 204508) +++ gcc/testsuite/gcc.dg/atomic-load-4.c (working copy) @@ -9,6 +9,7 @@ long long v, count; +int main () { v = 0; Index: gcc/testsuite/gcc.dg/atomic-store-2.c =================================================================== --- gcc/testsuite/gcc.dg/atomic-store-2.c (revision 204508) +++ gcc/testsuite/gcc.dg/atomic-store-2.c (working copy) @@ -9,6 +9,7 @@ short v, count; +int main () { v = 0; Index: gcc/testsuite/gcc.dg/atomic-noinline.c =================================================================== --- gcc/testsuite/gcc.dg/atomic-noinline.c (revision 204508) +++ gcc/testsuite/gcc.dg/atomic-noinline.c (working copy) @@ -16,6 +16,7 @@ short as,bs,cs; char ac,bc,cc; +int main () { Index: gcc/testsuite/gcc.dg/atomic-op-3.c =================================================================== --- gcc/testsuite/gcc.dg/atomic-op-3.c (revision 204508) +++ gcc/testsuite/gcc.dg/atomic-op-3.c (working copy) @@ -527,6 +527,7 @@ abort (); } +int main () { test_fetch_add (); Index: gcc/testsuite/gcc.dg/atomic-compare-exchange-2.c =================================================================== --- gcc/testsuite/gcc.dg/atomic-compare-exchange-2.c (revision 204508) +++ gcc/testsuite/gcc.dg/atomic-compare-exchange-2.c (working copy) @@ -16,6 +16,7 @@ #define STRONG 0 #define WEAK 1 +int main () { Index: gcc/testsuite/gcc.dg/atomic-load-1.c =================================================================== --- gcc/testsuite/gcc.dg/atomic-load-1.c (revision 204508) +++ gcc/testsuite/gcc.dg/atomic-load-1.c (working copy) @@ -10,6 +10,7 @@ char v, count; +int main () { v = 0; Index: gcc/testsuite/gcc.dg/atomic-exchange-4.c =================================================================== --- gcc/testsuite/gcc.dg/atomic-exchange-4.c (revision 204508) +++ gcc/testsuite/gcc.dg/atomic-exchange-4.c (working copy) @@ -11,25 +11,31 @@ long long v, count, ret; +int main () { v = 0; count = 0; - if (__atomic_exchange_n (&v, count + 1, __ATOMIC_RELAXED) != count++) + if (__atomic_exchange_n (&v, count + 1, __ATOMIC_RELAXED) != count) abort (); + count++; - if (__atomic_exchange_n (&v, count + 1, __ATOMIC_ACQUIRE) != count++) + if (__atomic_exchange_n (&v, count + 1, __ATOMIC_ACQUIRE) != count) abort (); + count++; - if (__atomic_exchange_n (&v, count + 1, __ATOMIC_RELEASE) != count++) + if (__atomic_exchange_n (&v, count + 1, __ATOMIC_RELEASE) != count) abort (); + count++; - if (__atomic_exchange_n (&v, count + 1, __ATOMIC_ACQ_REL) != count++) + if (__atomic_exchange_n (&v, count + 1, __ATOMIC_ACQ_REL) != count) abort (); + count++; - if (__atomic_exchange_n (&v, count + 1, __ATOMIC_SEQ_CST) != count++) + if (__atomic_exchange_n (&v, count + 1, __ATOMIC_SEQ_CST) != count) abort (); + count++; /* Now test the generic version. */ Index: gcc/testsuite/gcc.dg/atomic-flag.c =================================================================== --- gcc/testsuite/gcc.dg/atomic-flag.c (revision 204508) +++ gcc/testsuite/gcc.dg/atomic-flag.c (working copy) @@ -7,6 +7,7 @@ extern void abort(void); unsigned char a; +int main () { int b; Index: gcc/testsuite/gcc.dg/atomic-generic.c =================================================================== --- gcc/testsuite/gcc.dg/atomic-generic.c (revision 204508) +++ gcc/testsuite/gcc.dg/atomic-generic.c (working copy) @@ -23,6 +23,7 @@ int size = sizeof (test_struct); /* Test for consistency on sizes 1, 2, 4, 8, 16 and 32. */ +int main () { test_struct c; Index: gcc/testsuite/gcc.dg/atomic-lockfree.c =================================================================== --- gcc/testsuite/gcc.dg/atomic-lockfree.c (revision 204508) +++ gcc/testsuite/gcc.dg/atomic-lockfree.c (working copy) @@ -17,6 +17,7 @@ int r1, r2; /* Test for consistency on sizes 1, 2, 4, 8, 16 and 32. */ +int main () { Index: gcc/testsuite/gcc.dg/atomic-param.c =================================================================== --- gcc/testsuite/gcc.dg/atomic-param.c (revision 204508) +++ gcc/testsuite/gcc.dg/atomic-param.c (working copy) @@ -5,6 +5,7 @@ int i; +int main () { Index: gcc/testsuite/gcc.dg/atomic-load-5.c =================================================================== --- gcc/testsuite/gcc.dg/atomic-load-5.c (revision 204508) +++ gcc/testsuite/gcc.dg/atomic-load-5.c (working copy) @@ -8,6 +8,7 @@ __int128_t v, count; +int main () { v = 0; Index: gcc/testsuite/gcc.dg/atomic-store-3.c =================================================================== --- gcc/testsuite/gcc.dg/atomic-store-3.c (revision 204508) +++ gcc/testsuite/gcc.dg/atomic-store-3.c (working copy) @@ -9,6 +9,7 @@ int v, count; +int main () { v = 0; Index: gcc/testsuite/gcc.dg/atomic-invalid.c =================================================================== --- gcc/testsuite/gcc.dg/atomic-invalid.c (revision 204508) +++ gcc/testsuite/gcc.dg/atomic-invalid.c (working copy) @@ -10,6 +10,7 @@ size_t s; bool x; +int main () { __atomic_compare_exchange_n (&i, &e, 1, 0, __ATOMIC_RELAXED, __ATOMIC_SEQ_CST); /* { dg-error "failure memory model cannot be stronger" } */ Index: gcc/testsuite/gcc.dg/atomic-op-4.c =================================================================== --- gcc/testsuite/gcc.dg/atomic-op-4.c (revision 204508) +++ gcc/testsuite/gcc.dg/atomic-op-4.c (working copy) @@ -529,6 +529,7 @@ abort (); } +int main () { test_fetch_add (); Index: gcc/testsuite/gcc.dg/atomic-exchange-1.c =================================================================== --- gcc/testsuite/gcc.dg/atomic-exchange-1.c (revision 204508) +++ gcc/testsuite/gcc.dg/atomic-exchange-1.c (working copy) @@ -9,25 +9,31 @@ char v, count, ret; +int main () { v = 0; count = 0; - if (__atomic_exchange_n (&v, count + 1, __ATOMIC_RELAXED) != count++) + if (__atomic_exchange_n (&v, count + 1, __ATOMIC_RELAXED) != count) abort (); + count++; - if (__atomic_exchange_n (&v, count + 1, __ATOMIC_ACQUIRE) != count++) + if (__atomic_exchange_n (&v, count + 1, __ATOMIC_ACQUIRE) != count) abort (); + count++; - if (__atomic_exchange_n (&v, count + 1, __ATOMIC_RELEASE) != count++) + if (__atomic_exchange_n (&v, count + 1, __ATOMIC_RELEASE) != count) abort (); + count++; - if (__atomic_exchange_n (&v, count + 1, __ATOMIC_ACQ_REL) != count++) + if (__atomic_exchange_n (&v, count + 1, __ATOMIC_ACQ_REL) != count) abort (); + count++; - if (__atomic_exchange_n (&v, count + 1, __ATOMIC_SEQ_CST) != count++) + if (__atomic_exchange_n (&v, count + 1, __ATOMIC_SEQ_CST) != count) abort (); + count++; /* Now test the generic version. */ Index: gcc/testsuite/gcc.dg/atomic-compare-exchange-3.c =================================================================== --- gcc/testsuite/gcc.dg/atomic-compare-exchange-3.c (revision 204508) +++ gcc/testsuite/gcc.dg/atomic-compare-exchange-3.c (working copy) @@ -16,6 +16,7 @@ #define STRONG 0 #define WEAK 1 +int main () { Index: gcc/testsuite/gcc.dg/atomic-load-2.c =================================================================== --- gcc/testsuite/gcc.dg/atomic-load-2.c (revision 204508) +++ gcc/testsuite/gcc.dg/atomic-load-2.c (working copy) @@ -11,6 +11,7 @@ short v, count; +int main () { v = 0; Index: gcc/testsuite/gcc.dg/atomic-exchange-5.c =================================================================== --- gcc/testsuite/gcc.dg/atomic-exchange-5.c (revision 204508) +++ gcc/testsuite/gcc.dg/atomic-exchange-5.c (working copy) @@ -10,25 +10,31 @@ __int128_t v, count, ret; +int main () { v = 0; count = 0; - if (__atomic_exchange_n (&v, count + 1, __ATOMIC_RELAXED) != count++) + if (__atomic_exchange_n (&v, count + 1, __ATOMIC_RELAXED) != count) abort (); + count++; - if (__atomic_exchange_n (&v, count + 1, __ATOMIC_ACQUIRE) != count++) + if (__atomic_exchange_n (&v, count + 1, __ATOMIC_ACQUIRE) != count) abort (); + count++; - if (__atomic_exchange_n (&v, count + 1, __ATOMIC_RELEASE) != count++) + if (__atomic_exchange_n (&v, count + 1, __ATOMIC_RELEASE) != count) abort (); + count++; - if (__atomic_exchange_n (&v, count + 1, __ATOMIC_ACQ_REL) != count++) + if (__atomic_exchange_n (&v, count + 1, __ATOMIC_ACQ_REL) != count) abort (); + count++; - if (__atomic_exchange_n (&v, count + 1, __ATOMIC_SEQ_CST) != count++) + if (__atomic_exchange_n (&v, count + 1, __ATOMIC_SEQ_CST) != count) abort (); + count++; /* Now test the generic version. */ Index: gcc/testsuite/gcc.dg/atomic-store-4.c =================================================================== --- gcc/testsuite/gcc.dg/atomic-store-4.c (revision 204508) +++ gcc/testsuite/gcc.dg/atomic-store-4.c (working copy) @@ -11,6 +11,7 @@ long long v, count; +int main () { v = 0; Index: gcc/testsuite/gcc.dg/atomic-op-1.c =================================================================== --- gcc/testsuite/gcc.dg/atomic-op-1.c (revision 204508) +++ gcc/testsuite/gcc.dg/atomic-op-1.c (working copy) @@ -527,6 +527,7 @@ abort (); } +int main () { test_fetch_add (); Index: gcc/testsuite/gcc.dg/atomic-op-5.c =================================================================== --- gcc/testsuite/gcc.dg/atomic-op-5.c (revision 204508) +++ gcc/testsuite/gcc.dg/atomic-op-5.c (working copy) @@ -528,6 +528,7 @@ abort (); } +int main () { test_fetch_add (); Index: gcc/testsuite/gcc.dg/atomic-exchange-2.c =================================================================== --- gcc/testsuite/gcc.dg/atomic-exchange-2.c (revision 204508) +++ gcc/testsuite/gcc.dg/atomic-exchange-2.c (working copy) @@ -9,25 +9,31 @@ short v, count, ret; +int main () { v = 0; count = 0; - if (__atomic_exchange_n (&v, count + 1, __ATOMIC_RELAXED) != count++) + if (__atomic_exchange_n (&v, count + 1, __ATOMIC_RELAXED) != count) abort (); + count++; - if (__atomic_exchange_n (&v, count + 1, __ATOMIC_ACQUIRE) != count++) + if (__atomic_exchange_n (&v, count + 1, __ATOMIC_ACQUIRE) != count) abort (); + count++; - if (__atomic_exchange_n (&v, count + 1, __ATOMIC_RELEASE) != count++) + if (__atomic_exchange_n (&v, count + 1, __ATOMIC_RELEASE) != count) abort (); + count++; - if (__atomic_exchange_n (&v, count + 1, __ATOMIC_ACQ_REL) != count++) + if (__atomic_exchange_n (&v, count + 1, __ATOMIC_ACQ_REL) != count) abort (); + count++; - if (__atomic_exchange_n (&v, count + 1, __ATOMIC_SEQ_CST) != count++) + if (__atomic_exchange_n (&v, count + 1, __ATOMIC_SEQ_CST) != count) abort (); + count++; /* Now test the generic version. */ Index: gcc/testsuite/gcc.dg/atomic-compare-exchange-4.c =================================================================== --- gcc/testsuite/gcc.dg/atomic-compare-exchange-4.c (revision 204508) +++ gcc/testsuite/gcc.dg/atomic-compare-exchange-4.c (working copy) @@ -18,6 +18,7 @@ #define STRONG 0 #define WEAK 1 +int main () { Index: gcc/testsuite/gcc.dg/atomic-load-3.c =================================================================== --- gcc/testsuite/gcc.dg/atomic-load-3.c (revision 204508) +++ gcc/testsuite/gcc.dg/atomic-load-3.c (working copy) @@ -8,6 +8,7 @@ int v, count; +int main () { v = 0; Index: gcc/testsuite/gcc.dg/atomic-store-1.c =================================================================== --- gcc/testsuite/gcc.dg/atomic-store-1.c (revision 204508) +++ gcc/testsuite/gcc.dg/atomic-store-1.c (working copy) @@ -9,6 +9,7 @@ char v, count; +int main () { v = 0; Index: gcc/testsuite/gcc.dg/atomic-fence.c =================================================================== --- gcc/testsuite/gcc.dg/atomic-fence.c (revision 204508) +++ gcc/testsuite/gcc.dg/atomic-fence.c (working copy) @@ -6,6 +6,7 @@ /* Test that __atomic_{thread,signal}_fence builtins execute. */ +int main () { __atomic_thread_fence (__ATOMIC_RELAXED); Index: gcc/testsuite/gcc.dg/atomic-store-5.c =================================================================== --- gcc/testsuite/gcc.dg/atomic-store-5.c (revision 204508) +++ gcc/testsuite/gcc.dg/atomic-store-5.c (working copy) @@ -10,6 +10,7 @@ __int128_t v, count; +int main () { v = 0; Index: libatomic/testsuite/libatomic.c/atomic-generic.c =================================================================== --- libatomic/testsuite/libatomic.c/atomic-generic.c (revision 204508) +++ libatomic/testsuite/libatomic.c/atomic-generic.c (working copy) @@ -22,6 +22,7 @@ int size = sizeof (test_struct); /* Test for consistency on sizes 1, 2, 4, 8, 16 and 32. */ +int main () { test_struct c; Index: libatomic/testsuite/libatomic.c/atomic-op-1.c =================================================================== --- libatomic/testsuite/libatomic.c/atomic-op-1.c (revision 204508) +++ libatomic/testsuite/libatomic.c/atomic-op-1.c (working copy) @@ -1,7 +1,6 @@ /* Test __atomic routines for existence and proper execution on 1 byte values with each valid memory model. */ /* { dg-do run } */ -/* { dg-require-effective-target sync_char_short } */ /* Test the execution of the __atomic_*OP builtin routines for a char. */ @@ -527,6 +526,7 @@ abort (); } +int main () { test_fetch_add (); Index: libatomic/testsuite/libatomic.c/atomic-load-1.c =================================================================== --- libatomic/testsuite/libatomic.c/atomic-load-1.c (revision 204508) +++ libatomic/testsuite/libatomic.c/atomic-load-1.c (working copy) @@ -1,7 +1,6 @@ /* Test __atomic routines for existence and proper execution on 1 byte values with each valid memory model. */ /* { dg-do run } */ -/* { dg-require-effective-target sync_char_short } */ /* Test the execution of the __atomic_load_n builtin for a char. */ @@ -10,6 +9,7 @@ char v, count; +int main () { v = 0; Index: libatomic/testsuite/libatomic.c/atomic-op-2.c =================================================================== --- libatomic/testsuite/libatomic.c/atomic-op-2.c (revision 204508) +++ libatomic/testsuite/libatomic.c/atomic-op-2.c (working copy) @@ -1,7 +1,6 @@ /* Test __atomic routines for existence and proper execution on 2 byte values with each valid memory model. */ /* { dg-do run } */ -/* { dg-require-effective-target sync_char_short } */ /* Test the execution of the __atomic_*OP builtin routines for a short. */ @@ -528,6 +527,7 @@ abort (); } +int main () { test_fetch_add (); Index: libatomic/testsuite/libatomic.c/atomic-op-3.c =================================================================== --- libatomic/testsuite/libatomic.c/atomic-op-3.c (revision 204508) +++ libatomic/testsuite/libatomic.c/atomic-op-3.c (working copy) @@ -1,7 +1,6 @@ /* Test __atomic routines for existence and proper execution on 4 byte values with each valid memory model. */ /* { dg-do run } */ -/* { dg-require-effective-target sync_int_long } */ /* Test the execution of the __atomic_*OP builtin routines for an int. */ @@ -527,6 +526,7 @@ abort (); } +int main () { test_fetch_add (); Index: libatomic/testsuite/libatomic.c/atomic-load-2.c =================================================================== --- libatomic/testsuite/libatomic.c/atomic-load-2.c (revision 204508) +++ libatomic/testsuite/libatomic.c/atomic-load-2.c (working copy) @@ -1,7 +1,6 @@ /* Test __atomic routines for existence and proper execution on 2 byte values with each valid memory model. */ /* { dg-do run } */ -/* { dg-require-effective-target sync_char_short } */ /* Test the execution of the __atomic_load_n builtin for a short. */ @@ -11,6 +10,7 @@ short v, count; +int main () { v = 0; Index: libatomic/testsuite/libatomic.c/atomic-load-3.c =================================================================== --- libatomic/testsuite/libatomic.c/atomic-load-3.c (revision 204508) +++ libatomic/testsuite/libatomic.c/atomic-load-3.c (working copy) @@ -1,13 +1,13 @@ /* Test __atomic routines for existence and proper execution on 4 byte values with each valid memory model. */ /* { dg-do run } */ -/* { dg-require-effective-target sync_int_long } */ extern void abort(void); int v, count; +int main () { v = 0; Index: libatomic/testsuite/libatomic.c/atomic-op-4.c =================================================================== --- libatomic/testsuite/libatomic.c/atomic-op-4.c (revision 204508) +++ libatomic/testsuite/libatomic.c/atomic-op-4.c (working copy) @@ -1,9 +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_runtime } */ /* { dg-options "" } */ -/* { dg-options "-march=pentium" { target { { i?86-*-* x86_64-*-* } && ia32 } } } */ /* Test the execution of the __atomic_*OP builtin routines for long long. */ @@ -529,6 +527,7 @@ abort (); } +int main () { test_fetch_add (); Index: libatomic/testsuite/libatomic.c/atomic-exchange-1.c =================================================================== --- libatomic/testsuite/libatomic.c/atomic-exchange-1.c (revision 204508) +++ libatomic/testsuite/libatomic.c/atomic-exchange-1.c (working copy) @@ -1,7 +1,6 @@ /* Test __atomic routines for existence and proper execution on 1 byte values with each valid memory model. */ /* { dg-do run } */ -/* { dg-require-effective-target sync_char_short } */ /* Test the execution of the __atomic_exchange_n builtin for a char. */ @@ -9,25 +8,31 @@ char v, count, ret; +int main () { v = 0; count = 0; - if (__atomic_exchange_n (&v, count + 1, __ATOMIC_RELAXED) != count++) + if (__atomic_exchange_n (&v, count + 1, __ATOMIC_RELAXED) != count) abort (); + count++; - if (__atomic_exchange_n (&v, count + 1, __ATOMIC_ACQUIRE) != count++) + if (__atomic_exchange_n (&v, count + 1, __ATOMIC_ACQUIRE) != count) abort (); + count++; - if (__atomic_exchange_n (&v, count + 1, __ATOMIC_RELEASE) != count++) + if (__atomic_exchange_n (&v, count + 1, __ATOMIC_RELEASE) != count) abort (); + count++; - if (__atomic_exchange_n (&v, count + 1, __ATOMIC_ACQ_REL) != count++) + if (__atomic_exchange_n (&v, count + 1, __ATOMIC_ACQ_REL) != count) abort (); + count++; - if (__atomic_exchange_n (&v, count + 1, __ATOMIC_SEQ_CST) != count++) + if (__atomic_exchange_n (&v, count + 1, __ATOMIC_SEQ_CST) != count) abort (); + count++; /* Now test the generic version. */ Index: libatomic/testsuite/libatomic.c/atomic-load-4.c =================================================================== --- libatomic/testsuite/libatomic.c/atomic-load-4.c (revision 204508) +++ libatomic/testsuite/libatomic.c/atomic-load-4.c (working copy) @@ -1,14 +1,13 @@ /* 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_runtime } */ /* { dg-options "" } */ -/* { dg-options "-march=pentium" { target { { i?86-*-* x86_64-*-* } && ia32 } } } */ extern void abort(void); long long v, count; +int main () { v = 0; Index: libatomic/testsuite/libatomic.c/atomic-op-5.c =================================================================== --- libatomic/testsuite/libatomic.c/atomic-op-5.c (revision 204508) +++ libatomic/testsuite/libatomic.c/atomic-op-5.c (working copy) @@ -1,8 +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_runtime } */ -/* { dg-options "-mcx16" { target { i?86-*-* x86_64-*-* } } } */ +/* { dg-require-effective-target int128 } */ /* Test the execution of the __atomic_*OP builtin routines for an int_128. */ @@ -528,6 +527,7 @@ abort (); } +int main () { test_fetch_add (); Index: libatomic/testsuite/libatomic.c/atomic-load-5.c =================================================================== --- libatomic/testsuite/libatomic.c/atomic-load-5.c (revision 204508) +++ libatomic/testsuite/libatomic.c/atomic-load-5.c (working copy) @@ -1,13 +1,13 @@ /* 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_runtime } */ -/* { dg-options "-mcx16" { target { i?86-*-* x86_64-*-* } } } */ +/* { dg-require-effective-target int128 } */ extern void abort(void); __int128_t v, count; +int main () { v = 0; Index: libatomic/testsuite/libatomic.c/atomic-exchange-2.c =================================================================== --- libatomic/testsuite/libatomic.c/atomic-exchange-2.c (revision 204508) +++ libatomic/testsuite/libatomic.c/atomic-exchange-2.c (working copy) @@ -1,7 +1,6 @@ /* Test __atomic routines for existence and proper execution on 2 byte values with each valid memory model. */ /* { dg-do run } */ -/* { dg-require-effective-target sync_char_short } */ /* Test the execution of the __atomic_X builtin for a short. */ @@ -9,25 +8,31 @@ short v, count, ret; +int main () { v = 0; count = 0; - if (__atomic_exchange_n (&v, count + 1, __ATOMIC_RELAXED) != count++) + if (__atomic_exchange_n (&v, count + 1, __ATOMIC_RELAXED) != count) abort (); + count++; - if (__atomic_exchange_n (&v, count + 1, __ATOMIC_ACQUIRE) != count++) + if (__atomic_exchange_n (&v, count + 1, __ATOMIC_ACQUIRE) != count) abort (); + count++; - if (__atomic_exchange_n (&v, count + 1, __ATOMIC_RELEASE) != count++) + if (__atomic_exchange_n (&v, count + 1, __ATOMIC_RELEASE) != count) abort (); + count++; - if (__atomic_exchange_n (&v, count + 1, __ATOMIC_ACQ_REL) != count++) + if (__atomic_exchange_n (&v, count + 1, __ATOMIC_ACQ_REL) != count) abort (); + count++; - if (__atomic_exchange_n (&v, count + 1, __ATOMIC_SEQ_CST) != count++) + if (__atomic_exchange_n (&v, count + 1, __ATOMIC_SEQ_CST) != count) abort (); + count++; /* Now test the generic version. */ Index: libatomic/testsuite/libatomic.c/atomic-exchange-3.c =================================================================== --- libatomic/testsuite/libatomic.c/atomic-exchange-3.c (revision 204508) +++ libatomic/testsuite/libatomic.c/atomic-exchange-3.c (working copy) @@ -1,7 +1,6 @@ /* Test __atomic routines for existence and proper execution on 4 byte values with each valid memory model. */ /* { dg-do run } */ -/* { dg-require-effective-target sync_int_long } */ /* Test the execution of the __atomic_X builtin for an int. */ @@ -9,25 +8,31 @@ int v, count, ret; +int main () { v = 0; count = 0; - if (__atomic_exchange_n (&v, count + 1, __ATOMIC_RELAXED) != count++) + if (__atomic_exchange_n (&v, count + 1, __ATOMIC_RELAXED) != count) abort (); + count++; - if (__atomic_exchange_n (&v, count + 1, __ATOMIC_ACQUIRE) != count++) + if (__atomic_exchange_n (&v, count + 1, __ATOMIC_ACQUIRE) != count) abort (); + count++; - if (__atomic_exchange_n (&v, count + 1, __ATOMIC_RELEASE) != count++) + if (__atomic_exchange_n (&v, count + 1, __ATOMIC_RELEASE) != count) abort (); + count++; - if (__atomic_exchange_n (&v, count + 1, __ATOMIC_ACQ_REL) != count++) + if (__atomic_exchange_n (&v, count + 1, __ATOMIC_ACQ_REL) != count) abort (); + count++; - if (__atomic_exchange_n (&v, count + 1, __ATOMIC_SEQ_CST) != count++) + if (__atomic_exchange_n (&v, count + 1, __ATOMIC_SEQ_CST) != count) abort (); + count++; /* Now test the generic version. */ Index: libatomic/testsuite/libatomic.c/atomic-exchange-4.c =================================================================== --- libatomic/testsuite/libatomic.c/atomic-exchange-4.c (revision 204508) +++ libatomic/testsuite/libatomic.c/atomic-exchange-4.c (working copy) @@ -1,9 +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_runtime } */ /* { dg-options "" } */ -/* { dg-options "-march=pentium" { target { { i?86-*-* x86_64-*-* } && ia32 } } } */ /* Test the execution of the __atomic_X builtin for a long_long. */ @@ -11,25 +9,31 @@ long long v, count, ret; +int main () { v = 0; count = 0; - if (__atomic_exchange_n (&v, count + 1, __ATOMIC_RELAXED) != count++) + if (__atomic_exchange_n (&v, count + 1, __ATOMIC_RELAXED) != count) abort (); + count++; - if (__atomic_exchange_n (&v, count + 1, __ATOMIC_ACQUIRE) != count++) + if (__atomic_exchange_n (&v, count + 1, __ATOMIC_ACQUIRE) != count) abort (); + count++; - if (__atomic_exchange_n (&v, count + 1, __ATOMIC_RELEASE) != count++) + if (__atomic_exchange_n (&v, count + 1, __ATOMIC_RELEASE) != count) abort (); + count++; - if (__atomic_exchange_n (&v, count + 1, __ATOMIC_ACQ_REL) != count++) + if (__atomic_exchange_n (&v, count + 1, __ATOMIC_ACQ_REL) != count) abort (); + count++; - if (__atomic_exchange_n (&v, count + 1, __ATOMIC_SEQ_CST) != count++) + if (__atomic_exchange_n (&v, count + 1, __ATOMIC_SEQ_CST) != count) abort (); + count++; /* Now test the generic version. */ Index: libatomic/testsuite/libatomic.c/atomic-exchange-5.c =================================================================== --- libatomic/testsuite/libatomic.c/atomic-exchange-5.c (revision 204508) +++ libatomic/testsuite/libatomic.c/atomic-exchange-5.c (working copy) @@ -1,8 +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_runtime } */ -/* { dg-options "-mcx16" { target { i?86-*-* x86_64-*-* } } } */ +/* { dg-require-effective-target int128 } */ /* Test the execution of the __atomic_X builtin for a 16 byte value. */ @@ -10,25 +9,31 @@ __int128_t v, count, ret; +int main () { v = 0; count = 0; - if (__atomic_exchange_n (&v, count + 1, __ATOMIC_RELAXED) != count++) + if (__atomic_exchange_n (&v, count + 1, __ATOMIC_RELAXED) != count) abort (); + count++; - if (__atomic_exchange_n (&v, count + 1, __ATOMIC_ACQUIRE) != count++) + if (__atomic_exchange_n (&v, count + 1, __ATOMIC_ACQUIRE) != count) abort (); + count++; - if (__atomic_exchange_n (&v, count + 1, __ATOMIC_RELEASE) != count++) + if (__atomic_exchange_n (&v, count + 1, __ATOMIC_RELEASE) != count) abort (); + count++; - if (__atomic_exchange_n (&v, count + 1, __ATOMIC_ACQ_REL) != count++) + if (__atomic_exchange_n (&v, count + 1, __ATOMIC_ACQ_REL) != count) abort (); + count++; - if (__atomic_exchange_n (&v, count + 1, __ATOMIC_SEQ_CST) != count++) + if (__atomic_exchange_n (&v, count + 1, __ATOMIC_SEQ_CST) != count) abort (); + count++; /* Now test the generic version. */ Index: libatomic/testsuite/libatomic.c/atomic-store-1.c =================================================================== --- libatomic/testsuite/libatomic.c/atomic-store-1.c (revision 204508) +++ libatomic/testsuite/libatomic.c/atomic-store-1.c (working copy) @@ -1,7 +1,6 @@ /* Test __atomic routines for existence and proper execution on 1 byte values with each valid memory model. */ /* { dg-do run } */ -/* { dg-require-effective-target sync_char_short } */ /* Test the execution of the __atomic_store_n builtin for a char. */ @@ -9,6 +8,7 @@ char v, count; +int main () { v = 0; Index: libatomic/testsuite/libatomic.c/atomic-store-2.c =================================================================== --- libatomic/testsuite/libatomic.c/atomic-store-2.c (revision 204508) +++ libatomic/testsuite/libatomic.c/atomic-store-2.c (working copy) @@ -1,7 +1,6 @@ /* Test __atomic routines for existence and proper execution on 2 byte values with each valid memory model. */ /* { dg-do run } */ -/* { dg-require-effective-target sync_char_short } */ /* Test the execution of the __atomic_store_n builtin for a short. */ @@ -9,6 +8,7 @@ short v, count; +int main () { v = 0; Index: libatomic/testsuite/libatomic.c/atomic-store-3.c =================================================================== --- libatomic/testsuite/libatomic.c/atomic-store-3.c (revision 204508) +++ libatomic/testsuite/libatomic.c/atomic-store-3.c (working copy) @@ -1,7 +1,6 @@ /* Test __atomic routines for existence and proper execution on 4 byte values with each valid memory model. */ /* { dg-do run } */ -/* { dg-require-effective-target sync_int_long } */ /* Test the execution of the __atomic_store_n builtin for an int. */ @@ -9,6 +8,7 @@ int v, count; +int main () { v = 0; Index: libatomic/testsuite/libatomic.c/atomic-store-4.c =================================================================== --- libatomic/testsuite/libatomic.c/atomic-store-4.c (revision 204508) +++ libatomic/testsuite/libatomic.c/atomic-store-4.c (working copy) @@ -1,9 +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_runtime } */ /* { dg-options "" } */ -/* { dg-options "-march=pentium" { target { { i?86-*-* x86_64-*-* } && ia32 } } } */ /* Test the execution of the __atomic_store_n builtin for a long long. */ @@ -11,6 +9,7 @@ long long v, count; +int main () { v = 0; Index: libatomic/testsuite/libatomic.c/atomic-store-5.c =================================================================== --- libatomic/testsuite/libatomic.c/atomic-store-5.c (revision 204508) +++ libatomic/testsuite/libatomic.c/atomic-store-5.c (working copy) @@ -1,8 +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_runtime } */ -/* { dg-options "-mcx16" { target { i?86-*-* x86_64-*-* } } } */ +/* { dg-require-effective-target int128 } */ /* Test the execution of the __atomic_store_n builtin for a 16 byte value. */ @@ -10,6 +9,7 @@ __int128_t v, count; +int main () { v = 0; Index: libatomic/testsuite/libatomic.c/atomic-compare-exchange-1.c =================================================================== --- libatomic/testsuite/libatomic.c/atomic-compare-exchange-1.c (revision 204508) +++ libatomic/testsuite/libatomic.c/atomic-compare-exchange-1.c (working copy) @@ -1,7 +1,6 @@ /* Test __atomic routines for existence and proper execution on 1 byte values with each valid memory model. */ /* { dg-do run } */ -/* { dg-require-effective-target sync_char_short } */ /* Test the execution of the __atomic_compare_exchange_n builtin for a char. */ @@ -16,6 +15,7 @@ #define STRONG 0 #define WEAK 1 +int main () { Index: libatomic/testsuite/libatomic.c/atomic-compare-exchange-2.c =================================================================== --- libatomic/testsuite/libatomic.c/atomic-compare-exchange-2.c (revision 204508) +++ libatomic/testsuite/libatomic.c/atomic-compare-exchange-2.c (working copy) @@ -1,7 +1,6 @@ /* Test __atomic routines for existence and proper execution on 2 byte values with each valid memory model. */ /* { dg-do run } */ -/* { dg-require-effective-target sync_char_short } */ /* Test the execution of the __atomic_compare_exchange_n builtin for a short. */ @@ -16,6 +15,7 @@ #define STRONG 0 #define WEAK 1 +int main () { Index: libatomic/testsuite/libatomic.c/atomic-compare-exchange-3.c =================================================================== --- libatomic/testsuite/libatomic.c/atomic-compare-exchange-3.c (revision 204508) +++ libatomic/testsuite/libatomic.c/atomic-compare-exchange-3.c (working copy) @@ -1,7 +1,6 @@ /* Test __atomic routines for existence and proper execution on 4 byte values with each valid memory model. */ /* { dg-do run } */ -/* { dg-require-effective-target sync_int_long } */ /* Test the execution of the __atomic_compare_exchange_n builtin for an int. */ @@ -16,6 +15,7 @@ #define STRONG 0 #define WEAK 1 +int main () { Index: libatomic/testsuite/libatomic.c/atomic-compare-exchange-4.c =================================================================== --- libatomic/testsuite/libatomic.c/atomic-compare-exchange-4.c (revision 204508) +++ libatomic/testsuite/libatomic.c/atomic-compare-exchange-4.c (working copy) @@ -1,9 +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_runtime } */ /* { dg-options "" } */ -/* { dg-options "-march=pentium" { target { { i?86-*-* x86_64-*-* } && ia32 } } } */ /* Test the execution of __atomic_compare_exchange_n builtin for a long_long. */ @@ -18,6 +16,7 @@ #define STRONG 0 #define WEAK 1 +int main () { Index: libatomic/testsuite/libatomic.c/atomic-compare-exchange-5.c =================================================================== --- libatomic/testsuite/libatomic.c/atomic-compare-exchange-5.c (revision 204508) +++ libatomic/testsuite/libatomic.c/atomic-compare-exchange-5.c (working copy) @@ -1,8 +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_runtime } */ -/* { dg-options "-mcx16" { target { i?86-*-* x86_64-*-* } } } */ +/* { dg-require-effective-target int128 } */ /* Test the execution of __atomic_compare_exchange_n builtin for an int_128. */ @@ -17,6 +16,7 @@ #define STRONG 0 #define WEAK 1 +int main () {