1 //===-- XCoreInstrFormats.td - XCore Instruction Formats ---*- tablegen -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 //===----------------------------------------------------------------------===//
11 // Instruction format superclass
12 //===----------------------------------------------------------------------===//
13 class InstXCore<int sz, dag outs, dag ins, string asmstr, list<dag> pattern>
17 let Namespace = "XCore";
18 dag OutOperandList = outs;
19 dag InOperandList = ins;
20 let AsmString = asmstr;
21 let Pattern = pattern;
23 field bits<32> SoftFail = 0;
26 // XCore pseudo instructions format
27 class PseudoInstXCore<dag outs, dag ins, string asmstr, list<dag> pattern>
28 : InstXCore<0, outs, ins, asmstr, pattern> {
32 //===----------------------------------------------------------------------===//
33 // Instruction formats
34 //===----------------------------------------------------------------------===//
36 class _F3R<dag outs, dag ins, string asmstr, list<dag> pattern>
37 : InstXCore<2, outs, ins, asmstr, pattern> {
40 class _FL3R<dag outs, dag ins, string asmstr, list<dag> pattern>
41 : InstXCore<4, outs, ins, asmstr, pattern> {
44 class _F2RUS<dag outs, dag ins, string asmstr, list<dag> pattern>
45 : InstXCore<2, outs, ins, asmstr, pattern> {
48 class _FL2RUS<dag outs, dag ins, string asmstr, list<dag> pattern>
49 : InstXCore<4, outs, ins, asmstr, pattern> {
52 class _FRU6<dag outs, dag ins, string asmstr, list<dag> pattern>
53 : InstXCore<2, outs, ins, asmstr, pattern> {
56 class _FLRU6<dag outs, dag ins, string asmstr, list<dag> pattern>
57 : InstXCore<4, outs, ins, asmstr, pattern> {
60 class _FU6<dag outs, dag ins, string asmstr, list<dag> pattern>
61 : InstXCore<2, outs, ins, asmstr, pattern> {
64 class _FLU6<dag outs, dag ins, string asmstr, list<dag> pattern>
65 : InstXCore<4, outs, ins, asmstr, pattern> {
68 class _FU10<dag outs, dag ins, string asmstr, list<dag> pattern>
69 : InstXCore<2, outs, ins, asmstr, pattern> {
72 class _FLU10<dag outs, dag ins, string asmstr, list<dag> pattern>
73 : InstXCore<4, outs, ins, asmstr, pattern> {
76 class _F2R<bits<6> opc, dag outs, dag ins, string asmstr, list<dag> pattern>
77 : InstXCore<2, outs, ins, asmstr, pattern> {
78 let Inst{15-11} = opc{5-1};
80 let DecoderMethod = "Decode2RInstruction";
83 // 2R with first operand as both a source and a destination.
84 class _F2RSrcDst<bits<6> opc, dag outs, dag ins, string asmstr,
85 list<dag> pattern> : _F2R<opc, outs, ins, asmstr, pattern> {
86 let DecoderMethod = "Decode2RSrcDstInstruction";
89 // Same as 2R with last two operands swapped
90 class _FR2R<bits<6> opc, dag outs, dag ins, string asmstr, list<dag> pattern>
91 : _F2R<opc, outs, ins, asmstr, pattern> {
92 let DecoderMethod = "DecodeR2RInstruction";
95 class _FRUS<bits<6> opc, dag outs, dag ins, string asmstr, list<dag> pattern>
96 : InstXCore<2, outs, ins, asmstr, pattern> {
97 let Inst{15-11} = opc{5-1};
99 let DecoderMethod = "DecodeRUSInstruction";
102 // RUS with bitp operand
103 class _FRUSBitp<bits<6> opc, dag outs, dag ins, string asmstr,
105 : _FRUS<opc, outs, ins, asmstr, pattern> {
106 let DecoderMethod = "DecodeRUSBitpInstruction";
109 // RUS with first operand as both a source and a destination and a bitp second
111 class _FRUSSrcDstBitp<bits<6> opc, dag outs, dag ins, string asmstr,
113 : _FRUS<opc, outs, ins, asmstr, pattern> {
114 let DecoderMethod = "DecodeRUSSrcDstBitpInstruction";
117 class _FL2R<bits<10> opc, dag outs, dag ins, string asmstr, list<dag> pattern>
118 : InstXCore<4, outs, ins, asmstr, pattern> {
119 let Inst{31-27} = opc{9-5};
120 let Inst{26-20} = 0b1111110;
121 let Inst{19-16} = opc{4-1};
123 let Inst{15-11} = 0b11111;
124 let Inst{4} = opc{0};
125 let DecoderMethod = "DecodeL2RInstruction";
128 // Same as L2R with last two operands swapped
129 class _FLR2R<bits<10> opc, dag outs, dag ins, string asmstr, list<dag> pattern>
130 : _FL2R<opc, outs, ins, asmstr, pattern> {
131 let DecoderMethod = "DecodeLR2RInstruction";
134 class _F1R<bits<6> opc, dag outs, dag ins, string asmstr, list<dag> pattern>
135 : InstXCore<2, outs, ins, asmstr, pattern> {
138 let Inst{15-11} = opc{5-1};
139 let Inst{10-5} = 0b111111;
140 let Inst{4} = opc{0};
144 class _F0R<bits<10> opc, dag outs, dag ins, string asmstr, list<dag> pattern>
145 : InstXCore<2, outs, ins, asmstr, pattern> {
146 let Inst{15-11} = opc{9-5};
147 let Inst{10-5} = 0b111111;
148 let Inst{4-0} = opc{4-0};
151 class _L4R<dag outs, dag ins, string asmstr, list<dag> pattern>
152 : InstXCore<4, outs, ins, asmstr, pattern> {
155 class _L5R<dag outs, dag ins, string asmstr, list<dag> pattern>
156 : InstXCore<4, outs, ins, asmstr, pattern> {
159 class _L6R<dag outs, dag ins, string asmstr, list<dag> pattern>
160 : InstXCore<4, outs, ins, asmstr, pattern> {