]> gcc.gnu.org Git - gcc.git/blame - gcc/config/ia64/ia64.md
Daily bump.
[gcc.git] / gcc / config / ia64 / ia64.md
CommitLineData
c65ebc55 1;; IA-64 Machine description template
5da4f548 2;; Copyright (C) 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
c65ebc55
JW
3;; Contributed by James E. Wilson <wilson@cygnus.com> and
4;; David Mosberger <davidm@hpl.hp.com>.
5
6;; This file is part of GNU CC.
7
8;; GNU CC is free software; you can redistribute it and/or modify
9;; it under the terms of the GNU General Public License as published by
10;; the Free Software Foundation; either version 2, or (at your option)
11;; any later version.
12
13;; GNU CC is distributed in the hope that it will be useful,
14;; but WITHOUT ANY WARRANTY; without even the implied warranty of
15;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16;; GNU General Public License for more details.
17
18;; You should have received a copy of the GNU General Public License
19;; along with GNU CC; see the file COPYING. If not, write to
20;; the Free Software Foundation, 59 Temple Place - Suite 330,
21;; Boston, MA 02111-1307, USA.
22
23;;- See file "rtl.def" for documentation on define_insn, match_*, et. al.
24
c65ebc55
JW
25;; ??? register_operand accepts (subreg:DI (mem:SI X)) which forces later
26;; reload. This will be fixed once scheduling support is turned on.
27
28;; ??? Optimize for post-increment addressing modes.
29
30;; ??? fselect is not supported, because there is no integer register
31;; equivalent.
32
33;; ??? fp abs/min/max instructions may also work for integer values.
34
35;; ??? Would a predicate_reg_operand predicate be useful? The HP one is buggy,
36;; it assumes the operand is a register and takes REGNO of it without checking.
37
38;; ??? Would a branch_reg_operand predicate be useful? The HP one is buggy,
39;; it assumes the operand is a register and takes REGNO of it without checking.
40
41;; ??? Go through list of documented named patterns and look for more to
42;; implement.
43
44;; ??? Go through instruction manual and look for more instructions that
45;; can be emitted.
46
47;; ??? Add function unit scheduling info for Itanium (TM) processor.
48
26102535
RH
49;; ??? Need a better way to describe alternate fp status registers.
50
086c0f96 51(define_constants
7b6e506e
RH
52 [; Relocations
53 (UNSPEC_LTOFF_DTPMOD 0)
54 (UNSPEC_LTOFF_DTPREL 1)
55 (UNSPEC_DTPREL 2)
56 (UNSPEC_LTOFF_TPREL 3)
57 (UNSPEC_TPREL 4)
58
59 (UNSPEC_LD_BASE 9)
60 (UNSPEC_GR_SPILL 10)
61 (UNSPEC_GR_RESTORE 11)
62 (UNSPEC_FR_SPILL 12)
63 (UNSPEC_FR_RESTORE 13)
64 (UNSPEC_FR_RECIP_APPROX 14)
65 (UNSPEC_PRED_REL_MUTEX 15)
66 (UNSPEC_POPCNT 16)
67 (UNSPEC_PIC_CALL 17)
68 (UNSPEC_MF 18)
69 (UNSPEC_CMPXCHG_ACQ 19)
70 (UNSPEC_FETCHADD_ACQ 20)
71 (UNSPEC_BSP_VALUE 21)
72 (UNSPEC_FLUSHRS 22)
73 (UNSPEC_BUNDLE_SELECTOR 23)
086c0f96
RH
74 (UNSPEC_ADDP4 24)
75 (UNSPEC_PROLOGUE_USE 25)
76 ])
77
78(define_constants
79 [(UNSPECV_ALLOC 0)
80 (UNSPECV_BLOCKAGE 1)
81 (UNSPECV_INSN_GROUP_BARRIER 2)
82 (UNSPECV_BREAK 3)
7b6e506e
RH
83 (UNSPECV_SET_BSP 4)
84 (UNSPECV_PSAC_ALL 5) ; pred.safe_across_calls
85 (UNSPECV_PSAC_NORMAL 6)
086c0f96 86 ])
c65ebc55
JW
87\f
88;; ::::::::::::::::::::
89;; ::
90;; :: Attributes
91;; ::
92;; ::::::::::::::::::::
93
94;; Instruction type. This primarily determines how instructions can be
95;; packed in bundles, and secondarily affects scheduling to function units.
96
97;; A alu, can go in I or M syllable of a bundle
98;; I integer
99;; M memory
100;; F floating-point
101;; B branch
102;; L long immediate, takes two syllables
103;; S stop bit
104
105;; ??? Should not have any pattern with type unknown. Perhaps add code to
106;; check this in md_reorg? Currently use unknown for patterns which emit
107;; multiple instructions, patterns which emit 0 instructions, and patterns
108;; which emit instruction that can go in any slot (e.g. nop).
109
1d5d7a21
RH
110(define_attr "itanium_class" "unknown,ignore,stop_bit,br,fcmp,fcvtfx,fld,
111 fmac,fmisc,frar_i,frar_m,frbr,frfr,frpr,ialu,icmp,ilog,ishf,ld,
112 chk_s,long_i,mmmul,mmshf,mmshfi,rse_m,scall,sem,stf,st,syst_m0,
113 syst_m,tbit,toar_i,toar_m,tobr,tofr,topr,xmpy,xtd,nop_b,nop_f,
114 nop_i,nop_m,nop_x,lfetch"
115 (const_string "unknown"))
52e12ad0 116
2130b7fb
BS
117;; chk_s has an I and an M form; use type A for convenience.
118(define_attr "type" "unknown,A,I,M,F,B,L,X,S"
119 (cond [(eq_attr "itanium_class" "ld,st,fld,stf,sem,nop_m") (const_string "M")
52e12ad0
BS
120 (eq_attr "itanium_class" "rse_m,syst_m,syst_m0") (const_string "M")
121 (eq_attr "itanium_class" "frar_m,toar_m,frfr,tofr") (const_string "M")
44eca121 122 (eq_attr "itanium_class" "lfetch") (const_string "M")
2130b7fb
BS
123 (eq_attr "itanium_class" "chk_s,ialu,icmp,ilog") (const_string "A")
124 (eq_attr "itanium_class" "fmisc,fmac,fcmp,xmpy") (const_string "F")
125 (eq_attr "itanium_class" "fcvtfx,nop_f") (const_string "F")
52e12ad0
BS
126 (eq_attr "itanium_class" "frar_i,toar_i,frbr,tobr") (const_string "I")
127 (eq_attr "itanium_class" "frpr,topr,ishf,xtd,tbit") (const_string "I")
2130b7fb
BS
128 (eq_attr "itanium_class" "mmmul,mmshf,mmshfi,nop_i") (const_string "I")
129 (eq_attr "itanium_class" "br,scall,nop_b") (const_string "B")
52e12ad0 130 (eq_attr "itanium_class" "stop_bit") (const_string "S")
2130b7fb 131 (eq_attr "itanium_class" "nop_x") (const_string "X")
52e12ad0
BS
132 (eq_attr "itanium_class" "long_i") (const_string "L")]
133 (const_string "unknown")))
c65ebc55 134
2130b7fb
BS
135(define_attr "itanium_requires_unit0" "no,yes"
136 (cond [(eq_attr "itanium_class" "syst_m0,sem,frfr,rse_m") (const_string "yes")
137 (eq_attr "itanium_class" "toar_m,frar_m") (const_string "yes")
138 (eq_attr "itanium_class" "frbr,tobr,mmmul") (const_string "yes")
139 (eq_attr "itanium_class" "tbit,ishf,topr,frpr") (const_string "yes")
140 (eq_attr "itanium_class" "toar_i,frar_i") (const_string "yes")
141 (eq_attr "itanium_class" "fmisc,fcmp") (const_string "yes")]
142 (const_string "no")))
143
e5bde68a
RH
144;; Predication. True iff this instruction can be predicated.
145
146(define_attr "predicable" "no,yes" (const_string "yes"))
147
c65ebc55
JW
148\f
149;; ::::::::::::::::::::
150;; ::
151;; :: Function Units
152;; ::
153;; ::::::::::::::::::::
154
2130b7fb
BS
155;; We define 6 "dummy" functional units. All the real work to decide which
156;; insn uses which unit is done by our MD_SCHED_REORDER hooks. We only
157;; have to ensure here that there are enough copies of the dummy unit so
158;; that the scheduler doesn't get confused by MD_SCHED_REORDER.
159;; Other than the 6 dummies for normal insns, we also add a single dummy unit
160;; for stop bits.
161
162(define_function_unit "dummy" 6 1 (eq_attr "itanium_class" "br") 0 0)
163(define_function_unit "dummy" 6 1 (eq_attr "itanium_class" "scall") 0 0)
164(define_function_unit "dummy" 6 1 (eq_attr "itanium_class" "fcmp") 2 0)
165(define_function_unit "dummy" 6 1 (eq_attr "itanium_class" "fcvtfx") 7 0)
166(define_function_unit "dummy" 6 1 (eq_attr "itanium_class" "fld") 9 0)
167(define_function_unit "dummy" 6 1 (eq_attr "itanium_class" "fmac") 5 0)
168(define_function_unit "dummy" 6 1 (eq_attr "itanium_class" "fmisc") 5 0)
169
170;; There is only one insn `mov = ar.bsp' for frar_i:
171(define_function_unit "dummy" 6 1 (eq_attr "itanium_class" "frar_i") 13 0)
172;; There is only ony insn `mov = ar.unat' for frar_m:
173(define_function_unit "dummy" 6 1 (eq_attr "itanium_class" "frar_m") 6 0)
174(define_function_unit "dummy" 6 1 (eq_attr "itanium_class" "frbr") 2 0)
175(define_function_unit "dummy" 6 1 (eq_attr "itanium_class" "frfr") 2 0)
176(define_function_unit "dummy" 6 1 (eq_attr "itanium_class" "frpr") 2 0)
177
178(define_function_unit "dummy" 6 1 (eq_attr "itanium_class" "ialu") 1 0)
179(define_function_unit "dummy" 6 1 (eq_attr "itanium_class" "icmp") 1 0)
180(define_function_unit "dummy" 6 1 (eq_attr "itanium_class" "ilog") 1 0)
181(define_function_unit "dummy" 6 1 (eq_attr "itanium_class" "ishf") 1 0)
182(define_function_unit "dummy" 6 1 (eq_attr "itanium_class" "ld") 2 0)
183(define_function_unit "dummy" 6 1 (eq_attr "itanium_class" "long_i") 1 0)
184(define_function_unit "dummy" 6 1 (eq_attr "itanium_class" "mmmul") 2 0)
185(define_function_unit "dummy" 6 1 (eq_attr "itanium_class" "mmshf") 2 0)
186(define_function_unit "dummy" 6 1 (eq_attr "itanium_class" "mmshfi") 2 0)
187
188;; Now we have only one insn (flushrs) of such class. We assume that flushrs
189;; is the 1st syllable of the bundle after stop bit.
190(define_function_unit "dummy" 6 1 (eq_attr "itanium_class" "rse_m") 0 0)
191(define_function_unit "dummy" 6 1 (eq_attr "itanium_class" "sem") 11 0)
192(define_function_unit "dummy" 6 1 (eq_attr "itanium_class" "stf") 1 0)
193(define_function_unit "dummy" 6 1 (eq_attr "itanium_class" "st") 1 0)
194(define_function_unit "dummy" 6 1 (eq_attr "itanium_class" "syst_m0") 1 0)
195;; Now we use only one insn `mf'. Therfore latency time is set up to 0.
196(define_function_unit "dummy" 6 1 (eq_attr "itanium_class" "syst_m") 0 0)
197(define_function_unit "dummy" 6 1 (eq_attr "itanium_class" "tbit") 1 0)
198
199;; There is only one insn `mov ar.pfs =' for toar_i therefore we use
200;; latency time equal to 0:
201(define_function_unit "dummy" 6 1 (eq_attr "itanium_class" "toar_i") 0 0)
202;; There are only ony 2 insns `mov ar.ccv =' and `mov ar.unat =' for toar_m:
203(define_function_unit "dummy" 6 1 (eq_attr "itanium_class" "toar_m") 5 0)
204(define_function_unit "dummy" 6 1 (eq_attr "itanium_class" "tobr") 1 0)
205(define_function_unit "dummy" 6 1 (eq_attr "itanium_class" "tofr") 9 0)
206(define_function_unit "dummy" 6 1 (eq_attr "itanium_class" "topr") 1 0)
207(define_function_unit "dummy" 6 1 (eq_attr "itanium_class" "xmpy") 7 0)
208(define_function_unit "dummy" 6 1 (eq_attr "itanium_class" "xtd") 1 0)
209
210(define_function_unit "dummy" 6 1 (eq_attr "itanium_class" "nop_m") 0 0)
211(define_function_unit "dummy" 6 1 (eq_attr "itanium_class" "nop_i") 0 0)
212(define_function_unit "dummy" 6 1 (eq_attr "itanium_class" "nop_f") 0 0)
213(define_function_unit "dummy" 6 1 (eq_attr "itanium_class" "nop_b") 0 0)
214(define_function_unit "dummy" 6 1 (eq_attr "itanium_class" "nop_x") 0 0)
215
216(define_function_unit "stop_bit" 1 1 (eq_attr "itanium_class" "stop_bit") 0 0)
217(define_function_unit "dummy" 6 1 (eq_attr "itanium_class" "ignore") 0 0)
218(define_function_unit "dummy" 6 1 (eq_attr "itanium_class" "unknown") 0 0)
c65ebc55
JW
219\f
220;; ::::::::::::::::::::
221;; ::
222;; :: Moves
223;; ::
224;; ::::::::::::::::::::
225
f2f90c63
RH
226;; Set of a single predicate register. This is only used to implement
227;; pr-to-pr move and complement.
228
229(define_insn "*movcci"
230 [(set (match_operand:CCI 0 "register_operand" "=c,c,c")
231 (match_operand:CCI 1 "nonmemory_operand" "O,n,c"))]
232 ""
233 "@
234 cmp.ne %0, p0 = r0, r0
235 cmp.eq %0, p0 = r0, r0
236 (%1) cmp.eq.unc %0, p0 = r0, r0"
52e12ad0 237 [(set_attr "itanium_class" "icmp")
f2f90c63
RH
238 (set_attr "predicable" "no")])
239
240(define_insn "movbi"
cd5c4048
RH
241 [(set (match_operand:BI 0 "nonimmediate_operand" "=c,c,?c,?*r, c,*r,*r,*m,*r")
242 (match_operand:BI 1 "move_operand" " O,n, c, c,*r, n,*m,*r,*r"))]
f2f90c63
RH
243 ""
244 "@
245 cmp.ne %0, %I0 = r0, r0
246 cmp.eq %0, %I0 = r0, r0
247 #
248 #
249 tbit.nz %0, %I0 = %1, 0
250 adds %0 = %1, r0
251 ld1%O1 %0 = %1%P1
cd5c4048
RH
252 st1%Q0 %0 = %1%P0
253 mov %0 = %1"
52e12ad0 254 [(set_attr "itanium_class" "icmp,icmp,unknown,unknown,tbit,ialu,ld,st,ialu")])
f2f90c63
RH
255
256(define_split
257 [(set (match_operand:BI 0 "register_operand" "")
258 (match_operand:BI 1 "register_operand" ""))]
259 "reload_completed
260 && GET_CODE (operands[0]) == REG && GR_REGNO_P (REGNO (operands[0]))
261 && GET_CODE (operands[1]) == REG && PR_REGNO_P (REGNO (operands[1]))"
262 [(cond_exec (ne (match_dup 1) (const_int 0))
263 (set (match_dup 0) (const_int 1)))
264 (cond_exec (eq (match_dup 1) (const_int 0))
265 (set (match_dup 0) (const_int 0)))]
266 "")
267
268(define_split
269 [(set (match_operand:BI 0 "register_operand" "")
270 (match_operand:BI 1 "register_operand" ""))]
271 "reload_completed
272 && GET_CODE (operands[0]) == REG && PR_REGNO_P (REGNO (operands[0]))
273 && GET_CODE (operands[1]) == REG && PR_REGNO_P (REGNO (operands[1]))"
274 [(set (match_dup 2) (match_dup 4))
275 (set (match_dup 3) (match_dup 5))
086c0f96 276 (set (match_dup 0) (unspec:BI [(match_dup 0)] UNSPEC_PRED_REL_MUTEX))]
f2f90c63
RH
277 "operands[2] = gen_rtx_REG (CCImode, REGNO (operands[0]));
278 operands[3] = gen_rtx_REG (CCImode, REGNO (operands[0]) + 1);
279 operands[4] = gen_rtx_REG (CCImode, REGNO (operands[1]));
280 operands[5] = gen_rtx_REG (CCImode, REGNO (operands[1]) + 1);")
281
c65ebc55
JW
282(define_expand "movqi"
283 [(set (match_operand:QI 0 "general_operand" "")
284 (match_operand:QI 1 "general_operand" ""))]
285 ""
c65ebc55 286{
7b6e506e
RH
287 rtx op1 = ia64_expand_move (operands[0], operands[1]);
288 if (!op1)
289 DONE;
290 operands[1] = op1;
1d5d7a21 291})
c65ebc55
JW
292
293(define_insn "*movqi_internal"
4b983fdc
RH
294 [(set (match_operand:QI 0 "destination_operand" "=r,r,r, m, r,*f,*f")
295 (match_operand:QI 1 "move_operand" "rO,J,m,rO,*f,rO,*f"))]
aebf2462 296 "ia64_move_ok (operands[0], operands[1])"
c65ebc55 297 "@
13da91fd 298 mov %0 = %r1
c65ebc55
JW
299 addl %0 = %1, r0
300 ld1%O1 %0 = %1%P1
13da91fd 301 st1%Q0 %0 = %r1%P0
c65ebc55 302 getf.sig %0 = %1
13da91fd
RH
303 setf.sig %0 = %r1
304 mov %0 = %1"
52e12ad0 305 [(set_attr "itanium_class" "ialu,ialu,ld,st,frfr,tofr,fmisc")])
c65ebc55
JW
306
307(define_expand "movhi"
308 [(set (match_operand:HI 0 "general_operand" "")
309 (match_operand:HI 1 "general_operand" ""))]
310 ""
c65ebc55 311{
7b6e506e
RH
312 rtx op1 = ia64_expand_move (operands[0], operands[1]);
313 if (!op1)
314 DONE;
315 operands[1] = op1;
1d5d7a21 316})
c65ebc55
JW
317
318(define_insn "*movhi_internal"
4b983fdc
RH
319 [(set (match_operand:HI 0 "destination_operand" "=r,r,r, m, r,*f,*f")
320 (match_operand:HI 1 "move_operand" "rO,J,m,rO,*f,rO,*f"))]
aebf2462 321 "ia64_move_ok (operands[0], operands[1])"
c65ebc55 322 "@
13da91fd 323 mov %0 = %r1
c65ebc55
JW
324 addl %0 = %1, r0
325 ld2%O1 %0 = %1%P1
13da91fd 326 st2%Q0 %0 = %r1%P0
c65ebc55 327 getf.sig %0 = %1
13da91fd
RH
328 setf.sig %0 = %r1
329 mov %0 = %1"
52e12ad0 330 [(set_attr "itanium_class" "ialu,ialu,ld,st,frfr,tofr,fmisc")])
c65ebc55
JW
331
332(define_expand "movsi"
333 [(set (match_operand:SI 0 "general_operand" "")
334 (match_operand:SI 1 "general_operand" ""))]
335 ""
c65ebc55 336{
7b6e506e
RH
337 rtx op1 = ia64_expand_move (operands[0], operands[1]);
338 if (!op1)
339 DONE;
340 operands[1] = op1;
1d5d7a21 341})
c65ebc55 342
5da4f548
SE
343;; This is used during early compilation to delay the decision on
344;; how to refer to a variable as long as possible. This is especially
345;; important between initial rtl generation and optimization for
346;; deferred functions, since we may acquire additional information
347;; on the variables used in the meantime.
348
349(define_insn_and_split "movsi_symbolic"
350 [(set (match_operand:SI 0 "register_operand" "=r")
351 (match_operand:SI 1 "symbolic_operand" "s"))
352 (clobber (match_scratch:DI 2 "=r"))
353 (use (reg:DI 1))]
354 ""
355 "* abort ();"
356 "!no_new_pseudos || reload_completed"
357 [(const_int 0)]
358{
359 rtx scratch = operands[2];
360 if (!reload_completed)
361 scratch = gen_reg_rtx (Pmode);
362 ia64_expand_load_address (operands[0], operands[1], scratch);
363 DONE;
364})
365
c65ebc55 366(define_insn "*movsi_internal"
97e242b0 367 [(set (match_operand:SI 0 "destination_operand" "=r,r,r,r, m, r,*f,*f, r,*d")
514f96e6 368 (match_operand:SI 1 "move_operand" "rO,J,i,m,rO,*f,rO,*f,*d,rK"))]
aebf2462 369 "ia64_move_ok (operands[0], operands[1])"
c65ebc55 370 "@
13da91fd 371 mov %0 = %r1
c65ebc55
JW
372 addl %0 = %1, r0
373 movl %0 = %1
374 ld4%O1 %0 = %1%P1
13da91fd 375 st4%Q0 %0 = %r1%P0
c65ebc55 376 getf.sig %0 = %1
13da91fd 377 setf.sig %0 = %r1
97e242b0
RH
378 mov %0 = %1
379 mov %0 = %1
380 mov %0 = %r1"
1d5d7a21 381 ;; frar_m, toar_m ??? why not frar_i and toar_i
52e12ad0 382 [(set_attr "itanium_class" "ialu,ialu,long_i,ld,st,frfr,tofr,fmisc,frar_m,toar_m")])
c65ebc55
JW
383
384(define_expand "movdi"
385 [(set (match_operand:DI 0 "general_operand" "")
386 (match_operand:DI 1 "general_operand" ""))]
387 ""
c65ebc55 388{
7b6e506e
RH
389 rtx op1 = ia64_expand_move (operands[0], operands[1]);
390 if (!op1)
391 DONE;
392 operands[1] = op1;
1d5d7a21 393})
c65ebc55 394
9a89adb8
RH
395;; This is used during early compilation to delay the decision on
396;; how to refer to a variable as long as possible. This is especially
397;; important between initial rtl generation and optimization for
398;; deferred functions, since we may acquire additional information
399;; on the variables used in the meantime.
400
401(define_insn_and_split "movdi_symbolic"
402 [(set (match_operand:DI 0 "register_operand" "=r")
403 (match_operand:DI 1 "symbolic_operand" "s"))
7b6e506e 404 (clobber (match_scratch:DI 2 "=r"))
9a89adb8
RH
405 (use (reg:DI 1))]
406 ""
407 "* abort ();"
7b6e506e 408 "!no_new_pseudos || reload_completed"
9a89adb8 409 [(const_int 0)]
7b6e506e
RH
410{
411 rtx scratch = operands[2];
412 if (!reload_completed)
5da4f548 413 scratch = gen_reg_rtx (Pmode);
7b6e506e
RH
414 ia64_expand_load_address (operands[0], operands[1], scratch);
415 DONE;
416})
9a89adb8 417
c65ebc55 418(define_insn "*movdi_internal"
4b983fdc 419 [(set (match_operand:DI 0 "destination_operand"
52e12ad0 420 "=r,r,r,r, m, r,*f,*f,*f, Q, r,*b, r,*e, r,*d, r,*c")
4b983fdc 421 (match_operand:DI 1 "move_operand"
52e12ad0 422 "rO,J,i,m,rO,*f,rO,*f, Q,*f,*b,rO,*e,rK,*d,rK,*c,rO"))]
aebf2462 423 "ia64_move_ok (operands[0], operands[1])"
9b7bf67d
RH
424{
425 static const char * const alt[] = {
1d5d7a21
RH
426 "%,mov %0 = %r1",
427 "%,addl %0 = %1, r0",
428 "%,movl %0 = %1",
429 "%,ld8%O1 %0 = %1%P1",
430 "%,st8%Q0 %0 = %r1%P0",
431 "%,getf.sig %0 = %1",
432 "%,setf.sig %0 = %r1",
433 "%,mov %0 = %1",
434 "%,ldf8 %0 = %1%P1",
435 "%,stf8 %0 = %1%P0",
436 "%,mov %0 = %1",
437 "%,mov %0 = %r1",
438 "%,mov %0 = %1",
439 "%,mov %0 = %1",
440 "%,mov %0 = %1",
441 "%,mov %0 = %1",
442 "mov %0 = pr",
443 "mov pr = %1, -1"
9b7bf67d
RH
444 };
445
9b7bf67d
RH
446 if (which_alternative == 2 && ! TARGET_NO_PIC
447 && symbolic_operand (operands[1], VOIDmode))
448 abort ();
449
450 return alt[which_alternative];
1d5d7a21 451}
52e12ad0 452 [(set_attr "itanium_class" "ialu,ialu,long_i,ld,st,frfr,tofr,fmisc,fld,stf,frbr,tobr,frar_i,toar_i,frar_m,toar_m,frpr,topr")])
c65ebc55 453
9b7bf67d
RH
454(define_split
455 [(set (match_operand:DI 0 "register_operand" "")
456 (match_operand:DI 1 "symbolic_operand" ""))]
457 "reload_completed && ! TARGET_NO_PIC"
458 [(const_int 0)]
9b7bf67d 459{
b5d37c6f 460 ia64_expand_load_address (operands[0], operands[1], NULL_RTX);
9b7bf67d 461 DONE;
1d5d7a21 462})
9b7bf67d 463
c65ebc55
JW
464(define_expand "load_fptr"
465 [(set (match_dup 2)
5da4f548 466 (plus:DI (reg:DI 1) (match_operand 1 "function_operand" "")))
ec039e3c 467 (set (match_operand:DI 0 "register_operand" "") (match_dup 3))]
c65ebc55 468 ""
c65ebc55 469{
ec039e3c
RH
470 operands[2] = no_new_pseudos ? operands[0] : gen_reg_rtx (DImode);
471 operands[3] = gen_rtx_MEM (DImode, operands[2]);
472 RTX_UNCHANGING_P (operands[3]) = 1;
1d5d7a21 473})
c65ebc55
JW
474
475(define_insn "*load_fptr_internal1"
476 [(set (match_operand:DI 0 "register_operand" "=r")
5da4f548 477 (plus:DI (reg:DI 1) (match_operand 1 "function_operand" "s")))]
c65ebc55
JW
478 ""
479 "addl %0 = @ltoff(@fptr(%1)), gp"
52e12ad0 480 [(set_attr "itanium_class" "ialu")])
c65ebc55
JW
481
482(define_insn "load_gprel"
483 [(set (match_operand:DI 0 "register_operand" "=r")
5da4f548 484 (plus:DI (reg:DI 1) (match_operand 1 "sdata_symbolic_operand" "s")))]
c65ebc55
JW
485 ""
486 "addl %0 = @gprel(%1), gp"
52e12ad0 487 [(set_attr "itanium_class" "ialu")])
c65ebc55 488
59da9a7d
JW
489(define_insn "gprel64_offset"
490 [(set (match_operand:DI 0 "register_operand" "=r")
491 (minus:DI (match_operand:DI 1 "symbolic_operand" "") (reg:DI 1)))]
492 ""
493 "movl %0 = @gprel(%1)"
52e12ad0 494 [(set_attr "itanium_class" "long_i")])
59da9a7d
JW
495
496(define_expand "load_gprel64"
497 [(set (match_dup 2)
b5d37c6f 498 (minus:DI (match_operand:DI 1 "symbolic_operand" "") (match_dup 3)))
59da9a7d 499 (set (match_operand:DI 0 "register_operand" "")
b5d37c6f 500 (plus:DI (match_dup 3) (match_dup 2)))]
59da9a7d 501 ""
ec039e3c
RH
502{
503 operands[2] = no_new_pseudos ? operands[0] : gen_reg_rtx (DImode);
b5d37c6f 504 operands[3] = pic_offset_table_rtx;
1d5d7a21 505})
59da9a7d 506
c65ebc55 507(define_expand "load_symptr"
b5d37c6f
BS
508 [(set (match_operand:DI 2 "register_operand" "")
509 (plus:DI (match_dup 4) (match_operand:DI 1 "got_symbolic_operand" "")))
dee4095a 510 (set (match_operand:DI 0 "register_operand" "") (match_dup 3))]
c65ebc55 511 ""
c65ebc55 512{
dee4095a 513 operands[3] = gen_rtx_MEM (DImode, operands[2]);
b5d37c6f 514 operands[4] = pic_offset_table_rtx;
dee4095a 515 RTX_UNCHANGING_P (operands[3]) = 1;
1d5d7a21 516})
c65ebc55
JW
517
518(define_insn "*load_symptr_internal1"
519 [(set (match_operand:DI 0 "register_operand" "=r")
5da4f548 520 (plus:DI (reg:DI 1) (match_operand 1 "got_symbolic_operand" "s")))]
c65ebc55
JW
521 ""
522 "addl %0 = @ltoff(%1), gp"
52e12ad0 523 [(set_attr "itanium_class" "ialu")])
c65ebc55 524
7b6e506e
RH
525(define_insn "load_ltoff_dtpmod"
526 [(set (match_operand:DI 0 "register_operand" "=r")
527 (plus:DI (reg:DI 1)
528 (unspec:DI [(match_operand:DI 1 "symbolic_operand" "")]
529 UNSPEC_LTOFF_DTPMOD)))]
530 ""
531 "addl %0 = @ltoff(@dtpmod(%1)), gp"
532 [(set_attr "itanium_class" "ialu")])
533
534(define_insn "load_ltoff_dtprel"
535 [(set (match_operand:DI 0 "register_operand" "=r")
536 (plus:DI (reg:DI 1)
537 (unspec:DI [(match_operand:DI 1 "symbolic_operand" "")]
538 UNSPEC_LTOFF_DTPREL)))]
539 ""
540 "addl %0 = @ltoff(@dtprel(%1)), gp"
541 [(set_attr "itanium_class" "ialu")])
542
543(define_expand "load_dtprel"
544 [(set (match_operand:DI 0 "register_operand" "")
545 (unspec:DI [(match_operand:DI 1 "symbolic_operand" "")]
546 UNSPEC_DTPREL))]
547 ""
548 "")
549
550(define_insn "*load_dtprel64"
551 [(set (match_operand:DI 0 "register_operand" "=r")
552 (unspec:DI [(match_operand:DI 1 "symbolic_operand" "")]
553 UNSPEC_DTPREL))]
554 "TARGET_TLS64"
555 "movl %0 = @dtprel(%1)"
556 [(set_attr "itanium_class" "long_i")])
557
558(define_insn "*load_dtprel22"
559 [(set (match_operand:DI 0 "register_operand" "=r")
560 (unspec:DI [(match_operand:DI 1 "symbolic_operand" "")]
561 UNSPEC_DTPREL))]
562 ""
563 "addl %0 = @dtprel(%1), r0"
564 [(set_attr "itanium_class" "ialu")])
565
566(define_expand "add_dtprel"
567 [(set (match_operand:DI 0 "register_operand" "")
568 (plus:DI (match_operand:DI 1 "register_operand" "")
569 (unspec:DI [(match_operand:DI 2 "symbolic_operand" "")]
570 UNSPEC_DTPREL)))]
571 "!TARGET_TLS64"
572 "")
573
574(define_insn "*add_dtprel14"
575 [(set (match_operand:DI 0 "register_operand" "=r")
576 (plus:DI (match_operand:DI 1 "register_operand" "r")
577 (unspec:DI [(match_operand:DI 2 "symbolic_operand" "")]
578 UNSPEC_DTPREL)))]
579 "TARGET_TLS14"
580 "adds %0 = @dtprel(%2), %1"
581 [(set_attr "itanium_class" "ialu")])
582
583(define_insn "*add_dtprel22"
584 [(set (match_operand:DI 0 "register_operand" "=r")
585 (plus:DI (match_operand:DI 1 "register_operand" "a")
586 (unspec:DI [(match_operand:DI 2 "symbolic_operand" "")]
587 UNSPEC_DTPREL)))]
588 "TARGET_TLS22"
589 "addl %0 = @dtprel(%2), %1"
590 [(set_attr "itanium_class" "ialu")])
591
592(define_insn "load_ltoff_tprel"
593 [(set (match_operand:DI 0 "register_operand" "=r")
594 (plus:DI (reg:DI 1)
595 (unspec:DI [(match_operand:DI 1 "symbolic_operand" "")]
596 UNSPEC_LTOFF_TPREL)))]
597 ""
598 "addl %0 = @ltoff(@tprel(%1)), gp"
599 [(set_attr "itanium_class" "ialu")])
600
601(define_expand "load_tprel"
602 [(set (match_operand:DI 0 "register_operand" "")
603 (unspec:DI [(match_operand:DI 1 "symbolic_operand" "")]
604 UNSPEC_TPREL))]
605 ""
606 "")
607
608(define_insn "*load_tprel64"
609 [(set (match_operand:DI 0 "register_operand" "=r")
610 (unspec:DI [(match_operand:DI 1 "symbolic_operand" "")]
611 UNSPEC_TPREL))]
612 "TARGET_TLS64"
613 "movl %0 = @tprel(%1)"
614 [(set_attr "itanium_class" "long_i")])
615
616(define_insn "*load_tprel22"
617 [(set (match_operand:DI 0 "register_operand" "=r")
618 (unspec:DI [(match_operand:DI 1 "symbolic_operand" "")]
619 UNSPEC_TPREL))]
620 ""
621 "addl %0 = @tprel(%1), r0"
622 [(set_attr "itanium_class" "ialu")])
623
624(define_expand "add_tprel"
625 [(set (match_operand:DI 0 "register_operand" "")
626 (plus:DI (match_operand:DI 1 "register_operand" "")
627 (unspec:DI [(match_operand:DI 2 "symbolic_operand" "")]
628 UNSPEC_TPREL)))]
629 "!TARGET_TLS64"
630 "")
631
632(define_insn "*add_tprel14"
633 [(set (match_operand:DI 0 "register_operand" "=r")
634 (plus:DI (match_operand:DI 1 "register_operand" "r")
635 (unspec:DI [(match_operand:DI 2 "symbolic_operand" "")]
636 UNSPEC_TPREL)))]
637 "TARGET_TLS14"
638 "adds %0 = @tprel(%2), %1"
639 [(set_attr "itanium_class" "ialu")])
640
641(define_insn "*add_tprel22"
642 [(set (match_operand:DI 0 "register_operand" "=r")
643 (plus:DI (match_operand:DI 1 "register_operand" "a")
644 (unspec:DI [(match_operand:DI 2 "symbolic_operand" "")]
645 UNSPEC_TPREL)))]
646 "TARGET_TLS22"
647 "addl %0 = @tprel(%2), %1"
648 [(set_attr "itanium_class" "ialu")])
649
3f622353
RH
650;; With no offsettable memory references, we've got to have a scratch
651;; around to play with the second word.
652(define_expand "movti"
653 [(parallel [(set (match_operand:TI 0 "general_operand" "")
654 (match_operand:TI 1 "general_operand" ""))
655 (clobber (match_scratch:DI 2 ""))])]
656 ""
3f622353 657{
7b6e506e
RH
658 rtx op1 = ia64_expand_move (operands[0], operands[1]);
659 if (!op1)
660 DONE;
661 operands[1] = op1;
1d5d7a21 662})
3f622353
RH
663
664(define_insn_and_split "*movti_internal"
665 [(set (match_operand:TI 0 "nonimmediate_operand" "=r,r,m")
666 (match_operand:TI 1 "general_operand" "ri,m,r"))
667 (clobber (match_scratch:DI 2 "=X,&r,&r"))]
668 "ia64_move_ok (operands[0], operands[1])"
669 "#"
670 "reload_completed"
671 [(const_int 0)]
3f622353 672{
703cf211 673 rtx adj1, adj2, in[2], out[2], insn;
3f622353
RH
674 int first;
675
676 adj1 = ia64_split_timode (in, operands[1], operands[2]);
677 adj2 = ia64_split_timode (out, operands[0], operands[2]);
678
679 first = 0;
680 if (reg_overlap_mentioned_p (out[0], in[1]))
681 {
682 if (reg_overlap_mentioned_p (out[1], in[0]))
683 abort ();
684 first = 1;
685 }
686
687 if (adj1 && adj2)
688 abort ();
689 if (adj1)
690 emit_insn (adj1);
691 if (adj2)
692 emit_insn (adj2);
703cf211
BS
693 insn = emit_insn (gen_rtx_SET (VOIDmode, out[first], in[first]));
694 if (GET_CODE (out[first]) == MEM
695 && GET_CODE (XEXP (out[first], 0)) == POST_MODIFY)
696 REG_NOTES (insn) = gen_rtx_EXPR_LIST (REG_INC,
697 XEXP (XEXP (out[first], 0), 0),
698 REG_NOTES (insn));
699 insn = emit_insn (gen_rtx_SET (VOIDmode, out[!first], in[!first]));
700 if (GET_CODE (out[!first]) == MEM
701 && GET_CODE (XEXP (out[!first], 0)) == POST_MODIFY)
702 REG_NOTES (insn) = gen_rtx_EXPR_LIST (REG_INC,
703 XEXP (XEXP (out[!first], 0), 0),
704 REG_NOTES (insn));
3f622353 705 DONE;
1d5d7a21 706}
52e12ad0 707 [(set_attr "itanium_class" "unknown")
3f622353 708 (set_attr "predicable" "no")])
e314e331 709
3f622353
RH
710;; ??? SSA creates these. Can't allow memories since we don't have
711;; the scratch register. Fortunately combine will know how to add
712;; the clobber and scratch.
713(define_insn_and_split "*movti_internal_reg"
714 [(set (match_operand:TI 0 "register_operand" "=r")
715 (match_operand:TI 1 "nonmemory_operand" "ri"))]
716 ""
e314e331 717 "#"
3f622353
RH
718 "reload_completed"
719 [(const_int 0)]
3f622353
RH
720{
721 rtx in[2], out[2];
722 int first;
723
724 ia64_split_timode (in, operands[1], NULL_RTX);
725 ia64_split_timode (out, operands[0], NULL_RTX);
726
727 first = 0;
728 if (reg_overlap_mentioned_p (out[0], in[1]))
729 {
730 if (reg_overlap_mentioned_p (out[1], in[0]))
731 abort ();
732 first = 1;
733 }
734
735 emit_insn (gen_rtx_SET (VOIDmode, out[first], in[first]));
736 emit_insn (gen_rtx_SET (VOIDmode, out[!first], in[!first]));
737 DONE;
1d5d7a21 738}
52e12ad0 739 [(set_attr "itanium_class" "unknown")
e314e331
JW
740 (set_attr "predicable" "no")])
741
3f622353
RH
742(define_expand "reload_inti"
743 [(parallel [(set (match_operand:TI 0 "register_operand" "=r")
744 (match_operand:TI 1 "" "m"))
60a3c181 745 (clobber (match_operand:TI 2 "register_operand" "=&r"))])]
3f622353 746 ""
3f622353 747{
60a3c181
RH
748 unsigned int s_regno = REGNO (operands[2]);
749 if (s_regno == REGNO (operands[0]))
750 s_regno += 1;
751 operands[2] = gen_rtx_REG (DImode, s_regno);
1d5d7a21 752})
3f622353
RH
753
754(define_expand "reload_outti"
755 [(parallel [(set (match_operand:TI 0 "" "=m")
756 (match_operand:TI 1 "register_operand" "r"))
60a3c181 757 (clobber (match_operand:TI 2 "register_operand" "=&r"))])]
3f622353 758 ""
3f622353 759{
60a3c181
RH
760 unsigned int s_regno = REGNO (operands[2]);
761 if (s_regno == REGNO (operands[1]))
762 s_regno += 1;
763 operands[2] = gen_rtx_REG (DImode, s_regno);
1d5d7a21 764})
e314e331 765
c65ebc55
JW
766;; Floating Point Moves
767;;
768;; Note - Patterns for SF mode moves are compulsory, but
05713b80 769;; patterns for DF are optional, as GCC can synthesize them.
c65ebc55
JW
770
771(define_expand "movsf"
772 [(set (match_operand:SF 0 "general_operand" "")
773 (match_operand:SF 1 "general_operand" ""))]
774 ""
c65ebc55 775{
7b6e506e
RH
776 rtx op1 = ia64_expand_move (operands[0], operands[1]);
777 if (!op1)
778 DONE;
779 operands[1] = op1;
1d5d7a21 780})
c65ebc55 781
c65ebc55 782(define_insn "*movsf_internal"
4b983fdc
RH
783 [(set (match_operand:SF 0 "destination_operand" "=f,f, Q,*r, f,*r,*r, m")
784 (match_operand:SF 1 "general_operand" "fG,Q,fG,fG,*r,*r, m,*r"))]
aebf2462 785 "ia64_move_ok (operands[0], operands[1])"
c65ebc55 786 "@
1d5d7a21
RH
787 mov %0 = %F1
788 ldfs %0 = %1%P1
789 stfs %0 = %F1%P0
790 getf.s %0 = %F1
791 setf.s %0 = %1
792 mov %0 = %1
793 ld4%O1 %0 = %1%P1
794 st4%Q0 %0 = %1%P0"
52e12ad0 795 [(set_attr "itanium_class" "fmisc,fld,stf,frfr,tofr,ialu,ld,st")])
c65ebc55
JW
796
797(define_expand "movdf"
798 [(set (match_operand:DF 0 "general_operand" "")
799 (match_operand:DF 1 "general_operand" ""))]
800 ""
c65ebc55 801{
7b6e506e
RH
802 rtx op1 = ia64_expand_move (operands[0], operands[1]);
803 if (!op1)
804 DONE;
805 operands[1] = op1;
1d5d7a21 806})
c65ebc55 807
c65ebc55 808(define_insn "*movdf_internal"
4b983fdc
RH
809 [(set (match_operand:DF 0 "destination_operand" "=f,f, Q,*r, f,*r,*r, m")
810 (match_operand:DF 1 "general_operand" "fG,Q,fG,fG,*r,*r, m,*r"))]
aebf2462 811 "ia64_move_ok (operands[0], operands[1])"
c65ebc55 812 "@
1d5d7a21
RH
813 mov %0 = %F1
814 ldfd %0 = %1%P1
815 stfd %0 = %F1%P0
816 getf.d %0 = %F1
817 setf.d %0 = %1
818 mov %0 = %1
819 ld8%O1 %0 = %1%P1
820 st8%Q0 %0 = %1%P0"
52e12ad0 821 [(set_attr "itanium_class" "fmisc,fld,stf,frfr,tofr,ialu,ld,st")])
c65ebc55 822
3f622353
RH
823;; With no offsettable memory references, we've got to have a scratch
824;; around to play with the second word if the variable winds up in GRs.
825(define_expand "movtf"
826 [(set (match_operand:TF 0 "general_operand" "")
827 (match_operand:TF 1 "general_operand" ""))]
23c108af 828 "INTEL_EXTENDED_IEEE_FORMAT"
e5bde68a 829{
3f622353
RH
830 /* We must support TFmode loads into general registers for stdarg/vararg
831 and unprototyped calls. We split them into DImode loads for convenience.
832 We don't need TFmode stores from general regs, because a stdarg/vararg
833 routine does a block store to memory of unnamed arguments. */
834 if (GET_CODE (operands[0]) == REG
835 && GR_REGNO_P (REGNO (operands[0])))
836 {
837 /* We're hoping to transform everything that deals with TFmode
838 quantities and GR registers early in the compiler. */
839 if (no_new_pseudos)
840 abort ();
841
842 /* Struct to register can just use TImode instead. */
843 if ((GET_CODE (operands[1]) == SUBREG
844 && GET_MODE (SUBREG_REG (operands[1])) == TImode)
845 || (GET_CODE (operands[1]) == REG
846 && GR_REGNO_P (REGNO (operands[1]))))
847 {
848 emit_move_insn (gen_rtx_REG (TImode, REGNO (operands[0])),
849 SUBREG_REG (operands[1]));
850 DONE;
851 }
852
853 if (GET_CODE (operands[1]) == CONST_DOUBLE)
854 {
855 emit_move_insn (gen_rtx_REG (DImode, REGNO (operands[0])),
2bf47a10 856 operand_subword (operands[1], 0, 0, TFmode));
3f622353 857 emit_move_insn (gen_rtx_REG (DImode, REGNO (operands[0]) + 1),
2bf47a10 858 operand_subword (operands[1], 1, 0, TFmode));
3f622353
RH
859 DONE;
860 }
861
862 /* If the quantity is in a register not known to be GR, spill it. */
863 if (register_operand (operands[1], TFmode))
864 operands[1] = spill_tfmode_operand (operands[1], 1);
865
866 if (GET_CODE (operands[1]) == MEM)
867 {
868 rtx out[2];
869
870 out[WORDS_BIG_ENDIAN] = gen_rtx_REG (DImode, REGNO (operands[0]));
871 out[!WORDS_BIG_ENDIAN] = gen_rtx_REG (DImode, REGNO (operands[0])+1);
872
f4ef873c
RK
873 emit_move_insn (out[0], adjust_address (operands[1], DImode, 0));
874 emit_move_insn (out[1], adjust_address (operands[1], DImode, 8));
3f622353
RH
875 DONE;
876 }
877
878 abort ();
879 }
880
881 if (! reload_in_progress && ! reload_completed)
882 {
883 operands[0] = spill_tfmode_operand (operands[0], 0);
884 operands[1] = spill_tfmode_operand (operands[1], 0);
885
886 if (! ia64_move_ok (operands[0], operands[1]))
887 operands[1] = force_reg (TFmode, operands[1]);
888 }
1d5d7a21 889})
e5bde68a 890
3b572406 891;; ??? There's no easy way to mind volatile acquire/release semantics.
75cdbeb8 892
3f622353
RH
893(define_insn "*movtf_internal"
894 [(set (match_operand:TF 0 "destination_tfmode_operand" "=f,f, m")
895 (match_operand:TF 1 "general_tfmode_operand" "fG,m,fG"))]
23c108af 896 "INTEL_EXTENDED_IEEE_FORMAT && ia64_move_ok (operands[0], operands[1])"
e5bde68a 897 "@
1d5d7a21
RH
898 mov %0 = %F1
899 ldfe %0 = %1%P1
900 stfe %0 = %F1%P0"
52e12ad0 901 [(set_attr "itanium_class" "fmisc,fld,stf")])
c65ebc55
JW
902\f
903;; ::::::::::::::::::::
904;; ::
905;; :: Conversions
906;; ::
907;; ::::::::::::::::::::
908
909;; Signed conversions from a smaller integer to a larger integer
910
911(define_insn "extendqidi2"
0551c32d
RH
912 [(set (match_operand:DI 0 "gr_register_operand" "=r")
913 (sign_extend:DI (match_operand:QI 1 "gr_register_operand" "r")))]
c65ebc55
JW
914 ""
915 "sxt1 %0 = %1"
52e12ad0 916 [(set_attr "itanium_class" "xtd")])
c65ebc55
JW
917
918(define_insn "extendhidi2"
0551c32d
RH
919 [(set (match_operand:DI 0 "gr_register_operand" "=r")
920 (sign_extend:DI (match_operand:HI 1 "gr_register_operand" "r")))]
c65ebc55
JW
921 ""
922 "sxt2 %0 = %1"
52e12ad0 923 [(set_attr "itanium_class" "xtd")])
c65ebc55
JW
924
925(define_insn "extendsidi2"
655f2eb9
RH
926 [(set (match_operand:DI 0 "grfr_register_operand" "=r,?f")
927 (sign_extend:DI (match_operand:SI 1 "grfr_register_operand" "r,f")))]
c65ebc55
JW
928 ""
929 "@
930 sxt4 %0 = %1
aebf2462 931 fsxt.r %0 = %1, %1"
52e12ad0 932 [(set_attr "itanium_class" "xtd,fmisc")])
c65ebc55
JW
933
934;; Unsigned conversions from a smaller integer to a larger integer
935
936(define_insn "zero_extendqidi2"
0551c32d
RH
937 [(set (match_operand:DI 0 "gr_register_operand" "=r,r")
938 (zero_extend:DI (match_operand:QI 1 "gr_nonimmediate_operand" "r,m")))]
c65ebc55
JW
939 ""
940 "@
941 zxt1 %0 = %1
942 ld1%O1 %0 = %1%P1"
52e12ad0 943 [(set_attr "itanium_class" "xtd,ld")])
c65ebc55
JW
944
945(define_insn "zero_extendhidi2"
0551c32d
RH
946 [(set (match_operand:DI 0 "gr_register_operand" "=r,r")
947 (zero_extend:DI (match_operand:HI 1 "gr_nonimmediate_operand" "r,m")))]
c65ebc55
JW
948 ""
949 "@
950 zxt2 %0 = %1
951 ld2%O1 %0 = %1%P1"
52e12ad0 952 [(set_attr "itanium_class" "xtd,ld")])
c65ebc55
JW
953
954(define_insn "zero_extendsidi2"
655f2eb9 955 [(set (match_operand:DI 0 "grfr_register_operand" "=r,r,?f")
0551c32d 956 (zero_extend:DI
655f2eb9 957 (match_operand:SI 1 "grfr_nonimmediate_operand" "r,m,f")))]
c65ebc55
JW
958 ""
959 "@
960 zxt4 %0 = %1
961 ld4%O1 %0 = %1%P1
aebf2462 962 fmix.r %0 = f0, %1"
52e12ad0 963 [(set_attr "itanium_class" "xtd,ld,fmisc")])
c65ebc55
JW
964
965;; Convert between floating point types of different sizes.
966
640cea5f
JW
967;; At first glance, it would appear that emitting fnorm for an extending
968;; conversion is unnecessary. However, the stf and getf instructions work
969;; correctly only if the input is properly rounded for its type. In
970;; particular, we get the wrong result for getf.d/stfd if the input is a
971;; denorm single. Since we don't know what the next instruction will be, we
972;; have to emit an fnorm.
973
e8e20f18
RH
974;; ??? Optimization opportunity here. Get rid of the insn altogether
975;; when we can. Should probably use a scheme like has been proposed
976;; for ia32 in dealing with operands that match unary operators. This
640cea5f
JW
977;; would let combine merge the thing into adjacent insns. See also how the
978;; mips port handles SIGN_EXTEND as operands to integer arithmetic insns via
979;; se_register_operand.
c65ebc55 980
640cea5f
JW
981(define_insn "extendsfdf2"
982 [(set (match_operand:DF 0 "fr_register_operand" "=f")
983 (float_extend:DF (match_operand:SF 1 "fr_register_operand" "f")))]
c65ebc55 984 ""
640cea5f
JW
985 "fnorm.d %0 = %1"
986 [(set_attr "itanium_class" "fmac")])
c65ebc55 987
640cea5f
JW
988(define_insn "extendsftf2"
989 [(set (match_operand:TF 0 "fr_register_operand" "=f")
990 (float_extend:TF (match_operand:SF 1 "fr_register_operand" "f")))]
23c108af 991 "INTEL_EXTENDED_IEEE_FORMAT"
640cea5f
JW
992 "fnorm %0 = %1"
993 [(set_attr "itanium_class" "fmac")])
3f622353 994
640cea5f
JW
995(define_insn "extenddftf2"
996 [(set (match_operand:TF 0 "fr_register_operand" "=f")
997 (float_extend:TF (match_operand:DF 1 "fr_register_operand" "f")))]
23c108af 998 "INTEL_EXTENDED_IEEE_FORMAT"
640cea5f
JW
999 "fnorm %0 = %1"
1000 [(set_attr "itanium_class" "fmac")])
3f622353 1001
c65ebc55 1002(define_insn "truncdfsf2"
0551c32d
RH
1003 [(set (match_operand:SF 0 "fr_register_operand" "=f")
1004 (float_truncate:SF (match_operand:DF 1 "fr_register_operand" "f")))]
c65ebc55 1005 ""
aebf2462 1006 "fnorm.s %0 = %1"
52e12ad0 1007 [(set_attr "itanium_class" "fmac")])
c65ebc55 1008
3f622353 1009(define_insn "trunctfsf2"
0551c32d
RH
1010 [(set (match_operand:SF 0 "fr_register_operand" "=f")
1011 (float_truncate:SF (match_operand:TF 1 "fr_register_operand" "f")))]
23c108af 1012 "INTEL_EXTENDED_IEEE_FORMAT"
aebf2462 1013 "fnorm.s %0 = %1"
52e12ad0 1014 [(set_attr "itanium_class" "fmac")])
c65ebc55 1015
3f622353 1016(define_insn "trunctfdf2"
0551c32d
RH
1017 [(set (match_operand:DF 0 "fr_register_operand" "=f")
1018 (float_truncate:DF (match_operand:TF 1 "fr_register_operand" "f")))]
23c108af 1019 "INTEL_EXTENDED_IEEE_FORMAT"
aebf2462 1020 "fnorm.d %0 = %1"
52e12ad0 1021 [(set_attr "itanium_class" "fmac")])
e5bde68a
RH
1022
1023;; Convert between signed integer types and floating point.
1024
3f622353 1025(define_insn "floatditf2"
0551c32d
RH
1026 [(set (match_operand:TF 0 "fr_register_operand" "=f")
1027 (float:TF (match_operand:DI 1 "fr_register_operand" "f")))]
23c108af 1028 "INTEL_EXTENDED_IEEE_FORMAT"
e5bde68a 1029 "fcvt.xf %0 = %1"
52e12ad0 1030 [(set_attr "itanium_class" "fcvtfx")])
c65ebc55 1031
23c108af
SE
1032;; ??? Suboptimal. This should be split somehow.
1033(define_insn "floatdidf2"
1034 [(set (match_operand:DF 0 "register_operand" "=f")
1035 (float:DF (match_operand:DI 1 "register_operand" "f")))]
1036 "!INTEL_EXTENDED_IEEE_FORMAT"
1037 "fcvt.xf %0 = %1\;;;\;fnorm.d %0 = %0"
1038 [(set_attr "itanium_class" "fcvtfx")])
1039
1040;; ??? Suboptimal. This should be split somehow.
1041(define_insn "floatdisf2"
1042 [(set (match_operand:SF 0 "register_operand" "=f")
1043 (float:SF (match_operand:DI 1 "register_operand" "f")))]
1044 "!INTEL_EXTENDED_IEEE_FORMAT"
1045 "fcvt.xf %0 = %1\;;;\;fnorm.s %0 = %0"
1046 [(set_attr "itanium_class" "fcvtfx")])
1047
c65ebc55 1048(define_insn "fix_truncsfdi2"
0551c32d
RH
1049 [(set (match_operand:DI 0 "fr_register_operand" "=f")
1050 (fix:DI (match_operand:SF 1 "fr_register_operand" "f")))]
c65ebc55 1051 ""
aebf2462 1052 "fcvt.fx.trunc %0 = %1"
52e12ad0 1053 [(set_attr "itanium_class" "fcvtfx")])
c65ebc55
JW
1054
1055(define_insn "fix_truncdfdi2"
0551c32d
RH
1056 [(set (match_operand:DI 0 "fr_register_operand" "=f")
1057 (fix:DI (match_operand:DF 1 "fr_register_operand" "f")))]
c65ebc55 1058 ""
aebf2462 1059 "fcvt.fx.trunc %0 = %1"
52e12ad0 1060 [(set_attr "itanium_class" "fcvtfx")])
c65ebc55 1061
3f622353 1062(define_insn "fix_trunctfdi2"
0551c32d
RH
1063 [(set (match_operand:DI 0 "fr_register_operand" "=f")
1064 (fix:DI (match_operand:TF 1 "fr_register_operand" "f")))]
23c108af 1065 "INTEL_EXTENDED_IEEE_FORMAT"
aebf2462 1066 "fcvt.fx.trunc %0 = %1"
52e12ad0 1067 [(set_attr "itanium_class" "fcvtfx")])
3f622353 1068
655f2eb9
RH
1069(define_insn "fix_trunctfdi2_alts"
1070 [(set (match_operand:DI 0 "fr_register_operand" "=f")
1071 (fix:DI (match_operand:TF 1 "fr_register_operand" "f")))
1072 (use (match_operand:SI 2 "const_int_operand" ""))]
23c108af 1073 "INTEL_EXTENDED_IEEE_FORMAT"
aebf2462 1074 "fcvt.fx.trunc.s%2 %0 = %1"
52e12ad0 1075 [(set_attr "itanium_class" "fcvtfx")])
655f2eb9 1076
c65ebc55
JW
1077;; Convert between unsigned integer types and floating point.
1078
1079(define_insn "floatunsdisf2"
0551c32d
RH
1080 [(set (match_operand:SF 0 "fr_register_operand" "=f")
1081 (unsigned_float:SF (match_operand:DI 1 "fr_register_operand" "f")))]
c65ebc55 1082 ""
aebf2462 1083 "fcvt.xuf.s %0 = %1"
52e12ad0 1084 [(set_attr "itanium_class" "fcvtfx")])
c65ebc55
JW
1085
1086(define_insn "floatunsdidf2"
0551c32d
RH
1087 [(set (match_operand:DF 0 "fr_register_operand" "=f")
1088 (unsigned_float:DF (match_operand:DI 1 "fr_register_operand" "f")))]
c65ebc55 1089 ""
aebf2462 1090 "fcvt.xuf.d %0 = %1"
52e12ad0 1091 [(set_attr "itanium_class" "fcvtfx")])
c65ebc55 1092
3f622353 1093(define_insn "floatunsditf2"
0551c32d
RH
1094 [(set (match_operand:TF 0 "fr_register_operand" "=f")
1095 (unsigned_float:TF (match_operand:DI 1 "fr_register_operand" "f")))]
23c108af 1096 "INTEL_EXTENDED_IEEE_FORMAT"
aebf2462 1097 "fcvt.xuf %0 = %1"
52e12ad0 1098 [(set_attr "itanium_class" "fcvtfx")])
3f622353 1099
c65ebc55 1100(define_insn "fixuns_truncsfdi2"
0551c32d
RH
1101 [(set (match_operand:DI 0 "fr_register_operand" "=f")
1102 (unsigned_fix:DI (match_operand:SF 1 "fr_register_operand" "f")))]
c65ebc55 1103 ""
aebf2462 1104 "fcvt.fxu.trunc %0 = %1"
52e12ad0 1105 [(set_attr "itanium_class" "fcvtfx")])
c65ebc55
JW
1106
1107(define_insn "fixuns_truncdfdi2"
0551c32d
RH
1108 [(set (match_operand:DI 0 "fr_register_operand" "=f")
1109 (unsigned_fix:DI (match_operand:DF 1 "fr_register_operand" "f")))]
c65ebc55 1110 ""
aebf2462 1111 "fcvt.fxu.trunc %0 = %1"
52e12ad0 1112 [(set_attr "itanium_class" "fcvtfx")])
c65ebc55 1113
3f622353 1114(define_insn "fixuns_trunctfdi2"
0551c32d
RH
1115 [(set (match_operand:DI 0 "fr_register_operand" "=f")
1116 (unsigned_fix:DI (match_operand:TF 1 "fr_register_operand" "f")))]
23c108af 1117 "INTEL_EXTENDED_IEEE_FORMAT"
aebf2462 1118 "fcvt.fxu.trunc %0 = %1"
52e12ad0 1119 [(set_attr "itanium_class" "fcvtfx")])
655f2eb9
RH
1120
1121(define_insn "fixuns_trunctfdi2_alts"
1122 [(set (match_operand:DI 0 "fr_register_operand" "=f")
1123 (unsigned_fix:DI (match_operand:TF 1 "fr_register_operand" "f")))
1124 (use (match_operand:SI 2 "const_int_operand" ""))]
23c108af 1125 "INTEL_EXTENDED_IEEE_FORMAT"
aebf2462 1126 "fcvt.fxu.trunc.s%2 %0 = %1"
52e12ad0 1127 [(set_attr "itanium_class" "fcvtfx")])
c65ebc55
JW
1128\f
1129;; ::::::::::::::::::::
1130;; ::
1131;; :: Bit field extraction
1132;; ::
1133;; ::::::::::::::::::::
1134
c65ebc55 1135(define_insn "extv"
0551c32d
RH
1136 [(set (match_operand:DI 0 "gr_register_operand" "=r")
1137 (sign_extract:DI (match_operand:DI 1 "gr_register_operand" "r")
c65ebc55
JW
1138 (match_operand:DI 2 "const_int_operand" "n")
1139 (match_operand:DI 3 "const_int_operand" "n")))]
1140 ""
1141 "extr %0 = %1, %3, %2"
52e12ad0 1142 [(set_attr "itanium_class" "ishf")])
c65ebc55
JW
1143
1144(define_insn "extzv"
0551c32d
RH
1145 [(set (match_operand:DI 0 "gr_register_operand" "=r")
1146 (zero_extract:DI (match_operand:DI 1 "gr_register_operand" "r")
c65ebc55
JW
1147 (match_operand:DI 2 "const_int_operand" "n")
1148 (match_operand:DI 3 "const_int_operand" "n")))]
1149 ""
1150 "extr.u %0 = %1, %3, %2"
52e12ad0 1151 [(set_attr "itanium_class" "ishf")])
c65ebc55
JW
1152
1153;; Insert a bit field.
1154;; Can have 3 operands, source1 (inserter), source2 (insertee), dest.
1155;; Source1 can be 0 or -1.
1156;; Source2 can be 0.
1157
1158;; ??? Actual dep instruction is more powerful than what these insv
1159;; patterns support. Unfortunately, combine is unable to create patterns
1160;; where source2 != dest.
1161
1162(define_expand "insv"
0551c32d 1163 [(set (zero_extract:DI (match_operand:DI 0 "gr_register_operand" "")
c65ebc55
JW
1164 (match_operand:DI 1 "const_int_operand" "")
1165 (match_operand:DI 2 "const_int_operand" ""))
1166 (match_operand:DI 3 "nonmemory_operand" ""))]
1167 ""
c65ebc55
JW
1168{
1169 int width = INTVAL (operands[1]);
1170 int shift = INTVAL (operands[2]);
1171
1172 /* If operand[3] is a constant, and isn't 0 or -1, then load it into a
1173 pseudo. */
1174 if (! register_operand (operands[3], DImode)
1175 && operands[3] != const0_rtx && operands[3] != constm1_rtx)
1176 operands[3] = force_reg (DImode, operands[3]);
1177
1178 /* If this is a single dep instruction, we have nothing to do. */
1179 if (! ((register_operand (operands[3], DImode) && width <= 16)
1180 || operands[3] == const0_rtx || operands[3] == constm1_rtx))
1181 {
1182 /* Check for cases that can be implemented with a mix instruction. */
1183 if (width == 32 && shift == 0)
1184 {
1185 /* Directly generating the mix4left instruction confuses
1186 optimize_bit_field in function.c. Since this is performing
1187 a useful optimization, we defer generation of the complicated
1188 mix4left RTL to the first splitting phase. */
1189 rtx tmp = gen_reg_rtx (DImode);
1190 emit_insn (gen_shift_mix4left (operands[0], operands[3], tmp));
1191 DONE;
1192 }
1193 else if (width == 32 && shift == 32)
1194 {
1195 emit_insn (gen_mix4right (operands[0], operands[3]));
1196 DONE;
1197 }
1198
d2ba6dcf
JW
1199 /* We could handle remaining cases by emitting multiple dep
1200 instructions.
1201
1202 If we need more than two dep instructions then we lose. A 6
1203 insn sequence mov mask1,mov mask2,shl;;and,and;;or is better than
1204 mov;;dep,shr;;dep,shr;;dep. The former can be executed in 3 cycles,
1205 the latter is 6 cycles on an Itanium (TM) processor, because there is
1206 only one function unit that can execute dep and shr immed.
1207
1208 If we only need two dep instruction, then we still lose.
1209 mov;;dep,shr;;dep is still 4 cycles. Even if we optimize away
1210 the unnecessary mov, this is still undesirable because it will be
1211 hard to optimize, and it creates unnecessary pressure on the I0
1212 function unit. */
1213
c65ebc55
JW
1214 FAIL;
1215
1216#if 0
1217 /* This code may be useful for other IA-64 processors, so we leave it in
1218 for now. */
1219 while (width > 16)
1220 {
1221 rtx tmp;
1222
1223 emit_insn (gen_insv (operands[0], GEN_INT (16), GEN_INT (shift),
1224 operands[3]));
1225 shift += 16;
1226 width -= 16;
1227 tmp = gen_reg_rtx (DImode);
1228 emit_insn (gen_lshrdi3 (tmp, operands[3], GEN_INT (16)));
1229 operands[3] = tmp;
1230 }
1231 operands[1] = GEN_INT (width);
1232 operands[2] = GEN_INT (shift);
1233#endif
1234 }
1d5d7a21 1235})
c65ebc55
JW
1236
1237(define_insn "*insv_internal"
0551c32d 1238 [(set (zero_extract:DI (match_operand:DI 0 "gr_register_operand" "+r")
c65ebc55
JW
1239 (match_operand:DI 1 "const_int_operand" "n")
1240 (match_operand:DI 2 "const_int_operand" "n"))
1241 (match_operand:DI 3 "nonmemory_operand" "rP"))]
0551c32d 1242 "(gr_register_operand (operands[3], DImode) && INTVAL (operands[1]) <= 16)
c65ebc55
JW
1243 || operands[3] == const0_rtx || operands[3] == constm1_rtx"
1244 "dep %0 = %3, %0, %2, %1"
52e12ad0 1245 [(set_attr "itanium_class" "ishf")])
c65ebc55 1246
041f25e6
RH
1247;; Combine doesn't like to create bitfield insertions into zero.
1248(define_insn "*depz_internal"
0551c32d
RH
1249 [(set (match_operand:DI 0 "gr_register_operand" "=r")
1250 (and:DI (ashift:DI (match_operand:DI 1 "gr_register_operand" "r")
041f25e6
RH
1251 (match_operand:DI 2 "const_int_operand" "n"))
1252 (match_operand:DI 3 "const_int_operand" "n")))]
1253 "CONST_OK_FOR_M (INTVAL (operands[2]))
1254 && ia64_depz_field_mask (operands[3], operands[2]) > 0"
041f25e6
RH
1255{
1256 operands[3] = GEN_INT (ia64_depz_field_mask (operands[3], operands[2]));
1d5d7a21
RH
1257 return "%,dep.z %0 = %1, %2, %3";
1258}
52e12ad0 1259 [(set_attr "itanium_class" "ishf")])
041f25e6 1260
c65ebc55 1261(define_insn "shift_mix4left"
0551c32d 1262 [(set (zero_extract:DI (match_operand:DI 0 "gr_register_operand" "+r")
c65ebc55 1263 (const_int 32) (const_int 0))
0551c32d
RH
1264 (match_operand:DI 1 "gr_register_operand" "r"))
1265 (clobber (match_operand:DI 2 "gr_register_operand" "=r"))]
c65ebc55
JW
1266 ""
1267 "#"
52e12ad0 1268 [(set_attr "itanium_class" "unknown")])
c65ebc55 1269
c65ebc55
JW
1270(define_split
1271 [(set (zero_extract:DI (match_operand:DI 0 "register_operand" "")
1272 (const_int 32) (const_int 0))
1273 (match_operand:DI 1 "register_operand" ""))
1274 (clobber (match_operand:DI 2 "register_operand" ""))]
1275 "reload_completed"
1276 [(set (match_dup 3) (ashift:DI (match_dup 1) (const_int 32)))
c65ebc55
JW
1277 (set (zero_extract:DI (match_dup 0) (const_int 32) (const_int 0))
1278 (lshiftrt:DI (match_dup 3) (const_int 32)))]
1279 "operands[3] = operands[2];")
1280
1281(define_split
1282 [(set (zero_extract:DI (match_operand:DI 0 "register_operand" "")
1283 (const_int 32) (const_int 0))
1284 (match_operand:DI 1 "register_operand" ""))
1285 (clobber (match_operand:DI 2 "register_operand" ""))]
1286 "! reload_completed"
1287 [(set (match_dup 3) (ashift:DI (match_dup 1) (const_int 32)))
1288 (set (zero_extract:DI (match_dup 0) (const_int 32) (const_int 0))
1289 (lshiftrt:DI (match_dup 3) (const_int 32)))]
1290 "operands[3] = operands[2];")
1291
1292(define_insn "*mix4left"
0551c32d 1293 [(set (zero_extract:DI (match_operand:DI 0 "gr_register_operand" "+r")
c65ebc55 1294 (const_int 32) (const_int 0))
0551c32d 1295 (lshiftrt:DI (match_operand:DI 1 "gr_register_operand" "r")
c65ebc55
JW
1296 (const_int 32)))]
1297 ""
1298 "mix4.l %0 = %0, %r1"
52e12ad0 1299 [(set_attr "itanium_class" "mmshf")])
c65ebc55
JW
1300
1301(define_insn "mix4right"
0551c32d 1302 [(set (zero_extract:DI (match_operand:DI 0 "gr_register_operand" "+r")
c65ebc55 1303 (const_int 32) (const_int 32))
0551c32d 1304 (match_operand:DI 1 "gr_reg_or_0_operand" "rO"))]
c65ebc55
JW
1305 ""
1306 "mix4.r %0 = %r1, %0"
52e12ad0 1307 [(set_attr "itanium_class" "mmshf")])
c65ebc55
JW
1308
1309;; This is used by the rotrsi3 pattern.
1310
1311(define_insn "*mix4right_3op"
0551c32d
RH
1312 [(set (match_operand:DI 0 "gr_register_operand" "=r")
1313 (ior:DI (zero_extend:DI (match_operand:SI 1 "gr_register_operand" "r"))
1314 (ashift:DI (zero_extend:DI
1315 (match_operand:SI 2 "gr_register_operand" "r"))
c65ebc55
JW
1316 (const_int 32))))]
1317 ""
fa9a44e8 1318 "mix4.r %0 = %2, %1"
52e12ad0 1319 [(set_attr "itanium_class" "mmshf")])
c65ebc55
JW
1320
1321\f
1322;; ::::::::::::::::::::
cf1f6ae3 1323;; ::
f2f90c63
RH
1324;; :: 1 bit Integer arithmetic
1325;; ::
1326;; ::::::::::::::::::::
1327
1328(define_insn_and_split "andbi3"
1329 [(set (match_operand:BI 0 "register_operand" "=c,c,r")
1330 (and:BI (match_operand:BI 1 "register_operand" "%0,0,r")
1331 (match_operand:BI 2 "register_operand" "c,r,r")))]
1332 ""
1333 "@
1334 #
1335 tbit.nz.and.orcm %0, %I0 = %2, 0
1336 and %0 = %2, %1"
1337 "reload_completed
1338 && GET_CODE (operands[0]) == REG && PR_REGNO_P (REGNO (operands[0]))
1339 && GET_CODE (operands[2]) == REG && PR_REGNO_P (REGNO (operands[2]))"
1340 [(cond_exec (eq (match_dup 2) (const_int 0))
1341 (set (match_dup 0) (and:BI (ne:BI (const_int 0) (const_int 0))
1342 (match_dup 0))))]
1343 ""
52e12ad0 1344 [(set_attr "itanium_class" "unknown,tbit,ilog")])
f2f90c63
RH
1345
1346(define_insn_and_split "*andcmbi3"
1347 [(set (match_operand:BI 0 "register_operand" "=c,c,r")
1348 (and:BI (not:BI (match_operand:BI 1 "register_operand" "c,r,r"))
1349 (match_operand:BI 2 "register_operand" "0,0,r")))]
1350 ""
1351 "@
1352 #
967603ef 1353 tbit.z.and.orcm %0, %I0 = %1, 0
f2f90c63
RH
1354 andcm %0 = %2, %1"
1355 "reload_completed
1356 && GET_CODE (operands[0]) == REG && PR_REGNO_P (REGNO (operands[0]))
967603ef 1357 && GET_CODE (operands[1]) == REG && PR_REGNO_P (REGNO (operands[1]))"
f2f90c63
RH
1358 [(cond_exec (ne (match_dup 1) (const_int 0))
1359 (set (match_dup 0) (and:BI (ne:BI (const_int 0) (const_int 0))
1360 (match_dup 0))))]
1361 ""
52e12ad0 1362 [(set_attr "itanium_class" "unknown,tbit,ilog")])
f2f90c63
RH
1363
1364(define_insn_and_split "iorbi3"
1365 [(set (match_operand:BI 0 "register_operand" "=c,c,r")
1366 (ior:BI (match_operand:BI 1 "register_operand" "%0,0,r")
1367 (match_operand:BI 2 "register_operand" "c,r,r")))]
1368 ""
1369 "@
1370 #
1371 tbit.nz.or.andcm %0, %I0 = %2, 0
1372 or %0 = %2, %1"
1373 "reload_completed
1374 && GET_CODE (operands[0]) == REG && PR_REGNO_P (REGNO (operands[0]))
1375 && GET_CODE (operands[2]) == REG && PR_REGNO_P (REGNO (operands[2]))"
1376 [(cond_exec (ne (match_dup 2) (const_int 0))
1377 (set (match_dup 0) (ior:BI (eq:BI (const_int 0) (const_int 0))
1378 (match_dup 0))))]
1379 ""
52e12ad0 1380 [(set_attr "itanium_class" "unknown,tbit,ilog")])
f2f90c63
RH
1381
1382(define_insn_and_split "*iorcmbi3"
1383 [(set (match_operand:BI 0 "register_operand" "=c,c")
1384 (ior:BI (not:BI (match_operand:BI 1 "register_operand" "c,r"))
1385 (match_operand:BI 2 "register_operand" "0,0")))]
1386 ""
1387 "@
1388 #
967603ef 1389 tbit.z.or.andcm %0, %I0 = %1, 0"
f2f90c63
RH
1390 "reload_completed
1391 && GET_CODE (operands[0]) == REG && PR_REGNO_P (REGNO (operands[0]))
967603ef 1392 && GET_CODE (operands[1]) == REG && PR_REGNO_P (REGNO (operands[1]))"
f2f90c63
RH
1393 [(cond_exec (eq (match_dup 1) (const_int 0))
1394 (set (match_dup 0) (ior:BI (eq:BI (const_int 0) (const_int 0))
1395 (match_dup 0))))]
1396 ""
52e12ad0 1397 [(set_attr "itanium_class" "unknown,tbit")])
f2f90c63
RH
1398
1399(define_insn "one_cmplbi2"
1400 [(set (match_operand:BI 0 "register_operand" "=c,r,c,&c")
1401 (not:BI (match_operand:BI 1 "register_operand" "r,r,0,c")))
1402 (clobber (match_scratch:BI 2 "=X,X,c,X"))]
1403 ""
1404 "@
1405 tbit.z %0, %I0 = %1, 0
1406 xor %0 = 1, %1
1407 #
1408 #"
52e12ad0 1409 [(set_attr "itanium_class" "tbit,ilog,unknown,unknown")])
f2f90c63
RH
1410
1411(define_split
1412 [(set (match_operand:BI 0 "register_operand" "")
1413 (not:BI (match_operand:BI 1 "register_operand" "")))
1414 (clobber (match_scratch:BI 2 ""))]
1415 "reload_completed
1416 && GET_CODE (operands[0]) == REG && PR_REGNO_P (REGNO (operands[0]))
f2f90c63
RH
1417 && rtx_equal_p (operands[0], operands[1])"
1418 [(set (match_dup 4) (match_dup 3))
1419 (set (match_dup 0) (const_int 1))
1420 (cond_exec (ne (match_dup 2) (const_int 0))
1421 (set (match_dup 0) (const_int 0)))
086c0f96 1422 (set (match_dup 0) (unspec:BI [(match_dup 0)] UNSPEC_PRED_REL_MUTEX))]
f2f90c63
RH
1423 "operands[3] = gen_rtx_REG (CCImode, REGNO (operands[1]));
1424 operands[4] = gen_rtx_REG (CCImode, REGNO (operands[2]));")
1425
1426(define_split
1427 [(set (match_operand:BI 0 "register_operand" "")
1428 (not:BI (match_operand:BI 1 "register_operand" "")))
1429 (clobber (match_scratch:BI 2 ""))]
1430 "reload_completed
1431 && GET_CODE (operands[0]) == REG && PR_REGNO_P (REGNO (operands[0]))
1432 && GET_CODE (operands[1]) == REG && PR_REGNO_P (REGNO (operands[1]))
1433 && ! rtx_equal_p (operands[0], operands[1])"
1434 [(cond_exec (ne (match_dup 1) (const_int 0))
1435 (set (match_dup 0) (const_int 0)))
1436 (cond_exec (eq (match_dup 1) (const_int 0))
1437 (set (match_dup 0) (const_int 1)))
086c0f96 1438 (set (match_dup 0) (unspec:BI [(match_dup 0)] UNSPEC_PRED_REL_MUTEX))]
f2f90c63
RH
1439 "")
1440
1441(define_insn "*cmpsi_and_0"
1442 [(set (match_operand:BI 0 "register_operand" "=c")
1443 (and:BI (match_operator:BI 4 "predicate_operator"
1444 [(match_operand:SI 2 "gr_reg_or_0_operand" "rO")
1445 (match_operand:SI 3 "gr_reg_or_8bit_operand" "rK")])
1446 (match_operand:BI 1 "register_operand" "0")))]
1447 ""
1448 "cmp4.%C4.and.orcm %0, %I0 = %3, %r2"
52e12ad0 1449 [(set_attr "itanium_class" "icmp")])
f2f90c63
RH
1450
1451(define_insn "*cmpsi_and_1"
1452 [(set (match_operand:BI 0 "register_operand" "=c")
1453 (and:BI (match_operator:BI 3 "signed_inequality_operator"
1454 [(match_operand:SI 2 "gr_register_operand" "r")
1455 (const_int 0)])
1456 (match_operand:BI 1 "register_operand" "0")))]
1457 ""
1458 "cmp4.%C3.and.orcm %0, %I0 = r0, %2"
52e12ad0 1459 [(set_attr "itanium_class" "icmp")])
f2f90c63
RH
1460
1461(define_insn "*cmpsi_andnot_0"
1462 [(set (match_operand:BI 0 "register_operand" "=c")
1463 (and:BI (not:BI (match_operator:BI 4 "predicate_operator"
1464 [(match_operand:SI 2 "gr_reg_or_0_operand" "rO")
1465 (match_operand:SI 3 "gr_reg_or_8bit_operand" "rK")]))
1466 (match_operand:BI 1 "register_operand" "0")))]
1467 ""
1468 "cmp4.%C4.or.andcm %I0, %0 = %3, %r2"
52e12ad0 1469 [(set_attr "itanium_class" "icmp")])
f2f90c63
RH
1470
1471(define_insn "*cmpsi_andnot_1"
1472 [(set (match_operand:BI 0 "register_operand" "=c")
1473 (and:BI (not:BI (match_operator:BI 3 "signed_inequality_operator"
1474 [(match_operand:SI 2 "gr_register_operand" "r")
1475 (const_int 0)]))
1476 (match_operand:BI 1 "register_operand" "0")))]
1477 ""
1478 "cmp4.%C3.or.andcm %I0, %0 = r0, %2"
52e12ad0 1479 [(set_attr "itanium_class" "icmp")])
f2f90c63
RH
1480
1481(define_insn "*cmpdi_and_0"
1482 [(set (match_operand:BI 0 "register_operand" "=c")
1483 (and:BI (match_operator:BI 4 "predicate_operator"
1484 [(match_operand:DI 2 "gr_register_operand" "r")
1485 (match_operand:DI 3 "gr_reg_or_8bit_operand" "rK")])
1486 (match_operand:BI 1 "register_operand" "0")))]
1487 ""
1488 "cmp.%C4.and.orcm %0, %I0 = %3, %2"
52e12ad0 1489 [(set_attr "itanium_class" "icmp")])
f2f90c63
RH
1490
1491(define_insn "*cmpdi_and_1"
1492 [(set (match_operand:BI 0 "register_operand" "=c")
1493 (and:BI (match_operator:BI 3 "signed_inequality_operator"
1494 [(match_operand:DI 2 "gr_register_operand" "r")
1495 (const_int 0)])
1496 (match_operand:BI 1 "register_operand" "0")))]
1497 ""
1498 "cmp.%C3.and.orcm %0, %I0 = r0, %2"
52e12ad0 1499 [(set_attr "itanium_class" "icmp")])
f2f90c63
RH
1500
1501(define_insn "*cmpdi_andnot_0"
1502 [(set (match_operand:BI 0 "register_operand" "=c")
1503 (and:BI (not:BI (match_operator:BI 4 "predicate_operator"
1504 [(match_operand:DI 2 "gr_register_operand" "r")
1505 (match_operand:DI 3 "gr_reg_or_8bit_operand" "rK")]))
1506 (match_operand:BI 1 "register_operand" "0")))]
1507 ""
1508 "cmp.%C4.or.andcm %I0, %0 = %3, %2"
52e12ad0 1509 [(set_attr "itanium_class" "icmp")])
f2f90c63
RH
1510
1511(define_insn "*cmpdi_andnot_1"
1512 [(set (match_operand:BI 0 "register_operand" "=c")
1513 (and:BI (not:BI (match_operator:BI 3 "signed_inequality_operator"
1514 [(match_operand:DI 2 "gr_register_operand" "r")
1515 (const_int 0)]))
1516 (match_operand:BI 1 "register_operand" "0")))]
1517 ""
1518 "cmp.%C3.or.andcm %I0, %0 = r0, %2"
52e12ad0 1519 [(set_attr "itanium_class" "icmp")])
f2f90c63
RH
1520
1521(define_insn "*tbit_and_0"
1522 [(set (match_operand:BI 0 "register_operand" "=c")
1523 (and:BI (ne:BI (and:DI (match_operand:DI 1 "gr_register_operand" "r")
1524 (const_int 1))
1525 (const_int 0))
c77e04ae 1526 (match_operand:BI 2 "register_operand" "0")))]
f2f90c63
RH
1527 ""
1528 "tbit.nz.and.orcm %0, %I0 = %1, 0"
52e12ad0 1529 [(set_attr "itanium_class" "tbit")])
f2f90c63
RH
1530
1531(define_insn "*tbit_and_1"
1532 [(set (match_operand:BI 0 "register_operand" "=c")
1533 (and:BI (eq:BI (and:DI (match_operand:DI 1 "gr_register_operand" "r")
1534 (const_int 1))
1535 (const_int 0))
c77e04ae 1536 (match_operand:BI 2 "register_operand" "0")))]
f2f90c63
RH
1537 ""
1538 "tbit.z.and.orcm %0, %I0 = %1, 0"
52e12ad0 1539 [(set_attr "itanium_class" "tbit")])
f2f90c63
RH
1540
1541(define_insn "*tbit_and_2"
1542 [(set (match_operand:BI 0 "register_operand" "=c")
1543 (and:BI (ne:BI (zero_extract:DI
1544 (match_operand:DI 1 "gr_register_operand" "r")
1545 (const_int 1)
1546 (match_operand:DI 2 "const_int_operand" "n"))
1547 (const_int 0))
1548 (match_operand:BI 3 "register_operand" "0")))]
1549 ""
1550 "tbit.nz.and.orcm %0, %I0 = %1, %2"
52e12ad0 1551 [(set_attr "itanium_class" "tbit")])
f2f90c63
RH
1552
1553(define_insn "*tbit_and_3"
1554 [(set (match_operand:BI 0 "register_operand" "=c")
1555 (and:BI (eq:BI (zero_extract:DI
1556 (match_operand:DI 1 "gr_register_operand" "r")
1557 (const_int 1)
1558 (match_operand:DI 2 "const_int_operand" "n"))
1559 (const_int 0))
1560 (match_operand:BI 3 "register_operand" "0")))]
1561 ""
1562 "tbit.z.and.orcm %0, %I0 = %1, %2"
52e12ad0 1563 [(set_attr "itanium_class" "tbit")])
f2f90c63
RH
1564
1565(define_insn "*cmpsi_or_0"
1566 [(set (match_operand:BI 0 "register_operand" "=c")
1567 (ior:BI (match_operator:BI 4 "predicate_operator"
1568 [(match_operand:SI 2 "gr_reg_or_0_operand" "rO")
1569 (match_operand:SI 3 "gr_reg_or_8bit_operand" "rK")])
1570 (match_operand:BI 1 "register_operand" "0")))]
1571 ""
1572 "cmp4.%C4.or.andcm %0, %I0 = %3, %r2"
52e12ad0 1573 [(set_attr "itanium_class" "icmp")])
f2f90c63
RH
1574
1575(define_insn "*cmpsi_or_1"
1576 [(set (match_operand:BI 0 "register_operand" "=c")
1577 (ior:BI (match_operator:BI 3 "signed_inequality_operator"
1578 [(match_operand:SI 2 "gr_register_operand" "r")
1579 (const_int 0)])
1580 (match_operand:BI 1 "register_operand" "0")))]
1581 ""
1582 "cmp4.%C3.or.andcm %0, %I0 = r0, %2"
52e12ad0 1583 [(set_attr "itanium_class" "icmp")])
f2f90c63
RH
1584
1585(define_insn "*cmpsi_orcm_0"
1586 [(set (match_operand:BI 0 "register_operand" "=c")
1587 (ior:BI (not:BI (match_operator:BI 4 "predicate_operator"
1588 [(match_operand:SI 2 "gr_reg_or_0_operand" "rO")
1589 (match_operand:SI 3 "gr_reg_or_8bit_operand" "rK")]))
1590 (match_operand:BI 1 "register_operand" "0")))]
1591 ""
1592 "cmp4.%C4.and.orcm %I0, %0 = %3, %r2"
52e12ad0 1593 [(set_attr "itanium_class" "icmp")])
f2f90c63
RH
1594
1595(define_insn "*cmpsi_orcm_1"
1596 [(set (match_operand:BI 0 "register_operand" "=c")
1597 (ior:BI (not:BI (match_operator:BI 3 "signed_inequality_operator"
1598 [(match_operand:SI 2 "gr_register_operand" "r")
1599 (const_int 0)]))
1600 (match_operand:BI 1 "register_operand" "0")))]
1601 ""
1602 "cmp4.%C3.and.orcm %I0, %0 = r0, %2"
52e12ad0 1603 [(set_attr "itanium_class" "icmp")])
f2f90c63
RH
1604
1605(define_insn "*cmpdi_or_0"
1606 [(set (match_operand:BI 0 "register_operand" "=c")
1607 (ior:BI (match_operator:BI 4 "predicate_operator"
1608 [(match_operand:DI 2 "gr_register_operand" "r")
1609 (match_operand:DI 3 "gr_reg_or_8bit_operand" "rK")])
1610 (match_operand:BI 1 "register_operand" "0")))]
1611 ""
1612 "cmp.%C4.or.andcm %0, %I0 = %3, %2"
52e12ad0 1613 [(set_attr "itanium_class" "icmp")])
f2f90c63
RH
1614
1615(define_insn "*cmpdi_or_1"
1616 [(set (match_operand:BI 0 "register_operand" "=c")
1617 (ior:BI (match_operator:BI 3 "signed_inequality_operator"
1618 [(match_operand:DI 2 "gr_register_operand" "r")
1619 (const_int 0)])
1620 (match_operand:BI 1 "register_operand" "0")))]
1621 ""
1622 "cmp.%C3.or.andcm %0, %I0 = r0, %2"
52e12ad0 1623 [(set_attr "itanium_class" "icmp")])
f2f90c63
RH
1624
1625(define_insn "*cmpdi_orcm_0"
1626 [(set (match_operand:BI 0 "register_operand" "=c")
1627 (ior:BI (not:BI (match_operator:BI 4 "predicate_operator"
1628 [(match_operand:DI 2 "gr_register_operand" "r")
1629 (match_operand:DI 3 "gr_reg_or_8bit_operand" "rK")]))
1630 (match_operand:BI 1 "register_operand" "0")))]
1631 ""
1632 "cmp.%C4.and.orcm %I0, %0 = %3, %2"
52e12ad0 1633 [(set_attr "itanium_class" "icmp")])
f2f90c63
RH
1634
1635(define_insn "*cmpdi_orcm_1"
1636 [(set (match_operand:BI 0 "register_operand" "=c")
1637 (ior:BI (not:BI (match_operator:BI 3 "signed_inequality_operator"
1638 [(match_operand:DI 2 "gr_register_operand" "r")
1639 (const_int 0)]))
1640 (match_operand:BI 1 "register_operand" "0")))]
1641 ""
1642 "cmp.%C3.and.orcm %I0, %0 = r0, %2"
52e12ad0 1643 [(set_attr "itanium_class" "icmp")])
f2f90c63
RH
1644
1645(define_insn "*tbit_or_0"
1646 [(set (match_operand:BI 0 "register_operand" "=c")
1647 (ior:BI (ne:BI (and:DI (match_operand:DI 1 "gr_register_operand" "r")
1648 (const_int 1))
1649 (const_int 0))
c77e04ae 1650 (match_operand:BI 2 "register_operand" "0")))]
f2f90c63
RH
1651 ""
1652 "tbit.nz.or.andcm %0, %I0 = %1, 0"
52e12ad0 1653 [(set_attr "itanium_class" "tbit")])
f2f90c63
RH
1654
1655(define_insn "*tbit_or_1"
1656 [(set (match_operand:BI 0 "register_operand" "=c")
1657 (ior:BI (eq:BI (and:DI (match_operand:DI 1 "gr_register_operand" "r")
1658 (const_int 1))
1659 (const_int 0))
c77e04ae 1660 (match_operand:BI 2 "register_operand" "0")))]
f2f90c63
RH
1661 ""
1662 "tbit.z.or.andcm %0, %I0 = %1, 0"
52e12ad0 1663 [(set_attr "itanium_class" "tbit")])
f2f90c63
RH
1664
1665(define_insn "*tbit_or_2"
1666 [(set (match_operand:BI 0 "register_operand" "=c")
1667 (ior:BI (ne:BI (zero_extract:DI
1668 (match_operand:DI 1 "gr_register_operand" "r")
1669 (const_int 1)
1670 (match_operand:DI 2 "const_int_operand" "n"))
1671 (const_int 0))
1672 (match_operand:BI 3 "register_operand" "0")))]
1673 ""
1674 "tbit.nz.or.andcm %0, %I0 = %1, %2"
52e12ad0 1675 [(set_attr "itanium_class" "tbit")])
f2f90c63
RH
1676
1677(define_insn "*tbit_or_3"
1678 [(set (match_operand:BI 0 "register_operand" "=c")
1679 (ior:BI (eq:BI (zero_extract:DI
1680 (match_operand:DI 1 "gr_register_operand" "r")
1681 (const_int 1)
1682 (match_operand:DI 2 "const_int_operand" "n"))
1683 (const_int 0))
1684 (match_operand:BI 3 "register_operand" "0")))]
1685 ""
1686 "tbit.z.or.andcm %0, %I0 = %1, %2"
52e12ad0 1687 [(set_attr "itanium_class" "tbit")])
f2f90c63
RH
1688
1689;; Transform test of and/or of setcc into parallel comparisons.
1690
1691(define_split
1692 [(set (match_operand:BI 0 "register_operand" "")
1693 (ne:BI (and:DI (ne:DI (match_operand:BI 2 "register_operand" "")
1694 (const_int 0))
1695 (match_operand:DI 3 "register_operand" ""))
1696 (const_int 0)))]
1697 ""
1698 [(set (match_dup 0)
1699 (and:BI (ne:BI (and:DI (match_dup 3) (const_int 1)) (const_int 0))
1700 (match_dup 2)))]
1701 "")
1702
1703(define_split
1704 [(set (match_operand:BI 0 "register_operand" "")
1705 (eq:BI (and:DI (ne:DI (match_operand:BI 2 "register_operand" "")
1706 (const_int 0))
1707 (match_operand:DI 3 "register_operand" ""))
1708 (const_int 0)))]
1709 ""
1710 [(set (match_dup 0)
1711 (and:BI (ne:BI (and:DI (match_dup 3) (const_int 1)) (const_int 0))
1712 (match_dup 2)))
1713 (parallel [(set (match_dup 0) (not:BI (match_dup 0)))
1714 (clobber (scratch))])]
1715 "")
1716
1717(define_split
1718 [(set (match_operand:BI 0 "register_operand" "")
1719 (ne:BI (ior:DI (ne:DI (match_operand:BI 2 "register_operand" "")
1720 (const_int 0))
1721 (match_operand:DI 3 "register_operand" ""))
1722 (const_int 0)))]
1723 ""
1724 [(set (match_dup 0)
1725 (ior:BI (ne:BI (match_dup 3) (const_int 0))
1726 (match_dup 2)))]
1727 "")
1728
1729(define_split
1730 [(set (match_operand:BI 0 "register_operand" "")
1731 (eq:BI (ior:DI (ne:DI (match_operand:BI 2 "register_operand" "")
1732 (const_int 0))
1733 (match_operand:DI 3 "register_operand" ""))
1734 (const_int 0)))]
1735 ""
1736 [(set (match_dup 0)
1737 (ior:BI (ne:BI (match_dup 3) (const_int 0))
1738 (match_dup 2)))
1739 (parallel [(set (match_dup 0) (not:BI (match_dup 0)))
1740 (clobber (scratch))])]
1741 "")
1742
1743;; ??? Incredibly hackish. Either need four proper patterns with all
1744;; the alternatives, or rely on sched1 to split the insn and hope that
1745;; nothing bad happens to the comparisons in the meantime.
1746;;
1747;; Alternately, adjust combine to allow 2->2 and 3->3 splits, assuming
1748;; that we're doing height reduction.
1749;
1750;(define_insn_and_split ""
1751; [(set (match_operand:BI 0 "register_operand" "=c")
1752; (and:BI (and:BI (match_operator:BI 1 "comparison_operator"
1753; [(match_operand 2 "" "")
1754; (match_operand 3 "" "")])
1755; (match_operator:BI 4 "comparison_operator"
1756; [(match_operand 5 "" "")
1757; (match_operand 6 "" "")]))
1758; (match_dup 0)))]
1759; "flag_schedule_insns"
1760; "#"
1761; ""
1762; [(set (match_dup 0) (and:BI (match_dup 1) (match_dup 0)))
1763; (set (match_dup 0) (and:BI (match_dup 4) (match_dup 0)))]
1764; "")
1765;
1766;(define_insn_and_split ""
1767; [(set (match_operand:BI 0 "register_operand" "=c")
1768; (ior:BI (ior:BI (match_operator:BI 1 "comparison_operator"
1769; [(match_operand 2 "" "")
1770; (match_operand 3 "" "")])
1771; (match_operator:BI 4 "comparison_operator"
1772; [(match_operand 5 "" "")
1773; (match_operand 6 "" "")]))
1774; (match_dup 0)))]
1775; "flag_schedule_insns"
1776; "#"
1777; ""
1778; [(set (match_dup 0) (ior:BI (match_dup 1) (match_dup 0)))
1779; (set (match_dup 0) (ior:BI (match_dup 4) (match_dup 0)))]
1780; "")
1781;
1782;(define_split
1783; [(set (match_operand:BI 0 "register_operand" "")
1784; (and:BI (and:BI (match_operator:BI 1 "comparison_operator"
1785; [(match_operand 2 "" "")
1786; (match_operand 3 "" "")])
1787; (match_operand:BI 7 "register_operand" ""))
1788; (and:BI (match_operator:BI 4 "comparison_operator"
1789; [(match_operand 5 "" "")
1790; (match_operand 6 "" "")])
1791; (match_operand:BI 8 "register_operand" ""))))]
1792; ""
1793; [(set (match_dup 0) (and:BI (match_dup 7) (match_dup 8)))
1794; (set (match_dup 0) (and:BI (and:BI (match_dup 1) (match_dup 4))
1795; (match_dup 0)))]
1796; "")
1797;
1798;(define_split
1799; [(set (match_operand:BI 0 "register_operand" "")
1800; (ior:BI (ior:BI (match_operator:BI 1 "comparison_operator"
1801; [(match_operand 2 "" "")
1802; (match_operand 3 "" "")])
1803; (match_operand:BI 7 "register_operand" ""))
1804; (ior:BI (match_operator:BI 4 "comparison_operator"
1805; [(match_operand 5 "" "")
1806; (match_operand 6 "" "")])
1807; (match_operand:BI 8 "register_operand" ""))))]
1808; ""
1809; [(set (match_dup 0) (ior:BI (match_dup 7) (match_dup 8)))
1810; (set (match_dup 0) (ior:BI (ior:BI (match_dup 1) (match_dup 4))
1811; (match_dup 0)))]
1812; "")
1813
1814;; Try harder to avoid predicate copies by duplicating compares.
1815;; Note that we'll have already split the predicate copy, which
1816;; is kind of a pain, but oh well.
1817
1818(define_peephole2
1819 [(set (match_operand:BI 0 "register_operand" "")
1820 (match_operand:BI 1 "comparison_operator" ""))
1821 (set (match_operand:CCI 2 "register_operand" "")
1822 (match_operand:CCI 3 "register_operand" ""))
1823 (set (match_operand:CCI 4 "register_operand" "")
1824 (match_operand:CCI 5 "register_operand" ""))
1825 (set (match_operand:BI 6 "register_operand" "")
086c0f96 1826 (unspec:BI [(match_dup 6)] UNSPEC_PRED_REL_MUTEX))]
f2f90c63
RH
1827 "REGNO (operands[3]) == REGNO (operands[0])
1828 && REGNO (operands[4]) == REGNO (operands[0]) + 1
1829 && REGNO (operands[4]) == REGNO (operands[2]) + 1
1830 && REGNO (operands[6]) == REGNO (operands[2])"
1831 [(set (match_dup 0) (match_dup 1))
1832 (set (match_dup 6) (match_dup 7))]
1833 "operands[7] = copy_rtx (operands[1]);")
1834\f
1835;; ::::::::::::::::::::
1836;; ::
cf1f6ae3
RH
1837;; :: 16 bit Integer arithmetic
1838;; ::
1839;; ::::::::::::::::::::
1840
1841(define_insn "mulhi3"
1842 [(set (match_operand:HI 0 "gr_register_operand" "=r")
1843 (mult:HI (match_operand:HI 1 "gr_register_operand" "r")
1844 (match_operand:HI 2 "gr_register_operand" "r")))]
1845 ""
2a7ffc85 1846 "pmpy2.r %0 = %1, %2"
52e12ad0 1847 [(set_attr "itanium_class" "mmmul")])
cf1f6ae3
RH
1848
1849\f
1850;; ::::::::::::::::::::
c65ebc55
JW
1851;; ::
1852;; :: 32 bit Integer arithmetic
1853;; ::
1854;; ::::::::::::::::::::
1855
058557c4 1856(define_insn "addsi3"
0551c32d
RH
1857 [(set (match_operand:SI 0 "gr_register_operand" "=r,r,r")
1858 (plus:SI (match_operand:SI 1 "gr_register_operand" "%r,r,a")
1859 (match_operand:SI 2 "gr_reg_or_22bit_operand" "r,I,J")))]
c65ebc55
JW
1860 ""
1861 "@
1d5d7a21
RH
1862 add %0 = %1, %2
1863 adds %0 = %2, %1
1864 addl %0 = %2, %1"
52e12ad0 1865 [(set_attr "itanium_class" "ialu")])
c65ebc55
JW
1866
1867(define_insn "*addsi3_plus1"
0551c32d
RH
1868 [(set (match_operand:SI 0 "gr_register_operand" "=r")
1869 (plus:SI (plus:SI (match_operand:SI 1 "gr_register_operand" "r")
1870 (match_operand:SI 2 "gr_register_operand" "r"))
c65ebc55
JW
1871 (const_int 1)))]
1872 ""
1873 "add %0 = %1, %2, 1"
52e12ad0 1874 [(set_attr "itanium_class" "ialu")])
c65ebc55 1875
5527bf14 1876(define_insn "*addsi3_plus1_alt"
0551c32d
RH
1877 [(set (match_operand:SI 0 "gr_register_operand" "=r")
1878 (plus:SI (mult:SI (match_operand:SI 1 "gr_register_operand" "r")
5527bf14
RH
1879 (const_int 2))
1880 (const_int 1)))]
1881 ""
1882 "add %0 = %1, %1, 1"
52e12ad0 1883 [(set_attr "itanium_class" "ialu")])
5527bf14 1884
058557c4 1885(define_insn "*addsi3_shladd"
0551c32d
RH
1886 [(set (match_operand:SI 0 "gr_register_operand" "=r")
1887 (plus:SI (mult:SI (match_operand:SI 1 "gr_register_operand" "r")
058557c4 1888 (match_operand:SI 2 "shladd_operand" "n"))
0551c32d 1889 (match_operand:SI 3 "gr_register_operand" "r")))]
c65ebc55 1890 ""
058557c4 1891 "shladd %0 = %1, %S2, %3"
52e12ad0 1892 [(set_attr "itanium_class" "ialu")])
c65ebc55 1893
058557c4 1894(define_insn "subsi3"
0551c32d
RH
1895 [(set (match_operand:SI 0 "gr_register_operand" "=r")
1896 (minus:SI (match_operand:SI 1 "gr_reg_or_8bit_operand" "rK")
1897 (match_operand:SI 2 "gr_register_operand" "r")))]
c65ebc55
JW
1898 ""
1899 "sub %0 = %1, %2"
52e12ad0 1900 [(set_attr "itanium_class" "ialu")])
c65ebc55
JW
1901
1902(define_insn "*subsi3_minus1"
0551c32d
RH
1903 [(set (match_operand:SI 0 "gr_register_operand" "=r")
1904 (plus:SI (not:SI (match_operand:SI 1 "gr_register_operand" "r"))
1905 (match_operand:SI 2 "gr_register_operand" "r")))]
c65ebc55
JW
1906 ""
1907 "sub %0 = %2, %1, 1"
52e12ad0
BS
1908 [(set_attr "itanium_class" "ialu")])
1909
1910;; ??? Could add maddsi3 patterns patterned after the madddi3 patterns.
c65ebc55 1911
058557c4 1912(define_insn "mulsi3"
0551c32d 1913 [(set (match_operand:SI 0 "fr_register_operand" "=f")
11a13704
RH
1914 (mult:SI (match_operand:SI 1 "grfr_register_operand" "f")
1915 (match_operand:SI 2 "grfr_register_operand" "f")))]
c65ebc55 1916 ""
aebf2462 1917 "xmpy.l %0 = %1, %2"
52e12ad0 1918 [(set_attr "itanium_class" "xmpy")])
c65ebc55 1919
655f2eb9 1920(define_insn "maddsi4"
11a13704
RH
1921 [(set (match_operand:SI 0 "fr_register_operand" "=f")
1922 (plus:SI (mult:SI (match_operand:SI 1 "grfr_register_operand" "f")
1923 (match_operand:SI 2 "grfr_register_operand" "f"))
1924 (match_operand:SI 3 "grfr_register_operand" "f")))]
1925 ""
aebf2462 1926 "xma.l %0 = %1, %2, %3"
52e12ad0 1927 [(set_attr "itanium_class" "xmpy")])
11a13704 1928
058557c4 1929(define_insn "negsi2"
0551c32d
RH
1930 [(set (match_operand:SI 0 "gr_register_operand" "=r")
1931 (neg:SI (match_operand:SI 1 "gr_register_operand" "r")))]
c65ebc55
JW
1932 ""
1933 "sub %0 = r0, %1"
52e12ad0 1934 [(set_attr "itanium_class" "ialu")])
c65ebc55
JW
1935
1936(define_expand "abssi2"
1937 [(set (match_dup 2)
f2f90c63 1938 (ge:BI (match_operand:SI 1 "gr_register_operand" "") (const_int 0)))
0551c32d 1939 (set (match_operand:SI 0 "gr_register_operand" "")
f2f90c63 1940 (if_then_else:SI (eq (match_dup 2) (const_int 0))
e5bde68a
RH
1941 (neg:SI (match_dup 1))
1942 (match_dup 1)))]
c65ebc55 1943 ""
1d5d7a21 1944 { operands[2] = gen_reg_rtx (BImode); })
c65ebc55
JW
1945
1946(define_expand "sminsi3"
1947 [(set (match_dup 3)
f2f90c63 1948 (ge:BI (match_operand:SI 1 "gr_register_operand" "")
0551c32d
RH
1949 (match_operand:SI 2 "gr_register_operand" "")))
1950 (set (match_operand:SI 0 "gr_register_operand" "")
f2f90c63 1951 (if_then_else:SI (ne (match_dup 3) (const_int 0))
c65ebc55
JW
1952 (match_dup 2) (match_dup 1)))]
1953 ""
1d5d7a21 1954 { operands[3] = gen_reg_rtx (BImode); })
c65ebc55
JW
1955
1956(define_expand "smaxsi3"
1957 [(set (match_dup 3)
f2f90c63 1958 (ge:BI (match_operand:SI 1 "gr_register_operand" "")
0551c32d
RH
1959 (match_operand:SI 2 "gr_register_operand" "")))
1960 (set (match_operand:SI 0 "gr_register_operand" "")
f2f90c63 1961 (if_then_else:SI (ne (match_dup 3) (const_int 0))
c65ebc55
JW
1962 (match_dup 1) (match_dup 2)))]
1963 ""
1d5d7a21 1964 { operands[3] = gen_reg_rtx (BImode); })
c65ebc55
JW
1965
1966(define_expand "uminsi3"
1967 [(set (match_dup 3)
f2f90c63 1968 (geu:BI (match_operand:SI 1 "gr_register_operand" "")
0551c32d
RH
1969 (match_operand:SI 2 "gr_register_operand" "")))
1970 (set (match_operand:SI 0 "gr_register_operand" "")
f2f90c63 1971 (if_then_else:SI (ne (match_dup 3) (const_int 0))
c65ebc55
JW
1972 (match_dup 2) (match_dup 1)))]
1973 ""
1d5d7a21 1974 { operands[3] = gen_reg_rtx (BImode); })
c65ebc55
JW
1975
1976(define_expand "umaxsi3"
1977 [(set (match_dup 3)
f2f90c63 1978 (geu:BI (match_operand:SI 1 "gr_register_operand" "")
0551c32d
RH
1979 (match_operand:SI 2 "gr_register_operand" "")))
1980 (set (match_operand:SI 0 "gr_register_operand" "")
f2f90c63 1981 (if_then_else:SI (ne (match_dup 3) (const_int 0))
c65ebc55
JW
1982 (match_dup 1) (match_dup 2)))]
1983 ""
1d5d7a21 1984 { operands[3] = gen_reg_rtx (BImode); })
c65ebc55 1985
655f2eb9
RH
1986(define_expand "divsi3"
1987 [(set (match_operand:SI 0 "register_operand" "")
1988 (div:SI (match_operand:SI 1 "general_operand" "")
1989 (match_operand:SI 2 "general_operand" "")))]
23c108af 1990 "INTEL_EXTENDED_IEEE_FORMAT && TARGET_INLINE_DIV"
655f2eb9
RH
1991{
1992 rtx op1_tf, op2_tf, op0_tf, op0_di, twon34;
efdc7e19 1993 REAL_VALUE_TYPE twon34_r;
655f2eb9
RH
1994
1995 op0_tf = gen_reg_rtx (TFmode);
1996 op0_di = gen_reg_rtx (DImode);
1997
1998 if (CONSTANT_P (operands[1]))
1999 operands[1] = force_reg (SImode, operands[1]);
2000 op1_tf = gen_reg_rtx (TFmode);
2001 expand_float (op1_tf, operands[1], 0);
2002
2003 if (CONSTANT_P (operands[2]))
2004 operands[2] = force_reg (SImode, operands[2]);
2005 op2_tf = gen_reg_rtx (TFmode);
2006 expand_float (op2_tf, operands[2], 0);
2007
2008 /* 2^-34 */
efdc7e19
RH
2009 real_2expN (&twon34_r, -34);
2010 twon34 = CONST_DOUBLE_FROM_REAL_VALUE (twon34_r, TFmode);
655f2eb9 2011 twon34 = force_reg (TFmode, twon34);
655f2eb9
RH
2012
2013 emit_insn (gen_divsi3_internal (op0_tf, op1_tf, op2_tf, twon34));
2014
2015 emit_insn (gen_fix_trunctfdi2_alts (op0_di, op0_tf, const1_rtx));
2016 emit_move_insn (operands[0], gen_lowpart (SImode, op0_di));
2017 DONE;
1d5d7a21 2018})
655f2eb9
RH
2019
2020(define_expand "modsi3"
2021 [(set (match_operand:SI 0 "register_operand" "")
2022 (mod:SI (match_operand:SI 1 "general_operand" "")
2023 (match_operand:SI 2 "general_operand" "")))]
23c108af 2024 "INTEL_EXTENDED_IEEE_FORMAT && TARGET_INLINE_DIV"
655f2eb9
RH
2025{
2026 rtx op2_neg, op1_di, div;
2027
2028 div = gen_reg_rtx (SImode);
2029 emit_insn (gen_divsi3 (div, operands[1], operands[2]));
2030
2031 op2_neg = expand_unop (SImode, neg_optab, operands[2], NULL_RTX, 0);
2032
2033 /* This is a trick to get us to reuse the value that we're sure to
2034 have already copied to the FP regs. */
2035 op1_di = gen_reg_rtx (DImode);
2036 convert_move (op1_di, operands[1], 0);
2037
2038 emit_insn (gen_maddsi4 (operands[0], div, op2_neg,
2039 gen_lowpart (SImode, op1_di)));
2040 DONE;
1d5d7a21 2041})
655f2eb9
RH
2042
2043(define_expand "udivsi3"
2044 [(set (match_operand:SI 0 "register_operand" "")
2045 (udiv:SI (match_operand:SI 1 "general_operand" "")
2046 (match_operand:SI 2 "general_operand" "")))]
23c108af 2047 "INTEL_EXTENDED_IEEE_FORMAT && TARGET_INLINE_DIV"
655f2eb9
RH
2048{
2049 rtx op1_tf, op2_tf, op0_tf, op0_di, twon34;
efdc7e19 2050 REAL_VALUE_TYPE twon34_r;
655f2eb9
RH
2051
2052 op0_tf = gen_reg_rtx (TFmode);
2053 op0_di = gen_reg_rtx (DImode);
2054
2055 if (CONSTANT_P (operands[1]))
2056 operands[1] = force_reg (SImode, operands[1]);
2057 op1_tf = gen_reg_rtx (TFmode);
2058 expand_float (op1_tf, operands[1], 1);
2059
2060 if (CONSTANT_P (operands[2]))
2061 operands[2] = force_reg (SImode, operands[2]);
2062 op2_tf = gen_reg_rtx (TFmode);
2063 expand_float (op2_tf, operands[2], 1);
2064
2065 /* 2^-34 */
efdc7e19
RH
2066 real_2expN (&twon34_r, -34);
2067 twon34 = CONST_DOUBLE_FROM_REAL_VALUE (twon34_r, TFmode);
655f2eb9 2068 twon34 = force_reg (TFmode, twon34);
655f2eb9
RH
2069
2070 emit_insn (gen_divsi3_internal (op0_tf, op1_tf, op2_tf, twon34));
2071
2072 emit_insn (gen_fixuns_trunctfdi2_alts (op0_di, op0_tf, const1_rtx));
2073 emit_move_insn (operands[0], gen_lowpart (SImode, op0_di));
2074 DONE;
1d5d7a21 2075})
655f2eb9
RH
2076
2077(define_expand "umodsi3"
2078 [(set (match_operand:SI 0 "register_operand" "")
2079 (umod:SI (match_operand:SI 1 "general_operand" "")
2080 (match_operand:SI 2 "general_operand" "")))]
23c108af 2081 "INTEL_EXTENDED_IEEE_FORMAT && TARGET_INLINE_DIV"
655f2eb9
RH
2082{
2083 rtx op2_neg, op1_di, div;
2084
2085 div = gen_reg_rtx (SImode);
2086 emit_insn (gen_udivsi3 (div, operands[1], operands[2]));
2087
2088 op2_neg = expand_unop (SImode, neg_optab, operands[2], NULL_RTX, 0);
2089
2090 /* This is a trick to get us to reuse the value that we're sure to
2091 have already copied to the FP regs. */
2092 op1_di = gen_reg_rtx (DImode);
2093 convert_move (op1_di, operands[1], 1);
2094
2095 emit_insn (gen_maddsi4 (operands[0], div, op2_neg,
2096 gen_lowpart (SImode, op1_di)));
2097 DONE;
1d5d7a21 2098})
655f2eb9
RH
2099
2100(define_insn_and_split "divsi3_internal"
2101 [(set (match_operand:TF 0 "fr_register_operand" "=&f")
2102 (float:TF (div:SI (match_operand:TF 1 "fr_register_operand" "f")
2103 (match_operand:TF 2 "fr_register_operand" "f"))))
2104 (clobber (match_scratch:TF 4 "=&f"))
2105 (clobber (match_scratch:TF 5 "=&f"))
f2f90c63 2106 (clobber (match_scratch:BI 6 "=c"))
655f2eb9 2107 (use (match_operand:TF 3 "fr_register_operand" "f"))]
23c108af 2108 "INTEL_EXTENDED_IEEE_FORMAT && TARGET_INLINE_DIV"
655f2eb9
RH
2109 "#"
2110 "&& reload_completed"
2111 [(parallel [(set (match_dup 0) (div:TF (const_int 1) (match_dup 2)))
086c0f96
RH
2112 (set (match_dup 6) (unspec:BI [(match_dup 1) (match_dup 2)]
2113 UNSPEC_FR_RECIP_APPROX))
655f2eb9
RH
2114 (use (const_int 1))])
2115 (cond_exec (ne (match_dup 6) (const_int 0))
2116 (parallel [(set (match_dup 4) (mult:TF (match_dup 1) (match_dup 0)))
2117 (use (const_int 1))]))
2118 (cond_exec (ne (match_dup 6) (const_int 0))
2119 (parallel [(set (match_dup 5)
2120 (plus:TF (neg:TF (mult:TF (match_dup 2) (match_dup 0)))
2121 (match_dup 7)))
2122 (use (const_int 1))]))
2123 (cond_exec (ne (match_dup 6) (const_int 0))
2124 (parallel [(set (match_dup 4)
2125 (plus:TF (mult:TF (match_dup 5) (match_dup 4))
2126 (match_dup 4)))
2127 (use (const_int 1))]))
2128 (cond_exec (ne (match_dup 6) (const_int 0))
2129 (parallel [(set (match_dup 5)
2130 (plus:TF (mult:TF (match_dup 5) (match_dup 5))
2131 (match_dup 3)))
2132 (use (const_int 1))]))
2133 (cond_exec (ne (match_dup 6) (const_int 0))
2134 (parallel [(set (match_dup 0)
2135 (plus:TF (mult:TF (match_dup 5) (match_dup 4))
2136 (match_dup 4)))
2137 (use (const_int 1))]))
2138 ]
2139 "operands[7] = CONST1_RTX (TFmode);"
2140 [(set_attr "predicable" "no")])
c65ebc55
JW
2141\f
2142;; ::::::::::::::::::::
2143;; ::
2144;; :: 64 bit Integer arithmetic
2145;; ::
2146;; ::::::::::::::::::::
2147
2148(define_insn "adddi3"
0551c32d
RH
2149 [(set (match_operand:DI 0 "gr_register_operand" "=r,r,r")
2150 (plus:DI (match_operand:DI 1 "gr_register_operand" "%r,r,a")
2151 (match_operand:DI 2 "gr_reg_or_22bit_operand" "r,I,J")))]
c65ebc55
JW
2152 ""
2153 "@
1d5d7a21
RH
2154 add %0 = %1, %2
2155 adds %0 = %2, %1
2156 addl %0 = %2, %1"
52e12ad0 2157 [(set_attr "itanium_class" "ialu")])
c65ebc55
JW
2158
2159(define_insn "*adddi3_plus1"
0551c32d
RH
2160 [(set (match_operand:DI 0 "gr_register_operand" "=r")
2161 (plus:DI (plus:DI (match_operand:DI 1 "gr_register_operand" "r")
2162 (match_operand:DI 2 "gr_register_operand" "r"))
c65ebc55
JW
2163 (const_int 1)))]
2164 ""
2165 "add %0 = %1, %2, 1"
52e12ad0 2166 [(set_attr "itanium_class" "ialu")])
c65ebc55 2167
5527bf14
RH
2168;; This has some of the same problems as shladd. We let the shladd
2169;; eliminator hack handle it, which results in the 1 being forced into
2170;; a register, but not more ugliness here.
2171(define_insn "*adddi3_plus1_alt"
0551c32d
RH
2172 [(set (match_operand:DI 0 "gr_register_operand" "=r")
2173 (plus:DI (mult:DI (match_operand:DI 1 "gr_register_operand" "r")
5527bf14
RH
2174 (const_int 2))
2175 (const_int 1)))]
2176 ""
2177 "add %0 = %1, %1, 1"
52e12ad0 2178 [(set_attr "itanium_class" "ialu")])
5527bf14 2179
c65ebc55 2180(define_insn "subdi3"
0551c32d
RH
2181 [(set (match_operand:DI 0 "gr_register_operand" "=r")
2182 (minus:DI (match_operand:DI 1 "gr_reg_or_8bit_operand" "rK")
2183 (match_operand:DI 2 "gr_register_operand" "r")))]
c65ebc55
JW
2184 ""
2185 "sub %0 = %1, %2"
52e12ad0 2186 [(set_attr "itanium_class" "ialu")])
c65ebc55
JW
2187
2188(define_insn "*subdi3_minus1"
0551c32d
RH
2189 [(set (match_operand:DI 0 "gr_register_operand" "=r")
2190 (plus:DI (not:DI (match_operand:DI 1 "gr_register_operand" "r"))
2191 (match_operand:DI 2 "gr_register_operand" "r")))]
c65ebc55
JW
2192 ""
2193 "sub %0 = %2, %1, 1"
52e12ad0 2194 [(set_attr "itanium_class" "ialu")])
c65ebc55 2195
cee58bc0
RH
2196;; ??? Use grfr instead of fr because of virtual register elimination
2197;; and silly test cases multiplying by the frame pointer.
c65ebc55 2198(define_insn "muldi3"
0551c32d 2199 [(set (match_operand:DI 0 "fr_register_operand" "=f")
cee58bc0
RH
2200 (mult:DI (match_operand:DI 1 "grfr_register_operand" "f")
2201 (match_operand:DI 2 "grfr_register_operand" "f")))]
c65ebc55 2202 ""
aebf2462 2203 "xmpy.l %0 = %1, %2"
52e12ad0 2204 [(set_attr "itanium_class" "xmpy")])
c65ebc55
JW
2205
2206;; ??? If operand 3 is an eliminable reg, then register elimination causes the
2207;; same problem that we have with shladd below. Unfortunately, this case is
2208;; much harder to fix because the multiply puts the result in an FP register,
2209;; but the add needs inputs from a general register. We add a spurious clobber
2210;; here so that it will be present just in case register elimination gives us
2211;; the funny result.
2212
2213;; ??? Maybe validate_changes should try adding match_scratch clobbers?
2214
2215;; ??? Maybe we should change how adds are canonicalized.
2216
655f2eb9 2217(define_insn "madddi4"
0551c32d 2218 [(set (match_operand:DI 0 "fr_register_operand" "=f")
11a13704
RH
2219 (plus:DI (mult:DI (match_operand:DI 1 "grfr_register_operand" "f")
2220 (match_operand:DI 2 "grfr_register_operand" "f"))
2221 (match_operand:DI 3 "grfr_register_operand" "f")))
c65ebc55
JW
2222 (clobber (match_scratch:DI 4 "=X"))]
2223 ""
aebf2462 2224 "xma.l %0 = %1, %2, %3"
52e12ad0 2225 [(set_attr "itanium_class" "xmpy")])
c65ebc55
JW
2226
2227;; This can be created by register elimination if operand3 of shladd is an
2228;; eliminable register or has reg_equiv_constant set.
2229
2230;; We have to use nonmemory_operand for operand 4, to ensure that the
2231;; validate_changes call inside eliminate_regs will always succeed. If it
655f2eb9 2232;; doesn't succeed, then this remain a madddi4 pattern, and will be reloaded
c65ebc55
JW
2233;; incorrectly.
2234
655f2eb9 2235(define_insn "*madddi4_elim"
c65ebc55 2236 [(set (match_operand:DI 0 "register_operand" "=&r")
13da91fd
RH
2237 (plus:DI (plus:DI (mult:DI (match_operand:DI 1 "register_operand" "f")
2238 (match_operand:DI 2 "register_operand" "f"))
2239 (match_operand:DI 3 "register_operand" "f"))
c65ebc55 2240 (match_operand:DI 4 "nonmemory_operand" "rI")))
13da91fd 2241 (clobber (match_scratch:DI 5 "=f"))]
c65ebc55
JW
2242 "reload_in_progress"
2243 "#"
52e12ad0 2244 [(set_attr "itanium_class" "unknown")])
c65ebc55 2245
c65ebc55
JW
2246(define_split
2247 [(set (match_operand:DI 0 "register_operand" "")
2248 (plus:DI (plus:DI (mult:DI (match_operand:DI 1 "register_operand" "")
2249 (match_operand:DI 2 "register_operand" ""))
2250 (match_operand:DI 3 "register_operand" ""))
0551c32d 2251 (match_operand:DI 4 "gr_reg_or_14bit_operand" "")))
c65ebc55
JW
2252 (clobber (match_scratch:DI 5 ""))]
2253 "reload_completed"
2254 [(parallel [(set (match_dup 5) (plus:DI (mult:DI (match_dup 1) (match_dup 2))
2255 (match_dup 3)))
2256 (clobber (match_dup 0))])
c65ebc55 2257 (set (match_dup 0) (match_dup 5))
c65ebc55
JW
2258 (set (match_dup 0) (plus:DI (match_dup 0) (match_dup 4)))]
2259 "")
2260
2261;; ??? There are highpart multiply and add instructions, but we have no way
2262;; to generate them.
2263
2264(define_insn "smuldi3_highpart"
0551c32d 2265 [(set (match_operand:DI 0 "fr_register_operand" "=f")
c65ebc55
JW
2266 (truncate:DI
2267 (lshiftrt:TI
0551c32d
RH
2268 (mult:TI (sign_extend:TI
2269 (match_operand:DI 1 "fr_register_operand" "f"))
2270 (sign_extend:TI
2271 (match_operand:DI 2 "fr_register_operand" "f")))
c65ebc55
JW
2272 (const_int 64))))]
2273 ""
aebf2462 2274 "xmpy.h %0 = %1, %2"
52e12ad0 2275 [(set_attr "itanium_class" "xmpy")])
c65ebc55
JW
2276
2277(define_insn "umuldi3_highpart"
0551c32d 2278 [(set (match_operand:DI 0 "fr_register_operand" "=f")
c65ebc55
JW
2279 (truncate:DI
2280 (lshiftrt:TI
0551c32d
RH
2281 (mult:TI (zero_extend:TI
2282 (match_operand:DI 1 "fr_register_operand" "f"))
2283 (zero_extend:TI
2284 (match_operand:DI 2 "fr_register_operand" "f")))
c65ebc55
JW
2285 (const_int 64))))]
2286 ""
aebf2462 2287 "xmpy.hu %0 = %1, %2"
52e12ad0 2288 [(set_attr "itanium_class" "xmpy")])
c65ebc55
JW
2289
2290(define_insn "negdi2"
0551c32d
RH
2291 [(set (match_operand:DI 0 "gr_register_operand" "=r")
2292 (neg:DI (match_operand:DI 1 "gr_register_operand" "r")))]
c65ebc55
JW
2293 ""
2294 "sub %0 = r0, %1"
52e12ad0 2295 [(set_attr "itanium_class" "ialu")])
c65ebc55
JW
2296
2297(define_expand "absdi2"
2298 [(set (match_dup 2)
f2f90c63 2299 (ge:BI (match_operand:DI 1 "gr_register_operand" "") (const_int 0)))
0551c32d 2300 (set (match_operand:DI 0 "gr_register_operand" "")
f2f90c63 2301 (if_then_else:DI (eq (match_dup 2) (const_int 0))
e5bde68a
RH
2302 (neg:DI (match_dup 1))
2303 (match_dup 1)))]
c65ebc55 2304 ""
1d5d7a21 2305 { operands[2] = gen_reg_rtx (BImode); })
c65ebc55
JW
2306
2307(define_expand "smindi3"
2308 [(set (match_dup 3)
f2f90c63 2309 (ge:BI (match_operand:DI 1 "gr_register_operand" "")
0551c32d
RH
2310 (match_operand:DI 2 "gr_register_operand" "")))
2311 (set (match_operand:DI 0 "gr_register_operand" "")
f2f90c63 2312 (if_then_else:DI (ne (match_dup 3) (const_int 0))
c65ebc55
JW
2313 (match_dup 2) (match_dup 1)))]
2314 ""
1d5d7a21 2315 { operands[3] = gen_reg_rtx (BImode); })
c65ebc55
JW
2316
2317(define_expand "smaxdi3"
2318 [(set (match_dup 3)
f2f90c63 2319 (ge:BI (match_operand:DI 1 "gr_register_operand" "")
0551c32d
RH
2320 (match_operand:DI 2 "gr_register_operand" "")))
2321 (set (match_operand:DI 0 "gr_register_operand" "")
f2f90c63 2322 (if_then_else:DI (ne (match_dup 3) (const_int 0))
c65ebc55
JW
2323 (match_dup 1) (match_dup 2)))]
2324 ""
1d5d7a21 2325 { operands[3] = gen_reg_rtx (BImode); })
c65ebc55
JW
2326
2327(define_expand "umindi3"
2328 [(set (match_dup 3)
f2f90c63 2329 (geu:BI (match_operand:DI 1 "gr_register_operand" "")
0551c32d
RH
2330 (match_operand:DI 2 "gr_register_operand" "")))
2331 (set (match_operand:DI 0 "gr_register_operand" "")
f2f90c63 2332 (if_then_else:DI (ne (match_dup 3) (const_int 0))
c65ebc55
JW
2333 (match_dup 2) (match_dup 1)))]
2334 ""
1d5d7a21 2335 { operands[3] = gen_reg_rtx (BImode); })
c65ebc55
JW
2336
2337(define_expand "umaxdi3"
2338 [(set (match_dup 3)
f2f90c63 2339 (geu:BI (match_operand:DI 1 "gr_register_operand" "")
0551c32d
RH
2340 (match_operand:DI 2 "gr_register_operand" "")))
2341 (set (match_operand:DI 0 "gr_register_operand" "")
f2f90c63 2342 (if_then_else:DI (ne (match_dup 3) (const_int 0))
c65ebc55
JW
2343 (match_dup 1) (match_dup 2)))]
2344 ""
1d5d7a21 2345 { operands[3] = gen_reg_rtx (BImode); })
c65ebc55
JW
2346
2347(define_expand "ffsdi2"
2348 [(set (match_dup 6)
f2f90c63 2349 (eq:BI (match_operand:DI 1 "gr_register_operand" "") (const_int 0)))
c65ebc55
JW
2350 (set (match_dup 2) (plus:DI (match_dup 1) (const_int -1)))
2351 (set (match_dup 5) (const_int 0))
2352 (set (match_dup 3) (xor:DI (match_dup 1) (match_dup 2)))
086c0f96 2353 (set (match_dup 4) (unspec:DI [(match_dup 3)] UNSPEC_POPCNT))
0551c32d 2354 (set (match_operand:DI 0 "gr_register_operand" "")
f2f90c63 2355 (if_then_else:DI (ne (match_dup 6) (const_int 0))
c65ebc55
JW
2356 (match_dup 5) (match_dup 4)))]
2357 ""
c65ebc55
JW
2358{
2359 operands[2] = gen_reg_rtx (DImode);
2360 operands[3] = gen_reg_rtx (DImode);
2361 operands[4] = gen_reg_rtx (DImode);
2362 operands[5] = gen_reg_rtx (DImode);
f2f90c63 2363 operands[6] = gen_reg_rtx (BImode);
1d5d7a21 2364})
c65ebc55
JW
2365
2366(define_insn "*popcnt"
0551c32d 2367 [(set (match_operand:DI 0 "gr_register_operand" "=r")
086c0f96
RH
2368 (unspec:DI [(match_operand:DI 1 "gr_register_operand" "r")]
2369 UNSPEC_POPCNT))]
c65ebc55
JW
2370 ""
2371 "popcnt %0 = %1"
52e12ad0 2372 [(set_attr "itanium_class" "mmmul")])
c65ebc55 2373
655f2eb9
RH
2374(define_expand "divdi3"
2375 [(set (match_operand:DI 0 "register_operand" "")
2376 (div:DI (match_operand:DI 1 "general_operand" "")
2377 (match_operand:DI 2 "general_operand" "")))]
23c108af 2378 "INTEL_EXTENDED_IEEE_FORMAT && TARGET_INLINE_DIV"
655f2eb9
RH
2379{
2380 rtx op1_tf, op2_tf, op0_tf;
2381
2382 op0_tf = gen_reg_rtx (TFmode);
2383
2384 if (CONSTANT_P (operands[1]))
2385 operands[1] = force_reg (DImode, operands[1]);
2386 op1_tf = gen_reg_rtx (TFmode);
2387 expand_float (op1_tf, operands[1], 0);
2388
2389 if (CONSTANT_P (operands[2]))
2390 operands[2] = force_reg (DImode, operands[2]);
2391 op2_tf = gen_reg_rtx (TFmode);
2392 expand_float (op2_tf, operands[2], 0);
2393
2394 if (TARGET_INLINE_DIV_LAT)
2395 emit_insn (gen_divdi3_internal_lat (op0_tf, op1_tf, op2_tf));
2396 else
2397 emit_insn (gen_divdi3_internal_thr (op0_tf, op1_tf, op2_tf));
2398
2399 emit_insn (gen_fix_trunctfdi2_alts (operands[0], op0_tf, const1_rtx));
2400 DONE;
1d5d7a21 2401})
655f2eb9
RH
2402
2403(define_expand "moddi3"
2404 [(set (match_operand:DI 0 "register_operand" "")
2405 (mod:SI (match_operand:DI 1 "general_operand" "")
2406 (match_operand:DI 2 "general_operand" "")))]
23c108af 2407 "INTEL_EXTENDED_IEEE_FORMAT && TARGET_INLINE_DIV"
655f2eb9
RH
2408{
2409 rtx op2_neg, div;
2410
2411 div = gen_reg_rtx (DImode);
2412 emit_insn (gen_divdi3 (div, operands[1], operands[2]));
2413
2414 op2_neg = expand_unop (DImode, neg_optab, operands[2], NULL_RTX, 0);
2415
2416 emit_insn (gen_madddi4 (operands[0], div, op2_neg, operands[1]));
2417 DONE;
1d5d7a21 2418})
655f2eb9
RH
2419
2420(define_expand "udivdi3"
2421 [(set (match_operand:DI 0 "register_operand" "")
2422 (udiv:DI (match_operand:DI 1 "general_operand" "")
2423 (match_operand:DI 2 "general_operand" "")))]
23c108af 2424 "INTEL_EXTENDED_IEEE_FORMAT && TARGET_INLINE_DIV"
655f2eb9
RH
2425{
2426 rtx op1_tf, op2_tf, op0_tf;
2427
2428 op0_tf = gen_reg_rtx (TFmode);
2429
2430 if (CONSTANT_P (operands[1]))
2431 operands[1] = force_reg (DImode, operands[1]);
2432 op1_tf = gen_reg_rtx (TFmode);
2433 expand_float (op1_tf, operands[1], 1);
2434
2435 if (CONSTANT_P (operands[2]))
2436 operands[2] = force_reg (DImode, operands[2]);
2437 op2_tf = gen_reg_rtx (TFmode);
2438 expand_float (op2_tf, operands[2], 1);
2439
2440 if (TARGET_INLINE_DIV_LAT)
2441 emit_insn (gen_divdi3_internal_lat (op0_tf, op1_tf, op2_tf));
2442 else
2443 emit_insn (gen_divdi3_internal_thr (op0_tf, op1_tf, op2_tf));
2444
2445 emit_insn (gen_fixuns_trunctfdi2_alts (operands[0], op0_tf, const1_rtx));
2446 DONE;
1d5d7a21 2447})
655f2eb9
RH
2448
2449(define_expand "umoddi3"
2450 [(set (match_operand:DI 0 "register_operand" "")
2451 (umod:DI (match_operand:DI 1 "general_operand" "")
2452 (match_operand:DI 2 "general_operand" "")))]
23c108af 2453 "INTEL_EXTENDED_IEEE_FORMAT && TARGET_INLINE_DIV"
655f2eb9
RH
2454{
2455 rtx op2_neg, div;
2456
2457 div = gen_reg_rtx (DImode);
2458 emit_insn (gen_udivdi3 (div, operands[1], operands[2]));
2459
2460 op2_neg = expand_unop (DImode, neg_optab, operands[2], NULL_RTX, 0);
2461
2462 emit_insn (gen_madddi4 (operands[0], div, op2_neg, operands[1]));
2463 DONE;
1d5d7a21 2464})
655f2eb9
RH
2465
2466(define_insn_and_split "divdi3_internal_lat"
2467 [(set (match_operand:TF 0 "fr_register_operand" "=&f")
2468 (float:TF (div:SI (match_operand:TF 1 "fr_register_operand" "f")
2469 (match_operand:TF 2 "fr_register_operand" "f"))))
2470 (clobber (match_scratch:TF 3 "=&f"))
2471 (clobber (match_scratch:TF 4 "=&f"))
2472 (clobber (match_scratch:TF 5 "=&f"))
f2f90c63 2473 (clobber (match_scratch:BI 6 "=c"))]
23c108af 2474 "INTEL_EXTENDED_IEEE_FORMAT && TARGET_INLINE_DIV_LAT"
655f2eb9
RH
2475 "#"
2476 "&& reload_completed"
2477 [(parallel [(set (match_dup 0) (div:TF (const_int 1) (match_dup 2)))
086c0f96
RH
2478 (set (match_dup 6) (unspec:BI [(match_dup 1) (match_dup 2)]
2479 UNSPEC_FR_RECIP_APPROX))
655f2eb9
RH
2480 (use (const_int 1))])
2481 (cond_exec (ne (match_dup 6) (const_int 0))
2482 (parallel [(set (match_dup 3)
2483 (plus:TF (neg:TF (mult:TF (match_dup 2) (match_dup 0)))
2484 (match_dup 7)))
2485 (use (const_int 1))]))
2486 (cond_exec (ne (match_dup 6) (const_int 0))
2487 (parallel [(set (match_dup 4) (mult:TF (match_dup 1) (match_dup 0)))
2488 (use (const_int 1))]))
2489 (cond_exec (ne (match_dup 6) (const_int 0))
2490 (parallel [(set (match_dup 5) (mult:TF (match_dup 3) (match_dup 3)))
2491 (use (const_int 1))]))
2492 (cond_exec (ne (match_dup 6) (const_int 0))
2493 (parallel [(set (match_dup 4)
2494 (plus:TF (mult:TF (match_dup 3) (match_dup 4))
2495 (match_dup 4)))
2496 (use (const_int 1))]))
2497 (cond_exec (ne (match_dup 6) (const_int 0))
2498 (parallel [(set (match_dup 0)
2499 (plus:TF (mult:TF (match_dup 3) (match_dup 0))
2500 (match_dup 0)))
2501 (use (const_int 1))]))
2502 (cond_exec (ne (match_dup 6) (const_int 0))
2503 (parallel [(set (match_dup 3)
2504 (plus:TF (mult:TF (match_dup 5) (match_dup 4))
2505 (match_dup 4)))
2506 (use (const_int 1))]))
2507 (cond_exec (ne (match_dup 6) (const_int 0))
2508 (parallel [(set (match_dup 0)
2509 (plus:TF (mult:TF (match_dup 5) (match_dup 0))
2510 (match_dup 0)))
2511 (use (const_int 1))]))
2512 (cond_exec (ne (match_dup 6) (const_int 0))
2513 (parallel [(set (match_dup 4)
2514 (plus:TF (neg:TF (mult:TF (match_dup 2) (match_dup 3)))
2515 (match_dup 1)))
2516 (use (const_int 1))]))
2517 (cond_exec (ne (match_dup 6) (const_int 0))
2518 (parallel [(set (match_dup 0)
2519 (plus:TF (mult:TF (match_dup 4) (match_dup 0))
2520 (match_dup 3)))
2521 (use (const_int 1))]))
2522 ]
2523 "operands[7] = CONST1_RTX (TFmode);"
2524 [(set_attr "predicable" "no")])
2525
2526(define_insn_and_split "divdi3_internal_thr"
2527 [(set (match_operand:TF 0 "fr_register_operand" "=&f")
2528 (float:TF (div:SI (match_operand:TF 1 "fr_register_operand" "f")
2529 (match_operand:TF 2 "fr_register_operand" "f"))))
2530 (clobber (match_scratch:TF 3 "=&f"))
2531 (clobber (match_scratch:TF 4 "=f"))
f2f90c63 2532 (clobber (match_scratch:BI 5 "=c"))]
23c108af 2533 "INTEL_EXTENDED_IEEE_FORMAT && TARGET_INLINE_DIV_THR"
655f2eb9
RH
2534 "#"
2535 "&& reload_completed"
2536 [(parallel [(set (match_dup 0) (div:TF (const_int 1) (match_dup 2)))
086c0f96
RH
2537 (set (match_dup 5) (unspec:BI [(match_dup 1) (match_dup 2)]
2538 UNSPEC_FR_RECIP_APPROX))
655f2eb9
RH
2539 (use (const_int 1))])
2540 (cond_exec (ne (match_dup 5) (const_int 0))
2541 (parallel [(set (match_dup 3)
2542 (plus:TF (neg:TF (mult:TF (match_dup 2) (match_dup 0)))
2543 (match_dup 6)))
2544 (use (const_int 1))]))
2545 (cond_exec (ne (match_dup 5) (const_int 0))
2546 (parallel [(set (match_dup 0)
2547 (plus:TF (mult:TF (match_dup 3) (match_dup 0))
2548 (match_dup 0)))
2549 (use (const_int 1))]))
2550 (cond_exec (ne (match_dup 5) (const_int 0))
2551 (parallel [(set (match_dup 3) (mult:TF (match_dup 3) (match_dup 3)))
2552 (use (const_int 1))]))
2553 (cond_exec (ne (match_dup 5) (const_int 0))
2554 (parallel [(set (match_dup 0)
2555 (plus:TF (mult:TF (match_dup 3) (match_dup 0))
2556 (match_dup 0)))
2557 (use (const_int 1))]))
2558 (cond_exec (ne (match_dup 5) (const_int 0))
2559 (parallel [(set (match_dup 3) (mult:TF (match_dup 0) (match_dup 1)))
2560 (use (const_int 1))]))
2561 (cond_exec (ne (match_dup 5) (const_int 0))
2562 (parallel [(set (match_dup 4)
2563 (plus:TF (neg:TF (mult:TF (match_dup 2) (match_dup 3)))
2564 (match_dup 1)))
2565 (use (const_int 1))]))
2566 (cond_exec (ne (match_dup 5) (const_int 0))
2567 (parallel [(set (match_dup 0)
2568 (plus:TF (mult:TF (match_dup 4) (match_dup 0))
2569 (match_dup 3)))
2570 (use (const_int 1))]))
2571 ]
2572 "operands[6] = CONST1_RTX (TFmode);"
2573 [(set_attr "predicable" "no")])
c65ebc55
JW
2574\f
2575;; ::::::::::::::::::::
2576;; ::
2577;; :: 32 bit floating point arithmetic
2578;; ::
2579;; ::::::::::::::::::::
2580
2581(define_insn "addsf3"
0551c32d
RH
2582 [(set (match_operand:SF 0 "fr_register_operand" "=f")
2583 (plus:SF (match_operand:SF 1 "fr_register_operand" "%f")
2584 (match_operand:SF 2 "fr_reg_or_fp01_operand" "fG")))]
c65ebc55 2585 ""
aebf2462 2586 "fadd.s %0 = %1, %F2"
52e12ad0 2587 [(set_attr "itanium_class" "fmac")])
c65ebc55
JW
2588
2589(define_insn "subsf3"
0551c32d
RH
2590 [(set (match_operand:SF 0 "fr_register_operand" "=f")
2591 (minus:SF (match_operand:SF 1 "fr_reg_or_fp01_operand" "fG")
2592 (match_operand:SF 2 "fr_reg_or_fp01_operand" "fG")))]
c65ebc55 2593 ""
aebf2462 2594 "fsub.s %0 = %F1, %F2"
52e12ad0 2595 [(set_attr "itanium_class" "fmac")])
c65ebc55
JW
2596
2597(define_insn "mulsf3"
0551c32d
RH
2598 [(set (match_operand:SF 0 "fr_register_operand" "=f")
2599 (mult:SF (match_operand:SF 1 "fr_register_operand" "%f")
2600 (match_operand:SF 2 "fr_register_operand" "f")))]
c65ebc55 2601 ""
aebf2462 2602 "fmpy.s %0 = %1, %2"
52e12ad0 2603 [(set_attr "itanium_class" "fmac")])
c65ebc55
JW
2604
2605(define_insn "abssf2"
0551c32d
RH
2606 [(set (match_operand:SF 0 "fr_register_operand" "=f")
2607 (abs:SF (match_operand:SF 1 "fr_register_operand" "f")))]
c65ebc55 2608 ""
aebf2462 2609 "fabs %0 = %1"
52e12ad0 2610 [(set_attr "itanium_class" "fmisc")])
c65ebc55
JW
2611
2612(define_insn "negsf2"
0551c32d
RH
2613 [(set (match_operand:SF 0 "fr_register_operand" "=f")
2614 (neg:SF (match_operand:SF 1 "fr_register_operand" "f")))]
c65ebc55 2615 ""
aebf2462 2616 "fneg %0 = %1"
52e12ad0 2617 [(set_attr "itanium_class" "fmisc")])
c65ebc55
JW
2618
2619(define_insn "*nabssf2"
0551c32d
RH
2620 [(set (match_operand:SF 0 "fr_register_operand" "=f")
2621 (neg:SF (abs:SF (match_operand:SF 1 "fr_register_operand" "f"))))]
c65ebc55 2622 ""
aebf2462 2623 "fnegabs %0 = %1"
52e12ad0 2624 [(set_attr "itanium_class" "fmisc")])
c65ebc55
JW
2625
2626(define_insn "minsf3"
0551c32d
RH
2627 [(set (match_operand:SF 0 "fr_register_operand" "=f")
2628 (smin:SF (match_operand:SF 1 "fr_register_operand" "f")
2629 (match_operand:SF 2 "fr_reg_or_fp01_operand" "fG")))]
c65ebc55 2630 ""
aebf2462 2631 "fmin %0 = %1, %F2"
52e12ad0 2632 [(set_attr "itanium_class" "fmisc")])
c65ebc55
JW
2633
2634(define_insn "maxsf3"
0551c32d
RH
2635 [(set (match_operand:SF 0 "fr_register_operand" "=f")
2636 (smax:SF (match_operand:SF 1 "fr_register_operand" "f")
2637 (match_operand:SF 2 "fr_reg_or_fp01_operand" "fG")))]
c65ebc55 2638 ""
aebf2462 2639 "fmax %0 = %1, %F2"
52e12ad0 2640 [(set_attr "itanium_class" "fmisc")])
c65ebc55 2641
655f2eb9 2642(define_insn "*maddsf4"
0551c32d
RH
2643 [(set (match_operand:SF 0 "fr_register_operand" "=f")
2644 (plus:SF (mult:SF (match_operand:SF 1 "fr_register_operand" "f")
2645 (match_operand:SF 2 "fr_register_operand" "f"))
2646 (match_operand:SF 3 "fr_reg_or_fp01_operand" "fG")))]
c65ebc55 2647 ""
aebf2462 2648 "fma.s %0 = %1, %2, %F3"
52e12ad0 2649 [(set_attr "itanium_class" "fmac")])
c65ebc55 2650
655f2eb9 2651(define_insn "*msubsf4"
0551c32d
RH
2652 [(set (match_operand:SF 0 "fr_register_operand" "=f")
2653 (minus:SF (mult:SF (match_operand:SF 1 "fr_register_operand" "f")
2654 (match_operand:SF 2 "fr_register_operand" "f"))
2655 (match_operand:SF 3 "fr_reg_or_fp01_operand" "fG")))]
c65ebc55 2656 ""
aebf2462 2657 "fms.s %0 = %1, %2, %F3"
52e12ad0 2658 [(set_attr "itanium_class" "fmac")])
c65ebc55
JW
2659
2660(define_insn "*nmulsf3"
0551c32d
RH
2661 [(set (match_operand:SF 0 "fr_register_operand" "=f")
2662 (neg:SF (mult:SF (match_operand:SF 1 "fr_register_operand" "f")
2663 (match_operand:SF 2 "fr_register_operand" "f"))))]
c65ebc55 2664 ""
aebf2462 2665 "fnmpy.s %0 = %1, %2"
52e12ad0 2666 [(set_attr "itanium_class" "fmac")])
c65ebc55
JW
2667
2668;; ??? Is it possible to canonicalize this as (minus (reg) (mult))?
2669
655f2eb9 2670(define_insn "*nmaddsf4"
0551c32d 2671 [(set (match_operand:SF 0 "fr_register_operand" "=f")
26102535
RH
2672 (plus:SF (neg:SF (mult:SF
2673 (match_operand:SF 1 "fr_register_operand" "f")
2674 (match_operand:SF 2 "fr_register_operand" "f")))
0551c32d 2675 (match_operand:SF 3 "fr_reg_or_fp01_operand" "fG")))]
c65ebc55 2676 ""
aebf2462 2677 "fnma.s %0 = %1, %2, %F3"
52e12ad0 2678 [(set_attr "itanium_class" "fmac")])
c65ebc55 2679
26102535
RH
2680(define_expand "divsf3"
2681 [(set (match_operand:SF 0 "fr_register_operand" "")
2682 (div:SF (match_operand:SF 1 "fr_register_operand" "")
2683 (match_operand:SF 2 "fr_register_operand" "")))]
23c108af 2684 "INTEL_EXTENDED_IEEE_FORMAT && TARGET_INLINE_DIV"
26102535
RH
2685{
2686 rtx insn;
2687 if (TARGET_INLINE_DIV_LAT)
2688 insn = gen_divsf3_internal_lat (operands[0], operands[1], operands[2]);
2689 else
2690 insn = gen_divsf3_internal_thr (operands[0], operands[1], operands[2]);
2691 emit_insn (insn);
2692 DONE;
1d5d7a21 2693})
26102535
RH
2694
2695(define_insn_and_split "divsf3_internal_lat"
2696 [(set (match_operand:SF 0 "fr_register_operand" "=&f")
2697 (div:SF (match_operand:SF 1 "fr_register_operand" "f")
2698 (match_operand:SF 2 "fr_register_operand" "f")))
2699 (clobber (match_scratch:TF 3 "=&f"))
2700 (clobber (match_scratch:TF 4 "=f"))
f2f90c63 2701 (clobber (match_scratch:BI 5 "=c"))]
23c108af 2702 "INTEL_EXTENDED_IEEE_FORMAT && TARGET_INLINE_DIV_LAT"
26102535
RH
2703 "#"
2704 "&& reload_completed"
2705 [(parallel [(set (match_dup 6) (div:TF (const_int 1) (match_dup 8)))
086c0f96
RH
2706 (set (match_dup 5) (unspec:BI [(match_dup 7) (match_dup 8)]
2707 UNSPEC_FR_RECIP_APPROX))
26102535
RH
2708 (use (const_int 1))])
2709 (cond_exec (ne (match_dup 5) (const_int 0))
2710 (parallel [(set (match_dup 3) (mult:TF (match_dup 7) (match_dup 6)))
2711 (use (const_int 1))]))
2712 (cond_exec (ne (match_dup 5) (const_int 0))
2713 (parallel [(set (match_dup 4)
2714 (plus:TF (neg:TF (mult:TF (match_dup 8) (match_dup 6)))
2715 (match_dup 10)))
2716 (use (const_int 1))]))
2717 (cond_exec (ne (match_dup 5) (const_int 0))
2718 (parallel [(set (match_dup 3)
2719 (plus:TF (mult:TF (match_dup 4) (match_dup 3))
2720 (match_dup 3)))
2721 (use (const_int 1))]))
2722 (cond_exec (ne (match_dup 5) (const_int 0))
2723 (parallel [(set (match_dup 4) (mult:TF (match_dup 4) (match_dup 4)))
2724 (use (const_int 1))]))
2725 (cond_exec (ne (match_dup 5) (const_int 0))
2726 (parallel [(set (match_dup 3)
2727 (plus:TF (mult:TF (match_dup 4) (match_dup 3))
2728 (match_dup 3)))
2729 (use (const_int 1))]))
2730 (cond_exec (ne (match_dup 5) (const_int 0))
2731 (parallel [(set (match_dup 4) (mult:TF (match_dup 4) (match_dup 4)))
2732 (use (const_int 1))]))
2733 (cond_exec (ne (match_dup 5) (const_int 0))
2734 (parallel [(set (match_dup 9)
2735 (float_truncate:DF
2736 (plus:TF (mult:TF (match_dup 4) (match_dup 3))
2737 (match_dup 3))))
2738 (use (const_int 1))]))
2739 (cond_exec (ne (match_dup 5) (const_int 0))
2740 (set (match_dup 0)
2741 (float_truncate:SF (match_dup 6))))
2742 ]
1d5d7a21
RH
2743{
2744 operands[6] = gen_rtx_REG (TFmode, REGNO (operands[0]));
2745 operands[7] = gen_rtx_REG (TFmode, REGNO (operands[1]));
2746 operands[8] = gen_rtx_REG (TFmode, REGNO (operands[2]));
2747 operands[9] = gen_rtx_REG (DFmode, REGNO (operands[0]));
2748 operands[10] = CONST1_RTX (TFmode);
2749}
26102535
RH
2750 [(set_attr "predicable" "no")])
2751
2752(define_insn_and_split "divsf3_internal_thr"
2753 [(set (match_operand:SF 0 "fr_register_operand" "=&f")
2754 (div:SF (match_operand:SF 1 "fr_register_operand" "f")
2755 (match_operand:SF 2 "fr_register_operand" "f")))
2756 (clobber (match_scratch:TF 3 "=&f"))
2757 (clobber (match_scratch:TF 4 "=f"))
f2f90c63 2758 (clobber (match_scratch:BI 5 "=c"))]
23c108af 2759 "INTEL_EXTENDED_IEEE_FORMAT && TARGET_INLINE_DIV_THR"
26102535
RH
2760 "#"
2761 "&& reload_completed"
2762 [(parallel [(set (match_dup 6) (div:TF (const_int 1) (match_dup 8)))
086c0f96
RH
2763 (set (match_dup 5) (unspec:BI [(match_dup 7) (match_dup 8)]
2764 UNSPEC_FR_RECIP_APPROX))
26102535
RH
2765 (use (const_int 1))])
2766 (cond_exec (ne (match_dup 5) (const_int 0))
2767 (parallel [(set (match_dup 3)
2768 (plus:TF (neg:TF (mult:TF (match_dup 8) (match_dup 6)))
2769 (match_dup 10)))
2770 (use (const_int 1))]))
2771 (cond_exec (ne (match_dup 5) (const_int 0))
2772 (parallel [(set (match_dup 3)
2773 (plus:TF (mult:TF (match_dup 3) (match_dup 3))
2774 (match_dup 3)))
2775 (use (const_int 1))]))
2776 (cond_exec (ne (match_dup 5) (const_int 0))
2777 (parallel [(set (match_dup 6)
2778 (plus:TF (mult:TF (match_dup 3) (match_dup 6))
2779 (match_dup 6)))
2780 (use (const_int 1))]))
2781 (cond_exec (ne (match_dup 5) (const_int 0))
2782 (parallel [(set (match_dup 9)
2783 (float_truncate:SF
2784 (mult:TF (match_dup 7) (match_dup 6))))
2785 (use (const_int 1))]))
2786 (cond_exec (ne (match_dup 5) (const_int 0))
2787 (parallel [(set (match_dup 4)
2788 (plus:TF (neg:TF (mult:TF (match_dup 8) (match_dup 3)))
2789 (match_dup 7)))
2790 (use (const_int 1))]))
2791 (cond_exec (ne (match_dup 5) (const_int 0))
2792 (set (match_dup 0)
2793 (float_truncate:SF
2794 (plus:TF (mult:TF (match_dup 4) (match_dup 6))
2795 (match_dup 3)))))
2796 ]
1d5d7a21
RH
2797{
2798 operands[6] = gen_rtx_REG (TFmode, REGNO (operands[0]));
2799 operands[7] = gen_rtx_REG (TFmode, REGNO (operands[1]));
2800 operands[8] = gen_rtx_REG (TFmode, REGNO (operands[2]));
2801 operands[9] = gen_rtx_REG (SFmode, REGNO (operands[3]));
2802 operands[10] = CONST1_RTX (TFmode);
2803}
26102535 2804 [(set_attr "predicable" "no")])
c65ebc55
JW
2805\f
2806;; ::::::::::::::::::::
2807;; ::
2808;; :: 64 bit floating point arithmetic
2809;; ::
2810;; ::::::::::::::::::::
2811
2812(define_insn "adddf3"
0551c32d
RH
2813 [(set (match_operand:DF 0 "fr_register_operand" "=f")
2814 (plus:DF (match_operand:DF 1 "fr_register_operand" "%f")
2815 (match_operand:DF 2 "fr_reg_or_fp01_operand" "fG")))]
c65ebc55 2816 ""
aebf2462 2817 "fadd.d %0 = %1, %F2"
52e12ad0 2818 [(set_attr "itanium_class" "fmac")])
c65ebc55 2819
26102535
RH
2820(define_insn "*adddf3_trunc"
2821 [(set (match_operand:SF 0 "fr_register_operand" "=f")
2822 (float_truncate:SF
2823 (plus:DF (match_operand:DF 1 "fr_register_operand" "%f")
2824 (match_operand:DF 2 "fr_reg_or_fp01_operand" "fG"))))]
2825 ""
aebf2462 2826 "fadd.s %0 = %1, %F2"
52e12ad0 2827 [(set_attr "itanium_class" "fmac")])
26102535 2828
c65ebc55 2829(define_insn "subdf3"
0551c32d
RH
2830 [(set (match_operand:DF 0 "fr_register_operand" "=f")
2831 (minus:DF (match_operand:DF 1 "fr_reg_or_fp01_operand" "fG")
2832 (match_operand:DF 2 "fr_reg_or_fp01_operand" "fG")))]
c65ebc55 2833 ""
aebf2462 2834 "fsub.d %0 = %F1, %F2"
52e12ad0 2835 [(set_attr "itanium_class" "fmac")])
c65ebc55 2836
26102535
RH
2837(define_insn "*subdf3_trunc"
2838 [(set (match_operand:SF 0 "fr_register_operand" "=f")
2839 (float_truncate:SF
2840 (minus:DF (match_operand:DF 1 "fr_reg_or_fp01_operand" "fG")
2841 (match_operand:DF 2 "fr_reg_or_fp01_operand" "fG"))))]
2842 ""
aebf2462 2843 "fsub.s %0 = %F1, %F2"
52e12ad0 2844 [(set_attr "itanium_class" "fmac")])
26102535 2845
c65ebc55 2846(define_insn "muldf3"
0551c32d
RH
2847 [(set (match_operand:DF 0 "fr_register_operand" "=f")
2848 (mult:DF (match_operand:DF 1 "fr_register_operand" "f")
2849 (match_operand:DF 2 "fr_register_operand" "f")))]
c65ebc55 2850 ""
aebf2462 2851 "fmpy.d %0 = %1, %2"
52e12ad0 2852 [(set_attr "itanium_class" "fmac")])
c65ebc55 2853
26102535
RH
2854(define_insn "*muldf3_trunc"
2855 [(set (match_operand:SF 0 "fr_register_operand" "=f")
2856 (float_truncate:SF
2857 (mult:DF (match_operand:DF 1 "fr_register_operand" "f")
2858 (match_operand:DF 2 "fr_register_operand" "f"))))]
2859 ""
aebf2462 2860 "fmpy.s %0 = %1, %2"
52e12ad0 2861 [(set_attr "itanium_class" "fmac")])
26102535 2862
c65ebc55 2863(define_insn "absdf2"
0551c32d
RH
2864 [(set (match_operand:DF 0 "fr_register_operand" "=f")
2865 (abs:DF (match_operand:DF 1 "fr_register_operand" "f")))]
c65ebc55 2866 ""
aebf2462 2867 "fabs %0 = %1"
52e12ad0 2868 [(set_attr "itanium_class" "fmisc")])
c65ebc55
JW
2869
2870(define_insn "negdf2"
0551c32d
RH
2871 [(set (match_operand:DF 0 "fr_register_operand" "=f")
2872 (neg:DF (match_operand:DF 1 "fr_register_operand" "f")))]
c65ebc55 2873 ""
aebf2462 2874 "fneg %0 = %1"
52e12ad0 2875 [(set_attr "itanium_class" "fmisc")])
c65ebc55
JW
2876
2877(define_insn "*nabsdf2"
0551c32d
RH
2878 [(set (match_operand:DF 0 "fr_register_operand" "=f")
2879 (neg:DF (abs:DF (match_operand:DF 1 "fr_register_operand" "f"))))]
c65ebc55 2880 ""
aebf2462 2881 "fnegabs %0 = %1"
52e12ad0 2882 [(set_attr "itanium_class" "fmisc")])
c65ebc55
JW
2883
2884(define_insn "mindf3"
0551c32d
RH
2885 [(set (match_operand:DF 0 "fr_register_operand" "=f")
2886 (smin:DF (match_operand:DF 1 "fr_register_operand" "f")
2887 (match_operand:DF 2 "fr_reg_or_fp01_operand" "fG")))]
c65ebc55 2888 ""
aebf2462 2889 "fmin %0 = %1, %F2"
52e12ad0 2890 [(set_attr "itanium_class" "fmisc")])
c65ebc55
JW
2891
2892(define_insn "maxdf3"
0551c32d
RH
2893 [(set (match_operand:DF 0 "fr_register_operand" "=f")
2894 (smax:DF (match_operand:DF 1 "fr_register_operand" "f")
2895 (match_operand:DF 2 "fr_reg_or_fp01_operand" "fG")))]
c65ebc55 2896 ""
aebf2462 2897 "fmax %0 = %1, %F2"
52e12ad0 2898 [(set_attr "itanium_class" "fmisc")])
c65ebc55 2899
655f2eb9 2900(define_insn "*madddf4"
0551c32d
RH
2901 [(set (match_operand:DF 0 "fr_register_operand" "=f")
2902 (plus:DF (mult:DF (match_operand:DF 1 "fr_register_operand" "f")
2903 (match_operand:DF 2 "fr_register_operand" "f"))
2904 (match_operand:DF 3 "fr_reg_or_fp01_operand" "fG")))]
c65ebc55 2905 ""
aebf2462 2906 "fma.d %0 = %1, %2, %F3"
52e12ad0 2907 [(set_attr "itanium_class" "fmac")])
c65ebc55 2908
26102535
RH
2909(define_insn "*madddf4_trunc"
2910 [(set (match_operand:SF 0 "fr_register_operand" "=f")
2911 (float_truncate:SF
2912 (plus:DF (mult:DF (match_operand:DF 1 "fr_register_operand" "f")
2913 (match_operand:DF 2 "fr_register_operand" "f"))
2914 (match_operand:DF 3 "fr_reg_or_fp01_operand" "fG"))))]
2915 ""
aebf2462 2916 "fma.s %0 = %1, %2, %F3"
52e12ad0 2917 [(set_attr "itanium_class" "fmac")])
26102535 2918
655f2eb9 2919(define_insn "*msubdf4"
0551c32d
RH
2920 [(set (match_operand:DF 0 "fr_register_operand" "=f")
2921 (minus:DF (mult:DF (match_operand:DF 1 "fr_register_operand" "f")
2922 (match_operand:DF 2 "fr_register_operand" "f"))
2923 (match_operand:DF 3 "fr_reg_or_fp01_operand" "fG")))]
c65ebc55 2924 ""
aebf2462 2925 "fms.d %0 = %1, %2, %F3"
52e12ad0 2926 [(set_attr "itanium_class" "fmac")])
c65ebc55 2927
26102535
RH
2928(define_insn "*msubdf4_trunc"
2929 [(set (match_operand:SF 0 "fr_register_operand" "=f")
2930 (float_truncate:SF
2931 (minus:DF (mult:DF (match_operand:DF 1 "fr_register_operand" "f")
2932 (match_operand:DF 2 "fr_register_operand" "f"))
2933 (match_operand:DF 3 "fr_reg_or_fp01_operand" "fG"))))]
2934 ""
aebf2462 2935 "fms.s %0 = %1, %2, %F3"
52e12ad0 2936 [(set_attr "itanium_class" "fmac")])
26102535 2937
c65ebc55 2938(define_insn "*nmuldf3"
0551c32d
RH
2939 [(set (match_operand:DF 0 "fr_register_operand" "=f")
2940 (neg:DF (mult:DF (match_operand:DF 1 "fr_register_operand" "f")
2941 (match_operand:DF 2 "fr_register_operand" "f"))))]
c65ebc55 2942 ""
aebf2462 2943 "fnmpy.d %0 = %1, %2"
52e12ad0 2944 [(set_attr "itanium_class" "fmac")])
c65ebc55 2945
26102535
RH
2946(define_insn "*nmuldf3_trunc"
2947 [(set (match_operand:SF 0 "fr_register_operand" "=f")
2948 (float_truncate:SF
2949 (neg:DF (mult:DF (match_operand:DF 1 "fr_register_operand" "f")
2950 (match_operand:DF 2 "fr_register_operand" "f")))))]
2951 ""
aebf2462 2952 "fnmpy.s %0 = %1, %2"
52e12ad0 2953 [(set_attr "itanium_class" "fmac")])
26102535 2954
c65ebc55
JW
2955;; ??? Is it possible to canonicalize this as (minus (reg) (mult))?
2956
655f2eb9 2957(define_insn "*nmadddf4"
0551c32d 2958 [(set (match_operand:DF 0 "fr_register_operand" "=f")
26102535
RH
2959 (plus:DF (neg:DF (mult:DF
2960 (match_operand:DF 1 "fr_register_operand" "f")
2961 (match_operand:DF 2 "fr_register_operand" "f")))
0551c32d 2962 (match_operand:DF 3 "fr_reg_or_fp01_operand" "fG")))]
c65ebc55 2963 ""
aebf2462 2964 "fnma.d %0 = %1, %2, %F3"
52e12ad0 2965 [(set_attr "itanium_class" "fmac")])
26102535
RH
2966
2967(define_insn "*nmadddf4_alts"
2968 [(set (match_operand:DF 0 "fr_register_operand" "=f")
2969 (plus:DF (neg:DF (mult:DF
2970 (match_operand:DF 1 "fr_register_operand" "f")
2971 (match_operand:DF 2 "fr_register_operand" "f")))
2972 (match_operand:DF 3 "fr_reg_or_fp01_operand" "fG")))
2973 (use (match_operand:SI 4 "const_int_operand" ""))]
2974 ""
aebf2462 2975 "fnma.d.s%4 %0 = %1, %2, %F3"
52e12ad0 2976 [(set_attr "itanium_class" "fmac")])
26102535
RH
2977
2978(define_insn "*nmadddf4_trunc"
2979 [(set (match_operand:SF 0 "fr_register_operand" "=f")
2980 (float_truncate:SF
2981 (plus:DF (neg:DF (mult:DF
2982 (match_operand:DF 1 "fr_register_operand" "f")
2983 (match_operand:DF 2 "fr_register_operand" "f")))
2984 (match_operand:DF 3 "fr_reg_or_fp01_operand" "fG"))))]
2985 ""
aebf2462 2986 "fnma.s %0 = %1, %2, %F3"
52e12ad0 2987 [(set_attr "itanium_class" "fmac")])
26102535
RH
2988
2989(define_expand "divdf3"
2990 [(set (match_operand:DF 0 "fr_register_operand" "")
2991 (div:DF (match_operand:DF 1 "fr_register_operand" "")
2992 (match_operand:DF 2 "fr_register_operand" "")))]
23c108af 2993 "INTEL_EXTENDED_IEEE_FORMAT && TARGET_INLINE_DIV"
26102535
RH
2994{
2995 rtx insn;
2996 if (TARGET_INLINE_DIV_LAT)
2997 insn = gen_divdf3_internal_lat (operands[0], operands[1], operands[2]);
2998 else
2999 insn = gen_divdf3_internal_thr (operands[0], operands[1], operands[2]);
3000 emit_insn (insn);
3001 DONE;
1d5d7a21 3002})
26102535
RH
3003
3004(define_insn_and_split "divdf3_internal_lat"
3005 [(set (match_operand:DF 0 "fr_register_operand" "=&f")
3006 (div:DF (match_operand:DF 1 "fr_register_operand" "f")
3007 (match_operand:DF 2 "fr_register_operand" "f")))
3008 (clobber (match_scratch:TF 3 "=&f"))
3009 (clobber (match_scratch:TF 4 "=&f"))
3010 (clobber (match_scratch:TF 5 "=&f"))
f2f90c63 3011 (clobber (match_scratch:BI 6 "=c"))]
23c108af 3012 "INTEL_EXTENDED_IEEE_FORMAT && TARGET_INLINE_DIV_LAT"
26102535
RH
3013 "#"
3014 "&& reload_completed"
3015 [(parallel [(set (match_dup 7) (div:TF (const_int 1) (match_dup 9)))
086c0f96
RH
3016 (set (match_dup 6) (unspec:BI [(match_dup 8) (match_dup 9)]
3017 UNSPEC_FR_RECIP_APPROX))
26102535
RH
3018 (use (const_int 1))])
3019 (cond_exec (ne (match_dup 6) (const_int 0))
3020 (parallel [(set (match_dup 3) (mult:TF (match_dup 8) (match_dup 7)))
3021 (use (const_int 1))]))
3022 (cond_exec (ne (match_dup 6) (const_int 0))
3023 (parallel [(set (match_dup 4)
3024 (plus:TF (neg:TF (mult:TF (match_dup 9) (match_dup 7)))
3025 (match_dup 12)))
3026 (use (const_int 1))]))
3027 (cond_exec (ne (match_dup 6) (const_int 0))
3028 (parallel [(set (match_dup 3)
3029 (plus:TF (mult:TF (match_dup 4) (match_dup 3))
3030 (match_dup 3)))
3031 (use (const_int 1))]))
3032 (cond_exec (ne (match_dup 6) (const_int 0))
3033 (parallel [(set (match_dup 5) (mult:TF (match_dup 4) (match_dup 4)))
3034 (use (const_int 1))]))
3035 (cond_exec (ne (match_dup 6) (const_int 0))
3036 (parallel [(set (match_dup 7)
3037 (plus:TF (mult:TF (match_dup 4) (match_dup 7))
3038 (match_dup 7)))
3039 (use (const_int 1))]))
3040 (cond_exec (ne (match_dup 6) (const_int 0))
3041 (parallel [(set (match_dup 3)
3042 (plus:TF (mult:TF (match_dup 5) (match_dup 3))
3043 (match_dup 3)))
3044 (use (const_int 1))]))
3045 (cond_exec (ne (match_dup 6) (const_int 0))
3046 (parallel [(set (match_dup 4) (mult:TF (match_dup 5) (match_dup 5)))
3047 (use (const_int 1))]))
3048 (cond_exec (ne (match_dup 6) (const_int 0))
3049 (parallel [(set (match_dup 7)
3050 (plus:TF (mult:TF (match_dup 5) (match_dup 7))
3051 (match_dup 7)))
3052 (use (const_int 1))]))
3053 (cond_exec (ne (match_dup 6) (const_int 0))
3054 (parallel [(set (match_dup 10)
3055 (float_truncate:DF
3056 (plus:TF (mult:TF (match_dup 4) (match_dup 3))
3057 (match_dup 3))))
3058 (use (const_int 1))]))
3059 (cond_exec (ne (match_dup 6) (const_int 0))
3060 (parallel [(set (match_dup 7)
3061 (plus:TF (mult:TF (match_dup 4) (match_dup 7))
3062 (match_dup 7)))
3063 (use (const_int 1))]))
3064 (cond_exec (ne (match_dup 6) (const_int 0))
3065 (parallel [(set (match_dup 11)
3066 (float_truncate:DF
3067 (plus:TF (neg:TF (mult:TF (match_dup 9) (match_dup 3)))
3068 (match_dup 8))))
3069 (use (const_int 1))]))
3070 (cond_exec (ne (match_dup 6) (const_int 0))
3071 (set (match_dup 0)
3072 (float_truncate:DF (plus:TF (mult:TF (match_dup 5) (match_dup 7))
3073 (match_dup 3)))))
3074 ]
1d5d7a21
RH
3075{
3076 operands[7] = gen_rtx_REG (TFmode, REGNO (operands[0]));
3077 operands[8] = gen_rtx_REG (TFmode, REGNO (operands[1]));
3078 operands[9] = gen_rtx_REG (TFmode, REGNO (operands[2]));
3079 operands[10] = gen_rtx_REG (DFmode, REGNO (operands[3]));
3080 operands[11] = gen_rtx_REG (DFmode, REGNO (operands[5]));
3081 operands[12] = CONST1_RTX (TFmode);
3082}
26102535
RH
3083 [(set_attr "predicable" "no")])
3084
3085(define_insn_and_split "divdf3_internal_thr"
3086 [(set (match_operand:DF 0 "fr_register_operand" "=&f")
3087 (div:DF (match_operand:DF 1 "fr_register_operand" "f")
3088 (match_operand:DF 2 "fr_register_operand" "f")))
3089 (clobber (match_scratch:TF 3 "=&f"))
3090 (clobber (match_scratch:DF 4 "=f"))
f2f90c63 3091 (clobber (match_scratch:BI 5 "=c"))]
23c108af 3092 "INTEL_EXTENDED_IEEE_FORMAT && TARGET_INLINE_DIV_THR"
26102535
RH
3093 "#"
3094 "&& reload_completed"
3095 [(parallel [(set (match_dup 6) (div:TF (const_int 1) (match_dup 8)))
086c0f96
RH
3096 (set (match_dup 5) (unspec:BI [(match_dup 7) (match_dup 8)]
3097 UNSPEC_FR_RECIP_APPROX))
26102535
RH
3098 (use (const_int 1))])
3099 (cond_exec (ne (match_dup 5) (const_int 0))
3100 (parallel [(set (match_dup 3)
3101 (plus:TF (neg:TF (mult:TF (match_dup 8) (match_dup 6)))
3102 (match_dup 10)))
3103 (use (const_int 1))]))
3104 (cond_exec (ne (match_dup 5) (const_int 0))
3105 (parallel [(set (match_dup 6)
3106 (plus:TF (mult:TF (match_dup 3) (match_dup 6))
3107 (match_dup 6)))
3108 (use (const_int 1))]))
3109 (cond_exec (ne (match_dup 5) (const_int 0))
3110 (parallel [(set (match_dup 3)
3111 (mult:TF (match_dup 3) (match_dup 3)))
3112 (use (const_int 1))]))
3113 (cond_exec (ne (match_dup 5) (const_int 0))
3114 (parallel [(set (match_dup 6)
3115 (plus:TF (mult:TF (match_dup 3) (match_dup 6))
3116 (match_dup 6)))
3117 (use (const_int 1))]))
3118 (cond_exec (ne (match_dup 5) (const_int 0))
3119 (parallel [(set (match_dup 3)
3120 (mult:TF (match_dup 3) (match_dup 3)))
3121 (use (const_int 1))]))
3122 (cond_exec (ne (match_dup 5) (const_int 0))
3123 (parallel [(set (match_dup 6)
3124 (plus:TF (mult:TF (match_dup 3) (match_dup 6))
3125 (match_dup 6)))
3126 (use (const_int 1))]))
3127 (cond_exec (ne (match_dup 5) (const_int 0))
3128 (parallel [(set (match_dup 9)
3129 (float_truncate:DF
3130 (mult:TF (match_dup 7) (match_dup 3))))
3131 (use (const_int 1))]))
3132 (cond_exec (ne (match_dup 5) (const_int 0))
3133 (parallel [(set (match_dup 4)
3134 (plus:DF (neg:DF (mult:DF (match_dup 2) (match_dup 9)))
3135 (match_dup 1)))
3136 (use (const_int 1))]))
3137 (cond_exec (ne (match_dup 5) (const_int 0))
3138 (set (match_dup 0)
3139 (plus:DF (mult:DF (match_dup 4) (match_dup 0))
3140 (match_dup 9))))
3141 ]
1d5d7a21
RH
3142{
3143 operands[6] = gen_rtx_REG (TFmode, REGNO (operands[0]));
3144 operands[7] = gen_rtx_REG (TFmode, REGNO (operands[1]));
3145 operands[8] = gen_rtx_REG (TFmode, REGNO (operands[2]));
3146 operands[9] = gen_rtx_REG (DFmode, REGNO (operands[3]));
3147 operands[10] = CONST1_RTX (TFmode);
3148}
26102535 3149 [(set_attr "predicable" "no")])
3f622353
RH
3150\f
3151;; ::::::::::::::::::::
3152;; ::
3153;; :: 80 bit floating point arithmetic
3154;; ::
3155;; ::::::::::::::::::::
3156
3157(define_insn "addtf3"
0551c32d 3158 [(set (match_operand:TF 0 "fr_register_operand" "=f")
3f622353
RH
3159 (plus:TF (match_operand:TF 1 "tfreg_or_fp01_operand" "fG")
3160 (match_operand:TF 2 "tfreg_or_fp01_operand" "fG")))]
23c108af 3161 "INTEL_EXTENDED_IEEE_FORMAT"
aebf2462 3162 "fadd %0 = %F1, %F2"
52e12ad0 3163 [(set_attr "itanium_class" "fmac")])
3f622353 3164
26102535
RH
3165(define_insn "*addtf3_truncsf"
3166 [(set (match_operand:SF 0 "fr_register_operand" "=f")
3167 (float_truncate:SF
3168 (plus:TF (match_operand:TF 1 "tfreg_or_fp01_operand" "fG")
3169 (match_operand:TF 2 "tfreg_or_fp01_operand" "fG"))))]
23c108af 3170 "INTEL_EXTENDED_IEEE_FORMAT"
aebf2462 3171 "fadd.s %0 = %F1, %F2"
52e12ad0 3172 [(set_attr "itanium_class" "fmac")])
26102535
RH
3173
3174(define_insn "*addtf3_truncdf"
3175 [(set (match_operand:DF 0 "fr_register_operand" "=f")
3176 (float_truncate:DF
3177 (plus:TF (match_operand:TF 1 "tfreg_or_fp01_operand" "fG")
3178 (match_operand:TF 2 "tfreg_or_fp01_operand" "fG"))))]
23c108af 3179 "INTEL_EXTENDED_IEEE_FORMAT"
aebf2462 3180 "fadd.d %0 = %F1, %F2"
52e12ad0 3181 [(set_attr "itanium_class" "fmac")])
26102535 3182
3f622353 3183(define_insn "subtf3"
0551c32d 3184 [(set (match_operand:TF 0 "fr_register_operand" "=f")
3f622353
RH
3185 (minus:TF (match_operand:TF 1 "tfreg_or_fp01_operand" "fG")
3186 (match_operand:TF 2 "tfreg_or_fp01_operand" "fG")))]
23c108af 3187 "INTEL_EXTENDED_IEEE_FORMAT"
aebf2462 3188 "fsub %0 = %F1, %F2"
52e12ad0 3189 [(set_attr "itanium_class" "fmac")])
3f622353 3190
26102535
RH
3191(define_insn "*subtf3_truncsf"
3192 [(set (match_operand:SF 0 "fr_register_operand" "=f")
3193 (float_truncate:SF
3194 (minus:TF (match_operand:TF 1 "tfreg_or_fp01_operand" "fG")
3195 (match_operand:TF 2 "tfreg_or_fp01_operand" "fG"))))]
23c108af 3196 "INTEL_EXTENDED_IEEE_FORMAT"
aebf2462 3197 "fsub.s %0 = %F1, %F2"
52e12ad0 3198 [(set_attr "itanium_class" "fmac")])
26102535
RH
3199
3200(define_insn "*subtf3_truncdf"
3201 [(set (match_operand:DF 0 "fr_register_operand" "=f")
3202 (float_truncate:DF
3203 (minus:TF (match_operand:TF 1 "tfreg_or_fp01_operand" "fG")
3204 (match_operand:TF 2 "tfreg_or_fp01_operand" "fG"))))]
23c108af 3205 "INTEL_EXTENDED_IEEE_FORMAT"
aebf2462 3206 "fsub.d %0 = %F1, %F2"
52e12ad0 3207 [(set_attr "itanium_class" "fmac")])
26102535 3208
3f622353 3209(define_insn "multf3"
0551c32d 3210 [(set (match_operand:TF 0 "fr_register_operand" "=f")
3f622353
RH
3211 (mult:TF (match_operand:TF 1 "tfreg_or_fp01_operand" "fG")
3212 (match_operand:TF 2 "tfreg_or_fp01_operand" "fG")))]
23c108af 3213 "INTEL_EXTENDED_IEEE_FORMAT"
aebf2462 3214 "fmpy %0 = %F1, %F2"
52e12ad0 3215 [(set_attr "itanium_class" "fmac")])
3f622353 3216
26102535
RH
3217(define_insn "*multf3_truncsf"
3218 [(set (match_operand:SF 0 "fr_register_operand" "=f")
3219 (float_truncate:SF
3220 (mult:TF (match_operand:TF 1 "tfreg_or_fp01_operand" "fG")
3221 (match_operand:TF 2 "tfreg_or_fp01_operand" "fG"))))]
23c108af 3222 "INTEL_EXTENDED_IEEE_FORMAT"
aebf2462 3223 "fmpy.s %0 = %F1, %F2"
52e12ad0 3224 [(set_attr "itanium_class" "fmac")])
26102535
RH
3225
3226(define_insn "*multf3_truncdf"
3227 [(set (match_operand:DF 0 "fr_register_operand" "=f")
3228 (float_truncate:DF
3229 (mult:TF (match_operand:TF 1 "tfreg_or_fp01_operand" "fG")
3230 (match_operand:TF 2 "tfreg_or_fp01_operand" "fG"))))]
23c108af 3231 "INTEL_EXTENDED_IEEE_FORMAT"
aebf2462 3232 "fmpy.d %0 = %F1, %F2"
52e12ad0 3233 [(set_attr "itanium_class" "fmac")])
26102535 3234
655f2eb9
RH
3235(define_insn "*multf3_alts"
3236 [(set (match_operand:TF 0 "fr_register_operand" "=f")
3237 (mult:TF (match_operand:TF 1 "tfreg_or_fp01_operand" "fG")
3238 (match_operand:TF 2 "tfreg_or_fp01_operand" "fG")))
3239 (use (match_operand:SI 3 "const_int_operand" ""))]
23c108af 3240 "INTEL_EXTENDED_IEEE_FORMAT"
aebf2462 3241 "fmpy.s%3 %0 = %F1, %F2"
52e12ad0 3242 [(set_attr "itanium_class" "fmac")])
655f2eb9 3243
26102535
RH
3244(define_insn "*multf3_truncsf_alts"
3245 [(set (match_operand:SF 0 "fr_register_operand" "=f")
3246 (float_truncate:SF
3247 (mult:TF (match_operand:TF 1 "tfreg_or_fp01_operand" "fG")
3248 (match_operand:TF 2 "tfreg_or_fp01_operand" "fG"))))
3249 (use (match_operand:SI 3 "const_int_operand" ""))]
23c108af 3250 "INTEL_EXTENDED_IEEE_FORMAT"
aebf2462 3251 "fmpy.s.s%3 %0 = %F1, %F2"
52e12ad0 3252 [(set_attr "itanium_class" "fmac")])
26102535
RH
3253
3254(define_insn "*multf3_truncdf_alts"
3255 [(set (match_operand:DF 0 "fr_register_operand" "=f")
3256 (float_truncate:DF
3257 (mult:TF (match_operand:TF 1 "tfreg_or_fp01_operand" "fG")
3258 (match_operand:TF 2 "tfreg_or_fp01_operand" "fG"))))
3259 (use (match_operand:SI 3 "const_int_operand" ""))]
23c108af 3260 "INTEL_EXTENDED_IEEE_FORMAT"
aebf2462 3261 "fmpy.d.s%3 %0 = %F1, %F2"
52e12ad0 3262 [(set_attr "itanium_class" "fmac")])
26102535 3263
3f622353 3264(define_insn "abstf2"
0551c32d 3265 [(set (match_operand:TF 0 "fr_register_operand" "=f")
3f622353 3266 (abs:TF (match_operand:TF 1 "tfreg_or_fp01_operand" "fG")))]
23c108af 3267 "INTEL_EXTENDED_IEEE_FORMAT"
aebf2462 3268 "fabs %0 = %F1"
52e12ad0 3269 [(set_attr "itanium_class" "fmisc")])
3f622353
RH
3270
3271(define_insn "negtf2"
0551c32d 3272 [(set (match_operand:TF 0 "fr_register_operand" "=f")
3f622353 3273 (neg:TF (match_operand:TF 1 "tfreg_or_fp01_operand" "fG")))]
23c108af 3274 "INTEL_EXTENDED_IEEE_FORMAT"
aebf2462 3275 "fneg %0 = %F1"
52e12ad0 3276 [(set_attr "itanium_class" "fmisc")])
3f622353
RH
3277
3278(define_insn "*nabstf2"
0551c32d 3279 [(set (match_operand:TF 0 "fr_register_operand" "=f")
3f622353 3280 (neg:TF (abs:TF (match_operand:TF 1 "tfreg_or_fp01_operand" "fG"))))]
23c108af 3281 "INTEL_EXTENDED_IEEE_FORMAT"
aebf2462 3282 "fnegabs %0 = %F1"
52e12ad0 3283 [(set_attr "itanium_class" "fmisc")])
3f622353
RH
3284
3285(define_insn "mintf3"
0551c32d 3286 [(set (match_operand:TF 0 "fr_register_operand" "=f")
3f622353
RH
3287 (smin:TF (match_operand:TF 1 "tfreg_or_fp01_operand" "fG")
3288 (match_operand:TF 2 "tfreg_or_fp01_operand" "fG")))]
23c108af 3289 "INTEL_EXTENDED_IEEE_FORMAT"
aebf2462 3290 "fmin %0 = %F1, %F2"
52e12ad0 3291 [(set_attr "itanium_class" "fmisc")])
3f622353
RH
3292
3293(define_insn "maxtf3"
0551c32d 3294 [(set (match_operand:TF 0 "fr_register_operand" "=f")
3f622353
RH
3295 (smax:TF (match_operand:TF 1 "tfreg_or_fp01_operand" "fG")
3296 (match_operand:TF 2 "tfreg_or_fp01_operand" "fG")))]
23c108af 3297 "INTEL_EXTENDED_IEEE_FORMAT"
aebf2462 3298 "fmax %0 = %F1, %F2"
52e12ad0 3299 [(set_attr "itanium_class" "fmisc")])
3f622353 3300
655f2eb9 3301(define_insn "*maddtf4"
0551c32d 3302 [(set (match_operand:TF 0 "fr_register_operand" "=f")
3f622353
RH
3303 (plus:TF (mult:TF (match_operand:TF 1 "tfreg_or_fp01_operand" "fG")
3304 (match_operand:TF 2 "tfreg_or_fp01_operand" "fG"))
3305 (match_operand:TF 3 "tfreg_or_fp01_operand" "fG")))]
23c108af 3306 "INTEL_EXTENDED_IEEE_FORMAT"
aebf2462 3307 "fma %0 = %F1, %F2, %F3"
52e12ad0 3308 [(set_attr "itanium_class" "fmac")])
3f622353 3309
26102535
RH
3310(define_insn "*maddtf4_truncsf"
3311 [(set (match_operand:SF 0 "fr_register_operand" "=f")
3312 (float_truncate:SF
3313 (plus:TF (mult:TF (match_operand:TF 1 "tfreg_or_fp01_operand" "fG")
3314 (match_operand:TF 2 "tfreg_or_fp01_operand" "fG"))
3315 (match_operand:TF 3 "tfreg_or_fp01_operand" "fG"))))]
23c108af 3316 "INTEL_EXTENDED_IEEE_FORMAT"
aebf2462 3317 "fma.s %0 = %F1, %F2, %F3"
52e12ad0 3318 [(set_attr "itanium_class" "fmac")])
26102535
RH
3319
3320(define_insn "*maddtf4_truncdf"
3321 [(set (match_operand:DF 0 "fr_register_operand" "=f")
3322 (float_truncate:DF
3323 (plus:TF (mult:TF (match_operand:TF 1 "tfreg_or_fp01_operand" "fG")
3324 (match_operand:TF 2 "tfreg_or_fp01_operand" "fG"))
3325 (match_operand:TF 3 "tfreg_or_fp01_operand" "fG"))))]
23c108af 3326 "INTEL_EXTENDED_IEEE_FORMAT"
aebf2462 3327 "fma.d %0 = %F1, %F2, %F3"
52e12ad0 3328 [(set_attr "itanium_class" "fmac")])
26102535 3329
655f2eb9
RH
3330(define_insn "*maddtf4_alts"
3331 [(set (match_operand:TF 0 "fr_register_operand" "=f")
3332 (plus:TF (mult:TF (match_operand:TF 1 "tfreg_or_fp01_operand" "fG")
3333 (match_operand:TF 2 "tfreg_or_fp01_operand" "fG"))
3334 (match_operand:TF 3 "tfreg_or_fp01_operand" "fG")))
3335 (use (match_operand:SI 4 "const_int_operand" ""))]
23c108af 3336 "INTEL_EXTENDED_IEEE_FORMAT"
aebf2462 3337 "fma.s%4 %0 = %F1, %F2, %F3"
52e12ad0 3338 [(set_attr "itanium_class" "fmac")])
655f2eb9 3339
26102535
RH
3340(define_insn "*maddtf4_alts_truncdf"
3341 [(set (match_operand:DF 0 "fr_register_operand" "=f")
3342 (float_truncate:DF
3343 (plus:TF (mult:TF (match_operand:TF 1 "tfreg_or_fp01_operand" "fG")
3344 (match_operand:TF 2 "tfreg_or_fp01_operand" "fG"))
3345 (match_operand:TF 3 "tfreg_or_fp01_operand" "fG"))))
3346 (use (match_operand:SI 4 "const_int_operand" ""))]
23c108af 3347 "INTEL_EXTENDED_IEEE_FORMAT"
aebf2462 3348 "fma.d.s%4 %0 = %F1, %F2, %F3"
52e12ad0 3349 [(set_attr "itanium_class" "fmac")])
26102535 3350
655f2eb9 3351(define_insn "*msubtf4"
0551c32d 3352 [(set (match_operand:TF 0 "fr_register_operand" "=f")
3f622353
RH
3353 (minus:TF (mult:TF (match_operand:TF 1 "tfreg_or_fp01_operand" "fG")
3354 (match_operand:TF 2 "tfreg_or_fp01_operand" "fG"))
3355 (match_operand:TF 3 "tfreg_or_fp01_operand" "fG")))]
23c108af 3356 "INTEL_EXTENDED_IEEE_FORMAT"
aebf2462 3357 "fms %0 = %F1, %F2, %F3"
52e12ad0 3358 [(set_attr "itanium_class" "fmac")])
3f622353 3359
26102535
RH
3360(define_insn "*msubtf4_truncsf"
3361 [(set (match_operand:SF 0 "fr_register_operand" "=f")
3362 (float_truncate:SF
3363 (minus:TF (mult:TF (match_operand:TF 1 "tfreg_or_fp01_operand" "fG")
3364 (match_operand:TF 2 "tfreg_or_fp01_operand" "fG"))
3365 (match_operand:TF 3 "tfreg_or_fp01_operand" "fG"))))]
23c108af 3366 "INTEL_EXTENDED_IEEE_FORMAT"
aebf2462 3367 "fms.s %0 = %F1, %F2, %F3"
52e12ad0 3368 [(set_attr "itanium_class" "fmac")])
26102535
RH
3369
3370(define_insn "*msubtf4_truncdf"
3371 [(set (match_operand:DF 0 "fr_register_operand" "=f")
3372 (float_truncate:DF
3373 (minus:TF (mult:TF (match_operand:TF 1 "tfreg_or_fp01_operand" "fG")
3374 (match_operand:TF 2 "tfreg_or_fp01_operand" "fG"))
3375 (match_operand:TF 3 "tfreg_or_fp01_operand" "fG"))))]
23c108af 3376 "INTEL_EXTENDED_IEEE_FORMAT"
aebf2462 3377 "fms.d %0 = %F1, %F2, %F3"
52e12ad0 3378 [(set_attr "itanium_class" "fmac")])
26102535 3379
3f622353 3380(define_insn "*nmultf3"
0551c32d 3381 [(set (match_operand:TF 0 "fr_register_operand" "=f")
3f622353
RH
3382 (neg:TF (mult:TF (match_operand:TF 1 "tfreg_or_fp01_operand" "fG")
3383 (match_operand:TF 2 "tfreg_or_fp01_operand" "fG"))))]
23c108af 3384 "INTEL_EXTENDED_IEEE_FORMAT"
aebf2462 3385 "fnmpy %0 = %F1, %F2"
52e12ad0 3386 [(set_attr "itanium_class" "fmac")])
c65ebc55 3387
26102535
RH
3388(define_insn "*nmultf3_truncsf"
3389 [(set (match_operand:SF 0 "fr_register_operand" "=f")
3390 (float_truncate:SF
3391 (neg:TF (mult:TF
3392 (match_operand:TF 1 "tfreg_or_fp01_operand" "fG")
3393 (match_operand:TF 2 "tfreg_or_fp01_operand" "fG")))))]
23c108af 3394 "INTEL_EXTENDED_IEEE_FORMAT"
aebf2462 3395 "fnmpy.s %0 = %F1, %F2"
52e12ad0 3396 [(set_attr "itanium_class" "fmac")])
26102535
RH
3397
3398(define_insn "*nmultf3_truncdf"
3399 [(set (match_operand:DF 0 "fr_register_operand" "=f")
3400 (float_truncate:DF
3401 (neg:TF (mult:TF
3402 (match_operand:TF 1 "tfreg_or_fp01_operand" "fG")
3403 (match_operand:TF 2 "tfreg_or_fp01_operand" "fG")))))]
23c108af 3404 "INTEL_EXTENDED_IEEE_FORMAT"
aebf2462 3405 "fnmpy.d %0 = %F1, %F2"
52e12ad0 3406 [(set_attr "itanium_class" "fmac")])
26102535 3407
3f622353
RH
3408;; ??? Is it possible to canonicalize this as (minus (reg) (mult))?
3409
655f2eb9 3410(define_insn "*nmaddtf4"
0551c32d 3411 [(set (match_operand:TF 0 "fr_register_operand" "=f")
3f622353
RH
3412 (plus:TF (neg:TF (mult:TF
3413 (match_operand:TF 1 "tfreg_or_fp01_operand" "fG")
3414 (match_operand:TF 2 "tfreg_or_fp01_operand" "fG")))
3415 (match_operand:TF 3 "tfreg_or_fp01_operand" "fG")))]
23c108af 3416 "INTEL_EXTENDED_IEEE_FORMAT"
aebf2462 3417 "fnma %0 = %F1, %F2, %F3"
52e12ad0 3418 [(set_attr "itanium_class" "fmac")])
655f2eb9 3419
26102535
RH
3420(define_insn "*nmaddtf4_truncsf"
3421 [(set (match_operand:SF 0 "fr_register_operand" "=f")
3422 (float_truncate:SF
3423 (plus:TF (neg:TF (mult:TF
3424 (match_operand:TF 1 "tfreg_or_fp01_operand" "fG")
3425 (match_operand:TF 2 "tfreg_or_fp01_operand" "fG")))
3426 (match_operand:TF 3 "tfreg_or_fp01_operand" "fG"))))]
23c108af 3427 "INTEL_EXTENDED_IEEE_FORMAT"
aebf2462 3428 "fnma.s %0 = %F1, %F2, %F3"
52e12ad0 3429 [(set_attr "itanium_class" "fmac")])
26102535
RH
3430
3431(define_insn "*nmaddtf4_truncdf"
3432 [(set (match_operand:DF 0 "fr_register_operand" "=f")
3433 (float_truncate:DF
3434 (plus:TF (neg:TF (mult:TF
3435 (match_operand:TF 1 "tfreg_or_fp01_operand" "fG")
3436 (match_operand:TF 2 "tfreg_or_fp01_operand" "fG")))
3437 (match_operand:TF 3 "tfreg_or_fp01_operand" "fG"))))]
23c108af 3438 "INTEL_EXTENDED_IEEE_FORMAT"
aebf2462 3439 "fnma.d %0 = %F1, %F2, %F3"
52e12ad0 3440 [(set_attr "itanium_class" "fmac")])
26102535 3441
655f2eb9
RH
3442(define_insn "*nmaddtf4_alts"
3443 [(set (match_operand:TF 0 "fr_register_operand" "=f")
3444 (plus:TF (neg:TF (mult:TF
3445 (match_operand:TF 1 "tfreg_or_fp01_operand" "fG")
3446 (match_operand:TF 2 "tfreg_or_fp01_operand" "fG")))
3447 (match_operand:TF 3 "tfreg_or_fp01_operand" "fG")))
3448 (use (match_operand:SI 4 "const_int_operand" ""))]
23c108af 3449 "INTEL_EXTENDED_IEEE_FORMAT"
aebf2462 3450 "fnma.s%4 %0 = %F1, %F2, %F3"
52e12ad0 3451 [(set_attr "itanium_class" "fmac")])
655f2eb9 3452
26102535
RH
3453(define_insn "*nmaddtf4_truncdf_alts"
3454 [(set (match_operand:DF 0 "fr_register_operand" "=f")
3455 (float_truncate:DF
3456 (plus:TF (neg:TF
3457 (mult:TF
3458 (match_operand:TF 1 "tfreg_or_fp01_operand" "fG")
3459 (match_operand:TF 2 "tfreg_or_fp01_operand" "fG")))
3460 (match_operand:TF 3 "tfreg_or_fp01_operand" "fG"))))
3461 (use (match_operand:SI 4 "const_int_operand" ""))]
23c108af 3462 "INTEL_EXTENDED_IEEE_FORMAT"
aebf2462 3463 "fnma.d.s%4 %0 = %F1, %F2, %F3"
52e12ad0 3464 [(set_attr "itanium_class" "fmac")])
26102535
RH
3465
3466(define_expand "divtf3"
3467 [(set (match_operand:TF 0 "fr_register_operand" "")
3468 (div:TF (match_operand:TF 1 "fr_register_operand" "")
3469 (match_operand:TF 2 "fr_register_operand" "")))]
23c108af 3470 "INTEL_EXTENDED_IEEE_FORMAT && TARGET_INLINE_DIV"
26102535
RH
3471{
3472 rtx insn;
3473 if (TARGET_INLINE_DIV_LAT)
3474 insn = gen_divtf3_internal_lat (operands[0], operands[1], operands[2]);
3475 else
3476 insn = gen_divtf3_internal_thr (operands[0], operands[1], operands[2]);
3477 emit_insn (insn);
3478 DONE;
1d5d7a21 3479})
26102535
RH
3480
3481(define_insn_and_split "divtf3_internal_lat"
3482 [(set (match_operand:TF 0 "fr_register_operand" "=&f")
3483 (div:TF (match_operand:TF 1 "fr_register_operand" "f")
3484 (match_operand:TF 2 "fr_register_operand" "f")))
3485 (clobber (match_scratch:TF 3 "=&f"))
3486 (clobber (match_scratch:TF 4 "=&f"))
3487 (clobber (match_scratch:TF 5 "=&f"))
3488 (clobber (match_scratch:TF 6 "=&f"))
f2f90c63 3489 (clobber (match_scratch:BI 7 "=c"))]
23c108af 3490 "INTEL_EXTENDED_IEEE_FORMAT && TARGET_INLINE_DIV_LAT"
26102535
RH
3491 "#"
3492 "&& reload_completed"
3493 [(parallel [(set (match_dup 0) (div:TF (const_int 1) (match_dup 2)))
086c0f96
RH
3494 (set (match_dup 7) (unspec:BI [(match_dup 1) (match_dup 2)]
3495 UNSPEC_FR_RECIP_APPROX))
26102535
RH
3496 (use (const_int 1))])
3497 (cond_exec (ne (match_dup 7) (const_int 0))
3498 (parallel [(set (match_dup 3)
3499 (plus:TF (neg:TF (mult:TF (match_dup 2) (match_dup 0)))
3500 (match_dup 8)))
3501 (use (const_int 1))]))
3502 (cond_exec (ne (match_dup 7) (const_int 0))
3503 (parallel [(set (match_dup 4) (mult:TF (match_dup 1) (match_dup 0)))
3504 (use (const_int 1))]))
3505 (cond_exec (ne (match_dup 7) (const_int 0))
3506 (parallel [(set (match_dup 5) (mult:TF (match_dup 3) (match_dup 3)))
3507 (use (const_int 1))]))
3508 (cond_exec (ne (match_dup 7) (const_int 0))
3509 (parallel [(set (match_dup 6)
3510 (plus:TF (mult:TF (match_dup 3) (match_dup 3))
3511 (match_dup 3)))
3512 (use (const_int 1))]))
3513 (cond_exec (ne (match_dup 7) (const_int 0))
3514 (parallel [(set (match_dup 3)
3515 (plus:TF (mult:TF (match_dup 5) (match_dup 5))
3516 (match_dup 3)))
3517 (use (const_int 1))]))
3518 (cond_exec (ne (match_dup 7) (const_int 0))
3519 (parallel [(set (match_dup 5)
3520 (plus:TF (mult:TF (match_dup 6) (match_dup 0))
3521 (match_dup 0)))
3522 (use (const_int 1))]))
3523 (cond_exec (ne (match_dup 7) (const_int 0))
3524 (parallel [(set (match_dup 0)
3525 (plus:TF (mult:TF (match_dup 5) (match_dup 3))
3526 (match_dup 0)))
3527 (use (const_int 1))]))
3528 (cond_exec (ne (match_dup 7) (const_int 0))
3529 (parallel [(set (match_dup 4)
3530 (plus:TF (neg:TF (mult:TF (match_dup 2) (match_dup 4)))
3531 (match_dup 1)))
3532 (use (const_int 1))]))
3533 (cond_exec (ne (match_dup 7) (const_int 0))
3534 (parallel [(set (match_dup 3)
3535 (plus:TF (mult:TF (match_dup 3) (match_dup 0))
3536 (match_dup 4)))
3537 (use (const_int 1))]))
3538 (cond_exec (ne (match_dup 7) (const_int 0))
3539 (parallel [(set (match_dup 5)
3540 (plus:TF (neg:TF (mult:TF (match_dup 2) (match_dup 0)))
3541 (match_dup 8)))
3542 (use (const_int 1))]))
3543 (cond_exec (ne (match_dup 7) (const_int 0))
3544 (parallel [(set (match_dup 0)
3545 (plus:TF (mult:TF (match_dup 4) (match_dup 0))
3546 (match_dup 0)))
3547 (use (const_int 1))]))
3548 (cond_exec (ne (match_dup 7) (const_int 0))
3549 (parallel [(set (match_dup 4)
3550 (plus:TF (neg:TF (mult:TF (match_dup 2) (match_dup 3)))
3551 (match_dup 1)))
3552 (use (const_int 1))]))
3553 (cond_exec (ne (match_dup 7) (const_int 0))
3554 (set (match_dup 0)
3555 (plus:TF (mult:TF (match_dup 4) (match_dup 0))
3556 (match_dup 3))))
3557 ]
3558 "operands[8] = CONST1_RTX (TFmode);"
3559 [(set_attr "predicable" "no")])
3560
3561(define_insn_and_split "divtf3_internal_thr"
3562 [(set (match_operand:TF 0 "fr_register_operand" "=&f")
3563 (div:TF (match_operand:TF 1 "fr_register_operand" "f")
3564 (match_operand:TF 2 "fr_register_operand" "f")))
3565 (clobber (match_scratch:TF 3 "=&f"))
3566 (clobber (match_scratch:TF 4 "=&f"))
f2f90c63 3567 (clobber (match_scratch:BI 5 "=c"))]
23c108af 3568 "INTEL_EXTENDED_IEEE_FORMAT && TARGET_INLINE_DIV_THR"
26102535
RH
3569 "#"
3570 "&& reload_completed"
3571 [(parallel [(set (match_dup 0) (div:TF (const_int 1) (match_dup 2)))
086c0f96
RH
3572 (set (match_dup 5) (unspec:BI [(match_dup 1) (match_dup 2)]
3573 UNSPEC_FR_RECIP_APPROX))
26102535
RH
3574 (use (const_int 1))])
3575 (cond_exec (ne (match_dup 5) (const_int 0))
3576 (parallel [(set (match_dup 3)
3577 (plus:TF (neg:TF (mult:TF (match_dup 2) (match_dup 0)))
3578 (match_dup 6)))
3579 (use (const_int 1))]))
3580 (cond_exec (ne (match_dup 5) (const_int 0))
3581 (parallel [(set (match_dup 4)
3582 (plus:TF (mult:TF (match_dup 3) (match_dup 0))
3583 (match_dup 0)))
3584 (use (const_int 1))]))
3585 (cond_exec (ne (match_dup 5) (const_int 0))
3586 (parallel [(set (match_dup 3) (mult:TF (match_dup 3) (match_dup 3)))
3587 (use (const_int 1))]))
3588 (cond_exec (ne (match_dup 5) (const_int 0))
3589 (parallel [(set (match_dup 3)
3590 (plus:TF (mult:TF (match_dup 3) (match_dup 4))
3591 (match_dup 4)))
3592 (use (const_int 1))]))
3593 (cond_exec (ne (match_dup 5) (const_int 0))
3594 (parallel [(set (match_dup 4) (mult:TF (match_dup 1) (match_dup 0)))
3595 (use (const_int 1))]))
3596 (cond_exec (ne (match_dup 5) (const_int 0))
3597 (parallel [(set (match_dup 0)
3598 (plus:TF (neg:TF (mult:TF (match_dup 2) (match_dup 3)))
3599 (match_dup 6)))
3600 (use (const_int 1))]))
3601 (cond_exec (ne (match_dup 5) (const_int 0))
3602 (parallel [(set (match_dup 0)
3603 (plus:TF (mult:TF (match_dup 0) (match_dup 3))
3604 (match_dup 3)))
3605 (use (const_int 1))]))
3606 (cond_exec (ne (match_dup 5) (const_int 0))
3607 (parallel [(set (match_dup 3)
3608 (plus:TF (neg:TF (mult:TF (match_dup 2) (match_dup 4)))
3609 (match_dup 1)))
3610 (use (const_int 1))]))
3611 (cond_exec (ne (match_dup 5) (const_int 0))
3612 (parallel [(set (match_dup 3)
3613 (plus:TF (mult:TF (match_dup 3) (match_dup 0))
3614 (match_dup 4)))
3615 (use (const_int 1))]))
3616 (cond_exec (ne (match_dup 5) (const_int 0))
3617 (parallel [(set (match_dup 4)
3618 (plus:TF (neg:TF (mult:TF (match_dup 2) (match_dup 0)))
3619 (match_dup 6)))
3620 (use (const_int 1))]))
3621 (cond_exec (ne (match_dup 5) (const_int 0))
3622 (parallel [(set (match_dup 0)
3623 (plus:TF (mult:TF (match_dup 4) (match_dup 0))
3624 (match_dup 0)))
3625 (use (const_int 1))]))
3626 (cond_exec (ne (match_dup 5) (const_int 0))
3627 (parallel [(set (match_dup 4)
3628 (plus:TF (neg:TF (mult:TF (match_dup 2) (match_dup 3)))
3629 (match_dup 1)))
3630 (use (const_int 1))]))
3631 (cond_exec (ne (match_dup 5) (const_int 0))
3632 (set (match_dup 0)
3633 (plus:TF (mult:TF (match_dup 4) (match_dup 0))
3634 (match_dup 3))))
3635 ]
3636 "operands[6] = CONST1_RTX (TFmode);"
3637 [(set_attr "predicable" "no")])
3638
3639;; ??? frcpa works like cmp.foo.unc.
3640
655f2eb9
RH
3641(define_insn "*recip_approx"
3642 [(set (match_operand:TF 0 "fr_register_operand" "=f")
3643 (div:TF (const_int 1)
3644 (match_operand:TF 3 "fr_register_operand" "f")))
f2f90c63
RH
3645 (set (match_operand:BI 1 "register_operand" "=c")
3646 (unspec:BI [(match_operand:TF 2 "fr_register_operand" "f")
086c0f96 3647 (match_dup 3)] UNSPEC_FR_RECIP_APPROX))
655f2eb9 3648 (use (match_operand:SI 4 "const_int_operand" ""))]
23c108af 3649 "INTEL_EXTENDED_IEEE_FORMAT"
655f2eb9 3650 "frcpa.s%4 %0, %1 = %2, %3"
52e12ad0 3651 [(set_attr "itanium_class" "fmisc")
26102535 3652 (set_attr "predicable" "no")])
c65ebc55
JW
3653\f
3654;; ::::::::::::::::::::
3655;; ::
3656;; :: 32 bit Integer Shifts and Rotates
3657;; ::
3658;; ::::::::::::::::::::
3659
9c668921 3660(define_expand "ashlsi3"
0551c32d
RH
3661 [(set (match_operand:SI 0 "gr_register_operand" "")
3662 (ashift:SI (match_operand:SI 1 "gr_register_operand" "")
3663 (match_operand:SI 2 "gr_reg_or_5bit_operand" "")))]
9c668921 3664 ""
9c668921
RH
3665{
3666 if (GET_CODE (operands[2]) != CONST_INT)
3667 {
3668 /* Why oh why didn't Intel arrange for SHIFT_COUNT_TRUNCATED? Now
3669 we've got to get rid of stray bits outside the SImode register. */
3670 rtx subshift = gen_reg_rtx (DImode);
3671 emit_insn (gen_zero_extendsidi2 (subshift, operands[2]));
3672 operands[2] = subshift;
3673 }
1d5d7a21 3674})
9c668921
RH
3675
3676(define_insn "*ashlsi3_internal"
0551c32d
RH
3677 [(set (match_operand:SI 0 "gr_register_operand" "=r,r,r")
3678 (ashift:SI (match_operand:SI 1 "gr_register_operand" "r,r,r")
3679 (match_operand:DI 2 "gr_reg_or_5bit_operand" "R,n,r")))]
c65ebc55 3680 ""
041f25e6
RH
3681 "@
3682 shladd %0 = %1, %2, r0
3683 dep.z %0 = %1, %2, %E2
3684 shl %0 = %1, %2"
52e12ad0 3685 [(set_attr "itanium_class" "ialu,ishf,mmshf")])
c65ebc55
JW
3686
3687(define_expand "ashrsi3"
0551c32d
RH
3688 [(set (match_operand:SI 0 "gr_register_operand" "")
3689 (ashiftrt:SI (match_operand:SI 1 "gr_register_operand" "")
3690 (match_operand:SI 2 "gr_reg_or_5bit_operand" "")))]
c65ebc55 3691 ""
c65ebc55 3692{
041f25e6
RH
3693 rtx subtarget = gen_reg_rtx (DImode);
3694 if (GET_CODE (operands[2]) == CONST_INT)
3695 emit_insn (gen_extv (subtarget, gen_lowpart (DImode, operands[1]),
3696 GEN_INT (32 - INTVAL (operands[2])), operands[2]));
3697 else
3698 {
9c668921 3699 rtx subshift = gen_reg_rtx (DImode);
041f25e6 3700 emit_insn (gen_extendsidi2 (subtarget, operands[1]));
9c668921
RH
3701 emit_insn (gen_zero_extendsidi2 (subshift, operands[2]));
3702 emit_insn (gen_ashrdi3 (subtarget, subtarget, subshift));
041f25e6
RH
3703 }
3704 emit_move_insn (gen_lowpart (DImode, operands[0]), subtarget);
3705 DONE;
1d5d7a21 3706})
c65ebc55 3707
c65ebc55 3708(define_expand "lshrsi3"
0551c32d
RH
3709 [(set (match_operand:SI 0 "gr_register_operand" "")
3710 (lshiftrt:SI (match_operand:SI 1 "gr_register_operand" "")
3711 (match_operand:SI 2 "gr_reg_or_5bit_operand" "")))]
c65ebc55 3712 ""
c65ebc55 3713{
041f25e6
RH
3714 rtx subtarget = gen_reg_rtx (DImode);
3715 if (GET_CODE (operands[2]) == CONST_INT)
3716 emit_insn (gen_extzv (subtarget, gen_lowpart (DImode, operands[1]),
3717 GEN_INT (32 - INTVAL (operands[2])), operands[2]));
3718 else
3719 {
9c668921 3720 rtx subshift = gen_reg_rtx (DImode);
041f25e6 3721 emit_insn (gen_zero_extendsidi2 (subtarget, operands[1]));
9c668921
RH
3722 emit_insn (gen_zero_extendsidi2 (subshift, operands[2]));
3723 emit_insn (gen_lshrdi3 (subtarget, subtarget, subshift));
041f25e6
RH
3724 }
3725 emit_move_insn (gen_lowpart (DImode, operands[0]), subtarget);
3726 DONE;
1d5d7a21 3727})
c65ebc55 3728
c65ebc55 3729;; Use mix4.r/shr to implement rotrsi3. We only get 32 bits of valid result
66db6b45
RH
3730;; here, instead of 64 like the patterns above. Keep the pattern together
3731;; until after combine; otherwise it won't get matched often.
c65ebc55
JW
3732
3733(define_expand "rotrsi3"
66db6b45
RH
3734 [(set (match_operand:SI 0 "gr_register_operand" "")
3735 (rotatert:SI (match_operand:SI 1 "gr_register_operand" "")
3736 (match_operand:SI 2 "gr_reg_or_5bit_operand" "")))]
3737 ""
66db6b45
RH
3738{
3739 if (GET_MODE (operands[2]) != VOIDmode)
3740 {
3741 rtx tmp = gen_reg_rtx (DImode);
3742 emit_insn (gen_zero_extendsidi2 (tmp, operands[2]));
3743 operands[2] = tmp;
3744 }
1d5d7a21 3745})
66db6b45
RH
3746
3747(define_insn_and_split "*rotrsi3_internal"
3748 [(set (match_operand:SI 0 "gr_register_operand" "=&r")
3749 (rotatert:SI (match_operand:SI 1 "gr_register_operand" "r")
3750 (match_operand:DI 2 "gr_reg_or_5bit_operand" "rM")))]
3751 ""
3752 "#"
3753 "reload_completed"
c65ebc55 3754 [(set (match_dup 3)
66db6b45 3755 (ior:DI (zero_extend:DI (match_dup 1))
c65ebc55
JW
3756 (ashift:DI (zero_extend:DI (match_dup 1)) (const_int 32))))
3757 (set (match_dup 3)
66db6b45
RH
3758 (lshiftrt:DI (match_dup 3) (match_dup 2)))]
3759 "operands[3] = gen_rtx_REG (DImode, REGNO (operands[0]));")
3760
3761(define_expand "rotlsi3"
3762 [(set (match_operand:SI 0 "gr_register_operand" "")
3763 (rotate:SI (match_operand:SI 1 "gr_register_operand" "")
3764 (match_operand:SI 2 "gr_reg_or_5bit_operand" "")))]
c65ebc55 3765 ""
c65ebc55
JW
3766{
3767 if (! shift_32bit_count_operand (operands[2], SImode))
66db6b45
RH
3768 {
3769 rtx tmp = gen_reg_rtx (SImode);
3770 emit_insn (gen_subsi3 (tmp, GEN_INT (32), operands[2]));
3771 emit_insn (gen_rotrsi3 (operands[0], operands[1], tmp));
3772 DONE;
3773 }
1d5d7a21 3774})
66db6b45
RH
3775
3776(define_insn_and_split "*rotlsi3_internal"
3777 [(set (match_operand:SI 0 "gr_register_operand" "=r")
3778 (rotate:SI (match_operand:SI 1 "gr_register_operand" "r")
3779 (match_operand:SI 2 "shift_32bit_count_operand" "n")))]
3780 ""
3781 "#"
3782 "reload_completed"
3783 [(set (match_dup 3)
3784 (ior:DI (zero_extend:DI (match_dup 1))
3785 (ashift:DI (zero_extend:DI (match_dup 1)) (const_int 32))))
3786 (set (match_dup 3)
3787 (lshiftrt:DI (match_dup 3) (match_dup 2)))]
1d5d7a21
RH
3788{
3789 operands[3] = gen_rtx_REG (DImode, REGNO (operands[0]));
3790 operands[2] = GEN_INT (32 - INTVAL (operands[2]));
3791})
c65ebc55
JW
3792\f
3793;; ::::::::::::::::::::
3794;; ::
3795;; :: 64 bit Integer Shifts and Rotates
3796;; ::
3797;; ::::::::::::::::::::
3798
3799(define_insn "ashldi3"
52e12ad0
BS
3800 [(set (match_operand:DI 0 "gr_register_operand" "=r,r,r")
3801 (ashift:DI (match_operand:DI 1 "gr_register_operand" "r,r,r")
3802 (match_operand:DI 2 "gr_reg_or_6bit_operand" "R,r,rM")))]
c65ebc55 3803 ""
041f25e6
RH
3804 "@
3805 shladd %0 = %1, %2, r0
52e12ad0 3806 shl %0 = %1, %2
041f25e6 3807 shl %0 = %1, %2"
52e12ad0 3808 [(set_attr "itanium_class" "ialu,mmshf,mmshfi")])
c65ebc55
JW
3809
3810;; ??? Maybe combine this with the multiply and add instruction?
3811
3812(define_insn "*shladd"
0551c32d
RH
3813 [(set (match_operand:DI 0 "gr_register_operand" "=r")
3814 (plus:DI (mult:DI (match_operand:DI 1 "gr_register_operand" "r")
c65ebc55 3815 (match_operand:DI 2 "shladd_operand" "n"))
0551c32d 3816 (match_operand:DI 3 "gr_register_operand" "r")))]
c65ebc55
JW
3817 ""
3818 "shladd %0 = %1, %S2, %3"
52e12ad0 3819 [(set_attr "itanium_class" "ialu")])
c65ebc55
JW
3820
3821;; This can be created by register elimination if operand3 of shladd is an
3822;; eliminable register or has reg_equiv_constant set.
3823
3824;; We have to use nonmemory_operand for operand 4, to ensure that the
3825;; validate_changes call inside eliminate_regs will always succeed. If it
3826;; doesn't succeed, then this remain a shladd pattern, and will be reloaded
3827;; incorrectly.
3828
5527bf14 3829(define_insn_and_split "*shladd_elim"
0551c32d
RH
3830 [(set (match_operand:DI 0 "gr_register_operand" "=&r")
3831 (plus:DI (plus:DI (mult:DI (match_operand:DI 1 "gr_register_operand" "r")
c65ebc55 3832 (match_operand:DI 2 "shladd_operand" "n"))
5527bf14 3833 (match_operand:DI 3 "nonmemory_operand" "r"))
c65ebc55
JW
3834 (match_operand:DI 4 "nonmemory_operand" "rI")))]
3835 "reload_in_progress"
5527bf14 3836 "* abort ();"
c65ebc55
JW
3837 "reload_completed"
3838 [(set (match_dup 0) (plus:DI (mult:DI (match_dup 1) (match_dup 2))
3839 (match_dup 3)))
c65ebc55 3840 (set (match_dup 0) (plus:DI (match_dup 0) (match_dup 4)))]
5527bf14 3841 ""
52e12ad0 3842 [(set_attr "itanium_class" "unknown")])
c65ebc55
JW
3843
3844(define_insn "ashrdi3"
52e12ad0
BS
3845 [(set (match_operand:DI 0 "gr_register_operand" "=r,r")
3846 (ashiftrt:DI (match_operand:DI 1 "gr_register_operand" "r,r")
3847 (match_operand:DI 2 "gr_reg_or_6bit_operand" "r,rM")))]
c65ebc55 3848 ""
52e12ad0
BS
3849 "@
3850 shr %0 = %1, %2
3851 shr %0 = %1, %2"
3852 [(set_attr "itanium_class" "mmshf,mmshfi")])
c65ebc55
JW
3853
3854(define_insn "lshrdi3"
52e12ad0
BS
3855 [(set (match_operand:DI 0 "gr_register_operand" "=r,r")
3856 (lshiftrt:DI (match_operand:DI 1 "gr_register_operand" "r,r")
3857 (match_operand:DI 2 "gr_reg_or_6bit_operand" "r,rM")))]
c65ebc55 3858 ""
52e12ad0
BS
3859 "@
3860 shr.u %0 = %1, %2
3861 shr.u %0 = %1, %2"
3862 [(set_attr "itanium_class" "mmshf,mmshfi")])
c65ebc55
JW
3863
3864;; Using a predicate that accepts only constants doesn't work, because optabs
3865;; will load the operand into a register and call the pattern if the predicate
3866;; did not accept it on the first try. So we use nonmemory_operand and then
3867;; verify that we have an appropriate constant in the expander.
3868
3869(define_expand "rotrdi3"
0551c32d
RH
3870 [(set (match_operand:DI 0 "gr_register_operand" "")
3871 (rotatert:DI (match_operand:DI 1 "gr_register_operand" "")
c65ebc55
JW
3872 (match_operand:DI 2 "nonmemory_operand" "")))]
3873 ""
c65ebc55
JW
3874{
3875 if (! shift_count_operand (operands[2], DImode))
3876 FAIL;
1d5d7a21 3877})
c65ebc55
JW
3878
3879(define_insn "*rotrdi3_internal"
0551c32d
RH
3880 [(set (match_operand:DI 0 "gr_register_operand" "=r")
3881 (rotatert:DI (match_operand:DI 1 "gr_register_operand" "r")
c65ebc55
JW
3882 (match_operand:DI 2 "shift_count_operand" "M")))]
3883 ""
3884 "shrp %0 = %1, %1, %2"
52e12ad0 3885 [(set_attr "itanium_class" "ishf")])
c65ebc55 3886
66db6b45
RH
3887(define_expand "rotldi3"
3888 [(set (match_operand:DI 0 "gr_register_operand" "")
3889 (rotate:DI (match_operand:DI 1 "gr_register_operand" "")
3890 (match_operand:DI 2 "nonmemory_operand" "")))]
3891 ""
66db6b45
RH
3892{
3893 if (! shift_count_operand (operands[2], DImode))
3894 FAIL;
1d5d7a21 3895})
66db6b45
RH
3896
3897(define_insn "*rotldi3_internal"
3898 [(set (match_operand:DI 0 "gr_register_operand" "=r")
3899 (rotate:DI (match_operand:DI 1 "gr_register_operand" "r")
3900 (match_operand:DI 2 "shift_count_operand" "M")))]
3901 ""
3902 "shrp %0 = %1, %1, %e2"
52e12ad0 3903 [(set_attr "itanium_class" "ishf")])
c65ebc55
JW
3904\f
3905;; ::::::::::::::::::::
3906;; ::
058557c4 3907;; :: 32 bit Integer Logical operations
c65ebc55
JW
3908;; ::
3909;; ::::::::::::::::::::
3910
3911;; We don't seem to need any other 32-bit logical operations, because gcc
3912;; generates zero-extend;zero-extend;DImode-op, which combine optimizes to
3913;; DImode-op;zero-extend, and then we can optimize away the zero-extend.
3914;; This doesn't work for unary logical operations, because we don't call
3915;; apply_distributive_law for them.
3916
3917;; ??? Likewise, this doesn't work for andnot, which isn't handled by
3918;; apply_distributive_law. We get inefficient code for
3919;; int sub4 (int i, int j) { return i & ~j; }
3920;; We could convert (and (not (sign_extend A)) (sign_extend B)) to
3921;; (zero_extend (and (not A) B)) in combine.
3922;; Or maybe fix this by adding andsi3/iorsi3/xorsi3 patterns like the
3923;; one_cmplsi2 pattern.
3924
058557c4 3925(define_insn "one_cmplsi2"
0551c32d
RH
3926 [(set (match_operand:SI 0 "gr_register_operand" "=r")
3927 (not:SI (match_operand:SI 1 "gr_register_operand" "r")))]
c65ebc55
JW
3928 ""
3929 "andcm %0 = -1, %1"
52e12ad0 3930 [(set_attr "itanium_class" "ilog")])
c65ebc55
JW
3931\f
3932;; ::::::::::::::::::::
3933;; ::
058557c4 3934;; :: 64 bit Integer Logical operations
c65ebc55
JW
3935;; ::
3936;; ::::::::::::::::::::
3937
3938(define_insn "anddi3"
0551c32d
RH
3939 [(set (match_operand:DI 0 "grfr_register_operand" "=r,*f")
3940 (and:DI (match_operand:DI 1 "grfr_register_operand" "%r,*f")
3941 (match_operand:DI 2 "grfr_reg_or_8bit_operand" "rK,*f")))]
c65ebc55
JW
3942 ""
3943 "@
3944 and %0 = %2, %1
aebf2462 3945 fand %0 = %2, %1"
52e12ad0 3946 [(set_attr "itanium_class" "ilog,fmisc")])
c65ebc55
JW
3947
3948(define_insn "*andnot"
0551c32d
RH
3949 [(set (match_operand:DI 0 "grfr_register_operand" "=r,*f")
3950 (and:DI (not:DI (match_operand:DI 1 "grfr_register_operand" "r,*f"))
3951 (match_operand:DI 2 "grfr_reg_or_8bit_operand" "rK,*f")))]
c65ebc55
JW
3952 ""
3953 "@
3954 andcm %0 = %2, %1
aebf2462 3955 fandcm %0 = %2, %1"
52e12ad0 3956 [(set_attr "itanium_class" "ilog,fmisc")])
c65ebc55
JW
3957
3958(define_insn "iordi3"
0551c32d
RH
3959 [(set (match_operand:DI 0 "grfr_register_operand" "=r,*f")
3960 (ior:DI (match_operand:DI 1 "grfr_register_operand" "%r,*f")
3961 (match_operand:DI 2 "grfr_reg_or_8bit_operand" "rK,*f")))]
c65ebc55
JW
3962 ""
3963 "@
3964 or %0 = %2, %1
aebf2462 3965 for %0 = %2, %1"
52e12ad0 3966 [(set_attr "itanium_class" "ilog,fmisc")])
c65ebc55
JW
3967
3968(define_insn "xordi3"
0551c32d
RH
3969 [(set (match_operand:DI 0 "grfr_register_operand" "=r,*f")
3970 (xor:DI (match_operand:DI 1 "grfr_register_operand" "%r,*f")
3971 (match_operand:DI 2 "grfr_reg_or_8bit_operand" "rK,*f")))]
c65ebc55
JW
3972 ""
3973 "@
3974 xor %0 = %2, %1
aebf2462 3975 fxor %0 = %2, %1"
52e12ad0 3976 [(set_attr "itanium_class" "ilog,fmisc")])
c65ebc55
JW
3977
3978(define_insn "one_cmpldi2"
0551c32d
RH
3979 [(set (match_operand:DI 0 "gr_register_operand" "=r")
3980 (not:DI (match_operand:DI 1 "gr_register_operand" "r")))]
c65ebc55
JW
3981 ""
3982 "andcm %0 = -1, %1"
52e12ad0 3983 [(set_attr "itanium_class" "ilog")])
c65ebc55
JW
3984\f
3985;; ::::::::::::::::::::
3986;; ::
3987;; :: Comparisons
3988;; ::
3989;; ::::::::::::::::::::
3990
f2f90c63
RH
3991(define_expand "cmpbi"
3992 [(set (cc0)
3993 (compare (match_operand:BI 0 "register_operand" "")
3994 (match_operand:BI 1 "const_int_operand" "")))]
3995 ""
f2f90c63
RH
3996{
3997 ia64_compare_op0 = operands[0];
3998 ia64_compare_op1 = operands[1];
3999 DONE;
1d5d7a21 4000})
f2f90c63 4001
c65ebc55
JW
4002(define_expand "cmpsi"
4003 [(set (cc0)
0551c32d
RH
4004 (compare (match_operand:SI 0 "gr_register_operand" "")
4005 (match_operand:SI 1 "gr_reg_or_8bit_and_adjusted_operand" "")))]
c65ebc55 4006 ""
c65ebc55
JW
4007{
4008 ia64_compare_op0 = operands[0];
4009 ia64_compare_op1 = operands[1];
4010 DONE;
1d5d7a21 4011})
c65ebc55
JW
4012
4013(define_expand "cmpdi"
4014 [(set (cc0)
0551c32d
RH
4015 (compare (match_operand:DI 0 "gr_register_operand" "")
4016 (match_operand:DI 1 "gr_reg_or_8bit_and_adjusted_operand" "")))]
c65ebc55 4017 ""
c65ebc55
JW
4018{
4019 ia64_compare_op0 = operands[0];
4020 ia64_compare_op1 = operands[1];
4021 DONE;
1d5d7a21 4022})
c65ebc55
JW
4023
4024(define_expand "cmpsf"
4025 [(set (cc0)
0551c32d
RH
4026 (compare (match_operand:SF 0 "fr_reg_or_fp01_operand" "")
4027 (match_operand:SF 1 "fr_reg_or_fp01_operand" "")))]
c65ebc55 4028 ""
c65ebc55
JW
4029{
4030 ia64_compare_op0 = operands[0];
4031 ia64_compare_op1 = operands[1];
4032 DONE;
1d5d7a21 4033})
c65ebc55
JW
4034
4035(define_expand "cmpdf"
4036 [(set (cc0)
0551c32d
RH
4037 (compare (match_operand:DF 0 "fr_reg_or_fp01_operand" "")
4038 (match_operand:DF 1 "fr_reg_or_fp01_operand" "")))]
c65ebc55 4039 ""
c65ebc55
JW
4040{
4041 ia64_compare_op0 = operands[0];
4042 ia64_compare_op1 = operands[1];
4043 DONE;
1d5d7a21 4044})
c65ebc55 4045
3f622353 4046(define_expand "cmptf"
c65ebc55 4047 [(set (cc0)
3f622353
RH
4048 (compare (match_operand:TF 0 "tfreg_or_fp01_operand" "")
4049 (match_operand:TF 1 "tfreg_or_fp01_operand" "")))]
23c108af 4050 "INTEL_EXTENDED_IEEE_FORMAT"
c65ebc55
JW
4051{
4052 ia64_compare_op0 = operands[0];
4053 ia64_compare_op1 = operands[1];
4054 DONE;
1d5d7a21 4055})
c65ebc55
JW
4056
4057(define_insn "*cmpsi_normal"
f2f90c63
RH
4058 [(set (match_operand:BI 0 "register_operand" "=c")
4059 (match_operator:BI 1 "normal_comparison_operator"
0551c32d
RH
4060 [(match_operand:SI 2 "gr_register_operand" "r")
4061 (match_operand:SI 3 "gr_reg_or_8bit_operand" "rK")]))]
c65ebc55
JW
4062 ""
4063 "cmp4.%C1 %0, %I0 = %3, %2"
52e12ad0 4064 [(set_attr "itanium_class" "icmp")])
c65ebc55 4065
18a3c539
JW
4066;; We use %r3 because it is possible for us to match a 0, and two of the
4067;; unsigned comparisons don't accept immediate operands of zero.
4068
c65ebc55 4069(define_insn "*cmpsi_adjusted"
f2f90c63
RH
4070 [(set (match_operand:BI 0 "register_operand" "=c")
4071 (match_operator:BI 1 "adjusted_comparison_operator"
0551c32d
RH
4072 [(match_operand:SI 2 "gr_register_operand" "r")
4073 (match_operand:SI 3 "gr_reg_or_8bit_adjusted_operand" "rL")]))]
c65ebc55 4074 ""
18a3c539 4075 "cmp4.%C1 %0, %I0 = %r3, %2"
52e12ad0 4076 [(set_attr "itanium_class" "icmp")])
c65ebc55
JW
4077
4078(define_insn "*cmpdi_normal"
f2f90c63
RH
4079 [(set (match_operand:BI 0 "register_operand" "=c")
4080 (match_operator:BI 1 "normal_comparison_operator"
4081 [(match_operand:DI 2 "gr_reg_or_0_operand" "rO")
0551c32d 4082 (match_operand:DI 3 "gr_reg_or_8bit_operand" "rK")]))]
c65ebc55 4083 ""
f2f90c63 4084 "cmp.%C1 %0, %I0 = %3, %r2"
52e12ad0 4085 [(set_attr "itanium_class" "icmp")])
c65ebc55 4086
18a3c539
JW
4087;; We use %r3 because it is possible for us to match a 0, and two of the
4088;; unsigned comparisons don't accept immediate operands of zero.
4089
c65ebc55 4090(define_insn "*cmpdi_adjusted"
f2f90c63
RH
4091 [(set (match_operand:BI 0 "register_operand" "=c")
4092 (match_operator:BI 1 "adjusted_comparison_operator"
0551c32d
RH
4093 [(match_operand:DI 2 "gr_register_operand" "r")
4094 (match_operand:DI 3 "gr_reg_or_8bit_adjusted_operand" "rL")]))]
c65ebc55 4095 ""
18a3c539 4096 "cmp.%C1 %0, %I0 = %r3, %2"
52e12ad0 4097 [(set_attr "itanium_class" "icmp")])
c65ebc55
JW
4098
4099(define_insn "*cmpsf_internal"
f2f90c63
RH
4100 [(set (match_operand:BI 0 "register_operand" "=c")
4101 (match_operator:BI 1 "comparison_operator"
0551c32d
RH
4102 [(match_operand:SF 2 "fr_reg_or_fp01_operand" "fG")
4103 (match_operand:SF 3 "fr_reg_or_fp01_operand" "fG")]))]
c65ebc55
JW
4104 ""
4105 "fcmp.%D1 %0, %I0 = %F2, %F3"
52e12ad0 4106 [(set_attr "itanium_class" "fcmp")])
c65ebc55
JW
4107
4108(define_insn "*cmpdf_internal"
f2f90c63
RH
4109 [(set (match_operand:BI 0 "register_operand" "=c")
4110 (match_operator:BI 1 "comparison_operator"
0551c32d
RH
4111 [(match_operand:DF 2 "fr_reg_or_fp01_operand" "fG")
4112 (match_operand:DF 3 "fr_reg_or_fp01_operand" "fG")]))]
c65ebc55
JW
4113 ""
4114 "fcmp.%D1 %0, %I0 = %F2, %F3"
52e12ad0 4115 [(set_attr "itanium_class" "fcmp")])
c65ebc55 4116
3f622353 4117(define_insn "*cmptf_internal"
f2f90c63
RH
4118 [(set (match_operand:BI 0 "register_operand" "=c")
4119 (match_operator:BI 1 "comparison_operator"
3f622353
RH
4120 [(match_operand:TF 2 "tfreg_or_fp01_operand" "fG")
4121 (match_operand:TF 3 "tfreg_or_fp01_operand" "fG")]))]
23c108af 4122 "INTEL_EXTENDED_IEEE_FORMAT"
3f622353 4123 "fcmp.%D1 %0, %I0 = %F2, %F3"
52e12ad0 4124 [(set_attr "itanium_class" "fcmp")])
3f622353 4125
c65ebc55
JW
4126;; ??? Can this pattern be generated?
4127
4128(define_insn "*bit_zero"
f2f90c63
RH
4129 [(set (match_operand:BI 0 "register_operand" "=c")
4130 (eq:BI (zero_extract:DI (match_operand:DI 1 "gr_register_operand" "r")
c65ebc55
JW
4131 (const_int 1)
4132 (match_operand:DI 2 "immediate_operand" "n"))
4133 (const_int 0)))]
4134 ""
4135 "tbit.z %0, %I0 = %1, %2"
52e12ad0 4136 [(set_attr "itanium_class" "tbit")])
c65ebc55
JW
4137
4138(define_insn "*bit_one"
f2f90c63
RH
4139 [(set (match_operand:BI 0 "register_operand" "=c")
4140 (ne:BI (zero_extract:DI (match_operand:DI 1 "gr_register_operand" "r")
c65ebc55
JW
4141 (const_int 1)
4142 (match_operand:DI 2 "immediate_operand" "n"))
4143 (const_int 0)))]
4144 ""
4145 "tbit.nz %0, %I0 = %1, %2"
52e12ad0 4146 [(set_attr "itanium_class" "tbit")])
c65ebc55
JW
4147\f
4148;; ::::::::::::::::::::
4149;; ::
4150;; :: Branches
4151;; ::
4152;; ::::::::::::::::::::
4153
4154(define_expand "beq"
f2f90c63
RH
4155 [(set (pc)
4156 (if_then_else (match_dup 1)
c65ebc55
JW
4157 (label_ref (match_operand 0 "" ""))
4158 (pc)))]
4159 ""
f2f90c63 4160 "operands[1] = ia64_expand_compare (EQ, VOIDmode);")
c65ebc55
JW
4161
4162(define_expand "bne"
f2f90c63
RH
4163 [(set (pc)
4164 (if_then_else (match_dup 1)
c65ebc55
JW
4165 (label_ref (match_operand 0 "" ""))
4166 (pc)))]
4167 ""
f2f90c63 4168 "operands[1] = ia64_expand_compare (NE, VOIDmode);")
c65ebc55
JW
4169
4170(define_expand "blt"
f2f90c63
RH
4171 [(set (pc)
4172 (if_then_else (match_dup 1)
c65ebc55
JW
4173 (label_ref (match_operand 0 "" ""))
4174 (pc)))]
4175 ""
f2f90c63 4176 "operands[1] = ia64_expand_compare (LT, VOIDmode);")
c65ebc55
JW
4177
4178(define_expand "ble"
f2f90c63
RH
4179 [(set (pc)
4180 (if_then_else (match_dup 1)
c65ebc55
JW
4181 (label_ref (match_operand 0 "" ""))
4182 (pc)))]
4183 ""
f2f90c63 4184 "operands[1] = ia64_expand_compare (LE, VOIDmode);")
c65ebc55
JW
4185
4186(define_expand "bgt"
f2f90c63
RH
4187 [(set (pc)
4188 (if_then_else (match_dup 1)
c65ebc55
JW
4189 (label_ref (match_operand 0 "" ""))
4190 (pc)))]
4191 ""
f2f90c63 4192 "operands[1] = ia64_expand_compare (GT, VOIDmode);")
c65ebc55
JW
4193
4194(define_expand "bge"
f2f90c63
RH
4195 [(set (pc)
4196 (if_then_else (match_dup 1)
c65ebc55
JW
4197 (label_ref (match_operand 0 "" ""))
4198 (pc)))]
4199 ""
f2f90c63 4200 "operands[1] = ia64_expand_compare (GE, VOIDmode);")
c65ebc55
JW
4201
4202(define_expand "bltu"
f2f90c63
RH
4203 [(set (pc)
4204 (if_then_else (match_dup 1)
c65ebc55
JW
4205 (label_ref (match_operand 0 "" ""))
4206 (pc)))]
4207 ""
f2f90c63 4208 "operands[1] = ia64_expand_compare (LTU, VOIDmode);")
c65ebc55
JW
4209
4210(define_expand "bleu"
f2f90c63
RH
4211 [(set (pc)
4212 (if_then_else (match_dup 1)
c65ebc55
JW
4213 (label_ref (match_operand 0 "" ""))
4214 (pc)))]
4215 ""
f2f90c63 4216 "operands[1] = ia64_expand_compare (LEU, VOIDmode);")
c65ebc55
JW
4217
4218(define_expand "bgtu"
f2f90c63
RH
4219 [(set (pc)
4220 (if_then_else (match_dup 1)
c65ebc55
JW
4221 (label_ref (match_operand 0 "" ""))
4222 (pc)))]
4223 ""
f2f90c63 4224 "operands[1] = ia64_expand_compare (GTU, VOIDmode);")
c65ebc55
JW
4225
4226(define_expand "bgeu"
f2f90c63
RH
4227 [(set (pc)
4228 (if_then_else (match_dup 1)
c65ebc55
JW
4229 (label_ref (match_operand 0 "" ""))
4230 (pc)))]
4231 ""
f2f90c63 4232 "operands[1] = ia64_expand_compare (GEU, VOIDmode);")
c65ebc55 4233
e57b9d65 4234(define_expand "bunordered"
f2f90c63
RH
4235 [(set (pc)
4236 (if_then_else (match_dup 1)
e57b9d65
RH
4237 (label_ref (match_operand 0 "" ""))
4238 (pc)))]
4239 ""
f2f90c63 4240 "operands[1] = ia64_expand_compare (UNORDERED, VOIDmode);")
e57b9d65
RH
4241
4242(define_expand "bordered"
f2f90c63
RH
4243 [(set (pc)
4244 (if_then_else (match_dup 1)
e57b9d65
RH
4245 (label_ref (match_operand 0 "" ""))
4246 (pc)))]
4247 ""
f2f90c63 4248 "operands[1] = ia64_expand_compare (ORDERED, VOIDmode);")
e57b9d65 4249
6b6c1201 4250(define_insn "*br_true"
c65ebc55 4251 [(set (pc)
6b6c1201 4252 (if_then_else (match_operator 0 "predicate_operator"
f2f90c63 4253 [(match_operand:BI 1 "register_operand" "c")
6b6c1201
RH
4254 (const_int 0)])
4255 (label_ref (match_operand 2 "" ""))
c65ebc55
JW
4256 (pc)))]
4257 ""
85548039 4258 "(%J0) br.cond%+ %l2"
52e12ad0 4259 [(set_attr "itanium_class" "br")
e5bde68a 4260 (set_attr "predicable" "no")])
c65ebc55 4261
6b6c1201 4262(define_insn "*br_false"
c65ebc55 4263 [(set (pc)
6b6c1201 4264 (if_then_else (match_operator 0 "predicate_operator"
f2f90c63 4265 [(match_operand:BI 1 "register_operand" "c")
6b6c1201 4266 (const_int 0)])
c65ebc55 4267 (pc)
6b6c1201 4268 (label_ref (match_operand 2 "" ""))))]
c65ebc55 4269 ""
85548039 4270 "(%j0) br.cond%+ %l2"
52e12ad0 4271 [(set_attr "itanium_class" "br")
e5bde68a 4272 (set_attr "predicable" "no")])
c65ebc55
JW
4273\f
4274;; ::::::::::::::::::::
4275;; ::
5527bf14
RH
4276;; :: Counted loop operations
4277;; ::
4278;; ::::::::::::::::::::
4279
4280(define_expand "doloop_end"
4281 [(use (match_operand 0 "" "")) ; loop pseudo
4282 (use (match_operand 1 "" "")) ; iterations; zero if unknown
4283 (use (match_operand 2 "" "")) ; max iterations
4284 (use (match_operand 3 "" "")) ; loop level
4285 (use (match_operand 4 "" ""))] ; label
4286 ""
5527bf14
RH
4287{
4288 /* Only use cloop on innermost loops. */
4289 if (INTVAL (operands[3]) > 1)
4290 FAIL;
4291 emit_jump_insn (gen_doloop_end_internal (gen_rtx_REG (DImode, AR_LC_REGNUM),
4292 operands[4]));
4293 DONE;
1d5d7a21 4294})
5527bf14
RH
4295
4296(define_insn "doloop_end_internal"
4297 [(set (pc) (if_then_else (ne (match_operand:DI 0 "ar_lc_reg_operand" "")
4298 (const_int 0))
4299 (label_ref (match_operand 1 "" ""))
4300 (pc)))
4301 (set (match_dup 0) (if_then_else:DI (ne (match_dup 0) (const_int 0))
147d5f6f
AM
4302 (plus:DI (match_dup 0) (const_int -1))
4303 (match_dup 0)))]
5527bf14
RH
4304 ""
4305 "br.cloop.sptk.few %l1"
52e12ad0 4306 [(set_attr "itanium_class" "br")
5527bf14
RH
4307 (set_attr "predicable" "no")])
4308\f
4309;; ::::::::::::::::::::
4310;; ::
c65ebc55
JW
4311;; :: Set flag operations
4312;; ::
4313;; ::::::::::::::::::::
4314
4315(define_expand "seq"
f2f90c63 4316 [(set (match_operand:DI 0 "gr_register_operand" "") (match_dup 1))]
c65ebc55 4317 ""
f2f90c63 4318 "operands[1] = ia64_expand_compare (EQ, DImode);")
c65ebc55
JW
4319
4320(define_expand "sne"
f2f90c63 4321 [(set (match_operand:DI 0 "gr_register_operand" "") (match_dup 1))]
c65ebc55 4322 ""
f2f90c63 4323 "operands[1] = ia64_expand_compare (NE, DImode);")
c65ebc55
JW
4324
4325(define_expand "slt"
f2f90c63 4326 [(set (match_operand:DI 0 "gr_register_operand" "") (match_dup 1))]
c65ebc55 4327 ""
f2f90c63 4328 "operands[1] = ia64_expand_compare (LT, DImode);")
c65ebc55
JW
4329
4330(define_expand "sle"
f2f90c63 4331 [(set (match_operand:DI 0 "gr_register_operand" "") (match_dup 1))]
c65ebc55 4332 ""
f2f90c63 4333 "operands[1] = ia64_expand_compare (LE, DImode);")
c65ebc55
JW
4334
4335(define_expand "sgt"
f2f90c63 4336 [(set (match_operand:DI 0 "gr_register_operand" "") (match_dup 1))]
c65ebc55 4337 ""
f2f90c63 4338 "operands[1] = ia64_expand_compare (GT, DImode);")
c65ebc55
JW
4339
4340(define_expand "sge"
f2f90c63 4341 [(set (match_operand:DI 0 "gr_register_operand" "") (match_dup 1))]
c65ebc55 4342 ""
f2f90c63 4343 "operands[1] = ia64_expand_compare (GE, DImode);")
c65ebc55
JW
4344
4345(define_expand "sltu"
f2f90c63 4346 [(set (match_operand:DI 0 "gr_register_operand" "") (match_dup 1))]
c65ebc55 4347 ""
f2f90c63 4348 "operands[1] = ia64_expand_compare (LTU, DImode);")
c65ebc55
JW
4349
4350(define_expand "sleu"
f2f90c63 4351 [(set (match_operand:DI 0 "gr_register_operand" "") (match_dup 1))]
c65ebc55 4352 ""
f2f90c63 4353 "operands[1] = ia64_expand_compare (LEU, DImode);")
c65ebc55
JW
4354
4355(define_expand "sgtu"
f2f90c63 4356 [(set (match_operand:DI 0 "gr_register_operand" "") (match_dup 1))]
c65ebc55 4357 ""
f2f90c63 4358 "operands[1] = ia64_expand_compare (GTU, DImode);")
c65ebc55
JW
4359
4360(define_expand "sgeu"
f2f90c63 4361 [(set (match_operand:DI 0 "gr_register_operand" "") (match_dup 1))]
c65ebc55 4362 ""
f2f90c63 4363 "operands[1] = ia64_expand_compare (GEU, DImode);")
c65ebc55 4364
e57b9d65 4365(define_expand "sunordered"
f2f90c63 4366 [(set (match_operand:DI 0 "gr_register_operand" "") (match_dup 1))]
e57b9d65 4367 ""
f2f90c63 4368 "operands[1] = ia64_expand_compare (UNORDERED, DImode);")
e57b9d65
RH
4369
4370(define_expand "sordered"
f2f90c63 4371 [(set (match_operand:DI 0 "gr_register_operand" "") (match_dup 1))]
e57b9d65 4372 ""
f2f90c63 4373 "operands[1] = ia64_expand_compare (ORDERED, DImode);")
e57b9d65 4374
c65ebc55
JW
4375;; Don't allow memory as destination here, because cmov/cmov/st is more
4376;; efficient than mov/mov/cst/cst.
4377
0551c32d
RH
4378(define_insn_and_split "*sne_internal"
4379 [(set (match_operand:DI 0 "gr_register_operand" "=r")
f2f90c63 4380 (ne:DI (match_operand:BI 1 "register_operand" "c")
c65ebc55
JW
4381 (const_int 0)))]
4382 ""
4383 "#"
c65ebc55 4384 "reload_completed"
f2f90c63
RH
4385 [(cond_exec (ne (match_dup 1) (const_int 0))
4386 (set (match_dup 0) (const_int 1)))
4387 (cond_exec (eq (match_dup 1) (const_int 0))
4388 (set (match_dup 0) (const_int 0)))]
0551c32d 4389 ""
52e12ad0 4390 [(set_attr "itanium_class" "unknown")])
c65ebc55 4391
0551c32d
RH
4392(define_insn_and_split "*seq_internal"
4393 [(set (match_operand:DI 0 "gr_register_operand" "=r")
f2f90c63 4394 (eq:DI (match_operand:BI 1 "register_operand" "c")
c65ebc55
JW
4395 (const_int 0)))]
4396 ""
4397 "#"
c65ebc55 4398 "reload_completed"
f2f90c63
RH
4399 [(cond_exec (ne (match_dup 1) (const_int 0))
4400 (set (match_dup 0) (const_int 0)))
4401 (cond_exec (eq (match_dup 1) (const_int 0))
4402 (set (match_dup 0) (const_int 1)))]
0551c32d 4403 ""
52e12ad0 4404 [(set_attr "itanium_class" "unknown")])
c65ebc55
JW
4405\f
4406;; ::::::::::::::::::::
4407;; ::
4408;; :: Conditional move instructions.
4409;; ::
4410;; ::::::::::::::::::::
4411
4412;; ??? Add movXXcc patterns?
4413
c65ebc55
JW
4414;;
4415;; DImode if_then_else patterns.
4416;;
4417
75cdbeb8 4418(define_insn "*cmovdi_internal"
f2f90c63 4419 [(set (match_operand:DI 0 "destination_operand"
cd5c4048 4420 "= r, r, r, r, r, r, r, r, r, r, m, Q, *f,*b,*d*e")
e5bde68a 4421 (if_then_else:DI
f2f90c63
RH
4422 (match_operator 4 "predicate_operator"
4423 [(match_operand:BI 1 "register_operand"
cd5c4048 4424 "c,c,c,c,c,c,c,c,c,c,c,c,c,c,c")
e5bde68a 4425 (const_int 0)])
f2f90c63 4426 (match_operand:DI 2 "move_operand"
cd5c4048 4427 "rim, *f, *b,*d*e,rim,rim, rim,*f,*b,*d*e,rO,*f,rOQ,rO, rK")
f2f90c63 4428 (match_operand:DI 3 "move_operand"
cd5c4048 4429 "rim,rim,rim, rim, *f, *b,*d*e,*f,*b,*d*e,rO,*f,rOQ,rO, rK")))]
aebf2462 4430 "ia64_move_ok (operands[0], operands[2])
f2f90c63 4431 && ia64_move_ok (operands[0], operands[3])"
1d5d7a21 4432 { abort (); }
75cdbeb8
RH
4433 [(set_attr "predicable" "no")])
4434
4435(define_split
f2f90c63 4436 [(set (match_operand 0 "destination_operand" "")
75cdbeb8 4437 (if_then_else
f2f90c63
RH
4438 (match_operator 4 "predicate_operator"
4439 [(match_operand:BI 1 "register_operand" "")
75cdbeb8 4440 (const_int 0)])
f2f90c63
RH
4441 (match_operand 2 "move_operand" "")
4442 (match_operand 3 "move_operand" "")))]
3b572406
RH
4443 "reload_completed"
4444 [(const_int 0)]
e5bde68a 4445{
3b572406 4446 rtx tmp;
2f937369
DM
4447 int emitted_something;
4448
4449 emitted_something = 0;
3b572406 4450 if (! rtx_equal_p (operands[0], operands[2]))
e5bde68a 4451 {
3b572406
RH
4452 tmp = gen_rtx_SET (VOIDmode, operands[0], operands[2]);
4453 tmp = gen_rtx_COND_EXEC (VOIDmode, operands[4], tmp);
4454 emit_insn (tmp);
2f937369 4455 emitted_something = 1;
e5bde68a 4456 }
3b572406
RH
4457 if (! rtx_equal_p (operands[0], operands[3]))
4458 {
4459 tmp = gen_rtx_fmt_ee (GET_CODE (operands[4]) == NE ? EQ : NE,
f2f90c63 4460 VOIDmode, operands[1], const0_rtx);
3b572406
RH
4461 tmp = gen_rtx_COND_EXEC (VOIDmode, tmp,
4462 gen_rtx_SET (VOIDmode, operands[0],
4463 operands[3]));
4464 emit_insn (tmp);
2f937369 4465 emitted_something = 1;
3b572406 4466 }
2f937369
DM
4467 if (! emitted_something)
4468 emit_note (NULL, NOTE_INSN_DELETED);
3b572406 4469 DONE;
1d5d7a21 4470})
c65ebc55
JW
4471
4472;; Absolute value pattern.
4473
4474(define_insn "*absdi2_internal"
0551c32d 4475 [(set (match_operand:DI 0 "gr_register_operand" "=r,r")
e5bde68a 4476 (if_then_else:DI
f2f90c63
RH
4477 (match_operator 4 "predicate_operator"
4478 [(match_operand:BI 1 "register_operand" "c,c")
e5bde68a 4479 (const_int 0)])
0551c32d
RH
4480 (neg:DI (match_operand:DI 2 "gr_reg_or_22bit_operand" "rI,rI"))
4481 (match_operand:DI 3 "gr_reg_or_22bit_operand" "0,rI")))]
c65ebc55 4482 ""
e5bde68a 4483 "#"
52e12ad0 4484 [(set_attr "itanium_class" "ialu,unknown")
3b572406 4485 (set_attr "predicable" "no")])
c65ebc55
JW
4486
4487(define_split
4488 [(set (match_operand:DI 0 "register_operand" "")
e5bde68a 4489 (if_then_else:DI
f2f90c63
RH
4490 (match_operator 4 "predicate_operator"
4491 [(match_operand:BI 1 "register_operand" "c,c")
e5bde68a 4492 (const_int 0)])
0551c32d
RH
4493 (neg:DI (match_operand:DI 2 "gr_reg_or_22bit_operand" ""))
4494 (match_operand:DI 3 "gr_reg_or_22bit_operand" "")))]
e5bde68a
RH
4495 "reload_completed && rtx_equal_p (operands[0], operands[3])"
4496 [(cond_exec
4497 (match_dup 4)
4498 (set (match_dup 0)
4499 (neg:DI (match_dup 2))))]
c65ebc55
JW
4500 "")
4501
e5bde68a
RH
4502(define_split
4503 [(set (match_operand:DI 0 "register_operand" "")
4504 (if_then_else:DI
f2f90c63
RH
4505 (match_operator 4 "predicate_operator"
4506 [(match_operand:BI 1 "register_operand" "c,c")
e5bde68a 4507 (const_int 0)])
0551c32d
RH
4508 (neg:DI (match_operand:DI 2 "gr_reg_or_22bit_operand" ""))
4509 (match_operand:DI 3 "gr_reg_or_22bit_operand" "")))]
e5bde68a
RH
4510 "reload_completed"
4511 [(cond_exec
4512 (match_dup 4)
4513 (set (match_dup 0) (neg:DI (match_dup 2))))
4514 (cond_exec
4515 (match_dup 5)
4516 (set (match_dup 0) (match_dup 3)))]
e5bde68a
RH
4517{
4518 operands[5] = gen_rtx_fmt_ee (GET_CODE (operands[4]) == NE ? EQ : NE,
f2f90c63 4519 VOIDmode, operands[1], const0_rtx);
1d5d7a21 4520})
c65ebc55
JW
4521
4522;;
4523;; SImode if_then_else patterns.
4524;;
4525
75cdbeb8 4526(define_insn "*cmovsi_internal"
f2f90c63 4527 [(set (match_operand:SI 0 "destination_operand" "=r,m,*f,r,m,*f,r,m,*f")
e5bde68a 4528 (if_then_else:SI
f2f90c63
RH
4529 (match_operator 4 "predicate_operator"
4530 [(match_operand:BI 1 "register_operand" "c,c,c,c,c,c,c,c,c")
e5bde68a 4531 (const_int 0)])
f2f90c63 4532 (match_operand:SI 2 "move_operand"
3b572406 4533 "0,0,0,rim*f,rO,rO,rim*f,rO,rO")
f2f90c63 4534 (match_operand:SI 3 "move_operand"
3b572406 4535 "rim*f,rO,rO,0,0,0,rim*f,rO,rO")))]
aebf2462 4536 "ia64_move_ok (operands[0], operands[2])
f2f90c63 4537 && ia64_move_ok (operands[0], operands[3])"
1d5d7a21 4538 { abort (); }
3b572406 4539 [(set_attr "predicable" "no")])
c65ebc55
JW
4540
4541(define_insn "*abssi2_internal"
0551c32d 4542 [(set (match_operand:SI 0 "gr_register_operand" "=r,r")
e5bde68a 4543 (if_then_else:SI
f2f90c63
RH
4544 (match_operator 4 "predicate_operator"
4545 [(match_operand:BI 1 "register_operand" "c,c")
e5bde68a 4546 (const_int 0)])
0551c32d
RH
4547 (neg:SI (match_operand:SI 3 "gr_reg_or_22bit_operand" "rI,rI"))
4548 (match_operand:SI 2 "gr_reg_or_22bit_operand" "0,rI")))]
c65ebc55 4549 ""
e5bde68a 4550 "#"
52e12ad0 4551 [(set_attr "itanium_class" "ialu,unknown")
3b572406 4552 (set_attr "predicable" "no")])
c65ebc55
JW
4553
4554(define_split
4555 [(set (match_operand:SI 0 "register_operand" "")
e5bde68a 4556 (if_then_else:SI
f2f90c63
RH
4557 (match_operator 4 "predicate_operator"
4558 [(match_operand:BI 1 "register_operand" "c,c")
e5bde68a 4559 (const_int 0)])
0551c32d
RH
4560 (neg:SI (match_operand:SI 2 "gr_reg_or_22bit_operand" ""))
4561 (match_operand:SI 3 "gr_reg_or_22bit_operand" "")))]
e5bde68a
RH
4562 "reload_completed && rtx_equal_p (operands[0], operands[3])"
4563 [(cond_exec
4564 (match_dup 4)
4565 (set (match_dup 0)
4566 (neg:SI (match_dup 2))))]
c65ebc55
JW
4567 "")
4568
e5bde68a
RH
4569(define_split
4570 [(set (match_operand:SI 0 "register_operand" "")
4571 (if_then_else:SI
f2f90c63
RH
4572 (match_operator 4 "predicate_operator"
4573 [(match_operand:BI 1 "register_operand" "c,c")
e5bde68a 4574 (const_int 0)])
0551c32d
RH
4575 (neg:SI (match_operand:SI 2 "gr_reg_or_22bit_operand" ""))
4576 (match_operand:SI 3 "gr_reg_or_22bit_operand" "")))]
e5bde68a
RH
4577 "reload_completed"
4578 [(cond_exec
4579 (match_dup 4)
4580 (set (match_dup 0) (neg:SI (match_dup 2))))
4581 (cond_exec
4582 (match_dup 5)
4583 (set (match_dup 0) (match_dup 3)))]
e5bde68a
RH
4584{
4585 operands[5] = gen_rtx_fmt_ee (GET_CODE (operands[4]) == NE ? EQ : NE,
f2f90c63 4586 VOIDmode, operands[1], const0_rtx);
1d5d7a21 4587})
e5bde68a 4588
7dcc803e 4589(define_insn_and_split "*cond_opsi2_internal"
acb0638d
BS
4590 [(set (match_operand:SI 0 "gr_register_operand" "=r")
4591 (match_operator:SI 5 "condop_operator"
4592 [(if_then_else:SI
4593 (match_operator 6 "predicate_operator"
4594 [(match_operand:BI 1 "register_operand" "c")
4595 (const_int 0)])
4596 (match_operand:SI 2 "gr_register_operand" "r")
4597 (match_operand:SI 3 "gr_register_operand" "r"))
4598 (match_operand:SI 4 "gr_register_operand" "r")]))]
4599 ""
4600 "#"
acb0638d
BS
4601 "reload_completed"
4602 [(cond_exec
4603 (match_dup 6)
4604 (set (match_dup 0) (match_op_dup:SI 5 [(match_dup 2) (match_dup 4)])))
4605 (cond_exec
4606 (match_dup 7)
4607 (set (match_dup 0) (match_op_dup:SI 5 [(match_dup 3) (match_dup 4)])))]
acb0638d
BS
4608{
4609 operands[7] = gen_rtx_fmt_ee (GET_CODE (operands[6]) == NE ? EQ : NE,
4610 VOIDmode, operands[1], const0_rtx);
1d5d7a21 4611}
7dcc803e
BS
4612 [(set_attr "itanium_class" "ialu")
4613 (set_attr "predicable" "no")])
4614
acb0638d 4615
7dcc803e 4616(define_insn_and_split "*cond_opsi2_internal_b"
acb0638d
BS
4617 [(set (match_operand:SI 0 "gr_register_operand" "=r")
4618 (match_operator:SI 5 "condop_operator"
4619 [(match_operand:SI 4 "gr_register_operand" "r")
4620 (if_then_else:SI
4621 (match_operator 6 "predicate_operator"
4622 [(match_operand:BI 1 "register_operand" "c")
4623 (const_int 0)])
4624 (match_operand:SI 2 "gr_register_operand" "r")
4625 (match_operand:SI 3 "gr_register_operand" "r"))]))]
4626 ""
4627 "#"
acb0638d
BS
4628 "reload_completed"
4629 [(cond_exec
4630 (match_dup 6)
4631 (set (match_dup 0) (match_op_dup:SI 5 [(match_dup 4) (match_dup 2)])))
4632 (cond_exec
4633 (match_dup 7)
4634 (set (match_dup 0) (match_op_dup:SI 5 [(match_dup 4) (match_dup 3)])))]
acb0638d
BS
4635{
4636 operands[7] = gen_rtx_fmt_ee (GET_CODE (operands[6]) == NE ? EQ : NE,
4637 VOIDmode, operands[1], const0_rtx);
1d5d7a21 4638}
7dcc803e
BS
4639 [(set_attr "itanium_class" "ialu")
4640 (set_attr "predicable" "no")])
acb0638d 4641
c65ebc55
JW
4642\f
4643;; ::::::::::::::::::::
4644;; ::
4645;; :: Call and branch instructions
4646;; ::
4647;; ::::::::::::::::::::
4648
4649;; Subroutine call instruction returning no value. Operand 0 is the function
4650;; to call; operand 1 is the number of bytes of arguments pushed (in mode
4651;; `SImode', except it is normally a `const_int'); operand 2 is the number of
4652;; registers used as operands.
4653
4654;; On most machines, operand 2 is not actually stored into the RTL pattern. It
4655;; is supplied for the sake of some RISC machines which need to put this
4656;; information into the assembler code; they can put it in the RTL instead of
4657;; operand 1.
4658
4659(define_expand "call"
4660 [(use (match_operand:DI 0 "" ""))
4661 (use (match_operand 1 "" ""))
4662 (use (match_operand 2 "" ""))
4663 (use (match_operand 3 "" ""))]
4664 ""
c65ebc55 4665{
2ed4af6f 4666 ia64_expand_call (NULL_RTX, operands[0], operands[2], 0);
c65ebc55 4667 DONE;
1d5d7a21 4668})
c65ebc55 4669
2ed4af6f
RH
4670(define_expand "sibcall"
4671 [(use (match_operand:DI 0 "" ""))
4672 (use (match_operand 1 "" ""))
4673 (use (match_operand 2 "" ""))
4674 (use (match_operand 3 "" ""))]
c65ebc55 4675 ""
c65ebc55 4676{
2ed4af6f
RH
4677 ia64_expand_call (NULL_RTX, operands[0], operands[2], 1);
4678 DONE;
1d5d7a21 4679})
c65ebc55 4680
c65ebc55 4681;; Subroutine call instruction returning a value. Operand 0 is the hard
2ed4af6f
RH
4682;; register in which the value is returned. There are three more operands,
4683;; the same as the three operands of the `call' instruction (but with numbers
c65ebc55 4684;; increased by one).
2ed4af6f 4685;;
c65ebc55
JW
4686;; Subroutines that return `BLKmode' objects use the `call' insn.
4687
4688(define_expand "call_value"
4689 [(use (match_operand 0 "" ""))
4690 (use (match_operand:DI 1 "" ""))
4691 (use (match_operand 2 "" ""))
4692 (use (match_operand 3 "" ""))
4693 (use (match_operand 4 "" ""))]
4694 ""
c65ebc55 4695{
2ed4af6f 4696 ia64_expand_call (operands[0], operands[1], operands[3], 0);
c65ebc55 4697 DONE;
1d5d7a21 4698})
c65ebc55 4699
2ed4af6f
RH
4700(define_expand "sibcall_value"
4701 [(use (match_operand 0 "" ""))
4702 (use (match_operand:DI 1 "" ""))
4703 (use (match_operand 2 "" ""))
4704 (use (match_operand 3 "" ""))
4705 (use (match_operand 4 "" ""))]
c65ebc55 4706 ""
c65ebc55 4707{
2ed4af6f
RH
4708 ia64_expand_call (operands[0], operands[1], operands[3], 1);
4709 DONE;
1d5d7a21 4710})
c65ebc55 4711
c65ebc55
JW
4712;; Call subroutine returning any type.
4713
4714(define_expand "untyped_call"
4715 [(parallel [(call (match_operand 0 "" "")
4716 (const_int 0))
4717 (match_operand 1 "" "")
4718 (match_operand 2 "" "")])]
4719 ""
c65ebc55
JW
4720{
4721 int i;
4722
4723 emit_call_insn (gen_call (operands[0], const0_rtx, NULL, const0_rtx));
4724
4725 for (i = 0; i < XVECLEN (operands[2], 0); i++)
4726 {
4727 rtx set = XVECEXP (operands[2], 0, i);
4728 emit_move_insn (SET_DEST (set), SET_SRC (set));
4729 }
4730
4731 /* The optimizer does not know that the call sets the function value
4732 registers we stored in the result block. We avoid problems by
4733 claiming that all hard registers are used and clobbered at this
4734 point. */
4735 emit_insn (gen_blockage ());
4736
4737 DONE;
1d5d7a21 4738})
c65ebc55 4739
2ed4af6f 4740(define_insn "call_nopic"
52e12ad0 4741 [(call (mem:DI (match_operand:DI 0 "call_operand" "b,i"))
2ed4af6f 4742 (match_operand 1 "" ""))
52e12ad0 4743 (clobber (match_operand:DI 2 "register_operand" "=b,b"))]
2ed4af6f
RH
4744 ""
4745 "br.call%+.many %2 = %0"
52e12ad0 4746 [(set_attr "itanium_class" "br,scall")])
2ed4af6f
RH
4747
4748(define_insn "call_value_nopic"
4749 [(set (match_operand 0 "" "")
52e12ad0 4750 (call (mem:DI (match_operand:DI 1 "call_operand" "b,i"))
2ed4af6f 4751 (match_operand 2 "" "")))
52e12ad0 4752 (clobber (match_operand:DI 3 "register_operand" "=b,b"))]
2ed4af6f
RH
4753 ""
4754 "br.call%+.many %3 = %1"
52e12ad0 4755 [(set_attr "itanium_class" "br,scall")])
2ed4af6f
RH
4756
4757(define_insn "sibcall_nopic"
52e12ad0 4758 [(call (mem:DI (match_operand:DI 0 "call_operand" "b,i"))
2ed4af6f 4759 (match_operand 1 "" ""))
6ca3c22f
RH
4760 (use (match_operand:DI 2 "register_operand" "=b,b"))
4761 (use (match_operand:DI 3 "ar_pfs_reg_operand" ""))]
2ed4af6f
RH
4762 ""
4763 "br%+.many %0"
52e12ad0 4764 [(set_attr "itanium_class" "br,scall")])
2ed4af6f
RH
4765
4766(define_insn "call_pic"
5da4f548 4767 [(call (mem (match_operand 0 "call_operand" "b,i"))
2ed4af6f 4768 (match_operand 1 "" ""))
086c0f96 4769 (use (unspec [(reg:DI 1)] UNSPEC_PIC_CALL))
52e12ad0 4770 (clobber (match_operand:DI 2 "register_operand" "=b,b"))]
2ed4af6f
RH
4771 ""
4772 "br.call%+.many %2 = %0"
52e12ad0 4773 [(set_attr "itanium_class" "br,scall")])
2ed4af6f
RH
4774
4775(define_insn "call_value_pic"
4776 [(set (match_operand 0 "" "")
52e12ad0 4777 (call (mem:DI (match_operand:DI 1 "call_operand" "b,i"))
2ed4af6f 4778 (match_operand 2 "" "")))
086c0f96 4779 (use (unspec [(reg:DI 1)] UNSPEC_PIC_CALL))
52e12ad0 4780 (clobber (match_operand:DI 3 "register_operand" "=b,b"))]
2ed4af6f
RH
4781 ""
4782 "br.call%+.many %3 = %1"
52e12ad0 4783 [(set_attr "itanium_class" "br,scall")])
2ed4af6f
RH
4784
4785(define_insn "sibcall_pic"
4786 [(call (mem:DI (match_operand:DI 0 "call_operand" "bi"))
4787 (match_operand 1 "" ""))
086c0f96 4788 (use (unspec [(reg:DI 1)] UNSPEC_PIC_CALL))
6ca3c22f
RH
4789 (use (match_operand:DI 2 "register_operand" "=b"))
4790 (use (match_operand:DI 3 "ar_pfs_reg_operand" ""))]
2ed4af6f
RH
4791 ""
4792 "br%+.many %0"
52e12ad0 4793 [(set_attr "itanium_class" "br")])
2ed4af6f 4794
c65ebc55
JW
4795(define_insn "return_internal"
4796 [(return)
4797 (use (match_operand:DI 0 "register_operand" "b"))]
4798 ""
4799 "br.ret.sptk.many %0"
52e12ad0 4800 [(set_attr "itanium_class" "br")])
c65ebc55
JW
4801
4802(define_insn "return"
4803 [(return)]
4804 "ia64_direct_return ()"
4805 "br.ret.sptk.many rp"
52e12ad0 4806 [(set_attr "itanium_class" "br")])
c65ebc55 4807
6b6c1201 4808(define_insn "*return_true"
c65ebc55 4809 [(set (pc)
6b6c1201 4810 (if_then_else (match_operator 0 "predicate_operator"
f2f90c63 4811 [(match_operand:BI 1 "register_operand" "c")
6b6c1201 4812 (const_int 0)])
c65ebc55
JW
4813 (return)
4814 (pc)))]
4815 "ia64_direct_return ()"
13da91fd 4816 "(%J0) br.ret%+.many rp"
52e12ad0 4817 [(set_attr "itanium_class" "br")
e5bde68a 4818 (set_attr "predicable" "no")])
c65ebc55 4819
6b6c1201 4820(define_insn "*return_false"
c65ebc55 4821 [(set (pc)
6b6c1201 4822 (if_then_else (match_operator 0 "predicate_operator"
f2f90c63 4823 [(match_operand:BI 1 "register_operand" "c")
6b6c1201 4824 (const_int 0)])
c65ebc55
JW
4825 (pc)
4826 (return)))]
4827 "ia64_direct_return ()"
13da91fd 4828 "(%j0) br.ret%+.many rp"
52e12ad0 4829 [(set_attr "itanium_class" "br")
e5bde68a 4830 (set_attr "predicable" "no")])
c65ebc55
JW
4831
4832(define_insn "jump"
4833 [(set (pc) (label_ref (match_operand 0 "" "")))]
4834 ""
4835 "br %l0"
52e12ad0 4836 [(set_attr "itanium_class" "br")])
c65ebc55
JW
4837
4838(define_insn "indirect_jump"
4839 [(set (pc) (match_operand:DI 0 "register_operand" "b"))]
4840 ""
4841 "br %0"
52e12ad0 4842 [(set_attr "itanium_class" "br")])
c65ebc55
JW
4843
4844(define_expand "tablejump"
340f7e7c
RH
4845 [(parallel [(set (pc) (match_operand:DI 0 "memory_operand" ""))
4846 (use (label_ref (match_operand 1 "" "")))])]
c65ebc55 4847 ""
c65ebc55 4848{
340f7e7c
RH
4849 rtx op0 = operands[0];
4850 rtx addr;
4851
4852 /* ??? Bother -- do_tablejump is "helpful" and pulls the table
4853 element into a register without bothering to see whether that
4854 is necessary given the operand predicate. Check for MEM just
4855 in case someone fixes this. */
4856 if (GET_CODE (op0) == MEM)
4857 addr = XEXP (op0, 0);
4858 else
4859 {
4860 /* Otherwise, cheat and guess that the previous insn in the
4861 stream was the memory load. Grab the address from that.
4862 Note we have to momentarily pop out of the sequence started
4863 by the insn-emit wrapper in order to grab the last insn. */
4864 rtx last, set;
4865
4866 end_sequence ();
4867 last = get_last_insn ();
4868 start_sequence ();
4869 set = single_set (last);
4870
4871 if (! rtx_equal_p (SET_DEST (set), op0)
4872 || GET_CODE (SET_SRC (set)) != MEM)
4873 abort ();
4874 addr = XEXP (SET_SRC (set), 0);
4875 if (rtx_equal_p (addr, op0))
4876 abort ();
4877 }
c65ebc55 4878
340f7e7c
RH
4879 /* Jump table elements are stored pc-relative. That is, a displacement
4880 from the entry to the label. Thus to convert to an absolute address
4881 we add the address of the memory from which the value is loaded. */
4882 operands[0] = expand_simple_binop (DImode, PLUS, op0, addr,
4883 NULL_RTX, 1, OPTAB_DIRECT);
4884})
c65ebc55 4885
340f7e7c 4886(define_insn "*tablejump_internal"
c65ebc55
JW
4887 [(set (pc) (match_operand:DI 0 "register_operand" "b"))
4888 (use (label_ref (match_operand 1 "" "")))]
4889 ""
4890 "br %0"
52e12ad0 4891 [(set_attr "itanium_class" "br")])
c65ebc55
JW
4892
4893\f
4894;; ::::::::::::::::::::
4895;; ::
4896;; :: Prologue and Epilogue instructions
4897;; ::
4898;; ::::::::::::::::::::
4899
4900(define_expand "prologue"
4901 [(const_int 1)]
4902 ""
c65ebc55
JW
4903{
4904 ia64_expand_prologue ();
4905 DONE;
1d5d7a21 4906})
c65ebc55
JW
4907
4908(define_expand "epilogue"
2ed4af6f
RH
4909 [(return)]
4910 ""
2ed4af6f
RH
4911{
4912 ia64_expand_epilogue (0);
4913 DONE;
1d5d7a21 4914})
2ed4af6f
RH
4915
4916(define_expand "sibcall_epilogue"
4917 [(return)]
c65ebc55 4918 ""
c65ebc55 4919{
2ed4af6f 4920 ia64_expand_epilogue (1);
c65ebc55 4921 DONE;
1d5d7a21 4922})
c65ebc55
JW
4923
4924;; This prevents the scheduler from moving the SP decrement past FP-relative
4925;; stack accesses. This is the same as adddi3 plus the extra set.
4926
4927(define_insn "prologue_allocate_stack"
4928 [(set (match_operand:DI 0 "register_operand" "=r,r,r")
4929 (plus:DI (match_operand:DI 1 "register_operand" "%r,r,a")
0551c32d 4930 (match_operand:DI 2 "gr_reg_or_22bit_operand" "r,I,J")))
bdbe5b8d 4931 (set (match_operand:DI 3 "register_operand" "+r,r,r")
c65ebc55
JW
4932 (match_dup 3))]
4933 ""
4934 "@
1d5d7a21
RH
4935 add %0 = %1, %2
4936 adds %0 = %2, %1
4937 addl %0 = %2, %1"
52e12ad0 4938 [(set_attr "itanium_class" "ialu")])
c65ebc55
JW
4939
4940;; This prevents the scheduler from moving the SP restore past FP-relative
4941;; stack accesses. This is similar to movdi plus the extra set.
4942
4943(define_insn "epilogue_deallocate_stack"
4944 [(set (match_operand:DI 0 "register_operand" "=r")
4945 (match_operand:DI 1 "register_operand" "+r"))
4946 (set (match_dup 1) (match_dup 1))]
4947 ""
4948 "mov %0 = %1"
52e12ad0 4949 [(set_attr "itanium_class" "ialu")])
c65ebc55 4950
1d5d7a21
RH
4951;; As USE insns aren't meaningful after reload, this is used instead
4952;; to prevent deleting instructions setting registers for EH handling
4953(define_insn "prologue_use"
4954 [(unspec:DI [(match_operand:DI 0 "register_operand" "")]
4955 UNSPEC_PROLOGUE_USE)]
4956 ""
4957 ""
4958 [(set_attr "itanium_class" "ignore")
4959 (set_attr "predicable" "no")])
4960
c65ebc55
JW
4961;; Allocate a new register frame.
4962
4963(define_insn "alloc"
4964 [(set (match_operand:DI 0 "register_operand" "=r")
086c0f96 4965 (unspec_volatile:DI [(const_int 0)] UNSPECV_ALLOC))
c65ebc55
JW
4966 (use (match_operand:DI 1 "const_int_operand" "i"))
4967 (use (match_operand:DI 2 "const_int_operand" "i"))
4968 (use (match_operand:DI 3 "const_int_operand" "i"))
4969 (use (match_operand:DI 4 "const_int_operand" "i"))]
4970 ""
4971 "alloc %0 = ar.pfs, %1, %2, %3, %4"
52e12ad0 4972 [(set_attr "itanium_class" "syst_m0")
e5bde68a 4973 (set_attr "predicable" "no")])
c65ebc55 4974
97e242b0
RH
4975;; Modifies ar.unat
4976(define_expand "gr_spill"
870f9ec0
RH
4977 [(parallel [(set (match_operand:DI 0 "memory_operand" "=m")
4978 (unspec:DI [(match_operand:DI 1 "register_operand" "r")
086c0f96
RH
4979 (match_operand:DI 2 "const_int_operand" "")]
4980 UNSPEC_GR_SPILL))
870f9ec0 4981 (clobber (match_dup 3))])]
97e242b0 4982 ""
870f9ec0 4983 "operands[3] = gen_rtx_REG (DImode, AR_UNAT_REGNUM);")
97e242b0 4984
870f9ec0 4985(define_insn "gr_spill_internal"
c65ebc55 4986 [(set (match_operand:DI 0 "memory_operand" "=m")
870f9ec0 4987 (unspec:DI [(match_operand:DI 1 "register_operand" "r")
086c0f96
RH
4988 (match_operand:DI 2 "const_int_operand" "")]
4989 UNSPEC_GR_SPILL))
870f9ec0 4990 (clobber (match_operand:DI 3 "register_operand" ""))]
c65ebc55 4991 ""
2130b7fb 4992{
1d5d7a21
RH
4993 /* Note that we use a C output pattern here to avoid the predicate
4994 being automatically added before the .mem.offset directive. */
4995 return ".mem.offset %2, 0\;%,st8.spill %0 = %1%P0";
4996}
52e12ad0 4997 [(set_attr "itanium_class" "st")])
c65ebc55 4998
97e242b0
RH
4999;; Reads ar.unat
5000(define_expand "gr_restore"
870f9ec0
RH
5001 [(parallel [(set (match_operand:DI 0 "register_operand" "=r")
5002 (unspec:DI [(match_operand:DI 1 "memory_operand" "m")
086c0f96
RH
5003 (match_operand:DI 2 "const_int_operand" "")]
5004 UNSPEC_GR_RESTORE))
870f9ec0 5005 (use (match_dup 3))])]
97e242b0 5006 ""
870f9ec0 5007 "operands[3] = gen_rtx_REG (DImode, AR_UNAT_REGNUM);")
97e242b0 5008
870f9ec0 5009(define_insn "gr_restore_internal"
c65ebc55 5010 [(set (match_operand:DI 0 "register_operand" "=r")
870f9ec0 5011 (unspec:DI [(match_operand:DI 1 "memory_operand" "m")
086c0f96
RH
5012 (match_operand:DI 2 "const_int_operand" "")]
5013 UNSPEC_GR_RESTORE))
870f9ec0 5014 (use (match_operand:DI 3 "register_operand" ""))]
c65ebc55 5015 ""
1d5d7a21 5016 { return ".mem.offset %2, 0\;%,ld8.fill %0 = %1%P1"; }
52e12ad0 5017 [(set_attr "itanium_class" "ld")])
c65ebc55
JW
5018
5019(define_insn "fr_spill"
3f622353 5020 [(set (match_operand:TF 0 "memory_operand" "=m")
086c0f96
RH
5021 (unspec:TF [(match_operand:TF 1 "register_operand" "f")]
5022 UNSPEC_FR_SPILL))]
c65ebc55
JW
5023 ""
5024 "stf.spill %0 = %1%P0"
52e12ad0 5025 [(set_attr "itanium_class" "stf")])
c65ebc55
JW
5026
5027(define_insn "fr_restore"
3f622353 5028 [(set (match_operand:TF 0 "register_operand" "=f")
086c0f96
RH
5029 (unspec:TF [(match_operand:TF 1 "memory_operand" "m")]
5030 UNSPEC_FR_RESTORE))]
c65ebc55
JW
5031 ""
5032 "ldf.fill %0 = %1%P1"
52e12ad0 5033 [(set_attr "itanium_class" "fld")])
c65ebc55 5034
0024a804
JW
5035;; ??? The explicit stop is not ideal. It would be better if
5036;; rtx_needs_barrier took care of this, but this is something that can be
5037;; fixed later. This avoids an RSE DV.
5038
0c96007e
AM
5039(define_insn "bsp_value"
5040 [(set (match_operand:DI 0 "register_operand" "=r")
086c0f96 5041 (unspec:DI [(const_int 0)] UNSPEC_BSP_VALUE))]
0c96007e 5042 ""
0024a804 5043 ";;\;mov %0 = ar.bsp"
52e12ad0 5044 [(set_attr "itanium_class" "frar_i")])
0c96007e
AM
5045
5046(define_insn "set_bsp"
086c0f96
RH
5047 [(unspec_volatile [(match_operand:DI 0 "register_operand" "r")]
5048 UNSPECV_SET_BSP)]
0c96007e 5049 ""
1d5d7a21
RH
5050 "flushrs
5051 mov r19=ar.rsc
5052 ;;
5053 and r19=0x1c,r19
5054 ;;
5055 mov ar.rsc=r19
5056 ;;
5057 mov ar.bspstore=%0
5058 ;;
5059 or r19=0x3,r19
5060 ;;
5061 loadrs
5062 invala
5063 ;;
5064 mov ar.rsc=r19"
52e12ad0 5065 [(set_attr "itanium_class" "unknown")
e5bde68a 5066 (set_attr "predicable" "no")])
ce152ef8 5067
0024a804
JW
5068;; ??? The explicit stops are not ideal. It would be better if
5069;; rtx_needs_barrier took care of this, but this is something that can be
5070;; fixed later. This avoids an RSE DV.
5071
ce152ef8 5072(define_insn "flushrs"
086c0f96 5073 [(unspec [(const_int 0)] UNSPEC_FLUSHRS)]
ce152ef8 5074 ""
0024a804 5075 ";;\;flushrs\;;;"
52e12ad0 5076 [(set_attr "itanium_class" "rse_m")])
c65ebc55
JW
5077\f
5078;; ::::::::::::::::::::
5079;; ::
5080;; :: Miscellaneous instructions
5081;; ::
5082;; ::::::::::::::::::::
5083
5084;; ??? Emiting a NOP instruction isn't very useful. This should probably
5085;; be emitting ";;" to force a break in the instruction packing.
5086
5087;; No operation, needed in case the user uses -g but not -O.
5088(define_insn "nop"
5089 [(const_int 0)]
5090 ""
5091 "nop 0"
52e12ad0 5092 [(set_attr "itanium_class" "unknown")])
c65ebc55 5093
2130b7fb
BS
5094(define_insn "nop_m"
5095 [(const_int 1)]
5096 ""
5097 "nop.m 0"
5098 [(set_attr "itanium_class" "nop_m")])
5099
5100(define_insn "nop_i"
5101 [(const_int 2)]
5102 ""
5103 "nop.i 0"
5104 [(set_attr "itanium_class" "nop_i")])
5105
5106(define_insn "nop_f"
5107 [(const_int 3)]
5108 ""
5109 "nop.f 0"
5110 [(set_attr "itanium_class" "nop_f")])
5111
5112(define_insn "nop_b"
5113 [(const_int 4)]
5114 ""
5115 "nop.b 0"
5116 [(set_attr "itanium_class" "nop_b")])
5117
5118(define_insn "nop_x"
5119 [(const_int 5)]
5120 ""
5121 ""
5122 [(set_attr "itanium_class" "nop_x")])
5123
2130b7fb 5124(define_insn "bundle_selector"
086c0f96 5125 [(unspec [(match_operand 0 "const_int_operand" "")] UNSPEC_BUNDLE_SELECTOR)]
2130b7fb 5126 ""
1d5d7a21 5127 { return get_bundle_name (INTVAL (operands[0])); }
2130b7fb
BS
5128 [(set_attr "itanium_class" "ignore")
5129 (set_attr "predicable" "no")])
5130
c65ebc55
JW
5131;; Pseudo instruction that prevents the scheduler from moving code above this
5132;; point.
5133(define_insn "blockage"
086c0f96 5134 [(unspec_volatile [(const_int 0)] UNSPECV_BLOCKAGE)]
c65ebc55
JW
5135 ""
5136 ""
52e12ad0 5137 [(set_attr "itanium_class" "ignore")
e5bde68a 5138 (set_attr "predicable" "no")])
c65ebc55
JW
5139
5140(define_insn "insn_group_barrier"
086c0f96
RH
5141 [(unspec_volatile [(match_operand 0 "const_int_operand" "")]
5142 UNSPECV_INSN_GROUP_BARRIER)]
c65ebc55
JW
5143 ""
5144 ";;"
52e12ad0 5145 [(set_attr "itanium_class" "stop_bit")
e5bde68a 5146 (set_attr "predicable" "no")])
c65ebc55 5147
26406018
RH
5148(define_expand "trap"
5149 [(trap_if (const_int 1) (const_int 0))]
5150 ""
5151 "")
5152
5153;; ??? We don't have a match-any slot type. Setting the type to unknown
5154;; produces worse code that setting the slot type to A.
5155
5156(define_insn "*trap"
5157 [(trap_if (const_int 1) (match_operand 0 "const_int_operand" ""))]
5158 ""
5159 "break %0"
5160 [(set_attr "itanium_class" "chk_s")])
5161
5162(define_expand "conditional_trap"
5163 [(trap_if (match_operand 0 "" "") (match_operand 1 "" ""))]
5164 ""
5165{
5166 operands[0] = ia64_expand_compare (GET_CODE (operands[0]), VOIDmode);
5167})
5168
5169(define_insn "*conditional_trap"
5170 [(trap_if (match_operator 0 "predicate_operator"
5171 [(match_operand:BI 1 "register_operand" "c")
5172 (const_int 0)])
5173 (match_operand 2 "const_int_operand" ""))]
5174 ""
5cf63e3f 5175 "(%J0) break %2"
26406018
RH
5176 [(set_attr "itanium_class" "chk_s")
5177 (set_attr "predicable" "no")])
5178
f12f25a7 5179(define_insn "break_f"
086c0f96 5180 [(unspec_volatile [(const_int 0)] UNSPECV_BREAK)]
f12f25a7
RH
5181 ""
5182 "break.f 0"
5183 [(set_attr "itanium_class" "nop_f")])
44eca121
JJ
5184
5185(define_insn "prefetch"
5186 [(prefetch (match_operand:DI 0 "address_operand" "p")
5187 (match_operand:DI 1 "const_int_operand" "n")
5188 (match_operand:DI 2 "const_int_operand" "n"))]
5189 ""
5190{
5191 static const char * const alt[2][4] = {
b3656137
KG
5192 {
5193 "lfetch.nta [%0]",
5194 "lfetch.nt1 [%0]",
5195 "lfetch.nt2 [%0]",
5196 "lfetch [%0]"
5197 },
5198 {
5199 "lfetch.excl.nta [%0]",
5200 "lfetch.excl.nt1 [%0]",
5201 "lfetch.excl.nt2 [%0]",
5202 "lfetch.excl [%0]"
5203 }
44eca121
JJ
5204 };
5205 int i = (INTVAL (operands[1]));
5206 int j = (INTVAL (operands[2]));
5207
5208 if (i != 0 && i != 1)
5209 abort ();
5210 if (j < 0 || j > 3)
5211 abort ();
5212 return alt[i][j];
5213}
5214 [(set_attr "itanium_class" "lfetch")])
c65ebc55
JW
5215\f
5216;; Non-local goto support.
5217
5218(define_expand "save_stack_nonlocal"
5219 [(use (match_operand:OI 0 "memory_operand" ""))
5220 (use (match_operand:DI 1 "register_operand" ""))]
5221 ""
c65ebc55
JW
5222{
5223 emit_library_call (gen_rtx_SYMBOL_REF (Pmode,
5224 \"__ia64_save_stack_nonlocal\"),
5225 0, VOIDmode, 2, XEXP (operands[0], 0), Pmode,
5226 operands[1], Pmode);
5227 DONE;
1d5d7a21 5228})
c65ebc55
JW
5229
5230(define_expand "nonlocal_goto"
5231 [(use (match_operand 0 "general_operand" ""))
5232 (use (match_operand 1 "general_operand" ""))
5233 (use (match_operand 2 "general_operand" ""))
5234 (use (match_operand 3 "general_operand" ""))]
5235 ""
c65ebc55 5236{
c65ebc55 5237 emit_library_call (gen_rtx_SYMBOL_REF (Pmode, \"__ia64_nonlocal_goto\"),
8206fc89 5238 LCT_NORETURN, VOIDmode, 3,
7c2b017c 5239 operands[1], Pmode,
c65ebc55 5240 copy_to_reg (XEXP (operands[2], 0)), Pmode,
7c2b017c 5241 operands[3], Pmode);
c65ebc55
JW
5242 emit_barrier ();
5243 DONE;
1d5d7a21 5244})
c65ebc55 5245
97e242b0
RH
5246;; The rest of the setjmp processing happens with the nonlocal_goto expander.
5247;; ??? This is not tested.
5248(define_expand "builtin_setjmp_setup"
5249 [(use (match_operand:DI 0 "" ""))]
c65ebc55 5250 ""
c65ebc55 5251{
97e242b0
RH
5252 emit_move_insn (ia64_gp_save_reg (0), gen_rtx_REG (DImode, GR_REG (1)));
5253 DONE;
1d5d7a21 5254})
97e242b0
RH
5255
5256(define_expand "builtin_setjmp_receiver"
5257 [(use (match_operand:DI 0 "" ""))]
5258 ""
97e242b0
RH
5259{
5260 emit_move_insn (gen_rtx_REG (DImode, GR_REG (1)), ia64_gp_save_reg (0));
c65ebc55 5261 DONE;
1d5d7a21 5262})
c65ebc55 5263
0c96007e
AM
5264(define_expand "eh_epilogue"
5265 [(use (match_operand:DI 0 "register_operand" "r"))
5266 (use (match_operand:DI 1 "register_operand" "r"))
5267 (use (match_operand:DI 2 "register_operand" "r"))]
5268 ""
0c96007e
AM
5269{
5270 rtx bsp = gen_rtx_REG (Pmode, 10);
5271 rtx sp = gen_rtx_REG (Pmode, 9);
5272
5273 if (GET_CODE (operands[0]) != REG || REGNO (operands[0]) != 10)
5274 {
5275 emit_move_insn (bsp, operands[0]);
5276 operands[0] = bsp;
5277 }
5278 if (GET_CODE (operands[2]) != REG || REGNO (operands[2]) != 9)
5279 {
5280 emit_move_insn (sp, operands[2]);
5281 operands[2] = sp;
5282 }
5283 emit_insn (gen_rtx_USE (VOIDmode, sp));
5284 emit_insn (gen_rtx_USE (VOIDmode, bsp));
5285
5286 cfun->machine->ia64_eh_epilogue_sp = sp;
5287 cfun->machine->ia64_eh_epilogue_bsp = bsp;
1d5d7a21 5288})
9525c690
JW
5289\f
5290;; Builtin apply support.
5291
5292(define_expand "restore_stack_nonlocal"
5293 [(use (match_operand:DI 0 "register_operand" ""))
5294 (use (match_operand:OI 1 "memory_operand" ""))]
5295 ""
9525c690
JW
5296{
5297 emit_library_call (gen_rtx_SYMBOL_REF (Pmode,
1d5d7a21 5298 "__ia64_restore_stack_nonlocal"),
9525c690
JW
5299 0, VOIDmode, 1,
5300 copy_to_reg (XEXP (operands[1], 0)), Pmode);
5301 DONE;
1d5d7a21 5302})
9525c690
JW
5303
5304\f
5305;;; Intrinsics support.
c65ebc55 5306
0551c32d
RH
5307(define_expand "mf"
5308 [(set (mem:BLK (match_dup 0))
086c0f96 5309 (unspec:BLK [(mem:BLK (match_dup 0))] UNSPEC_MF))]
0551c32d 5310 ""
0551c32d
RH
5311{
5312 operands[0] = gen_rtx_MEM (BLKmode, gen_rtx_SCRATCH (DImode));
5313 MEM_VOLATILE_P (operands[0]) = 1;
1d5d7a21 5314})
0551c32d
RH
5315
5316(define_insn "*mf_internal"
5317 [(set (match_operand:BLK 0 "" "")
086c0f96 5318 (unspec:BLK [(match_operand:BLK 1 "" "")] UNSPEC_MF))]
c65ebc55
JW
5319 ""
5320 "mf"
52e12ad0 5321 [(set_attr "itanium_class" "syst_m")])
c65ebc55
JW
5322
5323(define_insn "fetchadd_acq_si"
0551c32d
RH
5324 [(set (match_operand:SI 0 "gr_register_operand" "=r")
5325 (match_dup 1))
5326 (set (match_operand:SI 1 "not_postinc_memory_operand" "+S")
5327 (unspec:SI [(match_dup 1)
086c0f96
RH
5328 (match_operand:SI 2 "fetchadd_operand" "n")]
5329 UNSPEC_FETCHADD_ACQ))]
c65ebc55
JW
5330 ""
5331 "fetchadd4.acq %0 = %1, %2"
52e12ad0 5332 [(set_attr "itanium_class" "sem")])
c65ebc55
JW
5333
5334(define_insn "fetchadd_acq_di"
0551c32d
RH
5335 [(set (match_operand:DI 0 "gr_register_operand" "=r")
5336 (match_dup 1))
5337 (set (match_operand:DI 1 "not_postinc_memory_operand" "+S")
5338 (unspec:DI [(match_dup 1)
086c0f96
RH
5339 (match_operand:DI 2 "fetchadd_operand" "n")]
5340 UNSPEC_FETCHADD_ACQ))]
c65ebc55
JW
5341 ""
5342 "fetchadd8.acq %0 = %1, %2"
52e12ad0 5343 [(set_attr "itanium_class" "sem")])
c65ebc55
JW
5344
5345(define_insn "cmpxchg_acq_si"
0551c32d
RH
5346 [(set (match_operand:SI 0 "gr_register_operand" "=r")
5347 (match_dup 1))
5348 (set (match_operand:SI 1 "not_postinc_memory_operand" "+S")
5349 (unspec:SI [(match_dup 1)
5350 (match_operand:SI 2 "gr_register_operand" "r")
086c0f96
RH
5351 (match_operand:SI 3 "ar_ccv_reg_operand" "")]
5352 UNSPEC_CMPXCHG_ACQ))]
c65ebc55 5353 ""
97e242b0 5354 "cmpxchg4.acq %0 = %1, %2, %3"
52e12ad0 5355 [(set_attr "itanium_class" "sem")])
c65ebc55
JW
5356
5357(define_insn "cmpxchg_acq_di"
0551c32d
RH
5358 [(set (match_operand:DI 0 "gr_register_operand" "=r")
5359 (match_dup 1))
5360 (set (match_operand:DI 1 "not_postinc_memory_operand" "+S")
5361 (unspec:DI [(match_dup 1)
5362 (match_operand:DI 2 "gr_register_operand" "r")
086c0f96
RH
5363 (match_operand:DI 3 "ar_ccv_reg_operand" "")]
5364 UNSPEC_CMPXCHG_ACQ))]
c65ebc55 5365 ""
97e242b0 5366 "cmpxchg8.acq %0 = %1, %2, %3"
52e12ad0 5367 [(set_attr "itanium_class" "sem")])
c65ebc55 5368
c65ebc55 5369(define_insn "xchgsi"
0551c32d
RH
5370 [(set (match_operand:SI 0 "gr_register_operand" "=r")
5371 (match_operand:SI 1 "not_postinc_memory_operand" "+S"))
c65ebc55 5372 (set (match_dup 1)
0551c32d 5373 (match_operand:SI 2 "gr_register_operand" "r"))]
c65ebc55
JW
5374 ""
5375 "xchg4 %0 = %1, %2"
52e12ad0 5376 [(set_attr "itanium_class" "sem")])
c65ebc55
JW
5377
5378(define_insn "xchgdi"
0551c32d
RH
5379 [(set (match_operand:DI 0 "gr_register_operand" "=r")
5380 (match_operand:DI 1 "not_postinc_memory_operand" "+S"))
c65ebc55 5381 (set (match_dup 1)
0551c32d 5382 (match_operand:DI 2 "gr_register_operand" "r"))]
c65ebc55
JW
5383 ""
5384 "xchg8 %0 = %1, %2"
52e12ad0 5385 [(set_attr "itanium_class" "sem")])
e5bde68a
RH
5386\f
5387;; Predication.
5388
5389(define_cond_exec
5390 [(match_operator 0 "predicate_operator"
f2f90c63 5391 [(match_operand:BI 1 "register_operand" "c")
e5bde68a
RH
5392 (const_int 0)])]
5393 ""
5394 "(%J0)")
3b572406
RH
5395
5396(define_insn "pred_rel_mutex"
f2f90c63 5397 [(set (match_operand:BI 0 "register_operand" "+c")
086c0f96 5398 (unspec:BI [(match_dup 0)] UNSPEC_PRED_REL_MUTEX))]
3b572406 5399 ""
054451ea 5400 ".pred.rel.mutex %0, %I0"
52e12ad0 5401 [(set_attr "itanium_class" "ignore")
3b572406 5402 (set_attr "predicable" "no")])
ca3920ad
JW
5403
5404(define_insn "safe_across_calls_all"
086c0f96 5405 [(unspec_volatile [(const_int 0)] UNSPECV_PSAC_ALL)]
ca3920ad
JW
5406 ""
5407 ".pred.safe_across_calls p1-p63"
52e12ad0 5408 [(set_attr "itanium_class" "ignore")
ca3920ad
JW
5409 (set_attr "predicable" "no")])
5410
5411(define_insn "safe_across_calls_normal"
086c0f96 5412 [(unspec_volatile [(const_int 0)] UNSPECV_PSAC_NORMAL)]
ca3920ad 5413 ""
ca3920ad
JW
5414{
5415 emit_safe_across_calls (asm_out_file);
1d5d7a21
RH
5416 return "";
5417}
52e12ad0 5418 [(set_attr "itanium_class" "ignore")
ca3920ad
JW
5419 (set_attr "predicable" "no")])
5420
6dd12198
SE
5421;; UNSPEC instruction definition to "swizzle" 32 bit pointer into 64 bit
5422;; pointer. This is used by the HP-UX 32 bit mode.
5423
5424(define_insn "ptr_extend"
5425 [(set (match_operand:DI 0 "gr_register_operand" "=r")
086c0f96
RH
5426 (unspec:DI [(match_operand:SI 1 "gr_register_operand" "r")]
5427 UNSPEC_ADDP4))]
6dd12198
SE
5428 ""
5429 "addp4 %0 = 0,%1"
5430 [(set_attr "itanium_class" "ialu")])
5431
e206a74f
SE
5432;;
5433;; Optimizations for ptr_extend
5434
5435(define_insn "*ptr_extend_plus_1"
5436 [(set (match_operand:DI 0 "gr_register_operand" "=r")
5437 (unspec:DI
5438 [(plus:SI (match_operand:SI 1 "basereg_operand" "r")
5439 (match_operand:SI 2 "gr_reg_or_14bit_operand" "rI"))]
086c0f96 5440 UNSPEC_ADDP4))]
e206a74f
SE
5441 ""
5442 "addp4 %0 = %2, %1"
5443 [(set_attr "itanium_class" "ialu")])
5444
5445(define_insn "*ptr_extend_plus_2"
5446 [(set (match_operand:DI 0 "gr_register_operand" "=r")
5447 (unspec:DI
5448 [(plus:SI (match_operand:SI 1 "gr_register_operand" "r")
5449 (match_operand:SI 2 "basereg_operand" "r"))]
086c0f96 5450 UNSPEC_ADDP4))]
e206a74f
SE
5451 ""
5452 "addp4 %0 = %1, %2"
5453 [(set_attr "itanium_class" "ialu")])
This page took 1.295984 seconds and 5 git commands to generate.