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