1 ;; IA-64 Machine description template
2 ;; Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008,
3 ;; 2009 Free Software Foundation, Inc.
4 ;; Contributed by James E. Wilson <wilson@cygnus.com> and
5 ;; David Mosberger <davidm@hpl.hp.com>.
7 ;; This file is part of GCC.
9 ;; GCC is free software; you can redistribute it and/or modify
10 ;; it under the terms of the GNU General Public License as published by
11 ;; the Free Software Foundation; either version 3, or (at your option)
14 ;; GCC is distributed in the hope that it will be useful,
15 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
16 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 ;; GNU General Public License for more details.
19 ;; You should have received a copy of the GNU General Public License
20 ;; along with GCC; see the file COPYING3. If not see
21 ;; <http://www.gnu.org/licenses/>.
23 ;;- See file "rtl.def" for documentation on define_insn, match_*, et. al.
25 ;; ??? register_operand accepts (subreg:DI (mem:SI X)) which forces later
26 ;; reload. This will be fixed once scheduling support is turned on.
28 ;; ??? Optimize for post-increment addressing modes.
30 ;; ??? fselect is not supported, because there is no integer register
33 ;; ??? fp abs/min/max instructions may also work for integer values.
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.
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.
41 ;; ??? Go through list of documented named patterns and look for more to
44 ;; ??? Go through instruction manual and look for more instructions that
47 ;; ??? Add function unit scheduling info for Itanium (TM) processor.
49 ;; ??? Need a better way to describe alternate fp status registers.
53 (UNSPEC_LTOFF_DTPMOD 0)
54 (UNSPEC_LTOFF_DTPREL 1)
56 (UNSPEC_LTOFF_TPREL 3)
62 (UNSPEC_GR_RESTORE 11)
64 (UNSPEC_FR_RESTORE 13)
65 (UNSPEC_FR_RECIP_APPROX 14)
66 (UNSPEC_PRED_REL_MUTEX 15)
70 (UNSPEC_CMPXCHG_ACQ 19)
71 (UNSPEC_FETCHADD_ACQ 20)
74 (UNSPEC_BUNDLE_SELECTOR 23)
76 (UNSPEC_PROLOGUE_USE 25)
79 (UNSPEC_FR_SQRT_RECIP_APPROX 28)
92 (UNSPEC_FR_RECIP_APPROX_RES 49)
93 (UNSPEC_FR_SQRT_RECIP_APPROX_RES 50)
99 (UNSPECV_INSN_GROUP_BARRIER 2)
102 (UNSPECV_PSAC_ALL 5) ; pred.safe_across_calls
103 (UNSPECV_PSAC_NORMAL 6)
104 (UNSPECV_SETJMP_RECEIVER 7)
105 (UNSPECV_GOTO_RECEIVER 8)
108 (include "predicates.md")
109 (include "constraints.md")
111 ;; ::::::::::::::::::::
115 ;; ::::::::::::::::::::
117 ;; Processor type. This attribute must exactly match the processor_type
118 ;; enumeration in ia64.h.
119 (define_attr "cpu" "itanium,itanium2"
120 (const (symbol_ref "((enum attr_cpu) ia64_tune)")))
122 ;; Instruction type. This primarily determines how instructions can be
123 ;; packed in bundles, and secondarily affects scheduling to function units.
125 ;; A alu, can go in I or M syllable of a bundle
130 ;; L long immediate, takes two syllables
133 ;; ??? Should not have any pattern with type unknown. Perhaps add code to
134 ;; check this in md_reorg? Currently use unknown for patterns which emit
135 ;; multiple instructions, patterns which emit 0 instructions, and patterns
136 ;; which emit instruction that can go in any slot (e.g. nop).
138 (define_attr "itanium_class" "unknown,ignore,stop_bit,br,fcmp,fcvtfx,fld,
139 fldp,fmac,fmisc,frar_i,frar_m,frbr,frfr,frpr,ialu,icmp,ilog,ishf,
140 ld,chk_s_i,chk_s_f,chk_a,long_i,mmalua,mmmul,mmshf,mmshfi,rse_m,scall,sem,stf,
141 st,syst_m0, syst_m,tbit,toar_i,toar_m,tobr,tofr,topr,xmpy,xtd,nop,
142 nop_b,nop_f,nop_i,nop_m,nop_x,lfetch,pre_cycle"
143 (const_string "unknown"))
145 ;; chk_s_i has an I and an M form; use type A for convenience.
146 (define_attr "type" "unknown,A,I,M,F,B,L,X,S"
147 (cond [(eq_attr "itanium_class" "ld,st,fld,fldp,stf,sem,nop_m") (const_string "M")
148 (eq_attr "itanium_class" "rse_m,syst_m,syst_m0") (const_string "M")
149 (eq_attr "itanium_class" "frar_m,toar_m,frfr,tofr") (const_string "M")
150 (eq_attr "itanium_class" "lfetch") (const_string "M")
151 (eq_attr "itanium_class" "chk_s_f,chk_a") (const_string "M")
152 (eq_attr "itanium_class" "chk_s_i,ialu,icmp,ilog,mmalua")
154 (eq_attr "itanium_class" "fmisc,fmac,fcmp,xmpy") (const_string "F")
155 (eq_attr "itanium_class" "fcvtfx,nop_f") (const_string "F")
156 (eq_attr "itanium_class" "frar_i,toar_i,frbr,tobr") (const_string "I")
157 (eq_attr "itanium_class" "frpr,topr,ishf,xtd,tbit") (const_string "I")
158 (eq_attr "itanium_class" "mmmul,mmshf,mmshfi,nop_i") (const_string "I")
159 (eq_attr "itanium_class" "br,scall,nop_b") (const_string "B")
160 (eq_attr "itanium_class" "stop_bit") (const_string "S")
161 (eq_attr "itanium_class" "nop_x") (const_string "X")
162 (eq_attr "itanium_class" "long_i") (const_string "L")]
163 (const_string "unknown")))
165 (define_attr "itanium_requires_unit0" "no,yes"
166 (cond [(eq_attr "itanium_class" "syst_m0,sem,frfr,rse_m") (const_string "yes")
167 (eq_attr "itanium_class" "toar_m,frar_m") (const_string "yes")
168 (eq_attr "itanium_class" "frbr,tobr,mmmul") (const_string "yes")
169 (eq_attr "itanium_class" "tbit,ishf,topr,frpr") (const_string "yes")
170 (eq_attr "itanium_class" "toar_i,frar_i") (const_string "yes")
171 (eq_attr "itanium_class" "fmisc,fcmp") (const_string "yes")]
172 (const_string "no")))
174 ;; Predication. True iff this instruction can be predicated.
176 (define_attr "predicable" "no,yes" (const_string "yes"))
178 ;; Empty. True iff this insn does not generate any code.
180 (define_attr "empty" "no,yes" (const_string "no"))
182 ;; True iff this insn must be the first insn of an instruction group.
183 ;; This is true for the alloc instruction, and will also be true of others
184 ;; when we have full intrinsics support.
186 (define_attr "first_insn" "no,yes" (const_string "no"))
188 (define_attr "data_speculative" "no,yes" (const_string "no"))
190 (define_attr "control_speculative" "no,yes" (const_string "no"))
192 (define_attr "check_load" "no,yes" (const_string "no"))
194 (define_attr "speculable1" "no,yes" (const_string "no"))
196 (define_attr "speculable2" "no,yes" (const_string "no"))
198 ;; DFA descriptions of ia64 processors used for insn scheduling and
201 (automata_option "ndfa")
203 ;; Uncomment the following line to output automata for debugging.
204 ;; (automata_option "v")
206 (automata_option "w")
208 (include "itanium1.md")
209 (include "itanium2.md")
212 ;; ::::::::::::::::::::
216 ;; ::::::::::::::::::::
218 ;; Set of a single predicate register. This is only used to implement
219 ;; pr-to-pr move and complement.
221 (define_insn "*movcci"
222 [(set (match_operand:CCI 0 "register_operand" "=c,c,c")
223 (match_operand:CCI 1 "nonmemory_operand" "O,n,c"))]
226 cmp.ne %0, p0 = r0, r0
227 cmp.eq %0, p0 = r0, r0
228 (%1) cmp.eq.unc %0, p0 = r0, r0"
229 [(set_attr "itanium_class" "icmp")
230 (set_attr "predicable" "no")])
233 [(set (match_operand:BI 0 "destination_operand" "=c,c,?c,?*r, c,*r,*r,*m,*r")
234 (match_operand:BI 1 "move_operand" " O,n, c, c,*r, n,*m,*r,*r"))]
237 cmp.ne %0, %I0 = r0, r0
238 cmp.eq %0, %I0 = r0, r0
241 tbit.nz %0, %I0 = %1, 0
246 [(set_attr "itanium_class" "icmp,icmp,unknown,unknown,tbit,ialu,ld,st,ialu")
247 (set_attr "speculable1" "yes")
248 (set_attr "speculable2" "no, no, no, no, no, no, yes,no,no")])
251 [(set (match_operand:BI 0 "register_operand" "")
252 (match_operand:BI 1 "register_operand" ""))]
254 && GET_CODE (operands[0]) == REG && GR_REGNO_P (REGNO (operands[0]))
255 && GET_CODE (operands[1]) == REG && PR_REGNO_P (REGNO (operands[1]))"
256 [(cond_exec (ne (match_dup 1) (const_int 0))
257 (set (match_dup 0) (const_int 1)))
258 (cond_exec (eq (match_dup 1) (const_int 0))
259 (set (match_dup 0) (const_int 0)))]
263 [(set (match_operand:BI 0 "register_operand" "")
264 (match_operand:BI 1 "register_operand" ""))]
266 && GET_CODE (operands[0]) == REG && PR_REGNO_P (REGNO (operands[0]))
267 && GET_CODE (operands[1]) == REG && PR_REGNO_P (REGNO (operands[1]))"
268 [(set (match_dup 2) (match_dup 4))
269 (set (match_dup 3) (match_dup 5))
270 (set (match_dup 0) (unspec:BI [(match_dup 0)] UNSPEC_PRED_REL_MUTEX))]
271 "operands[2] = gen_rtx_REG (CCImode, REGNO (operands[0]));
272 operands[3] = gen_rtx_REG (CCImode, REGNO (operands[0]) + 1);
273 operands[4] = gen_rtx_REG (CCImode, REGNO (operands[1]));
274 operands[5] = gen_rtx_REG (CCImode, REGNO (operands[1]) + 1);")
276 (define_expand "movqi"
277 [(set (match_operand:QI 0 "general_operand" "")
278 (match_operand:QI 1 "general_operand" ""))]
281 rtx op1 = ia64_expand_move (operands[0], operands[1]);
287 (define_insn "movqi_internal"
288 [(set (match_operand:QI 0 "destination_operand" "=r,r,r, m, r,*f,*f")
289 (match_operand:QI 1 "move_operand" "rO,J,m,rO,*f,rO,*f"))]
290 "ia64_move_ok (operands[0], operands[1])"
299 [(set_attr "itanium_class" "ialu,ialu,ld,st,frfr,tofr,fmisc")
300 (set_attr "speculable1" "yes")
301 (set_attr "speculable2" "no, no, yes,no,no, no, no")])
303 (define_expand "movhi"
304 [(set (match_operand:HI 0 "general_operand" "")
305 (match_operand:HI 1 "general_operand" ""))]
308 rtx op1 = ia64_expand_move (operands[0], operands[1]);
314 (define_insn "movhi_internal"
315 [(set (match_operand:HI 0 "destination_operand" "=r,r,r, m, r,*f,*f")
316 (match_operand:HI 1 "move_operand" "rO,J,m,rO,*f,rO,*f"))]
317 "ia64_move_ok (operands[0], operands[1])"
326 [(set_attr "itanium_class" "ialu,ialu,ld,st,frfr,tofr,fmisc")
327 (set_attr "speculable1" "yes")
328 (set_attr "speculable2" "no, no, yes,no,no, no, no")])
330 (define_expand "movsi"
331 [(set (match_operand:SI 0 "general_operand" "")
332 (match_operand:SI 1 "general_operand" ""))]
335 rtx op1 = ia64_expand_move (operands[0], operands[1]);
341 (define_insn "movsi_internal"
342 [(set (match_operand:SI 0 "destination_operand" "=r,r,r,r,r, m, r,*f,*f, r,*d")
343 (match_operand:SI 1 "move_operand" "rO,J,j,i,m,rO,*f,rO,*f,*d,rK"))]
344 "ia64_move_ok (operands[0], operands[1])"
348 addp4 %0 = %1 - 0x100000000, r0
357 ;; frar_m, toar_m ??? why not frar_i and toar_i
358 [(set_attr "itanium_class" "ialu,ialu,ialu,long_i,ld,st,frfr,tofr,fmisc,frar_m,toar_m")
359 (set_attr "speculable1" "yes")
360 (set_attr "speculable2" "no, no, no, no, yes,no,no, no, no, no, no")])
362 (define_expand "movdi"
363 [(set (match_operand:DI 0 "general_operand" "")
364 (match_operand:DI 1 "general_operand" ""))]
367 rtx op1 = ia64_expand_move (operands[0], operands[1]);
373 (define_insn "movdi_internal"
374 [(set (match_operand:DI 0 "destination_operand"
375 "=r,r,r,r,r, m, r,*f,*f,*f, Q, r,*b, r,*e, r,*d, r,*c")
376 (match_operand:DI 1 "move_operand"
377 "rO,JT,j,i,m,rO,*f,rO,*f, Q,*f,*b,rO,*e,rK,*d,rK,*c,rO"))]
378 "ia64_move_ok (operands[0], operands[1])"
380 static const char * const alt[] = {
382 "%,addl %0 = %1, r0",
383 "%,addp4 %0 = %1 - 0x100000000, r0",
385 "%,ld8%O1 %0 = %1%P1",
386 "%,st8%Q0 %0 = %r1%P0",
387 "%,getf.sig %0 = %1",
388 "%,setf.sig %0 = %r1",
402 gcc_assert (which_alternative != 2 || TARGET_NO_PIC
403 || !symbolic_operand (operands[1], VOIDmode));
405 return alt[which_alternative];
407 [(set_attr "itanium_class" "ialu,ialu,ialu,long_i,ld,st,frfr,tofr,fmisc,fld,stf,frbr,tobr,frar_i,toar_i,frar_m,toar_m,frpr,topr")
408 (set_attr "speculable1" "yes")
409 (set_attr "speculable2" "no, no, no, no, yes,no,no, no, no, yes,no, no, no, no, no, no, no, no, no")])
411 (define_mode_iterator MODE [BI QI HI SI DI SF DF XF TI])
412 (define_mode_iterator MODE_FOR_EXTEND [QI HI SI])
414 (define_mode_attr output_a [
415 (BI "ld1.a %0 = %1%P1")
416 (QI "ld1.a %0 = %1%P1")
417 (HI "ld2.a %0 = %1%P1")
418 (SI "ld4.a %0 = %1%P1")
431 (XF "ldfe.a %0 = %1%P1")
432 (TI "ldfp8.a %X0 = %1%P1")])
434 (define_mode_attr output_s [
435 (BI "ld1.s %0 = %1%P1")
436 (QI "ld1.s %0 = %1%P1")
437 (HI "ld2.s %0 = %1%P1")
438 (SI "ld4.s %0 = %1%P1")
451 (XF "ldfe.s %0 = %1%P1")
452 (TI "ldfp8.s %X0 = %1%P1")])
454 (define_mode_attr output_sa [
455 (BI "ld1.sa %0 = %1%P1")
456 (QI "ld1.sa %0 = %1%P1")
457 (HI "ld2.sa %0 = %1%P1")
458 (SI "ld4.sa %0 = %1%P1")
471 (XF "ldfe.sa %0 = %1%P1")
472 (TI "ldfp8.sa %X0 = %1%P1")])
474 (define_mode_attr output_c_clr [
475 (BI "ld1.c.clr%O1 %0 = %1%P1")
476 (QI "ld1.c.clr%O1 %0 = %1%P1")
477 (HI "ld2.c.clr%O1 %0 = %1%P1")
478 (SI "ld4.c.clr%O1 %0 = %1%P1")
481 ld8.c.clr%O1 %0 = %1%P1
482 ldf8.c.clr %0 = %1%P1")
485 ldfs.c.clr %0 = %1%P1
486 ld4.c.clr%O1 %0 = %1%P1")
489 ldfd.c.clr %0 = %1%P1
490 ld8.c.clr%O1 %0 = %1%P1")
491 (XF "ldfe.c.clr %0 = %1%P1")
492 (TI "ldfp8.c.clr %X0 = %1%P1")])
494 (define_mode_attr output_c_nc [
495 (BI "ld1.c.nc%O1 %0 = %1%P1")
496 (QI "ld1.c.nc%O1 %0 = %1%P1")
497 (HI "ld2.c.nc%O1 %0 = %1%P1")
498 (SI "ld4.c.nc%O1 %0 = %1%P1")
501 ld8.c.nc%O1 %0 = %1%P1
502 ldf8.c.nc %0 = %1%P1")
506 ld4.c.nc%O1 %0 = %1%P1")
510 ld8.c.nc%O1 %0 = %1%P1")
511 (XF "ldfe.c.nc %0 = %1%P1")
512 (TI "ldfp8.c.nc %X0 = %1%P1")])
514 (define_mode_attr ld_reg_constr [(BI "=*r") (QI "=r") (HI "=r") (SI "=r") (DI "=r,*f") (SF "=f,*r") (DF "=f,*r") (XF "=f") (TI "=*x")])
515 (define_mode_attr ldc_reg_constr [(BI "+*r") (QI "+r") (HI "+r") (SI "+r") (DI "+r,*f") (SF "+f,*r") (DF "+f,*r") (XF "+f") (TI "+*x")])
516 (define_mode_attr chk_reg_constr [(BI "*r") (QI "r") (HI "r") (SI "r") (DI "r,*f") (SF "f,*r") (DF "f,*r") (XF "f") (TI "*x")])
518 (define_mode_attr mem_constr [(BI "*m") (QI "m") (HI "m") (SI "m") (DI "m,Q") (SF "Q,m") (DF "Q,m") (XF "m") (TI "Q")])
520 ;; Define register predicate prefix.
521 ;; We can generate speculative loads only for general and fp registers - this
522 ;; is constrained in ia64.c: ia64_speculate_insn ().
523 (define_mode_attr reg_pred_prefix [(BI "gr") (QI "gr") (HI "gr") (SI "gr") (DI "grfr") (SF "grfr") (DF "grfr") (XF "fr") (TI "fr")])
525 (define_mode_attr ld_class [(BI "ld") (QI "ld") (HI "ld") (SI "ld") (DI "ld,fld") (SF "fld,ld") (DF "fld,ld") (XF "fld") (TI "fldp")])
526 (define_mode_attr chka_class [(BI "chk_a") (QI "chk_a") (HI "chk_a") (SI "chk_a") (DI "chk_a,chk_a") (SF "chk_a,chk_a") (DF "chk_a,chk_a") (XF "chk_a") (TI "chk_a")])
527 (define_mode_attr chks_class [(BI "chk_s_i") (QI "chk_s_i") (HI "chk_s_i") (SI "chk_s_i") (DI "chk_s_i,chk_s_f") (SF "chk_s_f,chk_s_i") (DF "chk_s_f,chk_s_i") (XF "chk_s_f") (TI "chk_s_i")])
529 (define_mode_attr attr_yes [(BI "yes") (QI "yes") (HI "yes") (SI "yes") (DI "yes,yes") (SF "yes,yes") (DF "yes,yes") (XF "yes") (TI "yes")])
531 (define_insn "mov<mode>_advanced"
532 [(set (match_operand:MODE 0 "<reg_pred_prefix>_register_operand" "<ld_reg_constr>")
533 (unspec:MODE [(match_operand:MODE 1 "memory_operand" "<mem_constr>")] UNSPEC_LDA))]
534 "ia64_move_ok (operands[0], operands[1])"
536 [(set_attr "itanium_class" "<ld_class>")
537 (set_attr "data_speculative" "<attr_yes>")])
539 (define_insn "zero_extend<mode>di2_advanced"
540 [(set (match_operand:DI 0 "gr_register_operand" "=r")
541 (zero_extend:DI (unspec:MODE_FOR_EXTEND [(match_operand:MODE_FOR_EXTEND 1 "memory_operand" "<mem_constr>")] UNSPEC_LDA)))]
544 [(set_attr "itanium_class" "<ld_class>")
545 (set_attr "data_speculative" "<attr_yes>")])
547 (define_insn "mov<mode>_speculative"
548 [(set (match_operand:MODE 0 "<reg_pred_prefix>_register_operand" "<ld_reg_constr>")
549 (unspec:MODE [(match_operand:MODE 1 "memory_operand" "<mem_constr>")] UNSPEC_LDS))]
550 "ia64_move_ok (operands[0], operands[1])"
552 [(set_attr "itanium_class" "<ld_class>")
553 (set_attr "control_speculative" "<attr_yes>")])
555 (define_insn "zero_extend<mode>di2_speculative"
556 [(set (match_operand:DI 0 "gr_register_operand" "=r")
557 (zero_extend:DI (unspec:MODE_FOR_EXTEND [(match_operand:MODE_FOR_EXTEND 1 "memory_operand" "<mem_constr>")] UNSPEC_LDS)))]
560 [(set_attr "itanium_class" "<ld_class>")
561 (set_attr "control_speculative" "<attr_yes>")])
563 (define_insn "mov<mode>_speculative_advanced"
564 [(set (match_operand:MODE 0 "<reg_pred_prefix>_register_operand" "<ld_reg_constr>")
565 (unspec:MODE [(match_operand:MODE 1 "memory_operand" "<mem_constr>")] UNSPEC_LDSA))]
566 "ia64_move_ok (operands[0], operands[1])"
568 [(set_attr "itanium_class" "<ld_class>")
569 (set_attr "data_speculative" "<attr_yes>")
570 (set_attr "control_speculative" "<attr_yes>")])
572 (define_insn "mov<mode>_speculative_a"
573 [(set (match_operand:MODE 0 "<reg_pred_prefix>_register_operand" "<ld_reg_constr>")
574 (unspec:MODE [(match_operand:MODE 1 "memory_operand" "<mem_constr>")] UNSPEC_LDS_A))]
575 "ia64_move_ok (operands[0], operands[1])"
577 [(set_attr "itanium_class" "<ld_class>")
578 (set_attr "data_speculative" "<attr_yes>")
579 (set_attr "control_speculative" "<attr_yes>")])
581 (define_insn "zero_extend<mode>di2_speculative_advanced"
582 [(set (match_operand:DI 0 "gr_register_operand" "=r")
583 (zero_extend:DI (unspec:MODE_FOR_EXTEND [(match_operand:MODE_FOR_EXTEND 1 "memory_operand" "<mem_constr>")] UNSPEC_LDSA)))]
586 [(set_attr "itanium_class" "<ld_class>")
587 (set_attr "data_speculative" "<attr_yes>")
588 (set_attr "control_speculative" "<attr_yes>")])
590 (define_insn "zero_extend<mode>di2_speculative_a"
591 [(set (match_operand:DI 0 "gr_register_operand" "=r")
592 (zero_extend:DI (unspec:MODE_FOR_EXTEND [(match_operand:MODE_FOR_EXTEND 1 "memory_operand" "<mem_constr>")] UNSPEC_LDS_A)))]
595 [(set_attr "itanium_class" "<ld_class>")
596 (set_attr "data_speculative" "<attr_yes>")
597 (set_attr "control_speculative" "<attr_yes>")])
599 (define_insn "mov<mode>_clr"
600 [(set (match_operand:MODE 0 "<reg_pred_prefix>_register_operand" "<ldc_reg_constr>")
601 (if_then_else:MODE (ne (unspec [(match_dup 0)] UNSPEC_LDCCLR) (const_int 0))
602 (match_operand:MODE 1 "memory_operand" "<mem_constr>")
604 "ia64_move_ok (operands[0], operands[1])"
606 [(set_attr "itanium_class" "<ld_class>")
607 (set_attr "check_load" "<attr_yes>")])
609 (define_insn "mov<mode>_nc"
610 [(set (match_operand:MODE 0 "<reg_pred_prefix>_register_operand" "<ldc_reg_constr>")
611 (if_then_else:MODE (ne (unspec [(match_dup 0)] UNSPEC_LDCNC) (const_int 0))
612 (match_operand:MODE 1 "memory_operand" "<mem_constr>")
614 "ia64_move_ok (operands[0], operands[1])"
616 [(set_attr "itanium_class" "<ld_class>")
617 (set_attr "check_load" "<attr_yes>")])
619 (define_insn "zero_extend<mode>di2_clr"
620 [(set (match_operand:DI 0 "gr_register_operand" "+r")
621 (if_then_else:DI (ne (unspec [(match_dup 0)] UNSPEC_LDCCLR) (const_int 0))
622 (zero_extend:DI (match_operand:MODE_FOR_EXTEND 1 "memory_operand" "<mem_constr>"))
626 [(set_attr "itanium_class" "<ld_class>")
627 (set_attr "check_load" "<attr_yes>")])
629 (define_insn "zero_extend<mode>di2_nc"
630 [(set (match_operand:DI 0 "gr_register_operand" "+r")
631 (if_then_else:DI (ne (unspec [(match_dup 0)] UNSPEC_LDCNC) (const_int 0))
632 (zero_extend:DI (match_operand:MODE_FOR_EXTEND 1 "memory_operand" "<mem_constr>"))
636 [(set_attr "itanium_class" "<ld_class>")
637 (set_attr "check_load" "<attr_yes>")])
639 (define_insn "advanced_load_check_clr_<mode>"
641 (if_then_else (ne (unspec [(match_operand:MODE 0 "<reg_pred_prefix>_register_operand" "<chk_reg_constr>")] UNSPEC_CHKACLR) (const_int 0))
643 (label_ref (match_operand 1 "" ""))))]
646 [(set_attr "itanium_class" "<chka_class>")])
648 (define_insn "advanced_load_check_nc_<mode>"
650 (if_then_else (ne (unspec [(match_operand:MODE 0 "<reg_pred_prefix>_register_operand" "<chk_reg_constr>")] UNSPEC_CHKANC) (const_int 0))
652 (label_ref (match_operand 1 "" ""))))]
655 [(set_attr "itanium_class" "<chka_class>")])
657 (define_insn "speculation_check_<mode>"
659 (if_then_else (ne (unspec [(match_operand:MODE 0 "<reg_pred_prefix>_register_operand" "<chk_reg_constr>")] UNSPEC_CHKS) (const_int 0))
661 (label_ref (match_operand 1 "" ""))))]
664 [(set_attr "itanium_class" "<chks_class>")])
667 [(set (match_operand 0 "register_operand" "")
668 (match_operand 1 "symbolic_operand" ""))]
672 if (ia64_expand_load_address (operands[0], operands[1]))
678 (define_expand "load_fptr"
679 [(set (match_operand:DI 0 "register_operand" "")
680 (plus:DI (match_dup 2) (match_operand 1 "function_operand" "")))
681 (set (match_dup 0) (match_dup 3))]
684 operands[2] = pic_offset_table_rtx;
685 operands[3] = gen_const_mem (DImode, operands[0]);
688 (define_insn "*load_fptr_internal1"
689 [(set (match_operand:DI 0 "register_operand" "=r")
690 (plus:DI (reg:DI 1) (match_operand 1 "function_operand" "s")))]
692 "addl %0 = @ltoff(@fptr(%1)), gp"
693 [(set_attr "itanium_class" "ialu")])
695 (define_insn "load_gprel"
696 [(set (match_operand:DI 0 "register_operand" "=r")
697 (plus:DI (reg:DI 1) (match_operand 1 "sdata_symbolic_operand" "s")))]
699 "addl %0 = @gprel(%1), gp"
700 [(set_attr "itanium_class" "ialu")])
702 (define_insn "*gprel64_offset"
703 [(set (match_operand:DI 0 "register_operand" "=r")
704 (minus:DI (match_operand:DI 1 "symbolic_operand" "") (reg:DI 1)))]
706 "movl %0 = @gprel(%1)"
707 [(set_attr "itanium_class" "long_i")])
709 (define_expand "load_gprel64"
710 [(set (match_operand:DI 0 "register_operand" "")
711 (minus:DI (match_operand:DI 1 "symbolic_operand" "") (match_dup 2)))
713 (plus:DI (match_dup 2) (match_dup 0)))]
716 operands[2] = pic_offset_table_rtx;
719 ;; This is used as a placeholder for the return address during early
720 ;; compilation. We won't know where we've placed this until during
721 ;; reload, at which point it can wind up in b0, a general register,
722 ;; or memory. The only safe destination under these conditions is a
725 (define_insn_and_split "*movdi_ret_addr"
726 [(set (match_operand:DI 0 "register_operand" "=r")
727 (unspec:DI [(const_int 0)] UNSPEC_RET_ADDR))]
733 ia64_split_return_addr_rtx (operands[0]);
736 [(set_attr "itanium_class" "ialu")])
738 (define_insn "*load_symptr_high"
739 [(set (match_operand:DI 0 "register_operand" "=r")
740 (plus:DI (high:DI (match_operand 1 "got_symbolic_operand" "s"))
741 (match_operand:DI 2 "register_operand" "a")))]
744 if (HAVE_AS_LTOFFX_LDXMOV_RELOCS)
745 return "%,addl %0 = @ltoffx(%1), %2";
747 return "%,addl %0 = @ltoff(%1), %2";
749 [(set_attr "itanium_class" "ialu")])
751 (define_insn "*load_symptr_low"
752 [(set (match_operand:DI 0 "register_operand" "=r")
753 (lo_sum:DI (match_operand:DI 1 "register_operand" "r")
754 (match_operand 2 "got_symbolic_operand" "s")))]
757 if (HAVE_AS_LTOFFX_LDXMOV_RELOCS)
758 return "%,ld8.mov %0 = [%1], %2";
760 return "%,ld8 %0 = [%1]";
762 [(set_attr "itanium_class" "ld")])
764 (define_insn_and_split "load_dtpmod"
765 [(set (match_operand:DI 0 "register_operand" "=r")
766 (unspec:DI [(match_operand 1 "tls_symbolic_operand" "")]
772 (plus:DI (unspec:DI [(match_dup 1)] UNSPEC_LTOFF_DTPMOD)
774 (set (match_dup 0) (match_dup 3))]
776 operands[2] = pic_offset_table_rtx;
777 operands[3] = gen_const_mem (DImode, operands[0]);
780 (define_insn "*load_ltoff_dtpmod"
781 [(set (match_operand:DI 0 "register_operand" "=r")
782 (plus:DI (unspec:DI [(match_operand 1 "tls_symbolic_operand" "")]
784 (match_operand:DI 2 "register_operand" "a")))]
786 "addl %0 = @ltoff(@dtpmod(%1)), %2"
787 [(set_attr "itanium_class" "ialu")])
789 (define_expand "load_dtprel"
790 [(set (match_operand:DI 0 "register_operand" "")
791 (unspec:DI [(match_operand 1 "tls_symbolic_operand" "")]
796 (define_insn "*load_dtprel64"
797 [(set (match_operand:DI 0 "register_operand" "=r")
798 (unspec:DI [(match_operand 1 "ld_tls_symbolic_operand" "")]
801 "movl %0 = @dtprel(%1)"
802 [(set_attr "itanium_class" "long_i")])
804 (define_insn "*load_dtprel22"
805 [(set (match_operand:DI 0 "register_operand" "=r")
806 (unspec:DI [(match_operand 1 "ld_tls_symbolic_operand" "")]
809 "addl %0 = @dtprel(%1), r0"
810 [(set_attr "itanium_class" "ialu")])
812 (define_insn_and_split "*load_dtprel_gd"
813 [(set (match_operand:DI 0 "register_operand" "=r")
814 (unspec:DI [(match_operand 1 "tls_symbolic_operand" "")]
820 (plus:DI (unspec:DI [(match_dup 1)] UNSPEC_LTOFF_DTPREL)
822 (set (match_dup 0) (match_dup 3))]
824 operands[2] = pic_offset_table_rtx;
825 operands[3] = gen_const_mem (DImode, operands[0]);
828 (define_insn "*load_ltoff_dtprel"
829 [(set (match_operand:DI 0 "register_operand" "=r")
830 (plus:DI (unspec:DI [(match_operand 1 "tls_symbolic_operand" "")]
832 (match_operand:DI 2 "register_operand" "a")))]
834 "addl %0 = @ltoff(@dtprel(%1)), %2"
835 [(set_attr "itanium_class" "ialu")])
837 (define_expand "add_dtprel"
838 [(set (match_operand:DI 0 "register_operand" "")
839 (plus:DI (unspec:DI [(match_operand 1 "ld_tls_symbolic_operand" "")]
841 (match_operand:DI 2 "register_operand" "")))]
845 (define_insn "*add_dtprel14"
846 [(set (match_operand:DI 0 "register_operand" "=r")
847 (plus:DI (unspec:DI [(match_operand 1 "ld_tls_symbolic_operand" "")]
849 (match_operand:DI 2 "register_operand" "r")))]
851 "adds %0 = @dtprel(%1), %2"
852 [(set_attr "itanium_class" "ialu")])
854 (define_insn "*add_dtprel22"
855 [(set (match_operand:DI 0 "register_operand" "=r")
856 (plus:DI (unspec:DI [(match_operand 1 "ld_tls_symbolic_operand" "")]
858 (match_operand:DI 2 "register_operand" "a")))]
860 "addl %0 = @dtprel(%1), %2"
861 [(set_attr "itanium_class" "ialu")])
863 (define_expand "load_tprel"
864 [(set (match_operand:DI 0 "register_operand" "")
865 (unspec:DI [(match_operand 1 "tls_symbolic_operand" "")]
870 (define_insn "*load_tprel64"
871 [(set (match_operand:DI 0 "register_operand" "=r")
872 (unspec:DI [(match_operand 1 "le_tls_symbolic_operand" "")]
875 "movl %0 = @tprel(%1)"
876 [(set_attr "itanium_class" "long_i")])
878 (define_insn "*load_tprel22"
879 [(set (match_operand:DI 0 "register_operand" "=r")
880 (unspec:DI [(match_operand 1 "le_tls_symbolic_operand" "")]
883 "addl %0 = @tprel(%1), r0"
884 [(set_attr "itanium_class" "ialu")])
886 (define_insn_and_split "*load_tprel_ie"
887 [(set (match_operand:DI 0 "register_operand" "=r")
888 (unspec:DI [(match_operand 1 "ie_tls_symbolic_operand" "")]
894 (plus:DI (unspec:DI [(match_dup 1)] UNSPEC_LTOFF_TPREL)
896 (set (match_dup 0) (match_dup 3))]
898 operands[2] = pic_offset_table_rtx;
899 operands[3] = gen_const_mem (DImode, operands[0]);
902 (define_insn "*load_ltoff_tprel"
903 [(set (match_operand:DI 0 "register_operand" "=r")
904 (plus:DI (unspec:DI [(match_operand 1 "ie_tls_symbolic_operand" "")]
906 (match_operand:DI 2 "register_operand" "a")))]
908 "addl %0 = @ltoff(@tprel(%1)), %2"
909 [(set_attr "itanium_class" "ialu")])
911 (define_expand "add_tprel"
912 [(set (match_operand:DI 0 "register_operand" "")
913 (plus:DI (unspec:DI [(match_operand 1 "le_tls_symbolic_operand" "")]
915 (match_operand:DI 2 "register_operand" "")))]
919 (define_insn "*add_tprel14"
920 [(set (match_operand:DI 0 "register_operand" "=r")
921 (plus:DI (unspec:DI [(match_operand 1 "le_tls_symbolic_operand" "")]
923 (match_operand:DI 2 "register_operand" "r")))]
925 "adds %0 = @tprel(%1), %2"
926 [(set_attr "itanium_class" "ialu")])
928 (define_insn "*add_tprel22"
929 [(set (match_operand:DI 0 "register_operand" "=r")
930 (plus:DI (unspec:DI [(match_operand 1 "le_tls_symbolic_operand" "")]
932 (match_operand:DI 2 "register_operand" "a")))]
934 "addl %0 = @tprel(%1), %2"
935 [(set_attr "itanium_class" "ialu")])
937 ;; With no offsettable memory references, we've got to have a scratch
938 ;; around to play with the second word. However, in order to avoid a
939 ;; reload nightmare we lie, claim we don't need one, and fix it up
940 ;; in ia64_split_tmode_move.
941 (define_expand "movti"
942 [(set (match_operand:TI 0 "general_operand" "")
943 (match_operand:TI 1 "general_operand" ""))]
946 rtx op1 = ia64_expand_move (operands[0], operands[1]);
952 (define_insn_and_split "movti_internal"
953 [(set (match_operand:TI 0 "destination_operand" "=r, *fm,*x,*f, Q")
954 (match_operand:TI 1 "general_operand" "r*fim,r, Q, *fOQ,*f"))]
955 "ia64_move_ok (operands[0], operands[1])"
962 "reload_completed && !ia64_load_pair_ok(operands[0], operands[1])"
965 ia64_split_tmode_move (operands);
968 [(set_attr "itanium_class" "unknown,unknown,fldp,unknown,unknown")
969 (set_attr "speculable1" "yes")
970 (set_attr "speculable2" "no, no, yes, no, no")])
972 ;; Floating Point Moves
974 ;; Note - Patterns for SF mode moves are compulsory, but
975 ;; patterns for DF are optional, as GCC can synthesize them.
977 (define_expand "movsf"
978 [(set (match_operand:SF 0 "general_operand" "")
979 (match_operand:SF 1 "general_operand" ""))]
982 rtx op1 = ia64_expand_move (operands[0], operands[1]);
988 (define_insn "movsf_internal"
989 [(set (match_operand:SF 0 "destination_operand" "=f,f, Q,*r, f,*r,*r, m")
990 (match_operand:SF 1 "general_operand" "fG,Q,fG,fG,*r,*r, m,*r"))]
991 "ia64_move_ok (operands[0], operands[1])"
1001 [(set_attr "itanium_class" "fmisc,fld,stf,frfr,tofr,ialu,ld,st")
1002 (set_attr "speculable1" "yes")
1003 (set_attr "speculable2" "no, yes,no, no, no, no, yes,no")])
1005 (define_expand "movdf"
1006 [(set (match_operand:DF 0 "general_operand" "")
1007 (match_operand:DF 1 "general_operand" ""))]
1010 rtx op1 = ia64_expand_move (operands[0], operands[1]);
1016 (define_insn "movdf_internal"
1017 [(set (match_operand:DF 0 "destination_operand" "=f,f, Q,*r, f,*r,*r, m")
1018 (match_operand:DF 1 "general_operand" "fG,Q,fG,fG,*r,*r, m,*r"))]
1019 "ia64_move_ok (operands[0], operands[1])"
1029 [(set_attr "itanium_class" "fmisc,fld,stf,frfr,tofr,ialu,ld,st")
1030 (set_attr "speculable1" "yes")
1031 (set_attr "speculable2" "no, yes,no, no, no, no, yes,no")])
1033 ;; With no offsettable memory references, we've got to have a scratch
1034 ;; around to play with the second word if the variable winds up in GRs.
1035 (define_expand "movxf"
1036 [(set (match_operand:XF 0 "general_operand" "")
1037 (match_operand:XF 1 "general_operand" ""))]
1040 if (ia64_expand_movxf_movrf (XFmode, operands))
1044 ;; ??? There's no easy way to mind volatile acquire/release semantics.
1046 (define_insn "movxf_internal"
1047 [(set (match_operand:XF 0 "destination_operand" "=f,f, m")
1048 (match_operand:XF 1 "general_operand" "fG,m,fG"))]
1049 "ia64_move_ok (operands[0], operands[1])"
1054 [(set_attr "itanium_class" "fmisc,fld,stf")
1055 (set_attr "speculable1" "yes")
1056 (set_attr "speculable2" "no, yes,no")])
1058 ;; Same as for movxf, but for RFmode.
1059 (define_expand "movrf"
1060 [(set (match_operand:RF 0 "general_operand" "")
1061 (match_operand:RF 1 "general_operand" ""))]
1064 if (ia64_expand_movxf_movrf (RFmode, operands))
1068 (define_insn "*movrf_internal"
1069 [(set (match_operand:RF 0 "destination_operand" "=f,f, m")
1070 (match_operand:RF 1 "general_operand" "fG,m,fG"))]
1071 "ia64_move_ok (operands[0], operands[1])"
1075 stf.spill %0 = %F1%P0"
1076 [(set_attr "itanium_class" "fmisc,fld,stf")])
1078 ;; Better code generation via insns that deal with TFmode register pairs
1079 ;; directly. Same concerns apply as for TImode.
1080 (define_expand "movtf"
1081 [(set (match_operand:TF 0 "general_operand" "")
1082 (match_operand:TF 1 "general_operand" ""))]
1085 rtx op1 = ia64_expand_move (operands[0], operands[1]);
1091 (define_insn_and_split "*movtf_internal"
1092 [(set (match_operand:TF 0 "destination_operand" "=r,r,m")
1093 (match_operand:TF 1 "general_operand" "ri,m,r"))]
1094 "ia64_move_ok (operands[0], operands[1])"
1099 ia64_split_tmode_move (operands);
1102 [(set_attr "itanium_class" "unknown")
1103 (set_attr "predicable" "no")])
1106 ;; ::::::::::::::::::::
1110 ;; ::::::::::::::::::::
1112 ;; Signed conversions from a smaller integer to a larger integer
1114 (define_insn "extendqidi2"
1115 [(set (match_operand:DI 0 "gr_register_operand" "=r")
1116 (sign_extend:DI (match_operand:QI 1 "gr_register_operand" "r")))]
1119 [(set_attr "itanium_class" "xtd")])
1121 (define_insn "extendhidi2"
1122 [(set (match_operand:DI 0 "gr_register_operand" "=r")
1123 (sign_extend:DI (match_operand:HI 1 "gr_register_operand" "r")))]
1126 [(set_attr "itanium_class" "xtd")])
1128 (define_insn "extendsidi2"
1129 [(set (match_operand:DI 0 "grfr_register_operand" "=r,?f")
1130 (sign_extend:DI (match_operand:SI 1 "grfr_register_operand" "r,f")))]
1135 [(set_attr "itanium_class" "xtd,fmisc")])
1137 ;; Unsigned conversions from a smaller integer to a larger integer
1139 (define_insn "zero_extendqidi2"
1140 [(set (match_operand:DI 0 "gr_register_operand" "=r,r")
1141 (zero_extend:DI (match_operand:QI 1 "gr_nonimmediate_operand" "r,m")))]
1146 [(set_attr "itanium_class" "xtd,ld")
1147 (set_attr "speculable1" "yes")
1148 (set_attr "speculable2" "no, yes")])
1150 (define_insn "zero_extendhidi2"
1151 [(set (match_operand:DI 0 "gr_register_operand" "=r,r")
1152 (zero_extend:DI (match_operand:HI 1 "gr_nonimmediate_operand" "r,m")))]
1157 [(set_attr "itanium_class" "xtd,ld")
1158 (set_attr "speculable1" "yes")
1159 (set_attr "speculable2" "no, yes")])
1161 (define_insn "zero_extendsidi2"
1162 [(set (match_operand:DI 0 "grfr_register_operand" "=r,r,?f")
1164 (match_operand:SI 1 "grfr_nonimmediate_operand" "r,m,f")))]
1170 [(set_attr "itanium_class" "ialu,ld,fmisc")
1171 (set_attr "speculable1" "yes")
1172 (set_attr "speculable2" "no, yes,no")])
1174 ;; Convert between floating point types of different sizes.
1176 ;; At first glance, it would appear that emitting fnorm for an extending
1177 ;; conversion is unnecessary. However, the stf and getf instructions work
1178 ;; correctly only if the input is properly rounded for its type. In
1179 ;; particular, we get the wrong result for getf.d/stfd if the input is a
1180 ;; denorm single. Since we don't know what the next instruction will be, we
1181 ;; have to emit an fnorm.
1183 ;; ??? Optimization opportunity here. Get rid of the insn altogether
1184 ;; when we can. Should probably use a scheme like has been proposed
1185 ;; for ia32 in dealing with operands that match unary operators. This
1186 ;; would let combine merge the thing into adjacent insns. See also how the
1187 ;; mips port handles SIGN_EXTEND as operands to integer arithmetic insns via
1188 ;; se_register_operand.
1190 (define_insn "extendsfdf2"
1191 [(set (match_operand:DF 0 "fr_register_operand" "=f")
1192 (float_extend:DF (match_operand:SF 1 "fr_reg_or_fp01_operand" "fG")))]
1195 [(set_attr "itanium_class" "fmac")])
1197 (define_insn "extendsfxf2"
1198 [(set (match_operand:XF 0 "fr_register_operand" "=f")
1199 (float_extend:XF (match_operand:SF 1 "fr_reg_or_fp01_operand" "fG")))]
1202 [(set_attr "itanium_class" "fmac")])
1204 (define_insn "extenddfxf2"
1205 [(set (match_operand:XF 0 "fr_register_operand" "=f")
1206 (float_extend:XF (match_operand:DF 1 "fr_reg_or_fp01_operand" "fG")))]
1209 [(set_attr "itanium_class" "fmac")])
1211 (define_insn "truncdfsf2"
1212 [(set (match_operand:SF 0 "fr_register_operand" "=f")
1213 (float_truncate:SF (match_operand:DF 1 "fr_reg_or_fp01_operand" "fG")))]
1216 [(set_attr "itanium_class" "fmac")])
1218 (define_insn "truncxfsf2"
1219 [(set (match_operand:SF 0 "fr_register_operand" "=f")
1220 (float_truncate:SF (match_operand:XF 1 "fr_reg_or_fp01_operand" "fG")))]
1223 [(set_attr "itanium_class" "fmac")])
1225 (define_insn "truncxfdf2"
1226 [(set (match_operand:DF 0 "fr_register_operand" "=f")
1227 (float_truncate:DF (match_operand:XF 1 "fr_reg_or_fp01_operand" "fG")))]
1230 [(set_attr "itanium_class" "fmac")])
1232 ;; Convert between signed integer types and floating point.
1234 (define_insn "floatdixf2"
1235 [(set (match_operand:XF 0 "fr_register_operand" "=f")
1236 (float:XF (match_operand:DI 1 "fr_reg_or_fp01_operand" "fG")))]
1239 [(set_attr "itanium_class" "fcvtfx")])
1241 (define_insn "fix_truncsfdi2"
1242 [(set (match_operand:DI 0 "fr_register_operand" "=f")
1243 (fix:DI (match_operand:SF 1 "fr_reg_or_fp01_operand" "fG")))]
1245 "fcvt.fx.trunc %0 = %F1"
1246 [(set_attr "itanium_class" "fcvtfx")])
1248 (define_insn "fix_truncdfdi2"
1249 [(set (match_operand:DI 0 "fr_register_operand" "=f")
1250 (fix:DI (match_operand:DF 1 "fr_reg_or_fp01_operand" "fG")))]
1252 "fcvt.fx.trunc %0 = %F1"
1253 [(set_attr "itanium_class" "fcvtfx")])
1255 (define_insn "fix_truncxfdi2"
1256 [(set (match_operand:DI 0 "fr_register_operand" "=f")
1257 (fix:DI (match_operand:XF 1 "fr_reg_or_fp01_operand" "fG")))]
1259 "fcvt.fx.trunc %0 = %F1"
1260 [(set_attr "itanium_class" "fcvtfx")])
1262 (define_insn "fix_truncxfdi2_alts"
1263 [(set (match_operand:DI 0 "fr_register_operand" "=f")
1264 (fix:DI (match_operand:XF 1 "fr_reg_or_fp01_operand" "fG")))
1265 (use (match_operand:SI 2 "const_int_operand" ""))]
1267 "fcvt.fx.trunc.s%2 %0 = %F1"
1268 [(set_attr "itanium_class" "fcvtfx")])
1270 ;; Convert between unsigned integer types and floating point.
1272 (define_insn "floatunsdisf2"
1273 [(set (match_operand:SF 0 "fr_register_operand" "=f")
1274 (unsigned_float:SF (match_operand:DI 1 "fr_reg_or_fp01_operand" "fG")))]
1276 "fcvt.xuf.s %0 = %F1"
1277 [(set_attr "itanium_class" "fcvtfx")])
1279 (define_insn "floatunsdidf2"
1280 [(set (match_operand:DF 0 "fr_register_operand" "=f")
1281 (unsigned_float:DF (match_operand:DI 1 "fr_reg_or_fp01_operand" "fG")))]
1283 "fcvt.xuf.d %0 = %F1"
1284 [(set_attr "itanium_class" "fcvtfx")])
1286 (define_insn "floatunsdixf2"
1287 [(set (match_operand:XF 0 "fr_register_operand" "=f")
1288 (unsigned_float:XF (match_operand:DI 1 "fr_reg_or_fp01_operand" "fG")))]
1291 [(set_attr "itanium_class" "fcvtfx")])
1293 (define_insn "fixuns_truncsfdi2"
1294 [(set (match_operand:DI 0 "fr_register_operand" "=f")
1295 (unsigned_fix:DI (match_operand:SF 1 "fr_reg_or_fp01_operand" "fG")))]
1297 "fcvt.fxu.trunc %0 = %F1"
1298 [(set_attr "itanium_class" "fcvtfx")])
1300 (define_insn "fixuns_truncdfdi2"
1301 [(set (match_operand:DI 0 "fr_register_operand" "=f")
1302 (unsigned_fix:DI (match_operand:DF 1 "fr_reg_or_fp01_operand" "fG")))]
1304 "fcvt.fxu.trunc %0 = %F1"
1305 [(set_attr "itanium_class" "fcvtfx")])
1307 (define_insn "fixuns_truncxfdi2"
1308 [(set (match_operand:DI 0 "fr_register_operand" "=f")
1309 (unsigned_fix:DI (match_operand:XF 1 "fr_reg_or_fp01_operand" "fG")))]
1311 "fcvt.fxu.trunc %0 = %F1"
1312 [(set_attr "itanium_class" "fcvtfx")])
1314 (define_insn "fixuns_truncxfdi2_alts"
1315 [(set (match_operand:DI 0 "fr_register_operand" "=f")
1316 (unsigned_fix:DI (match_operand:XF 1 "fr_reg_or_fp01_operand" "fG")))
1317 (use (match_operand:SI 2 "const_int_operand" ""))]
1319 "fcvt.fxu.trunc.s%2 %0 = %F1"
1320 [(set_attr "itanium_class" "fcvtfx")])
1322 ;; ::::::::::::::::::::
1324 ;; :: Bit field extraction
1326 ;; ::::::::::::::::::::
1329 [(set (match_operand:DI 0 "gr_register_operand" "=r")
1330 (sign_extract:DI (match_operand:DI 1 "gr_register_operand" "r")
1331 (match_operand:DI 2 "extr_len_operand" "n")
1332 (match_operand:DI 3 "shift_count_operand" "M")))]
1334 "extr %0 = %1, %3, %2"
1335 [(set_attr "itanium_class" "ishf")])
1337 (define_insn "extzv"
1338 [(set (match_operand:DI 0 "gr_register_operand" "=r")
1339 (zero_extract:DI (match_operand:DI 1 "gr_register_operand" "r")
1340 (match_operand:DI 2 "extr_len_operand" "n")
1341 (match_operand:DI 3 "shift_count_operand" "M")))]
1343 "extr.u %0 = %1, %3, %2"
1344 [(set_attr "itanium_class" "ishf")])
1346 ;; Insert a bit field.
1347 ;; Can have 3 operands, source1 (inserter), source2 (insertee), dest.
1348 ;; Source1 can be 0 or -1.
1349 ;; Source2 can be 0.
1351 ;; ??? Actual dep instruction is more powerful than what these insv
1352 ;; patterns support. Unfortunately, combine is unable to create patterns
1353 ;; where source2 != dest.
1355 (define_expand "insv"
1356 [(set (zero_extract:DI (match_operand:DI 0 "gr_register_operand" "")
1357 (match_operand:DI 1 "const_int_operand" "")
1358 (match_operand:DI 2 "const_int_operand" ""))
1359 (match_operand:DI 3 "nonmemory_operand" ""))]
1362 int width = INTVAL (operands[1]);
1363 int shift = INTVAL (operands[2]);
1365 /* If operand[3] is a constant, and isn't 0 or -1, then load it into a
1367 if (! register_operand (operands[3], DImode)
1368 && operands[3] != const0_rtx && operands[3] != constm1_rtx)
1369 operands[3] = force_reg (DImode, operands[3]);
1371 /* If this is a single dep instruction, we have nothing to do. */
1372 if (! ((register_operand (operands[3], DImode) && width <= 16)
1373 || operands[3] == const0_rtx || operands[3] == constm1_rtx))
1375 /* Check for cases that can be implemented with a mix instruction. */
1376 if (width == 32 && shift == 0)
1378 /* Directly generating the mix4left instruction confuses
1379 optimize_bit_field in function.c. Since this is performing
1380 a useful optimization, we defer generation of the complicated
1381 mix4left RTL to the first splitting phase. */
1382 rtx tmp = gen_reg_rtx (DImode);
1383 emit_insn (gen_shift_mix4left (operands[0], operands[3], tmp));
1386 else if (width == 32 && shift == 32)
1388 emit_insn (gen_mix4right (operands[0], operands[3]));
1392 /* We could handle remaining cases by emitting multiple dep
1395 If we need more than two dep instructions then we lose. A 6
1396 insn sequence mov mask1,mov mask2,shl;;and,and;;or is better than
1397 mov;;dep,shr;;dep,shr;;dep. The former can be executed in 3 cycles,
1398 the latter is 6 cycles on an Itanium (TM) processor, because there is
1399 only one function unit that can execute dep and shr immed.
1401 If we only need two dep instruction, then we still lose.
1402 mov;;dep,shr;;dep is still 4 cycles. Even if we optimize away
1403 the unnecessary mov, this is still undesirable because it will be
1404 hard to optimize, and it creates unnecessary pressure on the I0
1410 /* This code may be useful for other IA-64 processors, so we leave it in
1416 emit_insn (gen_insv (operands[0], GEN_INT (16), GEN_INT (shift),
1420 tmp = gen_reg_rtx (DImode);
1421 emit_insn (gen_lshrdi3 (tmp, operands[3], GEN_INT (16)));
1424 operands[1] = GEN_INT (width);
1425 operands[2] = GEN_INT (shift);
1430 (define_insn "*insv_internal"
1431 [(set (zero_extract:DI (match_operand:DI 0 "gr_register_operand" "+r")
1432 (match_operand:DI 1 "const_int_operand" "n")
1433 (match_operand:DI 2 "const_int_operand" "n"))
1434 (match_operand:DI 3 "nonmemory_operand" "rP"))]
1435 "(gr_register_operand (operands[3], DImode) && INTVAL (operands[1]) <= 16)
1436 || operands[3] == const0_rtx || operands[3] == constm1_rtx"
1437 "dep %0 = %3, %0, %2, %1"
1438 [(set_attr "itanium_class" "ishf")])
1440 ;; Combine doesn't like to create bit-field insertions into zero.
1441 (define_insn "*shladdp4_internal"
1442 [(set (match_operand:DI 0 "gr_register_operand" "=r")
1443 (and:DI (ashift:DI (match_operand:DI 1 "gr_register_operand" "r")
1444 (match_operand:DI 2 "shladd_log2_operand" "n"))
1445 (match_operand:DI 3 "const_int_operand" "n")))]
1446 "ia64_depz_field_mask (operands[3], operands[2]) + INTVAL (operands[2]) == 32"
1447 "shladdp4 %0 = %1, %2, r0"
1448 [(set_attr "itanium_class" "ialu")])
1450 (define_insn "*depz_internal"
1451 [(set (match_operand:DI 0 "gr_register_operand" "=r")
1452 (and:DI (ashift:DI (match_operand:DI 1 "gr_register_operand" "r")
1453 (match_operand:DI 2 "const_int_operand" "M"))
1454 (match_operand:DI 3 "const_int_operand" "n")))]
1455 "satisfies_constraint_M (operands[2])
1456 && ia64_depz_field_mask (operands[3], operands[2]) > 0"
1458 operands[3] = GEN_INT (ia64_depz_field_mask (operands[3], operands[2]));
1459 return "%,dep.z %0 = %1, %2, %3";
1461 [(set_attr "itanium_class" "ishf")])
1463 (define_insn "shift_mix4left"
1464 [(set (zero_extract:DI (match_operand:DI 0 "gr_register_operand" "+r")
1465 (const_int 32) (const_int 0))
1466 (match_operand:DI 1 "gr_register_operand" "r"))
1467 (clobber (match_operand:DI 2 "gr_register_operand" "=r"))]
1470 [(set_attr "itanium_class" "unknown")])
1473 [(set (zero_extract:DI (match_operand:DI 0 "register_operand" "")
1474 (const_int 32) (const_int 0))
1475 (match_operand:DI 1 "register_operand" ""))
1476 (clobber (match_operand:DI 2 "register_operand" ""))]
1478 [(set (match_dup 3) (ashift:DI (match_dup 1) (const_int 32)))
1479 (set (zero_extract:DI (match_dup 0) (const_int 32) (const_int 0))
1480 (lshiftrt:DI (match_dup 3) (const_int 32)))]
1481 "operands[3] = operands[2];")
1483 (define_insn "*mix4left"
1484 [(set (zero_extract:DI (match_operand:DI 0 "gr_register_operand" "+r")
1485 (const_int 32) (const_int 0))
1486 (lshiftrt:DI (match_operand:DI 1 "gr_register_operand" "r")
1489 "mix4.l %0 = %0, %r1"
1490 [(set_attr "itanium_class" "mmshf")])
1492 (define_insn "mix4right"
1493 [(set (zero_extract:DI (match_operand:DI 0 "gr_register_operand" "+r")
1494 (const_int 32) (const_int 32))
1495 (match_operand:DI 1 "gr_reg_or_0_operand" "rO"))]
1497 "mix4.r %0 = %r1, %0"
1498 [(set_attr "itanium_class" "mmshf")])
1500 ;; This is used by the rotrsi3 pattern.
1502 (define_insn "*mix4right_3op"
1503 [(set (match_operand:DI 0 "gr_register_operand" "=r")
1504 (ior:DI (zero_extend:DI (match_operand:SI 1 "gr_register_operand" "r"))
1505 (ashift:DI (zero_extend:DI
1506 (match_operand:SI 2 "gr_register_operand" "r"))
1509 "mix4.r %0 = %2, %1"
1510 [(set_attr "itanium_class" "mmshf")])
1513 ;; ::::::::::::::::::::
1515 ;; :: 1-bit Integer arithmetic
1517 ;; ::::::::::::::::::::
1519 (define_insn_and_split "andbi3"
1520 [(set (match_operand:BI 0 "register_operand" "=c,c,r")
1521 (and:BI (match_operand:BI 1 "register_operand" "%0,0,r")
1522 (match_operand:BI 2 "register_operand" "c,r,r")))]
1526 tbit.nz.and.orcm %0, %I0 = %2, 0
1529 && GET_CODE (operands[0]) == REG && PR_REGNO_P (REGNO (operands[0]))
1530 && GET_CODE (operands[2]) == REG && PR_REGNO_P (REGNO (operands[2]))"
1531 [(cond_exec (eq (match_dup 2) (const_int 0))
1532 (set (match_dup 0) (and:BI (ne:BI (const_int 0) (const_int 0))
1535 [(set_attr "itanium_class" "unknown,tbit,ilog")])
1537 (define_insn_and_split "*andcmbi3"
1538 [(set (match_operand:BI 0 "register_operand" "=c,c,r")
1539 (and:BI (not:BI (match_operand:BI 1 "register_operand" "c,r,r"))
1540 (match_operand:BI 2 "register_operand" "0,0,r")))]
1544 tbit.z.and.orcm %0, %I0 = %1, 0
1547 && GET_CODE (operands[0]) == REG && PR_REGNO_P (REGNO (operands[0]))
1548 && GET_CODE (operands[1]) == REG && PR_REGNO_P (REGNO (operands[1]))"
1549 [(cond_exec (ne (match_dup 1) (const_int 0))
1550 (set (match_dup 0) (and:BI (ne:BI (const_int 0) (const_int 0))
1553 [(set_attr "itanium_class" "unknown,tbit,ilog")])
1555 (define_insn_and_split "iorbi3"
1556 [(set (match_operand:BI 0 "register_operand" "=c,c,r")
1557 (ior:BI (match_operand:BI 1 "register_operand" "%0,0,r")
1558 (match_operand:BI 2 "register_operand" "c,r,r")))]
1562 tbit.nz.or.andcm %0, %I0 = %2, 0
1565 && GET_CODE (operands[0]) == REG && PR_REGNO_P (REGNO (operands[0]))
1566 && GET_CODE (operands[2]) == REG && PR_REGNO_P (REGNO (operands[2]))"
1567 [(cond_exec (ne (match_dup 2) (const_int 0))
1568 (set (match_dup 0) (ior:BI (eq:BI (const_int 0) (const_int 0))
1571 [(set_attr "itanium_class" "unknown,tbit,ilog")])
1573 (define_insn_and_split "*iorcmbi3"
1574 [(set (match_operand:BI 0 "register_operand" "=c,c")
1575 (ior:BI (not:BI (match_operand:BI 1 "register_operand" "c,r"))
1576 (match_operand:BI 2 "register_operand" "0,0")))]
1580 tbit.z.or.andcm %0, %I0 = %1, 0"
1582 && GET_CODE (operands[0]) == REG && PR_REGNO_P (REGNO (operands[0]))
1583 && GET_CODE (operands[1]) == REG && PR_REGNO_P (REGNO (operands[1]))"
1584 [(cond_exec (eq (match_dup 1) (const_int 0))
1585 (set (match_dup 0) (ior:BI (eq:BI (const_int 0) (const_int 0))
1588 [(set_attr "itanium_class" "unknown,tbit")])
1590 (define_insn "one_cmplbi2"
1591 [(set (match_operand:BI 0 "register_operand" "=c,r,c,&c")
1592 (not:BI (match_operand:BI 1 "register_operand" "r,r,0,c")))
1593 (clobber (match_scratch:BI 2 "=X,X,c,X"))]
1596 tbit.z %0, %I0 = %1, 0
1600 [(set_attr "itanium_class" "tbit,ilog,unknown,unknown")])
1603 [(set (match_operand:BI 0 "register_operand" "")
1604 (not:BI (match_operand:BI 1 "register_operand" "")))
1605 (clobber (match_scratch:BI 2 ""))]
1607 && GET_CODE (operands[0]) == REG && PR_REGNO_P (REGNO (operands[0]))
1608 && rtx_equal_p (operands[0], operands[1])"
1609 [(set (match_dup 4) (match_dup 3))
1610 (set (match_dup 0) (const_int 1))
1611 (cond_exec (ne (match_dup 2) (const_int 0))
1612 (set (match_dup 0) (const_int 0)))
1613 (set (match_dup 0) (unspec:BI [(match_dup 0)] UNSPEC_PRED_REL_MUTEX))]
1614 "operands[3] = gen_rtx_REG (CCImode, REGNO (operands[1]));
1615 operands[4] = gen_rtx_REG (CCImode, REGNO (operands[2]));")
1618 [(set (match_operand:BI 0 "register_operand" "")
1619 (not:BI (match_operand:BI 1 "register_operand" "")))
1620 (clobber (match_scratch:BI 2 ""))]
1622 && GET_CODE (operands[0]) == REG && PR_REGNO_P (REGNO (operands[0]))
1623 && GET_CODE (operands[1]) == REG && PR_REGNO_P (REGNO (operands[1]))
1624 && ! rtx_equal_p (operands[0], operands[1])"
1625 [(cond_exec (ne (match_dup 1) (const_int 0))
1626 (set (match_dup 0) (const_int 0)))
1627 (cond_exec (eq (match_dup 1) (const_int 0))
1628 (set (match_dup 0) (const_int 1)))
1629 (set (match_dup 0) (unspec:BI [(match_dup 0)] UNSPEC_PRED_REL_MUTEX))]
1632 (define_insn "*cmpsi_and_0"
1633 [(set (match_operand:BI 0 "register_operand" "=c")
1634 (and:BI (match_operator:BI 4 "predicate_operator"
1635 [(match_operand:SI 2 "gr_reg_or_0_operand" "rO")
1636 (match_operand:SI 3 "gr_reg_or_8bit_operand" "rK")])
1637 (match_operand:BI 1 "register_operand" "0")))]
1639 "cmp4.%C4.and.orcm %0, %I0 = %3, %r2"
1640 [(set_attr "itanium_class" "icmp")])
1642 (define_insn "*cmpsi_and_1"
1643 [(set (match_operand:BI 0 "register_operand" "=c")
1644 (and:BI (match_operator:BI 3 "signed_inequality_operator"
1645 [(match_operand:SI 2 "gr_register_operand" "r")
1647 (match_operand:BI 1 "register_operand" "0")))]
1649 "cmp4.%C3.and.orcm %0, %I0 = r0, %2"
1650 [(set_attr "itanium_class" "icmp")])
1652 (define_insn "*cmpsi_andnot_0"
1653 [(set (match_operand:BI 0 "register_operand" "=c")
1654 (and:BI (not:BI (match_operator:BI 4 "predicate_operator"
1655 [(match_operand:SI 2 "gr_reg_or_0_operand" "rO")
1656 (match_operand:SI 3 "gr_reg_or_8bit_operand" "rK")]))
1657 (match_operand:BI 1 "register_operand" "0")))]
1659 "cmp4.%C4.or.andcm %I0, %0 = %3, %r2"
1660 [(set_attr "itanium_class" "icmp")])
1662 (define_insn "*cmpsi_andnot_1"
1663 [(set (match_operand:BI 0 "register_operand" "=c")
1664 (and:BI (not:BI (match_operator:BI 3 "signed_inequality_operator"
1665 [(match_operand:SI 2 "gr_register_operand" "r")
1667 (match_operand:BI 1 "register_operand" "0")))]
1669 "cmp4.%C3.or.andcm %I0, %0 = r0, %2"
1670 [(set_attr "itanium_class" "icmp")])
1672 (define_insn "*cmpdi_and_0"
1673 [(set (match_operand:BI 0 "register_operand" "=c")
1674 (and:BI (match_operator:BI 4 "predicate_operator"
1675 [(match_operand:DI 2 "gr_register_operand" "r")
1676 (match_operand:DI 3 "gr_reg_or_8bit_operand" "rK")])
1677 (match_operand:BI 1 "register_operand" "0")))]
1679 "cmp.%C4.and.orcm %0, %I0 = %3, %2"
1680 [(set_attr "itanium_class" "icmp")])
1682 (define_insn "*cmpdi_and_1"
1683 [(set (match_operand:BI 0 "register_operand" "=c")
1684 (and:BI (match_operator:BI 3 "signed_inequality_operator"
1685 [(match_operand:DI 2 "gr_register_operand" "r")
1687 (match_operand:BI 1 "register_operand" "0")))]
1689 "cmp.%C3.and.orcm %0, %I0 = r0, %2"
1690 [(set_attr "itanium_class" "icmp")])
1692 (define_insn "*cmpdi_andnot_0"
1693 [(set (match_operand:BI 0 "register_operand" "=c")
1694 (and:BI (not:BI (match_operator:BI 4 "predicate_operator"
1695 [(match_operand:DI 2 "gr_register_operand" "r")
1696 (match_operand:DI 3 "gr_reg_or_8bit_operand" "rK")]))
1697 (match_operand:BI 1 "register_operand" "0")))]
1699 "cmp.%C4.or.andcm %I0, %0 = %3, %2"
1700 [(set_attr "itanium_class" "icmp")])
1702 (define_insn "*cmpdi_andnot_1"
1703 [(set (match_operand:BI 0 "register_operand" "=c")
1704 (and:BI (not:BI (match_operator:BI 3 "signed_inequality_operator"
1705 [(match_operand:DI 2 "gr_register_operand" "r")
1707 (match_operand:BI 1 "register_operand" "0")))]
1709 "cmp.%C3.or.andcm %I0, %0 = r0, %2"
1710 [(set_attr "itanium_class" "icmp")])
1712 (define_insn "*tbit_and_0"
1713 [(set (match_operand:BI 0 "register_operand" "=c")
1714 (and:BI (ne:BI (and:DI (match_operand:DI 1 "gr_register_operand" "r")
1717 (match_operand:BI 2 "register_operand" "0")))]
1719 "tbit.nz.and.orcm %0, %I0 = %1, 0"
1720 [(set_attr "itanium_class" "tbit")])
1722 (define_insn "*tbit_and_1"
1723 [(set (match_operand:BI 0 "register_operand" "=c")
1724 (and:BI (eq:BI (and:DI (match_operand:DI 1 "gr_register_operand" "r")
1727 (match_operand:BI 2 "register_operand" "0")))]
1729 "tbit.z.and.orcm %0, %I0 = %1, 0"
1730 [(set_attr "itanium_class" "tbit")])
1732 (define_insn "*tbit_and_2"
1733 [(set (match_operand:BI 0 "register_operand" "=c")
1734 (and:BI (ne:BI (zero_extract:DI
1735 (match_operand:DI 1 "gr_register_operand" "r")
1737 (match_operand:DI 2 "shift_count_operand" "M"))
1739 (match_operand:BI 3 "register_operand" "0")))]
1741 "tbit.nz.and.orcm %0, %I0 = %1, %2"
1742 [(set_attr "itanium_class" "tbit")])
1744 (define_insn "*tbit_and_3"
1745 [(set (match_operand:BI 0 "register_operand" "=c")
1746 (and:BI (eq:BI (zero_extract:DI
1747 (match_operand:DI 1 "gr_register_operand" "r")
1749 (match_operand:DI 2 "shift_count_operand" "M"))
1751 (match_operand:BI 3 "register_operand" "0")))]
1753 "tbit.z.and.orcm %0, %I0 = %1, %2"
1754 [(set_attr "itanium_class" "tbit")])
1756 (define_insn "*cmpsi_or_0"
1757 [(set (match_operand:BI 0 "register_operand" "=c")
1758 (ior:BI (match_operator:BI 4 "predicate_operator"
1759 [(match_operand:SI 2 "gr_reg_or_0_operand" "rO")
1760 (match_operand:SI 3 "gr_reg_or_8bit_operand" "rK")])
1761 (match_operand:BI 1 "register_operand" "0")))]
1763 "cmp4.%C4.or.andcm %0, %I0 = %3, %r2"
1764 [(set_attr "itanium_class" "icmp")])
1766 (define_insn "*cmpsi_or_1"
1767 [(set (match_operand:BI 0 "register_operand" "=c")
1768 (ior:BI (match_operator:BI 3 "signed_inequality_operator"
1769 [(match_operand:SI 2 "gr_register_operand" "r")
1771 (match_operand:BI 1 "register_operand" "0")))]
1773 "cmp4.%C3.or.andcm %0, %I0 = r0, %2"
1774 [(set_attr "itanium_class" "icmp")])
1776 (define_insn "*cmpsi_orcm_0"
1777 [(set (match_operand:BI 0 "register_operand" "=c")
1778 (ior:BI (not:BI (match_operator:BI 4 "predicate_operator"
1779 [(match_operand:SI 2 "gr_reg_or_0_operand" "rO")
1780 (match_operand:SI 3 "gr_reg_or_8bit_operand" "rK")]))
1781 (match_operand:BI 1 "register_operand" "0")))]
1783 "cmp4.%C4.and.orcm %I0, %0 = %3, %r2"
1784 [(set_attr "itanium_class" "icmp")])
1786 (define_insn "*cmpsi_orcm_1"
1787 [(set (match_operand:BI 0 "register_operand" "=c")
1788 (ior:BI (not:BI (match_operator:BI 3 "signed_inequality_operator"
1789 [(match_operand:SI 2 "gr_register_operand" "r")
1791 (match_operand:BI 1 "register_operand" "0")))]
1793 "cmp4.%C3.and.orcm %I0, %0 = r0, %2"
1794 [(set_attr "itanium_class" "icmp")])
1796 (define_insn "*cmpdi_or_0"
1797 [(set (match_operand:BI 0 "register_operand" "=c")
1798 (ior:BI (match_operator:BI 4 "predicate_operator"
1799 [(match_operand:DI 2 "gr_register_operand" "r")
1800 (match_operand:DI 3 "gr_reg_or_8bit_operand" "rK")])
1801 (match_operand:BI 1 "register_operand" "0")))]
1803 "cmp.%C4.or.andcm %0, %I0 = %3, %2"
1804 [(set_attr "itanium_class" "icmp")])
1806 (define_insn "*cmpdi_or_1"
1807 [(set (match_operand:BI 0 "register_operand" "=c")
1808 (ior:BI (match_operator:BI 3 "signed_inequality_operator"
1809 [(match_operand:DI 2 "gr_register_operand" "r")
1811 (match_operand:BI 1 "register_operand" "0")))]
1813 "cmp.%C3.or.andcm %0, %I0 = r0, %2"
1814 [(set_attr "itanium_class" "icmp")])
1816 (define_insn "*cmpdi_orcm_0"
1817 [(set (match_operand:BI 0 "register_operand" "=c")
1818 (ior:BI (not:BI (match_operator:BI 4 "predicate_operator"
1819 [(match_operand:DI 2 "gr_register_operand" "r")
1820 (match_operand:DI 3 "gr_reg_or_8bit_operand" "rK")]))
1821 (match_operand:BI 1 "register_operand" "0")))]
1823 "cmp.%C4.and.orcm %I0, %0 = %3, %2"
1824 [(set_attr "itanium_class" "icmp")])
1826 (define_insn "*cmpdi_orcm_1"
1827 [(set (match_operand:BI 0 "register_operand" "=c")
1828 (ior:BI (not:BI (match_operator:BI 3 "signed_inequality_operator"
1829 [(match_operand:DI 2 "gr_register_operand" "r")
1831 (match_operand:BI 1 "register_operand" "0")))]
1833 "cmp.%C3.and.orcm %I0, %0 = r0, %2"
1834 [(set_attr "itanium_class" "icmp")])
1836 (define_insn "*tbit_or_0"
1837 [(set (match_operand:BI 0 "register_operand" "=c")
1838 (ior:BI (ne:BI (and:DI (match_operand:DI 1 "gr_register_operand" "r")
1841 (match_operand:BI 2 "register_operand" "0")))]
1843 "tbit.nz.or.andcm %0, %I0 = %1, 0"
1844 [(set_attr "itanium_class" "tbit")])
1846 (define_insn "*tbit_or_1"
1847 [(set (match_operand:BI 0 "register_operand" "=c")
1848 (ior:BI (eq:BI (and:DI (match_operand:DI 1 "gr_register_operand" "r")
1851 (match_operand:BI 2 "register_operand" "0")))]
1853 "tbit.z.or.andcm %0, %I0 = %1, 0"
1854 [(set_attr "itanium_class" "tbit")])
1856 (define_insn "*tbit_or_2"
1857 [(set (match_operand:BI 0 "register_operand" "=c")
1858 (ior:BI (ne:BI (zero_extract:DI
1859 (match_operand:DI 1 "gr_register_operand" "r")
1861 (match_operand:DI 2 "shift_count_operand" "M"))
1863 (match_operand:BI 3 "register_operand" "0")))]
1865 "tbit.nz.or.andcm %0, %I0 = %1, %2"
1866 [(set_attr "itanium_class" "tbit")])
1868 (define_insn "*tbit_or_3"
1869 [(set (match_operand:BI 0 "register_operand" "=c")
1870 (ior:BI (eq:BI (zero_extract:DI
1871 (match_operand:DI 1 "gr_register_operand" "r")
1873 (match_operand:DI 2 "shift_count_operand" "M"))
1875 (match_operand:BI 3 "register_operand" "0")))]
1877 "tbit.z.or.andcm %0, %I0 = %1, %2"
1878 [(set_attr "itanium_class" "tbit")])
1880 ;; Transform test of and/or of setcc into parallel comparisons.
1883 [(set (match_operand:BI 0 "register_operand" "")
1884 (ne:BI (and:DI (ne:DI (match_operand:BI 2 "register_operand" "")
1886 (match_operand:DI 3 "register_operand" ""))
1890 (and:BI (ne:BI (and:DI (match_dup 3) (const_int 1)) (const_int 0))
1895 [(set (match_operand:BI 0 "register_operand" "")
1896 (eq:BI (and:DI (ne:DI (match_operand:BI 2 "register_operand" "")
1898 (match_operand:DI 3 "register_operand" ""))
1902 (and:BI (ne:BI (and:DI (match_dup 3) (const_int 1)) (const_int 0))
1904 (parallel [(set (match_dup 0) (not:BI (match_dup 0)))
1905 (clobber (scratch))])]
1909 [(set (match_operand:BI 0 "register_operand" "")
1910 (ne:BI (ior:DI (ne:DI (match_operand:BI 2 "register_operand" "")
1912 (match_operand:DI 3 "register_operand" ""))
1916 (ior:BI (ne:BI (match_dup 3) (const_int 0))
1921 [(set (match_operand:BI 0 "register_operand" "")
1922 (eq:BI (ior:DI (ne:DI (match_operand:BI 2 "register_operand" "")
1924 (match_operand:DI 3 "register_operand" ""))
1928 (ior:BI (ne:BI (match_dup 3) (const_int 0))
1930 (parallel [(set (match_dup 0) (not:BI (match_dup 0)))
1931 (clobber (scratch))])]
1934 ;; ??? Incredibly hackish. Either need four proper patterns with all
1935 ;; the alternatives, or rely on sched1 to split the insn and hope that
1936 ;; nothing bad happens to the comparisons in the meantime.
1938 ;; Alternately, adjust combine to allow 2->2 and 3->3 splits, assuming
1939 ;; that we're doing height reduction.
1941 ;(define_insn_and_split ""
1942 ; [(set (match_operand:BI 0 "register_operand" "=c")
1943 ; (and:BI (and:BI (match_operator:BI 1 "comparison_operator"
1944 ; [(match_operand 2 "" "")
1945 ; (match_operand 3 "" "")])
1946 ; (match_operator:BI 4 "comparison_operator"
1947 ; [(match_operand 5 "" "")
1948 ; (match_operand 6 "" "")]))
1950 ; "flag_schedule_insns"
1953 ; [(set (match_dup 0) (and:BI (match_dup 1) (match_dup 0)))
1954 ; (set (match_dup 0) (and:BI (match_dup 4) (match_dup 0)))]
1957 ;(define_insn_and_split ""
1958 ; [(set (match_operand:BI 0 "register_operand" "=c")
1959 ; (ior:BI (ior:BI (match_operator:BI 1 "comparison_operator"
1960 ; [(match_operand 2 "" "")
1961 ; (match_operand 3 "" "")])
1962 ; (match_operator:BI 4 "comparison_operator"
1963 ; [(match_operand 5 "" "")
1964 ; (match_operand 6 "" "")]))
1966 ; "flag_schedule_insns"
1969 ; [(set (match_dup 0) (ior:BI (match_dup 1) (match_dup 0)))
1970 ; (set (match_dup 0) (ior:BI (match_dup 4) (match_dup 0)))]
1974 ; [(set (match_operand:BI 0 "register_operand" "")
1975 ; (and:BI (and:BI (match_operator:BI 1 "comparison_operator"
1976 ; [(match_operand 2 "" "")
1977 ; (match_operand 3 "" "")])
1978 ; (match_operand:BI 7 "register_operand" ""))
1979 ; (and:BI (match_operator:BI 4 "comparison_operator"
1980 ; [(match_operand 5 "" "")
1981 ; (match_operand 6 "" "")])
1982 ; (match_operand:BI 8 "register_operand" ""))))]
1984 ; [(set (match_dup 0) (and:BI (match_dup 7) (match_dup 8)))
1985 ; (set (match_dup 0) (and:BI (and:BI (match_dup 1) (match_dup 4))
1990 ; [(set (match_operand:BI 0 "register_operand" "")
1991 ; (ior:BI (ior:BI (match_operator:BI 1 "comparison_operator"
1992 ; [(match_operand 2 "" "")
1993 ; (match_operand 3 "" "")])
1994 ; (match_operand:BI 7 "register_operand" ""))
1995 ; (ior:BI (match_operator:BI 4 "comparison_operator"
1996 ; [(match_operand 5 "" "")
1997 ; (match_operand 6 "" "")])
1998 ; (match_operand:BI 8 "register_operand" ""))))]
2000 ; [(set (match_dup 0) (ior:BI (match_dup 7) (match_dup 8)))
2001 ; (set (match_dup 0) (ior:BI (ior:BI (match_dup 1) (match_dup 4))
2005 ;; Try harder to avoid predicate copies by duplicating compares.
2006 ;; Note that we'll have already split the predicate copy, which
2007 ;; is kind of a pain, but oh well.
2010 [(set (match_operand:BI 0 "register_operand" "")
2011 (match_operand:BI 1 "comparison_operator" ""))
2012 (set (match_operand:CCI 2 "register_operand" "")
2013 (match_operand:CCI 3 "register_operand" ""))
2014 (set (match_operand:CCI 4 "register_operand" "")
2015 (match_operand:CCI 5 "register_operand" ""))
2016 (set (match_operand:BI 6 "register_operand" "")
2017 (unspec:BI [(match_dup 6)] UNSPEC_PRED_REL_MUTEX))]
2018 "REGNO (operands[3]) == REGNO (operands[0])
2019 && REGNO (operands[4]) == REGNO (operands[0]) + 1
2020 && REGNO (operands[4]) == REGNO (operands[2]) + 1
2021 && REGNO (operands[6]) == REGNO (operands[2])"
2022 [(set (match_dup 0) (match_dup 1))
2023 (set (match_dup 6) (match_dup 7))]
2024 "operands[7] = copy_rtx (operands[1]);")
2026 ;; ::::::::::::::::::::
2028 ;; :: 16-bit Integer arithmetic
2030 ;; ::::::::::::::::::::
2032 (define_insn "mulhi3"
2033 [(set (match_operand:HI 0 "gr_register_operand" "=r")
2034 (mult:HI (match_operand:HI 1 "gr_register_operand" "r")
2035 (match_operand:HI 2 "gr_register_operand" "r")))]
2037 "pmpy2.r %0 = %1, %2"
2038 [(set_attr "itanium_class" "mmmul")])
2041 ;; ::::::::::::::::::::
2043 ;; :: 32-bit Integer arithmetic
2045 ;; ::::::::::::::::::::
2047 (define_insn "addsi3"
2048 [(set (match_operand:SI 0 "gr_register_operand" "=r,r,r")
2049 (plus:SI (match_operand:SI 1 "gr_register_operand" "%r,r,a")
2050 (match_operand:SI 2 "gr_reg_or_22bit_operand" "r,I,J")))]
2056 [(set_attr "itanium_class" "ialu")])
2058 (define_insn "*addsi3_plus1"
2059 [(set (match_operand:SI 0 "gr_register_operand" "=r")
2060 (plus:SI (plus:SI (match_operand:SI 1 "gr_register_operand" "r")
2061 (match_operand:SI 2 "gr_register_operand" "r"))
2064 "add %0 = %1, %2, 1"
2065 [(set_attr "itanium_class" "ialu")])
2067 (define_insn "*addsi3_plus1_alt"
2068 [(set (match_operand:SI 0 "gr_register_operand" "=r")
2069 (plus:SI (mult:SI (match_operand:SI 1 "gr_register_operand" "r")
2073 "add %0 = %1, %1, 1"
2074 [(set_attr "itanium_class" "ialu")])
2076 (define_insn "*addsi3_shladd"
2077 [(set (match_operand:SI 0 "gr_register_operand" "=r")
2078 (plus:SI (mult:SI (match_operand:SI 1 "gr_register_operand" "r")
2079 (match_operand:SI 2 "shladd_operand" "n"))
2080 (match_operand:SI 3 "gr_register_operand" "r")))]
2082 "shladd %0 = %1, %S2, %3"
2083 [(set_attr "itanium_class" "ialu")])
2085 (define_insn "subsi3"
2086 [(set (match_operand:SI 0 "gr_register_operand" "=r")
2087 (minus:SI (match_operand:SI 1 "gr_reg_or_8bit_operand" "rK")
2088 (match_operand:SI 2 "gr_register_operand" "r")))]
2091 [(set_attr "itanium_class" "ialu")])
2093 (define_insn "*subsi3_minus1"
2094 [(set (match_operand:SI 0 "gr_register_operand" "=r")
2095 (plus:SI (not:SI (match_operand:SI 1 "gr_register_operand" "r"))
2096 (match_operand:SI 2 "gr_register_operand" "r")))]
2098 "sub %0 = %2, %1, 1"
2099 [(set_attr "itanium_class" "ialu")])
2101 ;; ??? Could add maddsi3 patterns patterned after the madddi3 patterns.
2103 (define_insn "mulsi3"
2104 [(set (match_operand:SI 0 "fr_register_operand" "=f")
2105 (mult:SI (match_operand:SI 1 "grfr_register_operand" "f")
2106 (match_operand:SI 2 "grfr_register_operand" "f")))]
2108 "xmpy.l %0 = %1, %2"
2109 [(set_attr "itanium_class" "xmpy")])
2111 (define_insn "maddsi4"
2112 [(set (match_operand:SI 0 "fr_register_operand" "=f")
2113 (plus:SI (mult:SI (match_operand:SI 1 "grfr_register_operand" "f")
2114 (match_operand:SI 2 "grfr_register_operand" "f"))
2115 (match_operand:SI 3 "grfr_register_operand" "f")))]
2117 "xma.l %0 = %1, %2, %3"
2118 [(set_attr "itanium_class" "xmpy")])
2120 (define_insn "negsi2"
2121 [(set (match_operand:SI 0 "gr_register_operand" "=r")
2122 (neg:SI (match_operand:SI 1 "gr_register_operand" "r")))]
2125 [(set_attr "itanium_class" "ialu")])
2127 (define_expand "abssi2"
2129 (ge:BI (match_operand:SI 1 "gr_register_operand" "") (const_int 0)))
2130 (set (match_operand:SI 0 "gr_register_operand" "")
2131 (if_then_else:SI (eq (match_dup 2) (const_int 0))
2132 (neg:SI (match_dup 1))
2135 { operands[2] = gen_reg_rtx (BImode); })
2137 (define_expand "sminsi3"
2139 (ge:BI (match_operand:SI 1 "gr_register_operand" "")
2140 (match_operand:SI 2 "gr_register_operand" "")))
2141 (set (match_operand:SI 0 "gr_register_operand" "")
2142 (if_then_else:SI (ne (match_dup 3) (const_int 0))
2143 (match_dup 2) (match_dup 1)))]
2145 { operands[3] = gen_reg_rtx (BImode); })
2147 (define_expand "smaxsi3"
2149 (ge:BI (match_operand:SI 1 "gr_register_operand" "")
2150 (match_operand:SI 2 "gr_register_operand" "")))
2151 (set (match_operand:SI 0 "gr_register_operand" "")
2152 (if_then_else:SI (ne (match_dup 3) (const_int 0))
2153 (match_dup 1) (match_dup 2)))]
2155 { operands[3] = gen_reg_rtx (BImode); })
2157 (define_expand "uminsi3"
2159 (geu:BI (match_operand:SI 1 "gr_register_operand" "")
2160 (match_operand:SI 2 "gr_register_operand" "")))
2161 (set (match_operand:SI 0 "gr_register_operand" "")
2162 (if_then_else:SI (ne (match_dup 3) (const_int 0))
2163 (match_dup 2) (match_dup 1)))]
2165 { operands[3] = gen_reg_rtx (BImode); })
2167 (define_expand "umaxsi3"
2169 (geu:BI (match_operand:SI 1 "gr_register_operand" "")
2170 (match_operand:SI 2 "gr_register_operand" "")))
2171 (set (match_operand:SI 0 "gr_register_operand" "")
2172 (if_then_else:SI (ne (match_dup 3) (const_int 0))
2173 (match_dup 1) (match_dup 2)))]
2175 { operands[3] = gen_reg_rtx (BImode); })
2177 (define_expand "divsi3"
2178 [(set (match_operand:SI 0 "register_operand" "")
2179 (div:SI (match_operand:SI 1 "general_operand" "")
2180 (match_operand:SI 2 "general_operand" "")))]
2181 "TARGET_INLINE_INT_DIV"
2183 rtx op1_xf, op2_xf, op0_xf, op0_di, twon34, twon34_exp;
2185 op0_xf = gen_reg_rtx (XFmode);
2186 op0_di = gen_reg_rtx (DImode);
2188 if (CONSTANT_P (operands[1]))
2189 operands[1] = force_reg (SImode, operands[1]);
2190 op1_xf = gen_reg_rtx (XFmode);
2191 expand_float (op1_xf, operands[1], 0);
2193 if (CONSTANT_P (operands[2]))
2194 operands[2] = force_reg (SImode, operands[2]);
2195 op2_xf = gen_reg_rtx (XFmode);
2196 expand_float (op2_xf, operands[2], 0);
2199 twon34_exp = gen_reg_rtx (DImode);
2200 emit_move_insn (twon34_exp, GEN_INT (65501));
2201 twon34 = gen_reg_rtx (XFmode);
2202 emit_insn (gen_setf_exp_xf (twon34, twon34_exp));
2204 emit_insn (gen_cond_trap (EQ, operands[2], CONST0_RTX (SImode),
2205 CONST1_RTX (SImode)));
2207 emit_insn (gen_divsi3_internal (op0_xf, op1_xf, op2_xf, twon34));
2209 emit_insn (gen_fix_truncxfdi2_alts (op0_di, op0_xf, const1_rtx));
2210 emit_move_insn (operands[0], gen_lowpart (SImode, op0_di));
2214 (define_expand "modsi3"
2215 [(set (match_operand:SI 0 "register_operand" "")
2216 (mod:SI (match_operand:SI 1 "general_operand" "")
2217 (match_operand:SI 2 "general_operand" "")))]
2218 "TARGET_INLINE_INT_DIV"
2220 rtx op2_neg, op1_di, div;
2222 div = gen_reg_rtx (SImode);
2223 emit_insn (gen_divsi3 (div, operands[1], operands[2]));
2225 op2_neg = expand_unop (SImode, neg_optab, operands[2], NULL_RTX, 0);
2227 /* This is a trick to get us to reuse the value that we're sure to
2228 have already copied to the FP regs. */
2229 op1_di = gen_reg_rtx (DImode);
2230 convert_move (op1_di, operands[1], 0);
2232 emit_insn (gen_maddsi4 (operands[0], div, op2_neg,
2233 gen_lowpart (SImode, op1_di)));
2237 (define_expand "udivsi3"
2238 [(set (match_operand:SI 0 "register_operand" "")
2239 (udiv:SI (match_operand:SI 1 "general_operand" "")
2240 (match_operand:SI 2 "general_operand" "")))]
2241 "TARGET_INLINE_INT_DIV"
2243 rtx op1_xf, op2_xf, op0_xf, op0_di, twon34, twon34_exp;
2245 op0_xf = gen_reg_rtx (XFmode);
2246 op0_di = gen_reg_rtx (DImode);
2248 if (CONSTANT_P (operands[1]))
2249 operands[1] = force_reg (SImode, operands[1]);
2250 op1_xf = gen_reg_rtx (XFmode);
2251 expand_float (op1_xf, operands[1], 1);
2253 if (CONSTANT_P (operands[2]))
2254 operands[2] = force_reg (SImode, operands[2]);
2255 op2_xf = gen_reg_rtx (XFmode);
2256 expand_float (op2_xf, operands[2], 1);
2259 twon34_exp = gen_reg_rtx (DImode);
2260 emit_move_insn (twon34_exp, GEN_INT (65501));
2261 twon34 = gen_reg_rtx (XFmode);
2262 emit_insn (gen_setf_exp_xf (twon34, twon34_exp));
2264 emit_insn (gen_cond_trap (EQ, operands[2], CONST0_RTX (SImode),
2265 CONST1_RTX (SImode)));
2267 emit_insn (gen_divsi3_internal (op0_xf, op1_xf, op2_xf, twon34));
2269 emit_insn (gen_fixuns_truncxfdi2_alts (op0_di, op0_xf, const1_rtx));
2270 emit_move_insn (operands[0], gen_lowpart (SImode, op0_di));
2274 (define_expand "umodsi3"
2275 [(set (match_operand:SI 0 "register_operand" "")
2276 (umod:SI (match_operand:SI 1 "general_operand" "")
2277 (match_operand:SI 2 "general_operand" "")))]
2278 "TARGET_INLINE_INT_DIV"
2280 rtx op2_neg, op1_di, div;
2282 div = gen_reg_rtx (SImode);
2283 emit_insn (gen_udivsi3 (div, operands[1], operands[2]));
2285 op2_neg = expand_unop (SImode, neg_optab, operands[2], NULL_RTX, 0);
2287 /* This is a trick to get us to reuse the value that we're sure to
2288 have already copied to the FP regs. */
2289 op1_di = gen_reg_rtx (DImode);
2290 convert_move (op1_di, operands[1], 1);
2292 emit_insn (gen_maddsi4 (operands[0], div, op2_neg,
2293 gen_lowpart (SImode, op1_di)));
2297 (define_insn_and_split "divsi3_internal"
2298 [(set (match_operand:XF 0 "fr_register_operand" "=&f")
2299 (float:XF (div:SI (match_operand:XF 1 "fr_reg_or_fp01_operand" "fG")
2300 (match_operand:XF 2 "fr_reg_or_fp01_operand" "fG"))))
2301 (clobber (match_scratch:XF 4 "=&f"))
2302 (clobber (match_scratch:XF 5 "=&f"))
2303 (clobber (match_scratch:BI 6 "=c"))
2304 (use (match_operand:XF 3 "fr_register_operand" "f"))]
2305 "TARGET_INLINE_INT_DIV"
2307 "&& reload_completed"
2308 [(parallel [(set (match_dup 0) (unspec:XF [(const_int 1) (match_dup 2)]
2309 UNSPEC_FR_RECIP_APPROX_RES))
2310 (set (match_dup 6) (unspec:BI [(match_dup 1) (match_dup 2)]
2311 UNSPEC_FR_RECIP_APPROX))
2312 (use (const_int 1))])
2313 (cond_exec (ne (match_dup 6) (const_int 0))
2314 (parallel [(set (match_dup 4) (mult:XF (match_dup 1) (match_dup 0)))
2315 (use (const_int 1))]))
2316 (cond_exec (ne (match_dup 6) (const_int 0))
2317 (parallel [(set (match_dup 5)
2318 (minus:XF (match_dup 7)
2319 (mult:XF (match_dup 2) (match_dup 0))))
2320 (use (const_int 1))]))
2321 (cond_exec (ne (match_dup 6) (const_int 0))
2322 (parallel [(set (match_dup 4)
2323 (plus:XF (mult:XF (match_dup 5) (match_dup 4))
2325 (use (const_int 1))]))
2326 (cond_exec (ne (match_dup 6) (const_int 0))
2327 (parallel [(set (match_dup 5)
2328 (plus:XF (mult:XF (match_dup 5) (match_dup 5))
2330 (use (const_int 1))]))
2331 (cond_exec (ne (match_dup 6) (const_int 0))
2332 (parallel [(set (match_dup 0)
2333 (plus:XF (mult:XF (match_dup 5) (match_dup 4))
2335 (use (const_int 1))]))
2337 "operands[7] = CONST1_RTX (XFmode);"
2338 [(set_attr "predicable" "no")])
2340 ;; ::::::::::::::::::::
2342 ;; :: 64-bit Integer arithmetic
2344 ;; ::::::::::::::::::::
2346 (define_insn "adddi3"
2347 [(set (match_operand:DI 0 "gr_register_operand" "=r,r,r")
2348 (plus:DI (match_operand:DI 1 "gr_register_operand" "%r,r,a")
2349 (match_operand:DI 2 "gr_reg_or_22bit_operand" "r,I,J")))]
2355 [(set_attr "itanium_class" "ialu")])
2357 (define_insn "*adddi3_plus1"
2358 [(set (match_operand:DI 0 "gr_register_operand" "=r")
2359 (plus:DI (plus:DI (match_operand:DI 1 "gr_register_operand" "r")
2360 (match_operand:DI 2 "gr_register_operand" "r"))
2363 "add %0 = %1, %2, 1"
2364 [(set_attr "itanium_class" "ialu")])
2366 ;; This has some of the same problems as shladd. We let the shladd
2367 ;; eliminator hack handle it, which results in the 1 being forced into
2368 ;; a register, but not more ugliness here.
2369 (define_insn "*adddi3_plus1_alt"
2370 [(set (match_operand:DI 0 "gr_register_operand" "=r")
2371 (plus:DI (mult:DI (match_operand:DI 1 "gr_register_operand" "r")
2375 "add %0 = %1, %1, 1"
2376 [(set_attr "itanium_class" "ialu")])
2378 (define_insn "subdi3"
2379 [(set (match_operand:DI 0 "gr_register_operand" "=r")
2380 (minus:DI (match_operand:DI 1 "gr_reg_or_8bit_operand" "rK")
2381 (match_operand:DI 2 "gr_register_operand" "r")))]
2384 [(set_attr "itanium_class" "ialu")])
2386 (define_insn "*subdi3_minus1"
2387 [(set (match_operand:DI 0 "gr_register_operand" "=r")
2388 (plus:DI (not:DI (match_operand:DI 1 "gr_register_operand" "r"))
2389 (match_operand:DI 2 "gr_register_operand" "r")))]
2391 "sub %0 = %2, %1, 1"
2392 [(set_attr "itanium_class" "ialu")])
2394 ;; ??? Use grfr instead of fr because of virtual register elimination
2395 ;; and silly test cases multiplying by the frame pointer.
2396 (define_insn "muldi3"
2397 [(set (match_operand:DI 0 "fr_register_operand" "=f")
2398 (mult:DI (match_operand:DI 1 "grfr_register_operand" "f")
2399 (match_operand:DI 2 "grfr_register_operand" "f")))]
2401 "xmpy.l %0 = %1, %2"
2402 [(set_attr "itanium_class" "xmpy")])
2404 ;; ??? If operand 3 is an eliminable reg, then register elimination causes the
2405 ;; same problem that we have with shladd below. Unfortunately, this case is
2406 ;; much harder to fix because the multiply puts the result in an FP register,
2407 ;; but the add needs inputs from a general register. We add a spurious clobber
2408 ;; here so that it will be present just in case register elimination gives us
2409 ;; the funny result.
2411 ;; ??? Maybe validate_changes should try adding match_scratch clobbers?
2413 ;; ??? Maybe we should change how adds are canonicalized.
2415 (define_insn "madddi4"
2416 [(set (match_operand:DI 0 "fr_register_operand" "=f")
2417 (plus:DI (mult:DI (match_operand:DI 1 "grfr_register_operand" "f")
2418 (match_operand:DI 2 "grfr_register_operand" "f"))
2419 (match_operand:DI 3 "grfr_register_operand" "f")))
2420 (clobber (match_scratch:DI 4 "=X"))]
2422 "xma.l %0 = %1, %2, %3"
2423 [(set_attr "itanium_class" "xmpy")])
2425 ;; This can be created by register elimination if operand3 of shladd is an
2426 ;; eliminable register or has reg_equiv_constant set.
2428 ;; We have to use nonmemory_operand for operand 4, to ensure that the
2429 ;; validate_changes call inside eliminate_regs will always succeed. If it
2430 ;; doesn't succeed, then this remain a madddi4 pattern, and will be reloaded
2433 (define_insn "*madddi4_elim"
2434 [(set (match_operand:DI 0 "register_operand" "=&r")
2435 (plus:DI (plus:DI (mult:DI (match_operand:DI 1 "register_operand" "f")
2436 (match_operand:DI 2 "register_operand" "f"))
2437 (match_operand:DI 3 "register_operand" "f"))
2438 (match_operand:DI 4 "nonmemory_operand" "rI")))
2439 (clobber (match_scratch:DI 5 "=f"))]
2440 "reload_in_progress"
2442 [(set_attr "itanium_class" "unknown")])
2445 [(set (match_operand:DI 0 "register_operand" "")
2446 (plus:DI (plus:DI (mult:DI (match_operand:DI 1 "register_operand" "")
2447 (match_operand:DI 2 "register_operand" ""))
2448 (match_operand:DI 3 "register_operand" ""))
2449 (match_operand:DI 4 "gr_reg_or_14bit_operand" "")))
2450 (clobber (match_scratch:DI 5 ""))]
2452 [(parallel [(set (match_dup 5) (plus:DI (mult:DI (match_dup 1) (match_dup 2))
2454 (clobber (match_dup 0))])
2455 (set (match_dup 0) (match_dup 5))
2456 (set (match_dup 0) (plus:DI (match_dup 0) (match_dup 4)))]
2459 (define_insn "smuldi3_highpart"
2460 [(set (match_operand:DI 0 "fr_register_operand" "=f")
2463 (mult:TI (sign_extend:TI
2464 (match_operand:DI 1 "fr_reg_or_fp01_operand" "fG"))
2466 (match_operand:DI 2 "fr_reg_or_fp01_operand" "fG")))
2469 "xmpy.h %0 = %F1, %F2"
2470 [(set_attr "itanium_class" "xmpy")])
2472 (define_insn "umuldi3_highpart"
2473 [(set (match_operand:DI 0 "fr_register_operand" "=f")
2476 (mult:TI (zero_extend:TI
2477 (match_operand:DI 1 "fr_reg_or_fp01_operand" "fG"))
2479 (match_operand:DI 2 "fr_reg_or_fp01_operand" "fG")))
2482 "xmpy.hu %0 = %F1, %F2"
2483 [(set_attr "itanium_class" "xmpy")])
2485 (define_insn "negdi2"
2486 [(set (match_operand:DI 0 "gr_register_operand" "=r")
2487 (neg:DI (match_operand:DI 1 "gr_register_operand" "r")))]
2490 [(set_attr "itanium_class" "ialu")])
2492 (define_expand "absdi2"
2494 (ge:BI (match_operand:DI 1 "gr_register_operand" "") (const_int 0)))
2495 (set (match_operand:DI 0 "gr_register_operand" "")
2496 (if_then_else:DI (eq (match_dup 2) (const_int 0))
2497 (neg:DI (match_dup 1))
2500 { operands[2] = gen_reg_rtx (BImode); })
2502 (define_expand "smindi3"
2504 (ge:BI (match_operand:DI 1 "gr_register_operand" "")
2505 (match_operand:DI 2 "gr_register_operand" "")))
2506 (set (match_operand:DI 0 "gr_register_operand" "")
2507 (if_then_else:DI (ne (match_dup 3) (const_int 0))
2508 (match_dup 2) (match_dup 1)))]
2510 { operands[3] = gen_reg_rtx (BImode); })
2512 (define_expand "smaxdi3"
2514 (ge:BI (match_operand:DI 1 "gr_register_operand" "")
2515 (match_operand:DI 2 "gr_register_operand" "")))
2516 (set (match_operand:DI 0 "gr_register_operand" "")
2517 (if_then_else:DI (ne (match_dup 3) (const_int 0))
2518 (match_dup 1) (match_dup 2)))]
2520 { operands[3] = gen_reg_rtx (BImode); })
2522 (define_expand "umindi3"
2524 (geu:BI (match_operand:DI 1 "gr_register_operand" "")
2525 (match_operand:DI 2 "gr_register_operand" "")))
2526 (set (match_operand:DI 0 "gr_register_operand" "")
2527 (if_then_else:DI (ne (match_dup 3) (const_int 0))
2528 (match_dup 2) (match_dup 1)))]
2530 { operands[3] = gen_reg_rtx (BImode); })
2532 (define_expand "umaxdi3"
2534 (geu:BI (match_operand:DI 1 "gr_register_operand" "")
2535 (match_operand:DI 2 "gr_register_operand" "")))
2536 (set (match_operand:DI 0 "gr_register_operand" "")
2537 (if_then_else:DI (ne (match_dup 3) (const_int 0))
2538 (match_dup 1) (match_dup 2)))]
2540 { operands[3] = gen_reg_rtx (BImode); })
2542 (define_expand "ffsdi2"
2544 (eq:BI (match_operand:DI 1 "gr_register_operand" "") (const_int 0)))
2545 (set (match_dup 2) (plus:DI (match_dup 1) (const_int -1)))
2546 (set (match_dup 5) (const_int 0))
2547 (set (match_dup 3) (xor:DI (match_dup 1) (match_dup 2)))
2548 (set (match_dup 4) (popcount:DI (match_dup 3)))
2549 (set (match_operand:DI 0 "gr_register_operand" "")
2550 (if_then_else:DI (ne (match_dup 6) (const_int 0))
2551 (match_dup 5) (match_dup 4)))]
2554 operands[2] = gen_reg_rtx (DImode);
2555 operands[3] = gen_reg_rtx (DImode);
2556 operands[4] = gen_reg_rtx (DImode);
2557 operands[5] = gen_reg_rtx (DImode);
2558 operands[6] = gen_reg_rtx (BImode);
2561 (define_expand "ctzdi2"
2562 [(set (match_dup 2) (plus:DI (match_operand:DI 1 "gr_register_operand" "")
2564 (set (match_dup 3) (not:DI (match_dup 1)))
2565 (set (match_dup 4) (and:DI (match_dup 2) (match_dup 3)))
2566 (set (match_operand:DI 0 "gr_register_operand" "")
2567 (popcount:DI (match_dup 4)))]
2570 operands[2] = gen_reg_rtx (DImode);
2571 operands[3] = gen_reg_rtx (DImode);
2572 operands[4] = gen_reg_rtx (DImode);
2575 ;; Note the computation here is op0 = 63 - (exp - 0xffff).
2576 (define_expand "clzdi2"
2578 (unsigned_float:XF (match_operand:DI 1 "fr_reg_or_fp01_operand" "")))
2580 (unspec:DI [(match_dup 2)] UNSPEC_GETF_EXP))
2581 (set (match_dup 4) (const_int 65598))
2582 (set (match_operand:DI 0 "gr_register_operand" "")
2583 (minus:DI (match_dup 4) (match_dup 3)))]
2586 operands[2] = gen_reg_rtx (XFmode);
2587 operands[3] = gen_reg_rtx (DImode);
2588 operands[4] = gen_reg_rtx (DImode);
2591 (define_insn "popcountdi2"
2592 [(set (match_operand:DI 0 "gr_register_operand" "=r")
2593 (popcount:DI (match_operand:DI 1 "gr_register_operand" "r")))]
2596 [(set_attr "itanium_class" "mmmul")])
2598 (define_insn "bswapdi2"
2599 [(set (match_operand:DI 0 "gr_register_operand" "=r")
2600 (bswap:DI (match_operand:DI 1 "gr_register_operand" "r")))]
2602 "mux1 %0 = %1, @rev"
2603 [(set_attr "itanium_class" "mmshf")])
2605 (define_insn "*getf_exp_xf"
2606 [(set (match_operand:DI 0 "gr_register_operand" "=r")
2607 (unspec:DI [(match_operand:XF 1 "fr_reg_or_fp01_operand" "fG")]
2611 [(set_attr "itanium_class" "frfr")])
2613 (define_expand "divdi3"
2614 [(set (match_operand:DI 0 "register_operand" "")
2615 (div:DI (match_operand:DI 1 "general_operand" "")
2616 (match_operand:DI 2 "general_operand" "")))]
2617 "TARGET_INLINE_INT_DIV"
2619 rtx op1_xf, op2_xf, op0_xf;
2621 op0_xf = gen_reg_rtx (XFmode);
2623 if (CONSTANT_P (operands[1]))
2624 operands[1] = force_reg (DImode, operands[1]);
2625 op1_xf = gen_reg_rtx (XFmode);
2626 expand_float (op1_xf, operands[1], 0);
2628 if (CONSTANT_P (operands[2]))
2629 operands[2] = force_reg (DImode, operands[2]);
2630 op2_xf = gen_reg_rtx (XFmode);
2631 expand_float (op2_xf, operands[2], 0);
2633 emit_insn (gen_cond_trap (EQ, operands[2], CONST0_RTX (DImode),
2634 CONST1_RTX (DImode)));
2636 if (TARGET_INLINE_INT_DIV == INL_MIN_LAT)
2637 emit_insn (gen_divdi3_internal_lat (op0_xf, op1_xf, op2_xf));
2639 emit_insn (gen_divdi3_internal_thr (op0_xf, op1_xf, op2_xf));
2641 emit_insn (gen_fix_truncxfdi2_alts (operands[0], op0_xf, const1_rtx));
2645 (define_expand "moddi3"
2646 [(set (match_operand:DI 0 "register_operand" "")
2647 (mod:SI (match_operand:DI 1 "general_operand" "")
2648 (match_operand:DI 2 "general_operand" "")))]
2649 "TARGET_INLINE_INT_DIV"
2653 div = gen_reg_rtx (DImode);
2654 emit_insn (gen_divdi3 (div, operands[1], operands[2]));
2656 op2_neg = expand_unop (DImode, neg_optab, operands[2], NULL_RTX, 0);
2658 emit_insn (gen_madddi4 (operands[0], div, op2_neg, operands[1]));
2662 (define_expand "udivdi3"
2663 [(set (match_operand:DI 0 "register_operand" "")
2664 (udiv:DI (match_operand:DI 1 "general_operand" "")
2665 (match_operand:DI 2 "general_operand" "")))]
2666 "TARGET_INLINE_INT_DIV"
2668 rtx op1_xf, op2_xf, op0_xf;
2670 op0_xf = gen_reg_rtx (XFmode);
2672 if (CONSTANT_P (operands[1]))
2673 operands[1] = force_reg (DImode, operands[1]);
2674 op1_xf = gen_reg_rtx (XFmode);
2675 expand_float (op1_xf, operands[1], 1);
2677 if (CONSTANT_P (operands[2]))
2678 operands[2] = force_reg (DImode, operands[2]);
2679 op2_xf = gen_reg_rtx (XFmode);
2680 expand_float (op2_xf, operands[2], 1);
2682 emit_insn (gen_cond_trap (EQ, operands[2], CONST0_RTX (DImode),
2683 CONST1_RTX (DImode)));
2685 if (TARGET_INLINE_INT_DIV == INL_MIN_LAT)
2686 emit_insn (gen_divdi3_internal_lat (op0_xf, op1_xf, op2_xf));
2688 emit_insn (gen_divdi3_internal_thr (op0_xf, op1_xf, op2_xf));
2690 emit_insn (gen_fixuns_truncxfdi2_alts (operands[0], op0_xf, const1_rtx));
2694 (define_expand "umoddi3"
2695 [(set (match_operand:DI 0 "register_operand" "")
2696 (umod:DI (match_operand:DI 1 "general_operand" "")
2697 (match_operand:DI 2 "general_operand" "")))]
2698 "TARGET_INLINE_INT_DIV"
2702 div = gen_reg_rtx (DImode);
2703 emit_insn (gen_udivdi3 (div, operands[1], operands[2]));
2705 op2_neg = expand_unop (DImode, neg_optab, operands[2], NULL_RTX, 0);
2707 emit_insn (gen_madddi4 (operands[0], div, op2_neg, operands[1]));
2711 (define_insn_and_split "divdi3_internal_lat"
2712 [(set (match_operand:XF 0 "fr_register_operand" "=&f")
2713 (float:XF (div:SI (match_operand:XF 1 "fr_reg_or_fp01_operand" "fG")
2714 (match_operand:XF 2 "fr_reg_or_fp01_operand" "fG"))))
2715 (clobber (match_scratch:XF 3 "=&f"))
2716 (clobber (match_scratch:XF 4 "=&f"))
2717 (clobber (match_scratch:XF 5 "=&f"))
2718 (clobber (match_scratch:BI 6 "=c"))]
2719 "TARGET_INLINE_INT_DIV == INL_MIN_LAT"
2721 "&& reload_completed"
2722 [(parallel [(set (match_dup 0) (unspec:XF [(const_int 1) (match_dup 2)]
2723 UNSPEC_FR_RECIP_APPROX_RES))
2724 (set (match_dup 6) (unspec:BI [(match_dup 1) (match_dup 2)]
2725 UNSPEC_FR_RECIP_APPROX))
2726 (use (const_int 1))])
2727 (cond_exec (ne (match_dup 6) (const_int 0))
2728 (parallel [(set (match_dup 3)
2729 (minus:XF (match_dup 7)
2730 (mult:XF (match_dup 2) (match_dup 0))))
2731 (use (const_int 1))]))
2732 (cond_exec (ne (match_dup 6) (const_int 0))
2733 (parallel [(set (match_dup 4) (mult:XF (match_dup 1) (match_dup 0)))
2734 (use (const_int 1))]))
2735 (cond_exec (ne (match_dup 6) (const_int 0))
2736 (parallel [(set (match_dup 5) (mult:XF (match_dup 3) (match_dup 3)))
2737 (use (const_int 1))]))
2738 (cond_exec (ne (match_dup 6) (const_int 0))
2739 (parallel [(set (match_dup 4)
2740 (plus:XF (mult:XF (match_dup 3) (match_dup 4))
2742 (use (const_int 1))]))
2743 (cond_exec (ne (match_dup 6) (const_int 0))
2744 (parallel [(set (match_dup 0)
2745 (plus:XF (mult:XF (match_dup 3) (match_dup 0))
2747 (use (const_int 1))]))
2748 (cond_exec (ne (match_dup 6) (const_int 0))
2749 (parallel [(set (match_dup 3)
2750 (plus:XF (mult:XF (match_dup 5) (match_dup 4))
2752 (use (const_int 1))]))
2753 (cond_exec (ne (match_dup 6) (const_int 0))
2754 (parallel [(set (match_dup 0)
2755 (plus:XF (mult:XF (match_dup 5) (match_dup 0))
2757 (use (const_int 1))]))
2758 (cond_exec (ne (match_dup 6) (const_int 0))
2759 (parallel [(set (match_dup 4)
2760 (minus:XF (match_dup 1)
2761 (mult:XF (match_dup 2) (match_dup 3))))
2762 (use (const_int 1))]))
2763 (cond_exec (ne (match_dup 6) (const_int 0))
2764 (parallel [(set (match_dup 0)
2765 (plus:XF (mult:XF (match_dup 4) (match_dup 0))
2767 (use (const_int 1))]))
2769 "operands[7] = CONST1_RTX (XFmode);"
2770 [(set_attr "predicable" "no")])
2772 (define_insn_and_split "divdi3_internal_thr"
2773 [(set (match_operand:XF 0 "fr_register_operand" "=&f")
2774 (float:XF (div:SI (match_operand:XF 1 "fr_reg_or_fp01_operand" "fG")
2775 (match_operand:XF 2 "fr_reg_or_fp01_operand" "fG"))))
2776 (clobber (match_scratch:XF 3 "=&f"))
2777 (clobber (match_scratch:XF 4 "=f"))
2778 (clobber (match_scratch:BI 5 "=c"))]
2779 "TARGET_INLINE_INT_DIV == INL_MAX_THR"
2781 "&& reload_completed"
2782 [(parallel [(set (match_dup 0) (unspec:XF [(const_int 1) (match_dup 2)]
2783 UNSPEC_FR_RECIP_APPROX_RES))
2784 (set (match_dup 5) (unspec:BI [(match_dup 1) (match_dup 2)]
2785 UNSPEC_FR_RECIP_APPROX))
2786 (use (const_int 1))])
2787 (cond_exec (ne (match_dup 5) (const_int 0))
2788 (parallel [(set (match_dup 3)
2789 (minus:XF (match_dup 6)
2790 (mult:XF (match_dup 2) (match_dup 0))))
2791 (use (const_int 1))]))
2792 (cond_exec (ne (match_dup 5) (const_int 0))
2793 (parallel [(set (match_dup 0)
2794 (plus:XF (mult:XF (match_dup 3) (match_dup 0))
2796 (use (const_int 1))]))
2797 (cond_exec (ne (match_dup 5) (const_int 0))
2798 (parallel [(set (match_dup 3) (mult:XF (match_dup 3) (match_dup 3)))
2799 (use (const_int 1))]))
2800 (cond_exec (ne (match_dup 5) (const_int 0))
2801 (parallel [(set (match_dup 0)
2802 (plus:XF (mult:XF (match_dup 3) (match_dup 0))
2804 (use (const_int 1))]))
2805 (cond_exec (ne (match_dup 5) (const_int 0))
2806 (parallel [(set (match_dup 3) (mult:XF (match_dup 0) (match_dup 1)))
2807 (use (const_int 1))]))
2808 (cond_exec (ne (match_dup 5) (const_int 0))
2809 (parallel [(set (match_dup 4)
2810 (minus:XF (match_dup 1)
2811 (mult:XF (match_dup 2) (match_dup 3))))
2812 (use (const_int 1))]))
2813 (cond_exec (ne (match_dup 5) (const_int 0))
2814 (parallel [(set (match_dup 0)
2815 (plus:XF (mult:XF (match_dup 4) (match_dup 0))
2817 (use (const_int 1))]))
2819 "operands[6] = CONST1_RTX (XFmode);"
2820 [(set_attr "predicable" "no")])
2822 ;; ::::::::::::::::::::
2824 ;; :: 128-bit Integer arithmetic
2826 ;; ::::::::::::::::::::
2828 (define_insn "addti3"
2829 [(set (match_operand:TI 0 "gr_register_operand" "=&r")
2830 (plus:TI (match_operand:TI 1 "gr_register_operand" "%r")
2831 (match_operand:TI 2 "gr_reg_or_14bit_operand" "rI")))
2832 (clobber (match_scratch:BI 3 "=&c"))]
2835 [(set_attr "itanium_class" "unknown")])
2838 [(set (match_operand:TI 0 "register_operand" "")
2839 (plus:TI (match_operand:TI 1 "register_operand" "")
2840 (match_operand:TI 2 "register_operand" "")))
2841 (clobber (match_scratch:BI 3 ""))]
2843 [(set (match_dup 0) (plus:DI (match_dup 1) (match_dup 2)))
2844 (set (match_dup 3) (ltu:BI (match_dup 0) (match_dup 1)))
2845 (cond_exec (eq (match_dup 3) (const_int 0))
2846 (set (match_dup 4) (plus:DI (match_dup 5) (match_dup 6))))
2847 (cond_exec (ne (match_dup 3) (const_int 0))
2849 (plus:DI (plus:DI (match_dup 5) (match_dup 6))
2852 operands[4] = gen_highpart (DImode, operands[0]);
2853 operands[0] = gen_lowpart (DImode, operands[0]);
2854 operands[5] = gen_highpart (DImode, operands[1]);
2855 operands[1] = gen_lowpart (DImode, operands[1]);
2856 operands[6] = gen_highpart (DImode, operands[2]);
2857 operands[2] = gen_lowpart (DImode, operands[2]);
2861 [(set (match_operand:TI 0 "register_operand" "")
2862 (plus:TI (match_operand:TI 1 "register_operand" "")
2863 (match_operand:TI 2 "immediate_operand" "")))
2864 (clobber (match_scratch:BI 3 ""))]
2866 [(set (match_dup 0) (plus:DI (match_dup 1) (match_dup 2)))
2867 (set (match_dup 3) (ltu:BI (match_dup 0) (match_dup 1)))
2868 (cond_exec (eq (match_dup 3) (const_int 0))
2870 (plus:DI (match_dup 5) (match_dup 6))))
2871 (cond_exec (ne (match_dup 3) (const_int 0))
2873 (plus:DI (match_dup 5) (match_dup 7))))]
2875 operands[4] = gen_highpart (DImode, operands[0]);
2876 operands[0] = gen_lowpart (DImode, operands[0]);
2877 operands[5] = gen_highpart (DImode, operands[1]);
2878 operands[1] = gen_lowpart (DImode, operands[1]);
2879 operands[6] = INTVAL (operands[2]) < 0 ? constm1_rtx : const0_rtx;
2880 operands[7] = INTVAL (operands[2]) < 0 ? const0_rtx : const1_rtx;
2883 (define_insn "subti3"
2884 [(set (match_operand:TI 0 "gr_register_operand" "=&r")
2885 (minus:TI (match_operand:TI 1 "gr_reg_or_8bit_operand" "rK")
2886 (match_operand:TI 2 "gr_register_operand" "r")))
2887 (clobber (match_scratch:BI 3 "=&c"))]
2890 [(set_attr "itanium_class" "unknown")])
2893 [(set (match_operand:TI 0 "register_operand" "")
2894 (minus:TI (match_operand:TI 1 "register_operand" "")
2895 (match_operand:TI 2 "register_operand" "")))
2896 (clobber (match_scratch:BI 3 "=&c"))]
2898 [(set (match_dup 0) (minus:DI (match_dup 1) (match_dup 2)))
2899 (set (match_dup 3) (ltu:BI (match_dup 1) (match_dup 0)))
2900 (cond_exec (eq (match_dup 3) (const_int 0))
2901 (set (match_dup 4) (minus:DI (match_dup 5) (match_dup 6))))
2902 (cond_exec (ne (match_dup 3) (const_int 0))
2904 (plus:DI (not:DI (match_dup 6)) (match_dup 5))))]
2906 operands[4] = gen_highpart (DImode, operands[0]);
2907 operands[0] = gen_lowpart (DImode, operands[0]);
2908 operands[5] = gen_highpart (DImode, operands[1]);
2909 operands[1] = gen_lowpart (DImode, operands[1]);
2910 operands[6] = gen_highpart (DImode, operands[2]);
2911 operands[2] = gen_lowpart (DImode, operands[2]);
2915 [(set (match_operand:TI 0 "register_operand" "")
2916 (minus:TI (match_operand:TI 1 "immediate_operand" "")
2917 (match_operand:TI 2 "register_operand" "")))
2918 (clobber (match_scratch:BI 3 "=&c"))]
2919 "reload_completed && satisfies_constraint_K (operands[1])"
2920 [(set (match_dup 0) (minus:DI (match_dup 1) (match_dup 2)))
2921 (set (match_dup 3) (gtu:BI (match_dup 0) (match_dup 1)))
2922 (cond_exec (ne (match_dup 3) (const_int 0))
2923 (set (match_dup 4) (minus:DI (match_dup 6) (match_dup 5))))
2924 (cond_exec (eq (match_dup 3) (const_int 0))
2925 (set (match_dup 4) (minus:DI (match_dup 7) (match_dup 5))))]
2927 operands[4] = gen_highpart (DImode, operands[0]);
2928 operands[0] = gen_lowpart (DImode, operands[0]);
2929 operands[5] = gen_highpart (DImode, operands[2]);
2930 operands[2] = gen_lowpart (DImode, operands[2]);
2931 operands[6] = INTVAL (operands[1]) < 0 ? GEN_INT (-2) : constm1_rtx;
2932 operands[7] = INTVAL (operands[1]) < 0 ? constm1_rtx : const0_rtx;
2935 (define_expand "mulditi3"
2936 [(set (match_operand:TI 0 "fr_register_operand" "")
2937 (mult:TI (sign_extend:TI
2938 (match_operand:DI 1 "fr_reg_or_fp01_operand" ""))
2940 (match_operand:DI 2 "fr_reg_or_fp01_operand" ""))))]
2944 (define_insn_and_split "*mulditi3_internal"
2945 [(set (match_operand:TI 0 "fr_register_operand" "=&f")
2946 (mult:TI (sign_extend:TI
2947 (match_operand:DI 1 "fr_reg_or_fp01_operand" "fG"))
2949 (match_operand:DI 2 "fr_reg_or_fp01_operand" "fG"))))]
2953 [(set (match_dup 0) (mult:DI (match_dup 1) (match_dup 2)))
2954 (set (match_dup 3) (truncate:DI
2956 (mult:TI (sign_extend:TI (match_dup 1))
2957 (sign_extend:TI (match_dup 2)))
2960 operands[3] = gen_highpart (DImode, operands[0]);
2961 operands[0] = gen_lowpart (DImode, operands[0]);
2963 [(set_attr "itanium_class" "unknown")])
2965 (define_expand "umulditi3"
2966 [(set (match_operand:TI 0 "fr_register_operand" "")
2967 (mult:TI (zero_extend:TI
2968 (match_operand:DI 1 "fr_reg_or_fp01_operand" ""))
2970 (match_operand:DI 2 "fr_reg_or_fp01_operand" ""))))]
2974 (define_insn_and_split "*umulditi3_internal"
2975 [(set (match_operand:TI 0 "fr_register_operand" "=&f")
2976 (mult:TI (zero_extend:TI
2977 (match_operand:DI 1 "fr_reg_or_fp01_operand" "fG"))
2979 (match_operand:DI 2 "fr_reg_or_fp01_operand" "fG"))))]
2983 [(set (match_dup 0) (mult:DI (match_dup 1) (match_dup 2)))
2984 (set (match_dup 3) (truncate:DI
2986 (mult:TI (zero_extend:TI (match_dup 1))
2987 (zero_extend:TI (match_dup 2)))
2990 operands[3] = gen_highpart (DImode, operands[0]);
2991 operands[0] = gen_lowpart (DImode, operands[0]);
2993 [(set_attr "itanium_class" "unknown")])
2995 (define_insn_and_split "negti2"
2996 [(set (match_operand:TI 0 "gr_register_operand" "=&r")
2997 (neg:TI (match_operand:TI 1 "gr_register_operand" "r")))
2998 (clobber (match_scratch:BI 2 "=&c"))]
3002 [(set (match_dup 2) (eq:BI (match_dup 1) (const_int 0)))
3003 (set (match_dup 0) (minus:DI (const_int 0) (match_dup 1)))
3004 (cond_exec (eq (match_dup 2) (const_int 0))
3005 (set (match_dup 3) (minus:DI (const_int -1) (match_dup 4))))
3006 (cond_exec (ne (match_dup 2) (const_int 0))
3007 (set (match_dup 3) (minus:DI (const_int 0) (match_dup 4))))]
3009 operands[3] = gen_highpart (DImode, operands[0]);
3010 operands[0] = gen_lowpart (DImode, operands[0]);
3011 operands[4] = gen_highpart (DImode, operands[1]);
3012 operands[1] = gen_lowpart (DImode, operands[1]);
3014 [(set_attr "itanium_class" "unknown")])
3016 ;; ::::::::::::::::::::
3018 ;; :: 32-bit floating point arithmetic
3020 ;; ::::::::::::::::::::
3022 (define_insn "addsf3"
3023 [(set (match_operand:SF 0 "fr_register_operand" "=f")
3024 (plus:SF (match_operand:SF 1 "fr_reg_or_fp01_operand" "fG")
3025 (match_operand:SF 2 "fr_reg_or_fp01_operand" "fG")))]
3027 "fadd.s %0 = %F1, %F2"
3028 [(set_attr "itanium_class" "fmac")])
3030 (define_insn "subsf3"
3031 [(set (match_operand:SF 0 "fr_register_operand" "=f")
3032 (minus:SF (match_operand:SF 1 "fr_reg_or_fp01_operand" "fG")
3033 (match_operand:SF 2 "fr_reg_or_fp01_operand" "fG")))]
3035 "fsub.s %0 = %F1, %F2"
3036 [(set_attr "itanium_class" "fmac")])
3038 (define_insn "mulsf3"
3039 [(set (match_operand:SF 0 "fr_register_operand" "=f")
3040 (mult:SF (match_operand:SF 1 "fr_reg_or_fp01_operand" "fG")
3041 (match_operand:SF 2 "fr_reg_or_fp01_operand" "fG")))]
3043 "fmpy.s %0 = %F1, %F2"
3044 [(set_attr "itanium_class" "fmac")])
3046 (define_insn "abssf2"
3047 [(set (match_operand:SF 0 "fr_register_operand" "=f")
3048 (abs:SF (match_operand:SF 1 "fr_reg_or_fp01_operand" "fG")))]
3051 [(set_attr "itanium_class" "fmisc")])
3053 (define_insn "negsf2"
3054 [(set (match_operand:SF 0 "fr_register_operand" "=f")
3055 (neg:SF (match_operand:SF 1 "fr_reg_or_fp01_operand" "fG")))]
3058 [(set_attr "itanium_class" "fmisc")])
3060 (define_insn "*nabssf2"
3061 [(set (match_operand:SF 0 "fr_register_operand" "=f")
3062 (neg:SF (abs:SF (match_operand:SF 1 "fr_reg_or_fp01_operand" "fG"))))]
3065 [(set_attr "itanium_class" "fmisc")])
3067 (define_insn "copysignsf3"
3068 [(set (match_operand:SF 0 "register_operand" "=f")
3069 (unspec:SF [(match_operand:SF 1 "fr_reg_or_fp01_operand" "fG")
3070 (match_operand:SF 2 "fr_reg_or_fp01_operand" "fG")]
3073 "fmerge.s %0 = %F2, %F1"
3074 [(set_attr "itanium_class" "fmisc")])
3076 (define_insn "*ncopysignsf3"
3077 [(set (match_operand:SF 0 "register_operand" "=f")
3078 (neg:SF (unspec:SF [(match_operand:SF 1 "fr_reg_or_fp01_operand" "fG")
3079 (match_operand:SF 2 "fr_reg_or_fp01_operand" "fG")]
3082 "fmerge.ns %0 = %F2, %F1"
3083 [(set_attr "itanium_class" "fmisc")])
3085 (define_insn "sminsf3"
3086 [(set (match_operand:SF 0 "fr_register_operand" "=f")
3087 (smin:SF (match_operand:SF 1 "fr_reg_or_fp01_operand" "fG")
3088 (match_operand:SF 2 "fr_reg_or_fp01_operand" "fG")))]
3090 "fmin %0 = %F1, %F2"
3091 [(set_attr "itanium_class" "fmisc")])
3093 (define_insn "smaxsf3"
3094 [(set (match_operand:SF 0 "fr_register_operand" "=f")
3095 (smax:SF (match_operand:SF 1 "fr_reg_or_fp01_operand" "fG")
3096 (match_operand:SF 2 "fr_reg_or_fp01_operand" "fG")))]
3098 "fmax %0 = %F1, %F2"
3099 [(set_attr "itanium_class" "fmisc")])
3101 (define_insn "*maddsf4"
3102 [(set (match_operand:SF 0 "fr_register_operand" "=f")
3103 (plus:SF (mult:SF (match_operand:SF 1 "fr_reg_or_fp01_operand" "fG")
3104 (match_operand:SF 2 "fr_reg_or_fp01_operand" "fG"))
3105 (match_operand:SF 3 "fr_reg_or_fp01_operand" "fG")))]
3107 "fma.s %0 = %F1, %F2, %F3"
3108 [(set_attr "itanium_class" "fmac")])
3110 (define_insn "*msubsf4"
3111 [(set (match_operand:SF 0 "fr_register_operand" "=f")
3112 (minus:SF (mult:SF (match_operand:SF 1 "fr_reg_or_fp01_operand" "fG")
3113 (match_operand:SF 2 "fr_reg_or_fp01_operand" "fG"))
3114 (match_operand:SF 3 "fr_reg_or_fp01_operand" "fG")))]
3116 "fms.s %0 = %F1, %F2, %F3"
3117 [(set_attr "itanium_class" "fmac")])
3119 (define_insn "*nmulsf3"
3120 [(set (match_operand:SF 0 "fr_register_operand" "=f")
3121 (neg:SF (mult:SF (match_operand:SF 1 "fr_reg_or_fp01_operand" "fG")
3122 (match_operand:SF 2 "fr_reg_or_fp01_operand" "fG"))))]
3124 "fnmpy.s %0 = %F1, %F2"
3125 [(set_attr "itanium_class" "fmac")])
3127 (define_insn "*nmaddsf4"
3128 [(set (match_operand:SF 0 "fr_register_operand" "=f")
3129 (minus:SF (match_operand:SF 3 "fr_reg_or_fp01_operand" "fG")
3130 (mult:SF (match_operand:SF 1 "fr_reg_or_fp01_operand" "fG")
3131 (match_operand:SF 2 "fr_reg_or_fp01_operand" "fG"))))]
3133 "fnma.s %0 = %F1, %F2, %F3"
3134 [(set_attr "itanium_class" "fmac")])
3136 (define_insn "*nmaddsf4_alts"
3137 [(set (match_operand:SF 0 "fr_register_operand" "=f")
3138 (minus:SF (match_operand:SF 3 "fr_reg_or_fp01_operand" "fG")
3139 (mult:SF (match_operand:SF 1 "fr_reg_or_fp01_operand" "fG")
3140 (match_operand:SF 2 "fr_reg_or_fp01_operand" "fG"))))
3141 (use (match_operand:SI 4 "const_int_operand" ""))]
3143 "fnma.s.s%4 %0 = %F1, %F2, %F3"
3144 [(set_attr "itanium_class" "fmac")])
3146 (define_expand "divsf3"
3147 [(set (match_operand:SF 0 "fr_register_operand" "")
3148 (div:SF (match_operand:SF 1 "fr_reg_or_fp01_operand" "")
3149 (match_operand:SF 2 "fr_reg_or_fp01_operand" "")))]
3150 "TARGET_INLINE_FLOAT_DIV"
3153 if (TARGET_INLINE_FLOAT_DIV == INL_MIN_LAT)
3154 insn = gen_divsf3_internal_lat (operands[0], operands[1], operands[2]);
3156 insn = gen_divsf3_internal_thr (operands[0], operands[1], operands[2]);
3161 ;; Inline square root.
3163 (define_insn "*sqrt_approx"
3164 [(set (match_operand:XF 0 "fr_register_operand" "=f")
3165 (div:XF (const_int 1)
3166 (unspec:XF [(match_operand:XF 2 "fr_reg_or_fp01_operand" "fG")]
3167 UNSPEC_FR_SQRT_RECIP_APPROX_RES)))
3168 (set (match_operand:BI 1 "register_operand" "=c")
3169 (unspec:BI [(match_dup 2)] UNSPEC_FR_SQRT_RECIP_APPROX))
3170 (use (match_operand:SI 3 "const_int_operand" "")) ]
3172 "frsqrta.s%3 %0, %1 = %2"
3173 [(set_attr "itanium_class" "fmisc")
3174 (set_attr "predicable" "no")])
3176 (define_insn "setf_exp_xf"
3177 [(set (match_operand:XF 0 "fr_register_operand" "=f")
3178 (unspec:XF [(match_operand:DI 1 "register_operand" "r")]
3182 [(set_attr "itanium_class" "frfr")])
3184 (define_expand "sqrtsf2"
3185 [(set (match_operand:SF 0 "fr_register_operand" "=&f")
3186 (sqrt:SF (match_operand:SF 1 "fr_reg_or_fp01_operand" "fG")))]
3187 "TARGET_INLINE_SQRT"
3191 if (TARGET_INLINE_SQRT == INL_MIN_LAT)
3192 insn = gen_sqrtsf2_internal_lat (operands[0], operands[1]);
3195 gcc_assert (TARGET_INLINE_SQRT != INL_MIN_LAT);
3197 insn = gen_sqrtsf2_internal_thr (operands[0], operands[1]);
3202 ;; Latency-optimized square root.
3203 ;; FIXME: Implement.
3205 ;; Throughput-optimized square root.
3207 (define_insn_and_split "sqrtsf2_internal_thr"
3208 [(set (match_operand:SF 0 "fr_register_operand" "=&f")
3209 (sqrt:SF (match_operand:SF 1 "fr_reg_or_fp01_operand" "fG")))
3210 ;; Register r2 in optimization guide.
3211 (clobber (match_scratch:DI 2 "=r"))
3212 ;; Register f8 in optimization guide
3213 (clobber (match_scratch:XF 3 "=&f"))
3214 ;; Register f9 in optimization guide
3215 (clobber (match_scratch:XF 4 "=&f"))
3216 ;; Register f10 in optimization guide
3217 (clobber (match_scratch:XF 5 "=&f"))
3218 ;; Register p6 in optimization guide.
3219 (clobber (match_scratch:BI 6 "=c"))]
3220 "TARGET_INLINE_SQRT == INL_MAX_THR"
3222 "&& reload_completed"
3223 [ ;; exponent of +1/2 in r2
3224 (set (match_dup 2) (const_int 65534))
3227 (unspec:XF [(match_dup 2)] UNSPEC_SETF_EXP))
3229 ;; y0 = 1/sqrt(a) in f7
3230 (parallel [(set (match_dup 7)
3231 (div:XF (const_int 1)
3232 (unspec:XF [(match_dup 8)]
3233 UNSPEC_FR_SQRT_RECIP_APPROX_RES)))
3235 (unspec:BI [(match_dup 8)]
3236 UNSPEC_FR_SQRT_RECIP_APPROX))
3237 (use (const_int 0))])
3239 ;; H0 = 1/2 * y0 in f9
3240 (cond_exec (ne (match_dup 6) (const_int 0))
3241 (parallel [(set (match_dup 4)
3242 (plus:XF (mult:XF (match_dup 3) (match_dup 7))
3244 (use (const_int 1))]))
3246 ;; S0 = a * y0 in f7
3247 (cond_exec (ne (match_dup 6) (const_int 0))
3248 (parallel [(set (match_dup 7)
3249 (plus:XF (mult:XF (match_dup 8) (match_dup 7))
3251 (use (const_int 1))]))
3253 ;; d = 1/2 - S0 * H0 in f10
3254 (cond_exec (ne (match_dup 6) (const_int 0))
3255 (parallel [(set (match_dup 5)
3256 (minus:XF (match_dup 3)
3257 (mult:XF (match_dup 7) (match_dup 4))))
3258 (use (const_int 1))]))
3260 ;; d' = d + 1/2 * d in f8
3261 (cond_exec (ne (match_dup 6) (const_int 0))
3262 (parallel [(set (match_dup 3)
3263 (plus:XF (mult:XF (match_dup 3) (match_dup 5))
3265 (use (const_int 1))]))
3267 ;; e = d + d * d' in f8
3268 (cond_exec (ne (match_dup 6) (const_int 0))
3269 (parallel [(set (match_dup 3)
3270 (plus:XF (mult:XF (match_dup 5) (match_dup 3))
3272 (use (const_int 1))]))
3274 ;; S1 = S0 + e * S0 in f7
3275 (cond_exec (ne (match_dup 6) (const_int 0))
3276 (parallel [(set (match_dup 0)
3278 (plus:XF (mult:XF (match_dup 3) (match_dup 7))
3280 (use (const_int 1))]))
3282 ;; H1 = H0 + e * H0 in f8
3283 (cond_exec (ne (match_dup 6) (const_int 0))
3284 (parallel [(set (match_dup 3)
3285 (plus:XF (mult:XF (match_dup 3) (match_dup 4))
3287 (use (const_int 1))]))
3289 ;; d1 = a - S1 * S1 in f9
3290 (cond_exec (ne (match_dup 6) (const_int 0))
3291 (parallel [(set (match_dup 4)
3292 (minus:XF (match_dup 8)
3293 (mult:XF (match_dup 7) (match_dup 7))))
3294 (use (const_int 1))]))
3296 ;; S = S1 + d1 * H1 in f7
3297 (cond_exec (ne (match_dup 6) (const_int 0))
3298 (parallel [(set (match_dup 0)
3300 (plus:XF (mult:XF (match_dup 4) (match_dup 3))
3302 (use (const_int 0))]))]
3304 /* Generate 82-bit versions of the input and output operands. */
3305 operands[7] = gen_rtx_REG (XFmode, REGNO (operands[0]));
3306 operands[8] = gen_rtx_REG (XFmode, REGNO (operands[1]));
3307 /* Generate required floating-point constants. */
3308 operands[9] = CONST0_RTX (XFmode);
3310 [(set_attr "predicable" "no")])
3312 ;; ::::::::::::::::::::
3314 ;; :: 64-bit floating point arithmetic
3316 ;; ::::::::::::::::::::
3318 (define_insn "adddf3"
3319 [(set (match_operand:DF 0 "fr_register_operand" "=f")
3320 (plus:DF (match_operand:DF 1 "fr_reg_or_fp01_operand" "fG")
3321 (match_operand:DF 2 "fr_reg_or_fp01_operand" "fG")))]
3323 "fadd.d %0 = %F1, %F2"
3324 [(set_attr "itanium_class" "fmac")])
3326 (define_insn "*adddf3_trunc"
3327 [(set (match_operand:SF 0 "fr_register_operand" "=f")
3329 (plus:DF (match_operand:DF 1 "fr_reg_or_fp01_operand" "fG")
3330 (match_operand:DF 2 "fr_reg_or_fp01_operand" "fG"))))]
3332 "fadd.s %0 = %F1, %F2"
3333 [(set_attr "itanium_class" "fmac")])
3335 (define_insn "subdf3"
3336 [(set (match_operand:DF 0 "fr_register_operand" "=f")
3337 (minus:DF (match_operand:DF 1 "fr_reg_or_fp01_operand" "fG")
3338 (match_operand:DF 2 "fr_reg_or_fp01_operand" "fG")))]
3340 "fsub.d %0 = %F1, %F2"
3341 [(set_attr "itanium_class" "fmac")])
3343 (define_insn "*subdf3_trunc"
3344 [(set (match_operand:SF 0 "fr_register_operand" "=f")
3346 (minus:DF (match_operand:DF 1 "fr_reg_or_fp01_operand" "fG")
3347 (match_operand:DF 2 "fr_reg_or_fp01_operand" "fG"))))]
3349 "fsub.s %0 = %F1, %F2"
3350 [(set_attr "itanium_class" "fmac")])
3352 (define_insn "muldf3"
3353 [(set (match_operand:DF 0 "fr_register_operand" "=f")
3354 (mult:DF (match_operand:DF 1 "fr_reg_or_fp01_operand" "fG")
3355 (match_operand:DF 2 "fr_reg_or_fp01_operand" "fG")))]
3357 "fmpy.d %0 = %F1, %F2"
3358 [(set_attr "itanium_class" "fmac")])
3360 (define_insn "*muldf3_trunc"
3361 [(set (match_operand:SF 0 "fr_register_operand" "=f")
3363 (mult:DF (match_operand:DF 1 "fr_reg_or_fp01_operand" "fG")
3364 (match_operand:DF 2 "fr_reg_or_fp01_operand" "fG"))))]
3366 "fmpy.s %0 = %F1, %F2"
3367 [(set_attr "itanium_class" "fmac")])
3369 (define_insn "absdf2"
3370 [(set (match_operand:DF 0 "fr_register_operand" "=f")
3371 (abs:DF (match_operand:DF 1 "fr_reg_or_fp01_operand" "fG")))]
3374 [(set_attr "itanium_class" "fmisc")])
3376 (define_insn "negdf2"
3377 [(set (match_operand:DF 0 "fr_register_operand" "=f")
3378 (neg:DF (match_operand:DF 1 "fr_reg_or_fp01_operand" "fG")))]
3381 [(set_attr "itanium_class" "fmisc")])
3383 (define_insn "*nabsdf2"
3384 [(set (match_operand:DF 0 "fr_register_operand" "=f")
3385 (neg:DF (abs:DF (match_operand:DF 1 "fr_reg_or_fp01_operand" "fG"))))]
3388 [(set_attr "itanium_class" "fmisc")])
3390 (define_insn "copysigndf3"
3391 [(set (match_operand:DF 0 "register_operand" "=f")
3392 (unspec:DF [(match_operand:DF 1 "fr_reg_or_fp01_operand" "fG")
3393 (match_operand:DF 2 "fr_reg_or_fp01_operand" "fG")]
3396 "fmerge.s %0 = %F2, %F1"
3397 [(set_attr "itanium_class" "fmisc")])
3399 (define_insn "*ncopysigndf3"
3400 [(set (match_operand:DF 0 "register_operand" "=f")
3401 (neg:DF (unspec:DF [(match_operand:DF 1 "fr_reg_or_fp01_operand" "fG")
3402 (match_operand:DF 2 "fr_reg_or_fp01_operand" "fG")]
3405 "fmerge.ns %0 = %F2, %F1"
3406 [(set_attr "itanium_class" "fmisc")])
3408 (define_insn "smindf3"
3409 [(set (match_operand:DF 0 "fr_register_operand" "=f")
3410 (smin:DF (match_operand:DF 1 "fr_reg_or_fp01_operand" "fG")
3411 (match_operand:DF 2 "fr_reg_or_fp01_operand" "fG")))]
3413 "fmin %0 = %F1, %F2"
3414 [(set_attr "itanium_class" "fmisc")])
3416 (define_insn "smaxdf3"
3417 [(set (match_operand:DF 0 "fr_register_operand" "=f")
3418 (smax:DF (match_operand:DF 1 "fr_reg_or_fp01_operand" "fG")
3419 (match_operand:DF 2 "fr_reg_or_fp01_operand" "fG")))]
3421 "fmax %0 = %F1, %F2"
3422 [(set_attr "itanium_class" "fmisc")])
3424 (define_insn "*madddf4"
3425 [(set (match_operand:DF 0 "fr_register_operand" "=f")
3426 (plus:DF (mult:DF (match_operand:DF 1 "fr_reg_or_fp01_operand" "fG")
3427 (match_operand:DF 2 "fr_reg_or_fp01_operand" "fG"))
3428 (match_operand:DF 3 "fr_reg_or_fp01_operand" "fG")))]
3430 "fma.d %0 = %F1, %F2, %F3"
3431 [(set_attr "itanium_class" "fmac")])
3433 (define_insn "*madddf4_trunc"
3434 [(set (match_operand:SF 0 "fr_register_operand" "=f")
3436 (plus:DF (mult:DF (match_operand:DF 1 "fr_reg_or_fp01_operand" "fG")
3437 (match_operand:DF 2 "fr_reg_or_fp01_operand" "fG"))
3438 (match_operand:DF 3 "fr_reg_or_fp01_operand" "fG"))))]
3440 "fma.s %0 = %F1, %F2, %F3"
3441 [(set_attr "itanium_class" "fmac")])
3443 (define_insn "*msubdf4"
3444 [(set (match_operand:DF 0 "fr_register_operand" "=f")
3445 (minus:DF (mult:DF (match_operand:DF 1 "fr_reg_or_fp01_operand" "fG")
3446 (match_operand:DF 2 "fr_reg_or_fp01_operand" "fG"))
3447 (match_operand:DF 3 "fr_reg_or_fp01_operand" "fG")))]
3449 "fms.d %0 = %F1, %F2, %F3"
3450 [(set_attr "itanium_class" "fmac")])
3452 (define_insn "*msubdf4_trunc"
3453 [(set (match_operand:SF 0 "fr_register_operand" "=f")
3455 (minus:DF (mult:DF (match_operand:DF 1 "fr_reg_or_fp01_operand" "fG")
3456 (match_operand:DF 2 "fr_reg_or_fp01_operand" "fG"))
3457 (match_operand:DF 3 "fr_reg_or_fp01_operand" "fG"))))]
3459 "fms.s %0 = %F1, %F2, %F3"
3460 [(set_attr "itanium_class" "fmac")])
3462 (define_insn "*nmuldf3"
3463 [(set (match_operand:DF 0 "fr_register_operand" "=f")
3464 (neg:DF (mult:DF (match_operand:DF 1 "fr_reg_or_fp01_operand" "fG")
3465 (match_operand:DF 2 "fr_reg_or_fp01_operand" "fG"))))]
3467 "fnmpy.d %0 = %F1, %F2"
3468 [(set_attr "itanium_class" "fmac")])
3470 (define_insn "*nmuldf3_trunc"
3471 [(set (match_operand:SF 0 "fr_register_operand" "=f")
3473 (neg:DF (mult:DF (match_operand:DF 1 "fr_reg_or_fp01_operand" "fG")
3474 (match_operand:DF 2 "fr_reg_or_fp01_operand" "fG")))))]
3476 "fnmpy.s %0 = %F1, %F2"
3477 [(set_attr "itanium_class" "fmac")])
3479 (define_insn "*nmadddf4"
3480 [(set (match_operand:DF 0 "fr_register_operand" "=f")
3481 (minus:DF (match_operand:DF 3 "fr_reg_or_fp01_operand" "fG")
3482 (mult:DF (match_operand:DF 1 "fr_reg_or_fp01_operand" "fG")
3483 (match_operand:DF 2 "fr_reg_or_fp01_operand" "fG"))))]
3485 "fnma.d %0 = %F1, %F2, %F3"
3486 [(set_attr "itanium_class" "fmac")])
3488 (define_insn "*nmadddf4_alts"
3489 [(set (match_operand:DF 0 "fr_register_operand" "=f")
3490 (minus:DF (match_operand:DF 3 "fr_reg_or_fp01_operand" "fG")
3491 (mult:DF (match_operand:DF 1 "fr_reg_or_fp01_operand" "fG")
3492 (match_operand:DF 2 "fr_reg_or_fp01_operand" "fG"))))
3493 (use (match_operand:SI 4 "const_int_operand" ""))]
3495 "fnma.d.s%4 %0 = %F1, %F2, %F3"
3496 [(set_attr "itanium_class" "fmac")])
3498 (define_insn "*nmadddf4_truncsf"
3499 [(set (match_operand:SF 0 "fr_register_operand" "=f")
3501 (minus:DF (match_operand:DF 3 "fr_reg_or_fp01_operand" "fG")
3502 (mult:DF (match_operand:DF 1 "fr_reg_or_fp01_operand" "fG")
3503 (match_operand:DF 2 "fr_reg_or_fp01_operand" "fG")))))]
3505 "fnma.s %0 = %F1, %F2, %F3"
3506 [(set_attr "itanium_class" "fmac")])
3508 (define_insn "*nmadddf4_truncsf_alts"
3509 [(set (match_operand:SF 0 "fr_register_operand" "=f")
3511 (minus:DF (match_operand:DF 3 "fr_reg_or_fp01_operand" "fG")
3512 (mult:DF (match_operand:DF 1 "fr_reg_or_fp01_operand" "fG")
3513 (match_operand:DF 2 "fr_reg_or_fp01_operand" "fG")))))
3514 (use (match_operand:SI 4 "const_int_operand" ""))]
3516 "fnma.s.s%4 %0 = %F1, %F2, %F3"
3517 [(set_attr "itanium_class" "fmac")])
3519 (define_expand "divdf3"
3520 [(set (match_operand:DF 0 "fr_register_operand" "")
3521 (div:DF (match_operand:DF 1 "fr_reg_or_fp01_operand" "")
3522 (match_operand:DF 2 "fr_reg_or_fp01_operand" "")))]
3523 "TARGET_INLINE_FLOAT_DIV"
3526 if (TARGET_INLINE_FLOAT_DIV == INL_MIN_LAT)
3527 insn = gen_divdf3_internal_lat (operands[0], operands[1], operands[2]);
3529 insn = gen_divdf3_internal_thr (operands[0], operands[1], operands[2]);
3534 ;; Inline square root.
3536 (define_expand "sqrtdf2"
3537 [(set (match_operand:DF 0 "fr_register_operand" "=&f")
3538 (sqrt:DF (match_operand:DF 1 "fr_reg_or_fp01_operand" "fG")))]
3539 "TARGET_INLINE_SQRT"
3543 if (TARGET_INLINE_SQRT == INL_MIN_LAT)
3544 insn = gen_sqrtdf2_internal_lat (operands[0], operands[1]);
3547 gcc_assert (TARGET_INLINE_SQRT != INL_MIN_LAT);
3549 insn = gen_sqrtdf2_internal_thr (operands[0], operands[1]);
3554 ;; Latency-optimized square root.
3555 ;; FIXME: Implement.
3557 ;; Throughput-optimized square root.
3559 (define_insn_and_split "sqrtdf2_internal_thr"
3560 [(set (match_operand:DF 0 "fr_register_operand" "=&f")
3561 (sqrt:DF (match_operand:DF 1 "fr_reg_or_fp01_operand" "fG")))
3562 ;; Register r2 in optimization guide.
3563 (clobber (match_scratch:DI 2 "=r"))
3564 ;; Register f8 in optimization guide
3565 (clobber (match_scratch:XF 3 "=&f"))
3566 ;; Register f9 in optimization guide
3567 (clobber (match_scratch:XF 4 "=&f"))
3568 ;; Register f10 in optimization guide
3569 (clobber (match_scratch:XF 5 "=&f"))
3570 ;; Register p6 in optimization guide.
3571 (clobber (match_scratch:BI 6 "=c"))]
3572 "TARGET_INLINE_SQRT == INL_MAX_THR"
3574 "&& reload_completed"
3575 [ ;; exponent of +1/2 in r2
3576 (set (match_dup 2) (const_int 65534))
3579 (unspec:XF [(match_dup 2)] UNSPEC_SETF_EXP))
3581 ;; y0 = 1/sqrt(a) in f7
3582 (parallel [(set (match_dup 7)
3583 (div:XF (const_int 1)
3584 (unspec:XF [(match_dup 8)]
3585 UNSPEC_FR_SQRT_RECIP_APPROX_RES)))
3587 (unspec:BI [(match_dup 8)]
3588 UNSPEC_FR_SQRT_RECIP_APPROX))
3589 (use (const_int 0))])
3591 ;; H0 = 1/2 * y0 in f8
3592 (cond_exec (ne (match_dup 6) (const_int 0))
3593 (parallel [(set (match_dup 3)
3594 (plus:XF (mult:XF (match_dup 5) (match_dup 7))
3596 (use (const_int 1))]))
3598 ;; G0 = a * y0 in f7
3599 (cond_exec (ne (match_dup 6) (const_int 0))
3600 (parallel [(set (match_dup 7)
3601 (plus:XF (mult:XF (match_dup 8) (match_dup 7))
3603 (use (const_int 1))]))
3605 ;; r0 = 1/2 - G0 * H0 in f9
3606 (cond_exec (ne (match_dup 6) (const_int 0))
3607 (parallel [(set (match_dup 4)
3608 (minus:XF (match_dup 5)
3609 (mult:XF (match_dup 7) (match_dup 3))))
3610 (use (const_int 1))]))
3612 ;; H1 = H0 + r0 * H0 in f8
3613 (cond_exec (ne (match_dup 6) (const_int 0))
3614 (parallel [(set (match_dup 3)
3615 (plus:XF (mult:XF (match_dup 4) (match_dup 3))
3617 (use (const_int 1))]))
3619 ;; G1 = G0 + r0 * G0 in f7
3620 (cond_exec (ne (match_dup 6) (const_int 0))
3621 (parallel [(set (match_dup 7)
3622 (plus:XF (mult:XF (match_dup 4) (match_dup 7))
3624 (use (const_int 1))]))
3626 ;; r1 = 1/2 - G1 * H1 in f9
3627 (cond_exec (ne (match_dup 6) (const_int 0))
3628 (parallel [(set (match_dup 4)
3629 (minus:XF (match_dup 5)
3630 (mult:XF (match_dup 7) (match_dup 3))))
3631 (use (const_int 1))]))
3633 ;; H2 = H1 + r1 * H1 in f8
3634 (cond_exec (ne (match_dup 6) (const_int 0))
3635 (parallel [(set (match_dup 3)
3636 (plus:XF (mult:XF (match_dup 4) (match_dup 3))
3638 (use (const_int 1))]))
3640 ;; G2 = G1 + r1 * G1 in f7
3641 (cond_exec (ne (match_dup 6) (const_int 0))
3642 (parallel [(set (match_dup 7)
3643 (plus:XF (mult:XF (match_dup 4) (match_dup 7))
3645 (use (const_int 1))]))
3647 ;; d2 = a - G2 * G2 in f9
3648 (cond_exec (ne (match_dup 6) (const_int 0))
3649 (parallel [(set (match_dup 4)
3650 (minus:XF (match_dup 8)
3651 (mult:XF (match_dup 7) (match_dup 7))))
3652 (use (const_int 1))]))
3654 ;; G3 = G2 + d2 * H2 in f7
3655 (cond_exec (ne (match_dup 6) (const_int 0))
3656 (parallel [(set (match_dup 7)
3657 (plus:XF (mult:XF (match_dup 4) (match_dup 3))
3659 (use (const_int 1))]))
3661 ;; d3 = a - G3 * G3 in f9
3662 (cond_exec (ne (match_dup 6) (const_int 0))
3663 (parallel [(set (match_dup 4)
3664 (minus:XF (match_dup 8)
3665 (mult:XF (match_dup 7) (match_dup 7))))
3666 (use (const_int 1))]))
3668 ;; S = G3 + d3 * H2 in f7
3669 (cond_exec (ne (match_dup 6) (const_int 0))
3670 (parallel [(set (match_dup 0)
3672 (plus:XF (mult:XF (match_dup 4) (match_dup 3))
3674 (use (const_int 0))]))]
3676 /* Generate 82-bit versions of the input and output operands. */
3677 operands[7] = gen_rtx_REG (XFmode, REGNO (operands[0]));
3678 operands[8] = gen_rtx_REG (XFmode, REGNO (operands[1]));
3679 /* Generate required floating-point constants. */
3680 operands[9] = CONST0_RTX (XFmode);
3682 [(set_attr "predicable" "no")])
3684 ;; ::::::::::::::::::::
3686 ;; :: 80-bit floating point arithmetic
3688 ;; ::::::::::::::::::::
3690 (define_insn "addxf3"
3691 [(set (match_operand:XF 0 "fr_register_operand" "=f")
3692 (plus:XF (match_operand:XF 1 "xfreg_or_fp01_operand" "fG")
3693 (match_operand:XF 2 "xfreg_or_fp01_operand" "fG")))]
3695 "fadd %0 = %F1, %F2"
3696 [(set_attr "itanium_class" "fmac")])
3698 (define_insn "*addxf3_truncsf"
3699 [(set (match_operand:SF 0 "fr_register_operand" "=f")
3701 (plus:XF (match_operand:XF 1 "xfreg_or_fp01_operand" "fG")
3702 (match_operand:XF 2 "xfreg_or_fp01_operand" "fG"))))]
3704 "fadd.s %0 = %F1, %F2"
3705 [(set_attr "itanium_class" "fmac")])
3707 (define_insn "*addxf3_truncdf"
3708 [(set (match_operand:DF 0 "fr_register_operand" "=f")
3710 (plus:XF (match_operand:XF 1 "xfreg_or_fp01_operand" "fG")
3711 (match_operand:XF 2 "xfreg_or_fp01_operand" "fG"))))]
3713 "fadd.d %0 = %F1, %F2"
3714 [(set_attr "itanium_class" "fmac")])
3716 (define_insn "subxf3"
3717 [(set (match_operand:XF 0 "fr_register_operand" "=f")
3718 (minus:XF (match_operand:XF 1 "xfreg_or_fp01_operand" "fG")
3719 (match_operand:XF 2 "xfreg_or_fp01_operand" "fG")))]
3721 "fsub %0 = %F1, %F2"
3722 [(set_attr "itanium_class" "fmac")])
3724 (define_insn "*subxf3_truncsf"
3725 [(set (match_operand:SF 0 "fr_register_operand" "=f")
3727 (minus:XF (match_operand:XF 1 "xfreg_or_fp01_operand" "fG")
3728 (match_operand:XF 2 "xfreg_or_fp01_operand" "fG"))))]
3730 "fsub.s %0 = %F1, %F2"
3731 [(set_attr "itanium_class" "fmac")])
3733 (define_insn "*subxf3_truncdf"
3734 [(set (match_operand:DF 0 "fr_register_operand" "=f")
3736 (minus:XF (match_operand:XF 1 "xfreg_or_fp01_operand" "fG")
3737 (match_operand:XF 2 "xfreg_or_fp01_operand" "fG"))))]
3739 "fsub.d %0 = %F1, %F2"
3740 [(set_attr "itanium_class" "fmac")])
3742 (define_insn "mulxf3"
3743 [(set (match_operand:XF 0 "fr_register_operand" "=f")
3744 (mult:XF (match_operand:XF 1 "xfreg_or_fp01_operand" "fG")
3745 (match_operand:XF 2 "xfreg_or_fp01_operand" "fG")))]
3747 "fmpy %0 = %F1, %F2"
3748 [(set_attr "itanium_class" "fmac")])
3750 (define_insn "*mulxf3_truncsf"
3751 [(set (match_operand:SF 0 "fr_register_operand" "=f")
3753 (mult:XF (match_operand:XF 1 "xfreg_or_fp01_operand" "fG")
3754 (match_operand:XF 2 "xfreg_or_fp01_operand" "fG"))))]
3756 "fmpy.s %0 = %F1, %F2"
3757 [(set_attr "itanium_class" "fmac")])
3759 (define_insn "*mulxf3_truncdf"
3760 [(set (match_operand:DF 0 "fr_register_operand" "=f")
3762 (mult:XF (match_operand:XF 1 "xfreg_or_fp01_operand" "fG")
3763 (match_operand:XF 2 "xfreg_or_fp01_operand" "fG"))))]
3765 "fmpy.d %0 = %F1, %F2"
3766 [(set_attr "itanium_class" "fmac")])
3768 (define_insn "*mulxf3_alts"
3769 [(set (match_operand:XF 0 "fr_register_operand" "=f")
3770 (mult:XF (match_operand:XF 1 "xfreg_or_fp01_operand" "fG")
3771 (match_operand:XF 2 "xfreg_or_fp01_operand" "fG")))
3772 (use (match_operand:SI 3 "const_int_operand" ""))]
3774 "fmpy.s%3 %0 = %F1, %F2"
3775 [(set_attr "itanium_class" "fmac")])
3777 (define_insn "*mulxf3_truncsf_alts"
3778 [(set (match_operand:SF 0 "fr_register_operand" "=f")
3780 (mult:XF (match_operand:XF 1 "xfreg_or_fp01_operand" "fG")
3781 (match_operand:XF 2 "xfreg_or_fp01_operand" "fG"))))
3782 (use (match_operand:SI 3 "const_int_operand" ""))]
3784 "fmpy.s.s%3 %0 = %F1, %F2"
3785 [(set_attr "itanium_class" "fmac")])
3787 (define_insn "*mulxf3_truncdf_alts"
3788 [(set (match_operand:DF 0 "fr_register_operand" "=f")
3790 (mult:XF (match_operand:XF 1 "xfreg_or_fp01_operand" "fG")
3791 (match_operand:XF 2 "xfreg_or_fp01_operand" "fG"))))
3792 (use (match_operand:SI 3 "const_int_operand" ""))]
3794 "fmpy.d.s%3 %0 = %F1, %F2"
3795 [(set_attr "itanium_class" "fmac")])
3797 (define_insn "absxf2"
3798 [(set (match_operand:XF 0 "fr_register_operand" "=f")
3799 (abs:XF (match_operand:XF 1 "xfreg_or_fp01_operand" "fG")))]
3802 [(set_attr "itanium_class" "fmisc")])
3804 (define_insn "negxf2"
3805 [(set (match_operand:XF 0 "fr_register_operand" "=f")
3806 (neg:XF (match_operand:XF 1 "xfreg_or_fp01_operand" "fG")))]
3809 [(set_attr "itanium_class" "fmisc")])
3811 (define_insn "*nabsxf2"
3812 [(set (match_operand:XF 0 "fr_register_operand" "=f")
3813 (neg:XF (abs:XF (match_operand:XF 1 "xfreg_or_fp01_operand" "fG"))))]
3816 [(set_attr "itanium_class" "fmisc")])
3818 (define_insn "copysignxf3"
3819 [(set (match_operand:XF 0 "register_operand" "=f")
3820 (unspec:XF [(match_operand:XF 1 "fr_reg_or_fp01_operand" "fG")
3821 (match_operand:XF 2 "fr_reg_or_fp01_operand" "fG")]
3824 "fmerge.s %0 = %F2, %F1"
3825 [(set_attr "itanium_class" "fmisc")])
3827 (define_insn "*ncopysignxf3"
3828 [(set (match_operand:XF 0 "register_operand" "=f")
3829 (neg:XF (unspec:XF [(match_operand:XF 1 "fr_reg_or_fp01_operand" "fG")
3830 (match_operand:XF 2 "fr_reg_or_fp01_operand" "fG")]
3833 "fmerge.ns %0 = %F2, %F1"
3834 [(set_attr "itanium_class" "fmisc")])
3836 (define_insn "sminxf3"
3837 [(set (match_operand:XF 0 "fr_register_operand" "=f")
3838 (smin:XF (match_operand:XF 1 "xfreg_or_fp01_operand" "fG")
3839 (match_operand:XF 2 "xfreg_or_fp01_operand" "fG")))]
3841 "fmin %0 = %F1, %F2"
3842 [(set_attr "itanium_class" "fmisc")])
3844 (define_insn "smaxxf3"
3845 [(set (match_operand:XF 0 "fr_register_operand" "=f")
3846 (smax:XF (match_operand:XF 1 "xfreg_or_fp01_operand" "fG")
3847 (match_operand:XF 2 "xfreg_or_fp01_operand" "fG")))]
3849 "fmax %0 = %F1, %F2"
3850 [(set_attr "itanium_class" "fmisc")])
3852 (define_insn "*maddxf4"
3853 [(set (match_operand:XF 0 "fr_register_operand" "=f")
3854 (plus:XF (mult:XF (match_operand:XF 1 "xfreg_or_fp01_operand" "fG")
3855 (match_operand:XF 2 "xfreg_or_fp01_operand" "fG"))
3856 (match_operand:XF 3 "xfreg_or_fp01_operand" "fG")))]
3858 "fma %0 = %F1, %F2, %F3"
3859 [(set_attr "itanium_class" "fmac")])
3861 (define_insn "*maddxf4_truncsf"
3862 [(set (match_operand:SF 0 "fr_register_operand" "=f")
3864 (plus:XF (mult:XF (match_operand:XF 1 "xfreg_or_fp01_operand" "fG")
3865 (match_operand:XF 2 "xfreg_or_fp01_operand" "fG"))
3866 (match_operand:XF 3 "xfreg_or_fp01_operand" "fG"))))]
3868 "fma.s %0 = %F1, %F2, %F3"
3869 [(set_attr "itanium_class" "fmac")])
3871 (define_insn "*maddxf4_truncdf"
3872 [(set (match_operand:DF 0 "fr_register_operand" "=f")
3874 (plus:XF (mult:XF (match_operand:XF 1 "xfreg_or_fp01_operand" "fG")
3875 (match_operand:XF 2 "xfreg_or_fp01_operand" "fG"))
3876 (match_operand:XF 3 "xfreg_or_fp01_operand" "fG"))))]
3878 "fma.d %0 = %F1, %F2, %F3"
3879 [(set_attr "itanium_class" "fmac")])
3881 (define_insn "*maddxf4_alts"
3882 [(set (match_operand:XF 0 "fr_register_operand" "=f")
3883 (plus:XF (mult:XF (match_operand:XF 1 "xfreg_or_fp01_operand" "fG")
3884 (match_operand:XF 2 "xfreg_or_fp01_operand" "fG"))
3885 (match_operand:XF 3 "xfreg_or_fp01_operand" "fG")))
3886 (use (match_operand:SI 4 "const_int_operand" ""))]
3888 "fma.s%4 %0 = %F1, %F2, %F3"
3889 [(set_attr "itanium_class" "fmac")])
3891 (define_insn "*maddxf4_alts_truncsf"
3892 [(set (match_operand:SF 0 "fr_register_operand" "=f")
3894 (plus:XF (mult:XF (match_operand:XF 1 "xfreg_or_fp01_operand" "fG")
3895 (match_operand:XF 2 "xfreg_or_fp01_operand" "fG"))
3896 (match_operand:XF 3 "xfreg_or_fp01_operand" "fG"))))
3897 (use (match_operand:SI 4 "const_int_operand" ""))]
3899 "fma.s.s%4 %0 = %F1, %F2, %F3"
3900 [(set_attr "itanium_class" "fmac")])
3902 (define_insn "*maddxf4_alts_truncdf"
3903 [(set (match_operand:DF 0 "fr_register_operand" "=f")
3905 (plus:XF (mult:XF (match_operand:XF 1 "xfreg_or_fp01_operand" "fG")
3906 (match_operand:XF 2 "xfreg_or_fp01_operand" "fG"))
3907 (match_operand:XF 3 "xfreg_or_fp01_operand" "fG"))))
3908 (use (match_operand:SI 4 "const_int_operand" ""))]
3910 "fma.d.s%4 %0 = %F1, %F2, %F3"
3911 [(set_attr "itanium_class" "fmac")])
3913 (define_insn "*msubxf4"
3914 [(set (match_operand:XF 0 "fr_register_operand" "=f")
3915 (minus:XF (mult:XF (match_operand:XF 1 "xfreg_or_fp01_operand" "fG")
3916 (match_operand:XF 2 "xfreg_or_fp01_operand" "fG"))
3917 (match_operand:XF 3 "xfreg_or_fp01_operand" "fG")))]
3919 "fms %0 = %F1, %F2, %F3"
3920 [(set_attr "itanium_class" "fmac")])
3922 (define_insn "*msubxf4_truncsf"
3923 [(set (match_operand:SF 0 "fr_register_operand" "=f")
3925 (minus:XF (mult:XF (match_operand:XF 1 "xfreg_or_fp01_operand" "fG")
3926 (match_operand:XF 2 "xfreg_or_fp01_operand" "fG"))
3927 (match_operand:XF 3 "xfreg_or_fp01_operand" "fG"))))]
3929 "fms.s %0 = %F1, %F2, %F3"
3930 [(set_attr "itanium_class" "fmac")])
3932 (define_insn "*msubxf4_truncdf"
3933 [(set (match_operand:DF 0 "fr_register_operand" "=f")
3935 (minus:XF (mult:XF (match_operand:XF 1 "xfreg_or_fp01_operand" "fG")
3936 (match_operand:XF 2 "xfreg_or_fp01_operand" "fG"))
3937 (match_operand:XF 3 "xfreg_or_fp01_operand" "fG"))))]
3939 "fms.d %0 = %F1, %F2, %F3"
3940 [(set_attr "itanium_class" "fmac")])
3942 (define_insn "*nmulxf3"
3943 [(set (match_operand:XF 0 "fr_register_operand" "=f")
3944 (neg:XF (mult:XF (match_operand:XF 1 "xfreg_or_fp01_operand" "fG")
3945 (match_operand:XF 2 "xfreg_or_fp01_operand" "fG"))))]
3947 "fnmpy %0 = %F1, %F2"
3948 [(set_attr "itanium_class" "fmac")])
3950 (define_insn "*nmulxf3_truncsf"
3951 [(set (match_operand:SF 0 "fr_register_operand" "=f")
3954 (match_operand:XF 1 "xfreg_or_fp01_operand" "fG")
3955 (match_operand:XF 2 "xfreg_or_fp01_operand" "fG")))))]
3957 "fnmpy.s %0 = %F1, %F2"
3958 [(set_attr "itanium_class" "fmac")])
3960 (define_insn "*nmulxf3_truncdf"
3961 [(set (match_operand:DF 0 "fr_register_operand" "=f")
3964 (match_operand:XF 1 "xfreg_or_fp01_operand" "fG")
3965 (match_operand:XF 2 "xfreg_or_fp01_operand" "fG")))))]
3967 "fnmpy.d %0 = %F1, %F2"
3968 [(set_attr "itanium_class" "fmac")])
3970 (define_insn "*nmaddxf4"
3971 [(set (match_operand:XF 0 "fr_register_operand" "=f")
3972 (minus:XF (match_operand:XF 3 "xfreg_or_fp01_operand" "fG")
3973 (mult:XF (match_operand:XF 1 "xfreg_or_fp01_operand" "fG")
3974 (match_operand:XF 2 "xfreg_or_fp01_operand" "fG")
3977 "fnma %0 = %F1, %F2, %F3"
3978 [(set_attr "itanium_class" "fmac")])
3980 (define_insn "*nmaddxf4_truncsf"
3981 [(set (match_operand:SF 0 "fr_register_operand" "=f")
3983 (minus:XF (match_operand:XF 3 "xfreg_or_fp01_operand" "fG")
3984 (mult:XF (match_operand:XF 1 "xfreg_or_fp01_operand" "fG")
3985 (match_operand:XF 2 "xfreg_or_fp01_operand" "fG")
3988 "fnma.s %0 = %F1, %F2, %F3"
3989 [(set_attr "itanium_class" "fmac")])
3991 (define_insn "*nmaddxf4_truncdf"
3992 [(set (match_operand:DF 0 "fr_register_operand" "=f")
3994 (minus:XF (match_operand:XF 3 "xfreg_or_fp01_operand" "fG")
3995 (mult:XF (match_operand:XF 1 "xfreg_or_fp01_operand" "fG")
3996 (match_operand:XF 2 "xfreg_or_fp01_operand" "fG")
3999 "fnma.d %0 = %F1, %F2, %F3"
4000 [(set_attr "itanium_class" "fmac")])
4002 (define_insn "*nmaddxf4_alts"
4003 [(set (match_operand:XF 0 "fr_register_operand" "=f")
4004 (minus:XF (match_operand:XF 3 "xfreg_or_fp01_operand" "fG")
4005 (mult:XF (match_operand:XF 1 "xfreg_or_fp01_operand" "fG")
4006 (match_operand:XF 2 "xfreg_or_fp01_operand" "fG")
4008 (use (match_operand:SI 4 "const_int_operand" ""))]
4010 "fnma.s%4 %0 = %F1, %F2, %F3"
4011 [(set_attr "itanium_class" "fmac")])
4013 (define_insn "*nmaddxf4_truncsf_alts"
4014 [(set (match_operand:SF 0 "fr_register_operand" "=f")
4016 (minus:XF (match_operand:XF 3 "xfreg_or_fp01_operand" "fG")
4017 (mult:XF (match_operand:XF 1 "xfreg_or_fp01_operand" "fG")
4018 (match_operand:XF 2 "xfreg_or_fp01_operand" "fG")
4020 (use (match_operand:SI 4 "const_int_operand" ""))]
4022 "fnma.s.s%4 %0 = %F1, %F2, %F3"
4023 [(set_attr "itanium_class" "fmac")])
4025 (define_insn "*nmaddxf4_truncdf_alts"
4026 [(set (match_operand:DF 0 "fr_register_operand" "=f")
4028 (minus:XF (match_operand:XF 3 "xfreg_or_fp01_operand" "fG")
4029 (mult:XF (match_operand:XF 1 "xfreg_or_fp01_operand" "fG")
4030 (match_operand:XF 2 "xfreg_or_fp01_operand" "fG")
4032 (use (match_operand:SI 4 "const_int_operand" ""))]
4034 "fnma.d.s%4 %0 = %F1, %F2, %F3"
4035 [(set_attr "itanium_class" "fmac")])
4037 (define_expand "divxf3"
4038 [(set (match_operand:XF 0 "fr_register_operand" "")
4039 (div:XF (match_operand:XF 1 "fr_reg_or_fp01_operand" "")
4040 (match_operand:XF 2 "fr_reg_or_fp01_operand" "")))]
4041 "TARGET_INLINE_FLOAT_DIV"
4043 /* There is only one divxf3 sequence, not two like for divsf and divdf. */
4044 emit_insn (gen_divxf3_internal (operands[0], operands[1], operands[2]));
4048 ;; Inline square root.
4050 (define_expand "sqrtxf2"
4051 [(set (match_operand:XF 0 "fr_register_operand" "=&f")
4052 (sqrt:XF (match_operand:XF 1 "fr_reg_or_fp01_operand" "fG")))]
4053 "TARGET_INLINE_SQRT"
4057 if (TARGET_INLINE_SQRT == INL_MIN_LAT)
4058 insn = gen_sqrtxf2_internal_lat (operands[0], operands[1]);
4061 gcc_assert (TARGET_INLINE_SQRT != INL_MIN_LAT);
4063 insn = gen_sqrtxf2_internal_thr (operands[0], operands[1]);
4068 ;; Latency-optimized square root.
4069 ;; FIXME: Implement.
4071 ;; Throughput-optimized square root.
4073 (define_insn_and_split "sqrtxf2_internal_thr"
4074 [(set (match_operand:XF 0 "fr_register_operand" "=&f")
4075 (sqrt:XF (match_operand:XF 1 "fr_reg_or_fp01_operand" "fG")))
4076 ;; Register r2 in optimization guide.
4077 (clobber (match_scratch:DI 2 "=r"))
4078 ;; Register f8 in optimization guide
4079 (clobber (match_scratch:XF 3 "=&f"))
4080 ;; Register f9 in optimization guide
4081 (clobber (match_scratch:XF 4 "=&f"))
4082 ;; Register f10 in optimization guide
4083 (clobber (match_scratch:XF 5 "=&f"))
4084 ;; Register f11 in optimization guide
4085 (clobber (match_scratch:XF 6 "=&f"))
4086 ;; Register p6 in optimization guide.
4087 (clobber (match_scratch:BI 7 "=c"))]
4088 "TARGET_INLINE_SQRT == INL_MAX_THR"
4090 "&& reload_completed"
4091 [ ;; exponent of +1/2 in r2
4092 (set (match_dup 2) (const_int 65534))
4093 ;; +1/2 in f8. The Intel manual mistakenly specifies f10.
4095 (unspec:XF [(match_dup 2)] UNSPEC_SETF_EXP))
4097 ;; y0 = 1/sqrt(a) in f7
4098 (parallel [(set (match_dup 8)
4099 (div:XF (const_int 1)
4100 (unspec:XF [(match_dup 9)]
4101 UNSPEC_FR_SQRT_RECIP_APPROX_RES)))
4103 (unspec:BI [(match_dup 9)]
4104 UNSPEC_FR_SQRT_RECIP_APPROX))
4105 (use (const_int 0))])
4107 ;; H0 = 1/2 * y0 in f9
4108 (cond_exec (ne (match_dup 7) (const_int 0))
4109 (parallel [(set (match_dup 4)
4110 (plus:XF (mult:XF (match_dup 3) (match_dup 8))
4112 (use (const_int 1))]))
4114 ;; S0 = a * y0 in f7
4115 (cond_exec (ne (match_dup 7) (const_int 0))
4116 (parallel [(set (match_dup 8)
4117 (plus:XF (mult:XF (match_dup 9) (match_dup 8))
4119 (use (const_int 1))]))
4121 ;; d0 = 1/2 - S0 * H0 in f10
4122 (cond_exec (ne (match_dup 7) (const_int 0))
4123 (parallel [(set (match_dup 5)
4124 (minus:XF (match_dup 3)
4125 (mult:XF (match_dup 8) (match_dup 4))))
4126 (use (const_int 1))]))
4128 ;; H1 = H0 + d0 * H0 in f9
4129 (cond_exec (ne (match_dup 7) (const_int 0))
4130 (parallel [(set (match_dup 4)
4131 (plus:XF (mult:XF (match_dup 5) (match_dup 4))
4133 (use (const_int 1))]))
4135 ;; S1 = S0 + d0 * S0 in f7
4136 (cond_exec (ne (match_dup 7) (const_int 0))
4137 (parallel [(set (match_dup 8)
4138 (plus:XF (mult:XF (match_dup 5) (match_dup 8))
4140 (use (const_int 1))]))
4142 ;; d1 = 1/2 - S1 * H1 in f10
4143 (cond_exec (ne (match_dup 7) (const_int 0))
4144 (parallel [(set (match_dup 5)
4145 (minus:XF (match_dup 3)
4146 (mult:XF (match_dup 8) (match_dup 4))))
4147 (use (const_int 1))]))
4149 ;; H2 = H1 + d1 * H1 in f9
4150 (cond_exec (ne (match_dup 7) (const_int 0))
4151 (parallel [(set (match_dup 4)
4152 (plus:XF (mult:XF (match_dup 5) (match_dup 4))
4154 (use (const_int 1))]))
4156 ;; S2 = S1 + d1 * S1 in f7
4157 (cond_exec (ne (match_dup 7) (const_int 0))
4158 (parallel [(set (match_dup 8)
4159 (plus:XF (mult:XF (match_dup 5) (match_dup 8))
4161 (use (const_int 1))]))
4163 ;; d2 = 1/2 - S2 * H2 in f10
4164 (cond_exec (ne (match_dup 7) (const_int 0))
4165 (parallel [(set (match_dup 5)
4166 (minus:XF (match_dup 3)
4167 (mult:XF (match_dup 8) (match_dup 4))))
4168 (use (const_int 1))]))
4170 ;; e2 = a - S2 * S2 in f8
4171 (cond_exec (ne (match_dup 7) (const_int 0))
4172 (parallel [(set (match_dup 3)
4173 (minus:XF (match_dup 9)
4174 (mult:XF (match_dup 8) (match_dup 8))))
4175 (use (const_int 1))]))
4177 ;; S3 = S2 + e2 * H2 in f7
4178 (cond_exec (ne (match_dup 7) (const_int 0))
4179 (parallel [(set (match_dup 8)
4180 (plus:XF (mult:XF (match_dup 3) (match_dup 4))
4182 (use (const_int 1))]))
4184 ;; H3 = H2 + d2 * H2 in f9
4185 (cond_exec (ne (match_dup 7) (const_int 0))
4186 (parallel [(set (match_dup 4)
4187 (plus:XF (mult:XF (match_dup 5) (match_dup 4))
4189 (use (const_int 1))]))
4191 ;; e3 = a - S3 * S3 in f8
4192 (cond_exec (ne (match_dup 7) (const_int 0))
4193 (parallel [(set (match_dup 3)
4194 (minus:XF (match_dup 9)
4195 (mult:XF (match_dup 8) (match_dup 8))))
4196 (use (const_int 1))]))
4198 ;; S = S3 + e3 * H3 in f7
4199 (cond_exec (ne (match_dup 7) (const_int 0))
4200 (parallel [(set (match_dup 0)
4201 (plus:XF (mult:XF (match_dup 3) (match_dup 4))
4203 (use (const_int 0))]))]
4205 /* Generate 82-bit versions of the input and output operands. */
4206 operands[8] = gen_rtx_REG (XFmode, REGNO (operands[0]));
4207 operands[9] = gen_rtx_REG (XFmode, REGNO (operands[1]));
4208 /* Generate required floating-point constants. */
4209 operands[10] = CONST0_RTX (XFmode);
4211 [(set_attr "predicable" "no")])
4213 ;; ??? frcpa works like cmp.foo.unc.
4215 (define_insn "*recip_approx"
4216 [(set (match_operand:XF 0 "fr_register_operand" "=f")
4217 (unspec:XF [(const_int 1)
4218 (match_operand:XF 3 "fr_reg_or_fp01_operand" "fG")]
4219 UNSPEC_FR_RECIP_APPROX_RES))
4220 (set (match_operand:BI 1 "register_operand" "=c")
4221 (unspec:BI [(match_operand:XF 2 "fr_reg_or_fp01_operand" "fG")
4222 (match_dup 3)] UNSPEC_FR_RECIP_APPROX))
4223 (use (match_operand:SI 4 "const_int_operand" ""))]
4225 "frcpa.s%4 %0, %1 = %F2, %F3"
4226 [(set_attr "itanium_class" "fmisc")
4227 (set_attr "predicable" "no")])
4229 ;; ::::::::::::::::::::
4231 ;; :: 32-bit Integer Shifts and Rotates
4233 ;; ::::::::::::::::::::
4235 (define_expand "ashlsi3"
4236 [(set (match_operand:SI 0 "gr_register_operand" "")
4237 (ashift:SI (match_operand:SI 1 "gr_register_operand" "")
4238 (match_operand:SI 2 "gr_reg_or_5bit_operand" "")))]
4241 if (GET_CODE (operands[2]) != CONST_INT)
4243 /* Why oh why didn't Intel arrange for SHIFT_COUNT_TRUNCATED? Now
4244 we've got to get rid of stray bits outside the SImode register. */
4245 rtx subshift = gen_reg_rtx (DImode);
4246 emit_insn (gen_zero_extendsidi2 (subshift, operands[2]));
4247 operands[2] = subshift;
4251 (define_insn "*ashlsi3_internal"
4252 [(set (match_operand:SI 0 "gr_register_operand" "=r,r,r")
4253 (ashift:SI (match_operand:SI 1 "gr_register_operand" "r,r,r")
4254 (match_operand:DI 2 "gr_reg_or_5bit_operand" "R,n,r")))]
4257 shladd %0 = %1, %2, r0
4258 dep.z %0 = %1, %2, %E2
4260 [(set_attr "itanium_class" "ialu,ishf,mmshf")])
4262 (define_expand "ashrsi3"
4263 [(set (match_operand:SI 0 "gr_register_operand" "")
4264 (ashiftrt:SI (match_operand:SI 1 "gr_register_operand" "")
4265 (match_operand:SI 2 "gr_reg_or_5bit_operand" "")))]
4268 rtx subtarget = gen_reg_rtx (DImode);
4269 if (GET_CODE (operands[2]) == CONST_INT)
4270 emit_insn (gen_extv (subtarget, gen_lowpart (DImode, operands[1]),
4271 GEN_INT (32 - INTVAL (operands[2])), operands[2]));
4274 rtx subshift = gen_reg_rtx (DImode);
4275 emit_insn (gen_extendsidi2 (subtarget, operands[1]));
4276 emit_insn (gen_zero_extendsidi2 (subshift, operands[2]));
4277 emit_insn (gen_ashrdi3 (subtarget, subtarget, subshift));
4279 emit_move_insn (gen_lowpart (DImode, operands[0]), subtarget);
4283 (define_expand "lshrsi3"
4284 [(set (match_operand:SI 0 "gr_register_operand" "")
4285 (lshiftrt:SI (match_operand:SI 1 "gr_register_operand" "")
4286 (match_operand:SI 2 "gr_reg_or_5bit_operand" "")))]
4289 rtx subtarget = gen_reg_rtx (DImode);
4290 if (GET_CODE (operands[2]) == CONST_INT)
4291 emit_insn (gen_extzv (subtarget, gen_lowpart (DImode, operands[1]),
4292 GEN_INT (32 - INTVAL (operands[2])), operands[2]));
4295 rtx subshift = gen_reg_rtx (DImode);
4296 emit_insn (gen_zero_extendsidi2 (subtarget, operands[1]));
4297 emit_insn (gen_zero_extendsidi2 (subshift, operands[2]));
4298 emit_insn (gen_lshrdi3 (subtarget, subtarget, subshift));
4300 emit_move_insn (gen_lowpart (DImode, operands[0]), subtarget);
4304 ;; Use mix4.r/shr to implement rotrsi3. We only get 32 bits of valid result
4305 ;; here, instead of 64 like the patterns above. Keep the pattern together
4306 ;; until after combine; otherwise it won't get matched often.
4308 (define_expand "rotrsi3"
4309 [(set (match_operand:SI 0 "gr_register_operand" "")
4310 (rotatert:SI (match_operand:SI 1 "gr_register_operand" "")
4311 (match_operand:SI 2 "gr_reg_or_5bit_operand" "")))]
4314 if (GET_MODE (operands[2]) != VOIDmode)
4316 rtx tmp = gen_reg_rtx (DImode);
4317 emit_insn (gen_zero_extendsidi2 (tmp, operands[2]));
4322 (define_insn_and_split "*rotrsi3_internal"
4323 [(set (match_operand:SI 0 "gr_register_operand" "=&r")
4324 (rotatert:SI (match_operand:SI 1 "gr_register_operand" "r")
4325 (match_operand:DI 2 "gr_reg_or_5bit_operand" "rM")))]
4330 (ior:DI (zero_extend:DI (match_dup 1))
4331 (ashift:DI (zero_extend:DI (match_dup 1)) (const_int 32))))
4333 (lshiftrt:DI (match_dup 3) (match_dup 2)))]
4334 "operands[3] = gen_rtx_REG (DImode, REGNO (operands[0]));")
4336 (define_expand "rotlsi3"
4337 [(set (match_operand:SI 0 "gr_register_operand" "")
4338 (rotate:SI (match_operand:SI 1 "gr_register_operand" "")
4339 (match_operand:SI 2 "gr_reg_or_5bit_operand" "")))]
4342 if (! shift_32bit_count_operand (operands[2], SImode))
4344 rtx tmp = gen_reg_rtx (SImode);
4345 emit_insn (gen_subsi3 (tmp, GEN_INT (32), operands[2]));
4346 emit_insn (gen_rotrsi3 (operands[0], operands[1], tmp));
4351 (define_insn_and_split "*rotlsi3_internal"
4352 [(set (match_operand:SI 0 "gr_register_operand" "=r")
4353 (rotate:SI (match_operand:SI 1 "gr_register_operand" "r")
4354 (match_operand:SI 2 "shift_32bit_count_operand" "n")))]
4356 "mux2 %0 = %1, 0xe1"
4357 "reload_completed && INTVAL (operands[2]) != 16"
4359 (ior:DI (zero_extend:DI (match_dup 1))
4360 (ashift:DI (zero_extend:DI (match_dup 1)) (const_int 32))))
4362 (lshiftrt:DI (match_dup 3) (match_dup 2)))]
4364 operands[3] = gen_rtx_REG (DImode, REGNO (operands[0]));
4365 operands[2] = GEN_INT (32 - INTVAL (operands[2]));
4367 [(set_attr "itanium_class" "mmshf")])
4369 ;; ::::::::::::::::::::
4371 ;; :: 64-bit Integer Shifts and Rotates
4373 ;; ::::::::::::::::::::
4375 (define_insn "ashldi3"
4376 [(set (match_operand:DI 0 "gr_register_operand" "=r,r,r")
4377 (ashift:DI (match_operand:DI 1 "gr_register_operand" "r,r,r")
4378 (match_operand:DI 2 "gr_reg_or_6bit_operand" "R,r,rM")))]
4381 shladd %0 = %1, %2, r0
4384 [(set_attr "itanium_class" "ialu,mmshf,mmshfi")])
4386 ;; ??? Maybe combine this with the multiply and add instruction?
4388 (define_insn "*shladd"
4389 [(set (match_operand:DI 0 "gr_register_operand" "=r")
4390 (plus:DI (mult:DI (match_operand:DI 1 "gr_register_operand" "r")
4391 (match_operand:DI 2 "shladd_operand" "n"))
4392 (match_operand:DI 3 "gr_register_operand" "r")))]
4394 "shladd %0 = %1, %S2, %3"
4395 [(set_attr "itanium_class" "ialu")])
4397 ;; This can be created by register elimination if operand3 of shladd is an
4398 ;; eliminable register or has reg_equiv_constant set.
4400 ;; We have to use nonmemory_operand for operand 4, to ensure that the
4401 ;; validate_changes call inside eliminate_regs will always succeed. If it
4402 ;; doesn't succeed, then this remain a shladd pattern, and will be reloaded
4405 (define_insn_and_split "*shladd_elim"
4406 [(set (match_operand:DI 0 "gr_register_operand" "=&r")
4407 (plus:DI (plus:DI (mult:DI (match_operand:DI 1 "gr_register_operand" "r")
4408 (match_operand:DI 2 "shladd_operand" "n"))
4409 (match_operand:DI 3 "nonmemory_operand" "r"))
4410 (match_operand:DI 4 "nonmemory_operand" "rI")))]
4411 "reload_in_progress"
4412 "* gcc_unreachable ();"
4414 [(set (match_dup 0) (plus:DI (mult:DI (match_dup 1) (match_dup 2))
4416 (set (match_dup 0) (plus:DI (match_dup 0) (match_dup 4)))]
4418 [(set_attr "itanium_class" "unknown")])
4420 (define_insn "ashrdi3"
4421 [(set (match_operand:DI 0 "gr_register_operand" "=r,r")
4422 (ashiftrt:DI (match_operand:DI 1 "gr_register_operand" "r,r")
4423 (match_operand:DI 2 "gr_reg_or_6bit_operand" "r,rM")))]
4428 [(set_attr "itanium_class" "mmshf,mmshfi")])
4430 (define_insn "lshrdi3"
4431 [(set (match_operand:DI 0 "gr_register_operand" "=r,r")
4432 (lshiftrt:DI (match_operand:DI 1 "gr_register_operand" "r,r")
4433 (match_operand:DI 2 "gr_reg_or_6bit_operand" "r,rM")))]
4438 [(set_attr "itanium_class" "mmshf,mmshfi")])
4440 ;; Using a predicate that accepts only constants doesn't work, because optabs
4441 ;; will load the operand into a register and call the pattern if the predicate
4442 ;; did not accept it on the first try. So we use nonmemory_operand and then
4443 ;; verify that we have an appropriate constant in the expander.
4445 (define_expand "rotrdi3"
4446 [(set (match_operand:DI 0 "gr_register_operand" "")
4447 (rotatert:DI (match_operand:DI 1 "gr_register_operand" "")
4448 (match_operand:DI 2 "nonmemory_operand" "")))]
4451 if (! shift_count_operand (operands[2], DImode))
4455 (define_insn "*rotrdi3_internal"
4456 [(set (match_operand:DI 0 "gr_register_operand" "=r")
4457 (rotatert:DI (match_operand:DI 1 "gr_register_operand" "r")
4458 (match_operand:DI 2 "shift_count_operand" "M")))]
4460 "shrp %0 = %1, %1, %2"
4461 [(set_attr "itanium_class" "ishf")])
4463 (define_expand "rotldi3"
4464 [(set (match_operand:DI 0 "gr_register_operand" "")
4465 (rotate:DI (match_operand:DI 1 "gr_register_operand" "")
4466 (match_operand:DI 2 "nonmemory_operand" "")))]
4469 if (! shift_count_operand (operands[2], DImode))
4473 (define_insn "*rotldi3_internal"
4474 [(set (match_operand:DI 0 "gr_register_operand" "=r")
4475 (rotate:DI (match_operand:DI 1 "gr_register_operand" "r")
4476 (match_operand:DI 2 "shift_count_operand" "M")))]
4478 "shrp %0 = %1, %1, %e2"
4479 [(set_attr "itanium_class" "ishf")])
4481 ;; ::::::::::::::::::::
4483 ;; :: 128-bit Integer Shifts and Rotates
4485 ;; ::::::::::::::::::::
4487 (define_expand "ashlti3"
4488 [(set (match_operand:TI 0 "gr_register_operand" "")
4489 (ashift:TI (match_operand:TI 1 "gr_register_operand" "")
4490 (match_operand:DI 2 "nonmemory_operand" "")))]
4493 if (!dshift_count_operand (operands[2], DImode))
4497 (define_insn_and_split "*ashlti3_internal"
4498 [(set (match_operand:TI 0 "gr_register_operand" "=&r")
4499 (ashift:TI (match_operand:TI 1 "gr_register_operand" "r")
4500 (match_operand:DI 2 "dshift_count_operand" "n")))]
4506 HOST_WIDE_INT shift = INTVAL (operands[2]);
4507 rtx rl = gen_lowpart (DImode, operands[0]);
4508 rtx rh = gen_highpart (DImode, operands[0]);
4509 rtx lo = gen_lowpart (DImode, operands[1]);
4510 rtx shiftlo = GEN_INT (shift & 63);
4514 emit_move_insn (rl, const0_rtx);
4516 emit_insn (gen_ashldi3 (rh, lo, shiftlo));
4518 emit_move_insn (rh, lo);
4522 rtx hi = gen_highpart (DImode, operands[1]);
4524 emit_insn (gen_shrp (rh, hi, lo, GEN_INT (-shift & 63)));
4525 emit_insn (gen_ashldi3 (rl, lo, shiftlo));
4530 (define_expand "ashrti3"
4531 [(set (match_operand:TI 0 "gr_register_operand" "")
4532 (ashiftrt:TI (match_operand:TI 1 "gr_register_operand" "")
4533 (match_operand:DI 2 "nonmemory_operand" "")))]
4536 if (!dshift_count_operand (operands[2], DImode))
4540 (define_insn_and_split "*ashrti3_internal"
4541 [(set (match_operand:TI 0 "gr_register_operand" "=&r")
4542 (ashiftrt:TI (match_operand:TI 1 "gr_register_operand" "r")
4543 (match_operand:DI 2 "dshift_count_operand" "n")))]
4549 HOST_WIDE_INT shift = INTVAL (operands[2]);
4550 rtx rl = gen_lowpart (DImode, operands[0]);
4551 rtx rh = gen_highpart (DImode, operands[0]);
4552 rtx hi = gen_highpart (DImode, operands[1]);
4553 rtx shiftlo = GEN_INT (shift & 63);
4558 emit_insn (gen_ashrdi3 (rl, hi, shiftlo));
4560 emit_move_insn (rl, hi);
4561 emit_insn (gen_ashrdi3 (rh, hi, GEN_INT (63)));
4565 rtx lo = gen_lowpart (DImode, operands[1]);
4567 emit_insn (gen_shrp (rl, hi, lo, shiftlo));
4568 emit_insn (gen_ashrdi3 (rh, hi, shiftlo));
4573 (define_expand "lshrti3"
4574 [(set (match_operand:TI 0 "gr_register_operand" "")
4575 (lshiftrt:TI (match_operand:TI 1 "gr_register_operand" "")
4576 (match_operand:DI 2 "nonmemory_operand" "")))]
4579 if (!dshift_count_operand (operands[2], DImode))
4583 (define_insn_and_split "*lshrti3_internal"
4584 [(set (match_operand:TI 0 "gr_register_operand" "=&r")
4585 (lshiftrt:TI (match_operand:TI 1 "gr_register_operand" "r")
4586 (match_operand:DI 2 "dshift_count_operand" "n")))]
4592 HOST_WIDE_INT shift = INTVAL (operands[2]);
4593 rtx rl = gen_lowpart (DImode, operands[0]);
4594 rtx rh = gen_highpart (DImode, operands[0]);
4595 rtx hi = gen_highpart (DImode, operands[1]);
4596 rtx shiftlo = GEN_INT (shift & 63);
4601 emit_insn (gen_lshrdi3 (rl, hi, shiftlo));
4603 emit_move_insn (rl, hi);
4604 emit_move_insn (rh, const0_rtx);
4608 rtx lo = gen_lowpart (DImode, operands[1]);
4610 emit_insn (gen_shrp (rl, hi, lo, shiftlo));
4611 emit_insn (gen_lshrdi3 (rh, hi, shiftlo));
4616 (define_expand "rotlti3"
4617 [(set (match_operand:TI 0 "gr_register_operand" "")
4618 (rotate:TI (match_operand:TI 1 "gr_register_operand" "")
4619 (match_operand:DI 2 "nonmemory_operand" "")))]
4622 if (! dshift_count_operand (operands[2], DImode))
4626 (define_insn_and_split "*rotlti3_internal"
4627 [(set (match_operand:TI 0 "gr_register_operand" "=&r")
4628 (rotate:TI (match_operand:TI 1 "gr_register_operand" "r")
4629 (match_operand:DI 2 "dshift_count_operand" "n")))]
4635 HOST_WIDE_INT count = INTVAL (operands[2]);
4636 rtx rl = gen_lowpart (DImode, operands[0]);
4637 rtx rh = gen_highpart (DImode, operands[0]);
4638 rtx lo = gen_lowpart (DImode, operands[1]);
4639 rtx hi = gen_highpart (DImode, operands[1]);
4640 rtx countlo = GEN_INT (-count & 63);
4646 emit_insn (gen_shrp (rl, hi, lo, countlo));
4647 emit_insn (gen_shrp (rh, lo, hi, countlo));
4651 emit_move_insn (rl, hi);
4652 emit_move_insn (rh, lo);
4657 emit_insn (gen_shrp (rl, lo, hi, countlo));
4658 emit_insn (gen_shrp (rh, hi, lo, countlo));
4662 [(set_attr "itanium_class" "unknown")])
4665 [(set (match_operand:DI 0 "gr_register_operand" "=r")
4666 (unspec:DI [(match_operand:DI 1 "gr_register_operand" "r")
4667 (match_operand:DI 2 "gr_register_operand" "r")
4668 (match_operand:DI 3 "shift_count_operand" "M")]
4671 "shrp %0 = %1, %2, %3"
4672 [(set_attr "itanium_class" "ishf")])
4674 ;; ::::::::::::::::::::
4676 ;; :: 32-bit Integer Logical operations
4678 ;; ::::::::::::::::::::
4680 ;; We don't seem to need any other 32-bit logical operations, because gcc
4681 ;; generates zero-extend;zero-extend;DImode-op, which combine optimizes to
4682 ;; DImode-op;zero-extend, and then we can optimize away the zero-extend.
4683 ;; This doesn't work for unary logical operations, because we don't call
4684 ;; apply_distributive_law for them.
4686 ;; ??? Likewise, this doesn't work for andnot, which isn't handled by
4687 ;; apply_distributive_law. We get inefficient code for
4688 ;; int sub4 (int i, int j) { return i & ~j; }
4689 ;; We could convert (and (not (sign_extend A)) (sign_extend B)) to
4690 ;; (zero_extend (and (not A) B)) in combine.
4691 ;; Or maybe fix this by adding andsi3/iorsi3/xorsi3 patterns like the
4692 ;; one_cmplsi2 pattern.
4694 (define_insn "one_cmplsi2"
4695 [(set (match_operand:SI 0 "gr_register_operand" "=r")
4696 (not:SI (match_operand:SI 1 "gr_register_operand" "r")))]
4699 [(set_attr "itanium_class" "ilog")])
4701 ;; ::::::::::::::::::::
4703 ;; :: 64-bit Integer Logical operations
4705 ;; ::::::::::::::::::::
4707 (define_insn "anddi3"
4708 [(set (match_operand:DI 0 "grfr_register_operand" "=r,*f")
4709 (and:DI (match_operand:DI 1 "grfr_register_operand" "%r,*f")
4710 (match_operand:DI 2 "grfr_reg_or_8bit_operand" "rK,*f")))]
4715 [(set_attr "itanium_class" "ilog,fmisc")])
4717 (define_insn "*andnot"
4718 [(set (match_operand:DI 0 "grfr_register_operand" "=r,*f")
4719 (and:DI (not:DI (match_operand:DI 1 "grfr_register_operand" "r,*f"))
4720 (match_operand:DI 2 "grfr_reg_or_8bit_operand" "rK,*f")))]
4725 [(set_attr "itanium_class" "ilog,fmisc")])
4727 (define_insn "iordi3"
4728 [(set (match_operand:DI 0 "grfr_register_operand" "=r,*f")
4729 (ior:DI (match_operand:DI 1 "grfr_register_operand" "%r,*f")
4730 (match_operand:DI 2 "grfr_reg_or_8bit_operand" "rK,*f")))]
4735 [(set_attr "itanium_class" "ilog,fmisc")])
4737 (define_insn "xordi3"
4738 [(set (match_operand:DI 0 "grfr_register_operand" "=r,*f")
4739 (xor:DI (match_operand:DI 1 "grfr_register_operand" "%r,*f")
4740 (match_operand:DI 2 "grfr_reg_or_8bit_operand" "rK,*f")))]
4745 [(set_attr "itanium_class" "ilog,fmisc")])
4747 (define_insn "one_cmpldi2"
4748 [(set (match_operand:DI 0 "gr_register_operand" "=r")
4749 (not:DI (match_operand:DI 1 "gr_register_operand" "r")))]
4752 [(set_attr "itanium_class" "ilog")])
4754 ;; ::::::::::::::::::::
4758 ;; ::::::::::::::::::::
4760 (define_expand "cmpbi"
4762 (compare (match_operand:BI 0 "register_operand" "")
4763 (match_operand:BI 1 "const_int_operand" "")))]
4766 ia64_compare_op0 = operands[0];
4767 ia64_compare_op1 = operands[1];
4771 (define_expand "cmpsi"
4773 (compare (match_operand:SI 0 "gr_register_operand" "")
4774 (match_operand:SI 1 "gr_reg_or_8bit_and_adjusted_operand" "")))]
4777 ia64_compare_op0 = operands[0];
4778 ia64_compare_op1 = operands[1];
4782 (define_expand "cmpdi"
4784 (compare (match_operand:DI 0 "gr_register_operand" "")
4785 (match_operand:DI 1 "gr_reg_or_8bit_and_adjusted_operand" "")))]
4788 ia64_compare_op0 = operands[0];
4789 ia64_compare_op1 = operands[1];
4793 (define_expand "cmpsf"
4795 (compare (match_operand:SF 0 "fr_reg_or_fp01_operand" "")
4796 (match_operand:SF 1 "fr_reg_or_fp01_operand" "")))]
4799 ia64_compare_op0 = operands[0];
4800 ia64_compare_op1 = operands[1];
4804 (define_expand "cmpdf"
4806 (compare (match_operand:DF 0 "fr_reg_or_fp01_operand" "")
4807 (match_operand:DF 1 "fr_reg_or_fp01_operand" "")))]
4810 ia64_compare_op0 = operands[0];
4811 ia64_compare_op1 = operands[1];
4815 (define_expand "cmpxf"
4817 (compare (match_operand:XF 0 "xfreg_or_fp01_operand" "")
4818 (match_operand:XF 1 "xfreg_or_fp01_operand" "")))]
4821 ia64_compare_op0 = operands[0];
4822 ia64_compare_op1 = operands[1];
4826 (define_expand "cmptf"
4828 (compare (match_operand:TF 0 "gr_register_operand" "")
4829 (match_operand:TF 1 "gr_register_operand" "")))]
4832 ia64_compare_op0 = operands[0];
4833 ia64_compare_op1 = operands[1];
4837 (define_insn "*cmpsi_normal"
4838 [(set (match_operand:BI 0 "register_operand" "=c")
4839 (match_operator:BI 1 "normal_comparison_operator"
4840 [(match_operand:SI 2 "gr_register_operand" "r")
4841 (match_operand:SI 3 "gr_reg_or_8bit_operand" "rK")]))]
4843 "cmp4.%C1 %0, %I0 = %3, %2"
4844 [(set_attr "itanium_class" "icmp")])
4846 ;; We use %r3 because it is possible for us to match a 0, and two of the
4847 ;; unsigned comparisons don't accept immediate operands of zero.
4849 (define_insn "*cmpsi_adjusted"
4850 [(set (match_operand:BI 0 "register_operand" "=c")
4851 (match_operator:BI 1 "adjusted_comparison_operator"
4852 [(match_operand:SI 2 "gr_register_operand" "r")
4853 (match_operand:SI 3 "gr_reg_or_8bit_adjusted_operand" "rL")]))]
4855 "cmp4.%C1 %0, %I0 = %r3, %2"
4856 [(set_attr "itanium_class" "icmp")])
4858 (define_insn "*cmpdi_normal"
4859 [(set (match_operand:BI 0 "register_operand" "=c")
4860 (match_operator:BI 1 "normal_comparison_operator"
4861 [(match_operand:DI 2 "gr_reg_or_0_operand" "rO")
4862 (match_operand:DI 3 "gr_reg_or_8bit_operand" "rK")]))]
4864 "cmp.%C1 %0, %I0 = %3, %r2"
4865 [(set_attr "itanium_class" "icmp")])
4867 ;; We use %r3 because it is possible for us to match a 0, and two of the
4868 ;; unsigned comparisons don't accept immediate operands of zero.
4870 (define_insn "*cmpdi_adjusted"
4871 [(set (match_operand:BI 0 "register_operand" "=c")
4872 (match_operator:BI 1 "adjusted_comparison_operator"
4873 [(match_operand:DI 2 "gr_register_operand" "r")
4874 (match_operand:DI 3 "gr_reg_or_8bit_adjusted_operand" "rL")]))]
4876 "cmp.%C1 %0, %I0 = %r3, %2"
4877 [(set_attr "itanium_class" "icmp")])
4879 (define_insn "*cmpsf_internal"
4880 [(set (match_operand:BI 0 "register_operand" "=c")
4881 (match_operator:BI 1 "comparison_operator"
4882 [(match_operand:SF 2 "fr_reg_or_fp01_operand" "fG")
4883 (match_operand:SF 3 "fr_reg_or_fp01_operand" "fG")]))]
4885 "fcmp.%D1 %0, %I0 = %F2, %F3"
4886 [(set_attr "itanium_class" "fcmp")])
4888 (define_insn "*cmpdf_internal"
4889 [(set (match_operand:BI 0 "register_operand" "=c")
4890 (match_operator:BI 1 "comparison_operator"
4891 [(match_operand:DF 2 "fr_reg_or_fp01_operand" "fG")
4892 (match_operand:DF 3 "fr_reg_or_fp01_operand" "fG")]))]
4894 "fcmp.%D1 %0, %I0 = %F2, %F3"
4895 [(set_attr "itanium_class" "fcmp")])
4897 (define_insn "*cmpxf_internal"
4898 [(set (match_operand:BI 0 "register_operand" "=c")
4899 (match_operator:BI 1 "comparison_operator"
4900 [(match_operand:XF 2 "xfreg_or_fp01_operand" "fG")
4901 (match_operand:XF 3 "xfreg_or_fp01_operand" "fG")]))]
4903 "fcmp.%D1 %0, %I0 = %F2, %F3"
4904 [(set_attr "itanium_class" "fcmp")])
4906 ;; ??? Can this pattern be generated?
4908 (define_insn "*bit_zero"
4909 [(set (match_operand:BI 0 "register_operand" "=c")
4910 (eq:BI (zero_extract:DI (match_operand:DI 1 "gr_register_operand" "r")
4912 (match_operand:DI 2 "shift_count_operand" "M"))
4915 "tbit.z %0, %I0 = %1, %2"
4916 [(set_attr "itanium_class" "tbit")])
4918 (define_insn "*bit_one"
4919 [(set (match_operand:BI 0 "register_operand" "=c")
4920 (ne:BI (zero_extract:DI (match_operand:DI 1 "gr_register_operand" "r")
4922 (match_operand:DI 2 "shift_count_operand" "M"))
4925 "tbit.nz %0, %I0 = %1, %2"
4926 [(set_attr "itanium_class" "tbit")])
4928 ;; ::::::::::::::::::::
4932 ;; ::::::::::::::::::::
4934 (define_expand "beq"
4936 (if_then_else (match_dup 1)
4937 (label_ref (match_operand 0 "" ""))
4940 "operands[1] = ia64_expand_compare (EQ, VOIDmode);")
4942 (define_expand "bne"
4944 (if_then_else (match_dup 1)
4945 (label_ref (match_operand 0 "" ""))
4948 "operands[1] = ia64_expand_compare (NE, VOIDmode);")
4950 (define_expand "blt"
4952 (if_then_else (match_dup 1)
4953 (label_ref (match_operand 0 "" ""))
4956 "operands[1] = ia64_expand_compare (LT, VOIDmode);")
4958 (define_expand "ble"
4960 (if_then_else (match_dup 1)
4961 (label_ref (match_operand 0 "" ""))
4964 "operands[1] = ia64_expand_compare (LE, VOIDmode);")
4966 (define_expand "bgt"
4968 (if_then_else (match_dup 1)
4969 (label_ref (match_operand 0 "" ""))
4972 "operands[1] = ia64_expand_compare (GT, VOIDmode);")
4974 (define_expand "bge"
4976 (if_then_else (match_dup 1)
4977 (label_ref (match_operand 0 "" ""))
4980 "operands[1] = ia64_expand_compare (GE, VOIDmode);")
4982 (define_expand "bltu"
4984 (if_then_else (match_dup 1)
4985 (label_ref (match_operand 0 "" ""))
4988 "operands[1] = ia64_expand_compare (LTU, VOIDmode);")
4990 (define_expand "bleu"
4992 (if_then_else (match_dup 1)
4993 (label_ref (match_operand 0 "" ""))
4996 "operands[1] = ia64_expand_compare (LEU, VOIDmode);")
4998 (define_expand "bgtu"
5000 (if_then_else (match_dup 1)
5001 (label_ref (match_operand 0 "" ""))
5004 "operands[1] = ia64_expand_compare (GTU, VOIDmode);")
5006 (define_expand "bgeu"
5008 (if_then_else (match_dup 1)
5009 (label_ref (match_operand 0 "" ""))
5012 "operands[1] = ia64_expand_compare (GEU, VOIDmode);")
5014 (define_expand "bunordered"
5016 (if_then_else (match_dup 1)
5017 (label_ref (match_operand 0 "" ""))
5020 "operands[1] = ia64_expand_compare (UNORDERED, VOIDmode);")
5022 (define_expand "bordered"
5024 (if_then_else (match_dup 1)
5025 (label_ref (match_operand 0 "" ""))
5028 "operands[1] = ia64_expand_compare (ORDERED, VOIDmode);")
5030 (define_insn "*br_true"
5032 (if_then_else (match_operator 0 "predicate_operator"
5033 [(match_operand:BI 1 "register_operand" "c")
5035 (label_ref (match_operand 2 "" ""))
5038 "(%J0) br.cond%+ %l2"
5039 [(set_attr "itanium_class" "br")
5040 (set_attr "predicable" "no")])
5042 (define_insn "*br_false"
5044 (if_then_else (match_operator 0 "predicate_operator"
5045 [(match_operand:BI 1 "register_operand" "c")
5048 (label_ref (match_operand 2 "" ""))))]
5050 "(%j0) br.cond%+ %l2"
5051 [(set_attr "itanium_class" "br")
5052 (set_attr "predicable" "no")])
5054 ;; ::::::::::::::::::::
5056 ;; :: Counted loop operations
5058 ;; ::::::::::::::::::::
5060 (define_expand "doloop_end"
5061 [(use (match_operand 0 "" "")) ; loop pseudo
5062 (use (match_operand 1 "" "")) ; iterations; zero if unknown
5063 (use (match_operand 2 "" "")) ; max iterations
5064 (use (match_operand 3 "" "")) ; loop level
5065 (use (match_operand 4 "" ""))] ; label
5068 /* Only use cloop on innermost loops. */
5069 if (INTVAL (operands[3]) > 1)
5071 emit_jump_insn (gen_doloop_end_internal (gen_rtx_REG (DImode, AR_LC_REGNUM),
5076 (define_insn "doloop_end_internal"
5077 [(set (pc) (if_then_else (ne (match_operand:DI 0 "ar_lc_reg_operand" "")
5079 (label_ref (match_operand 1 "" ""))
5081 (set (match_dup 0) (if_then_else:DI (ne (match_dup 0) (const_int 0))
5082 (plus:DI (match_dup 0) (const_int -1))
5085 "br.cloop.sptk.few %l1"
5086 [(set_attr "itanium_class" "br")
5087 (set_attr "predicable" "no")])
5089 ;; ::::::::::::::::::::
5091 ;; :: Set flag operations
5093 ;; ::::::::::::::::::::
5095 (define_expand "seq"
5096 [(set (match_operand:DI 0 "gr_register_operand" "") (match_dup 1))]
5098 "operands[1] = ia64_expand_compare (EQ, DImode);")
5100 (define_expand "sne"
5101 [(set (match_operand:DI 0 "gr_register_operand" "") (match_dup 1))]
5103 "operands[1] = ia64_expand_compare (NE, DImode);")
5105 (define_expand "slt"
5106 [(set (match_operand:DI 0 "gr_register_operand" "") (match_dup 1))]
5108 "operands[1] = ia64_expand_compare (LT, DImode);")
5110 (define_expand "sle"
5111 [(set (match_operand:DI 0 "gr_register_operand" "") (match_dup 1))]
5113 "operands[1] = ia64_expand_compare (LE, DImode);")
5115 (define_expand "sgt"
5116 [(set (match_operand:DI 0 "gr_register_operand" "") (match_dup 1))]
5118 "operands[1] = ia64_expand_compare (GT, DImode);")
5120 (define_expand "sge"
5121 [(set (match_operand:DI 0 "gr_register_operand" "") (match_dup 1))]
5123 "operands[1] = ia64_expand_compare (GE, DImode);")
5125 (define_expand "sltu"
5126 [(set (match_operand:DI 0 "gr_register_operand" "") (match_dup 1))]
5128 "operands[1] = ia64_expand_compare (LTU, DImode);")
5130 (define_expand "sleu"
5131 [(set (match_operand:DI 0 "gr_register_operand" "") (match_dup 1))]
5133 "operands[1] = ia64_expand_compare (LEU, DImode);")
5135 (define_expand "sgtu"
5136 [(set (match_operand:DI 0 "gr_register_operand" "") (match_dup 1))]
5138 "operands[1] = ia64_expand_compare (GTU, DImode);")
5140 (define_expand "sgeu"
5141 [(set (match_operand:DI 0 "gr_register_operand" "") (match_dup 1))]
5143 "operands[1] = ia64_expand_compare (GEU, DImode);")
5145 (define_expand "sunordered"
5146 [(set (match_operand:DI 0 "gr_register_operand" "") (match_dup 1))]
5148 "operands[1] = ia64_expand_compare (UNORDERED, DImode);")
5150 (define_expand "sordered"
5151 [(set (match_operand:DI 0 "gr_register_operand" "") (match_dup 1))]
5153 "operands[1] = ia64_expand_compare (ORDERED, DImode);")
5155 ;; Don't allow memory as destination here, because cmov/cmov/st is more
5156 ;; efficient than mov/mov/cst/cst.
5158 (define_insn_and_split "*sne_internal"
5159 [(set (match_operand:DI 0 "gr_register_operand" "=r")
5160 (ne:DI (match_operand:BI 1 "register_operand" "c")
5165 [(cond_exec (ne (match_dup 1) (const_int 0))
5166 (set (match_dup 0) (const_int 1)))
5167 (cond_exec (eq (match_dup 1) (const_int 0))
5168 (set (match_dup 0) (const_int 0)))]
5170 [(set_attr "itanium_class" "unknown")])
5172 (define_insn_and_split "*seq_internal"
5173 [(set (match_operand:DI 0 "gr_register_operand" "=r")
5174 (eq:DI (match_operand:BI 1 "register_operand" "c")
5179 [(cond_exec (ne (match_dup 1) (const_int 0))
5180 (set (match_dup 0) (const_int 0)))
5181 (cond_exec (eq (match_dup 1) (const_int 0))
5182 (set (match_dup 0) (const_int 1)))]
5184 [(set_attr "itanium_class" "unknown")])
5186 ;; ::::::::::::::::::::
5188 ;; :: Conditional move instructions.
5190 ;; ::::::::::::::::::::
5192 ;; ??? Add movXXcc patterns?
5195 ;; DImode if_then_else patterns.
5198 (define_insn "*cmovdi_internal"
5199 [(set (match_operand:DI 0 "destination_operand"
5200 "= r, r, r, r, r, r, r, r, r, r, m, Q, *f,*b,*d*e")
5202 (match_operator 4 "predicate_operator"
5203 [(match_operand:BI 1 "register_operand"
5204 "c,c,c,c,c,c,c,c,c,c,c,c,c,c,c")
5206 (match_operand:DI 2 "move_operand"
5207 "rim, *f, *b,*d*e,rim,rim, rim,*f,*b,*d*e,rO,*f,rOQ,rO, rK")
5208 (match_operand:DI 3 "move_operand"
5209 "rim,rim,rim, rim, *f, *b,*d*e,*f,*b,*d*e,rO,*f,rOQ,rO, rK")))]
5210 "ia64_move_ok (operands[0], operands[2])
5211 && ia64_move_ok (operands[0], operands[3])"
5212 { gcc_unreachable (); }
5213 [(set_attr "predicable" "no")])
5216 [(set (match_operand 0 "destination_operand" "")
5218 (match_operator 4 "predicate_operator"
5219 [(match_operand:BI 1 "register_operand" "")
5221 (match_operand 2 "move_operand" "")
5222 (match_operand 3 "move_operand" "")))]
5226 bool emitted_something = false;
5227 rtx dest = operands[0];
5228 rtx srct = operands[2];
5229 rtx srcf = operands[3];
5230 rtx cond = operands[4];
5232 if (! rtx_equal_p (dest, srct))
5234 ia64_emit_cond_move (dest, srct, cond);
5235 emitted_something = true;
5237 if (! rtx_equal_p (dest, srcf))
5239 cond = gen_rtx_fmt_ee (GET_CODE (cond) == NE ? EQ : NE,
5240 VOIDmode, operands[1], const0_rtx);
5241 ia64_emit_cond_move (dest, srcf, cond);
5242 emitted_something = true;
5244 if (! emitted_something)
5245 emit_note (NOTE_INSN_DELETED);
5249 ;; Absolute value pattern.
5251 (define_insn "*absdi2_internal"
5252 [(set (match_operand:DI 0 "gr_register_operand" "=r,r")
5254 (match_operator 4 "predicate_operator"
5255 [(match_operand:BI 1 "register_operand" "c,c")
5257 (neg:DI (match_operand:DI 2 "gr_reg_or_22bit_operand" "rI,rI"))
5258 (match_operand:DI 3 "gr_reg_or_22bit_operand" "0,rI")))]
5261 [(set_attr "itanium_class" "ialu,unknown")
5262 (set_attr "predicable" "no")])
5265 [(set (match_operand:DI 0 "register_operand" "")
5267 (match_operator 4 "predicate_operator"
5268 [(match_operand:BI 1 "register_operand" "c,c")
5270 (neg:DI (match_operand:DI 2 "gr_reg_or_22bit_operand" ""))
5271 (match_operand:DI 3 "gr_reg_or_22bit_operand" "")))]
5272 "reload_completed && rtx_equal_p (operands[0], operands[3])"
5276 (neg:DI (match_dup 2))))]
5280 [(set (match_operand:DI 0 "register_operand" "")
5282 (match_operator 4 "predicate_operator"
5283 [(match_operand:BI 1 "register_operand" "c,c")
5285 (neg:DI (match_operand:DI 2 "gr_reg_or_22bit_operand" ""))
5286 (match_operand:DI 3 "gr_reg_or_22bit_operand" "")))]
5290 (set (match_dup 0) (neg:DI (match_dup 2))))
5293 (set (match_dup 0) (match_dup 3)))]
5295 operands[5] = gen_rtx_fmt_ee (GET_CODE (operands[4]) == NE ? EQ : NE,
5296 VOIDmode, operands[1], const0_rtx);
5300 ;; SImode if_then_else patterns.
5303 (define_insn "*cmovsi_internal"
5304 [(set (match_operand:SI 0 "destination_operand" "=r,m,*f,r,m,*f,r,m,*f")
5306 (match_operator 4 "predicate_operator"
5307 [(match_operand:BI 1 "register_operand" "c,c,c,c,c,c,c,c,c")
5309 (match_operand:SI 2 "move_operand"
5310 "0,0,0,rim*f,rO,rO,rim*f,rO,rO")
5311 (match_operand:SI 3 "move_operand"
5312 "rim*f,rO,rO,0,0,0,rim*f,rO,rO")))]
5313 "ia64_move_ok (operands[0], operands[2])
5314 && ia64_move_ok (operands[0], operands[3])"
5315 { gcc_unreachable (); }
5316 [(set_attr "predicable" "no")])
5318 (define_insn "*abssi2_internal"
5319 [(set (match_operand:SI 0 "gr_register_operand" "=r,r")
5321 (match_operator 4 "predicate_operator"
5322 [(match_operand:BI 1 "register_operand" "c,c")
5324 (neg:SI (match_operand:SI 3 "gr_reg_or_22bit_operand" "rI,rI"))
5325 (match_operand:SI 2 "gr_reg_or_22bit_operand" "0,rI")))]
5328 [(set_attr "itanium_class" "ialu,unknown")
5329 (set_attr "predicable" "no")])
5332 [(set (match_operand:SI 0 "register_operand" "")
5334 (match_operator 4 "predicate_operator"
5335 [(match_operand:BI 1 "register_operand" "c,c")
5337 (neg:SI (match_operand:SI 2 "gr_reg_or_22bit_operand" ""))
5338 (match_operand:SI 3 "gr_reg_or_22bit_operand" "")))]
5339 "reload_completed && rtx_equal_p (operands[0], operands[3])"
5343 (neg:SI (match_dup 2))))]
5347 [(set (match_operand:SI 0 "register_operand" "")
5349 (match_operator 4 "predicate_operator"
5350 [(match_operand:BI 1 "register_operand" "c,c")
5352 (neg:SI (match_operand:SI 2 "gr_reg_or_22bit_operand" ""))
5353 (match_operand:SI 3 "gr_reg_or_22bit_operand" "")))]
5357 (set (match_dup 0) (neg:SI (match_dup 2))))
5360 (set (match_dup 0) (match_dup 3)))]
5362 operands[5] = gen_rtx_fmt_ee (GET_CODE (operands[4]) == NE ? EQ : NE,
5363 VOIDmode, operands[1], const0_rtx);
5366 (define_insn_and_split "*cond_opsi2_internal"
5367 [(set (match_operand:SI 0 "gr_register_operand" "=r")
5368 (match_operator:SI 5 "condop_operator"
5370 (match_operator 6 "predicate_operator"
5371 [(match_operand:BI 1 "register_operand" "c")
5373 (match_operand:SI 2 "gr_register_operand" "r")
5374 (match_operand:SI 3 "gr_register_operand" "r"))
5375 (match_operand:SI 4 "gr_register_operand" "r")]))]
5381 (set (match_dup 0) (match_op_dup:SI 5 [(match_dup 2) (match_dup 4)])))
5384 (set (match_dup 0) (match_op_dup:SI 5 [(match_dup 3) (match_dup 4)])))]
5386 operands[7] = gen_rtx_fmt_ee (GET_CODE (operands[6]) == NE ? EQ : NE,
5387 VOIDmode, operands[1], const0_rtx);
5389 [(set_attr "itanium_class" "ialu")
5390 (set_attr "predicable" "no")])
5393 (define_insn_and_split "*cond_opsi2_internal_b"
5394 [(set (match_operand:SI 0 "gr_register_operand" "=r")
5395 (match_operator:SI 5 "condop_operator"
5396 [(match_operand:SI 4 "gr_register_operand" "r")
5398 (match_operator 6 "predicate_operator"
5399 [(match_operand:BI 1 "register_operand" "c")
5401 (match_operand:SI 2 "gr_register_operand" "r")
5402 (match_operand:SI 3 "gr_register_operand" "r"))]))]
5408 (set (match_dup 0) (match_op_dup:SI 5 [(match_dup 4) (match_dup 2)])))
5411 (set (match_dup 0) (match_op_dup:SI 5 [(match_dup 4) (match_dup 3)])))]
5413 operands[7] = gen_rtx_fmt_ee (GET_CODE (operands[6]) == NE ? EQ : NE,
5414 VOIDmode, operands[1], const0_rtx);
5416 [(set_attr "itanium_class" "ialu")
5417 (set_attr "predicable" "no")])
5420 ;; ::::::::::::::::::::
5422 ;; :: Call and branch instructions
5424 ;; ::::::::::::::::::::
5426 ;; Subroutine call instruction returning no value. Operand 0 is the function
5427 ;; to call; operand 1 is the number of bytes of arguments pushed (in mode
5428 ;; `SImode', except it is normally a `const_int'); operand 2 is the number of
5429 ;; registers used as operands.
5431 ;; On most machines, operand 2 is not actually stored into the RTL pattern. It
5432 ;; is supplied for the sake of some RISC machines which need to put this
5433 ;; information into the assembler code; they can put it in the RTL instead of
5436 (define_expand "call"
5437 [(use (match_operand:DI 0 "" ""))
5438 (use (match_operand 1 "" ""))
5439 (use (match_operand 2 "" ""))
5440 (use (match_operand 3 "" ""))]
5443 ia64_expand_call (NULL_RTX, operands[0], operands[2], false);
5447 (define_expand "sibcall"
5448 [(use (match_operand:DI 0 "" ""))
5449 (use (match_operand 1 "" ""))
5450 (use (match_operand 2 "" ""))
5451 (use (match_operand 3 "" ""))]
5454 ia64_expand_call (NULL_RTX, operands[0], operands[2], true);
5458 ;; Subroutine call instruction returning a value. Operand 0 is the hard
5459 ;; register in which the value is returned. There are three more operands,
5460 ;; the same as the three operands of the `call' instruction (but with numbers
5461 ;; increased by one).
5463 ;; Subroutines that return `BLKmode' objects use the `call' insn.
5465 (define_expand "call_value"
5466 [(use (match_operand 0 "" ""))
5467 (use (match_operand:DI 1 "" ""))
5468 (use (match_operand 2 "" ""))
5469 (use (match_operand 3 "" ""))
5470 (use (match_operand 4 "" ""))]
5473 ia64_expand_call (operands[0], operands[1], operands[3], false);
5477 (define_expand "sibcall_value"
5478 [(use (match_operand 0 "" ""))
5479 (use (match_operand:DI 1 "" ""))
5480 (use (match_operand 2 "" ""))
5481 (use (match_operand 3 "" ""))
5482 (use (match_operand 4 "" ""))]
5485 ia64_expand_call (operands[0], operands[1], operands[3], true);
5489 ;; Call subroutine returning any type.
5491 (define_expand "untyped_call"
5492 [(parallel [(call (match_operand 0 "" "")
5494 (match_operand 1 "" "")
5495 (match_operand 2 "" "")])]
5500 emit_call_insn (gen_call (operands[0], const0_rtx, NULL, const0_rtx));
5502 for (i = 0; i < XVECLEN (operands[2], 0); i++)
5504 rtx set = XVECEXP (operands[2], 0, i);
5505 emit_move_insn (SET_DEST (set), SET_SRC (set));
5508 /* The optimizer does not know that the call sets the function value
5509 registers we stored in the result block. We avoid problems by
5510 claiming that all hard registers are used and clobbered at this
5512 emit_insn (gen_blockage ());
5517 (define_insn "call_nogp"
5518 [(call (mem:DI (match_operand:DI 0 "call_operand" "?b,i"))
5520 (clobber (match_operand:DI 1 "register_operand" "=b,b"))]
5522 "br.call%+.many %1 = %0"
5523 [(set_attr "itanium_class" "br,scall")])
5525 (define_insn "call_value_nogp"
5526 [(set (match_operand 0 "" "=X,X")
5527 (call (mem:DI (match_operand:DI 1 "call_operand" "?b,i"))
5529 (clobber (match_operand:DI 2 "register_operand" "=b,b"))]
5531 "br.call%+.many %2 = %1"
5532 [(set_attr "itanium_class" "br,scall")])
5534 (define_insn "sibcall_nogp"
5535 [(call (mem:DI (match_operand:DI 0 "call_operand" "?b,i"))
5539 [(set_attr "itanium_class" "br,scall")])
5541 (define_insn "call_gp"
5542 [(call (mem:DI (match_operand:DI 0 "call_operand" "?r,i"))
5544 (clobber (match_operand:DI 1 "register_operand" "=b,b"))
5545 (clobber (match_scratch:DI 2 "=&r,X"))
5546 (clobber (match_scratch:DI 3 "=b,X"))]
5549 [(set_attr "itanium_class" "br,scall")])
5551 ;; Irritatingly, we don't have access to INSN within the split body.
5552 ;; See commentary in ia64_split_call as to why these aren't peep2.
5554 [(call (mem (match_operand 0 "call_operand" ""))
5556 (clobber (match_operand:DI 1 "register_operand" ""))
5557 (clobber (match_scratch:DI 2 ""))
5558 (clobber (match_scratch:DI 3 ""))]
5559 "reload_completed && find_reg_note (insn, REG_NORETURN, NULL_RTX)"
5562 ia64_split_call (NULL_RTX, operands[0], operands[1], operands[2],
5563 operands[3], true, false);
5568 [(call (mem (match_operand 0 "call_operand" ""))
5570 (clobber (match_operand:DI 1 "register_operand" ""))
5571 (clobber (match_scratch:DI 2 ""))
5572 (clobber (match_scratch:DI 3 ""))]
5576 ia64_split_call (NULL_RTX, operands[0], operands[1], operands[2],
5577 operands[3], false, false);
5581 (define_insn "call_value_gp"
5582 [(set (match_operand 0 "" "=X,X")
5583 (call (mem:DI (match_operand:DI 1 "call_operand" "?r,i"))
5585 (clobber (match_operand:DI 2 "register_operand" "=b,b"))
5586 (clobber (match_scratch:DI 3 "=&r,X"))
5587 (clobber (match_scratch:DI 4 "=b,X"))]
5590 [(set_attr "itanium_class" "br,scall")])
5593 [(set (match_operand 0 "" "")
5594 (call (mem:DI (match_operand:DI 1 "call_operand" ""))
5596 (clobber (match_operand:DI 2 "register_operand" ""))
5597 (clobber (match_scratch:DI 3 ""))
5598 (clobber (match_scratch:DI 4 ""))]
5599 "reload_completed && find_reg_note (insn, REG_NORETURN, NULL_RTX)"
5602 ia64_split_call (operands[0], operands[1], operands[2], operands[3],
5603 operands[4], true, false);
5608 [(set (match_operand 0 "" "")
5609 (call (mem:DI (match_operand:DI 1 "call_operand" ""))
5611 (clobber (match_operand:DI 2 "register_operand" ""))
5612 (clobber (match_scratch:DI 3 ""))
5613 (clobber (match_scratch:DI 4 ""))]
5617 ia64_split_call (operands[0], operands[1], operands[2], operands[3],
5618 operands[4], false, false);
5622 (define_insn_and_split "sibcall_gp"
5623 [(call (mem:DI (match_operand:DI 0 "call_operand" "?r,i"))
5625 (clobber (match_scratch:DI 1 "=&r,X"))
5626 (clobber (match_scratch:DI 2 "=b,X"))]
5632 ia64_split_call (NULL_RTX, operands[0], NULL_RTX, operands[1],
5633 operands[2], true, true);
5636 [(set_attr "itanium_class" "br")])
5638 (define_insn "return_internal"
5640 (use (match_operand:DI 0 "register_operand" "b"))]
5642 "br.ret.sptk.many %0"
5643 [(set_attr "itanium_class" "br")])
5645 (define_insn "return"
5647 "ia64_direct_return ()"
5648 "br.ret.sptk.many rp"
5649 [(set_attr "itanium_class" "br")])
5651 (define_insn "*return_true"
5653 (if_then_else (match_operator 0 "predicate_operator"
5654 [(match_operand:BI 1 "register_operand" "c")
5658 "ia64_direct_return ()"
5659 "(%J0) br.ret%+.many rp"
5660 [(set_attr "itanium_class" "br")
5661 (set_attr "predicable" "no")])
5663 (define_insn "*return_false"
5665 (if_then_else (match_operator 0 "predicate_operator"
5666 [(match_operand:BI 1 "register_operand" "c")
5670 "ia64_direct_return ()"
5671 "(%j0) br.ret%+.many rp"
5672 [(set_attr "itanium_class" "br")
5673 (set_attr "predicable" "no")])
5676 [(set (pc) (label_ref (match_operand 0 "" "")))]
5679 [(set_attr "itanium_class" "br")])
5681 (define_insn "indirect_jump"
5682 [(set (pc) (match_operand:DI 0 "register_operand" "b"))]
5685 [(set_attr "itanium_class" "br")])
5687 (define_expand "tablejump"
5688 [(parallel [(set (pc) (match_operand:DI 0 "memory_operand" ""))
5689 (use (label_ref (match_operand 1 "" "")))])]
5692 rtx op0 = operands[0];
5695 /* ??? Bother -- do_tablejump is "helpful" and pulls the table
5696 element into a register without bothering to see whether that
5697 is necessary given the operand predicate. Check for MEM just
5698 in case someone fixes this. */
5699 if (GET_CODE (op0) == MEM)
5700 addr = XEXP (op0, 0);
5703 /* Otherwise, cheat and guess that the previous insn in the
5704 stream was the memory load. Grab the address from that.
5705 Note we have to momentarily pop out of the sequence started
5706 by the insn-emit wrapper in order to grab the last insn. */
5710 last = get_last_insn ();
5712 set = single_set (last);
5714 gcc_assert (rtx_equal_p (SET_DEST (set), op0)
5715 && GET_CODE (SET_SRC (set)) == MEM);
5716 addr = XEXP (SET_SRC (set), 0);
5717 gcc_assert (!rtx_equal_p (addr, op0));
5720 /* Jump table elements are stored pc-relative. That is, a displacement
5721 from the entry to the label. Thus to convert to an absolute address
5722 we add the address of the memory from which the value is loaded. */
5723 operands[0] = expand_simple_binop (DImode, PLUS, op0, addr,
5724 NULL_RTX, 1, OPTAB_DIRECT);
5727 (define_insn "*tablejump_internal"
5728 [(set (pc) (match_operand:DI 0 "register_operand" "b"))
5729 (use (label_ref (match_operand 1 "" "")))]
5732 [(set_attr "itanium_class" "br")])
5735 ;; ::::::::::::::::::::
5737 ;; :: Prologue and Epilogue instructions
5739 ;; ::::::::::::::::::::
5741 (define_expand "prologue"
5745 ia64_expand_prologue ();
5749 (define_expand "epilogue"
5753 ia64_expand_epilogue (0);
5757 (define_expand "sibcall_epilogue"
5761 ia64_expand_epilogue (1);
5765 ;; This prevents the scheduler from moving the SP decrement past FP-relative
5766 ;; stack accesses. This is the same as adddi3 plus the extra set.
5768 (define_insn "prologue_allocate_stack"
5769 [(set (match_operand:DI 0 "register_operand" "=r,r,r")
5770 (plus:DI (match_operand:DI 1 "register_operand" "%r,r,a")
5771 (match_operand:DI 2 "gr_reg_or_22bit_operand" "r,I,J")))
5772 (set (match_operand:DI 3 "register_operand" "+r,r,r")
5779 [(set_attr "itanium_class" "ialu")])
5781 ;; This prevents the scheduler from moving the SP restore past FP-relative
5782 ;; stack accesses. This is similar to movdi plus the extra set.
5784 (define_insn "epilogue_deallocate_stack"
5785 [(set (match_operand:DI 0 "register_operand" "=r")
5786 (match_operand:DI 1 "register_operand" "+r"))
5787 (set (match_dup 1) (match_dup 1))]
5790 [(set_attr "itanium_class" "ialu")])
5792 ;; As USE insns aren't meaningful after reload, this is used instead
5793 ;; to prevent deleting instructions setting registers for EH handling
5794 (define_insn "prologue_use"
5795 [(unspec:DI [(match_operand:DI 0 "register_operand" "")]
5796 UNSPEC_PROLOGUE_USE)]
5799 [(set_attr "itanium_class" "ignore")
5800 (set_attr "predicable" "no")
5801 (set_attr "empty" "yes")])
5803 ;; Allocate a new register frame.
5805 (define_insn "alloc"
5806 [(set (match_operand:DI 0 "register_operand" "=r")
5807 (unspec_volatile:DI [(const_int 0)] UNSPECV_ALLOC))
5808 (use (match_operand:DI 1 "const_int_operand" "i"))
5809 (use (match_operand:DI 2 "const_int_operand" "i"))
5810 (use (match_operand:DI 3 "const_int_operand" "i"))
5811 (use (match_operand:DI 4 "const_int_operand" "i"))]
5813 "alloc %0 = ar.pfs, %1, %2, %3, %4"
5814 [(set_attr "itanium_class" "syst_m0")
5815 (set_attr "predicable" "no")
5816 (set_attr "first_insn" "yes")])
5819 (define_expand "gr_spill"
5820 [(parallel [(set (match_operand:DI 0 "memory_operand" "=m")
5821 (unspec:DI [(match_operand:DI 1 "register_operand" "r")
5822 (match_operand:DI 2 "const_int_operand" "")]
5824 (clobber (match_dup 3))])]
5826 "operands[3] = gen_rtx_REG (DImode, AR_UNAT_REGNUM);")
5828 (define_insn "gr_spill_internal"
5829 [(set (match_operand:DI 0 "destination_operand" "=m")
5830 (unspec:DI [(match_operand:DI 1 "register_operand" "r")
5831 (match_operand:DI 2 "const_int_operand" "")]
5833 (clobber (match_operand:DI 3 "register_operand" ""))]
5836 /* Note that we use a C output pattern here to avoid the predicate
5837 being automatically added before the .mem.offset directive. */
5838 return ".mem.offset %2, 0\;%,st8.spill %0 = %1%P0";
5840 [(set_attr "itanium_class" "st")])
5843 (define_expand "gr_restore"
5844 [(parallel [(set (match_operand:DI 0 "register_operand" "=r")
5845 (unspec:DI [(match_operand:DI 1 "memory_operand" "m")
5846 (match_operand:DI 2 "const_int_operand" "")]
5848 (use (match_dup 3))])]
5850 "operands[3] = gen_rtx_REG (DImode, AR_UNAT_REGNUM);")
5852 (define_insn "gr_restore_internal"
5853 [(set (match_operand:DI 0 "register_operand" "=r")
5854 (unspec:DI [(match_operand:DI 1 "memory_operand" "m")
5855 (match_operand:DI 2 "const_int_operand" "")]
5857 (use (match_operand:DI 3 "register_operand" ""))]
5859 { return ".mem.offset %2, 0\;%,ld8.fill %0 = %1%P1"; }
5860 [(set_attr "itanium_class" "ld")])
5862 (define_insn "fr_spill"
5863 [(set (match_operand:XF 0 "destination_operand" "=m")
5864 (unspec:XF [(match_operand:XF 1 "register_operand" "f")]
5867 "stf.spill %0 = %1%P0"
5868 [(set_attr "itanium_class" "stf")])
5870 (define_insn "fr_restore"
5871 [(set (match_operand:XF 0 "register_operand" "=f")
5872 (unspec:XF [(match_operand:XF 1 "memory_operand" "m")]
5873 UNSPEC_FR_RESTORE))]
5875 "ldf.fill %0 = %1%P1"
5876 [(set_attr "itanium_class" "fld")])
5878 ;; ??? The explicit stop is not ideal. It would be better if
5879 ;; rtx_needs_barrier took care of this, but this is something that can be
5880 ;; fixed later. This avoids an RSE DV.
5882 (define_insn "bsp_value"
5883 [(set (match_operand:DI 0 "register_operand" "=r")
5884 (unspec:DI [(const_int 0)] UNSPEC_BSP_VALUE))]
5888 return \";;\;%,mov %0 = ar.bsp\";
5890 [(set_attr "itanium_class" "frar_i")])
5892 (define_insn "set_bsp"
5893 [(unspec_volatile [(match_operand:DI 0 "register_operand" "r")]
5911 [(set_attr "itanium_class" "unknown")
5912 (set_attr "predicable" "no")])
5914 ;; ??? The explicit stops are not ideal. It would be better if
5915 ;; rtx_needs_barrier took care of this, but this is something that can be
5916 ;; fixed later. This avoids an RSE DV.
5918 (define_insn "flushrs"
5919 [(unspec [(const_int 0)] UNSPEC_FLUSHRS)]
5922 [(set_attr "itanium_class" "rse_m")
5923 (set_attr "predicable" "no")])
5925 ;; ::::::::::::::::::::
5927 ;; :: Miscellaneous instructions
5929 ;; ::::::::::::::::::::
5931 ;; ??? Emitting a NOP instruction isn't very useful. This should probably
5932 ;; be emitting ";;" to force a break in the instruction packing.
5934 ;; No operation, needed in case the user uses -g but not -O.
5939 [(set_attr "itanium_class" "nop")])
5941 (define_insn "nop_m"
5945 [(set_attr "itanium_class" "nop_m")])
5947 (define_insn "nop_i"
5951 [(set_attr "itanium_class" "nop_i")])
5953 (define_insn "nop_f"
5957 [(set_attr "itanium_class" "nop_f")])
5959 (define_insn "nop_b"
5963 [(set_attr "itanium_class" "nop_b")])
5965 (define_insn "nop_x"
5969 [(set_attr "itanium_class" "nop_x")
5970 (set_attr "empty" "yes")])
5972 ;; The following insn will be never generated. It is used only by
5973 ;; insn scheduler to change state before advancing cycle.
5974 (define_insn "pre_cycle"
5978 [(set_attr "itanium_class" "pre_cycle")])
5980 (define_insn "bundle_selector"
5981 [(unspec [(match_operand 0 "const_int_operand" "")] UNSPEC_BUNDLE_SELECTOR)]
5983 { return get_bundle_name (INTVAL (operands[0])); }
5984 [(set_attr "itanium_class" "ignore")
5985 (set_attr "predicable" "no")])
5987 ;; Pseudo instruction that prevents the scheduler from moving code above this
5989 (define_insn "blockage"
5990 [(unspec_volatile [(const_int 0)] UNSPECV_BLOCKAGE)]
5993 [(set_attr "itanium_class" "ignore")
5994 (set_attr "predicable" "no")])
5996 (define_insn "insn_group_barrier"
5997 [(unspec_volatile [(match_operand 0 "const_int_operand" "")]
5998 UNSPECV_INSN_GROUP_BARRIER)]
6001 [(set_attr "itanium_class" "stop_bit")
6002 (set_attr "predicable" "no")
6003 (set_attr "empty" "yes")])
6005 (define_expand "trap"
6006 [(trap_if (const_int 1) (const_int 0))]
6010 ;; ??? We don't have a match-any slot type. Setting the type to unknown
6011 ;; produces worse code that setting the slot type to A.
6013 (define_insn "*trap"
6014 [(trap_if (const_int 1) (match_operand 0 "const_int_operand" ""))]
6017 [(set_attr "itanium_class" "chk_s_i")])
6019 (define_expand "conditional_trap"
6020 [(trap_if (match_operand 0 "" "") (match_operand 1 "" ""))]
6023 operands[0] = ia64_expand_compare (GET_CODE (operands[0]), VOIDmode);
6026 (define_insn "*conditional_trap"
6027 [(trap_if (match_operator 0 "predicate_operator"
6028 [(match_operand:BI 1 "register_operand" "c")
6030 (match_operand 2 "const_int_operand" ""))]
6033 [(set_attr "itanium_class" "chk_s_i")
6034 (set_attr "predicable" "no")])
6036 (define_insn "break_f"
6037 [(unspec_volatile [(const_int 0)] UNSPECV_BREAK)]
6040 [(set_attr "itanium_class" "nop_f")])
6042 (define_insn "prefetch"
6043 [(prefetch (match_operand:DI 0 "address_operand" "p")
6044 (match_operand:DI 1 "const_int_operand" "n")
6045 (match_operand:DI 2 "const_int_operand" "n"))]
6048 static const char * const alt[2][4] = {
6050 "%,lfetch.nta [%0]",
6051 "%,lfetch.nt1 [%0]",
6052 "%,lfetch.nt2 [%0]",
6056 "%,lfetch.excl.nta [%0]",
6057 "%,lfetch.excl.nt1 [%0]",
6058 "%,lfetch.excl.nt2 [%0]",
6059 "%,lfetch.excl [%0]"
6062 int i = (INTVAL (operands[1]));
6063 int j = (INTVAL (operands[2]));
6065 gcc_assert (i == 0 || i == 1);
6066 gcc_assert (j >= 0 && j <= 3);
6069 [(set_attr "itanium_class" "lfetch")])
6071 ;; Non-local goto support.
6073 (define_expand "save_stack_nonlocal"
6074 [(use (match_operand:OI 0 "memory_operand" ""))
6075 (use (match_operand:DI 1 "register_operand" ""))]
6078 emit_library_call (gen_rtx_SYMBOL_REF (Pmode,
6079 \"__ia64_save_stack_nonlocal\"),
6080 LCT_NORMAL, VOIDmode, 2, XEXP (operands[0], 0), Pmode,
6081 operands[1], Pmode);
6085 (define_expand "nonlocal_goto"
6086 [(use (match_operand 0 "general_operand" ""))
6087 (use (match_operand 1 "general_operand" ""))
6088 (use (match_operand 2 "general_operand" ""))
6089 (use (match_operand 3 "general_operand" ""))]
6092 emit_library_call (gen_rtx_SYMBOL_REF (Pmode, \"__ia64_nonlocal_goto\"),
6093 LCT_NORETURN, VOIDmode, 3,
6095 copy_to_reg (XEXP (operands[2], 0)), Pmode,
6096 operands[3], Pmode);
6101 (define_insn_and_split "nonlocal_goto_receiver"
6102 [(unspec_volatile [(const_int 0)] UNSPECV_GOTO_RECEIVER)]
6112 (define_insn_and_split "builtin_setjmp_receiver"
6113 [(unspec_volatile [(match_operand:DI 0 "" "")] UNSPECV_SETJMP_RECEIVER)]
6123 (define_expand "eh_epilogue"
6124 [(use (match_operand:DI 0 "register_operand" "r"))
6125 (use (match_operand:DI 1 "register_operand" "r"))
6126 (use (match_operand:DI 2 "register_operand" "r"))]
6129 rtx bsp = gen_rtx_REG (Pmode, 10);
6130 rtx sp = gen_rtx_REG (Pmode, 9);
6132 if (GET_CODE (operands[0]) != REG || REGNO (operands[0]) != 10)
6134 emit_move_insn (bsp, operands[0]);
6137 if (GET_CODE (operands[2]) != REG || REGNO (operands[2]) != 9)
6139 emit_move_insn (sp, operands[2]);
6145 cfun->machine->ia64_eh_epilogue_sp = sp;
6146 cfun->machine->ia64_eh_epilogue_bsp = bsp;
6149 ;; Builtin apply support.
6151 (define_expand "restore_stack_nonlocal"
6152 [(use (match_operand:DI 0 "register_operand" ""))
6153 (use (match_operand:OI 1 "memory_operand" ""))]
6156 emit_library_call (gen_rtx_SYMBOL_REF (Pmode,
6157 "__ia64_restore_stack_nonlocal"),
6158 LCT_NORMAL, VOIDmode, 1,
6159 copy_to_reg (XEXP (operands[1], 0)), Pmode);
6167 [(match_operator 0 "predicate_operator"
6168 [(match_operand:BI 1 "register_operand" "c")
6173 (define_insn "pred_rel_mutex"
6174 [(set (match_operand:BI 0 "register_operand" "+c")
6175 (unspec:BI [(match_dup 0)] UNSPEC_PRED_REL_MUTEX))]
6177 ".pred.rel.mutex %0, %I0"
6178 [(set_attr "itanium_class" "ignore")
6179 (set_attr "predicable" "no")])
6181 (define_insn "safe_across_calls_all"
6182 [(unspec_volatile [(const_int 0)] UNSPECV_PSAC_ALL)]
6184 ".pred.safe_across_calls p1-p63"
6185 [(set_attr "itanium_class" "ignore")
6186 (set_attr "predicable" "no")])
6188 (define_insn "safe_across_calls_normal"
6189 [(unspec_volatile [(const_int 0)] UNSPECV_PSAC_NORMAL)]
6192 emit_safe_across_calls ();
6195 [(set_attr "itanium_class" "ignore")
6196 (set_attr "predicable" "no")])
6198 ;; UNSPEC instruction definition to "swizzle" 32-bit pointer into 64-bit
6199 ;; pointer. This is used by the HP-UX 32 bit mode.
6201 (define_insn "ptr_extend"
6202 [(set (match_operand:DI 0 "gr_register_operand" "=r")
6203 (unspec:DI [(match_operand:SI 1 "gr_register_operand" "r")]
6207 [(set_attr "itanium_class" "ialu")])
6210 ;; Optimizations for ptr_extend
6212 (define_insn "ptr_extend_plus_imm"
6213 [(set (match_operand:DI 0 "gr_register_operand" "=r")
6215 [(plus:SI (match_operand:SI 1 "basereg_operand" "r")
6216 (match_operand:SI 2 "gr_reg_or_14bit_operand" "rI"))]
6218 "addp4_optimize_ok (operands[1], operands[2])"
6220 [(set_attr "itanium_class" "ialu")])
6222 (define_insn "*ptr_extend_plus_2"
6223 [(set (match_operand:DI 0 "gr_register_operand" "=r")
6225 [(plus:SI (match_operand:SI 1 "gr_register_operand" "r")
6226 (match_operand:SI 2 "basereg_operand" "r"))]
6228 "addp4_optimize_ok (operands[1], operands[2])"
6230 [(set_attr "itanium_class" "ialu")])
6233 ;; Get instruction pointer
6235 (define_insn "ip_value"
6236 [(set (match_operand:DI 0 "register_operand" "=r")
6240 [(set_attr "itanium_class" "frbr")])
6242 ;; Vector operations
6244 ;; Atomic operations
6246 ;; New division operations