diff options
author | upstream source tree <ports@midipix.org> | 2015-03-15 20:14:05 -0400 |
---|---|---|
committer | upstream source tree <ports@midipix.org> | 2015-03-15 20:14:05 -0400 |
commit | 554fd8c5195424bdbcabf5de30fdc183aba391bd (patch) | |
tree | 976dc5ab7fddf506dadce60ae936f43f58787092 /gcc/testsuite/gcc.target/mips/atomic-memory-1.c | |
download | cbb-gcc-4.6.4-upstream.tar.bz2 cbb-gcc-4.6.4-upstream.tar.xz |
obtained gcc-4.6.4.tar.bz2 from upstream website;upstream
verified gcc-4.6.4.tar.bz2.sig;
imported gcc-4.6.4 source tree from verified upstream tarball.
downloading a git-generated archive based on the 'upstream' tag
should provide you with a source tree that is binary identical
to the one extracted from the above tarball.
if you have obtained the source via the command 'git clone',
however, do note that line-endings of files in your working
directory might differ from line-endings of the respective
files in the upstream repository.
Diffstat (limited to 'gcc/testsuite/gcc.target/mips/atomic-memory-1.c')
-rw-r--r-- | gcc/testsuite/gcc.target/mips/atomic-memory-1.c | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.target/mips/atomic-memory-1.c b/gcc/testsuite/gcc.target/mips/atomic-memory-1.c new file mode 100644 index 000000000..b2316ee64 --- /dev/null +++ b/gcc/testsuite/gcc.target/mips/atomic-memory-1.c @@ -0,0 +1,44 @@ +/* { dg-do run } */ + +/* { dg-message "note: '__sync_nand_and_fetch' changed semantics in GCC 4.4" "" { target *-*-* } 0 } */ + +extern void abort (void); +extern void exit (int); + +NOMIPS16 int main () +{ +#ifdef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 + unsigned v = 0; + __sync_synchronize (); + + if (!__sync_bool_compare_and_swap (&v, 0, 30000)) + abort(); + if (30000 != __sync_val_compare_and_swap (&v, 30000, 100001)) + abort(); + __sync_sub_and_fetch (&v, 0x8001); + __sync_sub_and_fetch (&v, 0x7fff); + if (v != 34465) + abort(); + if (__sync_nand_and_fetch (&v, 0xff) != -162) + abort(); + if (__sync_fetch_and_add (&v, 262) != -162) + abort(); + if (v != 100) + abort(); + if (__sync_or_and_fetch (&v, 0xf001) != 0xf065) + abort(); + if (__sync_and_and_fetch (&v, 0x1000) != 0x1000) + abort(); + if (__sync_xor_and_fetch (&v, 0xa51040) != 0xa50040) + abort(); + __sync_and_and_fetch (&v, 7); + if (__sync_lock_test_and_set(&v, 1) != 0) + abort(); + if (v != 1) + abort(); + __sync_lock_release (&v); + if (v != 0) + abort(); +#endif + exit(0); +} |