OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [gcc.dg/] [atomic-flag.c] - Blame information for rev 689

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 689 jeremybenn
/* Test __atomic routines for existence and execution.  */
2
/* { dg-do run } */
3
 
4
/* Test that __atomic_test_and_set and __atomic_clear builtins execute.  */
5
 
6
extern void abort(void);
7
unsigned char a;
8
 
9
main ()
10
{
11
  int b;
12
 
13
  __atomic_clear (&a, __ATOMIC_RELAXED);
14
  if (a != 0)
15
    abort ();
16
 
17
  b = __atomic_test_and_set (&a, __ATOMIC_SEQ_CST);
18
  if (a != __GCC_ATOMIC_TEST_AND_SET_TRUEVAL || b != 0)
19
    abort ();
20
 
21
  b = __atomic_test_and_set (&a, __ATOMIC_ACQ_REL);
22
  if (a != __GCC_ATOMIC_TEST_AND_SET_TRUEVAL || b != 1)
23
    abort ();
24
 
25
  __atomic_clear (&a, __ATOMIC_SEQ_CST);
26
  if (a != 0)
27
    abort ();
28
 
29
  return 0;
30
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.