1 // RUN: llvm-tblgen -gen-emitter -I %p/../../include %s | FileCheck %s
3 // Check that EncoderMethod for RegisterOperand is working correctly
5 include "llvm/Target/Target.td"
7 def ArchInstrInfo : InstrInfo { }
10 let InstructionSet = ArchInstrInfo;
13 def Reg : Register<"reg">;
15 def RegClass : RegisterClass<"foo", [i32], 0, (add Reg)>;
17 def RegOperand : RegisterOperand<RegClass> {
18 let EncoderMethod = "barEncoder";
21 def foo1 : Instruction {
24 let OutOperandList = (outs);
25 let InOperandList = (ins RegOperand:$bar);
31 // CHECK: case ::foo1: {
32 // CHECK: op = barEncoder
33 // CHECK: op &= UINT64_C(255);
34 // CHECK: Value |= op;
39 // Also check that it works from a complex operand.
41 def RegPair : Operand<i32> {
42 let MIOperandInfo = (ops RegOperand, RegOperand);
45 def foo2 : Instruction {
48 let OutOperandList = (outs);
49 let InOperandList = (ins (RegPair $r1, $r2):$r12);
58 // CHECK: case ::foo2: {
59 // CHECK: op = barEncoder
60 // CHECK: op &= UINT64_C(15);
61 // CHECK: Value |= op;
62 // CHECK: op = barEncoder
63 // CHECK: op &= UINT64_C(15);
64 // CHECK: Value |= op;