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

Side by Side 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 unified diff | 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 //===- subzero/unittest/AssemblerX8632/Locked.cpp -------------------------===// 1 //===- subzero/unittest/AssemblerX8632/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 "AssemblerX8632/TestUtil.h" 9 #include "AssemblerX8632/TestUtil.h"
10 10
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 TestImpl(eax); 75 TestImpl(eax);
76 TestImpl(ebx); 76 TestImpl(ebx);
77 TestImpl(ecx); 77 TestImpl(ecx);
78 TestImpl(edx); 78 TestImpl(edx);
79 TestImpl(esi); 79 TestImpl(esi);
80 TestImpl(edi); 80 TestImpl(edi);
81 81
82 #undef TestImpl 82 #undef TestImpl
83 #undef TestImplSize 83 #undef TestImplSize
84 #undef TestImplAddrReg 84 #undef TestImplAddrReg
85
86 #define TestImplRegReg(Reg0, Value0, Reg1, Value1, Size) \
87 do { \
88 static constexpr char TestString[] = \
89 "(" #Reg0 "," #Value0 ", " #Reg1 ", " #Value1 ", " #Size ")"; \
90 const uint32_t V0 = (Value0)&Mask##Size; \
91 const uint32_t V1 = (Value1)&Mask##Size; \
92 \
93 __ mov(IceType_i##Size, GPRRegister::Encoded_Reg_##Reg0, \
94 Immediate(Value0)); \
95 __ mov(IceType_i##Size, GPRRegister::Encoded_Reg_##Reg1, \
96 Immediate(Value1)); \
97 __ xchg(IceType_i##Size, GPRRegister::Encoded_Reg_##Reg0, \
98 GPRRegister::Encoded_Reg_##Reg1); \
99 __ And(IceType_i32, GPRRegister::Encoded_Reg_##Reg0, \
100 Immediate(Mask##Size)); \
101 __ And(IceType_i32, GPRRegister::Encoded_Reg_##Reg1, \
102 Immediate(Mask##Size)); \
103 \
104 AssembledTest test = assemble(); \
105 test.run(); \
106 \
107 ASSERT_EQ(V0, test.Reg1()) << TestString; \
108 ASSERT_EQ(V1, test.Reg0()) << TestString; \
109 reset(); \
110 } while (0)
111
112 #define TestImplSize(Reg0, Reg1, Size) \
113 do { \
114 TestImplRegReg(Reg0, 0xa2b34567, Reg1, 0x0507ddee, Size); \
115 } while (0)
116
117 #define TestImpl(Reg0, Reg1) \
118 do { \
119 if (GPRRegister::Encoded_Reg_##Reg0 < 4 && \
120 GPRRegister::Encoded_Reg_##Reg1 < 4) { \
121 TestImplSize(Reg0, Reg1, 8); \
122 } \
123 TestImplSize(Reg0, Reg1, 16); \
124 TestImplSize(Reg0, Reg1, 32); \
125 } while (0)
126
127 TestImpl(eax, ebx);
128 TestImpl(edx, eax);
129 TestImpl(ecx, edx);
130 TestImpl(esi, eax);
131 TestImpl(edx, edi);
132
133 #undef TestImpl
134 #undef TestImplSize
135 #undef TestImplRegReg
85 } 136 }
86 137
87 TEST_F(AssemblerX8632Test, Xadd) { 138 TEST_F(AssemblerX8632Test, Xadd) {
88 static constexpr bool NotLocked = false; 139 static constexpr bool NotLocked = false;
89 static constexpr bool Locked = true; 140 static constexpr bool Locked = true;
90 141
91 static constexpr uint32_t Mask8 = 0x000000FF; 142 static constexpr uint32_t Mask8 = 0x000000FF;
92 static constexpr uint32_t Mask16 = 0x0000FFFF; 143 static constexpr uint32_t Mask16 = 0x0000FFFF;
93 static constexpr uint32_t Mask32 = 0xFFFFFFFF; 144 static constexpr uint32_t Mask32 = 0xFFFFFFFF;
94 145
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after
400 verifyBytes<ByteCountLocked32>(codeBytes(), 0xF0, 0x0F, 0xB1, 0x35, 0x00, 451 verifyBytes<ByteCountLocked32>(codeBytes(), 0xF0, 0x0F, 0xB1, 0x35, 0x00,
401 0xFF, 0x01, 0x00); 452 0xFF, 0x01, 0x00);
402 reset(); 453 reset();
403 } 454 }
404 } 455 }
405 456
406 } // end of anonymous namespace 457 } // end of anonymous namespace
407 } // end of namespace Test 458 } // end of namespace Test
408 } // end of namespace X8632 459 } // end of namespace X8632
409 } // end of namespace Ice 460 } // end of namespace Ice
OLDNEW
« 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