1 ;; IA-64 Machine description template
2 ;; Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008,
3 ;; 2009, 2010 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.
51 (define_c_enum "unspec"
65 UNSPEC_FR_RECIP_APPROX
74 UNSPEC_BUNDLE_SELECTOR
79 UNSPEC_FR_SQRT_RECIP_APPROX
92 UNSPEC_FR_RECIP_APPROX_RES
93 UNSPEC_FR_SQRT_RECIP_APPROX_RES
96 (define_c_enum "unspecv" [
99 UNSPECV_INSN_GROUP_BARRIER
102 UNSPECV_PSAC_ALL ; pred.safe_across_calls
104 UNSPECV_SETJMP_RECEIVER
105 UNSPECV_GOTO_RECEIVER
108 (include "predicates.md")
109 (include "constraints.md")
111 ;; ::::::::::::::::::::
115 ;; ::::::::::::::::::::
117 ;; Processor type. This attribute must exactly match the processor_type
118 ;; enumeration in ia64.h.
119 (define_attr "cpu" "itanium,itanium2"
120 (const (symbol_ref "((enum attr_cpu) ia64_tune)")))
122 ;; Instruction type. This primarily determines how instructions can be
123 ;; packed in bundles, and secondarily affects scheduling to function units.
125 ;; A alu, can go in I or M syllable of a bundle
130 ;; L long immediate, takes two syllables
133 ;; ??? Should not have any pattern with type unknown. Perhaps add code to
134 ;; check this in md_reorg? Currently use unknown for patterns which emit
135 ;; multiple instructions, patterns which emit 0 instructions, and patterns
136 ;; which emit instruction that can go in any slot (e.g. nop).
138 (define_attr "itanium_class" "unknown,ignore,stop_bit,br,fcmp,fcvtfx,fld,
139 fldp,fmac,fmisc,frar_i,frar_m,frbr,frfr,frpr,ialu,icmp,ilog,ishf,
140 ld,chk_s_i,chk_s_f,chk_a,long_i,mmalua,mmmul,mmshf,mmshfi,rse_m,scall,sem,stf,
141 st,syst_m0, syst_m,tbit,toar_i,toar_m,tobr,tofr,topr,xmpy,xtd,nop,
142 nop_b,nop_f,nop_i,nop_m,nop_x,lfetch,pre_cycle"
143 (const_string "unknown"))
145 ;; chk_s_i has an I and an M form; use type A for convenience.
146 (define_attr "type" "unknown,A,I,M,F,B,L,X,S"
147 (cond [(eq_attr "itanium_class" "ld,st,fld,fldp,stf,sem,nop_m") (const_string "M")
148 (eq_attr "itanium_class" "rse_m,syst_m,syst_m0") (const_string "M")
149 (eq_attr "itanium_class" "frar_m,toar_m,frfr,tofr") (const_string "M")
150 (eq_attr "itanium_class" "lfetch") (const_string "M")
151 (eq_attr "itanium_class" "chk_s_f,chk_a") (const_string "M")
152 (eq_attr "itanium_class" "chk_s_i,ialu,icmp,ilog,mmalua")
154 (eq_attr "itanium_class" "fmisc,fmac,fcmp,xmpy") (const_string "F")
155 (eq_attr "itanium_class" "fcvtfx,nop_f") (const_string "F")
156 (eq_attr "itanium_class" "frar_i,toar_i,frbr,tobr") (const_string "I")
157 (eq_attr "itanium_class" "frpr,topr,ishf,xtd,tbit") (const_string "I")
158 (eq_attr "itanium_class" "mmmul,mmshf,mmshfi,nop_i") (const_string "I")
159 (eq_attr "itanium_class" "br,scall,nop_b") (const_string "B")
160 (eq_attr "itanium_class" "stop_bit") (const_string "S")
161 (eq_attr "itanium_class" "nop_x") (const_string "X")
162 (eq_attr "itanium_class" "long_i") (const_string "L")]
163 (const_string "unknown")))
165 (define_attr "itanium_requires_unit0" "no,yes"
166 (cond [(eq_attr "itanium_class" "syst_m0,sem,frfr,rse_m") (const_string "yes")
167 (eq_attr "itanium_class" "toar_m,frar_m") (const_string "yes")
168 (eq_attr "itanium_class" "frbr,tobr,mmmul") (const_string "yes")
169 (eq_attr "itanium_class" "tbit,ishf,topr,frpr") (const_string "yes")
170 (eq_attr "itanium_class" "toar_i,frar_i") (const_string "yes")
171 (eq_attr "itanium_class" "fmisc,fcmp") (const_string "yes")]
172 (const_string "no")))
174 ;; Predication. True iff this instruction can be predicated.
176 (define_attr "predicable" "no,yes" (const_string "yes"))
178 ;; Empty. True iff this insn does not generate any code.
180 (define_attr "empty" "no,yes" (const_string "no"))
182 ;; True iff this insn must be the first insn of an instruction group.
183 ;; This is true for the alloc instruction, and will also be true of others
184 ;; when we have full intrinsics support.
186 (define_attr "first_insn" "no,yes" (const_string "no"))
188 (define_attr "data_speculative" "no,yes" (const_string "no"))
190 (define_attr "control_speculative" "no,yes" (const_string "no"))
192 (define_attr "check_load" "no,yes" (const_string "no"))
194 (define_attr "speculable1" "no,yes" (const_string "no"))
196 (define_attr "speculable2" "no,yes" (const_string "no"))
198 ;; DFA descriptions of ia64 processors used for insn scheduling and
201 (automata_option "ndfa")
203 ;; Uncomment the following line to output automata for debugging.
204 ;; (automata_option "v")
206 (automata_option "w")
208 (include "itanium2.md")
212 ; Used for truncations from XFmode.
213 (define_mode_iterator MODE_SDF [SF DF])
215 (define_mode_attr suffix [
221 ;; ::::::::::::::::::::
225 ;; ::::::::::::::::::::
227 ;; Set of a single predicate register. This is only used to implement
228 ;; pr-to-pr move and complement.
230 (define_insn "movcci"
231 [(set (match_operand:CCI 0 "destination_operand" "=c,c,?c,?*r, c,*r,*m,*r")
232 (match_operand:CCI 1 "move_operand" " O,n, c, c,*r,*m,*r,*r"))]
235 cmp.ne %0, p0 = r0, r0
236 cmp.eq %0, p0 = r0, r0
237 (%1) cmp.eq.unc %0, p0 = r0, r0
239 tbit.nz %0, p0 = %1, 0
243 [(set_attr "itanium_class" "icmp,icmp,icmp,unknown,tbit,ld,st,ialu")
244 (set_attr "predicable" "no")])
247 [(set (match_operand:CCI 0 "register_operand" "")
248 (match_operand:CCI 1 "register_operand" ""))]
250 && GET_CODE (operands[0]) == REG && GR_REGNO_P (REGNO (operands[0]))
251 && GET_CODE (operands[1]) == REG && PR_REGNO_P (REGNO (operands[1]))"
252 [(set (match_dup 2) (const_int 0))
253 (cond_exec (ne (match_dup 3) (const_int 0))
254 (set (match_dup 2) (const_int 1)))]
255 "operands[2] = gen_rtx_REG (BImode, REGNO (operands[0]));
256 operands[3] = gen_rtx_REG (BImode, REGNO (operands[1]));")
259 [(set (match_operand:BI 0 "destination_operand" "=c,c,?c,?*r, c,*r,*r,*m,*r")
260 (match_operand:BI 1 "move_operand" " O,n, c, c,*r, n,*m,*r,*r"))]
263 cmp.ne %0, %I0 = r0, r0
264 cmp.eq %0, %I0 = r0, r0
267 tbit.nz %0, %I0 = %1, 0
272 [(set_attr "itanium_class" "icmp,icmp,unknown,unknown,tbit,ialu,ld,st,ialu")
273 (set_attr "speculable1" "yes")
274 (set_attr "speculable2" "no, no, no, no, no, no, yes,no,no")])
277 [(set (match_operand:BI 0 "register_operand" "")
278 (match_operand:BI 1 "register_operand" ""))]
280 && GET_CODE (operands[0]) == REG && GR_REGNO_P (REGNO (operands[0]))
281 && GET_CODE (operands[1]) == REG && PR_REGNO_P (REGNO (operands[1]))"
282 [(cond_exec (ne (match_dup 1) (const_int 0))
283 (set (match_dup 0) (const_int 1)))
284 (cond_exec (eq (match_dup 1) (const_int 0))
285 (set (match_dup 0) (const_int 0)))]
289 [(set (match_operand:BI 0 "register_operand" "")
290 (match_operand:BI 1 "register_operand" ""))]
292 && GET_CODE (operands[0]) == REG && PR_REGNO_P (REGNO (operands[0]))
293 && GET_CODE (operands[1]) == REG && PR_REGNO_P (REGNO (operands[1]))"
294 [(set (match_dup 2) (match_dup 4))
295 (set (match_dup 3) (match_dup 5))
296 (set (match_dup 0) (unspec:BI [(match_dup 0)] UNSPEC_PRED_REL_MUTEX))]
297 "operands[2] = gen_rtx_REG (CCImode, REGNO (operands[0]));
298 operands[3] = gen_rtx_REG (CCImode, REGNO (operands[0]) + 1);
299 operands[4] = gen_rtx_REG (CCImode, REGNO (operands[1]));
300 operands[5] = gen_rtx_REG (CCImode, REGNO (operands[1]) + 1);")
302 (define_expand "movqi"
303 [(set (match_operand:QI 0 "general_operand" "")
304 (match_operand:QI 1 "general_operand" ""))]
307 rtx op1 = ia64_expand_move (operands[0], operands[1]);
313 (define_insn "movqi_internal"
314 [(set (match_operand:QI 0 "destination_operand" "=r,r,r, m, r,*f,*f")
315 (match_operand:QI 1 "move_operand" "rO,J,m,rO,*f,rO,*f"))]
316 "ia64_move_ok (operands[0], operands[1])"
325 [(set_attr "itanium_class" "ialu,ialu,ld,st,frfr,tofr,fmisc")
326 (set_attr "speculable1" "yes")
327 (set_attr "speculable2" "no, no, yes,no,no, no, no")])
329 (define_expand "movhi"
330 [(set (match_operand:HI 0 "general_operand" "")
331 (match_operand:HI 1 "general_operand" ""))]
334 rtx op1 = ia64_expand_move (operands[0], operands[1]);
340 (define_insn "movhi_internal"
341 [(set (match_operand:HI 0 "destination_operand" "=r,r,r, m, r,*f,*f")
342 (match_operand:HI 1 "move_operand" "rO,J,m,rO,*f,rO,*f"))]
343 "ia64_move_ok (operands[0], operands[1])"
352 [(set_attr "itanium_class" "ialu,ialu,ld,st,frfr,tofr,fmisc")
353 (set_attr "speculable1" "yes")
354 (set_attr "speculable2" "no, no, yes,no,no, no, no")])
356 (define_expand "movsi"
357 [(set (match_operand:SI 0 "general_operand" "")
358 (match_operand:SI 1 "general_operand" ""))]
361 rtx op1 = ia64_expand_move (operands[0], operands[1]);
367 (define_insn "movsi_internal"
368 [(set (match_operand:SI 0 "destination_operand" "=r,r,r,r,r, m, r,*f,*f, r,*d")
369 (match_operand:SI 1 "move_operand" "rO,J,j,i,m,rO,*f,rO,*f,*d,rK"))]
370 "ia64_move_ok (operands[0], operands[1])"
374 addp4 %0 = %1 - 0x100000000, r0
383 ;; frar_m, toar_m ??? why not frar_i and toar_i
384 [(set_attr "itanium_class" "ialu,ialu,ialu,long_i,ld,st,frfr,tofr,fmisc,frar_m,toar_m")
385 (set_attr "speculable1" "yes")
386 (set_attr "speculable2" "no, no, no, no, yes,no,no, no, no, no, no")])
388 (define_expand "movdi"
389 [(set (match_operand:DI 0 "general_operand" "")
390 (match_operand:DI 1 "general_operand" ""))]
393 rtx op1 = ia64_expand_move (operands[0], operands[1]);
399 (define_insn "movdi_internal"
400 [(set (match_operand:DI 0 "destination_operand"
401 "=r,r,r,r,r, m, r,*f,*f,*f, Q, r,*b, r,*e, r,*d, r,*c")
402 (match_operand:DI 1 "move_operand"
403 "rO,JT,j,i,m,rO,*f,rO,*f, Q,*f,*b,rO,*e,rK,*d,rK,*c,rO"))]
404 "ia64_move_ok (operands[0], operands[1])"
406 static const char * const alt[] = {
408 "%,addl %0 = %1, r0",
409 "%,addp4 %0 = %1 - 0x100000000, r0",
411 "%,ld8%O1 %0 = %1%P1",
412 "%,st8%Q0 %0 = %r1%P0",
413 "%,getf.sig %0 = %1",
414 "%,setf.sig %0 = %r1",
428 gcc_assert (which_alternative != 2 || TARGET_NO_PIC
429 || !symbolic_operand (operands[1], VOIDmode));
431 return alt[which_alternative];
433 [(set_attr "itanium_class" "ialu,ialu,ialu,long_i,ld,st,frfr,tofr,fmisc,fld,stf,frbr,tobr,frar_i,toar_i,frar_m,toar_m,frpr,topr")
434 (set_attr "speculable1" "yes")
435 (set_attr "speculable2" "no, no, no, no, yes,no,no, no, no, yes,no, no, no, no, no, no, no, no, no")])
437 (define_mode_iterator MODE [BI QI HI SI DI SF DF XF TI])
438 (define_mode_iterator MODE_FOR_CMP [BI SI DI SF DF XF (TF "TARGET_HPUX")])
439 (define_mode_iterator MODE_FOR_EXTEND [QI HI SI])
441 (define_mode_attr output_a [
442 (BI "ld1.a %0 = %1%P1")
443 (QI "ld1.a %0 = %1%P1")
444 (HI "ld2.a %0 = %1%P1")
445 (SI "ld4.a %0 = %1%P1")
458 (XF "ldfe.a %0 = %1%P1")
459 (TI "ldfp8.a %X0 = %1%P1")])
461 (define_mode_attr output_s [
462 (BI "ld1.s %0 = %1%P1")
463 (QI "ld1.s %0 = %1%P1")
464 (HI "ld2.s %0 = %1%P1")
465 (SI "ld4.s %0 = %1%P1")
478 (XF "ldfe.s %0 = %1%P1")
479 (TI "ldfp8.s %X0 = %1%P1")])
481 (define_mode_attr output_sa [
482 (BI "ld1.sa %0 = %1%P1")
483 (QI "ld1.sa %0 = %1%P1")
484 (HI "ld2.sa %0 = %1%P1")
485 (SI "ld4.sa %0 = %1%P1")
498 (XF "ldfe.sa %0 = %1%P1")
499 (TI "ldfp8.sa %X0 = %1%P1")])
501 (define_mode_attr output_c_clr [
502 (BI "ld1.c.clr%O1 %0 = %1%P1")
503 (QI "ld1.c.clr%O1 %0 = %1%P1")
504 (HI "ld2.c.clr%O1 %0 = %1%P1")
505 (SI "ld4.c.clr%O1 %0 = %1%P1")
508 ld8.c.clr%O1 %0 = %1%P1
509 ldf8.c.clr %0 = %1%P1")
512 ldfs.c.clr %0 = %1%P1
513 ld4.c.clr%O1 %0 = %1%P1")
516 ldfd.c.clr %0 = %1%P1
517 ld8.c.clr%O1 %0 = %1%P1")
518 (XF "ldfe.c.clr %0 = %1%P1")
519 (TI "ldfp8.c.clr %X0 = %1%P1")])
521 (define_mode_attr output_c_nc [
522 (BI "ld1.c.nc%O1 %0 = %1%P1")
523 (QI "ld1.c.nc%O1 %0 = %1%P1")
524 (HI "ld2.c.nc%O1 %0 = %1%P1")
525 (SI "ld4.c.nc%O1 %0 = %1%P1")
528 ld8.c.nc%O1 %0 = %1%P1
529 ldf8.c.nc %0 = %1%P1")
533 ld4.c.nc%O1 %0 = %1%P1")
537 ld8.c.nc%O1 %0 = %1%P1")
538 (XF "ldfe.c.nc %0 = %1%P1")
539 (TI "ldfp8.c.nc %X0 = %1%P1")])
541 (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")])
542 (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")])
543 (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")])
545 (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")])
547 ;; Define register predicate prefix.
548 ;; We can generate speculative loads only for general and fp registers - this
549 ;; is constrained in ia64.c: ia64_speculate_insn ().
550 (define_mode_attr reg_pred_prefix [(BI "gr") (QI "gr") (HI "gr") (SI "gr") (DI "grfr") (SF "grfr") (DF "grfr") (XF "fr") (TI "fr")])
552 (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")])
553 (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")])
554 (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")])
556 (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")])
558 (define_insn "mov<mode>_advanced"
559 [(set (match_operand:MODE 0 "<reg_pred_prefix>_register_operand" "<ld_reg_constr>")
560 (unspec:MODE [(match_operand:MODE 1 "memory_operand" "<mem_constr>")] UNSPEC_LDA))]
561 "ia64_move_ok (operands[0], operands[1])"
563 [(set_attr "itanium_class" "<ld_class>")
564 (set_attr "data_speculative" "<attr_yes>")])
566 (define_insn "zero_extend<mode>di2_advanced"
567 [(set (match_operand:DI 0 "gr_register_operand" "=r")
568 (zero_extend:DI (unspec:MODE_FOR_EXTEND [(match_operand:MODE_FOR_EXTEND 1 "memory_operand" "<mem_constr>")] UNSPEC_LDA)))]
571 [(set_attr "itanium_class" "<ld_class>")
572 (set_attr "data_speculative" "<attr_yes>")])
574 (define_insn "mov<mode>_speculative"
575 [(set (match_operand:MODE 0 "<reg_pred_prefix>_register_operand" "<ld_reg_constr>")
576 (unspec:MODE [(match_operand:MODE 1 "memory_operand" "<mem_constr>")] UNSPEC_LDS))]
577 "ia64_move_ok (operands[0], operands[1])"
579 [(set_attr "itanium_class" "<ld_class>")
580 (set_attr "control_speculative" "<attr_yes>")])
582 (define_insn "zero_extend<mode>di2_speculative"
583 [(set (match_operand:DI 0 "gr_register_operand" "=r")
584 (zero_extend:DI (unspec:MODE_FOR_EXTEND [(match_operand:MODE_FOR_EXTEND 1 "memory_operand" "<mem_constr>")] UNSPEC_LDS)))]
587 [(set_attr "itanium_class" "<ld_class>")
588 (set_attr "control_speculative" "<attr_yes>")])
590 (define_insn "mov<mode>_speculative_advanced"
591 [(set (match_operand:MODE 0 "<reg_pred_prefix>_register_operand" "<ld_reg_constr>")
592 (unspec:MODE [(match_operand:MODE 1 "memory_operand" "<mem_constr>")] UNSPEC_LDSA))]
593 "ia64_move_ok (operands[0], operands[1])"
595 [(set_attr "itanium_class" "<ld_class>")
596 (set_attr "data_speculative" "<attr_yes>")
597 (set_attr "control_speculative" "<attr_yes>")])
599 (define_insn "mov<mode>_speculative_a"
600 [(set (match_operand:MODE 0 "<reg_pred_prefix>_register_operand" "<ld_reg_constr>")
601 (unspec:MODE [(match_operand:MODE 1 "memory_operand" "<mem_constr>")] UNSPEC_LDS_A))]
602 "ia64_move_ok (operands[0], operands[1])"
604 [(set_attr "itanium_class" "<ld_class>")
605 (set_attr "data_speculative" "<attr_yes>")
606 (set_attr "control_speculative" "<attr_yes>")])
608 (define_insn "zero_extend<mode>di2_speculative_advanced"
609 [(set (match_operand:DI 0 "gr_register_operand" "=r")
610 (zero_extend:DI (unspec:MODE_FOR_EXTEND [(match_operand:MODE_FOR_EXTEND 1 "memory_operand" "<mem_constr>")] UNSPEC_LDSA)))]
613 [(set_attr "itanium_class" "<ld_class>")
614 (set_attr "data_speculative" "<attr_yes>")
615 (set_attr "control_speculative" "<attr_yes>")])
617 (define_insn "zero_extend<mode>di2_speculative_a"
618 [(set (match_operand:DI 0 "gr_register_operand" "=r")
619 (zero_extend:DI (unspec:MODE_FOR_EXTEND [(match_operand:MODE_FOR_EXTEND 1 "memory_operand" "<mem_constr>")] UNSPEC_LDS_A)))]
622 [(set_attr "itanium_class" "<ld_class>")
623 (set_attr "data_speculative" "<attr_yes>")
624 (set_attr "control_speculative" "<attr_yes>")])
626 (define_insn "mov<mode>_clr"
627 [(set (match_operand:MODE 0 "<reg_pred_prefix>_register_operand" "<ldc_reg_constr>")
628 (if_then_else:MODE (ne (unspec [(match_dup 0)] UNSPEC_LDCCLR) (const_int 0))
629 (match_operand:MODE 1 "memory_operand" "<mem_constr>")
631 "ia64_move_ok (operands[0], operands[1])"
633 [(set_attr "itanium_class" "<ld_class>")
634 (set_attr "check_load" "<attr_yes>")])
636 (define_insn "mov<mode>_nc"
637 [(set (match_operand:MODE 0 "<reg_pred_prefix>_register_operand" "<ldc_reg_constr>")
638 (if_then_else:MODE (ne (unspec [(match_dup 0)] UNSPEC_LDCNC) (const_int 0))
639 (match_operand:MODE 1 "memory_operand" "<mem_constr>")
641 "ia64_move_ok (operands[0], operands[1])"
643 [(set_attr "itanium_class" "<ld_class>")
644 (set_attr "check_load" "<attr_yes>")])
646 (define_insn "zero_extend<mode>di2_clr"
647 [(set (match_operand:DI 0 "gr_register_operand" "+r")
648 (if_then_else:DI (ne (unspec [(match_dup 0)] UNSPEC_LDCCLR) (const_int 0))
649 (zero_extend:DI (match_operand:MODE_FOR_EXTEND 1 "memory_operand" "<mem_constr>"))
653 [(set_attr "itanium_class" "<ld_class>")
654 (set_attr "check_load" "<attr_yes>")])
656 (define_insn "zero_extend<mode>di2_nc"
657 [(set (match_operand:DI 0 "gr_register_operand" "+r")
658 (if_then_else:DI (ne (unspec [(match_dup 0)] UNSPEC_LDCNC) (const_int 0))
659 (zero_extend:DI (match_operand:MODE_FOR_EXTEND 1 "memory_operand" "<mem_constr>"))
663 [(set_attr "itanium_class" "<ld_class>")
664 (set_attr "check_load" "<attr_yes>")])
666 (define_insn "advanced_load_check_clr_<mode>"
668 (if_then_else (ne (unspec [(match_operand:MODE 0 "<reg_pred_prefix>_register_operand" "<chk_reg_constr>")] UNSPEC_CHKACLR) (const_int 0))
670 (label_ref (match_operand 1 "" ""))))]
673 [(set_attr "itanium_class" "<chka_class>")])
675 (define_insn "advanced_load_check_nc_<mode>"
677 (if_then_else (ne (unspec [(match_operand:MODE 0 "<reg_pred_prefix>_register_operand" "<chk_reg_constr>")] UNSPEC_CHKANC) (const_int 0))
679 (label_ref (match_operand 1 "" ""))))]
682 [(set_attr "itanium_class" "<chka_class>")])
684 (define_insn "speculation_check_<mode>"
686 (if_then_else (ne (unspec [(match_operand:MODE 0 "<reg_pred_prefix>_register_operand" "<chk_reg_constr>")] UNSPEC_CHKS) (const_int 0))
688 (label_ref (match_operand 1 "" ""))))]
691 [(set_attr "itanium_class" "<chks_class>")])
694 [(set (match_operand 0 "register_operand" "")
695 (match_operand 1 "symbolic_operand" ""))]
699 if (ia64_expand_load_address (operands[0], operands[1]))
705 (define_expand "load_fptr"
706 [(set (match_operand:DI 0 "register_operand" "")
707 (plus:DI (match_dup 2) (match_operand 1 "function_operand" "")))
708 (set (match_dup 0) (match_dup 3))]
711 operands[2] = pic_offset_table_rtx;
712 operands[3] = gen_const_mem (DImode, operands[0]);
715 (define_insn "*load_fptr_internal1"
716 [(set (match_operand:DI 0 "register_operand" "=r")
717 (plus:DI (reg:DI 1) (match_operand 1 "function_operand" "s")))]
719 "addl %0 = @ltoff(@fptr(%1)), gp"
720 [(set_attr "itanium_class" "ialu")])
722 (define_insn "load_gprel"
723 [(set (match_operand:DI 0 "register_operand" "=r")
724 (plus:DI (reg:DI 1) (match_operand 1 "sdata_symbolic_operand" "s")))]
726 "addl %0 = @gprel(%1), gp"
727 [(set_attr "itanium_class" "ialu")])
729 (define_insn "*gprel64_offset"
730 [(set (match_operand:DI 0 "register_operand" "=r")
731 (minus:DI (match_operand:DI 1 "symbolic_operand" "") (reg:DI 1)))]
733 "movl %0 = @gprel(%1)"
734 [(set_attr "itanium_class" "long_i")])
736 (define_expand "load_gprel64"
737 [(set (match_operand:DI 0 "register_operand" "")
738 (minus:DI (match_operand:DI 1 "symbolic_operand" "") (match_dup 2)))
740 (plus:DI (match_dup 2) (match_dup 0)))]
743 operands[2] = pic_offset_table_rtx;
746 ;; This is used as a placeholder for the return address during early
747 ;; compilation. We won't know where we've placed this until during
748 ;; reload, at which point it can wind up in b0, a general register,
749 ;; or memory. The only safe destination under these conditions is a
752 (define_insn_and_split "*movdi_ret_addr"
753 [(set (match_operand:DI 0 "register_operand" "=r")
754 (unspec:DI [(const_int 0)] UNSPEC_RET_ADDR))]
760 ia64_split_return_addr_rtx (operands[0]);
763 [(set_attr "itanium_class" "ialu")])
765 (define_insn "*load_symptr_high"
766 [(set (match_operand:DI 0 "register_operand" "=r")
767 (plus:DI (high:DI (match_operand 1 "got_symbolic_operand" "s"))
768 (match_operand:DI 2 "register_operand" "a")))]
771 if (HAVE_AS_LTOFFX_LDXMOV_RELOCS)
772 return "%,addl %0 = @ltoffx(%1), %2";
774 return "%,addl %0 = @ltoff(%1), %2";
776 [(set_attr "itanium_class" "ialu")])
778 (define_insn "*load_symptr_low"
779 [(set (match_operand:DI 0 "register_operand" "=r")
780 (lo_sum:DI (mem:DI (match_operand:DI 1 "register_operand" "r"))
781 (match_operand 2 "got_symbolic_operand" "s")))]
784 if (HAVE_AS_LTOFFX_LDXMOV_RELOCS)
785 return "%,ld8.mov %0 = [%1], %2";
787 return "%,ld8 %0 = [%1]";
789 [(set_attr "itanium_class" "ld")])
791 (define_insn_and_split "load_dtpmod"
792 [(set (match_operand:DI 0 "register_operand" "=r")
793 (unspec:DI [(match_operand 1 "tls_symbolic_operand" "")]
799 (plus:DI (unspec:DI [(match_dup 1)] UNSPEC_LTOFF_DTPMOD)
801 (set (match_dup 0) (match_dup 3))]
803 operands[2] = pic_offset_table_rtx;
804 operands[3] = gen_const_mem (DImode, operands[0]);
807 (define_insn "*load_ltoff_dtpmod"
808 [(set (match_operand:DI 0 "register_operand" "=r")
809 (plus:DI (unspec:DI [(match_operand 1 "tls_symbolic_operand" "")]
811 (match_operand:DI 2 "register_operand" "a")))]
813 "addl %0 = @ltoff(@dtpmod(%1)), %2"
814 [(set_attr "itanium_class" "ialu")])
816 (define_expand "load_dtprel"
817 [(set (match_operand:DI 0 "register_operand" "")
818 (unspec:DI [(match_operand 1 "tls_symbolic_operand" "")]
823 (define_insn "*load_dtprel64"
824 [(set (match_operand:DI 0 "register_operand" "=r")
825 (unspec:DI [(match_operand 1 "ld_tls_symbolic_operand" "")]
828 "movl %0 = @dtprel(%1)"
829 [(set_attr "itanium_class" "long_i")])
831 (define_insn "*load_dtprel22"
832 [(set (match_operand:DI 0 "register_operand" "=r")
833 (unspec:DI [(match_operand 1 "ld_tls_symbolic_operand" "")]
836 "addl %0 = @dtprel(%1), r0"
837 [(set_attr "itanium_class" "ialu")])
839 (define_insn_and_split "*load_dtprel_gd"
840 [(set (match_operand:DI 0 "register_operand" "=r")
841 (unspec:DI [(match_operand 1 "tls_symbolic_operand" "")]
847 (plus:DI (unspec:DI [(match_dup 1)] UNSPEC_LTOFF_DTPREL)
849 (set (match_dup 0) (match_dup 3))]
851 operands[2] = pic_offset_table_rtx;
852 operands[3] = gen_const_mem (DImode, operands[0]);
855 (define_insn "*load_ltoff_dtprel"
856 [(set (match_operand:DI 0 "register_operand" "=r")
857 (plus:DI (unspec:DI [(match_operand 1 "tls_symbolic_operand" "")]
859 (match_operand:DI 2 "register_operand" "a")))]
861 "addl %0 = @ltoff(@dtprel(%1)), %2"
862 [(set_attr "itanium_class" "ialu")])
864 (define_expand "add_dtprel"
865 [(set (match_operand:DI 0 "register_operand" "")
866 (plus:DI (unspec:DI [(match_operand 1 "ld_tls_symbolic_operand" "")]
868 (match_operand:DI 2 "register_operand" "")))]
872 (define_insn "*add_dtprel14"
873 [(set (match_operand:DI 0 "register_operand" "=r")
874 (plus:DI (unspec:DI [(match_operand 1 "ld_tls_symbolic_operand" "")]
876 (match_operand:DI 2 "register_operand" "r")))]
878 "adds %0 = @dtprel(%1), %2"
879 [(set_attr "itanium_class" "ialu")])
881 (define_insn "*add_dtprel22"
882 [(set (match_operand:DI 0 "register_operand" "=r")
883 (plus:DI (unspec:DI [(match_operand 1 "ld_tls_symbolic_operand" "")]
885 (match_operand:DI 2 "register_operand" "a")))]
887 "addl %0 = @dtprel(%1), %2"
888 [(set_attr "itanium_class" "ialu")])
890 (define_expand "load_tprel"
891 [(set (match_operand:DI 0 "register_operand" "")
892 (unspec:DI [(match_operand 1 "tls_symbolic_operand" "")]
897 (define_insn "*load_tprel64"
898 [(set (match_operand:DI 0 "register_operand" "=r")
899 (unspec:DI [(match_operand 1 "le_tls_symbolic_operand" "")]
902 "movl %0 = @tprel(%1)"
903 [(set_attr "itanium_class" "long_i")])
905 (define_insn "*load_tprel22"
906 [(set (match_operand:DI 0 "register_operand" "=r")
907 (unspec:DI [(match_operand 1 "le_tls_symbolic_operand" "")]
910 "addl %0 = @tprel(%1), r0"
911 [(set_attr "itanium_class" "ialu")])
913 (define_insn_and_split "*load_tprel_ie"
914 [(set (match_operand:DI 0 "register_operand" "=r")
915 (unspec:DI [(match_operand 1 "ie_tls_symbolic_operand" "")]
921 (plus:DI (unspec:DI [(match_dup 1)] UNSPEC_LTOFF_TPREL)
923 (set (match_dup 0) (match_dup 3))]
925 operands[2] = pic_offset_table_rtx;
926 operands[3] = gen_const_mem (DImode, operands[0]);
929 (define_insn "*load_ltoff_tprel"
930 [(set (match_operand:DI 0 "register_operand" "=r")
931 (plus:DI (unspec:DI [(match_operand 1 "ie_tls_symbolic_operand" "")]
933 (match_operand:DI 2 "register_operand" "a")))]
935 "addl %0 = @ltoff(@tprel(%1)), %2"
936 [(set_attr "itanium_class" "ialu")])
938 (define_expand "add_tprel"
939 [(set (match_operand:DI 0 "register_operand" "")
940 (plus:DI (unspec:DI [(match_operand 1 "le_tls_symbolic_operand" "")]
942 (match_operand:DI 2 "register_operand" "")))]
946 (define_insn "*add_tprel14"
947 [(set (match_operand:DI 0 "register_operand" "=r")
948 (plus:DI (unspec:DI [(match_operand 1 "le_tls_symbolic_operand" "")]
950 (match_operand:DI 2 "register_operand" "r")))]
952 "adds %0 = @tprel(%1), %2"
953 [(set_attr "itanium_class" "ialu")])
955 (define_insn "*add_tprel22"
956 [(set (match_operand:DI 0 "register_operand" "=r")
957 (plus:DI (unspec:DI [(match_operand 1 "le_tls_symbolic_operand" "")]
959 (match_operand:DI 2 "register_operand" "a")))]
961 "addl %0 = @tprel(%1), %2"
962 [(set_attr "itanium_class" "ialu")])
964 ;; With no offsettable memory references, we've got to have a scratch
965 ;; around to play with the second word. However, in order to avoid a
966 ;; reload nightmare we lie, claim we don't need one, and fix it up
967 ;; in ia64_split_tmode_move.
968 (define_expand "movti"
969 [(set (match_operand:TI 0 "general_operand" "")
970 (match_operand:TI 1 "general_operand" ""))]
973 rtx op1 = ia64_expand_move (operands[0], operands[1]);
979 (define_insn_and_split "movti_internal"
980 [(set (match_operand:TI 0 "destination_operand" "=r, *fm,*x,*f, Q")
981 (match_operand:TI 1 "general_operand" "r*fim,r, Q, *fOQ,*f"))]
982 "ia64_move_ok (operands[0], operands[1])"
989 "reload_completed && !ia64_load_pair_ok(operands[0], operands[1])"
992 ia64_split_tmode_move (operands);
995 [(set_attr "itanium_class" "unknown,unknown,fldp,unknown,unknown")
996 (set_attr "speculable1" "yes")
997 (set_attr "speculable2" "no, no, yes, no, no")])
999 ;; Floating Point Moves
1001 ;; Note - Patterns for SF mode moves are compulsory, but
1002 ;; patterns for DF are optional, as GCC can synthesize them.
1004 (define_expand "movsf"
1005 [(set (match_operand:SF 0 "general_operand" "")
1006 (match_operand:SF 1 "general_operand" ""))]
1009 rtx op1 = ia64_expand_move (operands[0], operands[1]);
1015 (define_insn "movsf_internal"
1016 [(set (match_operand:SF 0 "destination_operand" "=f,f, Q,*r, f,*r,*r, m,*r")
1017 (match_operand:SF 1 "general_operand" "fG,Q,fG,fG,*r,*r, m,*r, F"))]
1018 "ia64_move_ok (operands[0], operands[1])"
1029 [(set_attr "itanium_class" "fmisc,fld,stf,frfr,tofr,ialu,ld,st,long_i")
1030 (set_attr "speculable1" "yes")
1031 (set_attr "speculable2" "no, yes,no, no, no, no, yes,no,no")])
1033 (define_expand "movdf"
1034 [(set (match_operand:DF 0 "general_operand" "")
1035 (match_operand:DF 1 "general_operand" ""))]
1038 rtx op1 = ia64_expand_move (operands[0], operands[1]);
1044 (define_insn "movdf_internal"
1045 [(set (match_operand:DF 0 "destination_operand" "=f,f, Q,*r, f,*r,*r, m,*r")
1046 (match_operand:DF 1 "general_operand" "fG,Q,fG,fG,*r,*r, m,*r, F"))]
1047 "ia64_move_ok (operands[0], operands[1])"
1058 [(set_attr "itanium_class" "fmisc,fld,stf,frfr,tofr,ialu,ld,st,long_i")
1059 (set_attr "speculable1" "yes")
1060 (set_attr "speculable2" "no, yes,no, no, no, no, yes,no,no")])
1062 ;; With no offsettable memory references, we've got to have a scratch
1063 ;; around to play with the second word if the variable winds up in GRs.
1064 (define_expand "movxf"
1065 [(set (match_operand:XF 0 "general_operand" "")
1066 (match_operand:XF 1 "general_operand" ""))]
1069 if (ia64_expand_movxf_movrf (XFmode, operands))
1073 ;; ??? There's no easy way to mind volatile acquire/release semantics.
1075 (define_insn "movxf_internal"
1076 [(set (match_operand:XF 0 "destination_operand" "=f,f, m")
1077 (match_operand:XF 1 "general_operand" "fG,m,fG"))]
1078 "ia64_move_ok (operands[0], operands[1])"
1083 [(set_attr "itanium_class" "fmisc,fld,stf")
1084 (set_attr "speculable1" "yes")
1085 (set_attr "speculable2" "no, yes,no")])
1087 ;; Same as for movxf, but for RFmode.
1088 (define_expand "movrf"
1089 [(set (match_operand:RF 0 "general_operand" "")
1090 (match_operand:RF 1 "general_operand" ""))]
1093 if (ia64_expand_movxf_movrf (RFmode, operands))
1097 (define_insn "*movrf_internal"
1098 [(set (match_operand:RF 0 "destination_operand" "=f,f, m")
1099 (match_operand:RF 1 "general_operand" "fG,m,fG"))]
1100 "ia64_move_ok (operands[0], operands[1])"
1104 stf.spill %0 = %F1%P0"
1105 [(set_attr "itanium_class" "fmisc,fld,stf")])
1107 ;; Better code generation via insns that deal with TFmode register pairs
1108 ;; directly. Same concerns apply as for TImode.
1109 (define_expand "movtf"
1110 [(set (match_operand:TF 0 "general_operand" "")
1111 (match_operand:TF 1 "general_operand" ""))]
1114 rtx op1 = ia64_expand_move (operands[0], operands[1]);
1120 (define_insn_and_split "*movtf_internal"
1121 [(set (match_operand:TF 0 "destination_operand" "=r,r,m")
1122 (match_operand:TF 1 "general_operand" "ri,m,r"))]
1123 "ia64_move_ok (operands[0], operands[1])"
1128 ia64_split_tmode_move (operands);
1131 [(set_attr "itanium_class" "unknown")
1132 (set_attr "predicable" "no")])
1135 ;; ::::::::::::::::::::
1139 ;; ::::::::::::::::::::
1141 ;; Signed conversions from a smaller integer to a larger integer
1143 (define_insn "extendqidi2"
1144 [(set (match_operand:DI 0 "gr_register_operand" "=r")
1145 (sign_extend:DI (match_operand:QI 1 "gr_register_operand" "r")))]
1148 [(set_attr "itanium_class" "xtd")])
1150 (define_insn "extendhidi2"
1151 [(set (match_operand:DI 0 "gr_register_operand" "=r")
1152 (sign_extend:DI (match_operand:HI 1 "gr_register_operand" "r")))]
1155 [(set_attr "itanium_class" "xtd")])
1157 (define_insn "extendsidi2"
1158 [(set (match_operand:DI 0 "grfr_register_operand" "=r,?f")
1159 (sign_extend:DI (match_operand:SI 1 "grfr_register_operand" "r,f")))]
1164 [(set_attr "itanium_class" "xtd,fmisc")])
1166 ;; Unsigned conversions from a smaller integer to a larger integer
1168 (define_insn "zero_extendqidi2"
1169 [(set (match_operand:DI 0 "gr_register_operand" "=r,r")
1170 (zero_extend:DI (match_operand:QI 1 "gr_nonimmediate_operand" "r,m")))]
1175 [(set_attr "itanium_class" "xtd,ld")
1176 (set_attr "speculable1" "yes")
1177 (set_attr "speculable2" "no, yes")])
1179 (define_insn "zero_extendhidi2"
1180 [(set (match_operand:DI 0 "gr_register_operand" "=r,r")
1181 (zero_extend:DI (match_operand:HI 1 "gr_nonimmediate_operand" "r,m")))]
1186 [(set_attr "itanium_class" "xtd,ld")
1187 (set_attr "speculable1" "yes")
1188 (set_attr "speculable2" "no, yes")])
1190 (define_insn "zero_extendsidi2"
1191 [(set (match_operand:DI 0 "grfr_register_operand" "=r,r,?f")
1193 (match_operand:SI 1 "grfr_nonimmediate_operand" "r,m,f")))]
1199 [(set_attr "itanium_class" "ialu,ld,fmisc")
1200 (set_attr "speculable1" "yes")
1201 (set_attr "speculable2" "no, yes,no")])
1203 ;; Convert between floating point types of different sizes.
1205 ;; At first glance, it would appear that emitting fnorm for an extending
1206 ;; conversion is unnecessary. However, the stf and getf instructions work
1207 ;; correctly only if the input is properly rounded for its type. In
1208 ;; particular, we get the wrong result for getf.d/stfd if the input is a
1209 ;; denorm single. Since we don't know what the next instruction will be, we
1210 ;; have to emit an fnorm.
1212 ;; ??? Optimization opportunity here. Get rid of the insn altogether
1213 ;; when we can. Should probably use a scheme like has been proposed
1214 ;; for ia32 in dealing with operands that match unary operators. This
1215 ;; would let combine merge the thing into adjacent insns. See also how the
1216 ;; mips port handles SIGN_EXTEND as operands to integer arithmetic insns via
1217 ;; se_register_operand.
1219 (define_insn "extendsfdf2"
1220 [(set (match_operand:DF 0 "fr_register_operand" "=f")
1221 (float_extend:DF (match_operand:SF 1 "fr_reg_or_fp01_operand" "fG")))]
1224 [(set_attr "itanium_class" "fmac")])
1226 (define_insn "extendsfxf2"
1227 [(set (match_operand:XF 0 "fr_register_operand" "=f")
1228 (float_extend:XF (match_operand:SF 1 "fr_reg_or_fp01_operand" "fG")))]
1231 [(set_attr "itanium_class" "fmac")])
1233 (define_insn "extenddfxf2"
1234 [(set (match_operand:XF 0 "fr_register_operand" "=f")
1235 (float_extend:XF (match_operand:DF 1 "fr_reg_or_fp01_operand" "fG")))]
1238 [(set_attr "itanium_class" "fmac")])
1240 (define_insn "truncdfsf2"
1241 [(set (match_operand:SF 0 "fr_register_operand" "=f")
1242 (float_truncate:SF (match_operand:DF 1 "fr_reg_or_fp01_operand" "fG")))]
1245 [(set_attr "itanium_class" "fmac")])
1247 (define_insn "truncxfsf2"
1248 [(set (match_operand:SF 0 "fr_register_operand" "=f")
1249 (float_truncate:SF (match_operand:XF 1 "fr_reg_or_fp01_operand" "fG")))]
1252 [(set_attr "itanium_class" "fmac")])
1254 (define_insn "truncxfdf2"
1255 [(set (match_operand:DF 0 "fr_register_operand" "=f")
1256 (float_truncate:DF (match_operand:XF 1 "fr_reg_or_fp01_operand" "fG")))]
1259 [(set_attr "itanium_class" "fmac")])
1261 ;; Convert between signed integer types and floating point.
1263 (define_insn "floatdirf2"
1264 [(set (match_operand:RF 0 "fr_register_operand" "=f")
1265 (float:RF (match_operand:DI 1 "fr_reg_or_fp01_operand" "fG")))]
1268 [(set_attr "itanium_class" "fcvtfx")])
1270 (define_insn "floatdixf2"
1271 [(set (match_operand:XF 0 "fr_register_operand" "=f")
1272 (float:XF (match_operand:DI 1 "fr_reg_or_fp01_operand" "fG")))]
1275 [(set_attr "itanium_class" "fcvtfx")])
1277 (define_insn "fix_truncsfdi2"
1278 [(set (match_operand:DI 0 "fr_register_operand" "=f")
1279 (fix:DI (match_operand:SF 1 "fr_reg_or_fp01_operand" "fG")))]
1281 "fcvt.fx.trunc %0 = %F1"
1282 [(set_attr "itanium_class" "fcvtfx")])
1284 (define_insn "fix_truncdfdi2"
1285 [(set (match_operand:DI 0 "fr_register_operand" "=f")
1286 (fix:DI (match_operand:DF 1 "fr_reg_or_fp01_operand" "fG")))]
1288 "fcvt.fx.trunc %0 = %F1"
1289 [(set_attr "itanium_class" "fcvtfx")])
1291 (define_insn "fix_truncxfdi2"
1292 [(set (match_operand:DI 0 "fr_register_operand" "=f")
1293 (fix:DI (match_operand:XF 1 "fr_reg_or_fp01_operand" "fG")))]
1295 "fcvt.fx.trunc %0 = %F1"
1296 [(set_attr "itanium_class" "fcvtfx")])
1298 (define_insn "fix_truncrfdi2"
1299 [(set (match_operand:DI 0 "fr_register_operand" "=f")
1300 (fix:DI (match_operand:RF 1 "fr_reg_or_fp01_operand" "fG")))]
1302 "fcvt.fx.trunc %0 = %F1"
1303 [(set_attr "itanium_class" "fcvtfx")])
1305 ;; Convert between unsigned integer types and floating point.
1307 (define_insn "floatunsdisf2"
1308 [(set (match_operand:SF 0 "fr_register_operand" "=f")
1309 (unsigned_float:SF (match_operand:DI 1 "fr_reg_or_fp01_operand" "fG")))]
1311 "fcvt.xuf.s %0 = %F1"
1312 [(set_attr "itanium_class" "fcvtfx")])
1314 (define_insn "floatunsdidf2"
1315 [(set (match_operand:DF 0 "fr_register_operand" "=f")
1316 (unsigned_float:DF (match_operand:DI 1 "fr_reg_or_fp01_operand" "fG")))]
1318 "fcvt.xuf.d %0 = %F1"
1319 [(set_attr "itanium_class" "fcvtfx")])
1321 (define_insn "floatunsdixf2"
1322 [(set (match_operand:XF 0 "fr_register_operand" "=f")
1323 (unsigned_float:XF (match_operand:DI 1 "fr_reg_or_fp01_operand" "fG")))]
1326 [(set_attr "itanium_class" "fcvtfx")])
1328 (define_insn "floatunsdirf2"
1329 [(set (match_operand:RF 0 "fr_register_operand" "=f")
1330 (unsigned_float:RF (match_operand:DI 1 "fr_reg_or_fp01_operand" "fG")))]
1333 [(set_attr "itanium_class" "fcvtfx")])
1335 (define_insn "fixuns_truncsfdi2"
1336 [(set (match_operand:DI 0 "fr_register_operand" "=f")
1337 (unsigned_fix:DI (match_operand:SF 1 "fr_reg_or_fp01_operand" "fG")))]
1339 "fcvt.fxu.trunc %0 = %F1"
1340 [(set_attr "itanium_class" "fcvtfx")])
1342 (define_insn "fixuns_truncdfdi2"
1343 [(set (match_operand:DI 0 "fr_register_operand" "=f")
1344 (unsigned_fix:DI (match_operand:DF 1 "fr_reg_or_fp01_operand" "fG")))]
1346 "fcvt.fxu.trunc %0 = %F1"
1347 [(set_attr "itanium_class" "fcvtfx")])
1349 (define_insn "fixuns_truncxfdi2"
1350 [(set (match_operand:DI 0 "fr_register_operand" "=f")
1351 (unsigned_fix:DI (match_operand:XF 1 "fr_reg_or_fp01_operand" "fG")))]
1353 "fcvt.fxu.trunc %0 = %F1"
1354 [(set_attr "itanium_class" "fcvtfx")])
1356 (define_insn "fixuns_truncrfdi2"
1357 [(set (match_operand:DI 0 "fr_register_operand" "=f")
1358 (unsigned_fix:DI (match_operand:RF 1 "fr_reg_or_fp01_operand" "fG")))]
1360 "fcvt.fxu.trunc %0 = %F1"
1361 [(set_attr "itanium_class" "fcvtfx")])
1363 ;; ::::::::::::::::::::
1365 ;; :: Bit field extraction
1367 ;; ::::::::::::::::::::
1370 [(set (match_operand:DI 0 "gr_register_operand" "=r")
1371 (sign_extract:DI (match_operand:DI 1 "gr_register_operand" "r")
1372 (match_operand:DI 2 "extr_len_operand" "n")
1373 (match_operand:DI 3 "shift_count_operand" "M")))]
1375 "extr %0 = %1, %3, %2"
1376 [(set_attr "itanium_class" "ishf")])
1378 (define_insn "extzv"
1379 [(set (match_operand:DI 0 "gr_register_operand" "=r")
1380 (zero_extract:DI (match_operand:DI 1 "gr_register_operand" "r")
1381 (match_operand:DI 2 "extr_len_operand" "n")
1382 (match_operand:DI 3 "shift_count_operand" "M")))]
1384 "extr.u %0 = %1, %3, %2"
1385 [(set_attr "itanium_class" "ishf")])
1387 ;; Insert a bit field.
1388 ;; Can have 3 operands, source1 (inserter), source2 (insertee), dest.
1389 ;; Source1 can be 0 or -1.
1390 ;; Source2 can be 0.
1392 ;; ??? Actual dep instruction is more powerful than what these insv
1393 ;; patterns support. Unfortunately, combine is unable to create patterns
1394 ;; where source2 != dest.
1396 (define_expand "insv"
1397 [(set (zero_extract:DI (match_operand:DI 0 "gr_register_operand" "")
1398 (match_operand:DI 1 "const_int_operand" "")
1399 (match_operand:DI 2 "const_int_operand" ""))
1400 (match_operand:DI 3 "nonmemory_operand" ""))]
1403 int width = INTVAL (operands[1]);
1404 int shift = INTVAL (operands[2]);
1406 /* If operand[3] is a constant, and isn't 0 or -1, then load it into a
1408 if (! register_operand (operands[3], DImode)
1409 && operands[3] != const0_rtx && operands[3] != constm1_rtx)
1410 operands[3] = force_reg (DImode, operands[3]);
1412 /* If this is a single dep instruction, we have nothing to do. */
1413 if (! ((register_operand (operands[3], DImode) && width <= 16)
1414 || operands[3] == const0_rtx || operands[3] == constm1_rtx))
1416 /* Check for cases that can be implemented with a mix instruction. */
1417 if (width == 32 && shift == 0)
1419 /* Directly generating the mix4left instruction confuses
1420 optimize_bit_field in function.c. Since this is performing
1421 a useful optimization, we defer generation of the complicated
1422 mix4left RTL to the first splitting phase. */
1423 rtx tmp = gen_reg_rtx (DImode);
1424 emit_insn (gen_shift_mix4left (operands[0], operands[3], tmp));
1427 else if (width == 32 && shift == 32)
1429 emit_insn (gen_mix4right (operands[0], operands[3]));
1433 /* We could handle remaining cases by emitting multiple dep
1436 If we need more than two dep instructions then we lose. A 6
1437 insn sequence mov mask1,mov mask2,shl;;and,and;;or is better than
1438 mov;;dep,shr;;dep,shr;;dep. The former can be executed in 3 cycles,
1439 the latter is 6 cycles on an Itanium (TM) processor, because there is
1440 only one function unit that can execute dep and shr immed.
1442 If we only need two dep instruction, then we still lose.
1443 mov;;dep,shr;;dep is still 4 cycles. Even if we optimize away
1444 the unnecessary mov, this is still undesirable because it will be
1445 hard to optimize, and it creates unnecessary pressure on the I0
1451 /* This code may be useful for other IA-64 processors, so we leave it in
1457 emit_insn (gen_insv (operands[0], GEN_INT (16), GEN_INT (shift),
1461 tmp = gen_reg_rtx (DImode);
1462 emit_insn (gen_lshrdi3 (tmp, operands[3], GEN_INT (16)));
1465 operands[1] = GEN_INT (width);
1466 operands[2] = GEN_INT (shift);
1471 (define_insn "*insv_internal"
1472 [(set (zero_extract:DI (match_operand:DI 0 "gr_register_operand" "+r")
1473 (match_operand:DI 1 "const_int_operand" "n")
1474 (match_operand:DI 2 "const_int_operand" "n"))
1475 (match_operand:DI 3 "nonmemory_operand" "rP"))]
1476 "(gr_register_operand (operands[3], DImode) && INTVAL (operands[1]) <= 16)
1477 || operands[3] == const0_rtx || operands[3] == constm1_rtx"
1478 "dep %0 = %3, %0, %2, %1"
1479 [(set_attr "itanium_class" "ishf")])
1481 ;; Combine doesn't like to create bit-field insertions into zero.
1482 (define_insn "*shladdp4_internal"
1483 [(set (match_operand:DI 0 "gr_register_operand" "=r")
1484 (and:DI (ashift:DI (match_operand:DI 1 "gr_register_operand" "r")
1485 (match_operand:DI 2 "shladd_log2_operand" "n"))
1486 (match_operand:DI 3 "const_int_operand" "n")))]
1487 "ia64_depz_field_mask (operands[3], operands[2]) + INTVAL (operands[2]) == 32"
1488 "shladdp4 %0 = %1, %2, r0"
1489 [(set_attr "itanium_class" "ialu")])
1491 (define_insn "*depz_internal"
1492 [(set (match_operand:DI 0 "gr_register_operand" "=r")
1493 (and:DI (ashift:DI (match_operand:DI 1 "gr_register_operand" "r")
1494 (match_operand:DI 2 "const_int_operand" "M"))
1495 (match_operand:DI 3 "const_int_operand" "n")))]
1496 "satisfies_constraint_M (operands[2])
1497 && ia64_depz_field_mask (operands[3], operands[2]) > 0"
1499 operands[3] = GEN_INT (ia64_depz_field_mask (operands[3], operands[2]));
1500 return "%,dep.z %0 = %1, %2, %3";
1502 [(set_attr "itanium_class" "ishf")])
1504 (define_insn "shift_mix4left"
1505 [(set (zero_extract:DI (match_operand:DI 0 "gr_register_operand" "+r")
1506 (const_int 32) (const_int 0))
1507 (match_operand:DI 1 "gr_register_operand" "r"))
1508 (clobber (match_operand:DI 2 "gr_register_operand" "=r"))]
1511 [(set_attr "itanium_class" "unknown")])
1514 [(set (zero_extract:DI (match_operand:DI 0 "register_operand" "")
1515 (const_int 32) (const_int 0))
1516 (match_operand:DI 1 "register_operand" ""))
1517 (clobber (match_operand:DI 2 "register_operand" ""))]
1519 [(set (match_dup 3) (ashift:DI (match_dup 1) (const_int 32)))
1520 (set (zero_extract:DI (match_dup 0) (const_int 32) (const_int 0))
1521 (lshiftrt:DI (match_dup 3) (const_int 32)))]
1522 "operands[3] = operands[2];")
1524 (define_insn "*mix4left"
1525 [(set (zero_extract:DI (match_operand:DI 0 "gr_register_operand" "+r")
1526 (const_int 32) (const_int 0))
1527 (lshiftrt:DI (match_operand:DI 1 "gr_register_operand" "r")
1530 "mix4.l %0 = %0, %r1"
1531 [(set_attr "itanium_class" "mmshf")])
1533 (define_insn "mix4right"
1534 [(set (zero_extract:DI (match_operand:DI 0 "gr_register_operand" "+r")
1535 (const_int 32) (const_int 32))
1536 (match_operand:DI 1 "gr_reg_or_0_operand" "rO"))]
1538 "mix4.r %0 = %r1, %0"
1539 [(set_attr "itanium_class" "mmshf")])
1541 ;; This is used by the rotrsi3 pattern.
1543 (define_insn "*mix4right_3op"
1544 [(set (match_operand:DI 0 "gr_register_operand" "=r")
1545 (ior:DI (zero_extend:DI (match_operand:SI 1 "gr_register_operand" "r"))
1546 (ashift:DI (zero_extend:DI
1547 (match_operand:SI 2 "gr_register_operand" "r"))
1550 "mix4.r %0 = %2, %1"
1551 [(set_attr "itanium_class" "mmshf")])
1554 ;; ::::::::::::::::::::
1556 ;; :: 1-bit Integer arithmetic
1558 ;; ::::::::::::::::::::
1560 (define_insn_and_split "andbi3"
1561 [(set (match_operand:BI 0 "register_operand" "=c,c,r")
1562 (and:BI (match_operand:BI 1 "register_operand" "%0,0,r")
1563 (match_operand:BI 2 "register_operand" "c,r,r")))]
1567 tbit.nz.and.orcm %0, %I0 = %2, 0
1570 && GET_CODE (operands[0]) == REG && PR_REGNO_P (REGNO (operands[0]))
1571 && GET_CODE (operands[2]) == REG && PR_REGNO_P (REGNO (operands[2]))"
1572 [(cond_exec (eq (match_dup 2) (const_int 0))
1573 (set (match_dup 0) (and:BI (ne:BI (const_int 0) (const_int 0))
1576 [(set_attr "itanium_class" "unknown,tbit,ilog")])
1578 (define_insn_and_split "*andcmbi3"
1579 [(set (match_operand:BI 0 "register_operand" "=c,c,r")
1580 (and:BI (not:BI (match_operand:BI 1 "register_operand" "c,r,r"))
1581 (match_operand:BI 2 "register_operand" "0,0,r")))]
1585 tbit.z.and.orcm %0, %I0 = %1, 0
1588 && GET_CODE (operands[0]) == REG && PR_REGNO_P (REGNO (operands[0]))
1589 && GET_CODE (operands[1]) == REG && PR_REGNO_P (REGNO (operands[1]))"
1590 [(cond_exec (ne (match_dup 1) (const_int 0))
1591 (set (match_dup 0) (and:BI (ne:BI (const_int 0) (const_int 0))
1594 [(set_attr "itanium_class" "unknown,tbit,ilog")])
1596 (define_insn_and_split "iorbi3"
1597 [(set (match_operand:BI 0 "register_operand" "=c,c,r")
1598 (ior:BI (match_operand:BI 1 "register_operand" "%0,0,r")
1599 (match_operand:BI 2 "register_operand" "c,r,r")))]
1603 tbit.nz.or.andcm %0, %I0 = %2, 0
1606 && GET_CODE (operands[0]) == REG && PR_REGNO_P (REGNO (operands[0]))
1607 && GET_CODE (operands[2]) == REG && PR_REGNO_P (REGNO (operands[2]))"
1608 [(cond_exec (ne (match_dup 2) (const_int 0))
1609 (set (match_dup 0) (ior:BI (eq:BI (const_int 0) (const_int 0))
1612 [(set_attr "itanium_class" "unknown,tbit,ilog")])
1614 (define_insn_and_split "*iorcmbi3"
1615 [(set (match_operand:BI 0 "register_operand" "=c,c")
1616 (ior:BI (not:BI (match_operand:BI 1 "register_operand" "c,r"))
1617 (match_operand:BI 2 "register_operand" "0,0")))]
1621 tbit.z.or.andcm %0, %I0 = %1, 0"
1623 && GET_CODE (operands[0]) == REG && PR_REGNO_P (REGNO (operands[0]))
1624 && GET_CODE (operands[1]) == REG && PR_REGNO_P (REGNO (operands[1]))"
1625 [(cond_exec (eq (match_dup 1) (const_int 0))
1626 (set (match_dup 0) (ior:BI (eq:BI (const_int 0) (const_int 0))
1629 [(set_attr "itanium_class" "unknown,tbit")])
1631 (define_insn "one_cmplbi2"
1632 [(set (match_operand:BI 0 "register_operand" "=c,r,c,&c")
1633 (not:BI (match_operand:BI 1 "register_operand" "r,r,0,c")))
1634 (clobber (match_scratch:BI 2 "=X,X,c,X"))]
1637 tbit.z %0, %I0 = %1, 0
1641 [(set_attr "itanium_class" "tbit,ilog,unknown,unknown")])
1644 [(set (match_operand:BI 0 "register_operand" "")
1645 (not:BI (match_operand:BI 1 "register_operand" "")))
1646 (clobber (match_scratch:BI 2 ""))]
1648 && GET_CODE (operands[0]) == REG && PR_REGNO_P (REGNO (operands[0]))
1649 && rtx_equal_p (operands[0], operands[1])"
1650 [(set (match_dup 4) (match_dup 3))
1651 (set (match_dup 0) (const_int 1))
1652 (cond_exec (ne (match_dup 2) (const_int 0))
1653 (set (match_dup 0) (const_int 0)))
1654 (set (match_dup 0) (unspec:BI [(match_dup 0)] UNSPEC_PRED_REL_MUTEX))]
1655 "operands[3] = gen_rtx_REG (CCImode, REGNO (operands[1]));
1656 operands[4] = gen_rtx_REG (CCImode, REGNO (operands[2]));")
1659 [(set (match_operand:BI 0 "register_operand" "")
1660 (not:BI (match_operand:BI 1 "register_operand" "")))
1661 (clobber (match_scratch:BI 2 ""))]
1663 && GET_CODE (operands[0]) == REG && PR_REGNO_P (REGNO (operands[0]))
1664 && GET_CODE (operands[1]) == REG && PR_REGNO_P (REGNO (operands[1]))
1665 && ! rtx_equal_p (operands[0], operands[1])"
1666 [(cond_exec (ne (match_dup 1) (const_int 0))
1667 (set (match_dup 0) (const_int 0)))
1668 (cond_exec (eq (match_dup 1) (const_int 0))
1669 (set (match_dup 0) (const_int 1)))
1670 (set (match_dup 0) (unspec:BI [(match_dup 0)] UNSPEC_PRED_REL_MUTEX))]
1673 (define_insn "*cmpsi_and_0"
1674 [(set (match_operand:BI 0 "register_operand" "=c")
1675 (and:BI (match_operator:BI 4 "predicate_operator"
1676 [(match_operand:SI 2 "gr_reg_or_0_operand" "rO")
1677 (match_operand:SI 3 "gr_reg_or_8bit_operand" "rK")])
1678 (match_operand:BI 1 "register_operand" "0")))]
1680 "cmp4.%C4.and.orcm %0, %I0 = %3, %r2"
1681 [(set_attr "itanium_class" "icmp")])
1683 (define_insn "*cmpsi_and_1"
1684 [(set (match_operand:BI 0 "register_operand" "=c")
1685 (and:BI (match_operator:BI 3 "signed_inequality_operator"
1686 [(match_operand:SI 2 "gr_register_operand" "r")
1688 (match_operand:BI 1 "register_operand" "0")))]
1690 "cmp4.%C3.and.orcm %0, %I0 = r0, %2"
1691 [(set_attr "itanium_class" "icmp")])
1693 (define_insn "*cmpsi_andnot_0"
1694 [(set (match_operand:BI 0 "register_operand" "=c")
1695 (and:BI (not:BI (match_operator:BI 4 "predicate_operator"
1696 [(match_operand:SI 2 "gr_reg_or_0_operand" "rO")
1697 (match_operand:SI 3 "gr_reg_or_8bit_operand" "rK")]))
1698 (match_operand:BI 1 "register_operand" "0")))]
1700 "cmp4.%C4.or.andcm %I0, %0 = %3, %r2"
1701 [(set_attr "itanium_class" "icmp")])
1703 (define_insn "*cmpsi_andnot_1"
1704 [(set (match_operand:BI 0 "register_operand" "=c")
1705 (and:BI (not:BI (match_operator:BI 3 "signed_inequality_operator"
1706 [(match_operand:SI 2 "gr_register_operand" "r")
1708 (match_operand:BI 1 "register_operand" "0")))]
1710 "cmp4.%C3.or.andcm %I0, %0 = r0, %2"
1711 [(set_attr "itanium_class" "icmp")])
1713 (define_insn "*cmpdi_and_0"
1714 [(set (match_operand:BI 0 "register_operand" "=c")
1715 (and:BI (match_operator:BI 4 "predicate_operator"
1716 [(match_operand:DI 2 "gr_register_operand" "r")
1717 (match_operand:DI 3 "gr_reg_or_8bit_operand" "rK")])
1718 (match_operand:BI 1 "register_operand" "0")))]
1720 "cmp.%C4.and.orcm %0, %I0 = %3, %2"
1721 [(set_attr "itanium_class" "icmp")])
1723 (define_insn "*cmpdi_and_1"
1724 [(set (match_operand:BI 0 "register_operand" "=c")
1725 (and:BI (match_operator:BI 3 "signed_inequality_operator"
1726 [(match_operand:DI 2 "gr_register_operand" "r")
1728 (match_operand:BI 1 "register_operand" "0")))]
1730 "cmp.%C3.and.orcm %0, %I0 = r0, %2"
1731 [(set_attr "itanium_class" "icmp")])
1733 (define_insn "*cmpdi_andnot_0"
1734 [(set (match_operand:BI 0 "register_operand" "=c")
1735 (and:BI (not:BI (match_operator:BI 4 "predicate_operator"
1736 [(match_operand:DI 2 "gr_register_operand" "r")
1737 (match_operand:DI 3 "gr_reg_or_8bit_operand" "rK")]))
1738 (match_operand:BI 1 "register_operand" "0")))]
1740 "cmp.%C4.or.andcm %I0, %0 = %3, %2"
1741 [(set_attr "itanium_class" "icmp")])
1743 (define_insn "*cmpdi_andnot_1"
1744 [(set (match_operand:BI 0 "register_operand" "=c")
1745 (and:BI (not:BI (match_operator:BI 3 "signed_inequality_operator"
1746 [(match_operand:DI 2 "gr_register_operand" "r")
1748 (match_operand:BI 1 "register_operand" "0")))]
1750 "cmp.%C3.or.andcm %I0, %0 = r0, %2"
1751 [(set_attr "itanium_class" "icmp")])
1753 (define_insn "*tbit_and_0"
1754 [(set (match_operand:BI 0 "register_operand" "=c")
1755 (and:BI (ne:BI (and:DI (match_operand:DI 1 "gr_register_operand" "r")
1758 (match_operand:BI 2 "register_operand" "0")))]
1760 "tbit.nz.and.orcm %0, %I0 = %1, 0"
1761 [(set_attr "itanium_class" "tbit")])
1763 (define_insn "*tbit_and_1"
1764 [(set (match_operand:BI 0 "register_operand" "=c")
1765 (and:BI (eq:BI (and:DI (match_operand:DI 1 "gr_register_operand" "r")
1768 (match_operand:BI 2 "register_operand" "0")))]
1770 "tbit.z.and.orcm %0, %I0 = %1, 0"
1771 [(set_attr "itanium_class" "tbit")])
1773 (define_insn "*tbit_and_2"
1774 [(set (match_operand:BI 0 "register_operand" "=c")
1775 (and:BI (ne:BI (zero_extract:DI
1776 (match_operand:DI 1 "gr_register_operand" "r")
1778 (match_operand:DI 2 "shift_count_operand" "M"))
1780 (match_operand:BI 3 "register_operand" "0")))]
1782 "tbit.nz.and.orcm %0, %I0 = %1, %2"
1783 [(set_attr "itanium_class" "tbit")])
1785 (define_insn "*tbit_and_3"
1786 [(set (match_operand:BI 0 "register_operand" "=c")
1787 (and:BI (eq:BI (zero_extract:DI
1788 (match_operand:DI 1 "gr_register_operand" "r")
1790 (match_operand:DI 2 "shift_count_operand" "M"))
1792 (match_operand:BI 3 "register_operand" "0")))]
1794 "tbit.z.and.orcm %0, %I0 = %1, %2"
1795 [(set_attr "itanium_class" "tbit")])
1797 (define_insn "*cmpsi_or_0"
1798 [(set (match_operand:BI 0 "register_operand" "=c")
1799 (ior:BI (match_operator:BI 4 "predicate_operator"
1800 [(match_operand:SI 2 "gr_reg_or_0_operand" "rO")
1801 (match_operand:SI 3 "gr_reg_or_8bit_operand" "rK")])
1802 (match_operand:BI 1 "register_operand" "0")))]
1804 "cmp4.%C4.or.andcm %0, %I0 = %3, %r2"
1805 [(set_attr "itanium_class" "icmp")])
1807 (define_insn "*cmpsi_or_1"
1808 [(set (match_operand:BI 0 "register_operand" "=c")
1809 (ior:BI (match_operator:BI 3 "signed_inequality_operator"
1810 [(match_operand:SI 2 "gr_register_operand" "r")
1812 (match_operand:BI 1 "register_operand" "0")))]
1814 "cmp4.%C3.or.andcm %0, %I0 = r0, %2"
1815 [(set_attr "itanium_class" "icmp")])
1817 (define_insn "*cmpsi_orcm_0"
1818 [(set (match_operand:BI 0 "register_operand" "=c")
1819 (ior:BI (not:BI (match_operator:BI 4 "predicate_operator"
1820 [(match_operand:SI 2 "gr_reg_or_0_operand" "rO")
1821 (match_operand:SI 3 "gr_reg_or_8bit_operand" "rK")]))
1822 (match_operand:BI 1 "register_operand" "0")))]
1824 "cmp4.%C4.and.orcm %I0, %0 = %3, %r2"
1825 [(set_attr "itanium_class" "icmp")])
1827 (define_insn "*cmpsi_orcm_1"
1828 [(set (match_operand:BI 0 "register_operand" "=c")
1829 (ior:BI (not:BI (match_operator:BI 3 "signed_inequality_operator"
1830 [(match_operand:SI 2 "gr_register_operand" "r")
1832 (match_operand:BI 1 "register_operand" "0")))]
1834 "cmp4.%C3.and.orcm %I0, %0 = r0, %2"
1835 [(set_attr "itanium_class" "icmp")])
1837 (define_insn "*cmpdi_or_0"
1838 [(set (match_operand:BI 0 "register_operand" "=c")
1839 (ior:BI (match_operator:BI 4 "predicate_operator"
1840 [(match_operand:DI 2 "gr_register_operand" "r")
1841 (match_operand:DI 3 "gr_reg_or_8bit_operand" "rK")])
1842 (match_operand:BI 1 "register_operand" "0")))]
1844 "cmp.%C4.or.andcm %0, %I0 = %3, %2"
1845 [(set_attr "itanium_class" "icmp")])
1847 (define_insn "*cmpdi_or_1"
1848 [(set (match_operand:BI 0 "register_operand" "=c")
1849 (ior:BI (match_operator:BI 3 "signed_inequality_operator"
1850 [(match_operand:DI 2 "gr_register_operand" "r")
1852 (match_operand:BI 1 "register_operand" "0")))]
1854 "cmp.%C3.or.andcm %0, %I0 = r0, %2"
1855 [(set_attr "itanium_class" "icmp")])
1857 (define_insn "*cmpdi_orcm_0"
1858 [(set (match_operand:BI 0 "register_operand" "=c")
1859 (ior:BI (not:BI (match_operator:BI 4 "predicate_operator"
1860 [(match_operand:DI 2 "gr_register_operand" "r")
1861 (match_operand:DI 3 "gr_reg_or_8bit_operand" "rK")]))
1862 (match_operand:BI 1 "register_operand" "0")))]
1864 "cmp.%C4.and.orcm %I0, %0 = %3, %2"
1865 [(set_attr "itanium_class" "icmp")])
1867 (define_insn "*cmpdi_orcm_1"
1868 [(set (match_operand:BI 0 "register_operand" "=c")
1869 (ior:BI (not:BI (match_operator:BI 3 "signed_inequality_operator"
1870 [(match_operand:DI 2 "gr_register_operand" "r")
1872 (match_operand:BI 1 "register_operand" "0")))]
1874 "cmp.%C3.and.orcm %I0, %0 = r0, %2"
1875 [(set_attr "itanium_class" "icmp")])
1877 (define_insn "*tbit_or_0"
1878 [(set (match_operand:BI 0 "register_operand" "=c")
1879 (ior:BI (ne:BI (and:DI (match_operand:DI 1 "gr_register_operand" "r")
1882 (match_operand:BI 2 "register_operand" "0")))]
1884 "tbit.nz.or.andcm %0, %I0 = %1, 0"
1885 [(set_attr "itanium_class" "tbit")])
1887 (define_insn "*tbit_or_1"
1888 [(set (match_operand:BI 0 "register_operand" "=c")
1889 (ior:BI (eq:BI (and:DI (match_operand:DI 1 "gr_register_operand" "r")
1892 (match_operand:BI 2 "register_operand" "0")))]
1894 "tbit.z.or.andcm %0, %I0 = %1, 0"
1895 [(set_attr "itanium_class" "tbit")])
1897 (define_insn "*tbit_or_2"
1898 [(set (match_operand:BI 0 "register_operand" "=c")
1899 (ior:BI (ne:BI (zero_extract:DI
1900 (match_operand:DI 1 "gr_register_operand" "r")
1902 (match_operand:DI 2 "shift_count_operand" "M"))
1904 (match_operand:BI 3 "register_operand" "0")))]
1906 "tbit.nz.or.andcm %0, %I0 = %1, %2"
1907 [(set_attr "itanium_class" "tbit")])
1909 (define_insn "*tbit_or_3"
1910 [(set (match_operand:BI 0 "register_operand" "=c")
1911 (ior:BI (eq:BI (zero_extract:DI
1912 (match_operand:DI 1 "gr_register_operand" "r")
1914 (match_operand:DI 2 "shift_count_operand" "M"))
1916 (match_operand:BI 3 "register_operand" "0")))]
1918 "tbit.z.or.andcm %0, %I0 = %1, %2"
1919 [(set_attr "itanium_class" "tbit")])
1921 ;; Transform test of and/or of setcc into parallel comparisons.
1924 [(set (match_operand:BI 0 "register_operand" "")
1925 (ne:BI (and:DI (ne:DI (match_operand:BI 2 "register_operand" "")
1927 (match_operand:DI 3 "register_operand" ""))
1931 (and:BI (ne:BI (and:DI (match_dup 3) (const_int 1)) (const_int 0))
1936 [(set (match_operand:BI 0 "register_operand" "")
1937 (eq:BI (and:DI (ne:DI (match_operand:BI 2 "register_operand" "")
1939 (match_operand:DI 3 "register_operand" ""))
1943 (and:BI (ne:BI (and:DI (match_dup 3) (const_int 1)) (const_int 0))
1945 (parallel [(set (match_dup 0) (not:BI (match_dup 0)))
1946 (clobber (scratch))])]
1950 [(set (match_operand:BI 0 "register_operand" "")
1951 (ne:BI (ior:DI (ne:DI (match_operand:BI 2 "register_operand" "")
1953 (match_operand:DI 3 "register_operand" ""))
1957 (ior:BI (ne:BI (match_dup 3) (const_int 0))
1962 [(set (match_operand:BI 0 "register_operand" "")
1963 (eq:BI (ior:DI (ne:DI (match_operand:BI 2 "register_operand" "")
1965 (match_operand:DI 3 "register_operand" ""))
1969 (ior:BI (ne:BI (match_dup 3) (const_int 0))
1971 (parallel [(set (match_dup 0) (not:BI (match_dup 0)))
1972 (clobber (scratch))])]
1975 ;; ??? Incredibly hackish. Either need four proper patterns with all
1976 ;; the alternatives, or rely on sched1 to split the insn and hope that
1977 ;; nothing bad happens to the comparisons in the meantime.
1979 ;; Alternately, adjust combine to allow 2->2 and 3->3 splits, assuming
1980 ;; that we're doing height reduction.
1982 ;(define_insn_and_split ""
1983 ; [(set (match_operand:BI 0 "register_operand" "=c")
1984 ; (and:BI (and:BI (match_operator:BI 1 "comparison_operator"
1985 ; [(match_operand 2 "" "")
1986 ; (match_operand 3 "" "")])
1987 ; (match_operator:BI 4 "comparison_operator"
1988 ; [(match_operand 5 "" "")
1989 ; (match_operand 6 "" "")]))
1991 ; "flag_schedule_insns"
1994 ; [(set (match_dup 0) (and:BI (match_dup 1) (match_dup 0)))
1995 ; (set (match_dup 0) (and:BI (match_dup 4) (match_dup 0)))]
1998 ;(define_insn_and_split ""
1999 ; [(set (match_operand:BI 0 "register_operand" "=c")
2000 ; (ior:BI (ior:BI (match_operator:BI 1 "comparison_operator"
2001 ; [(match_operand 2 "" "")
2002 ; (match_operand 3 "" "")])
2003 ; (match_operator:BI 4 "comparison_operator"
2004 ; [(match_operand 5 "" "")
2005 ; (match_operand 6 "" "")]))
2007 ; "flag_schedule_insns"
2010 ; [(set (match_dup 0) (ior:BI (match_dup 1) (match_dup 0)))
2011 ; (set (match_dup 0) (ior:BI (match_dup 4) (match_dup 0)))]
2015 ; [(set (match_operand:BI 0 "register_operand" "")
2016 ; (and:BI (and:BI (match_operator:BI 1 "comparison_operator"
2017 ; [(match_operand 2 "" "")
2018 ; (match_operand 3 "" "")])
2019 ; (match_operand:BI 7 "register_operand" ""))
2020 ; (and:BI (match_operator:BI 4 "comparison_operator"
2021 ; [(match_operand 5 "" "")
2022 ; (match_operand 6 "" "")])
2023 ; (match_operand:BI 8 "register_operand" ""))))]
2025 ; [(set (match_dup 0) (and:BI (match_dup 7) (match_dup 8)))
2026 ; (set (match_dup 0) (and:BI (and:BI (match_dup 1) (match_dup 4))
2031 ; [(set (match_operand:BI 0 "register_operand" "")
2032 ; (ior:BI (ior:BI (match_operator:BI 1 "comparison_operator"
2033 ; [(match_operand 2 "" "")
2034 ; (match_operand 3 "" "")])
2035 ; (match_operand:BI 7 "register_operand" ""))
2036 ; (ior:BI (match_operator:BI 4 "comparison_operator"
2037 ; [(match_operand 5 "" "")
2038 ; (match_operand 6 "" "")])
2039 ; (match_operand:BI 8 "register_operand" ""))))]
2041 ; [(set (match_dup 0) (ior:BI (match_dup 7) (match_dup 8)))
2042 ; (set (match_dup 0) (ior:BI (ior:BI (match_dup 1) (match_dup 4))
2046 ;; Try harder to avoid predicate copies by duplicating compares.
2047 ;; Note that we'll have already split the predicate copy, which
2048 ;; is kind of a pain, but oh well.
2051 [(set (match_operand:BI 0 "register_operand" "")
2052 (match_operand:BI 1 "comparison_operator" ""))
2053 (set (match_operand:CCI 2 "register_operand" "")
2054 (match_operand:CCI 3 "register_operand" ""))
2055 (set (match_operand:CCI 4 "register_operand" "")
2056 (match_operand:CCI 5 "register_operand" ""))
2057 (set (match_operand:BI 6 "register_operand" "")
2058 (unspec:BI [(match_dup 6)] UNSPEC_PRED_REL_MUTEX))]
2059 "REGNO (operands[3]) == REGNO (operands[0])
2060 && REGNO (operands[4]) == REGNO (operands[0]) + 1
2061 && REGNO (operands[4]) == REGNO (operands[2]) + 1
2062 && REGNO (operands[6]) == REGNO (operands[2])"
2063 [(set (match_dup 0) (match_dup 1))
2064 (set (match_dup 6) (match_dup 7))]
2065 "operands[7] = copy_rtx (operands[1]);")
2067 ;; ::::::::::::::::::::
2069 ;; :: 16-bit Integer arithmetic
2071 ;; ::::::::::::::::::::
2073 (define_insn "mulhi3"
2074 [(set (match_operand:HI 0 "gr_register_operand" "=r")
2075 (mult:HI (match_operand:HI 1 "gr_register_operand" "r")
2076 (match_operand:HI 2 "gr_register_operand" "r")))]
2078 "pmpy2.r %0 = %1, %2"
2079 [(set_attr "itanium_class" "mmmul")])
2082 ;; ::::::::::::::::::::
2084 ;; :: 32-bit Integer arithmetic
2086 ;; ::::::::::::::::::::
2088 (define_insn "addsi3"
2089 [(set (match_operand:SI 0 "gr_register_operand" "=r,r,r")
2090 (plus:SI (match_operand:SI 1 "gr_register_operand" "%r,r,a")
2091 (match_operand:SI 2 "gr_reg_or_22bit_operand" "r,I,J")))]
2097 [(set_attr "itanium_class" "ialu")])
2099 (define_insn "*addsi3_plus1"
2100 [(set (match_operand:SI 0 "gr_register_operand" "=r")
2101 (plus:SI (plus:SI (match_operand:SI 1 "gr_register_operand" "r")
2102 (match_operand:SI 2 "gr_register_operand" "r"))
2105 "add %0 = %1, %2, 1"
2106 [(set_attr "itanium_class" "ialu")])
2108 (define_insn "*addsi3_plus1_alt"
2109 [(set (match_operand:SI 0 "gr_register_operand" "=r")
2110 (plus:SI (mult:SI (match_operand:SI 1 "gr_register_operand" "r")
2114 "add %0 = %1, %1, 1"
2115 [(set_attr "itanium_class" "ialu")])
2117 (define_insn "*addsi3_shladd"
2118 [(set (match_operand:SI 0 "gr_register_operand" "=r")
2119 (plus:SI (mult:SI (match_operand:SI 1 "gr_register_operand" "r")
2120 (match_operand:SI 2 "shladd_operand" "n"))
2121 (match_operand:SI 3 "gr_register_operand" "r")))]
2123 "shladd %0 = %1, %S2, %3"
2124 [(set_attr "itanium_class" "ialu")])
2126 (define_insn "subsi3"
2127 [(set (match_operand:SI 0 "gr_register_operand" "=r")
2128 (minus:SI (match_operand:SI 1 "gr_reg_or_8bit_operand" "rK")
2129 (match_operand:SI 2 "gr_register_operand" "r")))]
2132 [(set_attr "itanium_class" "ialu")])
2134 (define_insn "*subsi3_minus1"
2135 [(set (match_operand:SI 0 "gr_register_operand" "=r")
2136 (plus:SI (not:SI (match_operand:SI 1 "gr_register_operand" "r"))
2137 (match_operand:SI 2 "gr_register_operand" "r")))]
2139 "sub %0 = %2, %1, 1"
2140 [(set_attr "itanium_class" "ialu")])
2142 ;; ??? Could add maddsi3 patterns patterned after the madddi3 patterns.
2144 (define_insn "mulsi3"
2145 [(set (match_operand:SI 0 "fr_register_operand" "=f")
2146 (mult:SI (match_operand:SI 1 "grfr_register_operand" "f")
2147 (match_operand:SI 2 "grfr_register_operand" "f")))]
2149 "xmpy.l %0 = %1, %2"
2150 [(set_attr "itanium_class" "xmpy")])
2152 (define_insn "maddsi4"
2153 [(set (match_operand:SI 0 "fr_register_operand" "=f")
2154 (plus:SI (mult:SI (match_operand:SI 1 "grfr_register_operand" "f")
2155 (match_operand:SI 2 "grfr_register_operand" "f"))
2156 (match_operand:SI 3 "grfr_register_operand" "f")))]
2158 "xma.l %0 = %1, %2, %3"
2159 [(set_attr "itanium_class" "xmpy")])
2161 (define_insn "negsi2"
2162 [(set (match_operand:SI 0 "gr_register_operand" "=r")
2163 (neg:SI (match_operand:SI 1 "gr_register_operand" "r")))]
2166 [(set_attr "itanium_class" "ialu")])
2168 (define_expand "abssi2"
2170 (ge:BI (match_operand:SI 1 "gr_register_operand" "") (const_int 0)))
2171 (set (match_operand:SI 0 "gr_register_operand" "")
2172 (if_then_else:SI (eq (match_dup 2) (const_int 0))
2173 (neg:SI (match_dup 1))
2176 { operands[2] = gen_reg_rtx (BImode); })
2178 (define_expand "sminsi3"
2180 (ge:BI (match_operand:SI 1 "gr_register_operand" "")
2181 (match_operand:SI 2 "gr_register_operand" "")))
2182 (set (match_operand:SI 0 "gr_register_operand" "")
2183 (if_then_else:SI (ne (match_dup 3) (const_int 0))
2184 (match_dup 2) (match_dup 1)))]
2186 { operands[3] = gen_reg_rtx (BImode); })
2188 (define_expand "smaxsi3"
2190 (ge:BI (match_operand:SI 1 "gr_register_operand" "")
2191 (match_operand:SI 2 "gr_register_operand" "")))
2192 (set (match_operand:SI 0 "gr_register_operand" "")
2193 (if_then_else:SI (ne (match_dup 3) (const_int 0))
2194 (match_dup 1) (match_dup 2)))]
2196 { operands[3] = gen_reg_rtx (BImode); })
2198 (define_expand "uminsi3"
2200 (geu:BI (match_operand:SI 1 "gr_register_operand" "")
2201 (match_operand:SI 2 "gr_register_operand" "")))
2202 (set (match_operand:SI 0 "gr_register_operand" "")
2203 (if_then_else:SI (ne (match_dup 3) (const_int 0))
2204 (match_dup 2) (match_dup 1)))]
2206 { operands[3] = gen_reg_rtx (BImode); })
2208 (define_expand "umaxsi3"
2210 (geu:BI (match_operand:SI 1 "gr_register_operand" "")
2211 (match_operand:SI 2 "gr_register_operand" "")))
2212 (set (match_operand:SI 0 "gr_register_operand" "")
2213 (if_then_else:SI (ne (match_dup 3) (const_int 0))
2214 (match_dup 1) (match_dup 2)))]
2216 { operands[3] = gen_reg_rtx (BImode); })
2218 ;; ::::::::::::::::::::
2220 ;; :: 64-bit Integer arithmetic
2222 ;; ::::::::::::::::::::
2224 (define_insn "adddi3"
2225 [(set (match_operand:DI 0 "gr_register_operand" "=r,r,r")
2226 (plus:DI (match_operand:DI 1 "gr_register_operand" "%r,r,a")
2227 (match_operand:DI 2 "gr_reg_or_22bit_operand" "r,I,J")))]
2233 [(set_attr "itanium_class" "ialu")])
2235 (define_insn "*adddi3_plus1"
2236 [(set (match_operand:DI 0 "gr_register_operand" "=r")
2237 (plus:DI (plus:DI (match_operand:DI 1 "gr_register_operand" "r")
2238 (match_operand:DI 2 "gr_register_operand" "r"))
2241 "add %0 = %1, %2, 1"
2242 [(set_attr "itanium_class" "ialu")])
2244 ;; This has some of the same problems as shladd. We let the shladd
2245 ;; eliminator hack handle it, which results in the 1 being forced into
2246 ;; a register, but not more ugliness here.
2247 (define_insn "*adddi3_plus1_alt"
2248 [(set (match_operand:DI 0 "gr_register_operand" "=r")
2249 (plus:DI (mult:DI (match_operand:DI 1 "gr_register_operand" "r")
2253 "add %0 = %1, %1, 1"
2254 [(set_attr "itanium_class" "ialu")])
2256 (define_insn "subdi3"
2257 [(set (match_operand:DI 0 "gr_register_operand" "=r")
2258 (minus:DI (match_operand:DI 1 "gr_reg_or_8bit_operand" "rK")
2259 (match_operand:DI 2 "gr_register_operand" "r")))]
2262 [(set_attr "itanium_class" "ialu")])
2264 (define_insn "*subdi3_minus1"
2265 [(set (match_operand:DI 0 "gr_register_operand" "=r")
2266 (plus:DI (not:DI (match_operand:DI 1 "gr_register_operand" "r"))
2267 (match_operand:DI 2 "gr_register_operand" "r")))]
2269 "sub %0 = %2, %1, 1"
2270 [(set_attr "itanium_class" "ialu")])
2272 ;; ??? Use grfr instead of fr because of virtual register elimination
2273 ;; and silly test cases multiplying by the frame pointer.
2274 (define_insn "muldi3"
2275 [(set (match_operand:DI 0 "fr_register_operand" "=f")
2276 (mult:DI (match_operand:DI 1 "grfr_register_operand" "f")
2277 (match_operand:DI 2 "grfr_register_operand" "f")))]
2279 "xmpy.l %0 = %1, %2"
2280 [(set_attr "itanium_class" "xmpy")])
2282 ;; ??? If operand 3 is an eliminable reg, then register elimination causes the
2283 ;; same problem that we have with shladd below. Unfortunately, this case is
2284 ;; much harder to fix because the multiply puts the result in an FP register,
2285 ;; but the add needs inputs from a general register. We add a spurious clobber
2286 ;; here so that it will be present just in case register elimination gives us
2287 ;; the funny result.
2289 ;; ??? Maybe validate_changes should try adding match_scratch clobbers?
2291 ;; ??? Maybe we should change how adds are canonicalized.
2293 (define_insn "madddi4"
2294 [(set (match_operand:DI 0 "fr_register_operand" "=f")
2295 (plus:DI (mult:DI (match_operand:DI 1 "grfr_register_operand" "f")
2296 (match_operand:DI 2 "grfr_register_operand" "f"))
2297 (match_operand:DI 3 "grfr_register_operand" "f")))
2298 (clobber (match_scratch:DI 4 "=X"))]
2300 "xma.l %0 = %1, %2, %3"
2301 [(set_attr "itanium_class" "xmpy")])
2303 ;; This can be created by register elimination if operand3 of shladd is an
2304 ;; eliminable register or has reg_equiv_constant set.
2306 ;; We have to use nonmemory_operand for operand 4, to ensure that the
2307 ;; validate_changes call inside eliminate_regs will always succeed. If it
2308 ;; doesn't succeed, then this remain a madddi4 pattern, and will be reloaded
2311 (define_insn "*madddi4_elim"
2312 [(set (match_operand:DI 0 "register_operand" "=&r")
2313 (plus:DI (plus:DI (mult:DI (match_operand:DI 1 "register_operand" "f")
2314 (match_operand:DI 2 "register_operand" "f"))
2315 (match_operand:DI 3 "register_operand" "f"))
2316 (match_operand:DI 4 "nonmemory_operand" "rI")))
2317 (clobber (match_scratch:DI 5 "=f"))]
2318 "reload_in_progress"
2320 [(set_attr "itanium_class" "unknown")])
2323 [(set (match_operand:DI 0 "register_operand" "")
2324 (plus:DI (plus:DI (mult:DI (match_operand:DI 1 "register_operand" "")
2325 (match_operand:DI 2 "register_operand" ""))
2326 (match_operand:DI 3 "register_operand" ""))
2327 (match_operand:DI 4 "gr_reg_or_14bit_operand" "")))
2328 (clobber (match_scratch:DI 5 ""))]
2330 [(parallel [(set (match_dup 5) (plus:DI (mult:DI (match_dup 1) (match_dup 2))
2332 (clobber (match_dup 0))])
2333 (set (match_dup 0) (match_dup 5))
2334 (set (match_dup 0) (plus:DI (match_dup 0) (match_dup 4)))]
2337 (define_insn "smuldi3_highpart"
2338 [(set (match_operand:DI 0 "fr_register_operand" "=f")
2341 (mult:TI (sign_extend:TI
2342 (match_operand:DI 1 "fr_reg_or_fp01_operand" "fG"))
2344 (match_operand:DI 2 "fr_reg_or_fp01_operand" "fG")))
2347 "xmpy.h %0 = %F1, %F2"
2348 [(set_attr "itanium_class" "xmpy")])
2350 (define_insn "umuldi3_highpart"
2351 [(set (match_operand:DI 0 "fr_register_operand" "=f")
2354 (mult:TI (zero_extend:TI
2355 (match_operand:DI 1 "fr_reg_or_fp01_operand" "fG"))
2357 (match_operand:DI 2 "fr_reg_or_fp01_operand" "fG")))
2360 "xmpy.hu %0 = %F1, %F2"
2361 [(set_attr "itanium_class" "xmpy")])
2363 (define_insn "negdi2"
2364 [(set (match_operand:DI 0 "gr_register_operand" "=r")
2365 (neg:DI (match_operand:DI 1 "gr_register_operand" "r")))]
2368 [(set_attr "itanium_class" "ialu")])
2370 (define_expand "absdi2"
2372 (ge:BI (match_operand:DI 1 "gr_register_operand" "") (const_int 0)))
2373 (set (match_operand:DI 0 "gr_register_operand" "")
2374 (if_then_else:DI (eq (match_dup 2) (const_int 0))
2375 (neg:DI (match_dup 1))
2378 { operands[2] = gen_reg_rtx (BImode); })
2380 (define_expand "smindi3"
2382 (ge:BI (match_operand:DI 1 "gr_register_operand" "")
2383 (match_operand:DI 2 "gr_register_operand" "")))
2384 (set (match_operand:DI 0 "gr_register_operand" "")
2385 (if_then_else:DI (ne (match_dup 3) (const_int 0))
2386 (match_dup 2) (match_dup 1)))]
2388 { operands[3] = gen_reg_rtx (BImode); })
2390 (define_expand "smaxdi3"
2392 (ge:BI (match_operand:DI 1 "gr_register_operand" "")
2393 (match_operand:DI 2 "gr_register_operand" "")))
2394 (set (match_operand:DI 0 "gr_register_operand" "")
2395 (if_then_else:DI (ne (match_dup 3) (const_int 0))
2396 (match_dup 1) (match_dup 2)))]
2398 { operands[3] = gen_reg_rtx (BImode); })
2400 (define_expand "umindi3"
2402 (geu:BI (match_operand:DI 1 "gr_register_operand" "")
2403 (match_operand:DI 2 "gr_register_operand" "")))
2404 (set (match_operand:DI 0 "gr_register_operand" "")
2405 (if_then_else:DI (ne (match_dup 3) (const_int 0))
2406 (match_dup 2) (match_dup 1)))]
2408 { operands[3] = gen_reg_rtx (BImode); })
2410 (define_expand "umaxdi3"
2412 (geu:BI (match_operand:DI 1 "gr_register_operand" "")
2413 (match_operand:DI 2 "gr_register_operand" "")))
2414 (set (match_operand:DI 0 "gr_register_operand" "")
2415 (if_then_else:DI (ne (match_dup 3) (const_int 0))
2416 (match_dup 1) (match_dup 2)))]
2418 { operands[3] = gen_reg_rtx (BImode); })
2420 (define_expand "ffsdi2"
2422 (eq:BI (match_operand:DI 1 "gr_register_operand" "") (const_int 0)))
2423 (set (match_dup 2) (plus:DI (match_dup 1) (const_int -1)))
2424 (set (match_dup 5) (const_int 0))
2425 (set (match_dup 3) (xor:DI (match_dup 1) (match_dup 2)))
2426 (set (match_dup 4) (popcount:DI (match_dup 3)))
2427 (set (match_operand:DI 0 "gr_register_operand" "")
2428 (if_then_else:DI (ne (match_dup 6) (const_int 0))
2429 (match_dup 5) (match_dup 4)))]
2432 operands[2] = gen_reg_rtx (DImode);
2433 operands[3] = gen_reg_rtx (DImode);
2434 operands[4] = gen_reg_rtx (DImode);
2435 operands[5] = gen_reg_rtx (DImode);
2436 operands[6] = gen_reg_rtx (BImode);
2439 (define_expand "ctzdi2"
2440 [(set (match_dup 2) (plus:DI (match_operand:DI 1 "gr_register_operand" "")
2442 (set (match_dup 3) (not:DI (match_dup 1)))
2443 (set (match_dup 4) (and:DI (match_dup 2) (match_dup 3)))
2444 (set (match_operand:DI 0 "gr_register_operand" "")
2445 (popcount:DI (match_dup 4)))]
2448 operands[2] = gen_reg_rtx (DImode);
2449 operands[3] = gen_reg_rtx (DImode);
2450 operands[4] = gen_reg_rtx (DImode);
2453 ;; Note the computation here is op0 = 63 - (exp - 0xffff).
2454 (define_expand "clzdi2"
2456 (unsigned_float:XF (match_operand:DI 1 "fr_reg_or_fp01_operand" "")))
2458 (unspec:DI [(match_dup 2)] UNSPEC_GETF_EXP))
2459 (set (match_dup 4) (const_int 65598))
2460 (set (match_operand:DI 0 "gr_register_operand" "")
2461 (minus:DI (match_dup 4) (match_dup 3)))]
2464 operands[2] = gen_reg_rtx (XFmode);
2465 operands[3] = gen_reg_rtx (DImode);
2466 operands[4] = gen_reg_rtx (DImode);
2469 (define_insn "popcountdi2"
2470 [(set (match_operand:DI 0 "gr_register_operand" "=r")
2471 (popcount:DI (match_operand:DI 1 "gr_register_operand" "r")))]
2474 [(set_attr "itanium_class" "mmmul")])
2476 (define_insn "bswapdi2"
2477 [(set (match_operand:DI 0 "gr_register_operand" "=r")
2478 (bswap:DI (match_operand:DI 1 "gr_register_operand" "r")))]
2480 "mux1 %0 = %1, @rev"
2481 [(set_attr "itanium_class" "mmshf")])
2483 (define_insn "*getf_exp_xf"
2484 [(set (match_operand:DI 0 "gr_register_operand" "=r")
2485 (unspec:DI [(match_operand:XF 1 "fr_reg_or_fp01_operand" "fG")]
2489 [(set_attr "itanium_class" "frfr")])
2491 ;; ::::::::::::::::::::
2493 ;; :: 128-bit Integer arithmetic
2495 ;; ::::::::::::::::::::
2497 (define_insn "addti3"
2498 [(set (match_operand:TI 0 "gr_register_operand" "=&r")
2499 (plus:TI (match_operand:TI 1 "gr_register_operand" "%r")
2500 (match_operand:TI 2 "gr_reg_or_14bit_operand" "rI")))
2501 (clobber (match_scratch:BI 3 "=&c"))]
2504 [(set_attr "itanium_class" "unknown")])
2507 [(set (match_operand:TI 0 "register_operand" "")
2508 (plus:TI (match_operand:TI 1 "register_operand" "")
2509 (match_operand:TI 2 "register_operand" "")))
2510 (clobber (match_scratch:BI 3 ""))]
2512 [(set (match_dup 0) (plus:DI (match_dup 1) (match_dup 2)))
2513 (set (match_dup 3) (ltu:BI (match_dup 0) (match_dup 1)))
2514 (cond_exec (eq (match_dup 3) (const_int 0))
2515 (set (match_dup 4) (plus:DI (match_dup 5) (match_dup 6))))
2516 (cond_exec (ne (match_dup 3) (const_int 0))
2518 (plus:DI (plus:DI (match_dup 5) (match_dup 6))
2521 operands[4] = gen_highpart (DImode, operands[0]);
2522 operands[0] = gen_lowpart (DImode, operands[0]);
2523 operands[5] = gen_highpart (DImode, operands[1]);
2524 operands[1] = gen_lowpart (DImode, operands[1]);
2525 operands[6] = gen_highpart (DImode, operands[2]);
2526 operands[2] = gen_lowpart (DImode, operands[2]);
2530 [(set (match_operand:TI 0 "register_operand" "")
2531 (plus:TI (match_operand:TI 1 "register_operand" "")
2532 (match_operand:TI 2 "immediate_operand" "")))
2533 (clobber (match_scratch:BI 3 ""))]
2535 [(set (match_dup 0) (plus:DI (match_dup 1) (match_dup 2)))
2536 (set (match_dup 3) (ltu:BI (match_dup 0) (match_dup 1)))
2537 (cond_exec (eq (match_dup 3) (const_int 0))
2539 (plus:DI (match_dup 5) (match_dup 6))))
2540 (cond_exec (ne (match_dup 3) (const_int 0))
2542 (plus:DI (match_dup 5) (match_dup 7))))]
2544 operands[4] = gen_highpart (DImode, operands[0]);
2545 operands[0] = gen_lowpart (DImode, operands[0]);
2546 operands[5] = gen_highpart (DImode, operands[1]);
2547 operands[1] = gen_lowpart (DImode, operands[1]);
2548 operands[6] = INTVAL (operands[2]) < 0 ? constm1_rtx : const0_rtx;
2549 operands[7] = INTVAL (operands[2]) < 0 ? const0_rtx : const1_rtx;
2552 (define_insn "subti3"
2553 [(set (match_operand:TI 0 "gr_register_operand" "=&r")
2554 (minus:TI (match_operand:TI 1 "gr_reg_or_8bit_operand" "rK")
2555 (match_operand:TI 2 "gr_register_operand" "r")))
2556 (clobber (match_scratch:BI 3 "=&c"))]
2559 [(set_attr "itanium_class" "unknown")])
2562 [(set (match_operand:TI 0 "register_operand" "")
2563 (minus:TI (match_operand:TI 1 "register_operand" "")
2564 (match_operand:TI 2 "register_operand" "")))
2565 (clobber (match_scratch:BI 3 "=&c"))]
2567 [(set (match_dup 0) (minus:DI (match_dup 1) (match_dup 2)))
2568 (set (match_dup 3) (ltu:BI (match_dup 1) (match_dup 0)))
2569 (cond_exec (eq (match_dup 3) (const_int 0))
2570 (set (match_dup 4) (minus:DI (match_dup 5) (match_dup 6))))
2571 (cond_exec (ne (match_dup 3) (const_int 0))
2573 (plus:DI (not:DI (match_dup 6)) (match_dup 5))))]
2575 operands[4] = gen_highpart (DImode, operands[0]);
2576 operands[0] = gen_lowpart (DImode, operands[0]);
2577 operands[5] = gen_highpart (DImode, operands[1]);
2578 operands[1] = gen_lowpart (DImode, operands[1]);
2579 operands[6] = gen_highpart (DImode, operands[2]);
2580 operands[2] = gen_lowpart (DImode, operands[2]);
2584 [(set (match_operand:TI 0 "register_operand" "")
2585 (minus:TI (match_operand:TI 1 "immediate_operand" "")
2586 (match_operand:TI 2 "register_operand" "")))
2587 (clobber (match_scratch:BI 3 "=&c"))]
2588 "reload_completed && satisfies_constraint_K (operands[1])"
2589 [(set (match_dup 0) (minus:DI (match_dup 1) (match_dup 2)))
2590 (set (match_dup 3) (gtu:BI (match_dup 0) (match_dup 1)))
2591 (cond_exec (ne (match_dup 3) (const_int 0))
2592 (set (match_dup 4) (minus:DI (match_dup 6) (match_dup 5))))
2593 (cond_exec (eq (match_dup 3) (const_int 0))
2594 (set (match_dup 4) (minus:DI (match_dup 7) (match_dup 5))))]
2596 operands[4] = gen_highpart (DImode, operands[0]);
2597 operands[0] = gen_lowpart (DImode, operands[0]);
2598 operands[5] = gen_highpart (DImode, operands[2]);
2599 operands[2] = gen_lowpart (DImode, operands[2]);
2600 operands[6] = INTVAL (operands[1]) < 0 ? GEN_INT (-2) : constm1_rtx;
2601 operands[7] = INTVAL (operands[1]) < 0 ? constm1_rtx : const0_rtx;
2604 (define_expand "mulditi3"
2605 [(set (match_operand:TI 0 "fr_register_operand" "")
2606 (mult:TI (sign_extend:TI
2607 (match_operand:DI 1 "fr_reg_or_fp01_operand" ""))
2609 (match_operand:DI 2 "fr_reg_or_fp01_operand" ""))))]
2613 (define_insn_and_split "*mulditi3_internal"
2614 [(set (match_operand:TI 0 "fr_register_operand" "=&f")
2615 (mult:TI (sign_extend:TI
2616 (match_operand:DI 1 "fr_reg_or_fp01_operand" "fG"))
2618 (match_operand:DI 2 "fr_reg_or_fp01_operand" "fG"))))]
2622 [(set (match_dup 0) (mult:DI (match_dup 1) (match_dup 2)))
2623 (set (match_dup 3) (truncate:DI
2625 (mult:TI (sign_extend:TI (match_dup 1))
2626 (sign_extend:TI (match_dup 2)))
2629 operands[3] = gen_highpart (DImode, operands[0]);
2630 operands[0] = gen_lowpart (DImode, operands[0]);
2632 [(set_attr "itanium_class" "unknown")])
2634 (define_expand "umulditi3"
2635 [(set (match_operand:TI 0 "fr_register_operand" "")
2636 (mult:TI (zero_extend:TI
2637 (match_operand:DI 1 "fr_reg_or_fp01_operand" ""))
2639 (match_operand:DI 2 "fr_reg_or_fp01_operand" ""))))]
2643 (define_insn_and_split "*umulditi3_internal"
2644 [(set (match_operand:TI 0 "fr_register_operand" "=&f")
2645 (mult:TI (zero_extend:TI
2646 (match_operand:DI 1 "fr_reg_or_fp01_operand" "fG"))
2648 (match_operand:DI 2 "fr_reg_or_fp01_operand" "fG"))))]
2652 [(set (match_dup 0) (mult:DI (match_dup 1) (match_dup 2)))
2653 (set (match_dup 3) (truncate:DI
2655 (mult:TI (zero_extend:TI (match_dup 1))
2656 (zero_extend:TI (match_dup 2)))
2659 operands[3] = gen_highpart (DImode, operands[0]);
2660 operands[0] = gen_lowpart (DImode, operands[0]);
2662 [(set_attr "itanium_class" "unknown")])
2664 (define_insn_and_split "negti2"
2665 [(set (match_operand:TI 0 "gr_register_operand" "=&r")
2666 (neg:TI (match_operand:TI 1 "gr_register_operand" "r")))
2667 (clobber (match_scratch:BI 2 "=&c"))]
2671 [(set (match_dup 2) (eq:BI (match_dup 1) (const_int 0)))
2672 (set (match_dup 0) (minus:DI (const_int 0) (match_dup 1)))
2673 (cond_exec (eq (match_dup 2) (const_int 0))
2674 (set (match_dup 3) (minus:DI (const_int -1) (match_dup 4))))
2675 (cond_exec (ne (match_dup 2) (const_int 0))
2676 (set (match_dup 3) (minus:DI (const_int 0) (match_dup 4))))]
2678 operands[3] = gen_highpart (DImode, operands[0]);
2679 operands[0] = gen_lowpart (DImode, operands[0]);
2680 operands[4] = gen_highpart (DImode, operands[1]);
2681 operands[1] = gen_lowpart (DImode, operands[1]);
2683 [(set_attr "itanium_class" "unknown")])
2685 ;; ::::::::::::::::::::
2687 ;; :: 32-bit floating point arithmetic
2689 ;; ::::::::::::::::::::
2691 (define_insn "addsf3"
2692 [(set (match_operand:SF 0 "fr_register_operand" "=f")
2693 (plus:SF (match_operand:SF 1 "fr_reg_or_fp01_operand" "%fG")
2694 (match_operand:SF 2 "fr_reg_or_signed_fp01_operand" "fZ")))]
2696 "fadd.s %0 = %F1, %F2"
2697 [(set_attr "itanium_class" "fmac")])
2699 (define_insn "subsf3"
2700 [(set (match_operand:SF 0 "fr_register_operand" "=f")
2701 (minus:SF (match_operand:SF 1 "fr_reg_or_fp01_operand" "fG")
2702 (match_operand:SF 2 "fr_reg_or_signed_fp01_operand" "fZ")))]
2704 "fsub.s %0 = %F1, %F2"
2705 [(set_attr "itanium_class" "fmac")])
2707 (define_insn "mulsf3"
2708 [(set (match_operand:SF 0 "fr_register_operand" "=f")
2709 (mult:SF (match_operand:SF 1 "fr_reg_or_fp01_operand" "fG")
2710 (match_operand:SF 2 "fr_reg_or_fp01_operand" "fG")))]
2712 "fmpy.s %0 = %F1, %F2"
2713 [(set_attr "itanium_class" "fmac")])
2715 (define_insn "abssf2"
2716 [(set (match_operand:SF 0 "fr_register_operand" "=f")
2717 (abs:SF (match_operand:SF 1 "fr_reg_or_fp01_operand" "fG")))]
2720 [(set_attr "itanium_class" "fmisc")])
2722 (define_insn "negsf2"
2723 [(set (match_operand:SF 0 "fr_register_operand" "=f")
2724 (neg:SF (match_operand:SF 1 "fr_reg_or_fp01_operand" "fG")))]
2727 [(set_attr "itanium_class" "fmisc")])
2729 (define_insn "*nabssf2"
2730 [(set (match_operand:SF 0 "fr_register_operand" "=f")
2731 (neg:SF (abs:SF (match_operand:SF 1 "fr_reg_or_fp01_operand" "fG"))))]
2734 [(set_attr "itanium_class" "fmisc")])
2736 (define_insn "copysignsf3"
2737 [(set (match_operand:SF 0 "register_operand" "=f")
2738 (unspec:SF [(match_operand:SF 1 "fr_reg_or_fp01_operand" "fG")
2739 (match_operand:SF 2 "fr_reg_or_fp01_operand" "fG")]
2742 "fmerge.s %0 = %F2, %F1"
2743 [(set_attr "itanium_class" "fmisc")])
2745 (define_insn "*ncopysignsf3"
2746 [(set (match_operand:SF 0 "register_operand" "=f")
2747 (neg:SF (unspec:SF [(match_operand:SF 1 "fr_reg_or_fp01_operand" "fG")
2748 (match_operand:SF 2 "fr_reg_or_fp01_operand" "fG")]
2751 "fmerge.ns %0 = %F2, %F1"
2752 [(set_attr "itanium_class" "fmisc")])
2754 (define_insn "sminsf3"
2755 [(set (match_operand:SF 0 "fr_register_operand" "=f")
2756 (smin:SF (match_operand:SF 1 "fr_reg_or_fp01_operand" "fG")
2757 (match_operand:SF 2 "fr_reg_or_fp01_operand" "fG")))]
2759 "fmin %0 = %F1, %F2"
2760 [(set_attr "itanium_class" "fmisc")])
2762 (define_insn "smaxsf3"
2763 [(set (match_operand:SF 0 "fr_register_operand" "=f")
2764 (smax:SF (match_operand:SF 1 "fr_reg_or_fp01_operand" "fG")
2765 (match_operand:SF 2 "fr_reg_or_fp01_operand" "fG")))]
2767 "fmax %0 = %F1, %F2"
2768 [(set_attr "itanium_class" "fmisc")])
2770 (define_insn "*nmulsf3"
2771 [(set (match_operand:SF 0 "fr_register_operand" "=f")
2772 (neg:SF (mult:SF (match_operand:SF 1 "fr_reg_or_fp01_operand" "fG")
2773 (match_operand:SF 2 "fr_reg_or_fp01_operand" "fG"))))]
2775 "fnmpy.s %0 = %F1, %F2"
2776 [(set_attr "itanium_class" "fmac")])
2778 (define_insn "fmasf4"
2779 [(set (match_operand:SF 0 "fr_register_operand" "=f")
2780 (fma:SF (match_operand:SF 1 "fr_reg_or_fp01_operand" "fG")
2781 (match_operand:SF 2 "fr_reg_or_fp01_operand" "fG")
2782 (match_operand:SF 3 "fr_reg_or_signed_fp01_operand" "fZ")))]
2784 "fma.s %0 = %F1, %F2, %F3"
2785 [(set_attr "itanium_class" "fmac")])
2787 (define_insn "fmssf4"
2788 [(set (match_operand:SF 0 "fr_register_operand" "=f")
2789 (fma:SF (match_operand:SF 1 "fr_reg_or_fp01_operand" "fG")
2790 (match_operand:SF 2 "fr_reg_or_fp01_operand" "fG")
2792 (match_operand:SF 3 "fr_reg_or_signed_fp01_operand" "fZ"))))]
2794 "fms.s %0 = %F1, %F2, %F3"
2795 [(set_attr "itanium_class" "fmac")])
2797 (define_insn "fnmasf4"
2798 [(set (match_operand:SF 0 "fr_register_operand" "=f")
2799 (fma:SF (neg:SF (match_operand:SF 1 "fr_reg_or_fp01_operand" "fG"))
2800 (match_operand:SF 2 "fr_reg_or_fp01_operand" "fG")
2801 (match_operand:SF 3 "fr_reg_or_signed_fp01_operand" "fZ")))]
2803 "fnma.s %0 = %F1, %F2, %F3"
2804 [(set_attr "itanium_class" "fmac")])
2806 ;; ::::::::::::::::::::
2808 ;; :: 64-bit floating point arithmetic
2810 ;; ::::::::::::::::::::
2812 (define_insn "adddf3"
2813 [(set (match_operand:DF 0 "fr_register_operand" "=f")
2814 (plus:DF (match_operand:DF 1 "fr_reg_or_fp01_operand" "%fG")
2815 (match_operand:DF 2 "fr_reg_or_signed_fp01_operand" "fZ")))]
2817 "fadd.d %0 = %F1, %F2"
2818 [(set_attr "itanium_class" "fmac")])
2820 (define_insn "*adddf3_trunc"
2821 [(set (match_operand:SF 0 "fr_register_operand" "=f")
2823 (plus:DF (match_operand:DF 1 "fr_reg_or_fp01_operand" "%fG")
2824 (match_operand:DF 2 "fr_reg_or_signed_fp01_operand" "fZ"))))]
2826 "fadd.s %0 = %F1, %F2"
2827 [(set_attr "itanium_class" "fmac")])
2829 (define_insn "subdf3"
2830 [(set (match_operand:DF 0 "fr_register_operand" "=f")
2831 (minus:DF (match_operand:DF 1 "fr_reg_or_fp01_operand" "fG")
2832 (match_operand:DF 2 "fr_reg_or_signed_fp01_operand" "fZ")))]
2834 "fsub.d %0 = %F1, %F2"
2835 [(set_attr "itanium_class" "fmac")])
2837 (define_insn "*subdf3_trunc"
2838 [(set (match_operand:SF 0 "fr_register_operand" "=f")
2840 (minus:DF (match_operand:DF 1 "fr_reg_or_fp01_operand" "fG")
2841 (match_operand:DF 2 "fr_reg_or_signed_fp01_operand" "fZ"))))]
2843 "fsub.s %0 = %F1, %F2"
2844 [(set_attr "itanium_class" "fmac")])
2846 (define_insn "muldf3"
2847 [(set (match_operand:DF 0 "fr_register_operand" "=f")
2848 (mult:DF (match_operand:DF 1 "fr_reg_or_fp01_operand" "fG")
2849 (match_operand:DF 2 "fr_reg_or_fp01_operand" "fG")))]
2851 "fmpy.d %0 = %F1, %F2"
2852 [(set_attr "itanium_class" "fmac")])
2854 (define_insn "*muldf3_trunc"
2855 [(set (match_operand:SF 0 "fr_register_operand" "=f")
2857 (mult:DF (match_operand:DF 1 "fr_reg_or_fp01_operand" "fG")
2858 (match_operand:DF 2 "fr_reg_or_fp01_operand" "fG"))))]
2860 "fmpy.s %0 = %F1, %F2"
2861 [(set_attr "itanium_class" "fmac")])
2863 (define_insn "absdf2"
2864 [(set (match_operand:DF 0 "fr_register_operand" "=f")
2865 (abs:DF (match_operand:DF 1 "fr_reg_or_fp01_operand" "fG")))]
2868 [(set_attr "itanium_class" "fmisc")])
2870 (define_insn "negdf2"
2871 [(set (match_operand:DF 0 "fr_register_operand" "=f")
2872 (neg:DF (match_operand:DF 1 "fr_reg_or_fp01_operand" "fG")))]
2875 [(set_attr "itanium_class" "fmisc")])
2877 (define_insn "*nabsdf2"
2878 [(set (match_operand:DF 0 "fr_register_operand" "=f")
2879 (neg:DF (abs:DF (match_operand:DF 1 "fr_reg_or_fp01_operand" "fG"))))]
2882 [(set_attr "itanium_class" "fmisc")])
2884 (define_insn "copysigndf3"
2885 [(set (match_operand:DF 0 "register_operand" "=f")
2886 (unspec:DF [(match_operand:DF 1 "fr_reg_or_fp01_operand" "fG")
2887 (match_operand:DF 2 "fr_reg_or_fp01_operand" "fG")]
2890 "fmerge.s %0 = %F2, %F1"
2891 [(set_attr "itanium_class" "fmisc")])
2893 (define_insn "*ncopysigndf3"
2894 [(set (match_operand:DF 0 "register_operand" "=f")
2895 (neg:DF (unspec:DF [(match_operand:DF 1 "fr_reg_or_fp01_operand" "fG")
2896 (match_operand:DF 2 "fr_reg_or_fp01_operand" "fG")]
2899 "fmerge.ns %0 = %F2, %F1"
2900 [(set_attr "itanium_class" "fmisc")])
2902 (define_insn "smindf3"
2903 [(set (match_operand:DF 0 "fr_register_operand" "=f")
2904 (smin:DF (match_operand:DF 1 "fr_reg_or_fp01_operand" "fG")
2905 (match_operand:DF 2 "fr_reg_or_fp01_operand" "fG")))]
2907 "fmin %0 = %F1, %F2"
2908 [(set_attr "itanium_class" "fmisc")])
2910 (define_insn "smaxdf3"
2911 [(set (match_operand:DF 0 "fr_register_operand" "=f")
2912 (smax:DF (match_operand:DF 1 "fr_reg_or_fp01_operand" "fG")
2913 (match_operand:DF 2 "fr_reg_or_fp01_operand" "fG")))]
2915 "fmax %0 = %F1, %F2"
2916 [(set_attr "itanium_class" "fmisc")])
2918 (define_insn "*nmuldf3"
2919 [(set (match_operand:DF 0 "fr_register_operand" "=f")
2920 (neg:DF (mult:DF (match_operand:DF 1 "fr_reg_or_fp01_operand" "fG")
2921 (match_operand:DF 2 "fr_reg_or_fp01_operand" "fG"))))]
2923 "fnmpy.d %0 = %F1, %F2"
2924 [(set_attr "itanium_class" "fmac")])
2926 (define_insn "*nmuldf3_trunc"
2927 [(set (match_operand:SF 0 "fr_register_operand" "=f")
2929 (neg:DF (mult:DF (match_operand:DF 1 "fr_reg_or_fp01_operand" "fG")
2930 (match_operand:DF 2 "fr_reg_or_fp01_operand" "fG")))))]
2932 "fnmpy.s %0 = %F1, %F2"
2933 [(set_attr "itanium_class" "fmac")])
2935 (define_insn "fmadf4"
2936 [(set (match_operand:DF 0 "fr_register_operand" "=f")
2937 (fma:DF (match_operand:DF 1 "fr_reg_or_fp01_operand" "fG")
2938 (match_operand:DF 2 "fr_reg_or_fp01_operand" "fG")
2939 (match_operand:DF 3 "fr_reg_or_signed_fp01_operand" "fZ")))]
2941 "fma.d %0 = %F1, %F2, %F3"
2942 [(set_attr "itanium_class" "fmac")])
2944 (define_insn "*fmadf_trunc_sf"
2945 [(set (match_operand:SF 0 "fr_register_operand" "=f")
2947 (fma:DF (match_operand:DF 1 "fr_reg_or_fp01_operand" "fG")
2948 (match_operand:DF 2 "fr_reg_or_fp01_operand" "fG")
2949 (match_operand:DF 3 "fr_reg_or_signed_fp01_operand" "fZ"))))]
2951 "fma.s %0 = %F1, %F2, %F3"
2952 [(set_attr "itanium_class" "fmac")])
2954 (define_insn "fmsdf4"
2955 [(set (match_operand:DF 0 "fr_register_operand" "=f")
2956 (fma:DF (match_operand:DF 1 "fr_reg_or_fp01_operand" "fG")
2957 (match_operand:DF 2 "fr_reg_or_fp01_operand" "fG")
2959 (match_operand:DF 3 "fr_reg_or_signed_fp01_operand" "fZ"))))]
2961 "fms.d %0 = %F1, %F2, %F3"
2962 [(set_attr "itanium_class" "fmac")])
2964 (define_insn "*fmsdf_trunc_sf"
2965 [(set (match_operand:SF 0 "fr_register_operand" "=f")
2968 (match_operand:DF 1 "fr_reg_or_fp01_operand" "fG")
2969 (match_operand:DF 2 "fr_reg_or_fp01_operand" "fG")
2971 (match_operand:DF 3 "fr_reg_or_signed_fp01_operand" "fZ")))))]
2973 "fms.s %0 = %F1, %F2, %F3"
2974 [(set_attr "itanium_class" "fmac")])
2976 (define_insn "fnmadf4"
2977 [(set (match_operand:DF 0 "fr_register_operand" "=f")
2978 (fma:DF (neg:DF (match_operand:DF 1 "fr_reg_or_fp01_operand" "fG"))
2979 (match_operand:DF 2 "fr_reg_or_fp01_operand" "fG")
2980 (match_operand:DF 3 "fr_reg_or_signed_fp01_operand" "fZ")))]
2982 "fnma.d %0 = %F1, %F2, %F3"
2983 [(set_attr "itanium_class" "fmac")])
2985 (define_insn "*fnmadf_trunc_sf"
2986 [(set (match_operand:SF 0 "fr_register_operand" "=f")
2989 (neg:DF (match_operand:DF 1 "fr_reg_or_fp01_operand" "fG"))
2990 (match_operand:DF 2 "fr_reg_or_fp01_operand" "fG")
2991 (match_operand:DF 3 "fr_reg_or_signed_fp01_operand" "fZ"))))]
2993 "fnma.s %0 = %F1, %F2, %F3"
2994 [(set_attr "itanium_class" "fmac")])
2996 ;; ::::::::::::::::::::
2998 ;; :: 80-bit floating point arithmetic
3000 ;; ::::::::::::::::::::
3002 (define_insn "addxf3"
3003 [(set (match_operand:XF 0 "fr_register_operand" "=f")
3004 (plus:XF (match_operand:XF 1 "xfreg_or_fp01_operand" "%fG")
3005 (match_operand:XF 2 "xfreg_or_signed_fp01_operand" "fZ")))]
3007 "fadd %0 = %F1, %F2"
3008 [(set_attr "itanium_class" "fmac")])
3010 (define_insn "*addxf3_truncsf"
3011 [(set (match_operand:SF 0 "fr_register_operand" "=f")
3013 (plus:XF (match_operand:XF 1 "xfreg_or_fp01_operand" "%fG")
3014 (match_operand:XF 2 "xfreg_or_signed_fp01_operand" "fZ"))))]
3016 "fadd.s %0 = %F1, %F2"
3017 [(set_attr "itanium_class" "fmac")])
3019 (define_insn "*addxf3_truncdf"
3020 [(set (match_operand:DF 0 "fr_register_operand" "=f")
3022 (plus:XF (match_operand:XF 1 "xfreg_or_fp01_operand" "%fG")
3023 (match_operand:XF 2 "xfreg_or_signed_fp01_operand" "fZ"))))]
3025 "fadd.d %0 = %F1, %F2"
3026 [(set_attr "itanium_class" "fmac")])
3028 (define_insn "subxf3"
3029 [(set (match_operand:XF 0 "fr_register_operand" "=f")
3030 (minus:XF (match_operand:XF 1 "xfreg_or_fp01_operand" "fG")
3031 (match_operand:XF 2 "xfreg_or_signed_fp01_operand" "fZ")))]
3033 "fsub %0 = %F1, %F2"
3034 [(set_attr "itanium_class" "fmac")])
3036 (define_insn "*subxf3_truncsf"
3037 [(set (match_operand:SF 0 "fr_register_operand" "=f")
3039 (minus:XF (match_operand:XF 1 "xfreg_or_fp01_operand" "fG")
3040 (match_operand:XF 2 "xfreg_or_signed_fp01_operand" "fZ"))))]
3042 "fsub.s %0 = %F1, %F2"
3043 [(set_attr "itanium_class" "fmac")])
3045 (define_insn "*subxf3_truncdf"
3046 [(set (match_operand:DF 0 "fr_register_operand" "=f")
3048 (minus:XF (match_operand:XF 1 "xfreg_or_fp01_operand" "fG")
3049 (match_operand:XF 2 "xfreg_or_signed_fp01_operand" "fZ"))))]
3051 "fsub.d %0 = %F1, %F2"
3052 [(set_attr "itanium_class" "fmac")])
3054 (define_insn "mulxf3"
3055 [(set (match_operand:XF 0 "fr_register_operand" "=f")
3056 (mult:XF (match_operand:XF 1 "xfreg_or_fp01_operand" "fG")
3057 (match_operand:XF 2 "xfreg_or_fp01_operand" "fG")))]
3059 "fmpy %0 = %F1, %F2"
3060 [(set_attr "itanium_class" "fmac")])
3062 (define_insn "*mulxf3_truncsf"
3063 [(set (match_operand:SF 0 "fr_register_operand" "=f")
3065 (mult:XF (match_operand:XF 1 "xfreg_or_fp01_operand" "fG")
3066 (match_operand:XF 2 "xfreg_or_fp01_operand" "fG"))))]
3068 "fmpy.s %0 = %F1, %F2"
3069 [(set_attr "itanium_class" "fmac")])
3071 (define_insn "*mulxf3_truncdf"
3072 [(set (match_operand:DF 0 "fr_register_operand" "=f")
3074 (mult:XF (match_operand:XF 1 "xfreg_or_fp01_operand" "fG")
3075 (match_operand:XF 2 "xfreg_or_fp01_operand" "fG"))))]
3077 "fmpy.d %0 = %F1, %F2"
3078 [(set_attr "itanium_class" "fmac")])
3080 (define_insn "absxf2"
3081 [(set (match_operand:XF 0 "fr_register_operand" "=f")
3082 (abs:XF (match_operand:XF 1 "xfreg_or_fp01_operand" "fG")))]
3085 [(set_attr "itanium_class" "fmisc")])
3087 (define_insn "negxf2"
3088 [(set (match_operand:XF 0 "fr_register_operand" "=f")
3089 (neg:XF (match_operand:XF 1 "xfreg_or_fp01_operand" "fG")))]
3092 [(set_attr "itanium_class" "fmisc")])
3094 (define_insn "*nabsxf2"
3095 [(set (match_operand:XF 0 "fr_register_operand" "=f")
3096 (neg:XF (abs:XF (match_operand:XF 1 "xfreg_or_fp01_operand" "fG"))))]
3099 [(set_attr "itanium_class" "fmisc")])
3101 (define_insn "copysignxf3"
3102 [(set (match_operand:XF 0 "register_operand" "=f")
3103 (unspec:XF [(match_operand:XF 1 "fr_reg_or_fp01_operand" "fG")
3104 (match_operand:XF 2 "fr_reg_or_fp01_operand" "fG")]
3107 "fmerge.s %0 = %F2, %F1"
3108 [(set_attr "itanium_class" "fmisc")])
3110 (define_insn "*ncopysignxf3"
3111 [(set (match_operand:XF 0 "register_operand" "=f")
3112 (neg:XF (unspec:XF [(match_operand:XF 1 "fr_reg_or_fp01_operand" "fG")
3113 (match_operand:XF 2 "fr_reg_or_fp01_operand" "fG")]
3116 "fmerge.ns %0 = %F2, %F1"
3117 [(set_attr "itanium_class" "fmisc")])
3119 (define_insn "sminxf3"
3120 [(set (match_operand:XF 0 "fr_register_operand" "=f")
3121 (smin:XF (match_operand:XF 1 "xfreg_or_fp01_operand" "fG")
3122 (match_operand:XF 2 "xfreg_or_fp01_operand" "fG")))]
3124 "fmin %0 = %F1, %F2"
3125 [(set_attr "itanium_class" "fmisc")])
3127 (define_insn "smaxxf3"
3128 [(set (match_operand:XF 0 "fr_register_operand" "=f")
3129 (smax:XF (match_operand:XF 1 "xfreg_or_fp01_operand" "fG")
3130 (match_operand:XF 2 "xfreg_or_fp01_operand" "fG")))]
3132 "fmax %0 = %F1, %F2"
3133 [(set_attr "itanium_class" "fmisc")])
3135 (define_insn "*nmulxf3"
3136 [(set (match_operand:XF 0 "fr_register_operand" "=f")
3137 (neg:XF (mult:XF (match_operand:XF 1 "xfreg_or_fp01_operand" "fG")
3138 (match_operand:XF 2 "xfreg_or_fp01_operand" "fG"))))]
3140 "fnmpy %0 = %F1, %F2"
3141 [(set_attr "itanium_class" "fmac")])
3143 (define_insn "*nmulxf3_truncsf"
3144 [(set (match_operand:SF 0 "fr_register_operand" "=f")
3147 (match_operand:XF 1 "xfreg_or_fp01_operand" "fG")
3148 (match_operand:XF 2 "xfreg_or_fp01_operand" "fG")))))]
3150 "fnmpy.s %0 = %F1, %F2"
3151 [(set_attr "itanium_class" "fmac")])
3153 (define_insn "*nmulxf3_truncdf"
3154 [(set (match_operand:DF 0 "fr_register_operand" "=f")
3157 (match_operand:XF 1 "xfreg_or_fp01_operand" "fG")
3158 (match_operand:XF 2 "xfreg_or_fp01_operand" "fG")))))]
3160 "fnmpy.d %0 = %F1, %F2"
3161 [(set_attr "itanium_class" "fmac")])
3163 (define_insn "fmaxf4"
3164 [(set (match_operand:XF 0 "fr_register_operand" "=f")
3165 (fma:XF (match_operand:XF 1 "fr_reg_or_fp01_operand" "fG")
3166 (match_operand:XF 2 "fr_reg_or_fp01_operand" "fG")
3167 (match_operand:XF 3 "fr_reg_or_signed_fp01_operand" "fZ")))]
3169 "fma %0 = %F1, %F2, %F3"
3170 [(set_attr "itanium_class" "fmac")])
3172 (define_insn "*fmaxf_trunc_<mode>"
3173 [(set (match_operand:MODE_SDF 0 "fr_register_operand" "=f")
3174 (float_truncate:MODE_SDF
3176 (match_operand:XF 1 "fr_reg_or_fp01_operand" "fG")
3177 (match_operand:XF 2 "fr_reg_or_fp01_operand" "fG")
3178 (match_operand:XF 3 "fr_reg_or_signed_fp01_operand" "fZ"))))]
3180 "fma<suffix> %0 = %F1, %F2, %F3"
3181 [(set_attr "itanium_class" "fmac")])
3183 (define_insn "fmsxf4"
3184 [(set (match_operand:XF 0 "fr_register_operand" "=f")
3185 (fma:XF (match_operand:XF 1 "fr_reg_or_fp01_operand" "fG")
3186 (match_operand:XF 2 "fr_reg_or_fp01_operand" "fG")
3188 (match_operand:XF 3 "fr_reg_or_signed_fp01_operand" "fZ"))))]
3190 "fms %0 = %F1, %F2, %F3"
3191 [(set_attr "itanium_class" "fmac")])
3193 (define_insn "*fmsxf_trunc_<mode>"
3194 [(set (match_operand:MODE_SDF 0 "fr_register_operand" "=f")
3195 (float_truncate:MODE_SDF
3197 (match_operand:XF 1 "fr_reg_or_fp01_operand" "fG")
3198 (match_operand:XF 2 "fr_reg_or_fp01_operand" "fG")
3200 (match_operand:XF 3 "fr_reg_or_signed_fp01_operand" "fZ")))))]
3202 "fms<suffix> %0 = %F1, %F2, %F3"
3203 [(set_attr "itanium_class" "fmac")])
3205 (define_insn "fnmaxf4"
3206 [(set (match_operand:XF 0 "fr_register_operand" "=f")
3207 (fma:XF (neg:XF (match_operand:XF 1 "fr_reg_or_fp01_operand" "fG"))
3208 (match_operand:XF 2 "fr_reg_or_fp01_operand" "fG")
3209 (match_operand:XF 3 "fr_reg_or_signed_fp01_operand" "fZ")))]
3211 "fnma %0 = %F1, %F2, %F3"
3212 [(set_attr "itanium_class" "fmac")])
3214 (define_insn "*fnmaxf_trunc_<mode>"
3215 [(set (match_operand:MODE_SDF 0 "fr_register_operand" "=f")
3216 (float_truncate:MODE_SDF
3218 (neg:XF (match_operand:XF 1 "fr_reg_or_fp01_operand" "fG"))
3219 (match_operand:XF 2 "fr_reg_or_fp01_operand" "fG")
3220 (match_operand:XF 3 "fr_reg_or_signed_fp01_operand" "fZ"))))]
3222 "fnma<suffix> %0 = %F1, %F2, %F3"
3223 [(set_attr "itanium_class" "fmac")])
3225 ;; ::::::::::::::::::::
3227 ;; :: 32-bit Integer Shifts and Rotates
3229 ;; ::::::::::::::::::::
3231 (define_expand "ashlsi3"
3232 [(set (match_operand:SI 0 "gr_register_operand" "")
3233 (ashift:SI (match_operand:SI 1 "gr_register_operand" "")
3234 (match_operand:SI 2 "gr_reg_or_5bit_operand" "")))]
3237 if (GET_CODE (operands[2]) != CONST_INT)
3239 /* Why oh why didn't Intel arrange for SHIFT_COUNT_TRUNCATED? Now
3240 we've got to get rid of stray bits outside the SImode register. */
3241 rtx subshift = gen_reg_rtx (DImode);
3242 emit_insn (gen_zero_extendsidi2 (subshift, operands[2]));
3243 operands[2] = subshift;
3247 (define_insn "*ashlsi3_internal"
3248 [(set (match_operand:SI 0 "gr_register_operand" "=r,r,r")
3249 (ashift:SI (match_operand:SI 1 "gr_register_operand" "r,r,r")
3250 (match_operand:DI 2 "gr_reg_or_5bit_operand" "R,n,r")))]
3253 shladd %0 = %1, %2, r0
3254 dep.z %0 = %1, %2, %E2
3256 [(set_attr "itanium_class" "ialu,ishf,mmshf")])
3258 (define_expand "ashrsi3"
3259 [(set (match_operand:SI 0 "gr_register_operand" "")
3260 (ashiftrt:SI (match_operand:SI 1 "gr_register_operand" "")
3261 (match_operand:SI 2 "gr_reg_or_5bit_operand" "")))]
3264 rtx subtarget = gen_reg_rtx (DImode);
3265 if (GET_CODE (operands[2]) == CONST_INT)
3266 emit_insn (gen_extv (subtarget, gen_lowpart (DImode, operands[1]),
3267 GEN_INT (32 - INTVAL (operands[2])), operands[2]));
3270 rtx subshift = gen_reg_rtx (DImode);
3271 emit_insn (gen_extendsidi2 (subtarget, operands[1]));
3272 emit_insn (gen_zero_extendsidi2 (subshift, operands[2]));
3273 emit_insn (gen_ashrdi3 (subtarget, subtarget, subshift));
3275 emit_move_insn (gen_lowpart (DImode, operands[0]), subtarget);
3279 (define_expand "lshrsi3"
3280 [(set (match_operand:SI 0 "gr_register_operand" "")
3281 (lshiftrt:SI (match_operand:SI 1 "gr_register_operand" "")
3282 (match_operand:SI 2 "gr_reg_or_5bit_operand" "")))]
3285 rtx subtarget = gen_reg_rtx (DImode);
3286 if (GET_CODE (operands[2]) == CONST_INT)
3287 emit_insn (gen_extzv (subtarget, gen_lowpart (DImode, operands[1]),
3288 GEN_INT (32 - INTVAL (operands[2])), operands[2]));
3291 rtx subshift = gen_reg_rtx (DImode);
3292 emit_insn (gen_zero_extendsidi2 (subtarget, operands[1]));
3293 emit_insn (gen_zero_extendsidi2 (subshift, operands[2]));
3294 emit_insn (gen_lshrdi3 (subtarget, subtarget, subshift));
3296 emit_move_insn (gen_lowpart (DImode, operands[0]), subtarget);
3300 ;; Use mix4.r/shr to implement rotrsi3. We only get 32 bits of valid result
3301 ;; here, instead of 64 like the patterns above. Keep the pattern together
3302 ;; until after combine; otherwise it won't get matched often.
3304 (define_expand "rotrsi3"
3305 [(set (match_operand:SI 0 "gr_register_operand" "")
3306 (rotatert:SI (match_operand:SI 1 "gr_register_operand" "")
3307 (match_operand:SI 2 "gr_reg_or_5bit_operand" "")))]
3310 if (GET_MODE (operands[2]) != VOIDmode)
3312 rtx tmp = gen_reg_rtx (DImode);
3313 emit_insn (gen_zero_extendsidi2 (tmp, operands[2]));
3318 (define_insn_and_split "*rotrsi3_internal"
3319 [(set (match_operand:SI 0 "gr_register_operand" "=&r")
3320 (rotatert:SI (match_operand:SI 1 "gr_register_operand" "r")
3321 (match_operand:DI 2 "gr_reg_or_5bit_operand" "rM")))]
3326 (ior:DI (zero_extend:DI (match_dup 1))
3327 (ashift:DI (zero_extend:DI (match_dup 1)) (const_int 32))))
3329 (lshiftrt:DI (match_dup 3) (match_dup 2)))]
3330 "operands[3] = gen_rtx_REG (DImode, REGNO (operands[0]));")
3332 (define_expand "rotlsi3"
3333 [(set (match_operand:SI 0 "gr_register_operand" "")
3334 (rotate:SI (match_operand:SI 1 "gr_register_operand" "")
3335 (match_operand:SI 2 "gr_reg_or_5bit_operand" "")))]
3338 if (! shift_32bit_count_operand (operands[2], SImode))
3340 rtx tmp = gen_reg_rtx (SImode);
3341 emit_insn (gen_subsi3 (tmp, GEN_INT (32), operands[2]));
3342 emit_insn (gen_rotrsi3 (operands[0], operands[1], tmp));
3347 (define_insn_and_split "*rotlsi3_internal"
3348 [(set (match_operand:SI 0 "gr_register_operand" "=r")
3349 (rotate:SI (match_operand:SI 1 "gr_register_operand" "r")
3350 (match_operand:SI 2 "shift_32bit_count_operand" "n")))]
3352 "mux2 %0 = %1, 0xe1"
3353 "reload_completed && INTVAL (operands[2]) != 16"
3355 (ior:DI (zero_extend:DI (match_dup 1))
3356 (ashift:DI (zero_extend:DI (match_dup 1)) (const_int 32))))
3358 (lshiftrt:DI (match_dup 3) (match_dup 2)))]
3360 operands[3] = gen_rtx_REG (DImode, REGNO (operands[0]));
3361 operands[2] = GEN_INT (32 - INTVAL (operands[2]));
3363 [(set_attr "itanium_class" "mmshf")])
3365 ;; ::::::::::::::::::::
3367 ;; :: 64-bit Integer Shifts and Rotates
3369 ;; ::::::::::::::::::::
3371 (define_insn "ashldi3"
3372 [(set (match_operand:DI 0 "gr_register_operand" "=r,r,r")
3373 (ashift:DI (match_operand:DI 1 "gr_register_operand" "r,r,r")
3374 (match_operand:DI 2 "gr_reg_or_6bit_operand" "R,r,rM")))]
3377 shladd %0 = %1, %2, r0
3380 [(set_attr "itanium_class" "ialu,mmshf,mmshfi")])
3382 ;; ??? Maybe combine this with the multiply and add instruction?
3384 (define_insn "*shladd"
3385 [(set (match_operand:DI 0 "gr_register_operand" "=r")
3386 (plus:DI (mult:DI (match_operand:DI 1 "gr_register_operand" "r")
3387 (match_operand:DI 2 "shladd_operand" "n"))
3388 (match_operand:DI 3 "gr_register_operand" "r")))]
3390 "shladd %0 = %1, %S2, %3"
3391 [(set_attr "itanium_class" "ialu")])
3393 ;; This can be created by register elimination if operand3 of shladd is an
3394 ;; eliminable register or has reg_equiv_constant set.
3396 ;; We have to use nonmemory_operand for operand 4, to ensure that the
3397 ;; validate_changes call inside eliminate_regs will always succeed. If it
3398 ;; doesn't succeed, then this remain a shladd pattern, and will be reloaded
3401 (define_insn_and_split "*shladd_elim"
3402 [(set (match_operand:DI 0 "gr_register_operand" "=&r")
3403 (plus:DI (plus:DI (mult:DI (match_operand:DI 1 "gr_register_operand" "r")
3404 (match_operand:DI 2 "shladd_operand" "n"))
3405 (match_operand:DI 3 "nonmemory_operand" "r"))
3406 (match_operand:DI 4 "nonmemory_operand" "rI")))]
3407 "reload_in_progress"
3408 "* gcc_unreachable ();"
3410 [(set (match_dup 0) (plus:DI (mult:DI (match_dup 1) (match_dup 2))
3412 (set (match_dup 0) (plus:DI (match_dup 0) (match_dup 4)))]
3414 [(set_attr "itanium_class" "unknown")])
3416 (define_insn "ashrdi3"
3417 [(set (match_operand:DI 0 "gr_register_operand" "=r,r")
3418 (ashiftrt:DI (match_operand:DI 1 "gr_register_operand" "r,r")
3419 (match_operand:DI 2 "gr_reg_or_6bit_operand" "r,rM")))]
3424 [(set_attr "itanium_class" "mmshf,mmshfi")])
3426 (define_insn "lshrdi3"
3427 [(set (match_operand:DI 0 "gr_register_operand" "=r,r")
3428 (lshiftrt:DI (match_operand:DI 1 "gr_register_operand" "r,r")
3429 (match_operand:DI 2 "gr_reg_or_6bit_operand" "r,rM")))]
3434 [(set_attr "itanium_class" "mmshf,mmshfi")])
3436 ;; Using a predicate that accepts only constants doesn't work, because optabs
3437 ;; will load the operand into a register and call the pattern if the predicate
3438 ;; did not accept it on the first try. So we use nonmemory_operand and then
3439 ;; verify that we have an appropriate constant in the expander.
3441 (define_expand "rotrdi3"
3442 [(set (match_operand:DI 0 "gr_register_operand" "")
3443 (rotatert:DI (match_operand:DI 1 "gr_register_operand" "")
3444 (match_operand:DI 2 "nonmemory_operand" "")))]
3447 if (! shift_count_operand (operands[2], DImode))
3451 (define_insn "*rotrdi3_internal"
3452 [(set (match_operand:DI 0 "gr_register_operand" "=r")
3453 (rotatert:DI (match_operand:DI 1 "gr_register_operand" "r")
3454 (match_operand:DI 2 "shift_count_operand" "M")))]
3456 "shrp %0 = %1, %1, %2"
3457 [(set_attr "itanium_class" "ishf")])
3459 (define_expand "rotldi3"
3460 [(set (match_operand:DI 0 "gr_register_operand" "")
3461 (rotate:DI (match_operand:DI 1 "gr_register_operand" "")
3462 (match_operand:DI 2 "nonmemory_operand" "")))]
3465 if (! shift_count_operand (operands[2], DImode))
3469 (define_insn "*rotldi3_internal"
3470 [(set (match_operand:DI 0 "gr_register_operand" "=r")
3471 (rotate:DI (match_operand:DI 1 "gr_register_operand" "r")
3472 (match_operand:DI 2 "shift_count_operand" "M")))]
3474 "shrp %0 = %1, %1, %e2"
3475 [(set_attr "itanium_class" "ishf")])
3477 ;; ::::::::::::::::::::
3479 ;; :: 128-bit Integer Shifts and Rotates
3481 ;; ::::::::::::::::::::
3483 (define_expand "ashlti3"
3484 [(set (match_operand:TI 0 "gr_register_operand" "")
3485 (ashift:TI (match_operand:TI 1 "gr_register_operand" "")
3486 (match_operand:DI 2 "nonmemory_operand" "")))]
3489 if (!dshift_count_operand (operands[2], DImode))
3493 (define_insn_and_split "*ashlti3_internal"
3494 [(set (match_operand:TI 0 "gr_register_operand" "=&r")
3495 (ashift:TI (match_operand:TI 1 "gr_register_operand" "r")
3496 (match_operand:DI 2 "dshift_count_operand" "n")))]
3502 HOST_WIDE_INT shift = INTVAL (operands[2]);
3503 rtx rl = gen_lowpart (DImode, operands[0]);
3504 rtx rh = gen_highpart (DImode, operands[0]);
3505 rtx lo = gen_lowpart (DImode, operands[1]);
3506 rtx shiftlo = GEN_INT (shift & 63);
3510 emit_move_insn (rl, const0_rtx);
3512 emit_insn (gen_ashldi3 (rh, lo, shiftlo));
3514 emit_move_insn (rh, lo);
3518 rtx hi = gen_highpart (DImode, operands[1]);
3520 emit_insn (gen_shrp (rh, hi, lo, GEN_INT (-shift & 63)));
3521 emit_insn (gen_ashldi3 (rl, lo, shiftlo));
3526 (define_expand "ashrti3"
3527 [(set (match_operand:TI 0 "gr_register_operand" "")
3528 (ashiftrt:TI (match_operand:TI 1 "gr_register_operand" "")
3529 (match_operand:DI 2 "nonmemory_operand" "")))]
3532 if (!dshift_count_operand (operands[2], DImode))
3536 (define_insn_and_split "*ashrti3_internal"
3537 [(set (match_operand:TI 0 "gr_register_operand" "=&r")
3538 (ashiftrt:TI (match_operand:TI 1 "gr_register_operand" "r")
3539 (match_operand:DI 2 "dshift_count_operand" "n")))]
3545 HOST_WIDE_INT shift = INTVAL (operands[2]);
3546 rtx rl = gen_lowpart (DImode, operands[0]);
3547 rtx rh = gen_highpart (DImode, operands[0]);
3548 rtx hi = gen_highpart (DImode, operands[1]);
3549 rtx shiftlo = GEN_INT (shift & 63);
3554 emit_insn (gen_ashrdi3 (rl, hi, shiftlo));
3556 emit_move_insn (rl, hi);
3557 emit_insn (gen_ashrdi3 (rh, hi, GEN_INT (63)));
3561 rtx lo = gen_lowpart (DImode, operands[1]);
3563 emit_insn (gen_shrp (rl, hi, lo, shiftlo));
3564 emit_insn (gen_ashrdi3 (rh, hi, shiftlo));
3569 (define_expand "lshrti3"
3570 [(set (match_operand:TI 0 "gr_register_operand" "")
3571 (lshiftrt:TI (match_operand:TI 1 "gr_register_operand" "")
3572 (match_operand:DI 2 "nonmemory_operand" "")))]
3575 if (!dshift_count_operand (operands[2], DImode))
3579 (define_insn_and_split "*lshrti3_internal"
3580 [(set (match_operand:TI 0 "gr_register_operand" "=&r")
3581 (lshiftrt:TI (match_operand:TI 1 "gr_register_operand" "r")
3582 (match_operand:DI 2 "dshift_count_operand" "n")))]
3588 HOST_WIDE_INT shift = INTVAL (operands[2]);
3589 rtx rl = gen_lowpart (DImode, operands[0]);
3590 rtx rh = gen_highpart (DImode, operands[0]);
3591 rtx hi = gen_highpart (DImode, operands[1]);
3592 rtx shiftlo = GEN_INT (shift & 63);
3597 emit_insn (gen_lshrdi3 (rl, hi, shiftlo));
3599 emit_move_insn (rl, hi);
3600 emit_move_insn (rh, const0_rtx);
3604 rtx lo = gen_lowpart (DImode, operands[1]);
3606 emit_insn (gen_shrp (rl, hi, lo, shiftlo));
3607 emit_insn (gen_lshrdi3 (rh, hi, shiftlo));
3612 (define_expand "rotlti3"
3613 [(set (match_operand:TI 0 "gr_register_operand" "")
3614 (rotate:TI (match_operand:TI 1 "gr_register_operand" "")
3615 (match_operand:DI 2 "nonmemory_operand" "")))]
3618 if (! dshift_count_operand (operands[2], DImode))
3622 (define_insn_and_split "*rotlti3_internal"
3623 [(set (match_operand:TI 0 "gr_register_operand" "=&r")
3624 (rotate:TI (match_operand:TI 1 "gr_register_operand" "r")
3625 (match_operand:DI 2 "dshift_count_operand" "n")))]
3631 HOST_WIDE_INT count = INTVAL (operands[2]);
3632 rtx rl = gen_lowpart (DImode, operands[0]);
3633 rtx rh = gen_highpart (DImode, operands[0]);
3634 rtx lo = gen_lowpart (DImode, operands[1]);
3635 rtx hi = gen_highpart (DImode, operands[1]);
3636 rtx countlo = GEN_INT (-count & 63);
3642 emit_insn (gen_shrp (rl, hi, lo, countlo));
3643 emit_insn (gen_shrp (rh, lo, hi, countlo));
3647 emit_move_insn (rl, hi);
3648 emit_move_insn (rh, lo);
3653 emit_insn (gen_shrp (rl, lo, hi, countlo));
3654 emit_insn (gen_shrp (rh, hi, lo, countlo));
3658 [(set_attr "itanium_class" "unknown")])
3661 [(set (match_operand:DI 0 "gr_register_operand" "=r")
3662 (unspec:DI [(match_operand:DI 1 "gr_register_operand" "r")
3663 (match_operand:DI 2 "gr_register_operand" "r")
3664 (match_operand:DI 3 "shift_count_operand" "M")]
3667 "shrp %0 = %1, %2, %3"
3668 [(set_attr "itanium_class" "ishf")])
3670 ;; ::::::::::::::::::::
3672 ;; :: 32-bit Integer Logical operations
3674 ;; ::::::::::::::::::::
3676 ;; We don't seem to need any other 32-bit logical operations, because gcc
3677 ;; generates zero-extend;zero-extend;DImode-op, which combine optimizes to
3678 ;; DImode-op;zero-extend, and then we can optimize away the zero-extend.
3679 ;; This doesn't work for unary logical operations, because we don't call
3680 ;; apply_distributive_law for them.
3682 ;; ??? Likewise, this doesn't work for andnot, which isn't handled by
3683 ;; apply_distributive_law. We get inefficient code for
3684 ;; int sub4 (int i, int j) { return i & ~j; }
3685 ;; We could convert (and (not (sign_extend A)) (sign_extend B)) to
3686 ;; (zero_extend (and (not A) B)) in combine.
3687 ;; Or maybe fix this by adding andsi3/iorsi3/xorsi3 patterns like the
3688 ;; one_cmplsi2 pattern.
3690 (define_insn "one_cmplsi2"
3691 [(set (match_operand:SI 0 "gr_register_operand" "=r")
3692 (not:SI (match_operand:SI 1 "gr_register_operand" "r")))]
3695 [(set_attr "itanium_class" "ilog")])
3697 ;; ::::::::::::::::::::
3699 ;; :: 64-bit Integer Logical operations
3701 ;; ::::::::::::::::::::
3703 (define_insn "anddi3"
3704 [(set (match_operand:DI 0 "grfr_register_operand" "=r,*f")
3705 (and:DI (match_operand:DI 1 "grfr_register_operand" "%r,*f")
3706 (match_operand:DI 2 "grfr_reg_or_8bit_operand" "rK,*f")))]
3711 [(set_attr "itanium_class" "ilog,fmisc")])
3713 (define_insn "*andnot"
3714 [(set (match_operand:DI 0 "grfr_register_operand" "=r,*f")
3715 (and:DI (not:DI (match_operand:DI 1 "grfr_register_operand" "r,*f"))
3716 (match_operand:DI 2 "grfr_reg_or_8bit_operand" "rK,*f")))]
3721 [(set_attr "itanium_class" "ilog,fmisc")])
3723 (define_insn "iordi3"
3724 [(set (match_operand:DI 0 "grfr_register_operand" "=r,*f")
3725 (ior:DI (match_operand:DI 1 "grfr_register_operand" "%r,*f")
3726 (match_operand:DI 2 "grfr_reg_or_8bit_operand" "rK,*f")))]
3731 [(set_attr "itanium_class" "ilog,fmisc")])
3733 (define_insn "xordi3"
3734 [(set (match_operand:DI 0 "grfr_register_operand" "=r,*f")
3735 (xor:DI (match_operand:DI 1 "grfr_register_operand" "%r,*f")
3736 (match_operand:DI 2 "grfr_reg_or_8bit_operand" "rK,*f")))]
3741 [(set_attr "itanium_class" "ilog,fmisc")])
3743 (define_insn "one_cmpldi2"
3744 [(set (match_operand:DI 0 "gr_register_operand" "=r")
3745 (not:DI (match_operand:DI 1 "gr_register_operand" "r")))]
3748 [(set_attr "itanium_class" "ilog")])
3750 ;; ::::::::::::::::::::
3754 ;; ::::::::::::::::::::
3756 (define_expand "cbranchbi4"
3758 (if_then_else (match_operator 0 "ia64_cbranch_operator"
3759 [(match_operand:BI 1 "register_operand" "")
3760 (match_operand:BI 2 "const_int_operand" "")])
3761 (label_ref (match_operand 3 "" ""))
3764 "ia64_expand_compare (&operands[0], &operands[1], &operands[2]);")
3766 (define_expand "cbranchsi4"
3768 (if_then_else (match_operator 0 "ia64_cbranch_operator"
3769 [(match_operand:SI 1 "gr_register_operand" "")
3770 (match_operand:SI 2 "gr_reg_or_8bit_and_adjusted_operand" "")])
3771 (label_ref (match_operand 3 "" ""))
3774 "ia64_expand_compare (&operands[0], &operands[1], &operands[2]);")
3776 (define_expand "cbranchdi4"
3778 (if_then_else (match_operator 0 "ia64_cbranch_operator"
3779 [(match_operand:DI 1 "gr_register_operand" "")
3780 (match_operand:DI 2 "gr_reg_or_8bit_and_adjusted_operand" "")])
3781 (label_ref (match_operand 3 "" ""))
3784 "ia64_expand_compare (&operands[0], &operands[1], &operands[2]);")
3786 (define_expand "cbranchsf4"
3788 (if_then_else (match_operator 0 "ia64_cbranch_operator"
3789 [(match_operand:SF 1 "fr_reg_or_fp01_operand" "")
3790 (match_operand:SF 2 "fr_reg_or_fp01_operand" "")])
3791 (label_ref (match_operand 3 "" ""))
3794 "ia64_expand_compare (&operands[0], &operands[1], &operands[2]);")
3796 (define_expand "cbranchdf4"
3798 (if_then_else (match_operator 0 "ia64_cbranch_operator"
3799 [(match_operand:DF 1 "fr_reg_or_fp01_operand" "")
3800 (match_operand:DF 2 "fr_reg_or_fp01_operand" "")])
3801 (label_ref (match_operand 3 "" ""))
3804 "ia64_expand_compare (&operands[0], &operands[1], &operands[2]);")
3806 (define_expand "cbranchxf4"
3808 (if_then_else (match_operator 0 "ia64_cbranch_operator"
3809 [(match_operand:XF 1 "xfreg_or_fp01_operand" "")
3810 (match_operand:XF 2 "xfreg_or_fp01_operand" "")])
3811 (label_ref (match_operand 3 "" ""))
3814 "ia64_expand_compare (&operands[0], &operands[1], &operands[2]);")
3816 (define_expand "cbranchtf4"
3818 (if_then_else (match_operator 0 "ia64_cbranch_operator"
3819 [(match_operand:TF 1 "gr_register_operand" "")
3820 (match_operand:TF 2 "gr_register_operand" "")])
3821 (label_ref (match_operand 3 "" ""))
3824 "ia64_expand_compare (&operands[0], &operands[1], &operands[2]);")
3827 (define_insn "*cmpsi_normal"
3828 [(set (match_operand:BI 0 "register_operand" "=c")
3829 (match_operator:BI 1 "normal_comparison_operator"
3830 [(match_operand:SI 2 "gr_register_operand" "r")
3831 (match_operand:SI 3 "gr_reg_or_8bit_operand" "rK")]))]
3833 "cmp4.%C1 %0, %I0 = %3, %2"
3834 [(set_attr "itanium_class" "icmp")])
3836 ;; We use %r3 because it is possible for us to match a 0, and two of the
3837 ;; unsigned comparisons don't accept immediate operands of zero.
3839 (define_insn "*cmpsi_adjusted"
3840 [(set (match_operand:BI 0 "register_operand" "=c")
3841 (match_operator:BI 1 "adjusted_comparison_operator"
3842 [(match_operand:SI 2 "gr_register_operand" "r")
3843 (match_operand:SI 3 "gr_reg_or_8bit_adjusted_operand" "rL")]))]
3845 "cmp4.%C1 %0, %I0 = %r3, %2"
3846 [(set_attr "itanium_class" "icmp")])
3848 (define_insn "*cmpdi_normal"
3849 [(set (match_operand:BI 0 "register_operand" "=c")
3850 (match_operator:BI 1 "normal_comparison_operator"
3851 [(match_operand:DI 2 "gr_reg_or_0_operand" "rO")
3852 (match_operand:DI 3 "gr_reg_or_8bit_operand" "rK")]))]
3854 "cmp.%C1 %0, %I0 = %3, %r2"
3855 [(set_attr "itanium_class" "icmp")])
3857 ;; We use %r3 because it is possible for us to match a 0, and two of the
3858 ;; unsigned comparisons don't accept immediate operands of zero.
3860 (define_insn "*cmpdi_adjusted"
3861 [(set (match_operand:BI 0 "register_operand" "=c")
3862 (match_operator:BI 1 "adjusted_comparison_operator"
3863 [(match_operand:DI 2 "gr_register_operand" "r")
3864 (match_operand:DI 3 "gr_reg_or_8bit_adjusted_operand" "rL")]))]
3866 "cmp.%C1 %0, %I0 = %r3, %2"
3867 [(set_attr "itanium_class" "icmp")])
3869 (define_insn "*cmpsf_internal"
3870 [(set (match_operand:BI 0 "register_operand" "=c")
3871 (match_operator:BI 1 "comparison_operator"
3872 [(match_operand:SF 2 "fr_reg_or_fp01_operand" "fG")
3873 (match_operand:SF 3 "fr_reg_or_fp01_operand" "fG")]))]
3875 "fcmp.%D1 %0, %I0 = %F2, %F3"
3876 [(set_attr "itanium_class" "fcmp")])
3878 (define_insn "*cmpdf_internal"
3879 [(set (match_operand:BI 0 "register_operand" "=c")
3880 (match_operator:BI 1 "comparison_operator"
3881 [(match_operand:DF 2 "fr_reg_or_fp01_operand" "fG")
3882 (match_operand:DF 3 "fr_reg_or_fp01_operand" "fG")]))]
3884 "fcmp.%D1 %0, %I0 = %F2, %F3"
3885 [(set_attr "itanium_class" "fcmp")])
3887 (define_insn "*cmpxf_internal"
3888 [(set (match_operand:BI 0 "register_operand" "=c")
3889 (match_operator:BI 1 "comparison_operator"
3890 [(match_operand:XF 2 "xfreg_or_fp01_operand" "fG")
3891 (match_operand:XF 3 "xfreg_or_fp01_operand" "fG")]))]
3893 "fcmp.%D1 %0, %I0 = %F2, %F3"
3894 [(set_attr "itanium_class" "fcmp")])
3896 ;; ??? Can this pattern be generated?
3898 (define_insn "*bit_zero"
3899 [(set (match_operand:BI 0 "register_operand" "=c")
3900 (eq:BI (zero_extract:DI (match_operand:DI 1 "gr_register_operand" "r")
3902 (match_operand:DI 2 "shift_count_operand" "M"))
3905 "tbit.z %0, %I0 = %1, %2"
3906 [(set_attr "itanium_class" "tbit")])
3908 (define_insn "*bit_one"
3909 [(set (match_operand:BI 0 "register_operand" "=c")
3910 (ne:BI (zero_extract:DI (match_operand:DI 1 "gr_register_operand" "r")
3912 (match_operand:DI 2 "shift_count_operand" "M"))
3915 "tbit.nz %0, %I0 = %1, %2"
3916 [(set_attr "itanium_class" "tbit")])
3918 ;; ::::::::::::::::::::
3922 ;; ::::::::::::::::::::
3924 (define_insn "*br_true"
3926 (if_then_else (match_operator 0 "predicate_operator"
3927 [(match_operand:BI 1 "register_operand" "c")
3929 (label_ref (match_operand 2 "" ""))
3932 "(%J0) br.cond%+ %l2"
3933 [(set_attr "itanium_class" "br")
3934 (set_attr "predicable" "no")])
3936 (define_insn "*br_false"
3938 (if_then_else (match_operator 0 "predicate_operator"
3939 [(match_operand:BI 1 "register_operand" "c")
3942 (label_ref (match_operand 2 "" ""))))]
3944 "(%j0) br.cond%+ %l2"
3945 [(set_attr "itanium_class" "br")
3946 (set_attr "predicable" "no")])
3948 ;; ::::::::::::::::::::
3950 ;; :: Counted loop operations
3952 ;; ::::::::::::::::::::
3954 (define_expand "doloop_end"
3955 [(use (match_operand 0 "" "")) ; loop pseudo
3956 (use (match_operand 1 "" "")) ; iterations; zero if unknown
3957 (use (match_operand 2 "" "")) ; max iterations
3958 (use (match_operand 3 "" "")) ; loop level
3959 (use (match_operand 4 "" ""))] ; label
3962 /* Only use cloop on innermost loops. */
3963 if (INTVAL (operands[3]) > 1)
3965 emit_jump_insn (gen_doloop_end_internal (gen_rtx_REG (DImode, AR_LC_REGNUM),
3970 (define_insn "doloop_end_internal"
3971 [(set (pc) (if_then_else (ne (match_operand:DI 0 "ar_lc_reg_operand" "")
3973 (label_ref (match_operand 1 "" ""))
3975 (set (match_dup 0) (if_then_else:DI (ne (match_dup 0) (const_int 0))
3976 (plus:DI (match_dup 0) (const_int -1))
3979 "br.cloop.sptk.few %l1"
3980 [(set_attr "itanium_class" "br")
3981 (set_attr "predicable" "no")])
3983 ;; ::::::::::::::::::::
3985 ;; :: Set flag operations
3987 ;; ::::::::::::::::::::
3989 (define_expand "cstorebi4"
3990 [(set (match_operand:DI 0 "gr_register_operand" "")
3991 (match_operator:DI 1 "ia64_cbranch_operator"
3992 [(match_operand:BI 2 "register_operand" "")
3993 (match_operand:BI 3 "const_int_operand" "")]))]
3995 "ia64_expand_compare (&operands[1], &operands[2], &operands[3]);")
3997 (define_expand "cstoresi4"
3998 [(set (match_operand:DI 0 "gr_register_operand" "")
3999 (match_operator:DI 1 "ia64_cbranch_operator"
4000 [(match_operand:SI 2 "gr_register_operand" "")
4001 (match_operand:SI 3 "gr_reg_or_8bit_and_adjusted_operand" "")]))]
4003 "ia64_expand_compare (&operands[1], &operands[2], &operands[3]);")
4005 (define_expand "cstoredi4"
4006 [(set (match_operand:DI 0 "gr_register_operand" "")
4007 (match_operator:DI 1 "ia64_cbranch_operator"
4008 [(match_operand:DI 2 "gr_register_operand" "")
4009 (match_operand:DI 3 "gr_reg_or_8bit_and_adjusted_operand" "")]))]
4011 "ia64_expand_compare (&operands[1], &operands[2], &operands[3]);")
4013 (define_expand "cstoresf4"
4014 [(set (match_operand:DI 0 "gr_register_operand" "")
4015 (match_operator:DI 1 "ia64_cbranch_operator"
4016 [(match_operand:SF 2 "fr_reg_or_fp01_operand" "")
4017 (match_operand:SF 3 "fr_reg_or_fp01_operand" "")]))]
4019 "ia64_expand_compare (&operands[1], &operands[2], &operands[3]);")
4021 (define_expand "cstoredf4"
4022 [(set (match_operand:DI 0 "gr_register_operand" "")
4023 (match_operator:DI 1 "ia64_cbranch_operator"
4024 [(match_operand:DF 2 "fr_reg_or_fp01_operand" "")
4025 (match_operand:DF 3 "fr_reg_or_fp01_operand" "")]))]
4027 "ia64_expand_compare (&operands[1], &operands[2], &operands[3]);")
4029 (define_expand "cstorexf4"
4030 [(set (match_operand:DI 0 "gr_register_operand" "")
4031 (match_operator:DI 1 "ia64_cbranch_operator"
4032 [(match_operand:XF 2 "xfreg_or_fp01_operand" "")
4033 (match_operand:XF 3 "xfreg_or_fp01_operand" "")]))]
4035 "ia64_expand_compare (&operands[1], &operands[2], &operands[3]);")
4037 (define_expand "cstoretf4"
4038 [(set (match_operand:DI 0 "gr_register_operand" "")
4039 (match_operator:DI 1 "ia64_cbranch_operator"
4040 [(match_operand:TF 2 "gr_register_operand" "")
4041 (match_operand:TF 3 "gr_register_operand" "")]))]
4043 "ia64_expand_compare (&operands[1], &operands[2], &operands[3]);")
4045 ;; Don't allow memory as destination here, because cmov/cmov/st is more
4046 ;; efficient than mov/mov/cst/cst.
4048 (define_insn_and_split "*sne_internal"
4049 [(set (match_operand:DI 0 "gr_register_operand" "=r")
4050 (ne:DI (match_operand:BI 1 "register_operand" "c")
4055 [(cond_exec (ne (match_dup 1) (const_int 0))
4056 (set (match_dup 0) (const_int 1)))
4057 (cond_exec (eq (match_dup 1) (const_int 0))
4058 (set (match_dup 0) (const_int 0)))]
4060 [(set_attr "itanium_class" "unknown")])
4062 (define_insn_and_split "*seq_internal"
4063 [(set (match_operand:DI 0 "gr_register_operand" "=r")
4064 (eq:DI (match_operand:BI 1 "register_operand" "c")
4069 [(cond_exec (ne (match_dup 1) (const_int 0))
4070 (set (match_dup 0) (const_int 0)))
4071 (cond_exec (eq (match_dup 1) (const_int 0))
4072 (set (match_dup 0) (const_int 1)))]
4074 [(set_attr "itanium_class" "unknown")])
4076 ;; ::::::::::::::::::::
4078 ;; :: Conditional move instructions.
4080 ;; ::::::::::::::::::::
4082 ;; ??? Add movXXcc patterns?
4085 ;; DImode if_then_else patterns.
4088 (define_insn "*cmovdi_internal"
4089 [(set (match_operand:DI 0 "not_postinc_destination_operand"
4090 "= r, r, r, r, r, r, r, r, r, r, m, Q, *f,*b,*d*e")
4092 (match_operator 4 "predicate_operator"
4093 [(match_operand:BI 1 "register_operand"
4094 "c,c,c,c,c,c,c,c,c,c,c,c,c,c,c")
4096 (match_operand:DI 2 "not_postinc_move_operand"
4097 "rim, *f, *b,*d*e,rim,rim, rim,*f,*b,*d*e,rO,*f,rOQ,rO, rK")
4098 (match_operand:DI 3 "not_postinc_move_operand"
4099 "rim,rim,rim, rim, *f, *b,*d*e,*f,*b,*d*e,rO,*f,rOQ,rO, rK")))]
4100 "ia64_move_ok (operands[0], operands[2])
4101 && ia64_move_ok (operands[0], operands[3])"
4102 { gcc_unreachable (); }
4103 [(set_attr "predicable" "no")])
4106 [(set (match_operand 0 "not_postinc_destination_operand" "")
4108 (match_operator 4 "predicate_operator"
4109 [(match_operand:BI 1 "register_operand" "")
4111 (match_operand 2 "not_postinc_move_operand" "")
4112 (match_operand 3 "not_postinc_move_operand" "")))]
4116 bool emitted_something = false;
4117 rtx dest = operands[0];
4118 rtx srct = operands[2];
4119 rtx srcf = operands[3];
4120 rtx cond = operands[4];
4122 if (! rtx_equal_p (dest, srct))
4124 ia64_emit_cond_move (dest, srct, cond);
4125 emitted_something = true;
4127 if (! rtx_equal_p (dest, srcf))
4129 cond = gen_rtx_fmt_ee (GET_CODE (cond) == NE ? EQ : NE,
4130 VOIDmode, operands[1], const0_rtx);
4131 ia64_emit_cond_move (dest, srcf, cond);
4132 emitted_something = true;
4134 if (! emitted_something)
4135 emit_note (NOTE_INSN_DELETED);
4139 ;; Absolute value pattern.
4141 (define_insn "*absdi2_internal"
4142 [(set (match_operand:DI 0 "gr_register_operand" "=r,r")
4144 (match_operator 4 "predicate_operator"
4145 [(match_operand:BI 1 "register_operand" "c,c")
4147 (neg:DI (match_operand:DI 2 "gr_reg_or_22bit_operand" "rI,rI"))
4148 (match_operand:DI 3 "gr_reg_or_22bit_operand" "0,rI")))]
4151 [(set_attr "itanium_class" "ialu,unknown")
4152 (set_attr "predicable" "no")])
4155 [(set (match_operand:DI 0 "register_operand" "")
4157 (match_operator 4 "predicate_operator"
4158 [(match_operand:BI 1 "register_operand" "c,c")
4160 (neg:DI (match_operand:DI 2 "gr_reg_or_22bit_operand" ""))
4161 (match_operand:DI 3 "gr_reg_or_22bit_operand" "")))]
4162 "reload_completed && rtx_equal_p (operands[0], operands[3])"
4166 (neg:DI (match_dup 2))))]
4170 [(set (match_operand:DI 0 "register_operand" "")
4172 (match_operator 4 "predicate_operator"
4173 [(match_operand:BI 1 "register_operand" "c,c")
4175 (neg:DI (match_operand:DI 2 "gr_reg_or_22bit_operand" ""))
4176 (match_operand:DI 3 "gr_reg_or_22bit_operand" "")))]
4180 (set (match_dup 0) (neg:DI (match_dup 2))))
4183 (set (match_dup 0) (match_dup 3)))]
4185 operands[5] = gen_rtx_fmt_ee (GET_CODE (operands[4]) == NE ? EQ : NE,
4186 VOIDmode, operands[1], const0_rtx);
4190 ;; SImode if_then_else patterns.
4193 (define_insn "*cmovsi_internal"
4194 [(set (match_operand:SI 0 "not_postinc_destination_operand"
4195 "=r,m,*f,r,m,*f,r,m,*f")
4197 (match_operator 4 "predicate_operator"
4198 [(match_operand:BI 1 "register_operand" "c,c,c,c,c,c,c,c,c")
4200 (match_operand:SI 2 "not_postinc_move_operand"
4201 "0,0,0,rim*f,rO,rO,rim*f,rO,rO")
4202 (match_operand:SI 3 "not_postinc_move_operand"
4203 "rim*f,rO,rO,0,0,0,rim*f,rO,rO")))]
4204 "ia64_move_ok (operands[0], operands[2])
4205 && ia64_move_ok (operands[0], operands[3])"
4206 { gcc_unreachable (); }
4207 [(set_attr "predicable" "no")])
4209 (define_insn "*abssi2_internal"
4210 [(set (match_operand:SI 0 "gr_register_operand" "=r,r")
4212 (match_operator 4 "predicate_operator"
4213 [(match_operand:BI 1 "register_operand" "c,c")
4215 (neg:SI (match_operand:SI 3 "gr_reg_or_22bit_operand" "rI,rI"))
4216 (match_operand:SI 2 "gr_reg_or_22bit_operand" "0,rI")))]
4219 [(set_attr "itanium_class" "ialu,unknown")
4220 (set_attr "predicable" "no")])
4223 [(set (match_operand:SI 0 "register_operand" "")
4225 (match_operator 4 "predicate_operator"
4226 [(match_operand:BI 1 "register_operand" "c,c")
4228 (neg:SI (match_operand:SI 2 "gr_reg_or_22bit_operand" ""))
4229 (match_operand:SI 3 "gr_reg_or_22bit_operand" "")))]
4230 "reload_completed && rtx_equal_p (operands[0], operands[3])"
4234 (neg:SI (match_dup 2))))]
4238 [(set (match_operand:SI 0 "register_operand" "")
4240 (match_operator 4 "predicate_operator"
4241 [(match_operand:BI 1 "register_operand" "c,c")
4243 (neg:SI (match_operand:SI 2 "gr_reg_or_22bit_operand" ""))
4244 (match_operand:SI 3 "gr_reg_or_22bit_operand" "")))]
4248 (set (match_dup 0) (neg:SI (match_dup 2))))
4251 (set (match_dup 0) (match_dup 3)))]
4253 operands[5] = gen_rtx_fmt_ee (GET_CODE (operands[4]) == NE ? EQ : NE,
4254 VOIDmode, operands[1], const0_rtx);
4257 (define_insn_and_split "*cond_opsi2_internal"
4258 [(set (match_operand:SI 0 "gr_register_operand" "=r")
4259 (match_operator:SI 5 "condop_operator"
4261 (match_operator 6 "predicate_operator"
4262 [(match_operand:BI 1 "register_operand" "c")
4264 (match_operand:SI 2 "gr_register_operand" "r")
4265 (match_operand:SI 3 "gr_register_operand" "r"))
4266 (match_operand:SI 4 "gr_register_operand" "r")]))]
4272 (set (match_dup 0) (match_op_dup:SI 5 [(match_dup 2) (match_dup 4)])))
4275 (set (match_dup 0) (match_op_dup:SI 5 [(match_dup 3) (match_dup 4)])))]
4277 operands[7] = gen_rtx_fmt_ee (GET_CODE (operands[6]) == NE ? EQ : NE,
4278 VOIDmode, operands[1], const0_rtx);
4280 [(set_attr "itanium_class" "ialu")
4281 (set_attr "predicable" "no")])
4284 (define_insn_and_split "*cond_opsi2_internal_b"
4285 [(set (match_operand:SI 0 "gr_register_operand" "=r")
4286 (match_operator:SI 5 "condop_operator"
4287 [(match_operand:SI 4 "gr_register_operand" "r")
4289 (match_operator 6 "predicate_operator"
4290 [(match_operand:BI 1 "register_operand" "c")
4292 (match_operand:SI 2 "gr_register_operand" "r")
4293 (match_operand:SI 3 "gr_register_operand" "r"))]))]
4299 (set (match_dup 0) (match_op_dup:SI 5 [(match_dup 4) (match_dup 2)])))
4302 (set (match_dup 0) (match_op_dup:SI 5 [(match_dup 4) (match_dup 3)])))]
4304 operands[7] = gen_rtx_fmt_ee (GET_CODE (operands[6]) == NE ? EQ : NE,
4305 VOIDmode, operands[1], const0_rtx);
4307 [(set_attr "itanium_class" "ialu")
4308 (set_attr "predicable" "no")])
4311 ;; ::::::::::::::::::::
4313 ;; :: Call and branch instructions
4315 ;; ::::::::::::::::::::
4317 ;; Subroutine call instruction returning no value. Operand 0 is the function
4318 ;; to call; operand 1 is the number of bytes of arguments pushed (in mode
4319 ;; `SImode', except it is normally a `const_int'); operand 2 is the number of
4320 ;; registers used as operands.
4322 ;; On most machines, operand 2 is not actually stored into the RTL pattern. It
4323 ;; is supplied for the sake of some RISC machines which need to put this
4324 ;; information into the assembler code; they can put it in the RTL instead of
4327 (define_expand "call"
4328 [(use (match_operand:DI 0 "" ""))
4329 (use (match_operand 1 "" ""))
4330 (use (match_operand 2 "" ""))
4331 (use (match_operand 3 "" ""))]
4334 ia64_expand_call (NULL_RTX, operands[0], operands[2], false);
4338 (define_expand "sibcall"
4339 [(use (match_operand:DI 0 "" ""))
4340 (use (match_operand 1 "" ""))
4341 (use (match_operand 2 "" ""))
4342 (use (match_operand 3 "" ""))]
4345 ia64_expand_call (NULL_RTX, operands[0], operands[2], true);
4349 ;; Subroutine call instruction returning a value. Operand 0 is the hard
4350 ;; register in which the value is returned. There are three more operands,
4351 ;; the same as the three operands of the `call' instruction (but with numbers
4352 ;; increased by one).
4354 ;; Subroutines that return `BLKmode' objects use the `call' insn.
4356 (define_expand "call_value"
4357 [(use (match_operand 0 "" ""))
4358 (use (match_operand:DI 1 "" ""))
4359 (use (match_operand 2 "" ""))
4360 (use (match_operand 3 "" ""))
4361 (use (match_operand 4 "" ""))]
4364 ia64_expand_call (operands[0], operands[1], operands[3], false);
4368 (define_expand "sibcall_value"
4369 [(use (match_operand 0 "" ""))
4370 (use (match_operand:DI 1 "" ""))
4371 (use (match_operand 2 "" ""))
4372 (use (match_operand 3 "" ""))
4373 (use (match_operand 4 "" ""))]
4376 ia64_expand_call (operands[0], operands[1], operands[3], true);
4380 ;; Call subroutine returning any type.
4382 (define_expand "untyped_call"
4383 [(parallel [(call (match_operand 0 "" "")
4385 (match_operand 1 "" "")
4386 (match_operand 2 "" "")])]
4391 emit_call_insn (gen_call (operands[0], const0_rtx, NULL, const0_rtx));
4393 for (i = 0; i < XVECLEN (operands[2], 0); i++)
4395 rtx set = XVECEXP (operands[2], 0, i);
4396 emit_move_insn (SET_DEST (set), SET_SRC (set));
4399 /* The optimizer does not know that the call sets the function value
4400 registers we stored in the result block. We avoid problems by
4401 claiming that all hard registers are used and clobbered at this
4403 emit_insn (gen_blockage ());
4408 (define_insn "call_nogp"
4409 [(call (mem:DI (match_operand:DI 0 "call_operand" "?b,s"))
4411 (clobber (match_operand:DI 1 "register_operand" "=b,b"))]
4413 "br.call%+.many %1 = %0"
4414 [(set_attr "itanium_class" "br,scall")])
4416 (define_insn "call_value_nogp"
4417 [(set (match_operand 0 "" "=X,X")
4418 (call (mem:DI (match_operand:DI 1 "call_operand" "?b,s"))
4420 (clobber (match_operand:DI 2 "register_operand" "=b,b"))]
4422 "br.call%+.many %2 = %1"
4423 [(set_attr "itanium_class" "br,scall")])
4425 (define_insn "sibcall_nogp"
4426 [(call (mem:DI (match_operand:DI 0 "call_operand" "?b,s"))
4430 [(set_attr "itanium_class" "br,scall")])
4432 (define_insn "call_gp"
4433 [(call (mem:DI (match_operand:DI 0 "call_operand" "?r,s"))
4435 (clobber (match_operand:DI 1 "register_operand" "=b,b"))
4436 (clobber (match_scratch:DI 2 "=&r,X"))
4437 (clobber (match_scratch:DI 3 "=b,X"))]
4440 [(set_attr "itanium_class" "br,scall")])
4442 ;; Irritatingly, we don't have access to INSN within the split body.
4443 ;; See commentary in ia64_split_call as to why these aren't peep2.
4445 [(call (mem (match_operand 0 "call_operand" ""))
4447 (clobber (match_operand:DI 1 "register_operand" ""))
4448 (clobber (match_scratch:DI 2 ""))
4449 (clobber (match_scratch:DI 3 ""))]
4450 "reload_completed && find_reg_note (insn, REG_NORETURN, NULL_RTX)"
4453 ia64_split_call (NULL_RTX, operands[0], operands[1], operands[2],
4454 operands[3], true, false);
4459 [(call (mem (match_operand 0 "call_operand" ""))
4461 (clobber (match_operand:DI 1 "register_operand" ""))
4462 (clobber (match_scratch:DI 2 ""))
4463 (clobber (match_scratch:DI 3 ""))]
4467 ia64_split_call (NULL_RTX, operands[0], operands[1], operands[2],
4468 operands[3], false, false);
4472 (define_insn "call_value_gp"
4473 [(set (match_operand 0 "" "=X,X")
4474 (call (mem:DI (match_operand:DI 1 "call_operand" "?r,s"))
4476 (clobber (match_operand:DI 2 "register_operand" "=b,b"))
4477 (clobber (match_scratch:DI 3 "=&r,X"))
4478 (clobber (match_scratch:DI 4 "=b,X"))]
4481 [(set_attr "itanium_class" "br,scall")])
4484 [(set (match_operand 0 "" "")
4485 (call (mem:DI (match_operand:DI 1 "call_operand" ""))
4487 (clobber (match_operand:DI 2 "register_operand" ""))
4488 (clobber (match_scratch:DI 3 ""))
4489 (clobber (match_scratch:DI 4 ""))]
4490 "reload_completed && find_reg_note (insn, REG_NORETURN, NULL_RTX)"
4493 ia64_split_call (operands[0], operands[1], operands[2], operands[3],
4494 operands[4], true, false);
4499 [(set (match_operand 0 "" "")
4500 (call (mem:DI (match_operand:DI 1 "call_operand" ""))
4502 (clobber (match_operand:DI 2 "register_operand" ""))
4503 (clobber (match_scratch:DI 3 ""))
4504 (clobber (match_scratch:DI 4 ""))]
4508 ia64_split_call (operands[0], operands[1], operands[2], operands[3],
4509 operands[4], false, false);
4513 (define_insn_and_split "sibcall_gp"
4514 [(call (mem:DI (match_operand:DI 0 "call_operand" "?r,s"))
4516 (clobber (match_scratch:DI 1 "=&r,X"))
4517 (clobber (match_scratch:DI 2 "=b,X"))]
4523 ia64_split_call (NULL_RTX, operands[0], NULL_RTX, operands[1],
4524 operands[2], true, true);
4527 [(set_attr "itanium_class" "br")])
4529 (define_insn "return_internal"
4531 (use (match_operand:DI 0 "register_operand" "b"))]
4533 "br.ret.sptk.many %0"
4534 [(set_attr "itanium_class" "br")])
4536 (define_insn "return"
4538 "ia64_direct_return ()"
4539 "br.ret.sptk.many rp"
4540 [(set_attr "itanium_class" "br")])
4542 (define_insn "*return_true"
4544 (if_then_else (match_operator 0 "predicate_operator"
4545 [(match_operand:BI 1 "register_operand" "c")
4549 "ia64_direct_return ()"
4550 "(%J0) br.ret%+.many rp"
4551 [(set_attr "itanium_class" "br")
4552 (set_attr "predicable" "no")])
4554 (define_insn "*return_false"
4556 (if_then_else (match_operator 0 "predicate_operator"
4557 [(match_operand:BI 1 "register_operand" "c")
4561 "ia64_direct_return ()"
4562 "(%j0) br.ret%+.many rp"
4563 [(set_attr "itanium_class" "br")
4564 (set_attr "predicable" "no")])
4567 [(set (pc) (label_ref (match_operand 0 "" "")))]
4570 [(set_attr "itanium_class" "br")])
4572 (define_insn "indirect_jump"
4573 [(set (pc) (match_operand:DI 0 "register_operand" "b"))]
4576 [(set_attr "itanium_class" "br")])
4578 (define_expand "tablejump"
4579 [(parallel [(set (pc) (match_operand:DI 0 "memory_operand" ""))
4580 (use (label_ref (match_operand 1 "" "")))])]
4583 rtx op0 = operands[0];
4586 /* ??? Bother -- do_tablejump is "helpful" and pulls the table
4587 element into a register without bothering to see whether that
4588 is necessary given the operand predicate. Check for MEM just
4589 in case someone fixes this. */
4590 if (GET_CODE (op0) == MEM)
4591 addr = XEXP (op0, 0);
4594 /* Otherwise, cheat and guess that the previous insn in the
4595 stream was the memory load. Grab the address from that.
4596 Note we have to momentarily pop out of the sequence started
4597 by the insn-emit wrapper in order to grab the last insn. */
4601 last = get_last_insn ();
4603 set = single_set (last);
4605 gcc_assert (rtx_equal_p (SET_DEST (set), op0)
4606 && GET_CODE (SET_SRC (set)) == MEM);
4607 addr = XEXP (SET_SRC (set), 0);
4608 gcc_assert (!rtx_equal_p (addr, op0));
4611 /* Jump table elements are stored pc-relative. That is, a displacement
4612 from the entry to the label. Thus to convert to an absolute address
4613 we add the address of the memory from which the value is loaded. */
4614 operands[0] = expand_simple_binop (DImode, PLUS, op0, addr,
4615 NULL_RTX, 1, OPTAB_DIRECT);
4618 (define_insn "*tablejump_internal"
4619 [(set (pc) (match_operand:DI 0 "register_operand" "b"))
4620 (use (label_ref (match_operand 1 "" "")))]
4623 [(set_attr "itanium_class" "br")])
4626 ;; ::::::::::::::::::::
4628 ;; :: Prologue and Epilogue instructions
4630 ;; ::::::::::::::::::::
4632 (define_expand "prologue"
4636 ia64_expand_prologue ();
4640 (define_expand "epilogue"
4644 ia64_expand_epilogue (0);
4648 (define_expand "sibcall_epilogue"
4652 ia64_expand_epilogue (1);
4656 ;; This prevents the scheduler from moving the SP decrement past FP-relative
4657 ;; stack accesses. This is the same as adddi3 plus the extra set.
4659 (define_insn "prologue_allocate_stack"
4660 [(set (match_operand:DI 0 "register_operand" "=r,r,r")
4661 (plus:DI (match_operand:DI 1 "register_operand" "%r,r,a")
4662 (match_operand:DI 2 "gr_reg_or_22bit_operand" "r,I,J")))
4663 (set (match_operand:DI 3 "register_operand" "+r,r,r")
4670 [(set_attr "itanium_class" "ialu")])
4672 ;; This prevents the scheduler from moving the SP restore past FP-relative
4673 ;; stack accesses. This is similar to movdi plus the extra set.
4675 (define_insn "epilogue_deallocate_stack"
4676 [(set (match_operand:DI 0 "register_operand" "=r")
4677 (match_operand:DI 1 "register_operand" "+r"))
4678 (set (match_dup 1) (match_dup 1))]
4681 [(set_attr "itanium_class" "ialu")])
4683 ;; As USE insns aren't meaningful after reload, this is used instead
4684 ;; to prevent deleting instructions setting registers for EH handling
4685 (define_insn "prologue_use"
4686 [(unspec:DI [(match_operand:DI 0 "register_operand" "")]
4687 UNSPEC_PROLOGUE_USE)]
4690 [(set_attr "itanium_class" "ignore")
4691 (set_attr "predicable" "no")
4692 (set_attr "empty" "yes")])
4694 ;; Allocate a new register frame.
4696 (define_insn "alloc"
4697 [(set (match_operand:DI 0 "register_operand" "=r")
4698 (unspec_volatile:DI [(const_int 0)] UNSPECV_ALLOC))
4699 (use (match_operand:DI 1 "const_int_operand" "i"))
4700 (use (match_operand:DI 2 "const_int_operand" "i"))
4701 (use (match_operand:DI 3 "const_int_operand" "i"))
4702 (use (match_operand:DI 4 "const_int_operand" "i"))]
4704 "alloc %0 = ar.pfs, %1, %2, %3, %4"
4705 [(set_attr "itanium_class" "syst_m0")
4706 (set_attr "predicable" "no")
4707 (set_attr "first_insn" "yes")])
4710 (define_expand "gr_spill"
4711 [(parallel [(set (match_operand:DI 0 "memory_operand" "=m")
4712 (unspec:DI [(match_operand:DI 1 "register_operand" "r")
4713 (match_operand:DI 2 "const_int_operand" "")]
4715 (clobber (match_dup 3))])]
4717 "operands[3] = gen_rtx_REG (DImode, AR_UNAT_REGNUM);")
4719 (define_insn "gr_spill_internal"
4720 [(set (match_operand:DI 0 "destination_operand" "=m")
4721 (unspec:DI [(match_operand:DI 1 "register_operand" "r")
4722 (match_operand:DI 2 "const_int_operand" "")]
4724 (clobber (match_operand:DI 3 "register_operand" ""))]
4727 /* Note that we use a C output pattern here to avoid the predicate
4728 being automatically added before the .mem.offset directive. */
4729 return ".mem.offset %2, 0\;%,st8.spill %0 = %1%P0";
4731 [(set_attr "itanium_class" "st")])
4734 (define_expand "gr_restore"
4735 [(parallel [(set (match_operand:DI 0 "register_operand" "=r")
4736 (unspec:DI [(match_operand:DI 1 "memory_operand" "m")
4737 (match_operand:DI 2 "const_int_operand" "")]
4739 (use (match_dup 3))])]
4741 "operands[3] = gen_rtx_REG (DImode, AR_UNAT_REGNUM);")
4743 (define_insn "gr_restore_internal"
4744 [(set (match_operand:DI 0 "register_operand" "=r")
4745 (unspec:DI [(match_operand:DI 1 "memory_operand" "m")
4746 (match_operand:DI 2 "const_int_operand" "")]
4748 (use (match_operand:DI 3 "register_operand" ""))]
4750 { return ".mem.offset %2, 0\;%,ld8.fill %0 = %1%P1"; }
4751 [(set_attr "itanium_class" "ld")])
4753 (define_insn "fr_spill"
4754 [(set (match_operand:XF 0 "destination_operand" "=m")
4755 (unspec:XF [(match_operand:XF 1 "register_operand" "f")]
4758 "stf.spill %0 = %1%P0"
4759 [(set_attr "itanium_class" "stf")])
4761 (define_insn "fr_restore"
4762 [(set (match_operand:XF 0 "register_operand" "=f")
4763 (unspec:XF [(match_operand:XF 1 "memory_operand" "m")]
4764 UNSPEC_FR_RESTORE))]
4766 "ldf.fill %0 = %1%P1"
4767 [(set_attr "itanium_class" "fld")])
4769 ;; ??? The explicit stop is not ideal. It would be better if
4770 ;; rtx_needs_barrier took care of this, but this is something that can be
4771 ;; fixed later. This avoids an RSE DV.
4773 (define_insn "bsp_value"
4774 [(set (match_operand:DI 0 "register_operand" "=r")
4775 (unspec:DI [(const_int 0)] UNSPEC_BSP_VALUE))]
4779 return \";;\;%,mov %0 = ar.bsp\";
4781 [(set_attr "itanium_class" "frar_i")])
4783 (define_insn "set_bsp"
4784 [(unspec_volatile [(match_operand:DI 0 "register_operand" "r")]
4802 [(set_attr "itanium_class" "unknown")
4803 (set_attr "predicable" "no")])
4805 ;; ??? The explicit stops are not ideal. It would be better if
4806 ;; rtx_needs_barrier took care of this, but this is something that can be
4807 ;; fixed later. This avoids an RSE DV.
4809 (define_insn "flushrs"
4810 [(unspec [(const_int 0)] UNSPEC_FLUSHRS)]
4813 [(set_attr "itanium_class" "rse_m")
4814 (set_attr "predicable" "no")])
4816 ;; ::::::::::::::::::::
4818 ;; :: Miscellaneous instructions
4820 ;; ::::::::::::::::::::
4822 ;; ??? Emitting a NOP instruction isn't very useful. This should probably
4823 ;; be emitting ";;" to force a break in the instruction packing.
4825 ;; No operation, needed in case the user uses -g but not -O.
4830 [(set_attr "itanium_class" "nop")])
4832 (define_insn "nop_m"
4836 [(set_attr "itanium_class" "nop_m")])
4838 (define_insn "nop_i"
4842 [(set_attr "itanium_class" "nop_i")])
4844 (define_insn "nop_f"
4848 [(set_attr "itanium_class" "nop_f")])
4850 (define_insn "nop_b"
4854 [(set_attr "itanium_class" "nop_b")])
4856 (define_insn "nop_x"
4860 [(set_attr "itanium_class" "nop_x")
4861 (set_attr "empty" "yes")])
4863 ;; The following insn will be never generated. It is used only by
4864 ;; insn scheduler to change state before advancing cycle.
4865 (define_insn "pre_cycle"
4869 [(set_attr "itanium_class" "pre_cycle")])
4871 (define_insn "bundle_selector"
4872 [(unspec [(match_operand 0 "const_int_operand" "")] UNSPEC_BUNDLE_SELECTOR)]
4874 { return get_bundle_name (INTVAL (operands[0])); }
4875 [(set_attr "itanium_class" "ignore")
4876 (set_attr "predicable" "no")])
4878 ;; Pseudo instruction that prevents the scheduler from moving code above this
4880 (define_insn "blockage"
4881 [(unspec_volatile [(const_int 0)] UNSPECV_BLOCKAGE)]
4884 [(set_attr "itanium_class" "ignore")
4885 (set_attr "predicable" "no")])
4887 (define_insn "insn_group_barrier"
4888 [(unspec_volatile [(match_operand 0 "const_int_operand" "")]
4889 UNSPECV_INSN_GROUP_BARRIER)]
4892 [(set_attr "itanium_class" "stop_bit")
4893 (set_attr "predicable" "no")
4894 (set_attr "empty" "yes")])
4896 (define_expand "trap"
4897 [(trap_if (const_int 1) (const_int 0))]
4901 ;; ??? We don't have a match-any slot type. Setting the type to unknown
4902 ;; produces worse code that setting the slot type to A.
4904 (define_insn "*trap"
4905 [(trap_if (const_int 1) (match_operand 0 "const_int_operand" ""))]
4908 [(set_attr "itanium_class" "chk_s_i")])
4910 (define_expand "ctrapbi4"
4911 [(trap_if (match_operator 0 "ia64_cbranch_operator"
4912 [(match_operand:BI 1 "register_operand" "")
4913 (match_operand:BI 2 "const_int_operand" "")])
4914 (match_operand 3 "" ""))]
4916 "ia64_expand_compare (&operands[0], &operands[1], &operands[2]);")
4918 (define_expand "ctrapsi4"
4919 [(trap_if (match_operator 0 "ia64_cbranch_operator"
4920 [(match_operand:SI 1 "gr_register_operand" "")
4921 (match_operand:SI 2 "gr_reg_or_8bit_and_adjusted_operand" "")])
4922 (match_operand 3 "" ""))]
4924 "ia64_expand_compare (&operands[0], &operands[1], &operands[2]);")
4926 (define_expand "ctrapdi4"
4927 [(trap_if (match_operator 0 "ia64_cbranch_operator"
4928 [(match_operand:DI 1 "gr_register_operand" "")
4929 (match_operand:DI 2 "gr_reg_or_8bit_and_adjusted_operand" "")])
4930 (match_operand 3 "" ""))]
4932 "ia64_expand_compare (&operands[0], &operands[1], &operands[2]);")
4934 (define_expand "ctrapsf4"
4935 [(trap_if (match_operator 0 "ia64_cbranch_operator"
4936 [(match_operand:SF 1 "fr_reg_or_fp01_operand" "")
4937 (match_operand:SF 2 "fr_reg_or_fp01_operand" "")])
4938 (match_operand 3 "" ""))]
4940 "ia64_expand_compare (&operands[0], &operands[1], &operands[2]);")
4942 (define_expand "ctrapdf4"
4943 [(trap_if (match_operator 0 "ia64_cbranch_operator"
4944 [(match_operand:DF 1 "fr_reg_or_fp01_operand" "")
4945 (match_operand:DF 2 "fr_reg_or_fp01_operand" "")])
4946 (match_operand 3 "" ""))]
4948 "ia64_expand_compare (&operands[0], &operands[1], &operands[2]);")
4950 (define_expand "ctrapxf4"
4951 [(trap_if (match_operator 0 "ia64_cbranch_operator"
4952 [(match_operand:XF 1 "xfreg_or_fp01_operand" "")
4953 (match_operand:XF 2 "xfreg_or_fp01_operand" "")])
4954 (match_operand 3 "" ""))]
4956 "ia64_expand_compare (&operands[0], &operands[1], &operands[2]);")
4958 (define_expand "ctraptf4"
4959 [(trap_if (match_operator 0 "ia64_cbranch_operator"
4960 [(match_operand:TF 1 "gr_register_operand" "")
4961 (match_operand:TF 2 "gr_register_operand" "")])
4962 (match_operand 3 "" ""))]
4964 "ia64_expand_compare (&operands[0], &operands[1], &operands[2]);")
4967 (define_insn "*conditional_trap"
4968 [(trap_if (match_operator 0 "predicate_operator"
4969 [(match_operand:BI 1 "register_operand" "c")
4971 (match_operand 2 "const_int_operand" ""))]
4974 [(set_attr "itanium_class" "chk_s_i")
4975 (set_attr "predicable" "no")])
4977 (define_insn "break_f"
4978 [(unspec_volatile [(const_int 0)] UNSPECV_BREAK)]
4981 [(set_attr "itanium_class" "nop_f")])
4983 (define_insn "prefetch"
4984 [(prefetch (match_operand:DI 0 "address_operand" "p")
4985 (match_operand:DI 1 "const_int_operand" "n")
4986 (match_operand:DI 2 "const_int_operand" "n"))]
4989 static const char * const alt[2][4] = {
4991 "%,lfetch.nta [%0]",
4992 "%,lfetch.nt1 [%0]",
4993 "%,lfetch.nt2 [%0]",
4997 "%,lfetch.excl.nta [%0]",
4998 "%,lfetch.excl.nt1 [%0]",
4999 "%,lfetch.excl.nt2 [%0]",
5000 "%,lfetch.excl [%0]"
5003 int i = (INTVAL (operands[1]));
5004 int j = (INTVAL (operands[2]));
5006 gcc_assert (i == 0 || i == 1);
5007 gcc_assert (j >= 0 && j <= 3);
5010 [(set_attr "itanium_class" "lfetch")])
5012 ;; Non-local goto support.
5014 (define_expand "save_stack_nonlocal"
5015 [(use (match_operand:OI 0 "memory_operand" ""))
5016 (use (match_operand:DI 1 "register_operand" ""))]
5019 emit_library_call (gen_rtx_SYMBOL_REF (Pmode,
5020 \"__ia64_save_stack_nonlocal\"),
5021 LCT_NORMAL, VOIDmode, 2, XEXP (operands[0], 0), Pmode,
5022 operands[1], Pmode);
5026 (define_expand "nonlocal_goto"
5027 [(use (match_operand 0 "general_operand" ""))
5028 (use (match_operand 1 "general_operand" ""))
5029 (use (match_operand 2 "general_operand" ""))
5030 (use (match_operand 3 "general_operand" ""))]
5033 emit_library_call (gen_rtx_SYMBOL_REF (Pmode, \"__ia64_nonlocal_goto\"),
5034 LCT_NORETURN, VOIDmode, 3,
5036 copy_to_reg (XEXP (operands[2], 0)), Pmode,
5037 operands[3], Pmode);
5042 (define_insn_and_split "nonlocal_goto_receiver"
5043 [(unspec_volatile [(const_int 0)] UNSPECV_GOTO_RECEIVER)]
5053 (define_insn_and_split "builtin_setjmp_receiver"
5054 [(unspec_volatile [(match_operand:DI 0 "" "")] UNSPECV_SETJMP_RECEIVER)]
5064 (define_expand "eh_epilogue"
5065 [(use (match_operand:DI 0 "register_operand" "r"))
5066 (use (match_operand:DI 1 "register_operand" "r"))
5067 (use (match_operand:DI 2 "register_operand" "r"))]
5070 rtx bsp = gen_rtx_REG (Pmode, 10);
5071 rtx sp = gen_rtx_REG (Pmode, 9);
5073 if (GET_CODE (operands[0]) != REG || REGNO (operands[0]) != 10)
5075 emit_move_insn (bsp, operands[0]);
5078 if (GET_CODE (operands[2]) != REG || REGNO (operands[2]) != 9)
5080 emit_move_insn (sp, operands[2]);
5086 cfun->machine->ia64_eh_epilogue_sp = sp;
5087 cfun->machine->ia64_eh_epilogue_bsp = bsp;
5090 ;; Builtin apply support.
5092 (define_expand "restore_stack_nonlocal"
5093 [(use (match_operand:DI 0 "register_operand" ""))
5094 (use (match_operand:OI 1 "memory_operand" ""))]
5097 emit_library_call (gen_rtx_SYMBOL_REF (Pmode,
5098 "__ia64_restore_stack_nonlocal"),
5099 LCT_NORMAL, VOIDmode, 1,
5100 copy_to_reg (XEXP (operands[1], 0)), Pmode);
5108 [(match_operator 0 "predicate_operator"
5109 [(match_operand:BI 1 "register_operand" "c")
5114 (define_insn "pred_rel_mutex"
5115 [(set (match_operand:BI 0 "register_operand" "+c")
5116 (unspec:BI [(match_dup 0)] UNSPEC_PRED_REL_MUTEX))]
5118 ".pred.rel.mutex %0, %I0"
5119 [(set_attr "itanium_class" "ignore")
5120 (set_attr "predicable" "no")])
5122 (define_insn "safe_across_calls_all"
5123 [(unspec_volatile [(const_int 0)] UNSPECV_PSAC_ALL)]
5125 ".pred.safe_across_calls p1-p63"
5126 [(set_attr "itanium_class" "ignore")
5127 (set_attr "predicable" "no")])
5129 (define_insn "safe_across_calls_normal"
5130 [(unspec_volatile [(const_int 0)] UNSPECV_PSAC_NORMAL)]
5133 emit_safe_across_calls ();
5136 [(set_attr "itanium_class" "ignore")
5137 (set_attr "predicable" "no")])
5139 ;; UNSPEC instruction definition to "swizzle" 32-bit pointer into 64-bit
5140 ;; pointer. This is used by the HP-UX 32 bit mode.
5142 (define_insn "ptr_extend"
5143 [(set (match_operand:DI 0 "gr_register_operand" "=r")
5144 (unspec:DI [(match_operand:SI 1 "gr_register_operand" "r")]
5148 [(set_attr "itanium_class" "ialu")])
5151 ;; Optimizations for ptr_extend
5153 (define_insn "ptr_extend_plus_imm"
5154 [(set (match_operand:DI 0 "gr_register_operand" "=r")
5156 [(plus:SI (match_operand:SI 1 "basereg_operand" "r")
5157 (match_operand:SI 2 "gr_reg_or_14bit_operand" "rI"))]
5159 "addp4_optimize_ok (operands[1], operands[2])"
5161 [(set_attr "itanium_class" "ialu")])
5163 (define_insn "*ptr_extend_plus_2"
5164 [(set (match_operand:DI 0 "gr_register_operand" "=r")
5166 [(plus:SI (match_operand:SI 1 "gr_register_operand" "r")
5167 (match_operand:SI 2 "basereg_operand" "r"))]
5169 "addp4_optimize_ok (operands[1], operands[2])"
5171 [(set_attr "itanium_class" "ialu")])
5174 ;; Get instruction pointer
5176 (define_insn "ip_value"
5177 [(set (match_operand:DI 0 "register_operand" "=r")
5181 [(set_attr "itanium_class" "frbr")])
5183 ;; Vector operations
5185 ;; Atomic operations
5187 ;; New division operations