summaryrefslogtreecommitdiffstats
path: root/llvm/test/TableGen/FixedLenDecoderEmitter/InitValue.td
blob: 2ed3f1343b4b1d8a0a03dde5237ceb661efa10f8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
// RUN: llvm-tblgen -gen-disassembler -I %p/../../../include %s | FileCheck %s

include "llvm/Target/Target.td"

def archInstrInfo : InstrInfo { }

def arch : Target {
    let InstructionSet = archInstrInfo;
}

let OutOperandList = (outs), Size = 2 in {

def foo : Instruction {
    let InOperandList = (ins i32imm:$factor);
    field bits<16> Inst;
    field bits<16> SoftFail = 0;
    bits<8> factor;
    let factor{0} = 0; // zero initial value
    let Inst{15-8} = factor{7-0};
    }

def bar : Instruction {
    let InOperandList = (ins i32imm:$factor);
    field bits<16> Inst;
    field bits<16> SoftFail = 0;
    bits<8> factor;
    let factor{0} = 1; // non-zero initial value
    let Inst{15-8} = factor{7-0};
    }

def bax : Instruction {
    let InOperandList = (ins i32imm:$factor);
    field bits<16> Inst;
    field bits<16> SoftFail = 0;
    bits<33> factor;
    let factor{32} = 1; // non-zero initial value
    let Inst{15-8} = factor{32-25};
    }

}

// CHECK: tmp = fieldFromInstruction(insn, 9, 7) << 1;
// CHECK: tmp = 0x1;
// CHECK: tmp |= fieldFromInstruction(insn, 9, 7) << 1;
// CHECK: tmp = 0x100000000;
// CHECK: tmp |= fieldFromInstruction(insn, 8, 7) << 25;
OpenPOWER on IntegriCloud