Files
derek.holloway 7502bf64a4
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
Flatten subprojects into a single base monorepo
2026-09-02 16:34:47 -07:00

111 lines
2.4 KiB
TableGen

// RUN: llvm-tblgen -gen-emitter -I %p/../../include %s | FileCheck %s
// Verify VarLenCodeEmitterGen using EncodingInfos with different HwModes.
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>;
def HasA : Predicate<"Subtarget->hasA()">;
def HasB : Predicate<"Subtarget->hasB()">;
def ModeA : HwMode<[HasA]>;
def ModeB : HwMode<[HasB]>;
def fooTypeEncA : InstructionEncoding {
dag Inst = (descend
(operand "$src", 4),
(operand "$dst", 4),
0b00000001
);
}
def fooTypeEncB : InstructionEncoding {
dag Inst = (descend
(operand "$dst", 4),
(operand "$src", 4),
0b00000010
);
}
def fooTypeEncC : InstructionEncoding {
dag Inst = (descend
(operand "$dst", 4),
(operand "$src", 4),
0b00000100
);
}
class VarLenInst : Instruction {
let AsmString = "foo $src, $dst";
let OutOperandList = (outs GR64:$dst);
let InOperandList = (ins GR64:$src);
}
// Defined in both HwModes
def foo : VarLenInst {
let EncodingInfos = EncodingByHwMode<
[ModeA, ModeB],
[fooTypeEncA, fooTypeEncB]
>;
}
// Same encoding in any HwMode
def bar : VarLenInst {
dag Inst = (descend
(operand "$dst", 4),
(operand "$src", 4),
0b00000011
);
}
// Only defined in HwMode B.
def baz : VarLenInst {
let EncodingInfos = EncodingByHwMode<
[ModeB],
[fooTypeEncC]
>;
}
// CHECK: static const uint64_t InstBits_ModeA[] = {
// CHECK: UINT64_C(3), // bar
// CHECK: UINT64_C(1), // foo
// CHECK: static const uint64_t InstBits_ModeB[] = {
// CHECK: UINT64_C(3), // bar
// CHECK: UINT64_C(4), // baz
// CHECK: UINT64_C(2), // foo
// CHECK: auto getInstBits_ModeA =
// CHECK: Idx = Index_ModeA
// CHECK: auto getInstBits_ModeB =
// CHECK: Idx = Index_ModeB
// CHECK: case ::bar: {
// CHECK-NOT: switch (Mode) {
// CHECK: Inst = getInstBits_ModeA
// CHECK: case ::foo: {
// CHECK: switch (Mode) {
// CHECK: case 1: {
// CHECK: Inst = getInstBits_ModeA
// CHECK: case 2: {
// CHECK: Inst = getInstBits_ModeB
// CHECK: case ::baz: {
// CHECK: case 1: {
// CHECK: llvm_unreachable("Undefined encoding in this mode");
// CHECK: case 2: {
// CHECK: Inst = getInstBits_ModeB