asmprint pseudo instrs
[oota-llvm.git] / lib / Target / Sparc / SparcInstrInfo.td
1 //===- SparcV8Instrs.td - Target Description for SparcV8 Target -----------===//
2 // 
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file was developed by the LLVM research group and is distributed under
6 // the University of Illinois Open Source License. See LICENSE.TXT for details.
7 // 
8 //===----------------------------------------------------------------------===//
9 //
10 // This file describes the SparcV8 instructions in TableGen format.
11 //
12 //===----------------------------------------------------------------------===//
13
14 //===----------------------------------------------------------------------===//
15 // Instruction format superclass
16 //===----------------------------------------------------------------------===//
17
18 class InstV8 : Instruction {          // SparcV8 instruction baseline
19   field bits<32> Inst;
20
21   let Namespace = "V8";
22
23   bits<2> op;
24   let Inst{31-30} = op;               // Top two bits are the 'op' field
25
26   // Bit attributes specific to SparcV8 instructions
27   bit isPasi       = 0; // Does this instruction affect an alternate addr space?
28   bit isPrivileged = 0; // Is this a privileged instruction?
29 }
30
31 include "SparcV8InstrFormats.td"
32
33 //===----------------------------------------------------------------------===//
34 // Instructions
35 //===----------------------------------------------------------------------===//
36
37 // Pseudo instructions.
38 class PseudoInstV8<string asmstr, dag ops> : InstV8  {
39   let AsmString = asmstr;
40   dag OperandList = ops;
41 }
42 def PHI : PseudoInstV8<"PHI", (ops variable_ops)>;
43 def ADJCALLSTACKDOWN : PseudoInstV8<"!ADJCALLSTACKDOWN $amt",
44                                     (ops i32imm:$amt)>;
45 def ADJCALLSTACKUP : PseudoInstV8<"!ADJCALLSTACKUP $amt",
46                                   (ops i32imm:$amt)>;
47 //def IMPLICIT_USE : PseudoInstV8<"!IMPLICIT_USE",(ops variable_ops)>;
48 def IMPLICIT_DEF : PseudoInstV8<"!IMPLICIT_DEF $dst", 
49                                 (ops IntRegs:$dst)>;
50 def FpMOVD : PseudoInstV8<"!FpMOVD", (ops)>; // pseudo 64-bit double move
51
52 // Section A.3 - Synthetic Instructions, p. 85
53 // special cases of JMPL:
54 let isReturn = 1, isTerminator = 1, hasDelaySlot = 1 in {
55   let rd = I7.Num, rs1 = G0.Num, simm13 = 8 in
56     def RET : F3_2<2, 0b111000,
57                    (ops IntRegs:$dst, IntRegs:$b, i32imm:$c),
58                    "ret $b, $c, $dst">;
59   let rd = O7.Num, rs1 = G0.Num, simm13 = 8 in
60     def RETL: F3_2<2, 0b111000, (ops),
61                    "retl">;
62 }
63 // CMP is a special case of SUBCC where destination is ignored, by setting it to
64 // %g0 (hardwired zero).
65 // FIXME: should keep track of the fact that it defs the integer condition codes
66 let rd = 0 in
67   def CMPri: F3_2<2, 0b010100,
68                   (ops IntRegs:$dst, IntRegs:$b, i32imm:$c),
69                   "cmp $b, $c, $dst">;
70
71 // Section B.1 - Load Integer Instructions, p. 90
72 def LDSB: F3_2<3, 0b001001,
73                (ops IntRegs:$dst, IntRegs:$b, i32imm:$c),
74                "ldsb [$b+$c], $dst">;
75 def LDSH: F3_2<3, 0b001010,
76                (ops IntRegs:$dst, IntRegs:$b, i32imm:$c),
77                "ldsh [$b+$c], $dst">;
78 def LDUB: F3_2<3, 0b000001,
79                (ops IntRegs:$dst, IntRegs:$b, i32imm:$c),
80                "ldub [$b+$c], $dst">;
81 def LDUH: F3_2<3, 0b000010,
82                (ops IntRegs:$dst, IntRegs:$b, i32imm:$c),
83                "lduh [$b+$c], $dst">;
84 def LD  : F3_2<3, 0b000000,
85                (ops IntRegs:$dst, IntRegs:$b, i32imm:$c),
86                "ld [$b+$c], $dst">;
87 def LDD : F3_2<3, 0b000011,
88                (ops IntRegs:$dst, IntRegs:$b, i32imm:$c),
89                "ldd [$b+$c], $dst">;
90
91 // Section B.2 - Load Floating-point Instructions, p. 92
92 def LDFrr  : F3_1<3, 0b100000,
93                   (ops IntRegs:$dst, IntRegs:$b, IntRegs:$c),
94                   "ld [$b+$c], $dst">;
95 def LDFri  : F3_2<3, 0b100000,
96                   (ops IntRegs:$dst, IntRegs:$b, i32imm:$c),
97                   "ld [$b+$c], $dst">;
98 def LDDFrr : F3_1<3, 0b100011,
99                   (ops IntRegs:$dst, IntRegs:$b, IntRegs:$c),
100                   "ldd [$b+$c], $dst">;
101 def LDDFri : F3_2<3, 0b100011,
102                   (ops IntRegs:$dst, IntRegs:$b, i32imm:$c),
103                   "ldd [$b+$c], $dst">;
104 def LDFSRrr: F3_1<3, 0b100001,
105                   (ops IntRegs:$dst, IntRegs:$b, IntRegs:$c),
106                   "ld [$b+$c], $dst">;
107 def LDFSRri: F3_2<3, 0b100001,
108                   (ops IntRegs:$dst, IntRegs:$b, i32imm:$c),
109                   "ld [$b+$c], $dst">;
110
111 // Section B.4 - Store Integer Instructions, p. 95
112 def STB : F3_2<3, 0b000101,
113                (ops IntRegs:$base, IntRegs:$offset, i32imm:$src),
114                "stb $src, [$base+$offset]">;
115 def STH : F3_2<3, 0b000110,
116                (ops IntRegs:$base, IntRegs:$offset, i32imm:$src),
117                "sth $src, [$base+$offset]">;
118 def ST  : F3_2<3, 0b000100,
119                (ops IntRegs:$base, IntRegs:$offset, i32imm:$src),
120                "st $src, [$base+$offset]">;
121 def STD : F3_2<3, 0b000111,
122                (ops IntRegs:$base, IntRegs:$offset, i32imm:$src),
123                "std $src, [$base+$offset]">;
124
125 // Section B.5 - Store Floating-point Instructions, p. 97
126 def STFrr   : F3_1<3, 0b100100,
127                    (ops IntRegs:$base, IntRegs:$offset, IntRegs:$src),
128                    "st $src, [$base+$offset]">;
129 def STFri   : F3_2<3, 0b100100,
130                    (ops IntRegs:$base, IntRegs:$offset, i32imm:$src),
131                    "st $src, [$base+$offset]">;
132 def STDFrr  : F3_1<3, 0b100111,
133                    (ops IntRegs:$base, IntRegs:$offset, IntRegs:$src),
134                    "std  $src, [$base+$offset]">;
135 def STDFri  : F3_2<3, 0b100111,
136                    (ops IntRegs:$base, IntRegs:$offset, i32imm:$src),
137                    "std $src, [$base+$offset]">;
138 def STFSRrr : F3_1<3, 0b100101,
139                    (ops IntRegs:$base, IntRegs:$offset, IntRegs:$src),
140                    "st $src, [$base+$offset]">;
141 def STFSRri : F3_2<3, 0b100101,
142                    (ops IntRegs:$base, IntRegs:$offset, i32imm:$src),
143                    "st $src, [$base+$offset]">;
144 def STDFQrr : F3_1<3, 0b100110,
145                    (ops IntRegs:$base, IntRegs:$offset, IntRegs:$src),
146                    "std $src, [$base+$offset]">;
147 def STDFQri : F3_2<3, 0b100110,
148                    (ops IntRegs:$base, IntRegs:$offset, i32imm:$src),
149                    "std $src, [$base+$offset]">;
150
151 // Section B.9 - SETHI Instruction, p. 104
152 def SETHIi: F2_1<0b100, "sethi">;
153
154 // Section B.10 - NOP Instruction, p. 105
155 // (It's a special case of SETHI)
156 let rd = 0, imm22 = 0 in
157   def NOP : F2_1<0b100, "nop">;
158
159 // Section B.11 - Logical Instructions, p. 106
160 def ANDrr   : F3_1<2, 0b000001,
161                    (ops IntRegs:$dst, IntRegs:$b, IntRegs:$c),
162                    "and $b, $c, $dst">;
163 def ANDri   : F3_2<2, 0b000001,
164                    (ops IntRegs:$dst, IntRegs:$b, i32imm:$c),
165                    "and $b, $c, $dst">;
166 def ANDCCrr : F3_1<2, 0b010001,
167                    (ops IntRegs:$dst, IntRegs:$b, IntRegs:$c),
168                    "andcc $b, $c, $dst">;
169 def ANDCCri : F3_2<2, 0b010001,
170                    (ops IntRegs:$dst, IntRegs:$b, i32imm:$c),
171                    "andcc $b, $c, $dst">;
172 def ANDNrr  : F3_1<2, 0b000101,
173                    (ops IntRegs:$dst, IntRegs:$b, IntRegs:$c),
174                    "andn $b, $c, $dst">;
175 def ANDNri  : F3_2<2, 0b000101,
176                    (ops IntRegs:$dst, IntRegs:$b, i32imm:$c),
177                    "andn $b, $c, $dst">;
178 def ANDNCCrr: F3_1<2, 0b010101,
179                    (ops IntRegs:$dst, IntRegs:$b, IntRegs:$c),
180                    "andncc $b, $c, $dst">;
181 def ANDNCCri: F3_2<2, 0b010101,
182                    (ops IntRegs:$dst, IntRegs:$b, i32imm:$c),
183                    "andncc $b, $c, $dst">;
184 def ORrr    : F3_1<2, 0b000010,
185                    (ops IntRegs:$dst, IntRegs:$b, IntRegs:$c),
186                    "or $b, $c, $dst">;
187 def ORri    : F3_2<2, 0b000010,
188                    (ops IntRegs:$dst, IntRegs:$b, i32imm:$c),
189                    "or $b, $c, $dst">;
190 def ORCCrr  : F3_1<2, 0b010010,
191                    (ops IntRegs:$dst, IntRegs:$b, IntRegs:$c),
192                    "orcc $b, $c, $dst">;
193 def ORCCri  : F3_2<2, 0b010010,
194                    (ops IntRegs:$dst, IntRegs:$b, i32imm:$c),
195                    "orcc $b, $c, $dst">;
196 def ORNrr   : F3_1<2, 0b000110,
197                    (ops IntRegs:$dst, IntRegs:$b, IntRegs:$c),
198                    "orn $b, $c, $dst">;
199 def ORNri   : F3_2<2, 0b000110,
200                    (ops IntRegs:$dst, IntRegs:$b, i32imm:$c),
201                    "orn $b, $c, $dst">;
202 def ORNCCrr : F3_1<2, 0b010110,
203                    (ops IntRegs:$dst, IntRegs:$b, IntRegs:$c),
204                    "orncc $b, $c, $dst">;
205 def ORNCCri : F3_2<2, 0b010110,
206                    (ops IntRegs:$dst, IntRegs:$b, i32imm:$c),
207                    "orncc $b, $c, $dst">;
208 def XORrr   : F3_1<2, 0b000011,
209                    (ops IntRegs:$dst, IntRegs:$b, IntRegs:$c),
210                    "xor $b, $c, $dst">;
211 def XORri   : F3_2<2, 0b000011,
212                    (ops IntRegs:$dst, IntRegs:$b, i32imm:$c),
213                    "xor $b, $c, $dst">;
214 def XORCCrr : F3_1<2, 0b010011,
215                    (ops IntRegs:$dst, IntRegs:$b, IntRegs:$c),
216                    "xorcc $b, $c, $dst">;
217 def XORCCri : F3_2<2, 0b010011,
218                    (ops IntRegs:$dst, IntRegs:$b, i32imm:$c),
219                    "xorcc $b, $c, $dst">;
220 def XNORrr  : F3_1<2, 0b000111,
221                    (ops IntRegs:$dst, IntRegs:$b, IntRegs:$c),
222                    "xnor $b, $c, $dst">;
223 def XNORri  : F3_2<2, 0b000111,
224                    (ops IntRegs:$dst, IntRegs:$b, i32imm:$c),
225                    "xnor $b, $c, $dst">;
226 def XNORCCrr: F3_1<2, 0b010111,
227                    (ops IntRegs:$dst, IntRegs:$b, IntRegs:$c),
228                    "xnorcc $b, $c, $dst">;
229 def XNORCCri: F3_2<2, 0b010111,
230                    (ops IntRegs:$dst, IntRegs:$b, i32imm:$c),
231                    "xnorcc $b, $c, $dst">;
232
233 // Section B.12 - Shift Instructions, p. 107
234 def SLLrr : F3_1<2, 0b100101,
235                  (ops IntRegs:$dst, IntRegs:$b, IntRegs:$c),
236                  "sll $b, $c, $dst">;
237 def SLLri : F3_2<2, 0b100101,
238                  (ops IntRegs:$dst, IntRegs:$b, i32imm:$c),
239                  "sll $b, $c, $dst">;
240 def SRLrr : F3_1<2, 0b100110, 
241                  (ops IntRegs:$dst, IntRegs:$b, IntRegs:$c),
242                   "srl $b, $c, $dst">;
243 def SRLri : F3_2<2, 0b100110,
244                  (ops IntRegs:$dst, IntRegs:$b, i32imm:$c),
245                  "srl $b, $c, $dst">;
246 def SRArr : F3_1<2, 0b100111, 
247                  (ops IntRegs:$dst, IntRegs:$b, IntRegs:$c),
248                   "sra $b, $c, $dst">;
249 def SRAri : F3_2<2, 0b100111,
250                  (ops IntRegs:$dst, IntRegs:$b, i32imm:$c),
251                  "sla $b, $c, $dst">;
252
253 // Section B.13 - Add Instructions, p. 108
254 def ADDrr   : F3_1<2, 0b000000, 
255                   (ops IntRegs:$dst, IntRegs:$b, IntRegs:$c),
256                   "add $b, $c, $dst">;
257 def ADDri   : F3_2<2, 0b000000,
258                    (ops IntRegs:$dst, IntRegs:$b, i32imm:$c),
259                    "add $b, $c, $dst">;
260 def ADDCCrr : F3_1<2, 0b010000, 
261                    (ops IntRegs:$dst, IntRegs:$b, IntRegs:$c),
262                    "addcc $b, $c, $dst">;
263 def ADDCCri : F3_2<2, 0b010000,
264                    (ops IntRegs:$dst, IntRegs:$b, i32imm:$c),
265                    "addcc $b, $c, $dst">;
266 def ADDXrr  : F3_1<2, 0b001000, 
267                    (ops IntRegs:$dst, IntRegs:$b, IntRegs:$c),
268                    "addx $b, $c, $dst">;
269 def ADDXri  : F3_2<2, 0b001000,
270                    (ops IntRegs:$dst, IntRegs:$b, i32imm:$c),
271                    "addx $b, $c, $dst">;
272 def ADDXCCrr: F3_1<2, 0b011000, 
273                    (ops IntRegs:$dst, IntRegs:$b, IntRegs:$c),
274                    "addxcc $b, $c, $dst">;
275 def ADDXCCri: F3_2<2, 0b011000,
276                    (ops IntRegs:$dst, IntRegs:$b, i32imm:$c),
277                    "addxcc $b, $c, $dst">;
278
279 // Section B.15 - Subtract Instructions, p. 110
280 def SUBrr   : F3_1<2, 0b000100, 
281                    (ops IntRegs:$dst, IntRegs:$b, IntRegs:$c),
282                    "sub $b, $c, $dst">;
283 def SUBri   : F3_2<2, 0b000100,
284                    (ops IntRegs:$dst, IntRegs:$b, i32imm:$c),
285                    "sub $b, $c, $dst">;
286 def SUBCCrr : F3_1<2, 0b010100, 
287                    (ops IntRegs:$dst, IntRegs:$b, IntRegs:$c),
288                    "subcc $b, $c, $dst">;
289 def SUBCCri : F3_2<2, 0b010100,
290                    (ops IntRegs:$dst, IntRegs:$b, i32imm:$c),
291                    "subcc $b, $c, $dst">;
292 def SUBXrr  : F3_1<2, 0b001100, 
293                    (ops IntRegs:$dst, IntRegs:$b, IntRegs:$c),
294                    "subx $b, $c, $dst">;
295 def SUBXri  : F3_2<2, 0b001100,
296                    (ops IntRegs:$dst, IntRegs:$b, i32imm:$c),
297                    "subx $b, $c, $dst">;
298 def SUBXCCrr: F3_1<2, 0b011100, 
299                    (ops IntRegs:$dst, IntRegs:$b, IntRegs:$c),
300                    "subxcc $b, $c, $dst">;
301 def SUBXCCri: F3_2<2, 0b011100,
302                    (ops IntRegs:$dst, IntRegs:$b, i32imm:$c),
303                    "subxcc $b, $c, $dst">;
304
305 // Section B.18 - Multiply Instructions, p. 113
306 def UMULrr  : F3_1<2, 0b001010, 
307                    (ops IntRegs:$dst, IntRegs:$b, IntRegs:$c),
308                    "umul $b, $c, $dst">;
309 def UMULri  : F3_2<2, 0b001010,
310                    (ops IntRegs:$dst, IntRegs:$b, i32imm:$c),
311                    "umul $b, $c, $dst">;
312 def SMULrr  : F3_1<2, 0b001011, 
313                    (ops IntRegs:$dst, IntRegs:$b, IntRegs:$c),
314                    "smul $b, $c, $dst">;
315 def SMULri  : F3_2<2, 0b001011,
316                    (ops IntRegs:$dst, IntRegs:$b, i32imm:$c),
317                    "smul $b, $c, $dst">;
318 def UMULCCrr: F3_1<2, 0b011010, 
319                    (ops IntRegs:$dst, IntRegs:$b, IntRegs:$c),
320                    "umulcc $b, $c, $dst">;
321 def UMULCCri: F3_2<2, 0b011010,
322                    (ops IntRegs:$dst, IntRegs:$b, i32imm:$c),
323                    "umulcc $b, $c, $dst">;
324 def SMULCCrr: F3_1<2, 0b011011, 
325                    (ops IntRegs:$dst, IntRegs:$b, IntRegs:$c),
326                    "smulcc $b, $c, $dst">;
327 def SMULCCri: F3_2<2, 0b011011,
328                    (ops IntRegs:$dst, IntRegs:$b, i32imm:$c),
329                    "smulcc $b, $c, $dst">;
330
331 // Section B.19 - Divide Instructions, p. 115
332 def UDIVrr   : F3_1<2, 0b001110, 
333                     (ops IntRegs:$dst, IntRegs:$b, IntRegs:$c),
334                     "udiv $b, $c, $dst">;
335 def UDIVri   : F3_2<2, 0b001110,
336                     (ops IntRegs:$dst, IntRegs:$b, i32imm:$c),
337                     "udiv $b, $c, $dst">;
338 def SDIVrr   : F3_1<2, 0b001111,
339                     (ops IntRegs:$dst, IntRegs:$b, IntRegs:$c),
340                     "sdiv $b, $c, $dst">;
341 def SDIVri   : F3_2<2, 0b001111,
342                     (ops IntRegs:$dst, IntRegs:$b, i32imm:$c),
343                     "sdiv $b, $c, $dst">;
344 def UDIVCCrr : F3_1<2, 0b011110,
345                     (ops IntRegs:$dst, IntRegs:$b, IntRegs:$c),
346                     "udivcc $b, $c, $dst">;
347 def UDIVCCri : F3_2<2, 0b011110,
348                     (ops IntRegs:$dst, IntRegs:$b, i32imm:$c),
349                     "udivcc $b, $c, $dst">;
350 def SDIVCCrr : F3_1<2, 0b011111,
351                     (ops IntRegs:$dst, IntRegs:$b, IntRegs:$c),
352                     "sdivcc $b, $c, $dst">;
353 def SDIVCCri : F3_2<2, 0b011111,
354                     (ops IntRegs:$dst, IntRegs:$b, i32imm:$c),
355                     "sdivcc $b, $c, $dst">;
356
357 // Section B.20 - SAVE and RESTORE, p. 117
358 def SAVErr    : F3_1<2, 0b111100,
359                      (ops IntRegs:$dst, IntRegs:$b, IntRegs:$c),
360                      "save $b, $c, $dst">;
361 def SAVEri    : F3_2<2, 0b111100,
362                      (ops IntRegs:$dst, IntRegs:$b, i32imm:$c),
363                      "save $b, $c, $dst">;
364 def RESTORErr : F3_1<2, 0b111101,
365                      (ops IntRegs:$dst, IntRegs:$b, IntRegs:$c),
366                      "restore $b, $c, $dst">;
367 def RESTOREri : F3_2<2, 0b111101,
368                      (ops IntRegs:$dst, IntRegs:$b, i32imm:$c),
369                      "restore $b, $c, $dst">;
370
371 // Section B.21 - Branch on Integer Condition Codes Instructions, p. 119
372
373 // conditional branch class:
374 class BranchV8<bits<4> cc, string nm> : F2_2<cc, 0b010, nm> {
375   let isBranch = 1;
376   let isTerminator = 1;
377   let hasDelaySlot = 1;
378 }
379
380 let isBarrier = 1 in
381   def BA   : BranchV8<0b1000, "ba">;
382 def BN   : BranchV8<0b0000, "bn">;
383 def BNE  : BranchV8<0b1001, "bne">;
384 def BE   : BranchV8<0b0001, "be">;
385 def BG   : BranchV8<0b1010, "bg">;
386 def BLE  : BranchV8<0b0010, "ble">;
387 def BGE  : BranchV8<0b1011, "bge">;
388 def BL   : BranchV8<0b0011, "bl">;
389 def BGU  : BranchV8<0b1100, "bgu">;
390 def BLEU : BranchV8<0b0100, "bleu">;
391 def BCC  : BranchV8<0b1101, "bcc">;
392 def BCS  : BranchV8<0b0101, "bcs">;
393
394 // Section B.22 - Branch on Floating-point Condition Codes Instructions, p. 121
395
396 // floating-point conditional branch class:
397 class FPBranchV8<bits<4> cc, string nm> : F2_2<cc, 0b110, nm> {
398   let isBranch = 1;
399   let isTerminator = 1;
400   let hasDelaySlot = 1;
401 }
402
403 def FBA  : FPBranchV8<0b1000, "fba">;
404 def FBN  : FPBranchV8<0b0000, "fbn">;
405 def FBU  : FPBranchV8<0b0111, "fbu">;
406 def FBG  : FPBranchV8<0b0110, "fbg">;
407 def FBUG : FPBranchV8<0b0101, "fbug">;
408 def FBL  : FPBranchV8<0b0100, "fbl">;
409 def FBUL : FPBranchV8<0b0011, "fbul">;
410 def FBLG : FPBranchV8<0b0010, "fblg">;
411 def FBNE : FPBranchV8<0b0001, "fbne">;
412 def FBE  : FPBranchV8<0b1001, "fbe">;
413 def FBUE : FPBranchV8<0b1010, "fbue">;
414 def FBGE : FPBranchV8<0b1011, "fbge">;
415 def FBUGE: FPBranchV8<0b1100, "fbuge">;
416 def FBLE : FPBranchV8<0b1101, "fble">;
417 def FBULE: FPBranchV8<0b1110, "fbule">;
418 def FBO  : FPBranchV8<0b1111, "fbo">;
419
420
421
422 // Section B.24 - Call and Link Instruction, p. 125
423 // This is the only Format 1 instruction
424 let Uses = [O0, O1, O2, O3, O4, O5], hasDelaySlot = 1, isCall = 1 in { 
425   // pc-relative call:
426   let Defs = [O0, O1, O2, O3, O4, O5, O7, G1, G2, G3, G4, G5, G6, G7,
427     D0, D1, D2, D3, D4, D5, D6, D7, D8, D9, D10, D11, D12, D13, D14, D15] in
428   def CALL : InstV8 {
429     bits<30> disp;
430     let op = 1;
431     let Inst{29-0} = disp;
432     let Name = "call";
433   }
434
435   // indirect call (O7 is an EXPLICIT def in indirect calls, so it cannot also
436   // be an implicit def):
437   let Defs = [O0, O1, O2, O3, O4, O5, G1, G2, G3, G4, G5, G6, G7,
438     D0, D1, D2, D3, D4, D5, D6, D7, D8, D9, D10, D11, D12, D13, D14, D15] in
439   def JMPLrr : F3_1<2, 0b111000,
440                     (ops IntRegs:$dst, IntRegs:$b, IntRegs:$c),
441                     "jmpl $b+$c, $dst">;
442 }
443
444 // Section B.29 - Write State Register Instructions
445 def WRrr : F3_1<2, 0b110000,
446                 (ops IntRegs:$dst, IntRegs:$b, IntRegs:$c),
447                 "wr $b, $c, $dst">;
448 def WRri : F3_2<2, 0b110000,
449                 (ops IntRegs:$dst, IntRegs:$b, i32imm:$c),
450                 "wr $b, $c, $dst">;
451
452 // Convert Integer to Floating-point Instructions, p. 141
453 def FITOS : F3_3<2, 0b110100, 0b011000100, "fitos">;
454 def FITOD : F3_3<2, 0b110100, 0b011001000, "fitod">;
455
456 // Convert Floating-point to Integer Instructions, p. 142
457 def FSTOI : F3_3<2, 0b110100, 0b011010001, "fstoi">;
458 def FDTOI : F3_3<2, 0b110100, 0b011010010, "fdtoi">;
459
460 // Convert between Floating-point Formats Instructions, p. 143
461 def FSTOD : F3_3<2, 0b110100, 0b011001001, "fstod">;
462 def FDTOS : F3_3<2, 0b110100, 0b011000110, "fdtos">;
463
464 // Floating-point Move Instructions, p. 144
465 def FMOVS : F3_3<2, 0b110100, 0b000000001, "fmovs">;
466 def FNEGS : F3_3<2, 0b110100, 0b000000101, "fnegs">;
467 def FABSS : F3_3<2, 0b110100, 0b000001001, "fabss">;
468
469 // Floating-point Add and Subtract Instructions, p. 146
470 def FADDS  : F3_3<2, 0b110100, 0b001000001, "fadds">;
471 def FADDD  : F3_3<2, 0b110100, 0b001000010, "faddd">;
472 def FSUBS  : F3_3<2, 0b110100, 0b001000101, "fsubs">;
473 def FSUBD  : F3_3<2, 0b110100, 0b001000110, "fsubd">;
474
475 // Floating-point Multiply and Divide Instructions, p. 147
476 def FMULS  : F3_3<2, 0b110100, 0b001001001, "fmuls">;
477 def FMULD  : F3_3<2, 0b110100, 0b001001010, "fmuld">;
478 def FSMULD : F3_3<2, 0b110100, 0b001101001, "fsmuld">;
479 def FDIVS  : F3_3<2, 0b110100, 0b001001101, "fdivs">;
480 def FDIVD  : F3_3<2, 0b110100, 0b001001110, "fdivd">;
481
482 // Floating-point Compare Instructions, p. 148
483 // Note: the 2nd template arg is different for these guys.
484 // Note 2: the result of a FCMP is not available until the 2nd cycle
485 // after the instr is retired, but there is no interlock. This behavior
486 // is modelled as a delay slot.
487 let hasDelaySlot = 1 in {
488   def FCMPS  : F3_3<2, 0b110101, 0b001010001, "fcmps">;
489   def FCMPD  : F3_3<2, 0b110101, 0b001010010, "fcmpd">;
490   def FCMPES : F3_3<2, 0b110101, 0b001010101, "fcmpes">;
491   def FCMPED : F3_3<2, 0b110101, 0b001010110, "fcmped">;
492 }
493