view gcc/testsuite/gcc.target/aarch64/target_attr_21.c @ 158:494b0b89df80 default tip

...
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Mon, 25 May 2020 18:13:55 +0900
parents 2b5abeee2509
children
line wrap: on
line source

/* { dg-do compile } */
/* { dg-options "-march=armv8-a+nolse -mno-outline-atomics" } */

int b, c, d, e, f, h;
short g;
int foo (int) __attribute__ ((__const__));

__attribute__ ((target ("outline-atomics")))
void
bar (void)
{
  while (1)
    {
      while (1)
	{
	  __atomic_load_n (&e, 0);
	  if (foo (2))
	    __sync_val_compare_and_swap (&c, 0, f);
	  b = 1;
	  if (h == e)
	    break;
	}
      __sync_val_compare_and_swap (&g, -1, f);
    }
}

/* { dg-final { scan-assembler-times "bl.*__aarch64_cas2_acq_rel" 1 } } */