1 // RUN: llvm-tblgen -gen-global-isel -warn-on-skipped-patterns -optimize-match-table=false -I %p/../../include -I %p/Common %s -o - | FileCheck -check-prefix=GISEL %s
3 include "llvm/Target/Target.td"
4 include "GlobalISelEmitterCommon.td"
6 def int_mytarget_sleep : Intrinsic<[], [llvm_i32_ty], [ImmArg<ArgIndex<0>>]>;
8 def G_TGT_CAT : MyTargetGenericInstruction {
9 let OutOperandList = (outs type0:$dst);
10 let InOperandList = (ins type1:$src0, untyped_imm_0:$immfield);
13 def TgtCat : SDNode<"MyTgt::CAT", SDTIntBinOp>;
14 def : GINodeEquiv<G_TGT_CAT, TgtCat>;
17 def SLEEP0 : I<(outs), (ins), []>;
18 def SLEEP1 : I<(outs), (ins), []>;
19 def CAT0 : I<(outs GPR32:$dst), (ins GPR32:$src0), []>;
20 def CAT1 : I<(outs GPR32:$dst), (ins GPR32:$src0), []>;
22 // Test immarg intrinsic pattern
24 // Make sure there is no type check.
25 // GISEL: GIM_CheckOpcode, /*MI*/0, GIMT_Encode2(TargetOpcode::G_INTRINSIC_W_SIDE_EFFECTS),
26 // GISEL: GIM_CheckIntrinsicID, /*MI*/0, /*Op*/0, GIMT_Encode2(Intrinsic::mytarget_sleep),
27 // GISEL-NEXT: // MIs[0] Operand 1
28 // GISEL-NEXT: GIM_CheckLiteralInt, /*MI*/0, /*Op*/1, GIMT_Encode8(0),
30 (int_mytarget_sleep 0),
34 // GISEL: GIM_CheckOpcode, /*MI*/0, GIMT_Encode2(TargetOpcode::G_INTRINSIC_W_SIDE_EFFECTS),
35 // GISEL: GIM_CheckIntrinsicID, /*MI*/0, /*Op*/0, GIMT_Encode2(Intrinsic::mytarget_sleep),
36 // GISEL-NEXT: // MIs[0] Operand 1
37 // GISEL-NEXT: GIM_CheckLiteralInt, /*MI*/0, /*Op*/1, GIMT_Encode8(1),
39 (int_mytarget_sleep 1),
43 // Check a non-intrinsic instruction with an immediate parameter.
45 // GISEL: GIM_CheckOpcode, /*MI*/0, GIMT_Encode2(MyTarget::G_TGT_CAT),
46 // GISEL: GIM_CheckType, /*MI*/0, /*Op*/1, /*Type*/GILLT_s32,
47 // GISEL-NEXT: // MIs[0] Operand 2
48 // GISEL-NEXT: GIM_CheckLiteralInt, /*MI*/0, /*Op*/2, GIMT_Encode8(0),
50 (TgtCat i32:$src0, 0),
54 // GISEL: GIM_CheckOpcode, /*MI*/0, GIMT_Encode2(MyTarget::G_TGT_CAT),
55 // GISEL: GIM_CheckType, /*MI*/0, /*Op*/1, /*Type*/GILLT_s32,
56 // GISEL-NEXT: // MIs[0] Operand 2
57 // GISEL-NEXT: GIM_CheckLiteralInt, /*MI*/0, /*Op*/2, GIMT_Encode8(93),
59 (TgtCat i32:$src0, 93),