1 // RUN: llvm-tblgen -I %p/../../../../include -gen-global-isel-combiner \
2 // RUN: -gicombiner-stop-after-parse -combiners=MyCombiner %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 // CHECK: (CombineRule name:BuiltinTest0 id:0 root:a
12 // CHECK-NEXT: (MatchPats
13 // CHECK-NEXT: <match_root>__BuiltinTest0_match_0:(CodeGenInstructionPattern G_TRUNC operands:[<def>$a, $b])
15 // CHECK-NEXT: (ApplyPats
16 // CHECK-NEXT: <apply_root>__BuiltinTest0_apply_0:(BuiltinPattern GIReplaceReg operands:[<def>$a, $b])
18 // CHECK-NEXT: (OperandTable MatchPats
19 // CHECK-NEXT: a -> __BuiltinTest0_match_0
20 // CHECK-NEXT: b -> <live-in>
22 // CHECK-NEXT: (OperandTable ApplyPats
23 // CHECK-NEXT: a -> __BuiltinTest0_apply_0
24 // CHECK-NEXT: b -> <live-in>
27 def BuiltinTest0 : GICombineRule<
29 (match (G_TRUNC $a, $b)),
30 (apply (GIReplaceReg $a, $b))
33 // CHECK: (CombineRule name:BuiltinTest1 id:1 root:mi
34 // CHECK-NEXT: (MatchPats
35 // CHECK-NEXT: <match_root>mi:(CodeGenInstructionPattern G_STORE operands:[$a, $b])
37 // CHECK-NEXT: (ApplyPats
38 // CHECK-NEXT: __BuiltinTest1_apply_0:(BuiltinPattern GIEraseRoot operands:[])
40 // CHECK-NEXT: (OperandTable MatchPats
41 // CHECK-NEXT: a -> <live-in>
42 // CHECK-NEXT: b -> <live-in>
44 // CHECK-NEXT: (OperandTable ApplyPats <empty>)
46 def BuiltinTest1 : GICombineRule<
48 (match (G_STORE $a, $b):$mi),
52 def MyCombiner: GICombiner<"GenMyCombiner", [