add skvx::{sin,cos,tan}

This lets us get rid of VECTOR_UNARY_FN_VEC.

I don't know exactly what was wrong with VECTOR_UNARY_FN_VEC,
but `color.rgb = color.rgb + a*(sin(6.28*color.rgb)*0.159)` looks
ok to me now when run through the interpreter.

Change-Id: I700398cd55eca1b8e1b3b46858415ecae5585a32
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/286065
Reviewed-by: Florin Malita <fmalita@chromium.org>
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
diff --git a/include/private/SkVx.h b/include/private/SkVx.h
index 267c102..81cd680 100644
--- a/include/private/SkVx.h
+++ b/include/private/SkVx.h
@@ -287,6 +287,9 @@
 SIT Vec<1,T> round(const Vec<1,T>& x) { return std::round(x.val); }
 SIT Vec<1,T>  sqrt(const Vec<1,T>& x) { return std:: sqrt(x.val); }
 SIT Vec<1,T>   abs(const Vec<1,T>& x) { return std::  abs(x.val); }
+SIT Vec<1,T>   sin(const Vec<1,T>& x) { return std::  sin(x.val); }
+SIT Vec<1,T>   cos(const Vec<1,T>& x) { return std::  cos(x.val); }
+SIT Vec<1,T>   tan(const Vec<1,T>& x) { return std::  tan(x.val); }
 
 SIT Vec<1,int> lrint(const Vec<1,T>& x) { return (int)std::lrint(x.val); }
 
@@ -317,6 +320,9 @@
 SINT Vec<N,T> round(const Vec<N,T>& x) { return join(round(x.lo), round(x.hi)); }
 SINT Vec<N,T>  sqrt(const Vec<N,T>& x) { return join( sqrt(x.lo),  sqrt(x.hi)); }
 SINT Vec<N,T>   abs(const Vec<N,T>& x) { return join(  abs(x.lo),   abs(x.hi)); }
+SINT Vec<N,T>   sin(const Vec<N,T>& x) { return join(  sin(x.lo),   sin(x.hi)); }
+SINT Vec<N,T>   cos(const Vec<N,T>& x) { return join(  cos(x.lo),   cos(x.hi)); }
+SINT Vec<N,T>   tan(const Vec<N,T>& x) { return join(  tan(x.lo),   tan(x.hi)); }
 
 SINT Vec<N,int> lrint(const Vec<N,T>& x) { return join(lrint(x.lo), lrint(x.hi)); }
 
diff --git a/src/sksl/SkSLByteCode.cpp b/src/sksl/SkSLByteCode.cpp
index af18c28..c2a1ab6 100644
--- a/src/sksl/SkSLByteCode.cpp
+++ b/src/sksl/SkSLByteCode.cpp
@@ -366,19 +366,6 @@
     case ByteCodeInstruction::base:       sp[ 0] = fn(sp[ 0].field); \
                       continue;
 
-#define VECTOR_UNARY_FN_VEC(base, fn)                                 \
-    case ByteCodeInstruction::base ## 4:                              \
-    case ByteCodeInstruction::base ## 3:                              \
-    case ByteCodeInstruction::base ## 2:                              \
-    case ByteCodeInstruction::base: {                                 \
-        int count = (int)inst - (int)(ByteCodeInstruction::base) + 1; \
-        float* v = (float*)sp - count + 1;                            \
-        for (int i = VecWidth * count; i > 0; --i, ++v) {             \
-            *v = fn(*v);                                              \
-        }                                                             \
-        continue;                                                     \
-    }
-
 union VValue {
     VValue() {}
     VValue(F32 f) : fFloat(f) {}
@@ -648,7 +635,7 @@
             case ByteCodeInstruction::kConvertUtoF:  sp[ 0] = skvx::cast<float>(sp[ 0].fUnsigned);
                                                      continue;
 
-            VECTOR_UNARY_FN_VEC(kCos, cosf)
+            VECTOR_UNARY_FN(kCos, skvx::cos, fFloat)
 
             VECTOR_BINARY_MASKED_OP(kDivideS, fSigned, /)
             VECTOR_BINARY_MASKED_OP(kDivideU, fUnsigned, /)
@@ -951,7 +938,7 @@
                 sp[0] = sp[0].fUnsigned >> READ8();
                 continue;
 
-            VECTOR_UNARY_FN_VEC(kSin, sinf)
+            VECTOR_UNARY_FN(kSin, skvx::sin, fFloat)
             VECTOR_UNARY_FN(kSqrt, skvx::sqrt, fFloat)
 
             case ByteCodeInstruction::kStore4:
@@ -1075,7 +1062,7 @@
                 continue;
             }
 
-            VECTOR_UNARY_FN_VEC(kTan, tanf)
+            VECTOR_UNARY_FN(kTan, skvx::tan, fFloat)
 
             case ByteCodeInstruction::kWriteExternal4:
             case ByteCodeInstruction::kWriteExternal3: