1 // RUN: llvm-tblgen -warn-on-skipped-patterns -gen-global-isel -I %p/../../include %s -o /dev/null 2>&1 | FileCheck %s
2 include "llvm/Target/Target.td"
4 //===- Boiler plate target code -===//
5 def MyTargetISA : InstrInfo;
6 def MyTarget : Target { let InstructionSet = MyTargetISA; }
8 let TargetPrefix = "mytarget" in {
9 def int_mytarget_nop : Intrinsic<[llvm_i32_ty], [llvm_i32_ty], [IntrNoMem]>;
12 def R0 : Register<"r0"> { let Namespace = "MyTarget"; }
13 def GPR32 : RegisterClass<"MyTarget", [i32], 32, (add R0)>;
15 class I<dag OOps, dag IOps, list<dag> Pat>
17 let Namespace = "MyTarget";
18 let OutOperandList = OOps;
19 let InOperandList = IOps;
23 def complex : Operand<i32>, ComplexPattern<i32, 2, "SelectComplexPattern", []> {
24 let MIOperandInfo = (ops i32imm, i32imm);
28 GIComplexOperandMatcher<s32, "selectComplexPattern">,
29 GIComplexPatternEquiv<complex>;
30 def complex_rr : Operand<i32>, ComplexPattern<i32, 2, "SelectComplexPatternRR", []> {
31 let MIOperandInfo = (ops GPR32, GPR32);
35 GIComplexOperandMatcher<s32, "selectComplexPatternRR">,
36 GIComplexPatternEquiv<complex_rr>;
38 def INSN : I<(outs GPR32:$dst), (ins GPR32:$src1, complex:$src2), []>;
40 //===- Bail out when we define a variable twice wrt complex suboperands. -===//
42 // CHECK: warning: Skipped pattern: Complex suboperand referenced more than once (Operand: x)
43 def : Pat<(add (complex_rr GPR32:$x, GPR32:$y),
44 (complex_rr GPR32:$x, GPR32:$z)),
45 (INSN GPR32:$z, complex:$y)>;