1 // RUN: llvm-tblgen -gen-dag-isel -I %p/../../include %s | FileCheck %s
3 include "llvm/Target/Target.td"
5 def TestTargetInstrInfo : InstrInfo;
7 def TestTarget : Target {
8 let InstructionSet = TestTargetInstrInfo;
11 let Namespace = "TestNamespace" in {
13 def R0 : Register<"r0">;
15 foreach i = 0...127 in {
16 def GPR#i : RegisterClass<"TestTarget", [i32], 32,
20 def GPRAbove127 : RegisterClass<"TestTarget", [i32], 32,
22 } // end Namespace TestNamespace
24 // CHECK: OPC_CheckOpcode, TARGET_VAL(ISD::ADD),
25 // CHECK-NEXT: OPC_RecordChild0, // #0 = $src
26 // CHECK-NEXT: OPC_Scope, 12, /*->18*/ // 2 children in Scope
27 // CHECK-NEXT: OPC_CheckChild1Integer, 0,
28 // CHECK-NEXT: OPC_EmitInteger32, 0|128,2/*256*/,
29 // CHECK-NEXT: OPC_MorphNodeTo1None, TARGET_VAL(TargetOpcode::COPY_TO_REGCLASS),
30 // CHECK-NEXT: MVT::i32, 2/*#Ops*/, 1, 0,
31 def : Pat<(i32 (add i32:$src, (i32 0))),
32 (COPY_TO_REGCLASS GPRAbove127, GPR0:$src)>;
34 // CHECK: OPC_CheckChild1Integer, 2,
35 // CHECK-NEXT: OPC_EmitStringInteger32, TestNamespace::GPR127RegClassID,
36 // CHECK-NEXT: OPC_MorphNodeTo1None, TARGET_VAL(TargetOpcode::COPY_TO_REGCLASS),
37 // CHECK-NEXT: MVT::i32, 2/*#Ops*/, 1, 0,
38 def : Pat<(i32 (add i32:$src, (i32 1))),
39 (COPY_TO_REGCLASS GPR127, GPR0:$src)>;