summaryrefslogtreecommitdiff
path: root/Source/UnitTests/Common/x64EmitterTest.cpp
diff options
context:
space:
mode:
authorTillmann Karras <tilkax@gmail.com>2015-05-17 09:20:29 +0200
committerTillmann Karras <tilkax@gmail.com>2015-06-02 19:19:52 +0200
commit8db6588bb921d1beac5b7df50ac24e67453f0991 (patch)
tree89bd0fa8674dd48d75da0b5dd2056ed5a4ba3850 /Source/UnitTests/Common/x64EmitterTest.cpp
parent7d29039c4869a7a88a12147a29f1dd06581c392f (diff)
XEmitter: add FMA4 instructions
Diffstat (limited to 'Source/UnitTests/Common/x64EmitterTest.cpp')
-rw-r--r--Source/UnitTests/Common/x64EmitterTest.cpp39
1 files changed, 39 insertions, 0 deletions
diff --git a/Source/UnitTests/Common/x64EmitterTest.cpp b/Source/UnitTests/Common/x64EmitterTest.cpp
index 886380e198..766fc0436c 100644
--- a/Source/UnitTests/Common/x64EmitterTest.cpp
+++ b/Source/UnitTests/Common/x64EmitterTest.cpp
@@ -1045,4 +1045,43 @@ FMA3_TEST(VFNMSUB, S, false)
FMA3_TEST(VFMADDSUB, P, true)
FMA3_TEST(VFMSUBADD, P, true)
+// for VEX instructions that take the form op reg, reg, r/m, reg OR reg, reg, reg, r/m
+#define VEX_RRMR_RRRM_TEST(Name, sizename) \
+ TEST_F(x64EmitterTest, Name) \
+ { \
+ struct { \
+ int bits; \
+ std::vector<NamedReg> regs; \
+ std::string out_name; \
+ std::string size; \
+ } regsets[] = { \
+ { 64, xmmnames, "xmm0", sizename }, \
+ }; \
+ for (const auto& regset : regsets) \
+ for (const auto& r : regset.regs) \
+ { \
+ emitter->Name(r.reg, XMM0, R(XMM0), r.reg); \
+ emitter->Name(XMM0, XMM0, r.reg, MatR(R12)); \
+ emitter->Name(XMM0, r.reg, MatR(R12), XMM0); \
+ ExpectDisassembly(#Name " " + r.name+ ", " + regset.out_name + ", " + regset.out_name + ", " + r.name + " " \
+ #Name " " + regset.out_name + ", " + regset.out_name + ", " + r.name + ", " + regset.size + " ptr ds:[r12] " \
+ #Name " " + regset.out_name + ", " + r.name + ", " + regset.size + " ptr ds:[r12], " + regset.out_name); \
+ } \
+ }
+
+#define FMA4_TEST(Name, P, packed) \
+ VEX_RRMR_RRRM_TEST(Name ## P ## S, packed ? "dqword" : "dword") \
+ VEX_RRMR_RRRM_TEST(Name ## P ## D, packed ? "dqword" : "qword")
+
+FMA4_TEST(VFMADD, P, true)
+FMA4_TEST(VFMADD, S, false)
+FMA4_TEST(VFMSUB, P, true)
+FMA4_TEST(VFMSUB, S, false)
+FMA4_TEST(VFNMADD, P, true)
+FMA4_TEST(VFNMADD, S, false)
+FMA4_TEST(VFNMSUB, P, true)
+FMA4_TEST(VFNMSUB, S, false)
+FMA4_TEST(VFMADDSUB, P, true)
+FMA4_TEST(VFMSUBADD, P, true)
+
} // namespace Gen