1 // RUN: llvm-tblgen -gen-global-isel -optimize-match-table=false -warn-on-skipped-patterns -I %p/../../include -I %p/Common %s -o - < %s | FileCheck %s
3 include "llvm/Target/Target.td"
4 include "GlobalISelEmitterCommon.td"
6 // Verify that patterns will add temp registers if NumDstDef > NumSrcDef when NumSrcDef >= 1
7 // and that these temp registers are marked as dead
8 // Note: This is an extension of the test GlobalISelEmitter-output-discard.td
10 def THREE_OUTS : I<(outs GPR32:$out1, GPR32:$out2, GPR32:$out3), (ins GPR32:$in1), []>;
12 def SDTTwoOut : SDTypeProfile<2, 1, [
13 SDTCisInt<0>, SDTCisInt<1>
15 def two_out : SDNode<"MyTgt::ONE_OUT", SDTTwoOut, []>;
16 def G_TWO_OUT : MyTargetGenericInstruction{
17 let OutOperandList = (outs type0:$out1, type0:$out2);
18 let InOperandList = (ins type0:$in);
20 def : GINodeEquiv<G_TWO_OUT, two_out>;
22 def : Pat<(two_out GPR32:$val), (THREE_OUTS GPR32:$val)>;
24 // CHECK: GIM_CheckOpcode, /*MI*/0, GIMT_Encode2(MyTarget::G_TWO_OUT),
25 // CHECK-NEXT: // MIs[0] DstI[out1]
26 // CHECK-NEXT: GIM_RootCheckType, /*Op*/0, /*Type*/GILLT_s32,
27 // CHECK-NEXT: GIM_RootCheckRegBankForClass, /*Op*/0, /*RC*/GIMT_Encode2(MyTarget::GPR32RegClassID),
28 // CHECK-NEXT: // MIs[0] DstI[out2]
29 // CHECK-NEXT: GIM_RootCheckType, /*Op*/1, /*Type*/GILLT_s32,
30 // CHECK-NEXT: GIM_RootCheckRegBankForClass, /*Op*/1, /*RC*/GIMT_Encode2(MyTarget::GPR32RegClassID),
31 // CHECK-NEXT: // MIs[0] val
32 // CHECK-NEXT: GIM_RootCheckType, /*Op*/2, /*Type*/GILLT_s32,
33 // CHECK-NEXT: GIM_RootCheckRegBankForClass, /*Op*/2, /*RC*/GIMT_Encode2(MyTarget::GPR32RegClassID),
34 // CHECK-NEXT: // (two_out:{ *:[i32] }:{ *:[i32] } GPR32:{ *:[i32] }:$val) => (THREE_OUTS:{ *:[i32] }:{ *:[i32] }:{ *:[i32] } GPR32:{ *:[i32] }:$val)
35 // CHECK-NEXT: GIR_MakeTempReg, /*TempRegID*/0, /*TypeID*/GILLT_s32,
36 // CHECK-NEXT: GIR_BuildRootMI, /*Opcode*/GIMT_Encode2(MyTarget::THREE_OUTS),
37 // CHECK-NEXT: GIR_RootToRootCopy, /*OpIdx*/0, // DstI[out1]
38 // CHECK-NEXT: GIR_RootToRootCopy, /*OpIdx*/1, // DstI[out2]
39 // CHECK-NEXT: GIR_AddTempRegister, /*InsnID*/0, /*TempRegID*/0, /*TempRegFlags*/GIMT_Encode2(RegState::Define|RegState::Dead),
40 // CHECK-NEXT: GIR_RootToRootCopy, /*OpIdx*/2, // val
41 // CHECK-NEXT: GIR_RootConstrainSelectedInstOperands,
42 // CHECK-NEXT: // GIR_Coverage
43 // CHECK-NEXT: GIR_EraseRootFromParent_Done,