1 //===- IA64InstrInfo.td - Describe the IA64 Instruction Set -----*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file was developed by Duraid Madina and is distributed under the
6 // University of Illinois Open Source License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This file describes the IA64 instruction set, defining the instructions, and
11 // properties of the instructions which are needed for code generation, machine
12 // code emission, and analysis.
14 //===----------------------------------------------------------------------===//
16 include "IA64InstrFormats.td"
18 def u2imm : Operand<i8>;
19 def u6imm : Operand<i8>;
20 def s8imm : Operand<i8> {
21 let PrintMethod = "printS8ImmOperand";
23 def s14imm : Operand<i64> {
24 let PrintMethod = "printS14ImmOperand";
26 def s22imm : Operand<i32> {
27 let PrintMethod = "printS22ImmOperand";
29 def u64imm : Operand<i64> {
30 let PrintMethod = "printU64ImmOperand";
32 def s64imm : Operand<i64> {
33 let PrintMethod = "printS64ImmOperand";
36 let PrintMethod = "printGlobalOperand" in
37 def globaladdress : Operand<i64>;
39 // the asmprinter needs to know about calls
40 let PrintMethod = "printCallOperand" in
41 def calltarget : Operand<i64>;
43 /* new daggy action!!! */
45 def is32ones : PatLeaf<(i64 imm), [{
46 // is32ones predicate - True if the immediate is 0x00000000FFFFFFFF
47 // Used to create ZXT4s appropriately
48 int64_t v = (int64_t)N->getValue();
49 return (v == 0x00000000FFFFFFFFLL);
52 def isSHLADDimm: PatLeaf<(i64 imm), [{
53 // isSHLADDimm predicate - True if the immediate is exactly 1, 2, 3 or 4
55 // Used to create shladd instructions appropriately
56 int64_t v = (int64_t)N->getValue();
57 return (v >= 1 && v <= 4);
60 def immSExt14 : PatLeaf<(i64 imm), [{
61 // immSExt14 predicate - True if the immediate fits in a 14-bit sign extended
62 // field. Used by instructions like 'adds'.
63 int64_t v = (int64_t)N->getValue();
64 return (v <= 8191 && v >= -8192);
67 def imm64 : PatLeaf<(i64 imm), [{
68 // imm64 predicate - True if the immediate fits in a 64-bit
69 // field - i.e., true. used to keep movl happy
73 def SXT1 : AForm_DAG<0x03, 0x0b, (ops GR:$dst, GR:$src), "sxt1 $dst = $src;;",
74 [(set GR:$dst, (sext_inreg GR:$src, i8))]>;
75 def ZXT1 : AForm_DAG<0x03, 0x0b, (ops GR:$dst, GR:$src), "zxt1 $dst = $src;;",
76 [(set GR:$dst, (and GR:$src, 255))]>;
77 def SXT2 : AForm_DAG<0x03, 0x0b, (ops GR:$dst, GR:$src), "sxt2 $dst = $src;;",
78 [(set GR:$dst, (sext_inreg GR:$src, i16))]>;
79 def ZXT2 : AForm_DAG<0x03, 0x0b, (ops GR:$dst, GR:$src), "zxt2 $dst = $src;;",
80 [(set GR:$dst, (and GR:$src, 65535))]>;
81 def SXT4 : AForm_DAG<0x03, 0x0b, (ops GR:$dst, GR:$src), "sxt4 $dst = $src;;",
82 [(set GR:$dst, (sext_inreg GR:$src, i32))]>;
83 def ZXT4 : AForm_DAG<0x03, 0x0b, (ops GR:$dst, GR:$src), "zxt4 $dst = $src;;",
84 [(set GR:$dst, (and GR:$src, is32ones))]>;
86 def ADD : AForm_DAG<0x03, 0x0b, (ops GR:$dst, GR:$src1, GR:$src2),
87 "add $dst = $src1, $src2;;",
88 [(set GR:$dst, (add GR:$src1, GR:$src2))]>;
90 def ADD1 : AForm_DAG<0x03, 0x0b, (ops GR:$dst, GR:$src1, GR:$src2),
91 "add $dst = $src1, $src2, 1;;",
92 [(set GR:$dst, (add (add GR:$src1, GR:$src2), 1))]>;
94 def ADDS : AForm_DAG<0x03, 0x0b, (ops GR:$dst, GR:$src1, s14imm:$imm),
95 "adds $dst = $imm, $src1;;",
96 [(set GR:$dst, (add GR:$src1, immSExt14:$imm))]>;
98 def MOVL : AForm_DAG<0x03, 0x0b, (ops GR:$dst, s64imm:$imm),
100 [(set GR:$dst, imm64:$imm)]>;
102 def ADDL_GA : AForm_DAG<0x03, 0x0b, (ops GR:$dst, GR:$src1, globaladdress:$imm),
103 "addl $dst = $imm, $src1;;",
106 def SUB : AForm_DAG<0x03, 0x0b, (ops GR:$dst, GR:$src1, GR:$src2),
107 "sub $dst = $src1, $src2;;",
108 [(set GR:$dst, (sub GR:$src1, GR:$src2))]>;
110 def SUB1 : AForm_DAG<0x03, 0x0b, (ops GR:$dst, GR:$src1, GR:$src2),
111 "sub $dst = $src1, $src2, 1;;",
112 [(set GR:$dst, (add (sub GR: $src1, GR:$src2), -1))]>;
114 def GETFSIGD : AForm_DAG<0x03, 0x0b, (ops GR:$dst, FP:$src),
115 "getf.sig $dst = $src;;",
118 def SETFSIGD : AForm_DAG<0x03, 0x0b, (ops FP:$dst, GR:$src),
119 "setf.sig $dst = $src;;",
122 def XMALD : AForm_DAG<0x03, 0x0b, (ops FP:$dst, FP:$src1, FP:$src2, FP:$src3),
123 "xma.l $dst = $src1, $src2, $src3;;",
126 // pseudocode for integer multiplication
127 def : Pat<(mul GR:$src1, GR:$src2),
128 (GETFSIGD (XMALD (SETFSIGD GR:$src1), (SETFSIGD GR:$src2), F0))>;
130 // TODO: addp4 (addp4 dst = src, r0 is a 32-bit add)
133 // def ADDS : AForm<0x03, 0x0b, (ops GR:$dst, GR:$src1, s14imm:$imm),
134 // "adds $dst = $imm, $src1;;">;
136 // load constants of various sizes // FIXME: prettyprint -ve constants
137 def : Pat<(i64 immSExt14:$imm), (ADDS r0, immSExt14:$imm)>;
138 def : Pat<(i64 imm64:$imm), (MOVL imm64:$imm)>;
139 // TODO: def : Pat<(i1 1), (MOV p0)>;
141 def AND : AForm_DAG<0x03, 0x0b, (ops GR:$dst, GR:$src1, GR:$src2),
142 "and $dst = $src1, $src2;;",
143 [(set GR:$dst, (and GR:$src1, GR:$src2))]>;
144 def ANDCM : AForm_DAG<0x03, 0x0b, (ops GR:$dst, GR:$src1, GR:$src2),
145 "andcm $dst = $src1, $src2;;",
146 [(set GR:$dst, (and GR:$src1, (not GR:$src2)))]>;
147 // TODO: and/andcm/or/xor/add/sub/shift immediate forms
148 def OR : AForm_DAG<0x03, 0x0b, (ops GR:$dst, GR:$src1, GR:$src2),
149 "or $dst = $src1, $src2;;",
150 [(set GR:$dst, (or GR:$src1, GR:$src2))]>;
152 def pOR : AForm<0x03, 0x0b, (ops GR:$dst, GR:$src1, GR:$src2, PR:$qp),
153 "($qp) or $dst = $src1, $src2;;">;
155 def PCMPEQUNCR0R0 : AForm<0x03, 0x0b, (ops PR:$dst, PR:$qp),
156 "($qp) cmp.eq.unc $dst, p0 = r0, r0;;">;
158 let isTwoAddress=1 in
159 def TPCMPEQR0R0 : AForm<0x03, 0x0b, (ops PR:$dst, PR:$bogus, PR:$qp),
160 "($qp) cmp.eq $dst, p0 = r0, r0;;">;
162 /* our pseudocode for OR on predicates is:
168 (pA) cmp.eq.unc pC,p0 = r0,r0 // pC = pA
170 (pB) cmp.eq pC,p0 = r0,r0 // if (pB) pC = 1
174 let isTwoAddress = 1 in {
175 def TPCMPEQ : AForm<0x03, 0x0b,
176 (ops PR:$dst, PR:$src2, GR:$src3, GR:$src4, PR:$qp),
177 "($qp) cmp.eq $dst, p0 = $src3, $src4;;">;
181 // FIXME: these are bogus
182 def bOR : Pat<(or PR:$src1, PR:$src2),
183 (PCMPEQUNCR0R0 PR:$src1)>;
185 def bXOR : Pat<(xor PR:$src1, PR:$src2),
186 (PCMPEQUNCR0R0 PR:$src1)>;
188 def XOR : AForm_DAG<0x03, 0x0b, (ops GR:$dst, GR:$src1, GR:$src2),
189 "xor $dst = $src1, $src2;;",
190 [(set GR:$dst, (xor GR:$src1, GR:$src2))]>;
192 def SHLADD: AForm_DAG<0x03, 0x0b, (ops GR:$dst,GR:$src1,s64imm:$imm,GR:$src2),
193 "shladd $dst = $src1, $imm, $src2;;",
194 [(set GR:$dst, (add GR:$src2, (shl GR:$src1, isSHLADDimm:$imm)))]>;
196 def SHL : AForm_DAG<0x03, 0x0b, (ops GR:$dst, GR:$src1, GR:$src2),
197 "shl $dst = $src1, $src2;;",
198 [(set GR:$dst, (shl GR:$src1, GR:$src2))]>;
200 def SHRU : AForm_DAG<0x03, 0x0b, (ops GR:$dst, GR:$src1, GR:$src2),
201 "shr.u $dst = $src1, $src2;;",
202 [(set GR:$dst, (srl GR:$src1, GR:$src2))]>;
204 def SHRS : AForm_DAG<0x03, 0x0b, (ops GR:$dst, GR:$src1, GR:$src2),
205 "shr $dst = $src1, $src2;;",
206 [(set GR:$dst, (sra GR:$src1, GR:$src2))]>;
209 def CMPEQ : AForm<0x03, 0x0b, (ops PR:$dst, GR:$src1, GR:$src2),
210 "cmp.eq $dst, p0 = $src1, $src2;;">;
211 def CMPGT : AForm<0x03, 0x0b, (ops PR:$dst, GR:$src1, GR:$src2),
212 "cmp.gt $dst, p0 = $src1, $src2;;">;
213 def CMPGE : AForm<0x03, 0x0b, (ops PR:$dst, GR:$src1, GR:$src2),
214 "cmp.ge $dst, p0 = $src1, $src2;;">;
215 def CMPLT : AForm<0x03, 0x0b, (ops PR:$dst, GR:$src1, GR:$src2),
216 "cmp.lt $dst, p0 = $src1, $src2;;">;
217 def CMPLE : AForm<0x03, 0x0b, (ops PR:$dst, GR:$src1, GR:$src2),
218 "cmp.le $dst, p0 = $src1, $src2;;">;
219 def CMPNE : AForm<0x03, 0x0b, (ops PR:$dst, GR:$src1, GR:$src2),
220 "cmp.ne $dst, p0 = $src1, $src2;;">;
221 def CMPLTU : AForm<0x03, 0x0b, (ops PR:$dst, GR:$src1, GR:$src2),
222 "cmp.ltu $dst, p0 = $src1, $src2;;">;
223 def CMPGTU : AForm<0x03, 0x0b, (ops PR:$dst, GR:$src1, GR:$src2),
224 "cmp.gtu $dst, p0 = $src1, $src2;;">;
225 def CMPLEU : AForm<0x03, 0x0b, (ops PR:$dst, GR:$src1, GR:$src2),
226 "cmp.leu $dst, p0 = $src1, $src2;;">;
227 def CMPGEU : AForm<0x03, 0x0b, (ops PR:$dst, GR:$src1, GR:$src2),
228 "cmp.geu $dst, p0 = $src1, $src2;;">;
231 // the following are all a bit unfortunate: we throw away the complement
233 def CMPEQ : AForm_DAG<0x03, 0x0b, (ops PR:$dst, GR:$src1, GR:$src2),
234 "cmp.eq $dst, p0 = $src1, $src2;;",
235 [(set PR:$dst, (seteq GR:$src1, GR:$src2))]>;
236 def CMPGT : AForm_DAG<0x03, 0x0b, (ops PR:$dst, GR:$src1, GR:$src2),
237 "cmp.gt $dst, p0 = $src1, $src2;;",
238 [(set PR:$dst, (setgt GR:$src1, GR:$src2))]>;
239 def CMPGE : AForm_DAG<0x03, 0x0b, (ops PR:$dst, GR:$src1, GR:$src2),
240 "cmp.ge $dst, p0 = $src1, $src2;;",
241 [(set PR:$dst, (setge GR:$src1, GR:$src2))]>;
242 def CMPLT : AForm_DAG<0x03, 0x0b, (ops PR:$dst, GR:$src1, GR:$src2),
243 "cmp.lt $dst, p0 = $src1, $src2;;",
244 [(set PR:$dst, (setlt GR:$src1, GR:$src2))]>;
245 def CMPLE : AForm_DAG<0x03, 0x0b, (ops PR:$dst, GR:$src1, GR:$src2),
246 "cmp.le $dst, p0 = $src1, $src2;;",
247 [(set PR:$dst, (setle GR:$src1, GR:$src2))]>;
248 def CMPNE : AForm_DAG<0x03, 0x0b, (ops PR:$dst, GR:$src1, GR:$src2),
249 "cmp.ne $dst, p0 = $src1, $src2;;",
250 [(set PR:$dst, (setne GR:$src1, GR:$src2))]>;
251 def CMPLTU: AForm_DAG<0x03, 0x0b, (ops PR:$dst, GR:$src1, GR:$src2),
252 "cmp.eq $dst, p0 = $src1, $src2;;",
253 [(set PR:$dst, (setult GR:$src1, GR:$src2))]>;
254 def CMPGTU: AForm_DAG<0x03, 0x0b, (ops PR:$dst, GR:$src1, GR:$src2),
255 "cmp.eq $dst, p0 = $src1, $src2;;",
256 [(set PR:$dst, (setugt GR:$src1, GR:$src2))]>;
257 def CMPLEU: AForm_DAG<0x03, 0x0b, (ops PR:$dst, GR:$src1, GR:$src2),
258 "cmp.eq $dst, p0 = $src1, $src2;;",
259 [(set PR:$dst, (setule GR:$src1, GR:$src2))]>;
260 def CMPGEU: AForm_DAG<0x03, 0x0b, (ops PR:$dst, GR:$src1, GR:$src2),
261 "cmp.eq $dst, p0 = $src1, $src2;;",
262 [(set PR:$dst, (setuge GR:$src1, GR:$src2))]>;
264 // TODO: support postincrement (reg, imm9) loads+stores - this needs more
267 def PHI : PseudoInstIA64<(ops variable_ops), "PHI">;
268 def IDEF : PseudoInstIA64<(ops variable_ops), "// IDEF">;
269 def IUSE : PseudoInstIA64<(ops variable_ops), "// IUSE">;
270 def ADJUSTCALLSTACKUP : PseudoInstIA64<(ops variable_ops),
271 "// ADJUSTCALLSTACKUP">;
272 def ADJUSTCALLSTACKDOWN : PseudoInstIA64<(ops variable_ops),
273 "// ADJUSTCALLSTACKDOWN">;
274 def PSEUDO_ALLOC : PseudoInstIA64<(ops GR:$foo), "// PSEUDO_ALLOC">;
276 def ALLOC : AForm<0x03, 0x0b,
277 (ops GR:$dst, i8imm:$inputs, i8imm:$locals, i8imm:$outputs, i8imm:$rotating),
278 "alloc $dst = ar.pfs,$inputs,$locals,$outputs,$rotating;;">;
280 def MOV : AForm<0x03, 0x0b, (ops GR:$dst, GR:$src), "mov $dst = $src;;">;
281 def PMOV : AForm<0x03, 0x0b, (ops GR:$dst, GR:$src, PR:$qp),
282 "($qp) mov $dst = $src;;">;
284 def SPILL_ALL_PREDICATES_TO_GR : AForm<0x03, 0x0b, (ops GR:$dst),
286 def FILL_ALL_PREDICATES_FROM_GR : AForm<0x03, 0x0b, (ops GR:$src),
289 let isTwoAddress = 1 in {
290 def CMOV : AForm<0x03, 0x0b, (ops GR:$dst, GR:$src2, GR:$src, PR:$qp),
291 "($qp) mov $dst = $src;;">;
294 def PFMOV : AForm<0x03, 0x0b, (ops FP:$dst, FP:$src, PR:$qp),
295 "($qp) mov $dst = $src;;">;
297 let isTwoAddress = 1 in {
298 def CFMOV : AForm<0x03, 0x0b, (ops FP:$dst, FP:$src2, FP:$src, PR:$qp),
299 "($qp) mov $dst = $src;;">;
302 let isTwoAddress = 1 in {
303 def TCMPNE : AForm<0x03, 0x0b,
304 (ops PR:$dst, PR:$src2, GR:$src3, GR:$src4),
305 "cmp.ne $dst, p0 = $src3, $src4;;">;
307 def TPCMPEQOR : AForm<0x03, 0x0b,
308 (ops PR:$dst, PR:$src2, GR:$src3, GR:$src4, PR:$qp),
309 "($qp) cmp.eq.or $dst, p0 = $src3, $src4;;">;
311 def TPCMPNE : AForm<0x03, 0x0b,
312 (ops PR:$dst, PR:$src2, GR:$src3, GR:$src4, PR:$qp),
313 "($qp) cmp.ne $dst, p0 = $src3, $src4;;">;
315 def TPCMPEQ : AForm<0x03, 0x0b,
316 (ops PR:$dst, PR:$src2, GR:$src3, GR:$src4, PR:$qp),
317 "($qp) cmp.eq $dst, p0 = $src3, $src4;;">;
320 def MOVSIMM14 : AForm<0x03, 0x0b, (ops GR:$dst, s14imm:$imm),
321 "mov $dst = $imm;;">;
322 def MOVSIMM22 : AForm<0x03, 0x0b, (ops GR:$dst, s22imm:$imm),
323 "mov $dst = $imm;;">;
324 def MOVLIMM64 : AForm<0x03, 0x0b, (ops GR:$dst, s64imm:$imm),
325 "movl $dst = $imm;;">;
327 def SHLI : AForm<0x03, 0x0b, (ops GR:$dst, GR:$src1, u6imm:$imm),
328 "shl $dst = $src1, $imm;;">;
329 def SHRUI : AForm<0x03, 0x0b, (ops GR:$dst, GR:$src1, u6imm:$imm),
330 "shr.u $dst = $src1, $imm;;">;
331 def SHRSI : AForm<0x03, 0x0b, (ops GR:$dst, GR:$src1, u6imm:$imm),
332 "shr $dst = $src1, $imm;;">;
334 def EXTRU : AForm<0x03, 0x0b, (ops GR:$dst, GR:$src1, u6imm:$imm1, u6imm:$imm2),
335 "extr.u $dst = $src1, $imm1, $imm2;;">;
337 def DEPZ : AForm<0x03, 0x0b, (ops GR:$dst, GR:$src1, u6imm:$imm1, u6imm:$imm2), "dep.z $dst = $src1, $imm1, $imm2;;">;
339 // and we do the whole thing again for FP compares!
340 def FCMPEQ : AForm<0x03, 0x0b, (ops PR:$dst, FP:$src1, FP:$src2),
341 "fcmp.eq $dst, p0 = $src1, $src2;;">;
342 def FCMPGT : AForm<0x03, 0x0b, (ops PR:$dst, FP:$src1, FP:$src2),
343 "fcmp.gt $dst, p0 = $src1, $src2;;">;
344 def FCMPGE : AForm<0x03, 0x0b, (ops PR:$dst, FP:$src1, FP:$src2),
345 "fcmp.ge $dst, p0 = $src1, $src2;;">;
346 def FCMPLT : AForm<0x03, 0x0b, (ops PR:$dst, FP:$src1, FP:$src2),
347 "fcmp.lt $dst, p0 = $src1, $src2;;">;
348 def FCMPLE : AForm<0x03, 0x0b, (ops PR:$dst, FP:$src1, FP:$src2),
349 "fcmp.le $dst, p0 = $src1, $src2;;">;
350 def FCMPNE : AForm<0x03, 0x0b, (ops PR:$dst, FP:$src1, FP:$src2),
351 "fcmp.neq $dst, p0 = $src1, $src2;;">;
352 def FCMPLTU : AForm<0x03, 0x0b, (ops PR:$dst, FP:$src1, FP:$src2),
353 "fcmp.ltu $dst, p0 = $src1, $src2;;">;
354 def FCMPGTU : AForm<0x03, 0x0b, (ops PR:$dst, FP:$src1, FP:$src2),
355 "fcmp.gtu $dst, p0 = $src1, $src2;;">;
356 def FCMPLEU : AForm<0x03, 0x0b, (ops PR:$dst, FP:$src1, FP:$src2),
357 "fcmp.leu $dst, p0 = $src1, $src2;;">;
358 def FCMPGEU : AForm<0x03, 0x0b, (ops PR:$dst, FP:$src1, FP:$src2),
359 "fcmp.geu $dst, p0 = $src1, $src2;;">;
361 def PCMPEQOR : AForm<0x03, 0x0b, (ops PR:$dst, GR:$src1, GR:$src2, PR:$qp),
362 "($qp) cmp.eq.or $dst, p0 = $src1, $src2;;">;
363 def PCMPEQUNC : AForm<0x03, 0x0b, (ops PR:$dst, GR:$src1, GR:$src2, PR:$qp),
364 "($qp) cmp.eq.unc $dst, p0 = $src1, $src2;;">;
365 def PCMPNE : AForm<0x03, 0x0b, (ops PR:$dst, GR:$src1, GR:$src2, PR:$qp),
366 "($qp) cmp.ne $dst, p0 = $src1, $src2;;">;
369 def BCMPEQ : AForm<0x03, 0x0b, (ops PR:$dst1, PR:$dst2, GR:$src1, GR:$src2),
370 "cmp.eq $dst1, dst2 = $src1, $src2;;">;
372 def ADDIMM14 : AForm<0x03, 0x0b, (ops GR:$dst, GR:$src1, s14imm:$imm),
373 "adds $dst = $imm, $src1;;">;
375 def ADDIMM22 : AForm<0x03, 0x0b, (ops GR:$dst, GR:$src1, s22imm:$imm),
376 "add $dst = $imm, $src1;;">;
377 def CADDIMM22 : AForm<0x03, 0x0b, (ops GR:$dst, GR:$src1, s22imm:$imm, PR:$qp),
378 "($qp) add $dst = $imm, $src1;;">;
380 let isTwoAddress = 1 in {
381 def TPCADDIMM22 : AForm<0x03, 0x0b,
382 (ops GR:$dst, GR:$src1, s22imm:$imm, PR:$qp),
383 "($qp) add $dst = $imm, $dst;;">;
384 def TPCMPIMM8NE : AForm<0x03, 0x0b,
385 (ops PR:$dst, PR:$src1, s22imm:$imm, GR:$src2, PR:$qp),
386 "($qp) cmp.ne $dst , p0 = $imm, $src2;;">;
389 def SUBIMM8 : AForm<0x03, 0x0b, (ops GR:$dst, s8imm:$imm, GR:$src2),
390 "sub $dst = $imm, $src2;;">;
392 def ST1 : AForm<0x03, 0x0b, (ops GR:$dstPtr, GR:$value),
393 "st1 [$dstPtr] = $value;;">;
394 def ST2 : AForm<0x03, 0x0b, (ops GR:$dstPtr, GR:$value),
395 "st2 [$dstPtr] = $value;;">;
396 def ST4 : AForm<0x03, 0x0b, (ops GR:$dstPtr, GR:$value),
397 "st4 [$dstPtr] = $value;;">;
398 def ST8 : AForm<0x03, 0x0b, (ops GR:$dstPtr, GR:$value),
399 "st8 [$dstPtr] = $value;;">;
401 def LD1 : AForm<0x03, 0x0b, (ops GR:$dst, GR:$srcPtr),
402 "ld1 $dst = [$srcPtr];;">;
403 def LD2 : AForm<0x03, 0x0b, (ops GR:$dst, GR:$srcPtr),
404 "ld2 $dst = [$srcPtr];;">;
405 def LD4 : AForm<0x03, 0x0b, (ops GR:$dst, GR:$srcPtr),
406 "ld4 $dst = [$srcPtr];;">;
407 def LD8 : AForm<0x03, 0x0b, (ops GR:$dst, GR:$srcPtr),
408 "ld8 $dst = [$srcPtr];;">;
410 def POPCNT : AForm<0x03, 0x0b, (ops GR:$dst, GR:$src), "popcnt $dst = $src;;">;
413 def FADD : AForm<0x03, 0x0b, (ops FP:$dst, FP:$src1, FP:$src2),
414 "fadd $dst = $src1, $src2;;">;
415 def FADDS: AForm<0x03, 0x0b, (ops FP:$dst, FP:$src1, FP:$src2),
416 "fadd.s $dst = $src1, $src2;;">;
417 def FSUB : AForm<0x03, 0x0b, (ops FP:$dst, FP:$src1, FP:$src2),
418 "fsub $dst = $src1, $src2;;">;
419 def FMPY : AForm<0x03, 0x0b, (ops FP:$dst, FP:$src1, FP:$src2),
420 "fmpy $dst = $src1, $src2;;">;
421 def FMOV : AForm<0x03, 0x0b, (ops FP:$dst, FP:$src),
422 "mov $dst = $src;;">; // XXX: there _is_ no fmov
423 def FMA : AForm<0x03, 0x0b, (ops FP:$dst, FP:$src1, FP:$src2, FP:$src3),
424 "fma $dst = $src1, $src2, $src3;;">;
425 def FMS : AForm<0x03, 0x0b, (ops FP:$dst, FP:$src1, FP:$src2, FP:$src3),
426 "fms $dst = $src1, $src2, $src3;;">;
427 def FNMA : AForm<0x03, 0x0b, (ops FP:$dst, FP:$src1, FP:$src2, FP:$src3),
428 "fnma $dst = $src1, $src2, $src3;;">;
429 def FABS : AForm<0x03, 0x0b, (ops FP:$dst, FP:$src),
430 "fabs $dst = $src;;">;
431 def FNEG : AForm<0x03, 0x0b, (ops FP:$dst, FP:$src),
432 "fneg $dst = $src;;">;
433 def FNEGABS : AForm<0x03, 0x0b, (ops FP:$dst, FP:$src),
434 "fnegabs $dst = $src;;">;
436 def CFMAS1 : AForm<0x03, 0x0b,
437 (ops FP:$dst, FP:$src1, FP:$src2, FP:$src3, PR:$qp),
438 "($qp) fma.s1 $dst = $src1, $src2, $src3;;">;
439 def CFNMAS1 : AForm<0x03, 0x0b,
440 (ops FP:$dst, FP:$src1, FP:$src2, FP:$src3, PR:$qp),
441 "($qp) fnma.s1 $dst = $src1, $src2, $src3;;">;
443 def FRCPAS1 : AForm<0x03, 0x0b, (ops FP:$dstFR, PR:$dstPR, FP:$src1, FP:$src2),
444 "frcpa.s1 $dstFR, $dstPR = $src1, $src2;;">;
446 def XMAL : AForm<0x03, 0x0b, (ops FP:$dst, FP:$src1, FP:$src2, FP:$src3),
447 "xma.l $dst = $src1, $src2, $src3;;">;
449 def FCVTXF : AForm<0x03, 0x0b, (ops FP:$dst, FP:$src),
450 "fcvt.xf $dst = $src;;">;
451 def FCVTXUF : AForm<0x03, 0x0b, (ops FP:$dst, FP:$src),
452 "fcvt.xuf $dst = $src;;">;
453 def FCVTXUFS1 : AForm<0x03, 0x0b, (ops FP:$dst, FP:$src),
454 "fcvt.xuf.s1 $dst = $src;;">;
455 def FCVTFX : AForm<0x03, 0x0b, (ops FP:$dst, FP:$src),
456 "fcvt.fx $dst = $src;;">;
457 def FCVTFXU : AForm<0x03, 0x0b, (ops FP:$dst, FP:$src),
458 "fcvt.fxu $dst = $src;;">;
460 def FCVTFXTRUNC : AForm<0x03, 0x0b, (ops FP:$dst, FP:$src),
461 "fcvt.fx.trunc $dst = $src;;">;
462 def FCVTFXUTRUNC : AForm<0x03, 0x0b, (ops FP:$dst, FP:$src),
463 "fcvt.fxu.trunc $dst = $src;;">;
465 def FCVTFXTRUNCS1 : AForm<0x03, 0x0b, (ops FP:$dst, FP:$src),
466 "fcvt.fx.trunc.s1 $dst = $src;;">;
467 def FCVTFXUTRUNCS1 : AForm<0x03, 0x0b, (ops FP:$dst, FP:$src),
468 "fcvt.fxu.trunc.s1 $dst = $src;;">;
470 def FNORMD : AForm<0x03, 0x0b, (ops FP:$dst, FP:$src),
471 "fnorm.d $dst = $src;;">;
473 def GETFD : AForm<0x03, 0x0b, (ops GR:$dst, FP:$src),
474 "getf.d $dst = $src;;">;
475 def SETFD : AForm<0x03, 0x0b, (ops FP:$dst, GR:$src),
476 "setf.d $dst = $src;;">;
478 def GETFSIG : AForm<0x03, 0x0b, (ops GR:$dst, FP:$src),
479 "getf.sig $dst = $src;;">;
480 def SETFSIG : AForm<0x03, 0x0b, (ops FP:$dst, GR:$src),
481 "setf.sig $dst = $src;;">;
483 def LDF4 : AForm<0x03, 0x0b, (ops FP:$dst, GR:$srcPtr),
484 "ldfs $dst = [$srcPtr];;">;
485 def LDF8 : AForm<0x03, 0x0b, (ops FP:$dst, GR:$srcPtr),
486 "ldfd $dst = [$srcPtr];;">;
488 def STF4 : AForm<0x03, 0x0b, (ops GR:$dstPtr, FP:$value),
489 "stfs [$dstPtr] = $value;;">;
490 def STF8 : AForm<0x03, 0x0b, (ops GR:$dstPtr, FP:$value),
491 "stfd [$dstPtr] = $value;;">;
493 let isTerminator = 1, isBranch = 1 in {
494 def BRL_NOTCALL : RawForm<0x03, 0xb0, (ops i64imm:$dst),
495 "(p0) brl.cond.sptk $dst;;">;
496 def BRLCOND_NOTCALL : RawForm<0x03, 0xb0, (ops PR:$qp, i64imm:$dst),
497 "($qp) brl.cond.sptk $dst;;">;
498 def BRCOND_NOTCALL : RawForm<0x03, 0xb0, (ops PR:$qp, GR:$dst),
499 "($qp) br.cond.sptk $dst;;">;
502 let isCall = 1, isTerminator = 1, isBranch = 1,
503 Uses = [out0,out1,out2,out3,out4,out5,out6,out7],
504 // all calls clobber non-callee-saved registers, and for now, they are these:
505 Defs = [r2,r3,r8,r9,r10,r11,r14,r15,r16,r17,r18,r19,r20,r21,r22,r23,r24,
506 r25,r26,r27,r28,r29,r30,r31,
507 p6,p7,p8,p9,p10,p11,p12,p13,p14,p15,
508 F6,F7,F8,F9,F10,F11,F12,F13,F14,F15,
509 F32,F33,F34,F35,F36,F37,F38,F39,F40,F41,F42,F43,F44,F45,F46,F47,F48,F49,
510 F50,F51,F52,F53,F54,F55,F56,
511 F57,F58,F59,F60,F61,F62,F63,F64,F65,F66,F67,F68,F69,F70,F71,F72,F73,F74,
512 F75,F76,F77,F78,F79,F80,F81,
513 F82,F83,F84,F85,F86,F87,F88,F89,F90,F91,F92,F93,F94,F95,F96,F97,F98,F99,
514 F100,F101,F102,F103,F104,F105,
515 F106,F107,F108,F109,F110,F111,F112,F113,F114,F115,F116,F117,F118,F119,
516 F120,F121,F122,F123,F124,F125,F126,F127,
517 out0,out1,out2,out3,out4,out5,out6,out7] in {
519 def BRCALL: RawForm<0x03, 0xb0, (ops calltarget:$dst),
520 "br.call.sptk rp = $dst;;">; // FIXME: teach llvm about branch regs?
522 def BRCALL_IPREL : RawForm<0x03, 0xb0, (ops calltarget:$dst, variable_ops),
523 "br.call.sptk rp = $dst;;">; // FIXME: teach llvm about branch regs?
524 def BRCALL_INDIRECT : RawForm<0x03, 0xb0, (ops GR:$branchreg, variable_ops),
525 "br.call.sptk rp = $branchreg;;">; // FIXME: teach llvm about branch regs?
526 def BRLCOND_CALL : RawForm<0x03, 0xb0, (ops PR:$qp, i64imm:$dst),
527 "($qp) brl.cond.call.sptk $dst;;">;
528 def BRCOND_CALL : RawForm<0x03, 0xb0, (ops PR:$qp, GR:$dst),
529 "($qp) br.cond.call.sptk $dst;;">;
532 let isTerminator = 1, isReturn = 1 in
533 def RET : RawForm<0x03, 0xb0, (ops), "br.ret.sptk.many rp;;">; // return