1 // RUN: llvm-tblgen %s -gen-global-isel -optimize-match-table=true -I %p/../../include -I %p/Common -o - | FileCheck %s
3 include "llvm/Target/Target.td"
4 include "GlobalISelEmitterCommon.td"
6 def InstTwoOperands : I<(outs GPR32:$dst), (ins GPR32:$src1, GPR32:$src2), []>;
7 def InstThreeOperands : I<(outs GPR32:$dst), (ins GPR32:$cond, GPR32:$src,GPR32:$src2), []>;
9 // Make sure the GIM_CheckIsSameOperand check is not hoisted into the common header group
11 // CHECK: GIM_Try, /*On fail goto*//*Label 1*/
12 // CHECK-NEXT: GIM_RootCheckRegBankForClass, /*Op*/0, /*RC*/GIMT_Encode2(MyTarget::GPR32RegClassID),
13 // CHECK-NOT: GIM_CheckIsSameOperand
14 // CHECK-NEXT: GIM_Try, /*On fail goto*//*Label 2*/
15 // CHECK: GIM_CheckIsSameOperand, /*MI*/0, /*OpIdx*/3, /*OtherMI*/2, /*OtherOpIdx*/1,
17 // CHECK-NEXT: GIM_Try, /*On fail goto*//*Label 3*/
18 // CHECK: GIM_CheckIsSameOperand, /*MI*/0, /*OpIdx*/3, /*OtherMI*/2, /*OtherOpIdx*/2,
20 def : Pat<(i32 (select GPR32:$cond, GPR32:$src1, GPR32:$src2)),
21 (InstThreeOperands GPR32:$cond, GPR32:$src1, GPR32:$src2)>;
23 def : Pat<(i32 (select (i32 (setcc GPR32:$cond, (i32 0), (OtherVT SETEQ))),
24 (i32 (add GPR32:$src1, GPR32:$const)),
26 (InstThreeOperands GPR32:$cond, GPR32:$src1, GPR32:$const)>;