CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
94 lines
3.3 KiB
TableGen
94 lines
3.3 KiB
TableGen
// RUN: llvm-tblgen -gen-disassembler -I %p/../../../include %s | FileCheck %s --check-prefixes=CHECK
|
|
|
|
include "llvm/Target/Target.td"
|
|
|
|
def ArchInstrInfo : InstrInfo { }
|
|
|
|
def Arch : Target {
|
|
let InstructionSet = ArchInstrInfo;
|
|
}
|
|
|
|
def Reg : Register<"reg">;
|
|
|
|
def RegClass : RegisterClass<"foo", [i64], 0, (add Reg)>;
|
|
|
|
def GR64 : RegisterOperand<RegClass>;
|
|
|
|
class MyMemOperand<dag sub_ops> : Operand<iPTR> {
|
|
let MIOperandInfo = sub_ops;
|
|
dag Base;
|
|
dag Extension;
|
|
}
|
|
|
|
def MemOp16: MyMemOperand<(ops GR64:$reg, i16imm:$offset)>;
|
|
|
|
def MemOp32: MyMemOperand<(ops GR64:$reg, i32imm:$offset)>;
|
|
|
|
class MyVarInst<MyMemOperand memory_op> : Instruction {
|
|
dag Inst;
|
|
|
|
let OutOperandList = (outs GR64:$dst);
|
|
let InOperandList = (ins memory_op:$src);
|
|
}
|
|
|
|
def FOO16 : MyVarInst<MemOp16> {
|
|
let Inst = (ascend
|
|
(descend (operand "$dst", 3), 0b01000, (operand "$src.reg", 3)),
|
|
(slice "$src.offset", 15, 0, (decoder "myCustomDecoder"))
|
|
);
|
|
}
|
|
def FOO32 : MyVarInst<MemOp32> {
|
|
let Inst = (ascend
|
|
(descend (operand "$dst", 3), 0b01001,
|
|
(operand "$src.reg", 3, (decoder "myCustomDecoder"))),
|
|
(slice "$src.offset", 31, 16),
|
|
(slice "$src.offset", 15, 0)
|
|
);
|
|
}
|
|
|
|
// Instruction length table
|
|
// CHECK: InstrLenTable
|
|
// CHECK: 27,
|
|
// CHECK-NEXT: 43,
|
|
// CHECK-NEXT: };
|
|
|
|
// CHECK-LABEL: static const uint8_t DecoderTable43[15] = {
|
|
// CHECK-NEXT: OPC_SwitchField, 3, 5, // 0: switch Inst[7:3] {
|
|
// CHECK-NEXT: 8, 4, // 3: case 0x8: {
|
|
// CHECK-NEXT: OPC_Decode, {{[0-9, ]+}}, 0, // 5: decode to FOO16 using decoder 0
|
|
// CHECK-NEXT: // 5: }
|
|
// CHECK-NEXT: 9, 0, // 9: case 0x9: {
|
|
// CHECK-NEXT: OPC_Decode, {{[0-9, ]+}}, 1, // 11: decode to FOO32 using decoder 1
|
|
// CHECK-NEXT: // 11: }
|
|
// CHECK-NEXT: // 11: } // switch Inst[7:3]
|
|
// CHECK-NEXT: };
|
|
|
|
// CHECK: case 0:
|
|
// CHECK-NEXT: tmp = fieldFromInstruction(insn, 8, 3);
|
|
// CHECK-NEXT: if (!Check(S, DecodeRegClassRegisterClass(MI, tmp, Address, Decoder))) { return MCDisassembler::Fail; }
|
|
// CHECK-NEXT: tmp = fieldFromInstruction(insn, 0, 3);
|
|
// CHECK-NEXT: if (!Check(S, DecodeRegClassRegisterClass(MI, tmp, Address, Decoder))) { return MCDisassembler::Fail; }
|
|
// CHECK-NEXT: tmp = fieldFromInstruction(insn, 11, 16);
|
|
// CHECK-NEXT: if (!Check(S, myCustomDecoder(MI, tmp, Address, Decoder))) { return MCDisassembler::Fail; }
|
|
// CHECK-NEXT: return S;
|
|
// CHECK-NEXT: case 1:
|
|
// CHECK-NEXT: tmp = fieldFromInstruction(insn, 8, 3);
|
|
// CHECK-NEXT: if (!Check(S, DecodeRegClassRegisterClass(MI, tmp, Address, Decoder))) { return MCDisassembler::Fail; }
|
|
// CHECK-NEXT: tmp = fieldFromInstruction(insn, 0, 3);
|
|
// CHECK-NEXT: if (!Check(S, myCustomDecoder(MI, tmp, Address, Decoder))) { return MCDisassembler::Fail; }
|
|
// CHECK-NEXT: tmp = 0x0;
|
|
// CHECK-NEXT: tmp |= fieldFromInstruction(insn, 11, 16) << 16;
|
|
// CHECK-NEXT: tmp |= fieldFromInstruction(insn, 27, 16);
|
|
// CHECK-NEXT: MI.addOperand(MCOperand::createImm(tmp));
|
|
// CHECK-NEXT: return S;
|
|
|
|
// CHECK-LABEL: case OPC_SwitchField: {
|
|
// CHECK: makeUp(insn, Start + Len);
|
|
|
|
// CHECK-LABEL: case OPC_CheckField: {
|
|
// CHECK: makeUp(insn, Start + Len);
|
|
|
|
// CHECK-LABEL: case OPC_Decode: {
|
|
// CHECK: Len = InstrLenTable[Opc];
|
|
// CHECK-NEXT: makeUp(insn, Len);
|