Represent vector-cast constructors with ConstructorVectorCast.

Making a VectorCast from a compile-time constant will perform the cast
at compile-time instead; previously, we did not apply this optimization.
This simplified a few test outputs in subtle ways. (In particular, the
SPIR-V codegen used to occasionally decorate OpConstantComposite of
constant numbers with RelaxedPrecision, and no longer appears to do
this. This should have no effect on results either way AFAICS.)

Because we don't return VectorCast constructors containing compile-time
constant values, we do not need to implement compareConstant for this
constructor; they only wrap non-compile-time-constant expressions.

Change-Id: I28c1f337f64d6f20fb86bc0f58e225af4bd7b26c
Bug: skia:11032
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/392197
Auto-Submit: John Stiles <johnstiles@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
diff --git a/src/sksl/SkSLRehydrator.cpp b/src/sksl/SkSLRehydrator.cpp
index 335a7c3..99e9064 100644
--- a/src/sksl/SkSLRehydrator.cpp
+++ b/src/sksl/SkSLRehydrator.cpp
@@ -20,6 +20,7 @@
 #include "src/sksl/ir/SkSLConstructorDiagonalMatrix.h"
 #include "src/sksl/ir/SkSLConstructorScalarCast.h"
 #include "src/sksl/ir/SkSLConstructorSplat.h"
+#include "src/sksl/ir/SkSLConstructorVectorCast.h"
 #include "src/sksl/ir/SkSLContinueStatement.h"
 #include "src/sksl/ir/SkSLDiscardStatement.h"
 #include "src/sksl/ir/SkSLDoStatement.h"
@@ -484,6 +485,12 @@
             SkASSERT(args.size() == 1);
             return ConstructorSplat::Make(fContext, /*offset=*/-1, *type, std::move(args[0]));
         }
+        case Rehydrator::kConstructorVectorCast_Command: {
+            const Type* type = this->type();
+            ExpressionArray args = this->expressionArray();
+            SkASSERT(args.size() == 1);
+            return ConstructorVectorCast::Make(fContext, /*offset=*/-1, *type, std::move(args[0]));
+        }
         case Rehydrator::kFieldAccess_Command: {
             std::unique_ptr<Expression> base = this->expression();
             int index = this->readU8();