@@ -121,7 +121,8 @@ predicate(inst::FCmpInst) = API.LLVMGetFCmpPredicate(inst)
121121
122122# # atomics
123123
124- export is_atomic, ordering, ordering!, SyncScope, syncscope, syncscope!
124+ export is_atomic, ordering, ordering!, SyncScope, syncscope, syncscope!, binop,
125+ isweak, weak!, success_ordering, success_ordering!, failure_ordering, failure_ordering!
125126
126127const AtomicInst = Union{LoadInst, StoreInst, FenceInst, AtomicRMWInst, AtomicCmpXchgInst}
127128
@@ -209,6 +210,69 @@ function syncscope!(inst::AtomicInst, scope::SyncScope)
209210 API. LLVMSetAtomicSyncScopeID (inst, scope)
210211end
211212
213+ """
214+ binop(inst::AtomicRMWInst)
215+
216+ Get the binary operation of the given atomic read-modify-write instruction.
217+ """
218+ function binop (inst:: AtomicRMWInst )
219+ API. LLVMGetAtomicRMWBinOp (inst)
220+ end
221+
222+ """
223+ isweak(inst::AtomicCmpXchgInst)
224+
225+ Check if the given atomic compare-and-exchange instruction is weak.
226+ """
227+ function isweak (inst:: AtomicCmpXchgInst )
228+ API. LLVMGetWeak (inst) |> Bool
229+ end
230+
231+ """
232+ weak!(inst::AtomicCmpXchgInst, is_weak::Bool)
233+
234+ Set whether the given atomic compare-and-exchange instruction is weak.
235+ """
236+ function weak! (inst:: AtomicCmpXchgInst , is_weak:: Bool )
237+ API. LLVMSetWeak (inst, is_weak)
238+ end
239+
240+ """
241+ success_ordering(inst::AtomicCmpXchgInst)
242+
243+ Get the success ordering of the given atomic compare-and-exchange instruction.
244+ """
245+ function success_ordering (inst:: AtomicCmpXchgInst )
246+ API. LLVMGetCmpXchgSuccessOrdering (inst)
247+ end
248+
249+ """
250+ success_ordering!(inst::AtomicCmpXchgInst, ord::API.LLVMAtomicOrdering)
251+
252+ Set the success ordering of the given atomic compare-and-exchange instruction.
253+ """
254+ function success_ordering! (inst:: AtomicCmpXchgInst , ord:: API.LLVMAtomicOrdering )
255+ API. LLVMSetCmpXchgSuccessOrdering (inst, ord)
256+ end
257+
258+ """
259+ failure_ordering(inst::AtomicCmpXchgInst)
260+
261+ Get the failure ordering of the given atomic compare-and-exchange instruction.
262+ """
263+ function failure_ordering (inst:: AtomicCmpXchgInst )
264+ API. LLVMGetCmpXchgFailureOrdering (inst)
265+ end
266+
267+ """
268+ failure_ordering!(inst::AtomicCmpXchgInst, ord::API.LLVMAtomicOrdering)
269+
270+ Set the failure ordering of the given atomic compare-and-exchange instruction.
271+ """
272+ function failure_ordering! (inst:: AtomicCmpXchgInst , ord:: API.LLVMAtomicOrdering )
273+ API. LLVMSetCmpXchgFailureOrdering (inst, ord)
274+ end
275+
212276
213277# # call sites and invocations
214278
0 commit comments