-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add conditional circuit box * fix lint
- Loading branch information
Showing
6 changed files
with
261 additions
and
1 deletion.
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
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,69 @@ | ||
; ModuleID = 'test_pytket_qir_conditional_10' | ||
source_filename = "test_pytket_qir_conditional_10" | ||
|
||
%Qubit = type opaque | ||
%Result = type opaque | ||
|
||
@0 = internal constant [2 x i8] c"a\00" | ||
@1 = internal constant [2 x i8] c"c\00" | ||
|
||
define void @main() #0 { | ||
entry: | ||
%0 = call i64 @reg2var(i1 false, i1 false, i1 false, i1 false, i1 false, i1 false, i1 false, i1 false, i1 false, i1 false, i1 false, i1 false, i1 false, i1 false, i1 false, i1 false, i1 false, i1 false, i1 false, i1 false, i1 false, i1 false, i1 false, i1 false, i1 false, i1 false, i1 false, i1 false, i1 false, i1 false, i1 false, i1 false, i1 false, i1 false, i1 false, i1 false, i1 false, i1 false, i1 false, i1 false, i1 false, i1 false, i1 false, i1 false, i1 false, i1 false, i1 false, i1 false, i1 false, i1 false, i1 false, i1 false, i1 false, i1 false, i1 false, i1 false, i1 false, i1 false, i1 false, i1 false, i1 false, i1 false, i1 false, i1 false) | ||
%1 = call i64 @reg2var(i1 false, i1 false, i1 false, i1 false, i1 false, i1 false, i1 false, i1 false, i1 false, i1 false, i1 false, i1 false, i1 false, i1 false, i1 false, i1 false, i1 false, i1 false, i1 false, i1 false, i1 false, i1 false, i1 false, i1 false, i1 false, i1 false, i1 false, i1 false, i1 false, i1 false, i1 false, i1 false, i1 false, i1 false, i1 false, i1 false, i1 false, i1 false, i1 false, i1 false, i1 false, i1 false, i1 false, i1 false, i1 false, i1 false, i1 false, i1 false, i1 false, i1 false, i1 false, i1 false, i1 false, i1 false, i1 false, i1 false, i1 false, i1 false, i1 false, i1 false, i1 false, i1 false, i1 false, i1 false) | ||
%2 = call i1 @read_bit_from_reg(i64 %0, i64 0) | ||
br i1 %2, label %then, label %else | ||
|
||
then: ; preds = %entry | ||
%3 = or i64 %1, %1 | ||
call void @set_all_bits_in_reg(i64 %1, i64 %3) | ||
call void @__quantum__qis__x__body(%Qubit* null) | ||
call void @__quantum__qis__z__body(%Qubit* inttoptr (i64 1 to %Qubit*)) | ||
call void @__quantum__qis__y__body(%Qubit* inttoptr (i64 2 to %Qubit*)) | ||
call void @__quantum__qis__h__body(%Qubit* inttoptr (i64 3 to %Qubit*)) | ||
call void @__quantum__qis__h__body(%Qubit* null) | ||
br label %continue | ||
|
||
else: ; preds = %entry | ||
br label %continue | ||
|
||
continue: ; preds = %else, %then | ||
call void @__quantum__rt__tuple_start_record_output() | ||
call void @__quantum__rt__int_record_output(i64 %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @0, i32 0, i32 0)) | ||
call void @__quantum__rt__int_record_output(i64 %1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @1, i32 0, i32 0)) | ||
call void @__quantum__rt__tuple_end_record_output() | ||
ret void | ||
} | ||
|
||
declare i1 @read_bit_from_reg(i64, i64) | ||
|
||
declare void @set_one_bit_in_reg(i64, i64, i1) | ||
|
||
declare void @set_all_bits_in_reg(i64, i64) | ||
|
||
declare i1 @__quantum__qis__read_result__body(%Result*) | ||
|
||
declare i64 @reg2var(i1, i1, i1, i1, i1, i1, i1, i1, i1, i1, i1, i1, i1, i1, i1, i1, i1, i1, i1, i1, i1, i1, i1, i1, i1, i1, i1, i1, i1, i1, i1, i1, i1, i1, i1, i1, i1, i1, i1, i1, i1, i1, i1, i1, i1, i1, i1, i1, i1, i1, i1, i1, i1, i1, i1, i1, i1, i1, i1, i1, i1, i1, i1, i1) | ||
|
||
declare void @__quantum__rt__int_record_output(i64, i8*) | ||
|
||
declare void @__quantum__rt__tuple_start_record_output() | ||
|
||
declare void @__quantum__rt__tuple_end_record_output() | ||
|
||
declare void @__quantum__qis__x__body(%Qubit*) | ||
|
||
declare void @__quantum__qis__z__body(%Qubit*) | ||
|
||
declare void @__quantum__qis__y__body(%Qubit*) | ||
|
||
declare void @__quantum__qis__h__body(%Qubit*) | ||
|
||
attributes #0 = { "entry_point" "num_required_qubits"="4" "num_required_results"="4" "output_labeling_schema" "qir_profiles"="custom" } | ||
|
||
!llvm.module.flags = !{!0, !1, !2, !3} | ||
|
||
!0 = !{i32 1, !"qir_major_version", i32 1} | ||
!1 = !{i32 7, !"qir_minor_version", i32 0} | ||
!2 = !{i32 1, !"dynamic_qubit_management", i1 false} | ||
!3 = !{i32 1, !"dynamic_result_management", i1 false} |
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,57 @@ | ||
; ModuleID = 'test_pytket_qir_conditional_8' | ||
source_filename = "test_pytket_qir_conditional_8" | ||
|
||
%Qubit = type opaque | ||
%Result = type opaque | ||
|
||
@0 = internal constant [2 x i8] c"a\00" | ||
|
||
define void @main() #0 { | ||
entry: | ||
%0 = call i64 @reg2var(i1 false, i1 false, i1 false, i1 false, i1 false, i1 false, i1 false, i1 false, i1 false, i1 false, i1 false, i1 false, i1 false, i1 false, i1 false, i1 false, i1 false, i1 false, i1 false, i1 false, i1 false, i1 false, i1 false, i1 false, i1 false, i1 false, i1 false, i1 false, i1 false, i1 false, i1 false, i1 false, i1 false, i1 false, i1 false, i1 false, i1 false, i1 false, i1 false, i1 false, i1 false, i1 false, i1 false, i1 false, i1 false, i1 false, i1 false, i1 false, i1 false, i1 false, i1 false, i1 false, i1 false, i1 false, i1 false, i1 false, i1 false, i1 false, i1 false, i1 false, i1 false, i1 false, i1 false, i1 false) | ||
%1 = call i1 @read_bit_from_reg(i64 %0, i64 0) | ||
br i1 %1, label %then, label %else | ||
|
||
then: ; preds = %entry | ||
call void @__quantum__qis__h__body(%Qubit* null) | ||
call void @__quantum__qis__h__body(%Qubit* inttoptr (i64 1 to %Qubit*)) | ||
call void @__quantum__qis__h__body(%Qubit* inttoptr (i64 2 to %Qubit*)) | ||
call void @__quantum__qis__h__body(%Qubit* inttoptr (i64 3 to %Qubit*)) | ||
br label %continue | ||
|
||
else: ; preds = %entry | ||
br label %continue | ||
|
||
continue: ; preds = %else, %then | ||
call void @__quantum__rt__tuple_start_record_output() | ||
call void @__quantum__rt__int_record_output(i64 %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @0, i32 0, i32 0)) | ||
call void @__quantum__rt__tuple_end_record_output() | ||
ret void | ||
} | ||
|
||
declare i1 @read_bit_from_reg(i64, i64) | ||
|
||
declare void @set_one_bit_in_reg(i64, i64, i1) | ||
|
||
declare void @set_all_bits_in_reg(i64, i64) | ||
|
||
declare i1 @__quantum__qis__read_result__body(%Result*) | ||
|
||
declare i64 @reg2var(i1, i1, i1, i1, i1, i1, i1, i1, i1, i1, i1, i1, i1, i1, i1, i1, i1, i1, i1, i1, i1, i1, i1, i1, i1, i1, i1, i1, i1, i1, i1, i1, i1, i1, i1, i1, i1, i1, i1, i1, i1, i1, i1, i1, i1, i1, i1, i1, i1, i1, i1, i1, i1, i1, i1, i1, i1, i1, i1, i1, i1, i1, i1, i1) | ||
|
||
declare void @__quantum__rt__int_record_output(i64, i8*) | ||
|
||
declare void @__quantum__rt__tuple_start_record_output() | ||
|
||
declare void @__quantum__rt__tuple_end_record_output() | ||
|
||
declare void @__quantum__qis__h__body(%Qubit*) | ||
|
||
attributes #0 = { "entry_point" "num_required_qubits"="4" "num_required_results"="4" "output_labeling_schema" "qir_profiles"="custom" } | ||
|
||
!llvm.module.flags = !{!0, !1, !2, !3} | ||
|
||
!0 = !{i32 1, !"qir_major_version", i32 1} | ||
!1 = !{i32 7, !"qir_minor_version", i32 0} | ||
!2 = !{i32 1, !"dynamic_qubit_management", i1 false} | ||
!3 = !{i32 1, !"dynamic_result_management", i1 false} |
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,63 @@ | ||
; ModuleID = 'test_pytket_qir_conditional_9' | ||
source_filename = "test_pytket_qir_conditional_9" | ||
|
||
%Qubit = type opaque | ||
%Result = type opaque | ||
|
||
@0 = internal constant [2 x i8] c"a\00" | ||
|
||
define void @main() #0 { | ||
entry: | ||
%0 = call i64 @reg2var(i1 false, i1 false, i1 false, i1 false, i1 false, i1 false, i1 false, i1 false, i1 false, i1 false, i1 false, i1 false, i1 false, i1 false, i1 false, i1 false, i1 false, i1 false, i1 false, i1 false, i1 false, i1 false, i1 false, i1 false, i1 false, i1 false, i1 false, i1 false, i1 false, i1 false, i1 false, i1 false, i1 false, i1 false, i1 false, i1 false, i1 false, i1 false, i1 false, i1 false, i1 false, i1 false, i1 false, i1 false, i1 false, i1 false, i1 false, i1 false, i1 false, i1 false, i1 false, i1 false, i1 false, i1 false, i1 false, i1 false, i1 false, i1 false, i1 false, i1 false, i1 false, i1 false, i1 false, i1 false) | ||
%1 = call i1 @read_bit_from_reg(i64 %0, i64 0) | ||
br i1 %1, label %then, label %else | ||
|
||
then: ; preds = %entry | ||
call void @__quantum__qis__x__body(%Qubit* null) | ||
call void @__quantum__qis__z__body(%Qubit* inttoptr (i64 1 to %Qubit*)) | ||
call void @__quantum__qis__y__body(%Qubit* inttoptr (i64 2 to %Qubit*)) | ||
call void @__quantum__qis__h__body(%Qubit* inttoptr (i64 3 to %Qubit*)) | ||
br label %continue | ||
|
||
else: ; preds = %entry | ||
br label %continue | ||
|
||
continue: ; preds = %else, %then | ||
call void @__quantum__rt__tuple_start_record_output() | ||
call void @__quantum__rt__int_record_output(i64 %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @0, i32 0, i32 0)) | ||
call void @__quantum__rt__tuple_end_record_output() | ||
ret void | ||
} | ||
|
||
declare i1 @read_bit_from_reg(i64, i64) | ||
|
||
declare void @set_one_bit_in_reg(i64, i64, i1) | ||
|
||
declare void @set_all_bits_in_reg(i64, i64) | ||
|
||
declare i1 @__quantum__qis__read_result__body(%Result*) | ||
|
||
declare i64 @reg2var(i1, i1, i1, i1, i1, i1, i1, i1, i1, i1, i1, i1, i1, i1, i1, i1, i1, i1, i1, i1, i1, i1, i1, i1, i1, i1, i1, i1, i1, i1, i1, i1, i1, i1, i1, i1, i1, i1, i1, i1, i1, i1, i1, i1, i1, i1, i1, i1, i1, i1, i1, i1, i1, i1, i1, i1, i1, i1, i1, i1, i1, i1, i1, i1) | ||
|
||
declare void @__quantum__rt__int_record_output(i64, i8*) | ||
|
||
declare void @__quantum__rt__tuple_start_record_output() | ||
|
||
declare void @__quantum__rt__tuple_end_record_output() | ||
|
||
declare void @__quantum__qis__x__body(%Qubit*) | ||
|
||
declare void @__quantum__qis__z__body(%Qubit*) | ||
|
||
declare void @__quantum__qis__y__body(%Qubit*) | ||
|
||
declare void @__quantum__qis__h__body(%Qubit*) | ||
|
||
attributes #0 = { "entry_point" "num_required_qubits"="4" "num_required_results"="4" "output_labeling_schema" "qir_profiles"="custom" } | ||
|
||
!llvm.module.flags = !{!0, !1, !2, !3} | ||
|
||
!0 = !{i32 1, !"qir_major_version", i32 1} | ||
!1 = !{i32 7, !"qir_minor_version", i32 0} | ||
!2 = !{i32 1, !"dynamic_qubit_management", i1 false} | ||
!3 = !{i32 1, !"dynamic_result_management", i1 false} |