-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Implement lowerings for ieq,ilt_s,sub in int codegen extension (#…
…33)
- Loading branch information
Showing
13 changed files
with
358 additions
and
38 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
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,15 @@ | ||
--- | ||
source: src/custom/int.rs | ||
expression: module.to_string() | ||
--- | ||
; ModuleID = 'test_context' | ||
source_filename = "test_context" | ||
|
||
define i8 @_hl.main.1(i8 %0, i8 %1) { | ||
alloca_block: | ||
br label %entry_block | ||
|
||
entry_block: ; preds = %alloca_block | ||
%2 = add i8 %0, %1 | ||
ret i8 %2 | ||
} |
27 changes: 27 additions & 0 deletions
27
src/custom/snapshots/hugr_llvm__custom__int__test__iadd@[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,27 @@ | ||
--- | ||
source: src/custom/int.rs | ||
expression: module.to_string() | ||
--- | ||
; ModuleID = 'test_context' | ||
source_filename = "test_context" | ||
|
||
define i8 @_hl.main.1(i8 %0, i8 %1) { | ||
alloca_block: | ||
%"0" = alloca i8, align 1 | ||
%"2_0" = alloca i8, align 1 | ||
%"2_1" = alloca i8, align 1 | ||
%"4_0" = alloca i8, align 1 | ||
br label %entry_block | ||
|
||
entry_block: ; preds = %alloca_block | ||
store i8 %0, i8* %"2_0", align 1 | ||
store i8 %1, i8* %"2_1", align 1 | ||
%"2_01" = load i8, i8* %"2_0", align 1 | ||
%"2_12" = load i8, i8* %"2_1", align 1 | ||
%2 = add i8 %"2_01", %"2_12" | ||
store i8 %2, i8* %"4_0", align 1 | ||
%"4_03" = load i8, i8* %"4_0", align 1 | ||
store i8 %"4_03", i8* %"0", align 1 | ||
%"04" = load i8, i8* %"0", align 1 | ||
ret i8 %"04" | ||
} |
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/int.rs | ||
expression: module.to_string() | ||
--- | ||
; ModuleID = 'test_context' | ||
source_filename = "test_context" | ||
|
||
define { i32, {}, {} } @_hl.main.1(i8 %0, i8 %1) { | ||
alloca_block: | ||
br label %entry_block | ||
|
||
entry_block: ; preds = %alloca_block | ||
%2 = icmp eq i8 %0, %1 | ||
%3 = select i1 %2, { i32, {}, {} } { i32 1, {} poison, {} undef }, { i32, {}, {} } { i32 0, {} undef, {} poison } | ||
ret { i32, {}, {} } %3 | ||
} |
28 changes: 28 additions & 0 deletions
28
src/custom/snapshots/hugr_llvm__custom__int__test__ieq@[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,28 @@ | ||
--- | ||
source: src/custom/int.rs | ||
expression: module.to_string() | ||
--- | ||
; ModuleID = 'test_context' | ||
source_filename = "test_context" | ||
|
||
define { i32, {}, {} } @_hl.main.1(i8 %0, i8 %1) { | ||
alloca_block: | ||
%"0" = alloca { i32, {}, {} }, align 8 | ||
%"2_0" = alloca i8, align 1 | ||
%"2_1" = 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 | ||
store i8 %1, i8* %"2_1", align 1 | ||
%"2_01" = load i8, i8* %"2_0", align 1 | ||
%"2_12" = load i8, i8* %"2_1", align 1 | ||
%2 = icmp eq i8 %"2_01", %"2_12" | ||
%3 = select i1 %2, { i32, {}, {} } { i32 1, {} poison, {} undef }, { i32, {}, {} } { i32 0, {} undef, {} poison } | ||
store { i32, {}, {} } %3, { i32, {}, {} }* %"4_0", align 4 | ||
%"4_03" = load { i32, {}, {} }, { i32, {}, {} }* %"4_0", align 4 | ||
store { i32, {}, {} } %"4_03", { i32, {}, {} }* %"0", align 4 | ||
%"04" = load { i32, {}, {} }, { i32, {}, {} }* %"0", align 4 | ||
ret { i32, {}, {} } %"04" | ||
} |
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/int.rs | ||
expression: module.to_string() | ||
--- | ||
; ModuleID = 'test_context' | ||
source_filename = "test_context" | ||
|
||
define { i32, {}, {} } @_hl.main.1(i8 %0, i8 %1) { | ||
alloca_block: | ||
br label %entry_block | ||
|
||
entry_block: ; preds = %alloca_block | ||
%2 = icmp slt i8 %0, %1 | ||
%3 = select i1 %2, { i32, {}, {} } { i32 1, {} poison, {} undef }, { i32, {}, {} } { i32 0, {} undef, {} poison } | ||
ret { i32, {}, {} } %3 | ||
} |
Oops, something went wrong.