1 ;; IA-64 Machine description template
2 ;; Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005
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)
87 (UNSPECV_INSN_GROUP_BARRIER 2)
90 (UNSPECV_PSAC_ALL 5) ; pred.safe_across_calls
91 (UNSPECV_PSAC_NORMAL 6)
92 (UNSPECV_SETJMP_RECEIVER 7)
95 (include "predicates.md")
97 ;; ::::::::::::::::::::
101 ;; ::::::::::::::::::::
103 ;; Processor type. This attribute must exactly match the processor_type
104 ;; enumeration in ia64.h.
105 (define_attr "cpu" "itanium,itanium2" (const (symbol_ref "ia64_tune")))
107 ;; Instruction type. This primarily determines how instructions can be
108 ;; packed in bundles, and secondarily affects scheduling to function units.
110 ;; A alu, can go in I or M syllable of a bundle
115 ;; L long immediate, takes two syllables
118 ;; ??? Should not have any pattern with type unknown. Perhaps add code to
119 ;; check this in md_reorg? Currently use unknown for patterns which emit
120 ;; multiple instructions, patterns which emit 0 instructions, and patterns
121 ;; which emit instruction that can go in any slot (e.g. nop).
123 (define_attr "itanium_class" "unknown,ignore,stop_bit,br,fcmp,fcvtfx,fld,
124 fmac,fmisc,frar_i,frar_m,frbr,frfr,frpr,ialu,icmp,ilog,ishf,ld,
125 chk_s,long_i,mmalua,mmmul,mmshf,mmshfi,rse_m,scall,sem,stf,
126 st,syst_m0, syst_m,tbit,toar_i,toar_m,tobr,tofr,topr,xmpy,xtd,nop,
127 nop_b,nop_f,nop_i,nop_m,nop_x,lfetch,pre_cycle"
128 (const_string "unknown"))
130 ;; chk_s has an I and an M form; use type A for convenience.
131 (define_attr "type" "unknown,A,I,M,F,B,L,X,S"
132 (cond [(eq_attr "itanium_class" "ld,st,fld,stf,sem,nop_m") (const_string "M")
133 (eq_attr "itanium_class" "rse_m,syst_m,syst_m0") (const_string "M")
134 (eq_attr "itanium_class" "frar_m,toar_m,frfr,tofr") (const_string "M")
135 (eq_attr "itanium_class" "lfetch") (const_string "M")
136 (eq_attr "itanium_class" "chk_s,ialu,icmp,ilog,mmalua")
138 (eq_attr "itanium_class" "fmisc,fmac,fcmp,xmpy") (const_string "F")
139 (eq_attr "itanium_class" "fcvtfx,nop_f") (const_string "F")
140 (eq_attr "itanium_class" "frar_i,toar_i,frbr,tobr") (const_string "I")
141 (eq_attr "itanium_class" "frpr,topr,ishf,xtd,tbit") (const_string "I")
142 (eq_attr "itanium_class" "mmmul,mmshf,mmshfi,nop_i") (const_string "I")
143 (eq_attr "itanium_class" "br,scall,nop_b") (const_string "B")
144 (eq_attr "itanium_class" "stop_bit") (const_string "S")
145 (eq_attr "itanium_class" "nop_x") (const_string "X")
146 (eq_attr "itanium_class" "long_i") (const_string "L")]
147 (const_string "unknown")))
149 (define_attr "itanium_requires_unit0" "no,yes"
150 (cond [(eq_attr "itanium_class" "syst_m0,sem,frfr,rse_m") (const_string "yes")
151 (eq_attr "itanium_class" "toar_m,frar_m") (const_string "yes")
152 (eq_attr "itanium_class" "frbr,tobr,mmmul") (const_string "yes")
153 (eq_attr "itanium_class" "tbit,ishf,topr,frpr") (const_string "yes")
154 (eq_attr "itanium_class" "toar_i,frar_i") (const_string "yes")
155 (eq_attr "itanium_class" "fmisc,fcmp") (const_string "yes")]
156 (const_string "no")))
158 ;; Predication. True iff this instruction can be predicated.
160 (define_attr "predicable" "no,yes" (const_string "yes"))
162 ;; Empty. True iff this insn does not generate any code.
164 (define_attr "empty" "no,yes" (const_string "no"))
166 ;; True iff this insn must be the first insn of an instruction group.
167 ;; This is true for the alloc instruction, and will also be true of others
168 ;; when we have full intrinsics support.
170 (define_attr "first_insn" "no,yes" (const_string "no"))
172 ;; DFA descriptions of ia64 processors used for insn scheduling and
175 (automata_option "ndfa")
177 ;; Uncomment the following line to output automata for debugging.
178 ;; (automata_option "v")
180 (automata_option "w")
182 (include "itanium1.md")
183 (include "itanium2.md")
186 ;; ::::::::::::::::::::
190 ;; ::::::::::::::::::::
192 ;; Set of a single predicate register. This is only used to implement
193 ;; pr-to-pr move and complement.
195 (define_insn "*movcci"
196 [(set (match_operand:CCI 0 "register_operand" "=c,c,c")
197 (match_operand:CCI 1 "nonmemory_operand" "O,n,c"))]
200 cmp.ne %0, p0 = r0, r0
201 cmp.eq %0, p0 = r0, r0
202 (%1) cmp.eq.unc %0, p0 = r0, r0"
203 [(set_attr "itanium_class" "icmp")
204 (set_attr "predicable" "no")])
207 [(set (match_operand:BI 0 "nonimmediate_operand" "=c,c,?c,?*r, c,*r,*r,*m,*r")
208 (match_operand:BI 1 "move_operand" " O,n, c, c,*r, n,*m,*r,*r"))]
211 cmp.ne %0, %I0 = r0, r0
212 cmp.eq %0, %I0 = r0, r0
215 tbit.nz %0, %I0 = %1, 0
220 [(set_attr "itanium_class" "icmp,icmp,unknown,unknown,tbit,ialu,ld,st,ialu")])
223 [(set (match_operand:BI 0 "register_operand" "")
224 (match_operand:BI 1 "register_operand" ""))]
226 && GET_CODE (operands[0]) == REG && GR_REGNO_P (REGNO (operands[0]))
227 && GET_CODE (operands[1]) == REG && PR_REGNO_P (REGNO (operands[1]))"
228 [(cond_exec (ne (match_dup 1) (const_int 0))
229 (set (match_dup 0) (const_int 1)))
230 (cond_exec (eq (match_dup 1) (const_int 0))
231 (set (match_dup 0) (const_int 0)))]
235 [(set (match_operand:BI 0 "register_operand" "")
236 (match_operand:BI 1 "register_operand" ""))]
238 && GET_CODE (operands[0]) == REG && PR_REGNO_P (REGNO (operands[0]))
239 && GET_CODE (operands[1]) == REG && PR_REGNO_P (REGNO (operands[1]))"
240 [(set (match_dup 2) (match_dup 4))
241 (set (match_dup 3) (match_dup 5))
242 (set (match_dup 0) (unspec:BI [(match_dup 0)] UNSPEC_PRED_REL_MUTEX))]
243 "operands[2] = gen_rtx_REG (CCImode, REGNO (operands[0]));
244 operands[3] = gen_rtx_REG (CCImode, REGNO (operands[0]) + 1);
245 operands[4] = gen_rtx_REG (CCImode, REGNO (operands[1]));
246 operands[5] = gen_rtx_REG (CCImode, REGNO (operands[1]) + 1);")
248 (define_expand "movqi"
249 [(set (match_operand:QI 0 "general_operand" "")
250 (match_operand:QI 1 "general_operand" ""))]
253 rtx op1 = ia64_expand_move (operands[0], operands[1]);
259 (define_insn "*movqi_internal"
260 [(set (match_operand:QI 0 "destination_operand" "=r,r,r, m, r,*f,*f")
261 (match_operand:QI 1 "move_operand" "rO,J,m,rO,*f,rO,*f"))]
262 "ia64_move_ok (operands[0], operands[1])"
271 [(set_attr "itanium_class" "ialu,ialu,ld,st,frfr,tofr,fmisc")])
273 (define_expand "movhi"
274 [(set (match_operand:HI 0 "general_operand" "")
275 (match_operand:HI 1 "general_operand" ""))]
278 rtx op1 = ia64_expand_move (operands[0], operands[1]);
284 (define_insn "*movhi_internal"
285 [(set (match_operand:HI 0 "destination_operand" "=r,r,r, m, r,*f,*f")
286 (match_operand:HI 1 "move_operand" "rO,J,m,rO,*f,rO,*f"))]
287 "ia64_move_ok (operands[0], operands[1])"
296 [(set_attr "itanium_class" "ialu,ialu,ld,st,frfr,tofr,fmisc")])
298 (define_expand "movsi"
299 [(set (match_operand:SI 0 "general_operand" "")
300 (match_operand:SI 1 "general_operand" ""))]
303 rtx op1 = ia64_expand_move (operands[0], operands[1]);
309 (define_insn "*movsi_internal"
310 [(set (match_operand:SI 0 "destination_operand" "=r,r,r,r, m, r,*f,*f, r,*d")
311 (match_operand:SI 1 "move_operand" "rO,J,i,m,rO,*f,rO,*f,*d,rK"))]
312 "ia64_move_ok (operands[0], operands[1])"
324 ;; frar_m, toar_m ??? why not frar_i and toar_i
325 [(set_attr "itanium_class" "ialu,ialu,long_i,ld,st,frfr,tofr,fmisc,frar_m,toar_m")])
327 (define_expand "movdi"
328 [(set (match_operand:DI 0 "general_operand" "")
329 (match_operand:DI 1 "general_operand" ""))]
332 rtx op1 = ia64_expand_move (operands[0], operands[1]);
338 (define_insn "*movdi_internal"
339 [(set (match_operand:DI 0 "destination_operand"
340 "=r,r,r,r, m, r,*f,*f,*f, Q, r,*b, r,*e, r,*d, r,*c")
341 (match_operand:DI 1 "move_operand"
342 "rO,JT,i,m,rO,*f,rO,*f, Q,*f,*b,rO,*e,rK,*d,rK,*c,rO"))]
343 "ia64_move_ok (operands[0], operands[1])"
345 static const char * const alt[] = {
347 "%,addl %0 = %1, r0",
349 "%,ld8%O1 %0 = %1%P1",
350 "%,st8%Q0 %0 = %r1%P0",
351 "%,getf.sig %0 = %1",
352 "%,setf.sig %0 = %r1",
366 if (which_alternative == 2 && ! TARGET_NO_PIC
367 && symbolic_operand (operands[1], VOIDmode))
370 return alt[which_alternative];
372 [(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")])
375 [(set (match_operand 0 "register_operand" "")
376 (match_operand 1 "symbolic_operand" ""))]
377 "reload_completed && ! TARGET_NO_PIC"
380 ia64_expand_load_address (operands[0], operands[1]);
384 (define_expand "load_fptr"
386 (plus:DI (reg:DI 1) (match_operand 1 "function_operand" "")))
387 (set (match_operand:DI 0 "register_operand" "") (match_dup 3))]
390 operands[2] = no_new_pseudos ? operands[0] : gen_reg_rtx (DImode);
391 operands[3] = gen_const_mem (DImode, operands[2]);
394 (define_insn "*load_fptr_internal1"
395 [(set (match_operand:DI 0 "register_operand" "=r")
396 (plus:DI (reg:DI 1) (match_operand 1 "function_operand" "s")))]
398 "addl %0 = @ltoff(@fptr(%1)), gp"
399 [(set_attr "itanium_class" "ialu")])
401 (define_insn "load_gprel"
402 [(set (match_operand:DI 0 "register_operand" "=r")
403 (plus:DI (reg:DI 1) (match_operand 1 "sdata_symbolic_operand" "s")))]
405 "addl %0 = @gprel(%1), gp"
406 [(set_attr "itanium_class" "ialu")])
408 (define_insn "gprel64_offset"
409 [(set (match_operand:DI 0 "register_operand" "=r")
410 (minus:DI (match_operand:DI 1 "symbolic_operand" "") (reg:DI 1)))]
412 "movl %0 = @gprel(%1)"
413 [(set_attr "itanium_class" "long_i")])
415 (define_expand "load_gprel64"
417 (minus:DI (match_operand:DI 1 "symbolic_operand" "") (match_dup 3)))
418 (set (match_operand:DI 0 "register_operand" "")
419 (plus:DI (match_dup 3) (match_dup 2)))]
422 operands[2] = no_new_pseudos ? operands[0] : gen_reg_rtx (DImode);
423 operands[3] = pic_offset_table_rtx;
426 ;; This is used as a placeholder for the return address during early
427 ;; compilation. We won't know where we've placed this until during
428 ;; reload, at which point it can wind up in b0, a general register,
429 ;; or memory. The only safe destination under these conditions is a
432 (define_insn_and_split "*movdi_ret_addr"
433 [(set (match_operand:DI 0 "register_operand" "=r")
434 (unspec:DI [(const_int 0)] UNSPEC_RET_ADDR))]
440 ia64_split_return_addr_rtx (operands[0]);
443 [(set_attr "itanium_class" "ialu")])
445 (define_insn "*load_symptr_high"
446 [(set (match_operand:DI 0 "register_operand" "=r")
447 (plus:DI (high:DI (match_operand 1 "got_symbolic_operand" "s"))
448 (match_operand:DI 2 "register_operand" "a")))]
451 if (HAVE_AS_LTOFFX_LDXMOV_RELOCS)
452 return "%,addl %0 = @ltoffx(%1), %2";
454 return "%,addl %0 = @ltoff(%1), %2";
456 [(set_attr "itanium_class" "ialu")])
458 (define_insn "*load_symptr_low"
459 [(set (match_operand:DI 0 "register_operand" "=r")
460 (lo_sum:DI (match_operand:DI 1 "register_operand" "r")
461 (match_operand 2 "got_symbolic_operand" "s")))]
464 if (HAVE_AS_LTOFFX_LDXMOV_RELOCS)
465 return "%,ld8.mov %0 = [%1], %2";
467 return "%,ld8 %0 = [%1]";
469 [(set_attr "itanium_class" "ld")])
471 (define_insn "load_ltoff_dtpmod"
472 [(set (match_operand:DI 0 "register_operand" "=r")
474 (unspec:DI [(match_operand:DI 1 "symbolic_operand" "")]
475 UNSPEC_LTOFF_DTPMOD)))]
477 "addl %0 = @ltoff(@dtpmod(%1)), gp"
478 [(set_attr "itanium_class" "ialu")])
480 (define_insn "load_ltoff_dtprel"
481 [(set (match_operand:DI 0 "register_operand" "=r")
483 (unspec:DI [(match_operand:DI 1 "symbolic_operand" "")]
484 UNSPEC_LTOFF_DTPREL)))]
486 "addl %0 = @ltoff(@dtprel(%1)), gp"
487 [(set_attr "itanium_class" "ialu")])
489 (define_expand "load_dtprel"
490 [(set (match_operand:DI 0 "register_operand" "")
491 (unspec:DI [(match_operand:DI 1 "symbolic_operand" "")]
496 (define_insn "*load_dtprel64"
497 [(set (match_operand:DI 0 "register_operand" "=r")
498 (unspec:DI [(match_operand:DI 1 "symbolic_operand" "")]
501 "movl %0 = @dtprel(%1)"
502 [(set_attr "itanium_class" "long_i")])
504 (define_insn "*load_dtprel22"
505 [(set (match_operand:DI 0 "register_operand" "=r")
506 (unspec:DI [(match_operand:DI 1 "symbolic_operand" "")]
509 "addl %0 = @dtprel(%1), r0"
510 [(set_attr "itanium_class" "ialu")])
512 (define_expand "add_dtprel"
513 [(set (match_operand:DI 0 "register_operand" "")
514 (plus:DI (match_operand:DI 1 "register_operand" "")
515 (unspec:DI [(match_operand:DI 2 "symbolic_operand" "")]
520 (define_insn "*add_dtprel14"
521 [(set (match_operand:DI 0 "register_operand" "=r")
522 (plus:DI (match_operand:DI 1 "register_operand" "r")
523 (unspec:DI [(match_operand:DI 2 "symbolic_operand" "")]
526 "adds %0 = @dtprel(%2), %1"
527 [(set_attr "itanium_class" "ialu")])
529 (define_insn "*add_dtprel22"
530 [(set (match_operand:DI 0 "register_operand" "=r")
531 (plus:DI (match_operand:DI 1 "register_operand" "a")
532 (unspec:DI [(match_operand:DI 2 "symbolic_operand" "")]
535 "addl %0 = @dtprel(%2), %1"
536 [(set_attr "itanium_class" "ialu")])
538 (define_insn "load_ltoff_tprel"
539 [(set (match_operand:DI 0 "register_operand" "=r")
541 (unspec:DI [(match_operand:DI 1 "symbolic_operand" "")]
542 UNSPEC_LTOFF_TPREL)))]
544 "addl %0 = @ltoff(@tprel(%1)), gp"
545 [(set_attr "itanium_class" "ialu")])
547 (define_expand "load_tprel"
548 [(set (match_operand:DI 0 "register_operand" "")
549 (unspec:DI [(match_operand:DI 1 "symbolic_operand" "")]
554 (define_insn "*load_tprel64"
555 [(set (match_operand:DI 0 "register_operand" "=r")
556 (unspec:DI [(match_operand:DI 1 "symbolic_operand" "")]
559 "movl %0 = @tprel(%1)"
560 [(set_attr "itanium_class" "long_i")])
562 (define_insn "*load_tprel22"
563 [(set (match_operand:DI 0 "register_operand" "=r")
564 (unspec:DI [(match_operand:DI 1 "symbolic_operand" "")]
567 "addl %0 = @tprel(%1), r0"
568 [(set_attr "itanium_class" "ialu")])
570 (define_expand "add_tprel"
571 [(set (match_operand:DI 0 "register_operand" "")
572 (plus:DI (match_operand:DI 1 "register_operand" "")
573 (unspec:DI [(match_operand:DI 2 "symbolic_operand" "")]
578 (define_insn "*add_tprel14"
579 [(set (match_operand:DI 0 "register_operand" "=r")
580 (plus:DI (match_operand:DI 1 "register_operand" "r")
581 (unspec:DI [(match_operand:DI 2 "symbolic_operand" "")]
584 "adds %0 = @tprel(%2), %1"
585 [(set_attr "itanium_class" "ialu")])
587 (define_insn "*add_tprel22"
588 [(set (match_operand:DI 0 "register_operand" "=r")
589 (plus:DI (match_operand:DI 1 "register_operand" "a")
590 (unspec:DI [(match_operand:DI 2 "symbolic_operand" "")]
593 "addl %0 = @tprel(%2), %1"
594 [(set_attr "itanium_class" "ialu")])
596 ;; With no offsettable memory references, we've got to have a scratch
597 ;; around to play with the second word. However, in order to avoid a
598 ;; reload nightmare we lie, claim we don't need one, and fix it up
599 ;; in ia64_split_tmode_move.
600 (define_expand "movti"
601 [(set (match_operand:TI 0 "general_operand" "")
602 (match_operand:TI 1 "general_operand" ""))]
605 rtx op1 = ia64_expand_move (operands[0], operands[1]);
611 (define_insn_and_split "*movti_internal"
612 [(set (match_operand:TI 0 "nonimmediate_operand" "=r,r,m")
613 (match_operand:TI 1 "general_operand" "ri,m,r"))]
614 "ia64_move_ok (operands[0], operands[1])"
619 ia64_split_tmode_move (operands);
622 [(set_attr "itanium_class" "unknown")
623 (set_attr "predicable" "no")])
625 ;; Floating Point Moves
627 ;; Note - Patterns for SF mode moves are compulsory, but
628 ;; patterns for DF are optional, as GCC can synthesize them.
630 (define_expand "movsf"
631 [(set (match_operand:SF 0 "general_operand" "")
632 (match_operand:SF 1 "general_operand" ""))]
635 rtx op1 = ia64_expand_move (operands[0], operands[1]);
641 (define_insn "*movsf_internal"
642 [(set (match_operand:SF 0 "destination_operand" "=f,f, Q,*r, f,*r,*r, m")
643 (match_operand:SF 1 "general_operand" "fG,Q,fG,fG,*r,*r, m,*r"))]
644 "ia64_move_ok (operands[0], operands[1])"
654 [(set_attr "itanium_class" "fmisc,fld,stf,frfr,tofr,ialu,ld,st")])
656 (define_expand "movdf"
657 [(set (match_operand:DF 0 "general_operand" "")
658 (match_operand:DF 1 "general_operand" ""))]
661 rtx op1 = ia64_expand_move (operands[0], operands[1]);
667 (define_insn "*movdf_internal"
668 [(set (match_operand:DF 0 "destination_operand" "=f,f, Q,*r, f,*r,*r, m")
669 (match_operand:DF 1 "general_operand" "fG,Q,fG,fG,*r,*r, m,*r"))]
670 "ia64_move_ok (operands[0], operands[1])"
680 [(set_attr "itanium_class" "fmisc,fld,stf,frfr,tofr,ialu,ld,st")])
682 ;; With no offsettable memory references, we've got to have a scratch
683 ;; around to play with the second word if the variable winds up in GRs.
684 (define_expand "movxf"
685 [(set (match_operand:XF 0 "general_operand" "")
686 (match_operand:XF 1 "general_operand" ""))]
689 rtx op0 = operands[0];
691 if (GET_CODE (op0) == SUBREG)
692 op0 = SUBREG_REG (op0);
694 /* We must support XFmode loads into general registers for stdarg/vararg,
695 unprototyped calls, and a rare case where a long double is passed as
696 an argument after a float HFA fills the FP registers. We split them into
697 DImode loads for convenience. We also need to support XFmode stores
698 for the last case. This case does not happen for stdarg/vararg routines,
699 because we do a block store to memory of unnamed arguments. */
701 if (GET_CODE (op0) == REG && GR_REGNO_P (REGNO (op0)))
703 /* We're hoping to transform everything that deals with XFmode
704 quantities and GR registers early in the compiler. */
708 /* Struct to register can just use TImode instead. */
709 if ((GET_CODE (operands[1]) == SUBREG
710 && GET_MODE (SUBREG_REG (operands[1])) == TImode)
711 || (GET_CODE (operands[1]) == REG
712 && GR_REGNO_P (REGNO (operands[1]))))
714 rtx op1 = operands[1];
716 if (GET_CODE (op1) == SUBREG)
717 op1 = SUBREG_REG (op1);
719 op1 = gen_rtx_REG (TImode, REGNO (op1));
721 emit_move_insn (gen_rtx_REG (TImode, REGNO (op0)), op1);
725 if (GET_CODE (operands[1]) == CONST_DOUBLE)
727 emit_move_insn (gen_rtx_REG (DImode, REGNO (op0)),
728 operand_subword (operands[1], 0, 0, XFmode));
729 emit_move_insn (gen_rtx_REG (DImode, REGNO (op0) + 1),
730 operand_subword (operands[1], 1, 0, XFmode));
734 /* If the quantity is in a register not known to be GR, spill it. */
735 if (register_operand (operands[1], XFmode))
736 operands[1] = spill_xfmode_operand (operands[1], 1);
738 if (GET_CODE (operands[1]) == MEM)
742 out[WORDS_BIG_ENDIAN] = gen_rtx_REG (DImode, REGNO (op0));
743 out[!WORDS_BIG_ENDIAN] = gen_rtx_REG (DImode, REGNO (op0) + 1);
745 emit_move_insn (out[0], adjust_address (operands[1], DImode, 0));
746 emit_move_insn (out[1], adjust_address (operands[1], DImode, 8));
753 if (GET_CODE (operands[1]) == REG && GR_REGNO_P (REGNO (operands[1])))
755 /* We're hoping to transform everything that deals with XFmode
756 quantities and GR registers early in the compiler. */
760 /* Op0 can't be a GR_REG here, as that case is handled above.
761 If op0 is a register, then we spill op1, so that we now have a
762 MEM operand. This requires creating an XFmode subreg of a TImode reg
763 to force the spill. */
764 if (register_operand (operands[0], XFmode))
766 rtx op1 = gen_rtx_REG (TImode, REGNO (operands[1]));
767 op1 = gen_rtx_SUBREG (XFmode, op1, 0);
768 operands[1] = spill_xfmode_operand (op1, 0);
771 else if (GET_CODE (operands[0]) == MEM)
775 in[WORDS_BIG_ENDIAN] = gen_rtx_REG (DImode, REGNO (operands[1]));
776 in[!WORDS_BIG_ENDIAN] = gen_rtx_REG (DImode, REGNO (operands[1]) + 1);
778 emit_move_insn (adjust_address (operands[0], DImode, 0), in[0]);
779 emit_move_insn (adjust_address (operands[0], DImode, 8), in[1]);
787 if (! reload_in_progress && ! reload_completed)
789 operands[1] = spill_xfmode_operand (operands[1], 0);
791 if (GET_MODE (op0) == TImode && GET_CODE (op0) == REG)
793 rtx memt, memx, in = operands[1];
795 in = validize_mem (force_const_mem (XFmode, in));
796 if (GET_CODE (in) == MEM)
797 memt = adjust_address (in, TImode, 0);
800 memt = assign_stack_temp (TImode, 16, 0);
801 memx = adjust_address (memt, XFmode, 0);
802 emit_move_insn (memx, in);
804 emit_move_insn (op0, memt);
808 if (! ia64_move_ok (operands[0], operands[1]))
809 operands[1] = force_reg (XFmode, operands[1]);
813 ;; ??? There's no easy way to mind volatile acquire/release semantics.
815 (define_insn "*movxf_internal"
816 [(set (match_operand:XF 0 "destination_operand" "=f,f, m")
817 (match_operand:XF 1 "general_operand" "fG,m,fG"))]
818 "ia64_move_ok (operands[0], operands[1])"
823 [(set_attr "itanium_class" "fmisc,fld,stf")])
825 ;; Better code generation via insns that deal with TFmode register pairs
826 ;; directly. Same concerns apply as for TImode.
827 (define_expand "movtf"
828 [(set (match_operand:TF 0 "general_operand" "")
829 (match_operand:TF 1 "general_operand" ""))]
832 rtx op1 = ia64_expand_move (operands[0], operands[1]);
838 (define_insn_and_split "*movtf_internal"
839 [(set (match_operand:TF 0 "destination_operand" "=r,r,m")
840 (match_operand:TF 1 "general_operand" "ri,m,r"))]
841 "ia64_move_ok (operands[0], operands[1])"
846 ia64_split_tmode_move (operands);
849 [(set_attr "itanium_class" "unknown")
850 (set_attr "predicable" "no")])
853 ;; ::::::::::::::::::::
857 ;; ::::::::::::::::::::
859 ;; Signed conversions from a smaller integer to a larger integer
861 (define_insn "extendqidi2"
862 [(set (match_operand:DI 0 "gr_register_operand" "=r")
863 (sign_extend:DI (match_operand:QI 1 "gr_register_operand" "r")))]
866 [(set_attr "itanium_class" "xtd")])
868 (define_insn "extendhidi2"
869 [(set (match_operand:DI 0 "gr_register_operand" "=r")
870 (sign_extend:DI (match_operand:HI 1 "gr_register_operand" "r")))]
873 [(set_attr "itanium_class" "xtd")])
875 (define_insn "extendsidi2"
876 [(set (match_operand:DI 0 "grfr_register_operand" "=r,?f")
877 (sign_extend:DI (match_operand:SI 1 "grfr_register_operand" "r,f")))]
882 [(set_attr "itanium_class" "xtd,fmisc")])
884 ;; Unsigned conversions from a smaller integer to a larger integer
886 (define_insn "zero_extendqidi2"
887 [(set (match_operand:DI 0 "gr_register_operand" "=r,r")
888 (zero_extend:DI (match_operand:QI 1 "gr_nonimmediate_operand" "r,m")))]
893 [(set_attr "itanium_class" "xtd,ld")])
895 (define_insn "zero_extendhidi2"
896 [(set (match_operand:DI 0 "gr_register_operand" "=r,r")
897 (zero_extend:DI (match_operand:HI 1 "gr_nonimmediate_operand" "r,m")))]
902 [(set_attr "itanium_class" "xtd,ld")])
904 (define_insn "zero_extendsidi2"
905 [(set (match_operand:DI 0 "grfr_register_operand" "=r,r,?f")
907 (match_operand:SI 1 "grfr_nonimmediate_operand" "r,m,f")))]
913 [(set_attr "itanium_class" "ialu,ld,fmisc")])
915 ;; Convert between floating point types of different sizes.
917 ;; At first glance, it would appear that emitting fnorm for an extending
918 ;; conversion is unnecessary. However, the stf and getf instructions work
919 ;; correctly only if the input is properly rounded for its type. In
920 ;; particular, we get the wrong result for getf.d/stfd if the input is a
921 ;; denorm single. Since we don't know what the next instruction will be, we
922 ;; have to emit an fnorm.
924 ;; ??? Optimization opportunity here. Get rid of the insn altogether
925 ;; when we can. Should probably use a scheme like has been proposed
926 ;; for ia32 in dealing with operands that match unary operators. This
927 ;; would let combine merge the thing into adjacent insns. See also how the
928 ;; mips port handles SIGN_EXTEND as operands to integer arithmetic insns via
929 ;; se_register_operand.
931 (define_insn "extendsfdf2"
932 [(set (match_operand:DF 0 "fr_register_operand" "=f")
933 (float_extend:DF (match_operand:SF 1 "fr_register_operand" "f")))]
936 [(set_attr "itanium_class" "fmac")])
938 (define_insn "extendsfxf2"
939 [(set (match_operand:XF 0 "fr_register_operand" "=f")
940 (float_extend:XF (match_operand:SF 1 "fr_register_operand" "f")))]
943 [(set_attr "itanium_class" "fmac")])
945 (define_insn "extenddfxf2"
946 [(set (match_operand:XF 0 "fr_register_operand" "=f")
947 (float_extend:XF (match_operand:DF 1 "fr_register_operand" "f")))]
950 [(set_attr "itanium_class" "fmac")])
952 (define_insn "truncdfsf2"
953 [(set (match_operand:SF 0 "fr_register_operand" "=f")
954 (float_truncate:SF (match_operand:DF 1 "fr_register_operand" "f")))]
957 [(set_attr "itanium_class" "fmac")])
959 (define_insn "truncxfsf2"
960 [(set (match_operand:SF 0 "fr_register_operand" "=f")
961 (float_truncate:SF (match_operand:XF 1 "fr_register_operand" "f")))]
964 [(set_attr "itanium_class" "fmac")])
966 (define_insn "truncxfdf2"
967 [(set (match_operand:DF 0 "fr_register_operand" "=f")
968 (float_truncate:DF (match_operand:XF 1 "fr_register_operand" "f")))]
971 [(set_attr "itanium_class" "fmac")])
973 ;; Convert between signed integer types and floating point.
975 (define_insn "floatdixf2"
976 [(set (match_operand:XF 0 "fr_register_operand" "=f")
977 (float:XF (match_operand:DI 1 "fr_register_operand" "f")))]
980 [(set_attr "itanium_class" "fcvtfx")])
982 (define_insn "fix_truncsfdi2"
983 [(set (match_operand:DI 0 "fr_register_operand" "=f")
984 (fix:DI (match_operand:SF 1 "fr_register_operand" "f")))]
986 "fcvt.fx.trunc %0 = %1"
987 [(set_attr "itanium_class" "fcvtfx")])
989 (define_insn "fix_truncdfdi2"
990 [(set (match_operand:DI 0 "fr_register_operand" "=f")
991 (fix:DI (match_operand:DF 1 "fr_register_operand" "f")))]
993 "fcvt.fx.trunc %0 = %1"
994 [(set_attr "itanium_class" "fcvtfx")])
996 (define_insn "fix_truncxfdi2"
997 [(set (match_operand:DI 0 "fr_register_operand" "=f")
998 (fix:DI (match_operand:XF 1 "fr_register_operand" "f")))]
1000 "fcvt.fx.trunc %0 = %1"
1001 [(set_attr "itanium_class" "fcvtfx")])
1003 (define_insn "fix_truncxfdi2_alts"
1004 [(set (match_operand:DI 0 "fr_register_operand" "=f")
1005 (fix:DI (match_operand:XF 1 "fr_register_operand" "f")))
1006 (use (match_operand:SI 2 "const_int_operand" ""))]
1008 "fcvt.fx.trunc.s%2 %0 = %1"
1009 [(set_attr "itanium_class" "fcvtfx")])
1011 ;; Convert between unsigned integer types and floating point.
1013 (define_insn "floatunsdisf2"
1014 [(set (match_operand:SF 0 "fr_register_operand" "=f")
1015 (unsigned_float:SF (match_operand:DI 1 "fr_register_operand" "f")))]
1017 "fcvt.xuf.s %0 = %1"
1018 [(set_attr "itanium_class" "fcvtfx")])
1020 (define_insn "floatunsdidf2"
1021 [(set (match_operand:DF 0 "fr_register_operand" "=f")
1022 (unsigned_float:DF (match_operand:DI 1 "fr_register_operand" "f")))]
1024 "fcvt.xuf.d %0 = %1"
1025 [(set_attr "itanium_class" "fcvtfx")])
1027 (define_insn "floatunsdixf2"
1028 [(set (match_operand:XF 0 "fr_register_operand" "=f")
1029 (unsigned_float:XF (match_operand:DI 1 "fr_register_operand" "f")))]
1032 [(set_attr "itanium_class" "fcvtfx")])
1034 (define_insn "fixuns_truncsfdi2"
1035 [(set (match_operand:DI 0 "fr_register_operand" "=f")
1036 (unsigned_fix:DI (match_operand:SF 1 "fr_register_operand" "f")))]
1038 "fcvt.fxu.trunc %0 = %1"
1039 [(set_attr "itanium_class" "fcvtfx")])
1041 (define_insn "fixuns_truncdfdi2"
1042 [(set (match_operand:DI 0 "fr_register_operand" "=f")
1043 (unsigned_fix:DI (match_operand:DF 1 "fr_register_operand" "f")))]
1045 "fcvt.fxu.trunc %0 = %1"
1046 [(set_attr "itanium_class" "fcvtfx")])
1048 (define_insn "fixuns_truncxfdi2"
1049 [(set (match_operand:DI 0 "fr_register_operand" "=f")
1050 (unsigned_fix:DI (match_operand:XF 1 "fr_register_operand" "f")))]
1052 "fcvt.fxu.trunc %0 = %1"
1053 [(set_attr "itanium_class" "fcvtfx")])
1055 (define_insn "fixuns_truncxfdi2_alts"
1056 [(set (match_operand:DI 0 "fr_register_operand" "=f")
1057 (unsigned_fix:DI (match_operand:XF 1 "fr_register_operand" "f")))
1058 (use (match_operand:SI 2 "const_int_operand" ""))]
1060 "fcvt.fxu.trunc.s%2 %0 = %1"
1061 [(set_attr "itanium_class" "fcvtfx")])
1063 ;; ::::::::::::::::::::
1065 ;; :: Bit field extraction
1067 ;; ::::::::::::::::::::
1070 [(set (match_operand:DI 0 "gr_register_operand" "=r")
1071 (sign_extract:DI (match_operand:DI 1 "gr_register_operand" "r")
1072 (match_operand:DI 2 "const_int_operand" "n")
1073 (match_operand:DI 3 "const_int_operand" "n")))]
1075 "extr %0 = %1, %3, %2"
1076 [(set_attr "itanium_class" "ishf")])
1078 (define_insn "extzv"
1079 [(set (match_operand:DI 0 "gr_register_operand" "=r")
1080 (zero_extract:DI (match_operand:DI 1 "gr_register_operand" "r")
1081 (match_operand:DI 2 "const_int_operand" "n")
1082 (match_operand:DI 3 "const_int_operand" "n")))]
1084 "extr.u %0 = %1, %3, %2"
1085 [(set_attr "itanium_class" "ishf")])
1087 ;; Insert a bit field.
1088 ;; Can have 3 operands, source1 (inserter), source2 (insertee), dest.
1089 ;; Source1 can be 0 or -1.
1090 ;; Source2 can be 0.
1092 ;; ??? Actual dep instruction is more powerful than what these insv
1093 ;; patterns support. Unfortunately, combine is unable to create patterns
1094 ;; where source2 != dest.
1096 (define_expand "insv"
1097 [(set (zero_extract:DI (match_operand:DI 0 "gr_register_operand" "")
1098 (match_operand:DI 1 "const_int_operand" "")
1099 (match_operand:DI 2 "const_int_operand" ""))
1100 (match_operand:DI 3 "nonmemory_operand" ""))]
1103 int width = INTVAL (operands[1]);
1104 int shift = INTVAL (operands[2]);
1106 /* If operand[3] is a constant, and isn't 0 or -1, then load it into a
1108 if (! register_operand (operands[3], DImode)
1109 && operands[3] != const0_rtx && operands[3] != constm1_rtx)
1110 operands[3] = force_reg (DImode, operands[3]);
1112 /* If this is a single dep instruction, we have nothing to do. */
1113 if (! ((register_operand (operands[3], DImode) && width <= 16)
1114 || operands[3] == const0_rtx || operands[3] == constm1_rtx))
1116 /* Check for cases that can be implemented with a mix instruction. */
1117 if (width == 32 && shift == 0)
1119 /* Directly generating the mix4left instruction confuses
1120 optimize_bit_field in function.c. Since this is performing
1121 a useful optimization, we defer generation of the complicated
1122 mix4left RTL to the first splitting phase. */
1123 rtx tmp = gen_reg_rtx (DImode);
1124 emit_insn (gen_shift_mix4left (operands[0], operands[3], tmp));
1127 else if (width == 32 && shift == 32)
1129 emit_insn (gen_mix4right (operands[0], operands[3]));
1133 /* We could handle remaining cases by emitting multiple dep
1136 If we need more than two dep instructions then we lose. A 6
1137 insn sequence mov mask1,mov mask2,shl;;and,and;;or is better than
1138 mov;;dep,shr;;dep,shr;;dep. The former can be executed in 3 cycles,
1139 the latter is 6 cycles on an Itanium (TM) processor, because there is
1140 only one function unit that can execute dep and shr immed.
1142 If we only need two dep instruction, then we still lose.
1143 mov;;dep,shr;;dep is still 4 cycles. Even if we optimize away
1144 the unnecessary mov, this is still undesirable because it will be
1145 hard to optimize, and it creates unnecessary pressure on the I0
1151 /* This code may be useful for other IA-64 processors, so we leave it in
1157 emit_insn (gen_insv (operands[0], GEN_INT (16), GEN_INT (shift),
1161 tmp = gen_reg_rtx (DImode);
1162 emit_insn (gen_lshrdi3 (tmp, operands[3], GEN_INT (16)));
1165 operands[1] = GEN_INT (width);
1166 operands[2] = GEN_INT (shift);
1171 (define_insn "*insv_internal"
1172 [(set (zero_extract:DI (match_operand:DI 0 "gr_register_operand" "+r")
1173 (match_operand:DI 1 "const_int_operand" "n")
1174 (match_operand:DI 2 "const_int_operand" "n"))
1175 (match_operand:DI 3 "nonmemory_operand" "rP"))]
1176 "(gr_register_operand (operands[3], DImode) && INTVAL (operands[1]) <= 16)
1177 || operands[3] == const0_rtx || operands[3] == constm1_rtx"
1178 "dep %0 = %3, %0, %2, %1"
1179 [(set_attr "itanium_class" "ishf")])
1181 ;; Combine doesn't like to create bit-field insertions into zero.
1182 (define_insn "*shladdp4_internal"
1183 [(set (match_operand:DI 0 "gr_register_operand" "=r")
1184 (and:DI (ashift:DI (match_operand:DI 1 "gr_register_operand" "r")
1185 (match_operand:DI 2 "shladd_log2_operand" "n"))
1186 (match_operand:DI 3 "const_int_operand" "n")))]
1187 "ia64_depz_field_mask (operands[3], operands[2]) + INTVAL (operands[2]) == 32"
1188 "shladdp4 %0 = %1, %2, r0"
1189 [(set_attr "itanium_class" "ialu")])
1191 (define_insn "*depz_internal"
1192 [(set (match_operand:DI 0 "gr_register_operand" "=r")
1193 (and:DI (ashift:DI (match_operand:DI 1 "gr_register_operand" "r")
1194 (match_operand:DI 2 "const_int_operand" "n"))
1195 (match_operand:DI 3 "const_int_operand" "n")))]
1196 "CONST_OK_FOR_M (INTVAL (operands[2]))
1197 && ia64_depz_field_mask (operands[3], operands[2]) > 0"
1199 operands[3] = GEN_INT (ia64_depz_field_mask (operands[3], operands[2]));
1200 return "%,dep.z %0 = %1, %2, %3";
1202 [(set_attr "itanium_class" "ishf")])
1204 (define_insn "shift_mix4left"
1205 [(set (zero_extract:DI (match_operand:DI 0 "gr_register_operand" "+r")
1206 (const_int 32) (const_int 0))
1207 (match_operand:DI 1 "gr_register_operand" "r"))
1208 (clobber (match_operand:DI 2 "gr_register_operand" "=r"))]
1211 [(set_attr "itanium_class" "unknown")])
1214 [(set (zero_extract:DI (match_operand:DI 0 "register_operand" "")
1215 (const_int 32) (const_int 0))
1216 (match_operand:DI 1 "register_operand" ""))
1217 (clobber (match_operand:DI 2 "register_operand" ""))]
1219 [(set (match_dup 3) (ashift:DI (match_dup 1) (const_int 32)))
1220 (set (zero_extract:DI (match_dup 0) (const_int 32) (const_int 0))
1221 (lshiftrt:DI (match_dup 3) (const_int 32)))]
1222 "operands[3] = operands[2];")
1224 (define_insn "*mix4left"
1225 [(set (zero_extract:DI (match_operand:DI 0 "gr_register_operand" "+r")
1226 (const_int 32) (const_int 0))
1227 (lshiftrt:DI (match_operand:DI 1 "gr_register_operand" "r")
1230 "mix4.l %0 = %0, %r1"
1231 [(set_attr "itanium_class" "mmshf")])
1233 (define_insn "mix4right"
1234 [(set (zero_extract:DI (match_operand:DI 0 "gr_register_operand" "+r")
1235 (const_int 32) (const_int 32))
1236 (match_operand:DI 1 "gr_reg_or_0_operand" "rO"))]
1238 "mix4.r %0 = %r1, %0"
1239 [(set_attr "itanium_class" "mmshf")])
1241 ;; This is used by the rotrsi3 pattern.
1243 (define_insn "*mix4right_3op"
1244 [(set (match_operand:DI 0 "gr_register_operand" "=r")
1245 (ior:DI (zero_extend:DI (match_operand:SI 1 "gr_register_operand" "r"))
1246 (ashift:DI (zero_extend:DI
1247 (match_operand:SI 2 "gr_register_operand" "r"))
1250 "mix4.r %0 = %2, %1"
1251 [(set_attr "itanium_class" "mmshf")])
1254 ;; ::::::::::::::::::::
1256 ;; :: 1 bit Integer arithmetic
1258 ;; ::::::::::::::::::::
1260 (define_insn_and_split "andbi3"
1261 [(set (match_operand:BI 0 "register_operand" "=c,c,r")
1262 (and:BI (match_operand:BI 1 "register_operand" "%0,0,r")
1263 (match_operand:BI 2 "register_operand" "c,r,r")))]
1267 tbit.nz.and.orcm %0, %I0 = %2, 0
1270 && GET_CODE (operands[0]) == REG && PR_REGNO_P (REGNO (operands[0]))
1271 && GET_CODE (operands[2]) == REG && PR_REGNO_P (REGNO (operands[2]))"
1272 [(cond_exec (eq (match_dup 2) (const_int 0))
1273 (set (match_dup 0) (and:BI (ne:BI (const_int 0) (const_int 0))
1276 [(set_attr "itanium_class" "unknown,tbit,ilog")])
1278 (define_insn_and_split "*andcmbi3"
1279 [(set (match_operand:BI 0 "register_operand" "=c,c,r")
1280 (and:BI (not:BI (match_operand:BI 1 "register_operand" "c,r,r"))
1281 (match_operand:BI 2 "register_operand" "0,0,r")))]
1285 tbit.z.and.orcm %0, %I0 = %1, 0
1288 && GET_CODE (operands[0]) == REG && PR_REGNO_P (REGNO (operands[0]))
1289 && GET_CODE (operands[1]) == REG && PR_REGNO_P (REGNO (operands[1]))"
1290 [(cond_exec (ne (match_dup 1) (const_int 0))
1291 (set (match_dup 0) (and:BI (ne:BI (const_int 0) (const_int 0))
1294 [(set_attr "itanium_class" "unknown,tbit,ilog")])
1296 (define_insn_and_split "iorbi3"
1297 [(set (match_operand:BI 0 "register_operand" "=c,c,r")
1298 (ior:BI (match_operand:BI 1 "register_operand" "%0,0,r")
1299 (match_operand:BI 2 "register_operand" "c,r,r")))]
1303 tbit.nz.or.andcm %0, %I0 = %2, 0
1306 && GET_CODE (operands[0]) == REG && PR_REGNO_P (REGNO (operands[0]))
1307 && GET_CODE (operands[2]) == REG && PR_REGNO_P (REGNO (operands[2]))"
1308 [(cond_exec (ne (match_dup 2) (const_int 0))
1309 (set (match_dup 0) (ior:BI (eq:BI (const_int 0) (const_int 0))
1312 [(set_attr "itanium_class" "unknown,tbit,ilog")])
1314 (define_insn_and_split "*iorcmbi3"
1315 [(set (match_operand:BI 0 "register_operand" "=c,c")
1316 (ior:BI (not:BI (match_operand:BI 1 "register_operand" "c,r"))
1317 (match_operand:BI 2 "register_operand" "0,0")))]
1321 tbit.z.or.andcm %0, %I0 = %1, 0"
1323 && GET_CODE (operands[0]) == REG && PR_REGNO_P (REGNO (operands[0]))
1324 && GET_CODE (operands[1]) == REG && PR_REGNO_P (REGNO (operands[1]))"
1325 [(cond_exec (eq (match_dup 1) (const_int 0))
1326 (set (match_dup 0) (ior:BI (eq:BI (const_int 0) (const_int 0))
1329 [(set_attr "itanium_class" "unknown,tbit")])
1331 (define_insn "one_cmplbi2"
1332 [(set (match_operand:BI 0 "register_operand" "=c,r,c,&c")
1333 (not:BI (match_operand:BI 1 "register_operand" "r,r,0,c")))
1334 (clobber (match_scratch:BI 2 "=X,X,c,X"))]
1337 tbit.z %0, %I0 = %1, 0
1341 [(set_attr "itanium_class" "tbit,ilog,unknown,unknown")])
1344 [(set (match_operand:BI 0 "register_operand" "")
1345 (not:BI (match_operand:BI 1 "register_operand" "")))
1346 (clobber (match_scratch:BI 2 ""))]
1348 && GET_CODE (operands[0]) == REG && PR_REGNO_P (REGNO (operands[0]))
1349 && rtx_equal_p (operands[0], operands[1])"
1350 [(set (match_dup 4) (match_dup 3))
1351 (set (match_dup 0) (const_int 1))
1352 (cond_exec (ne (match_dup 2) (const_int 0))
1353 (set (match_dup 0) (const_int 0)))
1354 (set (match_dup 0) (unspec:BI [(match_dup 0)] UNSPEC_PRED_REL_MUTEX))]
1355 "operands[3] = gen_rtx_REG (CCImode, REGNO (operands[1]));
1356 operands[4] = gen_rtx_REG (CCImode, REGNO (operands[2]));")
1359 [(set (match_operand:BI 0 "register_operand" "")
1360 (not:BI (match_operand:BI 1 "register_operand" "")))
1361 (clobber (match_scratch:BI 2 ""))]
1363 && GET_CODE (operands[0]) == REG && PR_REGNO_P (REGNO (operands[0]))
1364 && GET_CODE (operands[1]) == REG && PR_REGNO_P (REGNO (operands[1]))
1365 && ! rtx_equal_p (operands[0], operands[1])"
1366 [(cond_exec (ne (match_dup 1) (const_int 0))
1367 (set (match_dup 0) (const_int 0)))
1368 (cond_exec (eq (match_dup 1) (const_int 0))
1369 (set (match_dup 0) (const_int 1)))
1370 (set (match_dup 0) (unspec:BI [(match_dup 0)] UNSPEC_PRED_REL_MUTEX))]
1373 (define_insn "*cmpsi_and_0"
1374 [(set (match_operand:BI 0 "register_operand" "=c")
1375 (and:BI (match_operator:BI 4 "predicate_operator"
1376 [(match_operand:SI 2 "gr_reg_or_0_operand" "rO")
1377 (match_operand:SI 3 "gr_reg_or_8bit_operand" "rK")])
1378 (match_operand:BI 1 "register_operand" "0")))]
1380 "cmp4.%C4.and.orcm %0, %I0 = %3, %r2"
1381 [(set_attr "itanium_class" "icmp")])
1383 (define_insn "*cmpsi_and_1"
1384 [(set (match_operand:BI 0 "register_operand" "=c")
1385 (and:BI (match_operator:BI 3 "signed_inequality_operator"
1386 [(match_operand:SI 2 "gr_register_operand" "r")
1388 (match_operand:BI 1 "register_operand" "0")))]
1390 "cmp4.%C3.and.orcm %0, %I0 = r0, %2"
1391 [(set_attr "itanium_class" "icmp")])
1393 (define_insn "*cmpsi_andnot_0"
1394 [(set (match_operand:BI 0 "register_operand" "=c")
1395 (and:BI (not:BI (match_operator:BI 4 "predicate_operator"
1396 [(match_operand:SI 2 "gr_reg_or_0_operand" "rO")
1397 (match_operand:SI 3 "gr_reg_or_8bit_operand" "rK")]))
1398 (match_operand:BI 1 "register_operand" "0")))]
1400 "cmp4.%C4.or.andcm %I0, %0 = %3, %r2"
1401 [(set_attr "itanium_class" "icmp")])
1403 (define_insn "*cmpsi_andnot_1"
1404 [(set (match_operand:BI 0 "register_operand" "=c")
1405 (and:BI (not:BI (match_operator:BI 3 "signed_inequality_operator"
1406 [(match_operand:SI 2 "gr_register_operand" "r")
1408 (match_operand:BI 1 "register_operand" "0")))]
1410 "cmp4.%C3.or.andcm %I0, %0 = r0, %2"
1411 [(set_attr "itanium_class" "icmp")])
1413 (define_insn "*cmpdi_and_0"
1414 [(set (match_operand:BI 0 "register_operand" "=c")
1415 (and:BI (match_operator:BI 4 "predicate_operator"
1416 [(match_operand:DI 2 "gr_register_operand" "r")
1417 (match_operand:DI 3 "gr_reg_or_8bit_operand" "rK")])
1418 (match_operand:BI 1 "register_operand" "0")))]
1420 "cmp.%C4.and.orcm %0, %I0 = %3, %2"
1421 [(set_attr "itanium_class" "icmp")])
1423 (define_insn "*cmpdi_and_1"
1424 [(set (match_operand:BI 0 "register_operand" "=c")
1425 (and:BI (match_operator:BI 3 "signed_inequality_operator"
1426 [(match_operand:DI 2 "gr_register_operand" "r")
1428 (match_operand:BI 1 "register_operand" "0")))]
1430 "cmp.%C3.and.orcm %0, %I0 = r0, %2"
1431 [(set_attr "itanium_class" "icmp")])
1433 (define_insn "*cmpdi_andnot_0"
1434 [(set (match_operand:BI 0 "register_operand" "=c")
1435 (and:BI (not:BI (match_operator:BI 4 "predicate_operator"
1436 [(match_operand:DI 2 "gr_register_operand" "r")
1437 (match_operand:DI 3 "gr_reg_or_8bit_operand" "rK")]))
1438 (match_operand:BI 1 "register_operand" "0")))]
1440 "cmp.%C4.or.andcm %I0, %0 = %3, %2"
1441 [(set_attr "itanium_class" "icmp")])
1443 (define_insn "*cmpdi_andnot_1"
1444 [(set (match_operand:BI 0 "register_operand" "=c")
1445 (and:BI (not:BI (match_operator:BI 3 "signed_inequality_operator"
1446 [(match_operand:DI 2 "gr_register_operand" "r")
1448 (match_operand:BI 1 "register_operand" "0")))]
1450 "cmp.%C3.or.andcm %I0, %0 = r0, %2"
1451 [(set_attr "itanium_class" "icmp")])
1453 (define_insn "*tbit_and_0"
1454 [(set (match_operand:BI 0 "register_operand" "=c")
1455 (and:BI (ne:BI (and:DI (match_operand:DI 1 "gr_register_operand" "r")
1458 (match_operand:BI 2 "register_operand" "0")))]
1460 "tbit.nz.and.orcm %0, %I0 = %1, 0"
1461 [(set_attr "itanium_class" "tbit")])
1463 (define_insn "*tbit_and_1"
1464 [(set (match_operand:BI 0 "register_operand" "=c")
1465 (and:BI (eq:BI (and:DI (match_operand:DI 1 "gr_register_operand" "r")
1468 (match_operand:BI 2 "register_operand" "0")))]
1470 "tbit.z.and.orcm %0, %I0 = %1, 0"
1471 [(set_attr "itanium_class" "tbit")])
1473 (define_insn "*tbit_and_2"
1474 [(set (match_operand:BI 0 "register_operand" "=c")
1475 (and:BI (ne:BI (zero_extract:DI
1476 (match_operand:DI 1 "gr_register_operand" "r")
1478 (match_operand:DI 2 "const_int_operand" "n"))
1480 (match_operand:BI 3 "register_operand" "0")))]
1482 "tbit.nz.and.orcm %0, %I0 = %1, %2"
1483 [(set_attr "itanium_class" "tbit")])
1485 (define_insn "*tbit_and_3"
1486 [(set (match_operand:BI 0 "register_operand" "=c")
1487 (and:BI (eq:BI (zero_extract:DI
1488 (match_operand:DI 1 "gr_register_operand" "r")
1490 (match_operand:DI 2 "const_int_operand" "n"))
1492 (match_operand:BI 3 "register_operand" "0")))]
1494 "tbit.z.and.orcm %0, %I0 = %1, %2"
1495 [(set_attr "itanium_class" "tbit")])
1497 (define_insn "*cmpsi_or_0"
1498 [(set (match_operand:BI 0 "register_operand" "=c")
1499 (ior:BI (match_operator:BI 4 "predicate_operator"
1500 [(match_operand:SI 2 "gr_reg_or_0_operand" "rO")
1501 (match_operand:SI 3 "gr_reg_or_8bit_operand" "rK")])
1502 (match_operand:BI 1 "register_operand" "0")))]
1504 "cmp4.%C4.or.andcm %0, %I0 = %3, %r2"
1505 [(set_attr "itanium_class" "icmp")])
1507 (define_insn "*cmpsi_or_1"
1508 [(set (match_operand:BI 0 "register_operand" "=c")
1509 (ior:BI (match_operator:BI 3 "signed_inequality_operator"
1510 [(match_operand:SI 2 "gr_register_operand" "r")
1512 (match_operand:BI 1 "register_operand" "0")))]
1514 "cmp4.%C3.or.andcm %0, %I0 = r0, %2"
1515 [(set_attr "itanium_class" "icmp")])
1517 (define_insn "*cmpsi_orcm_0"
1518 [(set (match_operand:BI 0 "register_operand" "=c")
1519 (ior:BI (not:BI (match_operator:BI 4 "predicate_operator"
1520 [(match_operand:SI 2 "gr_reg_or_0_operand" "rO")
1521 (match_operand:SI 3 "gr_reg_or_8bit_operand" "rK")]))
1522 (match_operand:BI 1 "register_operand" "0")))]
1524 "cmp4.%C4.and.orcm %I0, %0 = %3, %r2"
1525 [(set_attr "itanium_class" "icmp")])
1527 (define_insn "*cmpsi_orcm_1"
1528 [(set (match_operand:BI 0 "register_operand" "=c")
1529 (ior:BI (not:BI (match_operator:BI 3 "signed_inequality_operator"
1530 [(match_operand:SI 2 "gr_register_operand" "r")
1532 (match_operand:BI 1 "register_operand" "0")))]
1534 "cmp4.%C3.and.orcm %I0, %0 = r0, %2"
1535 [(set_attr "itanium_class" "icmp")])
1537 (define_insn "*cmpdi_or_0"
1538 [(set (match_operand:BI 0 "register_operand" "=c")
1539 (ior:BI (match_operator:BI 4 "predicate_operator"
1540 [(match_operand:DI 2 "gr_register_operand" "r")
1541 (match_operand:DI 3 "gr_reg_or_8bit_operand" "rK")])
1542 (match_operand:BI 1 "register_operand" "0")))]
1544 "cmp.%C4.or.andcm %0, %I0 = %3, %2"
1545 [(set_attr "itanium_class" "icmp")])
1547 (define_insn "*cmpdi_or_1"
1548 [(set (match_operand:BI 0 "register_operand" "=c")
1549 (ior:BI (match_operator:BI 3 "signed_inequality_operator"
1550 [(match_operand:DI 2 "gr_register_operand" "r")
1552 (match_operand:BI 1 "register_operand" "0")))]
1554 "cmp.%C3.or.andcm %0, %I0 = r0, %2"
1555 [(set_attr "itanium_class" "icmp")])
1557 (define_insn "*cmpdi_orcm_0"
1558 [(set (match_operand:BI 0 "register_operand" "=c")
1559 (ior:BI (not:BI (match_operator:BI 4 "predicate_operator"
1560 [(match_operand:DI 2 "gr_register_operand" "r")
1561 (match_operand:DI 3 "gr_reg_or_8bit_operand" "rK")]))
1562 (match_operand:BI 1 "register_operand" "0")))]
1564 "cmp.%C4.and.orcm %I0, %0 = %3, %2"
1565 [(set_attr "itanium_class" "icmp")])
1567 (define_insn "*cmpdi_orcm_1"
1568 [(set (match_operand:BI 0 "register_operand" "=c")
1569 (ior:BI (not:BI (match_operator:BI 3 "signed_inequality_operator"
1570 [(match_operand:DI 2 "gr_register_operand" "r")
1572 (match_operand:BI 1 "register_operand" "0")))]
1574 "cmp.%C3.and.orcm %I0, %0 = r0, %2"
1575 [(set_attr "itanium_class" "icmp")])
1577 (define_insn "*tbit_or_0"
1578 [(set (match_operand:BI 0 "register_operand" "=c")
1579 (ior:BI (ne:BI (and:DI (match_operand:DI 1 "gr_register_operand" "r")
1582 (match_operand:BI 2 "register_operand" "0")))]
1584 "tbit.nz.or.andcm %0, %I0 = %1, 0"
1585 [(set_attr "itanium_class" "tbit")])
1587 (define_insn "*tbit_or_1"
1588 [(set (match_operand:BI 0 "register_operand" "=c")
1589 (ior:BI (eq:BI (and:DI (match_operand:DI 1 "gr_register_operand" "r")
1592 (match_operand:BI 2 "register_operand" "0")))]
1594 "tbit.z.or.andcm %0, %I0 = %1, 0"
1595 [(set_attr "itanium_class" "tbit")])
1597 (define_insn "*tbit_or_2"
1598 [(set (match_operand:BI 0 "register_operand" "=c")
1599 (ior:BI (ne:BI (zero_extract:DI
1600 (match_operand:DI 1 "gr_register_operand" "r")
1602 (match_operand:DI 2 "const_int_operand" "n"))
1604 (match_operand:BI 3 "register_operand" "0")))]
1606 "tbit.nz.or.andcm %0, %I0 = %1, %2"
1607 [(set_attr "itanium_class" "tbit")])
1609 (define_insn "*tbit_or_3"
1610 [(set (match_operand:BI 0 "register_operand" "=c")
1611 (ior:BI (eq:BI (zero_extract:DI
1612 (match_operand:DI 1 "gr_register_operand" "r")
1614 (match_operand:DI 2 "const_int_operand" "n"))
1616 (match_operand:BI 3 "register_operand" "0")))]
1618 "tbit.z.or.andcm %0, %I0 = %1, %2"
1619 [(set_attr "itanium_class" "tbit")])
1621 ;; Transform test of and/or of setcc into parallel comparisons.
1624 [(set (match_operand:BI 0 "register_operand" "")
1625 (ne:BI (and:DI (ne:DI (match_operand:BI 2 "register_operand" "")
1627 (match_operand:DI 3 "register_operand" ""))
1631 (and:BI (ne:BI (and:DI (match_dup 3) (const_int 1)) (const_int 0))
1636 [(set (match_operand:BI 0 "register_operand" "")
1637 (eq:BI (and:DI (ne:DI (match_operand:BI 2 "register_operand" "")
1639 (match_operand:DI 3 "register_operand" ""))
1643 (and:BI (ne:BI (and:DI (match_dup 3) (const_int 1)) (const_int 0))
1645 (parallel [(set (match_dup 0) (not:BI (match_dup 0)))
1646 (clobber (scratch))])]
1650 [(set (match_operand:BI 0 "register_operand" "")
1651 (ne:BI (ior:DI (ne:DI (match_operand:BI 2 "register_operand" "")
1653 (match_operand:DI 3 "register_operand" ""))
1657 (ior:BI (ne:BI (match_dup 3) (const_int 0))
1662 [(set (match_operand:BI 0 "register_operand" "")
1663 (eq:BI (ior:DI (ne:DI (match_operand:BI 2 "register_operand" "")
1665 (match_operand:DI 3 "register_operand" ""))
1669 (ior:BI (ne:BI (match_dup 3) (const_int 0))
1671 (parallel [(set (match_dup 0) (not:BI (match_dup 0)))
1672 (clobber (scratch))])]
1675 ;; ??? Incredibly hackish. Either need four proper patterns with all
1676 ;; the alternatives, or rely on sched1 to split the insn and hope that
1677 ;; nothing bad happens to the comparisons in the meantime.
1679 ;; Alternately, adjust combine to allow 2->2 and 3->3 splits, assuming
1680 ;; that we're doing height reduction.
1682 ;(define_insn_and_split ""
1683 ; [(set (match_operand:BI 0 "register_operand" "=c")
1684 ; (and:BI (and:BI (match_operator:BI 1 "comparison_operator"
1685 ; [(match_operand 2 "" "")
1686 ; (match_operand 3 "" "")])
1687 ; (match_operator:BI 4 "comparison_operator"
1688 ; [(match_operand 5 "" "")
1689 ; (match_operand 6 "" "")]))
1691 ; "flag_schedule_insns"
1694 ; [(set (match_dup 0) (and:BI (match_dup 1) (match_dup 0)))
1695 ; (set (match_dup 0) (and:BI (match_dup 4) (match_dup 0)))]
1698 ;(define_insn_and_split ""
1699 ; [(set (match_operand:BI 0 "register_operand" "=c")
1700 ; (ior:BI (ior:BI (match_operator:BI 1 "comparison_operator"
1701 ; [(match_operand 2 "" "")
1702 ; (match_operand 3 "" "")])
1703 ; (match_operator:BI 4 "comparison_operator"
1704 ; [(match_operand 5 "" "")
1705 ; (match_operand 6 "" "")]))
1707 ; "flag_schedule_insns"
1710 ; [(set (match_dup 0) (ior:BI (match_dup 1) (match_dup 0)))
1711 ; (set (match_dup 0) (ior:BI (match_dup 4) (match_dup 0)))]
1715 ; [(set (match_operand:BI 0 "register_operand" "")
1716 ; (and:BI (and:BI (match_operator:BI 1 "comparison_operator"
1717 ; [(match_operand 2 "" "")
1718 ; (match_operand 3 "" "")])
1719 ; (match_operand:BI 7 "register_operand" ""))
1720 ; (and:BI (match_operator:BI 4 "comparison_operator"
1721 ; [(match_operand 5 "" "")
1722 ; (match_operand 6 "" "")])
1723 ; (match_operand:BI 8 "register_operand" ""))))]
1725 ; [(set (match_dup 0) (and:BI (match_dup 7) (match_dup 8)))
1726 ; (set (match_dup 0) (and:BI (and:BI (match_dup 1) (match_dup 4))
1731 ; [(set (match_operand:BI 0 "register_operand" "")
1732 ; (ior:BI (ior:BI (match_operator:BI 1 "comparison_operator"
1733 ; [(match_operand 2 "" "")
1734 ; (match_operand 3 "" "")])
1735 ; (match_operand:BI 7 "register_operand" ""))
1736 ; (ior:BI (match_operator:BI 4 "comparison_operator"
1737 ; [(match_operand 5 "" "")
1738 ; (match_operand 6 "" "")])
1739 ; (match_operand:BI 8 "register_operand" ""))))]
1741 ; [(set (match_dup 0) (ior:BI (match_dup 7) (match_dup 8)))
1742 ; (set (match_dup 0) (ior:BI (ior:BI (match_dup 1) (match_dup 4))
1746 ;; Try harder to avoid predicate copies by duplicating compares.
1747 ;; Note that we'll have already split the predicate copy, which
1748 ;; is kind of a pain, but oh well.
1751 [(set (match_operand:BI 0 "register_operand" "")
1752 (match_operand:BI 1 "comparison_operator" ""))
1753 (set (match_operand:CCI 2 "register_operand" "")
1754 (match_operand:CCI 3 "register_operand" ""))
1755 (set (match_operand:CCI 4 "register_operand" "")
1756 (match_operand:CCI 5 "register_operand" ""))
1757 (set (match_operand:BI 6 "register_operand" "")
1758 (unspec:BI [(match_dup 6)] UNSPEC_PRED_REL_MUTEX))]
1759 "REGNO (operands[3]) == REGNO (operands[0])
1760 && REGNO (operands[4]) == REGNO (operands[0]) + 1
1761 && REGNO (operands[4]) == REGNO (operands[2]) + 1
1762 && REGNO (operands[6]) == REGNO (operands[2])"
1763 [(set (match_dup 0) (match_dup 1))
1764 (set (match_dup 6) (match_dup 7))]
1765 "operands[7] = copy_rtx (operands[1]);")
1767 ;; ::::::::::::::::::::
1769 ;; :: 16 bit Integer arithmetic
1771 ;; ::::::::::::::::::::
1773 (define_insn "mulhi3"
1774 [(set (match_operand:HI 0 "gr_register_operand" "=r")
1775 (mult:HI (match_operand:HI 1 "gr_register_operand" "r")
1776 (match_operand:HI 2 "gr_register_operand" "r")))]
1778 "pmpy2.r %0 = %1, %2"
1779 [(set_attr "itanium_class" "mmmul")])
1782 ;; ::::::::::::::::::::
1784 ;; :: 32 bit Integer arithmetic
1786 ;; ::::::::::::::::::::
1788 (define_insn "addsi3"
1789 [(set (match_operand:SI 0 "gr_register_operand" "=r,r,r")
1790 (plus:SI (match_operand:SI 1 "gr_register_operand" "%r,r,a")
1791 (match_operand:SI 2 "gr_reg_or_22bit_operand" "r,I,J")))]
1797 [(set_attr "itanium_class" "ialu")])
1799 (define_insn "*addsi3_plus1"
1800 [(set (match_operand:SI 0 "gr_register_operand" "=r")
1801 (plus:SI (plus:SI (match_operand:SI 1 "gr_register_operand" "r")
1802 (match_operand:SI 2 "gr_register_operand" "r"))
1805 "add %0 = %1, %2, 1"
1806 [(set_attr "itanium_class" "ialu")])
1808 (define_insn "*addsi3_plus1_alt"
1809 [(set (match_operand:SI 0 "gr_register_operand" "=r")
1810 (plus:SI (mult:SI (match_operand:SI 1 "gr_register_operand" "r")
1814 "add %0 = %1, %1, 1"
1815 [(set_attr "itanium_class" "ialu")])
1817 (define_insn "*addsi3_shladd"
1818 [(set (match_operand:SI 0 "gr_register_operand" "=r")
1819 (plus:SI (mult:SI (match_operand:SI 1 "gr_register_operand" "r")
1820 (match_operand:SI 2 "shladd_operand" "n"))
1821 (match_operand:SI 3 "gr_register_operand" "r")))]
1823 "shladd %0 = %1, %S2, %3"
1824 [(set_attr "itanium_class" "ialu")])
1826 (define_insn "subsi3"
1827 [(set (match_operand:SI 0 "gr_register_operand" "=r")
1828 (minus:SI (match_operand:SI 1 "gr_reg_or_8bit_operand" "rK")
1829 (match_operand:SI 2 "gr_register_operand" "r")))]
1832 [(set_attr "itanium_class" "ialu")])
1834 (define_insn "*subsi3_minus1"
1835 [(set (match_operand:SI 0 "gr_register_operand" "=r")
1836 (plus:SI (not:SI (match_operand:SI 1 "gr_register_operand" "r"))
1837 (match_operand:SI 2 "gr_register_operand" "r")))]
1839 "sub %0 = %2, %1, 1"
1840 [(set_attr "itanium_class" "ialu")])
1842 ;; ??? Could add maddsi3 patterns patterned after the madddi3 patterns.
1844 (define_insn "mulsi3"
1845 [(set (match_operand:SI 0 "fr_register_operand" "=f")
1846 (mult:SI (match_operand:SI 1 "grfr_register_operand" "f")
1847 (match_operand:SI 2 "grfr_register_operand" "f")))]
1849 "xmpy.l %0 = %1, %2"
1850 [(set_attr "itanium_class" "xmpy")])
1852 (define_insn "maddsi4"
1853 [(set (match_operand:SI 0 "fr_register_operand" "=f")
1854 (plus:SI (mult:SI (match_operand:SI 1 "grfr_register_operand" "f")
1855 (match_operand:SI 2 "grfr_register_operand" "f"))
1856 (match_operand:SI 3 "grfr_register_operand" "f")))]
1858 "xma.l %0 = %1, %2, %3"
1859 [(set_attr "itanium_class" "xmpy")])
1861 (define_insn "negsi2"
1862 [(set (match_operand:SI 0 "gr_register_operand" "=r")
1863 (neg:SI (match_operand:SI 1 "gr_register_operand" "r")))]
1866 [(set_attr "itanium_class" "ialu")])
1868 (define_expand "abssi2"
1870 (ge:BI (match_operand:SI 1 "gr_register_operand" "") (const_int 0)))
1871 (set (match_operand:SI 0 "gr_register_operand" "")
1872 (if_then_else:SI (eq (match_dup 2) (const_int 0))
1873 (neg:SI (match_dup 1))
1876 { operands[2] = gen_reg_rtx (BImode); })
1878 (define_expand "sminsi3"
1880 (ge:BI (match_operand:SI 1 "gr_register_operand" "")
1881 (match_operand:SI 2 "gr_register_operand" "")))
1882 (set (match_operand:SI 0 "gr_register_operand" "")
1883 (if_then_else:SI (ne (match_dup 3) (const_int 0))
1884 (match_dup 2) (match_dup 1)))]
1886 { operands[3] = gen_reg_rtx (BImode); })
1888 (define_expand "smaxsi3"
1890 (ge:BI (match_operand:SI 1 "gr_register_operand" "")
1891 (match_operand:SI 2 "gr_register_operand" "")))
1892 (set (match_operand:SI 0 "gr_register_operand" "")
1893 (if_then_else:SI (ne (match_dup 3) (const_int 0))
1894 (match_dup 1) (match_dup 2)))]
1896 { operands[3] = gen_reg_rtx (BImode); })
1898 (define_expand "uminsi3"
1900 (geu:BI (match_operand:SI 1 "gr_register_operand" "")
1901 (match_operand:SI 2 "gr_register_operand" "")))
1902 (set (match_operand:SI 0 "gr_register_operand" "")
1903 (if_then_else:SI (ne (match_dup 3) (const_int 0))
1904 (match_dup 2) (match_dup 1)))]
1906 { operands[3] = gen_reg_rtx (BImode); })
1908 (define_expand "umaxsi3"
1910 (geu:BI (match_operand:SI 1 "gr_register_operand" "")
1911 (match_operand:SI 2 "gr_register_operand" "")))
1912 (set (match_operand:SI 0 "gr_register_operand" "")
1913 (if_then_else:SI (ne (match_dup 3) (const_int 0))
1914 (match_dup 1) (match_dup 2)))]
1916 { operands[3] = gen_reg_rtx (BImode); })
1918 (define_expand "divsi3"
1919 [(set (match_operand:SI 0 "register_operand" "")
1920 (div:SI (match_operand:SI 1 "general_operand" "")
1921 (match_operand:SI 2 "general_operand" "")))]
1922 "TARGET_INLINE_INT_DIV"
1924 rtx op1_xf, op2_xf, op0_xf, op0_di, twon34, twon34_exp;
1926 op0_xf = gen_reg_rtx (XFmode);
1927 op0_di = gen_reg_rtx (DImode);
1929 if (CONSTANT_P (operands[1]))
1930 operands[1] = force_reg (SImode, operands[1]);
1931 op1_xf = gen_reg_rtx (XFmode);
1932 expand_float (op1_xf, operands[1], 0);
1934 if (CONSTANT_P (operands[2]))
1935 operands[2] = force_reg (SImode, operands[2]);
1936 op2_xf = gen_reg_rtx (XFmode);
1937 expand_float (op2_xf, operands[2], 0);
1940 twon34_exp = gen_reg_rtx (DImode);
1941 emit_move_insn (twon34_exp, GEN_INT (65501));
1942 twon34 = gen_reg_rtx (XFmode);
1943 emit_insn (gen_setf_exp_xf (twon34, twon34_exp));
1945 emit_insn (gen_divsi3_internal (op0_xf, op1_xf, op2_xf, twon34));
1947 emit_insn (gen_fix_truncxfdi2_alts (op0_di, op0_xf, const1_rtx));
1948 emit_move_insn (operands[0], gen_lowpart (SImode, op0_di));
1952 (define_expand "modsi3"
1953 [(set (match_operand:SI 0 "register_operand" "")
1954 (mod:SI (match_operand:SI 1 "general_operand" "")
1955 (match_operand:SI 2 "general_operand" "")))]
1956 "TARGET_INLINE_INT_DIV"
1958 rtx op2_neg, op1_di, div;
1960 div = gen_reg_rtx (SImode);
1961 emit_insn (gen_divsi3 (div, operands[1], operands[2]));
1963 op2_neg = expand_unop (SImode, neg_optab, operands[2], NULL_RTX, 0);
1965 /* This is a trick to get us to reuse the value that we're sure to
1966 have already copied to the FP regs. */
1967 op1_di = gen_reg_rtx (DImode);
1968 convert_move (op1_di, operands[1], 0);
1970 emit_insn (gen_maddsi4 (operands[0], div, op2_neg,
1971 gen_lowpart (SImode, op1_di)));
1975 (define_expand "udivsi3"
1976 [(set (match_operand:SI 0 "register_operand" "")
1977 (udiv:SI (match_operand:SI 1 "general_operand" "")
1978 (match_operand:SI 2 "general_operand" "")))]
1979 "TARGET_INLINE_INT_DIV"
1981 rtx op1_xf, op2_xf, op0_xf, op0_di, twon34, twon34_exp;
1983 op0_xf = gen_reg_rtx (XFmode);
1984 op0_di = gen_reg_rtx (DImode);
1986 if (CONSTANT_P (operands[1]))
1987 operands[1] = force_reg (SImode, operands[1]);
1988 op1_xf = gen_reg_rtx (XFmode);
1989 expand_float (op1_xf, operands[1], 1);
1991 if (CONSTANT_P (operands[2]))
1992 operands[2] = force_reg (SImode, operands[2]);
1993 op2_xf = gen_reg_rtx (XFmode);
1994 expand_float (op2_xf, operands[2], 1);
1997 twon34_exp = gen_reg_rtx (DImode);
1998 emit_move_insn (twon34_exp, GEN_INT (65501));
1999 twon34 = gen_reg_rtx (XFmode);
2000 emit_insn (gen_setf_exp_xf (twon34, twon34_exp));
2002 emit_insn (gen_divsi3_internal (op0_xf, op1_xf, op2_xf, twon34));
2004 emit_insn (gen_fixuns_truncxfdi2_alts (op0_di, op0_xf, const1_rtx));
2005 emit_move_insn (operands[0], gen_lowpart (SImode, op0_di));
2009 (define_expand "umodsi3"
2010 [(set (match_operand:SI 0 "register_operand" "")
2011 (umod:SI (match_operand:SI 1 "general_operand" "")
2012 (match_operand:SI 2 "general_operand" "")))]
2013 "TARGET_INLINE_INT_DIV"
2015 rtx op2_neg, op1_di, div;
2017 div = gen_reg_rtx (SImode);
2018 emit_insn (gen_udivsi3 (div, operands[1], operands[2]));
2020 op2_neg = expand_unop (SImode, neg_optab, operands[2], NULL_RTX, 0);
2022 /* This is a trick to get us to reuse the value that we're sure to
2023 have already copied to the FP regs. */
2024 op1_di = gen_reg_rtx (DImode);
2025 convert_move (op1_di, operands[1], 1);
2027 emit_insn (gen_maddsi4 (operands[0], div, op2_neg,
2028 gen_lowpart (SImode, op1_di)));
2032 (define_insn_and_split "divsi3_internal"
2033 [(set (match_operand:XF 0 "fr_register_operand" "=&f")
2034 (float:XF (div:SI (match_operand:XF 1 "fr_register_operand" "f")
2035 (match_operand:XF 2 "fr_register_operand" "f"))))
2036 (clobber (match_scratch:XF 4 "=&f"))
2037 (clobber (match_scratch:XF 5 "=&f"))
2038 (clobber (match_scratch:BI 6 "=c"))
2039 (use (match_operand:XF 3 "fr_register_operand" "f"))]
2040 "TARGET_INLINE_INT_DIV"
2042 "&& reload_completed"
2043 [(parallel [(set (match_dup 0) (div:XF (const_int 1) (match_dup 2)))
2044 (set (match_dup 6) (unspec:BI [(match_dup 1) (match_dup 2)]
2045 UNSPEC_FR_RECIP_APPROX))
2046 (use (const_int 1))])
2047 (cond_exec (ne (match_dup 6) (const_int 0))
2048 (parallel [(set (match_dup 4) (mult:XF (match_dup 1) (match_dup 0)))
2049 (use (const_int 1))]))
2050 (cond_exec (ne (match_dup 6) (const_int 0))
2051 (parallel [(set (match_dup 5)
2052 (minus:XF (match_dup 7)
2053 (mult:XF (match_dup 2) (match_dup 0))))
2054 (use (const_int 1))]))
2055 (cond_exec (ne (match_dup 6) (const_int 0))
2056 (parallel [(set (match_dup 4)
2057 (plus:XF (mult:XF (match_dup 5) (match_dup 4))
2059 (use (const_int 1))]))
2060 (cond_exec (ne (match_dup 6) (const_int 0))
2061 (parallel [(set (match_dup 5)
2062 (plus:XF (mult:XF (match_dup 5) (match_dup 5))
2064 (use (const_int 1))]))
2065 (cond_exec (ne (match_dup 6) (const_int 0))
2066 (parallel [(set (match_dup 0)
2067 (plus:XF (mult:XF (match_dup 5) (match_dup 4))
2069 (use (const_int 1))]))
2071 "operands[7] = CONST1_RTX (XFmode);"
2072 [(set_attr "predicable" "no")])
2074 ;; ::::::::::::::::::::
2076 ;; :: 64 bit Integer arithmetic
2078 ;; ::::::::::::::::::::
2080 (define_insn "adddi3"
2081 [(set (match_operand:DI 0 "gr_register_operand" "=r,r,r")
2082 (plus:DI (match_operand:DI 1 "gr_register_operand" "%r,r,a")
2083 (match_operand:DI 2 "gr_reg_or_22bit_operand" "r,I,J")))]
2089 [(set_attr "itanium_class" "ialu")])
2091 (define_insn "*adddi3_plus1"
2092 [(set (match_operand:DI 0 "gr_register_operand" "=r")
2093 (plus:DI (plus:DI (match_operand:DI 1 "gr_register_operand" "r")
2094 (match_operand:DI 2 "gr_register_operand" "r"))
2097 "add %0 = %1, %2, 1"
2098 [(set_attr "itanium_class" "ialu")])
2100 ;; This has some of the same problems as shladd. We let the shladd
2101 ;; eliminator hack handle it, which results in the 1 being forced into
2102 ;; a register, but not more ugliness here.
2103 (define_insn "*adddi3_plus1_alt"
2104 [(set (match_operand:DI 0 "gr_register_operand" "=r")
2105 (plus:DI (mult:DI (match_operand:DI 1 "gr_register_operand" "r")
2109 "add %0 = %1, %1, 1"
2110 [(set_attr "itanium_class" "ialu")])
2112 (define_insn "subdi3"
2113 [(set (match_operand:DI 0 "gr_register_operand" "=r")
2114 (minus:DI (match_operand:DI 1 "gr_reg_or_8bit_operand" "rK")
2115 (match_operand:DI 2 "gr_register_operand" "r")))]
2118 [(set_attr "itanium_class" "ialu")])
2120 (define_insn "*subdi3_minus1"
2121 [(set (match_operand:DI 0 "gr_register_operand" "=r")
2122 (plus:DI (not:DI (match_operand:DI 1 "gr_register_operand" "r"))
2123 (match_operand:DI 2 "gr_register_operand" "r")))]
2125 "sub %0 = %2, %1, 1"
2126 [(set_attr "itanium_class" "ialu")])
2128 ;; ??? Use grfr instead of fr because of virtual register elimination
2129 ;; and silly test cases multiplying by the frame pointer.
2130 (define_insn "muldi3"
2131 [(set (match_operand:DI 0 "fr_register_operand" "=f")
2132 (mult:DI (match_operand:DI 1 "grfr_register_operand" "f")
2133 (match_operand:DI 2 "grfr_register_operand" "f")))]
2135 "xmpy.l %0 = %1, %2"
2136 [(set_attr "itanium_class" "xmpy")])
2138 ;; ??? If operand 3 is an eliminable reg, then register elimination causes the
2139 ;; same problem that we have with shladd below. Unfortunately, this case is
2140 ;; much harder to fix because the multiply puts the result in an FP register,
2141 ;; but the add needs inputs from a general register. We add a spurious clobber
2142 ;; here so that it will be present just in case register elimination gives us
2143 ;; the funny result.
2145 ;; ??? Maybe validate_changes should try adding match_scratch clobbers?
2147 ;; ??? Maybe we should change how adds are canonicalized.
2149 (define_insn "madddi4"
2150 [(set (match_operand:DI 0 "fr_register_operand" "=f")
2151 (plus:DI (mult:DI (match_operand:DI 1 "grfr_register_operand" "f")
2152 (match_operand:DI 2 "grfr_register_operand" "f"))
2153 (match_operand:DI 3 "grfr_register_operand" "f")))
2154 (clobber (match_scratch:DI 4 "=X"))]
2156 "xma.l %0 = %1, %2, %3"
2157 [(set_attr "itanium_class" "xmpy")])
2159 ;; This can be created by register elimination if operand3 of shladd is an
2160 ;; eliminable register or has reg_equiv_constant set.
2162 ;; We have to use nonmemory_operand for operand 4, to ensure that the
2163 ;; validate_changes call inside eliminate_regs will always succeed. If it
2164 ;; doesn't succeed, then this remain a madddi4 pattern, and will be reloaded
2167 (define_insn "*madddi4_elim"
2168 [(set (match_operand:DI 0 "register_operand" "=&r")
2169 (plus:DI (plus:DI (mult:DI (match_operand:DI 1 "register_operand" "f")
2170 (match_operand:DI 2 "register_operand" "f"))
2171 (match_operand:DI 3 "register_operand" "f"))
2172 (match_operand:DI 4 "nonmemory_operand" "rI")))
2173 (clobber (match_scratch:DI 5 "=f"))]
2174 "reload_in_progress"
2176 [(set_attr "itanium_class" "unknown")])
2179 [(set (match_operand:DI 0 "register_operand" "")
2180 (plus:DI (plus:DI (mult:DI (match_operand:DI 1 "register_operand" "")
2181 (match_operand:DI 2 "register_operand" ""))
2182 (match_operand:DI 3 "register_operand" ""))
2183 (match_operand:DI 4 "gr_reg_or_14bit_operand" "")))
2184 (clobber (match_scratch:DI 5 ""))]
2186 [(parallel [(set (match_dup 5) (plus:DI (mult:DI (match_dup 1) (match_dup 2))
2188 (clobber (match_dup 0))])
2189 (set (match_dup 0) (match_dup 5))
2190 (set (match_dup 0) (plus:DI (match_dup 0) (match_dup 4)))]
2193 ;; ??? There are highpart multiply and add instructions, but we have no way
2194 ;; to generate them.
2196 (define_insn "smuldi3_highpart"
2197 [(set (match_operand:DI 0 "fr_register_operand" "=f")
2200 (mult:TI (sign_extend:TI
2201 (match_operand:DI 1 "fr_register_operand" "f"))
2203 (match_operand:DI 2 "fr_register_operand" "f")))
2206 "xmpy.h %0 = %1, %2"
2207 [(set_attr "itanium_class" "xmpy")])
2209 (define_insn "umuldi3_highpart"
2210 [(set (match_operand:DI 0 "fr_register_operand" "=f")
2213 (mult:TI (zero_extend:TI
2214 (match_operand:DI 1 "fr_register_operand" "f"))
2216 (match_operand:DI 2 "fr_register_operand" "f")))
2219 "xmpy.hu %0 = %1, %2"
2220 [(set_attr "itanium_class" "xmpy")])
2222 (define_insn "negdi2"
2223 [(set (match_operand:DI 0 "gr_register_operand" "=r")
2224 (neg:DI (match_operand:DI 1 "gr_register_operand" "r")))]
2227 [(set_attr "itanium_class" "ialu")])
2229 (define_expand "absdi2"
2231 (ge:BI (match_operand:DI 1 "gr_register_operand" "") (const_int 0)))
2232 (set (match_operand:DI 0 "gr_register_operand" "")
2233 (if_then_else:DI (eq (match_dup 2) (const_int 0))
2234 (neg:DI (match_dup 1))
2237 { operands[2] = gen_reg_rtx (BImode); })
2239 (define_expand "smindi3"
2241 (ge:BI (match_operand:DI 1 "gr_register_operand" "")
2242 (match_operand:DI 2 "gr_register_operand" "")))
2243 (set (match_operand:DI 0 "gr_register_operand" "")
2244 (if_then_else:DI (ne (match_dup 3) (const_int 0))
2245 (match_dup 2) (match_dup 1)))]
2247 { operands[3] = gen_reg_rtx (BImode); })
2249 (define_expand "smaxdi3"
2251 (ge:BI (match_operand:DI 1 "gr_register_operand" "")
2252 (match_operand:DI 2 "gr_register_operand" "")))
2253 (set (match_operand:DI 0 "gr_register_operand" "")
2254 (if_then_else:DI (ne (match_dup 3) (const_int 0))
2255 (match_dup 1) (match_dup 2)))]
2257 { operands[3] = gen_reg_rtx (BImode); })
2259 (define_expand "umindi3"
2261 (geu:BI (match_operand:DI 1 "gr_register_operand" "")
2262 (match_operand:DI 2 "gr_register_operand" "")))
2263 (set (match_operand:DI 0 "gr_register_operand" "")
2264 (if_then_else:DI (ne (match_dup 3) (const_int 0))
2265 (match_dup 2) (match_dup 1)))]
2267 { operands[3] = gen_reg_rtx (BImode); })
2269 (define_expand "umaxdi3"
2271 (geu:BI (match_operand:DI 1 "gr_register_operand" "")
2272 (match_operand:DI 2 "gr_register_operand" "")))
2273 (set (match_operand:DI 0 "gr_register_operand" "")
2274 (if_then_else:DI (ne (match_dup 3) (const_int 0))
2275 (match_dup 1) (match_dup 2)))]
2277 { operands[3] = gen_reg_rtx (BImode); })
2279 (define_expand "ffsdi2"
2281 (eq:BI (match_operand:DI 1 "gr_register_operand" "") (const_int 0)))
2282 (set (match_dup 2) (plus:DI (match_dup 1) (const_int -1)))
2283 (set (match_dup 5) (const_int 0))
2284 (set (match_dup 3) (xor:DI (match_dup 1) (match_dup 2)))
2285 (set (match_dup 4) (popcount:DI (match_dup 3)))
2286 (set (match_operand:DI 0 "gr_register_operand" "")
2287 (if_then_else:DI (ne (match_dup 6) (const_int 0))
2288 (match_dup 5) (match_dup 4)))]
2291 operands[2] = gen_reg_rtx (DImode);
2292 operands[3] = gen_reg_rtx (DImode);
2293 operands[4] = gen_reg_rtx (DImode);
2294 operands[5] = gen_reg_rtx (DImode);
2295 operands[6] = gen_reg_rtx (BImode);
2298 (define_expand "ctzdi2"
2299 [(set (match_dup 2) (plus:DI (match_operand:DI 1 "gr_register_operand" "")
2301 (set (match_dup 3) (not:DI (match_dup 1)))
2302 (set (match_dup 4) (and:DI (match_dup 2) (match_dup 3)))
2303 (set (match_operand:DI 0 "gr_register_operand" "")
2304 (popcount:DI (match_dup 4)))]
2307 operands[2] = gen_reg_rtx (DImode);
2308 operands[3] = gen_reg_rtx (DImode);
2309 operands[4] = gen_reg_rtx (DImode);
2312 ;; Note the computation here is op0 = 63 - (exp - 0xffff).
2313 (define_expand "clzdi2"
2315 (unsigned_float:XF (match_operand:DI 1 "fr_register_operand" "")))
2317 (unspec:DI [(match_dup 2)] UNSPEC_GETF_EXP))
2318 (set (match_dup 4) (const_int 65598))
2319 (set (match_operand:DI 0 "gr_register_operand" "")
2320 (minus:DI (match_dup 4) (match_dup 3)))]
2323 operands[2] = gen_reg_rtx (XFmode);
2324 operands[3] = gen_reg_rtx (DImode);
2325 operands[4] = gen_reg_rtx (DImode);
2328 (define_insn "popcountdi2"
2329 [(set (match_operand:DI 0 "gr_register_operand" "=r")
2330 (popcount:DI (match_operand:DI 1 "gr_register_operand" "r")))]
2333 [(set_attr "itanium_class" "mmmul")])
2335 (define_insn "*getf_exp_xf"
2336 [(set (match_operand:DI 0 "gr_register_operand" "=r")
2337 (unspec:DI [(match_operand:XF 1 "fr_register_operand" "f")]
2341 [(set_attr "itanium_class" "frfr")])
2343 (define_expand "divdi3"
2344 [(set (match_operand:DI 0 "register_operand" "")
2345 (div:DI (match_operand:DI 1 "general_operand" "")
2346 (match_operand:DI 2 "general_operand" "")))]
2347 "TARGET_INLINE_INT_DIV"
2349 rtx op1_xf, op2_xf, op0_xf;
2351 op0_xf = gen_reg_rtx (XFmode);
2353 if (CONSTANT_P (operands[1]))
2354 operands[1] = force_reg (DImode, operands[1]);
2355 op1_xf = gen_reg_rtx (XFmode);
2356 expand_float (op1_xf, operands[1], 0);
2358 if (CONSTANT_P (operands[2]))
2359 operands[2] = force_reg (DImode, operands[2]);
2360 op2_xf = gen_reg_rtx (XFmode);
2361 expand_float (op2_xf, operands[2], 0);
2363 if (TARGET_INLINE_INT_DIV == INL_MIN_LAT)
2364 emit_insn (gen_divdi3_internal_lat (op0_xf, op1_xf, op2_xf));
2366 emit_insn (gen_divdi3_internal_thr (op0_xf, op1_xf, op2_xf));
2368 emit_insn (gen_fix_truncxfdi2_alts (operands[0], op0_xf, const1_rtx));
2372 (define_expand "moddi3"
2373 [(set (match_operand:DI 0 "register_operand" "")
2374 (mod:SI (match_operand:DI 1 "general_operand" "")
2375 (match_operand:DI 2 "general_operand" "")))]
2376 "TARGET_INLINE_INT_DIV"
2380 div = gen_reg_rtx (DImode);
2381 emit_insn (gen_divdi3 (div, operands[1], operands[2]));
2383 op2_neg = expand_unop (DImode, neg_optab, operands[2], NULL_RTX, 0);
2385 emit_insn (gen_madddi4 (operands[0], div, op2_neg, operands[1]));
2389 (define_expand "udivdi3"
2390 [(set (match_operand:DI 0 "register_operand" "")
2391 (udiv:DI (match_operand:DI 1 "general_operand" "")
2392 (match_operand:DI 2 "general_operand" "")))]
2393 "TARGET_INLINE_INT_DIV"
2395 rtx op1_xf, op2_xf, op0_xf;
2397 op0_xf = gen_reg_rtx (XFmode);
2399 if (CONSTANT_P (operands[1]))
2400 operands[1] = force_reg (DImode, operands[1]);
2401 op1_xf = gen_reg_rtx (XFmode);
2402 expand_float (op1_xf, operands[1], 1);
2404 if (CONSTANT_P (operands[2]))
2405 operands[2] = force_reg (DImode, operands[2]);
2406 op2_xf = gen_reg_rtx (XFmode);
2407 expand_float (op2_xf, operands[2], 1);
2409 if (TARGET_INLINE_INT_DIV == INL_MIN_LAT)
2410 emit_insn (gen_divdi3_internal_lat (op0_xf, op1_xf, op2_xf));
2412 emit_insn (gen_divdi3_internal_thr (op0_xf, op1_xf, op2_xf));
2414 emit_insn (gen_fixuns_truncxfdi2_alts (operands[0], op0_xf, const1_rtx));
2418 (define_expand "umoddi3"
2419 [(set (match_operand:DI 0 "register_operand" "")
2420 (umod:DI (match_operand:DI 1 "general_operand" "")
2421 (match_operand:DI 2 "general_operand" "")))]
2422 "TARGET_INLINE_INT_DIV"
2426 div = gen_reg_rtx (DImode);
2427 emit_insn (gen_udivdi3 (div, operands[1], operands[2]));
2429 op2_neg = expand_unop (DImode, neg_optab, operands[2], NULL_RTX, 0);
2431 emit_insn (gen_madddi4 (operands[0], div, op2_neg, operands[1]));
2435 (define_insn_and_split "divdi3_internal_lat"
2436 [(set (match_operand:XF 0 "fr_register_operand" "=&f")
2437 (float:XF (div:SI (match_operand:XF 1 "fr_register_operand" "f")
2438 (match_operand:XF 2 "fr_register_operand" "f"))))
2439 (clobber (match_scratch:XF 3 "=&f"))
2440 (clobber (match_scratch:XF 4 "=&f"))
2441 (clobber (match_scratch:XF 5 "=&f"))
2442 (clobber (match_scratch:BI 6 "=c"))]
2443 "TARGET_INLINE_INT_DIV == INL_MIN_LAT"
2445 "&& reload_completed"
2446 [(parallel [(set (match_dup 0) (div:XF (const_int 1) (match_dup 2)))
2447 (set (match_dup 6) (unspec:BI [(match_dup 1) (match_dup 2)]
2448 UNSPEC_FR_RECIP_APPROX))
2449 (use (const_int 1))])
2450 (cond_exec (ne (match_dup 6) (const_int 0))
2451 (parallel [(set (match_dup 3)
2452 (minus:XF (match_dup 7)
2453 (mult:XF (match_dup 2) (match_dup 0))))
2454 (use (const_int 1))]))
2455 (cond_exec (ne (match_dup 6) (const_int 0))
2456 (parallel [(set (match_dup 4) (mult:XF (match_dup 1) (match_dup 0)))
2457 (use (const_int 1))]))
2458 (cond_exec (ne (match_dup 6) (const_int 0))
2459 (parallel [(set (match_dup 5) (mult:XF (match_dup 3) (match_dup 3)))
2460 (use (const_int 1))]))
2461 (cond_exec (ne (match_dup 6) (const_int 0))
2462 (parallel [(set (match_dup 4)
2463 (plus:XF (mult:XF (match_dup 3) (match_dup 4))
2465 (use (const_int 1))]))
2466 (cond_exec (ne (match_dup 6) (const_int 0))
2467 (parallel [(set (match_dup 0)
2468 (plus:XF (mult:XF (match_dup 3) (match_dup 0))
2470 (use (const_int 1))]))
2471 (cond_exec (ne (match_dup 6) (const_int 0))
2472 (parallel [(set (match_dup 3)
2473 (plus:XF (mult:XF (match_dup 5) (match_dup 4))
2475 (use (const_int 1))]))
2476 (cond_exec (ne (match_dup 6) (const_int 0))
2477 (parallel [(set (match_dup 0)
2478 (plus:XF (mult:XF (match_dup 5) (match_dup 0))
2480 (use (const_int 1))]))
2481 (cond_exec (ne (match_dup 6) (const_int 0))
2482 (parallel [(set (match_dup 4)
2483 (minus:XF (match_dup 1)
2484 (mult:XF (match_dup 2) (match_dup 3))))
2485 (use (const_int 1))]))
2486 (cond_exec (ne (match_dup 6) (const_int 0))
2487 (parallel [(set (match_dup 0)
2488 (plus:XF (mult:XF (match_dup 4) (match_dup 0))
2490 (use (const_int 1))]))
2492 "operands[7] = CONST1_RTX (XFmode);"
2493 [(set_attr "predicable" "no")])
2495 (define_insn_and_split "divdi3_internal_thr"
2496 [(set (match_operand:XF 0 "fr_register_operand" "=&f")
2497 (float:XF (div:SI (match_operand:XF 1 "fr_register_operand" "f")
2498 (match_operand:XF 2 "fr_register_operand" "f"))))
2499 (clobber (match_scratch:XF 3 "=&f"))
2500 (clobber (match_scratch:XF 4 "=f"))
2501 (clobber (match_scratch:BI 5 "=c"))]
2502 "TARGET_INLINE_INT_DIV == INL_MAX_THR"
2504 "&& reload_completed"
2505 [(parallel [(set (match_dup 0) (div:XF (const_int 1) (match_dup 2)))
2506 (set (match_dup 5) (unspec:BI [(match_dup 1) (match_dup 2)]
2507 UNSPEC_FR_RECIP_APPROX))
2508 (use (const_int 1))])
2509 (cond_exec (ne (match_dup 5) (const_int 0))
2510 (parallel [(set (match_dup 3)
2511 (minus:XF (match_dup 6)
2512 (mult:XF (match_dup 2) (match_dup 0))))
2513 (use (const_int 1))]))
2514 (cond_exec (ne (match_dup 5) (const_int 0))
2515 (parallel [(set (match_dup 0)
2516 (plus:XF (mult:XF (match_dup 3) (match_dup 0))
2518 (use (const_int 1))]))
2519 (cond_exec (ne (match_dup 5) (const_int 0))
2520 (parallel [(set (match_dup 3) (mult:XF (match_dup 3) (match_dup 3)))
2521 (use (const_int 1))]))
2522 (cond_exec (ne (match_dup 5) (const_int 0))
2523 (parallel [(set (match_dup 0)
2524 (plus:XF (mult:XF (match_dup 3) (match_dup 0))
2526 (use (const_int 1))]))
2527 (cond_exec (ne (match_dup 5) (const_int 0))
2528 (parallel [(set (match_dup 3) (mult:XF (match_dup 0) (match_dup 1)))
2529 (use (const_int 1))]))
2530 (cond_exec (ne (match_dup 5) (const_int 0))
2531 (parallel [(set (match_dup 4)
2532 (minus:XF (match_dup 1)
2533 (mult:XF (match_dup 2) (match_dup 3))))
2534 (use (const_int 1))]))
2535 (cond_exec (ne (match_dup 5) (const_int 0))
2536 (parallel [(set (match_dup 0)
2537 (plus:XF (mult:XF (match_dup 4) (match_dup 0))
2539 (use (const_int 1))]))
2541 "operands[6] = CONST1_RTX (XFmode);"
2542 [(set_attr "predicable" "no")])
2544 ;; ::::::::::::::::::::
2546 ;; :: 32 bit floating point arithmetic
2548 ;; ::::::::::::::::::::
2550 (define_insn "addsf3"
2551 [(set (match_operand:SF 0 "fr_register_operand" "=f")
2552 (plus:SF (match_operand:SF 1 "fr_register_operand" "%f")
2553 (match_operand:SF 2 "fr_reg_or_fp01_operand" "fG")))]
2555 "fadd.s %0 = %1, %F2"
2556 [(set_attr "itanium_class" "fmac")])
2558 (define_insn "subsf3"
2559 [(set (match_operand:SF 0 "fr_register_operand" "=f")
2560 (minus:SF (match_operand:SF 1 "fr_reg_or_fp01_operand" "fG")
2561 (match_operand:SF 2 "fr_reg_or_fp01_operand" "fG")))]
2563 "fsub.s %0 = %F1, %F2"
2564 [(set_attr "itanium_class" "fmac")])
2566 (define_insn "mulsf3"
2567 [(set (match_operand:SF 0 "fr_register_operand" "=f")
2568 (mult:SF (match_operand:SF 1 "fr_register_operand" "%f")
2569 (match_operand:SF 2 "fr_register_operand" "f")))]
2571 "fmpy.s %0 = %1, %2"
2572 [(set_attr "itanium_class" "fmac")])
2574 (define_insn "abssf2"
2575 [(set (match_operand:SF 0 "fr_register_operand" "=f")
2576 (abs:SF (match_operand:SF 1 "fr_register_operand" "f")))]
2579 [(set_attr "itanium_class" "fmisc")])
2581 (define_insn "negsf2"
2582 [(set (match_operand:SF 0 "fr_register_operand" "=f")
2583 (neg:SF (match_operand:SF 1 "fr_register_operand" "f")))]
2586 [(set_attr "itanium_class" "fmisc")])
2588 (define_insn "*nabssf2"
2589 [(set (match_operand:SF 0 "fr_register_operand" "=f")
2590 (neg:SF (abs:SF (match_operand:SF 1 "fr_register_operand" "f"))))]
2593 [(set_attr "itanium_class" "fmisc")])
2595 (define_insn "copysignsf3"
2596 [(set (match_operand:SF 0 "register_operand" "=f")
2597 (unspec:SF [(match_operand:SF 1 "fr_reg_or_fp01_operand" "fG")
2598 (match_operand:SF 2 "fr_reg_or_fp01_operand" "fG")]
2601 "fmerge.s %0 = %F2, %F1"
2602 [(set_attr "itanium_class" "fmisc")])
2604 (define_insn "*ncopysignsf3"
2605 [(set (match_operand:SF 0 "register_operand" "=f")
2606 (neg:SF (unspec:SF [(match_operand:SF 1 "fr_reg_or_fp01_operand" "fG")
2607 (match_operand:SF 2 "fr_reg_or_fp01_operand" "fG")]
2610 "fmerge.ns %0 = %F2, %F1"
2611 [(set_attr "itanium_class" "fmisc")])
2613 (define_insn "sminsf3"
2614 [(set (match_operand:SF 0 "fr_register_operand" "=f")
2615 (smin:SF (match_operand:SF 1 "fr_register_operand" "f")
2616 (match_operand:SF 2 "fr_reg_or_fp01_operand" "fG")))]
2619 [(set_attr "itanium_class" "fmisc")])
2621 (define_insn "smaxsf3"
2622 [(set (match_operand:SF 0 "fr_register_operand" "=f")
2623 (smax:SF (match_operand:SF 1 "fr_register_operand" "f")
2624 (match_operand:SF 2 "fr_reg_or_fp01_operand" "fG")))]
2627 [(set_attr "itanium_class" "fmisc")])
2629 (define_insn "*maddsf4"
2630 [(set (match_operand:SF 0 "fr_register_operand" "=f")
2631 (plus:SF (mult:SF (match_operand:SF 1 "fr_register_operand" "f")
2632 (match_operand:SF 2 "fr_register_operand" "f"))
2633 (match_operand:SF 3 "fr_reg_or_fp01_operand" "fG")))]
2635 "fma.s %0 = %1, %2, %F3"
2636 [(set_attr "itanium_class" "fmac")])
2638 (define_insn "*msubsf4"
2639 [(set (match_operand:SF 0 "fr_register_operand" "=f")
2640 (minus:SF (mult:SF (match_operand:SF 1 "fr_register_operand" "f")
2641 (match_operand:SF 2 "fr_register_operand" "f"))
2642 (match_operand:SF 3 "fr_reg_or_fp01_operand" "fG")))]
2644 "fms.s %0 = %1, %2, %F3"
2645 [(set_attr "itanium_class" "fmac")])
2647 (define_insn "*nmulsf3"
2648 [(set (match_operand:SF 0 "fr_register_operand" "=f")
2649 (neg:SF (mult:SF (match_operand:SF 1 "fr_register_operand" "f")
2650 (match_operand:SF 2 "fr_register_operand" "f"))))]
2652 "fnmpy.s %0 = %1, %2"
2653 [(set_attr "itanium_class" "fmac")])
2655 (define_insn "*nmaddsf4"
2656 [(set (match_operand:SF 0 "fr_register_operand" "=f")
2657 (minus:SF (match_operand:SF 3 "fr_reg_or_fp01_operand" "fG")
2658 (mult:SF (match_operand:SF 1 "fr_register_operand" "f")
2659 (match_operand:SF 2 "fr_register_operand" "f"))))]
2661 "fnma.s %0 = %1, %2, %F3"
2662 [(set_attr "itanium_class" "fmac")])
2664 (define_insn "*nmaddsf4_alts"
2665 [(set (match_operand:SF 0 "fr_register_operand" "=f")
2666 (minus:SF (match_operand:SF 3 "fr_reg_or_fp01_operand" "fG")
2667 (mult:SF (match_operand:SF 1 "fr_register_operand" "f")
2668 (match_operand:SF 2 "fr_register_operand" "f"))))
2669 (use (match_operand:SI 4 "const_int_operand" ""))]
2671 "fnma.s.s%4 %0 = %1, %2, %F3"
2672 [(set_attr "itanium_class" "fmac")])
2674 (define_expand "divsf3"
2675 [(set (match_operand:SF 0 "fr_register_operand" "")
2676 (div:SF (match_operand:SF 1 "fr_register_operand" "")
2677 (match_operand:SF 2 "fr_register_operand" "")))]
2678 "TARGET_INLINE_FLOAT_DIV"
2681 if (TARGET_INLINE_FLOAT_DIV == INL_MIN_LAT)
2682 insn = gen_divsf3_internal_lat (operands[0], operands[1], operands[2]);
2684 insn = gen_divsf3_internal_thr (operands[0], operands[1], operands[2]);
2689 (define_insn_and_split "divsf3_internal_lat"
2690 [(set (match_operand:SF 0 "fr_register_operand" "=&f")
2691 (div:SF (match_operand:SF 1 "fr_register_operand" "f")
2692 (match_operand:SF 2 "fr_register_operand" "f")))
2693 (clobber (match_scratch:XF 3 "=&f"))
2694 (clobber (match_scratch:XF 4 "=f"))
2695 (clobber (match_scratch:BI 5 "=c"))]
2696 "TARGET_INLINE_FLOAT_DIV == INL_MIN_LAT"
2698 "&& reload_completed"
2699 [(parallel [(set (match_dup 6) (div:XF (const_int 1) (match_dup 8)))
2700 (set (match_dup 5) (unspec:BI [(match_dup 7) (match_dup 8)]
2701 UNSPEC_FR_RECIP_APPROX))
2702 (use (const_int 0))])
2703 (cond_exec (ne (match_dup 5) (const_int 0))
2704 (parallel [(set (match_dup 3) (mult:XF (match_dup 7) (match_dup 6)))
2705 (use (const_int 1))]))
2706 (cond_exec (ne (match_dup 5) (const_int 0))
2707 (parallel [(set (match_dup 4)
2708 (minus:XF (match_dup 10)
2709 (mult:XF (match_dup 8) (match_dup 6))))
2710 (use (const_int 1))]))
2711 (cond_exec (ne (match_dup 5) (const_int 0))
2712 (parallel [(set (match_dup 3)
2713 (plus:XF (mult:XF (match_dup 4) (match_dup 3))
2715 (use (const_int 1))]))
2716 (cond_exec (ne (match_dup 5) (const_int 0))
2717 (parallel [(set (match_dup 4) (mult:XF (match_dup 4) (match_dup 4)))
2718 (use (const_int 1))]))
2719 (cond_exec (ne (match_dup 5) (const_int 0))
2720 (parallel [(set (match_dup 3)
2721 (plus:XF (mult:XF (match_dup 4) (match_dup 3))
2723 (use (const_int 1))]))
2724 (cond_exec (ne (match_dup 5) (const_int 0))
2725 (parallel [(set (match_dup 4) (mult:XF (match_dup 4) (match_dup 4)))
2726 (use (const_int 1))]))
2727 (cond_exec (ne (match_dup 5) (const_int 0))
2728 (parallel [(set (match_dup 9)
2730 (plus:XF (mult:XF (match_dup 4) (match_dup 3))
2732 (use (const_int 1))]))
2733 (cond_exec (ne (match_dup 5) (const_int 0))
2735 (float_truncate:SF (match_dup 6))))
2738 operands[6] = gen_rtx_REG (XFmode, REGNO (operands[0]));
2739 operands[7] = gen_rtx_REG (XFmode, REGNO (operands[1]));
2740 operands[8] = gen_rtx_REG (XFmode, REGNO (operands[2]));
2741 operands[9] = gen_rtx_REG (DFmode, REGNO (operands[0]));
2742 operands[10] = CONST1_RTX (XFmode);
2744 [(set_attr "predicable" "no")])
2746 (define_insn_and_split "divsf3_internal_thr"
2747 [(set (match_operand:SF 0 "fr_register_operand" "=&f")
2748 (div:SF (match_operand:SF 1 "fr_register_operand" "f")
2749 (match_operand:SF 2 "fr_register_operand" "f")))
2750 (clobber (match_scratch:XF 3 "=&f"))
2751 (clobber (match_scratch:XF 4 "=f"))
2752 (clobber (match_scratch:BI 5 "=c"))]
2753 "TARGET_INLINE_FLOAT_DIV == INL_MAX_THR"
2755 "&& reload_completed"
2756 [(parallel [(set (match_dup 6) (div:XF (const_int 1) (match_dup 8)))
2757 (set (match_dup 5) (unspec:BI [(match_dup 7) (match_dup 8)]
2758 UNSPEC_FR_RECIP_APPROX))
2759 (use (const_int 0))])
2760 (cond_exec (ne (match_dup 5) (const_int 0))
2761 (parallel [(set (match_dup 3)
2762 (minus:XF (match_dup 10)
2763 (mult:XF (match_dup 8) (match_dup 6))))
2764 (use (const_int 1))]))
2765 (cond_exec (ne (match_dup 5) (const_int 0))
2766 (parallel [(set (match_dup 3)
2767 (plus:XF (mult:XF (match_dup 3) (match_dup 3))
2769 (use (const_int 1))]))
2770 (cond_exec (ne (match_dup 5) (const_int 0))
2771 (parallel [(set (match_dup 6)
2772 (plus:XF (mult:XF (match_dup 3) (match_dup 6))
2774 (use (const_int 1))]))
2775 (cond_exec (ne (match_dup 5) (const_int 0))
2776 (parallel [(set (match_dup 9)
2778 (mult:XF (match_dup 7) (match_dup 6))))
2779 (use (const_int 1))]))
2780 (cond_exec (ne (match_dup 5) (const_int 0))
2781 (parallel [(set (match_dup 4)
2782 (minus:XF (match_dup 7)
2783 (mult:XF (match_dup 8) (match_dup 3))))
2784 (use (const_int 1))]))
2785 (cond_exec (ne (match_dup 5) (const_int 0))
2788 (plus:XF (mult:XF (match_dup 4) (match_dup 6))
2792 operands[6] = gen_rtx_REG (XFmode, REGNO (operands[0]));
2793 operands[7] = gen_rtx_REG (XFmode, REGNO (operands[1]));
2794 operands[8] = gen_rtx_REG (XFmode, REGNO (operands[2]));
2795 operands[9] = gen_rtx_REG (SFmode, REGNO (operands[3]));
2796 operands[10] = CONST1_RTX (XFmode);
2798 [(set_attr "predicable" "no")])
2800 ;; Inline square root.
2802 (define_insn "*sqrt_approx"
2803 [(set (match_operand:XF 0 "fr_register_operand" "=f")
2804 (div:XF (const_int 1)
2805 (sqrt:XF (match_operand:XF 2 "fr_register_operand" "f"))))
2806 (set (match_operand:BI 1 "register_operand" "=c")
2807 (unspec:BI [(match_dup 2)] UNSPEC_FR_SQRT_RECIP_APPROX))
2808 (use (match_operand:SI 3 "const_int_operand" "")) ]
2810 "frsqrta.s%3 %0, %1 = %2"
2811 [(set_attr "itanium_class" "fmisc")
2812 (set_attr "predicable" "no")])
2814 (define_insn "setf_exp_xf"
2815 [(set (match_operand:XF 0 "fr_register_operand" "=f")
2816 (unspec:XF [(match_operand:DI 1 "register_operand" "r")]
2820 [(set_attr "itanium_class" "frfr")])
2822 (define_expand "sqrtsf2"
2823 [(set (match_operand:SF 0 "fr_register_operand" "=&f")
2824 (sqrt:SF (match_operand:SF 1 "fr_register_operand" "f")))]
2825 "TARGET_INLINE_SQRT"
2828 if (TARGET_INLINE_SQRT == INL_MIN_LAT)
2830 insn = gen_sqrtsf2_internal_lat (operands[0], operands[1]);
2835 insn = gen_sqrtsf2_internal_thr (operands[0], operands[1]);
2840 ;; Latency-optimized square root.
2841 ;; FIXME: Implement.
2843 ;; Throughput-optimized square root.
2845 (define_insn_and_split "sqrtsf2_internal_thr"
2846 [(set (match_operand:SF 0 "fr_register_operand" "=&f")
2847 (sqrt:SF (match_operand:SF 1 "fr_register_operand" "f")))
2848 ;; Register r2 in optimization guide.
2849 (clobber (match_scratch:DI 2 "=r"))
2850 ;; Register f8 in optimization guide
2851 (clobber (match_scratch:XF 3 "=&f"))
2852 ;; Register f9 in optimization guide
2853 (clobber (match_scratch:XF 4 "=&f"))
2854 ;; Register f10 in optimization guide
2855 (clobber (match_scratch:XF 5 "=&f"))
2856 ;; Register p6 in optimization guide.
2857 (clobber (match_scratch:BI 6 "=c"))]
2858 "TARGET_INLINE_SQRT == INL_MAX_THR"
2860 "&& reload_completed"
2861 [ ;; exponent of +1/2 in r2
2862 (set (match_dup 2) (const_int 65534))
2865 (unspec:XF [(match_dup 2)] UNSPEC_SETF_EXP))
2867 ;; y0 = 1/sqrt(a) in f7
2868 (parallel [(set (match_dup 7)
2869 (div:XF (const_int 1)
2870 (sqrt:XF (match_dup 8))))
2872 (unspec:BI [(match_dup 8)]
2873 UNSPEC_FR_SQRT_RECIP_APPROX))
2874 (use (const_int 0))])
2876 ;; H0 = 1/2 * y0 in f9
2877 (cond_exec (ne (match_dup 6) (const_int 0))
2878 (parallel [(set (match_dup 4)
2879 (plus:XF (mult:XF (match_dup 3) (match_dup 7))
2881 (use (const_int 1))]))
2883 ;; S0 = a * y0 in f7
2884 (cond_exec (ne (match_dup 6) (const_int 0))
2885 (parallel [(set (match_dup 7)
2886 (plus:XF (mult:XF (match_dup 8) (match_dup 7))
2888 (use (const_int 1))]))
2890 ;; d = 1/2 - S0 * H0 in f10
2891 (cond_exec (ne (match_dup 6) (const_int 0))
2892 (parallel [(set (match_dup 5)
2893 (minus:XF (match_dup 3)
2894 (mult:XF (match_dup 7) (match_dup 4))))
2895 (use (const_int 1))]))
2897 ;; d' = d + 1/2 * d in f8
2898 (cond_exec (ne (match_dup 6) (const_int 0))
2899 (parallel [(set (match_dup 3)
2900 (plus:XF (mult:XF (match_dup 3) (match_dup 5))
2902 (use (const_int 1))]))
2904 ;; e = d + d * d' in f8
2905 (cond_exec (ne (match_dup 6) (const_int 0))
2906 (parallel [(set (match_dup 3)
2907 (plus:XF (mult:XF (match_dup 5) (match_dup 3))
2909 (use (const_int 1))]))
2911 ;; S1 = S0 + e * S0 in f7
2912 (cond_exec (ne (match_dup 6) (const_int 0))
2913 (parallel [(set (match_dup 0)
2915 (plus:XF (mult:XF (match_dup 3) (match_dup 7))
2917 (use (const_int 1))]))
2919 ;; H1 = H0 + e * H0 in f8
2920 (cond_exec (ne (match_dup 6) (const_int 0))
2921 (parallel [(set (match_dup 3)
2922 (plus:XF (mult:XF (match_dup 3) (match_dup 4))
2924 (use (const_int 1))]))
2926 ;; d1 = a - S1 * S1 in f9
2927 (cond_exec (ne (match_dup 6) (const_int 0))
2928 (parallel [(set (match_dup 4)
2929 (minus:XF (match_dup 8)
2930 (mult:XF (match_dup 7) (match_dup 7))))
2931 (use (const_int 1))]))
2933 ;; S = S1 + d1 * H1 in f7
2934 (cond_exec (ne (match_dup 6) (const_int 0))
2935 (parallel [(set (match_dup 0)
2937 (plus:XF (mult:XF (match_dup 4) (match_dup 3))
2939 (use (const_int 0))]))]
2941 /* Generate 82-bit versions of the input and output operands. */
2942 operands[7] = gen_rtx_REG (XFmode, REGNO (operands[0]));
2943 operands[8] = gen_rtx_REG (XFmode, REGNO (operands[1]));
2944 /* Generate required floating-point constants. */
2945 operands[9] = CONST0_RTX (XFmode);
2947 [(set_attr "predicable" "no")])
2949 ;; ::::::::::::::::::::
2951 ;; :: 64 bit floating point arithmetic
2953 ;; ::::::::::::::::::::
2955 (define_insn "adddf3"
2956 [(set (match_operand:DF 0 "fr_register_operand" "=f")
2957 (plus:DF (match_operand:DF 1 "fr_register_operand" "%f")
2958 (match_operand:DF 2 "fr_reg_or_fp01_operand" "fG")))]
2960 "fadd.d %0 = %1, %F2"
2961 [(set_attr "itanium_class" "fmac")])
2963 (define_insn "*adddf3_trunc"
2964 [(set (match_operand:SF 0 "fr_register_operand" "=f")
2966 (plus:DF (match_operand:DF 1 "fr_register_operand" "%f")
2967 (match_operand:DF 2 "fr_reg_or_fp01_operand" "fG"))))]
2969 "fadd.s %0 = %1, %F2"
2970 [(set_attr "itanium_class" "fmac")])
2972 (define_insn "subdf3"
2973 [(set (match_operand:DF 0 "fr_register_operand" "=f")
2974 (minus:DF (match_operand:DF 1 "fr_reg_or_fp01_operand" "fG")
2975 (match_operand:DF 2 "fr_reg_or_fp01_operand" "fG")))]
2977 "fsub.d %0 = %F1, %F2"
2978 [(set_attr "itanium_class" "fmac")])
2980 (define_insn "*subdf3_trunc"
2981 [(set (match_operand:SF 0 "fr_register_operand" "=f")
2983 (minus:DF (match_operand:DF 1 "fr_reg_or_fp01_operand" "fG")
2984 (match_operand:DF 2 "fr_reg_or_fp01_operand" "fG"))))]
2986 "fsub.s %0 = %F1, %F2"
2987 [(set_attr "itanium_class" "fmac")])
2989 (define_insn "muldf3"
2990 [(set (match_operand:DF 0 "fr_register_operand" "=f")
2991 (mult:DF (match_operand:DF 1 "fr_register_operand" "f")
2992 (match_operand:DF 2 "fr_register_operand" "f")))]
2994 "fmpy.d %0 = %1, %2"
2995 [(set_attr "itanium_class" "fmac")])
2997 (define_insn "*muldf3_trunc"
2998 [(set (match_operand:SF 0 "fr_register_operand" "=f")
3000 (mult:DF (match_operand:DF 1 "fr_register_operand" "f")
3001 (match_operand:DF 2 "fr_register_operand" "f"))))]
3003 "fmpy.s %0 = %1, %2"
3004 [(set_attr "itanium_class" "fmac")])
3006 (define_insn "absdf2"
3007 [(set (match_operand:DF 0 "fr_register_operand" "=f")
3008 (abs:DF (match_operand:DF 1 "fr_register_operand" "f")))]
3011 [(set_attr "itanium_class" "fmisc")])
3013 (define_insn "negdf2"
3014 [(set (match_operand:DF 0 "fr_register_operand" "=f")
3015 (neg:DF (match_operand:DF 1 "fr_register_operand" "f")))]
3018 [(set_attr "itanium_class" "fmisc")])
3020 (define_insn "*nabsdf2"
3021 [(set (match_operand:DF 0 "fr_register_operand" "=f")
3022 (neg:DF (abs:DF (match_operand:DF 1 "fr_register_operand" "f"))))]
3025 [(set_attr "itanium_class" "fmisc")])
3027 (define_insn "copysigndf3"
3028 [(set (match_operand:DF 0 "register_operand" "=f")
3029 (unspec:DF [(match_operand:DF 1 "fr_reg_or_fp01_operand" "fG")
3030 (match_operand:DF 2 "fr_reg_or_fp01_operand" "fG")]
3033 "fmerge.s %0 = %F2, %F1"
3034 [(set_attr "itanium_class" "fmisc")])
3036 (define_insn "*ncopysigndf3"
3037 [(set (match_operand:DF 0 "register_operand" "=f")
3038 (neg:DF (unspec:DF [(match_operand:DF 1 "fr_reg_or_fp01_operand" "fG")
3039 (match_operand:DF 2 "fr_reg_or_fp01_operand" "fG")]
3042 "fmerge.ns %0 = %F2, %F1"
3043 [(set_attr "itanium_class" "fmisc")])
3045 (define_insn "smindf3"
3046 [(set (match_operand:DF 0 "fr_register_operand" "=f")
3047 (smin:DF (match_operand:DF 1 "fr_register_operand" "f")
3048 (match_operand:DF 2 "fr_reg_or_fp01_operand" "fG")))]
3051 [(set_attr "itanium_class" "fmisc")])
3053 (define_insn "smaxdf3"
3054 [(set (match_operand:DF 0 "fr_register_operand" "=f")
3055 (smax:DF (match_operand:DF 1 "fr_register_operand" "f")
3056 (match_operand:DF 2 "fr_reg_or_fp01_operand" "fG")))]
3059 [(set_attr "itanium_class" "fmisc")])
3061 (define_insn "*madddf4"
3062 [(set (match_operand:DF 0 "fr_register_operand" "=f")
3063 (plus:DF (mult:DF (match_operand:DF 1 "fr_register_operand" "f")
3064 (match_operand:DF 2 "fr_register_operand" "f"))
3065 (match_operand:DF 3 "fr_reg_or_fp01_operand" "fG")))]
3067 "fma.d %0 = %1, %2, %F3"
3068 [(set_attr "itanium_class" "fmac")])
3070 (define_insn "*madddf4_trunc"
3071 [(set (match_operand:SF 0 "fr_register_operand" "=f")
3073 (plus:DF (mult:DF (match_operand:DF 1 "fr_register_operand" "f")
3074 (match_operand:DF 2 "fr_register_operand" "f"))
3075 (match_operand:DF 3 "fr_reg_or_fp01_operand" "fG"))))]
3077 "fma.s %0 = %1, %2, %F3"
3078 [(set_attr "itanium_class" "fmac")])
3080 (define_insn "*msubdf4"
3081 [(set (match_operand:DF 0 "fr_register_operand" "=f")
3082 (minus:DF (mult:DF (match_operand:DF 1 "fr_register_operand" "f")
3083 (match_operand:DF 2 "fr_register_operand" "f"))
3084 (match_operand:DF 3 "fr_reg_or_fp01_operand" "fG")))]
3086 "fms.d %0 = %1, %2, %F3"
3087 [(set_attr "itanium_class" "fmac")])
3089 (define_insn "*msubdf4_trunc"
3090 [(set (match_operand:SF 0 "fr_register_operand" "=f")
3092 (minus:DF (mult:DF (match_operand:DF 1 "fr_register_operand" "f")
3093 (match_operand:DF 2 "fr_register_operand" "f"))
3094 (match_operand:DF 3 "fr_reg_or_fp01_operand" "fG"))))]
3096 "fms.s %0 = %1, %2, %F3"
3097 [(set_attr "itanium_class" "fmac")])
3099 (define_insn "*nmuldf3"
3100 [(set (match_operand:DF 0 "fr_register_operand" "=f")
3101 (neg:DF (mult:DF (match_operand:DF 1 "fr_register_operand" "f")
3102 (match_operand:DF 2 "fr_register_operand" "f"))))]
3104 "fnmpy.d %0 = %1, %2"
3105 [(set_attr "itanium_class" "fmac")])
3107 (define_insn "*nmuldf3_trunc"
3108 [(set (match_operand:SF 0 "fr_register_operand" "=f")
3110 (neg:DF (mult:DF (match_operand:DF 1 "fr_register_operand" "f")
3111 (match_operand:DF 2 "fr_register_operand" "f")))))]
3113 "fnmpy.s %0 = %1, %2"
3114 [(set_attr "itanium_class" "fmac")])
3116 (define_insn "*nmadddf4"
3117 [(set (match_operand:DF 0 "fr_register_operand" "=f")
3118 (minus:DF (match_operand:DF 3 "fr_reg_or_fp01_operand" "fG")
3119 (mult:DF (match_operand:DF 1 "fr_register_operand" "f")
3120 (match_operand:DF 2 "fr_register_operand" "f"))))]
3122 "fnma.d %0 = %1, %2, %F3"
3123 [(set_attr "itanium_class" "fmac")])
3125 (define_insn "*nmadddf4_alts"
3126 [(set (match_operand:DF 0 "fr_register_operand" "=f")
3127 (minus:DF (match_operand:DF 3 "fr_reg_or_fp01_operand" "fG")
3128 (mult:DF (match_operand:DF 1 "fr_register_operand" "f")
3129 (match_operand:DF 2 "fr_register_operand" "f"))))
3130 (use (match_operand:SI 4 "const_int_operand" ""))]
3132 "fnma.d.s%4 %0 = %1, %2, %F3"
3133 [(set_attr "itanium_class" "fmac")])
3135 (define_insn "*nmadddf4_truncsf"
3136 [(set (match_operand:SF 0 "fr_register_operand" "=f")
3138 (minus:DF (match_operand:DF 3 "fr_reg_or_fp01_operand" "fG")
3139 (mult:DF (match_operand:DF 1 "fr_register_operand" "f")
3140 (match_operand:DF 2 "fr_register_operand" "f")))))]
3142 "fnma.s %0 = %1, %2, %F3"
3143 [(set_attr "itanium_class" "fmac")])
3145 (define_insn "*nmadddf4_truncsf_alts"
3146 [(set (match_operand:SF 0 "fr_register_operand" "=f")
3148 (minus:DF (match_operand:DF 3 "fr_reg_or_fp01_operand" "fG")
3149 (mult:DF (match_operand:DF 1 "fr_register_operand" "f")
3150 (match_operand:DF 2 "fr_register_operand" "f")))))
3151 (use (match_operand:SI 4 "const_int_operand" ""))]
3153 "fnma.s.s%4 %0 = %1, %2, %F3"
3154 [(set_attr "itanium_class" "fmac")])
3156 (define_expand "divdf3"
3157 [(set (match_operand:DF 0 "fr_register_operand" "")
3158 (div:DF (match_operand:DF 1 "fr_register_operand" "")
3159 (match_operand:DF 2 "fr_register_operand" "")))]
3160 "TARGET_INLINE_FLOAT_DIV"
3163 if (TARGET_INLINE_FLOAT_DIV == INL_MIN_LAT)
3164 insn = gen_divdf3_internal_lat (operands[0], operands[1], operands[2]);
3166 insn = gen_divdf3_internal_thr (operands[0], operands[1], operands[2]);
3171 (define_insn_and_split "divdf3_internal_lat"
3172 [(set (match_operand:DF 0 "fr_register_operand" "=&f")
3173 (div:DF (match_operand:DF 1 "fr_register_operand" "f")
3174 (match_operand:DF 2 "fr_register_operand" "f")))
3175 (clobber (match_scratch:XF 3 "=&f"))
3176 (clobber (match_scratch:XF 4 "=&f"))
3177 (clobber (match_scratch:XF 5 "=&f"))
3178 (clobber (match_scratch:BI 6 "=c"))]
3179 "TARGET_INLINE_FLOAT_DIV == INL_MIN_LAT"
3181 "&& reload_completed"
3182 [(parallel [(set (match_dup 7) (div:XF (const_int 1) (match_dup 9)))
3183 (set (match_dup 6) (unspec:BI [(match_dup 8) (match_dup 9)]
3184 UNSPEC_FR_RECIP_APPROX))
3185 (use (const_int 0))])
3186 (cond_exec (ne (match_dup 6) (const_int 0))
3187 (parallel [(set (match_dup 3) (mult:XF (match_dup 8) (match_dup 7)))
3188 (use (const_int 1))]))
3189 (cond_exec (ne (match_dup 6) (const_int 0))
3190 (parallel [(set (match_dup 4)
3191 (minus:XF (match_dup 12)
3192 (mult:XF (match_dup 9) (match_dup 7))))
3193 (use (const_int 1))]))
3194 (cond_exec (ne (match_dup 6) (const_int 0))
3195 (parallel [(set (match_dup 3)
3196 (plus:XF (mult:XF (match_dup 4) (match_dup 3))
3198 (use (const_int 1))]))
3199 (cond_exec (ne (match_dup 6) (const_int 0))
3200 (parallel [(set (match_dup 5) (mult:XF (match_dup 4) (match_dup 4)))
3201 (use (const_int 1))]))
3202 (cond_exec (ne (match_dup 6) (const_int 0))
3203 (parallel [(set (match_dup 7)
3204 (plus:XF (mult:XF (match_dup 4) (match_dup 7))
3206 (use (const_int 1))]))
3207 (cond_exec (ne (match_dup 6) (const_int 0))
3208 (parallel [(set (match_dup 3)
3209 (plus:XF (mult:XF (match_dup 5) (match_dup 3))
3211 (use (const_int 1))]))
3212 (cond_exec (ne (match_dup 6) (const_int 0))
3213 (parallel [(set (match_dup 4) (mult:XF (match_dup 5) (match_dup 5)))
3214 (use (const_int 1))]))
3215 (cond_exec (ne (match_dup 6) (const_int 0))
3216 (parallel [(set (match_dup 7)
3217 (plus:XF (mult:XF (match_dup 5) (match_dup 7))
3219 (use (const_int 1))]))
3220 (cond_exec (ne (match_dup 6) (const_int 0))
3221 (parallel [(set (match_dup 10)
3223 (plus:XF (mult:XF (match_dup 4) (match_dup 3))
3225 (use (const_int 1))]))
3226 (cond_exec (ne (match_dup 6) (const_int 0))
3227 (parallel [(set (match_dup 7)
3228 (plus:XF (mult:XF (match_dup 4) (match_dup 7))
3230 (use (const_int 1))]))
3231 (cond_exec (ne (match_dup 6) (const_int 0))
3232 (parallel [(set (match_dup 11)
3234 (minus:XF (match_dup 8)
3235 (mult:XF (match_dup 9) (match_dup 3)))))
3236 (use (const_int 1))]))
3237 (cond_exec (ne (match_dup 6) (const_int 0))
3239 (float_truncate:DF (plus:XF (mult:XF (match_dup 5) (match_dup 7))
3243 operands[7] = gen_rtx_REG (XFmode, REGNO (operands[0]));
3244 operands[8] = gen_rtx_REG (XFmode, REGNO (operands[1]));
3245 operands[9] = gen_rtx_REG (XFmode, REGNO (operands[2]));
3246 operands[10] = gen_rtx_REG (DFmode, REGNO (operands[3]));
3247 operands[11] = gen_rtx_REG (DFmode, REGNO (operands[5]));
3248 operands[12] = CONST1_RTX (XFmode);
3250 [(set_attr "predicable" "no")])
3252 (define_insn_and_split "divdf3_internal_thr"
3253 [(set (match_operand:DF 0 "fr_register_operand" "=&f")
3254 (div:DF (match_operand:DF 1 "fr_register_operand" "f")
3255 (match_operand:DF 2 "fr_register_operand" "f")))
3256 (clobber (match_scratch:XF 3 "=&f"))
3257 (clobber (match_scratch:DF 4 "=f"))
3258 (clobber (match_scratch:BI 5 "=c"))]
3259 "TARGET_INLINE_FLOAT_DIV == INL_MAX_THR"
3261 "&& reload_completed"
3262 [(parallel [(set (match_dup 6) (div:XF (const_int 1) (match_dup 8)))
3263 (set (match_dup 5) (unspec:BI [(match_dup 7) (match_dup 8)]
3264 UNSPEC_FR_RECIP_APPROX))
3265 (use (const_int 0))])
3266 (cond_exec (ne (match_dup 5) (const_int 0))
3267 (parallel [(set (match_dup 3)
3268 (minus:XF (match_dup 10)
3269 (mult:XF (match_dup 8) (match_dup 6))))
3270 (use (const_int 1))]))
3271 (cond_exec (ne (match_dup 5) (const_int 0))
3272 (parallel [(set (match_dup 6)
3273 (plus:XF (mult:XF (match_dup 3) (match_dup 6))
3275 (use (const_int 1))]))
3276 (cond_exec (ne (match_dup 5) (const_int 0))
3277 (parallel [(set (match_dup 3)
3278 (mult:XF (match_dup 3) (match_dup 3)))
3279 (use (const_int 1))]))
3280 (cond_exec (ne (match_dup 5) (const_int 0))
3281 (parallel [(set (match_dup 6)
3282 (plus:XF (mult:XF (match_dup 3) (match_dup 6))
3284 (use (const_int 1))]))
3285 (cond_exec (ne (match_dup 5) (const_int 0))
3286 (parallel [(set (match_dup 3)
3287 (mult:XF (match_dup 3) (match_dup 3)))
3288 (use (const_int 1))]))
3289 (cond_exec (ne (match_dup 5) (const_int 0))
3290 (parallel [(set (match_dup 6)
3291 (plus:XF (mult:XF (match_dup 3) (match_dup 6))
3293 (use (const_int 1))]))
3294 (cond_exec (ne (match_dup 5) (const_int 0))
3295 (parallel [(set (match_dup 9)
3297 (mult:XF (match_dup 7) (match_dup 6))))
3298 (use (const_int 1))]))
3299 (cond_exec (ne (match_dup 5) (const_int 0))
3300 (parallel [(set (match_dup 4)
3301 (minus:DF (match_dup 1)
3302 (mult:DF (match_dup 2) (match_dup 9))))
3303 (use (const_int 1))]))
3304 (cond_exec (ne (match_dup 5) (const_int 0))
3306 (plus:DF (mult:DF (match_dup 4) (match_dup 0))
3310 operands[6] = gen_rtx_REG (XFmode, REGNO (operands[0]));
3311 operands[7] = gen_rtx_REG (XFmode, REGNO (operands[1]));
3312 operands[8] = gen_rtx_REG (XFmode, REGNO (operands[2]));
3313 operands[9] = gen_rtx_REG (DFmode, REGNO (operands[3]));
3314 operands[10] = CONST1_RTX (XFmode);
3316 [(set_attr "predicable" "no")])
3318 ;; Inline square root.
3320 (define_expand "sqrtdf2"
3321 [(set (match_operand:DF 0 "fr_register_operand" "=&f")
3322 (sqrt:DF (match_operand:DF 1 "fr_register_operand" "f")))]
3323 "TARGET_INLINE_SQRT"
3326 if (TARGET_INLINE_SQRT == INL_MIN_LAT)
3328 insn = gen_sqrtdf2_internal_lat (operands[0], operands[1]);
3333 insn = gen_sqrtdf2_internal_thr (operands[0], operands[1]);
3338 ;; Latency-optimized square root.
3339 ;; FIXME: Implement.
3341 ;; Throughput-optimized square root.
3343 (define_insn_and_split "sqrtdf2_internal_thr"
3344 [(set (match_operand:DF 0 "fr_register_operand" "=&f")
3345 (sqrt:DF (match_operand:DF 1 "fr_register_operand" "f")))
3346 ;; Register r2 in optimization guide.
3347 (clobber (match_scratch:DI 2 "=r"))
3348 ;; Register f8 in optimization guide
3349 (clobber (match_scratch:XF 3 "=&f"))
3350 ;; Register f9 in optimization guide
3351 (clobber (match_scratch:XF 4 "=&f"))
3352 ;; Register f10 in optimization guide
3353 (clobber (match_scratch:XF 5 "=&f"))
3354 ;; Register p6 in optimization guide.
3355 (clobber (match_scratch:BI 6 "=c"))]
3356 "TARGET_INLINE_SQRT == INL_MAX_THR"
3358 "&& reload_completed"
3359 [ ;; exponent of +1/2 in r2
3360 (set (match_dup 2) (const_int 65534))
3363 (unspec:XF [(match_dup 2)] UNSPEC_SETF_EXP))
3365 ;; y0 = 1/sqrt(a) in f7
3366 (parallel [(set (match_dup 7)
3367 (div:XF (const_int 1)
3368 (sqrt:XF (match_dup 8))))
3370 (unspec:BI [(match_dup 8)]
3371 UNSPEC_FR_SQRT_RECIP_APPROX))
3372 (use (const_int 0))])
3374 ;; H0 = 1/2 * y0 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 5) (match_dup 7))
3379 (use (const_int 1))]))
3381 ;; G0 = a * y0 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 8) (match_dup 7))
3386 (use (const_int 1))]))
3388 ;; r0 = 1/2 - G0 * H0 in f9
3389 (cond_exec (ne (match_dup 6) (const_int 0))
3390 (parallel [(set (match_dup 4)
3391 (minus:XF (match_dup 5)
3392 (mult:XF (match_dup 7) (match_dup 3))))
3393 (use (const_int 1))]))
3395 ;; H1 = H0 + r0 * H0 in f8
3396 (cond_exec (ne (match_dup 6) (const_int 0))
3397 (parallel [(set (match_dup 3)
3398 (plus:XF (mult:XF (match_dup 4) (match_dup 3))
3400 (use (const_int 1))]))
3402 ;; G1 = G0 + r0 * G0 in f7
3403 (cond_exec (ne (match_dup 6) (const_int 0))
3404 (parallel [(set (match_dup 7)
3405 (plus:XF (mult:XF (match_dup 4) (match_dup 7))
3407 (use (const_int 1))]))
3409 ;; r1 = 1/2 - G1 * H1 in f9
3410 (cond_exec (ne (match_dup 6) (const_int 0))
3411 (parallel [(set (match_dup 4)
3412 (minus:XF (match_dup 5)
3413 (mult:XF (match_dup 7) (match_dup 3))))
3414 (use (const_int 1))]))
3416 ;; H2 = H1 + r1 * H1 in f8
3417 (cond_exec (ne (match_dup 6) (const_int 0))
3418 (parallel [(set (match_dup 3)
3419 (plus:XF (mult:XF (match_dup 4) (match_dup 3))
3421 (use (const_int 1))]))
3423 ;; G2 = G1 + r1 * G1 in f7
3424 (cond_exec (ne (match_dup 6) (const_int 0))
3425 (parallel [(set (match_dup 7)
3426 (plus:XF (mult:XF (match_dup 4) (match_dup 7))
3428 (use (const_int 1))]))
3430 ;; d2 = a - G2 * G2 in f9
3431 (cond_exec (ne (match_dup 6) (const_int 0))
3432 (parallel [(set (match_dup 4)
3433 (minus:XF (match_dup 8)
3434 (mult:XF (match_dup 7) (match_dup 7))))
3435 (use (const_int 1))]))
3437 ;; G3 = G2 + d2 * H2 in f7
3438 (cond_exec (ne (match_dup 6) (const_int 0))
3439 (parallel [(set (match_dup 7)
3440 (plus:XF (mult:XF (match_dup 4) (match_dup 3))
3442 (use (const_int 1))]))
3444 ;; d3 = a - G3 * G3 in f9
3445 (cond_exec (ne (match_dup 6) (const_int 0))
3446 (parallel [(set (match_dup 4)
3447 (minus:XF (match_dup 8)
3448 (mult:XF (match_dup 7) (match_dup 7))))
3449 (use (const_int 1))]))
3451 ;; S = G3 + d3 * H2 in f7
3452 (cond_exec (ne (match_dup 6) (const_int 0))
3453 (parallel [(set (match_dup 0)
3455 (plus:XF (mult:XF (match_dup 4) (match_dup 3))
3457 (use (const_int 0))]))]
3459 /* Generate 82-bit versions of the input and output operands. */
3460 operands[7] = gen_rtx_REG (XFmode, REGNO (operands[0]));
3461 operands[8] = gen_rtx_REG (XFmode, REGNO (operands[1]));
3462 /* Generate required floating-point constants. */
3463 operands[9] = CONST0_RTX (XFmode);
3465 [(set_attr "predicable" "no")])
3467 ;; ::::::::::::::::::::
3469 ;; :: 80 bit floating point arithmetic
3471 ;; ::::::::::::::::::::
3473 (define_insn "addxf3"
3474 [(set (match_operand:XF 0 "fr_register_operand" "=f")
3475 (plus:XF (match_operand:XF 1 "xfreg_or_fp01_operand" "fG")
3476 (match_operand:XF 2 "xfreg_or_fp01_operand" "fG")))]
3478 "fadd %0 = %F1, %F2"
3479 [(set_attr "itanium_class" "fmac")])
3481 (define_insn "*addxf3_truncsf"
3482 [(set (match_operand:SF 0 "fr_register_operand" "=f")
3484 (plus:XF (match_operand:XF 1 "xfreg_or_fp01_operand" "fG")
3485 (match_operand:XF 2 "xfreg_or_fp01_operand" "fG"))))]
3487 "fadd.s %0 = %F1, %F2"
3488 [(set_attr "itanium_class" "fmac")])
3490 (define_insn "*addxf3_truncdf"
3491 [(set (match_operand:DF 0 "fr_register_operand" "=f")
3493 (plus:XF (match_operand:XF 1 "xfreg_or_fp01_operand" "fG")
3494 (match_operand:XF 2 "xfreg_or_fp01_operand" "fG"))))]
3496 "fadd.d %0 = %F1, %F2"
3497 [(set_attr "itanium_class" "fmac")])
3499 (define_insn "subxf3"
3500 [(set (match_operand:XF 0 "fr_register_operand" "=f")
3501 (minus:XF (match_operand:XF 1 "xfreg_or_fp01_operand" "fG")
3502 (match_operand:XF 2 "xfreg_or_fp01_operand" "fG")))]
3504 "fsub %0 = %F1, %F2"
3505 [(set_attr "itanium_class" "fmac")])
3507 (define_insn "*subxf3_truncsf"
3508 [(set (match_operand:SF 0 "fr_register_operand" "=f")
3510 (minus:XF (match_operand:XF 1 "xfreg_or_fp01_operand" "fG")
3511 (match_operand:XF 2 "xfreg_or_fp01_operand" "fG"))))]
3513 "fsub.s %0 = %F1, %F2"
3514 [(set_attr "itanium_class" "fmac")])
3516 (define_insn "*subxf3_truncdf"
3517 [(set (match_operand:DF 0 "fr_register_operand" "=f")
3519 (minus:XF (match_operand:XF 1 "xfreg_or_fp01_operand" "fG")
3520 (match_operand:XF 2 "xfreg_or_fp01_operand" "fG"))))]
3522 "fsub.d %0 = %F1, %F2"
3523 [(set_attr "itanium_class" "fmac")])
3525 (define_insn "mulxf3"
3526 [(set (match_operand:XF 0 "fr_register_operand" "=f")
3527 (mult:XF (match_operand:XF 1 "xfreg_or_fp01_operand" "fG")
3528 (match_operand:XF 2 "xfreg_or_fp01_operand" "fG")))]
3530 "fmpy %0 = %F1, %F2"
3531 [(set_attr "itanium_class" "fmac")])
3533 (define_insn "*mulxf3_truncsf"
3534 [(set (match_operand:SF 0 "fr_register_operand" "=f")
3536 (mult:XF (match_operand:XF 1 "xfreg_or_fp01_operand" "fG")
3537 (match_operand:XF 2 "xfreg_or_fp01_operand" "fG"))))]
3539 "fmpy.s %0 = %F1, %F2"
3540 [(set_attr "itanium_class" "fmac")])
3542 (define_insn "*mulxf3_truncdf"
3543 [(set (match_operand:DF 0 "fr_register_operand" "=f")
3545 (mult:XF (match_operand:XF 1 "xfreg_or_fp01_operand" "fG")
3546 (match_operand:XF 2 "xfreg_or_fp01_operand" "fG"))))]
3548 "fmpy.d %0 = %F1, %F2"
3549 [(set_attr "itanium_class" "fmac")])
3551 (define_insn "*mulxf3_alts"
3552 [(set (match_operand:XF 0 "fr_register_operand" "=f")
3553 (mult:XF (match_operand:XF 1 "xfreg_or_fp01_operand" "fG")
3554 (match_operand:XF 2 "xfreg_or_fp01_operand" "fG")))
3555 (use (match_operand:SI 3 "const_int_operand" ""))]
3557 "fmpy.s%3 %0 = %F1, %F2"
3558 [(set_attr "itanium_class" "fmac")])
3560 (define_insn "*mulxf3_truncsf_alts"
3561 [(set (match_operand:SF 0 "fr_register_operand" "=f")
3563 (mult:XF (match_operand:XF 1 "xfreg_or_fp01_operand" "fG")
3564 (match_operand:XF 2 "xfreg_or_fp01_operand" "fG"))))
3565 (use (match_operand:SI 3 "const_int_operand" ""))]
3567 "fmpy.s.s%3 %0 = %F1, %F2"
3568 [(set_attr "itanium_class" "fmac")])
3570 (define_insn "*mulxf3_truncdf_alts"
3571 [(set (match_operand:DF 0 "fr_register_operand" "=f")
3573 (mult:XF (match_operand:XF 1 "xfreg_or_fp01_operand" "fG")
3574 (match_operand:XF 2 "xfreg_or_fp01_operand" "fG"))))
3575 (use (match_operand:SI 3 "const_int_operand" ""))]
3577 "fmpy.d.s%3 %0 = %F1, %F2"
3578 [(set_attr "itanium_class" "fmac")])
3580 (define_insn "absxf2"
3581 [(set (match_operand:XF 0 "fr_register_operand" "=f")
3582 (abs:XF (match_operand:XF 1 "xfreg_or_fp01_operand" "fG")))]
3585 [(set_attr "itanium_class" "fmisc")])
3587 (define_insn "negxf2"
3588 [(set (match_operand:XF 0 "fr_register_operand" "=f")
3589 (neg:XF (match_operand:XF 1 "xfreg_or_fp01_operand" "fG")))]
3592 [(set_attr "itanium_class" "fmisc")])
3594 (define_insn "*nabsxf2"
3595 [(set (match_operand:XF 0 "fr_register_operand" "=f")
3596 (neg:XF (abs:XF (match_operand:XF 1 "xfreg_or_fp01_operand" "fG"))))]
3599 [(set_attr "itanium_class" "fmisc")])
3601 (define_insn "copysignxf3"
3602 [(set (match_operand:XF 0 "register_operand" "=f")
3603 (unspec:XF [(match_operand:XF 1 "fr_reg_or_fp01_operand" "fG")
3604 (match_operand:XF 2 "fr_reg_or_fp01_operand" "fG")]
3607 "fmerge.s %0 = %F2, %F1"
3608 [(set_attr "itanium_class" "fmisc")])
3610 (define_insn "*ncopysignxf3"
3611 [(set (match_operand:XF 0 "register_operand" "=f")
3612 (neg:XF (unspec:XF [(match_operand:XF 1 "fr_reg_or_fp01_operand" "fG")
3613 (match_operand:XF 2 "fr_reg_or_fp01_operand" "fG")]
3616 "fmerge.ns %0 = %F2, %F1"
3617 [(set_attr "itanium_class" "fmisc")])
3619 (define_insn "sminxf3"
3620 [(set (match_operand:XF 0 "fr_register_operand" "=f")
3621 (smin:XF (match_operand:XF 1 "xfreg_or_fp01_operand" "fG")
3622 (match_operand:XF 2 "xfreg_or_fp01_operand" "fG")))]
3624 "fmin %0 = %F1, %F2"
3625 [(set_attr "itanium_class" "fmisc")])
3627 (define_insn "smaxxf3"
3628 [(set (match_operand:XF 0 "fr_register_operand" "=f")
3629 (smax:XF (match_operand:XF 1 "xfreg_or_fp01_operand" "fG")
3630 (match_operand:XF 2 "xfreg_or_fp01_operand" "fG")))]
3632 "fmax %0 = %F1, %F2"
3633 [(set_attr "itanium_class" "fmisc")])
3635 (define_insn "*maddxf4"
3636 [(set (match_operand:XF 0 "fr_register_operand" "=f")
3637 (plus:XF (mult:XF (match_operand:XF 1 "xfreg_or_fp01_operand" "fG")
3638 (match_operand:XF 2 "xfreg_or_fp01_operand" "fG"))
3639 (match_operand:XF 3 "xfreg_or_fp01_operand" "fG")))]
3641 "fma %0 = %F1, %F2, %F3"
3642 [(set_attr "itanium_class" "fmac")])
3644 (define_insn "*maddxf4_truncsf"
3645 [(set (match_operand:SF 0 "fr_register_operand" "=f")
3647 (plus:XF (mult:XF (match_operand:XF 1 "xfreg_or_fp01_operand" "fG")
3648 (match_operand:XF 2 "xfreg_or_fp01_operand" "fG"))
3649 (match_operand:XF 3 "xfreg_or_fp01_operand" "fG"))))]
3651 "fma.s %0 = %F1, %F2, %F3"
3652 [(set_attr "itanium_class" "fmac")])
3654 (define_insn "*maddxf4_truncdf"
3655 [(set (match_operand:DF 0 "fr_register_operand" "=f")
3657 (plus:XF (mult:XF (match_operand:XF 1 "xfreg_or_fp01_operand" "fG")
3658 (match_operand:XF 2 "xfreg_or_fp01_operand" "fG"))
3659 (match_operand:XF 3 "xfreg_or_fp01_operand" "fG"))))]
3661 "fma.d %0 = %F1, %F2, %F3"
3662 [(set_attr "itanium_class" "fmac")])
3664 (define_insn "*maddxf4_alts"
3665 [(set (match_operand:XF 0 "fr_register_operand" "=f")
3666 (plus:XF (mult:XF (match_operand:XF 1 "xfreg_or_fp01_operand" "fG")
3667 (match_operand:XF 2 "xfreg_or_fp01_operand" "fG"))
3668 (match_operand:XF 3 "xfreg_or_fp01_operand" "fG")))
3669 (use (match_operand:SI 4 "const_int_operand" ""))]
3671 "fma.s%4 %0 = %F1, %F2, %F3"
3672 [(set_attr "itanium_class" "fmac")])
3674 (define_insn "*maddxf4_alts_truncsf"
3675 [(set (match_operand:SF 0 "fr_register_operand" "=f")
3677 (plus:XF (mult:XF (match_operand:XF 1 "xfreg_or_fp01_operand" "fG")
3678 (match_operand:XF 2 "xfreg_or_fp01_operand" "fG"))
3679 (match_operand:XF 3 "xfreg_or_fp01_operand" "fG"))))
3680 (use (match_operand:SI 4 "const_int_operand" ""))]
3682 "fma.s.s%4 %0 = %F1, %F2, %F3"
3683 [(set_attr "itanium_class" "fmac")])
3685 (define_insn "*maddxf4_alts_truncdf"
3686 [(set (match_operand:DF 0 "fr_register_operand" "=f")
3688 (plus:XF (mult:XF (match_operand:XF 1 "xfreg_or_fp01_operand" "fG")
3689 (match_operand:XF 2 "xfreg_or_fp01_operand" "fG"))
3690 (match_operand:XF 3 "xfreg_or_fp01_operand" "fG"))))
3691 (use (match_operand:SI 4 "const_int_operand" ""))]
3693 "fma.d.s%4 %0 = %F1, %F2, %F3"
3694 [(set_attr "itanium_class" "fmac")])
3696 (define_insn "*msubxf4"
3697 [(set (match_operand:XF 0 "fr_register_operand" "=f")
3698 (minus:XF (mult:XF (match_operand:XF 1 "xfreg_or_fp01_operand" "fG")
3699 (match_operand:XF 2 "xfreg_or_fp01_operand" "fG"))
3700 (match_operand:XF 3 "xfreg_or_fp01_operand" "fG")))]
3702 "fms %0 = %F1, %F2, %F3"
3703 [(set_attr "itanium_class" "fmac")])
3705 (define_insn "*msubxf4_truncsf"
3706 [(set (match_operand:SF 0 "fr_register_operand" "=f")
3708 (minus:XF (mult:XF (match_operand:XF 1 "xfreg_or_fp01_operand" "fG")
3709 (match_operand:XF 2 "xfreg_or_fp01_operand" "fG"))
3710 (match_operand:XF 3 "xfreg_or_fp01_operand" "fG"))))]
3712 "fms.s %0 = %F1, %F2, %F3"
3713 [(set_attr "itanium_class" "fmac")])
3715 (define_insn "*msubxf4_truncdf"
3716 [(set (match_operand:DF 0 "fr_register_operand" "=f")
3718 (minus:XF (mult:XF (match_operand:XF 1 "xfreg_or_fp01_operand" "fG")
3719 (match_operand:XF 2 "xfreg_or_fp01_operand" "fG"))
3720 (match_operand:XF 3 "xfreg_or_fp01_operand" "fG"))))]
3722 "fms.d %0 = %F1, %F2, %F3"
3723 [(set_attr "itanium_class" "fmac")])
3725 (define_insn "*nmulxf3"
3726 [(set (match_operand:XF 0 "fr_register_operand" "=f")
3727 (neg:XF (mult:XF (match_operand:XF 1 "xfreg_or_fp01_operand" "fG")
3728 (match_operand:XF 2 "xfreg_or_fp01_operand" "fG"))))]
3730 "fnmpy %0 = %F1, %F2"
3731 [(set_attr "itanium_class" "fmac")])
3733 (define_insn "*nmulxf3_truncsf"
3734 [(set (match_operand:SF 0 "fr_register_operand" "=f")
3737 (match_operand:XF 1 "xfreg_or_fp01_operand" "fG")
3738 (match_operand:XF 2 "xfreg_or_fp01_operand" "fG")))))]
3740 "fnmpy.s %0 = %F1, %F2"
3741 [(set_attr "itanium_class" "fmac")])
3743 (define_insn "*nmulxf3_truncdf"
3744 [(set (match_operand:DF 0 "fr_register_operand" "=f")
3747 (match_operand:XF 1 "xfreg_or_fp01_operand" "fG")
3748 (match_operand:XF 2 "xfreg_or_fp01_operand" "fG")))))]
3750 "fnmpy.d %0 = %F1, %F2"
3751 [(set_attr "itanium_class" "fmac")])
3753 (define_insn "*nmaddxf4"
3754 [(set (match_operand:XF 0 "fr_register_operand" "=f")
3755 (minus:XF (match_operand:XF 3 "xfreg_or_fp01_operand" "fG")
3756 (mult:XF (match_operand:XF 1 "xfreg_or_fp01_operand" "fG")
3757 (match_operand:XF 2 "xfreg_or_fp01_operand" "fG")
3760 "fnma %0 = %F1, %F2, %F3"
3761 [(set_attr "itanium_class" "fmac")])
3763 (define_insn "*nmaddxf4_truncsf"
3764 [(set (match_operand:SF 0 "fr_register_operand" "=f")
3766 (minus:XF (match_operand:XF 3 "xfreg_or_fp01_operand" "fG")
3767 (mult:XF (match_operand:XF 1 "xfreg_or_fp01_operand" "fG")
3768 (match_operand:XF 2 "xfreg_or_fp01_operand" "fG")
3771 "fnma.s %0 = %F1, %F2, %F3"
3772 [(set_attr "itanium_class" "fmac")])
3774 (define_insn "*nmaddxf4_truncdf"
3775 [(set (match_operand:DF 0 "fr_register_operand" "=f")
3777 (minus:XF (match_operand:XF 3 "xfreg_or_fp01_operand" "fG")
3778 (mult:XF (match_operand:XF 1 "xfreg_or_fp01_operand" "fG")
3779 (match_operand:XF 2 "xfreg_or_fp01_operand" "fG")
3782 "fnma.d %0 = %F1, %F2, %F3"
3783 [(set_attr "itanium_class" "fmac")])
3785 (define_insn "*nmaddxf4_alts"
3786 [(set (match_operand:XF 0 "fr_register_operand" "=f")
3787 (minus:XF (match_operand:XF 3 "xfreg_or_fp01_operand" "fG")
3788 (mult:XF (match_operand:XF 1 "xfreg_or_fp01_operand" "fG")
3789 (match_operand:XF 2 "xfreg_or_fp01_operand" "fG")
3791 (use (match_operand:SI 4 "const_int_operand" ""))]
3793 "fnma.s%4 %0 = %F1, %F2, %F3"
3794 [(set_attr "itanium_class" "fmac")])
3796 (define_insn "*nmaddxf4_truncsf_alts"
3797 [(set (match_operand:SF 0 "fr_register_operand" "=f")
3799 (minus:XF (match_operand:XF 3 "xfreg_or_fp01_operand" "fG")
3800 (mult:XF (match_operand:XF 1 "xfreg_or_fp01_operand" "fG")
3801 (match_operand:XF 2 "xfreg_or_fp01_operand" "fG")
3803 (use (match_operand:SI 4 "const_int_operand" ""))]
3805 "fnma.s.s%4 %0 = %F1, %F2, %F3"
3806 [(set_attr "itanium_class" "fmac")])
3808 (define_insn "*nmaddxf4_truncdf_alts"
3809 [(set (match_operand:DF 0 "fr_register_operand" "=f")
3811 (minus:XF (match_operand:XF 3 "xfreg_or_fp01_operand" "fG")
3812 (mult:XF (match_operand:XF 1 "xfreg_or_fp01_operand" "fG")
3813 (match_operand:XF 2 "xfreg_or_fp01_operand" "fG")
3815 (use (match_operand:SI 4 "const_int_operand" ""))]
3817 "fnma.d.s%4 %0 = %F1, %F2, %F3"
3818 [(set_attr "itanium_class" "fmac")])
3820 (define_expand "divxf3"
3821 [(set (match_operand:XF 0 "fr_register_operand" "")
3822 (div:XF (match_operand:XF 1 "fr_register_operand" "")
3823 (match_operand:XF 2 "fr_register_operand" "")))]
3824 "TARGET_INLINE_FLOAT_DIV"
3827 if (TARGET_INLINE_FLOAT_DIV == INL_MIN_LAT)
3828 insn = gen_divxf3_internal_lat (operands[0], operands[1], operands[2]);
3830 insn = gen_divxf3_internal_thr (operands[0], operands[1], operands[2]);
3835 (define_insn_and_split "divxf3_internal_lat"
3836 [(set (match_operand:XF 0 "fr_register_operand" "=&f")
3837 (div:XF (match_operand:XF 1 "fr_register_operand" "f")
3838 (match_operand:XF 2 "fr_register_operand" "f")))
3839 (clobber (match_scratch:XF 3 "=&f"))
3840 (clobber (match_scratch:XF 4 "=&f"))
3841 (clobber (match_scratch:XF 5 "=&f"))
3842 (clobber (match_scratch:XF 6 "=&f"))
3843 (clobber (match_scratch:BI 7 "=c"))]
3844 "TARGET_INLINE_FLOAT_DIV == INL_MIN_LAT"
3846 "&& reload_completed"
3847 [(parallel [(set (match_dup 0) (div:XF (const_int 1) (match_dup 2)))
3848 (set (match_dup 7) (unspec:BI [(match_dup 1) (match_dup 2)]
3849 UNSPEC_FR_RECIP_APPROX))
3850 (use (const_int 0))])
3851 (cond_exec (ne (match_dup 7) (const_int 0))
3852 (parallel [(set (match_dup 3)
3853 (minus:XF (match_dup 8)
3854 (mult:XF (match_dup 2) (match_dup 0))))
3855 (use (const_int 1))]))
3856 (cond_exec (ne (match_dup 7) (const_int 0))
3857 (parallel [(set (match_dup 4) (mult:XF (match_dup 1) (match_dup 0)))
3858 (use (const_int 1))]))
3859 (cond_exec (ne (match_dup 7) (const_int 0))
3860 (parallel [(set (match_dup 5) (mult:XF (match_dup 3) (match_dup 3)))
3861 (use (const_int 1))]))
3862 (cond_exec (ne (match_dup 7) (const_int 0))
3863 (parallel [(set (match_dup 6)
3864 (plus:XF (mult:XF (match_dup 3) (match_dup 3))
3866 (use (const_int 1))]))
3867 (cond_exec (ne (match_dup 7) (const_int 0))
3868 (parallel [(set (match_dup 3)
3869 (plus:XF (mult:XF (match_dup 5) (match_dup 5))
3871 (use (const_int 1))]))
3872 (cond_exec (ne (match_dup 7) (const_int 0))
3873 (parallel [(set (match_dup 5)
3874 (plus:XF (mult:XF (match_dup 6) (match_dup 0))
3876 (use (const_int 1))]))
3877 (cond_exec (ne (match_dup 7) (const_int 0))
3878 (parallel [(set (match_dup 0)
3879 (plus:XF (mult:XF (match_dup 5) (match_dup 3))
3881 (use (const_int 1))]))
3882 (cond_exec (ne (match_dup 7) (const_int 0))
3883 (parallel [(set (match_dup 4)
3884 (minus:XF (match_dup 1)
3885 (mult:XF (match_dup 2) (match_dup 4))))
3886 (use (const_int 1))]))
3887 (cond_exec (ne (match_dup 7) (const_int 0))
3888 (parallel [(set (match_dup 3)
3889 (plus:XF (mult:XF (match_dup 3) (match_dup 0))
3891 (use (const_int 1))]))
3892 (cond_exec (ne (match_dup 7) (const_int 0))
3893 (parallel [(set (match_dup 5)
3894 (minus:XF (match_dup 8)
3895 (mult:XF (match_dup 2) (match_dup 0))))
3896 (use (const_int 1))]))
3897 (cond_exec (ne (match_dup 7) (const_int 0))
3898 (parallel [(set (match_dup 0)
3899 (plus:XF (mult:XF (match_dup 4) (match_dup 0))
3901 (use (const_int 1))]))
3902 (cond_exec (ne (match_dup 7) (const_int 0))
3903 (parallel [(set (match_dup 4)
3904 (minus:XF (match_dup 1)
3905 (mult:XF (match_dup 2) (match_dup 3))))
3906 (use (const_int 1))]))
3907 (cond_exec (ne (match_dup 7) (const_int 0))
3909 (plus:XF (mult:XF (match_dup 4) (match_dup 0))
3912 "operands[8] = CONST1_RTX (XFmode);"
3913 [(set_attr "predicable" "no")])
3915 (define_insn_and_split "divxf3_internal_thr"
3916 [(set (match_operand:XF 0 "fr_register_operand" "=&f")
3917 (div:XF (match_operand:XF 1 "fr_register_operand" "f")
3918 (match_operand:XF 2 "fr_register_operand" "f")))
3919 (clobber (match_scratch:XF 3 "=&f"))
3920 (clobber (match_scratch:XF 4 "=&f"))
3921 (clobber (match_scratch:BI 5 "=c"))]
3922 "TARGET_INLINE_FLOAT_DIV == INL_MAX_THR"
3924 "&& reload_completed"
3925 [(parallel [(set (match_dup 0) (div:XF (const_int 1) (match_dup 2)))
3926 (set (match_dup 5) (unspec:BI [(match_dup 1) (match_dup 2)]
3927 UNSPEC_FR_RECIP_APPROX))
3928 (use (const_int 0))])
3929 (cond_exec (ne (match_dup 5) (const_int 0))
3930 (parallel [(set (match_dup 3)
3931 (minus:XF (match_dup 6)
3932 (mult:XF (match_dup 2) (match_dup 0))))
3933 (use (const_int 1))]))
3934 (cond_exec (ne (match_dup 5) (const_int 0))
3935 (parallel [(set (match_dup 4)
3936 (plus:XF (mult:XF (match_dup 3) (match_dup 0))
3938 (use (const_int 1))]))
3939 (cond_exec (ne (match_dup 5) (const_int 0))
3940 (parallel [(set (match_dup 3) (mult:XF (match_dup 3) (match_dup 3)))
3941 (use (const_int 1))]))
3942 (cond_exec (ne (match_dup 5) (const_int 0))
3943 (parallel [(set (match_dup 3)
3944 (plus:XF (mult:XF (match_dup 3) (match_dup 4))
3946 (use (const_int 1))]))
3947 (cond_exec (ne (match_dup 5) (const_int 0))
3948 (parallel [(set (match_dup 4) (mult:XF (match_dup 1) (match_dup 0)))
3949 (use (const_int 1))]))
3950 (cond_exec (ne (match_dup 5) (const_int 0))
3951 (parallel [(set (match_dup 0)
3952 (minus:XF (match_dup 6)
3953 (mult:XF (match_dup 2) (match_dup 3))))
3954 (use (const_int 1))]))
3955 (cond_exec (ne (match_dup 5) (const_int 0))
3956 (parallel [(set (match_dup 0)
3957 (plus:XF (mult:XF (match_dup 0) (match_dup 3))
3959 (use (const_int 1))]))
3960 (cond_exec (ne (match_dup 5) (const_int 0))
3961 (parallel [(set (match_dup 3)
3962 (minus:XF (match_dup 1)
3963 (mult:XF (match_dup 2) (match_dup 4))))
3964 (use (const_int 1))]))
3965 (cond_exec (ne (match_dup 5) (const_int 0))
3966 (parallel [(set (match_dup 3)
3967 (plus:XF (mult:XF (match_dup 3) (match_dup 0))
3969 (use (const_int 1))]))
3970 (cond_exec (ne (match_dup 5) (const_int 0))
3971 (parallel [(set (match_dup 4)
3972 (minus:XF (match_dup 6)
3973 (mult:XF (match_dup 2) (match_dup 0))))
3974 (use (const_int 1))]))
3975 (cond_exec (ne (match_dup 5) (const_int 0))
3976 (parallel [(set (match_dup 0)
3977 (plus:XF (mult:XF (match_dup 4) (match_dup 0))
3979 (use (const_int 1))]))
3980 (cond_exec (ne (match_dup 5) (const_int 0))
3981 (parallel [(set (match_dup 4)
3982 (minus:XF (match_dup 1)
3983 (mult:XF (match_dup 2) (match_dup 3))))
3984 (use (const_int 1))]))
3985 (cond_exec (ne (match_dup 5) (const_int 0))
3987 (plus:XF (mult:XF (match_dup 4) (match_dup 0))
3990 "operands[6] = CONST1_RTX (XFmode);"
3991 [(set_attr "predicable" "no")])
3993 ;; Inline square root.
3995 (define_expand "sqrtxf2"
3996 [(set (match_operand:XF 0 "fr_register_operand" "=&f")
3997 (sqrt:XF (match_operand:XF 1 "fr_register_operand" "f")))]
3998 "TARGET_INLINE_SQRT"
4001 if (TARGET_INLINE_SQRT == INL_MIN_LAT)
4003 insn = gen_sqrtxf2_internal_lat (operands[0], operands[1]);
4008 insn = gen_sqrtxf2_internal_thr (operands[0], operands[1]);
4013 ;; Latency-optimized square root.
4014 ;; FIXME: Implement.
4016 ;; Throughput-optimized square root.
4018 (define_insn_and_split "sqrtxf2_internal_thr"
4019 [(set (match_operand:XF 0 "fr_register_operand" "=&f")
4020 (sqrt:XF (match_operand:XF 1 "fr_register_operand" "f")))
4021 ;; Register r2 in optimization guide.
4022 (clobber (match_scratch:DI 2 "=r"))
4023 ;; Register f8 in optimization guide
4024 (clobber (match_scratch:XF 3 "=&f"))
4025 ;; Register f9 in optimization guide
4026 (clobber (match_scratch:XF 4 "=&f"))
4027 ;; Register f10 in optimization guide
4028 (clobber (match_scratch:XF 5 "=&f"))
4029 ;; Register f11 in optimization guide
4030 (clobber (match_scratch:XF 6 "=&f"))
4031 ;; Register p6 in optimization guide.
4032 (clobber (match_scratch:BI 7 "=c"))]
4033 "TARGET_INLINE_SQRT == INL_MAX_THR"
4035 "&& reload_completed"
4036 [ ;; exponent of +1/2 in r2
4037 (set (match_dup 2) (const_int 65534))
4038 ;; +1/2 in f8. The Intel manual mistakenly specifies f10.
4040 (unspec:XF [(match_dup 2)] UNSPEC_SETF_EXP))
4042 ;; y0 = 1/sqrt(a) in f7
4043 (parallel [(set (match_dup 8)
4044 (div:XF (const_int 1)
4045 (sqrt:XF (match_dup 9))))
4047 (unspec:BI [(match_dup 9)]
4048 UNSPEC_FR_SQRT_RECIP_APPROX))
4049 (use (const_int 0))])
4051 ;; H0 = 1/2 * y0 in f9
4052 (cond_exec (ne (match_dup 7) (const_int 0))
4053 (parallel [(set (match_dup 4)
4054 (plus:XF (mult:XF (match_dup 3) (match_dup 8))
4056 (use (const_int 1))]))
4058 ;; S0 = a * y0 in f7
4059 (cond_exec (ne (match_dup 7) (const_int 0))
4060 (parallel [(set (match_dup 8)
4061 (plus:XF (mult:XF (match_dup 9) (match_dup 8))
4063 (use (const_int 1))]))
4065 ;; d0 = 1/2 - S0 * H0 in f10
4066 (cond_exec (ne (match_dup 7) (const_int 0))
4067 (parallel [(set (match_dup 5)
4068 (minus:XF (match_dup 3)
4069 (mult:XF (match_dup 8) (match_dup 4))))
4070 (use (const_int 1))]))
4072 ;; H1 = H0 + d0 * H0 in f9
4073 (cond_exec (ne (match_dup 7) (const_int 0))
4074 (parallel [(set (match_dup 4)
4075 (plus:XF (mult:XF (match_dup 5) (match_dup 4))
4077 (use (const_int 1))]))
4079 ;; S1 = S0 + d0 * S0 in f7
4080 (cond_exec (ne (match_dup 7) (const_int 0))
4081 (parallel [(set (match_dup 8)
4082 (plus:XF (mult:XF (match_dup 5) (match_dup 8))
4084 (use (const_int 1))]))
4086 ;; d1 = 1/2 - S1 * H1 in f10
4087 (cond_exec (ne (match_dup 7) (const_int 0))
4088 (parallel [(set (match_dup 5)
4089 (minus:XF (match_dup 3)
4090 (mult:XF (match_dup 8) (match_dup 4))))
4091 (use (const_int 1))]))
4093 ;; H2 = H1 + d1 * H1 in f9
4094 (cond_exec (ne (match_dup 7) (const_int 0))
4095 (parallel [(set (match_dup 4)
4096 (plus:XF (mult:XF (match_dup 5) (match_dup 4))
4098 (use (const_int 1))]))
4100 ;; S2 = S1 + d1 * S1 in f7
4101 (cond_exec (ne (match_dup 7) (const_int 0))
4102 (parallel [(set (match_dup 8)
4103 (plus:XF (mult:XF (match_dup 5) (match_dup 8))
4105 (use (const_int 1))]))
4107 ;; d2 = 1/2 - S2 * H2 in f10
4108 (cond_exec (ne (match_dup 7) (const_int 0))
4109 (parallel [(set (match_dup 5)
4110 (minus:XF (match_dup 3)
4111 (mult:XF (match_dup 8) (match_dup 4))))
4112 (use (const_int 1))]))
4114 ;; e2 = a - S2 * S2 in f8
4115 (cond_exec (ne (match_dup 7) (const_int 0))
4116 (parallel [(set (match_dup 3)
4117 (minus:XF (match_dup 9)
4118 (mult:XF (match_dup 8) (match_dup 8))))
4119 (use (const_int 1))]))
4121 ;; S3 = S2 + e2 * H2 in f7
4122 (cond_exec (ne (match_dup 7) (const_int 0))
4123 (parallel [(set (match_dup 8)
4124 (plus:XF (mult:XF (match_dup 3) (match_dup 4))
4126 (use (const_int 1))]))
4128 ;; H3 = H2 + d2 * H2 in f9
4129 (cond_exec (ne (match_dup 7) (const_int 0))
4130 (parallel [(set (match_dup 4)
4131 (plus:XF (mult:XF (match_dup 5) (match_dup 4))
4133 (use (const_int 1))]))
4135 ;; e3 = a - S3 * S3 in f8
4136 (cond_exec (ne (match_dup 7) (const_int 0))
4137 (parallel [(set (match_dup 3)
4138 (minus:XF (match_dup 9)
4139 (mult:XF (match_dup 8) (match_dup 8))))
4140 (use (const_int 1))]))
4142 ;; S = S3 + e3 * H3 in f7
4143 (cond_exec (ne (match_dup 7) (const_int 0))
4144 (parallel [(set (match_dup 0)
4145 (plus:XF (mult:XF (match_dup 3) (match_dup 4))
4147 (use (const_int 0))]))]
4149 /* Generate 82-bit versions of the input and output operands. */
4150 operands[8] = gen_rtx_REG (XFmode, REGNO (operands[0]));
4151 operands[9] = gen_rtx_REG (XFmode, REGNO (operands[1]));
4152 /* Generate required floating-point constants. */
4153 operands[10] = CONST0_RTX (XFmode);
4155 [(set_attr "predicable" "no")])
4157 ;; ??? frcpa works like cmp.foo.unc.
4159 (define_insn "*recip_approx"
4160 [(set (match_operand:XF 0 "fr_register_operand" "=f")
4161 (div:XF (const_int 1)
4162 (match_operand:XF 3 "fr_register_operand" "f")))
4163 (set (match_operand:BI 1 "register_operand" "=c")
4164 (unspec:BI [(match_operand:XF 2 "fr_register_operand" "f")
4165 (match_dup 3)] UNSPEC_FR_RECIP_APPROX))
4166 (use (match_operand:SI 4 "const_int_operand" ""))]
4168 "frcpa.s%4 %0, %1 = %2, %3"
4169 [(set_attr "itanium_class" "fmisc")
4170 (set_attr "predicable" "no")])
4172 ;; ::::::::::::::::::::
4174 ;; :: 32 bit Integer Shifts and Rotates
4176 ;; ::::::::::::::::::::
4178 (define_expand "ashlsi3"
4179 [(set (match_operand:SI 0 "gr_register_operand" "")
4180 (ashift:SI (match_operand:SI 1 "gr_register_operand" "")
4181 (match_operand:SI 2 "gr_reg_or_5bit_operand" "")))]
4184 if (GET_CODE (operands[2]) != CONST_INT)
4186 /* Why oh why didn't Intel arrange for SHIFT_COUNT_TRUNCATED? Now
4187 we've got to get rid of stray bits outside the SImode register. */
4188 rtx subshift = gen_reg_rtx (DImode);
4189 emit_insn (gen_zero_extendsidi2 (subshift, operands[2]));
4190 operands[2] = subshift;
4194 (define_insn "*ashlsi3_internal"
4195 [(set (match_operand:SI 0 "gr_register_operand" "=r,r,r")
4196 (ashift:SI (match_operand:SI 1 "gr_register_operand" "r,r,r")
4197 (match_operand:DI 2 "gr_reg_or_5bit_operand" "R,n,r")))]
4200 shladd %0 = %1, %2, r0
4201 dep.z %0 = %1, %2, %E2
4203 [(set_attr "itanium_class" "ialu,ishf,mmshf")])
4205 (define_expand "ashrsi3"
4206 [(set (match_operand:SI 0 "gr_register_operand" "")
4207 (ashiftrt:SI (match_operand:SI 1 "gr_register_operand" "")
4208 (match_operand:SI 2 "gr_reg_or_5bit_operand" "")))]
4211 rtx subtarget = gen_reg_rtx (DImode);
4212 if (GET_CODE (operands[2]) == CONST_INT)
4213 emit_insn (gen_extv (subtarget, gen_lowpart (DImode, operands[1]),
4214 GEN_INT (32 - INTVAL (operands[2])), operands[2]));
4217 rtx subshift = gen_reg_rtx (DImode);
4218 emit_insn (gen_extendsidi2 (subtarget, operands[1]));
4219 emit_insn (gen_zero_extendsidi2 (subshift, operands[2]));
4220 emit_insn (gen_ashrdi3 (subtarget, subtarget, subshift));
4222 emit_move_insn (gen_lowpart (DImode, operands[0]), subtarget);
4226 (define_expand "lshrsi3"
4227 [(set (match_operand:SI 0 "gr_register_operand" "")
4228 (lshiftrt:SI (match_operand:SI 1 "gr_register_operand" "")
4229 (match_operand:SI 2 "gr_reg_or_5bit_operand" "")))]
4232 rtx subtarget = gen_reg_rtx (DImode);
4233 if (GET_CODE (operands[2]) == CONST_INT)
4234 emit_insn (gen_extzv (subtarget, gen_lowpart (DImode, operands[1]),
4235 GEN_INT (32 - INTVAL (operands[2])), operands[2]));
4238 rtx subshift = gen_reg_rtx (DImode);
4239 emit_insn (gen_zero_extendsidi2 (subtarget, operands[1]));
4240 emit_insn (gen_zero_extendsidi2 (subshift, operands[2]));
4241 emit_insn (gen_lshrdi3 (subtarget, subtarget, subshift));
4243 emit_move_insn (gen_lowpart (DImode, operands[0]), subtarget);
4247 ;; Use mix4.r/shr to implement rotrsi3. We only get 32 bits of valid result
4248 ;; here, instead of 64 like the patterns above. Keep the pattern together
4249 ;; until after combine; otherwise it won't get matched often.
4251 (define_expand "rotrsi3"
4252 [(set (match_operand:SI 0 "gr_register_operand" "")
4253 (rotatert:SI (match_operand:SI 1 "gr_register_operand" "")
4254 (match_operand:SI 2 "gr_reg_or_5bit_operand" "")))]
4257 if (GET_MODE (operands[2]) != VOIDmode)
4259 rtx tmp = gen_reg_rtx (DImode);
4260 emit_insn (gen_zero_extendsidi2 (tmp, operands[2]));
4265 (define_insn_and_split "*rotrsi3_internal"
4266 [(set (match_operand:SI 0 "gr_register_operand" "=&r")
4267 (rotatert:SI (match_operand:SI 1 "gr_register_operand" "r")
4268 (match_operand:DI 2 "gr_reg_or_5bit_operand" "rM")))]
4273 (ior:DI (zero_extend:DI (match_dup 1))
4274 (ashift:DI (zero_extend:DI (match_dup 1)) (const_int 32))))
4276 (lshiftrt:DI (match_dup 3) (match_dup 2)))]
4277 "operands[3] = gen_rtx_REG (DImode, REGNO (operands[0]));")
4279 (define_expand "rotlsi3"
4280 [(set (match_operand:SI 0 "gr_register_operand" "")
4281 (rotate:SI (match_operand:SI 1 "gr_register_operand" "")
4282 (match_operand:SI 2 "gr_reg_or_5bit_operand" "")))]
4285 if (! shift_32bit_count_operand (operands[2], SImode))
4287 rtx tmp = gen_reg_rtx (SImode);
4288 emit_insn (gen_subsi3 (tmp, GEN_INT (32), operands[2]));
4289 emit_insn (gen_rotrsi3 (operands[0], operands[1], tmp));
4294 (define_insn_and_split "*rotlsi3_internal"
4295 [(set (match_operand:SI 0 "gr_register_operand" "=r")
4296 (rotate:SI (match_operand:SI 1 "gr_register_operand" "r")
4297 (match_operand:SI 2 "shift_32bit_count_operand" "n")))]
4302 (ior:DI (zero_extend:DI (match_dup 1))
4303 (ashift:DI (zero_extend:DI (match_dup 1)) (const_int 32))))
4305 (lshiftrt:DI (match_dup 3) (match_dup 2)))]
4307 operands[3] = gen_rtx_REG (DImode, REGNO (operands[0]));
4308 operands[2] = GEN_INT (32 - INTVAL (operands[2]));
4311 ;; ::::::::::::::::::::
4313 ;; :: 64 bit Integer Shifts and Rotates
4315 ;; ::::::::::::::::::::
4317 (define_insn "ashldi3"
4318 [(set (match_operand:DI 0 "gr_register_operand" "=r,r,r")
4319 (ashift:DI (match_operand:DI 1 "gr_register_operand" "r,r,r")
4320 (match_operand:DI 2 "gr_reg_or_6bit_operand" "R,r,rM")))]
4323 shladd %0 = %1, %2, r0
4326 [(set_attr "itanium_class" "ialu,mmshf,mmshfi")])
4328 ;; ??? Maybe combine this with the multiply and add instruction?
4330 (define_insn "*shladd"
4331 [(set (match_operand:DI 0 "gr_register_operand" "=r")
4332 (plus:DI (mult:DI (match_operand:DI 1 "gr_register_operand" "r")
4333 (match_operand:DI 2 "shladd_operand" "n"))
4334 (match_operand:DI 3 "gr_register_operand" "r")))]
4336 "shladd %0 = %1, %S2, %3"
4337 [(set_attr "itanium_class" "ialu")])
4339 ;; This can be created by register elimination if operand3 of shladd is an
4340 ;; eliminable register or has reg_equiv_constant set.
4342 ;; We have to use nonmemory_operand for operand 4, to ensure that the
4343 ;; validate_changes call inside eliminate_regs will always succeed. If it
4344 ;; doesn't succeed, then this remain a shladd pattern, and will be reloaded
4347 (define_insn_and_split "*shladd_elim"
4348 [(set (match_operand:DI 0 "gr_register_operand" "=&r")
4349 (plus:DI (plus:DI (mult:DI (match_operand:DI 1 "gr_register_operand" "r")
4350 (match_operand:DI 2 "shladd_operand" "n"))
4351 (match_operand:DI 3 "nonmemory_operand" "r"))
4352 (match_operand:DI 4 "nonmemory_operand" "rI")))]
4353 "reload_in_progress"
4356 [(set (match_dup 0) (plus:DI (mult:DI (match_dup 1) (match_dup 2))
4358 (set (match_dup 0) (plus:DI (match_dup 0) (match_dup 4)))]
4360 [(set_attr "itanium_class" "unknown")])
4362 (define_insn "ashrdi3"
4363 [(set (match_operand:DI 0 "gr_register_operand" "=r,r")
4364 (ashiftrt:DI (match_operand:DI 1 "gr_register_operand" "r,r")
4365 (match_operand:DI 2 "gr_reg_or_6bit_operand" "r,rM")))]
4370 [(set_attr "itanium_class" "mmshf,mmshfi")])
4372 (define_insn "lshrdi3"
4373 [(set (match_operand:DI 0 "gr_register_operand" "=r,r")
4374 (lshiftrt:DI (match_operand:DI 1 "gr_register_operand" "r,r")
4375 (match_operand:DI 2 "gr_reg_or_6bit_operand" "r,rM")))]
4380 [(set_attr "itanium_class" "mmshf,mmshfi")])
4382 ;; Using a predicate that accepts only constants doesn't work, because optabs
4383 ;; will load the operand into a register and call the pattern if the predicate
4384 ;; did not accept it on the first try. So we use nonmemory_operand and then
4385 ;; verify that we have an appropriate constant in the expander.
4387 (define_expand "rotrdi3"
4388 [(set (match_operand:DI 0 "gr_register_operand" "")
4389 (rotatert:DI (match_operand:DI 1 "gr_register_operand" "")
4390 (match_operand:DI 2 "nonmemory_operand" "")))]
4393 if (! shift_count_operand (operands[2], DImode))
4397 (define_insn "*rotrdi3_internal"
4398 [(set (match_operand:DI 0 "gr_register_operand" "=r")
4399 (rotatert:DI (match_operand:DI 1 "gr_register_operand" "r")
4400 (match_operand:DI 2 "shift_count_operand" "M")))]
4402 "shrp %0 = %1, %1, %2"
4403 [(set_attr "itanium_class" "ishf")])
4405 (define_expand "rotldi3"
4406 [(set (match_operand:DI 0 "gr_register_operand" "")
4407 (rotate:DI (match_operand:DI 1 "gr_register_operand" "")
4408 (match_operand:DI 2 "nonmemory_operand" "")))]
4411 if (! shift_count_operand (operands[2], DImode))
4415 (define_insn "*rotldi3_internal"
4416 [(set (match_operand:DI 0 "gr_register_operand" "=r")
4417 (rotate:DI (match_operand:DI 1 "gr_register_operand" "r")
4418 (match_operand:DI 2 "shift_count_operand" "M")))]
4420 "shrp %0 = %1, %1, %e2"
4421 [(set_attr "itanium_class" "ishf")])
4423 ;; ::::::::::::::::::::
4425 ;; :: 128 bit Integer Shifts and Rotates
4427 ;; ::::::::::::::::::::
4429 (define_expand "ashlti3"
4430 [(set (match_operand:TI 0 "gr_register_operand" "")
4431 (ashift:TI (match_operand:TI 1 "gr_register_operand" "")
4432 (match_operand:DI 2 "nonmemory_operand" "")))]
4435 if (!dshift_count_operand (operands[2], DImode))
4439 (define_insn_and_split "*ashlti3_internal"
4440 [(set (match_operand:TI 0 "gr_register_operand" "=&r")
4441 (ashift:TI (match_operand:TI 1 "gr_register_operand" "r")
4442 (match_operand:DI 2 "dshift_count_operand" "n")))]
4448 HOST_WIDE_INT shift = INTVAL (operands[2]);
4449 rtx rl = gen_lowpart (DImode, operands[0]);
4450 rtx rh = gen_highpart (DImode, operands[0]);
4451 rtx lo = gen_lowpart (DImode, operands[1]);
4452 rtx shiftlo = GEN_INT (shift & 63);
4456 emit_move_insn (rl, const0_rtx);
4458 emit_insn (gen_ashldi3 (rh, lo, shiftlo));
4460 emit_move_insn (rh, lo);
4464 rtx hi = gen_highpart (DImode, operands[1]);
4466 emit_insn (gen_shrp (rh, hi, lo, GEN_INT (-shift & 63)));
4467 emit_insn (gen_ashldi3 (rl, lo, shiftlo));
4472 (define_expand "ashrti3"
4473 [(set (match_operand:TI 0 "gr_register_operand" "")
4474 (ashiftrt:TI (match_operand:TI 1 "gr_register_operand" "")
4475 (match_operand:DI 2 "nonmemory_operand" "")))]
4478 if (!dshift_count_operand (operands[2], DImode))
4482 (define_insn_and_split "*ashrti3_internal"
4483 [(set (match_operand:TI 0 "gr_register_operand" "=&r")
4484 (ashiftrt:TI (match_operand:TI 1 "gr_register_operand" "r")
4485 (match_operand:DI 2 "dshift_count_operand" "n")))]
4491 HOST_WIDE_INT shift = INTVAL (operands[2]);
4492 rtx rl = gen_lowpart (DImode, operands[0]);
4493 rtx rh = gen_highpart (DImode, operands[0]);
4494 rtx hi = gen_highpart (DImode, operands[1]);
4495 rtx shiftlo = GEN_INT (shift & 63);
4500 emit_insn (gen_ashrdi3 (rl, hi, shiftlo));
4502 emit_move_insn (rl, hi);
4503 emit_insn (gen_ashrdi3 (rh, hi, GEN_INT (63)));
4507 rtx lo = gen_lowpart (DImode, operands[1]);
4509 emit_insn (gen_shrp (rl, hi, lo, shiftlo));
4510 emit_insn (gen_ashrdi3 (rh, hi, shiftlo));
4515 (define_expand "lshrti3"
4516 [(set (match_operand:TI 0 "gr_register_operand" "")
4517 (lshiftrt:TI (match_operand:TI 1 "gr_register_operand" "")
4518 (match_operand:DI 2 "nonmemory_operand" "")))]
4521 if (!dshift_count_operand (operands[2], DImode))
4525 (define_insn_and_split "*lshrti3_internal"
4526 [(set (match_operand:TI 0 "gr_register_operand" "=&r")
4527 (lshiftrt:TI (match_operand:TI 1 "gr_register_operand" "r")
4528 (match_operand:DI 2 "dshift_count_operand" "n")))]
4534 HOST_WIDE_INT shift = INTVAL (operands[2]);
4535 rtx rl = gen_lowpart (DImode, operands[0]);
4536 rtx rh = gen_highpart (DImode, operands[0]);
4537 rtx hi = gen_highpart (DImode, operands[1]);
4538 rtx shiftlo = GEN_INT (shift & 63);
4543 emit_insn (gen_lshrdi3 (rl, hi, shiftlo));
4545 emit_move_insn (rl, hi);
4546 emit_move_insn (rh, const0_rtx);
4550 rtx lo = gen_lowpart (DImode, operands[1]);
4552 emit_insn (gen_shrp (rl, hi, lo, shiftlo));
4553 emit_insn (gen_lshrdi3 (rh, hi, shiftlo));
4559 [(set (match_operand:DI 0 "gr_register_operand" "=r")
4560 (unspec:DI [(match_operand:DI 1 "gr_register_operand" "r")
4561 (match_operand:DI 2 "gr_register_operand" "r")
4562 (match_operand:DI 3 "shift_count_operand" "M")]
4565 "shrp %0 = %1, %2, %3"
4566 [(set_attr "itanium_class" "ishf")])
4568 ;; ::::::::::::::::::::
4570 ;; :: 32 bit Integer Logical operations
4572 ;; ::::::::::::::::::::
4574 ;; We don't seem to need any other 32-bit logical operations, because gcc
4575 ;; generates zero-extend;zero-extend;DImode-op, which combine optimizes to
4576 ;; DImode-op;zero-extend, and then we can optimize away the zero-extend.
4577 ;; This doesn't work for unary logical operations, because we don't call
4578 ;; apply_distributive_law for them.
4580 ;; ??? Likewise, this doesn't work for andnot, which isn't handled by
4581 ;; apply_distributive_law. We get inefficient code for
4582 ;; int sub4 (int i, int j) { return i & ~j; }
4583 ;; We could convert (and (not (sign_extend A)) (sign_extend B)) to
4584 ;; (zero_extend (and (not A) B)) in combine.
4585 ;; Or maybe fix this by adding andsi3/iorsi3/xorsi3 patterns like the
4586 ;; one_cmplsi2 pattern.
4588 (define_insn "one_cmplsi2"
4589 [(set (match_operand:SI 0 "gr_register_operand" "=r")
4590 (not:SI (match_operand:SI 1 "gr_register_operand" "r")))]
4593 [(set_attr "itanium_class" "ilog")])
4595 ;; ::::::::::::::::::::
4597 ;; :: 64 bit Integer Logical operations
4599 ;; ::::::::::::::::::::
4601 (define_insn "anddi3"
4602 [(set (match_operand:DI 0 "grfr_register_operand" "=r,*f")
4603 (and:DI (match_operand:DI 1 "grfr_register_operand" "%r,*f")
4604 (match_operand:DI 2 "grfr_reg_or_8bit_operand" "rK,*f")))]
4609 [(set_attr "itanium_class" "ilog,fmisc")])
4611 (define_insn "*andnot"
4612 [(set (match_operand:DI 0 "grfr_register_operand" "=r,*f")
4613 (and:DI (not:DI (match_operand:DI 1 "grfr_register_operand" "r,*f"))
4614 (match_operand:DI 2 "grfr_reg_or_8bit_operand" "rK,*f")))]
4619 [(set_attr "itanium_class" "ilog,fmisc")])
4621 (define_insn "iordi3"
4622 [(set (match_operand:DI 0 "grfr_register_operand" "=r,*f")
4623 (ior:DI (match_operand:DI 1 "grfr_register_operand" "%r,*f")
4624 (match_operand:DI 2 "grfr_reg_or_8bit_operand" "rK,*f")))]
4629 [(set_attr "itanium_class" "ilog,fmisc")])
4631 (define_insn "xordi3"
4632 [(set (match_operand:DI 0 "grfr_register_operand" "=r,*f")
4633 (xor:DI (match_operand:DI 1 "grfr_register_operand" "%r,*f")
4634 (match_operand:DI 2 "grfr_reg_or_8bit_operand" "rK,*f")))]
4639 [(set_attr "itanium_class" "ilog,fmisc")])
4641 (define_insn "one_cmpldi2"
4642 [(set (match_operand:DI 0 "gr_register_operand" "=r")
4643 (not:DI (match_operand:DI 1 "gr_register_operand" "r")))]
4646 [(set_attr "itanium_class" "ilog")])
4648 ;; ::::::::::::::::::::
4652 ;; ::::::::::::::::::::
4654 (define_expand "cmpbi"
4656 (compare (match_operand:BI 0 "register_operand" "")
4657 (match_operand:BI 1 "const_int_operand" "")))]
4660 ia64_compare_op0 = operands[0];
4661 ia64_compare_op1 = operands[1];
4665 (define_expand "cmpsi"
4667 (compare (match_operand:SI 0 "gr_register_operand" "")
4668 (match_operand:SI 1 "gr_reg_or_8bit_and_adjusted_operand" "")))]
4671 ia64_compare_op0 = operands[0];
4672 ia64_compare_op1 = operands[1];
4676 (define_expand "cmpdi"
4678 (compare (match_operand:DI 0 "gr_register_operand" "")
4679 (match_operand:DI 1 "gr_reg_or_8bit_and_adjusted_operand" "")))]
4682 ia64_compare_op0 = operands[0];
4683 ia64_compare_op1 = operands[1];
4687 (define_expand "cmpsf"
4689 (compare (match_operand:SF 0 "fr_reg_or_fp01_operand" "")
4690 (match_operand:SF 1 "fr_reg_or_fp01_operand" "")))]
4693 ia64_compare_op0 = operands[0];
4694 ia64_compare_op1 = operands[1];
4698 (define_expand "cmpdf"
4700 (compare (match_operand:DF 0 "fr_reg_or_fp01_operand" "")
4701 (match_operand:DF 1 "fr_reg_or_fp01_operand" "")))]
4704 ia64_compare_op0 = operands[0];
4705 ia64_compare_op1 = operands[1];
4709 (define_expand "cmpxf"
4711 (compare (match_operand:XF 0 "xfreg_or_fp01_operand" "")
4712 (match_operand:XF 1 "xfreg_or_fp01_operand" "")))]
4715 ia64_compare_op0 = operands[0];
4716 ia64_compare_op1 = operands[1];
4720 (define_expand "cmptf"
4722 (compare (match_operand:TF 0 "gr_register_operand" "")
4723 (match_operand:TF 1 "gr_register_operand" "")))]
4726 ia64_compare_op0 = operands[0];
4727 ia64_compare_op1 = operands[1];
4731 (define_insn "*cmpsi_normal"
4732 [(set (match_operand:BI 0 "register_operand" "=c")
4733 (match_operator:BI 1 "normal_comparison_operator"
4734 [(match_operand:SI 2 "gr_register_operand" "r")
4735 (match_operand:SI 3 "gr_reg_or_8bit_operand" "rK")]))]
4737 "cmp4.%C1 %0, %I0 = %3, %2"
4738 [(set_attr "itanium_class" "icmp")])
4740 ;; We use %r3 because it is possible for us to match a 0, and two of the
4741 ;; unsigned comparisons don't accept immediate operands of zero.
4743 (define_insn "*cmpsi_adjusted"
4744 [(set (match_operand:BI 0 "register_operand" "=c")
4745 (match_operator:BI 1 "adjusted_comparison_operator"
4746 [(match_operand:SI 2 "gr_register_operand" "r")
4747 (match_operand:SI 3 "gr_reg_or_8bit_adjusted_operand" "rL")]))]
4749 "cmp4.%C1 %0, %I0 = %r3, %2"
4750 [(set_attr "itanium_class" "icmp")])
4752 (define_insn "*cmpdi_normal"
4753 [(set (match_operand:BI 0 "register_operand" "=c")
4754 (match_operator:BI 1 "normal_comparison_operator"
4755 [(match_operand:DI 2 "gr_reg_or_0_operand" "rO")
4756 (match_operand:DI 3 "gr_reg_or_8bit_operand" "rK")]))]
4758 "cmp.%C1 %0, %I0 = %3, %r2"
4759 [(set_attr "itanium_class" "icmp")])
4761 ;; We use %r3 because it is possible for us to match a 0, and two of the
4762 ;; unsigned comparisons don't accept immediate operands of zero.
4764 (define_insn "*cmpdi_adjusted"
4765 [(set (match_operand:BI 0 "register_operand" "=c")
4766 (match_operator:BI 1 "adjusted_comparison_operator"
4767 [(match_operand:DI 2 "gr_register_operand" "r")
4768 (match_operand:DI 3 "gr_reg_or_8bit_adjusted_operand" "rL")]))]
4770 "cmp.%C1 %0, %I0 = %r3, %2"
4771 [(set_attr "itanium_class" "icmp")])
4773 (define_insn "*cmpsf_internal"
4774 [(set (match_operand:BI 0 "register_operand" "=c")
4775 (match_operator:BI 1 "comparison_operator"
4776 [(match_operand:SF 2 "fr_reg_or_fp01_operand" "fG")
4777 (match_operand:SF 3 "fr_reg_or_fp01_operand" "fG")]))]
4779 "fcmp.%D1 %0, %I0 = %F2, %F3"
4780 [(set_attr "itanium_class" "fcmp")])
4782 (define_insn "*cmpdf_internal"
4783 [(set (match_operand:BI 0 "register_operand" "=c")
4784 (match_operator:BI 1 "comparison_operator"
4785 [(match_operand:DF 2 "fr_reg_or_fp01_operand" "fG")
4786 (match_operand:DF 3 "fr_reg_or_fp01_operand" "fG")]))]
4788 "fcmp.%D1 %0, %I0 = %F2, %F3"
4789 [(set_attr "itanium_class" "fcmp")])
4791 (define_insn "*cmpxf_internal"
4792 [(set (match_operand:BI 0 "register_operand" "=c")
4793 (match_operator:BI 1 "comparison_operator"
4794 [(match_operand:XF 2 "xfreg_or_fp01_operand" "fG")
4795 (match_operand:XF 3 "xfreg_or_fp01_operand" "fG")]))]
4797 "fcmp.%D1 %0, %I0 = %F2, %F3"
4798 [(set_attr "itanium_class" "fcmp")])
4800 ;; ??? Can this pattern be generated?
4802 (define_insn "*bit_zero"
4803 [(set (match_operand:BI 0 "register_operand" "=c")
4804 (eq:BI (zero_extract:DI (match_operand:DI 1 "gr_register_operand" "r")
4806 (match_operand:DI 2 "immediate_operand" "n"))
4809 "tbit.z %0, %I0 = %1, %2"
4810 [(set_attr "itanium_class" "tbit")])
4812 (define_insn "*bit_one"
4813 [(set (match_operand:BI 0 "register_operand" "=c")
4814 (ne:BI (zero_extract:DI (match_operand:DI 1 "gr_register_operand" "r")
4816 (match_operand:DI 2 "immediate_operand" "n"))
4819 "tbit.nz %0, %I0 = %1, %2"
4820 [(set_attr "itanium_class" "tbit")])
4822 ;; ::::::::::::::::::::
4826 ;; ::::::::::::::::::::
4828 (define_expand "beq"
4830 (if_then_else (match_dup 1)
4831 (label_ref (match_operand 0 "" ""))
4834 "operands[1] = ia64_expand_compare (EQ, VOIDmode);")
4836 (define_expand "bne"
4838 (if_then_else (match_dup 1)
4839 (label_ref (match_operand 0 "" ""))
4842 "operands[1] = ia64_expand_compare (NE, VOIDmode);")
4844 (define_expand "blt"
4846 (if_then_else (match_dup 1)
4847 (label_ref (match_operand 0 "" ""))
4850 "operands[1] = ia64_expand_compare (LT, VOIDmode);")
4852 (define_expand "ble"
4854 (if_then_else (match_dup 1)
4855 (label_ref (match_operand 0 "" ""))
4858 "operands[1] = ia64_expand_compare (LE, VOIDmode);")
4860 (define_expand "bgt"
4862 (if_then_else (match_dup 1)
4863 (label_ref (match_operand 0 "" ""))
4866 "operands[1] = ia64_expand_compare (GT, VOIDmode);")
4868 (define_expand "bge"
4870 (if_then_else (match_dup 1)
4871 (label_ref (match_operand 0 "" ""))
4874 "operands[1] = ia64_expand_compare (GE, VOIDmode);")
4876 (define_expand "bltu"
4878 (if_then_else (match_dup 1)
4879 (label_ref (match_operand 0 "" ""))
4882 "operands[1] = ia64_expand_compare (LTU, VOIDmode);")
4884 (define_expand "bleu"
4886 (if_then_else (match_dup 1)
4887 (label_ref (match_operand 0 "" ""))
4890 "operands[1] = ia64_expand_compare (LEU, VOIDmode);")
4892 (define_expand "bgtu"
4894 (if_then_else (match_dup 1)
4895 (label_ref (match_operand 0 "" ""))
4898 "operands[1] = ia64_expand_compare (GTU, VOIDmode);")
4900 (define_expand "bgeu"
4902 (if_then_else (match_dup 1)
4903 (label_ref (match_operand 0 "" ""))
4906 "operands[1] = ia64_expand_compare (GEU, VOIDmode);")
4908 (define_expand "bunordered"
4910 (if_then_else (match_dup 1)
4911 (label_ref (match_operand 0 "" ""))
4914 "operands[1] = ia64_expand_compare (UNORDERED, VOIDmode);")
4916 (define_expand "bordered"
4918 (if_then_else (match_dup 1)
4919 (label_ref (match_operand 0 "" ""))
4922 "operands[1] = ia64_expand_compare (ORDERED, VOIDmode);")
4924 (define_insn "*br_true"
4926 (if_then_else (match_operator 0 "predicate_operator"
4927 [(match_operand:BI 1 "register_operand" "c")
4929 (label_ref (match_operand 2 "" ""))
4932 "(%J0) br.cond%+ %l2"
4933 [(set_attr "itanium_class" "br")
4934 (set_attr "predicable" "no")])
4936 (define_insn "*br_false"
4938 (if_then_else (match_operator 0 "predicate_operator"
4939 [(match_operand:BI 1 "register_operand" "c")
4942 (label_ref (match_operand 2 "" ""))))]
4944 "(%j0) br.cond%+ %l2"
4945 [(set_attr "itanium_class" "br")
4946 (set_attr "predicable" "no")])
4948 ;; ::::::::::::::::::::
4950 ;; :: Counted loop operations
4952 ;; ::::::::::::::::::::
4954 (define_expand "doloop_end"
4955 [(use (match_operand 0 "" "")) ; loop pseudo
4956 (use (match_operand 1 "" "")) ; iterations; zero if unknown
4957 (use (match_operand 2 "" "")) ; max iterations
4958 (use (match_operand 3 "" "")) ; loop level
4959 (use (match_operand 4 "" ""))] ; label
4962 /* Only use cloop on innermost loops. */
4963 if (INTVAL (operands[3]) > 1)
4965 emit_jump_insn (gen_doloop_end_internal (gen_rtx_REG (DImode, AR_LC_REGNUM),
4970 (define_insn "doloop_end_internal"
4971 [(set (pc) (if_then_else (ne (match_operand:DI 0 "ar_lc_reg_operand" "")
4973 (label_ref (match_operand 1 "" ""))
4975 (set (match_dup 0) (if_then_else:DI (ne (match_dup 0) (const_int 0))
4976 (plus:DI (match_dup 0) (const_int -1))
4979 "br.cloop.sptk.few %l1"
4980 [(set_attr "itanium_class" "br")
4981 (set_attr "predicable" "no")])
4983 ;; ::::::::::::::::::::
4985 ;; :: Set flag operations
4987 ;; ::::::::::::::::::::
4989 (define_expand "seq"
4990 [(set (match_operand:DI 0 "gr_register_operand" "") (match_dup 1))]
4992 "operands[1] = ia64_expand_compare (EQ, DImode);")
4994 (define_expand "sne"
4995 [(set (match_operand:DI 0 "gr_register_operand" "") (match_dup 1))]
4997 "operands[1] = ia64_expand_compare (NE, DImode);")
4999 (define_expand "slt"
5000 [(set (match_operand:DI 0 "gr_register_operand" "") (match_dup 1))]
5002 "operands[1] = ia64_expand_compare (LT, DImode);")
5004 (define_expand "sle"
5005 [(set (match_operand:DI 0 "gr_register_operand" "") (match_dup 1))]
5007 "operands[1] = ia64_expand_compare (LE, DImode);")
5009 (define_expand "sgt"
5010 [(set (match_operand:DI 0 "gr_register_operand" "") (match_dup 1))]
5012 "operands[1] = ia64_expand_compare (GT, DImode);")
5014 (define_expand "sge"
5015 [(set (match_operand:DI 0 "gr_register_operand" "") (match_dup 1))]
5017 "operands[1] = ia64_expand_compare (GE, DImode);")
5019 (define_expand "sltu"
5020 [(set (match_operand:DI 0 "gr_register_operand" "") (match_dup 1))]
5022 "operands[1] = ia64_expand_compare (LTU, DImode);")
5024 (define_expand "sleu"
5025 [(set (match_operand:DI 0 "gr_register_operand" "") (match_dup 1))]
5027 "operands[1] = ia64_expand_compare (LEU, DImode);")
5029 (define_expand "sgtu"
5030 [(set (match_operand:DI 0 "gr_register_operand" "") (match_dup 1))]
5032 "operands[1] = ia64_expand_compare (GTU, DImode);")
5034 (define_expand "sgeu"
5035 [(set (match_operand:DI 0 "gr_register_operand" "") (match_dup 1))]
5037 "operands[1] = ia64_expand_compare (GEU, DImode);")
5039 (define_expand "sunordered"
5040 [(set (match_operand:DI 0 "gr_register_operand" "") (match_dup 1))]
5042 "operands[1] = ia64_expand_compare (UNORDERED, DImode);")
5044 (define_expand "sordered"
5045 [(set (match_operand:DI 0 "gr_register_operand" "") (match_dup 1))]
5047 "operands[1] = ia64_expand_compare (ORDERED, DImode);")
5049 ;; Don't allow memory as destination here, because cmov/cmov/st is more
5050 ;; efficient than mov/mov/cst/cst.
5052 (define_insn_and_split "*sne_internal"
5053 [(set (match_operand:DI 0 "gr_register_operand" "=r")
5054 (ne:DI (match_operand:BI 1 "register_operand" "c")
5059 [(cond_exec (ne (match_dup 1) (const_int 0))
5060 (set (match_dup 0) (const_int 1)))
5061 (cond_exec (eq (match_dup 1) (const_int 0))
5062 (set (match_dup 0) (const_int 0)))]
5064 [(set_attr "itanium_class" "unknown")])
5066 (define_insn_and_split "*seq_internal"
5067 [(set (match_operand:DI 0 "gr_register_operand" "=r")
5068 (eq:DI (match_operand:BI 1 "register_operand" "c")
5073 [(cond_exec (ne (match_dup 1) (const_int 0))
5074 (set (match_dup 0) (const_int 0)))
5075 (cond_exec (eq (match_dup 1) (const_int 0))
5076 (set (match_dup 0) (const_int 1)))]
5078 [(set_attr "itanium_class" "unknown")])
5080 ;; ::::::::::::::::::::
5082 ;; :: Conditional move instructions.
5084 ;; ::::::::::::::::::::
5086 ;; ??? Add movXXcc patterns?
5089 ;; DImode if_then_else patterns.
5092 (define_insn "*cmovdi_internal"
5093 [(set (match_operand:DI 0 "destination_operand"
5094 "= r, r, r, r, r, r, r, r, r, r, m, Q, *f,*b,*d*e")
5096 (match_operator 4 "predicate_operator"
5097 [(match_operand:BI 1 "register_operand"
5098 "c,c,c,c,c,c,c,c,c,c,c,c,c,c,c")
5100 (match_operand:DI 2 "move_operand"
5101 "rim, *f, *b,*d*e,rim,rim, rim,*f,*b,*d*e,rO,*f,rOQ,rO, rK")
5102 (match_operand:DI 3 "move_operand"
5103 "rim,rim,rim, rim, *f, *b,*d*e,*f,*b,*d*e,rO,*f,rOQ,rO, rK")))]
5104 "ia64_move_ok (operands[0], operands[2])
5105 && ia64_move_ok (operands[0], operands[3])"
5107 [(set_attr "predicable" "no")])
5110 [(set (match_operand 0 "destination_operand" "")
5112 (match_operator 4 "predicate_operator"
5113 [(match_operand:BI 1 "register_operand" "")
5115 (match_operand 2 "move_operand" "")
5116 (match_operand 3 "move_operand" "")))]
5120 bool emitted_something = false;
5121 rtx dest = operands[0];
5122 rtx srct = operands[2];
5123 rtx srcf = operands[3];
5124 rtx cond = operands[4];
5126 if (! rtx_equal_p (dest, srct))
5128 ia64_emit_cond_move (dest, srct, cond);
5129 emitted_something = true;
5131 if (! rtx_equal_p (dest, srcf))
5133 cond = gen_rtx_fmt_ee (GET_CODE (cond) == NE ? EQ : NE,
5134 VOIDmode, operands[1], const0_rtx);
5135 ia64_emit_cond_move (dest, srcf, cond);
5136 emitted_something = true;
5138 if (! emitted_something)
5139 emit_note (NOTE_INSN_DELETED);
5143 ;; Absolute value pattern.
5145 (define_insn "*absdi2_internal"
5146 [(set (match_operand:DI 0 "gr_register_operand" "=r,r")
5148 (match_operator 4 "predicate_operator"
5149 [(match_operand:BI 1 "register_operand" "c,c")
5151 (neg:DI (match_operand:DI 2 "gr_reg_or_22bit_operand" "rI,rI"))
5152 (match_operand:DI 3 "gr_reg_or_22bit_operand" "0,rI")))]
5155 [(set_attr "itanium_class" "ialu,unknown")
5156 (set_attr "predicable" "no")])
5159 [(set (match_operand:DI 0 "register_operand" "")
5161 (match_operator 4 "predicate_operator"
5162 [(match_operand:BI 1 "register_operand" "c,c")
5164 (neg:DI (match_operand:DI 2 "gr_reg_or_22bit_operand" ""))
5165 (match_operand:DI 3 "gr_reg_or_22bit_operand" "")))]
5166 "reload_completed && rtx_equal_p (operands[0], operands[3])"
5170 (neg:DI (match_dup 2))))]
5174 [(set (match_operand:DI 0 "register_operand" "")
5176 (match_operator 4 "predicate_operator"
5177 [(match_operand:BI 1 "register_operand" "c,c")
5179 (neg:DI (match_operand:DI 2 "gr_reg_or_22bit_operand" ""))
5180 (match_operand:DI 3 "gr_reg_or_22bit_operand" "")))]
5184 (set (match_dup 0) (neg:DI (match_dup 2))))
5187 (set (match_dup 0) (match_dup 3)))]
5189 operands[5] = gen_rtx_fmt_ee (GET_CODE (operands[4]) == NE ? EQ : NE,
5190 VOIDmode, operands[1], const0_rtx);
5194 ;; SImode if_then_else patterns.
5197 (define_insn "*cmovsi_internal"
5198 [(set (match_operand:SI 0 "destination_operand" "=r,m,*f,r,m,*f,r,m,*f")
5200 (match_operator 4 "predicate_operator"
5201 [(match_operand:BI 1 "register_operand" "c,c,c,c,c,c,c,c,c")
5203 (match_operand:SI 2 "move_operand"
5204 "0,0,0,rim*f,rO,rO,rim*f,rO,rO")
5205 (match_operand:SI 3 "move_operand"
5206 "rim*f,rO,rO,0,0,0,rim*f,rO,rO")))]
5207 "ia64_move_ok (operands[0], operands[2])
5208 && ia64_move_ok (operands[0], operands[3])"
5210 [(set_attr "predicable" "no")])
5212 (define_insn "*abssi2_internal"
5213 [(set (match_operand:SI 0 "gr_register_operand" "=r,r")
5215 (match_operator 4 "predicate_operator"
5216 [(match_operand:BI 1 "register_operand" "c,c")
5218 (neg:SI (match_operand:SI 3 "gr_reg_or_22bit_operand" "rI,rI"))
5219 (match_operand:SI 2 "gr_reg_or_22bit_operand" "0,rI")))]
5222 [(set_attr "itanium_class" "ialu,unknown")
5223 (set_attr "predicable" "no")])
5226 [(set (match_operand:SI 0 "register_operand" "")
5228 (match_operator 4 "predicate_operator"
5229 [(match_operand:BI 1 "register_operand" "c,c")
5231 (neg:SI (match_operand:SI 2 "gr_reg_or_22bit_operand" ""))
5232 (match_operand:SI 3 "gr_reg_or_22bit_operand" "")))]
5233 "reload_completed && rtx_equal_p (operands[0], operands[3])"
5237 (neg:SI (match_dup 2))))]
5241 [(set (match_operand:SI 0 "register_operand" "")
5243 (match_operator 4 "predicate_operator"
5244 [(match_operand:BI 1 "register_operand" "c,c")
5246 (neg:SI (match_operand:SI 2 "gr_reg_or_22bit_operand" ""))
5247 (match_operand:SI 3 "gr_reg_or_22bit_operand" "")))]
5251 (set (match_dup 0) (neg:SI (match_dup 2))))
5254 (set (match_dup 0) (match_dup 3)))]
5256 operands[5] = gen_rtx_fmt_ee (GET_CODE (operands[4]) == NE ? EQ : NE,
5257 VOIDmode, operands[1], const0_rtx);
5260 (define_insn_and_split "*cond_opsi2_internal"
5261 [(set (match_operand:SI 0 "gr_register_operand" "=r")
5262 (match_operator:SI 5 "condop_operator"
5264 (match_operator 6 "predicate_operator"
5265 [(match_operand:BI 1 "register_operand" "c")
5267 (match_operand:SI 2 "gr_register_operand" "r")
5268 (match_operand:SI 3 "gr_register_operand" "r"))
5269 (match_operand:SI 4 "gr_register_operand" "r")]))]
5275 (set (match_dup 0) (match_op_dup:SI 5 [(match_dup 2) (match_dup 4)])))
5278 (set (match_dup 0) (match_op_dup:SI 5 [(match_dup 3) (match_dup 4)])))]
5280 operands[7] = gen_rtx_fmt_ee (GET_CODE (operands[6]) == NE ? EQ : NE,
5281 VOIDmode, operands[1], const0_rtx);
5283 [(set_attr "itanium_class" "ialu")
5284 (set_attr "predicable" "no")])
5287 (define_insn_and_split "*cond_opsi2_internal_b"
5288 [(set (match_operand:SI 0 "gr_register_operand" "=r")
5289 (match_operator:SI 5 "condop_operator"
5290 [(match_operand:SI 4 "gr_register_operand" "r")
5292 (match_operator 6 "predicate_operator"
5293 [(match_operand:BI 1 "register_operand" "c")
5295 (match_operand:SI 2 "gr_register_operand" "r")
5296 (match_operand:SI 3 "gr_register_operand" "r"))]))]
5302 (set (match_dup 0) (match_op_dup:SI 5 [(match_dup 4) (match_dup 2)])))
5305 (set (match_dup 0) (match_op_dup:SI 5 [(match_dup 4) (match_dup 3)])))]
5307 operands[7] = gen_rtx_fmt_ee (GET_CODE (operands[6]) == NE ? EQ : NE,
5308 VOIDmode, operands[1], const0_rtx);
5310 [(set_attr "itanium_class" "ialu")
5311 (set_attr "predicable" "no")])
5314 ;; ::::::::::::::::::::
5316 ;; :: Call and branch instructions
5318 ;; ::::::::::::::::::::
5320 ;; Subroutine call instruction returning no value. Operand 0 is the function
5321 ;; to call; operand 1 is the number of bytes of arguments pushed (in mode
5322 ;; `SImode', except it is normally a `const_int'); operand 2 is the number of
5323 ;; registers used as operands.
5325 ;; On most machines, operand 2 is not actually stored into the RTL pattern. It
5326 ;; is supplied for the sake of some RISC machines which need to put this
5327 ;; information into the assembler code; they can put it in the RTL instead of
5330 (define_expand "call"
5331 [(use (match_operand:DI 0 "" ""))
5332 (use (match_operand 1 "" ""))
5333 (use (match_operand 2 "" ""))
5334 (use (match_operand 3 "" ""))]
5337 ia64_expand_call (NULL_RTX, operands[0], operands[2], false);
5341 (define_expand "sibcall"
5342 [(use (match_operand:DI 0 "" ""))
5343 (use (match_operand 1 "" ""))
5344 (use (match_operand 2 "" ""))
5345 (use (match_operand 3 "" ""))]
5348 ia64_expand_call (NULL_RTX, operands[0], operands[2], true);
5352 ;; Subroutine call instruction returning a value. Operand 0 is the hard
5353 ;; register in which the value is returned. There are three more operands,
5354 ;; the same as the three operands of the `call' instruction (but with numbers
5355 ;; increased by one).
5357 ;; Subroutines that return `BLKmode' objects use the `call' insn.
5359 (define_expand "call_value"
5360 [(use (match_operand 0 "" ""))
5361 (use (match_operand:DI 1 "" ""))
5362 (use (match_operand 2 "" ""))
5363 (use (match_operand 3 "" ""))
5364 (use (match_operand 4 "" ""))]
5367 ia64_expand_call (operands[0], operands[1], operands[3], false);
5371 (define_expand "sibcall_value"
5372 [(use (match_operand 0 "" ""))
5373 (use (match_operand:DI 1 "" ""))
5374 (use (match_operand 2 "" ""))
5375 (use (match_operand 3 "" ""))
5376 (use (match_operand 4 "" ""))]
5379 ia64_expand_call (operands[0], operands[1], operands[3], true);
5383 ;; Call subroutine returning any type.
5385 (define_expand "untyped_call"
5386 [(parallel [(call (match_operand 0 "" "")
5388 (match_operand 1 "" "")
5389 (match_operand 2 "" "")])]
5394 emit_call_insn (gen_call (operands[0], const0_rtx, NULL, const0_rtx));
5396 for (i = 0; i < XVECLEN (operands[2], 0); i++)
5398 rtx set = XVECEXP (operands[2], 0, i);
5399 emit_move_insn (SET_DEST (set), SET_SRC (set));
5402 /* The optimizer does not know that the call sets the function value
5403 registers we stored in the result block. We avoid problems by
5404 claiming that all hard registers are used and clobbered at this
5406 emit_insn (gen_blockage ());
5411 (define_insn "call_nogp"
5412 [(call (mem:DI (match_operand:DI 0 "call_operand" "?b,i"))
5414 (clobber (match_operand:DI 1 "register_operand" "=b,b"))]
5416 "br.call%+.many %1 = %0"
5417 [(set_attr "itanium_class" "br,scall")])
5419 (define_insn "call_value_nogp"
5420 [(set (match_operand 0 "" "=X,X")
5421 (call (mem:DI (match_operand:DI 1 "call_operand" "?b,i"))
5423 (clobber (match_operand:DI 2 "register_operand" "=b,b"))]
5425 "br.call%+.many %2 = %1"
5426 [(set_attr "itanium_class" "br,scall")])
5428 (define_insn "sibcall_nogp"
5429 [(call (mem:DI (match_operand:DI 0 "call_operand" "?b,i"))
5433 [(set_attr "itanium_class" "br,scall")])
5435 (define_insn "call_gp"
5436 [(call (mem:DI (match_operand:DI 0 "call_operand" "?r,i"))
5438 (clobber (match_operand:DI 1 "register_operand" "=b,b"))
5439 (clobber (match_scratch:DI 2 "=&r,X"))
5440 (clobber (match_scratch:DI 3 "=b,X"))]
5443 [(set_attr "itanium_class" "br,scall")])
5445 ;; Irritatingly, we don't have access to INSN within the split body.
5446 ;; See commentary in ia64_split_call as to why these aren't peep2.
5448 [(call (mem (match_operand 0 "call_operand" ""))
5450 (clobber (match_operand:DI 1 "register_operand" ""))
5451 (clobber (match_scratch:DI 2 ""))
5452 (clobber (match_scratch:DI 3 ""))]
5453 "reload_completed && find_reg_note (insn, REG_NORETURN, NULL_RTX)"
5456 ia64_split_call (NULL_RTX, operands[0], operands[1], operands[2],
5457 operands[3], true, false);
5462 [(call (mem (match_operand 0 "call_operand" ""))
5464 (clobber (match_operand:DI 1 "register_operand" ""))
5465 (clobber (match_scratch:DI 2 ""))
5466 (clobber (match_scratch:DI 3 ""))]
5470 ia64_split_call (NULL_RTX, operands[0], operands[1], operands[2],
5471 operands[3], false, false);
5475 (define_insn "call_value_gp"
5476 [(set (match_operand 0 "" "=X,X")
5477 (call (mem:DI (match_operand:DI 1 "call_operand" "?r,i"))
5479 (clobber (match_operand:DI 2 "register_operand" "=b,b"))
5480 (clobber (match_scratch:DI 3 "=&r,X"))
5481 (clobber (match_scratch:DI 4 "=b,X"))]
5484 [(set_attr "itanium_class" "br,scall")])
5487 [(set (match_operand 0 "" "")
5488 (call (mem:DI (match_operand:DI 1 "call_operand" ""))
5490 (clobber (match_operand:DI 2 "register_operand" ""))
5491 (clobber (match_scratch:DI 3 ""))
5492 (clobber (match_scratch:DI 4 ""))]
5493 "reload_completed && find_reg_note (insn, REG_NORETURN, NULL_RTX)"
5496 ia64_split_call (operands[0], operands[1], operands[2], operands[3],
5497 operands[4], true, false);
5502 [(set (match_operand 0 "" "")
5503 (call (mem:DI (match_operand:DI 1 "call_operand" ""))
5505 (clobber (match_operand:DI 2 "register_operand" ""))
5506 (clobber (match_scratch:DI 3 ""))
5507 (clobber (match_scratch:DI 4 ""))]
5511 ia64_split_call (operands[0], operands[1], operands[2], operands[3],
5512 operands[4], false, false);
5516 (define_insn_and_split "sibcall_gp"
5517 [(call (mem:DI (match_operand:DI 0 "call_operand" "?r,i"))
5519 (clobber (match_scratch:DI 1 "=&r,X"))
5520 (clobber (match_scratch:DI 2 "=b,X"))]
5526 ia64_split_call (NULL_RTX, operands[0], NULL_RTX, operands[1],
5527 operands[2], true, true);
5530 [(set_attr "itanium_class" "br")])
5532 (define_insn "return_internal"
5534 (use (match_operand:DI 0 "register_operand" "b"))]
5536 "br.ret.sptk.many %0"
5537 [(set_attr "itanium_class" "br")])
5539 (define_insn "return"
5541 "ia64_direct_return ()"
5542 "br.ret.sptk.many rp"
5543 [(set_attr "itanium_class" "br")])
5545 (define_insn "*return_true"
5547 (if_then_else (match_operator 0 "predicate_operator"
5548 [(match_operand:BI 1 "register_operand" "c")
5552 "ia64_direct_return ()"
5553 "(%J0) br.ret%+.many rp"
5554 [(set_attr "itanium_class" "br")
5555 (set_attr "predicable" "no")])
5557 (define_insn "*return_false"
5559 (if_then_else (match_operator 0 "predicate_operator"
5560 [(match_operand:BI 1 "register_operand" "c")
5564 "ia64_direct_return ()"
5565 "(%j0) br.ret%+.many rp"
5566 [(set_attr "itanium_class" "br")
5567 (set_attr "predicable" "no")])
5570 [(set (pc) (label_ref (match_operand 0 "" "")))]
5573 [(set_attr "itanium_class" "br")])
5575 (define_insn "indirect_jump"
5576 [(set (pc) (match_operand:DI 0 "register_operand" "b"))]
5579 [(set_attr "itanium_class" "br")])
5581 (define_expand "tablejump"
5582 [(parallel [(set (pc) (match_operand:DI 0 "memory_operand" ""))
5583 (use (label_ref (match_operand 1 "" "")))])]
5586 rtx op0 = operands[0];
5589 /* ??? Bother -- do_tablejump is "helpful" and pulls the table
5590 element into a register without bothering to see whether that
5591 is necessary given the operand predicate. Check for MEM just
5592 in case someone fixes this. */
5593 if (GET_CODE (op0) == MEM)
5594 addr = XEXP (op0, 0);
5597 /* Otherwise, cheat and guess that the previous insn in the
5598 stream was the memory load. Grab the address from that.
5599 Note we have to momentarily pop out of the sequence started
5600 by the insn-emit wrapper in order to grab the last insn. */
5604 last = get_last_insn ();
5606 set = single_set (last);
5608 if (! rtx_equal_p (SET_DEST (set), op0)
5609 || GET_CODE (SET_SRC (set)) != MEM)
5611 addr = XEXP (SET_SRC (set), 0);
5612 if (rtx_equal_p (addr, op0))
5616 /* Jump table elements are stored pc-relative. That is, a displacement
5617 from the entry to the label. Thus to convert to an absolute address
5618 we add the address of the memory from which the value is loaded. */
5619 operands[0] = expand_simple_binop (DImode, PLUS, op0, addr,
5620 NULL_RTX, 1, OPTAB_DIRECT);
5623 (define_insn "*tablejump_internal"
5624 [(set (pc) (match_operand:DI 0 "register_operand" "b"))
5625 (use (label_ref (match_operand 1 "" "")))]
5628 [(set_attr "itanium_class" "br")])
5631 ;; ::::::::::::::::::::
5633 ;; :: Prologue and Epilogue instructions
5635 ;; ::::::::::::::::::::
5637 (define_expand "prologue"
5641 ia64_expand_prologue ();
5645 (define_expand "epilogue"
5649 ia64_expand_epilogue (0);
5653 (define_expand "sibcall_epilogue"
5657 ia64_expand_epilogue (1);
5661 ;; This prevents the scheduler from moving the SP decrement past FP-relative
5662 ;; stack accesses. This is the same as adddi3 plus the extra set.
5664 (define_insn "prologue_allocate_stack"
5665 [(set (match_operand:DI 0 "register_operand" "=r,r,r")
5666 (plus:DI (match_operand:DI 1 "register_operand" "%r,r,a")
5667 (match_operand:DI 2 "gr_reg_or_22bit_operand" "r,I,J")))
5668 (set (match_operand:DI 3 "register_operand" "+r,r,r")
5675 [(set_attr "itanium_class" "ialu")])
5677 ;; This prevents the scheduler from moving the SP restore past FP-relative
5678 ;; stack accesses. This is similar to movdi plus the extra set.
5680 (define_insn "epilogue_deallocate_stack"
5681 [(set (match_operand:DI 0 "register_operand" "=r")
5682 (match_operand:DI 1 "register_operand" "+r"))
5683 (set (match_dup 1) (match_dup 1))]
5686 [(set_attr "itanium_class" "ialu")])
5688 ;; As USE insns aren't meaningful after reload, this is used instead
5689 ;; to prevent deleting instructions setting registers for EH handling
5690 (define_insn "prologue_use"
5691 [(unspec:DI [(match_operand:DI 0 "register_operand" "")]
5692 UNSPEC_PROLOGUE_USE)]
5695 [(set_attr "itanium_class" "ignore")
5696 (set_attr "predicable" "no")
5697 (set_attr "empty" "yes")])
5699 ;; Allocate a new register frame.
5701 (define_insn "alloc"
5702 [(set (match_operand:DI 0 "register_operand" "=r")
5703 (unspec_volatile:DI [(const_int 0)] UNSPECV_ALLOC))
5704 (use (match_operand:DI 1 "const_int_operand" "i"))
5705 (use (match_operand:DI 2 "const_int_operand" "i"))
5706 (use (match_operand:DI 3 "const_int_operand" "i"))
5707 (use (match_operand:DI 4 "const_int_operand" "i"))]
5709 "alloc %0 = ar.pfs, %1, %2, %3, %4"
5710 [(set_attr "itanium_class" "syst_m0")
5711 (set_attr "predicable" "no")
5712 (set_attr "first_insn" "yes")])
5715 (define_expand "gr_spill"
5716 [(parallel [(set (match_operand:DI 0 "memory_operand" "=m")
5717 (unspec:DI [(match_operand:DI 1 "register_operand" "r")
5718 (match_operand:DI 2 "const_int_operand" "")]
5720 (clobber (match_dup 3))])]
5722 "operands[3] = gen_rtx_REG (DImode, AR_UNAT_REGNUM);")
5724 (define_insn "gr_spill_internal"
5725 [(set (match_operand:DI 0 "memory_operand" "=m")
5726 (unspec:DI [(match_operand:DI 1 "register_operand" "r")
5727 (match_operand:DI 2 "const_int_operand" "")]
5729 (clobber (match_operand:DI 3 "register_operand" ""))]
5732 /* Note that we use a C output pattern here to avoid the predicate
5733 being automatically added before the .mem.offset directive. */
5734 return ".mem.offset %2, 0\;%,st8.spill %0 = %1%P0";
5736 [(set_attr "itanium_class" "st")])
5739 (define_expand "gr_restore"
5740 [(parallel [(set (match_operand:DI 0 "register_operand" "=r")
5741 (unspec:DI [(match_operand:DI 1 "memory_operand" "m")
5742 (match_operand:DI 2 "const_int_operand" "")]
5744 (use (match_dup 3))])]
5746 "operands[3] = gen_rtx_REG (DImode, AR_UNAT_REGNUM);")
5748 (define_insn "gr_restore_internal"
5749 [(set (match_operand:DI 0 "register_operand" "=r")
5750 (unspec:DI [(match_operand:DI 1 "memory_operand" "m")
5751 (match_operand:DI 2 "const_int_operand" "")]
5753 (use (match_operand:DI 3 "register_operand" ""))]
5755 { return ".mem.offset %2, 0\;%,ld8.fill %0 = %1%P1"; }
5756 [(set_attr "itanium_class" "ld")])
5758 (define_insn "fr_spill"
5759 [(set (match_operand:XF 0 "memory_operand" "=m")
5760 (unspec:XF [(match_operand:XF 1 "register_operand" "f")]
5763 "stf.spill %0 = %1%P0"
5764 [(set_attr "itanium_class" "stf")])
5766 (define_insn "fr_restore"
5767 [(set (match_operand:XF 0 "register_operand" "=f")
5768 (unspec:XF [(match_operand:XF 1 "memory_operand" "m")]
5769 UNSPEC_FR_RESTORE))]
5771 "ldf.fill %0 = %1%P1"
5772 [(set_attr "itanium_class" "fld")])
5774 ;; ??? The explicit stop is not ideal. It would be better if
5775 ;; rtx_needs_barrier took care of this, but this is something that can be
5776 ;; fixed later. This avoids an RSE DV.
5778 (define_insn "bsp_value"
5779 [(set (match_operand:DI 0 "register_operand" "=r")
5780 (unspec:DI [(const_int 0)] UNSPEC_BSP_VALUE))]
5784 return \";;\;%,mov %0 = ar.bsp\";
5786 [(set_attr "itanium_class" "frar_i")])
5788 (define_insn "set_bsp"
5789 [(unspec_volatile [(match_operand:DI 0 "register_operand" "r")]
5807 [(set_attr "itanium_class" "unknown")
5808 (set_attr "predicable" "no")])
5810 ;; ??? The explicit stops are not ideal. It would be better if
5811 ;; rtx_needs_barrier took care of this, but this is something that can be
5812 ;; fixed later. This avoids an RSE DV.
5814 (define_insn "flushrs"
5815 [(unspec [(const_int 0)] UNSPEC_FLUSHRS)]
5818 [(set_attr "itanium_class" "rse_m")
5819 (set_attr "predicable" "no")])
5821 ;; ::::::::::::::::::::
5823 ;; :: Miscellaneous instructions
5825 ;; ::::::::::::::::::::
5827 ;; ??? Emitting a NOP instruction isn't very useful. This should probably
5828 ;; be emitting ";;" to force a break in the instruction packing.
5830 ;; No operation, needed in case the user uses -g but not -O.
5835 [(set_attr "itanium_class" "nop")])
5837 (define_insn "nop_m"
5841 [(set_attr "itanium_class" "nop_m")])
5843 (define_insn "nop_i"
5847 [(set_attr "itanium_class" "nop_i")])
5849 (define_insn "nop_f"
5853 [(set_attr "itanium_class" "nop_f")])
5855 (define_insn "nop_b"
5859 [(set_attr "itanium_class" "nop_b")])
5861 (define_insn "nop_x"
5865 [(set_attr "itanium_class" "nop_x")
5866 (set_attr "empty" "yes")])
5868 ;; The following insn will be never generated. It is used only by
5869 ;; insn scheduler to change state before advancing cycle.
5870 (define_insn "pre_cycle"
5874 [(set_attr "itanium_class" "pre_cycle")])
5876 (define_insn "bundle_selector"
5877 [(unspec [(match_operand 0 "const_int_operand" "")] UNSPEC_BUNDLE_SELECTOR)]
5879 { return get_bundle_name (INTVAL (operands[0])); }
5880 [(set_attr "itanium_class" "ignore")
5881 (set_attr "predicable" "no")])
5883 ;; Pseudo instruction that prevents the scheduler from moving code above this
5885 (define_insn "blockage"
5886 [(unspec_volatile [(const_int 0)] UNSPECV_BLOCKAGE)]
5889 [(set_attr "itanium_class" "ignore")
5890 (set_attr "predicable" "no")])
5892 (define_insn "insn_group_barrier"
5893 [(unspec_volatile [(match_operand 0 "const_int_operand" "")]
5894 UNSPECV_INSN_GROUP_BARRIER)]
5897 [(set_attr "itanium_class" "stop_bit")
5898 (set_attr "predicable" "no")
5899 (set_attr "empty" "yes")])
5901 (define_expand "trap"
5902 [(trap_if (const_int 1) (const_int 0))]
5906 ;; ??? We don't have a match-any slot type. Setting the type to unknown
5907 ;; produces worse code that setting the slot type to A.
5909 (define_insn "*trap"
5910 [(trap_if (const_int 1) (match_operand 0 "const_int_operand" ""))]
5913 [(set_attr "itanium_class" "chk_s")])
5915 (define_expand "conditional_trap"
5916 [(trap_if (match_operand 0 "" "") (match_operand 1 "" ""))]
5919 operands[0] = ia64_expand_compare (GET_CODE (operands[0]), VOIDmode);
5922 (define_insn "*conditional_trap"
5923 [(trap_if (match_operator 0 "predicate_operator"
5924 [(match_operand:BI 1 "register_operand" "c")
5926 (match_operand 2 "const_int_operand" ""))]
5929 [(set_attr "itanium_class" "chk_s")
5930 (set_attr "predicable" "no")])
5932 (define_insn "break_f"
5933 [(unspec_volatile [(const_int 0)] UNSPECV_BREAK)]
5936 [(set_attr "itanium_class" "nop_f")])
5938 (define_insn "prefetch"
5939 [(prefetch (match_operand:DI 0 "address_operand" "p")
5940 (match_operand:DI 1 "const_int_operand" "n")
5941 (match_operand:DI 2 "const_int_operand" "n"))]
5944 static const char * const alt[2][4] = {
5946 "%,lfetch.nta [%0]",
5947 "%,lfetch.nt1 [%0]",
5948 "%,lfetch.nt2 [%0]",
5952 "%,lfetch.excl.nta [%0]",
5953 "%,lfetch.excl.nt1 [%0]",
5954 "%,lfetch.excl.nt2 [%0]",
5955 "%,lfetch.excl [%0]"
5958 int i = (INTVAL (operands[1]));
5959 int j = (INTVAL (operands[2]));
5961 if (i != 0 && i != 1)
5967 [(set_attr "itanium_class" "lfetch")])
5969 ;; Non-local goto support.
5971 (define_expand "save_stack_nonlocal"
5972 [(use (match_operand:OI 0 "memory_operand" ""))
5973 (use (match_operand:DI 1 "register_operand" ""))]
5976 emit_library_call (gen_rtx_SYMBOL_REF (Pmode,
5977 \"__ia64_save_stack_nonlocal\"),
5978 0, VOIDmode, 2, XEXP (operands[0], 0), Pmode,
5979 operands[1], Pmode);
5983 (define_expand "nonlocal_goto"
5984 [(use (match_operand 0 "general_operand" ""))
5985 (use (match_operand 1 "general_operand" ""))
5986 (use (match_operand 2 "general_operand" ""))
5987 (use (match_operand 3 "general_operand" ""))]
5990 emit_library_call (gen_rtx_SYMBOL_REF (Pmode, \"__ia64_nonlocal_goto\"),
5991 LCT_NORETURN, VOIDmode, 3,
5993 copy_to_reg (XEXP (operands[2], 0)), Pmode,
5994 operands[3], Pmode);
5999 (define_insn_and_split "builtin_setjmp_receiver"
6000 [(unspec_volatile [(match_operand:DI 0 "" "")] UNSPECV_SETJMP_RECEIVER)]
6010 (define_expand "eh_epilogue"
6011 [(use (match_operand:DI 0 "register_operand" "r"))
6012 (use (match_operand:DI 1 "register_operand" "r"))
6013 (use (match_operand:DI 2 "register_operand" "r"))]
6016 rtx bsp = gen_rtx_REG (Pmode, 10);
6017 rtx sp = gen_rtx_REG (Pmode, 9);
6019 if (GET_CODE (operands[0]) != REG || REGNO (operands[0]) != 10)
6021 emit_move_insn (bsp, operands[0]);
6024 if (GET_CODE (operands[2]) != REG || REGNO (operands[2]) != 9)
6026 emit_move_insn (sp, operands[2]);
6029 emit_insn (gen_rtx_USE (VOIDmode, sp));
6030 emit_insn (gen_rtx_USE (VOIDmode, bsp));
6032 cfun->machine->ia64_eh_epilogue_sp = sp;
6033 cfun->machine->ia64_eh_epilogue_bsp = bsp;
6036 ;; Builtin apply support.
6038 (define_expand "restore_stack_nonlocal"
6039 [(use (match_operand:DI 0 "register_operand" ""))
6040 (use (match_operand:OI 1 "memory_operand" ""))]
6043 emit_library_call (gen_rtx_SYMBOL_REF (Pmode,
6044 "__ia64_restore_stack_nonlocal"),
6046 copy_to_reg (XEXP (operands[1], 0)), Pmode);
6054 [(match_operator 0 "predicate_operator"
6055 [(match_operand:BI 1 "register_operand" "c")
6060 (define_insn "pred_rel_mutex"
6061 [(set (match_operand:BI 0 "register_operand" "+c")
6062 (unspec:BI [(match_dup 0)] UNSPEC_PRED_REL_MUTEX))]
6064 ".pred.rel.mutex %0, %I0"
6065 [(set_attr "itanium_class" "ignore")
6066 (set_attr "predicable" "no")])
6068 (define_insn "safe_across_calls_all"
6069 [(unspec_volatile [(const_int 0)] UNSPECV_PSAC_ALL)]
6071 ".pred.safe_across_calls p1-p63"
6072 [(set_attr "itanium_class" "ignore")
6073 (set_attr "predicable" "no")])
6075 (define_insn "safe_across_calls_normal"
6076 [(unspec_volatile [(const_int 0)] UNSPECV_PSAC_NORMAL)]
6079 emit_safe_across_calls ();
6082 [(set_attr "itanium_class" "ignore")
6083 (set_attr "predicable" "no")])
6085 ;; UNSPEC instruction definition to "swizzle" 32 bit pointer into 64 bit
6086 ;; pointer. This is used by the HP-UX 32 bit mode.
6088 (define_insn "ptr_extend"
6089 [(set (match_operand:DI 0 "gr_register_operand" "=r")
6090 (unspec:DI [(match_operand:SI 1 "gr_register_operand" "r")]
6094 [(set_attr "itanium_class" "ialu")])
6097 ;; Optimizations for ptr_extend
6099 (define_insn "ptr_extend_plus_imm"
6100 [(set (match_operand:DI 0 "gr_register_operand" "=r")
6102 [(plus:SI (match_operand:SI 1 "basereg_operand" "r")
6103 (match_operand:SI 2 "gr_reg_or_14bit_operand" "rI"))]
6105 "addp4_optimize_ok (operands[1], operands[2])"
6107 [(set_attr "itanium_class" "ialu")])
6109 (define_insn "*ptr_extend_plus_2"
6110 [(set (match_operand:DI 0 "gr_register_operand" "=r")
6112 [(plus:SI (match_operand:SI 1 "gr_register_operand" "r")
6113 (match_operand:SI 2 "basereg_operand" "r"))]
6115 "addp4_optimize_ok (operands[1], operands[2])"
6117 [(set_attr "itanium_class" "ialu")])
6119 ;; Vector operations
6121 ;; Atomic operations