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]>
51 lines
2.9 KiB
LLVM
51 lines
2.9 KiB
LLVM
; Every intrinsic the reader takes, once each, at angles that are not dyadic where an intrinsic takes one (decimal, exponent and hex), then every qubit measured.
|
|
|
|
define i64 @main() #0 {
|
|
entry:
|
|
call void @__quantum__rt__initialize(ptr null)
|
|
br label %body
|
|
body:
|
|
call void @__quantum__qis__h__body(ptr null)
|
|
call void @__quantum__qis__h__body(ptr inttoptr (i64 1 to ptr))
|
|
call void @__quantum__qis__h__body(ptr inttoptr (i64 2 to ptr))
|
|
call void @__quantum__qis__x__body(ptr null)
|
|
call void @__quantum__qis__y__body(ptr inttoptr (i64 1 to ptr))
|
|
call void @__quantum__qis__z__body(ptr inttoptr (i64 2 to ptr))
|
|
call void @__quantum__qis__s__body(ptr null)
|
|
call void @__quantum__qis__s__adj(ptr inttoptr (i64 1 to ptr))
|
|
call void @__quantum__qis__t__body(ptr inttoptr (i64 2 to ptr))
|
|
call void @__quantum__qis__t__adj(ptr null)
|
|
call void @__quantum__qis__sx__body(ptr inttoptr (i64 1 to ptr))
|
|
call void @__quantum__qis__rx__body(double 3.000000e-01, ptr null)
|
|
call void @__quantum__qis__ry__body(double 0xBFF199999999999A, ptr inttoptr (i64 1 to ptr))
|
|
call void @__quantum__qis__rz__body(double 2.5, ptr inttoptr (i64 2 to ptr))
|
|
call void @__quantum__qis__rz__adj(double 0.7, ptr null)
|
|
call void @__quantum__qis__r1__body(double 0.9, ptr inttoptr (i64 1 to ptr))
|
|
call void @__quantum__qis__cnot__body(ptr null, ptr inttoptr (i64 1 to ptr))
|
|
call void @__quantum__qis__cx__body(ptr inttoptr (i64 1 to ptr), ptr inttoptr (i64 2 to ptr))
|
|
call void @__quantum__qis__cy__body(ptr inttoptr (i64 2 to ptr), ptr null)
|
|
call void @__quantum__qis__cz__body(ptr null, ptr inttoptr (i64 2 to ptr))
|
|
call void @__quantum__qis__swap__body(ptr inttoptr (i64 1 to ptr), ptr inttoptr (i64 2 to ptr))
|
|
call void @__quantum__qis__ccx__body(ptr null, ptr inttoptr (i64 1 to ptr), ptr inttoptr (i64 2 to ptr))
|
|
call void @__quantum__qis__ccz__body(ptr inttoptr (i64 2 to ptr), ptr inttoptr (i64 1 to ptr), ptr null)
|
|
call void @__quantum__qis__rxx__body(double 0.4, ptr null, ptr inttoptr (i64 1 to ptr))
|
|
call void @__quantum__qis__ryy__body(double -0.6, ptr inttoptr (i64 1 to ptr), ptr inttoptr (i64 2 to ptr))
|
|
call void @__quantum__qis__rzz__body(double 1.3, ptr inttoptr (i64 2 to ptr), ptr null)
|
|
br label %measurements
|
|
measurements:
|
|
call void @__quantum__qis__mz__body(ptr null, ptr writeonly null) #1
|
|
call void @__quantum__qis__mz__body(ptr inttoptr (i64 1 to ptr), ptr writeonly inttoptr (i64 1 to ptr)) #1
|
|
call void @__quantum__qis__mz__body(ptr inttoptr (i64 2 to ptr), ptr writeonly inttoptr (i64 2 to ptr)) #1
|
|
br label %output
|
|
output:
|
|
ret i64 0
|
|
}
|
|
|
|
attributes #0 = { "entry_point" "qir_profiles"="base_profile" "output_labeling_schema"="labels" "required_num_qubits"="3" "required_num_results"="3" }
|
|
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 1}
|
|
!2 = !{i32 1, !"dynamic_qubit_management", i1 false}
|
|
!3 = !{i32 1, !"dynamic_result_management", i1 false}
|