150
|
1 // RUN: llvm-tblgen -gen-disassembler -I %p/../../include %s | FileCheck %s
|
|
2
|
|
3 // Check that if decoding of an instruction fails and the instruction does not
|
|
4 // have a complete decoder method that can determine if the bitpattern is valid
|
|
5 // or not then the decoder tries to find a more general instruction that
|
|
6 // matches the bitpattern too.
|
|
7
|
|
8 include "llvm/Target/Target.td"
|
|
9
|
|
10 def archInstrInfo : InstrInfo { }
|
|
11
|
|
12 def arch : Target {
|
|
13 let InstructionSet = archInstrInfo;
|
|
14 }
|
|
15
|
|
16 class TestInstruction : Instruction {
|
|
17 let Size = 1;
|
|
18 let OutOperandList = (outs);
|
|
19 let InOperandList = (ins);
|
|
20 field bits<8> Inst;
|
|
21 field bits<8> SoftFail = 0;
|
|
22 }
|
|
23
|
|
24 def InstA : TestInstruction {
|
|
25 let Inst = {0,0,0,0,?,?,?,?};
|
|
26 let AsmString = "InstA";
|
|
27 }
|
|
28
|
|
29 def InstB : TestInstruction {
|
|
30 let Inst = {0,0,0,0,0,0,?,?};
|
|
31 let AsmString = "InstB";
|
|
32 let DecoderMethod = "DecodeInstB";
|
|
33 let hasCompleteDecoder = 0;
|
|
34 }
|
|
35
|
|
36 // CHECK: /* 0 */ MCD::OPC_ExtractField, 4, 4, // Inst{7-4} ...
|
|
37 // CHECK-NEXT: /* 3 */ MCD::OPC_FilterValue, 0, 18, 0, 0, // Skip to: 26
|
|
38 // CHECK-NEXT: /* 8 */ MCD::OPC_CheckField, 2, 2, 0, 7, 0, 0, // Skip to: 22
|
|
39 // CHECK-NEXT: /* 15 */ MCD::OPC_TryDecode, {{[0-9]+}}, 1, 0, 0, 0, 0, // Opcode: InstB, skip to: 22
|
|
40 // CHECK-NEXT: /* 22 */ MCD::OPC_Decode, {{[0-9]+}}, 1, 1, // Opcode: InstA
|
|
41 // CHECK-NEXT: /* 26 */ MCD::OPC_Fail,
|
|
42
|
|
43 // CHECK: if (DecodeInstB(MI, insn, Address, Decoder) == MCDisassembler::Fail) { DecodeComplete = false; return MCDisassembler::Fail; }
|