Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(425)

Unified Diff: unittest/AssemblerX8632/Locked.cpp

Issue 1278173009: Inline memove for small constant sizes and refactor memcpy and memset. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tests_lit/llvm2ice_tests/nacl-mem-intrinsics.ll ('k') | unittest/AssemblerX8664/Locked.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: unittest/AssemblerX8632/Locked.cpp
diff --git a/unittest/AssemblerX8632/Locked.cpp b/unittest/AssemblerX8632/Locked.cpp
index 82c1e140eed847b9fbd2ff72fdadb1a88fd7397e..9be0f940788a7fc09e10f943605b281b1f7dd325 100644
--- a/unittest/AssemblerX8632/Locked.cpp
+++ b/unittest/AssemblerX8632/Locked.cpp
@@ -82,6 +82,57 @@ TEST_F(AssemblerX8632Test, Xchg) {
#undef TestImpl
#undef TestImplSize
#undef TestImplAddrReg
+
+#define TestImplRegReg(Reg0, Value0, Reg1, Value1, Size) \
+ do { \
+ static constexpr char TestString[] = \
+ "(" #Reg0 "," #Value0 ", " #Reg1 ", " #Value1 ", " #Size ")"; \
+ const uint32_t V0 = (Value0)&Mask##Size; \
+ const uint32_t V1 = (Value1)&Mask##Size; \
+ \
+ __ mov(IceType_i##Size, GPRRegister::Encoded_Reg_##Reg0, \
+ Immediate(Value0)); \
+ __ mov(IceType_i##Size, GPRRegister::Encoded_Reg_##Reg1, \
+ Immediate(Value1)); \
+ __ xchg(IceType_i##Size, GPRRegister::Encoded_Reg_##Reg0, \
+ GPRRegister::Encoded_Reg_##Reg1); \
+ __ And(IceType_i32, GPRRegister::Encoded_Reg_##Reg0, \
+ Immediate(Mask##Size)); \
+ __ And(IceType_i32, GPRRegister::Encoded_Reg_##Reg1, \
+ Immediate(Mask##Size)); \
+ \
+ AssembledTest test = assemble(); \
+ test.run(); \
+ \
+ ASSERT_EQ(V0, test.Reg1()) << TestString; \
+ ASSERT_EQ(V1, test.Reg0()) << TestString; \
+ reset(); \
+ } while (0)
+
+#define TestImplSize(Reg0, Reg1, Size) \
+ do { \
+ TestImplRegReg(Reg0, 0xa2b34567, Reg1, 0x0507ddee, Size); \
+ } while (0)
+
+#define TestImpl(Reg0, Reg1) \
+ do { \
+ if (GPRRegister::Encoded_Reg_##Reg0 < 4 && \
+ GPRRegister::Encoded_Reg_##Reg1 < 4) { \
+ TestImplSize(Reg0, Reg1, 8); \
+ } \
+ TestImplSize(Reg0, Reg1, 16); \
+ TestImplSize(Reg0, Reg1, 32); \
+ } while (0)
+
+ TestImpl(eax, ebx);
+ TestImpl(edx, eax);
+ TestImpl(ecx, edx);
+ TestImpl(esi, eax);
+ TestImpl(edx, edi);
+
+#undef TestImpl
+#undef TestImplSize
+#undef TestImplRegReg
}
TEST_F(AssemblerX8632Test, Xadd) {
« no previous file with comments | « tests_lit/llvm2ice_tests/nacl-mem-intrinsics.ll ('k') | unittest/AssemblerX8664/Locked.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698