qir-alliance / qcor

C++ compiler for heterogeneous quantum-classical computing built on Clang and XACC
http://docs.aide-qc.org
MIT License
97 stars 39 forks source link

[OpenQASM3] Support auto-gen of ctrl-modifed gates #214

Closed 1tnguyen closed 3 years ago

1tnguyen commented 3 years ago

When applying ctrl @ on elementary gates, we can directly look up the corresponding two-qubit gate.

See the code comment here: https://github.com/ORNL-QCI/qcor/blob/e0a66e1bbd500e1a788cfff49edbf9a3d0bb73ca/mlir/parsers/qasm3/visitor_handlers/quantum_instruction_handler.cpp#L477

Note: currently, we only expose CNOT, SWAP, and CPHASE in the QIR runtime (see qir-qrt.hpp). We may need to add other controlled gates, such as CZ, CH, etc.