| OLD | NEW |
| (Empty) | |
| 1 //===- subzero/unittest/AssemblerX8632/Other.cpp --------------------------===// |
| 2 // |
| 3 // The Subzero Code Generator |
| 4 // |
| 5 // This file is distributed under the University of Illinois Open Source |
| 6 // License. See LICENSE.TXT for details. |
| 7 // |
| 8 //===----------------------------------------------------------------------===// |
| 9 #include "AssemblerX8632/TestUtil.h" |
| 10 |
| 11 namespace Ice { |
| 12 namespace X8632 { |
| 13 namespace Test { |
| 14 namespace { |
| 15 |
| 16 TEST_F(AssemblerX8632LowLevelTest, Nop) { |
| 17 #define TestImpl(Size, ...) \ |
| 18 do { \ |
| 19 static constexpr char TestString[] = "(" #Size ", " #__VA_ARGS__ ")"; \ |
| 20 __ nop(Size); \ |
| 21 ASSERT_EQ(Size##u, codeBytesSize()) << TestString; \ |
| 22 ASSERT_TRUE(verifyBytes<Size>(codeBytes(), __VA_ARGS__)) << TestString; \ |
| 23 reset(); \ |
| 24 } while (0); |
| 25 |
| 26 TestImpl(1, 0x90); |
| 27 TestImpl(2, 0x66, 0x90); |
| 28 TestImpl(3, 0x0F, 0x1F, 0x00); |
| 29 TestImpl(4, 0x0F, 0x1F, 0x40, 0x00); |
| 30 TestImpl(5, 0x0F, 0x1F, 0x44, 0x00, 0x00); |
| 31 TestImpl(6, 0x66, 0x0F, 0x1F, 0x44, 0x00, 0x00); |
| 32 TestImpl(7, 0x0F, 0x1F, 0x80, 0x00, 0x00, 0x00, 0x00); |
| 33 TestImpl(8, 0x0F, 0x1F, 0x84, 0x00, 0x00, 0x00, 0x00, 0x00); |
| 34 |
| 35 #undef TestImpl |
| 36 } |
| 37 |
| 38 TEST_F(AssemblerX8632LowLevelTest, Int3) { |
| 39 __ int3(); |
| 40 static constexpr uint32_t ByteCount = 1; |
| 41 ASSERT_EQ(ByteCount, codeBytesSize()); |
| 42 verifyBytes<ByteCount>(codeBytes(), 0xCC); |
| 43 } |
| 44 |
| 45 TEST_F(AssemblerX8632LowLevelTest, Hlt) { |
| 46 __ hlt(); |
| 47 static constexpr uint32_t ByteCount = 1; |
| 48 ASSERT_EQ(ByteCount, codeBytesSize()); |
| 49 verifyBytes<ByteCount>(codeBytes(), 0xF4); |
| 50 } |
| 51 |
| 52 TEST_F(AssemblerX8632LowLevelTest, Ud2) { |
| 53 __ ud2(); |
| 54 static constexpr uint32_t ByteCount = 2; |
| 55 ASSERT_EQ(ByteCount, codeBytesSize()); |
| 56 verifyBytes<ByteCount>(codeBytes(), 0x0F, 0x0B); |
| 57 } |
| 58 |
| 59 TEST_F(AssemblerX8632LowLevelTest, EmitSegmentOverride) { |
| 60 #define TestImpl(Prefix) \ |
| 61 do { \ |
| 62 static constexpr uint8_t ByteCount = 1; \ |
| 63 __ emitSegmentOverride(Prefix); \ |
| 64 ASSERT_EQ(ByteCount, codeBytesSize()) << Prefix; \ |
| 65 verifyBytes<ByteCount>(codeBytes(), Prefix); \ |
| 66 reset(); \ |
| 67 } while (0) |
| 68 |
| 69 TestImpl(0x26); |
| 70 TestImpl(0x2E); |
| 71 TestImpl(0x36); |
| 72 TestImpl(0x3E); |
| 73 TestImpl(0x64); |
| 74 TestImpl(0x65); |
| 75 TestImpl(0x66); |
| 76 TestImpl(0x67); |
| 77 |
| 78 #undef TestImpl |
| 79 } |
| 80 |
| 81 } // end of anonymous namespace |
| 82 } // end of namespace Test |
| 83 } // end of namespace X8632 |
| 84 } // end of namespace Ice |
| OLD | NEW |