xref: /llvm-project/llvm/test/TableGen/trydecode-emission4.td (revision d93f850c6f11aa315c83a34ec59210e1755528f8)
1// RUN: llvm-tblgen -gen-disassembler -I %p/../../include %s | FileCheck %s
2
3// Test for OPC_ExtractField/OPC_CheckField with start bit > 255.
4// These large start values may arise for architectures with long instruction
5// words.
6
7include "llvm/Target/Target.td"
8
9def archInstrInfo : InstrInfo { }
10
11def arch : Target {
12  let InstructionSet = archInstrInfo;
13}
14
15class TestInstruction : Instruction {
16  let Size = 64;
17  let OutOperandList = (outs);
18  let InOperandList = (ins);
19  field bits<512> Inst;
20  field bits<512> SoftFail = 0;
21}
22
23def InstA : TestInstruction {
24  let Inst{509-502} = {0,0,0,0,?,?,?,?};
25  let AsmString = "InstA";
26}
27
28def InstB : TestInstruction {
29  let Inst{509-502} = {0,0,0,0,0,0,?,?};
30  let AsmString = "InstB";
31  let DecoderMethod = "DecodeInstB";
32  let hasCompleteDecoder = 0;
33}
34
35
36// CHECK:      /* 0 */       MCD::OPC_ExtractField, 250, 3, 4,  // Inst{509-506} ...
37// CHECK-NEXT: /* 4 */       MCD::OPC_FilterValue, 0, 19, 0, 0, // Skip to: 28
38// CHECK-NEXT: /* 9 */       MCD::OPC_CheckField, 248, 3, 2, 0, 7, 0, 0, // Skip to: 24
39// CHECK-NEXT: /* 17 */      MCD::OPC_TryDecode, {{[0-9]+}}, {{[0-9]+}}, 0, 0, 0, 0, // Opcode: InstB, skip to: 24
40// CHECK-NEXT: /* 24 */      MCD::OPC_Decode, {{[0-9]+}}, {{[0-9]+}}, 1, // Opcode: InstA
41// CHECK-NEXT: /* 28 */      MCD::OPC_Fail,
42
43// CHECK: if (!Check(S, DecodeInstB(MI, insn, Address, Decoder))) { DecodeComplete = false; return MCDisassembler::Fail; }
44
45