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_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_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_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_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_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_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 1))])
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_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 1))])
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_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_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_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_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 1))])
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_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 1))])
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_LAT)
3328 insn = gen_sqrtdf2_internal_lat (operands[0], operands[1]);