OLD | NEW |
1 //===- subzero/unittest/AssemblerX8664/GPRArith.cpp -----------------------===// | 1 //===- subzero/unittest/AssemblerX8664/GPRArith.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 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
322 #undef TestLeaScaled32bitDisp | 322 #undef TestLeaScaled32bitDisp |
323 #undef TestLeaBaseDisp | 323 #undef TestLeaBaseDisp |
324 } | 324 } |
325 | 325 |
326 TEST_F(AssemblerX8664LowLevelTest, LeaAbsolute) { | 326 TEST_F(AssemblerX8664LowLevelTest, LeaAbsolute) { |
327 #define TestLeaAbsolute(Dst, Value) \ | 327 #define TestLeaAbsolute(Dst, Value) \ |
328 do { \ | 328 do { \ |
329 static constexpr char TestString[] = "(" #Dst ", " #Value ")"; \ | 329 static constexpr char TestString[] = "(" #Dst ", " #Value ")"; \ |
330 __ lea(IceType_i32, GPRRegister::Encoded_Reg_##Dst, \ | 330 __ lea(IceType_i32, GPRRegister::Encoded_Reg_##Dst, \ |
331 Address(Value, AssemblerFixup::NoFixup)); \ | 331 Address(Value, AssemblerFixup::NoFixup)); \ |
332 static constexpr uint32_t ByteCount = 6; \ | 332 static constexpr uint32_t ByteCount = 8; \ |
333 ASSERT_EQ(ByteCount, codeBytesSize()) << TestString; \ | 333 ASSERT_EQ(ByteCount, codeBytesSize()) << TestString; \ |
334 static constexpr uint8_t Opcode = 0x8D; \ | 334 static constexpr uint8_t Opcode = 0x8D; \ |
335 static constexpr uint8_t ModRM = \ | 335 static constexpr uint8_t ModRM = \ |
336 /*mod=*/0x00 | /*reg*/ (GPRRegister::Encoded_Reg_##Dst << 3) | \ | 336 /*mod*/ 0x00 | /*reg*/ (GPRRegister::Encoded_Reg_##Dst << 3) | \ |
337 /*rm*/ GPRRegister::Encoded_Reg_ebp; \ | 337 /*rm*/ GPRRegister::Encoded_Reg_esp; \ |
| 338 static constexpr uint8_t SIB = \ |
| 339 /*Scale*/ 0x00 | /*Index*/ (GPRRegister::Encoded_Reg_esp << 3) | \ |
| 340 /*base*/ GPRRegister::Encoded_Reg_ebp; \ |
338 ASSERT_TRUE(verifyBytes<ByteCount>( \ | 341 ASSERT_TRUE(verifyBytes<ByteCount>( \ |
339 codeBytes(), Opcode, ModRM, (Value)&0xFF, (Value >> 8) & 0xFF, \ | 342 codeBytes(), 0x67, Opcode, ModRM, SIB, (Value)&0xFF, \ |
340 (Value >> 16) & 0xFF, (Value >> 24) & 0xFF)); \ | 343 (Value >> 8) & 0xFF, (Value >> 16) & 0xFF, (Value >> 24) & 0xFF)); \ |
341 reset(); \ | 344 reset(); \ |
342 } while (0) | 345 } while (0) |
343 | 346 |
344 TestLeaAbsolute(eax, 0x11BEEF22); | 347 TestLeaAbsolute(eax, 0x11BEEF22); |
345 TestLeaAbsolute(ebx, 0x33BEEF44); | 348 TestLeaAbsolute(ebx, 0x33BEEF44); |
346 TestLeaAbsolute(ecx, 0x55BEEF66); | 349 TestLeaAbsolute(ecx, 0x55BEEF66); |
347 TestLeaAbsolute(edx, 0x77BEEF88); | 350 TestLeaAbsolute(edx, 0x77BEEF88); |
348 TestLeaAbsolute(esi, 0x99BEEFAA); | 351 TestLeaAbsolute(esi, 0x99BEEFAA); |
349 TestLeaAbsolute(edi, 0xBBBEEFBB); | 352 TestLeaAbsolute(edi, 0xBBBEEFBB); |
350 | 353 |
(...skipping 1550 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1901 #undef TestImplValue | 1904 #undef TestImplValue |
1902 #undef TestImplSize | 1905 #undef TestImplSize |
1903 #undef TestImplRegAddr | 1906 #undef TestImplRegAddr |
1904 #undef TestImplRegReg | 1907 #undef TestImplRegReg |
1905 } | 1908 } |
1906 | 1909 |
1907 } // end of anonymous namespace | 1910 } // end of anonymous namespace |
1908 } // end of namespace Test | 1911 } // end of namespace Test |
1909 } // end of namespace X8664 | 1912 } // end of namespace X8664 |
1910 } // end of namespace Ice | 1913 } // end of namespace Ice |
OLD | NEW |