1 // RUN: llvm-tblgen -gen-register-info -register-info-debug -I %p/../../include %s -o /dev/null 2>&1 | FileCheck %s
2 include "llvm/Target/Target.td"
4 def HasFeat : Predicate<"Subtarget->hasFeat()">;
6 def TestMode : HwMode<"+feat1", [HasFeat]>;
10 let Namespace = "Test";
12 class MyClass<int size, list<ValueType> types, dag registers>
13 : RegisterClass<"Test", types, size, registers> {
27 def X10 : MyReg<"x10">;
28 def X11 : MyReg<"x11">;
29 def X12 : MyReg<"x12">;
30 def X13 : MyReg<"x13">;
31 def X14 : MyReg<"x14">;
32 def X15 : MyReg<"x15">;
34 def ModeVT : ValueTypeByHwMode<[DefaultMode, TestMode],
36 let RegInfos = RegInfoByHwMode<[DefaultMode, TestMode],
37 [RegInfo<32,32,32>, RegInfo<64,64,64>]> in
38 def XRegs : MyClass<32, [ModeVT], (sequence "X%u", 0, 15)>;
40 def sub_even : SubRegIndex<32> {
41 let SubRegRanges = SubRegRangeByHwMode<[DefaultMode, TestMode],
42 [SubRegRange<32>, SubRegRange<64>]>;
44 def sub_odd : SubRegIndex<32, 32> {
45 let SubRegRanges = SubRegRangeByHwMode<[DefaultMode, TestMode],
46 [SubRegRange<32, 32>, SubRegRange<64, 64>]>;
49 def XPairs : RegisterTuples<[sub_even, sub_odd],
50 [(decimate (rotl XRegs, 0), 2),
51 (decimate (rotl XRegs, 1), 2)]>;
53 let RegInfos = RegInfoByHwMode<[DefaultMode, TestMode],
54 [RegInfo<64,64,32>, RegInfo<128,128,64>]> in
55 def XPairsClass : MyClass<64, [untyped], (add XPairs)>;
57 def TestTarget : Target;
59 // CHECK-LABEL: RegisterClass XRegs:
60 // CHECK: SpillSize: { Default:32 TestMode:64 }
61 // CHECK: SpillAlignment: { Default:32 TestMode:64 }
62 // CHECK: Regs: X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15
64 // CHECK-LABEL: RegisterClass XPairsClass:
65 // CHECK: SpillSize: { Default:64 TestMode:128 }
66 // CHECK: SpillAlignment: { Default:32 TestMode:64 }
67 // CHECK: CoveredBySubRegs: 1
68 // CHECK: Regs: X0_X1 X2_X3 X4_X5 X6_X7 X8_X9 X10_X11 X12_X13 X14_X15
70 // CHECK-LABEL: SubRegIndex sub_even:
71 // CHECK: Offset: { Default:0 TestMode:0 }
72 // CHECK: Size: { Default:32 TestMode:64 }
73 // CHECK-LABEL: SubRegIndex sub_odd:
74 // CHECK: Offset: { Default:32 TestMode:64 }
75 // CHECK: Size: { Default:32 TestMode:64 }