From d28b789d2028aef2d5cbe6758c3eaafc88fe0d1c Mon Sep 17 00:00:00 2001 From: "Stefan J. Wernli" Date: Wed, 2 Jul 2025 15:50:31 -0700 Subject: [PATCH 1/5] Switch to `i64` return type from entry point --- source/compiler/qsc/src/codegen/tests.rs | 112 +++++++++--------- source/compiler/qsc/src/interpret/tests.rs | 32 ++--- source/compiler/qsc_codegen/src/qir.rs | 2 +- source/compiler/qsc_codegen/src/qir/tests.rs | 8 +- source/compiler/qsc_partial_eval/src/lib.rs | 2 +- .../src/tests/output_recording.rs | 16 +-- .../src/tests/expression/function_call.rs | 4 +- source/compiler/qsc_qasm/src/tests/output.rs | 4 +- .../qsc_qasm/src/tests/statement/gate_call.rs | 28 ++--- .../qsc_qasm/src/tests/statement/reset.rs | 20 ++-- source/compiler/qsc_rir/src/builder.rs | 6 +- .../qsc_rir/src/passes/ssa_transform/tests.rs | 60 +++++----- .../resources/custom_intrinsics.ll | 4 +- .../adaptive_ri/output/ArithmeticOps.ll | 4 +- .../output/BernsteinVaziraniNISQ.ll | 4 +- .../adaptive_ri/output/ConstantFolding.ll | 4 +- .../output/CopyAndUpdateExpressions.ll | 4 +- .../adaptive_ri/output/DeutschJozsaNISQ.ll | 4 +- .../adaptive_ri/output/ExpandedTests.ll | 4 +- .../resources/adaptive_ri/output/Functors.ll | 4 +- .../adaptive_ri/output/HiddenShiftNISQ.ll | 4 +- .../adaptive_ri/output/IntegerComparison.ll | 4 +- .../adaptive_ri/output/IntrinsicCCNOT.ll | 4 +- .../adaptive_ri/output/IntrinsicCNOT.ll | 4 +- .../adaptive_ri/output/IntrinsicHIXYZ.ll | 4 +- .../adaptive_ri/output/IntrinsicM.ll | 4 +- .../output/IntrinsicMeasureWithBitFlipCode.ll | 4 +- .../IntrinsicMeasureWithPhaseFlipCode.ll | 4 +- .../output/IntrinsicRotationsWithPeriod.ll | 4 +- .../adaptive_ri/output/IntrinsicSTSWAP.ll | 4 +- .../adaptive_ri/output/MeasureAndReuse.ll | 4 +- .../output/MeasurementComparison.ll | 4 +- .../adaptive_ri/output/NestedBranching.ll | 4 +- .../resources/adaptive_ri/output/RandomBit.ll | 4 +- .../adaptive_ri/output/SampleTeleport.ll | 4 +- .../output/ShortcuttingMeasurement.ll | 4 +- .../resources/adaptive_ri/output/Slicing.ll | 4 +- .../adaptive_ri/output/SuperdenseCoding.ll | 4 +- .../adaptive_ri/output/SwitchHandling.ll | 4 +- .../output/ThreeQubitRepetitionCode.ll | 4 +- .../adaptive_ri/output/WithinApply.ll | 4 +- .../resources/adaptive_rif/output/Doubles.ll | 4 +- source/pip/tests/test_interpreter.py | 8 +- source/pip/tests/test_qasm.py | 10 +- source/pip/tests/test_qsharp.py | 12 +- 45 files changed, 218 insertions(+), 226 deletions(-) diff --git a/source/compiler/qsc/src/codegen/tests.rs b/source/compiler/qsc/src/codegen/tests.rs index d31516d00d..98a666d56b 100644 --- a/source/compiler/qsc/src/codegen/tests.rs +++ b/source/compiler/qsc/src/codegen/tests.rs @@ -105,14 +105,14 @@ mod base_profile { %Result = type opaque %Qubit = type opaque - define void @ENTRYPOINT__main() #0 { + define i64 @ENTRYPOINT__main() #0 { block_0: call void @__quantum__qis__rz__body(double 2.0, %Qubit* inttoptr (i64 0 to %Qubit*)) call void @__quantum__qis__rz__body(double 0.0, %Qubit* inttoptr (i64 0 to %Qubit*)) call void @__quantum__qis__rz__body(double 1.0, %Qubit* inttoptr (i64 0 to %Qubit*)) call void @__quantum__qis__m__body(%Qubit* inttoptr (i64 0 to %Qubit*), %Result* inttoptr (i64 0 to %Result*)) call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 0 to %Result*), i8* null) - ret void + ret i64 0 } declare void @__quantum__qis__rz__body(double, %Qubit*) @@ -150,14 +150,14 @@ mod base_profile { %Result = type opaque %Qubit = type opaque - define void @ENTRYPOINT__main() #0 { + define i64 @ENTRYPOINT__main() #0 { block_0: call void @__quantum__qis__m__body(%Qubit* inttoptr (i64 0 to %Qubit*), %Result* inttoptr (i64 0 to %Result*)) call void @__quantum__qis__m__body(%Qubit* inttoptr (i64 1 to %Qubit*), %Result* inttoptr (i64 1 to %Result*)) call void @__quantum__rt__tuple_record_output(i64 2, i8* null) call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 0 to %Result*), i8* null) call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 1 to %Result*), i8* null) - ret void + ret i64 0 } declare void @__quantum__rt__tuple_record_output(i64, i8*) @@ -198,7 +198,7 @@ mod base_profile { %Result = type opaque %Qubit = type opaque - define void @ENTRYPOINT__main() #0 { + define i64 @ENTRYPOINT__main() #0 { block_0: call void @__quantum__qis__x__body(%Qubit* inttoptr (i64 0 to %Qubit*)) call void @__quantum__qis__x__body(%Qubit* inttoptr (i64 1 to %Qubit*)) @@ -207,7 +207,7 @@ mod base_profile { call void @__quantum__rt__array_record_output(i64 2, i8* null) call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 0 to %Result*), i8* null) call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 1 to %Result*), i8* null) - ret void + ret i64 0 } declare void @__quantum__qis__x__body(%Qubit*) @@ -249,7 +249,7 @@ mod base_profile { %Result = type opaque %Qubit = type opaque - define void @ENTRYPOINT__main() #0 { + define i64 @ENTRYPOINT__main() #0 { block_0: call void @__quantum__qis__x__body(%Qubit* inttoptr (i64 0 to %Qubit*)) call void @__quantum__qis__x__body(%Qubit* inttoptr (i64 0 to %Qubit*)) @@ -258,7 +258,7 @@ mod base_profile { call void @__quantum__rt__tuple_record_output(i64 2, i8* null) call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 0 to %Result*), i8* null) call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 1 to %Result*), i8* null) - ret void + ret i64 0 } declare void @__quantum__qis__x__body(%Qubit*) @@ -305,7 +305,7 @@ mod base_profile { %Result = type opaque %Qubit = type opaque - define void @ENTRYPOINT__main() #0 { + define i64 @ENTRYPOINT__main() #0 { block_0: call void @__quantum__qis__x__body(%Qubit* inttoptr (i64 0 to %Qubit*)) call void @__quantum__qis__x__body(%Qubit* inttoptr (i64 0 to %Qubit*)) @@ -314,7 +314,7 @@ mod base_profile { call void @__quantum__rt__tuple_record_output(i64 2, i8* null) call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 0 to %Result*), i8* null) call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 1 to %Result*), i8* null) - ret void + ret i64 0 } declare void @__quantum__qis__x__body(%Qubit*) @@ -369,14 +369,14 @@ mod adaptive_profile { %Result = type opaque %Qubit = type opaque - define void @ENTRYPOINT__main() #0 { + define i64 @ENTRYPOINT__main() #0 { block_0: call void @__quantum__qis__rz__body(double 2.0, %Qubit* inttoptr (i64 0 to %Qubit*)) call void @__quantum__qis__rz__body(double 0.0, %Qubit* inttoptr (i64 0 to %Qubit*)) call void @__quantum__qis__rz__body(double 1.0, %Qubit* inttoptr (i64 0 to %Qubit*)) call void @__quantum__qis__m__body(%Qubit* inttoptr (i64 0 to %Qubit*), %Result* inttoptr (i64 0 to %Result*)) call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 0 to %Result*), i8* null) - ret void + ret i64 0 } declare void @__quantum__qis__rz__body(double, %Qubit*) @@ -414,14 +414,14 @@ mod adaptive_profile { %Result = type opaque %Qubit = type opaque - define void @ENTRYPOINT__main() #0 { + define i64 @ENTRYPOINT__main() #0 { block_0: call void @__quantum__qis__m__body(%Qubit* inttoptr (i64 0 to %Qubit*), %Result* inttoptr (i64 0 to %Result*)) call void @__quantum__qis__m__body(%Qubit* inttoptr (i64 1 to %Qubit*), %Result* inttoptr (i64 1 to %Result*)) call void @__quantum__rt__tuple_record_output(i64 2, i8* null) call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 0 to %Result*), i8* null) call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 1 to %Result*), i8* null) - ret void + ret i64 0 } declare void @__quantum__rt__tuple_record_output(i64, i8*) @@ -463,12 +463,12 @@ mod adaptive_profile { %Result = type opaque %Qubit = type opaque - define void @ENTRYPOINT__main() #0 { + define i64 @ENTRYPOINT__main() #0 { block_0: call void @__quantum__qis__h__body(%Qubit* inttoptr (i64 0 to %Qubit*)) call void @__quantum__qis__mx__body(%Qubit* inttoptr (i64 0 to %Qubit*), %Result* inttoptr (i64 0 to %Result*)) call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 0 to %Result*), i8* null) - ret void + ret i64 0 } declare void @__quantum__qis__h__body(%Qubit*) @@ -512,7 +512,7 @@ mod adaptive_profile { %Result = type opaque %Qubit = type opaque - define void @ENTRYPOINT__main() #0 { + define i64 @ENTRYPOINT__main() #0 { block_0: call void @__quantum__qis__h__body(%Qubit* inttoptr (i64 0 to %Qubit*)) call void @__quantum__qis__h__body(%Qubit* inttoptr (i64 1 to %Qubit*)) @@ -520,7 +520,7 @@ mod adaptive_profile { call void @__quantum__rt__tuple_record_output(i64 2, i8* null) call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 0 to %Result*), i8* null) call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 1 to %Result*), i8* null) - ret void + ret i64 0 } declare void @__quantum__qis__h__body(%Qubit*) @@ -563,7 +563,7 @@ mod adaptive_profile { %Result = type opaque %Qubit = type opaque - define void @ENTRYPOINT__main() #0 { + define i64 @ENTRYPOINT__main() #0 { block_0: call void @__quantum__qis__x__body(%Qubit* inttoptr (i64 0 to %Qubit*)) call void @__quantum__qis__m__body(%Qubit* inttoptr (i64 0 to %Qubit*), %Result* inttoptr (i64 0 to %Result*)) @@ -572,7 +572,7 @@ mod adaptive_profile { call void @__quantum__rt__array_record_output(i64 2, i8* null) call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 0 to %Result*), i8* null) call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 1 to %Result*), i8* null) - ret void + ret i64 0 } declare void @__quantum__qis__x__body(%Qubit*) @@ -633,14 +633,14 @@ mod adaptive_ri_profile { %Result = type opaque %Qubit = type opaque - define void @ENTRYPOINT__main() #0 { + define i64 @ENTRYPOINT__main() #0 { block_0: call void @__quantum__qis__rz__body(double 2.0, %Qubit* inttoptr (i64 0 to %Qubit*)) call void @__quantum__qis__rz__body(double 0.0, %Qubit* inttoptr (i64 0 to %Qubit*)) call void @__quantum__qis__rz__body(double 1.0, %Qubit* inttoptr (i64 0 to %Qubit*)) call void @__quantum__qis__mresetz__body(%Qubit* inttoptr (i64 0 to %Qubit*), %Result* inttoptr (i64 0 to %Result*)) call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 0 to %Result*), i8* null) - ret void + ret i64 0 } declare void @__quantum__qis__rz__body(double, %Qubit*) @@ -679,14 +679,14 @@ mod adaptive_ri_profile { %Result = type opaque %Qubit = type opaque - define void @ENTRYPOINT__main() #0 { + define i64 @ENTRYPOINT__main() #0 { block_0: call void @__quantum__qis__mresetz__body(%Qubit* inttoptr (i64 0 to %Qubit*), %Result* inttoptr (i64 0 to %Result*)) call void @__quantum__qis__mresetz__body(%Qubit* inttoptr (i64 0 to %Qubit*), %Result* inttoptr (i64 1 to %Result*)) call void @__quantum__rt__tuple_record_output(i64 2, i8* null) call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 0 to %Result*), i8* null) call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 1 to %Result*), i8* null) - ret void + ret i64 0 } declare void @__quantum__qis__mresetz__body(%Qubit*, %Result*) #1 @@ -728,7 +728,7 @@ mod adaptive_ri_profile { %Result = type opaque %Qubit = type opaque - define void @ENTRYPOINT__main() #0 { + define i64 @ENTRYPOINT__main() #0 { block_0: call void @__quantum__qis__x__body(%Qubit* inttoptr (i64 0 to %Qubit*)) call void @__quantum__qis__mresetz__body(%Qubit* inttoptr (i64 0 to %Qubit*), %Result* inttoptr (i64 0 to %Result*)) @@ -737,7 +737,7 @@ mod adaptive_ri_profile { call void @__quantum__rt__array_record_output(i64 2, i8* null) call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 0 to %Result*), i8* null) call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 1 to %Result*), i8* null) - ret void + ret i64 0 } declare void @__quantum__qis__x__body(%Qubit*) @@ -780,7 +780,7 @@ mod adaptive_ri_profile { %Result = type opaque %Qubit = type opaque - define void @ENTRYPOINT__main() #0 { + define i64 @ENTRYPOINT__main() #0 { block_0: call void @__quantum__qis__x__body(%Qubit* inttoptr (i64 0 to %Qubit*)) call void @__quantum__qis__x__body(%Qubit* inttoptr (i64 0 to %Qubit*)) @@ -789,7 +789,7 @@ mod adaptive_ri_profile { call void @__quantum__rt__tuple_record_output(i64 2, i8* null) call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 0 to %Result*), i8* null) call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 1 to %Result*), i8* null) - ret void + ret i64 0 } declare void @__quantum__qis__x__body(%Qubit*) @@ -837,7 +837,7 @@ mod adaptive_ri_profile { %Result = type opaque %Qubit = type opaque - define void @ENTRYPOINT__main() #0 { + define i64 @ENTRYPOINT__main() #0 { block_0: call void @__quantum__qis__x__body(%Qubit* inttoptr (i64 0 to %Qubit*)) call void @__quantum__qis__x__body(%Qubit* inttoptr (i64 0 to %Qubit*)) @@ -848,7 +848,7 @@ mod adaptive_ri_profile { call void @__quantum__rt__tuple_record_output(i64 2, i8* null) call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 0 to %Result*), i8* null) call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 1 to %Result*), i8* null) - ret void + ret i64 0 } declare void @__quantum__qis__x__body(%Qubit*) @@ -899,7 +899,7 @@ mod adaptive_ri_profile { %Result = type opaque %Qubit = type opaque - define void @ENTRYPOINT__main() #0 { + define i64 @ENTRYPOINT__main() #0 { block_0: call void @__quantum__qis__x__body(%Qubit* inttoptr (i64 0 to %Qubit*)) call void @__quantum__qis__x__body(%Qubit* inttoptr (i64 1 to %Qubit*)) @@ -910,7 +910,7 @@ mod adaptive_ri_profile { call void @__quantum__rt__tuple_record_output(i64 2, i8* null) call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 0 to %Result*), i8* null) call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 1 to %Result*), i8* null) - ret void + ret i64 0 } declare void @__quantum__qis__x__body(%Qubit*) @@ -951,7 +951,7 @@ mod adaptive_ri_profile { %Result = type opaque %Qubit = type opaque - define void @ENTRYPOINT__main() #0 { + define i64 @ENTRYPOINT__main() #0 { block_0: call void @__quantum__qis__h__body(%Qubit* inttoptr (i64 0 to %Qubit*)) call void @__quantum__qis__mresetz__body(%Qubit* inttoptr (i64 0 to %Qubit*), %Result* inttoptr (i64 0 to %Result*)) @@ -965,7 +965,7 @@ mod adaptive_ri_profile { block_3: %var_4 = phi i64 [0, %block_1], [1, %block_2] call void @__quantum__rt__int_record_output(i64 %var_4, i8* null) - ret void + ret i64 0 } declare void @__quantum__qis__h__body(%Qubit*) @@ -1010,12 +1010,12 @@ mod adaptive_ri_profile { %Result = type opaque %Qubit = type opaque - define void @ENTRYPOINT__main() #0 { + define i64 @ENTRYPOINT__main() #0 { block_0: call void @__quantum__qis__custom_reset__body(%Qubit* inttoptr (i64 0 to %Qubit*)) call void @__quantum__qis__m__body(%Qubit* inttoptr (i64 0 to %Qubit*), %Result* inttoptr (i64 0 to %Result*)) call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 0 to %Result*), i8* null) - ret void + ret i64 0 } declare void @__quantum__qis__custom_reset__body(%Qubit*) #1 @@ -1075,14 +1075,14 @@ mod adaptive_rif_profile { %Result = type opaque %Qubit = type opaque - define void @ENTRYPOINT__main() #0 { + define i64 @ENTRYPOINT__main() #0 { block_0: call void @__quantum__qis__rz__body(double 2.0, %Qubit* inttoptr (i64 0 to %Qubit*)) call void @__quantum__qis__rz__body(double 0.0, %Qubit* inttoptr (i64 0 to %Qubit*)) call void @__quantum__qis__rz__body(double 1.0, %Qubit* inttoptr (i64 0 to %Qubit*)) call void @__quantum__qis__mresetz__body(%Qubit* inttoptr (i64 0 to %Qubit*), %Result* inttoptr (i64 0 to %Result*)) call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 0 to %Result*), i8* null) - ret void + ret i64 0 } declare void @__quantum__qis__rz__body(double, %Qubit*) @@ -1122,14 +1122,14 @@ mod adaptive_rif_profile { %Result = type opaque %Qubit = type opaque - define void @ENTRYPOINT__main() #0 { + define i64 @ENTRYPOINT__main() #0 { block_0: call void @__quantum__qis__mresetz__body(%Qubit* inttoptr (i64 0 to %Qubit*), %Result* inttoptr (i64 0 to %Result*)) call void @__quantum__qis__mresetz__body(%Qubit* inttoptr (i64 0 to %Qubit*), %Result* inttoptr (i64 1 to %Result*)) call void @__quantum__rt__tuple_record_output(i64 2, i8* null) call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 0 to %Result*), i8* null) call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 1 to %Result*), i8* null) - ret void + ret i64 0 } declare void @__quantum__qis__mresetz__body(%Qubit*, %Result*) #1 @@ -1172,7 +1172,7 @@ mod adaptive_rif_profile { %Result = type opaque %Qubit = type opaque - define void @ENTRYPOINT__main() #0 { + define i64 @ENTRYPOINT__main() #0 { block_0: call void @__quantum__qis__x__body(%Qubit* inttoptr (i64 0 to %Qubit*)) call void @__quantum__qis__mresetz__body(%Qubit* inttoptr (i64 0 to %Qubit*), %Result* inttoptr (i64 0 to %Result*)) @@ -1181,7 +1181,7 @@ mod adaptive_rif_profile { call void @__quantum__rt__array_record_output(i64 2, i8* null) call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 0 to %Result*), i8* null) call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 1 to %Result*), i8* null) - ret void + ret i64 0 } declare void @__quantum__qis__x__body(%Qubit*) @@ -1225,7 +1225,7 @@ mod adaptive_rif_profile { %Result = type opaque %Qubit = type opaque - define void @ENTRYPOINT__main() #0 { + define i64 @ENTRYPOINT__main() #0 { block_0: call void @__quantum__qis__x__body(%Qubit* inttoptr (i64 0 to %Qubit*)) call void @__quantum__qis__x__body(%Qubit* inttoptr (i64 0 to %Qubit*)) @@ -1234,7 +1234,7 @@ mod adaptive_rif_profile { call void @__quantum__rt__tuple_record_output(i64 2, i8* null) call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 0 to %Result*), i8* null) call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 1 to %Result*), i8* null) - ret void + ret i64 0 } declare void @__quantum__qis__x__body(%Qubit*) @@ -1283,7 +1283,7 @@ mod adaptive_rif_profile { %Result = type opaque %Qubit = type opaque - define void @ENTRYPOINT__main() #0 { + define i64 @ENTRYPOINT__main() #0 { block_0: call void @__quantum__qis__x__body(%Qubit* inttoptr (i64 0 to %Qubit*)) call void @__quantum__qis__x__body(%Qubit* inttoptr (i64 0 to %Qubit*)) @@ -1294,7 +1294,7 @@ mod adaptive_rif_profile { call void @__quantum__rt__tuple_record_output(i64 2, i8* null) call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 0 to %Result*), i8* null) call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 1 to %Result*), i8* null) - ret void + ret i64 0 } declare void @__quantum__qis__x__body(%Qubit*) @@ -1346,7 +1346,7 @@ mod adaptive_rif_profile { %Result = type opaque %Qubit = type opaque - define void @ENTRYPOINT__main() #0 { + define i64 @ENTRYPOINT__main() #0 { block_0: call void @__quantum__qis__x__body(%Qubit* inttoptr (i64 0 to %Qubit*)) call void @__quantum__qis__x__body(%Qubit* inttoptr (i64 1 to %Qubit*)) @@ -1357,7 +1357,7 @@ mod adaptive_rif_profile { call void @__quantum__rt__tuple_record_output(i64 2, i8* null) call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 0 to %Result*), i8* null) call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 1 to %Result*), i8* null) - ret void + ret i64 0 } declare void @__quantum__qis__x__body(%Qubit*) @@ -1399,7 +1399,7 @@ mod adaptive_rif_profile { %Result = type opaque %Qubit = type opaque - define void @ENTRYPOINT__main() #0 { + define i64 @ENTRYPOINT__main() #0 { block_0: call void @__quantum__qis__h__body(%Qubit* inttoptr (i64 0 to %Qubit*)) call void @__quantum__qis__mresetz__body(%Qubit* inttoptr (i64 0 to %Qubit*), %Result* inttoptr (i64 0 to %Result*)) @@ -1413,7 +1413,7 @@ mod adaptive_rif_profile { block_3: %var_4 = phi i64 [0, %block_1], [1, %block_2] call void @__quantum__rt__int_record_output(i64 %var_4, i8* null) - ret void + ret i64 0 } declare void @__quantum__qis__h__body(%Qubit*) @@ -1455,7 +1455,7 @@ mod adaptive_rif_profile { %Result = type opaque %Qubit = type opaque - define void @ENTRYPOINT__main() #0 { + define i64 @ENTRYPOINT__main() #0 { block_0: call void @__quantum__qis__h__body(%Qubit* inttoptr (i64 0 to %Qubit*)) call void @__quantum__qis__mresetz__body(%Qubit* inttoptr (i64 0 to %Qubit*), %Result* inttoptr (i64 0 to %Result*)) @@ -1469,7 +1469,7 @@ mod adaptive_rif_profile { block_3: %var_4 = phi double [0.0, %block_1], [1.0, %block_2] call void @__quantum__rt__double_record_output(double %var_4, i8* null) - ret void + ret i64 0 } declare void @__quantum__qis__h__body(%Qubit*) @@ -1515,12 +1515,12 @@ mod adaptive_rif_profile { %Result = type opaque %Qubit = type opaque - define void @ENTRYPOINT__main() #0 { + define i64 @ENTRYPOINT__main() #0 { block_0: call void @__quantum__qis__custom_reset__body(%Qubit* inttoptr (i64 0 to %Qubit*)) call void @__quantum__qis__m__body(%Qubit* inttoptr (i64 0 to %Qubit*), %Result* inttoptr (i64 0 to %Result*)) call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 0 to %Result*), i8* null) - ret void + ret i64 0 } declare void @__quantum__qis__custom_reset__body(%Qubit*) #1 @@ -1569,7 +1569,7 @@ mod adaptive_rif_profile { %Result = type opaque %Qubit = type opaque - define void @ENTRYPOINT__main() #0 { + define i64 @ENTRYPOINT__main() #0 { block_0: call void @__quantum__qis__h__body(%Qubit* inttoptr (i64 0 to %Qubit*)) call void @__quantum__qis__mresetz__body(%Qubit* inttoptr (i64 0 to %Qubit*), %Result* inttoptr (i64 0 to %Result*)) @@ -1593,7 +1593,7 @@ mod adaptive_rif_profile { call void @OpA(double %var_9, %Qubit* inttoptr (i64 0 to %Qubit*)) call void @__quantum__qis__rx__body(double %var_9, %Qubit* inttoptr (i64 0 to %Qubit*)) call void @__quantum__rt__double_record_output(double %var_9, i8* null) - ret void + ret i64 0 } declare void @__quantum__qis__h__body(%Qubit*) diff --git a/source/compiler/qsc/src/interpret/tests.rs b/source/compiler/qsc/src/interpret/tests.rs index f4f5a5f6a9..c005660490 100644 --- a/source/compiler/qsc/src/interpret/tests.rs +++ b/source/compiler/qsc/src/interpret/tests.rs @@ -914,12 +914,12 @@ mod given_interpreter { %Result = type opaque %Qubit = type opaque - define void @ENTRYPOINT__main() #0 { + define i64 @ENTRYPOINT__main() #0 { block_0: call void @__quantum__qis__cx__body(%Qubit* inttoptr (i64 0 to %Qubit*), %Qubit* inttoptr (i64 1 to %Qubit*)) call void @__quantum__qis__m__body(%Qubit* inttoptr (i64 0 to %Qubit*), %Result* inttoptr (i64 0 to %Result*)) call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 0 to %Result*), i8* null) - ret void + ret i64 0 } declare void @__quantum__qis__m__body(%Qubit*, %Result*) #1 @@ -975,14 +975,14 @@ mod given_interpreter { %Result = type opaque %Qubit = type opaque - define void @ENTRYPOINT__main() #0 { + define i64 @ENTRYPOINT__main() #0 { block_0: call void @__quantum__qis__rz__body(double 2.0, %Qubit* inttoptr (i64 0 to %Qubit*)) call void @__quantum__qis__rz__body(double 0.0, %Qubit* inttoptr (i64 0 to %Qubit*)) call void @__quantum__qis__rz__body(double 1.0, %Qubit* inttoptr (i64 0 to %Qubit*)) call void @__quantum__qis__mresetz__body(%Qubit* inttoptr (i64 0 to %Qubit*), %Result* inttoptr (i64 0 to %Result*)) call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 0 to %Result*), i8* null) - ret void + ret i64 0 } declare void @__quantum__qis__rz__body(double, %Qubit*) @@ -1032,7 +1032,7 @@ mod given_interpreter { %Result = type opaque %Qubit = type opaque - define void @ENTRYPOINT__main() #0 { + define i64 @ENTRYPOINT__main() #0 { block_0: call void @__quantum__qis__mresetz__body(%Qubit* inttoptr (i64 0 to %Qubit*), %Result* inttoptr (i64 0 to %Result*)) %var_0 = call i1 @__quantum__qis__read_result__body(%Result* inttoptr (i64 0 to %Result*)) @@ -1043,7 +1043,7 @@ mod given_interpreter { call void @__quantum__rt__tuple_record_output(i64 2, i8* null) call void @__quantum__rt__bool_record_output(i1 %var_0, i8* null) call void @__quantum__rt__bool_record_output(i1 %var_3, i8* null) - ret void + ret i64 0 } declare void @__quantum__qis__mresetz__body(%Qubit*, %Result*) #1 @@ -1109,12 +1109,12 @@ mod given_interpreter { %Result = type opaque %Qubit = type opaque - define void @ENTRYPOINT__main() #0 { + define i64 @ENTRYPOINT__main() #0 { block_0: call void @__quantum__qis__cx__body(%Qubit* inttoptr (i64 0 to %Qubit*), %Qubit* inttoptr (i64 1 to %Qubit*)) call void @__quantum__qis__m__body(%Qubit* inttoptr (i64 0 to %Qubit*), %Result* inttoptr (i64 0 to %Result*)) call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 0 to %Result*), i8* null) - ret void + ret i64 0 } declare void @__quantum__qis__m__body(%Qubit*, %Result*) #1 @@ -1153,12 +1153,12 @@ mod given_interpreter { %Result = type opaque %Qubit = type opaque - define void @ENTRYPOINT__main() #0 { + define i64 @ENTRYPOINT__main() #0 { block_0: call void @__quantum__qis__cx__body(%Qubit* inttoptr (i64 0 to %Qubit*), %Qubit* inttoptr (i64 1 to %Qubit*)) call void @__quantum__qis__m__body(%Qubit* inttoptr (i64 0 to %Qubit*), %Result* inttoptr (i64 0 to %Result*)) call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 0 to %Result*), i8* null) - ret void + ret i64 0 } declare void @__quantum__qis__m__body(%Qubit*, %Result*) #1 @@ -1229,12 +1229,12 @@ mod given_interpreter { %Result = type opaque %Qubit = type opaque - define void @ENTRYPOINT__main() #0 { + define i64 @ENTRYPOINT__main() #0 { block_0: call void @__quantum__qis__cx__body(%Qubit* inttoptr (i64 0 to %Qubit*), %Qubit* inttoptr (i64 1 to %Qubit*)) call void @__quantum__qis__m__body(%Qubit* inttoptr (i64 0 to %Qubit*), %Result* inttoptr (i64 0 to %Result*)) call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 0 to %Result*), i8* null) - ret void + ret i64 0 } declare void @__quantum__qis__m__body(%Qubit*, %Result*) #1 @@ -1285,12 +1285,12 @@ mod given_interpreter { %Result = type opaque %Qubit = type opaque - define void @ENTRYPOINT__main() #0 { + define i64 @ENTRYPOINT__main() #0 { block_0: call void @__quantum__qis__cx__body(%Qubit* inttoptr (i64 0 to %Qubit*), %Qubit* inttoptr (i64 1 to %Qubit*)) call void @__quantum__qis__m__body(%Qubit* inttoptr (i64 0 to %Qubit*), %Result* inttoptr (i64 0 to %Result*)) call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 0 to %Result*), i8* null) - ret void + ret i64 0 } declare void @__quantum__qis__m__body(%Qubit*, %Result*) #1 @@ -1340,12 +1340,12 @@ mod given_interpreter { %Result = type opaque %Qubit = type opaque - define void @ENTRYPOINT__main() #0 { + define i64 @ENTRYPOINT__main() #0 { block_0: call void @__quantum__qis__mresetz__body(%Qubit* inttoptr (i64 0 to %Qubit*), %Result* inttoptr (i64 0 to %Result*)) %var_0 = call i1 @check_result(%Result* inttoptr (i64 0 to %Result*)) call void @__quantum__rt__bool_record_output(i1 %var_0, i8* null) - ret void + ret i64 0 } declare void @__quantum__qis__mresetz__body(%Qubit*, %Result*) #1 diff --git a/source/compiler/qsc_codegen/src/qir.rs b/source/compiler/qsc_codegen/src/qir.rs index 71f307cb8f..f167ee81c2 100644 --- a/source/compiler/qsc_codegen/src/qir.rs +++ b/source/compiler/qsc_codegen/src/qir.rs @@ -273,7 +273,7 @@ impl ToQir for rir::Instruction { format!(" br label %{}", ToQir::::to_qir(block_id, program)) } rir::Instruction::Phi(args, variable) => phi_to_qir(args, *variable, program), - rir::Instruction::Return => " ret void".to_string(), + rir::Instruction::Return => " ret i64 0".to_string(), rir::Instruction::Sdiv(lhs, rhs, variable) => { binop_to_qir("sdiv", lhs, rhs, *variable, program) } diff --git a/source/compiler/qsc_codegen/src/qir/tests.rs b/source/compiler/qsc_codegen/src/qir/tests.rs index 59c2927e80..072d13a604 100644 --- a/source/compiler/qsc_codegen/src/qir/tests.rs +++ b/source/compiler/qsc_codegen/src/qir/tests.rs @@ -141,7 +141,7 @@ fn bell_program() { declare void @__quantum__rt__result_record_output(%Result*, i8*) - define void @ENTRYPOINT__main() #0 { + define i64 @ENTRYPOINT__main() #0 { block_0: call void @__quantum__qis__h__body(%Qubit* inttoptr (i64 0 to %Qubit*)) call void @__quantum__qis__cx__body(%Qubit* inttoptr (i64 0 to %Qubit*), %Qubit* inttoptr (i64 1 to %Qubit*)) @@ -150,7 +150,7 @@ fn bell_program() { call void @__quantum__rt__array_record_output(i64 2, i8* null) call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 0 to %Result*), i8* null) call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 1 to %Result*), i8* null) - ret void + ret i64 0 } attributes #0 = { "entry_point" "output_labeling_schema" "qir_profiles"="base_profile" "required_num_qubits"="2" "required_num_results"="2" } @@ -188,7 +188,7 @@ fn teleport_program() { declare void @__quantum__rt__result_record_output(%Result*, i8*) - define void @ENTRYPOINT__main() #0 { + define i64 @ENTRYPOINT__main() #0 { block_0: call void @__quantum__qis__x__body(%Qubit* inttoptr (i64 0 to %Qubit*)) call void @__quantum__qis__h__body(%Qubit* inttoptr (i64 2 to %Qubit*)) @@ -211,7 +211,7 @@ fn teleport_program() { block_4: call void @__quantum__qis__mresetz__body(%Qubit* inttoptr (i64 1 to %Qubit*), %Result* inttoptr (i64 2 to %Result*)) call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 2 to %Result*), i8* null) - ret void + ret i64 0 } attributes #0 = { "entry_point" "output_labeling_schema" "qir_profiles"="adaptive_profile" "required_num_qubits"="3" "required_num_results"="3" } diff --git a/source/compiler/qsc_partial_eval/src/lib.rs b/source/compiler/qsc_partial_eval/src/lib.rs index f106e8bb6b..192ad84b5f 100644 --- a/source/compiler/qsc_partial_eval/src/lib.rs +++ b/source/compiler/qsc_partial_eval/src/lib.rs @@ -225,7 +225,7 @@ impl<'a> PartialEvaluator<'a> { let entry_point = rir::Callable { name: "main".into(), input_type: Vec::new(), - output_type: None, + output_type: Some(rir::Ty::Integer), body: Some(entry_block_id), call_type: CallableType::Regular, }; diff --git a/source/compiler/qsc_partial_eval/src/tests/output_recording.rs b/source/compiler/qsc_partial_eval/src/tests/output_recording.rs index 6972402fc4..2ac2984386 100644 --- a/source/compiler/qsc_partial_eval/src/tests/output_recording.rs +++ b/source/compiler/qsc_partial_eval/src/tests/output_recording.rs @@ -28,7 +28,7 @@ fn output_recording_for_tuple_of_different_types() { name: main call_type: Regular input_type: - output_type: + output_type: Integer body: 0 Callable 1: Callable: name: __quantum__qis__mresetz__body @@ -108,7 +108,7 @@ fn output_recording_for_nested_tuples() { name: main call_type: Regular input_type: - output_type: + output_type: Integer body: 0 Callable 1: Callable: name: __quantum__qis__mresetz__body @@ -196,7 +196,7 @@ fn output_recording_for_tuple_of_arrays() { name: main call_type: Regular input_type: - output_type: + output_type: Integer body: 0 Callable 1: Callable: name: __quantum__qis__mresetz__body @@ -288,7 +288,7 @@ fn output_recording_for_array_of_tuples() { name: main call_type: Regular input_type: - output_type: + output_type: Integer body: 0 Callable 1: Callable: name: __quantum__qis__mresetz__body @@ -380,7 +380,7 @@ fn output_recording_for_literal_bool() { name: main call_type: Regular input_type: - output_type: + output_type: Integer body: 0 Callable 1: Callable: name: __quantum__rt__bool_record_output @@ -422,7 +422,7 @@ fn output_recording_for_literal_double() { name: main call_type: Regular input_type: - output_type: + output_type: Integer body: 0 Callable 1: Callable: name: __quantum__rt__double_record_output @@ -464,7 +464,7 @@ fn output_recording_for_literal_int() { name: main call_type: Regular input_type: - output_type: + output_type: Integer body: 0 Callable 1: Callable: name: __quantum__rt__int_record_output @@ -508,7 +508,7 @@ fn output_recording_for_mix_of_literal_and_variable() { name: main call_type: Regular input_type: - output_type: + output_type: Integer body: 0 Callable 1: Callable: name: __quantum__qis__mresetz__body diff --git a/source/compiler/qsc_qasm/src/tests/expression/function_call.rs b/source/compiler/qsc_qasm/src/tests/expression/function_call.rs index 756005618b..3c29881cdd 100644 --- a/source/compiler/qsc_qasm/src/tests/expression/function_call.rs +++ b/source/compiler/qsc_qasm/src/tests/expression/function_call.rs @@ -315,12 +315,12 @@ fn simulatable_intrinsic_on_def_stmt_generates_correct_qir() -> miette::Result<( %Result = type opaque %Qubit = type opaque - define void @ENTRYPOINT__main() #0 { + define i64 @ENTRYPOINT__main() #0 { block_0: call void @my_gate(%Qubit* inttoptr (i64 0 to %Qubit*)) call void @__quantum__qis__m__body(%Qubit* inttoptr (i64 0 to %Qubit*), %Result* inttoptr (i64 0 to %Result*)) call void @__quantum__rt__tuple_record_output(i64 0, i8* null) - ret void + ret i64 0 } declare void @my_gate(%Qubit*) diff --git a/source/compiler/qsc_qasm/src/tests/output.rs b/source/compiler/qsc_qasm/src/tests/output.rs index adb3c65395..62af898943 100644 --- a/source/compiler/qsc_qasm/src/tests/output.rs +++ b/source/compiler/qsc_qasm/src/tests/output.rs @@ -253,7 +253,7 @@ c2[2] = measure q[4]; %Result = type opaque %Qubit = type opaque - define void @ENTRYPOINT__main() #0 { + define i64 @ENTRYPOINT__main() #0 { block_0: call void @__quantum__qis__rz__body(double 0.4999999999999997, %Qubit* inttoptr (i64 0 to %Qubit*)) call void @__quantum__qis__h__body(%Qubit* inttoptr (i64 0 to %Qubit*)) @@ -274,7 +274,7 @@ c2[2] = measure q[4]; call void @__quantum__rt__array_record_output(i64 2, i8* null) call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 1 to %Result*), i8* null) call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 0 to %Result*), i8* null) - ret void + ret i64 0 } declare void @__quantum__qis__rz__body(double, %Qubit*) diff --git a/source/compiler/qsc_qasm/src/tests/statement/gate_call.rs b/source/compiler/qsc_qasm/src/tests/statement/gate_call.rs index fd871ace73..c4da29a1bb 100644 --- a/source/compiler/qsc_qasm/src/tests/statement/gate_call.rs +++ b/source/compiler/qsc_qasm/src/tests/statement/gate_call.rs @@ -242,12 +242,11 @@ fn barrier_generates_qir() -> miette::Result<(), Vec> { "#; let qsharp = compile_qasm_to_qir(source, Profile::AdaptiveRI)?; - expect![[ - r#" + expect![[r#" %Result = type opaque %Qubit = type opaque - define void @ENTRYPOINT__main() #0 { + define i64 @ENTRYPOINT__main() #0 { block_0: call void @__quantum__qis__barrier__body() call void @__quantum__qis__barrier__body() @@ -256,7 +255,7 @@ fn barrier_generates_qir() -> miette::Result<(), Vec> { call void @__quantum__qis__m__body(%Qubit* inttoptr (i64 0 to %Qubit*), %Result* inttoptr (i64 0 to %Result*)) call void @__quantum__rt__array_record_output(i64 1, i8* null) call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 0 to %Result*), i8* null) - ret void + ret i64 0 } declare void @__quantum__qis__barrier__body() @@ -279,8 +278,7 @@ fn barrier_generates_qir() -> miette::Result<(), Vec> { !2 = !{i32 1, !"dynamic_qubit_management", i1 false} !3 = !{i32 1, !"dynamic_result_management", i1 false} !4 = !{i32 1, !"int_computations", !"i64"} - "# - ]] + "#]] .assert_eq(&qsharp); Ok(()) } @@ -607,12 +605,12 @@ fn simulatable_intrinsic_on_gate_stmt_generates_correct_qir() -> miette::Result< %Result = type opaque %Qubit = type opaque - define void @ENTRYPOINT__main() #0 { + define i64 @ENTRYPOINT__main() #0 { block_0: call void @my_gate(%Qubit* inttoptr (i64 0 to %Qubit*)) call void @__quantum__qis__m__body(%Qubit* inttoptr (i64 0 to %Qubit*), %Result* inttoptr (i64 0 to %Result*)) call void @__quantum__rt__tuple_record_output(i64 0, i8* null) - ret void + ret i64 0 } declare void @my_gate(%Qubit*) @@ -1086,12 +1084,11 @@ fn qasm2_barrier_generates_qir() -> miette::Result<(), Vec> { "#; let qsharp = compile_qasm_to_qir(source, Profile::AdaptiveRI)?; - expect![[ - r#" + expect![[r#" %Result = type opaque %Qubit = type opaque - define void @ENTRYPOINT__main() #0 { + define i64 @ENTRYPOINT__main() #0 { block_0: call void @__quantum__qis__barrier__body() call void @__quantum__qis__barrier__body() @@ -1100,7 +1097,7 @@ fn qasm2_barrier_generates_qir() -> miette::Result<(), Vec> { call void @__quantum__qis__m__body(%Qubit* inttoptr (i64 0 to %Qubit*), %Result* inttoptr (i64 0 to %Result*)) call void @__quantum__rt__array_record_output(i64 1, i8* null) call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 0 to %Result*), i8* null) - ret void + ret i64 0 } declare void @__quantum__qis__barrier__body() @@ -1123,8 +1120,7 @@ fn qasm2_barrier_generates_qir() -> miette::Result<(), Vec> { !2 = !{i32 1, !"dynamic_qubit_management", i1 false} !3 = !{i32 1, !"dynamic_result_management", i1 false} !4 = !{i32 1, !"int_computations", !"i64"} - "# - ]] + "#]] .assert_eq(&qsharp); Ok(()) } @@ -1351,13 +1347,13 @@ fn qasm2_simulatable_intrinsic_on_gate_stmt_generates_correct_qir() %Result = type opaque %Qubit = type opaque - define void @ENTRYPOINT__main() #0 { + define i64 @ENTRYPOINT__main() #0 { block_0: call void @my_gate(%Qubit* inttoptr (i64 0 to %Qubit*)) call void @__quantum__qis__m__body(%Qubit* inttoptr (i64 0 to %Qubit*), %Result* inttoptr (i64 0 to %Result*)) call void @__quantum__rt__array_record_output(i64 1, i8* null) call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 0 to %Result*), i8* null) - ret void + ret i64 0 } declare void @my_gate(%Qubit*) diff --git a/source/compiler/qsc_qasm/src/tests/statement/reset.rs b/source/compiler/qsc_qasm/src/tests/statement/reset.rs index 1f91838e10..599e45a97f 100644 --- a/source/compiler/qsc_qasm/src/tests/statement/reset.rs +++ b/source/compiler/qsc_qasm/src/tests/statement/reset.rs @@ -67,18 +67,17 @@ fn reset_with_base_profile_is_rewritten_without_resets() -> miette::Result<(), V "#; let qir = compile_qasm_to_qir(source, Profile::Base)?; - expect![[ - r#" + expect![[r#" %Result = type opaque %Qubit = type opaque - define void @ENTRYPOINT__main() #0 { + define i64 @ENTRYPOINT__main() #0 { block_0: call void @__quantum__qis__h__body(%Qubit* inttoptr (i64 1 to %Qubit*)) call void @__quantum__qis__m__body(%Qubit* inttoptr (i64 1 to %Qubit*), %Result* inttoptr (i64 0 to %Result*)) call void @__quantum__rt__array_record_output(i64 1, i8* null) call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 0 to %Result*), i8* null) - ret void + ret i64 0 } declare void @__quantum__qis__h__body(%Qubit*) @@ -100,8 +99,7 @@ fn reset_with_base_profile_is_rewritten_without_resets() -> miette::Result<(), V !1 = !{i32 7, !"qir_minor_version", i32 0} !2 = !{i32 1, !"dynamic_qubit_management", i1 false} !3 = !{i32 1, !"dynamic_result_management", i1 false} -"# - ]] + "#]] .assert_eq(&qir); Ok(()) @@ -120,19 +118,18 @@ fn reset_with_adaptive_ri_profile_generates_reset_qir() -> miette::Result<(), Ve "#; let qir = compile_qasm_to_qir(source, Profile::AdaptiveRI)?; - expect![ - r#" + expect![[r#" %Result = type opaque %Qubit = type opaque - define void @ENTRYPOINT__main() #0 { + define i64 @ENTRYPOINT__main() #0 { block_0: call void @__quantum__qis__reset__body(%Qubit* inttoptr (i64 0 to %Qubit*)) call void @__quantum__qis__h__body(%Qubit* inttoptr (i64 0 to %Qubit*)) call void @__quantum__qis__m__body(%Qubit* inttoptr (i64 0 to %Qubit*), %Result* inttoptr (i64 0 to %Result*)) call void @__quantum__rt__array_record_output(i64 1, i8* null) call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 0 to %Result*), i8* null) - ret void + ret i64 0 } declare void @__quantum__qis__reset__body(%Qubit*) #1 @@ -157,8 +154,7 @@ fn reset_with_adaptive_ri_profile_generates_reset_qir() -> miette::Result<(), Ve !2 = !{i32 1, !"dynamic_qubit_management", i1 false} !3 = !{i32 1, !"dynamic_result_management", i1 false} !4 = !{i32 1, !"int_computations", !"i64"} -"# - ] + "#]] .assert_eq(&qir); Ok(()) diff --git a/source/compiler/qsc_rir/src/builder.rs b/source/compiler/qsc_rir/src/builder.rs index d2ee3a74bf..3e4bbc29e5 100644 --- a/source/compiler/qsc_rir/src/builder.rs +++ b/source/compiler/qsc_rir/src/builder.rs @@ -183,7 +183,7 @@ pub fn new_program() -> Program { Callable { name: "main".to_string(), input_type: Vec::new(), - output_type: None, + output_type: Some(Ty::Integer), body: Some(BlockId(0)), call_type: CallableType::Regular, }, @@ -206,7 +206,7 @@ pub fn bell_program() -> Program { Callable { name: "main".to_string(), input_type: vec![], - output_type: None, + output_type: Some(Ty::Integer), body: Some(BlockId(0)), call_type: CallableType::Regular, }, @@ -295,7 +295,7 @@ pub fn teleport_program() -> Program { Callable { name: "main".to_string(), input_type: vec![], - output_type: None, + output_type: Some(Ty::Integer), body: Some(BlockId(0)), call_type: CallableType::Regular, }, diff --git a/source/compiler/qsc_rir/src/passes/ssa_transform/tests.rs b/source/compiler/qsc_rir/src/passes/ssa_transform/tests.rs index a1bd6e88bb..ac5447c632 100644 --- a/source/compiler/qsc_rir/src/passes/ssa_transform/tests.rs +++ b/source/compiler/qsc_rir/src/passes/ssa_transform/tests.rs @@ -97,7 +97,7 @@ fn ssa_transform_removes_store_in_single_block_program() { name: main call_type: Regular input_type: - output_type: + output_type: Integer body: 0 Callable 1: Callable: name: dynamic_bool @@ -127,7 +127,7 @@ fn ssa_transform_removes_store_in_single_block_program() { name: main call_type: Regular input_type: - output_type: + output_type: Integer body: 0 Callable 1: Callable: name: dynamic_bool @@ -245,7 +245,7 @@ fn ssa_transform_removes_multiple_stores_in_single_block_program() { name: main call_type: Regular input_type: - output_type: + output_type: Integer body: 0 Callable 1: Callable: name: dynamic_bool @@ -279,7 +279,7 @@ fn ssa_transform_removes_multiple_stores_in_single_block_program() { name: main call_type: Regular input_type: - output_type: + output_type: Integer body: 0 Callable 1: Callable: name: dynamic_bool @@ -404,7 +404,7 @@ fn ssa_transform_store_dominating_usage_propagates_to_successor_blocks() { name: main call_type: Regular input_type: - output_type: + output_type: Integer body: 0 Callable 1: Callable: name: dynamic_bool @@ -442,7 +442,7 @@ fn ssa_transform_store_dominating_usage_propagates_to_successor_blocks() { name: main call_type: Regular input_type: - output_type: + output_type: Integer body: 0 Callable 1: Callable: name: dynamic_bool @@ -548,7 +548,7 @@ fn ssa_transform_store_dominating_usage_propagates_to_successor_blocks_without_i name: main call_type: Regular input_type: - output_type: + output_type: Integer body: 0 Callable 1: Callable: name: dynamic_bool @@ -584,7 +584,7 @@ fn ssa_transform_store_dominating_usage_propagates_to_successor_blocks_without_i name: main call_type: Regular input_type: - output_type: + output_type: Integer body: 0 Callable 1: Callable: name: dynamic_bool @@ -733,7 +733,7 @@ fn ssa_transform_inserts_phi_for_store_not_dominating_usage() { name: main call_type: Regular input_type: - output_type: + output_type: Integer body: 0 Callable 1: Callable: name: dynamic_bool @@ -773,7 +773,7 @@ fn ssa_transform_inserts_phi_for_store_not_dominating_usage() { name: main call_type: Regular input_type: - output_type: + output_type: Integer body: 0 Callable 1: Callable: name: dynamic_bool @@ -901,7 +901,7 @@ fn ssa_transform_inserts_phi_for_store_not_dominating_usage_in_one_branch() { name: main call_type: Regular input_type: - output_type: + output_type: Integer body: 0 Callable 1: Callable: name: dynamic_bool @@ -939,7 +939,7 @@ fn ssa_transform_inserts_phi_for_store_not_dominating_usage_in_one_branch() { name: main call_type: Regular input_type: - output_type: + output_type: Integer body: 0 Callable 1: Callable: name: dynamic_bool @@ -1138,7 +1138,7 @@ fn ssa_transform_inserts_phi_for_node_with_many_predecessors() { name: main call_type: Regular input_type: - output_type: + output_type: Integer body: 0 Callable 1: Callable: name: dynamic_bool @@ -1188,7 +1188,7 @@ fn ssa_transform_inserts_phi_for_node_with_many_predecessors() { name: main call_type: Regular input_type: - output_type: + output_type: Integer body: 0 Callable 1: Callable: name: dynamic_bool @@ -1368,7 +1368,7 @@ fn ssa_transform_inserts_phi_for_multiple_stored_values() { name: main call_type: Regular input_type: - output_type: + output_type: Integer body: 0 Callable 1: Callable: name: dynamic_bool @@ -1410,7 +1410,7 @@ fn ssa_transform_inserts_phi_for_multiple_stored_values() { name: main call_type: Regular input_type: - output_type: + output_type: Integer body: 0 Callable 1: Callable: name: dynamic_bool @@ -1674,7 +1674,7 @@ fn ssa_transform_inserts_phi_nodes_in_successive_blocks_for_chained_branches() { name: main call_type: Regular input_type: - output_type: + output_type: Integer body: 0 Callable 1: Callable: name: dynamic_bool @@ -1730,7 +1730,7 @@ fn ssa_transform_inserts_phi_nodes_in_successive_blocks_for_chained_branches() { name: main call_type: Regular input_type: - output_type: + output_type: Integer body: 0 Callable 1: Callable: name: dynamic_bool @@ -1967,7 +1967,7 @@ fn ssa_transform_inerts_phi_nodes_for_early_return_graph_pattern() { name: main call_type: Regular input_type: - output_type: + output_type: Integer body: 0 Callable 1: Callable: name: dynamic_bool @@ -2018,7 +2018,7 @@ fn ssa_transform_inerts_phi_nodes_for_early_return_graph_pattern() { name: main call_type: Regular input_type: - output_type: + output_type: Integer body: 0 Callable 1: Callable: name: dynamic_bool @@ -2156,7 +2156,7 @@ fn ssa_transform_propagates_updates_from_multiple_predecessors_to_later_single_s name: main call_type: Regular input_type: - output_type: + output_type: Integer body: 0 Callable 1: Callable: name: dynamic_bool @@ -2195,7 +2195,7 @@ fn ssa_transform_propagates_updates_from_multiple_predecessors_to_later_single_s name: main call_type: Regular input_type: - output_type: + output_type: Integer body: 0 Callable 1: Callable: name: dynamic_bool @@ -2290,7 +2290,7 @@ fn ssa_transform_maps_store_instrs_that_use_values_from_other_store_instrs() { name: main call_type: Regular input_type: - output_type: + output_type: Integer body: 0 Callable 1: Callable: name: dynamic_bool @@ -2321,7 +2321,7 @@ fn ssa_transform_maps_store_instrs_that_use_values_from_other_store_instrs() { name: main call_type: Regular input_type: - output_type: + output_type: Integer body: 0 Callable 1: Callable: name: dynamic_bool @@ -2434,7 +2434,7 @@ fn ssa_transform_maps_store_with_variable_from_store_in_conditional_to_phi_node( name: main call_type: Regular input_type: - output_type: + output_type: Integer body: 0 Callable 1: Callable: name: dynamic_bool @@ -2470,7 +2470,7 @@ fn ssa_transform_maps_store_with_variable_from_store_in_conditional_to_phi_node( name: main call_type: Regular input_type: - output_type: + output_type: Integer body: 0 Callable 1: Callable: name: dynamic_bool @@ -2592,7 +2592,7 @@ fn ssa_transform_allows_point_in_time_copy_of_dynamic_variable() { name: main call_type: Regular input_type: - output_type: + output_type: Integer body: 0 Callable 1: Callable: name: dynamic_bool @@ -2626,7 +2626,7 @@ fn ssa_transform_allows_point_in_time_copy_of_dynamic_variable() { name: main call_type: Regular input_type: - output_type: + output_type: Integer body: 0 Callable 1: Callable: name: dynamic_bool @@ -2776,7 +2776,7 @@ fn ssa_transform_propagates_phi_var_to_successor_blocks_across_sequential_branch name: main call_type: Regular input_type: - output_type: + output_type: Integer body: 0 Callable 1: Callable: name: dynamic_bool @@ -2826,7 +2826,7 @@ fn ssa_transform_propagates_phi_var_to_successor_blocks_across_sequential_branch name: main call_type: Regular input_type: - output_type: + output_type: Integer body: 0 Callable 1: Callable: name: dynamic_bool diff --git a/source/pip/tests-integration/interop_qiskit/resources/custom_intrinsics.ll b/source/pip/tests-integration/interop_qiskit/resources/custom_intrinsics.ll index ec42527787..2e053c7a9d 100644 --- a/source/pip/tests-integration/interop_qiskit/resources/custom_intrinsics.ll +++ b/source/pip/tests-integration/interop_qiskit/resources/custom_intrinsics.ll @@ -1,13 +1,13 @@ %Result = type opaque %Qubit = type opaque -define void @ENTRYPOINT__main() #0 { +define i64 @ENTRYPOINT__main() #0 { block_0: call void @my_gate(%Qubit* inttoptr (i64 0 to %Qubit*)) call void @__quantum__qis__m__body(%Qubit* inttoptr (i64 0 to %Qubit*), %Result* inttoptr (i64 0 to %Result*)) call void @__quantum__rt__array_record_output(i64 1, i8* null) call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 0 to %Result*), i8* null) - ret void + ret i64 0 } declare void @my_gate(%Qubit*) diff --git a/source/pip/tests-integration/resources/adaptive_ri/output/ArithmeticOps.ll b/source/pip/tests-integration/resources/adaptive_ri/output/ArithmeticOps.ll index 48cb6e99ca..f62309382e 100644 --- a/source/pip/tests-integration/resources/adaptive_ri/output/ArithmeticOps.ll +++ b/source/pip/tests-integration/resources/adaptive_ri/output/ArithmeticOps.ll @@ -1,7 +1,7 @@ %Result = type opaque %Qubit = type opaque -define void @ENTRYPOINT__main() #0 { +define i64 @ENTRYPOINT__main() #0 { block_0: call void @__quantum__qis__x__body(%Qubit* inttoptr (i64 0 to %Qubit*)) call void @__quantum__qis__x__body(%Qubit* inttoptr (i64 1 to %Qubit*)) @@ -84,7 +84,7 @@ block_10: call void @__quantum__rt__int_record_output(i64 %var_53, i8* null) call void @__quantum__rt__int_record_output(i64 %var_54, i8* null) call void @__quantum__rt__int_record_output(i64 %var_55, i8* null) - ret void + ret i64 0 } declare void @__quantum__qis__x__body(%Qubit*) diff --git a/source/pip/tests-integration/resources/adaptive_ri/output/BernsteinVaziraniNISQ.ll b/source/pip/tests-integration/resources/adaptive_ri/output/BernsteinVaziraniNISQ.ll index 69cf1cc955..d71810cc45 100644 --- a/source/pip/tests-integration/resources/adaptive_ri/output/BernsteinVaziraniNISQ.ll +++ b/source/pip/tests-integration/resources/adaptive_ri/output/BernsteinVaziraniNISQ.ll @@ -1,7 +1,7 @@ %Result = type opaque %Qubit = type opaque -define void @ENTRYPOINT__main() #0 { +define i64 @ENTRYPOINT__main() #0 { block_0: call void @__quantum__qis__x__body(%Qubit* inttoptr (i64 5 to %Qubit*)) call void @__quantum__qis__h__body(%Qubit* inttoptr (i64 0 to %Qubit*)) @@ -30,7 +30,7 @@ block_0: call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 2 to %Result*), i8* null) call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 3 to %Result*), i8* null) call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 4 to %Result*), i8* null) - ret void + ret i64 0 } declare void @__quantum__qis__x__body(%Qubit*) diff --git a/source/pip/tests-integration/resources/adaptive_ri/output/ConstantFolding.ll b/source/pip/tests-integration/resources/adaptive_ri/output/ConstantFolding.ll index 27f3219d4c..7bfb6ea3a5 100644 --- a/source/pip/tests-integration/resources/adaptive_ri/output/ConstantFolding.ll +++ b/source/pip/tests-integration/resources/adaptive_ri/output/ConstantFolding.ll @@ -1,7 +1,7 @@ %Result = type opaque %Qubit = type opaque -define void @ENTRYPOINT__main() #0 { +define i64 @ENTRYPOINT__main() #0 { block_0: call void @__quantum__qis__x__body(%Qubit* inttoptr (i64 0 to %Qubit*)) call void @__quantum__qis__cx__body(%Qubit* inttoptr (i64 0 to %Qubit*), %Qubit* inttoptr (i64 1 to %Qubit*)) @@ -36,7 +36,7 @@ block_0: call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 1 to %Result*), i8* null) call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 2 to %Result*), i8* null) call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 3 to %Result*), i8* null) - ret void + ret i64 0 } declare void @__quantum__qis__x__body(%Qubit*) diff --git a/source/pip/tests-integration/resources/adaptive_ri/output/CopyAndUpdateExpressions.ll b/source/pip/tests-integration/resources/adaptive_ri/output/CopyAndUpdateExpressions.ll index d41ab82173..0464b7b091 100644 --- a/source/pip/tests-integration/resources/adaptive_ri/output/CopyAndUpdateExpressions.ll +++ b/source/pip/tests-integration/resources/adaptive_ri/output/CopyAndUpdateExpressions.ll @@ -1,7 +1,7 @@ %Result = type opaque %Qubit = type opaque -define void @ENTRYPOINT__main() #0 { +define i64 @ENTRYPOINT__main() #0 { block_0: call void @__quantum__qis__x__body(%Qubit* inttoptr (i64 0 to %Qubit*)) call void @__quantum__qis__mresetz__body(%Qubit* inttoptr (i64 0 to %Qubit*), %Result* inttoptr (i64 0 to %Result*)) @@ -23,7 +23,7 @@ block_0: call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 2 to %Result*), i8* null) call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 5 to %Result*), i8* null) call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 6 to %Result*), i8* null) - ret void + ret i64 0 } declare void @__quantum__qis__x__body(%Qubit*) diff --git a/source/pip/tests-integration/resources/adaptive_ri/output/DeutschJozsaNISQ.ll b/source/pip/tests-integration/resources/adaptive_ri/output/DeutschJozsaNISQ.ll index 4f038c599c..feac9a3c02 100644 --- a/source/pip/tests-integration/resources/adaptive_ri/output/DeutschJozsaNISQ.ll +++ b/source/pip/tests-integration/resources/adaptive_ri/output/DeutschJozsaNISQ.ll @@ -1,7 +1,7 @@ %Result = type opaque %Qubit = type opaque -define void @ENTRYPOINT__main() #0 { +define i64 @ENTRYPOINT__main() #0 { block_0: call void @__quantum__qis__x__body(%Qubit* inttoptr (i64 4 to %Qubit*)) call void @__quantum__qis__h__body(%Qubit* inttoptr (i64 4 to %Qubit*)) @@ -54,7 +54,7 @@ block_0: call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 5 to %Result*), i8* null) call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 6 to %Result*), i8* null) call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 7 to %Result*), i8* null) - ret void + ret i64 0 } declare void @__quantum__qis__x__body(%Qubit*) diff --git a/source/pip/tests-integration/resources/adaptive_ri/output/ExpandedTests.ll b/source/pip/tests-integration/resources/adaptive_ri/output/ExpandedTests.ll index 4794a9960c..9650dad586 100644 --- a/source/pip/tests-integration/resources/adaptive_ri/output/ExpandedTests.ll +++ b/source/pip/tests-integration/resources/adaptive_ri/output/ExpandedTests.ll @@ -1,7 +1,7 @@ %Result = type opaque %Qubit = type opaque -define void @ENTRYPOINT__main() #0 { +define i64 @ENTRYPOINT__main() #0 { block_0: call void @__quantum__qis__h__body(%Qubit* inttoptr (i64 0 to %Qubit*)) call void @__quantum__qis__h__body(%Qubit* inttoptr (i64 1 to %Qubit*)) @@ -41,7 +41,7 @@ block_0: call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 0 to %Result*), i8* null) call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 1 to %Result*), i8* null) call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 2 to %Result*), i8* null) - ret void + ret i64 0 } declare void @__quantum__qis__h__body(%Qubit*) diff --git a/source/pip/tests-integration/resources/adaptive_ri/output/Functors.ll b/source/pip/tests-integration/resources/adaptive_ri/output/Functors.ll index 7901410523..3c6dfdb0ec 100644 --- a/source/pip/tests-integration/resources/adaptive_ri/output/Functors.ll +++ b/source/pip/tests-integration/resources/adaptive_ri/output/Functors.ll @@ -1,7 +1,7 @@ %Result = type opaque %Qubit = type opaque -define void @ENTRYPOINT__main() #0 { +define i64 @ENTRYPOINT__main() #0 { block_0: call void @__quantum__qis__x__body(%Qubit* inttoptr (i64 0 to %Qubit*)) call void @__quantum__qis__h__body(%Qubit* inttoptr (i64 1 to %Qubit*)) @@ -74,7 +74,7 @@ block_0: call void @__quantum__rt__array_record_output(i64 2, i8* null) call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 4 to %Result*), i8* null) call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 5 to %Result*), i8* null) - ret void + ret i64 0 } declare void @__quantum__qis__x__body(%Qubit*) diff --git a/source/pip/tests-integration/resources/adaptive_ri/output/HiddenShiftNISQ.ll b/source/pip/tests-integration/resources/adaptive_ri/output/HiddenShiftNISQ.ll index 8bc3b5d4d0..94467ea01c 100644 --- a/source/pip/tests-integration/resources/adaptive_ri/output/HiddenShiftNISQ.ll +++ b/source/pip/tests-integration/resources/adaptive_ri/output/HiddenShiftNISQ.ll @@ -1,7 +1,7 @@ %Result = type opaque %Qubit = type opaque -define void @ENTRYPOINT__main() #0 { +define i64 @ENTRYPOINT__main() #0 { block_0: call void @__quantum__qis__h__body(%Qubit* inttoptr (i64 0 to %Qubit*)) call void @__quantum__qis__h__body(%Qubit* inttoptr (i64 1 to %Qubit*)) @@ -44,7 +44,7 @@ block_0: call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 3 to %Result*), i8* null) call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 4 to %Result*), i8* null) call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 5 to %Result*), i8* null) - ret void + ret i64 0 } declare void @__quantum__qis__h__body(%Qubit*) diff --git a/source/pip/tests-integration/resources/adaptive_ri/output/IntegerComparison.ll b/source/pip/tests-integration/resources/adaptive_ri/output/IntegerComparison.ll index 95e95a7e64..9fb4a74070 100644 --- a/source/pip/tests-integration/resources/adaptive_ri/output/IntegerComparison.ll +++ b/source/pip/tests-integration/resources/adaptive_ri/output/IntegerComparison.ll @@ -1,7 +1,7 @@ %Result = type opaque %Qubit = type opaque -define void @ENTRYPOINT__main() #0 { +define i64 @ENTRYPOINT__main() #0 { block_0: call void @__quantum__qis__x__body(%Qubit* inttoptr (i64 0 to %Qubit*)) call void @__quantum__qis__m__body(%Qubit* inttoptr (i64 0 to %Qubit*), %Result* inttoptr (i64 0 to %Result*)) @@ -110,7 +110,7 @@ block_20: call void @__quantum__rt__bool_record_output(i1 %var_31, i8* null) call void @__quantum__rt__bool_record_output(i1 %var_32, i8* null) call void @__quantum__rt__bool_record_output(i1 %var_33, i8* null) - ret void + ret i64 0 } declare void @__quantum__qis__x__body(%Qubit*) diff --git a/source/pip/tests-integration/resources/adaptive_ri/output/IntrinsicCCNOT.ll b/source/pip/tests-integration/resources/adaptive_ri/output/IntrinsicCCNOT.ll index bb5df300ae..4e469f399e 100644 --- a/source/pip/tests-integration/resources/adaptive_ri/output/IntrinsicCCNOT.ll +++ b/source/pip/tests-integration/resources/adaptive_ri/output/IntrinsicCCNOT.ll @@ -1,7 +1,7 @@ %Result = type opaque %Qubit = type opaque -define void @ENTRYPOINT__main() #0 { +define i64 @ENTRYPOINT__main() #0 { block_0: call void @__quantum__qis__ccx__body(%Qubit* inttoptr (i64 0 to %Qubit*), %Qubit* inttoptr (i64 1 to %Qubit*), %Qubit* inttoptr (i64 2 to %Qubit*)) call void @__quantum__qis__m__body(%Qubit* inttoptr (i64 0 to %Qubit*), %Result* inttoptr (i64 0 to %Result*)) @@ -40,7 +40,7 @@ block_0: call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 6 to %Result*), i8* null) call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 7 to %Result*), i8* null) call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 8 to %Result*), i8* null) - ret void + ret i64 0 } declare void @__quantum__qis__ccx__body(%Qubit*, %Qubit*, %Qubit*) diff --git a/source/pip/tests-integration/resources/adaptive_ri/output/IntrinsicCNOT.ll b/source/pip/tests-integration/resources/adaptive_ri/output/IntrinsicCNOT.ll index cd0a097c28..094db28dae 100644 --- a/source/pip/tests-integration/resources/adaptive_ri/output/IntrinsicCNOT.ll +++ b/source/pip/tests-integration/resources/adaptive_ri/output/IntrinsicCNOT.ll @@ -1,7 +1,7 @@ %Result = type opaque %Qubit = type opaque -define void @ENTRYPOINT__main() #0 { +define i64 @ENTRYPOINT__main() #0 { block_0: call void @__quantum__qis__cx__body(%Qubit* inttoptr (i64 0 to %Qubit*), %Qubit* inttoptr (i64 1 to %Qubit*)) call void @__quantum__qis__m__body(%Qubit* inttoptr (i64 0 to %Qubit*), %Result* inttoptr (i64 0 to %Result*)) @@ -21,7 +21,7 @@ block_0: call void @__quantum__rt__array_record_output(i64 2, i8* null) call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 2 to %Result*), i8* null) call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 3 to %Result*), i8* null) - ret void + ret i64 0 } declare void @__quantum__qis__cx__body(%Qubit*, %Qubit*) diff --git a/source/pip/tests-integration/resources/adaptive_ri/output/IntrinsicHIXYZ.ll b/source/pip/tests-integration/resources/adaptive_ri/output/IntrinsicHIXYZ.ll index 7572e852f8..0b383161e3 100644 --- a/source/pip/tests-integration/resources/adaptive_ri/output/IntrinsicHIXYZ.ll +++ b/source/pip/tests-integration/resources/adaptive_ri/output/IntrinsicHIXYZ.ll @@ -1,7 +1,7 @@ %Result = type opaque %Qubit = type opaque -define void @ENTRYPOINT__main() #0 { +define i64 @ENTRYPOINT__main() #0 { block_0: call void @__quantum__qis__h__body(%Qubit* inttoptr (i64 0 to %Qubit*)) call void @__quantum__qis__z__body(%Qubit* inttoptr (i64 0 to %Qubit*)) @@ -28,7 +28,7 @@ block_0: call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 3 to %Result*), i8* null) call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 4 to %Result*), i8* null) call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 5 to %Result*), i8* null) - ret void + ret i64 0 } declare void @__quantum__qis__h__body(%Qubit*) diff --git a/source/pip/tests-integration/resources/adaptive_ri/output/IntrinsicM.ll b/source/pip/tests-integration/resources/adaptive_ri/output/IntrinsicM.ll index 26915f37e2..de6d16a8fb 100644 --- a/source/pip/tests-integration/resources/adaptive_ri/output/IntrinsicM.ll +++ b/source/pip/tests-integration/resources/adaptive_ri/output/IntrinsicM.ll @@ -1,7 +1,7 @@ %Result = type opaque %Qubit = type opaque -define void @ENTRYPOINT__main() #0 { +define i64 @ENTRYPOINT__main() #0 { block_0: call void @__quantum__qis__m__body(%Qubit* inttoptr (i64 0 to %Qubit*), %Result* inttoptr (i64 0 to %Result*)) call void @__quantum__qis__x__body(%Qubit* inttoptr (i64 1 to %Qubit*)) @@ -11,7 +11,7 @@ block_0: call void @__quantum__rt__tuple_record_output(i64 2, i8* null) call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 0 to %Result*), i8* null) call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 1 to %Result*), i8* null) - ret void + ret i64 0 } declare void @__quantum__qis__m__body(%Qubit*, %Result*) #1 diff --git a/source/pip/tests-integration/resources/adaptive_ri/output/IntrinsicMeasureWithBitFlipCode.ll b/source/pip/tests-integration/resources/adaptive_ri/output/IntrinsicMeasureWithBitFlipCode.ll index f7b45de39a..27709c18ec 100644 --- a/source/pip/tests-integration/resources/adaptive_ri/output/IntrinsicMeasureWithBitFlipCode.ll +++ b/source/pip/tests-integration/resources/adaptive_ri/output/IntrinsicMeasureWithBitFlipCode.ll @@ -1,7 +1,7 @@ %Result = type opaque %Qubit = type opaque -define void @ENTRYPOINT__main() #0 { +define i64 @ENTRYPOINT__main() #0 { block_0: call void @__quantum__qis__cx__body(%Qubit* inttoptr (i64 0 to %Qubit*), %Qubit* inttoptr (i64 1 to %Qubit*)) call void @__quantum__qis__cx__body(%Qubit* inttoptr (i64 0 to %Qubit*), %Qubit* inttoptr (i64 2 to %Qubit*)) @@ -42,7 +42,7 @@ block_0: call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 4 to %Result*), i8* null) call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 5 to %Result*), i8* null) call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 6 to %Result*), i8* null) - ret void + ret i64 0 } declare void @__quantum__qis__cx__body(%Qubit*, %Qubit*) diff --git a/source/pip/tests-integration/resources/adaptive_ri/output/IntrinsicMeasureWithPhaseFlipCode.ll b/source/pip/tests-integration/resources/adaptive_ri/output/IntrinsicMeasureWithPhaseFlipCode.ll index f537083df5..1deae6faf5 100644 --- a/source/pip/tests-integration/resources/adaptive_ri/output/IntrinsicMeasureWithPhaseFlipCode.ll +++ b/source/pip/tests-integration/resources/adaptive_ri/output/IntrinsicMeasureWithPhaseFlipCode.ll @@ -1,7 +1,7 @@ %Result = type opaque %Qubit = type opaque -define void @ENTRYPOINT__main() #0 { +define i64 @ENTRYPOINT__main() #0 { block_0: call void @__quantum__qis__cx__body(%Qubit* inttoptr (i64 0 to %Qubit*), %Qubit* inttoptr (i64 1 to %Qubit*)) call void @__quantum__qis__cx__body(%Qubit* inttoptr (i64 0 to %Qubit*), %Qubit* inttoptr (i64 2 to %Qubit*)) @@ -48,7 +48,7 @@ block_0: call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 4 to %Result*), i8* null) call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 5 to %Result*), i8* null) call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 6 to %Result*), i8* null) - ret void + ret i64 0 } declare void @__quantum__qis__cx__body(%Qubit*, %Qubit*) diff --git a/source/pip/tests-integration/resources/adaptive_ri/output/IntrinsicRotationsWithPeriod.ll b/source/pip/tests-integration/resources/adaptive_ri/output/IntrinsicRotationsWithPeriod.ll index e8a9984785..654c1e7221 100644 --- a/source/pip/tests-integration/resources/adaptive_ri/output/IntrinsicRotationsWithPeriod.ll +++ b/source/pip/tests-integration/resources/adaptive_ri/output/IntrinsicRotationsWithPeriod.ll @@ -1,7 +1,7 @@ %Result = type opaque %Qubit = type opaque -define void @ENTRYPOINT__main() #0 { +define i64 @ENTRYPOINT__main() #0 { block_0: call void @__quantum__qis__x__body(%Qubit* inttoptr (i64 0 to %Qubit*)) call void @__quantum__qis__x__body(%Qubit* inttoptr (i64 1 to %Qubit*)) @@ -77,7 +77,7 @@ block_0: call void @__quantum__rt__array_record_output(i64 2, i8* null) call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 4 to %Result*), i8* null) call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 5 to %Result*), i8* null) - ret void + ret i64 0 } declare void @__quantum__qis__x__body(%Qubit*) diff --git a/source/pip/tests-integration/resources/adaptive_ri/output/IntrinsicSTSWAP.ll b/source/pip/tests-integration/resources/adaptive_ri/output/IntrinsicSTSWAP.ll index 6dc5de3e4b..27f1790394 100644 --- a/source/pip/tests-integration/resources/adaptive_ri/output/IntrinsicSTSWAP.ll +++ b/source/pip/tests-integration/resources/adaptive_ri/output/IntrinsicSTSWAP.ll @@ -1,7 +1,7 @@ %Result = type opaque %Qubit = type opaque -define void @ENTRYPOINT__main() #0 { +define i64 @ENTRYPOINT__main() #0 { block_0: call void @__quantum__qis__h__body(%Qubit* inttoptr (i64 0 to %Qubit*)) call void @__quantum__qis__s__body(%Qubit* inttoptr (i64 0 to %Qubit*)) @@ -25,7 +25,7 @@ block_0: call void @__quantum__rt__array_record_output(i64 2, i8* null) call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 2 to %Result*), i8* null) call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 3 to %Result*), i8* null) - ret void + ret i64 0 } declare void @__quantum__qis__h__body(%Qubit*) diff --git a/source/pip/tests-integration/resources/adaptive_ri/output/MeasureAndReuse.ll b/source/pip/tests-integration/resources/adaptive_ri/output/MeasureAndReuse.ll index b13143b88d..54b1359c6f 100644 --- a/source/pip/tests-integration/resources/adaptive_ri/output/MeasureAndReuse.ll +++ b/source/pip/tests-integration/resources/adaptive_ri/output/MeasureAndReuse.ll @@ -1,7 +1,7 @@ %Result = type opaque %Qubit = type opaque -define void @ENTRYPOINT__main() #0 { +define i64 @ENTRYPOINT__main() #0 { block_0: call void @__quantum__qis__m__body(%Qubit* inttoptr (i64 0 to %Qubit*), %Result* inttoptr (i64 0 to %Result*)) call void @__quantum__qis__x__body(%Qubit* inttoptr (i64 0 to %Qubit*)) @@ -22,7 +22,7 @@ block_0: call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 2 to %Result*), i8* null) call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 3 to %Result*), i8* null) call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 4 to %Result*), i8* null) - ret void + ret i64 0 } declare void @__quantum__qis__m__body(%Qubit*, %Result*) #1 diff --git a/source/pip/tests-integration/resources/adaptive_ri/output/MeasurementComparison.ll b/source/pip/tests-integration/resources/adaptive_ri/output/MeasurementComparison.ll index a3fb0c09a6..c984d71986 100644 --- a/source/pip/tests-integration/resources/adaptive_ri/output/MeasurementComparison.ll +++ b/source/pip/tests-integration/resources/adaptive_ri/output/MeasurementComparison.ll @@ -1,7 +1,7 @@ %Result = type opaque %Qubit = type opaque -define void @ENTRYPOINT__main() #0 { +define i64 @ENTRYPOINT__main() #0 { block_0: call void @__quantum__qis__x__body(%Qubit* inttoptr (i64 0 to %Qubit*)) call void @__quantum__qis__cx__body(%Qubit* inttoptr (i64 0 to %Qubit*), %Qubit* inttoptr (i64 1 to %Qubit*)) @@ -29,7 +29,7 @@ block_3: call void @__quantum__rt__bool_record_output(i1 %var_3, i8* null) call void @__quantum__rt__bool_record_output(i1 %var_6, i8* null) call void @__quantum__rt__bool_record_output(i1 %var_10, i8* null) - ret void + ret i64 0 } declare void @__quantum__qis__x__body(%Qubit*) diff --git a/source/pip/tests-integration/resources/adaptive_ri/output/NestedBranching.ll b/source/pip/tests-integration/resources/adaptive_ri/output/NestedBranching.ll index 760f3c737e..d9418582dd 100644 --- a/source/pip/tests-integration/resources/adaptive_ri/output/NestedBranching.ll +++ b/source/pip/tests-integration/resources/adaptive_ri/output/NestedBranching.ll @@ -1,7 +1,7 @@ %Result = type opaque %Qubit = type opaque -define void @ENTRYPOINT__main() #0 { +define i64 @ENTRYPOINT__main() #0 { block_0: call void @__quantum__qis__x__body(%Qubit* inttoptr (i64 0 to %Qubit*)) call void @__quantum__qis__x__body(%Qubit* inttoptr (i64 1 to %Qubit*)) @@ -296,7 +296,7 @@ block_82: call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 5 to %Result*), i8* null) call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 6 to %Result*), i8* null) call void @__quantum__rt__bool_record_output(i1 %var_77, i8* null) - ret void + ret i64 0 } declare void @__quantum__qis__x__body(%Qubit*) diff --git a/source/pip/tests-integration/resources/adaptive_ri/output/RandomBit.ll b/source/pip/tests-integration/resources/adaptive_ri/output/RandomBit.ll index c232922cea..393ba107d0 100644 --- a/source/pip/tests-integration/resources/adaptive_ri/output/RandomBit.ll +++ b/source/pip/tests-integration/resources/adaptive_ri/output/RandomBit.ll @@ -1,13 +1,13 @@ %Result = type opaque %Qubit = type opaque -define void @ENTRYPOINT__main() #0 { +define i64 @ENTRYPOINT__main() #0 { block_0: call void @__quantum__qis__h__body(%Qubit* inttoptr (i64 0 to %Qubit*)) call void @__quantum__qis__m__body(%Qubit* inttoptr (i64 0 to %Qubit*), %Result* inttoptr (i64 0 to %Result*)) call void @__quantum__qis__reset__body(%Qubit* inttoptr (i64 0 to %Qubit*)) call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 0 to %Result*), i8* null) - ret void + ret i64 0 } declare void @__quantum__qis__h__body(%Qubit*) diff --git a/source/pip/tests-integration/resources/adaptive_ri/output/SampleTeleport.ll b/source/pip/tests-integration/resources/adaptive_ri/output/SampleTeleport.ll index 558b2e544a..eb6dd04a02 100644 --- a/source/pip/tests-integration/resources/adaptive_ri/output/SampleTeleport.ll +++ b/source/pip/tests-integration/resources/adaptive_ri/output/SampleTeleport.ll @@ -1,7 +1,7 @@ %Result = type opaque %Qubit = type opaque -define void @ENTRYPOINT__main() #0 { +define i64 @ENTRYPOINT__main() #0 { block_0: call void @__quantum__qis__h__body(%Qubit* inttoptr (i64 0 to %Qubit*)) call void @__quantum__qis__cx__body(%Qubit* inttoptr (i64 0 to %Qubit*), %Qubit* inttoptr (i64 1 to %Qubit*)) @@ -29,7 +29,7 @@ block_4: call void @__quantum__qis__reset__body(%Qubit* inttoptr (i64 0 to %Qubit*)) call void @__quantum__qis__reset__body(%Qubit* inttoptr (i64 1 to %Qubit*)) call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 2 to %Result*), i8* null) - ret void + ret i64 0 } declare void @__quantum__qis__h__body(%Qubit*) diff --git a/source/pip/tests-integration/resources/adaptive_ri/output/ShortcuttingMeasurement.ll b/source/pip/tests-integration/resources/adaptive_ri/output/ShortcuttingMeasurement.ll index 99917a8eca..6ed607e4ce 100644 --- a/source/pip/tests-integration/resources/adaptive_ri/output/ShortcuttingMeasurement.ll +++ b/source/pip/tests-integration/resources/adaptive_ri/output/ShortcuttingMeasurement.ll @@ -1,7 +1,7 @@ %Result = type opaque %Qubit = type opaque -define void @ENTRYPOINT__main() #0 { +define i64 @ENTRYPOINT__main() #0 { block_0: call void @__quantum__qis__x__body(%Qubit* inttoptr (i64 0 to %Qubit*)) call void @__quantum__qis__cx__body(%Qubit* inttoptr (i64 0 to %Qubit*), %Qubit* inttoptr (i64 1 to %Qubit*)) @@ -27,7 +27,7 @@ block_4: call void @__quantum__rt__tuple_record_output(i64 2, i8* null) call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 2 to %Result*), i8* null) call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 3 to %Result*), i8* null) - ret void + ret i64 0 } declare void @__quantum__qis__x__body(%Qubit*) diff --git a/source/pip/tests-integration/resources/adaptive_ri/output/Slicing.ll b/source/pip/tests-integration/resources/adaptive_ri/output/Slicing.ll index 41f496f2e0..6c060a0e3b 100644 --- a/source/pip/tests-integration/resources/adaptive_ri/output/Slicing.ll +++ b/source/pip/tests-integration/resources/adaptive_ri/output/Slicing.ll @@ -1,7 +1,7 @@ %Result = type opaque %Qubit = type opaque -define void @ENTRYPOINT__main() #0 { +define i64 @ENTRYPOINT__main() #0 { block_0: call void @__quantum__qis__x__body(%Qubit* inttoptr (i64 9 to %Qubit*)) call void @__quantum__qis__x__body(%Qubit* inttoptr (i64 8 to %Qubit*)) @@ -29,7 +29,7 @@ block_0: call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 2 to %Result*), i8* null) call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 3 to %Result*), i8* null) call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 4 to %Result*), i8* null) - ret void + ret i64 0 } declare void @__quantum__qis__x__body(%Qubit*) diff --git a/source/pip/tests-integration/resources/adaptive_ri/output/SuperdenseCoding.ll b/source/pip/tests-integration/resources/adaptive_ri/output/SuperdenseCoding.ll index a9a64cb613..54bd2dbd7e 100644 --- a/source/pip/tests-integration/resources/adaptive_ri/output/SuperdenseCoding.ll +++ b/source/pip/tests-integration/resources/adaptive_ri/output/SuperdenseCoding.ll @@ -1,7 +1,7 @@ %Result = type opaque %Qubit = type opaque -define void @ENTRYPOINT__main() #0 { +define i64 @ENTRYPOINT__main() #0 { block_0: call void @__quantum__qis__h__body(%Qubit* inttoptr (i64 0 to %Qubit*)) call void @__quantum__qis__cx__body(%Qubit* inttoptr (i64 0 to %Qubit*), %Qubit* inttoptr (i64 1 to %Qubit*)) @@ -42,7 +42,7 @@ block_4: call void @__quantum__rt__tuple_record_output(i64 2, i8* null) call void @__quantum__rt__bool_record_output(i1 %var_9, i8* null) call void @__quantum__rt__bool_record_output(i1 %var_13, i8* null) - ret void + ret i64 0 } declare void @__quantum__qis__h__body(%Qubit*) diff --git a/source/pip/tests-integration/resources/adaptive_ri/output/SwitchHandling.ll b/source/pip/tests-integration/resources/adaptive_ri/output/SwitchHandling.ll index acf58afd49..d03b910a44 100644 --- a/source/pip/tests-integration/resources/adaptive_ri/output/SwitchHandling.ll +++ b/source/pip/tests-integration/resources/adaptive_ri/output/SwitchHandling.ll @@ -1,7 +1,7 @@ %Result = type opaque %Qubit = type opaque -define void @ENTRYPOINT__main() #0 { +define i64 @ENTRYPOINT__main() #0 { block_0: call void @__quantum__qis__x__body(%Qubit* inttoptr (i64 0 to %Qubit*)) call void @__quantum__qis__x__body(%Qubit* inttoptr (i64 1 to %Qubit*)) @@ -49,7 +49,7 @@ block_12: block_13: call void @__quantum__qis__mresetz__body(%Qubit* inttoptr (i64 2 to %Qubit*), %Result* inttoptr (i64 2 to %Result*)) call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 2 to %Result*), i8* null) - ret void + ret i64 0 } declare void @__quantum__qis__x__body(%Qubit*) diff --git a/source/pip/tests-integration/resources/adaptive_ri/output/ThreeQubitRepetitionCode.ll b/source/pip/tests-integration/resources/adaptive_ri/output/ThreeQubitRepetitionCode.ll index 47fe19769d..ed1e0b3e82 100644 --- a/source/pip/tests-integration/resources/adaptive_ri/output/ThreeQubitRepetitionCode.ll +++ b/source/pip/tests-integration/resources/adaptive_ri/output/ThreeQubitRepetitionCode.ll @@ -1,7 +1,7 @@ %Result = type opaque %Qubit = type opaque -define void @ENTRYPOINT__main() #0 { +define i64 @ENTRYPOINT__main() #0 { block_0: call void @__quantum__qis__h__body(%Qubit* inttoptr (i64 0 to %Qubit*)) call void @__quantum__qis__z__body(%Qubit* inttoptr (i64 0 to %Qubit*)) @@ -266,7 +266,7 @@ block_55: call void @__quantum__rt__tuple_record_output(i64 2, i8* null) call void @__quantum__rt__bool_record_output(i1 %var_82, i8* null) call void @__quantum__rt__int_record_output(i64 %var_101, i8* null) - ret void + ret i64 0 } declare void @__quantum__qis__h__body(%Qubit*) diff --git a/source/pip/tests-integration/resources/adaptive_ri/output/WithinApply.ll b/source/pip/tests-integration/resources/adaptive_ri/output/WithinApply.ll index ff8de72dfe..745cb5d83d 100644 --- a/source/pip/tests-integration/resources/adaptive_ri/output/WithinApply.ll +++ b/source/pip/tests-integration/resources/adaptive_ri/output/WithinApply.ll @@ -1,7 +1,7 @@ %Result = type opaque %Qubit = type opaque -define void @ENTRYPOINT__main() #0 { +define i64 @ENTRYPOINT__main() #0 { block_0: call void @__quantum__qis__x__body(%Qubit* inttoptr (i64 1 to %Qubit*)) call void @__quantum__qis__x__body(%Qubit* inttoptr (i64 2 to %Qubit*)) @@ -18,7 +18,7 @@ block_0: call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 0 to %Result*), i8* null) call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 1 to %Result*), i8* null) call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 2 to %Result*), i8* null) - ret void + ret i64 0 } declare void @__quantum__qis__x__body(%Qubit*) diff --git a/source/pip/tests-integration/resources/adaptive_rif/output/Doubles.ll b/source/pip/tests-integration/resources/adaptive_rif/output/Doubles.ll index 7db8d6c0a4..15defd05a9 100644 --- a/source/pip/tests-integration/resources/adaptive_rif/output/Doubles.ll +++ b/source/pip/tests-integration/resources/adaptive_rif/output/Doubles.ll @@ -1,7 +1,7 @@ %Result = type opaque %Qubit = type opaque -define void @ENTRYPOINT__main() #0 { +define i64 @ENTRYPOINT__main() #0 { block_0: call void @__quantum__qis__x__body(%Qubit* inttoptr (i64 0 to %Qubit*)) call void @__quantum__qis__m__body(%Qubit* inttoptr (i64 0 to %Qubit*), %Result* inttoptr (i64 0 to %Result*)) @@ -151,7 +151,7 @@ block_20: call void @__quantum__rt__bool_record_output(i1 %var_69, i8* null) call void @__quantum__rt__bool_record_output(i1 %var_70, i8* null) call void @__quantum__rt__bool_record_output(i1 %var_71, i8* null) - ret void + ret i64 0 } declare void @__quantum__qis__x__body(%Qubit*) diff --git a/source/pip/tests/test_interpreter.py b/source/pip/tests/test_interpreter.py index 7c8b28ce77..be11b64ace 100644 --- a/source/pip/tests/test_interpreter.py +++ b/source/pip/tests/test_interpreter.py @@ -371,14 +371,14 @@ def test_adaptive_ri_qir_can_be_generated() -> None: %Result = type opaque %Qubit = type opaque - define void @ENTRYPOINT__main() #0 { + define i64 @ENTRYPOINT__main() #0 { block_0: call void @__quantum__qis__rz__body(double 2.0, %Qubit* inttoptr (i64 0 to %Qubit*)) call void @__quantum__qis__rz__body(double 0.0, %Qubit* inttoptr (i64 0 to %Qubit*)) call void @__quantum__qis__rz__body(double 1.0, %Qubit* inttoptr (i64 0 to %Qubit*)) call void @__quantum__qis__mresetz__body(%Qubit* inttoptr (i64 0 to %Qubit*), %Result* inttoptr (i64 0 to %Result*)) call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 0 to %Result*), i8* null) - ret void + ret i64 0 } declare void @__quantum__qis__rz__body(double, %Qubit*) @@ -429,14 +429,14 @@ def test_base_qir_can_be_generated() -> None: %Result = type opaque %Qubit = type opaque - define void @ENTRYPOINT__main() #0 { + define i64 @ENTRYPOINT__main() #0 { block_0: call void @__quantum__qis__rz__body(double 2.0, %Qubit* inttoptr (i64 0 to %Qubit*)) call void @__quantum__qis__rz__body(double 0.0, %Qubit* inttoptr (i64 0 to %Qubit*)) call void @__quantum__qis__rz__body(double 1.0, %Qubit* inttoptr (i64 0 to %Qubit*)) call void @__quantum__qis__m__body(%Qubit* inttoptr (i64 0 to %Qubit*), %Result* inttoptr (i64 0 to %Result*)) call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 0 to %Result*), i8* null) - ret void + ret i64 0 } declare void @__quantum__qis__rz__body(double, %Qubit*) diff --git a/source/pip/tests/test_qasm.py b/source/pip/tests/test_qasm.py index 7fff4eada8..99d8fef3f8 100644 --- a/source/pip/tests/test_qasm.py +++ b/source/pip/tests/test_qasm.py @@ -289,7 +289,7 @@ def test_compile_qir_input_data() -> None: def test_compile_qir_str() -> None: qir = str(compile("qubit q; output bit c; c = measure q;")) - assert "define void @ENTRYPOINT__main()" in qir + assert "define i64 @ENTRYPOINT__main()" in qir assert '"required_num_qubits"="1" "required_num_results"="1"' in qir @@ -321,7 +321,7 @@ def test_compile_qir_str_from_python_callable() -> None: import_openqasm("qubit q; output bit c; c = measure q;", name="Program") operation = compile(code.Program) qir = str(operation) - assert "define void @ENTRYPOINT__main()" in qir + assert "define i64 @ENTRYPOINT__main()" in qir assert '"required_num_qubits"="1" "required_num_results"="1"' in qir @@ -340,7 +340,7 @@ def test_compile_qir_str_from_python_callable_with_single_arg() -> None: operation = compile(code.program, pi) qir = str(operation) - assert "define void @ENTRYPOINT__main()" in qir + assert "define i64 @ENTRYPOINT__main()" in qir assert ( "call void @__quantum__qis__rx__body(double 3.141592653589793, %Qubit* inttoptr (i64 0 to %Qubit*))" in qir @@ -368,7 +368,7 @@ def test_compile_qir_str_from_python_callable_with_multiple_args() -> None: ) operation = compile(code.Program, 2 * pi, 2.0) qir = str(operation) - assert "define void @ENTRYPOINT__main()" in qir + assert "define i64 @ENTRYPOINT__main()" in qir assert ( "call void @__quantum__qis__rx__body(double 3.141592653589793, %Qubit* inttoptr (i64 0 to %Qubit*))" in qir @@ -399,7 +399,7 @@ def test_compile_qir_str_from_python_callable_with_multiple_args_passed_as_tuple args = (2 * pi, 2.0) operation = compile(code.Program, args) qir = str(operation) - assert "define void @ENTRYPOINT__main()" in qir + assert "define i64 @ENTRYPOINT__main()" in qir assert ( "call void @__quantum__qis__rx__body(double 3.141592653589793, %Qubit* inttoptr (i64 0 to %Qubit*))" in qir diff --git a/source/pip/tests/test_qsharp.py b/source/pip/tests/test_qsharp.py index 396794fd13..c3e54f9727 100644 --- a/source/pip/tests/test_qsharp.py +++ b/source/pip/tests/test_qsharp.py @@ -330,7 +330,7 @@ def test_compile_qir_str() -> None: qsharp.eval("operation Program() : Result { use q = Qubit(); return MResetZ(q); }") operation = qsharp.compile("Program()") qir = str(operation) - assert "define void @ENTRYPOINT__main()" in qir + assert "define i64 @ENTRYPOINT__main()" in qir assert '"required_num_qubits"="1" "required_num_results"="1"' in qir @@ -339,7 +339,7 @@ def test_compile_qir_str_from_python_callable() -> None: qsharp.eval("operation Program() : Result { use q = Qubit(); return MResetZ(q); }") operation = qsharp.compile(qsharp.code.Program) qir = str(operation) - assert "define void @ENTRYPOINT__main()" in qir + assert "define i64 @ENTRYPOINT__main()" in qir assert '"required_num_qubits"="1" "required_num_results"="1"' in qir @@ -350,7 +350,7 @@ def test_compile_qir_str_from_python_callable_with_single_arg() -> None: ) operation = qsharp.compile(qsharp.code.Program, 5) qir = str(operation) - assert "define void @ENTRYPOINT__main()" in qir + assert "define i64 @ENTRYPOINT__main()" in qir assert ( "call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 4 to %Result*), i8* null)" in qir @@ -365,7 +365,7 @@ def test_compile_qir_str_from_python_callable_with_array_arg() -> None: ) operation = qsharp.compile(qsharp.code.Program, [5, 3]) qir = str(operation) - assert "define void @ENTRYPOINT__main()" in qir + assert "define i64 @ENTRYPOINT__main()" in qir assert ( "call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 2 to %Result*), i8* null)" in qir @@ -384,7 +384,7 @@ def test_compile_qir_str_from_python_callable_with_multiple_args() -> None: ) operation = qsharp.compile(qsharp.code.Program, 5, 3) qir = str(operation) - assert "define void @ENTRYPOINT__main()" in qir + assert "define i64 @ENTRYPOINT__main()" in qir assert ( "call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 2 to %Result*), i8* null)" in qir @@ -406,7 +406,7 @@ def test_compile_qir_str_from_python_callable_with_multiple_args_passed_as_tuple args = (5, 3) operation = qsharp.compile(qsharp.code.Program, args) qir = str(operation) - assert "define void @ENTRYPOINT__main()" in qir + assert "define i64 @ENTRYPOINT__main()" in qir assert ( "call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 2 to %Result*), i8* null)" in qir From b5623cb1b7cfe5bef22fb7f2ce04b3f187c1c369 Mon Sep 17 00:00:00 2001 From: "Stefan J. Wernli" Date: Thu, 3 Jul 2025 11:26:51 -0700 Subject: [PATCH 2/5] Update Adaptive module flags --- source/compiler/qsc/src/codegen/tests.rs | 56 +++++++++---------- source/compiler/qsc/src/interpret/tests.rs | 2 +- source/compiler/qsc_codegen/src/qir.rs | 8 +-- .../src/tests/expression/function_call.rs | 2 +- source/compiler/qsc_qasm/src/tests/output.rs | 2 +- .../qsc_qasm/src/tests/statement/gate_call.rs | 8 +-- .../qsc_qasm/src/tests/statement/reset.rs | 2 +- .../resources/custom_intrinsics.ll | 2 +- .../adaptive_ri/output/ArithmeticOps.ll | 2 +- .../output/BernsteinVaziraniNISQ.ll | 2 +- .../adaptive_ri/output/ConstantFolding.ll | 2 +- .../output/CopyAndUpdateExpressions.ll | 2 +- .../adaptive_ri/output/DeutschJozsaNISQ.ll | 2 +- .../adaptive_ri/output/ExpandedTests.ll | 2 +- .../resources/adaptive_ri/output/Functors.ll | 2 +- .../adaptive_ri/output/HiddenShiftNISQ.ll | 2 +- .../adaptive_ri/output/IntegerComparison.ll | 2 +- .../adaptive_ri/output/IntrinsicCCNOT.ll | 2 +- .../adaptive_ri/output/IntrinsicCNOT.ll | 2 +- .../adaptive_ri/output/IntrinsicHIXYZ.ll | 2 +- .../adaptive_ri/output/IntrinsicM.ll | 2 +- .../output/IntrinsicMeasureWithBitFlipCode.ll | 2 +- .../IntrinsicMeasureWithPhaseFlipCode.ll | 2 +- .../output/IntrinsicRotationsWithPeriod.ll | 2 +- .../adaptive_ri/output/IntrinsicSTSWAP.ll | 2 +- .../adaptive_ri/output/MeasureAndReuse.ll | 2 +- .../output/MeasurementComparison.ll | 2 +- .../adaptive_ri/output/NestedBranching.ll | 2 +- .../resources/adaptive_ri/output/RandomBit.ll | 2 +- .../adaptive_ri/output/SampleTeleport.ll | 2 +- .../output/ShortcuttingMeasurement.ll | 2 +- .../resources/adaptive_ri/output/Slicing.ll | 2 +- .../adaptive_ri/output/SuperdenseCoding.ll | 2 +- .../adaptive_ri/output/SwitchHandling.ll | 2 +- .../output/ThreeQubitRepetitionCode.ll | 2 +- .../adaptive_ri/output/WithinApply.ll | 2 +- .../resources/adaptive_rif/output/Doubles.ll | 4 +- source/pip/tests/test_interpreter.py | 2 +- 38 files changed, 72 insertions(+), 72 deletions(-) diff --git a/source/compiler/qsc/src/codegen/tests.rs b/source/compiler/qsc/src/codegen/tests.rs index 98a666d56b..0b9e518c93 100644 --- a/source/compiler/qsc/src/codegen/tests.rs +++ b/source/compiler/qsc/src/codegen/tests.rs @@ -660,7 +660,7 @@ mod adaptive_ri_profile { !1 = !{i32 7, !"qir_minor_version", i32 0} !2 = !{i32 1, !"dynamic_qubit_management", i1 false} !3 = !{i32 1, !"dynamic_result_management", i1 false} - !4 = !{i32 1, !"int_computations", !"i64"} + !4 = !{i32 5, !"int_computations", !{!"i64"}} "#]] .assert_eq(&qir); } @@ -706,7 +706,7 @@ mod adaptive_ri_profile { !1 = !{i32 7, !"qir_minor_version", i32 0} !2 = !{i32 1, !"dynamic_qubit_management", i1 false} !3 = !{i32 1, !"dynamic_result_management", i1 false} - !4 = !{i32 1, !"int_computations", !"i64"} + !4 = !{i32 5, !"int_computations", !{!"i64"}} "#]].assert_eq(&qir); } @@ -759,7 +759,7 @@ mod adaptive_ri_profile { !1 = !{i32 7, !"qir_minor_version", i32 0} !2 = !{i32 1, !"dynamic_qubit_management", i1 false} !3 = !{i32 1, !"dynamic_result_management", i1 false} - !4 = !{i32 1, !"int_computations", !"i64"} + !4 = !{i32 5, !"int_computations", !{!"i64"}} "#]].assert_eq(&qir); } @@ -811,7 +811,7 @@ mod adaptive_ri_profile { !1 = !{i32 7, !"qir_minor_version", i32 0} !2 = !{i32 1, !"dynamic_qubit_management", i1 false} !3 = !{i32 1, !"dynamic_result_management", i1 false} - !4 = !{i32 1, !"int_computations", !"i64"} + !4 = !{i32 5, !"int_computations", !{!"i64"}} "#]].assert_eq(&qir); } @@ -872,7 +872,7 @@ mod adaptive_ri_profile { !1 = !{i32 7, !"qir_minor_version", i32 0} !2 = !{i32 1, !"dynamic_qubit_management", i1 false} !3 = !{i32 1, !"dynamic_result_management", i1 false} - !4 = !{i32 1, !"int_computations", !"i64"} + !4 = !{i32 5, !"int_computations", !{!"i64"}} "#]].assert_eq(&qir); } @@ -932,7 +932,7 @@ mod adaptive_ri_profile { !1 = !{i32 7, !"qir_minor_version", i32 0} !2 = !{i32 1, !"dynamic_qubit_management", i1 false} !3 = !{i32 1, !"dynamic_result_management", i1 false} - !4 = !{i32 1, !"int_computations", !"i64"} + !4 = !{i32 5, !"int_computations", !{!"i64"}} "#]].assert_eq(&qir); } @@ -987,7 +987,7 @@ mod adaptive_ri_profile { !1 = !{i32 7, !"qir_minor_version", i32 0} !2 = !{i32 1, !"dynamic_qubit_management", i1 false} !3 = !{i32 1, !"dynamic_result_management", i1 false} - !4 = !{i32 1, !"int_computations", !"i64"} + !4 = !{i32 5, !"int_computations", !{!"i64"}} "#]].assert_eq(&qir); } @@ -1035,7 +1035,7 @@ mod adaptive_ri_profile { !1 = !{i32 7, !"qir_minor_version", i32 0} !2 = !{i32 1, !"dynamic_qubit_management", i1 false} !3 = !{i32 1, !"dynamic_result_management", i1 false} - !4 = !{i32 1, !"int_computations", !"i64"} + !4 = !{i32 5, !"int_computations", !{!"i64"}} "#]] .assert_eq(&qir); } @@ -1102,8 +1102,8 @@ mod adaptive_rif_profile { !1 = !{i32 7, !"qir_minor_version", i32 0} !2 = !{i32 1, !"dynamic_qubit_management", i1 false} !3 = !{i32 1, !"dynamic_result_management", i1 false} - !4 = !{i32 1, !"int_computations", !"i64"} - !5 = !{i32 1, !"float_computations", !"f64"} + !4 = !{i32 5, !"int_computations", !{!"i64"}} + !5 = !{i32 5, !"float_computations", !{!"f64"}} "#]] .assert_eq(&qir); } @@ -1149,8 +1149,8 @@ mod adaptive_rif_profile { !1 = !{i32 7, !"qir_minor_version", i32 0} !2 = !{i32 1, !"dynamic_qubit_management", i1 false} !3 = !{i32 1, !"dynamic_result_management", i1 false} - !4 = !{i32 1, !"int_computations", !"i64"} - !5 = !{i32 1, !"float_computations", !"f64"} + !4 = !{i32 5, !"int_computations", !{!"i64"}} + !5 = !{i32 5, !"float_computations", !{!"f64"}} "#]].assert_eq(&qir); } @@ -1203,8 +1203,8 @@ mod adaptive_rif_profile { !1 = !{i32 7, !"qir_minor_version", i32 0} !2 = !{i32 1, !"dynamic_qubit_management", i1 false} !3 = !{i32 1, !"dynamic_result_management", i1 false} - !4 = !{i32 1, !"int_computations", !"i64"} - !5 = !{i32 1, !"float_computations", !"f64"} + !4 = !{i32 5, !"int_computations", !{!"i64"}} + !5 = !{i32 5, !"float_computations", !{!"f64"}} "#]].assert_eq(&qir); } @@ -1256,8 +1256,8 @@ mod adaptive_rif_profile { !1 = !{i32 7, !"qir_minor_version", i32 0} !2 = !{i32 1, !"dynamic_qubit_management", i1 false} !3 = !{i32 1, !"dynamic_result_management", i1 false} - !4 = !{i32 1, !"int_computations", !"i64"} - !5 = !{i32 1, !"float_computations", !"f64"} + !4 = !{i32 5, !"int_computations", !{!"i64"}} + !5 = !{i32 5, !"float_computations", !{!"f64"}} "#]].assert_eq(&qir); } @@ -1318,8 +1318,8 @@ mod adaptive_rif_profile { !1 = !{i32 7, !"qir_minor_version", i32 0} !2 = !{i32 1, !"dynamic_qubit_management", i1 false} !3 = !{i32 1, !"dynamic_result_management", i1 false} - !4 = !{i32 1, !"int_computations", !"i64"} - !5 = !{i32 1, !"float_computations", !"f64"} + !4 = !{i32 5, !"int_computations", !{!"i64"}} + !5 = !{i32 5, !"float_computations", !{!"f64"}} "#]].assert_eq(&qir); } @@ -1379,8 +1379,8 @@ mod adaptive_rif_profile { !1 = !{i32 7, !"qir_minor_version", i32 0} !2 = !{i32 1, !"dynamic_qubit_management", i1 false} !3 = !{i32 1, !"dynamic_result_management", i1 false} - !4 = !{i32 1, !"int_computations", !"i64"} - !5 = !{i32 1, !"float_computations", !"f64"} + !4 = !{i32 5, !"int_computations", !{!"i64"}} + !5 = !{i32 5, !"float_computations", !{!"f64"}} "#]].assert_eq(&qir); } @@ -1435,8 +1435,8 @@ mod adaptive_rif_profile { !1 = !{i32 7, !"qir_minor_version", i32 0} !2 = !{i32 1, !"dynamic_qubit_management", i1 false} !3 = !{i32 1, !"dynamic_result_management", i1 false} - !4 = !{i32 1, !"int_computations", !"i64"} - !5 = !{i32 1, !"float_computations", !"f64"} + !4 = !{i32 5, !"int_computations", !{!"i64"}} + !5 = !{i32 5, !"float_computations", !{!"f64"}} "#]].assert_eq(&qir); } @@ -1491,8 +1491,8 @@ mod adaptive_rif_profile { !1 = !{i32 7, !"qir_minor_version", i32 0} !2 = !{i32 1, !"dynamic_qubit_management", i1 false} !3 = !{i32 1, !"dynamic_result_management", i1 false} - !4 = !{i32 1, !"int_computations", !"i64"} - !5 = !{i32 1, !"float_computations", !"f64"} + !4 = !{i32 5, !"int_computations", !{!"i64"}} + !5 = !{i32 5, !"float_computations", !{!"f64"}} "#]].assert_eq(&qir); } @@ -1540,8 +1540,8 @@ mod adaptive_rif_profile { !1 = !{i32 7, !"qir_minor_version", i32 0} !2 = !{i32 1, !"dynamic_qubit_management", i1 false} !3 = !{i32 1, !"dynamic_result_management", i1 false} - !4 = !{i32 1, !"int_computations", !"i64"} - !5 = !{i32 1, !"float_computations", !"f64"} + !4 = !{i32 5, !"int_computations", !{!"i64"}} + !5 = !{i32 5, !"float_computations", !{!"f64"}} "#]] .assert_eq(&qir); } @@ -1623,8 +1623,8 @@ mod adaptive_rif_profile { !1 = !{i32 7, !"qir_minor_version", i32 0} !2 = !{i32 1, !"dynamic_qubit_management", i1 false} !3 = !{i32 1, !"dynamic_result_management", i1 false} - !4 = !{i32 1, !"int_computations", !"i64"} - !5 = !{i32 1, !"float_computations", !"f64"} + !4 = !{i32 5, !"int_computations", !{!"i64"}} + !5 = !{i32 5, !"float_computations", !{!"f64"}} "#]].assert_eq(&qir); } } diff --git a/source/compiler/qsc/src/interpret/tests.rs b/source/compiler/qsc/src/interpret/tests.rs index c005660490..8112773088 100644 --- a/source/compiler/qsc/src/interpret/tests.rs +++ b/source/compiler/qsc/src/interpret/tests.rs @@ -1002,7 +1002,7 @@ mod given_interpreter { !1 = !{i32 7, !"qir_minor_version", i32 0} !2 = !{i32 1, !"dynamic_qubit_management", i1 false} !3 = !{i32 1, !"dynamic_result_management", i1 false} - !4 = !{i32 1, !"int_computations", !"i64"} + !4 = !{i32 5, !"int_computations", !{!"i64"}} "#]] .assert_eq(&res); } diff --git a/source/compiler/qsc_codegen/src/qir.rs b/source/compiler/qsc_codegen/src/qir.rs index f167ee81c2..2118dee9e5 100644 --- a/source/compiler/qsc_codegen/src/qir.rs +++ b/source/compiler/qsc_codegen/src/qir.rs @@ -728,8 +728,8 @@ fn get_module_metadata(program: &rir::Program) -> String { let name = "int_computations"; writeln!( flags, - "!{} = !{{i32 {}, !\"{}\", !\"i{}\"}}", - index, 1, name, 64 + "!{} = !{{i32 {}, !\"{}\", !{{!\"i{}\"}}}}", + index, 5, name, 64 ) .expect("writing to string should succeed"); index += 1; @@ -738,8 +738,8 @@ fn get_module_metadata(program: &rir::Program) -> String { let name = "float_computations"; writeln!( flags, - "!{} = !{{i32 {}, !\"{}\", !\"f{}\"}}", - index, 1, name, 64 + "!{} = !{{i32 {}, !\"{}\", !{{!\"f{}\"}}}}", + index, 5, name, 64 ) .expect("writing to string should succeed"); index += 1; diff --git a/source/compiler/qsc_qasm/src/tests/expression/function_call.rs b/source/compiler/qsc_qasm/src/tests/expression/function_call.rs index 3c29881cdd..94491e3a22 100644 --- a/source/compiler/qsc_qasm/src/tests/expression/function_call.rs +++ b/source/compiler/qsc_qasm/src/tests/expression/function_call.rs @@ -340,7 +340,7 @@ fn simulatable_intrinsic_on_def_stmt_generates_correct_qir() -> miette::Result<( !1 = !{i32 7, !"qir_minor_version", i32 0} !2 = !{i32 1, !"dynamic_qubit_management", i1 false} !3 = !{i32 1, !"dynamic_result_management", i1 false} - !4 = !{i32 1, !"int_computations", !"i64"} + !4 = !{i32 5, !"int_computations", !{!"i64"}} "#]] .assert_eq(&qsharp); Ok(()) diff --git a/source/compiler/qsc_qasm/src/tests/output.rs b/source/compiler/qsc_qasm/src/tests/output.rs index 62af898943..0cf63f5505 100644 --- a/source/compiler/qsc_qasm/src/tests/output.rs +++ b/source/compiler/qsc_qasm/src/tests/output.rs @@ -306,7 +306,7 @@ c2[2] = measure q[4]; !1 = !{i32 7, !"qir_minor_version", i32 0} !2 = !{i32 1, !"dynamic_qubit_management", i1 false} !3 = !{i32 1, !"dynamic_result_management", i1 false} - !4 = !{i32 1, !"int_computations", !"i64"} + !4 = !{i32 5, !"int_computations", !{!"i64"}} "#]] .assert_eq(&qir); diff --git a/source/compiler/qsc_qasm/src/tests/statement/gate_call.rs b/source/compiler/qsc_qasm/src/tests/statement/gate_call.rs index c4da29a1bb..d1a874af32 100644 --- a/source/compiler/qsc_qasm/src/tests/statement/gate_call.rs +++ b/source/compiler/qsc_qasm/src/tests/statement/gate_call.rs @@ -277,7 +277,7 @@ fn barrier_generates_qir() -> miette::Result<(), Vec> { !1 = !{i32 7, !"qir_minor_version", i32 0} !2 = !{i32 1, !"dynamic_qubit_management", i1 false} !3 = !{i32 1, !"dynamic_result_management", i1 false} - !4 = !{i32 1, !"int_computations", !"i64"} + !4 = !{i32 5, !"int_computations", !{!"i64"}} "#]] .assert_eq(&qsharp); Ok(()) @@ -630,7 +630,7 @@ fn simulatable_intrinsic_on_gate_stmt_generates_correct_qir() -> miette::Result< !1 = !{i32 7, !"qir_minor_version", i32 0} !2 = !{i32 1, !"dynamic_qubit_management", i1 false} !3 = !{i32 1, !"dynamic_result_management", i1 false} - !4 = !{i32 1, !"int_computations", !"i64"} + !4 = !{i32 5, !"int_computations", !{!"i64"}} "#]].assert_eq(&qsharp); Ok(()) } @@ -1119,7 +1119,7 @@ fn qasm2_barrier_generates_qir() -> miette::Result<(), Vec> { !1 = !{i32 7, !"qir_minor_version", i32 0} !2 = !{i32 1, !"dynamic_qubit_management", i1 false} !3 = !{i32 1, !"dynamic_result_management", i1 false} - !4 = !{i32 1, !"int_computations", !"i64"} + !4 = !{i32 5, !"int_computations", !{!"i64"}} "#]] .assert_eq(&qsharp); Ok(()) @@ -1375,7 +1375,7 @@ fn qasm2_simulatable_intrinsic_on_gate_stmt_generates_correct_qir() !1 = !{i32 7, !"qir_minor_version", i32 0} !2 = !{i32 1, !"dynamic_qubit_management", i1 false} !3 = !{i32 1, !"dynamic_result_management", i1 false} - !4 = !{i32 1, !"int_computations", !"i64"} + !4 = !{i32 5, !"int_computations", !{!"i64"}} "#]].assert_eq(&qsharp); Ok(()) } diff --git a/source/compiler/qsc_qasm/src/tests/statement/reset.rs b/source/compiler/qsc_qasm/src/tests/statement/reset.rs index 599e45a97f..7d94f80e8b 100644 --- a/source/compiler/qsc_qasm/src/tests/statement/reset.rs +++ b/source/compiler/qsc_qasm/src/tests/statement/reset.rs @@ -153,7 +153,7 @@ fn reset_with_adaptive_ri_profile_generates_reset_qir() -> miette::Result<(), Ve !1 = !{i32 7, !"qir_minor_version", i32 0} !2 = !{i32 1, !"dynamic_qubit_management", i1 false} !3 = !{i32 1, !"dynamic_result_management", i1 false} - !4 = !{i32 1, !"int_computations", !"i64"} + !4 = !{i32 5, !"int_computations", !{!"i64"}} "#]] .assert_eq(&qir); diff --git a/source/pip/tests-integration/interop_qiskit/resources/custom_intrinsics.ll b/source/pip/tests-integration/interop_qiskit/resources/custom_intrinsics.ll index 2e053c7a9d..c088d12a76 100644 --- a/source/pip/tests-integration/interop_qiskit/resources/custom_intrinsics.ll +++ b/source/pip/tests-integration/interop_qiskit/resources/custom_intrinsics.ll @@ -29,4 +29,4 @@ attributes #1 = { "irreversible" } !1 = !{i32 7, !"qir_minor_version", i32 0} !2 = !{i32 1, !"dynamic_qubit_management", i1 false} !3 = !{i32 1, !"dynamic_result_management", i1 false} -!4 = !{i32 1, !"int_computations", !"i64"} +!4 = !{i32 5, !"int_computations", !{!"i64"}} diff --git a/source/pip/tests-integration/resources/adaptive_ri/output/ArithmeticOps.ll b/source/pip/tests-integration/resources/adaptive_ri/output/ArithmeticOps.ll index f62309382e..851d7538a0 100644 --- a/source/pip/tests-integration/resources/adaptive_ri/output/ArithmeticOps.ll +++ b/source/pip/tests-integration/resources/adaptive_ri/output/ArithmeticOps.ll @@ -110,4 +110,4 @@ attributes #1 = { "irreversible" } !1 = !{i32 7, !"qir_minor_version", i32 0} !2 = !{i32 1, !"dynamic_qubit_management", i1 false} !3 = !{i32 1, !"dynamic_result_management", i1 false} -!4 = !{i32 1, !"int_computations", !"i64"} +!4 = !{i32 5, !"int_computations", !{!"i64"}} diff --git a/source/pip/tests-integration/resources/adaptive_ri/output/BernsteinVaziraniNISQ.ll b/source/pip/tests-integration/resources/adaptive_ri/output/BernsteinVaziraniNISQ.ll index d71810cc45..96b22236ee 100644 --- a/source/pip/tests-integration/resources/adaptive_ri/output/BernsteinVaziraniNISQ.ll +++ b/source/pip/tests-integration/resources/adaptive_ri/output/BernsteinVaziraniNISQ.ll @@ -58,4 +58,4 @@ attributes #1 = { "irreversible" } !1 = !{i32 7, !"qir_minor_version", i32 0} !2 = !{i32 1, !"dynamic_qubit_management", i1 false} !3 = !{i32 1, !"dynamic_result_management", i1 false} -!4 = !{i32 1, !"int_computations", !"i64"} +!4 = !{i32 5, !"int_computations", !{!"i64"}} diff --git a/source/pip/tests-integration/resources/adaptive_ri/output/ConstantFolding.ll b/source/pip/tests-integration/resources/adaptive_ri/output/ConstantFolding.ll index 7bfb6ea3a5..494eaf5422 100644 --- a/source/pip/tests-integration/resources/adaptive_ri/output/ConstantFolding.ll +++ b/source/pip/tests-integration/resources/adaptive_ri/output/ConstantFolding.ll @@ -64,4 +64,4 @@ attributes #1 = { "irreversible" } !1 = !{i32 7, !"qir_minor_version", i32 0} !2 = !{i32 1, !"dynamic_qubit_management", i1 false} !3 = !{i32 1, !"dynamic_result_management", i1 false} -!4 = !{i32 1, !"int_computations", !"i64"} +!4 = !{i32 5, !"int_computations", !{!"i64"}} diff --git a/source/pip/tests-integration/resources/adaptive_ri/output/CopyAndUpdateExpressions.ll b/source/pip/tests-integration/resources/adaptive_ri/output/CopyAndUpdateExpressions.ll index 0464b7b091..504c425882 100644 --- a/source/pip/tests-integration/resources/adaptive_ri/output/CopyAndUpdateExpressions.ll +++ b/source/pip/tests-integration/resources/adaptive_ri/output/CopyAndUpdateExpressions.ll @@ -49,4 +49,4 @@ attributes #1 = { "irreversible" } !1 = !{i32 7, !"qir_minor_version", i32 0} !2 = !{i32 1, !"dynamic_qubit_management", i1 false} !3 = !{i32 1, !"dynamic_result_management", i1 false} -!4 = !{i32 1, !"int_computations", !"i64"} +!4 = !{i32 5, !"int_computations", !{!"i64"}} diff --git a/source/pip/tests-integration/resources/adaptive_ri/output/DeutschJozsaNISQ.ll b/source/pip/tests-integration/resources/adaptive_ri/output/DeutschJozsaNISQ.ll index feac9a3c02..cc922b44b1 100644 --- a/source/pip/tests-integration/resources/adaptive_ri/output/DeutschJozsaNISQ.ll +++ b/source/pip/tests-integration/resources/adaptive_ri/output/DeutschJozsaNISQ.ll @@ -84,4 +84,4 @@ attributes #1 = { "irreversible" } !1 = !{i32 7, !"qir_minor_version", i32 0} !2 = !{i32 1, !"dynamic_qubit_management", i1 false} !3 = !{i32 1, !"dynamic_result_management", i1 false} -!4 = !{i32 1, !"int_computations", !"i64"} +!4 = !{i32 5, !"int_computations", !{!"i64"}} diff --git a/source/pip/tests-integration/resources/adaptive_ri/output/ExpandedTests.ll b/source/pip/tests-integration/resources/adaptive_ri/output/ExpandedTests.ll index 9650dad586..0863c76ac6 100644 --- a/source/pip/tests-integration/resources/adaptive_ri/output/ExpandedTests.ll +++ b/source/pip/tests-integration/resources/adaptive_ri/output/ExpandedTests.ll @@ -81,4 +81,4 @@ attributes #1 = { "irreversible" } !1 = !{i32 7, !"qir_minor_version", i32 0} !2 = !{i32 1, !"dynamic_qubit_management", i1 false} !3 = !{i32 1, !"dynamic_result_management", i1 false} -!4 = !{i32 1, !"int_computations", !"i64"} +!4 = !{i32 5, !"int_computations", !{!"i64"}} diff --git a/source/pip/tests-integration/resources/adaptive_ri/output/Functors.ll b/source/pip/tests-integration/resources/adaptive_ri/output/Functors.ll index 3c6dfdb0ec..c840f9ba71 100644 --- a/source/pip/tests-integration/resources/adaptive_ri/output/Functors.ll +++ b/source/pip/tests-integration/resources/adaptive_ri/output/Functors.ll @@ -114,4 +114,4 @@ attributes #1 = { "irreversible" } !1 = !{i32 7, !"qir_minor_version", i32 0} !2 = !{i32 1, !"dynamic_qubit_management", i1 false} !3 = !{i32 1, !"dynamic_result_management", i1 false} -!4 = !{i32 1, !"int_computations", !"i64"} +!4 = !{i32 5, !"int_computations", !{!"i64"}} diff --git a/source/pip/tests-integration/resources/adaptive_ri/output/HiddenShiftNISQ.ll b/source/pip/tests-integration/resources/adaptive_ri/output/HiddenShiftNISQ.ll index 94467ea01c..dcf05986da 100644 --- a/source/pip/tests-integration/resources/adaptive_ri/output/HiddenShiftNISQ.ll +++ b/source/pip/tests-integration/resources/adaptive_ri/output/HiddenShiftNISQ.ll @@ -70,4 +70,4 @@ attributes #1 = { "irreversible" } !1 = !{i32 7, !"qir_minor_version", i32 0} !2 = !{i32 1, !"dynamic_qubit_management", i1 false} !3 = !{i32 1, !"dynamic_result_management", i1 false} -!4 = !{i32 1, !"int_computations", !"i64"} +!4 = !{i32 5, !"int_computations", !{!"i64"}} diff --git a/source/pip/tests-integration/resources/adaptive_ri/output/IntegerComparison.ll b/source/pip/tests-integration/resources/adaptive_ri/output/IntegerComparison.ll index 9fb4a74070..7a094ba92f 100644 --- a/source/pip/tests-integration/resources/adaptive_ri/output/IntegerComparison.ll +++ b/source/pip/tests-integration/resources/adaptive_ri/output/IntegerComparison.ll @@ -136,4 +136,4 @@ attributes #1 = { "irreversible" } !1 = !{i32 7, !"qir_minor_version", i32 0} !2 = !{i32 1, !"dynamic_qubit_management", i1 false} !3 = !{i32 1, !"dynamic_result_management", i1 false} -!4 = !{i32 1, !"int_computations", !"i64"} +!4 = !{i32 5, !"int_computations", !{!"i64"}} diff --git a/source/pip/tests-integration/resources/adaptive_ri/output/IntrinsicCCNOT.ll b/source/pip/tests-integration/resources/adaptive_ri/output/IntrinsicCCNOT.ll index 4e469f399e..b7e7357b87 100644 --- a/source/pip/tests-integration/resources/adaptive_ri/output/IntrinsicCCNOT.ll +++ b/source/pip/tests-integration/resources/adaptive_ri/output/IntrinsicCCNOT.ll @@ -68,4 +68,4 @@ attributes #1 = { "irreversible" } !1 = !{i32 7, !"qir_minor_version", i32 0} !2 = !{i32 1, !"dynamic_qubit_management", i1 false} !3 = !{i32 1, !"dynamic_result_management", i1 false} -!4 = !{i32 1, !"int_computations", !"i64"} +!4 = !{i32 5, !"int_computations", !{!"i64"}} diff --git a/source/pip/tests-integration/resources/adaptive_ri/output/IntrinsicCNOT.ll b/source/pip/tests-integration/resources/adaptive_ri/output/IntrinsicCNOT.ll index 094db28dae..1828fba55a 100644 --- a/source/pip/tests-integration/resources/adaptive_ri/output/IntrinsicCNOT.ll +++ b/source/pip/tests-integration/resources/adaptive_ri/output/IntrinsicCNOT.ll @@ -49,4 +49,4 @@ attributes #1 = { "irreversible" } !1 = !{i32 7, !"qir_minor_version", i32 0} !2 = !{i32 1, !"dynamic_qubit_management", i1 false} !3 = !{i32 1, !"dynamic_result_management", i1 false} -!4 = !{i32 1, !"int_computations", !"i64"} +!4 = !{i32 5, !"int_computations", !{!"i64"}} diff --git a/source/pip/tests-integration/resources/adaptive_ri/output/IntrinsicHIXYZ.ll b/source/pip/tests-integration/resources/adaptive_ri/output/IntrinsicHIXYZ.ll index 0b383161e3..95f87dc8d1 100644 --- a/source/pip/tests-integration/resources/adaptive_ri/output/IntrinsicHIXYZ.ll +++ b/source/pip/tests-integration/resources/adaptive_ri/output/IntrinsicHIXYZ.ll @@ -56,4 +56,4 @@ attributes #1 = { "irreversible" } !1 = !{i32 7, !"qir_minor_version", i32 0} !2 = !{i32 1, !"dynamic_qubit_management", i1 false} !3 = !{i32 1, !"dynamic_result_management", i1 false} -!4 = !{i32 1, !"int_computations", !"i64"} +!4 = !{i32 5, !"int_computations", !{!"i64"}} diff --git a/source/pip/tests-integration/resources/adaptive_ri/output/IntrinsicM.ll b/source/pip/tests-integration/resources/adaptive_ri/output/IntrinsicM.ll index de6d16a8fb..40a57fd26b 100644 --- a/source/pip/tests-integration/resources/adaptive_ri/output/IntrinsicM.ll +++ b/source/pip/tests-integration/resources/adaptive_ri/output/IntrinsicM.ll @@ -35,4 +35,4 @@ attributes #1 = { "irreversible" } !1 = !{i32 7, !"qir_minor_version", i32 0} !2 = !{i32 1, !"dynamic_qubit_management", i1 false} !3 = !{i32 1, !"dynamic_result_management", i1 false} -!4 = !{i32 1, !"int_computations", !"i64"} +!4 = !{i32 5, !"int_computations", !{!"i64"}} diff --git a/source/pip/tests-integration/resources/adaptive_ri/output/IntrinsicMeasureWithBitFlipCode.ll b/source/pip/tests-integration/resources/adaptive_ri/output/IntrinsicMeasureWithBitFlipCode.ll index 27709c18ec..8a763ddda2 100644 --- a/source/pip/tests-integration/resources/adaptive_ri/output/IntrinsicMeasureWithBitFlipCode.ll +++ b/source/pip/tests-integration/resources/adaptive_ri/output/IntrinsicMeasureWithBitFlipCode.ll @@ -72,4 +72,4 @@ attributes #1 = { "irreversible" } !1 = !{i32 7, !"qir_minor_version", i32 0} !2 = !{i32 1, !"dynamic_qubit_management", i1 false} !3 = !{i32 1, !"dynamic_result_management", i1 false} -!4 = !{i32 1, !"int_computations", !"i64"} +!4 = !{i32 5, !"int_computations", !{!"i64"}} diff --git a/source/pip/tests-integration/resources/adaptive_ri/output/IntrinsicMeasureWithPhaseFlipCode.ll b/source/pip/tests-integration/resources/adaptive_ri/output/IntrinsicMeasureWithPhaseFlipCode.ll index 1deae6faf5..fe6a3eaec6 100644 --- a/source/pip/tests-integration/resources/adaptive_ri/output/IntrinsicMeasureWithPhaseFlipCode.ll +++ b/source/pip/tests-integration/resources/adaptive_ri/output/IntrinsicMeasureWithPhaseFlipCode.ll @@ -76,4 +76,4 @@ attributes #1 = { "irreversible" } !1 = !{i32 7, !"qir_minor_version", i32 0} !2 = !{i32 1, !"dynamic_qubit_management", i1 false} !3 = !{i32 1, !"dynamic_result_management", i1 false} -!4 = !{i32 1, !"int_computations", !"i64"} +!4 = !{i32 5, !"int_computations", !{!"i64"}} diff --git a/source/pip/tests-integration/resources/adaptive_ri/output/IntrinsicRotationsWithPeriod.ll b/source/pip/tests-integration/resources/adaptive_ri/output/IntrinsicRotationsWithPeriod.ll index 654c1e7221..0b45b3431e 100644 --- a/source/pip/tests-integration/resources/adaptive_ri/output/IntrinsicRotationsWithPeriod.ll +++ b/source/pip/tests-integration/resources/adaptive_ri/output/IntrinsicRotationsWithPeriod.ll @@ -113,4 +113,4 @@ attributes #1 = { "irreversible" } !1 = !{i32 7, !"qir_minor_version", i32 0} !2 = !{i32 1, !"dynamic_qubit_management", i1 false} !3 = !{i32 1, !"dynamic_result_management", i1 false} -!4 = !{i32 1, !"int_computations", !"i64"} +!4 = !{i32 5, !"int_computations", !{!"i64"}} diff --git a/source/pip/tests-integration/resources/adaptive_ri/output/IntrinsicSTSWAP.ll b/source/pip/tests-integration/resources/adaptive_ri/output/IntrinsicSTSWAP.ll index 27f1790394..c2bb7b0249 100644 --- a/source/pip/tests-integration/resources/adaptive_ri/output/IntrinsicSTSWAP.ll +++ b/source/pip/tests-integration/resources/adaptive_ri/output/IntrinsicSTSWAP.ll @@ -57,4 +57,4 @@ attributes #1 = { "irreversible" } !1 = !{i32 7, !"qir_minor_version", i32 0} !2 = !{i32 1, !"dynamic_qubit_management", i1 false} !3 = !{i32 1, !"dynamic_result_management", i1 false} -!4 = !{i32 1, !"int_computations", !"i64"} +!4 = !{i32 5, !"int_computations", !{!"i64"}} diff --git a/source/pip/tests-integration/resources/adaptive_ri/output/MeasureAndReuse.ll b/source/pip/tests-integration/resources/adaptive_ri/output/MeasureAndReuse.ll index 54b1359c6f..27fb460bf7 100644 --- a/source/pip/tests-integration/resources/adaptive_ri/output/MeasureAndReuse.ll +++ b/source/pip/tests-integration/resources/adaptive_ri/output/MeasureAndReuse.ll @@ -50,4 +50,4 @@ attributes #1 = { "irreversible" } !1 = !{i32 7, !"qir_minor_version", i32 0} !2 = !{i32 1, !"dynamic_qubit_management", i1 false} !3 = !{i32 1, !"dynamic_result_management", i1 false} -!4 = !{i32 1, !"int_computations", !"i64"} +!4 = !{i32 5, !"int_computations", !{!"i64"}} diff --git a/source/pip/tests-integration/resources/adaptive_ri/output/MeasurementComparison.ll b/source/pip/tests-integration/resources/adaptive_ri/output/MeasurementComparison.ll index c984d71986..4dccd6e2cb 100644 --- a/source/pip/tests-integration/resources/adaptive_ri/output/MeasurementComparison.ll +++ b/source/pip/tests-integration/resources/adaptive_ri/output/MeasurementComparison.ll @@ -57,4 +57,4 @@ attributes #1 = { "irreversible" } !1 = !{i32 7, !"qir_minor_version", i32 0} !2 = !{i32 1, !"dynamic_qubit_management", i1 false} !3 = !{i32 1, !"dynamic_result_management", i1 false} -!4 = !{i32 1, !"int_computations", !"i64"} +!4 = !{i32 5, !"int_computations", !{!"i64"}} diff --git a/source/pip/tests-integration/resources/adaptive_ri/output/NestedBranching.ll b/source/pip/tests-integration/resources/adaptive_ri/output/NestedBranching.ll index d9418582dd..4b6759e31e 100644 --- a/source/pip/tests-integration/resources/adaptive_ri/output/NestedBranching.ll +++ b/source/pip/tests-integration/resources/adaptive_ri/output/NestedBranching.ll @@ -334,4 +334,4 @@ attributes #1 = { "irreversible" } !1 = !{i32 7, !"qir_minor_version", i32 0} !2 = !{i32 1, !"dynamic_qubit_management", i1 false} !3 = !{i32 1, !"dynamic_result_management", i1 false} -!4 = !{i32 1, !"int_computations", !"i64"} +!4 = !{i32 5, !"int_computations", !{!"i64"}} diff --git a/source/pip/tests-integration/resources/adaptive_ri/output/RandomBit.ll b/source/pip/tests-integration/resources/adaptive_ri/output/RandomBit.ll index 393ba107d0..8c41bf34e2 100644 --- a/source/pip/tests-integration/resources/adaptive_ri/output/RandomBit.ll +++ b/source/pip/tests-integration/resources/adaptive_ri/output/RandomBit.ll @@ -29,4 +29,4 @@ attributes #1 = { "irreversible" } !1 = !{i32 7, !"qir_minor_version", i32 0} !2 = !{i32 1, !"dynamic_qubit_management", i1 false} !3 = !{i32 1, !"dynamic_result_management", i1 false} -!4 = !{i32 1, !"int_computations", !"i64"} +!4 = !{i32 5, !"int_computations", !{!"i64"}} diff --git a/source/pip/tests-integration/resources/adaptive_ri/output/SampleTeleport.ll b/source/pip/tests-integration/resources/adaptive_ri/output/SampleTeleport.ll index eb6dd04a02..a4ad861c3d 100644 --- a/source/pip/tests-integration/resources/adaptive_ri/output/SampleTeleport.ll +++ b/source/pip/tests-integration/resources/adaptive_ri/output/SampleTeleport.ll @@ -61,4 +61,4 @@ attributes #1 = { "irreversible" } !1 = !{i32 7, !"qir_minor_version", i32 0} !2 = !{i32 1, !"dynamic_qubit_management", i1 false} !3 = !{i32 1, !"dynamic_result_management", i1 false} -!4 = !{i32 1, !"int_computations", !"i64"} +!4 = !{i32 5, !"int_computations", !{!"i64"}} diff --git a/source/pip/tests-integration/resources/adaptive_ri/output/ShortcuttingMeasurement.ll b/source/pip/tests-integration/resources/adaptive_ri/output/ShortcuttingMeasurement.ll index 6ed607e4ce..e63c24c8cc 100644 --- a/source/pip/tests-integration/resources/adaptive_ri/output/ShortcuttingMeasurement.ll +++ b/source/pip/tests-integration/resources/adaptive_ri/output/ShortcuttingMeasurement.ll @@ -55,4 +55,4 @@ attributes #1 = { "irreversible" } !1 = !{i32 7, !"qir_minor_version", i32 0} !2 = !{i32 1, !"dynamic_qubit_management", i1 false} !3 = !{i32 1, !"dynamic_result_management", i1 false} -!4 = !{i32 1, !"int_computations", !"i64"} +!4 = !{i32 5, !"int_computations", !{!"i64"}} diff --git a/source/pip/tests-integration/resources/adaptive_ri/output/Slicing.ll b/source/pip/tests-integration/resources/adaptive_ri/output/Slicing.ll index 6c060a0e3b..0c6f0db14d 100644 --- a/source/pip/tests-integration/resources/adaptive_ri/output/Slicing.ll +++ b/source/pip/tests-integration/resources/adaptive_ri/output/Slicing.ll @@ -53,4 +53,4 @@ attributes #1 = { "irreversible" } !1 = !{i32 7, !"qir_minor_version", i32 0} !2 = !{i32 1, !"dynamic_qubit_management", i1 false} !3 = !{i32 1, !"dynamic_result_management", i1 false} -!4 = !{i32 1, !"int_computations", !"i64"} +!4 = !{i32 5, !"int_computations", !{!"i64"}} diff --git a/source/pip/tests-integration/resources/adaptive_ri/output/SuperdenseCoding.ll b/source/pip/tests-integration/resources/adaptive_ri/output/SuperdenseCoding.ll index 54bd2dbd7e..806154ff0c 100644 --- a/source/pip/tests-integration/resources/adaptive_ri/output/SuperdenseCoding.ll +++ b/source/pip/tests-integration/resources/adaptive_ri/output/SuperdenseCoding.ll @@ -76,4 +76,4 @@ attributes #1 = { "irreversible" } !1 = !{i32 7, !"qir_minor_version", i32 0} !2 = !{i32 1, !"dynamic_qubit_management", i1 false} !3 = !{i32 1, !"dynamic_result_management", i1 false} -!4 = !{i32 1, !"int_computations", !"i64"} +!4 = !{i32 5, !"int_computations", !{!"i64"}} diff --git a/source/pip/tests-integration/resources/adaptive_ri/output/SwitchHandling.ll b/source/pip/tests-integration/resources/adaptive_ri/output/SwitchHandling.ll index d03b910a44..7ca5f8bb3c 100644 --- a/source/pip/tests-integration/resources/adaptive_ri/output/SwitchHandling.ll +++ b/source/pip/tests-integration/resources/adaptive_ri/output/SwitchHandling.ll @@ -81,4 +81,4 @@ attributes #1 = { "irreversible" } !1 = !{i32 7, !"qir_minor_version", i32 0} !2 = !{i32 1, !"dynamic_qubit_management", i1 false} !3 = !{i32 1, !"dynamic_result_management", i1 false} -!4 = !{i32 1, !"int_computations", !"i64"} +!4 = !{i32 5, !"int_computations", !{!"i64"}} diff --git a/source/pip/tests-integration/resources/adaptive_ri/output/ThreeQubitRepetitionCode.ll b/source/pip/tests-integration/resources/adaptive_ri/output/ThreeQubitRepetitionCode.ll index ed1e0b3e82..e74249b7b1 100644 --- a/source/pip/tests-integration/resources/adaptive_ri/output/ThreeQubitRepetitionCode.ll +++ b/source/pip/tests-integration/resources/adaptive_ri/output/ThreeQubitRepetitionCode.ll @@ -302,4 +302,4 @@ attributes #1 = { "irreversible" } !1 = !{i32 7, !"qir_minor_version", i32 0} !2 = !{i32 1, !"dynamic_qubit_management", i1 false} !3 = !{i32 1, !"dynamic_result_management", i1 false} -!4 = !{i32 1, !"int_computations", !"i64"} +!4 = !{i32 5, !"int_computations", !{!"i64"}} diff --git a/source/pip/tests-integration/resources/adaptive_ri/output/WithinApply.ll b/source/pip/tests-integration/resources/adaptive_ri/output/WithinApply.ll index 745cb5d83d..f59d42593a 100644 --- a/source/pip/tests-integration/resources/adaptive_ri/output/WithinApply.ll +++ b/source/pip/tests-integration/resources/adaptive_ri/output/WithinApply.ll @@ -44,4 +44,4 @@ attributes #1 = { "irreversible" } !1 = !{i32 7, !"qir_minor_version", i32 0} !2 = !{i32 1, !"dynamic_qubit_management", i1 false} !3 = !{i32 1, !"dynamic_result_management", i1 false} -!4 = !{i32 1, !"int_computations", !"i64"} +!4 = !{i32 5, !"int_computations", !{!"i64"}} diff --git a/source/pip/tests-integration/resources/adaptive_rif/output/Doubles.ll b/source/pip/tests-integration/resources/adaptive_rif/output/Doubles.ll index 15defd05a9..655edb4d81 100644 --- a/source/pip/tests-integration/resources/adaptive_rif/output/Doubles.ll +++ b/source/pip/tests-integration/resources/adaptive_rif/output/Doubles.ll @@ -179,5 +179,5 @@ attributes #1 = { "irreversible" } !1 = !{i32 7, !"qir_minor_version", i32 0} !2 = !{i32 1, !"dynamic_qubit_management", i1 false} !3 = !{i32 1, !"dynamic_result_management", i1 false} -!4 = !{i32 1, !"int_computations", !"i64"} -!5 = !{i32 1, !"float_computations", !"f64"} +!4 = !{i32 5, !"int_computations", !{!"i64"}} +!5 = !{i32 5, !"float_computations", !{!"f64"}} diff --git a/source/pip/tests/test_interpreter.py b/source/pip/tests/test_interpreter.py index be11b64ace..54d91d2d6f 100644 --- a/source/pip/tests/test_interpreter.py +++ b/source/pip/tests/test_interpreter.py @@ -398,7 +398,7 @@ def test_adaptive_ri_qir_can_be_generated() -> None: !1 = !{i32 7, !"qir_minor_version", i32 0} !2 = !{i32 1, !"dynamic_qubit_management", i1 false} !3 = !{i32 1, !"dynamic_result_management", i1 false} - !4 = !{i32 1, !"int_computations", !"i64"} + !4 = !{i32 5, !"int_computations", !{!"i64"}} """ ) From a1f094459cbc1aba874ae74a036b77dff18938e7 Mon Sep 17 00:00:00 2001 From: "Stefan J. Wernli" Date: Thu, 3 Jul 2025 15:52:55 -0700 Subject: [PATCH 3/5] Output tagging unconditionally included --- source/compiler/qsc/src/codegen/tests.rs | 225 +++++++++++++----- source/compiler/qsc/src/interpret/tests.rs | 50 +++- source/compiler/qsc_codegen/src/qir.rs | 27 ++- .../compiler/qsc_codegen/src/qir/template.ll | 2 + source/compiler/qsc_codegen/src/qir/tests.rs | 16 +- source/compiler/qsc_partial_eval/src/lib.rs | 105 +++++--- .../qsc_partial_eval/src/tests/arrays.rs | 106 ++++----- .../qsc_partial_eval/src/tests/assigns.rs | 118 ++++----- .../qsc_partial_eval/src/tests/bindings.rs | 16 +- .../qsc_partial_eval/src/tests/branching.rs | 216 ++++++++--------- .../qsc_partial_eval/src/tests/calls.rs | 108 ++++----- .../src/tests/classical_args.rs | 6 +- .../src/tests/dynamic_vars.rs | 158 ++++++------ .../qsc_partial_eval/src/tests/intrinsics.rs | 114 ++++----- .../qsc_partial_eval/src/tests/loops.rs | 14 +- .../qsc_partial_eval/src/tests/misc.rs | 18 +- .../qsc_partial_eval/src/tests/operators.rs | 104 ++++---- .../src/tests/output_recording.rs | 106 ++++++--- .../qsc_partial_eval/src/tests/qubits.rs | 10 +- .../qsc_partial_eval/src/tests/results.rs | 28 +-- .../qsc_partial_eval/src/tests/returns.rs | 68 +++--- .../src/tests/expression/function_call.rs | 4 +- source/compiler/qsc_qasm/src/tests/output.rs | 23 +- .../qsc_qasm/src/tests/statement/gate_call.rs | 25 +- .../qsc_qasm/src/tests/statement/reset.rs | 14 +- source/compiler/qsc_rir/src/builder.rs | 10 +- .../src/passes/reindex_qubits/tests.rs | 4 +- .../src/passes/remap_block_ids/tests.rs | 56 +++-- .../src/passes/simplify_control_flow/tests.rs | 32 ++- .../qsc_rir/src/passes/ssa_transform/tests.rs | 120 +++++++--- source/compiler/qsc_rir/src/rir.rs | 20 +- .../resources/custom_intrinsics.ll | 7 +- .../interop_qiskit/test_qir.py | 2 +- .../adaptive_ri/output/ArithmeticOps.ll | 16 +- .../adaptive_ri/output/ArithmeticOps.out | 10 +- .../output/BernsteinVaziraniNISQ.ll | 19 +- .../output/BernsteinVaziraniNISQ.out | 12 +- .../adaptive_ri/output/ConstantFolding.ll | 16 +- .../adaptive_ri/output/ConstantFolding.out | 10 +- .../output/CopyAndUpdateExpressions.ll | 25 +- .../output/CopyAndUpdateExpressions.out | 18 +- .../adaptive_ri/output/DeutschJozsaNISQ.ll | 32 ++- .../adaptive_ri/output/DeutschJozsaNISQ.out | 22 +- .../adaptive_ri/output/ExpandedTests.ll | 15 +- .../adaptive_ri/output/ExpandedTests.out | 10 +- .../resources/adaptive_ri/output/Functors.ll | 28 ++- .../resources/adaptive_ri/output/Functors.out | 20 +- .../adaptive_ri/output/HiddenShiftNISQ.ll | 22 +- .../adaptive_ri/output/HiddenShiftNISQ.out | 14 +- .../adaptive_ri/output/IntegerComparison.ll | 13 +- .../adaptive_ri/output/IntegerComparison.out | 8 +- .../adaptive_ri/output/IntrinsicCCNOT.ll | 37 ++- .../adaptive_ri/output/IntrinsicCCNOT.out | 26 +- .../adaptive_ri/output/IntrinsicCNOT.ll | 20 +- .../adaptive_ri/output/IntrinsicCNOT.out | 14 +- .../adaptive_ri/output/IntrinsicHIXYZ.ll | 22 +- .../adaptive_ri/output/IntrinsicHIXYZ.out | 14 +- .../adaptive_ri/output/IntrinsicM.ll | 10 +- .../adaptive_ri/output/IntrinsicM.out | 6 +- .../output/IntrinsicMeasureWithBitFlipCode.ll | 31 ++- .../IntrinsicMeasureWithBitFlipCode.out | 22 +- .../IntrinsicMeasureWithPhaseFlipCode.ll | 31 ++- .../IntrinsicMeasureWithPhaseFlipCode.out | 22 +- .../output/IntrinsicRotationsWithPeriod.ll | 28 ++- .../output/IntrinsicRotationsWithPeriod.out | 20 +- .../adaptive_ri/output/IntrinsicSTSWAP.ll | 18 +- .../adaptive_ri/output/IntrinsicSTSWAP.out | 12 +- .../adaptive_ri/output/MeasureAndReuse.ll | 19 +- .../adaptive_ri/output/MeasureAndReuse.out | 12 +- .../output/MeasurementComparison.ll | 16 +- .../output/MeasurementComparison.out | 10 +- .../adaptive_ri/output/NestedBranching.ll | 39 +-- .../adaptive_ri/output/NestedBranching.out | 28 +-- .../resources/adaptive_ri/output/RandomBit.ll | 5 +- .../adaptive_ri/output/RandomBit.out | 2 +- .../adaptive_ri/output/SampleTeleport.ll | 5 +- .../adaptive_ri/output/SampleTeleport.out | 2 +- .../output/ShortcuttingMeasurement.ll | 10 +- .../output/ShortcuttingMeasurement.out | 6 +- .../resources/adaptive_ri/output/Slicing.ll | 19 +- .../resources/adaptive_ri/output/Slicing.out | 12 +- .../adaptive_ri/output/SuperdenseCoding.ll | 20 +- .../adaptive_ri/output/SuperdenseCoding.out | 14 +- .../adaptive_ri/output/SwitchHandling.ll | 5 +- .../adaptive_ri/output/SwitchHandling.out | 2 +- .../output/ThreeQubitRepetitionCode.ll | 10 +- .../output/ThreeQubitRepetitionCode.out | 6 +- .../adaptive_ri/output/WithinApply.ll | 13 +- .../adaptive_ri/output/WithinApply.out | 8 +- .../resources/adaptive_rif/output/Doubles.ll | 22 +- .../resources/adaptive_rif/output/Doubles.out | 14 +- source/pip/tests/test_interpreter.py | 10 +- source/pip/tests/test_qasm.py | 6 +- source/pip/tests/test_qsharp.py | 14 +- 94 files changed, 1749 insertions(+), 1155 deletions(-) diff --git a/source/compiler/qsc/src/codegen/tests.rs b/source/compiler/qsc/src/codegen/tests.rs index 0b9e518c93..5bd31f6189 100644 --- a/source/compiler/qsc/src/codegen/tests.rs +++ b/source/compiler/qsc/src/codegen/tests.rs @@ -105,13 +105,16 @@ mod base_profile { %Result = type opaque %Qubit = type opaque + @empty_tag = internal constant [1 x i8] c"\00" + @0 = internal constant [4 x i8] c"0_r\00" + define i64 @ENTRYPOINT__main() #0 { block_0: call void @__quantum__qis__rz__body(double 2.0, %Qubit* inttoptr (i64 0 to %Qubit*)) call void @__quantum__qis__rz__body(double 0.0, %Qubit* inttoptr (i64 0 to %Qubit*)) call void @__quantum__qis__rz__body(double 1.0, %Qubit* inttoptr (i64 0 to %Qubit*)) call void @__quantum__qis__m__body(%Qubit* inttoptr (i64 0 to %Qubit*), %Result* inttoptr (i64 0 to %Result*)) - call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 0 to %Result*), i8* null) + call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 0 to %Result*), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @0, i64 0, i64 0)) ret i64 0 } @@ -150,13 +153,17 @@ mod base_profile { %Result = type opaque %Qubit = type opaque + @empty_tag = internal constant [1 x i8] c"\00" + @0 = internal constant [6 x i8] c"0_t0r\00" + @1 = internal constant [6 x i8] c"1_t1r\00" + define i64 @ENTRYPOINT__main() #0 { block_0: call void @__quantum__qis__m__body(%Qubit* inttoptr (i64 0 to %Qubit*), %Result* inttoptr (i64 0 to %Result*)) call void @__quantum__qis__m__body(%Qubit* inttoptr (i64 1 to %Qubit*), %Result* inttoptr (i64 1 to %Result*)) - call void @__quantum__rt__tuple_record_output(i64 2, i8* null) - call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 0 to %Result*), i8* null) - call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 1 to %Result*), i8* null) + call void @__quantum__rt__tuple_record_output(i64 2, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @empty_tag, i64 0, i64 0)) + call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 0 to %Result*), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @0, i64 0, i64 0)) + call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 1 to %Result*), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @1, i64 0, i64 0)) ret i64 0 } @@ -198,15 +205,19 @@ mod base_profile { %Result = type opaque %Qubit = type opaque + @empty_tag = internal constant [1 x i8] c"\00" + @0 = internal constant [6 x i8] c"0_a0r\00" + @1 = internal constant [6 x i8] c"1_a1r\00" + define i64 @ENTRYPOINT__main() #0 { block_0: call void @__quantum__qis__x__body(%Qubit* inttoptr (i64 0 to %Qubit*)) call void @__quantum__qis__x__body(%Qubit* inttoptr (i64 1 to %Qubit*)) call void @__quantum__qis__m__body(%Qubit* inttoptr (i64 0 to %Qubit*), %Result* inttoptr (i64 0 to %Result*)) call void @__quantum__qis__m__body(%Qubit* inttoptr (i64 1 to %Qubit*), %Result* inttoptr (i64 1 to %Result*)) - call void @__quantum__rt__array_record_output(i64 2, i8* null) - call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 0 to %Result*), i8* null) - call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 1 to %Result*), i8* null) + call void @__quantum__rt__array_record_output(i64 2, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @empty_tag, i64 0, i64 0)) + call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 0 to %Result*), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @0, i64 0, i64 0)) + call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 1 to %Result*), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @1, i64 0, i64 0)) ret i64 0 } @@ -249,15 +260,19 @@ mod base_profile { %Result = type opaque %Qubit = type opaque + @empty_tag = internal constant [1 x i8] c"\00" + @0 = internal constant [6 x i8] c"0_t0r\00" + @1 = internal constant [6 x i8] c"1_t1r\00" + define i64 @ENTRYPOINT__main() #0 { block_0: call void @__quantum__qis__x__body(%Qubit* inttoptr (i64 0 to %Qubit*)) call void @__quantum__qis__x__body(%Qubit* inttoptr (i64 0 to %Qubit*)) call void @__quantum__qis__m__body(%Qubit* inttoptr (i64 1 to %Qubit*), %Result* inttoptr (i64 0 to %Result*)) call void @__quantum__qis__m__body(%Qubit* inttoptr (i64 0 to %Qubit*), %Result* inttoptr (i64 1 to %Result*)) - call void @__quantum__rt__tuple_record_output(i64 2, i8* null) - call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 0 to %Result*), i8* null) - call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 1 to %Result*), i8* null) + call void @__quantum__rt__tuple_record_output(i64 2, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @empty_tag, i64 0, i64 0)) + call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 0 to %Result*), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @0, i64 0, i64 0)) + call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 1 to %Result*), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @1, i64 0, i64 0)) ret i64 0 } @@ -305,15 +320,19 @@ mod base_profile { %Result = type opaque %Qubit = type opaque + @empty_tag = internal constant [1 x i8] c"\00" + @0 = internal constant [6 x i8] c"0_t0r\00" + @1 = internal constant [6 x i8] c"1_t1r\00" + define i64 @ENTRYPOINT__main() #0 { block_0: call void @__quantum__qis__x__body(%Qubit* inttoptr (i64 0 to %Qubit*)) call void @__quantum__qis__x__body(%Qubit* inttoptr (i64 0 to %Qubit*)) call void @__quantum__qis__m__body(%Qubit* inttoptr (i64 3 to %Qubit*), %Result* inttoptr (i64 0 to %Result*)) call void @__quantum__qis__m__body(%Qubit* inttoptr (i64 2 to %Qubit*), %Result* inttoptr (i64 1 to %Result*)) - call void @__quantum__rt__tuple_record_output(i64 2, i8* null) - call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 0 to %Result*), i8* null) - call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 1 to %Result*), i8* null) + call void @__quantum__rt__tuple_record_output(i64 2, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @empty_tag, i64 0, i64 0)) + call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 0 to %Result*), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @0, i64 0, i64 0)) + call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 1 to %Result*), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @1, i64 0, i64 0)) ret i64 0 } @@ -369,13 +388,16 @@ mod adaptive_profile { %Result = type opaque %Qubit = type opaque + @empty_tag = internal constant [1 x i8] c"\00" + @0 = internal constant [4 x i8] c"0_r\00" + define i64 @ENTRYPOINT__main() #0 { block_0: call void @__quantum__qis__rz__body(double 2.0, %Qubit* inttoptr (i64 0 to %Qubit*)) call void @__quantum__qis__rz__body(double 0.0, %Qubit* inttoptr (i64 0 to %Qubit*)) call void @__quantum__qis__rz__body(double 1.0, %Qubit* inttoptr (i64 0 to %Qubit*)) call void @__quantum__qis__m__body(%Qubit* inttoptr (i64 0 to %Qubit*), %Result* inttoptr (i64 0 to %Result*)) - call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 0 to %Result*), i8* null) + call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 0 to %Result*), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @0, i64 0, i64 0)) ret i64 0 } @@ -414,13 +436,17 @@ mod adaptive_profile { %Result = type opaque %Qubit = type opaque + @empty_tag = internal constant [1 x i8] c"\00" + @0 = internal constant [6 x i8] c"0_t0r\00" + @1 = internal constant [6 x i8] c"1_t1r\00" + define i64 @ENTRYPOINT__main() #0 { block_0: call void @__quantum__qis__m__body(%Qubit* inttoptr (i64 0 to %Qubit*), %Result* inttoptr (i64 0 to %Result*)) call void @__quantum__qis__m__body(%Qubit* inttoptr (i64 1 to %Qubit*), %Result* inttoptr (i64 1 to %Result*)) - call void @__quantum__rt__tuple_record_output(i64 2, i8* null) - call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 0 to %Result*), i8* null) - call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 1 to %Result*), i8* null) + call void @__quantum__rt__tuple_record_output(i64 2, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @empty_tag, i64 0, i64 0)) + call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 0 to %Result*), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @0, i64 0, i64 0)) + call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 1 to %Result*), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @1, i64 0, i64 0)) ret i64 0 } @@ -463,11 +489,14 @@ mod adaptive_profile { %Result = type opaque %Qubit = type opaque + @empty_tag = internal constant [1 x i8] c"\00" + @0 = internal constant [4 x i8] c"0_r\00" + define i64 @ENTRYPOINT__main() #0 { block_0: call void @__quantum__qis__h__body(%Qubit* inttoptr (i64 0 to %Qubit*)) call void @__quantum__qis__mx__body(%Qubit* inttoptr (i64 0 to %Qubit*), %Result* inttoptr (i64 0 to %Result*)) - call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 0 to %Result*), i8* null) + call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 0 to %Result*), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @0, i64 0, i64 0)) ret i64 0 } @@ -512,14 +541,18 @@ mod adaptive_profile { %Result = type opaque %Qubit = type opaque + @empty_tag = internal constant [1 x i8] c"\00" + @0 = internal constant [6 x i8] c"0_t0r\00" + @1 = internal constant [6 x i8] c"1_t1r\00" + define i64 @ENTRYPOINT__main() #0 { block_0: call void @__quantum__qis__h__body(%Qubit* inttoptr (i64 0 to %Qubit*)) call void @__quantum__qis__h__body(%Qubit* inttoptr (i64 1 to %Qubit*)) call void @__quantum__qis__mzz__body(%Qubit* inttoptr (i64 0 to %Qubit*), %Qubit* inttoptr (i64 1 to %Qubit*), %Result* inttoptr (i64 0 to %Result*), %Result* inttoptr (i64 1 to %Result*)) - call void @__quantum__rt__tuple_record_output(i64 2, i8* null) - call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 0 to %Result*), i8* null) - call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 1 to %Result*), i8* null) + call void @__quantum__rt__tuple_record_output(i64 2, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @empty_tag, i64 0, i64 0)) + call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 0 to %Result*), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @0, i64 0, i64 0)) + call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 1 to %Result*), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @1, i64 0, i64 0)) ret i64 0 } @@ -563,15 +596,19 @@ mod adaptive_profile { %Result = type opaque %Qubit = type opaque + @empty_tag = internal constant [1 x i8] c"\00" + @0 = internal constant [6 x i8] c"0_a0r\00" + @1 = internal constant [6 x i8] c"1_a1r\00" + define i64 @ENTRYPOINT__main() #0 { block_0: call void @__quantum__qis__x__body(%Qubit* inttoptr (i64 0 to %Qubit*)) call void @__quantum__qis__m__body(%Qubit* inttoptr (i64 0 to %Qubit*), %Result* inttoptr (i64 0 to %Result*)) call void @__quantum__qis__x__body(%Qubit* inttoptr (i64 1 to %Qubit*)) call void @__quantum__qis__m__body(%Qubit* inttoptr (i64 1 to %Qubit*), %Result* inttoptr (i64 1 to %Result*)) - call void @__quantum__rt__array_record_output(i64 2, i8* null) - call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 0 to %Result*), i8* null) - call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 1 to %Result*), i8* null) + call void @__quantum__rt__array_record_output(i64 2, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @empty_tag, i64 0, i64 0)) + call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 0 to %Result*), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @0, i64 0, i64 0)) + call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 1 to %Result*), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @1, i64 0, i64 0)) ret i64 0 } @@ -633,13 +670,16 @@ mod adaptive_ri_profile { %Result = type opaque %Qubit = type opaque + @empty_tag = internal constant [1 x i8] c"\00" + @0 = internal constant [4 x i8] c"0_r\00" + define i64 @ENTRYPOINT__main() #0 { block_0: call void @__quantum__qis__rz__body(double 2.0, %Qubit* inttoptr (i64 0 to %Qubit*)) call void @__quantum__qis__rz__body(double 0.0, %Qubit* inttoptr (i64 0 to %Qubit*)) call void @__quantum__qis__rz__body(double 1.0, %Qubit* inttoptr (i64 0 to %Qubit*)) call void @__quantum__qis__mresetz__body(%Qubit* inttoptr (i64 0 to %Qubit*), %Result* inttoptr (i64 0 to %Result*)) - call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 0 to %Result*), i8* null) + call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 0 to %Result*), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @0, i64 0, i64 0)) ret i64 0 } @@ -679,13 +719,17 @@ mod adaptive_ri_profile { %Result = type opaque %Qubit = type opaque + @empty_tag = internal constant [1 x i8] c"\00" + @0 = internal constant [6 x i8] c"0_t0r\00" + @1 = internal constant [6 x i8] c"1_t1r\00" + define i64 @ENTRYPOINT__main() #0 { block_0: call void @__quantum__qis__mresetz__body(%Qubit* inttoptr (i64 0 to %Qubit*), %Result* inttoptr (i64 0 to %Result*)) call void @__quantum__qis__mresetz__body(%Qubit* inttoptr (i64 0 to %Qubit*), %Result* inttoptr (i64 1 to %Result*)) - call void @__quantum__rt__tuple_record_output(i64 2, i8* null) - call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 0 to %Result*), i8* null) - call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 1 to %Result*), i8* null) + call void @__quantum__rt__tuple_record_output(i64 2, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @empty_tag, i64 0, i64 0)) + call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 0 to %Result*), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @0, i64 0, i64 0)) + call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 1 to %Result*), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @1, i64 0, i64 0)) ret i64 0 } @@ -728,15 +772,19 @@ mod adaptive_ri_profile { %Result = type opaque %Qubit = type opaque + @empty_tag = internal constant [1 x i8] c"\00" + @0 = internal constant [6 x i8] c"0_a0r\00" + @1 = internal constant [6 x i8] c"1_a1r\00" + define i64 @ENTRYPOINT__main() #0 { block_0: call void @__quantum__qis__x__body(%Qubit* inttoptr (i64 0 to %Qubit*)) call void @__quantum__qis__mresetz__body(%Qubit* inttoptr (i64 0 to %Qubit*), %Result* inttoptr (i64 0 to %Result*)) call void @__quantum__qis__x__body(%Qubit* inttoptr (i64 1 to %Qubit*)) call void @__quantum__qis__mresetz__body(%Qubit* inttoptr (i64 1 to %Qubit*), %Result* inttoptr (i64 1 to %Result*)) - call void @__quantum__rt__array_record_output(i64 2, i8* null) - call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 0 to %Result*), i8* null) - call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 1 to %Result*), i8* null) + call void @__quantum__rt__array_record_output(i64 2, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @empty_tag, i64 0, i64 0)) + call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 0 to %Result*), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @0, i64 0, i64 0)) + call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 1 to %Result*), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @1, i64 0, i64 0)) ret i64 0 } @@ -780,15 +828,19 @@ mod adaptive_ri_profile { %Result = type opaque %Qubit = type opaque + @empty_tag = internal constant [1 x i8] c"\00" + @0 = internal constant [6 x i8] c"0_t0r\00" + @1 = internal constant [6 x i8] c"1_t1r\00" + define i64 @ENTRYPOINT__main() #0 { block_0: call void @__quantum__qis__x__body(%Qubit* inttoptr (i64 0 to %Qubit*)) call void @__quantum__qis__x__body(%Qubit* inttoptr (i64 0 to %Qubit*)) call void @__quantum__qis__mresetz__body(%Qubit* inttoptr (i64 1 to %Qubit*), %Result* inttoptr (i64 0 to %Result*)) call void @__quantum__qis__mresetz__body(%Qubit* inttoptr (i64 0 to %Qubit*), %Result* inttoptr (i64 1 to %Result*)) - call void @__quantum__rt__tuple_record_output(i64 2, i8* null) - call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 0 to %Result*), i8* null) - call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 1 to %Result*), i8* null) + call void @__quantum__rt__tuple_record_output(i64 2, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @empty_tag, i64 0, i64 0)) + call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 0 to %Result*), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @0, i64 0, i64 0)) + call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 1 to %Result*), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @1, i64 0, i64 0)) ret i64 0 } @@ -837,6 +889,10 @@ mod adaptive_ri_profile { %Result = type opaque %Qubit = type opaque + @empty_tag = internal constant [1 x i8] c"\00" + @0 = internal constant [6 x i8] c"0_t0r\00" + @1 = internal constant [6 x i8] c"1_t1r\00" + define i64 @ENTRYPOINT__main() #0 { block_0: call void @__quantum__qis__x__body(%Qubit* inttoptr (i64 0 to %Qubit*)) @@ -845,9 +901,9 @@ mod adaptive_ri_profile { call void @__quantum__qis__reset__body(%Qubit* inttoptr (i64 0 to %Qubit*)) call void @__quantum__qis__mresetz__body(%Qubit* inttoptr (i64 0 to %Qubit*), %Result* inttoptr (i64 0 to %Result*)) call void @__quantum__qis__mresetz__body(%Qubit* inttoptr (i64 1 to %Qubit*), %Result* inttoptr (i64 1 to %Result*)) - call void @__quantum__rt__tuple_record_output(i64 2, i8* null) - call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 0 to %Result*), i8* null) - call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 1 to %Result*), i8* null) + call void @__quantum__rt__tuple_record_output(i64 2, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @empty_tag, i64 0, i64 0)) + call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 0 to %Result*), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @0, i64 0, i64 0)) + call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 1 to %Result*), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @1, i64 0, i64 0)) ret i64 0 } @@ -899,6 +955,10 @@ mod adaptive_ri_profile { %Result = type opaque %Qubit = type opaque + @empty_tag = internal constant [1 x i8] c"\00" + @0 = internal constant [6 x i8] c"0_t0r\00" + @1 = internal constant [6 x i8] c"1_t1r\00" + define i64 @ENTRYPOINT__main() #0 { block_0: call void @__quantum__qis__x__body(%Qubit* inttoptr (i64 0 to %Qubit*)) @@ -907,9 +967,9 @@ mod adaptive_ri_profile { call void @__quantum__qis__x__body(%Qubit* inttoptr (i64 1 to %Qubit*)) call void @__quantum__qis__mresetz__body(%Qubit* inttoptr (i64 1 to %Qubit*), %Result* inttoptr (i64 0 to %Result*)) call void @__quantum__qis__mresetz__body(%Qubit* inttoptr (i64 0 to %Qubit*), %Result* inttoptr (i64 1 to %Result*)) - call void @__quantum__rt__tuple_record_output(i64 2, i8* null) - call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 0 to %Result*), i8* null) - call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 1 to %Result*), i8* null) + call void @__quantum__rt__tuple_record_output(i64 2, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @empty_tag, i64 0, i64 0)) + call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 0 to %Result*), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @0, i64 0, i64 0)) + call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 1 to %Result*), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @1, i64 0, i64 0)) ret i64 0 } @@ -951,6 +1011,9 @@ mod adaptive_ri_profile { %Result = type opaque %Qubit = type opaque + @empty_tag = internal constant [1 x i8] c"\00" + @0 = internal constant [4 x i8] c"0_i\00" + define i64 @ENTRYPOINT__main() #0 { block_0: call void @__quantum__qis__h__body(%Qubit* inttoptr (i64 0 to %Qubit*)) @@ -964,7 +1027,7 @@ mod adaptive_ri_profile { br label %block_3 block_3: %var_4 = phi i64 [0, %block_1], [1, %block_2] - call void @__quantum__rt__int_record_output(i64 %var_4, i8* null) + call void @__quantum__rt__int_record_output(i64 %var_4, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @0, i64 0, i64 0)) ret i64 0 } @@ -1010,11 +1073,14 @@ mod adaptive_ri_profile { %Result = type opaque %Qubit = type opaque + @empty_tag = internal constant [1 x i8] c"\00" + @0 = internal constant [4 x i8] c"0_r\00" + define i64 @ENTRYPOINT__main() #0 { block_0: call void @__quantum__qis__custom_reset__body(%Qubit* inttoptr (i64 0 to %Qubit*)) call void @__quantum__qis__m__body(%Qubit* inttoptr (i64 0 to %Qubit*), %Result* inttoptr (i64 0 to %Result*)) - call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 0 to %Result*), i8* null) + call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 0 to %Result*), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @0, i64 0, i64 0)) ret i64 0 } @@ -1075,13 +1141,16 @@ mod adaptive_rif_profile { %Result = type opaque %Qubit = type opaque + @empty_tag = internal constant [1 x i8] c"\00" + @0 = internal constant [4 x i8] c"0_r\00" + define i64 @ENTRYPOINT__main() #0 { block_0: call void @__quantum__qis__rz__body(double 2.0, %Qubit* inttoptr (i64 0 to %Qubit*)) call void @__quantum__qis__rz__body(double 0.0, %Qubit* inttoptr (i64 0 to %Qubit*)) call void @__quantum__qis__rz__body(double 1.0, %Qubit* inttoptr (i64 0 to %Qubit*)) call void @__quantum__qis__mresetz__body(%Qubit* inttoptr (i64 0 to %Qubit*), %Result* inttoptr (i64 0 to %Result*)) - call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 0 to %Result*), i8* null) + call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 0 to %Result*), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @0, i64 0, i64 0)) ret i64 0 } @@ -1122,13 +1191,17 @@ mod adaptive_rif_profile { %Result = type opaque %Qubit = type opaque + @empty_tag = internal constant [1 x i8] c"\00" + @0 = internal constant [6 x i8] c"0_t0r\00" + @1 = internal constant [6 x i8] c"1_t1r\00" + define i64 @ENTRYPOINT__main() #0 { block_0: call void @__quantum__qis__mresetz__body(%Qubit* inttoptr (i64 0 to %Qubit*), %Result* inttoptr (i64 0 to %Result*)) call void @__quantum__qis__mresetz__body(%Qubit* inttoptr (i64 0 to %Qubit*), %Result* inttoptr (i64 1 to %Result*)) - call void @__quantum__rt__tuple_record_output(i64 2, i8* null) - call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 0 to %Result*), i8* null) - call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 1 to %Result*), i8* null) + call void @__quantum__rt__tuple_record_output(i64 2, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @empty_tag, i64 0, i64 0)) + call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 0 to %Result*), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @0, i64 0, i64 0)) + call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 1 to %Result*), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @1, i64 0, i64 0)) ret i64 0 } @@ -1172,15 +1245,19 @@ mod adaptive_rif_profile { %Result = type opaque %Qubit = type opaque + @empty_tag = internal constant [1 x i8] c"\00" + @0 = internal constant [6 x i8] c"0_a0r\00" + @1 = internal constant [6 x i8] c"1_a1r\00" + define i64 @ENTRYPOINT__main() #0 { block_0: call void @__quantum__qis__x__body(%Qubit* inttoptr (i64 0 to %Qubit*)) call void @__quantum__qis__mresetz__body(%Qubit* inttoptr (i64 0 to %Qubit*), %Result* inttoptr (i64 0 to %Result*)) call void @__quantum__qis__x__body(%Qubit* inttoptr (i64 1 to %Qubit*)) call void @__quantum__qis__mresetz__body(%Qubit* inttoptr (i64 1 to %Qubit*), %Result* inttoptr (i64 1 to %Result*)) - call void @__quantum__rt__array_record_output(i64 2, i8* null) - call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 0 to %Result*), i8* null) - call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 1 to %Result*), i8* null) + call void @__quantum__rt__array_record_output(i64 2, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @empty_tag, i64 0, i64 0)) + call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 0 to %Result*), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @0, i64 0, i64 0)) + call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 1 to %Result*), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @1, i64 0, i64 0)) ret i64 0 } @@ -1225,15 +1302,19 @@ mod adaptive_rif_profile { %Result = type opaque %Qubit = type opaque + @empty_tag = internal constant [1 x i8] c"\00" + @0 = internal constant [6 x i8] c"0_t0r\00" + @1 = internal constant [6 x i8] c"1_t1r\00" + define i64 @ENTRYPOINT__main() #0 { block_0: call void @__quantum__qis__x__body(%Qubit* inttoptr (i64 0 to %Qubit*)) call void @__quantum__qis__x__body(%Qubit* inttoptr (i64 0 to %Qubit*)) call void @__quantum__qis__mresetz__body(%Qubit* inttoptr (i64 1 to %Qubit*), %Result* inttoptr (i64 0 to %Result*)) call void @__quantum__qis__mresetz__body(%Qubit* inttoptr (i64 0 to %Qubit*), %Result* inttoptr (i64 1 to %Result*)) - call void @__quantum__rt__tuple_record_output(i64 2, i8* null) - call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 0 to %Result*), i8* null) - call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 1 to %Result*), i8* null) + call void @__quantum__rt__tuple_record_output(i64 2, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @empty_tag, i64 0, i64 0)) + call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 0 to %Result*), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @0, i64 0, i64 0)) + call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 1 to %Result*), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @1, i64 0, i64 0)) ret i64 0 } @@ -1283,6 +1364,10 @@ mod adaptive_rif_profile { %Result = type opaque %Qubit = type opaque + @empty_tag = internal constant [1 x i8] c"\00" + @0 = internal constant [6 x i8] c"0_t0r\00" + @1 = internal constant [6 x i8] c"1_t1r\00" + define i64 @ENTRYPOINT__main() #0 { block_0: call void @__quantum__qis__x__body(%Qubit* inttoptr (i64 0 to %Qubit*)) @@ -1291,9 +1376,9 @@ mod adaptive_rif_profile { call void @__quantum__qis__reset__body(%Qubit* inttoptr (i64 0 to %Qubit*)) call void @__quantum__qis__mresetz__body(%Qubit* inttoptr (i64 0 to %Qubit*), %Result* inttoptr (i64 0 to %Result*)) call void @__quantum__qis__mresetz__body(%Qubit* inttoptr (i64 1 to %Qubit*), %Result* inttoptr (i64 1 to %Result*)) - call void @__quantum__rt__tuple_record_output(i64 2, i8* null) - call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 0 to %Result*), i8* null) - call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 1 to %Result*), i8* null) + call void @__quantum__rt__tuple_record_output(i64 2, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @empty_tag, i64 0, i64 0)) + call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 0 to %Result*), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @0, i64 0, i64 0)) + call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 1 to %Result*), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @1, i64 0, i64 0)) ret i64 0 } @@ -1346,6 +1431,10 @@ mod adaptive_rif_profile { %Result = type opaque %Qubit = type opaque + @empty_tag = internal constant [1 x i8] c"\00" + @0 = internal constant [6 x i8] c"0_t0r\00" + @1 = internal constant [6 x i8] c"1_t1r\00" + define i64 @ENTRYPOINT__main() #0 { block_0: call void @__quantum__qis__x__body(%Qubit* inttoptr (i64 0 to %Qubit*)) @@ -1354,9 +1443,9 @@ mod adaptive_rif_profile { call void @__quantum__qis__x__body(%Qubit* inttoptr (i64 1 to %Qubit*)) call void @__quantum__qis__mresetz__body(%Qubit* inttoptr (i64 1 to %Qubit*), %Result* inttoptr (i64 0 to %Result*)) call void @__quantum__qis__mresetz__body(%Qubit* inttoptr (i64 0 to %Qubit*), %Result* inttoptr (i64 1 to %Result*)) - call void @__quantum__rt__tuple_record_output(i64 2, i8* null) - call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 0 to %Result*), i8* null) - call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 1 to %Result*), i8* null) + call void @__quantum__rt__tuple_record_output(i64 2, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @empty_tag, i64 0, i64 0)) + call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 0 to %Result*), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @0, i64 0, i64 0)) + call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 1 to %Result*), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @1, i64 0, i64 0)) ret i64 0 } @@ -1399,6 +1488,9 @@ mod adaptive_rif_profile { %Result = type opaque %Qubit = type opaque + @empty_tag = internal constant [1 x i8] c"\00" + @0 = internal constant [4 x i8] c"0_i\00" + define i64 @ENTRYPOINT__main() #0 { block_0: call void @__quantum__qis__h__body(%Qubit* inttoptr (i64 0 to %Qubit*)) @@ -1412,7 +1504,7 @@ mod adaptive_rif_profile { br label %block_3 block_3: %var_4 = phi i64 [0, %block_1], [1, %block_2] - call void @__quantum__rt__int_record_output(i64 %var_4, i8* null) + call void @__quantum__rt__int_record_output(i64 %var_4, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @0, i64 0, i64 0)) ret i64 0 } @@ -1455,6 +1547,9 @@ mod adaptive_rif_profile { %Result = type opaque %Qubit = type opaque + @empty_tag = internal constant [1 x i8] c"\00" + @0 = internal constant [4 x i8] c"0_d\00" + define i64 @ENTRYPOINT__main() #0 { block_0: call void @__quantum__qis__h__body(%Qubit* inttoptr (i64 0 to %Qubit*)) @@ -1468,7 +1563,7 @@ mod adaptive_rif_profile { br label %block_3 block_3: %var_4 = phi double [0.0, %block_1], [1.0, %block_2] - call void @__quantum__rt__double_record_output(double %var_4, i8* null) + call void @__quantum__rt__double_record_output(double %var_4, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @0, i64 0, i64 0)) ret i64 0 } @@ -1515,11 +1610,14 @@ mod adaptive_rif_profile { %Result = type opaque %Qubit = type opaque + @empty_tag = internal constant [1 x i8] c"\00" + @0 = internal constant [4 x i8] c"0_r\00" + define i64 @ENTRYPOINT__main() #0 { block_0: call void @__quantum__qis__custom_reset__body(%Qubit* inttoptr (i64 0 to %Qubit*)) call void @__quantum__qis__m__body(%Qubit* inttoptr (i64 0 to %Qubit*), %Result* inttoptr (i64 0 to %Result*)) - call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 0 to %Result*), i8* null) + call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 0 to %Result*), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @0, i64 0, i64 0)) ret i64 0 } @@ -1569,6 +1667,9 @@ mod adaptive_rif_profile { %Result = type opaque %Qubit = type opaque + @empty_tag = internal constant [1 x i8] c"\00" + @0 = internal constant [4 x i8] c"0_d\00" + define i64 @ENTRYPOINT__main() #0 { block_0: call void @__quantum__qis__h__body(%Qubit* inttoptr (i64 0 to %Qubit*)) @@ -1592,7 +1693,7 @@ mod adaptive_rif_profile { call void @__quantum__qis__rz__body(double %var_7, %Qubit* inttoptr (i64 0 to %Qubit*)) call void @OpA(double %var_9, %Qubit* inttoptr (i64 0 to %Qubit*)) call void @__quantum__qis__rx__body(double %var_9, %Qubit* inttoptr (i64 0 to %Qubit*)) - call void @__quantum__rt__double_record_output(double %var_9, i8* null) + call void @__quantum__rt__double_record_output(double %var_9, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @0, i64 0, i64 0)) ret i64 0 } diff --git a/source/compiler/qsc/src/interpret/tests.rs b/source/compiler/qsc/src/interpret/tests.rs index 8112773088..b0a0044494 100644 --- a/source/compiler/qsc/src/interpret/tests.rs +++ b/source/compiler/qsc/src/interpret/tests.rs @@ -914,11 +914,14 @@ mod given_interpreter { %Result = type opaque %Qubit = type opaque + @empty_tag = internal constant [1 x i8] c"\00" + @0 = internal constant [4 x i8] c"0_r\00" + define i64 @ENTRYPOINT__main() #0 { block_0: call void @__quantum__qis__cx__body(%Qubit* inttoptr (i64 0 to %Qubit*), %Qubit* inttoptr (i64 1 to %Qubit*)) call void @__quantum__qis__m__body(%Qubit* inttoptr (i64 0 to %Qubit*), %Result* inttoptr (i64 0 to %Result*)) - call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 0 to %Result*), i8* null) + call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 0 to %Result*), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @0, i64 0, i64 0)) ret i64 0 } @@ -975,13 +978,16 @@ mod given_interpreter { %Result = type opaque %Qubit = type opaque + @empty_tag = internal constant [1 x i8] c"\00" + @0 = internal constant [4 x i8] c"0_r\00" + define i64 @ENTRYPOINT__main() #0 { block_0: call void @__quantum__qis__rz__body(double 2.0, %Qubit* inttoptr (i64 0 to %Qubit*)) call void @__quantum__qis__rz__body(double 0.0, %Qubit* inttoptr (i64 0 to %Qubit*)) call void @__quantum__qis__rz__body(double 1.0, %Qubit* inttoptr (i64 0 to %Qubit*)) call void @__quantum__qis__mresetz__body(%Qubit* inttoptr (i64 0 to %Qubit*), %Result* inttoptr (i64 0 to %Result*)) - call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 0 to %Result*), i8* null) + call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 0 to %Result*), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @0, i64 0, i64 0)) ret i64 0 } @@ -1032,17 +1038,22 @@ mod given_interpreter { %Result = type opaque %Qubit = type opaque + @empty_tag = internal constant [1 x i8] c"\00" + @0 = internal constant [6 x i8] c"0_t0r\00" + @1 = internal constant [8 x i8] c"1_t1t0b\00" + @2 = internal constant [8 x i8] c"2_t1t1b\00" + define i64 @ENTRYPOINT__main() #0 { block_0: call void @__quantum__qis__mresetz__body(%Qubit* inttoptr (i64 0 to %Qubit*), %Result* inttoptr (i64 0 to %Result*)) %var_0 = call i1 @__quantum__qis__read_result__body(%Result* inttoptr (i64 0 to %Result*)) %var_2 = call i1 @__quantum__qis__read_result__body(%Result* inttoptr (i64 0 to %Result*)) %var_3 = icmp eq i1 %var_2, false - call void @__quantum__rt__tuple_record_output(i64 2, i8* null) - call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 0 to %Result*), i8* null) - call void @__quantum__rt__tuple_record_output(i64 2, i8* null) - call void @__quantum__rt__bool_record_output(i1 %var_0, i8* null) - call void @__quantum__rt__bool_record_output(i1 %var_3, i8* null) + call void @__quantum__rt__tuple_record_output(i64 2, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @empty_tag, i64 0, i64 0)) + call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 0 to %Result*), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @0, i64 0, i64 0)) + call void @__quantum__rt__tuple_record_output(i64 2, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @empty_tag, i64 0, i64 0)) + call void @__quantum__rt__bool_record_output(i1 %var_0, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @1, i64 0, i64 0)) + call void @__quantum__rt__bool_record_output(i1 %var_3, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @2, i64 0, i64 0)) ret i64 0 } @@ -1109,11 +1120,14 @@ mod given_interpreter { %Result = type opaque %Qubit = type opaque + @empty_tag = internal constant [1 x i8] c"\00" + @0 = internal constant [4 x i8] c"0_r\00" + define i64 @ENTRYPOINT__main() #0 { block_0: call void @__quantum__qis__cx__body(%Qubit* inttoptr (i64 0 to %Qubit*), %Qubit* inttoptr (i64 1 to %Qubit*)) call void @__quantum__qis__m__body(%Qubit* inttoptr (i64 0 to %Qubit*), %Result* inttoptr (i64 0 to %Result*)) - call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 0 to %Result*), i8* null) + call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 0 to %Result*), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @0, i64 0, i64 0)) ret i64 0 } @@ -1153,11 +1167,14 @@ mod given_interpreter { %Result = type opaque %Qubit = type opaque + @empty_tag = internal constant [1 x i8] c"\00" + @0 = internal constant [4 x i8] c"0_r\00" + define i64 @ENTRYPOINT__main() #0 { block_0: call void @__quantum__qis__cx__body(%Qubit* inttoptr (i64 0 to %Qubit*), %Qubit* inttoptr (i64 1 to %Qubit*)) call void @__quantum__qis__m__body(%Qubit* inttoptr (i64 0 to %Qubit*), %Result* inttoptr (i64 0 to %Result*)) - call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 0 to %Result*), i8* null) + call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 0 to %Result*), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @0, i64 0, i64 0)) ret i64 0 } @@ -1229,11 +1246,14 @@ mod given_interpreter { %Result = type opaque %Qubit = type opaque + @empty_tag = internal constant [1 x i8] c"\00" + @0 = internal constant [4 x i8] c"0_r\00" + define i64 @ENTRYPOINT__main() #0 { block_0: call void @__quantum__qis__cx__body(%Qubit* inttoptr (i64 0 to %Qubit*), %Qubit* inttoptr (i64 1 to %Qubit*)) call void @__quantum__qis__m__body(%Qubit* inttoptr (i64 0 to %Qubit*), %Result* inttoptr (i64 0 to %Result*)) - call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 0 to %Result*), i8* null) + call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 0 to %Result*), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @0, i64 0, i64 0)) ret i64 0 } @@ -1285,11 +1305,14 @@ mod given_interpreter { %Result = type opaque %Qubit = type opaque + @empty_tag = internal constant [1 x i8] c"\00" + @0 = internal constant [4 x i8] c"0_r\00" + define i64 @ENTRYPOINT__main() #0 { block_0: call void @__quantum__qis__cx__body(%Qubit* inttoptr (i64 0 to %Qubit*), %Qubit* inttoptr (i64 1 to %Qubit*)) call void @__quantum__qis__m__body(%Qubit* inttoptr (i64 0 to %Qubit*), %Result* inttoptr (i64 0 to %Result*)) - call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 0 to %Result*), i8* null) + call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 0 to %Result*), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @0, i64 0, i64 0)) ret i64 0 } @@ -1340,11 +1363,14 @@ mod given_interpreter { %Result = type opaque %Qubit = type opaque + @empty_tag = internal constant [1 x i8] c"\00" + @0 = internal constant [4 x i8] c"0_b\00" + define i64 @ENTRYPOINT__main() #0 { block_0: call void @__quantum__qis__mresetz__body(%Qubit* inttoptr (i64 0 to %Qubit*), %Result* inttoptr (i64 0 to %Result*)) %var_0 = call i1 @check_result(%Result* inttoptr (i64 0 to %Result*)) - call void @__quantum__rt__bool_record_output(i1 %var_0, i8* null) + call void @__quantum__rt__bool_record_output(i1 %var_0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @0, i64 0, i64 0)) ret i64 0 } diff --git a/source/compiler/qsc_codegen/src/qir.rs b/source/compiler/qsc_codegen/src/qir.rs index 2118dee9e5..33452baffb 100644 --- a/source/compiler/qsc_codegen/src/qir.rs +++ b/source/compiler/qsc_codegen/src/qir.rs @@ -120,6 +120,16 @@ impl ToQir for rir::Literal { rir::Literal::Pointer => "i8* null".to_string(), rir::Literal::Qubit(q) => format!("%Qubit* inttoptr (i64 {q} to %Qubit*)"), rir::Literal::Result(r) => format!("%Result* inttoptr (i64 {r} to %Result*)"), + rir::Literal::Tag(idx, len) => { + let len = len + 1; // +1 for the null terminator + format!( + "i8* getelementptr inbounds ([{len} x i8], [{len} x i8]* @{idx}, i64 0, i64 0)" + ) + } + rir::Literal::EmptyTag => { + "i8* getelementptr inbounds ([1 x i8], [1 x i8]* @empty_tag, i64 0, i64 0)" + .to_string() + } } } } @@ -571,6 +581,9 @@ fn get_value_as_str(value: &rir::Operand, program: &rir::Program) -> String { rir::Literal::Pointer => "null".to_string(), rir::Literal::Qubit(q) => format!("{q}"), rir::Literal::Result(r) => format!("{r}"), + rir::Literal::Tag(..) | rir::Literal::EmptyTag => panic!( + "tag literals should not be used as string values outside of output recording" + ), }, rir::Operand::Variable(var) => ToQir::::to_qir(&var.variable_id, program), } @@ -584,7 +597,7 @@ fn get_value_ty(lhs: &rir::Operand) -> &str { rir::Literal::Double(_) => get_f64_ty(), rir::Literal::Qubit(_) => "%Qubit*", rir::Literal::Result(_) => "%Result*", - rir::Literal::Pointer => "i8*", + rir::Literal::Pointer | rir::Literal::Tag(..) | rir::Literal::EmptyTag => "i8*", }, rir::Operand::Variable(var) => get_variable_ty(*var), } @@ -690,9 +703,19 @@ impl ToQir for rir::Program { } else { "adaptive_profile" }; + let mut constants = String::default(); + for (idx, tag) in self.tags.iter().enumerate() { + // We need to add the tag as a global constant. + writeln!( + constants, + "@{idx} = internal constant [{} x i8] c\"{tag}\\00\"", + tag.len() + 1 + ) + .expect("writing to string should succeed"); + } let body = format!( include_str!("./qir/template.ll"), - callables, profile, self.num_qubits, self.num_results + constants, callables, profile, self.num_qubits, self.num_results ); let flags = get_module_metadata(self); body + "\n" + &flags diff --git a/source/compiler/qsc_codegen/src/qir/template.ll b/source/compiler/qsc_codegen/src/qir/template.ll index b58560a733..bd9ea37c51 100644 --- a/source/compiler/qsc_codegen/src/qir/template.ll +++ b/source/compiler/qsc_codegen/src/qir/template.ll @@ -1,6 +1,8 @@ %Result = type opaque %Qubit = type opaque +@empty_tag = internal constant [1 x i8] c"\00" +{} {} attributes #0 = {{ "entry_point" "output_labeling_schema" "qir_profiles"="{}" "required_num_qubits"="{}" "required_num_results"="{}" }} diff --git a/source/compiler/qsc_codegen/src/qir/tests.rs b/source/compiler/qsc_codegen/src/qir/tests.rs index 072d13a604..d0e51afd30 100644 --- a/source/compiler/qsc_codegen/src/qir/tests.rs +++ b/source/compiler/qsc_codegen/src/qir/tests.rs @@ -131,6 +131,11 @@ fn bell_program() { %Result = type opaque %Qubit = type opaque + @empty_tag = internal constant [1 x i8] c"\00" + @0 = internal constant [4 x i8] c"0_a\00" + @1 = internal constant [6 x i8] c"1_a0r\00" + @2 = internal constant [6 x i8] c"2_a1r\00" + declare void @__quantum__qis__h__body(%Qubit*) declare void @__quantum__qis__cx__body(%Qubit*, %Qubit*) @@ -147,9 +152,9 @@ fn bell_program() { call void @__quantum__qis__cx__body(%Qubit* inttoptr (i64 0 to %Qubit*), %Qubit* inttoptr (i64 1 to %Qubit*)) call void @__quantum__qis__m__body(%Qubit* inttoptr (i64 0 to %Qubit*), %Result* inttoptr (i64 0 to %Result*)) call void @__quantum__qis__m__body(%Qubit* inttoptr (i64 1 to %Qubit*), %Result* inttoptr (i64 1 to %Result*)) - call void @__quantum__rt__array_record_output(i64 2, i8* null) - call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 0 to %Result*), i8* null) - call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 1 to %Result*), i8* null) + call void @__quantum__rt__array_record_output(i64 2, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @0, i64 0, i64 0)) + call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 0 to %Result*), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @1, i64 0, i64 0)) + call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 1 to %Result*), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @2, i64 0, i64 0)) ret i64 0 } @@ -174,6 +179,9 @@ fn teleport_program() { %Result = type opaque %Qubit = type opaque + @empty_tag = internal constant [1 x i8] c"\00" + @0 = internal constant [4 x i8] c"0_r\00" + declare void @__quantum__qis__h__body(%Qubit*) declare void @__quantum__qis__z__body(%Qubit*) @@ -210,7 +218,7 @@ fn teleport_program() { br label %block_4 block_4: call void @__quantum__qis__mresetz__body(%Qubit* inttoptr (i64 1 to %Qubit*), %Result* inttoptr (i64 2 to %Result*)) - call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 2 to %Result*), i8* null) + call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 2 to %Result*), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @0, i64 0, i64 0)) ret i64 0 } diff --git a/source/compiler/qsc_partial_eval/src/lib.rs b/source/compiler/qsc_partial_eval/src/lib.rs index 192ad84b5f..35304668a4 100644 --- a/source/compiler/qsc_partial_eval/src/lib.rs +++ b/source/compiler/qsc_partial_eval/src/lib.rs @@ -412,7 +412,7 @@ impl<'a> PartialEvaluator<'a> { output_span: PackageSpan, ) -> Result { let output_recording: Vec = self - .generate_output_recording_instructions(ret_val, output_ty) + .generate_output_recording_instructions(ret_val, output_ty, "") .map_err(|()| Error::OutputResultLiteral(output_span))?; // Insert the return expression and return the generated program. @@ -3088,19 +3088,20 @@ impl<'a> PartialEvaluator<'a> { &mut self, ret_val: Value, ty: &Ty, + tag_root: &str, ) -> Result, ()> { let mut instrs = Vec::new(); match ret_val { Value::Result(val::Result::Val(_)) => return Err(()), - Value::Array(vals) => self.record_array(ty, &mut instrs, &vals)?, - Value::Tuple(vals) => self.record_tuple(ty, &mut instrs, &vals)?, - Value::Result(res) => self.record_result(&mut instrs, res), - Value::Var(var) => self.record_variable(ty, &mut instrs, var), - Value::Bool(val) => self.record_bool(&mut instrs, val), - Value::Int(val) => self.record_int(&mut instrs, val), - Value::Double(val) => self.record_double(&mut instrs, val), + Value::Array(vals) => self.record_array(ty, &mut instrs, &vals, tag_root)?, + Value::Tuple(vals) => self.record_tuple(ty, &mut instrs, &vals, tag_root)?, + Value::Result(res) => self.record_result(&mut instrs, res, tag_root), + Value::Var(var) => self.record_variable(ty, &mut instrs, var, tag_root), + Value::Bool(val) => self.record_bool(&mut instrs, val, tag_root), + Value::Int(val) => self.record_int(&mut instrs, val, tag_root), + Value::Double(val) => self.record_double(&mut instrs, val, tag_root), Value::BigInt(_) | Value::Closure(_) @@ -3114,61 +3115,87 @@ impl<'a> PartialEvaluator<'a> { Ok(instrs) } - fn record_int(&mut self, instrs: &mut Vec, val: i64) { + fn record_int(&mut self, instrs: &mut Vec, val: i64, tag_root: &str) { + let idx = self.program.tags.len(); + let tag = format!("{idx}_{tag_root}i"); + let len = tag.len(); + self.program.tags.push(tag); let int_record_callable_id = self.get_int_record_callable(); instrs.push(Instruction::Call( int_record_callable_id, vec![ Operand::Literal(Literal::Integer(val)), - Operand::Literal(Literal::Pointer), + Operand::Literal(Literal::Tag(idx, len)), ], None, )); } - fn record_double(&mut self, instrs: &mut Vec, val: f64) { + fn record_double(&mut self, instrs: &mut Vec, val: f64, tag_root: &str) { + let idx = self.program.tags.len(); + let tag = format!("{idx}_{tag_root}d"); + let len = tag.len(); + self.program.tags.push(tag); let double_record_callable_id = self.get_double_record_callable(); instrs.push(Instruction::Call( double_record_callable_id, vec![ Operand::Literal(Literal::Double(val)), - Operand::Literal(Literal::Pointer), + Operand::Literal(Literal::Tag(idx, len)), ], None, )); } - fn record_bool(&mut self, instrs: &mut Vec, val: bool) { + fn record_bool(&mut self, instrs: &mut Vec, val: bool, tag_root: &str) { + let idx = self.program.tags.len(); + let tag = format!("{idx}_{tag_root}b"); + let len = tag.len(); + self.program.tags.push(tag); let bool_record_callable_id = self.get_bool_record_callable(); instrs.push(Instruction::Call( bool_record_callable_id, vec![ Operand::Literal(Literal::Bool(val)), - Operand::Literal(Literal::Pointer), + Operand::Literal(Literal::Tag(idx, len)), ], None, )); } - fn record_variable(&mut self, ty: &Ty, instrs: &mut Vec, var: Var) { - let record_callable_id = match ty { - Ty::Prim(Prim::Bool) => self.get_bool_record_callable(), - Ty::Prim(Prim::Int) => self.get_int_record_callable(), - Ty::Prim(Prim::Double) => self.get_double_record_callable(), + fn record_variable( + &mut self, + ty: &Ty, + instrs: &mut Vec, + var: Var, + tag_root: &str, + ) { + let idx = self.program.tags.len(); + let (record_callable_id, tag_ty) = match ty { + Ty::Prim(Prim::Bool) => (self.get_bool_record_callable(), "b"), + Ty::Prim(Prim::Int) => (self.get_int_record_callable(), "i"), + Ty::Prim(Prim::Double) => (self.get_double_record_callable(), "d"), _ => panic!("unsupported variable type in output recording"), }; + let tag = format!("{idx}_{tag_root}{tag_ty}"); + let len = tag.len(); + self.program.tags.push(tag); instrs.push(Instruction::Call( record_callable_id, vec![ Operand::Variable(map_eval_var_to_rir_var(var)), - Operand::Literal(Literal::Pointer), + Operand::Literal(Literal::Tag(idx, len)), ], None, )); } - fn record_result(&mut self, instrs: &mut Vec, res: val::Result) { + fn record_result(&mut self, instrs: &mut Vec, res: val::Result, tag_root: &str) { + let idx = self.program.tags.len(); let result_record_callable_id = self.get_result_record_callable(); + let tag = format!("{idx}_{tag_root}r"); + let len = tag.len(); + self.program.tags.push(tag); instrs.push(Instruction::Call( result_record_callable_id, vec![ @@ -3177,7 +3204,7 @@ impl<'a> PartialEvaluator<'a> { .try_into() .expect("result id should fit into u32"), )), - Operand::Literal(Literal::Pointer), + Operand::Literal(Literal::Tag(idx, len)), ], None, )); @@ -3188,11 +3215,17 @@ impl<'a> PartialEvaluator<'a> { ty: &Ty, instrs: &mut Vec, vals: &Rc<[Value]>, + tag_root: &str, ) -> Result<(), ()> { let Ty::Tuple(elem_tys) = ty else { panic!("expected tuple type for tuple value"); }; + let new_tag_root = format!("{tag_root}t"); let tuple_record_callable_id = self.get_tuple_record_callable(); + // let idx = self.program.tags.len(); + // let tag = format!("{idx}_{new_tag_root}"); + // let len = tag.len(); + // self.program.tags.push(tag); instrs.push(Instruction::Call( tuple_record_callable_id, vec![ @@ -3201,12 +3234,17 @@ impl<'a> PartialEvaluator<'a> { .try_into() .expect("tuple length should fit into u32"), )), - Operand::Literal(Literal::Pointer), + Operand::Literal(Literal::EmptyTag), ], None, )); - for (val, elem_ty) in vals.iter().zip(elem_tys.iter()) { - instrs.extend(self.generate_output_recording_instructions(val.clone(), elem_ty)?); + for (idx, (val, elem_ty)) in vals.iter().zip(elem_tys.iter()).enumerate() { + let new_tag_root = format!("{new_tag_root}{idx}"); + instrs.extend(self.generate_output_recording_instructions( + val.clone(), + elem_ty, + &new_tag_root, + )?); } Ok(()) @@ -3217,10 +3255,16 @@ impl<'a> PartialEvaluator<'a> { ty: &Ty, instrs: &mut Vec, vals: &Rc>, + tag_root: &str, ) -> Result<(), ()> { let Ty::Array(elem_ty) = ty else { panic!("expected array type for array value"); }; + let new_tag_root = format!("{tag_root}a"); + // let idx = self.program.tags.len(); + // let tag = format!("{idx}_{new_tag_root}"); + // let len = tag.len(); + // self.program.tags.push(tag); let array_record_callable_id = self.get_array_record_callable(); instrs.push(Instruction::Call( array_record_callable_id, @@ -3230,12 +3274,17 @@ impl<'a> PartialEvaluator<'a> { .try_into() .expect("array length should fit into u32"), )), - Operand::Literal(Literal::Pointer), + Operand::Literal(Literal::EmptyTag), ], None, )); - for val in vals.iter() { - instrs.extend(self.generate_output_recording_instructions(val.clone(), elem_ty)?); + for (idx, val) in vals.iter().enumerate() { + let new_tag_root = format!("{new_tag_root}{idx}"); + instrs.extend(self.generate_output_recording_instructions( + val.clone(), + elem_ty, + &new_tag_root, + )?); } Ok(()) diff --git a/source/compiler/qsc_partial_eval/src/tests/arrays.rs b/source/compiler/qsc_partial_eval/src/tests/arrays.rs index a470378978..e954711282 100644 --- a/source/compiler/qsc_partial_eval/src/tests/arrays.rs +++ b/source/compiler/qsc_partial_eval/src/tests/arrays.rs @@ -72,13 +72,13 @@ fn array_with_dynamic_content() { &program, BlockId(0), &expect![[r#" - Block: - Call id(1), args( Qubit(0), Result(0), ) - Call id(1), args( Qubit(1), Result(1), ) - Call id(2), args( Integer(2), Pointer, ) - Call id(3), args( Result(0), Pointer, ) - Call id(3), args( Result(1), Pointer, ) - Return"#]], + Block: + Call id(1), args( Qubit(0), Result(0), ) + Call id(1), args( Qubit(1), Result(1), ) + Call id(2), args( Integer(2), EmptyTag, ) + Call id(3), args( Result(0), Tag(0, 5), ) + Call id(3), args( Result(1), Tag(1, 5), ) + Return"#]], ); } @@ -143,9 +143,9 @@ fn array_with_hybrid_content() { Call id(1), args( Qubit(0), Result(0), ) Variable(0, Boolean) = Call id(2), args( Result(0), ) Variable(1, Boolean) = Store Variable(0, Boolean) - Call id(3), args( Integer(2), Pointer, ) - Call id(4), args( Bool(true), Pointer, ) - Call id(4), args( Variable(1, Boolean), Pointer, ) + Call id(3), args( Integer(2), EmptyTag, ) + Call id(4), args( Bool(true), Tag(0, 5), ) + Call id(4), args( Variable(1, Boolean), Tag(1, 5), ) Return"#]], ); } @@ -207,12 +207,12 @@ fn array_repeat_with_dynamic_content() { &program, BlockId(0), &expect![[r#" - Block: - Call id(1), args( Qubit(0), Result(0), ) - Call id(2), args( Integer(2), Pointer, ) - Call id(3), args( Result(0), Pointer, ) - Call id(3), args( Result(0), Pointer, ) - Return"#]], + Block: + Call id(1), args( Qubit(0), Result(0), ) + Call id(2), args( Integer(2), EmptyTag, ) + Call id(3), args( Result(0), Tag(0, 5), ) + Call id(3), args( Result(0), Tag(1, 5), ) + Return"#]], ); } @@ -263,7 +263,7 @@ fn result_array_value_at_index() { Block: Call id(1), args( Qubit(0), Result(0), ) Call id(1), args( Qubit(1), Result(1), ) - Call id(2), args( Result(1), Pointer, ) + Call id(2), args( Result(1), Tag(0, 3), ) Return"#]], ); } @@ -372,10 +372,10 @@ fn result_array_slice_with_explicit_range() { Call id(1), args( Qubit(2), Result(2), ) Call id(1), args( Qubit(3), Result(3), ) Call id(1), args( Qubit(4), Result(4), ) - Call id(2), args( Integer(3), Pointer, ) - Call id(3), args( Result(0), Pointer, ) - Call id(3), args( Result(2), Pointer, ) - Call id(3), args( Result(4), Pointer, ) + Call id(2), args( Integer(3), EmptyTag, ) + Call id(3), args( Result(0), Tag(0, 5), ) + Call id(3), args( Result(2), Tag(1, 5), ) + Call id(3), args( Result(4), Tag(2, 5), ) Return"#]], ); } @@ -442,9 +442,9 @@ fn result_array_slice_with_open_start_range() { Call id(1), args( Qubit(0), Result(0), ) Call id(1), args( Qubit(1), Result(1), ) Call id(1), args( Qubit(2), Result(2), ) - Call id(2), args( Integer(2), Pointer, ) - Call id(3), args( Result(0), Pointer, ) - Call id(3), args( Result(1), Pointer, ) + Call id(2), args( Integer(2), EmptyTag, ) + Call id(3), args( Result(0), Tag(0, 5), ) + Call id(3), args( Result(1), Tag(1, 5), ) Return"#]], ); } @@ -511,9 +511,9 @@ fn result_array_slice_with_open_ended_range() { Call id(1), args( Qubit(0), Result(0), ) Call id(1), args( Qubit(1), Result(1), ) Call id(1), args( Qubit(2), Result(2), ) - Call id(2), args( Integer(2), Pointer, ) - Call id(3), args( Result(1), Pointer, ) - Call id(3), args( Result(2), Pointer, ) + Call id(2), args( Integer(2), EmptyTag, ) + Call id(3), args( Result(1), Tag(0, 5), ) + Call id(3), args( Result(2), Tag(1, 5), ) Return"#]], ); } @@ -582,10 +582,10 @@ fn result_array_slice_with_open_two_step_range() { Call id(1), args( Qubit(2), Result(2), ) Call id(1), args( Qubit(3), Result(3), ) Call id(1), args( Qubit(4), Result(4), ) - Call id(2), args( Integer(3), Pointer, ) - Call id(3), args( Result(0), Pointer, ) - Call id(3), args( Result(2), Pointer, ) - Call id(3), args( Result(4), Pointer, ) + Call id(2), args( Integer(3), EmptyTag, ) + Call id(3), args( Result(0), Tag(0, 5), ) + Call id(3), args( Result(2), Tag(1, 5), ) + Call id(3), args( Result(4), Tag(2, 5), ) Return"#]], ); } @@ -673,10 +673,10 @@ fn result_array_copy_and_update_with_single_index() { Call id(1), args( Qubit(1), Result(1), ) Call id(1), args( Qubit(2), Result(2), ) Call id(1), args( Qubit(3), Result(3), ) - Call id(2), args( Integer(3), Pointer, ) - Call id(3), args( Result(0), Pointer, ) - Call id(3), args( Result(3), Pointer, ) - Call id(3), args( Result(2), Pointer, ) + Call id(2), args( Integer(3), EmptyTag, ) + Call id(3), args( Result(0), Tag(0, 5), ) + Call id(3), args( Result(3), Tag(1, 5), ) + Call id(3), args( Result(2), Tag(2, 5), ) Return"#]], ); } @@ -789,12 +789,12 @@ fn result_array_copy_and_update_with_explicit_range() { Call id(1), args( Qubit(5), Result(5), ) Call id(1), args( Qubit(6), Result(6), ) Call id(1), args( Qubit(7), Result(7), ) - Call id(2), args( Integer(5), Pointer, ) - Call id(3), args( Result(5), Pointer, ) - Call id(3), args( Result(1), Pointer, ) - Call id(3), args( Result(6), Pointer, ) - Call id(3), args( Result(3), Pointer, ) - Call id(3), args( Result(7), Pointer, ) + Call id(2), args( Integer(5), EmptyTag, ) + Call id(3), args( Result(5), Tag(0, 5), ) + Call id(3), args( Result(1), Tag(1, 5), ) + Call id(3), args( Result(6), Tag(2, 5), ) + Call id(3), args( Result(3), Tag(3, 5), ) + Call id(3), args( Result(7), Tag(4, 5), ) Return"#]], ); } @@ -863,10 +863,10 @@ fn result_array_copy_and_update_with_open_start_range() { Call id(1), args( Qubit(2), Result(2), ) Call id(1), args( Qubit(3), Result(3), ) Call id(1), args( Qubit(4), Result(4), ) - Call id(2), args( Integer(3), Pointer, ) - Call id(3), args( Result(3), Pointer, ) - Call id(3), args( Result(4), Pointer, ) - Call id(3), args( Result(2), Pointer, ) + Call id(2), args( Integer(3), EmptyTag, ) + Call id(3), args( Result(3), Tag(0, 5), ) + Call id(3), args( Result(4), Tag(1, 5), ) + Call id(3), args( Result(2), Tag(2, 5), ) Return"#]], ); } @@ -935,10 +935,10 @@ fn result_array_copy_and_update_with_open_ended_range() { Call id(1), args( Qubit(2), Result(2), ) Call id(1), args( Qubit(3), Result(3), ) Call id(1), args( Qubit(4), Result(4), ) - Call id(2), args( Integer(3), Pointer, ) - Call id(3), args( Result(0), Pointer, ) - Call id(3), args( Result(3), Pointer, ) - Call id(3), args( Result(4), Pointer, ) + Call id(2), args( Integer(3), EmptyTag, ) + Call id(3), args( Result(0), Tag(0, 5), ) + Call id(3), args( Result(3), Tag(1, 5), ) + Call id(3), args( Result(4), Tag(2, 5), ) Return"#]], ); } @@ -1007,10 +1007,10 @@ fn result_array_copy_and_update_with_open_two_step_range() { Call id(1), args( Qubit(2), Result(2), ) Call id(1), args( Qubit(3), Result(3), ) Call id(1), args( Qubit(4), Result(4), ) - Call id(2), args( Integer(3), Pointer, ) - Call id(3), args( Result(3), Pointer, ) - Call id(3), args( Result(1), Pointer, ) - Call id(3), args( Result(4), Pointer, ) + Call id(2), args( Integer(3), EmptyTag, ) + Call id(3), args( Result(3), Tag(0, 5), ) + Call id(3), args( Result(1), Tag(1, 5), ) + Call id(3), args( Result(4), Tag(2, 5), ) Return"#]], ); } diff --git a/source/compiler/qsc_partial_eval/src/tests/assigns.rs b/source/compiler/qsc_partial_eval/src/tests/assigns.rs index 80a076c9e6..e5a83eb33b 100644 --- a/source/compiler/qsc_partial_eval/src/tests/assigns.rs +++ b/source/compiler/qsc_partial_eval/src/tests/assigns.rs @@ -85,7 +85,7 @@ fn assigning_result_register_updates_value() { &expect![[r#" Block: Call id(1), args( Qubit(0), Result(0), ) - Call id(2), args( Result(0), Pointer, ) + Call id(2), args( Result(0), Tag(0, 3), ) Return"#]], ); } @@ -124,7 +124,7 @@ fn assigning_classical_bool_updates_value_and_adds_store_instructions() { Block: Variable(0, Boolean) = Store Bool(true) Variable(0, Boolean) = Store Bool(false) - Call id(1), args( Bool(false), Pointer, ) + Call id(1), args( Bool(false), Tag(0, 3), ) Return"#]], ); } @@ -194,7 +194,7 @@ fn assigning_dynamic_bool_updates_value_and_adds_store_instructions() { Variable(2, Boolean) = Store Variable(1, Boolean) Variable(0, Boolean) = Store Variable(2, Boolean) Variable(3, Boolean) = Store Variable(0, Boolean) - Call id(3), args( Variable(3, Boolean), Pointer, ) + Call id(3), args( Variable(3, Boolean), Tag(0, 3), ) Return"#]], ); } @@ -233,7 +233,7 @@ fn assigning_classical_int_updates_value_and_adds_store_instructions() { Block: Variable(0, Integer) = Store Integer(0) Variable(0, Integer) = Store Integer(1) - Call id(1), args( Integer(1), Pointer, ) + Call id(1), args( Integer(1), Tag(0, 3), ) Return"#]], ); } @@ -305,7 +305,7 @@ fn assigning_dynamic_int_updates_value_and_adds_store_instructions() { Block 1:Block: Variable(0, Integer) = Store Variable(3, Integer) Variable(4, Integer) = Store Variable(0, Integer) - Call id(3), args( Variable(4, Integer), Pointer, ) + Call id(3), args( Variable(4, Integer), Tag(0, 3), ) Return Block 2:Block: Variable(3, Integer) = Store Integer(1) @@ -384,7 +384,7 @@ fn assigning_classical_bool_within_dynamic_if_expression_adds_store_instruction( Branch Variable(2, Boolean), 2, 1 Block 1:Block: Variable(3, Boolean) = Store Variable(0, Boolean) - Call id(3), args( Variable(3, Boolean), Pointer, ) + Call id(3), args( Variable(3, Boolean), Tag(0, 3), ) Return Block 2:Block: Variable(0, Boolean) = Store Bool(true) @@ -462,7 +462,7 @@ fn assigning_classical_int_within_dynamic_if_else_expression_adds_store_instruct Branch Variable(2, Boolean), 2, 3 Block 1:Block: Variable(3, Integer) = Store Variable(0, Integer) - Call id(3), args( Variable(3, Integer), Pointer, ) + Call id(3), args( Variable(3, Integer), Tag(0, 3), ) Return Block 2:Block: Variable(0, Integer) = Store Integer(1) @@ -558,9 +558,9 @@ fn array_of_results_update_element_at_index_with_dynamic_content() { Block: Call id(1), args( Qubit(0), Result(0), ) Call id(1), args( Qubit(1), Result(1), ) - Call id(2), args( Integer(2), Pointer, ) - Call id(3), args( Result(0), Pointer, ) - Call id(3), args( Result(1), Pointer, ) + Call id(2), args( Integer(2), EmptyTag, ) + Call id(3), args( Result(0), Tag(0, 5), ) + Call id(3), args( Result(1), Tag(1, 5), ) Return"#]], ); } @@ -644,9 +644,9 @@ fn array_of_bools_update_element_at_index_with_dynamic_content() { Call id(1), args( Qubit(1), Result(1), ) Variable(2, Boolean) = Call id(2), args( Result(1), ) Variable(3, Boolean) = Store Variable(2, Boolean) - Call id(3), args( Integer(2), Pointer, ) - Call id(4), args( Variable(1, Boolean), Pointer, ) - Call id(4), args( Variable(3, Boolean), Pointer, ) + Call id(3), args( Integer(2), EmptyTag, ) + Call id(4), args( Variable(1, Boolean), Tag(0, 5), ) + Call id(4), args( Variable(3, Boolean), Tag(1, 5), ) Return"#]], ); } @@ -762,12 +762,12 @@ fn array_of_results_update_slice_with_explicit_range() { Call id(1), args( Qubit(5), Result(5), ) Call id(1), args( Qubit(6), Result(6), ) Call id(1), args( Qubit(7), Result(7), ) - Call id(2), args( Integer(5), Pointer, ) - Call id(3), args( Result(5), Pointer, ) - Call id(3), args( Result(1), Pointer, ) - Call id(3), args( Result(6), Pointer, ) - Call id(3), args( Result(3), Pointer, ) - Call id(3), args( Result(7), Pointer, ) + Call id(2), args( Integer(5), EmptyTag, ) + Call id(3), args( Result(5), Tag(0, 5), ) + Call id(3), args( Result(1), Tag(1, 5), ) + Call id(3), args( Result(6), Tag(2, 5), ) + Call id(3), args( Result(3), Tag(3, 5), ) + Call id(3), args( Result(7), Tag(4, 5), ) Return"#]], ); } @@ -837,10 +837,10 @@ fn array_of_results_update_slice_with_open_start_range() { Call id(1), args( Qubit(2), Result(2), ) Call id(1), args( Qubit(3), Result(3), ) Call id(1), args( Qubit(4), Result(4), ) - Call id(2), args( Integer(3), Pointer, ) - Call id(3), args( Result(3), Pointer, ) - Call id(3), args( Result(4), Pointer, ) - Call id(3), args( Result(2), Pointer, ) + Call id(2), args( Integer(3), EmptyTag, ) + Call id(3), args( Result(3), Tag(0, 5), ) + Call id(3), args( Result(4), Tag(1, 5), ) + Call id(3), args( Result(2), Tag(2, 5), ) Return"#]], ); } @@ -910,10 +910,10 @@ fn array_of_results_update_slice_with_open_ended_range() { Call id(1), args( Qubit(2), Result(2), ) Call id(1), args( Qubit(3), Result(3), ) Call id(1), args( Qubit(4), Result(4), ) - Call id(2), args( Integer(3), Pointer, ) - Call id(3), args( Result(0), Pointer, ) - Call id(3), args( Result(3), Pointer, ) - Call id(3), args( Result(4), Pointer, ) + Call id(2), args( Integer(3), EmptyTag, ) + Call id(3), args( Result(0), Tag(0, 5), ) + Call id(3), args( Result(3), Tag(1, 5), ) + Call id(3), args( Result(4), Tag(2, 5), ) Return"#]], ); } @@ -983,10 +983,10 @@ fn array_of_results_update_slice_with_open_two_step_range() { Call id(1), args( Qubit(2), Result(2), ) Call id(1), args( Qubit(3), Result(3), ) Call id(1), args( Qubit(4), Result(4), ) - Call id(2), args( Integer(3), Pointer, ) - Call id(3), args( Result(3), Pointer, ) - Call id(3), args( Result(1), Pointer, ) - Call id(3), args( Result(4), Pointer, ) + Call id(2), args( Integer(3), EmptyTag, ) + Call id(3), args( Result(3), Tag(0, 5), ) + Call id(3), args( Result(1), Tag(1, 5), ) + Call id(3), args( Result(4), Tag(2, 5), ) Return"#]], ); } @@ -1075,9 +1075,9 @@ fn empty_array_of_results_in_place_concatenation() { Block: Call id(1), args( Qubit(0), Result(0), ) Call id(1), args( Qubit(1), Result(1), ) - Call id(2), args( Integer(2), Pointer, ) - Call id(3), args( Result(0), Pointer, ) - Call id(3), args( Result(1), Pointer, ) + Call id(2), args( Integer(2), EmptyTag, ) + Call id(3), args( Result(0), Tag(0, 5), ) + Call id(3), args( Result(1), Tag(1, 5), ) Return"#]], ); } @@ -1144,9 +1144,9 @@ fn non_empty_array_of_results_in_place_concatenation() { Block: Call id(1), args( Qubit(0), Result(0), ) Call id(1), args( Qubit(1), Result(1), ) - Call id(2), args( Integer(2), Pointer, ) - Call id(3), args( Result(0), Pointer, ) - Call id(3), args( Result(1), Pointer, ) + Call id(2), args( Integer(2), EmptyTag, ) + Call id(3), args( Result(0), Tag(0, 5), ) + Call id(3), args( Result(1), Tag(1, 5), ) Return"#]], ); } @@ -1220,7 +1220,7 @@ fn logical_and_assign_with_lhs_classical_true_is_optimized_as_store() { Variable(3, Boolean) = Store Bool(true) Variable(3, Boolean) = Store Variable(2, Boolean) Variable(4, Boolean) = Store Variable(3, Boolean) - Call id(3), args( Variable(4, Boolean), Pointer, ) + Call id(3), args( Variable(4, Boolean), Tag(0, 3), ) Return"#]], ); } @@ -1293,7 +1293,7 @@ fn logical_and_assign_with_lhs_classical_false_short_circuits_evaluation() { Variable(2, Boolean) = Store Variable(1, Boolean) Variable(3, Boolean) = Store Bool(false) Variable(3, Boolean) = Store Bool(false) - Call id(3), args( Bool(false), Pointer, ) + Call id(3), args( Bool(false), Tag(0, 3), ) Return"#]], ); } @@ -1368,7 +1368,7 @@ fn logical_and_assign_with_dynamic_lhs_and_dynamic_rhs_short_circuits_when_rhs_i Block 1:Block: Variable(2, Boolean) = Store Variable(3, Boolean) Variable(6, Boolean) = Store Variable(2, Boolean) - Call id(3), args( Variable(6, Boolean), Pointer, ) + Call id(3), args( Variable(6, Boolean), Tag(0, 3), ) Return Block 2:Block: Call id(1), args( Qubit(0), Result(1), ) @@ -1447,7 +1447,7 @@ fn logical_or_assign_with_lhs_classical_true_short_circuits_evaluation() { Variable(2, Boolean) = Store Variable(1, Boolean) Variable(3, Boolean) = Store Bool(true) Variable(3, Boolean) = Store Bool(true) - Call id(3), args( Bool(true), Pointer, ) + Call id(3), args( Bool(true), Tag(0, 3), ) Return"#]], ); } @@ -1521,7 +1521,7 @@ fn logical_or_assign_with_lhs_classical_false_is_optimized_as_store() { Variable(3, Boolean) = Store Bool(false) Variable(3, Boolean) = Store Variable(2, Boolean) Variable(4, Boolean) = Store Variable(3, Boolean) - Call id(3), args( Variable(4, Boolean), Pointer, ) + Call id(3), args( Variable(4, Boolean), Tag(0, 3), ) Return"#]], ); } @@ -1596,7 +1596,7 @@ fn logical_or_assign_with_dynamic_lhs_and_dynamic_rhs_short_circuits_when_rhs_is Block 1:Block: Variable(2, Boolean) = Store Variable(3, Boolean) Variable(6, Boolean) = Store Variable(2, Boolean) - Call id(3), args( Variable(6, Boolean), Pointer, ) + Call id(3), args( Variable(6, Boolean), Tag(0, 3), ) Return Block 2:Block: Call id(1), args( Qubit(0), Result(1), ) @@ -1677,7 +1677,7 @@ fn integer_assign_add_with_lhs_classical_integer_and_rhs_dynamic_integer() { Variable(4, Integer) = Add Integer(0), Variable(3, Integer) Variable(0, Integer) = Store Variable(4, Integer) Variable(5, Integer) = Store Variable(0, Integer) - Call id(3), args( Variable(5, Integer), Pointer, ) + Call id(3), args( Variable(5, Integer), Tag(0, 3), ) Return Block 2:Block: Variable(3, Integer) = Store Integer(0) @@ -1758,7 +1758,7 @@ fn integer_assign_sub_with_lhs_dynamic_integer_and_rhs_classical_integer() { Variable(4, Integer) = Sub Variable(3, Integer), Integer(1) Variable(3, Integer) = Store Variable(4, Integer) Variable(5, Integer) = Store Variable(3, Integer) - Call id(3), args( Variable(5, Integer), Pointer, ) + Call id(3), args( Variable(5, Integer), Tag(0, 3), ) Return Block 2:Block: Variable(2, Integer) = Store Integer(0) @@ -1850,7 +1850,7 @@ fn integer_assign_mul_with_lhs_dynamic_integer_and_rhs_dynamic_integer() { Variable(7, Integer) = Mul Variable(3, Integer), Variable(6, Integer) Variable(3, Integer) = Store Variable(7, Integer) Variable(8, Integer) = Store Variable(3, Integer) - Call id(3), args( Variable(8, Integer), Pointer, ) + Call id(3), args( Variable(8, Integer), Tag(0, 3), ) Return Block 5:Block: Variable(6, Integer) = Store Integer(1) @@ -1931,7 +1931,7 @@ fn integer_assign_div_with_lhs_classical_integer_and_rhs_dynamic_integer() { Variable(4, Integer) = Sdiv Integer(0), Variable(3, Integer) Variable(0, Integer) = Store Variable(4, Integer) Variable(5, Integer) = Store Variable(0, Integer) - Call id(3), args( Variable(5, Integer), Pointer, ) + Call id(3), args( Variable(5, Integer), Tag(0, 3), ) Return Block 2:Block: Variable(3, Integer) = Store Integer(0) @@ -2012,7 +2012,7 @@ fn integer_assign_mod_with_lhs_dynamic_integer_and_rhs_classical_integer() { Variable(4, Integer) = Srem Variable(3, Integer), Integer(1) Variable(3, Integer) = Store Variable(4, Integer) Variable(5, Integer) = Store Variable(3, Integer) - Call id(3), args( Variable(5, Integer), Pointer, ) + Call id(3), args( Variable(5, Integer), Tag(0, 3), ) Return Block 2:Block: Variable(2, Integer) = Store Integer(0) @@ -2139,7 +2139,7 @@ fn integer_assign_exp_with_lhs_dynamic_integer_and_rhs_classical_zero_integer() Variable(4, Integer) = Store Integer(1) Variable(3, Integer) = Store Variable(4, Integer) Variable(5, Integer) = Store Variable(3, Integer) - Call id(3), args( Variable(5, Integer), Pointer, ) + Call id(3), args( Variable(5, Integer), Tag(0, 3), ) Return Block 2:Block: Variable(2, Integer) = Store Integer(0) @@ -2223,7 +2223,7 @@ fn integer_assign_exp_with_lhs_dynamic_integer_and_rhs_classical_positive_intege Variable(7, Integer) = Mul Variable(6, Integer), Variable(3, Integer) Variable(3, Integer) = Store Variable(7, Integer) Variable(8, Integer) = Store Variable(3, Integer) - Call id(3), args( Variable(8, Integer), Pointer, ) + Call id(3), args( Variable(8, Integer), Tag(0, 3), ) Return Block 2:Block: Variable(2, Integer) = Store Integer(0) @@ -2338,7 +2338,7 @@ fn integer_assign_bitwise_and_with_lhs_dynamic_integer_and_rhs_dynamic_integer() Variable(7, Integer) = BitwiseAnd Variable(3, Integer), Variable(6, Integer) Variable(3, Integer) = Store Variable(7, Integer) Variable(8, Integer) = Store Variable(3, Integer) - Call id(3), args( Variable(8, Integer), Pointer, ) + Call id(3), args( Variable(8, Integer), Tag(0, 3), ) Return Block 5:Block: Variable(6, Integer) = Store Integer(1) @@ -2419,7 +2419,7 @@ fn integer_assign_bitwise_or_with_lhs_classical_integer_and_rhs_dynamic_integer( Variable(4, Integer) = BitwiseOr Integer(0), Variable(3, Integer) Variable(0, Integer) = Store Variable(4, Integer) Variable(5, Integer) = Store Variable(0, Integer) - Call id(3), args( Variable(5, Integer), Pointer, ) + Call id(3), args( Variable(5, Integer), Tag(0, 3), ) Return Block 2:Block: Variable(3, Integer) = Store Integer(0) @@ -2500,7 +2500,7 @@ fn integer_bitwise_xor_with_lhs_dynamic_integer_and_rhs_classical_integer() { Variable(4, Integer) = BitwiseXor Variable(3, Integer), Integer(1) Variable(3, Integer) = Store Variable(4, Integer) Variable(5, Integer) = Store Variable(3, Integer) - Call id(3), args( Variable(5, Integer), Pointer, ) + Call id(3), args( Variable(5, Integer), Tag(0, 3), ) Return Block 2:Block: Variable(2, Integer) = Store Integer(0) @@ -2592,7 +2592,7 @@ fn integer_assign_bitwise_left_shift_with_lhs_dynamic_integer_and_rhs_dynamic_in Variable(7, Integer) = Shl Variable(3, Integer), Variable(6, Integer) Variable(3, Integer) = Store Variable(7, Integer) Variable(8, Integer) = Store Variable(3, Integer) - Call id(3), args( Variable(8, Integer), Pointer, ) + Call id(3), args( Variable(8, Integer), Tag(0, 3), ) Return Block 5:Block: Variable(6, Integer) = Store Integer(1) @@ -2673,7 +2673,7 @@ fn integer_assign_bitwise_right_shift_with_lhs_classical_integer_and_rhs_dynamic Variable(4, Integer) = Ashr Integer(0), Variable(3, Integer) Variable(0, Integer) = Store Variable(4, Integer) Variable(5, Integer) = Store Variable(0, Integer) - Call id(3), args( Variable(5, Integer), Pointer, ) + Call id(3), args( Variable(5, Integer), Tag(0, 3), ) Return Block 2:Block: Variable(3, Integer) = Store Integer(0) @@ -2754,7 +2754,7 @@ fn double_assign_add_with_lhs_classical_double_and_rhs_dynamic_double() { Variable(4, Double) = Fadd Double(0), Variable(3, Double) Variable(0, Double) = Store Variable(4, Double) Variable(5, Double) = Store Variable(0, Double) - Call id(3), args( Variable(5, Double), Pointer, ) + Call id(3), args( Variable(5, Double), Tag(0, 3), ) Return Block 2:Block: Variable(3, Double) = Store Double(0) @@ -2835,7 +2835,7 @@ fn double_assign_sub_with_lhs_dynamic_double_and_rhs_classical_double() { Variable(4, Double) = Fsub Variable(3, Double), Double(1) Variable(3, Double) = Store Variable(4, Double) Variable(5, Double) = Store Variable(3, Double) - Call id(3), args( Variable(5, Double), Pointer, ) + Call id(3), args( Variable(5, Double), Tag(0, 3), ) Return Block 2:Block: Variable(2, Double) = Store Double(0) @@ -2927,7 +2927,7 @@ fn double_assign_mul_with_lhs_dynamic_double_and_rhs_dynamic_double() { Variable(7, Double) = Fmul Variable(3, Double), Variable(6, Double) Variable(3, Double) = Store Variable(7, Double) Variable(8, Double) = Store Variable(3, Double) - Call id(3), args( Variable(8, Double), Pointer, ) + Call id(3), args( Variable(8, Double), Tag(0, 3), ) Return Block 5:Block: Variable(6, Double) = Store Double(1.1) @@ -3008,7 +3008,7 @@ fn double_assign_div_with_lhs_classical_double_and_rhs_dynamic_double() { Variable(4, Double) = Fdiv Double(0), Variable(3, Double) Variable(0, Double) = Store Variable(4, Double) Variable(5, Double) = Store Variable(0, Double) - Call id(3), args( Variable(5, Double), Pointer, ) + Call id(3), args( Variable(5, Double), Tag(0, 3), ) Return Block 2:Block: Variable(3, Double) = Store Double(0) diff --git a/source/compiler/qsc_partial_eval/src/tests/bindings.rs b/source/compiler/qsc_partial_eval/src/tests/bindings.rs index cc8e55d83f..0bd21aa798 100644 --- a/source/compiler/qsc_partial_eval/src/tests/bindings.rs +++ b/source/compiler/qsc_partial_eval/src/tests/bindings.rs @@ -58,7 +58,7 @@ fn immutable_result_binding_does_not_generate_store_instruction() { &expect![[r#" Block: Call id(1), args( Qubit(0), Result(0), ) - Call id(2), args( Result(0), Pointer, ) + Call id(2), args( Result(0), Tag(0, 3), ) Return"#]], ); } @@ -109,7 +109,7 @@ fn mutable_result_binding_does_not_generate_store_instruction() { &expect![[r#" Block: Call id(1), args( Qubit(0), Result(0), ) - Call id(2), args( Result(0), Pointer, ) + Call id(2), args( Result(0), Tag(0, 3), ) Return"#]], ); } @@ -177,7 +177,7 @@ fn immutable_bool_binding_does_not_generate_store_instruction() { Variable(1, Boolean) = Store Variable(0, Boolean) Variable(2, Boolean) = Store Variable(1, Boolean) Variable(3, Boolean) = Store Variable(2, Boolean) - Call id(3), args( Variable(3, Boolean), Pointer, ) + Call id(3), args( Variable(3, Boolean), Tag(0, 3), ) Return"#]], ); } @@ -245,7 +245,7 @@ fn mutable_bool_binding_generates_store_instruction() { Variable(1, Boolean) = Store Variable(0, Boolean) Variable(2, Boolean) = Store Variable(1, Boolean) Variable(3, Boolean) = Store Variable(2, Boolean) - Call id(3), args( Variable(3, Boolean), Pointer, ) + Call id(3), args( Variable(3, Boolean), Tag(0, 3), ) Return"#]], ); } @@ -315,7 +315,7 @@ fn immutable_int_binding_does_not_generate_store_instruction() { Block 1:Block: Variable(3, Integer) = Store Variable(2, Integer) Variable(4, Integer) = Store Variable(3, Integer) - Call id(3), args( Variable(4, Integer), Pointer, ) + Call id(3), args( Variable(4, Integer), Tag(0, 3), ) Return Block 2:Block: Variable(2, Integer) = Store Integer(0) @@ -391,7 +391,7 @@ fn mutable_int_binding_does_generate_store_instruction() { Block 1:Block: Variable(3, Integer) = Store Variable(2, Integer) Variable(4, Integer) = Store Variable(3, Integer) - Call id(3), args( Variable(4, Integer), Pointer, ) + Call id(3), args( Variable(4, Integer), Tag(0, 3), ) Return Block 2:Block: Variable(2, Integer) = Store Integer(0) @@ -477,7 +477,7 @@ fn mutable_variable_in_outer_scope_set_to_mutable_from_inner_scope() { Branch Variable(2, Boolean), 2, 3 Block 1:Block: Variable(4, Integer) = Store Variable(0, Integer) - Call id(3), args( Variable(4, Integer), Pointer, ) + Call id(3), args( Variable(4, Integer), Tag(0, 3), ) Return Block 2:Block: Variable(3, Integer) = Store Integer(1) @@ -554,7 +554,7 @@ fn mutable_double_binding_does_generate_store_instruction() { Block 1:Block: Variable(3, Double) = Store Variable(2, Double) Variable(4, Double) = Store Variable(3, Double) - Call id(3), args( Variable(4, Double), Pointer, ) + Call id(3), args( Variable(4, Double), Tag(0, 3), ) Return Block 2:Block: Variable(2, Double) = Store Double(0.1) diff --git a/source/compiler/qsc_partial_eval/src/tests/branching.rs b/source/compiler/qsc_partial_eval/src/tests/branching.rs index b8d508d326..35a3a2c771 100644 --- a/source/compiler/qsc_partial_eval/src/tests/branching.rs +++ b/source/compiler/qsc_partial_eval/src/tests/branching.rs @@ -46,11 +46,11 @@ fn if_expression_with_true_condition() { assert_blocks( &program, &expect![[r#" - Blocks: - Block 0:Block: - Call id(1), args( Qubit(0), ) - Call id(2), args( Integer(0), Pointer, ) - Return"#]], + Blocks: + Block 0:Block: + Call id(1), args( Qubit(0), ) + Call id(2), args( Integer(0), EmptyTag, ) + Return"#]], ); } @@ -73,10 +73,10 @@ fn if_expression_with_false_condition() { assert_blocks( &program, &expect![[r#" - Blocks: - Block 0:Block: - Call id(1), args( Integer(0), Pointer, ) - Return"#]], + Blocks: + Block 0:Block: + Call id(1), args( Integer(0), EmptyTag, ) + Return"#]], ); } @@ -115,11 +115,11 @@ fn if_else_expression_with_true_condition() { assert_blocks( &program, &expect![[r#" - Blocks: - Block 0:Block: - Call id(1), args( Qubit(0), ) - Call id(2), args( Integer(0), Pointer, ) - Return"#]], + Blocks: + Block 0:Block: + Call id(1), args( Qubit(0), ) + Call id(2), args( Integer(0), EmptyTag, ) + Return"#]], ); } @@ -158,11 +158,11 @@ fn if_else_expression_with_false_condition() { assert_blocks( &program, &expect![[r#" - Blocks: - Block 0:Block: - Call id(1), args( Qubit(0), ) - Call id(2), args( Integer(0), Pointer, ) - Return"#]], + Blocks: + Block 0:Block: + Call id(1), args( Qubit(0), ) + Call id(2), args( Integer(0), EmptyTag, ) + Return"#]], ); } @@ -204,11 +204,11 @@ fn if_elif_else_expression_with_true_elif_condition() { assert_blocks( &program, &expect![[r#" - Blocks: - Block 0:Block: - Call id(1), args( Qubit(0), ) - Call id(2), args( Integer(0), Pointer, ) - Return"#]], + Blocks: + Block 0:Block: + Call id(1), args( Qubit(0), ) + Call id(2), args( Integer(0), EmptyTag, ) + Return"#]], ); } @@ -282,7 +282,7 @@ fn if_expression_with_dynamic_condition() { Variable(1, Boolean) = Icmp Eq, Variable(0, Boolean), Bool(false) Branch Variable(1, Boolean), 2, 1 Block 1:Block: - Call id(4), args( Integer(0), Pointer, ) + Call id(4), args( Integer(0), EmptyTag, ) Return Block 2:Block: Call id(3), args( Qubit(0), ) @@ -376,7 +376,7 @@ fn if_else_expression_with_dynamic_condition() { Variable(1, Boolean) = Store Variable(0, Boolean) Branch Variable(1, Boolean), 2, 3 Block 1:Block: - Call id(5), args( Integer(0), Pointer, ) + Call id(5), args( Integer(0), EmptyTag, ) Return Block 2:Block: Call id(3), args( Qubit(0), ) @@ -491,7 +491,7 @@ fn if_elif_else_expression_with_dynamic_condition() { Variable(1, Boolean) = Store Variable(0, Boolean) Branch Variable(1, Boolean), 2, 3 Block 1:Block: - Call id(6), args( Integer(0), Pointer, ) + Call id(6), args( Integer(0), EmptyTag, ) Return Block 2:Block: Call id(3), args( Qubit(2), ) @@ -576,18 +576,18 @@ fn if_expression_with_dynamic_condition_and_nested_if_expression_with_true_condi assert_blocks( &program, &expect![[r#" - Blocks: - Block 0:Block: - Call id(1), args( Qubit(0), Result(0), ) - Variable(0, Boolean) = Call id(2), args( Result(0), ) - Variable(1, Boolean) = Icmp Eq, Variable(0, Boolean), Bool(false) - Branch Variable(1, Boolean), 2, 1 - Block 1:Block: - Call id(4), args( Integer(0), Pointer, ) - Return - Block 2:Block: - Call id(3), args( Qubit(0), ) - Jump(1)"#]], + Blocks: + Block 0:Block: + Call id(1), args( Qubit(0), Result(0), ) + Variable(0, Boolean) = Call id(2), args( Result(0), ) + Variable(1, Boolean) = Icmp Eq, Variable(0, Boolean), Bool(false) + Branch Variable(1, Boolean), 2, 1 + Block 1:Block: + Call id(4), args( Integer(0), EmptyTag, ) + Return + Block 2:Block: + Call id(3), args( Qubit(0), ) + Jump(1)"#]], ); } @@ -643,17 +643,17 @@ fn if_expression_with_dynamic_condition_and_nested_if_expression_with_false_cond assert_blocks( &program, &expect![[r#" - Blocks: - Block 0:Block: - Call id(1), args( Qubit(0), Result(0), ) - Variable(0, Boolean) = Call id(2), args( Result(0), ) - Variable(1, Boolean) = Icmp Eq, Variable(0, Boolean), Bool(false) - Branch Variable(1, Boolean), 2, 1 - Block 1:Block: - Call id(3), args( Integer(0), Pointer, ) - Return - Block 2:Block: - Jump(1)"#]], + Blocks: + Block 0:Block: + Call id(1), args( Qubit(0), Result(0), ) + Variable(0, Boolean) = Call id(2), args( Result(0), ) + Variable(1, Boolean) = Icmp Eq, Variable(0, Boolean), Bool(false) + Branch Variable(1, Boolean), 2, 1 + Block 1:Block: + Call id(3), args( Integer(0), EmptyTag, ) + Return + Block 2:Block: + Jump(1)"#]], ); } @@ -745,7 +745,7 @@ fn if_else_expression_with_dynamic_condition_and_nested_if_expression_with_true_ Variable(1, Boolean) = Store Variable(0, Boolean) Branch Variable(1, Boolean), 2, 3 Block 1:Block: - Call id(5), args( Integer(0), Pointer, ) + Call id(5), args( Integer(0), EmptyTag, ) Return Block 2:Block: Call id(3), args( Qubit(0), ) @@ -831,7 +831,7 @@ fn if_else_expression_with_dynamic_condition_and_nested_if_expression_with_false Variable(1, Boolean) = Store Variable(0, Boolean) Branch Variable(1, Boolean), 2, 3 Block 1:Block: - Call id(4), args( Integer(0), Pointer, ) + Call id(4), args( Integer(0), EmptyTag, ) Return Block 2:Block: Call id(3), args( Qubit(0), ) @@ -915,7 +915,7 @@ fn if_expression_with_dynamic_condition_and_nested_if_expression_with_dynamic_co Variable(1, Boolean) = Icmp Eq, Variable(0, Boolean), Bool(false) Branch Variable(1, Boolean), 2, 1 Block 1:Block: - Call id(4), args( Integer(0), Pointer, ) + Call id(4), args( Integer(0), EmptyTag, ) Return Block 2:Block: Variable(2, Boolean) = Call id(2), args( Result(1), ) @@ -1054,7 +1054,7 @@ fn doubly_nested_if_else_expressions_with_dynamic_conditions() { Variable(1, Boolean) = Icmp Eq, Variable(0, Boolean), Bool(false) Branch Variable(1, Boolean), 2, 6 Block 1:Block: - Call id(7), args( Integer(0), Pointer, ) + Call id(7), args( Integer(0), EmptyTag, ) Return Block 2:Block: Variable(2, Boolean) = Call id(2), args( Result(1), ) @@ -1161,19 +1161,19 @@ fn if_expression_with_dynamic_condition_and_subsequent_call_to_operation() { assert_blocks( &program, &expect![[r#" - Blocks: - Block 0:Block: - Call id(1), args( Qubit(0), Result(0), ) - Variable(0, Boolean) = Call id(2), args( Result(0), ) - Variable(1, Boolean) = Icmp Eq, Variable(0, Boolean), Bool(false) - Branch Variable(1, Boolean), 2, 1 - Block 1:Block: - Call id(4), args( Qubit(0), ) - Call id(5), args( Integer(0), Pointer, ) - Return - Block 2:Block: - Call id(3), args( Qubit(0), ) - Jump(1)"#]], + Blocks: + Block 0:Block: + Call id(1), args( Qubit(0), Result(0), ) + Variable(0, Boolean) = Call id(2), args( Result(0), ) + Variable(1, Boolean) = Icmp Eq, Variable(0, Boolean), Bool(false) + Branch Variable(1, Boolean), 2, 1 + Block 1:Block: + Call id(4), args( Qubit(0), ) + Call id(5), args( Integer(0), EmptyTag, ) + Return + Block 2:Block: + Call id(3), args( Qubit(0), ) + Jump(1)"#]], ); } @@ -1279,7 +1279,7 @@ fn if_else_expression_with_dynamic_condition_and_subsequent_call_to_operation() Branch Variable(1, Boolean), 2, 3 Block 1:Block: Call id(5), args( Qubit(0), ) - Call id(6), args( Integer(0), Pointer, ) + Call id(6), args( Integer(0), EmptyTag, ) Return Block 2:Block: Call id(3), args( Qubit(0), ) @@ -1389,15 +1389,15 @@ fn if_expression_with_classical_operand_from_hybrid_results_array_comparing_to_l assert_blocks( &program, &expect![[r#" - Blocks: - Block 0:Block: - Call id(1), args( Qubit(0), Result(0), ) - Call id(2), args( Qubit(1), ) - Call id(1), args( Qubit(1), Result(1), ) - Call id(3), args( Integer(2), Pointer, ) - Call id(4), args( Result(0), Pointer, ) - Call id(4), args( Result(1), Pointer, ) - Return"#]], + Blocks: + Block 0:Block: + Call id(1), args( Qubit(0), Result(0), ) + Call id(2), args( Qubit(1), ) + Call id(1), args( Qubit(1), Result(1), ) + Call id(3), args( Integer(2), EmptyTag, ) + Call id(4), args( Result(0), Tag(0, 5), ) + Call id(4), args( Result(1), Tag(1, 5), ) + Return"#]], ); } @@ -1478,15 +1478,15 @@ fn if_expression_with_classical_operand_from_hybrid_results_array_comparing_to_l assert_blocks( &program, &expect![[r#" - Blocks: - Block 0:Block: - Call id(1), args( Qubit(0), Result(0), ) - Call id(2), args( Qubit(1), ) - Call id(1), args( Qubit(1), Result(1), ) - Call id(3), args( Integer(2), Pointer, ) - Call id(4), args( Result(0), Pointer, ) - Call id(4), args( Result(1), Pointer, ) - Return"#]], + Blocks: + Block 0:Block: + Call id(1), args( Qubit(0), Result(0), ) + Call id(2), args( Qubit(1), ) + Call id(1), args( Qubit(1), Result(1), ) + Call id(3), args( Integer(2), EmptyTag, ) + Call id(4), args( Result(0), Tag(0, 5), ) + Call id(4), args( Result(1), Tag(1, 5), ) + Return"#]], ); } @@ -1588,9 +1588,9 @@ fn if_expression_with_dynamic_operand_from_hybrid_results_array() { Branch Variable(1, Boolean), 2, 1 Block 1:Block: Call id(1), args( Qubit(1), Result(1), ) - Call id(4), args( Integer(2), Pointer, ) - Call id(5), args( Result(0), Pointer, ) - Call id(5), args( Result(1), Pointer, ) + Call id(4), args( Integer(2), EmptyTag, ) + Call id(5), args( Result(0), Tag(0, 5), ) + Call id(5), args( Result(1), Tag(1, 5), ) Return Block 2:Block: Call id(3), args( Qubit(1), ) @@ -1697,9 +1697,9 @@ fn if_expression_with_classical_operand_from_hybrid_booleans_array() { Call id(1), args( Qubit(1), Result(1), ) Variable(2, Boolean) = Call id(2), args( Result(1), ) Variable(3, Boolean) = Store Variable(2, Boolean) - Call id(4), args( Integer(2), Pointer, ) - Call id(5), args( Variable(1, Boolean), Pointer, ) - Call id(5), args( Variable(3, Boolean), Pointer, ) + Call id(4), args( Integer(2), EmptyTag, ) + Call id(5), args( Variable(1, Boolean), Tag(0, 5), ) + Call id(5), args( Variable(3, Boolean), Tag(1, 5), ) Return"#]], ); } @@ -1804,9 +1804,9 @@ fn if_expression_with_dynamic_operand_from_hybrid_booleans_array() { Call id(1), args( Qubit(1), Result(1), ) Variable(2, Boolean) = Call id(2), args( Result(1), ) Variable(3, Boolean) = Store Variable(2, Boolean) - Call id(4), args( Integer(2), Pointer, ) - Call id(5), args( Variable(1, Boolean), Pointer, ) - Call id(5), args( Variable(3, Boolean), Pointer, ) + Call id(4), args( Integer(2), EmptyTag, ) + Call id(5), args( Variable(1, Boolean), Tag(0, 5), ) + Call id(5), args( Variable(3, Boolean), Tag(1, 5), ) Return Block 2:Block: Call id(3), args( Qubit(1), ) @@ -1923,9 +1923,9 @@ fn if_expression_with_classical_operand_from_hybrid_integers_array() { Variable(2, Integer) = Store Integer(1) Jump(1) Block 4:Block: - Call id(4), args( Integer(2), Pointer, ) - Call id(5), args( Variable(2, Integer), Pointer, ) - Call id(5), args( Variable(5, Integer), Pointer, ) + Call id(4), args( Integer(2), EmptyTag, ) + Call id(5), args( Variable(2, Integer), Tag(0, 5), ) + Call id(5), args( Variable(5, Integer), Tag(1, 5), ) Return Block 5:Block: Variable(5, Integer) = Store Integer(0) @@ -2050,9 +2050,9 @@ fn if_expression_with_dynamic_operand_from_hybrid_integers_array() { Call id(3), args( Qubit(1), ) Jump(4) Block 6:Block: - Call id(4), args( Integer(2), Pointer, ) - Call id(5), args( Variable(2, Integer), Pointer, ) - Call id(5), args( Variable(6, Integer), Pointer, ) + Call id(4), args( Integer(2), EmptyTag, ) + Call id(5), args( Variable(2, Integer), Tag(0, 5), ) + Call id(5), args( Variable(6, Integer), Tag(1, 5), ) Return Block 7:Block: Variable(6, Integer) = Store Integer(0) @@ -2172,9 +2172,9 @@ fn if_expression_with_classical_operand_from_hybrid_doubles_array() { Variable(2, Double) = Store Double(1.1) Jump(1) Block 4:Block: - Call id(4), args( Integer(2), Pointer, ) - Call id(5), args( Variable(2, Double), Pointer, ) - Call id(5), args( Variable(5, Double), Pointer, ) + Call id(4), args( Integer(2), EmptyTag, ) + Call id(5), args( Variable(2, Double), Tag(0, 5), ) + Call id(5), args( Variable(5, Double), Tag(1, 5), ) Return Block 5:Block: Variable(5, Double) = Store Double(0.1) @@ -2299,9 +2299,9 @@ fn if_expression_with_dynamic_operand_from_hybrid_doubles_array() { Call id(3), args( Qubit(1), ) Jump(4) Block 6:Block: - Call id(4), args( Integer(2), Pointer, ) - Call id(5), args( Variable(2, Double), Pointer, ) - Call id(5), args( Variable(6, Double), Pointer, ) + Call id(4), args( Integer(2), EmptyTag, ) + Call id(5), args( Variable(2, Double), Tag(0, 5), ) + Call id(5), args( Variable(6, Double), Tag(1, 5), ) Return Block 7:Block: Variable(6, Double) = Store Double(0.1) @@ -2341,7 +2341,7 @@ fn if_expression_with_implicit_return_in_callable_supported() { Branch Variable(1, Boolean), 2, 3 Block 1:Block: Variable(3, Integer) = Store Variable(2, Integer) - Call id(3), args( Variable(3, Integer), Pointer, ) + Call id(3), args( Variable(3, Integer), Tag(0, 3), ) Return Block 2:Block: Variable(2, Integer) = Store Integer(1) diff --git a/source/compiler/qsc_partial_eval/src/tests/calls.rs b/source/compiler/qsc_partial_eval/src/tests/calls.rs index ec72565842..17bd0dfd9f 100644 --- a/source/compiler/qsc_partial_eval/src/tests/calls.rs +++ b/source/compiler/qsc_partial_eval/src/tests/calls.rs @@ -50,11 +50,11 @@ fn call_to_single_qubit_unitary_with_two_calls_to_the_same_intrinsic() { &program, BlockId(0), &expect![[r#" - Block: - Call id(1), args( Qubit(0), ) - Call id(1), args( Qubit(0), ) - Call id(2), args( Integer(0), Pointer, ) - Return"#]], + Block: + Call id(1), args( Qubit(0), ) + Call id(1), args( Qubit(0), ) + Call id(2), args( Integer(0), EmptyTag, ) + Return"#]], ); } @@ -105,11 +105,11 @@ fn call_to_single_qubit_unitary_with_calls_to_different_intrinsics() { &program, BlockId(0), &expect![[r#" - Block: - Call id(1), args( Qubit(0), ) - Call id(2), args( Qubit(0), ) - Call id(3), args( Integer(0), Pointer, ) - Return"#]], + Block: + Call id(1), args( Qubit(0), ) + Call id(2), args( Qubit(0), ) + Call id(3), args( Integer(0), EmptyTag, ) + Return"#]], ); } @@ -147,11 +147,11 @@ fn call_to_two_qubit_unitary() { &program, BlockId(0), &expect![[r#" - Block: - Call id(1), args( Qubit(0), Qubit(1), ) - Call id(1), args( Qubit(1), Qubit(0), ) - Call id(2), args( Integer(0), Pointer, ) - Return"#]], + Block: + Call id(1), args( Qubit(0), Qubit(1), ) + Call id(1), args( Qubit(1), Qubit(0), ) + Call id(2), args( Integer(0), EmptyTag, ) + Return"#]], ); } @@ -204,11 +204,11 @@ fn call_to_unitary_that_receives_double_and_qubit() { &program, BlockId(0), &expect![[r#" - Block: - Call id(1), args( Double(1), Qubit(0), ) - Call id(2), args( Qubit(0), Double(1), ) - Call id(3), args( Integer(0), Pointer, ) - Return"#]], + Block: + Call id(1), args( Double(1), Qubit(0), ) + Call id(2), args( Qubit(0), Double(1), ) + Call id(3), args( Integer(0), EmptyTag, ) + Return"#]], ); } @@ -277,11 +277,11 @@ fn calls_to_unitary_that_conditionally_calls_intrinsic_with_classical_bool() { &program, BlockId(0), &expect![[r#" - Block: - Call id(1), args( Qubit(0), ) - Call id(2), args( Qubit(0), ) - Call id(3), args( Integer(0), Pointer, ) - Return"#]], + Block: + Call id(1), args( Qubit(0), ) + Call id(2), args( Qubit(0), ) + Call id(3), args( Integer(0), EmptyTag, ) + Return"#]], ); } @@ -383,7 +383,7 @@ fn calls_to_unitary_that_conditionally_calls_intrinsic_with_dynamic_bool() { Variable(1, Boolean) = Store Variable(0, Boolean) Branch Variable(1, Boolean), 2, 3 Block 1:Block: - Call id(5), args( Integer(0), Pointer, ) + Call id(5), args( Integer(0), EmptyTag, ) Return Block 2:Block: Call id(3), args( Qubit(1), ) @@ -428,11 +428,11 @@ fn call_to_unitary_rotation_unitary_with_computation() { &program, BlockId(0), &expect![[r#" - Block: - Call id(1), args( Double(4), Qubit(0), ) - Call id(1), args( Double(6), Qubit(0), ) - Call id(2), args( Integer(0), Pointer, ) - Return"#]], + Block: + Call id(1), args( Double(4), Qubit(0), ) + Call id(1), args( Double(6), Qubit(0), ) + Call id(2), args( Integer(0), EmptyTag, ) + Return"#]], ); } @@ -482,10 +482,10 @@ fn call_to_operation_that_returns_measurement_result() { &program, BlockId(0), &expect![[r#" - Block: - Call id(1), args( Qubit(0), Result(0), ) - Call id(2), args( Result(0), Pointer, ) - Return"#]], + Block: + Call id(1), args( Qubit(0), Result(0), ) + Call id(2), args( Result(0), Tag(0, 3), ) + Return"#]], ); } @@ -554,7 +554,7 @@ fn call_to_operation_that_returns_dynamic_bool() { Variable(0, Boolean) = Call id(2), args( Result(0), ) Variable(1, Boolean) = Icmp Eq, Variable(0, Boolean), Bool(false) Variable(2, Boolean) = Store Variable(1, Boolean) - Call id(3), args( Variable(2, Boolean), Pointer, ) + Call id(3), args( Variable(2, Boolean), Tag(0, 3), ) Return"#]], ); } @@ -613,7 +613,7 @@ fn call_to_boolean_function_using_result_literal_as_argument_yields_constant() { &expect![[r#" Block: Call id(1), args( Qubit(0), ) - Call id(2), args( Integer(0), Pointer, ) + Call id(2), args( Integer(0), EmptyTag, ) Return"#]], ); } @@ -702,7 +702,7 @@ fn call_to_boolean_function_using_dynamic_result_as_argument_generates_branches( Variable(1, Boolean) = Store Variable(0, Boolean) Branch Variable(1, Boolean), 2, 1 Block 1:Block: - Call id(4), args( Integer(0), Pointer, ) + Call id(4), args( Integer(0), EmptyTag, ) Return Block 2:Block: Call id(3), args( Qubit(1), ) @@ -780,7 +780,7 @@ fn call_to_unitary_operation_with_one_qubit_argument_using_one_control_qubit() { Block: Call id(1), args( Qubit(1), ) Call id(2), args( Qubit(0), Qubit(1), ) - Call id(3), args( Integer(0), Pointer, ) + Call id(3), args( Integer(0), EmptyTag, ) Return"#]], ); } @@ -856,7 +856,7 @@ fn call_to_unitary_operation_with_one_qubit_argument_using_mutiple_control_qubit Block: Call id(1), args( Qubit(2), ) Call id(2), args( Qubit(0), Qubit(1), Qubit(2), ) - Call id(3), args( Integer(0), Pointer, ) + Call id(3), args( Integer(0), EmptyTag, ) Return"#]], ); } @@ -933,7 +933,7 @@ fn call_to_unitary_operation_with_two_qubit_arguments_using_one_control_qubit() Block: Call id(1), args( Qubit(1), Qubit(2), ) Call id(2), args( Qubit(0), Qubit(1), Qubit(2), ) - Call id(3), args( Integer(0), Pointer, ) + Call id(3), args( Integer(0), EmptyTag, ) Return"#]], ); } @@ -1049,7 +1049,7 @@ fn call_to_unitary_operation_using_multiple_controlled_functors() { Call id(2), args( Qubit(1), Qubit(0), ) Call id(3), args( Qubit(1), Qubit(2), Qubit(0), ) Call id(4), args( Qubit(3), ) - Call id(5), args( Integer(0), Pointer, ) + Call id(5), args( Integer(0), EmptyTag, ) Return"#]], ); } @@ -1084,10 +1084,10 @@ fn call_to_closue_with_no_bound_locals() { &program, BlockId(0), &expect![[r#" - Block: - Call id(1), args( Qubit(0), ) - Call id(2), args( Integer(0), Pointer, ) - Return"#]], + Block: + Call id(1), args( Qubit(0), ) + Call id(2), args( Integer(0), EmptyTag, ) + Return"#]], ); } @@ -1124,7 +1124,7 @@ fn call_to_closue_with_one_bound_local() { &expect![[r#" Block: Call id(1), args( Double(1), Qubit(0), ) - Call id(2), args( Integer(0), Pointer, ) + Call id(2), args( Integer(0), EmptyTag, ) Return"#]], ); } @@ -1162,7 +1162,7 @@ fn call_to_closue_with_two_bound_locals() { &expect![[r#" Block: Call id(1), args( Double(1), Qubit(0), ) - Call id(2), args( Integer(0), Pointer, ) + Call id(2), args( Integer(0), EmptyTag, ) Return"#]], ); } @@ -1200,7 +1200,7 @@ fn call_to_closue_with_one_bound_local_two_unbound() { &expect![[r#" Block: Call id(1), args( Double(1), Qubit(0), ) - Call id(2), args( Integer(0), Pointer, ) + Call id(2), args( Integer(0), EmptyTag, ) Return"#]], ); } @@ -1228,10 +1228,10 @@ fn call_to_unresolved_callee_with_classical_arg_allowed() { &program, BlockId(0), &expect![[r#" - Block: - Call id(1), args( Double(1), Qubit(0), ) - Call id(2), args( Integer(0), Pointer, ) - Return"#]], + Block: + Call id(1), args( Double(1), Qubit(0), ) + Call id(2), args( Integer(0), EmptyTag, ) + Return"#]], ); } @@ -1343,7 +1343,7 @@ fn call_to_unresolved_callee_with_static_arg_and_entry_return_value_succeeds() { Block: Call id(1), args( Double(1), Qubit(0), ) Call id(2), args( Qubit(0), Result(0), ) - Call id(3), args( Result(0), Pointer, ) + Call id(3), args( Result(0), Tag(0, 3), ) Return"#]], ); } diff --git a/source/compiler/qsc_partial_eval/src/tests/classical_args.rs b/source/compiler/qsc_partial_eval/src/tests/classical_args.rs index c8dfa2376d..c962848d93 100644 --- a/source/compiler/qsc_partial_eval/src/tests/classical_args.rs +++ b/source/compiler/qsc_partial_eval/src/tests/classical_args.rs @@ -36,7 +36,7 @@ fn call_to_intrinsic_operation_using_double_literal() { &expect![[r#" Block: Call id(1), args( Double(1), ) - Call id(2), args( Integer(0), Pointer, ) + Call id(2), args( Integer(0), EmptyTag, ) Return"#]], ); } @@ -76,7 +76,7 @@ fn calls_to_intrinsic_operation_using_inline_expressions() { Call id(1), args( Double(0), ) Call id(1), args( Double(1), ) Call id(1), args( Double(1), ) - Call id(2), args( Integer(0), Pointer, ) + Call id(2), args( Integer(0), EmptyTag, ) Return"#]], ); } @@ -121,7 +121,7 @@ fn calls_to_intrinsic_operation_using_variables() { Call id(1), args( Double(4), ) Variable(0, Double) = Store Double(8) Call id(1), args( Double(8), ) - Call id(2), args( Integer(0), Pointer, ) + Call id(2), args( Integer(0), EmptyTag, ) Return"#]], ); } diff --git a/source/compiler/qsc_partial_eval/src/tests/dynamic_vars.rs b/source/compiler/qsc_partial_eval/src/tests/dynamic_vars.rs index 4c3d0d9295..11eb8e2cd2 100644 --- a/source/compiler/qsc_partial_eval/src/tests/dynamic_vars.rs +++ b/source/compiler/qsc_partial_eval/src/tests/dynamic_vars.rs @@ -63,7 +63,7 @@ fn dynamic_int_from_if_expression_with_single_measurement_comparison_and_classic Branch Variable(1, Boolean), 2, 3 Block 1:Block: Variable(3, Integer) = Store Variable(2, Integer) - Call id(3), args( Integer(0), Pointer, ) + Call id(3), args( Integer(0), EmptyTag, ) Return Block 2:Block: Variable(2, Integer) = Store Integer(0) @@ -162,7 +162,7 @@ fn dynamic_int_from_if_expression_with_single_measurement_comparison_and_non_cla Branch Variable(1, Boolean), 2, 3 Block 1:Block: Variable(3, Integer) = Store Variable(2, Integer) - Call id(5), args( Integer(0), Pointer, ) + Call id(5), args( Integer(0), EmptyTag, ) Return Block 2:Block: Call id(3), args( Qubit(1), ) @@ -198,22 +198,22 @@ fn dynamic_var_across_if_else_static_in_both_branches_constant_folded() { assert_blocks( &program, &expect![[r#" - Blocks: - Block 0:Block: - Variable(0, Integer) = Store Integer(0) - Call id(1), args( Qubit(0), Result(0), ) - Variable(1, Boolean) = Call id(2), args( Result(0), ) - Variable(2, Boolean) = Icmp Eq, Variable(1, Boolean), Bool(false) - Branch Variable(2, Boolean), 2, 3 - Block 1:Block: - Call id(3), args( Integer(0), Pointer, ) - Return - Block 2:Block: - Variable(0, Integer) = Store Integer(-1) - Jump(1) - Block 3:Block: - Variable(0, Integer) = Store Integer(1) - Jump(1)"#]], + Blocks: + Block 0:Block: + Variable(0, Integer) = Store Integer(0) + Call id(1), args( Qubit(0), Result(0), ) + Variable(1, Boolean) = Call id(2), args( Result(0), ) + Variable(2, Boolean) = Icmp Eq, Variable(1, Boolean), Bool(false) + Branch Variable(2, Boolean), 2, 3 + Block 1:Block: + Call id(3), args( Integer(0), EmptyTag, ) + Return + Block 2:Block: + Variable(0, Integer) = Store Integer(-1) + Jump(1) + Block 3:Block: + Variable(0, Integer) = Store Integer(1) + Jump(1)"#]], ); } @@ -242,37 +242,37 @@ fn dynamic_var_across_if_else_in_loop_constant_folded_in_first_iteration() { assert_blocks( &program, &expect![[r#" - Blocks: - Block 0:Block: - Variable(0, Integer) = Store Integer(0) - Call id(1), args( Qubit(0), Result(0), ) - Variable(1, Integer) = Store Integer(0) - Variable(2, Boolean) = Call id(2), args( Result(0), ) - Variable(3, Boolean) = Icmp Eq, Variable(2, Boolean), Bool(false) - Branch Variable(3, Boolean), 2, 3 - Block 1:Block: - Variable(1, Integer) = Store Integer(1) - Variable(4, Boolean) = Call id(2), args( Result(0), ) - Variable(5, Boolean) = Icmp Eq, Variable(4, Boolean), Bool(false) - Branch Variable(5, Boolean), 5, 6 - Block 2:Block: - Variable(0, Integer) = Store Integer(-1) - Jump(1) - Block 3:Block: - Variable(0, Integer) = Store Integer(1) - Jump(1) - Block 4:Block: - Variable(1, Integer) = Store Integer(2) - Call id(3), args( Integer(0), Pointer, ) - Return - Block 5:Block: - Variable(6, Integer) = Sub Variable(0, Integer), Integer(1) - Variable(0, Integer) = Store Variable(6, Integer) - Jump(4) - Block 6:Block: - Variable(7, Integer) = Add Variable(0, Integer), Integer(1) - Variable(0, Integer) = Store Variable(7, Integer) - Jump(4)"#]], + Blocks: + Block 0:Block: + Variable(0, Integer) = Store Integer(0) + Call id(1), args( Qubit(0), Result(0), ) + Variable(1, Integer) = Store Integer(0) + Variable(2, Boolean) = Call id(2), args( Result(0), ) + Variable(3, Boolean) = Icmp Eq, Variable(2, Boolean), Bool(false) + Branch Variable(3, Boolean), 2, 3 + Block 1:Block: + Variable(1, Integer) = Store Integer(1) + Variable(4, Boolean) = Call id(2), args( Result(0), ) + Variable(5, Boolean) = Icmp Eq, Variable(4, Boolean), Bool(false) + Branch Variable(5, Boolean), 5, 6 + Block 2:Block: + Variable(0, Integer) = Store Integer(-1) + Jump(1) + Block 3:Block: + Variable(0, Integer) = Store Integer(1) + Jump(1) + Block 4:Block: + Variable(1, Integer) = Store Integer(2) + Call id(3), args( Integer(0), EmptyTag, ) + Return + Block 5:Block: + Variable(6, Integer) = Sub Variable(0, Integer), Integer(1) + Variable(0, Integer) = Store Variable(6, Integer) + Jump(4) + Block 6:Block: + Variable(7, Integer) = Add Variable(0, Integer), Integer(1) + Variable(0, Integer) = Store Variable(7, Integer) + Jump(4)"#]], ); } @@ -323,7 +323,7 @@ fn dynamic_var_within_if_else_in_loop_constant_folded_in_every_iteration() { Jump(1) Block 4:Block: Variable(0, Integer) = Store Integer(2) - Call id(3), args( Integer(0), Pointer, ) + Call id(3), args( Integer(0), EmptyTag, ) Return Block 5:Block: Variable(4, Integer) = Store Integer(-1) @@ -367,7 +367,7 @@ fn dynamic_var_updated_twice_in_same_branch_constant_folded() { Variable(2, Boolean) = Icmp Eq, Variable(1, Boolean), Bool(false) Branch Variable(2, Boolean), 2, 3 Block 1:Block: - Call id(3), args( Integer(0), Pointer, ) + Call id(3), args( Integer(0), EmptyTag, ) Return Block 2:Block: Variable(0, Integer) = Store Integer(-1) @@ -406,25 +406,25 @@ fn dynamic_var_updated_to_same_value_in_different_branches_constant_folded_after assert_blocks( &program, &expect![[r#" - Blocks: - Block 0:Block: - Variable(0, Integer) = Store Integer(0) - Call id(1), args( Qubit(0), Result(0), ) - Variable(1, Boolean) = Call id(2), args( Result(0), ) - Variable(2, Boolean) = Icmp Eq, Variable(1, Boolean), Bool(false) - Branch Variable(2, Boolean), 2, 3 - Block 1:Block: - Variable(0, Integer) = Store Integer(2) - Call id(3), args( Integer(0), Pointer, ) - Return - Block 2:Block: - Variable(0, Integer) = Store Integer(-1) - Variable(0, Integer) = Store Integer(1) - Jump(1) - Block 3:Block: - Variable(0, Integer) = Store Integer(1) - Variable(0, Integer) = Store Integer(1) - Jump(1)"#]], + Blocks: + Block 0:Block: + Variable(0, Integer) = Store Integer(0) + Call id(1), args( Qubit(0), Result(0), ) + Variable(1, Boolean) = Call id(2), args( Result(0), ) + Variable(2, Boolean) = Icmp Eq, Variable(1, Boolean), Bool(false) + Branch Variable(2, Boolean), 2, 3 + Block 1:Block: + Variable(0, Integer) = Store Integer(2) + Call id(3), args( Integer(0), EmptyTag, ) + Return + Block 2:Block: + Variable(0, Integer) = Store Integer(-1) + Variable(0, Integer) = Store Integer(1) + Jump(1) + Block 3:Block: + Variable(0, Integer) = Store Integer(1) + Variable(0, Integer) = Store Integer(1) + Jump(1)"#]], ); } @@ -474,7 +474,7 @@ fn dynamic_var_updated_in_nested_branches_constant_folded_when_value_matches_acr Variable(2, Boolean) = Icmp Eq, Variable(1, Boolean), Bool(false) Branch Variable(2, Boolean), 2, 6 Block 1:Block: - Call id(3), args( Integer(1), Pointer, ) + Call id(3), args( Integer(1), Tag(0, 3), ) Return Block 2:Block: Variable(0, Integer) = Store Integer(-1) @@ -545,7 +545,7 @@ fn dynamic_var_set_to_static_after_dynamism_still_constant_folded() { Variable(0, Integer) = Store Variable(3, Integer) Variable(0, Integer) = Store Integer(3) Variable(0, Integer) = Store Integer(4) - Call id(3), args( Integer(0), Pointer, ) + Call id(3), args( Integer(0), EmptyTag, ) Return Block 2:Block: Variable(0, Integer) = Store Integer(-1) @@ -605,7 +605,7 @@ fn dynamic_var_updated_in_loop_constant_folded_when_every_iteration_results_in_s Block 4:Block: Variable(0, Integer) = Store Integer(0) Variable(1, Integer) = Store Integer(2) - Call id(3), args( Integer(0), Pointer, ) + Call id(3), args( Integer(0), Tag(0, 3), ) Return Block 5:Block: Variable(0, Integer) = Store Integer(-1) @@ -652,9 +652,9 @@ fn immutable_bind_of_dynamic_var_should_be_point_in_time_copy() { Variable(3, Integer) = Store Variable(0, Integer) Variable(4, Integer) = Add Variable(0, Integer), Integer(1) Variable(0, Integer) = Store Variable(4, Integer) - Call id(3), args( Integer(2), Pointer, ) - Call id(4), args( Variable(3, Integer), Pointer, ) - Call id(4), args( Variable(0, Integer), Pointer, ) + Call id(3), args( Integer(2), EmptyTag, ) + Call id(4), args( Variable(3, Integer), Tag(0, 5), ) + Call id(4), args( Variable(0, Integer), Tag(1, 5), ) Return Block 2:Block: Variable(0, Integer) = Store Integer(-1) @@ -717,7 +717,7 @@ fn dynamic_double_from_if_expression_with_single_measurement_comparison_and_clas Branch Variable(1, Boolean), 2, 3 Block 1:Block: Variable(3, Double) = Store Variable(2, Double) - Call id(3), args( Integer(0), Pointer, ) + Call id(3), args( Integer(0), EmptyTag, ) Return Block 2:Block: Variable(2, Double) = Store Double(0.1) @@ -816,7 +816,7 @@ fn dynamic_double_from_if_expression_with_single_measurement_comparison_and_non_ Branch Variable(1, Boolean), 2, 3 Block 1:Block: Variable(3, Double) = Store Variable(2, Double) - Call id(5), args( Integer(0), Pointer, ) + Call id(5), args( Integer(0), EmptyTag, ) Return Block 2:Block: Call id(3), args( Qubit(1), ) @@ -919,7 +919,7 @@ fn dynamic_double_from_if_expression_with_single_measurement_comparison_pass_dyn Block 1:Block: Variable(3, Double) = Store Variable(2, Double) Call id(3), args( Variable(3, Double), Qubit(1), ) - Call id(4), args( Integer(0), Pointer, ) + Call id(4), args( Integer(0), EmptyTag, ) Return Block 2:Block: Variable(2, Double) = Store Double(0.1) diff --git a/source/compiler/qsc_partial_eval/src/tests/intrinsics.rs b/source/compiler/qsc_partial_eval/src/tests/intrinsics.rs index 9d94d31aec..e9cb385940 100644 --- a/source/compiler/qsc_partial_eval/src/tests/intrinsics.rs +++ b/source/compiler/qsc_partial_eval/src/tests/intrinsics.rs @@ -146,7 +146,7 @@ fn call_to_intrinsic_h_adds_callable_and_generates_instruction() { &expect![[r#" Block: Call id(1), args( Qubit(0), ) - Call id(2), args( Integer(0), Pointer, ) + Call id(2), args( Integer(0), EmptyTag, ) Return"#]], ); } @@ -166,7 +166,7 @@ fn call_to_intrinsic_s_adds_callable_and_generates_instruction() { &expect![[r#" Block: Call id(1), args( Qubit(0), ) - Call id(2), args( Integer(0), Pointer, ) + Call id(2), args( Integer(0), EmptyTag, ) Return"#]], ); } @@ -186,7 +186,7 @@ fn call_to_intrinsic_adjoint_s_adds_callable_and_generates_instruction() { &expect![[r#" Block: Call id(1), args( Qubit(0), ) - Call id(2), args( Integer(0), Pointer, ) + Call id(2), args( Integer(0), EmptyTag, ) Return"#]], ); } @@ -206,7 +206,7 @@ fn call_to_intrinsic_sx_adds_callable_and_generates_instruction() { &expect![[r#" Block: Call id(1), args( Qubit(0), ) - Call id(2), args( Integer(0), Pointer, ) + Call id(2), args( Integer(0), EmptyTag, ) Return"#]], ); } @@ -226,7 +226,7 @@ fn call_to_intrinsic_t_adds_callable_and_generates_instruction() { &expect![[r#" Block: Call id(1), args( Qubit(0), ) - Call id(2), args( Integer(0), Pointer, ) + Call id(2), args( Integer(0), EmptyTag, ) Return"#]], ); } @@ -246,7 +246,7 @@ fn call_to_intrinsic_adjoint_t_adds_callable_and_generates_instruction() { &expect![[r#" Block: Call id(1), args( Qubit(0), ) - Call id(2), args( Integer(0), Pointer, ) + Call id(2), args( Integer(0), EmptyTag, ) Return"#]], ); } @@ -266,7 +266,7 @@ fn call_to_intrinsic_x_adds_callable_and_generates_instruction() { &expect![[r#" Block: Call id(1), args( Qubit(0), ) - Call id(2), args( Integer(0), Pointer, ) + Call id(2), args( Integer(0), EmptyTag, ) Return"#]], ); } @@ -286,7 +286,7 @@ fn call_to_intrinsic_y_adds_callable_and_generates_instruction() { &expect![[r#" Block: Call id(1), args( Qubit(0), ) - Call id(2), args( Integer(0), Pointer, ) + Call id(2), args( Integer(0), EmptyTag, ) Return"#]], ); } @@ -306,7 +306,7 @@ fn call_to_intrinsic_z_adds_callable_and_generates_instruction() { &expect![[r#" Block: Call id(1), args( Qubit(0), ) - Call id(2), args( Integer(0), Pointer, ) + Call id(2), args( Integer(0), EmptyTag, ) Return"#]], ); } @@ -327,7 +327,7 @@ fn call_to_intrinsic_swap_adds_callable_and_generates_instruction() { &expect![[r#" Block: Call id(1), args( Qubit(0), Qubit(1), ) - Call id(2), args( Integer(0), Pointer, ) + Call id(2), args( Integer(0), EmptyTag, ) Return"#]], ); } @@ -348,7 +348,7 @@ fn call_to_intrinsic_cx_adds_callable_and_generates_instruction() { &expect![[r#" Block: Call id(1), args( Qubit(0), Qubit(1), ) - Call id(2), args( Integer(0), Pointer, ) + Call id(2), args( Integer(0), EmptyTag, ) Return"#]], ); } @@ -369,7 +369,7 @@ fn call_to_intrinsic_cy_adds_callable_and_generates_instruction() { &expect![[r#" Block: Call id(1), args( Qubit(0), Qubit(1), ) - Call id(2), args( Integer(0), Pointer, ) + Call id(2), args( Integer(0), EmptyTag, ) Return"#]], ); } @@ -390,7 +390,7 @@ fn call_to_intrinsic_cz_adds_callable_and_generates_instruction() { &expect![[r#" Block: Call id(1), args( Qubit(0), Qubit(1), ) - Call id(2), args( Integer(0), Pointer, ) + Call id(2), args( Integer(0), EmptyTag, ) Return"#]], ); } @@ -412,7 +412,7 @@ fn call_to_intrinsic_ccx_adds_callable_and_generates_instruction() { &expect![[r#" Block: Call id(1), args( Qubit(0), Qubit(1), Qubit(2), ) - Call id(2), args( Integer(0), Pointer, ) + Call id(2), args( Integer(0), EmptyTag, ) Return"#]], ); } @@ -433,7 +433,7 @@ fn call_to_intrinsic_rx_adds_callable_and_generates_instruction() { &expect![[r#" Block: Call id(1), args( Double(0), Qubit(0), ) - Call id(2), args( Integer(0), Pointer, ) + Call id(2), args( Integer(0), EmptyTag, ) Return"#]], ); } @@ -455,7 +455,7 @@ fn call_to_intrinsic_rxx_adds_callable_and_generates_instruction() { &expect![[r#" Block: Call id(1), args( Double(0), Qubit(0), Qubit(1), ) - Call id(2), args( Integer(0), Pointer, ) + Call id(2), args( Integer(0), EmptyTag, ) Return"#]], ); } @@ -476,7 +476,7 @@ fn call_to_intrinsic_ry_adds_callable_and_generates_instruction() { &expect![[r#" Block: Call id(1), args( Double(0), Qubit(0), ) - Call id(2), args( Integer(0), Pointer, ) + Call id(2), args( Integer(0), EmptyTag, ) Return"#]], ); } @@ -498,7 +498,7 @@ fn call_to_intrinsic_ryy_adds_callable_and_generates_instruction() { &expect![[r#" Block: Call id(1), args( Double(0), Qubit(0), Qubit(1), ) - Call id(2), args( Integer(0), Pointer, ) + Call id(2), args( Integer(0), EmptyTag, ) Return"#]], ); } @@ -519,7 +519,7 @@ fn call_to_intrinsic_rz_adds_callable_and_generates_instruction() { &expect![[r#" Block: Call id(1), args( Double(0), Qubit(0), ) - Call id(2), args( Integer(0), Pointer, ) + Call id(2), args( Integer(0), EmptyTag, ) Return"#]], ); } @@ -541,7 +541,7 @@ fn call_to_intrinsic_rzz_adds_callable_and_generates_instruction() { &expect![[r#" Block: Call id(1), args( Double(0), Qubit(0), Qubit(1), ) - Call id(2), args( Integer(0), Pointer, ) + Call id(2), args( Integer(0), EmptyTag, ) Return"#]], ); } @@ -578,7 +578,7 @@ fn check_partial_eval_for_call_to_reset() { &expect![[r#" Block: Call id(1), args( Qubit(0), ) - Call id(2), args( Integer(0), Pointer, ) + Call id(2), args( Integer(0), EmptyTag, ) Return"#]], ); } @@ -616,7 +616,7 @@ fn call_to_intrinsic_m_adds_callable_and_generates_instruction() { &expect![[r#" Block: Call id(1), args( Qubit(0), Result(0), ) - Call id(2), args( Integer(0), Pointer, ) + Call id(2), args( Integer(0), EmptyTag, ) Return"#]], ); } @@ -654,7 +654,7 @@ fn call_to_intrinsic_mresetz_adds_callable_and_generates_instruction() { &expect![[r#" Block: Call id(1), args( Qubit(0), Result(0), ) - Call id(2), args( Integer(0), Pointer, ) + Call id(2), args( Integer(0), EmptyTag, ) Return"#]], ); } @@ -699,7 +699,7 @@ fn calls_to_intrinsic_begin_estimate_caching_with_classical_values_always_yield_ Block: Call id(1), args( Qubit(0), ) Call id(1), args( Qubit(0), ) - Call id(2), args( Integer(0), Pointer, ) + Call id(2), args( Integer(0), EmptyTag, ) Return"#]], ); } @@ -789,7 +789,7 @@ fn call_to_intrinsic_begin_estimate_caching_with_dynamic_values_yields_true() { Block 1:Block: Variable(3, Integer) = Store Variable(2, Integer) Call id(3), args( Qubit(0), ) - Call id(4), args( Integer(0), Pointer, ) + Call id(4), args( Integer(0), EmptyTag, ) Return Block 2:Block: Variable(2, Integer) = Store Integer(0) @@ -817,9 +817,9 @@ fn call_to_intrinsic_end_estimate_caching_does_not_generate_instructions() { &program, BlockId(0), &expect![[r#" - Block: - Call id(1), args( Integer(0), Pointer, ) - Return"#]], + Block: + Call id(1), args( Integer(0), EmptyTag, ) + Return"#]], ); } @@ -841,9 +841,9 @@ fn call_to_account_for_estimates_does_not_generate_instructions() { &program, BlockId(0), &expect![[r#" - Block: - Call id(1), args( Integer(0), Pointer, ) - Return"#]], + Block: + Call id(1), args( Integer(0), EmptyTag, ) + Return"#]], ); } @@ -865,9 +865,9 @@ fn call_to_begin_repeat_estimates_does_not_generate_instructions() { &program, BlockId(0), &expect![[r#" - Block: - Call id(1), args( Integer(0), Pointer, ) - Return"#]], + Block: + Call id(1), args( Integer(0), EmptyTag, ) + Return"#]], ); } @@ -889,9 +889,9 @@ fn call_to_end_repeat_estimates_does_not_generate_instructions() { &program, BlockId(0), &expect![[r#" - Block: - Call id(1), args( Integer(0), Pointer, ) - Return"#]], + Block: + Call id(1), args( Integer(0), EmptyTag, ) + Return"#]], ); } @@ -912,9 +912,9 @@ fn call_to_dump_machine_does_not_generate_instructions() { &program, BlockId(0), &expect![[r#" - Block: - Call id(1), args( Integer(0), Pointer, ) - Return"#]], + Block: + Call id(1), args( Integer(0), EmptyTag, ) + Return"#]], ); } @@ -936,9 +936,9 @@ fn call_to_dump_register_does_not_generate_instructions() { &program, BlockId(0), &expect![[r#" - Block: - Call id(1), args( Integer(0), Pointer, ) - Return"#]], + Block: + Call id(1), args( Integer(0), EmptyTag, ) + Return"#]], ); } @@ -962,7 +962,7 @@ fn use_of_noise_does_not_generate_instructions() { BlockId(0), &expect![[r#" Block: - Call id(1), args( Integer(0), Pointer, ) + Call id(1), args( Integer(0), EmptyTag, ) Return"#]], ); } @@ -1087,7 +1087,7 @@ fn call_to_length_in_inner_function_succeeds() { &expect![[r#" Block: Call id(1), args( Qubit(0), Result(0), ) - Call id(2), args( Integer(1), Pointer, ) + Call id(2), args( Integer(1), Tag(0, 3), ) Return"#]], ); } @@ -1109,9 +1109,9 @@ fn call_to_pauli_i_rotation_for_global_phase_is_noop() { &program, BlockId(0), &expect![[r#" - Block: - Call id(1), args( Integer(0), Pointer, ) - Return"#]], + Block: + Call id(1), args( Integer(0), EmptyTag, ) + Return"#]], ); } @@ -1166,12 +1166,12 @@ fn call_to_operation_with_codegen_intrinsic_override_should_skip_impl() { &program, BlockId(0), &expect![[r#" - Block: - Call id(1), args( ) - Call id(2), args( ) - Call id(1), args( ) - Call id(3), args( Integer(0), Pointer, ) - Return"#]], + Block: + Call id(1), args( ) + Call id(2), args( ) + Call id(1), args( ) + Call id(3), args( Integer(0), EmptyTag, ) + Return"#]], ); } @@ -1207,7 +1207,7 @@ fn call_to_intrinsic_operation_that_returns_bool_value_should_produce_variable_u &expect![[r#" Block: Variable(0, Boolean) = Call id(1), args( ) - Call id(2), args( Variable(0, Boolean), Pointer, ) + Call id(2), args( Variable(0, Boolean), Tag(0, 3), ) Return"#]], ); } @@ -1244,7 +1244,7 @@ fn call_to_intrinsic_operation_that_returns_int_value_should_produce_variable_us &expect![[r#" Block: Variable(0, Integer) = Call id(1), args( ) - Call id(2), args( Variable(0, Integer), Pointer, ) + Call id(2), args( Variable(0, Integer), Tag(0, 3), ) Return"#]], ); } @@ -1281,7 +1281,7 @@ fn call_to_intrinsic_operation_that_returns_double_value_should_produce_variable &expect![[r#" Block: Variable(0, Double) = Call id(1), args( ) - Call id(2), args( Variable(0, Double), Pointer, ) + Call id(2), args( Variable(0, Double), Tag(0, 3), ) Return"#]], ); } diff --git a/source/compiler/qsc_partial_eval/src/tests/loops.rs b/source/compiler/qsc_partial_eval/src/tests/loops.rs index ef2d9852a5..c8f8691e8e 100644 --- a/source/compiler/qsc_partial_eval/src/tests/loops.rs +++ b/source/compiler/qsc_partial_eval/src/tests/loops.rs @@ -48,7 +48,7 @@ fn unitary_call_within_a_for_loop() { Variable(0, Integer) = Store Integer(3) Call id(1), args( Qubit(0), ) Variable(0, Integer) = Store Integer(4) - Call id(2), args( Integer(0), Pointer, ) + Call id(2), args( Integer(0), EmptyTag, ) Return"#]], ); } @@ -97,7 +97,7 @@ fn unitary_call_within_a_while_loop() { Variable(0, Integer) = Store Integer(2) Call id(1), args( Qubit(0), ) Variable(0, Integer) = Store Integer(3) - Call id(2), args( Integer(0), Pointer, ) + Call id(2), args( Integer(0), EmptyTag, ) Return"#]], ); } @@ -150,7 +150,7 @@ fn unitary_call_within_a_repeat_until_loop() { Call id(1), args( Qubit(0), ) Variable(0, Integer) = Store Integer(3) Variable(1, Boolean) = Store Bool(false) - Call id(2), args( Integer(0), Pointer, ) + Call id(2), args( Integer(0), EmptyTag, ) Return"#]], ); } @@ -198,7 +198,7 @@ fn rotation_call_within_a_for_loop() { Variable(0, Integer) = Store Integer(2) Call id(1), args( Double(2), Qubit(0), ) Variable(0, Integer) = Store Integer(3) - Call id(2), args( Integer(0), Pointer, ) + Call id(2), args( Integer(0), EmptyTag, ) Return"#]], ); } @@ -249,7 +249,7 @@ fn rotation_call_within_a_while_loop() { Variable(0, Integer) = Store Integer(2) Call id(1), args( Double(2), Qubit(0), ) Variable(0, Integer) = Store Integer(3) - Call id(2), args( Integer(0), Pointer, ) + Call id(2), args( Integer(0), EmptyTag, ) Return"#]], ); } @@ -304,7 +304,7 @@ fn rotation_call_within_a_repeat_until_loop() { Call id(1), args( Double(2), Qubit(0), ) Variable(0, Integer) = Store Integer(3) Variable(1, Boolean) = Store Bool(false) - Call id(2), args( Integer(0), Pointer, ) + Call id(2), args( Integer(0), EmptyTag, ) Return"#]], ); } @@ -444,7 +444,7 @@ fn mutable_double_updated_in_loop() { Jump(7) Block 9:Block: Variable(1, Integer) = Store Integer(4) - Call id(3), args( Integer(0), Pointer, ) + Call id(3), args( Integer(0), EmptyTag, ) Return Block 10:Block: Variable(13, Double) = Fmul Double(-1), Variable(0, Double) diff --git a/source/compiler/qsc_partial_eval/src/tests/misc.rs b/source/compiler/qsc_partial_eval/src/tests/misc.rs index b416e4ae2d..6783fcae65 100644 --- a/source/compiler/qsc_partial_eval/src/tests/misc.rs +++ b/source/compiler/qsc_partial_eval/src/tests/misc.rs @@ -58,7 +58,7 @@ fn unitary_call_within_an_if_with_classical_condition_within_a_for_loop() { Call id(1), args( Qubit(0), ) Variable(0, Integer) = Store Integer(5) Variable(0, Integer) = Store Integer(6) - Call id(2), args( Integer(0), Pointer, ) + Call id(2), args( Integer(0), EmptyTag, ) Return"#]], ); } @@ -112,7 +112,7 @@ fn unitary_call_within_an_if_with_classical_condition_within_a_while_loop() { Call id(1), args( Qubit(0), ) Variable(0, Integer) = Store Integer(5) Variable(0, Integer) = Store Integer(6) - Call id(2), args( Integer(0), Pointer, ) + Call id(2), args( Integer(0), EmptyTag, ) Return"#]], ); } @@ -173,7 +173,7 @@ fn unitary_call_within_an_if_with_classical_condition_within_a_repeat_until_loop Variable(1, Boolean) = Store Bool(true) Variable(0, Integer) = Store Integer(6) Variable(1, Boolean) = Store Bool(false) - Call id(2), args( Integer(0), Pointer, ) + Call id(2), args( Integer(0), EmptyTag, ) Return"#]], ); } @@ -207,7 +207,7 @@ fn boolean_assign_and_update_with_classical_value_within_an_if_with_dynamic_cond Branch Variable(2, Boolean), 2, 1 Block 1:Block: Variable(3, Boolean) = Store Variable(0, Boolean) - Call id(3), args( Variable(3, Boolean), Pointer, ) + Call id(3), args( Variable(3, Boolean), Tag(0, 3), ) Return Block 2:Block: Variable(0, Boolean) = Store Bool(false) @@ -244,7 +244,7 @@ fn integer_assign_and_update_with_classical_value_within_an_if_with_dynamic_cond Branch Variable(2, Boolean), 2, 1 Block 1:Block: Variable(3, Integer) = Store Variable(0, Integer) - Call id(3), args( Variable(3, Integer), Pointer, ) + Call id(3), args( Variable(3, Integer), Tag(0, 3), ) Return Block 2:Block: Variable(0, Integer) = Store Integer(5) @@ -335,7 +335,7 @@ fn integer_assign_with_hybrid_value_within_an_if_with_dynamic_condition() { Block 3:Block: Variable(1, Integer) = Store Integer(2) Variable(7, Integer) = Store Variable(0, Integer) - Call id(3), args( Variable(7, Integer), Pointer, ) + Call id(3), args( Variable(7, Integer), Tag(0, 3), ) Return Block 4:Block: Variable(6, Integer) = BitwiseOr Variable(0, Integer), Integer(2) @@ -376,7 +376,7 @@ fn large_loop_with_inner_if_completes_eval_and_transform() { Block: Variable(1, Integer) = Store Integer(100) Variable(400, Integer) = Store Variable(0, Integer) - Call id(3), args( Variable(400, Integer), Pointer, ) + Call id(3), args( Variable(400, Integer), Tag(0, 3), ) Return"#]], ); } @@ -475,7 +475,7 @@ fn if_else_expression_with_dynamic_logical_and_condition() { Variable(2, Boolean) = Store Variable(4, Boolean) Jump(1) Block 3:Block: - Call id(5), args( Integer(0), Pointer, ) + Call id(5), args( Integer(0), EmptyTag, ) Return Block 4:Block: Call id(3), args( Qubit(2), ) @@ -580,7 +580,7 @@ fn if_else_expression_with_dynamic_logical_or_condition() { Variable(2, Boolean) = Store Variable(4, Boolean) Jump(1) Block 3:Block: - Call id(5), args( Integer(0), Pointer, ) + Call id(5), args( Integer(0), EmptyTag, ) Return Block 4:Block: Call id(3), args( Qubit(2), ) diff --git a/source/compiler/qsc_partial_eval/src/tests/operators.rs b/source/compiler/qsc_partial_eval/src/tests/operators.rs index 5608ce8e42..c0ba2b8376 100644 --- a/source/compiler/qsc_partial_eval/src/tests/operators.rs +++ b/source/compiler/qsc_partial_eval/src/tests/operators.rs @@ -74,7 +74,7 @@ fn leading_positive_unary_operator_on_integer_does_not_generate_rir_instruction( Block 1:Block: Variable(3, Integer) = Store Variable(2, Integer) Variable(4, Integer) = Store Variable(3, Integer) - Call id(3), args( Variable(4, Integer), Pointer, ) + Call id(3), args( Variable(4, Integer), Tag(0, 3), ) Return Block 2:Block: Variable(2, Integer) = Store Integer(0) @@ -151,7 +151,7 @@ fn leading_negative_unary_operator_on_integer_generates_rir_instruction() { Variable(3, Integer) = Store Variable(2, Integer) Variable(4, Integer) = Mul Integer(-1), Variable(3, Integer) Variable(5, Integer) = Store Variable(4, Integer) - Call id(3), args( Variable(5, Integer), Pointer, ) + Call id(3), args( Variable(5, Integer), Tag(0, 3), ) Return Block 2:Block: Variable(2, Integer) = Store Integer(0) @@ -228,7 +228,7 @@ fn bitwise_not_unary_operator_generates_rir_instruction() { Variable(3, Integer) = Store Variable(2, Integer) Variable(4, Integer) = BitwiseNot Variable(3, Integer) Variable(5, Integer) = Store Variable(4, Integer) - Call id(3), args( Variable(5, Integer), Pointer, ) + Call id(3), args( Variable(5, Integer), Tag(0, 3), ) Return Block 2:Block: Variable(2, Integer) = Store Integer(0) @@ -303,7 +303,7 @@ fn logical_not_unary_operator_generates_logical_not_rir_instruction() { Variable(2, Boolean) = Store Variable(1, Boolean) Variable(3, Boolean) = LogicalNot Variable(2, Boolean) Variable(4, Boolean) = Store Variable(3, Boolean) - Call id(3), args( Variable(4, Boolean), Pointer, ) + Call id(3), args( Variable(4, Boolean), Tag(0, 3), ) Return"#]], ); } @@ -375,7 +375,7 @@ fn comparing_measurement_results_for_equality_adds_read_result_and_comparison_in Variable(1, Boolean) = Call id(2), args( Result(1), ) Variable(2, Boolean) = Icmp Eq, Variable(0, Boolean), Variable(1, Boolean) Variable(3, Boolean) = Store Variable(2, Boolean) - Call id(3), args( Variable(3, Boolean), Pointer, ) + Call id(3), args( Variable(3, Boolean), Tag(0, 3), ) Return"#]], ); assert_eq!(program.num_qubits, 2); @@ -449,7 +449,7 @@ fn comparing_measurement_results_for_inequality_adds_read_result_and_comparison_ Variable(1, Boolean) = Call id(2), args( Result(1), ) Variable(2, Boolean) = Icmp Ne, Variable(0, Boolean), Variable(1, Boolean) Variable(3, Boolean) = Store Variable(2, Boolean) - Call id(3), args( Variable(3, Boolean), Pointer, ) + Call id(3), args( Variable(3, Boolean), Tag(0, 3), ) Return"#]], ); assert_eq!(program.num_qubits, 2); @@ -521,7 +521,7 @@ fn comparing_measurement_result_against_result_literal_for_equality_adds_read_re Variable(0, Boolean) = Call id(2), args( Result(0), ) Variable(1, Boolean) = Icmp Eq, Variable(0, Boolean), Bool(false) Variable(2, Boolean) = Store Variable(1, Boolean) - Call id(3), args( Variable(2, Boolean), Pointer, ) + Call id(3), args( Variable(2, Boolean), Tag(0, 3), ) Return"#]], ); assert_eq!(program.num_qubits, 1); @@ -593,7 +593,7 @@ fn comparing_measurement_result_against_result_literal_for_inequality_adds_read_ Variable(0, Boolean) = Call id(2), args( Result(0), ) Variable(1, Boolean) = Icmp Ne, Variable(0, Boolean), Bool(true) Variable(2, Boolean) = Store Variable(1, Boolean) - Call id(3), args( Variable(2, Boolean), Pointer, ) + Call id(3), args( Variable(2, Boolean), Tag(0, 3), ) Return"#]], ); assert_eq!(program.num_qubits, 1); @@ -666,7 +666,7 @@ fn comparing_lhs_classical_boolean_against_rhs_dynamic_boolean_for_equality() { Variable(2, Boolean) = Store Variable(1, Boolean) Variable(3, Boolean) = Icmp Eq, Bool(false), Variable(2, Boolean) Variable(4, Boolean) = Store Variable(3, Boolean) - Call id(3), args( Variable(4, Boolean), Pointer, ) + Call id(3), args( Variable(4, Boolean), Tag(0, 3), ) Return"#]], ); } @@ -738,7 +738,7 @@ fn comparing_lhs_dynamic_boolean_against_rhs_dynamic_boolean_for_equality() { Variable(3, Boolean) = Icmp Eq, Variable(2, Boolean), Bool(false) Variable(4, Boolean) = Icmp Eq, Variable(1, Boolean), Variable(3, Boolean) Variable(5, Boolean) = Store Variable(4, Boolean) - Call id(3), args( Variable(5, Boolean), Pointer, ) + Call id(3), args( Variable(5, Boolean), Tag(0, 3), ) Return"#]], ); } @@ -809,7 +809,7 @@ fn comparing_lhs_classical_boolean_against_rhs_dynamic_boolean_for_inequality() Variable(2, Boolean) = Store Variable(1, Boolean) Variable(3, Boolean) = Icmp Ne, Bool(true), Variable(2, Boolean) Variable(4, Boolean) = Store Variable(3, Boolean) - Call id(3), args( Variable(4, Boolean), Pointer, ) + Call id(3), args( Variable(4, Boolean), Tag(0, 3), ) Return"#]], ); } @@ -881,7 +881,7 @@ fn comparing_lhs_dynamic_boolean_against_rhs_dynamic_boolean_for_inequality() { Variable(3, Boolean) = Icmp Eq, Variable(2, Boolean), Bool(false) Variable(4, Boolean) = Icmp Ne, Variable(1, Boolean), Variable(3, Boolean) Variable(5, Boolean) = Store Variable(4, Boolean) - Call id(3), args( Variable(5, Boolean), Pointer, ) + Call id(3), args( Variable(5, Boolean), Tag(0, 3), ) Return"#]], ); } @@ -951,7 +951,7 @@ fn logical_and_with_lhs_classical_true_is_optimized_as_store() { Variable(1, Boolean) = Store Variable(0, Boolean) Variable(2, Boolean) = Store Variable(1, Boolean) Variable(3, Boolean) = Store Variable(2, Boolean) - Call id(3), args( Variable(3, Boolean), Pointer, ) + Call id(3), args( Variable(3, Boolean), Tag(0, 3), ) Return"#]], ); } @@ -1020,7 +1020,7 @@ fn logical_and_with_lhs_classical_false_short_circuits_evaluation() { Variable(0, Boolean) = Call id(2), args( Result(0), ) Variable(1, Boolean) = Store Variable(0, Boolean) Variable(2, Boolean) = Store Variable(1, Boolean) - Call id(3), args( Bool(false), Pointer, ) + Call id(3), args( Bool(false), Tag(0, 3), ) Return"#]], ); } @@ -1091,7 +1091,7 @@ fn logical_and_with_dynamic_lhs_and_dynamic_rhs_short_circuits_when_lhs_is_false Branch Variable(1, Boolean), 2, 1 Block 1:Block: Variable(5, Boolean) = Store Variable(2, Boolean) - Call id(3), args( Variable(5, Boolean), Pointer, ) + Call id(3), args( Variable(5, Boolean), Tag(0, 3), ) Return Block 2:Block: Call id(1), args( Qubit(0), Result(1), ) @@ -1166,7 +1166,7 @@ fn logical_or_with_lhs_classical_true_short_circuits_evaluation() { Variable(0, Boolean) = Call id(2), args( Result(0), ) Variable(1, Boolean) = Store Variable(0, Boolean) Variable(2, Boolean) = Store Variable(1, Boolean) - Call id(3), args( Bool(true), Pointer, ) + Call id(3), args( Bool(true), Tag(0, 3), ) Return"#]], ); } @@ -1236,7 +1236,7 @@ fn logical_or_with_lhs_classical_false_is_optimized_as_store() { Variable(1, Boolean) = Store Variable(0, Boolean) Variable(2, Boolean) = Store Variable(1, Boolean) Variable(3, Boolean) = Store Variable(2, Boolean) - Call id(3), args( Variable(3, Boolean), Pointer, ) + Call id(3), args( Variable(3, Boolean), Tag(0, 3), ) Return"#]], ); } @@ -1307,7 +1307,7 @@ fn logical_or_with_dynamic_lhs_and_dynamic_rhs_short_circuits_when_rhs_is_true() Branch Variable(1, Boolean), 1, 2 Block 1:Block: Variable(5, Boolean) = Store Variable(2, Boolean) - Call id(3), args( Variable(5, Boolean), Pointer, ) + Call id(3), args( Variable(5, Boolean), Tag(0, 3), ) Return Block 2:Block: Call id(1), args( Qubit(0), Result(1), ) @@ -1393,7 +1393,7 @@ fn logical_and_and_sequence_with_dynamic_operands() { Jump(1) Block 3:Block: Variable(8, Boolean) = Store Variable(5, Boolean) - Call id(3), args( Variable(8, Boolean), Pointer, ) + Call id(3), args( Variable(8, Boolean), Tag(0, 3), ) Return Block 4:Block: Call id(1), args( Qubit(2), Result(2), ) @@ -1479,7 +1479,7 @@ fn logical_and_or_sequence_with_dynamic_operands() { Jump(1) Block 3:Block: Variable(8, Boolean) = Store Variable(5, Boolean) - Call id(3), args( Variable(8, Boolean), Pointer, ) + Call id(3), args( Variable(8, Boolean), Tag(0, 3), ) Return Block 4:Block: Call id(1), args( Qubit(2), Result(2), ) @@ -1556,7 +1556,7 @@ fn logical_or_and_sequence_with_dynamic_operands() { Branch Variable(1, Boolean), 1, 2 Block 1:Block: Variable(8, Boolean) = Store Variable(2, Boolean) - Call id(3), args( Variable(8, Boolean), Pointer, ) + Call id(3), args( Variable(8, Boolean), Tag(0, 3), ) Return Block 2:Block: Call id(1), args( Qubit(1), Result(1), ) @@ -1651,7 +1651,7 @@ fn logical_or_or_sequence_with_dynamic_operands() { Jump(1) Block 3:Block: Variable(8, Boolean) = Store Variable(5, Boolean) - Call id(3), args( Variable(8, Boolean), Pointer, ) + Call id(3), args( Variable(8, Boolean), Tag(0, 3), ) Return Block 4:Block: Call id(1), args( Qubit(2), Result(2), ) @@ -1730,7 +1730,7 @@ fn integer_add_with_lhs_classical_integer_and_rhs_dynamic_integer() { Variable(3, Integer) = Store Variable(2, Integer) Variable(4, Integer) = Add Integer(1), Variable(3, Integer) Variable(5, Integer) = Store Variable(4, Integer) - Call id(3), args( Variable(5, Integer), Pointer, ) + Call id(3), args( Variable(5, Integer), Tag(0, 3), ) Return Block 2:Block: Variable(2, Integer) = Store Integer(0) @@ -1809,7 +1809,7 @@ fn integer_sub_with_lhs_dynamic_integer_and_rhs_classical_integer() { Variable(3, Integer) = Store Variable(2, Integer) Variable(4, Integer) = Sub Variable(3, Integer), Integer(1) Variable(5, Integer) = Store Variable(4, Integer) - Call id(3), args( Variable(5, Integer), Pointer, ) + Call id(3), args( Variable(5, Integer), Tag(0, 3), ) Return Block 2:Block: Variable(2, Integer) = Store Integer(0) @@ -1901,7 +1901,7 @@ fn integer_mul_with_lhs_dynamic_integer_and_rhs_dynamic_integer() { Variable(7, Integer) = Store Variable(6, Integer) Variable(8, Integer) = Mul Variable(3, Integer), Variable(7, Integer) Variable(9, Integer) = Store Variable(8, Integer) - Call id(3), args( Variable(9, Integer), Pointer, ) + Call id(3), args( Variable(9, Integer), Tag(0, 3), ) Return Block 5:Block: Variable(6, Integer) = Store Integer(1) @@ -1980,7 +1980,7 @@ fn integer_div_with_lhs_classical_integer_and_rhs_dynamic_integer() { Variable(3, Integer) = Store Variable(2, Integer) Variable(4, Integer) = Sdiv Integer(1), Variable(3, Integer) Variable(5, Integer) = Store Variable(4, Integer) - Call id(3), args( Variable(5, Integer), Pointer, ) + Call id(3), args( Variable(5, Integer), Tag(0, 3), ) Return Block 2:Block: Variable(2, Integer) = Store Integer(0) @@ -2081,7 +2081,7 @@ fn integer_mod_with_lhs_dynamic_integer_and_rhs_classical_integer() { Variable(3, Integer) = Store Variable(2, Integer) Variable(4, Integer) = Srem Variable(3, Integer), Integer(1) Variable(5, Integer) = Store Variable(4, Integer) - Call id(3), args( Variable(5, Integer), Pointer, ) + Call id(3), args( Variable(5, Integer), Tag(0, 3), ) Return Block 2:Block: Variable(2, Integer) = Store Integer(0) @@ -2205,7 +2205,7 @@ fn integer_exponentiation_with_lhs_dynamic_integer_and_rhs_classical_zero_intege Variable(3, Integer) = Store Variable(2, Integer) Variable(4, Integer) = Store Integer(1) Variable(5, Integer) = Store Variable(4, Integer) - Call id(3), args( Variable(5, Integer), Pointer, ) + Call id(3), args( Variable(5, Integer), Tag(0, 3), ) Return Block 2:Block: Variable(2, Integer) = Store Integer(0) @@ -2287,7 +2287,7 @@ fn integer_exponentiation_with_lhs_dynamic_integer_and_rhs_classical_positive_in Variable(6, Integer) = Mul Variable(5, Integer), Variable(3, Integer) Variable(7, Integer) = Mul Variable(6, Integer), Variable(3, Integer) Variable(8, Integer) = Store Variable(7, Integer) - Call id(3), args( Variable(8, Integer), Pointer, ) + Call id(3), args( Variable(8, Integer), Tag(0, 3), ) Return Block 2:Block: Variable(2, Integer) = Store Integer(0) @@ -2402,7 +2402,7 @@ fn integer_bitwise_and_with_lhs_dynamic_integer_and_rhs_dynamic_integer() { Variable(7, Integer) = Store Variable(6, Integer) Variable(8, Integer) = BitwiseAnd Variable(3, Integer), Variable(7, Integer) Variable(9, Integer) = Store Variable(8, Integer) - Call id(3), args( Variable(9, Integer), Pointer, ) + Call id(3), args( Variable(9, Integer), Tag(0, 3), ) Return Block 5:Block: Variable(6, Integer) = Store Integer(1) @@ -2481,7 +2481,7 @@ fn integer_bitwise_or_with_lhs_classical_integer_and_rhs_dynamic_integer() { Variable(3, Integer) = Store Variable(2, Integer) Variable(4, Integer) = BitwiseOr Integer(1), Variable(3, Integer) Variable(5, Integer) = Store Variable(4, Integer) - Call id(3), args( Variable(5, Integer), Pointer, ) + Call id(3), args( Variable(5, Integer), Tag(0, 3), ) Return Block 2:Block: Variable(2, Integer) = Store Integer(0) @@ -2560,7 +2560,7 @@ fn integer_bitwise_xor_with_lhs_dynamic_integer_and_rhs_classical_integer() { Variable(3, Integer) = Store Variable(2, Integer) Variable(4, Integer) = BitwiseXor Variable(3, Integer), Integer(1) Variable(5, Integer) = Store Variable(4, Integer) - Call id(3), args( Variable(5, Integer), Pointer, ) + Call id(3), args( Variable(5, Integer), Tag(0, 3), ) Return Block 2:Block: Variable(2, Integer) = Store Integer(0) @@ -2652,7 +2652,7 @@ fn integer_bitwise_left_shif_with_lhs_dynamic_integer_and_rhs_dynamic_integer() Variable(7, Integer) = Store Variable(6, Integer) Variable(8, Integer) = Shl Variable(3, Integer), Variable(7, Integer) Variable(9, Integer) = Store Variable(8, Integer) - Call id(3), args( Variable(9, Integer), Pointer, ) + Call id(3), args( Variable(9, Integer), Tag(0, 3), ) Return Block 5:Block: Variable(6, Integer) = Store Integer(1) @@ -2731,7 +2731,7 @@ fn integer_bitwise_right_shift_with_lhs_classical_integer_and_rhs_dynamic_intege Variable(3, Integer) = Store Variable(2, Integer) Variable(4, Integer) = Ashr Integer(1), Variable(3, Integer) Variable(5, Integer) = Store Variable(4, Integer) - Call id(3), args( Variable(5, Integer), Pointer, ) + Call id(3), args( Variable(5, Integer), Tag(0, 3), ) Return Block 2:Block: Variable(2, Integer) = Store Integer(0) @@ -2810,7 +2810,7 @@ fn integer_equality_comparison_with_lhs_dynamic_integer_and_rhs_classical_intege Variable(3, Integer) = Store Variable(2, Integer) Variable(4, Boolean) = Icmp Eq, Variable(3, Integer), Integer(1) Variable(5, Boolean) = Store Variable(4, Boolean) - Call id(3), args( Variable(5, Boolean), Pointer, ) + Call id(3), args( Variable(5, Boolean), Tag(0, 3), ) Return Block 2:Block: Variable(2, Integer) = Store Integer(0) @@ -2902,7 +2902,7 @@ fn integer_inequality_comparison_with_lhs_dynamic_integer_and_rhs_dynamic_intege Variable(7, Integer) = Store Variable(6, Integer) Variable(8, Boolean) = Icmp Ne, Variable(3, Integer), Variable(7, Integer) Variable(9, Boolean) = Store Variable(8, Boolean) - Call id(3), args( Variable(9, Boolean), Pointer, ) + Call id(3), args( Variable(9, Boolean), Tag(0, 3), ) Return Block 5:Block: Variable(6, Integer) = Store Integer(1) @@ -2981,7 +2981,7 @@ fn integer_greater_than_comparison_with_lhs_classical_integer_and_rhs_dynamic_in Variable(3, Integer) = Store Variable(2, Integer) Variable(4, Boolean) = Icmp Sgt, Integer(1), Variable(3, Integer) Variable(5, Boolean) = Store Variable(4, Boolean) - Call id(3), args( Variable(5, Boolean), Pointer, ) + Call id(3), args( Variable(5, Boolean), Tag(0, 3), ) Return Block 2:Block: Variable(2, Integer) = Store Integer(0) @@ -3060,7 +3060,7 @@ fn integer_greater_or_equal_than_comparison_with_lhs_dynamic_integer_and_rhs_cla Variable(3, Integer) = Store Variable(2, Integer) Variable(4, Boolean) = Icmp Sge, Variable(3, Integer), Integer(1) Variable(5, Boolean) = Store Variable(4, Boolean) - Call id(3), args( Variable(5, Boolean), Pointer, ) + Call id(3), args( Variable(5, Boolean), Tag(0, 3), ) Return Block 2:Block: Variable(2, Integer) = Store Integer(0) @@ -3152,7 +3152,7 @@ fn integer_less_than_comparison_with_lhs_dynamic_integer_and_rhs_dynamic_integer Variable(7, Integer) = Store Variable(6, Integer) Variable(8, Boolean) = Icmp Slt, Variable(3, Integer), Variable(7, Integer) Variable(9, Boolean) = Store Variable(8, Boolean) - Call id(3), args( Variable(9, Boolean), Pointer, ) + Call id(3), args( Variable(9, Boolean), Tag(0, 3), ) Return Block 5:Block: Variable(6, Integer) = Store Integer(1) @@ -3231,7 +3231,7 @@ fn integer_less_or_equal_than_comparison_with_lhs_classical_integer_and_rhs_dyna Variable(3, Integer) = Store Variable(2, Integer) Variable(4, Boolean) = Icmp Sle, Integer(1), Variable(3, Integer) Variable(5, Boolean) = Store Variable(4, Boolean) - Call id(3), args( Variable(5, Boolean), Pointer, ) + Call id(3), args( Variable(5, Boolean), Tag(0, 3), ) Return Block 2:Block: Variable(2, Integer) = Store Integer(0) @@ -3307,7 +3307,7 @@ fn leading_positive_unary_operator_on_double_does_not_generate_rir_instruction() Block 1:Block: Variable(3, Double) = Store Variable(2, Double) Variable(4, Double) = Store Variable(3, Double) - Call id(3), args( Variable(4, Double), Pointer, ) + Call id(3), args( Variable(4, Double), Tag(0, 3), ) Return Block 2:Block: Variable(2, Double) = Store Double(0) @@ -3384,7 +3384,7 @@ fn leading_negative_unary_operator_on_double_generates_rir_instruction() { Variable(3, Double) = Store Variable(2, Double) Variable(4, Double) = Fmul Double(-1), Variable(3, Double) Variable(5, Double) = Store Variable(4, Double) - Call id(3), args( Variable(5, Double), Pointer, ) + Call id(3), args( Variable(5, Double), Tag(0, 3), ) Return Block 2:Block: Variable(2, Double) = Store Double(0) @@ -3463,7 +3463,7 @@ fn double_add_with_lhs_classical_double_and_rhs_dynamic_double() { Variable(3, Double) = Store Variable(2, Double) Variable(4, Double) = Fadd Double(1), Variable(3, Double) Variable(5, Double) = Store Variable(4, Double) - Call id(3), args( Variable(5, Double), Pointer, ) + Call id(3), args( Variable(5, Double), Tag(0, 3), ) Return Block 2:Block: Variable(2, Double) = Store Double(0) @@ -3542,7 +3542,7 @@ fn double_sub_with_lhs_dynamic_double_and_rhs_classical_double() { Variable(3, Double) = Store Variable(2, Double) Variable(4, Double) = Fsub Variable(3, Double), Double(1) Variable(5, Double) = Store Variable(4, Double) - Call id(3), args( Variable(5, Double), Pointer, ) + Call id(3), args( Variable(5, Double), Tag(0, 3), ) Return Block 2:Block: Variable(2, Double) = Store Double(0) @@ -3634,7 +3634,7 @@ fn double_mul_with_lhs_dynamic_double_and_rhs_dynamic_double() { Variable(7, Double) = Store Variable(6, Double) Variable(8, Double) = Fmul Variable(3, Double), Variable(7, Double) Variable(9, Double) = Store Variable(8, Double) - Call id(3), args( Variable(9, Double), Pointer, ) + Call id(3), args( Variable(9, Double), Tag(0, 3), ) Return Block 5:Block: Variable(6, Double) = Store Double(1.1) @@ -3713,7 +3713,7 @@ fn double_div_with_lhs_classical_double_and_rhs_dynamic_double() { Variable(3, Double) = Store Variable(2, Double) Variable(4, Double) = Fdiv Double(1), Variable(3, Double) Variable(5, Double) = Store Variable(4, Double) - Call id(3), args( Variable(5, Double), Pointer, ) + Call id(3), args( Variable(5, Double), Tag(0, 3), ) Return Block 2:Block: Variable(2, Double) = Store Double(0) @@ -3814,7 +3814,7 @@ fn double_equality_comparison_with_lhs_dynamic_double_and_rhs_classical_double() Variable(3, Double) = Store Variable(2, Double) Variable(4, Boolean) = Fcmp Oeq, Variable(3, Double), Double(1) Variable(5, Boolean) = Store Variable(4, Boolean) - Call id(3), args( Variable(5, Boolean), Pointer, ) + Call id(3), args( Variable(5, Boolean), Tag(0, 3), ) Return Block 2:Block: Variable(2, Double) = Store Double(0) @@ -3906,7 +3906,7 @@ fn double_inequality_comparison_with_lhs_dynamic_double_and_rhs_dynamic_double() Variable(7, Double) = Store Variable(6, Double) Variable(8, Boolean) = Fcmp One, Variable(3, Double), Variable(7, Double) Variable(9, Boolean) = Store Variable(8, Boolean) - Call id(3), args( Variable(9, Boolean), Pointer, ) + Call id(3), args( Variable(9, Boolean), Tag(0, 3), ) Return Block 5:Block: Variable(6, Double) = Store Double(1.1) @@ -3985,7 +3985,7 @@ fn double_greater_than_comparison_with_lhs_classical_double_and_rhs_dynamic_doub Variable(3, Double) = Store Variable(2, Double) Variable(4, Boolean) = Fcmp Ogt, Double(1), Variable(3, Double) Variable(5, Boolean) = Store Variable(4, Boolean) - Call id(3), args( Variable(5, Boolean), Pointer, ) + Call id(3), args( Variable(5, Boolean), Tag(0, 3), ) Return Block 2:Block: Variable(2, Double) = Store Double(0) @@ -4064,7 +4064,7 @@ fn double_greater_or_equal_than_comparison_with_lhs_dynamic_double_and_rhs_class Variable(3, Double) = Store Variable(2, Double) Variable(4, Boolean) = Fcmp Oge, Variable(3, Double), Double(1) Variable(5, Boolean) = Store Variable(4, Boolean) - Call id(3), args( Variable(5, Boolean), Pointer, ) + Call id(3), args( Variable(5, Boolean), Tag(0, 3), ) Return Block 2:Block: Variable(2, Double) = Store Double(0) @@ -4156,7 +4156,7 @@ fn double_less_than_comparison_with_lhs_dynamic_double_and_rhs_dynamic_double() Variable(7, Double) = Store Variable(6, Double) Variable(8, Boolean) = Fcmp Olt, Variable(3, Double), Variable(7, Double) Variable(9, Boolean) = Store Variable(8, Boolean) - Call id(3), args( Variable(9, Boolean), Pointer, ) + Call id(3), args( Variable(9, Boolean), Tag(0, 3), ) Return Block 5:Block: Variable(6, Double) = Store Double(1.1) @@ -4235,7 +4235,7 @@ fn double_less_or_equal_than_comparison_with_lhs_classical_double_and_rhs_dynami Variable(3, Double) = Store Variable(2, Double) Variable(4, Boolean) = Fcmp Ole, Double(1), Variable(3, Double) Variable(5, Boolean) = Store Variable(4, Boolean) - Call id(3), args( Variable(5, Boolean), Pointer, ) + Call id(3), args( Variable(5, Boolean), Tag(0, 3), ) Return Block 2:Block: Variable(2, Double) = Store Double(0) diff --git a/source/compiler/qsc_partial_eval/src/tests/output_recording.rs b/source/compiler/qsc_partial_eval/src/tests/output_recording.rs index 2ac2984386..3999dada91 100644 --- a/source/compiler/qsc_partial_eval/src/tests/output_recording.rs +++ b/source/compiler/qsc_partial_eval/src/tests/output_recording.rs @@ -74,14 +74,18 @@ fn output_recording_for_tuple_of_different_types() { Call id(1), args( Qubit(0), Result(0), ) Variable(0, Boolean) = Call id(2), args( Result(0), ) Variable(1, Boolean) = Icmp Eq, Variable(0, Boolean), Bool(false) - Call id(3), args( Integer(2), Pointer, ) - Call id(4), args( Result(0), Pointer, ) - Call id(5), args( Variable(1, Boolean), Pointer, ) + Call id(3), args( Integer(2), EmptyTag, ) + Call id(4), args( Result(0), Tag(0, 5), ) + Call id(5), args( Variable(1, Boolean), Tag(1, 5), ) Return config: Config: capabilities: TargetCapabilityFlags(Adaptive | IntegerComputations | FloatingPointComputations | BackwardsBranching | HigherLevelConstructs | QubitReset) num_qubits: 1 - num_results: 1"#]] + num_results: 1 + tags: + [0]: 0_t0r + [1]: 1_t1b + "#]] .assert_eq(&program.to_string()); } @@ -156,18 +160,24 @@ fn output_recording_for_nested_tuples() { Variable(1, Boolean) = Icmp Eq, Variable(0, Boolean), Bool(false) Variable(2, Boolean) = Call id(2), args( Result(0), ) Variable(3, Boolean) = Store Variable(2, Boolean) - Call id(3), args( Integer(3), Pointer, ) - Call id(4), args( Result(0), Pointer, ) - Call id(3), args( Integer(2), Pointer, ) - Call id(5), args( Variable(1, Boolean), Pointer, ) - Call id(4), args( Result(0), Pointer, ) - Call id(3), args( Integer(1), Pointer, ) - Call id(5), args( Variable(3, Boolean), Pointer, ) + Call id(3), args( Integer(3), EmptyTag, ) + Call id(4), args( Result(0), Tag(0, 5), ) + Call id(3), args( Integer(2), EmptyTag, ) + Call id(5), args( Variable(1, Boolean), Tag(1, 7), ) + Call id(4), args( Result(0), Tag(2, 7), ) + Call id(3), args( Integer(1), EmptyTag, ) + Call id(5), args( Variable(3, Boolean), Tag(3, 7), ) Return config: Config: capabilities: TargetCapabilityFlags(Adaptive | IntegerComputations | FloatingPointComputations | BackwardsBranching | HigherLevelConstructs | QubitReset) num_qubits: 1 - num_results: 1"#]] + num_results: 1 + tags: + [0]: 0_t0r + [1]: 1_t1t0b + [2]: 2_t1t1r + [3]: 3_t2t0b + "#]] .assert_eq(&program.to_string()); } @@ -252,16 +262,21 @@ fn output_recording_for_tuple_of_arrays() { Variable(1, Boolean) = Icmp Eq, Variable(0, Boolean), Bool(false) Variable(2, Boolean) = Call id(2), args( Result(0), ) Variable(3, Boolean) = Store Variable(2, Boolean) - Call id(3), args( Integer(2), Pointer, ) - Call id(4), args( Result(0), Pointer, ) - Call id(5), args( Integer(2), Pointer, ) - Call id(6), args( Variable(1, Boolean), Pointer, ) - Call id(6), args( Variable(3, Boolean), Pointer, ) + Call id(3), args( Integer(2), EmptyTag, ) + Call id(4), args( Result(0), Tag(0, 5), ) + Call id(5), args( Integer(2), EmptyTag, ) + Call id(6), args( Variable(1, Boolean), Tag(1, 7), ) + Call id(6), args( Variable(3, Boolean), Tag(2, 7), ) Return config: Config: capabilities: TargetCapabilityFlags(Adaptive | IntegerComputations | FloatingPointComputations | BackwardsBranching | HigherLevelConstructs | QubitReset) num_qubits: 1 - num_results: 1"#]] + num_results: 1 + tags: + [0]: 0_t0r + [1]: 1_t1a0b + [2]: 2_t1a1b + "#]] .assert_eq(&program.to_string()); } @@ -344,18 +359,24 @@ fn output_recording_for_array_of_tuples() { Variable(1, Boolean) = Icmp Eq, Variable(0, Boolean), Bool(false) Variable(2, Boolean) = Call id(2), args( Result(0), ) Variable(3, Boolean) = Store Variable(2, Boolean) - Call id(3), args( Integer(2), Pointer, ) - Call id(4), args( Integer(2), Pointer, ) - Call id(5), args( Result(0), Pointer, ) - Call id(6), args( Variable(1, Boolean), Pointer, ) - Call id(4), args( Integer(2), Pointer, ) - Call id(5), args( Result(0), Pointer, ) - Call id(6), args( Variable(3, Boolean), Pointer, ) + Call id(3), args( Integer(2), EmptyTag, ) + Call id(4), args( Integer(2), EmptyTag, ) + Call id(5), args( Result(0), Tag(0, 7), ) + Call id(6), args( Variable(1, Boolean), Tag(1, 7), ) + Call id(4), args( Integer(2), EmptyTag, ) + Call id(5), args( Result(0), Tag(2, 7), ) + Call id(6), args( Variable(3, Boolean), Tag(3, 7), ) Return config: Config: capabilities: TargetCapabilityFlags(Adaptive | IntegerComputations | FloatingPointComputations | BackwardsBranching | HigherLevelConstructs | QubitReset) num_qubits: 1 - num_results: 1"#]] + num_results: 1 + tags: + [0]: 0_a0t0r + [1]: 1_a0t1b + [2]: 2_a1t0r + [3]: 3_a1t1b + "#]] .assert_eq(&program.to_string()); } @@ -392,12 +413,15 @@ fn output_recording_for_literal_bool() { body: blocks: Block 0: Block: - Call id(1), args( Bool(true), Pointer, ) + Call id(1), args( Bool(true), Tag(0, 3), ) Return config: Config: capabilities: TargetCapabilityFlags(Adaptive | IntegerComputations | FloatingPointComputations | BackwardsBranching | HigherLevelConstructs | QubitReset) num_qubits: 0 - num_results: 0"#]] + num_results: 0 + tags: + [0]: 0_b + "#]] .assert_eq(&program.to_string()); } @@ -434,12 +458,15 @@ fn output_recording_for_literal_double() { body: blocks: Block 0: Block: - Call id(1), args( Double(42.1), Pointer, ) + Call id(1), args( Double(42.1), Tag(0, 3), ) Return config: Config: capabilities: TargetCapabilityFlags(Adaptive | IntegerComputations | FloatingPointComputations | BackwardsBranching | HigherLevelConstructs | QubitReset) num_qubits: 0 - num_results: 0"#]] + num_results: 0 + tags: + [0]: 0_d + "#]] .assert_eq(&program.to_string()); } @@ -476,12 +503,15 @@ fn output_recording_for_literal_int() { body: blocks: Block 0: Block: - Call id(1), args( Integer(42), Pointer, ) + Call id(1), args( Integer(42), Tag(0, 3), ) Return config: Config: capabilities: TargetCapabilityFlags(Adaptive | IntegerComputations | FloatingPointComputations | BackwardsBranching | HigherLevelConstructs | QubitReset) num_qubits: 0 - num_results: 0"#]] + num_results: 0 + tags: + [0]: 0_i + "#]] .assert_eq(&program.to_string()); } @@ -545,14 +575,18 @@ fn output_recording_for_mix_of_literal_and_variable() { blocks: Block 0: Block: Call id(1), args( Qubit(0), Result(0), ) - Call id(2), args( Integer(2), Pointer, ) - Call id(3), args( Result(0), Pointer, ) - Call id(4), args( Bool(true), Pointer, ) + Call id(2), args( Integer(2), EmptyTag, ) + Call id(3), args( Result(0), Tag(0, 5), ) + Call id(4), args( Bool(true), Tag(1, 5), ) Return config: Config: capabilities: TargetCapabilityFlags(Adaptive | IntegerComputations | FloatingPointComputations | BackwardsBranching | HigherLevelConstructs | QubitReset) num_qubits: 1 - num_results: 1"#]] + num_results: 1 + tags: + [0]: 0_t0r + [1]: 1_t1b + "#]] .assert_eq(&program.to_string()); } diff --git a/source/compiler/qsc_partial_eval/src/tests/qubits.rs b/source/compiler/qsc_partial_eval/src/tests/qubits.rs index 16e95e02df..3fa358988e 100644 --- a/source/compiler/qsc_partial_eval/src/tests/qubits.rs +++ b/source/compiler/qsc_partial_eval/src/tests/qubits.rs @@ -46,7 +46,7 @@ fn qubit_ids_are_correct_for_allocate_use_release_one_qubit() { expect![[r#" Block: Call id(1), args( Qubit(0), ) - Call id(2), args( Integer(0), Pointer, ) + Call id(2), args( Integer(0), EmptyTag, ) Return"#]] .assert_eq(&program.get_block(BlockId(0)).to_string()); } @@ -107,7 +107,7 @@ fn qubit_ids_are_correct_for_allocate_use_release_multiple_qubits() { Call id(1), args( Qubit(0), ) Call id(1), args( Qubit(1), ) Call id(1), args( Qubit(2), ) - Call id(2), args( Integer(0), Pointer, ) + Call id(2), args( Integer(0), EmptyTag, ) Return"#]], ); assert_eq!(program.num_qubits, 3); @@ -170,7 +170,7 @@ fn qubit_ids_are_correct_for_allocate_use_release_one_qubit_multiple_times() { Call id(1), args( Qubit(0), ) Call id(1), args( Qubit(0), ) Call id(1), args( Qubit(0), ) - Call id(2), args( Integer(0), Pointer, ) + Call id(2), args( Integer(0), EmptyTag, ) Return"#]], ); assert_eq!(program.num_qubits, 1); @@ -241,7 +241,7 @@ fn qubit_ids_are_correct_for_allocate_use_release_multiple_qubits_interleaved() Call id(1), args( Qubit(2), ) Call id(1), args( Qubit(2), ) Call id(1), args( Qubit(3), ) - Call id(2), args( Integer(0), Pointer, ) + Call id(2), args( Integer(0), EmptyTag, ) Return"#]], ); assert_eq!(program.num_qubits, 4); @@ -307,7 +307,7 @@ fn qubit_array_allocation_and_access() { Variable(1, Integer) = Store Integer(1) Variable(1, Integer) = Store Integer(2) Variable(1, Integer) = Store Integer(3) - Call id(2), args( Integer(0), Pointer, ) + Call id(2), args( Integer(0), EmptyTag, ) Return"#]], ); assert_eq!(program.num_qubits, 3); diff --git a/source/compiler/qsc_partial_eval/src/tests/results.rs b/source/compiler/qsc_partial_eval/src/tests/results.rs index 23d5d0df4c..72b6aa8669 100644 --- a/source/compiler/qsc_partial_eval/src/tests/results.rs +++ b/source/compiler/qsc_partial_eval/src/tests/results.rs @@ -53,7 +53,7 @@ fn result_ids_are_correct_for_measuring_and_resetting_one_qubit() { &expect![[r#" Block: Call id(1), args( Qubit(0), Result(0), ) - Call id(2), args( Result(0), Pointer, ) + Call id(2), args( Result(0), Tag(0, 3), ) Return"#]], ); assert_eq!(program.num_qubits, 1); @@ -107,7 +107,7 @@ fn result_ids_are_correct_for_measuring_one_qubit() { &expect![[r#" Block: Call id(1), args( Qubit(0), Result(0), ) - Call id(2), args( Result(0), Pointer, ) + Call id(2), args( Result(0), Tag(0, 3), ) Return"#]], ); assert_eq!(program.num_qubits, 1); @@ -179,10 +179,10 @@ fn result_ids_are_correct_for_measuring_one_qubit_multiple_times() { Call id(1), args( Qubit(0), Result(0), ) Call id(1), args( Qubit(0), Result(1), ) Call id(1), args( Qubit(0), Result(2), ) - Call id(2), args( Integer(3), Pointer, ) - Call id(3), args( Result(0), Pointer, ) - Call id(3), args( Result(1), Pointer, ) - Call id(3), args( Result(2), Pointer, ) + Call id(2), args( Integer(3), EmptyTag, ) + Call id(3), args( Result(0), Tag(0, 5), ) + Call id(3), args( Result(1), Tag(1, 5), ) + Call id(3), args( Result(2), Tag(2, 5), ) Return"#]], ); } @@ -252,10 +252,10 @@ fn result_ids_are_correct_for_measuring_one_qubit_multiple_times_into_array() { Call id(1), args( Qubit(0), Result(0), ) Call id(1), args( Qubit(0), Result(1), ) Call id(1), args( Qubit(0), Result(2), ) - Call id(2), args( Integer(3), Pointer, ) - Call id(3), args( Result(0), Pointer, ) - Call id(3), args( Result(1), Pointer, ) - Call id(3), args( Result(2), Pointer, ) + Call id(2), args( Integer(3), EmptyTag, ) + Call id(3), args( Result(0), Tag(0, 5), ) + Call id(3), args( Result(1), Tag(1, 5), ) + Call id(3), args( Result(2), Tag(2, 5), ) Return"#]], ); assert_eq!(program.num_qubits, 1); @@ -327,10 +327,10 @@ fn result_ids_are_correct_for_measuring_multiple_qubits() { Call id(1), args( Qubit(0), Result(0), ) Call id(1), args( Qubit(1), Result(1), ) Call id(1), args( Qubit(2), Result(2), ) - Call id(2), args( Integer(3), Pointer, ) - Call id(3), args( Result(0), Pointer, ) - Call id(3), args( Result(1), Pointer, ) - Call id(3), args( Result(2), Pointer, ) + Call id(2), args( Integer(3), EmptyTag, ) + Call id(3), args( Result(0), Tag(0, 5), ) + Call id(3), args( Result(1), Tag(1, 5), ) + Call id(3), args( Result(2), Tag(2, 5), ) Return"#]], ); assert_eq!(program.num_qubits, 3); diff --git a/source/compiler/qsc_partial_eval/src/tests/returns.rs b/source/compiler/qsc_partial_eval/src/tests/returns.rs index 36a6d34883..4b22abd8b7 100644 --- a/source/compiler/qsc_partial_eval/src/tests/returns.rs +++ b/source/compiler/qsc_partial_eval/src/tests/returns.rs @@ -44,9 +44,9 @@ fn non_classical_entry_point_with_classical_implicit_return() { &program, BlockId(0), &expect![[r#" - Block: - Call id(1), args( Bool(true), Pointer, ) - Return"#]], + Block: + Call id(1), args( Bool(true), Tag(0, 3), ) + Return"#]], ); } @@ -95,7 +95,7 @@ fn non_classical_entry_point_with_non_classical_implicit_return() { &expect![[r#" Block: Call id(1), args( Qubit(0), Result(0), ) - Call id(2), args( Result(0), Pointer, ) + Call id(2), args( Result(0), Tag(0, 3), ) Return"#]], ); } @@ -129,9 +129,9 @@ fn non_classical_entry_point_with_classical_explicit_return() { &program, BlockId(0), &expect![[r#" - Block: - Call id(1), args( Bool(false), Pointer, ) - Return"#]], + Block: + Call id(1), args( Bool(false), Tag(0, 3), ) + Return"#]], ); } @@ -180,7 +180,7 @@ fn non_classical_entry_point_with_non_classical_explicit_return() { &expect![[r#" Block: Call id(1), args( Qubit(0), Result(0), ) - Call id(2), args( Result(0), Pointer, ) + Call id(2), args( Result(0), Tag(0, 3), ) Return"#]], ); } @@ -231,10 +231,10 @@ fn non_classical_entry_point_with_classical_inline_early_return_halts_evaluation &program, BlockId(0), &expect![[r#" - Block: - Call id(1), args( Qubit(0), ) - Call id(2), args( Integer(0), Pointer, ) - Return"#]], + Block: + Call id(1), args( Qubit(0), ) + Call id(2), args( Integer(0), EmptyTag, ) + Return"#]], ); } @@ -284,7 +284,7 @@ fn non_classical_entry_point_with_non_classical_inline_early_return_halts_evalua &expect![[r#" Block: Call id(1), args( Qubit(0), Result(0), ) - Call id(2), args( Result(0), Pointer, ) + Call id(2), args( Result(0), Tag(0, 3), ) Return"#]], ); } @@ -341,7 +341,7 @@ fn non_classical_entry_point_with_classical_early_return_within_classical_branch &expect![[r#" Block: Call id(1), args( Qubit(0), ) - Call id(2), args( Bool(true), Pointer, ) + Call id(2), args( Bool(true), Tag(0, 3), ) Return"#]], ); } @@ -508,7 +508,7 @@ fn non_classical_entry_point_with_early_return_after_branching_halts_evaluation( Branch Variable(1, Boolean), 2, 3 Block 1:Block: Call id(5), args( Qubit(1), ) - Call id(6), args( Integer(0), Pointer, ) + Call id(6), args( Integer(0), EmptyTag, ) Return Block 2:Block: Call id(3), args( Qubit(1), ) @@ -620,7 +620,7 @@ fn operation_with_early_return_within_dynamic_branch_halts_evaluation_at_the_cal Branch Variable(1, Boolean), 2, 1 Block 1:Block: Call id(4), args( Qubit(0), ) - Call id(5), args( Integer(0), Pointer, ) + Call id(5), args( Integer(0), EmptyTag, ) Return Block 2:Block: Call id(3), args( Qubit(0), ) @@ -680,12 +680,12 @@ fn default_qubit_management_releases_qubits_when_they_are_out_of_scope_with_impl &program, BlockId(0), &expect![[r#" - Block: - Call id(1), args( Qubit(0), ) - Call id(2), args( Qubit(1), ) - Call id(1), args( Qubit(1), ) - Call id(3), args( Integer(0), Pointer, ) - Return"#]], + Block: + Call id(1), args( Qubit(0), ) + Call id(2), args( Qubit(1), ) + Call id(1), args( Qubit(1), ) + Call id(3), args( Integer(0), EmptyTag, ) + Return"#]], ); assert_eq!(program.num_qubits, 2); assert_eq!(program.num_results, 0); @@ -744,12 +744,12 @@ fn default_qubit_management_releases_qubits_when_they_are_out_of_scope_with_expl &program, BlockId(0), &expect![[r#" - Block: - Call id(1), args( Qubit(0), ) - Call id(2), args( Qubit(1), ) - Call id(1), args( Qubit(1), ) - Call id(3), args( Integer(0), Pointer, ) - Return"#]], + Block: + Call id(1), args( Qubit(0), ) + Call id(2), args( Qubit(1), ) + Call id(1), args( Qubit(1), ) + Call id(3), args( Integer(0), EmptyTag, ) + Return"#]], ); assert_eq!(program.num_qubits, 2); assert_eq!(program.num_results, 0); @@ -810,12 +810,12 @@ fn default_qubit_management_releases_qubits_when_they_are_out_of_scope_with_expl &program, BlockId(0), &expect![[r#" - Block: - Call id(1), args( Qubit(0), ) - Call id(2), args( Qubit(1), ) - Call id(1), args( Qubit(1), ) - Call id(3), args( Integer(0), Pointer, ) - Return"#]], + Block: + Call id(1), args( Qubit(0), ) + Call id(2), args( Qubit(1), ) + Call id(1), args( Qubit(1), ) + Call id(3), args( Integer(0), EmptyTag, ) + Return"#]], ); assert_eq!(program.num_qubits, 2); assert_eq!(program.num_results, 0); diff --git a/source/compiler/qsc_qasm/src/tests/expression/function_call.rs b/source/compiler/qsc_qasm/src/tests/expression/function_call.rs index 94491e3a22..1d86a2e234 100644 --- a/source/compiler/qsc_qasm/src/tests/expression/function_call.rs +++ b/source/compiler/qsc_qasm/src/tests/expression/function_call.rs @@ -315,11 +315,13 @@ fn simulatable_intrinsic_on_def_stmt_generates_correct_qir() -> miette::Result<( %Result = type opaque %Qubit = type opaque + @empty_tag = internal constant [1 x i8] c"\00" + define i64 @ENTRYPOINT__main() #0 { block_0: call void @my_gate(%Qubit* inttoptr (i64 0 to %Qubit*)) call void @__quantum__qis__m__body(%Qubit* inttoptr (i64 0 to %Qubit*), %Result* inttoptr (i64 0 to %Result*)) - call void @__quantum__rt__tuple_record_output(i64 0, i8* null) + call void @__quantum__rt__tuple_record_output(i64 0, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @empty_tag, i64 0, i64 0)) ret i64 0 } diff --git a/source/compiler/qsc_qasm/src/tests/output.rs b/source/compiler/qsc_qasm/src/tests/output.rs index 0cf63f5505..18b1f4cf35 100644 --- a/source/compiler/qsc_qasm/src/tests/output.rs +++ b/source/compiler/qsc_qasm/src/tests/output.rs @@ -253,6 +253,13 @@ c2[2] = measure q[4]; %Result = type opaque %Qubit = type opaque + @empty_tag = internal constant [1 x i8] c"\00" + @0 = internal constant [8 x i8] c"0_t0a0r\00" + @1 = internal constant [8 x i8] c"1_t0a1r\00" + @2 = internal constant [8 x i8] c"2_t0a2r\00" + @3 = internal constant [8 x i8] c"3_t1a0r\00" + @4 = internal constant [8 x i8] c"4_t1a1r\00" + define i64 @ENTRYPOINT__main() #0 { block_0: call void @__quantum__qis__rz__body(double 0.4999999999999997, %Qubit* inttoptr (i64 0 to %Qubit*)) @@ -266,14 +273,14 @@ c2[2] = measure q[4]; call void @__quantum__qis__m__body(%Qubit* inttoptr (i64 2 to %Qubit*), %Result* inttoptr (i64 2 to %Result*)) call void @__quantum__qis__m__body(%Qubit* inttoptr (i64 3 to %Qubit*), %Result* inttoptr (i64 3 to %Result*)) call void @__quantum__qis__m__body(%Qubit* inttoptr (i64 4 to %Qubit*), %Result* inttoptr (i64 4 to %Result*)) - call void @__quantum__rt__tuple_record_output(i64 2, i8* null) - call void @__quantum__rt__array_record_output(i64 3, i8* null) - call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 4 to %Result*), i8* null) - call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 3 to %Result*), i8* null) - call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 2 to %Result*), i8* null) - call void @__quantum__rt__array_record_output(i64 2, i8* null) - call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 1 to %Result*), i8* null) - call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 0 to %Result*), i8* null) + call void @__quantum__rt__tuple_record_output(i64 2, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @empty_tag, i64 0, i64 0)) + call void @__quantum__rt__array_record_output(i64 3, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @empty_tag, i64 0, i64 0)) + call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 4 to %Result*), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @0, i64 0, i64 0)) + call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 3 to %Result*), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @1, i64 0, i64 0)) + call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 2 to %Result*), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @2, i64 0, i64 0)) + call void @__quantum__rt__array_record_output(i64 2, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @empty_tag, i64 0, i64 0)) + call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 1 to %Result*), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @3, i64 0, i64 0)) + call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 0 to %Result*), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @4, i64 0, i64 0)) ret i64 0 } diff --git a/source/compiler/qsc_qasm/src/tests/statement/gate_call.rs b/source/compiler/qsc_qasm/src/tests/statement/gate_call.rs index d1a874af32..b8320612d3 100644 --- a/source/compiler/qsc_qasm/src/tests/statement/gate_call.rs +++ b/source/compiler/qsc_qasm/src/tests/statement/gate_call.rs @@ -246,6 +246,9 @@ fn barrier_generates_qir() -> miette::Result<(), Vec> { %Result = type opaque %Qubit = type opaque + @empty_tag = internal constant [1 x i8] c"\00" + @0 = internal constant [6 x i8] c"0_a0r\00" + define i64 @ENTRYPOINT__main() #0 { block_0: call void @__quantum__qis__barrier__body() @@ -253,8 +256,8 @@ fn barrier_generates_qir() -> miette::Result<(), Vec> { call void @__quantum__qis__barrier__body() call void @__quantum__qis__barrier__body() call void @__quantum__qis__m__body(%Qubit* inttoptr (i64 0 to %Qubit*), %Result* inttoptr (i64 0 to %Result*)) - call void @__quantum__rt__array_record_output(i64 1, i8* null) - call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 0 to %Result*), i8* null) + call void @__quantum__rt__array_record_output(i64 1, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @empty_tag, i64 0, i64 0)) + call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 0 to %Result*), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @0, i64 0, i64 0)) ret i64 0 } @@ -605,11 +608,13 @@ fn simulatable_intrinsic_on_gate_stmt_generates_correct_qir() -> miette::Result< %Result = type opaque %Qubit = type opaque + @empty_tag = internal constant [1 x i8] c"\00" + define i64 @ENTRYPOINT__main() #0 { block_0: call void @my_gate(%Qubit* inttoptr (i64 0 to %Qubit*)) call void @__quantum__qis__m__body(%Qubit* inttoptr (i64 0 to %Qubit*), %Result* inttoptr (i64 0 to %Result*)) - call void @__quantum__rt__tuple_record_output(i64 0, i8* null) + call void @__quantum__rt__tuple_record_output(i64 0, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @empty_tag, i64 0, i64 0)) ret i64 0 } @@ -1088,6 +1093,9 @@ fn qasm2_barrier_generates_qir() -> miette::Result<(), Vec> { %Result = type opaque %Qubit = type opaque + @empty_tag = internal constant [1 x i8] c"\00" + @0 = internal constant [6 x i8] c"0_a0r\00" + define i64 @ENTRYPOINT__main() #0 { block_0: call void @__quantum__qis__barrier__body() @@ -1095,8 +1103,8 @@ fn qasm2_barrier_generates_qir() -> miette::Result<(), Vec> { call void @__quantum__qis__barrier__body() call void @__quantum__qis__barrier__body() call void @__quantum__qis__m__body(%Qubit* inttoptr (i64 0 to %Qubit*), %Result* inttoptr (i64 0 to %Result*)) - call void @__quantum__rt__array_record_output(i64 1, i8* null) - call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 0 to %Result*), i8* null) + call void @__quantum__rt__array_record_output(i64 1, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @empty_tag, i64 0, i64 0)) + call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 0 to %Result*), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @0, i64 0, i64 0)) ret i64 0 } @@ -1347,12 +1355,15 @@ fn qasm2_simulatable_intrinsic_on_gate_stmt_generates_correct_qir() %Result = type opaque %Qubit = type opaque + @empty_tag = internal constant [1 x i8] c"\00" + @0 = internal constant [6 x i8] c"0_a0r\00" + define i64 @ENTRYPOINT__main() #0 { block_0: call void @my_gate(%Qubit* inttoptr (i64 0 to %Qubit*)) call void @__quantum__qis__m__body(%Qubit* inttoptr (i64 0 to %Qubit*), %Result* inttoptr (i64 0 to %Result*)) - call void @__quantum__rt__array_record_output(i64 1, i8* null) - call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 0 to %Result*), i8* null) + call void @__quantum__rt__array_record_output(i64 1, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @empty_tag, i64 0, i64 0)) + call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 0 to %Result*), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @0, i64 0, i64 0)) ret i64 0 } diff --git a/source/compiler/qsc_qasm/src/tests/statement/reset.rs b/source/compiler/qsc_qasm/src/tests/statement/reset.rs index 7d94f80e8b..ea7afdf68c 100644 --- a/source/compiler/qsc_qasm/src/tests/statement/reset.rs +++ b/source/compiler/qsc_qasm/src/tests/statement/reset.rs @@ -71,12 +71,15 @@ fn reset_with_base_profile_is_rewritten_without_resets() -> miette::Result<(), V %Result = type opaque %Qubit = type opaque + @empty_tag = internal constant [1 x i8] c"\00" + @0 = internal constant [6 x i8] c"0_a0r\00" + define i64 @ENTRYPOINT__main() #0 { block_0: call void @__quantum__qis__h__body(%Qubit* inttoptr (i64 1 to %Qubit*)) call void @__quantum__qis__m__body(%Qubit* inttoptr (i64 1 to %Qubit*), %Result* inttoptr (i64 0 to %Result*)) - call void @__quantum__rt__array_record_output(i64 1, i8* null) - call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 0 to %Result*), i8* null) + call void @__quantum__rt__array_record_output(i64 1, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @empty_tag, i64 0, i64 0)) + call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 0 to %Result*), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @0, i64 0, i64 0)) ret i64 0 } @@ -122,13 +125,16 @@ fn reset_with_adaptive_ri_profile_generates_reset_qir() -> miette::Result<(), Ve %Result = type opaque %Qubit = type opaque + @empty_tag = internal constant [1 x i8] c"\00" + @0 = internal constant [6 x i8] c"0_a0r\00" + define i64 @ENTRYPOINT__main() #0 { block_0: call void @__quantum__qis__reset__body(%Qubit* inttoptr (i64 0 to %Qubit*)) call void @__quantum__qis__h__body(%Qubit* inttoptr (i64 0 to %Qubit*)) call void @__quantum__qis__m__body(%Qubit* inttoptr (i64 0 to %Qubit*), %Result* inttoptr (i64 0 to %Result*)) - call void @__quantum__rt__array_record_output(i64 1, i8* null) - call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 0 to %Result*), i8* null) + call void @__quantum__rt__array_record_output(i64 1, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @empty_tag, i64 0, i64 0)) + call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 0 to %Result*), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @0, i64 0, i64 0)) ret i64 0 } diff --git a/source/compiler/qsc_rir/src/builder.rs b/source/compiler/qsc_rir/src/builder.rs index 3e4bbc29e5..5a0dbe88f1 100644 --- a/source/compiler/qsc_rir/src/builder.rs +++ b/source/compiler/qsc_rir/src/builder.rs @@ -211,6 +211,7 @@ pub fn bell_program() -> Program { call_type: CallableType::Regular, }, ); + program.tags = vec!["0_a".to_string(), "1_a0r".to_string(), "2_a1r".to_string()]; program.entry = CallableId(5); program.blocks.insert( BlockId(0), @@ -248,7 +249,7 @@ pub fn bell_program() -> Program { CallableId(3), vec![ Operand::Literal(Literal::Integer(2)), - Operand::Literal(Literal::Pointer), + Operand::Literal(Literal::Tag(0, 3)), ], None, ), @@ -256,7 +257,7 @@ pub fn bell_program() -> Program { CallableId(4), vec![ Operand::Literal(Literal::Result(0)), - Operand::Literal(Literal::Pointer), + Operand::Literal(Literal::Tag(1, 5)), ], None, ), @@ -264,7 +265,7 @@ pub fn bell_program() -> Program { CallableId(4), vec![ Operand::Literal(Literal::Result(1)), - Operand::Literal(Literal::Pointer), + Operand::Literal(Literal::Tag(2, 5)), ], None, ), @@ -300,6 +301,7 @@ pub fn teleport_program() -> Program { call_type: CallableType::Regular, }, ); + program.tags = vec!["0_r".to_string()]; program.entry = CallableId(7); program.blocks.insert( BlockId(0), @@ -427,7 +429,7 @@ pub fn teleport_program() -> Program { CallableId(6), vec![ Operand::Literal(Literal::Result(2)), - Operand::Literal(Literal::Pointer), + Operand::Literal(Literal::Tag(0, 3)), ], None, ), diff --git a/source/compiler/qsc_rir/src/passes/reindex_qubits/tests.rs b/source/compiler/qsc_rir/src/passes/reindex_qubits/tests.rs index 2d35c23877..5737b5d156 100644 --- a/source/compiler/qsc_rir/src/passes/reindex_qubits/tests.rs +++ b/source/compiler/qsc_rir/src/passes/reindex_qubits/tests.rs @@ -439,7 +439,9 @@ fn qubit_reindexed_across_branches() { config: Config: capabilities: Base num_qubits: 1 - num_results: 3"#]] + num_results: 3 + tags: + "#]] .assert_eq(&program.to_string()); // After diff --git a/source/compiler/qsc_rir/src/passes/remap_block_ids/tests.rs b/source/compiler/qsc_rir/src/passes/remap_block_ids/tests.rs index 2345e2cc53..1dda127506 100644 --- a/source/compiler/qsc_rir/src/passes/remap_block_ids/tests.rs +++ b/source/compiler/qsc_rir/src/passes/remap_block_ids/tests.rs @@ -56,7 +56,9 @@ fn remap_block_ids_no_changes() { config: Config: capabilities: Base num_qubits: 0 - num_results: 0"#]] + num_results: 0 + tags: + "#]] .assert_eq(&program.to_string()); remap_block_ids(&mut program); @@ -80,7 +82,9 @@ fn remap_block_ids_no_changes() { config: Config: capabilities: Base num_qubits: 0 - num_results: 0"#]] + num_results: 0 + tags: + "#]] .assert_eq(&program.to_string()); } @@ -128,7 +132,9 @@ fn remap_block_ids_out_of_order_no_branches() { config: Config: capabilities: Base num_qubits: 0 - num_results: 0"#]] + num_results: 0 + tags: + "#]] .assert_eq(&program.to_string()); remap_block_ids(&mut program); @@ -152,7 +158,9 @@ fn remap_block_ids_out_of_order_no_branches() { config: Config: capabilities: Base num_qubits: 0 - num_results: 0"#]] + num_results: 0 + tags: + "#]] .assert_eq(&program.to_string()); } @@ -213,7 +221,9 @@ fn remap_block_ids_out_of_order_with_one_branch() { config: Config: capabilities: Base num_qubits: 0 - num_results: 0"#]] + num_results: 0 + tags: + "#]] .assert_eq(&program.to_string()); // After @@ -240,7 +250,9 @@ fn remap_block_ids_out_of_order_with_one_branch() { config: Config: capabilities: Base num_qubits: 0 - num_results: 0"#]] + num_results: 0 + tags: + "#]] .assert_eq(&program.to_string()); } @@ -296,7 +308,9 @@ fn remap_block_ids_simple_loop() { config: Config: capabilities: Base num_qubits: 0 - num_results: 0"#]] + num_results: 0 + tags: + "#]] .assert_eq(&program.to_string()); // After @@ -321,7 +335,9 @@ fn remap_block_ids_simple_loop() { config: Config: capabilities: Base num_qubits: 0 - num_results: 0"#]] + num_results: 0 + tags: + "#]] .assert_eq(&program.to_string()); } @@ -364,7 +380,9 @@ fn remap_block_ids_infinite_loop() { config: Config: capabilities: Base num_qubits: 0 - num_results: 0"#]] + num_results: 0 + tags: + "#]] .assert_eq(&program.to_string()); // After @@ -387,7 +405,9 @@ fn remap_block_ids_infinite_loop() { config: Config: capabilities: Base num_qubits: 0 - num_results: 0"#]] + num_results: 0 + tags: + "#]] .assert_eq(&program.to_string()); } @@ -451,7 +471,9 @@ fn remap_block_ids_nested_branching_loops() { config: Config: capabilities: Base num_qubits: 0 - num_results: 0"#]] + num_results: 0 + tags: + "#]] .assert_eq(&program.to_string()); // After @@ -476,7 +498,9 @@ fn remap_block_ids_nested_branching_loops() { config: Config: capabilities: Base num_qubits: 0 - num_results: 0"#]] + num_results: 0 + tags: + "#]] .assert_eq(&program.to_string()); } @@ -579,7 +603,9 @@ fn remap_block_ids_ensures_acyclic_program_gets_topological_ordering() { config: Config: capabilities: Base num_qubits: 0 - num_results: 0"#]] + num_results: 0 + tags: + "#]] .assert_eq(&program.to_string()); // After @@ -616,6 +642,8 @@ fn remap_block_ids_ensures_acyclic_program_gets_topological_ordering() { config: Config: capabilities: Base num_qubits: 0 - num_results: 0"#]] + num_results: 0 + tags: + "#]] .assert_eq(&program.to_string()); } diff --git a/source/compiler/qsc_rir/src/passes/simplify_control_flow/tests.rs b/source/compiler/qsc_rir/src/passes/simplify_control_flow/tests.rs index 3f58410082..b579b5d709 100644 --- a/source/compiler/qsc_rir/src/passes/simplify_control_flow/tests.rs +++ b/source/compiler/qsc_rir/src/passes/simplify_control_flow/tests.rs @@ -73,7 +73,9 @@ fn simplify_control_flow_removes_single_redundant_block() { config: Config: capabilities: Base num_qubits: 0 - num_results: 0"#]] + num_results: 0 + tags: + "#]] .assert_eq(&program.to_string()); // After @@ -90,7 +92,9 @@ fn simplify_control_flow_removes_single_redundant_block() { config: Config: capabilities: Base num_qubits: 0 - num_results: 0"#]] + num_results: 0 + tags: + "#]] .assert_eq(&program.to_string()); } @@ -155,7 +159,9 @@ fn simplify_control_flow_removes_multiple_redundant_blocks() { config: Config: capabilities: Base num_qubits: 0 - num_results: 0"#]] + num_results: 0 + tags: + "#]] .assert_eq(&program.to_string()); // After @@ -173,7 +179,9 @@ fn simplify_control_flow_removes_multiple_redundant_blocks() { config: Config: capabilities: Base num_qubits: 0 - num_results: 0"#]] + num_results: 0 + tags: + "#]] .assert_eq(&program.to_string()); } @@ -293,7 +301,9 @@ fn simplify_control_flow_removes_redundant_blocks_across_branches() { config: Config: capabilities: Base num_qubits: 0 - num_results: 0"#]] + num_results: 0 + tags: + "#]] .assert_eq(&program.to_string()); // After @@ -318,7 +328,9 @@ fn simplify_control_flow_removes_redundant_blocks_across_branches() { config: Config: capabilities: Base num_qubits: 0 - num_results: 0"#]] + num_results: 0 + tags: + "#]] .assert_eq(&program.to_string()); } @@ -444,7 +456,9 @@ fn simplify_control_flow_removes_redundant_blocks_across_out_of_order_branches() config: Config: capabilities: Base num_qubits: 0 - num_results: 0"#]] + num_results: 0 + tags: + "#]] .assert_eq(&program.to_string()); // After @@ -469,6 +483,8 @@ fn simplify_control_flow_removes_redundant_blocks_across_out_of_order_branches() config: Config: capabilities: Base num_qubits: 0 - num_results: 0"#]] + num_results: 0 + tags: + "#]] .assert_eq(&program.to_string()); } diff --git a/source/compiler/qsc_rir/src/passes/ssa_transform/tests.rs b/source/compiler/qsc_rir/src/passes/ssa_transform/tests.rs index ac5447c632..1d135b19d0 100644 --- a/source/compiler/qsc_rir/src/passes/ssa_transform/tests.rs +++ b/source/compiler/qsc_rir/src/passes/ssa_transform/tests.rs @@ -114,7 +114,9 @@ fn ssa_transform_removes_store_in_single_block_program() { config: Config: capabilities: Base num_qubits: 0 - num_results: 0"#]] + num_results: 0 + tags: + "#]] .assert_eq(&program.to_string()); // After @@ -143,7 +145,9 @@ fn ssa_transform_removes_store_in_single_block_program() { config: Config: capabilities: TargetCapabilityFlags(Adaptive | IntegerComputations | FloatingPointComputations | BackwardsBranching | HigherLevelConstructs | QubitReset) num_qubits: 0 - num_results: 0"#]] + num_results: 0 + tags: + "#]] .assert_eq(&program.to_string()); } @@ -266,7 +270,9 @@ fn ssa_transform_removes_multiple_stores_in_single_block_program() { config: Config: capabilities: Base num_qubits: 0 - num_results: 0"#]] + num_results: 0 + tags: + "#]] .assert_eq(&program.to_string()); // After @@ -297,7 +303,9 @@ fn ssa_transform_removes_multiple_stores_in_single_block_program() { config: Config: capabilities: TargetCapabilityFlags(Adaptive | IntegerComputations | FloatingPointComputations | BackwardsBranching | HigherLevelConstructs | QubitReset) num_qubits: 0 - num_results: 0"#]] + num_results: 0 + tags: + "#]] .assert_eq(&program.to_string()); } @@ -429,7 +437,9 @@ fn ssa_transform_store_dominating_usage_propagates_to_successor_blocks() { config: Config: capabilities: Base num_qubits: 0 - num_results: 0"#]] + num_results: 0 + tags: + "#]] .assert_eq(&program.to_string()); // After @@ -466,7 +476,9 @@ fn ssa_transform_store_dominating_usage_propagates_to_successor_blocks() { config: Config: capabilities: TargetCapabilityFlags(Adaptive | IntegerComputations | FloatingPointComputations | BackwardsBranching | HigherLevelConstructs | QubitReset) num_qubits: 0 - num_results: 0"#]] + num_results: 0 + tags: + "#]] .assert_eq(&program.to_string()); } @@ -571,7 +583,9 @@ fn ssa_transform_store_dominating_usage_propagates_to_successor_blocks_without_i config: Config: capabilities: Base num_qubits: 0 - num_results: 0"#]] + num_results: 0 + tags: + "#]] .assert_eq(&program.to_string()); // After @@ -606,7 +620,9 @@ fn ssa_transform_store_dominating_usage_propagates_to_successor_blocks_without_i config: Config: capabilities: TargetCapabilityFlags(Adaptive | IntegerComputations | FloatingPointComputations | BackwardsBranching | HigherLevelConstructs | QubitReset) num_qubits: 0 - num_results: 0"#]] + num_results: 0 + tags: + "#]] .assert_eq(&program.to_string()); } @@ -760,7 +776,9 @@ fn ssa_transform_inserts_phi_for_store_not_dominating_usage() { config: Config: capabilities: Base num_qubits: 0 - num_results: 0"#]] + num_results: 0 + tags: + "#]] .assert_eq(&program.to_string()); // After @@ -798,7 +816,9 @@ fn ssa_transform_inserts_phi_for_store_not_dominating_usage() { config: Config: capabilities: TargetCapabilityFlags(Adaptive | IntegerComputations | FloatingPointComputations | BackwardsBranching | HigherLevelConstructs | QubitReset) num_qubits: 0 - num_results: 0"#]].assert_eq(&program.to_string()); + num_results: 0 + tags: + "#]].assert_eq(&program.to_string()); } #[test] @@ -926,7 +946,9 @@ fn ssa_transform_inserts_phi_for_store_not_dominating_usage_in_one_branch() { config: Config: capabilities: Base num_qubits: 0 - num_results: 0"#]] + num_results: 0 + tags: + "#]] .assert_eq(&program.to_string()); // After @@ -963,7 +985,9 @@ fn ssa_transform_inserts_phi_for_store_not_dominating_usage_in_one_branch() { config: Config: capabilities: TargetCapabilityFlags(Adaptive | IntegerComputations | FloatingPointComputations | BackwardsBranching | HigherLevelConstructs | QubitReset) num_qubits: 0 - num_results: 0"#]].assert_eq(&program.to_string()); + num_results: 0 + tags: + "#]].assert_eq(&program.to_string()); } #[test] @@ -1175,7 +1199,9 @@ fn ssa_transform_inserts_phi_for_node_with_many_predecessors() { config: Config: capabilities: Base num_qubits: 0 - num_results: 0"#]] + num_results: 0 + tags: + "#]] .assert_eq(&program.to_string()); // After @@ -1222,7 +1248,9 @@ fn ssa_transform_inserts_phi_for_node_with_many_predecessors() { config: Config: capabilities: TargetCapabilityFlags(Adaptive | IntegerComputations | FloatingPointComputations | BackwardsBranching | HigherLevelConstructs | QubitReset) num_qubits: 0 - num_results: 0"#]].assert_eq(&program.to_string()); + num_results: 0 + tags: + "#]].assert_eq(&program.to_string()); } #[test] @@ -1397,7 +1425,9 @@ fn ssa_transform_inserts_phi_for_multiple_stored_values() { config: Config: capabilities: Base num_qubits: 0 - num_results: 0"#]] + num_results: 0 + tags: + "#]] .assert_eq(&program.to_string()); // After @@ -1437,7 +1467,9 @@ fn ssa_transform_inserts_phi_for_multiple_stored_values() { config: Config: capabilities: TargetCapabilityFlags(Adaptive | IntegerComputations | FloatingPointComputations | BackwardsBranching | HigherLevelConstructs | QubitReset) num_qubits: 0 - num_results: 0"#]].assert_eq(&program.to_string()); + num_results: 0 + tags: + "#]].assert_eq(&program.to_string()); } #[test] @@ -1717,7 +1749,9 @@ fn ssa_transform_inserts_phi_nodes_in_successive_blocks_for_chained_branches() { config: Config: capabilities: Base num_qubits: 0 - num_results: 0"#]] + num_results: 0 + tags: + "#]] .assert_eq(&program.to_string()); // After @@ -1766,7 +1800,9 @@ fn ssa_transform_inserts_phi_nodes_in_successive_blocks_for_chained_branches() { config: Config: capabilities: TargetCapabilityFlags(Adaptive | IntegerComputations | FloatingPointComputations | BackwardsBranching | HigherLevelConstructs | QubitReset) num_qubits: 0 - num_results: 0"#]].assert_eq(&program.to_string()); + num_results: 0 + tags: + "#]].assert_eq(&program.to_string()); } #[test] @@ -2005,7 +2041,9 @@ fn ssa_transform_inerts_phi_nodes_for_early_return_graph_pattern() { config: Config: capabilities: Base num_qubits: 0 - num_results: 0"#]] + num_results: 0 + tags: + "#]] .assert_eq(&program.to_string()); // After @@ -2053,7 +2091,9 @@ fn ssa_transform_inerts_phi_nodes_for_early_return_graph_pattern() { config: Config: capabilities: TargetCapabilityFlags(Adaptive | IntegerComputations | FloatingPointComputations | BackwardsBranching | HigherLevelConstructs | QubitReset) num_qubits: 0 - num_results: 0"#]].assert_eq(&program.to_string()); + num_results: 0 + tags: + "#]].assert_eq(&program.to_string()); } #[test] @@ -2182,7 +2222,9 @@ fn ssa_transform_propagates_updates_from_multiple_predecessors_to_later_single_s config: Config: capabilities: Base num_qubits: 0 - num_results: 0"#]] + num_results: 0 + tags: + "#]] .assert_eq(&program.to_string()); // After @@ -2219,7 +2261,9 @@ fn ssa_transform_propagates_updates_from_multiple_predecessors_to_later_single_s config: Config: capabilities: TargetCapabilityFlags(Adaptive | IntegerComputations | FloatingPointComputations | BackwardsBranching | HigherLevelConstructs | QubitReset) num_qubits: 0 - num_results: 0"#]].assert_eq(&program.to_string()); + num_results: 0 + tags: + "#]].assert_eq(&program.to_string()); } #[test] @@ -2308,7 +2352,9 @@ fn ssa_transform_maps_store_instrs_that_use_values_from_other_store_instrs() { config: Config: capabilities: Base num_qubits: 0 - num_results: 0"#]] + num_results: 0 + tags: + "#]] .assert_eq(&program.to_string()); // After @@ -2337,7 +2383,9 @@ fn ssa_transform_maps_store_instrs_that_use_values_from_other_store_instrs() { config: Config: capabilities: TargetCapabilityFlags(Adaptive | IntegerComputations | FloatingPointComputations | BackwardsBranching | HigherLevelConstructs | QubitReset) num_qubits: 0 - num_results: 0"#]].assert_eq(&program.to_string()); + num_results: 0 + tags: + "#]].assert_eq(&program.to_string()); } #[test] @@ -2457,7 +2505,9 @@ fn ssa_transform_maps_store_with_variable_from_store_in_conditional_to_phi_node( config: Config: capabilities: Base num_qubits: 0 - num_results: 0"#]] + num_results: 0 + tags: + "#]] .assert_eq(&program.to_string()); // After @@ -2491,7 +2541,9 @@ fn ssa_transform_maps_store_with_variable_from_store_in_conditional_to_phi_node( config: Config: capabilities: TargetCapabilityFlags(Adaptive | IntegerComputations | FloatingPointComputations | BackwardsBranching | HigherLevelConstructs | QubitReset) num_qubits: 0 - num_results: 0"#]].assert_eq(&program.to_string()); + num_results: 0 + tags: + "#]].assert_eq(&program.to_string()); } #[test] @@ -2613,7 +2665,9 @@ fn ssa_transform_allows_point_in_time_copy_of_dynamic_variable() { config: Config: capabilities: Base num_qubits: 0 - num_results: 0"#]] + num_results: 0 + tags: + "#]] .assert_eq(&program.to_string()); // After @@ -2644,7 +2698,9 @@ fn ssa_transform_allows_point_in_time_copy_of_dynamic_variable() { config: Config: capabilities: TargetCapabilityFlags(Adaptive | IntegerComputations | FloatingPointComputations | BackwardsBranching | HigherLevelConstructs | QubitReset) num_qubits: 0 - num_results: 0"#]].assert_eq(&program.to_string()); + num_results: 0 + tags: + "#]].assert_eq(&program.to_string()); } #[test] @@ -2813,7 +2869,9 @@ fn ssa_transform_propagates_phi_var_to_successor_blocks_across_sequential_branch config: Config: capabilities: Base num_qubits: 0 - num_results: 0"#]] + num_results: 0 + tags: + "#]] .assert_eq(&program.to_string()); // After @@ -2861,6 +2919,8 @@ fn ssa_transform_propagates_phi_var_to_successor_blocks_across_sequential_branch config: Config: capabilities: TargetCapabilityFlags(Adaptive | IntegerComputations | FloatingPointComputations | BackwardsBranching | HigherLevelConstructs | QubitReset) num_qubits: 0 - num_results: 0"#]] + num_results: 0 + tags: + "#]] .assert_eq(&program.to_string()); } diff --git a/source/compiler/qsc_rir/src/rir.rs b/source/compiler/qsc_rir/src/rir.rs index 1a1ffe1301..5b2af6bea9 100644 --- a/source/compiler/qsc_rir/src/rir.rs +++ b/source/compiler/qsc_rir/src/rir.rs @@ -14,6 +14,7 @@ pub struct Program { pub config: Config, pub num_qubits: u32, pub num_results: u32, + pub tags: Vec, } impl Display for Program { @@ -37,6 +38,11 @@ impl Display for Program { write!(indent, "\nconfig: {}", self.config)?; write!(indent, "\nnum_qubits: {}", self.num_qubits)?; write!(indent, "\nnum_results: {}", self.num_results)?; + writeln!(indent, "\ntags:")?; + indent = set_indentation(indent, 2); + for (idx, tag) in self.tags.iter().enumerate() { + writeln!(indent, "[{idx}]: {tag}")?; + } Ok(()) } } @@ -607,7 +613,7 @@ impl Operand { Literal::Bool(_) => Ty::Boolean, Literal::Integer(_) => Ty::Integer, Literal::Double(_) => Ty::Double, - Literal::Pointer => Ty::Pointer, + Literal::Pointer | Literal::Tag(..) | Literal::EmptyTag => Ty::Pointer, }, Operand::Variable(var) => var.ty, } @@ -621,6 +627,8 @@ pub enum Literal { Bool(bool), Integer(i64), Double(f64), + Tag(usize, usize), + EmptyTag, Pointer, } @@ -632,6 +640,8 @@ impl Display for Literal { Self::Bool(b) => write!(f, "Bool({b})")?, Self::Integer(i) => write!(f, "Integer({i})")?, Self::Double(d) => write!(f, "Double({d})")?, + Self::Tag(idx, len) => write!(f, "Tag({idx}, {len})")?, + Self::EmptyTag => write!(f, "EmptyTag")?, Self::Pointer => write!(f, "Pointer")?, } Ok(()) @@ -679,6 +689,14 @@ impl PartialEq for Literal { false } } + Self::Tag(self_tag_idx, self_tag_len) => { + if let Self::Tag(other_tag_idx, other_tag_len) = other { + self_tag_idx == other_tag_idx && self_tag_len == other_tag_len + } else { + false + } + } + Self::EmptyTag => *other == Self::EmptyTag, } } } diff --git a/source/pip/tests-integration/interop_qiskit/resources/custom_intrinsics.ll b/source/pip/tests-integration/interop_qiskit/resources/custom_intrinsics.ll index c088d12a76..8f06606f95 100644 --- a/source/pip/tests-integration/interop_qiskit/resources/custom_intrinsics.ll +++ b/source/pip/tests-integration/interop_qiskit/resources/custom_intrinsics.ll @@ -1,12 +1,15 @@ %Result = type opaque %Qubit = type opaque +@empty_tag = internal constant [1 x i8] c"\00" +@0 = internal constant [6 x i8] c"0_a0r\00" + define i64 @ENTRYPOINT__main() #0 { block_0: call void @my_gate(%Qubit* inttoptr (i64 0 to %Qubit*)) call void @__quantum__qis__m__body(%Qubit* inttoptr (i64 0 to %Qubit*), %Result* inttoptr (i64 0 to %Result*)) - call void @__quantum__rt__array_record_output(i64 1, i8* null) - call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 0 to %Result*), i8* null) + call void @__quantum__rt__array_record_output(i64 1, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @empty_tag, i64 0, i64 0)) + call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 0 to %Result*), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @0, i64 0, i64 0)) ret i64 0 } diff --git a/source/pip/tests-integration/interop_qiskit/test_qir.py b/source/pip/tests-integration/interop_qiskit/test_qir.py index 40fbcebc3d..a8b8b06db3 100644 --- a/source/pip/tests-integration/interop_qiskit/test_qir.py +++ b/source/pip/tests-integration/interop_qiskit/test_qir.py @@ -230,5 +230,5 @@ def test_qir_re_output_single_unit_tuple() -> None: res = backend.qir(circuit, output_semantics=output_semantics) assert res is not None - call = "call void @__quantum__rt__tuple_record_output(i64 0, i8* null)" + call = "call void @__quantum__rt__tuple_record_output(i64 0, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @empty_tag, i64 0, i64 0))" assert call in res diff --git a/source/pip/tests-integration/resources/adaptive_ri/output/ArithmeticOps.ll b/source/pip/tests-integration/resources/adaptive_ri/output/ArithmeticOps.ll index 851d7538a0..c0724e166f 100644 --- a/source/pip/tests-integration/resources/adaptive_ri/output/ArithmeticOps.ll +++ b/source/pip/tests-integration/resources/adaptive_ri/output/ArithmeticOps.ll @@ -1,6 +1,12 @@ %Result = type opaque %Qubit = type opaque +@empty_tag = internal constant [1 x i8] c"\00" +@0 = internal constant [6 x i8] c"0_t0i\00" +@1 = internal constant [6 x i8] c"1_t1i\00" +@2 = internal constant [6 x i8] c"2_t2i\00" +@3 = internal constant [6 x i8] c"3_t3i\00" + define i64 @ENTRYPOINT__main() #0 { block_0: call void @__quantum__qis__x__body(%Qubit* inttoptr (i64 0 to %Qubit*)) @@ -79,11 +85,11 @@ block_10: call void @__quantum__qis__reset__body(%Qubit* inttoptr (i64 2 to %Qubit*)) call void @__quantum__qis__reset__body(%Qubit* inttoptr (i64 3 to %Qubit*)) call void @__quantum__qis__reset__body(%Qubit* inttoptr (i64 4 to %Qubit*)) - call void @__quantum__rt__tuple_record_output(i64 4, i8* null) - call void @__quantum__rt__int_record_output(i64 %var_52, i8* null) - call void @__quantum__rt__int_record_output(i64 %var_53, i8* null) - call void @__quantum__rt__int_record_output(i64 %var_54, i8* null) - call void @__quantum__rt__int_record_output(i64 %var_55, i8* null) + call void @__quantum__rt__tuple_record_output(i64 4, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @empty_tag, i64 0, i64 0)) + call void @__quantum__rt__int_record_output(i64 %var_52, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @0, i64 0, i64 0)) + call void @__quantum__rt__int_record_output(i64 %var_53, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @1, i64 0, i64 0)) + call void @__quantum__rt__int_record_output(i64 %var_54, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @2, i64 0, i64 0)) + call void @__quantum__rt__int_record_output(i64 %var_55, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @3, i64 0, i64 0)) ret i64 0 } diff --git a/source/pip/tests-integration/resources/adaptive_ri/output/ArithmeticOps.out b/source/pip/tests-integration/resources/adaptive_ri/output/ArithmeticOps.out index 963ba77ac9..af47c80431 100644 --- a/source/pip/tests-integration/resources/adaptive_ri/output/ArithmeticOps.out +++ b/source/pip/tests-integration/resources/adaptive_ri/output/ArithmeticOps.out @@ -4,9 +4,9 @@ METADATA output_labeling_schema METADATA qir_profiles adaptive_profile METADATA required_num_qubits 5 METADATA required_num_results 5 -OUTPUT TUPLE 4 -OUTPUT INT 5 -OUTPUT INT 25 -OUTPUT INT 0 -OUTPUT INT 243 +OUTPUT TUPLE 4 +OUTPUT INT 5 0_t0i +OUTPUT INT 25 1_t1i +OUTPUT INT 0 2_t2i +OUTPUT INT 243 3_t3i END 0 diff --git a/source/pip/tests-integration/resources/adaptive_ri/output/BernsteinVaziraniNISQ.ll b/source/pip/tests-integration/resources/adaptive_ri/output/BernsteinVaziraniNISQ.ll index 96b22236ee..a59839ba2d 100644 --- a/source/pip/tests-integration/resources/adaptive_ri/output/BernsteinVaziraniNISQ.ll +++ b/source/pip/tests-integration/resources/adaptive_ri/output/BernsteinVaziraniNISQ.ll @@ -1,6 +1,13 @@ %Result = type opaque %Qubit = type opaque +@empty_tag = internal constant [1 x i8] c"\00" +@0 = internal constant [6 x i8] c"0_a0r\00" +@1 = internal constant [6 x i8] c"1_a1r\00" +@2 = internal constant [6 x i8] c"2_a2r\00" +@3 = internal constant [6 x i8] c"3_a3r\00" +@4 = internal constant [6 x i8] c"4_a4r\00" + define i64 @ENTRYPOINT__main() #0 { block_0: call void @__quantum__qis__x__body(%Qubit* inttoptr (i64 5 to %Qubit*)) @@ -24,12 +31,12 @@ block_0: call void @__quantum__qis__mresetz__body(%Qubit* inttoptr (i64 3 to %Qubit*), %Result* inttoptr (i64 3 to %Result*)) call void @__quantum__qis__mresetz__body(%Qubit* inttoptr (i64 4 to %Qubit*), %Result* inttoptr (i64 4 to %Result*)) call void @__quantum__qis__reset__body(%Qubit* inttoptr (i64 5 to %Qubit*)) - call void @__quantum__rt__array_record_output(i64 5, i8* null) - call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 0 to %Result*), i8* null) - call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 1 to %Result*), i8* null) - call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 2 to %Result*), i8* null) - call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 3 to %Result*), i8* null) - call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 4 to %Result*), i8* null) + call void @__quantum__rt__array_record_output(i64 5, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @empty_tag, i64 0, i64 0)) + call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 0 to %Result*), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @0, i64 0, i64 0)) + call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 1 to %Result*), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @1, i64 0, i64 0)) + call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 2 to %Result*), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @2, i64 0, i64 0)) + call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 3 to %Result*), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @3, i64 0, i64 0)) + call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 4 to %Result*), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @4, i64 0, i64 0)) ret i64 0 } diff --git a/source/pip/tests-integration/resources/adaptive_ri/output/BernsteinVaziraniNISQ.out b/source/pip/tests-integration/resources/adaptive_ri/output/BernsteinVaziraniNISQ.out index 79d40f1a26..f38ac80bb3 100644 --- a/source/pip/tests-integration/resources/adaptive_ri/output/BernsteinVaziraniNISQ.out +++ b/source/pip/tests-integration/resources/adaptive_ri/output/BernsteinVaziraniNISQ.out @@ -4,10 +4,10 @@ METADATA output_labeling_schema METADATA qir_profiles adaptive_profile METADATA required_num_qubits 6 METADATA required_num_results 5 -OUTPUT ARRAY 5 -OUTPUT RESULT 1 -OUTPUT RESULT 0 -OUTPUT RESULT 1 -OUTPUT RESULT 0 -OUTPUT RESULT 1 +OUTPUT ARRAY 5 +OUTPUT RESULT 1 0_a0r +OUTPUT RESULT 0 1_a1r +OUTPUT RESULT 1 2_a2r +OUTPUT RESULT 0 3_a3r +OUTPUT RESULT 1 4_a4r END 0 diff --git a/source/pip/tests-integration/resources/adaptive_ri/output/ConstantFolding.ll b/source/pip/tests-integration/resources/adaptive_ri/output/ConstantFolding.ll index 494eaf5422..511c1a8a9a 100644 --- a/source/pip/tests-integration/resources/adaptive_ri/output/ConstantFolding.ll +++ b/source/pip/tests-integration/resources/adaptive_ri/output/ConstantFolding.ll @@ -1,6 +1,12 @@ %Result = type opaque %Qubit = type opaque +@empty_tag = internal constant [1 x i8] c"\00" +@0 = internal constant [6 x i8] c"0_a0r\00" +@1 = internal constant [6 x i8] c"1_a1r\00" +@2 = internal constant [6 x i8] c"2_a2r\00" +@3 = internal constant [6 x i8] c"3_a3r\00" + define i64 @ENTRYPOINT__main() #0 { block_0: call void @__quantum__qis__x__body(%Qubit* inttoptr (i64 0 to %Qubit*)) @@ -31,11 +37,11 @@ block_0: call void @__quantum__qis__reset__body(%Qubit* inttoptr (i64 1 to %Qubit*)) call void @__quantum__qis__reset__body(%Qubit* inttoptr (i64 2 to %Qubit*)) call void @__quantum__qis__reset__body(%Qubit* inttoptr (i64 3 to %Qubit*)) - call void @__quantum__rt__array_record_output(i64 4, i8* null) - call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 0 to %Result*), i8* null) - call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 1 to %Result*), i8* null) - call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 2 to %Result*), i8* null) - call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 3 to %Result*), i8* null) + call void @__quantum__rt__array_record_output(i64 4, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @empty_tag, i64 0, i64 0)) + call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 0 to %Result*), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @0, i64 0, i64 0)) + call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 1 to %Result*), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @1, i64 0, i64 0)) + call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 2 to %Result*), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @2, i64 0, i64 0)) + call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 3 to %Result*), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @3, i64 0, i64 0)) ret i64 0 } diff --git a/source/pip/tests-integration/resources/adaptive_ri/output/ConstantFolding.out b/source/pip/tests-integration/resources/adaptive_ri/output/ConstantFolding.out index 6540306d87..68a2353638 100644 --- a/source/pip/tests-integration/resources/adaptive_ri/output/ConstantFolding.out +++ b/source/pip/tests-integration/resources/adaptive_ri/output/ConstantFolding.out @@ -4,9 +4,9 @@ METADATA output_labeling_schema METADATA qir_profiles adaptive_profile METADATA required_num_qubits 4 METADATA required_num_results 4 -OUTPUT ARRAY 4 -OUTPUT RESULT 1 -OUTPUT RESULT 1 -OUTPUT RESULT 1 -OUTPUT RESULT 1 +OUTPUT ARRAY 4 +OUTPUT RESULT 1 0_a0r +OUTPUT RESULT 1 1_a1r +OUTPUT RESULT 1 2_a2r +OUTPUT RESULT 1 3_a3r END 0 diff --git a/source/pip/tests-integration/resources/adaptive_ri/output/CopyAndUpdateExpressions.ll b/source/pip/tests-integration/resources/adaptive_ri/output/CopyAndUpdateExpressions.ll index 504c425882..84478d5058 100644 --- a/source/pip/tests-integration/resources/adaptive_ri/output/CopyAndUpdateExpressions.ll +++ b/source/pip/tests-integration/resources/adaptive_ri/output/CopyAndUpdateExpressions.ll @@ -1,6 +1,13 @@ %Result = type opaque %Qubit = type opaque +@empty_tag = internal constant [1 x i8] c"\00" +@0 = internal constant [8 x i8] c"0_t0a0r\00" +@1 = internal constant [8 x i8] c"1_t1a0r\00" +@2 = internal constant [8 x i8] c"2_t2a0r\00" +@3 = internal constant [8 x i8] c"3_t2a1r\00" +@4 = internal constant [8 x i8] c"4_t2a2r\00" + define i64 @ENTRYPOINT__main() #0 { block_0: call void @__quantum__qis__x__body(%Qubit* inttoptr (i64 0 to %Qubit*)) @@ -14,15 +21,15 @@ block_0: call void @__quantum__qis__x__body(%Qubit* inttoptr (i64 4 to %Qubit*)) call void @__quantum__qis__m__body(%Qubit* inttoptr (i64 3 to %Qubit*), %Result* inttoptr (i64 5 to %Result*)) call void @__quantum__qis__m__body(%Qubit* inttoptr (i64 4 to %Qubit*), %Result* inttoptr (i64 6 to %Result*)) - call void @__quantum__rt__tuple_record_output(i64 3, i8* null) - call void @__quantum__rt__array_record_output(i64 1, i8* null) - call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 0 to %Result*), i8* null) - call void @__quantum__rt__array_record_output(i64 1, i8* null) - call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 1 to %Result*), i8* null) - call void @__quantum__rt__array_record_output(i64 3, i8* null) - call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 2 to %Result*), i8* null) - call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 5 to %Result*), i8* null) - call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 6 to %Result*), i8* null) + call void @__quantum__rt__tuple_record_output(i64 3, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @empty_tag, i64 0, i64 0)) + call void @__quantum__rt__array_record_output(i64 1, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @empty_tag, i64 0, i64 0)) + call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 0 to %Result*), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @0, i64 0, i64 0)) + call void @__quantum__rt__array_record_output(i64 1, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @empty_tag, i64 0, i64 0)) + call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 1 to %Result*), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @1, i64 0, i64 0)) + call void @__quantum__rt__array_record_output(i64 3, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @empty_tag, i64 0, i64 0)) + call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 2 to %Result*), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @2, i64 0, i64 0)) + call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 5 to %Result*), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @3, i64 0, i64 0)) + call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 6 to %Result*), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @4, i64 0, i64 0)) ret i64 0 } diff --git a/source/pip/tests-integration/resources/adaptive_ri/output/CopyAndUpdateExpressions.out b/source/pip/tests-integration/resources/adaptive_ri/output/CopyAndUpdateExpressions.out index 81cb73fa43..3d3021c19a 100644 --- a/source/pip/tests-integration/resources/adaptive_ri/output/CopyAndUpdateExpressions.out +++ b/source/pip/tests-integration/resources/adaptive_ri/output/CopyAndUpdateExpressions.out @@ -4,13 +4,13 @@ METADATA output_labeling_schema METADATA qir_profiles adaptive_profile METADATA required_num_qubits 5 METADATA required_num_results 7 -OUTPUT TUPLE 3 -OUTPUT ARRAY 1 -OUTPUT RESULT 1 -OUTPUT ARRAY 1 -OUTPUT RESULT 0 -OUTPUT ARRAY 3 -OUTPUT RESULT 1 -OUTPUT RESULT 1 -OUTPUT RESULT 1 +OUTPUT TUPLE 3 +OUTPUT ARRAY 1 +OUTPUT RESULT 1 0_t0a0r +OUTPUT ARRAY 1 +OUTPUT RESULT 0 1_t1a0r +OUTPUT ARRAY 3 +OUTPUT RESULT 1 2_t2a0r +OUTPUT RESULT 1 3_t2a1r +OUTPUT RESULT 1 4_t2a2r END 0 diff --git a/source/pip/tests-integration/resources/adaptive_ri/output/DeutschJozsaNISQ.ll b/source/pip/tests-integration/resources/adaptive_ri/output/DeutschJozsaNISQ.ll index cc922b44b1..c52fb9d010 100644 --- a/source/pip/tests-integration/resources/adaptive_ri/output/DeutschJozsaNISQ.ll +++ b/source/pip/tests-integration/resources/adaptive_ri/output/DeutschJozsaNISQ.ll @@ -1,6 +1,16 @@ %Result = type opaque %Qubit = type opaque +@empty_tag = internal constant [1 x i8] c"\00" +@0 = internal constant [8 x i8] c"0_t0a0r\00" +@1 = internal constant [8 x i8] c"1_t0a1r\00" +@2 = internal constant [8 x i8] c"2_t0a2r\00" +@3 = internal constant [8 x i8] c"3_t0a3r\00" +@4 = internal constant [8 x i8] c"4_t1a0r\00" +@5 = internal constant [8 x i8] c"5_t1a1r\00" +@6 = internal constant [8 x i8] c"6_t1a2r\00" +@7 = internal constant [8 x i8] c"7_t1a3r\00" + define i64 @ENTRYPOINT__main() #0 { block_0: call void @__quantum__qis__x__body(%Qubit* inttoptr (i64 4 to %Qubit*)) @@ -43,17 +53,17 @@ block_0: call void @__quantum__qis__reset__body(%Qubit* inttoptr (i64 2 to %Qubit*)) call void @__quantum__qis__reset__body(%Qubit* inttoptr (i64 3 to %Qubit*)) call void @__quantum__qis__reset__body(%Qubit* inttoptr (i64 4 to %Qubit*)) - call void @__quantum__rt__tuple_record_output(i64 2, i8* null) - call void @__quantum__rt__array_record_output(i64 4, i8* null) - call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 0 to %Result*), i8* null) - call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 1 to %Result*), i8* null) - call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 2 to %Result*), i8* null) - call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 3 to %Result*), i8* null) - call void @__quantum__rt__array_record_output(i64 4, i8* null) - call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 4 to %Result*), i8* null) - call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 5 to %Result*), i8* null) - call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 6 to %Result*), i8* null) - call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 7 to %Result*), i8* null) + call void @__quantum__rt__tuple_record_output(i64 2, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @empty_tag, i64 0, i64 0)) + call void @__quantum__rt__array_record_output(i64 4, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @empty_tag, i64 0, i64 0)) + call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 0 to %Result*), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @0, i64 0, i64 0)) + call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 1 to %Result*), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @1, i64 0, i64 0)) + call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 2 to %Result*), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @2, i64 0, i64 0)) + call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 3 to %Result*), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @3, i64 0, i64 0)) + call void @__quantum__rt__array_record_output(i64 4, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @empty_tag, i64 0, i64 0)) + call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 4 to %Result*), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @4, i64 0, i64 0)) + call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 5 to %Result*), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @5, i64 0, i64 0)) + call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 6 to %Result*), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @6, i64 0, i64 0)) + call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 7 to %Result*), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @7, i64 0, i64 0)) ret i64 0 } diff --git a/source/pip/tests-integration/resources/adaptive_ri/output/DeutschJozsaNISQ.out b/source/pip/tests-integration/resources/adaptive_ri/output/DeutschJozsaNISQ.out index ffc1eae653..78defd7849 100644 --- a/source/pip/tests-integration/resources/adaptive_ri/output/DeutschJozsaNISQ.out +++ b/source/pip/tests-integration/resources/adaptive_ri/output/DeutschJozsaNISQ.out @@ -4,15 +4,15 @@ METADATA output_labeling_schema METADATA qir_profiles adaptive_profile METADATA required_num_qubits 5 METADATA required_num_results 8 -OUTPUT TUPLE 2 -OUTPUT ARRAY 4 -OUTPUT RESULT 1 -OUTPUT RESULT 0 -OUTPUT RESULT 0 -OUTPUT RESULT 0 -OUTPUT ARRAY 4 -OUTPUT RESULT 0 -OUTPUT RESULT 0 -OUTPUT RESULT 0 -OUTPUT RESULT 0 +OUTPUT TUPLE 2 +OUTPUT ARRAY 4 +OUTPUT RESULT 1 0_t0a0r +OUTPUT RESULT 0 1_t0a1r +OUTPUT RESULT 0 2_t0a2r +OUTPUT RESULT 0 3_t0a3r +OUTPUT ARRAY 4 +OUTPUT RESULT 0 4_t1a0r +OUTPUT RESULT 0 5_t1a1r +OUTPUT RESULT 0 6_t1a2r +OUTPUT RESULT 0 7_t1a3r END 0 diff --git a/source/pip/tests-integration/resources/adaptive_ri/output/ExpandedTests.ll b/source/pip/tests-integration/resources/adaptive_ri/output/ExpandedTests.ll index 0863c76ac6..b3b5594af9 100644 --- a/source/pip/tests-integration/resources/adaptive_ri/output/ExpandedTests.ll +++ b/source/pip/tests-integration/resources/adaptive_ri/output/ExpandedTests.ll @@ -1,6 +1,11 @@ %Result = type opaque %Qubit = type opaque +@empty_tag = internal constant [1 x i8] c"\00" +@0 = internal constant [8 x i8] c"0_t0a0r\00" +@1 = internal constant [8 x i8] c"1_t0a1r\00" +@2 = internal constant [6 x i8] c"2_t1r\00" + define i64 @ENTRYPOINT__main() #0 { block_0: call void @__quantum__qis__h__body(%Qubit* inttoptr (i64 0 to %Qubit*)) @@ -36,11 +41,11 @@ block_0: call void @__quantum__qis__cx__body(%Qubit* inttoptr (i64 2 to %Qubit*), %Qubit* inttoptr (i64 1 to %Qubit*)) call void @__quantum__qis__h__body(%Qubit* inttoptr (i64 2 to %Qubit*)) call void @__quantum__qis__m__body(%Qubit* inttoptr (i64 1 to %Qubit*), %Result* inttoptr (i64 2 to %Result*)) - call void @__quantum__rt__tuple_record_output(i64 2, i8* null) - call void @__quantum__rt__array_record_output(i64 2, i8* null) - call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 0 to %Result*), i8* null) - call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 1 to %Result*), i8* null) - call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 2 to %Result*), i8* null) + call void @__quantum__rt__tuple_record_output(i64 2, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @empty_tag, i64 0, i64 0)) + call void @__quantum__rt__array_record_output(i64 2, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @empty_tag, i64 0, i64 0)) + call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 0 to %Result*), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @0, i64 0, i64 0)) + call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 1 to %Result*), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @1, i64 0, i64 0)) + call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 2 to %Result*), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @2, i64 0, i64 0)) ret i64 0 } diff --git a/source/pip/tests-integration/resources/adaptive_ri/output/ExpandedTests.out b/source/pip/tests-integration/resources/adaptive_ri/output/ExpandedTests.out index 31695a48c4..f101117099 100644 --- a/source/pip/tests-integration/resources/adaptive_ri/output/ExpandedTests.out +++ b/source/pip/tests-integration/resources/adaptive_ri/output/ExpandedTests.out @@ -4,9 +4,9 @@ METADATA output_labeling_schema METADATA qir_profiles adaptive_profile METADATA required_num_qubits 3 METADATA required_num_results 3 -OUTPUT TUPLE 2 -OUTPUT ARRAY 2 -OUTPUT RESULT 0 -OUTPUT RESULT 1 -OUTPUT RESULT 0 +OUTPUT TUPLE 2 +OUTPUT ARRAY 2 +OUTPUT RESULT 0 0_t0a0r +OUTPUT RESULT 1 1_t0a1r +OUTPUT RESULT 0 2_t1r END 0 diff --git a/source/pip/tests-integration/resources/adaptive_ri/output/Functors.ll b/source/pip/tests-integration/resources/adaptive_ri/output/Functors.ll index c840f9ba71..2cb37604ba 100644 --- a/source/pip/tests-integration/resources/adaptive_ri/output/Functors.ll +++ b/source/pip/tests-integration/resources/adaptive_ri/output/Functors.ll @@ -1,6 +1,14 @@ %Result = type opaque %Qubit = type opaque +@empty_tag = internal constant [1 x i8] c"\00" +@0 = internal constant [8 x i8] c"0_t0a0r\00" +@1 = internal constant [8 x i8] c"1_t0a1r\00" +@2 = internal constant [8 x i8] c"2_t1a0r\00" +@3 = internal constant [8 x i8] c"3_t1a1r\00" +@4 = internal constant [8 x i8] c"4_t2a0r\00" +@5 = internal constant [8 x i8] c"5_t2a1r\00" + define i64 @ENTRYPOINT__main() #0 { block_0: call void @__quantum__qis__x__body(%Qubit* inttoptr (i64 0 to %Qubit*)) @@ -64,16 +72,16 @@ block_0: call void @__quantum__qis__reset__body(%Qubit* inttoptr (i64 5 to %Qubit*)) call void @__quantum__qis__reset__body(%Qubit* inttoptr (i64 6 to %Qubit*)) call void @__quantum__qis__reset__body(%Qubit* inttoptr (i64 7 to %Qubit*)) - call void @__quantum__rt__tuple_record_output(i64 3, i8* null) - call void @__quantum__rt__array_record_output(i64 2, i8* null) - call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 0 to %Result*), i8* null) - call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 1 to %Result*), i8* null) - call void @__quantum__rt__array_record_output(i64 2, i8* null) - call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 2 to %Result*), i8* null) - call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 3 to %Result*), i8* null) - call void @__quantum__rt__array_record_output(i64 2, i8* null) - call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 4 to %Result*), i8* null) - call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 5 to %Result*), i8* null) + call void @__quantum__rt__tuple_record_output(i64 3, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @empty_tag, i64 0, i64 0)) + call void @__quantum__rt__array_record_output(i64 2, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @empty_tag, i64 0, i64 0)) + call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 0 to %Result*), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @0, i64 0, i64 0)) + call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 1 to %Result*), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @1, i64 0, i64 0)) + call void @__quantum__rt__array_record_output(i64 2, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @empty_tag, i64 0, i64 0)) + call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 2 to %Result*), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @2, i64 0, i64 0)) + call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 3 to %Result*), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @3, i64 0, i64 0)) + call void @__quantum__rt__array_record_output(i64 2, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @empty_tag, i64 0, i64 0)) + call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 4 to %Result*), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @4, i64 0, i64 0)) + call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 5 to %Result*), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @5, i64 0, i64 0)) ret i64 0 } diff --git a/source/pip/tests-integration/resources/adaptive_ri/output/Functors.out b/source/pip/tests-integration/resources/adaptive_ri/output/Functors.out index 31048cb0c7..898c34efb4 100644 --- a/source/pip/tests-integration/resources/adaptive_ri/output/Functors.out +++ b/source/pip/tests-integration/resources/adaptive_ri/output/Functors.out @@ -4,14 +4,14 @@ METADATA output_labeling_schema METADATA qir_profiles adaptive_profile METADATA required_num_qubits 8 METADATA required_num_results 6 -OUTPUT TUPLE 3 -OUTPUT ARRAY 2 -OUTPUT RESULT 0 -OUTPUT RESULT 0 -OUTPUT ARRAY 2 -OUTPUT RESULT 1 -OUTPUT RESULT 1 -OUTPUT ARRAY 2 -OUTPUT RESULT 0 -OUTPUT RESULT 0 +OUTPUT TUPLE 3 +OUTPUT ARRAY 2 +OUTPUT RESULT 0 0_t0a0r +OUTPUT RESULT 0 1_t0a1r +OUTPUT ARRAY 2 +OUTPUT RESULT 1 2_t1a0r +OUTPUT RESULT 1 3_t1a1r +OUTPUT ARRAY 2 +OUTPUT RESULT 0 4_t2a0r +OUTPUT RESULT 0 5_t2a1r END 0 diff --git a/source/pip/tests-integration/resources/adaptive_ri/output/HiddenShiftNISQ.ll b/source/pip/tests-integration/resources/adaptive_ri/output/HiddenShiftNISQ.ll index dcf05986da..6f2b6d81c3 100644 --- a/source/pip/tests-integration/resources/adaptive_ri/output/HiddenShiftNISQ.ll +++ b/source/pip/tests-integration/resources/adaptive_ri/output/HiddenShiftNISQ.ll @@ -1,6 +1,14 @@ %Result = type opaque %Qubit = type opaque +@empty_tag = internal constant [1 x i8] c"\00" +@0 = internal constant [6 x i8] c"0_a0r\00" +@1 = internal constant [6 x i8] c"1_a1r\00" +@2 = internal constant [6 x i8] c"2_a2r\00" +@3 = internal constant [6 x i8] c"3_a3r\00" +@4 = internal constant [6 x i8] c"4_a4r\00" +@5 = internal constant [6 x i8] c"5_a5r\00" + define i64 @ENTRYPOINT__main() #0 { block_0: call void @__quantum__qis__h__body(%Qubit* inttoptr (i64 0 to %Qubit*)) @@ -37,13 +45,13 @@ block_0: call void @__quantum__qis__mresetz__body(%Qubit* inttoptr (i64 3 to %Qubit*), %Result* inttoptr (i64 3 to %Result*)) call void @__quantum__qis__mresetz__body(%Qubit* inttoptr (i64 4 to %Qubit*), %Result* inttoptr (i64 4 to %Result*)) call void @__quantum__qis__mresetz__body(%Qubit* inttoptr (i64 5 to %Qubit*), %Result* inttoptr (i64 5 to %Result*)) - call void @__quantum__rt__array_record_output(i64 6, i8* null) - call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 0 to %Result*), i8* null) - call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 1 to %Result*), i8* null) - call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 2 to %Result*), i8* null) - call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 3 to %Result*), i8* null) - call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 4 to %Result*), i8* null) - call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 5 to %Result*), i8* null) + call void @__quantum__rt__array_record_output(i64 6, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @empty_tag, i64 0, i64 0)) + call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 0 to %Result*), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @0, i64 0, i64 0)) + call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 1 to %Result*), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @1, i64 0, i64 0)) + call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 2 to %Result*), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @2, i64 0, i64 0)) + call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 3 to %Result*), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @3, i64 0, i64 0)) + call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 4 to %Result*), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @4, i64 0, i64 0)) + call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 5 to %Result*), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @5, i64 0, i64 0)) ret i64 0 } diff --git a/source/pip/tests-integration/resources/adaptive_ri/output/HiddenShiftNISQ.out b/source/pip/tests-integration/resources/adaptive_ri/output/HiddenShiftNISQ.out index 6e2f4aea5a..7240d2a55a 100644 --- a/source/pip/tests-integration/resources/adaptive_ri/output/HiddenShiftNISQ.out +++ b/source/pip/tests-integration/resources/adaptive_ri/output/HiddenShiftNISQ.out @@ -4,11 +4,11 @@ METADATA output_labeling_schema METADATA qir_profiles adaptive_profile METADATA required_num_qubits 6 METADATA required_num_results 6 -OUTPUT ARRAY 6 -OUTPUT RESULT 1 -OUTPUT RESULT 0 -OUTPUT RESULT 0 -OUTPUT RESULT 0 -OUTPUT RESULT 0 -OUTPUT RESULT 1 +OUTPUT ARRAY 6 +OUTPUT RESULT 1 0_a0r +OUTPUT RESULT 0 1_a1r +OUTPUT RESULT 0 2_a2r +OUTPUT RESULT 0 3_a3r +OUTPUT RESULT 0 4_a4r +OUTPUT RESULT 1 5_a5r END 0 diff --git a/source/pip/tests-integration/resources/adaptive_ri/output/IntegerComparison.ll b/source/pip/tests-integration/resources/adaptive_ri/output/IntegerComparison.ll index 7a094ba92f..90486108fa 100644 --- a/source/pip/tests-integration/resources/adaptive_ri/output/IntegerComparison.ll +++ b/source/pip/tests-integration/resources/adaptive_ri/output/IntegerComparison.ll @@ -1,6 +1,11 @@ %Result = type opaque %Qubit = type opaque +@empty_tag = internal constant [1 x i8] c"\00" +@0 = internal constant [6 x i8] c"0_t0b\00" +@1 = internal constant [6 x i8] c"1_t1b\00" +@2 = internal constant [6 x i8] c"2_t2b\00" + define i64 @ENTRYPOINT__main() #0 { block_0: call void @__quantum__qis__x__body(%Qubit* inttoptr (i64 0 to %Qubit*)) @@ -106,10 +111,10 @@ block_20: %var_31 = icmp sgt i64 %var_43, 5 %var_32 = icmp slt i64 %var_43, 5 %var_33 = icmp eq i64 %var_43, 10 - call void @__quantum__rt__tuple_record_output(i64 3, i8* null) - call void @__quantum__rt__bool_record_output(i1 %var_31, i8* null) - call void @__quantum__rt__bool_record_output(i1 %var_32, i8* null) - call void @__quantum__rt__bool_record_output(i1 %var_33, i8* null) + call void @__quantum__rt__tuple_record_output(i64 3, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @empty_tag, i64 0, i64 0)) + call void @__quantum__rt__bool_record_output(i1 %var_31, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @0, i64 0, i64 0)) + call void @__quantum__rt__bool_record_output(i1 %var_32, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @1, i64 0, i64 0)) + call void @__quantum__rt__bool_record_output(i1 %var_33, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @2, i64 0, i64 0)) ret i64 0 } diff --git a/source/pip/tests-integration/resources/adaptive_ri/output/IntegerComparison.out b/source/pip/tests-integration/resources/adaptive_ri/output/IntegerComparison.out index 90b9dc4529..813e1b5ab5 100644 --- a/source/pip/tests-integration/resources/adaptive_ri/output/IntegerComparison.out +++ b/source/pip/tests-integration/resources/adaptive_ri/output/IntegerComparison.out @@ -4,8 +4,8 @@ METADATA output_labeling_schema METADATA qir_profiles adaptive_profile METADATA required_num_qubits 1 METADATA required_num_results 10 -OUTPUT TUPLE 3 -OUTPUT BOOL true -OUTPUT BOOL false -OUTPUT BOOL true +OUTPUT TUPLE 3 +OUTPUT BOOL true 0_t0b +OUTPUT BOOL false 1_t1b +OUTPUT BOOL true 2_t2b END 0 diff --git a/source/pip/tests-integration/resources/adaptive_ri/output/IntrinsicCCNOT.ll b/source/pip/tests-integration/resources/adaptive_ri/output/IntrinsicCCNOT.ll index b7e7357b87..167d728013 100644 --- a/source/pip/tests-integration/resources/adaptive_ri/output/IntrinsicCCNOT.ll +++ b/source/pip/tests-integration/resources/adaptive_ri/output/IntrinsicCCNOT.ll @@ -1,6 +1,17 @@ %Result = type opaque %Qubit = type opaque +@empty_tag = internal constant [1 x i8] c"\00" +@0 = internal constant [8 x i8] c"0_t0a0r\00" +@1 = internal constant [8 x i8] c"1_t0a1r\00" +@2 = internal constant [8 x i8] c"2_t0a2r\00" +@3 = internal constant [8 x i8] c"3_t1a0r\00" +@4 = internal constant [8 x i8] c"4_t1a1r\00" +@5 = internal constant [8 x i8] c"5_t1a2r\00" +@6 = internal constant [8 x i8] c"6_t2a0r\00" +@7 = internal constant [8 x i8] c"7_t2a1r\00" +@8 = internal constant [8 x i8] c"8_t2a2r\00" + define i64 @ENTRYPOINT__main() #0 { block_0: call void @__quantum__qis__ccx__body(%Qubit* inttoptr (i64 0 to %Qubit*), %Qubit* inttoptr (i64 1 to %Qubit*), %Qubit* inttoptr (i64 2 to %Qubit*)) @@ -27,19 +38,19 @@ block_0: call void @__quantum__qis__reset__body(%Qubit* inttoptr (i64 6 to %Qubit*)) call void @__quantum__qis__reset__body(%Qubit* inttoptr (i64 7 to %Qubit*)) call void @__quantum__qis__reset__body(%Qubit* inttoptr (i64 8 to %Qubit*)) - call void @__quantum__rt__tuple_record_output(i64 3, i8* null) - call void @__quantum__rt__array_record_output(i64 3, i8* null) - call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 0 to %Result*), i8* null) - call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 1 to %Result*), i8* null) - call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 2 to %Result*), i8* null) - call void @__quantum__rt__array_record_output(i64 3, i8* null) - call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 3 to %Result*), i8* null) - call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 4 to %Result*), i8* null) - call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 5 to %Result*), i8* null) - call void @__quantum__rt__array_record_output(i64 3, i8* null) - call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 6 to %Result*), i8* null) - call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 7 to %Result*), i8* null) - call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 8 to %Result*), i8* null) + call void @__quantum__rt__tuple_record_output(i64 3, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @empty_tag, i64 0, i64 0)) + call void @__quantum__rt__array_record_output(i64 3, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @empty_tag, i64 0, i64 0)) + call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 0 to %Result*), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @0, i64 0, i64 0)) + call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 1 to %Result*), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @1, i64 0, i64 0)) + call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 2 to %Result*), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @2, i64 0, i64 0)) + call void @__quantum__rt__array_record_output(i64 3, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @empty_tag, i64 0, i64 0)) + call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 3 to %Result*), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @3, i64 0, i64 0)) + call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 4 to %Result*), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @4, i64 0, i64 0)) + call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 5 to %Result*), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @5, i64 0, i64 0)) + call void @__quantum__rt__array_record_output(i64 3, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @empty_tag, i64 0, i64 0)) + call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 6 to %Result*), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @6, i64 0, i64 0)) + call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 7 to %Result*), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @7, i64 0, i64 0)) + call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 8 to %Result*), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @8, i64 0, i64 0)) ret i64 0 } diff --git a/source/pip/tests-integration/resources/adaptive_ri/output/IntrinsicCCNOT.out b/source/pip/tests-integration/resources/adaptive_ri/output/IntrinsicCCNOT.out index 749e4a40b0..7992145354 100644 --- a/source/pip/tests-integration/resources/adaptive_ri/output/IntrinsicCCNOT.out +++ b/source/pip/tests-integration/resources/adaptive_ri/output/IntrinsicCCNOT.out @@ -4,17 +4,17 @@ METADATA output_labeling_schema METADATA qir_profiles adaptive_profile METADATA required_num_qubits 9 METADATA required_num_results 9 -OUTPUT TUPLE 3 -OUTPUT ARRAY 3 -OUTPUT RESULT 0 -OUTPUT RESULT 0 -OUTPUT RESULT 0 -OUTPUT ARRAY 3 -OUTPUT RESULT 1 -OUTPUT RESULT 0 -OUTPUT RESULT 0 -OUTPUT ARRAY 3 -OUTPUT RESULT 1 -OUTPUT RESULT 1 -OUTPUT RESULT 1 +OUTPUT TUPLE 3 +OUTPUT ARRAY 3 +OUTPUT RESULT 0 0_t0a0r +OUTPUT RESULT 0 1_t0a1r +OUTPUT RESULT 0 2_t0a2r +OUTPUT ARRAY 3 +OUTPUT RESULT 1 3_t1a0r +OUTPUT RESULT 0 4_t1a1r +OUTPUT RESULT 0 5_t1a2r +OUTPUT ARRAY 3 +OUTPUT RESULT 1 6_t2a0r +OUTPUT RESULT 1 7_t2a1r +OUTPUT RESULT 1 8_t2a2r END 0 diff --git a/source/pip/tests-integration/resources/adaptive_ri/output/IntrinsicCNOT.ll b/source/pip/tests-integration/resources/adaptive_ri/output/IntrinsicCNOT.ll index 1828fba55a..7bc8410395 100644 --- a/source/pip/tests-integration/resources/adaptive_ri/output/IntrinsicCNOT.ll +++ b/source/pip/tests-integration/resources/adaptive_ri/output/IntrinsicCNOT.ll @@ -1,6 +1,12 @@ %Result = type opaque %Qubit = type opaque +@empty_tag = internal constant [1 x i8] c"\00" +@0 = internal constant [8 x i8] c"0_t0a0r\00" +@1 = internal constant [8 x i8] c"1_t0a1r\00" +@2 = internal constant [8 x i8] c"2_t1a0r\00" +@3 = internal constant [8 x i8] c"3_t1a1r\00" + define i64 @ENTRYPOINT__main() #0 { block_0: call void @__quantum__qis__cx__body(%Qubit* inttoptr (i64 0 to %Qubit*), %Qubit* inttoptr (i64 1 to %Qubit*)) @@ -14,13 +20,13 @@ block_0: call void @__quantum__qis__m__body(%Qubit* inttoptr (i64 3 to %Qubit*), %Result* inttoptr (i64 3 to %Result*)) call void @__quantum__qis__reset__body(%Qubit* inttoptr (i64 2 to %Qubit*)) call void @__quantum__qis__reset__body(%Qubit* inttoptr (i64 3 to %Qubit*)) - call void @__quantum__rt__tuple_record_output(i64 2, i8* null) - call void @__quantum__rt__array_record_output(i64 2, i8* null) - call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 0 to %Result*), i8* null) - call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 1 to %Result*), i8* null) - call void @__quantum__rt__array_record_output(i64 2, i8* null) - call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 2 to %Result*), i8* null) - call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 3 to %Result*), i8* null) + call void @__quantum__rt__tuple_record_output(i64 2, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @empty_tag, i64 0, i64 0)) + call void @__quantum__rt__array_record_output(i64 2, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @empty_tag, i64 0, i64 0)) + call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 0 to %Result*), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @0, i64 0, i64 0)) + call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 1 to %Result*), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @1, i64 0, i64 0)) + call void @__quantum__rt__array_record_output(i64 2, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @empty_tag, i64 0, i64 0)) + call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 2 to %Result*), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @2, i64 0, i64 0)) + call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 3 to %Result*), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @3, i64 0, i64 0)) ret i64 0 } diff --git a/source/pip/tests-integration/resources/adaptive_ri/output/IntrinsicCNOT.out b/source/pip/tests-integration/resources/adaptive_ri/output/IntrinsicCNOT.out index 7eaf5aef5b..76b6ee28a5 100644 --- a/source/pip/tests-integration/resources/adaptive_ri/output/IntrinsicCNOT.out +++ b/source/pip/tests-integration/resources/adaptive_ri/output/IntrinsicCNOT.out @@ -4,11 +4,11 @@ METADATA output_labeling_schema METADATA qir_profiles adaptive_profile METADATA required_num_qubits 4 METADATA required_num_results 4 -OUTPUT TUPLE 2 -OUTPUT ARRAY 2 -OUTPUT RESULT 0 -OUTPUT RESULT 0 -OUTPUT ARRAY 2 -OUTPUT RESULT 1 -OUTPUT RESULT 1 +OUTPUT TUPLE 2 +OUTPUT ARRAY 2 +OUTPUT RESULT 0 0_t0a0r +OUTPUT RESULT 0 1_t0a1r +OUTPUT ARRAY 2 +OUTPUT RESULT 1 2_t1a0r +OUTPUT RESULT 1 3_t1a1r END 0 diff --git a/source/pip/tests-integration/resources/adaptive_ri/output/IntrinsicHIXYZ.ll b/source/pip/tests-integration/resources/adaptive_ri/output/IntrinsicHIXYZ.ll index 95f87dc8d1..216b1741bf 100644 --- a/source/pip/tests-integration/resources/adaptive_ri/output/IntrinsicHIXYZ.ll +++ b/source/pip/tests-integration/resources/adaptive_ri/output/IntrinsicHIXYZ.ll @@ -1,6 +1,14 @@ %Result = type opaque %Qubit = type opaque +@empty_tag = internal constant [1 x i8] c"\00" +@0 = internal constant [6 x i8] c"0_t0r\00" +@1 = internal constant [6 x i8] c"1_t1r\00" +@2 = internal constant [6 x i8] c"2_t2r\00" +@3 = internal constant [6 x i8] c"3_t3r\00" +@4 = internal constant [6 x i8] c"4_t4r\00" +@5 = internal constant [6 x i8] c"5_t5r\00" + define i64 @ENTRYPOINT__main() #0 { block_0: call void @__quantum__qis__h__body(%Qubit* inttoptr (i64 0 to %Qubit*)) @@ -21,13 +29,13 @@ block_0: call void @__quantum__qis__z__body(%Qubit* inttoptr (i64 5 to %Qubit*)) call void @__quantum__qis__h__body(%Qubit* inttoptr (i64 5 to %Qubit*)) call void @__quantum__qis__mresetz__body(%Qubit* inttoptr (i64 5 to %Qubit*), %Result* inttoptr (i64 5 to %Result*)) - call void @__quantum__rt__tuple_record_output(i64 6, i8* null) - call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 0 to %Result*), i8* null) - call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 1 to %Result*), i8* null) - call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 2 to %Result*), i8* null) - call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 3 to %Result*), i8* null) - call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 4 to %Result*), i8* null) - call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 5 to %Result*), i8* null) + call void @__quantum__rt__tuple_record_output(i64 6, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @empty_tag, i64 0, i64 0)) + call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 0 to %Result*), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @0, i64 0, i64 0)) + call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 1 to %Result*), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @1, i64 0, i64 0)) + call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 2 to %Result*), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @2, i64 0, i64 0)) + call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 3 to %Result*), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @3, i64 0, i64 0)) + call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 4 to %Result*), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @4, i64 0, i64 0)) + call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 5 to %Result*), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @5, i64 0, i64 0)) ret i64 0 } diff --git a/source/pip/tests-integration/resources/adaptive_ri/output/IntrinsicHIXYZ.out b/source/pip/tests-integration/resources/adaptive_ri/output/IntrinsicHIXYZ.out index 158d94e405..c607476ce0 100644 --- a/source/pip/tests-integration/resources/adaptive_ri/output/IntrinsicHIXYZ.out +++ b/source/pip/tests-integration/resources/adaptive_ri/output/IntrinsicHIXYZ.out @@ -4,11 +4,11 @@ METADATA output_labeling_schema METADATA qir_profiles adaptive_profile METADATA required_num_qubits 6 METADATA required_num_results 6 -OUTPUT TUPLE 6 -OUTPUT RESULT 1 -OUTPUT RESULT 1 -OUTPUT RESULT 1 -OUTPUT RESULT 1 -OUTPUT RESULT 1 -OUTPUT RESULT 1 +OUTPUT TUPLE 6 +OUTPUT RESULT 1 0_t0r +OUTPUT RESULT 1 1_t1r +OUTPUT RESULT 1 2_t2r +OUTPUT RESULT 1 3_t3r +OUTPUT RESULT 1 4_t4r +OUTPUT RESULT 1 5_t5r END 0 diff --git a/source/pip/tests-integration/resources/adaptive_ri/output/IntrinsicM.ll b/source/pip/tests-integration/resources/adaptive_ri/output/IntrinsicM.ll index 40a57fd26b..80ea18c59c 100644 --- a/source/pip/tests-integration/resources/adaptive_ri/output/IntrinsicM.ll +++ b/source/pip/tests-integration/resources/adaptive_ri/output/IntrinsicM.ll @@ -1,6 +1,10 @@ %Result = type opaque %Qubit = type opaque +@empty_tag = internal constant [1 x i8] c"\00" +@0 = internal constant [6 x i8] c"0_t0r\00" +@1 = internal constant [6 x i8] c"1_t1r\00" + define i64 @ENTRYPOINT__main() #0 { block_0: call void @__quantum__qis__m__body(%Qubit* inttoptr (i64 0 to %Qubit*), %Result* inttoptr (i64 0 to %Result*)) @@ -8,9 +12,9 @@ block_0: call void @__quantum__qis__m__body(%Qubit* inttoptr (i64 1 to %Qubit*), %Result* inttoptr (i64 1 to %Result*)) call void @__quantum__qis__reset__body(%Qubit* inttoptr (i64 0 to %Qubit*)) call void @__quantum__qis__reset__body(%Qubit* inttoptr (i64 1 to %Qubit*)) - call void @__quantum__rt__tuple_record_output(i64 2, i8* null) - call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 0 to %Result*), i8* null) - call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 1 to %Result*), i8* null) + call void @__quantum__rt__tuple_record_output(i64 2, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @empty_tag, i64 0, i64 0)) + call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 0 to %Result*), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @0, i64 0, i64 0)) + call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 1 to %Result*), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @1, i64 0, i64 0)) ret i64 0 } diff --git a/source/pip/tests-integration/resources/adaptive_ri/output/IntrinsicM.out b/source/pip/tests-integration/resources/adaptive_ri/output/IntrinsicM.out index 9726cf796d..4c9a278947 100644 --- a/source/pip/tests-integration/resources/adaptive_ri/output/IntrinsicM.out +++ b/source/pip/tests-integration/resources/adaptive_ri/output/IntrinsicM.out @@ -4,7 +4,7 @@ METADATA output_labeling_schema METADATA qir_profiles adaptive_profile METADATA required_num_qubits 2 METADATA required_num_results 2 -OUTPUT TUPLE 2 -OUTPUT RESULT 0 -OUTPUT RESULT 1 +OUTPUT TUPLE 2 +OUTPUT RESULT 0 0_t0r +OUTPUT RESULT 1 1_t1r END 0 diff --git a/source/pip/tests-integration/resources/adaptive_ri/output/IntrinsicMeasureWithBitFlipCode.ll b/source/pip/tests-integration/resources/adaptive_ri/output/IntrinsicMeasureWithBitFlipCode.ll index 8a763ddda2..bdd130dc3a 100644 --- a/source/pip/tests-integration/resources/adaptive_ri/output/IntrinsicMeasureWithBitFlipCode.ll +++ b/source/pip/tests-integration/resources/adaptive_ri/output/IntrinsicMeasureWithBitFlipCode.ll @@ -1,6 +1,15 @@ %Result = type opaque %Qubit = type opaque +@empty_tag = internal constant [1 x i8] c"\00" +@0 = internal constant [8 x i8] c"0_t0a0r\00" +@1 = internal constant [8 x i8] c"1_t0a1r\00" +@2 = internal constant [8 x i8] c"2_t1a0r\00" +@3 = internal constant [8 x i8] c"3_t1a1r\00" +@4 = internal constant [8 x i8] c"4_t2a0r\00" +@5 = internal constant [8 x i8] c"5_t2a1r\00" +@6 = internal constant [8 x i8] c"6_t2a2r\00" + define i64 @ENTRYPOINT__main() #0 { block_0: call void @__quantum__qis__cx__body(%Qubit* inttoptr (i64 0 to %Qubit*), %Qubit* inttoptr (i64 1 to %Qubit*)) @@ -31,17 +40,17 @@ block_0: call void @__quantum__qis__mresetz__body(%Qubit* inttoptr (i64 0 to %Qubit*), %Result* inttoptr (i64 4 to %Result*)) call void @__quantum__qis__mresetz__body(%Qubit* inttoptr (i64 1 to %Qubit*), %Result* inttoptr (i64 5 to %Result*)) call void @__quantum__qis__mresetz__body(%Qubit* inttoptr (i64 2 to %Qubit*), %Result* inttoptr (i64 6 to %Result*)) - call void @__quantum__rt__tuple_record_output(i64 3, i8* null) - call void @__quantum__rt__array_record_output(i64 2, i8* null) - call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 0 to %Result*), i8* null) - call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 1 to %Result*), i8* null) - call void @__quantum__rt__array_record_output(i64 2, i8* null) - call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 2 to %Result*), i8* null) - call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 3 to %Result*), i8* null) - call void @__quantum__rt__array_record_output(i64 3, i8* null) - call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 4 to %Result*), i8* null) - call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 5 to %Result*), i8* null) - call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 6 to %Result*), i8* null) + call void @__quantum__rt__tuple_record_output(i64 3, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @empty_tag, i64 0, i64 0)) + call void @__quantum__rt__array_record_output(i64 2, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @empty_tag, i64 0, i64 0)) + call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 0 to %Result*), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @0, i64 0, i64 0)) + call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 1 to %Result*), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @1, i64 0, i64 0)) + call void @__quantum__rt__array_record_output(i64 2, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @empty_tag, i64 0, i64 0)) + call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 2 to %Result*), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @2, i64 0, i64 0)) + call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 3 to %Result*), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @3, i64 0, i64 0)) + call void @__quantum__rt__array_record_output(i64 3, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @empty_tag, i64 0, i64 0)) + call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 4 to %Result*), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @4, i64 0, i64 0)) + call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 5 to %Result*), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @5, i64 0, i64 0)) + call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 6 to %Result*), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @6, i64 0, i64 0)) ret i64 0 } diff --git a/source/pip/tests-integration/resources/adaptive_ri/output/IntrinsicMeasureWithBitFlipCode.out b/source/pip/tests-integration/resources/adaptive_ri/output/IntrinsicMeasureWithBitFlipCode.out index e7d56532b1..d9ce7d1330 100644 --- a/source/pip/tests-integration/resources/adaptive_ri/output/IntrinsicMeasureWithBitFlipCode.out +++ b/source/pip/tests-integration/resources/adaptive_ri/output/IntrinsicMeasureWithBitFlipCode.out @@ -4,15 +4,15 @@ METADATA output_labeling_schema METADATA qir_profiles adaptive_profile METADATA required_num_qubits 4 METADATA required_num_results 7 -OUTPUT TUPLE 3 -OUTPUT ARRAY 2 -OUTPUT RESULT 0 -OUTPUT RESULT 0 -OUTPUT ARRAY 2 -OUTPUT RESULT 0 -OUTPUT RESULT 1 -OUTPUT ARRAY 3 -OUTPUT RESULT 0 -OUTPUT RESULT 0 -OUTPUT RESULT 1 +OUTPUT TUPLE 3 +OUTPUT ARRAY 2 +OUTPUT RESULT 0 0_t0a0r +OUTPUT RESULT 0 1_t0a1r +OUTPUT ARRAY 2 +OUTPUT RESULT 0 2_t1a0r +OUTPUT RESULT 1 3_t1a1r +OUTPUT ARRAY 3 +OUTPUT RESULT 0 4_t2a0r +OUTPUT RESULT 0 5_t2a1r +OUTPUT RESULT 1 6_t2a2r END 0 diff --git a/source/pip/tests-integration/resources/adaptive_ri/output/IntrinsicMeasureWithPhaseFlipCode.ll b/source/pip/tests-integration/resources/adaptive_ri/output/IntrinsicMeasureWithPhaseFlipCode.ll index fe6a3eaec6..fccc7385b5 100644 --- a/source/pip/tests-integration/resources/adaptive_ri/output/IntrinsicMeasureWithPhaseFlipCode.ll +++ b/source/pip/tests-integration/resources/adaptive_ri/output/IntrinsicMeasureWithPhaseFlipCode.ll @@ -1,6 +1,15 @@ %Result = type opaque %Qubit = type opaque +@empty_tag = internal constant [1 x i8] c"\00" +@0 = internal constant [8 x i8] c"0_t0a0r\00" +@1 = internal constant [8 x i8] c"1_t0a1r\00" +@2 = internal constant [8 x i8] c"2_t1a0r\00" +@3 = internal constant [8 x i8] c"3_t1a1r\00" +@4 = internal constant [8 x i8] c"4_t2a0r\00" +@5 = internal constant [8 x i8] c"5_t2a1r\00" +@6 = internal constant [8 x i8] c"6_t2a2r\00" + define i64 @ENTRYPOINT__main() #0 { block_0: call void @__quantum__qis__cx__body(%Qubit* inttoptr (i64 0 to %Qubit*), %Qubit* inttoptr (i64 1 to %Qubit*)) @@ -37,17 +46,17 @@ block_0: call void @__quantum__qis__mresetz__body(%Qubit* inttoptr (i64 0 to %Qubit*), %Result* inttoptr (i64 4 to %Result*)) call void @__quantum__qis__mresetz__body(%Qubit* inttoptr (i64 1 to %Qubit*), %Result* inttoptr (i64 5 to %Result*)) call void @__quantum__qis__mresetz__body(%Qubit* inttoptr (i64 2 to %Qubit*), %Result* inttoptr (i64 6 to %Result*)) - call void @__quantum__rt__tuple_record_output(i64 3, i8* null) - call void @__quantum__rt__array_record_output(i64 2, i8* null) - call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 0 to %Result*), i8* null) - call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 1 to %Result*), i8* null) - call void @__quantum__rt__array_record_output(i64 2, i8* null) - call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 2 to %Result*), i8* null) - call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 3 to %Result*), i8* null) - call void @__quantum__rt__array_record_output(i64 3, i8* null) - call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 4 to %Result*), i8* null) - call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 5 to %Result*), i8* null) - call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 6 to %Result*), i8* null) + call void @__quantum__rt__tuple_record_output(i64 3, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @empty_tag, i64 0, i64 0)) + call void @__quantum__rt__array_record_output(i64 2, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @empty_tag, i64 0, i64 0)) + call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 0 to %Result*), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @0, i64 0, i64 0)) + call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 1 to %Result*), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @1, i64 0, i64 0)) + call void @__quantum__rt__array_record_output(i64 2, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @empty_tag, i64 0, i64 0)) + call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 2 to %Result*), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @2, i64 0, i64 0)) + call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 3 to %Result*), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @3, i64 0, i64 0)) + call void @__quantum__rt__array_record_output(i64 3, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @empty_tag, i64 0, i64 0)) + call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 4 to %Result*), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @4, i64 0, i64 0)) + call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 5 to %Result*), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @5, i64 0, i64 0)) + call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 6 to %Result*), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @6, i64 0, i64 0)) ret i64 0 } diff --git a/source/pip/tests-integration/resources/adaptive_ri/output/IntrinsicMeasureWithPhaseFlipCode.out b/source/pip/tests-integration/resources/adaptive_ri/output/IntrinsicMeasureWithPhaseFlipCode.out index ffad183cb9..433f7ce017 100644 --- a/source/pip/tests-integration/resources/adaptive_ri/output/IntrinsicMeasureWithPhaseFlipCode.out +++ b/source/pip/tests-integration/resources/adaptive_ri/output/IntrinsicMeasureWithPhaseFlipCode.out @@ -4,15 +4,15 @@ METADATA output_labeling_schema METADATA qir_profiles adaptive_profile METADATA required_num_qubits 4 METADATA required_num_results 7 -OUTPUT TUPLE 3 -OUTPUT ARRAY 2 -OUTPUT RESULT 0 -OUTPUT RESULT 0 -OUTPUT ARRAY 2 -OUTPUT RESULT 1 -OUTPUT RESULT 1 -OUTPUT ARRAY 3 -OUTPUT RESULT 0 -OUTPUT RESULT 1 -OUTPUT RESULT 0 +OUTPUT TUPLE 3 +OUTPUT ARRAY 2 +OUTPUT RESULT 0 0_t0a0r +OUTPUT RESULT 0 1_t0a1r +OUTPUT ARRAY 2 +OUTPUT RESULT 1 2_t1a0r +OUTPUT RESULT 1 3_t1a1r +OUTPUT ARRAY 3 +OUTPUT RESULT 0 4_t2a0r +OUTPUT RESULT 1 5_t2a1r +OUTPUT RESULT 0 6_t2a2r END 0 diff --git a/source/pip/tests-integration/resources/adaptive_ri/output/IntrinsicRotationsWithPeriod.ll b/source/pip/tests-integration/resources/adaptive_ri/output/IntrinsicRotationsWithPeriod.ll index 0b45b3431e..cf70c79c29 100644 --- a/source/pip/tests-integration/resources/adaptive_ri/output/IntrinsicRotationsWithPeriod.ll +++ b/source/pip/tests-integration/resources/adaptive_ri/output/IntrinsicRotationsWithPeriod.ll @@ -1,6 +1,14 @@ %Result = type opaque %Qubit = type opaque +@empty_tag = internal constant [1 x i8] c"\00" +@0 = internal constant [8 x i8] c"0_t0a0r\00" +@1 = internal constant [8 x i8] c"1_t0a1r\00" +@2 = internal constant [8 x i8] c"2_t1a0r\00" +@3 = internal constant [8 x i8] c"3_t1a1r\00" +@4 = internal constant [8 x i8] c"4_t2a0r\00" +@5 = internal constant [8 x i8] c"5_t2a1r\00" + define i64 @ENTRYPOINT__main() #0 { block_0: call void @__quantum__qis__x__body(%Qubit* inttoptr (i64 0 to %Qubit*)) @@ -67,16 +75,16 @@ block_0: call void @__quantum__qis__mresetz__body(%Qubit* inttoptr (i64 3 to %Qubit*), %Result* inttoptr (i64 3 to %Result*)) call void @__quantum__qis__mresetz__body(%Qubit* inttoptr (i64 4 to %Qubit*), %Result* inttoptr (i64 4 to %Result*)) call void @__quantum__qis__mresetz__body(%Qubit* inttoptr (i64 5 to %Qubit*), %Result* inttoptr (i64 5 to %Result*)) - call void @__quantum__rt__tuple_record_output(i64 3, i8* null) - call void @__quantum__rt__array_record_output(i64 2, i8* null) - call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 0 to %Result*), i8* null) - call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 1 to %Result*), i8* null) - call void @__quantum__rt__array_record_output(i64 2, i8* null) - call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 2 to %Result*), i8* null) - call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 3 to %Result*), i8* null) - call void @__quantum__rt__array_record_output(i64 2, i8* null) - call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 4 to %Result*), i8* null) - call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 5 to %Result*), i8* null) + call void @__quantum__rt__tuple_record_output(i64 3, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @empty_tag, i64 0, i64 0)) + call void @__quantum__rt__array_record_output(i64 2, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @empty_tag, i64 0, i64 0)) + call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 0 to %Result*), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @0, i64 0, i64 0)) + call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 1 to %Result*), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @1, i64 0, i64 0)) + call void @__quantum__rt__array_record_output(i64 2, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @empty_tag, i64 0, i64 0)) + call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 2 to %Result*), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @2, i64 0, i64 0)) + call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 3 to %Result*), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @3, i64 0, i64 0)) + call void @__quantum__rt__array_record_output(i64 2, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @empty_tag, i64 0, i64 0)) + call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 4 to %Result*), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @4, i64 0, i64 0)) + call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 5 to %Result*), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @5, i64 0, i64 0)) ret i64 0 } diff --git a/source/pip/tests-integration/resources/adaptive_ri/output/IntrinsicRotationsWithPeriod.out b/source/pip/tests-integration/resources/adaptive_ri/output/IntrinsicRotationsWithPeriod.out index ad57e6aa7f..4875b8166f 100644 --- a/source/pip/tests-integration/resources/adaptive_ri/output/IntrinsicRotationsWithPeriod.out +++ b/source/pip/tests-integration/resources/adaptive_ri/output/IntrinsicRotationsWithPeriod.out @@ -4,14 +4,14 @@ METADATA output_labeling_schema METADATA qir_profiles adaptive_profile METADATA required_num_qubits 6 METADATA required_num_results 6 -OUTPUT TUPLE 3 -OUTPUT ARRAY 2 -OUTPUT RESULT 1 -OUTPUT RESULT 1 -OUTPUT ARRAY 2 -OUTPUT RESULT 1 -OUTPUT RESULT 1 -OUTPUT ARRAY 2 -OUTPUT RESULT 1 -OUTPUT RESULT 1 +OUTPUT TUPLE 3 +OUTPUT ARRAY 2 +OUTPUT RESULT 1 0_t0a0r +OUTPUT RESULT 1 1_t0a1r +OUTPUT ARRAY 2 +OUTPUT RESULT 1 2_t1a0r +OUTPUT RESULT 1 3_t1a1r +OUTPUT ARRAY 2 +OUTPUT RESULT 1 4_t2a0r +OUTPUT RESULT 1 5_t2a1r END 0 diff --git a/source/pip/tests-integration/resources/adaptive_ri/output/IntrinsicSTSWAP.ll b/source/pip/tests-integration/resources/adaptive_ri/output/IntrinsicSTSWAP.ll index c2bb7b0249..a05a48e3dd 100644 --- a/source/pip/tests-integration/resources/adaptive_ri/output/IntrinsicSTSWAP.ll +++ b/source/pip/tests-integration/resources/adaptive_ri/output/IntrinsicSTSWAP.ll @@ -1,6 +1,12 @@ %Result = type opaque %Qubit = type opaque +@empty_tag = internal constant [1 x i8] c"\00" +@0 = internal constant [6 x i8] c"0_t0r\00" +@1 = internal constant [6 x i8] c"1_t1r\00" +@2 = internal constant [8 x i8] c"2_t2a0r\00" +@3 = internal constant [8 x i8] c"3_t2a1r\00" + define i64 @ENTRYPOINT__main() #0 { block_0: call void @__quantum__qis__h__body(%Qubit* inttoptr (i64 0 to %Qubit*)) @@ -19,12 +25,12 @@ block_0: call void @__quantum__qis__swap__body(%Qubit* inttoptr (i64 2 to %Qubit*), %Qubit* inttoptr (i64 3 to %Qubit*)) call void @__quantum__qis__mresetz__body(%Qubit* inttoptr (i64 2 to %Qubit*), %Result* inttoptr (i64 2 to %Result*)) call void @__quantum__qis__mresetz__body(%Qubit* inttoptr (i64 3 to %Qubit*), %Result* inttoptr (i64 3 to %Result*)) - call void @__quantum__rt__tuple_record_output(i64 3, i8* null) - call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 0 to %Result*), i8* null) - call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 1 to %Result*), i8* null) - call void @__quantum__rt__array_record_output(i64 2, i8* null) - call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 2 to %Result*), i8* null) - call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 3 to %Result*), i8* null) + call void @__quantum__rt__tuple_record_output(i64 3, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @empty_tag, i64 0, i64 0)) + call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 0 to %Result*), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @0, i64 0, i64 0)) + call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 1 to %Result*), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @1, i64 0, i64 0)) + call void @__quantum__rt__array_record_output(i64 2, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @empty_tag, i64 0, i64 0)) + call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 2 to %Result*), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @2, i64 0, i64 0)) + call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 3 to %Result*), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @3, i64 0, i64 0)) ret i64 0 } diff --git a/source/pip/tests-integration/resources/adaptive_ri/output/IntrinsicSTSWAP.out b/source/pip/tests-integration/resources/adaptive_ri/output/IntrinsicSTSWAP.out index 5fd0c3c05f..45697e381a 100644 --- a/source/pip/tests-integration/resources/adaptive_ri/output/IntrinsicSTSWAP.out +++ b/source/pip/tests-integration/resources/adaptive_ri/output/IntrinsicSTSWAP.out @@ -4,10 +4,10 @@ METADATA output_labeling_schema METADATA qir_profiles adaptive_profile METADATA required_num_qubits 4 METADATA required_num_results 4 -OUTPUT TUPLE 3 -OUTPUT RESULT 1 -OUTPUT RESULT 1 -OUTPUT ARRAY 2 -OUTPUT RESULT 1 -OUTPUT RESULT 0 +OUTPUT TUPLE 3 +OUTPUT RESULT 1 0_t0r +OUTPUT RESULT 1 1_t1r +OUTPUT ARRAY 2 +OUTPUT RESULT 1 2_t2a0r +OUTPUT RESULT 0 3_t2a1r END 0 diff --git a/source/pip/tests-integration/resources/adaptive_ri/output/MeasureAndReuse.ll b/source/pip/tests-integration/resources/adaptive_ri/output/MeasureAndReuse.ll index 27fb460bf7..0ff7212a85 100644 --- a/source/pip/tests-integration/resources/adaptive_ri/output/MeasureAndReuse.ll +++ b/source/pip/tests-integration/resources/adaptive_ri/output/MeasureAndReuse.ll @@ -1,6 +1,13 @@ %Result = type opaque %Qubit = type opaque +@empty_tag = internal constant [1 x i8] c"\00" +@0 = internal constant [6 x i8] c"0_t0r\00" +@1 = internal constant [6 x i8] c"1_t1r\00" +@2 = internal constant [6 x i8] c"2_t2r\00" +@3 = internal constant [6 x i8] c"3_t3r\00" +@4 = internal constant [6 x i8] c"4_t4r\00" + define i64 @ENTRYPOINT__main() #0 { block_0: call void @__quantum__qis__m__body(%Qubit* inttoptr (i64 0 to %Qubit*), %Result* inttoptr (i64 0 to %Result*)) @@ -16,12 +23,12 @@ block_0: call void @__quantum__qis__s__adj(%Qubit* inttoptr (i64 0 to %Qubit*)) call void @__quantum__qis__h__body(%Qubit* inttoptr (i64 0 to %Qubit*)) call void @__quantum__qis__mresetz__body(%Qubit* inttoptr (i64 0 to %Qubit*), %Result* inttoptr (i64 4 to %Result*)) - call void @__quantum__rt__tuple_record_output(i64 5, i8* null) - call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 0 to %Result*), i8* null) - call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 1 to %Result*), i8* null) - call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 2 to %Result*), i8* null) - call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 3 to %Result*), i8* null) - call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 4 to %Result*), i8* null) + call void @__quantum__rt__tuple_record_output(i64 5, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @empty_tag, i64 0, i64 0)) + call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 0 to %Result*), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @0, i64 0, i64 0)) + call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 1 to %Result*), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @1, i64 0, i64 0)) + call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 2 to %Result*), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @2, i64 0, i64 0)) + call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 3 to %Result*), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @3, i64 0, i64 0)) + call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 4 to %Result*), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @4, i64 0, i64 0)) ret i64 0 } diff --git a/source/pip/tests-integration/resources/adaptive_ri/output/MeasureAndReuse.out b/source/pip/tests-integration/resources/adaptive_ri/output/MeasureAndReuse.out index 815422033b..0c193f621c 100644 --- a/source/pip/tests-integration/resources/adaptive_ri/output/MeasureAndReuse.out +++ b/source/pip/tests-integration/resources/adaptive_ri/output/MeasureAndReuse.out @@ -4,10 +4,10 @@ METADATA output_labeling_schema METADATA qir_profiles adaptive_profile METADATA required_num_qubits 1 METADATA required_num_results 5 -OUTPUT TUPLE 5 -OUTPUT RESULT 0 -OUTPUT RESULT 1 -OUTPUT RESULT 1 -OUTPUT RESULT 0 -OUTPUT RESULT 0 +OUTPUT TUPLE 5 +OUTPUT RESULT 0 0_t0r +OUTPUT RESULT 1 1_t1r +OUTPUT RESULT 1 2_t2r +OUTPUT RESULT 0 3_t3r +OUTPUT RESULT 0 4_t4r END 0 diff --git a/source/pip/tests-integration/resources/adaptive_ri/output/MeasurementComparison.ll b/source/pip/tests-integration/resources/adaptive_ri/output/MeasurementComparison.ll index 4dccd6e2cb..99279d2bff 100644 --- a/source/pip/tests-integration/resources/adaptive_ri/output/MeasurementComparison.ll +++ b/source/pip/tests-integration/resources/adaptive_ri/output/MeasurementComparison.ll @@ -1,6 +1,12 @@ %Result = type opaque %Qubit = type opaque +@empty_tag = internal constant [1 x i8] c"\00" +@0 = internal constant [6 x i8] c"0_t0b\00" +@1 = internal constant [6 x i8] c"1_t1b\00" +@2 = internal constant [6 x i8] c"2_t2b\00" +@3 = internal constant [6 x i8] c"3_t3b\00" + define i64 @ENTRYPOINT__main() #0 { block_0: call void @__quantum__qis__x__body(%Qubit* inttoptr (i64 0 to %Qubit*)) @@ -24,11 +30,11 @@ block_2: br label %block_3 block_3: %var_10 = phi i1 [false, %block_1], [true, %block_2] - call void @__quantum__rt__tuple_record_output(i64 4, i8* null) - call void @__quantum__rt__bool_record_output(i1 %var_0, i8* null) - call void @__quantum__rt__bool_record_output(i1 %var_3, i8* null) - call void @__quantum__rt__bool_record_output(i1 %var_6, i8* null) - call void @__quantum__rt__bool_record_output(i1 %var_10, i8* null) + call void @__quantum__rt__tuple_record_output(i64 4, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @empty_tag, i64 0, i64 0)) + call void @__quantum__rt__bool_record_output(i1 %var_0, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @0, i64 0, i64 0)) + call void @__quantum__rt__bool_record_output(i1 %var_3, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @1, i64 0, i64 0)) + call void @__quantum__rt__bool_record_output(i1 %var_6, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @2, i64 0, i64 0)) + call void @__quantum__rt__bool_record_output(i1 %var_10, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @3, i64 0, i64 0)) ret i64 0 } diff --git a/source/pip/tests-integration/resources/adaptive_ri/output/MeasurementComparison.out b/source/pip/tests-integration/resources/adaptive_ri/output/MeasurementComparison.out index 1aa28a26da..331b678fca 100644 --- a/source/pip/tests-integration/resources/adaptive_ri/output/MeasurementComparison.out +++ b/source/pip/tests-integration/resources/adaptive_ri/output/MeasurementComparison.out @@ -4,9 +4,9 @@ METADATA output_labeling_schema METADATA qir_profiles adaptive_profile METADATA required_num_qubits 2 METADATA required_num_results 2 -OUTPUT TUPLE 4 -OUTPUT BOOL true -OUTPUT BOOL false -OUTPUT BOOL true -OUTPUT BOOL true +OUTPUT TUPLE 4 +OUTPUT BOOL true 0_t0b +OUTPUT BOOL false 1_t1b +OUTPUT BOOL true 2_t2b +OUTPUT BOOL true 3_t3b END 0 diff --git a/source/pip/tests-integration/resources/adaptive_ri/output/NestedBranching.ll b/source/pip/tests-integration/resources/adaptive_ri/output/NestedBranching.ll index 4b6759e31e..c474547d2a 100644 --- a/source/pip/tests-integration/resources/adaptive_ri/output/NestedBranching.ll +++ b/source/pip/tests-integration/resources/adaptive_ri/output/NestedBranching.ll @@ -1,6 +1,17 @@ %Result = type opaque %Qubit = type opaque +@empty_tag = internal constant [1 x i8] c"\00" +@0 = internal constant [10 x i8] c"0_t0t0a0r\00" +@1 = internal constant [10 x i8] c"1_t0t0a1r\00" +@2 = internal constant [10 x i8] c"2_t0t0a2r\00" +@3 = internal constant [8 x i8] c"3_t0t1i\00" +@4 = internal constant [10 x i8] c"4_t1t0a0r\00" +@5 = internal constant [10 x i8] c"5_t1t0a1r\00" +@6 = internal constant [10 x i8] c"6_t1t0a2r\00" +@7 = internal constant [10 x i8] c"7_t1t0a3r\00" +@8 = internal constant [8 x i8] c"8_t1t1b\00" + define i64 @ENTRYPOINT__main() #0 { block_0: call void @__quantum__qis__x__body(%Qubit* inttoptr (i64 0 to %Qubit*)) @@ -282,20 +293,20 @@ block_82: call void @__quantum__qis__reset__body(%Qubit* inttoptr (i64 6 to %Qubit*)) call void @__quantum__qis__mresetz__body(%Qubit* inttoptr (i64 7 to %Qubit*), %Result* inttoptr (i64 7 to %Result*)) %var_77 = call i1 @__quantum__qis__read_result__body(%Result* inttoptr (i64 7 to %Result*)) - call void @__quantum__rt__tuple_record_output(i64 2, i8* null) - call void @__quantum__rt__tuple_record_output(i64 2, i8* null) - call void @__quantum__rt__array_record_output(i64 3, i8* null) - call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 0 to %Result*), i8* null) - call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 1 to %Result*), i8* null) - call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 2 to %Result*), i8* null) - call void @__quantum__rt__int_record_output(i64 %var_93, i8* null) - call void @__quantum__rt__tuple_record_output(i64 2, i8* null) - call void @__quantum__rt__array_record_output(i64 4, i8* null) - call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 3 to %Result*), i8* null) - call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 4 to %Result*), i8* null) - call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 5 to %Result*), i8* null) - call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 6 to %Result*), i8* null) - call void @__quantum__rt__bool_record_output(i1 %var_77, i8* null) + call void @__quantum__rt__tuple_record_output(i64 2, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @empty_tag, i64 0, i64 0)) + call void @__quantum__rt__tuple_record_output(i64 2, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @empty_tag, i64 0, i64 0)) + call void @__quantum__rt__array_record_output(i64 3, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @empty_tag, i64 0, i64 0)) + call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 0 to %Result*), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @0, i64 0, i64 0)) + call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 1 to %Result*), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @1, i64 0, i64 0)) + call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 2 to %Result*), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @2, i64 0, i64 0)) + call void @__quantum__rt__int_record_output(i64 %var_93, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @3, i64 0, i64 0)) + call void @__quantum__rt__tuple_record_output(i64 2, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @empty_tag, i64 0, i64 0)) + call void @__quantum__rt__array_record_output(i64 4, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @empty_tag, i64 0, i64 0)) + call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 3 to %Result*), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @4, i64 0, i64 0)) + call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 4 to %Result*), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @5, i64 0, i64 0)) + call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 5 to %Result*), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @6, i64 0, i64 0)) + call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 6 to %Result*), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @7, i64 0, i64 0)) + call void @__quantum__rt__bool_record_output(i1 %var_77, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @8, i64 0, i64 0)) ret i64 0 } diff --git a/source/pip/tests-integration/resources/adaptive_ri/output/NestedBranching.out b/source/pip/tests-integration/resources/adaptive_ri/output/NestedBranching.out index 40ebc4f86f..61c83a5737 100644 --- a/source/pip/tests-integration/resources/adaptive_ri/output/NestedBranching.out +++ b/source/pip/tests-integration/resources/adaptive_ri/output/NestedBranching.out @@ -4,18 +4,18 @@ METADATA output_labeling_schema METADATA qir_profiles adaptive_profile METADATA required_num_qubits 8 METADATA required_num_results 8 -OUTPUT TUPLE 2 -OUTPUT TUPLE 2 -OUTPUT ARRAY 3 -OUTPUT RESULT 1 -OUTPUT RESULT 1 -OUTPUT RESULT 0 -OUTPUT INT 6 -OUTPUT TUPLE 2 -OUTPUT ARRAY 4 -OUTPUT RESULT 1 -OUTPUT RESULT 1 -OUTPUT RESULT 1 -OUTPUT RESULT 0 -OUTPUT BOOL true +OUTPUT TUPLE 2 +OUTPUT TUPLE 2 +OUTPUT ARRAY 3 +OUTPUT RESULT 1 0_t0t0a0r +OUTPUT RESULT 1 1_t0t0a1r +OUTPUT RESULT 0 2_t0t0a2r +OUTPUT INT 6 3_t0t1i +OUTPUT TUPLE 2 +OUTPUT ARRAY 4 +OUTPUT RESULT 1 4_t1t0a0r +OUTPUT RESULT 1 5_t1t0a1r +OUTPUT RESULT 1 6_t1t0a2r +OUTPUT RESULT 0 7_t1t0a3r +OUTPUT BOOL true 8_t1t1b END 0 diff --git a/source/pip/tests-integration/resources/adaptive_ri/output/RandomBit.ll b/source/pip/tests-integration/resources/adaptive_ri/output/RandomBit.ll index 8c41bf34e2..440df84bcc 100644 --- a/source/pip/tests-integration/resources/adaptive_ri/output/RandomBit.ll +++ b/source/pip/tests-integration/resources/adaptive_ri/output/RandomBit.ll @@ -1,12 +1,15 @@ %Result = type opaque %Qubit = type opaque +@empty_tag = internal constant [1 x i8] c"\00" +@0 = internal constant [4 x i8] c"0_r\00" + define i64 @ENTRYPOINT__main() #0 { block_0: call void @__quantum__qis__h__body(%Qubit* inttoptr (i64 0 to %Qubit*)) call void @__quantum__qis__m__body(%Qubit* inttoptr (i64 0 to %Qubit*), %Result* inttoptr (i64 0 to %Result*)) call void @__quantum__qis__reset__body(%Qubit* inttoptr (i64 0 to %Qubit*)) - call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 0 to %Result*), i8* null) + call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 0 to %Result*), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @0, i64 0, i64 0)) ret i64 0 } diff --git a/source/pip/tests-integration/resources/adaptive_ri/output/RandomBit.out b/source/pip/tests-integration/resources/adaptive_ri/output/RandomBit.out index 7d0390a819..f3b3a065a9 100644 --- a/source/pip/tests-integration/resources/adaptive_ri/output/RandomBit.out +++ b/source/pip/tests-integration/resources/adaptive_ri/output/RandomBit.out @@ -4,5 +4,5 @@ METADATA output_labeling_schema METADATA qir_profiles adaptive_profile METADATA required_num_qubits 1 METADATA required_num_results 1 -OUTPUT RESULT 0 +OUTPUT RESULT 0 0_r END 0 diff --git a/source/pip/tests-integration/resources/adaptive_ri/output/SampleTeleport.ll b/source/pip/tests-integration/resources/adaptive_ri/output/SampleTeleport.ll index a4ad861c3d..88f3e630ff 100644 --- a/source/pip/tests-integration/resources/adaptive_ri/output/SampleTeleport.ll +++ b/source/pip/tests-integration/resources/adaptive_ri/output/SampleTeleport.ll @@ -1,6 +1,9 @@ %Result = type opaque %Qubit = type opaque +@empty_tag = internal constant [1 x i8] c"\00" +@0 = internal constant [4 x i8] c"0_r\00" + define i64 @ENTRYPOINT__main() #0 { block_0: call void @__quantum__qis__h__body(%Qubit* inttoptr (i64 0 to %Qubit*)) @@ -28,7 +31,7 @@ block_4: call void @__quantum__qis__h__body(%Qubit* inttoptr (i64 1 to %Qubit*)) call void @__quantum__qis__reset__body(%Qubit* inttoptr (i64 0 to %Qubit*)) call void @__quantum__qis__reset__body(%Qubit* inttoptr (i64 1 to %Qubit*)) - call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 2 to %Result*), i8* null) + call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 2 to %Result*), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @0, i64 0, i64 0)) ret i64 0 } diff --git a/source/pip/tests-integration/resources/adaptive_ri/output/SampleTeleport.out b/source/pip/tests-integration/resources/adaptive_ri/output/SampleTeleport.out index 566320047b..64b941c5f9 100644 --- a/source/pip/tests-integration/resources/adaptive_ri/output/SampleTeleport.out +++ b/source/pip/tests-integration/resources/adaptive_ri/output/SampleTeleport.out @@ -4,5 +4,5 @@ METADATA output_labeling_schema METADATA qir_profiles adaptive_profile METADATA required_num_qubits 3 METADATA required_num_results 3 -OUTPUT RESULT 1 +OUTPUT RESULT 1 0_r END 0 diff --git a/source/pip/tests-integration/resources/adaptive_ri/output/ShortcuttingMeasurement.ll b/source/pip/tests-integration/resources/adaptive_ri/output/ShortcuttingMeasurement.ll index e63c24c8cc..25c03d94c9 100644 --- a/source/pip/tests-integration/resources/adaptive_ri/output/ShortcuttingMeasurement.ll +++ b/source/pip/tests-integration/resources/adaptive_ri/output/ShortcuttingMeasurement.ll @@ -1,6 +1,10 @@ %Result = type opaque %Qubit = type opaque +@empty_tag = internal constant [1 x i8] c"\00" +@0 = internal constant [6 x i8] c"0_t0r\00" +@1 = internal constant [6 x i8] c"1_t1r\00" + define i64 @ENTRYPOINT__main() #0 { block_0: call void @__quantum__qis__x__body(%Qubit* inttoptr (i64 0 to %Qubit*)) @@ -24,9 +28,9 @@ block_4: call void @__quantum__qis__m__body(%Qubit* inttoptr (i64 1 to %Qubit*), %Result* inttoptr (i64 3 to %Result*)) call void @__quantum__qis__reset__body(%Qubit* inttoptr (i64 0 to %Qubit*)) call void @__quantum__qis__reset__body(%Qubit* inttoptr (i64 1 to %Qubit*)) - call void @__quantum__rt__tuple_record_output(i64 2, i8* null) - call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 2 to %Result*), i8* null) - call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 3 to %Result*), i8* null) + call void @__quantum__rt__tuple_record_output(i64 2, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @empty_tag, i64 0, i64 0)) + call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 2 to %Result*), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @0, i64 0, i64 0)) + call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 3 to %Result*), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @1, i64 0, i64 0)) ret i64 0 } diff --git a/source/pip/tests-integration/resources/adaptive_ri/output/ShortcuttingMeasurement.out b/source/pip/tests-integration/resources/adaptive_ri/output/ShortcuttingMeasurement.out index 453ce269ff..27d35996c4 100644 --- a/source/pip/tests-integration/resources/adaptive_ri/output/ShortcuttingMeasurement.out +++ b/source/pip/tests-integration/resources/adaptive_ri/output/ShortcuttingMeasurement.out @@ -4,7 +4,7 @@ METADATA output_labeling_schema METADATA qir_profiles adaptive_profile METADATA required_num_qubits 2 METADATA required_num_results 4 -OUTPUT TUPLE 2 -OUTPUT RESULT 0 -OUTPUT RESULT 0 +OUTPUT TUPLE 2 +OUTPUT RESULT 0 0_t0r +OUTPUT RESULT 0 1_t1r END 0 diff --git a/source/pip/tests-integration/resources/adaptive_ri/output/Slicing.ll b/source/pip/tests-integration/resources/adaptive_ri/output/Slicing.ll index 0c6f0db14d..e406d49922 100644 --- a/source/pip/tests-integration/resources/adaptive_ri/output/Slicing.ll +++ b/source/pip/tests-integration/resources/adaptive_ri/output/Slicing.ll @@ -1,6 +1,13 @@ %Result = type opaque %Qubit = type opaque +@empty_tag = internal constant [1 x i8] c"\00" +@0 = internal constant [6 x i8] c"0_a0r\00" +@1 = internal constant [6 x i8] c"1_a1r\00" +@2 = internal constant [6 x i8] c"2_a2r\00" +@3 = internal constant [6 x i8] c"3_a3r\00" +@4 = internal constant [6 x i8] c"4_a4r\00" + define i64 @ENTRYPOINT__main() #0 { block_0: call void @__quantum__qis__x__body(%Qubit* inttoptr (i64 9 to %Qubit*)) @@ -23,12 +30,12 @@ block_0: call void @__quantum__qis__reset__body(%Qubit* inttoptr (i64 7 to %Qubit*)) call void @__quantum__qis__reset__body(%Qubit* inttoptr (i64 8 to %Qubit*)) call void @__quantum__qis__reset__body(%Qubit* inttoptr (i64 9 to %Qubit*)) - call void @__quantum__rt__array_record_output(i64 5, i8* null) - call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 0 to %Result*), i8* null) - call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 1 to %Result*), i8* null) - call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 2 to %Result*), i8* null) - call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 3 to %Result*), i8* null) - call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 4 to %Result*), i8* null) + call void @__quantum__rt__array_record_output(i64 5, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @empty_tag, i64 0, i64 0)) + call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 0 to %Result*), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @0, i64 0, i64 0)) + call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 1 to %Result*), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @1, i64 0, i64 0)) + call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 2 to %Result*), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @2, i64 0, i64 0)) + call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 3 to %Result*), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @3, i64 0, i64 0)) + call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 4 to %Result*), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @4, i64 0, i64 0)) ret i64 0 } diff --git a/source/pip/tests-integration/resources/adaptive_ri/output/Slicing.out b/source/pip/tests-integration/resources/adaptive_ri/output/Slicing.out index 248c4992ba..c877c8b452 100644 --- a/source/pip/tests-integration/resources/adaptive_ri/output/Slicing.out +++ b/source/pip/tests-integration/resources/adaptive_ri/output/Slicing.out @@ -4,10 +4,10 @@ METADATA output_labeling_schema METADATA qir_profiles adaptive_profile METADATA required_num_qubits 10 METADATA required_num_results 5 -OUTPUT ARRAY 5 -OUTPUT RESULT 1 -OUTPUT RESULT 1 -OUTPUT RESULT 1 -OUTPUT RESULT 1 -OUTPUT RESULT 1 +OUTPUT ARRAY 5 +OUTPUT RESULT 1 0_a0r +OUTPUT RESULT 1 1_a1r +OUTPUT RESULT 1 2_a2r +OUTPUT RESULT 1 3_a3r +OUTPUT RESULT 1 4_a4r END 0 diff --git a/source/pip/tests-integration/resources/adaptive_ri/output/SuperdenseCoding.ll b/source/pip/tests-integration/resources/adaptive_ri/output/SuperdenseCoding.ll index 806154ff0c..b7c1b7880c 100644 --- a/source/pip/tests-integration/resources/adaptive_ri/output/SuperdenseCoding.ll +++ b/source/pip/tests-integration/resources/adaptive_ri/output/SuperdenseCoding.ll @@ -1,6 +1,12 @@ %Result = type opaque %Qubit = type opaque +@empty_tag = internal constant [1 x i8] c"\00" +@0 = internal constant [8 x i8] c"0_t0t0b\00" +@1 = internal constant [8 x i8] c"1_t0t1b\00" +@2 = internal constant [8 x i8] c"2_t1t0b\00" +@3 = internal constant [8 x i8] c"3_t1t1b\00" + define i64 @ENTRYPOINT__main() #0 { block_0: call void @__quantum__qis__h__body(%Qubit* inttoptr (i64 0 to %Qubit*)) @@ -35,13 +41,13 @@ block_4: %var_13 = call i1 @__quantum__qis__read_result__body(%Result* inttoptr (i64 3 to %Result*)) call void @__quantum__qis__reset__body(%Qubit* inttoptr (i64 0 to %Qubit*)) call void @__quantum__qis__reset__body(%Qubit* inttoptr (i64 1 to %Qubit*)) - call void @__quantum__rt__tuple_record_output(i64 2, i8* null) - call void @__quantum__rt__tuple_record_output(i64 2, i8* null) - call void @__quantum__rt__bool_record_output(i1 %var_0, i8* null) - call void @__quantum__rt__bool_record_output(i1 %var_4, i8* null) - call void @__quantum__rt__tuple_record_output(i64 2, i8* null) - call void @__quantum__rt__bool_record_output(i1 %var_9, i8* null) - call void @__quantum__rt__bool_record_output(i1 %var_13, i8* null) + call void @__quantum__rt__tuple_record_output(i64 2, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @empty_tag, i64 0, i64 0)) + call void @__quantum__rt__tuple_record_output(i64 2, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @empty_tag, i64 0, i64 0)) + call void @__quantum__rt__bool_record_output(i1 %var_0, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @0, i64 0, i64 0)) + call void @__quantum__rt__bool_record_output(i1 %var_4, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @1, i64 0, i64 0)) + call void @__quantum__rt__tuple_record_output(i64 2, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @empty_tag, i64 0, i64 0)) + call void @__quantum__rt__bool_record_output(i1 %var_9, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @2, i64 0, i64 0)) + call void @__quantum__rt__bool_record_output(i1 %var_13, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @3, i64 0, i64 0)) ret i64 0 } diff --git a/source/pip/tests-integration/resources/adaptive_ri/output/SuperdenseCoding.out b/source/pip/tests-integration/resources/adaptive_ri/output/SuperdenseCoding.out index 0170b7c2ff..e91f019bee 100644 --- a/source/pip/tests-integration/resources/adaptive_ri/output/SuperdenseCoding.out +++ b/source/pip/tests-integration/resources/adaptive_ri/output/SuperdenseCoding.out @@ -4,11 +4,11 @@ METADATA output_labeling_schema METADATA qir_profiles adaptive_profile METADATA required_num_qubits 3 METADATA required_num_results 4 -OUTPUT TUPLE 2 -OUTPUT TUPLE 2 -OUTPUT BOOL false -OUTPUT BOOL false -OUTPUT TUPLE 2 -OUTPUT BOOL false -OUTPUT BOOL false +OUTPUT TUPLE 2 +OUTPUT TUPLE 2 +OUTPUT BOOL false 0_t0t0b +OUTPUT BOOL false 1_t0t1b +OUTPUT TUPLE 2 +OUTPUT BOOL false 2_t1t0b +OUTPUT BOOL false 3_t1t1b END 0 diff --git a/source/pip/tests-integration/resources/adaptive_ri/output/SwitchHandling.ll b/source/pip/tests-integration/resources/adaptive_ri/output/SwitchHandling.ll index 7ca5f8bb3c..e7d5001197 100644 --- a/source/pip/tests-integration/resources/adaptive_ri/output/SwitchHandling.ll +++ b/source/pip/tests-integration/resources/adaptive_ri/output/SwitchHandling.ll @@ -1,6 +1,9 @@ %Result = type opaque %Qubit = type opaque +@empty_tag = internal constant [1 x i8] c"\00" +@0 = internal constant [4 x i8] c"0_r\00" + define i64 @ENTRYPOINT__main() #0 { block_0: call void @__quantum__qis__x__body(%Qubit* inttoptr (i64 0 to %Qubit*)) @@ -48,7 +51,7 @@ block_12: br label %block_13 block_13: call void @__quantum__qis__mresetz__body(%Qubit* inttoptr (i64 2 to %Qubit*), %Result* inttoptr (i64 2 to %Result*)) - call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 2 to %Result*), i8* null) + call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 2 to %Result*), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @0, i64 0, i64 0)) ret i64 0 } diff --git a/source/pip/tests-integration/resources/adaptive_ri/output/SwitchHandling.out b/source/pip/tests-integration/resources/adaptive_ri/output/SwitchHandling.out index 566320047b..64b941c5f9 100644 --- a/source/pip/tests-integration/resources/adaptive_ri/output/SwitchHandling.out +++ b/source/pip/tests-integration/resources/adaptive_ri/output/SwitchHandling.out @@ -4,5 +4,5 @@ METADATA output_labeling_schema METADATA qir_profiles adaptive_profile METADATA required_num_qubits 3 METADATA required_num_results 3 -OUTPUT RESULT 1 +OUTPUT RESULT 1 0_r END 0 diff --git a/source/pip/tests-integration/resources/adaptive_ri/output/ThreeQubitRepetitionCode.ll b/source/pip/tests-integration/resources/adaptive_ri/output/ThreeQubitRepetitionCode.ll index e74249b7b1..1408ce05d0 100644 --- a/source/pip/tests-integration/resources/adaptive_ri/output/ThreeQubitRepetitionCode.ll +++ b/source/pip/tests-integration/resources/adaptive_ri/output/ThreeQubitRepetitionCode.ll @@ -1,6 +1,10 @@ %Result = type opaque %Qubit = type opaque +@empty_tag = internal constant [1 x i8] c"\00" +@0 = internal constant [6 x i8] c"0_t0b\00" +@1 = internal constant [6 x i8] c"1_t1i\00" + define i64 @ENTRYPOINT__main() #0 { block_0: call void @__quantum__qis__h__body(%Qubit* inttoptr (i64 0 to %Qubit*)) @@ -263,9 +267,9 @@ block_55: %var_82 = call i1 @__quantum__qis__read_result__body(%Result* inttoptr (i64 10 to %Result*)) call void @__quantum__qis__reset__body(%Qubit* inttoptr (i64 1 to %Qubit*)) call void @__quantum__qis__reset__body(%Qubit* inttoptr (i64 2 to %Qubit*)) - call void @__quantum__rt__tuple_record_output(i64 2, i8* null) - call void @__quantum__rt__bool_record_output(i1 %var_82, i8* null) - call void @__quantum__rt__int_record_output(i64 %var_101, i8* null) + call void @__quantum__rt__tuple_record_output(i64 2, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @empty_tag, i64 0, i64 0)) + call void @__quantum__rt__bool_record_output(i1 %var_82, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @0, i64 0, i64 0)) + call void @__quantum__rt__int_record_output(i64 %var_101, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @1, i64 0, i64 0)) ret i64 0 } diff --git a/source/pip/tests-integration/resources/adaptive_ri/output/ThreeQubitRepetitionCode.out b/source/pip/tests-integration/resources/adaptive_ri/output/ThreeQubitRepetitionCode.out index 43e53972f4..e6998cc5f2 100644 --- a/source/pip/tests-integration/resources/adaptive_ri/output/ThreeQubitRepetitionCode.out +++ b/source/pip/tests-integration/resources/adaptive_ri/output/ThreeQubitRepetitionCode.out @@ -4,7 +4,7 @@ METADATA output_labeling_schema METADATA qir_profiles adaptive_profile METADATA required_num_qubits 5 METADATA required_num_results 11 -OUTPUT TUPLE 2 -OUTPUT BOOL true -OUTPUT INT 0 +OUTPUT TUPLE 2 +OUTPUT BOOL true 0_t0b +OUTPUT INT 0 1_t1i END 0 diff --git a/source/pip/tests-integration/resources/adaptive_ri/output/WithinApply.ll b/source/pip/tests-integration/resources/adaptive_ri/output/WithinApply.ll index f59d42593a..ec07e55118 100644 --- a/source/pip/tests-integration/resources/adaptive_ri/output/WithinApply.ll +++ b/source/pip/tests-integration/resources/adaptive_ri/output/WithinApply.ll @@ -1,6 +1,11 @@ %Result = type opaque %Qubit = type opaque +@empty_tag = internal constant [1 x i8] c"\00" +@0 = internal constant [6 x i8] c"0_a0r\00" +@1 = internal constant [6 x i8] c"1_a1r\00" +@2 = internal constant [6 x i8] c"2_a2r\00" + define i64 @ENTRYPOINT__main() #0 { block_0: call void @__quantum__qis__x__body(%Qubit* inttoptr (i64 1 to %Qubit*)) @@ -14,10 +19,10 @@ block_0: call void @__quantum__qis__reset__body(%Qubit* inttoptr (i64 1 to %Qubit*)) call void @__quantum__qis__reset__body(%Qubit* inttoptr (i64 2 to %Qubit*)) call void @__quantum__qis__reset__body(%Qubit* inttoptr (i64 0 to %Qubit*)) - call void @__quantum__rt__array_record_output(i64 3, i8* null) - call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 0 to %Result*), i8* null) - call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 1 to %Result*), i8* null) - call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 2 to %Result*), i8* null) + call void @__quantum__rt__array_record_output(i64 3, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @empty_tag, i64 0, i64 0)) + call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 0 to %Result*), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @0, i64 0, i64 0)) + call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 1 to %Result*), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @1, i64 0, i64 0)) + call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 2 to %Result*), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @2, i64 0, i64 0)) ret i64 0 } diff --git a/source/pip/tests-integration/resources/adaptive_ri/output/WithinApply.out b/source/pip/tests-integration/resources/adaptive_ri/output/WithinApply.out index dfebae9f19..c33e20d6fe 100644 --- a/source/pip/tests-integration/resources/adaptive_ri/output/WithinApply.out +++ b/source/pip/tests-integration/resources/adaptive_ri/output/WithinApply.out @@ -4,8 +4,8 @@ METADATA output_labeling_schema METADATA qir_profiles adaptive_profile METADATA required_num_qubits 3 METADATA required_num_results 3 -OUTPUT ARRAY 3 -OUTPUT RESULT 0 -OUTPUT RESULT 0 -OUTPUT RESULT 1 +OUTPUT ARRAY 3 +OUTPUT RESULT 0 0_a0r +OUTPUT RESULT 0 1_a1r +OUTPUT RESULT 1 2_a2r END 0 diff --git a/source/pip/tests-integration/resources/adaptive_rif/output/Doubles.ll b/source/pip/tests-integration/resources/adaptive_rif/output/Doubles.ll index 655edb4d81..389fe2048e 100644 --- a/source/pip/tests-integration/resources/adaptive_rif/output/Doubles.ll +++ b/source/pip/tests-integration/resources/adaptive_rif/output/Doubles.ll @@ -1,6 +1,14 @@ %Result = type opaque %Qubit = type opaque +@empty_tag = internal constant [1 x i8] c"\00" +@0 = internal constant [6 x i8] c"0_t0d\00" +@1 = internal constant [6 x i8] c"1_t1b\00" +@2 = internal constant [6 x i8] c"2_t2b\00" +@3 = internal constant [6 x i8] c"3_t3b\00" +@4 = internal constant [6 x i8] c"4_t4b\00" +@5 = internal constant [6 x i8] c"5_t5b\00" + define i64 @ENTRYPOINT__main() #0 { block_0: call void @__quantum__qis__x__body(%Qubit* inttoptr (i64 0 to %Qubit*)) @@ -144,13 +152,13 @@ block_20: %var_69 = fcmp oge double %var_81, 10.0 %var_70 = fcmp oeq double %var_81, 10.0 %var_71 = fcmp one double %var_81, 10.0 - call void @__quantum__rt__tuple_record_output(i64 6, i8* null) - call void @__quantum__rt__double_record_output(double %var_81, i8* null) - call void @__quantum__rt__bool_record_output(i1 %var_67, i8* null) - call void @__quantum__rt__bool_record_output(i1 %var_68, i8* null) - call void @__quantum__rt__bool_record_output(i1 %var_69, i8* null) - call void @__quantum__rt__bool_record_output(i1 %var_70, i8* null) - call void @__quantum__rt__bool_record_output(i1 %var_71, i8* null) + call void @__quantum__rt__tuple_record_output(i64 6, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @empty_tag, i64 0, i64 0)) + call void @__quantum__rt__double_record_output(double %var_81, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @0, i64 0, i64 0)) + call void @__quantum__rt__bool_record_output(i1 %var_67, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @1, i64 0, i64 0)) + call void @__quantum__rt__bool_record_output(i1 %var_68, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @2, i64 0, i64 0)) + call void @__quantum__rt__bool_record_output(i1 %var_69, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @3, i64 0, i64 0)) + call void @__quantum__rt__bool_record_output(i1 %var_70, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @4, i64 0, i64 0)) + call void @__quantum__rt__bool_record_output(i1 %var_71, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @5, i64 0, i64 0)) ret i64 0 } diff --git a/source/pip/tests-integration/resources/adaptive_rif/output/Doubles.out b/source/pip/tests-integration/resources/adaptive_rif/output/Doubles.out index ac07504f19..a2c86b382f 100644 --- a/source/pip/tests-integration/resources/adaptive_rif/output/Doubles.out +++ b/source/pip/tests-integration/resources/adaptive_rif/output/Doubles.out @@ -4,11 +4,11 @@ METADATA output_labeling_schema METADATA qir_profiles adaptive_profile METADATA required_num_qubits 1 METADATA required_num_results 10 -OUTPUT TUPLE 6 -OUTPUT DOUBLE 10.0 -OUTPUT BOOL true -OUTPUT BOOL false -OUTPUT BOOL true -OUTPUT BOOL true -OUTPUT BOOL false +OUTPUT TUPLE 6 +OUTPUT DOUBLE 10.0 0_t0d +OUTPUT BOOL true 1_t1b +OUTPUT BOOL false 2_t2b +OUTPUT BOOL true 3_t3b +OUTPUT BOOL true 4_t4b +OUTPUT BOOL false 5_t5b END 0 diff --git a/source/pip/tests/test_interpreter.py b/source/pip/tests/test_interpreter.py index 54d91d2d6f..0cc4854852 100644 --- a/source/pip/tests/test_interpreter.py +++ b/source/pip/tests/test_interpreter.py @@ -371,13 +371,16 @@ def test_adaptive_ri_qir_can_be_generated() -> None: %Result = type opaque %Qubit = type opaque + @empty_tag = internal constant [1 x i8] c"\\00" + @0 = internal constant [4 x i8] c"0_r\\00" + define i64 @ENTRYPOINT__main() #0 { block_0: call void @__quantum__qis__rz__body(double 2.0, %Qubit* inttoptr (i64 0 to %Qubit*)) call void @__quantum__qis__rz__body(double 0.0, %Qubit* inttoptr (i64 0 to %Qubit*)) call void @__quantum__qis__rz__body(double 1.0, %Qubit* inttoptr (i64 0 to %Qubit*)) call void @__quantum__qis__mresetz__body(%Qubit* inttoptr (i64 0 to %Qubit*), %Result* inttoptr (i64 0 to %Result*)) - call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 0 to %Result*), i8* null) + call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 0 to %Result*), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @0, i64 0, i64 0)) ret i64 0 } @@ -429,13 +432,16 @@ def test_base_qir_can_be_generated() -> None: %Result = type opaque %Qubit = type opaque + @empty_tag = internal constant [1 x i8] c"\\00" + @0 = internal constant [4 x i8] c"0_r\\00" + define i64 @ENTRYPOINT__main() #0 { block_0: call void @__quantum__qis__rz__body(double 2.0, %Qubit* inttoptr (i64 0 to %Qubit*)) call void @__quantum__qis__rz__body(double 0.0, %Qubit* inttoptr (i64 0 to %Qubit*)) call void @__quantum__qis__rz__body(double 1.0, %Qubit* inttoptr (i64 0 to %Qubit*)) call void @__quantum__qis__m__body(%Qubit* inttoptr (i64 0 to %Qubit*), %Result* inttoptr (i64 0 to %Result*)) - call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 0 to %Result*), i8* null) + call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 0 to %Result*), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @0, i64 0, i64 0)) ret i64 0 } diff --git a/source/pip/tests/test_qasm.py b/source/pip/tests/test_qasm.py index 99d8fef3f8..d25d5ef777 100644 --- a/source/pip/tests/test_qasm.py +++ b/source/pip/tests/test_qasm.py @@ -346,7 +346,7 @@ def test_compile_qir_str_from_python_callable_with_single_arg() -> None: in qir ) assert ( - "call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 0 to %Result*), i8* null)" + "call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 0 to %Result*), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @0, i64 0, i64 0))" in qir ) assert '"required_num_qubits"="1" "required_num_results"="1"' in qir @@ -374,7 +374,7 @@ def test_compile_qir_str_from_python_callable_with_multiple_args() -> None: in qir ) assert ( - "call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 0 to %Result*), i8* null)" + "call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 0 to %Result*), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @0, i64 0, i64 0))" in qir ) assert '"required_num_qubits"="1" "required_num_results"="1"' in qir @@ -405,7 +405,7 @@ def test_compile_qir_str_from_python_callable_with_multiple_args_passed_as_tuple in qir ) assert ( - "call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 0 to %Result*), i8* null)" + "call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 0 to %Result*), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @0, i64 0, i64 0))" in qir ) assert '"required_num_qubits"="1" "required_num_results"="1"' in qir diff --git a/source/pip/tests/test_qsharp.py b/source/pip/tests/test_qsharp.py index c3e54f9727..dc8f06ce0a 100644 --- a/source/pip/tests/test_qsharp.py +++ b/source/pip/tests/test_qsharp.py @@ -352,7 +352,7 @@ def test_compile_qir_str_from_python_callable_with_single_arg() -> None: qir = str(operation) assert "define i64 @ENTRYPOINT__main()" in qir assert ( - "call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 4 to %Result*), i8* null)" + "call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 4 to %Result*), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @4, i64 0, i64 0))" in qir ) assert '"required_num_qubits"="5" "required_num_results"="5"' in qir @@ -367,11 +367,11 @@ def test_compile_qir_str_from_python_callable_with_array_arg() -> None: qir = str(operation) assert "define i64 @ENTRYPOINT__main()" in qir assert ( - "call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 2 to %Result*), i8* null)" + "call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 2 to %Result*), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @2, i64 0, i64 0))" in qir ) assert ( - "call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 4 to %Result*), i8* null)" + "call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 4 to %Result*), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @4, i64 0, i64 0))" not in qir ) assert '"required_num_qubits"="3" "required_num_results"="3"' in qir @@ -386,11 +386,11 @@ def test_compile_qir_str_from_python_callable_with_multiple_args() -> None: qir = str(operation) assert "define i64 @ENTRYPOINT__main()" in qir assert ( - "call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 2 to %Result*), i8* null)" + "call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 2 to %Result*), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @2, i64 0, i64 0))" in qir ) assert ( - "call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 4 to %Result*), i8* null)" + "call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 4 to %Result*), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @4, i64 0, i64 0))" not in qir ) assert '"required_num_qubits"="5" "required_num_results"="5"' in qir @@ -408,11 +408,11 @@ def test_compile_qir_str_from_python_callable_with_multiple_args_passed_as_tuple qir = str(operation) assert "define i64 @ENTRYPOINT__main()" in qir assert ( - "call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 2 to %Result*), i8* null)" + "call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 2 to %Result*), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @2, i64 0, i64 0))" in qir ) assert ( - "call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 4 to %Result*), i8* null)" + "call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 4 to %Result*), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @4, i64 0, i64 0))" not in qir ) assert '"required_num_qubits"="5" "required_num_results"="5"' in qir From 3eebcaf6864e5845db0e6c4ca495807ba9539cf9 Mon Sep 17 00:00:00 2001 From: "Stefan J. Wernli" Date: Thu, 10 Jul 2025 11:28:06 -0700 Subject: [PATCH 4/5] Rename read result to use `__rt__` pattern --- source/compiler/qsc/src/codegen/tests.rs | 16 +- source/compiler/qsc/src/interpret/tests.rs | 6 +- source/compiler/qsc_codegen/src/qir/tests.rs | 8 +- .../qsc_partial_eval/src/tests/arrays.rs | 2 +- .../qsc_partial_eval/src/tests/assigns.rs | 366 ++++----- .../qsc_partial_eval/src/tests/bindings.rs | 12 +- .../qsc_partial_eval/src/tests/branching.rs | 168 ++-- .../qsc_partial_eval/src/tests/calls.rs | 42 +- .../src/tests/dynamic_vars.rs | 70 +- .../qsc_partial_eval/src/tests/intrinsics.rs | 14 +- .../qsc_partial_eval/src/tests/misc.rs | 42 +- .../qsc_partial_eval/src/tests/operators.rs | 728 +++++++++--------- .../src/tests/output_recording.rs | 8 +- .../qsc_partial_eval/src/tests/returns.rs | 28 +- source/compiler/qsc_rir/src/builder.rs | 2 +- .../src/passes/reindex_qubits/tests.rs | 2 +- .../adaptive_ri/output/ArithmeticOps.ll | 12 +- .../adaptive_ri/output/IntegerComparison.ll | 22 +- .../output/MeasurementComparison.ll | 12 +- .../adaptive_ri/output/NestedBranching.ll | 64 +- .../adaptive_ri/output/SampleTeleport.ll | 6 +- .../output/ShortcuttingMeasurement.ll | 6 +- .../adaptive_ri/output/SuperdenseCoding.ll | 10 +- .../adaptive_ri/output/SwitchHandling.ll | 6 +- .../output/ThreeQubitRepetitionCode.ll | 34 +- .../resources/adaptive_rif/output/Doubles.ll | 22 +- 26 files changed, 854 insertions(+), 854 deletions(-) diff --git a/source/compiler/qsc/src/codegen/tests.rs b/source/compiler/qsc/src/codegen/tests.rs index 5bd31f6189..a6aa0e1b3c 100644 --- a/source/compiler/qsc/src/codegen/tests.rs +++ b/source/compiler/qsc/src/codegen/tests.rs @@ -1018,7 +1018,7 @@ mod adaptive_ri_profile { block_0: call void @__quantum__qis__h__body(%Qubit* inttoptr (i64 0 to %Qubit*)) call void @__quantum__qis__mresetz__body(%Qubit* inttoptr (i64 0 to %Qubit*), %Result* inttoptr (i64 0 to %Result*)) - %var_0 = call i1 @__quantum__qis__read_result__body(%Result* inttoptr (i64 0 to %Result*)) + %var_0 = call i1 @__quantum__rt__read_result(%Result* inttoptr (i64 0 to %Result*)) %var_1 = icmp eq i1 %var_0, false br i1 %var_1, label %block_1, label %block_2 block_1: @@ -1035,7 +1035,7 @@ mod adaptive_ri_profile { declare void @__quantum__qis__mresetz__body(%Qubit*, %Result*) #1 - declare i1 @__quantum__qis__read_result__body(%Result*) + declare i1 @__quantum__rt__read_result(%Result*) declare void @__quantum__rt__int_record_output(i64, i8*) @@ -1495,7 +1495,7 @@ mod adaptive_rif_profile { block_0: call void @__quantum__qis__h__body(%Qubit* inttoptr (i64 0 to %Qubit*)) call void @__quantum__qis__mresetz__body(%Qubit* inttoptr (i64 0 to %Qubit*), %Result* inttoptr (i64 0 to %Result*)) - %var_0 = call i1 @__quantum__qis__read_result__body(%Result* inttoptr (i64 0 to %Result*)) + %var_0 = call i1 @__quantum__rt__read_result(%Result* inttoptr (i64 0 to %Result*)) %var_1 = icmp eq i1 %var_0, false br i1 %var_1, label %block_1, label %block_2 block_1: @@ -1512,7 +1512,7 @@ mod adaptive_rif_profile { declare void @__quantum__qis__mresetz__body(%Qubit*, %Result*) #1 - declare i1 @__quantum__qis__read_result__body(%Result*) + declare i1 @__quantum__rt__read_result(%Result*) declare void @__quantum__rt__int_record_output(i64, i8*) @@ -1554,7 +1554,7 @@ mod adaptive_rif_profile { block_0: call void @__quantum__qis__h__body(%Qubit* inttoptr (i64 0 to %Qubit*)) call void @__quantum__qis__mresetz__body(%Qubit* inttoptr (i64 0 to %Qubit*), %Result* inttoptr (i64 0 to %Result*)) - %var_0 = call i1 @__quantum__qis__read_result__body(%Result* inttoptr (i64 0 to %Result*)) + %var_0 = call i1 @__quantum__rt__read_result(%Result* inttoptr (i64 0 to %Result*)) %var_1 = icmp eq i1 %var_0, false br i1 %var_1, label %block_1, label %block_2 block_1: @@ -1571,7 +1571,7 @@ mod adaptive_rif_profile { declare void @__quantum__qis__mresetz__body(%Qubit*, %Result*) #1 - declare i1 @__quantum__qis__read_result__body(%Result*) + declare i1 @__quantum__rt__read_result(%Result*) declare void @__quantum__rt__double_record_output(double, i8*) @@ -1674,7 +1674,7 @@ mod adaptive_rif_profile { block_0: call void @__quantum__qis__h__body(%Qubit* inttoptr (i64 0 to %Qubit*)) call void @__quantum__qis__mresetz__body(%Qubit* inttoptr (i64 0 to %Qubit*), %Result* inttoptr (i64 0 to %Result*)) - %var_0 = call i1 @__quantum__qis__read_result__body(%Result* inttoptr (i64 0 to %Result*)) + %var_0 = call i1 @__quantum__rt__read_result(%Result* inttoptr (i64 0 to %Result*)) %var_1 = icmp eq i1 %var_0, false br i1 %var_1, label %block_1, label %block_2 block_1: @@ -1701,7 +1701,7 @@ mod adaptive_rif_profile { declare void @__quantum__qis__mresetz__body(%Qubit*, %Result*) #1 - declare i1 @__quantum__qis__read_result__body(%Result*) + declare i1 @__quantum__rt__read_result(%Result*) declare void @OpA(double, %Qubit*) diff --git a/source/compiler/qsc/src/interpret/tests.rs b/source/compiler/qsc/src/interpret/tests.rs index b0a0044494..8bbed4a6a3 100644 --- a/source/compiler/qsc/src/interpret/tests.rs +++ b/source/compiler/qsc/src/interpret/tests.rs @@ -1046,8 +1046,8 @@ mod given_interpreter { define i64 @ENTRYPOINT__main() #0 { block_0: call void @__quantum__qis__mresetz__body(%Qubit* inttoptr (i64 0 to %Qubit*), %Result* inttoptr (i64 0 to %Result*)) - %var_0 = call i1 @__quantum__qis__read_result__body(%Result* inttoptr (i64 0 to %Result*)) - %var_2 = call i1 @__quantum__qis__read_result__body(%Result* inttoptr (i64 0 to %Result*)) + %var_0 = call i1 @__quantum__rt__read_result(%Result* inttoptr (i64 0 to %Result*)) + %var_2 = call i1 @__quantum__rt__read_result(%Result* inttoptr (i64 0 to %Result*)) %var_3 = icmp eq i1 %var_2, false call void @__quantum__rt__tuple_record_output(i64 2, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @empty_tag, i64 0, i64 0)) call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 0 to %Result*), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @0, i64 0, i64 0)) @@ -1059,7 +1059,7 @@ mod given_interpreter { declare void @__quantum__qis__mresetz__body(%Qubit*, %Result*) #1 - declare i1 @__quantum__qis__read_result__body(%Result*) + declare i1 @__quantum__rt__read_result(%Result*) declare void @__quantum__rt__tuple_record_output(i64, i8*) diff --git a/source/compiler/qsc_codegen/src/qir/tests.rs b/source/compiler/qsc_codegen/src/qir/tests.rs index d0e51afd30..9268278c89 100644 --- a/source/compiler/qsc_codegen/src/qir/tests.rs +++ b/source/compiler/qsc_codegen/src/qir/tests.rs @@ -37,7 +37,7 @@ fn measurement_decl_works() { #[test] fn read_result_decl_works() { let decl = builder::read_result_decl(); - expect!["declare i1 @__quantum__qis__read_result__body(%Result*)"] + expect!["declare i1 @__quantum__rt__read_result(%Result*)"] .assert_eq(&decl.to_qir(&rir::Program::default())); } @@ -192,7 +192,7 @@ fn teleport_program() { declare void @__quantum__qis__mresetz__body(%Qubit*, %Result*) #1 - declare i1 @__quantum__qis__read_result__body(%Result*) + declare i1 @__quantum__rt__read_result(%Result*) declare void @__quantum__rt__result_record_output(%Result*, i8*) @@ -204,14 +204,14 @@ fn teleport_program() { call void @__quantum__qis__cx__body(%Qubit* inttoptr (i64 0 to %Qubit*), %Qubit* inttoptr (i64 2 to %Qubit*)) call void @__quantum__qis__h__body(%Qubit* inttoptr (i64 0 to %Qubit*)) call void @__quantum__qis__mresetz__body(%Qubit* inttoptr (i64 0 to %Qubit*), %Result* inttoptr (i64 0 to %Result*)) - %var_0 = call i1 @__quantum__qis__read_result__body(%Result* inttoptr (i64 0 to %Result*)) + %var_0 = call i1 @__quantum__rt__read_result(%Result* inttoptr (i64 0 to %Result*)) br i1 %var_0, label %block_1, label %block_2 block_1: call void @__quantum__qis__z__body(%Qubit* inttoptr (i64 1 to %Qubit*)) br label %block_2 block_2: call void @__quantum__qis__mresetz__body(%Qubit* inttoptr (i64 2 to %Qubit*), %Result* inttoptr (i64 1 to %Result*)) - %var_1 = call i1 @__quantum__qis__read_result__body(%Result* inttoptr (i64 1 to %Result*)) + %var_1 = call i1 @__quantum__rt__read_result(%Result* inttoptr (i64 1 to %Result*)) br i1 %var_1, label %block_3, label %block_4 block_3: call void @__quantum__qis__x__body(%Qubit* inttoptr (i64 1 to %Qubit*)) diff --git a/source/compiler/qsc_partial_eval/src/tests/arrays.rs b/source/compiler/qsc_partial_eval/src/tests/arrays.rs index e954711282..4dc86e58f9 100644 --- a/source/compiler/qsc_partial_eval/src/tests/arrays.rs +++ b/source/compiler/qsc_partial_eval/src/tests/arrays.rs @@ -114,7 +114,7 @@ fn array_with_hybrid_content() { array_output_recording_callable_id, &expect![[r#" Callable: - name: __quantum__qis__read_result__body + name: __quantum__rt__read_result call_type: Readout input_type: [0]: Result diff --git a/source/compiler/qsc_partial_eval/src/tests/assigns.rs b/source/compiler/qsc_partial_eval/src/tests/assigns.rs index e5a83eb33b..3662baacfb 100644 --- a/source/compiler/qsc_partial_eval/src/tests/assigns.rs +++ b/source/compiler/qsc_partial_eval/src/tests/assigns.rs @@ -161,13 +161,13 @@ fn assigning_dynamic_bool_updates_value_and_adds_store_instructions() { &program, readout_callable_id, &expect![[r#" - Callable: - name: __quantum__qis__read_result__body - call_type: Readout - input_type: - [0]: Result - output_type: Boolean - body: "#]], + Callable: + name: __quantum__rt__read_result + call_type: Readout + input_type: + [0]: Result + output_type: Boolean + body: "#]], ); let output_recording_callable_id = CallableId(3); assert_callable( @@ -270,13 +270,13 @@ fn assigning_dynamic_int_updates_value_and_adds_store_instructions() { &program, readout_callable_id, &expect![[r#" - Callable: - name: __quantum__qis__read_result__body - call_type: Readout - input_type: - [0]: Result - output_type: Boolean - body: "#]], + Callable: + name: __quantum__rt__read_result + call_type: Readout + input_type: + [0]: Result + output_type: Boolean + body: "#]], ); let output_recording_callable_id = CallableId(3); assert_callable( @@ -350,13 +350,13 @@ fn assigning_classical_bool_within_dynamic_if_expression_adds_store_instruction( &program, readout_callable_id, &expect![[r#" - Callable: - name: __quantum__qis__read_result__body - call_type: Readout - input_type: - [0]: Result - output_type: Boolean - body: "#]], + Callable: + name: __quantum__rt__read_result + call_type: Readout + input_type: + [0]: Result + output_type: Boolean + body: "#]], ); let output_recording_callable_id = CallableId(3); assert_callable( @@ -428,13 +428,13 @@ fn assigning_classical_int_within_dynamic_if_else_expression_adds_store_instruct &program, readout_callable_id, &expect![[r#" - Callable: - name: __quantum__qis__read_result__body - call_type: Readout - input_type: - [0]: Result - output_type: Boolean - body: "#]], + Callable: + name: __quantum__rt__read_result + call_type: Readout + input_type: + [0]: Result + output_type: Boolean + body: "#]], ); let output_recording_callable_id = CallableId(3); assert_callable( @@ -598,7 +598,7 @@ fn array_of_bools_update_element_at_index_with_dynamic_content() { readout_callable_id, &expect![[r#" Callable: - name: __quantum__qis__read_result__body + name: __quantum__rt__read_result call_type: Readout input_type: [0]: Result @@ -1186,13 +1186,13 @@ fn logical_and_assign_with_lhs_classical_true_is_optimized_as_store() { &program, readout_callable_id, &expect![[r#" - Callable: - name: __quantum__qis__read_result__body - call_type: Readout - input_type: - [0]: Result - output_type: Boolean - body: "#]], + Callable: + name: __quantum__rt__read_result + call_type: Readout + input_type: + [0]: Result + output_type: Boolean + body: "#]], ); let output_record_id = CallableId(3); assert_callable( @@ -1260,13 +1260,13 @@ fn logical_and_assign_with_lhs_classical_false_short_circuits_evaluation() { &program, readout_callable_id, &expect![[r#" - Callable: - name: __quantum__qis__read_result__body - call_type: Readout - input_type: - [0]: Result - output_type: Boolean - body: "#]], + Callable: + name: __quantum__rt__read_result + call_type: Readout + input_type: + [0]: Result + output_type: Boolean + body: "#]], ); let output_record_id = CallableId(3); assert_callable( @@ -1332,13 +1332,13 @@ fn logical_and_assign_with_dynamic_lhs_and_dynamic_rhs_short_circuits_when_rhs_i &program, readout_callable_id, &expect![[r#" - Callable: - name: __quantum__qis__read_result__body - call_type: Readout - input_type: - [0]: Result - output_type: Boolean - body: "#]], + Callable: + name: __quantum__rt__read_result + call_type: Readout + input_type: + [0]: Result + output_type: Boolean + body: "#]], ); let output_record_id = CallableId(3); assert_callable( @@ -1414,13 +1414,13 @@ fn logical_or_assign_with_lhs_classical_true_short_circuits_evaluation() { &program, readout_callable_id, &expect![[r#" - Callable: - name: __quantum__qis__read_result__body - call_type: Readout - input_type: - [0]: Result - output_type: Boolean - body: "#]], + Callable: + name: __quantum__rt__read_result + call_type: Readout + input_type: + [0]: Result + output_type: Boolean + body: "#]], ); let output_record_id = CallableId(3); assert_callable( @@ -1487,13 +1487,13 @@ fn logical_or_assign_with_lhs_classical_false_is_optimized_as_store() { &program, readout_callable_id, &expect![[r#" - Callable: - name: __quantum__qis__read_result__body - call_type: Readout - input_type: - [0]: Result - output_type: Boolean - body: "#]], + Callable: + name: __quantum__rt__read_result + call_type: Readout + input_type: + [0]: Result + output_type: Boolean + body: "#]], ); let output_record_id = CallableId(3); assert_callable( @@ -1560,13 +1560,13 @@ fn logical_or_assign_with_dynamic_lhs_and_dynamic_rhs_short_circuits_when_rhs_is &program, readout_callable_id, &expect![[r#" - Callable: - name: __quantum__qis__read_result__body - call_type: Readout - input_type: - [0]: Result - output_type: Boolean - body: "#]], + Callable: + name: __quantum__rt__read_result + call_type: Readout + input_type: + [0]: Result + output_type: Boolean + body: "#]], ); let output_record_id = CallableId(3); assert_callable( @@ -1641,13 +1641,13 @@ fn integer_assign_add_with_lhs_classical_integer_and_rhs_dynamic_integer() { &program, readout_callable_id, &expect![[r#" - Callable: - name: __quantum__qis__read_result__body - call_type: Readout - input_type: - [0]: Result - output_type: Boolean - body: "#]], + Callable: + name: __quantum__rt__read_result + call_type: Readout + input_type: + [0]: Result + output_type: Boolean + body: "#]], ); let output_record_id = CallableId(3); assert_callable( @@ -1722,13 +1722,13 @@ fn integer_assign_sub_with_lhs_dynamic_integer_and_rhs_classical_integer() { &program, readout_callable_id, &expect![[r#" - Callable: - name: __quantum__qis__read_result__body - call_type: Readout - input_type: - [0]: Result - output_type: Boolean - body: "#]], + Callable: + name: __quantum__rt__read_result + call_type: Readout + input_type: + [0]: Result + output_type: Boolean + body: "#]], ); let output_record_id = CallableId(3); assert_callable( @@ -1803,13 +1803,13 @@ fn integer_assign_mul_with_lhs_dynamic_integer_and_rhs_dynamic_integer() { &program, readout_callable_id, &expect![[r#" - Callable: - name: __quantum__qis__read_result__body - call_type: Readout - input_type: - [0]: Result - output_type: Boolean - body: "#]], + Callable: + name: __quantum__rt__read_result + call_type: Readout + input_type: + [0]: Result + output_type: Boolean + body: "#]], ); let output_record_id = CallableId(3); assert_callable( @@ -1895,13 +1895,13 @@ fn integer_assign_div_with_lhs_classical_integer_and_rhs_dynamic_integer() { &program, readout_callable_id, &expect![[r#" - Callable: - name: __quantum__qis__read_result__body - call_type: Readout - input_type: - [0]: Result - output_type: Boolean - body: "#]], + Callable: + name: __quantum__rt__read_result + call_type: Readout + input_type: + [0]: Result + output_type: Boolean + body: "#]], ); let output_record_id = CallableId(3); assert_callable( @@ -1976,13 +1976,13 @@ fn integer_assign_mod_with_lhs_dynamic_integer_and_rhs_classical_integer() { &program, readout_callable_id, &expect![[r#" - Callable: - name: __quantum__qis__read_result__body - call_type: Readout - input_type: - [0]: Result - output_type: Boolean - body: "#]], + Callable: + name: __quantum__rt__read_result + call_type: Readout + input_type: + [0]: Result + output_type: Boolean + body: "#]], ); let output_record_id = CallableId(3); assert_callable( @@ -2103,13 +2103,13 @@ fn integer_assign_exp_with_lhs_dynamic_integer_and_rhs_classical_zero_integer() &program, readout_callable_id, &expect![[r#" - Callable: - name: __quantum__qis__read_result__body - call_type: Readout - input_type: - [0]: Result - output_type: Boolean - body: "#]], + Callable: + name: __quantum__rt__read_result + call_type: Readout + input_type: + [0]: Result + output_type: Boolean + body: "#]], ); let output_record_id = CallableId(3); assert_callable( @@ -2184,13 +2184,13 @@ fn integer_assign_exp_with_lhs_dynamic_integer_and_rhs_classical_positive_intege &program, readout_callable_id, &expect![[r#" - Callable: - name: __quantum__qis__read_result__body - call_type: Readout - input_type: - [0]: Result - output_type: Boolean - body: "#]], + Callable: + name: __quantum__rt__read_result + call_type: Readout + input_type: + [0]: Result + output_type: Boolean + body: "#]], ); let output_record_id = CallableId(3); assert_callable( @@ -2291,13 +2291,13 @@ fn integer_assign_bitwise_and_with_lhs_dynamic_integer_and_rhs_dynamic_integer() &program, readout_callable_id, &expect![[r#" - Callable: - name: __quantum__qis__read_result__body - call_type: Readout - input_type: - [0]: Result - output_type: Boolean - body: "#]], + Callable: + name: __quantum__rt__read_result + call_type: Readout + input_type: + [0]: Result + output_type: Boolean + body: "#]], ); let output_record_id = CallableId(3); assert_callable( @@ -2383,13 +2383,13 @@ fn integer_assign_bitwise_or_with_lhs_classical_integer_and_rhs_dynamic_integer( &program, readout_callable_id, &expect![[r#" - Callable: - name: __quantum__qis__read_result__body - call_type: Readout - input_type: - [0]: Result - output_type: Boolean - body: "#]], + Callable: + name: __quantum__rt__read_result + call_type: Readout + input_type: + [0]: Result + output_type: Boolean + body: "#]], ); let output_record_id = CallableId(3); assert_callable( @@ -2464,13 +2464,13 @@ fn integer_bitwise_xor_with_lhs_dynamic_integer_and_rhs_classical_integer() { &program, readout_callable_id, &expect![[r#" - Callable: - name: __quantum__qis__read_result__body - call_type: Readout - input_type: - [0]: Result - output_type: Boolean - body: "#]], + Callable: + name: __quantum__rt__read_result + call_type: Readout + input_type: + [0]: Result + output_type: Boolean + body: "#]], ); let output_record_id = CallableId(3); assert_callable( @@ -2545,13 +2545,13 @@ fn integer_assign_bitwise_left_shift_with_lhs_dynamic_integer_and_rhs_dynamic_in &program, readout_callable_id, &expect![[r#" - Callable: - name: __quantum__qis__read_result__body - call_type: Readout - input_type: - [0]: Result - output_type: Boolean - body: "#]], + Callable: + name: __quantum__rt__read_result + call_type: Readout + input_type: + [0]: Result + output_type: Boolean + body: "#]], ); let output_record_id = CallableId(3); assert_callable( @@ -2637,13 +2637,13 @@ fn integer_assign_bitwise_right_shift_with_lhs_classical_integer_and_rhs_dynamic &program, readout_callable_id, &expect![[r#" - Callable: - name: __quantum__qis__read_result__body - call_type: Readout - input_type: - [0]: Result - output_type: Boolean - body: "#]], + Callable: + name: __quantum__rt__read_result + call_type: Readout + input_type: + [0]: Result + output_type: Boolean + body: "#]], ); let output_record_id = CallableId(3); assert_callable( @@ -2718,13 +2718,13 @@ fn double_assign_add_with_lhs_classical_double_and_rhs_dynamic_double() { &program, readout_callable_id, &expect![[r#" - Callable: - name: __quantum__qis__read_result__body - call_type: Readout - input_type: - [0]: Result - output_type: Boolean - body: "#]], + Callable: + name: __quantum__rt__read_result + call_type: Readout + input_type: + [0]: Result + output_type: Boolean + body: "#]], ); let output_record_id = CallableId(3); assert_callable( @@ -2799,13 +2799,13 @@ fn double_assign_sub_with_lhs_dynamic_double_and_rhs_classical_double() { &program, readout_callable_id, &expect![[r#" - Callable: - name: __quantum__qis__read_result__body - call_type: Readout - input_type: - [0]: Result - output_type: Boolean - body: "#]], + Callable: + name: __quantum__rt__read_result + call_type: Readout + input_type: + [0]: Result + output_type: Boolean + body: "#]], ); let output_record_id = CallableId(3); assert_callable( @@ -2880,13 +2880,13 @@ fn double_assign_mul_with_lhs_dynamic_double_and_rhs_dynamic_double() { &program, readout_callable_id, &expect![[r#" - Callable: - name: __quantum__qis__read_result__body - call_type: Readout - input_type: - [0]: Result - output_type: Boolean - body: "#]], + Callable: + name: __quantum__rt__read_result + call_type: Readout + input_type: + [0]: Result + output_type: Boolean + body: "#]], ); let output_record_id = CallableId(3); assert_callable( @@ -2972,13 +2972,13 @@ fn double_assign_div_with_lhs_classical_double_and_rhs_dynamic_double() { &program, readout_callable_id, &expect![[r#" - Callable: - name: __quantum__qis__read_result__body - call_type: Readout - input_type: - [0]: Result - output_type: Boolean - body: "#]], + Callable: + name: __quantum__rt__read_result + call_type: Readout + input_type: + [0]: Result + output_type: Boolean + body: "#]], ); let output_record_id = CallableId(3); assert_callable( diff --git a/source/compiler/qsc_partial_eval/src/tests/bindings.rs b/source/compiler/qsc_partial_eval/src/tests/bindings.rs index 0bd21aa798..c8668d1d0b 100644 --- a/source/compiler/qsc_partial_eval/src/tests/bindings.rs +++ b/source/compiler/qsc_partial_eval/src/tests/bindings.rs @@ -146,7 +146,7 @@ fn immutable_bool_binding_does_not_generate_store_instruction() { read_result_callable_id, &expect![[r#" Callable: - name: __quantum__qis__read_result__body + name: __quantum__rt__read_result call_type: Readout input_type: [0]: Result @@ -214,7 +214,7 @@ fn mutable_bool_binding_generates_store_instruction() { read_result_callable_id, &expect![[r#" Callable: - name: __quantum__qis__read_result__body + name: __quantum__rt__read_result call_type: Readout input_type: [0]: Result @@ -282,7 +282,7 @@ fn immutable_int_binding_does_not_generate_store_instruction() { read_result_callable_id, &expect![[r#" Callable: - name: __quantum__qis__read_result__body + name: __quantum__rt__read_result call_type: Readout input_type: [0]: Result @@ -358,7 +358,7 @@ fn mutable_int_binding_does_generate_store_instruction() { read_result_callable_id, &expect![[r#" Callable: - name: __quantum__qis__read_result__body + name: __quantum__rt__read_result call_type: Readout input_type: [0]: Result @@ -444,7 +444,7 @@ fn mutable_variable_in_outer_scope_set_to_mutable_from_inner_scope() { read_result_callable_id, &expect![[r#" Callable: - name: __quantum__qis__read_result__body + name: __quantum__rt__read_result call_type: Readout input_type: [0]: Result @@ -521,7 +521,7 @@ fn mutable_double_binding_does_generate_store_instruction() { read_result_callable_id, &expect![[r#" Callable: - name: __quantum__qis__read_result__body + name: __quantum__rt__read_result call_type: Readout input_type: [0]: Result diff --git a/source/compiler/qsc_partial_eval/src/tests/branching.rs b/source/compiler/qsc_partial_eval/src/tests/branching.rs index 35a3a2c771..6913334295 100644 --- a/source/compiler/qsc_partial_eval/src/tests/branching.rs +++ b/source/compiler/qsc_partial_eval/src/tests/branching.rs @@ -250,13 +250,13 @@ fn if_expression_with_dynamic_condition() { &program, read_result_callable_id, &expect![[r#" - Callable: - name: __quantum__qis__read_result__body - call_type: Readout - input_type: - [0]: Result - output_type: Boolean - body: "#]], + Callable: + name: __quantum__rt__read_result + call_type: Readout + input_type: + [0]: Result + output_type: Boolean + body: "#]], ); let op_a_callable_id = CallableId(3); assert_callable( @@ -331,13 +331,13 @@ fn if_else_expression_with_dynamic_condition() { &program, read_result_callable_id, &expect![[r#" - Callable: - name: __quantum__qis__read_result__body - call_type: Readout - input_type: - [0]: Result - output_type: Boolean - body: "#]], + Callable: + name: __quantum__rt__read_result + call_type: Readout + input_type: + [0]: Result + output_type: Boolean + body: "#]], ); let op_a_callable_id = CallableId(3); assert_callable( @@ -432,13 +432,13 @@ fn if_elif_else_expression_with_dynamic_condition() { &program, read_result_callable_id, &expect![[r#" - Callable: - name: __quantum__qis__read_result__body - call_type: Readout - input_type: - [0]: Result - output_type: Boolean - body: "#]], + Callable: + name: __quantum__rt__read_result + call_type: Readout + input_type: + [0]: Result + output_type: Boolean + body: "#]], ); let op_a_callable_id = CallableId(3); assert_callable( @@ -551,13 +551,13 @@ fn if_expression_with_dynamic_condition_and_nested_if_expression_with_true_condi &program, read_result_callable_id, &expect![[r#" - Callable: - name: __quantum__qis__read_result__body - call_type: Readout - input_type: - [0]: Result - output_type: Boolean - body: "#]], + Callable: + name: __quantum__rt__read_result + call_type: Readout + input_type: + [0]: Result + output_type: Boolean + body: "#]], ); let op_a_callable_id = CallableId(3); assert_callable( @@ -631,13 +631,13 @@ fn if_expression_with_dynamic_condition_and_nested_if_expression_with_false_cond &program, read_result_callable_id, &expect![[r#" - Callable: - name: __quantum__qis__read_result__body - call_type: Readout - input_type: - [0]: Result - output_type: Boolean - body: "#]], + Callable: + name: __quantum__rt__read_result + call_type: Readout + input_type: + [0]: Result + output_type: Boolean + body: "#]], ); assert_blocks( @@ -700,13 +700,13 @@ fn if_else_expression_with_dynamic_condition_and_nested_if_expression_with_true_ &program, read_result_callable_id, &expect![[r#" - Callable: - name: __quantum__qis__read_result__body - call_type: Readout - input_type: - [0]: Result - output_type: Boolean - body: "#]], + Callable: + name: __quantum__rt__read_result + call_type: Readout + input_type: + [0]: Result + output_type: Boolean + body: "#]], ); let op_a_callable_id = CallableId(3); assert_callable( @@ -799,13 +799,13 @@ fn if_else_expression_with_dynamic_condition_and_nested_if_expression_with_false &program, read_result_callable_id, &expect![[r#" - Callable: - name: __quantum__qis__read_result__body - call_type: Readout - input_type: - [0]: Result - output_type: Boolean - body: "#]], + Callable: + name: __quantum__rt__read_result + call_type: Readout + input_type: + [0]: Result + output_type: Boolean + body: "#]], ); let op_a_callable_id = CallableId(3); assert_callable( @@ -882,13 +882,13 @@ fn if_expression_with_dynamic_condition_and_nested_if_expression_with_dynamic_co &program, read_result_callable_id, &expect![[r#" - Callable: - name: __quantum__qis__read_result__body - call_type: Readout - input_type: - [0]: Result - output_type: Boolean - body: "#]], + Callable: + name: __quantum__rt__read_result + call_type: Readout + input_type: + [0]: Result + output_type: Boolean + body: "#]], ); let op_a_callable_id = CallableId(3); assert_callable( @@ -982,13 +982,13 @@ fn doubly_nested_if_else_expressions_with_dynamic_conditions() { &program, read_result_callable_id, &expect![[r#" - Callable: - name: __quantum__qis__read_result__body - call_type: Readout - input_type: - [0]: Result - output_type: Boolean - body: "#]], + Callable: + name: __quantum__rt__read_result + call_type: Readout + input_type: + [0]: Result + output_type: Boolean + body: "#]], ); let op_a_callable_id = CallableId(3); assert_callable( @@ -1123,13 +1123,13 @@ fn if_expression_with_dynamic_condition_and_subsequent_call_to_operation() { &program, read_result_callable_id, &expect![[r#" - Callable: - name: __quantum__qis__read_result__body - call_type: Readout - input_type: - [0]: Result - output_type: Boolean - body: "#]], + Callable: + name: __quantum__rt__read_result + call_type: Readout + input_type: + [0]: Result + output_type: Boolean + body: "#]], ); let op_a_callable_id = CallableId(3); assert_callable( @@ -1220,13 +1220,13 @@ fn if_else_expression_with_dynamic_condition_and_subsequent_call_to_operation() &program, read_result_callable_id, &expect![[r#" - Callable: - name: __quantum__qis__read_result__body - call_type: Readout - input_type: - [0]: Result - output_type: Boolean - body: "#]], + Callable: + name: __quantum__rt__read_result + call_type: Readout + input_type: + [0]: Result + output_type: Boolean + body: "#]], ); let op_a_callable_id = CallableId(3); assert_callable( @@ -1529,7 +1529,7 @@ fn if_expression_with_dynamic_operand_from_hybrid_results_array() { read_result_callable_id, &expect![[r#" Callable: - name: __quantum__qis__read_result__body + name: __quantum__rt__read_result call_type: Readout input_type: [0]: Result @@ -1637,7 +1637,7 @@ fn if_expression_with_classical_operand_from_hybrid_booleans_array() { read_result_callable_id, &expect![[r#" Callable: - name: __quantum__qis__read_result__body + name: __quantum__rt__read_result call_type: Readout input_type: [0]: Result @@ -1743,7 +1743,7 @@ fn if_expression_with_dynamic_operand_from_hybrid_booleans_array() { read_result_callable_id, &expect![[r#" Callable: - name: __quantum__qis__read_result__body + name: __quantum__rt__read_result call_type: Readout input_type: [0]: Result @@ -1853,7 +1853,7 @@ fn if_expression_with_classical_operand_from_hybrid_integers_array() { read_result_callable_id, &expect![[r#" Callable: - name: __quantum__qis__read_result__body + name: __quantum__rt__read_result call_type: Readout input_type: [0]: Result @@ -1975,7 +1975,7 @@ fn if_expression_with_dynamic_operand_from_hybrid_integers_array() { read_result_callable_id, &expect![[r#" Callable: - name: __quantum__qis__read_result__body + name: __quantum__rt__read_result call_type: Readout input_type: [0]: Result @@ -2102,7 +2102,7 @@ fn if_expression_with_classical_operand_from_hybrid_doubles_array() { read_result_callable_id, &expect![[r#" Callable: - name: __quantum__qis__read_result__body + name: __quantum__rt__read_result call_type: Readout input_type: [0]: Result @@ -2224,7 +2224,7 @@ fn if_expression_with_dynamic_operand_from_hybrid_doubles_array() { read_result_callable_id, &expect![[r#" Callable: - name: __quantum__qis__read_result__body + name: __quantum__rt__read_result call_type: Readout input_type: [0]: Result diff --git a/source/compiler/qsc_partial_eval/src/tests/calls.rs b/source/compiler/qsc_partial_eval/src/tests/calls.rs index 17bd0dfd9f..5a57bcb7a1 100644 --- a/source/compiler/qsc_partial_eval/src/tests/calls.rs +++ b/source/compiler/qsc_partial_eval/src/tests/calls.rs @@ -325,13 +325,13 @@ fn calls_to_unitary_that_conditionally_calls_intrinsic_with_dynamic_bool() { &program, read_result_callable_id, &expect![[r#" - Callable: - name: __quantum__qis__read_result__body - call_type: Readout - input_type: - [0]: Result - output_type: Boolean - body: "#]], + Callable: + name: __quantum__rt__read_result + call_type: Readout + input_type: + [0]: Result + output_type: Boolean + body: "#]], ); let op_a_callable_id = CallableId(3); assert_callable( @@ -523,13 +523,13 @@ fn call_to_operation_that_returns_dynamic_bool() { &program, read_result_callable_id, &expect![[r#" - Callable: - name: __quantum__qis__read_result__body - call_type: Readout - input_type: - [0]: Result - output_type: Boolean - body: "#]], + Callable: + name: __quantum__rt__read_result + call_type: Readout + input_type: + [0]: Result + output_type: Boolean + body: "#]], ); let output_recording_callable_id = CallableId(3); assert_callable( @@ -657,13 +657,13 @@ fn call_to_boolean_function_using_dynamic_result_as_argument_generates_branches( &program, read_result_callable_id, &expect![[r#" - Callable: - name: __quantum__qis__read_result__body - call_type: Readout - input_type: - [0]: Result - output_type: Boolean - body: "#]], + Callable: + name: __quantum__rt__read_result + call_type: Readout + input_type: + [0]: Result + output_type: Boolean + body: "#]], ); let op_callable_id = CallableId(3); assert_callable( diff --git a/source/compiler/qsc_partial_eval/src/tests/dynamic_vars.rs b/source/compiler/qsc_partial_eval/src/tests/dynamic_vars.rs index 11eb8e2cd2..04055f47d6 100644 --- a/source/compiler/qsc_partial_eval/src/tests/dynamic_vars.rs +++ b/source/compiler/qsc_partial_eval/src/tests/dynamic_vars.rs @@ -43,13 +43,13 @@ fn dynamic_int_from_if_expression_with_single_measurement_comparison_and_classic &program, read_result_callable_id, &expect![[r#" - Callable: - name: __quantum__qis__read_result__body - call_type: Readout - input_type: - [0]: Result - output_type: Boolean - body: "#]], + Callable: + name: __quantum__rt__read_result + call_type: Readout + input_type: + [0]: Result + output_type: Boolean + body: "#]], ); assert_blocks( @@ -117,13 +117,13 @@ fn dynamic_int_from_if_expression_with_single_measurement_comparison_and_non_cla &program, read_result_callable_id, &expect![[r#" - Callable: - name: __quantum__qis__read_result__body - call_type: Readout - input_type: - [0]: Result - output_type: Boolean - body: "#]], + Callable: + name: __quantum__rt__read_result + call_type: Readout + input_type: + [0]: Result + output_type: Boolean + body: "#]], ); let op_a_callable_id = CallableId(3); assert_callable( @@ -697,13 +697,13 @@ fn dynamic_double_from_if_expression_with_single_measurement_comparison_and_clas &program, read_result_callable_id, &expect![[r#" - Callable: - name: __quantum__qis__read_result__body - call_type: Readout - input_type: - [0]: Result - output_type: Boolean - body: "#]], + Callable: + name: __quantum__rt__read_result + call_type: Readout + input_type: + [0]: Result + output_type: Boolean + body: "#]], ); assert_blocks( @@ -771,13 +771,13 @@ fn dynamic_double_from_if_expression_with_single_measurement_comparison_and_non_ &program, read_result_callable_id, &expect![[r#" - Callable: - name: __quantum__qis__read_result__body - call_type: Readout - input_type: - [0]: Result - output_type: Boolean - body: "#]], + Callable: + name: __quantum__rt__read_result + call_type: Readout + input_type: + [0]: Result + output_type: Boolean + body: "#]], ); let op_a_callable_id = CallableId(3); assert_callable( @@ -871,13 +871,13 @@ fn dynamic_double_from_if_expression_with_single_measurement_comparison_pass_dyn &program, read_result_callable_id, &expect![[r#" - Callable: - name: __quantum__qis__read_result__body - call_type: Readout - input_type: - [0]: Result - output_type: Boolean - body: "#]], + Callable: + name: __quantum__rt__read_result + call_type: Readout + input_type: + [0]: Result + output_type: Boolean + body: "#]], ); let op_a_callable_id = CallableId(3); assert_callable( diff --git a/source/compiler/qsc_partial_eval/src/tests/intrinsics.rs b/source/compiler/qsc_partial_eval/src/tests/intrinsics.rs index e9cb385940..9a4c98b874 100644 --- a/source/compiler/qsc_partial_eval/src/tests/intrinsics.rs +++ b/source/compiler/qsc_partial_eval/src/tests/intrinsics.rs @@ -742,13 +742,13 @@ fn call_to_intrinsic_begin_estimate_caching_with_dynamic_values_yields_true() { &program, read_result_callable_id, &expect![[r#" - Callable: - name: __quantum__qis__read_result__body - call_type: Readout - input_type: - [0]: Result - output_type: Boolean - body: "#]], + Callable: + name: __quantum__rt__read_result + call_type: Readout + input_type: + [0]: Result + output_type: Boolean + body: "#]], ); let op_callable_id = CallableId(3); assert_callable( diff --git a/source/compiler/qsc_partial_eval/src/tests/misc.rs b/source/compiler/qsc_partial_eval/src/tests/misc.rs index 6783fcae65..50c97d0903 100644 --- a/source/compiler/qsc_partial_eval/src/tests/misc.rs +++ b/source/compiler/qsc_partial_eval/src/tests/misc.rs @@ -290,13 +290,13 @@ fn integer_assign_with_hybrid_value_within_an_if_with_dynamic_condition() { &program, readout_callable_id, &expect![[r#" - Callable: - name: __quantum__qis__read_result__body - call_type: Readout - input_type: - [0]: Result - output_type: Boolean - body: "#]], + Callable: + name: __quantum__rt__read_result + call_type: Readout + input_type: + [0]: Result + output_type: Boolean + body: "#]], ); let output_record_id = CallableId(3); assert_callable( @@ -421,13 +421,13 @@ fn if_else_expression_with_dynamic_logical_and_condition() { &program, read_result_callable_id, &expect![[r#" - Callable: - name: __quantum__qis__read_result__body - call_type: Readout - input_type: - [0]: Result - output_type: Boolean - body: "#]], + Callable: + name: __quantum__rt__read_result + call_type: Readout + input_type: + [0]: Result + output_type: Boolean + body: "#]], ); let op_a_callable_id = CallableId(3); assert_callable( @@ -526,13 +526,13 @@ fn if_else_expression_with_dynamic_logical_or_condition() { &program, read_result_callable_id, &expect![[r#" - Callable: - name: __quantum__qis__read_result__body - call_type: Readout - input_type: - [0]: Result - output_type: Boolean - body: "#]], + Callable: + name: __quantum__rt__read_result + call_type: Readout + input_type: + [0]: Result + output_type: Boolean + body: "#]], ); let op_a_callable_id = CallableId(3); assert_callable( diff --git a/source/compiler/qsc_partial_eval/src/tests/operators.rs b/source/compiler/qsc_partial_eval/src/tests/operators.rs index c0ba2b8376..48103c0097 100644 --- a/source/compiler/qsc_partial_eval/src/tests/operators.rs +++ b/source/compiler/qsc_partial_eval/src/tests/operators.rs @@ -40,13 +40,13 @@ fn leading_positive_unary_operator_on_integer_does_not_generate_rir_instruction( &program, readout_callable_id, &expect![[r#" - Callable: - name: __quantum__qis__read_result__body - call_type: Readout - input_type: - [0]: Result - output_type: Boolean - body: "#]], + Callable: + name: __quantum__rt__read_result + call_type: Readout + input_type: + [0]: Result + output_type: Boolean + body: "#]], ); let output_recording_callable_id = CallableId(3); assert_callable( @@ -116,13 +116,13 @@ fn leading_negative_unary_operator_on_integer_generates_rir_instruction() { &program, readout_callable_id, &expect![[r#" - Callable: - name: __quantum__qis__read_result__body - call_type: Readout - input_type: - [0]: Result - output_type: Boolean - body: "#]], + Callable: + name: __quantum__rt__read_result + call_type: Readout + input_type: + [0]: Result + output_type: Boolean + body: "#]], ); let output_recording_callable_id = CallableId(3); assert_callable( @@ -193,13 +193,13 @@ fn bitwise_not_unary_operator_generates_rir_instruction() { &program, readout_callable_id, &expect![[r#" - Callable: - name: __quantum__qis__read_result__body - call_type: Readout - input_type: - [0]: Result - output_type: Boolean - body: "#]], + Callable: + name: __quantum__rt__read_result + call_type: Readout + input_type: + [0]: Result + output_type: Boolean + body: "#]], ); let output_recording_callable_id = CallableId(3); assert_callable( @@ -270,13 +270,13 @@ fn logical_not_unary_operator_generates_logical_not_rir_instruction() { &program, readout_callable_id, &expect![[r#" - Callable: - name: __quantum__qis__read_result__body - call_type: Readout - input_type: - [0]: Result - output_type: Boolean - body: "#]], + Callable: + name: __quantum__rt__read_result + call_type: Readout + input_type: + [0]: Result + output_type: Boolean + body: "#]], ); let output_recording_callable_id = CallableId(3); assert_callable( @@ -342,13 +342,13 @@ fn comparing_measurement_results_for_equality_adds_read_result_and_comparison_in &program, readout_callable_id, &expect![[r#" - Callable: - name: __quantum__qis__read_result__body - call_type: Readout - input_type: - [0]: Result - output_type: Boolean - body: "#]], + Callable: + name: __quantum__rt__read_result + call_type: Readout + input_type: + [0]: Result + output_type: Boolean + body: "#]], ); let bool_record_id = CallableId(3); assert_callable( @@ -416,13 +416,13 @@ fn comparing_measurement_results_for_inequality_adds_read_result_and_comparison_ &program, readout_callable_id, &expect![[r#" - Callable: - name: __quantum__qis__read_result__body - call_type: Readout - input_type: - [0]: Result - output_type: Boolean - body: "#]], + Callable: + name: __quantum__rt__read_result + call_type: Readout + input_type: + [0]: Result + output_type: Boolean + body: "#]], ); let bool_record_id = CallableId(3); assert_callable( @@ -490,13 +490,13 @@ fn comparing_measurement_result_against_result_literal_for_equality_adds_read_re &program, readout_callable_id, &expect![[r#" - Callable: - name: __quantum__qis__read_result__body - call_type: Readout - input_type: - [0]: Result - output_type: Boolean - body: "#]], + Callable: + name: __quantum__rt__read_result + call_type: Readout + input_type: + [0]: Result + output_type: Boolean + body: "#]], ); let bool_record_id = CallableId(3); assert_callable( @@ -562,13 +562,13 @@ fn comparing_measurement_result_against_result_literal_for_inequality_adds_read_ &program, readout_callable_id, &expect![[r#" - Callable: - name: __quantum__qis__read_result__body - call_type: Readout - input_type: - [0]: Result - output_type: Boolean - body: "#]], + Callable: + name: __quantum__rt__read_result + call_type: Readout + input_type: + [0]: Result + output_type: Boolean + body: "#]], ); let bool_record_id = CallableId(3); assert_callable( @@ -633,13 +633,13 @@ fn comparing_lhs_classical_boolean_against_rhs_dynamic_boolean_for_equality() { &program, readout_callable_id, &expect![[r#" - Callable: - name: __quantum__qis__read_result__body - call_type: Readout - input_type: - [0]: Result - output_type: Boolean - body: "#]], + Callable: + name: __quantum__rt__read_result + call_type: Readout + input_type: + [0]: Result + output_type: Boolean + body: "#]], ); let output_record_id = CallableId(3); assert_callable( @@ -703,13 +703,13 @@ fn comparing_lhs_dynamic_boolean_against_rhs_dynamic_boolean_for_equality() { &program, readout_callable_id, &expect![[r#" - Callable: - name: __quantum__qis__read_result__body - call_type: Readout - input_type: - [0]: Result - output_type: Boolean - body: "#]], + Callable: + name: __quantum__rt__read_result + call_type: Readout + input_type: + [0]: Result + output_type: Boolean + body: "#]], ); let output_record_id = CallableId(3); assert_callable( @@ -776,13 +776,13 @@ fn comparing_lhs_classical_boolean_against_rhs_dynamic_boolean_for_inequality() &program, readout_callable_id, &expect![[r#" - Callable: - name: __quantum__qis__read_result__body - call_type: Readout - input_type: - [0]: Result - output_type: Boolean - body: "#]], + Callable: + name: __quantum__rt__read_result + call_type: Readout + input_type: + [0]: Result + output_type: Boolean + body: "#]], ); let output_record_id = CallableId(3); assert_callable( @@ -846,13 +846,13 @@ fn comparing_lhs_dynamic_boolean_against_rhs_dynamic_boolean_for_inequality() { &program, readout_callable_id, &expect![[r#" - Callable: - name: __quantum__qis__read_result__body - call_type: Readout - input_type: - [0]: Result - output_type: Boolean - body: "#]], + Callable: + name: __quantum__rt__read_result + call_type: Readout + input_type: + [0]: Result + output_type: Boolean + body: "#]], ); let output_record_id = CallableId(3); assert_callable( @@ -919,13 +919,13 @@ fn logical_and_with_lhs_classical_true_is_optimized_as_store() { &program, readout_callable_id, &expect![[r#" - Callable: - name: __quantum__qis__read_result__body - call_type: Readout - input_type: - [0]: Result - output_type: Boolean - body: "#]], + Callable: + name: __quantum__rt__read_result + call_type: Readout + input_type: + [0]: Result + output_type: Boolean + body: "#]], ); let output_record_id = CallableId(3); assert_callable( @@ -989,13 +989,13 @@ fn logical_and_with_lhs_classical_false_short_circuits_evaluation() { &program, readout_callable_id, &expect![[r#" - Callable: - name: __quantum__qis__read_result__body - call_type: Readout - input_type: - [0]: Result - output_type: Boolean - body: "#]], + Callable: + name: __quantum__rt__read_result + call_type: Readout + input_type: + [0]: Result + output_type: Boolean + body: "#]], ); let output_record_id = CallableId(3); assert_callable( @@ -1057,13 +1057,13 @@ fn logical_and_with_dynamic_lhs_and_dynamic_rhs_short_circuits_when_lhs_is_false &program, readout_callable_id, &expect![[r#" - Callable: - name: __quantum__qis__read_result__body - call_type: Readout - input_type: - [0]: Result - output_type: Boolean - body: "#]], + Callable: + name: __quantum__rt__read_result + call_type: Readout + input_type: + [0]: Result + output_type: Boolean + body: "#]], ); let output_record_id = CallableId(3); assert_callable( @@ -1135,13 +1135,13 @@ fn logical_or_with_lhs_classical_true_short_circuits_evaluation() { &program, readout_callable_id, &expect![[r#" - Callable: - name: __quantum__qis__read_result__body - call_type: Readout - input_type: - [0]: Result - output_type: Boolean - body: "#]], + Callable: + name: __quantum__rt__read_result + call_type: Readout + input_type: + [0]: Result + output_type: Boolean + body: "#]], ); let output_record_id = CallableId(3); assert_callable( @@ -1204,13 +1204,13 @@ fn logical_or_with_lhs_classical_false_is_optimized_as_store() { &program, readout_callable_id, &expect![[r#" - Callable: - name: __quantum__qis__read_result__body - call_type: Readout - input_type: - [0]: Result - output_type: Boolean - body: "#]], + Callable: + name: __quantum__rt__read_result + call_type: Readout + input_type: + [0]: Result + output_type: Boolean + body: "#]], ); let output_record_id = CallableId(3); assert_callable( @@ -1273,13 +1273,13 @@ fn logical_or_with_dynamic_lhs_and_dynamic_rhs_short_circuits_when_rhs_is_true() &program, readout_callable_id, &expect![[r#" - Callable: - name: __quantum__qis__read_result__body - call_type: Readout - input_type: - [0]: Result - output_type: Boolean - body: "#]], + Callable: + name: __quantum__rt__read_result + call_type: Readout + input_type: + [0]: Result + output_type: Boolean + body: "#]], ); let output_record_id = CallableId(3); assert_callable( @@ -1350,13 +1350,13 @@ fn logical_and_and_sequence_with_dynamic_operands() { &program, readout_callable_id, &expect![[r#" - Callable: - name: __quantum__qis__read_result__body - call_type: Readout - input_type: - [0]: Result - output_type: Boolean - body: "#]], + Callable: + name: __quantum__rt__read_result + call_type: Readout + input_type: + [0]: Result + output_type: Boolean + body: "#]], ); let output_record_id = CallableId(3); assert_callable( @@ -1436,13 +1436,13 @@ fn logical_and_or_sequence_with_dynamic_operands() { &program, readout_callable_id, &expect![[r#" - Callable: - name: __quantum__qis__read_result__body - call_type: Readout - input_type: - [0]: Result - output_type: Boolean - body: "#]], + Callable: + name: __quantum__rt__read_result + call_type: Readout + input_type: + [0]: Result + output_type: Boolean + body: "#]], ); let output_record_id = CallableId(3); assert_callable( @@ -1522,13 +1522,13 @@ fn logical_or_and_sequence_with_dynamic_operands() { &program, readout_callable_id, &expect![[r#" - Callable: - name: __quantum__qis__read_result__body - call_type: Readout - input_type: - [0]: Result - output_type: Boolean - body: "#]], + Callable: + name: __quantum__rt__read_result + call_type: Readout + input_type: + [0]: Result + output_type: Boolean + body: "#]], ); let output_record_id = CallableId(3); assert_callable( @@ -1608,13 +1608,13 @@ fn logical_or_or_sequence_with_dynamic_operands() { &program, readout_callable_id, &expect![[r#" - Callable: - name: __quantum__qis__read_result__body - call_type: Readout - input_type: - [0]: Result - output_type: Boolean - body: "#]], + Callable: + name: __quantum__rt__read_result + call_type: Readout + input_type: + [0]: Result + output_type: Boolean + body: "#]], ); let output_record_id = CallableId(3); assert_callable( @@ -1695,13 +1695,13 @@ fn integer_add_with_lhs_classical_integer_and_rhs_dynamic_integer() { &program, readout_callable_id, &expect![[r#" - Callable: - name: __quantum__qis__read_result__body - call_type: Readout - input_type: - [0]: Result - output_type: Boolean - body: "#]], + Callable: + name: __quantum__rt__read_result + call_type: Readout + input_type: + [0]: Result + output_type: Boolean + body: "#]], ); let output_record_id = CallableId(3); assert_callable( @@ -1774,13 +1774,13 @@ fn integer_sub_with_lhs_dynamic_integer_and_rhs_classical_integer() { &program, readout_callable_id, &expect![[r#" - Callable: - name: __quantum__qis__read_result__body - call_type: Readout - input_type: - [0]: Result - output_type: Boolean - body: "#]], + Callable: + name: __quantum__rt__read_result + call_type: Readout + input_type: + [0]: Result + output_type: Boolean + body: "#]], ); let output_record_id = CallableId(3); assert_callable( @@ -1854,13 +1854,13 @@ fn integer_mul_with_lhs_dynamic_integer_and_rhs_dynamic_integer() { &program, readout_callable_id, &expect![[r#" - Callable: - name: __quantum__qis__read_result__body - call_type: Readout - input_type: - [0]: Result - output_type: Boolean - body: "#]], + Callable: + name: __quantum__rt__read_result + call_type: Readout + input_type: + [0]: Result + output_type: Boolean + body: "#]], ); let output_record_id = CallableId(3); assert_callable( @@ -1945,13 +1945,13 @@ fn integer_div_with_lhs_classical_integer_and_rhs_dynamic_integer() { &program, readout_callable_id, &expect![[r#" - Callable: - name: __quantum__qis__read_result__body - call_type: Readout - input_type: - [0]: Result - output_type: Boolean - body: "#]], + Callable: + name: __quantum__rt__read_result + call_type: Readout + input_type: + [0]: Result + output_type: Boolean + body: "#]], ); let output_record_id = CallableId(3); assert_callable( @@ -2046,13 +2046,13 @@ fn integer_mod_with_lhs_dynamic_integer_and_rhs_classical_integer() { &program, readout_callable_id, &expect![[r#" - Callable: - name: __quantum__qis__read_result__body - call_type: Readout - input_type: - [0]: Result - output_type: Boolean - body: "#]], + Callable: + name: __quantum__rt__read_result + call_type: Readout + input_type: + [0]: Result + output_type: Boolean + body: "#]], ); let output_record_id = CallableId(3); assert_callable( @@ -2170,13 +2170,13 @@ fn integer_exponentiation_with_lhs_dynamic_integer_and_rhs_classical_zero_intege &program, readout_callable_id, &expect![[r#" - Callable: - name: __quantum__qis__read_result__body - call_type: Readout - input_type: - [0]: Result - output_type: Boolean - body: "#]], + Callable: + name: __quantum__rt__read_result + call_type: Readout + input_type: + [0]: Result + output_type: Boolean + body: "#]], ); let output_record_id = CallableId(3); assert_callable( @@ -2249,13 +2249,13 @@ fn integer_exponentiation_with_lhs_dynamic_integer_and_rhs_classical_positive_in &program, readout_callable_id, &expect![[r#" - Callable: - name: __quantum__qis__read_result__body - call_type: Readout - input_type: - [0]: Result - output_type: Boolean - body: "#]], + Callable: + name: __quantum__rt__read_result + call_type: Readout + input_type: + [0]: Result + output_type: Boolean + body: "#]], ); let output_record_id = CallableId(3); assert_callable( @@ -2355,13 +2355,13 @@ fn integer_bitwise_and_with_lhs_dynamic_integer_and_rhs_dynamic_integer() { &program, readout_callable_id, &expect![[r#" - Callable: - name: __quantum__qis__read_result__body - call_type: Readout - input_type: - [0]: Result - output_type: Boolean - body: "#]], + Callable: + name: __quantum__rt__read_result + call_type: Readout + input_type: + [0]: Result + output_type: Boolean + body: "#]], ); let output_record_id = CallableId(3); assert_callable( @@ -2446,13 +2446,13 @@ fn integer_bitwise_or_with_lhs_classical_integer_and_rhs_dynamic_integer() { &program, readout_callable_id, &expect![[r#" - Callable: - name: __quantum__qis__read_result__body - call_type: Readout - input_type: - [0]: Result - output_type: Boolean - body: "#]], + Callable: + name: __quantum__rt__read_result + call_type: Readout + input_type: + [0]: Result + output_type: Boolean + body: "#]], ); let output_record_id = CallableId(3); assert_callable( @@ -2525,13 +2525,13 @@ fn integer_bitwise_xor_with_lhs_dynamic_integer_and_rhs_classical_integer() { &program, readout_callable_id, &expect![[r#" - Callable: - name: __quantum__qis__read_result__body - call_type: Readout - input_type: - [0]: Result - output_type: Boolean - body: "#]], + Callable: + name: __quantum__rt__read_result + call_type: Readout + input_type: + [0]: Result + output_type: Boolean + body: "#]], ); let output_record_id = CallableId(3); assert_callable( @@ -2605,13 +2605,13 @@ fn integer_bitwise_left_shif_with_lhs_dynamic_integer_and_rhs_dynamic_integer() &program, readout_callable_id, &expect![[r#" - Callable: - name: __quantum__qis__read_result__body - call_type: Readout - input_type: - [0]: Result - output_type: Boolean - body: "#]], + Callable: + name: __quantum__rt__read_result + call_type: Readout + input_type: + [0]: Result + output_type: Boolean + body: "#]], ); let output_record_id = CallableId(3); assert_callable( @@ -2696,13 +2696,13 @@ fn integer_bitwise_right_shift_with_lhs_classical_integer_and_rhs_dynamic_intege &program, readout_callable_id, &expect![[r#" - Callable: - name: __quantum__qis__read_result__body - call_type: Readout - input_type: - [0]: Result - output_type: Boolean - body: "#]], + Callable: + name: __quantum__rt__read_result + call_type: Readout + input_type: + [0]: Result + output_type: Boolean + body: "#]], ); let output_record_id = CallableId(3); assert_callable( @@ -2775,13 +2775,13 @@ fn integer_equality_comparison_with_lhs_dynamic_integer_and_rhs_classical_intege &program, readout_callable_id, &expect![[r#" - Callable: - name: __quantum__qis__read_result__body - call_type: Readout - input_type: - [0]: Result - output_type: Boolean - body: "#]], + Callable: + name: __quantum__rt__read_result + call_type: Readout + input_type: + [0]: Result + output_type: Boolean + body: "#]], ); let output_record_id = CallableId(3); assert_callable( @@ -2855,13 +2855,13 @@ fn integer_inequality_comparison_with_lhs_dynamic_integer_and_rhs_dynamic_intege &program, readout_callable_id, &expect![[r#" - Callable: - name: __quantum__qis__read_result__body - call_type: Readout - input_type: - [0]: Result - output_type: Boolean - body: "#]], + Callable: + name: __quantum__rt__read_result + call_type: Readout + input_type: + [0]: Result + output_type: Boolean + body: "#]], ); let output_record_id = CallableId(3); assert_callable( @@ -2946,13 +2946,13 @@ fn integer_greater_than_comparison_with_lhs_classical_integer_and_rhs_dynamic_in &program, readout_callable_id, &expect![[r#" - Callable: - name: __quantum__qis__read_result__body - call_type: Readout - input_type: - [0]: Result - output_type: Boolean - body: "#]], + Callable: + name: __quantum__rt__read_result + call_type: Readout + input_type: + [0]: Result + output_type: Boolean + body: "#]], ); let output_record_id = CallableId(3); assert_callable( @@ -3025,13 +3025,13 @@ fn integer_greater_or_equal_than_comparison_with_lhs_dynamic_integer_and_rhs_cla &program, readout_callable_id, &expect![[r#" - Callable: - name: __quantum__qis__read_result__body - call_type: Readout - input_type: - [0]: Result - output_type: Boolean - body: "#]], + Callable: + name: __quantum__rt__read_result + call_type: Readout + input_type: + [0]: Result + output_type: Boolean + body: "#]], ); let output_record_id = CallableId(3); assert_callable( @@ -3105,13 +3105,13 @@ fn integer_less_than_comparison_with_lhs_dynamic_integer_and_rhs_dynamic_integer &program, readout_callable_id, &expect![[r#" - Callable: - name: __quantum__qis__read_result__body - call_type: Readout - input_type: - [0]: Result - output_type: Boolean - body: "#]], + Callable: + name: __quantum__rt__read_result + call_type: Readout + input_type: + [0]: Result + output_type: Boolean + body: "#]], ); let output_record_id = CallableId(3); assert_callable( @@ -3196,13 +3196,13 @@ fn integer_less_or_equal_than_comparison_with_lhs_classical_integer_and_rhs_dyna &program, readout_callable_id, &expect![[r#" - Callable: - name: __quantum__qis__read_result__body - call_type: Readout - input_type: - [0]: Result - output_type: Boolean - body: "#]], + Callable: + name: __quantum__rt__read_result + call_type: Readout + input_type: + [0]: Result + output_type: Boolean + body: "#]], ); let output_record_id = CallableId(3); assert_callable( @@ -3273,13 +3273,13 @@ fn leading_positive_unary_operator_on_double_does_not_generate_rir_instruction() &program, readout_callable_id, &expect![[r#" - Callable: - name: __quantum__qis__read_result__body - call_type: Readout - input_type: - [0]: Result - output_type: Boolean - body: "#]], + Callable: + name: __quantum__rt__read_result + call_type: Readout + input_type: + [0]: Result + output_type: Boolean + body: "#]], ); let output_recording_callable_id = CallableId(3); assert_callable( @@ -3349,13 +3349,13 @@ fn leading_negative_unary_operator_on_double_generates_rir_instruction() { &program, readout_callable_id, &expect![[r#" - Callable: - name: __quantum__qis__read_result__body - call_type: Readout - input_type: - [0]: Result - output_type: Boolean - body: "#]], + Callable: + name: __quantum__rt__read_result + call_type: Readout + input_type: + [0]: Result + output_type: Boolean + body: "#]], ); let output_recording_callable_id = CallableId(3); assert_callable( @@ -3428,13 +3428,13 @@ fn double_add_with_lhs_classical_double_and_rhs_dynamic_double() { &program, readout_callable_id, &expect![[r#" - Callable: - name: __quantum__qis__read_result__body - call_type: Readout - input_type: - [0]: Result - output_type: Boolean - body: "#]], + Callable: + name: __quantum__rt__read_result + call_type: Readout + input_type: + [0]: Result + output_type: Boolean + body: "#]], ); let output_record_id = CallableId(3); assert_callable( @@ -3507,13 +3507,13 @@ fn double_sub_with_lhs_dynamic_double_and_rhs_classical_double() { &program, readout_callable_id, &expect![[r#" - Callable: - name: __quantum__qis__read_result__body - call_type: Readout - input_type: - [0]: Result - output_type: Boolean - body: "#]], + Callable: + name: __quantum__rt__read_result + call_type: Readout + input_type: + [0]: Result + output_type: Boolean + body: "#]], ); let output_record_id = CallableId(3); assert_callable( @@ -3587,13 +3587,13 @@ fn double_mul_with_lhs_dynamic_double_and_rhs_dynamic_double() { &program, readout_callable_id, &expect![[r#" - Callable: - name: __quantum__qis__read_result__body - call_type: Readout - input_type: - [0]: Result - output_type: Boolean - body: "#]], + Callable: + name: __quantum__rt__read_result + call_type: Readout + input_type: + [0]: Result + output_type: Boolean + body: "#]], ); let output_record_id = CallableId(3); assert_callable( @@ -3678,13 +3678,13 @@ fn double_div_with_lhs_classical_double_and_rhs_dynamic_double() { &program, readout_callable_id, &expect![[r#" - Callable: - name: __quantum__qis__read_result__body - call_type: Readout - input_type: - [0]: Result - output_type: Boolean - body: "#]], + Callable: + name: __quantum__rt__read_result + call_type: Readout + input_type: + [0]: Result + output_type: Boolean + body: "#]], ); let output_record_id = CallableId(3); assert_callable( @@ -3779,13 +3779,13 @@ fn double_equality_comparison_with_lhs_dynamic_double_and_rhs_classical_double() &program, readout_callable_id, &expect![[r#" - Callable: - name: __quantum__qis__read_result__body - call_type: Readout - input_type: - [0]: Result - output_type: Boolean - body: "#]], + Callable: + name: __quantum__rt__read_result + call_type: Readout + input_type: + [0]: Result + output_type: Boolean + body: "#]], ); let output_record_id = CallableId(3); assert_callable( @@ -3859,13 +3859,13 @@ fn double_inequality_comparison_with_lhs_dynamic_double_and_rhs_dynamic_double() &program, readout_callable_id, &expect![[r#" - Callable: - name: __quantum__qis__read_result__body - call_type: Readout - input_type: - [0]: Result - output_type: Boolean - body: "#]], + Callable: + name: __quantum__rt__read_result + call_type: Readout + input_type: + [0]: Result + output_type: Boolean + body: "#]], ); let output_record_id = CallableId(3); assert_callable( @@ -3950,13 +3950,13 @@ fn double_greater_than_comparison_with_lhs_classical_double_and_rhs_dynamic_doub &program, readout_callable_id, &expect![[r#" - Callable: - name: __quantum__qis__read_result__body - call_type: Readout - input_type: - [0]: Result - output_type: Boolean - body: "#]], + Callable: + name: __quantum__rt__read_result + call_type: Readout + input_type: + [0]: Result + output_type: Boolean + body: "#]], ); let output_record_id = CallableId(3); assert_callable( @@ -4029,13 +4029,13 @@ fn double_greater_or_equal_than_comparison_with_lhs_dynamic_double_and_rhs_class &program, readout_callable_id, &expect![[r#" - Callable: - name: __quantum__qis__read_result__body - call_type: Readout - input_type: - [0]: Result - output_type: Boolean - body: "#]], + Callable: + name: __quantum__rt__read_result + call_type: Readout + input_type: + [0]: Result + output_type: Boolean + body: "#]], ); let output_record_id = CallableId(3); assert_callable( @@ -4109,13 +4109,13 @@ fn double_less_than_comparison_with_lhs_dynamic_double_and_rhs_dynamic_double() &program, readout_callable_id, &expect![[r#" - Callable: - name: __quantum__qis__read_result__body - call_type: Readout - input_type: - [0]: Result - output_type: Boolean - body: "#]], + Callable: + name: __quantum__rt__read_result + call_type: Readout + input_type: + [0]: Result + output_type: Boolean + body: "#]], ); let output_record_id = CallableId(3); assert_callable( @@ -4200,13 +4200,13 @@ fn double_less_or_equal_than_comparison_with_lhs_classical_double_and_rhs_dynami &program, readout_callable_id, &expect![[r#" - Callable: - name: __quantum__qis__read_result__body - call_type: Readout - input_type: - [0]: Result - output_type: Boolean - body: "#]], + Callable: + name: __quantum__rt__read_result + call_type: Readout + input_type: + [0]: Result + output_type: Boolean + body: "#]], ); let output_record_id = CallableId(3); assert_callable( diff --git a/source/compiler/qsc_partial_eval/src/tests/output_recording.rs b/source/compiler/qsc_partial_eval/src/tests/output_recording.rs index 3999dada91..38972d1cf1 100644 --- a/source/compiler/qsc_partial_eval/src/tests/output_recording.rs +++ b/source/compiler/qsc_partial_eval/src/tests/output_recording.rs @@ -39,7 +39,7 @@ fn output_recording_for_tuple_of_different_types() { output_type: body: Callable 2: Callable: - name: __quantum__qis__read_result__body + name: __quantum__rt__read_result call_type: Readout input_type: [0]: Result @@ -123,7 +123,7 @@ fn output_recording_for_nested_tuples() { output_type: body: Callable 2: Callable: - name: __quantum__qis__read_result__body + name: __quantum__rt__read_result call_type: Readout input_type: [0]: Result @@ -217,7 +217,7 @@ fn output_recording_for_tuple_of_arrays() { output_type: body: Callable 2: Callable: - name: __quantum__qis__read_result__body + name: __quantum__rt__read_result call_type: Readout input_type: [0]: Result @@ -314,7 +314,7 @@ fn output_recording_for_array_of_tuples() { output_type: body: Callable 2: Callable: - name: __quantum__qis__read_result__body + name: __quantum__rt__read_result call_type: Readout input_type: [0]: Result diff --git a/source/compiler/qsc_partial_eval/src/tests/returns.rs b/source/compiler/qsc_partial_eval/src/tests/returns.rs index 4b22abd8b7..0230664854 100644 --- a/source/compiler/qsc_partial_eval/src/tests/returns.rs +++ b/source/compiler/qsc_partial_eval/src/tests/returns.rs @@ -436,13 +436,13 @@ fn non_classical_entry_point_with_early_return_after_branching_halts_evaluation( &program, read_result_callable_id, &expect![[r#" - Callable: - name: __quantum__qis__read_result__body - call_type: Readout - input_type: - [0]: Result - output_type: Boolean - body: "#]], + Callable: + name: __quantum__rt__read_result + call_type: Readout + input_type: + [0]: Result + output_type: Boolean + body: "#]], ); let op_a_callable_id = CallableId(3); assert_callable( @@ -561,13 +561,13 @@ fn operation_with_early_return_within_dynamic_branch_halts_evaluation_at_the_cal &program, read_result_callable_id, &expect![[r#" - Callable: - name: __quantum__qis__read_result__body - call_type: Readout - input_type: - [0]: Result - output_type: Boolean - body: "#]], + Callable: + name: __quantum__rt__read_result + call_type: Readout + input_type: + [0]: Result + output_type: Boolean + body: "#]], ); let op_a_callable_id = CallableId(3); assert_callable( diff --git a/source/compiler/qsc_rir/src/builder.rs b/source/compiler/qsc_rir/src/builder.rs index 5a0dbe88f1..c321dcedd5 100644 --- a/source/compiler/qsc_rir/src/builder.rs +++ b/source/compiler/qsc_rir/src/builder.rs @@ -99,7 +99,7 @@ pub fn reset_decl() -> Callable { #[must_use] pub fn read_result_decl() -> Callable { Callable { - name: "__quantum__qis__read_result__body".to_string(), + name: "__quantum__rt__read_result".to_string(), input_type: vec![Ty::Result], output_type: Some(Ty::Boolean), body: None, diff --git a/source/compiler/qsc_rir/src/passes/reindex_qubits/tests.rs b/source/compiler/qsc_rir/src/passes/reindex_qubits/tests.rs index 5737b5d156..0445b249e9 100644 --- a/source/compiler/qsc_rir/src/passes/reindex_qubits/tests.rs +++ b/source/compiler/qsc_rir/src/passes/reindex_qubits/tests.rs @@ -414,7 +414,7 @@ fn qubit_reindexed_across_branches() { output_type: body: Callable 2: Callable: - name: __quantum__qis__read_result__body + name: __quantum__rt__read_result call_type: Readout input_type: [0]: Result diff --git a/source/pip/tests-integration/resources/adaptive_ri/output/ArithmeticOps.ll b/source/pip/tests-integration/resources/adaptive_ri/output/ArithmeticOps.ll index c0724e166f..ce1f2ce747 100644 --- a/source/pip/tests-integration/resources/adaptive_ri/output/ArithmeticOps.ll +++ b/source/pip/tests-integration/resources/adaptive_ri/output/ArithmeticOps.ll @@ -19,7 +19,7 @@ block_0: call void @__quantum__qis__m__body(%Qubit* inttoptr (i64 2 to %Qubit*), %Result* inttoptr (i64 2 to %Result*)) call void @__quantum__qis__m__body(%Qubit* inttoptr (i64 3 to %Qubit*), %Result* inttoptr (i64 3 to %Result*)) call void @__quantum__qis__m__body(%Qubit* inttoptr (i64 4 to %Qubit*), %Result* inttoptr (i64 4 to %Result*)) - %var_8 = call i1 @__quantum__qis__read_result__body(%Result* inttoptr (i64 0 to %Result*)) + %var_8 = call i1 @__quantum__rt__read_result(%Result* inttoptr (i64 0 to %Result*)) br i1 %var_8, label %block_1, label %block_2 block_1: br label %block_2 @@ -28,7 +28,7 @@ block_2: %var_38 = phi i64 [10, %block_0], [8, %block_1] %var_37 = phi i64 [0, %block_0], [5, %block_1] %var_36 = phi i64 [0, %block_0], [1, %block_1] - %var_10 = call i1 @__quantum__qis__read_result__body(%Result* inttoptr (i64 1 to %Result*)) + %var_10 = call i1 @__quantum__rt__read_result(%Result* inttoptr (i64 1 to %Result*)) br i1 %var_10, label %block_3, label %block_4 block_3: %var_12 = add i64 %var_36, 1 @@ -41,7 +41,7 @@ block_4: %var_42 = phi i64 [%var_38, %block_2], [%var_14, %block_3] %var_41 = phi i64 [%var_37, %block_2], [%var_13, %block_3] %var_40 = phi i64 [%var_36, %block_2], [%var_12, %block_3] - %var_16 = call i1 @__quantum__qis__read_result__body(%Result* inttoptr (i64 2 to %Result*)) + %var_16 = call i1 @__quantum__rt__read_result(%Result* inttoptr (i64 2 to %Result*)) br i1 %var_16, label %block_5, label %block_6 block_5: %var_18 = add i64 %var_40, 1 @@ -54,7 +54,7 @@ block_6: %var_46 = phi i64 [%var_42, %block_4], [%var_20, %block_5] %var_45 = phi i64 [%var_41, %block_4], [%var_19, %block_5] %var_44 = phi i64 [%var_40, %block_4], [%var_18, %block_5] - %var_22 = call i1 @__quantum__qis__read_result__body(%Result* inttoptr (i64 3 to %Result*)) + %var_22 = call i1 @__quantum__rt__read_result(%Result* inttoptr (i64 3 to %Result*)) br i1 %var_22, label %block_7, label %block_8 block_7: %var_24 = add i64 %var_44, 1 @@ -67,7 +67,7 @@ block_8: %var_50 = phi i64 [%var_46, %block_6], [%var_26, %block_7] %var_49 = phi i64 [%var_45, %block_6], [%var_25, %block_7] %var_48 = phi i64 [%var_44, %block_6], [%var_24, %block_7] - %var_28 = call i1 @__quantum__qis__read_result__body(%Result* inttoptr (i64 4 to %Result*)) + %var_28 = call i1 @__quantum__rt__read_result(%Result* inttoptr (i64 4 to %Result*)) br i1 %var_28, label %block_9, label %block_10 block_9: %var_30 = add i64 %var_48, 1 @@ -97,7 +97,7 @@ declare void @__quantum__qis__x__body(%Qubit*) declare void @__quantum__qis__m__body(%Qubit*, %Result*) #1 -declare i1 @__quantum__qis__read_result__body(%Result*) +declare i1 @__quantum__rt__read_result(%Result*) declare void @__quantum__qis__reset__body(%Qubit*) #1 diff --git a/source/pip/tests-integration/resources/adaptive_ri/output/IntegerComparison.ll b/source/pip/tests-integration/resources/adaptive_ri/output/IntegerComparison.ll index 90486108fa..5cec7c1928 100644 --- a/source/pip/tests-integration/resources/adaptive_ri/output/IntegerComparison.ll +++ b/source/pip/tests-integration/resources/adaptive_ri/output/IntegerComparison.ll @@ -10,7 +10,7 @@ define i64 @ENTRYPOINT__main() #0 { block_0: call void @__quantum__qis__x__body(%Qubit* inttoptr (i64 0 to %Qubit*)) call void @__quantum__qis__m__body(%Qubit* inttoptr (i64 0 to %Qubit*), %Result* inttoptr (i64 0 to %Result*)) - %var_2 = call i1 @__quantum__qis__read_result__body(%Result* inttoptr (i64 0 to %Result*)) + %var_2 = call i1 @__quantum__rt__read_result(%Result* inttoptr (i64 0 to %Result*)) br i1 %var_2, label %block_1, label %block_2 block_1: call void @__quantum__qis__x__body(%Qubit* inttoptr (i64 0 to %Qubit*)) @@ -19,7 +19,7 @@ block_2: %var_34 = phi i64 [0, %block_0], [1, %block_1] call void @__quantum__qis__x__body(%Qubit* inttoptr (i64 0 to %Qubit*)) call void @__quantum__qis__m__body(%Qubit* inttoptr (i64 0 to %Qubit*), %Result* inttoptr (i64 1 to %Result*)) - %var_4 = call i1 @__quantum__qis__read_result__body(%Result* inttoptr (i64 1 to %Result*)) + %var_4 = call i1 @__quantum__rt__read_result(%Result* inttoptr (i64 1 to %Result*)) br i1 %var_4, label %block_3, label %block_4 block_3: call void @__quantum__qis__x__body(%Qubit* inttoptr (i64 0 to %Qubit*)) @@ -29,7 +29,7 @@ block_4: %var_35 = phi i64 [%var_34, %block_2], [%var_6, %block_3] call void @__quantum__qis__x__body(%Qubit* inttoptr (i64 0 to %Qubit*)) call void @__quantum__qis__m__body(%Qubit* inttoptr (i64 0 to %Qubit*), %Result* inttoptr (i64 2 to %Result*)) - %var_7 = call i1 @__quantum__qis__read_result__body(%Result* inttoptr (i64 2 to %Result*)) + %var_7 = call i1 @__quantum__rt__read_result(%Result* inttoptr (i64 2 to %Result*)) br i1 %var_7, label %block_5, label %block_6 block_5: call void @__quantum__qis__x__body(%Qubit* inttoptr (i64 0 to %Qubit*)) @@ -39,7 +39,7 @@ block_6: %var_36 = phi i64 [%var_35, %block_4], [%var_9, %block_5] call void @__quantum__qis__x__body(%Qubit* inttoptr (i64 0 to %Qubit*)) call void @__quantum__qis__m__body(%Qubit* inttoptr (i64 0 to %Qubit*), %Result* inttoptr (i64 3 to %Result*)) - %var_10 = call i1 @__quantum__qis__read_result__body(%Result* inttoptr (i64 3 to %Result*)) + %var_10 = call i1 @__quantum__rt__read_result(%Result* inttoptr (i64 3 to %Result*)) br i1 %var_10, label %block_7, label %block_8 block_7: call void @__quantum__qis__x__body(%Qubit* inttoptr (i64 0 to %Qubit*)) @@ -49,7 +49,7 @@ block_8: %var_37 = phi i64 [%var_36, %block_6], [%var_12, %block_7] call void @__quantum__qis__x__body(%Qubit* inttoptr (i64 0 to %Qubit*)) call void @__quantum__qis__m__body(%Qubit* inttoptr (i64 0 to %Qubit*), %Result* inttoptr (i64 4 to %Result*)) - %var_13 = call i1 @__quantum__qis__read_result__body(%Result* inttoptr (i64 4 to %Result*)) + %var_13 = call i1 @__quantum__rt__read_result(%Result* inttoptr (i64 4 to %Result*)) br i1 %var_13, label %block_9, label %block_10 block_9: call void @__quantum__qis__x__body(%Qubit* inttoptr (i64 0 to %Qubit*)) @@ -59,7 +59,7 @@ block_10: %var_38 = phi i64 [%var_37, %block_8], [%var_15, %block_9] call void @__quantum__qis__x__body(%Qubit* inttoptr (i64 0 to %Qubit*)) call void @__quantum__qis__m__body(%Qubit* inttoptr (i64 0 to %Qubit*), %Result* inttoptr (i64 5 to %Result*)) - %var_16 = call i1 @__quantum__qis__read_result__body(%Result* inttoptr (i64 5 to %Result*)) + %var_16 = call i1 @__quantum__rt__read_result(%Result* inttoptr (i64 5 to %Result*)) br i1 %var_16, label %block_11, label %block_12 block_11: call void @__quantum__qis__x__body(%Qubit* inttoptr (i64 0 to %Qubit*)) @@ -69,7 +69,7 @@ block_12: %var_39 = phi i64 [%var_38, %block_10], [%var_18, %block_11] call void @__quantum__qis__x__body(%Qubit* inttoptr (i64 0 to %Qubit*)) call void @__quantum__qis__m__body(%Qubit* inttoptr (i64 0 to %Qubit*), %Result* inttoptr (i64 6 to %Result*)) - %var_19 = call i1 @__quantum__qis__read_result__body(%Result* inttoptr (i64 6 to %Result*)) + %var_19 = call i1 @__quantum__rt__read_result(%Result* inttoptr (i64 6 to %Result*)) br i1 %var_19, label %block_13, label %block_14 block_13: call void @__quantum__qis__x__body(%Qubit* inttoptr (i64 0 to %Qubit*)) @@ -79,7 +79,7 @@ block_14: %var_40 = phi i64 [%var_39, %block_12], [%var_21, %block_13] call void @__quantum__qis__x__body(%Qubit* inttoptr (i64 0 to %Qubit*)) call void @__quantum__qis__m__body(%Qubit* inttoptr (i64 0 to %Qubit*), %Result* inttoptr (i64 7 to %Result*)) - %var_22 = call i1 @__quantum__qis__read_result__body(%Result* inttoptr (i64 7 to %Result*)) + %var_22 = call i1 @__quantum__rt__read_result(%Result* inttoptr (i64 7 to %Result*)) br i1 %var_22, label %block_15, label %block_16 block_15: call void @__quantum__qis__x__body(%Qubit* inttoptr (i64 0 to %Qubit*)) @@ -89,7 +89,7 @@ block_16: %var_41 = phi i64 [%var_40, %block_14], [%var_24, %block_15] call void @__quantum__qis__x__body(%Qubit* inttoptr (i64 0 to %Qubit*)) call void @__quantum__qis__m__body(%Qubit* inttoptr (i64 0 to %Qubit*), %Result* inttoptr (i64 8 to %Result*)) - %var_25 = call i1 @__quantum__qis__read_result__body(%Result* inttoptr (i64 8 to %Result*)) + %var_25 = call i1 @__quantum__rt__read_result(%Result* inttoptr (i64 8 to %Result*)) br i1 %var_25, label %block_17, label %block_18 block_17: call void @__quantum__qis__x__body(%Qubit* inttoptr (i64 0 to %Qubit*)) @@ -99,7 +99,7 @@ block_18: %var_42 = phi i64 [%var_41, %block_16], [%var_27, %block_17] call void @__quantum__qis__x__body(%Qubit* inttoptr (i64 0 to %Qubit*)) call void @__quantum__qis__m__body(%Qubit* inttoptr (i64 0 to %Qubit*), %Result* inttoptr (i64 9 to %Result*)) - %var_28 = call i1 @__quantum__qis__read_result__body(%Result* inttoptr (i64 9 to %Result*)) + %var_28 = call i1 @__quantum__rt__read_result(%Result* inttoptr (i64 9 to %Result*)) br i1 %var_28, label %block_19, label %block_20 block_19: call void @__quantum__qis__x__body(%Qubit* inttoptr (i64 0 to %Qubit*)) @@ -122,7 +122,7 @@ declare void @__quantum__qis__x__body(%Qubit*) declare void @__quantum__qis__m__body(%Qubit*, %Result*) #1 -declare i1 @__quantum__qis__read_result__body(%Result*) +declare i1 @__quantum__rt__read_result(%Result*) declare void @__quantum__qis__reset__body(%Qubit*) #1 diff --git a/source/pip/tests-integration/resources/adaptive_ri/output/MeasurementComparison.ll b/source/pip/tests-integration/resources/adaptive_ri/output/MeasurementComparison.ll index 99279d2bff..8b5b022e9a 100644 --- a/source/pip/tests-integration/resources/adaptive_ri/output/MeasurementComparison.ll +++ b/source/pip/tests-integration/resources/adaptive_ri/output/MeasurementComparison.ll @@ -15,13 +15,13 @@ block_0: call void @__quantum__qis__m__body(%Qubit* inttoptr (i64 1 to %Qubit*), %Result* inttoptr (i64 1 to %Result*)) call void @__quantum__qis__reset__body(%Qubit* inttoptr (i64 0 to %Qubit*)) call void @__quantum__qis__reset__body(%Qubit* inttoptr (i64 1 to %Qubit*)) - %var_0 = call i1 @__quantum__qis__read_result__body(%Result* inttoptr (i64 0 to %Result*)) - %var_2 = call i1 @__quantum__qis__read_result__body(%Result* inttoptr (i64 1 to %Result*)) + %var_0 = call i1 @__quantum__rt__read_result(%Result* inttoptr (i64 0 to %Result*)) + %var_2 = call i1 @__quantum__rt__read_result(%Result* inttoptr (i64 1 to %Result*)) %var_3 = icmp eq i1 %var_2, false - %var_4 = call i1 @__quantum__qis__read_result__body(%Result* inttoptr (i64 0 to %Result*)) - %var_5 = call i1 @__quantum__qis__read_result__body(%Result* inttoptr (i64 1 to %Result*)) + %var_4 = call i1 @__quantum__rt__read_result(%Result* inttoptr (i64 0 to %Result*)) + %var_5 = call i1 @__quantum__rt__read_result(%Result* inttoptr (i64 1 to %Result*)) %var_6 = icmp eq i1 %var_4, %var_5 - %var_7 = call i1 @__quantum__qis__read_result__body(%Result* inttoptr (i64 0 to %Result*)) + %var_7 = call i1 @__quantum__rt__read_result(%Result* inttoptr (i64 0 to %Result*)) %var_8 = icmp eq i1 %var_7, false br i1 %var_8, label %block_1, label %block_2 block_1: @@ -46,7 +46,7 @@ declare void @__quantum__qis__m__body(%Qubit*, %Result*) #1 declare void @__quantum__qis__reset__body(%Qubit*) #1 -declare i1 @__quantum__qis__read_result__body(%Result*) +declare i1 @__quantum__rt__read_result(%Result*) declare void @__quantum__rt__tuple_record_output(i64, i8*) diff --git a/source/pip/tests-integration/resources/adaptive_ri/output/NestedBranching.ll b/source/pip/tests-integration/resources/adaptive_ri/output/NestedBranching.ll index c474547d2a..92f11cc15e 100644 --- a/source/pip/tests-integration/resources/adaptive_ri/output/NestedBranching.ll +++ b/source/pip/tests-integration/resources/adaptive_ri/output/NestedBranching.ll @@ -19,23 +19,23 @@ block_0: call void @__quantum__qis__m__body(%Qubit* inttoptr (i64 0 to %Qubit*), %Result* inttoptr (i64 0 to %Result*)) call void @__quantum__qis__m__body(%Qubit* inttoptr (i64 1 to %Qubit*), %Result* inttoptr (i64 1 to %Result*)) call void @__quantum__qis__m__body(%Qubit* inttoptr (i64 2 to %Qubit*), %Result* inttoptr (i64 2 to %Result*)) - %var_3 = call i1 @__quantum__qis__read_result__body(%Result* inttoptr (i64 0 to %Result*)) + %var_3 = call i1 @__quantum__rt__read_result(%Result* inttoptr (i64 0 to %Result*)) %var_4 = icmp eq i1 %var_3, false br i1 %var_4, label %block_1, label %block_2 block_1: - %var_5 = call i1 @__quantum__qis__read_result__body(%Result* inttoptr (i64 1 to %Result*)) + %var_5 = call i1 @__quantum__rt__read_result(%Result* inttoptr (i64 1 to %Result*)) %var_6 = icmp eq i1 %var_5, false br i1 %var_6, label %block_3, label %block_5 block_2: - %var_20 = call i1 @__quantum__qis__read_result__body(%Result* inttoptr (i64 1 to %Result*)) + %var_20 = call i1 @__quantum__rt__read_result(%Result* inttoptr (i64 1 to %Result*)) %var_21 = icmp eq i1 %var_20, false br i1 %var_21, label %block_4, label %block_6 block_3: - %var_8 = call i1 @__quantum__qis__read_result__body(%Result* inttoptr (i64 2 to %Result*)) + %var_8 = call i1 @__quantum__rt__read_result(%Result* inttoptr (i64 2 to %Result*)) %var_9 = icmp eq i1 %var_8, false br label %block_5 block_4: - %var_23 = call i1 @__quantum__qis__read_result__body(%Result* inttoptr (i64 2 to %Result*)) + %var_23 = call i1 @__quantum__rt__read_result(%Result* inttoptr (i64 2 to %Result*)) %var_24 = icmp eq i1 %var_23, false br label %block_6 block_5: @@ -47,20 +47,20 @@ block_6: block_7: br label %block_31 block_8: - %var_10 = call i1 @__quantum__qis__read_result__body(%Result* inttoptr (i64 1 to %Result*)) + %var_10 = call i1 @__quantum__rt__read_result(%Result* inttoptr (i64 1 to %Result*)) %var_11 = icmp eq i1 %var_10, false br i1 %var_11, label %block_11, label %block_13 block_9: br label %block_32 block_10: - %var_25 = call i1 @__quantum__qis__read_result__body(%Result* inttoptr (i64 1 to %Result*)) + %var_25 = call i1 @__quantum__rt__read_result(%Result* inttoptr (i64 1 to %Result*)) %var_26 = icmp eq i1 %var_25, false br i1 %var_26, label %block_12, label %block_14 block_11: - %var_13 = call i1 @__quantum__qis__read_result__body(%Result* inttoptr (i64 2 to %Result*)) + %var_13 = call i1 @__quantum__rt__read_result(%Result* inttoptr (i64 2 to %Result*)) br label %block_13 block_12: - %var_28 = call i1 @__quantum__qis__read_result__body(%Result* inttoptr (i64 2 to %Result*)) + %var_28 = call i1 @__quantum__rt__read_result(%Result* inttoptr (i64 2 to %Result*)) br label %block_14 block_13: %var_83 = phi i1 [false, %block_8], [%var_13, %block_11] @@ -71,19 +71,19 @@ block_14: block_15: br label %block_29 block_16: - %var_15 = call i1 @__quantum__qis__read_result__body(%Result* inttoptr (i64 1 to %Result*)) + %var_15 = call i1 @__quantum__rt__read_result(%Result* inttoptr (i64 1 to %Result*)) br i1 %var_15, label %block_19, label %block_21 block_17: br label %block_30 block_18: - %var_30 = call i1 @__quantum__qis__read_result__body(%Result* inttoptr (i64 1 to %Result*)) + %var_30 = call i1 @__quantum__rt__read_result(%Result* inttoptr (i64 1 to %Result*)) br i1 %var_30, label %block_20, label %block_22 block_19: - %var_18 = call i1 @__quantum__qis__read_result__body(%Result* inttoptr (i64 2 to %Result*)) + %var_18 = call i1 @__quantum__rt__read_result(%Result* inttoptr (i64 2 to %Result*)) %var_19 = icmp eq i1 %var_18, false br label %block_21 block_20: - %var_33 = call i1 @__quantum__qis__read_result__body(%Result* inttoptr (i64 2 to %Result*)) + %var_33 = call i1 @__quantum__rt__read_result(%Result* inttoptr (i64 2 to %Result*)) %var_34 = icmp eq i1 %var_33, false br label %block_22 block_21: @@ -131,27 +131,27 @@ block_33: call void @__quantum__qis__m__body(%Qubit* inttoptr (i64 4 to %Qubit*), %Result* inttoptr (i64 4 to %Result*)) call void @__quantum__qis__m__body(%Qubit* inttoptr (i64 5 to %Qubit*), %Result* inttoptr (i64 5 to %Result*)) call void @__quantum__qis__m__body(%Qubit* inttoptr (i64 6 to %Qubit*), %Result* inttoptr (i64 6 to %Result*)) - %var_40 = call i1 @__quantum__qis__read_result__body(%Result* inttoptr (i64 3 to %Result*)) + %var_40 = call i1 @__quantum__rt__read_result(%Result* inttoptr (i64 3 to %Result*)) %var_41 = icmp eq i1 %var_40, false br i1 %var_41, label %block_34, label %block_35 block_34: - %var_42 = call i1 @__quantum__qis__read_result__body(%Result* inttoptr (i64 4 to %Result*)) + %var_42 = call i1 @__quantum__rt__read_result(%Result* inttoptr (i64 4 to %Result*)) %var_43 = icmp eq i1 %var_42, false br i1 %var_43, label %block_36, label %block_37 block_35: - %var_48 = call i1 @__quantum__qis__read_result__body(%Result* inttoptr (i64 3 to %Result*)) + %var_48 = call i1 @__quantum__rt__read_result(%Result* inttoptr (i64 3 to %Result*)) %var_49 = icmp eq i1 %var_48, false br i1 %var_49, label %block_38, label %block_43 block_36: - %var_44 = call i1 @__quantum__qis__read_result__body(%Result* inttoptr (i64 5 to %Result*)) + %var_44 = call i1 @__quantum__rt__read_result(%Result* inttoptr (i64 5 to %Result*)) %var_45 = icmp eq i1 %var_44, false br i1 %var_45, label %block_39, label %block_40 block_37: - %var_46 = call i1 @__quantum__qis__read_result__body(%Result* inttoptr (i64 5 to %Result*)) + %var_46 = call i1 @__quantum__rt__read_result(%Result* inttoptr (i64 5 to %Result*)) %var_47 = icmp eq i1 %var_46, false br i1 %var_47, label %block_41, label %block_42 block_38: - %var_51 = call i1 @__quantum__qis__read_result__body(%Result* inttoptr (i64 4 to %Result*)) + %var_51 = call i1 @__quantum__rt__read_result(%Result* inttoptr (i64 4 to %Result*)) br label %block_43 block_39: br label %block_44 @@ -175,24 +175,24 @@ block_44: block_45: br label %block_48 block_46: - %var_53 = call i1 @__quantum__qis__read_result__body(%Result* inttoptr (i64 4 to %Result*)) + %var_53 = call i1 @__quantum__rt__read_result(%Result* inttoptr (i64 4 to %Result*)) %var_54 = icmp eq i1 %var_53, false br i1 %var_54, label %block_49, label %block_50 block_47: - %var_59 = call i1 @__quantum__qis__read_result__body(%Result* inttoptr (i64 3 to %Result*)) + %var_59 = call i1 @__quantum__rt__read_result(%Result* inttoptr (i64 3 to %Result*)) br i1 %var_59, label %block_51, label %block_56 block_48: br label %block_82 block_49: - %var_55 = call i1 @__quantum__qis__read_result__body(%Result* inttoptr (i64 5 to %Result*)) + %var_55 = call i1 @__quantum__rt__read_result(%Result* inttoptr (i64 5 to %Result*)) %var_56 = icmp eq i1 %var_55, false br i1 %var_56, label %block_52, label %block_53 block_50: - %var_57 = call i1 @__quantum__qis__read_result__body(%Result* inttoptr (i64 5 to %Result*)) + %var_57 = call i1 @__quantum__rt__read_result(%Result* inttoptr (i64 5 to %Result*)) %var_58 = icmp eq i1 %var_57, false br i1 %var_58, label %block_54, label %block_55 block_51: - %var_62 = call i1 @__quantum__qis__read_result__body(%Result* inttoptr (i64 4 to %Result*)) + %var_62 = call i1 @__quantum__rt__read_result(%Result* inttoptr (i64 4 to %Result*)) %var_63 = icmp eq i1 %var_62, false br label %block_56 block_52: @@ -217,29 +217,29 @@ block_57: block_58: br label %block_61 block_59: - %var_64 = call i1 @__quantum__qis__read_result__body(%Result* inttoptr (i64 4 to %Result*)) + %var_64 = call i1 @__quantum__rt__read_result(%Result* inttoptr (i64 4 to %Result*)) %var_65 = icmp eq i1 %var_64, false br i1 %var_65, label %block_62, label %block_63 block_60: - %var_70 = call i1 @__quantum__qis__read_result__body(%Result* inttoptr (i64 4 to %Result*)) + %var_70 = call i1 @__quantum__rt__read_result(%Result* inttoptr (i64 4 to %Result*)) %var_71 = icmp eq i1 %var_70, false br i1 %var_71, label %block_64, label %block_65 block_61: br label %block_81 block_62: - %var_66 = call i1 @__quantum__qis__read_result__body(%Result* inttoptr (i64 5 to %Result*)) + %var_66 = call i1 @__quantum__rt__read_result(%Result* inttoptr (i64 5 to %Result*)) %var_67 = icmp eq i1 %var_66, false br i1 %var_67, label %block_66, label %block_67 block_63: - %var_68 = call i1 @__quantum__qis__read_result__body(%Result* inttoptr (i64 5 to %Result*)) + %var_68 = call i1 @__quantum__rt__read_result(%Result* inttoptr (i64 5 to %Result*)) %var_69 = icmp eq i1 %var_68, false br i1 %var_69, label %block_68, label %block_69 block_64: - %var_72 = call i1 @__quantum__qis__read_result__body(%Result* inttoptr (i64 5 to %Result*)) + %var_72 = call i1 @__quantum__rt__read_result(%Result* inttoptr (i64 5 to %Result*)) %var_73 = icmp eq i1 %var_72, false br i1 %var_73, label %block_70, label %block_71 block_65: - %var_74 = call i1 @__quantum__qis__read_result__body(%Result* inttoptr (i64 5 to %Result*)) + %var_74 = call i1 @__quantum__rt__read_result(%Result* inttoptr (i64 5 to %Result*)) %var_75 = icmp eq i1 %var_74, false br i1 %var_75, label %block_72, label %block_73 block_66: @@ -292,7 +292,7 @@ block_82: call void @__quantum__qis__reset__body(%Qubit* inttoptr (i64 5 to %Qubit*)) call void @__quantum__qis__reset__body(%Qubit* inttoptr (i64 6 to %Qubit*)) call void @__quantum__qis__mresetz__body(%Qubit* inttoptr (i64 7 to %Qubit*), %Result* inttoptr (i64 7 to %Result*)) - %var_77 = call i1 @__quantum__qis__read_result__body(%Result* inttoptr (i64 7 to %Result*)) + %var_77 = call i1 @__quantum__rt__read_result(%Result* inttoptr (i64 7 to %Result*)) call void @__quantum__rt__tuple_record_output(i64 2, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @empty_tag, i64 0, i64 0)) call void @__quantum__rt__tuple_record_output(i64 2, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @empty_tag, i64 0, i64 0)) call void @__quantum__rt__array_record_output(i64 3, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @empty_tag, i64 0, i64 0)) @@ -314,7 +314,7 @@ declare void @__quantum__qis__x__body(%Qubit*) declare void @__quantum__qis__m__body(%Qubit*, %Result*) #1 -declare i1 @__quantum__qis__read_result__body(%Result*) +declare i1 @__quantum__rt__read_result(%Result*) declare void @__quantum__qis__reset__body(%Qubit*) #1 diff --git a/source/pip/tests-integration/resources/adaptive_ri/output/SampleTeleport.ll b/source/pip/tests-integration/resources/adaptive_ri/output/SampleTeleport.ll index 88f3e630ff..606995a27e 100644 --- a/source/pip/tests-integration/resources/adaptive_ri/output/SampleTeleport.ll +++ b/source/pip/tests-integration/resources/adaptive_ri/output/SampleTeleport.ll @@ -13,14 +13,14 @@ block_0: call void @__quantum__qis__cx__body(%Qubit* inttoptr (i64 2 to %Qubit*), %Qubit* inttoptr (i64 0 to %Qubit*)) call void @__quantum__qis__h__body(%Qubit* inttoptr (i64 2 to %Qubit*)) call void @__quantum__qis__m__body(%Qubit* inttoptr (i64 0 to %Qubit*), %Result* inttoptr (i64 0 to %Result*)) - %var_1 = call i1 @__quantum__qis__read_result__body(%Result* inttoptr (i64 0 to %Result*)) + %var_1 = call i1 @__quantum__rt__read_result(%Result* inttoptr (i64 0 to %Result*)) br i1 %var_1, label %block_1, label %block_2 block_1: call void @__quantum__qis__x__body(%Qubit* inttoptr (i64 1 to %Qubit*)) br label %block_2 block_2: call void @__quantum__qis__mresetz__body(%Qubit* inttoptr (i64 2 to %Qubit*), %Result* inttoptr (i64 1 to %Result*)) - %var_3 = call i1 @__quantum__qis__read_result__body(%Result* inttoptr (i64 1 to %Result*)) + %var_3 = call i1 @__quantum__rt__read_result(%Result* inttoptr (i64 1 to %Result*)) br i1 %var_3, label %block_3, label %block_4 block_3: call void @__quantum__qis__z__body(%Qubit* inttoptr (i64 1 to %Qubit*)) @@ -43,7 +43,7 @@ declare void @__quantum__qis__x__body(%Qubit*) declare void @__quantum__qis__m__body(%Qubit*, %Result*) #1 -declare i1 @__quantum__qis__read_result__body(%Result*) +declare i1 @__quantum__rt__read_result(%Result*) declare void @__quantum__qis__mresetz__body(%Qubit*, %Result*) #1 diff --git a/source/pip/tests-integration/resources/adaptive_ri/output/ShortcuttingMeasurement.ll b/source/pip/tests-integration/resources/adaptive_ri/output/ShortcuttingMeasurement.ll index 25c03d94c9..83711bf15e 100644 --- a/source/pip/tests-integration/resources/adaptive_ri/output/ShortcuttingMeasurement.ll +++ b/source/pip/tests-integration/resources/adaptive_ri/output/ShortcuttingMeasurement.ll @@ -10,11 +10,11 @@ block_0: call void @__quantum__qis__x__body(%Qubit* inttoptr (i64 0 to %Qubit*)) call void @__quantum__qis__cx__body(%Qubit* inttoptr (i64 0 to %Qubit*), %Qubit* inttoptr (i64 1 to %Qubit*)) call void @__quantum__qis__m__body(%Qubit* inttoptr (i64 0 to %Qubit*), %Result* inttoptr (i64 0 to %Result*)) - %var_0 = call i1 @__quantum__qis__read_result__body(%Result* inttoptr (i64 0 to %Result*)) + %var_0 = call i1 @__quantum__rt__read_result(%Result* inttoptr (i64 0 to %Result*)) br i1 %var_0, label %block_2, label %block_1 block_1: call void @__quantum__qis__m__body(%Qubit* inttoptr (i64 1 to %Qubit*), %Result* inttoptr (i64 1 to %Result*)) - %var_3 = call i1 @__quantum__qis__read_result__body(%Result* inttoptr (i64 1 to %Result*)) + %var_3 = call i1 @__quantum__rt__read_result(%Result* inttoptr (i64 1 to %Result*)) br label %block_2 block_2: %var_5 = phi i1 [true, %block_0], [%var_3, %block_1] @@ -40,7 +40,7 @@ declare void @__quantum__qis__cx__body(%Qubit*, %Qubit*) declare void @__quantum__qis__m__body(%Qubit*, %Result*) #1 -declare i1 @__quantum__qis__read_result__body(%Result*) +declare i1 @__quantum__rt__read_result(%Result*) declare void @__quantum__qis__reset__body(%Qubit*) #1 diff --git a/source/pip/tests-integration/resources/adaptive_ri/output/SuperdenseCoding.ll b/source/pip/tests-integration/resources/adaptive_ri/output/SuperdenseCoding.ll index b7c1b7880c..527bb8b9b8 100644 --- a/source/pip/tests-integration/resources/adaptive_ri/output/SuperdenseCoding.ll +++ b/source/pip/tests-integration/resources/adaptive_ri/output/SuperdenseCoding.ll @@ -13,10 +13,10 @@ block_0: call void @__quantum__qis__cx__body(%Qubit* inttoptr (i64 0 to %Qubit*), %Qubit* inttoptr (i64 1 to %Qubit*)) call void @__quantum__qis__h__body(%Qubit* inttoptr (i64 2 to %Qubit*)) call void @__quantum__qis__mresetz__body(%Qubit* inttoptr (i64 2 to %Qubit*), %Result* inttoptr (i64 0 to %Result*)) - %var_0 = call i1 @__quantum__qis__read_result__body(%Result* inttoptr (i64 0 to %Result*)) + %var_0 = call i1 @__quantum__rt__read_result(%Result* inttoptr (i64 0 to %Result*)) call void @__quantum__qis__h__body(%Qubit* inttoptr (i64 2 to %Qubit*)) call void @__quantum__qis__mresetz__body(%Qubit* inttoptr (i64 2 to %Qubit*), %Result* inttoptr (i64 1 to %Result*)) - %var_4 = call i1 @__quantum__qis__read_result__body(%Result* inttoptr (i64 1 to %Result*)) + %var_4 = call i1 @__quantum__rt__read_result(%Result* inttoptr (i64 1 to %Result*)) br i1 %var_0, label %block_1, label %block_2 block_1: call void @__quantum__qis__z__body(%Qubit* inttoptr (i64 0 to %Qubit*)) @@ -32,13 +32,13 @@ block_4: call void @__quantum__qis__cx__body(%Qubit* inttoptr (i64 2 to %Qubit*), %Qubit* inttoptr (i64 1 to %Qubit*)) call void @__quantum__qis__h__body(%Qubit* inttoptr (i64 2 to %Qubit*)) call void @__quantum__qis__mresetz__body(%Qubit* inttoptr (i64 2 to %Qubit*), %Result* inttoptr (i64 2 to %Result*)) - %var_9 = call i1 @__quantum__qis__read_result__body(%Result* inttoptr (i64 2 to %Result*)) + %var_9 = call i1 @__quantum__rt__read_result(%Result* inttoptr (i64 2 to %Result*)) call void @__quantum__qis__h__body(%Qubit* inttoptr (i64 2 to %Qubit*)) call void @__quantum__qis__cz__body(%Qubit* inttoptr (i64 2 to %Qubit*), %Qubit* inttoptr (i64 0 to %Qubit*)) call void @__quantum__qis__cz__body(%Qubit* inttoptr (i64 2 to %Qubit*), %Qubit* inttoptr (i64 1 to %Qubit*)) call void @__quantum__qis__h__body(%Qubit* inttoptr (i64 2 to %Qubit*)) call void @__quantum__qis__mresetz__body(%Qubit* inttoptr (i64 2 to %Qubit*), %Result* inttoptr (i64 3 to %Result*)) - %var_13 = call i1 @__quantum__qis__read_result__body(%Result* inttoptr (i64 3 to %Result*)) + %var_13 = call i1 @__quantum__rt__read_result(%Result* inttoptr (i64 3 to %Result*)) call void @__quantum__qis__reset__body(%Qubit* inttoptr (i64 0 to %Qubit*)) call void @__quantum__qis__reset__body(%Qubit* inttoptr (i64 1 to %Qubit*)) call void @__quantum__rt__tuple_record_output(i64 2, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @empty_tag, i64 0, i64 0)) @@ -57,7 +57,7 @@ declare void @__quantum__qis__cx__body(%Qubit*, %Qubit*) declare void @__quantum__qis__mresetz__body(%Qubit*, %Result*) #1 -declare i1 @__quantum__qis__read_result__body(%Result*) +declare i1 @__quantum__rt__read_result(%Result*) declare void @__quantum__qis__z__body(%Qubit*) diff --git a/source/pip/tests-integration/resources/adaptive_ri/output/SwitchHandling.ll b/source/pip/tests-integration/resources/adaptive_ri/output/SwitchHandling.ll index e7d5001197..ff81e2e41f 100644 --- a/source/pip/tests-integration/resources/adaptive_ri/output/SwitchHandling.ll +++ b/source/pip/tests-integration/resources/adaptive_ri/output/SwitchHandling.ll @@ -10,14 +10,14 @@ block_0: call void @__quantum__qis__x__body(%Qubit* inttoptr (i64 1 to %Qubit*)) call void @__quantum__qis__m__body(%Qubit* inttoptr (i64 0 to %Qubit*), %Result* inttoptr (i64 0 to %Result*)) call void @__quantum__qis__m__body(%Qubit* inttoptr (i64 1 to %Qubit*), %Result* inttoptr (i64 1 to %Result*)) - %var_5 = call i1 @__quantum__qis__read_result__body(%Result* inttoptr (i64 0 to %Result*)) + %var_5 = call i1 @__quantum__rt__read_result(%Result* inttoptr (i64 0 to %Result*)) br i1 %var_5, label %block_1, label %block_2 block_1: br label %block_2 block_2: %var_16 = phi i64 [0, %block_0], [1, %block_1] %var_7 = shl i64 %var_16, 1 - %var_8 = call i1 @__quantum__qis__read_result__body(%Result* inttoptr (i64 1 to %Result*)) + %var_8 = call i1 @__quantum__rt__read_result(%Result* inttoptr (i64 1 to %Result*)) br i1 %var_8, label %block_3, label %block_4 block_3: %var_10 = add i64 %var_7, 1 @@ -59,7 +59,7 @@ declare void @__quantum__qis__x__body(%Qubit*) declare void @__quantum__qis__m__body(%Qubit*, %Result*) #1 -declare i1 @__quantum__qis__read_result__body(%Result*) +declare i1 @__quantum__rt__read_result(%Result*) declare void @__quantum__qis__reset__body(%Qubit*) #1 diff --git a/source/pip/tests-integration/resources/adaptive_ri/output/ThreeQubitRepetitionCode.ll b/source/pip/tests-integration/resources/adaptive_ri/output/ThreeQubitRepetitionCode.ll index 1408ce05d0..a5356a8d51 100644 --- a/source/pip/tests-integration/resources/adaptive_ri/output/ThreeQubitRepetitionCode.ll +++ b/source/pip/tests-integration/resources/adaptive_ri/output/ThreeQubitRepetitionCode.ll @@ -29,13 +29,13 @@ block_0: call void @__quantum__qis__cx__body(%Qubit* inttoptr (i64 2 to %Qubit*), %Qubit* inttoptr (i64 4 to %Qubit*)) call void @__quantum__qis__mresetz__body(%Qubit* inttoptr (i64 3 to %Qubit*), %Result* inttoptr (i64 0 to %Result*)) call void @__quantum__qis__mresetz__body(%Qubit* inttoptr (i64 4 to %Qubit*), %Result* inttoptr (i64 1 to %Result*)) - %var_11 = call i1 @__quantum__qis__read_result__body(%Result* inttoptr (i64 0 to %Result*)) + %var_11 = call i1 @__quantum__rt__read_result(%Result* inttoptr (i64 0 to %Result*)) br i1 %var_11, label %block_1, label %block_2 block_1: - %var_13 = call i1 @__quantum__qis__read_result__body(%Result* inttoptr (i64 1 to %Result*)) + %var_13 = call i1 @__quantum__rt__read_result(%Result* inttoptr (i64 1 to %Result*)) br i1 %var_13, label %block_3, label %block_4 block_2: - %var_15 = call i1 @__quantum__qis__read_result__body(%Result* inttoptr (i64 1 to %Result*)) + %var_15 = call i1 @__quantum__rt__read_result(%Result* inttoptr (i64 1 to %Result*)) br i1 %var_15, label %block_5, label %block_6 block_3: call void @__quantum__qis__x__body(%Qubit* inttoptr (i64 1 to %Qubit*)) @@ -78,13 +78,13 @@ block_11: call void @__quantum__qis__cx__body(%Qubit* inttoptr (i64 2 to %Qubit*), %Qubit* inttoptr (i64 4 to %Qubit*)) call void @__quantum__qis__mresetz__body(%Qubit* inttoptr (i64 3 to %Qubit*), %Result* inttoptr (i64 2 to %Result*)) call void @__quantum__qis__mresetz__body(%Qubit* inttoptr (i64 4 to %Qubit*), %Result* inttoptr (i64 3 to %Result*)) - %var_26 = call i1 @__quantum__qis__read_result__body(%Result* inttoptr (i64 2 to %Result*)) + %var_26 = call i1 @__quantum__rt__read_result(%Result* inttoptr (i64 2 to %Result*)) br i1 %var_26, label %block_12, label %block_13 block_12: - %var_28 = call i1 @__quantum__qis__read_result__body(%Result* inttoptr (i64 3 to %Result*)) + %var_28 = call i1 @__quantum__rt__read_result(%Result* inttoptr (i64 3 to %Result*)) br i1 %var_28, label %block_14, label %block_15 block_13: - %var_30 = call i1 @__quantum__qis__read_result__body(%Result* inttoptr (i64 3 to %Result*)) + %var_30 = call i1 @__quantum__rt__read_result(%Result* inttoptr (i64 3 to %Result*)) br i1 %var_30, label %block_16, label %block_17 block_14: call void @__quantum__qis__x__body(%Qubit* inttoptr (i64 1 to %Qubit*)) @@ -128,13 +128,13 @@ block_22: call void @__quantum__qis__cx__body(%Qubit* inttoptr (i64 2 to %Qubit*), %Qubit* inttoptr (i64 4 to %Qubit*)) call void @__quantum__qis__mresetz__body(%Qubit* inttoptr (i64 3 to %Qubit*), %Result* inttoptr (i64 4 to %Result*)) call void @__quantum__qis__mresetz__body(%Qubit* inttoptr (i64 4 to %Qubit*), %Result* inttoptr (i64 5 to %Result*)) - %var_42 = call i1 @__quantum__qis__read_result__body(%Result* inttoptr (i64 4 to %Result*)) + %var_42 = call i1 @__quantum__rt__read_result(%Result* inttoptr (i64 4 to %Result*)) br i1 %var_42, label %block_23, label %block_24 block_23: - %var_44 = call i1 @__quantum__qis__read_result__body(%Result* inttoptr (i64 5 to %Result*)) + %var_44 = call i1 @__quantum__rt__read_result(%Result* inttoptr (i64 5 to %Result*)) br i1 %var_44, label %block_25, label %block_26 block_24: - %var_46 = call i1 @__quantum__qis__read_result__body(%Result* inttoptr (i64 5 to %Result*)) + %var_46 = call i1 @__quantum__rt__read_result(%Result* inttoptr (i64 5 to %Result*)) br i1 %var_46, label %block_27, label %block_28 block_25: call void @__quantum__qis__x__body(%Qubit* inttoptr (i64 1 to %Qubit*)) @@ -178,13 +178,13 @@ block_33: call void @__quantum__qis__cx__body(%Qubit* inttoptr (i64 2 to %Qubit*), %Qubit* inttoptr (i64 4 to %Qubit*)) call void @__quantum__qis__mresetz__body(%Qubit* inttoptr (i64 3 to %Qubit*), %Result* inttoptr (i64 6 to %Result*)) call void @__quantum__qis__mresetz__body(%Qubit* inttoptr (i64 4 to %Qubit*), %Result* inttoptr (i64 7 to %Result*)) - %var_58 = call i1 @__quantum__qis__read_result__body(%Result* inttoptr (i64 6 to %Result*)) + %var_58 = call i1 @__quantum__rt__read_result(%Result* inttoptr (i64 6 to %Result*)) br i1 %var_58, label %block_34, label %block_35 block_34: - %var_60 = call i1 @__quantum__qis__read_result__body(%Result* inttoptr (i64 7 to %Result*)) + %var_60 = call i1 @__quantum__rt__read_result(%Result* inttoptr (i64 7 to %Result*)) br i1 %var_60, label %block_36, label %block_37 block_35: - %var_62 = call i1 @__quantum__qis__read_result__body(%Result* inttoptr (i64 7 to %Result*)) + %var_62 = call i1 @__quantum__rt__read_result(%Result* inttoptr (i64 7 to %Result*)) br i1 %var_62, label %block_38, label %block_39 block_36: call void @__quantum__qis__x__body(%Qubit* inttoptr (i64 1 to %Qubit*)) @@ -228,13 +228,13 @@ block_44: call void @__quantum__qis__cx__body(%Qubit* inttoptr (i64 2 to %Qubit*), %Qubit* inttoptr (i64 4 to %Qubit*)) call void @__quantum__qis__mresetz__body(%Qubit* inttoptr (i64 3 to %Qubit*), %Result* inttoptr (i64 8 to %Result*)) call void @__quantum__qis__mresetz__body(%Qubit* inttoptr (i64 4 to %Qubit*), %Result* inttoptr (i64 9 to %Result*)) - %var_74 = call i1 @__quantum__qis__read_result__body(%Result* inttoptr (i64 8 to %Result*)) + %var_74 = call i1 @__quantum__rt__read_result(%Result* inttoptr (i64 8 to %Result*)) br i1 %var_74, label %block_45, label %block_46 block_45: - %var_76 = call i1 @__quantum__qis__read_result__body(%Result* inttoptr (i64 9 to %Result*)) + %var_76 = call i1 @__quantum__rt__read_result(%Result* inttoptr (i64 9 to %Result*)) br i1 %var_76, label %block_47, label %block_48 block_46: - %var_78 = call i1 @__quantum__qis__read_result__body(%Result* inttoptr (i64 9 to %Result*)) + %var_78 = call i1 @__quantum__rt__read_result(%Result* inttoptr (i64 9 to %Result*)) br i1 %var_78, label %block_49, label %block_50 block_47: call void @__quantum__qis__x__body(%Qubit* inttoptr (i64 1 to %Qubit*)) @@ -264,7 +264,7 @@ block_55: call void @__quantum__qis__cx__body(%Qubit* inttoptr (i64 0 to %Qubit*), %Qubit* inttoptr (i64 1 to %Qubit*)) call void @__quantum__qis__h__body(%Qubit* inttoptr (i64 0 to %Qubit*)) call void @__quantum__qis__mresetz__body(%Qubit* inttoptr (i64 0 to %Qubit*), %Result* inttoptr (i64 10 to %Result*)) - %var_82 = call i1 @__quantum__qis__read_result__body(%Result* inttoptr (i64 10 to %Result*)) + %var_82 = call i1 @__quantum__rt__read_result(%Result* inttoptr (i64 10 to %Result*)) call void @__quantum__qis__reset__body(%Qubit* inttoptr (i64 1 to %Qubit*)) call void @__quantum__qis__reset__body(%Qubit* inttoptr (i64 2 to %Qubit*)) call void @__quantum__rt__tuple_record_output(i64 2, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @empty_tag, i64 0, i64 0)) @@ -283,7 +283,7 @@ declare void @__quantum__qis__rx__body(double, %Qubit*) declare void @__quantum__qis__mresetz__body(%Qubit*, %Result*) #1 -declare i1 @__quantum__qis__read_result__body(%Result*) +declare i1 @__quantum__rt__read_result(%Result*) declare void @__quantum__qis__x__body(%Qubit*) diff --git a/source/pip/tests-integration/resources/adaptive_rif/output/Doubles.ll b/source/pip/tests-integration/resources/adaptive_rif/output/Doubles.ll index 389fe2048e..82fca47850 100644 --- a/source/pip/tests-integration/resources/adaptive_rif/output/Doubles.ll +++ b/source/pip/tests-integration/resources/adaptive_rif/output/Doubles.ll @@ -13,7 +13,7 @@ define i64 @ENTRYPOINT__main() #0 { block_0: call void @__quantum__qis__x__body(%Qubit* inttoptr (i64 0 to %Qubit*)) call void @__quantum__qis__m__body(%Qubit* inttoptr (i64 0 to %Qubit*), %Result* inttoptr (i64 0 to %Result*)) - %var_2 = call i1 @__quantum__qis__read_result__body(%Result* inttoptr (i64 0 to %Result*)) + %var_2 = call i1 @__quantum__rt__read_result(%Result* inttoptr (i64 0 to %Result*)) br i1 %var_2, label %block_1, label %block_2 block_1: call void @__quantum__qis__x__body(%Qubit* inttoptr (i64 0 to %Qubit*)) @@ -22,7 +22,7 @@ block_2: %var_72 = phi double [0.0, %block_0], [1.0, %block_1] call void @__quantum__qis__x__body(%Qubit* inttoptr (i64 0 to %Qubit*)) call void @__quantum__qis__m__body(%Qubit* inttoptr (i64 0 to %Qubit*), %Result* inttoptr (i64 1 to %Result*)) - %var_4 = call i1 @__quantum__qis__read_result__body(%Result* inttoptr (i64 1 to %Result*)) + %var_4 = call i1 @__quantum__rt__read_result(%Result* inttoptr (i64 1 to %Result*)) br i1 %var_4, label %block_3, label %block_4 block_3: call void @__quantum__qis__x__body(%Qubit* inttoptr (i64 0 to %Qubit*)) @@ -36,7 +36,7 @@ block_4: %var_73 = phi double [%var_72, %block_2], [%var_10, %block_3] call void @__quantum__qis__x__body(%Qubit* inttoptr (i64 0 to %Qubit*)) call void @__quantum__qis__m__body(%Qubit* inttoptr (i64 0 to %Qubit*), %Result* inttoptr (i64 2 to %Result*)) - %var_11 = call i1 @__quantum__qis__read_result__body(%Result* inttoptr (i64 2 to %Result*)) + %var_11 = call i1 @__quantum__rt__read_result(%Result* inttoptr (i64 2 to %Result*)) br i1 %var_11, label %block_5, label %block_6 block_5: call void @__quantum__qis__x__body(%Qubit* inttoptr (i64 0 to %Qubit*)) @@ -50,7 +50,7 @@ block_6: %var_74 = phi double [%var_73, %block_4], [%var_17, %block_5] call void @__quantum__qis__x__body(%Qubit* inttoptr (i64 0 to %Qubit*)) call void @__quantum__qis__m__body(%Qubit* inttoptr (i64 0 to %Qubit*), %Result* inttoptr (i64 3 to %Result*)) - %var_18 = call i1 @__quantum__qis__read_result__body(%Result* inttoptr (i64 3 to %Result*)) + %var_18 = call i1 @__quantum__rt__read_result(%Result* inttoptr (i64 3 to %Result*)) br i1 %var_18, label %block_7, label %block_8 block_7: call void @__quantum__qis__x__body(%Qubit* inttoptr (i64 0 to %Qubit*)) @@ -64,7 +64,7 @@ block_8: %var_75 = phi double [%var_74, %block_6], [%var_24, %block_7] call void @__quantum__qis__x__body(%Qubit* inttoptr (i64 0 to %Qubit*)) call void @__quantum__qis__m__body(%Qubit* inttoptr (i64 0 to %Qubit*), %Result* inttoptr (i64 4 to %Result*)) - %var_25 = call i1 @__quantum__qis__read_result__body(%Result* inttoptr (i64 4 to %Result*)) + %var_25 = call i1 @__quantum__rt__read_result(%Result* inttoptr (i64 4 to %Result*)) br i1 %var_25, label %block_9, label %block_10 block_9: call void @__quantum__qis__x__body(%Qubit* inttoptr (i64 0 to %Qubit*)) @@ -78,7 +78,7 @@ block_10: %var_76 = phi double [%var_75, %block_8], [%var_31, %block_9] call void @__quantum__qis__x__body(%Qubit* inttoptr (i64 0 to %Qubit*)) call void @__quantum__qis__m__body(%Qubit* inttoptr (i64 0 to %Qubit*), %Result* inttoptr (i64 5 to %Result*)) - %var_32 = call i1 @__quantum__qis__read_result__body(%Result* inttoptr (i64 5 to %Result*)) + %var_32 = call i1 @__quantum__rt__read_result(%Result* inttoptr (i64 5 to %Result*)) br i1 %var_32, label %block_11, label %block_12 block_11: call void @__quantum__qis__x__body(%Qubit* inttoptr (i64 0 to %Qubit*)) @@ -92,7 +92,7 @@ block_12: %var_77 = phi double [%var_76, %block_10], [%var_38, %block_11] call void @__quantum__qis__x__body(%Qubit* inttoptr (i64 0 to %Qubit*)) call void @__quantum__qis__m__body(%Qubit* inttoptr (i64 0 to %Qubit*), %Result* inttoptr (i64 6 to %Result*)) - %var_39 = call i1 @__quantum__qis__read_result__body(%Result* inttoptr (i64 6 to %Result*)) + %var_39 = call i1 @__quantum__rt__read_result(%Result* inttoptr (i64 6 to %Result*)) br i1 %var_39, label %block_13, label %block_14 block_13: call void @__quantum__qis__x__body(%Qubit* inttoptr (i64 0 to %Qubit*)) @@ -106,7 +106,7 @@ block_14: %var_78 = phi double [%var_77, %block_12], [%var_45, %block_13] call void @__quantum__qis__x__body(%Qubit* inttoptr (i64 0 to %Qubit*)) call void @__quantum__qis__m__body(%Qubit* inttoptr (i64 0 to %Qubit*), %Result* inttoptr (i64 7 to %Result*)) - %var_46 = call i1 @__quantum__qis__read_result__body(%Result* inttoptr (i64 7 to %Result*)) + %var_46 = call i1 @__quantum__rt__read_result(%Result* inttoptr (i64 7 to %Result*)) br i1 %var_46, label %block_15, label %block_16 block_15: call void @__quantum__qis__x__body(%Qubit* inttoptr (i64 0 to %Qubit*)) @@ -120,7 +120,7 @@ block_16: %var_79 = phi double [%var_78, %block_14], [%var_52, %block_15] call void @__quantum__qis__x__body(%Qubit* inttoptr (i64 0 to %Qubit*)) call void @__quantum__qis__m__body(%Qubit* inttoptr (i64 0 to %Qubit*), %Result* inttoptr (i64 8 to %Result*)) - %var_53 = call i1 @__quantum__qis__read_result__body(%Result* inttoptr (i64 8 to %Result*)) + %var_53 = call i1 @__quantum__rt__read_result(%Result* inttoptr (i64 8 to %Result*)) br i1 %var_53, label %block_17, label %block_18 block_17: call void @__quantum__qis__x__body(%Qubit* inttoptr (i64 0 to %Qubit*)) @@ -134,7 +134,7 @@ block_18: %var_80 = phi double [%var_79, %block_16], [%var_59, %block_17] call void @__quantum__qis__x__body(%Qubit* inttoptr (i64 0 to %Qubit*)) call void @__quantum__qis__m__body(%Qubit* inttoptr (i64 0 to %Qubit*), %Result* inttoptr (i64 9 to %Result*)) - %var_60 = call i1 @__quantum__qis__read_result__body(%Result* inttoptr (i64 9 to %Result*)) + %var_60 = call i1 @__quantum__rt__read_result(%Result* inttoptr (i64 9 to %Result*)) br i1 %var_60, label %block_19, label %block_20 block_19: call void @__quantum__qis__x__body(%Qubit* inttoptr (i64 0 to %Qubit*)) @@ -166,7 +166,7 @@ declare void @__quantum__qis__x__body(%Qubit*) declare void @__quantum__qis__m__body(%Qubit*, %Result*) #1 -declare i1 @__quantum__qis__read_result__body(%Result*) +declare i1 @__quantum__rt__read_result(%Result*) declare void @__quantum__qis__reset__body(%Qubit*) #1 From 25aa7c7937ca2c4586ea6718b7f3d797dff4c001 Mon Sep 17 00:00:00 2001 From: "Stefan J. Wernli" Date: Thu, 10 Jul 2025 15:35:13 -0700 Subject: [PATCH 5/5] Unconditionally use initialize function --- source/compiler/qsc/src/codegen/tests.rs | 84 + source/compiler/qsc/src/interpret/tests.rs | 24 + source/compiler/qsc_partial_eval/src/lib.rs | 15 +- .../qsc_partial_eval/src/tests/arrays.rs | 478 ++-- .../qsc_partial_eval/src/tests/assigns.rs | 1228 +++++------ .../qsc_partial_eval/src/tests/bindings.rs | 232 +- .../qsc_partial_eval/src/tests/branching.rs | 1293 +++++------ .../qsc_partial_eval/src/tests/calls.rs | 541 ++--- .../src/tests/classical_args.rs | 65 +- .../src/tests/dynamic_vars.rs | 291 +-- .../qsc_partial_eval/src/tests/intrinsics.rs | 407 ++-- .../qsc_partial_eval/src/tests/loops.rs | 166 +- .../qsc_partial_eval/src/tests/misc.rs | 255 +-- .../qsc_partial_eval/src/tests/operators.rs | 1932 ++++++++--------- .../src/tests/output_recording.rs | 185 +- .../qsc_partial_eval/src/tests/qubits.rs | 162 +- .../qsc_partial_eval/src/tests/results.rs | 226 +- .../qsc_partial_eval/src/tests/returns.rs | 401 ++-- .../src/tests/expression/function_call.rs | 3 + source/compiler/qsc_qasm/src/tests/output.rs | 3 + .../qsc_qasm/src/tests/statement/gate_call.rs | 12 + .../qsc_qasm/src/tests/statement/reset.rs | 6 + source/compiler/qsc_rir/src/builder.rs | 11 + .../resources/custom_intrinsics.ll | 3 + .../adaptive_ri/output/ArithmeticOps.ll | 3 + .../output/BernsteinVaziraniNISQ.ll | 3 + .../adaptive_ri/output/ConstantFolding.ll | 3 + .../output/CopyAndUpdateExpressions.ll | 3 + .../adaptive_ri/output/DeutschJozsaNISQ.ll | 3 + .../adaptive_ri/output/ExpandedTests.ll | 3 + .../resources/adaptive_ri/output/Functors.ll | 3 + .../adaptive_ri/output/HiddenShiftNISQ.ll | 3 + .../adaptive_ri/output/IntegerComparison.ll | 3 + .../adaptive_ri/output/IntrinsicCCNOT.ll | 3 + .../adaptive_ri/output/IntrinsicCNOT.ll | 3 + .../adaptive_ri/output/IntrinsicHIXYZ.ll | 3 + .../adaptive_ri/output/IntrinsicM.ll | 3 + .../output/IntrinsicMeasureWithBitFlipCode.ll | 3 + .../IntrinsicMeasureWithPhaseFlipCode.ll | 3 + .../output/IntrinsicRotationsWithPeriod.ll | 3 + .../adaptive_ri/output/IntrinsicSTSWAP.ll | 3 + .../adaptive_ri/output/MeasureAndReuse.ll | 3 + .../output/MeasurementComparison.ll | 3 + .../adaptive_ri/output/NestedBranching.ll | 3 + .../resources/adaptive_ri/output/RandomBit.ll | 3 + .../adaptive_ri/output/SampleTeleport.ll | 3 + .../output/ShortcuttingMeasurement.ll | 3 + .../resources/adaptive_ri/output/Slicing.ll | 3 + .../adaptive_ri/output/SuperdenseCoding.ll | 3 + .../adaptive_ri/output/SwitchHandling.ll | 3 + .../output/ThreeQubitRepetitionCode.ll | 3 + .../adaptive_ri/output/WithinApply.ll | 3 + .../resources/adaptive_rif/output/Doubles.ll | 3 + source/pip/tests-integration/test_base_qir.py | 16 +- .../tests-integration/test_requirements.txt | 2 +- source/pip/tests/test_interpreter.py | 6 + source/pip/tests/test_qasm.py | 2 +- 57 files changed, 4265 insertions(+), 3871 deletions(-) diff --git a/source/compiler/qsc/src/codegen/tests.rs b/source/compiler/qsc/src/codegen/tests.rs index a6aa0e1b3c..24df5a5785 100644 --- a/source/compiler/qsc/src/codegen/tests.rs +++ b/source/compiler/qsc/src/codegen/tests.rs @@ -110,6 +110,7 @@ mod base_profile { define i64 @ENTRYPOINT__main() #0 { block_0: + call void @__quantum__rt__initialize(i8* null) call void @__quantum__qis__rz__body(double 2.0, %Qubit* inttoptr (i64 0 to %Qubit*)) call void @__quantum__qis__rz__body(double 0.0, %Qubit* inttoptr (i64 0 to %Qubit*)) call void @__quantum__qis__rz__body(double 1.0, %Qubit* inttoptr (i64 0 to %Qubit*)) @@ -118,6 +119,8 @@ mod base_profile { ret i64 0 } + declare void @__quantum__rt__initialize(i8*) + declare void @__quantum__qis__rz__body(double, %Qubit*) declare void @__quantum__rt__result_record_output(%Result*, i8*) @@ -159,6 +162,7 @@ mod base_profile { define i64 @ENTRYPOINT__main() #0 { block_0: + call void @__quantum__rt__initialize(i8* null) call void @__quantum__qis__m__body(%Qubit* inttoptr (i64 0 to %Qubit*), %Result* inttoptr (i64 0 to %Result*)) call void @__quantum__qis__m__body(%Qubit* inttoptr (i64 1 to %Qubit*), %Result* inttoptr (i64 1 to %Result*)) call void @__quantum__rt__tuple_record_output(i64 2, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @empty_tag, i64 0, i64 0)) @@ -167,6 +171,8 @@ mod base_profile { ret i64 0 } + declare void @__quantum__rt__initialize(i8*) + declare void @__quantum__rt__tuple_record_output(i64, i8*) declare void @__quantum__rt__result_record_output(%Result*, i8*) @@ -211,6 +217,7 @@ mod base_profile { define i64 @ENTRYPOINT__main() #0 { block_0: + call void @__quantum__rt__initialize(i8* null) call void @__quantum__qis__x__body(%Qubit* inttoptr (i64 0 to %Qubit*)) call void @__quantum__qis__x__body(%Qubit* inttoptr (i64 1 to %Qubit*)) call void @__quantum__qis__m__body(%Qubit* inttoptr (i64 0 to %Qubit*), %Result* inttoptr (i64 0 to %Result*)) @@ -221,6 +228,8 @@ mod base_profile { ret i64 0 } + declare void @__quantum__rt__initialize(i8*) + declare void @__quantum__qis__x__body(%Qubit*) declare void @__quantum__rt__array_record_output(i64, i8*) @@ -266,6 +275,7 @@ mod base_profile { define i64 @ENTRYPOINT__main() #0 { block_0: + call void @__quantum__rt__initialize(i8* null) call void @__quantum__qis__x__body(%Qubit* inttoptr (i64 0 to %Qubit*)) call void @__quantum__qis__x__body(%Qubit* inttoptr (i64 0 to %Qubit*)) call void @__quantum__qis__m__body(%Qubit* inttoptr (i64 1 to %Qubit*), %Result* inttoptr (i64 0 to %Result*)) @@ -276,6 +286,8 @@ mod base_profile { ret i64 0 } + declare void @__quantum__rt__initialize(i8*) + declare void @__quantum__qis__x__body(%Qubit*) declare void @__quantum__rt__tuple_record_output(i64, i8*) @@ -326,6 +338,7 @@ mod base_profile { define i64 @ENTRYPOINT__main() #0 { block_0: + call void @__quantum__rt__initialize(i8* null) call void @__quantum__qis__x__body(%Qubit* inttoptr (i64 0 to %Qubit*)) call void @__quantum__qis__x__body(%Qubit* inttoptr (i64 0 to %Qubit*)) call void @__quantum__qis__m__body(%Qubit* inttoptr (i64 3 to %Qubit*), %Result* inttoptr (i64 0 to %Result*)) @@ -336,6 +349,8 @@ mod base_profile { ret i64 0 } + declare void @__quantum__rt__initialize(i8*) + declare void @__quantum__qis__x__body(%Qubit*) declare void @__quantum__rt__tuple_record_output(i64, i8*) @@ -393,6 +408,7 @@ mod adaptive_profile { define i64 @ENTRYPOINT__main() #0 { block_0: + call void @__quantum__rt__initialize(i8* null) call void @__quantum__qis__rz__body(double 2.0, %Qubit* inttoptr (i64 0 to %Qubit*)) call void @__quantum__qis__rz__body(double 0.0, %Qubit* inttoptr (i64 0 to %Qubit*)) call void @__quantum__qis__rz__body(double 1.0, %Qubit* inttoptr (i64 0 to %Qubit*)) @@ -401,6 +417,8 @@ mod adaptive_profile { ret i64 0 } + declare void @__quantum__rt__initialize(i8*) + declare void @__quantum__qis__rz__body(double, %Qubit*) declare void @__quantum__rt__result_record_output(%Result*, i8*) @@ -442,6 +460,7 @@ mod adaptive_profile { define i64 @ENTRYPOINT__main() #0 { block_0: + call void @__quantum__rt__initialize(i8* null) call void @__quantum__qis__m__body(%Qubit* inttoptr (i64 0 to %Qubit*), %Result* inttoptr (i64 0 to %Result*)) call void @__quantum__qis__m__body(%Qubit* inttoptr (i64 1 to %Qubit*), %Result* inttoptr (i64 1 to %Result*)) call void @__quantum__rt__tuple_record_output(i64 2, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @empty_tag, i64 0, i64 0)) @@ -450,6 +469,8 @@ mod adaptive_profile { ret i64 0 } + declare void @__quantum__rt__initialize(i8*) + declare void @__quantum__rt__tuple_record_output(i64, i8*) declare void @__quantum__rt__result_record_output(%Result*, i8*) @@ -494,12 +515,15 @@ mod adaptive_profile { define i64 @ENTRYPOINT__main() #0 { block_0: + call void @__quantum__rt__initialize(i8* null) call void @__quantum__qis__h__body(%Qubit* inttoptr (i64 0 to %Qubit*)) call void @__quantum__qis__mx__body(%Qubit* inttoptr (i64 0 to %Qubit*), %Result* inttoptr (i64 0 to %Result*)) call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 0 to %Result*), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @0, i64 0, i64 0)) ret i64 0 } + declare void @__quantum__rt__initialize(i8*) + declare void @__quantum__qis__h__body(%Qubit*) declare void @__quantum__qis__mx__body(%Qubit*, %Result*) #1 @@ -547,6 +571,7 @@ mod adaptive_profile { define i64 @ENTRYPOINT__main() #0 { block_0: + call void @__quantum__rt__initialize(i8* null) call void @__quantum__qis__h__body(%Qubit* inttoptr (i64 0 to %Qubit*)) call void @__quantum__qis__h__body(%Qubit* inttoptr (i64 1 to %Qubit*)) call void @__quantum__qis__mzz__body(%Qubit* inttoptr (i64 0 to %Qubit*), %Qubit* inttoptr (i64 1 to %Qubit*), %Result* inttoptr (i64 0 to %Result*), %Result* inttoptr (i64 1 to %Result*)) @@ -556,6 +581,8 @@ mod adaptive_profile { ret i64 0 } + declare void @__quantum__rt__initialize(i8*) + declare void @__quantum__qis__h__body(%Qubit*) declare void @__quantum__qis__mzz__body(%Qubit*, %Qubit*, %Result*, %Result*) #1 @@ -602,6 +629,7 @@ mod adaptive_profile { define i64 @ENTRYPOINT__main() #0 { block_0: + call void @__quantum__rt__initialize(i8* null) call void @__quantum__qis__x__body(%Qubit* inttoptr (i64 0 to %Qubit*)) call void @__quantum__qis__m__body(%Qubit* inttoptr (i64 0 to %Qubit*), %Result* inttoptr (i64 0 to %Result*)) call void @__quantum__qis__x__body(%Qubit* inttoptr (i64 1 to %Qubit*)) @@ -612,6 +640,8 @@ mod adaptive_profile { ret i64 0 } + declare void @__quantum__rt__initialize(i8*) + declare void @__quantum__qis__x__body(%Qubit*) declare void @__quantum__rt__array_record_output(i64, i8*) @@ -675,6 +705,7 @@ mod adaptive_ri_profile { define i64 @ENTRYPOINT__main() #0 { block_0: + call void @__quantum__rt__initialize(i8* null) call void @__quantum__qis__rz__body(double 2.0, %Qubit* inttoptr (i64 0 to %Qubit*)) call void @__quantum__qis__rz__body(double 0.0, %Qubit* inttoptr (i64 0 to %Qubit*)) call void @__quantum__qis__rz__body(double 1.0, %Qubit* inttoptr (i64 0 to %Qubit*)) @@ -683,6 +714,8 @@ mod adaptive_ri_profile { ret i64 0 } + declare void @__quantum__rt__initialize(i8*) + declare void @__quantum__qis__rz__body(double, %Qubit*) declare void @__quantum__qis__mresetz__body(%Qubit*, %Result*) #1 @@ -725,6 +758,7 @@ mod adaptive_ri_profile { define i64 @ENTRYPOINT__main() #0 { block_0: + call void @__quantum__rt__initialize(i8* null) call void @__quantum__qis__mresetz__body(%Qubit* inttoptr (i64 0 to %Qubit*), %Result* inttoptr (i64 0 to %Result*)) call void @__quantum__qis__mresetz__body(%Qubit* inttoptr (i64 0 to %Qubit*), %Result* inttoptr (i64 1 to %Result*)) call void @__quantum__rt__tuple_record_output(i64 2, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @empty_tag, i64 0, i64 0)) @@ -733,6 +767,8 @@ mod adaptive_ri_profile { ret i64 0 } + declare void @__quantum__rt__initialize(i8*) + declare void @__quantum__qis__mresetz__body(%Qubit*, %Result*) #1 declare void @__quantum__rt__tuple_record_output(i64, i8*) @@ -778,6 +814,7 @@ mod adaptive_ri_profile { define i64 @ENTRYPOINT__main() #0 { block_0: + call void @__quantum__rt__initialize(i8* null) call void @__quantum__qis__x__body(%Qubit* inttoptr (i64 0 to %Qubit*)) call void @__quantum__qis__mresetz__body(%Qubit* inttoptr (i64 0 to %Qubit*), %Result* inttoptr (i64 0 to %Result*)) call void @__quantum__qis__x__body(%Qubit* inttoptr (i64 1 to %Qubit*)) @@ -788,6 +825,8 @@ mod adaptive_ri_profile { ret i64 0 } + declare void @__quantum__rt__initialize(i8*) + declare void @__quantum__qis__x__body(%Qubit*) declare void @__quantum__qis__mresetz__body(%Qubit*, %Result*) #1 @@ -834,6 +873,7 @@ mod adaptive_ri_profile { define i64 @ENTRYPOINT__main() #0 { block_0: + call void @__quantum__rt__initialize(i8* null) call void @__quantum__qis__x__body(%Qubit* inttoptr (i64 0 to %Qubit*)) call void @__quantum__qis__x__body(%Qubit* inttoptr (i64 0 to %Qubit*)) call void @__quantum__qis__mresetz__body(%Qubit* inttoptr (i64 1 to %Qubit*), %Result* inttoptr (i64 0 to %Result*)) @@ -844,6 +884,8 @@ mod adaptive_ri_profile { ret i64 0 } + declare void @__quantum__rt__initialize(i8*) + declare void @__quantum__qis__x__body(%Qubit*) declare void @__quantum__qis__mresetz__body(%Qubit*, %Result*) #1 @@ -895,6 +937,7 @@ mod adaptive_ri_profile { define i64 @ENTRYPOINT__main() #0 { block_0: + call void @__quantum__rt__initialize(i8* null) call void @__quantum__qis__x__body(%Qubit* inttoptr (i64 0 to %Qubit*)) call void @__quantum__qis__x__body(%Qubit* inttoptr (i64 0 to %Qubit*)) call void @__quantum__qis__reset__body(%Qubit* inttoptr (i64 1 to %Qubit*)) @@ -907,6 +950,8 @@ mod adaptive_ri_profile { ret i64 0 } + declare void @__quantum__rt__initialize(i8*) + declare void @__quantum__qis__x__body(%Qubit*) declare void @__quantum__qis__reset__body(%Qubit*) #1 @@ -961,6 +1006,7 @@ mod adaptive_ri_profile { define i64 @ENTRYPOINT__main() #0 { block_0: + call void @__quantum__rt__initialize(i8* null) call void @__quantum__qis__x__body(%Qubit* inttoptr (i64 0 to %Qubit*)) call void @__quantum__qis__x__body(%Qubit* inttoptr (i64 1 to %Qubit*)) call void @__quantum__qis__x__body(%Qubit* inttoptr (i64 2 to %Qubit*)) @@ -973,6 +1019,8 @@ mod adaptive_ri_profile { ret i64 0 } + declare void @__quantum__rt__initialize(i8*) + declare void @__quantum__qis__x__body(%Qubit*) declare void @__quantum__qis__mresetz__body(%Qubit*, %Result*) #1 @@ -1016,6 +1064,7 @@ mod adaptive_ri_profile { define i64 @ENTRYPOINT__main() #0 { block_0: + call void @__quantum__rt__initialize(i8* null) call void @__quantum__qis__h__body(%Qubit* inttoptr (i64 0 to %Qubit*)) call void @__quantum__qis__mresetz__body(%Qubit* inttoptr (i64 0 to %Qubit*), %Result* inttoptr (i64 0 to %Result*)) %var_0 = call i1 @__quantum__rt__read_result(%Result* inttoptr (i64 0 to %Result*)) @@ -1031,6 +1080,8 @@ mod adaptive_ri_profile { ret i64 0 } + declare void @__quantum__rt__initialize(i8*) + declare void @__quantum__qis__h__body(%Qubit*) declare void @__quantum__qis__mresetz__body(%Qubit*, %Result*) #1 @@ -1078,12 +1129,15 @@ mod adaptive_ri_profile { define i64 @ENTRYPOINT__main() #0 { block_0: + call void @__quantum__rt__initialize(i8* null) call void @__quantum__qis__custom_reset__body(%Qubit* inttoptr (i64 0 to %Qubit*)) call void @__quantum__qis__m__body(%Qubit* inttoptr (i64 0 to %Qubit*), %Result* inttoptr (i64 0 to %Result*)) call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 0 to %Result*), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @0, i64 0, i64 0)) ret i64 0 } + declare void @__quantum__rt__initialize(i8*) + declare void @__quantum__qis__custom_reset__body(%Qubit*) #1 declare void @__quantum__qis__m__body(%Qubit*, %Result*) #1 @@ -1146,6 +1200,7 @@ mod adaptive_rif_profile { define i64 @ENTRYPOINT__main() #0 { block_0: + call void @__quantum__rt__initialize(i8* null) call void @__quantum__qis__rz__body(double 2.0, %Qubit* inttoptr (i64 0 to %Qubit*)) call void @__quantum__qis__rz__body(double 0.0, %Qubit* inttoptr (i64 0 to %Qubit*)) call void @__quantum__qis__rz__body(double 1.0, %Qubit* inttoptr (i64 0 to %Qubit*)) @@ -1154,6 +1209,8 @@ mod adaptive_rif_profile { ret i64 0 } + declare void @__quantum__rt__initialize(i8*) + declare void @__quantum__qis__rz__body(double, %Qubit*) declare void @__quantum__qis__mresetz__body(%Qubit*, %Result*) #1 @@ -1197,6 +1254,7 @@ mod adaptive_rif_profile { define i64 @ENTRYPOINT__main() #0 { block_0: + call void @__quantum__rt__initialize(i8* null) call void @__quantum__qis__mresetz__body(%Qubit* inttoptr (i64 0 to %Qubit*), %Result* inttoptr (i64 0 to %Result*)) call void @__quantum__qis__mresetz__body(%Qubit* inttoptr (i64 0 to %Qubit*), %Result* inttoptr (i64 1 to %Result*)) call void @__quantum__rt__tuple_record_output(i64 2, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @empty_tag, i64 0, i64 0)) @@ -1205,6 +1263,8 @@ mod adaptive_rif_profile { ret i64 0 } + declare void @__quantum__rt__initialize(i8*) + declare void @__quantum__qis__mresetz__body(%Qubit*, %Result*) #1 declare void @__quantum__rt__tuple_record_output(i64, i8*) @@ -1251,6 +1311,7 @@ mod adaptive_rif_profile { define i64 @ENTRYPOINT__main() #0 { block_0: + call void @__quantum__rt__initialize(i8* null) call void @__quantum__qis__x__body(%Qubit* inttoptr (i64 0 to %Qubit*)) call void @__quantum__qis__mresetz__body(%Qubit* inttoptr (i64 0 to %Qubit*), %Result* inttoptr (i64 0 to %Result*)) call void @__quantum__qis__x__body(%Qubit* inttoptr (i64 1 to %Qubit*)) @@ -1261,6 +1322,8 @@ mod adaptive_rif_profile { ret i64 0 } + declare void @__quantum__rt__initialize(i8*) + declare void @__quantum__qis__x__body(%Qubit*) declare void @__quantum__qis__mresetz__body(%Qubit*, %Result*) #1 @@ -1308,6 +1371,7 @@ mod adaptive_rif_profile { define i64 @ENTRYPOINT__main() #0 { block_0: + call void @__quantum__rt__initialize(i8* null) call void @__quantum__qis__x__body(%Qubit* inttoptr (i64 0 to %Qubit*)) call void @__quantum__qis__x__body(%Qubit* inttoptr (i64 0 to %Qubit*)) call void @__quantum__qis__mresetz__body(%Qubit* inttoptr (i64 1 to %Qubit*), %Result* inttoptr (i64 0 to %Result*)) @@ -1318,6 +1382,8 @@ mod adaptive_rif_profile { ret i64 0 } + declare void @__quantum__rt__initialize(i8*) + declare void @__quantum__qis__x__body(%Qubit*) declare void @__quantum__qis__mresetz__body(%Qubit*, %Result*) #1 @@ -1370,6 +1436,7 @@ mod adaptive_rif_profile { define i64 @ENTRYPOINT__main() #0 { block_0: + call void @__quantum__rt__initialize(i8* null) call void @__quantum__qis__x__body(%Qubit* inttoptr (i64 0 to %Qubit*)) call void @__quantum__qis__x__body(%Qubit* inttoptr (i64 0 to %Qubit*)) call void @__quantum__qis__reset__body(%Qubit* inttoptr (i64 1 to %Qubit*)) @@ -1382,6 +1449,8 @@ mod adaptive_rif_profile { ret i64 0 } + declare void @__quantum__rt__initialize(i8*) + declare void @__quantum__qis__x__body(%Qubit*) declare void @__quantum__qis__reset__body(%Qubit*) #1 @@ -1437,6 +1506,7 @@ mod adaptive_rif_profile { define i64 @ENTRYPOINT__main() #0 { block_0: + call void @__quantum__rt__initialize(i8* null) call void @__quantum__qis__x__body(%Qubit* inttoptr (i64 0 to %Qubit*)) call void @__quantum__qis__x__body(%Qubit* inttoptr (i64 1 to %Qubit*)) call void @__quantum__qis__x__body(%Qubit* inttoptr (i64 2 to %Qubit*)) @@ -1449,6 +1519,8 @@ mod adaptive_rif_profile { ret i64 0 } + declare void @__quantum__rt__initialize(i8*) + declare void @__quantum__qis__x__body(%Qubit*) declare void @__quantum__qis__mresetz__body(%Qubit*, %Result*) #1 @@ -1493,6 +1565,7 @@ mod adaptive_rif_profile { define i64 @ENTRYPOINT__main() #0 { block_0: + call void @__quantum__rt__initialize(i8* null) call void @__quantum__qis__h__body(%Qubit* inttoptr (i64 0 to %Qubit*)) call void @__quantum__qis__mresetz__body(%Qubit* inttoptr (i64 0 to %Qubit*), %Result* inttoptr (i64 0 to %Result*)) %var_0 = call i1 @__quantum__rt__read_result(%Result* inttoptr (i64 0 to %Result*)) @@ -1508,6 +1581,8 @@ mod adaptive_rif_profile { ret i64 0 } + declare void @__quantum__rt__initialize(i8*) + declare void @__quantum__qis__h__body(%Qubit*) declare void @__quantum__qis__mresetz__body(%Qubit*, %Result*) #1 @@ -1552,6 +1627,7 @@ mod adaptive_rif_profile { define i64 @ENTRYPOINT__main() #0 { block_0: + call void @__quantum__rt__initialize(i8* null) call void @__quantum__qis__h__body(%Qubit* inttoptr (i64 0 to %Qubit*)) call void @__quantum__qis__mresetz__body(%Qubit* inttoptr (i64 0 to %Qubit*), %Result* inttoptr (i64 0 to %Result*)) %var_0 = call i1 @__quantum__rt__read_result(%Result* inttoptr (i64 0 to %Result*)) @@ -1567,6 +1643,8 @@ mod adaptive_rif_profile { ret i64 0 } + declare void @__quantum__rt__initialize(i8*) + declare void @__quantum__qis__h__body(%Qubit*) declare void @__quantum__qis__mresetz__body(%Qubit*, %Result*) #1 @@ -1615,12 +1693,15 @@ mod adaptive_rif_profile { define i64 @ENTRYPOINT__main() #0 { block_0: + call void @__quantum__rt__initialize(i8* null) call void @__quantum__qis__custom_reset__body(%Qubit* inttoptr (i64 0 to %Qubit*)) call void @__quantum__qis__m__body(%Qubit* inttoptr (i64 0 to %Qubit*), %Result* inttoptr (i64 0 to %Result*)) call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 0 to %Result*), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @0, i64 0, i64 0)) ret i64 0 } + declare void @__quantum__rt__initialize(i8*) + declare void @__quantum__qis__custom_reset__body(%Qubit*) #1 declare void @__quantum__qis__m__body(%Qubit*, %Result*) #1 @@ -1672,6 +1753,7 @@ mod adaptive_rif_profile { define i64 @ENTRYPOINT__main() #0 { block_0: + call void @__quantum__rt__initialize(i8* null) call void @__quantum__qis__h__body(%Qubit* inttoptr (i64 0 to %Qubit*)) call void @__quantum__qis__mresetz__body(%Qubit* inttoptr (i64 0 to %Qubit*), %Result* inttoptr (i64 0 to %Result*)) %var_0 = call i1 @__quantum__rt__read_result(%Result* inttoptr (i64 0 to %Result*)) @@ -1697,6 +1779,8 @@ mod adaptive_rif_profile { ret i64 0 } + declare void @__quantum__rt__initialize(i8*) + declare void @__quantum__qis__h__body(%Qubit*) declare void @__quantum__qis__mresetz__body(%Qubit*, %Result*) #1 diff --git a/source/compiler/qsc/src/interpret/tests.rs b/source/compiler/qsc/src/interpret/tests.rs index 8bbed4a6a3..57bb192841 100644 --- a/source/compiler/qsc/src/interpret/tests.rs +++ b/source/compiler/qsc/src/interpret/tests.rs @@ -919,12 +919,15 @@ mod given_interpreter { define i64 @ENTRYPOINT__main() #0 { block_0: + call void @__quantum__rt__initialize(i8* null) call void @__quantum__qis__cx__body(%Qubit* inttoptr (i64 0 to %Qubit*), %Qubit* inttoptr (i64 1 to %Qubit*)) call void @__quantum__qis__m__body(%Qubit* inttoptr (i64 0 to %Qubit*), %Result* inttoptr (i64 0 to %Result*)) call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 0 to %Result*), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @0, i64 0, i64 0)) ret i64 0 } + declare void @__quantum__rt__initialize(i8*) + declare void @__quantum__qis__m__body(%Qubit*, %Result*) #1 declare void @__quantum__rt__result_record_output(%Result*, i8*) @@ -983,6 +986,7 @@ mod given_interpreter { define i64 @ENTRYPOINT__main() #0 { block_0: + call void @__quantum__rt__initialize(i8* null) call void @__quantum__qis__rz__body(double 2.0, %Qubit* inttoptr (i64 0 to %Qubit*)) call void @__quantum__qis__rz__body(double 0.0, %Qubit* inttoptr (i64 0 to %Qubit*)) call void @__quantum__qis__rz__body(double 1.0, %Qubit* inttoptr (i64 0 to %Qubit*)) @@ -991,6 +995,8 @@ mod given_interpreter { ret i64 0 } + declare void @__quantum__rt__initialize(i8*) + declare void @__quantum__qis__rz__body(double, %Qubit*) declare void @__quantum__qis__mresetz__body(%Qubit*, %Result*) #1 @@ -1045,6 +1051,7 @@ mod given_interpreter { define i64 @ENTRYPOINT__main() #0 { block_0: + call void @__quantum__rt__initialize(i8* null) call void @__quantum__qis__mresetz__body(%Qubit* inttoptr (i64 0 to %Qubit*), %Result* inttoptr (i64 0 to %Result*)) %var_0 = call i1 @__quantum__rt__read_result(%Result* inttoptr (i64 0 to %Result*)) %var_2 = call i1 @__quantum__rt__read_result(%Result* inttoptr (i64 0 to %Result*)) @@ -1057,6 +1064,8 @@ mod given_interpreter { ret i64 0 } + declare void @__quantum__rt__initialize(i8*) + declare void @__quantum__qis__mresetz__body(%Qubit*, %Result*) #1 declare i1 @__quantum__rt__read_result(%Result*) @@ -1125,12 +1134,15 @@ mod given_interpreter { define i64 @ENTRYPOINT__main() #0 { block_0: + call void @__quantum__rt__initialize(i8* null) call void @__quantum__qis__cx__body(%Qubit* inttoptr (i64 0 to %Qubit*), %Qubit* inttoptr (i64 1 to %Qubit*)) call void @__quantum__qis__m__body(%Qubit* inttoptr (i64 0 to %Qubit*), %Result* inttoptr (i64 0 to %Result*)) call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 0 to %Result*), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @0, i64 0, i64 0)) ret i64 0 } + declare void @__quantum__rt__initialize(i8*) + declare void @__quantum__qis__m__body(%Qubit*, %Result*) #1 declare void @__quantum__rt__result_record_output(%Result*, i8*) @@ -1172,12 +1184,15 @@ mod given_interpreter { define i64 @ENTRYPOINT__main() #0 { block_0: + call void @__quantum__rt__initialize(i8* null) call void @__quantum__qis__cx__body(%Qubit* inttoptr (i64 0 to %Qubit*), %Qubit* inttoptr (i64 1 to %Qubit*)) call void @__quantum__qis__m__body(%Qubit* inttoptr (i64 0 to %Qubit*), %Result* inttoptr (i64 0 to %Result*)) call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 0 to %Result*), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @0, i64 0, i64 0)) ret i64 0 } + declare void @__quantum__rt__initialize(i8*) + declare void @__quantum__qis__m__body(%Qubit*, %Result*) #1 declare void @__quantum__rt__result_record_output(%Result*, i8*) @@ -1251,12 +1266,15 @@ mod given_interpreter { define i64 @ENTRYPOINT__main() #0 { block_0: + call void @__quantum__rt__initialize(i8* null) call void @__quantum__qis__cx__body(%Qubit* inttoptr (i64 0 to %Qubit*), %Qubit* inttoptr (i64 1 to %Qubit*)) call void @__quantum__qis__m__body(%Qubit* inttoptr (i64 0 to %Qubit*), %Result* inttoptr (i64 0 to %Result*)) call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 0 to %Result*), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @0, i64 0, i64 0)) ret i64 0 } + declare void @__quantum__rt__initialize(i8*) + declare void @__quantum__qis__m__body(%Qubit*, %Result*) #1 declare void @__quantum__rt__result_record_output(%Result*, i8*) @@ -1310,12 +1328,15 @@ mod given_interpreter { define i64 @ENTRYPOINT__main() #0 { block_0: + call void @__quantum__rt__initialize(i8* null) call void @__quantum__qis__cx__body(%Qubit* inttoptr (i64 0 to %Qubit*), %Qubit* inttoptr (i64 1 to %Qubit*)) call void @__quantum__qis__m__body(%Qubit* inttoptr (i64 0 to %Qubit*), %Result* inttoptr (i64 0 to %Result*)) call void @__quantum__rt__result_record_output(%Result* inttoptr (i64 0 to %Result*), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @0, i64 0, i64 0)) ret i64 0 } + declare void @__quantum__rt__initialize(i8*) + declare void @__quantum__qis__m__body(%Qubit*, %Result*) #1 declare void @__quantum__rt__result_record_output(%Result*, i8*) @@ -1368,12 +1389,15 @@ mod given_interpreter { define i64 @ENTRYPOINT__main() #0 { block_0: + call void @__quantum__rt__initialize(i8* null) call void @__quantum__qis__mresetz__body(%Qubit* inttoptr (i64 0 to %Qubit*), %Result* inttoptr (i64 0 to %Result*)) %var_0 = call i1 @check_result(%Result* inttoptr (i64 0 to %Result*)) call void @__quantum__rt__bool_record_output(i1 %var_0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @0, i64 0, i64 0)) ret i64 0 } + declare void @__quantum__rt__initialize(i8*) + declare void @__quantum__qis__mresetz__body(%Qubit*, %Result*) #1 declare i1 @check_result(%Result*) diff --git a/source/compiler/qsc_partial_eval/src/lib.rs b/source/compiler/qsc_partial_eval/src/lib.rs index 35304668a4..9ef6c06785 100644 --- a/source/compiler/qsc_partial_eval/src/lib.rs +++ b/source/compiler/qsc_partial_eval/src/lib.rs @@ -46,7 +46,7 @@ use qsc_rca::{ }, }; use qsc_rir::{ - builder, + builder::{self, initialize_decl}, rir::{ self, Callable, CallableId, CallableType, ConditionCode, FcmpConditionCode, Instruction, Literal, Operand, Program, VariableId, @@ -232,6 +232,19 @@ impl<'a> PartialEvaluator<'a> { program.callables.insert(entry_point_id, entry_point); program.entry = entry_point_id; + // Add the required call to the initialization function. + let init_func = initialize_decl(); + let init_id = resource_manager.next_callable(); + program.callables.insert(init_id, init_func); + program + .get_block_mut(entry_block_id) + .0 + .push(Instruction::Call( + init_id, + vec![Operand::Literal(Literal::Pointer)], + None, + )); + // Initialize the evaluation context and create a new partial evaluator. let context = EvaluationContext::new( package_id.unwrap_or_else(|| { diff --git a/source/compiler/qsc_partial_eval/src/tests/arrays.rs b/source/compiler/qsc_partial_eval/src/tests/arrays.rs index 4dc86e58f9..24bd2ef79f 100644 --- a/source/compiler/qsc_partial_eval/src/tests/arrays.rs +++ b/source/compiler/qsc_partial_eval/src/tests/arrays.rs @@ -31,14 +31,13 @@ fn array_with_dynamic_content() { &program, mresetz_callable_id, &expect![[r#" - Callable: - name: __quantum__qis__mresetz__body - call_type: Measurement - input_type: - [0]: Qubit - [1]: Result - output_type: - body: "#]], + Callable: + name: __quantum__rt__initialize + call_type: Regular + input_type: + [0]: Pointer + output_type: + body: "#]], ); let array_output_recording_callable_id = CallableId(2); assert_callable( @@ -46,11 +45,11 @@ fn array_with_dynamic_content() { array_output_recording_callable_id, &expect![[r#" Callable: - name: __quantum__rt__array_record_output - call_type: OutputRecording + name: __quantum__qis__mresetz__body + call_type: Measurement input_type: - [0]: Integer - [1]: Pointer + [0]: Qubit + [1]: Result output_type: body: "#]], ); @@ -60,10 +59,10 @@ fn array_with_dynamic_content() { result_output_recording_callable_id, &expect![[r#" Callable: - name: __quantum__rt__result_record_output + name: __quantum__rt__array_record_output call_type: OutputRecording input_type: - [0]: Result + [0]: Integer [1]: Pointer output_type: body: "#]], @@ -73,11 +72,12 @@ fn array_with_dynamic_content() { BlockId(0), &expect![[r#" Block: - Call id(1), args( Qubit(0), Result(0), ) - Call id(1), args( Qubit(1), Result(1), ) - Call id(2), args( Integer(2), EmptyTag, ) - Call id(3), args( Result(0), Tag(0, 5), ) - Call id(3), args( Result(1), Tag(1, 5), ) + Call id(1), args( Pointer, ) + Call id(2), args( Qubit(0), Result(0), ) + Call id(2), args( Qubit(1), Result(1), ) + Call id(3), args( Integer(2), EmptyTag, ) + Call id(4), args( Result(0), Tag(0, 5), ) + Call id(4), args( Result(1), Tag(1, 5), ) Return"#]], ); } @@ -99,14 +99,13 @@ fn array_with_hybrid_content() { &program, mresetz_callable_id, &expect![[r#" - Callable: - name: __quantum__qis__mresetz__body - call_type: Measurement - input_type: - [0]: Qubit - [1]: Result - output_type: - body: "#]], + Callable: + name: __quantum__rt__initialize + call_type: Regular + input_type: + [0]: Pointer + output_type: + body: "#]], ); let array_output_recording_callable_id = CallableId(2); assert_callable( @@ -114,11 +113,12 @@ fn array_with_hybrid_content() { array_output_recording_callable_id, &expect![[r#" Callable: - name: __quantum__rt__read_result - call_type: Readout + name: __quantum__qis__mresetz__body + call_type: Measurement input_type: - [0]: Result - output_type: Boolean + [0]: Qubit + [1]: Result + output_type: body: "#]], ); let boolean_output_recording_callable_id = CallableId(3); @@ -127,12 +127,11 @@ fn array_with_hybrid_content() { boolean_output_recording_callable_id, &expect![[r#" Callable: - name: __quantum__rt__array_record_output - call_type: OutputRecording + name: __quantum__rt__read_result + call_type: Readout input_type: - [0]: Integer - [1]: Pointer - output_type: + [0]: Result + output_type: Boolean body: "#]], ); assert_block_instructions( @@ -140,12 +139,13 @@ fn array_with_hybrid_content() { BlockId(0), &expect![[r#" Block: - Call id(1), args( Qubit(0), Result(0), ) - Variable(0, Boolean) = Call id(2), args( Result(0), ) + Call id(1), args( Pointer, ) + Call id(2), args( Qubit(0), Result(0), ) + Variable(0, Boolean) = Call id(3), args( Result(0), ) Variable(1, Boolean) = Store Variable(0, Boolean) - Call id(3), args( Integer(2), EmptyTag, ) - Call id(4), args( Bool(true), Tag(0, 5), ) - Call id(4), args( Variable(1, Boolean), Tag(1, 5), ) + Call id(4), args( Integer(2), EmptyTag, ) + Call id(5), args( Bool(true), Tag(0, 5), ) + Call id(5), args( Variable(1, Boolean), Tag(1, 5), ) Return"#]], ); } @@ -166,14 +166,13 @@ fn array_repeat_with_dynamic_content() { &program, mresetz_callable_id, &expect![[r#" - Callable: - name: __quantum__qis__mresetz__body - call_type: Measurement - input_type: - [0]: Qubit - [1]: Result - output_type: - body: "#]], + Callable: + name: __quantum__rt__initialize + call_type: Regular + input_type: + [0]: Pointer + output_type: + body: "#]], ); let array_output_recording_callable_id = CallableId(2); assert_callable( @@ -181,11 +180,11 @@ fn array_repeat_with_dynamic_content() { array_output_recording_callable_id, &expect![[r#" Callable: - name: __quantum__rt__array_record_output - call_type: OutputRecording + name: __quantum__qis__mresetz__body + call_type: Measurement input_type: - [0]: Integer - [1]: Pointer + [0]: Qubit + [1]: Result output_type: body: "#]], ); @@ -195,10 +194,10 @@ fn array_repeat_with_dynamic_content() { result_output_recording_callable_id, &expect![[r#" Callable: - name: __quantum__rt__result_record_output + name: __quantum__rt__array_record_output call_type: OutputRecording input_type: - [0]: Result + [0]: Integer [1]: Pointer output_type: body: "#]], @@ -208,10 +207,11 @@ fn array_repeat_with_dynamic_content() { BlockId(0), &expect![[r#" Block: - Call id(1), args( Qubit(0), Result(0), ) - Call id(2), args( Integer(2), EmptyTag, ) - Call id(3), args( Result(0), Tag(0, 5), ) - Call id(3), args( Result(0), Tag(1, 5), ) + Call id(1), args( Pointer, ) + Call id(2), args( Qubit(0), Result(0), ) + Call id(3), args( Integer(2), EmptyTag, ) + Call id(4), args( Result(0), Tag(0, 5), ) + Call id(4), args( Result(0), Tag(1, 5), ) Return"#]], ); } @@ -234,11 +234,10 @@ fn result_array_value_at_index() { measurement_callable_id, &expect![[r#" Callable: - name: __quantum__qis__mresetz__body - call_type: Measurement + name: __quantum__rt__initialize + call_type: Regular input_type: - [0]: Qubit - [1]: Result + [0]: Pointer output_type: body: "#]], ); @@ -248,11 +247,11 @@ fn result_array_value_at_index() { result_output_recording_callable_id, &expect![[r#" Callable: - name: __quantum__rt__result_record_output - call_type: OutputRecording + name: __quantum__qis__mresetz__body + call_type: Measurement input_type: - [0]: Result - [1]: Pointer + [0]: Qubit + [1]: Result output_type: body: "#]], ); @@ -261,9 +260,10 @@ fn result_array_value_at_index() { BlockId(0), &expect![[r#" Block: - Call id(1), args( Qubit(0), Result(0), ) - Call id(1), args( Qubit(1), Result(1), ) - Call id(2), args( Result(1), Tag(0, 3), ) + Call id(1), args( Pointer, ) + Call id(2), args( Qubit(0), Result(0), ) + Call id(2), args( Qubit(1), Result(1), ) + Call id(3), args( Result(1), Tag(0, 3), ) Return"#]], ); } @@ -326,11 +326,10 @@ fn result_array_slice_with_explicit_range() { measurement_callable_id, &expect![[r#" Callable: - name: __quantum__qis__mresetz__body - call_type: Measurement + name: __quantum__rt__initialize + call_type: Regular input_type: - [0]: Qubit - [1]: Result + [0]: Pointer output_type: body: "#]], ); @@ -340,11 +339,11 @@ fn result_array_slice_with_explicit_range() { array_output_recording_callable_id, &expect![[r#" Callable: - name: __quantum__rt__array_record_output - call_type: OutputRecording + name: __quantum__qis__mresetz__body + call_type: Measurement input_type: - [0]: Integer - [1]: Pointer + [0]: Qubit + [1]: Result output_type: body: "#]], ); @@ -354,10 +353,10 @@ fn result_array_slice_with_explicit_range() { result_output_recording_callable_id, &expect![[r#" Callable: - name: __quantum__rt__result_record_output + name: __quantum__rt__array_record_output call_type: OutputRecording input_type: - [0]: Result + [0]: Integer [1]: Pointer output_type: body: "#]], @@ -367,15 +366,16 @@ fn result_array_slice_with_explicit_range() { BlockId(0), &expect![[r#" Block: - Call id(1), args( Qubit(0), Result(0), ) - Call id(1), args( Qubit(1), Result(1), ) - Call id(1), args( Qubit(2), Result(2), ) - Call id(1), args( Qubit(3), Result(3), ) - Call id(1), args( Qubit(4), Result(4), ) - Call id(2), args( Integer(3), EmptyTag, ) - Call id(3), args( Result(0), Tag(0, 5), ) - Call id(3), args( Result(2), Tag(1, 5), ) - Call id(3), args( Result(4), Tag(2, 5), ) + Call id(1), args( Pointer, ) + Call id(2), args( Qubit(0), Result(0), ) + Call id(2), args( Qubit(1), Result(1), ) + Call id(2), args( Qubit(2), Result(2), ) + Call id(2), args( Qubit(3), Result(3), ) + Call id(2), args( Qubit(4), Result(4), ) + Call id(3), args( Integer(3), EmptyTag, ) + Call id(4), args( Result(0), Tag(0, 5), ) + Call id(4), args( Result(2), Tag(1, 5), ) + Call id(4), args( Result(4), Tag(2, 5), ) Return"#]], ); } @@ -398,11 +398,10 @@ fn result_array_slice_with_open_start_range() { measurement_callable_id, &expect![[r#" Callable: - name: __quantum__qis__mresetz__body - call_type: Measurement + name: __quantum__rt__initialize + call_type: Regular input_type: - [0]: Qubit - [1]: Result + [0]: Pointer output_type: body: "#]], ); @@ -412,11 +411,11 @@ fn result_array_slice_with_open_start_range() { array_output_recording_callable_id, &expect![[r#" Callable: - name: __quantum__rt__array_record_output - call_type: OutputRecording + name: __quantum__qis__mresetz__body + call_type: Measurement input_type: - [0]: Integer - [1]: Pointer + [0]: Qubit + [1]: Result output_type: body: "#]], ); @@ -426,10 +425,10 @@ fn result_array_slice_with_open_start_range() { result_output_recording_callable_id, &expect![[r#" Callable: - name: __quantum__rt__result_record_output + name: __quantum__rt__array_record_output call_type: OutputRecording input_type: - [0]: Result + [0]: Integer [1]: Pointer output_type: body: "#]], @@ -439,12 +438,13 @@ fn result_array_slice_with_open_start_range() { BlockId(0), &expect![[r#" Block: - Call id(1), args( Qubit(0), Result(0), ) - Call id(1), args( Qubit(1), Result(1), ) - Call id(1), args( Qubit(2), Result(2), ) - Call id(2), args( Integer(2), EmptyTag, ) - Call id(3), args( Result(0), Tag(0, 5), ) - Call id(3), args( Result(1), Tag(1, 5), ) + Call id(1), args( Pointer, ) + Call id(2), args( Qubit(0), Result(0), ) + Call id(2), args( Qubit(1), Result(1), ) + Call id(2), args( Qubit(2), Result(2), ) + Call id(3), args( Integer(2), EmptyTag, ) + Call id(4), args( Result(0), Tag(0, 5), ) + Call id(4), args( Result(1), Tag(1, 5), ) Return"#]], ); } @@ -467,11 +467,10 @@ fn result_array_slice_with_open_ended_range() { measurement_callable_id, &expect![[r#" Callable: - name: __quantum__qis__mresetz__body - call_type: Measurement + name: __quantum__rt__initialize + call_type: Regular input_type: - [0]: Qubit - [1]: Result + [0]: Pointer output_type: body: "#]], ); @@ -481,11 +480,11 @@ fn result_array_slice_with_open_ended_range() { array_output_recording_callable_id, &expect![[r#" Callable: - name: __quantum__rt__array_record_output - call_type: OutputRecording + name: __quantum__qis__mresetz__body + call_type: Measurement input_type: - [0]: Integer - [1]: Pointer + [0]: Qubit + [1]: Result output_type: body: "#]], ); @@ -495,10 +494,10 @@ fn result_array_slice_with_open_ended_range() { result_output_recording_callable_id, &expect![[r#" Callable: - name: __quantum__rt__result_record_output + name: __quantum__rt__array_record_output call_type: OutputRecording input_type: - [0]: Result + [0]: Integer [1]: Pointer output_type: body: "#]], @@ -508,12 +507,13 @@ fn result_array_slice_with_open_ended_range() { BlockId(0), &expect![[r#" Block: - Call id(1), args( Qubit(0), Result(0), ) - Call id(1), args( Qubit(1), Result(1), ) - Call id(1), args( Qubit(2), Result(2), ) - Call id(2), args( Integer(2), EmptyTag, ) - Call id(3), args( Result(1), Tag(0, 5), ) - Call id(3), args( Result(2), Tag(1, 5), ) + Call id(1), args( Pointer, ) + Call id(2), args( Qubit(0), Result(0), ) + Call id(2), args( Qubit(1), Result(1), ) + Call id(2), args( Qubit(2), Result(2), ) + Call id(3), args( Integer(2), EmptyTag, ) + Call id(4), args( Result(1), Tag(0, 5), ) + Call id(4), args( Result(2), Tag(1, 5), ) Return"#]], ); } @@ -536,11 +536,10 @@ fn result_array_slice_with_open_two_step_range() { measurement_callable_id, &expect![[r#" Callable: - name: __quantum__qis__mresetz__body - call_type: Measurement + name: __quantum__rt__initialize + call_type: Regular input_type: - [0]: Qubit - [1]: Result + [0]: Pointer output_type: body: "#]], ); @@ -550,11 +549,11 @@ fn result_array_slice_with_open_two_step_range() { array_output_recording_callable_id, &expect![[r#" Callable: - name: __quantum__rt__array_record_output - call_type: OutputRecording + name: __quantum__qis__mresetz__body + call_type: Measurement input_type: - [0]: Integer - [1]: Pointer + [0]: Qubit + [1]: Result output_type: body: "#]], ); @@ -564,10 +563,10 @@ fn result_array_slice_with_open_two_step_range() { result_output_recording_callable_id, &expect![[r#" Callable: - name: __quantum__rt__result_record_output + name: __quantum__rt__array_record_output call_type: OutputRecording input_type: - [0]: Result + [0]: Integer [1]: Pointer output_type: body: "#]], @@ -577,15 +576,16 @@ fn result_array_slice_with_open_two_step_range() { BlockId(0), &expect![[r#" Block: - Call id(1), args( Qubit(0), Result(0), ) - Call id(1), args( Qubit(1), Result(1), ) - Call id(1), args( Qubit(2), Result(2), ) - Call id(1), args( Qubit(3), Result(3), ) - Call id(1), args( Qubit(4), Result(4), ) - Call id(2), args( Integer(3), EmptyTag, ) - Call id(3), args( Result(0), Tag(0, 5), ) - Call id(3), args( Result(2), Tag(1, 5), ) - Call id(3), args( Result(4), Tag(2, 5), ) + Call id(1), args( Pointer, ) + Call id(2), args( Qubit(0), Result(0), ) + Call id(2), args( Qubit(1), Result(1), ) + Call id(2), args( Qubit(2), Result(2), ) + Call id(2), args( Qubit(3), Result(3), ) + Call id(2), args( Qubit(4), Result(4), ) + Call id(3), args( Integer(3), EmptyTag, ) + Call id(4), args( Result(0), Tag(0, 5), ) + Call id(4), args( Result(2), Tag(1, 5), ) + Call id(4), args( Result(4), Tag(2, 5), ) Return"#]], ); } @@ -628,11 +628,10 @@ fn result_array_copy_and_update_with_single_index() { measurement_callable_id, &expect![[r#" Callable: - name: __quantum__qis__mresetz__body - call_type: Measurement + name: __quantum__rt__initialize + call_type: Regular input_type: - [0]: Qubit - [1]: Result + [0]: Pointer output_type: body: "#]], ); @@ -642,11 +641,11 @@ fn result_array_copy_and_update_with_single_index() { array_output_recording_callable_id, &expect![[r#" Callable: - name: __quantum__rt__array_record_output - call_type: OutputRecording + name: __quantum__qis__mresetz__body + call_type: Measurement input_type: - [0]: Integer - [1]: Pointer + [0]: Qubit + [1]: Result output_type: body: "#]], ); @@ -656,10 +655,10 @@ fn result_array_copy_and_update_with_single_index() { result_output_recording_callable_id, &expect![[r#" Callable: - name: __quantum__rt__result_record_output + name: __quantum__rt__array_record_output call_type: OutputRecording input_type: - [0]: Result + [0]: Integer [1]: Pointer output_type: body: "#]], @@ -669,14 +668,15 @@ fn result_array_copy_and_update_with_single_index() { BlockId(0), &expect![[r#" Block: - Call id(1), args( Qubit(0), Result(0), ) - Call id(1), args( Qubit(1), Result(1), ) - Call id(1), args( Qubit(2), Result(2), ) - Call id(1), args( Qubit(3), Result(3), ) - Call id(2), args( Integer(3), EmptyTag, ) - Call id(3), args( Result(0), Tag(0, 5), ) - Call id(3), args( Result(3), Tag(1, 5), ) - Call id(3), args( Result(2), Tag(2, 5), ) + Call id(1), args( Pointer, ) + Call id(2), args( Qubit(0), Result(0), ) + Call id(2), args( Qubit(1), Result(1), ) + Call id(2), args( Qubit(2), Result(2), ) + Call id(2), args( Qubit(3), Result(3), ) + Call id(3), args( Integer(3), EmptyTag, ) + Call id(4), args( Result(0), Tag(0, 5), ) + Call id(4), args( Result(3), Tag(1, 5), ) + Call id(4), args( Result(2), Tag(2, 5), ) Return"#]], ); } @@ -740,11 +740,10 @@ fn result_array_copy_and_update_with_explicit_range() { measurement_callable_id, &expect![[r#" Callable: - name: __quantum__qis__mresetz__body - call_type: Measurement + name: __quantum__rt__initialize + call_type: Regular input_type: - [0]: Qubit - [1]: Result + [0]: Pointer output_type: body: "#]], ); @@ -754,11 +753,11 @@ fn result_array_copy_and_update_with_explicit_range() { array_output_recording_callable_id, &expect![[r#" Callable: - name: __quantum__rt__array_record_output - call_type: OutputRecording + name: __quantum__qis__mresetz__body + call_type: Measurement input_type: - [0]: Integer - [1]: Pointer + [0]: Qubit + [1]: Result output_type: body: "#]], ); @@ -768,10 +767,10 @@ fn result_array_copy_and_update_with_explicit_range() { result_output_recording_callable_id, &expect![[r#" Callable: - name: __quantum__rt__result_record_output + name: __quantum__rt__array_record_output call_type: OutputRecording input_type: - [0]: Result + [0]: Integer [1]: Pointer output_type: body: "#]], @@ -781,20 +780,21 @@ fn result_array_copy_and_update_with_explicit_range() { BlockId(0), &expect![[r#" Block: - Call id(1), args( Qubit(0), Result(0), ) - Call id(1), args( Qubit(1), Result(1), ) - Call id(1), args( Qubit(2), Result(2), ) - Call id(1), args( Qubit(3), Result(3), ) - Call id(1), args( Qubit(4), Result(4), ) - Call id(1), args( Qubit(5), Result(5), ) - Call id(1), args( Qubit(6), Result(6), ) - Call id(1), args( Qubit(7), Result(7), ) - Call id(2), args( Integer(5), EmptyTag, ) - Call id(3), args( Result(5), Tag(0, 5), ) - Call id(3), args( Result(1), Tag(1, 5), ) - Call id(3), args( Result(6), Tag(2, 5), ) - Call id(3), args( Result(3), Tag(3, 5), ) - Call id(3), args( Result(7), Tag(4, 5), ) + Call id(1), args( Pointer, ) + Call id(2), args( Qubit(0), Result(0), ) + Call id(2), args( Qubit(1), Result(1), ) + Call id(2), args( Qubit(2), Result(2), ) + Call id(2), args( Qubit(3), Result(3), ) + Call id(2), args( Qubit(4), Result(4), ) + Call id(2), args( Qubit(5), Result(5), ) + Call id(2), args( Qubit(6), Result(6), ) + Call id(2), args( Qubit(7), Result(7), ) + Call id(3), args( Integer(5), EmptyTag, ) + Call id(4), args( Result(5), Tag(0, 5), ) + Call id(4), args( Result(1), Tag(1, 5), ) + Call id(4), args( Result(6), Tag(2, 5), ) + Call id(4), args( Result(3), Tag(3, 5), ) + Call id(4), args( Result(7), Tag(4, 5), ) Return"#]], ); } @@ -817,11 +817,10 @@ fn result_array_copy_and_update_with_open_start_range() { measurement_callable_id, &expect![[r#" Callable: - name: __quantum__qis__mresetz__body - call_type: Measurement + name: __quantum__rt__initialize + call_type: Regular input_type: - [0]: Qubit - [1]: Result + [0]: Pointer output_type: body: "#]], ); @@ -831,11 +830,11 @@ fn result_array_copy_and_update_with_open_start_range() { array_output_recording_callable_id, &expect![[r#" Callable: - name: __quantum__rt__array_record_output - call_type: OutputRecording + name: __quantum__qis__mresetz__body + call_type: Measurement input_type: - [0]: Integer - [1]: Pointer + [0]: Qubit + [1]: Result output_type: body: "#]], ); @@ -845,10 +844,10 @@ fn result_array_copy_and_update_with_open_start_range() { result_output_recording_callable_id, &expect![[r#" Callable: - name: __quantum__rt__result_record_output + name: __quantum__rt__array_record_output call_type: OutputRecording input_type: - [0]: Result + [0]: Integer [1]: Pointer output_type: body: "#]], @@ -858,15 +857,16 @@ fn result_array_copy_and_update_with_open_start_range() { BlockId(0), &expect![[r#" Block: - Call id(1), args( Qubit(0), Result(0), ) - Call id(1), args( Qubit(1), Result(1), ) - Call id(1), args( Qubit(2), Result(2), ) - Call id(1), args( Qubit(3), Result(3), ) - Call id(1), args( Qubit(4), Result(4), ) - Call id(2), args( Integer(3), EmptyTag, ) - Call id(3), args( Result(3), Tag(0, 5), ) - Call id(3), args( Result(4), Tag(1, 5), ) - Call id(3), args( Result(2), Tag(2, 5), ) + Call id(1), args( Pointer, ) + Call id(2), args( Qubit(0), Result(0), ) + Call id(2), args( Qubit(1), Result(1), ) + Call id(2), args( Qubit(2), Result(2), ) + Call id(2), args( Qubit(3), Result(3), ) + Call id(2), args( Qubit(4), Result(4), ) + Call id(3), args( Integer(3), EmptyTag, ) + Call id(4), args( Result(3), Tag(0, 5), ) + Call id(4), args( Result(4), Tag(1, 5), ) + Call id(4), args( Result(2), Tag(2, 5), ) Return"#]], ); } @@ -889,11 +889,10 @@ fn result_array_copy_and_update_with_open_ended_range() { measurement_callable_id, &expect![[r#" Callable: - name: __quantum__qis__mresetz__body - call_type: Measurement + name: __quantum__rt__initialize + call_type: Regular input_type: - [0]: Qubit - [1]: Result + [0]: Pointer output_type: body: "#]], ); @@ -903,11 +902,11 @@ fn result_array_copy_and_update_with_open_ended_range() { array_output_recording_callable_id, &expect![[r#" Callable: - name: __quantum__rt__array_record_output - call_type: OutputRecording + name: __quantum__qis__mresetz__body + call_type: Measurement input_type: - [0]: Integer - [1]: Pointer + [0]: Qubit + [1]: Result output_type: body: "#]], ); @@ -917,10 +916,10 @@ fn result_array_copy_and_update_with_open_ended_range() { result_output_recording_callable_id, &expect![[r#" Callable: - name: __quantum__rt__result_record_output + name: __quantum__rt__array_record_output call_type: OutputRecording input_type: - [0]: Result + [0]: Integer [1]: Pointer output_type: body: "#]], @@ -930,15 +929,16 @@ fn result_array_copy_and_update_with_open_ended_range() { BlockId(0), &expect![[r#" Block: - Call id(1), args( Qubit(0), Result(0), ) - Call id(1), args( Qubit(1), Result(1), ) - Call id(1), args( Qubit(2), Result(2), ) - Call id(1), args( Qubit(3), Result(3), ) - Call id(1), args( Qubit(4), Result(4), ) - Call id(2), args( Integer(3), EmptyTag, ) - Call id(3), args( Result(0), Tag(0, 5), ) - Call id(3), args( Result(3), Tag(1, 5), ) - Call id(3), args( Result(4), Tag(2, 5), ) + Call id(1), args( Pointer, ) + Call id(2), args( Qubit(0), Result(0), ) + Call id(2), args( Qubit(1), Result(1), ) + Call id(2), args( Qubit(2), Result(2), ) + Call id(2), args( Qubit(3), Result(3), ) + Call id(2), args( Qubit(4), Result(4), ) + Call id(3), args( Integer(3), EmptyTag, ) + Call id(4), args( Result(0), Tag(0, 5), ) + Call id(4), args( Result(3), Tag(1, 5), ) + Call id(4), args( Result(4), Tag(2, 5), ) Return"#]], ); } @@ -961,11 +961,10 @@ fn result_array_copy_and_update_with_open_two_step_range() { measurement_callable_id, &expect![[r#" Callable: - name: __quantum__qis__mresetz__body - call_type: Measurement + name: __quantum__rt__initialize + call_type: Regular input_type: - [0]: Qubit - [1]: Result + [0]: Pointer output_type: body: "#]], ); @@ -975,11 +974,11 @@ fn result_array_copy_and_update_with_open_two_step_range() { array_output_recording_callable_id, &expect![[r#" Callable: - name: __quantum__rt__array_record_output - call_type: OutputRecording + name: __quantum__qis__mresetz__body + call_type: Measurement input_type: - [0]: Integer - [1]: Pointer + [0]: Qubit + [1]: Result output_type: body: "#]], ); @@ -989,10 +988,10 @@ fn result_array_copy_and_update_with_open_two_step_range() { result_output_recording_callable_id, &expect![[r#" Callable: - name: __quantum__rt__result_record_output + name: __quantum__rt__array_record_output call_type: OutputRecording input_type: - [0]: Result + [0]: Integer [1]: Pointer output_type: body: "#]], @@ -1002,15 +1001,16 @@ fn result_array_copy_and_update_with_open_two_step_range() { BlockId(0), &expect![[r#" Block: - Call id(1), args( Qubit(0), Result(0), ) - Call id(1), args( Qubit(1), Result(1), ) - Call id(1), args( Qubit(2), Result(2), ) - Call id(1), args( Qubit(3), Result(3), ) - Call id(1), args( Qubit(4), Result(4), ) - Call id(2), args( Integer(3), EmptyTag, ) - Call id(3), args( Result(3), Tag(0, 5), ) - Call id(3), args( Result(1), Tag(1, 5), ) - Call id(3), args( Result(4), Tag(2, 5), ) + Call id(1), args( Pointer, ) + Call id(2), args( Qubit(0), Result(0), ) + Call id(2), args( Qubit(1), Result(1), ) + Call id(2), args( Qubit(2), Result(2), ) + Call id(2), args( Qubit(3), Result(3), ) + Call id(2), args( Qubit(4), Result(4), ) + Call id(3), args( Integer(3), EmptyTag, ) + Call id(4), args( Result(3), Tag(0, 5), ) + Call id(4), args( Result(1), Tag(1, 5), ) + Call id(4), args( Result(4), Tag(2, 5), ) Return"#]], ); } diff --git a/source/compiler/qsc_partial_eval/src/tests/assigns.rs b/source/compiler/qsc_partial_eval/src/tests/assigns.rs index 3662baacfb..c7091f210e 100644 --- a/source/compiler/qsc_partial_eval/src/tests/assigns.rs +++ b/source/compiler/qsc_partial_eval/src/tests/assigns.rs @@ -57,11 +57,10 @@ fn assigning_result_register_updates_value() { measurement_callable_id, &expect![[r#" Callable: - name: __quantum__qis__mresetz__body - call_type: Measurement + name: __quantum__rt__initialize + call_type: Regular input_type: - [0]: Qubit - [1]: Result + [0]: Pointer output_type: body: "#]], ); @@ -71,11 +70,11 @@ fn assigning_result_register_updates_value() { output_recording_callable_id, &expect![[r#" Callable: - name: __quantum__rt__result_record_output - call_type: OutputRecording + name: __quantum__qis__mresetz__body + call_type: Measurement input_type: - [0]: Result - [1]: Pointer + [0]: Qubit + [1]: Result output_type: body: "#]], ); @@ -84,8 +83,9 @@ fn assigning_result_register_updates_value() { BlockId(0), &expect![[r#" Block: - Call id(1), args( Qubit(0), Result(0), ) - Call id(2), args( Result(0), Tag(0, 3), ) + Call id(1), args( Pointer, ) + Call id(2), args( Qubit(0), Result(0), ) + Call id(3), args( Result(0), Tag(0, 3), ) Return"#]], ); } @@ -109,11 +109,10 @@ fn assigning_classical_bool_updates_value_and_adds_store_instructions() { output_recording_callable_id, &expect![[r#" Callable: - name: __quantum__rt__bool_record_output - call_type: OutputRecording + name: __quantum__rt__initialize + call_type: Regular input_type: - [0]: Boolean - [1]: Pointer + [0]: Pointer output_type: body: "#]], ); @@ -122,9 +121,10 @@ fn assigning_classical_bool_updates_value_and_adds_store_instructions() { BlockId(0), &expect![[r#" Block: + Call id(1), args( Pointer, ) Variable(0, Boolean) = Store Bool(true) Variable(0, Boolean) = Store Bool(false) - Call id(1), args( Bool(false), Tag(0, 3), ) + Call id(2), args( Bool(false), Tag(0, 3), ) Return"#]], ); } @@ -148,11 +148,10 @@ fn assigning_dynamic_bool_updates_value_and_adds_store_instructions() { measurement_callable_id, &expect![[r#" Callable: - name: __quantum__qis__mresetz__body - call_type: Measurement + name: __quantum__rt__initialize + call_type: Regular input_type: - [0]: Qubit - [1]: Result + [0]: Pointer output_type: body: "#]], ); @@ -162,11 +161,12 @@ fn assigning_dynamic_bool_updates_value_and_adds_store_instructions() { readout_callable_id, &expect![[r#" Callable: - name: __quantum__rt__read_result - call_type: Readout + name: __quantum__qis__mresetz__body + call_type: Measurement input_type: - [0]: Result - output_type: Boolean + [0]: Qubit + [1]: Result + output_type: body: "#]], ); let output_recording_callable_id = CallableId(3); @@ -175,12 +175,11 @@ fn assigning_dynamic_bool_updates_value_and_adds_store_instructions() { output_recording_callable_id, &expect![[r#" Callable: - name: __quantum__rt__bool_record_output - call_type: OutputRecording + name: __quantum__rt__read_result + call_type: Readout input_type: - [0]: Boolean - [1]: Pointer - output_type: + [0]: Result + output_type: Boolean body: "#]], ); assert_block_instructions( @@ -188,13 +187,14 @@ fn assigning_dynamic_bool_updates_value_and_adds_store_instructions() { BlockId(0), &expect![[r#" Block: + Call id(1), args( Pointer, ) Variable(0, Boolean) = Store Bool(false) - Call id(1), args( Qubit(0), Result(0), ) - Variable(1, Boolean) = Call id(2), args( Result(0), ) + Call id(2), args( Qubit(0), Result(0), ) + Variable(1, Boolean) = Call id(3), args( Result(0), ) Variable(2, Boolean) = Store Variable(1, Boolean) Variable(0, Boolean) = Store Variable(2, Boolean) Variable(3, Boolean) = Store Variable(0, Boolean) - Call id(3), args( Variable(3, Boolean), Tag(0, 3), ) + Call id(4), args( Variable(3, Boolean), Tag(0, 3), ) Return"#]], ); } @@ -218,11 +218,10 @@ fn assigning_classical_int_updates_value_and_adds_store_instructions() { output_recording_callable_id, &expect![[r#" Callable: - name: __quantum__rt__int_record_output - call_type: OutputRecording + name: __quantum__rt__initialize + call_type: Regular input_type: - [0]: Integer - [1]: Pointer + [0]: Pointer output_type: body: "#]], ); @@ -231,9 +230,10 @@ fn assigning_classical_int_updates_value_and_adds_store_instructions() { BlockId(0), &expect![[r#" Block: + Call id(1), args( Pointer, ) Variable(0, Integer) = Store Integer(0) Variable(0, Integer) = Store Integer(1) - Call id(1), args( Integer(1), Tag(0, 3), ) + Call id(2), args( Integer(1), Tag(0, 3), ) Return"#]], ); } @@ -257,11 +257,10 @@ fn assigning_dynamic_int_updates_value_and_adds_store_instructions() { measurement_callable_id, &expect![[r#" Callable: - name: __quantum__qis__mresetz__body - call_type: Measurement + name: __quantum__rt__initialize + call_type: Regular input_type: - [0]: Qubit - [1]: Result + [0]: Pointer output_type: body: "#]], ); @@ -271,11 +270,12 @@ fn assigning_dynamic_int_updates_value_and_adds_store_instructions() { readout_callable_id, &expect![[r#" Callable: - name: __quantum__rt__read_result - call_type: Readout + name: __quantum__qis__mresetz__body + call_type: Measurement input_type: - [0]: Result - output_type: Boolean + [0]: Qubit + [1]: Result + output_type: body: "#]], ); let output_recording_callable_id = CallableId(3); @@ -284,12 +284,11 @@ fn assigning_dynamic_int_updates_value_and_adds_store_instructions() { output_recording_callable_id, &expect![[r#" Callable: - name: __quantum__rt__int_record_output - call_type: OutputRecording + name: __quantum__rt__read_result + call_type: Readout input_type: - [0]: Integer - [1]: Pointer - output_type: + [0]: Result + output_type: Boolean body: "#]], ); assert_blocks( @@ -297,15 +296,16 @@ fn assigning_dynamic_int_updates_value_and_adds_store_instructions() { &expect![[r#" Blocks: Block 0:Block: + Call id(1), args( Pointer, ) Variable(0, Integer) = Store Integer(0) - Call id(1), args( Qubit(0), Result(0), ) - Variable(1, Boolean) = Call id(2), args( Result(0), ) + Call id(2), args( Qubit(0), Result(0), ) + Variable(1, Boolean) = Call id(3), args( Result(0), ) Variable(2, Boolean) = Store Variable(1, Boolean) Branch Variable(2, Boolean), 2, 3 Block 1:Block: Variable(0, Integer) = Store Variable(3, Integer) Variable(4, Integer) = Store Variable(0, Integer) - Call id(3), args( Variable(4, Integer), Tag(0, 3), ) + Call id(4), args( Variable(4, Integer), Tag(0, 3), ) Return Block 2:Block: Variable(3, Integer) = Store Integer(1) @@ -337,11 +337,10 @@ fn assigning_classical_bool_within_dynamic_if_expression_adds_store_instruction( measurement_callable_id, &expect![[r#" Callable: - name: __quantum__qis__mresetz__body - call_type: Measurement + name: __quantum__rt__initialize + call_type: Regular input_type: - [0]: Qubit - [1]: Result + [0]: Pointer output_type: body: "#]], ); @@ -351,11 +350,12 @@ fn assigning_classical_bool_within_dynamic_if_expression_adds_store_instruction( readout_callable_id, &expect![[r#" Callable: - name: __quantum__rt__read_result - call_type: Readout + name: __quantum__qis__mresetz__body + call_type: Measurement input_type: - [0]: Result - output_type: Boolean + [0]: Qubit + [1]: Result + output_type: body: "#]], ); let output_recording_callable_id = CallableId(3); @@ -364,12 +364,11 @@ fn assigning_classical_bool_within_dynamic_if_expression_adds_store_instruction( output_recording_callable_id, &expect![[r#" Callable: - name: __quantum__rt__bool_record_output - call_type: OutputRecording + name: __quantum__rt__read_result + call_type: Readout input_type: - [0]: Boolean - [1]: Pointer - output_type: + [0]: Result + output_type: Boolean body: "#]], ); assert_blocks( @@ -377,14 +376,15 @@ fn assigning_classical_bool_within_dynamic_if_expression_adds_store_instruction( &expect![[r#" Blocks: Block 0:Block: + Call id(1), args( Pointer, ) Variable(0, Boolean) = Store Bool(false) - Call id(1), args( Qubit(0), Result(0), ) - Variable(1, Boolean) = Call id(2), args( Result(0), ) + Call id(2), args( Qubit(0), Result(0), ) + Variable(1, Boolean) = Call id(3), args( Result(0), ) Variable(2, Boolean) = Store Variable(1, Boolean) Branch Variable(2, Boolean), 2, 1 Block 1:Block: Variable(3, Boolean) = Store Variable(0, Boolean) - Call id(3), args( Variable(3, Boolean), Tag(0, 3), ) + Call id(4), args( Variable(3, Boolean), Tag(0, 3), ) Return Block 2:Block: Variable(0, Boolean) = Store Bool(true) @@ -415,11 +415,10 @@ fn assigning_classical_int_within_dynamic_if_else_expression_adds_store_instruct measurement_callable_id, &expect![[r#" Callable: - name: __quantum__qis__mresetz__body - call_type: Measurement + name: __quantum__rt__initialize + call_type: Regular input_type: - [0]: Qubit - [1]: Result + [0]: Pointer output_type: body: "#]], ); @@ -429,11 +428,12 @@ fn assigning_classical_int_within_dynamic_if_else_expression_adds_store_instruct readout_callable_id, &expect![[r#" Callable: - name: __quantum__rt__read_result - call_type: Readout + name: __quantum__qis__mresetz__body + call_type: Measurement input_type: - [0]: Result - output_type: Boolean + [0]: Qubit + [1]: Result + output_type: body: "#]], ); let output_recording_callable_id = CallableId(3); @@ -442,12 +442,11 @@ fn assigning_classical_int_within_dynamic_if_else_expression_adds_store_instruct output_recording_callable_id, &expect![[r#" Callable: - name: __quantum__rt__int_record_output - call_type: OutputRecording + name: __quantum__rt__read_result + call_type: Readout input_type: - [0]: Integer - [1]: Pointer - output_type: + [0]: Result + output_type: Boolean body: "#]], ); assert_blocks( @@ -455,14 +454,15 @@ fn assigning_classical_int_within_dynamic_if_else_expression_adds_store_instruct &expect![[r#" Blocks: Block 0:Block: + Call id(1), args( Pointer, ) Variable(0, Integer) = Store Integer(0) - Call id(1), args( Qubit(0), Result(0), ) - Variable(1, Boolean) = Call id(2), args( Result(0), ) + Call id(2), args( Qubit(0), Result(0), ) + Variable(1, Boolean) = Call id(3), args( Result(0), ) Variable(2, Boolean) = Icmp Eq, Variable(1, Boolean), Bool(false) Branch Variable(2, Boolean), 2, 3 Block 1:Block: Variable(3, Integer) = Store Variable(0, Integer) - Call id(3), args( Variable(3, Integer), Tag(0, 3), ) + Call id(4), args( Variable(3, Integer), Tag(0, 3), ) Return Block 2:Block: Variable(0, Integer) = Store Integer(1) @@ -515,11 +515,10 @@ fn array_of_results_update_element_at_index_with_dynamic_content() { measurement_callable_id, &expect![[r#" Callable: - name: __quantum__qis__mresetz__body - call_type: Measurement + name: __quantum__rt__initialize + call_type: Regular input_type: - [0]: Qubit - [1]: Result + [0]: Pointer output_type: body: "#]], ); @@ -529,11 +528,11 @@ fn array_of_results_update_element_at_index_with_dynamic_content() { array_output_recording_callable_id, &expect![[r#" Callable: - name: __quantum__rt__array_record_output - call_type: OutputRecording + name: __quantum__qis__mresetz__body + call_type: Measurement input_type: - [0]: Integer - [1]: Pointer + [0]: Qubit + [1]: Result output_type: body: "#]], ); @@ -543,10 +542,10 @@ fn array_of_results_update_element_at_index_with_dynamic_content() { result_output_recording_callable_id, &expect![[r#" Callable: - name: __quantum__rt__result_record_output + name: __quantum__rt__array_record_output call_type: OutputRecording input_type: - [0]: Result + [0]: Integer [1]: Pointer output_type: body: "#]], @@ -556,11 +555,12 @@ fn array_of_results_update_element_at_index_with_dynamic_content() { BlockId(0), &expect![[r#" Block: - Call id(1), args( Qubit(0), Result(0), ) - Call id(1), args( Qubit(1), Result(1), ) - Call id(2), args( Integer(2), EmptyTag, ) - Call id(3), args( Result(0), Tag(0, 5), ) - Call id(3), args( Result(1), Tag(1, 5), ) + Call id(1), args( Pointer, ) + Call id(2), args( Qubit(0), Result(0), ) + Call id(2), args( Qubit(1), Result(1), ) + Call id(3), args( Integer(2), EmptyTag, ) + Call id(4), args( Result(0), Tag(0, 5), ) + Call id(4), args( Result(1), Tag(1, 5), ) Return"#]], ); } @@ -584,11 +584,10 @@ fn array_of_bools_update_element_at_index_with_dynamic_content() { measurement_callable_id, &expect![[r#" Callable: - name: __quantum__qis__mresetz__body - call_type: Measurement + name: __quantum__rt__initialize + call_type: Regular input_type: - [0]: Qubit - [1]: Result + [0]: Pointer output_type: body: "#]], ); @@ -598,11 +597,12 @@ fn array_of_bools_update_element_at_index_with_dynamic_content() { readout_callable_id, &expect![[r#" Callable: - name: __quantum__rt__read_result - call_type: Readout + name: __quantum__qis__mresetz__body + call_type: Measurement input_type: - [0]: Result - output_type: Boolean + [0]: Qubit + [1]: Result + output_type: body: "#]], ); let array_output_recording_callable_id = CallableId(3); @@ -611,12 +611,11 @@ fn array_of_bools_update_element_at_index_with_dynamic_content() { array_output_recording_callable_id, &expect![[r#" Callable: - name: __quantum__rt__array_record_output - call_type: OutputRecording + name: __quantum__rt__read_result + call_type: Readout input_type: - [0]: Integer - [1]: Pointer - output_type: + [0]: Result + output_type: Boolean body: "#]], ); let bool_output_recording_callable_id = CallableId(4); @@ -625,10 +624,10 @@ fn array_of_bools_update_element_at_index_with_dynamic_content() { bool_output_recording_callable_id, &expect![[r#" Callable: - name: __quantum__rt__bool_record_output + name: __quantum__rt__array_record_output call_type: OutputRecording input_type: - [0]: Boolean + [0]: Integer [1]: Pointer output_type: body: "#]], @@ -638,15 +637,16 @@ fn array_of_bools_update_element_at_index_with_dynamic_content() { BlockId(0), &expect![[r#" Block: - Call id(1), args( Qubit(0), Result(0), ) - Variable(0, Boolean) = Call id(2), args( Result(0), ) + Call id(1), args( Pointer, ) + Call id(2), args( Qubit(0), Result(0), ) + Variable(0, Boolean) = Call id(3), args( Result(0), ) Variable(1, Boolean) = Icmp Eq, Variable(0, Boolean), Bool(false) - Call id(1), args( Qubit(1), Result(1), ) - Variable(2, Boolean) = Call id(2), args( Result(1), ) + Call id(2), args( Qubit(1), Result(1), ) + Variable(2, Boolean) = Call id(3), args( Result(1), ) Variable(3, Boolean) = Store Variable(2, Boolean) - Call id(3), args( Integer(2), EmptyTag, ) - Call id(4), args( Variable(1, Boolean), Tag(0, 5), ) - Call id(4), args( Variable(3, Boolean), Tag(1, 5), ) + Call id(4), args( Integer(2), EmptyTag, ) + Call id(5), args( Variable(1, Boolean), Tag(0, 5), ) + Call id(5), args( Variable(3, Boolean), Tag(1, 5), ) Return"#]], ); } @@ -713,11 +713,10 @@ fn array_of_results_update_slice_with_explicit_range() { measurement_callable_id, &expect![[r#" Callable: - name: __quantum__qis__mresetz__body - call_type: Measurement + name: __quantum__rt__initialize + call_type: Regular input_type: - [0]: Qubit - [1]: Result + [0]: Pointer output_type: body: "#]], ); @@ -727,11 +726,11 @@ fn array_of_results_update_slice_with_explicit_range() { array_output_recording_callable_id, &expect![[r#" Callable: - name: __quantum__rt__array_record_output - call_type: OutputRecording + name: __quantum__qis__mresetz__body + call_type: Measurement input_type: - [0]: Integer - [1]: Pointer + [0]: Qubit + [1]: Result output_type: body: "#]], ); @@ -741,10 +740,10 @@ fn array_of_results_update_slice_with_explicit_range() { result_output_recording_callable_id, &expect![[r#" Callable: - name: __quantum__rt__result_record_output + name: __quantum__rt__array_record_output call_type: OutputRecording input_type: - [0]: Result + [0]: Integer [1]: Pointer output_type: body: "#]], @@ -754,20 +753,21 @@ fn array_of_results_update_slice_with_explicit_range() { BlockId(0), &expect![[r#" Block: - Call id(1), args( Qubit(0), Result(0), ) - Call id(1), args( Qubit(1), Result(1), ) - Call id(1), args( Qubit(2), Result(2), ) - Call id(1), args( Qubit(3), Result(3), ) - Call id(1), args( Qubit(4), Result(4), ) - Call id(1), args( Qubit(5), Result(5), ) - Call id(1), args( Qubit(6), Result(6), ) - Call id(1), args( Qubit(7), Result(7), ) - Call id(2), args( Integer(5), EmptyTag, ) - Call id(3), args( Result(5), Tag(0, 5), ) - Call id(3), args( Result(1), Tag(1, 5), ) - Call id(3), args( Result(6), Tag(2, 5), ) - Call id(3), args( Result(3), Tag(3, 5), ) - Call id(3), args( Result(7), Tag(4, 5), ) + Call id(1), args( Pointer, ) + Call id(2), args( Qubit(0), Result(0), ) + Call id(2), args( Qubit(1), Result(1), ) + Call id(2), args( Qubit(2), Result(2), ) + Call id(2), args( Qubit(3), Result(3), ) + Call id(2), args( Qubit(4), Result(4), ) + Call id(2), args( Qubit(5), Result(5), ) + Call id(2), args( Qubit(6), Result(6), ) + Call id(2), args( Qubit(7), Result(7), ) + Call id(3), args( Integer(5), EmptyTag, ) + Call id(4), args( Result(5), Tag(0, 5), ) + Call id(4), args( Result(1), Tag(1, 5), ) + Call id(4), args( Result(6), Tag(2, 5), ) + Call id(4), args( Result(3), Tag(3, 5), ) + Call id(4), args( Result(7), Tag(4, 5), ) Return"#]], ); } @@ -791,11 +791,10 @@ fn array_of_results_update_slice_with_open_start_range() { measurement_callable_id, &expect![[r#" Callable: - name: __quantum__qis__mresetz__body - call_type: Measurement + name: __quantum__rt__initialize + call_type: Regular input_type: - [0]: Qubit - [1]: Result + [0]: Pointer output_type: body: "#]], ); @@ -805,11 +804,11 @@ fn array_of_results_update_slice_with_open_start_range() { array_output_recording_callable_id, &expect![[r#" Callable: - name: __quantum__rt__array_record_output - call_type: OutputRecording + name: __quantum__qis__mresetz__body + call_type: Measurement input_type: - [0]: Integer - [1]: Pointer + [0]: Qubit + [1]: Result output_type: body: "#]], ); @@ -819,10 +818,10 @@ fn array_of_results_update_slice_with_open_start_range() { result_output_recording_callable_id, &expect![[r#" Callable: - name: __quantum__rt__result_record_output + name: __quantum__rt__array_record_output call_type: OutputRecording input_type: - [0]: Result + [0]: Integer [1]: Pointer output_type: body: "#]], @@ -832,15 +831,16 @@ fn array_of_results_update_slice_with_open_start_range() { BlockId(0), &expect![[r#" Block: - Call id(1), args( Qubit(0), Result(0), ) - Call id(1), args( Qubit(1), Result(1), ) - Call id(1), args( Qubit(2), Result(2), ) - Call id(1), args( Qubit(3), Result(3), ) - Call id(1), args( Qubit(4), Result(4), ) - Call id(2), args( Integer(3), EmptyTag, ) - Call id(3), args( Result(3), Tag(0, 5), ) - Call id(3), args( Result(4), Tag(1, 5), ) - Call id(3), args( Result(2), Tag(2, 5), ) + Call id(1), args( Pointer, ) + Call id(2), args( Qubit(0), Result(0), ) + Call id(2), args( Qubit(1), Result(1), ) + Call id(2), args( Qubit(2), Result(2), ) + Call id(2), args( Qubit(3), Result(3), ) + Call id(2), args( Qubit(4), Result(4), ) + Call id(3), args( Integer(3), EmptyTag, ) + Call id(4), args( Result(3), Tag(0, 5), ) + Call id(4), args( Result(4), Tag(1, 5), ) + Call id(4), args( Result(2), Tag(2, 5), ) Return"#]], ); } @@ -864,11 +864,10 @@ fn array_of_results_update_slice_with_open_ended_range() { measurement_callable_id, &expect![[r#" Callable: - name: __quantum__qis__mresetz__body - call_type: Measurement + name: __quantum__rt__initialize + call_type: Regular input_type: - [0]: Qubit - [1]: Result + [0]: Pointer output_type: body: "#]], ); @@ -878,11 +877,11 @@ fn array_of_results_update_slice_with_open_ended_range() { array_output_recording_callable_id, &expect![[r#" Callable: - name: __quantum__rt__array_record_output - call_type: OutputRecording + name: __quantum__qis__mresetz__body + call_type: Measurement input_type: - [0]: Integer - [1]: Pointer + [0]: Qubit + [1]: Result output_type: body: "#]], ); @@ -892,10 +891,10 @@ fn array_of_results_update_slice_with_open_ended_range() { result_output_recording_callable_id, &expect![[r#" Callable: - name: __quantum__rt__result_record_output + name: __quantum__rt__array_record_output call_type: OutputRecording input_type: - [0]: Result + [0]: Integer [1]: Pointer output_type: body: "#]], @@ -905,15 +904,16 @@ fn array_of_results_update_slice_with_open_ended_range() { BlockId(0), &expect![[r#" Block: - Call id(1), args( Qubit(0), Result(0), ) - Call id(1), args( Qubit(1), Result(1), ) - Call id(1), args( Qubit(2), Result(2), ) - Call id(1), args( Qubit(3), Result(3), ) - Call id(1), args( Qubit(4), Result(4), ) - Call id(2), args( Integer(3), EmptyTag, ) - Call id(3), args( Result(0), Tag(0, 5), ) - Call id(3), args( Result(3), Tag(1, 5), ) - Call id(3), args( Result(4), Tag(2, 5), ) + Call id(1), args( Pointer, ) + Call id(2), args( Qubit(0), Result(0), ) + Call id(2), args( Qubit(1), Result(1), ) + Call id(2), args( Qubit(2), Result(2), ) + Call id(2), args( Qubit(3), Result(3), ) + Call id(2), args( Qubit(4), Result(4), ) + Call id(3), args( Integer(3), EmptyTag, ) + Call id(4), args( Result(0), Tag(0, 5), ) + Call id(4), args( Result(3), Tag(1, 5), ) + Call id(4), args( Result(4), Tag(2, 5), ) Return"#]], ); } @@ -937,11 +937,10 @@ fn array_of_results_update_slice_with_open_two_step_range() { measurement_callable_id, &expect![[r#" Callable: - name: __quantum__qis__mresetz__body - call_type: Measurement + name: __quantum__rt__initialize + call_type: Regular input_type: - [0]: Qubit - [1]: Result + [0]: Pointer output_type: body: "#]], ); @@ -951,11 +950,11 @@ fn array_of_results_update_slice_with_open_two_step_range() { array_output_recording_callable_id, &expect![[r#" Callable: - name: __quantum__rt__array_record_output - call_type: OutputRecording + name: __quantum__qis__mresetz__body + call_type: Measurement input_type: - [0]: Integer - [1]: Pointer + [0]: Qubit + [1]: Result output_type: body: "#]], ); @@ -965,10 +964,10 @@ fn array_of_results_update_slice_with_open_two_step_range() { result_output_recording_callable_id, &expect![[r#" Callable: - name: __quantum__rt__result_record_output + name: __quantum__rt__array_record_output call_type: OutputRecording input_type: - [0]: Result + [0]: Integer [1]: Pointer output_type: body: "#]], @@ -978,15 +977,16 @@ fn array_of_results_update_slice_with_open_two_step_range() { BlockId(0), &expect![[r#" Block: - Call id(1), args( Qubit(0), Result(0), ) - Call id(1), args( Qubit(1), Result(1), ) - Call id(1), args( Qubit(2), Result(2), ) - Call id(1), args( Qubit(3), Result(3), ) - Call id(1), args( Qubit(4), Result(4), ) - Call id(2), args( Integer(3), EmptyTag, ) - Call id(3), args( Result(3), Tag(0, 5), ) - Call id(3), args( Result(1), Tag(1, 5), ) - Call id(3), args( Result(4), Tag(2, 5), ) + Call id(1), args( Pointer, ) + Call id(2), args( Qubit(0), Result(0), ) + Call id(2), args( Qubit(1), Result(1), ) + Call id(2), args( Qubit(2), Result(2), ) + Call id(2), args( Qubit(3), Result(3), ) + Call id(2), args( Qubit(4), Result(4), ) + Call id(3), args( Integer(3), EmptyTag, ) + Call id(4), args( Result(3), Tag(0, 5), ) + Call id(4), args( Result(1), Tag(1, 5), ) + Call id(4), args( Result(4), Tag(2, 5), ) Return"#]], ); } @@ -1032,11 +1032,10 @@ fn empty_array_of_results_in_place_concatenation() { measurement_callable_id, &expect![[r#" Callable: - name: __quantum__qis__mresetz__body - call_type: Measurement + name: __quantum__rt__initialize + call_type: Regular input_type: - [0]: Qubit - [1]: Result + [0]: Pointer output_type: body: "#]], ); @@ -1046,11 +1045,11 @@ fn empty_array_of_results_in_place_concatenation() { array_output_recording_callable_id, &expect![[r#" Callable: - name: __quantum__rt__array_record_output - call_type: OutputRecording + name: __quantum__qis__mresetz__body + call_type: Measurement input_type: - [0]: Integer - [1]: Pointer + [0]: Qubit + [1]: Result output_type: body: "#]], ); @@ -1060,10 +1059,10 @@ fn empty_array_of_results_in_place_concatenation() { result_output_recording_callable_id, &expect![[r#" Callable: - name: __quantum__rt__result_record_output + name: __quantum__rt__array_record_output call_type: OutputRecording input_type: - [0]: Result + [0]: Integer [1]: Pointer output_type: body: "#]], @@ -1073,11 +1072,12 @@ fn empty_array_of_results_in_place_concatenation() { BlockId(0), &expect![[r#" Block: - Call id(1), args( Qubit(0), Result(0), ) - Call id(1), args( Qubit(1), Result(1), ) - Call id(2), args( Integer(2), EmptyTag, ) - Call id(3), args( Result(0), Tag(0, 5), ) - Call id(3), args( Result(1), Tag(1, 5), ) + Call id(1), args( Pointer, ) + Call id(2), args( Qubit(0), Result(0), ) + Call id(2), args( Qubit(1), Result(1), ) + Call id(3), args( Integer(2), EmptyTag, ) + Call id(4), args( Result(0), Tag(0, 5), ) + Call id(4), args( Result(1), Tag(1, 5), ) Return"#]], ); } @@ -1101,11 +1101,10 @@ fn non_empty_array_of_results_in_place_concatenation() { measurement_callable_id, &expect![[r#" Callable: - name: __quantum__qis__mresetz__body - call_type: Measurement + name: __quantum__rt__initialize + call_type: Regular input_type: - [0]: Qubit - [1]: Result + [0]: Pointer output_type: body: "#]], ); @@ -1115,11 +1114,11 @@ fn non_empty_array_of_results_in_place_concatenation() { array_output_recording_callable_id, &expect![[r#" Callable: - name: __quantum__rt__array_record_output - call_type: OutputRecording + name: __quantum__qis__mresetz__body + call_type: Measurement input_type: - [0]: Integer - [1]: Pointer + [0]: Qubit + [1]: Result output_type: body: "#]], ); @@ -1129,10 +1128,10 @@ fn non_empty_array_of_results_in_place_concatenation() { result_output_recording_callable_id, &expect![[r#" Callable: - name: __quantum__rt__result_record_output + name: __quantum__rt__array_record_output call_type: OutputRecording input_type: - [0]: Result + [0]: Integer [1]: Pointer output_type: body: "#]], @@ -1142,11 +1141,12 @@ fn non_empty_array_of_results_in_place_concatenation() { BlockId(0), &expect![[r#" Block: - Call id(1), args( Qubit(0), Result(0), ) - Call id(1), args( Qubit(1), Result(1), ) - Call id(2), args( Integer(2), EmptyTag, ) - Call id(3), args( Result(0), Tag(0, 5), ) - Call id(3), args( Result(1), Tag(1, 5), ) + Call id(1), args( Pointer, ) + Call id(2), args( Qubit(0), Result(0), ) + Call id(2), args( Qubit(1), Result(1), ) + Call id(3), args( Integer(2), EmptyTag, ) + Call id(4), args( Result(0), Tag(0, 5), ) + Call id(4), args( Result(1), Tag(1, 5), ) Return"#]], ); } @@ -1173,11 +1173,10 @@ fn logical_and_assign_with_lhs_classical_true_is_optimized_as_store() { measurement_callable_id, &expect![[r#" Callable: - name: __quantum__qis__mresetz__body - call_type: Measurement + name: __quantum__rt__initialize + call_type: Regular input_type: - [0]: Qubit - [1]: Result + [0]: Pointer output_type: body: "#]], ); @@ -1187,11 +1186,12 @@ fn logical_and_assign_with_lhs_classical_true_is_optimized_as_store() { readout_callable_id, &expect![[r#" Callable: - name: __quantum__rt__read_result - call_type: Readout + name: __quantum__qis__mresetz__body + call_type: Measurement input_type: - [0]: Result - output_type: Boolean + [0]: Qubit + [1]: Result + output_type: body: "#]], ); let output_record_id = CallableId(3); @@ -1199,28 +1199,28 @@ fn logical_and_assign_with_lhs_classical_true_is_optimized_as_store() { &program, output_record_id, &expect![[r#" - Callable: - name: __quantum__rt__bool_record_output - call_type: OutputRecording - input_type: - [0]: Boolean - [1]: Pointer - output_type: - body: "#]], + Callable: + name: __quantum__rt__read_result + call_type: Readout + input_type: + [0]: Result + output_type: Boolean + body: "#]], ); assert_block_instructions( &program, BlockId(0), &expect![[r#" Block: - Call id(1), args( Qubit(0), Result(0), ) - Variable(0, Boolean) = Call id(2), args( Result(0), ) + Call id(1), args( Pointer, ) + Call id(2), args( Qubit(0), Result(0), ) + Variable(0, Boolean) = Call id(3), args( Result(0), ) Variable(1, Boolean) = Store Variable(0, Boolean) Variable(2, Boolean) = Store Variable(1, Boolean) Variable(3, Boolean) = Store Bool(true) Variable(3, Boolean) = Store Variable(2, Boolean) Variable(4, Boolean) = Store Variable(3, Boolean) - Call id(3), args( Variable(4, Boolean), Tag(0, 3), ) + Call id(4), args( Variable(4, Boolean), Tag(0, 3), ) Return"#]], ); } @@ -1247,11 +1247,10 @@ fn logical_and_assign_with_lhs_classical_false_short_circuits_evaluation() { measurement_callable_id, &expect![[r#" Callable: - name: __quantum__qis__mresetz__body - call_type: Measurement + name: __quantum__rt__initialize + call_type: Regular input_type: - [0]: Qubit - [1]: Result + [0]: Pointer output_type: body: "#]], ); @@ -1261,11 +1260,12 @@ fn logical_and_assign_with_lhs_classical_false_short_circuits_evaluation() { readout_callable_id, &expect![[r#" Callable: - name: __quantum__rt__read_result - call_type: Readout + name: __quantum__qis__mresetz__body + call_type: Measurement input_type: - [0]: Result - output_type: Boolean + [0]: Qubit + [1]: Result + output_type: body: "#]], ); let output_record_id = CallableId(3); @@ -1273,27 +1273,27 @@ fn logical_and_assign_with_lhs_classical_false_short_circuits_evaluation() { &program, output_record_id, &expect![[r#" - Callable: - name: __quantum__rt__bool_record_output - call_type: OutputRecording - input_type: - [0]: Boolean - [1]: Pointer - output_type: - body: "#]], + Callable: + name: __quantum__rt__read_result + call_type: Readout + input_type: + [0]: Result + output_type: Boolean + body: "#]], ); assert_block_instructions( &program, BlockId(0), &expect![[r#" Block: - Call id(1), args( Qubit(0), Result(0), ) - Variable(0, Boolean) = Call id(2), args( Result(0), ) + Call id(1), args( Pointer, ) + Call id(2), args( Qubit(0), Result(0), ) + Variable(0, Boolean) = Call id(3), args( Result(0), ) Variable(1, Boolean) = Store Variable(0, Boolean) Variable(2, Boolean) = Store Variable(1, Boolean) Variable(3, Boolean) = Store Bool(false) Variable(3, Boolean) = Store Bool(false) - Call id(3), args( Bool(false), Tag(0, 3), ) + Call id(4), args( Bool(false), Tag(0, 3), ) Return"#]], ); } @@ -1319,11 +1319,10 @@ fn logical_and_assign_with_dynamic_lhs_and_dynamic_rhs_short_circuits_when_rhs_i measurement_callable_id, &expect![[r#" Callable: - name: __quantum__qis__mresetz__body - call_type: Measurement + name: __quantum__rt__initialize + call_type: Regular input_type: - [0]: Qubit - [1]: Result + [0]: Pointer output_type: body: "#]], ); @@ -1333,11 +1332,12 @@ fn logical_and_assign_with_dynamic_lhs_and_dynamic_rhs_short_circuits_when_rhs_i readout_callable_id, &expect![[r#" Callable: - name: __quantum__rt__read_result - call_type: Readout + name: __quantum__qis__mresetz__body + call_type: Measurement input_type: - [0]: Result - output_type: Boolean + [0]: Qubit + [1]: Result + output_type: body: "#]], ); let output_record_id = CallableId(3); @@ -1345,22 +1345,22 @@ fn logical_and_assign_with_dynamic_lhs_and_dynamic_rhs_short_circuits_when_rhs_i &program, output_record_id, &expect![[r#" - Callable: - name: __quantum__rt__bool_record_output - call_type: OutputRecording - input_type: - [0]: Boolean - [1]: Pointer - output_type: - body: "#]], + Callable: + name: __quantum__rt__read_result + call_type: Readout + input_type: + [0]: Result + output_type: Boolean + body: "#]], ); assert_blocks( &program, &expect![[r#" Blocks: Block 0:Block: - Call id(1), args( Qubit(0), Result(0), ) - Variable(0, Boolean) = Call id(2), args( Result(0), ) + Call id(1), args( Pointer, ) + Call id(2), args( Qubit(0), Result(0), ) + Variable(0, Boolean) = Call id(3), args( Result(0), ) Variable(1, Boolean) = Icmp Ne, Variable(0, Boolean), Bool(true) Variable(2, Boolean) = Store Variable(1, Boolean) Variable(3, Boolean) = Store Bool(false) @@ -1368,11 +1368,11 @@ fn logical_and_assign_with_dynamic_lhs_and_dynamic_rhs_short_circuits_when_rhs_i Block 1:Block: Variable(2, Boolean) = Store Variable(3, Boolean) Variable(6, Boolean) = Store Variable(2, Boolean) - Call id(3), args( Variable(6, Boolean), Tag(0, 3), ) + Call id(4), args( Variable(6, Boolean), Tag(0, 3), ) Return Block 2:Block: - Call id(1), args( Qubit(0), Result(1), ) - Variable(4, Boolean) = Call id(2), args( Result(1), ) + Call id(2), args( Qubit(0), Result(1), ) + Variable(4, Boolean) = Call id(3), args( Result(1), ) Variable(5, Boolean) = Icmp Ne, Variable(4, Boolean), Bool(true) Variable(3, Boolean) = Store Variable(5, Boolean) Jump(1)"#]], @@ -1401,11 +1401,10 @@ fn logical_or_assign_with_lhs_classical_true_short_circuits_evaluation() { measurement_callable_id, &expect![[r#" Callable: - name: __quantum__qis__mresetz__body - call_type: Measurement + name: __quantum__rt__initialize + call_type: Regular input_type: - [0]: Qubit - [1]: Result + [0]: Pointer output_type: body: "#]], ); @@ -1415,11 +1414,12 @@ fn logical_or_assign_with_lhs_classical_true_short_circuits_evaluation() { readout_callable_id, &expect![[r#" Callable: - name: __quantum__rt__read_result - call_type: Readout + name: __quantum__qis__mresetz__body + call_type: Measurement input_type: - [0]: Result - output_type: Boolean + [0]: Qubit + [1]: Result + output_type: body: "#]], ); let output_record_id = CallableId(3); @@ -1427,27 +1427,27 @@ fn logical_or_assign_with_lhs_classical_true_short_circuits_evaluation() { &program, output_record_id, &expect![[r#" - Callable: - name: __quantum__rt__bool_record_output - call_type: OutputRecording - input_type: - [0]: Boolean - [1]: Pointer - output_type: - body: "#]], + Callable: + name: __quantum__rt__read_result + call_type: Readout + input_type: + [0]: Result + output_type: Boolean + body: "#]], ); assert_block_instructions( &program, BlockId(0), &expect![[r#" Block: - Call id(1), args( Qubit(0), Result(0), ) - Variable(0, Boolean) = Call id(2), args( Result(0), ) + Call id(1), args( Pointer, ) + Call id(2), args( Qubit(0), Result(0), ) + Variable(0, Boolean) = Call id(3), args( Result(0), ) Variable(1, Boolean) = Store Variable(0, Boolean) Variable(2, Boolean) = Store Variable(1, Boolean) Variable(3, Boolean) = Store Bool(true) Variable(3, Boolean) = Store Bool(true) - Call id(3), args( Bool(true), Tag(0, 3), ) + Call id(4), args( Bool(true), Tag(0, 3), ) Return"#]], ); } @@ -1474,11 +1474,10 @@ fn logical_or_assign_with_lhs_classical_false_is_optimized_as_store() { measurement_callable_id, &expect![[r#" Callable: - name: __quantum__qis__mresetz__body - call_type: Measurement + name: __quantum__rt__initialize + call_type: Regular input_type: - [0]: Qubit - [1]: Result + [0]: Pointer output_type: body: "#]], ); @@ -1488,11 +1487,12 @@ fn logical_or_assign_with_lhs_classical_false_is_optimized_as_store() { readout_callable_id, &expect![[r#" Callable: - name: __quantum__rt__read_result - call_type: Readout + name: __quantum__qis__mresetz__body + call_type: Measurement input_type: - [0]: Result - output_type: Boolean + [0]: Qubit + [1]: Result + output_type: body: "#]], ); let output_record_id = CallableId(3); @@ -1500,28 +1500,28 @@ fn logical_or_assign_with_lhs_classical_false_is_optimized_as_store() { &program, output_record_id, &expect![[r#" - Callable: - name: __quantum__rt__bool_record_output - call_type: OutputRecording - input_type: - [0]: Boolean - [1]: Pointer - output_type: - body: "#]], + Callable: + name: __quantum__rt__read_result + call_type: Readout + input_type: + [0]: Result + output_type: Boolean + body: "#]], ); assert_block_instructions( &program, BlockId(0), &expect![[r#" Block: - Call id(1), args( Qubit(0), Result(0), ) - Variable(0, Boolean) = Call id(2), args( Result(0), ) + Call id(1), args( Pointer, ) + Call id(2), args( Qubit(0), Result(0), ) + Variable(0, Boolean) = Call id(3), args( Result(0), ) Variable(1, Boolean) = Store Variable(0, Boolean) Variable(2, Boolean) = Store Variable(1, Boolean) Variable(3, Boolean) = Store Bool(false) Variable(3, Boolean) = Store Variable(2, Boolean) Variable(4, Boolean) = Store Variable(3, Boolean) - Call id(3), args( Variable(4, Boolean), Tag(0, 3), ) + Call id(4), args( Variable(4, Boolean), Tag(0, 3), ) Return"#]], ); } @@ -1547,11 +1547,10 @@ fn logical_or_assign_with_dynamic_lhs_and_dynamic_rhs_short_circuits_when_rhs_is measurement_callable_id, &expect![[r#" Callable: - name: __quantum__qis__mresetz__body - call_type: Measurement + name: __quantum__rt__initialize + call_type: Regular input_type: - [0]: Qubit - [1]: Result + [0]: Pointer output_type: body: "#]], ); @@ -1561,11 +1560,12 @@ fn logical_or_assign_with_dynamic_lhs_and_dynamic_rhs_short_circuits_when_rhs_is readout_callable_id, &expect![[r#" Callable: - name: __quantum__rt__read_result - call_type: Readout + name: __quantum__qis__mresetz__body + call_type: Measurement input_type: - [0]: Result - output_type: Boolean + [0]: Qubit + [1]: Result + output_type: body: "#]], ); let output_record_id = CallableId(3); @@ -1573,22 +1573,22 @@ fn logical_or_assign_with_dynamic_lhs_and_dynamic_rhs_short_circuits_when_rhs_is &program, output_record_id, &expect![[r#" - Callable: - name: __quantum__rt__bool_record_output - call_type: OutputRecording - input_type: - [0]: Boolean - [1]: Pointer - output_type: - body: "#]], + Callable: + name: __quantum__rt__read_result + call_type: Readout + input_type: + [0]: Result + output_type: Boolean + body: "#]], ); assert_blocks( &program, &expect![[r#" Blocks: Block 0:Block: - Call id(1), args( Qubit(0), Result(0), ) - Variable(0, Boolean) = Call id(2), args( Result(0), ) + Call id(1), args( Pointer, ) + Call id(2), args( Qubit(0), Result(0), ) + Variable(0, Boolean) = Call id(3), args( Result(0), ) Variable(1, Boolean) = Icmp Ne, Variable(0, Boolean), Bool(true) Variable(2, Boolean) = Store Variable(1, Boolean) Variable(3, Boolean) = Store Bool(true) @@ -1596,11 +1596,11 @@ fn logical_or_assign_with_dynamic_lhs_and_dynamic_rhs_short_circuits_when_rhs_is Block 1:Block: Variable(2, Boolean) = Store Variable(3, Boolean) Variable(6, Boolean) = Store Variable(2, Boolean) - Call id(3), args( Variable(6, Boolean), Tag(0, 3), ) + Call id(4), args( Variable(6, Boolean), Tag(0, 3), ) Return Block 2:Block: - Call id(1), args( Qubit(0), Result(1), ) - Variable(4, Boolean) = Call id(2), args( Result(1), ) + Call id(2), args( Qubit(0), Result(1), ) + Variable(4, Boolean) = Call id(3), args( Result(1), ) Variable(5, Boolean) = Icmp Ne, Variable(4, Boolean), Bool(true) Variable(3, Boolean) = Store Variable(5, Boolean) Jump(1)"#]], @@ -1628,11 +1628,10 @@ fn integer_assign_add_with_lhs_classical_integer_and_rhs_dynamic_integer() { measurement_callable_id, &expect![[r#" Callable: - name: __quantum__qis__mresetz__body - call_type: Measurement + name: __quantum__rt__initialize + call_type: Regular input_type: - [0]: Qubit - [1]: Result + [0]: Pointer output_type: body: "#]], ); @@ -1642,11 +1641,12 @@ fn integer_assign_add_with_lhs_classical_integer_and_rhs_dynamic_integer() { readout_callable_id, &expect![[r#" Callable: - name: __quantum__rt__read_result - call_type: Readout + name: __quantum__qis__mresetz__body + call_type: Measurement input_type: - [0]: Result - output_type: Boolean + [0]: Qubit + [1]: Result + output_type: body: "#]], ); let output_record_id = CallableId(3); @@ -1655,12 +1655,11 @@ fn integer_assign_add_with_lhs_classical_integer_and_rhs_dynamic_integer() { output_record_id, &expect![[r#" Callable: - name: __quantum__rt__int_record_output - call_type: OutputRecording + name: __quantum__rt__read_result + call_type: Readout input_type: - [0]: Integer - [1]: Pointer - output_type: + [0]: Result + output_type: Boolean body: "#]], ); assert_blocks( @@ -1668,16 +1667,17 @@ fn integer_assign_add_with_lhs_classical_integer_and_rhs_dynamic_integer() { &expect![[r#" Blocks: Block 0:Block: + Call id(1), args( Pointer, ) Variable(0, Integer) = Store Integer(0) - Call id(1), args( Qubit(0), Result(0), ) - Variable(1, Boolean) = Call id(2), args( Result(0), ) + Call id(2), args( Qubit(0), Result(0), ) + Variable(1, Boolean) = Call id(3), args( Result(0), ) Variable(2, Boolean) = Icmp Eq, Variable(1, Boolean), Bool(false) Branch Variable(2, Boolean), 2, 3 Block 1:Block: Variable(4, Integer) = Add Integer(0), Variable(3, Integer) Variable(0, Integer) = Store Variable(4, Integer) Variable(5, Integer) = Store Variable(0, Integer) - Call id(3), args( Variable(5, Integer), Tag(0, 3), ) + Call id(4), args( Variable(5, Integer), Tag(0, 3), ) Return Block 2:Block: Variable(3, Integer) = Store Integer(0) @@ -1709,11 +1709,10 @@ fn integer_assign_sub_with_lhs_dynamic_integer_and_rhs_classical_integer() { measurement_callable_id, &expect![[r#" Callable: - name: __quantum__qis__mresetz__body - call_type: Measurement + name: __quantum__rt__initialize + call_type: Regular input_type: - [0]: Qubit - [1]: Result + [0]: Pointer output_type: body: "#]], ); @@ -1723,11 +1722,12 @@ fn integer_assign_sub_with_lhs_dynamic_integer_and_rhs_classical_integer() { readout_callable_id, &expect![[r#" Callable: - name: __quantum__rt__read_result - call_type: Readout + name: __quantum__qis__mresetz__body + call_type: Measurement input_type: - [0]: Result - output_type: Boolean + [0]: Qubit + [1]: Result + output_type: body: "#]], ); let output_record_id = CallableId(3); @@ -1736,12 +1736,11 @@ fn integer_assign_sub_with_lhs_dynamic_integer_and_rhs_classical_integer() { output_record_id, &expect![[r#" Callable: - name: __quantum__rt__int_record_output - call_type: OutputRecording + name: __quantum__rt__read_result + call_type: Readout input_type: - [0]: Integer - [1]: Pointer - output_type: + [0]: Result + output_type: Boolean body: "#]], ); assert_blocks( @@ -1749,8 +1748,9 @@ fn integer_assign_sub_with_lhs_dynamic_integer_and_rhs_classical_integer() { &expect![[r#" Blocks: Block 0:Block: - Call id(1), args( Qubit(0), Result(0), ) - Variable(0, Boolean) = Call id(2), args( Result(0), ) + Call id(1), args( Pointer, ) + Call id(2), args( Qubit(0), Result(0), ) + Variable(0, Boolean) = Call id(3), args( Result(0), ) Variable(1, Boolean) = Icmp Eq, Variable(0, Boolean), Bool(false) Branch Variable(1, Boolean), 2, 3 Block 1:Block: @@ -1758,7 +1758,7 @@ fn integer_assign_sub_with_lhs_dynamic_integer_and_rhs_classical_integer() { Variable(4, Integer) = Sub Variable(3, Integer), Integer(1) Variable(3, Integer) = Store Variable(4, Integer) Variable(5, Integer) = Store Variable(3, Integer) - Call id(3), args( Variable(5, Integer), Tag(0, 3), ) + Call id(4), args( Variable(5, Integer), Tag(0, 3), ) Return Block 2:Block: Variable(2, Integer) = Store Integer(0) @@ -1790,11 +1790,10 @@ fn integer_assign_mul_with_lhs_dynamic_integer_and_rhs_dynamic_integer() { measurement_callable_id, &expect![[r#" Callable: - name: __quantum__qis__mresetz__body - call_type: Measurement + name: __quantum__rt__initialize + call_type: Regular input_type: - [0]: Qubit - [1]: Result + [0]: Pointer output_type: body: "#]], ); @@ -1804,11 +1803,12 @@ fn integer_assign_mul_with_lhs_dynamic_integer_and_rhs_dynamic_integer() { readout_callable_id, &expect![[r#" Callable: - name: __quantum__rt__read_result - call_type: Readout + name: __quantum__qis__mresetz__body + call_type: Measurement input_type: - [0]: Result - output_type: Boolean + [0]: Qubit + [1]: Result + output_type: body: "#]], ); let output_record_id = CallableId(3); @@ -1817,12 +1817,11 @@ fn integer_assign_mul_with_lhs_dynamic_integer_and_rhs_dynamic_integer() { output_record_id, &expect![[r#" Callable: - name: __quantum__rt__int_record_output - call_type: OutputRecording + name: __quantum__rt__read_result + call_type: Readout input_type: - [0]: Integer - [1]: Pointer - output_type: + [0]: Result + output_type: Boolean body: "#]], ); assert_blocks( @@ -1830,14 +1829,15 @@ fn integer_assign_mul_with_lhs_dynamic_integer_and_rhs_dynamic_integer() { &expect![[r#" Blocks: Block 0:Block: - Call id(1), args( Qubit(0), Result(0), ) - Variable(0, Boolean) = Call id(2), args( Result(0), ) + Call id(1), args( Pointer, ) + Call id(2), args( Qubit(0), Result(0), ) + Variable(0, Boolean) = Call id(3), args( Result(0), ) Variable(1, Boolean) = Icmp Eq, Variable(0, Boolean), Bool(false) Branch Variable(1, Boolean), 2, 3 Block 1:Block: Variable(3, Integer) = Store Variable(2, Integer) - Call id(1), args( Qubit(0), Result(1), ) - Variable(4, Boolean) = Call id(2), args( Result(1), ) + Call id(2), args( Qubit(0), Result(1), ) + Variable(4, Boolean) = Call id(3), args( Result(1), ) Variable(5, Boolean) = Icmp Eq, Variable(4, Boolean), Bool(false) Branch Variable(5, Boolean), 5, 6 Block 2:Block: @@ -1850,7 +1850,7 @@ fn integer_assign_mul_with_lhs_dynamic_integer_and_rhs_dynamic_integer() { Variable(7, Integer) = Mul Variable(3, Integer), Variable(6, Integer) Variable(3, Integer) = Store Variable(7, Integer) Variable(8, Integer) = Store Variable(3, Integer) - Call id(3), args( Variable(8, Integer), Tag(0, 3), ) + Call id(4), args( Variable(8, Integer), Tag(0, 3), ) Return Block 5:Block: Variable(6, Integer) = Store Integer(1) @@ -1882,11 +1882,10 @@ fn integer_assign_div_with_lhs_classical_integer_and_rhs_dynamic_integer() { measurement_callable_id, &expect![[r#" Callable: - name: __quantum__qis__mresetz__body - call_type: Measurement + name: __quantum__rt__initialize + call_type: Regular input_type: - [0]: Qubit - [1]: Result + [0]: Pointer output_type: body: "#]], ); @@ -1896,11 +1895,12 @@ fn integer_assign_div_with_lhs_classical_integer_and_rhs_dynamic_integer() { readout_callable_id, &expect![[r#" Callable: - name: __quantum__rt__read_result - call_type: Readout + name: __quantum__qis__mresetz__body + call_type: Measurement input_type: - [0]: Result - output_type: Boolean + [0]: Qubit + [1]: Result + output_type: body: "#]], ); let output_record_id = CallableId(3); @@ -1909,12 +1909,11 @@ fn integer_assign_div_with_lhs_classical_integer_and_rhs_dynamic_integer() { output_record_id, &expect![[r#" Callable: - name: __quantum__rt__int_record_output - call_type: OutputRecording + name: __quantum__rt__read_result + call_type: Readout input_type: - [0]: Integer - [1]: Pointer - output_type: + [0]: Result + output_type: Boolean body: "#]], ); assert_blocks( @@ -1922,16 +1921,17 @@ fn integer_assign_div_with_lhs_classical_integer_and_rhs_dynamic_integer() { &expect![[r#" Blocks: Block 0:Block: + Call id(1), args( Pointer, ) Variable(0, Integer) = Store Integer(0) - Call id(1), args( Qubit(0), Result(0), ) - Variable(1, Boolean) = Call id(2), args( Result(0), ) + Call id(2), args( Qubit(0), Result(0), ) + Variable(1, Boolean) = Call id(3), args( Result(0), ) Variable(2, Boolean) = Icmp Eq, Variable(1, Boolean), Bool(false) Branch Variable(2, Boolean), 2, 3 Block 1:Block: Variable(4, Integer) = Sdiv Integer(0), Variable(3, Integer) Variable(0, Integer) = Store Variable(4, Integer) Variable(5, Integer) = Store Variable(0, Integer) - Call id(3), args( Variable(5, Integer), Tag(0, 3), ) + Call id(4), args( Variable(5, Integer), Tag(0, 3), ) Return Block 2:Block: Variable(3, Integer) = Store Integer(0) @@ -1963,11 +1963,10 @@ fn integer_assign_mod_with_lhs_dynamic_integer_and_rhs_classical_integer() { measurement_callable_id, &expect![[r#" Callable: - name: __quantum__qis__mresetz__body - call_type: Measurement + name: __quantum__rt__initialize + call_type: Regular input_type: - [0]: Qubit - [1]: Result + [0]: Pointer output_type: body: "#]], ); @@ -1977,11 +1976,12 @@ fn integer_assign_mod_with_lhs_dynamic_integer_and_rhs_classical_integer() { readout_callable_id, &expect![[r#" Callable: - name: __quantum__rt__read_result - call_type: Readout + name: __quantum__qis__mresetz__body + call_type: Measurement input_type: - [0]: Result - output_type: Boolean + [0]: Qubit + [1]: Result + output_type: body: "#]], ); let output_record_id = CallableId(3); @@ -1990,12 +1990,11 @@ fn integer_assign_mod_with_lhs_dynamic_integer_and_rhs_classical_integer() { output_record_id, &expect![[r#" Callable: - name: __quantum__rt__int_record_output - call_type: OutputRecording + name: __quantum__rt__read_result + call_type: Readout input_type: - [0]: Integer - [1]: Pointer - output_type: + [0]: Result + output_type: Boolean body: "#]], ); assert_blocks( @@ -2003,8 +2002,9 @@ fn integer_assign_mod_with_lhs_dynamic_integer_and_rhs_classical_integer() { &expect![[r#" Blocks: Block 0:Block: - Call id(1), args( Qubit(0), Result(0), ) - Variable(0, Boolean) = Call id(2), args( Result(0), ) + Call id(1), args( Pointer, ) + Call id(2), args( Qubit(0), Result(0), ) + Variable(0, Boolean) = Call id(3), args( Result(0), ) Variable(1, Boolean) = Icmp Eq, Variable(0, Boolean), Bool(false) Branch Variable(1, Boolean), 2, 3 Block 1:Block: @@ -2012,7 +2012,7 @@ fn integer_assign_mod_with_lhs_dynamic_integer_and_rhs_classical_integer() { Variable(4, Integer) = Srem Variable(3, Integer), Integer(1) Variable(3, Integer) = Store Variable(4, Integer) Variable(5, Integer) = Store Variable(3, Integer) - Call id(3), args( Variable(5, Integer), Tag(0, 3), ) + Call id(4), args( Variable(5, Integer), Tag(0, 3), ) Return Block 2:Block: Variable(2, Integer) = Store Integer(0) @@ -2090,11 +2090,10 @@ fn integer_assign_exp_with_lhs_dynamic_integer_and_rhs_classical_zero_integer() measurement_callable_id, &expect![[r#" Callable: - name: __quantum__qis__mresetz__body - call_type: Measurement + name: __quantum__rt__initialize + call_type: Regular input_type: - [0]: Qubit - [1]: Result + [0]: Pointer output_type: body: "#]], ); @@ -2104,11 +2103,12 @@ fn integer_assign_exp_with_lhs_dynamic_integer_and_rhs_classical_zero_integer() readout_callable_id, &expect![[r#" Callable: - name: __quantum__rt__read_result - call_type: Readout + name: __quantum__qis__mresetz__body + call_type: Measurement input_type: - [0]: Result - output_type: Boolean + [0]: Qubit + [1]: Result + output_type: body: "#]], ); let output_record_id = CallableId(3); @@ -2117,12 +2117,11 @@ fn integer_assign_exp_with_lhs_dynamic_integer_and_rhs_classical_zero_integer() output_record_id, &expect![[r#" Callable: - name: __quantum__rt__int_record_output - call_type: OutputRecording + name: __quantum__rt__read_result + call_type: Readout input_type: - [0]: Integer - [1]: Pointer - output_type: + [0]: Result + output_type: Boolean body: "#]], ); assert_blocks( @@ -2130,8 +2129,9 @@ fn integer_assign_exp_with_lhs_dynamic_integer_and_rhs_classical_zero_integer() &expect![[r#" Blocks: Block 0:Block: - Call id(1), args( Qubit(0), Result(0), ) - Variable(0, Boolean) = Call id(2), args( Result(0), ) + Call id(1), args( Pointer, ) + Call id(2), args( Qubit(0), Result(0), ) + Variable(0, Boolean) = Call id(3), args( Result(0), ) Variable(1, Boolean) = Icmp Eq, Variable(0, Boolean), Bool(false) Branch Variable(1, Boolean), 2, 3 Block 1:Block: @@ -2139,7 +2139,7 @@ fn integer_assign_exp_with_lhs_dynamic_integer_and_rhs_classical_zero_integer() Variable(4, Integer) = Store Integer(1) Variable(3, Integer) = Store Variable(4, Integer) Variable(5, Integer) = Store Variable(3, Integer) - Call id(3), args( Variable(5, Integer), Tag(0, 3), ) + Call id(4), args( Variable(5, Integer), Tag(0, 3), ) Return Block 2:Block: Variable(2, Integer) = Store Integer(0) @@ -2171,11 +2171,10 @@ fn integer_assign_exp_with_lhs_dynamic_integer_and_rhs_classical_positive_intege measurement_callable_id, &expect![[r#" Callable: - name: __quantum__qis__mresetz__body - call_type: Measurement + name: __quantum__rt__initialize + call_type: Regular input_type: - [0]: Qubit - [1]: Result + [0]: Pointer output_type: body: "#]], ); @@ -2185,11 +2184,12 @@ fn integer_assign_exp_with_lhs_dynamic_integer_and_rhs_classical_positive_intege readout_callable_id, &expect![[r#" Callable: - name: __quantum__rt__read_result - call_type: Readout + name: __quantum__qis__mresetz__body + call_type: Measurement input_type: - [0]: Result - output_type: Boolean + [0]: Qubit + [1]: Result + output_type: body: "#]], ); let output_record_id = CallableId(3); @@ -2198,12 +2198,11 @@ fn integer_assign_exp_with_lhs_dynamic_integer_and_rhs_classical_positive_intege output_record_id, &expect![[r#" Callable: - name: __quantum__rt__int_record_output - call_type: OutputRecording + name: __quantum__rt__read_result + call_type: Readout input_type: - [0]: Integer - [1]: Pointer - output_type: + [0]: Result + output_type: Boolean body: "#]], ); assert_blocks( @@ -2211,8 +2210,9 @@ fn integer_assign_exp_with_lhs_dynamic_integer_and_rhs_classical_positive_intege &expect![[r#" Blocks: Block 0:Block: - Call id(1), args( Qubit(0), Result(0), ) - Variable(0, Boolean) = Call id(2), args( Result(0), ) + Call id(1), args( Pointer, ) + Call id(2), args( Qubit(0), Result(0), ) + Variable(0, Boolean) = Call id(3), args( Result(0), ) Variable(1, Boolean) = Icmp Eq, Variable(0, Boolean), Bool(false) Branch Variable(1, Boolean), 2, 3 Block 1:Block: @@ -2223,7 +2223,7 @@ fn integer_assign_exp_with_lhs_dynamic_integer_and_rhs_classical_positive_intege Variable(7, Integer) = Mul Variable(6, Integer), Variable(3, Integer) Variable(3, Integer) = Store Variable(7, Integer) Variable(8, Integer) = Store Variable(3, Integer) - Call id(3), args( Variable(8, Integer), Tag(0, 3), ) + Call id(4), args( Variable(8, Integer), Tag(0, 3), ) Return Block 2:Block: Variable(2, Integer) = Store Integer(0) @@ -2278,11 +2278,10 @@ fn integer_assign_bitwise_and_with_lhs_dynamic_integer_and_rhs_dynamic_integer() measurement_callable_id, &expect![[r#" Callable: - name: __quantum__qis__mresetz__body - call_type: Measurement + name: __quantum__rt__initialize + call_type: Regular input_type: - [0]: Qubit - [1]: Result + [0]: Pointer output_type: body: "#]], ); @@ -2292,11 +2291,12 @@ fn integer_assign_bitwise_and_with_lhs_dynamic_integer_and_rhs_dynamic_integer() readout_callable_id, &expect![[r#" Callable: - name: __quantum__rt__read_result - call_type: Readout + name: __quantum__qis__mresetz__body + call_type: Measurement input_type: - [0]: Result - output_type: Boolean + [0]: Qubit + [1]: Result + output_type: body: "#]], ); let output_record_id = CallableId(3); @@ -2305,12 +2305,11 @@ fn integer_assign_bitwise_and_with_lhs_dynamic_integer_and_rhs_dynamic_integer() output_record_id, &expect![[r#" Callable: - name: __quantum__rt__int_record_output - call_type: OutputRecording + name: __quantum__rt__read_result + call_type: Readout input_type: - [0]: Integer - [1]: Pointer - output_type: + [0]: Result + output_type: Boolean body: "#]], ); assert_blocks( @@ -2318,14 +2317,15 @@ fn integer_assign_bitwise_and_with_lhs_dynamic_integer_and_rhs_dynamic_integer() &expect![[r#" Blocks: Block 0:Block: - Call id(1), args( Qubit(0), Result(0), ) - Variable(0, Boolean) = Call id(2), args( Result(0), ) + Call id(1), args( Pointer, ) + Call id(2), args( Qubit(0), Result(0), ) + Variable(0, Boolean) = Call id(3), args( Result(0), ) Variable(1, Boolean) = Icmp Eq, Variable(0, Boolean), Bool(false) Branch Variable(1, Boolean), 2, 3 Block 1:Block: Variable(3, Integer) = Store Variable(2, Integer) - Call id(1), args( Qubit(0), Result(1), ) - Variable(4, Boolean) = Call id(2), args( Result(1), ) + Call id(2), args( Qubit(0), Result(1), ) + Variable(4, Boolean) = Call id(3), args( Result(1), ) Variable(5, Boolean) = Icmp Eq, Variable(4, Boolean), Bool(false) Branch Variable(5, Boolean), 5, 6 Block 2:Block: @@ -2338,7 +2338,7 @@ fn integer_assign_bitwise_and_with_lhs_dynamic_integer_and_rhs_dynamic_integer() Variable(7, Integer) = BitwiseAnd Variable(3, Integer), Variable(6, Integer) Variable(3, Integer) = Store Variable(7, Integer) Variable(8, Integer) = Store Variable(3, Integer) - Call id(3), args( Variable(8, Integer), Tag(0, 3), ) + Call id(4), args( Variable(8, Integer), Tag(0, 3), ) Return Block 5:Block: Variable(6, Integer) = Store Integer(1) @@ -2370,11 +2370,10 @@ fn integer_assign_bitwise_or_with_lhs_classical_integer_and_rhs_dynamic_integer( measurement_callable_id, &expect![[r#" Callable: - name: __quantum__qis__mresetz__body - call_type: Measurement + name: __quantum__rt__initialize + call_type: Regular input_type: - [0]: Qubit - [1]: Result + [0]: Pointer output_type: body: "#]], ); @@ -2384,11 +2383,12 @@ fn integer_assign_bitwise_or_with_lhs_classical_integer_and_rhs_dynamic_integer( readout_callable_id, &expect![[r#" Callable: - name: __quantum__rt__read_result - call_type: Readout + name: __quantum__qis__mresetz__body + call_type: Measurement input_type: - [0]: Result - output_type: Boolean + [0]: Qubit + [1]: Result + output_type: body: "#]], ); let output_record_id = CallableId(3); @@ -2397,12 +2397,11 @@ fn integer_assign_bitwise_or_with_lhs_classical_integer_and_rhs_dynamic_integer( output_record_id, &expect![[r#" Callable: - name: __quantum__rt__int_record_output - call_type: OutputRecording + name: __quantum__rt__read_result + call_type: Readout input_type: - [0]: Integer - [1]: Pointer - output_type: + [0]: Result + output_type: Boolean body: "#]], ); assert_blocks( @@ -2410,16 +2409,17 @@ fn integer_assign_bitwise_or_with_lhs_classical_integer_and_rhs_dynamic_integer( &expect![[r#" Blocks: Block 0:Block: + Call id(1), args( Pointer, ) Variable(0, Integer) = Store Integer(0) - Call id(1), args( Qubit(0), Result(0), ) - Variable(1, Boolean) = Call id(2), args( Result(0), ) + Call id(2), args( Qubit(0), Result(0), ) + Variable(1, Boolean) = Call id(3), args( Result(0), ) Variable(2, Boolean) = Icmp Eq, Variable(1, Boolean), Bool(false) Branch Variable(2, Boolean), 2, 3 Block 1:Block: Variable(4, Integer) = BitwiseOr Integer(0), Variable(3, Integer) Variable(0, Integer) = Store Variable(4, Integer) Variable(5, Integer) = Store Variable(0, Integer) - Call id(3), args( Variable(5, Integer), Tag(0, 3), ) + Call id(4), args( Variable(5, Integer), Tag(0, 3), ) Return Block 2:Block: Variable(3, Integer) = Store Integer(0) @@ -2451,11 +2451,10 @@ fn integer_bitwise_xor_with_lhs_dynamic_integer_and_rhs_classical_integer() { measurement_callable_id, &expect![[r#" Callable: - name: __quantum__qis__mresetz__body - call_type: Measurement + name: __quantum__rt__initialize + call_type: Regular input_type: - [0]: Qubit - [1]: Result + [0]: Pointer output_type: body: "#]], ); @@ -2465,11 +2464,12 @@ fn integer_bitwise_xor_with_lhs_dynamic_integer_and_rhs_classical_integer() { readout_callable_id, &expect![[r#" Callable: - name: __quantum__rt__read_result - call_type: Readout + name: __quantum__qis__mresetz__body + call_type: Measurement input_type: - [0]: Result - output_type: Boolean + [0]: Qubit + [1]: Result + output_type: body: "#]], ); let output_record_id = CallableId(3); @@ -2478,12 +2478,11 @@ fn integer_bitwise_xor_with_lhs_dynamic_integer_and_rhs_classical_integer() { output_record_id, &expect![[r#" Callable: - name: __quantum__rt__int_record_output - call_type: OutputRecording + name: __quantum__rt__read_result + call_type: Readout input_type: - [0]: Integer - [1]: Pointer - output_type: + [0]: Result + output_type: Boolean body: "#]], ); assert_blocks( @@ -2491,8 +2490,9 @@ fn integer_bitwise_xor_with_lhs_dynamic_integer_and_rhs_classical_integer() { &expect![[r#" Blocks: Block 0:Block: - Call id(1), args( Qubit(0), Result(0), ) - Variable(0, Boolean) = Call id(2), args( Result(0), ) + Call id(1), args( Pointer, ) + Call id(2), args( Qubit(0), Result(0), ) + Variable(0, Boolean) = Call id(3), args( Result(0), ) Variable(1, Boolean) = Icmp Eq, Variable(0, Boolean), Bool(false) Branch Variable(1, Boolean), 2, 3 Block 1:Block: @@ -2500,7 +2500,7 @@ fn integer_bitwise_xor_with_lhs_dynamic_integer_and_rhs_classical_integer() { Variable(4, Integer) = BitwiseXor Variable(3, Integer), Integer(1) Variable(3, Integer) = Store Variable(4, Integer) Variable(5, Integer) = Store Variable(3, Integer) - Call id(3), args( Variable(5, Integer), Tag(0, 3), ) + Call id(4), args( Variable(5, Integer), Tag(0, 3), ) Return Block 2:Block: Variable(2, Integer) = Store Integer(0) @@ -2532,11 +2532,10 @@ fn integer_assign_bitwise_left_shift_with_lhs_dynamic_integer_and_rhs_dynamic_in measurement_callable_id, &expect![[r#" Callable: - name: __quantum__qis__mresetz__body - call_type: Measurement + name: __quantum__rt__initialize + call_type: Regular input_type: - [0]: Qubit - [1]: Result + [0]: Pointer output_type: body: "#]], ); @@ -2546,11 +2545,12 @@ fn integer_assign_bitwise_left_shift_with_lhs_dynamic_integer_and_rhs_dynamic_in readout_callable_id, &expect![[r#" Callable: - name: __quantum__rt__read_result - call_type: Readout + name: __quantum__qis__mresetz__body + call_type: Measurement input_type: - [0]: Result - output_type: Boolean + [0]: Qubit + [1]: Result + output_type: body: "#]], ); let output_record_id = CallableId(3); @@ -2559,12 +2559,11 @@ fn integer_assign_bitwise_left_shift_with_lhs_dynamic_integer_and_rhs_dynamic_in output_record_id, &expect![[r#" Callable: - name: __quantum__rt__int_record_output - call_type: OutputRecording + name: __quantum__rt__read_result + call_type: Readout input_type: - [0]: Integer - [1]: Pointer - output_type: + [0]: Result + output_type: Boolean body: "#]], ); assert_blocks( @@ -2572,14 +2571,15 @@ fn integer_assign_bitwise_left_shift_with_lhs_dynamic_integer_and_rhs_dynamic_in &expect![[r#" Blocks: Block 0:Block: - Call id(1), args( Qubit(0), Result(0), ) - Variable(0, Boolean) = Call id(2), args( Result(0), ) + Call id(1), args( Pointer, ) + Call id(2), args( Qubit(0), Result(0), ) + Variable(0, Boolean) = Call id(3), args( Result(0), ) Variable(1, Boolean) = Icmp Eq, Variable(0, Boolean), Bool(false) Branch Variable(1, Boolean), 2, 3 Block 1:Block: Variable(3, Integer) = Store Variable(2, Integer) - Call id(1), args( Qubit(0), Result(1), ) - Variable(4, Boolean) = Call id(2), args( Result(1), ) + Call id(2), args( Qubit(0), Result(1), ) + Variable(4, Boolean) = Call id(3), args( Result(1), ) Variable(5, Boolean) = Icmp Eq, Variable(4, Boolean), Bool(false) Branch Variable(5, Boolean), 5, 6 Block 2:Block: @@ -2592,7 +2592,7 @@ fn integer_assign_bitwise_left_shift_with_lhs_dynamic_integer_and_rhs_dynamic_in Variable(7, Integer) = Shl Variable(3, Integer), Variable(6, Integer) Variable(3, Integer) = Store Variable(7, Integer) Variable(8, Integer) = Store Variable(3, Integer) - Call id(3), args( Variable(8, Integer), Tag(0, 3), ) + Call id(4), args( Variable(8, Integer), Tag(0, 3), ) Return Block 5:Block: Variable(6, Integer) = Store Integer(1) @@ -2624,11 +2624,10 @@ fn integer_assign_bitwise_right_shift_with_lhs_classical_integer_and_rhs_dynamic measurement_callable_id, &expect![[r#" Callable: - name: __quantum__qis__mresetz__body - call_type: Measurement + name: __quantum__rt__initialize + call_type: Regular input_type: - [0]: Qubit - [1]: Result + [0]: Pointer output_type: body: "#]], ); @@ -2638,11 +2637,12 @@ fn integer_assign_bitwise_right_shift_with_lhs_classical_integer_and_rhs_dynamic readout_callable_id, &expect![[r#" Callable: - name: __quantum__rt__read_result - call_type: Readout + name: __quantum__qis__mresetz__body + call_type: Measurement input_type: - [0]: Result - output_type: Boolean + [0]: Qubit + [1]: Result + output_type: body: "#]], ); let output_record_id = CallableId(3); @@ -2651,12 +2651,11 @@ fn integer_assign_bitwise_right_shift_with_lhs_classical_integer_and_rhs_dynamic output_record_id, &expect![[r#" Callable: - name: __quantum__rt__int_record_output - call_type: OutputRecording + name: __quantum__rt__read_result + call_type: Readout input_type: - [0]: Integer - [1]: Pointer - output_type: + [0]: Result + output_type: Boolean body: "#]], ); assert_blocks( @@ -2664,16 +2663,17 @@ fn integer_assign_bitwise_right_shift_with_lhs_classical_integer_and_rhs_dynamic &expect![[r#" Blocks: Block 0:Block: + Call id(1), args( Pointer, ) Variable(0, Integer) = Store Integer(0) - Call id(1), args( Qubit(0), Result(0), ) - Variable(1, Boolean) = Call id(2), args( Result(0), ) + Call id(2), args( Qubit(0), Result(0), ) + Variable(1, Boolean) = Call id(3), args( Result(0), ) Variable(2, Boolean) = Icmp Eq, Variable(1, Boolean), Bool(false) Branch Variable(2, Boolean), 2, 3 Block 1:Block: Variable(4, Integer) = Ashr Integer(0), Variable(3, Integer) Variable(0, Integer) = Store Variable(4, Integer) Variable(5, Integer) = Store Variable(0, Integer) - Call id(3), args( Variable(5, Integer), Tag(0, 3), ) + Call id(4), args( Variable(5, Integer), Tag(0, 3), ) Return Block 2:Block: Variable(3, Integer) = Store Integer(0) @@ -2705,11 +2705,10 @@ fn double_assign_add_with_lhs_classical_double_and_rhs_dynamic_double() { measurement_callable_id, &expect![[r#" Callable: - name: __quantum__qis__mresetz__body - call_type: Measurement + name: __quantum__rt__initialize + call_type: Regular input_type: - [0]: Qubit - [1]: Result + [0]: Pointer output_type: body: "#]], ); @@ -2719,11 +2718,12 @@ fn double_assign_add_with_lhs_classical_double_and_rhs_dynamic_double() { readout_callable_id, &expect![[r#" Callable: - name: __quantum__rt__read_result - call_type: Readout + name: __quantum__qis__mresetz__body + call_type: Measurement input_type: - [0]: Result - output_type: Boolean + [0]: Qubit + [1]: Result + output_type: body: "#]], ); let output_record_id = CallableId(3); @@ -2732,12 +2732,11 @@ fn double_assign_add_with_lhs_classical_double_and_rhs_dynamic_double() { output_record_id, &expect![[r#" Callable: - name: __quantum__rt__double_record_output - call_type: OutputRecording + name: __quantum__rt__read_result + call_type: Readout input_type: - [0]: Double - [1]: Pointer - output_type: + [0]: Result + output_type: Boolean body: "#]], ); assert_blocks( @@ -2745,16 +2744,17 @@ fn double_assign_add_with_lhs_classical_double_and_rhs_dynamic_double() { &expect![[r#" Blocks: Block 0:Block: + Call id(1), args( Pointer, ) Variable(0, Double) = Store Double(0) - Call id(1), args( Qubit(0), Result(0), ) - Variable(1, Boolean) = Call id(2), args( Result(0), ) + Call id(2), args( Qubit(0), Result(0), ) + Variable(1, Boolean) = Call id(3), args( Result(0), ) Variable(2, Boolean) = Icmp Eq, Variable(1, Boolean), Bool(false) Branch Variable(2, Boolean), 2, 3 Block 1:Block: Variable(4, Double) = Fadd Double(0), Variable(3, Double) Variable(0, Double) = Store Variable(4, Double) Variable(5, Double) = Store Variable(0, Double) - Call id(3), args( Variable(5, Double), Tag(0, 3), ) + Call id(4), args( Variable(5, Double), Tag(0, 3), ) Return Block 2:Block: Variable(3, Double) = Store Double(0) @@ -2786,11 +2786,10 @@ fn double_assign_sub_with_lhs_dynamic_double_and_rhs_classical_double() { measurement_callable_id, &expect![[r#" Callable: - name: __quantum__qis__mresetz__body - call_type: Measurement + name: __quantum__rt__initialize + call_type: Regular input_type: - [0]: Qubit - [1]: Result + [0]: Pointer output_type: body: "#]], ); @@ -2800,11 +2799,12 @@ fn double_assign_sub_with_lhs_dynamic_double_and_rhs_classical_double() { readout_callable_id, &expect![[r#" Callable: - name: __quantum__rt__read_result - call_type: Readout + name: __quantum__qis__mresetz__body + call_type: Measurement input_type: - [0]: Result - output_type: Boolean + [0]: Qubit + [1]: Result + output_type: body: "#]], ); let output_record_id = CallableId(3); @@ -2813,12 +2813,11 @@ fn double_assign_sub_with_lhs_dynamic_double_and_rhs_classical_double() { output_record_id, &expect![[r#" Callable: - name: __quantum__rt__double_record_output - call_type: OutputRecording + name: __quantum__rt__read_result + call_type: Readout input_type: - [0]: Double - [1]: Pointer - output_type: + [0]: Result + output_type: Boolean body: "#]], ); assert_blocks( @@ -2826,8 +2825,9 @@ fn double_assign_sub_with_lhs_dynamic_double_and_rhs_classical_double() { &expect![[r#" Blocks: Block 0:Block: - Call id(1), args( Qubit(0), Result(0), ) - Variable(0, Boolean) = Call id(2), args( Result(0), ) + Call id(1), args( Pointer, ) + Call id(2), args( Qubit(0), Result(0), ) + Variable(0, Boolean) = Call id(3), args( Result(0), ) Variable(1, Boolean) = Icmp Eq, Variable(0, Boolean), Bool(false) Branch Variable(1, Boolean), 2, 3 Block 1:Block: @@ -2835,7 +2835,7 @@ fn double_assign_sub_with_lhs_dynamic_double_and_rhs_classical_double() { Variable(4, Double) = Fsub Variable(3, Double), Double(1) Variable(3, Double) = Store Variable(4, Double) Variable(5, Double) = Store Variable(3, Double) - Call id(3), args( Variable(5, Double), Tag(0, 3), ) + Call id(4), args( Variable(5, Double), Tag(0, 3), ) Return Block 2:Block: Variable(2, Double) = Store Double(0) @@ -2867,11 +2867,10 @@ fn double_assign_mul_with_lhs_dynamic_double_and_rhs_dynamic_double() { measurement_callable_id, &expect![[r#" Callable: - name: __quantum__qis__mresetz__body - call_type: Measurement + name: __quantum__rt__initialize + call_type: Regular input_type: - [0]: Qubit - [1]: Result + [0]: Pointer output_type: body: "#]], ); @@ -2881,11 +2880,12 @@ fn double_assign_mul_with_lhs_dynamic_double_and_rhs_dynamic_double() { readout_callable_id, &expect![[r#" Callable: - name: __quantum__rt__read_result - call_type: Readout + name: __quantum__qis__mresetz__body + call_type: Measurement input_type: - [0]: Result - output_type: Boolean + [0]: Qubit + [1]: Result + output_type: body: "#]], ); let output_record_id = CallableId(3); @@ -2894,12 +2894,11 @@ fn double_assign_mul_with_lhs_dynamic_double_and_rhs_dynamic_double() { output_record_id, &expect![[r#" Callable: - name: __quantum__rt__double_record_output - call_type: OutputRecording + name: __quantum__rt__read_result + call_type: Readout input_type: - [0]: Double - [1]: Pointer - output_type: + [0]: Result + output_type: Boolean body: "#]], ); assert_blocks( @@ -2907,14 +2906,15 @@ fn double_assign_mul_with_lhs_dynamic_double_and_rhs_dynamic_double() { &expect![[r#" Blocks: Block 0:Block: - Call id(1), args( Qubit(0), Result(0), ) - Variable(0, Boolean) = Call id(2), args( Result(0), ) + Call id(1), args( Pointer, ) + Call id(2), args( Qubit(0), Result(0), ) + Variable(0, Boolean) = Call id(3), args( Result(0), ) Variable(1, Boolean) = Icmp Eq, Variable(0, Boolean), Bool(false) Branch Variable(1, Boolean), 2, 3 Block 1:Block: Variable(3, Double) = Store Variable(2, Double) - Call id(1), args( Qubit(0), Result(1), ) - Variable(4, Boolean) = Call id(2), args( Result(1), ) + Call id(2), args( Qubit(0), Result(1), ) + Variable(4, Boolean) = Call id(3), args( Result(1), ) Variable(5, Boolean) = Icmp Eq, Variable(4, Boolean), Bool(false) Branch Variable(5, Boolean), 5, 6 Block 2:Block: @@ -2927,7 +2927,7 @@ fn double_assign_mul_with_lhs_dynamic_double_and_rhs_dynamic_double() { Variable(7, Double) = Fmul Variable(3, Double), Variable(6, Double) Variable(3, Double) = Store Variable(7, Double) Variable(8, Double) = Store Variable(3, Double) - Call id(3), args( Variable(8, Double), Tag(0, 3), ) + Call id(4), args( Variable(8, Double), Tag(0, 3), ) Return Block 5:Block: Variable(6, Double) = Store Double(1.1) @@ -2959,11 +2959,10 @@ fn double_assign_div_with_lhs_classical_double_and_rhs_dynamic_double() { measurement_callable_id, &expect![[r#" Callable: - name: __quantum__qis__mresetz__body - call_type: Measurement + name: __quantum__rt__initialize + call_type: Regular input_type: - [0]: Qubit - [1]: Result + [0]: Pointer output_type: body: "#]], ); @@ -2973,11 +2972,12 @@ fn double_assign_div_with_lhs_classical_double_and_rhs_dynamic_double() { readout_callable_id, &expect![[r#" Callable: - name: __quantum__rt__read_result - call_type: Readout + name: __quantum__qis__mresetz__body + call_type: Measurement input_type: - [0]: Result - output_type: Boolean + [0]: Qubit + [1]: Result + output_type: body: "#]], ); let output_record_id = CallableId(3); @@ -2986,12 +2986,11 @@ fn double_assign_div_with_lhs_classical_double_and_rhs_dynamic_double() { output_record_id, &expect![[r#" Callable: - name: __quantum__rt__double_record_output - call_type: OutputRecording + name: __quantum__rt__read_result + call_type: Readout input_type: - [0]: Double - [1]: Pointer - output_type: + [0]: Result + output_type: Boolean body: "#]], ); assert_blocks( @@ -2999,16 +2998,17 @@ fn double_assign_div_with_lhs_classical_double_and_rhs_dynamic_double() { &expect![[r#" Blocks: Block 0:Block: + Call id(1), args( Pointer, ) Variable(0, Double) = Store Double(0) - Call id(1), args( Qubit(0), Result(0), ) - Variable(1, Boolean) = Call id(2), args( Result(0), ) + Call id(2), args( Qubit(0), Result(0), ) + Variable(1, Boolean) = Call id(3), args( Result(0), ) Variable(2, Boolean) = Icmp Eq, Variable(1, Boolean), Bool(false) Branch Variable(2, Boolean), 2, 3 Block 1:Block: Variable(4, Double) = Fdiv Double(0), Variable(3, Double) Variable(0, Double) = Store Variable(4, Double) Variable(5, Double) = Store Variable(0, Double) - Call id(3), args( Variable(5, Double), Tag(0, 3), ) + Call id(4), args( Variable(5, Double), Tag(0, 3), ) Return Block 2:Block: Variable(3, Double) = Store Double(0) diff --git a/source/compiler/qsc_partial_eval/src/tests/bindings.rs b/source/compiler/qsc_partial_eval/src/tests/bindings.rs index c8668d1d0b..c1eb44571d 100644 --- a/source/compiler/qsc_partial_eval/src/tests/bindings.rs +++ b/source/compiler/qsc_partial_eval/src/tests/bindings.rs @@ -30,11 +30,10 @@ fn immutable_result_binding_does_not_generate_store_instruction() { measurement_callable_id, &expect![[r#" Callable: - name: __quantum__qis__mresetz__body - call_type: Measurement + name: __quantum__rt__initialize + call_type: Regular input_type: - [0]: Qubit - [1]: Result + [0]: Pointer output_type: body: "#]], ); @@ -44,11 +43,11 @@ fn immutable_result_binding_does_not_generate_store_instruction() { output_recording_callable_id, &expect![[r#" Callable: - name: __quantum__rt__result_record_output - call_type: OutputRecording + name: __quantum__qis__mresetz__body + call_type: Measurement input_type: - [0]: Result - [1]: Pointer + [0]: Qubit + [1]: Result output_type: body: "#]], ); @@ -57,8 +56,9 @@ fn immutable_result_binding_does_not_generate_store_instruction() { BlockId(0), &expect![[r#" Block: - Call id(1), args( Qubit(0), Result(0), ) - Call id(2), args( Result(0), Tag(0, 3), ) + Call id(1), args( Pointer, ) + Call id(2), args( Qubit(0), Result(0), ) + Call id(3), args( Result(0), Tag(0, 3), ) Return"#]], ); } @@ -81,11 +81,10 @@ fn mutable_result_binding_does_not_generate_store_instruction() { measurement_callable_id, &expect![[r#" Callable: - name: __quantum__qis__mresetz__body - call_type: Measurement + name: __quantum__rt__initialize + call_type: Regular input_type: - [0]: Qubit - [1]: Result + [0]: Pointer output_type: body: "#]], ); @@ -95,11 +94,11 @@ fn mutable_result_binding_does_not_generate_store_instruction() { output_recording_callable_id, &expect![[r#" Callable: - name: __quantum__rt__result_record_output - call_type: OutputRecording + name: __quantum__qis__mresetz__body + call_type: Measurement input_type: - [0]: Result - [1]: Pointer + [0]: Qubit + [1]: Result output_type: body: "#]], ); @@ -108,8 +107,9 @@ fn mutable_result_binding_does_not_generate_store_instruction() { BlockId(0), &expect![[r#" Block: - Call id(1), args( Qubit(0), Result(0), ) - Call id(2), args( Result(0), Tag(0, 3), ) + Call id(1), args( Pointer, ) + Call id(2), args( Qubit(0), Result(0), ) + Call id(3), args( Result(0), Tag(0, 3), ) Return"#]], ); } @@ -132,11 +132,10 @@ fn immutable_bool_binding_does_not_generate_store_instruction() { measurement_callable_id, &expect![[r#" Callable: - name: __quantum__qis__mresetz__body - call_type: Measurement + name: __quantum__rt__initialize + call_type: Regular input_type: - [0]: Qubit - [1]: Result + [0]: Pointer output_type: body: "#]], ); @@ -146,11 +145,12 @@ fn immutable_bool_binding_does_not_generate_store_instruction() { read_result_callable_id, &expect![[r#" Callable: - name: __quantum__rt__read_result - call_type: Readout + name: __quantum__qis__mresetz__body + call_type: Measurement input_type: - [0]: Result - output_type: Boolean + [0]: Qubit + [1]: Result + output_type: body: "#]], ); let output_recording_callable_id = CallableId(3); @@ -159,12 +159,11 @@ fn immutable_bool_binding_does_not_generate_store_instruction() { output_recording_callable_id, &expect![[r#" Callable: - name: __quantum__rt__bool_record_output - call_type: OutputRecording + name: __quantum__rt__read_result + call_type: Readout input_type: - [0]: Boolean - [1]: Pointer - output_type: + [0]: Result + output_type: Boolean body: "#]], ); assert_block_instructions( @@ -172,12 +171,13 @@ fn immutable_bool_binding_does_not_generate_store_instruction() { BlockId(0), &expect![[r#" Block: - Call id(1), args( Qubit(0), Result(0), ) - Variable(0, Boolean) = Call id(2), args( Result(0), ) + Call id(1), args( Pointer, ) + Call id(2), args( Qubit(0), Result(0), ) + Variable(0, Boolean) = Call id(3), args( Result(0), ) Variable(1, Boolean) = Store Variable(0, Boolean) Variable(2, Boolean) = Store Variable(1, Boolean) Variable(3, Boolean) = Store Variable(2, Boolean) - Call id(3), args( Variable(3, Boolean), Tag(0, 3), ) + Call id(4), args( Variable(3, Boolean), Tag(0, 3), ) Return"#]], ); } @@ -200,11 +200,10 @@ fn mutable_bool_binding_generates_store_instruction() { measurement_callable_id, &expect![[r#" Callable: - name: __quantum__qis__mresetz__body - call_type: Measurement + name: __quantum__rt__initialize + call_type: Regular input_type: - [0]: Qubit - [1]: Result + [0]: Pointer output_type: body: "#]], ); @@ -214,11 +213,12 @@ fn mutable_bool_binding_generates_store_instruction() { read_result_callable_id, &expect![[r#" Callable: - name: __quantum__rt__read_result - call_type: Readout + name: __quantum__qis__mresetz__body + call_type: Measurement input_type: - [0]: Result - output_type: Boolean + [0]: Qubit + [1]: Result + output_type: body: "#]], ); let output_recording_callable_id = CallableId(3); @@ -227,12 +227,11 @@ fn mutable_bool_binding_generates_store_instruction() { output_recording_callable_id, &expect![[r#" Callable: - name: __quantum__rt__bool_record_output - call_type: OutputRecording + name: __quantum__rt__read_result + call_type: Readout input_type: - [0]: Boolean - [1]: Pointer - output_type: + [0]: Result + output_type: Boolean body: "#]], ); assert_block_instructions( @@ -240,12 +239,13 @@ fn mutable_bool_binding_generates_store_instruction() { BlockId(0), &expect![[r#" Block: - Call id(1), args( Qubit(0), Result(0), ) - Variable(0, Boolean) = Call id(2), args( Result(0), ) + Call id(1), args( Pointer, ) + Call id(2), args( Qubit(0), Result(0), ) + Variable(0, Boolean) = Call id(3), args( Result(0), ) Variable(1, Boolean) = Store Variable(0, Boolean) Variable(2, Boolean) = Store Variable(1, Boolean) Variable(3, Boolean) = Store Variable(2, Boolean) - Call id(3), args( Variable(3, Boolean), Tag(0, 3), ) + Call id(4), args( Variable(3, Boolean), Tag(0, 3), ) Return"#]], ); } @@ -268,11 +268,10 @@ fn immutable_int_binding_does_not_generate_store_instruction() { measurement_callable_id, &expect![[r#" Callable: - name: __quantum__qis__mresetz__body - call_type: Measurement + name: __quantum__rt__initialize + call_type: Regular input_type: - [0]: Qubit - [1]: Result + [0]: Pointer output_type: body: "#]], ); @@ -282,11 +281,12 @@ fn immutable_int_binding_does_not_generate_store_instruction() { read_result_callable_id, &expect![[r#" Callable: - name: __quantum__rt__read_result - call_type: Readout + name: __quantum__qis__mresetz__body + call_type: Measurement input_type: - [0]: Result - output_type: Boolean + [0]: Qubit + [1]: Result + output_type: body: "#]], ); let output_recording_callable_id = CallableId(3); @@ -295,12 +295,11 @@ fn immutable_int_binding_does_not_generate_store_instruction() { output_recording_callable_id, &expect![[r#" Callable: - name: __quantum__rt__int_record_output - call_type: OutputRecording + name: __quantum__rt__read_result + call_type: Readout input_type: - [0]: Integer - [1]: Pointer - output_type: + [0]: Result + output_type: Boolean body: "#]], ); assert_blocks( @@ -308,14 +307,15 @@ fn immutable_int_binding_does_not_generate_store_instruction() { &expect![[r#" Blocks: Block 0:Block: - Call id(1), args( Qubit(0), Result(0), ) - Variable(0, Boolean) = Call id(2), args( Result(0), ) + Call id(1), args( Pointer, ) + Call id(2), args( Qubit(0), Result(0), ) + Variable(0, Boolean) = Call id(3), args( Result(0), ) Variable(1, Boolean) = Store Variable(0, Boolean) Branch Variable(1, Boolean), 2, 3 Block 1:Block: Variable(3, Integer) = Store Variable(2, Integer) Variable(4, Integer) = Store Variable(3, Integer) - Call id(3), args( Variable(4, Integer), Tag(0, 3), ) + Call id(4), args( Variable(4, Integer), Tag(0, 3), ) Return Block 2:Block: Variable(2, Integer) = Store Integer(0) @@ -344,11 +344,10 @@ fn mutable_int_binding_does_generate_store_instruction() { measurement_callable_id, &expect![[r#" Callable: - name: __quantum__qis__mresetz__body - call_type: Measurement + name: __quantum__rt__initialize + call_type: Regular input_type: - [0]: Qubit - [1]: Result + [0]: Pointer output_type: body: "#]], ); @@ -358,11 +357,12 @@ fn mutable_int_binding_does_generate_store_instruction() { read_result_callable_id, &expect![[r#" Callable: - name: __quantum__rt__read_result - call_type: Readout + name: __quantum__qis__mresetz__body + call_type: Measurement input_type: - [0]: Result - output_type: Boolean + [0]: Qubit + [1]: Result + output_type: body: "#]], ); let output_recording_callable_id = CallableId(3); @@ -371,12 +371,11 @@ fn mutable_int_binding_does_generate_store_instruction() { output_recording_callable_id, &expect![[r#" Callable: - name: __quantum__rt__int_record_output - call_type: OutputRecording + name: __quantum__rt__read_result + call_type: Readout input_type: - [0]: Integer - [1]: Pointer - output_type: + [0]: Result + output_type: Boolean body: "#]], ); assert_blocks( @@ -384,14 +383,15 @@ fn mutable_int_binding_does_generate_store_instruction() { &expect![[r#" Blocks: Block 0:Block: - Call id(1), args( Qubit(0), Result(0), ) - Variable(0, Boolean) = Call id(2), args( Result(0), ) + Call id(1), args( Pointer, ) + Call id(2), args( Qubit(0), Result(0), ) + Variable(0, Boolean) = Call id(3), args( Result(0), ) Variable(1, Boolean) = Store Variable(0, Boolean) Branch Variable(1, Boolean), 2, 3 Block 1:Block: Variable(3, Integer) = Store Variable(2, Integer) Variable(4, Integer) = Store Variable(3, Integer) - Call id(3), args( Variable(4, Integer), Tag(0, 3), ) + Call id(4), args( Variable(4, Integer), Tag(0, 3), ) Return Block 2:Block: Variable(2, Integer) = Store Integer(0) @@ -430,11 +430,10 @@ fn mutable_variable_in_outer_scope_set_to_mutable_from_inner_scope() { measurement_callable_id, &expect![[r#" Callable: - name: __quantum__qis__mresetz__body - call_type: Measurement + name: __quantum__rt__initialize + call_type: Regular input_type: - [0]: Qubit - [1]: Result + [0]: Pointer output_type: body: "#]], ); @@ -444,11 +443,12 @@ fn mutable_variable_in_outer_scope_set_to_mutable_from_inner_scope() { read_result_callable_id, &expect![[r#" Callable: - name: __quantum__rt__read_result - call_type: Readout + name: __quantum__qis__mresetz__body + call_type: Measurement input_type: - [0]: Result - output_type: Boolean + [0]: Qubit + [1]: Result + output_type: body: "#]], ); let output_recording_callable_id = CallableId(3); @@ -457,12 +457,11 @@ fn mutable_variable_in_outer_scope_set_to_mutable_from_inner_scope() { output_recording_callable_id, &expect![[r#" Callable: - name: __quantum__rt__int_record_output - call_type: OutputRecording + name: __quantum__rt__read_result + call_type: Readout input_type: - [0]: Integer - [1]: Pointer - output_type: + [0]: Result + output_type: Boolean body: "#]], ); assert_blocks( @@ -470,14 +469,15 @@ fn mutable_variable_in_outer_scope_set_to_mutable_from_inner_scope() { &expect![[r#" Blocks: Block 0:Block: + Call id(1), args( Pointer, ) Variable(0, Integer) = Store Integer(0) - Call id(1), args( Qubit(0), Result(0), ) - Variable(1, Boolean) = Call id(2), args( Result(0), ) + Call id(2), args( Qubit(0), Result(0), ) + Variable(1, Boolean) = Call id(3), args( Result(0), ) Variable(2, Boolean) = Store Variable(1, Boolean) Branch Variable(2, Boolean), 2, 3 Block 1:Block: Variable(4, Integer) = Store Variable(0, Integer) - Call id(3), args( Variable(4, Integer), Tag(0, 3), ) + Call id(4), args( Variable(4, Integer), Tag(0, 3), ) Return Block 2:Block: Variable(3, Integer) = Store Integer(1) @@ -507,11 +507,10 @@ fn mutable_double_binding_does_generate_store_instruction() { measurement_callable_id, &expect![[r#" Callable: - name: __quantum__qis__mresetz__body - call_type: Measurement + name: __quantum__rt__initialize + call_type: Regular input_type: - [0]: Qubit - [1]: Result + [0]: Pointer output_type: body: "#]], ); @@ -521,11 +520,12 @@ fn mutable_double_binding_does_generate_store_instruction() { read_result_callable_id, &expect![[r#" Callable: - name: __quantum__rt__read_result - call_type: Readout + name: __quantum__qis__mresetz__body + call_type: Measurement input_type: - [0]: Result - output_type: Boolean + [0]: Qubit + [1]: Result + output_type: body: "#]], ); let output_recording_callable_id = CallableId(3); @@ -534,12 +534,11 @@ fn mutable_double_binding_does_generate_store_instruction() { output_recording_callable_id, &expect![[r#" Callable: - name: __quantum__rt__double_record_output - call_type: OutputRecording + name: __quantum__rt__read_result + call_type: Readout input_type: - [0]: Double - [1]: Pointer - output_type: + [0]: Result + output_type: Boolean body: "#]], ); assert_blocks( @@ -547,14 +546,15 @@ fn mutable_double_binding_does_generate_store_instruction() { &expect![[r#" Blocks: Block 0:Block: - Call id(1), args( Qubit(0), Result(0), ) - Variable(0, Boolean) = Call id(2), args( Result(0), ) + Call id(1), args( Pointer, ) + Call id(2), args( Qubit(0), Result(0), ) + Variable(0, Boolean) = Call id(3), args( Result(0), ) Variable(1, Boolean) = Store Variable(0, Boolean) Branch Variable(1, Boolean), 2, 3 Block 1:Block: Variable(3, Double) = Store Variable(2, Double) Variable(4, Double) = Store Variable(3, Double) - Call id(3), args( Variable(4, Double), Tag(0, 3), ) + Call id(4), args( Variable(4, Double), Tag(0, 3), ) Return Block 2:Block: Variable(2, Double) = Store Double(0.1) diff --git a/source/compiler/qsc_partial_eval/src/tests/branching.rs b/source/compiler/qsc_partial_eval/src/tests/branching.rs index 6913334295..d39754728f 100644 --- a/source/compiler/qsc_partial_eval/src/tests/branching.rs +++ b/source/compiler/qsc_partial_eval/src/tests/branching.rs @@ -35,21 +35,22 @@ fn if_expression_with_true_condition() { &program, op_a_callable_id, &expect![[r#" - Callable: - name: opA - call_type: Regular - input_type: - [0]: Qubit - output_type: - body: "#]], + Callable: + name: __quantum__rt__initialize + call_type: Regular + input_type: + [0]: Pointer + output_type: + body: "#]], ); assert_blocks( &program, &expect![[r#" Blocks: Block 0:Block: - Call id(1), args( Qubit(0), ) - Call id(2), args( Integer(0), EmptyTag, ) + Call id(1), args( Pointer, ) + Call id(2), args( Qubit(0), ) + Call id(3), args( Integer(0), EmptyTag, ) Return"#]], ); } @@ -75,7 +76,8 @@ fn if_expression_with_false_condition() { &expect![[r#" Blocks: Block 0:Block: - Call id(1), args( Integer(0), EmptyTag, ) + Call id(1), args( Pointer, ) + Call id(2), args( Integer(0), EmptyTag, ) Return"#]], ); } @@ -104,21 +106,22 @@ fn if_else_expression_with_true_condition() { &program, op_a_callable_id, &expect![[r#" - Callable: - name: opA - call_type: Regular - input_type: - [0]: Qubit - output_type: - body: "#]], + Callable: + name: __quantum__rt__initialize + call_type: Regular + input_type: + [0]: Pointer + output_type: + body: "#]], ); assert_blocks( &program, &expect![[r#" Blocks: Block 0:Block: - Call id(1), args( Qubit(0), ) - Call id(2), args( Integer(0), EmptyTag, ) + Call id(1), args( Pointer, ) + Call id(2), args( Qubit(0), ) + Call id(3), args( Integer(0), EmptyTag, ) Return"#]], ); } @@ -147,21 +150,22 @@ fn if_else_expression_with_false_condition() { &program, op_b_callable_id, &expect![[r#" - Callable: - name: opB - call_type: Regular - input_type: - [0]: Qubit - output_type: - body: "#]], + Callable: + name: __quantum__rt__initialize + call_type: Regular + input_type: + [0]: Pointer + output_type: + body: "#]], ); assert_blocks( &program, &expect![[r#" Blocks: Block 0:Block: - Call id(1), args( Qubit(0), ) - Call id(2), args( Integer(0), EmptyTag, ) + Call id(1), args( Pointer, ) + Call id(2), args( Qubit(0), ) + Call id(3), args( Integer(0), EmptyTag, ) Return"#]], ); } @@ -193,21 +197,22 @@ fn if_elif_else_expression_with_true_elif_condition() { &program, op_b_callable_id, &expect![[r#" - Callable: - name: opB - call_type: Regular - input_type: - [0]: Qubit - output_type: - body: "#]], + Callable: + name: __quantum__rt__initialize + call_type: Regular + input_type: + [0]: Pointer + output_type: + body: "#]], ); assert_blocks( &program, &expect![[r#" Blocks: Block 0:Block: - Call id(1), args( Qubit(0), ) - Call id(2), args( Integer(0), EmptyTag, ) + Call id(1), args( Pointer, ) + Call id(2), args( Qubit(0), ) + Call id(3), args( Integer(0), EmptyTag, ) Return"#]], ); } @@ -236,14 +241,13 @@ fn if_expression_with_dynamic_condition() { &program, mresetz_callable_id, &expect![[r#" - Callable: - name: __quantum__qis__mresetz__body - call_type: Measurement - input_type: - [0]: Qubit - [1]: Result - output_type: - body: "#]], + Callable: + name: __quantum__rt__initialize + call_type: Regular + input_type: + [0]: Pointer + output_type: + body: "#]], ); let read_result_callable_id = CallableId(2); assert_callable( @@ -251,11 +255,12 @@ fn if_expression_with_dynamic_condition() { read_result_callable_id, &expect![[r#" Callable: - name: __quantum__rt__read_result - call_type: Readout + name: __quantum__qis__mresetz__body + call_type: Measurement input_type: - [0]: Result - output_type: Boolean + [0]: Qubit + [1]: Result + output_type: body: "#]], ); let op_a_callable_id = CallableId(3); @@ -263,13 +268,13 @@ fn if_expression_with_dynamic_condition() { &program, op_a_callable_id, &expect![[r#" - Callable: - name: opA - call_type: Regular - input_type: - [0]: Qubit - output_type: - body: "#]], + Callable: + name: __quantum__rt__read_result + call_type: Readout + input_type: + [0]: Result + output_type: Boolean + body: "#]], ); assert_blocks( @@ -277,15 +282,16 @@ fn if_expression_with_dynamic_condition() { &expect![[r#" Blocks: Block 0:Block: - Call id(1), args( Qubit(0), Result(0), ) - Variable(0, Boolean) = Call id(2), args( Result(0), ) + Call id(1), args( Pointer, ) + Call id(2), args( Qubit(0), Result(0), ) + Variable(0, Boolean) = Call id(3), args( Result(0), ) Variable(1, Boolean) = Icmp Eq, Variable(0, Boolean), Bool(false) Branch Variable(1, Boolean), 2, 1 Block 1:Block: - Call id(4), args( Integer(0), EmptyTag, ) + Call id(5), args( Integer(0), EmptyTag, ) Return Block 2:Block: - Call id(3), args( Qubit(0), ) + Call id(4), args( Qubit(0), ) Jump(1)"#]], ); } @@ -317,14 +323,13 @@ fn if_else_expression_with_dynamic_condition() { &program, mresetz_callable_id, &expect![[r#" - Callable: - name: __quantum__qis__mresetz__body - call_type: Measurement - input_type: - [0]: Qubit - [1]: Result - output_type: - body: "#]], + Callable: + name: __quantum__rt__initialize + call_type: Regular + input_type: + [0]: Pointer + output_type: + body: "#]], ); let read_result_callable_id = CallableId(2); assert_callable( @@ -332,11 +337,12 @@ fn if_else_expression_with_dynamic_condition() { read_result_callable_id, &expect![[r#" Callable: - name: __quantum__rt__read_result - call_type: Readout + name: __quantum__qis__mresetz__body + call_type: Measurement input_type: - [0]: Result - output_type: Boolean + [0]: Qubit + [1]: Result + output_type: body: "#]], ); let op_a_callable_id = CallableId(3); @@ -344,26 +350,26 @@ fn if_else_expression_with_dynamic_condition() { &program, op_a_callable_id, &expect![[r#" - Callable: - name: opA - call_type: Regular - input_type: - [0]: Qubit - output_type: - body: "#]], + Callable: + name: __quantum__rt__read_result + call_type: Readout + input_type: + [0]: Result + output_type: Boolean + body: "#]], ); let op_b_callable_id = CallableId(4); assert_callable( &program, op_b_callable_id, &expect![[r#" - Callable: - name: opB - call_type: Regular - input_type: - [0]: Qubit - output_type: - body: "#]], + Callable: + name: opA + call_type: Regular + input_type: + [0]: Qubit + output_type: + body: "#]], ); assert_blocks( @@ -371,18 +377,19 @@ fn if_else_expression_with_dynamic_condition() { &expect![[r#" Blocks: Block 0:Block: - Call id(1), args( Qubit(0), Result(0), ) - Variable(0, Boolean) = Call id(2), args( Result(0), ) + Call id(1), args( Pointer, ) + Call id(2), args( Qubit(0), Result(0), ) + Variable(0, Boolean) = Call id(3), args( Result(0), ) Variable(1, Boolean) = Store Variable(0, Boolean) Branch Variable(1, Boolean), 2, 3 Block 1:Block: - Call id(5), args( Integer(0), EmptyTag, ) + Call id(6), args( Integer(0), EmptyTag, ) Return Block 2:Block: - Call id(3), args( Qubit(0), ) + Call id(4), args( Qubit(0), ) Jump(1) Block 3:Block: - Call id(4), args( Qubit(0), ) + Call id(5), args( Qubit(0), ) Jump(1)"#]], ); } @@ -418,14 +425,13 @@ fn if_elif_else_expression_with_dynamic_condition() { &program, mresetz_callable_id, &expect![[r#" - Callable: - name: __quantum__qis__mresetz__body - call_type: Measurement - input_type: - [0]: Qubit - [1]: Result - output_type: - body: "#]], + Callable: + name: __quantum__rt__initialize + call_type: Regular + input_type: + [0]: Pointer + output_type: + body: "#]], ); let read_result_callable_id = CallableId(2); assert_callable( @@ -433,11 +439,12 @@ fn if_elif_else_expression_with_dynamic_condition() { read_result_callable_id, &expect![[r#" Callable: - name: __quantum__rt__read_result - call_type: Readout + name: __quantum__qis__mresetz__body + call_type: Measurement input_type: - [0]: Result - output_type: Boolean + [0]: Qubit + [1]: Result + output_type: body: "#]], ); let op_a_callable_id = CallableId(3); @@ -445,39 +452,39 @@ fn if_elif_else_expression_with_dynamic_condition() { &program, op_a_callable_id, &expect![[r#" - Callable: - name: opA - call_type: Regular - input_type: - [0]: Qubit - output_type: - body: "#]], + Callable: + name: __quantum__rt__read_result + call_type: Readout + input_type: + [0]: Result + output_type: Boolean + body: "#]], ); let op_b_callable_id = CallableId(4); assert_callable( &program, op_b_callable_id, &expect![[r#" - Callable: - name: opB - call_type: Regular - input_type: - [0]: Qubit - output_type: - body: "#]], + Callable: + name: opA + call_type: Regular + input_type: + [0]: Qubit + output_type: + body: "#]], ); let op_c_callable_id = CallableId(5); assert_callable( &program, op_c_callable_id, &expect![[r#" - Callable: - name: opC - call_type: Regular - input_type: - [0]: Qubit - output_type: - body: "#]], + Callable: + name: opB + call_type: Regular + input_type: + [0]: Qubit + output_type: + body: "#]], ); assert_blocks( @@ -485,28 +492,29 @@ fn if_elif_else_expression_with_dynamic_condition() { &expect![[r#" Blocks: Block 0:Block: - Call id(1), args( Qubit(0), Result(0), ) - Call id(1), args( Qubit(1), Result(1), ) - Variable(0, Boolean) = Call id(2), args( Result(0), ) + Call id(1), args( Pointer, ) + Call id(2), args( Qubit(0), Result(0), ) + Call id(2), args( Qubit(1), Result(1), ) + Variable(0, Boolean) = Call id(3), args( Result(0), ) Variable(1, Boolean) = Store Variable(0, Boolean) Branch Variable(1, Boolean), 2, 3 Block 1:Block: - Call id(6), args( Integer(0), EmptyTag, ) + Call id(7), args( Integer(0), EmptyTag, ) Return Block 2:Block: - Call id(3), args( Qubit(2), ) + Call id(4), args( Qubit(2), ) Jump(1) Block 3:Block: - Variable(2, Boolean) = Call id(2), args( Result(1), ) + Variable(2, Boolean) = Call id(3), args( Result(1), ) Variable(3, Boolean) = Store Variable(2, Boolean) Branch Variable(3, Boolean), 5, 6 Block 4:Block: Jump(1) Block 5:Block: - Call id(4), args( Qubit(2), ) + Call id(5), args( Qubit(2), ) Jump(4) Block 6:Block: - Call id(5), args( Qubit(2), ) + Call id(6), args( Qubit(2), ) Jump(4)"#]], ); } @@ -537,14 +545,13 @@ fn if_expression_with_dynamic_condition_and_nested_if_expression_with_true_condi &program, mresetz_callable_id, &expect![[r#" - Callable: - name: __quantum__qis__mresetz__body - call_type: Measurement - input_type: - [0]: Qubit - [1]: Result - output_type: - body: "#]], + Callable: + name: __quantum__rt__initialize + call_type: Regular + input_type: + [0]: Pointer + output_type: + body: "#]], ); let read_result_callable_id = CallableId(2); assert_callable( @@ -552,11 +559,12 @@ fn if_expression_with_dynamic_condition_and_nested_if_expression_with_true_condi read_result_callable_id, &expect![[r#" Callable: - name: __quantum__rt__read_result - call_type: Readout + name: __quantum__qis__mresetz__body + call_type: Measurement input_type: - [0]: Result - output_type: Boolean + [0]: Qubit + [1]: Result + output_type: body: "#]], ); let op_a_callable_id = CallableId(3); @@ -564,13 +572,13 @@ fn if_expression_with_dynamic_condition_and_nested_if_expression_with_true_condi &program, op_a_callable_id, &expect![[r#" - Callable: - name: opA - call_type: Regular - input_type: - [0]: Qubit - output_type: - body: "#]], + Callable: + name: __quantum__rt__read_result + call_type: Readout + input_type: + [0]: Result + output_type: Boolean + body: "#]], ); assert_blocks( @@ -578,15 +586,16 @@ fn if_expression_with_dynamic_condition_and_nested_if_expression_with_true_condi &expect![[r#" Blocks: Block 0:Block: - Call id(1), args( Qubit(0), Result(0), ) - Variable(0, Boolean) = Call id(2), args( Result(0), ) + Call id(1), args( Pointer, ) + Call id(2), args( Qubit(0), Result(0), ) + Variable(0, Boolean) = Call id(3), args( Result(0), ) Variable(1, Boolean) = Icmp Eq, Variable(0, Boolean), Bool(false) Branch Variable(1, Boolean), 2, 1 Block 1:Block: - Call id(4), args( Integer(0), EmptyTag, ) + Call id(5), args( Integer(0), EmptyTag, ) Return Block 2:Block: - Call id(3), args( Qubit(0), ) + Call id(4), args( Qubit(0), ) Jump(1)"#]], ); } @@ -617,14 +626,13 @@ fn if_expression_with_dynamic_condition_and_nested_if_expression_with_false_cond &program, mresetz_callable_id, &expect![[r#" - Callable: - name: __quantum__qis__mresetz__body - call_type: Measurement - input_type: - [0]: Qubit - [1]: Result - output_type: - body: "#]], + Callable: + name: __quantum__rt__initialize + call_type: Regular + input_type: + [0]: Pointer + output_type: + body: "#]], ); let read_result_callable_id = CallableId(2); assert_callable( @@ -632,11 +640,12 @@ fn if_expression_with_dynamic_condition_and_nested_if_expression_with_false_cond read_result_callable_id, &expect![[r#" Callable: - name: __quantum__rt__read_result - call_type: Readout + name: __quantum__qis__mresetz__body + call_type: Measurement input_type: - [0]: Result - output_type: Boolean + [0]: Qubit + [1]: Result + output_type: body: "#]], ); @@ -645,12 +654,13 @@ fn if_expression_with_dynamic_condition_and_nested_if_expression_with_false_cond &expect![[r#" Blocks: Block 0:Block: - Call id(1), args( Qubit(0), Result(0), ) - Variable(0, Boolean) = Call id(2), args( Result(0), ) + Call id(1), args( Pointer, ) + Call id(2), args( Qubit(0), Result(0), ) + Variable(0, Boolean) = Call id(3), args( Result(0), ) Variable(1, Boolean) = Icmp Eq, Variable(0, Boolean), Bool(false) Branch Variable(1, Boolean), 2, 1 Block 1:Block: - Call id(3), args( Integer(0), EmptyTag, ) + Call id(4), args( Integer(0), EmptyTag, ) Return Block 2:Block: Jump(1)"#]], @@ -686,14 +696,13 @@ fn if_else_expression_with_dynamic_condition_and_nested_if_expression_with_true_ &program, mresetz_callable_id, &expect![[r#" - Callable: - name: __quantum__qis__mresetz__body - call_type: Measurement - input_type: - [0]: Qubit - [1]: Result - output_type: - body: "#]], + Callable: + name: __quantum__rt__initialize + call_type: Regular + input_type: + [0]: Pointer + output_type: + body: "#]], ); let read_result_callable_id = CallableId(2); assert_callable( @@ -701,11 +710,12 @@ fn if_else_expression_with_dynamic_condition_and_nested_if_expression_with_true_ read_result_callable_id, &expect![[r#" Callable: - name: __quantum__rt__read_result - call_type: Readout + name: __quantum__qis__mresetz__body + call_type: Measurement input_type: - [0]: Result - output_type: Boolean + [0]: Qubit + [1]: Result + output_type: body: "#]], ); let op_a_callable_id = CallableId(3); @@ -713,26 +723,26 @@ fn if_else_expression_with_dynamic_condition_and_nested_if_expression_with_true_ &program, op_a_callable_id, &expect![[r#" - Callable: - name: opA - call_type: Regular - input_type: - [0]: Qubit - output_type: - body: "#]], + Callable: + name: __quantum__rt__read_result + call_type: Readout + input_type: + [0]: Result + output_type: Boolean + body: "#]], ); let op_b_callable_id = CallableId(4); assert_callable( &program, op_b_callable_id, &expect![[r#" - Callable: - name: opB - call_type: Regular - input_type: - [0]: Qubit - output_type: - body: "#]], + Callable: + name: opA + call_type: Regular + input_type: + [0]: Qubit + output_type: + body: "#]], ); assert_blocks( @@ -740,18 +750,19 @@ fn if_else_expression_with_dynamic_condition_and_nested_if_expression_with_true_ &expect![[r#" Blocks: Block 0:Block: - Call id(1), args( Qubit(0), Result(0), ) - Variable(0, Boolean) = Call id(2), args( Result(0), ) + Call id(1), args( Pointer, ) + Call id(2), args( Qubit(0), Result(0), ) + Variable(0, Boolean) = Call id(3), args( Result(0), ) Variable(1, Boolean) = Store Variable(0, Boolean) Branch Variable(1, Boolean), 2, 3 Block 1:Block: - Call id(5), args( Integer(0), EmptyTag, ) + Call id(6), args( Integer(0), EmptyTag, ) Return Block 2:Block: - Call id(3), args( Qubit(0), ) + Call id(4), args( Qubit(0), ) Jump(1) Block 3:Block: - Call id(4), args( Qubit(0), ) + Call id(5), args( Qubit(0), ) Jump(1)"#]], ); } @@ -785,14 +796,13 @@ fn if_else_expression_with_dynamic_condition_and_nested_if_expression_with_false &program, mresetz_callable_id, &expect![[r#" - Callable: - name: __quantum__qis__mresetz__body - call_type: Measurement - input_type: - [0]: Qubit - [1]: Result - output_type: - body: "#]], + Callable: + name: __quantum__rt__initialize + call_type: Regular + input_type: + [0]: Pointer + output_type: + body: "#]], ); let read_result_callable_id = CallableId(2); assert_callable( @@ -800,11 +810,12 @@ fn if_else_expression_with_dynamic_condition_and_nested_if_expression_with_false read_result_callable_id, &expect![[r#" Callable: - name: __quantum__rt__read_result - call_type: Readout + name: __quantum__qis__mresetz__body + call_type: Measurement input_type: - [0]: Result - output_type: Boolean + [0]: Qubit + [1]: Result + output_type: body: "#]], ); let op_a_callable_id = CallableId(3); @@ -812,13 +823,13 @@ fn if_else_expression_with_dynamic_condition_and_nested_if_expression_with_false &program, op_a_callable_id, &expect![[r#" - Callable: - name: opA - call_type: Regular - input_type: - [0]: Qubit - output_type: - body: "#]], + Callable: + name: __quantum__rt__read_result + call_type: Readout + input_type: + [0]: Result + output_type: Boolean + body: "#]], ); assert_blocks( @@ -826,15 +837,16 @@ fn if_else_expression_with_dynamic_condition_and_nested_if_expression_with_false &expect![[r#" Blocks: Block 0:Block: - Call id(1), args( Qubit(0), Result(0), ) - Variable(0, Boolean) = Call id(2), args( Result(0), ) + Call id(1), args( Pointer, ) + Call id(2), args( Qubit(0), Result(0), ) + Variable(0, Boolean) = Call id(3), args( Result(0), ) Variable(1, Boolean) = Store Variable(0, Boolean) Branch Variable(1, Boolean), 2, 3 Block 1:Block: - Call id(4), args( Integer(0), EmptyTag, ) + Call id(5), args( Integer(0), EmptyTag, ) Return Block 2:Block: - Call id(3), args( Qubit(0), ) + Call id(4), args( Qubit(0), ) Jump(1) Block 3:Block: Jump(1)"#]], @@ -868,14 +880,13 @@ fn if_expression_with_dynamic_condition_and_nested_if_expression_with_dynamic_co &program, mresetz_callable_id, &expect![[r#" - Callable: - name: __quantum__qis__mresetz__body - call_type: Measurement - input_type: - [0]: Qubit - [1]: Result - output_type: - body: "#]], + Callable: + name: __quantum__rt__initialize + call_type: Regular + input_type: + [0]: Pointer + output_type: + body: "#]], ); let read_result_callable_id = CallableId(2); assert_callable( @@ -883,11 +894,12 @@ fn if_expression_with_dynamic_condition_and_nested_if_expression_with_dynamic_co read_result_callable_id, &expect![[r#" Callable: - name: __quantum__rt__read_result - call_type: Readout + name: __quantum__qis__mresetz__body + call_type: Measurement input_type: - [0]: Result - output_type: Boolean + [0]: Qubit + [1]: Result + output_type: body: "#]], ); let op_a_callable_id = CallableId(3); @@ -895,13 +907,13 @@ fn if_expression_with_dynamic_condition_and_nested_if_expression_with_dynamic_co &program, op_a_callable_id, &expect![[r#" - Callable: - name: opA - call_type: Regular - input_type: - [0]: Qubit - output_type: - body: "#]], + Callable: + name: __quantum__rt__read_result + call_type: Readout + input_type: + [0]: Result + output_type: Boolean + body: "#]], ); assert_blocks( @@ -909,22 +921,23 @@ fn if_expression_with_dynamic_condition_and_nested_if_expression_with_dynamic_co &expect![[r#" Blocks: Block 0:Block: - Call id(1), args( Qubit(0), Result(0), ) - Call id(1), args( Qubit(1), Result(1), ) - Variable(0, Boolean) = Call id(2), args( Result(0), ) + Call id(1), args( Pointer, ) + Call id(2), args( Qubit(0), Result(0), ) + Call id(2), args( Qubit(1), Result(1), ) + Variable(0, Boolean) = Call id(3), args( Result(0), ) Variable(1, Boolean) = Icmp Eq, Variable(0, Boolean), Bool(false) Branch Variable(1, Boolean), 2, 1 Block 1:Block: - Call id(4), args( Integer(0), EmptyTag, ) + Call id(5), args( Integer(0), EmptyTag, ) Return Block 2:Block: - Variable(2, Boolean) = Call id(2), args( Result(1), ) + Variable(2, Boolean) = Call id(3), args( Result(1), ) Variable(3, Boolean) = Store Variable(2, Boolean) Branch Variable(3, Boolean), 4, 3 Block 3:Block: Jump(1) Block 4:Block: - Call id(3), args( Qubit(2), ) + Call id(4), args( Qubit(2), ) Jump(3)"#]], ); } @@ -968,14 +981,13 @@ fn doubly_nested_if_else_expressions_with_dynamic_conditions() { &program, mresetz_callable_id, &expect![[r#" - Callable: - name: __quantum__qis__mresetz__body - call_type: Measurement - input_type: - [0]: Qubit - [1]: Result - output_type: - body: "#]], + Callable: + name: __quantum__rt__initialize + call_type: Regular + input_type: + [0]: Pointer + output_type: + body: "#]], ); let read_result_callable_id = CallableId(2); assert_callable( @@ -983,11 +995,12 @@ fn doubly_nested_if_else_expressions_with_dynamic_conditions() { read_result_callable_id, &expect![[r#" Callable: - name: __quantum__rt__read_result - call_type: Readout + name: __quantum__qis__mresetz__body + call_type: Measurement input_type: - [0]: Result - output_type: Boolean + [0]: Qubit + [1]: Result + output_type: body: "#]], ); let op_a_callable_id = CallableId(3); @@ -995,90 +1008,91 @@ fn doubly_nested_if_else_expressions_with_dynamic_conditions() { &program, op_a_callable_id, &expect![[r#" - Callable: - name: opA - call_type: Regular - input_type: - [0]: Qubit - output_type: - body: "#]], + Callable: + name: __quantum__rt__read_result + call_type: Readout + input_type: + [0]: Result + output_type: Boolean + body: "#]], ); let op_b_callable_id = CallableId(4); assert_callable( &program, op_b_callable_id, &expect![[r#" - Callable: - name: opB - call_type: Regular - input_type: - [0]: Qubit - output_type: - body: "#]], + Callable: + name: opA + call_type: Regular + input_type: + [0]: Qubit + output_type: + body: "#]], ); let op_c_callable_id = CallableId(5); assert_callable( &program, op_c_callable_id, &expect![[r#" - Callable: - name: opC - call_type: Regular - input_type: - [0]: Qubit - output_type: - body: "#]], + Callable: + name: opB + call_type: Regular + input_type: + [0]: Qubit + output_type: + body: "#]], ); let op_d_callable_id = CallableId(6); assert_callable( &program, op_d_callable_id, &expect![[r#" - Callable: - name: opD - call_type: Regular - input_type: - [0]: Qubit - output_type: - body: "#]], - ); - - assert_blocks( - &program, - &expect![[r#" + Callable: + name: opC + call_type: Regular + input_type: + [0]: Qubit + output_type: + body: "#]], + ); + + assert_blocks( + &program, + &expect![[r#" Blocks: Block 0:Block: - Call id(1), args( Qubit(0), Result(0), ) - Call id(1), args( Qubit(1), Result(1), ) - Variable(0, Boolean) = Call id(2), args( Result(0), ) + Call id(1), args( Pointer, ) + Call id(2), args( Qubit(0), Result(0), ) + Call id(2), args( Qubit(1), Result(1), ) + Variable(0, Boolean) = Call id(3), args( Result(0), ) Variable(1, Boolean) = Icmp Eq, Variable(0, Boolean), Bool(false) Branch Variable(1, Boolean), 2, 6 Block 1:Block: - Call id(7), args( Integer(0), EmptyTag, ) + Call id(8), args( Integer(0), EmptyTag, ) Return Block 2:Block: - Variable(2, Boolean) = Call id(2), args( Result(1), ) + Variable(2, Boolean) = Call id(3), args( Result(1), ) Variable(3, Boolean) = Icmp Eq, Variable(2, Boolean), Bool(false) Branch Variable(3, Boolean), 4, 5 Block 3:Block: Jump(1) Block 4:Block: - Call id(3), args( Qubit(2), ) + Call id(4), args( Qubit(2), ) Jump(3) Block 5:Block: - Call id(4), args( Qubit(2), ) + Call id(5), args( Qubit(2), ) Jump(3) Block 6:Block: - Variable(4, Boolean) = Call id(2), args( Result(1), ) + Variable(4, Boolean) = Call id(3), args( Result(1), ) Variable(5, Boolean) = Store Variable(4, Boolean) Branch Variable(5, Boolean), 8, 9 Block 7:Block: Jump(1) Block 8:Block: - Call id(5), args( Qubit(2), ) + Call id(6), args( Qubit(2), ) Jump(7) Block 9:Block: - Call id(6), args( Qubit(2), ) + Call id(7), args( Qubit(2), ) Jump(7)"#]], ); } @@ -1109,14 +1123,13 @@ fn if_expression_with_dynamic_condition_and_subsequent_call_to_operation() { &program, mresetz_callable_id, &expect![[r#" - Callable: - name: __quantum__qis__mresetz__body - call_type: Measurement - input_type: - [0]: Qubit - [1]: Result - output_type: - body: "#]], + Callable: + name: __quantum__rt__initialize + call_type: Regular + input_type: + [0]: Pointer + output_type: + body: "#]], ); let read_result_callable_id = CallableId(2); assert_callable( @@ -1124,11 +1137,12 @@ fn if_expression_with_dynamic_condition_and_subsequent_call_to_operation() { read_result_callable_id, &expect![[r#" Callable: - name: __quantum__rt__read_result - call_type: Readout + name: __quantum__qis__mresetz__body + call_type: Measurement input_type: - [0]: Result - output_type: Boolean + [0]: Qubit + [1]: Result + output_type: body: "#]], ); let op_a_callable_id = CallableId(3); @@ -1136,26 +1150,26 @@ fn if_expression_with_dynamic_condition_and_subsequent_call_to_operation() { &program, op_a_callable_id, &expect![[r#" - Callable: - name: opA - call_type: Regular - input_type: - [0]: Qubit - output_type: - body: "#]], + Callable: + name: __quantum__rt__read_result + call_type: Readout + input_type: + [0]: Result + output_type: Boolean + body: "#]], ); let op_b_callable_id = CallableId(4); assert_callable( &program, op_b_callable_id, &expect![[r#" - Callable: - name: opB - call_type: Regular - input_type: - [0]: Qubit - output_type: - body: "#]], + Callable: + name: opA + call_type: Regular + input_type: + [0]: Qubit + output_type: + body: "#]], ); assert_blocks( @@ -1163,16 +1177,17 @@ fn if_expression_with_dynamic_condition_and_subsequent_call_to_operation() { &expect![[r#" Blocks: Block 0:Block: - Call id(1), args( Qubit(0), Result(0), ) - Variable(0, Boolean) = Call id(2), args( Result(0), ) + Call id(1), args( Pointer, ) + Call id(2), args( Qubit(0), Result(0), ) + Variable(0, Boolean) = Call id(3), args( Result(0), ) Variable(1, Boolean) = Icmp Eq, Variable(0, Boolean), Bool(false) Branch Variable(1, Boolean), 2, 1 Block 1:Block: - Call id(4), args( Qubit(0), ) - Call id(5), args( Integer(0), EmptyTag, ) + Call id(5), args( Qubit(0), ) + Call id(6), args( Integer(0), EmptyTag, ) Return Block 2:Block: - Call id(3), args( Qubit(0), ) + Call id(4), args( Qubit(0), ) Jump(1)"#]], ); } @@ -1206,14 +1221,13 @@ fn if_else_expression_with_dynamic_condition_and_subsequent_call_to_operation() &program, mresetz_callable_id, &expect![[r#" - Callable: - name: __quantum__qis__mresetz__body - call_type: Measurement - input_type: - [0]: Qubit - [1]: Result - output_type: - body: "#]], + Callable: + name: __quantum__rt__initialize + call_type: Regular + input_type: + [0]: Pointer + output_type: + body: "#]], ); let read_result_callable_id = CallableId(2); assert_callable( @@ -1221,11 +1235,12 @@ fn if_else_expression_with_dynamic_condition_and_subsequent_call_to_operation() read_result_callable_id, &expect![[r#" Callable: - name: __quantum__rt__read_result - call_type: Readout + name: __quantum__qis__mresetz__body + call_type: Measurement input_type: - [0]: Result - output_type: Boolean + [0]: Qubit + [1]: Result + output_type: body: "#]], ); let op_a_callable_id = CallableId(3); @@ -1233,39 +1248,39 @@ fn if_else_expression_with_dynamic_condition_and_subsequent_call_to_operation() &program, op_a_callable_id, &expect![[r#" - Callable: - name: opA - call_type: Regular - input_type: - [0]: Qubit - output_type: - body: "#]], + Callable: + name: __quantum__rt__read_result + call_type: Readout + input_type: + [0]: Result + output_type: Boolean + body: "#]], ); let op_b_callable_id = CallableId(4); assert_callable( &program, op_b_callable_id, &expect![[r#" - Callable: - name: opB - call_type: Regular - input_type: - [0]: Qubit - output_type: - body: "#]], + Callable: + name: opA + call_type: Regular + input_type: + [0]: Qubit + output_type: + body: "#]], ); let op_c_callable_id = CallableId(5); assert_callable( &program, op_c_callable_id, &expect![[r#" - Callable: - name: opC - call_type: Regular - input_type: - [0]: Qubit - output_type: - body: "#]], + Callable: + name: opB + call_type: Regular + input_type: + [0]: Qubit + output_type: + body: "#]], ); assert_blocks( @@ -1273,19 +1288,20 @@ fn if_else_expression_with_dynamic_condition_and_subsequent_call_to_operation() &expect![[r#" Blocks: Block 0:Block: - Call id(1), args( Qubit(0), Result(0), ) - Variable(0, Boolean) = Call id(2), args( Result(0), ) + Call id(1), args( Pointer, ) + Call id(2), args( Qubit(0), Result(0), ) + Variable(0, Boolean) = Call id(3), args( Result(0), ) Variable(1, Boolean) = Store Variable(0, Boolean) Branch Variable(1, Boolean), 2, 3 Block 1:Block: - Call id(5), args( Qubit(0), ) - Call id(6), args( Integer(0), EmptyTag, ) + Call id(6), args( Qubit(0), ) + Call id(7), args( Integer(0), EmptyTag, ) Return Block 2:Block: - Call id(3), args( Qubit(0), ) + Call id(4), args( Qubit(0), ) Jump(1) Block 3:Block: - Call id(4), args( Qubit(0), ) + Call id(5), args( Qubit(0), ) Jump(1)"#]], ); } @@ -1336,27 +1352,27 @@ fn if_expression_with_classical_operand_from_hybrid_results_array_comparing_to_l &program, mresetz_callable_id, &expect![[r#" - Callable: - name: __quantum__qis__mresetz__body - call_type: Measurement - input_type: - [0]: Qubit - [1]: Result - output_type: - body: "#]], + Callable: + name: __quantum__rt__initialize + call_type: Regular + input_type: + [0]: Pointer + output_type: + body: "#]], ); let x_callable_id = CallableId(2); assert_callable( &program, x_callable_id, &expect![[r#" - Callable: - name: __quantum__qis__x__body - call_type: Regular - input_type: - [0]: Qubit - output_type: - body: "#]], + Callable: + name: __quantum__qis__mresetz__body + call_type: Measurement + input_type: + [0]: Qubit + [1]: Result + output_type: + body: "#]], ); let record_array_callable_id = CallableId(3); assert_callable( @@ -1364,11 +1380,10 @@ fn if_expression_with_classical_operand_from_hybrid_results_array_comparing_to_l record_array_callable_id, &expect![[r#" Callable: - name: __quantum__rt__array_record_output - call_type: OutputRecording + name: __quantum__qis__x__body + call_type: Regular input_type: - [0]: Integer - [1]: Pointer + [0]: Qubit output_type: body: "#]], ); @@ -1378,10 +1393,10 @@ fn if_expression_with_classical_operand_from_hybrid_results_array_comparing_to_l record_result_callable_id, &expect![[r#" Callable: - name: __quantum__rt__result_record_output + name: __quantum__rt__array_record_output call_type: OutputRecording input_type: - [0]: Result + [0]: Integer [1]: Pointer output_type: body: "#]], @@ -1391,12 +1406,13 @@ fn if_expression_with_classical_operand_from_hybrid_results_array_comparing_to_l &expect![[r#" Blocks: Block 0:Block: - Call id(1), args( Qubit(0), Result(0), ) - Call id(2), args( Qubit(1), ) - Call id(1), args( Qubit(1), Result(1), ) - Call id(3), args( Integer(2), EmptyTag, ) - Call id(4), args( Result(0), Tag(0, 5), ) - Call id(4), args( Result(1), Tag(1, 5), ) + Call id(1), args( Pointer, ) + Call id(2), args( Qubit(0), Result(0), ) + Call id(3), args( Qubit(1), ) + Call id(2), args( Qubit(1), Result(1), ) + Call id(4), args( Integer(2), EmptyTag, ) + Call id(5), args( Result(0), Tag(0, 5), ) + Call id(5), args( Result(1), Tag(1, 5), ) Return"#]], ); } @@ -1425,27 +1441,27 @@ fn if_expression_with_classical_operand_from_hybrid_results_array_comparing_to_l &program, mresetz_callable_id, &expect![[r#" - Callable: - name: __quantum__qis__mresetz__body - call_type: Measurement - input_type: - [0]: Qubit - [1]: Result - output_type: - body: "#]], + Callable: + name: __quantum__rt__initialize + call_type: Regular + input_type: + [0]: Pointer + output_type: + body: "#]], ); let x_callable_id = CallableId(2); assert_callable( &program, x_callable_id, &expect![[r#" - Callable: - name: __quantum__qis__x__body - call_type: Regular - input_type: - [0]: Qubit - output_type: - body: "#]], + Callable: + name: __quantum__qis__mresetz__body + call_type: Measurement + input_type: + [0]: Qubit + [1]: Result + output_type: + body: "#]], ); let record_array_callable_id = CallableId(3); assert_callable( @@ -1453,11 +1469,10 @@ fn if_expression_with_classical_operand_from_hybrid_results_array_comparing_to_l record_array_callable_id, &expect![[r#" Callable: - name: __quantum__rt__array_record_output - call_type: OutputRecording + name: __quantum__qis__x__body + call_type: Regular input_type: - [0]: Integer - [1]: Pointer + [0]: Qubit output_type: body: "#]], ); @@ -1467,10 +1482,10 @@ fn if_expression_with_classical_operand_from_hybrid_results_array_comparing_to_l record_result_callable_id, &expect![[r#" Callable: - name: __quantum__rt__result_record_output + name: __quantum__rt__array_record_output call_type: OutputRecording input_type: - [0]: Result + [0]: Integer [1]: Pointer output_type: body: "#]], @@ -1480,12 +1495,13 @@ fn if_expression_with_classical_operand_from_hybrid_results_array_comparing_to_l &expect![[r#" Blocks: Block 0:Block: - Call id(1), args( Qubit(0), Result(0), ) - Call id(2), args( Qubit(1), ) - Call id(1), args( Qubit(1), Result(1), ) - Call id(3), args( Integer(2), EmptyTag, ) - Call id(4), args( Result(0), Tag(0, 5), ) - Call id(4), args( Result(1), Tag(1, 5), ) + Call id(1), args( Pointer, ) + Call id(2), args( Qubit(0), Result(0), ) + Call id(3), args( Qubit(1), ) + Call id(2), args( Qubit(1), Result(1), ) + Call id(4), args( Integer(2), EmptyTag, ) + Call id(5), args( Result(0), Tag(0, 5), ) + Call id(5), args( Result(1), Tag(1, 5), ) Return"#]], ); } @@ -1514,14 +1530,13 @@ fn if_expression_with_dynamic_operand_from_hybrid_results_array() { &program, mresetz_callable_id, &expect![[r#" - Callable: - name: __quantum__qis__mresetz__body - call_type: Measurement - input_type: - [0]: Qubit - [1]: Result - output_type: - body: "#]], + Callable: + name: __quantum__rt__initialize + call_type: Regular + input_type: + [0]: Pointer + output_type: + body: "#]], ); let read_result_callable_id = CallableId(2); assert_callable( @@ -1529,11 +1544,12 @@ fn if_expression_with_dynamic_operand_from_hybrid_results_array() { read_result_callable_id, &expect![[r#" Callable: - name: __quantum__rt__read_result - call_type: Readout + name: __quantum__qis__mresetz__body + call_type: Measurement input_type: - [0]: Result - output_type: Boolean + [0]: Qubit + [1]: Result + output_type: body: "#]], ); let x_callable_id = CallableId(3); @@ -1542,11 +1558,11 @@ fn if_expression_with_dynamic_operand_from_hybrid_results_array() { x_callable_id, &expect![[r#" Callable: - name: __quantum__qis__x__body - call_type: Regular + name: __quantum__rt__read_result + call_type: Readout input_type: - [0]: Qubit - output_type: + [0]: Result + output_type: Boolean body: "#]], ); let record_array_callable_id = CallableId(4); @@ -1555,11 +1571,10 @@ fn if_expression_with_dynamic_operand_from_hybrid_results_array() { record_array_callable_id, &expect![[r#" Callable: - name: __quantum__rt__array_record_output - call_type: OutputRecording + name: __quantum__qis__x__body + call_type: Regular input_type: - [0]: Integer - [1]: Pointer + [0]: Qubit output_type: body: "#]], ); @@ -1569,10 +1584,10 @@ fn if_expression_with_dynamic_operand_from_hybrid_results_array() { record_result_callable_id, &expect![[r#" Callable: - name: __quantum__rt__result_record_output + name: __quantum__rt__array_record_output call_type: OutputRecording input_type: - [0]: Result + [0]: Integer [1]: Pointer output_type: body: "#]], @@ -1582,18 +1597,19 @@ fn if_expression_with_dynamic_operand_from_hybrid_results_array() { &expect![[r#" Blocks: Block 0:Block: - Call id(1), args( Qubit(0), Result(0), ) - Variable(0, Boolean) = Call id(2), args( Result(0), ) + Call id(1), args( Pointer, ) + Call id(2), args( Qubit(0), Result(0), ) + Variable(0, Boolean) = Call id(3), args( Result(0), ) Variable(1, Boolean) = Icmp Eq, Variable(0, Boolean), Bool(false) Branch Variable(1, Boolean), 2, 1 Block 1:Block: - Call id(1), args( Qubit(1), Result(1), ) - Call id(4), args( Integer(2), EmptyTag, ) - Call id(5), args( Result(0), Tag(0, 5), ) - Call id(5), args( Result(1), Tag(1, 5), ) + Call id(2), args( Qubit(1), Result(1), ) + Call id(5), args( Integer(2), EmptyTag, ) + Call id(6), args( Result(0), Tag(0, 5), ) + Call id(6), args( Result(1), Tag(1, 5), ) Return Block 2:Block: - Call id(3), args( Qubit(1), ) + Call id(4), args( Qubit(1), ) Jump(1)"#]], ); } @@ -1622,14 +1638,13 @@ fn if_expression_with_classical_operand_from_hybrid_booleans_array() { &program, mresetz_callable_id, &expect![[r#" - Callable: - name: __quantum__qis__mresetz__body - call_type: Measurement - input_type: - [0]: Qubit - [1]: Result - output_type: - body: "#]], + Callable: + name: __quantum__rt__initialize + call_type: Regular + input_type: + [0]: Pointer + output_type: + body: "#]], ); let read_result_callable_id = CallableId(2); assert_callable( @@ -1637,11 +1652,12 @@ fn if_expression_with_classical_operand_from_hybrid_booleans_array() { read_result_callable_id, &expect![[r#" Callable: - name: __quantum__rt__read_result - call_type: Readout + name: __quantum__qis__mresetz__body + call_type: Measurement input_type: - [0]: Result - output_type: Boolean + [0]: Qubit + [1]: Result + output_type: body: "#]], ); let x_callable_id = CallableId(3); @@ -1650,11 +1666,11 @@ fn if_expression_with_classical_operand_from_hybrid_booleans_array() { x_callable_id, &expect![[r#" Callable: - name: __quantum__qis__x__body - call_type: Regular + name: __quantum__rt__read_result + call_type: Readout input_type: - [0]: Qubit - output_type: + [0]: Result + output_type: Boolean body: "#]], ); let record_array_callable_id = CallableId(4); @@ -1663,11 +1679,10 @@ fn if_expression_with_classical_operand_from_hybrid_booleans_array() { record_array_callable_id, &expect![[r#" Callable: - name: __quantum__rt__array_record_output - call_type: OutputRecording + name: __quantum__qis__x__body + call_type: Regular input_type: - [0]: Integer - [1]: Pointer + [0]: Qubit output_type: body: "#]], ); @@ -1677,10 +1692,10 @@ fn if_expression_with_classical_operand_from_hybrid_booleans_array() { record_bool_callable_id, &expect![[r#" Callable: - name: __quantum__rt__bool_record_output + name: __quantum__rt__array_record_output call_type: OutputRecording input_type: - [0]: Boolean + [0]: Integer [1]: Pointer output_type: body: "#]], @@ -1690,16 +1705,17 @@ fn if_expression_with_classical_operand_from_hybrid_booleans_array() { &expect![[r#" Blocks: Block 0:Block: - Call id(1), args( Qubit(0), Result(0), ) - Variable(0, Boolean) = Call id(2), args( Result(0), ) + Call id(1), args( Pointer, ) + Call id(2), args( Qubit(0), Result(0), ) + Variable(0, Boolean) = Call id(3), args( Result(0), ) Variable(1, Boolean) = Store Variable(0, Boolean) - Call id(3), args( Qubit(1), ) - Call id(1), args( Qubit(1), Result(1), ) - Variable(2, Boolean) = Call id(2), args( Result(1), ) + Call id(4), args( Qubit(1), ) + Call id(2), args( Qubit(1), Result(1), ) + Variable(2, Boolean) = Call id(3), args( Result(1), ) Variable(3, Boolean) = Store Variable(2, Boolean) - Call id(4), args( Integer(2), EmptyTag, ) - Call id(5), args( Variable(1, Boolean), Tag(0, 5), ) - Call id(5), args( Variable(3, Boolean), Tag(1, 5), ) + Call id(5), args( Integer(2), EmptyTag, ) + Call id(6), args( Variable(1, Boolean), Tag(0, 5), ) + Call id(6), args( Variable(3, Boolean), Tag(1, 5), ) Return"#]], ); } @@ -1728,14 +1744,13 @@ fn if_expression_with_dynamic_operand_from_hybrid_booleans_array() { &program, mresetz_callable_id, &expect![[r#" - Callable: - name: __quantum__qis__mresetz__body - call_type: Measurement - input_type: - [0]: Qubit - [1]: Result - output_type: - body: "#]], + Callable: + name: __quantum__rt__initialize + call_type: Regular + input_type: + [0]: Pointer + output_type: + body: "#]], ); let read_result_callable_id = CallableId(2); assert_callable( @@ -1743,11 +1758,12 @@ fn if_expression_with_dynamic_operand_from_hybrid_booleans_array() { read_result_callable_id, &expect![[r#" Callable: - name: __quantum__rt__read_result - call_type: Readout + name: __quantum__qis__mresetz__body + call_type: Measurement input_type: - [0]: Result - output_type: Boolean + [0]: Qubit + [1]: Result + output_type: body: "#]], ); let x_callable_id = CallableId(3); @@ -1756,11 +1772,11 @@ fn if_expression_with_dynamic_operand_from_hybrid_booleans_array() { x_callable_id, &expect![[r#" Callable: - name: __quantum__qis__x__body - call_type: Regular + name: __quantum__rt__read_result + call_type: Readout input_type: - [0]: Qubit - output_type: + [0]: Result + output_type: Boolean body: "#]], ); let record_array_callable_id = CallableId(4); @@ -1769,11 +1785,10 @@ fn if_expression_with_dynamic_operand_from_hybrid_booleans_array() { record_array_callable_id, &expect![[r#" Callable: - name: __quantum__rt__array_record_output - call_type: OutputRecording + name: __quantum__qis__x__body + call_type: Regular input_type: - [0]: Integer - [1]: Pointer + [0]: Qubit output_type: body: "#]], ); @@ -1783,10 +1798,10 @@ fn if_expression_with_dynamic_operand_from_hybrid_booleans_array() { record_bool_callable_id, &expect![[r#" Callable: - name: __quantum__rt__bool_record_output + name: __quantum__rt__array_record_output call_type: OutputRecording input_type: - [0]: Boolean + [0]: Integer [1]: Pointer output_type: body: "#]], @@ -1796,20 +1811,21 @@ fn if_expression_with_dynamic_operand_from_hybrid_booleans_array() { &expect![[r#" Blocks: Block 0:Block: - Call id(1), args( Qubit(0), Result(0), ) - Variable(0, Boolean) = Call id(2), args( Result(0), ) + Call id(1), args( Pointer, ) + Call id(2), args( Qubit(0), Result(0), ) + Variable(0, Boolean) = Call id(3), args( Result(0), ) Variable(1, Boolean) = Store Variable(0, Boolean) Branch Variable(1, Boolean), 2, 1 Block 1:Block: - Call id(1), args( Qubit(1), Result(1), ) - Variable(2, Boolean) = Call id(2), args( Result(1), ) + Call id(2), args( Qubit(1), Result(1), ) + Variable(2, Boolean) = Call id(3), args( Result(1), ) Variable(3, Boolean) = Store Variable(2, Boolean) - Call id(4), args( Integer(2), EmptyTag, ) - Call id(5), args( Variable(1, Boolean), Tag(0, 5), ) - Call id(5), args( Variable(3, Boolean), Tag(1, 5), ) + Call id(5), args( Integer(2), EmptyTag, ) + Call id(6), args( Variable(1, Boolean), Tag(0, 5), ) + Call id(6), args( Variable(3, Boolean), Tag(1, 5), ) Return Block 2:Block: - Call id(3), args( Qubit(1), ) + Call id(4), args( Qubit(1), ) Jump(1)"#]], ); } @@ -1838,14 +1854,13 @@ fn if_expression_with_classical_operand_from_hybrid_integers_array() { &program, mresetz_callable_id, &expect![[r#" - Callable: - name: __quantum__qis__mresetz__body - call_type: Measurement - input_type: - [0]: Qubit - [1]: Result - output_type: - body: "#]], + Callable: + name: __quantum__rt__initialize + call_type: Regular + input_type: + [0]: Pointer + output_type: + body: "#]], ); let read_result_callable_id = CallableId(2); assert_callable( @@ -1853,11 +1868,12 @@ fn if_expression_with_classical_operand_from_hybrid_integers_array() { read_result_callable_id, &expect![[r#" Callable: - name: __quantum__rt__read_result - call_type: Readout + name: __quantum__qis__mresetz__body + call_type: Measurement input_type: - [0]: Result - output_type: Boolean + [0]: Qubit + [1]: Result + output_type: body: "#]], ); let x_callable_id = CallableId(3); @@ -1866,11 +1882,11 @@ fn if_expression_with_classical_operand_from_hybrid_integers_array() { x_callable_id, &expect![[r#" Callable: - name: __quantum__qis__x__body - call_type: Regular + name: __quantum__rt__read_result + call_type: Readout input_type: - [0]: Qubit - output_type: + [0]: Result + output_type: Boolean body: "#]], ); let record_array_callable_id = CallableId(4); @@ -1879,11 +1895,10 @@ fn if_expression_with_classical_operand_from_hybrid_integers_array() { record_array_callable_id, &expect![[r#" Callable: - name: __quantum__rt__array_record_output - call_type: OutputRecording + name: __quantum__qis__x__body + call_type: Regular input_type: - [0]: Integer - [1]: Pointer + [0]: Qubit output_type: body: "#]], ); @@ -1893,7 +1908,7 @@ fn if_expression_with_classical_operand_from_hybrid_integers_array() { record_int_callable_id, &expect![[r#" Callable: - name: __quantum__rt__int_record_output + name: __quantum__rt__array_record_output call_type: OutputRecording input_type: [0]: Integer @@ -1906,14 +1921,15 @@ fn if_expression_with_classical_operand_from_hybrid_integers_array() { &expect![[r#" Blocks: Block 0:Block: - Call id(1), args( Qubit(0), Result(0), ) - Variable(0, Boolean) = Call id(2), args( Result(0), ) + Call id(1), args( Pointer, ) + Call id(2), args( Qubit(0), Result(0), ) + Variable(0, Boolean) = Call id(3), args( Result(0), ) Variable(1, Boolean) = Icmp Eq, Variable(0, Boolean), Bool(false) Branch Variable(1, Boolean), 2, 3 Block 1:Block: - Call id(3), args( Qubit(1), ) - Call id(1), args( Qubit(1), Result(1), ) - Variable(3, Boolean) = Call id(2), args( Result(1), ) + Call id(4), args( Qubit(1), ) + Call id(2), args( Qubit(1), Result(1), ) + Variable(3, Boolean) = Call id(3), args( Result(1), ) Variable(4, Boolean) = Icmp Eq, Variable(3, Boolean), Bool(false) Branch Variable(4, Boolean), 5, 6 Block 2:Block: @@ -1923,9 +1939,9 @@ fn if_expression_with_classical_operand_from_hybrid_integers_array() { Variable(2, Integer) = Store Integer(1) Jump(1) Block 4:Block: - Call id(4), args( Integer(2), EmptyTag, ) - Call id(5), args( Variable(2, Integer), Tag(0, 5), ) - Call id(5), args( Variable(5, Integer), Tag(1, 5), ) + Call id(5), args( Integer(2), EmptyTag, ) + Call id(6), args( Variable(2, Integer), Tag(0, 5), ) + Call id(6), args( Variable(5, Integer), Tag(1, 5), ) Return Block 5:Block: Variable(5, Integer) = Store Integer(0) @@ -1960,14 +1976,13 @@ fn if_expression_with_dynamic_operand_from_hybrid_integers_array() { &program, mresetz_callable_id, &expect![[r#" - Callable: - name: __quantum__qis__mresetz__body - call_type: Measurement - input_type: - [0]: Qubit - [1]: Result - output_type: - body: "#]], + Callable: + name: __quantum__rt__initialize + call_type: Regular + input_type: + [0]: Pointer + output_type: + body: "#]], ); let read_result_callable_id = CallableId(2); assert_callable( @@ -1975,11 +1990,12 @@ fn if_expression_with_dynamic_operand_from_hybrid_integers_array() { read_result_callable_id, &expect![[r#" Callable: - name: __quantum__rt__read_result - call_type: Readout + name: __quantum__qis__mresetz__body + call_type: Measurement input_type: - [0]: Result - output_type: Boolean + [0]: Qubit + [1]: Result + output_type: body: "#]], ); let x_callable_id = CallableId(3); @@ -1988,11 +2004,11 @@ fn if_expression_with_dynamic_operand_from_hybrid_integers_array() { x_callable_id, &expect![[r#" Callable: - name: __quantum__qis__x__body - call_type: Regular + name: __quantum__rt__read_result + call_type: Readout input_type: - [0]: Qubit - output_type: + [0]: Result + output_type: Boolean body: "#]], ); let record_array_callable_id = CallableId(4); @@ -2001,11 +2017,10 @@ fn if_expression_with_dynamic_operand_from_hybrid_integers_array() { record_array_callable_id, &expect![[r#" Callable: - name: __quantum__rt__array_record_output - call_type: OutputRecording + name: __quantum__qis__x__body + call_type: Regular input_type: - [0]: Integer - [1]: Pointer + [0]: Qubit output_type: body: "#]], ); @@ -2015,7 +2030,7 @@ fn if_expression_with_dynamic_operand_from_hybrid_integers_array() { record_int_callable_id, &expect![[r#" Callable: - name: __quantum__rt__int_record_output + name: __quantum__rt__array_record_output call_type: OutputRecording input_type: [0]: Integer @@ -2028,8 +2043,9 @@ fn if_expression_with_dynamic_operand_from_hybrid_integers_array() { &expect![[r#" Blocks: Block 0:Block: - Call id(1), args( Qubit(0), Result(0), ) - Variable(0, Boolean) = Call id(2), args( Result(0), ) + Call id(1), args( Pointer, ) + Call id(2), args( Qubit(0), Result(0), ) + Variable(0, Boolean) = Call id(3), args( Result(0), ) Variable(1, Boolean) = Icmp Eq, Variable(0, Boolean), Bool(false) Branch Variable(1, Boolean), 2, 3 Block 1:Block: @@ -2042,17 +2058,17 @@ fn if_expression_with_dynamic_operand_from_hybrid_integers_array() { Variable(2, Integer) = Store Integer(1) Jump(1) Block 4:Block: - Call id(1), args( Qubit(1), Result(1), ) - Variable(4, Boolean) = Call id(2), args( Result(1), ) + Call id(2), args( Qubit(1), Result(1), ) + Variable(4, Boolean) = Call id(3), args( Result(1), ) Variable(5, Boolean) = Icmp Eq, Variable(4, Boolean), Bool(false) Branch Variable(5, Boolean), 7, 8 Block 5:Block: - Call id(3), args( Qubit(1), ) + Call id(4), args( Qubit(1), ) Jump(4) Block 6:Block: - Call id(4), args( Integer(2), EmptyTag, ) - Call id(5), args( Variable(2, Integer), Tag(0, 5), ) - Call id(5), args( Variable(6, Integer), Tag(1, 5), ) + Call id(5), args( Integer(2), EmptyTag, ) + Call id(6), args( Variable(2, Integer), Tag(0, 5), ) + Call id(6), args( Variable(6, Integer), Tag(1, 5), ) Return Block 7:Block: Variable(6, Integer) = Store Integer(0) @@ -2087,14 +2103,13 @@ fn if_expression_with_classical_operand_from_hybrid_doubles_array() { &program, mresetz_callable_id, &expect![[r#" - Callable: - name: __quantum__qis__mresetz__body - call_type: Measurement - input_type: - [0]: Qubit - [1]: Result - output_type: - body: "#]], + Callable: + name: __quantum__rt__initialize + call_type: Regular + input_type: + [0]: Pointer + output_type: + body: "#]], ); let read_result_callable_id = CallableId(2); assert_callable( @@ -2102,11 +2117,12 @@ fn if_expression_with_classical_operand_from_hybrid_doubles_array() { read_result_callable_id, &expect![[r#" Callable: - name: __quantum__rt__read_result - call_type: Readout + name: __quantum__qis__mresetz__body + call_type: Measurement input_type: - [0]: Result - output_type: Boolean + [0]: Qubit + [1]: Result + output_type: body: "#]], ); let x_callable_id = CallableId(3); @@ -2115,11 +2131,11 @@ fn if_expression_with_classical_operand_from_hybrid_doubles_array() { x_callable_id, &expect![[r#" Callable: - name: __quantum__qis__x__body - call_type: Regular + name: __quantum__rt__read_result + call_type: Readout input_type: - [0]: Qubit - output_type: + [0]: Result + output_type: Boolean body: "#]], ); let record_array_callable_id = CallableId(4); @@ -2128,11 +2144,10 @@ fn if_expression_with_classical_operand_from_hybrid_doubles_array() { record_array_callable_id, &expect![[r#" Callable: - name: __quantum__rt__array_record_output - call_type: OutputRecording + name: __quantum__qis__x__body + call_type: Regular input_type: - [0]: Integer - [1]: Pointer + [0]: Qubit output_type: body: "#]], ); @@ -2142,10 +2157,10 @@ fn if_expression_with_classical_operand_from_hybrid_doubles_array() { record_int_callable_id, &expect![[r#" Callable: - name: __quantum__rt__double_record_output + name: __quantum__rt__array_record_output call_type: OutputRecording input_type: - [0]: Double + [0]: Integer [1]: Pointer output_type: body: "#]], @@ -2155,14 +2170,15 @@ fn if_expression_with_classical_operand_from_hybrid_doubles_array() { &expect![[r#" Blocks: Block 0:Block: - Call id(1), args( Qubit(0), Result(0), ) - Variable(0, Boolean) = Call id(2), args( Result(0), ) + Call id(1), args( Pointer, ) + Call id(2), args( Qubit(0), Result(0), ) + Variable(0, Boolean) = Call id(3), args( Result(0), ) Variable(1, Boolean) = Icmp Eq, Variable(0, Boolean), Bool(false) Branch Variable(1, Boolean), 2, 3 Block 1:Block: - Call id(3), args( Qubit(1), ) - Call id(1), args( Qubit(1), Result(1), ) - Variable(3, Boolean) = Call id(2), args( Result(1), ) + Call id(4), args( Qubit(1), ) + Call id(2), args( Qubit(1), Result(1), ) + Variable(3, Boolean) = Call id(3), args( Result(1), ) Variable(4, Boolean) = Icmp Eq, Variable(3, Boolean), Bool(false) Branch Variable(4, Boolean), 5, 6 Block 2:Block: @@ -2172,9 +2188,9 @@ fn if_expression_with_classical_operand_from_hybrid_doubles_array() { Variable(2, Double) = Store Double(1.1) Jump(1) Block 4:Block: - Call id(4), args( Integer(2), EmptyTag, ) - Call id(5), args( Variable(2, Double), Tag(0, 5), ) - Call id(5), args( Variable(5, Double), Tag(1, 5), ) + Call id(5), args( Integer(2), EmptyTag, ) + Call id(6), args( Variable(2, Double), Tag(0, 5), ) + Call id(6), args( Variable(5, Double), Tag(1, 5), ) Return Block 5:Block: Variable(5, Double) = Store Double(0.1) @@ -2209,14 +2225,13 @@ fn if_expression_with_dynamic_operand_from_hybrid_doubles_array() { &program, mresetz_callable_id, &expect![[r#" - Callable: - name: __quantum__qis__mresetz__body - call_type: Measurement - input_type: - [0]: Qubit - [1]: Result - output_type: - body: "#]], + Callable: + name: __quantum__rt__initialize + call_type: Regular + input_type: + [0]: Pointer + output_type: + body: "#]], ); let read_result_callable_id = CallableId(2); assert_callable( @@ -2224,11 +2239,12 @@ fn if_expression_with_dynamic_operand_from_hybrid_doubles_array() { read_result_callable_id, &expect![[r#" Callable: - name: __quantum__rt__read_result - call_type: Readout + name: __quantum__qis__mresetz__body + call_type: Measurement input_type: - [0]: Result - output_type: Boolean + [0]: Qubit + [1]: Result + output_type: body: "#]], ); let x_callable_id = CallableId(3); @@ -2237,11 +2253,11 @@ fn if_expression_with_dynamic_operand_from_hybrid_doubles_array() { x_callable_id, &expect![[r#" Callable: - name: __quantum__qis__x__body - call_type: Regular + name: __quantum__rt__read_result + call_type: Readout input_type: - [0]: Qubit - output_type: + [0]: Result + output_type: Boolean body: "#]], ); let record_array_callable_id = CallableId(4); @@ -2250,11 +2266,10 @@ fn if_expression_with_dynamic_operand_from_hybrid_doubles_array() { record_array_callable_id, &expect![[r#" Callable: - name: __quantum__rt__array_record_output - call_type: OutputRecording + name: __quantum__qis__x__body + call_type: Regular input_type: - [0]: Integer - [1]: Pointer + [0]: Qubit output_type: body: "#]], ); @@ -2264,10 +2279,10 @@ fn if_expression_with_dynamic_operand_from_hybrid_doubles_array() { record_int_callable_id, &expect![[r#" Callable: - name: __quantum__rt__double_record_output + name: __quantum__rt__array_record_output call_type: OutputRecording input_type: - [0]: Double + [0]: Integer [1]: Pointer output_type: body: "#]], @@ -2277,8 +2292,9 @@ fn if_expression_with_dynamic_operand_from_hybrid_doubles_array() { &expect![[r#" Blocks: Block 0:Block: - Call id(1), args( Qubit(0), Result(0), ) - Variable(0, Boolean) = Call id(2), args( Result(0), ) + Call id(1), args( Pointer, ) + Call id(2), args( Qubit(0), Result(0), ) + Variable(0, Boolean) = Call id(3), args( Result(0), ) Variable(1, Boolean) = Icmp Eq, Variable(0, Boolean), Bool(false) Branch Variable(1, Boolean), 2, 3 Block 1:Block: @@ -2291,17 +2307,17 @@ fn if_expression_with_dynamic_operand_from_hybrid_doubles_array() { Variable(2, Double) = Store Double(1.1) Jump(1) Block 4:Block: - Call id(1), args( Qubit(1), Result(1), ) - Variable(4, Boolean) = Call id(2), args( Result(1), ) + Call id(2), args( Qubit(1), Result(1), ) + Variable(4, Boolean) = Call id(3), args( Result(1), ) Variable(5, Boolean) = Icmp Eq, Variable(4, Boolean), Bool(false) Branch Variable(5, Boolean), 7, 8 Block 5:Block: - Call id(3), args( Qubit(1), ) + Call id(4), args( Qubit(1), ) Jump(4) Block 6:Block: - Call id(4), args( Integer(2), EmptyTag, ) - Call id(5), args( Variable(2, Double), Tag(0, 5), ) - Call id(5), args( Variable(6, Double), Tag(1, 5), ) + Call id(5), args( Integer(2), EmptyTag, ) + Call id(6), args( Variable(2, Double), Tag(0, 5), ) + Call id(6), args( Variable(6, Double), Tag(1, 5), ) Return Block 7:Block: Variable(6, Double) = Store Double(0.1) @@ -2335,13 +2351,14 @@ fn if_expression_with_implicit_return_in_callable_supported() { &expect![[r#" Blocks: Block 0:Block: - Call id(1), args( Qubit(0), Result(0), ) - Variable(0, Boolean) = Call id(2), args( Result(0), ) + Call id(1), args( Pointer, ) + Call id(2), args( Qubit(0), Result(0), ) + Variable(0, Boolean) = Call id(3), args( Result(0), ) Variable(1, Boolean) = Store Variable(0, Boolean) Branch Variable(1, Boolean), 2, 3 Block 1:Block: Variable(3, Integer) = Store Variable(2, Integer) - Call id(3), args( Variable(3, Integer), Tag(0, 3), ) + Call id(4), args( Variable(3, Integer), Tag(0, 3), ) Return Block 2:Block: Variable(2, Integer) = Store Integer(1) diff --git a/source/compiler/qsc_partial_eval/src/tests/calls.rs b/source/compiler/qsc_partial_eval/src/tests/calls.rs index 5a57bcb7a1..9b36c4534c 100644 --- a/source/compiler/qsc_partial_eval/src/tests/calls.rs +++ b/source/compiler/qsc_partial_eval/src/tests/calls.rs @@ -38,22 +38,23 @@ fn call_to_single_qubit_unitary_with_two_calls_to_the_same_intrinsic() { &program, op_callable_id, &expect![[r#" - Callable: - name: Op - call_type: Regular - input_type: - [0]: Qubit - output_type: - body: "#]], + Callable: + name: __quantum__rt__initialize + call_type: Regular + input_type: + [0]: Pointer + output_type: + body: "#]], ); assert_block_instructions( &program, BlockId(0), &expect![[r#" Block: - Call id(1), args( Qubit(0), ) - Call id(1), args( Qubit(0), ) - Call id(2), args( Integer(0), EmptyTag, ) + Call id(1), args( Pointer, ) + Call id(2), args( Qubit(0), ) + Call id(2), args( Qubit(0), ) + Call id(3), args( Integer(0), EmptyTag, ) Return"#]], ); } @@ -81,34 +82,35 @@ fn call_to_single_qubit_unitary_with_calls_to_different_intrinsics() { &program, op_a_callable_id, &expect![[r#" - Callable: - name: OpA - call_type: Regular - input_type: - [0]: Qubit - output_type: - body: "#]], + Callable: + name: __quantum__rt__initialize + call_type: Regular + input_type: + [0]: Pointer + output_type: + body: "#]], ); assert_callable( &program, op_b_callable_id, &expect![[r#" - Callable: - name: OpB - call_type: Regular - input_type: - [0]: Qubit - output_type: - body: "#]], + Callable: + name: OpA + call_type: Regular + input_type: + [0]: Qubit + output_type: + body: "#]], ); assert_block_instructions( &program, BlockId(0), &expect![[r#" Block: - Call id(1), args( Qubit(0), ) + Call id(1), args( Pointer, ) Call id(2), args( Qubit(0), ) - Call id(3), args( Integer(0), EmptyTag, ) + Call id(3), args( Qubit(0), ) + Call id(4), args( Integer(0), EmptyTag, ) Return"#]], ); } @@ -134,23 +136,23 @@ fn call_to_two_qubit_unitary() { &program, op_callable_id, &expect![[r#" - Callable: - name: Op - call_type: Regular - input_type: - [0]: Qubit - [1]: Qubit - output_type: - body: "#]], + Callable: + name: __quantum__rt__initialize + call_type: Regular + input_type: + [0]: Pointer + output_type: + body: "#]], ); assert_block_instructions( &program, BlockId(0), &expect![[r#" Block: - Call id(1), args( Qubit(0), Qubit(1), ) - Call id(1), args( Qubit(1), Qubit(0), ) - Call id(2), args( Integer(0), EmptyTag, ) + Call id(1), args( Pointer, ) + Call id(2), args( Qubit(0), Qubit(1), ) + Call id(2), args( Qubit(1), Qubit(0), ) + Call id(3), args( Integer(0), EmptyTag, ) Return"#]], ); } @@ -178,36 +180,36 @@ fn call_to_unitary_that_receives_double_and_qubit() { &program, double_first_callable_id, &expect![[r#" - Callable: - name: DoubleFirst - call_type: Regular - input_type: - [0]: Double - [1]: Qubit - output_type: - body: "#]], + Callable: + name: __quantum__rt__initialize + call_type: Regular + input_type: + [0]: Pointer + output_type: + body: "#]], ); assert_callable( &program, qubit_first_callable_id, &expect![[r#" - Callable: - name: QubitFirst - call_type: Regular - input_type: - [0]: Qubit - [1]: Double - output_type: - body: "#]], + Callable: + name: DoubleFirst + call_type: Regular + input_type: + [0]: Double + [1]: Qubit + output_type: + body: "#]], ); assert_block_instructions( &program, BlockId(0), &expect![[r#" Block: - Call id(1), args( Double(1), Qubit(0), ) - Call id(2), args( Qubit(0), Double(1), ) - Call id(3), args( Integer(0), EmptyTag, ) + Call id(1), args( Pointer, ) + Call id(2), args( Double(1), Qubit(0), ) + Call id(3), args( Qubit(0), Double(1), ) + Call id(4), args( Integer(0), EmptyTag, ) Return"#]], ); } @@ -238,13 +240,13 @@ fn calls_to_unitary_that_conditionally_calls_intrinsic_with_classical_bool() { &program, op_a_callable_id, &expect![[r#" - Callable: - name: OpA - call_type: Regular - input_type: - [0]: Qubit - output_type: - body: "#]], + Callable: + name: __quantum__rt__initialize + call_type: Regular + input_type: + [0]: Pointer + output_type: + body: "#]], ); let op_b_callable_id = CallableId(2); assert_callable( @@ -252,7 +254,7 @@ fn calls_to_unitary_that_conditionally_calls_intrinsic_with_classical_bool() { op_b_callable_id, &expect![[r#" Callable: - name: OpB + name: OpA call_type: Regular input_type: [0]: Qubit @@ -265,11 +267,10 @@ fn calls_to_unitary_that_conditionally_calls_intrinsic_with_classical_bool() { output_recording_callable_id, &expect![[r#" Callable: - name: __quantum__rt__tuple_record_output - call_type: OutputRecording + name: OpB + call_type: Regular input_type: - [0]: Integer - [1]: Pointer + [0]: Qubit output_type: body: "#]], ); @@ -278,9 +279,10 @@ fn calls_to_unitary_that_conditionally_calls_intrinsic_with_classical_bool() { BlockId(0), &expect![[r#" Block: - Call id(1), args( Qubit(0), ) + Call id(1), args( Pointer, ) Call id(2), args( Qubit(0), ) - Call id(3), args( Integer(0), EmptyTag, ) + Call id(3), args( Qubit(0), ) + Call id(4), args( Integer(0), EmptyTag, ) Return"#]], ); } @@ -312,11 +314,10 @@ fn calls_to_unitary_that_conditionally_calls_intrinsic_with_dynamic_bool() { measure_callable_id, &expect![[r#" Callable: - name: __quantum__qis__m__body - call_type: Measurement + name: __quantum__rt__initialize + call_type: Regular input_type: - [0]: Qubit - [1]: Result + [0]: Pointer output_type: body: "#]], ); @@ -326,11 +327,12 @@ fn calls_to_unitary_that_conditionally_calls_intrinsic_with_dynamic_bool() { read_result_callable_id, &expect![[r#" Callable: - name: __quantum__rt__read_result - call_type: Readout + name: __quantum__qis__m__body + call_type: Measurement input_type: - [0]: Result - output_type: Boolean + [0]: Qubit + [1]: Result + output_type: body: "#]], ); let op_a_callable_id = CallableId(3); @@ -338,13 +340,13 @@ fn calls_to_unitary_that_conditionally_calls_intrinsic_with_dynamic_bool() { &program, op_a_callable_id, &expect![[r#" - Callable: - name: OpA - call_type: Regular - input_type: - [0]: Qubit - output_type: - body: "#]], + Callable: + name: __quantum__rt__read_result + call_type: Readout + input_type: + [0]: Result + output_type: Boolean + body: "#]], ); let op_b_callable_id = CallableId(4); assert_callable( @@ -352,7 +354,7 @@ fn calls_to_unitary_that_conditionally_calls_intrinsic_with_dynamic_bool() { op_b_callable_id, &expect![[r#" Callable: - name: OpB + name: OpA call_type: Regular input_type: [0]: Qubit @@ -365,11 +367,10 @@ fn calls_to_unitary_that_conditionally_calls_intrinsic_with_dynamic_bool() { output_recording_callable_id, &expect![[r#" Callable: - name: __quantum__rt__tuple_record_output - call_type: OutputRecording + name: OpB + call_type: Regular input_type: - [0]: Integer - [1]: Pointer + [0]: Qubit output_type: body: "#]], ); @@ -378,18 +379,19 @@ fn calls_to_unitary_that_conditionally_calls_intrinsic_with_dynamic_bool() { &expect![[r#" Blocks: Block 0:Block: - Call id(1), args( Qubit(0), Result(0), ) - Variable(0, Boolean) = Call id(2), args( Result(0), ) + Call id(1), args( Pointer, ) + Call id(2), args( Qubit(0), Result(0), ) + Variable(0, Boolean) = Call id(3), args( Result(0), ) Variable(1, Boolean) = Store Variable(0, Boolean) Branch Variable(1, Boolean), 2, 3 Block 1:Block: - Call id(5), args( Integer(0), EmptyTag, ) + Call id(6), args( Integer(0), EmptyTag, ) Return Block 2:Block: - Call id(3), args( Qubit(1), ) + Call id(4), args( Qubit(1), ) Jump(1) Block 3:Block: - Call id(4), args( Qubit(1), ) + Call id(5), args( Qubit(1), ) Jump(1)"#]], ); } @@ -415,23 +417,23 @@ fn call_to_unitary_rotation_unitary_with_computation() { &program, rotation_callable_id, &expect![[r#" - Callable: - name: Rotation - call_type: Regular - input_type: - [0]: Double - [1]: Qubit - output_type: - body: "#]], + Callable: + name: __quantum__rt__initialize + call_type: Regular + input_type: + [0]: Pointer + output_type: + body: "#]], ); assert_block_instructions( &program, BlockId(0), &expect![[r#" Block: - Call id(1), args( Double(4), Qubit(0), ) - Call id(1), args( Double(6), Qubit(0), ) - Call id(2), args( Integer(0), EmptyTag, ) + Call id(1), args( Pointer, ) + Call id(2), args( Double(4), Qubit(0), ) + Call id(2), args( Double(6), Qubit(0), ) + Call id(3), args( Integer(0), EmptyTag, ) Return"#]], ); } @@ -456,11 +458,10 @@ fn call_to_operation_that_returns_measurement_result() { measure_callable_id, &expect![[r#" Callable: - name: __quantum__qis__m__body - call_type: Measurement + name: __quantum__rt__initialize + call_type: Regular input_type: - [0]: Qubit - [1]: Result + [0]: Pointer output_type: body: "#]], ); @@ -469,22 +470,23 @@ fn call_to_operation_that_returns_measurement_result() { &program, output_recording_callable_id, &expect![[r#" - Callable: - name: __quantum__rt__result_record_output - call_type: OutputRecording - input_type: - [0]: Result - [1]: Pointer - output_type: - body: "#]], + Callable: + name: __quantum__qis__m__body + call_type: Measurement + input_type: + [0]: Qubit + [1]: Result + output_type: + body: "#]], ); assert_block_instructions( &program, BlockId(0), &expect![[r#" Block: - Call id(1), args( Qubit(0), Result(0), ) - Call id(2), args( Result(0), Tag(0, 3), ) + Call id(1), args( Pointer, ) + Call id(2), args( Qubit(0), Result(0), ) + Call id(3), args( Result(0), Tag(0, 3), ) Return"#]], ); } @@ -510,11 +512,10 @@ fn call_to_operation_that_returns_dynamic_bool() { measure_callable_id, &expect![[r#" Callable: - name: __quantum__qis__m__body - call_type: Measurement + name: __quantum__rt__initialize + call_type: Regular input_type: - [0]: Qubit - [1]: Result + [0]: Pointer output_type: body: "#]], ); @@ -524,11 +525,12 @@ fn call_to_operation_that_returns_dynamic_bool() { read_result_callable_id, &expect![[r#" Callable: - name: __quantum__rt__read_result - call_type: Readout + name: __quantum__qis__m__body + call_type: Measurement input_type: - [0]: Result - output_type: Boolean + [0]: Qubit + [1]: Result + output_type: body: "#]], ); let output_recording_callable_id = CallableId(3); @@ -537,12 +539,11 @@ fn call_to_operation_that_returns_dynamic_bool() { output_recording_callable_id, &expect![[r#" Callable: - name: __quantum__rt__bool_record_output - call_type: OutputRecording + name: __quantum__rt__read_result + call_type: Readout input_type: - [0]: Boolean - [1]: Pointer - output_type: + [0]: Result + output_type: Boolean body: "#]], ); assert_block_instructions( @@ -550,11 +551,12 @@ fn call_to_operation_that_returns_dynamic_bool() { BlockId(0), &expect![[r#" Block: - Call id(1), args( Qubit(0), Result(0), ) - Variable(0, Boolean) = Call id(2), args( Result(0), ) + Call id(1), args( Pointer, ) + Call id(2), args( Qubit(0), Result(0), ) + Variable(0, Boolean) = Call id(3), args( Result(0), ) Variable(1, Boolean) = Icmp Eq, Variable(0, Boolean), Bool(false) Variable(2, Boolean) = Store Variable(1, Boolean) - Call id(3), args( Variable(2, Boolean), Tag(0, 3), ) + Call id(4), args( Variable(2, Boolean), Tag(0, 3), ) Return"#]], ); } @@ -585,13 +587,13 @@ fn call_to_boolean_function_using_result_literal_as_argument_yields_constant() { &program, op_callable_id, &expect![[r#" - Callable: - name: Op - call_type: Regular - input_type: - [0]: Qubit - output_type: - body: "#]], + Callable: + name: __quantum__rt__initialize + call_type: Regular + input_type: + [0]: Pointer + output_type: + body: "#]], ); let output_recording_callable_id = CallableId(2); assert_callable( @@ -599,11 +601,10 @@ fn call_to_boolean_function_using_result_literal_as_argument_yields_constant() { output_recording_callable_id, &expect![[r#" Callable: - name: __quantum__rt__tuple_record_output - call_type: OutputRecording + name: Op + call_type: Regular input_type: - [0]: Integer - [1]: Pointer + [0]: Qubit output_type: body: "#]], ); @@ -612,8 +613,9 @@ fn call_to_boolean_function_using_result_literal_as_argument_yields_constant() { BlockId(0), &expect![[r#" Block: - Call id(1), args( Qubit(0), ) - Call id(2), args( Integer(0), EmptyTag, ) + Call id(1), args( Pointer, ) + Call id(2), args( Qubit(0), ) + Call id(3), args( Integer(0), EmptyTag, ) Return"#]], ); } @@ -644,11 +646,10 @@ fn call_to_boolean_function_using_dynamic_result_as_argument_generates_branches( measure_callable_id, &expect![[r#" Callable: - name: __quantum__qis__m__body - call_type: Measurement + name: __quantum__rt__initialize + call_type: Regular input_type: - [0]: Qubit - [1]: Result + [0]: Pointer output_type: body: "#]], ); @@ -658,11 +659,12 @@ fn call_to_boolean_function_using_dynamic_result_as_argument_generates_branches( read_result_callable_id, &expect![[r#" Callable: - name: __quantum__rt__read_result - call_type: Readout + name: __quantum__qis__m__body + call_type: Measurement input_type: - [0]: Result - output_type: Boolean + [0]: Qubit + [1]: Result + output_type: body: "#]], ); let op_callable_id = CallableId(3); @@ -670,13 +672,13 @@ fn call_to_boolean_function_using_dynamic_result_as_argument_generates_branches( &program, op_callable_id, &expect![[r#" - Callable: - name: Op - call_type: Regular - input_type: - [0]: Qubit - output_type: - body: "#]], + Callable: + name: __quantum__rt__read_result + call_type: Readout + input_type: + [0]: Result + output_type: Boolean + body: "#]], ); let output_recording_callable_id = CallableId(4); assert_callable( @@ -684,11 +686,10 @@ fn call_to_boolean_function_using_dynamic_result_as_argument_generates_branches( output_recording_callable_id, &expect![[r#" Callable: - name: __quantum__rt__tuple_record_output - call_type: OutputRecording + name: Op + call_type: Regular input_type: - [0]: Integer - [1]: Pointer + [0]: Qubit output_type: body: "#]], ); @@ -697,15 +698,16 @@ fn call_to_boolean_function_using_dynamic_result_as_argument_generates_branches( &expect![[r#" Blocks: Block 0:Block: - Call id(1), args( Qubit(0), Result(0), ) - Variable(0, Boolean) = Call id(2), args( Result(0), ) + Call id(1), args( Pointer, ) + Call id(2), args( Qubit(0), Result(0), ) + Variable(0, Boolean) = Call id(3), args( Result(0), ) Variable(1, Boolean) = Store Variable(0, Boolean) Branch Variable(1, Boolean), 2, 1 Block 1:Block: - Call id(4), args( Integer(0), EmptyTag, ) + Call id(5), args( Integer(0), EmptyTag, ) Return Block 2:Block: - Call id(3), args( Qubit(1), ) + Call id(4), args( Qubit(1), ) Jump(1)"#]], ); } @@ -737,27 +739,26 @@ fn call_to_unitary_operation_with_one_qubit_argument_using_one_control_qubit() { &program, intrinsic_a_callable_id, &expect![[r#" - Callable: - name: IntrinsicA - call_type: Regular - input_type: - [0]: Qubit - output_type: - body: "#]], + Callable: + name: __quantum__rt__initialize + call_type: Regular + input_type: + [0]: Pointer + output_type: + body: "#]], ); let intrinsic_b_callable_id = CallableId(2); assert_callable( &program, intrinsic_b_callable_id, &expect![[r#" - Callable: - name: IntrinsicB - call_type: Regular - input_type: - [0]: Qubit - [1]: Qubit - output_type: - body: "#]], + Callable: + name: IntrinsicA + call_type: Regular + input_type: + [0]: Qubit + output_type: + body: "#]], ); let output_recording_callable_id = CallableId(3); assert_callable( @@ -765,11 +766,11 @@ fn call_to_unitary_operation_with_one_qubit_argument_using_one_control_qubit() { output_recording_callable_id, &expect![[r#" Callable: - name: __quantum__rt__tuple_record_output - call_type: OutputRecording + name: IntrinsicB + call_type: Regular input_type: - [0]: Integer - [1]: Pointer + [0]: Qubit + [1]: Qubit output_type: body: "#]], ); @@ -778,9 +779,10 @@ fn call_to_unitary_operation_with_one_qubit_argument_using_one_control_qubit() { BlockId(0), &expect![[r#" Block: - Call id(1), args( Qubit(1), ) - Call id(2), args( Qubit(0), Qubit(1), ) - Call id(3), args( Integer(0), EmptyTag, ) + Call id(1), args( Pointer, ) + Call id(2), args( Qubit(1), ) + Call id(3), args( Qubit(0), Qubit(1), ) + Call id(4), args( Integer(0), EmptyTag, ) Return"#]], ); } @@ -812,13 +814,13 @@ fn call_to_unitary_operation_with_one_qubit_argument_using_mutiple_control_qubit &program, intrinsic_a_callable_id, &expect![[r#" - Callable: - name: IntrinsicA - call_type: Regular - input_type: - [0]: Qubit - output_type: - body: "#]], + Callable: + name: __quantum__rt__initialize + call_type: Regular + input_type: + [0]: Pointer + output_type: + body: "#]], ); let intrinsic_b_callable_id = CallableId(2); assert_callable( @@ -826,12 +828,10 @@ fn call_to_unitary_operation_with_one_qubit_argument_using_mutiple_control_qubit intrinsic_b_callable_id, &expect![[r#" Callable: - name: IntrinsicB + name: IntrinsicA call_type: Regular input_type: [0]: Qubit - [1]: Qubit - [2]: Qubit output_type: body: "#]], ); @@ -841,11 +841,12 @@ fn call_to_unitary_operation_with_one_qubit_argument_using_mutiple_control_qubit output_recording_callable_id, &expect![[r#" Callable: - name: __quantum__rt__tuple_record_output - call_type: OutputRecording + name: IntrinsicB + call_type: Regular input_type: - [0]: Integer - [1]: Pointer + [0]: Qubit + [1]: Qubit + [2]: Qubit output_type: body: "#]], ); @@ -854,9 +855,10 @@ fn call_to_unitary_operation_with_one_qubit_argument_using_mutiple_control_qubit BlockId(0), &expect![[r#" Block: - Call id(1), args( Qubit(2), ) - Call id(2), args( Qubit(0), Qubit(1), Qubit(2), ) - Call id(3), args( Integer(0), EmptyTag, ) + Call id(1), args( Pointer, ) + Call id(2), args( Qubit(2), ) + Call id(3), args( Qubit(0), Qubit(1), Qubit(2), ) + Call id(4), args( Integer(0), EmptyTag, ) Return"#]], ); } @@ -889,11 +891,10 @@ fn call_to_unitary_operation_with_two_qubit_arguments_using_one_control_qubit() intrinsic_a_callable_id, &expect![[r#" Callable: - name: IntrinsicA + name: __quantum__rt__initialize call_type: Regular input_type: - [0]: Qubit - [1]: Qubit + [0]: Pointer output_type: body: "#]], ); @@ -903,12 +904,11 @@ fn call_to_unitary_operation_with_two_qubit_arguments_using_one_control_qubit() intrinsic_b_callable_id, &expect![[r#" Callable: - name: IntrinsicB + name: IntrinsicA call_type: Regular input_type: [0]: Qubit [1]: Qubit - [2]: Qubit output_type: body: "#]], ); @@ -918,11 +918,12 @@ fn call_to_unitary_operation_with_two_qubit_arguments_using_one_control_qubit() output_recording_callable_id, &expect![[r#" Callable: - name: __quantum__rt__tuple_record_output - call_type: OutputRecording + name: IntrinsicB + call_type: Regular input_type: - [0]: Integer - [1]: Pointer + [0]: Qubit + [1]: Qubit + [2]: Qubit output_type: body: "#]], ); @@ -931,9 +932,10 @@ fn call_to_unitary_operation_with_two_qubit_arguments_using_one_control_qubit() BlockId(0), &expect![[r#" Block: - Call id(1), args( Qubit(1), Qubit(2), ) - Call id(2), args( Qubit(0), Qubit(1), Qubit(2), ) - Call id(3), args( Integer(0), EmptyTag, ) + Call id(1), args( Pointer, ) + Call id(2), args( Qubit(1), Qubit(2), ) + Call id(3), args( Qubit(0), Qubit(1), Qubit(2), ) + Call id(4), args( Integer(0), EmptyTag, ) Return"#]], ); } @@ -977,10 +979,10 @@ fn call_to_unitary_operation_using_multiple_controlled_functors() { intrinsic_a1_callable_id, &expect![[r#" Callable: - name: IntrinsicA1 + name: __quantum__rt__initialize call_type: Regular input_type: - [0]: Qubit + [0]: Pointer output_type: body: "#]], ); @@ -990,11 +992,10 @@ fn call_to_unitary_operation_using_multiple_controlled_functors() { intrinsic_b_callable_id, &expect![[r#" Callable: - name: IntrinsicB + name: IntrinsicA1 call_type: Regular input_type: [0]: Qubit - [1]: Qubit output_type: body: "#]], ); @@ -1004,12 +1005,11 @@ fn call_to_unitary_operation_using_multiple_controlled_functors() { intrinsic_c_callable_id, &expect![[r#" Callable: - name: IntrinsicC + name: IntrinsicB call_type: Regular input_type: [0]: Qubit [1]: Qubit - [2]: Qubit output_type: body: "#]], ); @@ -1019,10 +1019,12 @@ fn call_to_unitary_operation_using_multiple_controlled_functors() { intrinsic_a2_callable_id, &expect![[r#" Callable: - name: IntrinsicA2 + name: IntrinsicC call_type: Regular input_type: [0]: Qubit + [1]: Qubit + [2]: Qubit output_type: body: "#]], ); @@ -1032,11 +1034,10 @@ fn call_to_unitary_operation_using_multiple_controlled_functors() { output_recording_callable_id, &expect![[r#" Callable: - name: __quantum__rt__tuple_record_output - call_type: OutputRecording + name: IntrinsicA2 + call_type: Regular input_type: - [0]: Integer - [1]: Pointer + [0]: Qubit output_type: body: "#]], ); @@ -1045,11 +1046,12 @@ fn call_to_unitary_operation_using_multiple_controlled_functors() { BlockId(0), &expect![[r#" Block: - Call id(1), args( Qubit(0), ) - Call id(2), args( Qubit(1), Qubit(0), ) - Call id(3), args( Qubit(1), Qubit(2), Qubit(0), ) - Call id(4), args( Qubit(3), ) - Call id(5), args( Integer(0), EmptyTag, ) + Call id(1), args( Pointer, ) + Call id(2), args( Qubit(0), ) + Call id(3), args( Qubit(1), Qubit(0), ) + Call id(4), args( Qubit(1), Qubit(2), Qubit(0), ) + Call id(5), args( Qubit(3), ) + Call id(6), args( Integer(0), EmptyTag, ) Return"#]], ); } @@ -1072,21 +1074,22 @@ fn call_to_closue_with_no_bound_locals() { &program, CallableId(1), &expect![[r#" - Callable: - name: __quantum__qis__x__body - call_type: Regular - input_type: - [0]: Qubit - output_type: - body: "#]], + Callable: + name: __quantum__rt__initialize + call_type: Regular + input_type: + [0]: Pointer + output_type: + body: "#]], ); assert_block_instructions( &program, BlockId(0), &expect![[r#" Block: - Call id(1), args( Qubit(0), ) - Call id(2), args( Integer(0), EmptyTag, ) + Call id(1), args( Pointer, ) + Call id(2), args( Qubit(0), ) + Call id(3), args( Integer(0), EmptyTag, ) Return"#]], ); } @@ -1110,11 +1113,10 @@ fn call_to_closue_with_one_bound_local() { CallableId(1), &expect![[r#" Callable: - name: __quantum__qis__rx__body + name: __quantum__rt__initialize call_type: Regular input_type: - [0]: Double - [1]: Qubit + [0]: Pointer output_type: body: "#]], ); @@ -1123,8 +1125,9 @@ fn call_to_closue_with_one_bound_local() { BlockId(0), &expect![[r#" Block: - Call id(1), args( Double(1), Qubit(0), ) - Call id(2), args( Integer(0), EmptyTag, ) + Call id(1), args( Pointer, ) + Call id(2), args( Double(1), Qubit(0), ) + Call id(3), args( Integer(0), EmptyTag, ) Return"#]], ); } @@ -1148,11 +1151,10 @@ fn call_to_closue_with_two_bound_locals() { CallableId(1), &expect![[r#" Callable: - name: __quantum__qis__rx__body + name: __quantum__rt__initialize call_type: Regular input_type: - [0]: Double - [1]: Qubit + [0]: Pointer output_type: body: "#]], ); @@ -1161,8 +1163,9 @@ fn call_to_closue_with_two_bound_locals() { BlockId(0), &expect![[r#" Block: - Call id(1), args( Double(1), Qubit(0), ) - Call id(2), args( Integer(0), EmptyTag, ) + Call id(1), args( Pointer, ) + Call id(2), args( Double(1), Qubit(0), ) + Call id(3), args( Integer(0), EmptyTag, ) Return"#]], ); } @@ -1186,11 +1189,10 @@ fn call_to_closue_with_one_bound_local_two_unbound() { CallableId(1), &expect![[r#" Callable: - name: __quantum__qis__rx__body + name: __quantum__rt__initialize call_type: Regular input_type: - [0]: Double - [1]: Qubit + [0]: Pointer output_type: body: "#]], ); @@ -1199,8 +1201,9 @@ fn call_to_closue_with_one_bound_local_two_unbound() { BlockId(0), &expect![[r#" Block: - Call id(1), args( Double(1), Qubit(0), ) - Call id(2), args( Integer(0), EmptyTag, ) + Call id(1), args( Pointer, ) + Call id(2), args( Double(1), Qubit(0), ) + Call id(3), args( Integer(0), EmptyTag, ) Return"#]], ); } @@ -1229,8 +1232,9 @@ fn call_to_unresolved_callee_with_classical_arg_allowed() { BlockId(0), &expect![[r#" Block: - Call id(1), args( Double(1), Qubit(0), ) - Call id(2), args( Integer(0), EmptyTag, ) + Call id(1), args( Pointer, ) + Call id(2), args( Double(1), Qubit(0), ) + Call id(3), args( Integer(0), EmptyTag, ) Return"#]], ); } @@ -1341,9 +1345,10 @@ fn call_to_unresolved_callee_with_static_arg_and_entry_return_value_succeeds() { BlockId(0), &expect![[r#" Block: - Call id(1), args( Double(1), Qubit(0), ) - Call id(2), args( Qubit(0), Result(0), ) - Call id(3), args( Result(0), Tag(0, 3), ) + Call id(1), args( Pointer, ) + Call id(2), args( Double(1), Qubit(0), ) + Call id(3), args( Qubit(0), Result(0), ) + Call id(4), args( Result(0), Tag(0, 3), ) Return"#]], ); } diff --git a/source/compiler/qsc_partial_eval/src/tests/classical_args.rs b/source/compiler/qsc_partial_eval/src/tests/classical_args.rs index c962848d93..288adf07aa 100644 --- a/source/compiler/qsc_partial_eval/src/tests/classical_args.rs +++ b/source/compiler/qsc_partial_eval/src/tests/classical_args.rs @@ -22,21 +22,22 @@ fn call_to_intrinsic_operation_using_double_literal() { &program, op_callable_id, &expect![[r#" - Callable: - name: op - call_type: Regular - input_type: - [0]: Double - output_type: - body: "#]], + Callable: + name: __quantum__rt__initialize + call_type: Regular + input_type: + [0]: Pointer + output_type: + body: "#]], ); assert_block_instructions( &program, BlockId(0), &expect![[r#" Block: - Call id(1), args( Double(1), ) - Call id(2), args( Integer(0), EmptyTag, ) + Call id(1), args( Pointer, ) + Call id(2), args( Double(1), ) + Call id(3), args( Integer(0), EmptyTag, ) Return"#]], ); } @@ -60,23 +61,24 @@ fn calls_to_intrinsic_operation_using_inline_expressions() { &program, op_callable_id, &expect![[r#" - Callable: - name: op - call_type: Regular - input_type: - [0]: Double - output_type: - body: "#]], + Callable: + name: __quantum__rt__initialize + call_type: Regular + input_type: + [0]: Pointer + output_type: + body: "#]], ); assert_block_instructions( &program, BlockId(0), &expect![[r#" Block: - Call id(1), args( Double(0), ) - Call id(1), args( Double(1), ) - Call id(1), args( Double(1), ) - Call id(2), args( Integer(0), EmptyTag, ) + Call id(1), args( Pointer, ) + Call id(2), args( Double(0), ) + Call id(2), args( Double(1), ) + Call id(2), args( Double(1), ) + Call id(3), args( Integer(0), EmptyTag, ) Return"#]], ); } @@ -103,25 +105,26 @@ fn calls_to_intrinsic_operation_using_variables() { &program, op_callable_id, &expect![[r#" - Callable: - name: op - call_type: Regular - input_type: - [0]: Double - output_type: - body: "#]], + Callable: + name: __quantum__rt__initialize + call_type: Regular + input_type: + [0]: Pointer + output_type: + body: "#]], ); assert_block_instructions( &program, BlockId(0), &expect![[r#" Block: - Call id(1), args( Double(2), ) + Call id(1), args( Pointer, ) + Call id(2), args( Double(2), ) Variable(0, Double) = Store Double(4) - Call id(1), args( Double(4), ) + Call id(2), args( Double(4), ) Variable(0, Double) = Store Double(8) - Call id(1), args( Double(8), ) - Call id(2), args( Integer(0), EmptyTag, ) + Call id(2), args( Double(8), ) + Call id(3), args( Integer(0), EmptyTag, ) Return"#]], ); } diff --git a/source/compiler/qsc_partial_eval/src/tests/dynamic_vars.rs b/source/compiler/qsc_partial_eval/src/tests/dynamic_vars.rs index 04055f47d6..61dd2b0a2c 100644 --- a/source/compiler/qsc_partial_eval/src/tests/dynamic_vars.rs +++ b/source/compiler/qsc_partial_eval/src/tests/dynamic_vars.rs @@ -29,14 +29,13 @@ fn dynamic_int_from_if_expression_with_single_measurement_comparison_and_classic &program, mresetz_callable_id, &expect![[r#" - Callable: - name: __quantum__qis__mresetz__body - call_type: Measurement - input_type: - [0]: Qubit - [1]: Result - output_type: - body: "#]], + Callable: + name: __quantum__rt__initialize + call_type: Regular + input_type: + [0]: Pointer + output_type: + body: "#]], ); let read_result_callable_id = CallableId(2); assert_callable( @@ -44,11 +43,12 @@ fn dynamic_int_from_if_expression_with_single_measurement_comparison_and_classic read_result_callable_id, &expect![[r#" Callable: - name: __quantum__rt__read_result - call_type: Readout + name: __quantum__qis__mresetz__body + call_type: Measurement input_type: - [0]: Result - output_type: Boolean + [0]: Qubit + [1]: Result + output_type: body: "#]], ); @@ -57,13 +57,14 @@ fn dynamic_int_from_if_expression_with_single_measurement_comparison_and_classic &expect![[r#" Blocks: Block 0:Block: - Call id(1), args( Qubit(0), Result(0), ) - Variable(0, Boolean) = Call id(2), args( Result(0), ) + Call id(1), args( Pointer, ) + Call id(2), args( Qubit(0), Result(0), ) + Variable(0, Boolean) = Call id(3), args( Result(0), ) Variable(1, Boolean) = Icmp Eq, Variable(0, Boolean), Bool(false) Branch Variable(1, Boolean), 2, 3 Block 1:Block: Variable(3, Integer) = Store Variable(2, Integer) - Call id(3), args( Integer(0), EmptyTag, ) + Call id(4), args( Integer(0), EmptyTag, ) Return Block 2:Block: Variable(2, Integer) = Store Integer(0) @@ -103,14 +104,13 @@ fn dynamic_int_from_if_expression_with_single_measurement_comparison_and_non_cla &program, mresetz_callable_id, &expect![[r#" - Callable: - name: __quantum__qis__mresetz__body - call_type: Measurement - input_type: - [0]: Qubit - [1]: Result - output_type: - body: "#]], + Callable: + name: __quantum__rt__initialize + call_type: Regular + input_type: + [0]: Pointer + output_type: + body: "#]], ); let read_result_callable_id = CallableId(2); assert_callable( @@ -118,11 +118,12 @@ fn dynamic_int_from_if_expression_with_single_measurement_comparison_and_non_cla read_result_callable_id, &expect![[r#" Callable: - name: __quantum__rt__read_result - call_type: Readout + name: __quantum__qis__mresetz__body + call_type: Measurement input_type: - [0]: Result - output_type: Boolean + [0]: Qubit + [1]: Result + output_type: body: "#]], ); let op_a_callable_id = CallableId(3); @@ -130,13 +131,13 @@ fn dynamic_int_from_if_expression_with_single_measurement_comparison_and_non_cla &program, op_a_callable_id, &expect![[r#" - Callable: - name: OpA - call_type: Regular - input_type: - [0]: Qubit - output_type: - body: "#]], + Callable: + name: __quantum__rt__read_result + call_type: Readout + input_type: + [0]: Result + output_type: Boolean + body: "#]], ); let op_b_callable_id = CallableId(4); assert_callable( @@ -144,7 +145,7 @@ fn dynamic_int_from_if_expression_with_single_measurement_comparison_and_non_cla op_b_callable_id, &expect![[r#" Callable: - name: OpB + name: OpA call_type: Regular input_type: [0]: Qubit @@ -156,20 +157,21 @@ fn dynamic_int_from_if_expression_with_single_measurement_comparison_and_non_cla &expect![[r#" Blocks: Block 0:Block: - Call id(1), args( Qubit(0), Result(0), ) - Variable(0, Boolean) = Call id(2), args( Result(0), ) + Call id(1), args( Pointer, ) + Call id(2), args( Qubit(0), Result(0), ) + Variable(0, Boolean) = Call id(3), args( Result(0), ) Variable(1, Boolean) = Icmp Eq, Variable(0, Boolean), Bool(false) Branch Variable(1, Boolean), 2, 3 Block 1:Block: Variable(3, Integer) = Store Variable(2, Integer) - Call id(5), args( Integer(0), EmptyTag, ) + Call id(6), args( Integer(0), EmptyTag, ) Return Block 2:Block: - Call id(3), args( Qubit(1), ) + Call id(4), args( Qubit(1), ) Variable(2, Integer) = Store Integer(0) Jump(1) Block 3:Block: - Call id(4), args( Qubit(1), ) + Call id(5), args( Qubit(1), ) Variable(2, Integer) = Store Integer(1) Jump(1)"#]], ); @@ -200,13 +202,14 @@ fn dynamic_var_across_if_else_static_in_both_branches_constant_folded() { &expect![[r#" Blocks: Block 0:Block: + Call id(1), args( Pointer, ) Variable(0, Integer) = Store Integer(0) - Call id(1), args( Qubit(0), Result(0), ) - Variable(1, Boolean) = Call id(2), args( Result(0), ) + Call id(2), args( Qubit(0), Result(0), ) + Variable(1, Boolean) = Call id(3), args( Result(0), ) Variable(2, Boolean) = Icmp Eq, Variable(1, Boolean), Bool(false) Branch Variable(2, Boolean), 2, 3 Block 1:Block: - Call id(3), args( Integer(0), EmptyTag, ) + Call id(4), args( Integer(0), EmptyTag, ) Return Block 2:Block: Variable(0, Integer) = Store Integer(-1) @@ -244,15 +247,16 @@ fn dynamic_var_across_if_else_in_loop_constant_folded_in_first_iteration() { &expect![[r#" Blocks: Block 0:Block: + Call id(1), args( Pointer, ) Variable(0, Integer) = Store Integer(0) - Call id(1), args( Qubit(0), Result(0), ) + Call id(2), args( Qubit(0), Result(0), ) Variable(1, Integer) = Store Integer(0) - Variable(2, Boolean) = Call id(2), args( Result(0), ) + Variable(2, Boolean) = Call id(3), args( Result(0), ) Variable(3, Boolean) = Icmp Eq, Variable(2, Boolean), Bool(false) Branch Variable(3, Boolean), 2, 3 Block 1:Block: Variable(1, Integer) = Store Integer(1) - Variable(4, Boolean) = Call id(2), args( Result(0), ) + Variable(4, Boolean) = Call id(3), args( Result(0), ) Variable(5, Boolean) = Icmp Eq, Variable(4, Boolean), Bool(false) Branch Variable(5, Boolean), 5, 6 Block 2:Block: @@ -263,7 +267,7 @@ fn dynamic_var_across_if_else_in_loop_constant_folded_in_first_iteration() { Jump(1) Block 4:Block: Variable(1, Integer) = Store Integer(2) - Call id(3), args( Integer(0), EmptyTag, ) + Call id(4), args( Integer(0), EmptyTag, ) Return Block 5:Block: Variable(6, Integer) = Sub Variable(0, Integer), Integer(1) @@ -303,16 +307,17 @@ fn dynamic_var_within_if_else_in_loop_constant_folded_in_every_iteration() { &expect![[r#" Blocks: Block 0:Block: - Call id(1), args( Qubit(0), Result(0), ) + Call id(1), args( Pointer, ) + Call id(2), args( Qubit(0), Result(0), ) Variable(0, Integer) = Store Integer(0) Variable(1, Integer) = Store Integer(0) - Variable(2, Boolean) = Call id(2), args( Result(0), ) + Variable(2, Boolean) = Call id(3), args( Result(0), ) Variable(3, Boolean) = Icmp Eq, Variable(2, Boolean), Bool(false) Branch Variable(3, Boolean), 2, 3 Block 1:Block: Variable(0, Integer) = Store Integer(1) Variable(4, Integer) = Store Integer(0) - Variable(5, Boolean) = Call id(2), args( Result(0), ) + Variable(5, Boolean) = Call id(3), args( Result(0), ) Variable(6, Boolean) = Icmp Eq, Variable(5, Boolean), Bool(false) Branch Variable(6, Boolean), 5, 6 Block 2:Block: @@ -323,7 +328,7 @@ fn dynamic_var_within_if_else_in_loop_constant_folded_in_every_iteration() { Jump(1) Block 4:Block: Variable(0, Integer) = Store Integer(2) - Call id(3), args( Integer(0), EmptyTag, ) + Call id(4), args( Integer(0), EmptyTag, ) Return Block 5:Block: Variable(4, Integer) = Store Integer(-1) @@ -361,13 +366,14 @@ fn dynamic_var_updated_twice_in_same_branch_constant_folded() { &expect![[r#" Blocks: Block 0:Block: + Call id(1), args( Pointer, ) Variable(0, Integer) = Store Integer(0) - Call id(1), args( Qubit(0), Result(0), ) - Variable(1, Boolean) = Call id(2), args( Result(0), ) + Call id(2), args( Qubit(0), Result(0), ) + Variable(1, Boolean) = Call id(3), args( Result(0), ) Variable(2, Boolean) = Icmp Eq, Variable(1, Boolean), Bool(false) Branch Variable(2, Boolean), 2, 3 Block 1:Block: - Call id(3), args( Integer(0), EmptyTag, ) + Call id(4), args( Integer(0), EmptyTag, ) Return Block 2:Block: Variable(0, Integer) = Store Integer(-1) @@ -408,14 +414,15 @@ fn dynamic_var_updated_to_same_value_in_different_branches_constant_folded_after &expect![[r#" Blocks: Block 0:Block: + Call id(1), args( Pointer, ) Variable(0, Integer) = Store Integer(0) - Call id(1), args( Qubit(0), Result(0), ) - Variable(1, Boolean) = Call id(2), args( Result(0), ) + Call id(2), args( Qubit(0), Result(0), ) + Variable(1, Boolean) = Call id(3), args( Result(0), ) Variable(2, Boolean) = Icmp Eq, Variable(1, Boolean), Bool(false) Branch Variable(2, Boolean), 2, 3 Block 1:Block: Variable(0, Integer) = Store Integer(2) - Call id(3), args( Integer(0), EmptyTag, ) + Call id(4), args( Integer(0), EmptyTag, ) Return Block 2:Block: Variable(0, Integer) = Store Integer(-1) @@ -468,17 +475,18 @@ fn dynamic_var_updated_in_nested_branches_constant_folded_when_value_matches_acr &expect![[r#" Blocks: Block 0:Block: + Call id(1), args( Pointer, ) Variable(0, Integer) = Store Integer(0) - Call id(1), args( Qubit(0), Result(0), ) - Variable(1, Boolean) = Call id(2), args( Result(0), ) + Call id(2), args( Qubit(0), Result(0), ) + Variable(1, Boolean) = Call id(3), args( Result(0), ) Variable(2, Boolean) = Icmp Eq, Variable(1, Boolean), Bool(false) Branch Variable(2, Boolean), 2, 6 Block 1:Block: - Call id(3), args( Integer(1), Tag(0, 3), ) + Call id(4), args( Integer(1), Tag(0, 3), ) Return Block 2:Block: Variable(0, Integer) = Store Integer(-1) - Variable(3, Boolean) = Call id(2), args( Result(0), ) + Variable(3, Boolean) = Call id(3), args( Result(0), ) Variable(4, Boolean) = Icmp Eq, Variable(3, Boolean), Bool(false) Branch Variable(4, Boolean), 4, 5 Block 3:Block: @@ -493,7 +501,7 @@ fn dynamic_var_updated_in_nested_branches_constant_folded_when_value_matches_acr Jump(3) Block 6:Block: Variable(0, Integer) = Store Integer(1) - Variable(5, Boolean) = Call id(2), args( Result(0), ) + Variable(5, Boolean) = Call id(3), args( Result(0), ) Variable(6, Boolean) = Icmp Eq, Variable(5, Boolean), Bool(false) Branch Variable(6, Boolean), 8, 9 Block 7:Block: @@ -535,9 +543,10 @@ fn dynamic_var_set_to_static_after_dynamism_still_constant_folded() { &expect![[r#" Blocks: Block 0:Block: + Call id(1), args( Pointer, ) Variable(0, Integer) = Store Integer(0) - Call id(1), args( Qubit(0), Result(0), ) - Variable(1, Boolean) = Call id(2), args( Result(0), ) + Call id(2), args( Qubit(0), Result(0), ) + Variable(1, Boolean) = Call id(3), args( Result(0), ) Variable(2, Boolean) = Icmp Eq, Variable(1, Boolean), Bool(false) Branch Variable(2, Boolean), 2, 1 Block 1:Block: @@ -545,7 +554,7 @@ fn dynamic_var_set_to_static_after_dynamism_still_constant_folded() { Variable(0, Integer) = Store Variable(3, Integer) Variable(0, Integer) = Store Integer(3) Variable(0, Integer) = Store Integer(4) - Call id(3), args( Integer(0), EmptyTag, ) + Call id(4), args( Integer(0), EmptyTag, ) Return Block 2:Block: Variable(0, Integer) = Store Integer(-1) @@ -583,16 +592,17 @@ fn dynamic_var_updated_in_loop_constant_folded_when_every_iteration_results_in_s &expect![[r#" Blocks: Block 0:Block: + Call id(1), args( Pointer, ) Variable(0, Integer) = Store Integer(0) - Call id(1), args( Qubit(0), Result(0), ) + Call id(2), args( Qubit(0), Result(0), ) Variable(1, Integer) = Store Integer(0) - Variable(2, Boolean) = Call id(2), args( Result(0), ) + Variable(2, Boolean) = Call id(3), args( Result(0), ) Variable(3, Boolean) = Icmp Eq, Variable(2, Boolean), Bool(false) Branch Variable(3, Boolean), 2, 3 Block 1:Block: Variable(0, Integer) = Store Integer(0) Variable(1, Integer) = Store Integer(1) - Variable(4, Boolean) = Call id(2), args( Result(0), ) + Variable(4, Boolean) = Call id(3), args( Result(0), ) Variable(5, Boolean) = Icmp Eq, Variable(4, Boolean), Bool(false) Branch Variable(5, Boolean), 5, 6 Block 2:Block: @@ -605,7 +615,7 @@ fn dynamic_var_updated_in_loop_constant_folded_when_every_iteration_results_in_s Block 4:Block: Variable(0, Integer) = Store Integer(0) Variable(1, Integer) = Store Integer(2) - Call id(3), args( Integer(0), Tag(0, 3), ) + Call id(4), args( Integer(0), Tag(0, 3), ) Return Block 5:Block: Variable(0, Integer) = Store Integer(-1) @@ -643,18 +653,19 @@ fn immutable_bind_of_dynamic_var_should_be_point_in_time_copy() { &expect![[r#" Blocks: Block 0:Block: + Call id(1), args( Pointer, ) Variable(0, Integer) = Store Integer(0) - Call id(1), args( Qubit(0), Result(0), ) - Variable(1, Boolean) = Call id(2), args( Result(0), ) + Call id(2), args( Qubit(0), Result(0), ) + Variable(1, Boolean) = Call id(3), args( Result(0), ) Variable(2, Boolean) = Icmp Eq, Variable(1, Boolean), Bool(false) Branch Variable(2, Boolean), 2, 1 Block 1:Block: Variable(3, Integer) = Store Variable(0, Integer) Variable(4, Integer) = Add Variable(0, Integer), Integer(1) Variable(0, Integer) = Store Variable(4, Integer) - Call id(3), args( Integer(2), EmptyTag, ) - Call id(4), args( Variable(3, Integer), Tag(0, 5), ) - Call id(4), args( Variable(0, Integer), Tag(1, 5), ) + Call id(4), args( Integer(2), EmptyTag, ) + Call id(5), args( Variable(3, Integer), Tag(0, 5), ) + Call id(5), args( Variable(0, Integer), Tag(1, 5), ) Return Block 2:Block: Variable(0, Integer) = Store Integer(-1) @@ -683,14 +694,13 @@ fn dynamic_double_from_if_expression_with_single_measurement_comparison_and_clas &program, mresetz_callable_id, &expect![[r#" - Callable: - name: __quantum__qis__mresetz__body - call_type: Measurement - input_type: - [0]: Qubit - [1]: Result - output_type: - body: "#]], + Callable: + name: __quantum__rt__initialize + call_type: Regular + input_type: + [0]: Pointer + output_type: + body: "#]], ); let read_result_callable_id = CallableId(2); assert_callable( @@ -698,11 +708,12 @@ fn dynamic_double_from_if_expression_with_single_measurement_comparison_and_clas read_result_callable_id, &expect![[r#" Callable: - name: __quantum__rt__read_result - call_type: Readout + name: __quantum__qis__mresetz__body + call_type: Measurement input_type: - [0]: Result - output_type: Boolean + [0]: Qubit + [1]: Result + output_type: body: "#]], ); @@ -711,13 +722,14 @@ fn dynamic_double_from_if_expression_with_single_measurement_comparison_and_clas &expect![[r#" Blocks: Block 0:Block: - Call id(1), args( Qubit(0), Result(0), ) - Variable(0, Boolean) = Call id(2), args( Result(0), ) + Call id(1), args( Pointer, ) + Call id(2), args( Qubit(0), Result(0), ) + Variable(0, Boolean) = Call id(3), args( Result(0), ) Variable(1, Boolean) = Icmp Eq, Variable(0, Boolean), Bool(false) Branch Variable(1, Boolean), 2, 3 Block 1:Block: Variable(3, Double) = Store Variable(2, Double) - Call id(3), args( Integer(0), EmptyTag, ) + Call id(4), args( Integer(0), EmptyTag, ) Return Block 2:Block: Variable(2, Double) = Store Double(0.1) @@ -757,14 +769,13 @@ fn dynamic_double_from_if_expression_with_single_measurement_comparison_and_non_ &program, mresetz_callable_id, &expect![[r#" - Callable: - name: __quantum__qis__mresetz__body - call_type: Measurement - input_type: - [0]: Qubit - [1]: Result - output_type: - body: "#]], + Callable: + name: __quantum__rt__initialize + call_type: Regular + input_type: + [0]: Pointer + output_type: + body: "#]], ); let read_result_callable_id = CallableId(2); assert_callable( @@ -772,11 +783,12 @@ fn dynamic_double_from_if_expression_with_single_measurement_comparison_and_non_ read_result_callable_id, &expect![[r#" Callable: - name: __quantum__rt__read_result - call_type: Readout + name: __quantum__qis__mresetz__body + call_type: Measurement input_type: - [0]: Result - output_type: Boolean + [0]: Qubit + [1]: Result + output_type: body: "#]], ); let op_a_callable_id = CallableId(3); @@ -784,13 +796,13 @@ fn dynamic_double_from_if_expression_with_single_measurement_comparison_and_non_ &program, op_a_callable_id, &expect![[r#" - Callable: - name: OpA - call_type: Regular - input_type: - [0]: Qubit - output_type: - body: "#]], + Callable: + name: __quantum__rt__read_result + call_type: Readout + input_type: + [0]: Result + output_type: Boolean + body: "#]], ); let op_b_callable_id = CallableId(4); assert_callable( @@ -798,7 +810,7 @@ fn dynamic_double_from_if_expression_with_single_measurement_comparison_and_non_ op_b_callable_id, &expect![[r#" Callable: - name: OpB + name: OpA call_type: Regular input_type: [0]: Qubit @@ -810,20 +822,21 @@ fn dynamic_double_from_if_expression_with_single_measurement_comparison_and_non_ &expect![[r#" Blocks: Block 0:Block: - Call id(1), args( Qubit(0), Result(0), ) - Variable(0, Boolean) = Call id(2), args( Result(0), ) + Call id(1), args( Pointer, ) + Call id(2), args( Qubit(0), Result(0), ) + Variable(0, Boolean) = Call id(3), args( Result(0), ) Variable(1, Boolean) = Icmp Eq, Variable(0, Boolean), Bool(false) Branch Variable(1, Boolean), 2, 3 Block 1:Block: Variable(3, Double) = Store Variable(2, Double) - Call id(5), args( Integer(0), EmptyTag, ) + Call id(6), args( Integer(0), EmptyTag, ) Return Block 2:Block: - Call id(3), args( Qubit(1), ) + Call id(4), args( Qubit(1), ) Variable(2, Double) = Store Double(0.1) Jump(1) Block 3:Block: - Call id(4), args( Qubit(1), ) + Call id(5), args( Qubit(1), ) Variable(2, Double) = Store Double(1.1) Jump(1)"#]], ); @@ -857,14 +870,13 @@ fn dynamic_double_from_if_expression_with_single_measurement_comparison_pass_dyn &program, mresetz_callable_id, &expect![[r#" - Callable: - name: __quantum__qis__mresetz__body - call_type: Measurement - input_type: - [0]: Qubit - [1]: Result - output_type: - body: "#]], + Callable: + name: __quantum__rt__initialize + call_type: Regular + input_type: + [0]: Pointer + output_type: + body: "#]], ); let read_result_callable_id = CallableId(2); assert_callable( @@ -872,11 +884,12 @@ fn dynamic_double_from_if_expression_with_single_measurement_comparison_pass_dyn read_result_callable_id, &expect![[r#" Callable: - name: __quantum__rt__read_result - call_type: Readout + name: __quantum__qis__mresetz__body + call_type: Measurement input_type: - [0]: Result - output_type: Boolean + [0]: Qubit + [1]: Result + output_type: body: "#]], ); let op_a_callable_id = CallableId(3); @@ -885,12 +898,11 @@ fn dynamic_double_from_if_expression_with_single_measurement_comparison_pass_dyn op_a_callable_id, &expect![[r#" Callable: - name: OpA - call_type: Regular + name: __quantum__rt__read_result + call_type: Readout input_type: - [0]: Double - [1]: Qubit - output_type: + [0]: Result + output_type: Boolean body: "#]], ); let op_b_callable_id = CallableId(4); @@ -899,11 +911,11 @@ fn dynamic_double_from_if_expression_with_single_measurement_comparison_pass_dyn op_b_callable_id, &expect![[r#" Callable: - name: __quantum__rt__tuple_record_output - call_type: OutputRecording + name: OpA + call_type: Regular input_type: - [0]: Integer - [1]: Pointer + [0]: Double + [1]: Qubit output_type: body: "#]], ); @@ -912,14 +924,15 @@ fn dynamic_double_from_if_expression_with_single_measurement_comparison_pass_dyn &expect![[r#" Blocks: Block 0:Block: - Call id(1), args( Qubit(0), Result(0), ) - Variable(0, Boolean) = Call id(2), args( Result(0), ) + Call id(1), args( Pointer, ) + Call id(2), args( Qubit(0), Result(0), ) + Variable(0, Boolean) = Call id(3), args( Result(0), ) Variable(1, Boolean) = Icmp Eq, Variable(0, Boolean), Bool(false) Branch Variable(1, Boolean), 2, 3 Block 1:Block: Variable(3, Double) = Store Variable(2, Double) - Call id(3), args( Variable(3, Double), Qubit(1), ) - Call id(4), args( Integer(0), EmptyTag, ) + Call id(4), args( Variable(3, Double), Qubit(1), ) + Call id(5), args( Integer(0), EmptyTag, ) Return Block 2:Block: Variable(2, Double) = Store Double(0.1) diff --git a/source/compiler/qsc_partial_eval/src/tests/intrinsics.rs b/source/compiler/qsc_partial_eval/src/tests/intrinsics.rs index 9a4c98b874..94def74fd4 100644 --- a/source/compiler/qsc_partial_eval/src/tests/intrinsics.rs +++ b/source/compiler/qsc_partial_eval/src/tests/intrinsics.rs @@ -137,16 +137,17 @@ fn call_to_intrinsic_h_adds_callable_and_generates_instruction() { "__quantum__qis__h__body", &expect![[r#" Callable: - name: __quantum__qis__h__body + name: __quantum__rt__initialize call_type: Regular input_type: - [0]: Qubit + [0]: Pointer output_type: body: "#]], &expect![[r#" Block: - Call id(1), args( Qubit(0), ) - Call id(2), args( Integer(0), EmptyTag, ) + Call id(1), args( Pointer, ) + Call id(2), args( Qubit(0), ) + Call id(3), args( Integer(0), EmptyTag, ) Return"#]], ); } @@ -157,16 +158,17 @@ fn call_to_intrinsic_s_adds_callable_and_generates_instruction() { "__quantum__qis__s__body", &expect![[r#" Callable: - name: __quantum__qis__s__body + name: __quantum__rt__initialize call_type: Regular input_type: - [0]: Qubit + [0]: Pointer output_type: body: "#]], &expect![[r#" Block: - Call id(1), args( Qubit(0), ) - Call id(2), args( Integer(0), EmptyTag, ) + Call id(1), args( Pointer, ) + Call id(2), args( Qubit(0), ) + Call id(3), args( Integer(0), EmptyTag, ) Return"#]], ); } @@ -177,16 +179,17 @@ fn call_to_intrinsic_adjoint_s_adds_callable_and_generates_instruction() { "__quantum__qis__s__adj", &expect![[r#" Callable: - name: __quantum__qis__s__adj + name: __quantum__rt__initialize call_type: Regular input_type: - [0]: Qubit + [0]: Pointer output_type: body: "#]], &expect![[r#" Block: - Call id(1), args( Qubit(0), ) - Call id(2), args( Integer(0), EmptyTag, ) + Call id(1), args( Pointer, ) + Call id(2), args( Qubit(0), ) + Call id(3), args( Integer(0), EmptyTag, ) Return"#]], ); } @@ -197,16 +200,17 @@ fn call_to_intrinsic_sx_adds_callable_and_generates_instruction() { "__quantum__qis__sx__body", &expect![[r#" Callable: - name: __quantum__qis__sx__body + name: __quantum__rt__initialize call_type: Regular input_type: - [0]: Qubit + [0]: Pointer output_type: body: "#]], &expect![[r#" Block: - Call id(1), args( Qubit(0), ) - Call id(2), args( Integer(0), EmptyTag, ) + Call id(1), args( Pointer, ) + Call id(2), args( Qubit(0), ) + Call id(3), args( Integer(0), EmptyTag, ) Return"#]], ); } @@ -217,16 +221,17 @@ fn call_to_intrinsic_t_adds_callable_and_generates_instruction() { "__quantum__qis__t__body", &expect![[r#" Callable: - name: __quantum__qis__t__body + name: __quantum__rt__initialize call_type: Regular input_type: - [0]: Qubit + [0]: Pointer output_type: body: "#]], &expect![[r#" Block: - Call id(1), args( Qubit(0), ) - Call id(2), args( Integer(0), EmptyTag, ) + Call id(1), args( Pointer, ) + Call id(2), args( Qubit(0), ) + Call id(3), args( Integer(0), EmptyTag, ) Return"#]], ); } @@ -237,16 +242,17 @@ fn call_to_intrinsic_adjoint_t_adds_callable_and_generates_instruction() { "__quantum__qis__t__adj", &expect![[r#" Callable: - name: __quantum__qis__t__adj + name: __quantum__rt__initialize call_type: Regular input_type: - [0]: Qubit + [0]: Pointer output_type: body: "#]], &expect![[r#" Block: - Call id(1), args( Qubit(0), ) - Call id(2), args( Integer(0), EmptyTag, ) + Call id(1), args( Pointer, ) + Call id(2), args( Qubit(0), ) + Call id(3), args( Integer(0), EmptyTag, ) Return"#]], ); } @@ -257,16 +263,17 @@ fn call_to_intrinsic_x_adds_callable_and_generates_instruction() { "__quantum__qis__x__body", &expect![[r#" Callable: - name: __quantum__qis__x__body + name: __quantum__rt__initialize call_type: Regular input_type: - [0]: Qubit + [0]: Pointer output_type: body: "#]], &expect![[r#" Block: - Call id(1), args( Qubit(0), ) - Call id(2), args( Integer(0), EmptyTag, ) + Call id(1), args( Pointer, ) + Call id(2), args( Qubit(0), ) + Call id(3), args( Integer(0), EmptyTag, ) Return"#]], ); } @@ -277,16 +284,17 @@ fn call_to_intrinsic_y_adds_callable_and_generates_instruction() { "__quantum__qis__y__body", &expect![[r#" Callable: - name: __quantum__qis__y__body + name: __quantum__rt__initialize call_type: Regular input_type: - [0]: Qubit + [0]: Pointer output_type: body: "#]], &expect![[r#" Block: - Call id(1), args( Qubit(0), ) - Call id(2), args( Integer(0), EmptyTag, ) + Call id(1), args( Pointer, ) + Call id(2), args( Qubit(0), ) + Call id(3), args( Integer(0), EmptyTag, ) Return"#]], ); } @@ -297,16 +305,17 @@ fn call_to_intrinsic_z_adds_callable_and_generates_instruction() { "__quantum__qis__z__body", &expect![[r#" Callable: - name: __quantum__qis__z__body + name: __quantum__rt__initialize call_type: Regular input_type: - [0]: Qubit + [0]: Pointer output_type: body: "#]], &expect![[r#" Block: - Call id(1), args( Qubit(0), ) - Call id(2), args( Integer(0), EmptyTag, ) + Call id(1), args( Pointer, ) + Call id(2), args( Qubit(0), ) + Call id(3), args( Integer(0), EmptyTag, ) Return"#]], ); } @@ -317,17 +326,17 @@ fn call_to_intrinsic_swap_adds_callable_and_generates_instruction() { "__quantum__qis__swap__body", &expect![[r#" Callable: - name: __quantum__qis__swap__body + name: __quantum__rt__initialize call_type: Regular input_type: - [0]: Qubit - [1]: Qubit + [0]: Pointer output_type: body: "#]], &expect![[r#" Block: - Call id(1), args( Qubit(0), Qubit(1), ) - Call id(2), args( Integer(0), EmptyTag, ) + Call id(1), args( Pointer, ) + Call id(2), args( Qubit(0), Qubit(1), ) + Call id(3), args( Integer(0), EmptyTag, ) Return"#]], ); } @@ -338,17 +347,17 @@ fn call_to_intrinsic_cx_adds_callable_and_generates_instruction() { "__quantum__qis__cx__body", &expect![[r#" Callable: - name: __quantum__qis__cx__body + name: __quantum__rt__initialize call_type: Regular input_type: - [0]: Qubit - [1]: Qubit + [0]: Pointer output_type: body: "#]], &expect![[r#" Block: - Call id(1), args( Qubit(0), Qubit(1), ) - Call id(2), args( Integer(0), EmptyTag, ) + Call id(1), args( Pointer, ) + Call id(2), args( Qubit(0), Qubit(1), ) + Call id(3), args( Integer(0), EmptyTag, ) Return"#]], ); } @@ -359,17 +368,17 @@ fn call_to_intrinsic_cy_adds_callable_and_generates_instruction() { "__quantum__qis__cy__body", &expect![[r#" Callable: - name: __quantum__qis__cy__body + name: __quantum__rt__initialize call_type: Regular input_type: - [0]: Qubit - [1]: Qubit + [0]: Pointer output_type: body: "#]], &expect![[r#" Block: - Call id(1), args( Qubit(0), Qubit(1), ) - Call id(2), args( Integer(0), EmptyTag, ) + Call id(1), args( Pointer, ) + Call id(2), args( Qubit(0), Qubit(1), ) + Call id(3), args( Integer(0), EmptyTag, ) Return"#]], ); } @@ -380,17 +389,17 @@ fn call_to_intrinsic_cz_adds_callable_and_generates_instruction() { "__quantum__qis__cz__body", &expect![[r#" Callable: - name: __quantum__qis__cz__body + name: __quantum__rt__initialize call_type: Regular input_type: - [0]: Qubit - [1]: Qubit + [0]: Pointer output_type: body: "#]], &expect![[r#" Block: - Call id(1), args( Qubit(0), Qubit(1), ) - Call id(2), args( Integer(0), EmptyTag, ) + Call id(1), args( Pointer, ) + Call id(2), args( Qubit(0), Qubit(1), ) + Call id(3), args( Integer(0), EmptyTag, ) Return"#]], ); } @@ -401,18 +410,17 @@ fn call_to_intrinsic_ccx_adds_callable_and_generates_instruction() { "__quantum__qis__ccx__body", &expect![[r#" Callable: - name: __quantum__qis__ccx__body + name: __quantum__rt__initialize call_type: Regular input_type: - [0]: Qubit - [1]: Qubit - [2]: Qubit + [0]: Pointer output_type: body: "#]], &expect![[r#" Block: - Call id(1), args( Qubit(0), Qubit(1), Qubit(2), ) - Call id(2), args( Integer(0), EmptyTag, ) + Call id(1), args( Pointer, ) + Call id(2), args( Qubit(0), Qubit(1), Qubit(2), ) + Call id(3), args( Integer(0), EmptyTag, ) Return"#]], ); } @@ -423,17 +431,17 @@ fn call_to_intrinsic_rx_adds_callable_and_generates_instruction() { "__quantum__qis__rx__body", &expect![[r#" Callable: - name: __quantum__qis__rx__body + name: __quantum__rt__initialize call_type: Regular input_type: - [0]: Double - [1]: Qubit + [0]: Pointer output_type: body: "#]], &expect![[r#" Block: - Call id(1), args( Double(0), Qubit(0), ) - Call id(2), args( Integer(0), EmptyTag, ) + Call id(1), args( Pointer, ) + Call id(2), args( Double(0), Qubit(0), ) + Call id(3), args( Integer(0), EmptyTag, ) Return"#]], ); } @@ -444,18 +452,17 @@ fn call_to_intrinsic_rxx_adds_callable_and_generates_instruction() { "__quantum__qis__rxx__body", &expect![[r#" Callable: - name: __quantum__qis__rxx__body + name: __quantum__rt__initialize call_type: Regular input_type: - [0]: Double - [1]: Qubit - [2]: Qubit + [0]: Pointer output_type: body: "#]], &expect![[r#" Block: - Call id(1), args( Double(0), Qubit(0), Qubit(1), ) - Call id(2), args( Integer(0), EmptyTag, ) + Call id(1), args( Pointer, ) + Call id(2), args( Double(0), Qubit(0), Qubit(1), ) + Call id(3), args( Integer(0), EmptyTag, ) Return"#]], ); } @@ -466,17 +473,17 @@ fn call_to_intrinsic_ry_adds_callable_and_generates_instruction() { "__quantum__qis__ry__body", &expect![[r#" Callable: - name: __quantum__qis__ry__body + name: __quantum__rt__initialize call_type: Regular input_type: - [0]: Double - [1]: Qubit + [0]: Pointer output_type: body: "#]], &expect![[r#" Block: - Call id(1), args( Double(0), Qubit(0), ) - Call id(2), args( Integer(0), EmptyTag, ) + Call id(1), args( Pointer, ) + Call id(2), args( Double(0), Qubit(0), ) + Call id(3), args( Integer(0), EmptyTag, ) Return"#]], ); } @@ -487,18 +494,17 @@ fn call_to_intrinsic_ryy_adds_callable_and_generates_instruction() { "__quantum__qis__ryy__body", &expect![[r#" Callable: - name: __quantum__qis__ryy__body + name: __quantum__rt__initialize call_type: Regular input_type: - [0]: Double - [1]: Qubit - [2]: Qubit + [0]: Pointer output_type: body: "#]], &expect![[r#" Block: - Call id(1), args( Double(0), Qubit(0), Qubit(1), ) - Call id(2), args( Integer(0), EmptyTag, ) + Call id(1), args( Pointer, ) + Call id(2), args( Double(0), Qubit(0), Qubit(1), ) + Call id(3), args( Integer(0), EmptyTag, ) Return"#]], ); } @@ -509,17 +515,17 @@ fn call_to_intrinsic_rz_adds_callable_and_generates_instruction() { "__quantum__qis__rz__body", &expect![[r#" Callable: - name: __quantum__qis__rz__body + name: __quantum__rt__initialize call_type: Regular input_type: - [0]: Double - [1]: Qubit + [0]: Pointer output_type: body: "#]], &expect![[r#" Block: - Call id(1), args( Double(0), Qubit(0), ) - Call id(2), args( Integer(0), EmptyTag, ) + Call id(1), args( Pointer, ) + Call id(2), args( Double(0), Qubit(0), ) + Call id(3), args( Integer(0), EmptyTag, ) Return"#]], ); } @@ -530,18 +536,17 @@ fn call_to_intrinsic_rzz_adds_callable_and_generates_instruction() { "__quantum__qis__rzz__body", &expect![[r#" Callable: - name: __quantum__qis__rzz__body + name: __quantum__rt__initialize call_type: Regular input_type: - [0]: Double - [1]: Qubit - [2]: Qubit + [0]: Pointer output_type: body: "#]], &expect![[r#" Block: - Call id(1), args( Double(0), Qubit(0), Qubit(1), ) - Call id(2), args( Integer(0), EmptyTag, ) + Call id(1), args( Pointer, ) + Call id(2), args( Double(0), Qubit(0), Qubit(1), ) + Call id(3), args( Integer(0), EmptyTag, ) Return"#]], ); } @@ -564,21 +569,22 @@ fn check_partial_eval_for_call_to_reset() { &program, op_callable_id, &expect![[r#" - Callable: - name: __quantum__qis__reset__body - call_type: Reset - input_type: - [0]: Qubit - output_type: - body: "#]], + Callable: + name: __quantum__rt__initialize + call_type: Regular + input_type: + [0]: Pointer + output_type: + body: "#]], ); assert_block_instructions( &program, BlockId(0), &expect![[r#" Block: - Call id(1), args( Qubit(0), ) - Call id(2), args( Integer(0), EmptyTag, ) + Call id(1), args( Pointer, ) + Call id(2), args( Qubit(0), ) + Call id(3), args( Integer(0), EmptyTag, ) Return"#]], ); } @@ -602,11 +608,10 @@ fn call_to_intrinsic_m_adds_callable_and_generates_instruction() { op_callable_id, &expect![[r#" Callable: - name: __quantum__qis__m__body - call_type: Measurement + name: __quantum__rt__initialize + call_type: Regular input_type: - [0]: Qubit - [1]: Result + [0]: Pointer output_type: body: "#]], ); @@ -615,8 +620,9 @@ fn call_to_intrinsic_m_adds_callable_and_generates_instruction() { BlockId(0), &expect![[r#" Block: - Call id(1), args( Qubit(0), Result(0), ) - Call id(2), args( Integer(0), EmptyTag, ) + Call id(1), args( Pointer, ) + Call id(2), args( Qubit(0), Result(0), ) + Call id(3), args( Integer(0), EmptyTag, ) Return"#]], ); } @@ -639,22 +645,22 @@ fn call_to_intrinsic_mresetz_adds_callable_and_generates_instruction() { &program, op_callable_id, &expect![[r#" - Callable: - name: __quantum__qis__mresetz__body - call_type: Measurement - input_type: - [0]: Qubit - [1]: Result - output_type: - body: "#]], + Callable: + name: __quantum__rt__initialize + call_type: Regular + input_type: + [0]: Pointer + output_type: + body: "#]], ); assert_block_instructions( &program, BlockId(0), &expect![[r#" Block: - Call id(1), args( Qubit(0), Result(0), ) - Call id(2), args( Integer(0), EmptyTag, ) + Call id(1), args( Pointer, ) + Call id(2), args( Qubit(0), Result(0), ) + Call id(3), args( Integer(0), EmptyTag, ) Return"#]], ); } @@ -684,22 +690,23 @@ fn calls_to_intrinsic_begin_estimate_caching_with_classical_values_always_yield_ &program, op_callable_id, &expect![[r#" - Callable: - name: Op - call_type: Regular - input_type: - [0]: Qubit - output_type: - body: "#]], + Callable: + name: __quantum__rt__initialize + call_type: Regular + input_type: + [0]: Pointer + output_type: + body: "#]], ); assert_block_instructions( &program, BlockId(0), &expect![[r#" Block: - Call id(1), args( Qubit(0), ) - Call id(1), args( Qubit(0), ) - Call id(2), args( Integer(0), EmptyTag, ) + Call id(1), args( Pointer, ) + Call id(2), args( Qubit(0), ) + Call id(2), args( Qubit(0), ) + Call id(3), args( Integer(0), EmptyTag, ) Return"#]], ); } @@ -729,11 +736,10 @@ fn call_to_intrinsic_begin_estimate_caching_with_dynamic_values_yields_true() { measure_callable_id, &expect![[r#" Callable: - name: __quantum__qis__m__body - call_type: Measurement + name: __quantum__rt__initialize + call_type: Regular input_type: - [0]: Qubit - [1]: Result + [0]: Pointer output_type: body: "#]], ); @@ -743,11 +749,12 @@ fn call_to_intrinsic_begin_estimate_caching_with_dynamic_values_yields_true() { read_result_callable_id, &expect![[r#" Callable: - name: __quantum__rt__read_result - call_type: Readout + name: __quantum__qis__m__body + call_type: Measurement input_type: - [0]: Result - output_type: Boolean + [0]: Qubit + [1]: Result + output_type: body: "#]], ); let op_callable_id = CallableId(3); @@ -755,13 +762,13 @@ fn call_to_intrinsic_begin_estimate_caching_with_dynamic_values_yields_true() { &program, op_callable_id, &expect![[r#" - Callable: - name: Op - call_type: Regular - input_type: - [0]: Qubit - output_type: - body: "#]], + Callable: + name: __quantum__rt__read_result + call_type: Readout + input_type: + [0]: Result + output_type: Boolean + body: "#]], ); let output_recording_callable_id = CallableId(4); assert_callable( @@ -769,11 +776,10 @@ fn call_to_intrinsic_begin_estimate_caching_with_dynamic_values_yields_true() { output_recording_callable_id, &expect![[r#" Callable: - name: __quantum__rt__tuple_record_output - call_type: OutputRecording + name: Op + call_type: Regular input_type: - [0]: Integer - [1]: Pointer + [0]: Qubit output_type: body: "#]], ); @@ -782,14 +788,15 @@ fn call_to_intrinsic_begin_estimate_caching_with_dynamic_values_yields_true() { &expect![[r#" Blocks: Block 0:Block: - Call id(1), args( Qubit(0), Result(0), ) - Variable(0, Boolean) = Call id(2), args( Result(0), ) + Call id(1), args( Pointer, ) + Call id(2), args( Qubit(0), Result(0), ) + Variable(0, Boolean) = Call id(3), args( Result(0), ) Variable(1, Boolean) = Icmp Eq, Variable(0, Boolean), Bool(false) Branch Variable(1, Boolean), 2, 3 Block 1:Block: Variable(3, Integer) = Store Variable(2, Integer) - Call id(3), args( Qubit(0), ) - Call id(4), args( Integer(0), EmptyTag, ) + Call id(4), args( Qubit(0), ) + Call id(5), args( Integer(0), EmptyTag, ) Return Block 2:Block: Variable(2, Integer) = Store Integer(0) @@ -818,7 +825,8 @@ fn call_to_intrinsic_end_estimate_caching_does_not_generate_instructions() { BlockId(0), &expect![[r#" Block: - Call id(1), args( Integer(0), EmptyTag, ) + Call id(1), args( Pointer, ) + Call id(2), args( Integer(0), EmptyTag, ) Return"#]], ); } @@ -842,7 +850,8 @@ fn call_to_account_for_estimates_does_not_generate_instructions() { BlockId(0), &expect![[r#" Block: - Call id(1), args( Integer(0), EmptyTag, ) + Call id(1), args( Pointer, ) + Call id(2), args( Integer(0), EmptyTag, ) Return"#]], ); } @@ -866,7 +875,8 @@ fn call_to_begin_repeat_estimates_does_not_generate_instructions() { BlockId(0), &expect![[r#" Block: - Call id(1), args( Integer(0), EmptyTag, ) + Call id(1), args( Pointer, ) + Call id(2), args( Integer(0), EmptyTag, ) Return"#]], ); } @@ -890,7 +900,8 @@ fn call_to_end_repeat_estimates_does_not_generate_instructions() { BlockId(0), &expect![[r#" Block: - Call id(1), args( Integer(0), EmptyTag, ) + Call id(1), args( Pointer, ) + Call id(2), args( Integer(0), EmptyTag, ) Return"#]], ); } @@ -913,7 +924,8 @@ fn call_to_dump_machine_does_not_generate_instructions() { BlockId(0), &expect![[r#" Block: - Call id(1), args( Integer(0), EmptyTag, ) + Call id(1), args( Pointer, ) + Call id(2), args( Integer(0), EmptyTag, ) Return"#]], ); } @@ -937,7 +949,8 @@ fn call_to_dump_register_does_not_generate_instructions() { BlockId(0), &expect![[r#" Block: - Call id(1), args( Integer(0), EmptyTag, ) + Call id(1), args( Pointer, ) + Call id(2), args( Integer(0), EmptyTag, ) Return"#]], ); } @@ -962,7 +975,8 @@ fn use_of_noise_does_not_generate_instructions() { BlockId(0), &expect![[r#" Block: - Call id(1), args( Integer(0), EmptyTag, ) + Call id(1), args( Pointer, ) + Call id(2), args( Integer(0), EmptyTag, ) Return"#]], ); } @@ -1059,11 +1073,10 @@ fn call_to_length_in_inner_function_succeeds() { measurement_callable_id, &expect![[r#" Callable: - name: __quantum__qis__mresetz__body - call_type: Measurement + name: __quantum__rt__initialize + call_type: Regular input_type: - [0]: Qubit - [1]: Result + [0]: Pointer output_type: body: "#]], ); @@ -1073,11 +1086,11 @@ fn call_to_length_in_inner_function_succeeds() { output_recording_callable_id, &expect![[r#" Callable: - name: __quantum__rt__int_record_output - call_type: OutputRecording + name: __quantum__qis__mresetz__body + call_type: Measurement input_type: - [0]: Integer - [1]: Pointer + [0]: Qubit + [1]: Result output_type: body: "#]], ); @@ -1086,8 +1099,9 @@ fn call_to_length_in_inner_function_succeeds() { BlockId(0), &expect![[r#" Block: - Call id(1), args( Qubit(0), Result(0), ) - Call id(2), args( Integer(1), Tag(0, 3), ) + Call id(1), args( Pointer, ) + Call id(2), args( Qubit(0), Result(0), ) + Call id(3), args( Integer(1), Tag(0, 3), ) Return"#]], ); } @@ -1110,7 +1124,8 @@ fn call_to_pauli_i_rotation_for_global_phase_is_noop() { BlockId(0), &expect![[r#" Block: - Call id(1), args( Integer(0), EmptyTag, ) + Call id(1), args( Pointer, ) + Call id(2), args( Integer(0), EmptyTag, ) Return"#]], ); } @@ -1144,9 +1159,10 @@ fn call_to_operation_with_codegen_intrinsic_override_should_skip_impl() { op1_callable_id, &expect![[r#" Callable: - name: Op1 + name: __quantum__rt__initialize call_type: Regular - input_type: + input_type: + [0]: Pointer output_type: body: "#]], ); @@ -1156,7 +1172,7 @@ fn call_to_operation_with_codegen_intrinsic_override_should_skip_impl() { op2_callable_id, &expect![[r#" Callable: - name: Op2 + name: Op1 call_type: Regular input_type: output_type: @@ -1167,10 +1183,11 @@ fn call_to_operation_with_codegen_intrinsic_override_should_skip_impl() { BlockId(0), &expect![[r#" Block: - Call id(1), args( ) + Call id(1), args( Pointer, ) Call id(2), args( ) - Call id(1), args( ) - Call id(3), args( Integer(0), EmptyTag, ) + Call id(3), args( ) + Call id(2), args( ) + Call id(4), args( Integer(0), EmptyTag, ) Return"#]], ); } @@ -1195,10 +1212,11 @@ fn call_to_intrinsic_operation_that_returns_bool_value_should_produce_variable_u op1_callable_id, &expect![[r#" Callable: - name: Op1 + name: __quantum__rt__initialize call_type: Regular - input_type: - output_type: Boolean + input_type: + [0]: Pointer + output_type: body: "#]], ); assert_block_instructions( @@ -1206,8 +1224,9 @@ fn call_to_intrinsic_operation_that_returns_bool_value_should_produce_variable_u BlockId(0), &expect![[r#" Block: - Variable(0, Boolean) = Call id(1), args( ) - Call id(2), args( Variable(0, Boolean), Tag(0, 3), ) + Call id(1), args( Pointer, ) + Variable(0, Boolean) = Call id(2), args( ) + Call id(3), args( Variable(0, Boolean), Tag(0, 3), ) Return"#]], ); } @@ -1232,10 +1251,11 @@ fn call_to_intrinsic_operation_that_returns_int_value_should_produce_variable_us op1_callable_id, &expect![[r#" Callable: - name: Op1 + name: __quantum__rt__initialize call_type: Regular - input_type: - output_type: Integer + input_type: + [0]: Pointer + output_type: body: "#]], ); assert_block_instructions( @@ -1243,8 +1263,9 @@ fn call_to_intrinsic_operation_that_returns_int_value_should_produce_variable_us BlockId(0), &expect![[r#" Block: - Variable(0, Integer) = Call id(1), args( ) - Call id(2), args( Variable(0, Integer), Tag(0, 3), ) + Call id(1), args( Pointer, ) + Variable(0, Integer) = Call id(2), args( ) + Call id(3), args( Variable(0, Integer), Tag(0, 3), ) Return"#]], ); } @@ -1269,10 +1290,11 @@ fn call_to_intrinsic_operation_that_returns_double_value_should_produce_variable op1_callable_id, &expect![[r#" Callable: - name: Op1 + name: __quantum__rt__initialize call_type: Regular - input_type: - output_type: Double + input_type: + [0]: Pointer + output_type: body: "#]], ); assert_block_instructions( @@ -1280,8 +1302,9 @@ fn call_to_intrinsic_operation_that_returns_double_value_should_produce_variable BlockId(0), &expect![[r#" Block: - Variable(0, Double) = Call id(1), args( ) - Call id(2), args( Variable(0, Double), Tag(0, 3), ) + Call id(1), args( Pointer, ) + Variable(0, Double) = Call id(2), args( ) + Call id(3), args( Variable(0, Double), Tag(0, 3), ) Return"#]], ); } diff --git a/source/compiler/qsc_partial_eval/src/tests/loops.rs b/source/compiler/qsc_partial_eval/src/tests/loops.rs index c8f8691e8e..61039b78a7 100644 --- a/source/compiler/qsc_partial_eval/src/tests/loops.rs +++ b/source/compiler/qsc_partial_eval/src/tests/loops.rs @@ -28,27 +28,28 @@ fn unitary_call_within_a_for_loop() { &program, op_callable_id, &expect![[r#" - Callable: - name: op - call_type: Regular - input_type: - [0]: Qubit - output_type: - body: "#]], + Callable: + name: __quantum__rt__initialize + call_type: Regular + input_type: + [0]: Pointer + output_type: + body: "#]], ); assert_block_instructions( &program, BlockId(0), &expect![[r#" Block: + Call id(1), args( Pointer, ) Variable(0, Integer) = Store Integer(1) - Call id(1), args( Qubit(0), ) + Call id(2), args( Qubit(0), ) Variable(0, Integer) = Store Integer(2) - Call id(1), args( Qubit(0), ) + Call id(2), args( Qubit(0), ) Variable(0, Integer) = Store Integer(3) - Call id(1), args( Qubit(0), ) + Call id(2), args( Qubit(0), ) Variable(0, Integer) = Store Integer(4) - Call id(2), args( Integer(0), EmptyTag, ) + Call id(3), args( Integer(0), EmptyTag, ) Return"#]], ); } @@ -77,27 +78,28 @@ fn unitary_call_within_a_while_loop() { &program, rotation_callable_id, &expect![[r#" - Callable: - name: op - call_type: Regular - input_type: - [0]: Qubit - output_type: - body: "#]], + Callable: + name: __quantum__rt__initialize + call_type: Regular + input_type: + [0]: Pointer + output_type: + body: "#]], ); assert_block_instructions( &program, BlockId(0), &expect![[r#" Block: + Call id(1), args( Pointer, ) Variable(0, Integer) = Store Integer(0) - Call id(1), args( Qubit(0), ) + Call id(2), args( Qubit(0), ) Variable(0, Integer) = Store Integer(1) - Call id(1), args( Qubit(0), ) + Call id(2), args( Qubit(0), ) Variable(0, Integer) = Store Integer(2) - Call id(1), args( Qubit(0), ) + Call id(2), args( Qubit(0), ) Variable(0, Integer) = Store Integer(3) - Call id(2), args( Integer(0), EmptyTag, ) + Call id(3), args( Integer(0), EmptyTag, ) Return"#]], ); } @@ -126,31 +128,32 @@ fn unitary_call_within_a_repeat_until_loop() { &program, op_callable_id, &expect![[r#" - Callable: - name: op - call_type: Regular - input_type: - [0]: Qubit - output_type: - body: "#]], + Callable: + name: __quantum__rt__initialize + call_type: Regular + input_type: + [0]: Pointer + output_type: + body: "#]], ); assert_block_instructions( &program, BlockId(0), &expect![[r#" Block: + Call id(1), args( Pointer, ) Variable(0, Integer) = Store Integer(0) Variable(1, Boolean) = Store Bool(true) - Call id(1), args( Qubit(0), ) + Call id(2), args( Qubit(0), ) Variable(0, Integer) = Store Integer(1) Variable(1, Boolean) = Store Bool(true) - Call id(1), args( Qubit(0), ) + Call id(2), args( Qubit(0), ) Variable(0, Integer) = Store Integer(2) Variable(1, Boolean) = Store Bool(true) - Call id(1), args( Qubit(0), ) + Call id(2), args( Qubit(0), ) Variable(0, Integer) = Store Integer(3) Variable(1, Boolean) = Store Bool(false) - Call id(2), args( Integer(0), EmptyTag, ) + Call id(3), args( Integer(0), EmptyTag, ) Return"#]], ); } @@ -177,28 +180,28 @@ fn rotation_call_within_a_for_loop() { &program, rotation_callable_id, &expect![[r#" - Callable: - name: rotation - call_type: Regular - input_type: - [0]: Double - [1]: Qubit - output_type: - body: "#]], + Callable: + name: __quantum__rt__initialize + call_type: Regular + input_type: + [0]: Pointer + output_type: + body: "#]], ); assert_block_instructions( &program, BlockId(0), &expect![[r#" Block: + Call id(1), args( Pointer, ) Variable(0, Integer) = Store Integer(0) - Call id(1), args( Double(0), Qubit(0), ) + Call id(2), args( Double(0), Qubit(0), ) Variable(0, Integer) = Store Integer(1) - Call id(1), args( Double(1), Qubit(0), ) + Call id(2), args( Double(1), Qubit(0), ) Variable(0, Integer) = Store Integer(2) - Call id(1), args( Double(2), Qubit(0), ) + Call id(2), args( Double(2), Qubit(0), ) Variable(0, Integer) = Store Integer(3) - Call id(2), args( Integer(0), EmptyTag, ) + Call id(3), args( Integer(0), EmptyTag, ) Return"#]], ); } @@ -228,28 +231,28 @@ fn rotation_call_within_a_while_loop() { &program, op_callable_id, &expect![[r#" - Callable: - name: rotation - call_type: Regular - input_type: - [0]: Double - [1]: Qubit - output_type: - body: "#]], + Callable: + name: __quantum__rt__initialize + call_type: Regular + input_type: + [0]: Pointer + output_type: + body: "#]], ); assert_block_instructions( &program, BlockId(0), &expect![[r#" Block: + Call id(1), args( Pointer, ) Variable(0, Integer) = Store Integer(0) - Call id(1), args( Double(0), Qubit(0), ) + Call id(2), args( Double(0), Qubit(0), ) Variable(0, Integer) = Store Integer(1) - Call id(1), args( Double(1), Qubit(0), ) + Call id(2), args( Double(1), Qubit(0), ) Variable(0, Integer) = Store Integer(2) - Call id(1), args( Double(2), Qubit(0), ) + Call id(2), args( Double(2), Qubit(0), ) Variable(0, Integer) = Store Integer(3) - Call id(2), args( Integer(0), EmptyTag, ) + Call id(3), args( Integer(0), EmptyTag, ) Return"#]], ); } @@ -279,32 +282,32 @@ fn rotation_call_within_a_repeat_until_loop() { &program, rotation_callable_id, &expect![[r#" - Callable: - name: rotation - call_type: Regular - input_type: - [0]: Double - [1]: Qubit - output_type: - body: "#]], + Callable: + name: __quantum__rt__initialize + call_type: Regular + input_type: + [0]: Pointer + output_type: + body: "#]], ); assert_block_instructions( &program, BlockId(0), &expect![[r#" Block: + Call id(1), args( Pointer, ) Variable(0, Integer) = Store Integer(0) Variable(1, Boolean) = Store Bool(true) - Call id(1), args( Double(0), Qubit(0), ) + Call id(2), args( Double(0), Qubit(0), ) Variable(0, Integer) = Store Integer(1) Variable(1, Boolean) = Store Bool(true) - Call id(1), args( Double(1), Qubit(0), ) + Call id(2), args( Double(1), Qubit(0), ) Variable(0, Integer) = Store Integer(2) Variable(1, Boolean) = Store Bool(true) - Call id(1), args( Double(2), Qubit(0), ) + Call id(2), args( Double(2), Qubit(0), ) Variable(0, Integer) = Store Integer(3) Variable(1, Boolean) = Store Bool(false) - Call id(2), args( Integer(0), EmptyTag, ) + Call id(3), args( Integer(0), EmptyTag, ) Return"#]], ); } @@ -333,10 +336,11 @@ fn mutable_bool_updated_in_loop() { BlockId(0), &expect![[r#" Block: + Call id(1), args( Pointer, ) Variable(0, Boolean) = Store Bool(false) Variable(1, Integer) = Store Integer(1) - Call id(1), args( Qubit(0), Result(0), ) - Variable(2, Boolean) = Call id(2), args( Result(0), ) + Call id(2), args( Qubit(0), Result(0), ) + Variable(2, Boolean) = Call id(3), args( Result(0), ) Variable(3, Boolean) = Store Variable(2, Boolean) Variable(0, Boolean) = Store Variable(3, Boolean) Variable(1, Integer) = Store Integer(2) @@ -369,10 +373,11 @@ fn mutable_int_updated_in_loop() { BlockId(0), &expect![[r#" Block: + Call id(1), args( Pointer, ) Variable(0, Integer) = Store Integer(1) Variable(1, Integer) = Store Integer(1) - Call id(1), args( Qubit(0), Result(0), ) - Variable(2, Boolean) = Call id(2), args( Result(0), ) + Call id(2), args( Qubit(0), Result(0), ) + Variable(2, Boolean) = Call id(3), args( Result(0), ) Variable(3, Boolean) = Store Variable(2, Boolean) Branch Variable(3, Boolean), 2, 1"#]], ); @@ -403,10 +408,11 @@ fn mutable_double_updated_in_loop() { &expect![[r#" Blocks: Block 0:Block: + Call id(1), args( Pointer, ) Variable(0, Double) = Store Double(1.1) Variable(1, Integer) = Store Integer(1) - Call id(1), args( Qubit(0), Result(0), ) - Variable(2, Boolean) = Call id(2), args( Result(0), ) + Call id(2), args( Qubit(0), Result(0), ) + Variable(2, Boolean) = Call id(3), args( Result(0), ) Variable(3, Boolean) = Store Variable(2, Boolean) Branch Variable(3, Boolean), 2, 1 Block 1:Block: @@ -420,8 +426,8 @@ fn mutable_double_updated_in_loop() { Block 3:Block: Branch Variable(5, Boolean), 6, 5 Block 4:Block: - Call id(1), args( Qubit(0), Result(1), ) - Variable(6, Boolean) = Call id(2), args( Result(1), ) + Call id(2), args( Qubit(0), Result(1), ) + Variable(6, Boolean) = Call id(3), args( Result(1), ) Variable(7, Boolean) = Store Variable(6, Boolean) Variable(5, Boolean) = Store Variable(7, Boolean) Jump(3) @@ -437,14 +443,14 @@ fn mutable_double_updated_in_loop() { Block 7:Block: Branch Variable(10, Boolean), 10, 9 Block 8:Block: - Call id(1), args( Qubit(0), Result(2), ) - Variable(11, Boolean) = Call id(2), args( Result(2), ) + Call id(2), args( Qubit(0), Result(2), ) + Variable(11, Boolean) = Call id(3), args( Result(2), ) Variable(12, Boolean) = Store Variable(11, Boolean) Variable(10, Boolean) = Store Variable(12, Boolean) Jump(7) Block 9:Block: Variable(1, Integer) = Store Integer(4) - Call id(3), args( Integer(0), EmptyTag, ) + Call id(4), args( Integer(0), EmptyTag, ) Return Block 10:Block: Variable(13, Double) = Fmul Double(-1), Variable(0, Double) diff --git a/source/compiler/qsc_partial_eval/src/tests/misc.rs b/source/compiler/qsc_partial_eval/src/tests/misc.rs index 50c97d0903..14645a1baf 100644 --- a/source/compiler/qsc_partial_eval/src/tests/misc.rs +++ b/source/compiler/qsc_partial_eval/src/tests/misc.rs @@ -35,30 +35,31 @@ fn unitary_call_within_an_if_with_classical_condition_within_a_for_loop() { &program, op_callable_id, &expect![[r#" - Callable: - name: op - call_type: Regular - input_type: - [0]: Qubit - output_type: - body: "#]], + Callable: + name: __quantum__rt__initialize + call_type: Regular + input_type: + [0]: Pointer + output_type: + body: "#]], ); assert_block_instructions( &program, BlockId(0), &expect![[r#" Block: + Call id(1), args( Pointer, ) Variable(0, Integer) = Store Integer(0) - Call id(1), args( Qubit(0), ) + Call id(2), args( Qubit(0), ) Variable(0, Integer) = Store Integer(1) Variable(0, Integer) = Store Integer(2) - Call id(1), args( Qubit(0), ) + Call id(2), args( Qubit(0), ) Variable(0, Integer) = Store Integer(3) Variable(0, Integer) = Store Integer(4) - Call id(1), args( Qubit(0), ) + Call id(2), args( Qubit(0), ) Variable(0, Integer) = Store Integer(5) Variable(0, Integer) = Store Integer(6) - Call id(2), args( Integer(0), EmptyTag, ) + Call id(3), args( Integer(0), EmptyTag, ) Return"#]], ); } @@ -89,30 +90,31 @@ fn unitary_call_within_an_if_with_classical_condition_within_a_while_loop() { &program, op_callable_id, &expect![[r#" - Callable: - name: op - call_type: Regular - input_type: - [0]: Qubit - output_type: - body: "#]], + Callable: + name: __quantum__rt__initialize + call_type: Regular + input_type: + [0]: Pointer + output_type: + body: "#]], ); assert_block_instructions( &program, BlockId(0), &expect![[r#" Block: + Call id(1), args( Pointer, ) Variable(0, Integer) = Store Integer(0) - Call id(1), args( Qubit(0), ) + Call id(2), args( Qubit(0), ) Variable(0, Integer) = Store Integer(1) Variable(0, Integer) = Store Integer(2) - Call id(1), args( Qubit(0), ) + Call id(2), args( Qubit(0), ) Variable(0, Integer) = Store Integer(3) Variable(0, Integer) = Store Integer(4) - Call id(1), args( Qubit(0), ) + Call id(2), args( Qubit(0), ) Variable(0, Integer) = Store Integer(5) Variable(0, Integer) = Store Integer(6) - Call id(2), args( Integer(0), EmptyTag, ) + Call id(3), args( Integer(0), EmptyTag, ) Return"#]], ); } @@ -143,37 +145,38 @@ fn unitary_call_within_an_if_with_classical_condition_within_a_repeat_until_loop &program, op_callable_id, &expect![[r#" - Callable: - name: op - call_type: Regular - input_type: - [0]: Qubit - output_type: - body: "#]], + Callable: + name: __quantum__rt__initialize + call_type: Regular + input_type: + [0]: Pointer + output_type: + body: "#]], ); assert_block_instructions( &program, BlockId(0), &expect![[r#" Block: + Call id(1), args( Pointer, ) Variable(0, Integer) = Store Integer(0) Variable(1, Boolean) = Store Bool(true) - Call id(1), args( Qubit(0), ) + Call id(2), args( Qubit(0), ) Variable(0, Integer) = Store Integer(1) Variable(1, Boolean) = Store Bool(true) Variable(0, Integer) = Store Integer(2) Variable(1, Boolean) = Store Bool(true) - Call id(1), args( Qubit(0), ) + Call id(2), args( Qubit(0), ) Variable(0, Integer) = Store Integer(3) Variable(1, Boolean) = Store Bool(true) Variable(0, Integer) = Store Integer(4) Variable(1, Boolean) = Store Bool(true) - Call id(1), args( Qubit(0), ) + Call id(2), args( Qubit(0), ) Variable(0, Integer) = Store Integer(5) Variable(1, Boolean) = Store Bool(true) Variable(0, Integer) = Store Integer(6) Variable(1, Boolean) = Store Bool(false) - Call id(2), args( Integer(0), EmptyTag, ) + Call id(3), args( Integer(0), EmptyTag, ) Return"#]], ); } @@ -200,14 +203,15 @@ fn boolean_assign_and_update_with_classical_value_within_an_if_with_dynamic_cond &expect![[r#" Blocks: Block 0:Block: + Call id(1), args( Pointer, ) Variable(0, Boolean) = Store Bool(true) - Call id(1), args( Qubit(0), Result(0), ) - Variable(1, Boolean) = Call id(2), args( Result(0), ) + Call id(2), args( Qubit(0), Result(0), ) + Variable(1, Boolean) = Call id(3), args( Result(0), ) Variable(2, Boolean) = Store Variable(1, Boolean) Branch Variable(2, Boolean), 2, 1 Block 1:Block: Variable(3, Boolean) = Store Variable(0, Boolean) - Call id(3), args( Variable(3, Boolean), Tag(0, 3), ) + Call id(4), args( Variable(3, Boolean), Tag(0, 3), ) Return Block 2:Block: Variable(0, Boolean) = Store Bool(false) @@ -237,14 +241,15 @@ fn integer_assign_and_update_with_classical_value_within_an_if_with_dynamic_cond &expect![[r#" Blocks: Block 0:Block: + Call id(1), args( Pointer, ) Variable(0, Integer) = Store Integer(1) - Call id(1), args( Qubit(0), Result(0), ) - Variable(1, Boolean) = Call id(2), args( Result(0), ) + Call id(2), args( Qubit(0), Result(0), ) + Variable(1, Boolean) = Call id(3), args( Result(0), ) Variable(2, Boolean) = Store Variable(1, Boolean) Branch Variable(2, Boolean), 2, 1 Block 1:Block: Variable(3, Integer) = Store Variable(0, Integer) - Call id(3), args( Variable(3, Integer), Tag(0, 3), ) + Call id(4), args( Variable(3, Integer), Tag(0, 3), ) Return Block 2:Block: Variable(0, Integer) = Store Integer(5) @@ -277,11 +282,10 @@ fn integer_assign_with_hybrid_value_within_an_if_with_dynamic_condition() { measurement_callable_id, &expect![[r#" Callable: - name: __quantum__qis__mresetz__body - call_type: Measurement + name: __quantum__rt__initialize + call_type: Regular input_type: - [0]: Qubit - [1]: Result + [0]: Pointer output_type: body: "#]], ); @@ -291,11 +295,12 @@ fn integer_assign_with_hybrid_value_within_an_if_with_dynamic_condition() { readout_callable_id, &expect![[r#" Callable: - name: __quantum__rt__read_result - call_type: Readout + name: __quantum__qis__mresetz__body + call_type: Measurement input_type: - [0]: Result - output_type: Boolean + [0]: Qubit + [1]: Result + output_type: body: "#]], ); let output_record_id = CallableId(3); @@ -304,12 +309,11 @@ fn integer_assign_with_hybrid_value_within_an_if_with_dynamic_condition() { output_record_id, &expect![[r#" Callable: - name: __quantum__rt__int_record_output - call_type: OutputRecording + name: __quantum__rt__read_result + call_type: Readout input_type: - [0]: Integer - [1]: Pointer - output_type: + [0]: Result + output_type: Boolean body: "#]], ); assert_blocks( @@ -317,16 +321,17 @@ fn integer_assign_with_hybrid_value_within_an_if_with_dynamic_condition() { &expect![[r#" Blocks: Block 0:Block: + Call id(1), args( Pointer, ) Variable(0, Integer) = Store Integer(0) Variable(1, Integer) = Store Integer(0) - Call id(1), args( Qubit(0), Result(0), ) - Variable(2, Boolean) = Call id(2), args( Result(0), ) + Call id(2), args( Qubit(0), Result(0), ) + Variable(2, Boolean) = Call id(3), args( Result(0), ) Variable(3, Boolean) = Store Variable(2, Boolean) Branch Variable(3, Boolean), 2, 1 Block 1:Block: Variable(1, Integer) = Store Integer(1) - Call id(1), args( Qubit(0), Result(1), ) - Variable(4, Boolean) = Call id(2), args( Result(1), ) + Call id(2), args( Qubit(0), Result(1), ) + Variable(4, Boolean) = Call id(3), args( Result(1), ) Variable(5, Boolean) = Store Variable(4, Boolean) Branch Variable(5, Boolean), 4, 3 Block 2:Block: @@ -335,7 +340,7 @@ fn integer_assign_with_hybrid_value_within_an_if_with_dynamic_condition() { Block 3:Block: Variable(1, Integer) = Store Integer(2) Variable(7, Integer) = Store Variable(0, Integer) - Call id(3), args( Variable(7, Integer), Tag(0, 3), ) + Call id(4), args( Variable(7, Integer), Tag(0, 3), ) Return Block 4:Block: Variable(6, Integer) = BitwiseOr Variable(0, Integer), Integer(2) @@ -376,7 +381,7 @@ fn large_loop_with_inner_if_completes_eval_and_transform() { Block: Variable(1, Integer) = Store Integer(100) Variable(400, Integer) = Store Variable(0, Integer) - Call id(3), args( Variable(400, Integer), Tag(0, 3), ) + Call id(4), args( Variable(400, Integer), Tag(0, 3), ) Return"#]], ); } @@ -407,14 +412,13 @@ fn if_else_expression_with_dynamic_logical_and_condition() { &program, mresetz_callable_id, &expect![[r#" - Callable: - name: __quantum__qis__mresetz__body - call_type: Measurement - input_type: - [0]: Qubit - [1]: Result - output_type: - body: "#]], + Callable: + name: __quantum__rt__initialize + call_type: Regular + input_type: + [0]: Pointer + output_type: + body: "#]], ); let read_result_callable_id = CallableId(2); assert_callable( @@ -422,11 +426,12 @@ fn if_else_expression_with_dynamic_logical_and_condition() { read_result_callable_id, &expect![[r#" Callable: - name: __quantum__rt__read_result - call_type: Readout + name: __quantum__qis__mresetz__body + call_type: Measurement input_type: - [0]: Result - output_type: Boolean + [0]: Qubit + [1]: Result + output_type: body: "#]], ); let op_a_callable_id = CallableId(3); @@ -434,26 +439,26 @@ fn if_else_expression_with_dynamic_logical_and_condition() { &program, op_a_callable_id, &expect![[r#" - Callable: - name: opA - call_type: Regular - input_type: - [0]: Qubit - output_type: - body: "#]], + Callable: + name: __quantum__rt__read_result + call_type: Readout + input_type: + [0]: Result + output_type: Boolean + body: "#]], ); let op_b_callable_id = CallableId(4); assert_callable( &program, op_b_callable_id, &expect![[r#" - Callable: - name: opB - call_type: Regular - input_type: - [0]: Qubit - output_type: - body: "#]], + Callable: + name: opA + call_type: Regular + input_type: + [0]: Qubit + output_type: + body: "#]], ); assert_blocks( @@ -461,27 +466,28 @@ fn if_else_expression_with_dynamic_logical_and_condition() { &expect![[r#" Blocks: Block 0:Block: - Call id(1), args( Qubit(0), Result(0), ) - Variable(0, Boolean) = Call id(2), args( Result(0), ) + Call id(1), args( Pointer, ) + Call id(2), args( Qubit(0), Result(0), ) + Variable(0, Boolean) = Call id(3), args( Result(0), ) Variable(1, Boolean) = Store Variable(0, Boolean) Variable(2, Boolean) = Store Bool(false) Branch Variable(1, Boolean), 2, 1 Block 1:Block: Branch Variable(2, Boolean), 4, 5 Block 2:Block: - Call id(1), args( Qubit(1), Result(1), ) - Variable(3, Boolean) = Call id(2), args( Result(1), ) + Call id(2), args( Qubit(1), Result(1), ) + Variable(3, Boolean) = Call id(3), args( Result(1), ) Variable(4, Boolean) = Store Variable(3, Boolean) Variable(2, Boolean) = Store Variable(4, Boolean) Jump(1) Block 3:Block: - Call id(5), args( Integer(0), EmptyTag, ) + Call id(6), args( Integer(0), EmptyTag, ) Return Block 4:Block: - Call id(3), args( Qubit(2), ) + Call id(4), args( Qubit(2), ) Jump(3) Block 5:Block: - Call id(4), args( Qubit(2), ) + Call id(5), args( Qubit(2), ) Jump(3)"#]], ); } @@ -512,14 +518,13 @@ fn if_else_expression_with_dynamic_logical_or_condition() { &program, mresetz_callable_id, &expect![[r#" - Callable: - name: __quantum__qis__mresetz__body - call_type: Measurement - input_type: - [0]: Qubit - [1]: Result - output_type: - body: "#]], + Callable: + name: __quantum__rt__initialize + call_type: Regular + input_type: + [0]: Pointer + output_type: + body: "#]], ); let read_result_callable_id = CallableId(2); assert_callable( @@ -527,11 +532,12 @@ fn if_else_expression_with_dynamic_logical_or_condition() { read_result_callable_id, &expect![[r#" Callable: - name: __quantum__rt__read_result - call_type: Readout + name: __quantum__qis__mresetz__body + call_type: Measurement input_type: - [0]: Result - output_type: Boolean + [0]: Qubit + [1]: Result + output_type: body: "#]], ); let op_a_callable_id = CallableId(3); @@ -539,26 +545,26 @@ fn if_else_expression_with_dynamic_logical_or_condition() { &program, op_a_callable_id, &expect![[r#" - Callable: - name: opA - call_type: Regular - input_type: - [0]: Qubit - output_type: - body: "#]], + Callable: + name: __quantum__rt__read_result + call_type: Readout + input_type: + [0]: Result + output_type: Boolean + body: "#]], ); let op_b_callable_id = CallableId(4); assert_callable( &program, op_b_callable_id, &expect![[r#" - Callable: - name: opB - call_type: Regular - input_type: - [0]: Qubit - output_type: - body: "#]], + Callable: + name: opA + call_type: Regular + input_type: + [0]: Qubit + output_type: + body: "#]], ); assert_blocks( @@ -566,27 +572,28 @@ fn if_else_expression_with_dynamic_logical_or_condition() { &expect![[r#" Blocks: Block 0:Block: - Call id(1), args( Qubit(0), Result(0), ) - Variable(0, Boolean) = Call id(2), args( Result(0), ) + Call id(1), args( Pointer, ) + Call id(2), args( Qubit(0), Result(0), ) + Variable(0, Boolean) = Call id(3), args( Result(0), ) Variable(1, Boolean) = Store Variable(0, Boolean) Variable(2, Boolean) = Store Bool(true) Branch Variable(1, Boolean), 1, 2 Block 1:Block: Branch Variable(2, Boolean), 4, 5 Block 2:Block: - Call id(1), args( Qubit(1), Result(1), ) - Variable(3, Boolean) = Call id(2), args( Result(1), ) + Call id(2), args( Qubit(1), Result(1), ) + Variable(3, Boolean) = Call id(3), args( Result(1), ) Variable(4, Boolean) = Store Variable(3, Boolean) Variable(2, Boolean) = Store Variable(4, Boolean) Jump(1) Block 3:Block: - Call id(5), args( Integer(0), EmptyTag, ) + Call id(6), args( Integer(0), EmptyTag, ) Return Block 4:Block: - Call id(3), args( Qubit(2), ) + Call id(4), args( Qubit(2), ) Jump(3) Block 5:Block: - Call id(4), args( Qubit(2), ) + Call id(5), args( Qubit(2), ) Jump(3)"#]], ); } diff --git a/source/compiler/qsc_partial_eval/src/tests/operators.rs b/source/compiler/qsc_partial_eval/src/tests/operators.rs index 48103c0097..5e733ebb5b 100644 --- a/source/compiler/qsc_partial_eval/src/tests/operators.rs +++ b/source/compiler/qsc_partial_eval/src/tests/operators.rs @@ -26,14 +26,13 @@ fn leading_positive_unary_operator_on_integer_does_not_generate_rir_instruction( &program, mresetz_callable_id, &expect![[r#" - Callable: - name: __quantum__qis__mresetz__body - call_type: Measurement - input_type: - [0]: Qubit - [1]: Result - output_type: - body: "#]], + Callable: + name: __quantum__rt__initialize + call_type: Regular + input_type: + [0]: Pointer + output_type: + body: "#]], ); let readout_callable_id = CallableId(2); assert_callable( @@ -41,11 +40,12 @@ fn leading_positive_unary_operator_on_integer_does_not_generate_rir_instruction( readout_callable_id, &expect![[r#" Callable: - name: __quantum__rt__read_result - call_type: Readout + name: __quantum__qis__mresetz__body + call_type: Measurement input_type: - [0]: Result - output_type: Boolean + [0]: Qubit + [1]: Result + output_type: body: "#]], ); let output_recording_callable_id = CallableId(3); @@ -54,12 +54,11 @@ fn leading_positive_unary_operator_on_integer_does_not_generate_rir_instruction( output_recording_callable_id, &expect![[r#" Callable: - name: __quantum__rt__int_record_output - call_type: OutputRecording + name: __quantum__rt__read_result + call_type: Readout input_type: - [0]: Integer - [1]: Pointer - output_type: + [0]: Result + output_type: Boolean body: "#]], ); assert_blocks( @@ -67,14 +66,15 @@ fn leading_positive_unary_operator_on_integer_does_not_generate_rir_instruction( &expect![[r#" Blocks: Block 0:Block: - Call id(1), args( Qubit(0), Result(0), ) - Variable(0, Boolean) = Call id(2), args( Result(0), ) + Call id(1), args( Pointer, ) + Call id(2), args( Qubit(0), Result(0), ) + Variable(0, Boolean) = Call id(3), args( Result(0), ) Variable(1, Boolean) = Icmp Eq, Variable(0, Boolean), Bool(false) Branch Variable(1, Boolean), 2, 3 Block 1:Block: Variable(3, Integer) = Store Variable(2, Integer) Variable(4, Integer) = Store Variable(3, Integer) - Call id(3), args( Variable(4, Integer), Tag(0, 3), ) + Call id(4), args( Variable(4, Integer), Tag(0, 3), ) Return Block 2:Block: Variable(2, Integer) = Store Integer(0) @@ -102,14 +102,13 @@ fn leading_negative_unary_operator_on_integer_generates_rir_instruction() { &program, mresetz_callable_id, &expect![[r#" - Callable: - name: __quantum__qis__mresetz__body - call_type: Measurement - input_type: - [0]: Qubit - [1]: Result - output_type: - body: "#]], + Callable: + name: __quantum__rt__initialize + call_type: Regular + input_type: + [0]: Pointer + output_type: + body: "#]], ); let readout_callable_id = CallableId(2); assert_callable( @@ -117,11 +116,12 @@ fn leading_negative_unary_operator_on_integer_generates_rir_instruction() { readout_callable_id, &expect![[r#" Callable: - name: __quantum__rt__read_result - call_type: Readout + name: __quantum__qis__mresetz__body + call_type: Measurement input_type: - [0]: Result - output_type: Boolean + [0]: Qubit + [1]: Result + output_type: body: "#]], ); let output_recording_callable_id = CallableId(3); @@ -130,12 +130,11 @@ fn leading_negative_unary_operator_on_integer_generates_rir_instruction() { output_recording_callable_id, &expect![[r#" Callable: - name: __quantum__rt__int_record_output - call_type: OutputRecording + name: __quantum__rt__read_result + call_type: Readout input_type: - [0]: Integer - [1]: Pointer - output_type: + [0]: Result + output_type: Boolean body: "#]], ); assert_blocks( @@ -143,15 +142,16 @@ fn leading_negative_unary_operator_on_integer_generates_rir_instruction() { &expect![[r#" Blocks: Block 0:Block: - Call id(1), args( Qubit(0), Result(0), ) - Variable(0, Boolean) = Call id(2), args( Result(0), ) + Call id(1), args( Pointer, ) + Call id(2), args( Qubit(0), Result(0), ) + Variable(0, Boolean) = Call id(3), args( Result(0), ) Variable(1, Boolean) = Icmp Eq, Variable(0, Boolean), Bool(false) Branch Variable(1, Boolean), 2, 3 Block 1:Block: Variable(3, Integer) = Store Variable(2, Integer) Variable(4, Integer) = Mul Integer(-1), Variable(3, Integer) Variable(5, Integer) = Store Variable(4, Integer) - Call id(3), args( Variable(5, Integer), Tag(0, 3), ) + Call id(4), args( Variable(5, Integer), Tag(0, 3), ) Return Block 2:Block: Variable(2, Integer) = Store Integer(0) @@ -179,14 +179,13 @@ fn bitwise_not_unary_operator_generates_rir_instruction() { &program, mresetz_callable_id, &expect![[r#" - Callable: - name: __quantum__qis__mresetz__body - call_type: Measurement - input_type: - [0]: Qubit - [1]: Result - output_type: - body: "#]], + Callable: + name: __quantum__rt__initialize + call_type: Regular + input_type: + [0]: Pointer + output_type: + body: "#]], ); let readout_callable_id = CallableId(2); assert_callable( @@ -194,11 +193,12 @@ fn bitwise_not_unary_operator_generates_rir_instruction() { readout_callable_id, &expect![[r#" Callable: - name: __quantum__rt__read_result - call_type: Readout + name: __quantum__qis__mresetz__body + call_type: Measurement input_type: - [0]: Result - output_type: Boolean + [0]: Qubit + [1]: Result + output_type: body: "#]], ); let output_recording_callable_id = CallableId(3); @@ -207,12 +207,11 @@ fn bitwise_not_unary_operator_generates_rir_instruction() { output_recording_callable_id, &expect![[r#" Callable: - name: __quantum__rt__int_record_output - call_type: OutputRecording + name: __quantum__rt__read_result + call_type: Readout input_type: - [0]: Integer - [1]: Pointer - output_type: + [0]: Result + output_type: Boolean body: "#]], ); assert_blocks( @@ -220,15 +219,16 @@ fn bitwise_not_unary_operator_generates_rir_instruction() { &expect![[r#" Blocks: Block 0:Block: - Call id(1), args( Qubit(0), Result(0), ) - Variable(0, Boolean) = Call id(2), args( Result(0), ) + Call id(1), args( Pointer, ) + Call id(2), args( Qubit(0), Result(0), ) + Variable(0, Boolean) = Call id(3), args( Result(0), ) Variable(1, Boolean) = Icmp Eq, Variable(0, Boolean), Bool(false) Branch Variable(1, Boolean), 2, 3 Block 1:Block: Variable(3, Integer) = Store Variable(2, Integer) Variable(4, Integer) = BitwiseNot Variable(3, Integer) Variable(5, Integer) = Store Variable(4, Integer) - Call id(3), args( Variable(5, Integer), Tag(0, 3), ) + Call id(4), args( Variable(5, Integer), Tag(0, 3), ) Return Block 2:Block: Variable(2, Integer) = Store Integer(0) @@ -256,14 +256,13 @@ fn logical_not_unary_operator_generates_logical_not_rir_instruction() { &program, mresetz_callable_id, &expect![[r#" - Callable: - name: __quantum__qis__mresetz__body - call_type: Measurement - input_type: - [0]: Qubit - [1]: Result - output_type: - body: "#]], + Callable: + name: __quantum__rt__initialize + call_type: Regular + input_type: + [0]: Pointer + output_type: + body: "#]], ); let readout_callable_id = CallableId(2); assert_callable( @@ -271,11 +270,12 @@ fn logical_not_unary_operator_generates_logical_not_rir_instruction() { readout_callable_id, &expect![[r#" Callable: - name: __quantum__rt__read_result - call_type: Readout + name: __quantum__qis__mresetz__body + call_type: Measurement input_type: - [0]: Result - output_type: Boolean + [0]: Qubit + [1]: Result + output_type: body: "#]], ); let output_recording_callable_id = CallableId(3); @@ -284,12 +284,11 @@ fn logical_not_unary_operator_generates_logical_not_rir_instruction() { output_recording_callable_id, &expect![[r#" Callable: - name: __quantum__rt__bool_record_output - call_type: OutputRecording + name: __quantum__rt__read_result + call_type: Readout input_type: - [0]: Boolean - [1]: Pointer - output_type: + [0]: Result + output_type: Boolean body: "#]], ); assert_block_instructions( @@ -297,13 +296,14 @@ fn logical_not_unary_operator_generates_logical_not_rir_instruction() { BlockId(0), &expect![[r#" Block: - Call id(1), args( Qubit(0), Result(0), ) - Variable(0, Boolean) = Call id(2), args( Result(0), ) + Call id(1), args( Pointer, ) + Call id(2), args( Qubit(0), Result(0), ) + Variable(0, Boolean) = Call id(3), args( Result(0), ) Variable(1, Boolean) = Icmp Eq, Variable(0, Boolean), Bool(false) Variable(2, Boolean) = Store Variable(1, Boolean) Variable(3, Boolean) = LogicalNot Variable(2, Boolean) Variable(4, Boolean) = Store Variable(3, Boolean) - Call id(3), args( Variable(4, Boolean), Tag(0, 3), ) + Call id(4), args( Variable(4, Boolean), Tag(0, 3), ) Return"#]], ); } @@ -329,11 +329,10 @@ fn comparing_measurement_results_for_equality_adds_read_result_and_comparison_in measurement_callable_id, &expect![[r#" Callable: - name: __quantum__qis__mresetz__body - call_type: Measurement + name: __quantum__rt__initialize + call_type: Regular input_type: - [0]: Qubit - [1]: Result + [0]: Pointer output_type: body: "#]], ); @@ -343,11 +342,12 @@ fn comparing_measurement_results_for_equality_adds_read_result_and_comparison_in readout_callable_id, &expect![[r#" Callable: - name: __quantum__rt__read_result - call_type: Readout + name: __quantum__qis__mresetz__body + call_type: Measurement input_type: - [0]: Result - output_type: Boolean + [0]: Qubit + [1]: Result + output_type: body: "#]], ); let bool_record_id = CallableId(3); @@ -355,27 +355,27 @@ fn comparing_measurement_results_for_equality_adds_read_result_and_comparison_in &program, bool_record_id, &expect![[r#" - Callable: - name: __quantum__rt__bool_record_output - call_type: OutputRecording - input_type: - [0]: Boolean - [1]: Pointer - output_type: - body: "#]], + Callable: + name: __quantum__rt__read_result + call_type: Readout + input_type: + [0]: Result + output_type: Boolean + body: "#]], ); assert_block_instructions( &program, BlockId(0), &expect![[r#" Block: - Call id(1), args( Qubit(0), Result(0), ) - Call id(1), args( Qubit(1), Result(1), ) - Variable(0, Boolean) = Call id(2), args( Result(0), ) - Variable(1, Boolean) = Call id(2), args( Result(1), ) + Call id(1), args( Pointer, ) + Call id(2), args( Qubit(0), Result(0), ) + Call id(2), args( Qubit(1), Result(1), ) + Variable(0, Boolean) = Call id(3), args( Result(0), ) + Variable(1, Boolean) = Call id(3), args( Result(1), ) Variable(2, Boolean) = Icmp Eq, Variable(0, Boolean), Variable(1, Boolean) Variable(3, Boolean) = Store Variable(2, Boolean) - Call id(3), args( Variable(3, Boolean), Tag(0, 3), ) + Call id(4), args( Variable(3, Boolean), Tag(0, 3), ) Return"#]], ); assert_eq!(program.num_qubits, 2); @@ -402,14 +402,13 @@ fn comparing_measurement_results_for_inequality_adds_read_result_and_comparison_ &program, measurement_callable_id, &expect![[r#" - Callable: - name: __quantum__qis__mresetz__body - call_type: Measurement - input_type: - [0]: Qubit - [1]: Result - output_type: - body: "#]], + Callable: + name: __quantum__rt__initialize + call_type: Regular + input_type: + [0]: Pointer + output_type: + body: "#]], ); let readout_callable_id = CallableId(2); assert_callable( @@ -417,11 +416,12 @@ fn comparing_measurement_results_for_inequality_adds_read_result_and_comparison_ readout_callable_id, &expect![[r#" Callable: - name: __quantum__rt__read_result - call_type: Readout + name: __quantum__qis__mresetz__body + call_type: Measurement input_type: - [0]: Result - output_type: Boolean + [0]: Qubit + [1]: Result + output_type: body: "#]], ); let bool_record_id = CallableId(3); @@ -429,27 +429,27 @@ fn comparing_measurement_results_for_inequality_adds_read_result_and_comparison_ &program, bool_record_id, &expect![[r#" - Callable: - name: __quantum__rt__bool_record_output - call_type: OutputRecording - input_type: - [0]: Boolean - [1]: Pointer - output_type: - body: "#]], + Callable: + name: __quantum__rt__read_result + call_type: Readout + input_type: + [0]: Result + output_type: Boolean + body: "#]], ); assert_block_instructions( &program, BlockId(0), &expect![[r#" Block: - Call id(1), args( Qubit(0), Result(0), ) - Call id(1), args( Qubit(1), Result(1), ) - Variable(0, Boolean) = Call id(2), args( Result(0), ) - Variable(1, Boolean) = Call id(2), args( Result(1), ) + Call id(1), args( Pointer, ) + Call id(2), args( Qubit(0), Result(0), ) + Call id(2), args( Qubit(1), Result(1), ) + Variable(0, Boolean) = Call id(3), args( Result(0), ) + Variable(1, Boolean) = Call id(3), args( Result(1), ) Variable(2, Boolean) = Icmp Ne, Variable(0, Boolean), Variable(1, Boolean) Variable(3, Boolean) = Store Variable(2, Boolean) - Call id(3), args( Variable(3, Boolean), Tag(0, 3), ) + Call id(4), args( Variable(3, Boolean), Tag(0, 3), ) Return"#]], ); assert_eq!(program.num_qubits, 2); @@ -476,14 +476,13 @@ fn comparing_measurement_result_against_result_literal_for_equality_adds_read_re &program, measurement_callable_id, &expect![[r#" - Callable: - name: __quantum__qis__mresetz__body - call_type: Measurement - input_type: - [0]: Qubit - [1]: Result - output_type: - body: "#]], + Callable: + name: __quantum__rt__initialize + call_type: Regular + input_type: + [0]: Pointer + output_type: + body: "#]], ); let readout_callable_id = CallableId(2); assert_callable( @@ -491,11 +490,12 @@ fn comparing_measurement_result_against_result_literal_for_equality_adds_read_re readout_callable_id, &expect![[r#" Callable: - name: __quantum__rt__read_result - call_type: Readout + name: __quantum__qis__mresetz__body + call_type: Measurement input_type: - [0]: Result - output_type: Boolean + [0]: Qubit + [1]: Result + output_type: body: "#]], ); let bool_record_id = CallableId(3); @@ -503,25 +503,25 @@ fn comparing_measurement_result_against_result_literal_for_equality_adds_read_re &program, bool_record_id, &expect![[r#" - Callable: - name: __quantum__rt__bool_record_output - call_type: OutputRecording - input_type: - [0]: Boolean - [1]: Pointer - output_type: - body: "#]], + Callable: + name: __quantum__rt__read_result + call_type: Readout + input_type: + [0]: Result + output_type: Boolean + body: "#]], ); assert_block_instructions( &program, BlockId(0), &expect![[r#" Block: - Call id(1), args( Qubit(0), Result(0), ) - Variable(0, Boolean) = Call id(2), args( Result(0), ) + Call id(1), args( Pointer, ) + Call id(2), args( Qubit(0), Result(0), ) + Variable(0, Boolean) = Call id(3), args( Result(0), ) Variable(1, Boolean) = Icmp Eq, Variable(0, Boolean), Bool(false) Variable(2, Boolean) = Store Variable(1, Boolean) - Call id(3), args( Variable(2, Boolean), Tag(0, 3), ) + Call id(4), args( Variable(2, Boolean), Tag(0, 3), ) Return"#]], ); assert_eq!(program.num_qubits, 1); @@ -548,14 +548,13 @@ fn comparing_measurement_result_against_result_literal_for_inequality_adds_read_ &program, measurement_callable_id, &expect![[r#" - Callable: - name: __quantum__qis__mresetz__body - call_type: Measurement - input_type: - [0]: Qubit - [1]: Result - output_type: - body: "#]], + Callable: + name: __quantum__rt__initialize + call_type: Regular + input_type: + [0]: Pointer + output_type: + body: "#]], ); let readout_callable_id = CallableId(2); assert_callable( @@ -563,11 +562,12 @@ fn comparing_measurement_result_against_result_literal_for_inequality_adds_read_ readout_callable_id, &expect![[r#" Callable: - name: __quantum__rt__read_result - call_type: Readout + name: __quantum__qis__mresetz__body + call_type: Measurement input_type: - [0]: Result - output_type: Boolean + [0]: Qubit + [1]: Result + output_type: body: "#]], ); let bool_record_id = CallableId(3); @@ -575,25 +575,25 @@ fn comparing_measurement_result_against_result_literal_for_inequality_adds_read_ &program, bool_record_id, &expect![[r#" - Callable: - name: __quantum__rt__bool_record_output - call_type: OutputRecording - input_type: - [0]: Boolean - [1]: Pointer - output_type: - body: "#]], + Callable: + name: __quantum__rt__read_result + call_type: Readout + input_type: + [0]: Result + output_type: Boolean + body: "#]], ); assert_block_instructions( &program, BlockId(0), &expect![[r#" Block: - Call id(1), args( Qubit(0), Result(0), ) - Variable(0, Boolean) = Call id(2), args( Result(0), ) + Call id(1), args( Pointer, ) + Call id(2), args( Qubit(0), Result(0), ) + Variable(0, Boolean) = Call id(3), args( Result(0), ) Variable(1, Boolean) = Icmp Ne, Variable(0, Boolean), Bool(true) Variable(2, Boolean) = Store Variable(1, Boolean) - Call id(3), args( Variable(2, Boolean), Tag(0, 3), ) + Call id(4), args( Variable(2, Boolean), Tag(0, 3), ) Return"#]], ); assert_eq!(program.num_qubits, 1); @@ -620,11 +620,10 @@ fn comparing_lhs_classical_boolean_against_rhs_dynamic_boolean_for_equality() { measurement_callable_id, &expect![[r#" Callable: - name: __quantum__qis__mresetz__body - call_type: Measurement + name: __quantum__rt__initialize + call_type: Regular input_type: - [0]: Qubit - [1]: Result + [0]: Pointer output_type: body: "#]], ); @@ -634,11 +633,12 @@ fn comparing_lhs_classical_boolean_against_rhs_dynamic_boolean_for_equality() { readout_callable_id, &expect![[r#" Callable: - name: __quantum__rt__read_result - call_type: Readout + name: __quantum__qis__mresetz__body + call_type: Measurement input_type: - [0]: Result - output_type: Boolean + [0]: Qubit + [1]: Result + output_type: body: "#]], ); let output_record_id = CallableId(3); @@ -646,27 +646,27 @@ fn comparing_lhs_classical_boolean_against_rhs_dynamic_boolean_for_equality() { &program, output_record_id, &expect![[r#" - Callable: - name: __quantum__rt__bool_record_output - call_type: OutputRecording - input_type: - [0]: Boolean - [1]: Pointer - output_type: - body: "#]], + Callable: + name: __quantum__rt__read_result + call_type: Readout + input_type: + [0]: Result + output_type: Boolean + body: "#]], ); assert_block_instructions( &program, BlockId(0), &expect![[r#" Block: - Call id(1), args( Qubit(0), Result(0), ) - Variable(0, Boolean) = Call id(2), args( Result(0), ) + Call id(1), args( Pointer, ) + Call id(2), args( Qubit(0), Result(0), ) + Variable(0, Boolean) = Call id(3), args( Result(0), ) Variable(1, Boolean) = Store Variable(0, Boolean) Variable(2, Boolean) = Store Variable(1, Boolean) Variable(3, Boolean) = Icmp Eq, Bool(false), Variable(2, Boolean) Variable(4, Boolean) = Store Variable(3, Boolean) - Call id(3), args( Variable(4, Boolean), Tag(0, 3), ) + Call id(4), args( Variable(4, Boolean), Tag(0, 3), ) Return"#]], ); } @@ -690,11 +690,10 @@ fn comparing_lhs_dynamic_boolean_against_rhs_dynamic_boolean_for_equality() { measurement_callable_id, &expect![[r#" Callable: - name: __quantum__qis__mresetz__body - call_type: Measurement + name: __quantum__rt__initialize + call_type: Regular input_type: - [0]: Qubit - [1]: Result + [0]: Pointer output_type: body: "#]], ); @@ -704,11 +703,12 @@ fn comparing_lhs_dynamic_boolean_against_rhs_dynamic_boolean_for_equality() { readout_callable_id, &expect![[r#" Callable: - name: __quantum__rt__read_result - call_type: Readout + name: __quantum__qis__mresetz__body + call_type: Measurement input_type: - [0]: Result - output_type: Boolean + [0]: Qubit + [1]: Result + output_type: body: "#]], ); let output_record_id = CallableId(3); @@ -716,29 +716,29 @@ fn comparing_lhs_dynamic_boolean_against_rhs_dynamic_boolean_for_equality() { &program, output_record_id, &expect![[r#" - Callable: - name: __quantum__rt__bool_record_output - call_type: OutputRecording - input_type: - [0]: Boolean - [1]: Pointer - output_type: - body: "#]], + Callable: + name: __quantum__rt__read_result + call_type: Readout + input_type: + [0]: Result + output_type: Boolean + body: "#]], ); assert_block_instructions( &program, BlockId(0), &expect![[r#" Block: - Call id(1), args( Qubit(0), Result(0), ) - Variable(0, Boolean) = Call id(2), args( Result(0), ) + Call id(1), args( Pointer, ) + Call id(2), args( Qubit(0), Result(0), ) + Variable(0, Boolean) = Call id(3), args( Result(0), ) Variable(1, Boolean) = Icmp Eq, Variable(0, Boolean), Bool(false) - Call id(1), args( Qubit(0), Result(1), ) - Variable(2, Boolean) = Call id(2), args( Result(1), ) + Call id(2), args( Qubit(0), Result(1), ) + Variable(2, Boolean) = Call id(3), args( Result(1), ) Variable(3, Boolean) = Icmp Eq, Variable(2, Boolean), Bool(false) Variable(4, Boolean) = Icmp Eq, Variable(1, Boolean), Variable(3, Boolean) Variable(5, Boolean) = Store Variable(4, Boolean) - Call id(3), args( Variable(5, Boolean), Tag(0, 3), ) + Call id(4), args( Variable(5, Boolean), Tag(0, 3), ) Return"#]], ); } @@ -763,11 +763,10 @@ fn comparing_lhs_classical_boolean_against_rhs_dynamic_boolean_for_inequality() measurement_callable_id, &expect![[r#" Callable: - name: __quantum__qis__mresetz__body - call_type: Measurement + name: __quantum__rt__initialize + call_type: Regular input_type: - [0]: Qubit - [1]: Result + [0]: Pointer output_type: body: "#]], ); @@ -777,11 +776,12 @@ fn comparing_lhs_classical_boolean_against_rhs_dynamic_boolean_for_inequality() readout_callable_id, &expect![[r#" Callable: - name: __quantum__rt__read_result - call_type: Readout + name: __quantum__qis__mresetz__body + call_type: Measurement input_type: - [0]: Result - output_type: Boolean + [0]: Qubit + [1]: Result + output_type: body: "#]], ); let output_record_id = CallableId(3); @@ -789,27 +789,27 @@ fn comparing_lhs_classical_boolean_against_rhs_dynamic_boolean_for_inequality() &program, output_record_id, &expect![[r#" - Callable: - name: __quantum__rt__bool_record_output - call_type: OutputRecording - input_type: - [0]: Boolean - [1]: Pointer - output_type: - body: "#]], + Callable: + name: __quantum__rt__read_result + call_type: Readout + input_type: + [0]: Result + output_type: Boolean + body: "#]], ); assert_block_instructions( &program, BlockId(0), &expect![[r#" Block: - Call id(1), args( Qubit(0), Result(0), ) - Variable(0, Boolean) = Call id(2), args( Result(0), ) + Call id(1), args( Pointer, ) + Call id(2), args( Qubit(0), Result(0), ) + Variable(0, Boolean) = Call id(3), args( Result(0), ) Variable(1, Boolean) = Store Variable(0, Boolean) Variable(2, Boolean) = Store Variable(1, Boolean) Variable(3, Boolean) = Icmp Ne, Bool(true), Variable(2, Boolean) Variable(4, Boolean) = Store Variable(3, Boolean) - Call id(3), args( Variable(4, Boolean), Tag(0, 3), ) + Call id(4), args( Variable(4, Boolean), Tag(0, 3), ) Return"#]], ); } @@ -833,11 +833,10 @@ fn comparing_lhs_dynamic_boolean_against_rhs_dynamic_boolean_for_inequality() { measurement_callable_id, &expect![[r#" Callable: - name: __quantum__qis__mresetz__body - call_type: Measurement + name: __quantum__rt__initialize + call_type: Regular input_type: - [0]: Qubit - [1]: Result + [0]: Pointer output_type: body: "#]], ); @@ -847,11 +846,12 @@ fn comparing_lhs_dynamic_boolean_against_rhs_dynamic_boolean_for_inequality() { readout_callable_id, &expect![[r#" Callable: - name: __quantum__rt__read_result - call_type: Readout + name: __quantum__qis__mresetz__body + call_type: Measurement input_type: - [0]: Result - output_type: Boolean + [0]: Qubit + [1]: Result + output_type: body: "#]], ); let output_record_id = CallableId(3); @@ -859,29 +859,29 @@ fn comparing_lhs_dynamic_boolean_against_rhs_dynamic_boolean_for_inequality() { &program, output_record_id, &expect![[r#" - Callable: - name: __quantum__rt__bool_record_output - call_type: OutputRecording - input_type: - [0]: Boolean - [1]: Pointer - output_type: - body: "#]], + Callable: + name: __quantum__rt__read_result + call_type: Readout + input_type: + [0]: Result + output_type: Boolean + body: "#]], ); assert_block_instructions( &program, BlockId(0), &expect![[r#" Block: - Call id(1), args( Qubit(0), Result(0), ) - Variable(0, Boolean) = Call id(2), args( Result(0), ) + Call id(1), args( Pointer, ) + Call id(2), args( Qubit(0), Result(0), ) + Variable(0, Boolean) = Call id(3), args( Result(0), ) Variable(1, Boolean) = Icmp Eq, Variable(0, Boolean), Bool(false) - Call id(1), args( Qubit(0), Result(1), ) - Variable(2, Boolean) = Call id(2), args( Result(1), ) + Call id(2), args( Qubit(0), Result(1), ) + Variable(2, Boolean) = Call id(3), args( Result(1), ) Variable(3, Boolean) = Icmp Eq, Variable(2, Boolean), Bool(false) Variable(4, Boolean) = Icmp Ne, Variable(1, Boolean), Variable(3, Boolean) Variable(5, Boolean) = Store Variable(4, Boolean) - Call id(3), args( Variable(5, Boolean), Tag(0, 3), ) + Call id(4), args( Variable(5, Boolean), Tag(0, 3), ) Return"#]], ); } @@ -906,11 +906,10 @@ fn logical_and_with_lhs_classical_true_is_optimized_as_store() { measurement_callable_id, &expect![[r#" Callable: - name: __quantum__qis__mresetz__body - call_type: Measurement + name: __quantum__rt__initialize + call_type: Regular input_type: - [0]: Qubit - [1]: Result + [0]: Pointer output_type: body: "#]], ); @@ -920,11 +919,12 @@ fn logical_and_with_lhs_classical_true_is_optimized_as_store() { readout_callable_id, &expect![[r#" Callable: - name: __quantum__rt__read_result - call_type: Readout + name: __quantum__qis__mresetz__body + call_type: Measurement input_type: - [0]: Result - output_type: Boolean + [0]: Qubit + [1]: Result + output_type: body: "#]], ); let output_record_id = CallableId(3); @@ -932,26 +932,26 @@ fn logical_and_with_lhs_classical_true_is_optimized_as_store() { &program, output_record_id, &expect![[r#" - Callable: - name: __quantum__rt__bool_record_output - call_type: OutputRecording - input_type: - [0]: Boolean - [1]: Pointer - output_type: - body: "#]], + Callable: + name: __quantum__rt__read_result + call_type: Readout + input_type: + [0]: Result + output_type: Boolean + body: "#]], ); assert_block_instructions( &program, BlockId(0), &expect![[r#" Block: - Call id(1), args( Qubit(0), Result(0), ) - Variable(0, Boolean) = Call id(2), args( Result(0), ) + Call id(1), args( Pointer, ) + Call id(2), args( Qubit(0), Result(0), ) + Variable(0, Boolean) = Call id(3), args( Result(0), ) Variable(1, Boolean) = Store Variable(0, Boolean) Variable(2, Boolean) = Store Variable(1, Boolean) Variable(3, Boolean) = Store Variable(2, Boolean) - Call id(3), args( Variable(3, Boolean), Tag(0, 3), ) + Call id(4), args( Variable(3, Boolean), Tag(0, 3), ) Return"#]], ); } @@ -976,11 +976,10 @@ fn logical_and_with_lhs_classical_false_short_circuits_evaluation() { measurement_callable_id, &expect![[r#" Callable: - name: __quantum__qis__mresetz__body - call_type: Measurement + name: __quantum__rt__initialize + call_type: Regular input_type: - [0]: Qubit - [1]: Result + [0]: Pointer output_type: body: "#]], ); @@ -990,11 +989,12 @@ fn logical_and_with_lhs_classical_false_short_circuits_evaluation() { readout_callable_id, &expect![[r#" Callable: - name: __quantum__rt__read_result - call_type: Readout + name: __quantum__qis__mresetz__body + call_type: Measurement input_type: - [0]: Result - output_type: Boolean + [0]: Qubit + [1]: Result + output_type: body: "#]], ); let output_record_id = CallableId(3); @@ -1002,25 +1002,25 @@ fn logical_and_with_lhs_classical_false_short_circuits_evaluation() { &program, output_record_id, &expect![[r#" - Callable: - name: __quantum__rt__bool_record_output - call_type: OutputRecording - input_type: - [0]: Boolean - [1]: Pointer - output_type: - body: "#]], + Callable: + name: __quantum__rt__read_result + call_type: Readout + input_type: + [0]: Result + output_type: Boolean + body: "#]], ); assert_block_instructions( &program, BlockId(0), &expect![[r#" Block: - Call id(1), args( Qubit(0), Result(0), ) - Variable(0, Boolean) = Call id(2), args( Result(0), ) + Call id(1), args( Pointer, ) + Call id(2), args( Qubit(0), Result(0), ) + Variable(0, Boolean) = Call id(3), args( Result(0), ) Variable(1, Boolean) = Store Variable(0, Boolean) Variable(2, Boolean) = Store Variable(1, Boolean) - Call id(3), args( Bool(false), Tag(0, 3), ) + Call id(4), args( Bool(false), Tag(0, 3), ) Return"#]], ); } @@ -1044,11 +1044,10 @@ fn logical_and_with_dynamic_lhs_and_dynamic_rhs_short_circuits_when_lhs_is_false measurement_callable_id, &expect![[r#" Callable: - name: __quantum__qis__mresetz__body - call_type: Measurement + name: __quantum__rt__initialize + call_type: Regular input_type: - [0]: Qubit - [1]: Result + [0]: Pointer output_type: body: "#]], ); @@ -1058,11 +1057,12 @@ fn logical_and_with_dynamic_lhs_and_dynamic_rhs_short_circuits_when_lhs_is_false readout_callable_id, &expect![[r#" Callable: - name: __quantum__rt__read_result - call_type: Readout + name: __quantum__qis__mresetz__body + call_type: Measurement input_type: - [0]: Result - output_type: Boolean + [0]: Qubit + [1]: Result + output_type: body: "#]], ); let output_record_id = CallableId(3); @@ -1070,32 +1070,32 @@ fn logical_and_with_dynamic_lhs_and_dynamic_rhs_short_circuits_when_lhs_is_false &program, output_record_id, &expect![[r#" - Callable: - name: __quantum__rt__bool_record_output - call_type: OutputRecording - input_type: - [0]: Boolean - [1]: Pointer - output_type: - body: "#]], + Callable: + name: __quantum__rt__read_result + call_type: Readout + input_type: + [0]: Result + output_type: Boolean + body: "#]], ); assert_blocks( &program, &expect![[r#" Blocks: Block 0:Block: - Call id(1), args( Qubit(0), Result(0), ) - Variable(0, Boolean) = Call id(2), args( Result(0), ) + Call id(1), args( Pointer, ) + Call id(2), args( Qubit(0), Result(0), ) + Variable(0, Boolean) = Call id(3), args( Result(0), ) Variable(1, Boolean) = Icmp Eq, Variable(0, Boolean), Bool(false) Variable(2, Boolean) = Store Bool(false) Branch Variable(1, Boolean), 2, 1 Block 1:Block: Variable(5, Boolean) = Store Variable(2, Boolean) - Call id(3), args( Variable(5, Boolean), Tag(0, 3), ) + Call id(4), args( Variable(5, Boolean), Tag(0, 3), ) Return Block 2:Block: - Call id(1), args( Qubit(0), Result(1), ) - Variable(3, Boolean) = Call id(2), args( Result(1), ) + Call id(2), args( Qubit(0), Result(1), ) + Variable(3, Boolean) = Call id(3), args( Result(1), ) Variable(4, Boolean) = Icmp Eq, Variable(3, Boolean), Bool(false) Variable(2, Boolean) = Store Variable(4, Boolean) Jump(1)"#]], @@ -1122,11 +1122,10 @@ fn logical_or_with_lhs_classical_true_short_circuits_evaluation() { measurement_callable_id, &expect![[r#" Callable: - name: __quantum__qis__mresetz__body - call_type: Measurement + name: __quantum__rt__initialize + call_type: Regular input_type: - [0]: Qubit - [1]: Result + [0]: Pointer output_type: body: "#]], ); @@ -1136,11 +1135,12 @@ fn logical_or_with_lhs_classical_true_short_circuits_evaluation() { readout_callable_id, &expect![[r#" Callable: - name: __quantum__rt__read_result - call_type: Readout + name: __quantum__qis__mresetz__body + call_type: Measurement input_type: - [0]: Result - output_type: Boolean + [0]: Qubit + [1]: Result + output_type: body: "#]], ); let output_record_id = CallableId(3); @@ -1148,25 +1148,25 @@ fn logical_or_with_lhs_classical_true_short_circuits_evaluation() { &program, output_record_id, &expect![[r#" - Callable: - name: __quantum__rt__bool_record_output - call_type: OutputRecording - input_type: - [0]: Boolean - [1]: Pointer - output_type: - body: "#]], + Callable: + name: __quantum__rt__read_result + call_type: Readout + input_type: + [0]: Result + output_type: Boolean + body: "#]], ); assert_block_instructions( &program, BlockId(0), &expect![[r#" Block: - Call id(1), args( Qubit(0), Result(0), ) - Variable(0, Boolean) = Call id(2), args( Result(0), ) + Call id(1), args( Pointer, ) + Call id(2), args( Qubit(0), Result(0), ) + Variable(0, Boolean) = Call id(3), args( Result(0), ) Variable(1, Boolean) = Store Variable(0, Boolean) Variable(2, Boolean) = Store Variable(1, Boolean) - Call id(3), args( Bool(true), Tag(0, 3), ) + Call id(4), args( Bool(true), Tag(0, 3), ) Return"#]], ); } @@ -1191,11 +1191,10 @@ fn logical_or_with_lhs_classical_false_is_optimized_as_store() { measurement_callable_id, &expect![[r#" Callable: - name: __quantum__qis__mresetz__body - call_type: Measurement + name: __quantum__rt__initialize + call_type: Regular input_type: - [0]: Qubit - [1]: Result + [0]: Pointer output_type: body: "#]], ); @@ -1205,11 +1204,12 @@ fn logical_or_with_lhs_classical_false_is_optimized_as_store() { readout_callable_id, &expect![[r#" Callable: - name: __quantum__rt__read_result - call_type: Readout + name: __quantum__qis__mresetz__body + call_type: Measurement input_type: - [0]: Result - output_type: Boolean + [0]: Qubit + [1]: Result + output_type: body: "#]], ); let output_record_id = CallableId(3); @@ -1217,26 +1217,26 @@ fn logical_or_with_lhs_classical_false_is_optimized_as_store() { &program, output_record_id, &expect![[r#" - Callable: - name: __quantum__rt__bool_record_output - call_type: OutputRecording - input_type: - [0]: Boolean - [1]: Pointer - output_type: - body: "#]], + Callable: + name: __quantum__rt__read_result + call_type: Readout + input_type: + [0]: Result + output_type: Boolean + body: "#]], ); assert_block_instructions( &program, BlockId(0), &expect![[r#" Block: - Call id(1), args( Qubit(0), Result(0), ) - Variable(0, Boolean) = Call id(2), args( Result(0), ) + Call id(1), args( Pointer, ) + Call id(2), args( Qubit(0), Result(0), ) + Variable(0, Boolean) = Call id(3), args( Result(0), ) Variable(1, Boolean) = Store Variable(0, Boolean) Variable(2, Boolean) = Store Variable(1, Boolean) Variable(3, Boolean) = Store Variable(2, Boolean) - Call id(3), args( Variable(3, Boolean), Tag(0, 3), ) + Call id(4), args( Variable(3, Boolean), Tag(0, 3), ) Return"#]], ); } @@ -1260,11 +1260,10 @@ fn logical_or_with_dynamic_lhs_and_dynamic_rhs_short_circuits_when_rhs_is_true() measurement_callable_id, &expect![[r#" Callable: - name: __quantum__qis__mresetz__body - call_type: Measurement + name: __quantum__rt__initialize + call_type: Regular input_type: - [0]: Qubit - [1]: Result + [0]: Pointer output_type: body: "#]], ); @@ -1274,11 +1273,12 @@ fn logical_or_with_dynamic_lhs_and_dynamic_rhs_short_circuits_when_rhs_is_true() readout_callable_id, &expect![[r#" Callable: - name: __quantum__rt__read_result - call_type: Readout + name: __quantum__qis__mresetz__body + call_type: Measurement input_type: - [0]: Result - output_type: Boolean + [0]: Qubit + [1]: Result + output_type: body: "#]], ); let output_record_id = CallableId(3); @@ -1286,32 +1286,32 @@ fn logical_or_with_dynamic_lhs_and_dynamic_rhs_short_circuits_when_rhs_is_true() &program, output_record_id, &expect![[r#" - Callable: - name: __quantum__rt__bool_record_output - call_type: OutputRecording - input_type: - [0]: Boolean - [1]: Pointer - output_type: - body: "#]], + Callable: + name: __quantum__rt__read_result + call_type: Readout + input_type: + [0]: Result + output_type: Boolean + body: "#]], ); assert_blocks( &program, &expect![[r#" Blocks: Block 0:Block: - Call id(1), args( Qubit(0), Result(0), ) - Variable(0, Boolean) = Call id(2), args( Result(0), ) + Call id(1), args( Pointer, ) + Call id(2), args( Qubit(0), Result(0), ) + Variable(0, Boolean) = Call id(3), args( Result(0), ) Variable(1, Boolean) = Icmp Ne, Variable(0, Boolean), Bool(true) Variable(2, Boolean) = Store Bool(true) Branch Variable(1, Boolean), 1, 2 Block 1:Block: Variable(5, Boolean) = Store Variable(2, Boolean) - Call id(3), args( Variable(5, Boolean), Tag(0, 3), ) + Call id(4), args( Variable(5, Boolean), Tag(0, 3), ) Return Block 2:Block: - Call id(1), args( Qubit(0), Result(1), ) - Variable(3, Boolean) = Call id(2), args( Result(1), ) + Call id(2), args( Qubit(0), Result(1), ) + Variable(3, Boolean) = Call id(3), args( Result(1), ) Variable(4, Boolean) = Icmp Ne, Variable(3, Boolean), Bool(true) Variable(2, Boolean) = Store Variable(4, Boolean) Jump(1)"#]], @@ -1337,11 +1337,10 @@ fn logical_and_and_sequence_with_dynamic_operands() { measurement_callable_id, &expect![[r#" Callable: - name: __quantum__qis__mresetz__body - call_type: Measurement + name: __quantum__rt__initialize + call_type: Regular input_type: - [0]: Qubit - [1]: Result + [0]: Pointer output_type: body: "#]], ); @@ -1351,11 +1350,12 @@ fn logical_and_and_sequence_with_dynamic_operands() { readout_callable_id, &expect![[r#" Callable: - name: __quantum__rt__read_result - call_type: Readout + name: __quantum__qis__mresetz__body + call_type: Measurement input_type: - [0]: Result - output_type: Boolean + [0]: Qubit + [1]: Result + output_type: body: "#]], ); let output_record_id = CallableId(3); @@ -1363,22 +1363,22 @@ fn logical_and_and_sequence_with_dynamic_operands() { &program, output_record_id, &expect![[r#" - Callable: - name: __quantum__rt__bool_record_output - call_type: OutputRecording - input_type: - [0]: Boolean - [1]: Pointer - output_type: - body: "#]], + Callable: + name: __quantum__rt__read_result + call_type: Readout + input_type: + [0]: Result + output_type: Boolean + body: "#]], ); assert_blocks( &program, &expect![[r#" Blocks: Block 0:Block: - Call id(1), args( Qubit(0), Result(0), ) - Variable(0, Boolean) = Call id(2), args( Result(0), ) + Call id(1), args( Pointer, ) + Call id(2), args( Qubit(0), Result(0), ) + Variable(0, Boolean) = Call id(3), args( Result(0), ) Variable(1, Boolean) = Icmp Ne, Variable(0, Boolean), Bool(true) Variable(2, Boolean) = Store Bool(false) Branch Variable(1, Boolean), 2, 1 @@ -1386,18 +1386,18 @@ fn logical_and_and_sequence_with_dynamic_operands() { Variable(5, Boolean) = Store Bool(false) Branch Variable(2, Boolean), 4, 3 Block 2:Block: - Call id(1), args( Qubit(1), Result(1), ) - Variable(3, Boolean) = Call id(2), args( Result(1), ) + Call id(2), args( Qubit(1), Result(1), ) + Variable(3, Boolean) = Call id(3), args( Result(1), ) Variable(4, Boolean) = Icmp Ne, Variable(3, Boolean), Bool(true) Variable(2, Boolean) = Store Variable(4, Boolean) Jump(1) Block 3:Block: Variable(8, Boolean) = Store Variable(5, Boolean) - Call id(3), args( Variable(8, Boolean), Tag(0, 3), ) + Call id(4), args( Variable(8, Boolean), Tag(0, 3), ) Return Block 4:Block: - Call id(1), args( Qubit(2), Result(2), ) - Variable(6, Boolean) = Call id(2), args( Result(2), ) + Call id(2), args( Qubit(2), Result(2), ) + Variable(6, Boolean) = Call id(3), args( Result(2), ) Variable(7, Boolean) = Icmp Ne, Variable(6, Boolean), Bool(true) Variable(5, Boolean) = Store Variable(7, Boolean) Jump(3)"#]], @@ -1423,11 +1423,10 @@ fn logical_and_or_sequence_with_dynamic_operands() { measurement_callable_id, &expect![[r#" Callable: - name: __quantum__qis__mresetz__body - call_type: Measurement + name: __quantum__rt__initialize + call_type: Regular input_type: - [0]: Qubit - [1]: Result + [0]: Pointer output_type: body: "#]], ); @@ -1437,11 +1436,12 @@ fn logical_and_or_sequence_with_dynamic_operands() { readout_callable_id, &expect![[r#" Callable: - name: __quantum__rt__read_result - call_type: Readout + name: __quantum__qis__mresetz__body + call_type: Measurement input_type: - [0]: Result - output_type: Boolean + [0]: Qubit + [1]: Result + output_type: body: "#]], ); let output_record_id = CallableId(3); @@ -1449,22 +1449,22 @@ fn logical_and_or_sequence_with_dynamic_operands() { &program, output_record_id, &expect![[r#" - Callable: - name: __quantum__rt__bool_record_output - call_type: OutputRecording - input_type: - [0]: Boolean - [1]: Pointer - output_type: - body: "#]], + Callable: + name: __quantum__rt__read_result + call_type: Readout + input_type: + [0]: Result + output_type: Boolean + body: "#]], ); assert_blocks( &program, &expect![[r#" Blocks: Block 0:Block: - Call id(1), args( Qubit(0), Result(0), ) - Variable(0, Boolean) = Call id(2), args( Result(0), ) + Call id(1), args( Pointer, ) + Call id(2), args( Qubit(0), Result(0), ) + Variable(0, Boolean) = Call id(3), args( Result(0), ) Variable(1, Boolean) = Icmp Ne, Variable(0, Boolean), Bool(true) Variable(2, Boolean) = Store Bool(false) Branch Variable(1, Boolean), 2, 1 @@ -1472,18 +1472,18 @@ fn logical_and_or_sequence_with_dynamic_operands() { Variable(5, Boolean) = Store Bool(true) Branch Variable(2, Boolean), 3, 4 Block 2:Block: - Call id(1), args( Qubit(1), Result(1), ) - Variable(3, Boolean) = Call id(2), args( Result(1), ) + Call id(2), args( Qubit(1), Result(1), ) + Variable(3, Boolean) = Call id(3), args( Result(1), ) Variable(4, Boolean) = Icmp Ne, Variable(3, Boolean), Bool(true) Variable(2, Boolean) = Store Variable(4, Boolean) Jump(1) Block 3:Block: Variable(8, Boolean) = Store Variable(5, Boolean) - Call id(3), args( Variable(8, Boolean), Tag(0, 3), ) + Call id(4), args( Variable(8, Boolean), Tag(0, 3), ) Return Block 4:Block: - Call id(1), args( Qubit(2), Result(2), ) - Variable(6, Boolean) = Call id(2), args( Result(2), ) + Call id(2), args( Qubit(2), Result(2), ) + Variable(6, Boolean) = Call id(3), args( Result(2), ) Variable(7, Boolean) = Icmp Ne, Variable(6, Boolean), Bool(true) Variable(5, Boolean) = Store Variable(7, Boolean) Jump(3)"#]], @@ -1509,11 +1509,10 @@ fn logical_or_and_sequence_with_dynamic_operands() { measurement_callable_id, &expect![[r#" Callable: - name: __quantum__qis__mresetz__body - call_type: Measurement + name: __quantum__rt__initialize + call_type: Regular input_type: - [0]: Qubit - [1]: Result + [0]: Pointer output_type: body: "#]], ); @@ -1523,11 +1522,12 @@ fn logical_or_and_sequence_with_dynamic_operands() { readout_callable_id, &expect![[r#" Callable: - name: __quantum__rt__read_result - call_type: Readout + name: __quantum__qis__mresetz__body + call_type: Measurement input_type: - [0]: Result - output_type: Boolean + [0]: Qubit + [1]: Result + output_type: body: "#]], ); let output_record_id = CallableId(3); @@ -1535,32 +1535,32 @@ fn logical_or_and_sequence_with_dynamic_operands() { &program, output_record_id, &expect![[r#" - Callable: - name: __quantum__rt__bool_record_output - call_type: OutputRecording - input_type: - [0]: Boolean - [1]: Pointer - output_type: - body: "#]], + Callable: + name: __quantum__rt__read_result + call_type: Readout + input_type: + [0]: Result + output_type: Boolean + body: "#]], ); assert_blocks( &program, &expect![[r#" Blocks: Block 0:Block: - Call id(1), args( Qubit(0), Result(0), ) - Variable(0, Boolean) = Call id(2), args( Result(0), ) + Call id(1), args( Pointer, ) + Call id(2), args( Qubit(0), Result(0), ) + Variable(0, Boolean) = Call id(3), args( Result(0), ) Variable(1, Boolean) = Icmp Ne, Variable(0, Boolean), Bool(true) Variable(2, Boolean) = Store Bool(true) Branch Variable(1, Boolean), 1, 2 Block 1:Block: Variable(8, Boolean) = Store Variable(2, Boolean) - Call id(3), args( Variable(8, Boolean), Tag(0, 3), ) + Call id(4), args( Variable(8, Boolean), Tag(0, 3), ) Return Block 2:Block: - Call id(1), args( Qubit(1), Result(1), ) - Variable(3, Boolean) = Call id(2), args( Result(1), ) + Call id(2), args( Qubit(1), Result(1), ) + Variable(3, Boolean) = Call id(3), args( Result(1), ) Variable(4, Boolean) = Icmp Ne, Variable(3, Boolean), Bool(true) Variable(5, Boolean) = Store Bool(false) Branch Variable(4, Boolean), 4, 3 @@ -1568,8 +1568,8 @@ fn logical_or_and_sequence_with_dynamic_operands() { Variable(2, Boolean) = Store Variable(5, Boolean) Jump(1) Block 4:Block: - Call id(1), args( Qubit(2), Result(2), ) - Variable(6, Boolean) = Call id(2), args( Result(2), ) + Call id(2), args( Qubit(2), Result(2), ) + Variable(6, Boolean) = Call id(3), args( Result(2), ) Variable(7, Boolean) = Icmp Ne, Variable(6, Boolean), Bool(true) Variable(5, Boolean) = Store Variable(7, Boolean) Jump(3)"#]], @@ -1595,11 +1595,10 @@ fn logical_or_or_sequence_with_dynamic_operands() { measurement_callable_id, &expect![[r#" Callable: - name: __quantum__qis__mresetz__body - call_type: Measurement + name: __quantum__rt__initialize + call_type: Regular input_type: - [0]: Qubit - [1]: Result + [0]: Pointer output_type: body: "#]], ); @@ -1609,11 +1608,12 @@ fn logical_or_or_sequence_with_dynamic_operands() { readout_callable_id, &expect![[r#" Callable: - name: __quantum__rt__read_result - call_type: Readout + name: __quantum__qis__mresetz__body + call_type: Measurement input_type: - [0]: Result - output_type: Boolean + [0]: Qubit + [1]: Result + output_type: body: "#]], ); let output_record_id = CallableId(3); @@ -1621,22 +1621,22 @@ fn logical_or_or_sequence_with_dynamic_operands() { &program, output_record_id, &expect![[r#" - Callable: - name: __quantum__rt__bool_record_output - call_type: OutputRecording - input_type: - [0]: Boolean - [1]: Pointer - output_type: - body: "#]], + Callable: + name: __quantum__rt__read_result + call_type: Readout + input_type: + [0]: Result + output_type: Boolean + body: "#]], ); assert_blocks( &program, &expect![[r#" Blocks: Block 0:Block: - Call id(1), args( Qubit(0), Result(0), ) - Variable(0, Boolean) = Call id(2), args( Result(0), ) + Call id(1), args( Pointer, ) + Call id(2), args( Qubit(0), Result(0), ) + Variable(0, Boolean) = Call id(3), args( Result(0), ) Variable(1, Boolean) = Icmp Ne, Variable(0, Boolean), Bool(true) Variable(2, Boolean) = Store Bool(true) Branch Variable(1, Boolean), 1, 2 @@ -1644,18 +1644,18 @@ fn logical_or_or_sequence_with_dynamic_operands() { Variable(5, Boolean) = Store Bool(true) Branch Variable(2, Boolean), 3, 4 Block 2:Block: - Call id(1), args( Qubit(1), Result(1), ) - Variable(3, Boolean) = Call id(2), args( Result(1), ) + Call id(2), args( Qubit(1), Result(1), ) + Variable(3, Boolean) = Call id(3), args( Result(1), ) Variable(4, Boolean) = Icmp Ne, Variable(3, Boolean), Bool(true) Variable(2, Boolean) = Store Variable(4, Boolean) Jump(1) Block 3:Block: Variable(8, Boolean) = Store Variable(5, Boolean) - Call id(3), args( Variable(8, Boolean), Tag(0, 3), ) + Call id(4), args( Variable(8, Boolean), Tag(0, 3), ) Return Block 4:Block: - Call id(1), args( Qubit(2), Result(2), ) - Variable(6, Boolean) = Call id(2), args( Result(2), ) + Call id(2), args( Qubit(2), Result(2), ) + Variable(6, Boolean) = Call id(3), args( Result(2), ) Variable(7, Boolean) = Icmp Ne, Variable(6, Boolean), Bool(true) Variable(5, Boolean) = Store Variable(7, Boolean) Jump(3)"#]], @@ -1682,11 +1682,10 @@ fn integer_add_with_lhs_classical_integer_and_rhs_dynamic_integer() { measurement_callable_id, &expect![[r#" Callable: - name: __quantum__qis__mresetz__body - call_type: Measurement + name: __quantum__rt__initialize + call_type: Regular input_type: - [0]: Qubit - [1]: Result + [0]: Pointer output_type: body: "#]], ); @@ -1696,11 +1695,12 @@ fn integer_add_with_lhs_classical_integer_and_rhs_dynamic_integer() { readout_callable_id, &expect![[r#" Callable: - name: __quantum__rt__read_result - call_type: Readout + name: __quantum__qis__mresetz__body + call_type: Measurement input_type: - [0]: Result - output_type: Boolean + [0]: Qubit + [1]: Result + output_type: body: "#]], ); let output_record_id = CallableId(3); @@ -1709,12 +1709,11 @@ fn integer_add_with_lhs_classical_integer_and_rhs_dynamic_integer() { output_record_id, &expect![[r#" Callable: - name: __quantum__rt__int_record_output - call_type: OutputRecording + name: __quantum__rt__read_result + call_type: Readout input_type: - [0]: Integer - [1]: Pointer - output_type: + [0]: Result + output_type: Boolean body: "#]], ); assert_blocks( @@ -1722,15 +1721,16 @@ fn integer_add_with_lhs_classical_integer_and_rhs_dynamic_integer() { &expect![[r#" Blocks: Block 0:Block: - Call id(1), args( Qubit(0), Result(0), ) - Variable(0, Boolean) = Call id(2), args( Result(0), ) + Call id(1), args( Pointer, ) + Call id(2), args( Qubit(0), Result(0), ) + Variable(0, Boolean) = Call id(3), args( Result(0), ) Variable(1, Boolean) = Icmp Eq, Variable(0, Boolean), Bool(false) Branch Variable(1, Boolean), 2, 3 Block 1:Block: Variable(3, Integer) = Store Variable(2, Integer) Variable(4, Integer) = Add Integer(1), Variable(3, Integer) Variable(5, Integer) = Store Variable(4, Integer) - Call id(3), args( Variable(5, Integer), Tag(0, 3), ) + Call id(4), args( Variable(5, Integer), Tag(0, 3), ) Return Block 2:Block: Variable(2, Integer) = Store Integer(0) @@ -1761,11 +1761,10 @@ fn integer_sub_with_lhs_dynamic_integer_and_rhs_classical_integer() { measurement_callable_id, &expect![[r#" Callable: - name: __quantum__qis__mresetz__body - call_type: Measurement + name: __quantum__rt__initialize + call_type: Regular input_type: - [0]: Qubit - [1]: Result + [0]: Pointer output_type: body: "#]], ); @@ -1775,11 +1774,12 @@ fn integer_sub_with_lhs_dynamic_integer_and_rhs_classical_integer() { readout_callable_id, &expect![[r#" Callable: - name: __quantum__rt__read_result - call_type: Readout + name: __quantum__qis__mresetz__body + call_type: Measurement input_type: - [0]: Result - output_type: Boolean + [0]: Qubit + [1]: Result + output_type: body: "#]], ); let output_record_id = CallableId(3); @@ -1788,12 +1788,11 @@ fn integer_sub_with_lhs_dynamic_integer_and_rhs_classical_integer() { output_record_id, &expect![[r#" Callable: - name: __quantum__rt__int_record_output - call_type: OutputRecording + name: __quantum__rt__read_result + call_type: Readout input_type: - [0]: Integer - [1]: Pointer - output_type: + [0]: Result + output_type: Boolean body: "#]], ); assert_blocks( @@ -1801,15 +1800,16 @@ fn integer_sub_with_lhs_dynamic_integer_and_rhs_classical_integer() { &expect![[r#" Blocks: Block 0:Block: - Call id(1), args( Qubit(0), Result(0), ) - Variable(0, Boolean) = Call id(2), args( Result(0), ) + Call id(1), args( Pointer, ) + Call id(2), args( Qubit(0), Result(0), ) + Variable(0, Boolean) = Call id(3), args( Result(0), ) Variable(1, Boolean) = Icmp Eq, Variable(0, Boolean), Bool(false) Branch Variable(1, Boolean), 2, 3 Block 1:Block: Variable(3, Integer) = Store Variable(2, Integer) Variable(4, Integer) = Sub Variable(3, Integer), Integer(1) Variable(5, Integer) = Store Variable(4, Integer) - Call id(3), args( Variable(5, Integer), Tag(0, 3), ) + Call id(4), args( Variable(5, Integer), Tag(0, 3), ) Return Block 2:Block: Variable(2, Integer) = Store Integer(0) @@ -1841,11 +1841,10 @@ fn integer_mul_with_lhs_dynamic_integer_and_rhs_dynamic_integer() { measurement_callable_id, &expect![[r#" Callable: - name: __quantum__qis__mresetz__body - call_type: Measurement + name: __quantum__rt__initialize + call_type: Regular input_type: - [0]: Qubit - [1]: Result + [0]: Pointer output_type: body: "#]], ); @@ -1855,11 +1854,12 @@ fn integer_mul_with_lhs_dynamic_integer_and_rhs_dynamic_integer() { readout_callable_id, &expect![[r#" Callable: - name: __quantum__rt__read_result - call_type: Readout + name: __quantum__qis__mresetz__body + call_type: Measurement input_type: - [0]: Result - output_type: Boolean + [0]: Qubit + [1]: Result + output_type: body: "#]], ); let output_record_id = CallableId(3); @@ -1868,12 +1868,11 @@ fn integer_mul_with_lhs_dynamic_integer_and_rhs_dynamic_integer() { output_record_id, &expect![[r#" Callable: - name: __quantum__rt__int_record_output - call_type: OutputRecording + name: __quantum__rt__read_result + call_type: Readout input_type: - [0]: Integer - [1]: Pointer - output_type: + [0]: Result + output_type: Boolean body: "#]], ); assert_blocks( @@ -1881,14 +1880,15 @@ fn integer_mul_with_lhs_dynamic_integer_and_rhs_dynamic_integer() { &expect![[r#" Blocks: Block 0:Block: - Call id(1), args( Qubit(0), Result(0), ) - Variable(0, Boolean) = Call id(2), args( Result(0), ) + Call id(1), args( Pointer, ) + Call id(2), args( Qubit(0), Result(0), ) + Variable(0, Boolean) = Call id(3), args( Result(0), ) Variable(1, Boolean) = Icmp Eq, Variable(0, Boolean), Bool(false) Branch Variable(1, Boolean), 2, 3 Block 1:Block: Variable(3, Integer) = Store Variable(2, Integer) - Call id(1), args( Qubit(0), Result(1), ) - Variable(4, Boolean) = Call id(2), args( Result(1), ) + Call id(2), args( Qubit(0), Result(1), ) + Variable(4, Boolean) = Call id(3), args( Result(1), ) Variable(5, Boolean) = Icmp Eq, Variable(4, Boolean), Bool(false) Branch Variable(5, Boolean), 5, 6 Block 2:Block: @@ -1901,7 +1901,7 @@ fn integer_mul_with_lhs_dynamic_integer_and_rhs_dynamic_integer() { Variable(7, Integer) = Store Variable(6, Integer) Variable(8, Integer) = Mul Variable(3, Integer), Variable(7, Integer) Variable(9, Integer) = Store Variable(8, Integer) - Call id(3), args( Variable(9, Integer), Tag(0, 3), ) + Call id(4), args( Variable(9, Integer), Tag(0, 3), ) Return Block 5:Block: Variable(6, Integer) = Store Integer(1) @@ -1932,11 +1932,10 @@ fn integer_div_with_lhs_classical_integer_and_rhs_dynamic_integer() { measurement_callable_id, &expect![[r#" Callable: - name: __quantum__qis__mresetz__body - call_type: Measurement + name: __quantum__rt__initialize + call_type: Regular input_type: - [0]: Qubit - [1]: Result + [0]: Pointer output_type: body: "#]], ); @@ -1946,11 +1945,12 @@ fn integer_div_with_lhs_classical_integer_and_rhs_dynamic_integer() { readout_callable_id, &expect![[r#" Callable: - name: __quantum__rt__read_result - call_type: Readout + name: __quantum__qis__mresetz__body + call_type: Measurement input_type: - [0]: Result - output_type: Boolean + [0]: Qubit + [1]: Result + output_type: body: "#]], ); let output_record_id = CallableId(3); @@ -1959,12 +1959,11 @@ fn integer_div_with_lhs_classical_integer_and_rhs_dynamic_integer() { output_record_id, &expect![[r#" Callable: - name: __quantum__rt__int_record_output - call_type: OutputRecording + name: __quantum__rt__read_result + call_type: Readout input_type: - [0]: Integer - [1]: Pointer - output_type: + [0]: Result + output_type: Boolean body: "#]], ); assert_blocks( @@ -1972,15 +1971,16 @@ fn integer_div_with_lhs_classical_integer_and_rhs_dynamic_integer() { &expect![[r#" Blocks: Block 0:Block: - Call id(1), args( Qubit(0), Result(0), ) - Variable(0, Boolean) = Call id(2), args( Result(0), ) + Call id(1), args( Pointer, ) + Call id(2), args( Qubit(0), Result(0), ) + Variable(0, Boolean) = Call id(3), args( Result(0), ) Variable(1, Boolean) = Icmp Eq, Variable(0, Boolean), Bool(false) Branch Variable(1, Boolean), 2, 3 Block 1:Block: Variable(3, Integer) = Store Variable(2, Integer) Variable(4, Integer) = Sdiv Integer(1), Variable(3, Integer) Variable(5, Integer) = Store Variable(4, Integer) - Call id(3), args( Variable(5, Integer), Tag(0, 3), ) + Call id(4), args( Variable(5, Integer), Tag(0, 3), ) Return Block 2:Block: Variable(2, Integer) = Store Integer(0) @@ -2033,11 +2033,10 @@ fn integer_mod_with_lhs_dynamic_integer_and_rhs_classical_integer() { measurement_callable_id, &expect![[r#" Callable: - name: __quantum__qis__mresetz__body - call_type: Measurement + name: __quantum__rt__initialize + call_type: Regular input_type: - [0]: Qubit - [1]: Result + [0]: Pointer output_type: body: "#]], ); @@ -2047,11 +2046,12 @@ fn integer_mod_with_lhs_dynamic_integer_and_rhs_classical_integer() { readout_callable_id, &expect![[r#" Callable: - name: __quantum__rt__read_result - call_type: Readout + name: __quantum__qis__mresetz__body + call_type: Measurement input_type: - [0]: Result - output_type: Boolean + [0]: Qubit + [1]: Result + output_type: body: "#]], ); let output_record_id = CallableId(3); @@ -2060,12 +2060,11 @@ fn integer_mod_with_lhs_dynamic_integer_and_rhs_classical_integer() { output_record_id, &expect![[r#" Callable: - name: __quantum__rt__int_record_output - call_type: OutputRecording + name: __quantum__rt__read_result + call_type: Readout input_type: - [0]: Integer - [1]: Pointer - output_type: + [0]: Result + output_type: Boolean body: "#]], ); assert_blocks( @@ -2073,15 +2072,16 @@ fn integer_mod_with_lhs_dynamic_integer_and_rhs_classical_integer() { &expect![[r#" Blocks: Block 0:Block: - Call id(1), args( Qubit(0), Result(0), ) - Variable(0, Boolean) = Call id(2), args( Result(0), ) + Call id(1), args( Pointer, ) + Call id(2), args( Qubit(0), Result(0), ) + Variable(0, Boolean) = Call id(3), args( Result(0), ) Variable(1, Boolean) = Icmp Eq, Variable(0, Boolean), Bool(false) Branch Variable(1, Boolean), 2, 3 Block 1:Block: Variable(3, Integer) = Store Variable(2, Integer) Variable(4, Integer) = Srem Variable(3, Integer), Integer(1) Variable(5, Integer) = Store Variable(4, Integer) - Call id(3), args( Variable(5, Integer), Tag(0, 3), ) + Call id(4), args( Variable(5, Integer), Tag(0, 3), ) Return Block 2:Block: Variable(2, Integer) = Store Integer(0) @@ -2157,11 +2157,10 @@ fn integer_exponentiation_with_lhs_dynamic_integer_and_rhs_classical_zero_intege measurement_callable_id, &expect![[r#" Callable: - name: __quantum__qis__mresetz__body - call_type: Measurement + name: __quantum__rt__initialize + call_type: Regular input_type: - [0]: Qubit - [1]: Result + [0]: Pointer output_type: body: "#]], ); @@ -2171,11 +2170,12 @@ fn integer_exponentiation_with_lhs_dynamic_integer_and_rhs_classical_zero_intege readout_callable_id, &expect![[r#" Callable: - name: __quantum__rt__read_result - call_type: Readout + name: __quantum__qis__mresetz__body + call_type: Measurement input_type: - [0]: Result - output_type: Boolean + [0]: Qubit + [1]: Result + output_type: body: "#]], ); let output_record_id = CallableId(3); @@ -2184,12 +2184,11 @@ fn integer_exponentiation_with_lhs_dynamic_integer_and_rhs_classical_zero_intege output_record_id, &expect![[r#" Callable: - name: __quantum__rt__int_record_output - call_type: OutputRecording + name: __quantum__rt__read_result + call_type: Readout input_type: - [0]: Integer - [1]: Pointer - output_type: + [0]: Result + output_type: Boolean body: "#]], ); assert_blocks( @@ -2197,15 +2196,16 @@ fn integer_exponentiation_with_lhs_dynamic_integer_and_rhs_classical_zero_intege &expect![[r#" Blocks: Block 0:Block: - Call id(1), args( Qubit(0), Result(0), ) - Variable(0, Boolean) = Call id(2), args( Result(0), ) + Call id(1), args( Pointer, ) + Call id(2), args( Qubit(0), Result(0), ) + Variable(0, Boolean) = Call id(3), args( Result(0), ) Variable(1, Boolean) = Icmp Eq, Variable(0, Boolean), Bool(false) Branch Variable(1, Boolean), 2, 3 Block 1:Block: Variable(3, Integer) = Store Variable(2, Integer) Variable(4, Integer) = Store Integer(1) Variable(5, Integer) = Store Variable(4, Integer) - Call id(3), args( Variable(5, Integer), Tag(0, 3), ) + Call id(4), args( Variable(5, Integer), Tag(0, 3), ) Return Block 2:Block: Variable(2, Integer) = Store Integer(0) @@ -2236,11 +2236,10 @@ fn integer_exponentiation_with_lhs_dynamic_integer_and_rhs_classical_positive_in measurement_callable_id, &expect![[r#" Callable: - name: __quantum__qis__mresetz__body - call_type: Measurement + name: __quantum__rt__initialize + call_type: Regular input_type: - [0]: Qubit - [1]: Result + [0]: Pointer output_type: body: "#]], ); @@ -2250,11 +2249,12 @@ fn integer_exponentiation_with_lhs_dynamic_integer_and_rhs_classical_positive_in readout_callable_id, &expect![[r#" Callable: - name: __quantum__rt__read_result - call_type: Readout + name: __quantum__qis__mresetz__body + call_type: Measurement input_type: - [0]: Result - output_type: Boolean + [0]: Qubit + [1]: Result + output_type: body: "#]], ); let output_record_id = CallableId(3); @@ -2263,12 +2263,11 @@ fn integer_exponentiation_with_lhs_dynamic_integer_and_rhs_classical_positive_in output_record_id, &expect![[r#" Callable: - name: __quantum__rt__int_record_output - call_type: OutputRecording + name: __quantum__rt__read_result + call_type: Readout input_type: - [0]: Integer - [1]: Pointer - output_type: + [0]: Result + output_type: Boolean body: "#]], ); assert_blocks( @@ -2276,8 +2275,9 @@ fn integer_exponentiation_with_lhs_dynamic_integer_and_rhs_classical_positive_in &expect![[r#" Blocks: Block 0:Block: - Call id(1), args( Qubit(0), Result(0), ) - Variable(0, Boolean) = Call id(2), args( Result(0), ) + Call id(1), args( Pointer, ) + Call id(2), args( Qubit(0), Result(0), ) + Variable(0, Boolean) = Call id(3), args( Result(0), ) Variable(1, Boolean) = Icmp Eq, Variable(0, Boolean), Bool(false) Branch Variable(1, Boolean), 2, 3 Block 1:Block: @@ -2287,7 +2287,7 @@ fn integer_exponentiation_with_lhs_dynamic_integer_and_rhs_classical_positive_in Variable(6, Integer) = Mul Variable(5, Integer), Variable(3, Integer) Variable(7, Integer) = Mul Variable(6, Integer), Variable(3, Integer) Variable(8, Integer) = Store Variable(7, Integer) - Call id(3), args( Variable(8, Integer), Tag(0, 3), ) + Call id(4), args( Variable(8, Integer), Tag(0, 3), ) Return Block 2:Block: Variable(2, Integer) = Store Integer(0) @@ -2342,11 +2342,10 @@ fn integer_bitwise_and_with_lhs_dynamic_integer_and_rhs_dynamic_integer() { measurement_callable_id, &expect![[r#" Callable: - name: __quantum__qis__mresetz__body - call_type: Measurement + name: __quantum__rt__initialize + call_type: Regular input_type: - [0]: Qubit - [1]: Result + [0]: Pointer output_type: body: "#]], ); @@ -2356,11 +2355,12 @@ fn integer_bitwise_and_with_lhs_dynamic_integer_and_rhs_dynamic_integer() { readout_callable_id, &expect![[r#" Callable: - name: __quantum__rt__read_result - call_type: Readout + name: __quantum__qis__mresetz__body + call_type: Measurement input_type: - [0]: Result - output_type: Boolean + [0]: Qubit + [1]: Result + output_type: body: "#]], ); let output_record_id = CallableId(3); @@ -2369,12 +2369,11 @@ fn integer_bitwise_and_with_lhs_dynamic_integer_and_rhs_dynamic_integer() { output_record_id, &expect![[r#" Callable: - name: __quantum__rt__int_record_output - call_type: OutputRecording + name: __quantum__rt__read_result + call_type: Readout input_type: - [0]: Integer - [1]: Pointer - output_type: + [0]: Result + output_type: Boolean body: "#]], ); assert_blocks( @@ -2382,14 +2381,15 @@ fn integer_bitwise_and_with_lhs_dynamic_integer_and_rhs_dynamic_integer() { &expect![[r#" Blocks: Block 0:Block: - Call id(1), args( Qubit(0), Result(0), ) - Variable(0, Boolean) = Call id(2), args( Result(0), ) + Call id(1), args( Pointer, ) + Call id(2), args( Qubit(0), Result(0), ) + Variable(0, Boolean) = Call id(3), args( Result(0), ) Variable(1, Boolean) = Icmp Eq, Variable(0, Boolean), Bool(false) Branch Variable(1, Boolean), 2, 3 Block 1:Block: Variable(3, Integer) = Store Variable(2, Integer) - Call id(1), args( Qubit(0), Result(1), ) - Variable(4, Boolean) = Call id(2), args( Result(1), ) + Call id(2), args( Qubit(0), Result(1), ) + Variable(4, Boolean) = Call id(3), args( Result(1), ) Variable(5, Boolean) = Icmp Eq, Variable(4, Boolean), Bool(false) Branch Variable(5, Boolean), 5, 6 Block 2:Block: @@ -2402,7 +2402,7 @@ fn integer_bitwise_and_with_lhs_dynamic_integer_and_rhs_dynamic_integer() { Variable(7, Integer) = Store Variable(6, Integer) Variable(8, Integer) = BitwiseAnd Variable(3, Integer), Variable(7, Integer) Variable(9, Integer) = Store Variable(8, Integer) - Call id(3), args( Variable(9, Integer), Tag(0, 3), ) + Call id(4), args( Variable(9, Integer), Tag(0, 3), ) Return Block 5:Block: Variable(6, Integer) = Store Integer(1) @@ -2433,11 +2433,10 @@ fn integer_bitwise_or_with_lhs_classical_integer_and_rhs_dynamic_integer() { measurement_callable_id, &expect![[r#" Callable: - name: __quantum__qis__mresetz__body - call_type: Measurement + name: __quantum__rt__initialize + call_type: Regular input_type: - [0]: Qubit - [1]: Result + [0]: Pointer output_type: body: "#]], ); @@ -2447,11 +2446,12 @@ fn integer_bitwise_or_with_lhs_classical_integer_and_rhs_dynamic_integer() { readout_callable_id, &expect![[r#" Callable: - name: __quantum__rt__read_result - call_type: Readout + name: __quantum__qis__mresetz__body + call_type: Measurement input_type: - [0]: Result - output_type: Boolean + [0]: Qubit + [1]: Result + output_type: body: "#]], ); let output_record_id = CallableId(3); @@ -2460,12 +2460,11 @@ fn integer_bitwise_or_with_lhs_classical_integer_and_rhs_dynamic_integer() { output_record_id, &expect![[r#" Callable: - name: __quantum__rt__int_record_output - call_type: OutputRecording + name: __quantum__rt__read_result + call_type: Readout input_type: - [0]: Integer - [1]: Pointer - output_type: + [0]: Result + output_type: Boolean body: "#]], ); assert_blocks( @@ -2473,15 +2472,16 @@ fn integer_bitwise_or_with_lhs_classical_integer_and_rhs_dynamic_integer() { &expect![[r#" Blocks: Block 0:Block: - Call id(1), args( Qubit(0), Result(0), ) - Variable(0, Boolean) = Call id(2), args( Result(0), ) + Call id(1), args( Pointer, ) + Call id(2), args( Qubit(0), Result(0), ) + Variable(0, Boolean) = Call id(3), args( Result(0), ) Variable(1, Boolean) = Icmp Eq, Variable(0, Boolean), Bool(false) Branch Variable(1, Boolean), 2, 3 Block 1:Block: Variable(3, Integer) = Store Variable(2, Integer) Variable(4, Integer) = BitwiseOr Integer(1), Variable(3, Integer) Variable(5, Integer) = Store Variable(4, Integer) - Call id(3), args( Variable(5, Integer), Tag(0, 3), ) + Call id(4), args( Variable(5, Integer), Tag(0, 3), ) Return Block 2:Block: Variable(2, Integer) = Store Integer(0) @@ -2512,11 +2512,10 @@ fn integer_bitwise_xor_with_lhs_dynamic_integer_and_rhs_classical_integer() { measurement_callable_id, &expect![[r#" Callable: - name: __quantum__qis__mresetz__body - call_type: Measurement + name: __quantum__rt__initialize + call_type: Regular input_type: - [0]: Qubit - [1]: Result + [0]: Pointer output_type: body: "#]], ); @@ -2526,11 +2525,12 @@ fn integer_bitwise_xor_with_lhs_dynamic_integer_and_rhs_classical_integer() { readout_callable_id, &expect![[r#" Callable: - name: __quantum__rt__read_result - call_type: Readout + name: __quantum__qis__mresetz__body + call_type: Measurement input_type: - [0]: Result - output_type: Boolean + [0]: Qubit + [1]: Result + output_type: body: "#]], ); let output_record_id = CallableId(3); @@ -2539,12 +2539,11 @@ fn integer_bitwise_xor_with_lhs_dynamic_integer_and_rhs_classical_integer() { output_record_id, &expect![[r#" Callable: - name: __quantum__rt__int_record_output - call_type: OutputRecording + name: __quantum__rt__read_result + call_type: Readout input_type: - [0]: Integer - [1]: Pointer - output_type: + [0]: Result + output_type: Boolean body: "#]], ); assert_blocks( @@ -2552,15 +2551,16 @@ fn integer_bitwise_xor_with_lhs_dynamic_integer_and_rhs_classical_integer() { &expect![[r#" Blocks: Block 0:Block: - Call id(1), args( Qubit(0), Result(0), ) - Variable(0, Boolean) = Call id(2), args( Result(0), ) + Call id(1), args( Pointer, ) + Call id(2), args( Qubit(0), Result(0), ) + Variable(0, Boolean) = Call id(3), args( Result(0), ) Variable(1, Boolean) = Icmp Eq, Variable(0, Boolean), Bool(false) Branch Variable(1, Boolean), 2, 3 Block 1:Block: Variable(3, Integer) = Store Variable(2, Integer) Variable(4, Integer) = BitwiseXor Variable(3, Integer), Integer(1) Variable(5, Integer) = Store Variable(4, Integer) - Call id(3), args( Variable(5, Integer), Tag(0, 3), ) + Call id(4), args( Variable(5, Integer), Tag(0, 3), ) Return Block 2:Block: Variable(2, Integer) = Store Integer(0) @@ -2592,11 +2592,10 @@ fn integer_bitwise_left_shif_with_lhs_dynamic_integer_and_rhs_dynamic_integer() measurement_callable_id, &expect![[r#" Callable: - name: __quantum__qis__mresetz__body - call_type: Measurement + name: __quantum__rt__initialize + call_type: Regular input_type: - [0]: Qubit - [1]: Result + [0]: Pointer output_type: body: "#]], ); @@ -2606,11 +2605,12 @@ fn integer_bitwise_left_shif_with_lhs_dynamic_integer_and_rhs_dynamic_integer() readout_callable_id, &expect![[r#" Callable: - name: __quantum__rt__read_result - call_type: Readout + name: __quantum__qis__mresetz__body + call_type: Measurement input_type: - [0]: Result - output_type: Boolean + [0]: Qubit + [1]: Result + output_type: body: "#]], ); let output_record_id = CallableId(3); @@ -2619,12 +2619,11 @@ fn integer_bitwise_left_shif_with_lhs_dynamic_integer_and_rhs_dynamic_integer() output_record_id, &expect![[r#" Callable: - name: __quantum__rt__int_record_output - call_type: OutputRecording + name: __quantum__rt__read_result + call_type: Readout input_type: - [0]: Integer - [1]: Pointer - output_type: + [0]: Result + output_type: Boolean body: "#]], ); assert_blocks( @@ -2632,14 +2631,15 @@ fn integer_bitwise_left_shif_with_lhs_dynamic_integer_and_rhs_dynamic_integer() &expect![[r#" Blocks: Block 0:Block: - Call id(1), args( Qubit(0), Result(0), ) - Variable(0, Boolean) = Call id(2), args( Result(0), ) + Call id(1), args( Pointer, ) + Call id(2), args( Qubit(0), Result(0), ) + Variable(0, Boolean) = Call id(3), args( Result(0), ) Variable(1, Boolean) = Icmp Eq, Variable(0, Boolean), Bool(false) Branch Variable(1, Boolean), 2, 3 Block 1:Block: Variable(3, Integer) = Store Variable(2, Integer) - Call id(1), args( Qubit(0), Result(1), ) - Variable(4, Boolean) = Call id(2), args( Result(1), ) + Call id(2), args( Qubit(0), Result(1), ) + Variable(4, Boolean) = Call id(3), args( Result(1), ) Variable(5, Boolean) = Icmp Eq, Variable(4, Boolean), Bool(false) Branch Variable(5, Boolean), 5, 6 Block 2:Block: @@ -2652,7 +2652,7 @@ fn integer_bitwise_left_shif_with_lhs_dynamic_integer_and_rhs_dynamic_integer() Variable(7, Integer) = Store Variable(6, Integer) Variable(8, Integer) = Shl Variable(3, Integer), Variable(7, Integer) Variable(9, Integer) = Store Variable(8, Integer) - Call id(3), args( Variable(9, Integer), Tag(0, 3), ) + Call id(4), args( Variable(9, Integer), Tag(0, 3), ) Return Block 5:Block: Variable(6, Integer) = Store Integer(1) @@ -2683,11 +2683,10 @@ fn integer_bitwise_right_shift_with_lhs_classical_integer_and_rhs_dynamic_intege measurement_callable_id, &expect![[r#" Callable: - name: __quantum__qis__mresetz__body - call_type: Measurement + name: __quantum__rt__initialize + call_type: Regular input_type: - [0]: Qubit - [1]: Result + [0]: Pointer output_type: body: "#]], ); @@ -2697,11 +2696,12 @@ fn integer_bitwise_right_shift_with_lhs_classical_integer_and_rhs_dynamic_intege readout_callable_id, &expect![[r#" Callable: - name: __quantum__rt__read_result - call_type: Readout + name: __quantum__qis__mresetz__body + call_type: Measurement input_type: - [0]: Result - output_type: Boolean + [0]: Qubit + [1]: Result + output_type: body: "#]], ); let output_record_id = CallableId(3); @@ -2710,12 +2710,11 @@ fn integer_bitwise_right_shift_with_lhs_classical_integer_and_rhs_dynamic_intege output_record_id, &expect![[r#" Callable: - name: __quantum__rt__int_record_output - call_type: OutputRecording + name: __quantum__rt__read_result + call_type: Readout input_type: - [0]: Integer - [1]: Pointer - output_type: + [0]: Result + output_type: Boolean body: "#]], ); assert_blocks( @@ -2723,15 +2722,16 @@ fn integer_bitwise_right_shift_with_lhs_classical_integer_and_rhs_dynamic_intege &expect![[r#" Blocks: Block 0:Block: - Call id(1), args( Qubit(0), Result(0), ) - Variable(0, Boolean) = Call id(2), args( Result(0), ) + Call id(1), args( Pointer, ) + Call id(2), args( Qubit(0), Result(0), ) + Variable(0, Boolean) = Call id(3), args( Result(0), ) Variable(1, Boolean) = Icmp Eq, Variable(0, Boolean), Bool(false) Branch Variable(1, Boolean), 2, 3 Block 1:Block: Variable(3, Integer) = Store Variable(2, Integer) Variable(4, Integer) = Ashr Integer(1), Variable(3, Integer) Variable(5, Integer) = Store Variable(4, Integer) - Call id(3), args( Variable(5, Integer), Tag(0, 3), ) + Call id(4), args( Variable(5, Integer), Tag(0, 3), ) Return Block 2:Block: Variable(2, Integer) = Store Integer(0) @@ -2762,11 +2762,10 @@ fn integer_equality_comparison_with_lhs_dynamic_integer_and_rhs_classical_intege measurement_callable_id, &expect![[r#" Callable: - name: __quantum__qis__mresetz__body - call_type: Measurement + name: __quantum__rt__initialize + call_type: Regular input_type: - [0]: Qubit - [1]: Result + [0]: Pointer output_type: body: "#]], ); @@ -2776,11 +2775,12 @@ fn integer_equality_comparison_with_lhs_dynamic_integer_and_rhs_classical_intege readout_callable_id, &expect![[r#" Callable: - name: __quantum__rt__read_result - call_type: Readout + name: __quantum__qis__mresetz__body + call_type: Measurement input_type: - [0]: Result - output_type: Boolean + [0]: Qubit + [1]: Result + output_type: body: "#]], ); let output_record_id = CallableId(3); @@ -2789,12 +2789,11 @@ fn integer_equality_comparison_with_lhs_dynamic_integer_and_rhs_classical_intege output_record_id, &expect![[r#" Callable: - name: __quantum__rt__bool_record_output - call_type: OutputRecording + name: __quantum__rt__read_result + call_type: Readout input_type: - [0]: Boolean - [1]: Pointer - output_type: + [0]: Result + output_type: Boolean body: "#]], ); assert_blocks( @@ -2802,15 +2801,16 @@ fn integer_equality_comparison_with_lhs_dynamic_integer_and_rhs_classical_intege &expect![[r#" Blocks: Block 0:Block: - Call id(1), args( Qubit(0), Result(0), ) - Variable(0, Boolean) = Call id(2), args( Result(0), ) + Call id(1), args( Pointer, ) + Call id(2), args( Qubit(0), Result(0), ) + Variable(0, Boolean) = Call id(3), args( Result(0), ) Variable(1, Boolean) = Icmp Eq, Variable(0, Boolean), Bool(false) Branch Variable(1, Boolean), 2, 3 Block 1:Block: Variable(3, Integer) = Store Variable(2, Integer) Variable(4, Boolean) = Icmp Eq, Variable(3, Integer), Integer(1) Variable(5, Boolean) = Store Variable(4, Boolean) - Call id(3), args( Variable(5, Boolean), Tag(0, 3), ) + Call id(4), args( Variable(5, Boolean), Tag(0, 3), ) Return Block 2:Block: Variable(2, Integer) = Store Integer(0) @@ -2842,11 +2842,10 @@ fn integer_inequality_comparison_with_lhs_dynamic_integer_and_rhs_dynamic_intege measurement_callable_id, &expect![[r#" Callable: - name: __quantum__qis__mresetz__body - call_type: Measurement + name: __quantum__rt__initialize + call_type: Regular input_type: - [0]: Qubit - [1]: Result + [0]: Pointer output_type: body: "#]], ); @@ -2856,11 +2855,12 @@ fn integer_inequality_comparison_with_lhs_dynamic_integer_and_rhs_dynamic_intege readout_callable_id, &expect![[r#" Callable: - name: __quantum__rt__read_result - call_type: Readout + name: __quantum__qis__mresetz__body + call_type: Measurement input_type: - [0]: Result - output_type: Boolean + [0]: Qubit + [1]: Result + output_type: body: "#]], ); let output_record_id = CallableId(3); @@ -2869,12 +2869,11 @@ fn integer_inequality_comparison_with_lhs_dynamic_integer_and_rhs_dynamic_intege output_record_id, &expect![[r#" Callable: - name: __quantum__rt__bool_record_output - call_type: OutputRecording + name: __quantum__rt__read_result + call_type: Readout input_type: - [0]: Boolean - [1]: Pointer - output_type: + [0]: Result + output_type: Boolean body: "#]], ); assert_blocks( @@ -2882,14 +2881,15 @@ fn integer_inequality_comparison_with_lhs_dynamic_integer_and_rhs_dynamic_intege &expect![[r#" Blocks: Block 0:Block: - Call id(1), args( Qubit(0), Result(0), ) - Variable(0, Boolean) = Call id(2), args( Result(0), ) + Call id(1), args( Pointer, ) + Call id(2), args( Qubit(0), Result(0), ) + Variable(0, Boolean) = Call id(3), args( Result(0), ) Variable(1, Boolean) = Icmp Eq, Variable(0, Boolean), Bool(false) Branch Variable(1, Boolean), 2, 3 Block 1:Block: Variable(3, Integer) = Store Variable(2, Integer) - Call id(1), args( Qubit(0), Result(1), ) - Variable(4, Boolean) = Call id(2), args( Result(1), ) + Call id(2), args( Qubit(0), Result(1), ) + Variable(4, Boolean) = Call id(3), args( Result(1), ) Variable(5, Boolean) = Icmp Eq, Variable(4, Boolean), Bool(false) Branch Variable(5, Boolean), 5, 6 Block 2:Block: @@ -2902,7 +2902,7 @@ fn integer_inequality_comparison_with_lhs_dynamic_integer_and_rhs_dynamic_intege Variable(7, Integer) = Store Variable(6, Integer) Variable(8, Boolean) = Icmp Ne, Variable(3, Integer), Variable(7, Integer) Variable(9, Boolean) = Store Variable(8, Boolean) - Call id(3), args( Variable(9, Boolean), Tag(0, 3), ) + Call id(4), args( Variable(9, Boolean), Tag(0, 3), ) Return Block 5:Block: Variable(6, Integer) = Store Integer(1) @@ -2933,11 +2933,10 @@ fn integer_greater_than_comparison_with_lhs_classical_integer_and_rhs_dynamic_in measurement_callable_id, &expect![[r#" Callable: - name: __quantum__qis__mresetz__body - call_type: Measurement + name: __quantum__rt__initialize + call_type: Regular input_type: - [0]: Qubit - [1]: Result + [0]: Pointer output_type: body: "#]], ); @@ -2947,11 +2946,12 @@ fn integer_greater_than_comparison_with_lhs_classical_integer_and_rhs_dynamic_in readout_callable_id, &expect![[r#" Callable: - name: __quantum__rt__read_result - call_type: Readout + name: __quantum__qis__mresetz__body + call_type: Measurement input_type: - [0]: Result - output_type: Boolean + [0]: Qubit + [1]: Result + output_type: body: "#]], ); let output_record_id = CallableId(3); @@ -2960,12 +2960,11 @@ fn integer_greater_than_comparison_with_lhs_classical_integer_and_rhs_dynamic_in output_record_id, &expect![[r#" Callable: - name: __quantum__rt__bool_record_output - call_type: OutputRecording + name: __quantum__rt__read_result + call_type: Readout input_type: - [0]: Boolean - [1]: Pointer - output_type: + [0]: Result + output_type: Boolean body: "#]], ); assert_blocks( @@ -2973,15 +2972,16 @@ fn integer_greater_than_comparison_with_lhs_classical_integer_and_rhs_dynamic_in &expect![[r#" Blocks: Block 0:Block: - Call id(1), args( Qubit(0), Result(0), ) - Variable(0, Boolean) = Call id(2), args( Result(0), ) + Call id(1), args( Pointer, ) + Call id(2), args( Qubit(0), Result(0), ) + Variable(0, Boolean) = Call id(3), args( Result(0), ) Variable(1, Boolean) = Icmp Eq, Variable(0, Boolean), Bool(false) Branch Variable(1, Boolean), 2, 3 Block 1:Block: Variable(3, Integer) = Store Variable(2, Integer) Variable(4, Boolean) = Icmp Sgt, Integer(1), Variable(3, Integer) Variable(5, Boolean) = Store Variable(4, Boolean) - Call id(3), args( Variable(5, Boolean), Tag(0, 3), ) + Call id(4), args( Variable(5, Boolean), Tag(0, 3), ) Return Block 2:Block: Variable(2, Integer) = Store Integer(0) @@ -3012,11 +3012,10 @@ fn integer_greater_or_equal_than_comparison_with_lhs_dynamic_integer_and_rhs_cla measurement_callable_id, &expect![[r#" Callable: - name: __quantum__qis__mresetz__body - call_type: Measurement + name: __quantum__rt__initialize + call_type: Regular input_type: - [0]: Qubit - [1]: Result + [0]: Pointer output_type: body: "#]], ); @@ -3026,11 +3025,12 @@ fn integer_greater_or_equal_than_comparison_with_lhs_dynamic_integer_and_rhs_cla readout_callable_id, &expect![[r#" Callable: - name: __quantum__rt__read_result - call_type: Readout + name: __quantum__qis__mresetz__body + call_type: Measurement input_type: - [0]: Result - output_type: Boolean + [0]: Qubit + [1]: Result + output_type: body: "#]], ); let output_record_id = CallableId(3); @@ -3039,12 +3039,11 @@ fn integer_greater_or_equal_than_comparison_with_lhs_dynamic_integer_and_rhs_cla output_record_id, &expect![[r#" Callable: - name: __quantum__rt__bool_record_output - call_type: OutputRecording + name: __quantum__rt__read_result + call_type: Readout input_type: - [0]: Boolean - [1]: Pointer - output_type: + [0]: Result + output_type: Boolean body: "#]], ); assert_blocks( @@ -3052,15 +3051,16 @@ fn integer_greater_or_equal_than_comparison_with_lhs_dynamic_integer_and_rhs_cla &expect![[r#" Blocks: Block 0:Block: - Call id(1), args( Qubit(0), Result(0), ) - Variable(0, Boolean) = Call id(2), args( Result(0), ) + Call id(1), args( Pointer, ) + Call id(2), args( Qubit(0), Result(0), ) + Variable(0, Boolean) = Call id(3), args( Result(0), ) Variable(1, Boolean) = Icmp Eq, Variable(0, Boolean), Bool(false) Branch Variable(1, Boolean), 2, 3 Block 1:Block: Variable(3, Integer) = Store Variable(2, Integer) Variable(4, Boolean) = Icmp Sge, Variable(3, Integer), Integer(1) Variable(5, Boolean) = Store Variable(4, Boolean) - Call id(3), args( Variable(5, Boolean), Tag(0, 3), ) + Call id(4), args( Variable(5, Boolean), Tag(0, 3), ) Return Block 2:Block: Variable(2, Integer) = Store Integer(0) @@ -3092,11 +3092,10 @@ fn integer_less_than_comparison_with_lhs_dynamic_integer_and_rhs_dynamic_integer measurement_callable_id, &expect![[r#" Callable: - name: __quantum__qis__mresetz__body - call_type: Measurement + name: __quantum__rt__initialize + call_type: Regular input_type: - [0]: Qubit - [1]: Result + [0]: Pointer output_type: body: "#]], ); @@ -3106,11 +3105,12 @@ fn integer_less_than_comparison_with_lhs_dynamic_integer_and_rhs_dynamic_integer readout_callable_id, &expect![[r#" Callable: - name: __quantum__rt__read_result - call_type: Readout + name: __quantum__qis__mresetz__body + call_type: Measurement input_type: - [0]: Result - output_type: Boolean + [0]: Qubit + [1]: Result + output_type: body: "#]], ); let output_record_id = CallableId(3); @@ -3119,12 +3119,11 @@ fn integer_less_than_comparison_with_lhs_dynamic_integer_and_rhs_dynamic_integer output_record_id, &expect![[r#" Callable: - name: __quantum__rt__bool_record_output - call_type: OutputRecording + name: __quantum__rt__read_result + call_type: Readout input_type: - [0]: Boolean - [1]: Pointer - output_type: + [0]: Result + output_type: Boolean body: "#]], ); assert_blocks( @@ -3132,14 +3131,15 @@ fn integer_less_than_comparison_with_lhs_dynamic_integer_and_rhs_dynamic_integer &expect![[r#" Blocks: Block 0:Block: - Call id(1), args( Qubit(0), Result(0), ) - Variable(0, Boolean) = Call id(2), args( Result(0), ) + Call id(1), args( Pointer, ) + Call id(2), args( Qubit(0), Result(0), ) + Variable(0, Boolean) = Call id(3), args( Result(0), ) Variable(1, Boolean) = Icmp Eq, Variable(0, Boolean), Bool(false) Branch Variable(1, Boolean), 2, 3 Block 1:Block: Variable(3, Integer) = Store Variable(2, Integer) - Call id(1), args( Qubit(0), Result(1), ) - Variable(4, Boolean) = Call id(2), args( Result(1), ) + Call id(2), args( Qubit(0), Result(1), ) + Variable(4, Boolean) = Call id(3), args( Result(1), ) Variable(5, Boolean) = Icmp Eq, Variable(4, Boolean), Bool(false) Branch Variable(5, Boolean), 5, 6 Block 2:Block: @@ -3152,7 +3152,7 @@ fn integer_less_than_comparison_with_lhs_dynamic_integer_and_rhs_dynamic_integer Variable(7, Integer) = Store Variable(6, Integer) Variable(8, Boolean) = Icmp Slt, Variable(3, Integer), Variable(7, Integer) Variable(9, Boolean) = Store Variable(8, Boolean) - Call id(3), args( Variable(9, Boolean), Tag(0, 3), ) + Call id(4), args( Variable(9, Boolean), Tag(0, 3), ) Return Block 5:Block: Variable(6, Integer) = Store Integer(1) @@ -3183,11 +3183,10 @@ fn integer_less_or_equal_than_comparison_with_lhs_classical_integer_and_rhs_dyna measurement_callable_id, &expect![[r#" Callable: - name: __quantum__qis__mresetz__body - call_type: Measurement + name: __quantum__rt__initialize + call_type: Regular input_type: - [0]: Qubit - [1]: Result + [0]: Pointer output_type: body: "#]], ); @@ -3197,11 +3196,12 @@ fn integer_less_or_equal_than_comparison_with_lhs_classical_integer_and_rhs_dyna readout_callable_id, &expect![[r#" Callable: - name: __quantum__rt__read_result - call_type: Readout + name: __quantum__qis__mresetz__body + call_type: Measurement input_type: - [0]: Result - output_type: Boolean + [0]: Qubit + [1]: Result + output_type: body: "#]], ); let output_record_id = CallableId(3); @@ -3210,12 +3210,11 @@ fn integer_less_or_equal_than_comparison_with_lhs_classical_integer_and_rhs_dyna output_record_id, &expect![[r#" Callable: - name: __quantum__rt__bool_record_output - call_type: OutputRecording + name: __quantum__rt__read_result + call_type: Readout input_type: - [0]: Boolean - [1]: Pointer - output_type: + [0]: Result + output_type: Boolean body: "#]], ); assert_blocks( @@ -3223,15 +3222,16 @@ fn integer_less_or_equal_than_comparison_with_lhs_classical_integer_and_rhs_dyna &expect![[r#" Blocks: Block 0:Block: - Call id(1), args( Qubit(0), Result(0), ) - Variable(0, Boolean) = Call id(2), args( Result(0), ) + Call id(1), args( Pointer, ) + Call id(2), args( Qubit(0), Result(0), ) + Variable(0, Boolean) = Call id(3), args( Result(0), ) Variable(1, Boolean) = Icmp Eq, Variable(0, Boolean), Bool(false) Branch Variable(1, Boolean), 2, 3 Block 1:Block: Variable(3, Integer) = Store Variable(2, Integer) Variable(4, Boolean) = Icmp Sle, Integer(1), Variable(3, Integer) Variable(5, Boolean) = Store Variable(4, Boolean) - Call id(3), args( Variable(5, Boolean), Tag(0, 3), ) + Call id(4), args( Variable(5, Boolean), Tag(0, 3), ) Return Block 2:Block: Variable(2, Integer) = Store Integer(0) @@ -3259,14 +3259,13 @@ fn leading_positive_unary_operator_on_double_does_not_generate_rir_instruction() &program, mresetz_callable_id, &expect![[r#" - Callable: - name: __quantum__qis__mresetz__body - call_type: Measurement - input_type: - [0]: Qubit - [1]: Result - output_type: - body: "#]], + Callable: + name: __quantum__rt__initialize + call_type: Regular + input_type: + [0]: Pointer + output_type: + body: "#]], ); let readout_callable_id = CallableId(2); assert_callable( @@ -3274,11 +3273,12 @@ fn leading_positive_unary_operator_on_double_does_not_generate_rir_instruction() readout_callable_id, &expect![[r#" Callable: - name: __quantum__rt__read_result - call_type: Readout + name: __quantum__qis__mresetz__body + call_type: Measurement input_type: - [0]: Result - output_type: Boolean + [0]: Qubit + [1]: Result + output_type: body: "#]], ); let output_recording_callable_id = CallableId(3); @@ -3287,12 +3287,11 @@ fn leading_positive_unary_operator_on_double_does_not_generate_rir_instruction() output_recording_callable_id, &expect![[r#" Callable: - name: __quantum__rt__double_record_output - call_type: OutputRecording + name: __quantum__rt__read_result + call_type: Readout input_type: - [0]: Double - [1]: Pointer - output_type: + [0]: Result + output_type: Boolean body: "#]], ); assert_blocks( @@ -3300,14 +3299,15 @@ fn leading_positive_unary_operator_on_double_does_not_generate_rir_instruction() &expect![[r#" Blocks: Block 0:Block: - Call id(1), args( Qubit(0), Result(0), ) - Variable(0, Boolean) = Call id(2), args( Result(0), ) + Call id(1), args( Pointer, ) + Call id(2), args( Qubit(0), Result(0), ) + Variable(0, Boolean) = Call id(3), args( Result(0), ) Variable(1, Boolean) = Icmp Eq, Variable(0, Boolean), Bool(false) Branch Variable(1, Boolean), 2, 3 Block 1:Block: Variable(3, Double) = Store Variable(2, Double) Variable(4, Double) = Store Variable(3, Double) - Call id(3), args( Variable(4, Double), Tag(0, 3), ) + Call id(4), args( Variable(4, Double), Tag(0, 3), ) Return Block 2:Block: Variable(2, Double) = Store Double(0) @@ -3335,14 +3335,13 @@ fn leading_negative_unary_operator_on_double_generates_rir_instruction() { &program, mresetz_callable_id, &expect![[r#" - Callable: - name: __quantum__qis__mresetz__body - call_type: Measurement - input_type: - [0]: Qubit - [1]: Result - output_type: - body: "#]], + Callable: + name: __quantum__rt__initialize + call_type: Regular + input_type: + [0]: Pointer + output_type: + body: "#]], ); let readout_callable_id = CallableId(2); assert_callable( @@ -3350,11 +3349,12 @@ fn leading_negative_unary_operator_on_double_generates_rir_instruction() { readout_callable_id, &expect![[r#" Callable: - name: __quantum__rt__read_result - call_type: Readout + name: __quantum__qis__mresetz__body + call_type: Measurement input_type: - [0]: Result - output_type: Boolean + [0]: Qubit + [1]: Result + output_type: body: "#]], ); let output_recording_callable_id = CallableId(3); @@ -3363,12 +3363,11 @@ fn leading_negative_unary_operator_on_double_generates_rir_instruction() { output_recording_callable_id, &expect![[r#" Callable: - name: __quantum__rt__double_record_output - call_type: OutputRecording + name: __quantum__rt__read_result + call_type: Readout input_type: - [0]: Double - [1]: Pointer - output_type: + [0]: Result + output_type: Boolean body: "#]], ); assert_blocks( @@ -3376,15 +3375,16 @@ fn leading_negative_unary_operator_on_double_generates_rir_instruction() { &expect![[r#" Blocks: Block 0:Block: - Call id(1), args( Qubit(0), Result(0), ) - Variable(0, Boolean) = Call id(2), args( Result(0), ) + Call id(1), args( Pointer, ) + Call id(2), args( Qubit(0), Result(0), ) + Variable(0, Boolean) = Call id(3), args( Result(0), ) Variable(1, Boolean) = Icmp Eq, Variable(0, Boolean), Bool(false) Branch Variable(1, Boolean), 2, 3 Block 1:Block: Variable(3, Double) = Store Variable(2, Double) Variable(4, Double) = Fmul Double(-1), Variable(3, Double) Variable(5, Double) = Store Variable(4, Double) - Call id(3), args( Variable(5, Double), Tag(0, 3), ) + Call id(4), args( Variable(5, Double), Tag(0, 3), ) Return Block 2:Block: Variable(2, Double) = Store Double(0) @@ -3415,11 +3415,10 @@ fn double_add_with_lhs_classical_double_and_rhs_dynamic_double() { measurement_callable_id, &expect![[r#" Callable: - name: __quantum__qis__mresetz__body - call_type: Measurement + name: __quantum__rt__initialize + call_type: Regular input_type: - [0]: Qubit - [1]: Result + [0]: Pointer output_type: body: "#]], ); @@ -3429,11 +3428,12 @@ fn double_add_with_lhs_classical_double_and_rhs_dynamic_double() { readout_callable_id, &expect![[r#" Callable: - name: __quantum__rt__read_result - call_type: Readout + name: __quantum__qis__mresetz__body + call_type: Measurement input_type: - [0]: Result - output_type: Boolean + [0]: Qubit + [1]: Result + output_type: body: "#]], ); let output_record_id = CallableId(3); @@ -3442,12 +3442,11 @@ fn double_add_with_lhs_classical_double_and_rhs_dynamic_double() { output_record_id, &expect![[r#" Callable: - name: __quantum__rt__double_record_output - call_type: OutputRecording + name: __quantum__rt__read_result + call_type: Readout input_type: - [0]: Double - [1]: Pointer - output_type: + [0]: Result + output_type: Boolean body: "#]], ); assert_blocks( @@ -3455,15 +3454,16 @@ fn double_add_with_lhs_classical_double_and_rhs_dynamic_double() { &expect![[r#" Blocks: Block 0:Block: - Call id(1), args( Qubit(0), Result(0), ) - Variable(0, Boolean) = Call id(2), args( Result(0), ) + Call id(1), args( Pointer, ) + Call id(2), args( Qubit(0), Result(0), ) + Variable(0, Boolean) = Call id(3), args( Result(0), ) Variable(1, Boolean) = Icmp Eq, Variable(0, Boolean), Bool(false) Branch Variable(1, Boolean), 2, 3 Block 1:Block: Variable(3, Double) = Store Variable(2, Double) Variable(4, Double) = Fadd Double(1), Variable(3, Double) Variable(5, Double) = Store Variable(4, Double) - Call id(3), args( Variable(5, Double), Tag(0, 3), ) + Call id(4), args( Variable(5, Double), Tag(0, 3), ) Return Block 2:Block: Variable(2, Double) = Store Double(0) @@ -3494,11 +3494,10 @@ fn double_sub_with_lhs_dynamic_double_and_rhs_classical_double() { measurement_callable_id, &expect![[r#" Callable: - name: __quantum__qis__mresetz__body - call_type: Measurement + name: __quantum__rt__initialize + call_type: Regular input_type: - [0]: Qubit - [1]: Result + [0]: Pointer output_type: body: "#]], ); @@ -3508,11 +3507,12 @@ fn double_sub_with_lhs_dynamic_double_and_rhs_classical_double() { readout_callable_id, &expect![[r#" Callable: - name: __quantum__rt__read_result - call_type: Readout + name: __quantum__qis__mresetz__body + call_type: Measurement input_type: - [0]: Result - output_type: Boolean + [0]: Qubit + [1]: Result + output_type: body: "#]], ); let output_record_id = CallableId(3); @@ -3521,12 +3521,11 @@ fn double_sub_with_lhs_dynamic_double_and_rhs_classical_double() { output_record_id, &expect![[r#" Callable: - name: __quantum__rt__double_record_output - call_type: OutputRecording + name: __quantum__rt__read_result + call_type: Readout input_type: - [0]: Double - [1]: Pointer - output_type: + [0]: Result + output_type: Boolean body: "#]], ); assert_blocks( @@ -3534,15 +3533,16 @@ fn double_sub_with_lhs_dynamic_double_and_rhs_classical_double() { &expect![[r#" Blocks: Block 0:Block: - Call id(1), args( Qubit(0), Result(0), ) - Variable(0, Boolean) = Call id(2), args( Result(0), ) + Call id(1), args( Pointer, ) + Call id(2), args( Qubit(0), Result(0), ) + Variable(0, Boolean) = Call id(3), args( Result(0), ) Variable(1, Boolean) = Icmp Eq, Variable(0, Boolean), Bool(false) Branch Variable(1, Boolean), 2, 3 Block 1:Block: Variable(3, Double) = Store Variable(2, Double) Variable(4, Double) = Fsub Variable(3, Double), Double(1) Variable(5, Double) = Store Variable(4, Double) - Call id(3), args( Variable(5, Double), Tag(0, 3), ) + Call id(4), args( Variable(5, Double), Tag(0, 3), ) Return Block 2:Block: Variable(2, Double) = Store Double(0) @@ -3574,11 +3574,10 @@ fn double_mul_with_lhs_dynamic_double_and_rhs_dynamic_double() { measurement_callable_id, &expect![[r#" Callable: - name: __quantum__qis__mresetz__body - call_type: Measurement + name: __quantum__rt__initialize + call_type: Regular input_type: - [0]: Qubit - [1]: Result + [0]: Pointer output_type: body: "#]], ); @@ -3588,11 +3587,12 @@ fn double_mul_with_lhs_dynamic_double_and_rhs_dynamic_double() { readout_callable_id, &expect![[r#" Callable: - name: __quantum__rt__read_result - call_type: Readout + name: __quantum__qis__mresetz__body + call_type: Measurement input_type: - [0]: Result - output_type: Boolean + [0]: Qubit + [1]: Result + output_type: body: "#]], ); let output_record_id = CallableId(3); @@ -3601,12 +3601,11 @@ fn double_mul_with_lhs_dynamic_double_and_rhs_dynamic_double() { output_record_id, &expect![[r#" Callable: - name: __quantum__rt__double_record_output - call_type: OutputRecording + name: __quantum__rt__read_result + call_type: Readout input_type: - [0]: Double - [1]: Pointer - output_type: + [0]: Result + output_type: Boolean body: "#]], ); assert_blocks( @@ -3614,14 +3613,15 @@ fn double_mul_with_lhs_dynamic_double_and_rhs_dynamic_double() { &expect![[r#" Blocks: Block 0:Block: - Call id(1), args( Qubit(0), Result(0), ) - Variable(0, Boolean) = Call id(2), args( Result(0), ) + Call id(1), args( Pointer, ) + Call id(2), args( Qubit(0), Result(0), ) + Variable(0, Boolean) = Call id(3), args( Result(0), ) Variable(1, Boolean) = Icmp Eq, Variable(0, Boolean), Bool(false) Branch Variable(1, Boolean), 2, 3 Block 1:Block: Variable(3, Double) = Store Variable(2, Double) - Call id(1), args( Qubit(0), Result(1), ) - Variable(4, Boolean) = Call id(2), args( Result(1), ) + Call id(2), args( Qubit(0), Result(1), ) + Variable(4, Boolean) = Call id(3), args( Result(1), ) Variable(5, Boolean) = Icmp Eq, Variable(4, Boolean), Bool(false) Branch Variable(5, Boolean), 5, 6 Block 2:Block: @@ -3634,7 +3634,7 @@ fn double_mul_with_lhs_dynamic_double_and_rhs_dynamic_double() { Variable(7, Double) = Store Variable(6, Double) Variable(8, Double) = Fmul Variable(3, Double), Variable(7, Double) Variable(9, Double) = Store Variable(8, Double) - Call id(3), args( Variable(9, Double), Tag(0, 3), ) + Call id(4), args( Variable(9, Double), Tag(0, 3), ) Return Block 5:Block: Variable(6, Double) = Store Double(1.1) @@ -3665,11 +3665,10 @@ fn double_div_with_lhs_classical_double_and_rhs_dynamic_double() { measurement_callable_id, &expect![[r#" Callable: - name: __quantum__qis__mresetz__body - call_type: Measurement + name: __quantum__rt__initialize + call_type: Regular input_type: - [0]: Qubit - [1]: Result + [0]: Pointer output_type: body: "#]], ); @@ -3679,11 +3678,12 @@ fn double_div_with_lhs_classical_double_and_rhs_dynamic_double() { readout_callable_id, &expect![[r#" Callable: - name: __quantum__rt__read_result - call_type: Readout + name: __quantum__qis__mresetz__body + call_type: Measurement input_type: - [0]: Result - output_type: Boolean + [0]: Qubit + [1]: Result + output_type: body: "#]], ); let output_record_id = CallableId(3); @@ -3692,12 +3692,11 @@ fn double_div_with_lhs_classical_double_and_rhs_dynamic_double() { output_record_id, &expect![[r#" Callable: - name: __quantum__rt__double_record_output - call_type: OutputRecording + name: __quantum__rt__read_result + call_type: Readout input_type: - [0]: Double - [1]: Pointer - output_type: + [0]: Result + output_type: Boolean body: "#]], ); assert_blocks( @@ -3705,15 +3704,16 @@ fn double_div_with_lhs_classical_double_and_rhs_dynamic_double() { &expect![[r#" Blocks: Block 0:Block: - Call id(1), args( Qubit(0), Result(0), ) - Variable(0, Boolean) = Call id(2), args( Result(0), ) + Call id(1), args( Pointer, ) + Call id(2), args( Qubit(0), Result(0), ) + Variable(0, Boolean) = Call id(3), args( Result(0), ) Variable(1, Boolean) = Icmp Eq, Variable(0, Boolean), Bool(false) Branch Variable(1, Boolean), 2, 3 Block 1:Block: Variable(3, Double) = Store Variable(2, Double) Variable(4, Double) = Fdiv Double(1), Variable(3, Double) Variable(5, Double) = Store Variable(4, Double) - Call id(3), args( Variable(5, Double), Tag(0, 3), ) + Call id(4), args( Variable(5, Double), Tag(0, 3), ) Return Block 2:Block: Variable(2, Double) = Store Double(0) @@ -3766,11 +3766,10 @@ fn double_equality_comparison_with_lhs_dynamic_double_and_rhs_classical_double() measurement_callable_id, &expect![[r#" Callable: - name: __quantum__qis__mresetz__body - call_type: Measurement + name: __quantum__rt__initialize + call_type: Regular input_type: - [0]: Qubit - [1]: Result + [0]: Pointer output_type: body: "#]], ); @@ -3780,11 +3779,12 @@ fn double_equality_comparison_with_lhs_dynamic_double_and_rhs_classical_double() readout_callable_id, &expect![[r#" Callable: - name: __quantum__rt__read_result - call_type: Readout + name: __quantum__qis__mresetz__body + call_type: Measurement input_type: - [0]: Result - output_type: Boolean + [0]: Qubit + [1]: Result + output_type: body: "#]], ); let output_record_id = CallableId(3); @@ -3793,12 +3793,11 @@ fn double_equality_comparison_with_lhs_dynamic_double_and_rhs_classical_double() output_record_id, &expect![[r#" Callable: - name: __quantum__rt__bool_record_output - call_type: OutputRecording + name: __quantum__rt__read_result + call_type: Readout input_type: - [0]: Boolean - [1]: Pointer - output_type: + [0]: Result + output_type: Boolean body: "#]], ); assert_blocks( @@ -3806,15 +3805,16 @@ fn double_equality_comparison_with_lhs_dynamic_double_and_rhs_classical_double() &expect![[r#" Blocks: Block 0:Block: - Call id(1), args( Qubit(0), Result(0), ) - Variable(0, Boolean) = Call id(2), args( Result(0), ) + Call id(1), args( Pointer, ) + Call id(2), args( Qubit(0), Result(0), ) + Variable(0, Boolean) = Call id(3), args( Result(0), ) Variable(1, Boolean) = Icmp Eq, Variable(0, Boolean), Bool(false) Branch Variable(1, Boolean), 2, 3 Block 1:Block: Variable(3, Double) = Store Variable(2, Double) Variable(4, Boolean) = Fcmp Oeq, Variable(3, Double), Double(1) Variable(5, Boolean) = Store Variable(4, Boolean) - Call id(3), args( Variable(5, Boolean), Tag(0, 3), ) + Call id(4), args( Variable(5, Boolean), Tag(0, 3), ) Return Block 2:Block: Variable(2, Double) = Store Double(0) @@ -3846,11 +3846,10 @@ fn double_inequality_comparison_with_lhs_dynamic_double_and_rhs_dynamic_double() measurement_callable_id, &expect![[r#" Callable: - name: __quantum__qis__mresetz__body - call_type: Measurement + name: __quantum__rt__initialize + call_type: Regular input_type: - [0]: Qubit - [1]: Result + [0]: Pointer output_type: body: "#]], ); @@ -3860,11 +3859,12 @@ fn double_inequality_comparison_with_lhs_dynamic_double_and_rhs_dynamic_double() readout_callable_id, &expect![[r#" Callable: - name: __quantum__rt__read_result - call_type: Readout + name: __quantum__qis__mresetz__body + call_type: Measurement input_type: - [0]: Result - output_type: Boolean + [0]: Qubit + [1]: Result + output_type: body: "#]], ); let output_record_id = CallableId(3); @@ -3873,12 +3873,11 @@ fn double_inequality_comparison_with_lhs_dynamic_double_and_rhs_dynamic_double() output_record_id, &expect![[r#" Callable: - name: __quantum__rt__bool_record_output - call_type: OutputRecording + name: __quantum__rt__read_result + call_type: Readout input_type: - [0]: Boolean - [1]: Pointer - output_type: + [0]: Result + output_type: Boolean body: "#]], ); assert_blocks( @@ -3886,14 +3885,15 @@ fn double_inequality_comparison_with_lhs_dynamic_double_and_rhs_dynamic_double() &expect![[r#" Blocks: Block 0:Block: - Call id(1), args( Qubit(0), Result(0), ) - Variable(0, Boolean) = Call id(2), args( Result(0), ) + Call id(1), args( Pointer, ) + Call id(2), args( Qubit(0), Result(0), ) + Variable(0, Boolean) = Call id(3), args( Result(0), ) Variable(1, Boolean) = Icmp Eq, Variable(0, Boolean), Bool(false) Branch Variable(1, Boolean), 2, 3 Block 1:Block: Variable(3, Double) = Store Variable(2, Double) - Call id(1), args( Qubit(0), Result(1), ) - Variable(4, Boolean) = Call id(2), args( Result(1), ) + Call id(2), args( Qubit(0), Result(1), ) + Variable(4, Boolean) = Call id(3), args( Result(1), ) Variable(5, Boolean) = Icmp Eq, Variable(4, Boolean), Bool(false) Branch Variable(5, Boolean), 5, 6 Block 2:Block: @@ -3906,7 +3906,7 @@ fn double_inequality_comparison_with_lhs_dynamic_double_and_rhs_dynamic_double() Variable(7, Double) = Store Variable(6, Double) Variable(8, Boolean) = Fcmp One, Variable(3, Double), Variable(7, Double) Variable(9, Boolean) = Store Variable(8, Boolean) - Call id(3), args( Variable(9, Boolean), Tag(0, 3), ) + Call id(4), args( Variable(9, Boolean), Tag(0, 3), ) Return Block 5:Block: Variable(6, Double) = Store Double(1.1) @@ -3937,11 +3937,10 @@ fn double_greater_than_comparison_with_lhs_classical_double_and_rhs_dynamic_doub measurement_callable_id, &expect![[r#" Callable: - name: __quantum__qis__mresetz__body - call_type: Measurement + name: __quantum__rt__initialize + call_type: Regular input_type: - [0]: Qubit - [1]: Result + [0]: Pointer output_type: body: "#]], ); @@ -3951,11 +3950,12 @@ fn double_greater_than_comparison_with_lhs_classical_double_and_rhs_dynamic_doub readout_callable_id, &expect![[r#" Callable: - name: __quantum__rt__read_result - call_type: Readout + name: __quantum__qis__mresetz__body + call_type: Measurement input_type: - [0]: Result - output_type: Boolean + [0]: Qubit + [1]: Result + output_type: body: "#]], ); let output_record_id = CallableId(3); @@ -3964,12 +3964,11 @@ fn double_greater_than_comparison_with_lhs_classical_double_and_rhs_dynamic_doub output_record_id, &expect![[r#" Callable: - name: __quantum__rt__bool_record_output - call_type: OutputRecording + name: __quantum__rt__read_result + call_type: Readout input_type: - [0]: Boolean - [1]: Pointer - output_type: + [0]: Result + output_type: Boolean body: "#]], ); assert_blocks( @@ -3977,15 +3976,16 @@ fn double_greater_than_comparison_with_lhs_classical_double_and_rhs_dynamic_doub &expect![[r#" Blocks: Block 0:Block: - Call id(1), args( Qubit(0), Result(0), ) - Variable(0, Boolean) = Call id(2), args( Result(0), ) + Call id(1), args( Pointer, ) + Call id(2), args( Qubit(0), Result(0), ) + Variable(0, Boolean) = Call id(3), args( Result(0), ) Variable(1, Boolean) = Icmp Eq, Variable(0, Boolean), Bool(false) Branch Variable(1, Boolean), 2, 3 Block 1:Block: Variable(3, Double) = Store Variable(2, Double) Variable(4, Boolean) = Fcmp Ogt, Double(1), Variable(3, Double) Variable(5, Boolean) = Store Variable(4, Boolean) - Call id(3), args( Variable(5, Boolean), Tag(0, 3), ) + Call id(4), args( Variable(5, Boolean), Tag(0, 3), ) Return Block 2:Block: Variable(2, Double) = Store Double(0) @@ -4016,11 +4016,10 @@ fn double_greater_or_equal_than_comparison_with_lhs_dynamic_double_and_rhs_class measurement_callable_id, &expect![[r#" Callable: - name: __quantum__qis__mresetz__body - call_type: Measurement + name: __quantum__rt__initialize + call_type: Regular input_type: - [0]: Qubit - [1]: Result + [0]: Pointer output_type: body: "#]], ); @@ -4030,11 +4029,12 @@ fn double_greater_or_equal_than_comparison_with_lhs_dynamic_double_and_rhs_class readout_callable_id, &expect![[r#" Callable: - name: __quantum__rt__read_result - call_type: Readout + name: __quantum__qis__mresetz__body + call_type: Measurement input_type: - [0]: Result - output_type: Boolean + [0]: Qubit + [1]: Result + output_type: body: "#]], ); let output_record_id = CallableId(3); @@ -4043,12 +4043,11 @@ fn double_greater_or_equal_than_comparison_with_lhs_dynamic_double_and_rhs_class output_record_id, &expect![[r#" Callable: - name: __quantum__rt__bool_record_output - call_type: OutputRecording + name: __quantum__rt__read_result + call_type: Readout input_type: - [0]: Boolean - [1]: Pointer - output_type: + [0]: Result + output_type: Boolean body: "#]], ); assert_blocks( @@ -4056,15 +4055,16 @@ fn double_greater_or_equal_than_comparison_with_lhs_dynamic_double_and_rhs_class &expect![[r#" Blocks: Block 0:Block: - Call id(1), args( Qubit(0), Result(0), ) - Variable(0, Boolean) = Call id(2), args( Result(0), ) + Call id(1), args( Pointer, ) + Call id(2), args( Qubit(0), Result(0), ) + Variable(0, Boolean) = Call id(3), args( Result(0), ) Variable(1, Boolean) = Icmp Eq, Variable(0, Boolean), Bool(false) Branch Variable(1, Boolean), 2, 3 Block 1:Block: Variable(3, Double) = Store Variable(2, Double) Variable(4, Boolean) = Fcmp Oge, Variable(3, Double), Double(1) Variable(5, Boolean) = Store Variable(4, Boolean) - Call id(3), args( Variable(5, Boolean), Tag(0, 3), ) + Call id(4), args( Variable(5, Boolean), Tag(0, 3), ) Return Block 2:Block: Variable(2, Double) = Store Double(0) @@ -4096,11 +4096,10 @@ fn double_less_than_comparison_with_lhs_dynamic_double_and_rhs_dynamic_double() measurement_callable_id, &expect![[r#" Callable: - name: __quantum__qis__mresetz__body - call_type: Measurement + name: __quantum__rt__initialize + call_type: Regular input_type: - [0]: Qubit - [1]: Result + [0]: Pointer output_type: body: "#]], ); @@ -4110,11 +4109,12 @@ fn double_less_than_comparison_with_lhs_dynamic_double_and_rhs_dynamic_double() readout_callable_id, &expect![[r#" Callable: - name: __quantum__rt__read_result - call_type: Readout + name: __quantum__qis__mresetz__body + call_type: Measurement input_type: - [0]: Result - output_type: Boolean + [0]: Qubit + [1]: Result + output_type: body: "#]], ); let output_record_id = CallableId(3); @@ -4123,12 +4123,11 @@ fn double_less_than_comparison_with_lhs_dynamic_double_and_rhs_dynamic_double() output_record_id, &expect![[r#" Callable: - name: __quantum__rt__bool_record_output - call_type: OutputRecording + name: __quantum__rt__read_result + call_type: Readout input_type: - [0]: Boolean - [1]: Pointer - output_type: + [0]: Result + output_type: Boolean body: "#]], ); assert_blocks( @@ -4136,14 +4135,15 @@ fn double_less_than_comparison_with_lhs_dynamic_double_and_rhs_dynamic_double() &expect![[r#" Blocks: Block 0:Block: - Call id(1), args( Qubit(0), Result(0), ) - Variable(0, Boolean) = Call id(2), args( Result(0), ) + Call id(1), args( Pointer, ) + Call id(2), args( Qubit(0), Result(0), ) + Variable(0, Boolean) = Call id(3), args( Result(0), ) Variable(1, Boolean) = Icmp Eq, Variable(0, Boolean), Bool(false) Branch Variable(1, Boolean), 2, 3 Block 1:Block: Variable(3, Double) = Store Variable(2, Double) - Call id(1), args( Qubit(0), Result(1), ) - Variable(4, Boolean) = Call id(2), args( Result(1), ) + Call id(2), args( Qubit(0), Result(1), ) + Variable(4, Boolean) = Call id(3), args( Result(1), ) Variable(5, Boolean) = Icmp Eq, Variable(4, Boolean), Bool(false) Branch Variable(5, Boolean), 5, 6 Block 2:Block: @@ -4156,7 +4156,7 @@ fn double_less_than_comparison_with_lhs_dynamic_double_and_rhs_dynamic_double() Variable(7, Double) = Store Variable(6, Double) Variable(8, Boolean) = Fcmp Olt, Variable(3, Double), Variable(7, Double) Variable(9, Boolean) = Store Variable(8, Boolean) - Call id(3), args( Variable(9, Boolean), Tag(0, 3), ) + Call id(4), args( Variable(9, Boolean), Tag(0, 3), ) Return Block 5:Block: Variable(6, Double) = Store Double(1.1) @@ -4187,11 +4187,10 @@ fn double_less_or_equal_than_comparison_with_lhs_classical_double_and_rhs_dynami measurement_callable_id, &expect![[r#" Callable: - name: __quantum__qis__mresetz__body - call_type: Measurement + name: __quantum__rt__initialize + call_type: Regular input_type: - [0]: Qubit - [1]: Result + [0]: Pointer output_type: body: "#]], ); @@ -4201,11 +4200,12 @@ fn double_less_or_equal_than_comparison_with_lhs_classical_double_and_rhs_dynami readout_callable_id, &expect![[r#" Callable: - name: __quantum__rt__read_result - call_type: Readout + name: __quantum__qis__mresetz__body + call_type: Measurement input_type: - [0]: Result - output_type: Boolean + [0]: Qubit + [1]: Result + output_type: body: "#]], ); let output_record_id = CallableId(3); @@ -4214,12 +4214,11 @@ fn double_less_or_equal_than_comparison_with_lhs_classical_double_and_rhs_dynami output_record_id, &expect![[r#" Callable: - name: __quantum__rt__bool_record_output - call_type: OutputRecording + name: __quantum__rt__read_result + call_type: Readout input_type: - [0]: Boolean - [1]: Pointer - output_type: + [0]: Result + output_type: Boolean body: "#]], ); assert_blocks( @@ -4227,15 +4226,16 @@ fn double_less_or_equal_than_comparison_with_lhs_classical_double_and_rhs_dynami &expect![[r#" Blocks: Block 0:Block: - Call id(1), args( Qubit(0), Result(0), ) - Variable(0, Boolean) = Call id(2), args( Result(0), ) + Call id(1), args( Pointer, ) + Call id(2), args( Qubit(0), Result(0), ) + Variable(0, Boolean) = Call id(3), args( Result(0), ) Variable(1, Boolean) = Icmp Eq, Variable(0, Boolean), Bool(false) Branch Variable(1, Boolean), 2, 3 Block 1:Block: Variable(3, Double) = Store Variable(2, Double) Variable(4, Boolean) = Fcmp Ole, Double(1), Variable(3, Double) Variable(5, Boolean) = Store Variable(4, Boolean) - Call id(3), args( Variable(5, Boolean), Tag(0, 3), ) + Call id(4), args( Variable(5, Boolean), Tag(0, 3), ) Return Block 2:Block: Variable(2, Double) = Store Double(0) diff --git a/source/compiler/qsc_partial_eval/src/tests/output_recording.rs b/source/compiler/qsc_partial_eval/src/tests/output_recording.rs index 38972d1cf1..b68902b223 100644 --- a/source/compiler/qsc_partial_eval/src/tests/output_recording.rs +++ b/source/compiler/qsc_partial_eval/src/tests/output_recording.rs @@ -1,6 +1,7 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. +#![allow(clippy::too_many_lines)] use super::{assert_error, get_partial_evaluation_error, get_rir_program}; use expect_test::expect; use indoc::indoc; @@ -31,6 +32,13 @@ fn output_recording_for_tuple_of_different_types() { output_type: Integer body: 0 Callable 1: Callable: + name: __quantum__rt__initialize + call_type: Regular + input_type: + [0]: Pointer + output_type: + body: + Callable 2: Callable: name: __quantum__qis__mresetz__body call_type: Measurement input_type: @@ -38,14 +46,14 @@ fn output_recording_for_tuple_of_different_types() { [1]: Result output_type: body: - Callable 2: Callable: + Callable 3: Callable: name: __quantum__rt__read_result call_type: Readout input_type: [0]: Result output_type: Boolean body: - Callable 3: Callable: + Callable 4: Callable: name: __quantum__rt__tuple_record_output call_type: OutputRecording input_type: @@ -53,7 +61,7 @@ fn output_recording_for_tuple_of_different_types() { [1]: Pointer output_type: body: - Callable 4: Callable: + Callable 5: Callable: name: __quantum__rt__result_record_output call_type: OutputRecording input_type: @@ -61,7 +69,7 @@ fn output_recording_for_tuple_of_different_types() { [1]: Pointer output_type: body: - Callable 5: Callable: + Callable 6: Callable: name: __quantum__rt__bool_record_output call_type: OutputRecording input_type: @@ -71,12 +79,13 @@ fn output_recording_for_tuple_of_different_types() { body: blocks: Block 0: Block: - Call id(1), args( Qubit(0), Result(0), ) - Variable(0, Boolean) = Call id(2), args( Result(0), ) + Call id(1), args( Pointer, ) + Call id(2), args( Qubit(0), Result(0), ) + Variable(0, Boolean) = Call id(3), args( Result(0), ) Variable(1, Boolean) = Icmp Eq, Variable(0, Boolean), Bool(false) - Call id(3), args( Integer(2), EmptyTag, ) - Call id(4), args( Result(0), Tag(0, 5), ) - Call id(5), args( Variable(1, Boolean), Tag(1, 5), ) + Call id(4), args( Integer(2), EmptyTag, ) + Call id(5), args( Result(0), Tag(0, 5), ) + Call id(6), args( Variable(1, Boolean), Tag(1, 5), ) Return config: Config: capabilities: TargetCapabilityFlags(Adaptive | IntegerComputations | FloatingPointComputations | BackwardsBranching | HigherLevelConstructs | QubitReset) @@ -115,6 +124,13 @@ fn output_recording_for_nested_tuples() { output_type: Integer body: 0 Callable 1: Callable: + name: __quantum__rt__initialize + call_type: Regular + input_type: + [0]: Pointer + output_type: + body: + Callable 2: Callable: name: __quantum__qis__mresetz__body call_type: Measurement input_type: @@ -122,14 +138,14 @@ fn output_recording_for_nested_tuples() { [1]: Result output_type: body: - Callable 2: Callable: + Callable 3: Callable: name: __quantum__rt__read_result call_type: Readout input_type: [0]: Result output_type: Boolean body: - Callable 3: Callable: + Callable 4: Callable: name: __quantum__rt__tuple_record_output call_type: OutputRecording input_type: @@ -137,7 +153,7 @@ fn output_recording_for_nested_tuples() { [1]: Pointer output_type: body: - Callable 4: Callable: + Callable 5: Callable: name: __quantum__rt__result_record_output call_type: OutputRecording input_type: @@ -145,7 +161,7 @@ fn output_recording_for_nested_tuples() { [1]: Pointer output_type: body: - Callable 5: Callable: + Callable 6: Callable: name: __quantum__rt__bool_record_output call_type: OutputRecording input_type: @@ -155,18 +171,19 @@ fn output_recording_for_nested_tuples() { body: blocks: Block 0: Block: - Call id(1), args( Qubit(0), Result(0), ) - Variable(0, Boolean) = Call id(2), args( Result(0), ) + Call id(1), args( Pointer, ) + Call id(2), args( Qubit(0), Result(0), ) + Variable(0, Boolean) = Call id(3), args( Result(0), ) Variable(1, Boolean) = Icmp Eq, Variable(0, Boolean), Bool(false) - Variable(2, Boolean) = Call id(2), args( Result(0), ) + Variable(2, Boolean) = Call id(3), args( Result(0), ) Variable(3, Boolean) = Store Variable(2, Boolean) - Call id(3), args( Integer(3), EmptyTag, ) - Call id(4), args( Result(0), Tag(0, 5), ) - Call id(3), args( Integer(2), EmptyTag, ) - Call id(5), args( Variable(1, Boolean), Tag(1, 7), ) - Call id(4), args( Result(0), Tag(2, 7), ) - Call id(3), args( Integer(1), EmptyTag, ) - Call id(5), args( Variable(3, Boolean), Tag(3, 7), ) + Call id(4), args( Integer(3), EmptyTag, ) + Call id(5), args( Result(0), Tag(0, 5), ) + Call id(4), args( Integer(2), EmptyTag, ) + Call id(6), args( Variable(1, Boolean), Tag(1, 7), ) + Call id(5), args( Result(0), Tag(2, 7), ) + Call id(4), args( Integer(1), EmptyTag, ) + Call id(6), args( Variable(3, Boolean), Tag(3, 7), ) Return config: Config: capabilities: TargetCapabilityFlags(Adaptive | IntegerComputations | FloatingPointComputations | BackwardsBranching | HigherLevelConstructs | QubitReset) @@ -209,6 +226,13 @@ fn output_recording_for_tuple_of_arrays() { output_type: Integer body: 0 Callable 1: Callable: + name: __quantum__rt__initialize + call_type: Regular + input_type: + [0]: Pointer + output_type: + body: + Callable 2: Callable: name: __quantum__qis__mresetz__body call_type: Measurement input_type: @@ -216,14 +240,14 @@ fn output_recording_for_tuple_of_arrays() { [1]: Result output_type: body: - Callable 2: Callable: + Callable 3: Callable: name: __quantum__rt__read_result call_type: Readout input_type: [0]: Result output_type: Boolean body: - Callable 3: Callable: + Callable 4: Callable: name: __quantum__rt__tuple_record_output call_type: OutputRecording input_type: @@ -231,7 +255,7 @@ fn output_recording_for_tuple_of_arrays() { [1]: Pointer output_type: body: - Callable 4: Callable: + Callable 5: Callable: name: __quantum__rt__result_record_output call_type: OutputRecording input_type: @@ -239,7 +263,7 @@ fn output_recording_for_tuple_of_arrays() { [1]: Pointer output_type: body: - Callable 5: Callable: + Callable 6: Callable: name: __quantum__rt__array_record_output call_type: OutputRecording input_type: @@ -247,7 +271,7 @@ fn output_recording_for_tuple_of_arrays() { [1]: Pointer output_type: body: - Callable 6: Callable: + Callable 7: Callable: name: __quantum__rt__bool_record_output call_type: OutputRecording input_type: @@ -257,16 +281,17 @@ fn output_recording_for_tuple_of_arrays() { body: blocks: Block 0: Block: - Call id(1), args( Qubit(0), Result(0), ) - Variable(0, Boolean) = Call id(2), args( Result(0), ) + Call id(1), args( Pointer, ) + Call id(2), args( Qubit(0), Result(0), ) + Variable(0, Boolean) = Call id(3), args( Result(0), ) Variable(1, Boolean) = Icmp Eq, Variable(0, Boolean), Bool(false) - Variable(2, Boolean) = Call id(2), args( Result(0), ) + Variable(2, Boolean) = Call id(3), args( Result(0), ) Variable(3, Boolean) = Store Variable(2, Boolean) - Call id(3), args( Integer(2), EmptyTag, ) - Call id(4), args( Result(0), Tag(0, 5), ) - Call id(5), args( Integer(2), EmptyTag, ) - Call id(6), args( Variable(1, Boolean), Tag(1, 7), ) - Call id(6), args( Variable(3, Boolean), Tag(2, 7), ) + Call id(4), args( Integer(2), EmptyTag, ) + Call id(5), args( Result(0), Tag(0, 5), ) + Call id(6), args( Integer(2), EmptyTag, ) + Call id(7), args( Variable(1, Boolean), Tag(1, 7), ) + Call id(7), args( Variable(3, Boolean), Tag(2, 7), ) Return config: Config: capabilities: TargetCapabilityFlags(Adaptive | IntegerComputations | FloatingPointComputations | BackwardsBranching | HigherLevelConstructs | QubitReset) @@ -306,6 +331,13 @@ fn output_recording_for_array_of_tuples() { output_type: Integer body: 0 Callable 1: Callable: + name: __quantum__rt__initialize + call_type: Regular + input_type: + [0]: Pointer + output_type: + body: + Callable 2: Callable: name: __quantum__qis__mresetz__body call_type: Measurement input_type: @@ -313,14 +345,14 @@ fn output_recording_for_array_of_tuples() { [1]: Result output_type: body: - Callable 2: Callable: + Callable 3: Callable: name: __quantum__rt__read_result call_type: Readout input_type: [0]: Result output_type: Boolean body: - Callable 3: Callable: + Callable 4: Callable: name: __quantum__rt__array_record_output call_type: OutputRecording input_type: @@ -328,7 +360,7 @@ fn output_recording_for_array_of_tuples() { [1]: Pointer output_type: body: - Callable 4: Callable: + Callable 5: Callable: name: __quantum__rt__tuple_record_output call_type: OutputRecording input_type: @@ -336,7 +368,7 @@ fn output_recording_for_array_of_tuples() { [1]: Pointer output_type: body: - Callable 5: Callable: + Callable 6: Callable: name: __quantum__rt__result_record_output call_type: OutputRecording input_type: @@ -344,7 +376,7 @@ fn output_recording_for_array_of_tuples() { [1]: Pointer output_type: body: - Callable 6: Callable: + Callable 7: Callable: name: __quantum__rt__bool_record_output call_type: OutputRecording input_type: @@ -354,18 +386,19 @@ fn output_recording_for_array_of_tuples() { body: blocks: Block 0: Block: - Call id(1), args( Qubit(0), Result(0), ) - Variable(0, Boolean) = Call id(2), args( Result(0), ) + Call id(1), args( Pointer, ) + Call id(2), args( Qubit(0), Result(0), ) + Variable(0, Boolean) = Call id(3), args( Result(0), ) Variable(1, Boolean) = Icmp Eq, Variable(0, Boolean), Bool(false) - Variable(2, Boolean) = Call id(2), args( Result(0), ) + Variable(2, Boolean) = Call id(3), args( Result(0), ) Variable(3, Boolean) = Store Variable(2, Boolean) - Call id(3), args( Integer(2), EmptyTag, ) Call id(4), args( Integer(2), EmptyTag, ) - Call id(5), args( Result(0), Tag(0, 7), ) - Call id(6), args( Variable(1, Boolean), Tag(1, 7), ) - Call id(4), args( Integer(2), EmptyTag, ) - Call id(5), args( Result(0), Tag(2, 7), ) - Call id(6), args( Variable(3, Boolean), Tag(3, 7), ) + Call id(5), args( Integer(2), EmptyTag, ) + Call id(6), args( Result(0), Tag(0, 7), ) + Call id(7), args( Variable(1, Boolean), Tag(1, 7), ) + Call id(5), args( Integer(2), EmptyTag, ) + Call id(6), args( Result(0), Tag(2, 7), ) + Call id(7), args( Variable(3, Boolean), Tag(3, 7), ) Return config: Config: capabilities: TargetCapabilityFlags(Adaptive | IntegerComputations | FloatingPointComputations | BackwardsBranching | HigherLevelConstructs | QubitReset) @@ -404,6 +437,13 @@ fn output_recording_for_literal_bool() { output_type: Integer body: 0 Callable 1: Callable: + name: __quantum__rt__initialize + call_type: Regular + input_type: + [0]: Pointer + output_type: + body: + Callable 2: Callable: name: __quantum__rt__bool_record_output call_type: OutputRecording input_type: @@ -413,7 +453,8 @@ fn output_recording_for_literal_bool() { body: blocks: Block 0: Block: - Call id(1), args( Bool(true), Tag(0, 3), ) + Call id(1), args( Pointer, ) + Call id(2), args( Bool(true), Tag(0, 3), ) Return config: Config: capabilities: TargetCapabilityFlags(Adaptive | IntegerComputations | FloatingPointComputations | BackwardsBranching | HigherLevelConstructs | QubitReset) @@ -449,6 +490,13 @@ fn output_recording_for_literal_double() { output_type: Integer body: 0 Callable 1: Callable: + name: __quantum__rt__initialize + call_type: Regular + input_type: + [0]: Pointer + output_type: + body: + Callable 2: Callable: name: __quantum__rt__double_record_output call_type: OutputRecording input_type: @@ -458,7 +506,8 @@ fn output_recording_for_literal_double() { body: blocks: Block 0: Block: - Call id(1), args( Double(42.1), Tag(0, 3), ) + Call id(1), args( Pointer, ) + Call id(2), args( Double(42.1), Tag(0, 3), ) Return config: Config: capabilities: TargetCapabilityFlags(Adaptive | IntegerComputations | FloatingPointComputations | BackwardsBranching | HigherLevelConstructs | QubitReset) @@ -494,6 +543,13 @@ fn output_recording_for_literal_int() { output_type: Integer body: 0 Callable 1: Callable: + name: __quantum__rt__initialize + call_type: Regular + input_type: + [0]: Pointer + output_type: + body: + Callable 2: Callable: name: __quantum__rt__int_record_output call_type: OutputRecording input_type: @@ -503,7 +559,8 @@ fn output_recording_for_literal_int() { body: blocks: Block 0: Block: - Call id(1), args( Integer(42), Tag(0, 3), ) + Call id(1), args( Pointer, ) + Call id(2), args( Integer(42), Tag(0, 3), ) Return config: Config: capabilities: TargetCapabilityFlags(Adaptive | IntegerComputations | FloatingPointComputations | BackwardsBranching | HigherLevelConstructs | QubitReset) @@ -541,6 +598,13 @@ fn output_recording_for_mix_of_literal_and_variable() { output_type: Integer body: 0 Callable 1: Callable: + name: __quantum__rt__initialize + call_type: Regular + input_type: + [0]: Pointer + output_type: + body: + Callable 2: Callable: name: __quantum__qis__mresetz__body call_type: Measurement input_type: @@ -548,7 +612,7 @@ fn output_recording_for_mix_of_literal_and_variable() { [1]: Result output_type: body: - Callable 2: Callable: + Callable 3: Callable: name: __quantum__rt__tuple_record_output call_type: OutputRecording input_type: @@ -556,7 +620,7 @@ fn output_recording_for_mix_of_literal_and_variable() { [1]: Pointer output_type: body: - Callable 3: Callable: + Callable 4: Callable: name: __quantum__rt__result_record_output call_type: OutputRecording input_type: @@ -564,7 +628,7 @@ fn output_recording_for_mix_of_literal_and_variable() { [1]: Pointer output_type: body: - Callable 4: Callable: + Callable 5: Callable: name: __quantum__rt__bool_record_output call_type: OutputRecording input_type: @@ -574,10 +638,11 @@ fn output_recording_for_mix_of_literal_and_variable() { body: blocks: Block 0: Block: - Call id(1), args( Qubit(0), Result(0), ) - Call id(2), args( Integer(2), EmptyTag, ) - Call id(3), args( Result(0), Tag(0, 5), ) - Call id(4), args( Bool(true), Tag(1, 5), ) + Call id(1), args( Pointer, ) + Call id(2), args( Qubit(0), Result(0), ) + Call id(3), args( Integer(2), EmptyTag, ) + Call id(4), args( Result(0), Tag(0, 5), ) + Call id(5), args( Bool(true), Tag(1, 5), ) Return config: Config: capabilities: TargetCapabilityFlags(Adaptive | IntegerComputations | FloatingPointComputations | BackwardsBranching | HigherLevelConstructs | QubitReset) diff --git a/source/compiler/qsc_partial_eval/src/tests/qubits.rs b/source/compiler/qsc_partial_eval/src/tests/qubits.rs index 3fa358988e..570f6f7a19 100644 --- a/source/compiler/qsc_partial_eval/src/tests/qubits.rs +++ b/source/compiler/qsc_partial_eval/src/tests/qubits.rs @@ -26,27 +26,27 @@ fn qubit_ids_are_correct_for_allocate_use_release_one_qubit() { }); expect![[r#" Callable: - name: op + name: __quantum__rt__initialize call_type: Regular input_type: - [0]: Qubit + [0]: Pointer output_type: body: "#]] .assert_eq(&program.get_callable(CallableId(1)).to_string()); expect![[r#" Callable: - name: __quantum__rt__tuple_record_output - call_type: OutputRecording + name: op + call_type: Regular input_type: - [0]: Integer - [1]: Pointer + [0]: Qubit output_type: body: "#]] .assert_eq(&program.get_callable(CallableId(2)).to_string()); expect![[r#" Block: - Call id(1), args( Qubit(0), ) - Call id(2), args( Integer(0), EmptyTag, ) + Call id(1), args( Pointer, ) + Call id(2), args( Qubit(0), ) + Call id(3), args( Integer(0), EmptyTag, ) Return"#]] .assert_eq(&program.get_block(BlockId(0)).to_string()); } @@ -77,37 +77,37 @@ fn qubit_ids_are_correct_for_allocate_use_release_multiple_qubits() { &program, op_callable_id, &expect![[r#" - Callable: - name: op - call_type: Regular - input_type: - [0]: Qubit - output_type: - body: "#]], + Callable: + name: __quantum__rt__initialize + call_type: Regular + input_type: + [0]: Pointer + output_type: + body: "#]], ); let tuple_callable_id = CallableId(2); assert_callable( &program, tuple_callable_id, &expect![[r#" - Callable: - name: __quantum__rt__tuple_record_output - call_type: OutputRecording - input_type: - [0]: Integer - [1]: Pointer - output_type: - body: "#]], + Callable: + name: op + call_type: Regular + input_type: + [0]: Qubit + output_type: + body: "#]], ); assert_block_instructions( &program, BlockId(0), &expect![[r#" Block: - Call id(1), args( Qubit(0), ) - Call id(1), args( Qubit(1), ) - Call id(1), args( Qubit(2), ) - Call id(2), args( Integer(0), EmptyTag, ) + Call id(1), args( Pointer, ) + Call id(2), args( Qubit(0), ) + Call id(2), args( Qubit(1), ) + Call id(2), args( Qubit(2), ) + Call id(3), args( Integer(0), EmptyTag, ) Return"#]], ); assert_eq!(program.num_qubits, 3); @@ -140,37 +140,37 @@ fn qubit_ids_are_correct_for_allocate_use_release_one_qubit_multiple_times() { &program, op_callable_id, &expect![[r#" - Callable: - name: op - call_type: Regular - input_type: - [0]: Qubit - output_type: - body: "#]], + Callable: + name: __quantum__rt__initialize + call_type: Regular + input_type: + [0]: Pointer + output_type: + body: "#]], ); let tuple_callable_id = CallableId(2); assert_callable( &program, tuple_callable_id, &expect![[r#" - Callable: - name: __quantum__rt__tuple_record_output - call_type: OutputRecording - input_type: - [0]: Integer - [1]: Pointer - output_type: - body: "#]], + Callable: + name: op + call_type: Regular + input_type: + [0]: Qubit + output_type: + body: "#]], ); assert_block_instructions( &program, BlockId(0), &expect![[r#" Block: - Call id(1), args( Qubit(0), ) - Call id(1), args( Qubit(0), ) - Call id(1), args( Qubit(0), ) - Call id(2), args( Integer(0), EmptyTag, ) + Call id(1), args( Pointer, ) + Call id(2), args( Qubit(0), ) + Call id(2), args( Qubit(0), ) + Call id(2), args( Qubit(0), ) + Call id(3), args( Integer(0), EmptyTag, ) Return"#]], ); assert_eq!(program.num_qubits, 1); @@ -209,39 +209,39 @@ fn qubit_ids_are_correct_for_allocate_use_release_multiple_qubits_interleaved() &program, op_callable_id, &expect![[r#" - Callable: - name: op - call_type: Regular - input_type: - [0]: Qubit - output_type: - body: "#]], + Callable: + name: __quantum__rt__initialize + call_type: Regular + input_type: + [0]: Pointer + output_type: + body: "#]], ); let tuple_callable_id = CallableId(2); assert_callable( &program, tuple_callable_id, &expect![[r#" - Callable: - name: __quantum__rt__tuple_record_output - call_type: OutputRecording - input_type: - [0]: Integer - [1]: Pointer - output_type: - body: "#]], + Callable: + name: op + call_type: Regular + input_type: + [0]: Qubit + output_type: + body: "#]], ); assert_block_instructions( &program, BlockId(0), &expect![[r#" Block: - Call id(1), args( Qubit(0), ) - Call id(1), args( Qubit(1), ) - Call id(1), args( Qubit(2), ) - Call id(1), args( Qubit(2), ) - Call id(1), args( Qubit(3), ) - Call id(2), args( Integer(0), EmptyTag, ) + Call id(1), args( Pointer, ) + Call id(2), args( Qubit(0), ) + Call id(2), args( Qubit(1), ) + Call id(2), args( Qubit(2), ) + Call id(2), args( Qubit(2), ) + Call id(2), args( Qubit(3), ) + Call id(3), args( Integer(0), EmptyTag, ) Return"#]], ); assert_eq!(program.num_qubits, 4); @@ -270,10 +270,10 @@ fn qubit_array_allocation_and_access() { op_callable_id, &expect![[r#" Callable: - name: Op + name: __quantum__rt__initialize call_type: Regular input_type: - [0]: Qubit + [0]: Pointer output_type: body: "#]], ); @@ -282,32 +282,32 @@ fn qubit_array_allocation_and_access() { &program, tuple_record_callable_id, &expect![[r#" - Callable: - name: __quantum__rt__tuple_record_output - call_type: OutputRecording - input_type: - [0]: Integer - [1]: Pointer - output_type: - body: "#]], + Callable: + name: Op + call_type: Regular + input_type: + [0]: Qubit + output_type: + body: "#]], ); assert_block_instructions( &program, BlockId(0), &expect![[r#" Block: + Call id(1), args( Pointer, ) Variable(0, Integer) = Store Integer(0) Variable(0, Integer) = Store Integer(1) Variable(0, Integer) = Store Integer(2) Variable(0, Integer) = Store Integer(3) - Call id(1), args( Qubit(0), ) - Call id(1), args( Qubit(1), ) - Call id(1), args( Qubit(2), ) + Call id(2), args( Qubit(0), ) + Call id(2), args( Qubit(1), ) + Call id(2), args( Qubit(2), ) Variable(1, Integer) = Store Integer(0) Variable(1, Integer) = Store Integer(1) Variable(1, Integer) = Store Integer(2) Variable(1, Integer) = Store Integer(3) - Call id(2), args( Integer(0), EmptyTag, ) + Call id(3), args( Integer(0), EmptyTag, ) Return"#]], ); assert_eq!(program.num_qubits, 3); diff --git a/source/compiler/qsc_partial_eval/src/tests/results.rs b/source/compiler/qsc_partial_eval/src/tests/results.rs index 72b6aa8669..5664420c84 100644 --- a/source/compiler/qsc_partial_eval/src/tests/results.rs +++ b/source/compiler/qsc_partial_eval/src/tests/results.rs @@ -25,35 +25,35 @@ fn result_ids_are_correct_for_measuring_and_resetting_one_qubit() { &program, op_callable_id, &expect![[r#" - Callable: - name: __quantum__qis__mresetz__body - call_type: Measurement - input_type: - [0]: Qubit - [1]: Result - output_type: - body: "#]], + Callable: + name: __quantum__rt__initialize + call_type: Regular + input_type: + [0]: Pointer + output_type: + body: "#]], ); assert_callable( &program, result_record_id, &expect![[r#" - Callable: - name: __quantum__rt__result_record_output - call_type: OutputRecording - input_type: - [0]: Result - [1]: Pointer - output_type: - body: "#]], + Callable: + name: __quantum__qis__mresetz__body + call_type: Measurement + input_type: + [0]: Qubit + [1]: Result + output_type: + body: "#]], ); assert_block_instructions( &program, BlockId(0), &expect![[r#" Block: - Call id(1), args( Qubit(0), Result(0), ) - Call id(2), args( Result(0), Tag(0, 3), ) + Call id(1), args( Pointer, ) + Call id(2), args( Qubit(0), Result(0), ) + Call id(3), args( Result(0), Tag(0, 3), ) Return"#]], ); assert_eq!(program.num_qubits, 1); @@ -80,11 +80,10 @@ fn result_ids_are_correct_for_measuring_one_qubit() { op_callable_id, &expect![[r#" Callable: - name: __quantum__qis__m__body - call_type: Measurement + name: __quantum__rt__initialize + call_type: Regular input_type: - [0]: Qubit - [1]: Result + [0]: Pointer output_type: body: "#]], ); @@ -92,22 +91,23 @@ fn result_ids_are_correct_for_measuring_one_qubit() { &program, result_record_id, &expect![[r#" - Callable: - name: __quantum__rt__result_record_output - call_type: OutputRecording - input_type: - [0]: Result - [1]: Pointer - output_type: - body: "#]], + Callable: + name: __quantum__qis__m__body + call_type: Measurement + input_type: + [0]: Qubit + [1]: Result + output_type: + body: "#]], ); assert_block_instructions( &program, BlockId(0), &expect![[r#" Block: - Call id(1), args( Qubit(0), Result(0), ) - Call id(2), args( Result(0), Tag(0, 3), ) + Call id(1), args( Pointer, ) + Call id(2), args( Qubit(0), Result(0), ) + Call id(3), args( Result(0), Tag(0, 3), ) Return"#]], ); assert_eq!(program.num_qubits, 1); @@ -137,11 +137,10 @@ fn result_ids_are_correct_for_measuring_one_qubit_multiple_times() { op_callable_id, &expect![[r#" Callable: - name: __quantum__qis__m__body - call_type: Measurement + name: __quantum__rt__initialize + call_type: Regular input_type: - [0]: Qubit - [1]: Result + [0]: Pointer output_type: body: "#]], ); @@ -149,40 +148,41 @@ fn result_ids_are_correct_for_measuring_one_qubit_multiple_times() { &program, tuple_record_id, &expect![[r#" - Callable: - name: __quantum__rt__tuple_record_output - call_type: OutputRecording - input_type: - [0]: Integer - [1]: Pointer - output_type: - body: "#]], + Callable: + name: __quantum__qis__m__body + call_type: Measurement + input_type: + [0]: Qubit + [1]: Result + output_type: + body: "#]], ); assert_callable( &program, result_record_id, &expect![[r#" - Callable: - name: __quantum__rt__result_record_output - call_type: OutputRecording - input_type: - [0]: Result - [1]: Pointer - output_type: - body: "#]], + Callable: + name: __quantum__rt__tuple_record_output + call_type: OutputRecording + input_type: + [0]: Integer + [1]: Pointer + output_type: + body: "#]], ); assert_block_instructions( &program, BlockId(0), &expect![[r#" Block: - Call id(1), args( Qubit(0), Result(0), ) - Call id(1), args( Qubit(0), Result(1), ) - Call id(1), args( Qubit(0), Result(2), ) - Call id(2), args( Integer(3), EmptyTag, ) - Call id(3), args( Result(0), Tag(0, 5), ) - Call id(3), args( Result(1), Tag(1, 5), ) - Call id(3), args( Result(2), Tag(2, 5), ) + Call id(1), args( Pointer, ) + Call id(2), args( Qubit(0), Result(0), ) + Call id(2), args( Qubit(0), Result(1), ) + Call id(2), args( Qubit(0), Result(2), ) + Call id(3), args( Integer(3), EmptyTag, ) + Call id(4), args( Result(0), Tag(0, 5), ) + Call id(4), args( Result(1), Tag(1, 5), ) + Call id(4), args( Result(2), Tag(2, 5), ) Return"#]], ); } @@ -210,11 +210,10 @@ fn result_ids_are_correct_for_measuring_one_qubit_multiple_times_into_array() { op_callable_id, &expect![[r#" Callable: - name: __quantum__qis__m__body - call_type: Measurement + name: __quantum__rt__initialize + call_type: Regular input_type: - [0]: Qubit - [1]: Result + [0]: Pointer output_type: body: "#]], ); @@ -222,40 +221,41 @@ fn result_ids_are_correct_for_measuring_one_qubit_multiple_times_into_array() { &program, array_record_id, &expect![[r#" - Callable: - name: __quantum__rt__array_record_output - call_type: OutputRecording - input_type: - [0]: Integer - [1]: Pointer - output_type: - body: "#]], + Callable: + name: __quantum__qis__m__body + call_type: Measurement + input_type: + [0]: Qubit + [1]: Result + output_type: + body: "#]], ); assert_callable( &program, result_record_id, &expect![[r#" - Callable: - name: __quantum__rt__result_record_output - call_type: OutputRecording - input_type: - [0]: Result - [1]: Pointer - output_type: - body: "#]], + Callable: + name: __quantum__rt__array_record_output + call_type: OutputRecording + input_type: + [0]: Integer + [1]: Pointer + output_type: + body: "#]], ); assert_block_instructions( &program, BlockId(0), &expect![[r#" Block: - Call id(1), args( Qubit(0), Result(0), ) - Call id(1), args( Qubit(0), Result(1), ) - Call id(1), args( Qubit(0), Result(2), ) - Call id(2), args( Integer(3), EmptyTag, ) - Call id(3), args( Result(0), Tag(0, 5), ) - Call id(3), args( Result(1), Tag(1, 5), ) - Call id(3), args( Result(2), Tag(2, 5), ) + Call id(1), args( Pointer, ) + Call id(2), args( Qubit(0), Result(0), ) + Call id(2), args( Qubit(0), Result(1), ) + Call id(2), args( Qubit(0), Result(2), ) + Call id(3), args( Integer(3), EmptyTag, ) + Call id(4), args( Result(0), Tag(0, 5), ) + Call id(4), args( Result(1), Tag(1, 5), ) + Call id(4), args( Result(2), Tag(2, 5), ) Return"#]], ); assert_eq!(program.num_qubits, 1); @@ -285,11 +285,10 @@ fn result_ids_are_correct_for_measuring_multiple_qubits() { op_callable_id, &expect![[r#" Callable: - name: __quantum__qis__m__body - call_type: Measurement + name: __quantum__rt__initialize + call_type: Regular input_type: - [0]: Qubit - [1]: Result + [0]: Pointer output_type: body: "#]], ); @@ -297,40 +296,41 @@ fn result_ids_are_correct_for_measuring_multiple_qubits() { &program, tuple_record_id, &expect![[r#" - Callable: - name: __quantum__rt__tuple_record_output - call_type: OutputRecording - input_type: - [0]: Integer - [1]: Pointer - output_type: - body: "#]], + Callable: + name: __quantum__qis__m__body + call_type: Measurement + input_type: + [0]: Qubit + [1]: Result + output_type: + body: "#]], ); assert_callable( &program, result_record_id, &expect![[r#" - Callable: - name: __quantum__rt__result_record_output - call_type: OutputRecording - input_type: - [0]: Result - [1]: Pointer - output_type: - body: "#]], + Callable: + name: __quantum__rt__tuple_record_output + call_type: OutputRecording + input_type: + [0]: Integer + [1]: Pointer + output_type: + body: "#]], ); assert_block_instructions( &program, BlockId(0), &expect![[r#" Block: - Call id(1), args( Qubit(0), Result(0), ) - Call id(1), args( Qubit(1), Result(1), ) - Call id(1), args( Qubit(2), Result(2), ) - Call id(2), args( Integer(3), EmptyTag, ) - Call id(3), args( Result(0), Tag(0, 5), ) - Call id(3), args( Result(1), Tag(1, 5), ) - Call id(3), args( Result(2), Tag(2, 5), ) + Call id(1), args( Pointer, ) + Call id(2), args( Qubit(0), Result(0), ) + Call id(2), args( Qubit(1), Result(1), ) + Call id(2), args( Qubit(2), Result(2), ) + Call id(3), args( Integer(3), EmptyTag, ) + Call id(4), args( Result(0), Tag(0, 5), ) + Call id(4), args( Result(1), Tag(1, 5), ) + Call id(4), args( Result(2), Tag(2, 5), ) Return"#]], ); assert_eq!(program.num_qubits, 3); diff --git a/source/compiler/qsc_partial_eval/src/tests/returns.rs b/source/compiler/qsc_partial_eval/src/tests/returns.rs index 0230664854..ef860dd260 100644 --- a/source/compiler/qsc_partial_eval/src/tests/returns.rs +++ b/source/compiler/qsc_partial_eval/src/tests/returns.rs @@ -31,21 +31,21 @@ fn non_classical_entry_point_with_classical_implicit_return() { &program, output_recording_callable_id, &expect![[r#" - Callable: - name: __quantum__rt__bool_record_output - call_type: OutputRecording - input_type: - [0]: Boolean - [1]: Pointer - output_type: - body: "#]], + Callable: + name: __quantum__rt__initialize + call_type: Regular + input_type: + [0]: Pointer + output_type: + body: "#]], ); assert_block_instructions( &program, BlockId(0), &expect![[r#" Block: - Call id(1), args( Bool(true), Tag(0, 3), ) + Call id(1), args( Pointer, ) + Call id(2), args( Bool(true), Tag(0, 3), ) Return"#]], ); } @@ -67,11 +67,10 @@ fn non_classical_entry_point_with_non_classical_implicit_return() { mresetz_callable_id, &expect![[r#" Callable: - name: __quantum__qis__mresetz__body - call_type: Measurement + name: __quantum__rt__initialize + call_type: Regular input_type: - [0]: Qubit - [1]: Result + [0]: Pointer output_type: body: "#]], ); @@ -81,11 +80,11 @@ fn non_classical_entry_point_with_non_classical_implicit_return() { output_recording_callable_id, &expect![[r#" Callable: - name: __quantum__rt__result_record_output - call_type: OutputRecording + name: __quantum__qis__mresetz__body + call_type: Measurement input_type: - [0]: Result - [1]: Pointer + [0]: Qubit + [1]: Result output_type: body: "#]], ); @@ -94,8 +93,9 @@ fn non_classical_entry_point_with_non_classical_implicit_return() { BlockId(0), &expect![[r#" Block: - Call id(1), args( Qubit(0), Result(0), ) - Call id(2), args( Result(0), Tag(0, 3), ) + Call id(1), args( Pointer, ) + Call id(2), args( Qubit(0), Result(0), ) + Call id(3), args( Result(0), Tag(0, 3), ) Return"#]], ); } @@ -116,21 +116,21 @@ fn non_classical_entry_point_with_classical_explicit_return() { &program, output_recording_callable_id, &expect![[r#" - Callable: - name: __quantum__rt__bool_record_output - call_type: OutputRecording - input_type: - [0]: Boolean - [1]: Pointer - output_type: - body: "#]], + Callable: + name: __quantum__rt__initialize + call_type: Regular + input_type: + [0]: Pointer + output_type: + body: "#]], ); assert_block_instructions( &program, BlockId(0), &expect![[r#" Block: - Call id(1), args( Bool(false), Tag(0, 3), ) + Call id(1), args( Pointer, ) + Call id(2), args( Bool(false), Tag(0, 3), ) Return"#]], ); } @@ -152,11 +152,10 @@ fn non_classical_entry_point_with_non_classical_explicit_return() { mresetz_callable_id, &expect![[r#" Callable: - name: __quantum__qis__mresetz__body - call_type: Measurement + name: __quantum__rt__initialize + call_type: Regular input_type: - [0]: Qubit - [1]: Result + [0]: Pointer output_type: body: "#]], ); @@ -166,11 +165,11 @@ fn non_classical_entry_point_with_non_classical_explicit_return() { output_recording_callable_id, &expect![[r#" Callable: - name: __quantum__rt__result_record_output - call_type: OutputRecording + name: __quantum__qis__mresetz__body + call_type: Measurement input_type: - [0]: Result - [1]: Pointer + [0]: Qubit + [1]: Result output_type: body: "#]], ); @@ -179,8 +178,9 @@ fn non_classical_entry_point_with_non_classical_explicit_return() { BlockId(0), &expect![[r#" Block: - Call id(1), args( Qubit(0), Result(0), ) - Call id(2), args( Result(0), Tag(0, 3), ) + Call id(1), args( Pointer, ) + Call id(2), args( Qubit(0), Result(0), ) + Call id(3), args( Result(0), Tag(0, 3), ) Return"#]], ); } @@ -205,35 +205,35 @@ fn non_classical_entry_point_with_classical_inline_early_return_halts_evaluation &program, op_a_callable_id, &expect![[r#" - Callable: - name: OpA - call_type: Regular - input_type: - [0]: Qubit - output_type: - body: "#]], + Callable: + name: __quantum__rt__initialize + call_type: Regular + input_type: + [0]: Pointer + output_type: + body: "#]], ); let output_recording_callable_id = CallableId(2); assert_callable( &program, output_recording_callable_id, &expect![[r#" - Callable: - name: __quantum__rt__tuple_record_output - call_type: OutputRecording - input_type: - [0]: Integer - [1]: Pointer - output_type: - body: "#]], + Callable: + name: OpA + call_type: Regular + input_type: + [0]: Qubit + output_type: + body: "#]], ); assert_block_instructions( &program, BlockId(0), &expect![[r#" Block: - Call id(1), args( Qubit(0), ) - Call id(2), args( Integer(0), EmptyTag, ) + Call id(1), args( Pointer, ) + Call id(2), args( Qubit(0), ) + Call id(3), args( Integer(0), EmptyTag, ) Return"#]], ); } @@ -256,11 +256,10 @@ fn non_classical_entry_point_with_non_classical_inline_early_return_halts_evalua mresetz_callable_id, &expect![[r#" Callable: - name: __quantum__qis__mresetz__body - call_type: Measurement + name: __quantum__rt__initialize + call_type: Regular input_type: - [0]: Qubit - [1]: Result + [0]: Pointer output_type: body: "#]], ); @@ -270,11 +269,11 @@ fn non_classical_entry_point_with_non_classical_inline_early_return_halts_evalua output_recording_callable_id, &expect![[r#" Callable: - name: __quantum__rt__result_record_output - call_type: OutputRecording + name: __quantum__qis__mresetz__body + call_type: Measurement input_type: - [0]: Result - [1]: Pointer + [0]: Qubit + [1]: Result output_type: body: "#]], ); @@ -283,8 +282,9 @@ fn non_classical_entry_point_with_non_classical_inline_early_return_halts_evalua BlockId(0), &expect![[r#" Block: - Call id(1), args( Qubit(0), Result(0), ) - Call id(2), args( Result(0), Tag(0, 3), ) + Call id(1), args( Pointer, ) + Call id(2), args( Qubit(0), Result(0), ) + Call id(3), args( Result(0), Tag(0, 3), ) Return"#]], ); } @@ -313,13 +313,13 @@ fn non_classical_entry_point_with_classical_early_return_within_classical_branch &program, op_a_callable_id, &expect![[r#" - Callable: - name: OpA - call_type: Regular - input_type: - [0]: Qubit - output_type: - body: "#]], + Callable: + name: __quantum__rt__initialize + call_type: Regular + input_type: + [0]: Pointer + output_type: + body: "#]], ); let output_recording_callable_id = CallableId(2); assert_callable( @@ -327,11 +327,10 @@ fn non_classical_entry_point_with_classical_early_return_within_classical_branch output_recording_callable_id, &expect![[r#" Callable: - name: __quantum__rt__bool_record_output - call_type: OutputRecording + name: OpA + call_type: Regular input_type: - [0]: Boolean - [1]: Pointer + [0]: Qubit output_type: body: "#]], ); @@ -340,8 +339,9 @@ fn non_classical_entry_point_with_classical_early_return_within_classical_branch BlockId(0), &expect![[r#" Block: - Call id(1), args( Qubit(0), ) - Call id(2), args( Bool(true), Tag(0, 3), ) + Call id(1), args( Pointer, ) + Call id(2), args( Qubit(0), ) + Call id(3), args( Bool(true), Tag(0, 3), ) Return"#]], ); } @@ -423,11 +423,10 @@ fn non_classical_entry_point_with_early_return_after_branching_halts_evaluation( mresetz_callable_id, &expect![[r#" Callable: - name: __quantum__qis__mresetz__body - call_type: Measurement + name: __quantum__rt__initialize + call_type: Regular input_type: - [0]: Qubit - [1]: Result + [0]: Pointer output_type: body: "#]], ); @@ -437,11 +436,12 @@ fn non_classical_entry_point_with_early_return_after_branching_halts_evaluation( read_result_callable_id, &expect![[r#" Callable: - name: __quantum__rt__read_result - call_type: Readout + name: __quantum__qis__mresetz__body + call_type: Measurement input_type: - [0]: Result - output_type: Boolean + [0]: Qubit + [1]: Result + output_type: body: "#]], ); let op_a_callable_id = CallableId(3); @@ -449,39 +449,39 @@ fn non_classical_entry_point_with_early_return_after_branching_halts_evaluation( &program, op_a_callable_id, &expect![[r#" - Callable: - name: OpA - call_type: Regular - input_type: - [0]: Qubit - output_type: - body: "#]], + Callable: + name: __quantum__rt__read_result + call_type: Readout + input_type: + [0]: Result + output_type: Boolean + body: "#]], ); let op_b_callable_id = CallableId(4); assert_callable( &program, op_b_callable_id, &expect![[r#" - Callable: - name: OpB - call_type: Regular - input_type: - [0]: Qubit - output_type: - body: "#]], + Callable: + name: OpA + call_type: Regular + input_type: + [0]: Qubit + output_type: + body: "#]], ); let op_c_callable_id = CallableId(5); assert_callable( &program, op_c_callable_id, &expect![[r#" - Callable: - name: OpC - call_type: Regular - input_type: - [0]: Qubit - output_type: - body: "#]], + Callable: + name: OpB + call_type: Regular + input_type: + [0]: Qubit + output_type: + body: "#]], ); let output_recording_callable_id = CallableId(6); assert_callable( @@ -489,11 +489,10 @@ fn non_classical_entry_point_with_early_return_after_branching_halts_evaluation( output_recording_callable_id, &expect![[r#" Callable: - name: __quantum__rt__tuple_record_output - call_type: OutputRecording + name: OpC + call_type: Regular input_type: - [0]: Integer - [1]: Pointer + [0]: Qubit output_type: body: "#]], ); @@ -502,19 +501,20 @@ fn non_classical_entry_point_with_early_return_after_branching_halts_evaluation( &expect![[r#" Blocks: Block 0:Block: - Call id(1), args( Qubit(0), Result(0), ) - Variable(0, Boolean) = Call id(2), args( Result(0), ) + Call id(1), args( Pointer, ) + Call id(2), args( Qubit(0), Result(0), ) + Variable(0, Boolean) = Call id(3), args( Result(0), ) Variable(1, Boolean) = Icmp Eq, Variable(0, Boolean), Bool(false) Branch Variable(1, Boolean), 2, 3 Block 1:Block: - Call id(5), args( Qubit(1), ) - Call id(6), args( Integer(0), EmptyTag, ) + Call id(6), args( Qubit(1), ) + Call id(7), args( Integer(0), EmptyTag, ) Return Block 2:Block: - Call id(3), args( Qubit(1), ) + Call id(4), args( Qubit(1), ) Jump(1) Block 3:Block: - Call id(4), args( Qubit(1), ) + Call id(5), args( Qubit(1), ) Jump(1)"#]], ); } @@ -548,11 +548,10 @@ fn operation_with_early_return_within_dynamic_branch_halts_evaluation_at_the_cal mresetz_callable_id, &expect![[r#" Callable: - name: __quantum__qis__mresetz__body - call_type: Measurement + name: __quantum__rt__initialize + call_type: Regular input_type: - [0]: Qubit - [1]: Result + [0]: Pointer output_type: body: "#]], ); @@ -562,11 +561,12 @@ fn operation_with_early_return_within_dynamic_branch_halts_evaluation_at_the_cal read_result_callable_id, &expect![[r#" Callable: - name: __quantum__rt__read_result - call_type: Readout + name: __quantum__qis__mresetz__body + call_type: Measurement input_type: - [0]: Result - output_type: Boolean + [0]: Qubit + [1]: Result + output_type: body: "#]], ); let op_a_callable_id = CallableId(3); @@ -574,26 +574,26 @@ fn operation_with_early_return_within_dynamic_branch_halts_evaluation_at_the_cal &program, op_a_callable_id, &expect![[r#" - Callable: - name: OpA - call_type: Regular - input_type: - [0]: Qubit - output_type: - body: "#]], + Callable: + name: __quantum__rt__read_result + call_type: Readout + input_type: + [0]: Result + output_type: Boolean + body: "#]], ); let op_b_callable_id = CallableId(4); assert_callable( &program, op_b_callable_id, &expect![[r#" - Callable: - name: OpB - call_type: Regular - input_type: - [0]: Qubit - output_type: - body: "#]], + Callable: + name: OpA + call_type: Regular + input_type: + [0]: Qubit + output_type: + body: "#]], ); let output_recording_callable_id = CallableId(5); assert_callable( @@ -601,11 +601,10 @@ fn operation_with_early_return_within_dynamic_branch_halts_evaluation_at_the_cal output_recording_callable_id, &expect![[r#" Callable: - name: __quantum__rt__tuple_record_output - call_type: OutputRecording + name: OpB + call_type: Regular input_type: - [0]: Integer - [1]: Pointer + [0]: Qubit output_type: body: "#]], ); @@ -614,16 +613,17 @@ fn operation_with_early_return_within_dynamic_branch_halts_evaluation_at_the_cal &expect![[r#" Blocks: Block 0:Block: - Call id(1), args( Qubit(0), Result(0), ) - Variable(0, Boolean) = Call id(2), args( Result(0), ) + Call id(1), args( Pointer, ) + Call id(2), args( Qubit(0), Result(0), ) + Variable(0, Boolean) = Call id(3), args( Result(0), ) Variable(1, Boolean) = Icmp Eq, Variable(0, Boolean), Bool(false) Branch Variable(1, Boolean), 2, 1 Block 1:Block: - Call id(4), args( Qubit(0), ) - Call id(5), args( Integer(0), EmptyTag, ) + Call id(5), args( Qubit(0), ) + Call id(6), args( Integer(0), EmptyTag, ) Return Block 2:Block: - Call id(3), args( Qubit(0), ) + Call id(4), args( Qubit(0), ) Jump(1)"#]], ); } @@ -655,36 +655,37 @@ fn default_qubit_management_releases_qubits_when_they_are_out_of_scope_with_impl &program, op_a_callable_id, &expect![[r#" - Callable: - name: OpA - call_type: Regular - input_type: - [0]: Qubit - output_type: - body: "#]], + Callable: + name: __quantum__rt__initialize + call_type: Regular + input_type: + [0]: Pointer + output_type: + body: "#]], ); let op_b_callable_id = CallableId(2); assert_callable( &program, op_b_callable_id, &expect![[r#" - Callable: - name: OpB - call_type: Regular - input_type: - [0]: Qubit - output_type: - body: "#]], + Callable: + name: OpA + call_type: Regular + input_type: + [0]: Qubit + output_type: + body: "#]], ); assert_block_instructions( &program, BlockId(0), &expect![[r#" Block: - Call id(1), args( Qubit(0), ) + Call id(1), args( Pointer, ) + Call id(2), args( Qubit(0), ) + Call id(3), args( Qubit(1), ) Call id(2), args( Qubit(1), ) - Call id(1), args( Qubit(1), ) - Call id(3), args( Integer(0), EmptyTag, ) + Call id(4), args( Integer(0), EmptyTag, ) Return"#]], ); assert_eq!(program.num_qubits, 2); @@ -719,36 +720,37 @@ fn default_qubit_management_releases_qubits_when_they_are_out_of_scope_with_expl &program, op_a_callable_id, &expect![[r#" - Callable: - name: OpA - call_type: Regular - input_type: - [0]: Qubit - output_type: - body: "#]], + Callable: + name: __quantum__rt__initialize + call_type: Regular + input_type: + [0]: Pointer + output_type: + body: "#]], ); let op_b_callable_id = CallableId(2); assert_callable( &program, op_b_callable_id, &expect![[r#" - Callable: - name: OpB - call_type: Regular - input_type: - [0]: Qubit - output_type: - body: "#]], + Callable: + name: OpA + call_type: Regular + input_type: + [0]: Qubit + output_type: + body: "#]], ); assert_block_instructions( &program, BlockId(0), &expect![[r#" Block: - Call id(1), args( Qubit(0), ) + Call id(1), args( Pointer, ) + Call id(2), args( Qubit(0), ) + Call id(3), args( Qubit(1), ) Call id(2), args( Qubit(1), ) - Call id(1), args( Qubit(1), ) - Call id(3), args( Integer(0), EmptyTag, ) + Call id(4), args( Integer(0), EmptyTag, ) Return"#]], ); assert_eq!(program.num_qubits, 2); @@ -785,36 +787,37 @@ fn default_qubit_management_releases_qubits_when_they_are_out_of_scope_with_expl &program, op_a_callable_id, &expect![[r#" - Callable: - name: OpA - call_type: Regular - input_type: - [0]: Qubit - output_type: - body: "#]], + Callable: + name: __quantum__rt__initialize + call_type: Regular + input_type: + [0]: Pointer + output_type: + body: "#]], ); let op_b_callable_id = CallableId(2); assert_callable( &program, op_b_callable_id, &expect![[r#" - Callable: - name: OpB - call_type: Regular - input_type: - [0]: Qubit - output_type: - body: "#]], + Callable: + name: OpA + call_type: Regular + input_type: + [0]: Qubit + output_type: + body: "#]], ); assert_block_instructions( &program, BlockId(0), &expect![[r#" Block: - Call id(1), args( Qubit(0), ) + Call id(1), args( Pointer, ) + Call id(2), args( Qubit(0), ) + Call id(3), args( Qubit(1), ) Call id(2), args( Qubit(1), ) - Call id(1), args( Qubit(1), ) - Call id(3), args( Integer(0), EmptyTag, ) + Call id(4), args( Integer(0), EmptyTag, ) Return"#]], ); assert_eq!(program.num_qubits, 2); diff --git a/source/compiler/qsc_qasm/src/tests/expression/function_call.rs b/source/compiler/qsc_qasm/src/tests/expression/function_call.rs index 1d86a2e234..5747e7a1d4 100644 --- a/source/compiler/qsc_qasm/src/tests/expression/function_call.rs +++ b/source/compiler/qsc_qasm/src/tests/expression/function_call.rs @@ -319,12 +319,15 @@ fn simulatable_intrinsic_on_def_stmt_generates_correct_qir() -> miette::Result<( define i64 @ENTRYPOINT__main() #0 { block_0: + call void @__quantum__rt__initialize(i8* null) call void @my_gate(%Qubit* inttoptr (i64 0 to %Qubit*)) call void @__quantum__qis__m__body(%Qubit* inttoptr (i64 0 to %Qubit*), %Result* inttoptr (i64 0 to %Result*)) call void @__quantum__rt__tuple_record_output(i64 0, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @empty_tag, i64 0, i64 0)) ret i64 0 } + declare void @__quantum__rt__initialize(i8*) + declare void @my_gate(%Qubit*) declare void @__quantum__qis__m__body(%Qubit*, %Result*) #1 diff --git a/source/compiler/qsc_qasm/src/tests/output.rs b/source/compiler/qsc_qasm/src/tests/output.rs index 18b1f4cf35..440adeab1e 100644 --- a/source/compiler/qsc_qasm/src/tests/output.rs +++ b/source/compiler/qsc_qasm/src/tests/output.rs @@ -262,6 +262,7 @@ c2[2] = measure q[4]; define i64 @ENTRYPOINT__main() #0 { block_0: + call void @__quantum__rt__initialize(i8* null) call void @__quantum__qis__rz__body(double 0.4999999999999997, %Qubit* inttoptr (i64 0 to %Qubit*)) call void @__quantum__qis__h__body(%Qubit* inttoptr (i64 0 to %Qubit*)) call void @__quantum__qis__cx__body(%Qubit* inttoptr (i64 0 to %Qubit*), %Qubit* inttoptr (i64 1 to %Qubit*)) @@ -284,6 +285,8 @@ c2[2] = measure q[4]; ret i64 0 } + declare void @__quantum__rt__initialize(i8*) + declare void @__quantum__qis__rz__body(double, %Qubit*) declare void @__quantum__qis__h__body(%Qubit*) diff --git a/source/compiler/qsc_qasm/src/tests/statement/gate_call.rs b/source/compiler/qsc_qasm/src/tests/statement/gate_call.rs index b8320612d3..3867646cdc 100644 --- a/source/compiler/qsc_qasm/src/tests/statement/gate_call.rs +++ b/source/compiler/qsc_qasm/src/tests/statement/gate_call.rs @@ -251,6 +251,7 @@ fn barrier_generates_qir() -> miette::Result<(), Vec> { define i64 @ENTRYPOINT__main() #0 { block_0: + call void @__quantum__rt__initialize(i8* null) call void @__quantum__qis__barrier__body() call void @__quantum__qis__barrier__body() call void @__quantum__qis__barrier__body() @@ -261,6 +262,8 @@ fn barrier_generates_qir() -> miette::Result<(), Vec> { ret i64 0 } + declare void @__quantum__rt__initialize(i8*) + declare void @__quantum__qis__barrier__body() declare void @__quantum__qis__m__body(%Qubit*, %Result*) #1 @@ -612,12 +615,15 @@ fn simulatable_intrinsic_on_gate_stmt_generates_correct_qir() -> miette::Result< define i64 @ENTRYPOINT__main() #0 { block_0: + call void @__quantum__rt__initialize(i8* null) call void @my_gate(%Qubit* inttoptr (i64 0 to %Qubit*)) call void @__quantum__qis__m__body(%Qubit* inttoptr (i64 0 to %Qubit*), %Result* inttoptr (i64 0 to %Result*)) call void @__quantum__rt__tuple_record_output(i64 0, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @empty_tag, i64 0, i64 0)) ret i64 0 } + declare void @__quantum__rt__initialize(i8*) + declare void @my_gate(%Qubit*) declare void @__quantum__qis__m__body(%Qubit*, %Result*) #1 @@ -1098,6 +1104,7 @@ fn qasm2_barrier_generates_qir() -> miette::Result<(), Vec> { define i64 @ENTRYPOINT__main() #0 { block_0: + call void @__quantum__rt__initialize(i8* null) call void @__quantum__qis__barrier__body() call void @__quantum__qis__barrier__body() call void @__quantum__qis__barrier__body() @@ -1108,6 +1115,8 @@ fn qasm2_barrier_generates_qir() -> miette::Result<(), Vec> { ret i64 0 } + declare void @__quantum__rt__initialize(i8*) + declare void @__quantum__qis__barrier__body() declare void @__quantum__qis__m__body(%Qubit*, %Result*) #1 @@ -1360,6 +1369,7 @@ fn qasm2_simulatable_intrinsic_on_gate_stmt_generates_correct_qir() define i64 @ENTRYPOINT__main() #0 { block_0: + call void @__quantum__rt__initialize(i8* null) call void @my_gate(%Qubit* inttoptr (i64 0 to %Qubit*)) call void @__quantum__qis__m__body(%Qubit* inttoptr (i64 0 to %Qubit*), %Result* inttoptr (i64 0 to %Result*)) call void @__quantum__rt__array_record_output(i64 1, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @empty_tag, i64 0, i64 0)) @@ -1367,6 +1377,8 @@ fn qasm2_simulatable_intrinsic_on_gate_stmt_generates_correct_qir() ret i64 0 } + declare void @__quantum__rt__initialize(i8*) + declare void @my_gate(%Qubit*) declare void @__quantum__qis__m__body(%Qubit*, %Result*) #1 diff --git a/source/compiler/qsc_qasm/src/tests/statement/reset.rs b/source/compiler/qsc_qasm/src/tests/statement/reset.rs index ea7afdf68c..f298dece76 100644 --- a/source/compiler/qsc_qasm/src/tests/statement/reset.rs +++ b/source/compiler/qsc_qasm/src/tests/statement/reset.rs @@ -76,6 +76,7 @@ fn reset_with_base_profile_is_rewritten_without_resets() -> miette::Result<(), V define i64 @ENTRYPOINT__main() #0 { block_0: + call void @__quantum__rt__initialize(i8* null) call void @__quantum__qis__h__body(%Qubit* inttoptr (i64 1 to %Qubit*)) call void @__quantum__qis__m__body(%Qubit* inttoptr (i64 1 to %Qubit*), %Result* inttoptr (i64 0 to %Result*)) call void @__quantum__rt__array_record_output(i64 1, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @empty_tag, i64 0, i64 0)) @@ -83,6 +84,8 @@ fn reset_with_base_profile_is_rewritten_without_resets() -> miette::Result<(), V ret i64 0 } + declare void @__quantum__rt__initialize(i8*) + declare void @__quantum__qis__h__body(%Qubit*) declare void @__quantum__qis__m__body(%Qubit*, %Result*) #1 @@ -130,6 +133,7 @@ fn reset_with_adaptive_ri_profile_generates_reset_qir() -> miette::Result<(), Ve define i64 @ENTRYPOINT__main() #0 { block_0: + call void @__quantum__rt__initialize(i8* null) call void @__quantum__qis__reset__body(%Qubit* inttoptr (i64 0 to %Qubit*)) call void @__quantum__qis__h__body(%Qubit* inttoptr (i64 0 to %Qubit*)) call void @__quantum__qis__m__body(%Qubit* inttoptr (i64 0 to %Qubit*), %Result* inttoptr (i64 0 to %Result*)) @@ -138,6 +142,8 @@ fn reset_with_adaptive_ri_profile_generates_reset_qir() -> miette::Result<(), Ve ret i64 0 } + declare void @__quantum__rt__initialize(i8*) + declare void @__quantum__qis__reset__body(%Qubit*) #1 declare void @__quantum__qis__h__body(%Qubit*) diff --git a/source/compiler/qsc_rir/src/builder.rs b/source/compiler/qsc_rir/src/builder.rs index c321dcedd5..60d72fb5a5 100644 --- a/source/compiler/qsc_rir/src/builder.rs +++ b/source/compiler/qsc_rir/src/builder.rs @@ -107,6 +107,17 @@ pub fn read_result_decl() -> Callable { } } +#[must_use] +pub fn initialize_decl() -> Callable { + Callable { + name: "__quantum__rt__initialize".to_string(), + input_type: vec![Ty::Pointer], + output_type: None, + body: None, + call_type: CallableType::Regular, + } +} + #[must_use] pub fn result_record_decl() -> Callable { Callable { diff --git a/source/pip/tests-integration/interop_qiskit/resources/custom_intrinsics.ll b/source/pip/tests-integration/interop_qiskit/resources/custom_intrinsics.ll index 8f06606f95..71bc1f9838 100644 --- a/source/pip/tests-integration/interop_qiskit/resources/custom_intrinsics.ll +++ b/source/pip/tests-integration/interop_qiskit/resources/custom_intrinsics.ll @@ -6,6 +6,7 @@ define i64 @ENTRYPOINT__main() #0 { block_0: + call void @__quantum__rt__initialize(i8* null) call void @my_gate(%Qubit* inttoptr (i64 0 to %Qubit*)) call void @__quantum__qis__m__body(%Qubit* inttoptr (i64 0 to %Qubit*), %Result* inttoptr (i64 0 to %Result*)) call void @__quantum__rt__array_record_output(i64 1, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @empty_tag, i64 0, i64 0)) @@ -13,6 +14,8 @@ block_0: ret i64 0 } +declare void @__quantum__rt__initialize(i8*) + declare void @my_gate(%Qubit*) declare void @__quantum__qis__m__body(%Qubit*, %Result*) #1 diff --git a/source/pip/tests-integration/resources/adaptive_ri/output/ArithmeticOps.ll b/source/pip/tests-integration/resources/adaptive_ri/output/ArithmeticOps.ll index ce1f2ce747..efa6cecefd 100644 --- a/source/pip/tests-integration/resources/adaptive_ri/output/ArithmeticOps.ll +++ b/source/pip/tests-integration/resources/adaptive_ri/output/ArithmeticOps.ll @@ -9,6 +9,7 @@ define i64 @ENTRYPOINT__main() #0 { block_0: + call void @__quantum__rt__initialize(i8* null) call void @__quantum__qis__x__body(%Qubit* inttoptr (i64 0 to %Qubit*)) call void @__quantum__qis__x__body(%Qubit* inttoptr (i64 1 to %Qubit*)) call void @__quantum__qis__x__body(%Qubit* inttoptr (i64 2 to %Qubit*)) @@ -93,6 +94,8 @@ block_10: ret i64 0 } +declare void @__quantum__rt__initialize(i8*) + declare void @__quantum__qis__x__body(%Qubit*) declare void @__quantum__qis__m__body(%Qubit*, %Result*) #1 diff --git a/source/pip/tests-integration/resources/adaptive_ri/output/BernsteinVaziraniNISQ.ll b/source/pip/tests-integration/resources/adaptive_ri/output/BernsteinVaziraniNISQ.ll index a59839ba2d..d3616516e9 100644 --- a/source/pip/tests-integration/resources/adaptive_ri/output/BernsteinVaziraniNISQ.ll +++ b/source/pip/tests-integration/resources/adaptive_ri/output/BernsteinVaziraniNISQ.ll @@ -10,6 +10,7 @@ define i64 @ENTRYPOINT__main() #0 { block_0: + call void @__quantum__rt__initialize(i8* null) call void @__quantum__qis__x__body(%Qubit* inttoptr (i64 5 to %Qubit*)) call void @__quantum__qis__h__body(%Qubit* inttoptr (i64 0 to %Qubit*)) call void @__quantum__qis__h__body(%Qubit* inttoptr (i64 1 to %Qubit*)) @@ -40,6 +41,8 @@ block_0: ret i64 0 } +declare void @__quantum__rt__initialize(i8*) + declare void @__quantum__qis__x__body(%Qubit*) declare void @__quantum__qis__h__body(%Qubit*) diff --git a/source/pip/tests-integration/resources/adaptive_ri/output/ConstantFolding.ll b/source/pip/tests-integration/resources/adaptive_ri/output/ConstantFolding.ll index 511c1a8a9a..0a084401a1 100644 --- a/source/pip/tests-integration/resources/adaptive_ri/output/ConstantFolding.ll +++ b/source/pip/tests-integration/resources/adaptive_ri/output/ConstantFolding.ll @@ -9,6 +9,7 @@ define i64 @ENTRYPOINT__main() #0 { block_0: + call void @__quantum__rt__initialize(i8* null) call void @__quantum__qis__x__body(%Qubit* inttoptr (i64 0 to %Qubit*)) call void @__quantum__qis__cx__body(%Qubit* inttoptr (i64 0 to %Qubit*), %Qubit* inttoptr (i64 1 to %Qubit*)) call void @__quantum__qis__cx__body(%Qubit* inttoptr (i64 0 to %Qubit*), %Qubit* inttoptr (i64 2 to %Qubit*)) @@ -45,6 +46,8 @@ block_0: ret i64 0 } +declare void @__quantum__rt__initialize(i8*) + declare void @__quantum__qis__x__body(%Qubit*) declare void @__quantum__qis__cx__body(%Qubit*, %Qubit*) diff --git a/source/pip/tests-integration/resources/adaptive_ri/output/CopyAndUpdateExpressions.ll b/source/pip/tests-integration/resources/adaptive_ri/output/CopyAndUpdateExpressions.ll index 84478d5058..899d0cde86 100644 --- a/source/pip/tests-integration/resources/adaptive_ri/output/CopyAndUpdateExpressions.ll +++ b/source/pip/tests-integration/resources/adaptive_ri/output/CopyAndUpdateExpressions.ll @@ -10,6 +10,7 @@ define i64 @ENTRYPOINT__main() #0 { block_0: + call void @__quantum__rt__initialize(i8* null) call void @__quantum__qis__x__body(%Qubit* inttoptr (i64 0 to %Qubit*)) call void @__quantum__qis__mresetz__body(%Qubit* inttoptr (i64 0 to %Qubit*), %Result* inttoptr (i64 0 to %Result*)) call void @__quantum__qis__mresetz__body(%Qubit* inttoptr (i64 1 to %Qubit*), %Result* inttoptr (i64 1 to %Result*)) @@ -33,6 +34,8 @@ block_0: ret i64 0 } +declare void @__quantum__rt__initialize(i8*) + declare void @__quantum__qis__x__body(%Qubit*) declare void @__quantum__qis__mresetz__body(%Qubit*, %Result*) #1 diff --git a/source/pip/tests-integration/resources/adaptive_ri/output/DeutschJozsaNISQ.ll b/source/pip/tests-integration/resources/adaptive_ri/output/DeutschJozsaNISQ.ll index c52fb9d010..1d82a7b434 100644 --- a/source/pip/tests-integration/resources/adaptive_ri/output/DeutschJozsaNISQ.ll +++ b/source/pip/tests-integration/resources/adaptive_ri/output/DeutschJozsaNISQ.ll @@ -13,6 +13,7 @@ define i64 @ENTRYPOINT__main() #0 { block_0: + call void @__quantum__rt__initialize(i8* null) call void @__quantum__qis__x__body(%Qubit* inttoptr (i64 4 to %Qubit*)) call void @__quantum__qis__h__body(%Qubit* inttoptr (i64 4 to %Qubit*)) call void @__quantum__qis__h__body(%Qubit* inttoptr (i64 0 to %Qubit*)) @@ -67,6 +68,8 @@ block_0: ret i64 0 } +declare void @__quantum__rt__initialize(i8*) + declare void @__quantum__qis__x__body(%Qubit*) declare void @__quantum__qis__h__body(%Qubit*) diff --git a/source/pip/tests-integration/resources/adaptive_ri/output/ExpandedTests.ll b/source/pip/tests-integration/resources/adaptive_ri/output/ExpandedTests.ll index b3b5594af9..0d964329b8 100644 --- a/source/pip/tests-integration/resources/adaptive_ri/output/ExpandedTests.ll +++ b/source/pip/tests-integration/resources/adaptive_ri/output/ExpandedTests.ll @@ -8,6 +8,7 @@ define i64 @ENTRYPOINT__main() #0 { block_0: + call void @__quantum__rt__initialize(i8* null) call void @__quantum__qis__h__body(%Qubit* inttoptr (i64 0 to %Qubit*)) call void @__quantum__qis__h__body(%Qubit* inttoptr (i64 1 to %Qubit*)) call void @__quantum__qis__x__body(%Qubit* inttoptr (i64 2 to %Qubit*)) @@ -49,6 +50,8 @@ block_0: ret i64 0 } +declare void @__quantum__rt__initialize(i8*) + declare void @__quantum__qis__h__body(%Qubit*) declare void @__quantum__qis__x__body(%Qubit*) diff --git a/source/pip/tests-integration/resources/adaptive_ri/output/Functors.ll b/source/pip/tests-integration/resources/adaptive_ri/output/Functors.ll index 2cb37604ba..aeaed7e33e 100644 --- a/source/pip/tests-integration/resources/adaptive_ri/output/Functors.ll +++ b/source/pip/tests-integration/resources/adaptive_ri/output/Functors.ll @@ -11,6 +11,7 @@ define i64 @ENTRYPOINT__main() #0 { block_0: + call void @__quantum__rt__initialize(i8* null) call void @__quantum__qis__x__body(%Qubit* inttoptr (i64 0 to %Qubit*)) call void @__quantum__qis__h__body(%Qubit* inttoptr (i64 1 to %Qubit*)) call void @__quantum__qis__z__body(%Qubit* inttoptr (i64 1 to %Qubit*)) @@ -85,6 +86,8 @@ block_0: ret i64 0 } +declare void @__quantum__rt__initialize(i8*) + declare void @__quantum__qis__x__body(%Qubit*) declare void @__quantum__qis__h__body(%Qubit*) diff --git a/source/pip/tests-integration/resources/adaptive_ri/output/HiddenShiftNISQ.ll b/source/pip/tests-integration/resources/adaptive_ri/output/HiddenShiftNISQ.ll index 6f2b6d81c3..9c339676ae 100644 --- a/source/pip/tests-integration/resources/adaptive_ri/output/HiddenShiftNISQ.ll +++ b/source/pip/tests-integration/resources/adaptive_ri/output/HiddenShiftNISQ.ll @@ -11,6 +11,7 @@ define i64 @ENTRYPOINT__main() #0 { block_0: + call void @__quantum__rt__initialize(i8* null) call void @__quantum__qis__h__body(%Qubit* inttoptr (i64 0 to %Qubit*)) call void @__quantum__qis__h__body(%Qubit* inttoptr (i64 1 to %Qubit*)) call void @__quantum__qis__h__body(%Qubit* inttoptr (i64 2 to %Qubit*)) @@ -55,6 +56,8 @@ block_0: ret i64 0 } +declare void @__quantum__rt__initialize(i8*) + declare void @__quantum__qis__h__body(%Qubit*) declare void @__quantum__qis__x__body(%Qubit*) diff --git a/source/pip/tests-integration/resources/adaptive_ri/output/IntegerComparison.ll b/source/pip/tests-integration/resources/adaptive_ri/output/IntegerComparison.ll index 5cec7c1928..683a0c2cae 100644 --- a/source/pip/tests-integration/resources/adaptive_ri/output/IntegerComparison.ll +++ b/source/pip/tests-integration/resources/adaptive_ri/output/IntegerComparison.ll @@ -8,6 +8,7 @@ define i64 @ENTRYPOINT__main() #0 { block_0: + call void @__quantum__rt__initialize(i8* null) call void @__quantum__qis__x__body(%Qubit* inttoptr (i64 0 to %Qubit*)) call void @__quantum__qis__m__body(%Qubit* inttoptr (i64 0 to %Qubit*), %Result* inttoptr (i64 0 to %Result*)) %var_2 = call i1 @__quantum__rt__read_result(%Result* inttoptr (i64 0 to %Result*)) @@ -118,6 +119,8 @@ block_20: ret i64 0 } +declare void @__quantum__rt__initialize(i8*) + declare void @__quantum__qis__x__body(%Qubit*) declare void @__quantum__qis__m__body(%Qubit*, %Result*) #1 diff --git a/source/pip/tests-integration/resources/adaptive_ri/output/IntrinsicCCNOT.ll b/source/pip/tests-integration/resources/adaptive_ri/output/IntrinsicCCNOT.ll index 167d728013..1483c0c6b5 100644 --- a/source/pip/tests-integration/resources/adaptive_ri/output/IntrinsicCCNOT.ll +++ b/source/pip/tests-integration/resources/adaptive_ri/output/IntrinsicCCNOT.ll @@ -14,6 +14,7 @@ define i64 @ENTRYPOINT__main() #0 { block_0: + call void @__quantum__rt__initialize(i8* null) call void @__quantum__qis__ccx__body(%Qubit* inttoptr (i64 0 to %Qubit*), %Qubit* inttoptr (i64 1 to %Qubit*), %Qubit* inttoptr (i64 2 to %Qubit*)) call void @__quantum__qis__m__body(%Qubit* inttoptr (i64 0 to %Qubit*), %Result* inttoptr (i64 0 to %Result*)) call void @__quantum__qis__m__body(%Qubit* inttoptr (i64 1 to %Qubit*), %Result* inttoptr (i64 1 to %Result*)) @@ -54,6 +55,8 @@ block_0: ret i64 0 } +declare void @__quantum__rt__initialize(i8*) + declare void @__quantum__qis__ccx__body(%Qubit*, %Qubit*, %Qubit*) declare void @__quantum__qis__m__body(%Qubit*, %Result*) #1 diff --git a/source/pip/tests-integration/resources/adaptive_ri/output/IntrinsicCNOT.ll b/source/pip/tests-integration/resources/adaptive_ri/output/IntrinsicCNOT.ll index 7bc8410395..80f9dbc05e 100644 --- a/source/pip/tests-integration/resources/adaptive_ri/output/IntrinsicCNOT.ll +++ b/source/pip/tests-integration/resources/adaptive_ri/output/IntrinsicCNOT.ll @@ -9,6 +9,7 @@ define i64 @ENTRYPOINT__main() #0 { block_0: + call void @__quantum__rt__initialize(i8* null) call void @__quantum__qis__cx__body(%Qubit* inttoptr (i64 0 to %Qubit*), %Qubit* inttoptr (i64 1 to %Qubit*)) call void @__quantum__qis__m__body(%Qubit* inttoptr (i64 0 to %Qubit*), %Result* inttoptr (i64 0 to %Result*)) call void @__quantum__qis__m__body(%Qubit* inttoptr (i64 1 to %Qubit*), %Result* inttoptr (i64 1 to %Result*)) @@ -30,6 +31,8 @@ block_0: ret i64 0 } +declare void @__quantum__rt__initialize(i8*) + declare void @__quantum__qis__cx__body(%Qubit*, %Qubit*) declare void @__quantum__qis__m__body(%Qubit*, %Result*) #1 diff --git a/source/pip/tests-integration/resources/adaptive_ri/output/IntrinsicHIXYZ.ll b/source/pip/tests-integration/resources/adaptive_ri/output/IntrinsicHIXYZ.ll index 216b1741bf..ca0af6c04d 100644 --- a/source/pip/tests-integration/resources/adaptive_ri/output/IntrinsicHIXYZ.ll +++ b/source/pip/tests-integration/resources/adaptive_ri/output/IntrinsicHIXYZ.ll @@ -11,6 +11,7 @@ define i64 @ENTRYPOINT__main() #0 { block_0: + call void @__quantum__rt__initialize(i8* null) call void @__quantum__qis__h__body(%Qubit* inttoptr (i64 0 to %Qubit*)) call void @__quantum__qis__z__body(%Qubit* inttoptr (i64 0 to %Qubit*)) call void @__quantum__qis__h__body(%Qubit* inttoptr (i64 0 to %Qubit*)) @@ -39,6 +40,8 @@ block_0: ret i64 0 } +declare void @__quantum__rt__initialize(i8*) + declare void @__quantum__qis__h__body(%Qubit*) declare void @__quantum__qis__z__body(%Qubit*) diff --git a/source/pip/tests-integration/resources/adaptive_ri/output/IntrinsicM.ll b/source/pip/tests-integration/resources/adaptive_ri/output/IntrinsicM.ll index 80ea18c59c..aed01fa2ad 100644 --- a/source/pip/tests-integration/resources/adaptive_ri/output/IntrinsicM.ll +++ b/source/pip/tests-integration/resources/adaptive_ri/output/IntrinsicM.ll @@ -7,6 +7,7 @@ define i64 @ENTRYPOINT__main() #0 { block_0: + call void @__quantum__rt__initialize(i8* null) call void @__quantum__qis__m__body(%Qubit* inttoptr (i64 0 to %Qubit*), %Result* inttoptr (i64 0 to %Result*)) call void @__quantum__qis__x__body(%Qubit* inttoptr (i64 1 to %Qubit*)) call void @__quantum__qis__m__body(%Qubit* inttoptr (i64 1 to %Qubit*), %Result* inttoptr (i64 1 to %Result*)) @@ -18,6 +19,8 @@ block_0: ret i64 0 } +declare void @__quantum__rt__initialize(i8*) + declare void @__quantum__qis__m__body(%Qubit*, %Result*) #1 declare void @__quantum__qis__x__body(%Qubit*) diff --git a/source/pip/tests-integration/resources/adaptive_ri/output/IntrinsicMeasureWithBitFlipCode.ll b/source/pip/tests-integration/resources/adaptive_ri/output/IntrinsicMeasureWithBitFlipCode.ll index bdd130dc3a..477d7780d0 100644 --- a/source/pip/tests-integration/resources/adaptive_ri/output/IntrinsicMeasureWithBitFlipCode.ll +++ b/source/pip/tests-integration/resources/adaptive_ri/output/IntrinsicMeasureWithBitFlipCode.ll @@ -12,6 +12,7 @@ define i64 @ENTRYPOINT__main() #0 { block_0: + call void @__quantum__rt__initialize(i8* null) call void @__quantum__qis__cx__body(%Qubit* inttoptr (i64 0 to %Qubit*), %Qubit* inttoptr (i64 1 to %Qubit*)) call void @__quantum__qis__cx__body(%Qubit* inttoptr (i64 0 to %Qubit*), %Qubit* inttoptr (i64 2 to %Qubit*)) call void @__quantum__qis__h__body(%Qubit* inttoptr (i64 3 to %Qubit*)) @@ -54,6 +55,8 @@ block_0: ret i64 0 } +declare void @__quantum__rt__initialize(i8*) + declare void @__quantum__qis__cx__body(%Qubit*, %Qubit*) declare void @__quantum__qis__h__body(%Qubit*) diff --git a/source/pip/tests-integration/resources/adaptive_ri/output/IntrinsicMeasureWithPhaseFlipCode.ll b/source/pip/tests-integration/resources/adaptive_ri/output/IntrinsicMeasureWithPhaseFlipCode.ll index fccc7385b5..f51b97987b 100644 --- a/source/pip/tests-integration/resources/adaptive_ri/output/IntrinsicMeasureWithPhaseFlipCode.ll +++ b/source/pip/tests-integration/resources/adaptive_ri/output/IntrinsicMeasureWithPhaseFlipCode.ll @@ -12,6 +12,7 @@ define i64 @ENTRYPOINT__main() #0 { block_0: + call void @__quantum__rt__initialize(i8* null) call void @__quantum__qis__cx__body(%Qubit* inttoptr (i64 0 to %Qubit*), %Qubit* inttoptr (i64 1 to %Qubit*)) call void @__quantum__qis__cx__body(%Qubit* inttoptr (i64 0 to %Qubit*), %Qubit* inttoptr (i64 2 to %Qubit*)) call void @__quantum__qis__h__body(%Qubit* inttoptr (i64 0 to %Qubit*)) @@ -60,6 +61,8 @@ block_0: ret i64 0 } +declare void @__quantum__rt__initialize(i8*) + declare void @__quantum__qis__cx__body(%Qubit*, %Qubit*) declare void @__quantum__qis__h__body(%Qubit*) diff --git a/source/pip/tests-integration/resources/adaptive_ri/output/IntrinsicRotationsWithPeriod.ll b/source/pip/tests-integration/resources/adaptive_ri/output/IntrinsicRotationsWithPeriod.ll index cf70c79c29..e978945f7e 100644 --- a/source/pip/tests-integration/resources/adaptive_ri/output/IntrinsicRotationsWithPeriod.ll +++ b/source/pip/tests-integration/resources/adaptive_ri/output/IntrinsicRotationsWithPeriod.ll @@ -11,6 +11,7 @@ define i64 @ENTRYPOINT__main() #0 { block_0: + call void @__quantum__rt__initialize(i8* null) call void @__quantum__qis__x__body(%Qubit* inttoptr (i64 0 to %Qubit*)) call void @__quantum__qis__x__body(%Qubit* inttoptr (i64 1 to %Qubit*)) call void @__quantum__qis__y__body(%Qubit* inttoptr (i64 2 to %Qubit*)) @@ -88,6 +89,8 @@ block_0: ret i64 0 } +declare void @__quantum__rt__initialize(i8*) + declare void @__quantum__qis__x__body(%Qubit*) declare void @__quantum__qis__y__body(%Qubit*) diff --git a/source/pip/tests-integration/resources/adaptive_ri/output/IntrinsicSTSWAP.ll b/source/pip/tests-integration/resources/adaptive_ri/output/IntrinsicSTSWAP.ll index a05a48e3dd..f532ab1f2e 100644 --- a/source/pip/tests-integration/resources/adaptive_ri/output/IntrinsicSTSWAP.ll +++ b/source/pip/tests-integration/resources/adaptive_ri/output/IntrinsicSTSWAP.ll @@ -9,6 +9,7 @@ define i64 @ENTRYPOINT__main() #0 { block_0: + call void @__quantum__rt__initialize(i8* null) call void @__quantum__qis__h__body(%Qubit* inttoptr (i64 0 to %Qubit*)) call void @__quantum__qis__s__body(%Qubit* inttoptr (i64 0 to %Qubit*)) call void @__quantum__qis__s__body(%Qubit* inttoptr (i64 0 to %Qubit*)) @@ -34,6 +35,8 @@ block_0: ret i64 0 } +declare void @__quantum__rt__initialize(i8*) + declare void @__quantum__qis__h__body(%Qubit*) declare void @__quantum__qis__s__body(%Qubit*) diff --git a/source/pip/tests-integration/resources/adaptive_ri/output/MeasureAndReuse.ll b/source/pip/tests-integration/resources/adaptive_ri/output/MeasureAndReuse.ll index 0ff7212a85..40e2975aa8 100644 --- a/source/pip/tests-integration/resources/adaptive_ri/output/MeasureAndReuse.ll +++ b/source/pip/tests-integration/resources/adaptive_ri/output/MeasureAndReuse.ll @@ -10,6 +10,7 @@ define i64 @ENTRYPOINT__main() #0 { block_0: + call void @__quantum__rt__initialize(i8* null) call void @__quantum__qis__m__body(%Qubit* inttoptr (i64 0 to %Qubit*), %Result* inttoptr (i64 0 to %Result*)) call void @__quantum__qis__x__body(%Qubit* inttoptr (i64 0 to %Qubit*)) call void @__quantum__qis__m__body(%Qubit* inttoptr (i64 0 to %Qubit*), %Result* inttoptr (i64 1 to %Result*)) @@ -32,6 +33,8 @@ block_0: ret i64 0 } +declare void @__quantum__rt__initialize(i8*) + declare void @__quantum__qis__m__body(%Qubit*, %Result*) #1 declare void @__quantum__qis__x__body(%Qubit*) diff --git a/source/pip/tests-integration/resources/adaptive_ri/output/MeasurementComparison.ll b/source/pip/tests-integration/resources/adaptive_ri/output/MeasurementComparison.ll index 8b5b022e9a..327c3f59b5 100644 --- a/source/pip/tests-integration/resources/adaptive_ri/output/MeasurementComparison.ll +++ b/source/pip/tests-integration/resources/adaptive_ri/output/MeasurementComparison.ll @@ -9,6 +9,7 @@ define i64 @ENTRYPOINT__main() #0 { block_0: + call void @__quantum__rt__initialize(i8* null) call void @__quantum__qis__x__body(%Qubit* inttoptr (i64 0 to %Qubit*)) call void @__quantum__qis__cx__body(%Qubit* inttoptr (i64 0 to %Qubit*), %Qubit* inttoptr (i64 1 to %Qubit*)) call void @__quantum__qis__m__body(%Qubit* inttoptr (i64 0 to %Qubit*), %Result* inttoptr (i64 0 to %Result*)) @@ -38,6 +39,8 @@ block_3: ret i64 0 } +declare void @__quantum__rt__initialize(i8*) + declare void @__quantum__qis__x__body(%Qubit*) declare void @__quantum__qis__cx__body(%Qubit*, %Qubit*) diff --git a/source/pip/tests-integration/resources/adaptive_ri/output/NestedBranching.ll b/source/pip/tests-integration/resources/adaptive_ri/output/NestedBranching.ll index 92f11cc15e..dc2febeb7a 100644 --- a/source/pip/tests-integration/resources/adaptive_ri/output/NestedBranching.ll +++ b/source/pip/tests-integration/resources/adaptive_ri/output/NestedBranching.ll @@ -14,6 +14,7 @@ define i64 @ENTRYPOINT__main() #0 { block_0: + call void @__quantum__rt__initialize(i8* null) call void @__quantum__qis__x__body(%Qubit* inttoptr (i64 0 to %Qubit*)) call void @__quantum__qis__x__body(%Qubit* inttoptr (i64 1 to %Qubit*)) call void @__quantum__qis__m__body(%Qubit* inttoptr (i64 0 to %Qubit*), %Result* inttoptr (i64 0 to %Result*)) @@ -310,6 +311,8 @@ block_82: ret i64 0 } +declare void @__quantum__rt__initialize(i8*) + declare void @__quantum__qis__x__body(%Qubit*) declare void @__quantum__qis__m__body(%Qubit*, %Result*) #1 diff --git a/source/pip/tests-integration/resources/adaptive_ri/output/RandomBit.ll b/source/pip/tests-integration/resources/adaptive_ri/output/RandomBit.ll index 440df84bcc..09d122a363 100644 --- a/source/pip/tests-integration/resources/adaptive_ri/output/RandomBit.ll +++ b/source/pip/tests-integration/resources/adaptive_ri/output/RandomBit.ll @@ -6,6 +6,7 @@ define i64 @ENTRYPOINT__main() #0 { block_0: + call void @__quantum__rt__initialize(i8* null) call void @__quantum__qis__h__body(%Qubit* inttoptr (i64 0 to %Qubit*)) call void @__quantum__qis__m__body(%Qubit* inttoptr (i64 0 to %Qubit*), %Result* inttoptr (i64 0 to %Result*)) call void @__quantum__qis__reset__body(%Qubit* inttoptr (i64 0 to %Qubit*)) @@ -13,6 +14,8 @@ block_0: ret i64 0 } +declare void @__quantum__rt__initialize(i8*) + declare void @__quantum__qis__h__body(%Qubit*) declare void @__quantum__qis__m__body(%Qubit*, %Result*) #1 diff --git a/source/pip/tests-integration/resources/adaptive_ri/output/SampleTeleport.ll b/source/pip/tests-integration/resources/adaptive_ri/output/SampleTeleport.ll index 606995a27e..171dfde7a8 100644 --- a/source/pip/tests-integration/resources/adaptive_ri/output/SampleTeleport.ll +++ b/source/pip/tests-integration/resources/adaptive_ri/output/SampleTeleport.ll @@ -6,6 +6,7 @@ define i64 @ENTRYPOINT__main() #0 { block_0: + call void @__quantum__rt__initialize(i8* null) call void @__quantum__qis__h__body(%Qubit* inttoptr (i64 0 to %Qubit*)) call void @__quantum__qis__cx__body(%Qubit* inttoptr (i64 0 to %Qubit*), %Qubit* inttoptr (i64 1 to %Qubit*)) call void @__quantum__qis__x__body(%Qubit* inttoptr (i64 2 to %Qubit*)) @@ -35,6 +36,8 @@ block_4: ret i64 0 } +declare void @__quantum__rt__initialize(i8*) + declare void @__quantum__qis__h__body(%Qubit*) declare void @__quantum__qis__cx__body(%Qubit*, %Qubit*) diff --git a/source/pip/tests-integration/resources/adaptive_ri/output/ShortcuttingMeasurement.ll b/source/pip/tests-integration/resources/adaptive_ri/output/ShortcuttingMeasurement.ll index 83711bf15e..92746c6b7f 100644 --- a/source/pip/tests-integration/resources/adaptive_ri/output/ShortcuttingMeasurement.ll +++ b/source/pip/tests-integration/resources/adaptive_ri/output/ShortcuttingMeasurement.ll @@ -7,6 +7,7 @@ define i64 @ENTRYPOINT__main() #0 { block_0: + call void @__quantum__rt__initialize(i8* null) call void @__quantum__qis__x__body(%Qubit* inttoptr (i64 0 to %Qubit*)) call void @__quantum__qis__cx__body(%Qubit* inttoptr (i64 0 to %Qubit*), %Qubit* inttoptr (i64 1 to %Qubit*)) call void @__quantum__qis__m__body(%Qubit* inttoptr (i64 0 to %Qubit*), %Result* inttoptr (i64 0 to %Result*)) @@ -34,6 +35,8 @@ block_4: ret i64 0 } +declare void @__quantum__rt__initialize(i8*) + declare void @__quantum__qis__x__body(%Qubit*) declare void @__quantum__qis__cx__body(%Qubit*, %Qubit*) diff --git a/source/pip/tests-integration/resources/adaptive_ri/output/Slicing.ll b/source/pip/tests-integration/resources/adaptive_ri/output/Slicing.ll index e406d49922..4630c40ac9 100644 --- a/source/pip/tests-integration/resources/adaptive_ri/output/Slicing.ll +++ b/source/pip/tests-integration/resources/adaptive_ri/output/Slicing.ll @@ -10,6 +10,7 @@ define i64 @ENTRYPOINT__main() #0 { block_0: + call void @__quantum__rt__initialize(i8* null) call void @__quantum__qis__x__body(%Qubit* inttoptr (i64 9 to %Qubit*)) call void @__quantum__qis__x__body(%Qubit* inttoptr (i64 8 to %Qubit*)) call void @__quantum__qis__x__body(%Qubit* inttoptr (i64 7 to %Qubit*)) @@ -39,6 +40,8 @@ block_0: ret i64 0 } +declare void @__quantum__rt__initialize(i8*) + declare void @__quantum__qis__x__body(%Qubit*) declare void @__quantum__qis__m__body(%Qubit*, %Result*) #1 diff --git a/source/pip/tests-integration/resources/adaptive_ri/output/SuperdenseCoding.ll b/source/pip/tests-integration/resources/adaptive_ri/output/SuperdenseCoding.ll index 527bb8b9b8..dad7b84199 100644 --- a/source/pip/tests-integration/resources/adaptive_ri/output/SuperdenseCoding.ll +++ b/source/pip/tests-integration/resources/adaptive_ri/output/SuperdenseCoding.ll @@ -9,6 +9,7 @@ define i64 @ENTRYPOINT__main() #0 { block_0: + call void @__quantum__rt__initialize(i8* null) call void @__quantum__qis__h__body(%Qubit* inttoptr (i64 0 to %Qubit*)) call void @__quantum__qis__cx__body(%Qubit* inttoptr (i64 0 to %Qubit*), %Qubit* inttoptr (i64 1 to %Qubit*)) call void @__quantum__qis__h__body(%Qubit* inttoptr (i64 2 to %Qubit*)) @@ -51,6 +52,8 @@ block_4: ret i64 0 } +declare void @__quantum__rt__initialize(i8*) + declare void @__quantum__qis__h__body(%Qubit*) declare void @__quantum__qis__cx__body(%Qubit*, %Qubit*) diff --git a/source/pip/tests-integration/resources/adaptive_ri/output/SwitchHandling.ll b/source/pip/tests-integration/resources/adaptive_ri/output/SwitchHandling.ll index ff81e2e41f..1e1c5e9e83 100644 --- a/source/pip/tests-integration/resources/adaptive_ri/output/SwitchHandling.ll +++ b/source/pip/tests-integration/resources/adaptive_ri/output/SwitchHandling.ll @@ -6,6 +6,7 @@ define i64 @ENTRYPOINT__main() #0 { block_0: + call void @__quantum__rt__initialize(i8* null) call void @__quantum__qis__x__body(%Qubit* inttoptr (i64 0 to %Qubit*)) call void @__quantum__qis__x__body(%Qubit* inttoptr (i64 1 to %Qubit*)) call void @__quantum__qis__m__body(%Qubit* inttoptr (i64 0 to %Qubit*), %Result* inttoptr (i64 0 to %Result*)) @@ -55,6 +56,8 @@ block_13: ret i64 0 } +declare void @__quantum__rt__initialize(i8*) + declare void @__quantum__qis__x__body(%Qubit*) declare void @__quantum__qis__m__body(%Qubit*, %Result*) #1 diff --git a/source/pip/tests-integration/resources/adaptive_ri/output/ThreeQubitRepetitionCode.ll b/source/pip/tests-integration/resources/adaptive_ri/output/ThreeQubitRepetitionCode.ll index a5356a8d51..4176cc355c 100644 --- a/source/pip/tests-integration/resources/adaptive_ri/output/ThreeQubitRepetitionCode.ll +++ b/source/pip/tests-integration/resources/adaptive_ri/output/ThreeQubitRepetitionCode.ll @@ -7,6 +7,7 @@ define i64 @ENTRYPOINT__main() #0 { block_0: + call void @__quantum__rt__initialize(i8* null) call void @__quantum__qis__h__body(%Qubit* inttoptr (i64 0 to %Qubit*)) call void @__quantum__qis__z__body(%Qubit* inttoptr (i64 0 to %Qubit*)) call void @__quantum__qis__cx__body(%Qubit* inttoptr (i64 0 to %Qubit*), %Qubit* inttoptr (i64 1 to %Qubit*)) @@ -273,6 +274,8 @@ block_55: ret i64 0 } +declare void @__quantum__rt__initialize(i8*) + declare void @__quantum__qis__h__body(%Qubit*) declare void @__quantum__qis__z__body(%Qubit*) diff --git a/source/pip/tests-integration/resources/adaptive_ri/output/WithinApply.ll b/source/pip/tests-integration/resources/adaptive_ri/output/WithinApply.ll index ec07e55118..f534755d98 100644 --- a/source/pip/tests-integration/resources/adaptive_ri/output/WithinApply.ll +++ b/source/pip/tests-integration/resources/adaptive_ri/output/WithinApply.ll @@ -8,6 +8,7 @@ define i64 @ENTRYPOINT__main() #0 { block_0: + call void @__quantum__rt__initialize(i8* null) call void @__quantum__qis__x__body(%Qubit* inttoptr (i64 1 to %Qubit*)) call void @__quantum__qis__x__body(%Qubit* inttoptr (i64 2 to %Qubit*)) call void @__quantum__qis__ccx__body(%Qubit* inttoptr (i64 1 to %Qubit*), %Qubit* inttoptr (i64 2 to %Qubit*), %Qubit* inttoptr (i64 0 to %Qubit*)) @@ -26,6 +27,8 @@ block_0: ret i64 0 } +declare void @__quantum__rt__initialize(i8*) + declare void @__quantum__qis__x__body(%Qubit*) declare void @__quantum__qis__ccx__body(%Qubit*, %Qubit*, %Qubit*) diff --git a/source/pip/tests-integration/resources/adaptive_rif/output/Doubles.ll b/source/pip/tests-integration/resources/adaptive_rif/output/Doubles.ll index 82fca47850..c02f4592de 100644 --- a/source/pip/tests-integration/resources/adaptive_rif/output/Doubles.ll +++ b/source/pip/tests-integration/resources/adaptive_rif/output/Doubles.ll @@ -11,6 +11,7 @@ define i64 @ENTRYPOINT__main() #0 { block_0: + call void @__quantum__rt__initialize(i8* null) call void @__quantum__qis__x__body(%Qubit* inttoptr (i64 0 to %Qubit*)) call void @__quantum__qis__m__body(%Qubit* inttoptr (i64 0 to %Qubit*), %Result* inttoptr (i64 0 to %Result*)) %var_2 = call i1 @__quantum__rt__read_result(%Result* inttoptr (i64 0 to %Result*)) @@ -162,6 +163,8 @@ block_20: ret i64 0 } +declare void @__quantum__rt__initialize(i8*) + declare void @__quantum__qis__x__body(%Qubit*) declare void @__quantum__qis__m__body(%Qubit*, %Result*) #1 diff --git a/source/pip/tests-integration/test_base_qir.py b/source/pip/tests-integration/test_base_qir.py index 0c75677021..7941590f2c 100644 --- a/source/pip/tests-integration/test_base_qir.py +++ b/source/pip/tests-integration/test_base_qir.py @@ -32,23 +32,23 @@ def test_compile_qir_input_data() -> None: qir = operation._repr_qir_() assert isinstance(qir, bytes) module = Module.from_ir(Context(), qir.decode(), "module") - assert len(module.functions) == 3 + assert len(module.functions) == 4 assert module.functions[0].name == "ENTRYPOINT__main" func = module.functions[0] assert len(func.basic_blocks) == 1 - assert len(func.basic_blocks[0].instructions) == 3 - call_m = func.basic_blocks[0].instructions[0] + assert len(func.basic_blocks[0].instructions) == 4 + call_m = func.basic_blocks[0].instructions[1] assert isinstance(call_m, Call) assert call_m.callee.name == "__quantum__qis__m__body" assert len(call_m.args) == 2 assert qubit_id(call_m.args[0]) == 0 assert result_id(call_m.args[1]) == 0 - record_res = func.basic_blocks[0].instructions[1] + record_res = func.basic_blocks[0].instructions[2] assert isinstance(record_res, Call) assert len(record_res.args) == 2 assert record_res.callee.name == "__quantum__rt__result_record_output" assert result_id(record_res.args[0]) == 0 - assert func.basic_blocks[0].instructions[2].opcode == Opcode.RET + assert func.basic_blocks[0].instructions[3].opcode == Opcode.RET @pytest.mark.skipif(not PYQIR_AVAILABLE, reason=SKIP_REASON) @@ -85,14 +85,14 @@ def test_compile_qir_all_gates() -> None: qir = operation._repr_qir_() assert isinstance(qir, bytes) module = Module.from_ir(Context(), qir.decode(), "module") - assert len(module.functions) == 24 + assert len(module.functions) == 25 assert module.functions[0].name == "ENTRYPOINT__main" func = module.functions[0] assert len(func.basic_blocks) == 1 - assert len(func.basic_blocks[0].instructions) == 27 + assert len(func.basic_blocks[0].instructions) == 28 def check_call(i: int, name: str, num_args: int) -> None: - call = func.basic_blocks[0].instructions[i] + call = func.basic_blocks[0].instructions[i + 1] assert isinstance(call, Call) assert call.callee.name == name assert len(call.args) == num_args diff --git a/source/pip/tests-integration/test_requirements.txt b/source/pip/tests-integration/test_requirements.txt index ef5088095f..0347067b37 100644 --- a/source/pip/tests-integration/test_requirements.txt +++ b/source/pip/tests-integration/test_requirements.txt @@ -1,6 +1,6 @@ pytest==8.2.2 qiskit>=1.3.0,<2.0.0 -qirrunner==0.7.1 +qirrunner==0.8.3 pyqir==0.10.2 qiskit-aer==0.14.2 qiskit_qasm3_import==0.5.0 diff --git a/source/pip/tests/test_interpreter.py b/source/pip/tests/test_interpreter.py index 0cc4854852..9dfce57844 100644 --- a/source/pip/tests/test_interpreter.py +++ b/source/pip/tests/test_interpreter.py @@ -376,6 +376,7 @@ def test_adaptive_ri_qir_can_be_generated() -> None: define i64 @ENTRYPOINT__main() #0 { block_0: + call void @__quantum__rt__initialize(i8* null) call void @__quantum__qis__rz__body(double 2.0, %Qubit* inttoptr (i64 0 to %Qubit*)) call void @__quantum__qis__rz__body(double 0.0, %Qubit* inttoptr (i64 0 to %Qubit*)) call void @__quantum__qis__rz__body(double 1.0, %Qubit* inttoptr (i64 0 to %Qubit*)) @@ -384,6 +385,8 @@ def test_adaptive_ri_qir_can_be_generated() -> None: ret i64 0 } + declare void @__quantum__rt__initialize(i8*) + declare void @__quantum__qis__rz__body(double, %Qubit*) declare void @__quantum__qis__mresetz__body(%Qubit*, %Result*) #1 @@ -437,6 +440,7 @@ def test_base_qir_can_be_generated() -> None: define i64 @ENTRYPOINT__main() #0 { block_0: + call void @__quantum__rt__initialize(i8* null) call void @__quantum__qis__rz__body(double 2.0, %Qubit* inttoptr (i64 0 to %Qubit*)) call void @__quantum__qis__rz__body(double 0.0, %Qubit* inttoptr (i64 0 to %Qubit*)) call void @__quantum__qis__rz__body(double 1.0, %Qubit* inttoptr (i64 0 to %Qubit*)) @@ -445,6 +449,8 @@ def test_base_qir_can_be_generated() -> None: ret i64 0 } + declare void @__quantum__rt__initialize(i8*) + declare void @__quantum__qis__rz__body(double, %Qubit*) declare void @__quantum__rt__result_record_output(%Result*, i8*) diff --git a/source/pip/tests/test_qasm.py b/source/pip/tests/test_qasm.py index d25d5ef777..a1e673d1b0 100644 --- a/source/pip/tests/test_qasm.py +++ b/source/pip/tests/test_qasm.py @@ -424,7 +424,7 @@ def test_compile_qir_str_from_callable_with_mresetzchecked() -> None: ) operation = compile(code.Program) qir = str(operation) - assert "define void @ENTRYPOINT__main()" in qir + assert "define i64 @ENTRYPOINT__main()" in qir assert ( "call i1 @__quantum__rt__read_loss(%Result* inttoptr (i64 0 to %Result*))" in qir