wai/quantum-conformance/formats/ holds a module for each construct, each with the program it must read to (a reference held by the equivalence ladder), the outcomes it gives, a round trip back to its format, the formats it writes to, and every refusal with its code and its place: the QIR specification's two example programs, every intrinsic, a QIR 1 module with typed pointers, the profiles' refusals; jeff modules built field by field from the schema; the jeff project's own structured benchmarks and examples, unchanged; and OpenQASM sources written to each format, the QIR written pinned by its BLAKE3. CI runs it in wai-quantum-formats.yml, with the readers' and writers' unit tests. The jeff reader now converts integers to floats and floats to integers, and a QIR conversion is checked against the type it gives. Co-Authored-By: Claude Opus 5.5 <[email protected]>
52 lines
1.8 KiB
LLVM
52 lines
1.8 KiB
LLVM
; The base profile's own example program (the QIR specification, MIT): two
|
|
; qubits entangled, measured, and a tuple of the two results recorded.
|
|
|
|
@0 = internal constant [3 x i8] c"r1\00"
|
|
@1 = internal constant [3 x i8] c"r2\00"
|
|
@2 = internal constant [3 x i8] c"t0\00"
|
|
|
|
define i64 @Entry_Point_Name() #0 {
|
|
entry:
|
|
call void @__quantum__rt__initialize(ptr null)
|
|
br label %body
|
|
|
|
body: ; preds = %entry
|
|
call void @__quantum__qis__h__body(ptr null)
|
|
call void @__quantum__qis__cnot__body(ptr null, ptr inttoptr (i64 1 to ptr))
|
|
br label %measurements
|
|
|
|
measurements: ; preds = %body
|
|
call void @__quantum__qis__mz__body(ptr null, ptr writeonly null)
|
|
call void @__quantum__qis__mz__body(ptr inttoptr (i64 1 to ptr), ptr writeonly inttoptr (i64 1 to ptr))
|
|
br label %output
|
|
|
|
output: ; preds = %measurements
|
|
call void @__quantum__rt__tuple_record_output(i64 2, ptr @2)
|
|
call void @__quantum__rt__result_record_output(ptr null, ptr @0)
|
|
call void @__quantum__rt__result_record_output(ptr inttoptr (i64 1 to ptr), ptr @1)
|
|
|
|
ret i64 0
|
|
}
|
|
|
|
declare void @__quantum__qis__h__body(ptr)
|
|
|
|
declare void @__quantum__qis__cnot__body(ptr, ptr)
|
|
|
|
declare void @__quantum__qis__mz__body(ptr, ptr writeonly) #1
|
|
|
|
declare void @__quantum__rt__initialize(ptr)
|
|
|
|
declare void @__quantum__rt__tuple_record_output(i64, ptr)
|
|
|
|
declare void @__quantum__rt__result_record_output(ptr, ptr)
|
|
|
|
attributes #0 = { "entry_point" "qir_profiles"="base_profile" "output_labeling_schema"="schema_id" "required_num_qubits"="2" "required_num_results"="2" }
|
|
|
|
attributes #1 = { "irreversible" }
|
|
|
|
!llvm.module.flags = !{!0, !1, !2, !3}
|
|
|
|
!0 = !{i32 1, !"qir_major_version", i32 2}
|
|
!1 = !{i32 7, !"qir_minor_version", i32 0}
|
|
!2 = !{i32 1, !"dynamic_qubit_management", i1 false}
|
|
!3 = !{i32 1, !"dynamic_result_management", i1 false}
|