tint: Add unary-ops to the intrinsic table

• Declare all the unary ops in the intrinsics.def file.
• Reimplement the bulk of Resolver::UnaryOp() with the IntrinsicTable.

This will simplify maintenance of the operators, and will greatly
simplify the [AbstractInt -> i32|u32] [AbstractFloat -> f32|f16] logic.

Bug: tint:1504
Change-Id: Ifc646d086fc93cfbe3f3f861b8c447178664c1f7
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/89028
Reviewed-by: James Price <jrprice@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@chromium.org>
This commit is contained in:
Ben Clayton
2022-05-09 21:22:24 +00:00
committed by Dawn LUCI CQ
parent 7378612ca5
commit b61e0452f8
11 changed files with 2617 additions and 2364 deletions

View File

@@ -72,6 +72,8 @@ func (l *lexer) lex() error {
l.tok(1, tok.Modulo)
case '^':
l.tok(1, tok.Xor)
case '~':
l.tok(1, tok.Complement)
case '"':
start := l.loc
l.next() // Skip opening quote
@@ -105,6 +107,7 @@ func (l *lexer) lex() error {
case l.match("||", tok.OrOr):
case l.match("|", tok.Or):
case l.match("!=", tok.NotEqual):
case l.match("!", tok.Not):
case l.match("==", tok.Equal):
case l.match("=", tok.Assign):
case l.match("<<", tok.Shl):