1 //===- ARCInstrFormats.td - ARC Instruction Formats --------*- tablegen -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 //===----------------------------------------------------------------------===//
11 // Instruction format superclass
12 //===----------------------------------------------------------------------===//
16 field bits<64> SoftFail = 0;
21 class immU<int BSz> : Operand<i32>, PatLeaf<(imm),
22 "\n return isUInt<"#BSz#">(N->getSExtValue());"> {
27 class immS<int BSz> : Operand<i32>, PatLeaf<(imm),
28 "\n return isInt<"#BSz#">(N->getSExtValue());"> {
29 let DecoderMethod = "DecodeSignedOperand<"#BSz#">";
32 // e.g. s3 field may encode the signed integers values -1 .. 6
33 // using binary codes 111, 000, 001, 010, 011, 100, 101, and 110, respectively
34 class immC<int BSz> : Operand<i32>, PatLeaf<(imm),
35 "\n return isInt<"#BSz#">(N->getSExtValue());"> {
36 let DecoderMethod = "DecodeFromCyclicRange<"#BSz#">";
39 def MEMii : Operand<i32> {
40 let MIOperandInfo = (ops i32imm, i32imm);
43 def MEMrs9 : Operand<iAny> {
44 let MIOperandInfo = (ops GPR32:$B, immS<9>:$S9);
45 let PrintMethod = "printMemOperandRI";
46 let DecoderMethod = "DecodeMEMrs9";
49 def MEMrlimm : Operand<iAny> {
50 let MIOperandInfo = (ops GPR32:$B, i32imm:$LImm);
51 let PrintMethod = "printMemOperandRI";
52 let DecoderMethod = "DecodeMEMrlimm";
55 def GPR32Reduced : Operand<iAny> {
56 let DecoderMethod = "DecodeGBR32ShortRegister";
59 class InstARC<int sz, dag outs, dag ins, string asmstr, list<dag> pattern>
60 : Instruction, Encoding64 {
62 let Namespace = "ARC";
63 dag OutOperandList = outs;
64 dag InOperandList = ins;
65 let AsmString = asmstr;
66 let Pattern = pattern;
70 // ARC pseudo instructions format
71 class PseudoInstARC<dag outs, dag ins, string asmstr, list<dag> pattern>
72 : InstARC<0, outs, ins, asmstr, pattern> {
76 //===----------------------------------------------------------------------===//
77 // Instruction formats
78 //===----------------------------------------------------------------------===//
80 // All 32-bit ARC instructions have a 5-bit "major" opcode class designator
83 // Some general naming conventions:
84 // N - Delay Slot bit. ARC v2 branch instructions have an optional delay slot
85 // which is encoded with this bit. When set, a delay slot exists.
86 // cc - Condition code.
87 // SX - Signed X-bit immediate.
88 // UX - Unsigned X-bit immediate.
90 // [ABC] - 32-bit register operand. These are 6-bit fields. This encodes the
91 // standard 32 general purpose registers, and allows use of additional
92 // (extension) registers. This also encodes an instruction that uses
93 // a 32-bit Long Immediate (LImm), using 0x3e==62 as the field value.
94 // This makes 32-bit format instructions with Long Immediates
95 // 64-bit instructions, with the Long Immediate in bits 32-63.
96 // A - Inst[5-0] = A[5-0], when the format has A. A is always a register.
97 // B - Inst[14-12] = B[5-3], Inst[26-24] = B[2-0], when the format has B.
98 // B is always a register.
99 // C - Inst[11-6] = C[5-0], when the format has C. C can either be a register,
100 // or a 6-bit unsigned immediate (immU6), depending on the format.
101 // F - Many instructions specify a flag bit. When set, the result of these
102 // instructions will set the ZNCV flags of the STATUS32 register
103 // (Zero/Negative/Carry/oVerflow).
105 // Branch Instructions.
106 class F32_BR<bits<5> major, dag outs, dag ins, bit b16, string asmstr,
108 InstARC<4, outs, ins, asmstr, pattern> {
111 let Inst{31-27} = major;
116 class F32_BR_COND<bits<5> major, dag outs, dag ins, bit b16, string asmstr,
118 F32_BR<major, outs, ins, b16, asmstr, pattern> {
119 bits<21> S21; // 2-byte aligned 21-bit byte-offset.
121 let Inst{26-18} = S21{10-2};
122 let Inst{15-6} = S21{20-11};
126 class F32_BR_UCOND_FAR<bits<5> major, dag outs, dag ins, bit b16, string asmstr,
128 F32_BR<major, outs, ins, b16, asmstr, pattern> {
129 bits<25> S25; // 2-byte aligned 25-bit byte-offset.
130 let Inst{26-18} = S25{10-2};
131 let Inst{15-6} = S25{20-11};
133 let Inst{3-0} = S25{24-21};
136 class F32_BR0_COND<dag outs, dag ins, string asmstr, list<dag> pat> :
137 F32_BR_COND<0b00000, outs, ins, 0, asmstr, pat> {
138 let Inst{17} = S21{1};
141 // Branch targets are 2-byte aligned, so S25[0] is implied 0.
142 // |26|25|24|23|22|21|20|19|18|17|16|15|14|13|12|11|10|9|8|7|6|5|4|3|2|1|0 |
143 // |S25[10-1] | 1|S25[20-11] |N|0|S25[24-21]|
144 class F32_BR0_UCOND_FAR<dag outs, dag ins, string asmstr, list<dag> pat> :
145 F32_BR_UCOND_FAR<0b00000, outs, ins, 1, asmstr, pat> {
146 let Inst{17} = S25{1};
149 // BL targets (functions) are 4-byte aligned, so S25[1-0] = 0b00
150 // |26|25|24|23|22|21|20|19|18|17|16|15|14|13|12|11|10|9|8|7|6|5|4|3|2|1|0 |
151 // |S25[10-2] | 1| 0|S25[20-11] |N|0|S25[24-21]|
152 class F32_BR1_BL_UCOND_FAR<dag outs, dag ins, string asmstr, list<dag> pat> :
153 F32_BR_UCOND_FAR<0b00001, outs, ins, 0, asmstr, pat> {
157 // BLcc targets have 21 bit range, and are 4-byte aligned.
158 // |26|25|24|23|22|21|20|19|18|17|16|15|14|13|12|11|10|9|8|7|6|5|4|3|2|1|0|
159 // |S25[10-2] | 0| 0|S25[20-11] |N|0|cc |
160 class F32_BR1_BL_COND<dag outs, dag ins, string asmstr, list<dag> pat> :
161 F32_BR_COND<0b00001, outs, ins, 0, asmstr, pat> {
165 // BRcc targets have limited 9-bit range. These are for compare and branch
166 // in single instruction. Their targets are 2-byte aligned. They also use
167 // a different (3-bit) set of condition codes.
168 // |26|25|24|23|22|21|20|19|18|17|16|15 |14|13|12|11|10|9|8|7|6|5|4|3|2|1|0|
169 // |B[2-0] |S9[7-1] | 1|S9[8]|B[5-3] |C |N|u|0|cc |
170 class F32_BR1_BCC<dag outs, dag ins, string asmstr, bit IsU6,
172 InstARC<4, outs, ins, asmstr, pattern> {
178 bits<9> S9; // 2-byte aligned 9-bit byte-offset.
180 let Inst{31-27} = 0b00001;
181 let Inst{26-24} = B{2-0};
182 let Inst{23-17} = S9{7-1};
184 let Inst{15} = S9{8};
185 let Inst{14-12} = B{5-3};
193 // General operations instructions.
194 // Single Operand Instructions. Inst[5-0] specifies the specific operation
196 // |26|25|24|23|22|21|20|19|18|17|16|15|14|13|12|11|10|9|8|7|6|5|4|3|2|1|0|
197 // |B[2-0] | 0| 0| 1| 0| 1| 1| 1| 1| F|B[5-3] |C |subop |
198 class F32_SOP_RR<bits<5> major, bits<6> subop, bit F, dag outs, dag ins,
199 string asmstr, list<dag> pattern> :
200 InstARC<4, outs, ins, asmstr, pattern> {
205 let Inst{31-27} = major;
206 let Inst{26-24} = B{2-0};
207 let Inst{23-22} = 0b00;
208 let Inst{21-16} = 0b101111;
210 let Inst{14-12} = B{5-3};
212 let Inst{5-0} = subop;
215 // Dual Operand Instructions. Inst[21-16] specifies the specific operation
218 // 3-register Dual Operand instruction.
219 // |26|25|24|23|22|21|20|19|18|17|16|15|14|13|12|11|10|9|8|7|6|5|4|3|2|1|0|
220 // |B[2-0] | 0| 0| subop| F|B[5-3] |C |A |
221 class F32_DOP_RR<bits<5> major, bits<6> subop, bit F, dag outs, dag ins,
222 string asmstr, list<dag> pattern> :
223 InstARC<4, outs, ins, asmstr, pattern> {
228 let Inst{31-27} = major;
229 let Inst{26-24} = B{2-0};
230 let Inst{23-22} = 0b00;
231 let Inst{21-16} = subop;
233 let Inst{14-12} = B{5-3};
238 // Conditional Dual Operand instruction. This instruction uses B as the
239 // first 2 operands (i.e, add.cc B, B, C).
240 // |26|25|24|23|22|21|20|19|18|17|16|15|14|13|12|11|10|9|8|7|6|5|4|3|2|1|0|
241 // |B[2-0] | 1| 1| subop| F|B[5-3] |C |A |
242 class F32_DOP_CC_RR<bits<5> major, bits<6> subop, bit F, dag outs, dag ins,
243 string asmstr, list<dag> pattern> :
244 InstARC<4, outs, ins, asmstr, pattern> {
249 let Inst{31-27} = major;
250 let Inst{26-24} = B{2-0};
251 let Inst{23-22} = 0b11;
252 let Inst{21-16} = subop;
254 let Inst{14-12} = B{5-3};
261 // 2-register, unsigned 6-bit immediate Dual Operand instruction.
262 // |26|25|24|23|22|21|20|19|18|17|16|15|14|13|12|11|10|9|8|7|6|5|4|3|2|1|0|
263 // |B[2-0] | 0| 1| subop| F|B[5-3] |U6 |A |
264 class F32_DOP_RU6<bits<5> major, bits<6> subop, bit F, dag outs, dag ins,
265 string asmstr, list<dag> pattern> :
266 InstARC<4, outs, ins, asmstr, pattern> {
271 let Inst{31-27} = major;
272 let Inst{26-24} = B{2-0};
273 let Inst{23-22} = 0b01;
274 let Inst{21-16} = subop;
276 let Inst{14-12} = B{5-3};
281 // 2-register, signed 12-bit immediate Dual Operand instruction.
282 // This instruction uses B as the first 2 operands (i.e., add B, B, -128).
283 // |26|25|24|23|22|21|20|19|18|17|16|15|14|13|12|11|10|9|8|7|6|5|4|3|2|1|0|
284 // |B[2-0] | 1| 0| subop| F|B[5-3] |S12[5-0] |S12[11-6] |
285 class F32_DOP_RS12<bits<5> major, bits<6> subop, bit F, dag outs, dag ins,
286 string asmstr, list<dag> pattern> :
287 InstARC<4, outs, ins, asmstr, pattern> {
291 let Inst{31-27} = major;
292 let Inst{26-24} = B{2-0};
293 let Inst{23-22} = 0b10;
294 let Inst{21-16} = subop;
296 let Inst{14-12} = B{5-3};
297 let Inst{11-6} = S12{5-0};
298 let Inst{5-0} = S12{11-6};
301 // 2-register, 32-bit immediate (LImm) Dual Operand instruction.
302 // This instruction has the 32-bit immediate in bits 32-63, and
303 // 62 in the C register operand slot, but is otherwise F32_DOP_RR.
304 class F32_DOP_RLIMM<bits<5> major, bits<6> subop, bit F, dag outs, dag ins,
305 string asmstr, list<dag> pattern> :
306 InstARC<8, outs, ins, asmstr, pattern> {
311 let Inst{63-32} = LImm;
312 let Inst{31-27} = major;
313 let Inst{26-24} = B{2-0};
314 let Inst{23-22} = 0b00;
315 let Inst{21-16} = subop;
317 let Inst{14-12} = B{5-3};
318 let Inst{11-6} = 0b111110;
323 // Load and store instructions.
324 // In addition to the previous naming conventions, load and store instructions
326 // di - Uncached bit. When set, loads/stores bypass the cache and access
328 // aa - Incrementing mode. Loads and stores can write-back address pre- or
329 // post- memory operation.
330 // zz - Memory size (can be 8/16/32 bit load/store).
331 // x - Sign-extending. When set, short loads can be sign-extended to 32-bits.
332 // Loads and Stores support different memory addressing modes:
333 // Base Register + Signed 9-bit Immediate: Both Load/Store.
334 // LImm: Both Load/Store (Load/Store from a fixed 32-bit address).
335 // Register + Register: Load Only.
336 // Register + LImm: Load Only.
338 // Register + S9 Load. (B + S9)
339 // |26|25|24|23|22|21|20|19|18|17|16|15 |14|13|12|11|10|9|8|7|6|5|4|3|2|1|0|
340 // |B[2-0] |S9[7-0] |S9[8]|B[5-3] |di|aa |zz |x|A |
341 class F32_LD_RS9<bit x, bits<2> aa, bit di, bits<2> zz, dag outs, dag ins,
342 string asmstr, list<dag> pattern> :
343 InstARC<4, outs, ins, asmstr, pattern> {
348 let Inst{31-27} = 0b00010;
349 let Inst{26-24} = B{2-0};
350 let Inst{23-16} = S9{7-0};
351 let Inst{15} = S9{8};
352 let Inst{14-12} = B{5-3};
360 class F32_LD_ADDR<bit x, bits<2> aa, bit di, bits<2> zz, dag outs, dag ins,
361 string asmstr, list<dag> pattern> :
362 F32_LD_RS9<x, aa, di, zz, outs, ins, asmstr, pattern> {
370 // LImm Load. The 32-bit immediate address is in Inst[63-32].
371 // |26|25|24|23|22|21|20|19|18|17|16|15|14|13|12|11|10|9|8|7|6|5|4|3|2|1|0|
372 // | 1| 1| 0| 0 | 1| 1| 1|di| 0|0|zz |x|A |
373 class F32_LD_LIMM<bit x, bit di, bits<2> zz, dag outs, dag ins,
374 string asmstr, list<dag> pattern> :
375 InstARC<8, outs, ins, asmstr, pattern> {
376 bits<6> LImmReg = 0b111110;
380 let Inst{63-32} = LImm;
381 let Inst{31-27} = 0b00010;
382 let Inst{26-24} = LImmReg{2-0};
384 let Inst{14-12} = LImmReg{5-3};
390 let DecoderMethod = "DecodeLdLImmInstruction";
393 // Register + LImm load. The 32-bit immediate address is in Inst[63-32].
394 // |26|25|24|23|22|21|20|19|18|17|16|15|14|13|12|11|10|9|8|7|6|5|4|3|2|1|0|
395 // |B[2-0] |aa | 1| 1| 0|zz | x|di|B[5-3] | 1| 1|1|1|1|0|A |
396 class F32_LD_RLIMM<bit x, bits<2> aa, bit di, bits<2> zz, dag outs, dag ins,
397 string asmstr, list<dag> pattern> :
398 InstARC<8, outs, ins, asmstr, pattern> {
399 bits<6> LImmReg = 0b111110;
405 let LImm = addr{31-0};
407 let Inst{63-32} = LImm;
408 let Inst{31-27} = 0b00100;
409 let Inst{26-24} = B{2-0};
410 let Inst{23-22} = aa;
411 let Inst{21-19} = 0b110;
412 let Inst{18-17} = zz;
415 let Inst{14-12} = B{5-3};
416 let Inst{11-6} = LImmReg;
418 let DecoderMethod = "DecodeLdRLImmInstruction";
421 // Register + S9 Store. (B + S9)
422 // |26|25|24|23|22|21|20|19|18|17|16|15 |14|13|12|11|10|9|8|7|6|5 |4|3|2|1|0|
423 // |B[2-0] |S9[7-0] |S9[8]|B[5-3] |C |di|aa |zz |0|
424 class F32_ST_RS9<bits<2> aa, bit di, bits<2> zz, dag outs, dag ins,
425 string asmstr, list<dag> pattern> :
426 InstARC<4, outs, ins, asmstr, pattern> {
431 let Inst{31-27} = 0b00011;
432 let Inst{26-24} = B{2-0};
433 let Inst{23-16} = S9{7-0};
434 let Inst{15} = S9{8};
435 let Inst{14-12} = B{5-3};
443 class F32_ST_ADDR<bits<2> aa, bit di, bits<2> zz, dag outs, dag ins,
444 string asmstr, list<dag> pattern> :
445 F32_ST_RS9<aa, di, zz, outs, ins, asmstr, pattern> {
453 // |26|25|24|23|22|21|20|19|18|17|16|15|14|13|12|11|10|9|8|7|6|5 |4|3|2|1|0|
454 // | 1| 1| 0| 0 | 1| 1| 1|C |di|0|0|zz |0|
455 class F32_ST_LIMM<bit di, bits<2> zz, dag outs, dag ins,
456 string asmstr, list<dag> pattern> :
457 InstARC<8, outs, ins, asmstr, pattern> {
458 bits<6> LImmReg = 0b111110;
462 let Inst{63-32} = LImm;
463 let Inst{31-27} = 0b00011;
464 let Inst{26-24} = LImmReg{2-0};
466 let Inst{14-12} = LImmReg{5-3};
472 let DecoderMethod = "DecodeStLImmInstruction";
475 // Compact Move/Load.
476 // |10|9|8|7|6|5|4|3|2|1|0|
478 class F16_COMPACT<bits<1> i, dag outs, dag ins,
480 InstARC<2, outs, ins, asmstr, []> {
484 let Inst{15-11} = 0b01000;
485 let Inst{7-5} = h{2-0};
487 let Inst{1-0} = h{4-3};
490 // Compact Load/Add/Sub.
491 class F16_LD_ADD_SUB<dag outs, dag ins, string asmstr> :
492 InstARC<2, outs, ins, asmstr, []> {
495 let Inst{15-11} = 0b01001;
499 class F16_LD_SUB<bit i, string asmstr> :
500 F16_LD_ADD_SUB<(outs GPR32:$a), (ins GPR32:$b, GPR32:$c),
513 F16_LD_ADD_SUB<(outs GPR32:$r), (ins GPR32:$b, immU<6>:$u6),
514 "add_s\t$r, $b, $u6"> {
520 let Inst{6-4} = u6{5-3};
522 let Inst{2-0} = u6{2-0};
525 // Compact Load/Store.
526 class F16_LD_ST_1<dag outs, dag ins, string asmstr> :
527 InstARC<2, outs, ins, asmstr, []> {
529 let Inst{15-11} = 0b01010;
532 class F16_LD_ST_s11<bit i, string asmstr> :
533 F16_LD_ST_1<(outs), (ins immS<11>:$s11), asmstr> {
537 let Inst{10-5} = s11{10-5};
540 let Inst{2-0} = s11{4-2};
545 F16_LD_ST_1<(outs GPR32:$b), (ins immU<7>:$u7),
546 "ldi_s\t$b, [$u7]"> {
552 let Inst{7-4} = u7{6-3};
554 let Inst{2-0} = u7{2-0};
557 // Indexed Jump or Execute.
558 class F16_JLI_EI<bit i, string asmstr> :
559 InstARC<2, (outs), (ins immU<10>:$u10),
560 !strconcat(asmstr, "\t$u10"), []> {
564 let Inst{15-11} = 0b01011;
569 // Load/Add Register-Register.
570 class F16_LD_ADD_RR<bits<2> i, string asmstr> :
571 InstARC<2, (outs GPR32:$a), (ins GPR32:$b, GPR32:$c),
578 let Inst{15-11} = 0b01100;
585 // Load/Add GP-Relative.
586 class F16_GP_LD_ADD<bits<2> i, dag ins, string asmstr> :
587 InstARC<2, (outs), ins, asmstr, []> {
589 let Inst{15-11} = 0b11001;
593 // Add/Sub/Shift Register-Immediate.
594 // |10|9|8|7|6|5|4|3|2|1|0|
596 class F16_ADD_IMM<bits<2> i, string asmstr> :
597 InstARC<2, (outs GPR32:$c), (ins GPR32:$b, immU<3>:$u3),
598 !strconcat(asmstr, "\t$c, $b, $u3"), []> {
604 let Inst{15-11} = 0b01101;
611 // Dual Register Operations.
612 // |10|9|8|7|6|5|4|3|2|1|0|
614 class F16_OP_HREG<bits<3> i, dag outs, dag ins, string asmstr> :
615 InstARC<2, outs, ins, asmstr, []> {
620 let Inst{15-11} = 0b01110;
621 let Inst{10-8} = b_s3;
622 let Inst{7-5} = h{2-0};
624 let Inst{1-0} = h{4-3};
627 class F16_OP_HREG30<bits<3> i, dag outs, dag ins, string asmstr> :
628 F16_OP_HREG<i, outs, ins, asmstr> {
630 bits<5> LImmReg = 0b11110;
631 let Inst{7-5} = LImmReg{2-0};
632 let Inst{1-0} = LImmReg{4-3};
635 class F16_OP_HREG_LIMM<bits<3> i, dag outs, dag ins, string asmstr> :
636 F16_OP_HREG30<i, outs, ins, asmstr> {
639 let Inst{47-16} = LImm;
643 // General compact DOP format.
644 class F16_GEN_DOP_BASE<bits<5> i, dag outs, dag ins, string asmstr> :
645 InstARC<2, outs, ins, asmstr, []> {
649 let Inst{15-11} = 0b01111;
655 class F16_GEN_DOP<bits<5> i, string asmstr> :
656 F16_GEN_DOP_BASE<i, (outs GPR32:$b), (ins GPR32:$c),
657 !strconcat(asmstr, "\t$b, $b, $c")>;
659 class F16_GEN_DOP_NODST<bits<5> i, string asmstr> :
660 F16_GEN_DOP_BASE<i, (outs), (ins GPR32:$b, GPR32:$c),
661 !strconcat(asmstr, "\t$b, $c")>;
663 class F16_GEN_DOP_SINGLESRC<bits<5> i, string asmstr> :
664 F16_GEN_DOP_BASE<i, (outs GPR32:$b), (ins GPR32:$c),
665 !strconcat(asmstr, "\t$b, $c")>;
667 class F16_GEN_SOP_BASE<bits<3> i, dag outs, dag ins, string asmstr> :
668 F16_GEN_DOP_BASE<0b00000, outs, ins, asmstr> {
673 class F16_GEN_SOP<bits<3> i, string asmstr> :
674 F16_GEN_SOP_BASE<i, (outs), (ins GPR32:$b), asmstr>;
676 class F16_GEN_ZOP<bits<3> i, string asmstr> :
677 F16_GEN_SOP_BASE<0b111, (outs), (ins), asmstr> {
682 // Compact Load/Store with Offset Format.
683 class F16_LD_ST_OFF<bits<5> opc, dag outs, dag ins, string asmstr> :
684 InstARC<2, outs, ins, !strconcat(asmstr, "\t$c, [$b, $off]"), []> {
688 let Inst{15-11} = opc;
693 class F16_LD_ST_WORD_OFF<bits<5> opc, dag outs, dag ins, string asmstr> :
694 F16_LD_ST_OFF<opc, outs, ins, asmstr> {
697 let Inst{4-0} = off{6-2};
701 class F16_LD_ST_HALF_OFF<bits<5> opc, dag outs, dag ins, string asmstr> :
702 F16_LD_ST_OFF<opc, outs, ins, asmstr> {
705 let Inst{4-0} = off{5-1};
709 class F16_LD_ST_BYTE_OFF<bits<5> opc, dag outs, dag ins, string asmstr> :
710 F16_LD_ST_OFF<opc, outs, ins, asmstr> {
716 // Shift/Subtract/Bit Immediate.
717 // |10|9|8|7|6|5|4|3|2|1|0|
719 class F16_SH_SUB_BIT<bits<3> i, string asmstr> :
720 InstARC<2, (outs), (ins GPR32:$b, immU<5>:$u5), asmstr, []> {
725 let Inst{15-11} = 0b10111;
731 class F16_SH_SUB_BIT_DST<bits<3> i, string asmstr> :
732 F16_SH_SUB_BIT<i, !strconcat(asmstr, "\t$b, $b, $u5")>;
734 // 16-bit stack-based operations.
735 // |10|9|8|7|6|5|4|3|2|1|0|
737 class F16_SP_OPS<bits<3> i,
738 dag outs, dag ins, string asmstr> :
739 InstARC<2, outs, ins, asmstr, []> {
744 let Inst{15-11} = 0b11000;
745 let Inst{10-8} = fieldB;
747 let Inst{4-0} = fieldU;
750 class F16_SP_OPS_u7_aligned<bits<3> i,
751 dag outs, dag ins, string asmstr> :
752 F16_SP_OPS<i, outs, ins, asmstr> {
758 let fieldU = u7{6-2};
762 class F16_SP_OPS_bconst<bits<3> b, string asmop> :
763 F16_SP_OPS_u7_aligned<0b101,
764 (outs), (ins immU<7>:$u7),
765 !strconcat(asmop, "\t%sp, %sp, $u7")> {
770 class F16_SP_OPS_uconst<bits<3> i,
771 dag outs, dag ins, string asmop> :
772 F16_SP_OPS_u7_aligned<i, outs, ins,
773 !strconcat(asmop, "\t$b3")> {
775 let fieldU = 0b00001;
778 class F16_SP_OPS_buconst<bits<3> i, string asmop> :
779 F16_SP_OPS_u7_aligned<i, (outs), (ins),
780 !strconcat(asmop, "\t%blink")> {
783 let fieldU = 0b10001;
786 class F16_SP_LD<bits<3> i, string asmop> : F16_SP_OPS_u7_aligned<i,
787 (outs GPR32Reduced:$b3), (ins immU<7>:$u7),
788 !strconcat(asmop, "\t$b3, [%sp, $u7]")>;
790 class F16_SP_ST<bits<3> i, string asmop> : F16_SP_OPS_u7_aligned<i,
791 (outs), (ins GPR32Reduced:$b3, immU<7>:$u7),
792 !strconcat(asmop, "\t$b3, [%sp, $u7]")>;
794 // Compact MOV/ADD/CMP Immediate Format.
795 class F16_OP_IMM<bits<5> opc, dag outs, dag ins, string asmstr> :
796 InstARC<2, outs, ins, asmstr, []> {
799 let Inst{15-11} = opc;
803 class F16_OP_U7<bit i, string asmstr> :
804 F16_OP_IMM<0b11100, (outs GPR32:$b), (ins immU<7>:$u7), asmstr> {
811 // Special types for different instruction operands.
812 def cmovpred : Operand<i32>, PredicateOp,
813 ComplexPattern<i32, 2, "SelectCMOVPred"> {
814 let MIOperandInfo = (ops i32imm, i32imm);
815 let PrintMethod = "printPredicateOperand";
818 def ccond : Operand<i32> {
819 let MIOperandInfo = (ops i32imm);
820 let PrintMethod = "printPredicateOperand";
823 def brccond : Operand<i32> {
824 let MIOperandInfo = (ops i32imm);
825 let PrintMethod = "printBRCCPredicateOperand";
828 // Branch/call targets of different offset sizes.
829 class BCTarget<ValueType vt> : Operand<vt> {
830 let OperandType = "OPERAND_PCREL";
833 def btarget : BCTarget<OtherVT>;
835 class BCTargetSigned<ValueType vt, int BSz> : BCTarget<vt> {
836 let DecoderMethod = "DecodeBranchTargetS<"#BSz#">";
839 class BranchTargetS<int BSz> : BCTargetSigned<OtherVT, BSz>;
840 def btargetS7 : BranchTargetS<7>;
841 def btargetS8 : BranchTargetS<8>;
842 def btargetS9 : BranchTargetS<9>;
843 def btargetS10 : BranchTargetS<10>;
844 def btargetS13 : BranchTargetS<13>;
845 def btargetS21 : BranchTargetS<21>;
846 def btargetS25 : BranchTargetS<25>;
848 class CallTargetS<int BSz> : BCTargetSigned<i32, BSz>;
849 def calltargetS25: CallTargetS<25>;
851 // Compact Branch on Compare Register with Zero.
852 class F16_BCC_REG<bit i, string asmstr> :
853 InstARC<2, (outs), (ins GPR32:$b, btargetS8:$s8),
854 !strconcat(asmstr, "\t$b, 0, $s8"), []> {
859 let Inst{15-11} = 0b11101;
862 let Inst{6-0} = s8{7-1};
866 // Compact Branch Conditionally Format.
867 class F16_BCC<bits<2> i, dag ins, string asmstr> :
868 InstARC<2, (outs), ins, asmstr, []> {
870 let Inst{15-11} = 0b11110;
874 class F16_BCC_s10<bits<2> i, string asmstr> :
875 F16_BCC<i, (ins btargetS10:$s),
876 !strconcat(asmstr, "\t$s")> {
879 let Inst{8-0} = s{9-1};
883 class F16_BCC_s7<bits<3> i, string asmstr> :
884 F16_BCC<0b11, (ins btargetS7:$s),
885 !strconcat(asmstr, "\t$s")> {
889 let Inst{5-0} = s{6-1};