negateS -> negateI
The same negate should work fine for unsigned, right?
This seems to eliminate the need for kInvaid.
~ $ cat test.c
int main(void) {
unsigned u = 0;
do {
unsigned nu = -u,
ns = -(int)u;
if (nu != ns) {
return 1;
}
} while (++u != 0);
return 0;
}
~ $ clang -Os test.c
~ $ ./a.out && echo ok
ok
Change-Id: If4eec8aa24dce634e3196c8631adec4362a3b69b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/215045
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
diff --git a/src/sksl/SkSLByteCodeGenerator.cpp b/src/sksl/SkSLByteCodeGenerator.cpp
index b389ced..94f4e78 100644
--- a/src/sksl/SkSLByteCodeGenerator.cpp
+++ b/src/sksl/SkSLByteCodeGenerator.cpp
@@ -436,8 +436,8 @@
case Token::Kind::MINUS: {
this->writeExpression(*p.fOperand);
this->writeTypedInstruction(p.fType,
- ByteCodeInstruction::kNegateS,
- ByteCodeInstruction::kInvalid,
+ ByteCodeInstruction::kNegateI,
+ ByteCodeInstruction::kNegateI,
ByteCodeInstruction::kNegateF,
slot_count(p.fOperand->fType));
break;