Index: unittest/AssemblerX8664/XmmArith.cpp |
diff --git a/unittest/AssemblerX8664/XmmArith.cpp b/unittest/AssemblerX8664/XmmArith.cpp |
index 6a0d9f5b40430699d2acac4e0b7b3514fb8d3caa..c0375203edc8ed96b67c12506c4be109779e4802 100644 |
--- a/unittest/AssemblerX8664/XmmArith.cpp |
+++ b/unittest/AssemblerX8664/XmmArith.cpp |
@@ -1083,6 +1083,81 @@ TEST_F(AssemblerX8664Test, Shufp) { |
#undef TestImplSingleXmmXmm |
} |
+TEST_F(AssemblerX8664Test, Punpckldq) { |
+ const Dqword V0(uint64_t(0x1111111122222222ull), |
+ uint64_t(0x5555555577777777ull)); |
+ const Dqword V1(uint64_t(0xAAAAAAAABBBBBBBBull), |
+ uint64_t(0xCCCCCCCCDDDDDDDDull)); |
+ |
+ const Dqword Expected(uint64_t(0xBBBBBBBB22222222ull), |
+ uint64_t(0xAAAAAAAA11111111ull)); |
+ |
+#define TestImplXmmXmm(Dst, Src, Inst) \ |
+ do { \ |
+ static constexpr char TestString[] = "(" #Dst ", " #Src ", " #Inst ")"; \ |
+ const uint32_t T0 = allocateDqword(); \ |
+ const uint32_t T1 = allocateDqword(); \ |
+ \ |
+ __ movups(XmmRegister::Encoded_Reg_##Dst, dwordAddress(T0)); \ |
+ __ movups(XmmRegister::Encoded_Reg_##Src, dwordAddress(T1)); \ |
+ __ Inst(IceType_void, XmmRegister::Encoded_Reg_##Dst, \ |
+ XmmRegister::Encoded_Reg_##Src); \ |
+ \ |
+ AssembledTest test = assemble(); \ |
+ test.setDqwordTo(T0, V0); \ |
+ test.setDqwordTo(T1, V1); \ |
+ test.run(); \ |
+ \ |
+ ASSERT_EQ(Expected, test.Dst<Dqword>()) << TestString; \ |
+ reset(); \ |
+ } while (0) |
+ |
+#define TestImplXmmAddr(Dst, Inst) \ |
+ do { \ |
+ static constexpr char TestString[] = "(" #Dst ", Addr, " #Inst ")"; \ |
+ const uint32_t T0 = allocateDqword(); \ |
+ const uint32_t T1 = allocateDqword(); \ |
+ \ |
+ __ movups(XmmRegister::Encoded_Reg_##Dst, dwordAddress(T0)); \ |
+ __ Inst(IceType_void, XmmRegister::Encoded_Reg_##Dst, dwordAddress(T1)); \ |
+ \ |
+ AssembledTest test = assemble(); \ |
+ test.setDqwordTo(T0, V0); \ |
+ test.setDqwordTo(T1, V1); \ |
+ test.run(); \ |
+ \ |
+ ASSERT_EQ(Expected, test.Dst<Dqword>()) << TestString; \ |
+ reset(); \ |
+ } while (0) |
+ |
+#define TestImpl(Dst, Src) \ |
+ do { \ |
+ TestImplXmmXmm(Dst, Src, punpckldq); \ |
+ TestImplXmmAddr(Dst, punpckldq); \ |
+ } while (0) |
+ |
+ TestImpl(xmm0, xmm1); |
+ TestImpl(xmm1, xmm2); |
+ TestImpl(xmm2, xmm3); |
+ TestImpl(xmm3, xmm4); |
+ TestImpl(xmm4, xmm5); |
+ TestImpl(xmm5, xmm6); |
+ TestImpl(xmm6, xmm7); |
+ TestImpl(xmm7, xmm8); |
+ TestImpl(xmm8, xmm9); |
+ TestImpl(xmm9, xmm10); |
+ TestImpl(xmm10, xmm11); |
+ TestImpl(xmm11, xmm12); |
+ TestImpl(xmm12, xmm13); |
+ TestImpl(xmm13, xmm14); |
+ TestImpl(xmm14, xmm15); |
+ TestImpl(xmm15, xmm0); |
+ |
+#undef TestImpl |
+#undef TestImplXmmAddr |
+#undef TestImplXmmXmm |
+} |
+ |
TEST_F(AssemblerX8664Test, Cvt) { |
const Dqword dq2ps32DstValue(-1.0f, -1.0f, -1.0f, -1.0f); |
const Dqword dq2ps32SrcValue(-5, 3, 100, 200); |