-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: support ~ operation, close #278 #303
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @Zhaoyilunnn, thank you very much for this follow up PR! Do you think you could create a reproducer test here to https://github.com/openqasm/qe-compiler/blob/main/test/Frontend/OpenQASM3/bitops.qasm
Could you please bump the version here to 0.3.1 -
qe-compiler/conan/qasm/conanfile.py
Line 20 in e0b4a85
version = "0.3.0" |
Line 10 in e0b4a85
- qasm/0.3.0@qss/stable |
I think you'll also need to add a short reno to get the static checks to pass.
conan/qasm/conandata.yml
Outdated
@@ -1,5 +1,5 @@ | |||
sources: | |||
hash: "d59248cbb4cf8840c9720462f2569907b9506323" | |||
hash: "d42bca2c2b7a8e2543462cceea178240709b6fa2" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would you mind updating this to openqasm/qe-qasm@a9cf9fa?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Almost, there - just a couple small changes please
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, pending CI passes. Thank you!
Hi Team,
I've added rules to parse "~" symbol in qe-qasm: openqasm/qe-qasm#29, at the side of qe-compiler, we need to generate a MLIR op for
ASTOpTypeBitNot
inlib/Frontend/OpenQASM3/QUIRGenQASM3Visitor.cpp
.After searching, I find that MLIR does not have arith operations directly related to "BitNot". In the context of OQ3, I believe "~cbit" and "!cbit" are equivalent in a "if" condition? So I just simply reused the processing logic of
ASTOpTypeLogicalNot
, which checks whether the target is aI1Type
and also works forASTOpTypeBitNot
operation. It will also create anCmpIPredicate::ne
operation.Willing to update my pr if you have better solutions
Thanks,
Yilun
Changes
ASTOpTypeLogicalNot
forASTOpTypeBitNot
.Sample
Given the following source file
The compiler generates following MLIR