[HLSL] Implement RWBuffer::operator[] via __builtin_hlsl_resource_getpointer (#117017)
[llvm-project.git] / llvm / test / TableGen / GlobalISelCombinerEmitter / match-table-patfrag-root.td
blob5a8b51dfc8324a2892751ae40b2693eb5e002a7c
1 // RUN: llvm-tblgen -I %p/../../../include -gen-global-isel-combiner \
2 // RUN:     -combiners=MyCombiner -gicombiner-debug-cxxpreds %s | \
3 // RUN: FileCheck %s
5 include "llvm/Target/Target.td"
6 include "llvm/Target/GlobalISel/Combine.td"
8 def MyTargetISA : InstrInfo;
9 def MyTarget : Target { let InstructionSet = MyTargetISA; }
11 def MatchFooPerms: GICombinePatFrag<
12     (outs root:$foo),
13     (ins gi_imm:$cst),
14     [
15       (pattern (G_ZEXT $foo, $b), (G_TRUNC $b, $x):$dbg0),
16       (pattern (G_TRUNC $foo, $z):$dbg1),
17       (pattern (G_FPEXT $foo, $z):$dbg1)
18     ]>;
20 def Test0 : GICombineRule<
21   (defs root:$root),
22   (match (MatchFooPerms $root, (i32 10))),
23   (apply (COPY $root, (i32 0)))>;
25 def MyCombiner: GICombiner<"GenMyCombiner", [
26   Test0
27 ]>;
29 //      CHECK: const uint8_t *GenMyCombiner::getMatchTable() const {
30 // CHECK-NEXT:   constexpr static uint8_t MatchTable0[] = {
31 // CHECK-NEXT:     GIM_SwitchOpcode, /*MI*/0, /*[*/GIMT_Encode2({{[0-9]+}}), GIMT_Encode2({{[0-9]+}}), /*)*//*default:*//*Label 3*/ GIMT_Encode4([[L380:[0-9]+]]),
32 // CHECK-NEXT:     /*TargetOpcode::G_TRUNC*//*Label 0*/ GIMT_Encode4([[L262:[0-9]+]]), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0),
33 // CHECK-NEXT:     /*TargetOpcode::G_ZEXT*//*Label 1*/ GIMT_Encode4([[L298:[0-9]+]]), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0), GIMT_Encode4(0),
34 // CHECK-NEXT:     /*TargetOpcode::G_FPEXT*//*Label 2*/ GIMT_Encode4([[L344:[0-9]+]]),
35 // CHECK-NEXT:     // Label 0: @[[L262]]
36 // CHECK-NEXT:     GIM_Try, /*On fail goto*//*Label 4*/ GIMT_Encode4([[L297:[0-9]+]]), // Rule ID 1 //
37 // CHECK-NEXT:       GIM_CheckSimplePredicate, GIMT_Encode2(GICXXPred_Simple_IsRule0Enabled),
38 // CHECK-NEXT:       // MIs[0] root
39 // CHECK-NEXT:       // No operand predicates
40 // CHECK-NEXT:       // MIs[0] __Test0_match_0.z
41 // CHECK-NEXT:       // No operand predicates
42 // CHECK-NEXT:       GIR_MakeTempReg, /*TempRegID*/0, /*TypeID*/GILLT_s32,
43 // CHECK-NEXT:       GIR_BuildConstant, /*TempRegID*/0, /*Val*/GIMT_Encode8(0),
44 // CHECK-NEXT:       // Combiner Rule #0: Test0 @ [__Test0_match_0[1]]
45 // CHECK-NEXT:       GIR_BuildRootMI, /*Opcode*/GIMT_Encode2(TargetOpcode::COPY),
46 // CHECK-NEXT:       GIR_RootToRootCopy, /*OpIdx*/0, // root
47 // CHECK-NEXT:       GIR_AddSimpleTempRegister, /*InsnID*/0, /*TempRegID*/0,
48 // CHECK-NEXT:       GIR_EraseRootFromParent_Done,
49 // CHECK-NEXT:     // Label 4: @[[L297]]
50 // CHECK-NEXT:     GIM_Reject,
51 // CHECK-NEXT:     // Label 1: @[[L298]]
52 // CHECK-NEXT:     GIM_Try, /*On fail goto*//*Label 5*/ GIMT_Encode4([[L343:[0-9]+]]), // Rule ID 0 //
53 // CHECK-NEXT:       GIM_CheckSimplePredicate, GIMT_Encode2(GICXXPred_Simple_IsRule0Enabled),
54 // CHECK-NEXT:       // MIs[0] root
55 // CHECK-NEXT:       // No operand predicates
56 // CHECK-NEXT:       // MIs[0] __Test0_match_0.b
57 // CHECK-NEXT:       GIM_RecordInsnIgnoreCopies, /*DefineMI*/1, /*MI*/0, /*OpIdx*/1, // MIs[1]
58 // CHECK-NEXT:       GIM_CheckOpcode, /*MI*/1, GIMT_Encode2(TargetOpcode::G_TRUNC),
59 // CHECK-NEXT:       // MIs[1] __Test0_match_0.x
60 // CHECK-NEXT:       // No operand predicates
61 // CHECK-NEXT:       GIM_CheckIsSafeToFold, /*NumInsns*/1,
62 // CHECK-NEXT:       GIR_MakeTempReg, /*TempRegID*/0, /*TypeID*/GILLT_s32,
63 // CHECK-NEXT:       GIR_BuildConstant, /*TempRegID*/0, /*Val*/GIMT_Encode8(0),
64 // CHECK-NEXT:       // Combiner Rule #0: Test0 @ [__Test0_match_0[0]]
65 // CHECK-NEXT:       GIR_BuildRootMI, /*Opcode*/GIMT_Encode2(TargetOpcode::COPY),
66 // CHECK-NEXT:       GIR_RootToRootCopy, /*OpIdx*/0, // root
67 // CHECK-NEXT:       GIR_AddSimpleTempRegister, /*InsnID*/0, /*TempRegID*/0,
68 // CHECK-NEXT:       GIR_EraseRootFromParent_Done,
69 // CHECK-NEXT:     // Label 5: @[[L343]]
70 // CHECK-NEXT:     GIM_Reject,
71 // CHECK-NEXT:     // Label 2: @[[L344]]
72 // CHECK-NEXT:     GIM_Try, /*On fail goto*//*Label 6*/ GIMT_Encode4([[L379:[0-9]+]]), // Rule ID 2 //
73 // CHECK-NEXT:       GIM_CheckSimplePredicate, GIMT_Encode2(GICXXPred_Simple_IsRule0Enabled),
74 // CHECK-NEXT:       // MIs[0] root
75 // CHECK-NEXT:       // No operand predicates
76 // CHECK-NEXT:       // MIs[0] __Test0_match_0.z
77 // CHECK-NEXT:       // No operand predicates
78 // CHECK-NEXT:       GIR_MakeTempReg, /*TempRegID*/0, /*TypeID*/GILLT_s32,
79 // CHECK-NEXT:       GIR_BuildConstant, /*TempRegID*/0, /*Val*/GIMT_Encode8(0),
80 // CHECK-NEXT:       // Combiner Rule #0: Test0 @ [__Test0_match_0[2]]
81 // CHECK-NEXT:       GIR_BuildRootMI, /*Opcode*/GIMT_Encode2(TargetOpcode::COPY),
82 // CHECK-NEXT:       GIR_RootToRootCopy, /*OpIdx*/0, // root
83 // CHECK-NEXT:       GIR_AddSimpleTempRegister, /*InsnID*/0, /*TempRegID*/0,
84 // CHECK-NEXT:       GIR_EraseRootFromParent_Done,
85 // CHECK-NEXT:     // Label 6: @[[L379]]
86 // CHECK-NEXT:     GIM_Reject,
87 // CHECK-NEXT:     // Label 3: @[[L380]]
88 // CHECK-NEXT:     GIM_Reject,
89 // CHECK-NEXT:     }; // Size: {{[0-9]+}} bytes
90 // CHECK-NEXT:   return MatchTable0;
91 // CHECK-NEXT: }