|
| 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" |
| 3 | + |
| 4 | +//===- Boiler plate target code -===// |
| 5 | +def MyTargetISA : InstrInfo; |
| 6 | +def MyTarget : Target { let InstructionSet = MyTargetISA; } |
| 7 | + |
| 8 | +let TargetPrefix = "mytarget" in { |
| 9 | +def int_mytarget_nop : Intrinsic<[llvm_i32_ty], [llvm_i32_ty], [IntrNoMem]>; |
| 10 | +} |
| 11 | + |
| 12 | +def R0 : Register<"r0"> { let Namespace = "MyTarget"; } |
| 13 | +def GPR32 : RegisterClass<"MyTarget", [i32], 32, (add R0)>; |
| 14 | + |
| 15 | +class I<dag OOps, dag IOps, list<dag> Pat> |
| 16 | + : Instruction { |
| 17 | + let Namespace = "MyTarget"; |
| 18 | + let OutOperandList = OOps; |
| 19 | + let InOperandList = IOps; |
| 20 | + let Pattern = Pat; |
| 21 | +} |
| 22 | + |
| 23 | +def complex : Operand<i32>, ComplexPattern<i32, 2, "SelectComplexPattern", []> { |
| 24 | + let MIOperandInfo = (ops i32imm, i32imm); |
| 25 | +} |
| 26 | + |
| 27 | +def gi_complex : |
| 28 | + GIComplexOperandMatcher<s32, "selectComplexPattern">, |
| 29 | + GIComplexPatternEquiv<complex>; |
| 30 | +def complex_rr : Operand<i32>, ComplexPattern<i32, 2, "SelectComplexPatternRR", []> { |
| 31 | + let MIOperandInfo = (ops GPR32, GPR32); |
| 32 | +} |
| 33 | + |
| 34 | +def gi_complex_rr : |
| 35 | + GIComplexOperandMatcher<s32, "selectComplexPatternRR">, |
| 36 | + GIComplexPatternEquiv<complex_rr>; |
| 37 | + |
| 38 | +def INSN : I<(outs GPR32:$dst), (ins GPR32:$src1, complex:$src2), []>; |
| 39 | + |
| 40 | +//===- Bail out when we define a variable twice wrt complex suboperands. -===// |
| 41 | + |
| 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)>; |
0 commit comments