aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.target/i386/raoint-aadd-2.c
blob: 8ae9bc25b17d73ddfee0e50c5a9ba627fb6c2fbf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
/* { dg-do run { target { *-*-linux* && { ! ia32 } } } }*/
/* { dg-require-effective-target raoint }*/
/* { dg-options "-pthread -O2 -mraoint" }*/
#include "rao-helper.h"

const unsigned int inc_val = 3;
const unsigned int num_iters= 1000000;
static long long shared_val = 0;

static
void* threads_worker (state_t *tstate)
{
  int i;
  for (i = 0; i < num_iters; i++) 
     _aadd_i64 (&shared_val, inc_val);
  return 0;
}

static void
rao_test (void)
{
  if (shared_val != num_iters * num_threads * inc_val)
    abort ();	
}