1 ;; IA-64 Machine description template
2 ;; Copyright (C) 1999, 2000 Free Software Foundation, Inc.
3 ;; Contributed by James E. Wilson <wilson@cygnus.com> and
4 ;; David Mosberger <davidm@hpl.hp.com>.
6 ;; This file is part of GNU CC.
8 ;; GNU CC is free software; you can redistribute it and/or modify
9 ;; it under the terms of the GNU General Public License as published by
10 ;; the Free Software Foundation; either version 2, or (at your option)
13 ;; GNU CC is distributed in the hope that it will be useful,
14 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
15 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 ;; GNU General Public License for more details.
18 ;; You should have received a copy of the GNU General Public License
19 ;; along with GNU CC; see the file COPYING. If not, write to
20 ;; the Free Software Foundation, 59 Temple Place - Suite 330,
21 ;; Boston, MA 02111-1307, USA.
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.
73 ;; 2 insn_group_barrier
76 ;; 8 pred.safe_across_calls all
77 ;; 9 pred.safe_across_calls normal
79 ;; ::::::::::::::::::::
83 ;; ::::::::::::::::::::
85 ;; Instruction type. This primarily determines how instructions can be
86 ;; packed in bundles, and secondarily affects scheduling to function units.
88 ;; A alu, can go in I or M syllable of a bundle
93 ;; L long immediate, takes two syllables
96 ;; ??? Should not have any pattern with type unknown. Perhaps add code to
97 ;; check this in md_reorg? Currently use unknown for patterns which emit
98 ;; multiple instructions, patterns which emit 0 instructions, and patterns
99 ;; which emit instruction that can go in any slot (e.g. nop).
101 (define_attr "itanium_class" "unknown,ignore,stop_bit,br,fcmp,fcvtfx,fld,fmac,fmisc,frar_i,frar_m,frbr,frfr,frpr,ialu,icmp,ilog,ishf,ld,chk_s,long_i,mmmul,mmshf,mmshfi,rse_m,scall,sem,stf,st,syst_m0,syst_m,tbit,toar_i,toar_m,tobr,tofr,topr,xmpy,xtd,nop_b,nop_f,nop_i,nop_m,nop_x"
102 (const_string "unknown"))
104 ;; chk_s has an I and an M form; use type A for convenience.
105 (define_attr "type" "unknown,A,I,M,F,B,L,X,S"
106 (cond [(eq_attr "itanium_class" "ld,st,fld,stf,sem,nop_m") (const_string "M")
107 (eq_attr "itanium_class" "rse_m,syst_m,syst_m0") (const_string "M")
108 (eq_attr "itanium_class" "frar_m,toar_m,frfr,tofr") (const_string "M")
109 (eq_attr "itanium_class" "chk_s,ialu,icmp,ilog") (const_string "A")
110 (eq_attr "itanium_class" "fmisc,fmac,fcmp,xmpy") (const_string "F")
111 (eq_attr "itanium_class" "fcvtfx,nop_f") (const_string "F")
112 (eq_attr "itanium_class" "frar_i,toar_i,frbr,tobr") (const_string "I")
113 (eq_attr "itanium_class" "frpr,topr,ishf,xtd,tbit") (const_string "I")
114 (eq_attr "itanium_class" "mmmul,mmshf,mmshfi,nop_i") (const_string "I")
115 (eq_attr "itanium_class" "br,scall,nop_b") (const_string "B")
116 (eq_attr "itanium_class" "stop_bit") (const_string "S")
117 (eq_attr "itanium_class" "nop_x") (const_string "X")
118 (eq_attr "itanium_class" "long_i") (const_string "L")]
119 (const_string "unknown")))
121 (define_attr "itanium_requires_unit0" "no,yes"
122 (cond [(eq_attr "itanium_class" "syst_m0,sem,frfr,rse_m") (const_string "yes")
123 (eq_attr "itanium_class" "toar_m,frar_m") (const_string "yes")
124 (eq_attr "itanium_class" "frbr,tobr,mmmul") (const_string "yes")
125 (eq_attr "itanium_class" "tbit,ishf,topr,frpr") (const_string "yes")
126 (eq_attr "itanium_class" "toar_i,frar_i") (const_string "yes")
127 (eq_attr "itanium_class" "fmisc,fcmp") (const_string "yes")]
128 (const_string "no")))
130 ;; Predication. True iff this instruction can be predicated.
132 (define_attr "predicable" "no,yes" (const_string "yes"))
135 ;; ::::::::::::::::::::
139 ;; ::::::::::::::::::::
141 ;; We define 6 "dummy" functional units. All the real work to decide which
142 ;; insn uses which unit is done by our MD_SCHED_REORDER hooks. We only
143 ;; have to ensure here that there are enough copies of the dummy unit so
144 ;; that the scheduler doesn't get confused by MD_SCHED_REORDER.
145 ;; Other than the 6 dummies for normal insns, we also add a single dummy unit
148 (define_function_unit "dummy" 6 1 (eq_attr "itanium_class" "br") 0 0)
149 (define_function_unit "dummy" 6 1 (eq_attr "itanium_class" "scall") 0 0)
150 (define_function_unit "dummy" 6 1 (eq_attr "itanium_class" "fcmp") 2 0)
151 (define_function_unit "dummy" 6 1 (eq_attr "itanium_class" "fcvtfx") 7 0)
152 (define_function_unit "dummy" 6 1 (eq_attr "itanium_class" "fld") 9 0)
153 (define_function_unit "dummy" 6 1 (eq_attr "itanium_class" "fmac") 5 0)
154 (define_function_unit "dummy" 6 1 (eq_attr "itanium_class" "fmisc") 5 0)
156 ;; There is only one insn `mov = ar.bsp' for frar_i:
157 (define_function_unit "dummy" 6 1 (eq_attr "itanium_class" "frar_i") 13 0)
158 ;; There is only ony insn `mov = ar.unat' for frar_m:
159 (define_function_unit "dummy" 6 1 (eq_attr "itanium_class" "frar_m") 6 0)
160 (define_function_unit "dummy" 6 1 (eq_attr "itanium_class" "frbr") 2 0)
161 (define_function_unit "dummy" 6 1 (eq_attr "itanium_class" "frfr") 2 0)
162 (define_function_unit "dummy" 6 1 (eq_attr "itanium_class" "frpr") 2 0)
164 (define_function_unit "dummy" 6 1 (eq_attr "itanium_class" "ialu") 1 0)
165 (define_function_unit "dummy" 6 1 (eq_attr "itanium_class" "icmp") 1 0)
166 (define_function_unit "dummy" 6 1 (eq_attr "itanium_class" "ilog") 1 0)
167 (define_function_unit "dummy" 6 1 (eq_attr "itanium_class" "ishf") 1 0)
168 (define_function_unit "dummy" 6 1 (eq_attr "itanium_class" "ld") 2 0)
169 (define_function_unit "dummy" 6 1 (eq_attr "itanium_class" "long_i") 1 0)
170 (define_function_unit "dummy" 6 1 (eq_attr "itanium_class" "mmmul") 2 0)
171 (define_function_unit "dummy" 6 1 (eq_attr "itanium_class" "mmshf") 2 0)
172 (define_function_unit "dummy" 6 1 (eq_attr "itanium_class" "mmshfi") 2 0)
174 ;; Now we have only one insn (flushrs) of such class. We assume that flushrs
175 ;; is the 1st syllable of the bundle after stop bit.
176 (define_function_unit "dummy" 6 1 (eq_attr "itanium_class" "rse_m") 0 0)
177 (define_function_unit "dummy" 6 1 (eq_attr "itanium_class" "sem") 11 0)
178 (define_function_unit "dummy" 6 1 (eq_attr "itanium_class" "stf") 1 0)
179 (define_function_unit "dummy" 6 1 (eq_attr "itanium_class" "st") 1 0)
180 (define_function_unit "dummy" 6 1 (eq_attr "itanium_class" "syst_m0") 1 0)
181 ;; Now we use only one insn `mf'. Therfore latency time is set up to 0.
182 (define_function_unit "dummy" 6 1 (eq_attr "itanium_class" "syst_m") 0 0)
183 (define_function_unit "dummy" 6 1 (eq_attr "itanium_class" "tbit") 1 0)
185 ;; There is only one insn `mov ar.pfs =' for toar_i therefore we use
186 ;; latency time equal to 0:
187 (define_function_unit "dummy" 6 1 (eq_attr "itanium_class" "toar_i") 0 0)
188 ;; There are only ony 2 insns `mov ar.ccv =' and `mov ar.unat =' for toar_m:
189 (define_function_unit "dummy" 6 1 (eq_attr "itanium_class" "toar_m") 5 0)
190 (define_function_unit "dummy" 6 1 (eq_attr "itanium_class" "tobr") 1 0)
191 (define_function_unit "dummy" 6 1 (eq_attr "itanium_class" "tofr") 9 0)
192 (define_function_unit "dummy" 6 1 (eq_attr "itanium_class" "topr") 1 0)
193 (define_function_unit "dummy" 6 1 (eq_attr "itanium_class" "xmpy") 7 0)
194 (define_function_unit "dummy" 6 1 (eq_attr "itanium_class" "xtd") 1 0)
196 (define_function_unit "dummy" 6 1 (eq_attr "itanium_class" "nop_m") 0 0)
197 (define_function_unit "dummy" 6 1 (eq_attr "itanium_class" "nop_i") 0 0)
198 (define_function_unit "dummy" 6 1 (eq_attr "itanium_class" "nop_f") 0 0)
199 (define_function_unit "dummy" 6 1 (eq_attr "itanium_class" "nop_b") 0 0)
200 (define_function_unit "dummy" 6 1 (eq_attr "itanium_class" "nop_x") 0 0)
202 (define_function_unit "stop_bit" 1 1 (eq_attr "itanium_class" "stop_bit") 0 0)
203 (define_function_unit "dummy" 6 1 (eq_attr "itanium_class" "ignore") 0 0)
204 (define_function_unit "dummy" 6 1 (eq_attr "itanium_class" "unknown") 0 0)
206 ;; ::::::::::::::::::::
210 ;; ::::::::::::::::::::
212 ;; Set of a single predicate register. This is only used to implement
213 ;; pr-to-pr move and complement.
215 (define_insn "*movcci"
216 [(set (match_operand:CCI 0 "register_operand" "=c,c,c")
217 (match_operand:CCI 1 "nonmemory_operand" "O,n,c"))]
220 cmp.ne %0, p0 = r0, r0
221 cmp.eq %0, p0 = r0, r0
222 (%1) cmp.eq.unc %0, p0 = r0, r0"
223 [(set_attr "itanium_class" "icmp")
224 (set_attr "predicable" "no")])
227 [(set (match_operand:BI 0 "nonimmediate_operand" "=c,c,?c,?*r, c,*r,*r,*m,*r")
228 (match_operand:BI 1 "move_operand" " O,n, c, c,*r, n,*m,*r,*r"))]
231 cmp.ne %0, %I0 = r0, r0
232 cmp.eq %0, %I0 = r0, r0
235 tbit.nz %0, %I0 = %1, 0
240 [(set_attr "itanium_class" "icmp,icmp,unknown,unknown,tbit,ialu,ld,st,ialu")])
243 [(set (match_operand:BI 0 "register_operand" "")
244 (match_operand:BI 1 "register_operand" ""))]
246 && GET_CODE (operands[0]) == REG && GR_REGNO_P (REGNO (operands[0]))
247 && GET_CODE (operands[1]) == REG && PR_REGNO_P (REGNO (operands[1]))"
248 [(cond_exec (ne (match_dup 1) (const_int 0))
249 (set (match_dup 0) (const_int 1)))
250 (cond_exec (eq (match_dup 1) (const_int 0))
251 (set (match_dup 0) (const_int 0)))]
255 [(set (match_operand:BI 0 "register_operand" "")
256 (match_operand:BI 1 "register_operand" ""))]
258 && GET_CODE (operands[0]) == REG && PR_REGNO_P (REGNO (operands[0]))
259 && GET_CODE (operands[1]) == REG && PR_REGNO_P (REGNO (operands[1]))"
260 [(set (match_dup 2) (match_dup 4))
261 (set (match_dup 3) (match_dup 5))
262 (set (match_dup 0) (unspec:BI [(match_dup 0)] 7))]
263 "operands[2] = gen_rtx_REG (CCImode, REGNO (operands[0]));
264 operands[3] = gen_rtx_REG (CCImode, REGNO (operands[0]) + 1);
265 operands[4] = gen_rtx_REG (CCImode, REGNO (operands[1]));
266 operands[5] = gen_rtx_REG (CCImode, REGNO (operands[1]) + 1);")
268 (define_expand "movqi"
269 [(set (match_operand:QI 0 "general_operand" "")
270 (match_operand:QI 1 "general_operand" ""))]
274 if (! reload_in_progress && ! reload_completed
275 && ! ia64_move_ok (operands[0], operands[1]))
276 operands[1] = force_reg (QImode, operands[1]);
279 (define_insn "*movqi_internal"
280 [(set (match_operand:QI 0 "destination_operand" "=r,r,r, m, r,*f,*f")
281 (match_operand:QI 1 "move_operand" "rO,J,m,rO,*f,rO,*f"))]
282 "ia64_move_ok (operands[0], operands[1])"
291 [(set_attr "itanium_class" "ialu,ialu,ld,st,frfr,tofr,fmisc")])
293 (define_expand "movhi"
294 [(set (match_operand:HI 0 "general_operand" "")
295 (match_operand:HI 1 "general_operand" ""))]
299 if (! reload_in_progress && ! reload_completed
300 && ! ia64_move_ok (operands[0], operands[1]))
301 operands[1] = force_reg (HImode, operands[1]);
304 (define_insn "*movhi_internal"
305 [(set (match_operand:HI 0 "destination_operand" "=r,r,r, m, r,*f,*f")
306 (match_operand:HI 1 "move_operand" "rO,J,m,rO,*f,rO,*f"))]
307 "ia64_move_ok (operands[0], operands[1])"
316 [(set_attr "itanium_class" "ialu,ialu,ld,st,frfr,tofr,fmisc")])
318 (define_expand "movsi"
319 [(set (match_operand:SI 0 "general_operand" "")
320 (match_operand:SI 1 "general_operand" ""))]
324 if (! reload_in_progress && ! reload_completed
325 && ! ia64_move_ok (operands[0], operands[1]))
326 operands[1] = force_reg (SImode, operands[1]);
329 (define_insn "*movsi_internal"
330 [(set (match_operand:SI 0 "destination_operand" "=r,r,r,r, m, r,*f,*f, r,*d")
331 (match_operand:SI 1 "move_operand" "rO,J,i,m,rO,*f,rO,*f,*d,rK"))]
332 "ia64_move_ok (operands[0], operands[1])"
344 ;; frar_m, toar_m ??? why not frar_i and toar_i
345 [(set_attr "itanium_class" "ialu,ialu,long_i,ld,st,frfr,tofr,fmisc,frar_m,toar_m")])
347 (define_expand "movdi"
348 [(set (match_operand:DI 0 "general_operand" "")
349 (match_operand:DI 1 "general_operand" ""))]
353 if (! reload_in_progress && ! reload_completed
354 && ! ia64_move_ok (operands[0], operands[1]))
355 operands[1] = force_reg (DImode, operands[1]);
356 if (! TARGET_NO_PIC && symbolic_operand (operands[1], DImode))
358 /* Before optimization starts, delay committing to any particular
359 type of PIC address load. If this function gets deferred, we
360 may acquire information that changes the value of the
361 sdata_symbolic_operand predicate. */
362 /* But don't delay for function pointers. Loading a function address
363 actually loads the address of the descriptor not the function.
364 If we represent these as SYMBOL_REFs, then they get cse'd with
365 calls, and we end up with calls to the descriptor address instead of
366 calls to the function address. Functions are not candidates for
368 if (rtx_equal_function_value_matters
369 && ! (GET_CODE (operands[1]) == SYMBOL_REF
370 && SYMBOL_REF_FLAG (operands[1])))
371 emit_insn (gen_movdi_symbolic (operands[0], operands[1], gen_reg_rtx (DImode)));
373 ia64_expand_load_address (operands[0], operands[1], NULL_RTX);
378 ;; This is used during early compilation to delay the decision on
379 ;; how to refer to a variable as long as possible. This is especially
380 ;; important between initial rtl generation and optimization for
381 ;; deferred functions, since we may acquire additional information
382 ;; on the variables used in the meantime.
384 ;; ??? This causes us to lose REG_LABEL notes, because the insn splitter
385 ;; does not attempt to preserve any REG_NOTES on the input instruction.
387 (define_insn_and_split "movdi_symbolic"
388 [(set (match_operand:DI 0 "register_operand" "=r")
389 (match_operand:DI 1 "symbolic_operand" "s"))
390 (clobber (match_operand:DI 2 "register_operand" "+r"))
396 "ia64_expand_load_address (operands[0], operands[1], operands[2]); DONE;")
398 (define_insn "*movdi_internal"
399 [(set (match_operand:DI 0 "destination_operand"
400 "=r,r,r,r, m, r,*f,*f,*f, Q, r,*b, r,*e, r,*d, r,*c")
401 (match_operand:DI 1 "move_operand"
402 "rO,J,i,m,rO,*f,rO,*f, Q,*f,*b,rO,*e,rK,*d,rK,*c,rO"))]
403 "ia64_move_ok (operands[0], operands[1])"
406 static const char * const alt[] = {
408 \"%,addl %0 = %1, r0\",
410 \"%,ld8%O1 %0 = %1%P1\",
411 \"%,st8%Q0 %0 = %r1%P0\",
412 \"%,getf.sig %0 = %1\",
413 \"%,setf.sig %0 = %r1\",
415 \"%,ldf8 %0 = %1%P1\",
416 \"%,stf8 %0 = %1%P0\",
427 if (which_alternative == 2 && ! TARGET_NO_PIC
428 && symbolic_operand (operands[1], VOIDmode))
431 return alt[which_alternative];
433 [(set_attr "itanium_class" "ialu,ialu,long_i,ld,st,frfr,tofr,fmisc,fld,stf,frbr,tobr,frar_i,toar_i,frar_m,toar_m,frpr,topr")])
436 [(set (match_operand:DI 0 "register_operand" "")
437 (match_operand:DI 1 "symbolic_operand" ""))]
438 "reload_completed && ! TARGET_NO_PIC"
442 ia64_expand_load_address (operands[0], operands[1], NULL_RTX);
446 (define_expand "load_fptr"
448 (plus:DI (reg:DI 1) (match_operand:DI 1 "function_operand" "")))
449 (set (match_operand:DI 0 "register_operand" "") (match_dup 3))]
453 operands[2] = no_new_pseudos ? operands[0] : gen_reg_rtx (DImode);
454 operands[3] = gen_rtx_MEM (DImode, operands[2]);
455 RTX_UNCHANGING_P (operands[3]) = 1;
458 (define_insn "*load_fptr_internal1"
459 [(set (match_operand:DI 0 "register_operand" "=r")
460 (plus:DI (reg:DI 1) (match_operand:DI 1 "function_operand" "s")))]
462 "addl %0 = @ltoff(@fptr(%1)), gp"
463 [(set_attr "itanium_class" "ialu")])
465 (define_insn "load_gprel"
466 [(set (match_operand:DI 0 "register_operand" "=r")
467 (plus:DI (reg:DI 1) (match_operand:DI 1 "sdata_symbolic_operand" "s")))]
469 "addl %0 = @gprel(%1), gp"
470 [(set_attr "itanium_class" "ialu")])
472 (define_insn "gprel64_offset"
473 [(set (match_operand:DI 0 "register_operand" "=r")
474 (minus:DI (match_operand:DI 1 "symbolic_operand" "") (reg:DI 1)))]
476 "movl %0 = @gprel(%1)"
477 [(set_attr "itanium_class" "long_i")])
479 (define_expand "load_gprel64"
481 (minus:DI (match_operand:DI 1 "symbolic_operand" "") (match_dup 3)))
482 (set (match_operand:DI 0 "register_operand" "")
483 (plus:DI (match_dup 3) (match_dup 2)))]
487 operands[2] = no_new_pseudos ? operands[0] : gen_reg_rtx (DImode);
488 operands[3] = pic_offset_table_rtx;
491 (define_expand "load_symptr"
492 [(set (match_operand:DI 2 "register_operand" "")
493 (plus:DI (match_dup 4) (match_operand:DI 1 "got_symbolic_operand" "")))
494 (set (match_operand:DI 0 "register_operand" "") (match_dup 3))]
498 operands[3] = gen_rtx_MEM (DImode, operands[2]);
499 operands[4] = pic_offset_table_rtx;
500 RTX_UNCHANGING_P (operands[3]) = 1;
503 (define_insn "*load_symptr_internal1"
504 [(set (match_operand:DI 0 "register_operand" "=r")
505 (plus:DI (reg:DI 1) (match_operand:DI 1 "got_symbolic_operand" "s")))]
507 "addl %0 = @ltoff(%1), gp"
508 [(set_attr "itanium_class" "ialu")])
510 ;; With no offsettable memory references, we've got to have a scratch
511 ;; around to play with the second word.
512 (define_expand "movti"
513 [(parallel [(set (match_operand:TI 0 "general_operand" "")
514 (match_operand:TI 1 "general_operand" ""))
515 (clobber (match_scratch:DI 2 ""))])]
519 if (! reload_in_progress && ! reload_completed
520 && ! ia64_move_ok (operands[0], operands[1]))
521 operands[1] = force_reg (TImode, operands[1]);
524 (define_insn_and_split "*movti_internal"
525 [(set (match_operand:TI 0 "nonimmediate_operand" "=r,r,m")
526 (match_operand:TI 1 "general_operand" "ri,m,r"))
527 (clobber (match_scratch:DI 2 "=X,&r,&r"))]
528 "ia64_move_ok (operands[0], operands[1])"
534 rtx adj1, adj2, in[2], out[2];
537 adj1 = ia64_split_timode (in, operands[1], operands[2]);
538 adj2 = ia64_split_timode (out, operands[0], operands[2]);
541 if (reg_overlap_mentioned_p (out[0], in[1]))
543 if (reg_overlap_mentioned_p (out[1], in[0]))
554 emit_insn (gen_rtx_SET (VOIDmode, out[first], in[first]));
555 emit_insn (gen_rtx_SET (VOIDmode, out[!first], in[!first]));
558 [(set_attr "itanium_class" "unknown")
559 (set_attr "predicable" "no")])
561 ;; ??? SSA creates these. Can't allow memories since we don't have
562 ;; the scratch register. Fortunately combine will know how to add
563 ;; the clobber and scratch.
564 (define_insn_and_split "*movti_internal_reg"
565 [(set (match_operand:TI 0 "register_operand" "=r")
566 (match_operand:TI 1 "nonmemory_operand" "ri"))]
576 ia64_split_timode (in, operands[1], NULL_RTX);
577 ia64_split_timode (out, operands[0], NULL_RTX);
580 if (reg_overlap_mentioned_p (out[0], in[1]))
582 if (reg_overlap_mentioned_p (out[1], in[0]))
587 emit_insn (gen_rtx_SET (VOIDmode, out[first], in[first]));
588 emit_insn (gen_rtx_SET (VOIDmode, out[!first], in[!first]));
591 [(set_attr "itanium_class" "unknown")
592 (set_attr "predicable" "no")])
594 (define_expand "reload_inti"
595 [(parallel [(set (match_operand:TI 0 "register_operand" "=r")
596 (match_operand:TI 1 "" "m"))
597 (clobber (match_operand:TI 2 "register_operand" "=&r"))])]
601 unsigned int s_regno = REGNO (operands[2]);
602 if (s_regno == REGNO (operands[0]))
604 operands[2] = gen_rtx_REG (DImode, s_regno);
607 (define_expand "reload_outti"
608 [(parallel [(set (match_operand:TI 0 "" "=m")
609 (match_operand:TI 1 "register_operand" "r"))
610 (clobber (match_operand:TI 2 "register_operand" "=&r"))])]
614 unsigned int s_regno = REGNO (operands[2]);
615 if (s_regno == REGNO (operands[1]))
617 operands[2] = gen_rtx_REG (DImode, s_regno);
620 ;; Floating Point Moves
622 ;; Note - Patterns for SF mode moves are compulsory, but
623 ;; patterns for DF are optional, as GCC can synthesise them.
625 (define_expand "movsf"
626 [(set (match_operand:SF 0 "general_operand" "")
627 (match_operand:SF 1 "general_operand" ""))]
631 if (! reload_in_progress && ! reload_completed
632 && ! ia64_move_ok (operands[0], operands[1]))
633 operands[1] = force_reg (SFmode, operands[1]);
636 (define_insn "*movsf_internal"
637 [(set (match_operand:SF 0 "destination_operand" "=f,f, Q,*r, f,*r,*r, m")
638 (match_operand:SF 1 "general_operand" "fG,Q,fG,fG,*r,*r, m,*r"))]
639 "ia64_move_ok (operands[0], operands[1])"
649 [(set_attr "itanium_class" "fmisc,fld,stf,frfr,tofr,ialu,ld,st")])
651 (define_expand "movdf"
652 [(set (match_operand:DF 0 "general_operand" "")
653 (match_operand:DF 1 "general_operand" ""))]
657 if (! reload_in_progress && ! reload_completed
658 && ! ia64_move_ok (operands[0], operands[1]))
659 operands[1] = force_reg (DFmode, operands[1]);
662 (define_insn "*movdf_internal"
663 [(set (match_operand:DF 0 "destination_operand" "=f,f, Q,*r, f,*r,*r, m")
664 (match_operand:DF 1 "general_operand" "fG,Q,fG,fG,*r,*r, m,*r"))]
665 "ia64_move_ok (operands[0], operands[1])"
675 [(set_attr "itanium_class" "fmisc,fld,stf,frfr,tofr,ialu,ld,st")])
677 ;; With no offsettable memory references, we've got to have a scratch
678 ;; around to play with the second word if the variable winds up in GRs.
679 (define_expand "movtf"
680 [(set (match_operand:TF 0 "general_operand" "")
681 (match_operand:TF 1 "general_operand" ""))]
685 /* We must support TFmode loads into general registers for stdarg/vararg
686 and unprototyped calls. We split them into DImode loads for convenience.
687 We don't need TFmode stores from general regs, because a stdarg/vararg
688 routine does a block store to memory of unnamed arguments. */
689 if (GET_CODE (operands[0]) == REG
690 && GR_REGNO_P (REGNO (operands[0])))
692 /* We're hoping to transform everything that deals with TFmode
693 quantities and GR registers early in the compiler. */
697 /* Struct to register can just use TImode instead. */
698 if ((GET_CODE (operands[1]) == SUBREG
699 && GET_MODE (SUBREG_REG (operands[1])) == TImode)
700 || (GET_CODE (operands[1]) == REG
701 && GR_REGNO_P (REGNO (operands[1]))))
703 emit_move_insn (gen_rtx_REG (TImode, REGNO (operands[0])),
704 SUBREG_REG (operands[1]));
708 if (GET_CODE (operands[1]) == CONST_DOUBLE)
710 emit_move_insn (gen_rtx_REG (DImode, REGNO (operands[0])),
711 operand_subword (operands[1], 0, 0, TFmode));
712 emit_move_insn (gen_rtx_REG (DImode, REGNO (operands[0]) + 1),
713 operand_subword (operands[1], 1, 0, TFmode));
717 /* If the quantity is in a register not known to be GR, spill it. */
718 if (register_operand (operands[1], TFmode))
719 operands[1] = spill_tfmode_operand (operands[1], 1);
721 if (GET_CODE (operands[1]) == MEM)
725 out[WORDS_BIG_ENDIAN] = gen_rtx_REG (DImode, REGNO (operands[0]));
726 out[!WORDS_BIG_ENDIAN] = gen_rtx_REG (DImode, REGNO (operands[0])+1);
728 emit_move_insn (out[0], change_address (operands[1], DImode, NULL));
729 emit_move_insn (out[1],
730 change_address (operands[1], DImode,
731 plus_constant (XEXP (operands[1], 0),
739 if (! reload_in_progress && ! reload_completed)
741 operands[0] = spill_tfmode_operand (operands[0], 0);
742 operands[1] = spill_tfmode_operand (operands[1], 0);
744 if (! ia64_move_ok (operands[0], operands[1]))
745 operands[1] = force_reg (TFmode, operands[1]);
749 ;; ??? There's no easy way to mind volatile acquire/release semantics.
751 (define_insn "*movtf_internal"
752 [(set (match_operand:TF 0 "destination_tfmode_operand" "=f,f, m")
753 (match_operand:TF 1 "general_tfmode_operand" "fG,m,fG"))]
754 "ia64_move_ok (operands[0], operands[1])"
759 [(set_attr "itanium_class" "fmisc,fld,stf")])
761 ;; ::::::::::::::::::::
765 ;; ::::::::::::::::::::
767 ;; Signed conversions from a smaller integer to a larger integer
769 (define_insn "extendqidi2"
770 [(set (match_operand:DI 0 "gr_register_operand" "=r")
771 (sign_extend:DI (match_operand:QI 1 "gr_register_operand" "r")))]
774 [(set_attr "itanium_class" "xtd")])
776 (define_insn "extendhidi2"
777 [(set (match_operand:DI 0 "gr_register_operand" "=r")
778 (sign_extend:DI (match_operand:HI 1 "gr_register_operand" "r")))]
781 [(set_attr "itanium_class" "xtd")])
783 (define_insn "extendsidi2"
784 [(set (match_operand:DI 0 "grfr_register_operand" "=r,?f")
785 (sign_extend:DI (match_operand:SI 1 "grfr_register_operand" "r,f")))]
790 [(set_attr "itanium_class" "xtd,fmisc")])
792 ;; Unsigned conversions from a smaller integer to a larger integer
794 (define_insn "zero_extendqidi2"
795 [(set (match_operand:DI 0 "gr_register_operand" "=r,r")
796 (zero_extend:DI (match_operand:QI 1 "gr_nonimmediate_operand" "r,m")))]
801 [(set_attr "itanium_class" "xtd,ld")])
803 (define_insn "zero_extendhidi2"
804 [(set (match_operand:DI 0 "gr_register_operand" "=r,r")
805 (zero_extend:DI (match_operand:HI 1 "gr_nonimmediate_operand" "r,m")))]
810 [(set_attr "itanium_class" "xtd,ld")])
812 (define_insn "zero_extendsidi2"
813 [(set (match_operand:DI 0 "grfr_register_operand" "=r,r,?f")
815 (match_operand:SI 1 "grfr_nonimmediate_operand" "r,m,f")))]
821 [(set_attr "itanium_class" "xtd,ld,fmisc")])
823 ;; Convert between floating point types of different sizes.
825 ;; At first glance, it would appear that emitting fnorm for an extending
826 ;; conversion is unnecessary. However, the stf and getf instructions work
827 ;; correctly only if the input is properly rounded for its type. In
828 ;; particular, we get the wrong result for getf.d/stfd if the input is a
829 ;; denorm single. Since we don't know what the next instruction will be, we
830 ;; have to emit an fnorm.
832 ;; ??? Optimization opportunity here. Get rid of the insn altogether
833 ;; when we can. Should probably use a scheme like has been proposed
834 ;; for ia32 in dealing with operands that match unary operators. This
835 ;; would let combine merge the thing into adjacent insns. See also how the
836 ;; mips port handles SIGN_EXTEND as operands to integer arithmetic insns via
837 ;; se_register_operand.
839 (define_insn "extendsfdf2"
840 [(set (match_operand:DF 0 "fr_register_operand" "=f")
841 (float_extend:DF (match_operand:SF 1 "fr_register_operand" "f")))]
844 [(set_attr "itanium_class" "fmac")])
846 (define_insn "extendsftf2"
847 [(set (match_operand:TF 0 "fr_register_operand" "=f")
848 (float_extend:TF (match_operand:SF 1 "fr_register_operand" "f")))]
851 [(set_attr "itanium_class" "fmac")])
853 (define_insn "extenddftf2"
854 [(set (match_operand:TF 0 "fr_register_operand" "=f")
855 (float_extend:TF (match_operand:DF 1 "fr_register_operand" "f")))]
858 [(set_attr "itanium_class" "fmac")])
860 (define_insn "truncdfsf2"
861 [(set (match_operand:SF 0 "fr_register_operand" "=f")
862 (float_truncate:SF (match_operand:DF 1 "fr_register_operand" "f")))]
865 [(set_attr "itanium_class" "fmac")])
867 (define_insn "trunctfsf2"
868 [(set (match_operand:SF 0 "fr_register_operand" "=f")
869 (float_truncate:SF (match_operand:TF 1 "fr_register_operand" "f")))]
872 [(set_attr "itanium_class" "fmac")])
874 (define_insn "trunctfdf2"
875 [(set (match_operand:DF 0 "fr_register_operand" "=f")
876 (float_truncate:DF (match_operand:TF 1 "fr_register_operand" "f")))]
879 [(set_attr "itanium_class" "fmac")])
881 ;; Convert between signed integer types and floating point.
883 (define_insn "floatditf2"
884 [(set (match_operand:TF 0 "fr_register_operand" "=f")
885 (float:TF (match_operand:DI 1 "fr_register_operand" "f")))]
888 [(set_attr "itanium_class" "fcvtfx")])
890 (define_insn "fix_truncsfdi2"
891 [(set (match_operand:DI 0 "fr_register_operand" "=f")
892 (fix:DI (match_operand:SF 1 "fr_register_operand" "f")))]
894 "fcvt.fx.trunc %0 = %1"
895 [(set_attr "itanium_class" "fcvtfx")])
897 (define_insn "fix_truncdfdi2"
898 [(set (match_operand:DI 0 "fr_register_operand" "=f")
899 (fix:DI (match_operand:DF 1 "fr_register_operand" "f")))]
901 "fcvt.fx.trunc %0 = %1"
902 [(set_attr "itanium_class" "fcvtfx")])
904 (define_insn "fix_trunctfdi2"
905 [(set (match_operand:DI 0 "fr_register_operand" "=f")
906 (fix:DI (match_operand:TF 1 "fr_register_operand" "f")))]
908 "fcvt.fx.trunc %0 = %1"
909 [(set_attr "itanium_class" "fcvtfx")])
911 (define_insn "fix_trunctfdi2_alts"
912 [(set (match_operand:DI 0 "fr_register_operand" "=f")
913 (fix:DI (match_operand:TF 1 "fr_register_operand" "f")))
914 (use (match_operand:SI 2 "const_int_operand" ""))]
916 "fcvt.fx.trunc.s%2 %0 = %1"
917 [(set_attr "itanium_class" "fcvtfx")])
919 ;; Convert between unsigned integer types and floating point.
921 (define_insn "floatunsdisf2"
922 [(set (match_operand:SF 0 "fr_register_operand" "=f")
923 (unsigned_float:SF (match_operand:DI 1 "fr_register_operand" "f")))]
926 [(set_attr "itanium_class" "fcvtfx")])
928 (define_insn "floatunsdidf2"
929 [(set (match_operand:DF 0 "fr_register_operand" "=f")
930 (unsigned_float:DF (match_operand:DI 1 "fr_register_operand" "f")))]
933 [(set_attr "itanium_class" "fcvtfx")])
935 (define_insn "floatunsditf2"
936 [(set (match_operand:TF 0 "fr_register_operand" "=f")
937 (unsigned_float:TF (match_operand:DI 1 "fr_register_operand" "f")))]
940 [(set_attr "itanium_class" "fcvtfx")])
942 (define_insn "fixuns_truncsfdi2"
943 [(set (match_operand:DI 0 "fr_register_operand" "=f")
944 (unsigned_fix:DI (match_operand:SF 1 "fr_register_operand" "f")))]
946 "fcvt.fxu.trunc %0 = %1"
947 [(set_attr "itanium_class" "fcvtfx")])
949 (define_insn "fixuns_truncdfdi2"
950 [(set (match_operand:DI 0 "fr_register_operand" "=f")
951 (unsigned_fix:DI (match_operand:DF 1 "fr_register_operand" "f")))]
953 "fcvt.fxu.trunc %0 = %1"
954 [(set_attr "itanium_class" "fcvtfx")])
956 (define_insn "fixuns_trunctfdi2"
957 [(set (match_operand:DI 0 "fr_register_operand" "=f")
958 (unsigned_fix:DI (match_operand:TF 1 "fr_register_operand" "f")))]
960 "fcvt.fxu.trunc %0 = %1"
961 [(set_attr "itanium_class" "fcvtfx")])
963 (define_insn "fixuns_trunctfdi2_alts"
964 [(set (match_operand:DI 0 "fr_register_operand" "=f")
965 (unsigned_fix:DI (match_operand:TF 1 "fr_register_operand" "f")))
966 (use (match_operand:SI 2 "const_int_operand" ""))]
968 "fcvt.fxu.trunc.s%2 %0 = %1"
969 [(set_attr "itanium_class" "fcvtfx")])
971 ;; ::::::::::::::::::::
973 ;; :: Bit field extraction
975 ;; ::::::::::::::::::::
978 [(set (match_operand:DI 0 "gr_register_operand" "=r")
979 (sign_extract:DI (match_operand:DI 1 "gr_register_operand" "r")
980 (match_operand:DI 2 "const_int_operand" "n")
981 (match_operand:DI 3 "const_int_operand" "n")))]
983 "extr %0 = %1, %3, %2"
984 [(set_attr "itanium_class" "ishf")])
987 [(set (match_operand:DI 0 "gr_register_operand" "=r")
988 (zero_extract:DI (match_operand:DI 1 "gr_register_operand" "r")
989 (match_operand:DI 2 "const_int_operand" "n")
990 (match_operand:DI 3 "const_int_operand" "n")))]
992 "extr.u %0 = %1, %3, %2"
993 [(set_attr "itanium_class" "ishf")])
995 ;; Insert a bit field.
996 ;; Can have 3 operands, source1 (inserter), source2 (insertee), dest.
997 ;; Source1 can be 0 or -1.
1000 ;; ??? Actual dep instruction is more powerful than what these insv
1001 ;; patterns support. Unfortunately, combine is unable to create patterns
1002 ;; where source2 != dest.
1004 (define_expand "insv"
1005 [(set (zero_extract:DI (match_operand:DI 0 "gr_register_operand" "")
1006 (match_operand:DI 1 "const_int_operand" "")
1007 (match_operand:DI 2 "const_int_operand" ""))
1008 (match_operand:DI 3 "nonmemory_operand" ""))]
1012 int width = INTVAL (operands[1]);
1013 int shift = INTVAL (operands[2]);
1015 /* If operand[3] is a constant, and isn't 0 or -1, then load it into a
1017 if (! register_operand (operands[3], DImode)
1018 && operands[3] != const0_rtx && operands[3] != constm1_rtx)
1019 operands[3] = force_reg (DImode, operands[3]);
1021 /* If this is a single dep instruction, we have nothing to do. */
1022 if (! ((register_operand (operands[3], DImode) && width <= 16)
1023 || operands[3] == const0_rtx || operands[3] == constm1_rtx))
1025 /* Check for cases that can be implemented with a mix instruction. */
1026 if (width == 32 && shift == 0)
1028 /* Directly generating the mix4left instruction confuses
1029 optimize_bit_field in function.c. Since this is performing
1030 a useful optimization, we defer generation of the complicated
1031 mix4left RTL to the first splitting phase. */
1032 rtx tmp = gen_reg_rtx (DImode);
1033 emit_insn (gen_shift_mix4left (operands[0], operands[3], tmp));
1036 else if (width == 32 && shift == 32)
1038 emit_insn (gen_mix4right (operands[0], operands[3]));
1042 /* We could handle remaining cases by emitting multiple dep
1045 If we need more than two dep instructions then we lose. A 6
1046 insn sequence mov mask1,mov mask2,shl;;and,and;;or is better than
1047 mov;;dep,shr;;dep,shr;;dep. The former can be executed in 3 cycles,
1048 the latter is 6 cycles on an Itanium (TM) processor, because there is
1049 only one function unit that can execute dep and shr immed.
1051 If we only need two dep instruction, then we still lose.
1052 mov;;dep,shr;;dep is still 4 cycles. Even if we optimize away
1053 the unnecessary mov, this is still undesirable because it will be
1054 hard to optimize, and it creates unnecessary pressure on the I0
1060 /* This code may be useful for other IA-64 processors, so we leave it in
1066 emit_insn (gen_insv (operands[0], GEN_INT (16), GEN_INT (shift),
1070 tmp = gen_reg_rtx (DImode);
1071 emit_insn (gen_lshrdi3 (tmp, operands[3], GEN_INT (16)));
1074 operands[1] = GEN_INT (width);
1075 operands[2] = GEN_INT (shift);
1080 (define_insn "*insv_internal"
1081 [(set (zero_extract:DI (match_operand:DI 0 "gr_register_operand" "+r")
1082 (match_operand:DI 1 "const_int_operand" "n")
1083 (match_operand:DI 2 "const_int_operand" "n"))
1084 (match_operand:DI 3 "nonmemory_operand" "rP"))]
1085 "(gr_register_operand (operands[3], DImode) && INTVAL (operands[1]) <= 16)
1086 || operands[3] == const0_rtx || operands[3] == constm1_rtx"
1087 "dep %0 = %3, %0, %2, %1"
1088 [(set_attr "itanium_class" "ishf")])
1090 ;; Combine doesn't like to create bitfield insertions into zero.
1091 (define_insn "*depz_internal"
1092 [(set (match_operand:DI 0 "gr_register_operand" "=r")
1093 (and:DI (ashift:DI (match_operand:DI 1 "gr_register_operand" "r")
1094 (match_operand:DI 2 "const_int_operand" "n"))
1095 (match_operand:DI 3 "const_int_operand" "n")))]
1096 "CONST_OK_FOR_M (INTVAL (operands[2]))
1097 && ia64_depz_field_mask (operands[3], operands[2]) > 0"
1100 operands[3] = GEN_INT (ia64_depz_field_mask (operands[3], operands[2]));
1101 return \"%,dep.z %0 = %1, %2, %3\";
1103 [(set_attr "itanium_class" "ishf")])
1105 (define_insn "shift_mix4left"
1106 [(set (zero_extract:DI (match_operand:DI 0 "gr_register_operand" "+r")
1107 (const_int 32) (const_int 0))
1108 (match_operand:DI 1 "gr_register_operand" "r"))
1109 (clobber (match_operand:DI 2 "gr_register_operand" "=r"))]
1112 [(set_attr "itanium_class" "unknown")])
1115 [(set (zero_extract:DI (match_operand:DI 0 "register_operand" "")
1116 (const_int 32) (const_int 0))
1117 (match_operand:DI 1 "register_operand" ""))
1118 (clobber (match_operand:DI 2 "register_operand" ""))]
1120 [(set (match_dup 3) (ashift:DI (match_dup 1) (const_int 32)))
1121 (set (zero_extract:DI (match_dup 0) (const_int 32) (const_int 0))
1122 (lshiftrt:DI (match_dup 3) (const_int 32)))]
1123 "operands[3] = operands[2];")
1126 [(set (zero_extract:DI (match_operand:DI 0 "register_operand" "")
1127 (const_int 32) (const_int 0))
1128 (match_operand:DI 1 "register_operand" ""))
1129 (clobber (match_operand:DI 2 "register_operand" ""))]
1130 "! reload_completed"
1131 [(set (match_dup 3) (ashift:DI (match_dup 1) (const_int 32)))
1132 (set (zero_extract:DI (match_dup 0) (const_int 32) (const_int 0))
1133 (lshiftrt:DI (match_dup 3) (const_int 32)))]
1134 "operands[3] = operands[2];")
1136 (define_insn "*mix4left"
1137 [(set (zero_extract:DI (match_operand:DI 0 "gr_register_operand" "+r")
1138 (const_int 32) (const_int 0))
1139 (lshiftrt:DI (match_operand:DI 1 "gr_register_operand" "r")
1142 "mix4.l %0 = %0, %r1"
1143 [(set_attr "itanium_class" "mmshf")])
1145 (define_insn "mix4right"
1146 [(set (zero_extract:DI (match_operand:DI 0 "gr_register_operand" "+r")
1147 (const_int 32) (const_int 32))
1148 (match_operand:DI 1 "gr_reg_or_0_operand" "rO"))]
1150 "mix4.r %0 = %r1, %0"
1151 [(set_attr "itanium_class" "mmshf")])
1153 ;; This is used by the rotrsi3 pattern.
1155 (define_insn "*mix4right_3op"
1156 [(set (match_operand:DI 0 "gr_register_operand" "=r")
1157 (ior:DI (zero_extend:DI (match_operand:SI 1 "gr_register_operand" "r"))
1158 (ashift:DI (zero_extend:DI
1159 (match_operand:SI 2 "gr_register_operand" "r"))
1162 "mix4.r %0 = %2, %1"
1163 [(set_attr "itanium_class" "mmshf")])
1166 ;; ::::::::::::::::::::
1168 ;; :: 1 bit Integer arithmetic
1170 ;; ::::::::::::::::::::
1172 (define_insn_and_split "andbi3"
1173 [(set (match_operand:BI 0 "register_operand" "=c,c,r")
1174 (and:BI (match_operand:BI 1 "register_operand" "%0,0,r")
1175 (match_operand:BI 2 "register_operand" "c,r,r")))]
1179 tbit.nz.and.orcm %0, %I0 = %2, 0
1182 && GET_CODE (operands[0]) == REG && PR_REGNO_P (REGNO (operands[0]))
1183 && GET_CODE (operands[2]) == REG && PR_REGNO_P (REGNO (operands[2]))"
1184 [(cond_exec (eq (match_dup 2) (const_int 0))
1185 (set (match_dup 0) (and:BI (ne:BI (const_int 0) (const_int 0))
1188 [(set_attr "itanium_class" "unknown,tbit,ilog")])
1190 (define_insn_and_split "*andcmbi3"
1191 [(set (match_operand:BI 0 "register_operand" "=c,c,r")
1192 (and:BI (not:BI (match_operand:BI 1 "register_operand" "c,r,r"))
1193 (match_operand:BI 2 "register_operand" "0,0,r")))]
1197 tbit.z.and.orcm %0, %I0 = %2, 0
1200 && GET_CODE (operands[0]) == REG && PR_REGNO_P (REGNO (operands[0]))
1201 && GET_CODE (operands[2]) == REG && PR_REGNO_P (REGNO (operands[2]))"
1202 [(cond_exec (ne (match_dup 1) (const_int 0))
1203 (set (match_dup 0) (and:BI (ne:BI (const_int 0) (const_int 0))
1206 [(set_attr "itanium_class" "unknown,tbit,ilog")])
1208 (define_insn_and_split "iorbi3"
1209 [(set (match_operand:BI 0 "register_operand" "=c,c,r")
1210 (ior:BI (match_operand:BI 1 "register_operand" "%0,0,r")
1211 (match_operand:BI 2 "register_operand" "c,r,r")))]
1215 tbit.nz.or.andcm %0, %I0 = %2, 0
1218 && GET_CODE (operands[0]) == REG && PR_REGNO_P (REGNO (operands[0]))
1219 && GET_CODE (operands[2]) == REG && PR_REGNO_P (REGNO (operands[2]))"
1220 [(cond_exec (ne (match_dup 2) (const_int 0))
1221 (set (match_dup 0) (ior:BI (eq:BI (const_int 0) (const_int 0))
1224 [(set_attr "itanium_class" "unknown,tbit,ilog")])
1226 (define_insn_and_split "*iorcmbi3"
1227 [(set (match_operand:BI 0 "register_operand" "=c,c")
1228 (ior:BI (not:BI (match_operand:BI 1 "register_operand" "c,r"))
1229 (match_operand:BI 2 "register_operand" "0,0")))]
1233 tbit.z.or.andcm %0, %I0 = %2, 0"
1235 && GET_CODE (operands[0]) == REG && PR_REGNO_P (REGNO (operands[0]))
1236 && GET_CODE (operands[2]) == REG && PR_REGNO_P (REGNO (operands[2]))"
1237 [(cond_exec (eq (match_dup 1) (const_int 0))
1238 (set (match_dup 0) (ior:BI (eq:BI (const_int 0) (const_int 0))
1241 [(set_attr "itanium_class" "unknown,tbit")])
1243 (define_insn "one_cmplbi2"
1244 [(set (match_operand:BI 0 "register_operand" "=c,r,c,&c")
1245 (not:BI (match_operand:BI 1 "register_operand" "r,r,0,c")))
1246 (clobber (match_scratch:BI 2 "=X,X,c,X"))]
1249 tbit.z %0, %I0 = %1, 0
1253 [(set_attr "itanium_class" "tbit,ilog,unknown,unknown")])
1256 [(set (match_operand:BI 0 "register_operand" "")
1257 (not:BI (match_operand:BI 1 "register_operand" "")))
1258 (clobber (match_scratch:BI 2 ""))]
1260 && GET_CODE (operands[0]) == REG && PR_REGNO_P (REGNO (operands[0]))
1261 && GET_CODE (operands[1]) == REG && PR_REGNO_P (REGNO (operands[1]))
1262 && rtx_equal_p (operands[0], operands[1])"
1263 [(set (match_dup 4) (match_dup 3))
1264 (set (match_dup 0) (const_int 1))
1265 (cond_exec (ne (match_dup 2) (const_int 0))
1266 (set (match_dup 0) (const_int 0)))
1267 (set (match_dup 0) (unspec:BI [(match_dup 0)] 7))]
1268 "operands[3] = gen_rtx_REG (CCImode, REGNO (operands[1]));
1269 operands[4] = gen_rtx_REG (CCImode, REGNO (operands[2]));")
1272 [(set (match_operand:BI 0 "register_operand" "")
1273 (not:BI (match_operand:BI 1 "register_operand" "")))
1274 (clobber (match_scratch:BI 2 ""))]
1276 && GET_CODE (operands[0]) == REG && PR_REGNO_P (REGNO (operands[0]))
1277 && GET_CODE (operands[1]) == REG && PR_REGNO_P (REGNO (operands[1]))
1278 && ! rtx_equal_p (operands[0], operands[1])"
1279 [(cond_exec (ne (match_dup 1) (const_int 0))
1280 (set (match_dup 0) (const_int 0)))
1281 (cond_exec (eq (match_dup 1) (const_int 0))
1282 (set (match_dup 0) (const_int 1)))
1283 (set (match_dup 0) (unspec:BI [(match_dup 0)] 7))]
1286 (define_insn "*cmpsi_and_0"
1287 [(set (match_operand:BI 0 "register_operand" "=c")
1288 (and:BI (match_operator:BI 4 "predicate_operator"
1289 [(match_operand:SI 2 "gr_reg_or_0_operand" "rO")
1290 (match_operand:SI 3 "gr_reg_or_8bit_operand" "rK")])
1291 (match_operand:BI 1 "register_operand" "0")))]
1293 "cmp4.%C4.and.orcm %0, %I0 = %3, %r2"
1294 [(set_attr "itanium_class" "icmp")])
1296 (define_insn "*cmpsi_and_1"
1297 [(set (match_operand:BI 0 "register_operand" "=c")
1298 (and:BI (match_operator:BI 3 "signed_inequality_operator"
1299 [(match_operand:SI 2 "gr_register_operand" "r")
1301 (match_operand:BI 1 "register_operand" "0")))]
1303 "cmp4.%C3.and.orcm %0, %I0 = r0, %2"
1304 [(set_attr "itanium_class" "icmp")])
1306 (define_insn "*cmpsi_andnot_0"
1307 [(set (match_operand:BI 0 "register_operand" "=c")
1308 (and:BI (not:BI (match_operator:BI 4 "predicate_operator"
1309 [(match_operand:SI 2 "gr_reg_or_0_operand" "rO")
1310 (match_operand:SI 3 "gr_reg_or_8bit_operand" "rK")]))
1311 (match_operand:BI 1 "register_operand" "0")))]
1313 "cmp4.%C4.or.andcm %I0, %0 = %3, %r2"
1314 [(set_attr "itanium_class" "icmp")])
1316 (define_insn "*cmpsi_andnot_1"
1317 [(set (match_operand:BI 0 "register_operand" "=c")
1318 (and:BI (not:BI (match_operator:BI 3 "signed_inequality_operator"
1319 [(match_operand:SI 2 "gr_register_operand" "r")
1321 (match_operand:BI 1 "register_operand" "0")))]
1323 "cmp4.%C3.or.andcm %I0, %0 = r0, %2"
1324 [(set_attr "itanium_class" "icmp")])
1326 (define_insn "*cmpdi_and_0"
1327 [(set (match_operand:BI 0 "register_operand" "=c")
1328 (and:BI (match_operator:BI 4 "predicate_operator"
1329 [(match_operand:DI 2 "gr_register_operand" "r")
1330 (match_operand:DI 3 "gr_reg_or_8bit_operand" "rK")])
1331 (match_operand:BI 1 "register_operand" "0")))]
1333 "cmp.%C4.and.orcm %0, %I0 = %3, %2"
1334 [(set_attr "itanium_class" "icmp")])
1336 (define_insn "*cmpdi_and_1"
1337 [(set (match_operand:BI 0 "register_operand" "=c")
1338 (and:BI (match_operator:BI 3 "signed_inequality_operator"
1339 [(match_operand:DI 2 "gr_register_operand" "r")
1341 (match_operand:BI 1 "register_operand" "0")))]
1343 "cmp.%C3.and.orcm %0, %I0 = r0, %2"
1344 [(set_attr "itanium_class" "icmp")])
1346 (define_insn "*cmpdi_andnot_0"
1347 [(set (match_operand:BI 0 "register_operand" "=c")
1348 (and:BI (not:BI (match_operator:BI 4 "predicate_operator"
1349 [(match_operand:DI 2 "gr_register_operand" "r")
1350 (match_operand:DI 3 "gr_reg_or_8bit_operand" "rK")]))
1351 (match_operand:BI 1 "register_operand" "0")))]
1353 "cmp.%C4.or.andcm %I0, %0 = %3, %2"
1354 [(set_attr "itanium_class" "icmp")])
1356 (define_insn "*cmpdi_andnot_1"
1357 [(set (match_operand:BI 0 "register_operand" "=c")
1358 (and:BI (not:BI (match_operator:BI 3 "signed_inequality_operator"
1359 [(match_operand:DI 2 "gr_register_operand" "r")
1361 (match_operand:BI 1 "register_operand" "0")))]
1363 "cmp.%C3.or.andcm %I0, %0 = r0, %2"
1364 [(set_attr "itanium_class" "icmp")])
1366 (define_insn "*tbit_and_0"
1367 [(set (match_operand:BI 0 "register_operand" "=c")
1368 (and:BI (ne:BI (and:DI (match_operand:DI 1 "gr_register_operand" "r")
1371 (match_operand:BI 2 "register_operand" "0")))]
1373 "tbit.nz.and.orcm %0, %I0 = %1, 0"
1374 [(set_attr "itanium_class" "tbit")])
1376 (define_insn "*tbit_and_1"
1377 [(set (match_operand:BI 0 "register_operand" "=c")
1378 (and:BI (eq:BI (and:DI (match_operand:DI 1 "gr_register_operand" "r")
1381 (match_operand:BI 2 "register_operand" "0")))]
1383 "tbit.z.and.orcm %0, %I0 = %1, 0"
1384 [(set_attr "itanium_class" "tbit")])
1386 (define_insn "*tbit_and_2"
1387 [(set (match_operand:BI 0 "register_operand" "=c")
1388 (and:BI (ne:BI (zero_extract:DI
1389 (match_operand:DI 1 "gr_register_operand" "r")
1391 (match_operand:DI 2 "const_int_operand" "n"))
1393 (match_operand:BI 3 "register_operand" "0")))]
1395 "tbit.nz.and.orcm %0, %I0 = %1, %2"
1396 [(set_attr "itanium_class" "tbit")])
1398 (define_insn "*tbit_and_3"
1399 [(set (match_operand:BI 0 "register_operand" "=c")
1400 (and:BI (eq:BI (zero_extract:DI
1401 (match_operand:DI 1 "gr_register_operand" "r")
1403 (match_operand:DI 2 "const_int_operand" "n"))
1405 (match_operand:BI 3 "register_operand" "0")))]
1407 "tbit.z.and.orcm %0, %I0 = %1, %2"
1408 [(set_attr "itanium_class" "tbit")])
1410 (define_insn "*cmpsi_or_0"
1411 [(set (match_operand:BI 0 "register_operand" "=c")
1412 (ior:BI (match_operator:BI 4 "predicate_operator"
1413 [(match_operand:SI 2 "gr_reg_or_0_operand" "rO")
1414 (match_operand:SI 3 "gr_reg_or_8bit_operand" "rK")])
1415 (match_operand:BI 1 "register_operand" "0")))]
1417 "cmp4.%C4.or.andcm %0, %I0 = %3, %r2"
1418 [(set_attr "itanium_class" "icmp")])
1420 (define_insn "*cmpsi_or_1"
1421 [(set (match_operand:BI 0 "register_operand" "=c")
1422 (ior:BI (match_operator:BI 3 "signed_inequality_operator"
1423 [(match_operand:SI 2 "gr_register_operand" "r")
1425 (match_operand:BI 1 "register_operand" "0")))]
1427 "cmp4.%C3.or.andcm %0, %I0 = r0, %2"
1428 [(set_attr "itanium_class" "icmp")])
1430 (define_insn "*cmpsi_orcm_0"
1431 [(set (match_operand:BI 0 "register_operand" "=c")
1432 (ior:BI (not:BI (match_operator:BI 4 "predicate_operator"
1433 [(match_operand:SI 2 "gr_reg_or_0_operand" "rO")
1434 (match_operand:SI 3 "gr_reg_or_8bit_operand" "rK")]))
1435 (match_operand:BI 1 "register_operand" "0")))]
1437 "cmp4.%C4.and.orcm %I0, %0 = %3, %r2"
1438 [(set_attr "itanium_class" "icmp")])
1440 (define_insn "*cmpsi_orcm_1"
1441 [(set (match_operand:BI 0 "register_operand" "=c")
1442 (ior:BI (not:BI (match_operator:BI 3 "signed_inequality_operator"
1443 [(match_operand:SI 2 "gr_register_operand" "r")
1445 (match_operand:BI 1 "register_operand" "0")))]
1447 "cmp4.%C3.and.orcm %I0, %0 = r0, %2"
1448 [(set_attr "itanium_class" "icmp")])
1450 (define_insn "*cmpdi_or_0"
1451 [(set (match_operand:BI 0 "register_operand" "=c")
1452 (ior:BI (match_operator:BI 4 "predicate_operator"
1453 [(match_operand:DI 2 "gr_register_operand" "r")
1454 (match_operand:DI 3 "gr_reg_or_8bit_operand" "rK")])
1455 (match_operand:BI 1 "register_operand" "0")))]
1457 "cmp.%C4.or.andcm %0, %I0 = %3, %2"
1458 [(set_attr "itanium_class" "icmp")])
1460 (define_insn "*cmpdi_or_1"
1461 [(set (match_operand:BI 0 "register_operand" "=c")
1462 (ior:BI (match_operator:BI 3 "signed_inequality_operator"
1463 [(match_operand:DI 2 "gr_register_operand" "r")
1465 (match_operand:BI 1 "register_operand" "0")))]
1467 "cmp.%C3.or.andcm %0, %I0 = r0, %2"
1468 [(set_attr "itanium_class" "icmp")])
1470 (define_insn "*cmpdi_orcm_0"
1471 [(set (match_operand:BI 0 "register_operand" "=c")
1472 (ior:BI (not:BI (match_operator:BI 4 "predicate_operator"
1473 [(match_operand:DI 2 "gr_register_operand" "r")
1474 (match_operand:DI 3 "gr_reg_or_8bit_operand" "rK")]))
1475 (match_operand:BI 1 "register_operand" "0")))]
1477 "cmp.%C4.and.orcm %I0, %0 = %3, %2"
1478 [(set_attr "itanium_class" "icmp")])
1480 (define_insn "*cmpdi_orcm_1"
1481 [(set (match_operand:BI 0 "register_operand" "=c")
1482 (ior:BI (not:BI (match_operator:BI 3 "signed_inequality_operator"
1483 [(match_operand:DI 2 "gr_register_operand" "r")
1485 (match_operand:BI 1 "register_operand" "0")))]
1487 "cmp.%C3.and.orcm %I0, %0 = r0, %2"
1488 [(set_attr "itanium_class" "icmp")])
1490 (define_insn "*tbit_or_0"
1491 [(set (match_operand:BI 0 "register_operand" "=c")
1492 (ior:BI (ne:BI (and:DI (match_operand:DI 1 "gr_register_operand" "r")
1495 (match_operand:BI 2 "register_operand" "0")))]
1497 "tbit.nz.or.andcm %0, %I0 = %1, 0"
1498 [(set_attr "itanium_class" "tbit")])
1500 (define_insn "*tbit_or_1"
1501 [(set (match_operand:BI 0 "register_operand" "=c")
1502 (ior:BI (eq:BI (and:DI (match_operand:DI 1 "gr_register_operand" "r")
1505 (match_operand:BI 2 "register_operand" "0")))]
1507 "tbit.z.or.andcm %0, %I0 = %1, 0"
1508 [(set_attr "itanium_class" "tbit")])
1510 (define_insn "*tbit_or_2"
1511 [(set (match_operand:BI 0 "register_operand" "=c")
1512 (ior:BI (ne:BI (zero_extract:DI
1513 (match_operand:DI 1 "gr_register_operand" "r")
1515 (match_operand:DI 2 "const_int_operand" "n"))
1517 (match_operand:BI 3 "register_operand" "0")))]
1519 "tbit.nz.or.andcm %0, %I0 = %1, %2"
1520 [(set_attr "itanium_class" "tbit")])
1522 (define_insn "*tbit_or_3"
1523 [(set (match_operand:BI 0 "register_operand" "=c")
1524 (ior:BI (eq:BI (zero_extract:DI
1525 (match_operand:DI 1 "gr_register_operand" "r")
1527 (match_operand:DI 2 "const_int_operand" "n"))
1529 (match_operand:BI 3 "register_operand" "0")))]
1531 "tbit.z.or.andcm %0, %I0 = %1, %2"
1532 [(set_attr "itanium_class" "tbit")])
1534 ;; Transform test of and/or of setcc into parallel comparisons.
1537 [(set (match_operand:BI 0 "register_operand" "")
1538 (ne:BI (and:DI (ne:DI (match_operand:BI 2 "register_operand" "")
1540 (match_operand:DI 3 "register_operand" ""))
1544 (and:BI (ne:BI (and:DI (match_dup 3) (const_int 1)) (const_int 0))
1549 [(set (match_operand:BI 0 "register_operand" "")
1550 (eq:BI (and:DI (ne:DI (match_operand:BI 2 "register_operand" "")
1552 (match_operand:DI 3 "register_operand" ""))
1556 (and:BI (ne:BI (and:DI (match_dup 3) (const_int 1)) (const_int 0))
1558 (parallel [(set (match_dup 0) (not:BI (match_dup 0)))
1559 (clobber (scratch))])]
1563 [(set (match_operand:BI 0 "register_operand" "")
1564 (ne:BI (ior:DI (ne:DI (match_operand:BI 2 "register_operand" "")
1566 (match_operand:DI 3 "register_operand" ""))
1570 (ior:BI (ne:BI (match_dup 3) (const_int 0))
1575 [(set (match_operand:BI 0 "register_operand" "")
1576 (eq:BI (ior:DI (ne:DI (match_operand:BI 2 "register_operand" "")
1578 (match_operand:DI 3 "register_operand" ""))
1582 (ior:BI (ne:BI (match_dup 3) (const_int 0))
1584 (parallel [(set (match_dup 0) (not:BI (match_dup 0)))
1585 (clobber (scratch))])]
1588 ;; ??? Incredibly hackish. Either need four proper patterns with all
1589 ;; the alternatives, or rely on sched1 to split the insn and hope that
1590 ;; nothing bad happens to the comparisons in the meantime.
1592 ;; Alternately, adjust combine to allow 2->2 and 3->3 splits, assuming
1593 ;; that we're doing height reduction.
1595 ;(define_insn_and_split ""
1596 ; [(set (match_operand:BI 0 "register_operand" "=c")
1597 ; (and:BI (and:BI (match_operator:BI 1 "comparison_operator"
1598 ; [(match_operand 2 "" "")
1599 ; (match_operand 3 "" "")])
1600 ; (match_operator:BI 4 "comparison_operator"
1601 ; [(match_operand 5 "" "")
1602 ; (match_operand 6 "" "")]))
1604 ; "flag_schedule_insns"
1607 ; [(set (match_dup 0) (and:BI (match_dup 1) (match_dup 0)))
1608 ; (set (match_dup 0) (and:BI (match_dup 4) (match_dup 0)))]
1611 ;(define_insn_and_split ""
1612 ; [(set (match_operand:BI 0 "register_operand" "=c")
1613 ; (ior:BI (ior:BI (match_operator:BI 1 "comparison_operator"
1614 ; [(match_operand 2 "" "")
1615 ; (match_operand 3 "" "")])
1616 ; (match_operator:BI 4 "comparison_operator"
1617 ; [(match_operand 5 "" "")
1618 ; (match_operand 6 "" "")]))
1620 ; "flag_schedule_insns"
1623 ; [(set (match_dup 0) (ior:BI (match_dup 1) (match_dup 0)))
1624 ; (set (match_dup 0) (ior:BI (match_dup 4) (match_dup 0)))]
1628 ; [(set (match_operand:BI 0 "register_operand" "")
1629 ; (and:BI (and:BI (match_operator:BI 1 "comparison_operator"
1630 ; [(match_operand 2 "" "")
1631 ; (match_operand 3 "" "")])
1632 ; (match_operand:BI 7 "register_operand" ""))
1633 ; (and:BI (match_operator:BI 4 "comparison_operator"
1634 ; [(match_operand 5 "" "")
1635 ; (match_operand 6 "" "")])
1636 ; (match_operand:BI 8 "register_operand" ""))))]
1638 ; [(set (match_dup 0) (and:BI (match_dup 7) (match_dup 8)))
1639 ; (set (match_dup 0) (and:BI (and:BI (match_dup 1) (match_dup 4))
1644 ; [(set (match_operand:BI 0 "register_operand" "")
1645 ; (ior:BI (ior:BI (match_operator:BI 1 "comparison_operator"
1646 ; [(match_operand 2 "" "")
1647 ; (match_operand 3 "" "")])
1648 ; (match_operand:BI 7 "register_operand" ""))
1649 ; (ior:BI (match_operator:BI 4 "comparison_operator"
1650 ; [(match_operand 5 "" "")
1651 ; (match_operand 6 "" "")])
1652 ; (match_operand:BI 8 "register_operand" ""))))]
1654 ; [(set (match_dup 0) (ior:BI (match_dup 7) (match_dup 8)))
1655 ; (set (match_dup 0) (ior:BI (ior:BI (match_dup 1) (match_dup 4))
1659 ;; Try harder to avoid predicate copies by duplicating compares.
1660 ;; Note that we'll have already split the predicate copy, which
1661 ;; is kind of a pain, but oh well.
1664 [(set (match_operand:BI 0 "register_operand" "")
1665 (match_operand:BI 1 "comparison_operator" ""))
1666 (set (match_operand:CCI 2 "register_operand" "")
1667 (match_operand:CCI 3 "register_operand" ""))
1668 (set (match_operand:CCI 4 "register_operand" "")
1669 (match_operand:CCI 5 "register_operand" ""))
1670 (set (match_operand:BI 6 "register_operand" "")
1671 (unspec:BI [(match_dup 6)] 7))]
1672 "REGNO (operands[3]) == REGNO (operands[0])
1673 && REGNO (operands[4]) == REGNO (operands[0]) + 1
1674 && REGNO (operands[4]) == REGNO (operands[2]) + 1
1675 && REGNO (operands[6]) == REGNO (operands[2])"
1676 [(set (match_dup 0) (match_dup 1))
1677 (set (match_dup 6) (match_dup 7))]
1678 "operands[7] = copy_rtx (operands[1]);")
1680 ;; ::::::::::::::::::::
1682 ;; :: 16 bit Integer arithmetic
1684 ;; ::::::::::::::::::::
1686 (define_insn "mulhi3"
1687 [(set (match_operand:HI 0 "gr_register_operand" "=r")
1688 (mult:HI (match_operand:HI 1 "gr_register_operand" "r")
1689 (match_operand:HI 2 "gr_register_operand" "r")))]
1691 "pmpy2.r %0 = %1, %2"
1692 [(set_attr "itanium_class" "mmmul")])
1695 ;; ::::::::::::::::::::
1697 ;; :: 32 bit Integer arithmetic
1699 ;; ::::::::::::::::::::
1701 (define_insn "addsi3"
1702 [(set (match_operand:SI 0 "gr_register_operand" "=r,r,r")
1703 (plus:SI (match_operand:SI 1 "gr_register_operand" "%r,r,a")
1704 (match_operand:SI 2 "gr_reg_or_22bit_operand" "r,I,J")))]
1710 [(set_attr "itanium_class" "ialu")])
1712 (define_insn "*addsi3_plus1"
1713 [(set (match_operand:SI 0 "gr_register_operand" "=r")
1714 (plus:SI (plus:SI (match_operand:SI 1 "gr_register_operand" "r")
1715 (match_operand:SI 2 "gr_register_operand" "r"))
1718 "add %0 = %1, %2, 1"
1719 [(set_attr "itanium_class" "ialu")])
1721 (define_insn "*addsi3_plus1_alt"
1722 [(set (match_operand:SI 0 "gr_register_operand" "=r")
1723 (plus:SI (mult:SI (match_operand:SI 1 "gr_register_operand" "r")
1727 "add %0 = %1, %1, 1"
1728 [(set_attr "itanium_class" "ialu")])
1730 (define_insn "*addsi3_shladd"
1731 [(set (match_operand:SI 0 "gr_register_operand" "=r")
1732 (plus:SI (mult:SI (match_operand:SI 1 "gr_register_operand" "r")
1733 (match_operand:SI 2 "shladd_operand" "n"))
1734 (match_operand:SI 3 "gr_register_operand" "r")))]
1736 "shladd %0 = %1, %S2, %3"
1737 [(set_attr "itanium_class" "ialu")])
1739 (define_insn "subsi3"
1740 [(set (match_operand:SI 0 "gr_register_operand" "=r")
1741 (minus:SI (match_operand:SI 1 "gr_reg_or_8bit_operand" "rK")
1742 (match_operand:SI 2 "gr_register_operand" "r")))]
1745 [(set_attr "itanium_class" "ialu")])
1747 (define_insn "*subsi3_minus1"
1748 [(set (match_operand:SI 0 "gr_register_operand" "=r")
1749 (plus:SI (not:SI (match_operand:SI 1 "gr_register_operand" "r"))
1750 (match_operand:SI 2 "gr_register_operand" "r")))]
1752 "sub %0 = %2, %1, 1"
1753 [(set_attr "itanium_class" "ialu")])
1755 ;; ??? Could add maddsi3 patterns patterned after the madddi3 patterns.
1757 (define_insn "mulsi3"
1758 [(set (match_operand:SI 0 "fr_register_operand" "=f")
1759 (mult:SI (match_operand:SI 1 "grfr_register_operand" "f")
1760 (match_operand:SI 2 "grfr_register_operand" "f")))]
1762 "xmpy.l %0 = %1, %2"
1763 [(set_attr "itanium_class" "xmpy")])
1765 (define_insn "maddsi4"
1766 [(set (match_operand:SI 0 "fr_register_operand" "=f")
1767 (plus:SI (mult:SI (match_operand:SI 1 "grfr_register_operand" "f")
1768 (match_operand:SI 2 "grfr_register_operand" "f"))
1769 (match_operand:SI 3 "grfr_register_operand" "f")))]
1771 "xma.l %0 = %1, %2, %3"
1772 [(set_attr "itanium_class" "xmpy")])
1774 (define_insn "negsi2"
1775 [(set (match_operand:SI 0 "gr_register_operand" "=r")
1776 (neg:SI (match_operand:SI 1 "gr_register_operand" "r")))]
1779 [(set_attr "itanium_class" "ialu")])
1781 (define_expand "abssi2"
1783 (ge:BI (match_operand:SI 1 "gr_register_operand" "") (const_int 0)))
1784 (set (match_operand:SI 0 "gr_register_operand" "")
1785 (if_then_else:SI (eq (match_dup 2) (const_int 0))
1786 (neg:SI (match_dup 1))
1791 operands[2] = gen_reg_rtx (BImode);
1794 (define_expand "sminsi3"
1796 (ge:BI (match_operand:SI 1 "gr_register_operand" "")
1797 (match_operand:SI 2 "gr_register_operand" "")))
1798 (set (match_operand:SI 0 "gr_register_operand" "")
1799 (if_then_else:SI (ne (match_dup 3) (const_int 0))
1800 (match_dup 2) (match_dup 1)))]
1804 operands[3] = gen_reg_rtx (BImode);
1807 (define_expand "smaxsi3"
1809 (ge:BI (match_operand:SI 1 "gr_register_operand" "")
1810 (match_operand:SI 2 "gr_register_operand" "")))
1811 (set (match_operand:SI 0 "gr_register_operand" "")
1812 (if_then_else:SI (ne (match_dup 3) (const_int 0))
1813 (match_dup 1) (match_dup 2)))]
1817 operands[3] = gen_reg_rtx (BImode);
1820 (define_expand "uminsi3"
1822 (geu:BI (match_operand:SI 1 "gr_register_operand" "")
1823 (match_operand:SI 2 "gr_register_operand" "")))
1824 (set (match_operand:SI 0 "gr_register_operand" "")
1825 (if_then_else:SI (ne (match_dup 3) (const_int 0))
1826 (match_dup 2) (match_dup 1)))]
1830 operands[3] = gen_reg_rtx (BImode);
1833 (define_expand "umaxsi3"
1835 (geu:BI (match_operand:SI 1 "gr_register_operand" "")
1836 (match_operand:SI 2 "gr_register_operand" "")))
1837 (set (match_operand:SI 0 "gr_register_operand" "")
1838 (if_then_else:SI (ne (match_dup 3) (const_int 0))
1839 (match_dup 1) (match_dup 2)))]
1843 operands[3] = gen_reg_rtx (BImode);
1846 (define_expand "divsi3"
1847 [(set (match_operand:SI 0 "register_operand" "")
1848 (div:SI (match_operand:SI 1 "general_operand" "")
1849 (match_operand:SI 2 "general_operand" "")))]
1853 rtx op1_tf, op2_tf, op0_tf, op0_di, twon34;
1855 op0_tf = gen_reg_rtx (TFmode);
1856 op0_di = gen_reg_rtx (DImode);
1858 if (CONSTANT_P (operands[1]))
1859 operands[1] = force_reg (SImode, operands[1]);
1860 op1_tf = gen_reg_rtx (TFmode);
1861 expand_float (op1_tf, operands[1], 0);
1863 if (CONSTANT_P (operands[2]))
1864 operands[2] = force_reg (SImode, operands[2]);
1865 op2_tf = gen_reg_rtx (TFmode);
1866 expand_float (op2_tf, operands[2], 0);
1870 twon34 = (CONST_DOUBLE_FROM_REAL_VALUE
1871 (REAL_VALUE_FROM_TARGET_SINGLE (0x2e800000), TFmode));
1872 twon34 = force_reg (TFmode, twon34);
1874 twon34 = gen_reg_rtx (TFmode);
1875 convert_move (twon34, force_const_mem (SFmode, CONST_DOUBLE_FROM_REAL_VALUE (REAL_VALUE_FROM_TARGET_SINGLE (0x2e800000), SFmode)), 0);
1878 emit_insn (gen_divsi3_internal (op0_tf, op1_tf, op2_tf, twon34));
1880 emit_insn (gen_fix_trunctfdi2_alts (op0_di, op0_tf, const1_rtx));
1881 emit_move_insn (operands[0], gen_lowpart (SImode, op0_di));
1885 (define_expand "modsi3"
1886 [(set (match_operand:SI 0 "register_operand" "")
1887 (mod:SI (match_operand:SI 1 "general_operand" "")
1888 (match_operand:SI 2 "general_operand" "")))]
1892 rtx op2_neg, op1_di, div;
1894 div = gen_reg_rtx (SImode);
1895 emit_insn (gen_divsi3 (div, operands[1], operands[2]));
1897 op2_neg = expand_unop (SImode, neg_optab, operands[2], NULL_RTX, 0);
1899 /* This is a trick to get us to reuse the value that we're sure to
1900 have already copied to the FP regs. */
1901 op1_di = gen_reg_rtx (DImode);
1902 convert_move (op1_di, operands[1], 0);
1904 emit_insn (gen_maddsi4 (operands[0], div, op2_neg,
1905 gen_lowpart (SImode, op1_di)));
1909 (define_expand "udivsi3"
1910 [(set (match_operand:SI 0 "register_operand" "")
1911 (udiv:SI (match_operand:SI 1 "general_operand" "")
1912 (match_operand:SI 2 "general_operand" "")))]
1916 rtx op1_tf, op2_tf, op0_tf, op0_di, twon34;
1918 op0_tf = gen_reg_rtx (TFmode);
1919 op0_di = gen_reg_rtx (DImode);
1921 if (CONSTANT_P (operands[1]))
1922 operands[1] = force_reg (SImode, operands[1]);
1923 op1_tf = gen_reg_rtx (TFmode);
1924 expand_float (op1_tf, operands[1], 1);
1926 if (CONSTANT_P (operands[2]))
1927 operands[2] = force_reg (SImode, operands[2]);
1928 op2_tf = gen_reg_rtx (TFmode);
1929 expand_float (op2_tf, operands[2], 1);
1933 twon34 = (CONST_DOUBLE_FROM_REAL_VALUE
1934 (REAL_VALUE_FROM_TARGET_SINGLE (0x2e800000), TFmode));
1935 twon34 = force_reg (TFmode, twon34);
1937 twon34 = gen_reg_rtx (TFmode);
1938 convert_move (twon34, force_const_mem (SFmode, CONST_DOUBLE_FROM_REAL_VALUE (REAL_VALUE_FROM_TARGET_SINGLE (0x2e800000), SFmode)), 0);
1941 emit_insn (gen_divsi3_internal (op0_tf, op1_tf, op2_tf, twon34));
1943 emit_insn (gen_fixuns_trunctfdi2_alts (op0_di, op0_tf, const1_rtx));
1944 emit_move_insn (operands[0], gen_lowpart (SImode, op0_di));
1948 (define_expand "umodsi3"
1949 [(set (match_operand:SI 0 "register_operand" "")
1950 (umod:SI (match_operand:SI 1 "general_operand" "")
1951 (match_operand:SI 2 "general_operand" "")))]
1955 rtx op2_neg, op1_di, div;
1957 div = gen_reg_rtx (SImode);
1958 emit_insn (gen_udivsi3 (div, operands[1], operands[2]));
1960 op2_neg = expand_unop (SImode, neg_optab, operands[2], NULL_RTX, 0);
1962 /* This is a trick to get us to reuse the value that we're sure to
1963 have already copied to the FP regs. */
1964 op1_di = gen_reg_rtx (DImode);
1965 convert_move (op1_di, operands[1], 1);
1967 emit_insn (gen_maddsi4 (operands[0], div, op2_neg,
1968 gen_lowpart (SImode, op1_di)));
1972 (define_insn_and_split "divsi3_internal"
1973 [(set (match_operand:TF 0 "fr_register_operand" "=&f")
1974 (float:TF (div:SI (match_operand:TF 1 "fr_register_operand" "f")
1975 (match_operand:TF 2 "fr_register_operand" "f"))))
1976 (clobber (match_scratch:TF 4 "=&f"))
1977 (clobber (match_scratch:TF 5 "=&f"))
1978 (clobber (match_scratch:BI 6 "=c"))
1979 (use (match_operand:TF 3 "fr_register_operand" "f"))]
1982 "&& reload_completed"
1983 [(parallel [(set (match_dup 0) (div:TF (const_int 1) (match_dup 2)))
1984 (set (match_dup 6) (unspec:BI [(match_dup 1) (match_dup 2)] 5))
1985 (use (const_int 1))])
1986 (cond_exec (ne (match_dup 6) (const_int 0))
1987 (parallel [(set (match_dup 4) (mult:TF (match_dup 1) (match_dup 0)))
1988 (use (const_int 1))]))
1989 (cond_exec (ne (match_dup 6) (const_int 0))
1990 (parallel [(set (match_dup 5)
1991 (plus:TF (neg:TF (mult:TF (match_dup 2) (match_dup 0)))
1993 (use (const_int 1))]))
1994 (cond_exec (ne (match_dup 6) (const_int 0))
1995 (parallel [(set (match_dup 4)
1996 (plus:TF (mult:TF (match_dup 5) (match_dup 4))
1998 (use (const_int 1))]))
1999 (cond_exec (ne (match_dup 6) (const_int 0))
2000 (parallel [(set (match_dup 5)
2001 (plus:TF (mult:TF (match_dup 5) (match_dup 5))
2003 (use (const_int 1))]))
2004 (cond_exec (ne (match_dup 6) (const_int 0))
2005 (parallel [(set (match_dup 0)
2006 (plus:TF (mult:TF (match_dup 5) (match_dup 4))
2008 (use (const_int 1))]))
2010 "operands[7] = CONST1_RTX (TFmode);"
2011 [(set_attr "predicable" "no")])
2013 ;; ::::::::::::::::::::
2015 ;; :: 64 bit Integer arithmetic
2017 ;; ::::::::::::::::::::
2019 (define_insn "adddi3"
2020 [(set (match_operand:DI 0 "gr_register_operand" "=r,r,r")
2021 (plus:DI (match_operand:DI 1 "gr_register_operand" "%r,r,a")
2022 (match_operand:DI 2 "gr_reg_or_22bit_operand" "r,I,J")))]
2028 [(set_attr "itanium_class" "ialu")])
2030 (define_insn "*adddi3_plus1"
2031 [(set (match_operand:DI 0 "gr_register_operand" "=r")
2032 (plus:DI (plus:DI (match_operand:DI 1 "gr_register_operand" "r")
2033 (match_operand:DI 2 "gr_register_operand" "r"))
2036 "add %0 = %1, %2, 1"
2037 [(set_attr "itanium_class" "ialu")])
2039 ;; This has some of the same problems as shladd. We let the shladd
2040 ;; eliminator hack handle it, which results in the 1 being forced into
2041 ;; a register, but not more ugliness here.
2042 (define_insn "*adddi3_plus1_alt"
2043 [(set (match_operand:DI 0 "gr_register_operand" "=r")
2044 (plus:DI (mult:DI (match_operand:DI 1 "gr_register_operand" "r")
2048 "add %0 = %1, %1, 1"
2049 [(set_attr "itanium_class" "ialu")])
2051 (define_insn "subdi3"
2052 [(set (match_operand:DI 0 "gr_register_operand" "=r")
2053 (minus:DI (match_operand:DI 1 "gr_reg_or_8bit_operand" "rK")
2054 (match_operand:DI 2 "gr_register_operand" "r")))]
2057 [(set_attr "itanium_class" "ialu")])
2059 (define_insn "*subdi3_minus1"
2060 [(set (match_operand:DI 0 "gr_register_operand" "=r")
2061 (plus:DI (not:DI (match_operand:DI 1 "gr_register_operand" "r"))
2062 (match_operand:DI 2 "gr_register_operand" "r")))]
2064 "sub %0 = %2, %1, 1"
2065 [(set_attr "itanium_class" "ialu")])
2067 ;; ??? Use grfr instead of fr because of virtual register elimination
2068 ;; and silly test cases multiplying by the frame pointer.
2069 (define_insn "muldi3"
2070 [(set (match_operand:DI 0 "fr_register_operand" "=f")
2071 (mult:DI (match_operand:DI 1 "grfr_register_operand" "f")
2072 (match_operand:DI 2 "grfr_register_operand" "f")))]
2074 "xmpy.l %0 = %1, %2"
2075 [(set_attr "itanium_class" "xmpy")])
2077 ;; ??? If operand 3 is an eliminable reg, then register elimination causes the
2078 ;; same problem that we have with shladd below. Unfortunately, this case is
2079 ;; much harder to fix because the multiply puts the result in an FP register,
2080 ;; but the add needs inputs from a general register. We add a spurious clobber
2081 ;; here so that it will be present just in case register elimination gives us
2082 ;; the funny result.
2084 ;; ??? Maybe validate_changes should try adding match_scratch clobbers?
2086 ;; ??? Maybe we should change how adds are canonicalized.
2088 (define_insn "madddi4"
2089 [(set (match_operand:DI 0 "fr_register_operand" "=f")
2090 (plus:DI (mult:DI (match_operand:DI 1 "grfr_register_operand" "f")
2091 (match_operand:DI 2 "grfr_register_operand" "f"))
2092 (match_operand:DI 3 "grfr_register_operand" "f")))
2093 (clobber (match_scratch:DI 4 "=X"))]
2095 "xma.l %0 = %1, %2, %3"
2096 [(set_attr "itanium_class" "xmpy")])
2098 ;; This can be created by register elimination if operand3 of shladd is an
2099 ;; eliminable register or has reg_equiv_constant set.
2101 ;; We have to use nonmemory_operand for operand 4, to ensure that the
2102 ;; validate_changes call inside eliminate_regs will always succeed. If it
2103 ;; doesn't succeed, then this remain a madddi4 pattern, and will be reloaded
2106 (define_insn "*madddi4_elim"
2107 [(set (match_operand:DI 0 "register_operand" "=&r")
2108 (plus:DI (plus:DI (mult:DI (match_operand:DI 1 "register_operand" "f")
2109 (match_operand:DI 2 "register_operand" "f"))
2110 (match_operand:DI 3 "register_operand" "f"))
2111 (match_operand:DI 4 "nonmemory_operand" "rI")))
2112 (clobber (match_scratch:DI 5 "=f"))]
2113 "reload_in_progress"
2115 [(set_attr "itanium_class" "unknown")])
2118 [(set (match_operand:DI 0 "register_operand" "")
2119 (plus:DI (plus:DI (mult:DI (match_operand:DI 1 "register_operand" "")
2120 (match_operand:DI 2 "register_operand" ""))
2121 (match_operand:DI 3 "register_operand" ""))
2122 (match_operand:DI 4 "gr_reg_or_14bit_operand" "")))
2123 (clobber (match_scratch:DI 5 ""))]
2125 [(parallel [(set (match_dup 5) (plus:DI (mult:DI (match_dup 1) (match_dup 2))
2127 (clobber (match_dup 0))])
2128 (set (match_dup 0) (match_dup 5))
2129 (set (match_dup 0) (plus:DI (match_dup 0) (match_dup 4)))]
2132 ;; ??? There are highpart multiply and add instructions, but we have no way
2133 ;; to generate them.
2135 (define_insn "smuldi3_highpart"
2136 [(set (match_operand:DI 0 "fr_register_operand" "=f")
2139 (mult:TI (sign_extend:TI
2140 (match_operand:DI 1 "fr_register_operand" "f"))
2142 (match_operand:DI 2 "fr_register_operand" "f")))
2145 "xmpy.h %0 = %1, %2"
2146 [(set_attr "itanium_class" "xmpy")])
2148 (define_insn "umuldi3_highpart"
2149 [(set (match_operand:DI 0 "fr_register_operand" "=f")
2152 (mult:TI (zero_extend:TI
2153 (match_operand:DI 1 "fr_register_operand" "f"))
2155 (match_operand:DI 2 "fr_register_operand" "f")))
2158 "xmpy.hu %0 = %1, %2"
2159 [(set_attr "itanium_class" "xmpy")])
2161 (define_insn "negdi2"
2162 [(set (match_operand:DI 0 "gr_register_operand" "=r")
2163 (neg:DI (match_operand:DI 1 "gr_register_operand" "r")))]
2166 [(set_attr "itanium_class" "ialu")])
2168 (define_expand "absdi2"
2170 (ge:BI (match_operand:DI 1 "gr_register_operand" "") (const_int 0)))
2171 (set (match_operand:DI 0 "gr_register_operand" "")
2172 (if_then_else:DI (eq (match_dup 2) (const_int 0))
2173 (neg:DI (match_dup 1))
2178 operands[2] = gen_reg_rtx (BImode);
2181 (define_expand "smindi3"
2183 (ge:BI (match_operand:DI 1 "gr_register_operand" "")
2184 (match_operand:DI 2 "gr_register_operand" "")))
2185 (set (match_operand:DI 0 "gr_register_operand" "")
2186 (if_then_else:DI (ne (match_dup 3) (const_int 0))
2187 (match_dup 2) (match_dup 1)))]
2191 operands[3] = gen_reg_rtx (BImode);
2194 (define_expand "smaxdi3"
2196 (ge:BI (match_operand:DI 1 "gr_register_operand" "")
2197 (match_operand:DI 2 "gr_register_operand" "")))
2198 (set (match_operand:DI 0 "gr_register_operand" "")
2199 (if_then_else:DI (ne (match_dup 3) (const_int 0))
2200 (match_dup 1) (match_dup 2)))]
2204 operands[3] = gen_reg_rtx (BImode);
2207 (define_expand "umindi3"
2209 (geu:BI (match_operand:DI 1 "gr_register_operand" "")
2210 (match_operand:DI 2 "gr_register_operand" "")))
2211 (set (match_operand:DI 0 "gr_register_operand" "")
2212 (if_then_else:DI (ne (match_dup 3) (const_int 0))
2213 (match_dup 2) (match_dup 1)))]
2217 operands[3] = gen_reg_rtx (BImode);
2220 (define_expand "umaxdi3"
2222 (geu:BI (match_operand:DI 1 "gr_register_operand" "")
2223 (match_operand:DI 2 "gr_register_operand" "")))
2224 (set (match_operand:DI 0 "gr_register_operand" "")
2225 (if_then_else:DI (ne (match_dup 3) (const_int 0))
2226 (match_dup 1) (match_dup 2)))]
2230 operands[3] = gen_reg_rtx (BImode);
2233 (define_expand "ffsdi2"
2235 (eq:BI (match_operand:DI 1 "gr_register_operand" "") (const_int 0)))
2236 (set (match_dup 2) (plus:DI (match_dup 1) (const_int -1)))
2237 (set (match_dup 5) (const_int 0))
2238 (set (match_dup 3) (xor:DI (match_dup 1) (match_dup 2)))
2239 (set (match_dup 4) (unspec:DI [(match_dup 3)] 8))
2240 (set (match_operand:DI 0 "gr_register_operand" "")
2241 (if_then_else:DI (ne (match_dup 6) (const_int 0))
2242 (match_dup 5) (match_dup 4)))]
2246 operands[2] = gen_reg_rtx (DImode);
2247 operands[3] = gen_reg_rtx (DImode);
2248 operands[4] = gen_reg_rtx (DImode);
2249 operands[5] = gen_reg_rtx (DImode);
2250 operands[6] = gen_reg_rtx (BImode);
2253 (define_insn "*popcnt"
2254 [(set (match_operand:DI 0 "gr_register_operand" "=r")
2255 (unspec:DI [(match_operand:DI 1 "gr_register_operand" "r")] 8))]
2258 [(set_attr "itanium_class" "mmmul")])
2260 (define_expand "divdi3"
2261 [(set (match_operand:DI 0 "register_operand" "")
2262 (div:DI (match_operand:DI 1 "general_operand" "")
2263 (match_operand:DI 2 "general_operand" "")))]
2267 rtx op1_tf, op2_tf, op0_tf;
2269 op0_tf = gen_reg_rtx (TFmode);
2271 if (CONSTANT_P (operands[1]))
2272 operands[1] = force_reg (DImode, operands[1]);
2273 op1_tf = gen_reg_rtx (TFmode);
2274 expand_float (op1_tf, operands[1], 0);
2276 if (CONSTANT_P (operands[2]))
2277 operands[2] = force_reg (DImode, operands[2]);
2278 op2_tf = gen_reg_rtx (TFmode);
2279 expand_float (op2_tf, operands[2], 0);
2281 if (TARGET_INLINE_DIV_LAT)
2282 emit_insn (gen_divdi3_internal_lat (op0_tf, op1_tf, op2_tf));
2284 emit_insn (gen_divdi3_internal_thr (op0_tf, op1_tf, op2_tf));
2286 emit_insn (gen_fix_trunctfdi2_alts (operands[0], op0_tf, const1_rtx));
2290 (define_expand "moddi3"
2291 [(set (match_operand:DI 0 "register_operand" "")
2292 (mod:SI (match_operand:DI 1 "general_operand" "")
2293 (match_operand:DI 2 "general_operand" "")))]
2299 div = gen_reg_rtx (DImode);
2300 emit_insn (gen_divdi3 (div, operands[1], operands[2]));
2302 op2_neg = expand_unop (DImode, neg_optab, operands[2], NULL_RTX, 0);
2304 emit_insn (gen_madddi4 (operands[0], div, op2_neg, operands[1]));
2308 (define_expand "udivdi3"
2309 [(set (match_operand:DI 0 "register_operand" "")
2310 (udiv:DI (match_operand:DI 1 "general_operand" "")
2311 (match_operand:DI 2 "general_operand" "")))]
2315 rtx op1_tf, op2_tf, op0_tf;
2317 op0_tf = gen_reg_rtx (TFmode);
2319 if (CONSTANT_P (operands[1]))
2320 operands[1] = force_reg (DImode, operands[1]);
2321 op1_tf = gen_reg_rtx (TFmode);
2322 expand_float (op1_tf, operands[1], 1);
2324 if (CONSTANT_P (operands[2]))
2325 operands[2] = force_reg (DImode, operands[2]);
2326 op2_tf = gen_reg_rtx (TFmode);
2327 expand_float (op2_tf, operands[2], 1);
2329 if (TARGET_INLINE_DIV_LAT)
2330 emit_insn (gen_divdi3_internal_lat (op0_tf, op1_tf, op2_tf));
2332 emit_insn (gen_divdi3_internal_thr (op0_tf, op1_tf, op2_tf));
2334 emit_insn (gen_fixuns_trunctfdi2_alts (operands[0], op0_tf, const1_rtx));
2338 (define_expand "umoddi3"
2339 [(set (match_operand:DI 0 "register_operand" "")
2340 (umod:DI (match_operand:DI 1 "general_operand" "")
2341 (match_operand:DI 2 "general_operand" "")))]
2347 div = gen_reg_rtx (DImode);
2348 emit_insn (gen_udivdi3 (div, operands[1], operands[2]));
2350 op2_neg = expand_unop (DImode, neg_optab, operands[2], NULL_RTX, 0);
2352 emit_insn (gen_madddi4 (operands[0], div, op2_neg, operands[1]));
2356 (define_insn_and_split "divdi3_internal_lat"
2357 [(set (match_operand:TF 0 "fr_register_operand" "=&f")
2358 (float:TF (div:SI (match_operand:TF 1 "fr_register_operand" "f")
2359 (match_operand:TF 2 "fr_register_operand" "f"))))
2360 (clobber (match_scratch:TF 3 "=&f"))
2361 (clobber (match_scratch:TF 4 "=&f"))
2362 (clobber (match_scratch:TF 5 "=&f"))
2363 (clobber (match_scratch:BI 6 "=c"))]
2364 "TARGET_INLINE_DIV_LAT"
2366 "&& reload_completed"
2367 [(parallel [(set (match_dup 0) (div:TF (const_int 1) (match_dup 2)))
2368 (set (match_dup 6) (unspec:BI [(match_dup 1) (match_dup 2)] 5))
2369 (use (const_int 1))])
2370 (cond_exec (ne (match_dup 6) (const_int 0))
2371 (parallel [(set (match_dup 3)
2372 (plus:TF (neg:TF (mult:TF (match_dup 2) (match_dup 0)))
2374 (use (const_int 1))]))
2375 (cond_exec (ne (match_dup 6) (const_int 0))
2376 (parallel [(set (match_dup 4) (mult:TF (match_dup 1) (match_dup 0)))
2377 (use (const_int 1))]))
2378 (cond_exec (ne (match_dup 6) (const_int 0))
2379 (parallel [(set (match_dup 5) (mult:TF (match_dup 3) (match_dup 3)))
2380 (use (const_int 1))]))
2381 (cond_exec (ne (match_dup 6) (const_int 0))
2382 (parallel [(set (match_dup 4)
2383 (plus:TF (mult:TF (match_dup 3) (match_dup 4))
2385 (use (const_int 1))]))
2386 (cond_exec (ne (match_dup 6) (const_int 0))
2387 (parallel [(set (match_dup 0)
2388 (plus:TF (mult:TF (match_dup 3) (match_dup 0))
2390 (use (const_int 1))]))
2391 (cond_exec (ne (match_dup 6) (const_int 0))
2392 (parallel [(set (match_dup 3)
2393 (plus:TF (mult:TF (match_dup 5) (match_dup 4))
2395 (use (const_int 1))]))
2396 (cond_exec (ne (match_dup 6) (const_int 0))
2397 (parallel [(set (match_dup 0)
2398 (plus:TF (mult:TF (match_dup 5) (match_dup 0))
2400 (use (const_int 1))]))
2401 (cond_exec (ne (match_dup 6) (const_int 0))
2402 (parallel [(set (match_dup 4)
2403 (plus:TF (neg:TF (mult:TF (match_dup 2) (match_dup 3)))
2405 (use (const_int 1))]))
2406 (cond_exec (ne (match_dup 6) (const_int 0))
2407 (parallel [(set (match_dup 0)
2408 (plus:TF (mult:TF (match_dup 4) (match_dup 0))
2410 (use (const_int 1))]))
2412 "operands[7] = CONST1_RTX (TFmode);"
2413 [(set_attr "predicable" "no")])
2415 (define_insn_and_split "divdi3_internal_thr"
2416 [(set (match_operand:TF 0 "fr_register_operand" "=&f")
2417 (float:TF (div:SI (match_operand:TF 1 "fr_register_operand" "f")
2418 (match_operand:TF 2 "fr_register_operand" "f"))))
2419 (clobber (match_scratch:TF 3 "=&f"))
2420 (clobber (match_scratch:TF 4 "=f"))
2421 (clobber (match_scratch:BI 5 "=c"))]
2422 "TARGET_INLINE_DIV_THR"
2424 "&& reload_completed"
2425 [(parallel [(set (match_dup 0) (div:TF (const_int 1) (match_dup 2)))
2426 (set (match_dup 5) (unspec:BI [(match_dup 1) (match_dup 2)] 5))
2427 (use (const_int 1))])
2428 (cond_exec (ne (match_dup 5) (const_int 0))
2429 (parallel [(set (match_dup 3)
2430 (plus:TF (neg:TF (mult:TF (match_dup 2) (match_dup 0)))
2432 (use (const_int 1))]))
2433 (cond_exec (ne (match_dup 5) (const_int 0))
2434 (parallel [(set (match_dup 0)
2435 (plus:TF (mult:TF (match_dup 3) (match_dup 0))
2437 (use (const_int 1))]))
2438 (cond_exec (ne (match_dup 5) (const_int 0))
2439 (parallel [(set (match_dup 3) (mult:TF (match_dup 3) (match_dup 3)))
2440 (use (const_int 1))]))
2441 (cond_exec (ne (match_dup 5) (const_int 0))
2442 (parallel [(set (match_dup 0)
2443 (plus:TF (mult:TF (match_dup 3) (match_dup 0))
2445 (use (const_int 1))]))
2446 (cond_exec (ne (match_dup 5) (const_int 0))
2447 (parallel [(set (match_dup 3) (mult:TF (match_dup 0) (match_dup 1)))
2448 (use (const_int 1))]))
2449 (cond_exec (ne (match_dup 5) (const_int 0))
2450 (parallel [(set (match_dup 4)
2451 (plus:TF (neg:TF (mult:TF (match_dup 2) (match_dup 3)))
2453 (use (const_int 1))]))
2454 (cond_exec (ne (match_dup 5) (const_int 0))
2455 (parallel [(set (match_dup 0)
2456 (plus:TF (mult:TF (match_dup 4) (match_dup 0))
2458 (use (const_int 1))]))
2460 "operands[6] = CONST1_RTX (TFmode);"
2461 [(set_attr "predicable" "no")])
2463 ;; ::::::::::::::::::::
2465 ;; :: 32 bit floating point arithmetic
2467 ;; ::::::::::::::::::::
2469 (define_insn "addsf3"
2470 [(set (match_operand:SF 0 "fr_register_operand" "=f")
2471 (plus:SF (match_operand:SF 1 "fr_register_operand" "%f")
2472 (match_operand:SF 2 "fr_reg_or_fp01_operand" "fG")))]
2474 "fadd.s %0 = %1, %F2"
2475 [(set_attr "itanium_class" "fmac")])
2477 (define_insn "subsf3"
2478 [(set (match_operand:SF 0 "fr_register_operand" "=f")
2479 (minus:SF (match_operand:SF 1 "fr_reg_or_fp01_operand" "fG")
2480 (match_operand:SF 2 "fr_reg_or_fp01_operand" "fG")))]
2482 "fsub.s %0 = %F1, %F2"
2483 [(set_attr "itanium_class" "fmac")])
2485 (define_insn "mulsf3"
2486 [(set (match_operand:SF 0 "fr_register_operand" "=f")
2487 (mult:SF (match_operand:SF 1 "fr_register_operand" "%f")
2488 (match_operand:SF 2 "fr_register_operand" "f")))]
2490 "fmpy.s %0 = %1, %2"
2491 [(set_attr "itanium_class" "fmac")])
2493 (define_insn "abssf2"
2494 [(set (match_operand:SF 0 "fr_register_operand" "=f")
2495 (abs:SF (match_operand:SF 1 "fr_register_operand" "f")))]
2498 [(set_attr "itanium_class" "fmisc")])
2500 (define_insn "negsf2"
2501 [(set (match_operand:SF 0 "fr_register_operand" "=f")
2502 (neg:SF (match_operand:SF 1 "fr_register_operand" "f")))]
2505 [(set_attr "itanium_class" "fmisc")])
2507 (define_insn "*nabssf2"
2508 [(set (match_operand:SF 0 "fr_register_operand" "=f")
2509 (neg:SF (abs:SF (match_operand:SF 1 "fr_register_operand" "f"))))]
2512 [(set_attr "itanium_class" "fmisc")])
2514 (define_insn "minsf3"
2515 [(set (match_operand:SF 0 "fr_register_operand" "=f")
2516 (smin:SF (match_operand:SF 1 "fr_register_operand" "f")
2517 (match_operand:SF 2 "fr_reg_or_fp01_operand" "fG")))]
2520 [(set_attr "itanium_class" "fmisc")])
2522 (define_insn "maxsf3"
2523 [(set (match_operand:SF 0 "fr_register_operand" "=f")
2524 (smax:SF (match_operand:SF 1 "fr_register_operand" "f")
2525 (match_operand:SF 2 "fr_reg_or_fp01_operand" "fG")))]
2528 [(set_attr "itanium_class" "fmisc")])
2530 (define_insn "*maddsf4"
2531 [(set (match_operand:SF 0 "fr_register_operand" "=f")
2532 (plus:SF (mult:SF (match_operand:SF 1 "fr_register_operand" "f")
2533 (match_operand:SF 2 "fr_register_operand" "f"))
2534 (match_operand:SF 3 "fr_reg_or_fp01_operand" "fG")))]
2536 "fma.s %0 = %1, %2, %F3"
2537 [(set_attr "itanium_class" "fmac")])
2539 (define_insn "*msubsf4"
2540 [(set (match_operand:SF 0 "fr_register_operand" "=f")
2541 (minus:SF (mult:SF (match_operand:SF 1 "fr_register_operand" "f")
2542 (match_operand:SF 2 "fr_register_operand" "f"))
2543 (match_operand:SF 3 "fr_reg_or_fp01_operand" "fG")))]
2545 "fms.s %0 = %1, %2, %F3"
2546 [(set_attr "itanium_class" "fmac")])
2548 (define_insn "*nmulsf3"
2549 [(set (match_operand:SF 0 "fr_register_operand" "=f")
2550 (neg:SF (mult:SF (match_operand:SF 1 "fr_register_operand" "f")
2551 (match_operand:SF 2 "fr_register_operand" "f"))))]
2553 "fnmpy.s %0 = %1, %2"
2554 [(set_attr "itanium_class" "fmac")])
2556 ;; ??? Is it possible to canonicalize this as (minus (reg) (mult))?
2558 (define_insn "*nmaddsf4"
2559 [(set (match_operand:SF 0 "fr_register_operand" "=f")
2560 (plus:SF (neg:SF (mult:SF
2561 (match_operand:SF 1 "fr_register_operand" "f")
2562 (match_operand:SF 2 "fr_register_operand" "f")))
2563 (match_operand:SF 3 "fr_reg_or_fp01_operand" "fG")))]
2565 "fnma.s %0 = %1, %2, %F3"
2566 [(set_attr "itanium_class" "fmac")])
2568 (define_expand "divsf3"
2569 [(set (match_operand:SF 0 "fr_register_operand" "")
2570 (div:SF (match_operand:SF 1 "fr_register_operand" "")
2571 (match_operand:SF 2 "fr_register_operand" "")))]
2576 if (TARGET_INLINE_DIV_LAT)
2577 insn = gen_divsf3_internal_lat (operands[0], operands[1], operands[2]);
2579 insn = gen_divsf3_internal_thr (operands[0], operands[1], operands[2]);
2584 (define_insn_and_split "divsf3_internal_lat"
2585 [(set (match_operand:SF 0 "fr_register_operand" "=&f")
2586 (div:SF (match_operand:SF 1 "fr_register_operand" "f")
2587 (match_operand:SF 2 "fr_register_operand" "f")))
2588 (clobber (match_scratch:TF 3 "=&f"))
2589 (clobber (match_scratch:TF 4 "=f"))
2590 (clobber (match_scratch:BI 5 "=c"))]
2591 "TARGET_INLINE_DIV_LAT"
2593 "&& reload_completed"
2594 [(parallel [(set (match_dup 6) (div:TF (const_int 1) (match_dup 8)))
2595 (set (match_dup 5) (unspec:BI [(match_dup 7) (match_dup 8)] 5))
2596 (use (const_int 1))])
2597 (cond_exec (ne (match_dup 5) (const_int 0))
2598 (parallel [(set (match_dup 3) (mult:TF (match_dup 7) (match_dup 6)))
2599 (use (const_int 1))]))
2600 (cond_exec (ne (match_dup 5) (const_int 0))
2601 (parallel [(set (match_dup 4)
2602 (plus:TF (neg:TF (mult:TF (match_dup 8) (match_dup 6)))
2604 (use (const_int 1))]))
2605 (cond_exec (ne (match_dup 5) (const_int 0))
2606 (parallel [(set (match_dup 3)
2607 (plus:TF (mult:TF (match_dup 4) (match_dup 3))
2609 (use (const_int 1))]))
2610 (cond_exec (ne (match_dup 5) (const_int 0))
2611 (parallel [(set (match_dup 4) (mult:TF (match_dup 4) (match_dup 4)))
2612 (use (const_int 1))]))
2613 (cond_exec (ne (match_dup 5) (const_int 0))
2614 (parallel [(set (match_dup 3)
2615 (plus:TF (mult:TF (match_dup 4) (match_dup 3))
2617 (use (const_int 1))]))
2618 (cond_exec (ne (match_dup 5) (const_int 0))
2619 (parallel [(set (match_dup 4) (mult:TF (match_dup 4) (match_dup 4)))
2620 (use (const_int 1))]))
2621 (cond_exec (ne (match_dup 5) (const_int 0))
2622 (parallel [(set (match_dup 9)
2624 (plus:TF (mult:TF (match_dup 4) (match_dup 3))
2626 (use (const_int 1))]))
2627 (cond_exec (ne (match_dup 5) (const_int 0))
2629 (float_truncate:SF (match_dup 6))))
2631 "operands[6] = gen_rtx_REG (TFmode, REGNO (operands[0]));
2632 operands[7] = gen_rtx_REG (TFmode, REGNO (operands[1]));
2633 operands[8] = gen_rtx_REG (TFmode, REGNO (operands[2]));
2634 operands[9] = gen_rtx_REG (DFmode, REGNO (operands[0]));
2635 operands[10] = CONST1_RTX (TFmode);"
2636 [(set_attr "predicable" "no")])
2638 (define_insn_and_split "divsf3_internal_thr"
2639 [(set (match_operand:SF 0 "fr_register_operand" "=&f")
2640 (div:SF (match_operand:SF 1 "fr_register_operand" "f")
2641 (match_operand:SF 2 "fr_register_operand" "f")))
2642 (clobber (match_scratch:TF 3 "=&f"))
2643 (clobber (match_scratch:TF 4 "=f"))
2644 (clobber (match_scratch:BI 5 "=c"))]
2645 "TARGET_INLINE_DIV_THR"
2647 "&& reload_completed"
2648 [(parallel [(set (match_dup 6) (div:TF (const_int 1) (match_dup 8)))
2649 (set (match_dup 5) (unspec:BI [(match_dup 7) (match_dup 8)] 5))
2650 (use (const_int 1))])
2651 (cond_exec (ne (match_dup 5) (const_int 0))
2652 (parallel [(set (match_dup 3)
2653 (plus:TF (neg:TF (mult:TF (match_dup 8) (match_dup 6)))
2655 (use (const_int 1))]))
2656 (cond_exec (ne (match_dup 5) (const_int 0))
2657 (parallel [(set (match_dup 3)
2658 (plus:TF (mult:TF (match_dup 3) (match_dup 3))
2660 (use (const_int 1))]))
2661 (cond_exec (ne (match_dup 5) (const_int 0))
2662 (parallel [(set (match_dup 6)
2663 (plus:TF (mult:TF (match_dup 3) (match_dup 6))
2665 (use (const_int 1))]))
2666 (cond_exec (ne (match_dup 5) (const_int 0))
2667 (parallel [(set (match_dup 9)
2669 (mult:TF (match_dup 7) (match_dup 6))))
2670 (use (const_int 1))]))
2671 (cond_exec (ne (match_dup 5) (const_int 0))
2672 (parallel [(set (match_dup 4)
2673 (plus:TF (neg:TF (mult:TF (match_dup 8) (match_dup 3)))
2675 (use (const_int 1))]))
2676 (cond_exec (ne (match_dup 5) (const_int 0))
2679 (plus:TF (mult:TF (match_dup 4) (match_dup 6))
2682 "operands[6] = gen_rtx_REG (TFmode, REGNO (operands[0]));
2683 operands[7] = gen_rtx_REG (TFmode, REGNO (operands[1]));
2684 operands[8] = gen_rtx_REG (TFmode, REGNO (operands[2]));
2685 operands[9] = gen_rtx_REG (SFmode, REGNO (operands[3]));
2686 operands[10] = CONST1_RTX (TFmode);"
2687 [(set_attr "predicable" "no")])
2689 ;; ::::::::::::::::::::
2691 ;; :: 64 bit floating point arithmetic
2693 ;; ::::::::::::::::::::
2695 (define_insn "adddf3"
2696 [(set (match_operand:DF 0 "fr_register_operand" "=f")
2697 (plus:DF (match_operand:DF 1 "fr_register_operand" "%f")
2698 (match_operand:DF 2 "fr_reg_or_fp01_operand" "fG")))]
2700 "fadd.d %0 = %1, %F2"
2701 [(set_attr "itanium_class" "fmac")])
2703 (define_insn "*adddf3_trunc"
2704 [(set (match_operand:SF 0 "fr_register_operand" "=f")
2706 (plus:DF (match_operand:DF 1 "fr_register_operand" "%f")
2707 (match_operand:DF 2 "fr_reg_or_fp01_operand" "fG"))))]
2709 "fadd.s %0 = %1, %F2"
2710 [(set_attr "itanium_class" "fmac")])
2712 (define_insn "subdf3"
2713 [(set (match_operand:DF 0 "fr_register_operand" "=f")
2714 (minus:DF (match_operand:DF 1 "fr_reg_or_fp01_operand" "fG")
2715 (match_operand:DF 2 "fr_reg_or_fp01_operand" "fG")))]
2717 "fsub.d %0 = %F1, %F2"
2718 [(set_attr "itanium_class" "fmac")])
2720 (define_insn "*subdf3_trunc"
2721 [(set (match_operand:SF 0 "fr_register_operand" "=f")
2723 (minus:DF (match_operand:DF 1 "fr_reg_or_fp01_operand" "fG")
2724 (match_operand:DF 2 "fr_reg_or_fp01_operand" "fG"))))]
2726 "fsub.s %0 = %F1, %F2"
2727 [(set_attr "itanium_class" "fmac")])
2729 (define_insn "muldf3"
2730 [(set (match_operand:DF 0 "fr_register_operand" "=f")
2731 (mult:DF (match_operand:DF 1 "fr_register_operand" "f")
2732 (match_operand:DF 2 "fr_register_operand" "f")))]
2734 "fmpy.d %0 = %1, %2"
2735 [(set_attr "itanium_class" "fmac")])
2737 (define_insn "*muldf3_trunc"
2738 [(set (match_operand:SF 0 "fr_register_operand" "=f")
2740 (mult:DF (match_operand:DF 1 "fr_register_operand" "f")
2741 (match_operand:DF 2 "fr_register_operand" "f"))))]
2743 "fmpy.s %0 = %1, %2"
2744 [(set_attr "itanium_class" "fmac")])
2746 (define_insn "absdf2"
2747 [(set (match_operand:DF 0 "fr_register_operand" "=f")
2748 (abs:DF (match_operand:DF 1 "fr_register_operand" "f")))]
2751 [(set_attr "itanium_class" "fmisc")])
2753 (define_insn "negdf2"
2754 [(set (match_operand:DF 0 "fr_register_operand" "=f")
2755 (neg:DF (match_operand:DF 1 "fr_register_operand" "f")))]
2758 [(set_attr "itanium_class" "fmisc")])
2760 (define_insn "*nabsdf2"
2761 [(set (match_operand:DF 0 "fr_register_operand" "=f")
2762 (neg:DF (abs:DF (match_operand:DF 1 "fr_register_operand" "f"))))]
2765 [(set_attr "itanium_class" "fmisc")])
2767 (define_insn "mindf3"
2768 [(set (match_operand:DF 0 "fr_register_operand" "=f")
2769 (smin:DF (match_operand:DF 1 "fr_register_operand" "f")
2770 (match_operand:DF 2 "fr_reg_or_fp01_operand" "fG")))]
2773 [(set_attr "itanium_class" "fmisc")])
2775 (define_insn "maxdf3"
2776 [(set (match_operand:DF 0 "fr_register_operand" "=f")
2777 (smax:DF (match_operand:DF 1 "fr_register_operand" "f")
2778 (match_operand:DF 2 "fr_reg_or_fp01_operand" "fG")))]
2781 [(set_attr "itanium_class" "fmisc")])
2783 (define_insn "*madddf4"
2784 [(set (match_operand:DF 0 "fr_register_operand" "=f")
2785 (plus:DF (mult:DF (match_operand:DF 1 "fr_register_operand" "f")
2786 (match_operand:DF 2 "fr_register_operand" "f"))
2787 (match_operand:DF 3 "fr_reg_or_fp01_operand" "fG")))]
2789 "fma.d %0 = %1, %2, %F3"
2790 [(set_attr "itanium_class" "fmac")])
2792 (define_insn "*madddf4_trunc"
2793 [(set (match_operand:SF 0 "fr_register_operand" "=f")
2795 (plus:DF (mult:DF (match_operand:DF 1 "fr_register_operand" "f")
2796 (match_operand:DF 2 "fr_register_operand" "f"))
2797 (match_operand:DF 3 "fr_reg_or_fp01_operand" "fG"))))]
2799 "fma.s %0 = %1, %2, %F3"
2800 [(set_attr "itanium_class" "fmac")])
2802 (define_insn "*msubdf4"
2803 [(set (match_operand:DF 0 "fr_register_operand" "=f")
2804 (minus:DF (mult:DF (match_operand:DF 1 "fr_register_operand" "f")
2805 (match_operand:DF 2 "fr_register_operand" "f"))
2806 (match_operand:DF 3 "fr_reg_or_fp01_operand" "fG")))]
2808 "fms.d %0 = %1, %2, %F3"
2809 [(set_attr "itanium_class" "fmac")])
2811 (define_insn "*msubdf4_trunc"
2812 [(set (match_operand:SF 0 "fr_register_operand" "=f")
2814 (minus:DF (mult:DF (match_operand:DF 1 "fr_register_operand" "f")
2815 (match_operand:DF 2 "fr_register_operand" "f"))
2816 (match_operand:DF 3 "fr_reg_or_fp01_operand" "fG"))))]
2818 "fms.s %0 = %1, %2, %F3"
2819 [(set_attr "itanium_class" "fmac")])
2821 (define_insn "*nmuldf3"
2822 [(set (match_operand:DF 0 "fr_register_operand" "=f")
2823 (neg:DF (mult:DF (match_operand:DF 1 "fr_register_operand" "f")
2824 (match_operand:DF 2 "fr_register_operand" "f"))))]
2826 "fnmpy.d %0 = %1, %2"
2827 [(set_attr "itanium_class" "fmac")])
2829 (define_insn "*nmuldf3_trunc"
2830 [(set (match_operand:SF 0 "fr_register_operand" "=f")
2832 (neg:DF (mult:DF (match_operand:DF 1 "fr_register_operand" "f")
2833 (match_operand:DF 2 "fr_register_operand" "f")))))]
2835 "fnmpy.s %0 = %1, %2"
2836 [(set_attr "itanium_class" "fmac")])
2838 ;; ??? Is it possible to canonicalize this as (minus (reg) (mult))?
2840 (define_insn "*nmadddf4"
2841 [(set (match_operand:DF 0 "fr_register_operand" "=f")
2842 (plus:DF (neg:DF (mult:DF
2843 (match_operand:DF 1 "fr_register_operand" "f")
2844 (match_operand:DF 2 "fr_register_operand" "f")))
2845 (match_operand:DF 3 "fr_reg_or_fp01_operand" "fG")))]
2847 "fnma.d %0 = %1, %2, %F3"
2848 [(set_attr "itanium_class" "fmac")])
2850 (define_insn "*nmadddf4_alts"
2851 [(set (match_operand:DF 0 "fr_register_operand" "=f")
2852 (plus:DF (neg:DF (mult:DF
2853 (match_operand:DF 1 "fr_register_operand" "f")
2854 (match_operand:DF 2 "fr_register_operand" "f")))
2855 (match_operand:DF 3 "fr_reg_or_fp01_operand" "fG")))
2856 (use (match_operand:SI 4 "const_int_operand" ""))]
2858 "fnma.d.s%4 %0 = %1, %2, %F3"
2859 [(set_attr "itanium_class" "fmac")])
2861 (define_insn "*nmadddf4_trunc"
2862 [(set (match_operand:SF 0 "fr_register_operand" "=f")
2864 (plus:DF (neg:DF (mult:DF
2865 (match_operand:DF 1 "fr_register_operand" "f")
2866 (match_operand:DF 2 "fr_register_operand" "f")))
2867 (match_operand:DF 3 "fr_reg_or_fp01_operand" "fG"))))]
2869 "fnma.s %0 = %1, %2, %F3"
2870 [(set_attr "itanium_class" "fmac")])
2872 (define_expand "divdf3"
2873 [(set (match_operand:DF 0 "fr_register_operand" "")
2874 (div:DF (match_operand:DF 1 "fr_register_operand" "")
2875 (match_operand:DF 2 "fr_register_operand" "")))]
2880 if (TARGET_INLINE_DIV_LAT)
2881 insn = gen_divdf3_internal_lat (operands[0], operands[1], operands[2]);
2883 insn = gen_divdf3_internal_thr (operands[0], operands[1], operands[2]);
2888 (define_insn_and_split "divdf3_internal_lat"
2889 [(set (match_operand:DF 0 "fr_register_operand" "=&f")
2890 (div:DF (match_operand:DF 1 "fr_register_operand" "f")
2891 (match_operand:DF 2 "fr_register_operand" "f")))
2892 (clobber (match_scratch:TF 3 "=&f"))
2893 (clobber (match_scratch:TF 4 "=&f"))
2894 (clobber (match_scratch:TF 5 "=&f"))
2895 (clobber (match_scratch:BI 6 "=c"))]
2896 "TARGET_INLINE_DIV_LAT"
2898 "&& reload_completed"
2899 [(parallel [(set (match_dup 7) (div:TF (const_int 1) (match_dup 9)))
2900 (set (match_dup 6) (unspec:BI [(match_dup 8) (match_dup 9)] 5))
2901 (use (const_int 1))])
2902 (cond_exec (ne (match_dup 6) (const_int 0))
2903 (parallel [(set (match_dup 3) (mult:TF (match_dup 8) (match_dup 7)))
2904 (use (const_int 1))]))
2905 (cond_exec (ne (match_dup 6) (const_int 0))
2906 (parallel [(set (match_dup 4)
2907 (plus:TF (neg:TF (mult:TF (match_dup 9) (match_dup 7)))
2909 (use (const_int 1))]))
2910 (cond_exec (ne (match_dup 6) (const_int 0))
2911 (parallel [(set (match_dup 3)
2912 (plus:TF (mult:TF (match_dup 4) (match_dup 3))
2914 (use (const_int 1))]))
2915 (cond_exec (ne (match_dup 6) (const_int 0))
2916 (parallel [(set (match_dup 5) (mult:TF (match_dup 4) (match_dup 4)))
2917 (use (const_int 1))]))
2918 (cond_exec (ne (match_dup 6) (const_int 0))
2919 (parallel [(set (match_dup 7)
2920 (plus:TF (mult:TF (match_dup 4) (match_dup 7))
2922 (use (const_int 1))]))
2923 (cond_exec (ne (match_dup 6) (const_int 0))
2924 (parallel [(set (match_dup 3)
2925 (plus:TF (mult:TF (match_dup 5) (match_dup 3))
2927 (use (const_int 1))]))
2928 (cond_exec (ne (match_dup 6) (const_int 0))
2929 (parallel [(set (match_dup 4) (mult:TF (match_dup 5) (match_dup 5)))
2930 (use (const_int 1))]))
2931 (cond_exec (ne (match_dup 6) (const_int 0))
2932 (parallel [(set (match_dup 7)
2933 (plus:TF (mult:TF (match_dup 5) (match_dup 7))
2935 (use (const_int 1))]))
2936 (cond_exec (ne (match_dup 6) (const_int 0))
2937 (parallel [(set (match_dup 10)
2939 (plus:TF (mult:TF (match_dup 4) (match_dup 3))
2941 (use (const_int 1))]))
2942 (cond_exec (ne (match_dup 6) (const_int 0))
2943 (parallel [(set (match_dup 7)
2944 (plus:TF (mult:TF (match_dup 4) (match_dup 7))
2946 (use (const_int 1))]))
2947 (cond_exec (ne (match_dup 6) (const_int 0))
2948 (parallel [(set (match_dup 11)
2950 (plus:TF (neg:TF (mult:TF (match_dup 9) (match_dup 3)))
2952 (use (const_int 1))]))
2953 (cond_exec (ne (match_dup 6) (const_int 0))
2955 (float_truncate:DF (plus:TF (mult:TF (match_dup 5) (match_dup 7))
2958 "operands[7] = gen_rtx_REG (TFmode, REGNO (operands[0]));
2959 operands[8] = gen_rtx_REG (TFmode, REGNO (operands[1]));
2960 operands[9] = gen_rtx_REG (TFmode, REGNO (operands[2]));
2961 operands[10] = gen_rtx_REG (DFmode, REGNO (operands[3]));
2962 operands[11] = gen_rtx_REG (DFmode, REGNO (operands[5]));
2963 operands[12] = CONST1_RTX (TFmode);"
2964 [(set_attr "predicable" "no")])
2966 (define_insn_and_split "divdf3_internal_thr"
2967 [(set (match_operand:DF 0 "fr_register_operand" "=&f")
2968 (div:DF (match_operand:DF 1 "fr_register_operand" "f")
2969 (match_operand:DF 2 "fr_register_operand" "f")))
2970 (clobber (match_scratch:TF 3 "=&f"))
2971 (clobber (match_scratch:DF 4 "=f"))
2972 (clobber (match_scratch:BI 5 "=c"))]
2973 "TARGET_INLINE_DIV_THR"
2975 "&& reload_completed"
2976 [(parallel [(set (match_dup 6) (div:TF (const_int 1) (match_dup 8)))
2977 (set (match_dup 5) (unspec:BI [(match_dup 7) (match_dup 8)] 5))
2978 (use (const_int 1))])
2979 (cond_exec (ne (match_dup 5) (const_int 0))
2980 (parallel [(set (match_dup 3)
2981 (plus:TF (neg:TF (mult:TF (match_dup 8) (match_dup 6)))
2983 (use (const_int 1))]))
2984 (cond_exec (ne (match_dup 5) (const_int 0))
2985 (parallel [(set (match_dup 6)
2986 (plus:TF (mult:TF (match_dup 3) (match_dup 6))
2988 (use (const_int 1))]))
2989 (cond_exec (ne (match_dup 5) (const_int 0))
2990 (parallel [(set (match_dup 3)
2991 (mult:TF (match_dup 3) (match_dup 3)))
2992 (use (const_int 1))]))
2993 (cond_exec (ne (match_dup 5) (const_int 0))
2994 (parallel [(set (match_dup 6)
2995 (plus:TF (mult:TF (match_dup 3) (match_dup 6))
2997 (use (const_int 1))]))
2998 (cond_exec (ne (match_dup 5) (const_int 0))
2999 (parallel [(set (match_dup 3)
3000 (mult:TF (match_dup 3) (match_dup 3)))
3001 (use (const_int 1))]))
3002 (cond_exec (ne (match_dup 5) (const_int 0))
3003 (parallel [(set (match_dup 6)
3004 (plus:TF (mult:TF (match_dup 3) (match_dup 6))
3006 (use (const_int 1))]))
3007 (cond_exec (ne (match_dup 5) (const_int 0))
3008 (parallel [(set (match_dup 9)
3010 (mult:TF (match_dup 7) (match_dup 3))))
3011 (use (const_int 1))]))
3012 (cond_exec (ne (match_dup 5) (const_int 0))
3013 (parallel [(set (match_dup 4)
3014 (plus:DF (neg:DF (mult:DF (match_dup 2) (match_dup 9)))
3016 (use (const_int 1))]))
3017 (cond_exec (ne (match_dup 5) (const_int 0))
3019 (plus:DF (mult:DF (match_dup 4) (match_dup 0))
3022 "operands[6] = gen_rtx_REG (TFmode, REGNO (operands[0]));
3023 operands[7] = gen_rtx_REG (TFmode, REGNO (operands[1]));
3024 operands[8] = gen_rtx_REG (TFmode, REGNO (operands[2]));
3025 operands[9] = gen_rtx_REG (DFmode, REGNO (operands[3]));
3026 operands[10] = CONST1_RTX (TFmode);"
3027 [(set_attr "predicable" "no")])
3029 ;; ::::::::::::::::::::
3031 ;; :: 80 bit floating point arithmetic
3033 ;; ::::::::::::::::::::
3035 (define_insn "addtf3"
3036 [(set (match_operand:TF 0 "fr_register_operand" "=f")
3037 (plus:TF (match_operand:TF 1 "tfreg_or_fp01_operand" "fG")
3038 (match_operand:TF 2 "tfreg_or_fp01_operand" "fG")))]
3040 "fadd %0 = %F1, %F2"
3041 [(set_attr "itanium_class" "fmac")])
3043 (define_insn "*addtf3_truncsf"
3044 [(set (match_operand:SF 0 "fr_register_operand" "=f")
3046 (plus:TF (match_operand:TF 1 "tfreg_or_fp01_operand" "fG")
3047 (match_operand:TF 2 "tfreg_or_fp01_operand" "fG"))))]
3049 "fadd.s %0 = %F1, %F2"
3050 [(set_attr "itanium_class" "fmac")])
3052 (define_insn "*addtf3_truncdf"
3053 [(set (match_operand:DF 0 "fr_register_operand" "=f")
3055 (plus:TF (match_operand:TF 1 "tfreg_or_fp01_operand" "fG")
3056 (match_operand:TF 2 "tfreg_or_fp01_operand" "fG"))))]
3058 "fadd.d %0 = %F1, %F2"
3059 [(set_attr "itanium_class" "fmac")])
3061 (define_insn "subtf3"
3062 [(set (match_operand:TF 0 "fr_register_operand" "=f")
3063 (minus:TF (match_operand:TF 1 "tfreg_or_fp01_operand" "fG")
3064 (match_operand:TF 2 "tfreg_or_fp01_operand" "fG")))]
3066 "fsub %0 = %F1, %F2"
3067 [(set_attr "itanium_class" "fmac")])
3069 (define_insn "*subtf3_truncsf"
3070 [(set (match_operand:SF 0 "fr_register_operand" "=f")
3072 (minus:TF (match_operand:TF 1 "tfreg_or_fp01_operand" "fG")
3073 (match_operand:TF 2 "tfreg_or_fp01_operand" "fG"))))]
3075 "fsub.s %0 = %F1, %F2"
3076 [(set_attr "itanium_class" "fmac")])
3078 (define_insn "*subtf3_truncdf"
3079 [(set (match_operand:DF 0 "fr_register_operand" "=f")
3081 (minus:TF (match_operand:TF 1 "tfreg_or_fp01_operand" "fG")
3082 (match_operand:TF 2 "tfreg_or_fp01_operand" "fG"))))]
3084 "fsub.d %0 = %F1, %F2"
3085 [(set_attr "itanium_class" "fmac")])
3087 (define_insn "multf3"
3088 [(set (match_operand:TF 0 "fr_register_operand" "=f")
3089 (mult:TF (match_operand:TF 1 "tfreg_or_fp01_operand" "fG")
3090 (match_operand:TF 2 "tfreg_or_fp01_operand" "fG")))]
3092 "fmpy %0 = %F1, %F2"
3093 [(set_attr "itanium_class" "fmac")])
3095 (define_insn "*multf3_truncsf"
3096 [(set (match_operand:SF 0 "fr_register_operand" "=f")
3098 (mult:TF (match_operand:TF 1 "tfreg_or_fp01_operand" "fG")
3099 (match_operand:TF 2 "tfreg_or_fp01_operand" "fG"))))]
3101 "fmpy.s %0 = %F1, %F2"
3102 [(set_attr "itanium_class" "fmac")])
3104 (define_insn "*multf3_truncdf"
3105 [(set (match_operand:DF 0 "fr_register_operand" "=f")
3107 (mult:TF (match_operand:TF 1 "tfreg_or_fp01_operand" "fG")
3108 (match_operand:TF 2 "tfreg_or_fp01_operand" "fG"))))]
3110 "fmpy.d %0 = %F1, %F2"
3111 [(set_attr "itanium_class" "fmac")])
3113 (define_insn "*multf3_alts"
3114 [(set (match_operand:TF 0 "fr_register_operand" "=f")
3115 (mult:TF (match_operand:TF 1 "tfreg_or_fp01_operand" "fG")
3116 (match_operand:TF 2 "tfreg_or_fp01_operand" "fG")))
3117 (use (match_operand:SI 3 "const_int_operand" ""))]
3119 "fmpy.s%3 %0 = %F1, %F2"
3120 [(set_attr "itanium_class" "fmac")])
3122 (define_insn "*multf3_truncsf_alts"
3123 [(set (match_operand:SF 0 "fr_register_operand" "=f")
3125 (mult:TF (match_operand:TF 1 "tfreg_or_fp01_operand" "fG")
3126 (match_operand:TF 2 "tfreg_or_fp01_operand" "fG"))))
3127 (use (match_operand:SI 3 "const_int_operand" ""))]
3129 "fmpy.s.s%3 %0 = %F1, %F2"
3130 [(set_attr "itanium_class" "fmac")])
3132 (define_insn "*multf3_truncdf_alts"
3133 [(set (match_operand:DF 0 "fr_register_operand" "=f")
3135 (mult:TF (match_operand:TF 1 "tfreg_or_fp01_operand" "fG")
3136 (match_operand:TF 2 "tfreg_or_fp01_operand" "fG"))))
3137 (use (match_operand:SI 3 "const_int_operand" ""))]
3139 "fmpy.d.s%3 %0 = %F1, %F2"
3140 [(set_attr "itanium_class" "fmac")])
3142 (define_insn "abstf2"
3143 [(set (match_operand:TF 0 "fr_register_operand" "=f")
3144 (abs:TF (match_operand:TF 1 "tfreg_or_fp01_operand" "fG")))]
3147 [(set_attr "itanium_class" "fmisc")])
3149 (define_insn "negtf2"
3150 [(set (match_operand:TF 0 "fr_register_operand" "=f")
3151 (neg:TF (match_operand:TF 1 "tfreg_or_fp01_operand" "fG")))]
3154 [(set_attr "itanium_class" "fmisc")])
3156 (define_insn "*nabstf2"
3157 [(set (match_operand:TF 0 "fr_register_operand" "=f")
3158 (neg:TF (abs:TF (match_operand:TF 1 "tfreg_or_fp01_operand" "fG"))))]
3161 [(set_attr "itanium_class" "fmisc")])
3163 (define_insn "mintf3"
3164 [(set (match_operand:TF 0 "fr_register_operand" "=f")
3165 (smin:TF (match_operand:TF 1 "tfreg_or_fp01_operand" "fG")
3166 (match_operand:TF 2 "tfreg_or_fp01_operand" "fG")))]
3168 "fmin %0 = %F1, %F2"
3169 [(set_attr "itanium_class" "fmisc")])
3171 (define_insn "maxtf3"
3172 [(set (match_operand:TF 0 "fr_register_operand" "=f")
3173 (smax:TF (match_operand:TF 1 "tfreg_or_fp01_operand" "fG")
3174 (match_operand:TF 2 "tfreg_or_fp01_operand" "fG")))]
3176 "fmax %0 = %F1, %F2"
3177 [(set_attr "itanium_class" "fmisc")])
3179 (define_insn "*maddtf4"
3180 [(set (match_operand:TF 0 "fr_register_operand" "=f")
3181 (plus:TF (mult:TF (match_operand:TF 1 "tfreg_or_fp01_operand" "fG")
3182 (match_operand:TF 2 "tfreg_or_fp01_operand" "fG"))
3183 (match_operand:TF 3 "tfreg_or_fp01_operand" "fG")))]
3185 "fma %0 = %F1, %F2, %F3"
3186 [(set_attr "itanium_class" "fmac")])
3188 (define_insn "*maddtf4_truncsf"
3189 [(set (match_operand:SF 0 "fr_register_operand" "=f")
3191 (plus:TF (mult:TF (match_operand:TF 1 "tfreg_or_fp01_operand" "fG")
3192 (match_operand:TF 2 "tfreg_or_fp01_operand" "fG"))
3193 (match_operand:TF 3 "tfreg_or_fp01_operand" "fG"))))]
3195 "fma.s %0 = %F1, %F2, %F3"
3196 [(set_attr "itanium_class" "fmac")])
3198 (define_insn "*maddtf4_truncdf"
3199 [(set (match_operand:DF 0 "fr_register_operand" "=f")
3201 (plus:TF (mult:TF (match_operand:TF 1 "tfreg_or_fp01_operand" "fG")
3202 (match_operand:TF 2 "tfreg_or_fp01_operand" "fG"))
3203 (match_operand:TF 3 "tfreg_or_fp01_operand" "fG"))))]
3205 "fma.d %0 = %F1, %F2, %F3"
3206 [(set_attr "itanium_class" "fmac")])
3208 (define_insn "*maddtf4_alts"
3209 [(set (match_operand:TF 0 "fr_register_operand" "=f")
3210 (plus:TF (mult:TF (match_operand:TF 1 "tfreg_or_fp01_operand" "fG")
3211 (match_operand:TF 2 "tfreg_or_fp01_operand" "fG"))
3212 (match_operand:TF 3 "tfreg_or_fp01_operand" "fG")))
3213 (use (match_operand:SI 4 "const_int_operand" ""))]
3215 "fma.s%4 %0 = %F1, %F2, %F3"
3216 [(set_attr "itanium_class" "fmac")])
3218 (define_insn "*maddtf4_alts_truncdf"
3219 [(set (match_operand:DF 0 "fr_register_operand" "=f")
3221 (plus:TF (mult:TF (match_operand:TF 1 "tfreg_or_fp01_operand" "fG")
3222 (match_operand:TF 2 "tfreg_or_fp01_operand" "fG"))
3223 (match_operand:TF 3 "tfreg_or_fp01_operand" "fG"))))
3224 (use (match_operand:SI 4 "const_int_operand" ""))]
3226 "fma.d.s%4 %0 = %F1, %F2, %F3"
3227 [(set_attr "itanium_class" "fmac")])
3229 (define_insn "*msubtf4"
3230 [(set (match_operand:TF 0 "fr_register_operand" "=f")
3231 (minus:TF (mult:TF (match_operand:TF 1 "tfreg_or_fp01_operand" "fG")
3232 (match_operand:TF 2 "tfreg_or_fp01_operand" "fG"))
3233 (match_operand:TF 3 "tfreg_or_fp01_operand" "fG")))]
3235 "fms %0 = %F1, %F2, %F3"
3236 [(set_attr "itanium_class" "fmac")])
3238 (define_insn "*msubtf4_truncsf"
3239 [(set (match_operand:SF 0 "fr_register_operand" "=f")
3241 (minus:TF (mult:TF (match_operand:TF 1 "tfreg_or_fp01_operand" "fG")
3242 (match_operand:TF 2 "tfreg_or_fp01_operand" "fG"))
3243 (match_operand:TF 3 "tfreg_or_fp01_operand" "fG"))))]
3245 "fms.s %0 = %F1, %F2, %F3"
3246 [(set_attr "itanium_class" "fmac")])
3248 (define_insn "*msubtf4_truncdf"
3249 [(set (match_operand:DF 0 "fr_register_operand" "=f")
3251 (minus:TF (mult:TF (match_operand:TF 1 "tfreg_or_fp01_operand" "fG")
3252 (match_operand:TF 2 "tfreg_or_fp01_operand" "fG"))
3253 (match_operand:TF 3 "tfreg_or_fp01_operand" "fG"))))]
3255 "fms.d %0 = %F1, %F2, %F3"
3256 [(set_attr "itanium_class" "fmac")])
3258 (define_insn "*nmultf3"
3259 [(set (match_operand:TF 0 "fr_register_operand" "=f")
3260 (neg:TF (mult:TF (match_operand:TF 1 "tfreg_or_fp01_operand" "fG")
3261 (match_operand:TF 2 "tfreg_or_fp01_operand" "fG"))))]
3263 "fnmpy %0 = %F1, %F2"
3264 [(set_attr "itanium_class" "fmac")])
3266 (define_insn "*nmultf3_truncsf"
3267 [(set (match_operand:SF 0 "fr_register_operand" "=f")
3270 (match_operand:TF 1 "tfreg_or_fp01_operand" "fG")
3271 (match_operand:TF 2 "tfreg_or_fp01_operand" "fG")))))]
3273 "fnmpy.s %0 = %F1, %F2"
3274 [(set_attr "itanium_class" "fmac")])
3276 (define_insn "*nmultf3_truncdf"
3277 [(set (match_operand:DF 0 "fr_register_operand" "=f")
3280 (match_operand:TF 1 "tfreg_or_fp01_operand" "fG")
3281 (match_operand:TF 2 "tfreg_or_fp01_operand" "fG")))))]
3283 "fnmpy.d %0 = %F1, %F2"
3284 [(set_attr "itanium_class" "fmac")])
3286 ;; ??? Is it possible to canonicalize this as (minus (reg) (mult))?
3288 (define_insn "*nmaddtf4"
3289 [(set (match_operand:TF 0 "fr_register_operand" "=f")
3290 (plus:TF (neg:TF (mult:TF
3291 (match_operand:TF 1 "tfreg_or_fp01_operand" "fG")
3292 (match_operand:TF 2 "tfreg_or_fp01_operand" "fG")))
3293 (match_operand:TF 3 "tfreg_or_fp01_operand" "fG")))]
3295 "fnma %0 = %F1, %F2, %F3"
3296 [(set_attr "itanium_class" "fmac")])
3298 (define_insn "*nmaddtf4_truncsf"
3299 [(set (match_operand:SF 0 "fr_register_operand" "=f")
3301 (plus:TF (neg:TF (mult:TF
3302 (match_operand:TF 1 "tfreg_or_fp01_operand" "fG")
3303 (match_operand:TF 2 "tfreg_or_fp01_operand" "fG")))
3304 (match_operand:TF 3 "tfreg_or_fp01_operand" "fG"))))]
3306 "fnma.s %0 = %F1, %F2, %F3"
3307 [(set_attr "itanium_class" "fmac")])
3309 (define_insn "*nmaddtf4_truncdf"
3310 [(set (match_operand:DF 0 "fr_register_operand" "=f")
3312 (plus:TF (neg:TF (mult:TF
3313 (match_operand:TF 1 "tfreg_or_fp01_operand" "fG")
3314 (match_operand:TF 2 "tfreg_or_fp01_operand" "fG")))
3315 (match_operand:TF 3 "tfreg_or_fp01_operand" "fG"))))]
3317 "fnma.d %0 = %F1, %F2, %F3"
3318 [(set_attr "itanium_class" "fmac")])
3320 (define_insn "*nmaddtf4_alts"
3321 [(set (match_operand:TF 0 "fr_register_operand" "=f")
3322 (plus:TF (neg:TF (mult:TF
3323 (match_operand:TF 1 "tfreg_or_fp01_operand" "fG")
3324 (match_operand:TF 2 "tfreg_or_fp01_operand" "fG")))
3325 (match_operand:TF 3 "tfreg_or_fp01_operand" "fG")))
3326 (use (match_operand:SI 4 "const_int_operand" ""))]
3328 "fnma.s%4 %0 = %F1, %F2, %F3"
3329 [(set_attr "itanium_class" "fmac")])
3331 (define_insn "*nmaddtf4_truncdf_alts"
3332 [(set (match_operand:DF 0 "fr_register_operand" "=f")
3336 (match_operand:TF 1 "tfreg_or_fp01_operand" "fG")
3337 (match_operand:TF 2 "tfreg_or_fp01_operand" "fG")))
3338 (match_operand:TF 3 "tfreg_or_fp01_operand" "fG"))))
3339 (use (match_operand:SI 4 "const_int_operand" ""))]
3341 "fnma.d.s%4 %0 = %F1, %F2, %F3"
3342 [(set_attr "itanium_class" "fmac")])
3344 (define_expand "divtf3"
3345 [(set (match_operand:TF 0 "fr_register_operand" "")
3346 (div:TF (match_operand:TF 1 "fr_register_operand" "")
3347 (match_operand:TF 2 "fr_register_operand" "")))]
3352 if (TARGET_INLINE_DIV_LAT)
3353 insn = gen_divtf3_internal_lat (operands[0], operands[1], operands[2]);
3355 insn = gen_divtf3_internal_thr (operands[0], operands[1], operands[2]);
3360 (define_insn_and_split "divtf3_internal_lat"
3361 [(set (match_operand:TF 0 "fr_register_operand" "=&f")
3362 (div:TF (match_operand:TF 1 "fr_register_operand" "f")
3363 (match_operand:TF 2 "fr_register_operand" "f")))
3364 (clobber (match_scratch:TF 3 "=&f"))
3365 (clobber (match_scratch:TF 4 "=&f"))
3366 (clobber (match_scratch:TF 5 "=&f"))
3367 (clobber (match_scratch:TF 6 "=&f"))
3368 (clobber (match_scratch:BI 7 "=c"))]
3369 "TARGET_INLINE_DIV_LAT"
3371 "&& reload_completed"
3372 [(parallel [(set (match_dup 0) (div:TF (const_int 1) (match_dup 2)))
3373 (set (match_dup 7) (unspec:BI [(match_dup 1) (match_dup 2)] 5))
3374 (use (const_int 1))])
3375 (cond_exec (ne (match_dup 7) (const_int 0))
3376 (parallel [(set (match_dup 3)
3377 (plus:TF (neg:TF (mult:TF (match_dup 2) (match_dup 0)))
3379 (use (const_int 1))]))
3380 (cond_exec (ne (match_dup 7) (const_int 0))
3381 (parallel [(set (match_dup 4) (mult:TF (match_dup 1) (match_dup 0)))
3382 (use (const_int 1))]))
3383 (cond_exec (ne (match_dup 7) (const_int 0))
3384 (parallel [(set (match_dup 5) (mult:TF (match_dup 3) (match_dup 3)))
3385 (use (const_int 1))]))
3386 (cond_exec (ne (match_dup 7) (const_int 0))
3387 (parallel [(set (match_dup 6)
3388 (plus:TF (mult:TF (match_dup 3) (match_dup 3))
3390 (use (const_int 1))]))
3391 (cond_exec (ne (match_dup 7) (const_int 0))
3392 (parallel [(set (match_dup 3)
3393 (plus:TF (mult:TF (match_dup 5) (match_dup 5))
3395 (use (const_int 1))]))
3396 (cond_exec (ne (match_dup 7) (const_int 0))
3397 (parallel [(set (match_dup 5)
3398 (plus:TF (mult:TF (match_dup 6) (match_dup 0))
3400 (use (const_int 1))]))
3401 (cond_exec (ne (match_dup 7) (const_int 0))
3402 (parallel [(set (match_dup 0)
3403 (plus:TF (mult:TF (match_dup 5) (match_dup 3))
3405 (use (const_int 1))]))
3406 (cond_exec (ne (match_dup 7) (const_int 0))
3407 (parallel [(set (match_dup 4)
3408 (plus:TF (neg:TF (mult:TF (match_dup 2) (match_dup 4)))
3410 (use (const_int 1))]))
3411 (cond_exec (ne (match_dup 7) (const_int 0))
3412 (parallel [(set (match_dup 3)
3413 (plus:TF (mult:TF (match_dup 3) (match_dup 0))
3415 (use (const_int 1))]))
3416 (cond_exec (ne (match_dup 7) (const_int 0))
3417 (parallel [(set (match_dup 5)
3418 (plus:TF (neg:TF (mult:TF (match_dup 2) (match_dup 0)))
3420 (use (const_int 1))]))
3421 (cond_exec (ne (match_dup 7) (const_int 0))
3422 (parallel [(set (match_dup 0)
3423 (plus:TF (mult:TF (match_dup 4) (match_dup 0))
3425 (use (const_int 1))]))
3426 (cond_exec (ne (match_dup 7) (const_int 0))
3427 (parallel [(set (match_dup 4)
3428 (plus:TF (neg:TF (mult:TF (match_dup 2) (match_dup 3)))
3430 (use (const_int 1))]))
3431 (cond_exec (ne (match_dup 7) (const_int 0))
3433 (plus:TF (mult:TF (match_dup 4) (match_dup 0))
3436 "operands[8] = CONST1_RTX (TFmode);"
3437 [(set_attr "predicable" "no")])
3439 (define_insn_and_split "divtf3_internal_thr"
3440 [(set (match_operand:TF 0 "fr_register_operand" "=&f")
3441 (div:TF (match_operand:TF 1 "fr_register_operand" "f")
3442 (match_operand:TF 2 "fr_register_operand" "f")))
3443 (clobber (match_scratch:TF 3 "=&f"))
3444 (clobber (match_scratch:TF 4 "=&f"))
3445 (clobber (match_scratch:BI 5 "=c"))]
3446 "TARGET_INLINE_DIV_THR"
3448 "&& reload_completed"
3449 [(parallel [(set (match_dup 0) (div:TF (const_int 1) (match_dup 2)))
3450 (set (match_dup 5) (unspec:BI [(match_dup 1) (match_dup 2)] 5))
3451 (use (const_int 1))])
3452 (cond_exec (ne (match_dup 5) (const_int 0))
3453 (parallel [(set (match_dup 3)
3454 (plus:TF (neg:TF (mult:TF (match_dup 2) (match_dup 0)))
3456 (use (const_int 1))]))
3457 (cond_exec (ne (match_dup 5) (const_int 0))
3458 (parallel [(set (match_dup 4)
3459 (plus:TF (mult:TF (match_dup 3) (match_dup 0))
3461 (use (const_int 1))]))
3462 (cond_exec (ne (match_dup 5) (const_int 0))
3463 (parallel [(set (match_dup 3) (mult:TF (match_dup 3) (match_dup 3)))
3464 (use (const_int 1))]))
3465 (cond_exec (ne (match_dup 5) (const_int 0))
3466 (parallel [(set (match_dup 3)
3467 (plus:TF (mult:TF (match_dup 3) (match_dup 4))
3469 (use (const_int 1))]))
3470 (cond_exec (ne (match_dup 5) (const_int 0))
3471 (parallel [(set (match_dup 4) (mult:TF (match_dup 1) (match_dup 0)))
3472 (use (const_int 1))]))
3473 (cond_exec (ne (match_dup 5) (const_int 0))
3474 (parallel [(set (match_dup 0)
3475 (plus:TF (neg:TF (mult:TF (match_dup 2) (match_dup 3)))
3477 (use (const_int 1))]))
3478 (cond_exec (ne (match_dup 5) (const_int 0))
3479 (parallel [(set (match_dup 0)
3480 (plus:TF (mult:TF (match_dup 0) (match_dup 3))
3482 (use (const_int 1))]))
3483 (cond_exec (ne (match_dup 5) (const_int 0))
3484 (parallel [(set (match_dup 3)
3485 (plus:TF (neg:TF (mult:TF (match_dup 2) (match_dup 4)))
3487 (use (const_int 1))]))
3488 (cond_exec (ne (match_dup 5) (const_int 0))
3489 (parallel [(set (match_dup 3)
3490 (plus:TF (mult:TF (match_dup 3) (match_dup 0))
3492 (use (const_int 1))]))
3493 (cond_exec (ne (match_dup 5) (const_int 0))
3494 (parallel [(set (match_dup 4)
3495 (plus:TF (neg:TF (mult:TF (match_dup 2) (match_dup 0)))
3497 (use (const_int 1))]))
3498 (cond_exec (ne (match_dup 5) (const_int 0))
3499 (parallel [(set (match_dup 0)
3500 (plus:TF (mult:TF (match_dup 4) (match_dup 0))
3502 (use (const_int 1))]))
3503 (cond_exec (ne (match_dup 5) (const_int 0))
3504 (parallel [(set (match_dup 4)
3505 (plus:TF (neg:TF (mult:TF (match_dup 2) (match_dup 3)))
3507 (use (const_int 1))]))
3508 (cond_exec (ne (match_dup 5) (const_int 0))
3510 (plus:TF (mult:TF (match_dup 4) (match_dup 0))
3513 "operands[6] = CONST1_RTX (TFmode);"
3514 [(set_attr "predicable" "no")])
3516 ;; ??? frcpa works like cmp.foo.unc.
3518 (define_insn "*recip_approx"
3519 [(set (match_operand:TF 0 "fr_register_operand" "=f")
3520 (div:TF (const_int 1)
3521 (match_operand:TF 3 "fr_register_operand" "f")))
3522 (set (match_operand:BI 1 "register_operand" "=c")
3523 (unspec:BI [(match_operand:TF 2 "fr_register_operand" "f")
3525 (use (match_operand:SI 4 "const_int_operand" ""))]
3527 "frcpa.s%4 %0, %1 = %2, %3"
3528 [(set_attr "itanium_class" "fmisc")
3529 (set_attr "predicable" "no")])
3531 ;; ::::::::::::::::::::
3533 ;; :: 32 bit Integer Shifts and Rotates
3535 ;; ::::::::::::::::::::
3537 (define_expand "ashlsi3"
3538 [(set (match_operand:SI 0 "gr_register_operand" "")
3539 (ashift:SI (match_operand:SI 1 "gr_register_operand" "")
3540 (match_operand:SI 2 "gr_reg_or_5bit_operand" "")))]
3544 if (GET_CODE (operands[2]) != CONST_INT)
3546 /* Why oh why didn't Intel arrange for SHIFT_COUNT_TRUNCATED? Now
3547 we've got to get rid of stray bits outside the SImode register. */
3548 rtx subshift = gen_reg_rtx (DImode);
3549 emit_insn (gen_zero_extendsidi2 (subshift, operands[2]));
3550 operands[2] = subshift;
3554 (define_insn "*ashlsi3_internal"
3555 [(set (match_operand:SI 0 "gr_register_operand" "=r,r,r")
3556 (ashift:SI (match_operand:SI 1 "gr_register_operand" "r,r,r")
3557 (match_operand:DI 2 "gr_reg_or_5bit_operand" "R,n,r")))]
3560 shladd %0 = %1, %2, r0
3561 dep.z %0 = %1, %2, %E2
3563 [(set_attr "itanium_class" "ialu,ishf,mmshf")])
3565 (define_expand "ashrsi3"
3566 [(set (match_operand:SI 0 "gr_register_operand" "")
3567 (ashiftrt:SI (match_operand:SI 1 "gr_register_operand" "")
3568 (match_operand:SI 2 "gr_reg_or_5bit_operand" "")))]
3572 rtx subtarget = gen_reg_rtx (DImode);
3573 if (GET_CODE (operands[2]) == CONST_INT)
3574 emit_insn (gen_extv (subtarget, gen_lowpart (DImode, operands[1]),
3575 GEN_INT (32 - INTVAL (operands[2])), operands[2]));
3578 rtx subshift = gen_reg_rtx (DImode);
3579 emit_insn (gen_extendsidi2 (subtarget, operands[1]));
3580 emit_insn (gen_zero_extendsidi2 (subshift, operands[2]));
3581 emit_insn (gen_ashrdi3 (subtarget, subtarget, subshift));
3583 emit_move_insn (gen_lowpart (DImode, operands[0]), subtarget);
3587 (define_expand "lshrsi3"
3588 [(set (match_operand:SI 0 "gr_register_operand" "")
3589 (lshiftrt:SI (match_operand:SI 1 "gr_register_operand" "")
3590 (match_operand:SI 2 "gr_reg_or_5bit_operand" "")))]
3594 rtx subtarget = gen_reg_rtx (DImode);
3595 if (GET_CODE (operands[2]) == CONST_INT)
3596 emit_insn (gen_extzv (subtarget, gen_lowpart (DImode, operands[1]),
3597 GEN_INT (32 - INTVAL (operands[2])), operands[2]));
3600 rtx subshift = gen_reg_rtx (DImode);
3601 emit_insn (gen_zero_extendsidi2 (subtarget, operands[1]));
3602 emit_insn (gen_zero_extendsidi2 (subshift, operands[2]));
3603 emit_insn (gen_lshrdi3 (subtarget, subtarget, subshift));
3605 emit_move_insn (gen_lowpart (DImode, operands[0]), subtarget);
3609 ;; Use mix4.r/shr to implement rotrsi3. We only get 32 bits of valid result
3610 ;; here, instead of 64 like the patterns above. Keep the pattern together
3611 ;; until after combine; otherwise it won't get matched often.
3613 (define_expand "rotrsi3"
3614 [(set (match_operand:SI 0 "gr_register_operand" "")
3615 (rotatert:SI (match_operand:SI 1 "gr_register_operand" "")
3616 (match_operand:SI 2 "gr_reg_or_5bit_operand" "")))]
3620 if (GET_MODE (operands[2]) != VOIDmode)
3622 rtx tmp = gen_reg_rtx (DImode);
3623 emit_insn (gen_zero_extendsidi2 (tmp, operands[2]));
3628 (define_insn_and_split "*rotrsi3_internal"
3629 [(set (match_operand:SI 0 "gr_register_operand" "=&r")
3630 (rotatert:SI (match_operand:SI 1 "gr_register_operand" "r")
3631 (match_operand:DI 2 "gr_reg_or_5bit_operand" "rM")))]
3636 (ior:DI (zero_extend:DI (match_dup 1))
3637 (ashift:DI (zero_extend:DI (match_dup 1)) (const_int 32))))
3639 (lshiftrt:DI (match_dup 3) (match_dup 2)))]
3640 "operands[3] = gen_rtx_REG (DImode, REGNO (operands[0]));")
3642 (define_expand "rotlsi3"
3643 [(set (match_operand:SI 0 "gr_register_operand" "")
3644 (rotate:SI (match_operand:SI 1 "gr_register_operand" "")
3645 (match_operand:SI 2 "gr_reg_or_5bit_operand" "")))]
3649 if (! shift_32bit_count_operand (operands[2], SImode))
3651 rtx tmp = gen_reg_rtx (SImode);
3652 emit_insn (gen_subsi3 (tmp, GEN_INT (32), operands[2]));
3653 emit_insn (gen_rotrsi3 (operands[0], operands[1], tmp));
3658 (define_insn_and_split "*rotlsi3_internal"
3659 [(set (match_operand:SI 0 "gr_register_operand" "=r")
3660 (rotate:SI (match_operand:SI 1 "gr_register_operand" "r")
3661 (match_operand:SI 2 "shift_32bit_count_operand" "n")))]
3666 (ior:DI (zero_extend:DI (match_dup 1))
3667 (ashift:DI (zero_extend:DI (match_dup 1)) (const_int 32))))
3669 (lshiftrt:DI (match_dup 3) (match_dup 2)))]
3670 "operands[3] = gen_rtx_REG (DImode, REGNO (operands[0]));
3671 operands[2] = GEN_INT (32 - INTVAL (operands[2]));")
3673 ;; ::::::::::::::::::::
3675 ;; :: 64 bit Integer Shifts and Rotates
3677 ;; ::::::::::::::::::::
3679 (define_insn "ashldi3"
3680 [(set (match_operand:DI 0 "gr_register_operand" "=r,r,r")
3681 (ashift:DI (match_operand:DI 1 "gr_register_operand" "r,r,r")
3682 (match_operand:DI 2 "gr_reg_or_6bit_operand" "R,r,rM")))]
3685 shladd %0 = %1, %2, r0
3688 [(set_attr "itanium_class" "ialu,mmshf,mmshfi")])
3690 ;; ??? Maybe combine this with the multiply and add instruction?
3692 (define_insn "*shladd"
3693 [(set (match_operand:DI 0 "gr_register_operand" "=r")
3694 (plus:DI (mult:DI (match_operand:DI 1 "gr_register_operand" "r")
3695 (match_operand:DI 2 "shladd_operand" "n"))
3696 (match_operand:DI 3 "gr_register_operand" "r")))]
3698 "shladd %0 = %1, %S2, %3"
3699 [(set_attr "itanium_class" "ialu")])
3701 ;; This can be created by register elimination if operand3 of shladd is an
3702 ;; eliminable register or has reg_equiv_constant set.
3704 ;; We have to use nonmemory_operand for operand 4, to ensure that the
3705 ;; validate_changes call inside eliminate_regs will always succeed. If it
3706 ;; doesn't succeed, then this remain a shladd pattern, and will be reloaded
3709 (define_insn_and_split "*shladd_elim"
3710 [(set (match_operand:DI 0 "gr_register_operand" "=&r")
3711 (plus:DI (plus:DI (mult:DI (match_operand:DI 1 "gr_register_operand" "r")
3712 (match_operand:DI 2 "shladd_operand" "n"))
3713 (match_operand:DI 3 "nonmemory_operand" "r"))
3714 (match_operand:DI 4 "nonmemory_operand" "rI")))]
3715 "reload_in_progress"
3718 [(set (match_dup 0) (plus:DI (mult:DI (match_dup 1) (match_dup 2))
3720 (set (match_dup 0) (plus:DI (match_dup 0) (match_dup 4)))]
3722 [(set_attr "itanium_class" "unknown")])
3724 (define_insn "ashrdi3"
3725 [(set (match_operand:DI 0 "gr_register_operand" "=r,r")
3726 (ashiftrt:DI (match_operand:DI 1 "gr_register_operand" "r,r")
3727 (match_operand:DI 2 "gr_reg_or_6bit_operand" "r,rM")))]
3732 [(set_attr "itanium_class" "mmshf,mmshfi")])
3734 (define_insn "lshrdi3"
3735 [(set (match_operand:DI 0 "gr_register_operand" "=r,r")
3736 (lshiftrt:DI (match_operand:DI 1 "gr_register_operand" "r,r")
3737 (match_operand:DI 2 "gr_reg_or_6bit_operand" "r,rM")))]
3742 [(set_attr "itanium_class" "mmshf,mmshfi")])
3744 ;; Using a predicate that accepts only constants doesn't work, because optabs
3745 ;; will load the operand into a register and call the pattern if the predicate
3746 ;; did not accept it on the first try. So we use nonmemory_operand and then
3747 ;; verify that we have an appropriate constant in the expander.
3749 (define_expand "rotrdi3"
3750 [(set (match_operand:DI 0 "gr_register_operand" "")
3751 (rotatert:DI (match_operand:DI 1 "gr_register_operand" "")
3752 (match_operand:DI 2 "nonmemory_operand" "")))]
3756 if (! shift_count_operand (operands[2], DImode))
3760 (define_insn "*rotrdi3_internal"
3761 [(set (match_operand:DI 0 "gr_register_operand" "=r")
3762 (rotatert:DI (match_operand:DI 1 "gr_register_operand" "r")
3763 (match_operand:DI 2 "shift_count_operand" "M")))]
3765 "shrp %0 = %1, %1, %2"
3766 [(set_attr "itanium_class" "ishf")])
3768 (define_expand "rotldi3"
3769 [(set (match_operand:DI 0 "gr_register_operand" "")
3770 (rotate:DI (match_operand:DI 1 "gr_register_operand" "")
3771 (match_operand:DI 2 "nonmemory_operand" "")))]
3775 if (! shift_count_operand (operands[2], DImode))
3779 (define_insn "*rotldi3_internal"
3780 [(set (match_operand:DI 0 "gr_register_operand" "=r")
3781 (rotate:DI (match_operand:DI 1 "gr_register_operand" "r")
3782 (match_operand:DI 2 "shift_count_operand" "M")))]
3784 "shrp %0 = %1, %1, %e2"
3785 [(set_attr "itanium_class" "ishf")])
3787 ;; ::::::::::::::::::::
3789 ;; :: 32 bit Integer Logical operations
3791 ;; ::::::::::::::::::::
3793 ;; We don't seem to need any other 32-bit logical operations, because gcc
3794 ;; generates zero-extend;zero-extend;DImode-op, which combine optimizes to
3795 ;; DImode-op;zero-extend, and then we can optimize away the zero-extend.
3796 ;; This doesn't work for unary logical operations, because we don't call
3797 ;; apply_distributive_law for them.
3799 ;; ??? Likewise, this doesn't work for andnot, which isn't handled by
3800 ;; apply_distributive_law. We get inefficient code for
3801 ;; int sub4 (int i, int j) { return i & ~j; }
3802 ;; We could convert (and (not (sign_extend A)) (sign_extend B)) to
3803 ;; (zero_extend (and (not A) B)) in combine.
3804 ;; Or maybe fix this by adding andsi3/iorsi3/xorsi3 patterns like the
3805 ;; one_cmplsi2 pattern.
3807 (define_insn "one_cmplsi2"
3808 [(set (match_operand:SI 0 "gr_register_operand" "=r")
3809 (not:SI (match_operand:SI 1 "gr_register_operand" "r")))]
3812 [(set_attr "itanium_class" "ilog")])
3814 ;; ::::::::::::::::::::
3816 ;; :: 64 bit Integer Logical operations
3818 ;; ::::::::::::::::::::
3820 (define_insn "anddi3"
3821 [(set (match_operand:DI 0 "grfr_register_operand" "=r,*f")
3822 (and:DI (match_operand:DI 1 "grfr_register_operand" "%r,*f")
3823 (match_operand:DI 2 "grfr_reg_or_8bit_operand" "rK,*f")))]
3828 [(set_attr "itanium_class" "ilog,fmisc")])
3830 (define_insn "*andnot"
3831 [(set (match_operand:DI 0 "grfr_register_operand" "=r,*f")
3832 (and:DI (not:DI (match_operand:DI 1 "grfr_register_operand" "r,*f"))
3833 (match_operand:DI 2 "grfr_reg_or_8bit_operand" "rK,*f")))]
3838 [(set_attr "itanium_class" "ilog,fmisc")])
3840 (define_insn "iordi3"
3841 [(set (match_operand:DI 0 "grfr_register_operand" "=r,*f")
3842 (ior:DI (match_operand:DI 1 "grfr_register_operand" "%r,*f")
3843 (match_operand:DI 2 "grfr_reg_or_8bit_operand" "rK,*f")))]
3848 [(set_attr "itanium_class" "ilog,fmisc")])
3850 (define_insn "xordi3"
3851 [(set (match_operand:DI 0 "grfr_register_operand" "=r,*f")
3852 (xor:DI (match_operand:DI 1 "grfr_register_operand" "%r,*f")
3853 (match_operand:DI 2 "grfr_reg_or_8bit_operand" "rK,*f")))]
3858 [(set_attr "itanium_class" "ilog,fmisc")])
3860 (define_insn "one_cmpldi2"
3861 [(set (match_operand:DI 0 "gr_register_operand" "=r")
3862 (not:DI (match_operand:DI 1 "gr_register_operand" "r")))]
3865 [(set_attr "itanium_class" "ilog")])
3867 ;; ::::::::::::::::::::
3871 ;; ::::::::::::::::::::
3873 (define_expand "cmpbi"
3875 (compare (match_operand:BI 0 "register_operand" "")
3876 (match_operand:BI 1 "const_int_operand" "")))]
3880 ia64_compare_op0 = operands[0];
3881 ia64_compare_op1 = operands[1];
3885 (define_expand "cmpsi"
3887 (compare (match_operand:SI 0 "gr_register_operand" "")
3888 (match_operand:SI 1 "gr_reg_or_8bit_and_adjusted_operand" "")))]
3892 ia64_compare_op0 = operands[0];
3893 ia64_compare_op1 = operands[1];
3897 (define_expand "cmpdi"
3899 (compare (match_operand:DI 0 "gr_register_operand" "")
3900 (match_operand:DI 1 "gr_reg_or_8bit_and_adjusted_operand" "")))]
3904 ia64_compare_op0 = operands[0];
3905 ia64_compare_op1 = operands[1];
3909 (define_expand "cmpsf"
3911 (compare (match_operand:SF 0 "fr_reg_or_fp01_operand" "")
3912 (match_operand:SF 1 "fr_reg_or_fp01_operand" "")))]
3916 ia64_compare_op0 = operands[0];
3917 ia64_compare_op1 = operands[1];
3921 (define_expand "cmpdf"
3923 (compare (match_operand:DF 0 "fr_reg_or_fp01_operand" "")
3924 (match_operand:DF 1 "fr_reg_or_fp01_operand" "")))]
3928 ia64_compare_op0 = operands[0];
3929 ia64_compare_op1 = operands[1];
3933 (define_expand "cmptf"
3935 (compare (match_operand:TF 0 "tfreg_or_fp01_operand" "")
3936 (match_operand:TF 1 "tfreg_or_fp01_operand" "")))]
3940 ia64_compare_op0 = operands[0];
3941 ia64_compare_op1 = operands[1];
3945 (define_insn "*cmpsi_normal"
3946 [(set (match_operand:BI 0 "register_operand" "=c")
3947 (match_operator:BI 1 "normal_comparison_operator"
3948 [(match_operand:SI 2 "gr_register_operand" "r")
3949 (match_operand:SI 3 "gr_reg_or_8bit_operand" "rK")]))]
3951 "cmp4.%C1 %0, %I0 = %3, %2"
3952 [(set_attr "itanium_class" "icmp")])
3954 ;; We use %r3 because it is possible for us to match a 0, and two of the
3955 ;; unsigned comparisons don't accept immediate operands of zero.
3957 (define_insn "*cmpsi_adjusted"
3958 [(set (match_operand:BI 0 "register_operand" "=c")
3959 (match_operator:BI 1 "adjusted_comparison_operator"
3960 [(match_operand:SI 2 "gr_register_operand" "r")
3961 (match_operand:SI 3 "gr_reg_or_8bit_adjusted_operand" "rL")]))]
3963 "cmp4.%C1 %0, %I0 = %r3, %2"
3964 [(set_attr "itanium_class" "icmp")])
3966 (define_insn "*cmpdi_normal"
3967 [(set (match_operand:BI 0 "register_operand" "=c")
3968 (match_operator:BI 1 "normal_comparison_operator"
3969 [(match_operand:DI 2 "gr_reg_or_0_operand" "rO")
3970 (match_operand:DI 3 "gr_reg_or_8bit_operand" "rK")]))]
3972 "cmp.%C1 %0, %I0 = %3, %r2"
3973 [(set_attr "itanium_class" "icmp")])
3975 ;; We use %r3 because it is possible for us to match a 0, and two of the
3976 ;; unsigned comparisons don't accept immediate operands of zero.
3978 (define_insn "*cmpdi_adjusted"
3979 [(set (match_operand:BI 0 "register_operand" "=c")
3980 (match_operator:BI 1 "adjusted_comparison_operator"
3981 [(match_operand:DI 2 "gr_register_operand" "r")
3982 (match_operand:DI 3 "gr_reg_or_8bit_adjusted_operand" "rL")]))]
3984 "cmp.%C1 %0, %I0 = %r3, %2"
3985 [(set_attr "itanium_class" "icmp")])
3987 (define_insn "*cmpsf_internal"
3988 [(set (match_operand:BI 0 "register_operand" "=c")
3989 (match_operator:BI 1 "comparison_operator"
3990 [(match_operand:SF 2 "fr_reg_or_fp01_operand" "fG")
3991 (match_operand:SF 3 "fr_reg_or_fp01_operand" "fG")]))]
3993 "fcmp.%D1 %0, %I0 = %F2, %F3"
3994 [(set_attr "itanium_class" "fcmp")])
3996 (define_insn "*cmpdf_internal"
3997 [(set (match_operand:BI 0 "register_operand" "=c")
3998 (match_operator:BI 1 "comparison_operator"
3999 [(match_operand:DF 2 "fr_reg_or_fp01_operand" "fG")
4000 (match_operand:DF 3 "fr_reg_or_fp01_operand" "fG")]))]
4002 "fcmp.%D1 %0, %I0 = %F2, %F3"
4003 [(set_attr "itanium_class" "fcmp")])
4005 (define_insn "*cmptf_internal"
4006 [(set (match_operand:BI 0 "register_operand" "=c")
4007 (match_operator:BI 1 "comparison_operator"
4008 [(match_operand:TF 2 "tfreg_or_fp01_operand" "fG")
4009 (match_operand:TF 3 "tfreg_or_fp01_operand" "fG")]))]
4011 "fcmp.%D1 %0, %I0 = %F2, %F3"
4012 [(set_attr "itanium_class" "fcmp")])
4014 ;; ??? Can this pattern be generated?
4016 (define_insn "*bit_zero"
4017 [(set (match_operand:BI 0 "register_operand" "=c")
4018 (eq:BI (zero_extract:DI (match_operand:DI 1 "gr_register_operand" "r")
4020 (match_operand:DI 2 "immediate_operand" "n"))
4023 "tbit.z %0, %I0 = %1, %2"
4024 [(set_attr "itanium_class" "tbit")])
4026 (define_insn "*bit_one"
4027 [(set (match_operand:BI 0 "register_operand" "=c")
4028 (ne:BI (zero_extract:DI (match_operand:DI 1 "gr_register_operand" "r")
4030 (match_operand:DI 2 "immediate_operand" "n"))
4033 "tbit.nz %0, %I0 = %1, %2"
4034 [(set_attr "itanium_class" "tbit")])
4036 ;; ::::::::::::::::::::
4040 ;; ::::::::::::::::::::
4042 (define_expand "beq"
4044 (if_then_else (match_dup 1)
4045 (label_ref (match_operand 0 "" ""))
4048 "operands[1] = ia64_expand_compare (EQ, VOIDmode);")
4050 (define_expand "bne"
4052 (if_then_else (match_dup 1)
4053 (label_ref (match_operand 0 "" ""))
4056 "operands[1] = ia64_expand_compare (NE, VOIDmode);")
4058 (define_expand "blt"
4060 (if_then_else (match_dup 1)
4061 (label_ref (match_operand 0 "" ""))
4064 "operands[1] = ia64_expand_compare (LT, VOIDmode);")
4066 (define_expand "ble"
4068 (if_then_else (match_dup 1)
4069 (label_ref (match_operand 0 "" ""))
4072 "operands[1] = ia64_expand_compare (LE, VOIDmode);")
4074 (define_expand "bgt"
4076 (if_then_else (match_dup 1)
4077 (label_ref (match_operand 0 "" ""))
4080 "operands[1] = ia64_expand_compare (GT, VOIDmode);")
4082 (define_expand "bge"
4084 (if_then_else (match_dup 1)
4085 (label_ref (match_operand 0 "" ""))
4088 "operands[1] = ia64_expand_compare (GE, VOIDmode);")
4090 (define_expand "bltu"
4092 (if_then_else (match_dup 1)
4093 (label_ref (match_operand 0 "" ""))
4096 "operands[1] = ia64_expand_compare (LTU, VOIDmode);")
4098 (define_expand "bleu"
4100 (if_then_else (match_dup 1)
4101 (label_ref (match_operand 0 "" ""))
4104 "operands[1] = ia64_expand_compare (LEU, VOIDmode);")
4106 (define_expand "bgtu"
4108 (if_then_else (match_dup 1)
4109 (label_ref (match_operand 0 "" ""))
4112 "operands[1] = ia64_expand_compare (GTU, VOIDmode);")
4114 (define_expand "bgeu"
4116 (if_then_else (match_dup 1)
4117 (label_ref (match_operand 0 "" ""))
4120 "operands[1] = ia64_expand_compare (GEU, VOIDmode);")
4122 (define_expand "bunordered"
4124 (if_then_else (match_dup 1)
4125 (label_ref (match_operand 0 "" ""))
4128 "operands[1] = ia64_expand_compare (UNORDERED, VOIDmode);")
4130 (define_expand "bordered"
4132 (if_then_else (match_dup 1)
4133 (label_ref (match_operand 0 "" ""))
4136 "operands[1] = ia64_expand_compare (ORDERED, VOIDmode);")
4138 (define_insn "*br_true"
4140 (if_then_else (match_operator 0 "predicate_operator"
4141 [(match_operand:BI 1 "register_operand" "c")
4143 (label_ref (match_operand 2 "" ""))
4146 "(%J0) br.cond%+ %l2"
4147 [(set_attr "itanium_class" "br")
4148 (set_attr "predicable" "no")])
4150 (define_insn "*br_false"
4152 (if_then_else (match_operator 0 "predicate_operator"
4153 [(match_operand:BI 1 "register_operand" "c")
4156 (label_ref (match_operand 2 "" ""))))]
4158 "(%j0) br.cond%+ %l2"
4159 [(set_attr "itanium_class" "br")
4160 (set_attr "predicable" "no")])
4162 ;; ::::::::::::::::::::
4164 ;; :: Counted loop operations
4166 ;; ::::::::::::::::::::
4168 (define_expand "doloop_end"
4169 [(use (match_operand 0 "" "")) ; loop pseudo
4170 (use (match_operand 1 "" "")) ; iterations; zero if unknown
4171 (use (match_operand 2 "" "")) ; max iterations
4172 (use (match_operand 3 "" "")) ; loop level
4173 (use (match_operand 4 "" ""))] ; label
4177 /* Only use cloop on innermost loops. */
4178 if (INTVAL (operands[3]) > 1)
4180 emit_jump_insn (gen_doloop_end_internal (gen_rtx_REG (DImode, AR_LC_REGNUM),
4185 (define_insn "doloop_end_internal"
4186 [(set (pc) (if_then_else (ne (match_operand:DI 0 "ar_lc_reg_operand" "")
4188 (label_ref (match_operand 1 "" ""))
4190 (set (match_dup 0) (if_then_else:DI (ne (match_dup 0) (const_int 0))
4192 (plus:DI (match_dup 0) (const_int -1))))]
4194 "br.cloop.sptk.few %l1"
4195 [(set_attr "itanium_class" "br")
4196 (set_attr "predicable" "no")])
4198 ;; ::::::::::::::::::::
4200 ;; :: Set flag operations
4202 ;; ::::::::::::::::::::
4204 (define_expand "seq"
4205 [(set (match_operand:DI 0 "gr_register_operand" "") (match_dup 1))]
4207 "operands[1] = ia64_expand_compare (EQ, DImode);")
4209 (define_expand "sne"
4210 [(set (match_operand:DI 0 "gr_register_operand" "") (match_dup 1))]
4212 "operands[1] = ia64_expand_compare (NE, DImode);")
4214 (define_expand "slt"
4215 [(set (match_operand:DI 0 "gr_register_operand" "") (match_dup 1))]
4217 "operands[1] = ia64_expand_compare (LT, DImode);")
4219 (define_expand "sle"
4220 [(set (match_operand:DI 0 "gr_register_operand" "") (match_dup 1))]
4222 "operands[1] = ia64_expand_compare (LE, DImode);")
4224 (define_expand "sgt"
4225 [(set (match_operand:DI 0 "gr_register_operand" "") (match_dup 1))]
4227 "operands[1] = ia64_expand_compare (GT, DImode);")
4229 (define_expand "sge"
4230 [(set (match_operand:DI 0 "gr_register_operand" "") (match_dup 1))]
4232 "operands[1] = ia64_expand_compare (GE, DImode);")
4234 (define_expand "sltu"
4235 [(set (match_operand:DI 0 "gr_register_operand" "") (match_dup 1))]
4237 "operands[1] = ia64_expand_compare (LTU, DImode);")
4239 (define_expand "sleu"
4240 [(set (match_operand:DI 0 "gr_register_operand" "") (match_dup 1))]
4242 "operands[1] = ia64_expand_compare (LEU, DImode);")
4244 (define_expand "sgtu"
4245 [(set (match_operand:DI 0 "gr_register_operand" "") (match_dup 1))]
4247 "operands[1] = ia64_expand_compare (GTU, DImode);")
4249 (define_expand "sgeu"
4250 [(set (match_operand:DI 0 "gr_register_operand" "") (match_dup 1))]
4252 "operands[1] = ia64_expand_compare (GEU, DImode);")
4254 (define_expand "sunordered"
4255 [(set (match_operand:DI 0 "gr_register_operand" "") (match_dup 1))]
4257 "operands[1] = ia64_expand_compare (UNORDERED, DImode);")
4259 (define_expand "sordered"
4260 [(set (match_operand:DI 0 "gr_register_operand" "") (match_dup 1))]
4262 "operands[1] = ia64_expand_compare (ORDERED, DImode);")
4264 ;; Don't allow memory as destination here, because cmov/cmov/st is more
4265 ;; efficient than mov/mov/cst/cst.
4267 (define_insn_and_split "*sne_internal"
4268 [(set (match_operand:DI 0 "gr_register_operand" "=r")
4269 (ne:DI (match_operand:BI 1 "register_operand" "c")
4274 [(cond_exec (ne (match_dup 1) (const_int 0))
4275 (set (match_dup 0) (const_int 1)))
4276 (cond_exec (eq (match_dup 1) (const_int 0))
4277 (set (match_dup 0) (const_int 0)))]
4279 [(set_attr "itanium_class" "unknown")])
4281 (define_insn_and_split "*seq_internal"
4282 [(set (match_operand:DI 0 "gr_register_operand" "=r")
4283 (eq:DI (match_operand:BI 1 "register_operand" "c")
4288 [(cond_exec (ne (match_dup 1) (const_int 0))
4289 (set (match_dup 0) (const_int 0)))
4290 (cond_exec (eq (match_dup 1) (const_int 0))
4291 (set (match_dup 0) (const_int 1)))]
4293 [(set_attr "itanium_class" "unknown")])
4295 ;; ::::::::::::::::::::
4297 ;; :: Conditional move instructions.
4299 ;; ::::::::::::::::::::
4301 ;; ??? Add movXXcc patterns?
4304 ;; DImode if_then_else patterns.
4307 (define_insn "*cmovdi_internal"
4308 [(set (match_operand:DI 0 "destination_operand"
4309 "= r, r, r, r, r, r, r, r, r, r, m, Q, *f,*b,*d*e")
4311 (match_operator 4 "predicate_operator"
4312 [(match_operand:BI 1 "register_operand"
4313 "c,c,c,c,c,c,c,c,c,c,c,c,c,c,c")
4315 (match_operand:DI 2 "move_operand"
4316 "rim, *f, *b,*d*e,rim,rim, rim,*f,*b,*d*e,rO,*f,rOQ,rO, rK")
4317 (match_operand:DI 3 "move_operand"
4318 "rim,rim,rim, rim, *f, *b,*d*e,*f,*b,*d*e,rO,*f,rOQ,rO, rK")))]
4319 "ia64_move_ok (operands[0], operands[2])
4320 && ia64_move_ok (operands[0], operands[3])"
4322 [(set_attr "predicable" "no")])
4325 [(set (match_operand 0 "destination_operand" "")
4327 (match_operator 4 "predicate_operator"
4328 [(match_operand:BI 1 "register_operand" "")
4330 (match_operand 2 "move_operand" "")
4331 (match_operand 3 "move_operand" "")))]
4337 if (! rtx_equal_p (operands[0], operands[2]))
4339 tmp = gen_rtx_SET (VOIDmode, operands[0], operands[2]);
4340 tmp = gen_rtx_COND_EXEC (VOIDmode, operands[4], tmp);
4343 if (! rtx_equal_p (operands[0], operands[3]))
4345 tmp = gen_rtx_fmt_ee (GET_CODE (operands[4]) == NE ? EQ : NE,
4346 VOIDmode, operands[1], const0_rtx);
4347 tmp = gen_rtx_COND_EXEC (VOIDmode, tmp,
4348 gen_rtx_SET (VOIDmode, operands[0],
4355 ;; Absolute value pattern.
4357 (define_insn "*absdi2_internal"
4358 [(set (match_operand:DI 0 "gr_register_operand" "=r,r")
4360 (match_operator 4 "predicate_operator"
4361 [(match_operand:BI 1 "register_operand" "c,c")
4363 (neg:DI (match_operand:DI 2 "gr_reg_or_22bit_operand" "rI,rI"))
4364 (match_operand:DI 3 "gr_reg_or_22bit_operand" "0,rI")))]
4367 [(set_attr "itanium_class" "ialu,unknown")
4368 (set_attr "predicable" "no")])
4371 [(set (match_operand:DI 0 "register_operand" "")
4373 (match_operator 4 "predicate_operator"
4374 [(match_operand:BI 1 "register_operand" "c,c")
4376 (neg:DI (match_operand:DI 2 "gr_reg_or_22bit_operand" ""))
4377 (match_operand:DI 3 "gr_reg_or_22bit_operand" "")))]
4378 "reload_completed && rtx_equal_p (operands[0], operands[3])"
4382 (neg:DI (match_dup 2))))]
4386 [(set (match_operand:DI 0 "register_operand" "")
4388 (match_operator 4 "predicate_operator"
4389 [(match_operand:BI 1 "register_operand" "c,c")
4391 (neg:DI (match_operand:DI 2 "gr_reg_or_22bit_operand" ""))
4392 (match_operand:DI 3 "gr_reg_or_22bit_operand" "")))]
4396 (set (match_dup 0) (neg:DI (match_dup 2))))
4399 (set (match_dup 0) (match_dup 3)))]
4402 operands[5] = gen_rtx_fmt_ee (GET_CODE (operands[4]) == NE ? EQ : NE,
4403 VOIDmode, operands[1], const0_rtx);
4407 ;; SImode if_then_else patterns.
4410 (define_insn "*cmovsi_internal"
4411 [(set (match_operand:SI 0 "destination_operand" "=r,m,*f,r,m,*f,r,m,*f")
4413 (match_operator 4 "predicate_operator"
4414 [(match_operand:BI 1 "register_operand" "c,c,c,c,c,c,c,c,c")
4416 (match_operand:SI 2 "move_operand"
4417 "0,0,0,rim*f,rO,rO,rim*f,rO,rO")
4418 (match_operand:SI 3 "move_operand"
4419 "rim*f,rO,rO,0,0,0,rim*f,rO,rO")))]
4420 "ia64_move_ok (operands[0], operands[2])
4421 && ia64_move_ok (operands[0], operands[3])"
4423 [(set_attr "predicable" "no")])
4425 (define_insn "*abssi2_internal"
4426 [(set (match_operand:SI 0 "gr_register_operand" "=r,r")
4428 (match_operator 4 "predicate_operator"
4429 [(match_operand:BI 1 "register_operand" "c,c")
4431 (neg:SI (match_operand:SI 3 "gr_reg_or_22bit_operand" "rI,rI"))
4432 (match_operand:SI 2 "gr_reg_or_22bit_operand" "0,rI")))]
4435 [(set_attr "itanium_class" "ialu,unknown")
4436 (set_attr "predicable" "no")])
4439 [(set (match_operand:SI 0 "register_operand" "")
4441 (match_operator 4 "predicate_operator"
4442 [(match_operand:BI 1 "register_operand" "c,c")
4444 (neg:SI (match_operand:SI 2 "gr_reg_or_22bit_operand" ""))
4445 (match_operand:SI 3 "gr_reg_or_22bit_operand" "")))]
4446 "reload_completed && rtx_equal_p (operands[0], operands[3])"
4450 (neg:SI (match_dup 2))))]
4454 [(set (match_operand:SI 0 "register_operand" "")
4456 (match_operator 4 "predicate_operator"
4457 [(match_operand:BI 1 "register_operand" "c,c")
4459 (neg:SI (match_operand:SI 2 "gr_reg_or_22bit_operand" ""))
4460 (match_operand:SI 3 "gr_reg_or_22bit_operand" "")))]
4464 (set (match_dup 0) (neg:SI (match_dup 2))))
4467 (set (match_dup 0) (match_dup 3)))]
4470 operands[5] = gen_rtx_fmt_ee (GET_CODE (operands[4]) == NE ? EQ : NE,
4471 VOIDmode, operands[1], const0_rtx);
4475 ;; ::::::::::::::::::::
4477 ;; :: Call and branch instructions
4479 ;; ::::::::::::::::::::
4481 ;; Subroutine call instruction returning no value. Operand 0 is the function
4482 ;; to call; operand 1 is the number of bytes of arguments pushed (in mode
4483 ;; `SImode', except it is normally a `const_int'); operand 2 is the number of
4484 ;; registers used as operands.
4486 ;; On most machines, operand 2 is not actually stored into the RTL pattern. It
4487 ;; is supplied for the sake of some RISC machines which need to put this
4488 ;; information into the assembler code; they can put it in the RTL instead of
4491 (define_expand "call"
4492 [(use (match_operand:DI 0 "" ""))
4493 (use (match_operand 1 "" ""))
4494 (use (match_operand 2 "" ""))
4495 (use (match_operand 3 "" ""))]
4499 ia64_expand_call (NULL_RTX, operands[0], operands[2], 0);
4503 (define_expand "sibcall"
4504 [(use (match_operand:DI 0 "" ""))
4505 (use (match_operand 1 "" ""))
4506 (use (match_operand 2 "" ""))
4507 (use (match_operand 3 "" ""))]
4511 ia64_expand_call (NULL_RTX, operands[0], operands[2], 1);
4515 ;; Subroutine call instruction returning a value. Operand 0 is the hard
4516 ;; register in which the value is returned. There are three more operands,
4517 ;; the same as the three operands of the `call' instruction (but with numbers
4518 ;; increased by one).
4520 ;; Subroutines that return `BLKmode' objects use the `call' insn.
4522 (define_expand "call_value"
4523 [(use (match_operand 0 "" ""))
4524 (use (match_operand:DI 1 "" ""))
4525 (use (match_operand 2 "" ""))
4526 (use (match_operand 3 "" ""))
4527 (use (match_operand 4 "" ""))]
4531 ia64_expand_call (operands[0], operands[1], operands[3], 0);
4535 (define_expand "sibcall_value"
4536 [(use (match_operand 0 "" ""))
4537 (use (match_operand:DI 1 "" ""))
4538 (use (match_operand 2 "" ""))
4539 (use (match_operand 3 "" ""))
4540 (use (match_operand 4 "" ""))]
4544 ia64_expand_call (operands[0], operands[1], operands[3], 1);
4548 ;; Call subroutine returning any type.
4550 (define_expand "untyped_call"
4551 [(parallel [(call (match_operand 0 "" "")
4553 (match_operand 1 "" "")
4554 (match_operand 2 "" "")])]
4560 emit_call_insn (gen_call (operands[0], const0_rtx, NULL, const0_rtx));
4562 for (i = 0; i < XVECLEN (operands[2], 0); i++)
4564 rtx set = XVECEXP (operands[2], 0, i);
4565 emit_move_insn (SET_DEST (set), SET_SRC (set));
4568 /* The optimizer does not know that the call sets the function value
4569 registers we stored in the result block. We avoid problems by
4570 claiming that all hard registers are used and clobbered at this
4572 emit_insn (gen_blockage ());
4577 (define_insn "call_nopic"
4578 [(call (mem:DI (match_operand:DI 0 "call_operand" "b,i"))
4579 (match_operand 1 "" ""))
4580 (clobber (match_operand:DI 2 "register_operand" "=b,b"))]
4582 "br.call%+.many %2 = %0"
4583 [(set_attr "itanium_class" "br,scall")])
4585 (define_insn "call_value_nopic"
4586 [(set (match_operand 0 "" "")
4587 (call (mem:DI (match_operand:DI 1 "call_operand" "b,i"))
4588 (match_operand 2 "" "")))
4589 (clobber (match_operand:DI 3 "register_operand" "=b,b"))]
4591 "br.call%+.many %3 = %1"
4592 [(set_attr "itanium_class" "br,scall")])
4594 (define_insn "sibcall_nopic"
4595 [(call (mem:DI (match_operand:DI 0 "call_operand" "b,i"))
4596 (match_operand 1 "" ""))
4597 (use (match_operand:DI 2 "register_operand" "=b,b"))]
4600 [(set_attr "itanium_class" "br,scall")])
4602 (define_insn "call_pic"
4603 [(call (mem:DI (match_operand:DI 0 "call_operand" "b,i"))
4604 (match_operand 1 "" ""))
4605 (use (unspec [(reg:DI 1)] 9))
4606 (clobber (match_operand:DI 2 "register_operand" "=b,b"))]
4608 "br.call%+.many %2 = %0"
4609 [(set_attr "itanium_class" "br,scall")])
4611 (define_insn "call_value_pic"
4612 [(set (match_operand 0 "" "")
4613 (call (mem:DI (match_operand:DI 1 "call_operand" "b,i"))
4614 (match_operand 2 "" "")))
4615 (use (unspec [(reg:DI 1)] 9))
4616 (clobber (match_operand:DI 3 "register_operand" "=b,b"))]
4618 "br.call%+.many %3 = %1"
4619 [(set_attr "itanium_class" "br,scall")])
4621 (define_insn "sibcall_pic"
4622 [(call (mem:DI (match_operand:DI 0 "call_operand" "bi"))
4623 (match_operand 1 "" ""))
4624 (use (unspec [(reg:DI 1)] 9))
4625 (use (match_operand:DI 2 "register_operand" "=b"))]
4628 [(set_attr "itanium_class" "br")])
4630 (define_insn "return_internal"
4632 (use (match_operand:DI 0 "register_operand" "b"))]
4634 "br.ret.sptk.many %0"
4635 [(set_attr "itanium_class" "br")])
4637 (define_insn "return"
4639 "ia64_direct_return ()"
4640 "br.ret.sptk.many rp"
4641 [(set_attr "itanium_class" "br")])
4643 (define_insn "*return_true"
4645 (if_then_else (match_operator 0 "predicate_operator"
4646 [(match_operand:BI 1 "register_operand" "c")
4650 "ia64_direct_return ()"
4651 "(%J0) br.ret%+.many rp"
4652 [(set_attr "itanium_class" "br")
4653 (set_attr "predicable" "no")])
4655 (define_insn "*return_false"
4657 (if_then_else (match_operator 0 "predicate_operator"
4658 [(match_operand:BI 1 "register_operand" "c")
4662 "ia64_direct_return ()"
4663 "(%j0) br.ret%+.many rp"
4664 [(set_attr "itanium_class" "br")
4665 (set_attr "predicable" "no")])
4668 [(set (pc) (label_ref (match_operand 0 "" "")))]
4671 [(set_attr "itanium_class" "br")])
4673 (define_insn "indirect_jump"
4674 [(set (pc) (match_operand:DI 0 "register_operand" "b"))]
4677 [(set_attr "itanium_class" "br")])
4679 (define_expand "tablejump"
4680 [(match_operand:DI 0 "register_operand" "")
4681 (match_operand 1 "" "")]
4685 rtx tmp1 = gen_reg_rtx (DImode);
4686 rtx tmp2 = gen_reg_rtx (DImode);
4688 emit_move_insn (tmp1, gen_rtx_LABEL_REF (Pmode, operands[1]));
4689 emit_insn (gen_adddi3 (tmp2, operands[0], tmp1));
4690 emit_jump_insn (gen_tablejump_internal (tmp2, operands[1]));
4694 (define_insn "tablejump_internal"
4695 [(set (pc) (match_operand:DI 0 "register_operand" "b"))
4696 (use (label_ref (match_operand 1 "" "")))]
4699 [(set_attr "itanium_class" "br")])
4702 ;; ::::::::::::::::::::
4704 ;; :: Prologue and Epilogue instructions
4706 ;; ::::::::::::::::::::
4708 (define_expand "prologue"
4713 ia64_expand_prologue ();
4717 (define_expand "epilogue"
4722 ia64_expand_epilogue (0);
4726 (define_expand "sibcall_epilogue"
4731 ia64_expand_epilogue (1);
4735 ;; This prevents the scheduler from moving the SP decrement past FP-relative
4736 ;; stack accesses. This is the same as adddi3 plus the extra set.
4738 (define_insn "prologue_allocate_stack"
4739 [(set (match_operand:DI 0 "register_operand" "=r,r,r")
4740 (plus:DI (match_operand:DI 1 "register_operand" "%r,r,a")
4741 (match_operand:DI 2 "gr_reg_or_22bit_operand" "r,I,J")))
4742 (set (match_operand:DI 3 "register_operand" "=r,r,r")
4749 [(set_attr "itanium_class" "ialu")])
4751 ;; This prevents the scheduler from moving the SP restore past FP-relative
4752 ;; stack accesses. This is similar to movdi plus the extra set.
4754 (define_insn "epilogue_deallocate_stack"
4755 [(set (match_operand:DI 0 "register_operand" "=r")
4756 (match_operand:DI 1 "register_operand" "+r"))
4757 (set (match_dup 1) (match_dup 1))]
4760 [(set_attr "itanium_class" "ialu")])
4762 ;; Allocate a new register frame.
4764 (define_insn "alloc"
4765 [(set (match_operand:DI 0 "register_operand" "=r")
4766 (unspec_volatile:DI [(const_int 0)] 0))
4767 (use (match_operand:DI 1 "const_int_operand" "i"))
4768 (use (match_operand:DI 2 "const_int_operand" "i"))
4769 (use (match_operand:DI 3 "const_int_operand" "i"))
4770 (use (match_operand:DI 4 "const_int_operand" "i"))]
4772 "alloc %0 = ar.pfs, %1, %2, %3, %4"
4773 [(set_attr "itanium_class" "syst_m0")
4774 (set_attr "predicable" "no")])
4777 (define_expand "gr_spill"
4778 [(parallel [(set (match_operand:DI 0 "memory_operand" "=m")
4779 (unspec:DI [(match_operand:DI 1 "register_operand" "r")
4780 (match_operand:DI 2 "const_int_operand" "")] 1))
4781 (clobber (match_dup 3))])]
4783 "operands[3] = gen_rtx_REG (DImode, AR_UNAT_REGNUM);")
4785 (define_insn "gr_spill_internal"
4786 [(set (match_operand:DI 0 "memory_operand" "=m")
4787 (unspec:DI [(match_operand:DI 1 "register_operand" "r")
4788 (match_operand:DI 2 "const_int_operand" "")] 1))
4789 (clobber (match_operand:DI 3 "register_operand" ""))]
4793 return \".mem.offset %2, 0\;%,st8.spill %0 = %1%P0\";
4795 [(set_attr "itanium_class" "st")])
4798 (define_expand "gr_restore"
4799 [(parallel [(set (match_operand:DI 0 "register_operand" "=r")
4800 (unspec:DI [(match_operand:DI 1 "memory_operand" "m")
4801 (match_operand:DI 2 "const_int_operand" "")] 2))
4802 (use (match_dup 3))])]
4804 "operands[3] = gen_rtx_REG (DImode, AR_UNAT_REGNUM);")
4806 (define_insn "gr_restore_internal"
4807 [(set (match_operand:DI 0 "register_operand" "=r")
4808 (unspec:DI [(match_operand:DI 1 "memory_operand" "m")
4809 (match_operand:DI 2 "const_int_operand" "")] 2))
4810 (use (match_operand:DI 3 "register_operand" ""))]
4814 return \".mem.offset %2, 0\;%,ld8.fill %0 = %1%P1\";
4816 [(set_attr "itanium_class" "ld")])
4818 (define_insn "fr_spill"
4819 [(set (match_operand:TF 0 "memory_operand" "=m")
4820 (unspec:TF [(match_operand:TF 1 "register_operand" "f")] 3))]
4822 "stf.spill %0 = %1%P0"
4823 [(set_attr "itanium_class" "stf")])
4825 (define_insn "fr_restore"
4826 [(set (match_operand:TF 0 "register_operand" "=f")
4827 (unspec:TF [(match_operand:TF 1 "memory_operand" "m")] 4))]
4829 "ldf.fill %0 = %1%P1"
4830 [(set_attr "itanium_class" "fld")])
4832 ;; ??? The explicit stop is not ideal. It would be better if
4833 ;; rtx_needs_barrier took care of this, but this is something that can be
4834 ;; fixed later. This avoids an RSE DV.
4836 (define_insn "bsp_value"
4837 [(set (match_operand:DI 0 "register_operand" "=r")
4838 (unspec:DI [(const_int 0)] 20))]
4840 ";;\;mov %0 = ar.bsp"
4841 [(set_attr "itanium_class" "frar_i")])
4843 (define_insn "set_bsp"
4844 [(unspec_volatile [(match_operand:DI 0 "register_operand" "r")] 5)]
4846 "flushrs\;mov r19=ar.rsc\;;;\;and r19=0x1c,r19\;;;\;mov ar.rsc=r19\;;;\;mov ar.bspstore=%0\;;;\;or r19=0x3,r19\;;;\;loadrs\;invala\;;;\;mov ar.rsc=r19"
4847 [(set_attr "itanium_class" "unknown")
4848 (set_attr "predicable" "no")])
4850 ;; ??? The explicit stops are not ideal. It would be better if
4851 ;; rtx_needs_barrier took care of this, but this is something that can be
4852 ;; fixed later. This avoids an RSE DV.
4854 (define_insn "flushrs"
4855 [(unspec [(const_int 0)] 21)]
4858 [(set_attr "itanium_class" "rse_m")])
4860 ;; ::::::::::::::::::::
4862 ;; :: Miscellaneous instructions
4864 ;; ::::::::::::::::::::
4866 ;; ??? Emiting a NOP instruction isn't very useful. This should probably
4867 ;; be emitting ";;" to force a break in the instruction packing.
4869 ;; No operation, needed in case the user uses -g but not -O.
4874 [(set_attr "itanium_class" "unknown")])
4876 (define_insn "nop_m"
4880 [(set_attr "itanium_class" "nop_m")])
4882 (define_insn "nop_i"
4886 [(set_attr "itanium_class" "nop_i")])
4888 (define_insn "nop_f"
4892 [(set_attr "itanium_class" "nop_f")])
4894 (define_insn "nop_b"
4898 [(set_attr "itanium_class" "nop_b")])
4900 (define_insn "nop_x"
4904 [(set_attr "itanium_class" "nop_x")])
4906 (define_expand "cycle_display"
4907 [(unspec [(match_operand 0 "const_int_operand" "")] 23)]
4908 "ia64_final_schedule"
4911 (define_insn "*cycle_display_1"
4912 [(unspec [(match_operand 0 "const_int_operand" "")] 23)]
4915 [(set_attr "itanium_class" "ignore")
4916 (set_attr "predicable" "no")])
4918 (define_insn "bundle_selector"
4919 [(unspec [(match_operand 0 "const_int_operand" "")] 22)]
4923 return get_bundle_name (INTVAL (operands[0]));
4925 [(set_attr "itanium_class" "ignore")
4926 (set_attr "predicable" "no")])
4928 ;; Pseudo instruction that prevents the scheduler from moving code above this
4930 (define_insn "blockage"
4931 [(unspec_volatile [(const_int 0)] 1)]
4934 [(set_attr "itanium_class" "ignore")
4935 (set_attr "predicable" "no")])
4937 (define_insn "insn_group_barrier"
4938 [(unspec_volatile [(match_operand 0 "const_int_operand" "")] 2)]
4941 [(set_attr "itanium_class" "stop_bit")
4942 (set_attr "predicable" "no")])
4944 (define_insn "break_f"
4945 [(unspec_volatile [(const_int 0)] 3)]
4948 [(set_attr "itanium_class" "nop_f")])
4950 ;; Non-local goto support.
4952 (define_expand "save_stack_nonlocal"
4953 [(use (match_operand:OI 0 "memory_operand" ""))
4954 (use (match_operand:DI 1 "register_operand" ""))]
4958 emit_library_call (gen_rtx_SYMBOL_REF (Pmode,
4959 \"__ia64_save_stack_nonlocal\"),
4960 0, VOIDmode, 2, XEXP (operands[0], 0), Pmode,
4961 operands[1], Pmode);
4965 (define_expand "nonlocal_goto"
4966 [(use (match_operand 0 "general_operand" ""))
4967 (use (match_operand 1 "general_operand" ""))
4968 (use (match_operand 2 "general_operand" ""))
4969 (use (match_operand 3 "general_operand" ""))]
4973 emit_library_call (gen_rtx_SYMBOL_REF (Pmode, \"__ia64_nonlocal_goto\"),
4974 LCT_NORETURN, VOIDmode, 3,
4976 copy_to_reg (XEXP (operands[2], 0)), Pmode,
4977 operands[1], Pmode);
4982 ;; The rest of the setjmp processing happens with the nonlocal_goto expander.
4983 ;; ??? This is not tested.
4984 (define_expand "builtin_setjmp_setup"
4985 [(use (match_operand:DI 0 "" ""))]
4989 emit_move_insn (ia64_gp_save_reg (0), gen_rtx_REG (DImode, GR_REG (1)));
4993 (define_expand "builtin_setjmp_receiver"
4994 [(use (match_operand:DI 0 "" ""))]
4998 emit_move_insn (gen_rtx_REG (DImode, GR_REG (1)), ia64_gp_save_reg (0));
5002 (define_expand "eh_epilogue"
5003 [(use (match_operand:DI 0 "register_operand" "r"))
5004 (use (match_operand:DI 1 "register_operand" "r"))
5005 (use (match_operand:DI 2 "register_operand" "r"))]
5009 rtx bsp = gen_rtx_REG (Pmode, 10);
5010 rtx sp = gen_rtx_REG (Pmode, 9);
5012 if (GET_CODE (operands[0]) != REG || REGNO (operands[0]) != 10)
5014 emit_move_insn (bsp, operands[0]);
5017 if (GET_CODE (operands[2]) != REG || REGNO (operands[2]) != 9)
5019 emit_move_insn (sp, operands[2]);
5022 emit_insn (gen_rtx_USE (VOIDmode, sp));
5023 emit_insn (gen_rtx_USE (VOIDmode, bsp));
5025 cfun->machine->ia64_eh_epilogue_sp = sp;
5026 cfun->machine->ia64_eh_epilogue_bsp = bsp;
5029 ;; Builtin apply support.
5031 (define_expand "restore_stack_nonlocal"
5032 [(use (match_operand:DI 0 "register_operand" ""))
5033 (use (match_operand:OI 1 "memory_operand" ""))]
5037 emit_library_call (gen_rtx_SYMBOL_REF (Pmode,
5038 \"__ia64_restore_stack_nonlocal\"),
5040 copy_to_reg (XEXP (operands[1], 0)), Pmode);
5045 ;;; Intrinsics support.
5048 [(set (mem:BLK (match_dup 0))
5049 (unspec:BLK [(mem:BLK (match_dup 0))] 12))]
5053 operands[0] = gen_rtx_MEM (BLKmode, gen_rtx_SCRATCH (DImode));
5054 MEM_VOLATILE_P (operands[0]) = 1;
5057 (define_insn "*mf_internal"
5058 [(set (match_operand:BLK 0 "" "")
5059 (unspec:BLK [(match_operand:BLK 1 "" "")] 12))]
5062 [(set_attr "itanium_class" "syst_m")])
5064 (define_insn "fetchadd_acq_si"
5065 [(set (match_operand:SI 0 "gr_register_operand" "=r")
5067 (set (match_operand:SI 1 "not_postinc_memory_operand" "+S")
5068 (unspec:SI [(match_dup 1)
5069 (match_operand:SI 2 "fetchadd_operand" "n")] 19))]
5071 "fetchadd4.acq %0 = %1, %2"
5072 [(set_attr "itanium_class" "sem")])
5074 (define_insn "fetchadd_acq_di"
5075 [(set (match_operand:DI 0 "gr_register_operand" "=r")
5077 (set (match_operand:DI 1 "not_postinc_memory_operand" "+S")
5078 (unspec:DI [(match_dup 1)
5079 (match_operand:DI 2 "fetchadd_operand" "n")] 19))]
5081 "fetchadd8.acq %0 = %1, %2"
5082 [(set_attr "itanium_class" "sem")])
5084 (define_insn "cmpxchg_acq_si"
5085 [(set (match_operand:SI 0 "gr_register_operand" "=r")
5087 (set (match_operand:SI 1 "not_postinc_memory_operand" "+S")
5088 (unspec:SI [(match_dup 1)
5089 (match_operand:SI 2 "gr_register_operand" "r")
5090 (match_operand:SI 3 "ar_ccv_reg_operand" "")] 13))]
5092 "cmpxchg4.acq %0 = %1, %2, %3"
5093 [(set_attr "itanium_class" "sem")])
5095 (define_insn "cmpxchg_acq_di"
5096 [(set (match_operand:DI 0 "gr_register_operand" "=r")
5098 (set (match_operand:DI 1 "not_postinc_memory_operand" "+S")
5099 (unspec:DI [(match_dup 1)
5100 (match_operand:DI 2 "gr_register_operand" "r")
5101 (match_operand:DI 3 "ar_ccv_reg_operand" "")] 13))]
5103 "cmpxchg8.acq %0 = %1, %2, %3"
5104 [(set_attr "itanium_class" "sem")])
5106 (define_insn "xchgsi"
5107 [(set (match_operand:SI 0 "gr_register_operand" "=r")
5108 (match_operand:SI 1 "not_postinc_memory_operand" "+S"))
5110 (match_operand:SI 2 "gr_register_operand" "r"))]
5113 [(set_attr "itanium_class" "sem")])
5115 (define_insn "xchgdi"
5116 [(set (match_operand:DI 0 "gr_register_operand" "=r")
5117 (match_operand:DI 1 "not_postinc_memory_operand" "+S"))
5119 (match_operand:DI 2 "gr_register_operand" "r"))]
5122 [(set_attr "itanium_class" "sem")])
5127 [(match_operator 0 "predicate_operator"
5128 [(match_operand:BI 1 "register_operand" "c")
5133 (define_insn "pred_rel_mutex"
5134 [(set (match_operand:BI 0 "register_operand" "+c")
5135 (unspec:BI [(match_dup 0)] 7))]
5137 ".pred.rel.mutex %0, %I0"
5138 [(set_attr "itanium_class" "ignore")
5139 (set_attr "predicable" "no")])
5141 (define_insn "safe_across_calls_all"
5142 [(unspec_volatile [(const_int 0)] 8)]
5144 ".pred.safe_across_calls p1-p63"
5145 [(set_attr "itanium_class" "ignore")
5146 (set_attr "predicable" "no")])
5148 (define_insn "safe_across_calls_normal"
5149 [(unspec_volatile [(const_int 0)] 9)]
5153 emit_safe_across_calls (asm_out_file);
5156 [(set_attr "itanium_class" "ignore")
5157 (set_attr "predicable" "no")])