crates/pecos-qasm/src/qasm_to_phir.rs (the VarDefineOp emitted per creg, around line 98) types every classical register as i64 regardless of width. crates/pecos-qasm/src/qasm_to_phir_json.rs (classical_register_dtype, around line 44) types the same register as u32 for widths up to 32 and u64 up to 64, and rejects wider ones. The two lowerings of the same program therefore disagree on the signedness of every classical variable.
OpenQASM 2 classical registers are arrays of bits interpreted as unsigned integers with bit 0 as the low-order bit (the spec's if(creg==int) compares against an nninteger), so the JSON path has it right. The Rust path's i64 is pinned by the PHIR fixtures in python/quantum-pecos/tests/pecos/regression/test_engines/test_rxy1q_conditional_gates.py ("data_type": "i64"), so changing it is a cross-language change with fixture updates and a check of how the Python PHIR interpreter treats i64 versus u64 variables. Kept out of #864 (the expression-evaluator fix for the same signedness confusion) for that reason.
crates/pecos-qasm/src/qasm_to_phir.rs(theVarDefineOpemitted percreg, around line 98) types every classical register asi64regardless of width.crates/pecos-qasm/src/qasm_to_phir_json.rs(classical_register_dtype, around line 44) types the same register asu32for widths up to 32 andu64up to 64, and rejects wider ones. The two lowerings of the same program therefore disagree on the signedness of every classical variable.OpenQASM 2 classical registers are arrays of bits interpreted as unsigned integers with bit 0 as the low-order bit (the spec's
if(creg==int)compares against annninteger), so the JSON path has it right. The Rust path'si64is pinned by the PHIR fixtures inpython/quantum-pecos/tests/pecos/regression/test_engines/test_rxy1q_conditional_gates.py("data_type": "i64"), so changing it is a cross-language change with fixture updates and a check of how the Python PHIR interpreter treatsi64versusu64variables. Kept out of #864 (the expression-evaluator fix for the same signedness confusion) for that reason.