| 1 |
// RUN: llvm-tblgen -I %p/../../../../include -gen-global-isel-combiner \ |
| 2 |
// RUN: -gicombiner-stop-after-parse -combiners=MyCombiner %s | \ |
| 3 |
// RUN: FileCheck %s |
| 4 |
|
| 5 |
include "llvm/Target/Target.td" |
| 6 |
include "llvm/Target/GlobalISel/Combine.td" |
| 7 |
|
| 8 |
def MyTargetISA : InstrInfo; |
| 9 |
def MyTarget : Target { let InstructionSet = MyTargetISA; } |
| 10 |
|
| 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]) |
| 14 |
// CHECK-NEXT: ) |
| 15 |
// CHECK-NEXT: (ApplyPats |
| 16 |
// CHECK-NEXT: <apply_root>__BuiltinTest0_apply_0:(BuiltinPattern GIReplaceReg operands:[<def>$a, $b]) |
| 17 |
// CHECK-NEXT: ) |
| 18 |
// CHECK-NEXT: (OperandTable MatchPats |
| 19 |
// CHECK-NEXT: a -> __BuiltinTest0_match_0 |
| 20 |
// CHECK-NEXT: b -> <live-in> |
| 21 |
// CHECK-NEXT: ) |
| 22 |
// CHECK-NEXT: (OperandTable ApplyPats |
| 23 |
// CHECK-NEXT: a -> __BuiltinTest0_apply_0 |
| 24 |
// CHECK-NEXT: b -> <live-in> |
| 25 |
// CHECK-NEXT: ) |
| 26 |
// CHECK-NEXT: ) |
| 27 |
def BuiltinTest0 : GICombineRule< |
| 28 |
(defs root:$a), |
| 29 |
(match (G_TRUNC $a, $b)), |
| 30 |
(apply (GIReplaceReg $a, $b)) |
| 31 |
>; |
| 32 |
|
| 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]) |
| 36 |
// CHECK-NEXT: ) |
| 37 |
// CHECK-NEXT: (ApplyPats |
| 38 |
// CHECK-NEXT: __BuiltinTest1_apply_0:(BuiltinPattern GIEraseRoot operands:[]) |
| 39 |
// CHECK-NEXT: ) |
| 40 |
// CHECK-NEXT: (OperandTable MatchPats |
| 41 |
// CHECK-NEXT: a -> <live-in> |
| 42 |
// CHECK-NEXT: b -> <live-in> |
| 43 |
// CHECK-NEXT: ) |
| 44 |
// CHECK-NEXT: (OperandTable ApplyPats <empty>) |
| 45 |
// CHECK-NEXT: ) |
| 46 |
def BuiltinTest1 : GICombineRule< |
| 47 |
(defs root:$mi), |
| 48 |
(match (G_STORE $a, $b):$mi), |
| 49 |
(apply (GIEraseRoot)) |
| 50 |
>; |
| 51 |
|
| 52 |
def MyCombiner: GICombiner<"GenMyCombiner", [ |
| 53 |
BuiltinTest0, |
| 54 |
BuiltinTest1 |
| 55 |
]>; |