1// RUN: not --crash llvm-tblgen -gen-dag-isel -I %p/../../include %s 2>&1 | FileCheck %s
2
3// The HwModeSelect class is intended to serve as a base class for other
4// classes that are then used to select a value based on the HW mode.
5// It contains a list of HW modes, and a derived class should provide a
6// list of corresponding values.
7// These two lists must have the same size. Make sure that a violation of
8// this requirement is diagnosed.
9
10include "llvm/Target/Target.td"
11
12def TestTargetInstrInfo : InstrInfo;
13
14def TestTarget : Target {
15  let InstructionSet = TestTargetInstrInfo;
16}
17
18def TestReg : Register<"testreg">;
19def TestClass : RegisterClass<"TestTarget", [i32], 32, (add TestReg)>;
20
21def TestMode1 : HwMode<"+feat1">;
22def TestMode2 : HwMode<"+feat2">;
23
24def BadDef : ValueTypeByHwMode<[TestMode1, TestMode2, DefaultMode],
25                               [i8, i16, i32, i64]>;
26
27// CHECK: error: in record BadDef derived from HwModeSelect: the lists Modes and Objects should have the same size
28