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

Side by Side 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 unified diff | Download patch
OLDNEW
1 //===- subzero/unittest/AssemblerX8664/Locked.cpp -------------------------===// 1 //===- subzero/unittest/AssemblerX8664/Locked.cpp -------------------------===//
2 // 2 //
3 // The Subzero Code Generator 3 // The Subzero Code Generator
4 // 4 //
5 // This file is distributed under the University of Illinois Open Source 5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details. 6 // License. See LICENSE.TXT for details.
7 // 7 //
8 //===----------------------------------------------------------------------===// 8 //===----------------------------------------------------------------------===//
9 #include "AssemblerX8664/TestUtil.h" 9 #include "AssemblerX8664/TestUtil.h"
10 10
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 TestImpl(r10); 78 TestImpl(r10);
79 TestImpl(r11); 79 TestImpl(r11);
80 TestImpl(r12); 80 TestImpl(r12);
81 TestImpl(r13); 81 TestImpl(r13);
82 TestImpl(r14); 82 TestImpl(r14);
83 TestImpl(r15); 83 TestImpl(r15);
84 84
85 #undef TestImpl 85 #undef TestImpl
86 #undef TestImplSize 86 #undef TestImplSize
87 #undef TestImplAddrReg 87 #undef TestImplAddrReg
88
89 #define TestImplRegReg(Reg0, Value0, Reg1, Value1, Size) \
90 do { \
91 static constexpr char TestString[] = \
92 "(" #Reg0 "," #Value0 ", " #Reg1 ", " #Value1 ", " #Size ")"; \
93 const uint32_t V0 = (Value0)&Mask##Size; \
94 const uint32_t V1 = (Value1)&Mask##Size; \
95 \
96 __ mov(IceType_i##Size, Encoded_GPR_##Reg0(), Immediate(Value0)); \
97 __ mov(IceType_i##Size, Encoded_GPR_##Reg1(), Immediate(Value1)); \
98 __ xchg(IceType_i##Size, Encoded_GPR_##Reg0(), Encoded_GPR_##Reg1()); \
99 __ And(IceType_i32, Encoded_GPR_##Reg0(), Immediate(Mask##Size)); \
100 __ And(IceType_i32, Encoded_GPR_##Reg1(), Immediate(Mask##Size)); \
101 \
102 AssembledTest test = assemble(); \
103 test.run(); \
104 \
105 ASSERT_EQ(V0, test.Reg1()) << TestString; \
106 ASSERT_EQ(V1, test.Reg0()) << TestString; \
107 reset(); \
108 } while (0)
109
110 #define TestImplSize(Reg0, Reg1, Size) \
111 do { \
112 TestImplRegReg(Reg0, 0xa2b34567, Reg1, 0x0507ddee, Size); \
113 } while (0)
114
115 #define TestImpl(Reg0, Reg1) \
116 do { \
117 TestImplSize(Reg0, Reg1, 8); \
118 TestImplSize(Reg0, Reg1, 16); \
119 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
120 } while (0)
121
122 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 ;)
123 TestImpl(r2, r10);
124 TestImpl(r3, r11);
125 TestImpl(r4, r12);
126 TestImpl(r5, r13);
127 TestImpl(r6, r14);
128 TestImpl(r7, r15);
129
130 #undef TestImpl
131 #undef TestImplSize
132 #undef TestImplAddrReg
jvoung (off chromium) 2015/08/18 17:18:22 undef TestImplRegReg
ascull 2015/08/18 18:38:01 Done.
88 } 133 }
89 134
90 TEST_F(AssemblerX8664Test, Xadd) { 135 TEST_F(AssemblerX8664Test, Xadd) {
91 static constexpr bool NotLocked = false; 136 static constexpr bool NotLocked = false;
92 static constexpr bool Locked = true; 137 static constexpr bool Locked = true;
93 138
94 static constexpr uint32_t Mask8 = 0x000000FF; 139 static constexpr uint32_t Mask8 = 0x000000FF;
95 static constexpr uint32_t Mask16 = 0x0000FFFF; 140 static constexpr uint32_t Mask16 = 0x0000FFFF;
96 static constexpr uint32_t Mask32 = 0xFFFFFFFF; 141 static constexpr uint32_t Mask32 = 0xFFFFFFFF;
97 142
(...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after
440 ASSERT_TRUE(verifyBytes<ByteCountLocked32>( 485 ASSERT_TRUE(verifyBytes<ByteCountLocked32>(
441 codeBytes(), 0xF0, 0x44, 0x0F, 0xB1, 0x35, 0x00, 0xFF, 0x01, 0x00)); 486 codeBytes(), 0xF0, 0x44, 0x0F, 0xB1, 0x35, 0x00, 0xFF, 0x01, 0x00));
442 reset(); 487 reset();
443 } 488 }
444 } 489 }
445 490
446 } // end of anonymous namespace 491 } // end of anonymous namespace
447 } // end of namespace Test 492 } // end of namespace Test
448 } // end of namespace X8664 493 } // end of namespace X8664
449 } // end of namespace Ice 494 } // end of namespace Ice
OLDNEW
« 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