1 ;; IA-64 Machine description template
2 ;; Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004
3 ;; Free Software Foundation, Inc.
4 ;; Contributed by James E. Wilson <wilson@cygnus.com> and
5 ;; David Mosberger <davidm@hpl.hp.com>.
7 ;; This file is part of GCC.
9 ;; GCC is free software; you can redistribute it and/or modify
10 ;; it under the terms of the GNU General Public License as published by
11 ;; the Free Software Foundation; either version 2, or (at your option)
14 ;; GCC is distributed in the hope that it will be useful,
15 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
16 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 ;; GNU General Public License for more details.
19 ;; You should have received a copy of the GNU General Public License
20 ;; along with GCC; see the file COPYING. If not, write to
21 ;; the Free Software Foundation, 59 Temple Place - Suite 330,
22 ;; Boston, MA 02111-1307, USA.
24 ;;- See file "rtl.def" for documentation on define_insn, match_*, et. al.
26 ;; ??? register_operand accepts (subreg:DI (mem:SI X)) which forces later
27 ;; reload. This will be fixed once scheduling support is turned on.
29 ;; ??? Optimize for post-increment addressing modes.
31 ;; ??? fselect is not supported, because there is no integer register
34 ;; ??? fp abs/min/max instructions may also work for integer values.
36 ;; ??? Would a predicate_reg_operand predicate be useful? The HP one is buggy,
37 ;; it assumes the operand is a register and takes REGNO of it without checking.
39 ;; ??? Would a branch_reg_operand predicate be useful? The HP one is buggy,
40 ;; it assumes the operand is a register and takes REGNO of it without checking.
42 ;; ??? Go through list of documented named patterns and look for more to
45 ;; ??? Go through instruction manual and look for more instructions that
48 ;; ??? Add function unit scheduling info for Itanium (TM) processor.
50 ;; ??? Need a better way to describe alternate fp status registers.
54 (UNSPEC_LTOFF_DTPMOD 0)
55 (UNSPEC_LTOFF_DTPREL 1)
57 (UNSPEC_LTOFF_TPREL 3)
62 (UNSPEC_GR_RESTORE 11)
64 (UNSPEC_FR_RESTORE 13)
65 (UNSPEC_FR_RECIP_APPROX 14)
66 (UNSPEC_PRED_REL_MUTEX 15)
70 (UNSPEC_CMPXCHG_ACQ 19)
71 (UNSPEC_FETCHADD_ACQ 20)
74 (UNSPEC_BUNDLE_SELECTOR 23)
76 (UNSPEC_PROLOGUE_USE 25)
79 (UNSPEC_FR_SQRT_RECIP_APPROX 28)
86 (UNSPECV_INSN_GROUP_BARRIER 2)
89 (UNSPECV_PSAC_ALL 5) ; pred.safe_across_calls
90 (UNSPECV_PSAC_NORMAL 6)
91 (UNSPECV_SETJMP_RECEIVER 7)
94 (include "predicates.md")
96 ;; ::::::::::::::::::::
100 ;; ::::::::::::::::::::
102 ;; Processor type. This attribute must exactly match the processor_type
103 ;; enumeration in ia64.h.
104 (define_attr "cpu" "itanium,itanium2" (const (symbol_ref "ia64_tune")))
106 ;; Instruction type. This primarily determines how instructions can be
107 ;; packed in bundles, and secondarily affects scheduling to function units.
109 ;; A alu, can go in I or M syllable of a bundle
114 ;; L long immediate, takes two syllables
117 ;; ??? Should not have any pattern with type unknown. Perhaps add code to
118 ;; check this in md_reorg? Currently use unknown for patterns which emit
119 ;; multiple instructions, patterns which emit 0 instructions, and patterns
120 ;; which emit instruction that can go in any slot (e.g. nop).
122 (define_attr "itanium_class" "unknown,ignore,stop_bit,br,fcmp,fcvtfx,fld,
123 fmac,fmisc,frar_i,frar_m,frbr,frfr,frpr,ialu,icmp,ilog,ishf,ld,
124 chk_s,long_i,mmalua,mmmul,mmshf,mmshfi,rse_m,scall,sem,stf,
125 st,syst_m0, syst_m,tbit,toar_i,toar_m,tobr,tofr,topr,xmpy,xtd,nop,
126 nop_b,nop_f,nop_i,nop_m,nop_x,lfetch,pre_cycle"
127 (const_string "unknown"))
129 ;; chk_s has an I and an M form; use type A for convenience.
130 (define_attr "type" "unknown,A,I,M,F,B,L,X,S"
131 (cond [(eq_attr "itanium_class" "ld,st,fld,stf,sem,nop_m") (const_string "M")
132 (eq_attr "itanium_class" "rse_m,syst_m,syst_m0") (const_string "M")
133 (eq_attr "itanium_class" "frar_m,toar_m,frfr,tofr") (const_string "M")
134 (eq_attr "itanium_class" "lfetch") (const_string "M")
135 (eq_attr "itanium_class" "chk_s,ialu,icmp,ilog,mmalua")
137 (eq_attr "itanium_class" "fmisc,fmac,fcmp,xmpy") (const_string "F")
138 (eq_attr "itanium_class" "fcvtfx,nop_f") (const_string "F")
139 (eq_attr "itanium_class" "frar_i,toar_i,frbr,tobr") (const_string "I")
140 (eq_attr "itanium_class" "frpr,topr,ishf,xtd,tbit") (const_string "I")
141 (eq_attr "itanium_class" "mmmul,mmshf,mmshfi,nop_i") (const_string "I")
142 (eq_attr "itanium_class" "br,scall,nop_b") (const_string "B")
143 (eq_attr "itanium_class" "stop_bit") (const_string "S")
144 (eq_attr "itanium_class" "nop_x") (const_string "X")
145 (eq_attr "itanium_class" "long_i") (const_string "L")]
146 (const_string "unknown")))
148 (define_attr "itanium_requires_unit0" "no,yes"
149 (cond [(eq_attr "itanium_class" "syst_m0,sem,frfr,rse_m") (const_string "yes")
150 (eq_attr "itanium_class" "toar_m,frar_m") (const_string "yes")
151 (eq_attr "itanium_class" "frbr,tobr,mmmul") (const_string "yes")
152 (eq_attr "itanium_class" "tbit,ishf,topr,frpr") (const_string "yes")
153 (eq_attr "itanium_class" "toar_i,frar_i") (const_string "yes")
154 (eq_attr "itanium_class" "fmisc,fcmp") (const_string "yes")]
155 (const_string "no")))
157 ;; Predication. True iff this instruction can be predicated.
159 (define_attr "predicable" "no,yes" (const_string "yes"))
161 ;; Empty. True iff this insn does not generate any code.
163 (define_attr "empty" "no,yes" (const_string "no"))
166 ;; DFA descriptions of ia64 processors used for insn scheduling and
169 (automata_option "ndfa")
171 ;; Uncomment the following line to output automata for debugging.
172 ;; (automata_option "v")
174 (automata_option "w")
176 (include "itanium1.md")
177 (include "itanium2.md")
180 ;; ::::::::::::::::::::
184 ;; ::::::::::::::::::::
186 ;; Set of a single predicate register. This is only used to implement
187 ;; pr-to-pr move and complement.
189 (define_insn "*movcci"
190 [(set (match_operand:CCI 0 "register_operand" "=c,c,c")
191 (match_operand:CCI 1 "nonmemory_operand" "O,n,c"))]
194 cmp.ne %0, p0 = r0, r0
195 cmp.eq %0, p0 = r0, r0
196 (%1) cmp.eq.unc %0, p0 = r0, r0"
197 [(set_attr "itanium_class" "icmp")
198 (set_attr "predicable" "no")])
201 [(set (match_operand:BI 0 "nonimmediate_operand" "=c,c,?c,?*r, c,*r,*r,*m,*r")
202 (match_operand:BI 1 "move_operand" " O,n, c, c,*r, n,*m,*r,*r"))]
205 cmp.ne %0, %I0 = r0, r0
206 cmp.eq %0, %I0 = r0, r0
209 tbit.nz %0, %I0 = %1, 0
214 [(set_attr "itanium_class" "icmp,icmp,unknown,unknown,tbit,ialu,ld,st,ialu")])
217 [(set (match_operand:BI 0 "register_operand" "")
218 (match_operand:BI 1 "register_operand" ""))]
220 && GET_CODE (operands[0]) == REG && GR_REGNO_P (REGNO (operands[0]))
221 && GET_CODE (operands[1]) == REG && PR_REGNO_P (REGNO (operands[1]))"
222 [(cond_exec (ne (match_dup 1) (const_int 0))
223 (set (match_dup 0) (const_int 1)))
224 (cond_exec (eq (match_dup 1) (const_int 0))
225 (set (match_dup 0) (const_int 0)))]
229 [(set (match_operand:BI 0 "register_operand" "")
230 (match_operand:BI 1 "register_operand" ""))]
232 && GET_CODE (operands[0]) == REG && PR_REGNO_P (REGNO (operands[0]))
233 && GET_CODE (operands[1]) == REG && PR_REGNO_P (REGNO (operands[1]))"
234 [(set (match_dup 2) (match_dup 4))
235 (set (match_dup 3) (match_dup 5))
236 (set (match_dup 0) (unspec:BI [(match_dup 0)] UNSPEC_PRED_REL_MUTEX))]
237 "operands[2] = gen_rtx_REG (CCImode, REGNO (operands[0]));
238 operands[3] = gen_rtx_REG (CCImode, REGNO (operands[0]) + 1);
239 operands[4] = gen_rtx_REG (CCImode, REGNO (operands[1]));
240 operands[5] = gen_rtx_REG (CCImode, REGNO (operands[1]) + 1);")
242 (define_expand "movqi"
243 [(set (match_operand:QI 0 "general_operand" "")
244 (match_operand:QI 1 "general_operand" ""))]
247 rtx op1 = ia64_expand_move (operands[0], operands[1]);
253 (define_insn "*movqi_internal"
254 [(set (match_operand:QI 0 "destination_operand" "=r,r,r, m, r,*f,*f")
255 (match_operand:QI 1 "move_operand" "rO,J,m,rO,*f,rO,*f"))]
256 "ia64_move_ok (operands[0], operands[1])"
265 [(set_attr "itanium_class" "ialu,ialu,ld,st,frfr,tofr,fmisc")])
267 (define_expand "movhi"
268 [(set (match_operand:HI 0 "general_operand" "")
269 (match_operand:HI 1 "general_operand" ""))]
272 rtx op1 = ia64_expand_move (operands[0], operands[1]);
278 (define_insn "*movhi_internal"
279 [(set (match_operand:HI 0 "destination_operand" "=r,r,r, m, r,*f,*f")
280 (match_operand:HI 1 "move_operand" "rO,J,m,rO,*f,rO,*f"))]
281 "ia64_move_ok (operands[0], operands[1])"
290 [(set_attr "itanium_class" "ialu,ialu,ld,st,frfr,tofr,fmisc")])
292 (define_expand "movsi"
293 [(set (match_operand:SI 0 "general_operand" "")
294 (match_operand:SI 1 "general_operand" ""))]
297 rtx op1 = ia64_expand_move (operands[0], operands[1]);
303 (define_insn "*movsi_internal"
304 [(set (match_operand:SI 0 "destination_operand" "=r,r,r,r, m, r,*f,*f, r,*d")
305 (match_operand:SI 1 "move_operand" "rO,J,i,m,rO,*f,rO,*f,*d,rK"))]
306 "ia64_move_ok (operands[0], operands[1])"
318 ;; frar_m, toar_m ??? why not frar_i and toar_i
319 [(set_attr "itanium_class" "ialu,ialu,long_i,ld,st,frfr,tofr,fmisc,frar_m,toar_m")])
321 (define_expand "movdi"
322 [(set (match_operand:DI 0 "general_operand" "")
323 (match_operand:DI 1 "general_operand" ""))]
326 rtx op1 = ia64_expand_move (operands[0], operands[1]);
332 (define_insn "*movdi_internal"
333 [(set (match_operand:DI 0 "destination_operand"
334 "=r,r,r,r, m, r,*f,*f,*f, Q, r,*b, r,*e, r,*d, r,*c")
335 (match_operand:DI 1 "move_operand"
336 "rO,JT,i,m,rO,*f,rO,*f, Q,*f,*b,rO,*e,rK,*d,rK,*c,rO"))]
337 "ia64_move_ok (operands[0], operands[1])"
339 static const char * const alt[] = {
341 "%,addl %0 = %1, r0",
343 "%,ld8%O1 %0 = %1%P1",
344 "%,st8%Q0 %0 = %r1%P0",
345 "%,getf.sig %0 = %1",
346 "%,setf.sig %0 = %r1",
360 if (which_alternative == 2 && ! TARGET_NO_PIC
361 && symbolic_operand (operands[1], VOIDmode))
364 return alt[which_alternative];
366 [(set_attr "itanium_class" "ialu,ialu,long_i,ld,st,frfr,tofr,fmisc,fld,stf,frbr,tobr,frar_i,toar_i,frar_m,toar_m,frpr,topr")])
369 [(set (match_operand 0 "register_operand" "")
370 (match_operand 1 "symbolic_operand" ""))]
371 "reload_completed && ! TARGET_NO_PIC"
374 ia64_expand_load_address (operands[0], operands[1]);
378 (define_expand "load_fptr"
380 (plus:DI (reg:DI 1) (match_operand 1 "function_operand" "")))
381 (set (match_operand:DI 0 "register_operand" "") (match_dup 3))]
384 operands[2] = no_new_pseudos ? operands[0] : gen_reg_rtx (DImode);
385 operands[3] = gen_const_mem (DImode, operands[2]);
388 (define_insn "*load_fptr_internal1"
389 [(set (match_operand:DI 0 "register_operand" "=r")
390 (plus:DI (reg:DI 1) (match_operand 1 "function_operand" "s")))]
392 "addl %0 = @ltoff(@fptr(%1)), gp"
393 [(set_attr "itanium_class" "ialu")])
395 (define_insn "load_gprel"
396 [(set (match_operand:DI 0 "register_operand" "=r")
397 (plus:DI (reg:DI 1) (match_operand 1 "sdata_symbolic_operand" "s")))]
399 "addl %0 = @gprel(%1), gp"
400 [(set_attr "itanium_class" "ialu")])
402 (define_insn "gprel64_offset"
403 [(set (match_operand:DI 0 "register_operand" "=r")
404 (minus:DI (match_operand:DI 1 "symbolic_operand" "") (reg:DI 1)))]
406 "movl %0 = @gprel(%1)"
407 [(set_attr "itanium_class" "long_i")])
409 (define_expand "load_gprel64"
411 (minus:DI (match_operand:DI 1 "symbolic_operand" "") (match_dup 3)))
412 (set (match_operand:DI 0 "register_operand" "")
413 (plus:DI (match_dup 3) (match_dup 2)))]
416 operands[2] = no_new_pseudos ? operands[0] : gen_reg_rtx (DImode);
417 operands[3] = pic_offset_table_rtx;
420 ;; This is used as a placeholder for the return address during early
421 ;; compilation. We won't know where we've placed this until during
422 ;; reload, at which point it can wind up in b0, a general register,
423 ;; or memory. The only safe destination under these conditions is a
426 (define_insn_and_split "*movdi_ret_addr"
427 [(set (match_operand:DI 0 "register_operand" "=r")
428 (unspec:DI [(const_int 0)] UNSPEC_RET_ADDR))]
434 ia64_split_return_addr_rtx (operands[0]);
437 [(set_attr "itanium_class" "ialu")])
439 (define_insn "*load_symptr_high"
440 [(set (match_operand:DI 0 "register_operand" "=r")
441 (plus:DI (high:DI (match_operand 1 "got_symbolic_operand" "s"))
442 (match_operand:DI 2 "register_operand" "a")))]
445 if (HAVE_AS_LTOFFX_LDXMOV_RELOCS)
446 return "%,addl %0 = @ltoffx(%1), %2";
448 return "%,addl %0 = @ltoff(%1), %2";
450 [(set_attr "itanium_class" "ialu")])
452 (define_insn "*load_symptr_low"
453 [(set (match_operand:DI 0 "register_operand" "=r")
454 (lo_sum:DI (match_operand:DI 1 "register_operand" "r")
455 (match_operand 2 "got_symbolic_operand" "s")))]
458 if (HAVE_AS_LTOFFX_LDXMOV_RELOCS)
459 return "%,ld8.mov %0 = [%1], %2";
461 return "%,ld8 %0 = [%1]";
463 [(set_attr "itanium_class" "ld")])
465 (define_insn "load_ltoff_dtpmod"
466 [(set (match_operand:DI 0 "register_operand" "=r")
468 (unspec:DI [(match_operand:DI 1 "symbolic_operand" "")]
469 UNSPEC_LTOFF_DTPMOD)))]
471 "addl %0 = @ltoff(@dtpmod(%1)), gp"
472 [(set_attr "itanium_class" "ialu")])
474 (define_insn "load_ltoff_dtprel"
475 [(set (match_operand:DI 0 "register_operand" "=r")
477 (unspec:DI [(match_operand:DI 1 "symbolic_operand" "")]
478 UNSPEC_LTOFF_DTPREL)))]
480 "addl %0 = @ltoff(@dtprel(%1)), gp"
481 [(set_attr "itanium_class" "ialu")])
483 (define_expand "load_dtprel"
484 [(set (match_operand:DI 0 "register_operand" "")
485 (unspec:DI [(match_operand:DI 1 "symbolic_operand" "")]
490 (define_insn "*load_dtprel64"
491 [(set (match_operand:DI 0 "register_operand" "=r")
492 (unspec:DI [(match_operand:DI 1 "symbolic_operand" "")]
495 "movl %0 = @dtprel(%1)"
496 [(set_attr "itanium_class" "long_i")])
498 (define_insn "*load_dtprel22"
499 [(set (match_operand:DI 0 "register_operand" "=r")
500 (unspec:DI [(match_operand:DI 1 "symbolic_operand" "")]
503 "addl %0 = @dtprel(%1), r0"
504 [(set_attr "itanium_class" "ialu")])
506 (define_expand "add_dtprel"
507 [(set (match_operand:DI 0 "register_operand" "")
508 (plus:DI (match_operand:DI 1 "register_operand" "")
509 (unspec:DI [(match_operand:DI 2 "symbolic_operand" "")]
514 (define_insn "*add_dtprel14"
515 [(set (match_operand:DI 0 "register_operand" "=r")
516 (plus:DI (match_operand:DI 1 "register_operand" "r")
517 (unspec:DI [(match_operand:DI 2 "symbolic_operand" "")]
520 "adds %0 = @dtprel(%2), %1"
521 [(set_attr "itanium_class" "ialu")])
523 (define_insn "*add_dtprel22"
524 [(set (match_operand:DI 0 "register_operand" "=r")
525 (plus:DI (match_operand:DI 1 "register_operand" "a")
526 (unspec:DI [(match_operand:DI 2 "symbolic_operand" "")]
529 "addl %0 = @dtprel(%2), %1"
530 [(set_attr "itanium_class" "ialu")])
532 (define_insn "load_ltoff_tprel"
533 [(set (match_operand:DI 0 "register_operand" "=r")
535 (unspec:DI [(match_operand:DI 1 "symbolic_operand" "")]
536 UNSPEC_LTOFF_TPREL)))]
538 "addl %0 = @ltoff(@tprel(%1)), gp"
539 [(set_attr "itanium_class" "ialu")])
541 (define_expand "load_tprel"
542 [(set (match_operand:DI 0 "register_operand" "")
543 (unspec:DI [(match_operand:DI 1 "symbolic_operand" "")]
548 (define_insn "*load_tprel64"
549 [(set (match_operand:DI 0 "register_operand" "=r")
550 (unspec:DI [(match_operand:DI 1 "symbolic_operand" "")]
553 "movl %0 = @tprel(%1)"
554 [(set_attr "itanium_class" "long_i")])
556 (define_insn "*load_tprel22"
557 [(set (match_operand:DI 0 "register_operand" "=r")
558 (unspec:DI [(match_operand:DI 1 "symbolic_operand" "")]
561 "addl %0 = @tprel(%1), r0"
562 [(set_attr "itanium_class" "ialu")])
564 (define_expand "add_tprel"
565 [(set (match_operand:DI 0 "register_operand" "")
566 (plus:DI (match_operand:DI 1 "register_operand" "")
567 (unspec:DI [(match_operand:DI 2 "symbolic_operand" "")]
572 (define_insn "*add_tprel14"
573 [(set (match_operand:DI 0 "register_operand" "=r")
574 (plus:DI (match_operand:DI 1 "register_operand" "r")
575 (unspec:DI [(match_operand:DI 2 "symbolic_operand" "")]
578 "adds %0 = @tprel(%2), %1"
579 [(set_attr "itanium_class" "ialu")])
581 (define_insn "*add_tprel22"
582 [(set (match_operand:DI 0 "register_operand" "=r")
583 (plus:DI (match_operand:DI 1 "register_operand" "a")
584 (unspec:DI [(match_operand:DI 2 "symbolic_operand" "")]
587 "addl %0 = @tprel(%2), %1"
588 [(set_attr "itanium_class" "ialu")])
590 ;; With no offsettable memory references, we've got to have a scratch
591 ;; around to play with the second word. However, in order to avoid a
592 ;; reload nightmare we lie, claim we don't need one, and fix it up
593 ;; in ia64_split_tmode_move.
594 (define_expand "movti"
595 [(set (match_operand:TI 0 "general_operand" "")
596 (match_operand:TI 1 "general_operand" ""))]
599 rtx op1 = ia64_expand_move (operands[0], operands[1]);
605 (define_insn_and_split "*movti_internal"
606 [(set (match_operand:TI 0 "nonimmediate_operand" "=r,r,m")
607 (match_operand:TI 1 "general_operand" "ri,m,r"))]
608 "ia64_move_ok (operands[0], operands[1])"
613 ia64_split_tmode_move (operands);
616 [(set_attr "itanium_class" "unknown")
617 (set_attr "predicable" "no")])
619 ;; Floating Point Moves
621 ;; Note - Patterns for SF mode moves are compulsory, but
622 ;; patterns for DF are optional, as GCC can synthesize them.
624 (define_expand "movsf"
625 [(set (match_operand:SF 0 "general_operand" "")
626 (match_operand:SF 1 "general_operand" ""))]
629 rtx op1 = ia64_expand_move (operands[0], operands[1]);
635 (define_insn "*movsf_internal"
636 [(set (match_operand:SF 0 "destination_operand" "=f,f, Q,*r, f,*r,*r, m")
637 (match_operand:SF 1 "general_operand" "fG,Q,fG,fG,*r,*r, m,*r"))]
638 "ia64_move_ok (operands[0], operands[1])"
648 [(set_attr "itanium_class" "fmisc,fld,stf,frfr,tofr,ialu,ld,st")])
650 (define_expand "movdf"
651 [(set (match_operand:DF 0 "general_operand" "")
652 (match_operand:DF 1 "general_operand" ""))]
655 rtx op1 = ia64_expand_move (operands[0], operands[1]);
661 (define_insn "*movdf_internal"
662 [(set (match_operand:DF 0 "destination_operand" "=f,f, Q,*r, f,*r,*r, m")
663 (match_operand:DF 1 "general_operand" "fG,Q,fG,fG,*r,*r, m,*r"))]
664 "ia64_move_ok (operands[0], operands[1])"
674 [(set_attr "itanium_class" "fmisc,fld,stf,frfr,tofr,ialu,ld,st")])
676 ;; With no offsettable memory references, we've got to have a scratch
677 ;; around to play with the second word if the variable winds up in GRs.
678 (define_expand "movxf"
679 [(set (match_operand:XF 0 "general_operand" "")
680 (match_operand:XF 1 "general_operand" ""))]
683 rtx op0 = operands[0];
685 if (GET_CODE (op0) == SUBREG)
686 op0 = SUBREG_REG (op0);
688 /* We must support XFmode loads into general registers for stdarg/vararg,
689 unprototyped calls, and a rare case where a long double is passed as
690 an argument after a float HFA fills the FP registers. We split them into
691 DImode loads for convenience. We also need to support XFmode stores
692 for the last case. This case does not happen for stdarg/vararg routines,
693 because we do a block store to memory of unnamed arguments. */
695 if (GET_CODE (op0) == REG && GR_REGNO_P (REGNO (op0)))
697 /* We're hoping to transform everything that deals with XFmode
698 quantities and GR registers early in the compiler. */
702 /* Struct to register can just use TImode instead. */
703 if ((GET_CODE (operands[1]) == SUBREG
704 && GET_MODE (SUBREG_REG (operands[1])) == TImode)
705 || (GET_CODE (operands[1]) == REG
706 && GR_REGNO_P (REGNO (operands[1]))))
708 rtx op1 = operands[1];
710 if (GET_CODE (op1) == SUBREG)
711 op1 = SUBREG_REG (op1);
713 op1 = gen_rtx_REG (TImode, REGNO (op1));
715 emit_move_insn (gen_rtx_REG (TImode, REGNO (op0)), op1);
719 if (GET_CODE (operands[1]) == CONST_DOUBLE)
721 emit_move_insn (gen_rtx_REG (DImode, REGNO (op0)),
722 operand_subword (operands[1], 0, 0, XFmode));
723 emit_move_insn (gen_rtx_REG (DImode, REGNO (op0) + 1),
724 operand_subword (operands[1], 1, 0, XFmode));
728 /* If the quantity is in a register not known to be GR, spill it. */
729 if (register_operand (operands[1], XFmode))
730 operands[1] = spill_xfmode_operand (operands[1], 1);
732 if (GET_CODE (operands[1]) == MEM)
736 out[WORDS_BIG_ENDIAN] = gen_rtx_REG (DImode, REGNO (op0));
737 out[!WORDS_BIG_ENDIAN] = gen_rtx_REG (DImode, REGNO (op0) + 1);
739 emit_move_insn (out[0], adjust_address (operands[1], DImode, 0));
740 emit_move_insn (out[1], adjust_address (operands[1], DImode, 8));
747 if (GET_CODE (operands[1]) == REG && GR_REGNO_P (REGNO (operands[1])))
749 /* We're hoping to transform everything that deals with XFmode
750 quantities and GR registers early in the compiler. */
754 /* Op0 can't be a GR_REG here, as that case is handled above.
755 If op0 is a register, then we spill op1, so that we now have a
756 MEM operand. This requires creating an XFmode subreg of a TImode reg
757 to force the spill. */
758 if (register_operand (operands[0], XFmode))
760 rtx op1 = gen_rtx_REG (TImode, REGNO (operands[1]));
761 op1 = gen_rtx_SUBREG (XFmode, op1, 0);
762 operands[1] = spill_xfmode_operand (op1, 0);
765 else if (GET_CODE (operands[0]) == MEM)
769 in[WORDS_BIG_ENDIAN] = gen_rtx_REG (DImode, REGNO (operands[1]));
770 in[!WORDS_BIG_ENDIAN] = gen_rtx_REG (DImode, REGNO (operands[1]) + 1);
772 emit_move_insn (adjust_address (operands[0], DImode, 0), in[0]);
773 emit_move_insn (adjust_address (operands[0], DImode, 8), in[1]);
781 if (! reload_in_progress && ! reload_completed)
783 operands[1] = spill_xfmode_operand (operands[1], 0);
785 if (GET_MODE (op0) == TImode && GET_CODE (op0) == REG)
787 rtx memt, memx, in = operands[1];
789 in = validize_mem (force_const_mem (XFmode, in));
790 if (GET_CODE (in) == MEM)
791 memt = adjust_address (in, TImode, 0);
794 memt = assign_stack_temp (TImode, 16, 0);
795 memx = adjust_address (memt, XFmode, 0);
796 emit_move_insn (memx, in);
798 emit_move_insn (op0, memt);
802 if (! ia64_move_ok (operands[0], operands[1]))
803 operands[1] = force_reg (XFmode, operands[1]);
807 ;; ??? There's no easy way to mind volatile acquire/release semantics.
809 (define_insn "*movxf_internal"
810 [(set (match_operand:XF 0 "destination_operand" "=f,f, m")
811 (match_operand:XF 1 "general_operand" "fG,m,fG"))]
812 "ia64_move_ok (operands[0], operands[1])"
817 [(set_attr "itanium_class" "fmisc,fld,stf")])
819 ;; Better code generation via insns that deal with TFmode register pairs
820 ;; directly. Same concerns apply as for TImode.
821 (define_expand "movtf"
822 [(set (match_operand:TF 0 "general_operand" "")
823 (match_operand:TF 1 "general_operand" ""))]
826 rtx op1 = ia64_expand_move (operands[0], operands[1]);
832 (define_insn_and_split "*movtf_internal"
833 [(set (match_operand:TF 0 "destination_operand" "=r,r,m")
834 (match_operand:TF 1 "general_operand" "ri,m,r"))]
835 "ia64_move_ok (operands[0], operands[1])"
840 ia64_split_tmode_move (operands);
843 [(set_attr "itanium_class" "unknown")
844 (set_attr "predicable" "no")])
847 ;; ::::::::::::::::::::
851 ;; ::::::::::::::::::::
853 ;; Signed conversions from a smaller integer to a larger integer
855 (define_insn "extendqidi2"
856 [(set (match_operand:DI 0 "gr_register_operand" "=r")
857 (sign_extend:DI (match_operand:QI 1 "gr_register_operand" "r")))]
860 [(set_attr "itanium_class" "xtd")])
862 (define_insn "extendhidi2"
863 [(set (match_operand:DI 0 "gr_register_operand" "=r")
864 (sign_extend:DI (match_operand:HI 1 "gr_register_operand" "r")))]
867 [(set_attr "itanium_class" "xtd")])
869 (define_insn "extendsidi2"
870 [(set (match_operand:DI 0 "grfr_register_operand" "=r,?f")
871 (sign_extend:DI (match_operand:SI 1 "grfr_register_operand" "r,f")))]
876 [(set_attr "itanium_class" "xtd,fmisc")])
878 ;; Unsigned conversions from a smaller integer to a larger integer
880 (define_insn "zero_extendqidi2"
881 [(set (match_operand:DI 0 "gr_register_operand" "=r,r")
882 (zero_extend:DI (match_operand:QI 1 "gr_nonimmediate_operand" "r,m")))]
887 [(set_attr "itanium_class" "xtd,ld")])
889 (define_insn "zero_extendhidi2"
890 [(set (match_operand:DI 0 "gr_register_operand" "=r,r")
891 (zero_extend:DI (match_operand:HI 1 "gr_nonimmediate_operand" "r,m")))]
896 [(set_attr "itanium_class" "xtd,ld")])
898 (define_insn "zero_extendsidi2"
899 [(set (match_operand:DI 0 "grfr_register_operand" "=r,r,?f")
901 (match_operand:SI 1 "grfr_nonimmediate_operand" "r,m,f")))]
907 [(set_attr "itanium_class" "ialu,ld,fmisc")])
909 ;; Convert between floating point types of different sizes.
911 ;; At first glance, it would appear that emitting fnorm for an extending
912 ;; conversion is unnecessary. However, the stf and getf instructions work
913 ;; correctly only if the input is properly rounded for its type. In
914 ;; particular, we get the wrong result for getf.d/stfd if the input is a
915 ;; denorm single. Since we don't know what the next instruction will be, we
916 ;; have to emit an fnorm.
918 ;; ??? Optimization opportunity here. Get rid of the insn altogether
919 ;; when we can. Should probably use a scheme like has been proposed
920 ;; for ia32 in dealing with operands that match unary operators. This
921 ;; would let combine merge the thing into adjacent insns. See also how the
922 ;; mips port handles SIGN_EXTEND as operands to integer arithmetic insns via
923 ;; se_register_operand.
925 (define_insn "extendsfdf2"
926 [(set (match_operand:DF 0 "fr_register_operand" "=f")
927 (float_extend:DF (match_operand:SF 1 "fr_register_operand" "f")))]
930 [(set_attr "itanium_class" "fmac")])
932 (define_insn "extendsfxf2"
933 [(set (match_operand:XF 0 "fr_register_operand" "=f")
934 (float_extend:XF (match_operand:SF 1 "fr_register_operand" "f")))]
937 [(set_attr "itanium_class" "fmac")])
939 (define_insn "extenddfxf2"
940 [(set (match_operand:XF 0 "fr_register_operand" "=f")
941 (float_extend:XF (match_operand:DF 1 "fr_register_operand" "f")))]
944 [(set_attr "itanium_class" "fmac")])
946 (define_insn "truncdfsf2"
947 [(set (match_operand:SF 0 "fr_register_operand" "=f")
948 (float_truncate:SF (match_operand:DF 1 "fr_register_operand" "f")))]
951 [(set_attr "itanium_class" "fmac")])
953 (define_insn "truncxfsf2"
954 [(set (match_operand:SF 0 "fr_register_operand" "=f")
955 (float_truncate:SF (match_operand:XF 1 "fr_register_operand" "f")))]
958 [(set_attr "itanium_class" "fmac")])
960 (define_insn "truncxfdf2"
961 [(set (match_operand:DF 0 "fr_register_operand" "=f")
962 (float_truncate:DF (match_operand:XF 1 "fr_register_operand" "f")))]
965 [(set_attr "itanium_class" "fmac")])
967 ;; Convert between signed integer types and floating point.
969 (define_insn "floatdixf2"
970 [(set (match_operand:XF 0 "fr_register_operand" "=f")
971 (float:XF (match_operand:DI 1 "fr_register_operand" "f")))]
974 [(set_attr "itanium_class" "fcvtfx")])
976 (define_insn "fix_truncsfdi2"
977 [(set (match_operand:DI 0 "fr_register_operand" "=f")
978 (fix:DI (match_operand:SF 1 "fr_register_operand" "f")))]
980 "fcvt.fx.trunc %0 = %1"
981 [(set_attr "itanium_class" "fcvtfx")])
983 (define_insn "fix_truncdfdi2"
984 [(set (match_operand:DI 0 "fr_register_operand" "=f")
985 (fix:DI (match_operand:DF 1 "fr_register_operand" "f")))]
987 "fcvt.fx.trunc %0 = %1"
988 [(set_attr "itanium_class" "fcvtfx")])
990 (define_insn "fix_truncxfdi2"
991 [(set (match_operand:DI 0 "fr_register_operand" "=f")
992 (fix:DI (match_operand:XF 1 "fr_register_operand" "f")))]
994 "fcvt.fx.trunc %0 = %1"
995 [(set_attr "itanium_class" "fcvtfx")])
997 (define_insn "fix_truncxfdi2_alts"
998 [(set (match_operand:DI 0 "fr_register_operand" "=f")
999 (fix:DI (match_operand:XF 1 "fr_register_operand" "f")))
1000 (use (match_operand:SI 2 "const_int_operand" ""))]
1002 "fcvt.fx.trunc.s%2 %0 = %1"
1003 [(set_attr "itanium_class" "fcvtfx")])
1005 ;; Convert between unsigned integer types and floating point.
1007 (define_insn "floatunsdisf2"
1008 [(set (match_operand:SF 0 "fr_register_operand" "=f")
1009 (unsigned_float:SF (match_operand:DI 1 "fr_register_operand" "f")))]
1011 "fcvt.xuf.s %0 = %1"
1012 [(set_attr "itanium_class" "fcvtfx")])
1014 (define_insn "floatunsdidf2"
1015 [(set (match_operand:DF 0 "fr_register_operand" "=f")
1016 (unsigned_float:DF (match_operand:DI 1 "fr_register_operand" "f")))]
1018 "fcvt.xuf.d %0 = %1"
1019 [(set_attr "itanium_class" "fcvtfx")])
1021 (define_insn "floatunsdixf2"
1022 [(set (match_operand:XF 0 "fr_register_operand" "=f")
1023 (unsigned_float:XF (match_operand:DI 1 "fr_register_operand" "f")))]
1026 [(set_attr "itanium_class" "fcvtfx")])
1028 (define_insn "fixuns_truncsfdi2"
1029 [(set (match_operand:DI 0 "fr_register_operand" "=f")
1030 (unsigned_fix:DI (match_operand:SF 1 "fr_register_operand" "f")))]
1032 "fcvt.fxu.trunc %0 = %1"
1033 [(set_attr "itanium_class" "fcvtfx")])
1035 (define_insn "fixuns_truncdfdi2"
1036 [(set (match_operand:DI 0 "fr_register_operand" "=f")
1037 (unsigned_fix:DI (match_operand:DF 1 "fr_register_operand" "f")))]
1039 "fcvt.fxu.trunc %0 = %1"
1040 [(set_attr "itanium_class" "fcvtfx")])
1042 (define_insn "fixuns_truncxfdi2"
1043 [(set (match_operand:DI 0 "fr_register_operand" "=f")
1044 (unsigned_fix:DI (match_operand:XF 1 "fr_register_operand" "f")))]
1046 "fcvt.fxu.trunc %0 = %1"
1047 [(set_attr "itanium_class" "fcvtfx")])
1049 (define_insn "fixuns_truncxfdi2_alts"
1050 [(set (match_operand:DI 0 "fr_register_operand" "=f")
1051 (unsigned_fix:DI (match_operand:XF 1 "fr_register_operand" "f")))
1052 (use (match_operand:SI 2 "const_int_operand" ""))]
1054 "fcvt.fxu.trunc.s%2 %0 = %1"
1055 [(set_attr "itanium_class" "fcvtfx")])
1057 ;; ::::::::::::::::::::
1059 ;; :: Bit field extraction
1061 ;; ::::::::::::::::::::
1064 [(set (match_operand:DI 0 "gr_register_operand" "=r")
1065 (sign_extract:DI (match_operand:DI 1 "gr_register_operand" "r")
1066 (match_operand:DI 2 "const_int_operand" "n")
1067 (match_operand:DI 3 "const_int_operand" "n")))]
1069 "extr %0 = %1, %3, %2"
1070 [(set_attr "itanium_class" "ishf")])
1072 (define_insn "extzv"
1073 [(set (match_operand:DI 0 "gr_register_operand" "=r")
1074 (zero_extract:DI (match_operand:DI 1 "gr_register_operand" "r")
1075 (match_operand:DI 2 "const_int_operand" "n")
1076 (match_operand:DI 3 "const_int_operand" "n")))]
1078 "extr.u %0 = %1, %3, %2"
1079 [(set_attr "itanium_class" "ishf")])
1081 ;; Insert a bit field.
1082 ;; Can have 3 operands, source1 (inserter), source2 (insertee), dest.
1083 ;; Source1 can be 0 or -1.
1084 ;; Source2 can be 0.
1086 ;; ??? Actual dep instruction is more powerful than what these insv
1087 ;; patterns support. Unfortunately, combine is unable to create patterns
1088 ;; where source2 != dest.
1090 (define_expand "insv"
1091 [(set (zero_extract:DI (match_operand:DI 0 "gr_register_operand" "")
1092 (match_operand:DI 1 "const_int_operand" "")
1093 (match_operand:DI 2 "const_int_operand" ""))
1094 (match_operand:DI 3 "nonmemory_operand" ""))]
1097 int width = INTVAL (operands[1]);
1098 int shift = INTVAL (operands[2]);
1100 /* If operand[3] is a constant, and isn't 0 or -1, then load it into a
1102 if (! register_operand (operands[3], DImode)
1103 && operands[3] != const0_rtx && operands[3] != constm1_rtx)
1104 operands[3] = force_reg (DImode, operands[3]);
1106 /* If this is a single dep instruction, we have nothing to do. */
1107 if (! ((register_operand (operands[3], DImode) && width <= 16)
1108 || operands[3] == const0_rtx || operands[3] == constm1_rtx))
1110 /* Check for cases that can be implemented with a mix instruction. */
1111 if (width == 32 && shift == 0)
1113 /* Directly generating the mix4left instruction confuses
1114 optimize_bit_field in function.c. Since this is performing
1115 a useful optimization, we defer generation of the complicated
1116 mix4left RTL to the first splitting phase. */
1117 rtx tmp = gen_reg_rtx (DImode);
1118 emit_insn (gen_shift_mix4left (operands[0], operands[3], tmp));
1121 else if (width == 32 && shift == 32)
1123 emit_insn (gen_mix4right (operands[0], operands[3]));
1127 /* We could handle remaining cases by emitting multiple dep
1130 If we need more than two dep instructions then we lose. A 6
1131 insn sequence mov mask1,mov mask2,shl;;and,and;;or is better than
1132 mov;;dep,shr;;dep,shr;;dep. The former can be executed in 3 cycles,
1133 the latter is 6 cycles on an Itanium (TM) processor, because there is
1134 only one function unit that can execute dep and shr immed.
1136 If we only need two dep instruction, then we still lose.
1137 mov;;dep,shr;;dep is still 4 cycles. Even if we optimize away
1138 the unnecessary mov, this is still undesirable because it will be
1139 hard to optimize, and it creates unnecessary pressure on the I0
1145 /* This code may be useful for other IA-64 processors, so we leave it in
1151 emit_insn (gen_insv (operands[0], GEN_INT (16), GEN_INT (shift),
1155 tmp = gen_reg_rtx (DImode);
1156 emit_insn (gen_lshrdi3 (tmp, operands[3], GEN_INT (16)));
1159 operands[1] = GEN_INT (width);
1160 operands[2] = GEN_INT (shift);
1165 (define_insn "*insv_internal"
1166 [(set (zero_extract:DI (match_operand:DI 0 "gr_register_operand" "+r")
1167 (match_operand:DI 1 "const_int_operand" "n")
1168 (match_operand:DI 2 "const_int_operand" "n"))
1169 (match_operand:DI 3 "nonmemory_operand" "rP"))]
1170 "(gr_register_operand (operands[3], DImode) && INTVAL (operands[1]) <= 16)
1171 || operands[3] == const0_rtx || operands[3] == constm1_rtx"
1172 "dep %0 = %3, %0, %2, %1"
1173 [(set_attr "itanium_class" "ishf")])
1175 ;; Combine doesn't like to create bit-field insertions into zero.
1176 (define_insn "*shladdp4_internal"
1177 [(set (match_operand:DI 0 "gr_register_operand" "=r")
1178 (and:DI (ashift:DI (match_operand:DI 1 "gr_register_operand" "r")
1179 (match_operand:DI 2 "shladd_log2_operand" "n"))
1180 (match_operand:DI 3 "const_int_operand" "n")))]
1181 "ia64_depz_field_mask (operands[3], operands[2]) + INTVAL (operands[2]) == 32"
1182 "shladdp4 %0 = %1, %2, r0"
1183 [(set_attr "itanium_class" "ialu")])
1185 (define_insn "*depz_internal"
1186 [(set (match_operand:DI 0 "gr_register_operand" "=r")
1187 (and:DI (ashift:DI (match_operand:DI 1 "gr_register_operand" "r")
1188 (match_operand:DI 2 "const_int_operand" "n"))
1189 (match_operand:DI 3 "const_int_operand" "n")))]
1190 "CONST_OK_FOR_M (INTVAL (operands[2]))
1191 && ia64_depz_field_mask (operands[3], operands[2]) > 0"
1193 operands[3] = GEN_INT (ia64_depz_field_mask (operands[3], operands[2]));
1194 return "%,dep.z %0 = %1, %2, %3";
1196 [(set_attr "itanium_class" "ishf")])
1198 (define_insn "shift_mix4left"
1199 [(set (zero_extract:DI (match_operand:DI 0 "gr_register_operand" "+r")
1200 (const_int 32) (const_int 0))
1201 (match_operand:DI 1 "gr_register_operand" "r"))
1202 (clobber (match_operand:DI 2 "gr_register_operand" "=r"))]
1205 [(set_attr "itanium_class" "unknown")])
1208 [(set (zero_extract:DI (match_operand:DI 0 "register_operand" "")
1209 (const_int 32) (const_int 0))
1210 (match_operand:DI 1 "register_operand" ""))
1211 (clobber (match_operand:DI 2 "register_operand" ""))]
1213 [(set (match_dup 3) (ashift:DI (match_dup 1) (const_int 32)))
1214 (set (zero_extract:DI (match_dup 0) (const_int 32) (const_int 0))
1215 (lshiftrt:DI (match_dup 3) (const_int 32)))]
1216 "operands[3] = operands[2];")
1218 (define_insn "*mix4left"
1219 [(set (zero_extract:DI (match_operand:DI 0 "gr_register_operand" "+r")
1220 (const_int 32) (const_int 0))
1221 (lshiftrt:DI (match_operand:DI 1 "gr_register_operand" "r")
1224 "mix4.l %0 = %0, %r1"
1225 [(set_attr "itanium_class" "mmshf")])
1227 (define_insn "mix4right"
1228 [(set (zero_extract:DI (match_operand:DI 0 "gr_register_operand" "+r")
1229 (const_int 32) (const_int 32))
1230 (match_operand:DI 1 "gr_reg_or_0_operand" "rO"))]
1232 "mix4.r %0 = %r1, %0"
1233 [(set_attr "itanium_class" "mmshf")])
1235 ;; This is used by the rotrsi3 pattern.
1237 (define_insn "*mix4right_3op"
1238 [(set (match_operand:DI 0 "gr_register_operand" "=r")
1239 (ior:DI (zero_extend:DI (match_operand:SI 1 "gr_register_operand" "r"))
1240 (ashift:DI (zero_extend:DI
1241 (match_operand:SI 2 "gr_register_operand" "r"))
1244 "mix4.r %0 = %2, %1"
1245 [(set_attr "itanium_class" "mmshf")])
1248 ;; ::::::::::::::::::::
1250 ;; :: 1 bit Integer arithmetic
1252 ;; ::::::::::::::::::::
1254 (define_insn_and_split "andbi3"
1255 [(set (match_operand:BI 0 "register_operand" "=c,c,r")
1256 (and:BI (match_operand:BI 1 "register_operand" "%0,0,r")
1257 (match_operand:BI 2 "register_operand" "c,r,r")))]
1261 tbit.nz.and.orcm %0, %I0 = %2, 0
1264 && GET_CODE (operands[0]) == REG && PR_REGNO_P (REGNO (operands[0]))
1265 && GET_CODE (operands[2]) == REG && PR_REGNO_P (REGNO (operands[2]))"
1266 [(cond_exec (eq (match_dup 2) (const_int 0))
1267 (set (match_dup 0) (and:BI (ne:BI (const_int 0) (const_int 0))
1270 [(set_attr "itanium_class" "unknown,tbit,ilog")])
1272 (define_insn_and_split "*andcmbi3"
1273 [(set (match_operand:BI 0 "register_operand" "=c,c,r")
1274 (and:BI (not:BI (match_operand:BI 1 "register_operand" "c,r,r"))
1275 (match_operand:BI 2 "register_operand" "0,0,r")))]
1279 tbit.z.and.orcm %0, %I0 = %1, 0
1282 && GET_CODE (operands[0]) == REG && PR_REGNO_P (REGNO (operands[0]))
1283 && GET_CODE (operands[1]) == REG && PR_REGNO_P (REGNO (operands[1]))"
1284 [(cond_exec (ne (match_dup 1) (const_int 0))
1285 (set (match_dup 0) (and:BI (ne:BI (const_int 0) (const_int 0))
1288 [(set_attr "itanium_class" "unknown,tbit,ilog")])
1290 (define_insn_and_split "iorbi3"
1291 [(set (match_operand:BI 0 "register_operand" "=c,c,r")
1292 (ior:BI (match_operand:BI 1 "register_operand" "%0,0,r")
1293 (match_operand:BI 2 "register_operand" "c,r,r")))]
1297 tbit.nz.or.andcm %0, %I0 = %2, 0
1300 && GET_CODE (operands[0]) == REG && PR_REGNO_P (REGNO (operands[0]))
1301 && GET_CODE (operands[2]) == REG && PR_REGNO_P (REGNO (operands[2]))"
1302 [(cond_exec (ne (match_dup 2) (const_int 0))
1303 (set (match_dup 0) (ior:BI (eq:BI (const_int 0) (const_int 0))
1306 [(set_attr "itanium_class" "unknown,tbit,ilog")])
1308 (define_insn_and_split "*iorcmbi3"
1309 [(set (match_operand:BI 0 "register_operand" "=c,c")
1310 (ior:BI (not:BI (match_operand:BI 1 "register_operand" "c,r"))
1311 (match_operand:BI 2 "register_operand" "0,0")))]
1315 tbit.z.or.andcm %0, %I0 = %1, 0"
1317 && GET_CODE (operands[0]) == REG && PR_REGNO_P (REGNO (operands[0]))
1318 && GET_CODE (operands[1]) == REG && PR_REGNO_P (REGNO (operands[1]))"
1319 [(cond_exec (eq (match_dup 1) (const_int 0))
1320 (set (match_dup 0) (ior:BI (eq:BI (const_int 0) (const_int 0))
1323 [(set_attr "itanium_class" "unknown,tbit")])
1325 (define_insn "one_cmplbi2"
1326 [(set (match_operand:BI 0 "register_operand" "=c,r,c,&c")
1327 (not:BI (match_operand:BI 1 "register_operand" "r,r,0,c")))
1328 (clobber (match_scratch:BI 2 "=X,X,c,X"))]
1331 tbit.z %0, %I0 = %1, 0
1335 [(set_attr "itanium_class" "tbit,ilog,unknown,unknown")])
1338 [(set (match_operand:BI 0 "register_operand" "")
1339 (not:BI (match_operand:BI 1 "register_operand" "")))
1340 (clobber (match_scratch:BI 2 ""))]
1342 && GET_CODE (operands[0]) == REG && PR_REGNO_P (REGNO (operands[0]))
1343 && rtx_equal_p (operands[0], operands[1])"
1344 [(set (match_dup 4) (match_dup 3))
1345 (set (match_dup 0) (const_int 1))
1346 (cond_exec (ne (match_dup 2) (const_int 0))
1347 (set (match_dup 0) (const_int 0)))
1348 (set (match_dup 0) (unspec:BI [(match_dup 0)] UNSPEC_PRED_REL_MUTEX))]
1349 "operands[3] = gen_rtx_REG (CCImode, REGNO (operands[1]));
1350 operands[4] = gen_rtx_REG (CCImode, REGNO (operands[2]));")
1353 [(set (match_operand:BI 0 "register_operand" "")
1354 (not:BI (match_operand:BI 1 "register_operand" "")))
1355 (clobber (match_scratch:BI 2 ""))]
1357 && GET_CODE (operands[0]) == REG && PR_REGNO_P (REGNO (operands[0]))
1358 && GET_CODE (operands[1]) == REG && PR_REGNO_P (REGNO (operands[1]))
1359 && ! rtx_equal_p (operands[0], operands[1])"
1360 [(cond_exec (ne (match_dup 1) (const_int 0))
1361 (set (match_dup 0) (const_int 0)))
1362 (cond_exec (eq (match_dup 1) (const_int 0))
1363 (set (match_dup 0) (const_int 1)))
1364 (set (match_dup 0) (unspec:BI [(match_dup 0)] UNSPEC_PRED_REL_MUTEX))]
1367 (define_insn "*cmpsi_and_0"
1368 [(set (match_operand:BI 0 "register_operand" "=c")
1369 (and:BI (match_operator:BI 4 "predicate_operator"
1370 [(match_operand:SI 2 "gr_reg_or_0_operand" "rO")
1371 (match_operand:SI 3 "gr_reg_or_8bit_operand" "rK")])
1372 (match_operand:BI 1 "register_operand" "0")))]
1374 "cmp4.%C4.and.orcm %0, %I0 = %3, %r2"
1375 [(set_attr "itanium_class" "icmp")])
1377 (define_insn "*cmpsi_and_1"
1378 [(set (match_operand:BI 0 "register_operand" "=c")
1379 (and:BI (match_operator:BI 3 "signed_inequality_operator"
1380 [(match_operand:SI 2 "gr_register_operand" "r")
1382 (match_operand:BI 1 "register_operand" "0")))]
1384 "cmp4.%C3.and.orcm %0, %I0 = r0, %2"
1385 [(set_attr "itanium_class" "icmp")])
1387 (define_insn "*cmpsi_andnot_0"
1388 [(set (match_operand:BI 0 "register_operand" "=c")
1389 (and:BI (not:BI (match_operator:BI 4 "predicate_operator"
1390 [(match_operand:SI 2 "gr_reg_or_0_operand" "rO")
1391 (match_operand:SI 3 "gr_reg_or_8bit_operand" "rK")]))
1392 (match_operand:BI 1 "register_operand" "0")))]
1394 "cmp4.%C4.or.andcm %I0, %0 = %3, %r2"
1395 [(set_attr "itanium_class" "icmp")])
1397 (define_insn "*cmpsi_andnot_1"
1398 [(set (match_operand:BI 0 "register_operand" "=c")
1399 (and:BI (not:BI (match_operator:BI 3 "signed_inequality_operator"
1400 [(match_operand:SI 2 "gr_register_operand" "r")
1402 (match_operand:BI 1 "register_operand" "0")))]
1404 "cmp4.%C3.or.andcm %I0, %0 = r0, %2"
1405 [(set_attr "itanium_class" "icmp")])
1407 (define_insn "*cmpdi_and_0"
1408 [(set (match_operand:BI 0 "register_operand" "=c")
1409 (and:BI (match_operator:BI 4 "predicate_operator"
1410 [(match_operand:DI 2 "gr_register_operand" "r")
1411 (match_operand:DI 3 "gr_reg_or_8bit_operand" "rK")])
1412 (match_operand:BI 1 "register_operand" "0")))]
1414 "cmp.%C4.and.orcm %0, %I0 = %3, %2"
1415 [(set_attr "itanium_class" "icmp")])
1417 (define_insn "*cmpdi_and_1"
1418 [(set (match_operand:BI 0 "register_operand" "=c")
1419 (and:BI (match_operator:BI 3 "signed_inequality_operator"
1420 [(match_operand:DI 2 "gr_register_operand" "r")
1422 (match_operand:BI 1 "register_operand" "0")))]
1424 "cmp.%C3.and.orcm %0, %I0 = r0, %2"
1425 [(set_attr "itanium_class" "icmp")])
1427 (define_insn "*cmpdi_andnot_0"
1428 [(set (match_operand:BI 0 "register_operand" "=c")
1429 (and:BI (not:BI (match_operator:BI 4 "predicate_operator"
1430 [(match_operand:DI 2 "gr_register_operand" "r")
1431 (match_operand:DI 3 "gr_reg_or_8bit_operand" "rK")]))
1432 (match_operand:BI 1 "register_operand" "0")))]
1434 "cmp.%C4.or.andcm %I0, %0 = %3, %2"
1435 [(set_attr "itanium_class" "icmp")])
1437 (define_insn "*cmpdi_andnot_1"
1438 [(set (match_operand:BI 0 "register_operand" "=c")
1439 (and:BI (not:BI (match_operator:BI 3 "signed_inequality_operator"
1440 [(match_operand:DI 2 "gr_register_operand" "r")
1442 (match_operand:BI 1 "register_operand" "0")))]
1444 "cmp.%C3.or.andcm %I0, %0 = r0, %2"
1445 [(set_attr "itanium_class" "icmp")])
1447 (define_insn "*tbit_and_0"
1448 [(set (match_operand:BI 0 "register_operand" "=c")
1449 (and:BI (ne:BI (and:DI (match_operand:DI 1 "gr_register_operand" "r")
1452 (match_operand:BI 2 "register_operand" "0")))]
1454 "tbit.nz.and.orcm %0, %I0 = %1, 0"
1455 [(set_attr "itanium_class" "tbit")])
1457 (define_insn "*tbit_and_1"
1458 [(set (match_operand:BI 0 "register_operand" "=c")
1459 (and:BI (eq:BI (and:DI (match_operand:DI 1 "gr_register_operand" "r")
1462 (match_operand:BI 2 "register_operand" "0")))]
1464 "tbit.z.and.orcm %0, %I0 = %1, 0"
1465 [(set_attr "itanium_class" "tbit")])
1467 (define_insn "*tbit_and_2"
1468 [(set (match_operand:BI 0 "register_operand" "=c")
1469 (and:BI (ne:BI (zero_extract:DI
1470 (match_operand:DI 1 "gr_register_operand" "r")
1472 (match_operand:DI 2 "const_int_operand" "n"))
1474 (match_operand:BI 3 "register_operand" "0")))]
1476 "tbit.nz.and.orcm %0, %I0 = %1, %2"
1477 [(set_attr "itanium_class" "tbit")])
1479 (define_insn "*tbit_and_3"
1480 [(set (match_operand:BI 0 "register_operand" "=c")
1481 (and:BI (eq:BI (zero_extract:DI
1482 (match_operand:DI 1 "gr_register_operand" "r")
1484 (match_operand:DI 2 "const_int_operand" "n"))
1486 (match_operand:BI 3 "register_operand" "0")))]
1488 "tbit.z.and.orcm %0, %I0 = %1, %2"
1489 [(set_attr "itanium_class" "tbit")])
1491 (define_insn "*cmpsi_or_0"
1492 [(set (match_operand:BI 0 "register_operand" "=c")
1493 (ior:BI (match_operator:BI 4 "predicate_operator"
1494 [(match_operand:SI 2 "gr_reg_or_0_operand" "rO")
1495 (match_operand:SI 3 "gr_reg_or_8bit_operand" "rK")])
1496 (match_operand:BI 1 "register_operand" "0")))]
1498 "cmp4.%C4.or.andcm %0, %I0 = %3, %r2"
1499 [(set_attr "itanium_class" "icmp")])
1501 (define_insn "*cmpsi_or_1"
1502 [(set (match_operand:BI 0 "register_operand" "=c")
1503 (ior:BI (match_operator:BI 3 "signed_inequality_operator"
1504 [(match_operand:SI 2 "gr_register_operand" "r")
1506 (match_operand:BI 1 "register_operand" "0")))]
1508 "cmp4.%C3.or.andcm %0, %I0 = r0, %2"
1509 [(set_attr "itanium_class" "icmp")])
1511 (define_insn "*cmpsi_orcm_0"
1512 [(set (match_operand:BI 0 "register_operand" "=c")
1513 (ior:BI (not:BI (match_operator:BI 4 "predicate_operator"
1514 [(match_operand:SI 2 "gr_reg_or_0_operand" "rO")
1515 (match_operand:SI 3 "gr_reg_or_8bit_operand" "rK")]))
1516 (match_operand:BI 1 "register_operand" "0")))]
1518 "cmp4.%C4.and.orcm %I0, %0 = %3, %r2"
1519 [(set_attr "itanium_class" "icmp")])
1521 (define_insn "*cmpsi_orcm_1"
1522 [(set (match_operand:BI 0 "register_operand" "=c")
1523 (ior:BI (not:BI (match_operator:BI 3 "signed_inequality_operator"
1524 [(match_operand:SI 2 "gr_register_operand" "r")
1526 (match_operand:BI 1 "register_operand" "0")))]
1528 "cmp4.%C3.and.orcm %I0, %0 = r0, %2"
1529 [(set_attr "itanium_class" "icmp")])
1531 (define_insn "*cmpdi_or_0"
1532 [(set (match_operand:BI 0 "register_operand" "=c")
1533 (ior:BI (match_operator:BI 4 "predicate_operator"
1534 [(match_operand:DI 2 "gr_register_operand" "r")
1535 (match_operand:DI 3 "gr_reg_or_8bit_operand" "rK")])
1536 (match_operand:BI 1 "register_operand" "0")))]
1538 "cmp.%C4.or.andcm %0, %I0 = %3, %2"
1539 [(set_attr "itanium_class" "icmp")])
1541 (define_insn "*cmpdi_or_1"
1542 [(set (match_operand:BI 0 "register_operand" "=c")
1543 (ior:BI (match_operator:BI 3 "signed_inequality_operator"
1544 [(match_operand:DI 2 "gr_register_operand" "r")
1546 (match_operand:BI 1 "register_operand" "0")))]
1548 "cmp.%C3.or.andcm %0, %I0 = r0, %2"
1549 [(set_attr "itanium_class" "icmp")])
1551 (define_insn "*cmpdi_orcm_0"
1552 [(set (match_operand:BI 0 "register_operand" "=c")
1553 (ior:BI (not:BI (match_operator:BI 4 "predicate_operator"
1554 [(match_operand:DI 2 "gr_register_operand" "r")
1555 (match_operand:DI 3 "gr_reg_or_8bit_operand" "rK")]))
1556 (match_operand:BI 1 "register_operand" "0")))]
1558 "cmp.%C4.and.orcm %I0, %0 = %3, %2"
1559 [(set_attr "itanium_class" "icmp")])
1561 (define_insn "*cmpdi_orcm_1"
1562 [(set (match_operand:BI 0 "register_operand" "=c")
1563 (ior:BI (not:BI (match_operator:BI 3 "signed_inequality_operator"
1564 [(match_operand:DI 2 "gr_register_operand" "r")
1566 (match_operand:BI 1 "register_operand" "0")))]
1568 "cmp.%C3.and.orcm %I0, %0 = r0, %2"
1569 [(set_attr "itanium_class" "icmp")])
1571 (define_insn "*tbit_or_0"
1572 [(set (match_operand:BI 0 "register_operand" "=c")
1573 (ior:BI (ne:BI (and:DI (match_operand:DI 1 "gr_register_operand" "r")
1576 (match_operand:BI 2 "register_operand" "0")))]
1578 "tbit.nz.or.andcm %0, %I0 = %1, 0"
1579 [(set_attr "itanium_class" "tbit")])
1581 (define_insn "*tbit_or_1"
1582 [(set (match_operand:BI 0 "register_operand" "=c")
1583 (ior:BI (eq:BI (and:DI (match_operand:DI 1 "gr_register_operand" "r")
1586 (match_operand:BI 2 "register_operand" "0")))]
1588 "tbit.z.or.andcm %0, %I0 = %1, 0"
1589 [(set_attr "itanium_class" "tbit")])
1591 (define_insn "*tbit_or_2"
1592 [(set (match_operand:BI 0 "register_operand" "=c")
1593 (ior:BI (ne:BI (zero_extract:DI
1594 (match_operand:DI 1 "gr_register_operand" "r")
1596 (match_operand:DI 2 "const_int_operand" "n"))
1598 (match_operand:BI 3 "register_operand" "0")))]
1600 "tbit.nz.or.andcm %0, %I0 = %1, %2"
1601 [(set_attr "itanium_class" "tbit")])
1603 (define_insn "*tbit_or_3"
1604 [(set (match_operand:BI 0 "register_operand" "=c")
1605 (ior:BI (eq:BI (zero_extract:DI
1606 (match_operand:DI 1 "gr_register_operand" "r")
1608 (match_operand:DI 2 "const_int_operand" "n"))
1610 (match_operand:BI 3 "register_operand" "0")))]
1612 "tbit.z.or.andcm %0, %I0 = %1, %2"
1613 [(set_attr "itanium_class" "tbit")])
1615 ;; Transform test of and/or of setcc into parallel comparisons.
1618 [(set (match_operand:BI 0 "register_operand" "")
1619 (ne:BI (and:DI (ne:DI (match_operand:BI 2 "register_operand" "")
1621 (match_operand:DI 3 "register_operand" ""))
1625 (and:BI (ne:BI (and:DI (match_dup 3) (const_int 1)) (const_int 0))
1630 [(set (match_operand:BI 0 "register_operand" "")
1631 (eq:BI (and:DI (ne:DI (match_operand:BI 2 "register_operand" "")
1633 (match_operand:DI 3 "register_operand" ""))
1637 (and:BI (ne:BI (and:DI (match_dup 3) (const_int 1)) (const_int 0))
1639 (parallel [(set (match_dup 0) (not:BI (match_dup 0)))
1640 (clobber (scratch))])]
1644 [(set (match_operand:BI 0 "register_operand" "")
1645 (ne:BI (ior:DI (ne:DI (match_operand:BI 2 "register_operand" "")
1647 (match_operand:DI 3 "register_operand" ""))
1651 (ior:BI (ne:BI (match_dup 3) (const_int 0))
1656 [(set (match_operand:BI 0 "register_operand" "")
1657 (eq:BI (ior:DI (ne:DI (match_operand:BI 2 "register_operand" "")
1659 (match_operand:DI 3 "register_operand" ""))
1663 (ior:BI (ne:BI (match_dup 3) (const_int 0))
1665 (parallel [(set (match_dup 0) (not:BI (match_dup 0)))
1666 (clobber (scratch))])]
1669 ;; ??? Incredibly hackish. Either need four proper patterns with all
1670 ;; the alternatives, or rely on sched1 to split the insn and hope that
1671 ;; nothing bad happens to the comparisons in the meantime.
1673 ;; Alternately, adjust combine to allow 2->2 and 3->3 splits, assuming
1674 ;; that we're doing height reduction.
1676 ;(define_insn_and_split ""
1677 ; [(set (match_operand:BI 0 "register_operand" "=c")
1678 ; (and:BI (and:BI (match_operator:BI 1 "comparison_operator"
1679 ; [(match_operand 2 "" "")
1680 ; (match_operand 3 "" "")])
1681 ; (match_operator:BI 4 "comparison_operator"
1682 ; [(match_operand 5 "" "")
1683 ; (match_operand 6 "" "")]))
1685 ; "flag_schedule_insns"
1688 ; [(set (match_dup 0) (and:BI (match_dup 1) (match_dup 0)))
1689 ; (set (match_dup 0) (and:BI (match_dup 4) (match_dup 0)))]
1692 ;(define_insn_and_split ""
1693 ; [(set (match_operand:BI 0 "register_operand" "=c")
1694 ; (ior:BI (ior:BI (match_operator:BI 1 "comparison_operator"
1695 ; [(match_operand 2 "" "")
1696 ; (match_operand 3 "" "")])
1697 ; (match_operator:BI 4 "comparison_operator"
1698 ; [(match_operand 5 "" "")
1699 ; (match_operand 6 "" "")]))
1701 ; "flag_schedule_insns"
1704 ; [(set (match_dup 0) (ior:BI (match_dup 1) (match_dup 0)))
1705 ; (set (match_dup 0) (ior:BI (match_dup 4) (match_dup 0)))]
1709 ; [(set (match_operand:BI 0 "register_operand" "")
1710 ; (and:BI (and:BI (match_operator:BI 1 "comparison_operator"
1711 ; [(match_operand 2 "" "")
1712 ; (match_operand 3 "" "")])
1713 ; (match_operand:BI 7 "register_operand" ""))
1714 ; (and:BI (match_operator:BI 4 "comparison_operator"
1715 ; [(match_operand 5 "" "")
1716 ; (match_operand 6 "" "")])
1717 ; (match_operand:BI 8 "register_operand" ""))))]
1719 ; [(set (match_dup 0) (and:BI (match_dup 7) (match_dup 8)))
1720 ; (set (match_dup 0) (and:BI (and:BI (match_dup 1) (match_dup 4))
1725 ; [(set (match_operand:BI 0 "register_operand" "")
1726 ; (ior:BI (ior:BI (match_operator:BI 1 "comparison_operator"
1727 ; [(match_operand 2 "" "")
1728 ; (match_operand 3 "" "")])
1729 ; (match_operand:BI 7 "register_operand" ""))
1730 ; (ior:BI (match_operator:BI 4 "comparison_operator"
1731 ; [(match_operand 5 "" "")
1732 ; (match_operand 6 "" "")])
1733 ; (match_operand:BI 8 "register_operand" ""))))]
1735 ; [(set (match_dup 0) (ior:BI (match_dup 7) (match_dup 8)))
1736 ; (set (match_dup 0) (ior:BI (ior:BI (match_dup 1) (match_dup 4))
1740 ;; Try harder to avoid predicate copies by duplicating compares.
1741 ;; Note that we'll have already split the predicate copy, which
1742 ;; is kind of a pain, but oh well.
1745 [(set (match_operand:BI 0 "register_operand" "")
1746 (match_operand:BI 1 "comparison_operator" ""))
1747 (set (match_operand:CCI 2 "register_operand" "")
1748 (match_operand:CCI 3 "register_operand" ""))
1749 (set (match_operand:CCI 4 "register_operand" "")
1750 (match_operand:CCI 5 "register_operand" ""))
1751 (set (match_operand:BI 6 "register_operand" "")
1752 (unspec:BI [(match_dup 6)] UNSPEC_PRED_REL_MUTEX))]
1753 "REGNO (operands[3]) == REGNO (operands[0])
1754 && REGNO (operands[4]) == REGNO (operands[0]) + 1
1755 && REGNO (operands[4]) == REGNO (operands[2]) + 1
1756 && REGNO (operands[6]) == REGNO (operands[2])"
1757 [(set (match_dup 0) (match_dup 1))
1758 (set (match_dup 6) (match_dup 7))]
1759 "operands[7] = copy_rtx (operands[1]);")
1761 ;; ::::::::::::::::::::
1763 ;; :: 16 bit Integer arithmetic
1765 ;; ::::::::::::::::::::
1767 (define_insn "mulhi3"
1768 [(set (match_operand:HI 0 "gr_register_operand" "=r")
1769 (mult:HI (match_operand:HI 1 "gr_register_operand" "r")
1770 (match_operand:HI 2 "gr_register_operand" "r")))]
1772 "pmpy2.r %0 = %1, %2"
1773 [(set_attr "itanium_class" "mmmul")])
1776 ;; ::::::::::::::::::::
1778 ;; :: 32 bit Integer arithmetic
1780 ;; ::::::::::::::::::::
1782 (define_insn "addsi3"
1783 [(set (match_operand:SI 0 "gr_register_operand" "=r,r,r")
1784 (plus:SI (match_operand:SI 1 "gr_register_operand" "%r,r,a")
1785 (match_operand:SI 2 "gr_reg_or_22bit_operand" "r,I,J")))]
1791 [(set_attr "itanium_class" "ialu")])
1793 (define_insn "*addsi3_plus1"
1794 [(set (match_operand:SI 0 "gr_register_operand" "=r")
1795 (plus:SI (plus:SI (match_operand:SI 1 "gr_register_operand" "r")
1796 (match_operand:SI 2 "gr_register_operand" "r"))
1799 "add %0 = %1, %2, 1"
1800 [(set_attr "itanium_class" "ialu")])
1802 (define_insn "*addsi3_plus1_alt"
1803 [(set (match_operand:SI 0 "gr_register_operand" "=r")
1804 (plus:SI (mult:SI (match_operand:SI 1 "gr_register_operand" "r")
1808 "add %0 = %1, %1, 1"
1809 [(set_attr "itanium_class" "ialu")])
1811 (define_insn "*addsi3_shladd"
1812 [(set (match_operand:SI 0 "gr_register_operand" "=r")
1813 (plus:SI (mult:SI (match_operand:SI 1 "gr_register_operand" "r")
1814 (match_operand:SI 2 "shladd_operand" "n"))
1815 (match_operand:SI 3 "gr_register_operand" "r")))]
1817 "shladd %0 = %1, %S2, %3"
1818 [(set_attr "itanium_class" "ialu")])
1820 (define_insn "subsi3"
1821 [(set (match_operand:SI 0 "gr_register_operand" "=r")
1822 (minus:SI (match_operand:SI 1 "gr_reg_or_8bit_operand" "rK")
1823 (match_operand:SI 2 "gr_register_operand" "r")))]
1826 [(set_attr "itanium_class" "ialu")])
1828 (define_insn "*subsi3_minus1"
1829 [(set (match_operand:SI 0 "gr_register_operand" "=r")
1830 (plus:SI (not:SI (match_operand:SI 1 "gr_register_operand" "r"))
1831 (match_operand:SI 2 "gr_register_operand" "r")))]
1833 "sub %0 = %2, %1, 1"
1834 [(set_attr "itanium_class" "ialu")])
1836 ;; ??? Could add maddsi3 patterns patterned after the madddi3 patterns.
1838 (define_insn "mulsi3"
1839 [(set (match_operand:SI 0 "fr_register_operand" "=f")
1840 (mult:SI (match_operand:SI 1 "grfr_register_operand" "f")
1841 (match_operand:SI 2 "grfr_register_operand" "f")))]
1843 "xmpy.l %0 = %1, %2"
1844 [(set_attr "itanium_class" "xmpy")])
1846 (define_insn "maddsi4"
1847 [(set (match_operand:SI 0 "fr_register_operand" "=f")
1848 (plus:SI (mult:SI (match_operand:SI 1 "grfr_register_operand" "f")
1849 (match_operand:SI 2 "grfr_register_operand" "f"))
1850 (match_operand:SI 3 "grfr_register_operand" "f")))]
1852 "xma.l %0 = %1, %2, %3"
1853 [(set_attr "itanium_class" "xmpy")])
1855 (define_insn "negsi2"
1856 [(set (match_operand:SI 0 "gr_register_operand" "=r")
1857 (neg:SI (match_operand:SI 1 "gr_register_operand" "r")))]
1860 [(set_attr "itanium_class" "ialu")])
1862 (define_expand "abssi2"
1864 (ge:BI (match_operand:SI 1 "gr_register_operand" "") (const_int 0)))
1865 (set (match_operand:SI 0 "gr_register_operand" "")
1866 (if_then_else:SI (eq (match_dup 2) (const_int 0))
1867 (neg:SI (match_dup 1))
1870 { operands[2] = gen_reg_rtx (BImode); })
1872 (define_expand "sminsi3"
1874 (ge:BI (match_operand:SI 1 "gr_register_operand" "")
1875 (match_operand:SI 2 "gr_register_operand" "")))
1876 (set (match_operand:SI 0 "gr_register_operand" "")
1877 (if_then_else:SI (ne (match_dup 3) (const_int 0))
1878 (match_dup 2) (match_dup 1)))]
1880 { operands[3] = gen_reg_rtx (BImode); })
1882 (define_expand "smaxsi3"
1884 (ge:BI (match_operand:SI 1 "gr_register_operand" "")
1885 (match_operand:SI 2 "gr_register_operand" "")))
1886 (set (match_operand:SI 0 "gr_register_operand" "")
1887 (if_then_else:SI (ne (match_dup 3) (const_int 0))
1888 (match_dup 1) (match_dup 2)))]
1890 { operands[3] = gen_reg_rtx (BImode); })
1892 (define_expand "uminsi3"
1894 (geu:BI (match_operand:SI 1 "gr_register_operand" "")
1895 (match_operand:SI 2 "gr_register_operand" "")))
1896 (set (match_operand:SI 0 "gr_register_operand" "")
1897 (if_then_else:SI (ne (match_dup 3) (const_int 0))
1898 (match_dup 2) (match_dup 1)))]
1900 { operands[3] = gen_reg_rtx (BImode); })
1902 (define_expand "umaxsi3"
1904 (geu:BI (match_operand:SI 1 "gr_register_operand" "")
1905 (match_operand:SI 2 "gr_register_operand" "")))
1906 (set (match_operand:SI 0 "gr_register_operand" "")
1907 (if_then_else:SI (ne (match_dup 3) (const_int 0))
1908 (match_dup 1) (match_dup 2)))]
1910 { operands[3] = gen_reg_rtx (BImode); })
1912 (define_expand "divsi3"
1913 [(set (match_operand:SI 0 "register_operand" "")
1914 (div:SI (match_operand:SI 1 "general_operand" "")
1915 (match_operand:SI 2 "general_operand" "")))]
1916 "TARGET_INLINE_INT_DIV"
1918 rtx op1_xf, op2_xf, op0_xf, op0_di, twon34, twon34_exp;
1920 op0_xf = gen_reg_rtx (XFmode);
1921 op0_di = gen_reg_rtx (DImode);
1923 if (CONSTANT_P (operands[1]))
1924 operands[1] = force_reg (SImode, operands[1]);
1925 op1_xf = gen_reg_rtx (XFmode);
1926 expand_float (op1_xf, operands[1], 0);
1928 if (CONSTANT_P (operands[2]))
1929 operands[2] = force_reg (SImode, operands[2]);
1930 op2_xf = gen_reg_rtx (XFmode);
1931 expand_float (op2_xf, operands[2], 0);
1934 twon34_exp = gen_reg_rtx (DImode);
1935 emit_move_insn (twon34_exp, GEN_INT (65501));
1936 twon34 = gen_reg_rtx (XFmode);
1937 emit_insn (gen_setf_exp_xf (twon34, twon34_exp));
1939 emit_insn (gen_divsi3_internal (op0_xf, op1_xf, op2_xf, twon34));
1941 emit_insn (gen_fix_truncxfdi2_alts (op0_di, op0_xf, const1_rtx));
1942 emit_move_insn (operands[0], gen_lowpart (SImode, op0_di));
1946 (define_expand "modsi3"
1947 [(set (match_operand:SI 0 "register_operand" "")
1948 (mod:SI (match_operand:SI 1 "general_operand" "")
1949 (match_operand:SI 2 "general_operand" "")))]
1950 "TARGET_INLINE_INT_DIV"
1952 rtx op2_neg, op1_di, div;
1954 div = gen_reg_rtx (SImode);
1955 emit_insn (gen_divsi3 (div, operands[1], operands[2]));
1957 op2_neg = expand_unop (SImode, neg_optab, operands[2], NULL_RTX, 0);
1959 /* This is a trick to get us to reuse the value that we're sure to
1960 have already copied to the FP regs. */
1961 op1_di = gen_reg_rtx (DImode);
1962 convert_move (op1_di, operands[1], 0);
1964 emit_insn (gen_maddsi4 (operands[0], div, op2_neg,
1965 gen_lowpart (SImode, op1_di)));
1969 (define_expand "udivsi3"
1970 [(set (match_operand:SI 0 "register_operand" "")
1971 (udiv:SI (match_operand:SI 1 "general_operand" "")
1972 (match_operand:SI 2 "general_operand" "")))]
1973 "TARGET_INLINE_INT_DIV"
1975 rtx op1_xf, op2_xf, op0_xf, op0_di, twon34, twon34_exp;
1977 op0_xf = gen_reg_rtx (XFmode);
1978 op0_di = gen_reg_rtx (DImode);
1980 if (CONSTANT_P (operands[1]))
1981 operands[1] = force_reg (SImode, operands[1]);
1982 op1_xf = gen_reg_rtx (XFmode);
1983 expand_float (op1_xf, operands[1], 1);
1985 if (CONSTANT_P (operands[2]))
1986 operands[2] = force_reg (SImode, operands[2]);
1987 op2_xf = gen_reg_rtx (XFmode);
1988 expand_float (op2_xf, operands[2], 1);
1991 twon34_exp = gen_reg_rtx (DImode);
1992 emit_move_insn (twon34_exp, GEN_INT (65501));
1993 twon34 = gen_reg_rtx (XFmode);
1994 emit_insn (gen_setf_exp_xf (twon34, twon34_exp));
1996 emit_insn (gen_divsi3_internal (op0_xf, op1_xf, op2_xf, twon34));
1998 emit_insn (gen_fixuns_truncxfdi2_alts (op0_di, op0_xf, const1_rtx));
1999 emit_move_insn (operands[0], gen_lowpart (SImode, op0_di));
2003 (define_expand "umodsi3"
2004 [(set (match_operand:SI 0 "register_operand" "")
2005 (umod:SI (match_operand:SI 1 "general_operand" "")
2006 (match_operand:SI 2 "general_operand" "")))]
2007 "TARGET_INLINE_INT_DIV"
2009 rtx op2_neg, op1_di, div;
2011 div = gen_reg_rtx (SImode);
2012 emit_insn (gen_udivsi3 (div, operands[1], operands[2]));
2014 op2_neg = expand_unop (SImode, neg_optab, operands[2], NULL_RTX, 0);
2016 /* This is a trick to get us to reuse the value that we're sure to
2017 have already copied to the FP regs. */
2018 op1_di = gen_reg_rtx (DImode);
2019 convert_move (op1_di, operands[1], 1);
2021 emit_insn (gen_maddsi4 (operands[0], div, op2_neg,
2022 gen_lowpart (SImode, op1_di)));
2026 (define_insn_and_split "divsi3_internal"
2027 [(set (match_operand:XF 0 "fr_register_operand" "=&f")
2028 (float:XF (div:SI (match_operand:XF 1 "fr_register_operand" "f")
2029 (match_operand:XF 2 "fr_register_operand" "f"))))
2030 (clobber (match_scratch:XF 4 "=&f"))
2031 (clobber (match_scratch:XF 5 "=&f"))
2032 (clobber (match_scratch:BI 6 "=c"))
2033 (use (match_operand:XF 3 "fr_register_operand" "f"))]
2034 "TARGET_INLINE_INT_DIV"
2036 "&& reload_completed"
2037 [(parallel [(set (match_dup 0) (div:XF (const_int 1) (match_dup 2)))
2038 (set (match_dup 6) (unspec:BI [(match_dup 1) (match_dup 2)]
2039 UNSPEC_FR_RECIP_APPROX))
2040 (use (const_int 1))])
2041 (cond_exec (ne (match_dup 6) (const_int 0))
2042 (parallel [(set (match_dup 4) (mult:XF (match_dup 1) (match_dup 0)))
2043 (use (const_int 1))]))
2044 (cond_exec (ne (match_dup 6) (const_int 0))
2045 (parallel [(set (match_dup 5)
2046 (minus:XF (match_dup 7)
2047 (mult:XF (match_dup 2) (match_dup 0))))
2048 (use (const_int 1))]))
2049 (cond_exec (ne (match_dup 6) (const_int 0))
2050 (parallel [(set (match_dup 4)
2051 (plus:XF (mult:XF (match_dup 5) (match_dup 4))
2053 (use (const_int 1))]))
2054 (cond_exec (ne (match_dup 6) (const_int 0))
2055 (parallel [(set (match_dup 5)
2056 (plus:XF (mult:XF (match_dup 5) (match_dup 5))
2058 (use (const_int 1))]))
2059 (cond_exec (ne (match_dup 6) (const_int 0))
2060 (parallel [(set (match_dup 0)
2061 (plus:XF (mult:XF (match_dup 5) (match_dup 4))
2063 (use (const_int 1))]))
2065 "operands[7] = CONST1_RTX (XFmode);"
2066 [(set_attr "predicable" "no")])
2068 ;; ::::::::::::::::::::
2070 ;; :: 64 bit Integer arithmetic
2072 ;; ::::::::::::::::::::
2074 (define_insn "adddi3"
2075 [(set (match_operand:DI 0 "gr_register_operand" "=r,r,r")
2076 (plus:DI (match_operand:DI 1 "gr_register_operand" "%r,r,a")
2077 (match_operand:DI 2 "gr_reg_or_22bit_operand" "r,I,J")))]
2083 [(set_attr "itanium_class" "ialu")])
2085 (define_insn "*adddi3_plus1"
2086 [(set (match_operand:DI 0 "gr_register_operand" "=r")
2087 (plus:DI (plus:DI (match_operand:DI 1 "gr_register_operand" "r")
2088 (match_operand:DI 2 "gr_register_operand" "r"))
2091 "add %0 = %1, %2, 1"
2092 [(set_attr "itanium_class" "ialu")])
2094 ;; This has some of the same problems as shladd. We let the shladd
2095 ;; eliminator hack handle it, which results in the 1 being forced into
2096 ;; a register, but not more ugliness here.
2097 (define_insn "*adddi3_plus1_alt"
2098 [(set (match_operand:DI 0 "gr_register_operand" "=r")
2099 (plus:DI (mult:DI (match_operand:DI 1 "gr_register_operand" "r")
2103 "add %0 = %1, %1, 1"
2104 [(set_attr "itanium_class" "ialu")])
2106 (define_insn "subdi3"
2107 [(set (match_operand:DI 0 "gr_register_operand" "=r")
2108 (minus:DI (match_operand:DI 1 "gr_reg_or_8bit_operand" "rK")
2109 (match_operand:DI 2 "gr_register_operand" "r")))]
2112 [(set_attr "itanium_class" "ialu")])
2114 (define_insn "*subdi3_minus1"
2115 [(set (match_operand:DI 0 "gr_register_operand" "=r")
2116 (plus:DI (not:DI (match_operand:DI 1 "gr_register_operand" "r"))
2117 (match_operand:DI 2 "gr_register_operand" "r")))]
2119 "sub %0 = %2, %1, 1"
2120 [(set_attr "itanium_class" "ialu")])
2122 ;; ??? Use grfr instead of fr because of virtual register elimination
2123 ;; and silly test cases multiplying by the frame pointer.
2124 (define_insn "muldi3"
2125 [(set (match_operand:DI 0 "fr_register_operand" "=f")
2126 (mult:DI (match_operand:DI 1 "grfr_register_operand" "f")
2127 (match_operand:DI 2 "grfr_register_operand" "f")))]
2129 "xmpy.l %0 = %1, %2"
2130 [(set_attr "itanium_class" "xmpy")])
2132 ;; ??? If operand 3 is an eliminable reg, then register elimination causes the
2133 ;; same problem that we have with shladd below. Unfortunately, this case is
2134 ;; much harder to fix because the multiply puts the result in an FP register,
2135 ;; but the add needs inputs from a general register. We add a spurious clobber
2136 ;; here so that it will be present just in case register elimination gives us
2137 ;; the funny result.
2139 ;; ??? Maybe validate_changes should try adding match_scratch clobbers?
2141 ;; ??? Maybe we should change how adds are canonicalized.
2143 (define_insn "madddi4"
2144 [(set (match_operand:DI 0 "fr_register_operand" "=f")
2145 (plus:DI (mult:DI (match_operand:DI 1 "grfr_register_operand" "f")
2146 (match_operand:DI 2 "grfr_register_operand" "f"))
2147 (match_operand:DI 3 "grfr_register_operand" "f")))
2148 (clobber (match_scratch:DI 4 "=X"))]
2150 "xma.l %0 = %1, %2, %3"
2151 [(set_attr "itanium_class" "xmpy")])
2153 ;; This can be created by register elimination if operand3 of shladd is an
2154 ;; eliminable register or has reg_equiv_constant set.
2156 ;; We have to use nonmemory_operand for operand 4, to ensure that the
2157 ;; validate_changes call inside eliminate_regs will always succeed. If it
2158 ;; doesn't succeed, then this remain a madddi4 pattern, and will be reloaded
2161 (define_insn "*madddi4_elim"
2162 [(set (match_operand:DI 0 "register_operand" "=&r")
2163 (plus:DI (plus:DI (mult:DI (match_operand:DI 1 "register_operand" "f")
2164 (match_operand:DI 2 "register_operand" "f"))
2165 (match_operand:DI 3 "register_operand" "f"))
2166 (match_operand:DI 4 "nonmemory_operand" "rI")))
2167 (clobber (match_scratch:DI 5 "=f"))]
2168 "reload_in_progress"
2170 [(set_attr "itanium_class" "unknown")])
2173 [(set (match_operand:DI 0 "register_operand" "")
2174 (plus:DI (plus:DI (mult:DI (match_operand:DI 1 "register_operand" "")
2175 (match_operand:DI 2 "register_operand" ""))
2176 (match_operand:DI 3 "register_operand" ""))
2177 (match_operand:DI 4 "gr_reg_or_14bit_operand" "")))
2178 (clobber (match_scratch:DI 5 ""))]
2180 [(parallel [(set (match_dup 5) (plus:DI (mult:DI (match_dup 1) (match_dup 2))
2182 (clobber (match_dup 0))])
2183 (set (match_dup 0) (match_dup 5))
2184 (set (match_dup 0) (plus:DI (match_dup 0) (match_dup 4)))]
2187 ;; ??? There are highpart multiply and add instructions, but we have no way
2188 ;; to generate them.
2190 (define_insn "smuldi3_highpart"
2191 [(set (match_operand:DI 0 "fr_register_operand" "=f")
2194 (mult:TI (sign_extend:TI
2195 (match_operand:DI 1 "fr_register_operand" "f"))
2197 (match_operand:DI 2 "fr_register_operand" "f")))
2200 "xmpy.h %0 = %1, %2"
2201 [(set_attr "itanium_class" "xmpy")])
2203 (define_insn "umuldi3_highpart"
2204 [(set (match_operand:DI 0 "fr_register_operand" "=f")
2207 (mult:TI (zero_extend:TI
2208 (match_operand:DI 1 "fr_register_operand" "f"))
2210 (match_operand:DI 2 "fr_register_operand" "f")))
2213 "xmpy.hu %0 = %1, %2"
2214 [(set_attr "itanium_class" "xmpy")])
2216 (define_insn "negdi2"
2217 [(set (match_operand:DI 0 "gr_register_operand" "=r")
2218 (neg:DI (match_operand:DI 1 "gr_register_operand" "r")))]
2221 [(set_attr "itanium_class" "ialu")])
2223 (define_expand "absdi2"
2225 (ge:BI (match_operand:DI 1 "gr_register_operand" "") (const_int 0)))
2226 (set (match_operand:DI 0 "gr_register_operand" "")
2227 (if_then_else:DI (eq (match_dup 2) (const_int 0))
2228 (neg:DI (match_dup 1))
2231 { operands[2] = gen_reg_rtx (BImode); })
2233 (define_expand "smindi3"
2235 (ge:BI (match_operand:DI 1 "gr_register_operand" "")
2236 (match_operand:DI 2 "gr_register_operand" "")))
2237 (set (match_operand:DI 0 "gr_register_operand" "")
2238 (if_then_else:DI (ne (match_dup 3) (const_int 0))
2239 (match_dup 2) (match_dup 1)))]
2241 { operands[3] = gen_reg_rtx (BImode); })
2243 (define_expand "smaxdi3"
2245 (ge:BI (match_operand:DI 1 "gr_register_operand" "")
2246 (match_operand:DI 2 "gr_register_operand" "")))
2247 (set (match_operand:DI 0 "gr_register_operand" "")
2248 (if_then_else:DI (ne (match_dup 3) (const_int 0))
2249 (match_dup 1) (match_dup 2)))]
2251 { operands[3] = gen_reg_rtx (BImode); })
2253 (define_expand "umindi3"
2255 (geu:BI (match_operand:DI 1 "gr_register_operand" "")
2256 (match_operand:DI 2 "gr_register_operand" "")))
2257 (set (match_operand:DI 0 "gr_register_operand" "")
2258 (if_then_else:DI (ne (match_dup 3) (const_int 0))
2259 (match_dup 2) (match_dup 1)))]
2261 { operands[3] = gen_reg_rtx (BImode); })
2263 (define_expand "umaxdi3"
2265 (geu:BI (match_operand:DI 1 "gr_register_operand" "")
2266 (match_operand:DI 2 "gr_register_operand" "")))
2267 (set (match_operand:DI 0 "gr_register_operand" "")
2268 (if_then_else:DI (ne (match_dup 3) (const_int 0))
2269 (match_dup 1) (match_dup 2)))]
2271 { operands[3] = gen_reg_rtx (BImode); })
2273 (define_expand "ffsdi2"
2275 (eq:BI (match_operand:DI 1 "gr_register_operand" "") (const_int 0)))
2276 (set (match_dup 2) (plus:DI (match_dup 1) (const_int -1)))
2277 (set (match_dup 5) (const_int 0))
2278 (set (match_dup 3) (xor:DI (match_dup 1) (match_dup 2)))
2279 (set (match_dup 4) (popcount:DI (match_dup 3)))
2280 (set (match_operand:DI 0 "gr_register_operand" "")
2281 (if_then_else:DI (ne (match_dup 6) (const_int 0))
2282 (match_dup 5) (match_dup 4)))]
2285 operands[2] = gen_reg_rtx (DImode);
2286 operands[3] = gen_reg_rtx (DImode);
2287 operands[4] = gen_reg_rtx (DImode);
2288 operands[5] = gen_reg_rtx (DImode);
2289 operands[6] = gen_reg_rtx (BImode);
2292 (define_expand "ctzdi2"
2293 [(set (match_dup 2) (plus:DI (match_operand:DI 1 "gr_register_operand" "")
2295 (set (match_dup 3) (not:DI (match_dup 1)))
2296 (set (match_dup 4) (and:DI (match_dup 2) (match_dup 3)))
2297 (set (match_operand:DI 0 "gr_register_operand" "")
2298 (popcount:DI (match_dup 4)))]
2301 operands[2] = gen_reg_rtx (DImode);
2302 operands[3] = gen_reg_rtx (DImode);
2303 operands[4] = gen_reg_rtx (DImode);
2306 ;; Note the computation here is op0 = 63 - (exp - 0xffff).
2307 (define_expand "clzdi2"
2309 (unsigned_float:XF (match_operand:DI 1 "fr_register_operand" "")))
2311 (unspec:DI [(match_dup 2)] UNSPEC_GETF_EXP))
2312 (set (match_dup 4) (const_int 65598))
2313 (set (match_operand:DI 0 "gr_register_operand" "")
2314 (minus:DI (match_dup 4) (match_dup 3)))]
2317 operands[2] = gen_reg_rtx (XFmode);
2318 operands[3] = gen_reg_rtx (DImode);
2319 operands[4] = gen_reg_rtx (DImode);
2322 (define_insn "popcountdi2"
2323 [(set (match_operand:DI 0 "gr_register_operand" "=r")
2324 (popcount:DI (match_operand:DI 1 "gr_register_operand" "r")))]
2327 [(set_attr "itanium_class" "mmmul")])
2329 (define_insn "*getf_exp_xf"
2330 [(set (match_operand:DI 0 "gr_register_operand" "=r")
2331 (unspec:DI [(match_operand:XF 1 "fr_register_operand" "f")]
2335 [(set_attr "itanium_class" "frfr")])
2337 (define_expand "divdi3"
2338 [(set (match_operand:DI 0 "register_operand" "")
2339 (div:DI (match_operand:DI 1 "general_operand" "")
2340 (match_operand:DI 2 "general_operand" "")))]
2341 "TARGET_INLINE_INT_DIV"
2343 rtx op1_xf, op2_xf, op0_xf;
2345 op0_xf = gen_reg_rtx (XFmode);
2347 if (CONSTANT_P (operands[1]))
2348 operands[1] = force_reg (DImode, operands[1]);
2349 op1_xf = gen_reg_rtx (XFmode);
2350 expand_float (op1_xf, operands[1], 0);
2352 if (CONSTANT_P (operands[2]))
2353 operands[2] = force_reg (DImode, operands[2]);
2354 op2_xf = gen_reg_rtx (XFmode);
2355 expand_float (op2_xf, operands[2], 0);
2357 if (TARGET_INLINE_INT_DIV_LAT)
2358 emit_insn (gen_divdi3_internal_lat (op0_xf, op1_xf, op2_xf));
2360 emit_insn (gen_divdi3_internal_thr (op0_xf, op1_xf, op2_xf));
2362 emit_insn (gen_fix_truncxfdi2_alts (operands[0], op0_xf, const1_rtx));
2366 (define_expand "moddi3"
2367 [(set (match_operand:DI 0 "register_operand" "")
2368 (mod:SI (match_operand:DI 1 "general_operand" "")
2369 (match_operand:DI 2 "general_operand" "")))]
2370 "TARGET_INLINE_INT_DIV"
2374 div = gen_reg_rtx (DImode);
2375 emit_insn (gen_divdi3 (div, operands[1], operands[2]));
2377 op2_neg = expand_unop (DImode, neg_optab, operands[2], NULL_RTX, 0);
2379 emit_insn (gen_madddi4 (operands[0], div, op2_neg, operands[1]));
2383 (define_expand "udivdi3"
2384 [(set (match_operand:DI 0 "register_operand" "")
2385 (udiv:DI (match_operand:DI 1 "general_operand" "")
2386 (match_operand:DI 2 "general_operand" "")))]
2387 "TARGET_INLINE_INT_DIV"
2389 rtx op1_xf, op2_xf, op0_xf;
2391 op0_xf = gen_reg_rtx (XFmode);
2393 if (CONSTANT_P (operands[1]))
2394 operands[1] = force_reg (DImode, operands[1]);
2395 op1_xf = gen_reg_rtx (XFmode);
2396 expand_float (op1_xf, operands[1], 1);
2398 if (CONSTANT_P (operands[2]))
2399 operands[2] = force_reg (DImode, operands[2]);
2400 op2_xf = gen_reg_rtx (XFmode);
2401 expand_float (op2_xf, operands[2], 1);
2403 if (TARGET_INLINE_INT_DIV_LAT)
2404 emit_insn (gen_divdi3_internal_lat (op0_xf, op1_xf, op2_xf));
2406 emit_insn (gen_divdi3_internal_thr (op0_xf, op1_xf, op2_xf));
2408 emit_insn (gen_fixuns_truncxfdi2_alts (operands[0], op0_xf, const1_rtx));
2412 (define_expand "umoddi3"
2413 [(set (match_operand:DI 0 "register_operand" "")
2414 (umod:DI (match_operand:DI 1 "general_operand" "")
2415 (match_operand:DI 2 "general_operand" "")))]
2416 "TARGET_INLINE_INT_DIV"
2420 div = gen_reg_rtx (DImode);
2421 emit_insn (gen_udivdi3 (div, operands[1], operands[2]));
2423 op2_neg = expand_unop (DImode, neg_optab, operands[2], NULL_RTX, 0);
2425 emit_insn (gen_madddi4 (operands[0], div, op2_neg, operands[1]));
2429 (define_insn_and_split "divdi3_internal_lat"
2430 [(set (match_operand:XF 0 "fr_register_operand" "=&f")
2431 (float:XF (div:SI (match_operand:XF 1 "fr_register_operand" "f")
2432 (match_operand:XF 2 "fr_register_operand" "f"))))
2433 (clobber (match_scratch:XF 3 "=&f"))
2434 (clobber (match_scratch:XF 4 "=&f"))
2435 (clobber (match_scratch:XF 5 "=&f"))
2436 (clobber (match_scratch:BI 6 "=c"))]
2437 "TARGET_INLINE_INT_DIV_LAT"
2439 "&& reload_completed"
2440 [(parallel [(set (match_dup 0) (div:XF (const_int 1) (match_dup 2)))
2441 (set (match_dup 6) (unspec:BI [(match_dup 1) (match_dup 2)]
2442 UNSPEC_FR_RECIP_APPROX))
2443 (use (const_int 1))])
2444 (cond_exec (ne (match_dup 6) (const_int 0))
2445 (parallel [(set (match_dup 3)
2446 (minus:XF (match_dup 7)
2447 (mult:XF (match_dup 2) (match_dup 0))))
2448 (use (const_int 1))]))
2449 (cond_exec (ne (match_dup 6) (const_int 0))
2450 (parallel [(set (match_dup 4) (mult:XF (match_dup 1) (match_dup 0)))
2451 (use (const_int 1))]))
2452 (cond_exec (ne (match_dup 6) (const_int 0))
2453 (parallel [(set (match_dup 5) (mult:XF (match_dup 3) (match_dup 3)))
2454 (use (const_int 1))]))
2455 (cond_exec (ne (match_dup 6) (const_int 0))
2456 (parallel [(set (match_dup 4)
2457 (plus:XF (mult:XF (match_dup 3) (match_dup 4))
2459 (use (const_int 1))]))
2460 (cond_exec (ne (match_dup 6) (const_int 0))
2461 (parallel [(set (match_dup 0)
2462 (plus:XF (mult:XF (match_dup 3) (match_dup 0))
2464 (use (const_int 1))]))
2465 (cond_exec (ne (match_dup 6) (const_int 0))
2466 (parallel [(set (match_dup 3)
2467 (plus:XF (mult:XF (match_dup 5) (match_dup 4))
2469 (use (const_int 1))]))
2470 (cond_exec (ne (match_dup 6) (const_int 0))
2471 (parallel [(set (match_dup 0)
2472 (plus:XF (mult:XF (match_dup 5) (match_dup 0))
2474 (use (const_int 1))]))
2475 (cond_exec (ne (match_dup 6) (const_int 0))
2476 (parallel [(set (match_dup 4)
2477 (minus:XF (match_dup 1)
2478 (mult:XF (match_dup 2) (match_dup 3))))
2479 (use (const_int 1))]))
2480 (cond_exec (ne (match_dup 6) (const_int 0))
2481 (parallel [(set (match_dup 0)
2482 (plus:XF (mult:XF (match_dup 4) (match_dup 0))
2484 (use (const_int 1))]))
2486 "operands[7] = CONST1_RTX (XFmode);"
2487 [(set_attr "predicable" "no")])
2489 (define_insn_and_split "divdi3_internal_thr"
2490 [(set (match_operand:XF 0 "fr_register_operand" "=&f")
2491 (float:XF (div:SI (match_operand:XF 1 "fr_register_operand" "f")
2492 (match_operand:XF 2 "fr_register_operand" "f"))))
2493 (clobber (match_scratch:XF 3 "=&f"))
2494 (clobber (match_scratch:XF 4 "=f"))
2495 (clobber (match_scratch:BI 5 "=c"))]
2496 "TARGET_INLINE_INT_DIV_THR"
2498 "&& reload_completed"
2499 [(parallel [(set (match_dup 0) (div:XF (const_int 1) (match_dup 2)))
2500 (set (match_dup 5) (unspec:BI [(match_dup 1) (match_dup 2)]
2501 UNSPEC_FR_RECIP_APPROX))
2502 (use (const_int 1))])
2503 (cond_exec (ne (match_dup 5) (const_int 0))
2504 (parallel [(set (match_dup 3)
2505 (minus:XF (match_dup 6)
2506 (mult:XF (match_dup 2) (match_dup 0))))
2507 (use (const_int 1))]))
2508 (cond_exec (ne (match_dup 5) (const_int 0))
2509 (parallel [(set (match_dup 0)
2510 (plus:XF (mult:XF (match_dup 3) (match_dup 0))
2512 (use (const_int 1))]))
2513 (cond_exec (ne (match_dup 5) (const_int 0))
2514 (parallel [(set (match_dup 3) (mult:XF (match_dup 3) (match_dup 3)))
2515 (use (const_int 1))]))
2516 (cond_exec (ne (match_dup 5) (const_int 0))
2517 (parallel [(set (match_dup 0)
2518 (plus:XF (mult:XF (match_dup 3) (match_dup 0))
2520 (use (const_int 1))]))
2521 (cond_exec (ne (match_dup 5) (const_int 0))
2522 (parallel [(set (match_dup 3) (mult:XF (match_dup 0) (match_dup 1)))
2523 (use (const_int 1))]))
2524 (cond_exec (ne (match_dup 5) (const_int 0))
2525 (parallel [(set (match_dup 4)
2526 (minus:XF (match_dup 1)
2527 (mult:XF (match_dup 2) (match_dup 3))))
2528 (use (const_int 1))]))
2529 (cond_exec (ne (match_dup 5) (const_int 0))
2530 (parallel [(set (match_dup 0)
2531 (plus:XF (mult:XF (match_dup 4) (match_dup 0))
2533 (use (const_int 1))]))
2535 "operands[6] = CONST1_RTX (XFmode);"
2536 [(set_attr "predicable" "no")])
2538 ;; ::::::::::::::::::::
2540 ;; :: 32 bit floating point arithmetic
2542 ;; ::::::::::::::::::::
2544 (define_insn "addsf3"
2545 [(set (match_operand:SF 0 "fr_register_operand" "=f")
2546 (plus:SF (match_operand:SF 1 "fr_register_operand" "%f")
2547 (match_operand:SF 2 "fr_reg_or_fp01_operand" "fG")))]
2549 "fadd.s %0 = %1, %F2"
2550 [(set_attr "itanium_class" "fmac")])
2552 (define_insn "subsf3"
2553 [(set (match_operand:SF 0 "fr_register_operand" "=f")
2554 (minus:SF (match_operand:SF 1 "fr_reg_or_fp01_operand" "fG")
2555 (match_operand:SF 2 "fr_reg_or_fp01_operand" "fG")))]
2557 "fsub.s %0 = %F1, %F2"
2558 [(set_attr "itanium_class" "fmac")])
2560 (define_insn "mulsf3"
2561 [(set (match_operand:SF 0 "fr_register_operand" "=f")
2562 (mult:SF (match_operand:SF 1 "fr_register_operand" "%f")
2563 (match_operand:SF 2 "fr_register_operand" "f")))]
2565 "fmpy.s %0 = %1, %2"
2566 [(set_attr "itanium_class" "fmac")])
2568 (define_insn "abssf2"
2569 [(set (match_operand:SF 0 "fr_register_operand" "=f")
2570 (abs:SF (match_operand:SF 1 "fr_register_operand" "f")))]
2573 [(set_attr "itanium_class" "fmisc")])
2575 (define_insn "negsf2"
2576 [(set (match_operand:SF 0 "fr_register_operand" "=f")
2577 (neg:SF (match_operand:SF 1 "fr_register_operand" "f")))]
2580 [(set_attr "itanium_class" "fmisc")])
2582 (define_insn "*nabssf2"
2583 [(set (match_operand:SF 0 "fr_register_operand" "=f")
2584 (neg:SF (abs:SF (match_operand:SF 1 "fr_register_operand" "f"))))]
2587 [(set_attr "itanium_class" "fmisc")])
2589 (define_insn "minsf3"
2590 [(set (match_operand:SF 0 "fr_register_operand" "=f")
2591 (smin:SF (match_operand:SF 1 "fr_register_operand" "f")
2592 (match_operand:SF 2 "fr_reg_or_fp01_operand" "fG")))]
2595 [(set_attr "itanium_class" "fmisc")])
2597 (define_insn "maxsf3"
2598 [(set (match_operand:SF 0 "fr_register_operand" "=f")
2599 (smax:SF (match_operand:SF 1 "fr_register_operand" "f")
2600 (match_operand:SF 2 "fr_reg_or_fp01_operand" "fG")))]
2603 [(set_attr "itanium_class" "fmisc")])
2605 (define_insn "*maddsf4"
2606 [(set (match_operand:SF 0 "fr_register_operand" "=f")
2607 (plus:SF (mult:SF (match_operand:SF 1 "fr_register_operand" "f")
2608 (match_operand:SF 2 "fr_register_operand" "f"))
2609 (match_operand:SF 3 "fr_reg_or_fp01_operand" "fG")))]
2611 "fma.s %0 = %1, %2, %F3"
2612 [(set_attr "itanium_class" "fmac")])
2614 (define_insn "*msubsf4"
2615 [(set (match_operand:SF 0 "fr_register_operand" "=f")
2616 (minus:SF (mult:SF (match_operand:SF 1 "fr_register_operand" "f")
2617 (match_operand:SF 2 "fr_register_operand" "f"))
2618 (match_operand:SF 3 "fr_reg_or_fp01_operand" "fG")))]
2620 "fms.s %0 = %1, %2, %F3"
2621 [(set_attr "itanium_class" "fmac")])
2623 (define_insn "*nmulsf3"
2624 [(set (match_operand:SF 0 "fr_register_operand" "=f")
2625 (neg:SF (mult:SF (match_operand:SF 1 "fr_register_operand" "f")
2626 (match_operand:SF 2 "fr_register_operand" "f"))))]
2628 "fnmpy.s %0 = %1, %2"
2629 [(set_attr "itanium_class" "fmac")])
2631 (define_insn "*nmaddsf4"
2632 [(set (match_operand:SF 0 "fr_register_operand" "=f")
2633 (minus:SF (match_operand:SF 3 "fr_reg_or_fp01_operand" "fG")
2634 (mult:SF (match_operand:SF 1 "fr_register_operand" "f")
2635 (match_operand:SF 2 "fr_register_operand" "f"))))]
2637 "fnma.s %0 = %1, %2, %F3"
2638 [(set_attr "itanium_class" "fmac")])
2640 (define_insn "*nmaddsf4_alts"
2641 [(set (match_operand:SF 0 "fr_register_operand" "=f")
2642 (minus:SF (match_operand:SF 3 "fr_reg_or_fp01_operand" "fG")
2643 (mult:SF (match_operand:SF 1 "fr_register_operand" "f")
2644 (match_operand:SF 2 "fr_register_operand" "f"))))
2645 (use (match_operand:SI 4 "const_int_operand" ""))]
2647 "fnma.s.s%4 %0 = %1, %2, %F3"
2648 [(set_attr "itanium_class" "fmac")])
2650 (define_expand "divsf3"
2651 [(set (match_operand:SF 0 "fr_register_operand" "")
2652 (div:SF (match_operand:SF 1 "fr_register_operand" "")
2653 (match_operand:SF 2 "fr_register_operand" "")))]
2654 "TARGET_INLINE_FLOAT_DIV"
2657 if (TARGET_INLINE_FLOAT_DIV_LAT)
2658 insn = gen_divsf3_internal_lat (operands[0], operands[1], operands[2]);
2660 insn = gen_divsf3_internal_thr (operands[0], operands[1], operands[2]);
2665 (define_insn_and_split "divsf3_internal_lat"
2666 [(set (match_operand:SF 0 "fr_register_operand" "=&f")
2667 (div:SF (match_operand:SF 1 "fr_register_operand" "f")
2668 (match_operand:SF 2 "fr_register_operand" "f")))
2669 (clobber (match_scratch:XF 3 "=&f"))
2670 (clobber (match_scratch:XF 4 "=f"))
2671 (clobber (match_scratch:BI 5 "=c"))]
2672 "TARGET_INLINE_FLOAT_DIV_LAT"
2674 "&& reload_completed"
2675 [(parallel [(set (match_dup 6) (div:XF (const_int 1) (match_dup 8)))
2676 (set (match_dup 5) (unspec:BI [(match_dup 7) (match_dup 8)]
2677 UNSPEC_FR_RECIP_APPROX))
2678 (use (const_int 1))])
2679 (cond_exec (ne (match_dup 5) (const_int 0))
2680 (parallel [(set (match_dup 3) (mult:XF (match_dup 7) (match_dup 6)))
2681 (use (const_int 1))]))
2682 (cond_exec (ne (match_dup 5) (const_int 0))
2683 (parallel [(set (match_dup 4)
2684 (minus:XF (match_dup 10)
2685 (mult:XF (match_dup 8) (match_dup 6))))
2686 (use (const_int 1))]))
2687 (cond_exec (ne (match_dup 5) (const_int 0))
2688 (parallel [(set (match_dup 3)
2689 (plus:XF (mult:XF (match_dup 4) (match_dup 3))
2691 (use (const_int 1))]))
2692 (cond_exec (ne (match_dup 5) (const_int 0))
2693 (parallel [(set (match_dup 4) (mult:XF (match_dup 4) (match_dup 4)))
2694 (use (const_int 1))]))
2695 (cond_exec (ne (match_dup 5) (const_int 0))
2696 (parallel [(set (match_dup 3)
2697 (plus:XF (mult:XF (match_dup 4) (match_dup 3))
2699 (use (const_int 1))]))
2700 (cond_exec (ne (match_dup 5) (const_int 0))
2701 (parallel [(set (match_dup 4) (mult:XF (match_dup 4) (match_dup 4)))
2702 (use (const_int 1))]))
2703 (cond_exec (ne (match_dup 5) (const_int 0))
2704 (parallel [(set (match_dup 9)
2706 (plus:XF (mult:XF (match_dup 4) (match_dup 3))
2708 (use (const_int 1))]))
2709 (cond_exec (ne (match_dup 5) (const_int 0))
2711 (float_truncate:SF (match_dup 6))))
2714 operands[6] = gen_rtx_REG (XFmode, REGNO (operands[0]));
2715 operands[7] = gen_rtx_REG (XFmode, REGNO (operands[1]));
2716 operands[8] = gen_rtx_REG (XFmode, REGNO (operands[2]));
2717 operands[9] = gen_rtx_REG (DFmode, REGNO (operands[0]));
2718 operands[10] = CONST1_RTX (XFmode);
2720 [(set_attr "predicable" "no")])
2722 (define_insn_and_split "divsf3_internal_thr"
2723 [(set (match_operand:SF 0 "fr_register_operand" "=&f")
2724 (div:SF (match_operand:SF 1 "fr_register_operand" "f")
2725 (match_operand:SF 2 "fr_register_operand" "f")))
2726 (clobber (match_scratch:XF 3 "=&f"))
2727 (clobber (match_scratch:XF 4 "=f"))
2728 (clobber (match_scratch:BI 5 "=c"))]
2729 "TARGET_INLINE_FLOAT_DIV_THR"
2731 "&& reload_completed"
2732 [(parallel [(set (match_dup 6) (div:XF (const_int 1) (match_dup 8)))
2733 (set (match_dup 5) (unspec:BI [(match_dup 7) (match_dup 8)]
2734 UNSPEC_FR_RECIP_APPROX))
2735 (use (const_int 1))])
2736 (cond_exec (ne (match_dup 5) (const_int 0))
2737 (parallel [(set (match_dup 3)
2738 (minus:XF (match_dup 10)
2739 (mult:XF (match_dup 8) (match_dup 6))))
2740 (use (const_int 1))]))
2741 (cond_exec (ne (match_dup 5) (const_int 0))
2742 (parallel [(set (match_dup 3)
2743 (plus:XF (mult:XF (match_dup 3) (match_dup 3))
2745 (use (const_int 1))]))
2746 (cond_exec (ne (match_dup 5) (const_int 0))
2747 (parallel [(set (match_dup 6)
2748 (plus:XF (mult:XF (match_dup 3) (match_dup 6))
2750 (use (const_int 1))]))
2751 (cond_exec (ne (match_dup 5) (const_int 0))
2752 (parallel [(set (match_dup 9)
2754 (mult:XF (match_dup 7) (match_dup 6))))
2755 (use (const_int 1))]))
2756 (cond_exec (ne (match_dup 5) (const_int 0))
2757 (parallel [(set (match_dup 4)
2758 (minus:XF (match_dup 7)
2759 (mult:XF (match_dup 8) (match_dup 3))))
2760 (use (const_int 1))]))
2761 (cond_exec (ne (match_dup 5) (const_int 0))
2764 (plus:XF (mult:XF (match_dup 4) (match_dup 6))
2768 operands[6] = gen_rtx_REG (XFmode, REGNO (operands[0]));
2769 operands[7] = gen_rtx_REG (XFmode, REGNO (operands[1]));
2770 operands[8] = gen_rtx_REG (XFmode, REGNO (operands[2]));
2771 operands[9] = gen_rtx_REG (SFmode, REGNO (operands[3]));
2772 operands[10] = CONST1_RTX (XFmode);
2774 [(set_attr "predicable" "no")])
2776 ;; Inline square root.
2778 (define_insn "*sqrt_approx"
2779 [(set (match_operand:XF 0 "fr_register_operand" "=f")
2780 (div:XF (const_int 1)
2781 (sqrt:XF (match_operand:XF 2 "fr_register_operand" "f"))))
2782 (set (match_operand:BI 1 "register_operand" "=c")
2783 (unspec:BI [(match_dup 2)] UNSPEC_FR_SQRT_RECIP_APPROX))
2784 (use (match_operand:SI 3 "const_int_operand" "")) ]
2786 "frsqrta.s%3 %0, %1 = %2"
2787 [(set_attr "itanium_class" "fmisc")
2788 (set_attr "predicable" "no")])
2790 (define_insn "setf_exp_xf"
2791 [(set (match_operand:XF 0 "fr_register_operand" "=f")
2792 (unspec:XF [(match_operand:DI 1 "register_operand" "r")]
2796 [(set_attr "itanium_class" "frfr")])
2798 (define_expand "sqrtsf2"
2799 [(set (match_operand:SF 0 "fr_register_operand" "=&f")
2800 (sqrt:SF (match_operand:SF 1 "fr_register_operand" "f")))]
2801 "TARGET_INLINE_SQRT"
2804 if (TARGET_INLINE_SQRT_LAT)
2806 insn = gen_sqrtsf2_internal_lat (operands[0], operands[1]);
2811 insn = gen_sqrtsf2_internal_thr (operands[0], operands[1]);
2816 ;; Latency-optimized square root.
2817 ;; FIXME: Implement.
2819 ;; Throughput-optimized square root.
2821 (define_insn_and_split "sqrtsf2_internal_thr"
2822 [(set (match_operand:SF 0 "fr_register_operand" "=&f")
2823 (sqrt:SF (match_operand:SF 1 "fr_register_operand" "f")))
2824 ;; Register r2 in optimization guide.
2825 (clobber (match_scratch:DI 2 "=r"))
2826 ;; Register f8 in optimization guide
2827 (clobber (match_scratch:XF 3 "=&f"))
2828 ;; Register f9 in optimization guide
2829 (clobber (match_scratch:XF 4 "=&f"))
2830 ;; Register f10 in optimization guide
2831 (clobber (match_scratch:XF 5 "=&f"))
2832 ;; Register p6 in optimization guide.
2833 (clobber (match_scratch:BI 6 "=c"))]
2834 "TARGET_INLINE_SQRT_THR"
2836 "&& reload_completed"
2837 [ ;; exponent of +1/2 in r2
2838 (set (match_dup 2) (const_int 65534))
2841 (unspec:XF [(match_dup 2)] UNSPEC_SETF_EXP))
2843 ;; y0 = 1/sqrt(a) in f7
2844 (parallel [(set (match_dup 7)
2845 (div:XF (const_int 1)
2846 (sqrt:XF (match_dup 8))))
2848 (unspec:BI [(match_dup 8)]
2849 UNSPEC_FR_SQRT_RECIP_APPROX))
2850 (use (const_int 0))])
2852 ;; H0 = 1/2 * y0 in f9
2853 (cond_exec (ne (match_dup 6) (const_int 0))
2854 (parallel [(set (match_dup 4)
2855 (plus:XF (mult:XF (match_dup 3) (match_dup 7))
2857 (use (const_int 1))]))
2859 ;; S0 = a * y0 in f7
2860 (cond_exec (ne (match_dup 6) (const_int 0))
2861 (parallel [(set (match_dup 7)
2862 (plus:XF (mult:XF (match_dup 8) (match_dup 7))
2864 (use (const_int 1))]))
2866 ;; d = 1/2 - S0 * H0 in f10
2867 (cond_exec (ne (match_dup 6) (const_int 0))
2868 (parallel [(set (match_dup 5)
2869 (minus:XF (match_dup 3)
2870 (mult:XF (match_dup 7) (match_dup 4))))
2871 (use (const_int 1))]))
2873 ;; d' = d + 1/2 * d in f8
2874 (cond_exec (ne (match_dup 6) (const_int 0))
2875 (parallel [(set (match_dup 3)
2876 (plus:XF (mult:XF (match_dup 3) (match_dup 5))
2878 (use (const_int 1))]))
2880 ;; e = d + d * d' in f8
2881 (cond_exec (ne (match_dup 6) (const_int 0))
2882 (parallel [(set (match_dup 3)
2883 (plus:XF (mult:XF (match_dup 5) (match_dup 3))
2885 (use (const_int 1))]))
2887 ;; S1 = S0 + e * S0 in f7
2888 (cond_exec (ne (match_dup 6) (const_int 0))
2889 (parallel [(set (match_dup 0)
2891 (plus:XF (mult:XF (match_dup 3) (match_dup 7))
2893 (use (const_int 1))]))
2895 ;; H1 = H0 + e * H0 in f8
2896 (cond_exec (ne (match_dup 6) (const_int 0))
2897 (parallel [(set (match_dup 3)
2898 (plus:XF (mult:XF (match_dup 3) (match_dup 4))
2900 (use (const_int 1))]))
2902 ;; d1 = a - S1 * S1 in f9
2903 (cond_exec (ne (match_dup 6) (const_int 0))
2904 (parallel [(set (match_dup 4)
2905 (minus:XF (match_dup 8)
2906 (mult:XF (match_dup 7) (match_dup 7))))
2907 (use (const_int 1))]))
2909 ;; S = S1 + d1 * H1 in f7
2910 (cond_exec (ne (match_dup 6) (const_int 0))
2911 (parallel [(set (match_dup 0)
2913 (plus:XF (mult:XF (match_dup 4) (match_dup 3))
2915 (use (const_int 0))]))]
2917 /* Generate 82-bit versions of the input and output operands. */
2918 operands[7] = gen_rtx_REG (XFmode, REGNO (operands[0]));
2919 operands[8] = gen_rtx_REG (XFmode, REGNO (operands[1]));
2920 /* Generate required floating-point constants. */
2921 operands[9] = CONST0_RTX (XFmode);
2923 [(set_attr "predicable" "no")])
2925 ;; ::::::::::::::::::::
2927 ;; :: 64 bit floating point arithmetic
2929 ;; ::::::::::::::::::::
2931 (define_insn "adddf3"
2932 [(set (match_operand:DF 0 "fr_register_operand" "=f")
2933 (plus:DF (match_operand:DF 1 "fr_register_operand" "%f")
2934 (match_operand:DF 2 "fr_reg_or_fp01_operand" "fG")))]
2936 "fadd.d %0 = %1, %F2"
2937 [(set_attr "itanium_class" "fmac")])
2939 (define_insn "*adddf3_trunc"
2940 [(set (match_operand:SF 0 "fr_register_operand" "=f")
2942 (plus:DF (match_operand:DF 1 "fr_register_operand" "%f")
2943 (match_operand:DF 2 "fr_reg_or_fp01_operand" "fG"))))]
2945 "fadd.s %0 = %1, %F2"
2946 [(set_attr "itanium_class" "fmac")])
2948 (define_insn "subdf3"
2949 [(set (match_operand:DF 0 "fr_register_operand" "=f")
2950 (minus:DF (match_operand:DF 1 "fr_reg_or_fp01_operand" "fG")
2951 (match_operand:DF 2 "fr_reg_or_fp01_operand" "fG")))]
2953 "fsub.d %0 = %F1, %F2"
2954 [(set_attr "itanium_class" "fmac")])
2956 (define_insn "*subdf3_trunc"
2957 [(set (match_operand:SF 0 "fr_register_operand" "=f")
2959 (minus:DF (match_operand:DF 1 "fr_reg_or_fp01_operand" "fG")
2960 (match_operand:DF 2 "fr_reg_or_fp01_operand" "fG"))))]
2962 "fsub.s %0 = %F1, %F2"
2963 [(set_attr "itanium_class" "fmac")])
2965 (define_insn "muldf3"
2966 [(set (match_operand:DF 0 "fr_register_operand" "=f")
2967 (mult:DF (match_operand:DF 1 "fr_register_operand" "f")
2968 (match_operand:DF 2 "fr_register_operand" "f")))]
2970 "fmpy.d %0 = %1, %2"
2971 [(set_attr "itanium_class" "fmac")])
2973 (define_insn "*muldf3_trunc"
2974 [(set (match_operand:SF 0 "fr_register_operand" "=f")
2976 (mult:DF (match_operand:DF 1 "fr_register_operand" "f")
2977 (match_operand:DF 2 "fr_register_operand" "f"))))]
2979 "fmpy.s %0 = %1, %2"
2980 [(set_attr "itanium_class" "fmac")])
2982 (define_insn "absdf2"
2983 [(set (match_operand:DF 0 "fr_register_operand" "=f")
2984 (abs:DF (match_operand:DF 1 "fr_register_operand" "f")))]
2987 [(set_attr "itanium_class" "fmisc")])
2989 (define_insn "negdf2"
2990 [(set (match_operand:DF 0 "fr_register_operand" "=f")
2991 (neg:DF (match_operand:DF 1 "fr_register_operand" "f")))]
2994 [(set_attr "itanium_class" "fmisc")])
2996 (define_insn "*nabsdf2"
2997 [(set (match_operand:DF 0 "fr_register_operand" "=f")
2998 (neg:DF (abs:DF (match_operand:DF 1 "fr_register_operand" "f"))))]
3001 [(set_attr "itanium_class" "fmisc")])
3003 (define_insn "mindf3"
3004 [(set (match_operand:DF 0 "fr_register_operand" "=f")
3005 (smin:DF (match_operand:DF 1 "fr_register_operand" "f")
3006 (match_operand:DF 2 "fr_reg_or_fp01_operand" "fG")))]
3009 [(set_attr "itanium_class" "fmisc")])
3011 (define_insn "maxdf3"
3012 [(set (match_operand:DF 0 "fr_register_operand" "=f")
3013 (smax:DF (match_operand:DF 1 "fr_register_operand" "f")
3014 (match_operand:DF 2 "fr_reg_or_fp01_operand" "fG")))]
3017 [(set_attr "itanium_class" "fmisc")])
3019 (define_insn "*madddf4"
3020 [(set (match_operand:DF 0 "fr_register_operand" "=f")
3021 (plus:DF (mult:DF (match_operand:DF 1 "fr_register_operand" "f")
3022 (match_operand:DF 2 "fr_register_operand" "f"))
3023 (match_operand:DF 3 "fr_reg_or_fp01_operand" "fG")))]
3025 "fma.d %0 = %1, %2, %F3"
3026 [(set_attr "itanium_class" "fmac")])
3028 (define_insn "*madddf4_trunc"
3029 [(set (match_operand:SF 0 "fr_register_operand" "=f")
3031 (plus:DF (mult:DF (match_operand:DF 1 "fr_register_operand" "f")
3032 (match_operand:DF 2 "fr_register_operand" "f"))
3033 (match_operand:DF 3 "fr_reg_or_fp01_operand" "fG"))))]
3035 "fma.s %0 = %1, %2, %F3"
3036 [(set_attr "itanium_class" "fmac")])
3038 (define_insn "*msubdf4"
3039 [(set (match_operand:DF 0 "fr_register_operand" "=f")
3040 (minus:DF (mult:DF (match_operand:DF 1 "fr_register_operand" "f")
3041 (match_operand:DF 2 "fr_register_operand" "f"))
3042 (match_operand:DF 3 "fr_reg_or_fp01_operand" "fG")))]
3044 "fms.d %0 = %1, %2, %F3"
3045 [(set_attr "itanium_class" "fmac")])
3047 (define_insn "*msubdf4_trunc"
3048 [(set (match_operand:SF 0 "fr_register_operand" "=f")
3050 (minus:DF (mult:DF (match_operand:DF 1 "fr_register_operand" "f")
3051 (match_operand:DF 2 "fr_register_operand" "f"))
3052 (match_operand:DF 3 "fr_reg_or_fp01_operand" "fG"))))]
3054 "fms.s %0 = %1, %2, %F3"
3055 [(set_attr "itanium_class" "fmac")])
3057 (define_insn "*nmuldf3"
3058 [(set (match_operand:DF 0 "fr_register_operand" "=f")
3059 (neg:DF (mult:DF (match_operand:DF 1 "fr_register_operand" "f")
3060 (match_operand:DF 2 "fr_register_operand" "f"))))]
3062 "fnmpy.d %0 = %1, %2"
3063 [(set_attr "itanium_class" "fmac")])
3065 (define_insn "*nmuldf3_trunc"
3066 [(set (match_operand:SF 0 "fr_register_operand" "=f")
3068 (neg:DF (mult:DF (match_operand:DF 1 "fr_register_operand" "f")
3069 (match_operand:DF 2 "fr_register_operand" "f")))))]
3071 "fnmpy.s %0 = %1, %2"
3072 [(set_attr "itanium_class" "fmac")])
3074 (define_insn "*nmadddf4"
3075 [(set (match_operand:DF 0 "fr_register_operand" "=f")
3076 (minus:DF (match_operand:DF 3 "fr_reg_or_fp01_operand" "fG")
3077 (mult:DF (match_operand:DF 1 "fr_register_operand" "f")
3078 (match_operand:DF 2 "fr_register_operand" "f"))))]
3080 "fnma.d %0 = %1, %2, %F3"
3081 [(set_attr "itanium_class" "fmac")])
3083 (define_insn "*nmadddf4_alts"
3084 [(set (match_operand:DF 0 "fr_register_operand" "=f")
3085 (minus:DF (match_operand:DF 3 "fr_reg_or_fp01_operand" "fG")
3086 (mult:DF (match_operand:DF 1 "fr_register_operand" "f")
3087 (match_operand:DF 2 "fr_register_operand" "f"))))
3088 (use (match_operand:SI 4 "const_int_operand" ""))]
3090 "fnma.d.s%4 %0 = %1, %2, %F3"
3091 [(set_attr "itanium_class" "fmac")])
3093 (define_insn "*nmadddf4_truncsf"
3094 [(set (match_operand:SF 0 "fr_register_operand" "=f")
3096 (minus:DF (match_operand:DF 3 "fr_reg_or_fp01_operand" "fG")
3097 (mult:DF (match_operand:DF 1 "fr_register_operand" "f")
3098 (match_operand:DF 2 "fr_register_operand" "f")))))]
3100 "fnma.s %0 = %1, %2, %F3"
3101 [(set_attr "itanium_class" "fmac")])
3103 (define_insn "*nmadddf4_truncsf_alts"
3104 [(set (match_operand:SF 0 "fr_register_operand" "=f")
3106 (minus:DF (match_operand:DF 3 "fr_reg_or_fp01_operand" "fG")
3107 (mult:DF (match_operand:DF 1 "fr_register_operand" "f")
3108 (match_operand:DF 2 "fr_register_operand" "f")))))
3109 (use (match_operand:SI 4 "const_int_operand" ""))]
3111 "fnma.s.s%4 %0 = %1, %2, %F3"
3112 [(set_attr "itanium_class" "fmac")])
3114 (define_expand "divdf3"
3115 [(set (match_operand:DF 0 "fr_register_operand" "")
3116 (div:DF (match_operand:DF 1 "fr_register_operand" "")
3117 (match_operand:DF 2 "fr_register_operand" "")))]
3118 "TARGET_INLINE_FLOAT_DIV"
3121 if (TARGET_INLINE_FLOAT_DIV_LAT)
3122 insn = gen_divdf3_internal_lat (operands[0], operands[1], operands[2]);
3124 insn = gen_divdf3_internal_thr (operands[0], operands[1], operands[2]);
3129 (define_insn_and_split "divdf3_internal_lat"
3130 [(set (match_operand:DF 0 "fr_register_operand" "=&f")
3131 (div:DF (match_operand:DF 1 "fr_register_operand" "f")
3132 (match_operand:DF 2 "fr_register_operand" "f")))
3133 (clobber (match_scratch:XF 3 "=&f"))
3134 (clobber (match_scratch:XF 4 "=&f"))
3135 (clobber (match_scratch:XF 5 "=&f"))
3136 (clobber (match_scratch:BI 6 "=c"))]
3137 "TARGET_INLINE_FLOAT_DIV_LAT"
3139 "&& reload_completed"
3140 [(parallel [(set (match_dup 7) (div:XF (const_int 1) (match_dup 9)))
3141 (set (match_dup 6) (unspec:BI [(match_dup 8) (match_dup 9)]
3142 UNSPEC_FR_RECIP_APPROX))
3143 (use (const_int 1))])
3144 (cond_exec (ne (match_dup 6) (const_int 0))
3145 (parallel [(set (match_dup 3) (mult:XF (match_dup 8) (match_dup 7)))
3146 (use (const_int 1))]))
3147 (cond_exec (ne (match_dup 6) (const_int 0))
3148 (parallel [(set (match_dup 4)
3149 (minus:XF (match_dup 12)
3150 (mult:XF (match_dup 9) (match_dup 7))))
3151 (use (const_int 1))]))
3152 (cond_exec (ne (match_dup 6) (const_int 0))
3153 (parallel [(set (match_dup 3)
3154 (plus:XF (mult:XF (match_dup 4) (match_dup 3))
3156 (use (const_int 1))]))
3157 (cond_exec (ne (match_dup 6) (const_int 0))
3158 (parallel [(set (match_dup 5) (mult:XF (match_dup 4) (match_dup 4)))
3159 (use (const_int 1))]))
3160 (cond_exec (ne (match_dup 6) (const_int 0))
3161 (parallel [(set (match_dup 7)
3162 (plus:XF (mult:XF (match_dup 4) (match_dup 7))
3164 (use (const_int 1))]))
3165 (cond_exec (ne (match_dup 6) (const_int 0))
3166 (parallel [(set (match_dup 3)
3167 (plus:XF (mult:XF (match_dup 5) (match_dup 3))
3169 (use (const_int 1))]))
3170 (cond_exec (ne (match_dup 6) (const_int 0))
3171 (parallel [(set (match_dup 4) (mult:XF (match_dup 5) (match_dup 5)))
3172 (use (const_int 1))]))
3173 (cond_exec (ne (match_dup 6) (const_int 0))
3174 (parallel [(set (match_dup 7)
3175 (plus:XF (mult:XF (match_dup 5) (match_dup 7))
3177 (use (const_int 1))]))
3178 (cond_exec (ne (match_dup 6) (const_int 0))
3179 (parallel [(set (match_dup 10)
3181 (plus:XF (mult:XF (match_dup 4) (match_dup 3))
3183 (use (const_int 1))]))
3184 (cond_exec (ne (match_dup 6) (const_int 0))
3185 (parallel [(set (match_dup 7)
3186 (plus:XF (mult:XF (match_dup 4) (match_dup 7))
3188 (use (const_int 1))]))
3189 (cond_exec (ne (match_dup 6) (const_int 0))
3190 (parallel [(set (match_dup 11)
3192 (minus:XF (match_dup 8)
3193 (mult:XF (match_dup 9) (match_dup 3)))))
3194 (use (const_int 1))]))
3195 (cond_exec (ne (match_dup 6) (const_int 0))
3197 (float_truncate:DF (plus:XF (mult:XF (match_dup 5) (match_dup 7))
3201 operands[7] = gen_rtx_REG (XFmode, REGNO (operands[0]));
3202 operands[8] = gen_rtx_REG (XFmode, REGNO (operands[1]));
3203 operands[9] = gen_rtx_REG (XFmode, REGNO (operands[2]));
3204 operands[10] = gen_rtx_REG (DFmode, REGNO (operands[3]));
3205 operands[11] = gen_rtx_REG (DFmode, REGNO (operands[5]));
3206 operands[12] = CONST1_RTX (XFmode);
3208 [(set_attr "predicable" "no")])
3210 (define_insn_and_split "divdf3_internal_thr"
3211 [(set (match_operand:DF 0 "fr_register_operand" "=&f")
3212 (div:DF (match_operand:DF 1 "fr_register_operand" "f")
3213 (match_operand:DF 2 "fr_register_operand" "f")))
3214 (clobber (match_scratch:XF 3 "=&f"))
3215 (clobber (match_scratch:DF 4 "=f"))
3216 (clobber (match_scratch:BI 5 "=c"))]
3217 "TARGET_INLINE_FLOAT_DIV_THR"
3219 "&& reload_completed"
3220 [(parallel [(set (match_dup 6) (div:XF (const_int 1) (match_dup 8)))
3221 (set (match_dup 5) (unspec:BI [(match_dup 7) (match_dup 8)]
3222 UNSPEC_FR_RECIP_APPROX))
3223 (use (const_int 1))])
3224 (cond_exec (ne (match_dup 5) (const_int 0))
3225 (parallel [(set (match_dup 3)
3226 (minus:XF (match_dup 10)
3227 (mult:XF (match_dup 8) (match_dup 6))))
3228 (use (const_int 1))]))
3229 (cond_exec (ne (match_dup 5) (const_int 0))
3230 (parallel [(set (match_dup 6)
3231 (plus:XF (mult:XF (match_dup 3) (match_dup 6))
3233 (use (const_int 1))]))
3234 (cond_exec (ne (match_dup 5) (const_int 0))
3235 (parallel [(set (match_dup 3)
3236 (mult:XF (match_dup 3) (match_dup 3)))
3237 (use (const_int 1))]))
3238 (cond_exec (ne (match_dup 5) (const_int 0))
3239 (parallel [(set (match_dup 6)
3240 (plus:XF (mult:XF (match_dup 3) (match_dup 6))
3242 (use (const_int 1))]))
3243 (cond_exec (ne (match_dup 5) (const_int 0))
3244 (parallel [(set (match_dup 3)
3245 (mult:XF (match_dup 3) (match_dup 3)))
3246 (use (const_int 1))]))
3247 (cond_exec (ne (match_dup 5) (const_int 0))
3248 (parallel [(set (match_dup 6)
3249 (plus:XF (mult:XF (match_dup 3) (match_dup 6))
3251 (use (const_int 1))]))
3252 (cond_exec (ne (match_dup 5) (const_int 0))
3253 (parallel [(set (match_dup 9)
3255 (mult:XF (match_dup 7) (match_dup 6))))
3256 (use (const_int 1))]))
3257 (cond_exec (ne (match_dup 5) (const_int 0))
3258 (parallel [(set (match_dup 4)
3259 (minus:DF (match_dup 1)
3260 (mult:DF (match_dup 2) (match_dup 9))))
3261 (use (const_int 1))]))
3262 (cond_exec (ne (match_dup 5) (const_int 0))
3264 (plus:DF (mult:DF (match_dup 4) (match_dup 0))
3268 operands[6] = gen_rtx_REG (XFmode, REGNO (operands[0]));
3269 operands[7] = gen_rtx_REG (XFmode, REGNO (operands[1]));
3270 operands[8] = gen_rtx_REG (XFmode, REGNO (operands[2]));
3271 operands[9] = gen_rtx_REG (DFmode, REGNO (operands[3]));
3272 operands[10] = CONST1_RTX (XFmode);
3274 [(set_attr "predicable" "no")])
3276 ;; Inline square root.
3278 (define_expand "sqrtdf2"
3279 [(set (match_operand:DF 0 "fr_register_operand" "=&f")
3280 (sqrt:DF (match_operand:DF 1 "fr_register_operand" "f")))]
3281 "TARGET_INLINE_SQRT"
3284 if (TARGET_INLINE_SQRT_LAT)
3286 insn = gen_sqrtdf2_internal_lat (operands[0], operands[1]);
3291 insn = gen_sqrtdf2_internal_thr (operands[0], operands[1]);
3296 ;; Latency-optimized square root.
3297 ;; FIXME: Implement.
3299 ;; Throughput-optimized square root.
3301 (define_insn_and_split "sqrtdf2_internal_thr"
3302 [(set (match_operand:DF 0 "fr_register_operand" "=&f")
3303 (sqrt:DF (match_operand:DF 1 "fr_register_operand" "f")))
3304 ;; Register r2 in optimization guide.
3305 (clobber (match_scratch:DI 2 "=r"))
3306 ;; Register f8 in optimization guide
3307 (clobber (match_scratch:XF 3 "=&f"))
3308 ;; Register f9 in optimization guide
3309 (clobber (match_scratch:XF 4 "=&f"))
3310 ;; Register f10 in optimization guide
3311 (clobber (match_scratch:XF 5 "=&f"))
3312 ;; Register p6 in optimization guide.
3313 (clobber (match_scratch:BI 6 "=c"))]
3314 "TARGET_INLINE_SQRT_THR"
3316 "&& reload_completed"
3317 [ ;; exponent of +1/2 in r2
3318 (set (match_dup 2) (const_int 65534))
3321 (unspec:XF [(match_dup 2)] UNSPEC_SETF_EXP))
3323 ;; y0 = 1/sqrt(a) in f7
3324 (parallel [(set (match_dup 7)
3325 (div:XF (const_int 1)
3326 (sqrt:XF (match_dup 8))))
3328 (unspec:BI [(match_dup 8)]
3329 UNSPEC_FR_SQRT_RECIP_APPROX))
3330 (use (const_int 0))])
3332 ;; H0 = 1/2 * y0 in f8
3333 (cond_exec (ne (match_dup 6) (const_int 0))