1 // RUN: llvm-tblgen -gen-global-isel -I %p/../../include %s -o %t
2 // RUN: FileCheck %s < %t
4 // Both predicates should be tested
5 // CHECK-DAG: GIM_CheckCxxInsnPredicate, /*MI*/0, /*FnId*/GIPFP_MI_Predicate_pat_frag_b,
6 // CHECK-DAG: GIM_CheckCxxInsnPredicate, /*MI*/0, /*FnId*/GIPFP_MI_Predicate_pat_frag_a,
8 include "llvm/Target/Target.td"
10 def MyTargetISA : InstrInfo;
11 def MyTarget : Target { let InstructionSet = MyTargetISA; }
14 def pat_frag_a : PatFrag <(ops node:$ptr), (load node:$ptr), [{}]> {
15 let PredicateCode = [{ return isInstA(MI); }];
16 let GISelPredicateCode = [{ return isInstA(MI); }];
19 def pat_frag_b : PatFrag <(ops node:$ptr), (load node:$ptr), [{}]> {
20 let PredicateCode = [{ return isInstB(MI); }];
21 let GISelPredicateCode = [{ return isInstB(MI); }];
24 def R0 : Register<"r0"> { let Namespace = "MyTarget"; }
25 def GPR32 : RegisterClass<"MyTarget", [i32], 32, (add R0)>;
27 def inst_a : Instruction {
28 let OutOperandList = (outs GPR32:$dst);
29 let InOperandList = (ins GPR32:$src);
31 def inst_b : Instruction {
32 let OutOperandList = (outs GPR32:$dst);
33 let InOperandList = (ins GPR32:$src);
37 (pat_frag_a GPR32:$src),
42 (pat_frag_b GPR32:$src),