[libitm] Add SPARC bits

Eric Botcazou ebotcazou@adacore.com
Mon Feb 27 20:56:00 GMT 2012


> We need a reliable way to test for v9/v8plus/whatever properly because
> nobody is testing current gcc with real 32-bit pre-v9 sparc hardware and
> not providing atomics and proper cpu_relax implementations is just silly.

Both libgomp and libitm already force -mcpu=v9 though (and simply aren't built 
if it cannot be forced) so I don't think we should care about pre-v9 here.

I think the issue is just how we unify the two cpu_relax implementations:

static inline void
cpu_relax (void)
{
#if defined __arch64__ || defined  __sparc_v9__
  __asm volatile ("membar #LoadLoad" : : : "memory");
#else
  __asm volatile ("" : : : "memory");
#endif
}

for libgomp and:

static inline void
cpu_relax (void)
{
  __asm volatile ("rd %%ccr, %%g0" : : : "memory");
}

for libitm.


Would

static inline void
cpu_relax (void)
{
  __asm volatile ("membar #LoadLoad" : : : "memory");
}

be good enough?

-- 
Eric Botcazou



More information about the Gcc-patches mailing list