| OLD | NEW |
| 1 //===- subzero/unittest/AssemblerX8632/LowLevel.cpp -----------------------===// | 1 //===- subzero/unittest/AssemblerX8632/LowLevel.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 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 196 reset(); \ | 196 reset(); \ |
| 197 } while (0) | 197 } while (0) |
| 198 | 198 |
| 199 #define TestAddrBaseScaledIndexImm(Inst, Base, Index, Scale, Disp, Imm, \ | 199 #define TestAddrBaseScaledIndexImm(Inst, Base, Index, Scale, Disp, Imm, \ |
| 200 OpType, ByteCountUntyped, ...) \ | 200 OpType, ByteCountUntyped, ...) \ |
| 201 do { \ | 201 do { \ |
| 202 static constexpr char TestString[] = \ | 202 static constexpr char TestString[] = \ |
| 203 "(" #Inst ", " #Base ", " #Index ", " #Scale ", " #Disp ", " #Imm \ | 203 "(" #Inst ", " #Base ", " #Index ", " #Scale ", " #Disp ", " #Imm \ |
| 204 ", " #OpType ", " #ByteCountUntyped ", " #__VA_ARGS__ ")"; \ | 204 ", " #OpType ", " #ByteCountUntyped ", " #__VA_ARGS__ ")"; \ |
| 205 static constexpr uint8_t ByteCount = ByteCountUntyped; \ | 205 static constexpr uint8_t ByteCount = ByteCountUntyped; \ |
| 206 __ Inst(IceType_##OpType, Address(GPRRegister::Encoded_Reg_##Base, \ | 206 __ Inst(IceType_##OpType, \ |
| 207 GPRRegister::Encoded_Reg_##Index, \ | 207 Address(GPRRegister::Encoded_Reg_##Base, \ |
| 208 Traits::TIMES_##Scale, Disp, \ | 208 GPRRegister::Encoded_Reg_##Index, Traits::TIMES_##Scale, \ |
| 209 AssemblerFixup::NoFixup), \ | 209 Disp, AssemblerFixup::NoFixup), \ |
| 210 Immediate(Imm)); \ | 210 Immediate(Imm)); \ |
| 211 ASSERT_EQ(ByteCount, codeBytesSize()) << TestString; \ | 211 ASSERT_EQ(ByteCount, codeBytesSize()) << TestString; \ |
| 212 ASSERT_TRUE(verifyBytes<ByteCount>(codeBytes(), __VA_ARGS__)) \ | 212 ASSERT_TRUE(verifyBytes<ByteCount>(codeBytes(), __VA_ARGS__)) \ |
| 213 << TestString; \ | 213 << TestString; \ |
| 214 reset(); \ | 214 reset(); \ |
| 215 } while (0) | 215 } while (0) |
| 216 | 216 |
| 217 #define TestAddrBaseScaledIndexReg(Inst, Base, Index, Scale, Disp, Src, \ | 217 #define TestAddrBaseScaledIndexReg(Inst, Base, Index, Scale, Disp, Src, \ |
| 218 OpType, ByteCountUntyped, ...) \ | 218 OpType, ByteCountUntyped, ...) \ |
| 219 do { \ | 219 do { \ |
| 220 static constexpr char TestString[] = \ | 220 static constexpr char TestString[] = \ |
| 221 "(" #Inst ", " #Base ", " #Index ", " #Scale ", " #Disp ", " #Src \ | 221 "(" #Inst ", " #Base ", " #Index ", " #Scale ", " #Disp ", " #Src \ |
| 222 ", " #OpType ", " #ByteCountUntyped ", " #__VA_ARGS__ ")"; \ | 222 ", " #OpType ", " #ByteCountUntyped ", " #__VA_ARGS__ ")"; \ |
| 223 static constexpr uint8_t ByteCount = ByteCountUntyped; \ | 223 static constexpr uint8_t ByteCount = ByteCountUntyped; \ |
| 224 __ Inst(IceType_##OpType, Address(GPRRegister::Encoded_Reg_##Base, \ | 224 __ Inst(IceType_##OpType, \ |
| 225 GPRRegister::Encoded_Reg_##Index, \ | 225 Address(GPRRegister::Encoded_Reg_##Base, \ |
| 226 Traits::TIMES_##Scale, Disp, \ | 226 GPRRegister::Encoded_Reg_##Index, Traits::TIMES_##Scale, \ |
| 227 AssemblerFixup::NoFixup), \ | 227 Disp, AssemblerFixup::NoFixup), \ |
| 228 GPRRegister::Encoded_Reg_##Src); \ | 228 GPRRegister::Encoded_Reg_##Src); \ |
| 229 ASSERT_EQ(ByteCount, codeBytesSize()) << TestString; \ | 229 ASSERT_EQ(ByteCount, codeBytesSize()) << TestString; \ |
| 230 ASSERT_TRUE(verifyBytes<ByteCount>(codeBytes(), __VA_ARGS__)) \ | 230 ASSERT_TRUE(verifyBytes<ByteCount>(codeBytes(), __VA_ARGS__)) \ |
| 231 << TestString; \ | 231 << TestString; \ |
| 232 reset(); \ | 232 reset(); \ |
| 233 } while (0) | 233 } while (0) |
| 234 | 234 |
| 235 /* cmp GPR, GPR */ | 235 /* cmp GPR, GPR */ |
| 236 TestRegReg(cmp, eax, ecx, i32, 2, 0x3B, 0xC1); | 236 TestRegReg(cmp, eax, ecx, i32, 2, 0x3B, 0xC1); |
| 237 TestRegReg(cmp, ecx, edx, i32, 2, 0x3B, 0xCA); | 237 TestRegReg(cmp, ecx, edx, i32, 2, 0x3B, 0xCA); |
| (...skipping 466 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 704 EXPECT_FLOAT_EQ(1.0f, test.contentsOfDword<float>(S0)); | 704 EXPECT_FLOAT_EQ(1.0f, test.contentsOfDword<float>(S0)); |
| 705 EXPECT_FLOAT_EQ(2.0f, test.contentsOfDword<float>(S1)); | 705 EXPECT_FLOAT_EQ(2.0f, test.contentsOfDword<float>(S1)); |
| 706 EXPECT_FLOAT_EQ(3.0f, test.contentsOfDword<float>(S2)); | 706 EXPECT_FLOAT_EQ(3.0f, test.contentsOfDword<float>(S2)); |
| 707 EXPECT_FLOAT_EQ(4.0f, test.contentsOfDword<float>(S3)); | 707 EXPECT_FLOAT_EQ(4.0f, test.contentsOfDword<float>(S3)); |
| 708 } | 708 } |
| 709 | 709 |
| 710 } // end of anonymous namespace | 710 } // end of anonymous namespace |
| 711 } // end of namespace Test | 711 } // end of namespace Test |
| 712 } // end of namespace X8632 | 712 } // end of namespace X8632 |
| 713 } // end of namespace Ice | 713 } // end of namespace Ice |
| OLD | NEW |