Add test for MulAdd in Reactor
Test: New test passes
Bug: b/37496078
Change-Id: Ieff1b080bdde3f9c86a0531566c8b08d7cdf24fe
Reviewed-on: https://swiftshader-review.googlesource.com/13009
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Tested-by: Casey Dahlin <sadmac@google.com>
diff --git a/src/Reactor/Main.cpp b/src/Reactor/Main.cpp
index 0d22f4d..b04de27 100644
--- a/src/Reactor/Main.cpp
+++ b/src/Reactor/Main.cpp
@@ -923,6 +923,41 @@
delete routine;
}
+TEST(SubzeroReactorTest, MulAdd) {
+ Routine *routine = nullptr;
+
+ {
+ Function<Int(Pointer<Byte>)> function;
+ {
+ Pointer<Byte> out = function.Arg<0>();
+
+ *Pointer<Int2>(out + 8 * 0) =
+ MulAdd(Short4(0x1aa, 0x2dd, 0x3ee, 0xF422),
+ Short4(0x1bb, 0x2cc, 0x3ff, 0xF411));
+
+ // (U)Short8 variant is mentioned but unimplemented
+ Return(0);
+ }
+
+ routine = function(L"one");
+
+ if(routine)
+ {
+ int out[1][2];
+
+ memset(&out, 0, sizeof(out));
+
+ int(*callable)(void*) = (int(*)(void*))routine->getEntry();
+ callable(&out);
+
+ EXPECT_EQ((unsigned)out[0][0], 0x000ae34a);
+ EXPECT_EQ((unsigned)out[0][1], 0x009d5254);
+ }
+ }
+
+ delete routine;
+}
+
int main(int argc, char **argv)
{
::testing::InitGoogleTest(&argc, argv);