Commit 4e759e4e by Casey Dahlin

Add test for Unpack in Reactor

Test: New test passes Bug: b/67106219 Change-Id: Ib21f73d312d39cf2b3aa15a11d2a207885a58978 Reviewed-on: https://swiftshader-review.googlesource.com/12828Reviewed-by: 's avatarNicolas Capens <nicolascapens@google.com> Tested-by: 's avatarCasey Dahlin <sadmac@google.com>
parent 444b04ad
......@@ -773,6 +773,53 @@ TEST(SubzeroReactorTest, SaturatedAddAndSubtract)
delete routine;
}
TEST(SubzeroReactorTest, Unpack)
{
Routine *routine = nullptr;
{
Function<Int(Pointer<Byte>,Pointer<Byte>)> function;
{
Pointer<Byte> in = function.Arg<0>();
Pointer<Byte> out = function.Arg<1>();
Byte4 test_byte_a = *Pointer<Byte4>(in + 4 * 0);
Byte4 test_byte_b = *Pointer<Byte4>(in + 4 * 1);
*Pointer<Short4>(out + 8 * 0) =
Unpack(test_byte_a, test_byte_b);
*Pointer<Short4>(out + 8 * 1) = Unpack(test_byte_a);
Return(0);
}
routine = function(L"one");
if(routine)
{
int in[1][2];
int out[2][2];
memset(&out, 0, sizeof(out));
in[0][0] = 0xABCDEF12;
in[0][1] = 0x34567890;
int(*callable)(void*,void*) = (int(*)(void*,void*))routine->getEntry();
callable(&in, &out);
EXPECT_EQ(out[0][0], 0x78EF9012);
EXPECT_EQ(out[0][1], 0x34AB56CD);
EXPECT_EQ(out[1][0], 0xEFEF1212);
EXPECT_EQ(out[1][1], 0xABABCDCD);
}
}
delete routine;
}
int main(int argc, char **argv)
{
::testing::InitGoogleTest(&argc, argv);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment