Implement unpacking of high 64-bit vector halves.
Bug swiftshader:15
Change-Id: I59bfec356b04ebc2ff7d8507d39ec8f18c57e42a
Reviewed-on: https://swiftshader-review.googlesource.com/7830
Reviewed-by: Nicolas Capens <capn@google.com>
Tested-by: Nicolas Capens <capn@google.com>
Reviewed-on: https://swiftshader-review.googlesource.com/8149
Reviewed-by: Alexis Hétu <sugoi@google.com>
diff --git a/src/Reactor/SubzeroReactor.cpp b/src/Reactor/SubzeroReactor.cpp
index a8c2b74..d169de1 100644
--- a/src/Reactor/SubzeroReactor.cpp
+++ b/src/Reactor/SubzeroReactor.cpp
@@ -2556,7 +2556,9 @@
RValue<Short4> UnpackHigh(RValue<Byte8> x, RValue<Byte8> y)
{
- assert(false && "UNIMPLEMENTED"); return RValue<Short4>(V(nullptr));
+ int shuffle[16] = {0, 16, 1, 17, 2, 18, 3, 19, 4, 20, 5, 21, 6, 22, 7, 23}; // Real type is v16i8
+ auto lowHigh = RValue<Byte16>(Nucleus::createShuffleVector(x.value, y.value, shuffle));
+ return As<Short4>(Swizzle(As<Int4>(lowHigh), 0xEE));
}
RValue<Int> SignMask(RValue<Byte8> x)
@@ -2773,7 +2775,9 @@
RValue<Short4> UnpackHigh(RValue<SByte8> x, RValue<SByte8> y)
{
- assert(false && "UNIMPLEMENTED"); return RValue<Short4>(V(nullptr));
+ int shuffle[16] = {0, 16, 1, 17, 2, 18, 3, 19, 4, 20, 5, 21, 6, 22, 7, 23}; // Real type is v16i8
+ auto lowHigh = RValue<Byte16>(Nucleus::createShuffleVector(x.value, y.value, shuffle));
+ return As<Short4>(Swizzle(As<Int4>(lowHigh), 0xEE));
}
RValue<Int> SignMask(RValue<SByte8> x)
@@ -3199,7 +3203,9 @@
RValue<Int2> UnpackHigh(RValue<Short4> x, RValue<Short4> y)
{
- assert(false && "UNIMPLEMENTED"); return RValue<Int2>(V(nullptr));
+ int shuffle[8] = {0, 8, 1, 9, 2, 10, 3, 11}; // Real type is v8i16
+ auto lowHigh = RValue<Short8>(Nucleus::createShuffleVector(x.value, y.value, shuffle));
+ return As<Int2>(Swizzle(As<Int4>(lowHigh), 0xEE));
}
RValue<Short4> Swizzle(RValue<Short4> x, unsigned char select)