[NFC][RemoveDIs] Prefer iterators over inst-pointers in InstCombine
[llvm-project.git] / llvm / test / TableGen / dag-isel-regclass-emit-enum.td
blobb4a2db605b9aaee87294466f53c8b5a244a579d0
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,
17                           (add R0)>;
20 def GPRAbove127 : RegisterClass<"TestTarget", [i32], 32,
21                                 (add R0)>;
22 } // end Namespace TestNamespace
24 // CHECK:      OPC_CheckOpcode, TARGET_VAL(ISD::ADD),
25 // CHECK-NEXT: OPC_RecordChild0, // #0 = $src
26 // CHECK-NEXT: OPC_Scope, 14, /*->20*/ // 2 children in Scope
27 // CHECK-NEXT: OPC_CheckChild1Integer, 0,
28 // CHECK-NEXT: OPC_EmitInteger, MVT::i32, 0|128,2/*256*/,
29 // CHECK-NEXT: OPC_MorphNodeTo1, TARGET_VAL(TargetOpcode::COPY_TO_REGCLASS), 0,
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_EmitStringInteger, MVT::i32, TestNamespace::GPR127RegClassID,
36 // CHECK-NEXT: OPC_MorphNodeTo1, TARGET_VAL(TargetOpcode::COPY_TO_REGCLASS), 0,
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)>;