xref: /minix3/external/bsd/llvm/dist/llvm/lib/Target/Mips/Mips16InstrInfo.td (revision 0a6a1f1d05b60e214de2f05a7310ddd1f0e590e7)
1f4a2713aSLionel Sambuc//===- Mips16InstrInfo.td - Target Description for Mips16  -*- tablegen -*-=//
2f4a2713aSLionel Sambuc//
3f4a2713aSLionel Sambuc//                     The LLVM Compiler Infrastructure
4f4a2713aSLionel Sambuc//
5f4a2713aSLionel Sambuc// This file is distributed under the University of Illinois Open Source
6f4a2713aSLionel Sambuc// License. See LICENSE.TXT for details.
7f4a2713aSLionel Sambuc//
8f4a2713aSLionel Sambuc//===----------------------------------------------------------------------===//
9f4a2713aSLionel Sambuc//
10f4a2713aSLionel Sambuc// This file describes Mips16 instructions.
11f4a2713aSLionel Sambuc//
12f4a2713aSLionel Sambuc//===----------------------------------------------------------------------===//
13f4a2713aSLionel Sambuc//
14f4a2713aSLionel Sambuc//
15f4a2713aSLionel Sambuc// Mips Address
16f4a2713aSLionel Sambuc//
17f4a2713aSLionel Sambucdef addr16 :
18f4a2713aSLionel Sambuc  ComplexPattern<iPTR, 3, "selectAddr16", [frameindex], [SDNPWantParent]>;
19f4a2713aSLionel Sambuc
20f4a2713aSLionel Sambuc//
21f4a2713aSLionel Sambuc// Address operand
22f4a2713aSLionel Sambucdef mem16 : Operand<i32> {
23f4a2713aSLionel Sambuc  let PrintMethod = "printMemOperand";
24f4a2713aSLionel Sambuc  let MIOperandInfo = (ops CPU16Regs, simm16, CPU16RegsPlusSP);
25f4a2713aSLionel Sambuc  let EncoderMethod = "getMemEncoding";
26f4a2713aSLionel Sambuc}
27f4a2713aSLionel Sambuc
28f4a2713aSLionel Sambucdef mem16_ea : Operand<i32> {
29f4a2713aSLionel Sambuc  let PrintMethod = "printMemOperandEA";
30f4a2713aSLionel Sambuc  let MIOperandInfo = (ops CPU16RegsPlusSP, simm16);
31f4a2713aSLionel Sambuc  let EncoderMethod = "getMemEncoding";
32f4a2713aSLionel Sambuc}
33f4a2713aSLionel Sambuc
34f4a2713aSLionel Sambuc//
35f4a2713aSLionel Sambuc// I-type instruction format
36f4a2713aSLionel Sambuc//
37f4a2713aSLionel Sambuc// this is only used by bimm. the actual assembly value is a 12 bit signed
38f4a2713aSLionel Sambuc// number
39f4a2713aSLionel Sambuc//
40f4a2713aSLionel Sambucclass FI16_ins<bits<5> op, string asmstr, InstrItinClass itin>:
41f4a2713aSLionel Sambuc  FI16<op, (outs), (ins brtarget:$imm16),
42f4a2713aSLionel Sambuc            !strconcat(asmstr, "\t$imm16 # 16 bit inst"), [], itin>;
43f4a2713aSLionel Sambuc
44f4a2713aSLionel Sambuc//
45f4a2713aSLionel Sambuc//
46f4a2713aSLionel Sambuc// I8 instruction format
47f4a2713aSLionel Sambuc//
48f4a2713aSLionel Sambuc
49f4a2713aSLionel Sambucclass FI816_ins_base<bits<3> _func, string asmstr,
50f4a2713aSLionel Sambuc                     string asmstr2, InstrItinClass itin>:
51f4a2713aSLionel Sambuc  FI816<_func, (outs), (ins simm16:$imm), !strconcat(asmstr, asmstr2),
52f4a2713aSLionel Sambuc        [], itin>;
53f4a2713aSLionel Sambuc
54f4a2713aSLionel Sambucclass FI816_ins<bits<3> _func, string asmstr,
55f4a2713aSLionel Sambuc                InstrItinClass itin>:
56f4a2713aSLionel Sambuc  FI816_ins_base<_func, asmstr, "\t$imm  # 16 bit inst", itin>;
57f4a2713aSLionel Sambuc
58f4a2713aSLionel Sambucclass FI816_SP_ins<bits<3> _func, string asmstr,
59f4a2713aSLionel Sambuc                   InstrItinClass itin>:
60f4a2713aSLionel Sambuc  FI816_ins_base<_func, asmstr, "\t$$sp, $imm # 16 bit inst", itin>;
61f4a2713aSLionel Sambuc
62f4a2713aSLionel Sambuc//
63f4a2713aSLionel Sambuc// RI instruction format
64f4a2713aSLionel Sambuc//
65f4a2713aSLionel Sambuc
66f4a2713aSLionel Sambuc
67f4a2713aSLionel Sambucclass FRI16_ins_base<bits<5> op, string asmstr, string asmstr2,
68f4a2713aSLionel Sambuc                     InstrItinClass itin>:
69f4a2713aSLionel Sambuc  FRI16<op, (outs CPU16Regs:$rx), (ins simm16:$imm),
70f4a2713aSLionel Sambuc        !strconcat(asmstr, asmstr2), [], itin>;
71f4a2713aSLionel Sambuc
72f4a2713aSLionel Sambucclass FRI16_ins<bits<5> op, string asmstr,
73f4a2713aSLionel Sambuc                InstrItinClass itin>:
74f4a2713aSLionel Sambuc  FRI16_ins_base<op, asmstr, "\t$rx, $imm \t# 16 bit inst", itin>;
75f4a2713aSLionel Sambuc
76f4a2713aSLionel Sambucclass FRI16_TCP_ins<bits<5> _op, string asmstr,
77f4a2713aSLionel Sambuc                    InstrItinClass itin>:
78f4a2713aSLionel Sambuc  FRI16<_op, (outs CPU16Regs:$rx), (ins pcrel16:$imm, i32imm:$size),
79f4a2713aSLionel Sambuc            !strconcat(asmstr, "\t$rx, $imm\t# 16 bit inst"), [], itin>;
80f4a2713aSLionel Sambuc
81f4a2713aSLionel Sambucclass FRI16R_ins_base<bits<5> op, string asmstr, string asmstr2,
82f4a2713aSLionel Sambuc                     InstrItinClass itin>:
83f4a2713aSLionel Sambuc  FRI16<op, (outs), (ins CPU16Regs:$rx, simm16:$imm),
84f4a2713aSLionel Sambuc        !strconcat(asmstr, asmstr2), [], itin>;
85f4a2713aSLionel Sambuc
86f4a2713aSLionel Sambucclass FRI16R_ins<bits<5> op, string asmstr,
87f4a2713aSLionel Sambuc                InstrItinClass itin>:
88f4a2713aSLionel Sambuc  FRI16R_ins_base<op, asmstr, "\t$rx, $imm \t# 16 bit inst", itin>;
89f4a2713aSLionel Sambuc
90f4a2713aSLionel Sambucclass F2RI16_ins<bits<5> _op, string asmstr,
91f4a2713aSLionel Sambuc                     InstrItinClass itin>:
92f4a2713aSLionel Sambuc  FRI16<_op, (outs CPU16Regs:$rx), (ins CPU16Regs:$rx_, simm16:$imm),
93f4a2713aSLionel Sambuc        !strconcat(asmstr, "\t$rx, $imm\t# 16 bit inst"), [], itin> {
94f4a2713aSLionel Sambuc  let Constraints = "$rx_ = $rx";
95f4a2713aSLionel Sambuc}
96f4a2713aSLionel Sambuc
97f4a2713aSLionel Sambucclass FRI16_B_ins<bits<5> _op, string asmstr,
98f4a2713aSLionel Sambuc                  InstrItinClass itin>:
99f4a2713aSLionel Sambuc  FRI16<_op, (outs), (ins  CPU16Regs:$rx, brtarget:$imm),
100f4a2713aSLionel Sambuc        !strconcat(asmstr, "\t$rx, $imm  # 16 bit inst"), [], itin>;
101f4a2713aSLionel Sambuc//
102f4a2713aSLionel Sambuc// Compare a register and immediate and place result in CC
103f4a2713aSLionel Sambuc// Implicit use of T8
104f4a2713aSLionel Sambuc//
105f4a2713aSLionel Sambuc// EXT-CCRR Instruction format
106f4a2713aSLionel Sambuc//
107f4a2713aSLionel Sambucclass FEXT_CCRXI16_ins<string asmstr>:
108f4a2713aSLionel Sambuc  MipsPseudo16<(outs CPU16Regs:$cc), (ins CPU16Regs:$rx, simm16:$imm),
109f4a2713aSLionel Sambuc               !strconcat(asmstr, "\t$rx, $imm\n\tmove\t$cc, $$t8"), []> {
110f4a2713aSLionel Sambuc  let isCodeGenOnly=1;
111f4a2713aSLionel Sambuc  let usesCustomInserter = 1;
112f4a2713aSLionel Sambuc}
113f4a2713aSLionel Sambuc
114f4a2713aSLionel Sambuc// JAL and JALX instruction format
115f4a2713aSLionel Sambuc//
116f4a2713aSLionel Sambucclass FJAL16_ins<bits<1> _X, string asmstr,
117f4a2713aSLionel Sambuc                 InstrItinClass itin>:
118f4a2713aSLionel Sambuc  FJAL16<_X, (outs), (ins simm20:$imm),
119f4a2713aSLionel Sambuc         !strconcat(asmstr, "\t$imm\n\tnop"),[],
120f4a2713aSLionel Sambuc         itin>  {
121f4a2713aSLionel Sambuc  let isCodeGenOnly=1;
122*0a6a1f1dSLionel Sambuc  let Size=6;
123f4a2713aSLionel Sambuc}
124*0a6a1f1dSLionel Sambuc
125*0a6a1f1dSLionel Sambucclass FJALB16_ins<bits<1> _X, string asmstr,
126*0a6a1f1dSLionel Sambuc                 InstrItinClass itin>:
127*0a6a1f1dSLionel Sambuc  FJAL16<_X, (outs), (ins simm20:$imm),
128*0a6a1f1dSLionel Sambuc         !strconcat(asmstr, "\t$imm\t# branch\n\tnop"),[],
129*0a6a1f1dSLionel Sambuc         itin>  {
130*0a6a1f1dSLionel Sambuc  let isCodeGenOnly=1;
131*0a6a1f1dSLionel Sambuc  let Size=6;
132*0a6a1f1dSLionel Sambuc}
133*0a6a1f1dSLionel Sambuc
134f4a2713aSLionel Sambuc//
135f4a2713aSLionel Sambuc// EXT-I instruction format
136f4a2713aSLionel Sambuc//
137f4a2713aSLionel Sambucclass FEXT_I16_ins<bits<5> eop, string asmstr, InstrItinClass itin> :
138f4a2713aSLionel Sambuc  FEXT_I16<eop, (outs), (ins brtarget:$imm16),
139f4a2713aSLionel Sambuc           !strconcat(asmstr, "\t$imm16"),[], itin>;
140f4a2713aSLionel Sambuc
141f4a2713aSLionel Sambuc//
142f4a2713aSLionel Sambuc// EXT-I8 instruction format
143f4a2713aSLionel Sambuc//
144f4a2713aSLionel Sambuc
145f4a2713aSLionel Sambucclass FEXT_I816_ins_base<bits<3> _func, string asmstr,
146f4a2713aSLionel Sambuc                         string asmstr2, InstrItinClass itin>:
147f4a2713aSLionel Sambuc  FEXT_I816<_func, (outs), (ins simm16:$imm), !strconcat(asmstr, asmstr2),
148f4a2713aSLionel Sambuc            [], itin>;
149f4a2713aSLionel Sambuc
150f4a2713aSLionel Sambucclass FEXT_I816_ins<bits<3> _func, string asmstr,
151f4a2713aSLionel Sambuc                    InstrItinClass itin>:
152f4a2713aSLionel Sambuc  FEXT_I816_ins_base<_func, asmstr, "\t$imm", itin>;
153f4a2713aSLionel Sambuc
154f4a2713aSLionel Sambucclass FEXT_I816_SP_ins<bits<3> _func, string asmstr,
155f4a2713aSLionel Sambuc                       InstrItinClass itin>:
156f4a2713aSLionel Sambuc      FEXT_I816_ins_base<_func, asmstr, "\t$$sp, $imm", itin>;
157f4a2713aSLionel Sambuc
158f4a2713aSLionel Sambuc//
159f4a2713aSLionel Sambuc// Assembler formats in alphabetical order.
160f4a2713aSLionel Sambuc// Natural and pseudos are mixed together.
161f4a2713aSLionel Sambuc//
162f4a2713aSLionel Sambuc// Compare two registers and place result in CC
163f4a2713aSLionel Sambuc// Implicit use of T8
164f4a2713aSLionel Sambuc//
165f4a2713aSLionel Sambuc// CC-RR Instruction format
166f4a2713aSLionel Sambuc//
167f4a2713aSLionel Sambucclass FCCRR16_ins<string asmstr> :
168f4a2713aSLionel Sambuc  MipsPseudo16<(outs CPU16Regs:$cc), (ins CPU16Regs:$rx, CPU16Regs:$ry),
169f4a2713aSLionel Sambuc               !strconcat(asmstr, "\t$rx, $ry\n\tmove\t$cc, $$t8"), []> {
170f4a2713aSLionel Sambuc  let isCodeGenOnly=1;
171f4a2713aSLionel Sambuc  let usesCustomInserter = 1;
172f4a2713aSLionel Sambuc}
173f4a2713aSLionel Sambuc
174f4a2713aSLionel Sambuc//
175f4a2713aSLionel Sambuc// EXT-RI instruction format
176f4a2713aSLionel Sambuc//
177f4a2713aSLionel Sambuc
178f4a2713aSLionel Sambucclass FEXT_RI16_ins_base<bits<5> _op, string asmstr, string asmstr2,
179f4a2713aSLionel Sambuc                         InstrItinClass itin>:
180f4a2713aSLionel Sambuc  FEXT_RI16<_op, (outs CPU16Regs:$rx), (ins simm16:$imm),
181f4a2713aSLionel Sambuc                  !strconcat(asmstr, asmstr2), [], itin>;
182f4a2713aSLionel Sambuc
183f4a2713aSLionel Sambucclass FEXT_RI16_ins<bits<5> _op, string asmstr,
184f4a2713aSLionel Sambuc                    InstrItinClass itin>:
185f4a2713aSLionel Sambuc  FEXT_RI16_ins_base<_op, asmstr, "\t$rx, $imm", itin>;
186f4a2713aSLionel Sambuc
187f4a2713aSLionel Sambucclass FEXT_RI16R_ins_base<bits<5> _op, string asmstr, string asmstr2,
188f4a2713aSLionel Sambuc                         InstrItinClass itin>:
189f4a2713aSLionel Sambuc  FEXT_RI16<_op, (outs ), (ins CPU16Regs:$rx, simm16:$imm),
190f4a2713aSLionel Sambuc                  !strconcat(asmstr, asmstr2), [], itin>;
191f4a2713aSLionel Sambuc
192f4a2713aSLionel Sambucclass FEXT_RI16R_ins<bits<5> _op, string asmstr,
193f4a2713aSLionel Sambuc                    InstrItinClass itin>:
194f4a2713aSLionel Sambuc  FEXT_RI16R_ins_base<_op, asmstr, "\t$rx, $imm", itin>;
195f4a2713aSLionel Sambuc
196f4a2713aSLionel Sambucclass FEXT_RI16_PC_ins<bits<5> _op, string asmstr, InstrItinClass itin>:
197f4a2713aSLionel Sambuc  FEXT_RI16_ins_base<_op, asmstr, "\t$rx, $$pc, $imm", itin>;
198f4a2713aSLionel Sambuc
199f4a2713aSLionel Sambucclass FEXT_RI16_B_ins<bits<5> _op, string asmstr,
200f4a2713aSLionel Sambuc                      InstrItinClass itin>:
201f4a2713aSLionel Sambuc  FEXT_RI16<_op, (outs), (ins  CPU16Regs:$rx, brtarget:$imm),
202f4a2713aSLionel Sambuc            !strconcat(asmstr, "\t$rx, $imm"), [], itin>;
203f4a2713aSLionel Sambuc
204f4a2713aSLionel Sambucclass FEXT_RI16_TCP_ins<bits<5> _op, string asmstr,
205f4a2713aSLionel Sambuc                        InstrItinClass itin>:
206f4a2713aSLionel Sambuc  FEXT_RI16<_op, (outs CPU16Regs:$rx), (ins pcrel16:$imm, i32imm:$size),
207f4a2713aSLionel Sambuc            !strconcat(asmstr, "\t$rx, $imm"), [], itin>;
208f4a2713aSLionel Sambuc
209f4a2713aSLionel Sambucclass FEXT_2RI16_ins<bits<5> _op, string asmstr,
210f4a2713aSLionel Sambuc                     InstrItinClass itin>:
211f4a2713aSLionel Sambuc  FEXT_RI16<_op, (outs CPU16Regs:$rx), (ins CPU16Regs:$rx_, simm16:$imm),
212f4a2713aSLionel Sambuc            !strconcat(asmstr, "\t$rx, $imm"), [], itin> {
213f4a2713aSLionel Sambuc  let Constraints = "$rx_ = $rx";
214f4a2713aSLionel Sambuc}
215f4a2713aSLionel Sambuc
216f4a2713aSLionel Sambuc
217f4a2713aSLionel Sambuc// this has an explicit sp argument that we ignore to work around a problem
218f4a2713aSLionel Sambuc// in the compiler
219f4a2713aSLionel Sambucclass FEXT_RI16_SP_explicit_ins<bits<5> _op, string asmstr,
220f4a2713aSLionel Sambuc                                InstrItinClass itin>:
221f4a2713aSLionel Sambuc  FEXT_RI16<_op, (outs CPU16Regs:$rx), (ins CPUSPReg:$ry, simm16:$imm),
222f4a2713aSLionel Sambuc            !strconcat(asmstr, "\t$rx, $imm ( $ry ); "), [], itin>;
223f4a2713aSLionel Sambuc
224f4a2713aSLionel Sambucclass FEXT_RI16_SP_Store_explicit_ins<bits<5> _op, string asmstr,
225f4a2713aSLionel Sambuc                                InstrItinClass itin>:
226f4a2713aSLionel Sambuc  FEXT_RI16<_op, (outs), (ins  CPU16Regs:$rx, CPUSPReg:$ry, simm16:$imm),
227f4a2713aSLionel Sambuc            !strconcat(asmstr, "\t$rx, $imm ( $ry ); "), [], itin>;
228f4a2713aSLionel Sambuc
229f4a2713aSLionel Sambuc//
230f4a2713aSLionel Sambuc// EXT-RRI instruction format
231f4a2713aSLionel Sambuc//
232f4a2713aSLionel Sambuc
233f4a2713aSLionel Sambucclass FEXT_RRI16_mem_ins<bits<5> op, string asmstr, Operand MemOpnd,
234f4a2713aSLionel Sambuc                         InstrItinClass itin>:
235f4a2713aSLionel Sambuc  FEXT_RRI16<op, (outs CPU16Regs:$ry), (ins  MemOpnd:$addr),
236f4a2713aSLionel Sambuc             !strconcat(asmstr, "\t$ry, $addr"), [], itin>;
237f4a2713aSLionel Sambuc
238f4a2713aSLionel Sambucclass FEXT_RRI16_mem2_ins<bits<5> op, string asmstr, Operand MemOpnd,
239f4a2713aSLionel Sambuc                          InstrItinClass itin>:
240f4a2713aSLionel Sambuc  FEXT_RRI16<op, (outs ), (ins  CPU16Regs:$ry, MemOpnd:$addr),
241f4a2713aSLionel Sambuc             !strconcat(asmstr, "\t$ry, $addr"), [], itin>;
242f4a2713aSLionel Sambuc
243f4a2713aSLionel Sambuc//
244f4a2713aSLionel Sambuc//
245f4a2713aSLionel Sambuc// EXT-RRI-A instruction format
246f4a2713aSLionel Sambuc//
247f4a2713aSLionel Sambuc
248f4a2713aSLionel Sambucclass FEXT_RRI_A16_mem_ins<bits<1> op, string asmstr, Operand MemOpnd,
249f4a2713aSLionel Sambuc                           InstrItinClass itin>:
250f4a2713aSLionel Sambuc  FEXT_RRI_A16<op, (outs CPU16Regs:$ry), (ins  MemOpnd:$addr),
251f4a2713aSLionel Sambuc               !strconcat(asmstr, "\t$ry, $addr"), [], itin>;
252f4a2713aSLionel Sambuc
253f4a2713aSLionel Sambuc//
254f4a2713aSLionel Sambuc// EXT-SHIFT instruction format
255f4a2713aSLionel Sambuc//
256f4a2713aSLionel Sambucclass FEXT_SHIFT16_ins<bits<2> _f, string asmstr, InstrItinClass itin>:
257f4a2713aSLionel Sambuc  FEXT_SHIFT16<_f, (outs CPU16Regs:$rx), (ins CPU16Regs:$ry, uimm5:$sa),
258f4a2713aSLionel Sambuc               !strconcat(asmstr, "\t$rx, $ry, $sa"), [], itin>;
259f4a2713aSLionel Sambuc
260f4a2713aSLionel Sambuc//
261f4a2713aSLionel Sambuc// EXT-T8I8
262f4a2713aSLionel Sambuc//
263f4a2713aSLionel Sambucclass FEXT_T8I816_ins<string asmstr, string asmstr2>:
264f4a2713aSLionel Sambuc  MipsPseudo16<(outs),
265f4a2713aSLionel Sambuc               (ins CPU16Regs:$rx, CPU16Regs:$ry, brtarget:$imm),
266f4a2713aSLionel Sambuc               !strconcat(asmstr2, !strconcat("\t$rx, $ry\n\t",
267f4a2713aSLionel Sambuc               !strconcat(asmstr, "\t$imm"))),[]> {
268f4a2713aSLionel Sambuc  let isCodeGenOnly=1;
269f4a2713aSLionel Sambuc  let usesCustomInserter = 1;
270f4a2713aSLionel Sambuc}
271f4a2713aSLionel Sambuc
272f4a2713aSLionel Sambuc//
273f4a2713aSLionel Sambuc// EXT-T8I8I
274f4a2713aSLionel Sambuc//
275f4a2713aSLionel Sambucclass FEXT_T8I8I16_ins<string asmstr, string asmstr2>:
276f4a2713aSLionel Sambuc  MipsPseudo16<(outs),
277f4a2713aSLionel Sambuc               (ins CPU16Regs:$rx, simm16:$imm, brtarget:$targ),
278f4a2713aSLionel Sambuc               !strconcat(asmstr2, !strconcat("\t$rx, $imm\n\t",
279f4a2713aSLionel Sambuc               !strconcat(asmstr, "\t$targ"))), []> {
280f4a2713aSLionel Sambuc  let isCodeGenOnly=1;
281f4a2713aSLionel Sambuc  let usesCustomInserter = 1;
282f4a2713aSLionel Sambuc}
283f4a2713aSLionel Sambuc//
284f4a2713aSLionel Sambuc
285f4a2713aSLionel Sambuc
286f4a2713aSLionel Sambuc//
287f4a2713aSLionel Sambuc// I8_MOVR32 instruction format (used only by the MOVR32 instructio
288f4a2713aSLionel Sambuc//
289f4a2713aSLionel Sambucclass FI8_MOVR3216_ins<string asmstr, InstrItinClass itin>:
290f4a2713aSLionel Sambuc       FI8_MOVR3216<(outs CPU16Regs:$rz), (ins GPR32:$r32),
291f4a2713aSLionel Sambuc       !strconcat(asmstr,  "\t$rz, $r32"), [], itin>;
292f4a2713aSLionel Sambuc
293f4a2713aSLionel Sambuc//
294f4a2713aSLionel Sambuc// I8_MOV32R instruction format (used only by MOV32R instruction)
295f4a2713aSLionel Sambuc//
296f4a2713aSLionel Sambuc
297f4a2713aSLionel Sambucclass FI8_MOV32R16_ins<string asmstr, InstrItinClass itin>:
298f4a2713aSLionel Sambuc  FI8_MOV32R16<(outs GPR32:$r32), (ins CPU16Regs:$rz),
299f4a2713aSLionel Sambuc               !strconcat(asmstr,  "\t$r32, $rz"), [], itin>;
300f4a2713aSLionel Sambuc
301f4a2713aSLionel Sambuc//
302f4a2713aSLionel Sambuc// This are pseudo formats for multiply
303*0a6a1f1dSLionel Sambuc// This first one can be changed to non-pseudo now.
304f4a2713aSLionel Sambuc//
305f4a2713aSLionel Sambuc// MULT
306f4a2713aSLionel Sambuc//
307f4a2713aSLionel Sambucclass FMULT16_ins<string asmstr, InstrItinClass itin> :
308f4a2713aSLionel Sambuc  MipsPseudo16<(outs), (ins CPU16Regs:$rx, CPU16Regs:$ry),
309f4a2713aSLionel Sambuc               !strconcat(asmstr, "\t$rx, $ry"), []>;
310f4a2713aSLionel Sambuc
311f4a2713aSLionel Sambuc//
312f4a2713aSLionel Sambuc// MULT-LO
313f4a2713aSLionel Sambuc//
314f4a2713aSLionel Sambucclass FMULT16_LO_ins<string asmstr, InstrItinClass itin> :
315f4a2713aSLionel Sambuc  MipsPseudo16<(outs CPU16Regs:$rz), (ins CPU16Regs:$rx, CPU16Regs:$ry),
316f4a2713aSLionel Sambuc               !strconcat(asmstr, "\t$rx, $ry\n\tmflo\t$rz"), []> {
317f4a2713aSLionel Sambuc  let isCodeGenOnly=1;
318f4a2713aSLionel Sambuc}
319f4a2713aSLionel Sambuc
320f4a2713aSLionel Sambuc//
321f4a2713aSLionel Sambuc// RR-type instruction format
322f4a2713aSLionel Sambuc//
323f4a2713aSLionel Sambuc
324f4a2713aSLionel Sambucclass FRR16_ins<bits<5> f, string asmstr, InstrItinClass itin> :
325f4a2713aSLionel Sambuc  FRR16<f, (outs CPU16Regs:$rx), (ins CPU16Regs:$ry),
326f4a2713aSLionel Sambuc        !strconcat(asmstr, "\t$rx, $ry"), [], itin> {
327f4a2713aSLionel Sambuc}
328f4a2713aSLionel Sambuc
329f4a2713aSLionel Sambucclass FRRBreakNull16_ins<string asmstr, InstrItinClass itin> :
330f4a2713aSLionel Sambuc  FRRBreak16<(outs), (ins), asmstr, [], itin> {
331f4a2713aSLionel Sambuc  let Code=0;
332f4a2713aSLionel Sambuc}
333f4a2713aSLionel Sambuc
334f4a2713aSLionel Sambucclass FRR16R_ins<bits<5> f, string asmstr, InstrItinClass itin> :
335f4a2713aSLionel Sambuc  FRR16<f, (outs), (ins  CPU16Regs:$rx, CPU16Regs:$ry),
336f4a2713aSLionel Sambuc        !strconcat(asmstr, "\t$rx, $ry"), [], itin> {
337f4a2713aSLionel Sambuc}
338f4a2713aSLionel Sambuc
339f4a2713aSLionel Sambucclass FRRTR16_ins<string asmstr> :
340f4a2713aSLionel Sambuc  MipsPseudo16<(outs CPU16Regs:$rz), (ins CPU16Regs:$rx, CPU16Regs:$ry),
341f4a2713aSLionel Sambuc               !strconcat(asmstr, "\t$rx, $ry\n\tmove\t$rz, $$t8"), []> ;
342f4a2713aSLionel Sambuc
343f4a2713aSLionel Sambuc//
344f4a2713aSLionel Sambuc// maybe refactor but need a $zero as a dummy first parameter
345f4a2713aSLionel Sambuc//
346f4a2713aSLionel Sambucclass FRR16_div_ins<bits<5> f, string asmstr, InstrItinClass itin> :
347f4a2713aSLionel Sambuc  FRR16<f, (outs ), (ins CPU16Regs:$rx, CPU16Regs:$ry),
348f4a2713aSLionel Sambuc        !strconcat(asmstr, "\t$$zero, $rx, $ry"), [], itin> ;
349f4a2713aSLionel Sambuc
350f4a2713aSLionel Sambucclass FUnaryRR16_ins<bits<5> f, string asmstr, InstrItinClass itin> :
351f4a2713aSLionel Sambuc  FRR16<f, (outs CPU16Regs:$rx), (ins CPU16Regs:$ry),
352f4a2713aSLionel Sambuc        !strconcat(asmstr, "\t$rx, $ry"), [], itin> ;
353f4a2713aSLionel Sambuc
354f4a2713aSLionel Sambuc
355f4a2713aSLionel Sambucclass FRR16_M_ins<bits<5> f, string asmstr,
356f4a2713aSLionel Sambuc                  InstrItinClass itin> :
357f4a2713aSLionel Sambuc  FRR16<f, (outs CPU16Regs:$rx), (ins),
358f4a2713aSLionel Sambuc        !strconcat(asmstr, "\t$rx"), [], itin>;
359f4a2713aSLionel Sambuc
360f4a2713aSLionel Sambucclass FRxRxRy16_ins<bits<5> f, string asmstr,
361f4a2713aSLionel Sambuc                    InstrItinClass itin> :
362f4a2713aSLionel Sambuc  FRR16<f, (outs CPU16Regs:$rz), (ins CPU16Regs:$rx, CPU16Regs:$ry),
363f4a2713aSLionel Sambuc            !strconcat(asmstr, "\t$rz, $ry"),
364f4a2713aSLionel Sambuc            [], itin> {
365f4a2713aSLionel Sambuc  let Constraints = "$rx = $rz";
366f4a2713aSLionel Sambuc}
367f4a2713aSLionel Sambuc
368f4a2713aSLionel Sambuclet rx=0 in
369f4a2713aSLionel Sambucclass FRR16_JALRC_RA_only_ins<bits<1> nd_, bits<1> l_,
370f4a2713aSLionel Sambuc                              string asmstr, InstrItinClass itin>:
371f4a2713aSLionel Sambuc  FRR16_JALRC<nd_, l_, 1, (outs), (ins), !strconcat(asmstr, "\t $$ra"),
372f4a2713aSLionel Sambuc              [], itin> ;
373f4a2713aSLionel Sambuc
374f4a2713aSLionel Sambuc
375f4a2713aSLionel Sambucclass FRR16_JALRC_ins<bits<1> nd, bits<1> l, bits<1> ra,
376f4a2713aSLionel Sambuc                      string asmstr, InstrItinClass itin>:
377f4a2713aSLionel Sambuc  FRR16_JALRC<nd, l, ra, (outs), (ins CPU16Regs:$rx),
378f4a2713aSLionel Sambuc              !strconcat(asmstr, "\t $rx"), [], itin> ;
379f4a2713aSLionel Sambuc
380f4a2713aSLionel Sambucclass FRR_SF16_ins
381f4a2713aSLionel Sambuc  <bits<5> _funct, bits<3> _subfunc,
382f4a2713aSLionel Sambuc    string asmstr, InstrItinClass itin>:
383f4a2713aSLionel Sambuc  FRR_SF16<_funct, _subfunc, (outs CPU16Regs:$rx), (ins CPU16Regs:$rx_),
384f4a2713aSLionel Sambuc           !strconcat(asmstr, "\t $rx"),
385f4a2713aSLionel Sambuc           [], itin> {
386f4a2713aSLionel Sambuc  let Constraints = "$rx_ = $rx";
387f4a2713aSLionel Sambuc  }
388f4a2713aSLionel Sambuc//
389f4a2713aSLionel Sambuc// RRR-type instruction format
390f4a2713aSLionel Sambuc//
391f4a2713aSLionel Sambuc
392f4a2713aSLionel Sambucclass FRRR16_ins<bits<2> _f, string asmstr,  InstrItinClass itin> :
393f4a2713aSLionel Sambuc  FRRR16<_f, (outs CPU16Regs:$rz), (ins CPU16Regs:$rx, CPU16Regs:$ry),
394f4a2713aSLionel Sambuc         !strconcat(asmstr, "\t$rz, $rx, $ry"), [], itin>;
395f4a2713aSLionel Sambuc
396f4a2713aSLionel Sambuc//
397f4a2713aSLionel Sambuc// These Sel patterns support the generation of conditional move
398f4a2713aSLionel Sambuc// pseudo instructions.
399f4a2713aSLionel Sambuc//
400f4a2713aSLionel Sambuc// The nomenclature uses the components making up the pseudo and may
401f4a2713aSLionel Sambuc// be a bit counter intuitive when compared with the end result we seek.
402f4a2713aSLionel Sambuc// For example using a bqez in the example directly below results in the
403f4a2713aSLionel Sambuc// conditional move being done if the tested register is not zero.
404f4a2713aSLionel Sambuc// I considered in easier to check by keeping the pseudo consistent with
405f4a2713aSLionel Sambuc// it's components but it could have been done differently.
406f4a2713aSLionel Sambuc//
407f4a2713aSLionel Sambuc// The simplest case is when can test and operand directly and do the
408f4a2713aSLionel Sambuc// conditional move based on a simple mips16 conditional
409f4a2713aSLionel Sambuc//  branch instruction.
410f4a2713aSLionel Sambuc// for example:
411f4a2713aSLionel Sambuc// if $op == beqz or bnez:
412f4a2713aSLionel Sambuc//
413f4a2713aSLionel Sambuc// $op1 $rt, .+4
414f4a2713aSLionel Sambuc// move $rd, $rs
415f4a2713aSLionel Sambuc//
416f4a2713aSLionel Sambuc// if $op == beqz, then if $rt != 0, then the conditional assignment
417f4a2713aSLionel Sambuc// $rd = $rs is done.
418f4a2713aSLionel Sambuc
419f4a2713aSLionel Sambuc// if $op == bnez, then if $rt == 0, then the conditional assignment
420f4a2713aSLionel Sambuc// $rd = $rs is done.
421f4a2713aSLionel Sambuc//
422f4a2713aSLionel Sambuc// So this pseudo class only has one operand, i.e. op
423f4a2713aSLionel Sambuc//
424f4a2713aSLionel Sambucclass Sel<string op>:
425f4a2713aSLionel Sambuc  MipsPseudo16<(outs CPU16Regs:$rd_), (ins CPU16Regs:$rd, CPU16Regs:$rs,
426f4a2713aSLionel Sambuc               CPU16Regs:$rt),
427f4a2713aSLionel Sambuc               !strconcat(op, "\t$rt, .+4\n\t\n\tmove $rd, $rs"), []> {
428f4a2713aSLionel Sambuc  //let isCodeGenOnly=1;
429f4a2713aSLionel Sambuc  let Constraints = "$rd = $rd_";
430f4a2713aSLionel Sambuc  let usesCustomInserter = 1;
431f4a2713aSLionel Sambuc}
432f4a2713aSLionel Sambuc
433f4a2713aSLionel Sambuc//
434f4a2713aSLionel Sambuc// The next two instruction classes allow for an operand which tests
435f4a2713aSLionel Sambuc// two operands and returns a value in register T8 and
436f4a2713aSLionel Sambuc//then does a conditional branch based on the value of T8
437f4a2713aSLionel Sambuc//
438f4a2713aSLionel Sambuc
439f4a2713aSLionel Sambuc// op2 can be cmpi or slti/sltiu
440f4a2713aSLionel Sambuc// op1 can bteqz or btnez
441f4a2713aSLionel Sambuc// the operands for op2 are a register and a signed constant
442f4a2713aSLionel Sambuc//
443f4a2713aSLionel Sambuc// $op2 $t, $imm  ;test register t and branch conditionally
444f4a2713aSLionel Sambuc// $op1 .+4       ;op1 is a conditional branch
445f4a2713aSLionel Sambuc// move $rd, $rs
446f4a2713aSLionel Sambuc//
447f4a2713aSLionel Sambuc//
448f4a2713aSLionel Sambucclass SeliT<string op1, string op2>:
449f4a2713aSLionel Sambuc  MipsPseudo16<(outs CPU16Regs:$rd_), (ins CPU16Regs:$rd, CPU16Regs:$rs,
450f4a2713aSLionel Sambuc                                       CPU16Regs:$rl, simm16:$imm),
451f4a2713aSLionel Sambuc               !strconcat(op2,
452f4a2713aSLionel Sambuc               !strconcat("\t$rl, $imm\n\t",
453f4a2713aSLionel Sambuc               !strconcat(op1, "\t.+4\n\tmove $rd, $rs"))), []> {
454f4a2713aSLionel Sambuc  let isCodeGenOnly=1;
455f4a2713aSLionel Sambuc  let Constraints = "$rd = $rd_";
456f4a2713aSLionel Sambuc  let usesCustomInserter = 1;
457f4a2713aSLionel Sambuc}
458f4a2713aSLionel Sambuc
459f4a2713aSLionel Sambuc//
460f4a2713aSLionel Sambuc// op2 can be cmp or slt/sltu
461f4a2713aSLionel Sambuc// op1 can be bteqz or btnez
462f4a2713aSLionel Sambuc// the operands for op2 are two registers
463f4a2713aSLionel Sambuc// op1 is a conditional branch
464f4a2713aSLionel Sambuc//
465f4a2713aSLionel Sambuc//
466f4a2713aSLionel Sambuc// $op2 $rl, $rr  ;test registers rl,rr
467f4a2713aSLionel Sambuc// $op1 .+4       ;op2 is a conditional branch
468f4a2713aSLionel Sambuc// move $rd, $rs
469f4a2713aSLionel Sambuc//
470f4a2713aSLionel Sambuc//
471f4a2713aSLionel Sambucclass SelT<string op1, string op2>:
472f4a2713aSLionel Sambuc  MipsPseudo16<(outs CPU16Regs:$rd_),
473f4a2713aSLionel Sambuc               (ins CPU16Regs:$rd, CPU16Regs:$rs,
474f4a2713aSLionel Sambuc                CPU16Regs:$rl, CPU16Regs:$rr),
475f4a2713aSLionel Sambuc               !strconcat(op2,
476f4a2713aSLionel Sambuc               !strconcat("\t$rl, $rr\n\t",
477f4a2713aSLionel Sambuc               !strconcat(op1, "\t.+4\n\tmove $rd, $rs"))), []> {
478f4a2713aSLionel Sambuc  let isCodeGenOnly=1;
479f4a2713aSLionel Sambuc  let Constraints = "$rd = $rd_";
480f4a2713aSLionel Sambuc  let usesCustomInserter = 1;
481f4a2713aSLionel Sambuc}
482f4a2713aSLionel Sambuc
483f4a2713aSLionel Sambuc//
484f4a2713aSLionel Sambuc// 32 bit constant
485f4a2713aSLionel Sambuc//
486f4a2713aSLionel Sambucdef imm32: Operand<i32>;
487f4a2713aSLionel Sambuc
488f4a2713aSLionel Sambucdef Constant32:
489f4a2713aSLionel Sambuc  MipsPseudo16<(outs), (ins imm32:$imm), "\t.word $imm", []>;
490f4a2713aSLionel Sambuc
491f4a2713aSLionel Sambucdef LwConstant32:
492f4a2713aSLionel Sambuc  MipsPseudo16<(outs CPU16Regs:$rx), (ins imm32:$imm, imm32:$constid),
493f4a2713aSLionel Sambuc    "lw\t$rx, 1f\n\tb\t2f\n\t.align\t2\n1: \t.word\t$imm\n2:", []>;
494f4a2713aSLionel Sambuc
495f4a2713aSLionel Sambuc
496f4a2713aSLionel Sambuc//
497f4a2713aSLionel Sambuc// Some general instruction class info
498f4a2713aSLionel Sambuc//
499f4a2713aSLionel Sambuc//
500f4a2713aSLionel Sambuc
501f4a2713aSLionel Sambucclass ArithLogic16Defs<bit isCom=0> {
502f4a2713aSLionel Sambuc  bits<5> shamt = 0;
503f4a2713aSLionel Sambuc  bit isCommutable = isCom;
504f4a2713aSLionel Sambuc  bit isReMaterializable = 1;
505*0a6a1f1dSLionel Sambuc  bit hasSideEffects = 0;
506f4a2713aSLionel Sambuc}
507f4a2713aSLionel Sambuc
508f4a2713aSLionel Sambucclass branch16 {
509f4a2713aSLionel Sambuc  bit isBranch = 1;
510f4a2713aSLionel Sambuc  bit isTerminator = 1;
511f4a2713aSLionel Sambuc  bit isBarrier = 1;
512f4a2713aSLionel Sambuc}
513f4a2713aSLionel Sambuc
514f4a2713aSLionel Sambucclass cbranch16 {
515f4a2713aSLionel Sambuc  bit isBranch = 1;
516f4a2713aSLionel Sambuc  bit isTerminator = 1;
517f4a2713aSLionel Sambuc}
518f4a2713aSLionel Sambuc
519f4a2713aSLionel Sambucclass MayLoad {
520f4a2713aSLionel Sambuc  bit mayLoad = 1;
521f4a2713aSLionel Sambuc}
522f4a2713aSLionel Sambuc
523f4a2713aSLionel Sambucclass MayStore {
524f4a2713aSLionel Sambuc  bit mayStore = 1;
525f4a2713aSLionel Sambuc}
526f4a2713aSLionel Sambuc//
527f4a2713aSLionel Sambuc
528f4a2713aSLionel Sambuc
529f4a2713aSLionel Sambuc// Format: ADDIU rx, immediate MIPS16e
530f4a2713aSLionel Sambuc// Purpose: Add Immediate Unsigned Word (2-Operand, Extended)
531f4a2713aSLionel Sambuc// To add a constant to a 32-bit integer.
532f4a2713aSLionel Sambuc//
533f4a2713aSLionel Sambucdef AddiuRxImmX16: FEXT_RI16_ins<0b01001, "addiu", IIAlu>;
534f4a2713aSLionel Sambuc
535f4a2713aSLionel Sambucdef AddiuRxRxImm16: F2RI16_ins<0b01001, "addiu", IIAlu>,
536f4a2713aSLionel Sambuc  ArithLogic16Defs<0> {
537f4a2713aSLionel Sambuc  let AddedComplexity = 5;
538f4a2713aSLionel Sambuc}
539f4a2713aSLionel Sambucdef AddiuRxRxImmX16: FEXT_2RI16_ins<0b01001, "addiu", IIAlu>,
540f4a2713aSLionel Sambuc  ArithLogic16Defs<0> {
541f4a2713aSLionel Sambuc  let isCodeGenOnly = 1;
542f4a2713aSLionel Sambuc}
543f4a2713aSLionel Sambuc
544f4a2713aSLionel Sambucdef AddiuRxRyOffMemX16:
545f4a2713aSLionel Sambuc  FEXT_RRI_A16_mem_ins<0, "addiu", mem16_ea, IIAlu>;
546f4a2713aSLionel Sambuc
547f4a2713aSLionel Sambuc//
548f4a2713aSLionel Sambuc
549f4a2713aSLionel Sambuc// Format: ADDIU rx, pc, immediate MIPS16e
550f4a2713aSLionel Sambuc// Purpose: Add Immediate Unsigned Word (3-Operand, PC-Relative, Extended)
551f4a2713aSLionel Sambuc// To add a constant to the program counter.
552f4a2713aSLionel Sambuc//
553f4a2713aSLionel Sambucdef AddiuRxPcImmX16: FEXT_RI16_PC_ins<0b00001, "addiu", IIAlu>;
554f4a2713aSLionel Sambuc
555f4a2713aSLionel Sambuc//
556f4a2713aSLionel Sambuc// Format: ADDIU sp, immediate MIPS16e
557f4a2713aSLionel Sambuc// Purpose: Add Immediate Unsigned Word (2-Operand, SP-Relative, Extended)
558f4a2713aSLionel Sambuc// To add a constant to the stack pointer.
559f4a2713aSLionel Sambuc//
560f4a2713aSLionel Sambucdef AddiuSpImm16
561f4a2713aSLionel Sambuc  : FI816_SP_ins<0b011, "addiu", IIAlu> {
562f4a2713aSLionel Sambuc  let Defs = [SP];
563f4a2713aSLionel Sambuc  let Uses = [SP];
564f4a2713aSLionel Sambuc  let AddedComplexity = 5;
565f4a2713aSLionel Sambuc}
566f4a2713aSLionel Sambuc
567f4a2713aSLionel Sambucdef AddiuSpImmX16
568f4a2713aSLionel Sambuc  : FEXT_I816_SP_ins<0b011, "addiu", IIAlu> {
569f4a2713aSLionel Sambuc  let Defs = [SP];
570f4a2713aSLionel Sambuc  let Uses = [SP];
571f4a2713aSLionel Sambuc}
572f4a2713aSLionel Sambuc
573f4a2713aSLionel Sambuc//
574f4a2713aSLionel Sambuc// Format: ADDU rz, rx, ry MIPS16e
575f4a2713aSLionel Sambuc// Purpose: Add Unsigned Word (3-Operand)
576f4a2713aSLionel Sambuc// To add 32-bit integers.
577f4a2713aSLionel Sambuc//
578f4a2713aSLionel Sambuc
579f4a2713aSLionel Sambucdef AdduRxRyRz16: FRRR16_ins<01, "addu", IIAlu>, ArithLogic16Defs<1>;
580f4a2713aSLionel Sambuc
581f4a2713aSLionel Sambuc//
582f4a2713aSLionel Sambuc// Format: AND rx, ry MIPS16e
583f4a2713aSLionel Sambuc// Purpose: AND
584f4a2713aSLionel Sambuc// To do a bitwise logical AND.
585f4a2713aSLionel Sambuc
586f4a2713aSLionel Sambucdef AndRxRxRy16: FRxRxRy16_ins<0b01100, "and", IIAlu>, ArithLogic16Defs<1>;
587f4a2713aSLionel Sambuc
588f4a2713aSLionel Sambuc
589f4a2713aSLionel Sambuc//
590f4a2713aSLionel Sambuc// Format: BEQZ rx, offset MIPS16e
591f4a2713aSLionel Sambuc// Purpose: Branch on Equal to Zero
592f4a2713aSLionel Sambuc// To test a GPR then do a PC-relative conditional branch.
593f4a2713aSLionel Sambuc//
594f4a2713aSLionel Sambucdef BeqzRxImm16: FRI16_B_ins<0b00100, "beqz", IIAlu>, cbranch16;
595f4a2713aSLionel Sambuc
596f4a2713aSLionel Sambuc
597f4a2713aSLionel Sambuc//
598f4a2713aSLionel Sambuc// Format: BEQZ rx, offset MIPS16e
599f4a2713aSLionel Sambuc// Purpose: Branch on Equal to Zero (Extended)
600f4a2713aSLionel Sambuc// To test a GPR then do a PC-relative conditional branch.
601f4a2713aSLionel Sambuc//
602f4a2713aSLionel Sambucdef BeqzRxImmX16: FEXT_RI16_B_ins<0b00100, "beqz", IIAlu>, cbranch16;
603f4a2713aSLionel Sambuc
604f4a2713aSLionel Sambuc//
605f4a2713aSLionel Sambuc// Format: B offset MIPS16e
606f4a2713aSLionel Sambuc// Purpose: Unconditional Branch (Extended)
607f4a2713aSLionel Sambuc// To do an unconditional PC-relative branch.
608f4a2713aSLionel Sambuc//
609f4a2713aSLionel Sambuc
610f4a2713aSLionel Sambucdef Bimm16: FI16_ins<0b00010, "b", IIAlu>, branch16;
611f4a2713aSLionel Sambuc
612f4a2713aSLionel Sambuc// Format: B offset MIPS16e
613f4a2713aSLionel Sambuc// Purpose: Unconditional Branch
614f4a2713aSLionel Sambuc// To do an unconditional PC-relative branch.
615f4a2713aSLionel Sambuc//
616f4a2713aSLionel Sambucdef BimmX16: FEXT_I16_ins<0b00010, "b", IIAlu>, branch16;
617f4a2713aSLionel Sambuc
618f4a2713aSLionel Sambuc//
619f4a2713aSLionel Sambuc// Format: BNEZ rx, offset MIPS16e
620f4a2713aSLionel Sambuc// Purpose: Branch on Not Equal to Zero
621f4a2713aSLionel Sambuc// To test a GPR then do a PC-relative conditional branch.
622f4a2713aSLionel Sambuc//
623f4a2713aSLionel Sambucdef BnezRxImm16: FRI16_B_ins<0b00101, "bnez", IIAlu>, cbranch16;
624f4a2713aSLionel Sambuc
625f4a2713aSLionel Sambuc//
626f4a2713aSLionel Sambuc// Format: BNEZ rx, offset MIPS16e
627f4a2713aSLionel Sambuc// Purpose: Branch on Not Equal to Zero (Extended)
628f4a2713aSLionel Sambuc// To test a GPR then do a PC-relative conditional branch.
629f4a2713aSLionel Sambuc//
630f4a2713aSLionel Sambucdef BnezRxImmX16: FEXT_RI16_B_ins<0b00101, "bnez", IIAlu>, cbranch16;
631f4a2713aSLionel Sambuc
632f4a2713aSLionel Sambuc
633f4a2713aSLionel Sambuc//
634f4a2713aSLionel Sambuc//Format: BREAK immediate
635f4a2713aSLionel Sambuc// Purpose: Breakpoint
636f4a2713aSLionel Sambuc// To cause a Breakpoint exception.
637f4a2713aSLionel Sambuc
638f4a2713aSLionel Sambucdef Break16: FRRBreakNull16_ins<"break 0", NoItinerary>;
639f4a2713aSLionel Sambuc//
640f4a2713aSLionel Sambuc// Format: BTEQZ offset MIPS16e
641f4a2713aSLionel Sambuc// Purpose: Branch on T Equal to Zero (Extended)
642f4a2713aSLionel Sambuc// To test special register T then do a PC-relative conditional branch.
643f4a2713aSLionel Sambuc//
644f4a2713aSLionel Sambucdef Bteqz16: FI816_ins<0b000, "bteqz", IIAlu>, cbranch16 {
645f4a2713aSLionel Sambuc  let Uses = [T8];
646f4a2713aSLionel Sambuc}
647f4a2713aSLionel Sambuc
648f4a2713aSLionel Sambucdef BteqzX16: FEXT_I816_ins<0b000, "bteqz", IIAlu>, cbranch16 {
649f4a2713aSLionel Sambuc  let Uses = [T8];
650f4a2713aSLionel Sambuc}
651f4a2713aSLionel Sambuc
652f4a2713aSLionel Sambucdef BteqzT8CmpX16: FEXT_T8I816_ins<"bteqz", "cmp">, cbranch16;
653f4a2713aSLionel Sambuc
654f4a2713aSLionel Sambucdef BteqzT8CmpiX16: FEXT_T8I8I16_ins<"bteqz", "cmpi">,
655f4a2713aSLionel Sambuc  cbranch16;
656f4a2713aSLionel Sambuc
657f4a2713aSLionel Sambucdef BteqzT8SltX16: FEXT_T8I816_ins<"bteqz", "slt">, cbranch16;
658f4a2713aSLionel Sambuc
659f4a2713aSLionel Sambucdef BteqzT8SltuX16: FEXT_T8I816_ins<"bteqz", "sltu">, cbranch16;
660f4a2713aSLionel Sambuc
661f4a2713aSLionel Sambucdef BteqzT8SltiX16: FEXT_T8I8I16_ins<"bteqz", "slti">, cbranch16;
662f4a2713aSLionel Sambuc
663f4a2713aSLionel Sambucdef BteqzT8SltiuX16: FEXT_T8I8I16_ins<"bteqz", "sltiu">,
664f4a2713aSLionel Sambuc  cbranch16;
665f4a2713aSLionel Sambuc
666f4a2713aSLionel Sambuc//
667f4a2713aSLionel Sambuc// Format: BTNEZ offset MIPS16e
668f4a2713aSLionel Sambuc// Purpose: Branch on T Not Equal to Zero (Extended)
669f4a2713aSLionel Sambuc// To test special register T then do a PC-relative conditional branch.
670f4a2713aSLionel Sambuc//
671f4a2713aSLionel Sambuc
672f4a2713aSLionel Sambucdef Btnez16: FI816_ins<0b001, "btnez", IIAlu>, cbranch16 {
673f4a2713aSLionel Sambuc  let Uses = [T8];
674f4a2713aSLionel Sambuc}
675f4a2713aSLionel Sambuc
676f4a2713aSLionel Sambucdef BtnezX16: FEXT_I816_ins<0b001, "btnez", IIAlu> ,cbranch16 {
677f4a2713aSLionel Sambuc  let Uses = [T8];
678f4a2713aSLionel Sambuc}
679f4a2713aSLionel Sambuc
680f4a2713aSLionel Sambucdef BtnezT8CmpX16: FEXT_T8I816_ins<"btnez", "cmp">, cbranch16;
681f4a2713aSLionel Sambuc
682f4a2713aSLionel Sambucdef BtnezT8CmpiX16: FEXT_T8I8I16_ins<"btnez", "cmpi">, cbranch16;
683f4a2713aSLionel Sambuc
684f4a2713aSLionel Sambucdef BtnezT8SltX16: FEXT_T8I816_ins<"btnez", "slt">, cbranch16;
685f4a2713aSLionel Sambuc
686f4a2713aSLionel Sambucdef BtnezT8SltuX16: FEXT_T8I816_ins<"btnez", "sltu">, cbranch16;
687f4a2713aSLionel Sambuc
688f4a2713aSLionel Sambucdef BtnezT8SltiX16: FEXT_T8I8I16_ins<"btnez", "slti">, cbranch16;
689f4a2713aSLionel Sambuc
690f4a2713aSLionel Sambucdef BtnezT8SltiuX16: FEXT_T8I8I16_ins<"btnez", "sltiu">,
691f4a2713aSLionel Sambuc  cbranch16;
692f4a2713aSLionel Sambuc
693f4a2713aSLionel Sambuc//
694f4a2713aSLionel Sambuc// Format: CMP rx, ry MIPS16e
695f4a2713aSLionel Sambuc// Purpose: Compare
696f4a2713aSLionel Sambuc// To compare the contents of two GPRs.
697f4a2713aSLionel Sambuc//
698f4a2713aSLionel Sambucdef CmpRxRy16: FRR16R_ins<0b01010, "cmp", IIAlu> {
699f4a2713aSLionel Sambuc  let Defs = [T8];
700f4a2713aSLionel Sambuc}
701f4a2713aSLionel Sambuc
702f4a2713aSLionel Sambuc//
703f4a2713aSLionel Sambuc// Format: CMPI rx, immediate MIPS16e
704f4a2713aSLionel Sambuc// Purpose: Compare Immediate
705f4a2713aSLionel Sambuc// To compare a constant with the contents of a GPR.
706f4a2713aSLionel Sambuc//
707f4a2713aSLionel Sambucdef CmpiRxImm16: FRI16R_ins<0b01110, "cmpi", IIAlu> {
708f4a2713aSLionel Sambuc  let Defs = [T8];
709f4a2713aSLionel Sambuc}
710f4a2713aSLionel Sambuc
711f4a2713aSLionel Sambuc//
712f4a2713aSLionel Sambuc// Format: CMPI rx, immediate MIPS16e
713f4a2713aSLionel Sambuc// Purpose: Compare Immediate (Extended)
714f4a2713aSLionel Sambuc// To compare a constant with the contents of a GPR.
715f4a2713aSLionel Sambuc//
716f4a2713aSLionel Sambucdef CmpiRxImmX16: FEXT_RI16R_ins<0b01110, "cmpi", IIAlu> {
717f4a2713aSLionel Sambuc  let Defs = [T8];
718f4a2713aSLionel Sambuc}
719f4a2713aSLionel Sambuc
720f4a2713aSLionel Sambuc
721f4a2713aSLionel Sambuc//
722f4a2713aSLionel Sambuc// Format: DIV rx, ry MIPS16e
723f4a2713aSLionel Sambuc// Purpose: Divide Word
724f4a2713aSLionel Sambuc// To divide 32-bit signed integers.
725f4a2713aSLionel Sambuc//
726f4a2713aSLionel Sambucdef DivRxRy16: FRR16_div_ins<0b11010, "div", IIAlu> {
727f4a2713aSLionel Sambuc  let Defs = [HI0, LO0];
728f4a2713aSLionel Sambuc}
729f4a2713aSLionel Sambuc
730f4a2713aSLionel Sambuc//
731f4a2713aSLionel Sambuc// Format: DIVU rx, ry MIPS16e
732f4a2713aSLionel Sambuc// Purpose: Divide Unsigned Word
733f4a2713aSLionel Sambuc// To divide 32-bit unsigned integers.
734f4a2713aSLionel Sambuc//
735f4a2713aSLionel Sambucdef DivuRxRy16: FRR16_div_ins<0b11011, "divu", IIAlu> {
736f4a2713aSLionel Sambuc  let Defs = [HI0, LO0];
737f4a2713aSLionel Sambuc}
738f4a2713aSLionel Sambuc//
739f4a2713aSLionel Sambuc// Format: JAL target MIPS16e
740f4a2713aSLionel Sambuc// Purpose: Jump and Link
741f4a2713aSLionel Sambuc// To execute a procedure call within the current 256 MB-aligned
742f4a2713aSLionel Sambuc// region and preserve the current ISA.
743f4a2713aSLionel Sambuc//
744f4a2713aSLionel Sambuc
745f4a2713aSLionel Sambucdef Jal16 : FJAL16_ins<0b0, "jal", IIAlu> {
746f4a2713aSLionel Sambuc  let hasDelaySlot = 0;  // not true, but we add the nop for now
747f4a2713aSLionel Sambuc  let isCall=1;
748*0a6a1f1dSLionel Sambuc  let Defs = [RA];
749*0a6a1f1dSLionel Sambuc}
750*0a6a1f1dSLionel Sambuc
751*0a6a1f1dSLionel Sambucdef JalB16 : FJALB16_ins<0b0, "jal", IIAlu>, branch16 {
752*0a6a1f1dSLionel Sambuc  let hasDelaySlot = 0;  // not true, but we add the nop for now
753*0a6a1f1dSLionel Sambuc  let isBranch=1;
754*0a6a1f1dSLionel Sambuc  let Defs = [RA];
755f4a2713aSLionel Sambuc}
756f4a2713aSLionel Sambuc
757f4a2713aSLionel Sambuc//
758f4a2713aSLionel Sambuc// Format: JR ra MIPS16e
759f4a2713aSLionel Sambuc// Purpose: Jump Register Through Register ra
760f4a2713aSLionel Sambuc// To execute a branch to the instruction address in the return
761f4a2713aSLionel Sambuc// address register.
762f4a2713aSLionel Sambuc//
763f4a2713aSLionel Sambuc
764f4a2713aSLionel Sambucdef JrRa16: FRR16_JALRC_RA_only_ins<0, 0, "jr", IIAlu> {
765f4a2713aSLionel Sambuc  let isBranch = 1;
766f4a2713aSLionel Sambuc  let isIndirectBranch = 1;
767f4a2713aSLionel Sambuc  let hasDelaySlot = 1;
768f4a2713aSLionel Sambuc  let isTerminator=1;
769f4a2713aSLionel Sambuc  let isBarrier=1;
770f4a2713aSLionel Sambuc}
771f4a2713aSLionel Sambuc
772f4a2713aSLionel Sambucdef JrcRa16: FRR16_JALRC_RA_only_ins<1, 1, "jrc", IIAlu> {
773f4a2713aSLionel Sambuc  let isBranch = 1;
774f4a2713aSLionel Sambuc  let isIndirectBranch = 1;
775f4a2713aSLionel Sambuc  let isTerminator=1;
776f4a2713aSLionel Sambuc  let isBarrier=1;
777f4a2713aSLionel Sambuc}
778f4a2713aSLionel Sambuc
779f4a2713aSLionel Sambucdef JrcRx16: FRR16_JALRC_ins<1, 1, 0, "jrc", IIAlu> {
780f4a2713aSLionel Sambuc  let isBranch = 1;
781f4a2713aSLionel Sambuc  let isIndirectBranch = 1;
782f4a2713aSLionel Sambuc  let isTerminator=1;
783f4a2713aSLionel Sambuc  let isBarrier=1;
784f4a2713aSLionel Sambuc}
785f4a2713aSLionel Sambuc//
786f4a2713aSLionel Sambuc// Format: LB ry, offset(rx) MIPS16e
787f4a2713aSLionel Sambuc// Purpose: Load Byte (Extended)
788f4a2713aSLionel Sambuc// To load a byte from memory as a signed value.
789f4a2713aSLionel Sambuc//
790*0a6a1f1dSLionel Sambucdef LbRxRyOffMemX16: FEXT_RRI16_mem_ins<0b10011, "lb", mem16, II_LB>, MayLoad{
791f4a2713aSLionel Sambuc  let isCodeGenOnly = 1;
792f4a2713aSLionel Sambuc}
793f4a2713aSLionel Sambuc
794f4a2713aSLionel Sambuc//
795f4a2713aSLionel Sambuc// Format: LBU ry, offset(rx) MIPS16e
796f4a2713aSLionel Sambuc// Purpose: Load Byte Unsigned (Extended)
797f4a2713aSLionel Sambuc// To load a byte from memory as a unsigned value.
798f4a2713aSLionel Sambuc//
799f4a2713aSLionel Sambucdef LbuRxRyOffMemX16:
800*0a6a1f1dSLionel Sambuc  FEXT_RRI16_mem_ins<0b10100, "lbu", mem16, II_LBU>, MayLoad {
801f4a2713aSLionel Sambuc  let isCodeGenOnly = 1;
802f4a2713aSLionel Sambuc}
803f4a2713aSLionel Sambuc
804f4a2713aSLionel Sambuc//
805f4a2713aSLionel Sambuc// Format: LH ry, offset(rx) MIPS16e
806f4a2713aSLionel Sambuc// Purpose: Load Halfword signed (Extended)
807f4a2713aSLionel Sambuc// To load a halfword from memory as a signed value.
808f4a2713aSLionel Sambuc//
809*0a6a1f1dSLionel Sambucdef LhRxRyOffMemX16: FEXT_RRI16_mem_ins<0b10100, "lh", mem16, II_LH>, MayLoad{
810f4a2713aSLionel Sambuc  let isCodeGenOnly = 1;
811f4a2713aSLionel Sambuc}
812f4a2713aSLionel Sambuc
813f4a2713aSLionel Sambuc//
814f4a2713aSLionel Sambuc// Format: LHU ry, offset(rx) MIPS16e
815f4a2713aSLionel Sambuc// Purpose: Load Halfword unsigned (Extended)
816f4a2713aSLionel Sambuc// To load a halfword from memory as an unsigned value.
817f4a2713aSLionel Sambuc//
818f4a2713aSLionel Sambucdef LhuRxRyOffMemX16:
819*0a6a1f1dSLionel Sambuc  FEXT_RRI16_mem_ins<0b10100, "lhu", mem16, II_LHU>, MayLoad {
820f4a2713aSLionel Sambuc  let isCodeGenOnly = 1;
821f4a2713aSLionel Sambuc}
822f4a2713aSLionel Sambuc
823f4a2713aSLionel Sambuc//
824f4a2713aSLionel Sambuc// Format: LI rx, immediate MIPS16e
825f4a2713aSLionel Sambuc// Purpose: Load Immediate
826f4a2713aSLionel Sambuc// To load a constant into a GPR.
827f4a2713aSLionel Sambuc//
828f4a2713aSLionel Sambucdef LiRxImm16: FRI16_ins<0b01101, "li", IIAlu>;
829f4a2713aSLionel Sambuc
830f4a2713aSLionel Sambuc//
831f4a2713aSLionel Sambuc// Format: LI rx, immediate MIPS16e
832f4a2713aSLionel Sambuc// Purpose: Load Immediate (Extended)
833f4a2713aSLionel Sambuc// To load a constant into a GPR.
834f4a2713aSLionel Sambuc//
835f4a2713aSLionel Sambucdef LiRxImmX16: FEXT_RI16_ins<0b01101, "li", IIAlu>;
836f4a2713aSLionel Sambuc
837f4a2713aSLionel Sambucdef LiRxImmAlignX16: FEXT_RI16_ins<0b01101, ".align 2\n\tli", IIAlu> {
838f4a2713aSLionel Sambuc  let isCodeGenOnly = 1;
839f4a2713aSLionel Sambuc}
840f4a2713aSLionel Sambuc
841f4a2713aSLionel Sambuc//
842f4a2713aSLionel Sambuc// Format: LW ry, offset(rx) MIPS16e
843f4a2713aSLionel Sambuc// Purpose: Load Word (Extended)
844f4a2713aSLionel Sambuc// To load a word from memory as a signed value.
845f4a2713aSLionel Sambuc//
846*0a6a1f1dSLionel Sambucdef LwRxRyOffMemX16: FEXT_RRI16_mem_ins<0b10011, "lw", mem16, II_LW>, MayLoad{
847f4a2713aSLionel Sambuc  let isCodeGenOnly = 1;
848f4a2713aSLionel Sambuc}
849f4a2713aSLionel Sambuc
850f4a2713aSLionel Sambuc// Format: LW rx, offset(sp) MIPS16e
851f4a2713aSLionel Sambuc// Purpose: Load Word (SP-Relative, Extended)
852f4a2713aSLionel Sambuc// To load an SP-relative word from memory as a signed value.
853f4a2713aSLionel Sambuc//
854*0a6a1f1dSLionel Sambucdef LwRxSpImmX16: FEXT_RI16_SP_explicit_ins<0b10010, "lw", II_LW>, MayLoad{
855f4a2713aSLionel Sambuc  let Uses = [SP];
856f4a2713aSLionel Sambuc}
857f4a2713aSLionel Sambuc
858*0a6a1f1dSLionel Sambucdef LwRxPcTcp16: FRI16_TCP_ins<0b10110, "lw", II_LW>, MayLoad;
859f4a2713aSLionel Sambuc
860*0a6a1f1dSLionel Sambucdef LwRxPcTcpX16: FEXT_RI16_TCP_ins<0b10110, "lw", II_LW>, MayLoad;
861f4a2713aSLionel Sambuc//
862f4a2713aSLionel Sambuc// Format: MOVE r32, rz MIPS16e
863f4a2713aSLionel Sambuc// Purpose: Move
864f4a2713aSLionel Sambuc// To move the contents of a GPR to a GPR.
865f4a2713aSLionel Sambuc//
866f4a2713aSLionel Sambucdef Move32R16: FI8_MOV32R16_ins<"move", IIAlu>;
867f4a2713aSLionel Sambuc
868f4a2713aSLionel Sambuc//
869f4a2713aSLionel Sambuc// Format: MOVE ry, r32 MIPS16e
870f4a2713aSLionel Sambuc//Purpose: Move
871f4a2713aSLionel Sambuc// To move the contents of a GPR to a GPR.
872f4a2713aSLionel Sambuc//
873f4a2713aSLionel Sambucdef MoveR3216: FI8_MOVR3216_ins<"move", IIAlu>;
874f4a2713aSLionel Sambuc
875f4a2713aSLionel Sambuc//
876f4a2713aSLionel Sambuc// Format: MFHI rx MIPS16e
877f4a2713aSLionel Sambuc// Purpose: Move From HI Register
878f4a2713aSLionel Sambuc// To copy the special purpose HI register to a GPR.
879f4a2713aSLionel Sambuc//
880f4a2713aSLionel Sambucdef Mfhi16: FRR16_M_ins<0b10000, "mfhi", IIAlu> {
881f4a2713aSLionel Sambuc  let Uses = [HI0];
882*0a6a1f1dSLionel Sambuc  let hasSideEffects = 0;
883f4a2713aSLionel Sambuc}
884f4a2713aSLionel Sambuc
885f4a2713aSLionel Sambuc//
886f4a2713aSLionel Sambuc// Format: MFLO rx MIPS16e
887f4a2713aSLionel Sambuc// Purpose: Move From LO Register
888f4a2713aSLionel Sambuc// To copy the special purpose LO register to a GPR.
889f4a2713aSLionel Sambuc//
890f4a2713aSLionel Sambucdef Mflo16: FRR16_M_ins<0b10010, "mflo", IIAlu> {
891f4a2713aSLionel Sambuc  let Uses = [LO0];
892*0a6a1f1dSLionel Sambuc  let hasSideEffects = 0;
893f4a2713aSLionel Sambuc}
894f4a2713aSLionel Sambuc
895f4a2713aSLionel Sambuc//
896f4a2713aSLionel Sambuc// Pseudo Instruction for mult
897f4a2713aSLionel Sambuc//
898f4a2713aSLionel Sambucdef MultRxRy16:  FMULT16_ins<"mult",  IIAlu> {
899f4a2713aSLionel Sambuc  let isCommutable = 1;
900*0a6a1f1dSLionel Sambuc  let hasSideEffects = 0;
901f4a2713aSLionel Sambuc  let Defs = [HI0, LO0];
902f4a2713aSLionel Sambuc}
903f4a2713aSLionel Sambuc
904f4a2713aSLionel Sambucdef MultuRxRy16: FMULT16_ins<"multu", IIAlu> {
905f4a2713aSLionel Sambuc  let isCommutable = 1;
906*0a6a1f1dSLionel Sambuc  let hasSideEffects = 0;
907f4a2713aSLionel Sambuc  let Defs = [HI0, LO0];
908f4a2713aSLionel Sambuc}
909f4a2713aSLionel Sambuc
910f4a2713aSLionel Sambuc//
911f4a2713aSLionel Sambuc// Format: MULT rx, ry MIPS16e
912f4a2713aSLionel Sambuc// Purpose: Multiply Word
913f4a2713aSLionel Sambuc// To multiply 32-bit signed integers.
914f4a2713aSLionel Sambuc//
915f4a2713aSLionel Sambucdef MultRxRyRz16: FMULT16_LO_ins<"mult", IIAlu> {
916f4a2713aSLionel Sambuc  let isCommutable = 1;
917*0a6a1f1dSLionel Sambuc  let hasSideEffects = 0;
918f4a2713aSLionel Sambuc  let Defs = [HI0, LO0];
919f4a2713aSLionel Sambuc}
920f4a2713aSLionel Sambuc
921f4a2713aSLionel Sambuc//
922f4a2713aSLionel Sambuc// Format: MULTU rx, ry MIPS16e
923f4a2713aSLionel Sambuc// Purpose: Multiply Unsigned Word
924f4a2713aSLionel Sambuc// To multiply 32-bit unsigned integers.
925f4a2713aSLionel Sambuc//
926f4a2713aSLionel Sambucdef MultuRxRyRz16: FMULT16_LO_ins<"multu", IIAlu> {
927f4a2713aSLionel Sambuc  let isCommutable = 1;
928*0a6a1f1dSLionel Sambuc  let hasSideEffects = 0;
929f4a2713aSLionel Sambuc  let Defs = [HI0, LO0];
930f4a2713aSLionel Sambuc}
931f4a2713aSLionel Sambuc
932f4a2713aSLionel Sambuc//
933f4a2713aSLionel Sambuc// Format: NEG rx, ry MIPS16e
934f4a2713aSLionel Sambuc// Purpose: Negate
935f4a2713aSLionel Sambuc// To negate an integer value.
936f4a2713aSLionel Sambuc//
937f4a2713aSLionel Sambucdef NegRxRy16: FUnaryRR16_ins<0b11101, "neg", IIAlu>;
938f4a2713aSLionel Sambuc
939f4a2713aSLionel Sambuc//
940f4a2713aSLionel Sambuc// Format: NOT rx, ry MIPS16e
941f4a2713aSLionel Sambuc// Purpose: Not
942f4a2713aSLionel Sambuc// To complement an integer value
943f4a2713aSLionel Sambuc//
944f4a2713aSLionel Sambucdef NotRxRy16: FUnaryRR16_ins<0b01111, "not", IIAlu>;
945f4a2713aSLionel Sambuc
946f4a2713aSLionel Sambuc//
947f4a2713aSLionel Sambuc// Format: OR rx, ry MIPS16e
948f4a2713aSLionel Sambuc// Purpose: Or
949f4a2713aSLionel Sambuc// To do a bitwise logical OR.
950f4a2713aSLionel Sambuc//
951f4a2713aSLionel Sambucdef OrRxRxRy16: FRxRxRy16_ins<0b01101, "or", IIAlu>, ArithLogic16Defs<1>;
952f4a2713aSLionel Sambuc
953f4a2713aSLionel Sambuc//
954f4a2713aSLionel Sambuc// Format: RESTORE {ra,}{s0/s1/s0-1,}{framesize}
955f4a2713aSLionel Sambuc// (All args are optional) MIPS16e
956f4a2713aSLionel Sambuc// Purpose: Restore Registers and Deallocate Stack Frame
957f4a2713aSLionel Sambuc// To deallocate a stack frame before exit from a subroutine,
958f4a2713aSLionel Sambuc// restoring return address and static registers, and adjusting
959f4a2713aSLionel Sambuc// stack
960f4a2713aSLionel Sambuc//
961f4a2713aSLionel Sambuc
962*0a6a1f1dSLionel Sambucdef Restore16:
963*0a6a1f1dSLionel Sambuc  FI8_SVRS16<0b1, (outs), (ins variable_ops),
964*0a6a1f1dSLionel Sambuc             "", [], II_RESTORE >, MayLoad {
965f4a2713aSLionel Sambuc  let isCodeGenOnly = 1;
966*0a6a1f1dSLionel Sambuc  let Defs = [SP];
967f4a2713aSLionel Sambuc  let Uses = [SP];
968f4a2713aSLionel Sambuc}
969f4a2713aSLionel Sambuc
970*0a6a1f1dSLionel Sambuc
971*0a6a1f1dSLionel Sambucdef RestoreX16:
972*0a6a1f1dSLionel Sambuc  FI8_SVRS16<0b1, (outs), (ins variable_ops),
973*0a6a1f1dSLionel Sambuc             "", [], II_RESTORE >, MayLoad {
974f4a2713aSLionel Sambuc  let isCodeGenOnly = 1;
975f4a2713aSLionel Sambuc  let Defs = [SP];
976f4a2713aSLionel Sambuc  let Uses = [SP];
977f4a2713aSLionel Sambuc}
978f4a2713aSLionel Sambuc
979f4a2713aSLionel Sambuc//
980f4a2713aSLionel Sambuc// Format: SAVE {ra,}{s0/s1/s0-1,}{framesize} (All arguments are optional)
981f4a2713aSLionel Sambuc// MIPS16e
982f4a2713aSLionel Sambuc// Purpose: Save Registers and Set Up Stack Frame
983f4a2713aSLionel Sambuc// To set up a stack frame on entry to a subroutine,
984f4a2713aSLionel Sambuc// saving return address and static registers, and adjusting stack
985f4a2713aSLionel Sambuc//
986*0a6a1f1dSLionel Sambucdef Save16:
987*0a6a1f1dSLionel Sambuc  FI8_SVRS16<0b1, (outs), (ins variable_ops),
988*0a6a1f1dSLionel Sambuc             "", [], II_SAVE >, MayStore {
989f4a2713aSLionel Sambuc  let isCodeGenOnly = 1;
990*0a6a1f1dSLionel Sambuc  let Uses = [SP];
991f4a2713aSLionel Sambuc  let Defs = [SP];
992f4a2713aSLionel Sambuc}
993f4a2713aSLionel Sambuc
994*0a6a1f1dSLionel Sambucdef SaveX16:
995*0a6a1f1dSLionel Sambuc  FI8_SVRS16<0b1, (outs), (ins variable_ops),
996*0a6a1f1dSLionel Sambuc             "", [], II_SAVE >, MayStore {
997f4a2713aSLionel Sambuc  let isCodeGenOnly = 1;
998f4a2713aSLionel Sambuc  let Uses = [SP];
999f4a2713aSLionel Sambuc  let Defs = [SP];
1000f4a2713aSLionel Sambuc}
1001f4a2713aSLionel Sambuc//
1002f4a2713aSLionel Sambuc// Format: SB ry, offset(rx) MIPS16e
1003f4a2713aSLionel Sambuc// Purpose: Store Byte (Extended)
1004f4a2713aSLionel Sambuc// To store a byte to memory.
1005f4a2713aSLionel Sambuc//
1006f4a2713aSLionel Sambucdef SbRxRyOffMemX16:
1007*0a6a1f1dSLionel Sambuc  FEXT_RRI16_mem2_ins<0b11000, "sb", mem16, II_SB>, MayStore;
1008f4a2713aSLionel Sambuc
1009f4a2713aSLionel Sambuc//
1010f4a2713aSLionel Sambuc// Format: SEB rx MIPS16e
1011f4a2713aSLionel Sambuc// Purpose: Sign-Extend Byte
1012f4a2713aSLionel Sambuc// Sign-extend least significant byte in register rx.
1013f4a2713aSLionel Sambuc//
1014f4a2713aSLionel Sambucdef SebRx16
1015f4a2713aSLionel Sambuc  : FRR_SF16_ins<0b10001, 0b100, "seb", IIAlu>;
1016f4a2713aSLionel Sambuc
1017f4a2713aSLionel Sambuc//
1018f4a2713aSLionel Sambuc// Format: SEH rx MIPS16e
1019f4a2713aSLionel Sambuc// Purpose: Sign-Extend Halfword
1020f4a2713aSLionel Sambuc// Sign-extend least significant word in register rx.
1021f4a2713aSLionel Sambuc//
1022f4a2713aSLionel Sambucdef SehRx16
1023f4a2713aSLionel Sambuc  : FRR_SF16_ins<0b10001, 0b101, "seh", IIAlu>;
1024f4a2713aSLionel Sambuc
1025f4a2713aSLionel Sambuc//
1026f4a2713aSLionel Sambuc// The Sel(T) instructions are pseudos
1027f4a2713aSLionel Sambuc// T means that they use T8 implicitly.
1028f4a2713aSLionel Sambuc//
1029f4a2713aSLionel Sambuc//
1030f4a2713aSLionel Sambuc// Format: SelBeqZ rd, rs, rt
1031f4a2713aSLionel Sambuc// Purpose: if rt==0, do nothing
1032f4a2713aSLionel Sambuc//          else rs = rt
1033f4a2713aSLionel Sambuc//
1034f4a2713aSLionel Sambucdef SelBeqZ: Sel<"beqz">;
1035f4a2713aSLionel Sambuc
1036f4a2713aSLionel Sambuc//
1037f4a2713aSLionel Sambuc// Format:  SelTBteqZCmp rd, rs, rl, rr
1038f4a2713aSLionel Sambuc// Purpose: b = Cmp rl, rr.
1039f4a2713aSLionel Sambuc//          If b==0 then do nothing.
1040f4a2713aSLionel Sambuc//          if b!=0 then rd = rs
1041f4a2713aSLionel Sambuc//
1042f4a2713aSLionel Sambucdef SelTBteqZCmp: SelT<"bteqz", "cmp">;
1043f4a2713aSLionel Sambuc
1044f4a2713aSLionel Sambuc//
1045f4a2713aSLionel Sambuc// Format:  SelTBteqZCmpi rd, rs, rl, rr
1046f4a2713aSLionel Sambuc// Purpose: b = Cmpi rl, imm.
1047f4a2713aSLionel Sambuc//          If b==0 then do nothing.
1048f4a2713aSLionel Sambuc//          if b!=0 then rd = rs
1049f4a2713aSLionel Sambuc//
1050f4a2713aSLionel Sambucdef SelTBteqZCmpi: SeliT<"bteqz", "cmpi">;
1051f4a2713aSLionel Sambuc
1052f4a2713aSLionel Sambuc//
1053f4a2713aSLionel Sambuc// Format:  SelTBteqZSlt rd, rs, rl, rr
1054f4a2713aSLionel Sambuc// Purpose: b = Slt rl, rr.
1055f4a2713aSLionel Sambuc//          If b==0 then do nothing.
1056f4a2713aSLionel Sambuc//          if b!=0 then rd = rs
1057f4a2713aSLionel Sambuc//
1058f4a2713aSLionel Sambucdef SelTBteqZSlt: SelT<"bteqz", "slt">;
1059f4a2713aSLionel Sambuc
1060f4a2713aSLionel Sambuc//
1061f4a2713aSLionel Sambuc// Format:  SelTBteqZSlti rd, rs, rl, rr
1062f4a2713aSLionel Sambuc// Purpose: b = Slti rl, imm.
1063f4a2713aSLionel Sambuc//          If b==0 then do nothing.
1064f4a2713aSLionel Sambuc//          if b!=0 then rd = rs
1065f4a2713aSLionel Sambuc//
1066f4a2713aSLionel Sambucdef SelTBteqZSlti: SeliT<"bteqz", "slti">;
1067f4a2713aSLionel Sambuc
1068f4a2713aSLionel Sambuc//
1069f4a2713aSLionel Sambuc// Format:  SelTBteqZSltu rd, rs, rl, rr
1070f4a2713aSLionel Sambuc// Purpose: b = Sltu rl, rr.
1071f4a2713aSLionel Sambuc//          If b==0 then do nothing.
1072f4a2713aSLionel Sambuc//          if b!=0 then rd = rs
1073f4a2713aSLionel Sambuc//
1074f4a2713aSLionel Sambucdef SelTBteqZSltu: SelT<"bteqz", "sltu">;
1075f4a2713aSLionel Sambuc
1076f4a2713aSLionel Sambuc//
1077f4a2713aSLionel Sambuc// Format:  SelTBteqZSltiu rd, rs, rl, rr
1078f4a2713aSLionel Sambuc// Purpose: b = Sltiu rl, imm.
1079f4a2713aSLionel Sambuc//          If b==0 then do nothing.
1080f4a2713aSLionel Sambuc//          if b!=0 then rd = rs
1081f4a2713aSLionel Sambuc//
1082f4a2713aSLionel Sambucdef SelTBteqZSltiu: SeliT<"bteqz", "sltiu">;
1083f4a2713aSLionel Sambuc
1084f4a2713aSLionel Sambuc//
1085f4a2713aSLionel Sambuc// Format: SelBnez rd, rs, rt
1086f4a2713aSLionel Sambuc// Purpose: if rt!=0, do nothing
1087f4a2713aSLionel Sambuc//          else rs = rt
1088f4a2713aSLionel Sambuc//
1089f4a2713aSLionel Sambucdef SelBneZ: Sel<"bnez">;
1090f4a2713aSLionel Sambuc
1091f4a2713aSLionel Sambuc//
1092f4a2713aSLionel Sambuc// Format:  SelTBtneZCmp rd, rs, rl, rr
1093f4a2713aSLionel Sambuc// Purpose: b = Cmp rl, rr.
1094f4a2713aSLionel Sambuc//          If b!=0 then do nothing.
1095f4a2713aSLionel Sambuc//          if b0=0 then rd = rs
1096f4a2713aSLionel Sambuc//
1097f4a2713aSLionel Sambucdef SelTBtneZCmp: SelT<"btnez", "cmp">;
1098f4a2713aSLionel Sambuc
1099f4a2713aSLionel Sambuc//
1100f4a2713aSLionel Sambuc// Format:  SelTBtnezCmpi rd, rs, rl, rr
1101f4a2713aSLionel Sambuc// Purpose: b = Cmpi rl, imm.
1102f4a2713aSLionel Sambuc//          If b!=0 then do nothing.
1103f4a2713aSLionel Sambuc//          if b==0 then rd = rs
1104f4a2713aSLionel Sambuc//
1105f4a2713aSLionel Sambucdef SelTBtneZCmpi: SeliT<"btnez", "cmpi">;
1106f4a2713aSLionel Sambuc
1107f4a2713aSLionel Sambuc//
1108f4a2713aSLionel Sambuc// Format:  SelTBtneZSlt rd, rs, rl, rr
1109f4a2713aSLionel Sambuc// Purpose: b = Slt rl, rr.
1110f4a2713aSLionel Sambuc//          If b!=0 then do nothing.
1111f4a2713aSLionel Sambuc//          if b==0 then rd = rs
1112f4a2713aSLionel Sambuc//
1113f4a2713aSLionel Sambucdef SelTBtneZSlt: SelT<"btnez", "slt">;
1114f4a2713aSLionel Sambuc
1115f4a2713aSLionel Sambuc//
1116f4a2713aSLionel Sambuc// Format:  SelTBtneZSlti rd, rs, rl, rr
1117f4a2713aSLionel Sambuc// Purpose: b = Slti rl, imm.
1118f4a2713aSLionel Sambuc//          If b!=0 then do nothing.
1119f4a2713aSLionel Sambuc//          if b==0 then rd = rs
1120f4a2713aSLionel Sambuc//
1121f4a2713aSLionel Sambucdef SelTBtneZSlti: SeliT<"btnez", "slti">;
1122f4a2713aSLionel Sambuc
1123f4a2713aSLionel Sambuc//
1124f4a2713aSLionel Sambuc// Format:  SelTBtneZSltu rd, rs, rl, rr
1125f4a2713aSLionel Sambuc// Purpose: b = Sltu rl, rr.
1126f4a2713aSLionel Sambuc//          If b!=0 then do nothing.
1127f4a2713aSLionel Sambuc//          if b==0 then rd = rs
1128f4a2713aSLionel Sambuc//
1129f4a2713aSLionel Sambucdef SelTBtneZSltu: SelT<"btnez", "sltu">;
1130f4a2713aSLionel Sambuc
1131f4a2713aSLionel Sambuc//
1132f4a2713aSLionel Sambuc// Format:  SelTBtneZSltiu rd, rs, rl, rr
1133f4a2713aSLionel Sambuc// Purpose: b = Slti rl, imm.
1134f4a2713aSLionel Sambuc//          If b!=0 then do nothing.
1135f4a2713aSLionel Sambuc//          if b==0 then rd = rs
1136f4a2713aSLionel Sambuc//
1137f4a2713aSLionel Sambucdef SelTBtneZSltiu: SeliT<"btnez", "sltiu">;
1138f4a2713aSLionel Sambuc//
1139f4a2713aSLionel Sambuc//
1140f4a2713aSLionel Sambuc// Format: SH ry, offset(rx) MIPS16e
1141f4a2713aSLionel Sambuc// Purpose: Store Halfword (Extended)
1142f4a2713aSLionel Sambuc// To store a halfword to memory.
1143f4a2713aSLionel Sambuc//
1144f4a2713aSLionel Sambucdef ShRxRyOffMemX16:
1145*0a6a1f1dSLionel Sambuc  FEXT_RRI16_mem2_ins<0b11001, "sh", mem16, II_SH>, MayStore;
1146f4a2713aSLionel Sambuc
1147f4a2713aSLionel Sambuc//
1148f4a2713aSLionel Sambuc// Format: SLL rx, ry, sa MIPS16e
1149f4a2713aSLionel Sambuc// Purpose: Shift Word Left Logical (Extended)
1150f4a2713aSLionel Sambuc// To execute a left-shift of a word by a fixed number of bits-0 to 31 bits.
1151f4a2713aSLionel Sambuc//
1152f4a2713aSLionel Sambucdef SllX16: FEXT_SHIFT16_ins<0b00, "sll", IIAlu>;
1153f4a2713aSLionel Sambuc
1154f4a2713aSLionel Sambuc//
1155f4a2713aSLionel Sambuc// Format: SLLV ry, rx MIPS16e
1156f4a2713aSLionel Sambuc// Purpose: Shift Word Left Logical Variable
1157f4a2713aSLionel Sambuc// To execute a left-shift of a word by a variable number of bits.
1158f4a2713aSLionel Sambuc//
1159f4a2713aSLionel Sambucdef SllvRxRy16 : FRxRxRy16_ins<0b00100, "sllv", IIAlu>;
1160f4a2713aSLionel Sambuc
1161f4a2713aSLionel Sambuc// Format: SLTI rx, immediate MIPS16e
1162f4a2713aSLionel Sambuc// Purpose: Set on Less Than Immediate
1163f4a2713aSLionel Sambuc// To record the result of a less-than comparison with a constant.
1164f4a2713aSLionel Sambuc//
1165f4a2713aSLionel Sambuc//
1166f4a2713aSLionel Sambucdef SltiRxImm16: FRI16R_ins<0b01010, "slti", IIAlu> {
1167f4a2713aSLionel Sambuc  let Defs = [T8];
1168f4a2713aSLionel Sambuc}
1169f4a2713aSLionel Sambuc
1170f4a2713aSLionel Sambuc//
1171f4a2713aSLionel Sambuc// Format: SLTI rx, immediate MIPS16e
1172f4a2713aSLionel Sambuc// Purpose: Set on Less Than Immediate (Extended)
1173f4a2713aSLionel Sambuc// To record the result of a less-than comparison with a constant.
1174f4a2713aSLionel Sambuc//
1175f4a2713aSLionel Sambuc//
1176f4a2713aSLionel Sambucdef SltiRxImmX16: FEXT_RI16R_ins<0b01010, "slti", IIAlu> {
1177f4a2713aSLionel Sambuc  let Defs = [T8];
1178f4a2713aSLionel Sambuc}
1179f4a2713aSLionel Sambuc
1180f4a2713aSLionel Sambucdef SltiCCRxImmX16: FEXT_CCRXI16_ins<"slti">;
1181f4a2713aSLionel Sambuc
1182f4a2713aSLionel Sambuc// Format: SLTIU rx, immediate MIPS16e
1183f4a2713aSLionel Sambuc// Purpose: Set on Less Than Immediate Unsigned
1184f4a2713aSLionel Sambuc// To record the result of a less-than comparison with a constant.
1185f4a2713aSLionel Sambuc//
1186f4a2713aSLionel Sambuc//
1187f4a2713aSLionel Sambucdef SltiuRxImm16: FRI16R_ins<0b01011, "sltiu", IIAlu> {
1188f4a2713aSLionel Sambuc  let Defs = [T8];
1189f4a2713aSLionel Sambuc}
1190f4a2713aSLionel Sambuc
1191f4a2713aSLionel Sambuc//
1192f4a2713aSLionel Sambuc// Format: SLTI rx, immediate MIPS16e
1193f4a2713aSLionel Sambuc// Purpose: Set on Less Than Immediate Unsigned (Extended)
1194f4a2713aSLionel Sambuc// To record the result of a less-than comparison with a constant.
1195f4a2713aSLionel Sambuc//
1196f4a2713aSLionel Sambuc//
1197f4a2713aSLionel Sambucdef SltiuRxImmX16: FEXT_RI16R_ins<0b01011, "sltiu", IIAlu> {
1198f4a2713aSLionel Sambuc  let Defs = [T8];
1199f4a2713aSLionel Sambuc}
1200f4a2713aSLionel Sambuc//
1201f4a2713aSLionel Sambuc// Format: SLTIU rx, immediate MIPS16e
1202f4a2713aSLionel Sambuc// Purpose: Set on Less Than Immediate Unsigned (Extended)
1203f4a2713aSLionel Sambuc// To record the result of a less-than comparison with a constant.
1204f4a2713aSLionel Sambuc//
1205f4a2713aSLionel Sambucdef SltiuCCRxImmX16: FEXT_CCRXI16_ins<"sltiu">;
1206f4a2713aSLionel Sambuc
1207f4a2713aSLionel Sambuc//
1208f4a2713aSLionel Sambuc// Format: SLT rx, ry MIPS16e
1209f4a2713aSLionel Sambuc// Purpose: Set on Less Than
1210f4a2713aSLionel Sambuc// To record the result of a less-than comparison.
1211f4a2713aSLionel Sambuc//
1212f4a2713aSLionel Sambucdef SltRxRy16: FRR16R_ins<0b00010, "slt", IIAlu>{
1213f4a2713aSLionel Sambuc  let Defs = [T8];
1214f4a2713aSLionel Sambuc}
1215f4a2713aSLionel Sambuc
1216f4a2713aSLionel Sambucdef SltCCRxRy16: FCCRR16_ins<"slt">;
1217f4a2713aSLionel Sambuc
1218f4a2713aSLionel Sambuc// Format: SLTU rx, ry MIPS16e
1219f4a2713aSLionel Sambuc// Purpose: Set on Less Than Unsigned
1220f4a2713aSLionel Sambuc// To record the result of an unsigned less-than comparison.
1221f4a2713aSLionel Sambuc//
1222f4a2713aSLionel Sambucdef SltuRxRy16: FRR16R_ins<0b00011, "sltu", IIAlu>{
1223f4a2713aSLionel Sambuc  let Defs = [T8];
1224f4a2713aSLionel Sambuc}
1225f4a2713aSLionel Sambuc
1226f4a2713aSLionel Sambucdef SltuRxRyRz16: FRRTR16_ins<"sltu"> {
1227f4a2713aSLionel Sambuc  let isCodeGenOnly=1;
1228f4a2713aSLionel Sambuc  let Defs = [T8];
1229f4a2713aSLionel Sambuc}
1230f4a2713aSLionel Sambuc
1231f4a2713aSLionel Sambuc
1232f4a2713aSLionel Sambucdef SltuCCRxRy16: FCCRR16_ins<"sltu">;
1233f4a2713aSLionel Sambuc//
1234f4a2713aSLionel Sambuc// Format: SRAV ry, rx MIPS16e
1235f4a2713aSLionel Sambuc// Purpose: Shift Word Right Arithmetic Variable
1236f4a2713aSLionel Sambuc// To execute an arithmetic right-shift of a word by a variable
1237f4a2713aSLionel Sambuc// number of bits.
1238f4a2713aSLionel Sambuc//
1239f4a2713aSLionel Sambucdef SravRxRy16: FRxRxRy16_ins<0b00111, "srav", IIAlu>;
1240f4a2713aSLionel Sambuc
1241f4a2713aSLionel Sambuc
1242f4a2713aSLionel Sambuc//
1243f4a2713aSLionel Sambuc// Format: SRA rx, ry, sa MIPS16e
1244f4a2713aSLionel Sambuc// Purpose: Shift Word Right Arithmetic (Extended)
1245f4a2713aSLionel Sambuc// To execute an arithmetic right-shift of a word by a fixed
1246f4a2713aSLionel Sambuc// number of bits-1 to 8 bits.
1247f4a2713aSLionel Sambuc//
1248f4a2713aSLionel Sambucdef SraX16: FEXT_SHIFT16_ins<0b11, "sra", IIAlu>;
1249f4a2713aSLionel Sambuc
1250f4a2713aSLionel Sambuc
1251f4a2713aSLionel Sambuc//
1252f4a2713aSLionel Sambuc// Format: SRLV ry, rx MIPS16e
1253f4a2713aSLionel Sambuc// Purpose: Shift Word Right Logical Variable
1254f4a2713aSLionel Sambuc// To execute a logical right-shift of a word by a variable
1255f4a2713aSLionel Sambuc// number of bits.
1256f4a2713aSLionel Sambuc//
1257f4a2713aSLionel Sambucdef SrlvRxRy16: FRxRxRy16_ins<0b00110, "srlv", IIAlu>;
1258f4a2713aSLionel Sambuc
1259f4a2713aSLionel Sambuc
1260f4a2713aSLionel Sambuc//
1261f4a2713aSLionel Sambuc// Format: SRL rx, ry, sa MIPS16e
1262f4a2713aSLionel Sambuc// Purpose: Shift Word Right Logical (Extended)
1263f4a2713aSLionel Sambuc// To execute a logical right-shift of a word by a fixed
1264f4a2713aSLionel Sambuc// number of bits-1 to 31 bits.
1265f4a2713aSLionel Sambuc//
1266f4a2713aSLionel Sambucdef SrlX16: FEXT_SHIFT16_ins<0b10, "srl", IIAlu>;
1267f4a2713aSLionel Sambuc
1268f4a2713aSLionel Sambuc//
1269f4a2713aSLionel Sambuc// Format: SUBU rz, rx, ry MIPS16e
1270f4a2713aSLionel Sambuc// Purpose: Subtract Unsigned Word
1271f4a2713aSLionel Sambuc// To subtract 32-bit integers
1272f4a2713aSLionel Sambuc//
1273f4a2713aSLionel Sambucdef SubuRxRyRz16: FRRR16_ins<0b11, "subu", IIAlu>, ArithLogic16Defs<0>;
1274f4a2713aSLionel Sambuc
1275f4a2713aSLionel Sambuc//
1276f4a2713aSLionel Sambuc// Format: SW ry, offset(rx) MIPS16e
1277f4a2713aSLionel Sambuc// Purpose: Store Word (Extended)
1278f4a2713aSLionel Sambuc// To store a word to memory.
1279f4a2713aSLionel Sambuc//
1280f4a2713aSLionel Sambucdef SwRxRyOffMemX16:
1281*0a6a1f1dSLionel Sambuc  FEXT_RRI16_mem2_ins<0b11011, "sw", mem16, II_SW>, MayStore;
1282f4a2713aSLionel Sambuc
1283f4a2713aSLionel Sambuc//
1284f4a2713aSLionel Sambuc// Format: SW rx, offset(sp) MIPS16e
1285f4a2713aSLionel Sambuc// Purpose: Store Word rx (SP-Relative)
1286f4a2713aSLionel Sambuc// To store an SP-relative word to memory.
1287f4a2713aSLionel Sambuc//
1288f4a2713aSLionel Sambucdef SwRxSpImmX16: FEXT_RI16_SP_Store_explicit_ins
1289*0a6a1f1dSLionel Sambuc  <0b11010, "sw", II_SW>, MayStore;
1290f4a2713aSLionel Sambuc
1291f4a2713aSLionel Sambuc//
1292f4a2713aSLionel Sambuc//
1293f4a2713aSLionel Sambuc// Format: XOR rx, ry MIPS16e
1294f4a2713aSLionel Sambuc// Purpose: Xor
1295f4a2713aSLionel Sambuc// To do a bitwise logical XOR.
1296f4a2713aSLionel Sambuc//
1297f4a2713aSLionel Sambucdef XorRxRxRy16: FRxRxRy16_ins<0b01110, "xor", IIAlu>, ArithLogic16Defs<1>;
1298f4a2713aSLionel Sambuc
1299f4a2713aSLionel Sambucclass Mips16Pat<dag pattern, dag result> : Pat<pattern, result> {
1300f4a2713aSLionel Sambuc  let Predicates = [InMips16Mode];
1301f4a2713aSLionel Sambuc}
1302f4a2713aSLionel Sambuc
1303f4a2713aSLionel Sambuc// Unary Arith/Logic
1304f4a2713aSLionel Sambuc//
1305f4a2713aSLionel Sambucclass ArithLogicU_pat<PatFrag OpNode, Instruction I> :
1306f4a2713aSLionel Sambuc  Mips16Pat<(OpNode CPU16Regs:$r),
1307f4a2713aSLionel Sambuc            (I CPU16Regs:$r)>;
1308f4a2713aSLionel Sambuc
1309f4a2713aSLionel Sambucdef: ArithLogicU_pat<not, NotRxRy16>;
1310f4a2713aSLionel Sambucdef: ArithLogicU_pat<ineg, NegRxRy16>;
1311f4a2713aSLionel Sambuc
1312f4a2713aSLionel Sambucclass ArithLogic16_pat<SDNode OpNode, Instruction I> :
1313f4a2713aSLionel Sambuc  Mips16Pat<(OpNode CPU16Regs:$l, CPU16Regs:$r),
1314f4a2713aSLionel Sambuc            (I CPU16Regs:$l, CPU16Regs:$r)>;
1315f4a2713aSLionel Sambuc
1316f4a2713aSLionel Sambucdef: ArithLogic16_pat<add, AdduRxRyRz16>;
1317f4a2713aSLionel Sambucdef: ArithLogic16_pat<and, AndRxRxRy16>;
1318f4a2713aSLionel Sambucdef: ArithLogic16_pat<mul, MultRxRyRz16>;
1319f4a2713aSLionel Sambucdef: ArithLogic16_pat<or, OrRxRxRy16>;
1320f4a2713aSLionel Sambucdef: ArithLogic16_pat<sub, SubuRxRyRz16>;
1321f4a2713aSLionel Sambucdef: ArithLogic16_pat<xor, XorRxRxRy16>;
1322f4a2713aSLionel Sambuc
1323f4a2713aSLionel Sambuc// Arithmetic and logical instructions with 2 register operands.
1324f4a2713aSLionel Sambuc
1325f4a2713aSLionel Sambucclass ArithLogicI16_pat<SDNode OpNode, PatFrag imm_type, Instruction I> :
1326f4a2713aSLionel Sambuc  Mips16Pat<(OpNode CPU16Regs:$in, imm_type:$imm),
1327f4a2713aSLionel Sambuc            (I CPU16Regs:$in, imm_type:$imm)>;
1328f4a2713aSLionel Sambuc
1329f4a2713aSLionel Sambucdef: ArithLogicI16_pat<add, immSExt8, AddiuRxRxImm16>;
1330f4a2713aSLionel Sambucdef: ArithLogicI16_pat<add, immSExt16, AddiuRxRxImmX16>;
1331f4a2713aSLionel Sambucdef: ArithLogicI16_pat<shl, immZExt5, SllX16>;
1332f4a2713aSLionel Sambucdef: ArithLogicI16_pat<srl, immZExt5, SrlX16>;
1333f4a2713aSLionel Sambucdef: ArithLogicI16_pat<sra, immZExt5, SraX16>;
1334f4a2713aSLionel Sambuc
1335f4a2713aSLionel Sambucclass shift_rotate_reg16_pat<SDNode OpNode, Instruction I> :
1336f4a2713aSLionel Sambuc  Mips16Pat<(OpNode CPU16Regs:$r, CPU16Regs:$ra),
1337f4a2713aSLionel Sambuc            (I CPU16Regs:$r, CPU16Regs:$ra)>;
1338f4a2713aSLionel Sambuc
1339f4a2713aSLionel Sambucdef: shift_rotate_reg16_pat<shl, SllvRxRy16>;
1340f4a2713aSLionel Sambucdef: shift_rotate_reg16_pat<sra, SravRxRy16>;
1341f4a2713aSLionel Sambucdef: shift_rotate_reg16_pat<srl, SrlvRxRy16>;
1342f4a2713aSLionel Sambuc
1343f4a2713aSLionel Sambucclass LoadM16_pat<PatFrag OpNode, Instruction I> :
1344f4a2713aSLionel Sambuc  Mips16Pat<(OpNode addr16:$addr), (I addr16:$addr)>;
1345f4a2713aSLionel Sambuc
1346f4a2713aSLionel Sambucdef: LoadM16_pat<sextloadi8, LbRxRyOffMemX16>;
1347f4a2713aSLionel Sambucdef: LoadM16_pat<zextloadi8, LbuRxRyOffMemX16>;
1348f4a2713aSLionel Sambucdef: LoadM16_pat<sextloadi16, LhRxRyOffMemX16>;
1349f4a2713aSLionel Sambucdef: LoadM16_pat<zextloadi16, LhuRxRyOffMemX16>;
1350f4a2713aSLionel Sambucdef: LoadM16_pat<load, LwRxRyOffMemX16>;
1351f4a2713aSLionel Sambuc
1352f4a2713aSLionel Sambucclass StoreM16_pat<PatFrag OpNode, Instruction I> :
1353f4a2713aSLionel Sambuc  Mips16Pat<(OpNode CPU16Regs:$r, addr16:$addr),
1354f4a2713aSLionel Sambuc            (I CPU16Regs:$r, addr16:$addr)>;
1355f4a2713aSLionel Sambuc
1356f4a2713aSLionel Sambucdef: StoreM16_pat<truncstorei8, SbRxRyOffMemX16>;
1357f4a2713aSLionel Sambucdef: StoreM16_pat<truncstorei16, ShRxRyOffMemX16>;
1358f4a2713aSLionel Sambucdef: StoreM16_pat<store, SwRxRyOffMemX16>;
1359f4a2713aSLionel Sambuc
1360f4a2713aSLionel Sambuc// Unconditional branch
1361f4a2713aSLionel Sambucclass UncondBranch16_pat<SDNode OpNode, Instruction I>:
1362f4a2713aSLionel Sambuc  Mips16Pat<(OpNode bb:$imm16), (I bb:$imm16)> {
1363f4a2713aSLionel Sambuc    let Predicates = [InMips16Mode];
1364f4a2713aSLionel Sambuc  }
1365f4a2713aSLionel Sambuc
1366f4a2713aSLionel Sambucdef : Mips16Pat<(MipsJmpLink (i32 tglobaladdr:$dst)),
1367f4a2713aSLionel Sambuc                (Jal16 tglobaladdr:$dst)>;
1368f4a2713aSLionel Sambuc
1369f4a2713aSLionel Sambucdef : Mips16Pat<(MipsJmpLink (i32 texternalsym:$dst)),
1370f4a2713aSLionel Sambuc                (Jal16 texternalsym:$dst)>;
1371f4a2713aSLionel Sambuc
1372f4a2713aSLionel Sambuc// Indirect branch
1373*0a6a1f1dSLionel Sambucdef: Mips16Pat<(brind CPU16Regs:$rs), (JrcRx16 CPU16Regs:$rs)> {
1374*0a6a1f1dSLionel Sambuc  // Ensure that the addition of MIPS32r6/MIPS64r6 support does not change
1375*0a6a1f1dSLionel Sambuc  // MIPS16's behaviour.
1376*0a6a1f1dSLionel Sambuc  let AddedComplexity = 1;
1377*0a6a1f1dSLionel Sambuc}
1378f4a2713aSLionel Sambuc
1379f4a2713aSLionel Sambuc// Jump and Link (Call)
1380f4a2713aSLionel Sambuclet isCall=1, hasDelaySlot=0 in
1381f4a2713aSLionel Sambucdef JumpLinkReg16:
1382f4a2713aSLionel Sambuc  FRR16_JALRC<0, 0, 0, (outs), (ins CPU16Regs:$rs),
1383*0a6a1f1dSLionel Sambuc              "jalrc \t$rs", [(MipsJmpLink CPU16Regs:$rs)], IIBranch> {
1384*0a6a1f1dSLionel Sambuc  let Defs = [RA];
1385*0a6a1f1dSLionel Sambuc}
1386f4a2713aSLionel Sambuc
1387f4a2713aSLionel Sambuc// Mips16 pseudos
1388f4a2713aSLionel Sambuclet isReturn=1, isTerminator=1, hasDelaySlot=1, isBarrier=1, hasCtrlDep=1,
1389f4a2713aSLionel Sambuc  hasExtraSrcRegAllocReq = 1 in
1390f4a2713aSLionel Sambucdef RetRA16 : MipsPseudo16<(outs), (ins), "", [(MipsRet)]>;
1391f4a2713aSLionel Sambuc
1392f4a2713aSLionel Sambuc
1393f4a2713aSLionel Sambuc// setcc patterns
1394f4a2713aSLionel Sambuc
1395f4a2713aSLionel Sambucclass SetCC_R16<PatFrag cond_op, Instruction I>:
1396f4a2713aSLionel Sambuc  Mips16Pat<(cond_op CPU16Regs:$rx, CPU16Regs:$ry),
1397f4a2713aSLionel Sambuc            (I CPU16Regs:$rx, CPU16Regs:$ry)>;
1398f4a2713aSLionel Sambuc
1399f4a2713aSLionel Sambucclass SetCC_I16<PatFrag cond_op, PatLeaf imm_type, Instruction I>:
1400f4a2713aSLionel Sambuc  Mips16Pat<(cond_op CPU16Regs:$rx, imm_type:$imm16),
1401f4a2713aSLionel Sambuc            (I CPU16Regs:$rx, imm_type:$imm16)>;
1402f4a2713aSLionel Sambuc
1403f4a2713aSLionel Sambuc
1404f4a2713aSLionel Sambucdef: Mips16Pat<(i32  addr16:$addr),
1405f4a2713aSLionel Sambuc               (AddiuRxRyOffMemX16  addr16:$addr)>;
1406f4a2713aSLionel Sambuc
1407f4a2713aSLionel Sambuc
1408f4a2713aSLionel Sambuc// Large (>16 bit) immediate loads
1409f4a2713aSLionel Sambucdef : Mips16Pat<(i32 imm:$imm), (LwConstant32 imm:$imm, -1)>;
1410f4a2713aSLionel Sambuc
1411f4a2713aSLionel Sambuc// Carry MipsPatterns
1412f4a2713aSLionel Sambucdef : Mips16Pat<(subc CPU16Regs:$lhs, CPU16Regs:$rhs),
1413f4a2713aSLionel Sambuc                (SubuRxRyRz16 CPU16Regs:$lhs, CPU16Regs:$rhs)>;
1414f4a2713aSLionel Sambucdef : Mips16Pat<(addc CPU16Regs:$lhs, CPU16Regs:$rhs),
1415f4a2713aSLionel Sambuc                (AdduRxRyRz16 CPU16Regs:$lhs, CPU16Regs:$rhs)>;
1416f4a2713aSLionel Sambucdef : Mips16Pat<(addc  CPU16Regs:$src, immSExt16:$imm),
1417f4a2713aSLionel Sambuc                (AddiuRxRxImmX16 CPU16Regs:$src, imm:$imm)>;
1418f4a2713aSLionel Sambuc
1419f4a2713aSLionel Sambuc//
1420f4a2713aSLionel Sambuc// Some branch conditional patterns are not generated by llvm at this time.
1421f4a2713aSLionel Sambuc// Some are for seemingly arbitrary reasons not used: i.e. with signed number
1422f4a2713aSLionel Sambuc// comparison they are used and for unsigned a different pattern is used.
1423f4a2713aSLionel Sambuc// I am pushing upstream from the full mips16 port and it seemed that I needed
1424f4a2713aSLionel Sambuc// these earlier and the mips32 port has these but now I cannot create test
1425f4a2713aSLionel Sambuc// cases that use these patterns. While I sort this all out I will leave these
1426f4a2713aSLionel Sambuc// extra patterns commented out and if I can be sure they are really not used,
1427f4a2713aSLionel Sambuc// I will delete the code. I don't want to check the code in uncommented without
1428f4a2713aSLionel Sambuc// a valid test case. In some cases, the compiler is generating patterns with
1429f4a2713aSLionel Sambuc// setcc instead and earlier I had implemented setcc first so may have masked
1430f4a2713aSLionel Sambuc// the problem. The setcc variants are suboptimal for mips16 so I may wantto
1431f4a2713aSLionel Sambuc// figure out how to enable the brcond patterns or else possibly new
1432f4a2713aSLionel Sambuc// combinations of of brcond and setcc.
1433f4a2713aSLionel Sambuc//
1434f4a2713aSLionel Sambuc//
1435f4a2713aSLionel Sambuc// bcond-seteq
1436f4a2713aSLionel Sambuc//
1437f4a2713aSLionel Sambucdef: Mips16Pat
1438f4a2713aSLionel Sambuc  <(brcond (i32 (seteq CPU16Regs:$rx, CPU16Regs:$ry)), bb:$imm16),
1439f4a2713aSLionel Sambuc   (BteqzT8CmpX16 CPU16Regs:$rx, CPU16Regs:$ry,  bb:$imm16)
1440f4a2713aSLionel Sambuc  >;
1441f4a2713aSLionel Sambuc
1442f4a2713aSLionel Sambuc
1443f4a2713aSLionel Sambucdef: Mips16Pat
1444f4a2713aSLionel Sambuc  <(brcond (i32 (seteq CPU16Regs:$rx, immZExt16:$imm)), bb:$targ16),
1445f4a2713aSLionel Sambuc   (BteqzT8CmpiX16 CPU16Regs:$rx, immSExt16:$imm,  bb:$targ16)
1446f4a2713aSLionel Sambuc  >;
1447f4a2713aSLionel Sambuc
1448f4a2713aSLionel Sambucdef: Mips16Pat
1449f4a2713aSLionel Sambuc  <(brcond (i32 (seteq CPU16Regs:$rx, 0)), bb:$targ16),
1450f4a2713aSLionel Sambuc   (BeqzRxImm16 CPU16Regs:$rx, bb:$targ16)
1451f4a2713aSLionel Sambuc  >;
1452f4a2713aSLionel Sambuc
1453f4a2713aSLionel Sambuc//
1454f4a2713aSLionel Sambuc// bcond-setgt (do we need to have this pair of setlt, setgt??)
1455f4a2713aSLionel Sambuc//
1456f4a2713aSLionel Sambucdef: Mips16Pat
1457f4a2713aSLionel Sambuc  <(brcond (i32 (setgt CPU16Regs:$rx, CPU16Regs:$ry)), bb:$imm16),
1458f4a2713aSLionel Sambuc   (BtnezT8SltX16 CPU16Regs:$ry, CPU16Regs:$rx,  bb:$imm16)
1459f4a2713aSLionel Sambuc  >;
1460f4a2713aSLionel Sambuc
1461f4a2713aSLionel Sambuc//
1462f4a2713aSLionel Sambuc// bcond-setge
1463f4a2713aSLionel Sambuc//
1464f4a2713aSLionel Sambucdef: Mips16Pat
1465f4a2713aSLionel Sambuc  <(brcond (i32 (setge CPU16Regs:$rx, CPU16Regs:$ry)), bb:$imm16),
1466f4a2713aSLionel Sambuc   (BteqzT8SltX16 CPU16Regs:$rx, CPU16Regs:$ry,  bb:$imm16)
1467f4a2713aSLionel Sambuc  >;
1468f4a2713aSLionel Sambuc
1469f4a2713aSLionel Sambuc//
1470f4a2713aSLionel Sambuc// never called because compiler transforms a >= k to a > (k-1)
1471f4a2713aSLionel Sambucdef: Mips16Pat
1472f4a2713aSLionel Sambuc  <(brcond (i32 (setge CPU16Regs:$rx, immSExt16:$imm)), bb:$imm16),
1473f4a2713aSLionel Sambuc   (BteqzT8SltiX16 CPU16Regs:$rx, immSExt16:$imm,  bb:$imm16)
1474f4a2713aSLionel Sambuc  >;
1475f4a2713aSLionel Sambuc
1476f4a2713aSLionel Sambuc//
1477f4a2713aSLionel Sambuc// bcond-setlt
1478f4a2713aSLionel Sambuc//
1479f4a2713aSLionel Sambucdef: Mips16Pat
1480f4a2713aSLionel Sambuc  <(brcond (i32 (setlt CPU16Regs:$rx, CPU16Regs:$ry)), bb:$imm16),
1481f4a2713aSLionel Sambuc   (BtnezT8SltX16 CPU16Regs:$rx, CPU16Regs:$ry,  bb:$imm16)
1482f4a2713aSLionel Sambuc  >;
1483f4a2713aSLionel Sambuc
1484f4a2713aSLionel Sambucdef: Mips16Pat
1485f4a2713aSLionel Sambuc  <(brcond (i32 (setlt CPU16Regs:$rx, immSExt16:$imm)), bb:$imm16),
1486f4a2713aSLionel Sambuc   (BtnezT8SltiX16 CPU16Regs:$rx, immSExt16:$imm,  bb:$imm16)
1487f4a2713aSLionel Sambuc  >;
1488f4a2713aSLionel Sambuc
1489f4a2713aSLionel Sambuc//
1490f4a2713aSLionel Sambuc// bcond-setle
1491f4a2713aSLionel Sambuc//
1492f4a2713aSLionel Sambucdef: Mips16Pat
1493f4a2713aSLionel Sambuc  <(brcond (i32 (setle CPU16Regs:$rx, CPU16Regs:$ry)), bb:$imm16),
1494f4a2713aSLionel Sambuc   (BteqzT8SltX16 CPU16Regs:$ry, CPU16Regs:$rx,  bb:$imm16)
1495f4a2713aSLionel Sambuc  >;
1496f4a2713aSLionel Sambuc
1497f4a2713aSLionel Sambuc//
1498f4a2713aSLionel Sambuc// bcond-setne
1499f4a2713aSLionel Sambuc//
1500f4a2713aSLionel Sambucdef: Mips16Pat
1501f4a2713aSLionel Sambuc  <(brcond (i32 (setne CPU16Regs:$rx, CPU16Regs:$ry)), bb:$imm16),
1502f4a2713aSLionel Sambuc   (BtnezT8CmpX16 CPU16Regs:$rx, CPU16Regs:$ry,  bb:$imm16)
1503f4a2713aSLionel Sambuc  >;
1504f4a2713aSLionel Sambuc
1505f4a2713aSLionel Sambucdef: Mips16Pat
1506f4a2713aSLionel Sambuc  <(brcond (i32 (setne CPU16Regs:$rx, immZExt16:$imm)), bb:$targ16),
1507f4a2713aSLionel Sambuc   (BtnezT8CmpiX16 CPU16Regs:$rx, immSExt16:$imm,  bb:$targ16)
1508f4a2713aSLionel Sambuc  >;
1509f4a2713aSLionel Sambuc
1510f4a2713aSLionel Sambucdef: Mips16Pat
1511f4a2713aSLionel Sambuc  <(brcond (i32 (setne CPU16Regs:$rx, 0)), bb:$targ16),
1512f4a2713aSLionel Sambuc   (BnezRxImm16 CPU16Regs:$rx, bb:$targ16)
1513f4a2713aSLionel Sambuc  >;
1514f4a2713aSLionel Sambuc
1515f4a2713aSLionel Sambuc//
1516f4a2713aSLionel Sambuc// This needs to be there but I forget which code will generate it
1517f4a2713aSLionel Sambuc//
1518f4a2713aSLionel Sambucdef: Mips16Pat
1519f4a2713aSLionel Sambuc  <(brcond CPU16Regs:$rx, bb:$targ16),
1520f4a2713aSLionel Sambuc   (BnezRxImm16 CPU16Regs:$rx, bb:$targ16)
1521f4a2713aSLionel Sambuc  >;
1522f4a2713aSLionel Sambuc
1523f4a2713aSLionel Sambuc//
1524f4a2713aSLionel Sambuc
1525f4a2713aSLionel Sambuc//
1526f4a2713aSLionel Sambuc// bcond-setugt
1527f4a2713aSLionel Sambuc//
1528f4a2713aSLionel Sambuc//def: Mips16Pat
1529f4a2713aSLionel Sambuc//  <(brcond (i32 (setugt CPU16Regs:$rx, CPU16Regs:$ry)), bb:$imm16),
1530f4a2713aSLionel Sambuc//   (BtnezT8SltuX16 CPU16Regs:$ry, CPU16Regs:$rx,  bb:$imm16)
1531f4a2713aSLionel Sambuc//  >;
1532f4a2713aSLionel Sambuc
1533f4a2713aSLionel Sambuc//
1534f4a2713aSLionel Sambuc// bcond-setuge
1535f4a2713aSLionel Sambuc//
1536f4a2713aSLionel Sambuc//def: Mips16Pat
1537f4a2713aSLionel Sambuc//  <(brcond (i32 (setuge CPU16Regs:$rx, CPU16Regs:$ry)), bb:$imm16),
1538f4a2713aSLionel Sambuc//   (BteqzT8SltuX16 CPU16Regs:$rx, CPU16Regs:$ry,  bb:$imm16)
1539f4a2713aSLionel Sambuc//  >;
1540f4a2713aSLionel Sambuc
1541f4a2713aSLionel Sambuc
1542f4a2713aSLionel Sambuc//
1543f4a2713aSLionel Sambuc// bcond-setult
1544f4a2713aSLionel Sambuc//
1545f4a2713aSLionel Sambuc//def: Mips16Pat
1546f4a2713aSLionel Sambuc//  <(brcond (i32 (setult CPU16Regs:$rx, CPU16Regs:$ry)), bb:$imm16),
1547f4a2713aSLionel Sambuc//   (BtnezT8SltuX16 CPU16Regs:$rx, CPU16Regs:$ry,  bb:$imm16)
1548f4a2713aSLionel Sambuc//  >;
1549f4a2713aSLionel Sambuc
1550f4a2713aSLionel Sambucdef: UncondBranch16_pat<br, Bimm16>;
1551f4a2713aSLionel Sambuc
1552f4a2713aSLionel Sambuc// Small immediates
1553f4a2713aSLionel Sambucdef: Mips16Pat<(i32 immSExt16:$in),
1554f4a2713aSLionel Sambuc               (AddiuRxRxImmX16 (Move32R16 ZERO), immSExt16:$in)>;
1555f4a2713aSLionel Sambuc
1556f4a2713aSLionel Sambucdef: Mips16Pat<(i32 immZExt16:$in), (LiRxImmX16 immZExt16:$in)>;
1557f4a2713aSLionel Sambuc
1558f4a2713aSLionel Sambuc//
1559f4a2713aSLionel Sambuc// MipsDivRem
1560f4a2713aSLionel Sambuc//
1561f4a2713aSLionel Sambucdef: Mips16Pat
1562f4a2713aSLionel Sambuc  <(MipsDivRem16 CPU16Regs:$rx, CPU16Regs:$ry),
1563f4a2713aSLionel Sambuc   (DivRxRy16 CPU16Regs:$rx, CPU16Regs:$ry)>;
1564f4a2713aSLionel Sambuc
1565f4a2713aSLionel Sambuc//
1566f4a2713aSLionel Sambuc// MipsDivRemU
1567f4a2713aSLionel Sambuc//
1568f4a2713aSLionel Sambucdef: Mips16Pat
1569f4a2713aSLionel Sambuc  <(MipsDivRemU16 CPU16Regs:$rx, CPU16Regs:$ry),
1570f4a2713aSLionel Sambuc   (DivuRxRy16 CPU16Regs:$rx, CPU16Regs:$ry)>;
1571f4a2713aSLionel Sambuc
1572f4a2713aSLionel Sambuc//  signed a,b
1573f4a2713aSLionel Sambuc//  x = (a>=b)?x:y
1574f4a2713aSLionel Sambuc//
1575f4a2713aSLionel Sambuc//  if !(a < b) x = y
1576f4a2713aSLionel Sambuc//
1577f4a2713aSLionel Sambucdef : Mips16Pat<(select (i32 (setge CPU16Regs:$a, CPU16Regs:$b)),
1578f4a2713aSLionel Sambuc                 CPU16Regs:$x, CPU16Regs:$y),
1579f4a2713aSLionel Sambuc                (SelTBteqZSlt CPU16Regs:$x, CPU16Regs:$y,
1580f4a2713aSLionel Sambuc                 CPU16Regs:$a, CPU16Regs:$b)>;
1581f4a2713aSLionel Sambuc
1582f4a2713aSLionel Sambuc//  signed a,b
1583f4a2713aSLionel Sambuc//  x = (a>b)?x:y
1584f4a2713aSLionel Sambuc//
1585f4a2713aSLionel Sambuc//  if  (b < a) x = y
1586f4a2713aSLionel Sambuc//
1587f4a2713aSLionel Sambucdef : Mips16Pat<(select (i32 (setgt CPU16Regs:$a, CPU16Regs:$b)),
1588f4a2713aSLionel Sambuc                 CPU16Regs:$x, CPU16Regs:$y),
1589f4a2713aSLionel Sambuc                (SelTBtneZSlt CPU16Regs:$x, CPU16Regs:$y,
1590f4a2713aSLionel Sambuc                 CPU16Regs:$b, CPU16Regs:$a)>;
1591f4a2713aSLionel Sambuc
1592f4a2713aSLionel Sambuc// unsigned a,b
1593f4a2713aSLionel Sambuc// x = (a>=b)?x:y
1594f4a2713aSLionel Sambuc//
1595f4a2713aSLionel Sambuc// if !(a < b) x = y;
1596f4a2713aSLionel Sambuc//
1597f4a2713aSLionel Sambucdef : Mips16Pat<
1598f4a2713aSLionel Sambuc  (select (i32 (setuge CPU16Regs:$a, CPU16Regs:$b)),
1599f4a2713aSLionel Sambuc   CPU16Regs:$x, CPU16Regs:$y),
1600f4a2713aSLionel Sambuc  (SelTBteqZSltu CPU16Regs:$x, CPU16Regs:$y,
1601f4a2713aSLionel Sambuc   CPU16Regs:$a, CPU16Regs:$b)>;
1602f4a2713aSLionel Sambuc
1603f4a2713aSLionel Sambuc//  unsigned a,b
1604f4a2713aSLionel Sambuc//  x = (a>b)?x:y
1605f4a2713aSLionel Sambuc//
1606f4a2713aSLionel Sambuc//  if (b < a) x = y
1607f4a2713aSLionel Sambuc//
1608f4a2713aSLionel Sambucdef : Mips16Pat<(select (i32 (setugt CPU16Regs:$a, CPU16Regs:$b)),
1609f4a2713aSLionel Sambuc                 CPU16Regs:$x, CPU16Regs:$y),
1610f4a2713aSLionel Sambuc                (SelTBtneZSltu CPU16Regs:$x, CPU16Regs:$y,
1611f4a2713aSLionel Sambuc                 CPU16Regs:$b, CPU16Regs:$a)>;
1612f4a2713aSLionel Sambuc
1613f4a2713aSLionel Sambuc// signed
1614f4a2713aSLionel Sambuc// x = (a >= k)?x:y
1615f4a2713aSLionel Sambuc// due to an llvm optimization, i don't think that this will ever
1616f4a2713aSLionel Sambuc// be used. This is transformed into x = (a > k-1)?x:y
1617f4a2713aSLionel Sambuc//
1618f4a2713aSLionel Sambuc//
1619f4a2713aSLionel Sambuc
1620f4a2713aSLionel Sambuc//def : Mips16Pat<
1621f4a2713aSLionel Sambuc//  (select (i32 (setge CPU16Regs:$lhs, immSExt16:$rhs)),
1622f4a2713aSLionel Sambuc//   CPU16Regs:$T, CPU16Regs:$F),
1623f4a2713aSLionel Sambuc//  (SelTBteqZSlti CPU16Regs:$T, CPU16Regs:$F,
1624f4a2713aSLionel Sambuc//   CPU16Regs:$lhs, immSExt16:$rhs)>;
1625f4a2713aSLionel Sambuc
1626f4a2713aSLionel Sambuc//def : Mips16Pat<
1627f4a2713aSLionel Sambuc//  (select (i32 (setuge CPU16Regs:$lhs, immSExt16:$rhs)),
1628f4a2713aSLionel Sambuc//   CPU16Regs:$T, CPU16Regs:$F),
1629f4a2713aSLionel Sambuc//  (SelTBteqZSltiu CPU16Regs:$T, CPU16Regs:$F,
1630f4a2713aSLionel Sambuc//   CPU16Regs:$lhs, immSExt16:$rhs)>;
1631f4a2713aSLionel Sambuc
1632f4a2713aSLionel Sambuc// signed
1633f4a2713aSLionel Sambuc// x = (a < k)?x:y
1634f4a2713aSLionel Sambuc//
1635f4a2713aSLionel Sambuc// if !(a < k) x = y;
1636f4a2713aSLionel Sambuc//
1637f4a2713aSLionel Sambucdef : Mips16Pat<
1638f4a2713aSLionel Sambuc  (select (i32 (setlt CPU16Regs:$a, immSExt16:$b)),
1639f4a2713aSLionel Sambuc   CPU16Regs:$x, CPU16Regs:$y),
1640f4a2713aSLionel Sambuc  (SelTBtneZSlti CPU16Regs:$x, CPU16Regs:$y,
1641f4a2713aSLionel Sambuc   CPU16Regs:$a, immSExt16:$b)>;
1642f4a2713aSLionel Sambuc
1643f4a2713aSLionel Sambuc
1644f4a2713aSLionel Sambuc//
1645f4a2713aSLionel Sambuc//
1646f4a2713aSLionel Sambuc// signed
1647f4a2713aSLionel Sambuc// x = (a <= b)? x : y
1648f4a2713aSLionel Sambuc//
1649f4a2713aSLionel Sambuc// if  (b < a) x = y
1650f4a2713aSLionel Sambuc//
1651f4a2713aSLionel Sambucdef : Mips16Pat<(select (i32 (setle CPU16Regs:$a, CPU16Regs:$b)),
1652f4a2713aSLionel Sambuc                 CPU16Regs:$x, CPU16Regs:$y),
1653f4a2713aSLionel Sambuc                (SelTBteqZSlt CPU16Regs:$x, CPU16Regs:$y,
1654f4a2713aSLionel Sambuc                 CPU16Regs:$b, CPU16Regs:$a)>;
1655f4a2713aSLionel Sambuc
1656f4a2713aSLionel Sambuc//
1657f4a2713aSLionel Sambuc// unnsigned
1658f4a2713aSLionel Sambuc// x = (a <= b)? x : y
1659f4a2713aSLionel Sambuc//
1660f4a2713aSLionel Sambuc// if  (b < a) x = y
1661f4a2713aSLionel Sambuc//
1662f4a2713aSLionel Sambucdef : Mips16Pat<(select (i32 (setule CPU16Regs:$a, CPU16Regs:$b)),
1663f4a2713aSLionel Sambuc                 CPU16Regs:$x, CPU16Regs:$y),
1664f4a2713aSLionel Sambuc                (SelTBteqZSltu CPU16Regs:$x, CPU16Regs:$y,
1665f4a2713aSLionel Sambuc                 CPU16Regs:$b, CPU16Regs:$a)>;
1666f4a2713aSLionel Sambuc
1667f4a2713aSLionel Sambuc//
1668f4a2713aSLionel Sambuc// signed/unsigned
1669f4a2713aSLionel Sambuc// x = (a == b)? x : y
1670f4a2713aSLionel Sambuc//
1671f4a2713aSLionel Sambuc// if (a != b) x = y
1672f4a2713aSLionel Sambuc//
1673f4a2713aSLionel Sambucdef : Mips16Pat<(select (i32 (seteq CPU16Regs:$a, CPU16Regs:$b)),
1674f4a2713aSLionel Sambuc                 CPU16Regs:$x, CPU16Regs:$y),
1675f4a2713aSLionel Sambuc                (SelTBteqZCmp CPU16Regs:$x, CPU16Regs:$y,
1676f4a2713aSLionel Sambuc                 CPU16Regs:$b, CPU16Regs:$a)>;
1677f4a2713aSLionel Sambuc
1678f4a2713aSLionel Sambuc//
1679f4a2713aSLionel Sambuc// signed/unsigned
1680f4a2713aSLionel Sambuc// x = (a == 0)? x : y
1681f4a2713aSLionel Sambuc//
1682f4a2713aSLionel Sambuc// if (a != 0) x = y
1683f4a2713aSLionel Sambuc//
1684f4a2713aSLionel Sambucdef : Mips16Pat<(select (i32 (seteq CPU16Regs:$a, 0)),
1685f4a2713aSLionel Sambuc                 CPU16Regs:$x, CPU16Regs:$y),
1686f4a2713aSLionel Sambuc                (SelBeqZ CPU16Regs:$x, CPU16Regs:$y,
1687f4a2713aSLionel Sambuc                 CPU16Regs:$a)>;
1688f4a2713aSLionel Sambuc
1689f4a2713aSLionel Sambuc
1690f4a2713aSLionel Sambuc//
1691f4a2713aSLionel Sambuc// signed/unsigned
1692f4a2713aSLionel Sambuc// x = (a == k)? x : y
1693f4a2713aSLionel Sambuc//
1694f4a2713aSLionel Sambuc// if (a != k) x = y
1695f4a2713aSLionel Sambuc//
1696f4a2713aSLionel Sambucdef : Mips16Pat<(select (i32 (seteq CPU16Regs:$a, immZExt16:$k)),
1697f4a2713aSLionel Sambuc                 CPU16Regs:$x, CPU16Regs:$y),
1698f4a2713aSLionel Sambuc                (SelTBteqZCmpi CPU16Regs:$x, CPU16Regs:$y,
1699f4a2713aSLionel Sambuc                 CPU16Regs:$a, immZExt16:$k)>;
1700f4a2713aSLionel Sambuc
1701f4a2713aSLionel Sambuc
1702f4a2713aSLionel Sambuc//
1703f4a2713aSLionel Sambuc// signed/unsigned
1704f4a2713aSLionel Sambuc// x = (a != b)? x : y
1705f4a2713aSLionel Sambuc//
1706f4a2713aSLionel Sambuc// if (a == b) x = y
1707f4a2713aSLionel Sambuc//
1708f4a2713aSLionel Sambuc//
1709f4a2713aSLionel Sambucdef : Mips16Pat<(select (i32 (setne CPU16Regs:$a, CPU16Regs:$b)),
1710f4a2713aSLionel Sambuc                 CPU16Regs:$x, CPU16Regs:$y),
1711f4a2713aSLionel Sambuc                (SelTBtneZCmp CPU16Regs:$x, CPU16Regs:$y,
1712f4a2713aSLionel Sambuc                 CPU16Regs:$b, CPU16Regs:$a)>;
1713f4a2713aSLionel Sambuc
1714f4a2713aSLionel Sambuc//
1715f4a2713aSLionel Sambuc// signed/unsigned
1716f4a2713aSLionel Sambuc// x = (a != 0)? x : y
1717f4a2713aSLionel Sambuc//
1718f4a2713aSLionel Sambuc// if (a == 0) x = y
1719f4a2713aSLionel Sambuc//
1720f4a2713aSLionel Sambucdef : Mips16Pat<(select (i32 (setne CPU16Regs:$a, 0)),
1721f4a2713aSLionel Sambuc                 CPU16Regs:$x, CPU16Regs:$y),
1722f4a2713aSLionel Sambuc                (SelBneZ CPU16Regs:$x, CPU16Regs:$y,
1723f4a2713aSLionel Sambuc                 CPU16Regs:$a)>;
1724f4a2713aSLionel Sambuc
1725f4a2713aSLionel Sambuc// signed/unsigned
1726f4a2713aSLionel Sambuc// x = (a)? x : y
1727f4a2713aSLionel Sambuc//
1728f4a2713aSLionel Sambuc// if (!a) x = y
1729f4a2713aSLionel Sambuc//
1730f4a2713aSLionel Sambucdef : Mips16Pat<(select  CPU16Regs:$a,
1731f4a2713aSLionel Sambuc                 CPU16Regs:$x, CPU16Regs:$y),
1732f4a2713aSLionel Sambuc      (SelBneZ CPU16Regs:$x, CPU16Regs:$y,
1733f4a2713aSLionel Sambuc       CPU16Regs:$a)>;
1734f4a2713aSLionel Sambuc
1735f4a2713aSLionel Sambuc
1736f4a2713aSLionel Sambuc//
1737f4a2713aSLionel Sambuc// signed/unsigned
1738f4a2713aSLionel Sambuc// x = (a != k)? x : y
1739f4a2713aSLionel Sambuc//
1740f4a2713aSLionel Sambuc// if (a == k) x = y
1741f4a2713aSLionel Sambuc//
1742f4a2713aSLionel Sambucdef : Mips16Pat<(select (i32 (setne CPU16Regs:$a, immZExt16:$k)),
1743f4a2713aSLionel Sambuc                 CPU16Regs:$x, CPU16Regs:$y),
1744f4a2713aSLionel Sambuc                (SelTBtneZCmpi CPU16Regs:$x, CPU16Regs:$y,
1745f4a2713aSLionel Sambuc                 CPU16Regs:$a, immZExt16:$k)>;
1746f4a2713aSLionel Sambuc
1747f4a2713aSLionel Sambuc//
1748f4a2713aSLionel Sambuc// When writing C code to test setxx these patterns,
1749f4a2713aSLionel Sambuc// some will be transformed into
1750f4a2713aSLionel Sambuc// other things. So we test using C code but using -O3 and -O0
1751f4a2713aSLionel Sambuc//
1752f4a2713aSLionel Sambuc// seteq
1753f4a2713aSLionel Sambuc//
1754f4a2713aSLionel Sambucdef : Mips16Pat
1755f4a2713aSLionel Sambuc  <(seteq CPU16Regs:$lhs,CPU16Regs:$rhs),
1756f4a2713aSLionel Sambuc   (SltiuCCRxImmX16 (XorRxRxRy16 CPU16Regs:$lhs, CPU16Regs:$rhs), 1)>;
1757f4a2713aSLionel Sambuc
1758f4a2713aSLionel Sambucdef : Mips16Pat
1759f4a2713aSLionel Sambuc  <(seteq CPU16Regs:$lhs, 0),
1760f4a2713aSLionel Sambuc   (SltiuCCRxImmX16 CPU16Regs:$lhs, 1)>;
1761f4a2713aSLionel Sambuc
1762f4a2713aSLionel Sambuc
1763f4a2713aSLionel Sambuc//
1764f4a2713aSLionel Sambuc// setge
1765f4a2713aSLionel Sambuc//
1766f4a2713aSLionel Sambuc
1767f4a2713aSLionel Sambucdef: Mips16Pat
1768f4a2713aSLionel Sambuc  <(setge CPU16Regs:$lhs, CPU16Regs:$rhs),
1769f4a2713aSLionel Sambuc   (XorRxRxRy16 (SltCCRxRy16 CPU16Regs:$lhs, CPU16Regs:$rhs),
1770f4a2713aSLionel Sambuc   (LiRxImmX16 1))>;
1771f4a2713aSLionel Sambuc
1772f4a2713aSLionel Sambuc//
1773f4a2713aSLionel Sambuc// For constants, llvm transforms this to:
1774f4a2713aSLionel Sambuc// x > (k - 1) and then reverses the operands to use setlt. So this pattern
1775f4a2713aSLionel Sambuc// is not used now by the compiler. (Presumably checking that k-1 does not
1776*0a6a1f1dSLionel Sambuc// overflow). The compiler never uses this at the current time, due to
1777f4a2713aSLionel Sambuc// other optimizations.
1778f4a2713aSLionel Sambuc//
1779f4a2713aSLionel Sambuc//def: Mips16Pat
1780f4a2713aSLionel Sambuc//  <(setge CPU16Regs:$lhs, immSExt16:$rhs),
1781f4a2713aSLionel Sambuc//   (XorRxRxRy16 (SltiCCRxImmX16 CPU16Regs:$lhs, immSExt16:$rhs),
1782f4a2713aSLionel Sambuc//   (LiRxImmX16 1))>;
1783f4a2713aSLionel Sambuc
1784f4a2713aSLionel Sambuc// This catches the x >= -32768 case by transforming it to  x > -32769
1785f4a2713aSLionel Sambuc//
1786f4a2713aSLionel Sambucdef: Mips16Pat
1787f4a2713aSLionel Sambuc  <(setgt CPU16Regs:$lhs, -32769),
1788f4a2713aSLionel Sambuc   (XorRxRxRy16 (SltiCCRxImmX16 CPU16Regs:$lhs, -32768),
1789f4a2713aSLionel Sambuc   (LiRxImmX16 1))>;
1790f4a2713aSLionel Sambuc
1791f4a2713aSLionel Sambuc//
1792f4a2713aSLionel Sambuc// setgt
1793f4a2713aSLionel Sambuc//
1794f4a2713aSLionel Sambuc//
1795f4a2713aSLionel Sambuc
1796f4a2713aSLionel Sambucdef: Mips16Pat
1797f4a2713aSLionel Sambuc  <(setgt CPU16Regs:$lhs, CPU16Regs:$rhs),
1798f4a2713aSLionel Sambuc   (SltCCRxRy16 CPU16Regs:$rhs, CPU16Regs:$lhs)>;
1799f4a2713aSLionel Sambuc
1800f4a2713aSLionel Sambuc//
1801f4a2713aSLionel Sambuc// setle
1802f4a2713aSLionel Sambuc//
1803f4a2713aSLionel Sambucdef: Mips16Pat
1804f4a2713aSLionel Sambuc  <(setle CPU16Regs:$lhs, CPU16Regs:$rhs),
1805f4a2713aSLionel Sambuc   (XorRxRxRy16 (SltCCRxRy16 CPU16Regs:$rhs, CPU16Regs:$lhs), (LiRxImm16 1))>;
1806f4a2713aSLionel Sambuc
1807f4a2713aSLionel Sambuc//
1808f4a2713aSLionel Sambuc// setlt
1809f4a2713aSLionel Sambuc//
1810f4a2713aSLionel Sambucdef: SetCC_R16<setlt, SltCCRxRy16>;
1811f4a2713aSLionel Sambuc
1812f4a2713aSLionel Sambucdef: SetCC_I16<setlt, immSExt16, SltiCCRxImmX16>;
1813f4a2713aSLionel Sambuc
1814f4a2713aSLionel Sambuc//
1815f4a2713aSLionel Sambuc// setne
1816f4a2713aSLionel Sambuc//
1817f4a2713aSLionel Sambucdef : Mips16Pat
1818f4a2713aSLionel Sambuc  <(setne CPU16Regs:$lhs,CPU16Regs:$rhs),
1819f4a2713aSLionel Sambuc   (SltuCCRxRy16 (LiRxImmX16 0),
1820f4a2713aSLionel Sambuc   (XorRxRxRy16 CPU16Regs:$lhs, CPU16Regs:$rhs))>;
1821f4a2713aSLionel Sambuc
1822f4a2713aSLionel Sambuc
1823f4a2713aSLionel Sambuc//
1824f4a2713aSLionel Sambuc// setuge
1825f4a2713aSLionel Sambuc//
1826f4a2713aSLionel Sambucdef: Mips16Pat
1827f4a2713aSLionel Sambuc  <(setuge CPU16Regs:$lhs, CPU16Regs:$rhs),
1828f4a2713aSLionel Sambuc   (XorRxRxRy16 (SltuCCRxRy16 CPU16Regs:$lhs, CPU16Regs:$rhs),
1829f4a2713aSLionel Sambuc   (LiRxImmX16 1))>;
1830f4a2713aSLionel Sambuc
1831f4a2713aSLionel Sambuc// this pattern will never be used because the compiler will transform
1832f4a2713aSLionel Sambuc// x >= k to x > (k - 1) and then use SLT
1833f4a2713aSLionel Sambuc//
1834f4a2713aSLionel Sambuc//def: Mips16Pat
1835f4a2713aSLionel Sambuc//  <(setuge CPU16Regs:$lhs, immZExt16:$rhs),
1836f4a2713aSLionel Sambuc//   (XorRxRxRy16 (SltiuCCRxImmX16 CPU16Regs:$lhs, immZExt16:$rhs),
1837f4a2713aSLionel Sambuc//   (LiRxImmX16 1))>;
1838f4a2713aSLionel Sambuc
1839f4a2713aSLionel Sambuc//
1840f4a2713aSLionel Sambuc// setugt
1841f4a2713aSLionel Sambuc//
1842f4a2713aSLionel Sambucdef: Mips16Pat
1843f4a2713aSLionel Sambuc  <(setugt CPU16Regs:$lhs, CPU16Regs:$rhs),
1844f4a2713aSLionel Sambuc   (SltuCCRxRy16 CPU16Regs:$rhs, CPU16Regs:$lhs)>;
1845f4a2713aSLionel Sambuc
1846f4a2713aSLionel Sambuc//
1847f4a2713aSLionel Sambuc// setule
1848f4a2713aSLionel Sambuc//
1849f4a2713aSLionel Sambucdef: Mips16Pat
1850f4a2713aSLionel Sambuc  <(setule CPU16Regs:$lhs, CPU16Regs:$rhs),
1851f4a2713aSLionel Sambuc   (XorRxRxRy16 (SltuCCRxRy16 CPU16Regs:$rhs, CPU16Regs:$lhs), (LiRxImmX16 1))>;
1852f4a2713aSLionel Sambuc
1853f4a2713aSLionel Sambuc//
1854f4a2713aSLionel Sambuc// setult
1855f4a2713aSLionel Sambuc//
1856f4a2713aSLionel Sambucdef: SetCC_R16<setult, SltuCCRxRy16>;
1857f4a2713aSLionel Sambuc
1858f4a2713aSLionel Sambucdef: SetCC_I16<setult, immSExt16, SltiuCCRxImmX16>;
1859f4a2713aSLionel Sambuc
1860f4a2713aSLionel Sambucdef: Mips16Pat<(add CPU16Regs:$hi, (MipsLo tglobaladdr:$lo)),
1861f4a2713aSLionel Sambuc               (AddiuRxRxImmX16 CPU16Regs:$hi, tglobaladdr:$lo)>;
1862f4a2713aSLionel Sambuc
1863f4a2713aSLionel Sambuc// hi/lo relocs
1864f4a2713aSLionel Sambucdef : Mips16Pat<(MipsHi tblockaddress:$in),
1865f4a2713aSLionel Sambuc                (SllX16 (LiRxImmX16 tblockaddress:$in), 16)>;
1866f4a2713aSLionel Sambucdef : Mips16Pat<(MipsHi tglobaladdr:$in),
1867f4a2713aSLionel Sambuc                (SllX16 (LiRxImmX16 tglobaladdr:$in), 16)>;
1868f4a2713aSLionel Sambucdef : Mips16Pat<(MipsHi tjumptable:$in),
1869f4a2713aSLionel Sambuc                (SllX16 (LiRxImmX16 tjumptable:$in), 16)>;
1870f4a2713aSLionel Sambucdef : Mips16Pat<(MipsHi tglobaltlsaddr:$in),
1871f4a2713aSLionel Sambuc                (SllX16 (LiRxImmX16 tglobaltlsaddr:$in), 16)>;
1872f4a2713aSLionel Sambuc
1873f4a2713aSLionel Sambucdef : Mips16Pat<(MipsLo tblockaddress:$in), (LiRxImmX16 tblockaddress:$in)>;
1874f4a2713aSLionel Sambuc
1875f4a2713aSLionel Sambuc// wrapper_pic
1876f4a2713aSLionel Sambucclass Wrapper16Pat<SDNode node, Instruction ADDiuOp, RegisterClass RC>:
1877f4a2713aSLionel Sambuc  Mips16Pat<(MipsWrapper RC:$gp, node:$in),
1878f4a2713aSLionel Sambuc            (ADDiuOp RC:$gp, node:$in)>;
1879f4a2713aSLionel Sambuc
1880f4a2713aSLionel Sambuc
1881f4a2713aSLionel Sambucdef : Wrapper16Pat<tglobaladdr, AddiuRxRxImmX16, CPU16Regs>;
1882f4a2713aSLionel Sambucdef : Wrapper16Pat<tglobaltlsaddr, AddiuRxRxImmX16, CPU16Regs>;
1883f4a2713aSLionel Sambuc
1884f4a2713aSLionel Sambucdef : Mips16Pat<(i32 (extloadi8   addr16:$src)),
1885f4a2713aSLionel Sambuc                (LbuRxRyOffMemX16  addr16:$src)>;
1886f4a2713aSLionel Sambucdef : Mips16Pat<(i32 (extloadi16  addr16:$src)),
1887f4a2713aSLionel Sambuc                (LhuRxRyOffMemX16  addr16:$src)>;
1888f4a2713aSLionel Sambuc
1889f4a2713aSLionel Sambucdef: Mips16Pat<(trap), (Break16)>;
1890f4a2713aSLionel Sambuc
1891f4a2713aSLionel Sambucdef : Mips16Pat<(sext_inreg CPU16Regs:$val, i8),
1892f4a2713aSLionel Sambuc                (SebRx16 CPU16Regs:$val)>;
1893f4a2713aSLionel Sambuc
1894f4a2713aSLionel Sambucdef : Mips16Pat<(sext_inreg CPU16Regs:$val, i16),
1895f4a2713aSLionel Sambuc                (SehRx16 CPU16Regs:$val)>;
1896f4a2713aSLionel Sambuc
1897f4a2713aSLionel Sambucdef GotPrologue16:
1898f4a2713aSLionel Sambuc  MipsPseudo16<
1899f4a2713aSLionel Sambuc    (outs CPU16Regs:$rh, CPU16Regs:$rl),
1900f4a2713aSLionel Sambuc    (ins simm16:$immHi, simm16:$immLo),
1901*0a6a1f1dSLionel Sambuc    "li\t$rh, $immHi\n\taddiu\t$rl, $$pc, $immLo\n ",[]> ;
1902f4a2713aSLionel Sambuc
1903f4a2713aSLionel Sambuc// An operand for the CONSTPOOL_ENTRY pseudo-instruction.
1904f4a2713aSLionel Sambucdef cpinst_operand : Operand<i32> {
1905f4a2713aSLionel Sambuc  // let PrintMethod = "printCPInstOperand";
1906f4a2713aSLionel Sambuc}
1907f4a2713aSLionel Sambuc
1908f4a2713aSLionel Sambuc// CONSTPOOL_ENTRY - This instruction represents a floating constant pool in
1909f4a2713aSLionel Sambuc// the function.  The first operand is the ID# for this instruction, the second
1910f4a2713aSLionel Sambuc// is the index into the MachineConstantPool that this is, the third is the
1911f4a2713aSLionel Sambuc// size in bytes of this constant pool entry.
1912f4a2713aSLionel Sambuc//
1913*0a6a1f1dSLionel Sambuclet hasSideEffects = 0, isNotDuplicable = 1 in
1914f4a2713aSLionel Sambucdef CONSTPOOL_ENTRY :
1915f4a2713aSLionel SambucMipsPseudo16<(outs), (ins cpinst_operand:$instid, cpinst_operand:$cpidx,
1916f4a2713aSLionel Sambuc                      i32imm:$size), "foo", []>;
1917f4a2713aSLionel Sambuc
1918