blob: 4a349b0a9a96e911526181d056bd63fbed09481f [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
Duraid Madina7abaf902005-10-29 16:08:30 +000048 uint64_t v = (uint64_t)N->getValue();
Duraid Madinac252f332005-10-29 04:13:40 +000049 return (v == 0x00000000FFFFFFFFLL);
50}]>;
51
Duraid Madina7abaf902005-10-29 16:08:30 +000052// isMIXable predicates - True if the immediate is
53// 0xFF00FF00FF00FF00, 0x00FF00FF00FF00FF
54// etc, through 0x00000000FFFFFFFF
55// Used to test for the suitability of mix*
56def isMIX1Lable: PatLeaf<(i64 imm), [{
57 return((uint64_t)N->getValue()==0xFF00FF00FF00FF00LL);
58}]>;
59def isMIX1Rable: PatLeaf<(i64 imm), [{
60 return((uint64_t)N->getValue()==0x00FF00FF00FF00FFLL);
61}]>;
62def isMIX2Lable: PatLeaf<(i64 imm), [{
63 return((uint64_t)N->getValue()==0xFFFF0000FFFF0000LL);
64}]>;
65def isMIX2Rable: PatLeaf<(i64 imm), [{
66 return((uint64_t)N->getValue()==0x0000FFFF0000FFFFLL);
67}]>;
68def isMIX4Lable: PatLeaf<(i64 imm), [{
69 return((uint64_t)N->getValue()==0xFFFFFFFF00000000LL);
70}]>;
71def isMIX4Rable: PatLeaf<(i64 imm), [{
72 return((uint64_t)N->getValue()==0x00000000FFFFFFFFLL);
73}]>;
74
Duraid Madinac252f332005-10-29 04:13:40 +000075def isSHLADDimm: PatLeaf<(i64 imm), [{
76 // isSHLADDimm predicate - True if the immediate is exactly 1, 2, 3 or 4
77 // - 0 is *not* okay.
78 // Used to create shladd instructions appropriately
79 int64_t v = (int64_t)N->getValue();
80 return (v >= 1 && v <= 4);
81}]>;
82
Duraid Madinaf221c262005-10-28 17:46:35 +000083def immSExt14 : PatLeaf<(i64 imm), [{
84 // immSExt14 predicate - True if the immediate fits in a 14-bit sign extended
85 // field. Used by instructions like 'adds'.
86 int64_t v = (int64_t)N->getValue();
87 return (v <= 8191 && v >= -8192);
88}]>;
89
90def imm64 : PatLeaf<(i64 imm), [{
91 // imm64 predicate - True if the immediate fits in a 64-bit
92 // field - i.e., true. used to keep movl happy
93 return true;
94}]>;
95
Duraid Madinaa284b662005-11-01 01:29:55 +000096def ADD : AForm_DAG<0x03, 0x0b, (ops GR:$dst, GR:$src1, GR:$src2),
97 "add $dst = $src1, $src2;;",
98 [(set GR:$dst, (add GR:$src1, GR:$src2))]>;
99
100def ADD1 : AForm_DAG<0x03, 0x0b, (ops GR:$dst, GR:$src1, GR:$src2),
101 "add $dst = $src1, $src2, 1;;",
102 [(set GR:$dst, (add (add GR:$src1, GR:$src2), 1))]>;
103
104def ADDS : AForm_DAG<0x03, 0x0b, (ops GR:$dst, GR:$src1, s14imm:$imm),
105 "adds $dst = $imm, $src1;;",
106 [(set GR:$dst, (add GR:$src1, immSExt14:$imm))]>;
107
Duraid Madina7ac646e2005-11-04 00:57:56 +0000108def PADDS: AForm_DAG<0x03, 0x0b, (ops GR:$dst, GR:$src1, s14imm:$imm, PR:$qp),
109 "($qp) adds $dst = $imm, $src1;;",
110 []>;
111
Duraid Madinaa284b662005-11-01 01:29:55 +0000112def MOVL : AForm_DAG<0x03, 0x0b, (ops GR:$dst, s64imm:$imm),
113 "movl $dst = $imm;;",
114 [(set GR:$dst, imm64:$imm)]>;
115
116def ADDL_GA : AForm_DAG<0x03, 0x0b, (ops GR:$dst, GR:$src1, globaladdress:$imm),
117 "addl $dst = $imm, $src1;;",
118 []>;
119
120def SUB : AForm_DAG<0x03, 0x0b, (ops GR:$dst, GR:$src1, GR:$src2),
121 "sub $dst = $src1, $src2;;",
122 [(set GR:$dst, (sub GR:$src1, GR:$src2))]>;
123
124def SUB1 : AForm_DAG<0x03, 0x0b, (ops GR:$dst, GR:$src1, GR:$src2),
125 "sub $dst = $src1, $src2, 1;;",
126 [(set GR:$dst, (add (sub GR: $src1, GR:$src2), -1))]>;
127
128let isTwoAddress = 1 in {
129def TPCADDIMM22 : AForm<0x03, 0x0b,
130 (ops GR:$dst, GR:$src1, s22imm:$imm, PR:$qp),
131 "($qp) add $dst = $imm, $dst;;">;
132def TPCMPIMM8NE : AForm<0x03, 0x0b,
133 (ops PR:$dst, PR:$src1, s22imm:$imm, GR:$src2, PR:$qp),
134 "($qp) cmp.ne $dst , p0 = $imm, $src2;;">;
135}
136
137// zero extend a bool (predicate reg) into an integer reg
138def ZXTb : Pat<(zext PR:$src),
139 (TPCADDIMM22 (ADDS r0, 0), 1, PR:$src)>;
140
141// normal sign/zero-extends
Duraid Madinac252f332005-10-29 04:13:40 +0000142def SXT1 : AForm_DAG<0x03, 0x0b, (ops GR:$dst, GR:$src), "sxt1 $dst = $src;;",
143 [(set GR:$dst, (sext_inreg GR:$src, i8))]>;
144def ZXT1 : AForm_DAG<0x03, 0x0b, (ops GR:$dst, GR:$src), "zxt1 $dst = $src;;",
145 [(set GR:$dst, (and GR:$src, 255))]>;
146def SXT2 : AForm_DAG<0x03, 0x0b, (ops GR:$dst, GR:$src), "sxt2 $dst = $src;;",
147 [(set GR:$dst, (sext_inreg GR:$src, i16))]>;
148def ZXT2 : AForm_DAG<0x03, 0x0b, (ops GR:$dst, GR:$src), "zxt2 $dst = $src;;",
149 [(set GR:$dst, (and GR:$src, 65535))]>;
150def SXT4 : AForm_DAG<0x03, 0x0b, (ops GR:$dst, GR:$src), "sxt4 $dst = $src;;",
151 [(set GR:$dst, (sext_inreg GR:$src, i32))]>;
152def ZXT4 : AForm_DAG<0x03, 0x0b, (ops GR:$dst, GR:$src), "zxt4 $dst = $src;;",
153 [(set GR:$dst, (and GR:$src, is32ones))]>;
154
Duraid Madina7abaf902005-10-29 16:08:30 +0000155// fixme: shrs vs shru?
156def MIX1L : AForm_DAG<0x03, 0x0b, (ops GR:$dst, GR:$src1, GR:$src2),
157 "mix1.l $dst = $src1, $src2;;",
158 [(set GR:$dst, (or (and GR:$src1, isMIX1Lable),
Chris Lattnerc54cddd2005-12-05 02:34:29 +0000159 (and (srl GR:$src2, (i64 8)), isMIX1Lable)))]>;
Duraid Madina7abaf902005-10-29 16:08:30 +0000160
161def MIX2L : AForm_DAG<0x03, 0x0b, (ops GR:$dst, GR:$src1, GR:$src2),
162 "mix2.l $dst = $src1, $src2;;",
163 [(set GR:$dst, (or (and GR:$src1, isMIX2Lable),
Chris Lattnerc54cddd2005-12-05 02:34:29 +0000164 (and (srl GR:$src2, (i64 16)), isMIX2Lable)))]>;
Duraid Madina7abaf902005-10-29 16:08:30 +0000165
166def MIX4L : AForm_DAG<0x03, 0x0b, (ops GR:$dst, GR:$src1, GR:$src2),
167 "mix4.l $dst = $src1, $src2;;",
168 [(set GR:$dst, (or (and GR:$src1, isMIX4Lable),
Chris Lattnerc54cddd2005-12-05 02:34:29 +0000169 (and (srl GR:$src2, (i64 32)), isMIX4Lable)))]>;
Duraid Madina7abaf902005-10-29 16:08:30 +0000170
171def MIX1R : AForm_DAG<0x03, 0x0b, (ops GR:$dst, GR:$src1, GR:$src2),
172 "mix1.r $dst = $src1, $src2;;",
Chris Lattnerc54cddd2005-12-05 02:34:29 +0000173 [(set GR:$dst, (or (and (shl GR:$src1, (i64 8)), isMIX1Rable),
Duraid Madina7abaf902005-10-29 16:08:30 +0000174 (and GR:$src2, isMIX1Rable)))]>;
175
176def MIX2R : AForm_DAG<0x03, 0x0b, (ops GR:$dst, GR:$src1, GR:$src2),
177 "mix2.r $dst = $src1, $src2;;",
Chris Lattnerc54cddd2005-12-05 02:34:29 +0000178 [(set GR:$dst, (or (and (shl GR:$src1, (i64 16)), isMIX2Rable),
Duraid Madina7abaf902005-10-29 16:08:30 +0000179 (and GR:$src2, isMIX2Rable)))]>;
180
181def MIX4R : AForm_DAG<0x03, 0x0b, (ops GR:$dst, GR:$src1, GR:$src2),
182 "mix4.r $dst = $src1, $src2;;",
Chris Lattnerc54cddd2005-12-05 02:34:29 +0000183 [(set GR:$dst, (or (and (shl GR:$src1, (i64 32)), isMIX4Rable),
Duraid Madina7abaf902005-10-29 16:08:30 +0000184 (and GR:$src2, isMIX4Rable)))]>;
185
Duraid Madinaf221c262005-10-28 17:46:35 +0000186def GETFSIGD : AForm_DAG<0x03, 0x0b, (ops GR:$dst, FP:$src),
187 "getf.sig $dst = $src;;",
188 []>;
189
190def SETFSIGD : AForm_DAG<0x03, 0x0b, (ops FP:$dst, GR:$src),
191 "setf.sig $dst = $src;;",
192 []>;
193
194def XMALD : AForm_DAG<0x03, 0x0b, (ops FP:$dst, FP:$src1, FP:$src2, FP:$src3),
195 "xma.l $dst = $src1, $src2, $src3;;",
196 []>;
Duraid Madina7abaf902005-10-29 16:08:30 +0000197def XMAHD : AForm_DAG<0x03, 0x0b, (ops FP:$dst, FP:$src1, FP:$src2, FP:$src3),
198 "xma.h $dst = $src1, $src2, $src3;;",
199 []>;
200def XMAHUD : AForm_DAG<0x03, 0x0b, (ops FP:$dst, FP:$src1, FP:$src2, FP:$src3),
201 "xma.hu $dst = $src1, $src2, $src3;;",
202 []>;
Duraid Madinaf221c262005-10-28 17:46:35 +0000203
204// pseudocode for integer multiplication
205def : Pat<(mul GR:$src1, GR:$src2),
206 (GETFSIGD (XMALD (SETFSIGD GR:$src1), (SETFSIGD GR:$src2), F0))>;
Duraid Madina7abaf902005-10-29 16:08:30 +0000207def : Pat<(mulhs GR:$src1, GR:$src2),
208 (GETFSIGD (XMAHD (SETFSIGD GR:$src1), (SETFSIGD GR:$src2), F0))>;
209def : Pat<(mulhu GR:$src1, GR:$src2),
210 (GETFSIGD (XMAHUD (SETFSIGD GR:$src1), (SETFSIGD GR:$src2), F0))>;
Duraid Madinaf221c262005-10-28 17:46:35 +0000211
212// TODO: addp4 (addp4 dst = src, r0 is a 32-bit add)
213// has imm form, too
214
215// def ADDS : AForm<0x03, 0x0b, (ops GR:$dst, GR:$src1, s14imm:$imm),
216// "adds $dst = $imm, $src1;;">;
217
Duraid Madinaf221c262005-10-28 17:46:35 +0000218def AND : AForm_DAG<0x03, 0x0b, (ops GR:$dst, GR:$src1, GR:$src2),
219 "and $dst = $src1, $src2;;",
220 [(set GR:$dst, (and GR:$src1, GR:$src2))]>;
221def ANDCM : AForm_DAG<0x03, 0x0b, (ops GR:$dst, GR:$src1, GR:$src2),
222 "andcm $dst = $src1, $src2;;",
223 [(set GR:$dst, (and GR:$src1, (not GR:$src2)))]>;
224// TODO: and/andcm/or/xor/add/sub/shift immediate forms
225def OR : AForm_DAG<0x03, 0x0b, (ops GR:$dst, GR:$src1, GR:$src2),
226 "or $dst = $src1, $src2;;",
227 [(set GR:$dst, (or GR:$src1, GR:$src2))]>;
228
229def pOR : AForm<0x03, 0x0b, (ops GR:$dst, GR:$src1, GR:$src2, PR:$qp),
230 "($qp) or $dst = $src1, $src2;;">;
231
Duraid Madinaf221c262005-10-28 17:46:35 +0000232// the following are all a bit unfortunate: we throw away the complement
233// of the compare!
234def CMPEQ : AForm_DAG<0x03, 0x0b, (ops PR:$dst, GR:$src1, GR:$src2),
235 "cmp.eq $dst, p0 = $src1, $src2;;",
236 [(set PR:$dst, (seteq GR:$src1, GR:$src2))]>;
237def CMPGT : AForm_DAG<0x03, 0x0b, (ops PR:$dst, GR:$src1, GR:$src2),
238 "cmp.gt $dst, p0 = $src1, $src2;;",
239 [(set PR:$dst, (setgt GR:$src1, GR:$src2))]>;
240def CMPGE : AForm_DAG<0x03, 0x0b, (ops PR:$dst, GR:$src1, GR:$src2),
241 "cmp.ge $dst, p0 = $src1, $src2;;",
242 [(set PR:$dst, (setge GR:$src1, GR:$src2))]>;
243def CMPLT : AForm_DAG<0x03, 0x0b, (ops PR:$dst, GR:$src1, GR:$src2),
244 "cmp.lt $dst, p0 = $src1, $src2;;",
245 [(set PR:$dst, (setlt GR:$src1, GR:$src2))]>;
246def CMPLE : AForm_DAG<0x03, 0x0b, (ops PR:$dst, GR:$src1, GR:$src2),
247 "cmp.le $dst, p0 = $src1, $src2;;",
248 [(set PR:$dst, (setle GR:$src1, GR:$src2))]>;
249def CMPNE : AForm_DAG<0x03, 0x0b, (ops PR:$dst, GR:$src1, GR:$src2),
250 "cmp.ne $dst, p0 = $src1, $src2;;",
251 [(set PR:$dst, (setne GR:$src1, GR:$src2))]>;
252def CMPLTU: AForm_DAG<0x03, 0x0b, (ops PR:$dst, GR:$src1, GR:$src2),
Duraid Madina57b7ee92005-10-30 10:14:19 +0000253 "cmp.ltu $dst, p0 = $src1, $src2;;",
Duraid Madinaf221c262005-10-28 17:46:35 +0000254 [(set PR:$dst, (setult GR:$src1, GR:$src2))]>;
255def CMPGTU: AForm_DAG<0x03, 0x0b, (ops PR:$dst, GR:$src1, GR:$src2),
Duraid Madina57b7ee92005-10-30 10:14:19 +0000256 "cmp.gtu $dst, p0 = $src1, $src2;;",
Duraid Madinaf221c262005-10-28 17:46:35 +0000257 [(set PR:$dst, (setugt GR:$src1, GR:$src2))]>;
258def CMPLEU: AForm_DAG<0x03, 0x0b, (ops PR:$dst, GR:$src1, GR:$src2),
Duraid Madina57b7ee92005-10-30 10:14:19 +0000259 "cmp.leu $dst, p0 = $src1, $src2;;",
Duraid Madinaf221c262005-10-28 17:46:35 +0000260 [(set PR:$dst, (setule GR:$src1, GR:$src2))]>;
261def CMPGEU: AForm_DAG<0x03, 0x0b, (ops PR:$dst, GR:$src1, GR:$src2),
Duraid Madina57b7ee92005-10-30 10:14:19 +0000262 "cmp.geu $dst, p0 = $src1, $src2;;",
Duraid Madinaf221c262005-10-28 17:46:35 +0000263 [(set PR:$dst, (setuge GR:$src1, GR:$src2))]>;
264
Duraid Madina88fc69f2005-10-31 01:42:11 +0000265// and we do the whole thing again for FP compares!
266def FCMPEQ : AForm_DAG<0x03, 0x0b, (ops PR:$dst, FP:$src1, FP:$src2),
267 "fcmp.eq $dst, p0 = $src1, $src2;;",
268 [(set PR:$dst, (seteq FP:$src1, FP:$src2))]>;
269def FCMPGT : AForm_DAG<0x03, 0x0b, (ops PR:$dst, FP:$src1, FP:$src2),
270 "fcmp.gt $dst, p0 = $src1, $src2;;",
271 [(set PR:$dst, (setgt FP:$src1, FP:$src2))]>;
272def FCMPGE : AForm_DAG<0x03, 0x0b, (ops PR:$dst, FP:$src1, FP:$src2),
273 "fcmp.ge $dst, p0 = $src1, $src2;;",
274 [(set PR:$dst, (setge FP:$src1, FP:$src2))]>;
275def FCMPLT : AForm_DAG<0x03, 0x0b, (ops PR:$dst, FP:$src1, FP:$src2),
276 "fcmp.lt $dst, p0 = $src1, $src2;;",
277 [(set PR:$dst, (setlt FP:$src1, FP:$src2))]>;
278def FCMPLE : AForm_DAG<0x03, 0x0b, (ops PR:$dst, FP:$src1, FP:$src2),
279 "fcmp.le $dst, p0 = $src1, $src2;;",
280 [(set PR:$dst, (setle FP:$src1, FP:$src2))]>;
281def FCMPNE : AForm_DAG<0x03, 0x0b, (ops PR:$dst, FP:$src1, FP:$src2),
282 "fcmp.neq $dst, p0 = $src1, $src2;;",
283 [(set PR:$dst, (setne FP:$src1, FP:$src2))]>;
284def FCMPLTU: AForm_DAG<0x03, 0x0b, (ops PR:$dst, FP:$src1, FP:$src2),
285 "fcmp.ltu $dst, p0 = $src1, $src2;;",
286 [(set PR:$dst, (setult FP:$src1, FP:$src2))]>;
287def FCMPGTU: AForm_DAG<0x03, 0x0b, (ops PR:$dst, FP:$src1, FP:$src2),
288 "fcmp.gtu $dst, p0 = $src1, $src2;;",
289 [(set PR:$dst, (setugt FP:$src1, FP:$src2))]>;
290def FCMPLEU: AForm_DAG<0x03, 0x0b, (ops PR:$dst, FP:$src1, FP:$src2),
291 "fcmp.leu $dst, p0 = $src1, $src2;;",
292 [(set PR:$dst, (setule FP:$src1, FP:$src2))]>;
293def FCMPGEU: AForm_DAG<0x03, 0x0b, (ops PR:$dst, FP:$src1, FP:$src2),
294 "fcmp.geu $dst, p0 = $src1, $src2;;",
295 [(set PR:$dst, (setuge FP:$src1, FP:$src2))]>;
296
Duraid Madina7ac646e2005-11-04 00:57:56 +0000297def PCMPEQUNCR0R0 : AForm<0x03, 0x0b, (ops PR:$dst, PR:$qp),
298 "($qp) cmp.eq.unc $dst, p0 = r0, r0;;">;
299
300def : Pat<(trunc GR:$src), // truncate i64 to i1
301 (CMPNE GR:$src, r0)>; // $src!=0? If so, PR:$dst=true
302
303let isTwoAddress=1 in {
304 def TPCMPEQR0R0 : AForm<0x03, 0x0b, (ops PR:$dst, PR:$bogus, PR:$qp),
305 "($qp) cmp.eq $dst, p0 = r0, r0;;">;
306 def TPCMPNER0R0 : AForm<0x03, 0x0b, (ops PR:$dst, PR:$bogus, PR:$qp),
307 "($qp) cmp.ne $dst, p0 = r0, r0;;">;
308}
309
310/* our pseudocode for OR on predicates is:
311pC = pA OR pB
312-------------
313(pA) cmp.eq.unc pC,p0 = r0,r0 // pC = pA
314 ;;
315(pB) cmp.eq pC,p0 = r0,r0 // if (pB) pC = 1 */
316
317def bOR : Pat<(or PR:$src1, PR:$src2),
318 (TPCMPEQR0R0 (PCMPEQUNCR0R0 PR:$src1), PR:$src2)>;
319
320/* our pseudocode for AND on predicates is:
321 *
322(pA) cmp.eq.unc pC,p0 = r0,r0 // pC = pA
323 cmp.eq pTemp,p0 = r0,r0 // pTemp = NOT pB
324 ;;
325(pB) cmp.ne pTemp,p0 = r0,r0
326 ;;
327(pTemp)cmp.ne pC,p0 = r0,r0 // if (NOT pB) pC = 0 */
328
329def bAND : Pat<(and PR:$src1, PR:$src2),
330 ( TPCMPNER0R0 (PCMPEQUNCR0R0 PR:$src1),
331 (TPCMPNER0R0 (CMPEQ r0, r0), PR:$src2) )>;
332
333/* one possible routine for XOR on predicates is:
334
335 // Compute px = py ^ pz
336 // using sum of products: px = (py & !pz) | (pz & !py)
337 // Uses 5 instructions in 3 cycles.
338 // cycle 1
339(pz) cmp.eq.unc px = r0, r0 // px = pz
340(py) cmp.eq.unc pt = r0, r0 // pt = py
341 ;;
342 // cycle 2
343(pt) cmp.ne.and px = r0, r0 // px = px & !pt (px = pz & !pt)
344(pz) cmp.ne.and pt = r0, r0 // pt = pt & !pz
345 ;;
346 } { .mmi
347 // cycle 3
348(pt) cmp.eq.or px = r0, r0 // px = px | pt
349
350*** Another, which we use here, requires one scratch GR. it is:
351
352 mov rt = 0 // initialize rt off critical path
353 ;;
354
355 // cycle 1
356(pz) cmp.eq.unc px = r0, r0 // px = pz
357(pz) mov rt = 1 // rt = pz
358 ;;
359 // cycle 2
360(py) cmp.ne px = 1, rt // if (py) px = !pz
361
362.. these routines kindly provided by Jim Hull
363*/
364
365def bXOR : Pat<(xor PR:$src1, PR:$src2),
366 (TPCMPIMM8NE (PCMPEQUNCR0R0 PR:$src2), 1,
367 (PADDS r0, 1, PR:$src2),
368 PR:$src1)>;
369
370def XOR : AForm_DAG<0x03, 0x0b, (ops GR:$dst, GR:$src1, GR:$src2),
371 "xor $dst = $src1, $src2;;",
372 [(set GR:$dst, (xor GR:$src1, GR:$src2))]>;
373
374def SHLADD: AForm_DAG<0x03, 0x0b, (ops GR:$dst,GR:$src1,s64imm:$imm,GR:$src2),
375 "shladd $dst = $src1, $imm, $src2;;",
376 [(set GR:$dst, (add GR:$src2, (shl GR:$src1, isSHLADDimm:$imm)))]>;
377
378def SHL : AForm_DAG<0x03, 0x0b, (ops GR:$dst, GR:$src1, GR:$src2),
379 "shl $dst = $src1, $src2;;",
380 [(set GR:$dst, (shl GR:$src1, GR:$src2))]>;
381
382def SHRU : AForm_DAG<0x03, 0x0b, (ops GR:$dst, GR:$src1, GR:$src2),
383 "shr.u $dst = $src1, $src2;;",
384 [(set GR:$dst, (srl GR:$src1, GR:$src2))]>;
385
386def SHRS : AForm_DAG<0x03, 0x0b, (ops GR:$dst, GR:$src1, GR:$src2),
387 "shr $dst = $src1, $src2;;",
388 [(set GR:$dst, (sra GR:$src1, GR:$src2))]>;
389
Duraid Madina17decbb2005-11-02 02:37:18 +0000390def MOV : AForm<0x03, 0x0b, (ops GR:$dst, GR:$src), "mov $dst = $src;;">;
Duraid Madina76034f92005-11-14 01:17:30 +0000391def FMOV : AForm<0x03, 0x0b, (ops FP:$dst, FP:$src),
392 "mov $dst = $src;;">; // XXX: there _is_ no fmov
Duraid Madina17decbb2005-11-02 02:37:18 +0000393def PMOV : AForm<0x03, 0x0b, (ops GR:$dst, GR:$src, PR:$qp),
394 "($qp) mov $dst = $src;;">;
395
396def SPILL_ALL_PREDICATES_TO_GR : AForm<0x03, 0x0b, (ops GR:$dst),
397 "mov $dst = pr;;">;
398def FILL_ALL_PREDICATES_FROM_GR : AForm<0x03, 0x0b, (ops GR:$src),
399 "mov pr = $src;;">;
400
401let isTwoAddress = 1 in {
402 def CMOV : AForm<0x03, 0x0b, (ops GR:$dst, GR:$src2, GR:$src, PR:$qp),
403 "($qp) mov $dst = $src;;">;
404}
405
406def PFMOV : AForm<0x03, 0x0b, (ops FP:$dst, FP:$src, PR:$qp),
407 "($qp) mov $dst = $src;;">;
408
409let isTwoAddress = 1 in {
410 def CFMOV : AForm<0x03, 0x0b, (ops FP:$dst, FP:$src2, FP:$src, PR:$qp),
411 "($qp) mov $dst = $src;;">;
412}
413
Duraid Madina76034f92005-11-14 01:17:30 +0000414// TODO: select bools
Duraid Madina17decbb2005-11-02 02:37:18 +0000415def SELECTINT : Pat<(select PR:$which, GR:$src1, GR:$src2),
416 (CMOV (MOV GR:$src2), GR:$src1, PR:$which)>; // note order!
Duraid Madina76034f92005-11-14 01:17:30 +0000417def SELECTFP : Pat<(select PR:$which, FP:$src1, FP:$src2),
418 (CFMOV (FMOV FP:$src2), FP:$src1, PR:$which)>; // note order!
Duraid Madina17decbb2005-11-02 02:37:18 +0000419
420// load constants of various sizes // FIXME: prettyprint -ve constants
421def : Pat<(i64 immSExt14:$imm), (ADDS r0, immSExt14:$imm)>;
422def : Pat<(i64 imm64:$imm), (MOVL imm64:$imm)>;
Chris Lattner674660f2005-11-03 05:45:34 +0000423def : Pat<(i1 -1), (CMPEQ r0, r0)>; // TODO: this should just be a ref to p0
Duraid Madinaf0f22a52005-11-03 10:09:32 +0000424def : Pat<(i1 0), (CMPNE r0, r0)>; // TODO: any instruction actually *using*
425 // this predicate should be killed!
Duraid Madina17decbb2005-11-02 02:37:18 +0000426
Duraid Madinaf221c262005-10-28 17:46:35 +0000427// TODO: support postincrement (reg, imm9) loads+stores - this needs more
428// tablegen support
429
Chris Lattner3e0335c2005-08-19 00:47:42 +0000430def PHI : PseudoInstIA64<(ops variable_ops), "PHI">;
431def IDEF : PseudoInstIA64<(ops variable_ops), "// IDEF">;
Duraid Madina88fc69f2005-10-31 01:42:11 +0000432
433def IDEF_GR_D : PseudoInstIA64_DAG<(ops GR:$reg), "// $reg = IDEF",
434 [(set GR:$reg, (undef))]>;
435def IDEF_FP_D : PseudoInstIA64_DAG<(ops FP:$reg), "// $reg = IDEF",
436 [(set FP:$reg, (undef))]>;
437def IDEF_PR_D : PseudoInstIA64_DAG<(ops PR:$reg), "// $reg = IDEF",
438 [(set PR:$reg, (undef))]>;
439
Chris Lattner3e0335c2005-08-19 00:47:42 +0000440def IUSE : PseudoInstIA64<(ops variable_ops), "// IUSE">;
441def ADJUSTCALLSTACKUP : PseudoInstIA64<(ops variable_ops),
442 "// ADJUSTCALLSTACKUP">;
443def ADJUSTCALLSTACKDOWN : PseudoInstIA64<(ops variable_ops),
444 "// ADJUSTCALLSTACKDOWN">;
Chris Lattner9e4a4ee2005-09-14 21:11:13 +0000445def PSEUDO_ALLOC : PseudoInstIA64<(ops GR:$foo), "// PSEUDO_ALLOC">;
Duraid Madina91ed0a12005-03-17 18:17:03 +0000446
447def ALLOC : AForm<0x03, 0x0b,
448 (ops GR:$dst, i8imm:$inputs, i8imm:$locals, i8imm:$outputs, i8imm:$rotating),
449 "alloc $dst = ar.pfs,$inputs,$locals,$outputs,$rotating;;">;
450
Duraid Madina91ed0a12005-03-17 18:17:03 +0000451let isTwoAddress = 1 in {
452 def TCMPNE : AForm<0x03, 0x0b,
453 (ops PR:$dst, PR:$src2, GR:$src3, GR:$src4),
454 "cmp.ne $dst, p0 = $src3, $src4;;">;
455
456 def TPCMPEQOR : AForm<0x03, 0x0b,
457 (ops PR:$dst, PR:$src2, GR:$src3, GR:$src4, PR:$qp),
458 "($qp) cmp.eq.or $dst, p0 = $src3, $src4;;">;
459
460 def TPCMPNE : AForm<0x03, 0x0b,
461 (ops PR:$dst, PR:$src2, GR:$src3, GR:$src4, PR:$qp),
462 "($qp) cmp.ne $dst, p0 = $src3, $src4;;">;
463
464 def TPCMPEQ : AForm<0x03, 0x0b,
465 (ops PR:$dst, PR:$src2, GR:$src3, GR:$src4, PR:$qp),
466 "($qp) cmp.eq $dst, p0 = $src3, $src4;;">;
467}
468
Duraid Madinafb43ef72005-04-11 05:55:56 +0000469def MOVSIMM14 : AForm<0x03, 0x0b, (ops GR:$dst, s14imm:$imm),
Duraid Madina91ed0a12005-03-17 18:17:03 +0000470 "mov $dst = $imm;;">;
Duraid Madinafb43ef72005-04-11 05:55:56 +0000471def MOVSIMM22 : AForm<0x03, 0x0b, (ops GR:$dst, s22imm:$imm),
472 "mov $dst = $imm;;">;
Duraid Madina0a7c2b92005-04-14 10:08:01 +0000473def MOVLIMM64 : AForm<0x03, 0x0b, (ops GR:$dst, s64imm:$imm),
Duraid Madina91ed0a12005-03-17 18:17:03 +0000474 "movl $dst = $imm;;">;
475
Duraid Madinafb43ef72005-04-11 05:55:56 +0000476def SHLI : AForm<0x03, 0x0b, (ops GR:$dst, GR:$src1, u6imm:$imm),
477 "shl $dst = $src1, $imm;;">;
Duraid Madinafb43ef72005-04-11 05:55:56 +0000478def SHRUI : AForm<0x03, 0x0b, (ops GR:$dst, GR:$src1, u6imm:$imm),
Duraid Madinab484f7c2005-04-07 12:32:24 +0000479 "shr.u $dst = $src1, $imm;;">;
Duraid Madinafb43ef72005-04-11 05:55:56 +0000480def SHRSI : AForm<0x03, 0x0b, (ops GR:$dst, GR:$src1, u6imm:$imm),
Duraid Madinab484f7c2005-04-07 12:32:24 +0000481 "shr $dst = $src1, $imm;;">;
Duraid Madina91ed0a12005-03-17 18:17:03 +0000482
Duraid Madina41ff5022005-04-08 10:01:48 +0000483def EXTRU : AForm<0x03, 0x0b, (ops GR:$dst, GR:$src1, u6imm:$imm1, u6imm:$imm2),
484 "extr.u $dst = $src1, $imm1, $imm2;;">;
485
Duraid Madina91ed0a12005-03-17 18:17:03 +0000486def DEPZ : AForm<0x03, 0x0b, (ops GR:$dst, GR:$src1, u6imm:$imm1, u6imm:$imm2), "dep.z $dst = $src1, $imm1, $imm2;;">;
487
Duraid Madina91ed0a12005-03-17 18:17:03 +0000488def PCMPEQOR : AForm<0x03, 0x0b, (ops PR:$dst, GR:$src1, GR:$src2, PR:$qp),
489 "($qp) cmp.eq.or $dst, p0 = $src1, $src2;;">;
490def PCMPEQUNC : AForm<0x03, 0x0b, (ops PR:$dst, GR:$src1, GR:$src2, PR:$qp),
491 "($qp) cmp.eq.unc $dst, p0 = $src1, $src2;;">;
492def PCMPNE : AForm<0x03, 0x0b, (ops PR:$dst, GR:$src1, GR:$src2, PR:$qp),
493 "($qp) cmp.ne $dst, p0 = $src1, $src2;;">;
494
495// two destinations!
496def BCMPEQ : AForm<0x03, 0x0b, (ops PR:$dst1, PR:$dst2, GR:$src1, GR:$src2),
497 "cmp.eq $dst1, dst2 = $src1, $src2;;">;
498
Duraid Madinab484f7c2005-04-07 12:32:24 +0000499def ADDIMM14 : AForm<0x03, 0x0b, (ops GR:$dst, GR:$src1, s14imm:$imm),
500 "adds $dst = $imm, $src1;;">;
Duraid Madina91ed0a12005-03-17 18:17:03 +0000501
Duraid Madinafb43ef72005-04-11 05:55:56 +0000502def ADDIMM22 : AForm<0x03, 0x0b, (ops GR:$dst, GR:$src1, s22imm:$imm),
Duraid Madina91ed0a12005-03-17 18:17:03 +0000503 "add $dst = $imm, $src1;;">;
Duraid Madinafb43ef72005-04-11 05:55:56 +0000504def CADDIMM22 : AForm<0x03, 0x0b, (ops GR:$dst, GR:$src1, s22imm:$imm, PR:$qp),
Duraid Madina91ed0a12005-03-17 18:17:03 +0000505 "($qp) add $dst = $imm, $src1;;">;
506
Duraid Madinab484f7c2005-04-07 12:32:24 +0000507def SUBIMM8 : AForm<0x03, 0x0b, (ops GR:$dst, s8imm:$imm, GR:$src2),
508 "sub $dst = $imm, $src2;;">;
Duraid Madina91ed0a12005-03-17 18:17:03 +0000509
Duraid Madina7abaf902005-10-29 16:08:30 +0000510let isStore = 1 in {
511 def ST1 : AForm<0x03, 0x0b, (ops GR:$dstPtr, GR:$value),
512 "st1 [$dstPtr] = $value;;">;
513 def ST2 : AForm<0x03, 0x0b, (ops GR:$dstPtr, GR:$value),
514 "st2 [$dstPtr] = $value;;">;
515 def ST4 : AForm<0x03, 0x0b, (ops GR:$dstPtr, GR:$value),
516 "st4 [$dstPtr] = $value;;">;
517 def ST8 : AForm<0x03, 0x0b, (ops GR:$dstPtr, GR:$value),
518 "st8 [$dstPtr] = $value;;">;
519 def STF4 : AForm<0x03, 0x0b, (ops GR:$dstPtr, FP:$value),
520 "stfs [$dstPtr] = $value;;">;
521 def STF8 : AForm<0x03, 0x0b, (ops GR:$dstPtr, FP:$value),
522 "stfd [$dstPtr] = $value;;">;
523}
Duraid Madina91ed0a12005-03-17 18:17:03 +0000524
Duraid Madina7abaf902005-10-29 16:08:30 +0000525let isLoad = 1 in {
526 def LD1 : AForm<0x03, 0x0b, (ops GR:$dst, GR:$srcPtr),
527 "ld1 $dst = [$srcPtr];;">;
528 def LD2 : AForm<0x03, 0x0b, (ops GR:$dst, GR:$srcPtr),
529 "ld2 $dst = [$srcPtr];;">;
530 def LD4 : AForm<0x03, 0x0b, (ops GR:$dst, GR:$srcPtr),
531 "ld4 $dst = [$srcPtr];;">;
532 def LD8 : AForm<0x03, 0x0b, (ops GR:$dst, GR:$srcPtr),
533 "ld8 $dst = [$srcPtr];;">;
534 def LDF4 : AForm<0x03, 0x0b, (ops FP:$dst, GR:$srcPtr),
535 "ldfs $dst = [$srcPtr];;">;
536 def LDF8 : AForm<0x03, 0x0b, (ops FP:$dst, GR:$srcPtr),
537 "ldfd $dst = [$srcPtr];;">;
538}
Duraid Madina91ed0a12005-03-17 18:17:03 +0000539
Duraid Madina7abaf902005-10-29 16:08:30 +0000540def POPCNT : AForm_DAG<0x03, 0x0b, (ops GR:$dst, GR:$src),
541 "popcnt $dst = $src;;",
542 [(set GR:$dst, (ctpop GR:$src))]>;
Duraid Madina25163d82005-05-11 05:16:09 +0000543
Duraid Madina7abaf902005-10-29 16:08:30 +0000544// some FP stuff: // TODO: single-precision stuff?
545def FADD : AForm_DAG<0x03, 0x0b, (ops FP:$dst, FP:$src1, FP:$src2),
546 "fadd $dst = $src1, $src2;;",
547 [(set FP:$dst, (fadd FP:$src1, FP:$src2))]>;
Duraid Madina91ed0a12005-03-17 18:17:03 +0000548def FADDS: AForm<0x03, 0x0b, (ops FP:$dst, FP:$src1, FP:$src2),
549 "fadd.s $dst = $src1, $src2;;">;
Duraid Madina7abaf902005-10-29 16:08:30 +0000550def FSUB : AForm_DAG<0x03, 0x0b, (ops FP:$dst, FP:$src1, FP:$src2),
551 "fsub $dst = $src1, $src2;;",
552 [(set FP:$dst, (fsub FP:$src1, FP:$src2))]>;
553def FMPY : AForm_DAG<0x03, 0x0b, (ops FP:$dst, FP:$src1, FP:$src2),
554 "fmpy $dst = $src1, $src2;;",
555 [(set FP:$dst, (fmul FP:$src1, FP:$src2))]>;
Duraid Madina7abaf902005-10-29 16:08:30 +0000556def FMA : AForm_DAG<0x03, 0x0b, (ops FP:$dst, FP:$src1, FP:$src2, FP:$src3),
557 "fma $dst = $src1, $src2, $src3;;",
558 [(set FP:$dst, (fadd (fmul FP:$src1, FP:$src2), FP:$src3))]>;
559def FMS : AForm_DAG<0x03, 0x0b, (ops FP:$dst, FP:$src1, FP:$src2, FP:$src3),
560 "fms $dst = $src1, $src2, $src3;;",
561 [(set FP:$dst, (fsub (fmul FP:$src1, FP:$src2), FP:$src3))]>;
562def FNMA : AForm_DAG<0x03, 0x0b, (ops FP:$dst, FP:$src1, FP:$src2, FP:$src3),
563 "fnma $dst = $src1, $src2, $src3;;",
564 [(set FP:$dst, (fneg (fadd (fmul FP:$src1, FP:$src2), FP:$src3)))]>;
Duraid Madina17decbb2005-11-02 02:37:18 +0000565def FABS : AForm_DAG<0x03, 0x0b, (ops FP:$dst, FP:$src),
566 "fabs $dst = $src;;",
567 [(set FP:$dst, (fabs FP:$src))]>;
Duraid Madina7abaf902005-10-29 16:08:30 +0000568def FNEG : AForm_DAG<0x03, 0x0b, (ops FP:$dst, FP:$src),
569 "fneg $dst = $src;;",
570 [(set FP:$dst, (fneg FP:$src))]>;
Duraid Madina17decbb2005-11-02 02:37:18 +0000571def FNEGABS : AForm_DAG<0x03, 0x0b, (ops FP:$dst, FP:$src),
572 "fnegabs $dst = $src;;",
573 [(set FP:$dst, (fneg (fabs FP:$src)))]>;
Duraid Madina91ed0a12005-03-17 18:17:03 +0000574
575def CFMAS1 : AForm<0x03, 0x0b,
576 (ops FP:$dst, FP:$src1, FP:$src2, FP:$src3, PR:$qp),
577 "($qp) fma.s1 $dst = $src1, $src2, $src3;;">;
578def CFNMAS1 : AForm<0x03, 0x0b,
579 (ops FP:$dst, FP:$src1, FP:$src2, FP:$src3, PR:$qp),
580 "($qp) fnma.s1 $dst = $src1, $src2, $src3;;">;
581
Duraid Madina41ff5022005-04-08 10:01:48 +0000582def FRCPAS1 : AForm<0x03, 0x0b, (ops FP:$dstFR, PR:$dstPR, FP:$src1, FP:$src2),
583 "frcpa.s1 $dstFR, $dstPR = $src1, $src2;;">;
Duraid Madina91ed0a12005-03-17 18:17:03 +0000584
585def XMAL : AForm<0x03, 0x0b, (ops FP:$dst, FP:$src1, FP:$src2, FP:$src3),
586 "xma.l $dst = $src1, $src2, $src3;;">;
587
588def FCVTXF : AForm<0x03, 0x0b, (ops FP:$dst, FP:$src),
589 "fcvt.xf $dst = $src;;">;
590def FCVTXUF : AForm<0x03, 0x0b, (ops FP:$dst, FP:$src),
591 "fcvt.xuf $dst = $src;;">;
592def FCVTXUFS1 : AForm<0x03, 0x0b, (ops FP:$dst, FP:$src),
593 "fcvt.xuf.s1 $dst = $src;;">;
594def FCVTFX : AForm<0x03, 0x0b, (ops FP:$dst, FP:$src),
595 "fcvt.fx $dst = $src;;">;
596def FCVTFXU : AForm<0x03, 0x0b, (ops FP:$dst, FP:$src),
597 "fcvt.fxu $dst = $src;;">;
598
599def FCVTFXTRUNC : AForm<0x03, 0x0b, (ops FP:$dst, FP:$src),
600 "fcvt.fx.trunc $dst = $src;;">;
601def FCVTFXUTRUNC : AForm<0x03, 0x0b, (ops FP:$dst, FP:$src),
602 "fcvt.fxu.trunc $dst = $src;;">;
603
604def FCVTFXTRUNCS1 : AForm<0x03, 0x0b, (ops FP:$dst, FP:$src),
605 "fcvt.fx.trunc.s1 $dst = $src;;">;
606def FCVTFXUTRUNCS1 : AForm<0x03, 0x0b, (ops FP:$dst, FP:$src),
607 "fcvt.fxu.trunc.s1 $dst = $src;;">;
608
609def FNORMD : AForm<0x03, 0x0b, (ops FP:$dst, FP:$src),
610 "fnorm.d $dst = $src;;">;
611
612def GETFD : AForm<0x03, 0x0b, (ops GR:$dst, FP:$src),
613 "getf.d $dst = $src;;">;
614def SETFD : AForm<0x03, 0x0b, (ops FP:$dst, GR:$src),
615 "setf.d $dst = $src;;">;
616
617def GETFSIG : AForm<0x03, 0x0b, (ops GR:$dst, FP:$src),
618 "getf.sig $dst = $src;;">;
619def SETFSIG : AForm<0x03, 0x0b, (ops FP:$dst, GR:$src),
620 "setf.sig $dst = $src;;">;
621
Duraid Madina6c912bf2005-11-01 03:07:25 +0000622// these four FP<->int conversion patterns need checking/cleaning
623def SINT_TO_FP : Pat<(sint_to_fp GR:$src),
624 (FNORMD (FCVTXF (SETFSIG GR:$src)))>;
625def UINT_TO_FP : Pat<(uint_to_fp GR:$src),
626 (FNORMD (FCVTXUF (SETFSIG GR:$src)))>;
Duraid Madinab81b6132005-11-01 03:32:15 +0000627def FP_TO_SINT : Pat<(i64 (fp_to_sint FP:$src)),
Duraid Madina6c912bf2005-11-01 03:07:25 +0000628 (GETFSIG (FCVTFXTRUNC FP:$src))>;
Duraid Madinab81b6132005-11-01 03:32:15 +0000629def FP_TO_UINT : Pat<(i64 (fp_to_uint FP:$src)),
Duraid Madina6c912bf2005-11-01 03:07:25 +0000630 (GETFSIG (FCVTFXUTRUNC FP:$src))>;
Duraid Madinab81b6132005-11-01 03:32:15 +0000631
Duraid Madina6c912bf2005-11-01 03:07:25 +0000632
Duraid Madina91ed0a12005-03-17 18:17:03 +0000633let isTerminator = 1, isBranch = 1 in {
Duraid Madinaf221c262005-10-28 17:46:35 +0000634 def BRL_NOTCALL : RawForm<0x03, 0xb0, (ops i64imm:$dst),
635 "(p0) brl.cond.sptk $dst;;">;
Duraid Madina91ed0a12005-03-17 18:17:03 +0000636 def BRLCOND_NOTCALL : RawForm<0x03, 0xb0, (ops PR:$qp, i64imm:$dst),
637 "($qp) brl.cond.sptk $dst;;">;
638 def BRCOND_NOTCALL : RawForm<0x03, 0xb0, (ops PR:$qp, GR:$dst),
639 "($qp) br.cond.sptk $dst;;">;
640}
641
642let isCall = 1, isTerminator = 1, isBranch = 1,
Chris Lattner6b917672005-04-12 15:12:19 +0000643 Uses = [out0,out1,out2,out3,out4,out5,out6,out7],
Duraid Madina91ed0a12005-03-17 18:17:03 +0000644// all calls clobber non-callee-saved registers, and for now, they are these:
645 Defs = [r2,r3,r8,r9,r10,r11,r14,r15,r16,r17,r18,r19,r20,r21,r22,r23,r24,
646 r25,r26,r27,r28,r29,r30,r31,
647 p6,p7,p8,p9,p10,p11,p12,p13,p14,p15,
648 F6,F7,F8,F9,F10,F11,F12,F13,F14,F15,
649 F32,F33,F34,F35,F36,F37,F38,F39,F40,F41,F42,F43,F44,F45,F46,F47,F48,F49,
650 F50,F51,F52,F53,F54,F55,F56,
651 F57,F58,F59,F60,F61,F62,F63,F64,F65,F66,F67,F68,F69,F70,F71,F72,F73,F74,
652 F75,F76,F77,F78,F79,F80,F81,
653 F82,F83,F84,F85,F86,F87,F88,F89,F90,F91,F92,F93,F94,F95,F96,F97,F98,F99,
654 F100,F101,F102,F103,F104,F105,
655 F106,F107,F108,F109,F110,F111,F112,F113,F114,F115,F116,F117,F118,F119,
656 F120,F121,F122,F123,F124,F125,F126,F127,
657 out0,out1,out2,out3,out4,out5,out6,out7] in {
Duraid Madinaf221c262005-10-28 17:46:35 +0000658// old pattern call
659 def BRCALL: RawForm<0x03, 0xb0, (ops calltarget:$dst),
Duraid Madina91ed0a12005-03-17 18:17:03 +0000660 "br.call.sptk rp = $dst;;">; // FIXME: teach llvm about branch regs?
Duraid Madinaf221c262005-10-28 17:46:35 +0000661// new daggy stuff!
662 def BRCALL_IPREL : RawForm<0x03, 0xb0, (ops calltarget:$dst, variable_ops),
663 "br.call.sptk rp = $dst;;">; // FIXME: teach llvm about branch regs?
664 def BRCALL_INDIRECT : RawForm<0x03, 0xb0, (ops GR:$branchreg, variable_ops),
665 "br.call.sptk rp = $branchreg;;">; // FIXME: teach llvm about branch regs?
Duraid Madina91ed0a12005-03-17 18:17:03 +0000666 def BRLCOND_CALL : RawForm<0x03, 0xb0, (ops PR:$qp, i64imm:$dst),
667 "($qp) brl.cond.call.sptk $dst;;">;
668 def BRCOND_CALL : RawForm<0x03, 0xb0, (ops PR:$qp, GR:$dst),
669 "($qp) br.cond.call.sptk $dst;;">;
670}
671
672let isTerminator = 1, isReturn = 1 in
673 def RET : RawForm<0x03, 0xb0, (ops), "br.ret.sptk.many rp;;">; // return
674
675