@@ -14,37 +14,32 @@ import Builtin
1414
1515% from SwiftAtomics import *
1616
17- % for (type, size, alignment, builtin) in atomicTypes:
17+ % for (type, size, alignment, builtin, swift ) in atomicTypes:
1818
1919//===----------------------------------------------------------------------===//
2020// ${size} bit Atomic Storage
2121//===----------------------------------------------------------------------===//
2222
23- % if type == "WordPair":
2423@available(SwiftStdlib 5.11, *)
25- % end
26- extension ${type} {
27- /// The storage representation type that `Self` encodes to and decodes from
28- /// which is a suitable type when used in atomic operations.
24+ @frozen
25+ @_alignment(${alignment})
26+ public struct ${type} {
27+ public var _storage: ${builtin}
28+
2929 @available(SwiftStdlib 5.11, *)
30- @_alignment(${alignment})
31- @frozen
32- public struct AtomicRepresentation {
33- public var _storage: ${builtin}
34-
35- @available(SwiftStdlib 5.11, *)
36- @_alwaysEmitIntoClient
37- @_transparent
38- public init(_ _builtin: ${builtin}) {
39- self._storage = _builtin
40- }
30+ @_alwaysEmitIntoClient
31+ @_transparent
32+ public init(_ _builtin: ${builtin}) {
33+ self._storage = _builtin
4134 }
4235}
4336
44- // ${size} bit atomic loads
37+ //===----------------------------------------------------------------------===//
38+ // ${size} bit atomic load
39+ //===----------------------------------------------------------------------===//
4540
4641@available(SwiftStdlib 5.11, *)
47- extension Atomic where Value.AtomicRepresentation == ${type}.AtomicRepresentation {
42+ extension Atomic where Value.AtomicRepresentation == ${type} {
4843 /// Atomically loads and returns the current value, applying the specified
4944 /// memory ordering.
5045 ///
@@ -69,10 +64,12 @@ extension Atomic where Value.AtomicRepresentation == ${type}.AtomicRepresentatio
6964 }
7065}
7166
72- // ${size} bit atomic stores
67+ //===----------------------------------------------------------------------===//
68+ // ${size} bit atomic store
69+ //===----------------------------------------------------------------------===//
7370
7471@available(SwiftStdlib 5.11, *)
75- extension Atomic where Value.AtomicRepresentation == ${type}.AtomicRepresentation {
72+ extension Atomic where Value.AtomicRepresentation == ${type} {
7673 /// Atomically sets the current value to `desired`, applying the specified
7774 /// memory ordering.
7875 ///
@@ -101,10 +98,12 @@ extension Atomic where Value.AtomicRepresentation == ${type}.AtomicRepresentatio
10198 }
10299}
103100
101+ //===----------------------------------------------------------------------===//
104102// ${size} bit atomic exchanges
103+ //===----------------------------------------------------------------------===//
105104
106105@available(SwiftStdlib 5.11, *)
107- extension Atomic where Value.AtomicRepresentation == ${type}.AtomicRepresentation {
106+ extension Atomic where Value.AtomicRepresentation == ${type} {
108107 /// Atomically sets the current value to `desired` and returns the original
109108 /// value, applying the specified memory ordering.
110109 ///
@@ -137,10 +136,12 @@ extension Atomic where Value.AtomicRepresentation == ${type}.AtomicRepresentatio
137136 }
138137}
139138
140- // ${size} bit atomic compare and exchanges
139+ //===----------------------------------------------------------------------===//
140+ // ${size} bit atomic compare exchanges
141+ //===----------------------------------------------------------------------===//
141142
142143@available(SwiftStdlib 5.11, *)
143- extension Atomic where Value.AtomicRepresentation == ${type}.AtomicRepresentation {
144+ extension Atomic where Value.AtomicRepresentation == ${type} {
144145 /// Perform an atomic compare and exchange operation on the current value,
145146 /// applying the specified memory ordering.
146147 ///
@@ -181,7 +182,7 @@ extension Atomic where Value.AtomicRepresentation == ${type}.AtomicRepresentatio
181182}
182183
183184@available(SwiftStdlib 5.11, *)
184- extension Atomic where Value.AtomicRepresentation == ${type}.AtomicRepresentation {
185+ extension Atomic where Value.AtomicRepresentation == ${type} {
185186 /// Perform an atomic compare and exchange operation on the current value,
186187 /// applying the specified success/failure memory orderings.
187188 ///
@@ -246,10 +247,12 @@ extension Atomic where Value.AtomicRepresentation == ${type}.AtomicRepresentatio
246247 }
247248}
248249
249- // ${size} bit atomic weak compare and exchanges
250+ //===----------------------------------------------------------------------===//
251+ // ${size} bit weak compare exchanges
252+ //===----------------------------------------------------------------------===//
250253
251254@available(SwiftStdlib 5.11, *)
252- extension Atomic where Value.AtomicRepresentation == ${type}.AtomicRepresentation {
255+ extension Atomic where Value.AtomicRepresentation == ${type} {
253256 /// Perform an atomic weak compare and exchange operation on the current
254257 /// value, applying the memory ordering. This compare-exchange variant is
255258 /// allowed to spuriously fail; it is designed to be called in a loop until
@@ -299,7 +302,7 @@ extension Atomic where Value.AtomicRepresentation == ${type}.AtomicRepresentatio
299302}
300303
301304@available(SwiftStdlib 5.11, *)
302- extension Atomic where Value.AtomicRepresentation == ${type}.AtomicRepresentation {
305+ extension Atomic where Value.AtomicRepresentation == ${type} {
303306 /// Perform an atomic weak compare and exchange operation on the current
304307 /// value, applying the specified success/failure memory orderings. This
305308 /// compare-exchange variant is allowed to spuriously fail; it is designed to
0 commit comments