Last active
August 22, 2023 15:52
-
-
Save eupp/b67107ecd143af9b37ad1ca0bf3d8c03 to your computer and use it in GitHub Desktop.
LLVM Atomic instructions example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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