aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/SkNx.h
diff options
context:
space:
mode:
authorGravatar mtklein <mtklein@chromium.org>2016-07-26 08:01:19 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2016-07-26 08:01:20 -0700
commitf660b7cfcfbf3062f88e61f8320ea7051da72213 (patch)
treefca0db0effa07c70ea7f0b64f84b7f6e954c1944 /src/core/SkNx.h
parent8c523e0f3ffa66eefd70f893e9f863b7d9ea3dc9 (diff)
Add Sk4h_load4 for loading F16.
Should feel very similar to Sk4h_store4: NEON uses its native instruction, SSE unpacks manually. Since we'll have our F16s in 4 Sk4h by the time we're done here, this also extracts an Sk4h->Sk4f routine from the old uint64_t->Sk4f one. BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2184753002 CQ_INCLUDE_TRYBOTS=master.client.skia:Test-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Release-SKNX_NO_SIMD-Trybot Review-Url: https://codereview.chromium.org/2184753002
Diffstat (limited to 'src/core/SkNx.h')
-rw-r--r--src/core/SkNx.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/core/SkNx.h b/src/core/SkNx.h
index 253fcf22fe..308addd928 100644
--- a/src/core/SkNx.h
+++ b/src/core/SkNx.h
@@ -309,6 +309,19 @@ SI Sk4i Sk4f_round(const Sk4f& x) {
(int) lrintf (x[3]), };
}
+// Load 4 Sk4h and transpose them (256 bits total).
+SI void Sk4h_load4(const void* vptr, Sk4h* r, Sk4h* g, Sk4h* b, Sk4h* a) {
+ const uint64_t* ptr = (const uint64_t*)vptr;
+ auto p0 = Sk4h::Load(ptr+0),
+ p1 = Sk4h::Load(ptr+1),
+ p2 = Sk4h::Load(ptr+2),
+ p3 = Sk4h::Load(ptr+3);
+ *r = { p0[0], p1[0], p2[0], p3[0] };
+ *g = { p0[1], p1[1], p2[1], p3[1] };
+ *b = { p0[2], p1[2], p2[2], p3[2] };
+ *a = { p0[3], p1[3], p2[3], p3[3] };
+}
+
// Transpose 4 Sk4h and store (256 bits total).
SI void Sk4h_store4(void* dst, const Sk4h& r, const Sk4h& g, const Sk4h& b, const Sk4h& a) {
uint64_t* dst64 = (uint64_t*) dst;