1 //===-- AssemblerTest.cpp ---------------------------------------*- C++ -*-===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
9 #include "../Common/AssemblerUtils.h"
10 #include "X86InstrInfo.h"
15 void InitializeX86ExegesisTarget();
19 using llvm::MCInstBuilder
;
21 using llvm::X86::MOV32ri
;
22 using llvm::X86::MOV64ri32
;
24 using llvm::X86::XOR32rr
;
26 class X86MachineFunctionGeneratorTest
27 : public MachineFunctionGeneratorBaseTest
{
29 X86MachineFunctionGeneratorTest()
30 : MachineFunctionGeneratorBaseTest("x86_64-unknown-linux", "haswell") {}
32 static void SetUpTestCase() {
33 LLVMInitializeX86TargetInfo();
34 LLVMInitializeX86TargetMC();
35 LLVMInitializeX86Target();
36 LLVMInitializeX86AsmPrinter();
37 InitializeX86ExegesisTarget();
41 TEST_F(X86MachineFunctionGeneratorTest
, DISABLED_JitFunction
) {
42 Check({}, llvm::MCInst(), 0xc3);
45 TEST_F(X86MachineFunctionGeneratorTest
, DISABLED_JitFunctionXOR32rr_X86
) {
46 Check({{EAX
, llvm::APInt(32, 1)}},
47 MCInstBuilder(XOR32rr
).addReg(EAX
).addReg(EAX
).addReg(EAX
),
49 0xb8, 0x01, 0x00, 0x00, 0x00,
54 TEST_F(X86MachineFunctionGeneratorTest
, DISABLED_JitFunctionMOV64ri
) {
55 Check({}, MCInstBuilder(MOV64ri32
).addReg(RAX
).addImm(42), 0x48, 0xc7, 0xc0,
56 0x2a, 0x00, 0x00, 0x00, 0xc3);
59 TEST_F(X86MachineFunctionGeneratorTest
, DISABLED_JitFunctionMOV32ri
) {
60 Check({}, MCInstBuilder(MOV32ri
).addReg(EAX
).addImm(42), 0xb8, 0x2a, 0x00,
65 } // namespace exegesis