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<bits<5> opc, dag outs, dag ins, string asmstr, list<dag> pattern>
37 : InstXCore<2, outs, ins, asmstr, pattern> {
38 let Inst{15-11} = opc;
39 let DecoderMethod = "Decode3RInstruction";
42 class _FL3R<dag outs, dag ins, string asmstr, list<dag> pattern>
43 : InstXCore<4, outs, ins, asmstr, pattern> {
46 class _F2RUS<bits<5> opc, dag outs, dag ins, string asmstr, list<dag> pattern>
47 : InstXCore<2, outs, ins, asmstr, pattern> {
48 let Inst{15-11} = opc;
49 let DecoderMethod = "Decode2RUSInstruction";
52 // 2RUS with bitp operand
53 class _F2RUSBitp<bits<5> opc, dag outs, dag ins, string asmstr,
55 : _F2RUS<opc, outs, ins, asmstr, pattern> {
56 let DecoderMethod = "Decode2RUSBitpInstruction";
59 class _FL2RUS<dag outs, dag ins, string asmstr, list<dag> pattern>
60 : InstXCore<4, outs, ins, asmstr, pattern> {
63 class _FRU6<dag outs, dag ins, string asmstr, list<dag> pattern>
64 : InstXCore<2, outs, ins, asmstr, pattern> {
67 class _FLRU6<dag outs, dag ins, string asmstr, list<dag> pattern>
68 : InstXCore<4, outs, ins, asmstr, pattern> {
71 class _FU6<dag outs, dag ins, string asmstr, list<dag> pattern>
72 : InstXCore<2, outs, ins, asmstr, pattern> {
75 class _FLU6<dag outs, dag ins, string asmstr, list<dag> pattern>
76 : InstXCore<4, outs, ins, asmstr, pattern> {
79 class _FU10<dag outs, dag ins, string asmstr, list<dag> pattern>
80 : InstXCore<2, outs, ins, asmstr, pattern> {
83 class _FLU10<dag outs, dag ins, string asmstr, list<dag> pattern>
84 : InstXCore<4, outs, ins, asmstr, pattern> {
87 class _F2R<bits<6> opc, dag outs, dag ins, string asmstr, list<dag> pattern>
88 : InstXCore<2, outs, ins, asmstr, pattern> {
89 let Inst{15-11} = opc{5-1};
91 let DecoderMethod = "Decode2RInstruction";
94 // 2R with first operand as both a source and a destination.
95 class _F2RSrcDst<bits<6> opc, dag outs, dag ins, string asmstr,
96 list<dag> pattern> : _F2R<opc, outs, ins, asmstr, pattern> {
97 let DecoderMethod = "Decode2RSrcDstInstruction";
100 // Same as 2R with last two operands swapped
101 class _FR2R<bits<6> opc, dag outs, dag ins, string asmstr, list<dag> pattern>
102 : _F2R<opc, outs, ins, asmstr, pattern> {
103 let DecoderMethod = "DecodeR2RInstruction";
106 class _FRUS<bits<6> opc, dag outs, dag ins, string asmstr, list<dag> pattern>
107 : InstXCore<2, outs, ins, asmstr, pattern> {
108 let Inst{15-11} = opc{5-1};
109 let Inst{4} = opc{0};
110 let DecoderMethod = "DecodeRUSInstruction";
113 // RUS with bitp operand
114 class _FRUSBitp<bits<6> opc, dag outs, dag ins, string asmstr,
116 : _FRUS<opc, outs, ins, asmstr, pattern> {
117 let DecoderMethod = "DecodeRUSBitpInstruction";
120 // RUS with first operand as both a source and a destination and a bitp second
122 class _FRUSSrcDstBitp<bits<6> opc, dag outs, dag ins, string asmstr,
124 : _FRUS<opc, outs, ins, asmstr, pattern> {
125 let DecoderMethod = "DecodeRUSSrcDstBitpInstruction";
128 class _FL2R<bits<10> opc, dag outs, dag ins, string asmstr, list<dag> pattern>
129 : InstXCore<4, outs, ins, asmstr, pattern> {
130 let Inst{31-27} = opc{9-5};
131 let Inst{26-20} = 0b1111110;
132 let Inst{19-16} = opc{4-1};
134 let Inst{15-11} = 0b11111;
135 let Inst{4} = opc{0};
136 let DecoderMethod = "DecodeL2RInstruction";
139 // Same as L2R with last two operands swapped
140 class _FLR2R<bits<10> opc, dag outs, dag ins, string asmstr, list<dag> pattern>
141 : _FL2R<opc, outs, ins, asmstr, pattern> {
142 let DecoderMethod = "DecodeLR2RInstruction";
145 class _F1R<bits<6> opc, dag outs, dag ins, string asmstr, list<dag> pattern>
146 : InstXCore<2, outs, ins, asmstr, pattern> {
149 let Inst{15-11} = opc{5-1};
150 let Inst{10-5} = 0b111111;
151 let Inst{4} = opc{0};
155 class _F0R<bits<10> opc, dag outs, dag ins, string asmstr, list<dag> pattern>
156 : InstXCore<2, outs, ins, asmstr, pattern> {
157 let Inst{15-11} = opc{9-5};
158 let Inst{10-5} = 0b111111;
159 let Inst{4-0} = opc{4-0};
162 class _L4R<dag outs, dag ins, string asmstr, list<dag> pattern>
163 : InstXCore<4, outs, ins, asmstr, pattern> {
166 class _L5R<dag outs, dag ins, string asmstr, list<dag> pattern>
167 : InstXCore<4, outs, ins, asmstr, pattern> {
170 class _L6R<dag outs, dag ins, string asmstr, list<dag> pattern>
171 : InstXCore<4, outs, ins, asmstr, pattern> {