1// RUN: llvm-tblgen -gen-emitter -I %p/../../include %s | FileCheck %s 2 3include "llvm/Target/Target.td" 4 5def archInstrInfo : InstrInfo { } 6 7def arch : Target { 8 let InstructionSet = archInstrInfo; 9} 10 11def Myi32 : Operand<i32> { 12 let DecoderMethod = "DecodeMyi32"; 13} 14 15 16let OutOperandList = (outs), Size = 2 in { 17 18def foo : Instruction { 19 let InOperandList = (ins i32imm:$factor); 20 field bits<65> Inst; 21 bits<32> factor; 22 let Inst{7-0} = 0xAA; 23 let Inst{14-8} = factor{6-0}; // no offset 24 let AsmString = "foo $factor"; 25 field bits<16> SoftFail = 0; 26 } 27 28def bar : Instruction { 29 let InOperandList = (ins i32imm:$factor); 30 field bits<65> Inst; 31 bits<32> factor; 32 let Inst{7-0} = 0xBB; 33 let Inst{15-8} = factor{10-3}; // offset by 3 34 let AsmString = "bar $factor"; 35 field bits<16> SoftFail = 0; 36 } 37 38def biz : Instruction { 39 let InOperandList = (ins i32imm:$factor); 40 field bits<65> Inst; 41 bits<32> factor; 42 let Inst{7-0} = 0xCC; 43 let Inst{11-8,15-12} = factor{10-3}; // offset by 3, multipart 44 let AsmString = "biz $factor"; 45 field bits<16> SoftFail = 0; 46 } 47 48} 49 50// CHECK-LABEL: case ::biz: { 51// CHECK: const APInt [[x:M[0-9]+]] = APInt::getBitsSet(65, 3, 7); 52// CHECK-NEXT: Value |= (op & [[x]]) << 9; 53// CHECK-NEXT: const APInt [[y:M[0-9]+]] = APInt::getBitsSet(65, 7, 11); 54// CHECK-NEXT: Value |= (op & [[y]]) << 1; 55 56// CHECK-LABEL: case ::foo: { 57// CHECK: const APInt [[x:M[0-9]+]] = APInt::getBitsSet(65, 0, 7); 58// CHECK-NEXT: op &= [[x]]; 59// CHECK-NEXT: op <<= 8; 60// CHECK-NEXT: Value |= op; 61 62// CHECK-LABEL: case ::bar: { 63// CHECK: const APInt [[x:M[0-9]+]] = APInt::getBitsSet(65, 3, 11); 64// CHECK-NEXT: op &= [[x]]; 65// CHECK-NEXT: op <<= 5; 66// CHECK-NEXT: Value |= op; 67