1 ;; IA-64 Machine description template
2 ;; Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004
3 ;; 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 2, 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 COPYING. If not, write to
21 ;; the Free Software Foundation, 59 Temple Place - Suite 330,
22 ;; Boston, MA 02111-1307, USA.
24 ;;- See file "rtl.def" for documentation on define_insn, match_*, et. al.
26 ;; ??? register_operand accepts (subreg:DI (mem:SI X)) which forces later
27 ;; reload. This will be fixed once scheduling support is turned on.
29 ;; ??? Optimize for post-increment addressing modes.
31 ;; ??? fselect is not supported, because there is no integer register
34 ;; ??? fp abs/min/max instructions may also work for integer values.
36 ;; ??? Would a predicate_reg_operand predicate be useful? The HP one is buggy,
37 ;; it assumes the operand is a register and takes REGNO of it without checking.
39 ;; ??? Would a branch_reg_operand predicate be useful? The HP one is buggy,
40 ;; it assumes the operand is a register and takes REGNO of it without checking.
42 ;; ??? Go through list of documented named patterns and look for more to
45 ;; ??? Go through instruction manual and look for more instructions that
48 ;; ??? Add function unit scheduling info for Itanium (TM) processor.
50 ;; ??? Need a better way to describe alternate fp status registers.
54 (UNSPEC_LTOFF_DTPMOD 0)
55 (UNSPEC_LTOFF_DTPREL 1)
57 (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)
86 (UNSPECV_INSN_GROUP_BARRIER 2)
89 (UNSPECV_PSAC_ALL 5) ; pred.safe_across_calls
90 (UNSPECV_PSAC_NORMAL 6)
91 (UNSPECV_SETJMP_RECEIVER 7)
94 (include "predicates.md")
96 ;; ::::::::::::::::::::
100 ;; ::::::::::::::::::::
102 ;; Processor type. This attribute must exactly match the processor_type
103 ;; enumeration in ia64.h.
104 (define_attr "cpu" "itanium,itanium2" (const (symbol_ref "ia64_tune")))
106 ;; Instruction type. This primarily determines how instructions can be
107 ;; packed in bundles, and secondarily affects scheduling to function units.
109 ;; A alu, can go in I or M syllable of a bundle
114 ;; L long immediate, takes two syllables
117 ;; ??? Should not have any pattern with type unknown. Perhaps add code to
118 ;; check this in md_reorg? Currently use unknown for patterns which emit
119 ;; multiple instructions, patterns which emit 0 instructions, and patterns
120 ;; which emit instruction that can go in any slot (e.g. nop).
122 (define_attr "itanium_class" "unknown,ignore,stop_bit,br,fcmp,fcvtfx,fld,
123 fmac,fmisc,frar_i,frar_m,frbr,frfr,frpr,ialu,icmp,ilog,ishf,ld,
124 chk_s,long_i,mmalua,mmmul,mmshf,mmshfi,rse_m,scall,sem,stf,
125 st,syst_m0, syst_m,tbit,toar_i,toar_m,tobr,tofr,topr,xmpy,xtd,nop,
126 nop_b,nop_f,nop_i,nop_m,nop_x,lfetch,pre_cycle"
127 (const_string "unknown"))
129 ;; chk_s has an I and an M form; use type A for convenience.
130 (define_attr "type" "unknown,A,I,M,F,B,L,X,S"
131 (cond [(eq_attr "itanium_class" "ld,st,fld,stf,sem,nop_m") (const_string "M")
132 (eq_attr "itanium_class" "rse_m,syst_m,syst_m0") (const_string "M")
133 (eq_attr "itanium_class" "frar_m,toar_m,frfr,tofr") (const_string "M")
134 (eq_attr "itanium_class" "lfetch") (const_string "M")
135 (eq_attr "itanium_class" "chk_s,ialu,icmp,ilog,mmalua")
137 (eq_attr "itanium_class" "fmisc,fmac,fcmp,xmpy") (const_string "F")
138 (eq_attr "itanium_class" "fcvtfx,nop_f") (const_string "F")
139 (eq_attr "itanium_class" "frar_i,toar_i,frbr,tobr") (const_string "I")
140 (eq_attr "itanium_class" "frpr,topr,ishf,xtd,tbit") (const_string "I")
141 (eq_attr "itanium_class" "mmmul,mmshf,mmshfi,nop_i") (const_string "I")
142 (eq_attr "itanium_class" "br,scall,nop_b") (const_string "B")
143 (eq_attr "itanium_class" "stop_bit") (const_string "S")
144 (eq_attr "itanium_class" "nop_x") (const_string "X")
145 (eq_attr "itanium_class" "long_i") (const_string "L")]
146 (const_string "unknown")))
148 (define_attr "itanium_requires_unit0" "no,yes"
149 (cond [(eq_attr "itanium_class" "syst_m0,sem,frfr,rse_m") (const_string "yes")
150 (eq_attr "itanium_class" "toar_m,frar_m") (const_string "yes")
151 (eq_attr "itanium_class" "frbr,tobr,mmmul") (const_string "yes")
152 (eq_attr "itanium_class" "tbit,ishf,topr,frpr") (const_string "yes")
153 (eq_attr "itanium_class" "toar_i,frar_i") (const_string "yes")
154 (eq_attr "itanium_class" "fmisc,fcmp") (const_string "yes")]
155 (const_string "no")))
157 ;; Predication. True iff this instruction can be predicated.
159 (define_attr "predicable" "no,yes" (const_string "yes"))
161 ;; Empty. True iff this insn does not generate any code.
163 (define_attr "empty" "no,yes" (const_string "no"))
166 ;; DFA descriptions of ia64 processors used for insn scheduling and
169 (automata_option "ndfa")
171 ;; Uncomment the following line to output automata for debugging.
172 ;; (automata_option "v")
174 (automata_option "w")
176 (include "itanium1.md")
177 (include "itanium2.md")
180 ;; ::::::::::::::::::::
184 ;; ::::::::::::::::::::
186 ;; Set of a single predicate register. This is only used to implement
187 ;; pr-to-pr move and complement.
189 (define_insn "*movcci"
190 [(set (match_operand:CCI 0 "register_operand" "=c,c,c")
191 (match_operand:CCI 1 "nonmemory_operand" "O,n,c"))]
194 cmp.ne %0, p0 = r0, r0
195 cmp.eq %0, p0 = r0, r0
196 (%1) cmp.eq.unc %0, p0 = r0, r0"
197 [(set_attr "itanium_class" "icmp")
198 (set_attr "predicable" "no")])
201 [(set (match_operand:BI 0 "nonimmediate_operand" "=c,c,?c,?*r, c,*r,*r,*m,*r")
202 (match_operand:BI 1 "move_operand" " O,n, c, c,*r, n,*m,*r,*r"))]
205 cmp.ne %0, %I0 = r0, r0
206 cmp.eq %0, %I0 = r0, r0
209 tbit.nz %0, %I0 = %1, 0
214 [(set_attr "itanium_class" "icmp,icmp,unknown,unknown,tbit,ialu,ld,st,ialu")])
217 [(set (match_operand:BI 0 "register_operand" "")
218 (match_operand:BI 1 "register_operand" ""))]
220 && GET_CODE (operands[0]) == REG && GR_REGNO_P (REGNO (operands[0]))
221 && GET_CODE (operands[1]) == REG && PR_REGNO_P (REGNO (operands[1]))"
222 [(cond_exec (ne (match_dup 1) (const_int 0))
223 (set (match_dup 0) (const_int 1)))
224 (cond_exec (eq (match_dup 1) (const_int 0))
225 (set (match_dup 0) (const_int 0)))]
229 [(set (match_operand:BI 0 "register_operand" "")
230 (match_operand:BI 1 "register_operand" ""))]
232 && GET_CODE (operands[0]) == REG && PR_REGNO_P (REGNO (operands[0]))
233 && GET_CODE (operands[1]) == REG && PR_REGNO_P (REGNO (operands[1]))"
234 [(set (match_dup 2) (match_dup 4))
235 (set (match_dup 3) (match_dup 5))
236 (set (match_dup 0) (unspec:BI [(match_dup 0)] UNSPEC_PRED_REL_MUTEX))]
237 "operands[2] = gen_rtx_REG (CCImode, REGNO (operands[0]));
238 operands[3] = gen_rtx_REG (CCImode, REGNO (operands[0]) + 1);
239 operands[4] = gen_rtx_REG (CCImode, REGNO (operands[1]));
240 operands[5] = gen_rtx_REG (CCImode, REGNO (operands[1]) + 1);")
242 (define_expand "movqi"
243 [(set (match_operand:QI 0 "general_operand" "")
244 (match_operand:QI 1 "general_operand" ""))]
247 rtx op1 = ia64_expand_move (operands[0], operands[1]);
253 (define_insn "*movqi_internal"
254 [(set (match_operand:QI 0 "destination_operand" "=r,r,r, m, r,*f,*f")
255 (match_operand:QI 1 "move_operand" "rO,J,m,rO,*f,rO,*f"))]
256 "ia64_move_ok (operands[0], operands[1])"
265 [(set_attr "itanium_class" "ialu,ialu,ld,st,frfr,tofr,fmisc")])
267 (define_expand "movhi"
268 [(set (match_operand:HI 0 "general_operand" "")
269 (match_operand:HI 1 "general_operand" ""))]
272 rtx op1 = ia64_expand_move (operands[0], operands[1]);
278 (define_insn "*movhi_internal"
279 [(set (match_operand:HI 0 "destination_operand" "=r,r,r, m, r,*f,*f")
280 (match_operand:HI 1 "move_operand" "rO,J,m,rO,*f,rO,*f"))]
281 "ia64_move_ok (operands[0], operands[1])"
290 [(set_attr "itanium_class" "ialu,ialu,ld,st,frfr,tofr,fmisc")])
292 (define_expand "movsi"
293 [(set (match_operand:SI 0 "general_operand" "")
294 (match_operand:SI 1 "general_operand" ""))]
297 rtx op1 = ia64_expand_move (operands[0], operands[1]);
303 (define_insn "*movsi_internal"
304 [(set (match_operand:SI 0 "destination_operand" "=r,r,r,r, m, r,*f,*f, r,*d")
305 (match_operand:SI 1 "move_operand" "rO,J,i,m,rO,*f,rO,*f,*d,rK"))]
306 "ia64_move_ok (operands[0], operands[1])"
318 ;; frar_m, toar_m ??? why not frar_i and toar_i
319 [(set_attr "itanium_class" "ialu,ialu,long_i,ld,st,frfr,tofr,fmisc,frar_m,toar_m")])
321 (define_expand "movdi"
322 [(set (match_operand:DI 0 "general_operand" "")
323 (match_operand:DI 1 "general_operand" ""))]
326 rtx op1 = ia64_expand_move (operands[0], operands[1]);
332 (define_insn "*movdi_internal"
333 [(set (match_operand:DI 0 "destination_operand"
334 "=r,r,r,r, m, r,*f,*f,*f, Q, r,*b, r,*e, r,*d, r,*c")
335 (match_operand:DI 1 "move_operand"
336 "rO,JT,i,m,rO,*f,rO,*f, Q,*f,*b,rO,*e,rK,*d,rK,*c,rO"))]
337 "ia64_move_ok (operands[0], operands[1])"
339 static const char * const alt[] = {
341 "%,addl %0 = %1, r0",
343 "%,ld8%O1 %0 = %1%P1",
344 "%,st8%Q0 %0 = %r1%P0",
345 "%,getf.sig %0 = %1",
346 "%,setf.sig %0 = %r1",
360 if (which_alternative == 2 && ! TARGET_NO_PIC
361 && symbolic_operand (operands[1], VOIDmode))
364 return alt[which_alternative];
366 [(set_attr "itanium_class" "ialu,ialu,long_i,ld,st,frfr,tofr,fmisc,fld,stf,frbr,tobr,frar_i,toar_i,frar_m,toar_m,frpr,topr")])
369 [(set (match_operand 0 "register_operand" "")
370 (match_operand 1 "symbolic_operand" ""))]
371 "reload_completed && ! TARGET_NO_PIC"
374 ia64_expand_load_address (operands[0], operands[1]);
378 (define_expand "load_fptr"
380 (plus:DI (reg:DI 1) (match_operand 1 "function_operand" "")))
381 (set (match_operand:DI 0 "register_operand" "") (match_dup 3))]
384 operands[2] = no_new_pseudos ? operands[0] : gen_reg_rtx (DImode);
385 operands[3] = gen_const_mem (DImode, operands[2]);
388 (define_insn "*load_fptr_internal1"
389 [(set (match_operand:DI 0 "register_operand" "=r")
390 (plus:DI (reg:DI 1) (match_operand 1 "function_operand" "s")))]
392 "addl %0 = @ltoff(@fptr(%1)), gp"
393 [(set_attr "itanium_class" "ialu")])
395 (define_insn "load_gprel"
396 [(set (match_operand:DI 0 "register_operand" "=r")
397 (plus:DI (reg:DI 1) (match_operand 1 "sdata_symbolic_operand" "s")))]
399 "addl %0 = @gprel(%1), gp"
400 [(set_attr "itanium_class" "ialu")])
402 (define_insn "gprel64_offset"
403 [(set (match_operand:DI 0 "register_operand" "=r")
404 (minus:DI (match_operand:DI 1 "symbolic_operand" "") (reg:DI 1)))]
406 "movl %0 = @gprel(%1)"
407 [(set_attr "itanium_class" "long_i")])
409 (define_expand "load_gprel64"
411 (minus:DI (match_operand:DI 1 "symbolic_operand" "") (match_dup 3)))
412 (set (match_operand:DI 0 "register_operand" "")
413 (plus:DI (match_dup 3) (match_dup 2)))]
416 operands[2] = no_new_pseudos ? operands[0] : gen_reg_rtx (DImode);
417 operands[3] = pic_offset_table_rtx;
420 ;; This is used as a placeholder for the return address during early
421 ;; compilation. We won't know where we've placed this until during
422 ;; reload, at which point it can wind up in b0, a general register,
423 ;; or memory. The only safe destination under these conditions is a
426 (define_insn_and_split "*movdi_ret_addr"
427 [(set (match_operand:DI 0 "register_operand" "=r")
428 (unspec:DI [(const_int 0)] UNSPEC_RET_ADDR))]
434 ia64_split_return_addr_rtx (operands[0]);
437 [(set_attr "itanium_class" "ialu")])
439 (define_insn "*load_symptr_high"
440 [(set (match_operand:DI 0 "register_operand" "=r")
441 (plus:DI (high:DI (match_operand 1 "got_symbolic_operand" "s"))
442 (match_operand:DI 2 "register_operand" "a")))]
445 if (HAVE_AS_LTOFFX_LDXMOV_RELOCS)
446 return "%,addl %0 = @ltoffx(%1), %2";
448 return "%,addl %0 = @ltoff(%1), %2";
450 [(set_attr "itanium_class" "ialu")])
452 (define_insn "*load_symptr_low"
453 [(set (match_operand:DI 0 "register_operand" "=r")
454 (lo_sum:DI (match_operand:DI 1 "register_operand" "r")
455 (match_operand 2 "got_symbolic_operand" "s")))]
458 if (HAVE_AS_LTOFFX_LDXMOV_RELOCS)
459 return "%,ld8.mov %0 = [%1], %2";
461 return "%,ld8 %0 = [%1]";
463 [(set_attr "itanium_class" "ld")])
465 (define_insn "load_ltoff_dtpmod"
466 [(set (match_operand:DI 0 "register_operand" "=r")
468 (unspec:DI [(match_operand:DI 1 "symbolic_operand" "")]
469 UNSPEC_LTOFF_DTPMOD)))]
471 "addl %0 = @ltoff(@dtpmod(%1)), gp"
472 [(set_attr "itanium_class" "ialu")])
474 (define_insn "load_ltoff_dtprel"
475 [(set (match_operand:DI 0 "register_operand" "=r")
477 (unspec:DI [(match_operand:DI 1 "symbolic_operand" "")]
478 UNSPEC_LTOFF_DTPREL)))]
480 "addl %0 = @ltoff(@dtprel(%1)), gp"
481 [(set_attr "itanium_class" "ialu")])
483 (define_expand "load_dtprel"
484 [(set (match_operand:DI 0 "register_operand" "")
485 (unspec:DI [(match_operand:DI 1 "symbolic_operand" "")]
490 (define_insn "*load_dtprel64"
491 [(set (match_operand:DI 0 "register_operand" "=r")
492 (unspec:DI [(match_operand:DI 1 "symbolic_operand" "")]
495 "movl %0 = @dtprel(%1)"
496 [(set_attr "itanium_class" "long_i")])
498 (define_insn "*load_dtprel22"
499 [(set (match_operand:DI 0 "register_operand" "=r")
500 (unspec:DI [(match_operand:DI 1 "symbolic_operand" "")]
503 "addl %0 = @dtprel(%1), r0"
504 [(set_attr "itanium_class" "ialu")])
506 (define_expand "add_dtprel"
507 [(set (match_operand:DI 0 "register_operand" "")
508 (plus:DI (match_operand:DI 1 "register_operand" "")
509 (unspec:DI [(match_operand:DI 2 "symbolic_operand" "")]
514 (define_insn "*add_dtprel14"
515 [(set (match_operand:DI 0 "register_operand" "=r")
516 (plus:DI (match_operand:DI 1 "register_operand" "r")
517 (unspec:DI [(match_operand:DI 2 "symbolic_operand" "")]
520 "adds %0 = @dtprel(%2), %1"
521 [(set_attr "itanium_class" "ialu")])
523 (define_insn "*add_dtprel22"
524 [(set (match_operand:DI 0 "register_operand" "=r")
525 (plus:DI (match_operand:DI 1 "register_operand" "a")
526 (unspec:DI [(match_operand:DI 2 "symbolic_operand" "")]
529 "addl %0 = @dtprel(%2), %1"
530 [(set_attr "itanium_class" "ialu")])
532 (define_insn "load_ltoff_tprel"
533 [(set (match_operand:DI 0 "register_operand" "=r")
535 (unspec:DI [(match_operand:DI 1 "symbolic_operand" "")]
536 UNSPEC_LTOFF_TPREL)))]
538 "addl %0 = @ltoff(@tprel(%1)), gp"
539 [(set_attr "itanium_class" "ialu")])
541 (define_expand "load_tprel"
542 [(set (match_operand:DI 0 "register_operand" "")
543 (unspec:DI [(match_operand:DI 1 "symbolic_operand" "")]
548 (define_insn "*load_tprel64"
549 [(set (match_operand:DI 0 "register_operand" "=r")
550 (unspec:DI [(match_operand:DI 1 "symbolic_operand" "")]
553 "movl %0 = @tprel(%1)"
554 [(set_attr "itanium_class" "long_i")])
556 (define_insn "*load_tprel22"
557 [(set (match_operand:DI 0 "register_operand" "=r")
558 (unspec:DI [(match_operand:DI 1 "symbolic_operand" "")]
561 "addl %0 = @tprel(%1), r0"
562 [(set_attr "itanium_class" "ialu")])
564 (define_expand "add_tprel"
565 [(set (match_operand:DI 0 "register_operand" "")
566 (plus:DI (match_operand:DI 1 "register_operand" "")
567 (unspec:DI [(match_operand:DI 2 "symbolic_operand" "")]
572 (define_insn "*add_tprel14"
573 [(set (match_operand:DI 0 "register_operand" "=r")
574 (plus:DI (match_operand:DI 1 "register_operand" "r")
575 (unspec:DI [(match_operand:DI 2 "symbolic_operand" "")]
578 "adds %0 = @tprel(%2), %1"
579 [(set_attr "itanium_class" "ialu")])
581 (define_insn "*add_tprel22"
582 [(set (match_operand:DI 0 "register_operand" "=r")
583 (plus:DI (match_operand:DI 1 "register_operand" "a")
584 (unspec:DI [(match_operand:DI 2 "symbolic_operand" "")]
587 "addl %0 = @tprel(%2), %1"
588 [(set_attr "itanium_class" "ialu")])
590 ;; With no offsettable memory references, we've got to have a scratch
591 ;; around to play with the second word. However, in order to avoid a
592 ;; reload nightmare we lie, claim we don't need one, and fix it up
593 ;; in ia64_split_tmode_move.
594 (define_expand "movti"
595 [(set (match_operand:TI 0 "general_operand" "")
596 (match_operand:TI 1 "general_operand" ""))]
599 rtx op1 = ia64_expand_move (operands[0], operands[1]);
605 (define_insn_and_split "*movti_internal"
606 [(set (match_operand:TI 0 "nonimmediate_operand" "=r,r,m")
607 (match_operand:TI 1 "general_operand" "ri,m,r"))]
608 "ia64_move_ok (operands[0], operands[1])"
613 ia64_split_tmode_move (operands);
616 [(set_attr "itanium_class" "unknown")
617 (set_attr "predicable" "no")])
619 ;; Floating Point Moves
621 ;; Note - Patterns for SF mode moves are compulsory, but
622 ;; patterns for DF are optional, as GCC can synthesize them.
624 (define_expand "movsf"
625 [(set (match_operand:SF 0 "general_operand" "")
626 (match_operand:SF 1 "general_operand" ""))]
629 rtx op1 = ia64_expand_move (operands[0], operands[1]);
635 (define_insn "*movsf_internal"
636 [(set (match_operand:SF 0 "destination_operand" "=f,f, Q,*r, f,*r,*r, m")
637 (match_operand:SF 1 "general_operand" "fG,Q,fG,fG,*r,*r, m,*r"))]
638 "ia64_move_ok (operands[0], operands[1])"
648 [(set_attr "itanium_class" "fmisc,fld,stf,frfr,tofr,ialu,ld,st")])
650 (define_expand "movdf"
651 [(set (match_operand:DF 0 "general_operand" "")
652 (match_operand:DF 1 "general_operand" ""))]
655 rtx op1 = ia64_expand_move (operands[0], operands[1]);
661 (define_insn "*movdf_internal"
662 [(set (match_operand:DF 0 "destination_operand" "=f,f, Q,*r, f,*r,*r, m")
663 (match_operand:DF 1 "general_operand" "fG,Q,fG,fG,*r,*r, m,*r"))]
664 "ia64_move_ok (operands[0], operands[1])"
674 [(set_attr "itanium_class" "fmisc,fld,stf,frfr,tofr,ialu,ld,st")])
676 ;; With no offsettable memory references, we've got to have a scratch
677 ;; around to play with the second word if the variable winds up in GRs.
678 (define_expand "movxf"
679 [(set (match_operand:XF 0 "general_operand" "")
680 (match_operand:XF 1 "general_operand" ""))]
683 rtx op0 = operands[0];
685 if (GET_CODE (op0) == SUBREG)
686 op0 = SUBREG_REG (op0);
688 /* We must support XFmode loads into general registers for stdarg/vararg,
689 unprototyped calls, and a rare case where a long double is passed as
690 an argument after a float HFA fills the FP registers. We split them into
691 DImode loads for convenience. We also need to support XFmode stores
692 for the last case. This case does not happen for stdarg/vararg routines,
693 because we do a block store to memory of unnamed arguments. */
695 if (GET_CODE (op0) == REG && GR_REGNO_P (REGNO (op0)))
697 /* We're hoping to transform everything that deals with XFmode
698 quantities and GR registers early in the compiler. */
702 /* Struct to register can just use TImode instead. */
703 if ((GET_CODE (operands[1]) == SUBREG
704 && GET_MODE (SUBREG_REG (operands[1])) == TImode)
705 || (GET_CODE (operands[1]) == REG
706 && GR_REGNO_P (REGNO (operands[1]))))
708 rtx op1 = operands[1];
710 if (GET_CODE (op1) == SUBREG)
711 op1 = SUBREG_REG (op1);
713 op1 = gen_rtx_REG (TImode, REGNO (op1));
715 emit_move_insn (gen_rtx_REG (TImode, REGNO (op0)), op1);
719 if (GET_CODE (operands[1]) == CONST_DOUBLE)
721 emit_move_insn (gen_rtx_REG (DImode, REGNO (op0)),
722 operand_subword (operands[1], 0, 0, XFmode));
723 emit_move_insn (gen_rtx_REG (DImode, REGNO (op0) + 1),
724 operand_subword (operands[1], 1, 0, XFmode));
728 /* If the quantity is in a register not known to be GR, spill it. */
729 if (register_operand (operands[1], XFmode))
730 operands[1] = spill_xfmode_operand (operands[1], 1);
732 if (GET_CODE (operands[1]) == MEM)
736 out[WORDS_BIG_ENDIAN] = gen_rtx_REG (DImode, REGNO (op0));
737 out[!WORDS_BIG_ENDIAN] = gen_rtx_REG (DImode, REGNO (op0) + 1);
739 emit_move_insn (out[0], adjust_address (operands[1], DImode, 0));
740 emit_move_insn (out[1], adjust_address (operands[1], DImode, 8));
747 if (GET_CODE (operands[1]) == REG && GR_REGNO_P (REGNO (operands[1])))
749 /* We're hoping to transform everything that deals with XFmode
750 quantities and GR registers early in the compiler. */
754 /* Op0 can't be a GR_REG here, as that case is handled above.
755 If op0 is a register, then we spill op1, so that we now have a
756 MEM operand. This requires creating an XFmode subreg of a TImode reg
757 to force the spill. */
758 if (register_operand (operands[0], XFmode))
760 rtx op1 = gen_rtx_REG (TImode, REGNO (operands[1]));
761 op1 = gen_rtx_SUBREG (XFmode, op1, 0);
762 operands[1] = spill_xfmode_operand (op1, 0);
765 else if (GET_CODE (operands[0]) == MEM)
769 in[WORDS_BIG_ENDIAN] = gen_rtx_REG (DImode, REGNO (operands[1]));
770 in[!WORDS_BIG_ENDIAN] = gen_rtx_REG (DImode, REGNO (operands[1]) + 1);
772 emit_move_insn (adjust_address (operands[0], DImode, 0), in[0]);
773 emit_move_insn (adjust_address (operands[0], DImode, 8), in[1]);
781 if (! reload_in_progress && ! reload_completed)
783 operands[1] = spill_xfmode_operand (operands[1], 0);
785 if (GET_MODE (op0) == TImode && GET_CODE (op0) == REG)
787 rtx memt, memx, in = operands[1];
789 in = validize_mem (force_const_mem (XFmode, in));
790 if (GET_CODE (in) == MEM)
791 memt = adjust_address (in, TImode, 0);
794 memt = assign_stack_temp (TImode, 16, 0);
795 memx = adjust_address (memt, XFmode, 0);
796 emit_move_insn (memx, in);
798 emit_move_insn (op0, memt);
802 if (! ia64_move_ok (operands[0], operands[1]))
803 operands[1] = force_reg (XFmode, operands[1]);
807 ;; ??? There's no easy way to mind volatile acquire/release semantics.
809 (define_insn "*movxf_internal"
810 [(set (match_operand:XF 0 "destination_operand" "=f,f, m")
811 (match_operand:XF 1 "general_operand" "fG,m,fG"))]
812 "ia64_move_ok (operands[0], operands[1])"
817 [(set_attr "itanium_class" "fmisc,fld,stf")])
819 ;; Better code generation via insns that deal with TFmode register pairs
820 ;; directly. Same concerns apply as for TImode.
821 (define_expand "movtf"
822 [(set (match_operand:TF 0 "general_operand" "")
823 (match_operand:TF 1 "general_operand" ""))]
826 rtx op1 = ia64_expand_move (operands[0], operands[1]);
832 (define_insn_and_split "*movtf_internal"
833 [(set (match_operand:TF 0 "destination_operand" "=r,r,m")
834 (match_operand:TF 1 "general_operand" "ri,m,r"))]
835 "ia64_move_ok (operands[0], operands[1])"
840 ia64_split_tmode_move (operands);
843 [(set_attr "itanium_class" "unknown")
844 (set_attr "predicable" "no")])
847 ;; ::::::::::::::::::::
851 ;; ::::::::::::::::::::
853 ;; Signed conversions from a smaller integer to a larger integer
855 (define_insn "extendqidi2"
856 [(set (match_operand:DI 0 "gr_register_operand" "=r")
857 (sign_extend:DI (match_operand:QI 1 "gr_register_operand" "r")))]
860 [(set_attr "itanium_class" "xtd")])
862 (define_insn "extendhidi2"
863 [(set (match_operand:DI 0 "gr_register_operand" "=r")
864 (sign_extend:DI (match_operand:HI 1 "gr_register_operand" "r")))]
867 [(set_attr "itanium_class" "xtd")])
869 (define_insn "extendsidi2"
870 [(set (match_operand:DI 0 "grfr_register_operand" "=r,?f")
871 (sign_extend:DI (match_operand:SI 1 "grfr_register_operand" "r,f")))]
876 [(set_attr "itanium_class" "xtd,fmisc")])
878 ;; Unsigned conversions from a smaller integer to a larger integer
880 (define_insn "zero_extendqidi2"
881 [(set (match_operand:DI 0 "gr_register_operand" "=r,r")
882 (zero_extend:DI (match_operand:QI 1 "gr_nonimmediate_operand" "r,m")))]
887 [(set_attr "itanium_class" "xtd,ld")])
889 (define_insn "zero_extendhidi2"
890 [(set (match_operand:DI 0 "gr_register_operand" "=r,r")
891 (zero_extend:DI (match_operand:HI 1 "gr_nonimmediate_operand" "r,m")))]
896 [(set_attr "itanium_class" "xtd,ld")])
898 (define_insn "zero_extendsidi2"
899 [(set (match_operand:DI 0 "grfr_register_operand" "=r,r,?f")
901 (match_operand:SI 1 "grfr_nonimmediate_operand" "r,m,f")))]
907 [(set_attr "itanium_class" "ialu,ld,fmisc")])
909 ;; Convert between floating point types of different sizes.
911 ;; At first glance, it would appear that emitting fnorm for an extending
912 ;; conversion is unnecessary. However, the stf and getf instructions work
913 ;; correctly only if the input is properly rounded for its type. In
914 ;; particular, we get the wrong result for getf.d/stfd if the input is a
915 ;; denorm single. Since we don't know what the next instruction will be, we
916 ;; have to emit an fnorm.
918 ;; ??? Optimization opportunity here. Get rid of the insn altogether
919 ;; when we can. Should probably use a scheme like has been proposed
920 ;; for ia32 in dealing with operands that match unary operators. This
921 ;; would let combine merge the thing into adjacent insns. See also how the
922 ;; mips port handles SIGN_EXTEND as operands to integer arithmetic insns via
923 ;; se_register_operand.
925 (define_insn "extendsfdf2"
926 [(set (match_operand:DF 0 "fr_register_operand" "=f")
927 (float_extend:DF (match_operand:SF 1 "fr_register_operand" "f")))]
930 [(set_attr "itanium_class" "fmac")])
932 (define_insn "extendsfxf2"
933 [(set (match_operand:XF 0 "fr_register_operand" "=f")
934 (float_extend:XF (match_operand:SF 1 "fr_register_operand" "f")))]
937 [(set_attr "itanium_class" "fmac")])
939 (define_insn "extenddfxf2"
940 [(set (match_operand:XF 0 "fr_register_operand" "=f")
941 (float_extend:XF (match_operand:DF 1 "fr_register_operand" "f")))]
944 [(set_attr "itanium_class" "fmac")])
946 (define_insn "truncdfsf2"
947 [(set (match_operand:SF 0 "fr_register_operand" "=f")
948 (float_truncate:SF (match_operand:DF 1 "fr_register_operand" "f")))]
951 [(set_attr "itanium_class" "fmac")])
953 (define_insn "truncxfsf2"
954 [(set (match_operand:SF 0 "fr_register_operand" "=f")
955 (float_truncate:SF (match_operand:XF 1 "fr_register_operand" "f")))]
958 [(set_attr "itanium_class" "fmac")])
960 (define_insn "truncxfdf2"
961 [(set (match_operand:DF 0 "fr_register_operand" "=f")
962 (float_truncate:DF (match_operand:XF 1 "fr_register_operand" "f")))]
965 [(set_attr "itanium_class" "fmac")])
967 ;; Convert between signed integer types and floating point.
969 (define_insn "floatdixf2"
970 [(set (match_operand:XF 0 "fr_register_operand" "=f")
971 (float:XF (match_operand:DI 1 "fr_register_operand" "f")))]
974 [(set_attr "itanium_class" "fcvtfx")])
976 (define_insn "fix_truncsfdi2"
977 [(set (match_operand:DI 0 "fr_register_operand" "=f")
978 (fix:DI (match_operand:SF 1 "fr_register_operand" "f")))]
980 "fcvt.fx.trunc %0 = %1"
981 [(set_attr "itanium_class" "fcvtfx")])
983 (define_insn "fix_truncdfdi2"
984 [(set (match_operand:DI 0 "fr_register_operand" "=f")
985 (fix:DI (match_operand:DF 1 "fr_register_operand" "f")))]
987 "fcvt.fx.trunc %0 = %1"
988 [(set_attr "itanium_class" "fcvtfx")])
990 (define_insn "fix_truncxfdi2"
991 [(set (match_operand:DI 0 "fr_register_operand" "=f")
992 (fix:DI (match_operand:XF 1 "fr_register_operand" "f")))]
994 "fcvt.fx.trunc %0 = %1"
995 [(set_attr "itanium_class" "fcvtfx")])
997 (define_insn "fix_truncxfdi2_alts"
998 [(set (match_operand:DI 0 "fr_register_operand" "=f")
999 (fix:DI (match_operand:XF 1 "fr_register_operand" "f")))
1000 (use (match_operand:SI 2 "const_int_operand" ""))]
1002 "fcvt.fx.trunc.s%2 %0 = %1"
1003 [(set_attr "itanium_class" "fcvtfx")])
1005 ;; Convert between unsigned integer types and floating point.
1007 (define_insn "floatunsdisf2"
1008 [(set (match_operand:SF 0 "fr_register_operand" "=f")
1009 (unsigned_float:SF (match_operand:DI 1 "fr_register_operand" "f")))]
1011 "fcvt.xuf.s %0 = %1"
1012 [(set_attr "itanium_class" "fcvtfx")])
1014 (define_insn "floatunsdidf2"
1015 [(set (match_operand:DF 0 "fr_register_operand" "=f")
1016 (unsigned_float:DF (match_operand:DI 1 "fr_register_operand" "f")))]
1018 "fcvt.xuf.d %0 = %1"
1019 [(set_attr "itanium_class" "fcvtfx")])
1021 (define_insn "floatunsdixf2"
1022 [(set (match_operand:XF 0 "fr_register_operand" "=f")
1023 (unsigned_float:XF (match_operand:DI 1 "fr_register_operand" "f")))]
1026 [(set_attr "itanium_class" "fcvtfx")])
1028 (define_insn "fixuns_truncsfdi2"
1029 [(set (match_operand:DI 0 "fr_register_operand" "=f")
1030 (unsigned_fix:DI (match_operand:SF 1 "fr_register_operand" "f")))]
1032 "fcvt.fxu.trunc %0 = %1"
1033 [(set_attr "itanium_class" "fcvtfx")])
1035 (define_insn "fixuns_truncdfdi2"
1036 [(set (match_operand:DI 0 "fr_register_operand" "=f")
1037 (unsigned_fix:DI (match_operand:DF 1 "fr_register_operand" "f")))]
1039 "fcvt.fxu.trunc %0 = %1"
1040 [(set_attr "itanium_class" "fcvtfx")])
1042 (define_insn "fixuns_truncxfdi2"
1043 [(set (match_operand:DI 0 "fr_register_operand" "=f")
1044 (unsigned_fix:DI (match_operand:XF 1 "fr_register_operand" "f")))]
1046 "fcvt.fxu.trunc %0 = %1"
1047 [(set_attr "itanium_class" "fcvtfx")])
1049 (define_insn "fixuns_truncxfdi2_alts"
1050 [(set (match_operand:DI 0 "fr_register_operand" "=f")
1051 (unsigned_fix:DI (match_operand:XF 1 "fr_register_operand" "f")))
1052 (use (match_operand:SI 2 "const_int_operand" ""))]
1054 "fcvt.fxu.trunc.s%2 %0 = %1"
1055 [(set_attr "itanium_class" "fcvtfx")])
1057 ;; ::::::::::::::::::::
1059 ;; :: Bit field extraction
1061 ;; ::::::::::::::::::::
1064 [(set (match_operand:DI 0 "gr_register_operand" "=r")
1065 (sign_extract:DI (match_operand:DI 1 "gr_register_operand" "r")
1066 (match_operand:DI 2 "const_int_operand" "n")
1067 (match_operand:DI 3 "const_int_operand" "n")))]
1069 "extr %0 = %1, %3, %2"
1070 [(set_attr "itanium_class" "ishf")])
1072 (define_insn "extzv"
1073 [(set (match_operand:DI 0 "gr_register_operand" "=r")
1074 (zero_extract:DI (match_operand:DI 1 "gr_register_operand" "r")
1075 (match_operand:DI 2 "const_int_operand" "n")
1076 (match_operand:DI 3 "const_int_operand" "n")))]
1078 "extr.u %0 = %1, %3, %2"
1079 [(set_attr "itanium_class" "ishf")])
1081 ;; Insert a bit field.
1082 ;; Can have 3 operands, source1 (inserter), source2 (insertee), dest.
1083 ;; Source1 can be 0 or -1.
1084 ;; Source2 can be 0.
1086 ;; ??? Actual dep instruction is more powerful than what these insv
1087 ;; patterns support. Unfortunately, combine is unable to create patterns
1088 ;; where source2 != dest.
1090 (define_expand "insv"
1091 [(set (zero_extract:DI (match_operand:DI 0 "gr_register_operand" "")
1092 (match_operand:DI 1 "const_int_operand" "")
1093 (match_operand:DI 2 "const_int_operand" ""))
1094 (match_operand:DI 3 "nonmemory_operand" ""))]
1097 int width = INTVAL (operands[1]);
1098 int shift = INTVAL (operands[2]);
1100 /* If operand[3] is a constant, and isn't 0 or -1, then load it into a
1102 if (! register_operand (operands[3], DImode)
1103 && operands[3] != const0_rtx && operands[3] != constm1_rtx)
1104 operands[3] = force_reg (DImode, operands[3]);
1106 /* If this is a single dep instruction, we have nothing to do. */
1107 if (! ((register_operand (operands[3], DImode) && width <= 16)
1108 || operands[3] == const0_rtx || operands[3] == constm1_rtx))
1110 /* Check for cases that can be implemented with a mix instruction. */
1111 if (width == 32 && shift == 0)
1113 /* Directly generating the mix4left instruction confuses
1114 optimize_bit_field in function.c. Since this is performing
1115 a useful optimization, we defer generation of the complicated
1116 mix4left RTL to the first splitting phase. */
1117 rtx tmp = gen_reg_rtx (DImode);
1118 emit_insn (gen_shift_mix4left (operands[0], operands[3], tmp));
1121 else if (width == 32 && shift == 32)
1123 emit_insn (gen_mix4right (operands[0], operands[3]));
1127 /* We could handle remaining cases by emitting multiple dep
1130 If we need more than two dep instructions then we lose. A 6
1131 insn sequence mov mask1,mov mask2,shl;;and,and;;or is better than
1132 mov;;dep,shr;;dep,shr;;dep. The former can be executed in 3 cycles,
1133 the latter is 6 cycles on an Itanium (TM) processor, because there is
1134 only one function unit that can execute dep and shr immed.
1136 If we only need two dep instruction, then we still lose.
1137 mov;;dep,shr;;dep is still 4 cycles. Even if we optimize away
1138 the unnecessary mov, this is still undesirable because it will be
1139 hard to optimize, and it creates unnecessary pressure on the I0
1145 /* This code may be useful for other IA-64 processors, so we leave it in
1151 emit_insn (gen_insv (operands[0], GEN_INT (16), GEN_INT (shift),
1155 tmp = gen_reg_rtx (DImode);
1156 emit_insn (gen_lshrdi3 (tmp, operands[3], GEN_INT (16)));
1159 operands[1] = GEN_INT (width);
1160 operands[2] = GEN_INT (shift);
1165 (define_insn "*insv_internal"
1166 [(set (zero_extract:DI (match_operand:DI 0 "gr_register_operand" "+r")
1167 (match_operand:DI 1 "const_int_operand" "n")
1168 (match_operand:DI 2 "const_int_operand" "n"))
1169 (match_operand:DI 3 "nonmemory_operand" "rP"))]
1170 "(gr_register_operand (operands[3], DImode) && INTVAL (operands[1]) <= 16)
1171 || operands[3] == const0_rtx || operands[3] == constm1_rtx"
1172 "dep %0 = %3, %0, %2, %1"
1173 [(set_attr "itanium_class" "ishf")])
1175 ;; Combine doesn't like to create bit-field insertions into zero.
1176 (define_insn "*shladdp4_internal"
1177 [(set (match_operand:DI 0 "gr_register_operand" "=r")
1178 (and:DI (ashift:DI (match_operand:DI 1 "gr_register_operand" "r")
1179 (match_operand:DI 2 "shladd_log2_operand" "n"))
1180 (match_operand:DI 3 "const_int_operand" "n")))]
1181 "ia64_depz_field_mask (operands[3], operands[2]) + INTVAL (operands[2]) == 32"
1182 "shladdp4 %0 = %1, %2, r0"
1183 [(set_attr "itanium_class" "ialu")])
1185 (define_insn "*depz_internal"
1186 [(set (match_operand:DI 0 "gr_register_operand" "=r")
1187 (and:DI (ashift:DI (match_operand:DI 1 "gr_register_operand" "r")
1188 (match_operand:DI 2 "const_int_operand" "n"))
1189 (match_operand:DI 3 "const_int_operand" "n")))]
1190 "CONST_OK_FOR_M (INTVAL (operands[2]))
1191 && ia64_depz_field_mask (operands[3], operands[2]) > 0"
1193 operands[3] = GEN_INT (ia64_depz_field_mask (operands[3], operands[2]));
1194 return "%,dep.z %0 = %1, %2, %3";
1196 [(set_attr "itanium_class" "ishf")])
1198 (define_insn "shift_mix4left"
1199 [(set (zero_extract:DI (match_operand:DI 0 "gr_register_operand" "+r")
1200 (const_int 32) (const_int 0))
1201 (match_operand:DI 1 "gr_register_operand" "r"))
1202 (clobber (match_operand:DI 2 "gr_register_operand" "=r"))]
1205 [(set_attr "itanium_class" "unknown")])
1208 [(set (zero_extract:DI (match_operand:DI 0 "register_operand" "")
1209 (const_int 32) (const_int 0))
1210 (match_operand:DI 1 "register_operand" ""))
1211 (clobber (match_operand:DI 2 "register_operand" ""))]
1213 [(set (match_dup 3) (ashift:DI (match_dup 1) (const_int 32)))
1214 (set (zero_extract:DI (match_dup 0) (const_int 32) (const_int 0))
1215 (lshiftrt:DI (match_dup 3) (const_int 32)))]
1216 "operands[3] = operands[2];")
1218 (define_insn "*mix4left"
1219 [(set (zero_extract:DI (match_operand:DI 0 "gr_register_operand" "+r")
1220 (const_int 32) (const_int 0))
1221 (lshiftrt:DI (match_operand:DI 1 "gr_register_operand" "r")
1224 "mix4.l %0 = %0, %r1"
1225 [(set_attr "itanium_class" "mmshf")])
1227 (define_insn "mix4right"
1228 [(set (zero_extract:DI (match_operand:DI 0 "gr_register_operand" "+r")
1229 (const_int 32) (const_int 32))
1230 (match_operand:DI 1 "gr_reg_or_0_operand" "rO"))]
1232 "mix4.r %0 = %r1, %0"
1233 [(set_attr "itanium_class" "mmshf")])
1235 ;; This is used by the rotrsi3 pattern.
1237 (define_insn "*mix4right_3op"
1238 [(set (match_operand:DI 0 "gr_register_operand" "=r")
1239 (ior:DI (zero_extend:DI (match_operand:SI 1 "gr_register_operand" "r"))
1240 (ashift:DI (zero_extend:DI
1241 (match_operand:SI 2 "gr_register_operand" "r"))
1244 "mix4.r %0 = %2, %1"
1245 [(set_attr "itanium_class" "mmshf")])
1248 ;; ::::::::::::::::::::
1250 ;; :: 1 bit Integer arithmetic
1252 ;; ::::::::::::::::::::
1254 (define_insn_and_split "andbi3"
1255 [(set (match_operand:BI 0 "register_operand" "=c,c,r")
1256 (and:BI (match_operand:BI 1 "register_operand" "%0,0,r")
1257 (match_operand:BI 2 "register_operand" "c,r,r")))]
1261 tbit.nz.and.orcm %0, %I0 = %2, 0
1264 && GET_CODE (operands[0]) == REG && PR_REGNO_P (REGNO (operands[0]))
1265 && GET_CODE (operands[2]) == REG && PR_REGNO_P (REGNO (operands[2]))"
1266 [(cond_exec (eq (match_dup 2) (const_int 0))
1267 (set (match_dup 0) (and:BI (ne:BI (const_int 0) (const_int 0))
1270 [(set_attr "itanium_class" "unknown,tbit,ilog")])
1272 (define_insn_and_split "*andcmbi3"
1273 [(set (match_operand:BI 0 "register_operand" "=c,c,r")
1274 (and:BI (not:BI (match_operand:BI 1 "register_operand" "c,r,r"))
1275 (match_operand:BI 2 "register_operand" "0,0,r")))]
1279 tbit.z.and.orcm %0, %I0 = %1, 0
1282 && GET_CODE (operands[0]) == REG && PR_REGNO_P (REGNO (operands[0]))
1283 && GET_CODE (operands[1]) == REG && PR_REGNO_P (REGNO (operands[1]))"
1284 [(cond_exec (ne (match_dup 1) (const_int 0))
1285 (set (match_dup 0) (and:BI (ne:BI (const_int 0) (const_int 0))
1288 [(set_attr "itanium_class" "unknown,tbit,ilog")])
1290 (define_insn_and_split "iorbi3"
1291 [(set (match_operand:BI 0 "register_operand" "=c,c,r")
1292 (ior:BI (match_operand:BI 1 "register_operand" "%0,0,r")
1293 (match_operand:BI 2 "register_operand" "c,r,r")))]
1297 tbit.nz.or.andcm %0, %I0 = %2, 0
1300 && GET_CODE (operands[0]) == REG && PR_REGNO_P (REGNO (operands[0]))
1301 && GET_CODE (operands[2]) == REG && PR_REGNO_P (REGNO (operands[2]))"
1302 [(cond_exec (ne (match_dup 2) (const_int 0))
1303 (set (match_dup 0) (ior:BI (eq:BI (const_int 0) (const_int 0))
1306 [(set_attr "itanium_class" "unknown,tbit,ilog")])
1308 (define_insn_and_split "*iorcmbi3"
1309 [(set (match_operand:BI 0 "register_operand" "=c,c")
1310 (ior:BI (not:BI (match_operand:BI 1 "register_operand" "c,r"))
1311 (match_operand:BI 2 "register_operand" "0,0")))]
1315 tbit.z.or.andcm %0, %I0 = %1, 0"
1317 && GET_CODE (operands[0]) == REG && PR_REGNO_P (REGNO (operands[0]))
1318 && GET_CODE (operands[1]) == REG && PR_REGNO_P (REGNO (operands[1]))"
1319 [(cond_exec (eq (match_dup 1) (const_int 0))
1320 (set (match_dup 0) (ior:BI (eq:BI (const_int 0) (const_int 0))
1323 [(set_attr "itanium_class" "unknown,tbit")])
1325 (define_insn "one_cmplbi2"
1326 [(set (match_operand:BI 0 "register_operand" "=c,r,c,&c")
1327 (not:BI (match_operand:BI 1 "register_operand" "r,r,0,c")))
1328 (clobber (match_scratch:BI 2 "=X,X,c,X"))]
1331 tbit.z %0, %I0 = %1, 0
1335 [(set_attr "itanium_class" "tbit,ilog,unknown,unknown")])
1338 [(set (match_operand:BI 0 "register_operand" "")
1339 (not:BI (match_operand:BI 1 "register_operand" "")))
1340 (clobber (match_scratch:BI 2 ""))]
1342 && GET_CODE (operands[0]) == REG && PR_REGNO_P (REGNO (operands[0]))
1343 && rtx_equal_p (operands[0], operands[1])"
1344 [(set (match_dup 4) (match_dup 3))
1345 (set (match_dup 0) (const_int 1))
1346 (cond_exec (ne (match_dup 2) (const_int 0))
1347 (set (match_dup 0) (const_int 0)))
1348 (set (match_dup 0) (unspec:BI [(match_dup 0)] UNSPEC_PRED_REL_MUTEX))]
1349 "operands[3] = gen_rtx_REG (CCImode, REGNO (operands[1]));
1350 operands[4] = gen_rtx_REG (CCImode, REGNO (operands[2]));")
1353 [(set (match_operand:BI 0 "register_operand" "")
1354 (not:BI (match_operand:BI 1 "register_operand" "")))
1355 (clobber (match_scratch:BI 2 ""))]
1357 && GET_CODE (operands[0]) == REG && PR_REGNO_P (REGNO (operands[0]))
1358 && GET_CODE (operands[1]) == REG && PR_REGNO_P (REGNO (operands[1]))
1359 && ! rtx_equal_p (operands[0], operands[1])"
1360 [(cond_exec (ne (match_dup 1) (const_int 0))
1361 (set (match_dup 0) (const_int 0)))
1362 (cond_exec (eq (match_dup 1) (const_int 0))
1363 (set (match_dup 0) (const_int 1)))
1364 (set (match_dup 0) (unspec:BI [(match_dup 0)] UNSPEC_PRED_REL_MUTEX))]
1367 (define_insn "*cmpsi_and_0"
1368 [(set (match_operand:BI 0 "register_operand" "=c")
1369 (and:BI (match_operator:BI 4 "predicate_operator"
1370 [(match_operand:SI 2 "gr_reg_or_0_operand" "rO")
1371 (match_operand:SI 3 "gr_reg_or_8bit_operand" "rK")])
1372 (match_operand:BI 1 "register_operand" "0")))]
1374 "cmp4.%C4.and.orcm %0, %I0 = %3, %r2"
1375 [(set_attr "itanium_class" "icmp")])
1377 (define_insn "*cmpsi_and_1"
1378 [(set (match_operand:BI 0 "register_operand" "=c")
1379 (and:BI (match_operator:BI 3 "signed_inequality_operator"
1380 [(match_operand:SI 2 "gr_register_operand" "r")
1382 (match_operand:BI 1 "register_operand" "0")))]
1384 "cmp4.%C3.and.orcm %0, %I0 = r0, %2"
1385 [(set_attr "itanium_class" "icmp")])
1387 (define_insn "*cmpsi_andnot_0"
1388 [(set (match_operand:BI 0 "register_operand" "=c")
1389 (and:BI (not:BI (match_operator:BI 4 "predicate_operator"
1390 [(match_operand:SI 2 "gr_reg_or_0_operand" "rO")
1391 (match_operand:SI 3 "gr_reg_or_8bit_operand" "rK")]))
1392 (match_operand:BI 1 "register_operand" "0")))]
1394 "cmp4.%C4.or.andcm %I0, %0 = %3, %r2"
1395 [(set_attr "itanium_class" "icmp")])
1397 (define_insn "*cmpsi_andnot_1"
1398 [(set (match_operand:BI 0 "register_operand" "=c")
1399 (and:BI (not:BI (match_operator:BI 3 "signed_inequality_operator"
1400 [(match_operand:SI 2 "gr_register_operand" "r")
1402 (match_operand:BI 1 "register_operand" "0")))]
1404 "cmp4.%C3.or.andcm %I0, %0 = r0, %2"
1405 [(set_attr "itanium_class" "icmp")])
1407 (define_insn "*cmpdi_and_0"
1408 [(set (match_operand:BI 0 "register_operand" "=c")
1409 (and:BI (match_operator:BI 4 "predicate_operator"
1410 [(match_operand:DI 2 "gr_register_operand" "r")
1411 (match_operand:DI 3 "gr_reg_or_8bit_operand" "rK")])
1412 (match_operand:BI 1 "register_operand" "0")))]
1414 "cmp.%C4.and.orcm %0, %I0 = %3, %2"
1415 [(set_attr "itanium_class" "icmp")])
1417 (define_insn "*cmpdi_and_1"
1418 [(set (match_operand:BI 0 "register_operand" "=c")
1419 (and:BI (match_operator:BI 3 "signed_inequality_operator"
1420 [(match_operand:DI 2 "gr_register_operand" "r")
1422 (match_operand:BI 1 "register_operand" "0")))]
1424 "cmp.%C3.and.orcm %0, %I0 = r0, %2"
1425 [(set_attr "itanium_class" "icmp")])
1427 (define_insn "*cmpdi_andnot_0"
1428 [(set (match_operand:BI 0 "register_operand" "=c")
1429 (and:BI (not:BI (match_operator:BI 4 "predicate_operator"
1430 [(match_operand:DI 2 "gr_register_operand" "r")
1431 (match_operand:DI 3 "gr_reg_or_8bit_operand" "rK")]))
1432 (match_operand:BI 1 "register_operand" "0")))]
1434 "cmp.%C4.or.andcm %I0, %0 = %3, %2"
1435 [(set_attr "itanium_class" "icmp")])
1437 (define_insn "*cmpdi_andnot_1"
1438 [(set (match_operand:BI 0 "register_operand" "=c")
1439 (and:BI (not:BI (match_operator:BI 3 "signed_inequality_operator"
1440 [(match_operand:DI 2 "gr_register_operand" "r")
1442 (match_operand:BI 1 "register_operand" "0")))]
1444 "cmp.%C3.or.andcm %I0, %0 = r0, %2"
1445 [(set_attr "itanium_class" "icmp")])
1447 (define_insn "*tbit_and_0"
1448 [(set (match_operand:BI 0 "register_operand" "=c")
1449 (and:BI (ne:BI (and:DI (match_operand:DI 1 "gr_register_operand" "r")
1452 (match_operand:BI 2 "register_operand" "0")))]
1454 "tbit.nz.and.orcm %0, %I0 = %1, 0"
1455 [(set_attr "itanium_class" "tbit")])
1457 (define_insn "*tbit_and_1"
1458 [(set (match_operand:BI 0 "register_operand" "=c")
1459 (and:BI (eq:BI (and:DI (match_operand:DI 1 "gr_register_operand" "r")
1462 (match_operand:BI 2 "register_operand" "0")))]
1464 "tbit.z.and.orcm %0, %I0 = %1, 0"
1465 [(set_attr "itanium_class" "tbit")])
1467 (define_insn "*tbit_and_2"
1468 [(set (match_operand:BI 0 "register_operand" "=c")
1469 (and:BI (ne:BI (zero_extract:DI
1470 (match_operand:DI 1 "gr_register_operand" "r")
1472 (match_operand:DI 2 "const_int_operand" "n"))
1474 (match_operand:BI 3 "register_operand" "0")))]
1476 "tbit.nz.and.orcm %0, %I0 = %1, %2"
1477 [(set_attr "itanium_class" "tbit")])
1479 (define_insn "*tbit_and_3"
1480 [(set (match_operand:BI 0 "register_operand" "=c")
1481 (and:BI (eq:BI (zero_extract:DI
1482 (match_operand:DI 1 "gr_register_operand" "r")
1484 (match_operand:DI 2 "const_int_operand" "n"))
1486 (match_operand:BI 3 "register_operand" "0")))]
1488 "tbit.z.and.orcm %0, %I0 = %1, %2"
1489 [(set_attr "itanium_class" "tbit")])
1491 (define_insn "*cmpsi_or_0"
1492 [(set (match_operand:BI 0 "register_operand" "=c")
1493 (ior:BI (match_operator:BI 4 "predicate_operator"
1494 [(match_operand:SI 2 "gr_reg_or_0_operand" "rO")
1495 (match_operand:SI 3 "gr_reg_or_8bit_operand" "rK")])
1496 (match_operand:BI 1 "register_operand" "0")))]
1498 "cmp4.%C4.or.andcm %0, %I0 = %3, %r2"
1499 [(set_attr "itanium_class" "icmp")])
1501 (define_insn "*cmpsi_or_1"
1502 [(set (match_operand:BI 0 "register_operand" "=c")
1503 (ior:BI (match_operator:BI 3 "signed_inequality_operator"
1504 [(match_operand:SI 2 "gr_register_operand" "r")
1506 (match_operand:BI 1 "register_operand" "0")))]
1508 "cmp4.%C3.or.andcm %0, %I0 = r0, %2"
1509 [(set_attr "itanium_class" "icmp")])
1511 (define_insn "*cmpsi_orcm_0"
1512 [(set (match_operand:BI 0 "register_operand" "=c")
1513 (ior:BI (not:BI (match_operator:BI 4 "predicate_operator"
1514 [(match_operand:SI 2 "gr_reg_or_0_operand" "rO")
1515 (match_operand:SI 3 "gr_reg_or_8bit_operand" "rK")]))
1516 (match_operand:BI 1 "register_operand" "0")))]
1518 "cmp4.%C4.and.orcm %I0, %0 = %3, %r2"
1519 [(set_attr "itanium_class" "icmp")])
1521 (define_insn "*cmpsi_orcm_1"
1522 [(set (match_operand:BI 0 "register_operand" "=c")
1523 (ior:BI (not:BI (match_operator:BI 3 "signed_inequality_operator"
1524 [(match_operand:SI 2 "gr_register_operand" "r")
1526 (match_operand:BI 1 "register_operand" "0")))]
1528 "cmp4.%C3.and.orcm %I0, %0 = r0, %2"
1529 [(set_attr "itanium_class" "icmp")])
1531 (define_insn "*cmpdi_or_0"
1532 [(set (match_operand:BI 0 "register_operand" "=c")
1533 (ior:BI (match_operator:BI 4 "predicate_operator"
1534 [(match_operand:DI 2 "gr_register_operand" "r")
1535 (match_operand:DI 3 "gr_reg_or_8bit_operand" "rK")])
1536 (match_operand:BI 1 "register_operand" "0")))]
1538 "cmp.%C4.or.andcm %0, %I0 = %3, %2"
1539 [(set_attr "itanium_class" "icmp")])
1541 (define_insn "*cmpdi_or_1"
1542 [(set (match_operand:BI 0 "register_operand" "=c")
1543 (ior:BI (match_operator:BI 3 "signed_inequality_operator"
1544 [(match_operand:DI 2 "gr_register_operand" "r")
1546 (match_operand:BI 1 "register_operand" "0")))]
1548 "cmp.%C3.or.andcm %0, %I0 = r0, %2"
1549 [(set_attr "itanium_class" "icmp")])
1551 (define_insn "*cmpdi_orcm_0"
1552 [(set (match_operand:BI 0 "register_operand" "=c")
1553 (ior:BI (not:BI (match_operator:BI 4 "predicate_operator"
1554 [(match_operand:DI 2 "gr_register_operand" "r")
1555 (match_operand:DI 3 "gr_reg_or_8bit_operand" "rK")]))
1556 (match_operand:BI 1 "register_operand" "0")))]
1558 "cmp.%C4.and.orcm %I0, %0 = %3, %2"
1559 [(set_attr "itanium_class" "icmp")])
1561 (define_insn "*cmpdi_orcm_1"
1562 [(set (match_operand:BI 0 "register_operand" "=c")
1563 (ior:BI (not:BI (match_operator:BI 3 "signed_inequality_operator"
1564 [(match_operand:DI 2 "gr_register_operand" "r")
1566 (match_operand:BI 1 "register_operand" "0")))]
1568 "cmp.%C3.and.orcm %I0, %0 = r0, %2"
1569 [(set_attr "itanium_class" "icmp")])
1571 (define_insn "*tbit_or_0"
1572 [(set (match_operand:BI 0 "register_operand" "=c")
1573 (ior:BI (ne:BI (and:DI (match_operand:DI 1 "gr_register_operand" "r")
1576 (match_operand:BI 2 "register_operand" "0")))]
1578 "tbit.nz.or.andcm %0, %I0 = %1, 0"
1579 [(set_attr "itanium_class" "tbit")])
1581 (define_insn "*tbit_or_1"
1582 [(set (match_operand:BI 0 "register_operand" "=c")
1583 (ior:BI (eq:BI (and:DI (match_operand:DI 1 "gr_register_operand" "r")
1586 (match_operand:BI 2 "register_operand" "0")))]
1588 "tbit.z.or.andcm %0, %I0 = %1, 0"
1589 [(set_attr "itanium_class" "tbit")])
1591 (define_insn "*tbit_or_2"
1592 [(set (match_operand:BI 0 "register_operand" "=c")
1593 (ior:BI (ne:BI (zero_extract:DI
1594 (match_operand:DI 1 "gr_register_operand" "r")
1596 (match_operand:DI 2 "const_int_operand" "n"))
1598 (match_operand:BI 3 "register_operand" "0")))]
1600 "tbit.nz.or.andcm %0, %I0 = %1, %2"
1601 [(set_attr "itanium_class" "tbit")])
1603 (define_insn "*tbit_or_3"
1604 [(set (match_operand:BI 0 "register_operand" "=c")
1605 (ior:BI (eq:BI (zero_extract:DI
1606 (match_operand:DI 1 "gr_register_operand" "r")
1608 (match_operand:DI 2 "const_int_operand" "n"))
1610 (match_operand:BI 3 "register_operand" "0")))]
1612 "tbit.z.or.andcm %0, %I0 = %1, %2"
1613 [(set_attr "itanium_class" "tbit")])
1615 ;; Transform test of and/or of setcc into parallel comparisons.
1618 [(set (match_operand:BI 0 "register_operand" "")
1619 (ne:BI (and:DI (ne:DI (match_operand:BI 2 "register_operand" "")
1621 (match_operand:DI 3 "register_operand" ""))
1625 (and:BI (ne:BI (and:DI (match_dup 3) (const_int 1)) (const_int 0))
1630 [(set (match_operand:BI 0 "register_operand" "")
1631 (eq:BI (and:DI (ne:DI (match_operand:BI 2 "register_operand" "")
1633 (match_operand:DI 3 "register_operand" ""))
1637 (and:BI (ne:BI (and:DI (match_dup 3) (const_int 1)) (const_int 0))
1639 (parallel [(set (match_dup 0) (not:BI (match_dup 0)))
1640 (clobber (scratch))])]
1644 [(set (match_operand:BI 0 "register_operand" "")
1645 (ne:BI (ior:DI (ne:DI (match_operand:BI 2 "register_operand" "")
1647 (match_operand:DI 3 "register_operand" ""))
1651 (ior:BI (ne:BI (match_dup 3) (const_int 0))
1656 [(set (match_operand:BI 0 "register_operand" "")
1657 (eq:BI (ior:DI (ne:DI (match_operand:BI 2 "register_operand" "")
1659 (match_operand:DI 3 "register_operand" ""))
1663 (ior:BI (ne:BI (match_dup 3) (const_int 0))
1665 (parallel [(set (match_dup 0) (not:BI (match_dup 0)))
1666 (clobber (scratch))])]
1669 ;; ??? Incredibly hackish. Either need four proper patterns with all
1670 ;; the alternatives, or rely on sched1 to split the insn and hope that
1671 ;; nothing bad happens to the comparisons in the meantime.
1673 ;; Alternately, adjust combine to allow 2->2 and 3->3 splits, assuming
1674 ;; that we're doing height reduction.
1676 ;(define_insn_and_split ""
1677 ; [(set (match_operand:BI 0 "register_operand" "=c")
1678 ; (and:BI (and:BI (match_operator:BI 1 "comparison_operator"
1679 ; [(match_operand 2 "" "")
1680 ; (match_operand 3 "" "")])
1681 ; (match_operator:BI 4 "comparison_operator"
1682 ; [(match_operand 5 "" "")
1683 ; (match_operand 6 "" "")]))
1685 ; "flag_schedule_insns"
1688 ; [(set (match_dup 0) (and:BI (match_dup 1) (match_dup 0)))
1689 ; (set (match_dup 0) (and:BI (match_dup 4) (match_dup 0)))]
1692 ;(define_insn_and_split ""
1693 ; [(set (match_operand:BI 0 "register_operand" "=c")
1694 ; (ior:BI (ior:BI (match_operator:BI 1 "comparison_operator"
1695 ; [(match_operand 2 "" "")
1696 ; (match_operand 3 "" "")])
1697 ; (match_operator:BI 4 "comparison_operator"
1698 ; [(match_operand 5 "" "")
1699 ; (match_operand 6 "" "")]))
1701 ; "flag_schedule_insns"
1704 ; [(set (match_dup 0) (ior:BI (match_dup 1) (match_dup 0)))
1705 ; (set (match_dup 0) (ior:BI (match_dup 4) (match_dup 0)))]
1709 ; [(set (match_operand:BI 0 "register_operand" "")
1710 ; (and:BI (and:BI (match_operator:BI 1 "comparison_operator"
1711 ; [(match_operand 2 "" "")
1712 ; (match_operand 3 "" "")])
1713 ; (match_operand:BI 7 "register_operand" ""))
1714 ; (and:BI (match_operator:BI 4 "comparison_operator"
1715 ; [(match_operand 5 "" "")
1716 ; (match_operand 6 "" "")])
1717 ; (match_operand:BI 8 "register_operand" ""))))]
1719 ; [(set (match_dup 0) (and:BI (match_dup 7) (match_dup 8)))
1720 ; (set (match_dup 0) (and:BI (and:BI (match_dup 1) (match_dup 4))
1725 ; [(set (match_operand:BI 0 "register_operand" "")
1726 ; (ior:BI (ior:BI (match_operator:BI 1 "comparison_operator"
1727 ; [(match_operand 2 "" "")
1728 ; (match_operand 3 "" "")])
1729 ; (match_operand:BI 7 "register_operand" ""))
1730 ; (ior:BI (match_operator:BI 4 "comparison_operator"
1731 ; [(match_operand 5 "" "")
1732 ; (match_operand 6 "" "")])
1733 ; (match_operand:BI 8 "register_operand" ""))))]
1735 ; [(set (match_dup 0) (ior:BI (match_dup 7) (match_dup 8)))
1736 ; (set (match_dup 0) (ior:BI (ior:BI (match_dup 1) (match_dup 4))
1740 ;; Try harder to avoid predicate copies by duplicating compares.
1741 ;; Note that we'll have already split the predicate copy, which
1742 ;; is kind of a pain, but oh well.
1745 [(set (match_operand:BI 0 "register_operand" "")
1746 (match_operand:BI 1 "comparison_operator" ""))
1747 (set (match_operand:CCI 2 "register_operand" "")
1748 (match_operand:CCI 3 "register_operand" ""))
1749 (set (match_operand:CCI 4 "register_operand" "")
1750 (match_operand:CCI 5 "register_operand" ""))
1751 (set (match_operand:BI 6 "register_operand" "")
1752 (unspec:BI [(match_dup 6)] UNSPEC_PRED_REL_MUTEX))]
1753 "REGNO (operands[3]) == REGNO (operands[0])
1754 && REGNO (operands[4]) == REGNO (operands[0]) + 1
1755 && REGNO (operands[4]) == REGNO (operands[2]) + 1
1756 && REGNO (operands[6]) == REGNO (operands[2])"
1757 [(set (match_dup 0) (match_dup 1))
1758 (set (match_dup 6) (match_dup 7))]
1759 "operands[7] = copy_rtx (operands[1]);")
1761 ;; ::::::::::::::::::::
1763 ;; :: 16 bit Integer arithmetic
1765 ;; ::::::::::::::::::::
1767 (define_insn "mulhi3"
1768 [(set (match_operand:HI 0 "gr_register_operand" "=r")
1769 (mult:HI (match_operand:HI 1 "gr_register_operand" "r")
1770 (match_operand:HI 2 "gr_register_operand" "r")))]
1772 "pmpy2.r %0 = %1, %2"
1773 [(set_attr "itanium_class" "mmmul")])
1776 ;; ::::::::::::::::::::
1778 ;; :: 32 bit Integer arithmetic
1780 ;; ::::::::::::::::::::
1782 (define_insn "addsi3"
1783 [(set (match_operand:SI 0 "gr_register_operand" "=r,r,r")
1784 (plus:SI (match_operand:SI 1 "gr_register_operand" "%r,r,a")
1785 (match_operand:SI 2 "gr_reg_or_22bit_operand" "r,I,J")))]
1791 [(set_attr "itanium_class" "ialu")])
1793 (define_insn "*addsi3_plus1"
1794 [(set (match_operand:SI 0 "gr_register_operand" "=r")
1795 (plus:SI (plus:SI (match_operand:SI 1 "gr_register_operand" "r")
1796 (match_operand:SI 2 "gr_register_operand" "r"))
1799 "add %0 = %1, %2, 1"
1800 [(set_attr "itanium_class" "ialu")])
1802 (define_insn "*addsi3_plus1_alt"
1803 [(set (match_operand:SI 0 "gr_register_operand" "=r")
1804 (plus:SI (mult:SI (match_operand:SI 1 "gr_register_operand" "r")
1808 "add %0 = %1, %1, 1"
1809 [(set_attr "itanium_class" "ialu")])
1811 (define_insn "*addsi3_shladd"
1812 [(set (match_operand:SI 0 "gr_register_operand" "=r")
1813 (plus:SI (mult:SI (match_operand:SI 1 "gr_register_operand" "r")
1814 (match_operand:SI 2 "shladd_operand" "n"))
1815 (match_operand:SI 3 "gr_register_operand" "r")))]
1817 "shladd %0 = %1, %S2, %3"
1818 [(set_attr "itanium_class" "ialu")])
1820 (define_insn "subsi3"
1821 [(set (match_operand:SI 0 "gr_register_operand" "=r")
1822 (minus:SI (match_operand:SI 1 "gr_reg_or_8bit_operand" "rK")
1823 (match_operand:SI 2 "gr_register_operand" "r")))]
1826 [(set_attr "itanium_class" "ialu")])
1828 (define_insn "*subsi3_minus1"
1829 [(set (match_operand:SI 0 "gr_register_operand" "=r")
1830 (plus:SI (not:SI (match_operand:SI 1 "gr_register_operand" "r"))
1831 (match_operand:SI 2 "gr_register_operand" "r")))]
1833 "sub %0 = %2, %1, 1"
1834 [(set_attr "itanium_class" "ialu")])
1836 ;; ??? Could add maddsi3 patterns patterned after the madddi3 patterns.
1838 (define_insn "mulsi3"
1839 [(set (match_operand:SI 0 "fr_register_operand" "=f")
1840 (mult:SI (match_operand:SI 1 "grfr_register_operand" "f")
1841 (match_operand:SI 2 "grfr_register_operand" "f")))]
1843 "xmpy.l %0 = %1, %2"
1844 [(set_attr "itanium_class" "xmpy")])
1846 (define_insn "maddsi4"
1847 [(set (match_operand:SI 0 "fr_register_operand" "=f")
1848 (plus:SI (mult:SI (match_operand:SI 1 "grfr_register_operand" "f")
1849 (match_operand:SI 2 "grfr_register_operand" "f"))
1850 (match_operand:SI 3 "grfr_register_operand" "f")))]
1852 "xma.l %0 = %1, %2, %3"
1853 [(set_attr "itanium_class" "xmpy")])
1855 (define_insn "negsi2"
1856 [(set (match_operand:SI 0 "gr_register_operand" "=r")
1857 (neg:SI (match_operand:SI 1 "gr_register_operand" "r")))]
1860 [(set_attr "itanium_class" "ialu")])
1862 (define_expand "abssi2"
1864 (ge:BI (match_operand:SI 1 "gr_register_operand" "") (const_int 0)))
1865 (set (match_operand:SI 0 "gr_register_operand" "")
1866 (if_then_else:SI (eq (match_dup 2) (const_int 0))
1867 (neg:SI (match_dup 1))
1870 { operands[2] = gen_reg_rtx (BImode); })
1872 (define_expand "sminsi3"
1874 (ge:BI (match_operand:SI 1 "gr_register_operand" "")
1875 (match_operand:SI 2 "gr_register_operand" "")))
1876 (set (match_operand:SI 0 "gr_register_operand" "")
1877 (if_then_else:SI (ne (match_dup 3) (const_int 0))
1878 (match_dup 2) (match_dup 1)))]
1880 { operands[3] = gen_reg_rtx (BImode); })
1882 (define_expand "smaxsi3"
1884 (ge:BI (match_operand:SI 1 "gr_register_operand" "")
1885 (match_operand:SI 2 "gr_register_operand" "")))
1886 (set (match_operand:SI 0 "gr_register_operand" "")
1887 (if_then_else:SI (ne (match_dup 3) (const_int 0))
1888 (match_dup 1) (match_dup 2)))]
1890 { operands[3] = gen_reg_rtx (BImode); })
1892 (define_expand "uminsi3"
1894 (geu:BI (match_operand:SI 1 "gr_register_operand" "")
1895 (match_operand:SI 2 "gr_register_operand" "")))
1896 (set (match_operand:SI 0 "gr_register_operand" "")
1897 (if_then_else:SI (ne (match_dup 3) (const_int 0))
1898 (match_dup 2) (match_dup 1)))]
1900 { operands[3] = gen_reg_rtx (BImode); })
1902 (define_expand "umaxsi3"
1904 (geu:BI (match_operand:SI 1 "gr_register_operand" "")
1905 (match_operand:SI 2 "gr_register_operand" "")))
1906 (set (match_operand:SI 0 "gr_register_operand" "")
1907 (if_then_else:SI (ne (match_dup 3) (const_int 0))
1908 (match_dup 1) (match_dup 2)))]
1910 { operands[3] = gen_reg_rtx (BImode); })
1912 (define_expand "divsi3"
1913 [(set (match_operand:SI 0 "register_operand" "")
1914 (div:SI (match_operand:SI 1 "general_operand" "")
1915 (match_operand:SI 2 "general_operand" "")))]
1916 "TARGET_INLINE_INT_DIV"
1918 rtx op1_xf, op2_xf, op0_xf, op0_di, twon34, twon34_exp;
1920 op0_xf = gen_reg_rtx (XFmode);
1921 op0_di = gen_reg_rtx (DImode);
1923 if (CONSTANT_P (operands[1]))
1924 operands[1] = force_reg (SImode, operands[1]);
1925 op1_xf = gen_reg_rtx (XFmode);
1926 expand_float (op1_xf, operands[1], 0);
1928 if (CONSTANT_P (operands[2]))
1929 operands[2] = force_reg (SImode, operands[2]);
1930 op2_xf = gen_reg_rtx (XFmode);
1931 expand_float (op2_xf, operands[2], 0);
1934 twon34_exp = gen_reg_rtx (DImode);
1935 emit_move_insn (twon34_exp, GEN_INT (65501));
1936 twon34 = gen_reg_rtx (XFmode);
1937 emit_insn (gen_setf_exp_xf (twon34, twon34_exp));
1939 emit_insn (gen_divsi3_internal (op0_xf, op1_xf, op2_xf, twon34));
1941 emit_insn (gen_fix_truncxfdi2_alts (op0_di, op0_xf, const1_rtx));
1942 emit_move_insn (operands[0], gen_lowpart (SImode, op0_di));
1946 (define_expand "modsi3"
1947 [(set (match_operand:SI 0 "register_operand" "")
1948 (mod:SI (match_operand:SI 1 "general_operand" "")
1949 (match_operand:SI 2 "general_operand" "")))]
1950 "TARGET_INLINE_INT_DIV"
1952 rtx op2_neg, op1_di, div;
1954 div = gen_reg_rtx (SImode);
1955 emit_insn (gen_divsi3 (div, operands[1], operands[2]));
1957 op2_neg = expand_unop (SImode, neg_optab, operands[2], NULL_RTX, 0);
1959 /* This is a trick to get us to reuse the value that we're sure to
1960 have already copied to the FP regs. */
1961 op1_di = gen_reg_rtx (DImode);
1962 convert_move (op1_di, operands[1], 0);
1964 emit_insn (gen_maddsi4 (operands[0], div, op2_neg,
1965 gen_lowpart (SImode, op1_di)));
1969 (define_expand "udivsi3"
1970 [(set (match_operand:SI 0 "register_operand" "")
1971 (udiv:SI (match_operand:SI 1 "general_operand" "")
1972 (match_operand:SI 2 "general_operand" "")))]
1973 "TARGET_INLINE_INT_DIV"
1975 rtx op1_xf, op2_xf, op0_xf, op0_di, twon34, twon34_exp;
1977 op0_xf = gen_reg_rtx (XFmode);
1978 op0_di = gen_reg_rtx (DImode);
1980 if (CONSTANT_P (operands[1]))
1981 operands[1] = force_reg (SImode, operands[1]);
1982 op1_xf = gen_reg_rtx (XFmode);
1983 expand_float (op1_xf, operands[1], 1);
1985 if (CONSTANT_P (operands[2]))
1986 operands[2] = force_reg (SImode, operands[2]);
1987 op2_xf = gen_reg_rtx (XFmode);
1988 expand_float (op2_xf, operands[2], 1);
1991 twon34_exp = gen_reg_rtx (DImode);
1992 emit_move_insn (twon34_exp, GEN_INT (65501));
1993 twon34 = gen_reg_rtx (XFmode);
1994 emit_insn (gen_setf_exp_xf (twon34, twon34_exp));
1996 emit_insn (gen_divsi3_internal (op0_xf, op1_xf, op2_xf, twon34));
1998 emit_insn (gen_fixuns_truncxfdi2_alts (op0_di, op0_xf, const1_rtx));
1999 emit_move_insn (operands[0], gen_lowpart (SImode, op0_di));
2003 (define_expand "umodsi3"
2004 [(set (match_operand:SI 0 "register_operand" "")
2005 (umod:SI (match_operand:SI 1 "general_operand" "")
2006 (match_operand:SI 2 "general_operand" "")))]
2007 "TARGET_INLINE_INT_DIV"
2009 rtx op2_neg, op1_di, div;
2011 div = gen_reg_rtx (SImode);
2012 emit_insn (gen_udivsi3 (div, operands[1], operands[2]));
2014 op2_neg = expand_unop (SImode, neg_optab, operands[2], NULL_RTX, 0);
2016 /* This is a trick to get us to reuse the value that we're sure to
2017 have already copied to the FP regs. */
2018 op1_di = gen_reg_rtx (DImode);
2019 convert_move (op1_di, operands[1], 1);
2021 emit_insn (gen_maddsi4 (operands[0], div, op2_neg,
2022 gen_lowpart (SImode, op1_di)));
2026 (define_insn_and_split "divsi3_internal"
2027 [(set (match_operand:XF 0 "fr_register_operand" "=&f")
2028 (float:XF (div:SI (match_operand:XF 1 "fr_register_operand" "f")
2029 (match_operand:XF 2 "fr_register_operand" "f"))))
2030 (clobber (match_scratch:XF 4 "=&f"))
2031 (clobber (match_scratch:XF 5 "=&f"))
2032 (clobber (match_scratch:BI 6 "=c"))
2033 (use (match_operand:XF 3 "fr_register_operand" "f"))]
2034 "TARGET_INLINE_INT_DIV"
2036 "&& reload_completed"
2037 [(parallel [(set (match_dup 0) (div:XF (const_int 1) (match_dup 2)))
2038 (set (match_dup 6) (unspec:BI [(match_dup 1) (match_dup 2)]
2039 UNSPEC_FR_RECIP_APPROX))
2040 (use (const_int 1))])
2041 (cond_exec (ne (match_dup 6) (const_int 0))
2042 (parallel [(set (match_dup 4) (mult:XF (match_dup 1) (match_dup 0)))
2043 (use (const_int 1))]))
2044 (cond_exec (ne (match_dup 6) (const_int 0))
2045 (parallel [(set (match_dup 5)
2046 (minus:XF (match_dup 7)
2047 (mult:XF (match_dup 2) (match_dup 0))))
2048 (use (const_int 1))]))
2049 (cond_exec (ne (match_dup 6) (const_int 0))
2050 (parallel [(set (match_dup 4)
2051 (plus:XF (mult:XF (match_dup 5) (match_dup 4))
2053 (use (const_int 1))]))
2054 (cond_exec (ne (match_dup 6) (const_int 0))
2055 (parallel [(set (match_dup 5)
2056 (plus:XF (mult:XF (match_dup 5) (match_dup 5))
2058 (use (const_int 1))]))
2059 (cond_exec (ne (match_dup 6) (const_int 0))
2060 (parallel [(set (match_dup 0)
2061 (plus:XF (mult:XF (match_dup 5) (match_dup 4))
2063 (use (const_int 1))]))
2065 "operands[7] = CONST1_RTX (XFmode);"
2066 [(set_attr "predicable" "no")])
2068 ;; ::::::::::::::::::::
2070 ;; :: 64 bit Integer arithmetic
2072 ;; ::::::::::::::::::::
2074 (define_insn "adddi3"
2075 [(set (match_operand:DI 0 "gr_register_operand" "=r,r,r")
2076 (plus:DI (match_operand:DI 1 "gr_register_operand" "%r,r,a")
2077 (match_operand:DI 2 "gr_reg_or_22bit_operand" "r,I,J")))]
2083 [(set_attr "itanium_class" "ialu")])
2085 (define_insn "*adddi3_plus1"
2086 [(set (match_operand:DI 0 "gr_register_operand" "=r")
2087 (plus:DI (plus:DI (match_operand:DI 1 "gr_register_operand" "r")
2088 (match_operand:DI 2 "gr_register_operand" "r"))
2091 "add %0 = %1, %2, 1"
2092 [(set_attr "itanium_class" "ialu")])
2094 ;; This has some of the same problems as shladd. We let the shladd
2095 ;; eliminator hack handle it, which results in the 1 being forced into
2096 ;; a register, but not more ugliness here.
2097 (define_insn "*adddi3_plus1_alt"
2098 [(set (match_operand:DI 0 "gr_register_operand" "=r")
2099 (plus:DI (mult:DI (match_operand:DI 1 "gr_register_operand" "r")
2103 "add %0 = %1, %1, 1"
2104 [(set_attr "itanium_class" "ialu")])
2106 (define_insn "subdi3"
2107 [(set (match_operand:DI 0 "gr_register_operand" "=r")
2108 (minus:DI (match_operand:DI 1 "gr_reg_or_8bit_operand" "rK")
2109 (match_operand:DI 2 "gr_register_operand" "r")))]
2112 [(set_attr "itanium_class" "ialu")])
2114 (define_insn "*subdi3_minus1"
2115 [(set (match_operand:DI 0 "gr_register_operand" "=r")
2116 (plus:DI (not:DI (match_operand:DI 1 "gr_register_operand" "r"))
2117 (match_operand:DI 2 "gr_register_operand" "r")))]
2119 "sub %0 = %2, %1, 1"
2120 [(set_attr "itanium_class" "ialu")])
2122 ;; ??? Use grfr instead of fr because of virtual register elimination
2123 ;; and silly test cases multiplying by the frame pointer.
2124 (define_insn "muldi3"
2125 [(set (match_operand:DI 0 "fr_register_operand" "=f")
2126 (mult:DI (match_operand:DI 1 "grfr_register_operand" "f")
2127 (match_operand:DI 2 "grfr_register_operand" "f")))]
2129 "xmpy.l %0 = %1, %2"
2130 [(set_attr "itanium_class" "xmpy")])
2132 ;; ??? If operand 3 is an eliminable reg, then register elimination causes the
2133 ;; same problem that we have with shladd below. Unfortunately, this case is
2134 ;; much harder to fix because the multiply puts the result in an FP register,
2135 ;; but the add needs inputs from a general register. We add a spurious clobber
2136 ;; here so that it will be present just in case register elimination gives us
2137 ;; the funny result.
2139 ;; ??? Maybe validate_changes should try adding match_scratch clobbers?
2141 ;; ??? Maybe we should change how adds are canonicalized.
2143 (define_insn "madddi4"
2144 [(set (match_operand:DI 0 "fr_register_operand" "=f")
2145 (plus:DI (mult:DI (match_operand:DI 1 "grfr_register_operand" "f")
2146 (match_operand:DI 2 "grfr_register_operand" "f"))
2147 (match_operand:DI 3 "grfr_register_operand" "f")))
2148 (clobber (match_scratch:DI 4 "=X"))]
2150 "xma.l %0 = %1, %2, %3"
2151 [(set_attr "itanium_class" "xmpy")])
2153 ;; This can be created by register elimination if operand3 of shladd is an
2154 ;; eliminable register or has reg_equiv_constant set.
2156 ;; We have to use nonmemory_operand for operand 4, to ensure that the
2157 ;; validate_changes call inside eliminate_regs will always succeed. If it
2158 ;; doesn't succeed, then this remain a madddi4 pattern, and will be reloaded
2161 (define_insn "*madddi4_elim"
2162 [(set (match_operand:DI 0 "register_operand" "=&r")
2163 (plus:DI (plus:DI (mult:DI (match_operand:DI 1 "register_operand" "f")
2164 (match_operand:DI 2 "register_operand" "f"))
2165 (match_operand:DI 3 "register_operand" "f"))
2166 (match_operand:DI 4 "nonmemory_operand" "rI")))
2167 (clobber (match_scratch:DI 5 "=f"))]
2168 "reload_in_progress"
2170 [(set_attr "itanium_class" "unknown")])
2173 [(set (match_operand:DI 0 "register_operand" "")
2174 (plus:DI (plus:DI (mult:DI (match_operand:DI 1 "register_operand" "")
2175 (match_operand:DI 2 "register_operand" ""))
2176 (match_operand:DI 3 "register_operand" ""))
2177 (match_operand:DI 4 "gr_reg_or_14bit_operand" "")))
2178 (clobber (match_scratch:DI 5 ""))]
2180 [(parallel [(set (match_dup 5) (plus:DI (mult:DI (match_dup 1) (match_dup 2))
2182 (clobber (match_dup 0))])
2183 (set (match_dup 0) (match_dup 5))
2184 (set (match_dup 0) (plus:DI (match_dup 0) (match_dup 4)))]
2187 ;; ??? There are highpart multiply and add instructions, but we have no way
2188 ;; to generate them.
2190 (define_insn "smuldi3_highpart"
2191 [(set (match_operand:DI 0 "fr_register_operand" "=f")
2194 (mult:TI (sign_extend:TI
2195 (match_operand:DI 1 "fr_register_operand" "f"))
2197 (match_operand:DI 2 "fr_register_operand" "f")))
2200 "xmpy.h %0 = %1, %2"
2201 [(set_attr "itanium_class" "xmpy")])
2203 (define_insn "umuldi3_highpart"
2204 [(set (match_operand:DI 0 "fr_register_operand" "=f")
2207 (mult:TI (zero_extend:TI
2208 (match_operand:DI 1 "fr_register_operand" "f"))
2210 (match_operand:DI 2 "fr_register_operand" "f")))
2213 "xmpy.hu %0 = %1, %2"
2214 [(set_attr "itanium_class" "xmpy")])
2216 (define_insn "negdi2"
2217 [(set (match_operand:DI 0 "gr_register_operand" "=r")
2218 (neg:DI (match_operand:DI 1 "gr_register_operand" "r")))]
2221 [(set_attr "itanium_class" "ialu")])
2223 (define_expand "absdi2"
2225 (ge:BI (match_operand:DI 1 "gr_register_operand" "") (const_int 0)))
2226 (set (match_operand:DI 0 "gr_register_operand" "")
2227 (if_then_else:DI (eq (match_dup 2) (const_int 0))
2228 (neg:DI (match_dup 1))
2231 { operands[2] = gen_reg_rtx (BImode); })
2233 (define_expand "smindi3"
2235 (ge:BI (match_operand:DI 1 "gr_register_operand" "")
2236 (match_operand:DI 2 "gr_register_operand" "")))
2237 (set (match_operand:DI 0 "gr_register_operand" "")
2238 (if_then_else:DI (ne (match_dup 3) (const_int 0))
2239 (match_dup 2) (match_dup 1)))]
2241 { operands[3] = gen_reg_rtx (BImode); })
2243 (define_expand "smaxdi3"
2245 (ge:BI (match_operand:DI 1 "gr_register_operand" "")
2246 (match_operand:DI 2 "gr_register_operand" "")))
2247 (set (match_operand:DI 0 "gr_register_operand" "")
2248 (if_then_else:DI (ne (match_dup 3) (const_int 0))
2249 (match_dup 1) (match_dup 2)))]
2251 { operands[3] = gen_reg_rtx (BImode); })
2253 (define_expand "umindi3"
2255 (geu:BI (match_operand:DI 1 "gr_register_operand" "")
2256 (match_operand:DI 2 "gr_register_operand" "")))
2257 (set (match_operand:DI 0 "gr_register_operand" "")
2258 (if_then_else:DI (ne (match_dup 3) (const_int 0))
2259 (match_dup 2) (match_dup 1)))]
2261 { operands[3] = gen_reg_rtx (BImode); })
2263 (define_expand "umaxdi3"
2265 (geu:BI (match_operand:DI 1 "gr_register_operand" "")
2266 (match_operand:DI 2 "gr_register_operand" "")))
2267 (set (match_operand:DI 0 "gr_register_operand" "")
2268 (if_then_else:DI (ne (match_dup 3) (const_int 0))
2269 (match_dup 1) (match_dup 2)))]
2271 { operands[3] = gen_reg_rtx (BImode); })
2273 (define_expand "ffsdi2"
2275 (eq:BI (match_operand:DI 1 "gr_register_operand" "") (const_int 0)))
2276 (set (match_dup 2) (plus:DI (match_dup 1) (const_int -1)))
2277 (set (match_dup 5) (const_int 0))
2278 (set (match_dup 3) (xor:DI (match_dup 1) (match_dup 2)))
2279 (set (match_dup 4) (popcount:DI (match_dup 3)))
2280 (set (match_operand:DI 0 "gr_register_operand" "")
2281 (if_then_else:DI (ne (match_dup 6) (const_int 0))
2282 (match_dup 5) (match_dup 4)))]
2285 operands[2] = gen_reg_rtx (DImode);
2286 operands[3] = gen_reg_rtx (DImode);
2287 operands[4] = gen_reg_rtx (DImode);
2288 operands[5] = gen_reg_rtx (DImode);
2289 operands[6] = gen_reg_rtx (BImode);
2292 (define_expand "ctzdi2"
2293 [(set (match_dup 2) (plus:DI (match_operand:DI 1 "gr_register_operand" "")
2295 (set (match_dup 3) (not:DI (match_dup 1)))
2296 (set (match_dup 4) (and:DI (match_dup 2) (match_dup 3)))
2297 (set (match_operand:DI 0 "gr_register_operand" "")
2298 (popcount:DI (match_dup 4)))]
2301 operands[2] = gen_reg_rtx (DImode);
2302 operands[3] = gen_reg_rtx (DImode);
2303 operands[4] = gen_reg_rtx (DImode);
2306 ;; Note the computation here is op0 = 63 - (exp - 0xffff).
2307 (define_expand "clzdi2"
2309 (unsigned_float:XF (match_operand:DI 1 "fr_register_operand" "")))
2311 (unspec:DI [(match_dup 2)] UNSPEC_GETF_EXP))
2312 (set (match_dup 4) (const_int 65598))
2313 (set (match_operand:DI 0 "gr_register_operand" "")
2314 (minus:DI (match_dup 4) (match_dup 3)))]
2317 operands[2] = gen_reg_rtx (XFmode);
2318 operands[3] = gen_reg_rtx (DImode);
2319 operands[4] = gen_reg_rtx (DImode);
2322 (define_insn "popcountdi2"
2323 [(set (match_operand:DI 0 "gr_register_operand" "=r")
2324 (popcount:DI (match_operand:DI 1 "gr_register_operand" "r")))]
2327 [(set_attr "itanium_class" "mmmul")])
2329 (define_insn "*getf_exp_xf"
2330 [(set (match_operand:DI 0 "gr_register_operand" "=r")
2331 (unspec:DI [(match_operand:XF 1 "fr_register_operand" "f")]
2335 [(set_attr "itanium_class" "frfr")])
2337 (define_expand "divdi3"
2338 [(set (match_operand:DI 0 "register_operand" "")
2339 (div:DI (match_operand:DI 1 "general_operand" "")
2340 (match_operand:DI 2 "general_operand" "")))]
2341 "TARGET_INLINE_INT_DIV"
2343 rtx op1_xf, op2_xf, op0_xf;
2345 op0_xf = gen_reg_rtx (XFmode);
2347 if (CONSTANT_P (operands[1]))
2348 operands[1] = force_reg (DImode, operands[1]);
2349 op1_xf = gen_reg_rtx (XFmode);
2350 expand_float (op1_xf, operands[1], 0);
2352 if (CONSTANT_P (operands[2]))
2353 operands[2] = force_reg (DImode, operands[2]);
2354 op2_xf = gen_reg_rtx (XFmode);
2355 expand_float (op2_xf, operands[2], 0);
2357 if (TARGET_INLINE_INT_DIV_LAT)
2358 emit_insn (gen_divdi3_internal_lat (op0_xf, op1_xf, op2_xf));
2360 emit_insn (gen_divdi3_internal_thr (op0_xf, op1_xf, op2_xf));
2362 emit_insn (gen_fix_truncxfdi2_alts (operands[0], op0_xf, const1_rtx));
2366 (define_expand "moddi3"
2367 [(set (match_operand:DI 0 "register_operand" "")
2368 (mod:SI (match_operand:DI 1 "general_operand" "")
2369 (match_operand:DI 2 "general_operand" "")))]
2370 "TARGET_INLINE_INT_DIV"
2374 div = gen_reg_rtx (DImode);
2375 emit_insn (gen_divdi3 (div, operands[1], operands[2]));
2377 op2_neg = expand_unop (DImode, neg_optab, operands[2], NULL_RTX, 0);
2379 emit_insn (gen_madddi4 (operands[0], div, op2_neg, operands[1]));
2383 (define_expand "udivdi3"
2384 [(set (match_operand:DI 0 "register_operand" "")
2385 (udiv:DI (match_operand:DI 1 "general_operand" "")
2386 (match_operand:DI 2 "general_operand" "")))]
2387 "TARGET_INLINE_INT_DIV"
2389 rtx op1_xf, op2_xf, op0_xf;
2391 op0_xf = gen_reg_rtx (XFmode);
2393 if (CONSTANT_P (operands[1]))
2394 operands[1] = force_reg (DImode, operands[1]);
2395 op1_xf = gen_reg_rtx (XFmode);
2396 expand_float (op1_xf, operands[1], 1);
2398 if (CONSTANT_P (operands[2]))
2399 operands[2] = force_reg (DImode, operands[2]);
2400 op2_xf = gen_reg_rtx (XFmode);
2401 expand_float (op2_xf, operands[2], 1);
2403 if (TARGET_INLINE_INT_DIV_LAT)
2404 emit_insn (gen_divdi3_internal_lat (op0_xf, op1_xf, op2_xf));
2406 emit_insn (gen_divdi3_internal_thr (op0_xf, op1_xf, op2_xf));
2408 emit_insn (gen_fixuns_truncxfdi2_alts (operands[0], op0_xf, const1_rtx));
2412 (define_expand "umoddi3"
2413 [(set (match_operand:DI 0 "register_operand" "")
2414 (umod:DI (match_operand:DI 1 "general_operand" "")
2415 (match_operand:DI 2 "general_operand" "")))]
2416 "TARGET_INLINE_INT_DIV"
2420 div = gen_reg_rtx (DImode);
2421 emit_insn (gen_udivdi3 (div, operands[1], operands[2]));
2423 op2_neg = expand_unop (DImode, neg_optab, operands[2], NULL_RTX, 0);
2425 emit_insn (gen_madddi4 (operands[0], div, op2_neg, operands[1]));
2429 (define_insn_and_split "divdi3_internal_lat"
2430 [(set (match_operand:XF 0 "fr_register_operand" "=&f")
2431 (float:XF (div:SI (match_operand:XF 1 "fr_register_operand" "f")
2432 (match_operand:XF 2 "fr_register_operand" "f"))))
2433 (clobber (match_scratch:XF 3 "=&f"))
2434 (clobber (match_scratch:XF 4 "=&f"))
2435 (clobber (match_scratch:XF 5 "=&f"))
2436 (clobber (match_scratch:BI 6 "=c"))]
2437 "TARGET_INLINE_INT_DIV_LAT"
2439 "&& reload_completed"
2440 [(parallel [(set (match_dup 0) (div:XF (const_int 1) (match_dup 2)))
2441 (set (match_dup 6) (unspec:BI [(match_dup 1) (match_dup 2)]
2442 UNSPEC_FR_RECIP_APPROX))
2443 (use (const_int 1))])
2444 (cond_exec (ne (match_dup 6) (const_int 0))
2445 (parallel [(set (match_dup 3)
2446 (minus:XF (match_dup 7)
2447 (mult:XF (match_dup 2) (match_dup 0))))
2448 (use (const_int 1))]))
2449 (cond_exec (ne (match_dup 6) (const_int 0))
2450 (parallel [(set (match_dup 4) (mult:XF (match_dup 1) (match_dup 0)))
2451 (use (const_int 1))]))
2452 (cond_exec (ne (match_dup 6) (const_int 0))
2453 (parallel [(set (match_dup 5) (mult:XF (match_dup 3) (match_dup 3)))
2454 (use (const_int 1))]))
2455 (cond_exec (ne (match_dup 6) (const_int 0))
2456 (parallel [(set (match_dup 4)
2457 (plus:XF (mult:XF (match_dup 3) (match_dup 4))
2459 (use (const_int 1))]))
2460 (cond_exec (ne (match_dup 6) (const_int 0))
2461 (parallel [(set (match_dup 0)
2462 (plus:XF (mult:XF (match_dup 3) (match_dup 0))
2464 (use (const_int 1))]))
2465 (cond_exec (ne (match_dup 6) (const_int 0))
2466 (parallel [(set (match_dup 3)
2467 (plus:XF (mult:XF (match_dup 5) (match_dup 4))
2469 (use (const_int 1))]))
2470 (cond_exec (ne (match_dup 6) (const_int 0))
2471 (parallel [(set (match_dup 0)
2472 (plus:XF (mult:XF (match_dup 5) (match_dup 0))
2474 (use (const_int 1))]))
2475 (cond_exec (ne (match_dup 6) (const_int 0))
2476 (parallel [(set (match_dup 4)
2477 (minus:XF (match_dup 1)
2478 (mult:XF (match_dup 2) (match_dup 3))))
2479 (use (const_int 1))]))
2480 (cond_exec (ne (match_dup 6) (const_int 0))
2481 (parallel [(set (match_dup 0)
2482 (plus:XF (mult:XF (match_dup 4) (match_dup 0))
2484 (use (const_int 1))]))
2486 "operands[7] = CONST1_RTX (XFmode);"
2487 [(set_attr "predicable" "no")])
2489 (define_insn_and_split "divdi3_internal_thr"
2490 [(set (match_operand:XF 0 "fr_register_operand" "=&f")
2491 (float:XF (div:SI (match_operand:XF 1 "fr_register_operand" "f")
2492 (match_operand:XF 2 "fr_register_operand" "f"))))
2493 (clobber (match_scratch:XF 3 "=&f"))
2494 (clobber (match_scratch:XF 4 "=f"))
2495 (clobber (match_scratch:BI 5 "=c"))]
2496 "TARGET_INLINE_INT_DIV_THR"
2498 "&& reload_completed"
2499 [(parallel [(set (match_dup 0) (div:XF (const_int 1) (match_dup 2)))
2500 (set (match_dup 5) (unspec:BI [(match_dup 1) (match_dup 2)]
2501 UNSPEC_FR_RECIP_APPROX))
2502 (use (const_int 1))])
2503 (cond_exec (ne (match_dup 5) (const_int 0))
2504 (parallel [(set (match_dup 3)
2505 (minus:XF (match_dup 6)
2506 (mult:XF (match_dup 2) (match_dup 0))))
2507 (use (const_int 1))]))
2508 (cond_exec (ne (match_dup 5) (const_int 0))
2509 (parallel [(set (match_dup 0)
2510 (plus:XF (mult:XF (match_dup 3) (match_dup 0))
2512 (use (const_int 1))]))
2513 (cond_exec (ne (match_dup 5) (const_int 0))
2514 (parallel [(set (match_dup 3) (mult:XF (match_dup 3) (match_dup 3)))
2515 (use (const_int 1))]))
2516 (cond_exec (ne (match_dup 5) (const_int 0))
2517 (parallel [(set (match_dup 0)
2518 (plus:XF (mult:XF (match_dup 3) (match_dup 0))
2520 (use (const_int 1))]))
2521 (cond_exec (ne (match_dup 5) (const_int 0))
2522 (parallel [(set (match_dup 3) (mult:XF (match_dup 0) (match_dup 1)))
2523 (use (const_int 1))]))
2524 (cond_exec (ne (match_dup 5) (const_int 0))
2525 (parallel [(set (match_dup 4)
2526 (minus:XF (match_dup 1)
2527 (mult:XF (match_dup 2) (match_dup 3))))
2528 (use (const_int 1))]))
2529 (cond_exec (ne (match_dup 5) (const_int 0))
2530 (parallel [(set (match_dup 0)
2531 (plus:XF (mult:XF (match_dup 4) (match_dup 0))
2533 (use (const_int 1))]))
2535 "operands[6] = CONST1_RTX (XFmode);"
2536 [(set_attr "predicable" "no")])
2538 ;; ::::::::::::::::::::
2540 ;; :: 32 bit floating point arithmetic
2542 ;; ::::::::::::::::::::
2544 (define_insn "addsf3"
2545 [(set (match_operand:SF 0 "fr_register_operand" "=f")
2546 (plus:SF (match_operand:SF 1 "fr_register_operand" "%f")
2547 (match_operand:SF 2 "fr_reg_or_fp01_operand" "fG")))]
2549 "fadd.s %0 = %1, %F2"
2550 [(set_attr "itanium_class" "fmac")])
2552 (define_insn "subsf3"
2553 [(set (match_operand:SF 0 "fr_register_operand" "=f")
2554 (minus:SF (match_operand:SF 1 "fr_reg_or_fp01_operand" "fG")
2555 (match_operand:SF 2 "fr_reg_or_fp01_operand" "fG")))]
2557 "fsub.s %0 = %F1, %F2"
2558 [(set_attr "itanium_class" "fmac")])
2560 (define_insn "mulsf3"
2561 [(set (match_operand:SF 0 "fr_register_operand" "=f")
2562 (mult:SF (match_operand:SF 1 "fr_register_operand" "%f")
2563 (match_operand:SF 2 "fr_register_operand" "f")))]
2565 "fmpy.s %0 = %1, %2"
2566 [(set_attr "itanium_class" "fmac")])
2568 (define_insn "abssf2"
2569 [(set (match_operand:SF 0 "fr_register_operand" "=f")
2570 (abs:SF (match_operand:SF 1 "fr_register_operand" "f")))]
2573 [(set_attr "itanium_class" "fmisc")])
2575 (define_insn "negsf2"
2576 [(set (match_operand:SF 0 "fr_register_operand" "=f")
2577 (neg:SF (match_operand:SF 1 "fr_register_operand" "f")))]
2580 [(set_attr "itanium_class" "fmisc")])
2582 (define_insn "*nabssf2"
2583 [(set (match_operand:SF 0 "fr_register_operand" "=f")
2584 (neg:SF (abs:SF (match_operand:SF 1 "fr_register_operand" "f"))))]
2587 [(set_attr "itanium_class" "fmisc")])
2589 (define_insn "minsf3"
2590 [(set (match_operand:SF 0 "fr_register_operand" "=f")
2591 (smin:SF (match_operand:SF 1 "fr_register_operand" "f")
2592 (match_operand:SF 2 "fr_reg_or_fp01_operand" "fG")))]
2595 [(set_attr "itanium_class" "fmisc")])
2597 (define_insn "maxsf3"
2598 [(set (match_operand:SF 0 "fr_register_operand" "=f")
2599 (smax:SF (match_operand:SF 1 "fr_register_operand" "f")
2600 (match_operand:SF 2 "fr_reg_or_fp01_operand" "fG")))]
2603 [(set_attr "itanium_class" "fmisc")])
2605 (define_insn "*maddsf4"
2606 [(set (match_operand:SF 0 "fr_register_operand" "=f")
2607 (plus:SF (mult:SF (match_operand:SF 1 "fr_register_operand" "f")
2608 (match_operand:SF 2 "fr_register_operand" "f"))
2609 (match_operand:SF 3 "fr_reg_or_fp01_operand" "fG")))]
2611 "fma.s %0 = %1, %2, %F3"
2612 [(set_attr "itanium_class" "fmac")])
2614 (define_insn "*msubsf4"
2615 [(set (match_operand:SF 0 "fr_register_operand" "=f")
2616 (minus:SF (mult:SF (match_operand:SF 1 "fr_register_operand" "f")
2617 (match_operand:SF 2 "fr_register_operand" "f"))
2618 (match_operand:SF 3 "fr_reg_or_fp01_operand" "fG")))]
2620 "fms.s %0 = %1, %2, %F3"
2621 [(set_attr "itanium_class" "fmac")])
2623 (define_insn "*nmulsf3"
2624 [(set (match_operand:SF 0 "fr_register_operand" "=f")
2625 (neg:SF (mult:SF (match_operand:SF 1 "fr_register_operand" "f")
2626 (match_operand:SF 2 "fr_register_operand" "f"))))]
2628 "fnmpy.s %0 = %1, %2"
2629 [(set_attr "itanium_class" "fmac")])
2631 (define_insn "*nmaddsf4"
2632 [(set (match_operand:SF 0 "fr_register_operand" "=f")
2633 (minus:SF (match_operand:SF 3 "fr_reg_or_fp01_operand" "fG")
2634 (mult:SF (match_operand:SF 1 "fr_register_operand" "f")
2635 (match_operand:SF 2 "fr_register_operand" "f"))))]
2637 "fnma.s %0 = %1, %2, %F3"
2638 [(set_attr "itanium_class" "fmac")])
2640 (define_insn "*nmaddsf4_alts"
2641 [(set (match_operand:SF 0 "fr_register_operand" "=f")
2642 (minus:SF (match_operand:SF 3 "fr_reg_or_fp01_operand" "fG")
2643 (mult:SF (match_operand:SF 1 "fr_register_operand" "f")
2644 (match_operand:SF 2 "fr_register_operand" "f"))))
2645 (use (match_operand:SI 4 "const_int_operand" ""))]
2647 "fnma.s.s%4 %0 = %1, %2, %F3"
2648 [(set_attr "itanium_class" "fmac")])
2650 (define_expand "divsf3"
2651 [(set (match_operand:SF 0 "fr_register_operand" "")
2652 (div:SF (match_operand:SF 1 "fr_register_operand" "")
2653 (match_operand:SF 2 "fr_register_operand" "")))]
2654 "TARGET_INLINE_FLOAT_DIV"
2657 if (TARGET_INLINE_FLOAT_DIV_LAT)
2658 insn = gen_divsf3_internal_lat (operands[0], operands[1], operands[2]);
2660 insn = gen_divsf3_internal_thr (operands[0], operands[1], operands[2]);
2665 (define_insn_and_split "divsf3_internal_lat"
2666 [(set (match_operand:SF 0 "fr_register_operand" "=&f")
2667 (div:SF (match_operand:SF 1 "fr_register_operand" "f")
2668 (match_operand:SF 2 "fr_register_operand" "f")))
2669 (clobber (match_scratch:XF 3 "=&f"))
2670 (clobber (match_scratch:XF 4 "=f"))
2671 (clobber (match_scratch:BI 5 "=c"))]
2672 "TARGET_INLINE_FLOAT_DIV_LAT"
2674 "&& reload_completed"
2675 [(parallel [(set (match_dup 6) (div:XF (const_int 1) (match_dup 8)))
2676 (set (match_dup 5) (unspec:BI [(match_dup 7) (match_dup 8)]
2677 UNSPEC_FR_RECIP_APPROX))
2678 (use (const_int 1))])
2679 (cond_exec (ne (match_dup 5) (const_int 0))
2680 (parallel [(set (match_dup 3) (mult:XF (match_dup 7) (match_dup 6)))
2681 (use (const_int 1))]))
2682 (cond_exec (ne (match_dup 5) (const_int 0))
2683 (parallel [(set (match_dup 4)
2684 (minus:XF (match_dup 10)
2685 (mult:XF (match_dup 8) (match_dup 6))))
2686 (use (const_int 1))]))
2687 (cond_exec (ne (match_dup 5) (const_int 0))
2688 (parallel [(set (match_dup 3)
2689 (plus:XF (mult:XF (match_dup 4) (match_dup 3))
2691 (use (const_int 1))]))
2692 (cond_exec (ne (match_dup 5) (const_int 0))
2693 (parallel [(set (match_dup 4) (mult:XF (match_dup 4) (match_dup 4)))
2694 (use (const_int 1))]))
2695 (cond_exec (ne (match_dup 5) (const_int 0))
2696 (parallel [(set (match_dup 3)
2697 (plus:XF (mult:XF (match_dup 4) (match_dup 3))
2699 (use (const_int 1))]))
2700 (cond_exec (ne (match_dup 5) (const_int 0))
2701 (parallel [(set (match_dup 4) (mult:XF (match_dup 4) (match_dup 4)))
2702 (use (const_int 1))]))
2703 (cond_exec (ne (match_dup 5) (const_int 0))
2704 (parallel [(set (match_dup 9)
2706 (plus:XF (mult:XF (match_dup 4) (match_dup 3))
2708 (use (const_int 1))]))
2709 (cond_exec (ne (match_dup 5) (const_int 0))
2711 (float_truncate:SF (match_dup 6))))
2714 operands[6] = gen_rtx_REG (XFmode, REGNO (operands[0]));
2715 operands[7] = gen_rtx_REG (XFmode, REGNO (operands[1]));
2716 operands[8] = gen_rtx_REG (XFmode, REGNO (operands[2]));
2717 operands[9] = gen_rtx_REG (DFmode, REGNO (operands[0]));
2718 operands[10] = CONST1_RTX (XFmode);
2720 [(set_attr "predicable" "no")])
2722 (define_insn_and_split "divsf3_internal_thr"
2723 [(set (match_operand:SF 0 "fr_register_operand" "=&f")
2724 (div:SF (match_operand:SF 1 "fr_register_operand" "f")
2725 (match_operand:SF 2 "fr_register_operand" "f")))
2726 (clobber (match_scratch:XF 3 "=&f"))
2727 (clobber (match_scratch:XF 4 "=f"))
2728 (clobber (match_scratch:BI 5 "=c"))]
2729 "TARGET_INLINE_FLOAT_DIV_THR"
2731 "&& reload_completed"
2732 [(parallel [(set (match_dup 6) (div:XF (const_int 1) (match_dup 8)))
2733 (set (match_dup 5) (unspec:BI [(match_dup 7) (match_dup 8)]
2734 UNSPEC_FR_RECIP_APPROX))
2735 (use (const_int 1))])
2736 (cond_exec (ne (match_dup 5) (const_int 0))
2737 (parallel [(set (match_dup 3)
2738 (minus:XF (match_dup 10)
2739 (mult:XF (match_dup 8) (match_dup 6))))
2740 (use (const_int 1))]))
2741 (cond_exec (ne (match_dup 5) (const_int 0))
2742 (parallel [(set (match_dup 3)
2743 (plus:XF (mult:XF (match_dup 3) (match_dup 3))
2745 (use (const_int 1))]))
2746 (cond_exec (ne (match_dup 5) (const_int 0))
2747 (parallel [(set (match_dup 6)
2748 (plus:XF (mult:XF (match_dup 3) (match_dup 6))
2750 (use (const_int 1))]))
2751 (cond_exec (ne (match_dup 5) (const_int 0))
2752 (parallel [(set (match_dup 9)
2754 (mult:XF (match_dup 7) (match_dup 6))))
2755 (use (const_int 1))]))
2756 (cond_exec (ne (match_dup 5) (const_int 0))
2757 (parallel [(set (match_dup 4)
2758 (minus:XF (match_dup 7)
2759 (mult:XF (match_dup 8) (match_dup 3))))
2760 (use (const_int 1))]))
2761 (cond_exec (ne (match_dup 5) (const_int 0))
2764 (plus:XF (mult:XF (match_dup 4) (match_dup 6))
2768 operands[6] = gen_rtx_REG (XFmode, REGNO (operands[0]));
2769 operands[7] = gen_rtx_REG (XFmode, REGNO (operands[1]));
2770 operands[8] = gen_rtx_REG (XFmode, REGNO (operands[2]));
2771 operands[9] = gen_rtx_REG (SFmode, REGNO (operands[3]));
2772 operands[10] = CONST1_RTX (XFmode);
2774 [(set_attr "predicable" "no")])
2776 ;; Inline square root.
2778 (define_insn "*sqrt_approx"
2779 [(set (match_operand:XF 0 "fr_register_operand" "=f")
2780 (div:XF (const_int 1)
2781 (sqrt:XF (match_operand:XF 2 "fr_register_operand" "f"))))
2782 (set (match_operand:BI 1 "register_operand" "=c")
2783 (unspec:BI [(match_dup 2)] UNSPEC_FR_SQRT_RECIP_APPROX))
2784 (use (match_operand:SI 3 "const_int_operand" "")) ]
2786 "frsqrta.s%3 %0, %1 = %2"
2787 [(set_attr "itanium_class" "fmisc")
2788 (set_attr "predicable" "no")])
2790 (define_insn "setf_exp_xf"
2791 [(set (match_operand:XF 0 "fr_register_operand" "=f")
2792 (unspec:XF [(match_operand:DI 1 "register_operand" "r")]
2796 [(set_attr "itanium_class" "frfr")])
2798 (define_expand "sqrtsf2"
2799 [(set (match_operand:SF 0 "fr_register_operand" "=&f")
2800 (sqrt:SF (match_operand:SF 1 "fr_register_operand" "f")))]
2801 "TARGET_INLINE_SQRT"
2804 if (TARGET_INLINE_SQRT_LAT)
2806 insn = gen_sqrtsf2_internal_lat (operands[0], operands[1]);
2811 insn = gen_sqrtsf2_internal_thr (operands[0], operands[1]);
2816 ;; Latency-optimized square root.
2817 ;; FIXME: Implement.
2819 ;; Throughput-optimized square root.
2821 (define_insn_and_split "sqrtsf2_internal_thr"
2822 [(set (match_operand:SF 0 "fr_register_operand" "=&f")
2823 (sqrt:SF (match_operand:SF 1 "fr_register_operand" "f")))
2824 ;; Register r2 in optimization guide.
2825 (clobber (match_scratch:DI 2 "=r"))
2826 ;; Register f8 in optimization guide
2827 (clobber (match_scratch:XF 3 "=&f"))
2828 ;; Register f9 in optimization guide
2829 (clobber (match_scratch:XF 4 "=&f"))
2830 ;; Register f10 in optimization guide
2831 (clobber (match_scratch:XF 5 "=&f"))
2832 ;; Register p6 in optimization guide.
2833 (clobber (match_scratch:BI 6 "=c"))]
2834 "TARGET_INLINE_SQRT_THR"
2836 "&& reload_completed"
2837 [ ;; exponent of +1/2 in r2
2838 (set (match_dup 2) (const_int 65534))
2841 (unspec:XF [(match_dup 2)] UNSPEC_SETF_EXP))
2843 ;; y0 = 1/sqrt(a) in f7
2844 (parallel [(set (match_dup 7)
2845 (div:XF (const_int 1)
2846 (sqrt:XF (match_dup 8))))
2848 (unspec:BI [(match_dup 8)]
2849 UNSPEC_FR_SQRT_RECIP_APPROX))
2850 (use (const_int 0))])
2852 ;; H0 = 1/2 * y0 in f9
2853 (cond_exec (ne (match_dup 6) (const_int 0))
2854 (parallel [(set (match_dup 4)
2855 (plus:XF (mult:XF (match_dup 3) (match_dup 7))
2857 (use (const_int 1))]))
2859 ;; S0 = a * y0 in f7
2860 (cond_exec (ne (match_dup 6) (const_int 0))
2861 (parallel [(set (match_dup 7)
2862 (plus:XF (mult:XF (match_dup 8) (match_dup 7))
2864 (use (const_int 1))]))
2866 ;; d = 1/2 - S0 * H0 in f10
2867 (cond_exec (ne (match_dup 6) (const_int 0))
2868 (parallel [(set (match_dup 5)
2869 (minus:XF (match_dup 3)
2870 (mult:XF (match_dup 7) (match_dup 4))))
2871 (use (const_int 1))]))
2873 ;; d' = d + 1/2 * d in f8
2874 (cond_exec (ne (match_dup 6) (const_int 0))
2875 (parallel [(set (match_dup 3)
2876 (plus:XF (mult:XF (match_dup 3) (match_dup 5))
2878 (use (const_int 1))]))
2880 ;; e = d + d * d' in f8
2881 (cond_exec (ne (match_dup 6) (const_int 0))
2882 (parallel [(set (match_dup 3)
2883 (plus:XF (mult:XF (match_dup 5) (match_dup 3))
2885 (use (const_int 1))]))
2887 ;; S1 = S0 + e * S0 in f7
2888 (cond_exec (ne (match_dup 6) (const_int 0))
2889 (parallel [(set (match_dup 0)
2891 (plus:XF (mult:XF (match_dup 3) (match_dup 7))
2893 (use (const_int 1))]))
2895 ;; H1 = H0 + e * H0 in f8
2896 (cond_exec (ne (match_dup 6) (const_int 0))
2897 (parallel [(set (match_dup 3)
2898 (plus:XF (mult:XF (match_dup 3) (match_dup 4))
2900 (use (const_int 1))]))
2902 ;; d1 = a - S1 * S1 in f9
2903 (cond_exec (ne (match_dup 6) (const_int 0))
2904 (parallel [(set (match_dup 4)
2905 (minus:XF (match_dup 8)
2906 (mult:XF (match_dup 7) (match_dup 7))))
2907 (use (const_int 1))]))
2909 ;; S = S1 + d1 * H1 in f7
2910 (cond_exec (ne (match_dup 6) (const_int 0))
2911 (parallel [(set (match_dup 0)
2913 (plus:XF (mult:XF (match_dup 4) (match_dup 3))
2915 (use (const_int 0))]))]
2917 /* Generate 82-bit versions of the input and output operands. */
2918 operands[7] = gen_rtx_REG (XFmode, REGNO (operands[0]));
2919 operands[8] = gen_rtx_REG (XFmode, REGNO (operands[1]));
2920 /* Generate required floating-point constants. */
2921 operands[9] = CONST0_RTX (XFmode);
2923 [(set_attr "predicable" "no")])
2925 ;; ::::::::::::::::::::
2927 ;; :: 64 bit floating point arithmetic
2929 ;; ::::::::::::::::::::
2931 (define_insn "adddf3"
2932 [(set (match_operand:DF 0 "fr_register_operand" "=f")
2933 (plus:DF (match_operand:DF 1 "fr_register_operand" "%f")
2934 (match_operand:DF 2 "fr_reg_or_fp01_operand" "fG")))]
2936 "fadd.d %0 = %1, %F2"
2937 [(set_attr "itanium_class" "fmac")])
2939 (define_insn "*adddf3_trunc"
2940 [(set (match_operand:SF 0 "fr_register_operand" "=f")
2942 (plus:DF (match_operand:DF 1 "fr_register_operand" "%f")
2943 (match_operand:DF 2 "fr_reg_or_fp01_operand" "fG"))))]
2945 "fadd.s %0 = %1, %F2"
2946 [(set_attr "itanium_class" "fmac")])
2948 (define_insn "subdf3"
2949 [(set (match_operand:DF 0 "fr_register_operand" "=f")
2950 (minus:DF (match_operand:DF 1 "fr_reg_or_fp01_operand" "fG")
2951 (match_operand:DF 2 "fr_reg_or_fp01_operand" "fG")))]
2953 "fsub.d %0 = %F1, %F2"
2954 [(set_attr "itanium_class" "fmac")])
2956 (define_insn "*subdf3_trunc"
2957 [(set (match_operand:SF 0 "fr_register_operand" "=f")
2959 (minus:DF (match_operand:DF 1 "fr_reg_or_fp01_operand" "fG")
2960 (match_operand:DF 2 "fr_reg_or_fp01_operand" "fG"))))]
2962 "fsub.s %0 = %F1, %F2"
2963 [(set_attr "itanium_class" "fmac")])
2965 (define_insn "muldf3"
2966 [(set (match_operand:DF 0 "fr_register_operand" "=f")
2967 (mult:DF (match_operand:DF 1 "fr_register_operand" "f")
2968 (match_operand:DF 2 "fr_register_operand" "f")))]
2970 "fmpy.d %0 = %1, %2"
2971 [(set_attr "itanium_class" "fmac")])
2973 (define_insn "*muldf3_trunc"
2974 [(set (match_operand:SF 0 "fr_register_operand" "=f")
2976 (mult:DF (match_operand:DF 1 "fr_register_operand" "f")
2977 (match_operand:DF 2 "fr_register_operand" "f"))))]
2979 "fmpy.s %0 = %1, %2"
2980 [(set_attr "itanium_class" "fmac")])
2982 (define_insn "absdf2"
2983 [(set (match_operand:DF 0 "fr_register_operand" "=f")
2984 (abs:DF (match_operand:DF 1 "fr_register_operand" "f")))]
2987 [(set_attr "itanium_class" "fmisc")])
2989 (define_insn "negdf2"
2990 [(set (match_operand:DF 0 "fr_register_operand" "=f")
2991 (neg:DF (match_operand:DF 1 "fr_register_operand" "f")))]
2994 [(set_attr "itanium_class" "fmisc")])
2996 (define_insn "*nabsdf2"
2997 [(set (match_operand:DF 0 "fr_register_operand" "=f")
2998 (neg:DF (abs:DF (match_operand:DF 1 "fr_register_operand" "f"))))]
3001 [(set_attr "itanium_class" "fmisc")])
3003 (define_insn "mindf3"
3004 [(set (match_operand:DF 0 "fr_register_operand" "=f")
3005 (smin:DF (match_operand:DF 1 "fr_register_operand" "f")
3006 (match_operand:DF 2 "fr_reg_or_fp01_operand" "fG")))]
3009 [(set_attr "itanium_class" "fmisc")])
3011 (define_insn "maxdf3"
3012 [(set (match_operand:DF 0 "fr_register_operand" "=f")
3013 (smax:DF (match_operand:DF 1 "fr_register_operand" "f")
3014 (match_operand:DF 2 "fr_reg_or_fp01_operand" "fG")))]
3017 [(set_attr "itanium_class" "fmisc")])
3019 (define_insn "*madddf4"
3020 [(set (match_operand:DF 0 "fr_register_operand" "=f")
3021 (plus:DF (mult:DF (match_operand:DF 1 "fr_register_operand" "f")
3022 (match_operand:DF 2 "fr_register_operand" "f"))
3023 (match_operand:DF 3 "fr_reg_or_fp01_operand" "fG")))]
3025 "fma.d %0 = %1, %2, %F3"
3026 [(set_attr "itanium_class" "fmac")])
3028 (define_insn "*madddf4_trunc"
3029 [(set (match_operand:SF 0 "fr_register_operand" "=f")
3031 (plus:DF (mult:DF (match_operand:DF 1 "fr_register_operand" "f")
3032 (match_operand:DF 2 "fr_register_operand" "f"))
3033 (match_operand:DF 3 "fr_reg_or_fp01_operand" "fG"))))]
3035 "fma.s %0 = %1, %2, %F3"
3036 [(set_attr "itanium_class" "fmac")])
3038 (define_insn "*msubdf4"
3039 [(set (match_operand:DF 0 "fr_register_operand" "=f")
3040 (minus:DF (mult:DF (match_operand:DF 1 "fr_register_operand" "f")
3041 (match_operand:DF 2 "fr_register_operand" "f"))
3042 (match_operand:DF 3 "fr_reg_or_fp01_operand" "fG")))]
3044 "fms.d %0 = %1, %2, %F3"
3045 [(set_attr "itanium_class" "fmac")])
3047 (define_insn "*msubdf4_trunc"
3048 [(set (match_operand:SF 0 "fr_register_operand" "=f")
3050 (minus:DF (mult:DF (match_operand:DF 1 "fr_register_operand" "f")
3051 (match_operand:DF 2 "fr_register_operand" "f"))
3052 (match_operand:DF 3 "fr_reg_or_fp01_operand" "fG"))))]
3054 "fms.s %0 = %1, %2, %F3"
3055 [(set_attr "itanium_class" "fmac")])
3057 (define_insn "*nmuldf3"
3058 [(set (match_operand:DF 0 "fr_register_operand" "=f")
3059 (neg:DF (mult:DF (match_operand:DF 1 "fr_register_operand" "f")
3060 (match_operand:DF 2 "fr_register_operand" "f"))))]
3062 "fnmpy.d %0 = %1, %2"
3063 [(set_attr "itanium_class" "fmac")])
3065 (define_insn "*nmuldf3_trunc"
3066 [(set (match_operand:SF 0 "fr_register_operand" "=f")
3068 (neg:DF (mult:DF (match_operand:DF 1 "fr_register_operand" "f")
3069 (match_operand:DF 2 "fr_register_operand" "f")))))]
3071 "fnmpy.s %0 = %1, %2"
3072 [(set_attr "itanium_class" "fmac")])
3074 (define_insn "*nmadddf4"
3075 [(set (match_operand:DF 0 "fr_register_operand" "=f")
3076 (minus:DF (match_operand:DF 3 "fr_reg_or_fp01_operand" "fG")
3077 (mult:DF (match_operand:DF 1 "fr_register_operand" "f")
3078 (match_operand:DF 2 "fr_register_operand" "f"))))]
3080 "fnma.d %0 = %1, %2, %F3"
3081 [(set_attr "itanium_class" "fmac")])
3083 (define_insn "*nmadddf4_alts"
3084 [(set (match_operand:DF 0 "fr_register_operand" "=f")
3085 (minus:DF (match_operand:DF 3 "fr_reg_or_fp01_operand" "fG")
3086 (mult:DF (match_operand:DF 1 "fr_register_operand" "f")
3087 (match_operand:DF 2 "fr_register_operand" "f"))))
3088 (use (match_operand:SI 4 "const_int_operand" ""))]
3090 "fnma.d.s%4 %0 = %1, %2, %F3"
3091 [(set_attr "itanium_class" "fmac")])
3093 (define_insn "*nmadddf4_truncsf"
3094 [(set (match_operand:SF 0 "fr_register_operand" "=f")
3096 (minus:DF (match_operand:DF 3 "fr_reg_or_fp01_operand" "fG")
3097 (mult:DF (match_operand:DF 1 "fr_register_operand" "f")
3098 (match_operand:DF 2 "fr_register_operand" "f")))))]
3100 "fnma.s %0 = %1, %2, %F3"
3101 [(set_attr "itanium_class" "fmac")])
3103 (define_insn "*nmadddf4_truncsf_alts"
3104 [(set (match_operand:SF 0 "fr_register_operand" "=f")
3106 (minus:DF (match_operand:DF 3 "fr_reg_or_fp01_operand" "fG")
3107 (mult:DF (match_operand:DF 1 "fr_register_operand" "f")
3108 (match_operand:DF 2 "fr_register_operand" "f")))))
3109 (use (match_operand:SI 4 "const_int_operand" ""))]
3111 "fnma.s.s%4 %0 = %1, %2, %F3"
3112 [(set_attr "itanium_class" "fmac")])
3114 (define_expand "divdf3"
3115 [(set (match_operand:DF 0 "fr_register_operand" "")
3116 (div:DF (match_operand:DF 1 "fr_register_operand" "")
3117 (match_operand:DF 2 "fr_register_operand" "")))]
3118 "TARGET_INLINE_FLOAT_DIV"
3121 if (TARGET_INLINE_FLOAT_DIV_LAT)
3122 insn = gen_divdf3_internal_lat (operands[0], operands[1], operands[2]);
3124 insn = gen_divdf3_internal_thr (operands[0], operands[1], operands[2]);
3129 (define_insn_and_split "divdf3_internal_lat"
3130 [(set (match_operand:DF 0 "fr_register_operand" "=&f")
3131 (div:DF (match_operand:DF 1 "fr_register_operand" "f")
3132 (match_operand:DF 2 "fr_register_operand" "f")))
3133 (clobber (match_scratch:XF 3 "=&f"))
3134 (clobber (match_scratch:XF 4 "=&f"))
3135 (clobber (match_scratch:XF 5 "=&f"))
3136 (clobber (match_scratch:BI 6 "=c"))]
3137 "TARGET_INLINE_FLOAT_DIV_LAT"
3139 "&& reload_completed"
3140 [(parallel [(set (match_dup 7) (div:XF (const_int 1) (match_dup 9)))
3141 (set (match_dup 6) (unspec:BI [(match_dup 8) (match_dup 9)]
3142 UNSPEC_FR_RECIP_APPROX))
3143 (use (const_int 1))])
3144 (cond_exec (ne (match_dup 6) (const_int 0))
3145 (parallel [(set (match_dup 3) (mult:XF (match_dup 8) (match_dup 7)))
3146 (use (const_int 1))]))
3147 (cond_exec (ne (match_dup 6) (const_int 0))
3148 (parallel [(set (match_dup 4)
3149 (minus:XF (match_dup 12)
3150 (mult:XF (match_dup 9) (match_dup 7))))
3151 (use (const_int 1))]))
3152 (cond_exec (ne (match_dup 6) (const_int 0))
3153 (parallel [(set (match_dup 3)
3154 (plus:XF (mult:XF (match_dup 4) (match_dup 3))
3156 (use (const_int 1))]))
3157 (cond_exec (ne (match_dup 6) (const_int 0))
3158 (parallel [(set (match_dup 5) (mult:XF (match_dup 4) (match_dup 4)))
3159 (use (const_int 1))]))
3160 (cond_exec (ne (match_dup 6) (const_int 0))
3161 (parallel [(set (match_dup 7)
3162 (plus:XF (mult:XF (match_dup 4) (match_dup 7))
3164 (use (const_int 1))]))
3165 (cond_exec (ne (match_dup 6) (const_int 0))
3166 (parallel [(set (match_dup 3)
3167 (plus:XF (mult:XF (match_dup 5) (match_dup 3))
3169 (use (const_int 1))]))
3170 (cond_exec (ne (match_dup 6) (const_int 0))
3171 (parallel [(set (match_dup 4) (mult:XF (match_dup 5) (match_dup 5)))
3172 (use (const_int 1))]))
3173 (cond_exec (ne (match_dup 6) (const_int 0))
3174 (parallel [(set (match_dup 7)
3175 (plus:XF (mult:XF (match_dup 5) (match_dup 7))
3177 (use (const_int 1))]))
3178 (cond_exec (ne (match_dup 6) (const_int 0))
3179 (parallel [(set (match_dup 10)
3181 (plus:XF (mult:XF (match_dup 4) (match_dup 3))
3183 (use (const_int 1))]))
3184 (cond_exec (ne (match_dup 6) (const_int 0))
3185 (parallel [(set (match_dup 7)
3186 (plus:XF (mult:XF (match_dup 4) (match_dup 7))
3188 (use (const_int 1))]))
3189 (cond_exec (ne (match_dup 6) (const_int 0))
3190 (parallel [(set (match_dup 11)
3192 (minus:XF (match_dup 8)
3193 (mult:XF (match_dup 9) (match_dup 3)))))
3194 (use (const_int 1))]))
3195 (cond_exec (ne (match_dup 6) (const_int 0))
3197 (float_truncate:DF (plus:XF (mult:XF (match_dup 5) (match_dup 7))
3201 operands[7] = gen_rtx_REG (XFmode, REGNO (operands[0]));
3202 operands[8] = gen_rtx_REG (XFmode, REGNO (operands[1]));
3203 operands[9] = gen_rtx_REG (XFmode, REGNO (operands[2]));
3204 operands[10] = gen_rtx_REG (DFmode, REGNO (operands[3]));
3205 operands[11] = gen_rtx_REG (DFmode, REGNO (operands[5]));
3206 operands[12] = CONST1_RTX (XFmode);
3208 [(set_attr "predicable" "no")])
3210 (define_insn_and_split "divdf3_internal_thr"
3211 [(set (match_operand:DF 0 "fr_register_operand" "=&f")
3212 (div:DF (match_operand:DF 1 "fr_register_operand" "f")
3213 (match_operand:DF 2 "fr_register_operand" "f")))
3214 (clobber (match_scratch:XF 3 "=&f"))
3215 (clobber (match_scratch:DF 4 "=f"))
3216 (clobber (match_scratch:BI 5 "=c"))]
3217 "TARGET_INLINE_FLOAT_DIV_THR"
3219 "&& reload_completed"
3220 [(parallel [(set (match_dup 6) (div:XF (const_int 1) (match_dup 8)))
3221 (set (match_dup 5) (unspec:BI [(match_dup 7) (match_dup 8)]
3222 UNSPEC_FR_RECIP_APPROX))
3223 (use (const_int 1))])
3224 (cond_exec (ne (match_dup 5) (const_int 0))
3225 (parallel [(set (match_dup 3)
3226 (minus:XF (match_dup 10)
3227 (mult:XF (match_dup 8) (match_dup 6))))
3228 (use (const_int 1))]))
3229 (cond_exec (ne (match_dup 5) (const_int 0))
3230 (parallel [(set (match_dup 6)
3231 (plus:XF (mult:XF (match_dup 3) (match_dup 6))
3233 (use (const_int 1))]))
3234 (cond_exec (ne (match_dup 5) (const_int 0))
3235 (parallel [(set (match_dup 3)
3236 (mult:XF (match_dup 3) (match_dup 3)))
3237 (use (const_int 1))]))
3238 (cond_exec (ne (match_dup 5) (const_int 0))
3239 (parallel [(set (match_dup 6)
3240 (plus:XF (mult:XF (match_dup 3) (match_dup 6))
3242 (use (const_int 1))]))
3243 (cond_exec (ne (match_dup 5) (const_int 0))
3244 (parallel [(set (match_dup 3)
3245 (mult:XF (match_dup 3) (match_dup 3)))
3246 (use (const_int 1))]))
3247 (cond_exec (ne (match_dup 5) (const_int 0))
3248 (parallel [(set (match_dup 6)
3249 (plus:XF (mult:XF (match_dup 3) (match_dup 6))
3251 (use (const_int 1))]))
3252 (cond_exec (ne (match_dup 5) (const_int 0))
3253 (parallel [(set (match_dup 9)
3255 (mult:XF (match_dup 7) (match_dup 6))))
3256 (use (const_int 1))]))
3257 (cond_exec (ne (match_dup 5) (const_int 0))
3258 (parallel [(set (match_dup 4)
3259 (minus:DF (match_dup 1)
3260 (mult:DF (match_dup 2) (match_dup 9))))
3261 (use (const_int 1))]))
3262 (cond_exec (ne (match_dup 5) (const_int 0))
3264 (plus:DF (mult:DF (match_dup 4) (match_dup 0))
3268 operands[6] = gen_rtx_REG (XFmode, REGNO (operands[0]));
3269 operands[7] = gen_rtx_REG (XFmode, REGNO (operands[1]));
3270 operands[8] = gen_rtx_REG (XFmode, REGNO (operands[2]));
3271 operands[9] = gen_rtx_REG (DFmode, REGNO (operands[3]));
3272 operands[10] = CONST1_RTX (XFmode);
3274 [(set_attr "predicable" "no")])
3276 ;; Inline square root.
3278 (define_expand "sqrtdf2"
3279 [(set (match_operand:DF 0 "fr_register_operand" "=&f")
3280 (sqrt:DF (match_operand:DF 1 "fr_register_operand" "f")))]
3281 "TARGET_INLINE_SQRT"
3284 if (TARGET_INLINE_SQRT_LAT)
3286 insn = gen_sqrtdf2_internal_lat (operands[0], operands[1]);
3291 insn = gen_sqrtdf2_internal_thr (operands[0], operands[1]);
3296 ;; Latency-optimized square root.
3297 ;; FIXME: Implement.
3299 ;; Throughput-optimized square root.
3301 (define_insn_and_split "sqrtdf2_internal_thr"
3302 [(set (match_operand:DF 0 "fr_register_operand" "=&f")
3303 (sqrt:DF (match_operand:DF 1 "fr_register_operand" "f")))
3304 ;; Register r2 in optimization guide.
3305 (clobber (match_scratch:DI 2 "=r"))
3306 ;; Register f8 in optimization guide
3307 (clobber (match_scratch:XF 3 "=&f"))
3308 ;; Register f9 in optimization guide
3309 (clobber (match_scratch:XF 4 "=&f"))
3310 ;; Register f10 in optimization guide
3311 (clobber (match_scratch:XF 5 "=&f"))
3312 ;; Register p6 in optimization guide.
3313 (clobber (match_scratch:BI 6 "=c"))]
3314 "TARGET_INLINE_SQRT_THR"
3316 "&& reload_completed"
3317 [ ;; exponent of +1/2 in r2
3318 (set (match_dup 2) (const_int 65534))
3321 (unspec:XF [(match_dup 2)] UNSPEC_SETF_EXP))
3323 ;; y0 = 1/sqrt(a) in f7
3324 (parallel [(set (match_dup 7)
3325 (div:XF (const_int 1)
3326 (sqrt:XF (match_dup 8))))
3328 (unspec:BI [(match_dup 8)]
3329 UNSPEC_FR_SQRT_RECIP_APPROX))
3330 (use (const_int 0))])
3332 ;; H0 = 1/2 * y0 in f8
3333 (cond_exec (ne (match_dup 6) (const_int 0))
3334 (parallel [(set (match_dup 3)
3335 (plus:XF (mult:XF (match_dup 5) (match_dup 7))
3337 (use (const_int 1))]))
3339 ;; G0 = a * y0 in f7
3340 (cond_exec (ne (match_dup 6) (const_int 0))
3341 (parallel [(set (match_dup 7)
3342 (plus:XF (mult:XF (match_dup 8) (match_dup 7))
3344 (use (const_int 1))]))
3346 ;; r0 = 1/2 - G0 * H0 in f9
3347 (cond_exec (ne (match_dup 6) (const_int 0))
3348 (parallel [(set (match_dup 4)
3349 (minus:XF (match_dup 5)
3350 (mult:XF (match_dup 7) (match_dup 3))))
3351 (use (const_int 1))]))
3353 ;; H1 = H0 + r0 * H0 in f8
3354 (cond_exec (ne (match_dup 6) (const_int 0))
3355 (parallel [(set (match_dup 3)
3356 (plus:XF (mult:XF (match_dup 4) (match_dup 3))
3358 (use (const_int 1))]))
3360 ;; G1 = G0 + r0 * G0 in f7
3361 (cond_exec (ne (match_dup 6) (const_int 0))
3362 (parallel [(set (match_dup 7)
3363 (plus:XF (mult:XF (match_dup 4) (match_dup 7))
3365 (use (const_int 1))]))
3367 ;; r1 = 1/2 - G1 * H1 in f9
3368 (cond_exec (ne (match_dup 6) (const_int 0))
3369 (parallel [(set (match_dup 4)
3370 (minus:XF (match_dup 5)
3371 (mult:XF (match_dup 7) (match_dup 3))))
3372 (use (const_int 1))]))
3374 ;; H2 = H1 + r1 * H1 in f8
3375 (cond_exec (ne (match_dup 6) (const_int 0))
3376 (parallel [(set (match_dup 3)
3377 (plus:XF (mult:XF (match_dup 4) (match_dup 3))
3379 (use (const_int 1))]))
3381 ;; G2 = G1 + r1 * G1 in f7
3382 (cond_exec (ne (match_dup 6) (const_int 0))
3383 (parallel [(set (match_dup 7)
3384 (plus:XF (mult:XF (match_dup 4) (match_dup 7))
3386 (use (const_int 1))]))
3388 ;; d2 = a - G2 * G2 in f9
3389 (cond_exec (ne (match_dup 6) (const_int 0))
3390 (parallel [(set (match_dup 4)
3391 (minus:XF (match_dup 8)
3392 (mult:XF (match_dup 7) (match_dup 7))))
3393 (use (const_int 1))]))
3395 ;; G3 = G2 + d2 * H2 in f7
3396 (cond_exec (ne (match_dup 6) (const_int 0))
3397 (parallel [(set (match_dup 7)
3398 (plus:XF (mult:XF (match_dup 4) (match_dup 3))
3400 (use (const_int 1))]))
3402 ;; d3 = a - G3 * G3 in f9
3403 (cond_exec (ne (match_dup 6) (const_int 0))
3404 (parallel [(set (match_dup 4)
3405 (minus:XF (match_dup 8)
3406 (mult:XF (match_dup 7) (match_dup 7))))
3407 (use (const_int 1))]))
3409 ;; S = G3 + d3 * H2 in f7
3410 (cond_exec (ne (match_dup 6) (const_int 0))
3411 (parallel [(set (match_dup 0)
3413 (plus:XF (mult:XF (match_dup 4) (match_dup 3))
3415 (use (const_int 0))]))]
3417 /* Generate 82-bit versions of the input and output operands. */
3418 operands[7] = gen_rtx_REG (XFmode, REGNO (operands[0]));
3419 operands[8] = gen_rtx_REG (XFmode, REGNO (operands[1]));
3420 /* Generate required floating-point constants. */
3421 operands[9] = CONST0_RTX (XFmode);
3423 [(set_attr "predicable" "no")])
3425 ;; ::::::::::::::::::::
3427 ;; :: 80 bit floating point arithmetic
3429 ;; ::::::::::::::::::::
3431 (define_insn "addxf3"
3432 [(set (match_operand:XF 0 "fr_register_operand" "=f")
3433 (plus:XF (match_operand:XF 1 "xfreg_or_fp01_operand" "fG")
3434 (match_operand:XF 2 "xfreg_or_fp01_operand" "fG")))]
3436 "fadd %0 = %F1, %F2"
3437 [(set_attr "itanium_class" "fmac")])
3439 (define_insn "*addxf3_truncsf"
3440 [(set (match_operand:SF 0 "fr_register_operand" "=f")
3442 (plus:XF (match_operand:XF 1 "xfreg_or_fp01_operand" "fG")
3443 (match_operand:XF 2 "xfreg_or_fp01_operand" "fG"))))]
3445 "fadd.s %0 = %F1, %F2"
3446 [(set_attr "itanium_class" "fmac")])
3448 (define_insn "*addxf3_truncdf"
3449 [(set (match_operand:DF 0 "fr_register_operand" "=f")
3451 (plus:XF (match_operand:XF 1 "xfreg_or_fp01_operand" "fG")
3452 (match_operand:XF 2 "xfreg_or_fp01_operand" "fG"))))]
3454 "fadd.d %0 = %F1, %F2"
3455 [(set_attr "itanium_class" "fmac")])
3457 (define_insn "subxf3"
3458 [(set (match_operand:XF 0 "fr_register_operand" "=f")
3459 (minus:XF (match_operand:XF 1 "xfreg_or_fp01_operand" "fG")
3460 (match_operand:XF 2 "xfreg_or_fp01_operand" "fG")))]
3462 "fsub %0 = %F1, %F2"
3463 [(set_attr "itanium_class" "fmac")])
3465 (define_insn "*subxf3_truncsf"
3466 [(set (match_operand:SF 0 "fr_register_operand" "=f")
3468 (minus:XF (match_operand:XF 1 "xfreg_or_fp01_operand" "fG")
3469 (match_operand:XF 2 "xfreg_or_fp01_operand" "fG"))))]
3471 "fsub.s %0 = %F1, %F2"
3472 [(set_attr "itanium_class" "fmac")])
3474 (define_insn "*subxf3_truncdf"
3475 [(set (match_operand:DF 0 "fr_register_operand" "=f")
3477 (minus:XF (match_operand:XF 1 "xfreg_or_fp01_operand" "fG")
3478 (match_operand:XF 2 "xfreg_or_fp01_operand" "fG"))))]
3480 "fsub.d %0 = %F1, %F2"
3481 [(set_attr "itanium_class" "fmac")])
3483 (define_insn "mulxf3"
3484 [(set (match_operand:XF 0 "fr_register_operand" "=f")
3485 (mult:XF (match_operand:XF 1 "xfreg_or_fp01_operand" "fG")
3486 (match_operand:XF 2 "xfreg_or_fp01_operand" "fG")))]
3488 "fmpy %0 = %F1, %F2"
3489 [(set_attr "itanium_class" "fmac")])
3491 (define_insn "*mulxf3_truncsf"
3492 [(set (match_operand:SF 0 "fr_register_operand" "=f")
3494 (mult:XF (match_operand:XF 1 "xfreg_or_fp01_operand" "fG")
3495 (match_operand:XF 2 "xfreg_or_fp01_operand" "fG"))))]
3497 "fmpy.s %0 = %F1, %F2"
3498 [(set_attr "itanium_class" "fmac")])
3500 (define_insn "*mulxf3_truncdf"
3501 [(set (match_operand:DF 0 "fr_register_operand" "=f")
3503 (mult:XF (match_operand:XF 1 "xfreg_or_fp01_operand" "fG")
3504 (match_operand:XF 2 "xfreg_or_fp01_operand" "fG"))))]
3506 "fmpy.d %0 = %F1, %F2"
3507 [(set_attr "itanium_class" "fmac")])
3509 (define_insn "*mulxf3_alts"
3510 [(set (match_operand:XF 0 "fr_register_operand" "=f")
3511 (mult:XF (match_operand:XF 1 "xfreg_or_fp01_operand" "fG")
3512 (match_operand:XF 2 "xfreg_or_fp01_operand" "fG")))
3513 (use (match_operand:SI 3 "const_int_operand" ""))]
3515 "fmpy.s%3 %0 = %F1, %F2"
3516 [(set_attr "itanium_class" "fmac")])
3518 (define_insn "*mulxf3_truncsf_alts"
3519 [(set (match_operand:SF 0 "fr_register_operand" "=f")
3521 (mult:XF (match_operand:XF 1 "xfreg_or_fp01_operand" "fG")
3522 (match_operand:XF 2 "xfreg_or_fp01_operand" "fG"))))
3523 (use (match_operand:SI 3 "const_int_operand" ""))]
3525 "fmpy.s.s%3 %0 = %F1, %F2"
3526 [(set_attr "itanium_class" "fmac")])
3528 (define_insn "*mulxf3_truncdf_alts"
3529 [(set (match_operand:DF 0 "fr_register_operand" "=f")
3531 (mult:XF (match_operand:XF 1 "xfreg_or_fp01_operand" "fG")
3532 (match_operand:XF 2 "xfreg_or_fp01_operand" "fG"))))
3533 (use (match_operand:SI 3 "const_int_operand" ""))]
3535 "fmpy.d.s%3 %0 = %F1, %F2"
3536 [(set_attr "itanium_class" "fmac")])
3538 (define_insn "absxf2"
3539 [(set (match_operand:XF 0 "fr_register_operand" "=f")
3540 (abs:XF (match_operand:XF 1 "xfreg_or_fp01_operand" "fG")))]
3543 [(set_attr "itanium_class" "fmisc")])
3545 (define_insn "negxf2"
3546 [(set (match_operand:XF 0 "fr_register_operand" "=f")
3547 (neg:XF (match_operand:XF 1 "xfreg_or_fp01_operand" "fG")))]
3550 [(set_attr "itanium_class" "fmisc")])
3552 (define_insn "*nabsxf2"
3553 [(set (match_operand:XF 0 "fr_register_operand" "=f")
3554 (neg:XF (abs:XF (match_operand:XF 1 "xfreg_or_fp01_operand" "fG"))))]
3557 [(set_attr "itanium_class" "fmisc")])
3559 (define_insn "minxf3"
3560 [(set (match_operand:XF 0 "fr_register_operand" "=f")
3561 (smin:XF (match_operand:XF 1 "xfreg_or_fp01_operand" "fG")
3562 (match_operand:XF 2 "xfreg_or_fp01_operand" "fG")))]
3564 "fmin %0 = %F1, %F2"
3565 [(set_attr "itanium_class" "fmisc")])
3567 (define_insn "maxxf3"
3568 [(set (match_operand:XF 0 "fr_register_operand" "=f")
3569 (smax:XF (match_operand:XF 1 "xfreg_or_fp01_operand" "fG")
3570 (match_operand:XF 2 "xfreg_or_fp01_operand" "fG")))]
3572 "fmax %0 = %F1, %F2"
3573 [(set_attr "itanium_class" "fmisc")])
3575 (define_insn "*maddxf4"
3576 [(set (match_operand:XF 0 "fr_register_operand" "=f")
3577 (plus:XF (mult:XF (match_operand:XF 1 "xfreg_or_fp01_operand" "fG")
3578 (match_operand:XF 2 "xfreg_or_fp01_operand" "fG"))
3579 (match_operand:XF 3 "xfreg_or_fp01_operand" "fG")))]
3581 "fma %0 = %F1, %F2, %F3"
3582 [(set_attr "itanium_class" "fmac")])
3584 (define_insn "*maddxf4_truncsf"
3585 [(set (match_operand:SF 0 "fr_register_operand" "=f")
3587 (plus:XF (mult:XF (match_operand:XF 1 "xfreg_or_fp01_operand" "fG")
3588 (match_operand:XF 2 "xfreg_or_fp01_operand" "fG"))
3589 (match_operand:XF 3 "xfreg_or_fp01_operand" "fG"))))]
3591 "fma.s %0 = %F1, %F2, %F3"
3592 [(set_attr "itanium_class" "fmac")])
3594 (define_insn "*maddxf4_truncdf"
3595 [(set (match_operand:DF 0 "fr_register_operand" "=f")
3597 (plus:XF (mult:XF (match_operand:XF 1 "xfreg_or_fp01_operand" "fG")
3598 (match_operand:XF 2 "xfreg_or_fp01_operand" "fG"))
3599 (match_operand:XF 3 "xfreg_or_fp01_operand" "fG"))))]
3601 "fma.d %0 = %F1, %F2, %F3"
3602 [(set_attr "itanium_class" "fmac")])
3604 (define_insn "*maddxf4_alts"
3605 [(set (match_operand:XF 0 "fr_register_operand" "=f")
3606 (plus:XF (mult:XF (match_operand:XF 1 "xfreg_or_fp01_operand" "fG")
3607 (match_operand:XF 2 "xfreg_or_fp01_operand" "fG"))
3608 (match_operand:XF 3 "xfreg_or_fp01_operand" "fG")))
3609 (use (match_operand:SI 4 "const_int_operand" ""))]
3611 "fma.s%4 %0 = %F1, %F2, %F3"
3612 [(set_attr "itanium_class" "fmac")])
3614 (define_insn "*maddxf4_alts_truncsf"
3615 [(set (match_operand:SF 0 "fr_register_operand" "=f")
3617 (plus:XF (mult:XF (match_operand:XF 1 "xfreg_or_fp01_operand" "fG")
3618 (match_operand:XF 2 "xfreg_or_fp01_operand" "fG"))
3619 (match_operand:XF 3 "xfreg_or_fp01_operand" "fG"))))
3620 (use (match_operand:SI 4 "const_int_operand" ""))]
3622 "fma.s.s%4 %0 = %F1, %F2, %F3"
3623 [(set_attr "itanium_class" "fmac")])
3625 (define_insn "*maddxf4_alts_truncdf"
3626 [(set (match_operand:DF 0 "fr_register_operand" "=f")
3628 (plus:XF (mult:XF (match_operand:XF 1 "xfreg_or_fp01_operand" "fG")
3629 (match_operand:XF 2 "xfreg_or_fp01_operand" "fG"))
3630 (match_operand:XF 3 "xfreg_or_fp01_operand" "fG"))))
3631 (use (match_operand:SI 4 "const_int_operand" ""))]
3633 "fma.d.s%4 %0 = %F1, %F2, %F3"
3634 [(set_attr "itanium_class" "fmac")])
3636 (define_insn "*msubxf4"
3637 [(set (match_operand:XF 0 "fr_register_operand" "=f")
3638 (minus:XF (mult:XF (match_operand:XF 1 "xfreg_or_fp01_operand" "fG")
3639 (match_operand:XF 2 "xfreg_or_fp01_operand" "fG"))
3640 (match_operand:XF 3 "xfreg_or_fp01_operand" "fG")))]
3642 "fms %0 = %F1, %F2, %F3"
3643 [(set_attr "itanium_class" "fmac")])
3645 (define_insn "*msubxf4_truncsf"
3646 [(set (match_operand:SF 0 "fr_register_operand" "=f")
3648 (minus:XF (mult:XF (match_operand:XF 1 "xfreg_or_fp01_operand" "fG")
3649 (match_operand:XF 2 "xfreg_or_fp01_operand" "fG"))
3650 (match_operand:XF 3 "xfreg_or_fp01_operand" "fG"))))]
3652 "fms.s %0 = %F1, %F2, %F3"
3653 [(set_attr "itanium_class" "fmac")])
3655 (define_insn "*msubxf4_truncdf"
3656 [(set (match_operand:DF 0 "fr_register_operand" "=f")
3658 (minus:XF (mult:XF (match_operand:XF 1 "xfreg_or_fp01_operand" "fG")
3659 (match_operand:XF 2 "xfreg_or_fp01_operand" "fG"))
3660 (match_operand:XF 3 "xfreg_or_fp01_operand" "fG"))))]
3662 "fms.d %0 = %F1, %F2, %F3"
3663 [(set_attr "itanium_class" "fmac")])
3665 (define_insn "*nmulxf3"
3666 [(set (match_operand:XF 0 "fr_register_operand" "=f")
3667 (neg:XF (mult:XF (match_operand:XF 1 "xfreg_or_fp01_operand" "fG")
3668 (match_operand:XF 2 "xfreg_or_fp01_operand" "fG"))))]
3670 "fnmpy %0 = %F1, %F2"
3671 [(set_attr "itanium_class" "fmac")])
3673 (define_insn "*nmulxf3_truncsf"
3674 [(set (match_operand:SF 0 "fr_register_operand" "=f")
3677 (match_operand:XF 1 "xfreg_or_fp01_operand" "fG")
3678 (match_operand:XF 2 "xfreg_or_fp01_operand" "fG")))))]
3680 "fnmpy.s %0 = %F1, %F2"
3681 [(set_attr "itanium_class" "fmac")])
3683 (define_insn "*nmulxf3_truncdf"
3684 [(set (match_operand:DF 0 "fr_register_operand" "=f")
3687 (match_operand:XF 1 "xfreg_or_fp01_operand" "fG")
3688 (match_operand:XF 2 "xfreg_or_fp01_operand" "fG")))))]
3690 "fnmpy.d %0 = %F1, %F2"
3691 [(set_attr "itanium_class" "fmac")])
3693 (define_insn "*nmaddxf4"
3694 [(set (match_operand:XF 0 "fr_register_operand" "=f")
3695 (minus:XF (match_operand:XF 3 "xfreg_or_fp01_operand" "fG")
3696 (mult:XF (match_operand:XF 1 "xfreg_or_fp01_operand" "fG")
3697 (match_operand:XF 2 "xfreg_or_fp01_operand" "fG")
3700 "fnma %0 = %F1, %F2, %F3"
3701 [(set_attr "itanium_class" "fmac")])
3703 (define_insn "*nmaddxf4_truncsf"
3704 [(set (match_operand:SF 0 "fr_register_operand" "=f")
3706 (minus:XF (match_operand:XF 3 "xfreg_or_fp01_operand" "fG")
3707 (mult:XF (match_operand:XF 1 "xfreg_or_fp01_operand" "fG")
3708 (match_operand:XF 2 "xfreg_or_fp01_operand" "fG")
3711 "fnma.s %0 = %F1, %F2, %F3"
3712 [(set_attr "itanium_class" "fmac")])
3714 (define_insn "*nmaddxf4_truncdf"
3715 [(set (match_operand:DF 0 "fr_register_operand" "=f")
3717 (minus:XF (match_operand:XF 3 "xfreg_or_fp01_operand" "fG")
3718 (mult:XF (match_operand:XF 1 "xfreg_or_fp01_operand" "fG")
3719 (match_operand:XF 2 "xfreg_or_fp01_operand" "fG")
3722 "fnma.d %0 = %F1, %F2, %F3"
3723 [(set_attr "itanium_class" "fmac")])
3725 (define_insn "*nmaddxf4_alts"
3726 [(set (match_operand:XF 0 "fr_register_operand" "=f")
3727 (minus:XF (match_operand:XF 3 "xfreg_or_fp01_operand" "fG")
3728 (mult:XF (match_operand:XF 1 "xfreg_or_fp01_operand" "fG")
3729 (match_operand:XF 2 "xfreg_or_fp01_operand" "fG")
3731 (use (match_operand:SI 4 "const_int_operand" ""))]
3733 "fnma.s%4 %0 = %F1, %F2, %F3"
3734 [(set_attr "itanium_class" "fmac")])
3736 (define_insn "*nmaddxf4_truncsf_alts"
3737 [(set (match_operand:SF 0 "fr_register_operand" "=f")
3739 (minus:XF (match_operand:XF 3 "xfreg_or_fp01_operand" "fG")
3740 (mult:XF (match_operand:XF 1 "xfreg_or_fp01_operand" "fG")
3741 (match_operand:XF 2 "xfreg_or_fp01_operand" "fG")
3743 (use (match_operand:SI 4 "const_int_operand" ""))]
3745 "fnma.s.s%4 %0 = %F1, %F2, %F3"
3746 [(set_attr "itanium_class" "fmac")])
3748 (define_insn "*nmaddxf4_truncdf_alts"
3749 [(set (match_operand:DF 0 "fr_register_operand" "=f")
3751 (minus:XF (match_operand:XF 3 "xfreg_or_fp01_operand" "fG")
3752 (mult:XF (match_operand:XF 1 "xfreg_or_fp01_operand" "fG")
3753 (match_operand:XF 2 "xfreg_or_fp01_operand" "fG")
3755 (use (match_operand:SI 4 "const_int_operand" ""))]
3757 "fnma.d.s%4 %0 = %F1, %F2, %F3"
3758 [(set_attr "itanium_class" "fmac")])
3760 (define_expand "divxf3"
3761 [(set (match_operand:XF 0 "fr_register_operand" "")
3762 (div:XF (match_operand:XF 1 "fr_register_operand" "")
3763 (match_operand:XF 2 "fr_register_operand" "")))]
3764 "TARGET_INLINE_FLOAT_DIV"
3767 if (TARGET_INLINE_FLOAT_DIV_LAT)
3768 insn = gen_divxf3_internal_lat (operands[0], operands[1], operands[2]);
3770 insn = gen_divxf3_internal_thr (operands[0], operands[1], operands[2]);
3775 (define_insn_and_split "divxf3_internal_lat"
3776 [(set (match_operand:XF 0 "fr_register_operand" "=&f")
3777 (div:XF (match_operand:XF 1 "fr_register_operand" "f")
3778 (match_operand:XF 2 "fr_register_operand" "f")))
3779 (clobber (match_scratch:XF 3 "=&f"))
3780 (clobber (match_scratch:XF 4 "=&f"))
3781 (clobber (match_scratch:XF 5 "=&f"))
3782 (clobber (match_scratch:XF 6 "=&f"))
3783 (clobber (match_scratch:BI 7 "=c"))]
3784 "TARGET_INLINE_FLOAT_DIV_LAT"
3786 "&& reload_completed"
3787 [(parallel [(set (match_dup 0) (div:XF (const_int 1) (match_dup 2)))
3788 (set (match_dup 7) (unspec:BI [(match_dup 1) (match_dup 2)]
3789 UNSPEC_FR_RECIP_APPROX))
3790 (use (const_int 1))])
3791 (cond_exec (ne (match_dup 7) (const_int 0))
3792 (parallel [(set (match_dup 3)
3793 (minus:XF (match_dup 8)
3794 (mult:XF (match_dup 2) (match_dup 0))))
3795 (use (const_int 1))]))
3796 (cond_exec (ne (match_dup 7) (const_int 0))
3797 (parallel [(set (match_dup 4) (mult:XF (match_dup 1) (match_dup 0)))
3798 (use (const_int 1))]))
3799 (cond_exec (ne (match_dup 7) (const_int 0))
3800 (parallel [(set (match_dup 5) (mult:XF (match_dup 3) (match_dup 3)))
3801 (use (const_int 1))]))
3802 (cond_exec (ne (match_dup 7) (const_int 0))
3803 (parallel [(set (match_dup 6)
3804 (plus:XF (mult:XF (match_dup 3) (match_dup 3))
3806 (use (const_int 1))]))
3807 (cond_exec (ne (match_dup 7) (const_int 0))
3808 (parallel [(set (match_dup 3)
3809 (plus:XF (mult:XF (match_dup 5) (match_dup 5))
3811 (use (const_int 1))]))
3812 (cond_exec (ne (match_dup 7) (const_int 0))
3813 (parallel [(set (match_dup 5)
3814 (plus:XF (mult:XF (match_dup 6) (match_dup 0))
3816 (use (const_int 1))]))
3817 (cond_exec (ne (match_dup 7) (const_int 0))
3818 (parallel [(set (match_dup 0)
3819 (plus:XF (mult:XF (match_dup 5) (match_dup 3))
3821 (use (const_int 1))]))
3822 (cond_exec (ne (match_dup 7) (const_int 0))
3823 (parallel [(set (match_dup 4)
3824 (minus:XF (match_dup 1)
3825 (mult:XF (match_dup 2) (match_dup 4))))
3826 (use (const_int 1))]))
3827 (cond_exec (ne (match_dup 7) (const_int 0))
3828 (parallel [(set (match_dup 3)
3829 (plus:XF (mult:XF (match_dup 3) (match_dup 0))
3831 (use (const_int 1))]))
3832 (cond_exec (ne (match_dup 7) (const_int 0))
3833 (parallel [(set (match_dup 5)
3834 (minus:XF (match_dup 8)
3835 (mult:XF (match_dup 2) (match_dup 0))))
3836 (use (const_int 1))]))
3837 (cond_exec (ne (match_dup 7) (const_int 0))
3838 (parallel [(set (match_dup 0)
3839 (plus:XF (mult:XF (match_dup 4) (match_dup 0))
3841 (use (const_int 1))]))
3842 (cond_exec (ne (match_dup 7) (const_int 0))
3843 (parallel [(set (match_dup 4)
3844 (minus:XF (match_dup 1)
3845 (mult:XF (match_dup 2) (match_dup 3))))
3846 (use (const_int 1))]))
3847 (cond_exec (ne (match_dup 7) (const_int 0))
3849 (plus:XF (mult:XF (match_dup 4) (match_dup 0))
3852 "operands[8] = CONST1_RTX (XFmode);"
3853 [(set_attr "predicable" "no")])
3855 (define_insn_and_split "divxf3_internal_thr"
3856 [(set (match_operand:XF 0 "fr_register_operand" "=&f")
3857 (div:XF (match_operand:XF 1 "fr_register_operand" "f")
3858 (match_operand:XF 2 "fr_register_operand" "f")))
3859 (clobber (match_scratch:XF 3 "=&f"))
3860 (clobber (match_scratch:XF 4 "=&f"))
3861 (clobber (match_scratch:BI 5 "=c"))]
3862 "TARGET_INLINE_FLOAT_DIV_THR"
3864 "&& reload_completed"
3865 [(parallel [(set (match_dup 0) (div:XF (const_int 1) (match_dup 2)))
3866 (set (match_dup 5) (unspec:BI [(match_dup 1) (match_dup 2)]
3867 UNSPEC_FR_RECIP_APPROX))
3868 (use (const_int 1))])
3869 (cond_exec (ne (match_dup 5) (const_int 0))
3870 (parallel [(set (match_dup 3)
3871 (minus:XF (match_dup 6)
3872 (mult:XF (match_dup 2) (match_dup 0))))
3873 (use (const_int 1))]))
3874 (cond_exec (ne (match_dup 5) (const_int 0))
3875 (parallel [(set (match_dup 4)
3876 (plus:XF (mult:XF (match_dup 3) (match_dup 0))
3878 (use (const_int 1))]))
3879 (cond_exec (ne (match_dup 5) (const_int 0))
3880 (parallel [(set (match_dup 3) (mult:XF (match_dup 3) (match_dup 3)))
3881 (use (const_int 1))]))
3882 (cond_exec (ne (match_dup 5) (const_int 0))
3883 (parallel [(set (match_dup 3)
3884 (plus:XF (mult:XF (match_dup 3) (match_dup 4))
3886 (use (const_int 1))]))
3887 (cond_exec (ne (match_dup 5) (const_int 0))
3888 (parallel [(set (match_dup 4) (mult:XF (match_dup 1) (match_dup 0)))
3889 (use (const_int 1))]))
3890 (cond_exec (ne (match_dup 5) (const_int 0))
3891 (parallel [(set (match_dup 0)
3892 (minus:XF (match_dup 6)
3893 (mult:XF (match_dup 2) (match_dup 3))))
3894 (use (const_int 1))]))
3895 (cond_exec (ne (match_dup 5) (const_int 0))
3896 (parallel [(set (match_dup 0)
3897 (plus:XF (mult:XF (match_dup 0) (match_dup 3))
3899 (use (const_int 1))]))
3900 (cond_exec (ne (match_dup 5) (const_int 0))
3901 (parallel [(set (match_dup 3)
3902 (minus:XF (match_dup 1)
3903 (mult:XF (match_dup 2) (match_dup 4))))
3904 (use (const_int 1))]))
3905 (cond_exec (ne (match_dup 5) (const_int 0))
3906 (parallel [(set (match_dup 3)
3907 (plus:XF (mult:XF (match_dup 3) (match_dup 0))
3909 (use (const_int 1))]))
3910 (cond_exec (ne (match_dup 5) (const_int 0))
3911 (parallel [(set (match_dup 4)
3912 (minus:XF (match_dup 6)
3913 (mult:XF (match_dup 2) (match_dup 0))))
3914 (use (const_int 1))]))
3915 (cond_exec (ne (match_dup 5) (const_int 0))
3916 (parallel [(set (match_dup 0)
3917 (plus:XF (mult:XF (match_dup 4) (match_dup 0))
3919 (use (const_int 1))]))
3920 (cond_exec (ne (match_dup 5) (const_int 0))
3921 (parallel [(set (match_dup 4)
3922 (minus:XF (match_dup 1)
3923 (mult:XF (match_dup 2) (match_dup 3))))
3924 (use (const_int 1))]))
3925 (cond_exec (ne (match_dup 5) (const_int 0))
3927 (plus:XF (mult:XF (match_dup 4) (match_dup 0))
3930 "operands[6] = CONST1_RTX (XFmode);"
3931 [(set_attr "predicable" "no")])
3933 ;; Inline square root.
3935 (define_expand "sqrtxf2"
3936 [(set (match_operand:XF 0 "fr_register_operand" "=&f")
3937 (sqrt:XF (match_operand:XF 1 "fr_register_operand" "f")))]
3938 "TARGET_INLINE_SQRT"
3941 if (TARGET_INLINE_SQRT_LAT)
3943 insn = gen_sqrtxf2_internal_lat (operands[0], operands[1]);
3948 insn = gen_sqrtxf2_internal_thr (operands[0], operands[1]);
3953 ;; Latency-optimized square root.
3954 ;; FIXME: Implement.
3956 ;; Throughput-optimized square root.
3958 (define_insn_and_split "sqrtxf2_internal_thr"
3959 [(set (match_operand:XF 0 "fr_register_operand" "=&f")
3960 (sqrt:XF (match_operand:XF 1 "fr_register_operand" "f")))
3961 ;; Register r2 in optimization guide.
3962 (clobber (match_scratch:DI 2 "=r"))
3963 ;; Register f8 in optimization guide
3964 (clobber (match_scratch:XF 3 "=&f"))
3965 ;; Register f9 in optimization guide
3966 (clobber (match_scratch:XF 4 "=&f"))
3967 ;; Register f10 in optimization guide
3968 (clobber (match_scratch:XF 5 "=&f"))
3969 ;; Register f11 in optimization guide
3970 (clobber (match_scratch:XF 6 "=&f"))
3971 ;; Register p6 in optimization guide.
3972 (clobber (match_scratch:BI 7 "=c"))]
3973 "TARGET_INLINE_SQRT_THR"
3975 "&& reload_completed"
3976 [ ;; exponent of +1/2 in r2
3977 (set (match_dup 2) (const_int 65534))
3978 ;; +1/2 in f8. The Intel manual mistakenly specifies f10.
3980 (unspec:XF [(match_dup 2)] UNSPEC_SETF_EXP))
3982 ;; y0 = 1/sqrt(a) in f7
3983 (parallel [(set (match_dup 8)
3984 (div:XF (const_int 1)
3985 (sqrt:XF (match_dup 9))))
3987 (unspec:BI [(match_dup 9)]
3988 UNSPEC_FR_SQRT_RECIP_APPROX))
3989 (use (const_int 0))])
3991 ;; H0 = 1/2 * y0 in f9
3992 (cond_exec (ne (match_dup 7) (const_int 0))
3993 (parallel [(set (match_dup 4)
3994 (plus:XF (mult:XF (match_dup 3) (match_dup 8))
3996 (use (const_int 1))]))
3998 ;; S0 = a * y0 in f7
3999 (cond_exec (ne (match_dup 7) (const_int 0))
4000 (parallel [(set (match_dup 8)
4001 (plus:XF (mult:XF (match_dup 9) (match_dup 8))
4003 (use (const_int 1))]))
4005 ;; d0 = 1/2 - S0 * H0 in f10
4006 (cond_exec (ne (match_dup 7) (const_int 0))
4007 (parallel [(set (match_dup 5)
4008 (minus:XF (match_dup 3)
4009 (mult:XF (match_dup 8) (match_dup 4))))
4010 (use (const_int 1))]))
4012 ;; H1 = H0 + d0 * H0 in f9
4013 (cond_exec (ne (match_dup 7) (const_int 0))
4014 (parallel [(set (match_dup 4)
4015 (plus:XF (mult:XF (match_dup 5) (match_dup 4))
4017 (use (const_int 1))]))
4019 ;; S1 = S0 + d0 * S0 in f7
4020 (cond_exec (ne (match_dup 7) (const_int 0))
4021 (parallel [(set (match_dup 8)
4022 (plus:XF (mult:XF (match_dup 5) (match_dup 8))
4024 (use (const_int 1))]))
4026 ;; d1 = 1/2 - S1 * H1 in f10
4027 (cond_exec (ne (match_dup 7) (const_int 0))
4028 (parallel [(set (match_dup 5)
4029 (minus:XF (match_dup 3)
4030 (mult:XF (match_dup 8) (match_dup 4))))
4031 (use (const_int 1))]))
4033 ;; H2 = H1 + d1 * H1 in f9
4034 (cond_exec (ne (match_dup 7) (const_int 0))
4035 (parallel [(set (match_dup 4)
4036 (plus:XF (mult:XF (match_dup 5) (match_dup 4))
4038 (use (const_int 1))]))
4040 ;; S2 = S1 + d1 * S1 in f7
4041 (cond_exec (ne (match_dup 7) (const_int 0))
4042 (parallel [(set (match_dup 8)
4043 (plus:XF (mult:XF (match_dup 5) (match_dup 8))
4045 (use (const_int 1))]))
4047 ;; d2 = 1/2 - S2 * H2 in f10
4048 (cond_exec (ne (match_dup 7) (const_int 0))
4049 (parallel [(set (match_dup 5)
4050 (minus:XF (match_dup 3)
4051 (mult:XF (match_dup 8) (match_dup 4))))
4052 (use (const_int 1))]))
4054 ;; e2 = a - S2 * S2 in f8
4055 (cond_exec (ne (match_dup 7) (const_int 0))
4056 (parallel [(set (match_dup 3)
4057 (minus:XF (match_dup 9)
4058 (mult:XF (match_dup 8) (match_dup 8))))
4059 (use (const_int 1))]))
4061 ;; S3 = S2 + e2 * H2 in f7
4062 (cond_exec (ne (match_dup 7) (const_int 0))
4063 (parallel [(set (match_dup 8)
4064 (plus:XF (mult:XF (match_dup 3) (match_dup 4))
4066 (use (const_int 1))]))
4068 ;; H3 = H2 + d2 * H2 in f9
4069 (cond_exec (ne (match_dup 7) (const_int 0))
4070 (parallel [(set (match_dup 4)
4071 (plus:XF (mult:XF (match_dup 5) (match_dup 4))
4073 (use (const_int 1))]))
4075 ;; e3 = a - S3 * S3 in f8
4076 (cond_exec (ne (match_dup 7) (const_int 0))
4077 (parallel [(set (match_dup 3)
4078 (minus:XF (match_dup 9)
4079 (mult:XF (match_dup 8) (match_dup 8))))
4080 (use (const_int 1))]))
4082 ;; S = S3 + e3 * H3 in f7
4083 (cond_exec (ne (match_dup 7) (const_int 0))
4084 (parallel [(set (match_dup 0)
4085 (plus:XF (mult:XF (match_dup 3) (match_dup 4))
4087 (use (const_int 0))]))]
4089 /* Generate 82-bit versions of the input and output operands. */
4090 operands[8] = gen_rtx_REG (XFmode, REGNO (operands[0]));
4091 operands[9] = gen_rtx_REG (XFmode, REGNO (operands[1]));
4092 /* Generate required floating-point constants. */
4093 operands[10] = CONST0_RTX (XFmode);
4095 [(set_attr "predicable" "no")])
4097 ;; ??? frcpa works like cmp.foo.unc.
4099 (define_insn "*recip_approx"
4100 [(set (match_operand:XF 0 "fr_register_operand" "=f")
4101 (div:XF (const_int 1)
4102 (match_operand:XF 3 "fr_register_operand" "f")))
4103 (set (match_operand:BI 1 "register_operand" "=c")
4104 (unspec:BI [(match_operand:XF 2 "fr_register_operand" "f")
4105 (match_dup 3)] UNSPEC_FR_RECIP_APPROX))
4106 (use (match_operand:SI 4 "const_int_operand" ""))]
4108 "frcpa.s%4 %0, %1 = %2, %3"
4109 [(set_attr "itanium_class" "fmisc")
4110 (set_attr "predicable" "no")])
4112 ;; ::::::::::::::::::::
4114 ;; :: 32 bit Integer Shifts and Rotates
4116 ;; ::::::::::::::::::::
4118 (define_expand "ashlsi3"
4119 [(set (match_operand:SI 0 "gr_register_operand" "")
4120 (ashift:SI (match_operand:SI 1 "gr_register_operand" "")
4121 (match_operand:SI 2 "gr_reg_or_5bit_operand" "")))]
4124 if (GET_CODE (operands[2]) != CONST_INT)
4126 /* Why oh why didn't Intel arrange for SHIFT_COUNT_TRUNCATED? Now
4127 we've got to get rid of stray bits outside the SImode register. */
4128 rtx subshift = gen_reg_rtx (DImode);
4129 emit_insn (gen_zero_extendsidi2 (subshift, operands[2]));
4130 operands[2] = subshift;
4134 (define_insn "*ashlsi3_internal"
4135 [(set (match_operand:SI 0 "gr_register_operand" "=r,r,r")
4136 (ashift:SI (match_operand:SI 1 "gr_register_operand" "r,r,r")
4137 (match_operand:DI 2 "gr_reg_or_5bit_operand" "R,n,r")))]
4140 shladd %0 = %1, %2, r0
4141 dep.z %0 = %1, %2, %E2
4143 [(set_attr "itanium_class" "ialu,ishf,mmshf")])
4145 (define_expand "ashrsi3"
4146 [(set (match_operand:SI 0 "gr_register_operand" "")
4147 (ashiftrt:SI (match_operand:SI 1 "gr_register_operand" "")
4148 (match_operand:SI 2 "gr_reg_or_5bit_operand" "")))]
4151 rtx subtarget = gen_reg_rtx (DImode);
4152 if (GET_CODE (operands[2]) == CONST_INT)
4153 emit_insn (gen_extv (subtarget, gen_lowpart (DImode, operands[1]),
4154 GEN_INT (32 - INTVAL (operands[2])), operands[2]));
4157 rtx subshift = gen_reg_rtx (DImode);
4158 emit_insn (gen_extendsidi2 (subtarget, operands[1]));
4159 emit_insn (gen_zero_extendsidi2 (subshift, operands[2]));
4160 emit_insn (gen_ashrdi3 (subtarget, subtarget, subshift));
4162 emit_move_insn (gen_lowpart (DImode, operands[0]), subtarget);
4166 (define_expand "lshrsi3"
4167 [(set (match_operand:SI 0 "gr_register_operand" "")
4168 (lshiftrt:SI (match_operand:SI 1 "gr_register_operand" "")
4169 (match_operand:SI 2 "gr_reg_or_5bit_operand" "")))]
4172 rtx subtarget = gen_reg_rtx (DImode);
4173 if (GET_CODE (operands[2]) == CONST_INT)
4174 emit_insn (gen_extzv (subtarget, gen_lowpart (DImode, operands[1]),
4175 GEN_INT (32 - INTVAL (operands[2])), operands[2]));
4178 rtx subshift = gen_reg_rtx (DImode);
4179 emit_insn (gen_zero_extendsidi2 (subtarget, operands[1]));
4180 emit_insn (gen_zero_extendsidi2 (subshift, operands[2]));
4181 emit_insn (gen_lshrdi3 (subtarget, subtarget, subshift));
4183 emit_move_insn (gen_lowpart (DImode, operands[0]), subtarget);
4187 ;; Use mix4.r/shr to implement rotrsi3. We only get 32 bits of valid result
4188 ;; here, instead of 64 like the patterns above. Keep the pattern together
4189 ;; until after combine; otherwise it won't get matched often.
4191 (define_expand "rotrsi3"
4192 [(set (match_operand:SI 0 "gr_register_operand" "")
4193 (rotatert:SI (match_operand:SI 1 "gr_register_operand" "")
4194 (match_operand:SI 2 "gr_reg_or_5bit_operand" "")))]
4197 if (GET_MODE (operands[2]) != VOIDmode)
4199 rtx tmp = gen_reg_rtx (DImode);
4200 emit_insn (gen_zero_extendsidi2 (tmp, operands[2]));
4205 (define_insn_and_split "*rotrsi3_internal"
4206 [(set (match_operand:SI 0 "gr_register_operand" "=&r")
4207 (rotatert:SI (match_operand:SI 1 "gr_register_operand" "r")
4208 (match_operand:DI 2 "gr_reg_or_5bit_operand" "rM")))]
4213 (ior:DI (zero_extend:DI (match_dup 1))
4214 (ashift:DI (zero_extend:DI (match_dup 1)) (const_int 32))))
4216 (lshiftrt:DI (match_dup 3) (match_dup 2)))]
4217 "operands[3] = gen_rtx_REG (DImode, REGNO (operands[0]));")
4219 (define_expand "rotlsi3"
4220 [(set (match_operand:SI 0 "gr_register_operand" "")
4221 (rotate:SI (match_operand:SI 1 "gr_register_operand" "")
4222 (match_operand:SI 2 "gr_reg_or_5bit_operand" "")))]
4225 if (! shift_32bit_count_operand (operands[2], SImode))
4227 rtx tmp = gen_reg_rtx (SImode);
4228 emit_insn (gen_subsi3 (tmp, GEN_INT (32), operands[2]));
4229 emit_insn (gen_rotrsi3 (operands[0], operands[1], tmp));
4234 (define_insn_and_split "*rotlsi3_internal"
4235 [(set (match_operand:SI 0 "gr_register_operand" "=r")
4236 (rotate:SI (match_operand:SI 1 "gr_register_operand" "r")
4237 (match_operand:SI 2 "shift_32bit_count_operand" "n")))]
4242 (ior:DI (zero_extend:DI (match_dup 1))
4243 (ashift:DI (zero_extend:DI (match_dup 1)) (const_int 32))))
4245 (lshiftrt:DI (match_dup 3) (match_dup 2)))]
4247 operands[3] = gen_rtx_REG (DImode, REGNO (operands[0]));
4248 operands[2] = GEN_INT (32 - INTVAL (operands[2]));
4251 ;; ::::::::::::::::::::
4253 ;; :: 64 bit Integer Shifts and Rotates
4255 ;; ::::::::::::::::::::
4257 (define_insn "ashldi3"
4258 [(set (match_operand:DI 0 "gr_register_operand" "=r,r,r")
4259 (ashift:DI (match_operand:DI 1 "gr_register_operand" "r,r,r")
4260 (match_operand:DI 2 "gr_reg_or_6bit_operand" "R,r,rM")))]
4263 shladd %0 = %1, %2, r0
4266 [(set_attr "itanium_class" "ialu,mmshf,mmshfi")])
4268 ;; ??? Maybe combine this with the multiply and add instruction?
4270 (define_insn "*shladd"
4271 [(set (match_operand:DI 0 "gr_register_operand" "=r")
4272 (plus:DI (mult:DI (match_operand:DI 1 "gr_register_operand" "r")
4273 (match_operand:DI 2 "shladd_operand" "n"))
4274 (match_operand:DI 3 "gr_register_operand" "r")))]
4276 "shladd %0 = %1, %S2, %3"
4277 [(set_attr "itanium_class" "ialu")])
4279 ;; This can be created by register elimination if operand3 of shladd is an
4280 ;; eliminable register or has reg_equiv_constant set.
4282 ;; We have to use nonmemory_operand for operand 4, to ensure that the
4283 ;; validate_changes call inside eliminate_regs will always succeed. If it
4284 ;; doesn't succeed, then this remain a shladd pattern, and will be reloaded
4287 (define_insn_and_split "*shladd_elim"
4288 [(set (match_operand:DI 0 "gr_register_operand" "=&r")
4289 (plus:DI (plus:DI (mult:DI (match_operand:DI 1 "gr_register_operand" "r")
4290 (match_operand:DI 2 "shladd_operand" "n"))
4291 (match_operand:DI 3 "nonmemory_operand" "r"))
4292 (match_operand:DI 4 "nonmemory_operand" "rI")))]
4293 "reload_in_progress"
4296 [(set (match_dup 0) (plus:DI (mult:DI (match_dup 1) (match_dup 2))
4298 (set (match_dup 0) (plus:DI (match_dup 0) (match_dup 4)))]
4300 [(set_attr "itanium_class" "unknown")])
4302 (define_insn "ashrdi3"
4303 [(set (match_operand:DI 0 "gr_register_operand" "=r,r")
4304 (ashiftrt:DI (match_operand:DI 1 "gr_register_operand" "r,r")
4305 (match_operand:DI 2 "gr_reg_or_6bit_operand" "r,rM")))]
4310 [(set_attr "itanium_class" "mmshf,mmshfi")])
4312 (define_insn "lshrdi3"
4313 [(set (match_operand:DI 0 "gr_register_operand" "=r,r")
4314 (lshiftrt:DI (match_operand:DI 1 "gr_register_operand" "r,r")
4315 (match_operand:DI 2 "gr_reg_or_6bit_operand" "r,rM")))]
4320 [(set_attr "itanium_class" "mmshf,mmshfi")])
4322 ;; Using a predicate that accepts only constants doesn't work, because optabs
4323 ;; will load the operand into a register and call the pattern if the predicate
4324 ;; did not accept it on the first try. So we use nonmemory_operand and then
4325 ;; verify that we have an appropriate constant in the expander.
4327 (define_expand "rotrdi3"
4328 [(set (match_operand:DI 0 "gr_register_operand" "")
4329 (rotatert:DI (match_operand:DI 1 "gr_register_operand" "")
4330 (match_operand:DI 2 "nonmemory_operand" "")))]
4333 if (! shift_count_operand (operands[2], DImode))
4337 (define_insn "*rotrdi3_internal"
4338 [(set (match_operand:DI 0 "gr_register_operand" "=r")
4339 (rotatert:DI (match_operand:DI 1 "gr_register_operand" "r")
4340 (match_operand:DI 2 "shift_count_operand" "M")))]
4342 "shrp %0 = %1, %1, %2"
4343 [(set_attr "itanium_class" "ishf")])
4345 (define_expand "rotldi3"
4346 [(set (match_operand:DI 0 "gr_register_operand" "")
4347 (rotate:DI (match_operand:DI 1 "gr_register_operand" "")
4348 (match_operand:DI 2 "nonmemory_operand" "")))]
4351 if (! shift_count_operand (operands[2], DImode))
4355 (define_insn "*rotldi3_internal"
4356 [(set (match_operand:DI 0 "gr_register_operand" "=r")
4357 (rotate:DI (match_operand:DI 1 "gr_register_operand" "r")
4358 (match_operand:DI 2 "shift_count_operand" "M")))]
4360 "shrp %0 = %1, %1, %e2"
4361 [(set_attr "itanium_class" "ishf")])
4363 ;; ::::::::::::::::::::
4365 ;; :: 128 bit Integer Shifts and Rotates
4367 ;; ::::::::::::::::::::
4369 (define_expand "ashlti3"
4370 [(set (match_operand:TI 0 "gr_register_operand" "")
4371 (ashift:TI (match_operand:TI 1 "gr_register_operand" "")
4372 (match_operand:DI 2 "nonmemory_operand" "")))]
4375 if (!dshift_count_operand (operands[2], DImode))
4379 (define_insn_and_split "*ashlti3_internal"
4380 [(set (match_operand:TI 0 "gr_register_operand" "=&r")
4381 (ashift:TI (match_operand:TI 1 "gr_register_operand" "r")
4382 (match_operand:DI 2 "dshift_count_operand" "n")))]
4388 HOST_WIDE_INT shift = INTVAL (operands[2]);
4389 rtx rl = gen_lowpart (DImode, operands[0]);
4390 rtx rh = gen_highpart (DImode, operands[0]);
4391 rtx lo = gen_lowpart (DImode, operands[1]);
4392 rtx shiftlo = GEN_INT (shift & 63);
4396 emit_move_insn (rl, const0_rtx);
4398 emit_insn (gen_ashldi3 (rh, lo, shiftlo));
4400 emit_move_insn (rh, lo);
4404 rtx hi = gen_highpart (DImode, operands[1]);
4406 emit_insn (gen_shrp (rh, hi, lo, GEN_INT (-shift & 63)));
4407 emit_insn (gen_ashldi3 (rl, lo, shiftlo));
4412 (define_expand "ashrti3"
4413 [(set (match_operand:TI 0 "gr_register_operand" "")
4414 (ashiftrt:TI (match_operand:TI 1 "gr_register_operand" "")
4415 (match_operand:DI 2 "nonmemory_operand" "")))]
4418 if (!dshift_count_operand (operands[2], DImode))
4422 (define_insn_and_split "*ashrti3_internal"
4423 [(set (match_operand:TI 0 "gr_register_operand" "=&r")
4424 (ashiftrt:TI (match_operand:TI 1 "gr_register_operand" "r")
4425 (match_operand:DI 2 "dshift_count_operand" "n")))]
4431 HOST_WIDE_INT shift = INTVAL (operands[2]);
4432 rtx rl = gen_lowpart (DImode, operands[0]);
4433 rtx rh = gen_highpart (DImode, operands[0]);
4434 rtx hi = gen_highpart (DImode, operands[1]);
4435 rtx shiftlo = GEN_INT (shift & 63);
4440 emit_insn (gen_ashrdi3 (rl, hi, shiftlo));
4442 emit_move_insn (rl, hi);
4443 emit_insn (gen_ashrdi3 (rh, hi, GEN_INT (63)));
4447 rtx lo = gen_lowpart (DImode, operands[1]);
4449 emit_insn (gen_shrp (rl, hi, lo, shiftlo));
4450 emit_insn (gen_ashrdi3 (rh, hi, shiftlo));
4455 (define_expand "lshrti3"
4456 [(set (match_operand:TI 0 "gr_register_operand" "")
4457 (lshiftrt:TI (match_operand:TI 1 "gr_register_operand" "")
4458 (match_operand:DI 2 "nonmemory_operand" "")))]
4461 if (!dshift_count_operand (operands[2], DImode))
4465 (define_insn_and_split "*lshrti3_internal"
4466 [(set (match_operand:TI 0 "gr_register_operand" "=&r")
4467 (lshiftrt:TI (match_operand:TI 1 "gr_register_operand" "r")
4468 (match_operand:DI 2 "dshift_count_operand" "n")))]
4474 HOST_WIDE_INT shift = INTVAL (operands[2]);
4475 rtx rl = gen_lowpart (DImode, operands[0]);
4476 rtx rh = gen_highpart (DImode, operands[0]);
4477 rtx hi = gen_highpart (DImode, operands[1]);
4478 rtx shiftlo = GEN_INT (shift & 63);
4483 emit_insn (gen_lshrdi3 (rl, hi, shiftlo));
4485 emit_move_insn (rl, hi);
4486 emit_move_insn (rh, const0_rtx);
4490 rtx lo = gen_lowpart (DImode, operands[1]);
4492 emit_insn (gen_shrp (rl, hi, lo, shiftlo));
4493 emit_insn (gen_lshrdi3 (rh, hi, shiftlo));
4499 [(set (match_operand:DI 0 "gr_register_operand" "=r")
4500 (unspec:DI [(match_operand:DI 1 "gr_register_operand" "r")
4501 (match_operand:DI 2 "gr_register_operand" "r")
4502 (match_operand:DI 3 "shift_count_operand" "M")]
4505 "shrp %0 = %1, %2, %3"
4506 [(set_attr "itanium_class" "ishf")])
4508 ;; ::::::::::::::::::::
4510 ;; :: 32 bit Integer Logical operations
4512 ;; ::::::::::::::::::::
4514 ;; We don't seem to need any other 32-bit logical operations, because gcc
4515 ;; generates zero-extend;zero-extend;DImode-op, which combine optimizes to
4516 ;; DImode-op;zero-extend, and then we can optimize away the zero-extend.
4517 ;; This doesn't work for unary logical operations, because we don't call
4518 ;; apply_distributive_law for them.
4520 ;; ??? Likewise, this doesn't work for andnot, which isn't handled by
4521 ;; apply_distributive_law. We get inefficient code for
4522 ;; int sub4 (int i, int j) { return i & ~j; }
4523 ;; We could convert (and (not (sign_extend A)) (sign_extend B)) to
4524 ;; (zero_extend (and (not A) B)) in combine.
4525 ;; Or maybe fix this by adding andsi3/iorsi3/xorsi3 patterns like the
4526 ;; one_cmplsi2 pattern.
4528 (define_insn "one_cmplsi2"
4529 [(set (match_operand:SI 0 "gr_register_operand" "=r")
4530 (not:SI (match_operand:SI 1 "gr_register_operand" "r")))]
4533 [(set_attr "itanium_class" "ilog")])
4535 ;; ::::::::::::::::::::
4537 ;; :: 64 bit Integer Logical operations
4539 ;; ::::::::::::::::::::
4541 (define_insn "anddi3"
4542 [(set (match_operand:DI 0 "grfr_register_operand" "=r,*f")
4543 (and:DI (match_operand:DI 1 "grfr_register_operand" "%r,*f")
4544 (match_operand:DI 2 "grfr_reg_or_8bit_operand" "rK,*f")))]
4549 [(set_attr "itanium_class" "ilog,fmisc")])
4551 (define_insn "*andnot"
4552 [(set (match_operand:DI 0 "grfr_register_operand" "=r,*f")
4553 (and:DI (not:DI (match_operand:DI 1 "grfr_register_operand" "r,*f"))
4554 (match_operand:DI 2 "grfr_reg_or_8bit_operand" "rK,*f")))]
4559 [(set_attr "itanium_class" "ilog,fmisc")])
4561 (define_insn "iordi3"
4562 [(set (match_operand:DI 0 "grfr_register_operand" "=r,*f")
4563 (ior:DI (match_operand:DI 1 "grfr_register_operand" "%r,*f")
4564 (match_operand:DI 2 "grfr_reg_or_8bit_operand" "rK,*f")))]
4569 [(set_attr "itanium_class" "ilog,fmisc")])
4571 (define_insn "xordi3"
4572 [(set (match_operand:DI 0 "grfr_register_operand" "=r,*f")
4573 (xor:DI (match_operand:DI 1 "grfr_register_operand" "%r,*f")
4574 (match_operand:DI 2 "grfr_reg_or_8bit_operand" "rK,*f")))]
4579 [(set_attr "itanium_class" "ilog,fmisc")])
4581 (define_insn "one_cmpldi2"
4582 [(set (match_operand:DI 0 "gr_register_operand" "=r")
4583 (not:DI (match_operand:DI 1 "gr_register_operand" "r")))]
4586 [(set_attr "itanium_class" "ilog")])
4588 ;; ::::::::::::::::::::
4592 ;; ::::::::::::::::::::
4594 (define_expand "cmpbi"
4596 (compare (match_operand:BI 0 "register_operand" "")
4597 (match_operand:BI 1 "const_int_operand" "")))]
4600 ia64_compare_op0 = operands[0];
4601 ia64_compare_op1 = operands[1];
4605 (define_expand "cmpsi"
4607 (compare (match_operand:SI 0 "gr_register_operand" "")
4608 (match_operand:SI 1 "gr_reg_or_8bit_and_adjusted_operand" "")))]
4611 ia64_compare_op0 = operands[0];
4612 ia64_compare_op1 = operands[1];
4616 (define_expand "cmpdi"
4618 (compare (match_operand:DI 0 "gr_register_operand" "")
4619 (match_operand:DI 1 "gr_reg_or_8bit_and_adjusted_operand" "")))]
4622 ia64_compare_op0 = operands[0];
4623 ia64_compare_op1 = operands[1];
4627 (define_expand "cmpsf"
4629 (compare (match_operand:SF 0 "fr_reg_or_fp01_operand" "")
4630 (match_operand:SF 1 "fr_reg_or_fp01_operand" "")))]
4633 ia64_compare_op0 = operands[0];
4634 ia64_compare_op1 = operands[1];
4638 (define_expand "cmpdf"
4640 (compare (match_operand:DF 0 "fr_reg_or_fp01_operand" "")
4641 (match_operand:DF 1 "fr_reg_or_fp01_operand" "")))]
4644 ia64_compare_op0 = operands[0];
4645 ia64_compare_op1 = operands[1];
4649 (define_expand "cmpxf"
4651 (compare (match_operand:XF 0 "xfreg_or_fp01_operand" "")
4652 (match_operand:XF 1 "xfreg_or_fp01_operand" "")))]
4655 ia64_compare_op0 = operands[0];
4656 ia64_compare_op1 = operands[1];
4660 (define_expand "cmptf"
4662 (compare (match_operand:TF 0 "gr_register_operand" "")
4663 (match_operand:TF 1 "gr_register_operand" "")))]
4666 ia64_compare_op0 = operands[0];
4667 ia64_compare_op1 = operands[1];
4671 (define_insn "*cmpsi_normal"
4672 [(set (match_operand:BI 0 "register_operand" "=c")
4673 (match_operator:BI 1 "normal_comparison_operator"
4674 [(match_operand:SI 2 "gr_register_operand" "r")
4675 (match_operand:SI 3 "gr_reg_or_8bit_operand" "rK")]))]
4677 "cmp4.%C1 %0, %I0 = %3, %2"
4678 [(set_attr "itanium_class" "icmp")])
4680 ;; We use %r3 because it is possible for us to match a 0, and two of the
4681 ;; unsigned comparisons don't accept immediate operands of zero.
4683 (define_insn "*cmpsi_adjusted"
4684 [(set (match_operand:BI 0 "register_operand" "=c")
4685 (match_operator:BI 1 "adjusted_comparison_operator"
4686 [(match_operand:SI 2 "gr_register_operand" "r")
4687 (match_operand:SI 3 "gr_reg_or_8bit_adjusted_operand" "rL")]))]
4689 "cmp4.%C1 %0, %I0 = %r3, %2"
4690 [(set_attr "itanium_class" "icmp")])
4692 (define_insn "*cmpdi_normal"
4693 [(set (match_operand:BI 0 "register_operand" "=c")
4694 (match_operator:BI 1 "normal_comparison_operator"
4695 [(match_operand:DI 2 "gr_reg_or_0_operand" "rO")
4696 (match_operand:DI 3 "gr_reg_or_8bit_operand" "rK")]))]
4698 "cmp.%C1 %0, %I0 = %3, %r2"
4699 [(set_attr "itanium_class" "icmp")])
4701 ;; We use %r3 because it is possible for us to match a 0, and two of the
4702 ;; unsigned comparisons don't accept immediate operands of zero.
4704 (define_insn "*cmpdi_adjusted"
4705 [(set (match_operand:BI 0 "register_operand" "=c")
4706 (match_operator:BI 1 "adjusted_comparison_operator"
4707 [(match_operand:DI 2 "gr_register_operand" "r")
4708 (match_operand:DI 3 "gr_reg_or_8bit_adjusted_operand" "rL")]))]
4710 "cmp.%C1 %0, %I0 = %r3, %2"
4711 [(set_attr "itanium_class" "icmp")])
4713 (define_insn "*cmpsf_internal"
4714 [(set (match_operand:BI 0 "register_operand" "=c")
4715 (match_operator:BI 1 "comparison_operator"
4716 [(match_operand:SF 2 "fr_reg_or_fp01_operand" "fG")
4717 (match_operand:SF 3 "fr_reg_or_fp01_operand" "fG")]))]
4719 "fcmp.%D1 %0, %I0 = %F2, %F3"
4720 [(set_attr "itanium_class" "fcmp")])
4722 (define_insn "*cmpdf_internal"
4723 [(set (match_operand:BI 0 "register_operand" "=c")
4724 (match_operator:BI 1 "comparison_operator"
4725 [(match_operand:DF 2 "fr_reg_or_fp01_operand" "fG")
4726 (match_operand:DF 3 "fr_reg_or_fp01_operand" "fG")]))]
4728 "fcmp.%D1 %0, %I0 = %F2, %F3"
4729 [(set_attr "itanium_class" "fcmp")])
4731 (define_insn "*cmpxf_internal"
4732 [(set (match_operand:BI 0 "register_operand" "=c")
4733 (match_operator:BI 1 "comparison_operator"
4734 [(match_operand:XF 2 "xfreg_or_fp01_operand" "fG")
4735 (match_operand:XF 3 "xfreg_or_fp01_operand" "fG")]))]
4737 "fcmp.%D1 %0, %I0 = %F2, %F3"
4738 [(set_attr "itanium_class" "fcmp")])
4740 ;; ??? Can this pattern be generated?
4742 (define_insn "*bit_zero"
4743 [(set (match_operand:BI 0 "register_operand" "=c")
4744 (eq:BI (zero_extract:DI (match_operand:DI 1 "gr_register_operand" "r")
4746 (match_operand:DI 2 "immediate_operand" "n"))
4749 "tbit.z %0, %I0 = %1, %2"
4750 [(set_attr "itanium_class" "tbit")])
4752 (define_insn "*bit_one"
4753 [(set (match_operand:BI 0 "register_operand" "=c")
4754 (ne:BI (zero_extract:DI (match_operand:DI 1 "gr_register_operand" "r")
4756 (match_operand:DI 2 "immediate_operand" "n"))
4759 "tbit.nz %0, %I0 = %1, %2"
4760 [(set_attr "itanium_class" "tbit")])
4762 ;; ::::::::::::::::::::
4766 ;; ::::::::::::::::::::
4768 (define_expand "beq"
4770 (if_then_else (match_dup 1)
4771 (label_ref (match_operand 0 "" ""))
4774 "operands[1] = ia64_expand_compare (EQ, VOIDmode);")
4776 (define_expand "bne"
4778 (if_then_else (match_dup 1)
4779 (label_ref (match_operand 0 "" ""))
4782 "operands[1] = ia64_expand_compare (NE, VOIDmode);")
4784 (define_expand "blt"
4786 (if_then_else (match_dup 1)
4787 (label_ref (match_operand 0 "" ""))
4790 "operands[1] = ia64_expand_compare (LT, VOIDmode);")
4792 (define_expand "ble"
4794 (if_then_else (match_dup 1)
4795 (label_ref (match_operand 0 "" ""))
4798 "operands[1] = ia64_expand_compare (LE, VOIDmode);")
4800 (define_expand "bgt"
4802 (if_then_else (match_dup 1)
4803 (label_ref (match_operand 0 "" ""))
4806 "operands[1] = ia64_expand_compare (GT, VOIDmode);")
4808 (define_expand "bge"
4810 (if_then_else (match_dup 1)
4811 (label_ref (match_operand 0 "" ""))
4814 "operands[1] = ia64_expand_compare (GE, VOIDmode);")
4816 (define_expand "bltu"
4818 (if_then_else (match_dup 1)
4819 (label_ref (match_operand 0 "" ""))
4822 "operands[1] = ia64_expand_compare (LTU, VOIDmode);")
4824 (define_expand "bleu"
4826 (if_then_else (match_dup 1)
4827 (label_ref (match_operand 0 "" ""))
4830 "operands[1] = ia64_expand_compare (LEU, VOIDmode);")
4832 (define_expand "bgtu"
4834 (if_then_else (match_dup 1)
4835 (label_ref (match_operand 0 "" ""))
4838 "operands[1] = ia64_expand_compare (GTU, VOIDmode);")
4840 (define_expand "bgeu"
4842 (if_then_else (match_dup 1)
4843 (label_ref (match_operand 0 "" ""))
4846 "operands[1] = ia64_expand_compare (GEU, VOIDmode);")
4848 (define_expand "bunordered"
4850 (if_then_else (match_dup 1)
4851 (label_ref (match_operand 0 "" ""))
4854 "operands[1] = ia64_expand_compare (UNORDERED, VOIDmode);")
4856 (define_expand "bordered"
4858 (if_then_else (match_dup 1)
4859 (label_ref (match_operand 0 "" ""))
4862 "operands[1] = ia64_expand_compare (ORDERED, VOIDmode);")
4864 (define_insn "*br_true"
4866 (if_then_else (match_operator 0 "predicate_operator"
4867 [(match_operand:BI 1 "register_operand" "c")
4869 (label_ref (match_operand 2 "" ""))
4872 "(%J0) br.cond%+ %l2"
4873 [(set_attr "itanium_class" "br")
4874 (set_attr "predicable" "no")])
4876 (define_insn "*br_false"
4878 (if_then_else (match_operator 0 "predicate_operator"
4879 [(match_operand:BI 1 "register_operand" "c")
4882 (label_ref (match_operand 2 "" ""))))]
4884 "(%j0) br.cond%+ %l2"
4885 [(set_attr "itanium_class" "br")
4886 (set_attr "predicable" "no")])
4888 ;; ::::::::::::::::::::
4890 ;; :: Counted loop operations
4892 ;; ::::::::::::::::::::
4894 (define_expand "doloop_end"
4895 [(use (match_operand 0 "" "")) ; loop pseudo
4896 (use (match_operand 1 "" "")) ; iterations; zero if unknown
4897 (use (match_operand 2 "" "")) ; max iterations
4898 (use (match_operand 3 "" "")) ; loop level
4899 (use (match_operand 4 "" ""))] ; label
4902 /* Only use cloop on innermost loops. */
4903 if (INTVAL (operands[3]) > 1)
4905 emit_jump_insn (gen_doloop_end_internal (gen_rtx_REG (DImode, AR_LC_REGNUM),
4910 (define_insn "doloop_end_internal"
4911 [(set (pc) (if_then_else (ne (match_operand:DI 0 "ar_lc_reg_operand" "")
4913 (label_ref (match_operand 1 "" ""))
4915 (set (match_dup 0) (if_then_else:DI (ne (match_dup 0) (const_int 0))
4916 (plus:DI (match_dup 0) (const_int -1))
4919 "br.cloop.sptk.few %l1"
4920 [(set_attr "itanium_class" "br")
4921 (set_attr "predicable" "no")])
4923 ;; ::::::::::::::::::::
4925 ;; :: Set flag operations
4927 ;; ::::::::::::::::::::
4929 (define_expand "seq"
4930 [(set (match_operand:DI 0 "gr_register_operand" "") (match_dup 1))]
4932 "operands[1] = ia64_expand_compare (EQ, DImode);")
4934 (define_expand "sne"
4935 [(set (match_operand:DI 0 "gr_register_operand" "") (match_dup 1))]
4937 "operands[1] = ia64_expand_compare (NE, DImode);")
4939 (define_expand "slt"
4940 [(set (match_operand:DI 0 "gr_register_operand" "") (match_dup 1))]
4942 "operands[1] = ia64_expand_compare (LT, DImode);")
4944 (define_expand "sle"
4945 [(set (match_operand:DI 0 "gr_register_operand" "") (match_dup 1))]
4947 "operands[1] = ia64_expand_compare (LE, DImode);")
4949 (define_expand "sgt"
4950 [(set (match_operand:DI 0 "gr_register_operand" "") (match_dup 1))]
4952 "operands[1] = ia64_expand_compare (GT, DImode);")
4954 (define_expand "sge"
4955 [(set (match_operand:DI 0 "gr_register_operand" "") (match_dup 1))]
4957 "operands[1] = ia64_expand_compare (GE, DImode);")
4959 (define_expand "sltu"
4960 [(set (match_operand:DI 0 "gr_register_operand" "") (match_dup 1))]
4962 "operands[1] = ia64_expand_compare (LTU, DImode);")
4964 (define_expand "sleu"
4965 [(set (match_operand:DI 0 "gr_register_operand" "") (match_dup 1))]
4967 "operands[1] = ia64_expand_compare (LEU, DImode);")
4969 (define_expand "sgtu"
4970 [(set (match_operand:DI 0 "gr_register_operand" "") (match_dup 1))]
4972 "operands[1] = ia64_expand_compare (GTU, DImode);")
4974 (define_expand "sgeu"
4975 [(set (match_operand:DI 0 "gr_register_operand" "") (match_dup 1))]
4977 "operands[1] = ia64_expand_compare (GEU, DImode);")
4979 (define_expand "sunordered"
4980 [(set (match_operand:DI 0 "gr_register_operand" "") (match_dup 1))]
4982 "operands[1] = ia64_expand_compare (UNORDERED, DImode);")
4984 (define_expand "sordered"
4985 [(set (match_operand:DI 0 "gr_register_operand" "") (match_dup 1))]
4987 "operands[1] = ia64_expand_compare (ORDERED, DImode);")
4989 ;; Don't allow memory as destination here, because cmov/cmov/st is more
4990 ;; efficient than mov/mov/cst/cst.
4992 (define_insn_and_split "*sne_internal"
4993 [(set (match_operand:DI 0 "gr_register_operand" "=r")
4994 (ne:DI (match_operand:BI 1 "register_operand" "c")
4999 [(cond_exec (ne (match_dup 1) (const_int 0))
5000 (set (match_dup 0) (const_int 1)))
5001 (cond_exec (eq (match_dup 1) (const_int 0))
5002 (set (match_dup 0) (const_int 0)))]
5004 [(set_attr "itanium_class" "unknown")])
5006 (define_insn_and_split "*seq_internal"
5007 [(set (match_operand:DI 0 "gr_register_operand" "=r")
5008 (eq:DI (match_operand:BI 1 "register_operand" "c")
5013 [(cond_exec (ne (match_dup 1) (const_int 0))
5014 (set (match_dup 0) (const_int 0)))
5015 (cond_exec (eq (match_dup 1) (const_int 0))
5016 (set (match_dup 0) (const_int 1)))]
5018 [(set_attr "itanium_class" "unknown")])
5020 ;; ::::::::::::::::::::
5022 ;; :: Conditional move instructions.
5024 ;; ::::::::::::::::::::
5026 ;; ??? Add movXXcc patterns?
5029 ;; DImode if_then_else patterns.
5032 (define_insn "*cmovdi_internal"
5033 [(set (match_operand:DI 0 "destination_operand"
5034 "= r, r, r, r, r, r, r, r, r, r, m, Q, *f,*b,*d*e")
5036 (match_operator 4 "predicate_operator"
5037 [(match_operand:BI 1 "register_operand"
5038 "c,c,c,c,c,c,c,c,c,c,c,c,c,c,c")
5040 (match_operand:DI 2 "move_operand"
5041 "rim, *f, *b,*d*e,rim,rim, rim,*f,*b,*d*e,rO,*f,rOQ,rO, rK")
5042 (match_operand:DI 3 "move_operand"
5043 "rim,rim,rim, rim, *f, *b,*d*e,*f,*b,*d*e,rO,*f,rOQ,rO, rK")))]
5044 "ia64_move_ok (operands[0], operands[2])
5045 && ia64_move_ok (operands[0], operands[3])"
5047 [(set_attr "predicable" "no")])
5050 [(set (match_operand 0 "destination_operand" "")
5052 (match_operator 4 "predicate_operator"
5053 [(match_operand:BI 1 "register_operand" "")
5055 (match_operand 2 "move_operand" "")
5056 (match_operand 3 "move_operand" "")))]
5060 bool emitted_something = false;
5061 rtx dest = operands[0];
5062 rtx srct = operands[2];
5063 rtx srcf = operands[3];
5064 rtx cond = operands[4];
5066 if (! rtx_equal_p (dest, srct))
5068 ia64_emit_cond_move (dest, srct, cond);
5069 emitted_something = true;
5071 if (! rtx_equal_p (dest, srcf))
5073 cond = gen_rtx_fmt_ee (GET_CODE (cond) == NE ? EQ : NE,
5074 VOIDmode, operands[1], const0_rtx);
5075 ia64_emit_cond_move (dest, srcf, cond);
5076 emitted_something = true;
5078 if (! emitted_something)
5079 emit_note (NOTE_INSN_DELETED);
5083 ;; Absolute value pattern.
5085 (define_insn "*absdi2_internal"
5086 [(set (match_operand:DI 0 "gr_register_operand" "=r,r")
5088 (match_operator 4 "predicate_operator"
5089 [(match_operand:BI 1 "register_operand" "c,c")
5091 (neg:DI (match_operand:DI 2 "gr_reg_or_22bit_operand" "rI,rI"))
5092 (match_operand:DI 3 "gr_reg_or_22bit_operand" "0,rI")))]
5095 [(set_attr "itanium_class" "ialu,unknown")
5096 (set_attr "predicable" "no")])
5099 [(set (match_operand:DI 0 "register_operand" "")
5101 (match_operator 4 "predicate_operator"
5102 [(match_operand:BI 1 "register_operand" "c,c")
5104 (neg:DI (match_operand:DI 2 "gr_reg_or_22bit_operand" ""))
5105 (match_operand:DI 3 "gr_reg_or_22bit_operand" "")))]
5106 "reload_completed && rtx_equal_p (operands[0], operands[3])"
5110 (neg:DI (match_dup 2))))]
5114 [(set (match_operand:DI 0 "register_operand" "")
5116 (match_operator 4 "predicate_operator"
5117 [(match_operand:BI 1 "register_operand" "c,c")
5119 (neg:DI (match_operand:DI 2 "gr_reg_or_22bit_operand" ""))
5120 (match_operand:DI 3 "gr_reg_or_22bit_operand" "")))]
5124 (set (match_dup 0) (neg:DI (match_dup 2))))
5127 (set (match_dup 0) (match_dup 3)))]
5129 operands[5] = gen_rtx_fmt_ee (GET_CODE (operands[4]) == NE ? EQ : NE,
5130 VOIDmode, operands[1], const0_rtx);
5134 ;; SImode if_then_else patterns.
5137 (define_insn "*cmovsi_internal"
5138 [(set (match_operand:SI 0 "destination_operand" "=r,m,*f,r,m,*f,r,m,*f")
5140 (match_operator 4 "predicate_operator"
5141 [(match_operand:BI 1 "register_operand" "c,c,c,c,c,c,c,c,c")
5143 (match_operand:SI 2 "move_operand"
5144 "0,0,0,rim*f,rO,rO,rim*f,rO,rO")
5145 (match_operand:SI 3 "move_operand"
5146 "rim*f,rO,rO,0,0,0,rim*f,rO,rO")))]
5147 "ia64_move_ok (operands[0], operands[2])
5148 && ia64_move_ok (operands[0], operands[3])"
5150 [(set_attr "predicable" "no")])
5152 (define_insn "*abssi2_internal"
5153 [(set (match_operand:SI 0 "gr_register_operand" "=r,r")
5155 (match_operator 4 "predicate_operator"
5156 [(match_operand:BI 1 "register_operand" "c,c")
5158 (neg:SI (match_operand:SI 3 "gr_reg_or_22bit_operand" "rI,rI"))
5159 (match_operand:SI 2 "gr_reg_or_22bit_operand" "0,rI")))]
5162 [(set_attr "itanium_class" "ialu,unknown")
5163 (set_attr "predicable" "no")])
5166 [(set (match_operand:SI 0 "register_operand" "")
5168 (match_operator 4 "predicate_operator"
5169 [(match_operand:BI 1 "register_operand" "c,c")
5171 (neg:SI (match_operand:SI 2 "gr_reg_or_22bit_operand" ""))
5172 (match_operand:SI 3 "gr_reg_or_22bit_operand" "")))]
5173 "reload_completed && rtx_equal_p (operands[0], operands[3])"
5177 (neg:SI (match_dup 2))))]
5181 [(set (match_operand:SI 0 "register_operand" "")
5183 (match_operator 4 "predicate_operator"
5184 [(match_operand:BI 1 "register_operand" "c,c")
5186 (neg:SI (match_operand:SI 2 "gr_reg_or_22bit_operand" ""))
5187 (match_operand:SI 3 "gr_reg_or_22bit_operand" "")))]
5191 (set (match_dup 0) (neg:SI (match_dup 2))))
5194 (set (match_dup 0) (match_dup 3)))]
5196 operands[5] = gen_rtx_fmt_ee (GET_CODE (operands[4]) == NE ? EQ : NE,
5197 VOIDmode, operands[1], const0_rtx);
5200 (define_insn_and_split "*cond_opsi2_internal"
5201 [(set (match_operand:SI 0 "gr_register_operand" "=r")
5202 (match_operator:SI 5 "condop_operator"
5204 (match_operator 6 "predicate_operator"
5205 [(match_operand:BI 1 "register_operand" "c")
5207 (match_operand:SI 2 "gr_register_operand" "r")
5208 (match_operand:SI 3 "gr_register_operand" "r"))
5209 (match_operand:SI 4 "gr_register_operand" "r")]))]
5215 (set (match_dup 0) (match_op_dup:SI 5 [(match_dup 2) (match_dup 4)])))
5218 (set (match_dup 0) (match_op_dup:SI 5 [(match_dup 3) (match_dup 4)])))]
5220 operands[7] = gen_rtx_fmt_ee (GET_CODE (operands[6]) == NE ? EQ : NE,
5221 VOIDmode, operands[1], const0_rtx);
5223 [(set_attr "itanium_class" "ialu")
5224 (set_attr "predicable" "no")])
5227 (define_insn_and_split "*cond_opsi2_internal_b"
5228 [(set (match_operand:SI 0 "gr_register_operand" "=r")
5229 (match_operator:SI 5 "condop_operator"
5230 [(match_operand:SI 4 "gr_register_operand" "r")
5232 (match_operator 6 "predicate_operator"
5233 [(match_operand:BI 1 "register_operand" "c")
5235 (match_operand:SI 2 "gr_register_operand" "r")
5236 (match_operand:SI 3 "gr_register_operand" "r"))]))]
5242 (set (match_dup 0) (match_op_dup:SI 5 [(match_dup 4) (match_dup 2)])))
5245 (set (match_dup 0) (match_op_dup:SI 5 [(match_dup 4) (match_dup 3)])))]
5247 operands[7] = gen_rtx_fmt_ee (GET_CODE (operands[6]) == NE ? EQ : NE,
5248 VOIDmode, operands[1], const0_rtx);
5250 [(set_attr "itanium_class" "ialu")
5251 (set_attr "predicable" "no")])
5254 ;; ::::::::::::::::::::
5256 ;; :: Call and branch instructions
5258 ;; ::::::::::::::::::::
5260 ;; Subroutine call instruction returning no value. Operand 0 is the function
5261 ;; to call; operand 1 is the number of bytes of arguments pushed (in mode
5262 ;; `SImode', except it is normally a `const_int'); operand 2 is the number of
5263 ;; registers used as operands.
5265 ;; On most machines, operand 2 is not actually stored into the RTL pattern. It
5266 ;; is supplied for the sake of some RISC machines which need to put this
5267 ;; information into the assembler code; they can put it in the RTL instead of
5270 (define_expand "call"
5271 [(use (match_operand:DI 0 "" ""))
5272 (use (match_operand 1 "" ""))
5273 (use (match_operand 2 "" ""))
5274 (use (match_operand 3 "" ""))]
5277 ia64_expand_call (NULL_RTX, operands[0], operands[2], false);
5281 (define_expand "sibcall"
5282 [(use (match_operand:DI 0 "" ""))
5283 (use (match_operand 1 "" ""))
5284 (use (match_operand 2 "" ""))
5285 (use (match_operand 3 "" ""))]
5288 ia64_expand_call (NULL_RTX, operands[0], operands[2], true);
5292 ;; Subroutine call instruction returning a value. Operand 0 is the hard
5293 ;; register in which the value is returned. There are three more operands,
5294 ;; the same as the three operands of the `call' instruction (but with numbers
5295 ;; increased by one).
5297 ;; Subroutines that return `BLKmode' objects use the `call' insn.
5299 (define_expand "call_value"
5300 [(use (match_operand 0 "" ""))
5301 (use (match_operand:DI 1 "" ""))
5302 (use (match_operand 2 "" ""))
5303 (use (match_operand 3 "" ""))
5304 (use (match_operand 4 "" ""))]
5307 ia64_expand_call (operands[0], operands[1], operands[3], false);
5311 (define_expand "sibcall_value"
5312 [(use (match_operand 0 "" ""))
5313 (use (match_operand:DI 1 "" ""))
5314 (use (match_operand 2 "" ""))
5315 (use (match_operand 3 "" ""))
5316 (use (match_operand 4 "" ""))]
5319 ia64_expand_call (operands[0], operands[1], operands[3], true);
5323 ;; Call subroutine returning any type.
5325 (define_expand "untyped_call"
5326 [(parallel [(call (match_operand 0 "" "")
5328 (match_operand 1 "" "")
5329 (match_operand 2 "" "")])]
5334 emit_call_insn (gen_call (operands[0], const0_rtx, NULL, const0_rtx));
5336 for (i = 0; i < XVECLEN (operands[2], 0); i++)
5338 rtx set = XVECEXP (operands[2], 0, i);
5339 emit_move_insn (SET_DEST (set), SET_SRC (set));
5342 /* The optimizer does not know that the call sets the function value
5343 registers we stored in the result block. We avoid problems by
5344 claiming that all hard registers are used and clobbered at this
5346 emit_insn (gen_blockage ());
5351 (define_insn "call_nogp"
5352 [(call (mem:DI (match_operand:DI 0 "call_operand" "?b,i"))
5354 (clobber (match_operand:DI 1 "register_operand" "=b,b"))]
5356 "br.call%+.many %1 = %0"
5357 [(set_attr "itanium_class" "br,scall")])
5359 (define_insn "call_value_nogp"
5360 [(set (match_operand 0 "" "=X,X")
5361 (call (mem:DI (match_operand:DI 1 "call_operand" "?b,i"))
5363 (clobber (match_operand:DI 2 "register_operand" "=b,b"))]
5365 "br.call%+.many %2 = %1"
5366 [(set_attr "itanium_class" "br,scall")])
5368 (define_insn "sibcall_nogp"
5369 [(call (mem:DI (match_operand:DI 0 "call_operand" "?b,i"))
5373 [(set_attr "itanium_class" "br,scall")])
5375 (define_insn "call_gp"
5376 [(call (mem:DI (match_operand:DI 0 "call_operand" "?r,i"))
5378 (clobber (match_operand:DI 1 "register_operand" "=b,b"))
5379 (clobber (match_scratch:DI 2 "=&r,X"))
5380 (clobber (match_scratch:DI 3 "=b,X"))]
5383 [(set_attr "itanium_class" "br,scall")])
5385 ;; Irritatingly, we don't have access to INSN within the split body.
5386 ;; See commentary in ia64_split_call as to why these aren't peep2.
5388 [(call (mem (match_operand 0 "call_operand" ""))
5390 (clobber (match_operand:DI 1 "register_operand" ""))
5391 (clobber (match_scratch:DI 2 ""))
5392 (clobber (match_scratch:DI 3 ""))]
5393 "reload_completed && find_reg_note (insn, REG_NORETURN, NULL_RTX)"
5396 ia64_split_call (NULL_RTX, operands[0], operands[1], operands[2],
5397 operands[3], true, false);
5402 [(call (mem (match_operand 0 "call_operand" ""))
5404 (clobber (match_operand:DI 1 "register_operand" ""))
5405 (clobber (match_scratch:DI 2 ""))
5406 (clobber (match_scratch:DI 3 ""))]
5410 ia64_split_call (NULL_RTX, operands[0], operands[1], operands[2],
5411 operands[3], false, false);
5415 (define_insn "call_value_gp"
5416 [(set (match_operand 0 "" "=X,X")
5417 (call (mem:DI (match_operand:DI 1 "call_operand" "?r,i"))
5419 (clobber (match_operand:DI 2 "register_operand" "=b,b"))
5420 (clobber (match_scratch:DI 3 "=&r,X"))
5421 (clobber (match_scratch:DI 4 "=b,X"))]
5424 [(set_attr "itanium_class" "br,scall")])
5427 [(set (match_operand 0 "" "")
5428 (call (mem:DI (match_operand:DI 1 "call_operand" ""))
5430 (clobber (match_operand:DI 2 "register_operand" ""))
5431 (clobber (match_scratch:DI 3 ""))
5432 (clobber (match_scratch:DI 4 ""))]
5433 "reload_completed && find_reg_note (insn, REG_NORETURN, NULL_RTX)"
5436 ia64_split_call (operands[0], operands[1], operands[2], operands[3],
5437 operands[4], true, false);
5442 [(set (match_operand 0 "" "")
5443 (call (mem:DI (match_operand:DI 1 "call_operand" ""))
5445 (clobber (match_operand:DI 2 "register_operand" ""))
5446 (clobber (match_scratch:DI 3 ""))
5447 (clobber (match_scratch:DI 4 ""))]
5451 ia64_split_call (operands[0], operands[1], operands[2], operands[3],
5452 operands[4], false, false);
5456 (define_insn_and_split "sibcall_gp"
5457 [(call (mem:DI (match_operand:DI 0 "call_operand" "?r,i"))
5459 (clobber (match_scratch:DI 1 "=&r,X"))
5460 (clobber (match_scratch:DI 2 "=b,X"))]
5466 ia64_split_call (NULL_RTX, operands[0], NULL_RTX, operands[1],
5467 operands[2], true, true);
5470 [(set_attr "itanium_class" "br")])
5472 (define_insn "return_internal"
5474 (use (match_operand:DI 0 "register_operand" "b"))]
5476 "br.ret.sptk.many %0"
5477 [(set_attr "itanium_class" "br")])
5479 (define_insn "return"
5481 "ia64_direct_return ()"
5482 "br.ret.sptk.many rp"
5483 [(set_attr "itanium_class" "br")])
5485 (define_insn "*return_true"
5487 (if_then_else (match_operator 0 "predicate_operator"
5488 [(match_operand:BI 1 "register_operand" "c")
5492 "ia64_direct_return ()"
5493 "(%J0) br.ret%+.many rp"
5494 [(set_attr "itanium_class" "br")
5495 (set_attr "predicable" "no")])
5497 (define_insn "*return_false"
5499 (if_then_else (match_operator 0 "predicate_operator"
5500 [(match_operand:BI 1 "register_operand" "c")
5504 "ia64_direct_return ()"
5505 "(%j0) br.ret%+.many rp"
5506 [(set_attr "itanium_class" "br")
5507 (set_attr "predicable" "no")])
5510 [(set (pc) (label_ref (match_operand 0 "" "")))]
5513 [(set_attr "itanium_class" "br")])
5515 (define_insn "indirect_jump"
5516 [(set (pc) (match_operand:DI 0 "register_operand" "b"))]
5519 [(set_attr "itanium_class" "br")])
5521 (define_expand "tablejump"
5522 [(parallel [(set (pc) (match_operand:DI 0 "memory_operand" ""))
5523 (use (label_ref (match_operand 1 "" "")))])]
5526 rtx op0 = operands[0];
5529 /* ??? Bother -- do_tablejump is "helpful" and pulls the table
5530 element into a register without bothering to see whether that
5531 is necessary given the operand predicate. Check for MEM just
5532 in case someone fixes this. */
5533 if (GET_CODE (op0) == MEM)
5534 addr = XEXP (op0, 0);
5537 /* Otherwise, cheat and guess that the previous insn in the
5538 stream was the memory load. Grab the address from that.
5539 Note we have to momentarily pop out of the sequence started
5540 by the insn-emit wrapper in order to grab the last insn. */
5544 last = get_last_insn ();
5546 set = single_set (last);
5548 if (! rtx_equal_p (SET_DEST (set), op0)
5549 || GET_CODE (SET_SRC (set)) != MEM)
5551 addr = XEXP (SET_SRC (set), 0);
5552 if (rtx_equal_p (addr, op0))
5556 /* Jump table elements are stored pc-relative. That is, a displacement
5557 from the entry to the label. Thus to convert to an absolute address
5558 we add the address of the memory from which the value is loaded. */
5559 operands[0] = expand_simple_binop (DImode, PLUS, op0, addr,
5560 NULL_RTX, 1, OPTAB_DIRECT);
5563 (define_insn "*tablejump_internal"
5564 [(set (pc) (match_operand:DI 0 "register_operand" "b"))
5565 (use (label_ref (match_operand 1 "" "")))]
5568 [(set_attr "itanium_class" "br")])
5571 ;; ::::::::::::::::::::
5573 ;; :: Prologue and Epilogue instructions
5575 ;; ::::::::::::::::::::
5577 (define_expand "prologue"
5581 ia64_expand_prologue ();
5585 (define_expand "epilogue"
5589 ia64_expand_epilogue (0);
5593 (define_expand "sibcall_epilogue"
5597 ia64_expand_epilogue (1);
5601 ;; This prevents the scheduler from moving the SP decrement past FP-relative
5602 ;; stack accesses. This is the same as adddi3 plus the extra set.
5604 (define_insn "prologue_allocate_stack"
5605 [(set (match_operand:DI 0 "register_operand" "=r,r,r")
5606 (plus:DI (match_operand:DI 1 "register_operand" "%r,r,a")
5607 (match_operand:DI 2 "gr_reg_or_22bit_operand" "r,I,J")))
5608 (set (match_operand:DI 3 "register_operand" "+r,r,r")
5615 [(set_attr "itanium_class" "ialu")])
5617 ;; This prevents the scheduler from moving the SP restore past FP-relative
5618 ;; stack accesses. This is similar to movdi plus the extra set.
5620 (define_insn "epilogue_deallocate_stack"
5621 [(set (match_operand:DI 0 "register_operand" "=r")
5622 (match_operand:DI 1 "register_operand" "+r"))
5623 (set (match_dup 1) (match_dup 1))]
5626 [(set_attr "itanium_class" "ialu")])
5628 ;; As USE insns aren't meaningful after reload, this is used instead
5629 ;; to prevent deleting instructions setting registers for EH handling
5630 (define_insn "prologue_use"
5631 [(unspec:DI [(match_operand:DI 0 "register_operand" "")]
5632 UNSPEC_PROLOGUE_USE)]
5635 [(set_attr "itanium_class" "ignore")
5636 (set_attr "predicable" "no")
5637 (set_attr "empty" "yes")])
5639 ;; Allocate a new register frame.
5641 (define_insn "alloc"
5642 [(set (match_operand:DI 0 "register_operand" "=r")
5643 (unspec_volatile:DI [(const_int 0)] UNSPECV_ALLOC))
5644 (use (match_operand:DI 1 "const_int_operand" "i"))
5645 (use (match_operand:DI 2 "const_int_operand" "i"))
5646 (use (match_operand:DI 3 "const_int_operand" "i"))
5647 (use (match_operand:DI 4 "const_int_operand" "i"))]
5649 "alloc %0 = ar.pfs, %1, %2, %3, %4"
5650 [(set_attr "itanium_class" "syst_m0")
5651 (set_attr "predicable" "no")])
5654 (define_expand "gr_spill"
5655 [(parallel [(set (match_operand:DI 0 "memory_operand" "=m")
5656 (unspec:DI [(match_operand:DI 1 "register_operand" "r")
5657 (match_operand:DI 2 "const_int_operand" "")]
5659 (clobber (match_dup 3))])]
5661 "operands[3] = gen_rtx_REG (DImode, AR_UNAT_REGNUM);")
5663 (define_insn "gr_spill_internal"
5664 [(set (match_operand:DI 0 "memory_operand" "=m")
5665 (unspec:DI [(match_operand:DI 1 "register_operand" "r")
5666 (match_operand:DI 2 "const_int_operand" "")]
5668 (clobber (match_operand:DI 3 "register_operand" ""))]
5671 /* Note that we use a C output pattern here to avoid the predicate
5672 being automatically added before the .mem.offset directive. */
5673 return ".mem.offset %2, 0\;%,st8.spill %0 = %1%P0";
5675 [(set_attr "itanium_class" "st")])
5678 (define_expand "gr_restore"
5679 [(parallel [(set (match_operand:DI 0 "register_operand" "=r")
5680 (unspec:DI [(match_operand:DI 1 "memory_operand" "m")
5681 (match_operand:DI 2 "const_int_operand" "")]
5683 (use (match_dup 3))])]
5685 "operands[3] = gen_rtx_REG (DImode, AR_UNAT_REGNUM);")
5687 (define_insn "gr_restore_internal"
5688 [(set (match_operand:DI 0 "register_operand" "=r")
5689 (unspec:DI [(match_operand:DI 1 "memory_operand" "m")
5690 (match_operand:DI 2 "const_int_operand" "")]
5692 (use (match_operand:DI 3 "register_operand" ""))]
5694 { return ".mem.offset %2, 0\;%,ld8.fill %0 = %1%P1"; }
5695 [(set_attr "itanium_class" "ld")])
5697 (define_insn "fr_spill"
5698 [(set (match_operand:XF 0 "memory_operand" "=m")
5699 (unspec:XF [(match_operand:XF 1 "register_operand" "f")]
5702 "stf.spill %0 = %1%P0"
5703 [(set_attr "itanium_class" "stf")])
5705 (define_insn "fr_restore"
5706 [(set (match_operand:XF 0 "register_operand" "=f")
5707 (unspec:XF [(match_operand:XF 1 "memory_operand" "m")]
5708 UNSPEC_FR_RESTORE))]
5710 "ldf.fill %0 = %1%P1"
5711 [(set_attr "itanium_class" "fld")])
5713 ;; ??? The explicit stop is not ideal. It would be better if
5714 ;; rtx_needs_barrier took care of this, but this is something that can be
5715 ;; fixed later. This avoids an RSE DV.
5717 (define_insn "bsp_value"
5718 [(set (match_operand:DI 0 "register_operand" "=r")
5719 (unspec:DI [(const_int 0)] UNSPEC_BSP_VALUE))]
5723 return \";;\;%,mov %0 = ar.bsp\";
5725 [(set_attr "itanium_class" "frar_i")])
5727 (define_insn "set_bsp"
5728 [(unspec_volatile [(match_operand:DI 0 "register_operand" "r")]
5746 [(set_attr "itanium_class" "unknown")
5747 (set_attr "predicable" "no")])
5749 ;; ??? The explicit stops are not ideal. It would be better if
5750 ;; rtx_needs_barrier took care of this, but this is something that can be
5751 ;; fixed later. This avoids an RSE DV.
5753 (define_insn "flushrs"
5754 [(unspec [(const_int 0)] UNSPEC_FLUSHRS)]
5757 [(set_attr "itanium_class" "rse_m")
5758 (set_attr "predicable" "no")])
5760 ;; ::::::::::::::::::::
5762 ;; :: Miscellaneous instructions
5764 ;; ::::::::::::::::::::
5766 ;; ??? Emitting a NOP instruction isn't very useful. This should probably
5767 ;; be emitting ";;" to force a break in the instruction packing.
5769 ;; No operation, needed in case the user uses -g but not -O.
5774 [(set_attr "itanium_class" "nop")])
5776 (define_insn "nop_m"
5780 [(set_attr "itanium_class" "nop_m")])
5782 (define_insn "nop_i"
5786 [(set_attr "itanium_class" "nop_i")])
5788 (define_insn "nop_f"
5792 [(set_attr "itanium_class" "nop_f")])
5794 (define_insn "nop_b"
5798 [(set_attr "itanium_class" "nop_b")])
5800 (define_insn "nop_x"
5804 [(set_attr "itanium_class" "nop_x")
5805 (set_attr "empty" "yes")])
5807 ;; The following insn will be never generated. It is used only by
5808 ;; insn scheduler to change state before advancing cycle.
5809 (define_insn "pre_cycle"
5813 [(set_attr "itanium_class" "pre_cycle")])
5815 (define_insn "bundle_selector"
5816 [(unspec [(match_operand 0 "const_int_operand" "")] UNSPEC_BUNDLE_SELECTOR)]
5818 { return get_bundle_name (INTVAL (operands[0])); }
5819 [(set_attr "itanium_class" "ignore")
5820 (set_attr "predicable" "no")])
5822 ;; Pseudo instruction that prevents the scheduler from moving code above this
5824 (define_insn "blockage"
5825 [(unspec_volatile [(const_int 0)] UNSPECV_BLOCKAGE)]
5828 [(set_attr "itanium_class" "ignore")
5829 (set_attr "predicable" "no")])
5831 (define_insn "insn_group_barrier"
5832 [(unspec_volatile [(match_operand 0 "const_int_operand" "")]
5833 UNSPECV_INSN_GROUP_BARRIER)]
5836 [(set_attr "itanium_class" "stop_bit")
5837 (set_attr "predicable" "no")
5838 (set_attr "empty" "yes")])
5840 (define_expand "trap"
5841 [(trap_if (const_int 1) (const_int 0))]
5845 ;; ??? We don't have a match-any slot type. Setting the type to unknown
5846 ;; produces worse code that setting the slot type to A.
5848 (define_insn "*trap"
5849 [(trap_if (const_int 1) (match_operand 0 "const_int_operand" ""))]
5852 [(set_attr "itanium_class" "chk_s")])
5854 (define_expand "conditional_trap"
5855 [(trap_if (match_operand 0 "" "") (match_operand 1 "" ""))]
5858 operands[0] = ia64_expand_compare (GET_CODE (operands[0]), VOIDmode);
5861 (define_insn "*conditional_trap"
5862 [(trap_if (match_operator 0 "predicate_operator"
5863 [(match_operand:BI 1 "register_operand" "c")
5865 (match_operand 2 "const_int_operand" ""))]
5868 [(set_attr "itanium_class" "chk_s")
5869 (set_attr "predicable" "no")])
5871 (define_insn "break_f"
5872 [(unspec_volatile [(const_int 0)] UNSPECV_BREAK)]
5875 [(set_attr "itanium_class" "nop_f")])
5877 (define_insn "prefetch"
5878 [(prefetch (match_operand:DI 0 "address_operand" "p")
5879 (match_operand:DI 1 "const_int_operand" "n")
5880 (match_operand:DI 2 "const_int_operand" "n"))]
5883 static const char * const alt[2][4] = {
5885 "%,lfetch.nta [%0]",
5886 "%,lfetch.nt1 [%0]",
5887 "%,lfetch.nt2 [%0]",
5891 "%,lfetch.excl.nta [%0]",
5892 "%,lfetch.excl.nt1 [%0]",
5893 "%,lfetch.excl.nt2 [%0]",
5894 "%,lfetch.excl [%0]"
5897 int i = (INTVAL (operands[1]));
5898 int j = (INTVAL (operands[2]));
5900 if (i != 0 && i != 1)
5906 [(set_attr "itanium_class" "lfetch")])
5908 ;; Non-local goto support.
5910 (define_expand "save_stack_nonlocal"
5911 [(use (match_operand:OI 0 "memory_operand" ""))
5912 (use (match_operand:DI 1 "register_operand" ""))]
5915 emit_library_call (gen_rtx_SYMBOL_REF (Pmode,
5916 \"__ia64_save_stack_nonlocal\"),
5917 0, VOIDmode, 2, XEXP (operands[0], 0), Pmode,
5918 operands[1], Pmode);
5922 (define_expand "nonlocal_goto"
5923 [(use (match_operand 0 "general_operand" ""))
5924 (use (match_operand 1 "general_operand" ""))
5925 (use (match_operand 2 "general_operand" ""))
5926 (use (match_operand 3 "general_operand" ""))]
5929 emit_library_call (gen_rtx_SYMBOL_REF (Pmode, \"__ia64_nonlocal_goto\"),
5930 LCT_NORETURN, VOIDmode, 3,
5932 copy_to_reg (XEXP (operands[2], 0)), Pmode,
5933 operands[3], Pmode);
5938 (define_insn_and_split "builtin_setjmp_receiver"
5939 [(unspec_volatile [(match_operand:DI 0 "" "")] UNSPECV_SETJMP_RECEIVER)]
5949 (define_expand "eh_epilogue"
5950 [(use (match_operand:DI 0 "register_operand" "r"))
5951 (use (match_operand:DI 1 "register_operand" "r"))
5952 (use (match_operand:DI 2 "register_operand" "r"))]
5955 rtx bsp = gen_rtx_REG (Pmode, 10);
5956 rtx sp = gen_rtx_REG (Pmode, 9);
5958 if (GET_CODE (operands[0]) != REG || REGNO (operands[0]) != 10)
5960 emit_move_insn (bsp, operands[0]);
5963 if (GET_CODE (operands[2]) != REG || REGNO (operands[2]) != 9)
5965 emit_move_insn (sp, operands[2]);
5968 emit_insn (gen_rtx_USE (VOIDmode, sp));
5969 emit_insn (gen_rtx_USE (VOIDmode, bsp));
5971 cfun->machine->ia64_eh_epilogue_sp = sp;
5972 cfun->machine->ia64_eh_epilogue_bsp = bsp;
5975 ;; Builtin apply support.
5977 (define_expand "restore_stack_nonlocal"
5978 [(use (match_operand:DI 0 "register_operand" ""))
5979 (use (match_operand:OI 1 "memory_operand" ""))]
5982 emit_library_call (gen_rtx_SYMBOL_REF (Pmode,
5983 "__ia64_restore_stack_nonlocal"),
5985 copy_to_reg (XEXP (operands[1], 0)), Pmode);
5990 ;;; Intrinsics support.
5993 [(set (mem:BLK (match_dup 0))
5994 (unspec:BLK [(mem:BLK (match_dup 0))] UNSPEC_MF))]
5997 operands[0] = gen_rtx_MEM (BLKmode, gen_rtx_SCRATCH (DImode));
5998 MEM_VOLATILE_P (operands[0]) = 1;
6001 (define_insn "*mf_internal"
6002 [(set (match_operand:BLK 0 "" "")
6003 (unspec:BLK [(match_operand:BLK 1 "" "")] UNSPEC_MF))]
6006 [(set_attr "itanium_class" "syst_m")])
6008 (define_insn "fetchadd_acq_si"
6009 [(set (match_operand:SI 0 "gr_register_operand" "=r")
6010 (match_operand:SI 1 "not_postinc_memory_operand" "+S"))
6012 (unspec:SI [(match_dup 1)
6013 (match_operand:SI 2 "fetchadd_operand" "n")]
6014 UNSPEC_FETCHADD_ACQ))]
6016 "fetchadd4.acq %0 = %1, %2"
6017 [(set_attr "itanium_class" "sem")])
6019 (define_insn "fetchadd_acq_di"
6020 [(set (match_operand:DI 0 "gr_register_operand" "=r")
6021 (match_operand:DI 1 "not_postinc_memory_operand" "+S"))
6023 (unspec:DI [(match_dup 1)
6024 (match_operand:DI 2 "fetchadd_operand" "n")]
6025 UNSPEC_FETCHADD_ACQ))]
6027 "fetchadd8.acq %0 = %1, %2"
6028 [(set_attr "itanium_class" "sem")])
6030 (define_insn "cmpxchg_acq_si"
6031 [(set (match_operand:SI 0 "gr_register_operand" "=r")
6032 (match_operand:SI 1 "not_postinc_memory_operand" "+S"))
6034 (unspec:SI [(match_dup 1)
6035 (match_operand:SI 2 "gr_register_operand" "r")
6036 (match_operand:DI 3 "ar_ccv_reg_operand" "")]
6037 UNSPEC_CMPXCHG_ACQ))]
6039 "cmpxchg4.acq %0 = %1, %2, %3"
6040 [(set_attr "itanium_class" "sem")])
6042 (define_insn "cmpxchg_acq_di"
6043 [(set (match_operand:DI 0 "gr_register_operand" "=r")
6044 (match_operand:DI 1 "not_postinc_memory_operand" "+S"))
6046 (unspec:DI [(match_dup 1)
6047 (match_operand:DI 2 "gr_register_operand" "r")
6048 (match_operand:DI 3 "ar_ccv_reg_operand" "")]
6049 UNSPEC_CMPXCHG_ACQ))]
6051 "cmpxchg8.acq %0 = %1, %2, %3"
6052 [(set_attr "itanium_class" "sem")])
6054 (define_insn "xchgsi"
6055 [(set (match_operand:SI 0 "gr_register_operand" "=r")
6056 (match_operand:SI 1 "not_postinc_memory_operand" "+S"))
6058 (match_operand:SI 2 "gr_register_operand" "r"))]
6061 [(set_attr "itanium_class" "sem")])
6063 (define_insn "xchgdi"
6064 [(set (match_operand:DI 0 "gr_register_operand" "=r")
6065 (match_operand:DI 1 "not_postinc_memory_operand" "+S"))
6067 (match_operand:DI 2 "gr_register_operand" "r"))]
6070 [(set_attr "itanium_class" "sem")])
6075 [(match_operator 0 "predicate_operator"
6076 [(match_operand:BI 1 "register_operand" "c")
6081 (define_insn "pred_rel_mutex"
6082 [(set (match_operand:BI 0 "register_operand" "+c")
6083 (unspec:BI [(match_dup 0)] UNSPEC_PRED_REL_MUTEX))]
6085 ".pred.rel.mutex %0, %I0"
6086 [(set_attr "itanium_class" "ignore")
6087 (set_attr "predicable" "no")])
6089 (define_insn "safe_across_calls_all"
6090 [(unspec_volatile [(const_int 0)] UNSPECV_PSAC_ALL)]
6092 ".pred.safe_across_calls p1-p63"
6093 [(set_attr "itanium_class" "ignore")
6094 (set_attr "predicable" "no")])
6096 (define_insn "safe_across_calls_normal"
6097 [(unspec_volatile [(const_int 0)] UNSPECV_PSAC_NORMAL)]
6100 emit_safe_across_calls ();
6103 [(set_attr "itanium_class" "ignore")
6104 (set_attr "predicable" "no")])
6106 ;; UNSPEC instruction definition to "swizzle" 32 bit pointer into 64 bit
6107 ;; pointer. This is used by the HP-UX 32 bit mode.
6109 (define_insn "ptr_extend"
6110 [(set (match_operand:DI 0 "gr_register_operand" "=r")
6111 (unspec:DI [(match_operand:SI 1 "gr_register_operand" "r")]
6115 [(set_attr "itanium_class" "ialu")])
6118 ;; Optimizations for ptr_extend
6120 (define_insn "ptr_extend_plus_imm"
6121 [(set (match_operand:DI 0 "gr_register_operand" "=r")
6123 [(plus:SI (match_operand:SI 1 "basereg_operand" "r")
6124 (match_operand:SI 2 "gr_reg_or_14bit_operand" "rI"))]
6126 "addp4_optimize_ok (operands[1], operands[2])"
6128 [(set_attr "itanium_class" "ialu")])
6130 (define_insn "*ptr_extend_plus_2"
6131 [(set (match_operand:DI 0 "gr_register_operand" "=r")
6133 [(plus:SI (match_operand:SI 1 "gr_register_operand" "r")
6134 (match_operand:SI 2 "basereg_operand" "r"))]
6136 "addp4_optimize_ok (operands[1], operands[2])"
6138 [(set_attr "itanium_class" "ialu")])
6140 ;; Vector operations