• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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:
X86MachineFunctionGeneratorTest()26   X86MachineFunctionGeneratorTest()
27       : MachineFunctionGeneratorBaseTest("x86_64-unknown-linux", "haswell") {}
28 
SetUpTestCase()29   static void SetUpTestCase() {
30     LLVMInitializeX86TargetInfo();
31     LLVMInitializeX86TargetMC();
32     LLVMInitializeX86Target();
33     LLVMInitializeX86AsmPrinter();
34   }
35 };
36 
TEST_F(X86MachineFunctionGeneratorTest,DISABLED_JitFunction)37 TEST_F(X86MachineFunctionGeneratorTest, DISABLED_JitFunction) {
38   Check(llvm::MCInst(), 0xc3);
39 }
40 
TEST_F(X86MachineFunctionGeneratorTest,DISABLED_JitFunctionXOR32rr)41 TEST_F(X86MachineFunctionGeneratorTest, DISABLED_JitFunctionXOR32rr) {
42   Check(MCInstBuilder(XOR32rr).addReg(EAX).addReg(EAX).addReg(EAX), 0x31, 0xc0,
43         0xc3);
44 }
45 
TEST_F(X86MachineFunctionGeneratorTest,DISABLED_JitFunctionMOV64ri)46 TEST_F(X86MachineFunctionGeneratorTest, DISABLED_JitFunctionMOV64ri) {
47   Check(MCInstBuilder(MOV64ri32).addReg(RAX).addImm(42), 0x48, 0xc7, 0xc0, 0x2a,
48         0x00, 0x00, 0x00, 0xc3);
49 }
50 
TEST_F(X86MachineFunctionGeneratorTest,DISABLED_JitFunctionMOV32ri)51 TEST_F(X86MachineFunctionGeneratorTest, DISABLED_JitFunctionMOV32ri) {
52   Check(MCInstBuilder(MOV32ri).addReg(EAX).addImm(42), 0xb8, 0x2a, 0x00, 0x00,
53         0x00, 0xc3);
54 }
55 
56 } // namespace
57 } // namespace exegesis
58