1 ;; IA-64 Machine description template
2 ;; Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007
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 3, or (at your option)
14 ;; GCC is distributed in the hope that it will be useful,
15 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
16 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 ;; GNU General Public License for more details.
19 ;; You should have received a copy of the GNU General Public License
20 ;; along with GCC; see the file COPYING3. If not see
21 ;; <http://www.gnu.org/licenses/>.
23 ;;- See file "rtl.def" for documentation on define_insn, match_*, et. al.
25 ;; ??? register_operand accepts (subreg:DI (mem:SI X)) which forces later
26 ;; reload. This will be fixed once scheduling support is turned on.
28 ;; ??? Optimize for post-increment addressing modes.
30 ;; ??? fselect is not supported, because there is no integer register
33 ;; ??? fp abs/min/max instructions may also work for integer values.
35 ;; ??? Would a predicate_reg_operand predicate be useful? The HP one is buggy,
36 ;; it assumes the operand is a register and takes REGNO of it without checking.
38 ;; ??? Would a branch_reg_operand predicate be useful? The HP one is buggy,
39 ;; it assumes the operand is a register and takes REGNO of it without checking.
41 ;; ??? Go through list of documented named patterns and look for more to
44 ;; ??? Go through instruction manual and look for more instructions that
47 ;; ??? Add function unit scheduling info for Itanium (TM) processor.
49 ;; ??? Need a better way to describe alternate fp status registers.
53 (UNSPEC_LTOFF_DTPMOD 0)
54 (UNSPEC_LTOFF_DTPREL 1)
56 (UNSPEC_LTOFF_TPREL 3)
62 (UNSPEC_GR_RESTORE 11)
64 (UNSPEC_FR_RESTORE 13)
65 (UNSPEC_FR_RECIP_APPROX 14)
66 (UNSPEC_PRED_REL_MUTEX 15)
70 (UNSPEC_CMPXCHG_ACQ 19)
71 (UNSPEC_FETCHADD_ACQ 20)
74 (UNSPEC_BUNDLE_SELECTOR 23)
76 (UNSPEC_PROLOGUE_USE 25)
79 (UNSPEC_FR_SQRT_RECIP_APPROX 28)
94 (UNSPECV_INSN_GROUP_BARRIER 2)
97 (UNSPECV_PSAC_ALL 5) ; pred.safe_across_calls
98 (UNSPECV_PSAC_NORMAL 6)
99 (UNSPECV_SETJMP_RECEIVER 7)
102 (include "predicates.md")
103 (include "constraints.md")
105 ;; ::::::::::::::::::::
109 ;; ::::::::::::::::::::
111 ;; Processor type. This attribute must exactly match the processor_type
112 ;; enumeration in ia64.h.
113 (define_attr "cpu" "itanium,itanium2" (const (symbol_ref "ia64_tune")))
115 ;; Instruction type. This primarily determines how instructions can be
116 ;; packed in bundles, and secondarily affects scheduling to function units.
118 ;; A alu, can go in I or M syllable of a bundle
123 ;; L long immediate, takes two syllables
126 ;; ??? Should not have any pattern with type unknown. Perhaps add code to
127 ;; check this in md_reorg? Currently use unknown for patterns which emit
128 ;; multiple instructions, patterns which emit 0 instructions, and patterns
129 ;; which emit instruction that can go in any slot (e.g. nop).
131 (define_attr "itanium_class" "unknown,ignore,stop_bit,br,fcmp,fcvtfx,fld,
132 fldp,fmac,fmisc,frar_i,frar_m,frbr,frfr,frpr,ialu,icmp,ilog,ishf,
133 ld,chk_s_i,chk_s_f,chk_a,long_i,mmalua,mmmul,mmshf,mmshfi,rse_m,scall,sem,stf,
134 st,syst_m0, syst_m,tbit,toar_i,toar_m,tobr,tofr,topr,xmpy,xtd,nop,
135 nop_b,nop_f,nop_i,nop_m,nop_x,lfetch,pre_cycle"
136 (const_string "unknown"))
138 ;; chk_s_i has an I and an M form; use type A for convenience.
139 (define_attr "type" "unknown,A,I,M,F,B,L,X,S"
140 (cond [(eq_attr "itanium_class" "ld,st,fld,fldp,stf,sem,nop_m") (const_string "M")
141 (eq_attr "itanium_class" "rse_m,syst_m,syst_m0") (const_string "M")
142 (eq_attr "itanium_class" "frar_m,toar_m,frfr,tofr") (const_string "M")
143 (eq_attr "itanium_class" "lfetch") (const_string "M")
144 (eq_attr "itanium_class" "chk_s_f,chk_a") (const_string "M")
145 (eq_attr "itanium_class" "chk_s_i,ialu,icmp,ilog,mmalua")
147 (eq_attr "itanium_class" "fmisc,fmac,fcmp,xmpy") (const_string "F")
148 (eq_attr "itanium_class" "fcvtfx,nop_f") (const_string "F")
149 (eq_attr "itanium_class" "frar_i,toar_i,frbr,tobr") (const_string "I")
150 (eq_attr "itanium_class" "frpr,topr,ishf,xtd,tbit") (const_string "I")
151 (eq_attr "itanium_class" "mmmul,mmshf,mmshfi,nop_i") (const_string "I")
152 (eq_attr "itanium_class" "br,scall,nop_b") (const_string "B")
153 (eq_attr "itanium_class" "stop_bit") (const_string "S")
154 (eq_attr "itanium_class" "nop_x") (const_string "X")
155 (eq_attr "itanium_class" "long_i") (const_string "L")]
156 (const_string "unknown")))
158 (define_attr "itanium_requires_unit0" "no,yes"
159 (cond [(eq_attr "itanium_class" "syst_m0,sem,frfr,rse_m") (const_string "yes")
160 (eq_attr "itanium_class" "toar_m,frar_m") (const_string "yes")
161 (eq_attr "itanium_class" "frbr,tobr,mmmul") (const_string "yes")
162 (eq_attr "itanium_class" "tbit,ishf,topr,frpr") (const_string "yes")
163 (eq_attr "itanium_class" "toar_i,frar_i") (const_string "yes")
164 (eq_attr "itanium_class" "fmisc,fcmp") (const_string "yes")]
165 (const_string "no")))
167 ;; Predication. True iff this instruction can be predicated.
169 (define_attr "predicable" "no,yes" (const_string "yes"))
171 ;; Empty. True iff this insn does not generate any code.
173 (define_attr "empty" "no,yes" (const_string "no"))
175 ;; True iff this insn must be the first insn of an instruction group.
176 ;; This is true for the alloc instruction, and will also be true of others
177 ;; when we have full intrinsics support.
179 (define_attr "first_insn" "no,yes" (const_string "no"))
181 (define_attr "data_speculative" "no,yes" (const_string "no"))
183 (define_attr "control_speculative" "no,yes" (const_string "no"))
185 (define_attr "check_load" "no,yes" (const_string "no"))
187 ;; DFA descriptions of ia64 processors used for insn scheduling and
190 (automata_option "ndfa")
192 ;; Uncomment the following line to output automata for debugging.
193 ;; (automata_option "v")
195 (automata_option "w")
197 (include "itanium1.md")
198 (include "itanium2.md")
201 ;; ::::::::::::::::::::
205 ;; ::::::::::::::::::::
207 ;; Set of a single predicate register. This is only used to implement
208 ;; pr-to-pr move and complement.
210 (define_insn "*movcci"
211 [(set (match_operand:CCI 0 "register_operand" "=c,c,c")
212 (match_operand:CCI 1 "nonmemory_operand" "O,n,c"))]
215 cmp.ne %0, p0 = r0, r0
216 cmp.eq %0, p0 = r0, r0
217 (%1) cmp.eq.unc %0, p0 = r0, r0"
218 [(set_attr "itanium_class" "icmp")
219 (set_attr "predicable" "no")])
222 [(set (match_operand:BI 0 "destination_operand" "=c,c,?c,?*r, c,*r,*r,*m,*r")
223 (match_operand:BI 1 "move_operand" " O,n, c, c,*r, n,*m,*r,*r"))]
226 cmp.ne %0, %I0 = r0, r0
227 cmp.eq %0, %I0 = r0, r0
230 tbit.nz %0, %I0 = %1, 0
235 [(set_attr "itanium_class" "icmp,icmp,unknown,unknown,tbit,ialu,ld,st,ialu")])
238 [(set (match_operand:BI 0 "register_operand" "")
239 (match_operand:BI 1 "register_operand" ""))]
241 && GET_CODE (operands[0]) == REG && GR_REGNO_P (REGNO (operands[0]))
242 && GET_CODE (operands[1]) == REG && PR_REGNO_P (REGNO (operands[1]))"
243 [(cond_exec (ne (match_dup 1) (const_int 0))
244 (set (match_dup 0) (const_int 1)))
245 (cond_exec (eq (match_dup 1) (const_int 0))
246 (set (match_dup 0) (const_int 0)))]
250 [(set (match_operand:BI 0 "register_operand" "")
251 (match_operand:BI 1 "register_operand" ""))]
253 && GET_CODE (operands[0]) == REG && PR_REGNO_P (REGNO (operands[0]))
254 && GET_CODE (operands[1]) == REG && PR_REGNO_P (REGNO (operands[1]))"
255 [(set (match_dup 2) (match_dup 4))
256 (set (match_dup 3) (match_dup 5))
257 (set (match_dup 0) (unspec:BI [(match_dup 0)] UNSPEC_PRED_REL_MUTEX))]
258 "operands[2] = gen_rtx_REG (CCImode, REGNO (operands[0]));
259 operands[3] = gen_rtx_REG (CCImode, REGNO (operands[0]) + 1);
260 operands[4] = gen_rtx_REG (CCImode, REGNO (operands[1]));
261 operands[5] = gen_rtx_REG (CCImode, REGNO (operands[1]) + 1);")
263 (define_expand "movqi"
264 [(set (match_operand:QI 0 "general_operand" "")
265 (match_operand:QI 1 "general_operand" ""))]
268 rtx op1 = ia64_expand_move (operands[0], operands[1]);
274 (define_insn "*movqi_internal"
275 [(set (match_operand:QI 0 "destination_operand" "=r,r,r, m, r,*f,*f")
276 (match_operand:QI 1 "move_operand" "rO,J,m,rO,*f,rO,*f"))]
277 "ia64_move_ok (operands[0], operands[1])"
286 [(set_attr "itanium_class" "ialu,ialu,ld,st,frfr,tofr,fmisc")])
288 (define_expand "movhi"
289 [(set (match_operand:HI 0 "general_operand" "")
290 (match_operand:HI 1 "general_operand" ""))]
293 rtx op1 = ia64_expand_move (operands[0], operands[1]);
299 (define_insn "*movhi_internal"
300 [(set (match_operand:HI 0 "destination_operand" "=r,r,r, m, r,*f,*f")
301 (match_operand:HI 1 "move_operand" "rO,J,m,rO,*f,rO,*f"))]
302 "ia64_move_ok (operands[0], operands[1])"
311 [(set_attr "itanium_class" "ialu,ialu,ld,st,frfr,tofr,fmisc")])
313 (define_expand "movsi"
314 [(set (match_operand:SI 0 "general_operand" "")
315 (match_operand:SI 1 "general_operand" ""))]
318 rtx op1 = ia64_expand_move (operands[0], operands[1]);
324 (define_insn "*movsi_internal"
325 [(set (match_operand:SI 0 "destination_operand" "=r,r,r,r, m, r,*f,*f, r,*d")
326 (match_operand:SI 1 "move_operand" "rO,J,i,m,rO,*f,rO,*f,*d,rK"))]
327 "ia64_move_ok (operands[0], operands[1])"
339 ;; frar_m, toar_m ??? why not frar_i and toar_i
340 [(set_attr "itanium_class" "ialu,ialu,long_i,ld,st,frfr,tofr,fmisc,frar_m,toar_m")])
342 (define_expand "movdi"
343 [(set (match_operand:DI 0 "general_operand" "")
344 (match_operand:DI 1 "general_operand" ""))]
347 rtx op1 = ia64_expand_move (operands[0], operands[1]);
353 (define_insn "*movdi_internal"
354 [(set (match_operand:DI 0 "destination_operand"
355 "=r,r,r,r, m, r,*f,*f,*f, Q, r,*b, r,*e, r,*d, r,*c")
356 (match_operand:DI 1 "move_operand"
357 "rO,JT,i,m,rO,*f,rO,*f, Q,*f,*b,rO,*e,rK,*d,rK,*c,rO"))]
358 "ia64_move_ok (operands[0], operands[1])"
360 static const char * const alt[] = {
362 "%,addl %0 = %1, r0",
364 "%,ld8%O1 %0 = %1%P1",
365 "%,st8%Q0 %0 = %r1%P0",
366 "%,getf.sig %0 = %1",
367 "%,setf.sig %0 = %r1",
381 gcc_assert (which_alternative != 2 || TARGET_NO_PIC
382 || !symbolic_operand (operands[1], VOIDmode));
384 return alt[which_alternative];
386 [(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")])
388 (define_mode_iterator MODE [BI QI HI SI DI SF DF XF TI])
389 (define_mode_iterator MODE_FOR_EXTEND [QI HI SI])
391 (define_mode_attr output_a [
392 (BI "ld1.a %0 = %1%P1")
393 (QI "ld1.a %0 = %1%P1")
394 (HI "ld2.a %0 = %1%P1")
395 (SI "ld4.a %0 = %1%P1")
408 (XF "ldfe.a %0 = %1%P1")
409 (TI "ldfp8.a %X0 = %1%P1")])
411 (define_mode_attr output_s [
412 (BI "ld1.s %0 = %1%P1")
413 (QI "ld1.s %0 = %1%P1")
414 (HI "ld2.s %0 = %1%P1")
415 (SI "ld4.s %0 = %1%P1")
428 (XF "ldfe.s %0 = %1%P1")
429 (TI "ldfp8.s %X0 = %1%P1")])
431 (define_mode_attr output_sa [
432 (BI "ld1.sa %0 = %1%P1")
433 (QI "ld1.sa %0 = %1%P1")
434 (HI "ld2.sa %0 = %1%P1")
435 (SI "ld4.sa %0 = %1%P1")
448 (XF "ldfe.sa %0 = %1%P1")
449 (TI "ldfp8.sa %X0 = %1%P1")])
451 (define_mode_attr output_c_clr [
452 (BI "ld1.c.clr%O1 %0 = %1%P1")
453 (QI "ld1.c.clr%O1 %0 = %1%P1")
454 (HI "ld2.c.clr%O1 %0 = %1%P1")
455 (SI "ld4.c.clr%O1 %0 = %1%P1")
458 ld8.c.clr%O1 %0 = %1%P1
459 ldf8.c.clr %0 = %1%P1")
462 ldfs.c.clr %0 = %1%P1
463 ld4.c.clr%O1 %0 = %1%P1")
466 ldfd.c.clr %0 = %1%P1
467 ld8.c.clr%O1 %0 = %1%P1")
468 (XF "ldfe.c.clr %0 = %1%P1")
469 (TI "ldfp8.c.clr %X0 = %1%P1")])
471 (define_mode_attr ld_reg_constr [(BI "=*r") (QI "=r") (HI "=r") (SI "=r") (DI "=r,*f") (SF "=f,*r") (DF "=f,*r") (XF "=f") (TI "=*x")])
472 (define_mode_attr ldc_reg_constr [(BI "+*r") (QI "+r") (HI "+r") (SI "+r") (DI "+r,*f") (SF "+f,*r") (DF "+f,*r") (XF "+f") (TI "+*x")])
473 (define_mode_attr chk_reg_constr [(BI "*r") (QI "r") (HI "r") (SI "r") (DI "r,*f") (SF "f,*r") (DF "f,*r") (XF "f") (TI "*x")])
475 (define_mode_attr mem_constr [(BI "*m") (QI "m") (HI "m") (SI "m") (DI "m,Q") (SF "Q,m") (DF "Q,m") (XF "m") (TI "Q")])
477 ;; Define register predicate prefix.
478 ;; We can generate speculative loads only for general and fp registers - this
479 ;; is constrained in ia64.c: ia64_speculate_insn ().
480 (define_mode_attr reg_pred_prefix [(BI "gr") (QI "gr") (HI "gr") (SI "gr") (DI "grfr") (SF "grfr") (DF "grfr") (XF "fr") (TI "fr")])
482 (define_mode_attr ld_class [(BI "ld") (QI "ld") (HI "ld") (SI "ld") (DI "ld,fld") (SF "fld,ld") (DF "fld,ld") (XF "fld") (TI "fldp")])
483 (define_mode_attr chka_class [(BI "chk_a") (QI "chk_a") (HI "chk_a") (SI "chk_a") (DI "chk_a,chk_a") (SF "chk_a,chk_a") (DF "chk_a,chk_a") (XF "chk_a") (TI "chk_a")])
484 (define_mode_attr chks_class [(BI "chk_s_i") (QI "chk_s_i") (HI "chk_s_i") (SI "chk_s_i") (DI "chk_s_i,chk_s_f") (SF "chk_s_f,chk_s_i") (DF "chk_s_f,chk_s_i") (XF "chk_s_f") (TI "chk_s_i")])
486 (define_mode_attr attr_yes [(BI "yes") (QI "yes") (HI "yes") (SI "yes") (DI "yes,yes") (SF "yes,yes") (DF "yes,yes") (XF "yes") (TI "yes")])
488 (define_insn "mov<mode>_advanced"
489 [(set (match_operand:MODE 0 "<reg_pred_prefix>_register_operand" "<ld_reg_constr>")
490 (unspec:MODE [(match_operand:MODE 1 "memory_operand" "<mem_constr>")] UNSPEC_LDA))]
491 "ia64_move_ok (operands[0], operands[1])"
493 [(set_attr "itanium_class" "<ld_class>")
494 (set_attr "data_speculative" "<attr_yes>")])
496 (define_insn "zero_extend<mode>di2_advanced"
497 [(set (match_operand:DI 0 "gr_register_operand" "=r")
498 (zero_extend:DI (unspec:MODE_FOR_EXTEND [(match_operand:MODE_FOR_EXTEND 1 "memory_operand" "<mem_constr>")] UNSPEC_LDA)))]
501 [(set_attr "itanium_class" "<ld_class>")
502 (set_attr "data_speculative" "<attr_yes>")])
504 (define_insn "mov<mode>_speculative"
505 [(set (match_operand:MODE 0 "<reg_pred_prefix>_register_operand" "<ld_reg_constr>")
506 (unspec:MODE [(match_operand:MODE 1 "memory_operand" "<mem_constr>")] UNSPEC_LDS))]
507 "ia64_move_ok (operands[0], operands[1])"
509 [(set_attr "itanium_class" "<ld_class>")
510 (set_attr "control_speculative" "<attr_yes>")])
512 (define_insn "zero_extend<mode>di2_speculative"
513 [(set (match_operand:DI 0 "gr_register_operand" "=r")
514 (zero_extend:DI (unspec:MODE_FOR_EXTEND [(match_operand:MODE_FOR_EXTEND 1 "memory_operand" "<mem_constr>")] UNSPEC_LDS)))]
517 [(set_attr "itanium_class" "<ld_class>")
518 (set_attr "control_speculative" "<attr_yes>")])
520 (define_insn "mov<mode>_speculative_advanced"
521 [(set (match_operand:MODE 0 "<reg_pred_prefix>_register_operand" "<ld_reg_constr>")
522 (unspec:MODE [(match_operand:MODE 1 "memory_operand" "<mem_constr>")] UNSPEC_LDSA))]
523 "ia64_move_ok (operands[0], operands[1])"
525 [(set_attr "itanium_class" "<ld_class>")
526 (set_attr "data_speculative" "<attr_yes>")
527 (set_attr "control_speculative" "<attr_yes>")])
529 (define_insn "zero_extend<mode>di2_speculative_advanced"
530 [(set (match_operand:DI 0 "gr_register_operand" "=r")
531 (zero_extend:DI (unspec:MODE_FOR_EXTEND [(match_operand:MODE_FOR_EXTEND 1 "memory_operand" "<mem_constr>")] UNSPEC_LDSA)))]
534 [(set_attr "itanium_class" "<ld_class>")
535 (set_attr "data_speculative" "<attr_yes>")
536 (set_attr "control_speculative" "<attr_yes>")])
538 (define_insn "mov<mode>_clr"
539 [(set (match_operand:MODE 0 "<reg_pred_prefix>_register_operand" "<ldc_reg_constr>")
540 (if_then_else:MODE (ne (unspec [(match_dup 0)] UNSPEC_LDCCLR) (const_int 0))
541 (match_operand:MODE 1 "memory_operand" "<mem_constr>")
543 "ia64_move_ok (operands[0], operands[1])"
545 [(set_attr "itanium_class" "<ld_class>")
546 (set_attr "check_load" "<attr_yes>")])
548 (define_insn "zero_extend<mode>di2_clr"
549 [(set (match_operand:DI 0 "gr_register_operand" "+r")
550 (if_then_else:DI (ne (unspec [(match_dup 0)] UNSPEC_LDCCLR) (const_int 0))
551 (zero_extend:DI (match_operand:MODE_FOR_EXTEND 1 "memory_operand" "<mem_constr>"))
555 [(set_attr "itanium_class" "<ld_class>")
556 (set_attr "check_load" "<attr_yes>")])
558 (define_insn "advanced_load_check_clr_<mode>"
560 (if_then_else (ne (unspec [(match_operand:MODE 0 "<reg_pred_prefix>_register_operand" "<chk_reg_constr>")] UNSPEC_CHKACLR) (const_int 0))
562 (label_ref (match_operand 1 "" ""))))]
565 [(set_attr "itanium_class" "<chka_class>")])
567 (define_insn "speculation_check_<mode>"
569 (if_then_else (ne (unspec [(match_operand:MODE 0 "<reg_pred_prefix>_register_operand" "<chk_reg_constr>")] UNSPEC_CHKS) (const_int 0))
571 (label_ref (match_operand 1 "" ""))))]
574 [(set_attr "itanium_class" "<chks_class>")])
577 [(set (match_operand 0 "register_operand" "")
578 (match_operand 1 "symbolic_operand" ""))]
582 if (ia64_expand_load_address (operands[0], operands[1]))
588 (define_expand "load_fptr"
589 [(set (match_operand:DI 0 "register_operand" "")
590 (plus:DI (match_dup 2) (match_operand 1 "function_operand" "")))
591 (set (match_dup 0) (match_dup 3))]
594 operands[2] = pic_offset_table_rtx;
595 operands[3] = gen_const_mem (DImode, operands[0]);
598 (define_insn "*load_fptr_internal1"
599 [(set (match_operand:DI 0 "register_operand" "=r")
600 (plus:DI (reg:DI 1) (match_operand 1 "function_operand" "s")))]
602 "addl %0 = @ltoff(@fptr(%1)), gp"
603 [(set_attr "itanium_class" "ialu")])
605 (define_insn "load_gprel"
606 [(set (match_operand:DI 0 "register_operand" "=r")
607 (plus:DI (reg:DI 1) (match_operand 1 "sdata_symbolic_operand" "s")))]
609 "addl %0 = @gprel(%1), gp"
610 [(set_attr "itanium_class" "ialu")])
612 (define_insn "*gprel64_offset"
613 [(set (match_operand:DI 0 "register_operand" "=r")
614 (minus:DI (match_operand:DI 1 "symbolic_operand" "") (reg:DI 1)))]
616 "movl %0 = @gprel(%1)"
617 [(set_attr "itanium_class" "long_i")])
619 (define_expand "load_gprel64"
620 [(set (match_operand:DI 0 "register_operand" "")
621 (minus:DI (match_operand:DI 1 "symbolic_operand" "") (match_dup 2)))
623 (plus:DI (match_dup 2) (match_dup 0)))]
626 operands[2] = pic_offset_table_rtx;
629 ;; This is used as a placeholder for the return address during early
630 ;; compilation. We won't know where we've placed this until during
631 ;; reload, at which point it can wind up in b0, a general register,
632 ;; or memory. The only safe destination under these conditions is a
635 (define_insn_and_split "*movdi_ret_addr"
636 [(set (match_operand:DI 0 "register_operand" "=r")
637 (unspec:DI [(const_int 0)] UNSPEC_RET_ADDR))]
643 ia64_split_return_addr_rtx (operands[0]);
646 [(set_attr "itanium_class" "ialu")])
648 (define_insn "*load_symptr_high"
649 [(set (match_operand:DI 0 "register_operand" "=r")
650 (plus:DI (high:DI (match_operand 1 "got_symbolic_operand" "s"))
651 (match_operand:DI 2 "register_operand" "a")))]
654 if (HAVE_AS_LTOFFX_LDXMOV_RELOCS)
655 return "%,addl %0 = @ltoffx(%1), %2";
657 return "%,addl %0 = @ltoff(%1), %2";
659 [(set_attr "itanium_class" "ialu")])
661 (define_insn "*load_symptr_low"
662 [(set (match_operand:DI 0 "register_operand" "=r")
663 (lo_sum:DI (match_operand:DI 1 "register_operand" "r")
664 (match_operand 2 "got_symbolic_operand" "s")))]
667 if (HAVE_AS_LTOFFX_LDXMOV_RELOCS)
668 return "%,ld8.mov %0 = [%1], %2";
670 return "%,ld8 %0 = [%1]";
672 [(set_attr "itanium_class" "ld")])
674 (define_insn_and_split "load_dtpmod"
675 [(set (match_operand:DI 0 "register_operand" "=r")
676 (unspec:DI [(match_operand 1 "tls_symbolic_operand" "")]
682 (plus:DI (unspec:DI [(match_dup 1)] UNSPEC_LTOFF_DTPMOD)
684 (set (match_dup 0) (match_dup 3))]
686 operands[2] = pic_offset_table_rtx;
687 operands[3] = gen_const_mem (DImode, operands[0]);
690 (define_insn "*load_ltoff_dtpmod"
691 [(set (match_operand:DI 0 "register_operand" "=r")
692 (plus:DI (unspec:DI [(match_operand 1 "tls_symbolic_operand" "")]
694 (match_operand:DI 2 "register_operand" "a")))]
696 "addl %0 = @ltoff(@dtpmod(%1)), %2"
697 [(set_attr "itanium_class" "ialu")])
699 (define_expand "load_dtprel"
700 [(set (match_operand:DI 0 "register_operand" "")
701 (unspec:DI [(match_operand 1 "tls_symbolic_operand" "")]
706 (define_insn "*load_dtprel64"
707 [(set (match_operand:DI 0 "register_operand" "=r")
708 (unspec:DI [(match_operand 1 "ld_tls_symbolic_operand" "")]
711 "movl %0 = @dtprel(%1)"
712 [(set_attr "itanium_class" "long_i")])
714 (define_insn "*load_dtprel22"
715 [(set (match_operand:DI 0 "register_operand" "=r")
716 (unspec:DI [(match_operand 1 "ld_tls_symbolic_operand" "")]
719 "addl %0 = @dtprel(%1), r0"
720 [(set_attr "itanium_class" "ialu")])
722 (define_insn_and_split "*load_dtprel_gd"
723 [(set (match_operand:DI 0 "register_operand" "=r")
724 (unspec:DI [(match_operand 1 "tls_symbolic_operand" "")]
730 (plus:DI (unspec:DI [(match_dup 1)] UNSPEC_LTOFF_DTPREL)
732 (set (match_dup 0) (match_dup 3))]
734 operands[2] = pic_offset_table_rtx;
735 operands[3] = gen_const_mem (DImode, operands[0]);
738 (define_insn "*load_ltoff_dtprel"
739 [(set (match_operand:DI 0 "register_operand" "=r")
740 (plus:DI (unspec:DI [(match_operand 1 "tls_symbolic_operand" "")]
742 (match_operand:DI 2 "register_operand" "a")))]
744 "addl %0 = @ltoff(@dtprel(%1)), %2"
745 [(set_attr "itanium_class" "ialu")])
747 (define_expand "add_dtprel"
748 [(set (match_operand:DI 0 "register_operand" "")
749 (plus:DI (unspec:DI [(match_operand 1 "ld_tls_symbolic_operand" "")]
751 (match_operand:DI 2 "register_operand" "")))]
755 (define_insn "*add_dtprel14"
756 [(set (match_operand:DI 0 "register_operand" "=r")
757 (plus:DI (unspec:DI [(match_operand 1 "ld_tls_symbolic_operand" "")]
759 (match_operand:DI 2 "register_operand" "r")))]
761 "adds %0 = @dtprel(%1), %2"
762 [(set_attr "itanium_class" "ialu")])
764 (define_insn "*add_dtprel22"
765 [(set (match_operand:DI 0 "register_operand" "=r")
766 (plus:DI (unspec:DI [(match_operand 1 "ld_tls_symbolic_operand" "")]
768 (match_operand:DI 2 "register_operand" "a")))]
770 "addl %0 = @dtprel(%1), %2"
771 [(set_attr "itanium_class" "ialu")])
773 (define_expand "load_tprel"
774 [(set (match_operand:DI 0 "register_operand" "")
775 (unspec:DI [(match_operand 1 "tls_symbolic_operand" "")]
780 (define_insn "*load_tprel64"
781 [(set (match_operand:DI 0 "register_operand" "=r")
782 (unspec:DI [(match_operand 1 "le_tls_symbolic_operand" "")]
785 "movl %0 = @tprel(%1)"
786 [(set_attr "itanium_class" "long_i")])
788 (define_insn "*load_tprel22"
789 [(set (match_operand:DI 0 "register_operand" "=r")
790 (unspec:DI [(match_operand 1 "le_tls_symbolic_operand" "")]
793 "addl %0 = @tprel(%1), r0"
794 [(set_attr "itanium_class" "ialu")])
796 (define_insn_and_split "*load_tprel_ie"
797 [(set (match_operand:DI 0 "register_operand" "=r")
798 (unspec:DI [(match_operand 1 "ie_tls_symbolic_operand" "")]
804 (plus:DI (unspec:DI [(match_dup 1)] UNSPEC_LTOFF_TPREL)
806 (set (match_dup 0) (match_dup 3))]
808 operands[2] = pic_offset_table_rtx;
809 operands[3] = gen_const_mem (DImode, operands[0]);
812 (define_insn "*load_ltoff_tprel"
813 [(set (match_operand:DI 0 "register_operand" "=r")
814 (plus:DI (unspec:DI [(match_operand 1 "ie_tls_symbolic_operand" "")]
816 (match_operand:DI 2 "register_operand" "a")))]
818 "addl %0 = @ltoff(@tprel(%1)), %2"
819 [(set_attr "itanium_class" "ialu")])
821 (define_expand "add_tprel"
822 [(set (match_operand:DI 0 "register_operand" "")
823 (plus:DI (unspec:DI [(match_operand 1 "le_tls_symbolic_operand" "")]
825 (match_operand:DI 2 "register_operand" "")))]
829 (define_insn "*add_tprel14"
830 [(set (match_operand:DI 0 "register_operand" "=r")
831 (plus:DI (unspec:DI [(match_operand 1 "le_tls_symbolic_operand" "")]
833 (match_operand:DI 2 "register_operand" "r")))]
835 "adds %0 = @tprel(%1), %2"
836 [(set_attr "itanium_class" "ialu")])
838 (define_insn "*add_tprel22"
839 [(set (match_operand:DI 0 "register_operand" "=r")
840 (plus:DI (unspec:DI [(match_operand 1 "le_tls_symbolic_operand" "")]
842 (match_operand:DI 2 "register_operand" "a")))]
844 "addl %0 = @tprel(%1), %2"
845 [(set_attr "itanium_class" "ialu")])
847 ;; With no offsettable memory references, we've got to have a scratch
848 ;; around to play with the second word. However, in order to avoid a
849 ;; reload nightmare we lie, claim we don't need one, and fix it up
850 ;; in ia64_split_tmode_move.
851 (define_expand "movti"
852 [(set (match_operand:TI 0 "general_operand" "")
853 (match_operand:TI 1 "general_operand" ""))]
856 rtx op1 = ia64_expand_move (operands[0], operands[1]);
862 (define_insn_and_split "*movti_internal"
863 [(set (match_operand:TI 0 "destination_operand" "=r, *fm,*x,*f, Q")
864 (match_operand:TI 1 "general_operand" "r*fim,r, Q, *fOQ,*f"))]
865 "ia64_move_ok (operands[0], operands[1])"
872 "reload_completed && !ia64_load_pair_ok(operands[0], operands[1])"
875 ia64_split_tmode_move (operands);
878 [(set_attr "itanium_class" "unknown,unknown,fldp,unknown,unknown")])
880 ;; Floating Point Moves
882 ;; Note - Patterns for SF mode moves are compulsory, but
883 ;; patterns for DF are optional, as GCC can synthesize them.
885 (define_expand "movsf"
886 [(set (match_operand:SF 0 "general_operand" "")
887 (match_operand:SF 1 "general_operand" ""))]
890 rtx op1 = ia64_expand_move (operands[0], operands[1]);
896 (define_insn "*movsf_internal"
897 [(set (match_operand:SF 0 "destination_operand" "=f,f, Q,*r, f,*r,*r, m")
898 (match_operand:SF 1 "general_operand" "fG,Q,fG,fG,*r,*r, m,*r"))]
899 "ia64_move_ok (operands[0], operands[1])"
909 [(set_attr "itanium_class" "fmisc,fld,stf,frfr,tofr,ialu,ld,st")])
911 (define_expand "movdf"
912 [(set (match_operand:DF 0 "general_operand" "")
913 (match_operand:DF 1 "general_operand" ""))]
916 rtx op1 = ia64_expand_move (operands[0], operands[1]);
922 (define_insn "*movdf_internal"
923 [(set (match_operand:DF 0 "destination_operand" "=f,f, Q,*r, f,*r,*r, m")
924 (match_operand:DF 1 "general_operand" "fG,Q,fG,fG,*r,*r, m,*r"))]
925 "ia64_move_ok (operands[0], operands[1])"
935 [(set_attr "itanium_class" "fmisc,fld,stf,frfr,tofr,ialu,ld,st")])
937 ;; With no offsettable memory references, we've got to have a scratch
938 ;; around to play with the second word if the variable winds up in GRs.
939 (define_expand "movxf"
940 [(set (match_operand:XF 0 "general_operand" "")
941 (match_operand:XF 1 "general_operand" ""))]
944 if (ia64_expand_movxf_movrf (XFmode, operands))
948 ;; ??? There's no easy way to mind volatile acquire/release semantics.
950 (define_insn "*movxf_internal"
951 [(set (match_operand:XF 0 "destination_operand" "=f,f, m")
952 (match_operand:XF 1 "general_operand" "fG,m,fG"))]
953 "ia64_move_ok (operands[0], operands[1])"
958 [(set_attr "itanium_class" "fmisc,fld,stf")])
960 ;; Same as for movxf, but for RFmode.
961 (define_expand "movrf"
962 [(set (match_operand:RF 0 "general_operand" "")
963 (match_operand:RF 1 "general_operand" ""))]
966 if (ia64_expand_movxf_movrf (RFmode, operands))
970 (define_insn "*movrf_internal"
971 [(set (match_operand:RF 0 "destination_operand" "=f,f, m")
972 (match_operand:RF 1 "general_operand" "fG,m,fG"))]
973 "ia64_move_ok (operands[0], operands[1])"
977 stf.spill %0 = %F1%P0"
978 [(set_attr "itanium_class" "fmisc,fld,stf")])
980 ;; Better code generation via insns that deal with TFmode register pairs
981 ;; directly. Same concerns apply as for TImode.
982 (define_expand "movtf"
983 [(set (match_operand:TF 0 "general_operand" "")
984 (match_operand:TF 1 "general_operand" ""))]
987 rtx op1 = ia64_expand_move (operands[0], operands[1]);
993 (define_insn_and_split "*movtf_internal"
994 [(set (match_operand:TF 0 "destination_operand" "=r,r,m")
995 (match_operand:TF 1 "general_operand" "ri,m,r"))]
996 "ia64_move_ok (operands[0], operands[1])"
1001 ia64_split_tmode_move (operands);
1004 [(set_attr "itanium_class" "unknown")
1005 (set_attr "predicable" "no")])
1008 ;; ::::::::::::::::::::
1012 ;; ::::::::::::::::::::
1014 ;; Signed conversions from a smaller integer to a larger integer
1016 (define_insn "extendqidi2"
1017 [(set (match_operand:DI 0 "gr_register_operand" "=r")
1018 (sign_extend:DI (match_operand:QI 1 "gr_register_operand" "r")))]
1021 [(set_attr "itanium_class" "xtd")])
1023 (define_insn "extendhidi2"
1024 [(set (match_operand:DI 0 "gr_register_operand" "=r")
1025 (sign_extend:DI (match_operand:HI 1 "gr_register_operand" "r")))]
1028 [(set_attr "itanium_class" "xtd")])
1030 (define_insn "extendsidi2"
1031 [(set (match_operand:DI 0 "grfr_register_operand" "=r,?f")
1032 (sign_extend:DI (match_operand:SI 1 "grfr_register_operand" "r,f")))]
1037 [(set_attr "itanium_class" "xtd,fmisc")])
1039 ;; Unsigned conversions from a smaller integer to a larger integer
1041 (define_insn "zero_extendqidi2"
1042 [(set (match_operand:DI 0 "gr_register_operand" "=r,r")
1043 (zero_extend:DI (match_operand:QI 1 "gr_nonimmediate_operand" "r,m")))]
1048 [(set_attr "itanium_class" "xtd,ld")])
1050 (define_insn "zero_extendhidi2"
1051 [(set (match_operand:DI 0 "gr_register_operand" "=r,r")
1052 (zero_extend:DI (match_operand:HI 1 "gr_nonimmediate_operand" "r,m")))]
1057 [(set_attr "itanium_class" "xtd,ld")])
1059 (define_insn "zero_extendsidi2"
1060 [(set (match_operand:DI 0 "grfr_register_operand" "=r,r,?f")
1062 (match_operand:SI 1 "grfr_nonimmediate_operand" "r,m,f")))]
1068 [(set_attr "itanium_class" "ialu,ld,fmisc")])
1070 ;; Convert between floating point types of different sizes.
1072 ;; At first glance, it would appear that emitting fnorm for an extending
1073 ;; conversion is unnecessary. However, the stf and getf instructions work
1074 ;; correctly only if the input is properly rounded for its type. In
1075 ;; particular, we get the wrong result for getf.d/stfd if the input is a
1076 ;; denorm single. Since we don't know what the next instruction will be, we
1077 ;; have to emit an fnorm.
1079 ;; ??? Optimization opportunity here. Get rid of the insn altogether
1080 ;; when we can. Should probably use a scheme like has been proposed
1081 ;; for ia32 in dealing with operands that match unary operators. This
1082 ;; would let combine merge the thing into adjacent insns. See also how the
1083 ;; mips port handles SIGN_EXTEND as operands to integer arithmetic insns via
1084 ;; se_register_operand.
1086 (define_insn "extendsfdf2"
1087 [(set (match_operand:DF 0 "fr_register_operand" "=f")
1088 (float_extend:DF (match_operand:SF 1 "fr_register_operand" "f")))]
1091 [(set_attr "itanium_class" "fmac")])
1093 (define_insn "extendsfxf2"
1094 [(set (match_operand:XF 0 "fr_register_operand" "=f")
1095 (float_extend:XF (match_operand:SF 1 "fr_register_operand" "f")))]
1098 [(set_attr "itanium_class" "fmac")])
1100 (define_insn "extenddfxf2"
1101 [(set (match_operand:XF 0 "fr_register_operand" "=f")
1102 (float_extend:XF (match_operand:DF 1 "fr_register_operand" "f")))]
1105 [(set_attr "itanium_class" "fmac")])
1107 (define_insn "truncdfsf2"
1108 [(set (match_operand:SF 0 "fr_register_operand" "=f")
1109 (float_truncate:SF (match_operand:DF 1 "fr_register_operand" "f")))]
1112 [(set_attr "itanium_class" "fmac")])
1114 (define_insn "truncxfsf2"
1115 [(set (match_operand:SF 0 "fr_register_operand" "=f")
1116 (float_truncate:SF (match_operand:XF 1 "fr_register_operand" "f")))]
1119 [(set_attr "itanium_class" "fmac")])
1121 (define_insn "truncxfdf2"
1122 [(set (match_operand:DF 0 "fr_register_operand" "=f")
1123 (float_truncate:DF (match_operand:XF 1 "fr_register_operand" "f")))]
1126 [(set_attr "itanium_class" "fmac")])
1128 ;; Convert between signed integer types and floating point.
1130 (define_insn "floatdixf2"
1131 [(set (match_operand:XF 0 "fr_register_operand" "=f")
1132 (float:XF (match_operand:DI 1 "fr_register_operand" "f")))]
1135 [(set_attr "itanium_class" "fcvtfx")])
1137 (define_insn "fix_truncsfdi2"
1138 [(set (match_operand:DI 0 "fr_register_operand" "=f")
1139 (fix:DI (match_operand:SF 1 "fr_register_operand" "f")))]
1141 "fcvt.fx.trunc %0 = %1"
1142 [(set_attr "itanium_class" "fcvtfx")])
1144 (define_insn "fix_truncdfdi2"
1145 [(set (match_operand:DI 0 "fr_register_operand" "=f")
1146 (fix:DI (match_operand:DF 1 "fr_register_operand" "f")))]
1148 "fcvt.fx.trunc %0 = %1"
1149 [(set_attr "itanium_class" "fcvtfx")])
1151 (define_insn "fix_truncxfdi2"
1152 [(set (match_operand:DI 0 "fr_register_operand" "=f")
1153 (fix:DI (match_operand:XF 1 "fr_register_operand" "f")))]
1155 "fcvt.fx.trunc %0 = %1"
1156 [(set_attr "itanium_class" "fcvtfx")])
1158 (define_insn "fix_truncxfdi2_alts"
1159 [(set (match_operand:DI 0 "fr_register_operand" "=f")
1160 (fix:DI (match_operand:XF 1 "fr_register_operand" "f")))
1161 (use (match_operand:SI 2 "const_int_operand" ""))]
1163 "fcvt.fx.trunc.s%2 %0 = %1"
1164 [(set_attr "itanium_class" "fcvtfx")])
1166 ;; Convert between unsigned integer types and floating point.
1168 (define_insn "floatunsdisf2"
1169 [(set (match_operand:SF 0 "fr_register_operand" "=f")
1170 (unsigned_float:SF (match_operand:DI 1 "fr_register_operand" "f")))]
1172 "fcvt.xuf.s %0 = %1"
1173 [(set_attr "itanium_class" "fcvtfx")])
1175 (define_insn "floatunsdidf2"
1176 [(set (match_operand:DF 0 "fr_register_operand" "=f")
1177 (unsigned_float:DF (match_operand:DI 1 "fr_register_operand" "f")))]
1179 "fcvt.xuf.d %0 = %1"
1180 [(set_attr "itanium_class" "fcvtfx")])
1182 (define_insn "floatunsdixf2"
1183 [(set (match_operand:XF 0 "fr_register_operand" "=f")
1184 (unsigned_float:XF (match_operand:DI 1 "fr_register_operand" "f")))]
1187 [(set_attr "itanium_class" "fcvtfx")])
1189 (define_insn "fixuns_truncsfdi2"
1190 [(set (match_operand:DI 0 "fr_register_operand" "=f")
1191 (unsigned_fix:DI (match_operand:SF 1 "fr_register_operand" "f")))]
1193 "fcvt.fxu.trunc %0 = %1"
1194 [(set_attr "itanium_class" "fcvtfx")])
1196 (define_insn "fixuns_truncdfdi2"
1197 [(set (match_operand:DI 0 "fr_register_operand" "=f")
1198 (unsigned_fix:DI (match_operand:DF 1 "fr_register_operand" "f")))]
1200 "fcvt.fxu.trunc %0 = %1"
1201 [(set_attr "itanium_class" "fcvtfx")])
1203 (define_insn "fixuns_truncxfdi2"
1204 [(set (match_operand:DI 0 "fr_register_operand" "=f")
1205 (unsigned_fix:DI (match_operand:XF 1 "fr_register_operand" "f")))]
1207 "fcvt.fxu.trunc %0 = %1"
1208 [(set_attr "itanium_class" "fcvtfx")])
1210 (define_insn "fixuns_truncxfdi2_alts"
1211 [(set (match_operand:DI 0 "fr_register_operand" "=f")
1212 (unsigned_fix:DI (match_operand:XF 1 "fr_register_operand" "f")))
1213 (use (match_operand:SI 2 "const_int_operand" ""))]
1215 "fcvt.fxu.trunc.s%2 %0 = %1"
1216 [(set_attr "itanium_class" "fcvtfx")])
1218 ;; ::::::::::::::::::::
1220 ;; :: Bit field extraction
1222 ;; ::::::::::::::::::::
1225 [(set (match_operand:DI 0 "gr_register_operand" "=r")
1226 (sign_extract:DI (match_operand:DI 1 "gr_register_operand" "r")
1227 (match_operand:DI 2 "extr_len_operand" "n")
1228 (match_operand:DI 3 "shift_count_operand" "M")))]
1230 "extr %0 = %1, %3, %2"
1231 [(set_attr "itanium_class" "ishf")])
1233 (define_insn "extzv"
1234 [(set (match_operand:DI 0 "gr_register_operand" "=r")
1235 (zero_extract:DI (match_operand:DI 1 "gr_register_operand" "r")
1236 (match_operand:DI 2 "extr_len_operand" "n")
1237 (match_operand:DI 3 "shift_count_operand" "M")))]
1239 "extr.u %0 = %1, %3, %2"
1240 [(set_attr "itanium_class" "ishf")])
1242 ;; Insert a bit field.
1243 ;; Can have 3 operands, source1 (inserter), source2 (insertee), dest.
1244 ;; Source1 can be 0 or -1.
1245 ;; Source2 can be 0.
1247 ;; ??? Actual dep instruction is more powerful than what these insv
1248 ;; patterns support. Unfortunately, combine is unable to create patterns
1249 ;; where source2 != dest.
1251 (define_expand "insv"
1252 [(set (zero_extract:DI (match_operand:DI 0 "gr_register_operand" "")
1253 (match_operand:DI 1 "const_int_operand" "")
1254 (match_operand:DI 2 "const_int_operand" ""))
1255 (match_operand:DI 3 "nonmemory_operand" ""))]
1258 int width = INTVAL (operands[1]);
1259 int shift = INTVAL (operands[2]);
1261 /* If operand[3] is a constant, and isn't 0 or -1, then load it into a
1263 if (! register_operand (operands[3], DImode)
1264 && operands[3] != const0_rtx && operands[3] != constm1_rtx)
1265 operands[3] = force_reg (DImode, operands[3]);
1267 /* If this is a single dep instruction, we have nothing to do. */
1268 if (! ((register_operand (operands[3], DImode) && width <= 16)
1269 || operands[3] == const0_rtx || operands[3] == constm1_rtx))
1271 /* Check for cases that can be implemented with a mix instruction. */
1272 if (width == 32 && shift == 0)
1274 /* Directly generating the mix4left instruction confuses
1275 optimize_bit_field in function.c. Since this is performing
1276 a useful optimization, we defer generation of the complicated
1277 mix4left RTL to the first splitting phase. */
1278 rtx tmp = gen_reg_rtx (DImode);
1279 emit_insn (gen_shift_mix4left (operands[0], operands[3], tmp));
1282 else if (width == 32 && shift == 32)
1284 emit_insn (gen_mix4right (operands[0], operands[3]));
1288 /* We could handle remaining cases by emitting multiple dep
1291 If we need more than two dep instructions then we lose. A 6
1292 insn sequence mov mask1,mov mask2,shl;;and,and;;or is better than
1293 mov;;dep,shr;;dep,shr;;dep. The former can be executed in 3 cycles,
1294 the latter is 6 cycles on an Itanium (TM) processor, because there is
1295 only one function unit that can execute dep and shr immed.
1297 If we only need two dep instruction, then we still lose.
1298 mov;;dep,shr;;dep is still 4 cycles. Even if we optimize away
1299 the unnecessary mov, this is still undesirable because it will be
1300 hard to optimize, and it creates unnecessary pressure on the I0
1306 /* This code may be useful for other IA-64 processors, so we leave it in
1312 emit_insn (gen_insv (operands[0], GEN_INT (16), GEN_INT (shift),
1316 tmp = gen_reg_rtx (DImode);
1317 emit_insn (gen_lshrdi3 (tmp, operands[3], GEN_INT (16)));
1320 operands[1] = GEN_INT (width);
1321 operands[2] = GEN_INT (shift);
1326 (define_insn "*insv_internal"
1327 [(set (zero_extract:DI (match_operand:DI 0 "gr_register_operand" "+r")
1328 (match_operand:DI 1 "const_int_operand" "n")
1329 (match_operand:DI 2 "const_int_operand" "n"))
1330 (match_operand:DI 3 "nonmemory_operand" "rP"))]
1331 "(gr_register_operand (operands[3], DImode) && INTVAL (operands[1]) <= 16)
1332 || operands[3] == const0_rtx || operands[3] == constm1_rtx"
1333 "dep %0 = %3, %0, %2, %1"
1334 [(set_attr "itanium_class" "ishf")])
1336 ;; Combine doesn't like to create bit-field insertions into zero.
1337 (define_insn "*shladdp4_internal"
1338 [(set (match_operand:DI 0 "gr_register_operand" "=r")
1339 (and:DI (ashift:DI (match_operand:DI 1 "gr_register_operand" "r")
1340 (match_operand:DI 2 "shladd_log2_operand" "n"))
1341 (match_operand:DI 3 "const_int_operand" "n")))]
1342 "ia64_depz_field_mask (operands[3], operands[2]) + INTVAL (operands[2]) == 32"
1343 "shladdp4 %0 = %1, %2, r0"
1344 [(set_attr "itanium_class" "ialu")])
1346 (define_insn "*depz_internal"
1347 [(set (match_operand:DI 0 "gr_register_operand" "=r")
1348 (and:DI (ashift:DI (match_operand:DI 1 "gr_register_operand" "r")
1349 (match_operand:DI 2 "const_int_operand" "M"))
1350 (match_operand:DI 3 "const_int_operand" "n")))]
1351 "satisfies_constraint_M (operands[2])
1352 && ia64_depz_field_mask (operands[3], operands[2]) > 0"
1354 operands[3] = GEN_INT (ia64_depz_field_mask (operands[3], operands[2]));
1355 return "%,dep.z %0 = %1, %2, %3";
1357 [(set_attr "itanium_class" "ishf")])
1359 (define_insn "shift_mix4left"
1360 [(set (zero_extract:DI (match_operand:DI 0 "gr_register_operand" "+r")
1361 (const_int 32) (const_int 0))
1362 (match_operand:DI 1 "gr_register_operand" "r"))
1363 (clobber (match_operand:DI 2 "gr_register_operand" "=r"))]
1366 [(set_attr "itanium_class" "unknown")])
1369 [(set (zero_extract:DI (match_operand:DI 0 "register_operand" "")
1370 (const_int 32) (const_int 0))
1371 (match_operand:DI 1 "register_operand" ""))
1372 (clobber (match_operand:DI 2 "register_operand" ""))]
1374 [(set (match_dup 3) (ashift:DI (match_dup 1) (const_int 32)))
1375 (set (zero_extract:DI (match_dup 0) (const_int 32) (const_int 0))
1376 (lshiftrt:DI (match_dup 3) (const_int 32)))]
1377 "operands[3] = operands[2];")
1379 (define_insn "*mix4left"
1380 [(set (zero_extract:DI (match_operand:DI 0 "gr_register_operand" "+r")
1381 (const_int 32) (const_int 0))
1382 (lshiftrt:DI (match_operand:DI 1 "gr_register_operand" "r")
1385 "mix4.l %0 = %0, %r1"
1386 [(set_attr "itanium_class" "mmshf")])
1388 (define_insn "mix4right"
1389 [(set (zero_extract:DI (match_operand:DI 0 "gr_register_operand" "+r")
1390 (const_int 32) (const_int 32))
1391 (match_operand:DI 1 "gr_reg_or_0_operand" "rO"))]
1393 "mix4.r %0 = %r1, %0"
1394 [(set_attr "itanium_class" "mmshf")])
1396 ;; This is used by the rotrsi3 pattern.
1398 (define_insn "*mix4right_3op"
1399 [(set (match_operand:DI 0 "gr_register_operand" "=r")
1400 (ior:DI (zero_extend:DI (match_operand:SI 1 "gr_register_operand" "r"))
1401 (ashift:DI (zero_extend:DI
1402 (match_operand:SI 2 "gr_register_operand" "r"))
1405 "mix4.r %0 = %2, %1"
1406 [(set_attr "itanium_class" "mmshf")])
1409 ;; ::::::::::::::::::::
1411 ;; :: 1-bit Integer arithmetic
1413 ;; ::::::::::::::::::::
1415 (define_insn_and_split "andbi3"
1416 [(set (match_operand:BI 0 "register_operand" "=c,c,r")
1417 (and:BI (match_operand:BI 1 "register_operand" "%0,0,r")
1418 (match_operand:BI 2 "register_operand" "c,r,r")))]
1422 tbit.nz.and.orcm %0, %I0 = %2, 0
1425 && GET_CODE (operands[0]) == REG && PR_REGNO_P (REGNO (operands[0]))
1426 && GET_CODE (operands[2]) == REG && PR_REGNO_P (REGNO (operands[2]))"
1427 [(cond_exec (eq (match_dup 2) (const_int 0))
1428 (set (match_dup 0) (and:BI (ne:BI (const_int 0) (const_int 0))
1431 [(set_attr "itanium_class" "unknown,tbit,ilog")])
1433 (define_insn_and_split "*andcmbi3"
1434 [(set (match_operand:BI 0 "register_operand" "=c,c,r")
1435 (and:BI (not:BI (match_operand:BI 1 "register_operand" "c,r,r"))
1436 (match_operand:BI 2 "register_operand" "0,0,r")))]
1440 tbit.z.and.orcm %0, %I0 = %1, 0
1443 && GET_CODE (operands[0]) == REG && PR_REGNO_P (REGNO (operands[0]))
1444 && GET_CODE (operands[1]) == REG && PR_REGNO_P (REGNO (operands[1]))"
1445 [(cond_exec (ne (match_dup 1) (const_int 0))
1446 (set (match_dup 0) (and:BI (ne:BI (const_int 0) (const_int 0))
1449 [(set_attr "itanium_class" "unknown,tbit,ilog")])
1451 (define_insn_and_split "iorbi3"
1452 [(set (match_operand:BI 0 "register_operand" "=c,c,r")
1453 (ior:BI (match_operand:BI 1 "register_operand" "%0,0,r")
1454 (match_operand:BI 2 "register_operand" "c,r,r")))]
1458 tbit.nz.or.andcm %0, %I0 = %2, 0
1461 && GET_CODE (operands[0]) == REG && PR_REGNO_P (REGNO (operands[0]))
1462 && GET_CODE (operands[2]) == REG && PR_REGNO_P (REGNO (operands[2]))"
1463 [(cond_exec (ne (match_dup 2) (const_int 0))
1464 (set (match_dup 0) (ior:BI (eq:BI (const_int 0) (const_int 0))
1467 [(set_attr "itanium_class" "unknown,tbit,ilog")])
1469 (define_insn_and_split "*iorcmbi3"
1470 [(set (match_operand:BI 0 "register_operand" "=c,c")
1471 (ior:BI (not:BI (match_operand:BI 1 "register_operand" "c,r"))
1472 (match_operand:BI 2 "register_operand" "0,0")))]
1476 tbit.z.or.andcm %0, %I0 = %1, 0"
1478 && GET_CODE (operands[0]) == REG && PR_REGNO_P (REGNO (operands[0]))
1479 && GET_CODE (operands[1]) == REG && PR_REGNO_P (REGNO (operands[1]))"
1480 [(cond_exec (eq (match_dup 1) (const_int 0))
1481 (set (match_dup 0) (ior:BI (eq:BI (const_int 0) (const_int 0))
1484 [(set_attr "itanium_class" "unknown,tbit")])
1486 (define_insn "one_cmplbi2"
1487 [(set (match_operand:BI 0 "register_operand" "=c,r,c,&c")
1488 (not:BI (match_operand:BI 1 "register_operand" "r,r,0,c")))
1489 (clobber (match_scratch:BI 2 "=X,X,c,X"))]
1492 tbit.z %0, %I0 = %1, 0
1496 [(set_attr "itanium_class" "tbit,ilog,unknown,unknown")])
1499 [(set (match_operand:BI 0 "register_operand" "")
1500 (not:BI (match_operand:BI 1 "register_operand" "")))
1501 (clobber (match_scratch:BI 2 ""))]
1503 && GET_CODE (operands[0]) == REG && PR_REGNO_P (REGNO (operands[0]))
1504 && rtx_equal_p (operands[0], operands[1])"
1505 [(set (match_dup 4) (match_dup 3))
1506 (set (match_dup 0) (const_int 1))
1507 (cond_exec (ne (match_dup 2) (const_int 0))
1508 (set (match_dup 0) (const_int 0)))
1509 (set (match_dup 0) (unspec:BI [(match_dup 0)] UNSPEC_PRED_REL_MUTEX))]
1510 "operands[3] = gen_rtx_REG (CCImode, REGNO (operands[1]));
1511 operands[4] = gen_rtx_REG (CCImode, REGNO (operands[2]));")
1514 [(set (match_operand:BI 0 "register_operand" "")
1515 (not:BI (match_operand:BI 1 "register_operand" "")))
1516 (clobber (match_scratch:BI 2 ""))]
1518 && GET_CODE (operands[0]) == REG && PR_REGNO_P (REGNO (operands[0]))
1519 && GET_CODE (operands[1]) == REG && PR_REGNO_P (REGNO (operands[1]))
1520 && ! rtx_equal_p (operands[0], operands[1])"
1521 [(cond_exec (ne (match_dup 1) (const_int 0))
1522 (set (match_dup 0) (const_int 0)))
1523 (cond_exec (eq (match_dup 1) (const_int 0))
1524 (set (match_dup 0) (const_int 1)))
1525 (set (match_dup 0) (unspec:BI [(match_dup 0)] UNSPEC_PRED_REL_MUTEX))]
1528 (define_insn "*cmpsi_and_0"
1529 [(set (match_operand:BI 0 "register_operand" "=c")
1530 (and:BI (match_operator:BI 4 "predicate_operator"
1531 [(match_operand:SI 2 "gr_reg_or_0_operand" "rO")
1532 (match_operand:SI 3 "gr_reg_or_8bit_operand" "rK")])
1533 (match_operand:BI 1 "register_operand" "0")))]
1535 "cmp4.%C4.and.orcm %0, %I0 = %3, %r2"
1536 [(set_attr "itanium_class" "icmp")])
1538 (define_insn "*cmpsi_and_1"
1539 [(set (match_operand:BI 0 "register_operand" "=c")
1540 (and:BI (match_operator:BI 3 "signed_inequality_operator"
1541 [(match_operand:SI 2 "gr_register_operand" "r")
1543 (match_operand:BI 1 "register_operand" "0")))]
1545 "cmp4.%C3.and.orcm %0, %I0 = r0, %2"
1546 [(set_attr "itanium_class" "icmp")])
1548 (define_insn "*cmpsi_andnot_0"
1549 [(set (match_operand:BI 0 "register_operand" "=c")
1550 (and:BI (not:BI (match_operator:BI 4 "predicate_operator"
1551 [(match_operand:SI 2 "gr_reg_or_0_operand" "rO")
1552 (match_operand:SI 3 "gr_reg_or_8bit_operand" "rK")]))
1553 (match_operand:BI 1 "register_operand" "0")))]
1555 "cmp4.%C4.or.andcm %I0, %0 = %3, %r2"
1556 [(set_attr "itanium_class" "icmp")])
1558 (define_insn "*cmpsi_andnot_1"
1559 [(set (match_operand:BI 0 "register_operand" "=c")
1560 (and:BI (not:BI (match_operator:BI 3 "signed_inequality_operator"
1561 [(match_operand:SI 2 "gr_register_operand" "r")
1563 (match_operand:BI 1 "register_operand" "0")))]
1565 "cmp4.%C3.or.andcm %I0, %0 = r0, %2"
1566 [(set_attr "itanium_class" "icmp")])
1568 (define_insn "*cmpdi_and_0"
1569 [(set (match_operand:BI 0 "register_operand" "=c")
1570 (and:BI (match_operator:BI 4 "predicate_operator"
1571 [(match_operand:DI 2 "gr_register_operand" "r")
1572 (match_operand:DI 3 "gr_reg_or_8bit_operand" "rK")])
1573 (match_operand:BI 1 "register_operand" "0")))]
1575 "cmp.%C4.and.orcm %0, %I0 = %3, %2"
1576 [(set_attr "itanium_class" "icmp")])
1578 (define_insn "*cmpdi_and_1"
1579 [(set (match_operand:BI 0 "register_operand" "=c")
1580 (and:BI (match_operator:BI 3 "signed_inequality_operator"
1581 [(match_operand:DI 2 "gr_register_operand" "r")
1583 (match_operand:BI 1 "register_operand" "0")))]
1585 "cmp.%C3.and.orcm %0, %I0 = r0, %2"
1586 [(set_attr "itanium_class" "icmp")])
1588 (define_insn "*cmpdi_andnot_0"
1589 [(set (match_operand:BI 0 "register_operand" "=c")
1590 (and:BI (not:BI (match_operator:BI 4 "predicate_operator"
1591 [(match_operand:DI 2 "gr_register_operand" "r")
1592 (match_operand:DI 3 "gr_reg_or_8bit_operand" "rK")]))
1593 (match_operand:BI 1 "register_operand" "0")))]
1595 "cmp.%C4.or.andcm %I0, %0 = %3, %2"
1596 [(set_attr "itanium_class" "icmp")])
1598 (define_insn "*cmpdi_andnot_1"
1599 [(set (match_operand:BI 0 "register_operand" "=c")
1600 (and:BI (not:BI (match_operator:BI 3 "signed_inequality_operator"
1601 [(match_operand:DI 2 "gr_register_operand" "r")
1603 (match_operand:BI 1 "register_operand" "0")))]
1605 "cmp.%C3.or.andcm %I0, %0 = r0, %2"
1606 [(set_attr "itanium_class" "icmp")])
1608 (define_insn "*tbit_and_0"
1609 [(set (match_operand:BI 0 "register_operand" "=c")
1610 (and:BI (ne:BI (and:DI (match_operand:DI 1 "gr_register_operand" "r")
1613 (match_operand:BI 2 "register_operand" "0")))]
1615 "tbit.nz.and.orcm %0, %I0 = %1, 0"
1616 [(set_attr "itanium_class" "tbit")])
1618 (define_insn "*tbit_and_1"
1619 [(set (match_operand:BI 0 "register_operand" "=c")
1620 (and:BI (eq:BI (and:DI (match_operand:DI 1 "gr_register_operand" "r")
1623 (match_operand:BI 2 "register_operand" "0")))]
1625 "tbit.z.and.orcm %0, %I0 = %1, 0"
1626 [(set_attr "itanium_class" "tbit")])
1628 (define_insn "*tbit_and_2"
1629 [(set (match_operand:BI 0 "register_operand" "=c")
1630 (and:BI (ne:BI (zero_extract:DI
1631 (match_operand:DI 1 "gr_register_operand" "r")
1633 (match_operand:DI 2 "shift_count_operand" "M"))
1635 (match_operand:BI 3 "register_operand" "0")))]
1637 "tbit.nz.and.orcm %0, %I0 = %1, %2"
1638 [(set_attr "itanium_class" "tbit")])
1640 (define_insn "*tbit_and_3"
1641 [(set (match_operand:BI 0 "register_operand" "=c")
1642 (and:BI (eq:BI (zero_extract:DI
1643 (match_operand:DI 1 "gr_register_operand" "r")
1645 (match_operand:DI 2 "shift_count_operand" "M"))
1647 (match_operand:BI 3 "register_operand" "0")))]
1649 "tbit.z.and.orcm %0, %I0 = %1, %2"
1650 [(set_attr "itanium_class" "tbit")])
1652 (define_insn "*cmpsi_or_0"
1653 [(set (match_operand:BI 0 "register_operand" "=c")
1654 (ior:BI (match_operator:BI 4 "predicate_operator"
1655 [(match_operand:SI 2 "gr_reg_or_0_operand" "rO")
1656 (match_operand:SI 3 "gr_reg_or_8bit_operand" "rK")])
1657 (match_operand:BI 1 "register_operand" "0")))]
1659 "cmp4.%C4.or.andcm %0, %I0 = %3, %r2"
1660 [(set_attr "itanium_class" "icmp")])
1662 (define_insn "*cmpsi_or_1"
1663 [(set (match_operand:BI 0 "register_operand" "=c")
1664 (ior:BI (match_operator:BI 3 "signed_inequality_operator"
1665 [(match_operand:SI 2 "gr_register_operand" "r")
1667 (match_operand:BI 1 "register_operand" "0")))]
1669 "cmp4.%C3.or.andcm %0, %I0 = r0, %2"
1670 [(set_attr "itanium_class" "icmp")])
1672 (define_insn "*cmpsi_orcm_0"
1673 [(set (match_operand:BI 0 "register_operand" "=c")
1674 (ior:BI (not:BI (match_operator:BI 4 "predicate_operator"
1675 [(match_operand:SI 2 "gr_reg_or_0_operand" "rO")
1676 (match_operand:SI 3 "gr_reg_or_8bit_operand" "rK")]))
1677 (match_operand:BI 1 "register_operand" "0")))]
1679 "cmp4.%C4.and.orcm %I0, %0 = %3, %r2"
1680 [(set_attr "itanium_class" "icmp")])
1682 (define_insn "*cmpsi_orcm_1"
1683 [(set (match_operand:BI 0 "register_operand" "=c")
1684 (ior:BI (not:BI (match_operator:BI 3 "signed_inequality_operator"
1685 [(match_operand:SI 2 "gr_register_operand" "r")
1687 (match_operand:BI 1 "register_operand" "0")))]
1689 "cmp4.%C3.and.orcm %I0, %0 = r0, %2"
1690 [(set_attr "itanium_class" "icmp")])
1692 (define_insn "*cmpdi_or_0"
1693 [(set (match_operand:BI 0 "register_operand" "=c")
1694 (ior:BI (match_operator:BI 4 "predicate_operator"
1695 [(match_operand:DI 2 "gr_register_operand" "r")
1696 (match_operand:DI 3 "gr_reg_or_8bit_operand" "rK")])
1697 (match_operand:BI 1 "register_operand" "0")))]
1699 "cmp.%C4.or.andcm %0, %I0 = %3, %2"
1700 [(set_attr "itanium_class" "icmp")])
1702 (define_insn "*cmpdi_or_1"
1703 [(set (match_operand:BI 0 "register_operand" "=c")
1704 (ior:BI (match_operator:BI 3 "signed_inequality_operator"
1705 [(match_operand:DI 2 "gr_register_operand" "r")
1707 (match_operand:BI 1 "register_operand" "0")))]
1709 "cmp.%C3.or.andcm %0, %I0 = r0, %2"
1710 [(set_attr "itanium_class" "icmp")])
1712 (define_insn "*cmpdi_orcm_0"
1713 [(set (match_operand:BI 0 "register_operand" "=c")
1714 (ior:BI (not:BI (match_operator:BI 4 "predicate_operator"
1715 [(match_operand:DI 2 "gr_register_operand" "r")
1716 (match_operand:DI 3 "gr_reg_or_8bit_operand" "rK")]))
1717 (match_operand:BI 1 "register_operand" "0")))]
1719 "cmp.%C4.and.orcm %I0, %0 = %3, %2"
1720 [(set_attr "itanium_class" "icmp")])
1722 (define_insn "*cmpdi_orcm_1"
1723 [(set (match_operand:BI 0 "register_operand" "=c")
1724 (ior:BI (not:BI (match_operator:BI 3 "signed_inequality_operator"
1725 [(match_operand:DI 2 "gr_register_operand" "r")
1727 (match_operand:BI 1 "register_operand" "0")))]
1729 "cmp.%C3.and.orcm %I0, %0 = r0, %2"
1730 [(set_attr "itanium_class" "icmp")])
1732 (define_insn "*tbit_or_0"
1733 [(set (match_operand:BI 0 "register_operand" "=c")
1734 (ior:BI (ne:BI (and:DI (match_operand:DI 1 "gr_register_operand" "r")
1737 (match_operand:BI 2 "register_operand" "0")))]
1739 "tbit.nz.or.andcm %0, %I0 = %1, 0"
1740 [(set_attr "itanium_class" "tbit")])
1742 (define_insn "*tbit_or_1"
1743 [(set (match_operand:BI 0 "register_operand" "=c")
1744 (ior:BI (eq:BI (and:DI (match_operand:DI 1 "gr_register_operand" "r")
1747 (match_operand:BI 2 "register_operand" "0")))]
1749 "tbit.z.or.andcm %0, %I0 = %1, 0"
1750 [(set_attr "itanium_class" "tbit")])
1752 (define_insn "*tbit_or_2"
1753 [(set (match_operand:BI 0 "register_operand" "=c")
1754 (ior:BI (ne:BI (zero_extract:DI
1755 (match_operand:DI 1 "gr_register_operand" "r")
1757 (match_operand:DI 2 "shift_count_operand" "M"))
1759 (match_operand:BI 3 "register_operand" "0")))]
1761 "tbit.nz.or.andcm %0, %I0 = %1, %2"
1762 [(set_attr "itanium_class" "tbit")])
1764 (define_insn "*tbit_or_3"
1765 [(set (match_operand:BI 0 "register_operand" "=c")
1766 (ior:BI (eq:BI (zero_extract:DI
1767 (match_operand:DI 1 "gr_register_operand" "r")
1769 (match_operand:DI 2 "shift_count_operand" "M"))
1771 (match_operand:BI 3 "register_operand" "0")))]
1773 "tbit.z.or.andcm %0, %I0 = %1, %2"
1774 [(set_attr "itanium_class" "tbit")])
1776 ;; Transform test of and/or of setcc into parallel comparisons.
1779 [(set (match_operand:BI 0 "register_operand" "")
1780 (ne:BI (and:DI (ne:DI (match_operand:BI 2 "register_operand" "")
1782 (match_operand:DI 3 "register_operand" ""))
1786 (and:BI (ne:BI (and:DI (match_dup 3) (const_int 1)) (const_int 0))
1791 [(set (match_operand:BI 0 "register_operand" "")
1792 (eq:BI (and:DI (ne:DI (match_operand:BI 2 "register_operand" "")
1794 (match_operand:DI 3 "register_operand" ""))
1798 (and:BI (ne:BI (and:DI (match_dup 3) (const_int 1)) (const_int 0))
1800 (parallel [(set (match_dup 0) (not:BI (match_dup 0)))
1801 (clobber (scratch))])]
1805 [(set (match_operand:BI 0 "register_operand" "")
1806 (ne:BI (ior:DI (ne:DI (match_operand:BI 2 "register_operand" "")
1808 (match_operand:DI 3 "register_operand" ""))
1812 (ior:BI (ne:BI (match_dup 3) (const_int 0))
1817 [(set (match_operand:BI 0 "register_operand" "")
1818 (eq:BI (ior:DI (ne:DI (match_operand:BI 2 "register_operand" "")
1820 (match_operand:DI 3 "register_operand" ""))
1824 (ior:BI (ne:BI (match_dup 3) (const_int 0))
1826 (parallel [(set (match_dup 0) (not:BI (match_dup 0)))
1827 (clobber (scratch))])]
1830 ;; ??? Incredibly hackish. Either need four proper patterns with all
1831 ;; the alternatives, or rely on sched1 to split the insn and hope that
1832 ;; nothing bad happens to the comparisons in the meantime.
1834 ;; Alternately, adjust combine to allow 2->2 and 3->3 splits, assuming
1835 ;; that we're doing height reduction.
1837 ;(define_insn_and_split ""
1838 ; [(set (match_operand:BI 0 "register_operand" "=c")
1839 ; (and:BI (and:BI (match_operator:BI 1 "comparison_operator"
1840 ; [(match_operand 2 "" "")
1841 ; (match_operand 3 "" "")])
1842 ; (match_operator:BI 4 "comparison_operator"
1843 ; [(match_operand 5 "" "")
1844 ; (match_operand 6 "" "")]))
1846 ; "flag_schedule_insns"
1849 ; [(set (match_dup 0) (and:BI (match_dup 1) (match_dup 0)))
1850 ; (set (match_dup 0) (and:BI (match_dup 4) (match_dup 0)))]
1853 ;(define_insn_and_split ""
1854 ; [(set (match_operand:BI 0 "register_operand" "=c")
1855 ; (ior:BI (ior:BI (match_operator:BI 1 "comparison_operator"
1856 ; [(match_operand 2 "" "")
1857 ; (match_operand 3 "" "")])
1858 ; (match_operator:BI 4 "comparison_operator"
1859 ; [(match_operand 5 "" "")
1860 ; (match_operand 6 "" "")]))
1862 ; "flag_schedule_insns"
1865 ; [(set (match_dup 0) (ior:BI (match_dup 1) (match_dup 0)))
1866 ; (set (match_dup 0) (ior:BI (match_dup 4) (match_dup 0)))]
1870 ; [(set (match_operand:BI 0 "register_operand" "")
1871 ; (and:BI (and:BI (match_operator:BI 1 "comparison_operator"
1872 ; [(match_operand 2 "" "")
1873 ; (match_operand 3 "" "")])
1874 ; (match_operand:BI 7 "register_operand" ""))
1875 ; (and:BI (match_operator:BI 4 "comparison_operator"
1876 ; [(match_operand 5 "" "")
1877 ; (match_operand 6 "" "")])
1878 ; (match_operand:BI 8 "register_operand" ""))))]
1880 ; [(set (match_dup 0) (and:BI (match_dup 7) (match_dup 8)))
1881 ; (set (match_dup 0) (and:BI (and:BI (match_dup 1) (match_dup 4))
1886 ; [(set (match_operand:BI 0 "register_operand" "")
1887 ; (ior:BI (ior:BI (match_operator:BI 1 "comparison_operator"
1888 ; [(match_operand 2 "" "")
1889 ; (match_operand 3 "" "")])
1890 ; (match_operand:BI 7 "register_operand" ""))
1891 ; (ior:BI (match_operator:BI 4 "comparison_operator"
1892 ; [(match_operand 5 "" "")
1893 ; (match_operand 6 "" "")])
1894 ; (match_operand:BI 8 "register_operand" ""))))]
1896 ; [(set (match_dup 0) (ior:BI (match_dup 7) (match_dup 8)))
1897 ; (set (match_dup 0) (ior:BI (ior:BI (match_dup 1) (match_dup 4))
1901 ;; Try harder to avoid predicate copies by duplicating compares.
1902 ;; Note that we'll have already split the predicate copy, which
1903 ;; is kind of a pain, but oh well.
1906 [(set (match_operand:BI 0 "register_operand" "")
1907 (match_operand:BI 1 "comparison_operator" ""))
1908 (set (match_operand:CCI 2 "register_operand" "")
1909 (match_operand:CCI 3 "register_operand" ""))
1910 (set (match_operand:CCI 4 "register_operand" "")
1911 (match_operand:CCI 5 "register_operand" ""))
1912 (set (match_operand:BI 6 "register_operand" "")
1913 (unspec:BI [(match_dup 6)] UNSPEC_PRED_REL_MUTEX))]
1914 "REGNO (operands[3]) == REGNO (operands[0])
1915 && REGNO (operands[4]) == REGNO (operands[0]) + 1
1916 && REGNO (operands[4]) == REGNO (operands[2]) + 1
1917 && REGNO (operands[6]) == REGNO (operands[2])"
1918 [(set (match_dup 0) (match_dup 1))
1919 (set (match_dup 6) (match_dup 7))]
1920 "operands[7] = copy_rtx (operands[1]);")
1922 ;; ::::::::::::::::::::
1924 ;; :: 16-bit Integer arithmetic
1926 ;; ::::::::::::::::::::
1928 (define_insn "mulhi3"
1929 [(set (match_operand:HI 0 "gr_register_operand" "=r")
1930 (mult:HI (match_operand:HI 1 "gr_register_operand" "r")
1931 (match_operand:HI 2 "gr_register_operand" "r")))]
1933 "pmpy2.r %0 = %1, %2"
1934 [(set_attr "itanium_class" "mmmul")])
1937 ;; ::::::::::::::::::::
1939 ;; :: 32-bit Integer arithmetic
1941 ;; ::::::::::::::::::::
1943 (define_insn "addsi3"
1944 [(set (match_operand:SI 0 "gr_register_operand" "=r,r,r")
1945 (plus:SI (match_operand:SI 1 "gr_register_operand" "%r,r,a")
1946 (match_operand:SI 2 "gr_reg_or_22bit_operand" "r,I,J")))]
1952 [(set_attr "itanium_class" "ialu")])
1954 (define_insn "*addsi3_plus1"
1955 [(set (match_operand:SI 0 "gr_register_operand" "=r")
1956 (plus:SI (plus:SI (match_operand:SI 1 "gr_register_operand" "r")
1957 (match_operand:SI 2 "gr_register_operand" "r"))
1960 "add %0 = %1, %2, 1"
1961 [(set_attr "itanium_class" "ialu")])
1963 (define_insn "*addsi3_plus1_alt"
1964 [(set (match_operand:SI 0 "gr_register_operand" "=r")
1965 (plus:SI (mult:SI (match_operand:SI 1 "gr_register_operand" "r")
1969 "add %0 = %1, %1, 1"
1970 [(set_attr "itanium_class" "ialu")])
1972 (define_insn "*addsi3_shladd"
1973 [(set (match_operand:SI 0 "gr_register_operand" "=r")
1974 (plus:SI (mult:SI (match_operand:SI 1 "gr_register_operand" "r")
1975 (match_operand:SI 2 "shladd_operand" "n"))
1976 (match_operand:SI 3 "gr_register_operand" "r")))]
1978 "shladd %0 = %1, %S2, %3"
1979 [(set_attr "itanium_class" "ialu")])
1981 (define_insn "subsi3"
1982 [(set (match_operand:SI 0 "gr_register_operand" "=r")
1983 (minus:SI (match_operand:SI 1 "gr_reg_or_8bit_operand" "rK")
1984 (match_operand:SI 2 "gr_register_operand" "r")))]
1987 [(set_attr "itanium_class" "ialu")])
1989 (define_insn "*subsi3_minus1"
1990 [(set (match_operand:SI 0 "gr_register_operand" "=r")
1991 (plus:SI (not:SI (match_operand:SI 1 "gr_register_operand" "r"))
1992 (match_operand:SI 2 "gr_register_operand" "r")))]
1994 "sub %0 = %2, %1, 1"
1995 [(set_attr "itanium_class" "ialu")])
1997 ;; ??? Could add maddsi3 patterns patterned after the madddi3 patterns.
1999 (define_insn "mulsi3"
2000 [(set (match_operand:SI 0 "fr_register_operand" "=f")
2001 (mult:SI (match_operand:SI 1 "grfr_register_operand" "f")
2002 (match_operand:SI 2 "grfr_register_operand" "f")))]
2004 "xmpy.l %0 = %1, %2"
2005 [(set_attr "itanium_class" "xmpy")])
2007 (define_insn "maddsi4"
2008 [(set (match_operand:SI 0 "fr_register_operand" "=f")
2009 (plus:SI (mult:SI (match_operand:SI 1 "grfr_register_operand" "f")
2010 (match_operand:SI 2 "grfr_register_operand" "f"))
2011 (match_operand:SI 3 "grfr_register_operand" "f")))]
2013 "xma.l %0 = %1, %2, %3"
2014 [(set_attr "itanium_class" "xmpy")])
2016 (define_insn "negsi2"
2017 [(set (match_operand:SI 0 "gr_register_operand" "=r")
2018 (neg:SI (match_operand:SI 1 "gr_register_operand" "r")))]
2021 [(set_attr "itanium_class" "ialu")])
2023 (define_expand "abssi2"
2025 (ge:BI (match_operand:SI 1 "gr_register_operand" "") (const_int 0)))
2026 (set (match_operand:SI 0 "gr_register_operand" "")
2027 (if_then_else:SI (eq (match_dup 2) (const_int 0))
2028 (neg:SI (match_dup 1))
2031 { operands[2] = gen_reg_rtx (BImode); })
2033 (define_expand "sminsi3"
2035 (ge:BI (match_operand:SI 1 "gr_register_operand" "")
2036 (match_operand:SI 2 "gr_register_operand" "")))
2037 (set (match_operand:SI 0 "gr_register_operand" "")
2038 (if_then_else:SI (ne (match_dup 3) (const_int 0))
2039 (match_dup 2) (match_dup 1)))]
2041 { operands[3] = gen_reg_rtx (BImode); })
2043 (define_expand "smaxsi3"
2045 (ge:BI (match_operand:SI 1 "gr_register_operand" "")
2046 (match_operand:SI 2 "gr_register_operand" "")))
2047 (set (match_operand:SI 0 "gr_register_operand" "")
2048 (if_then_else:SI (ne (match_dup 3) (const_int 0))
2049 (match_dup 1) (match_dup 2)))]
2051 { operands[3] = gen_reg_rtx (BImode); })
2053 (define_expand "uminsi3"
2055 (geu:BI (match_operand:SI 1 "gr_register_operand" "")
2056 (match_operand:SI 2 "gr_register_operand" "")))
2057 (set (match_operand:SI 0 "gr_register_operand" "")
2058 (if_then_else:SI (ne (match_dup 3) (const_int 0))
2059 (match_dup 2) (match_dup 1)))]
2061 { operands[3] = gen_reg_rtx (BImode); })
2063 (define_expand "umaxsi3"
2065 (geu:BI (match_operand:SI 1 "gr_register_operand" "")
2066 (match_operand:SI 2 "gr_register_operand" "")))
2067 (set (match_operand:SI 0 "gr_register_operand" "")
2068 (if_then_else:SI (ne (match_dup 3) (const_int 0))
2069 (match_dup 1) (match_dup 2)))]
2071 { operands[3] = gen_reg_rtx (BImode); })
2073 (define_expand "divsi3"
2074 [(set (match_operand:SI 0 "register_operand" "")
2075 (div:SI (match_operand:SI 1 "general_operand" "")
2076 (match_operand:SI 2 "general_operand" "")))]
2077 "TARGET_INLINE_INT_DIV"
2079 rtx op1_xf, op2_xf, op0_xf, op0_di, twon34, twon34_exp;
2081 op0_xf = gen_reg_rtx (XFmode);
2082 op0_di = gen_reg_rtx (DImode);
2084 if (CONSTANT_P (operands[1]))
2085 operands[1] = force_reg (SImode, operands[1]);
2086 op1_xf = gen_reg_rtx (XFmode);
2087 expand_float (op1_xf, operands[1], 0);
2089 if (CONSTANT_P (operands[2]))
2090 operands[2] = force_reg (SImode, operands[2]);
2091 op2_xf = gen_reg_rtx (XFmode);
2092 expand_float (op2_xf, operands[2], 0);
2095 twon34_exp = gen_reg_rtx (DImode);
2096 emit_move_insn (twon34_exp, GEN_INT (65501));
2097 twon34 = gen_reg_rtx (XFmode);
2098 emit_insn (gen_setf_exp_xf (twon34, twon34_exp));
2100 emit_insn (gen_cond_trap (EQ, operands[2], CONST0_RTX (SImode),
2101 CONST1_RTX (SImode)));
2103 emit_insn (gen_divsi3_internal (op0_xf, op1_xf, op2_xf, twon34));
2105 emit_insn (gen_fix_truncxfdi2_alts (op0_di, op0_xf, const1_rtx));
2106 emit_move_insn (operands[0], gen_lowpart (SImode, op0_di));
2110 (define_expand "modsi3"
2111 [(set (match_operand:SI 0 "register_operand" "")
2112 (mod:SI (match_operand:SI 1 "general_operand" "")
2113 (match_operand:SI 2 "general_operand" "")))]
2114 "TARGET_INLINE_INT_DIV"
2116 rtx op2_neg, op1_di, div;
2118 div = gen_reg_rtx (SImode);
2119 emit_insn (gen_divsi3 (div, operands[1], operands[2]));
2121 op2_neg = expand_unop (SImode, neg_optab, operands[2], NULL_RTX, 0);
2123 /* This is a trick to get us to reuse the value that we're sure to
2124 have already copied to the FP regs. */
2125 op1_di = gen_reg_rtx (DImode);
2126 convert_move (op1_di, operands[1], 0);
2128 emit_insn (gen_maddsi4 (operands[0], div, op2_neg,
2129 gen_lowpart (SImode, op1_di)));
2133 (define_expand "udivsi3"
2134 [(set (match_operand:SI 0 "register_operand" "")
2135 (udiv:SI (match_operand:SI 1 "general_operand" "")
2136 (match_operand:SI 2 "general_operand" "")))]
2137 "TARGET_INLINE_INT_DIV"
2139 rtx op1_xf, op2_xf, op0_xf, op0_di, twon34, twon34_exp;
2141 op0_xf = gen_reg_rtx (XFmode);
2142 op0_di = gen_reg_rtx (DImode);
2144 if (CONSTANT_P (operands[1]))
2145 operands[1] = force_reg (SImode, operands[1]);
2146 op1_xf = gen_reg_rtx (XFmode);
2147 expand_float (op1_xf, operands[1], 1);
2149 if (CONSTANT_P (operands[2]))
2150 operands[2] = force_reg (SImode, operands[2]);
2151 op2_xf = gen_reg_rtx (XFmode);
2152 expand_float (op2_xf, operands[2], 1);
2155 twon34_exp = gen_reg_rtx (DImode);
2156 emit_move_insn (twon34_exp, GEN_INT (65501));
2157 twon34 = gen_reg_rtx (XFmode);
2158 emit_insn (gen_setf_exp_xf (twon34, twon34_exp));
2160 emit_insn (gen_cond_trap (EQ, operands[2], CONST0_RTX (SImode),
2161 CONST1_RTX (SImode)));
2163 emit_insn (gen_divsi3_internal (op0_xf, op1_xf, op2_xf, twon34));
2165 emit_insn (gen_fixuns_truncxfdi2_alts (op0_di, op0_xf, const1_rtx));
2166 emit_move_insn (operands[0], gen_lowpart (SImode, op0_di));
2170 (define_expand "umodsi3"
2171 [(set (match_operand:SI 0 "register_operand" "")
2172 (umod:SI (match_operand:SI 1 "general_operand" "")
2173 (match_operand:SI 2 "general_operand" "")))]
2174 "TARGET_INLINE_INT_DIV"
2176 rtx op2_neg, op1_di, div;
2178 div = gen_reg_rtx (SImode);
2179 emit_insn (gen_udivsi3 (div, operands[1], operands[2]));
2181 op2_neg = expand_unop (SImode, neg_optab, operands[2], NULL_RTX, 0);
2183 /* This is a trick to get us to reuse the value that we're sure to
2184 have already copied to the FP regs. */
2185 op1_di = gen_reg_rtx (DImode);
2186 convert_move (op1_di, operands[1], 1);
2188 emit_insn (gen_maddsi4 (operands[0], div, op2_neg,
2189 gen_lowpart (SImode, op1_di)));
2193 (define_insn_and_split "divsi3_internal"
2194 [(set (match_operand:XF 0 "fr_register_operand" "=&f")
2195 (float:XF (div:SI (match_operand:XF 1 "fr_register_operand" "f")
2196 (match_operand:XF 2 "fr_register_operand" "f"))))
2197 (clobber (match_scratch:XF 4 "=&f"))
2198 (clobber (match_scratch:XF 5 "=&f"))
2199 (clobber (match_scratch:BI 6 "=c"))
2200 (use (match_operand:XF 3 "fr_register_operand" "f"))]
2201 "TARGET_INLINE_INT_DIV"
2203 "&& reload_completed"
2204 [(parallel [(set (match_dup 0) (div:XF (const_int 1) (match_dup 2)))
2205 (set (match_dup 6) (unspec:BI [(match_dup 1) (match_dup 2)]
2206 UNSPEC_FR_RECIP_APPROX))
2207 (use (const_int 1))])
2208 (cond_exec (ne (match_dup 6) (const_int 0))
2209 (parallel [(set (match_dup 4) (mult:XF (match_dup 1) (match_dup 0)))
2210 (use (const_int 1))]))
2211 (cond_exec (ne (match_dup 6) (const_int 0))
2212 (parallel [(set (match_dup 5)
2213 (minus:XF (match_dup 7)
2214 (mult:XF (match_dup 2) (match_dup 0))))
2215 (use (const_int 1))]))
2216 (cond_exec (ne (match_dup 6) (const_int 0))
2217 (parallel [(set (match_dup 4)
2218 (plus:XF (mult:XF (match_dup 5) (match_dup 4))
2220 (use (const_int 1))]))
2221 (cond_exec (ne (match_dup 6) (const_int 0))
2222 (parallel [(set (match_dup 5)
2223 (plus:XF (mult:XF (match_dup 5) (match_dup 5))
2225 (use (const_int 1))]))
2226 (cond_exec (ne (match_dup 6) (const_int 0))
2227 (parallel [(set (match_dup 0)
2228 (plus:XF (mult:XF (match_dup 5) (match_dup 4))
2230 (use (const_int 1))]))
2232 "operands[7] = CONST1_RTX (XFmode);"
2233 [(set_attr "predicable" "no")])
2235 ;; ::::::::::::::::::::
2237 ;; :: 64-bit Integer arithmetic
2239 ;; ::::::::::::::::::::
2241 (define_insn "adddi3"
2242 [(set (match_operand:DI 0 "gr_register_operand" "=r,r,r")
2243 (plus:DI (match_operand:DI 1 "gr_register_operand" "%r,r,a")
2244 (match_operand:DI 2 "gr_reg_or_22bit_operand" "r,I,J")))]
2250 [(set_attr "itanium_class" "ialu")])
2252 (define_insn "*adddi3_plus1"
2253 [(set (match_operand:DI 0 "gr_register_operand" "=r")
2254 (plus:DI (plus:DI (match_operand:DI 1 "gr_register_operand" "r")
2255 (match_operand:DI 2 "gr_register_operand" "r"))
2258 "add %0 = %1, %2, 1"
2259 [(set_attr "itanium_class" "ialu")])
2261 ;; This has some of the same problems as shladd. We let the shladd
2262 ;; eliminator hack handle it, which results in the 1 being forced into
2263 ;; a register, but not more ugliness here.
2264 (define_insn "*adddi3_plus1_alt"
2265 [(set (match_operand:DI 0 "gr_register_operand" "=r")
2266 (plus:DI (mult:DI (match_operand:DI 1 "gr_register_operand" "r")
2270 "add %0 = %1, %1, 1"
2271 [(set_attr "itanium_class" "ialu")])
2273 (define_insn "subdi3"
2274 [(set (match_operand:DI 0 "gr_register_operand" "=r")
2275 (minus:DI (match_operand:DI 1 "gr_reg_or_8bit_operand" "rK")
2276 (match_operand:DI 2 "gr_register_operand" "r")))]
2279 [(set_attr "itanium_class" "ialu")])
2281 (define_insn "*subdi3_minus1"
2282 [(set (match_operand:DI 0 "gr_register_operand" "=r")
2283 (plus:DI (not:DI (match_operand:DI 1 "gr_register_operand" "r"))
2284 (match_operand:DI 2 "gr_register_operand" "r")))]
2286 "sub %0 = %2, %1, 1"
2287 [(set_attr "itanium_class" "ialu")])
2289 ;; ??? Use grfr instead of fr because of virtual register elimination
2290 ;; and silly test cases multiplying by the frame pointer.
2291 (define_insn "muldi3"
2292 [(set (match_operand:DI 0 "fr_register_operand" "=f")
2293 (mult:DI (match_operand:DI 1 "grfr_register_operand" "f")
2294 (match_operand:DI 2 "grfr_register_operand" "f")))]
2296 "xmpy.l %0 = %1, %2"
2297 [(set_attr "itanium_class" "xmpy")])
2299 ;; ??? If operand 3 is an eliminable reg, then register elimination causes the
2300 ;; same problem that we have with shladd below. Unfortunately, this case is
2301 ;; much harder to fix because the multiply puts the result in an FP register,
2302 ;; but the add needs inputs from a general register. We add a spurious clobber
2303 ;; here so that it will be present just in case register elimination gives us
2304 ;; the funny result.
2306 ;; ??? Maybe validate_changes should try adding match_scratch clobbers?
2308 ;; ??? Maybe we should change how adds are canonicalized.
2310 (define_insn "madddi4"
2311 [(set (match_operand:DI 0 "fr_register_operand" "=f")
2312 (plus:DI (mult:DI (match_operand:DI 1 "grfr_register_operand" "f")
2313 (match_operand:DI 2 "grfr_register_operand" "f"))
2314 (match_operand:DI 3 "grfr_register_operand" "f")))
2315 (clobber (match_scratch:DI 4 "=X"))]
2317 "xma.l %0 = %1, %2, %3"
2318 [(set_attr "itanium_class" "xmpy")])
2320 ;; This can be created by register elimination if operand3 of shladd is an
2321 ;; eliminable register or has reg_equiv_constant set.
2323 ;; We have to use nonmemory_operand for operand 4, to ensure that the
2324 ;; validate_changes call inside eliminate_regs will always succeed. If it
2325 ;; doesn't succeed, then this remain a madddi4 pattern, and will be reloaded
2328 (define_insn "*madddi4_elim"
2329 [(set (match_operand:DI 0 "register_operand" "=&r")
2330 (plus:DI (plus:DI (mult:DI (match_operand:DI 1 "register_operand" "f")
2331 (match_operand:DI 2 "register_operand" "f"))
2332 (match_operand:DI 3 "register_operand" "f"))
2333 (match_operand:DI 4 "nonmemory_operand" "rI")))
2334 (clobber (match_scratch:DI 5 "=f"))]
2335 "reload_in_progress"
2337 [(set_attr "itanium_class" "unknown")])
2340 [(set (match_operand:DI 0 "register_operand" "")
2341 (plus:DI (plus:DI (mult:DI (match_operand:DI 1 "register_operand" "")
2342 (match_operand:DI 2 "register_operand" ""))
2343 (match_operand:DI 3 "register_operand" ""))
2344 (match_operand:DI 4 "gr_reg_or_14bit_operand" "")))
2345 (clobber (match_scratch:DI 5 ""))]
2347 [(parallel [(set (match_dup 5) (plus:DI (mult:DI (match_dup 1) (match_dup 2))
2349 (clobber (match_dup 0))])
2350 (set (match_dup 0) (match_dup 5))
2351 (set (match_dup 0) (plus:DI (match_dup 0) (match_dup 4)))]
2354 (define_insn "smuldi3_highpart"
2355 [(set (match_operand:DI 0 "fr_register_operand" "=f")
2358 (mult:TI (sign_extend:TI
2359 (match_operand:DI 1 "fr_register_operand" "f"))
2361 (match_operand:DI 2 "fr_register_operand" "f")))
2364 "xmpy.h %0 = %1, %2"
2365 [(set_attr "itanium_class" "xmpy")])
2367 (define_insn "umuldi3_highpart"
2368 [(set (match_operand:DI 0 "fr_register_operand" "=f")
2371 (mult:TI (zero_extend:TI
2372 (match_operand:DI 1 "fr_register_operand" "f"))
2374 (match_operand:DI 2 "fr_register_operand" "f")))
2377 "xmpy.hu %0 = %1, %2"
2378 [(set_attr "itanium_class" "xmpy")])
2380 (define_insn "negdi2"
2381 [(set (match_operand:DI 0 "gr_register_operand" "=r")
2382 (neg:DI (match_operand:DI 1 "gr_register_operand" "r")))]
2385 [(set_attr "itanium_class" "ialu")])
2387 (define_expand "absdi2"
2389 (ge:BI (match_operand:DI 1 "gr_register_operand" "") (const_int 0)))
2390 (set (match_operand:DI 0 "gr_register_operand" "")
2391 (if_then_else:DI (eq (match_dup 2) (const_int 0))
2392 (neg:DI (match_dup 1))
2395 { operands[2] = gen_reg_rtx (BImode); })
2397 (define_expand "smindi3"
2399 (ge:BI (match_operand:DI 1 "gr_register_operand" "")
2400 (match_operand:DI 2 "gr_register_operand" "")))
2401 (set (match_operand:DI 0 "gr_register_operand" "")
2402 (if_then_else:DI (ne (match_dup 3) (const_int 0))
2403 (match_dup 2) (match_dup 1)))]
2405 { operands[3] = gen_reg_rtx (BImode); })
2407 (define_expand "smaxdi3"
2409 (ge:BI (match_operand:DI 1 "gr_register_operand" "")
2410 (match_operand:DI 2 "gr_register_operand" "")))
2411 (set (match_operand:DI 0 "gr_register_operand" "")
2412 (if_then_else:DI (ne (match_dup 3) (const_int 0))
2413 (match_dup 1) (match_dup 2)))]
2415 { operands[3] = gen_reg_rtx (BImode); })
2417 (define_expand "umindi3"
2419 (geu:BI (match_operand:DI 1 "gr_register_operand" "")
2420 (match_operand:DI 2 "gr_register_operand" "")))
2421 (set (match_operand:DI 0 "gr_register_operand" "")
2422 (if_then_else:DI (ne (match_dup 3) (const_int 0))
2423 (match_dup 2) (match_dup 1)))]
2425 { operands[3] = gen_reg_rtx (BImode); })
2427 (define_expand "umaxdi3"
2429 (geu:BI (match_operand:DI 1 "gr_register_operand" "")
2430 (match_operand:DI 2 "gr_register_operand" "")))
2431 (set (match_operand:DI 0 "gr_register_operand" "")
2432 (if_then_else:DI (ne (match_dup 3) (const_int 0))
2433 (match_dup 1) (match_dup 2)))]
2435 { operands[3] = gen_reg_rtx (BImode); })
2437 (define_expand "ffsdi2"
2439 (eq:BI (match_operand:DI 1 "gr_register_operand" "") (const_int 0)))
2440 (set (match_dup 2) (plus:DI (match_dup 1) (const_int -1)))
2441 (set (match_dup 5) (const_int 0))
2442 (set (match_dup 3) (xor:DI (match_dup 1) (match_dup 2)))
2443 (set (match_dup 4) (popcount:DI (match_dup 3)))
2444 (set (match_operand:DI 0 "gr_register_operand" "")
2445 (if_then_else:DI (ne (match_dup 6) (const_int 0))
2446 (match_dup 5) (match_dup 4)))]
2449 operands[2] = gen_reg_rtx (DImode);
2450 operands[3] = gen_reg_rtx (DImode);
2451 operands[4] = gen_reg_rtx (DImode);
2452 operands[5] = gen_reg_rtx (DImode);
2453 operands[6] = gen_reg_rtx (BImode);
2456 (define_expand "ctzdi2"
2457 [(set (match_dup 2) (plus:DI (match_operand:DI 1 "gr_register_operand" "")
2459 (set (match_dup 3) (not:DI (match_dup 1)))
2460 (set (match_dup 4) (and:DI (match_dup 2) (match_dup 3)))
2461 (set (match_operand:DI 0 "gr_register_operand" "")
2462 (popcount:DI (match_dup 4)))]
2465 operands[2] = gen_reg_rtx (DImode);
2466 operands[3] = gen_reg_rtx (DImode);
2467 operands[4] = gen_reg_rtx (DImode);
2470 ;; Note the computation here is op0 = 63 - (exp - 0xffff).
2471 (define_expand "clzdi2"
2473 (unsigned_float:XF (match_operand:DI 1 "fr_register_operand" "")))
2475 (unspec:DI [(match_dup 2)] UNSPEC_GETF_EXP))
2476 (set (match_dup 4) (const_int 65598))
2477 (set (match_operand:DI 0 "gr_register_operand" "")
2478 (minus:DI (match_dup 4) (match_dup 3)))]
2481 operands[2] = gen_reg_rtx (XFmode);
2482 operands[3] = gen_reg_rtx (DImode);
2483 operands[4] = gen_reg_rtx (DImode);
2486 (define_insn "popcountdi2"
2487 [(set (match_operand:DI 0 "gr_register_operand" "=r")
2488 (popcount:DI (match_operand:DI 1 "gr_register_operand" "r")))]
2491 [(set_attr "itanium_class" "mmmul")])
2493 (define_insn "bswapdi2"
2494 [(set (match_operand:DI 0 "gr_register_operand" "=r")
2495 (bswap:DI (match_operand:DI 1 "gr_register_operand" "r")))]
2497 "mux1 %0 = %1, @rev"
2498 [(set_attr "itanium_class" "mmshf")])
2500 (define_insn "*getf_exp_xf"
2501 [(set (match_operand:DI 0 "gr_register_operand" "=r")
2502 (unspec:DI [(match_operand:XF 1 "fr_register_operand" "f")]
2506 [(set_attr "itanium_class" "frfr")])
2508 (define_expand "divdi3"
2509 [(set (match_operand:DI 0 "register_operand" "")
2510 (div:DI (match_operand:DI 1 "general_operand" "")
2511 (match_operand:DI 2 "general_operand" "")))]
2512 "TARGET_INLINE_INT_DIV"
2514 rtx op1_xf, op2_xf, op0_xf;
2516 op0_xf = gen_reg_rtx (XFmode);
2518 if (CONSTANT_P (operands[1]))
2519 operands[1] = force_reg (DImode, operands[1]);
2520 op1_xf = gen_reg_rtx (XFmode);
2521 expand_float (op1_xf, operands[1], 0);
2523 if (CONSTANT_P (operands[2]))
2524 operands[2] = force_reg (DImode, operands[2]);
2525 op2_xf = gen_reg_rtx (XFmode);
2526 expand_float (op2_xf, operands[2], 0);
2528 emit_insn (gen_cond_trap (EQ, operands[2], CONST0_RTX (DImode),
2529 CONST1_RTX (DImode)));
2531 if (TARGET_INLINE_INT_DIV == INL_MIN_LAT)
2532 emit_insn (gen_divdi3_internal_lat (op0_xf, op1_xf, op2_xf));
2534 emit_insn (gen_divdi3_internal_thr (op0_xf, op1_xf, op2_xf));
2536 emit_insn (gen_fix_truncxfdi2_alts (operands[0], op0_xf, const1_rtx));
2540 (define_expand "moddi3"
2541 [(set (match_operand:DI 0 "register_operand" "")
2542 (mod:SI (match_operand:DI 1 "general_operand" "")
2543 (match_operand:DI 2 "general_operand" "")))]
2544 "TARGET_INLINE_INT_DIV"
2548 div = gen_reg_rtx (DImode);
2549 emit_insn (gen_divdi3 (div, operands[1], operands[2]));
2551 op2_neg = expand_unop (DImode, neg_optab, operands[2], NULL_RTX, 0);
2553 emit_insn (gen_madddi4 (operands[0], div, op2_neg, operands[1]));
2557 (define_expand "udivdi3"
2558 [(set (match_operand:DI 0 "register_operand" "")
2559 (udiv:DI (match_operand:DI 1 "general_operand" "")
2560 (match_operand:DI 2 "general_operand" "")))]
2561 "TARGET_INLINE_INT_DIV"
2563 rtx op1_xf, op2_xf, op0_xf;
2565 op0_xf = gen_reg_rtx (XFmode);
2567 if (CONSTANT_P (operands[1]))
2568 operands[1] = force_reg (DImode, operands[1]);
2569 op1_xf = gen_reg_rtx (XFmode);
2570 expand_float (op1_xf, operands[1], 1);
2572 if (CONSTANT_P (operands[2]))
2573 operands[2] = force_reg (DImode, operands[2]);
2574 op2_xf = gen_reg_rtx (XFmode);
2575 expand_float (op2_xf, operands[2], 1);
2577 emit_insn (gen_cond_trap (EQ, operands[2], CONST0_RTX (DImode),
2578 CONST1_RTX (DImode)));
2580 if (TARGET_INLINE_INT_DIV == INL_MIN_LAT)
2581 emit_insn (gen_divdi3_internal_lat (op0_xf, op1_xf, op2_xf));
2583 emit_insn (gen_divdi3_internal_thr (op0_xf, op1_xf, op2_xf));
2585 emit_insn (gen_fixuns_truncxfdi2_alts (operands[0], op0_xf, const1_rtx));
2589 (define_expand "umoddi3"
2590 [(set (match_operand:DI 0 "register_operand" "")
2591 (umod:DI (match_operand:DI 1 "general_operand" "")
2592 (match_operand:DI 2 "general_operand" "")))]
2593 "TARGET_INLINE_INT_DIV"
2597 div = gen_reg_rtx (DImode);
2598 emit_insn (gen_udivdi3 (div, operands[1], operands[2]));
2600 op2_neg = expand_unop (DImode, neg_optab, operands[2], NULL_RTX, 0);
2602 emit_insn (gen_madddi4 (operands[0], div, op2_neg, operands[1]));
2606 (define_insn_and_split "divdi3_internal_lat"
2607 [(set (match_operand:XF 0 "fr_register_operand" "=&f")
2608 (float:XF (div:SI (match_operand:XF 1 "fr_register_operand" "f")
2609 (match_operand:XF 2 "fr_register_operand" "f"))))
2610 (clobber (match_scratch:XF 3 "=&f"))
2611 (clobber (match_scratch:XF 4 "=&f"))
2612 (clobber (match_scratch:XF 5 "=&f"))
2613 (clobber (match_scratch:BI 6 "=c"))]
2614 "TARGET_INLINE_INT_DIV == INL_MIN_LAT"
2616 "&& reload_completed"
2617 [(parallel [(set (match_dup 0) (div:XF (const_int 1) (match_dup 2)))
2618 (set (match_dup 6) (unspec:BI [(match_dup 1) (match_dup 2)]
2619 UNSPEC_FR_RECIP_APPROX))
2620 (use (const_int 1))])
2621 (cond_exec (ne (match_dup 6) (const_int 0))
2622 (parallel [(set (match_dup 3)
2623 (minus:XF (match_dup 7)
2624 (mult:XF (match_dup 2) (match_dup 0))))
2625 (use (const_int 1))]))
2626 (cond_exec (ne (match_dup 6) (const_int 0))
2627 (parallel [(set (match_dup 4) (mult:XF (match_dup 1) (match_dup 0)))
2628 (use (const_int 1))]))
2629 (cond_exec (ne (match_dup 6) (const_int 0))
2630 (parallel [(set (match_dup 5) (mult:XF (match_dup 3) (match_dup 3)))
2631 (use (const_int 1))]))
2632 (cond_exec (ne (match_dup 6) (const_int 0))
2633 (parallel [(set (match_dup 4)
2634 (plus:XF (mult:XF (match_dup 3) (match_dup 4))
2636 (use (const_int 1))]))
2637 (cond_exec (ne (match_dup 6) (const_int 0))
2638 (parallel [(set (match_dup 0)
2639 (plus:XF (mult:XF (match_dup 3) (match_dup 0))
2641 (use (const_int 1))]))
2642 (cond_exec (ne (match_dup 6) (const_int 0))
2643 (parallel [(set (match_dup 3)
2644 (plus:XF (mult:XF (match_dup 5) (match_dup 4))
2646 (use (const_int 1))]))
2647 (cond_exec (ne (match_dup 6) (const_int 0))
2648 (parallel [(set (match_dup 0)
2649 (plus:XF (mult:XF (match_dup 5) (match_dup 0))
2651 (use (const_int 1))]))
2652 (cond_exec (ne (match_dup 6) (const_int 0))
2653 (parallel [(set (match_dup 4)
2654 (minus:XF (match_dup 1)
2655 (mult:XF (match_dup 2) (match_dup 3))))
2656 (use (const_int 1))]))
2657 (cond_exec (ne (match_dup 6) (const_int 0))
2658 (parallel [(set (match_dup 0)
2659 (plus:XF (mult:XF (match_dup 4) (match_dup 0))
2661 (use (const_int 1))]))
2663 "operands[7] = CONST1_RTX (XFmode);"
2664 [(set_attr "predicable" "no")])
2666 (define_insn_and_split "divdi3_internal_thr"
2667 [(set (match_operand:XF 0 "fr_register_operand" "=&f")
2668 (float:XF (div:SI (match_operand:XF 1 "fr_register_operand" "f")
2669 (match_operand:XF 2 "fr_register_operand" "f"))))
2670 (clobber (match_scratch:XF 3 "=&f"))
2671 (clobber (match_scratch:XF 4 "=f"))
2672 (clobber (match_scratch:BI 5 "=c"))]
2673 "TARGET_INLINE_INT_DIV == INL_MAX_THR"
2675 "&& reload_completed"
2676 [(parallel [(set (match_dup 0) (div:XF (const_int 1) (match_dup 2)))
2677 (set (match_dup 5) (unspec:BI [(match_dup 1) (match_dup 2)]
2678 UNSPEC_FR_RECIP_APPROX))
2679 (use (const_int 1))])
2680 (cond_exec (ne (match_dup 5) (const_int 0))
2681 (parallel [(set (match_dup 3)
2682 (minus:XF (match_dup 6)
2683 (mult:XF (match_dup 2) (match_dup 0))))
2684 (use (const_int 1))]))
2685 (cond_exec (ne (match_dup 5) (const_int 0))
2686 (parallel [(set (match_dup 0)
2687 (plus:XF (mult:XF (match_dup 3) (match_dup 0))
2689 (use (const_int 1))]))
2690 (cond_exec (ne (match_dup 5) (const_int 0))
2691 (parallel [(set (match_dup 3) (mult:XF (match_dup 3) (match_dup 3)))
2692 (use (const_int 1))]))
2693 (cond_exec (ne (match_dup 5) (const_int 0))
2694 (parallel [(set (match_dup 0)
2695 (plus:XF (mult:XF (match_dup 3) (match_dup 0))
2697 (use (const_int 1))]))
2698 (cond_exec (ne (match_dup 5) (const_int 0))
2699 (parallel [(set (match_dup 3) (mult:XF (match_dup 0) (match_dup 1)))
2700 (use (const_int 1))]))
2701 (cond_exec (ne (match_dup 5) (const_int 0))
2702 (parallel [(set (match_dup 4)
2703 (minus:XF (match_dup 1)
2704 (mult:XF (match_dup 2) (match_dup 3))))
2705 (use (const_int 1))]))
2706 (cond_exec (ne (match_dup 5) (const_int 0))
2707 (parallel [(set (match_dup 0)
2708 (plus:XF (mult:XF (match_dup 4) (match_dup 0))
2710 (use (const_int 1))]))
2712 "operands[6] = CONST1_RTX (XFmode);"
2713 [(set_attr "predicable" "no")])
2715 ;; ::::::::::::::::::::
2717 ;; :: 128-bit Integer arithmetic
2719 ;; ::::::::::::::::::::
2721 (define_insn "addti3"
2722 [(set (match_operand:TI 0 "gr_register_operand" "=&r")
2723 (plus:TI (match_operand:TI 1 "gr_register_operand" "%r")
2724 (match_operand:TI 2 "gr_reg_or_14bit_operand" "rI")))
2725 (clobber (match_scratch:BI 3 "=&c"))]
2728 [(set_attr "itanium_class" "unknown")])
2731 [(set (match_operand:TI 0 "register_operand" "")
2732 (plus:TI (match_operand:TI 1 "register_operand" "")
2733 (match_operand:TI 2 "register_operand" "")))
2734 (clobber (match_scratch:BI 3 ""))]
2736 [(set (match_dup 0) (plus:DI (match_dup 1) (match_dup 2)))
2737 (set (match_dup 3) (ltu:BI (match_dup 0) (match_dup 1)))
2738 (cond_exec (eq (match_dup 3) (const_int 0))
2739 (set (match_dup 4) (plus:DI (match_dup 5) (match_dup 6))))
2740 (cond_exec (ne (match_dup 3) (const_int 0))
2742 (plus:DI (plus:DI (match_dup 5) (match_dup 6))
2745 operands[4] = gen_highpart (DImode, operands[0]);
2746 operands[0] = gen_lowpart (DImode, operands[0]);
2747 operands[5] = gen_highpart (DImode, operands[1]);
2748 operands[1] = gen_lowpart (DImode, operands[1]);
2749 operands[6] = gen_highpart (DImode, operands[2]);
2750 operands[2] = gen_lowpart (DImode, operands[2]);
2754 [(set (match_operand:TI 0 "register_operand" "")
2755 (plus:TI (match_operand:TI 1 "register_operand" "")
2756 (match_operand:TI 2 "immediate_operand" "")))
2757 (clobber (match_scratch:BI 3 ""))]
2759 [(set (match_dup 0) (plus:DI (match_dup 1) (match_dup 2)))
2760 (set (match_dup 3) (ltu:BI (match_dup 0) (match_dup 1)))
2761 (cond_exec (eq (match_dup 3) (const_int 0))
2763 (plus:DI (match_dup 5) (match_dup 6))))
2764 (cond_exec (ne (match_dup 3) (const_int 0))
2766 (plus:DI (match_dup 5) (match_dup 7))))]
2768 operands[4] = gen_highpart (DImode, operands[0]);
2769 operands[0] = gen_lowpart (DImode, operands[0]);
2770 operands[5] = gen_highpart (DImode, operands[1]);
2771 operands[1] = gen_lowpart (DImode, operands[1]);
2772 operands[6] = INTVAL (operands[2]) < 0 ? constm1_rtx : const0_rtx;
2773 operands[7] = INTVAL (operands[2]) < 0 ? const0_rtx : const1_rtx;
2776 (define_insn "subti3"
2777 [(set (match_operand:TI 0 "gr_register_operand" "=&r")
2778 (minus:TI (match_operand:TI 1 "gr_reg_or_8bit_operand" "rK")
2779 (match_operand:TI 2 "gr_register_operand" "r")))
2780 (clobber (match_scratch:BI 3 "=&c"))]
2783 [(set_attr "itanium_class" "unknown")])
2786 [(set (match_operand:TI 0 "register_operand" "")
2787 (minus:TI (match_operand:TI 1 "register_operand" "")
2788 (match_operand:TI 2 "register_operand" "")))
2789 (clobber (match_scratch:BI 3 "=&c"))]
2791 [(set (match_dup 0) (minus:DI (match_dup 1) (match_dup 2)))
2792 (set (match_dup 3) (ltu:BI (match_dup 1) (match_dup 0)))
2793 (cond_exec (eq (match_dup 3) (const_int 0))
2794 (set (match_dup 4) (minus:DI (match_dup 5) (match_dup 6))))
2795 (cond_exec (ne (match_dup 3) (const_int 0))
2797 (plus:DI (not:DI (match_dup 6)) (match_dup 5))))]
2799 operands[4] = gen_highpart (DImode, operands[0]);
2800 operands[0] = gen_lowpart (DImode, operands[0]);
2801 operands[5] = gen_highpart (DImode, operands[1]);
2802 operands[1] = gen_lowpart (DImode, operands[1]);
2803 operands[6] = gen_highpart (DImode, operands[2]);
2804 operands[2] = gen_lowpart (DImode, operands[2]);
2808 [(set (match_operand:TI 0 "register_operand" "")
2809 (minus:TI (match_operand:TI 1 "immediate_operand" "")
2810 (match_operand:TI 2 "register_operand" "")))
2811 (clobber (match_scratch:BI 3 "=&c"))]
2812 "reload_completed && satisfies_constraint_K (operands[1])"
2813 [(set (match_dup 0) (minus:DI (match_dup 1) (match_dup 2)))
2814 (set (match_dup 3) (gtu:BI (match_dup 0) (match_dup 1)))
2815 (cond_exec (ne (match_dup 3) (const_int 0))
2816 (set (match_dup 4) (minus:DI (match_dup 6) (match_dup 5))))
2817 (cond_exec (eq (match_dup 3) (const_int 0))
2818 (set (match_dup 4) (minus:DI (match_dup 7) (match_dup 5))))]
2820 operands[4] = gen_highpart (DImode, operands[0]);
2821 operands[0] = gen_lowpart (DImode, operands[0]);
2822 operands[5] = gen_highpart (DImode, operands[2]);
2823 operands[2] = gen_lowpart (DImode, operands[2]);
2824 operands[6] = INTVAL (operands[1]) < 0 ? GEN_INT (-2) : constm1_rtx;
2825 operands[7] = INTVAL (operands[1]) < 0 ? constm1_rtx : const0_rtx;
2828 (define_expand "mulditi3"
2829 [(set (match_operand:TI 0 "fr_register_operand" "")
2830 (mult:TI (sign_extend:TI
2831 (match_operand:DI 1 "fr_register_operand" ""))
2833 (match_operand:DI 2 "fr_register_operand" ""))))]
2837 (define_insn_and_split "*mulditi3_internal"
2838 [(set (match_operand:TI 0 "fr_register_operand" "=&f")
2839 (mult:TI (sign_extend:TI
2840 (match_operand:DI 1 "fr_register_operand" "%f"))
2842 (match_operand:DI 2 "fr_register_operand" "f"))))]
2846 [(set (match_dup 0) (mult:DI (match_dup 1) (match_dup 2)))
2847 (set (match_dup 3) (truncate:DI
2849 (mult:TI (sign_extend:TI (match_dup 1))
2850 (sign_extend:TI (match_dup 2)))
2853 operands[3] = gen_highpart (DImode, operands[0]);
2854 operands[0] = gen_lowpart (DImode, operands[0]);
2856 [(set_attr "itanium_class" "unknown")])
2858 (define_expand "umulditi3"
2859 [(set (match_operand:TI 0 "fr_register_operand" "")
2860 (mult:TI (zero_extend:TI
2861 (match_operand:DI 1 "fr_register_operand" ""))
2863 (match_operand:DI 2 "fr_register_operand" ""))))]
2867 (define_insn_and_split "*umulditi3_internal"
2868 [(set (match_operand:TI 0 "fr_register_operand" "=&f")
2869 (mult:TI (zero_extend:TI
2870 (match_operand:DI 1 "fr_register_operand" "%f"))
2872 (match_operand:DI 2 "fr_register_operand" "f"))))]
2876 [(set (match_dup 0) (mult:DI (match_dup 1) (match_dup 2)))
2877 (set (match_dup 3) (truncate:DI
2879 (mult:TI (zero_extend:TI (match_dup 1))
2880 (zero_extend:TI (match_dup 2)))
2883 operands[3] = gen_highpart (DImode, operands[0]);
2884 operands[0] = gen_lowpart (DImode, operands[0]);
2886 [(set_attr "itanium_class" "unknown")])
2888 (define_insn_and_split "negti2"
2889 [(set (match_operand:TI 0 "gr_register_operand" "=&r")
2890 (neg:TI (match_operand:TI 1 "gr_register_operand" "r")))
2891 (clobber (match_scratch:BI 2 "=&c"))]
2895 [(set (match_dup 2) (eq:BI (match_dup 1) (const_int 0)))
2896 (set (match_dup 0) (minus:DI (const_int 0) (match_dup 1)))
2897 (cond_exec (eq (match_dup 2) (const_int 0))
2898 (set (match_dup 3) (minus:DI (const_int -1) (match_dup 4))))
2899 (cond_exec (ne (match_dup 2) (const_int 0))
2900 (set (match_dup 3) (minus:DI (const_int 0) (match_dup 4))))]
2902 operands[3] = gen_highpart (DImode, operands[0]);
2903 operands[0] = gen_lowpart (DImode, operands[0]);
2904 operands[4] = gen_highpart (DImode, operands[1]);
2905 operands[1] = gen_lowpart (DImode, operands[1]);
2907 [(set_attr "itanium_class" "unknown")])
2909 ;; ::::::::::::::::::::
2911 ;; :: 32-bit floating point arithmetic
2913 ;; ::::::::::::::::::::
2915 (define_insn "addsf3"
2916 [(set (match_operand:SF 0 "fr_register_operand" "=f")
2917 (plus:SF (match_operand:SF 1 "fr_register_operand" "%f")
2918 (match_operand:SF 2 "fr_reg_or_fp01_operand" "fG")))]
2920 "fadd.s %0 = %1, %F2"
2921 [(set_attr "itanium_class" "fmac")])
2923 (define_insn "subsf3"
2924 [(set (match_operand:SF 0 "fr_register_operand" "=f")
2925 (minus:SF (match_operand:SF 1 "fr_reg_or_fp01_operand" "fG")
2926 (match_operand:SF 2 "fr_reg_or_fp01_operand" "fG")))]
2928 "fsub.s %0 = %F1, %F2"
2929 [(set_attr "itanium_class" "fmac")])
2931 (define_insn "mulsf3"
2932 [(set (match_operand:SF 0 "fr_register_operand" "=f")
2933 (mult:SF (match_operand:SF 1 "fr_register_operand" "%f")
2934 (match_operand:SF 2 "fr_register_operand" "f")))]
2936 "fmpy.s %0 = %1, %2"
2937 [(set_attr "itanium_class" "fmac")])
2939 (define_insn "abssf2"
2940 [(set (match_operand:SF 0 "fr_register_operand" "=f")
2941 (abs:SF (match_operand:SF 1 "fr_register_operand" "f")))]
2944 [(set_attr "itanium_class" "fmisc")])
2946 (define_insn "negsf2"
2947 [(set (match_operand:SF 0 "fr_register_operand" "=f")
2948 (neg:SF (match_operand:SF 1 "fr_register_operand" "f")))]
2951 [(set_attr "itanium_class" "fmisc")])
2953 (define_insn "*nabssf2"
2954 [(set (match_operand:SF 0 "fr_register_operand" "=f")
2955 (neg:SF (abs:SF (match_operand:SF 1 "fr_register_operand" "f"))))]
2958 [(set_attr "itanium_class" "fmisc")])
2960 (define_insn "copysignsf3"
2961 [(set (match_operand:SF 0 "register_operand" "=f")
2962 (unspec:SF [(match_operand:SF 1 "fr_reg_or_fp01_operand" "fG")
2963 (match_operand:SF 2 "fr_reg_or_fp01_operand" "fG")]
2966 "fmerge.s %0 = %F2, %F1"
2967 [(set_attr "itanium_class" "fmisc")])
2969 (define_insn "*ncopysignsf3"
2970 [(set (match_operand:SF 0 "register_operand" "=f")
2971 (neg:SF (unspec:SF [(match_operand:SF 1 "fr_reg_or_fp01_operand" "fG")
2972 (match_operand:SF 2 "fr_reg_or_fp01_operand" "fG")]
2975 "fmerge.ns %0 = %F2, %F1"
2976 [(set_attr "itanium_class" "fmisc")])
2978 (define_insn "sminsf3"
2979 [(set (match_operand:SF 0 "fr_register_operand" "=f")
2980 (smin:SF (match_operand:SF 1 "fr_register_operand" "f")
2981 (match_operand:SF 2 "fr_reg_or_fp01_operand" "fG")))]
2984 [(set_attr "itanium_class" "fmisc")])
2986 (define_insn "smaxsf3"
2987 [(set (match_operand:SF 0 "fr_register_operand" "=f")
2988 (smax:SF (match_operand:SF 1 "fr_register_operand" "f")
2989 (match_operand:SF 2 "fr_reg_or_fp01_operand" "fG")))]
2992 [(set_attr "itanium_class" "fmisc")])
2994 (define_insn "*maddsf4"
2995 [(set (match_operand:SF 0 "fr_register_operand" "=f")
2996 (plus:SF (mult:SF (match_operand:SF 1 "fr_register_operand" "f")
2997 (match_operand:SF 2 "fr_register_operand" "f"))
2998 (match_operand:SF 3 "fr_reg_or_fp01_operand" "fG")))]
3000 "fma.s %0 = %1, %2, %F3"
3001 [(set_attr "itanium_class" "fmac")])
3003 (define_insn "*msubsf4"
3004 [(set (match_operand:SF 0 "fr_register_operand" "=f")
3005 (minus:SF (mult:SF (match_operand:SF 1 "fr_register_operand" "f")
3006 (match_operand:SF 2 "fr_register_operand" "f"))
3007 (match_operand:SF 3 "fr_reg_or_fp01_operand" "fG")))]
3009 "fms.s %0 = %1, %2, %F3"
3010 [(set_attr "itanium_class" "fmac")])
3012 (define_insn "*nmulsf3"
3013 [(set (match_operand:SF 0 "fr_register_operand" "=f")
3014 (neg:SF (mult:SF (match_operand:SF 1 "fr_register_operand" "f")
3015 (match_operand:SF 2 "fr_register_operand" "f"))))]
3017 "fnmpy.s %0 = %1, %2"
3018 [(set_attr "itanium_class" "fmac")])
3020 (define_insn "*nmaddsf4"
3021 [(set (match_operand:SF 0 "fr_register_operand" "=f")
3022 (minus:SF (match_operand:SF 3 "fr_reg_or_fp01_operand" "fG")
3023 (mult:SF (match_operand:SF 1 "fr_register_operand" "f")
3024 (match_operand:SF 2 "fr_register_operand" "f"))))]
3026 "fnma.s %0 = %1, %2, %F3"
3027 [(set_attr "itanium_class" "fmac")])
3029 (define_insn "*nmaddsf4_alts"
3030 [(set (match_operand:SF 0 "fr_register_operand" "=f")
3031 (minus:SF (match_operand:SF 3 "fr_reg_or_fp01_operand" "fG")
3032 (mult:SF (match_operand:SF 1 "fr_register_operand" "f")
3033 (match_operand:SF 2 "fr_register_operand" "f"))))
3034 (use (match_operand:SI 4 "const_int_operand" ""))]
3036 "fnma.s.s%4 %0 = %1, %2, %F3"
3037 [(set_attr "itanium_class" "fmac")])
3039 (define_expand "divsf3"
3040 [(set (match_operand:SF 0 "fr_register_operand" "")
3041 (div:SF (match_operand:SF 1 "fr_register_operand" "")
3042 (match_operand:SF 2 "fr_register_operand" "")))]
3043 "TARGET_INLINE_FLOAT_DIV"
3046 if (TARGET_INLINE_FLOAT_DIV == INL_MIN_LAT)
3047 insn = gen_divsf3_internal_lat (operands[0], operands[1], operands[2]);
3049 insn = gen_divsf3_internal_thr (operands[0], operands[1], operands[2]);
3054 (define_insn_and_split "divsf3_internal_lat"
3055 [(set (match_operand:SF 0 "fr_register_operand" "=&f")
3056 (div:SF (match_operand:SF 1 "fr_register_operand" "f")
3057 (match_operand:SF 2 "fr_register_operand" "f")))
3058 (clobber (match_scratch:XF 3 "=&f"))
3059 (clobber (match_scratch:XF 4 "=f"))
3060 (clobber (match_scratch:BI 5 "=c"))]
3061 "TARGET_INLINE_FLOAT_DIV == INL_MIN_LAT"
3063 "&& reload_completed"
3064 [(parallel [(set (match_dup 6) (div:XF (const_int 1) (match_dup 8)))
3065 (set (match_dup 5) (unspec:BI [(match_dup 7) (match_dup 8)]
3066 UNSPEC_FR_RECIP_APPROX))
3067 (use (const_int 0))])
3068 (cond_exec (ne (match_dup 5) (const_int 0))
3069 (parallel [(set (match_dup 3) (mult:XF (match_dup 7) (match_dup 6)))
3070 (use (const_int 1))]))
3071 (cond_exec (ne (match_dup 5) (const_int 0))
3072 (parallel [(set (match_dup 4)
3073 (minus:XF (match_dup 10)
3074 (mult:XF (match_dup 8) (match_dup 6))))
3075 (use (const_int 1))]))
3076 (cond_exec (ne (match_dup 5) (const_int 0))
3077 (parallel [(set (match_dup 3)
3078 (plus:XF (mult:XF (match_dup 4) (match_dup 3))
3080 (use (const_int 1))]))
3081 (cond_exec (ne (match_dup 5) (const_int 0))
3082 (parallel [(set (match_dup 4) (mult:XF (match_dup 4) (match_dup 4)))
3083 (use (const_int 1))]))
3084 (cond_exec (ne (match_dup 5) (const_int 0))
3085 (parallel [(set (match_dup 3)
3086 (plus:XF (mult:XF (match_dup 4) (match_dup 3))
3088 (use (const_int 1))]))
3089 (cond_exec (ne (match_dup 5) (const_int 0))
3090 (parallel [(set (match_dup 4) (mult:XF (match_dup 4) (match_dup 4)))
3091 (use (const_int 1))]))
3092 (cond_exec (ne (match_dup 5) (const_int 0))
3093 (parallel [(set (match_dup 9)
3095 (plus:XF (mult:XF (match_dup 4) (match_dup 3))
3097 (use (const_int 1))]))
3098 (cond_exec (ne (match_dup 5) (const_int 0))
3100 (float_truncate:SF (match_dup 6))))
3103 operands[6] = gen_rtx_REG (XFmode, REGNO (operands[0]));
3104 operands[7] = gen_rtx_REG (XFmode, REGNO (operands[1]));
3105 operands[8] = gen_rtx_REG (XFmode, REGNO (operands[2]));
3106 operands[9] = gen_rtx_REG (DFmode, REGNO (operands[0]));
3107 operands[10] = CONST1_RTX (XFmode);
3109 [(set_attr "predicable" "no")])
3111 ;; Inline square root.
3113 (define_insn "*sqrt_approx"
3114 [(set (match_operand:XF 0 "fr_register_operand" "=f")
3115 (div:XF (const_int 1)
3116 (sqrt:XF (match_operand:XF 2 "fr_register_operand" "f"))))
3117 (set (match_operand:BI 1 "register_operand" "=c")
3118 (unspec:BI [(match_dup 2)] UNSPEC_FR_SQRT_RECIP_APPROX))
3119 (use (match_operand:SI 3 "const_int_operand" "")) ]
3121 "frsqrta.s%3 %0, %1 = %2"
3122 [(set_attr "itanium_class" "fmisc")
3123 (set_attr "predicable" "no")])
3125 (define_insn "setf_exp_xf"
3126 [(set (match_operand:XF 0 "fr_register_operand" "=f")
3127 (unspec:XF [(match_operand:DI 1 "register_operand" "r")]
3131 [(set_attr "itanium_class" "frfr")])
3133 (define_expand "sqrtsf2"
3134 [(set (match_operand:SF 0 "fr_register_operand" "=&f")
3135 (sqrt:SF (match_operand:SF 1 "fr_register_operand" "f")))]
3136 "TARGET_INLINE_SQRT"
3140 if (TARGET_INLINE_SQRT == INL_MIN_LAT)
3141 insn = gen_sqrtsf2_internal_lat (operands[0], operands[1]);
3144 gcc_assert (TARGET_INLINE_SQRT != INL_MIN_LAT);
3146 insn = gen_sqrtsf2_internal_thr (operands[0], operands[1]);
3151 ;; Latency-optimized square root.
3152 ;; FIXME: Implement.
3154 ;; Throughput-optimized square root.
3156 (define_insn_and_split "sqrtsf2_internal_thr"
3157 [(set (match_operand:SF 0 "fr_register_operand" "=&f")
3158 (sqrt:SF (match_operand:SF 1 "fr_register_operand" "f")))
3159 ;; Register r2 in optimization guide.
3160 (clobber (match_scratch:DI 2 "=r"))
3161 ;; Register f8 in optimization guide
3162 (clobber (match_scratch:XF 3 "=&f"))
3163 ;; Register f9 in optimization guide
3164 (clobber (match_scratch:XF 4 "=&f"))
3165 ;; Register f10 in optimization guide
3166 (clobber (match_scratch:XF 5 "=&f"))
3167 ;; Register p6 in optimization guide.
3168 (clobber (match_scratch:BI 6 "=c"))]
3169 "TARGET_INLINE_SQRT == INL_MAX_THR"
3171 "&& reload_completed"
3172 [ ;; exponent of +1/2 in r2
3173 (set (match_dup 2) (const_int 65534))
3176 (unspec:XF [(match_dup 2)] UNSPEC_SETF_EXP))
3178 ;; y0 = 1/sqrt(a) in f7
3179 (parallel [(set (match_dup 7)
3180 (div:XF (const_int 1)
3181 (sqrt:XF (match_dup 8))))
3183 (unspec:BI [(match_dup 8)]
3184 UNSPEC_FR_SQRT_RECIP_APPROX))
3185 (use (const_int 0))])
3187 ;; H0 = 1/2 * y0 in f9
3188 (cond_exec (ne (match_dup 6) (const_int 0))
3189 (parallel [(set (match_dup 4)
3190 (plus:XF (mult:XF (match_dup 3) (match_dup 7))
3192 (use (const_int 1))]))
3194 ;; S0 = a * y0 in f7
3195 (cond_exec (ne (match_dup 6) (const_int 0))
3196 (parallel [(set (match_dup 7)
3197 (plus:XF (mult:XF (match_dup 8) (match_dup 7))
3199 (use (const_int 1))]))
3201 ;; d = 1/2 - S0 * H0 in f10
3202 (cond_exec (ne (match_dup 6) (const_int 0))
3203 (parallel [(set (match_dup 5)
3204 (minus:XF (match_dup 3)
3205 (mult:XF (match_dup 7) (match_dup 4))))
3206 (use (const_int 1))]))
3208 ;; d' = d + 1/2 * d in f8
3209 (cond_exec (ne (match_dup 6) (const_int 0))
3210 (parallel [(set (match_dup 3)
3211 (plus:XF (mult:XF (match_dup 3) (match_dup 5))
3213 (use (const_int 1))]))
3215 ;; e = d + d * d' in f8
3216 (cond_exec (ne (match_dup 6) (const_int 0))
3217 (parallel [(set (match_dup 3)
3218 (plus:XF (mult:XF (match_dup 5) (match_dup 3))
3220 (use (const_int 1))]))
3222 ;; S1 = S0 + e * S0 in f7
3223 (cond_exec (ne (match_dup 6) (const_int 0))
3224 (parallel [(set (match_dup 0)
3226 (plus:XF (mult:XF (match_dup 3) (match_dup 7))
3228 (use (const_int 1))]))
3230 ;; H1 = H0 + e * H0 in f8
3231 (cond_exec (ne (match_dup 6) (const_int 0))
3232 (parallel [(set (match_dup 3)
3233 (plus:XF (mult:XF (match_dup 3) (match_dup 4))
3235 (use (const_int 1))]))
3237 ;; d1 = a - S1 * S1 in f9
3238 (cond_exec (ne (match_dup 6) (const_int 0))
3239 (parallel [(set (match_dup 4)
3240 (minus:XF (match_dup 8)
3241 (mult:XF (match_dup 7) (match_dup 7))))
3242 (use (const_int 1))]))
3244 ;; S = S1 + d1 * H1 in f7
3245 (cond_exec (ne (match_dup 6) (const_int 0))
3246 (parallel [(set (match_dup 0)
3248 (plus:XF (mult:XF (match_dup 4) (match_dup 3))
3250 (use (const_int 0))]))]
3252 /* Generate 82-bit versions of the input and output operands. */
3253 operands[7] = gen_rtx_REG (XFmode, REGNO (operands[0]));
3254 operands[8] = gen_rtx_REG (XFmode, REGNO (operands[1]));
3255 /* Generate required floating-point constants. */
3256 operands[9] = CONST0_RTX (XFmode);
3258 [(set_attr "predicable" "no")])
3260 ;; ::::::::::::::::::::
3262 ;; :: 64-bit floating point arithmetic
3264 ;; ::::::::::::::::::::
3266 (define_insn "adddf3"
3267 [(set (match_operand:DF 0 "fr_register_operand" "=f")
3268 (plus:DF (match_operand:DF 1 "fr_register_operand" "%f")
3269 (match_operand:DF 2 "fr_reg_or_fp01_operand" "fG")))]
3271 "fadd.d %0 = %1, %F2"
3272 [(set_attr "itanium_class" "fmac")])
3274 (define_insn "*adddf3_trunc"
3275 [(set (match_operand:SF 0 "fr_register_operand" "=f")
3277 (plus:DF (match_operand:DF 1 "fr_register_operand" "%f")
3278 (match_operand:DF 2 "fr_reg_or_fp01_operand" "fG"))))]
3280 "fadd.s %0 = %1, %F2"
3281 [(set_attr "itanium_class" "fmac")])
3283 (define_insn "subdf3"
3284 [(set (match_operand:DF 0 "fr_register_operand" "=f")
3285 (minus:DF (match_operand:DF 1 "fr_reg_or_fp01_operand" "fG")
3286 (match_operand:DF 2 "fr_reg_or_fp01_operand" "fG")))]
3288 "fsub.d %0 = %F1, %F2"
3289 [(set_attr "itanium_class" "fmac")])
3291 (define_insn "*subdf3_trunc"
3292 [(set (match_operand:SF 0 "fr_register_operand" "=f")
3294 (minus:DF (match_operand:DF 1 "fr_reg_or_fp01_operand" "fG")
3295 (match_operand:DF 2 "fr_reg_or_fp01_operand" "fG"))))]
3297 "fsub.s %0 = %F1, %F2"
3298 [(set_attr "itanium_class" "fmac")])
3300 (define_insn "muldf3"
3301 [(set (match_operand:DF 0 "fr_register_operand" "=f")
3302 (mult:DF (match_operand:DF 1 "fr_register_operand" "f")
3303 (match_operand:DF 2 "fr_register_operand" "f")))]
3305 "fmpy.d %0 = %1, %2"
3306 [(set_attr "itanium_class" "fmac")])
3308 (define_insn "*muldf3_trunc"
3309 [(set (match_operand:SF 0 "fr_register_operand" "=f")
3311 (mult:DF (match_operand:DF 1 "fr_register_operand" "f")
3312 (match_operand:DF 2 "fr_register_operand" "f"))))]
3314 "fmpy.s %0 = %1, %2"
3315 [(set_attr "itanium_class" "fmac")])
3317 (define_insn "absdf2"
3318 [(set (match_operand:DF 0 "fr_register_operand" "=f")
3319 (abs:DF (match_operand:DF 1 "fr_register_operand" "f")))]
3322 [(set_attr "itanium_class" "fmisc")])
3324 (define_insn "negdf2"
3325 [(set (match_operand:DF 0 "fr_register_operand" "=f")
3326 (neg:DF (match_operand:DF 1 "fr_register_operand" "f")))]
3329 [(set_attr "itanium_class" "fmisc")])
3331 (define_insn "*nabsdf2"
3332 [(set (match_operand:DF 0 "fr_register_operand" "=f")
3333 (neg:DF (abs:DF (match_operand:DF 1 "fr_register_operand" "f"))))]
3336 [(set_attr "itanium_class" "fmisc")])
3338 (define_insn "copysigndf3"
3339 [(set (match_operand:DF 0 "register_operand" "=f")
3340 (unspec:DF [(match_operand:DF 1 "fr_reg_or_fp01_operand" "fG")
3341 (match_operand:DF 2 "fr_reg_or_fp01_operand" "fG")]
3344 "fmerge.s %0 = %F2, %F1"
3345 [(set_attr "itanium_class" "fmisc")])
3347 (define_insn "*ncopysigndf3"
3348 [(set (match_operand:DF 0 "register_operand" "=f")
3349 (neg:DF (unspec:DF [(match_operand:DF 1 "fr_reg_or_fp01_operand" "fG")
3350 (match_operand:DF 2 "fr_reg_or_fp01_operand" "fG")]
3353 "fmerge.ns %0 = %F2, %F1"
3354 [(set_attr "itanium_class" "fmisc")])
3356 (define_insn "smindf3"
3357 [(set (match_operand:DF 0 "fr_register_operand" "=f")
3358 (smin:DF (match_operand:DF 1 "fr_register_operand" "f")
3359 (match_operand:DF 2 "fr_reg_or_fp01_operand" "fG")))]
3362 [(set_attr "itanium_class" "fmisc")])
3364 (define_insn "smaxdf3"
3365 [(set (match_operand:DF 0 "fr_register_operand" "=f")
3366 (smax:DF (match_operand:DF 1 "fr_register_operand" "f")
3367 (match_operand:DF 2 "fr_reg_or_fp01_operand" "fG")))]
3370 [(set_attr "itanium_class" "fmisc")])
3372 (define_insn "*madddf4"
3373 [(set (match_operand:DF 0 "fr_register_operand" "=f")
3374 (plus:DF (mult:DF (match_operand:DF 1 "fr_register_operand" "f")
3375 (match_operand:DF 2 "fr_register_operand" "f"))
3376 (match_operand:DF 3 "fr_reg_or_fp01_operand" "fG")))]
3378 "fma.d %0 = %1, %2, %F3"
3379 [(set_attr "itanium_class" "fmac")])
3381 (define_insn "*madddf4_trunc"
3382 [(set (match_operand:SF 0 "fr_register_operand" "=f")
3384 (plus:DF (mult:DF (match_operand:DF 1 "fr_register_operand" "f")
3385 (match_operand:DF 2 "fr_register_operand" "f"))
3386 (match_operand:DF 3 "fr_reg_or_fp01_operand" "fG"))))]
3388 "fma.s %0 = %1, %2, %F3"
3389 [(set_attr "itanium_class" "fmac")])
3391 (define_insn "*msubdf4"
3392 [(set (match_operand:DF 0 "fr_register_operand" "=f")
3393 (minus:DF (mult:DF (match_operand:DF 1 "fr_register_operand" "f")
3394 (match_operand:DF 2 "fr_register_operand" "f"))
3395 (match_operand:DF 3 "fr_reg_or_fp01_operand" "fG")))]
3397 "fms.d %0 = %1, %2, %F3"
3398 [(set_attr "itanium_class" "fmac")])
3400 (define_insn "*msubdf4_trunc"
3401 [(set (match_operand:SF 0 "fr_register_operand" "=f")
3403 (minus:DF (mult:DF (match_operand:DF 1 "fr_register_operand" "f")
3404 (match_operand:DF 2 "fr_register_operand" "f"))
3405 (match_operand:DF 3 "fr_reg_or_fp01_operand" "fG"))))]
3407 "fms.s %0 = %1, %2, %F3"
3408 [(set_attr "itanium_class" "fmac")])
3410 (define_insn "*nmuldf3"
3411 [(set (match_operand:DF 0 "fr_register_operand" "=f")
3412 (neg:DF (mult:DF (match_operand:DF 1 "fr_register_operand" "f")
3413 (match_operand:DF 2 "fr_register_operand" "f"))))]
3415 "fnmpy.d %0 = %1, %2"
3416 [(set_attr "itanium_class" "fmac")])
3418 (define_insn "*nmuldf3_trunc"
3419 [(set (match_operand:SF 0 "fr_register_operand" "=f")
3421 (neg:DF (mult:DF (match_operand:DF 1 "fr_register_operand" "f")
3422 (match_operand:DF 2 "fr_register_operand" "f")))))]
3424 "fnmpy.s %0 = %1, %2"
3425 [(set_attr "itanium_class" "fmac")])
3427 (define_insn "*nmadddf4"
3428 [(set (match_operand:DF 0 "fr_register_operand" "=f")
3429 (minus:DF (match_operand:DF 3 "fr_reg_or_fp01_operand" "fG")
3430 (mult:DF (match_operand:DF 1 "fr_register_operand" "f")
3431 (match_operand:DF 2 "fr_register_operand" "f"))))]
3433 "fnma.d %0 = %1, %2, %F3"
3434 [(set_attr "itanium_class" "fmac")])
3436 (define_insn "*nmadddf4_alts"
3437 [(set (match_operand:DF 0 "fr_register_operand" "=f")
3438 (minus:DF (match_operand:DF 3 "fr_reg_or_fp01_operand" "fG")
3439 (mult:DF (match_operand:DF 1 "fr_register_operand" "f")
3440 (match_operand:DF 2 "fr_register_operand" "f"))))
3441 (use (match_operand:SI 4 "const_int_operand" ""))]
3443 "fnma.d.s%4 %0 = %1, %2, %F3"
3444 [(set_attr "itanium_class" "fmac")])
3446 (define_insn "*nmadddf4_truncsf"
3447 [(set (match_operand:SF 0 "fr_register_operand" "=f")
3449 (minus:DF (match_operand:DF 3 "fr_reg_or_fp01_operand" "fG")
3450 (mult:DF (match_operand:DF 1 "fr_register_operand" "f")
3451 (match_operand:DF 2 "fr_register_operand" "f")))))]
3453 "fnma.s %0 = %1, %2, %F3"
3454 [(set_attr "itanium_class" "fmac")])
3456 (define_insn "*nmadddf4_truncsf_alts"
3457 [(set (match_operand:SF 0 "fr_register_operand" "=f")
3459 (minus:DF (match_operand:DF 3 "fr_reg_or_fp01_operand" "fG")
3460 (mult:DF (match_operand:DF 1 "fr_register_operand" "f")
3461 (match_operand:DF 2 "fr_register_operand" "f")))))
3462 (use (match_operand:SI 4 "const_int_operand" ""))]
3464 "fnma.s.s%4 %0 = %1, %2, %F3"
3465 [(set_attr "itanium_class" "fmac")])
3467 (define_expand "divdf3"
3468 [(set (match_operand:DF 0 "fr_register_operand" "")
3469 (div:DF (match_operand:DF 1 "fr_register_operand" "")
3470 (match_operand:DF 2 "fr_register_operand" "")))]
3471 "TARGET_INLINE_FLOAT_DIV"
3474 if (TARGET_INLINE_FLOAT_DIV == INL_MIN_LAT)
3475 insn = gen_divdf3_internal_lat (operands[0], operands[1], operands[2]);
3477 insn = gen_divdf3_internal_thr (operands[0], operands[1], operands[2]);
3482 (define_insn_and_split "divdf3_internal_lat"
3483 [(set (match_operand:DF 0 "fr_register_operand" "=&f")
3484 (div:DF (match_operand:DF 1 "fr_register_operand" "f")
3485 (match_operand:DF 2 "fr_register_operand" "f")))
3486 (clobber (match_scratch:XF 3 "=&f"))
3487 (clobber (match_scratch:XF 4 "=&f"))
3488 (clobber (match_scratch:XF 5 "=&f"))
3489 (clobber (match_scratch:BI 6 "=c"))]
3490 "TARGET_INLINE_FLOAT_DIV == INL_MIN_LAT"
3492 "&& reload_completed"
3493 [(parallel [(set (match_dup 7) (div:XF (const_int 1) (match_dup 9)))
3494 (set (match_dup 6) (unspec:BI [(match_dup 8) (match_dup 9)]
3495 UNSPEC_FR_RECIP_APPROX))
3496 (use (const_int 0))])
3497 (cond_exec (ne (match_dup 6) (const_int 0))
3498 (parallel [(set (match_dup 3) (mult:XF (match_dup 8) (match_dup 7)))
3499 (use (const_int 1))]))
3500 (cond_exec (ne (match_dup 6) (const_int 0))
3501 (parallel [(set (match_dup 4)
3502 (minus:XF (match_dup 12)
3503 (mult:XF (match_dup 9) (match_dup 7))))
3504 (use (const_int 1))]))
3505 (cond_exec (ne (match_dup 6) (const_int 0))
3506 (parallel [(set (match_dup 3)
3507 (plus:XF (mult:XF (match_dup 4) (match_dup 3))
3509 (use (const_int 1))]))
3510 (cond_exec (ne (match_dup 6) (const_int 0))
3511 (parallel [(set (match_dup 5) (mult:XF (match_dup 4) (match_dup 4)))
3512 (use (const_int 1))]))
3513 (cond_exec (ne (match_dup 6) (const_int 0))
3514 (parallel [(set (match_dup 7)
3515 (plus:XF (mult:XF (match_dup 4) (match_dup 7))
3517 (use (const_int 1))]))
3518 (cond_exec (ne (match_dup 6) (const_int 0))
3519 (parallel [(set (match_dup 3)
3520 (plus:XF (mult:XF (match_dup 5) (match_dup 3))
3522 (use (const_int 1))]))
3523 (cond_exec (ne (match_dup 6) (const_int 0))
3524 (parallel [(set (match_dup 4) (mult:XF (match_dup 5) (match_dup 5)))
3525 (use (const_int 1))]))
3526 (cond_exec (ne (match_dup 6) (const_int 0))
3527 (parallel [(set (match_dup 7)
3528 (plus:XF (mult:XF (match_dup 5) (match_dup 7))
3530 (use (const_int 1))]))
3531 (cond_exec (ne (match_dup 6) (const_int 0))
3532 (parallel [(set (match_dup 10)
3534 (plus:XF (mult:XF (match_dup 4) (match_dup 3))
3536 (use (const_int 1))]))
3537 (cond_exec (ne (match_dup 6) (const_int 0))
3538 (parallel [(set (match_dup 7)
3539 (plus:XF (mult:XF (match_dup 4) (match_dup 7))
3541 (use (const_int 1))]))
3542 (cond_exec (ne (match_dup 6) (const_int 0))
3543 (parallel [(set (match_dup 11)
3545 (minus:XF (match_dup 8)
3546 (mult:XF (match_dup 9) (match_dup 3)))))
3547 (use (const_int 1))]))
3548 (cond_exec (ne (match_dup 6) (const_int 0))
3550 (float_truncate:DF (plus:XF (mult:XF (match_dup 5) (match_dup 7))
3554 operands[7] = gen_rtx_REG (XFmode, REGNO (operands[0]));
3555 operands[8] = gen_rtx_REG (XFmode, REGNO (operands[1]));
3556 operands[9] = gen_rtx_REG (XFmode, REGNO (operands[2]));
3557 operands[10] = gen_rtx_REG (DFmode, REGNO (operands[3]));
3558 operands[11] = gen_rtx_REG (DFmode, REGNO (operands[5]));
3559 operands[12] = CONST1_RTX (XFmode);
3561 [(set_attr "predicable" "no")])
3563 ;; Inline square root.
3565 (define_expand "sqrtdf2"
3566 [(set (match_operand:DF 0 "fr_register_operand" "=&f")
3567 (sqrt:DF (match_operand:DF 1 "fr_register_operand" "f")))]
3568 "TARGET_INLINE_SQRT"
3572 if (TARGET_INLINE_SQRT == INL_MIN_LAT)
3573 insn = gen_sqrtdf2_internal_lat (operands[0], operands[1]);
3576 gcc_assert (TARGET_INLINE_SQRT != INL_MIN_LAT);
3578 insn = gen_sqrtdf2_internal_thr (operands[0], operands[1]);
3583 ;; Latency-optimized square root.
3584 ;; FIXME: Implement.
3586 ;; Throughput-optimized square root.
3588 (define_insn_and_split "sqrtdf2_internal_thr"
3589 [(set (match_operand:DF 0 "fr_register_operand" "=&f")
3590 (sqrt:DF (match_operand:DF 1 "fr_register_operand" "f")))
3591 ;; Register r2 in optimization guide.
3592 (clobber (match_scratch:DI 2 "=r"))
3593 ;; Register f8 in optimization guide
3594 (clobber (match_scratch:XF 3 "=&f"))
3595 ;; Register f9 in optimization guide
3596 (clobber (match_scratch:XF 4 "=&f"))
3597 ;; Register f10 in optimization guide
3598 (clobber (match_scratch:XF 5 "=&f"))
3599 ;; Register p6 in optimization guide.
3600 (clobber (match_scratch:BI 6 "=c"))]
3601 "TARGET_INLINE_SQRT == INL_MAX_THR"
3603 "&& reload_completed"
3604 [ ;; exponent of +1/2 in r2
3605 (set (match_dup 2) (const_int 65534))
3608 (unspec:XF [(match_dup 2)] UNSPEC_SETF_EXP))
3610 ;; y0 = 1/sqrt(a) in f7
3611 (parallel [(set (match_dup 7)
3612 (div:XF (const_int 1)
3613 (sqrt:XF (match_dup 8))))
3615 (unspec:BI [(match_dup 8)]
3616 UNSPEC_FR_SQRT_RECIP_APPROX))
3617 (use (const_int 0))])
3619 ;; H0 = 1/2 * y0 in f8
3620 (cond_exec (ne (match_dup 6) (const_int 0))
3621 (parallel [(set (match_dup 3)
3622 (plus:XF (mult:XF (match_dup 5) (match_dup 7))
3624 (use (const_int 1))]))
3626 ;; G0 = a * y0 in f7
3627 (cond_exec (ne (match_dup 6) (const_int 0))
3628 (parallel [(set (match_dup 7)
3629 (plus:XF (mult:XF (match_dup 8) (match_dup 7))
3631 (use (const_int 1))]))
3633 ;; r0 = 1/2 - G0 * H0 in f9
3634 (cond_exec (ne (match_dup 6) (const_int 0))
3635 (parallel [(set (match_dup 4)
3636 (minus:XF (match_dup 5)
3637 (mult:XF (match_dup 7) (match_dup 3))))
3638 (use (const_int 1))]))
3640 ;; H1 = H0 + r0 * H0 in f8
3641 (cond_exec (ne (match_dup 6) (const_int 0))
3642 (parallel [(set (match_dup 3)
3643 (plus:XF (mult:XF (match_dup 4) (match_dup 3))
3645 (use (const_int 1))]))
3647 ;; G1 = G0 + r0 * G0 in f7
3648 (cond_exec (ne (match_dup 6) (const_int 0))
3649 (parallel [(set (match_dup 7)
3650 (plus:XF (mult:XF (match_dup 4) (match_dup 7))
3652 (use (const_int 1))]))
3654 ;; r1 = 1/2 - G1 * H1 in f9
3655 (cond_exec (ne (match_dup 6) (const_int 0))
3656 (parallel [(set (match_dup 4)
3657 (minus:XF (match_dup 5)
3658 (mult:XF (match_dup 7) (match_dup 3))))
3659 (use (const_int 1))]))
3661 ;; H2 = H1 + r1 * H1 in f8
3662 (cond_exec (ne (match_dup 6) (const_int 0))
3663 (parallel [(set (match_dup 3)
3664 (plus:XF (mult:XF (match_dup 4) (match_dup 3))
3666 (use (const_int 1))]))
3668 ;; G2 = G1 + r1 * G1 in f7
3669 (cond_exec (ne (match_dup 6) (const_int 0))
3670 (parallel [(set (match_dup 7)
3671 (plus:XF (mult:XF (match_dup 4) (match_dup 7))
3673 (use (const_int 1))]))
3675 ;; d2 = a - G2 * G2 in f9
3676 (cond_exec (ne (match_dup 6) (const_int 0))
3677 (parallel [(set (match_dup 4)
3678 (minus:XF (match_dup 8)
3679 (mult:XF (match_dup 7) (match_dup 7))))
3680 (use (const_int 1))]))
3682 ;; G3 = G2 + d2 * H2 in f7
3683 (cond_exec (ne (match_dup 6) (const_int 0))
3684 (parallel [(set (match_dup 7)
3685 (plus:XF (mult:XF (match_dup 4) (match_dup 3))
3687 (use (const_int 1))]))
3689 ;; d3 = a - G3 * G3 in f9
3690 (cond_exec (ne (match_dup 6) (const_int 0))
3691 (parallel [(set (match_dup 4)
3692 (minus:XF (match_dup 8)
3693 (mult:XF (match_dup 7) (match_dup 7))))
3694 (use (const_int 1))]))
3696 ;; S = G3 + d3 * H2 in f7
3697 (cond_exec (ne (match_dup 6) (const_int 0))
3698 (parallel [(set (match_dup 0)
3700 (plus:XF (mult:XF (match_dup 4) (match_dup 3))
3702 (use (const_int 0))]))]
3704 /* Generate 82-bit versions of the input and output operands. */
3705 operands[7] = gen_rtx_REG (XFmode, REGNO (operands[0]));
3706 operands[8] = gen_rtx_REG (XFmode, REGNO (operands[1]));
3707 /* Generate required floating-point constants. */
3708 operands[9] = CONST0_RTX (XFmode);
3710 [(set_attr "predicable" "no")])
3712 ;; ::::::::::::::::::::
3714 ;; :: 80-bit floating point arithmetic
3716 ;; ::::::::::::::::::::
3718 (define_insn "addxf3"
3719 [(set (match_operand:XF 0 "fr_register_operand" "=f")
3720 (plus:XF (match_operand:XF 1 "xfreg_or_fp01_operand" "fG")
3721 (match_operand:XF 2 "xfreg_or_fp01_operand" "fG")))]
3723 "fadd %0 = %F1, %F2"
3724 [(set_attr "itanium_class" "fmac")])
3726 (define_insn "*addxf3_truncsf"
3727 [(set (match_operand:SF 0 "fr_register_operand" "=f")
3729 (plus:XF (match_operand:XF 1 "xfreg_or_fp01_operand" "fG")
3730 (match_operand:XF 2 "xfreg_or_fp01_operand" "fG"))))]
3732 "fadd.s %0 = %F1, %F2"
3733 [(set_attr "itanium_class" "fmac")])
3735 (define_insn "*addxf3_truncdf"
3736 [(set (match_operand:DF 0 "fr_register_operand" "=f")
3738 (plus:XF (match_operand:XF 1 "xfreg_or_fp01_operand" "fG")
3739 (match_operand:XF 2 "xfreg_or_fp01_operand" "fG"))))]
3741 "fadd.d %0 = %F1, %F2"
3742 [(set_attr "itanium_class" "fmac")])
3744 (define_insn "subxf3"
3745 [(set (match_operand:XF 0 "fr_register_operand" "=f")
3746 (minus:XF (match_operand:XF 1 "xfreg_or_fp01_operand" "fG")
3747 (match_operand:XF 2 "xfreg_or_fp01_operand" "fG")))]
3749 "fsub %0 = %F1, %F2"
3750 [(set_attr "itanium_class" "fmac")])
3752 (define_insn "*subxf3_truncsf"
3753 [(set (match_operand:SF 0 "fr_register_operand" "=f")
3755 (minus:XF (match_operand:XF 1 "xfreg_or_fp01_operand" "fG")
3756 (match_operand:XF 2 "xfreg_or_fp01_operand" "fG"))))]
3758 "fsub.s %0 = %F1, %F2"
3759 [(set_attr "itanium_class" "fmac")])
3761 (define_insn "*subxf3_truncdf"
3762 [(set (match_operand:DF 0 "fr_register_operand" "=f")
3764 (minus:XF (match_operand:XF 1 "xfreg_or_fp01_operand" "fG")
3765 (match_operand:XF 2 "xfreg_or_fp01_operand" "fG"))))]
3767 "fsub.d %0 = %F1, %F2"
3768 [(set_attr "itanium_class" "fmac")])
3770 (define_insn "mulxf3"
3771 [(set (match_operand:XF 0 "fr_register_operand" "=f")
3772 (mult:XF (match_operand:XF 1 "xfreg_or_fp01_operand" "fG")
3773 (match_operand:XF 2 "xfreg_or_fp01_operand" "fG")))]
3775 "fmpy %0 = %F1, %F2"
3776 [(set_attr "itanium_class" "fmac")])
3778 (define_insn "*mulxf3_truncsf"
3779 [(set (match_operand:SF 0 "fr_register_operand" "=f")
3781 (mult:XF (match_operand:XF 1 "xfreg_or_fp01_operand" "fG")
3782 (match_operand:XF 2 "xfreg_or_fp01_operand" "fG"))))]
3784 "fmpy.s %0 = %F1, %F2"
3785 [(set_attr "itanium_class" "fmac")])
3787 (define_insn "*mulxf3_truncdf"
3788 [(set (match_operand:DF 0 "fr_register_operand" "=f")
3790 (mult:XF (match_operand:XF 1 "xfreg_or_fp01_operand" "fG")
3791 (match_operand:XF 2 "xfreg_or_fp01_operand" "fG"))))]
3793 "fmpy.d %0 = %F1, %F2"
3794 [(set_attr "itanium_class" "fmac")])
3796 (define_insn "*mulxf3_alts"
3797 [(set (match_operand:XF 0 "fr_register_operand" "=f")
3798 (mult:XF (match_operand:XF 1 "xfreg_or_fp01_operand" "fG")
3799 (match_operand:XF 2 "xfreg_or_fp01_operand" "fG")))
3800 (use (match_operand:SI 3 "const_int_operand" ""))]
3802 "fmpy.s%3 %0 = %F1, %F2"
3803 [(set_attr "itanium_class" "fmac")])
3805 (define_insn "*mulxf3_truncsf_alts"
3806 [(set (match_operand:SF 0 "fr_register_operand" "=f")
3808 (mult:XF (match_operand:XF 1 "xfreg_or_fp01_operand" "fG")
3809 (match_operand:XF 2 "xfreg_or_fp01_operand" "fG"))))
3810 (use (match_operand:SI 3 "const_int_operand" ""))]
3812 "fmpy.s.s%3 %0 = %F1, %F2"
3813 [(set_attr "itanium_class" "fmac")])
3815 (define_insn "*mulxf3_truncdf_alts"
3816 [(set (match_operand:DF 0 "fr_register_operand" "=f")
3818 (mult:XF (match_operand:XF 1 "xfreg_or_fp01_operand" "fG")
3819 (match_operand:XF 2 "xfreg_or_fp01_operand" "fG"))))
3820 (use (match_operand:SI 3 "const_int_operand" ""))]
3822 "fmpy.d.s%3 %0 = %F1, %F2"
3823 [(set_attr "itanium_class" "fmac")])
3825 (define_insn "absxf2"
3826 [(set (match_operand:XF 0 "fr_register_operand" "=f")
3827 (abs:XF (match_operand:XF 1 "xfreg_or_fp01_operand" "fG")))]
3830 [(set_attr "itanium_class" "fmisc")])
3832 (define_insn "negxf2"
3833 [(set (match_operand:XF 0 "fr_register_operand" "=f")
3834 (neg:XF (match_operand:XF 1 "xfreg_or_fp01_operand" "fG")))]
3837 [(set_attr "itanium_class" "fmisc")])
3839 (define_insn "*nabsxf2"
3840 [(set (match_operand:XF 0 "fr_register_operand" "=f")
3841 (neg:XF (abs:XF (match_operand:XF 1 "xfreg_or_fp01_operand" "fG"))))]
3844 [(set_attr "itanium_class" "fmisc")])
3846 (define_insn "copysignxf3"
3847 [(set (match_operand:XF 0 "register_operand" "=f")
3848 (unspec:XF [(match_operand:XF 1 "fr_reg_or_fp01_operand" "fG")
3849 (match_operand:XF 2 "fr_reg_or_fp01_operand" "fG")]
3852 "fmerge.s %0 = %F2, %F1"
3853 [(set_attr "itanium_class" "fmisc")])
3855 (define_insn "*ncopysignxf3"
3856 [(set (match_operand:XF 0 "register_operand" "=f")
3857 (neg:XF (unspec:XF [(match_operand:XF 1 "fr_reg_or_fp01_operand" "fG")
3858 (match_operand:XF 2 "fr_reg_or_fp01_operand" "fG")]
3861 "fmerge.ns %0 = %F2, %F1"
3862 [(set_attr "itanium_class" "fmisc")])
3864 (define_insn "sminxf3"
3865 [(set (match_operand:XF 0 "fr_register_operand" "=f")
3866 (smin:XF (match_operand:XF 1 "xfreg_or_fp01_operand" "fG")
3867 (match_operand:XF 2 "xfreg_or_fp01_operand" "fG")))]
3869 "fmin %0 = %F1, %F2"
3870 [(set_attr "itanium_class" "fmisc")])
3872 (define_insn "smaxxf3"
3873 [(set (match_operand:XF 0 "fr_register_operand" "=f")
3874 (smax:XF (match_operand:XF 1 "xfreg_or_fp01_operand" "fG")
3875 (match_operand:XF 2 "xfreg_or_fp01_operand" "fG")))]
3877 "fmax %0 = %F1, %F2"
3878 [(set_attr "itanium_class" "fmisc")])
3880 (define_insn "*maddxf4"
3881 [(set (match_operand:XF 0 "fr_register_operand" "=f")
3882 (plus:XF (mult:XF (match_operand:XF 1 "xfreg_or_fp01_operand" "fG")
3883 (match_operand:XF 2 "xfreg_or_fp01_operand" "fG"))
3884 (match_operand:XF 3 "xfreg_or_fp01_operand" "fG")))]
3886 "fma %0 = %F1, %F2, %F3"
3887 [(set_attr "itanium_class" "fmac")])
3889 (define_insn "*maddxf4_truncsf"
3890 [(set (match_operand:SF 0 "fr_register_operand" "=f")
3892 (plus:XF (mult:XF (match_operand:XF 1 "xfreg_or_fp01_operand" "fG")
3893 (match_operand:XF 2 "xfreg_or_fp01_operand" "fG"))
3894 (match_operand:XF 3 "xfreg_or_fp01_operand" "fG"))))]
3896 "fma.s %0 = %F1, %F2, %F3"
3897 [(set_attr "itanium_class" "fmac")])
3899 (define_insn "*maddxf4_truncdf"
3900 [(set (match_operand:DF 0 "fr_register_operand" "=f")
3902 (plus:XF (mult:XF (match_operand:XF 1 "xfreg_or_fp01_operand" "fG")
3903 (match_operand:XF 2 "xfreg_or_fp01_operand" "fG"))
3904 (match_operand:XF 3 "xfreg_or_fp01_operand" "fG"))))]
3906 "fma.d %0 = %F1, %F2, %F3"
3907 [(set_attr "itanium_class" "fmac")])
3909 (define_insn "*maddxf4_alts"
3910 [(set (match_operand:XF 0 "fr_register_operand" "=f")
3911 (plus:XF (mult:XF (match_operand:XF 1 "xfreg_or_fp01_operand" "fG")
3912 (match_operand:XF 2 "xfreg_or_fp01_operand" "fG"))
3913 (match_operand:XF 3 "xfreg_or_fp01_operand" "fG")))
3914 (use (match_operand:SI 4 "const_int_operand" ""))]
3916 "fma.s%4 %0 = %F1, %F2, %F3"
3917 [(set_attr "itanium_class" "fmac")])
3919 (define_insn "*maddxf4_alts_truncsf"
3920 [(set (match_operand:SF 0 "fr_register_operand" "=f")
3922 (plus:XF (mult:XF (match_operand:XF 1 "xfreg_or_fp01_operand" "fG")
3923 (match_operand:XF 2 "xfreg_or_fp01_operand" "fG"))
3924 (match_operand:XF 3 "xfreg_or_fp01_operand" "fG"))))
3925 (use (match_operand:SI 4 "const_int_operand" ""))]
3927 "fma.s.s%4 %0 = %F1, %F2, %F3"
3928 [(set_attr "itanium_class" "fmac")])
3930 (define_insn "*maddxf4_alts_truncdf"
3931 [(set (match_operand:DF 0 "fr_register_operand" "=f")
3933 (plus:XF (mult:XF (match_operand:XF 1 "xfreg_or_fp01_operand" "fG")
3934 (match_operand:XF 2 "xfreg_or_fp01_operand" "fG"))
3935 (match_operand:XF 3 "xfreg_or_fp01_operand" "fG"))))
3936 (use (match_operand:SI 4 "const_int_operand" ""))]
3938 "fma.d.s%4 %0 = %F1, %F2, %F3"
3939 [(set_attr "itanium_class" "fmac")])
3941 (define_insn "*msubxf4"
3942 [(set (match_operand:XF 0 "fr_register_operand" "=f")
3943 (minus:XF (mult:XF (match_operand:XF 1 "xfreg_or_fp01_operand" "fG")
3944 (match_operand:XF 2 "xfreg_or_fp01_operand" "fG"))
3945 (match_operand:XF 3 "xfreg_or_fp01_operand" "fG")))]
3947 "fms %0 = %F1, %F2, %F3"
3948 [(set_attr "itanium_class" "fmac")])
3950 (define_insn "*msubxf4_truncsf"
3951 [(set (match_operand:SF 0 "fr_register_operand" "=f")
3953 (minus:XF (mult:XF (match_operand:XF 1 "xfreg_or_fp01_operand" "fG")
3954 (match_operand:XF 2 "xfreg_or_fp01_operand" "fG"))
3955 (match_operand:XF 3 "xfreg_or_fp01_operand" "fG"))))]
3957 "fms.s %0 = %F1, %F2, %F3"
3958 [(set_attr "itanium_class" "fmac")])
3960 (define_insn "*msubxf4_truncdf"
3961 [(set (match_operand:DF 0 "fr_register_operand" "=f")
3963 (minus:XF (mult:XF (match_operand:XF 1 "xfreg_or_fp01_operand" "fG")
3964 (match_operand:XF 2 "xfreg_or_fp01_operand" "fG"))
3965 (match_operand:XF 3 "xfreg_or_fp01_operand" "fG"))))]
3967 "fms.d %0 = %F1, %F2, %F3"
3968 [(set_attr "itanium_class" "fmac")])
3970 (define_insn "*nmulxf3"
3971 [(set (match_operand:XF 0 "fr_register_operand" "=f")
3972 (neg:XF (mult:XF (match_operand:XF 1 "xfreg_or_fp01_operand" "fG")
3973 (match_operand:XF 2 "xfreg_or_fp01_operand" "fG"))))]
3975 "fnmpy %0 = %F1, %F2"
3976 [(set_attr "itanium_class" "fmac")])
3978 (define_insn "*nmulxf3_truncsf"
3979 [(set (match_operand:SF 0 "fr_register_operand" "=f")
3982 (match_operand:XF 1 "xfreg_or_fp01_operand" "fG")
3983 (match_operand:XF 2 "xfreg_or_fp01_operand" "fG")))))]
3985 "fnmpy.s %0 = %F1, %F2"
3986 [(set_attr "itanium_class" "fmac")])
3988 (define_insn "*nmulxf3_truncdf"
3989 [(set (match_operand:DF 0 "fr_register_operand" "=f")
3992 (match_operand:XF 1 "xfreg_or_fp01_operand" "fG")
3993 (match_operand:XF 2 "xfreg_or_fp01_operand" "fG")))))]
3995 "fnmpy.d %0 = %F1, %F2"
3996 [(set_attr "itanium_class" "fmac")])
3998 (define_insn "*nmaddxf4"
3999 [(set (match_operand:XF 0 "fr_register_operand" "=f")
4000 (minus:XF (match_operand:XF 3 "xfreg_or_fp01_operand" "fG")
4001 (mult:XF (match_operand:XF 1 "xfreg_or_fp01_operand" "fG")
4002 (match_operand:XF 2 "xfreg_or_fp01_operand" "fG")
4005 "fnma %0 = %F1, %F2, %F3"
4006 [(set_attr "itanium_class" "fmac")])
4008 (define_insn "*nmaddxf4_truncsf"
4009 [(set (match_operand:SF 0 "fr_register_operand" "=f")
4011 (minus:XF (match_operand:XF 3 "xfreg_or_fp01_operand" "fG")
4012 (mult:XF (match_operand:XF 1 "xfreg_or_fp01_operand" "fG")
4013 (match_operand:XF 2 "xfreg_or_fp01_operand" "fG")
4016 "fnma.s %0 = %F1, %F2, %F3"
4017 [(set_attr "itanium_class" "fmac")])
4019 (define_insn "*nmaddxf4_truncdf"
4020 [(set (match_operand:DF 0 "fr_register_operand" "=f")
4022 (minus:XF (match_operand:XF 3 "xfreg_or_fp01_operand" "fG")
4023 (mult:XF (match_operand:XF 1 "xfreg_or_fp01_operand" "fG")
4024 (match_operand:XF 2 "xfreg_or_fp01_operand" "fG")
4027 "fnma.d %0 = %F1, %F2, %F3"
4028 [(set_attr "itanium_class" "fmac")])
4030 (define_insn "*nmaddxf4_alts"
4031 [(set (match_operand:XF 0 "fr_register_operand" "=f")
4032 (minus:XF (match_operand:XF 3 "xfreg_or_fp01_operand" "fG")
4033 (mult:XF (match_operand:XF 1 "xfreg_or_fp01_operand" "fG")
4034 (match_operand:XF 2 "xfreg_or_fp01_operand" "fG")
4036 (use (match_operand:SI 4 "const_int_operand" ""))]
4038 "fnma.s%4 %0 = %F1, %F2, %F3"
4039 [(set_attr "itanium_class" "fmac")])
4041 (define_insn "*nmaddxf4_truncsf_alts"
4042 [(set (match_operand:SF 0 "fr_register_operand" "=f")
4044 (minus:XF (match_operand:XF 3 "xfreg_or_fp01_operand" "fG")
4045 (mult:XF (match_operand:XF 1 "xfreg_or_fp01_operand" "fG")
4046 (match_operand:XF 2 "xfreg_or_fp01_operand" "fG")
4048 (use (match_operand:SI 4 "const_int_operand" ""))]
4050 "fnma.s.s%4 %0 = %F1, %F2, %F3"
4051 [(set_attr "itanium_class" "fmac")])
4053 (define_insn "*nmaddxf4_truncdf_alts"
4054 [(set (match_operand:DF 0 "fr_register_operand" "=f")
4056 (minus:XF (match_operand:XF 3 "xfreg_or_fp01_operand" "fG")
4057 (mult:XF (match_operand:XF 1 "xfreg_or_fp01_operand" "fG")
4058 (match_operand:XF 2 "xfreg_or_fp01_operand" "fG")
4060 (use (match_operand:SI 4 "const_int_operand" ""))]
4062 "fnma.d.s%4 %0 = %F1, %F2, %F3"
4063 [(set_attr "itanium_class" "fmac")])
4065 (define_expand "divxf3"
4066 [(set (match_operand:XF 0 "fr_register_operand" "")
4067 (div:XF (match_operand:XF 1 "fr_register_operand" "")
4068 (match_operand:XF 2 "fr_register_operand" "")))]
4069 "TARGET_INLINE_FLOAT_DIV"
4072 if (TARGET_INLINE_FLOAT_DIV == INL_MIN_LAT)
4073 insn = gen_divxf3_internal_lat (operands[0], operands[1], operands[2]);
4075 insn = gen_divxf3_internal_thr (operands[0], operands[1], operands[2]);
4080 (define_insn_and_split "divxf3_internal_lat"
4081 [(set (match_operand:XF 0 "fr_register_operand" "=&f")
4082 (div:XF (match_operand:XF 1 "fr_register_operand" "f")
4083 (match_operand:XF 2 "fr_register_operand" "f")))
4084 (clobber (match_scratch:XF 3 "=&f"))
4085 (clobber (match_scratch:XF 4 "=&f"))
4086 (clobber (match_scratch:XF 5 "=&f"))
4087 (clobber (match_scratch:XF 6 "=&f"))
4088 (clobber (match_scratch:BI 7 "=c"))]
4089 "TARGET_INLINE_FLOAT_DIV == INL_MIN_LAT"
4091 "&& reload_completed"
4092 [(parallel [(set (match_dup 0) (div:XF (const_int 1) (match_dup 2)))
4093 (set (match_dup 7) (unspec:BI [(match_dup 1) (match_dup 2)]
4094 UNSPEC_FR_RECIP_APPROX))
4095 (use (const_int 0))])
4096 (cond_exec (ne (match_dup 7) (const_int 0))
4097 (parallel [(set (match_dup 3)
4098 (minus:XF (match_dup 8)
4099 (mult:XF (match_dup 2) (match_dup 0))))
4100 (use (const_int 1))]))
4101 (cond_exec (ne (match_dup 7) (const_int 0))
4102 (parallel [(set (match_dup 4) (mult:XF (match_dup 1) (match_dup 0)))
4103 (use (const_int 1))]))
4104 (cond_exec (ne (match_dup 7) (const_int 0))
4105 (parallel [(set (match_dup 5) (mult:XF (match_dup 3) (match_dup 3)))
4106 (use (const_int 1))]))
4107 (cond_exec (ne (match_dup 7) (const_int 0))
4108 (parallel [(set (match_dup 6)
4109 (plus:XF (mult:XF (match_dup 3) (match_dup 3))
4111 (use (const_int 1))]))
4112 (cond_exec (ne (match_dup 7) (const_int 0))
4113 (parallel [(set (match_dup 3)
4114 (plus:XF (mult:XF (match_dup 5) (match_dup 5))
4116 (use (const_int 1))]))
4117 (cond_exec (ne (match_dup 7) (const_int 0))
4118 (parallel [(set (match_dup 5)
4119 (plus:XF (mult:XF (match_dup 6) (match_dup 0))
4121 (use (const_int 1))]))
4122 (cond_exec (ne (match_dup 7) (const_int 0))
4123 (parallel [(set (match_dup 0)
4124 (plus:XF (mult:XF (match_dup 5) (match_dup 3))
4126 (use (const_int 1))]))
4127 (cond_exec (ne (match_dup 7) (const_int 0))
4128 (parallel [(set (match_dup 4)
4129 (minus:XF (match_dup 1)
4130 (mult:XF (match_dup 2) (match_dup 4))))
4131 (use (const_int 1))]))
4132 (cond_exec (ne (match_dup 7) (const_int 0))
4133 (parallel [(set (match_dup 3)
4134 (plus:XF (mult:XF (match_dup 3) (match_dup 0))
4136 (use (const_int 1))]))
4137 (cond_exec (ne (match_dup 7) (const_int 0))
4138 (parallel [(set (match_dup 5)
4139 (minus:XF (match_dup 8)
4140 (mult:XF (match_dup 2) (match_dup 0))))
4141 (use (const_int 1))]))
4142 (cond_exec (ne (match_dup 7) (const_int 0))
4143 (parallel [(set (match_dup 0)
4144 (plus:XF (mult:XF (match_dup 4) (match_dup 0))
4146 (use (const_int 1))]))
4147 (cond_exec (ne (match_dup 7) (const_int 0))
4148 (parallel [(set (match_dup 4)
4149 (minus:XF (match_dup 1)
4150 (mult:XF (match_dup 2) (match_dup 3))))
4151 (use (const_int 1))]))
4152 (cond_exec (ne (match_dup 7) (const_int 0))
4154 (plus:XF (mult:XF (match_dup 4) (match_dup 0))
4157 "operands[8] = CONST1_RTX (XFmode);"
4158 [(set_attr "predicable" "no")])
4160 (define_insn_and_split "divxf3_internal_thr"
4161 [(set (match_operand:XF 0 "fr_register_operand" "=&f")
4162 (div:XF (match_operand:XF 1 "fr_register_operand" "f")
4163 (match_operand:XF 2 "fr_register_operand" "f")))
4164 (clobber (match_scratch:XF 3 "=&f"))
4165 (clobber (match_scratch:XF 4 "=&f"))
4166 (clobber (match_scratch:BI 5 "=c"))]
4167 "TARGET_INLINE_FLOAT_DIV == INL_MAX_THR"
4169 "&& reload_completed"
4170 [(parallel [(set (match_dup 0) (div:XF (const_int 1) (match_dup 2)))
4171 (set (match_dup 5) (unspec:BI [(match_dup 1) (match_dup 2)]
4172 UNSPEC_FR_RECIP_APPROX))
4173 (use (const_int 0))])
4174 (cond_exec (ne (match_dup 5) (const_int 0))
4175 (parallel [(set (match_dup 3)
4176 (minus:XF (match_dup 6)
4177 (mult:XF (match_dup 2) (match_dup 0))))
4178 (use (const_int 1))]))
4179 (cond_exec (ne (match_dup 5) (const_int 0))
4180 (parallel [(set (match_dup 4)
4181 (plus:XF (mult:XF (match_dup 3) (match_dup 0))
4183 (use (const_int 1))]))
4184 (cond_exec (ne (match_dup 5) (const_int 0))
4185 (parallel [(set (match_dup 3) (mult:XF (match_dup 3) (match_dup 3)))
4186 (use (const_int 1))]))
4187 (cond_exec (ne (match_dup 5) (const_int 0))
4188 (parallel [(set (match_dup 3)
4189 (plus:XF (mult:XF (match_dup 3) (match_dup 4))
4191 (use (const_int 1))]))
4192 (cond_exec (ne (match_dup 5) (const_int 0))
4193 (parallel [(set (match_dup 4) (mult:XF (match_dup 1) (match_dup 0)))
4194 (use (const_int 1))]))
4195 (cond_exec (ne (match_dup 5) (const_int 0))
4196 (parallel [(set (match_dup 0)
4197 (minus:XF (match_dup 6)
4198 (mult:XF (match_dup 2) (match_dup 3))))
4199 (use (const_int 1))]))
4200 (cond_exec (ne (match_dup 5) (const_int 0))
4201 (parallel [(set (match_dup 0)
4202 (plus:XF (mult:XF (match_dup 0) (match_dup 3))
4204 (use (const_int 1))]))
4205 (cond_exec (ne (match_dup 5) (const_int 0))
4206 (parallel [(set (match_dup 3)
4207 (minus:XF (match_dup 1)
4208 (mult:XF (match_dup 2) (match_dup 4))))
4209 (use (const_int 1))]))
4210 (cond_exec (ne (match_dup 5) (const_int 0))
4211 (parallel [(set (match_dup 3)
4212 (plus:XF (mult:XF (match_dup 3) (match_dup 0))
4214 (use (const_int 1))]))
4215 (cond_exec (ne (match_dup 5) (const_int 0))
4216 (parallel [(set (match_dup 4)
4217 (minus:XF (match_dup 6)
4218 (mult:XF (match_dup 2) (match_dup 0))))
4219 (use (const_int 1))]))
4220 (cond_exec (ne (match_dup 5) (const_int 0))
4221 (parallel [(set (match_dup 0)
4222 (plus:XF (mult:XF (match_dup 4) (match_dup 0))
4224 (use (const_int 1))]))
4225 (cond_exec (ne (match_dup 5) (const_int 0))
4226 (parallel [(set (match_dup 4)
4227 (minus:XF (match_dup 1)
4228 (mult:XF (match_dup 2) (match_dup 3))))
4229 (use (const_int 1))]))
4230 (cond_exec (ne (match_dup 5) (const_int 0))
4232 (plus:XF (mult:XF (match_dup 4) (match_dup 0))
4235 "operands[6] = CONST1_RTX (XFmode);"
4236 [(set_attr "predicable" "no")])
4238 ;; Inline square root.
4240 (define_expand "sqrtxf2"
4241 [(set (match_operand:XF 0 "fr_register_operand" "=&f")
4242 (sqrt:XF (match_operand:XF 1 "fr_register_operand" "f")))]
4243 "TARGET_INLINE_SQRT"
4247 if (TARGET_INLINE_SQRT == INL_MIN_LAT)
4248 insn = gen_sqrtxf2_internal_lat (operands[0], operands[1]);
4251 gcc_assert (TARGET_INLINE_SQRT != INL_MIN_LAT);
4253 insn = gen_sqrtxf2_internal_thr (operands[0], operands[1]);
4258 ;; Latency-optimized square root.
4259 ;; FIXME: Implement.
4261 ;; Throughput-optimized square root.
4263 (define_insn_and_split "sqrtxf2_internal_thr"
4264 [(set (match_operand:XF 0 "fr_register_operand" "=&f")
4265 (sqrt:XF (match_operand:XF 1 "fr_register_operand" "f")))
4266 ;; Register r2 in optimization guide.
4267 (clobber (match_scratch:DI 2 "=r"))
4268 ;; Register f8 in optimization guide
4269 (clobber (match_scratch:XF 3 "=&f"))
4270 ;; Register f9 in optimization guide
4271 (clobber (match_scratch:XF 4 "=&f"))
4272 ;; Register f10 in optimization guide
4273 (clobber (match_scratch:XF 5 "=&f"))
4274 ;; Register f11 in optimization guide
4275 (clobber (match_scratch:XF 6 "=&f"))
4276 ;; Register p6 in optimization guide.
4277 (clobber (match_scratch:BI 7 "=c"))]
4278 "TARGET_INLINE_SQRT == INL_MAX_THR"
4280 "&& reload_completed"
4281 [ ;; exponent of +1/2 in r2
4282 (set (match_dup 2) (const_int 65534))
4283 ;; +1/2 in f8. The Intel manual mistakenly specifies f10.
4285 (unspec:XF [(match_dup 2)] UNSPEC_SETF_EXP))
4287 ;; y0 = 1/sqrt(a) in f7
4288 (parallel [(set (match_dup 8)
4289 (div:XF (const_int 1)
4290 (sqrt:XF (match_dup 9))))
4292 (unspec:BI [(match_dup 9)]
4293 UNSPEC_FR_SQRT_RECIP_APPROX))
4294 (use (const_int 0))])
4296 ;; H0 = 1/2 * y0 in f9
4297 (cond_exec (ne (match_dup 7) (const_int 0))
4298 (parallel [(set (match_dup 4)
4299 (plus:XF (mult:XF (match_dup 3) (match_dup 8))
4301 (use (const_int 1))]))
4303 ;; S0 = a * y0 in f7
4304 (cond_exec (ne (match_dup 7) (const_int 0))
4305 (parallel [(set (match_dup 8)
4306 (plus:XF (mult:XF (match_dup 9) (match_dup 8))
4308 (use (const_int 1))]))
4310 ;; d0 = 1/2 - S0 * H0 in f10
4311 (cond_exec (ne (match_dup 7) (const_int 0))
4312 (parallel [(set (match_dup 5)
4313 (minus:XF (match_dup 3)
4314 (mult:XF (match_dup 8) (match_dup 4))))
4315 (use (const_int 1))]))
4317 ;; H1 = H0 + d0 * H0 in f9
4318 (cond_exec (ne (match_dup 7) (const_int 0))
4319 (parallel [(set (match_dup 4)
4320 (plus:XF (mult:XF (match_dup 5) (match_dup 4))
4322 (use (const_int 1))]))
4324 ;; S1 = S0 + d0 * S0 in f7
4325 (cond_exec (ne (match_dup 7) (const_int 0))
4326 (parallel [(set (match_dup 8)
4327 (plus:XF (mult:XF (match_dup 5) (match_dup 8))
4329 (use (const_int 1))]))
4331 ;; d1 = 1/2 - S1 * H1 in f10
4332 (cond_exec (ne (match_dup 7) (const_int 0))
4333 (parallel [(set (match_dup 5)
4334 (minus:XF (match_dup 3)
4335 (mult:XF (match_dup 8) (match_dup 4))))
4336 (use (const_int 1))]))
4338 ;; H2 = H1 + d1 * H1 in f9
4339 (cond_exec (ne (match_dup 7) (const_int 0))
4340 (parallel [(set (match_dup 4)
4341 (plus:XF (mult:XF (match_dup 5) (match_dup 4))
4343 (use (const_int 1))]))
4345 ;; S2 = S1 + d1 * S1 in f7
4346 (cond_exec (ne (match_dup 7) (const_int 0))
4347 (parallel [(set (match_dup 8)
4348 (plus:XF (mult:XF (match_dup 5) (match_dup 8))
4350 (use (const_int 1))]))
4352 ;; d2 = 1/2 - S2 * H2 in f10
4353 (cond_exec (ne (match_dup 7) (const_int 0))
4354 (parallel [(set (match_dup 5)
4355 (minus:XF (match_dup 3)
4356 (mult:XF (match_dup 8) (match_dup 4))))
4357 (use (const_int 1))]))
4359 ;; e2 = a - S2 * S2 in f8
4360 (cond_exec (ne (match_dup 7) (const_int 0))
4361 (parallel [(set (match_dup 3)
4362 (minus:XF (match_dup 9)
4363 (mult:XF (match_dup 8) (match_dup 8))))
4364 (use (const_int 1))]))
4366 ;; S3 = S2 + e2 * H2 in f7
4367 (cond_exec (ne (match_dup 7) (const_int 0))
4368 (parallel [(set (match_dup 8)
4369 (plus:XF (mult:XF (match_dup 3) (match_dup 4))
4371 (use (const_int 1))]))
4373 ;; H3 = H2 + d2 * H2 in f9
4374 (cond_exec (ne (match_dup 7) (const_int 0))
4375 (parallel [(set (match_dup 4)
4376 (plus:XF (mult:XF (match_dup 5) (match_dup 4))
4378 (use (const_int 1))]))
4380 ;; e3 = a - S3 * S3 in f8
4381 (cond_exec (ne (match_dup 7) (const_int 0))
4382 (parallel [(set (match_dup 3)
4383 (minus:XF (match_dup 9)
4384 (mult:XF (match_dup 8) (match_dup 8))))
4385 (use (const_int 1))]))
4387 ;; S = S3 + e3 * H3 in f7
4388 (cond_exec (ne (match_dup 7) (const_int 0))
4389 (parallel [(set (match_dup 0)
4390 (plus:XF (mult:XF (match_dup 3) (match_dup 4))
4392 (use (const_int 0))]))]
4394 /* Generate 82-bit versions of the input and output operands. */
4395 operands[8] = gen_rtx_REG (XFmode, REGNO (operands[0]));
4396 operands[9] = gen_rtx_REG (XFmode, REGNO (operands[1]));
4397 /* Generate required floating-point constants. */
4398 operands[10] = CONST0_RTX (XFmode);
4400 [(set_attr "predicable" "no")])
4402 ;; ??? frcpa works like cmp.foo.unc.
4404 (define_insn "*recip_approx"
4405 [(set (match_operand:XF 0 "fr_register_operand" "=f")
4406 (div:XF (const_int 1)
4407 (match_operand:XF 3 "fr_register_operand" "f")))
4408 (set (match_operand:BI 1 "register_operand" "=c")
4409 (unspec:BI [(match_operand:XF 2 "fr_register_operand" "f")
4410 (match_dup 3)] UNSPEC_FR_RECIP_APPROX))
4411 (use (match_operand:SI 4 "const_int_operand" ""))]
4413 "frcpa.s%4 %0, %1 = %2, %3"
4414 [(set_attr "itanium_class" "fmisc")
4415 (set_attr "predicable" "no")])
4417 ;; ::::::::::::::::::::
4419 ;; :: 32-bit Integer Shifts and Rotates
4421 ;; ::::::::::::::::::::
4423 (define_expand "ashlsi3"
4424 [(set (match_operand:SI 0 "gr_register_operand" "")
4425 (ashift:SI (match_operand:SI 1 "gr_register_operand" "")
4426 (match_operand:SI 2 "gr_reg_or_5bit_operand" "")))]
4429 if (GET_CODE (operands[2]) != CONST_INT)
4431 /* Why oh why didn't Intel arrange for SHIFT_COUNT_TRUNCATED? Now
4432 we've got to get rid of stray bits outside the SImode register. */
4433 rtx subshift = gen_reg_rtx (DImode);
4434 emit_insn (gen_zero_extendsidi2 (subshift, operands[2]));
4435 operands[2] = subshift;
4439 (define_insn "*ashlsi3_internal"
4440 [(set (match_operand:SI 0 "gr_register_operand" "=r,r,r")
4441 (ashift:SI (match_operand:SI 1 "gr_register_operand" "r,r,r")
4442 (match_operand:DI 2 "gr_reg_or_5bit_operand" "R,n,r")))]
4445 shladd %0 = %1, %2, r0
4446 dep.z %0 = %1, %2, %E2
4448 [(set_attr "itanium_class" "ialu,ishf,mmshf")])
4450 (define_expand "ashrsi3"
4451 [(set (match_operand:SI 0 "gr_register_operand" "")
4452 (ashiftrt:SI (match_operand:SI 1 "gr_register_operand" "")
4453 (match_operand:SI 2 "gr_reg_or_5bit_operand" "")))]
4456 rtx subtarget = gen_reg_rtx (DImode);
4457 if (GET_CODE (operands[2]) == CONST_INT)
4458 emit_insn (gen_extv (subtarget, gen_lowpart (DImode, operands[1]),
4459 GEN_INT (32 - INTVAL (operands[2])), operands[2]));
4462 rtx subshift = gen_reg_rtx (DImode);
4463 emit_insn (gen_extendsidi2 (subtarget, operands[1]));
4464 emit_insn (gen_zero_extendsidi2 (subshift, operands[2]));
4465 emit_insn (gen_ashrdi3 (subtarget, subtarget, subshift));
4467 emit_move_insn (gen_lowpart (DImode, operands[0]), subtarget);
4471 (define_expand "lshrsi3"
4472 [(set (match_operand:SI 0 "gr_register_operand" "")
4473 (lshiftrt:SI (match_operand:SI 1 "gr_register_operand" "")
4474 (match_operand:SI 2 "gr_reg_or_5bit_operand" "")))]
4477 rtx subtarget = gen_reg_rtx (DImode);
4478 if (GET_CODE (operands[2]) == CONST_INT)
4479 emit_insn (gen_extzv (subtarget, gen_lowpart (DImode, operands[1]),
4480 GEN_INT (32 - INTVAL (operands[2])), operands[2]));
4483 rtx subshift = gen_reg_rtx (DImode);
4484 emit_insn (gen_zero_extendsidi2 (subtarget, operands[1]));
4485 emit_insn (gen_zero_extendsidi2 (subshift, operands[2]));
4486 emit_insn (gen_lshrdi3 (subtarget, subtarget, subshift));
4488 emit_move_insn (gen_lowpart (DImode, operands[0]), subtarget);
4492 ;; Use mix4.r/shr to implement rotrsi3. We only get 32 bits of valid result
4493 ;; here, instead of 64 like the patterns above. Keep the pattern together
4494 ;; until after combine; otherwise it won't get matched often.
4496 (define_expand "rotrsi3"
4497 [(set (match_operand:SI 0 "gr_register_operand" "")
4498 (rotatert:SI (match_operand:SI 1 "gr_register_operand" "")
4499 (match_operand:SI 2 "gr_reg_or_5bit_operand" "")))]
4502 if (GET_MODE (operands[2]) != VOIDmode)
4504 rtx tmp = gen_reg_rtx (DImode);
4505 emit_insn (gen_zero_extendsidi2 (tmp, operands[2]));
4510 (define_insn_and_split "*rotrsi3_internal"
4511 [(set (match_operand:SI 0 "gr_register_operand" "=&r")
4512 (rotatert:SI (match_operand:SI 1 "gr_register_operand" "r")
4513 (match_operand:DI 2 "gr_reg_or_5bit_operand" "rM")))]
4518 (ior:DI (zero_extend:DI (match_dup 1))
4519 (ashift:DI (zero_extend:DI (match_dup 1)) (const_int 32))))
4521 (lshiftrt:DI (match_dup 3) (match_dup 2)))]
4522 "operands[3] = gen_rtx_REG (DImode, REGNO (operands[0]));")
4524 (define_expand "rotlsi3"
4525 [(set (match_operand:SI 0 "gr_register_operand" "")
4526 (rotate:SI (match_operand:SI 1 "gr_register_operand" "")
4527 (match_operand:SI 2 "gr_reg_or_5bit_operand" "")))]
4530 if (! shift_32bit_count_operand (operands[2], SImode))
4532 rtx tmp = gen_reg_rtx (SImode);
4533 emit_insn (gen_subsi3 (tmp, GEN_INT (32), operands[2]));
4534 emit_insn (gen_rotrsi3 (operands[0], operands[1], tmp));
4539 (define_insn_and_split "*rotlsi3_internal"
4540 [(set (match_operand:SI 0 "gr_register_operand" "=r")
4541 (rotate:SI (match_operand:SI 1 "gr_register_operand" "r")
4542 (match_operand:SI 2 "shift_32bit_count_operand" "n")))]
4544 "mux2 %0 = %1, 0xe1"
4545 "reload_completed && INTVAL (operands[2]) != 16"
4547 (ior:DI (zero_extend:DI (match_dup 1))
4548 (ashift:DI (zero_extend:DI (match_dup 1)) (const_int 32))))
4550 (lshiftrt:DI (match_dup 3) (match_dup 2)))]
4552 operands[3] = gen_rtx_REG (DImode, REGNO (operands[0]));
4553 operands[2] = GEN_INT (32 - INTVAL (operands[2]));
4555 [(set_attr "itanium_class" "mmshf")])
4557 ;; ::::::::::::::::::::
4559 ;; :: 64-bit Integer Shifts and Rotates
4561 ;; ::::::::::::::::::::
4563 (define_insn "ashldi3"
4564 [(set (match_operand:DI 0 "gr_register_operand" "=r,r,r")
4565 (ashift:DI (match_operand:DI 1 "gr_register_operand" "r,r,r")
4566 (match_operand:DI 2 "gr_reg_or_6bit_operand" "R,r,rM")))]
4569 shladd %0 = %1, %2, r0
4572 [(set_attr "itanium_class" "ialu,mmshf,mmshfi")])
4574 ;; ??? Maybe combine this with the multiply and add instruction?
4576 (define_insn "*shladd"
4577 [(set (match_operand:DI 0 "gr_register_operand" "=r")
4578 (plus:DI (mult:DI (match_operand:DI 1 "gr_register_operand" "r")
4579 (match_operand:DI 2 "shladd_operand" "n"))
4580 (match_operand:DI 3 "gr_register_operand" "r")))]
4582 "shladd %0 = %1, %S2, %3"
4583 [(set_attr "itanium_class" "ialu")])
4585 ;; This can be created by register elimination if operand3 of shladd is an
4586 ;; eliminable register or has reg_equiv_constant set.
4588 ;; We have to use nonmemory_operand for operand 4, to ensure that the
4589 ;; validate_changes call inside eliminate_regs will always succeed. If it
4590 ;; doesn't succeed, then this remain a shladd pattern, and will be reloaded
4593 (define_insn_and_split "*shladd_elim"
4594 [(set (match_operand:DI 0 "gr_register_operand" "=&r")
4595 (plus:DI (plus:DI (mult:DI (match_operand:DI 1 "gr_register_operand" "r")
4596 (match_operand:DI 2 "shladd_operand" "n"))
4597 (match_operand:DI 3 "nonmemory_operand" "r"))
4598 (match_operand:DI 4 "nonmemory_operand" "rI")))]
4599 "reload_in_progress"
4600 "* gcc_unreachable ();"
4602 [(set (match_dup 0) (plus:DI (mult:DI (match_dup 1) (match_dup 2))
4604 (set (match_dup 0) (plus:DI (match_dup 0) (match_dup 4)))]
4606 [(set_attr "itanium_class" "unknown")])
4608 (define_insn "ashrdi3"
4609 [(set (match_operand:DI 0 "gr_register_operand" "=r,r")
4610 (ashiftrt:DI (match_operand:DI 1 "gr_register_operand" "r,r")
4611 (match_operand:DI 2 "gr_reg_or_6bit_operand" "r,rM")))]
4616 [(set_attr "itanium_class" "mmshf,mmshfi")])
4618 (define_insn "lshrdi3"
4619 [(set (match_operand:DI 0 "gr_register_operand" "=r,r")
4620 (lshiftrt:DI (match_operand:DI 1 "gr_register_operand" "r,r")
4621 (match_operand:DI 2 "gr_reg_or_6bit_operand" "r,rM")))]
4626 [(set_attr "itanium_class" "mmshf,mmshfi")])
4628 ;; Using a predicate that accepts only constants doesn't work, because optabs
4629 ;; will load the operand into a register and call the pattern if the predicate
4630 ;; did not accept it on the first try. So we use nonmemory_operand and then
4631 ;; verify that we have an appropriate constant in the expander.
4633 (define_expand "rotrdi3"
4634 [(set (match_operand:DI 0 "gr_register_operand" "")
4635 (rotatert:DI (match_operand:DI 1 "gr_register_operand" "")
4636 (match_operand:DI 2 "nonmemory_operand" "")))]
4639 if (! shift_count_operand (operands[2], DImode))
4643 (define_insn "*rotrdi3_internal"
4644 [(set (match_operand:DI 0 "gr_register_operand" "=r")
4645 (rotatert:DI (match_operand:DI 1 "gr_register_operand" "r")
4646 (match_operand:DI 2 "shift_count_operand" "M")))]
4648 "shrp %0 = %1, %1, %2"
4649 [(set_attr "itanium_class" "ishf")])
4651 (define_expand "rotldi3"
4652 [(set (match_operand:DI 0 "gr_register_operand" "")
4653 (rotate:DI (match_operand:DI 1 "gr_register_operand" "")
4654 (match_operand:DI 2 "nonmemory_operand" "")))]
4657 if (! shift_count_operand (operands[2], DImode))
4661 (define_insn "*rotldi3_internal"
4662 [(set (match_operand:DI 0 "gr_register_operand" "=r")
4663 (rotate:DI (match_operand:DI 1 "gr_register_operand" "r")
4664 (match_operand:DI 2 "shift_count_operand" "M")))]
4666 "shrp %0 = %1, %1, %e2"
4667 [(set_attr "itanium_class" "ishf")])
4669 ;; ::::::::::::::::::::
4671 ;; :: 128-bit Integer Shifts and Rotates
4673 ;; ::::::::::::::::::::
4675 (define_expand "ashlti3"
4676 [(set (match_operand:TI 0 "gr_register_operand" "")
4677 (ashift:TI (match_operand:TI 1 "gr_register_operand" "")
4678 (match_operand:DI 2 "nonmemory_operand" "")))]
4681 if (!dshift_count_operand (operands[2], DImode))
4685 (define_insn_and_split "*ashlti3_internal"
4686 [(set (match_operand:TI 0 "gr_register_operand" "=&r")
4687 (ashift:TI (match_operand:TI 1 "gr_register_operand" "r")
4688 (match_operand:DI 2 "dshift_count_operand" "n")))]
4694 HOST_WIDE_INT shift = INTVAL (operands[2]);
4695 rtx rl = gen_lowpart (DImode, operands[0]);
4696 rtx rh = gen_highpart (DImode, operands[0]);
4697 rtx lo = gen_lowpart (DImode, operands[1]);
4698 rtx shiftlo = GEN_INT (shift & 63);
4702 emit_move_insn (rl, const0_rtx);
4704 emit_insn (gen_ashldi3 (rh, lo, shiftlo));
4706 emit_move_insn (rh, lo);
4710 rtx hi = gen_highpart (DImode, operands[1]);
4712 emit_insn (gen_shrp (rh, hi, lo, GEN_INT (-shift & 63)));
4713 emit_insn (gen_ashldi3 (rl, lo, shiftlo));
4718 (define_expand "ashrti3"
4719 [(set (match_operand:TI 0 "gr_register_operand" "")
4720 (ashiftrt:TI (match_operand:TI 1 "gr_register_operand" "")
4721 (match_operand:DI 2 "nonmemory_operand" "")))]
4724 if (!dshift_count_operand (operands[2], DImode))
4728 (define_insn_and_split "*ashrti3_internal"
4729 [(set (match_operand:TI 0 "gr_register_operand" "=&r")
4730 (ashiftrt:TI (match_operand:TI 1 "gr_register_operand" "r")
4731 (match_operand:DI 2 "dshift_count_operand" "n")))]
4737 HOST_WIDE_INT shift = INTVAL (operands[2]);
4738 rtx rl = gen_lowpart (DImode, operands[0]);
4739 rtx rh = gen_highpart (DImode, operands[0]);
4740 rtx hi = gen_highpart (DImode, operands[1]);
4741 rtx shiftlo = GEN_INT (shift & 63);
4746 emit_insn (gen_ashrdi3 (rl, hi, shiftlo));
4748 emit_move_insn (rl, hi);
4749 emit_insn (gen_ashrdi3 (rh, hi, GEN_INT (63)));
4753 rtx lo = gen_lowpart (DImode, operands[1]);
4755 emit_insn (gen_shrp (rl, hi, lo, shiftlo));
4756 emit_insn (gen_ashrdi3 (rh, hi, shiftlo));
4761 (define_expand "lshrti3"
4762 [(set (match_operand:TI 0 "gr_register_operand" "")
4763 (lshiftrt:TI (match_operand:TI 1 "gr_register_operand" "")
4764 (match_operand:DI 2 "nonmemory_operand" "")))]
4767 if (!dshift_count_operand (operands[2], DImode))
4771 (define_insn_and_split "*lshrti3_internal"
4772 [(set (match_operand:TI 0 "gr_register_operand" "=&r")
4773 (lshiftrt:TI (match_operand:TI 1 "gr_register_operand" "r")
4774 (match_operand:DI 2 "dshift_count_operand" "n")))]
4780 HOST_WIDE_INT shift = INTVAL (operands[2]);
4781 rtx rl = gen_lowpart (DImode, operands[0]);
4782 rtx rh = gen_highpart (DImode, operands[0]);
4783 rtx hi = gen_highpart (DImode, operands[1]);
4784 rtx shiftlo = GEN_INT (shift & 63);
4789 emit_insn (gen_lshrdi3 (rl, hi, shiftlo));
4791 emit_move_insn (rl, hi);
4792 emit_move_insn (rh, const0_rtx);
4796 rtx lo = gen_lowpart (DImode, operands[1]);
4798 emit_insn (gen_shrp (rl, hi, lo, shiftlo));
4799 emit_insn (gen_lshrdi3 (rh, hi, shiftlo));
4804 (define_expand "rotlti3"
4805 [(set (match_operand:TI 0 "gr_register_operand" "")
4806 (rotate:TI (match_operand:TI 1 "gr_register_operand" "")
4807 (match_operand:DI 2 "nonmemory_operand" "")))]
4810 if (! dshift_count_operand (operands[2], DImode))
4814 (define_insn_and_split "*rotlti3_internal"
4815 [(set (match_operand:TI 0 "gr_register_operand" "=&r")
4816 (rotate:TI (match_operand:TI 1 "gr_register_operand" "r")
4817 (match_operand:DI 2 "dshift_count_operand" "n")))]
4823 HOST_WIDE_INT count = INTVAL (operands[2]);
4824 rtx rl = gen_lowpart (DImode, operands[0]);
4825 rtx rh = gen_highpart (DImode, operands[0]);
4826 rtx lo = gen_lowpart (DImode, operands[1]);
4827 rtx hi = gen_highpart (DImode, operands[1]);
4828 rtx countlo = GEN_INT (-count & 63);
4834 emit_insn (gen_shrp (rl, hi, lo, countlo));
4835 emit_insn (gen_shrp (rh, lo, hi, countlo));
4839 emit_move_insn (rl, hi);
4840 emit_move_insn (rh, lo);
4845 emit_insn (gen_shrp (rl, lo, hi, countlo));
4846 emit_insn (gen_shrp (rh, hi, lo, countlo));
4850 [(set_attr "itanium_class" "unknown")])
4853 [(set (match_operand:DI 0 "gr_register_operand" "=r")
4854 (unspec:DI [(match_operand:DI 1 "gr_register_operand" "r")
4855 (match_operand:DI 2 "gr_register_operand" "r")
4856 (match_operand:DI 3 "shift_count_operand" "M")]
4859 "shrp %0 = %1, %2, %3"
4860 [(set_attr "itanium_class" "ishf")])
4862 ;; ::::::::::::::::::::
4864 ;; :: 32-bit Integer Logical operations
4866 ;; ::::::::::::::::::::
4868 ;; We don't seem to need any other 32-bit logical operations, because gcc
4869 ;; generates zero-extend;zero-extend;DImode-op, which combine optimizes to
4870 ;; DImode-op;zero-extend, and then we can optimize away the zero-extend.
4871 ;; This doesn't work for unary logical operations, because we don't call
4872 ;; apply_distributive_law for them.
4874 ;; ??? Likewise, this doesn't work for andnot, which isn't handled by
4875 ;; apply_distributive_law. We get inefficient code for
4876 ;; int sub4 (int i, int j) { return i & ~j; }
4877 ;; We could convert (and (not (sign_extend A)) (sign_extend B)) to
4878 ;; (zero_extend (and (not A) B)) in combine.
4879 ;; Or maybe fix this by adding andsi3/iorsi3/xorsi3 patterns like the
4880 ;; one_cmplsi2 pattern.
4882 (define_insn "one_cmplsi2"
4883 [(set (match_operand:SI 0 "gr_register_operand" "=r")
4884 (not:SI (match_operand:SI 1 "gr_register_operand" "r")))]
4887 [(set_attr "itanium_class" "ilog")])
4889 ;; ::::::::::::::::::::
4891 ;; :: 64-bit Integer Logical operations
4893 ;; ::::::::::::::::::::
4895 (define_insn "anddi3"
4896 [(set (match_operand:DI 0 "grfr_register_operand" "=r,*f")
4897 (and:DI (match_operand:DI 1 "grfr_register_operand" "%r,*f")
4898 (match_operand:DI 2 "grfr_reg_or_8bit_operand" "rK,*f")))]
4903 [(set_attr "itanium_class" "ilog,fmisc")])
4905 (define_insn "*andnot"
4906 [(set (match_operand:DI 0 "grfr_register_operand" "=r,*f")
4907 (and:DI (not:DI (match_operand:DI 1 "grfr_register_operand" "r,*f"))
4908 (match_operand:DI 2 "grfr_reg_or_8bit_operand" "rK,*f")))]
4913 [(set_attr "itanium_class" "ilog,fmisc")])
4915 (define_insn "iordi3"
4916 [(set (match_operand:DI 0 "grfr_register_operand" "=r,*f")
4917 (ior:DI (match_operand:DI 1 "grfr_register_operand" "%r,*f")
4918 (match_operand:DI 2 "grfr_reg_or_8bit_operand" "rK,*f")))]
4923 [(set_attr "itanium_class" "ilog,fmisc")])
4925 (define_insn "xordi3"
4926 [(set (match_operand:DI 0 "grfr_register_operand" "=r,*f")
4927 (xor:DI (match_operand:DI 1 "grfr_register_operand" "%r,*f")
4928 (match_operand:DI 2 "grfr_reg_or_8bit_operand" "rK,*f")))]
4933 [(set_attr "itanium_class" "ilog,fmisc")])
4935 (define_insn "one_cmpldi2"
4936 [(set (match_operand:DI 0 "gr_register_operand" "=r")
4937 (not:DI (match_operand:DI 1 "gr_register_operand" "r")))]
4940 [(set_attr "itanium_class" "ilog")])
4942 ;; ::::::::::::::::::::
4946 ;; ::::::::::::::::::::
4948 (define_expand "cmpbi"
4950 (compare (match_operand:BI 0 "register_operand" "")
4951 (match_operand:BI 1 "const_int_operand" "")))]
4954 ia64_compare_op0 = operands[0];
4955 ia64_compare_op1 = operands[1];
4959 (define_expand "cmpsi"
4961 (compare (match_operand:SI 0 "gr_register_operand" "")
4962 (match_operand:SI 1 "gr_reg_or_8bit_and_adjusted_operand" "")))]
4965 ia64_compare_op0 = operands[0];
4966 ia64_compare_op1 = operands[1];
4970 (define_expand "cmpdi"
4972 (compare (match_operand:DI 0 "gr_register_operand" "")
4973 (match_operand:DI 1 "gr_reg_or_8bit_and_adjusted_operand" "")))]
4976 ia64_compare_op0 = operands[0];
4977 ia64_compare_op1 = operands[1];
4981 (define_expand "cmpsf"
4983 (compare (match_operand:SF 0 "fr_reg_or_fp01_operand" "")
4984 (match_operand:SF 1 "fr_reg_or_fp01_operand" "")))]
4987 ia64_compare_op0 = operands[0];
4988 ia64_compare_op1 = operands[1];
4992 (define_expand "cmpdf"
4994 (compare (match_operand:DF 0 "fr_reg_or_fp01_operand" "")
4995 (match_operand:DF 1 "fr_reg_or_fp01_operand" "")))]
4998 ia64_compare_op0 = operands[0];
4999 ia64_compare_op1 = operands[1];
5003 (define_expand "cmpxf"
5005 (compare (match_operand:XF 0 "xfreg_or_fp01_operand" "")
5006 (match_operand:XF 1 "xfreg_or_fp01_operand" "")))]
5009 ia64_compare_op0 = operands[0];
5010 ia64_compare_op1 = operands[1];
5014 (define_expand "cmptf"
5016 (compare (match_operand:TF 0 "gr_register_operand" "")
5017 (match_operand:TF 1 "gr_register_operand" "")))]
5020 ia64_compare_op0 = operands[0];
5021 ia64_compare_op1 = operands[1];
5025 (define_insn "*cmpsi_normal"
5026 [(set (match_operand:BI 0 "register_operand" "=c")
5027 (match_operator:BI 1 "normal_comparison_operator"
5028 [(match_operand:SI 2 "gr_register_operand" "r")
5029 (match_operand:SI 3 "gr_reg_or_8bit_operand" "rK")]))]
5031 "cmp4.%C1 %0, %I0 = %3, %2"
5032 [(set_attr "itanium_class" "icmp")])
5034 ;; We use %r3 because it is possible for us to match a 0, and two of the
5035 ;; unsigned comparisons don't accept immediate operands of zero.
5037 (define_insn "*cmpsi_adjusted"
5038 [(set (match_operand:BI 0 "register_operand" "=c")
5039 (match_operator:BI 1 "adjusted_comparison_operator"
5040 [(match_operand:SI 2 "gr_register_operand" "r")
5041 (match_operand:SI 3 "gr_reg_or_8bit_adjusted_operand" "rL")]))]
5043 "cmp4.%C1 %0, %I0 = %r3, %2"
5044 [(set_attr "itanium_class" "icmp")])
5046 (define_insn "*cmpdi_normal"
5047 [(set (match_operand:BI 0 "register_operand" "=c")
5048 (match_operator:BI 1 "normal_comparison_operator"
5049 [(match_operand:DI 2 "gr_reg_or_0_operand" "rO")
5050 (match_operand:DI 3 "gr_reg_or_8bit_operand" "rK")]))]
5052 "cmp.%C1 %0, %I0 = %3, %r2"
5053 [(set_attr "itanium_class" "icmp")])
5055 ;; We use %r3 because it is possible for us to match a 0, and two of the
5056 ;; unsigned comparisons don't accept immediate operands of zero.
5058 (define_insn "*cmpdi_adjusted"
5059 [(set (match_operand:BI 0 "register_operand" "=c")
5060 (match_operator:BI 1 "adjusted_comparison_operator"
5061 [(match_operand:DI 2 "gr_register_operand" "r")
5062 (match_operand:DI 3 "gr_reg_or_8bit_adjusted_operand" "rL")]))]
5064 "cmp.%C1 %0, %I0 = %r3, %2"
5065 [(set_attr "itanium_class" "icmp")])
5067 (define_insn "*cmpsf_internal"
5068 [(set (match_operand:BI 0 "register_operand" "=c")
5069 (match_operator:BI 1 "comparison_operator"
5070 [(match_operand:SF 2 "fr_reg_or_fp01_operand" "fG")
5071 (match_operand:SF 3 "fr_reg_or_fp01_operand" "fG")]))]
5073 "fcmp.%D1 %0, %I0 = %F2, %F3"
5074 [(set_attr "itanium_class" "fcmp")])
5076 (define_insn "*cmpdf_internal"
5077 [(set (match_operand:BI 0 "register_operand" "=c")
5078 (match_operator:BI 1 "comparison_operator"
5079 [(match_operand:DF 2 "fr_reg_or_fp01_operand" "fG")
5080 (match_operand:DF 3 "fr_reg_or_fp01_operand" "fG")]))]
5082 "fcmp.%D1 %0, %I0 = %F2, %F3"
5083 [(set_attr "itanium_class" "fcmp")])
5085 (define_insn "*cmpxf_internal"
5086 [(set (match_operand:BI 0 "register_operand" "=c")
5087 (match_operator:BI 1 "comparison_operator"
5088 [(match_operand:XF 2 "xfreg_or_fp01_operand" "fG")
5089 (match_operand:XF 3 "xfreg_or_fp01_operand" "fG")]))]
5091 "fcmp.%D1 %0, %I0 = %F2, %F3"
5092 [(set_attr "itanium_class" "fcmp")])
5094 ;; ??? Can this pattern be generated?
5096 (define_insn "*bit_zero"
5097 [(set (match_operand:BI 0 "register_operand" "=c")
5098 (eq:BI (zero_extract:DI (match_operand:DI 1 "gr_register_operand" "r")
5100 (match_operand:DI 2 "shift_count_operand" "M"))
5103 "tbit.z %0, %I0 = %1, %2"
5104 [(set_attr "itanium_class" "tbit")])
5106 (define_insn "*bit_one"
5107 [(set (match_operand:BI 0 "register_operand" "=c")
5108 (ne:BI (zero_extract:DI (match_operand:DI 1 "gr_register_operand" "r")
5110 (match_operand:DI 2 "shift_count_operand" "M"))
5113 "tbit.nz %0, %I0 = %1, %2"
5114 [(set_attr "itanium_class" "tbit")])
5116 ;; ::::::::::::::::::::
5120 ;; ::::::::::::::::::::
5122 (define_expand "beq"
5124 (if_then_else (match_dup 1)
5125 (label_ref (match_operand 0 "" ""))
5128 "operands[1] = ia64_expand_compare (EQ, VOIDmode);")
5130 (define_expand "bne"
5132 (if_then_else (match_dup 1)
5133 (label_ref (match_operand 0 "" ""))
5136 "operands[1] = ia64_expand_compare (NE, VOIDmode);")
5138 (define_expand "blt"
5140 (if_then_else (match_dup 1)
5141 (label_ref (match_operand 0 "" ""))
5144 "operands[1] = ia64_expand_compare (LT, VOIDmode);")
5146 (define_expand "ble"
5148 (if_then_else (match_dup 1)
5149 (label_ref (match_operand 0 "" ""))
5152 "operands[1] = ia64_expand_compare (LE, VOIDmode);")
5154 (define_expand "bgt"
5156 (if_then_else (match_dup 1)
5157 (label_ref (match_operand 0 "" ""))
5160 "operands[1] = ia64_expand_compare (GT, VOIDmode);")
5162 (define_expand "bge"
5164 (if_then_else (match_dup 1)
5165 (label_ref (match_operand 0 "" ""))
5168 "operands[1] = ia64_expand_compare (GE, VOIDmode);")
5170 (define_expand "bltu"
5172 (if_then_else (match_dup 1)
5173 (label_ref (match_operand 0 "" ""))
5176 "operands[1] = ia64_expand_compare (LTU, VOIDmode);")
5178 (define_expand "bleu"
5180 (if_then_else (match_dup 1)
5181 (label_ref (match_operand 0 "" ""))
5184 "operands[1] = ia64_expand_compare (LEU, VOIDmode);")
5186 (define_expand "bgtu"
5188 (if_then_else (match_dup 1)
5189 (label_ref (match_operand 0 "" ""))
5192 "operands[1] = ia64_expand_compare (GTU, VOIDmode);")
5194 (define_expand "bgeu"
5196 (if_then_else (match_dup 1)
5197 (label_ref (match_operand 0 "" ""))
5200 "operands[1] = ia64_expand_compare (GEU, VOIDmode);")
5202 (define_expand "bunordered"
5204 (if_then_else (match_dup 1)
5205 (label_ref (match_operand 0 "" ""))
5208 "operands[1] = ia64_expand_compare (UNORDERED, VOIDmode);")
5210 (define_expand "bordered"
5212 (if_then_else (match_dup 1)
5213 (label_ref (match_operand 0 "" ""))
5216 "operands[1] = ia64_expand_compare (ORDERED, VOIDmode);")
5218 (define_insn "*br_true"
5220 (if_then_else (match_operator 0 "predicate_operator"
5221 [(match_operand:BI 1 "register_operand" "c")
5223 (label_ref (match_operand 2 "" ""))
5226 "(%J0) br.cond%+ %l2"
5227 [(set_attr "itanium_class" "br")
5228 (set_attr "predicable" "no")])
5230 (define_insn "*br_false"
5232 (if_then_else (match_operator 0 "predicate_operator"
5233 [(match_operand:BI 1 "register_operand" "c")
5236 (label_ref (match_operand 2 "" ""))))]
5238 "(%j0) br.cond%+ %l2"
5239 [(set_attr "itanium_class" "br")
5240 (set_attr "predicable" "no")])
5242 ;; ::::::::::::::::::::
5244 ;; :: Counted loop operations
5246 ;; ::::::::::::::::::::
5248 (define_expand "doloop_end"
5249 [(use (match_operand 0 "" "")) ; loop pseudo
5250 (use (match_operand 1 "" "")) ; iterations; zero if unknown
5251 (use (match_operand 2 "" "")) ; max iterations
5252 (use (match_operand 3 "" "")) ; loop level
5253 (use (match_operand 4 "" ""))] ; label
5256 /* Only use cloop on innermost loops. */
5257 if (INTVAL (operands[3]) > 1)
5259 emit_jump_insn (gen_doloop_end_internal (gen_rtx_REG (DImode, AR_LC_REGNUM),
5264 (define_insn "doloop_end_internal"
5265 [(set (pc) (if_then_else (ne (match_operand:DI 0 "ar_lc_reg_operand" "")
5267 (label_ref (match_operand 1 "" ""))
5269 (set (match_dup 0) (if_then_else:DI (ne (match_dup 0) (const_int 0))
5270 (plus:DI (match_dup 0) (const_int -1))
5273 "br.cloop.sptk.few %l1"
5274 [(set_attr "itanium_class" "br")
5275 (set_attr "predicable" "no")])
5277 ;; ::::::::::::::::::::
5279 ;; :: Set flag operations
5281 ;; ::::::::::::::::::::
5283 (define_expand "seq"
5284 [(set (match_operand:DI 0 "gr_register_operand" "") (match_dup 1))]
5286 "operands[1] = ia64_expand_compare (EQ, DImode);")
5288 (define_expand "sne"
5289 [(set (match_operand:DI 0 "gr_register_operand" "") (match_dup 1))]
5291 "operands[1] = ia64_expand_compare (NE, DImode);")
5293 (define_expand "slt"
5294 [(set (match_operand:DI 0 "gr_register_operand" "") (match_dup 1))]
5296 "operands[1] = ia64_expand_compare (LT, DImode);")
5298 (define_expand "sle"
5299 [(set (match_operand:DI 0 "gr_register_operand" "") (match_dup 1))]
5301 "operands[1] = ia64_expand_compare (LE, DImode);")
5303 (define_expand "sgt"
5304 [(set (match_operand:DI 0 "gr_register_operand" "") (match_dup 1))]
5306 "operands[1] = ia64_expand_compare (GT, DImode);")
5308 (define_expand "sge"
5309 [(set (match_operand:DI 0 "gr_register_operand" "") (match_dup 1))]
5311 "operands[1] = ia64_expand_compare (GE, DImode);")
5313 (define_expand "sltu"
5314 [(set (match_operand:DI 0 "gr_register_operand" "") (match_dup 1))]
5316 "operands[1] = ia64_expand_compare (LTU, DImode);")
5318 (define_expand "sleu"
5319 [(set (match_operand:DI 0 "gr_register_operand" "") (match_dup 1))]
5321 "operands[1] = ia64_expand_compare (LEU, DImode);")
5323 (define_expand "sgtu"
5324 [(set (match_operand:DI 0 "gr_register_operand" "") (match_dup 1))]
5326 "operands[1] = ia64_expand_compare (GTU, DImode);")
5328 (define_expand "sgeu"
5329 [(set (match_operand:DI 0 "gr_register_operand" "") (match_dup 1))]
5331 "operands[1] = ia64_expand_compare (GEU, DImode);")
5333 (define_expand "sunordered"
5334 [(set (match_operand:DI 0 "gr_register_operand" "") (match_dup 1))]
5336 "operands[1] = ia64_expand_compare (UNORDERED, DImode);")
5338 (define_expand "sordered"
5339 [(set (match_operand:DI 0 "gr_register_operand" "") (match_dup 1))]
5341 "operands[1] = ia64_expand_compare (ORDERED, DImode);")
5343 ;; Don't allow memory as destination here, because cmov/cmov/st is more
5344 ;; efficient than mov/mov/cst/cst.
5346 (define_insn_and_split "*sne_internal"
5347 [(set (match_operand:DI 0 "gr_register_operand" "=r")
5348 (ne:DI (match_operand:BI 1 "register_operand" "c")
5353 [(cond_exec (ne (match_dup 1) (const_int 0))
5354 (set (match_dup 0) (const_int 1)))
5355 (cond_exec (eq (match_dup 1) (const_int 0))
5356 (set (match_dup 0) (const_int 0)))]
5358 [(set_attr "itanium_class" "unknown")])
5360 (define_insn_and_split "*seq_internal"
5361 [(set (match_operand:DI 0 "gr_register_operand" "=r")
5362 (eq:DI (match_operand:BI 1 "register_operand" "c")
5367 [(cond_exec (ne (match_dup 1) (const_int 0))
5368 (set (match_dup 0) (const_int 0)))
5369 (cond_exec (eq (match_dup 1) (const_int 0))
5370 (set (match_dup 0) (const_int 1)))]
5372 [(set_attr "itanium_class" "unknown")])
5374 ;; ::::::::::::::::::::
5376 ;; :: Conditional move instructions.
5378 ;; ::::::::::::::::::::
5380 ;; ??? Add movXXcc patterns?
5383 ;; DImode if_then_else patterns.
5386 (define_insn "*cmovdi_internal"
5387 [(set (match_operand:DI 0 "destination_operand"
5388 "= r, r, r, r, r, r, r, r, r, r, m, Q, *f,*b,*d*e")
5390 (match_operator 4 "predicate_operator"
5391 [(match_operand:BI 1 "register_operand"
5392 "c,c,c,c,c,c,c,c,c,c,c,c,c,c,c")
5394 (match_operand:DI 2 "move_operand"
5395 "rim, *f, *b,*d*e,rim,rim, rim,*f,*b,*d*e,rO,*f,rOQ,rO, rK")
5396 (match_operand:DI 3 "move_operand"
5397 "rim,rim,rim, rim, *f, *b,*d*e,*f,*b,*d*e,rO,*f,rOQ,rO, rK")))]
5398 "ia64_move_ok (operands[0], operands[2])
5399 && ia64_move_ok (operands[0], operands[3])"
5400 { gcc_unreachable (); }
5401 [(set_attr "predicable" "no")])
5404 [(set (match_operand 0 "destination_operand" "")
5406 (match_operator 4 "predicate_operator"
5407 [(match_operand:BI 1 "register_operand" "")
5409 (match_operand 2 "move_operand" "")
5410 (match_operand 3 "move_operand" "")))]
5414 bool emitted_something = false;
5415 rtx dest = operands[0];
5416 rtx srct = operands[2];
5417 rtx srcf = operands[3];
5418 rtx cond = operands[4];
5420 if (! rtx_equal_p (dest, srct))
5422 ia64_emit_cond_move (dest, srct, cond);
5423 emitted_something = true;
5425 if (! rtx_equal_p (dest, srcf))
5427 cond = gen_rtx_fmt_ee (GET_CODE (cond) == NE ? EQ : NE,
5428 VOIDmode, operands[1], const0_rtx);
5429 ia64_emit_cond_move (dest, srcf, cond);
5430 emitted_something = true;
5432 if (! emitted_something)
5433 emit_note (NOTE_INSN_DELETED);
5437 ;; Absolute value pattern.
5439 (define_insn "*absdi2_internal"
5440 [(set (match_operand:DI 0 "gr_register_operand" "=r,r")
5442 (match_operator 4 "predicate_operator"
5443 [(match_operand:BI 1 "register_operand" "c,c")
5445 (neg:DI (match_operand:DI 2 "gr_reg_or_22bit_operand" "rI,rI"))
5446 (match_operand:DI 3 "gr_reg_or_22bit_operand" "0,rI")))]
5449 [(set_attr "itanium_class" "ialu,unknown")
5450 (set_attr "predicable" "no")])
5453 [(set (match_operand:DI 0 "register_operand" "")
5455 (match_operator 4 "predicate_operator"
5456 [(match_operand:BI 1 "register_operand" "c,c")
5458 (neg:DI (match_operand:DI 2 "gr_reg_or_22bit_operand" ""))
5459 (match_operand:DI 3 "gr_reg_or_22bit_operand" "")))]
5460 "reload_completed && rtx_equal_p (operands[0], operands[3])"
5464 (neg:DI (match_dup 2))))]
5468 [(set (match_operand:DI 0 "register_operand" "")
5470 (match_operator 4 "predicate_operator"
5471 [(match_operand:BI 1 "register_operand" "c,c")
5473 (neg:DI (match_operand:DI 2 "gr_reg_or_22bit_operand" ""))
5474 (match_operand:DI 3 "gr_reg_or_22bit_operand" "")))]
5478 (set (match_dup 0) (neg:DI (match_dup 2))))
5481 (set (match_dup 0) (match_dup 3)))]
5483 operands[5] = gen_rtx_fmt_ee (GET_CODE (operands[4]) == NE ? EQ : NE,
5484 VOIDmode, operands[1], const0_rtx);
5488 ;; SImode if_then_else patterns.
5491 (define_insn "*cmovsi_internal"
5492 [(set (match_operand:SI 0 "destination_operand" "=r,m,*f,r,m,*f,r,m,*f")
5494 (match_operator 4 "predicate_operator"
5495 [(match_operand:BI 1 "register_operand" "c,c,c,c,c,c,c,c,c")
5497 (match_operand:SI 2 "move_operand"
5498 "0,0,0,rim*f,rO,rO,rim*f,rO,rO")
5499 (match_operand:SI 3 "move_operand"
5500 "rim*f,rO,rO,0,0,0,rim*f,rO,rO")))]
5501 "ia64_move_ok (operands[0], operands[2])
5502 && ia64_move_ok (operands[0], operands[3])"
5503 { gcc_unreachable (); }
5504 [(set_attr "predicable" "no")])
5506 (define_insn "*abssi2_internal"
5507 [(set (match_operand:SI 0 "gr_register_operand" "=r,r")
5509 (match_operator 4 "predicate_operator"
5510 [(match_operand:BI 1 "register_operand" "c,c")
5512 (neg:SI (match_operand:SI 3 "gr_reg_or_22bit_operand" "rI,rI"))
5513 (match_operand:SI 2 "gr_reg_or_22bit_operand" "0,rI")))]
5516 [(set_attr "itanium_class" "ialu,unknown")
5517 (set_attr "predicable" "no")])
5520 [(set (match_operand:SI 0 "register_operand" "")
5522 (match_operator 4 "predicate_operator"
5523 [(match_operand:BI 1 "register_operand" "c,c")
5525 (neg:SI (match_operand:SI 2 "gr_reg_or_22bit_operand" ""))
5526 (match_operand:SI 3 "gr_reg_or_22bit_operand" "")))]
5527 "reload_completed && rtx_equal_p (operands[0], operands[3])"
5531 (neg:SI (match_dup 2))))]
5535 [(set (match_operand:SI 0 "register_operand" "")
5537 (match_operator 4 "predicate_operator"
5538 [(match_operand:BI 1 "register_operand" "c,c")
5540 (neg:SI (match_operand:SI 2 "gr_reg_or_22bit_operand" ""))
5541 (match_operand:SI 3 "gr_reg_or_22bit_operand" "")))]
5545 (set (match_dup 0) (neg:SI (match_dup 2))))
5548 (set (match_dup 0) (match_dup 3)))]
5550 operands[5] = gen_rtx_fmt_ee (GET_CODE (operands[4]) == NE ? EQ : NE,
5551 VOIDmode, operands[1], const0_rtx);
5554 (define_insn_and_split "*cond_opsi2_internal"
5555 [(set (match_operand:SI 0 "gr_register_operand" "=r")
5556 (match_operator:SI 5 "condop_operator"
5558 (match_operator 6 "predicate_operator"
5559 [(match_operand:BI 1 "register_operand" "c")
5561 (match_operand:SI 2 "gr_register_operand" "r")
5562 (match_operand:SI 3 "gr_register_operand" "r"))
5563 (match_operand:SI 4 "gr_register_operand" "r")]))]
5569 (set (match_dup 0) (match_op_dup:SI 5 [(match_dup 2) (match_dup 4)])))
5572 (set (match_dup 0) (match_op_dup:SI 5 [(match_dup 3) (match_dup 4)])))]
5574 operands[7] = gen_rtx_fmt_ee (GET_CODE (operands[6]) == NE ? EQ : NE,
5575 VOIDmode, operands[1], const0_rtx);
5577 [(set_attr "itanium_class" "ialu")
5578 (set_attr "predicable" "no")])
5581 (define_insn_and_split "*cond_opsi2_internal_b"
5582 [(set (match_operand:SI 0 "gr_register_operand" "=r")
5583 (match_operator:SI 5 "condop_operator"
5584 [(match_operand:SI 4 "gr_register_operand" "r")
5586 (match_operator 6 "predicate_operator"
5587 [(match_operand:BI 1 "register_operand" "c")
5589 (match_operand:SI 2 "gr_register_operand" "r")
5590 (match_operand:SI 3 "gr_register_operand" "r"))]))]
5596 (set (match_dup 0) (match_op_dup:SI 5 [(match_dup 4) (match_dup 2)])))
5599 (set (match_dup 0) (match_op_dup:SI 5 [(match_dup 4) (match_dup 3)])))]
5601 operands[7] = gen_rtx_fmt_ee (GET_CODE (operands[6]) == NE ? EQ : NE,
5602 VOIDmode, operands[1], const0_rtx);
5604 [(set_attr "itanium_class" "ialu")
5605 (set_attr "predicable" "no")])
5608 ;; ::::::::::::::::::::
5610 ;; :: Call and branch instructions
5612 ;; ::::::::::::::::::::
5614 ;; Subroutine call instruction returning no value. Operand 0 is the function
5615 ;; to call; operand 1 is the number of bytes of arguments pushed (in mode
5616 ;; `SImode', except it is normally a `const_int'); operand 2 is the number of
5617 ;; registers used as operands.
5619 ;; On most machines, operand 2 is not actually stored into the RTL pattern. It
5620 ;; is supplied for the sake of some RISC machines which need to put this
5621 ;; information into the assembler code; they can put it in the RTL instead of
5624 (define_expand "call"
5625 [(use (match_operand:DI 0 "" ""))
5626 (use (match_operand 1 "" ""))
5627 (use (match_operand 2 "" ""))
5628 (use (match_operand 3 "" ""))]
5631 ia64_expand_call (NULL_RTX, operands[0], operands[2], false);
5635 (define_expand "sibcall"
5636 [(use (match_operand:DI 0 "" ""))
5637 (use (match_operand 1 "" ""))
5638 (use (match_operand 2 "" ""))
5639 (use (match_operand 3 "" ""))]
5642 ia64_expand_call (NULL_RTX, operands[0], operands[2], true);
5646 ;; Subroutine call instruction returning a value. Operand 0 is the hard
5647 ;; register in which the value is returned. There are three more operands,
5648 ;; the same as the three operands of the `call' instruction (but with numbers
5649 ;; increased by one).
5651 ;; Subroutines that return `BLKmode' objects use the `call' insn.
5653 (define_expand "call_value"
5654 [(use (match_operand 0 "" ""))
5655 (use (match_operand:DI 1 "" ""))
5656 (use (match_operand 2 "" ""))
5657 (use (match_operand 3 "" ""))
5658 (use (match_operand 4 "" ""))]
5661 ia64_expand_call (operands[0], operands[1], operands[3], false);
5665 (define_expand "sibcall_value"
5666 [(use (match_operand 0 "" ""))
5667 (use (match_operand:DI 1 "" ""))
5668 (use (match_operand 2 "" ""))
5669 (use (match_operand 3 "" ""))
5670 (use (match_operand 4 "" ""))]
5673 ia64_expand_call (operands[0], operands[1], operands[3], true);
5677 ;; Call subroutine returning any type.
5679 (define_expand "untyped_call"
5680 [(parallel [(call (match_operand 0 "" "")
5682 (match_operand 1 "" "")
5683 (match_operand 2 "" "")])]
5688 emit_call_insn (gen_call (operands[0], const0_rtx, NULL, const0_rtx));
5690 for (i = 0; i < XVECLEN (operands[2], 0); i++)
5692 rtx set = XVECEXP (operands[2], 0, i);
5693 emit_move_insn (SET_DEST (set), SET_SRC (set));
5696 /* The optimizer does not know that the call sets the function value
5697 registers we stored in the result block. We avoid problems by
5698 claiming that all hard registers are used and clobbered at this
5700 emit_insn (gen_blockage ());
5705 (define_insn "call_nogp"
5706 [(call (mem:DI (match_operand:DI 0 "call_operand" "?b,i"))
5708 (clobber (match_operand:DI 1 "register_operand" "=b,b"))]
5710 "br.call%+.many %1 = %0"
5711 [(set_attr "itanium_class" "br,scall")])
5713 (define_insn "call_value_nogp"
5714 [(set (match_operand 0 "" "=X,X")
5715 (call (mem:DI (match_operand:DI 1 "call_operand" "?b,i"))
5717 (clobber (match_operand:DI 2 "register_operand" "=b,b"))]
5719 "br.call%+.many %2 = %1"
5720 [(set_attr "itanium_class" "br,scall")])
5722 (define_insn "sibcall_nogp"
5723 [(call (mem:DI (match_operand:DI 0 "call_operand" "?b,i"))
5727 [(set_attr "itanium_class" "br,scall")])
5729 (define_insn "call_gp"
5730 [(call (mem:DI (match_operand:DI 0 "call_operand" "?r,i"))
5732 (clobber (match_operand:DI 1 "register_operand" "=b,b"))
5733 (clobber (match_scratch:DI 2 "=&r,X"))
5734 (clobber (match_scratch:DI 3 "=b,X"))]
5737 [(set_attr "itanium_class" "br,scall")])
5739 ;; Irritatingly, we don't have access to INSN within the split body.
5740 ;; See commentary in ia64_split_call as to why these aren't peep2.
5742 [(call (mem (match_operand 0 "call_operand" ""))
5744 (clobber (match_operand:DI 1 "register_operand" ""))
5745 (clobber (match_scratch:DI 2 ""))
5746 (clobber (match_scratch:DI 3 ""))]
5747 "reload_completed && find_reg_note (insn, REG_NORETURN, NULL_RTX)"
5750 ia64_split_call (NULL_RTX, operands[0], operands[1], operands[2],
5751 operands[3], true, false);
5756 [(call (mem (match_operand 0 "call_operand" ""))
5758 (clobber (match_operand:DI 1 "register_operand" ""))
5759 (clobber (match_scratch:DI 2 ""))
5760 (clobber (match_scratch:DI 3 ""))]
5764 ia64_split_call (NULL_RTX, operands[0], operands[1], operands[2],
5765 operands[3], false, false);
5769 (define_insn "call_value_gp"
5770 [(set (match_operand 0 "" "=X,X")
5771 (call (mem:DI (match_operand:DI 1 "call_operand" "?r,i"))
5773 (clobber (match_operand:DI 2 "register_operand" "=b,b"))
5774 (clobber (match_scratch:DI 3 "=&r,X"))
5775 (clobber (match_scratch:DI 4 "=b,X"))]
5778 [(set_attr "itanium_class" "br,scall")])
5781 [(set (match_operand 0 "" "")
5782 (call (mem:DI (match_operand:DI 1 "call_operand" ""))
5784 (clobber (match_operand:DI 2 "register_operand" ""))
5785 (clobber (match_scratch:DI 3 ""))
5786 (clobber (match_scratch:DI 4 ""))]
5787 "reload_completed && find_reg_note (insn, REG_NORETURN, NULL_RTX)"
5790 ia64_split_call (operands[0], operands[1], operands[2], operands[3],
5791 operands[4], true, false);
5796 [(set (match_operand 0 "" "")
5797 (call (mem:DI (match_operand:DI 1 "call_operand" ""))
5799 (clobber (match_operand:DI 2 "register_operand" ""))
5800 (clobber (match_scratch:DI 3 ""))
5801 (clobber (match_scratch:DI 4 ""))]
5805 ia64_split_call (operands[0], operands[1], operands[2], operands[3],
5806 operands[4], false, false);
5810 (define_insn_and_split "sibcall_gp"
5811 [(call (mem:DI (match_operand:DI 0 "call_operand" "?r,i"))
5813 (clobber (match_scratch:DI 1 "=&r,X"))
5814 (clobber (match_scratch:DI 2 "=b,X"))]
5820 ia64_split_call (NULL_RTX, operands[0], NULL_RTX, operands[1],
5821 operands[2], true, true);
5824 [(set_attr "itanium_class" "br")])
5826 (define_insn "return_internal"
5828 (use (match_operand:DI 0 "register_operand" "b"))]
5830 "br.ret.sptk.many %0"
5831 [(set_attr "itanium_class" "br")])
5833 (define_insn "return"
5835 "ia64_direct_return ()"
5836 "br.ret.sptk.many rp"
5837 [(set_attr "itanium_class" "br")])
5839 (define_insn "*return_true"
5841 (if_then_else (match_operator 0 "predicate_operator"
5842 [(match_operand:BI 1 "register_operand" "c")
5846 "ia64_direct_return ()"
5847 "(%J0) br.ret%+.many rp"
5848 [(set_attr "itanium_class" "br")
5849 (set_attr "predicable" "no")])
5851 (define_insn "*return_false"
5853 (if_then_else (match_operator 0 "predicate_operator"
5854 [(match_operand:BI 1 "register_operand" "c")
5858 "ia64_direct_return ()"
5859 "(%j0) br.ret%+.many rp"
5860 [(set_attr "itanium_class" "br")
5861 (set_attr "predicable" "no")])
5864 [(set (pc) (label_ref (match_operand 0 "" "")))]
5867 [(set_attr "itanium_class" "br")])
5869 (define_insn "indirect_jump"
5870 [(set (pc) (match_operand:DI 0 "register_operand" "b"))]
5873 [(set_attr "itanium_class" "br")])
5875 (define_expand "tablejump"
5876 [(parallel [(set (pc) (match_operand:DI 0 "memory_operand" ""))
5877 (use (label_ref (match_operand 1 "" "")))])]
5880 rtx op0 = operands[0];
5883 /* ??? Bother -- do_tablejump is "helpful" and pulls the table
5884 element into a register without bothering to see whether that
5885 is necessary given the operand predicate. Check for MEM just
5886 in case someone fixes this. */
5887 if (GET_CODE (op0) == MEM)
5888 addr = XEXP (op0, 0);
5891 /* Otherwise, cheat and guess that the previous insn in the
5892 stream was the memory load. Grab the address from that.
5893 Note we have to momentarily pop out of the sequence started
5894 by the insn-emit wrapper in order to grab the last insn. */
5898 last = get_last_insn ();
5900 set = single_set (last);
5902 gcc_assert (rtx_equal_p (SET_DEST (set), op0)
5903 && GET_CODE (SET_SRC (set)) == MEM);
5904 addr = XEXP (SET_SRC (set), 0);
5905 gcc_assert (!rtx_equal_p (addr, op0));
5908 /* Jump table elements are stored pc-relative. That is, a displacement
5909 from the entry to the label. Thus to convert to an absolute address
5910 we add the address of the memory from which the value is loaded. */
5911 operands[0] = expand_simple_binop (DImode, PLUS, op0, addr,
5912 NULL_RTX, 1, OPTAB_DIRECT);
5915 (define_insn "*tablejump_internal"
5916 [(set (pc) (match_operand:DI 0 "register_operand" "b"))
5917 (use (label_ref (match_operand 1 "" "")))]
5920 [(set_attr "itanium_class" "br")])
5923 ;; ::::::::::::::::::::
5925 ;; :: Prologue and Epilogue instructions
5927 ;; ::::::::::::::::::::
5929 (define_expand "prologue"
5933 ia64_expand_prologue ();
5937 (define_expand "epilogue"
5941 ia64_expand_epilogue (0);
5945 (define_expand "sibcall_epilogue"
5949 ia64_expand_epilogue (1);
5953 ;; This prevents the scheduler from moving the SP decrement past FP-relative
5954 ;; stack accesses. This is the same as adddi3 plus the extra set.
5956 (define_insn "prologue_allocate_stack"
5957 [(set (match_operand:DI 0 "register_operand" "=r,r,r")
5958 (plus:DI (match_operand:DI 1 "register_operand" "%r,r,a")
5959 (match_operand:DI 2 "gr_reg_or_22bit_operand" "r,I,J")))
5960 (set (match_operand:DI 3 "register_operand" "+r,r,r")
5967 [(set_attr "itanium_class" "ialu")])
5969 ;; This prevents the scheduler from moving the SP restore past FP-relative
5970 ;; stack accesses. This is similar to movdi plus the extra set.
5972 (define_insn "epilogue_deallocate_stack"
5973 [(set (match_operand:DI 0 "register_operand" "=r")
5974 (match_operand:DI 1 "register_operand" "+r"))
5975 (set (match_dup 1) (match_dup 1))]
5978 [(set_attr "itanium_class" "ialu")])
5980 ;; As USE insns aren't meaningful after reload, this is used instead
5981 ;; to prevent deleting instructions setting registers for EH handling
5982 (define_insn "prologue_use"
5983 [(unspec:DI [(match_operand:DI 0 "register_operand" "")]
5984 UNSPEC_PROLOGUE_USE)]
5987 [(set_attr "itanium_class" "ignore")
5988 (set_attr "predicable" "no")
5989 (set_attr "empty" "yes")])
5991 ;; Allocate a new register frame.
5993 (define_insn "alloc"
5994 [(set (match_operand:DI 0 "register_operand" "=r")
5995 (unspec_volatile:DI [(const_int 0)] UNSPECV_ALLOC))
5996 (use (match_operand:DI 1 "const_int_operand" "i"))
5997 (use (match_operand:DI 2 "const_int_operand" "i"))
5998 (use (match_operand:DI 3 "const_int_operand" "i"))
5999 (use (match_operand:DI 4 "const_int_operand" "i"))]
6001 "alloc %0 = ar.pfs, %1, %2, %3, %4"
6002 [(set_attr "itanium_class" "syst_m0")
6003 (set_attr "predicable" "no")
6004 (set_attr "first_insn" "yes")])
6007 (define_expand "gr_spill"
6008 [(parallel [(set (match_operand:DI 0 "memory_operand" "=m")
6009 (unspec:DI [(match_operand:DI 1 "register_operand" "r")
6010 (match_operand:DI 2 "const_int_operand" "")]
6012 (clobber (match_dup 3))])]
6014 "operands[3] = gen_rtx_REG (DImode, AR_UNAT_REGNUM);")
6016 (define_insn "gr_spill_internal"
6017 [(set (match_operand:DI 0 "destination_operand" "=m")
6018 (unspec:DI [(match_operand:DI 1 "register_operand" "r")
6019 (match_operand:DI 2 "const_int_operand" "")]
6021 (clobber (match_operand:DI 3 "register_operand" ""))]
6024 /* Note that we use a C output pattern here to avoid the predicate
6025 being automatically added before the .mem.offset directive. */
6026 return ".mem.offset %2, 0\;%,st8.spill %0 = %1%P0";
6028 [(set_attr "itanium_class" "st")])
6031 (define_expand "gr_restore"
6032 [(parallel [(set (match_operand:DI 0 "register_operand" "=r")
6033 (unspec:DI [(match_operand:DI 1 "memory_operand" "m")
6034 (match_operand:DI 2 "const_int_operand" "")]
6036 (use (match_dup 3))])]
6038 "operands[3] = gen_rtx_REG (DImode, AR_UNAT_REGNUM);")
6040 (define_insn "gr_restore_internal"
6041 [(set (match_operand:DI 0 "register_operand" "=r")
6042 (unspec:DI [(match_operand:DI 1 "memory_operand" "m")
6043 (match_operand:DI 2 "const_int_operand" "")]
6045 (use (match_operand:DI 3 "register_operand" ""))]
6047 { return ".mem.offset %2, 0\;%,ld8.fill %0 = %1%P1"; }
6048 [(set_attr "itanium_class" "ld")])
6050 (define_insn "fr_spill"
6051 [(set (match_operand:XF 0 "destination_operand" "=m")
6052 (unspec:XF [(match_operand:XF 1 "register_operand" "f")]
6055 "stf.spill %0 = %1%P0"
6056 [(set_attr "itanium_class" "stf")])
6058 (define_insn "fr_restore"
6059 [(set (match_operand:XF 0 "register_operand" "=f")
6060 (unspec:XF [(match_operand:XF 1 "memory_operand" "m")]
6061 UNSPEC_FR_RESTORE))]
6063 "ldf.fill %0 = %1%P1"
6064 [(set_attr "itanium_class" "fld")])
6066 ;; ??? The explicit stop is not ideal. It would be better if
6067 ;; rtx_needs_barrier took care of this, but this is something that can be
6068 ;; fixed later. This avoids an RSE DV.
6070 (define_insn "bsp_value"
6071 [(set (match_operand:DI 0 "register_operand" "=r")
6072 (unspec:DI [(const_int 0)] UNSPEC_BSP_VALUE))]
6076 return \";;\;%,mov %0 = ar.bsp\";
6078 [(set_attr "itanium_class" "frar_i")])
6080 (define_insn "set_bsp"
6081 [(unspec_volatile [(match_operand:DI 0 "register_operand" "r")]
6099 [(set_attr "itanium_class" "unknown")
6100 (set_attr "predicable" "no")])
6102 ;; ??? The explicit stops are not ideal. It would be better if
6103 ;; rtx_needs_barrier took care of this, but this is something that can be
6104 ;; fixed later. This avoids an RSE DV.
6106 (define_insn "flushrs"
6107 [(unspec [(const_int 0)] UNSPEC_FLUSHRS)]
6110 [(set_attr "itanium_class" "rse_m")
6111 (set_attr "predicable" "no")])
6113 ;; ::::::::::::::::::::
6115 ;; :: Miscellaneous instructions
6117 ;; ::::::::::::::::::::
6119 ;; ??? Emitting a NOP instruction isn't very useful. This should probably
6120 ;; be emitting ";;" to force a break in the instruction packing.
6122 ;; No operation, needed in case the user uses -g but not -O.
6127 [(set_attr "itanium_class" "nop")])
6129 (define_insn "nop_m"
6133 [(set_attr "itanium_class" "nop_m")])
6135 (define_insn "nop_i"
6139 [(set_attr "itanium_class" "nop_i")])
6141 (define_insn "nop_f"
6145 [(set_attr "itanium_class" "nop_f")])
6147 (define_insn "nop_b"
6151 [(set_attr "itanium_class" "nop_b")])
6153 (define_insn "nop_x"
6157 [(set_attr "itanium_class" "nop_x")
6158 (set_attr "empty" "yes")])
6160 ;; The following insn will be never generated. It is used only by
6161 ;; insn scheduler to change state before advancing cycle.
6162 (define_insn "pre_cycle"
6166 [(set_attr "itanium_class" "pre_cycle")])
6168 (define_insn "bundle_selector"
6169 [(unspec [(match_operand 0 "const_int_operand" "")] UNSPEC_BUNDLE_SELECTOR)]
6171 { return get_bundle_name (INTVAL (operands[0])); }
6172 [(set_attr "itanium_class" "ignore")
6173 (set_attr "predicable" "no")])
6175 ;; Pseudo instruction that prevents the scheduler from moving code above this
6177 (define_insn "blockage"
6178 [(unspec_volatile [(const_int 0)] UNSPECV_BLOCKAGE)]
6181 [(set_attr "itanium_class" "ignore")
6182 (set_attr "predicable" "no")])
6184 (define_insn "insn_group_barrier"
6185 [(unspec_volatile [(match_operand 0 "const_int_operand" "")]
6186 UNSPECV_INSN_GROUP_BARRIER)]
6189 [(set_attr "itanium_class" "stop_bit")
6190 (set_attr "predicable" "no")
6191 (set_attr "empty" "yes")])
6193 (define_expand "trap"
6194 [(trap_if (const_int 1) (const_int 0))]
6198 ;; ??? We don't have a match-any slot type. Setting the type to unknown
6199 ;; produces worse code that setting the slot type to A.
6201 (define_insn "*trap"
6202 [(trap_if (const_int 1) (match_operand 0 "const_int_operand" ""))]
6205 [(set_attr "itanium_class" "chk_s_i")])
6207 (define_expand "conditional_trap"
6208 [(trap_if (match_operand 0 "" "") (match_operand 1 "" ""))]
6211 operands[0] = ia64_expand_compare (GET_CODE (operands[0]), VOIDmode);
6214 (define_insn "*conditional_trap"
6215 [(trap_if (match_operator 0 "predicate_operator"
6216 [(match_operand:BI 1 "register_operand" "c")
6218 (match_operand 2 "const_int_operand" ""))]
6221 [(set_attr "itanium_class" "chk_s_i")
6222 (set_attr "predicable" "no")])
6224 (define_insn "break_f"
6225 [(unspec_volatile [(const_int 0)] UNSPECV_BREAK)]
6228 [(set_attr "itanium_class" "nop_f")])
6230 (define_insn "prefetch"
6231 [(prefetch (match_operand:DI 0 "address_operand" "p")
6232 (match_operand:DI 1 "const_int_operand" "n")
6233 (match_operand:DI 2 "const_int_operand" "n"))]
6236 static const char * const alt[2][4] = {
6238 "%,lfetch.nta [%0]",
6239 "%,lfetch.nt1 [%0]",
6240 "%,lfetch.nt2 [%0]",
6244 "%,lfetch.excl.nta [%0]",
6245 "%,lfetch.excl.nt1 [%0]",
6246 "%,lfetch.excl.nt2 [%0]",
6247 "%,lfetch.excl [%0]"
6250 int i = (INTVAL (operands[1]));
6251 int j = (INTVAL (operands[2]));
6253 gcc_assert (i == 0 || i == 1);
6254 gcc_assert (j >= 0 && j <= 3);
6257 [(set_attr "itanium_class" "lfetch")])
6259 ;; Non-local goto support.
6261 (define_expand "save_stack_nonlocal"
6262 [(use (match_operand:OI 0 "memory_operand" ""))
6263 (use (match_operand:DI 1 "register_operand" ""))]
6266 emit_library_call (gen_rtx_SYMBOL_REF (Pmode,
6267 \"__ia64_save_stack_nonlocal\"),
6268 0, VOIDmode, 2, XEXP (operands[0], 0), Pmode,
6269 operands[1], Pmode);
6273 (define_expand "nonlocal_goto"
6274 [(use (match_operand 0 "general_operand" ""))
6275 (use (match_operand 1 "general_operand" ""))
6276 (use (match_operand 2 "general_operand" ""))
6277 (use (match_operand 3 "general_operand" ""))]
6280 emit_library_call (gen_rtx_SYMBOL_REF (Pmode, \"__ia64_nonlocal_goto\"),
6281 LCT_NORETURN, VOIDmode, 3,
6283 copy_to_reg (XEXP (operands[2], 0)), Pmode,
6284 operands[3], Pmode);
6289 (define_insn_and_split "builtin_setjmp_receiver"
6290 [(unspec_volatile [(match_operand:DI 0 "" "")] UNSPECV_SETJMP_RECEIVER)]
6300 (define_expand "eh_epilogue"
6301 [(use (match_operand:DI 0 "register_operand" "r"))
6302 (use (match_operand:DI 1 "register_operand" "r"))
6303 (use (match_operand:DI 2 "register_operand" "r"))]
6306 rtx bsp = gen_rtx_REG (Pmode, 10);
6307 rtx sp = gen_rtx_REG (Pmode, 9);
6309 if (GET_CODE (operands[0]) != REG || REGNO (operands[0]) != 10)
6311 emit_move_insn (bsp, operands[0]);
6314 if (GET_CODE (operands[2]) != REG || REGNO (operands[2]) != 9)
6316 emit_move_insn (sp, operands[2]);
6319 emit_insn (gen_rtx_USE (VOIDmode, sp));
6320 emit_insn (gen_rtx_USE (VOIDmode, bsp));
6322 cfun->machine->ia64_eh_epilogue_sp = sp;
6323 cfun->machine->ia64_eh_epilogue_bsp = bsp;
6326 ;; Builtin apply support.
6328 (define_expand "restore_stack_nonlocal"
6329 [(use (match_operand:DI 0 "register_operand" ""))
6330 (use (match_operand:OI 1 "memory_operand" ""))]
6333 emit_library_call (gen_rtx_SYMBOL_REF (Pmode,
6334 "__ia64_restore_stack_nonlocal"),
6336 copy_to_reg (XEXP (operands[1], 0)), Pmode);
6344 [(match_operator 0 "predicate_operator"
6345 [(match_operand:BI 1 "register_operand" "c")
6350 (define_insn "pred_rel_mutex"
6351 [(set (match_operand:BI 0 "register_operand" "+c")
6352 (unspec:BI [(match_dup 0)] UNSPEC_PRED_REL_MUTEX))]
6354 ".pred.rel.mutex %0, %I0"
6355 [(set_attr "itanium_class" "ignore")
6356 (set_attr "predicable" "no")])
6358 (define_insn "safe_across_calls_all"
6359 [(unspec_volatile [(const_int 0)] UNSPECV_PSAC_ALL)]
6361 ".pred.safe_across_calls p1-p63"
6362 [(set_attr "itanium_class" "ignore")
6363 (set_attr "predicable" "no")])
6365 (define_insn "safe_across_calls_normal"
6366 [(unspec_volatile [(const_int 0)] UNSPECV_PSAC_NORMAL)]
6369 emit_safe_across_calls ();
6372 [(set_attr "itanium_class" "ignore")
6373 (set_attr "predicable" "no")])
6375 ;; UNSPEC instruction definition to "swizzle" 32-bit pointer into 64-bit
6376 ;; pointer. This is used by the HP-UX 32 bit mode.
6378 (define_insn "ptr_extend"
6379 [(set (match_operand:DI 0 "gr_register_operand" "=r")
6380 (unspec:DI [(match_operand:SI 1 "gr_register_operand" "r")]
6384 [(set_attr "itanium_class" "ialu")])
6387 ;; Optimizations for ptr_extend
6389 (define_insn "ptr_extend_plus_imm"
6390 [(set (match_operand:DI 0 "gr_register_operand" "=r")
6392 [(plus:SI (match_operand:SI 1 "basereg_operand" "r")
6393 (match_operand:SI 2 "gr_reg_or_14bit_operand" "rI"))]
6395 "addp4_optimize_ok (operands[1], operands[2])"
6397 [(set_attr "itanium_class" "ialu")])
6399 (define_insn "*ptr_extend_plus_2"
6400 [(set (match_operand:DI 0 "gr_register_operand" "=r")
6402 [(plus:SI (match_operand:SI 1 "gr_register_operand" "r")
6403 (match_operand:SI 2 "basereg_operand" "r"))]
6405 "addp4_optimize_ok (operands[1], operands[2])"
6407 [(set_attr "itanium_class" "ialu")])
6410 ;; Get instruction pointer
6412 (define_insn "ip_value"
6413 [(set (match_operand:DI 0 "register_operand" "=r")
6417 [(set_attr "itanium_class" "frbr")])
6419 ;; Vector operations
6421 ;; Atomic operations
6423 ;; New division operations