Clement Courbet | 0e69e2d | 2018-05-17 10:52:18 +0000 | [diff] [blame] | 1 | //===-- AssemblerTest.cpp ---------------------------------------*- C++ -*-===// |
| 2 | // |
| 3 | // The LLVM Compiler Infrastructure |
| 4 | // |
| 5 | // This file is distributed under the University of Illinois Open Source |
| 6 | // License. See LICENSE.TXT for details. |
| 7 | // |
| 8 | //===----------------------------------------------------------------------===// |
| 9 | |
| 10 | #include "../Common/AssemblerUtils.h" |
| 11 | #include "X86InstrInfo.h" |
| 12 | |
| 13 | namespace exegesis { |
| 14 | namespace { |
| 15 | |
| 16 | using llvm::MCInstBuilder; |
| 17 | using llvm::X86::EAX; |
| 18 | using llvm::X86::MOV32ri; |
| 19 | using llvm::X86::MOV64ri32; |
| 20 | using llvm::X86::RAX; |
| 21 | using llvm::X86::XOR32rr; |
| 22 | |
| 23 | class X86MachineFunctionGeneratorTest |
| 24 | : public MachineFunctionGeneratorBaseTest { |
| 25 | protected: |
| 26 | X86MachineFunctionGeneratorTest() |
| 27 | : MachineFunctionGeneratorBaseTest("x86_64-unknown-linux", "haswell") {} |
| 28 | |
| 29 | static void SetUpTestCase() { |
| 30 | LLVMInitializeX86TargetInfo(); |
| 31 | LLVMInitializeX86TargetMC(); |
| 32 | LLVMInitializeX86Target(); |
| 33 | LLVMInitializeX86AsmPrinter(); |
| 34 | } |
| 35 | }; |
| 36 | |
Clement Courbet | 3d5e08d | 2018-05-17 11:55:08 +0000 | [diff] [blame^] | 37 | TEST_F(X86MachineFunctionGeneratorTest, DISABLED_JitFunction) { |
Clement Courbet | 0e69e2d | 2018-05-17 10:52:18 +0000 | [diff] [blame] | 38 | Check(llvm::MCInst(), 0xc3); |
| 39 | } |
| 40 | |
Clement Courbet | 3d5e08d | 2018-05-17 11:55:08 +0000 | [diff] [blame^] | 41 | TEST_F(X86MachineFunctionGeneratorTest, DISABLED_JitFunctionXOR32rr) { |
Clement Courbet | 0e69e2d | 2018-05-17 10:52:18 +0000 | [diff] [blame] | 42 | Check(MCInstBuilder(XOR32rr).addReg(EAX).addReg(EAX).addReg(EAX), 0x31, 0xc0, |
| 43 | 0xc3); |
| 44 | } |
| 45 | |
Clement Courbet | 3d5e08d | 2018-05-17 11:55:08 +0000 | [diff] [blame^] | 46 | TEST_F(X86MachineFunctionGeneratorTest, DISABLED_JitFunctionMOV64ri) { |
Clement Courbet | 0e69e2d | 2018-05-17 10:52:18 +0000 | [diff] [blame] | 47 | Check(MCInstBuilder(MOV64ri32).addReg(RAX).addImm(42), 0x48, 0xc7, 0xc0, 0x2a, |
| 48 | 0x00, 0x00, 0x00, 0xc3); |
| 49 | } |
| 50 | |
Clement Courbet | 3d5e08d | 2018-05-17 11:55:08 +0000 | [diff] [blame^] | 51 | TEST_F(X86MachineFunctionGeneratorTest, DISABLED_JitFunctionMOV32ri) { |
Clement Courbet | 0e69e2d | 2018-05-17 10:52:18 +0000 | [diff] [blame] | 52 | Check(MCInstBuilder(MOV32ri).addReg(EAX).addImm(42), 0xb8, 0x2a, 0x00, 0x00, |
| 53 | 0x00, 0xc3); |
| 54 | } |
| 55 | |
| 56 | } // namespace |
| 57 | } // namespace exegesis |