Implement bitwise complement operator

This translates to/from OpNot for SPIR-V, and ~ for all three textual
language backends.

Fixed: tint:866
Change-Id: Id934fb309221e3fca0e7efa33edaaae137fd8085
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/54980
Auto-Submit: James Price <jrprice@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
This commit is contained in:
James Price
2021-06-17 08:35:54 +00:00
committed by Tint LUCI CQ
parent 52b6a004b8
commit c932b5535f
25 changed files with 243 additions and 10 deletions

View File

@@ -23,6 +23,10 @@ std::ostream& operator<<(std::ostream& out, UnaryOp mod) {
out << "address-of";
break;
}
case UnaryOp::kComplement: {
out << "complement";
break;
}
case UnaryOp::kIndirection: {
out << "indirection";
break;

View File

@@ -23,6 +23,7 @@ namespace ast {
/// The unary op
enum class UnaryOp {
kAddressOf, // &EXPR
kComplement, // ~EXPR
kIndirection, // *EXPR
kNegation, // -EXPR
kNot, // !EXPR