PPC atomic.h and compare_exchange_val forms

Steven Munroe sjmunroe@us.ibm.com
Tue Apr 15 19:32:00 GMT 2003


I sent the patch to libc-alpha to fix the current problem for PPC64 but 
I think there is a larger issue that needs to be discussed.

For the macros defined by include/atomic.h, which forms are included for 
the convenience of specific architecture and which forms are part of the 
common API (i.e. can they be freely used in arch independent parts of 
glibc)?

For example atomic_compare_and_exchange_val_acq. Are all forms (8-, 16-, 
32-, and 64-bit) of this operation expected to be available for general 
use?

A quick review of arch specific atomic.h's shows that only i386 and m68k 
  support the 8- and 16-bit forms. Most arch's define these to abort(). 
  The 64-bit form is also problematic on most 32-bit arches.

For PPC32/PPC64 implementing the 8- and 16-bit forms would be 
problematic. The resulting code would be slow and prone to live lock 
conditions. I assume that this is true for most architectures.

I recommend dropping any mention of the 8- and 16-bit forms from 
include/atomic.h.



More information about the Libc-hacker mailing list