|
56 | 56 | #include "opal/sys/architecture.h"
|
57 | 57 | #include "opal_stdatomic.h"
|
58 | 58 |
|
59 |
| -#if OPAL_ASSEMBLY_BUILTIN == OPAL_BUILTIN_C11 && !defined(__INTEL_COMPILER) |
60 |
| - |
61 |
| -# include "atomic_stdc.h" |
62 |
| - |
63 |
| -#else /* !OPAL_C_HAVE__ATOMIC */ |
64 |
| - |
65 |
| - |
66 | 59 | BEGIN_C_DECLS
|
67 | 60 |
|
68 |
| -/********************************************************************** |
69 |
| - * |
70 |
| - * Load the appropriate architecture files and set some reasonable |
71 |
| - * default values for our support |
72 |
| - * |
73 |
| - *********************************************************************/ |
74 |
| -# if defined(DOXYGEN) |
75 |
| -/* don't include system-level gorp when generating doxygen files */ |
76 |
| -# elif OPAL_ASSEMBLY_BUILTIN == OPAL_BUILTIN_GCC |
77 |
| -# include "opal/sys/gcc_builtin/atomic.h" |
78 |
| -# elif OPAL_ASSEMBLY_ARCH == OPAL_X86_64 |
79 |
| -# include "opal/sys/x86_64/atomic.h" |
80 |
| -# elif OPAL_ASSEMBLY_ARCH == OPAL_ARM |
81 |
| -# include "opal/sys/arm/atomic.h" |
82 |
| -# elif OPAL_ASSEMBLY_ARCH == OPAL_ARM64 |
83 |
| -# include "opal/sys/arm64/atomic.h" |
84 |
| -# elif OPAL_ASSEMBLY_ARCH == OPAL_IA32 |
85 |
| -# include "opal/sys/ia32/atomic.h" |
86 |
| -# elif OPAL_ASSEMBLY_ARCH == OPAL_POWERPC32 |
87 |
| -# include "opal/sys/powerpc/atomic.h" |
88 |
| -# elif OPAL_ASSEMBLY_ARCH == OPAL_POWERPC64 |
89 |
| -# include "opal/sys/powerpc/atomic.h" |
90 |
| -# endif |
91 |
| - |
92 |
| -# ifndef DOXYGEN |
93 |
| -/* compare and set operations can't really be emulated from software, |
94 |
| - so if these defines aren't already set, they should be set to 0 |
95 |
| - now */ |
96 |
| -# ifndef OPAL_HAVE_ATOMIC_COMPARE_EXCHANGE_128 |
97 |
| -# define OPAL_HAVE_ATOMIC_COMPARE_EXCHANGE_128 0 |
98 |
| -# endif |
99 |
| -# ifndef OPAL_HAVE_ATOMIC_LLSC_32 |
100 |
| -# define OPAL_HAVE_ATOMIC_LLSC_32 0 |
101 |
| -# endif |
102 |
| -# ifndef OPAL_HAVE_ATOMIC_LLSC_64 |
103 |
| -# define OPAL_HAVE_ATOMIC_LLSC_64 0 |
104 |
| -# endif |
105 |
| -# endif /* DOXYGEN */ |
106 |
| - |
107 |
| - |
108 | 61 | /**********************************************************************
|
109 | 62 | *
|
110 | 63 | * Memory Barriers
|
@@ -158,6 +111,18 @@ static inline void opal_atomic_wmb(void);
|
158 | 111 | * over the 32 and 64 bit implementations).
|
159 | 112 | *
|
160 | 113 | *********************************************************************/
|
| 114 | + |
| 115 | +/* |
| 116 | + * The stdc implementation is implemetned as macros around the C11 |
| 117 | + * atomic interface (which is a type-independent interface). While it |
| 118 | + * would be better to have type checking so developers using the C11 |
| 119 | + * interface didn't accidently munge something that broke on other |
| 120 | + * implementations, there are a ton of warnings due to volatile casing |
| 121 | + * in the opal_lifo code. Don't enforce the types of the function |
| 122 | + * calls on C11 until we can sort that out. |
| 123 | + */ |
| 124 | +#if !(OPAL_ASSEMBLY_BUILTIN == OPAL_BUILTIN_C11 && !defined(__INTEL_COMPILER)) |
| 125 | + |
161 | 126 | /**
|
162 | 127 | * Atomic compare and set of 32 bit intergers with acquire and release semantics.
|
163 | 128 | *
|
@@ -284,7 +249,6 @@ static inline bool opal_atomic_compare_exchange_strong_acq_ptr(opal_atomic_intpt
|
284 | 249 | static inline bool opal_atomic_compare_exchange_strong_rel_ptr(opal_atomic_intptr_t *addr,
|
285 | 250 | intptr_t *oldval, intptr_t newval);
|
286 | 251 |
|
287 |
| - |
288 | 252 | /**********************************************************************
|
289 | 253 | *
|
290 | 254 | * Swap
|
@@ -321,6 +285,8 @@ static inline int64_t opal_atomic_swap_64(opal_atomic_int64_t *addr, int64_t new
|
321 | 285 | */
|
322 | 286 | static inline intptr_t opal_atomic_swap_ptr(opal_atomic_intptr_t *addr, intptr_t newval);
|
323 | 287 |
|
| 288 | +#endif /* #if !(OPAL_ASSEMBLY_BUILTIN == OPAL_BUILTIN_C11 && !defined(__INTEL_COMPILER)) */ |
| 289 | + |
324 | 290 |
|
325 | 291 | /**********************************************************************
|
326 | 292 | *
|
@@ -410,8 +376,6 @@ static inline size_t opal_atomic_fetch_add_size_t(opal_atomic_size_t *addr, size
|
410 | 376 | static inline void opal_atomic_add(type *addr, type delta);
|
411 | 377 | #endif
|
412 | 378 |
|
413 |
| -#endif /* !OPAL_C_HAVE__ATOMIC */ |
414 |
| - |
415 | 379 |
|
416 | 380 | /**********************************************************************
|
417 | 381 | *
|
@@ -444,20 +408,56 @@ static inline void opal_atomic_sc_ptr(opal_atomic_intptr_t *addr, intptr_t newva
|
444 | 408 |
|
445 | 409 | #endif
|
446 | 410 |
|
| 411 | + |
| 412 | +/********************************************************************** |
| 413 | + * |
| 414 | + * Load the appropriate architecture files and set some reasonable |
| 415 | + * default values for our support |
| 416 | + * |
| 417 | + *********************************************************************/ |
| 418 | + |
| 419 | +#if defined(DOXYGEN) |
| 420 | +/* don't include system-level gorp when generating doxygen files */ |
| 421 | +#elif OPAL_ASSEMBLY_BUILTIN == OPAL_BUILTIN_C11 && !defined(__INTEL_COMPILER) |
| 422 | +# include "opal/sys/atomic_stdc.h" |
| 423 | +#elif OPAL_ASSEMBLY_BUILTIN == OPAL_BUILTIN_GCC |
| 424 | +# include "opal/sys/gcc_builtin/atomic.h" |
| 425 | +#elif OPAL_ASSEMBLY_ARCH == OPAL_X86_64 |
| 426 | +# include "opal/sys/x86_64/atomic.h" |
| 427 | +#elif OPAL_ASSEMBLY_ARCH == OPAL_ARM64 |
| 428 | +# include "opal/sys/arm64/atomic.h" |
| 429 | +#elif OPAL_ASSEMBLY_ARCH == OPAL_POWERPC64 |
| 430 | +# include "opal/sys/powerpc/atomic.h" |
| 431 | +#endif |
| 432 | + |
447 | 433 | #if OPAL_ASSEMBLY_ARCH == OPAL_ARM64
|
448 | 434 | # include "opal/sys/arm64/atomic_llsc.h"
|
449 | 435 | #elif OPAL_ASSEMBLY_ARCH == OPAL_POWERPC64
|
450 | 436 | # include "opal/sys/powerpc/atomic_llsc.h"
|
451 | 437 | #endif
|
452 | 438 |
|
453 |
| -#if !defined(OPAL_HAVE_ATOMIC_LLSC_32) |
| 439 | + |
| 440 | +/********************************************************************** |
| 441 | + * |
| 442 | + * Ensure defines for the few optional features are always defined |
| 443 | + * |
| 444 | + *********************************************************************/ |
| 445 | + |
| 446 | +#ifndef OPAL_HAVE_ATOMIC_COMPARE_EXCHANGE_128 |
| 447 | +# define OPAL_HAVE_ATOMIC_COMPARE_EXCHANGE_128 0 |
| 448 | +#endif |
| 449 | + |
| 450 | +#ifndef OPAL_HAVE_ATOMIC_LLSC_32 |
454 | 451 | # define OPAL_HAVE_ATOMIC_LLSC_32 0
|
455 | 452 | #endif
|
456 | 453 |
|
457 |
| -#if !defined(OPAL_HAVE_ATOMIC_LLSC_64) |
| 454 | +#ifndef OPAL_HAVE_ATOMIC_LLSC_64 |
458 | 455 | # define OPAL_HAVE_ATOMIC_LLSC_64 0
|
459 | 456 | #endif
|
460 | 457 |
|
| 458 | +#ifndef OPAL_HAVE_ATOMIC_LLSC_PTR |
| 459 | +# define OPAL_HAVE_ATOMIC_LLSC_PTR 0 |
| 460 | +#endif |
461 | 461 |
|
462 | 462 | END_C_DECLS
|
463 | 463 |
|
|
0 commit comments