-
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.
feat: Add conversions itobool, ifrombool (#101)
Closes #22 --------- Co-authored-by: Craig Roy <[email protected]> Co-authored-by: Craig Roy <[email protected]> Co-authored-by: Mark Koch <[email protected]>
- Loading branch information
1 parent
ede3f51
commit 99ad943
Showing
5 changed files
with
223 additions
and
3 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
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,17 @@ | ||
--- | ||
source: src/custom/conversions.rs | ||
expression: mod_str | ||
--- | ||
; ModuleID = 'test_context' | ||
source_filename = "test_context" | ||
|
||
define i8 @_hl.main.1({ i32, {}, {} } %0) { | ||
alloca_block: | ||
br label %entry_block | ||
|
||
entry_block: ; preds = %alloca_block | ||
%1 = extractvalue { i32, {}, {} } %0, 0 | ||
%2 = icmp eq i32 %1, 1 | ||
%3 = select i1 %2, i8 1, i8 0 | ||
ret i8 %3 | ||
} |
26 changes: 26 additions & 0 deletions
26
src/custom/snapshots/hugr_llvm__custom__conversions__test__ifrombool@[email protected]
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,26 @@ | ||
--- | ||
source: src/custom/conversions.rs | ||
expression: mod_str | ||
--- | ||
; ModuleID = 'test_context' | ||
source_filename = "test_context" | ||
|
||
define i8 @_hl.main.1({ i32, {}, {} } %0) { | ||
alloca_block: | ||
%"0" = alloca i8, align 1 | ||
%"2_0" = alloca { i32, {}, {} }, align 8 | ||
%"4_0" = alloca i8, align 1 | ||
br label %entry_block | ||
|
||
entry_block: ; preds = %alloca_block | ||
store { i32, {}, {} } %0, { i32, {}, {} }* %"2_0", align 4 | ||
%"2_01" = load { i32, {}, {} }, { i32, {}, {} }* %"2_0", align 4 | ||
%1 = extractvalue { i32, {}, {} } %"2_01", 0 | ||
%2 = icmp eq i32 %1, 1 | ||
%3 = select i1 %2, i8 1, i8 0 | ||
store i8 %3, i8* %"4_0", align 1 | ||
%"4_02" = load i8, i8* %"4_0", align 1 | ||
store i8 %"4_02", i8* %"0", align 1 | ||
%"03" = load i8, i8* %"0", align 1 | ||
ret i8 %"03" | ||
} |
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,16 @@ | ||
--- | ||
source: src/custom/conversions.rs | ||
expression: mod_str | ||
--- | ||
; ModuleID = 'test_context' | ||
source_filename = "test_context" | ||
|
||
define { i32, {}, {} } @_hl.main.1(i8 %0) { | ||
alloca_block: | ||
br label %entry_block | ||
|
||
entry_block: ; preds = %alloca_block | ||
%eq1 = icmp eq i8 %0, 1 | ||
%1 = select i1 %eq1, { i32, {}, {} } { i32 1, {} poison, {} undef }, { i32, {}, {} } { i32 0, {} undef, {} poison } | ||
ret { i32, {}, {} } %1 | ||
} |
25 changes: 25 additions & 0 deletions
25
src/custom/snapshots/hugr_llvm__custom__conversions__test__itobool@[email protected]
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,25 @@ | ||
--- | ||
source: src/custom/conversions.rs | ||
expression: mod_str | ||
--- | ||
; ModuleID = 'test_context' | ||
source_filename = "test_context" | ||
|
||
define { i32, {}, {} } @_hl.main.1(i8 %0) { | ||
alloca_block: | ||
%"0" = alloca { i32, {}, {} }, align 8 | ||
%"2_0" = alloca i8, align 1 | ||
%"4_0" = alloca { i32, {}, {} }, align 8 | ||
br label %entry_block | ||
|
||
entry_block: ; preds = %alloca_block | ||
store i8 %0, i8* %"2_0", align 1 | ||
%"2_01" = load i8, i8* %"2_0", align 1 | ||
%eq1 = icmp eq i8 %"2_01", 1 | ||
%1 = select i1 %eq1, { i32, {}, {} } { i32 1, {} poison, {} undef }, { i32, {}, {} } { i32 0, {} undef, {} poison } | ||
store { i32, {}, {} } %1, { i32, {}, {} }* %"4_0", align 4 | ||
%"4_02" = load { i32, {}, {} }, { i32, {}, {} }* %"4_0", align 4 | ||
store { i32, {}, {} } %"4_02", { i32, {}, {} }* %"0", align 4 | ||
%"03" = load { i32, {}, {} }, { i32, {}, {} }* %"0", align 4 | ||
ret { i32, {}, {} } %"03" | ||
} |