-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Parse atomic operations introduced in LLVM 9+
This adapts `llvm-pretty-bc-parser` to new atomic operations introduced in LLVM 9 and later: * This bumps the `llvm-pretty` submodule to incorporate the changes from GaloisInc/llvm-pretty#138 and GaloisInc/llvm-pretty#140. * This updates the parsing code in `Data.LLVM.BitCode.IR.Function` to account for atomic `fadd`, `fsub`, `fmax`, `fmin`, `uinc_wrap`, and `udec_wrap` operations. * This ensures that all atomic operations have a corresponding `disasm-test` test case.
- Loading branch information
1 parent
1cfe6e8
commit 84821be
Showing
12 changed files
with
71 additions
and
5 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
define void @atomicrmw(float* %a, float %f) { | ||
%b11 = atomicrmw fadd float* %a, float %f acquire | ||
%b12 = atomicrmw fsub float* %a, float %f acquire | ||
ret void | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
SKIP_TEST | ||
|
||
This test case requires the use of atomic `fadd` and `fsub` operations, which | ||
are only available in LLVM 9 or later. |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
define void @atomicrmw(float* %a, float %f) { | ||
%b13 = atomicrmw fmax float* %a, float %f acquire | ||
%b14 = atomicrmw fmin float* %a, float %f acquire | ||
ret void | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
SKIP_TEST | ||
|
||
This test case requires the use of atomic `fmax` and `fmin` operations, which | ||
are only available in LLVM 15 or later. |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
define void @atomicrmw(i32* %a, i32 %i) { | ||
%b15 = atomicrmw uinc_wrap i32* %a, i32 %i acquire | ||
%b16 = atomicrmw udec_wrap i32* %a, i32 %i acquire | ||
ret void | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
SKIP_TEST | ||
|
||
This test case requires the use of atomic `uinc_wrap` and `udec_wrap` | ||
operations, which are only available in LLVM 16 or later. |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,14 @@ | ||
define void @atomicrmw(i32* %a, i32 %i) { | ||
%b = atomicrmw add i32* %a, i32 %i acquire | ||
%b0 = atomicrmw xchg i32* %a, i32 %i acquire | ||
%b1 = atomicrmw add i32* %a, i32 %i acquire | ||
%b2 = atomicrmw sub i32* %a, i32 %i acquire | ||
%b3 = atomicrmw and i32* %a, i32 %i acquire | ||
%b4 = atomicrmw nand i32* %a, i32 %i acquire | ||
%b5 = atomicrmw or i32* %a, i32 %i acquire | ||
%b6 = atomicrmw xor i32* %a, i32 %i acquire | ||
%b7 = atomicrmw max i32* %a, i32 %i acquire | ||
%b8 = atomicrmw min i32* %a, i32 %i acquire | ||
%b9 = atomicrmw umax i32* %a, i32 %i acquire | ||
%b10 = atomicrmw umin i32* %a, i32 %i acquire | ||
ret void | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
define void @atomicrmw(ptr %a, i32 %i) { | ||
%b15 = atomicrmw uinc_wrap ptr %a, i32 %i acquire | ||
%b16 = atomicrmw udec_wrap ptr %a, i32 %i acquire | ||
ret void | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
SKIP_TEST | ||
|
||
This test case requires the use of atomic `uinc_wrap` and `udec_wrap` | ||
operations, which are only available in LLVM 16 or later. |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,18 @@ | ||
define void @atomicrmw(ptr %a, i32 %i) { | ||
%b = atomicrmw add ptr %a, i32 %i acquire | ||
define void @atomicrmw(ptr %a1, i32 %i, ptr %a2, float %f) { | ||
%b0 = atomicrmw xchg ptr %a1, i32 %i acquire | ||
%b1 = atomicrmw add ptr %a1, i32 %i acquire | ||
%b2 = atomicrmw sub ptr %a1, i32 %i acquire | ||
%b3 = atomicrmw and ptr %a1, i32 %i acquire | ||
%b4 = atomicrmw nand ptr %a1, i32 %i acquire | ||
%b5 = atomicrmw or ptr %a1, i32 %i acquire | ||
%b6 = atomicrmw xor ptr %a1, i32 %i acquire | ||
%b7 = atomicrmw max ptr %a1, i32 %i acquire | ||
%b8 = atomicrmw min ptr %a1, i32 %i acquire | ||
%b9 = atomicrmw umax ptr %a1, i32 %i acquire | ||
%b10 = atomicrmw umin ptr %a1, i32 %i acquire | ||
%b11 = atomicrmw fadd ptr %a2, float %f acquire | ||
%b12 = atomicrmw fsub ptr %a2, float %f acquire | ||
%b13 = atomicrmw fmax ptr %a2, float %f acquire | ||
%b14 = atomicrmw fmin ptr %a2, float %f acquire | ||
ret void | ||
} |
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