1 // RUN: llvm-tblgen --gen-fast-isel -I %p/../../include %s 2>&1 | FileCheck %s
3 include "llvm/Target/Target.td"
5 //===- Define the necessary boilerplate for our test target. --------------===//
7 def MyTargetISA : InstrInfo;
8 def MyTarget : Target { let InstructionSet = MyTargetISA; }
10 def R0 : Register<"r0"> { let Namespace = "MyTarget"; }
11 def R1 : Register<"r0"> { let Namespace = "MyTarget"; }
12 def GPR32M : RegisterClass<"MyTarget", [i32], 32, (add R0)>;
13 def GPR32MOp : RegisterOperand<GPR32M>;
15 def GPR32 : RegisterClass<"MyTarget", [i32], 32, (add R0, R1)>;
16 def GPR32Op : RegisterOperand<GPR32>;
18 class I<dag OOps, dag IOps, list<dag> Pat> : Instruction {
19 let Namespace = "MyTarget";
20 let OutOperandList = OOps;
21 let InOperandList = IOps;
25 def HasA : Predicate<"Subtarget->hasA()">;
27 let Predicates = [HasA] in {
29 def ADD : I<(outs GPR32Op:$rd), (ins GPR32Op:$rs, GPR32Op:$rt),
30 [(set GPR32Op:$rd, (add GPR32Op:$rs, GPR32Op:$rt))]>;
32 let FastISelShouldIgnore = 1 in
33 def ADD_M : I<(outs GPR32MOp:$rd), (ins GPR32MOp:$rs, GPR32MOp:$rt),
34 [(set GPR32MOp:$rd, (add GPR32MOp:$rs, GPR32MOp:$rt))]>;
37 // CHECK-NOT: error: Duplicate predicate in FastISel table!