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

Unified Diff: unittest/AssemblerX8664/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: Simplify xtests and add flags for memory intrinsic optimization. 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
« unittest/AssemblerX8632/Locked.cpp ('K') | « unittest/AssemblerX8632/Locked.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: unittest/AssemblerX8664/Locked.cpp
diff --git a/unittest/AssemblerX8664/Locked.cpp b/unittest/AssemblerX8664/Locked.cpp
index f93f2d28f8824df7ccef067461b4f6140ef26812..ff9f22fefd21f5aa8f68d76dbf74216a8eddcf90 100644
--- a/unittest/AssemblerX8664/Locked.cpp
+++ b/unittest/AssemblerX8664/Locked.cpp
@@ -85,6 +85,51 @@ TEST_F(AssemblerX8664Test, 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, Encoded_GPR_##Reg0(), Immediate(Value0)); \
+ __ mov(IceType_i##Size, Encoded_GPR_##Reg1(), Immediate(Value1)); \
+ __ xchg(IceType_i##Size, Encoded_GPR_##Reg0(), Encoded_GPR_##Reg1()); \
+ __ And(IceType_i32, Encoded_GPR_##Reg0(), Immediate(Mask##Size)); \
+ __ And(IceType_i32, Encoded_GPR_##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 { \
+ TestImplSize(Reg0, Reg1, 8); \
+ TestImplSize(Reg0, Reg1, 16); \
+ TestImplSize(Reg0, Reg1, 32); \
jvoung (off chromium) 2015/08/18 17:18:22 Does size 64 work?
ascull 2015/08/18 18:38:01 No. I tried it and there were a lot of build error
+ } while (0)
+
+ TestImpl(r1, r8);
jvoung (off chromium) 2015/08/18 17:18:22 Maybe throw in eax/rax too, if that has a special
ascull 2015/08/18 18:38:01 Done.
John 2015/08/18 18:51:39 r1 == rax Sorry for making this so confusing.
ascull 2015/08/18 19:03:10 Ok, I've fixed the fix ;)
+ TestImpl(r2, r10);
+ TestImpl(r3, r11);
+ TestImpl(r4, r12);
+ TestImpl(r5, r13);
+ TestImpl(r6, r14);
+ TestImpl(r7, r15);
+
+#undef TestImpl
+#undef TestImplSize
+#undef TestImplAddrReg
jvoung (off chromium) 2015/08/18 17:18:22 undef TestImplRegReg
ascull 2015/08/18 18:38:01 Done.
}
TEST_F(AssemblerX8664Test, Xadd) {
« unittest/AssemblerX8632/Locked.cpp ('K') | « unittest/AssemblerX8632/Locked.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698