blob: bd3042a654b6db9f4e2cbb2acfe53cbad1f9f3cc [file] [log] [blame]
Duraid Madina91ed0a12005-03-17 18:17:03 +00001//===- IA64InstrInfo.td - Describe the IA64 Instruction Set -----*- C++ -*-===//
2//
3// The LLVM Compiler Infrastructure
4//
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.
7//
8//===----------------------------------------------------------------------===//
9//
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.
13//
14//===----------------------------------------------------------------------===//
15
16include "IA64InstrFormats.td"
17
Duraid Madinac252f332005-10-29 04:13:40 +000018def u2imm : Operand<i8>;
Duraid Madina91ed0a12005-03-17 18:17:03 +000019def u6imm : Operand<i8>;
Duraid Madinab484f7c2005-04-07 12:32:24 +000020def s8imm : Operand<i8> {
21 let PrintMethod = "printS8ImmOperand";
22}
Duraid Madinaf221c262005-10-28 17:46:35 +000023def s14imm : Operand<i64> {
Duraid Madinab484f7c2005-04-07 12:32:24 +000024 let PrintMethod = "printS14ImmOperand";
25}
Duraid Madinafb43ef72005-04-11 05:55:56 +000026def s22imm : Operand<i32> {
27 let PrintMethod = "printS22ImmOperand";
Duraid Madina91ed0a12005-03-17 18:17:03 +000028}
29def u64imm : Operand<i64> {
30 let PrintMethod = "printU64ImmOperand";
31}
Duraid Madina0a7c2b92005-04-14 10:08:01 +000032def s64imm : Operand<i64> {
33 let PrintMethod = "printS64ImmOperand";
34}
Duraid Madina91ed0a12005-03-17 18:17:03 +000035
Duraid Madinaf221c262005-10-28 17:46:35 +000036let PrintMethod = "printGlobalOperand" in
37 def globaladdress : Operand<i64>;
38
Duraid Madina91ed0a12005-03-17 18:17:03 +000039// the asmprinter needs to know about calls
40let PrintMethod = "printCallOperand" in
41 def calltarget : Operand<i64>;
42
Duraid Madinaf221c262005-10-28 17:46:35 +000043/* new daggy action!!! */
44
Duraid Madinac252f332005-10-29 04:13:40 +000045def 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);
50}]>;
51
52def isSHLADDimm: PatLeaf<(i64 imm), [{
53 // isSHLADDimm predicate - True if the immediate is exactly 1, 2, 3 or 4
54 // - 0 is *not* okay.
55 // Used to create shladd instructions appropriately
56 int64_t v = (int64_t)N->getValue();
57 return (v >= 1 && v <= 4);
58}]>;
59
Duraid Madinaf221c262005-10-28 17:46:35 +000060def 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);
65}]>;
66
67def 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
70 return true;
71}]>;
72
Duraid Madinac252f332005-10-29 04:13:40 +000073def SXT1 : AForm_DAG<0x03, 0x0b, (ops GR:$dst, GR:$src), "sxt1 $dst = $src;;",
74 [(set GR:$dst, (sext_inreg GR:$src, i8))]>;
75def ZXT1 : AForm_DAG<0x03, 0x0b, (ops GR:$dst, GR:$src), "zxt1 $dst = $src;;",
76 [(set GR:$dst, (and GR:$src, 255))]>;
77def SXT2 : AForm_DAG<0x03, 0x0b, (ops GR:$dst, GR:$src), "sxt2 $dst = $src;;",
78 [(set GR:$dst, (sext_inreg GR:$src, i16))]>;
79def ZXT2 : AForm_DAG<0x03, 0x0b, (ops GR:$dst, GR:$src), "zxt2 $dst = $src;;",
80 [(set GR:$dst, (and GR:$src, 65535))]>;
81def SXT4 : AForm_DAG<0x03, 0x0b, (ops GR:$dst, GR:$src), "sxt4 $dst = $src;;",
82 [(set GR:$dst, (sext_inreg GR:$src, i32))]>;
83def ZXT4 : AForm_DAG<0x03, 0x0b, (ops GR:$dst, GR:$src), "zxt4 $dst = $src;;",
84 [(set GR:$dst, (and GR:$src, is32ones))]>;
85
Duraid Madinaf221c262005-10-28 17:46:35 +000086def 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))]>;
89
90def 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))]>;
93
94def 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))]>;
97
98def MOVL : AForm_DAG<0x03, 0x0b, (ops GR:$dst, s64imm:$imm),
99 "movl $dst = $imm;;",
100 [(set GR:$dst, imm64:$imm)]>;
101
102def ADDL_GA : AForm_DAG<0x03, 0x0b, (ops GR:$dst, GR:$src1, globaladdress:$imm),
103 "addl $dst = $imm, $src1;;",
104 []>;
105
106def 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))]>;
109
110def 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))]>;
113
114def GETFSIGD : AForm_DAG<0x03, 0x0b, (ops GR:$dst, FP:$src),
115 "getf.sig $dst = $src;;",
116 []>;
117
118def SETFSIGD : AForm_DAG<0x03, 0x0b, (ops FP:$dst, GR:$src),
119 "setf.sig $dst = $src;;",
120 []>;
121
122def XMALD : AForm_DAG<0x03, 0x0b, (ops FP:$dst, FP:$src1, FP:$src2, FP:$src3),
123 "xma.l $dst = $src1, $src2, $src3;;",
124 []>;
125
126// pseudocode for integer multiplication
127def : Pat<(mul GR:$src1, GR:$src2),
128 (GETFSIGD (XMALD (SETFSIGD GR:$src1), (SETFSIGD GR:$src2), F0))>;
129
130// TODO: addp4 (addp4 dst = src, r0 is a 32-bit add)
131// has imm form, too
132
133// def ADDS : AForm<0x03, 0x0b, (ops GR:$dst, GR:$src1, s14imm:$imm),
134// "adds $dst = $imm, $src1;;">;
135
136// load constants of various sizes // FIXME: prettyprint -ve constants
137def : Pat<(i64 immSExt14:$imm), (ADDS r0, immSExt14:$imm)>;
138def : Pat<(i64 imm64:$imm), (MOVL imm64:$imm)>;
Duraid Madinac252f332005-10-29 04:13:40 +0000139// TODO: def : Pat<(i1 1), (MOV p0)>;
Duraid Madinaf221c262005-10-28 17:46:35 +0000140
141def 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))]>;
144def 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
148def 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))]>;
151
152def pOR : AForm<0x03, 0x0b, (ops GR:$dst, GR:$src1, GR:$src2, PR:$qp),
153 "($qp) or $dst = $src1, $src2;;">;
154
155def PCMPEQUNCR0R0 : AForm<0x03, 0x0b, (ops PR:$dst, PR:$qp),
156 "($qp) cmp.eq.unc $dst, p0 = r0, r0;;">;
157
158let isTwoAddress=1 in
159def TPCMPEQR0R0 : AForm<0x03, 0x0b, (ops PR:$dst, PR:$bogus, PR:$qp),
160 "($qp) cmp.eq $dst, p0 = r0, r0;;">;
161
162/* our pseudocode for OR on predicates is:
163 *
164
165pC = pA OR pB
166-------------
167
168(pA) cmp.eq.unc pC,p0 = r0,r0 // pC = pA
169 ;;
170(pB) cmp.eq pC,p0 = r0,r0 // if (pB) pC = 1
171
172*/
173/*
174let 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;;">;
178}
179*/
180
181// FIXME: these are bogus
182def bOR : Pat<(or PR:$src1, PR:$src2),
183 (PCMPEQUNCR0R0 PR:$src1)>;
184
185def bXOR : Pat<(xor PR:$src1, PR:$src2),
186 (PCMPEQUNCR0R0 PR:$src1)>;
187
188def 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))]>;
191
Duraid Madinac252f332005-10-29 04:13:40 +0000192def 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)))]>;
195
Duraid Madinaf221c262005-10-28 17:46:35 +0000196def 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))]>;
199
Duraid Madinac252f332005-10-29 04:13:40 +0000200def 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))]>;
203
204def 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))]>;
207
Duraid Madinaf221c262005-10-28 17:46:35 +0000208/*
209def CMPEQ : AForm<0x03, 0x0b, (ops PR:$dst, GR:$src1, GR:$src2),
210 "cmp.eq $dst, p0 = $src1, $src2;;">;
211def CMPGT : AForm<0x03, 0x0b, (ops PR:$dst, GR:$src1, GR:$src2),
212 "cmp.gt $dst, p0 = $src1, $src2;;">;
213def CMPGE : AForm<0x03, 0x0b, (ops PR:$dst, GR:$src1, GR:$src2),
214 "cmp.ge $dst, p0 = $src1, $src2;;">;
215def CMPLT : AForm<0x03, 0x0b, (ops PR:$dst, GR:$src1, GR:$src2),
216 "cmp.lt $dst, p0 = $src1, $src2;;">;
217def CMPLE : AForm<0x03, 0x0b, (ops PR:$dst, GR:$src1, GR:$src2),
218 "cmp.le $dst, p0 = $src1, $src2;;">;
219def CMPNE : AForm<0x03, 0x0b, (ops PR:$dst, GR:$src1, GR:$src2),
220 "cmp.ne $dst, p0 = $src1, $src2;;">;
221def CMPLTU : AForm<0x03, 0x0b, (ops PR:$dst, GR:$src1, GR:$src2),
222 "cmp.ltu $dst, p0 = $src1, $src2;;">;
223def CMPGTU : AForm<0x03, 0x0b, (ops PR:$dst, GR:$src1, GR:$src2),
224 "cmp.gtu $dst, p0 = $src1, $src2;;">;
225def CMPLEU : AForm<0x03, 0x0b, (ops PR:$dst, GR:$src1, GR:$src2),
226 "cmp.leu $dst, p0 = $src1, $src2;;">;
227def CMPGEU : AForm<0x03, 0x0b, (ops PR:$dst, GR:$src1, GR:$src2),
228 "cmp.geu $dst, p0 = $src1, $src2;;">;
229*/
230
231// the following are all a bit unfortunate: we throw away the complement
232// of the compare!
233def 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))]>;
236def 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))]>;
239def 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))]>;
242def 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))]>;
245def 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))]>;
248def 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))]>;
251def 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))]>;
254def 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))]>;
257def 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))]>;
260def 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))]>;
263
Duraid Madinaf221c262005-10-28 17:46:35 +0000264// TODO: support postincrement (reg, imm9) loads+stores - this needs more
265// tablegen support
266
Chris Lattner3e0335c2005-08-19 00:47:42 +0000267def PHI : PseudoInstIA64<(ops variable_ops), "PHI">;
268def IDEF : PseudoInstIA64<(ops variable_ops), "// IDEF">;
269def IUSE : PseudoInstIA64<(ops variable_ops), "// IUSE">;
270def ADJUSTCALLSTACKUP : PseudoInstIA64<(ops variable_ops),
271 "// ADJUSTCALLSTACKUP">;
272def ADJUSTCALLSTACKDOWN : PseudoInstIA64<(ops variable_ops),
273 "// ADJUSTCALLSTACKDOWN">;
Chris Lattner9e4a4ee2005-09-14 21:11:13 +0000274def PSEUDO_ALLOC : PseudoInstIA64<(ops GR:$foo), "// PSEUDO_ALLOC">;
Duraid Madina91ed0a12005-03-17 18:17:03 +0000275
276def 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;;">;
279
280def MOV : AForm<0x03, 0x0b, (ops GR:$dst, GR:$src), "mov $dst = $src;;">;
281def PMOV : AForm<0x03, 0x0b, (ops GR:$dst, GR:$src, PR:$qp),
282 "($qp) mov $dst = $src;;">;
283
284def SPILL_ALL_PREDICATES_TO_GR : AForm<0x03, 0x0b, (ops GR:$dst),
285 "mov $dst = pr;;">;
286def FILL_ALL_PREDICATES_FROM_GR : AForm<0x03, 0x0b, (ops GR:$src),
287 "mov pr = $src;;">;
288
289let isTwoAddress = 1 in {
290 def CMOV : AForm<0x03, 0x0b, (ops GR:$dst, GR:$src2, GR:$src, PR:$qp),
291 "($qp) mov $dst = $src;;">;
292}
293
Duraid Madina73c27772005-03-31 07:32:32 +0000294def PFMOV : AForm<0x03, 0x0b, (ops FP:$dst, FP:$src, PR:$qp),
295 "($qp) mov $dst = $src;;">;
296
297let isTwoAddress = 1 in {
298 def CFMOV : AForm<0x03, 0x0b, (ops FP:$dst, FP:$src2, FP:$src, PR:$qp),
299 "($qp) mov $dst = $src;;">;
300}
301
Duraid Madina91ed0a12005-03-17 18:17:03 +0000302let 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;;">;
306
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;;">;
310
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;;">;
314
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;;">;
318}
319
Duraid Madinafb43ef72005-04-11 05:55:56 +0000320def MOVSIMM14 : AForm<0x03, 0x0b, (ops GR:$dst, s14imm:$imm),
Duraid Madina91ed0a12005-03-17 18:17:03 +0000321 "mov $dst = $imm;;">;
Duraid Madinafb43ef72005-04-11 05:55:56 +0000322def MOVSIMM22 : AForm<0x03, 0x0b, (ops GR:$dst, s22imm:$imm),
323 "mov $dst = $imm;;">;
Duraid Madina0a7c2b92005-04-14 10:08:01 +0000324def MOVLIMM64 : AForm<0x03, 0x0b, (ops GR:$dst, s64imm:$imm),
Duraid Madina91ed0a12005-03-17 18:17:03 +0000325 "movl $dst = $imm;;">;
326
Duraid Madinafb43ef72005-04-11 05:55:56 +0000327def SHLI : AForm<0x03, 0x0b, (ops GR:$dst, GR:$src1, u6imm:$imm),
328 "shl $dst = $src1, $imm;;">;
Duraid Madinafb43ef72005-04-11 05:55:56 +0000329def SHRUI : AForm<0x03, 0x0b, (ops GR:$dst, GR:$src1, u6imm:$imm),
Duraid Madinab484f7c2005-04-07 12:32:24 +0000330 "shr.u $dst = $src1, $imm;;">;
Duraid Madinafb43ef72005-04-11 05:55:56 +0000331def SHRSI : AForm<0x03, 0x0b, (ops GR:$dst, GR:$src1, u6imm:$imm),
Duraid Madinab484f7c2005-04-07 12:32:24 +0000332 "shr $dst = $src1, $imm;;">;
Duraid Madina91ed0a12005-03-17 18:17:03 +0000333
Duraid Madina41ff5022005-04-08 10:01:48 +0000334def EXTRU : AForm<0x03, 0x0b, (ops GR:$dst, GR:$src1, u6imm:$imm1, u6imm:$imm2),
335 "extr.u $dst = $src1, $imm1, $imm2;;">;
336
Duraid Madina91ed0a12005-03-17 18:17:03 +0000337def DEPZ : AForm<0x03, 0x0b, (ops GR:$dst, GR:$src1, u6imm:$imm1, u6imm:$imm2), "dep.z $dst = $src1, $imm1, $imm2;;">;
338
Duraid Madina91ed0a12005-03-17 18:17:03 +0000339// and we do the whole thing again for FP compares!
340def FCMPEQ : AForm<0x03, 0x0b, (ops PR:$dst, FP:$src1, FP:$src2),
341 "fcmp.eq $dst, p0 = $src1, $src2;;">;
342def FCMPGT : AForm<0x03, 0x0b, (ops PR:$dst, FP:$src1, FP:$src2),
343 "fcmp.gt $dst, p0 = $src1, $src2;;">;
344def FCMPGE : AForm<0x03, 0x0b, (ops PR:$dst, FP:$src1, FP:$src2),
345 "fcmp.ge $dst, p0 = $src1, $src2;;">;
346def FCMPLT : AForm<0x03, 0x0b, (ops PR:$dst, FP:$src1, FP:$src2),
347 "fcmp.lt $dst, p0 = $src1, $src2;;">;
348def FCMPLE : AForm<0x03, 0x0b, (ops PR:$dst, FP:$src1, FP:$src2),
349 "fcmp.le $dst, p0 = $src1, $src2;;">;
350def FCMPNE : AForm<0x03, 0x0b, (ops PR:$dst, FP:$src1, FP:$src2),
351 "fcmp.neq $dst, p0 = $src1, $src2;;">;
352def FCMPLTU : AForm<0x03, 0x0b, (ops PR:$dst, FP:$src1, FP:$src2),
353 "fcmp.ltu $dst, p0 = $src1, $src2;;">;
354def FCMPGTU : AForm<0x03, 0x0b, (ops PR:$dst, FP:$src1, FP:$src2),
355 "fcmp.gtu $dst, p0 = $src1, $src2;;">;
356def FCMPLEU : AForm<0x03, 0x0b, (ops PR:$dst, FP:$src1, FP:$src2),
357 "fcmp.leu $dst, p0 = $src1, $src2;;">;
358def FCMPGEU : AForm<0x03, 0x0b, (ops PR:$dst, FP:$src1, FP:$src2),
359 "fcmp.geu $dst, p0 = $src1, $src2;;">;
360
361def PCMPEQOR : AForm<0x03, 0x0b, (ops PR:$dst, GR:$src1, GR:$src2, PR:$qp),
362 "($qp) cmp.eq.or $dst, p0 = $src1, $src2;;">;
363def PCMPEQUNC : AForm<0x03, 0x0b, (ops PR:$dst, GR:$src1, GR:$src2, PR:$qp),
364 "($qp) cmp.eq.unc $dst, p0 = $src1, $src2;;">;
365def PCMPNE : AForm<0x03, 0x0b, (ops PR:$dst, GR:$src1, GR:$src2, PR:$qp),
366 "($qp) cmp.ne $dst, p0 = $src1, $src2;;">;
367
368// two destinations!
369def BCMPEQ : AForm<0x03, 0x0b, (ops PR:$dst1, PR:$dst2, GR:$src1, GR:$src2),
370 "cmp.eq $dst1, dst2 = $src1, $src2;;">;
371
Duraid Madinab484f7c2005-04-07 12:32:24 +0000372def ADDIMM14 : AForm<0x03, 0x0b, (ops GR:$dst, GR:$src1, s14imm:$imm),
373 "adds $dst = $imm, $src1;;">;
Duraid Madina91ed0a12005-03-17 18:17:03 +0000374
Duraid Madinafb43ef72005-04-11 05:55:56 +0000375def ADDIMM22 : AForm<0x03, 0x0b, (ops GR:$dst, GR:$src1, s22imm:$imm),
Duraid Madina91ed0a12005-03-17 18:17:03 +0000376 "add $dst = $imm, $src1;;">;
Duraid Madinafb43ef72005-04-11 05:55:56 +0000377def CADDIMM22 : AForm<0x03, 0x0b, (ops GR:$dst, GR:$src1, s22imm:$imm, PR:$qp),
Duraid Madina91ed0a12005-03-17 18:17:03 +0000378 "($qp) add $dst = $imm, $src1;;">;
379
380let isTwoAddress = 1 in {
381def TPCADDIMM22 : AForm<0x03, 0x0b,
Duraid Madinafb43ef72005-04-11 05:55:56 +0000382 (ops GR:$dst, GR:$src1, s22imm:$imm, PR:$qp),
Duraid Madina91ed0a12005-03-17 18:17:03 +0000383 "($qp) add $dst = $imm, $dst;;">;
384def TPCMPIMM8NE : AForm<0x03, 0x0b,
Duraid Madinafb43ef72005-04-11 05:55:56 +0000385 (ops PR:$dst, PR:$src1, s22imm:$imm, GR:$src2, PR:$qp),
Duraid Madina91ed0a12005-03-17 18:17:03 +0000386 "($qp) cmp.ne $dst , p0 = $imm, $src2;;">;
387}
388
Duraid Madinab484f7c2005-04-07 12:32:24 +0000389def SUBIMM8 : AForm<0x03, 0x0b, (ops GR:$dst, s8imm:$imm, GR:$src2),
390 "sub $dst = $imm, $src2;;">;
Duraid Madina91ed0a12005-03-17 18:17:03 +0000391
392def ST1 : AForm<0x03, 0x0b, (ops GR:$dstPtr, GR:$value),
393 "st1 [$dstPtr] = $value;;">;
394def ST2 : AForm<0x03, 0x0b, (ops GR:$dstPtr, GR:$value),
395 "st2 [$dstPtr] = $value;;">;
396def ST4 : AForm<0x03, 0x0b, (ops GR:$dstPtr, GR:$value),
397 "st4 [$dstPtr] = $value;;">;
398def ST8 : AForm<0x03, 0x0b, (ops GR:$dstPtr, GR:$value),
399 "st8 [$dstPtr] = $value;;">;
400
401def LD1 : AForm<0x03, 0x0b, (ops GR:$dst, GR:$srcPtr),
402 "ld1 $dst = [$srcPtr];;">;
403def LD2 : AForm<0x03, 0x0b, (ops GR:$dst, GR:$srcPtr),
404 "ld2 $dst = [$srcPtr];;">;
405def LD4 : AForm<0x03, 0x0b, (ops GR:$dst, GR:$srcPtr),
406 "ld4 $dst = [$srcPtr];;">;
407def LD8 : AForm<0x03, 0x0b, (ops GR:$dst, GR:$srcPtr),
408 "ld8 $dst = [$srcPtr];;">;
409
Duraid Madina25163d82005-05-11 05:16:09 +0000410def POPCNT : AForm<0x03, 0x0b, (ops GR:$dst, GR:$src), "popcnt $dst = $src;;">;
411
Duraid Madina91ed0a12005-03-17 18:17:03 +0000412// some FP stuff:
413def FADD : AForm<0x03, 0x0b, (ops FP:$dst, FP:$src1, FP:$src2),
414 "fadd $dst = $src1, $src2;;">;
415def FADDS: AForm<0x03, 0x0b, (ops FP:$dst, FP:$src1, FP:$src2),
416 "fadd.s $dst = $src1, $src2;;">;
417def FSUB : AForm<0x03, 0x0b, (ops FP:$dst, FP:$src1, FP:$src2),
418 "fsub $dst = $src1, $src2;;">;
419def FMPY : AForm<0x03, 0x0b, (ops FP:$dst, FP:$src1, FP:$src2),
420 "fmpy $dst = $src1, $src2;;">;
421def FMOV : AForm<0x03, 0x0b, (ops FP:$dst, FP:$src),
422 "mov $dst = $src;;">; // XXX: there _is_ no fmov
423def FMA : AForm<0x03, 0x0b, (ops FP:$dst, FP:$src1, FP:$src2, FP:$src3),
424 "fma $dst = $src1, $src2, $src3;;">;
Duraid Madina03c53072005-04-06 09:54:09 +0000425def FMS : AForm<0x03, 0x0b, (ops FP:$dst, FP:$src1, FP:$src2, FP:$src3),
426 "fms $dst = $src1, $src2, $src3;;">;
Duraid Madina91ed0a12005-03-17 18:17:03 +0000427def FNMA : AForm<0x03, 0x0b, (ops FP:$dst, FP:$src1, FP:$src2, FP:$src3),
428 "fnma $dst = $src1, $src2, $src3;;">;
Duraid Madina0720dc12005-04-02 05:18:38 +0000429def FABS : AForm<0x03, 0x0b, (ops FP:$dst, FP:$src),
430 "fabs $dst = $src;;">;
431def FNEG : AForm<0x03, 0x0b, (ops FP:$dst, FP:$src),
432 "fneg $dst = $src;;">;
Duraid Madina0ccac382005-04-02 10:06:27 +0000433def FNEGABS : AForm<0x03, 0x0b, (ops FP:$dst, FP:$src),
434 "fnegabs $dst = $src;;">;
Duraid Madina91ed0a12005-03-17 18:17:03 +0000435
436def CFMAS1 : AForm<0x03, 0x0b,
437 (ops FP:$dst, FP:$src1, FP:$src2, FP:$src3, PR:$qp),
438 "($qp) fma.s1 $dst = $src1, $src2, $src3;;">;
439def CFNMAS1 : AForm<0x03, 0x0b,
440 (ops FP:$dst, FP:$src1, FP:$src2, FP:$src3, PR:$qp),
441 "($qp) fnma.s1 $dst = $src1, $src2, $src3;;">;
442
Duraid Madina41ff5022005-04-08 10:01:48 +0000443def FRCPAS1 : AForm<0x03, 0x0b, (ops FP:$dstFR, PR:$dstPR, FP:$src1, FP:$src2),
444 "frcpa.s1 $dstFR, $dstPR = $src1, $src2;;">;
Duraid Madina91ed0a12005-03-17 18:17:03 +0000445
446def XMAL : AForm<0x03, 0x0b, (ops FP:$dst, FP:$src1, FP:$src2, FP:$src3),
447 "xma.l $dst = $src1, $src2, $src3;;">;
448
449def FCVTXF : AForm<0x03, 0x0b, (ops FP:$dst, FP:$src),
450 "fcvt.xf $dst = $src;;">;
451def FCVTXUF : AForm<0x03, 0x0b, (ops FP:$dst, FP:$src),
452 "fcvt.xuf $dst = $src;;">;
453def FCVTXUFS1 : AForm<0x03, 0x0b, (ops FP:$dst, FP:$src),
454 "fcvt.xuf.s1 $dst = $src;;">;
455def FCVTFX : AForm<0x03, 0x0b, (ops FP:$dst, FP:$src),
456 "fcvt.fx $dst = $src;;">;
457def FCVTFXU : AForm<0x03, 0x0b, (ops FP:$dst, FP:$src),
458 "fcvt.fxu $dst = $src;;">;
459
460def FCVTFXTRUNC : AForm<0x03, 0x0b, (ops FP:$dst, FP:$src),
461 "fcvt.fx.trunc $dst = $src;;">;
462def FCVTFXUTRUNC : AForm<0x03, 0x0b, (ops FP:$dst, FP:$src),
463 "fcvt.fxu.trunc $dst = $src;;">;
464
465def FCVTFXTRUNCS1 : AForm<0x03, 0x0b, (ops FP:$dst, FP:$src),
466 "fcvt.fx.trunc.s1 $dst = $src;;">;
467def FCVTFXUTRUNCS1 : AForm<0x03, 0x0b, (ops FP:$dst, FP:$src),
468 "fcvt.fxu.trunc.s1 $dst = $src;;">;
469
470def FNORMD : AForm<0x03, 0x0b, (ops FP:$dst, FP:$src),
471 "fnorm.d $dst = $src;;">;
472
473def GETFD : AForm<0x03, 0x0b, (ops GR:$dst, FP:$src),
474 "getf.d $dst = $src;;">;
475def SETFD : AForm<0x03, 0x0b, (ops FP:$dst, GR:$src),
476 "setf.d $dst = $src;;">;
477
478def GETFSIG : AForm<0x03, 0x0b, (ops GR:$dst, FP:$src),
479 "getf.sig $dst = $src;;">;
480def SETFSIG : AForm<0x03, 0x0b, (ops FP:$dst, GR:$src),
481 "setf.sig $dst = $src;;">;
482
483def LDF4 : AForm<0x03, 0x0b, (ops FP:$dst, GR:$srcPtr),
484 "ldfs $dst = [$srcPtr];;">;
485def LDF8 : AForm<0x03, 0x0b, (ops FP:$dst, GR:$srcPtr),
486 "ldfd $dst = [$srcPtr];;">;
487
488def STF4 : AForm<0x03, 0x0b, (ops GR:$dstPtr, FP:$value),
489 "stfs [$dstPtr] = $value;;">;
490def STF8 : AForm<0x03, 0x0b, (ops GR:$dstPtr, FP:$value),
491 "stfd [$dstPtr] = $value;;">;
492
493let isTerminator = 1, isBranch = 1 in {
Duraid Madinaf221c262005-10-28 17:46:35 +0000494 def BRL_NOTCALL : RawForm<0x03, 0xb0, (ops i64imm:$dst),
495 "(p0) brl.cond.sptk $dst;;">;
Duraid Madina91ed0a12005-03-17 18:17:03 +0000496 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;;">;
500}
501
502let isCall = 1, isTerminator = 1, isBranch = 1,
Chris Lattner6b917672005-04-12 15:12:19 +0000503 Uses = [out0,out1,out2,out3,out4,out5,out6,out7],
Duraid Madina91ed0a12005-03-17 18:17:03 +0000504// 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 {
Duraid Madinaf221c262005-10-28 17:46:35 +0000518// old pattern call
519 def BRCALL: RawForm<0x03, 0xb0, (ops calltarget:$dst),
Duraid Madina91ed0a12005-03-17 18:17:03 +0000520 "br.call.sptk rp = $dst;;">; // FIXME: teach llvm about branch regs?
Duraid Madinaf221c262005-10-28 17:46:35 +0000521// new daggy stuff!
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?
Duraid Madina91ed0a12005-03-17 18:17:03 +0000526 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;;">;
530}
531
532let isTerminator = 1, isReturn = 1 in
533 def RET : RawForm<0x03, 0xb0, (ops), "br.ret.sptk.many rp;;">; // return
534
535