32 lines · plain
1// RUN: not llvm-tblgen -gen-dag-isel -I %p/../../include %s 2>&1 | FileCheck %s -DFILE=%s2 3// The HwModeSelect class is intended to serve as a base class for other4// 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 a6// list of corresponding values.7// These two lists must have the same size. Make sure that a violation of8// 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 HasFeat1 : Predicate<"Subtarget->hasFeat1()">;22def HasFeat2 : Predicate<"Subtarget->hasFeat2()">;23 24def TestMode1 : HwMode<[HasFeat1]>;25def TestMode2 : HwMode<[HasFeat2]>;26 27// CHECK: error: assertion failed: The Objects and Modes lists must be the same length28// CHECK: [[FILE]]:[[@LINE+1]]:5: error: assertion failed in this record29def BadDef : ValueTypeByHwMode<[TestMode1, TestMode2, DefaultMode],30 [i8, i16, i32, i64]>;31 32