Skip to content

Instantly share code, notes, and snippets.

@eupp
Last active August 22, 2023 15:52
Show Gist options
  • Save eupp/b67107ecd143af9b37ad1ca0bf3d8c03 to your computer and use it in GitHub Desktop.
Save eupp/b67107ecd143af9b37ad1ca0bf3d8c03 to your computer and use it in GitHub Desktop.
LLVM Atomic instructions example
store atomic i32 1, ptr %ptr, seq_cst, align 4
store atomic i32 2, ptr %ptr, release, align 4
store atomic i32 3, ptr %ptr, monotonic, align 4
store atomic i32 4, ptr %ptr, unordered, align 4
store i32 5, ptr %ptr, align 4 ;; NotAtomic
...
%r1 = load atomic i32, ptr %ptr, seq_cst, align 4
%r2 = load atomic i32, ptr %ptr, release, align 4
%r3 = load atomic i32, ptr %ptr, monotonic, align 4
%r4 = load atomic i32, ptr %ptr, unordered, align 4
%r5 = load i32, ptr %ptr, align 4 ;; NotAtomic
...
fence acquire
fence release
fence seq_cst
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment