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 ;; ??? The explicit stop in the flushrs pattern is not ideal. It
50 ;; would be better if rtx_needs_barrier took care of this, but this is
51 ;; something that can be fixed later.
53 ;; ??? Need a better way to describe alternate fp status registers.
75 ;; 2 insn_group_barrier
77 ;; 8 pred.safe_across_calls all
78 ;; 9 pred.safe_across_calls normal
80 ;; ::::::::::::::::::::
84 ;; ::::::::::::::::::::
86 ;; Instruction type. This primarily determines how instructions can be
87 ;; packed in bundles, and secondarily affects scheduling to function units.
89 ;; A alu, can go in I or M syllable of a bundle
94 ;; L long immediate, takes two syllables
97 ;; ??? Should not have any pattern with type unknown. Perhaps add code to
98 ;; check this in md_reorg? Currently use unknown for patterns which emit
99 ;; multiple instructions, patterns which emit 0 instructions, and patterns
100 ;; which emit instruction that can go in any slot (e.g. nop).
102 (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,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"
103 (const_string "unknown"))
105 (define_attr "type" "unknown,A,I,M,F,B,L,S"
106 (cond [(eq_attr "itanium_class" "ld,st,fld,stf,sem") (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" "ialu,icmp,ilog") (const_string "A")
110 (eq_attr "itanium_class" "fmisc,fmac,fcmp,xmpy,fcvtfx") (const_string "F")
111 (eq_attr "itanium_class" "frar_i,toar_i,frbr,tobr") (const_string "I")
112 (eq_attr "itanium_class" "frpr,topr,ishf,xtd,tbit") (const_string "I")
113 (eq_attr "itanium_class" "mmmul,mmshf,mmshfi") (const_string "I")
114 (eq_attr "itanium_class" "br,scall") (const_string "B")
115 (eq_attr "itanium_class" "stop_bit") (const_string "S")
116 (eq_attr "itanium_class" "long_i") (const_string "L")]
117 (const_string "unknown")))
119 ;; Predication. True iff this instruction can be predicated.
121 (define_attr "predicable" "no,yes" (const_string "yes"))
124 ;; ::::::::::::::::::::
128 ;; ::::::::::::::::::::
130 ;; Each usage of a function units by a class of insns is specified with a
131 ;; `define_function_unit' expression, which looks like this:
132 ;; (define_function_unit NAME MULTIPLICITY SIMULTANEITY TEST READY-DELAY
133 ;; ISSUE-DELAY [CONFLICT-LIST])
135 ;; This default scheduling info seeks to pack instructions into bundles
136 ;; efficiently to reduce code size, so we just list how many of each
137 ;; instruction type can go in a bundle. ISSUE_RATE is set to 3.
139 ;; ??? Add scheduler ready-list hook (MD_SCHED_REORDER) that orders
140 ;; instructions, so that the next instruction can fill the next bundle slot.
141 ;; This really needs to know where the stop bits are though.
143 ;; ??? Use MD_SCHED_REORDER to put alloc first instead of using an unspec
144 ;; volatile. Use ADJUST_PRIORITY to set the priority of alloc very high to
145 ;; make it schedule first.
147 ;; ??? Modify the md_reorg code that emits stop bits so that instead of putting
148 ;; them in the last possible place, we put them in places where bundles allow
149 ;; them. This should reduce code size, but may decrease performance if we end
150 ;; up with more stop bits than the minimum we need.
152 ;; Alu instructions can execute on either the integer or memory function
153 ;; unit. We indicate this by defining an alu function unit, and then marking
154 ;; it as busy everytime we issue a integer or memory type instruction.
156 (define_function_unit "alu" 3 1 (eq_attr "type" "A,I,M") 1 0)
158 (define_function_unit "integer" 2 1 (eq_attr "type" "I") 1 0)
160 (define_function_unit "memory" 3 1 (eq_attr "type" "M") 1 0)
162 (define_function_unit "floating_point" 1 1 (eq_attr "type" "F") 1 0)
164 (define_function_unit "branch" 3 1 (eq_attr "type" "B") 1 0)
166 ;; ??? This isn't quite right, because we can only fit two insns in a bundle
167 ;; when using an L type instruction. That isn't modeled currently.
169 (define_function_unit "long_immediate" 1 1 (eq_attr "type" "L") 1 0)
172 ;; ::::::::::::::::::::
176 ;; ::::::::::::::::::::
178 ;; Set of a single predicate register. This is only used to implement
179 ;; pr-to-pr move and complement.
181 (define_insn "*movcci"
182 [(set (match_operand:CCI 0 "register_operand" "=c,c,c")
183 (match_operand:CCI 1 "nonmemory_operand" "O,n,c"))]
186 cmp.ne %0, p0 = r0, r0
187 cmp.eq %0, p0 = r0, r0
188 (%1) cmp.eq.unc %0, p0 = r0, r0"
189 [(set_attr "itanium_class" "icmp")
190 (set_attr "predicable" "no")])
193 [(set (match_operand:BI 0 "nonimmediate_operand" "=c,c,?c,?*r, c,*r,*r,*m,*r")
194 (match_operand:BI 1 "move_operand" " O,n, c, c,*r, n,*m,*r,*r"))]
197 cmp.ne %0, %I0 = r0, r0
198 cmp.eq %0, %I0 = r0, r0
201 tbit.nz %0, %I0 = %1, 0
206 [(set_attr "itanium_class" "icmp,icmp,unknown,unknown,tbit,ialu,ld,st,ialu")])
209 [(set (match_operand:BI 0 "register_operand" "")
210 (match_operand:BI 1 "register_operand" ""))]
212 && GET_CODE (operands[0]) == REG && GR_REGNO_P (REGNO (operands[0]))
213 && GET_CODE (operands[1]) == REG && PR_REGNO_P (REGNO (operands[1]))"
214 [(cond_exec (ne (match_dup 1) (const_int 0))
215 (set (match_dup 0) (const_int 1)))
216 (cond_exec (eq (match_dup 1) (const_int 0))
217 (set (match_dup 0) (const_int 0)))]
221 [(set (match_operand:BI 0 "register_operand" "")
222 (match_operand:BI 1 "register_operand" ""))]
224 && GET_CODE (operands[0]) == REG && PR_REGNO_P (REGNO (operands[0]))
225 && GET_CODE (operands[1]) == REG && PR_REGNO_P (REGNO (operands[1]))"
226 [(set (match_dup 2) (match_dup 4))
227 (set (match_dup 3) (match_dup 5))
228 (set (match_dup 0) (unspec:BI [(match_dup 0)] 7))]
229 "operands[2] = gen_rtx_REG (CCImode, REGNO (operands[0]));
230 operands[3] = gen_rtx_REG (CCImode, REGNO (operands[0]) + 1);
231 operands[4] = gen_rtx_REG (CCImode, REGNO (operands[1]));
232 operands[5] = gen_rtx_REG (CCImode, REGNO (operands[1]) + 1);")
234 (define_expand "movqi"
235 [(set (match_operand:QI 0 "general_operand" "")
236 (match_operand:QI 1 "general_operand" ""))]
240 if (! reload_in_progress && ! reload_completed
241 && ! ia64_move_ok (operands[0], operands[1]))
242 operands[1] = force_reg (QImode, operands[1]);
245 ;; Errata 72 implies that we cannot use predicated loads and stores
246 ;; on affected systems. Reuse TARGET_A_STEP for convenience.
248 ;; ??? It would be convenient at this point if the cond_exec pattern
249 ;; expander understood non-constant conditions on attributes. Failing
250 ;; that we have to replicate patterns.
252 (define_insn "*movqicc_astep"
254 (match_operator 2 "predicate_operator"
255 [(match_operand:BI 3 "register_operand" "c,c,c,c,c")
257 (set (match_operand:QI 0 "register_operand" "=r,r, r,*f,*f")
258 (match_operand:QI 1 "nonmemory_operand" "rO,J,*f,rO,*f")))]
259 "TARGET_A_STEP && ia64_move_ok (operands[0], operands[1])"
262 (%J2) addl %0 = %1, r0
263 (%J2) getf.sig %0 = %1
264 (%J2) setf.sig %0 = %r1
266 [(set_attr "itanium_class" "ialu,ialu,frfr,tofr,fmisc")
267 (set_attr "predicable" "no")])
269 (define_insn "*movqi_internal_astep"
270 [(set (match_operand:QI 0 "destination_operand" "=r,r,r, m, r,*f,*f")
271 (match_operand:QI 1 "move_operand" "rO,J,m,rO,*f,rO,*f"))]
272 "TARGET_A_STEP && ia64_move_ok (operands[0], operands[1])"
281 [(set_attr "itanium_class" "ialu,ialu,ld,st,frfr,tofr,fmisc")
282 (set_attr "predicable" "no")])
284 (define_insn "*movqi_internal"
285 [(set (match_operand:QI 0 "destination_operand" "=r,r,r, m, r,*f,*f")
286 (match_operand:QI 1 "move_operand" "rO,J,m,rO,*f,rO,*f"))]
287 "! TARGET_A_STEP && ia64_move_ok (operands[0], operands[1])"
296 [(set_attr "itanium_class" "ialu,ialu,ld,st,frfr,tofr,fmisc")])
298 (define_expand "movhi"
299 [(set (match_operand:HI 0 "general_operand" "")
300 (match_operand:HI 1 "general_operand" ""))]
304 if (! reload_in_progress && ! reload_completed
305 && ! ia64_move_ok (operands[0], operands[1]))
306 operands[1] = force_reg (HImode, operands[1]);
309 ;; Errata 72 workaround.
310 (define_insn "*movhicc_astep"
312 (match_operator 2 "predicate_operator"
313 [(match_operand:BI 3 "register_operand" "c,c,c,c,c")
315 (set (match_operand:HI 0 "register_operand" "=r,r, r,*f,*f")
316 (match_operand:HI 1 "nonmemory_operand" "rO,J,*f,rO,*f")))]
317 "TARGET_A_STEP && ia64_move_ok (operands[0], operands[1])"
320 (%J2) addl %0 = %1, r0
321 (%J2) getf.sig %0 = %1
322 (%J2) setf.sig %0 = %r1
324 [(set_attr "itanium_class" "ialu,ialu,frfr,tofr,fmisc")
325 (set_attr "predicable" "no")])
327 (define_insn "*movhi_internal_astep"
328 [(set (match_operand:HI 0 "destination_operand" "=r,r,r, m, r,*f,*f")
329 (match_operand:HI 1 "move_operand" "rO,J,m,rO,*f,rO,*f"))]
330 "TARGET_A_STEP && ia64_move_ok (operands[0], operands[1])"
339 [(set_attr "itanium_class" "ialu,ialu,ld,st,frfr,tofr,fmisc")
340 (set_attr "predicable" "no")])
342 (define_insn "*movhi_internal"
343 [(set (match_operand:HI 0 "destination_operand" "=r,r,r, m, r,*f,*f")
344 (match_operand:HI 1 "move_operand" "rO,J,m,rO,*f,rO,*f"))]
345 "! TARGET_A_STEP && ia64_move_ok (operands[0], operands[1])"
354 [(set_attr "itanium_class" "ialu,ialu,ld,st,frfr,tofr,fmisc")])
356 (define_expand "movsi"
357 [(set (match_operand:SI 0 "general_operand" "")
358 (match_operand:SI 1 "general_operand" ""))]
362 if (! reload_in_progress && ! reload_completed
363 && ! ia64_move_ok (operands[0], operands[1]))
364 operands[1] = force_reg (SImode, operands[1]);
367 ;; Errata 72 workaround.
368 (define_insn "*movsicc_astep"
370 (match_operator 2 "predicate_operator"
371 [(match_operand:BI 3 "register_operand" "c,c,c,c,c,c,c,c")
373 (set (match_operand:SI 0 "register_operand" "=r,r,r, r,*f,*f, r,*d")
374 (match_operand:SI 1 "nonmemory_operand" "rO,J,i,*f,rO,*f,*d,rK")))]
375 "TARGET_A_STEP && ia64_move_ok (operands[0], operands[1])"
378 (%J2) addl %0 = %1, r0
380 (%J2) getf.sig %0 = %1
381 (%J2) setf.sig %0 = %r1
385 ;; frar_m, toar_m ??? why not frar_i and toar_i
386 [(set_attr "itanium_class" "ialu,ialu,long_i,frfr,tofr,fmisc,frar_m,toar_m")
387 (set_attr "predicable" "no")])
389 (define_insn "*movsi_internal_astep"
390 [(set (match_operand:SI 0 "destination_operand" "=r,r,r,r, m, r,*f,*f, r,*d")
391 (match_operand:SI 1 "move_operand" "rO,J,i,m,rO,*f,rO,*f,*d,rK"))]
392 "TARGET_A_STEP && ia64_move_ok (operands[0], operands[1])"
404 ;; frar_m, toar_m ??? why not frar_i and toar_i
405 [(set_attr "itanium_class" "ialu,ialu,long_i,ld,st,frfr,tofr,fmisc,frar_m,toar_m")
406 (set_attr "predicable" "no")])
408 (define_insn "*movsi_internal"
409 [(set (match_operand:SI 0 "destination_operand" "=r,r,r,r, m, r,*f,*f, r,*d")
410 (match_operand:SI 1 "move_operand" "rO,J,i,m,rO,*f,rO,*f,*d,rK"))]
411 "! TARGET_A_STEP && ia64_move_ok (operands[0], operands[1])"
423 ;; frar_m, toar_m ??? why not frar_i and toar_i
424 [(set_attr "itanium_class" "ialu,ialu,long_i,ld,st,frfr,tofr,fmisc,frar_m,toar_m")])
426 (define_expand "movdi"
427 [(set (match_operand:DI 0 "general_operand" "")
428 (match_operand:DI 1 "general_operand" ""))]
432 if (! reload_in_progress && ! reload_completed
433 && ! ia64_move_ok (operands[0], operands[1]))
434 operands[1] = force_reg (DImode, operands[1]);
435 if (! TARGET_NO_PIC && symbolic_operand (operands[1], DImode))
437 /* Before optimization starts, delay committing to any particular
438 type of PIC address load. If this function gets deferred, we
439 may acquire information that changes the value of the
440 sdata_symbolic_operand predicate. */
441 /* But don't delay for function pointers. Loading a function address
442 actually loads the address of the descriptor not the function.
443 If we represent these as SYMBOL_REFs, then they get cse'd with
444 calls, and we end up with calls to the descriptor address instead of
445 calls to the function address. Functions are not candidates for
447 if (rtx_equal_function_value_matters
448 && ! (GET_CODE (operands[1]) == SYMBOL_REF
449 && SYMBOL_REF_FLAG (operands[1])))
450 emit_insn (gen_movdi_symbolic (operands[0], operands[1]));
452 ia64_expand_load_address (operands[0], operands[1]);
457 ;; Errata 72 workaround.
460 (match_operator 2 "predicate_operator"
461 [(match_operand:BI 3 "register_operand" "c,c,c,c,c,c,c,c,c,c,c,c")
463 (set (match_operand:DI 0 "register_operand"
464 "=r,r,r, r,*f,*f, r,*b, r,*e, r,*d")
465 (match_operand:DI 1 "nonmemory_operand"
466 "rO,J,i,*f,rO,*f,*b,rO,*e,rK,*d,rK")))]
467 "TARGET_A_STEP && ia64_move_ok (operands[0], operands[1])"
470 static const char * const alt[] = {
471 \"(%J2) mov %0 = %r1\",
472 \"(%J2) addl %0 = %1, r0\",
473 \"(%J2) movl %0 = %1\",
474 \"(%J2) getf.sig %0 = %1\",
475 \"(%J2) setf.sig %0 = %r1\",
476 \"(%J2) mov %0 = %1\",
477 \"(%J2) mov %0 = %1\",
478 \"(%J2) mov %0 = %r1\",
479 \"(%J2) mov %0 = %1\",
480 \"(%J2) mov %0 = %1\",
481 \"(%J2) mov %0 = %1\",
482 \"(%J2) mov %0 = %1\"
485 /* We use 'i' for alternative 2 despite possible PIC problems.
487 If we define LEGITIMATE_CONSTANT_P such that symbols are not
488 allowed, then the compiler dumps the data into constant memory
489 instead of letting us read the values from the GOT. Similarly
490 if we use 'n' instead of 'i'.
492 Instead, we allow such insns through reload and then split them
493 afterward (even without optimization). Therefore, we should
494 never get so far with a symbolic operand. */
496 if (which_alternative == 2 && ! TARGET_NO_PIC
497 && symbolic_operand (operands[1], VOIDmode))
500 return alt[which_alternative];
502 [(set_attr "itanium_class" "ialu,ialu,long_i,frfr,tofr,fmisc,frbr,tobr,frar_i,toar_i,frar_m,toar_m")
503 (set_attr "predicable" "no")])
505 ;; This is used during early compilation to delay the decision on
506 ;; how to refer to a variable as long as possible. This is especially
507 ;; important between initial rtl generation and optimization for
508 ;; deferred functions, since we may acquire additional information
509 ;; on the variables used in the meantime.
511 ;; ??? This causes us to lose REG_LABEL notes, because the insn splitter
512 ;; does not attempt to preserve any REG_NOTES on the input instruction.
514 (define_insn_and_split "movdi_symbolic"
515 [(set (match_operand:DI 0 "register_operand" "=r")
516 (match_operand:DI 1 "symbolic_operand" "s"))
522 "ia64_expand_load_address (operands[0], operands[1]); DONE;")
524 (define_insn "*movdi_internal_astep"
525 [(set (match_operand:DI 0 "destination_operand"
526 "=r,r,r,r, m, r,*f,*f,*f, Q, r,*b, r,*e, r,*d, r,*c")
527 (match_operand:DI 1 "move_operand"
528 "rO,J,i,m,rO,*f,rO,*f, Q,*f,*b,rO,*e,rK,*d,rK,*c,rO"))]
529 "TARGET_A_STEP && ia64_move_ok (operands[0], operands[1])"
532 static const char * const alt[] = {
534 \"addl %0 = %1, r0\",
536 \"ld8%O1 %0 = %1%P1\",
537 \"st8%Q0 %0 = %r1%P0\",
538 \"getf.sig %0 = %1\",
539 \"setf.sig %0 = %r1\",
553 if (which_alternative == 2 && ! TARGET_NO_PIC
554 && symbolic_operand (operands[1], VOIDmode))
557 return alt[which_alternative];
559 [(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")
560 (set_attr "predicable" "no")])
562 (define_insn "*movdi_internal"
563 [(set (match_operand:DI 0 "destination_operand"
564 "=r,r,r,r, m, r,*f,*f,*f, Q, r,*b, r,*e, r,*d, r,*c")
565 (match_operand:DI 1 "move_operand"
566 "rO,J,i,m,rO,*f,rO,*f, Q,*f,*b,rO,*e,rK,*d,rK,*c,rO"))]
567 "! TARGET_A_STEP && ia64_move_ok (operands[0], operands[1])"
570 static const char * const alt[] = {
572 \"%,addl %0 = %1, r0\",
574 \"%,ld8%O1 %0 = %1%P1\",
575 \"%,st8%Q0 %0 = %r1%P0\",
576 \"%,getf.sig %0 = %1\",
577 \"%,setf.sig %0 = %r1\",
579 \"%,ldf8 %0 = %1%P1\",
580 \"%,stf8 %0 = %1%P0\",
591 if (which_alternative == 2 && ! TARGET_NO_PIC
592 && symbolic_operand (operands[1], VOIDmode))
595 return alt[which_alternative];
597 [(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")])
600 [(set (match_operand:DI 0 "register_operand" "")
601 (match_operand:DI 1 "symbolic_operand" ""))]
602 "reload_completed && ! TARGET_NO_PIC"
606 ia64_expand_load_address (operands[0], operands[1]);
610 (define_expand "load_fptr"
612 (plus:DI (reg:DI 1) (match_operand:DI 1 "function_operand" "")))
613 (set (match_operand:DI 0 "register_operand" "") (match_dup 3))]
617 operands[2] = no_new_pseudos ? operands[0] : gen_reg_rtx (DImode);
618 operands[3] = gen_rtx_MEM (DImode, operands[2]);
619 RTX_UNCHANGING_P (operands[3]) = 1;
622 (define_insn "*load_fptr_internal1"
623 [(set (match_operand:DI 0 "register_operand" "=r")
624 (plus:DI (reg:DI 1) (match_operand:DI 1 "function_operand" "s")))]
626 "addl %0 = @ltoff(@fptr(%1)), gp"
627 [(set_attr "itanium_class" "ialu")])
629 (define_insn "load_gprel"
630 [(set (match_operand:DI 0 "register_operand" "=r")
631 (plus:DI (reg:DI 1) (match_operand:DI 1 "sdata_symbolic_operand" "s")))]
633 "addl %0 = @gprel(%1), gp"
634 [(set_attr "itanium_class" "ialu")])
636 (define_insn "gprel64_offset"
637 [(set (match_operand:DI 0 "register_operand" "=r")
638 (minus:DI (match_operand:DI 1 "symbolic_operand" "") (reg:DI 1)))]
640 "movl %0 = @gprel(%1)"
641 [(set_attr "itanium_class" "long_i")])
643 (define_expand "load_gprel64"
645 (minus:DI (match_operand:DI 1 "symbolic_operand" "") (reg:DI 1)))
646 (set (match_operand:DI 0 "register_operand" "")
647 (plus:DI (reg:DI 1) (match_dup 2)))]
651 operands[2] = no_new_pseudos ? operands[0] : gen_reg_rtx (DImode);
654 (define_expand "load_symptr"
656 (plus:DI (reg:DI 1) (match_operand:DI 1 "got_symbolic_operand" "")))
657 (set (match_operand:DI 0 "register_operand" "") (match_dup 3))]
661 operands[2] = no_new_pseudos ? operands[0] : gen_reg_rtx (DImode);
662 operands[3] = gen_rtx_MEM (DImode, operands[2]);
663 RTX_UNCHANGING_P (operands[3]) = 1;
666 (define_insn "*load_symptr_internal1"
667 [(set (match_operand:DI 0 "register_operand" "=r")
668 (plus:DI (reg:DI 1) (match_operand:DI 1 "got_symbolic_operand" "s")))]
670 "addl %0 = @ltoff(%1), gp"
671 [(set_attr "itanium_class" "ialu")])
673 ;; With no offsettable memory references, we've got to have a scratch
674 ;; around to play with the second word.
675 (define_expand "movti"
676 [(parallel [(set (match_operand:TI 0 "general_operand" "")
677 (match_operand:TI 1 "general_operand" ""))
678 (clobber (match_scratch:DI 2 ""))])]
682 if (! reload_in_progress && ! reload_completed
683 && ! ia64_move_ok (operands[0], operands[1]))
684 operands[1] = force_reg (TImode, operands[1]);
687 (define_insn_and_split "*movti_internal"
688 [(set (match_operand:TI 0 "nonimmediate_operand" "=r,r,m")
689 (match_operand:TI 1 "general_operand" "ri,m,r"))
690 (clobber (match_scratch:DI 2 "=X,&r,&r"))]
691 "ia64_move_ok (operands[0], operands[1])"
697 rtx adj1, adj2, in[2], out[2];
700 adj1 = ia64_split_timode (in, operands[1], operands[2]);
701 adj2 = ia64_split_timode (out, operands[0], operands[2]);
704 if (reg_overlap_mentioned_p (out[0], in[1]))
706 if (reg_overlap_mentioned_p (out[1], in[0]))
717 emit_insn (gen_rtx_SET (VOIDmode, out[first], in[first]));
718 emit_insn (gen_rtx_SET (VOIDmode, out[!first], in[!first]));
721 [(set_attr "itanium_class" "unknown")
722 (set_attr "predicable" "no")])
724 ;; ??? SSA creates these. Can't allow memories since we don't have
725 ;; the scratch register. Fortunately combine will know how to add
726 ;; the clobber and scratch.
727 (define_insn_and_split "*movti_internal_reg"
728 [(set (match_operand:TI 0 "register_operand" "=r")
729 (match_operand:TI 1 "nonmemory_operand" "ri"))]
739 ia64_split_timode (in, operands[1], NULL_RTX);
740 ia64_split_timode (out, operands[0], NULL_RTX);
743 if (reg_overlap_mentioned_p (out[0], in[1]))
745 if (reg_overlap_mentioned_p (out[1], in[0]))
750 emit_insn (gen_rtx_SET (VOIDmode, out[first], in[first]));
751 emit_insn (gen_rtx_SET (VOIDmode, out[!first], in[!first]));
754 [(set_attr "itanium_class" "unknown")
755 (set_attr "predicable" "no")])
757 (define_expand "reload_inti"
758 [(parallel [(set (match_operand:TI 0 "register_operand" "=r")
759 (match_operand:TI 1 "" "m"))
760 (clobber (match_operand:TI 2 "register_operand" "=&r"))])]
764 unsigned int s_regno = REGNO (operands[2]);
765 if (s_regno == REGNO (operands[0]))
767 operands[2] = gen_rtx_REG (DImode, s_regno);
770 (define_expand "reload_outti"
771 [(parallel [(set (match_operand:TI 0 "" "=m")
772 (match_operand:TI 1 "register_operand" "r"))
773 (clobber (match_operand:TI 2 "register_operand" "=&r"))])]
777 unsigned int s_regno = REGNO (operands[2]);
778 if (s_regno == REGNO (operands[1]))
780 operands[2] = gen_rtx_REG (DImode, s_regno);
783 ;; Floating Point Moves
785 ;; Note - Patterns for SF mode moves are compulsory, but
786 ;; patterns for DF are optional, as GCC can synthesise them.
788 (define_expand "movsf"
789 [(set (match_operand:SF 0 "general_operand" "")
790 (match_operand:SF 1 "general_operand" ""))]
794 if (! reload_in_progress && ! reload_completed
795 && ! ia64_move_ok (operands[0], operands[1]))
796 operands[1] = force_reg (SFmode, operands[1]);
799 ;; Errata 72 workaround.
800 (define_insn "*movsfcc_astep"
802 (match_operator 2 "predicate_operator"
803 [(match_operand:BI 3 "register_operand" "c,c,c,c")
805 (set (match_operand:SF 0 "register_operand" "=f,*r, f,*r")
806 (match_operand:SF 1 "nonmemory_operand" "fG,fG,*r,*r")))]
807 "TARGET_A_STEP && ia64_move_ok (operands[0], operands[1])"
810 (%J2) getf.s %0 = %F1
813 [(set_attr "itanium_class" "fmisc,frfr,tofr,ialu")
814 (set_attr "predicable" "no")])
816 (define_insn "*movsf_internal_astep"
817 [(set (match_operand:SF 0 "destination_operand" "=f,f, Q,*r, f,*r,*r, m")
818 (match_operand:SF 1 "general_operand" "fG,Q,fG,fG,*r,*r, m,*r"))]
819 "TARGET_A_STEP && ia64_move_ok (operands[0], operands[1])"
829 [(set_attr "itanium_class" "fmisc,fld,stf,frfr,tofr,ialu,ld,st")
830 (set_attr "predicable" "no")])
832 (define_insn "*movsf_internal"
833 [(set (match_operand:SF 0 "destination_operand" "=f,f, Q,*r, f,*r,*r, m")
834 (match_operand:SF 1 "general_operand" "fG,Q,fG,fG,*r,*r, m,*r"))]
835 "! TARGET_A_STEP && ia64_move_ok (operands[0], operands[1])"
845 [(set_attr "itanium_class" "fmisc,fld,stf,frfr,tofr,ialu,ld,st")])
847 (define_expand "movdf"
848 [(set (match_operand:DF 0 "general_operand" "")
849 (match_operand:DF 1 "general_operand" ""))]
853 if (! reload_in_progress && ! reload_completed
854 && ! ia64_move_ok (operands[0], operands[1]))
855 operands[1] = force_reg (DFmode, operands[1]);
858 ;; Errata 72 workaround.
859 (define_insn "*movdfcc_astep"
861 (match_operator 2 "predicate_operator"
862 [(match_operand:BI 3 "register_operand" "c,c,c,c")
864 (set (match_operand:DF 0 "register_operand" "=f,*r, f,*r")
865 (match_operand:DF 1 "nonmemory_operand" "fG,fG,*r,*r")))]
866 "TARGET_A_STEP && ia64_move_ok (operands[0], operands[1])"
869 (%J2) getf.d %0 = %F1
872 [(set_attr "itanium_class" "fmisc,frfr,tofr,ialu")
873 (set_attr "predicable" "no")])
875 (define_insn "*movdf_internal_astep"
876 [(set (match_operand:DF 0 "destination_operand" "=f,f, Q,*r, f,*r,*r, m")
877 (match_operand:DF 1 "general_operand" "fG,Q,fG,fG,*r,*r, m,*r"))]
878 "TARGET_A_STEP && ia64_move_ok (operands[0], operands[1])"
888 [(set_attr "itanium_class" "fmisc,fld,stf,frfr,tofr,ialu,ld,st")
889 (set_attr "predicable" "no")])
891 (define_insn "*movdf_internal"
892 [(set (match_operand:DF 0 "destination_operand" "=f,f, Q,*r, f,*r,*r, m")
893 (match_operand:DF 1 "general_operand" "fG,Q,fG,fG,*r,*r, m,*r"))]
894 "! TARGET_A_STEP && ia64_move_ok (operands[0], operands[1])"
904 [(set_attr "itanium_class" "fmisc,fld,stf,frfr,tofr,ialu,ld,st")])
906 ;; With no offsettable memory references, we've got to have a scratch
907 ;; around to play with the second word if the variable winds up in GRs.
908 (define_expand "movtf"
909 [(set (match_operand:TF 0 "general_operand" "")
910 (match_operand:TF 1 "general_operand" ""))]
914 /* We must support TFmode loads into general registers for stdarg/vararg
915 and unprototyped calls. We split them into DImode loads for convenience.
916 We don't need TFmode stores from general regs, because a stdarg/vararg
917 routine does a block store to memory of unnamed arguments. */
918 if (GET_CODE (operands[0]) == REG
919 && GR_REGNO_P (REGNO (operands[0])))
921 /* We're hoping to transform everything that deals with TFmode
922 quantities and GR registers early in the compiler. */
926 /* Struct to register can just use TImode instead. */
927 if ((GET_CODE (operands[1]) == SUBREG
928 && GET_MODE (SUBREG_REG (operands[1])) == TImode)
929 || (GET_CODE (operands[1]) == REG
930 && GR_REGNO_P (REGNO (operands[1]))))
932 emit_move_insn (gen_rtx_REG (TImode, REGNO (operands[0])),
933 SUBREG_REG (operands[1]));
937 if (GET_CODE (operands[1]) == CONST_DOUBLE)
939 emit_move_insn (gen_rtx_REG (DImode, REGNO (operands[0])),
940 operand_subword (operands[1], 0, 0, DImode));
941 emit_move_insn (gen_rtx_REG (DImode, REGNO (operands[0]) + 1),
942 operand_subword (operands[1], 1, 0, DImode));
946 /* If the quantity is in a register not known to be GR, spill it. */
947 if (register_operand (operands[1], TFmode))
948 operands[1] = spill_tfmode_operand (operands[1], 1);
950 if (GET_CODE (operands[1]) == MEM)
954 out[WORDS_BIG_ENDIAN] = gen_rtx_REG (DImode, REGNO (operands[0]));
955 out[!WORDS_BIG_ENDIAN] = gen_rtx_REG (DImode, REGNO (operands[0])+1);
957 emit_move_insn (out[0], change_address (operands[1], DImode, NULL));
958 emit_move_insn (out[1],
959 change_address (operands[1], DImode,
960 plus_constant (XEXP (operands[1], 0),
968 if (! reload_in_progress && ! reload_completed)
970 operands[0] = spill_tfmode_operand (operands[0], 0);
971 operands[1] = spill_tfmode_operand (operands[1], 0);
973 if (! ia64_move_ok (operands[0], operands[1]))
974 operands[1] = force_reg (TFmode, operands[1]);
978 ;; ??? There's no easy way to mind volatile acquire/release semantics.
980 ;; Errata 72 workaround.
981 (define_insn "*movtfcc_astep"
983 (match_operator 2 "predicate_operator"
984 [(match_operand:BI 3 "register_operand" "c")
986 (set (match_operand:TF 0 "register_operand" "=f")
987 (match_operand:TF 1 "nonmemory_operand" "fG")))]
988 "TARGET_A_STEP && ia64_move_ok (operands[0], operands[1])"
990 [(set_attr "itanium_class" "fmisc")
991 (set_attr "predicable" "no")])
993 (define_insn "*movtf_internal_astep"
994 [(set (match_operand:TF 0 "destination_tfmode_operand" "=f,f, m")
995 (match_operand:TF 1 "general_tfmode_operand" "fG,m,fG"))]
996 "TARGET_A_STEP && ia64_move_ok (operands[0], operands[1])"
1001 [(set_attr "itanium_class" "fmisc,fld,stf")
1002 (set_attr "predicable" "no")])
1004 (define_insn "*movtf_internal"
1005 [(set (match_operand:TF 0 "destination_tfmode_operand" "=f,f, m")
1006 (match_operand:TF 1 "general_tfmode_operand" "fG,m,fG"))]
1007 "! TARGET_A_STEP && ia64_move_ok (operands[0], operands[1])"
1012 [(set_attr "itanium_class" "fmisc,fld,stf")])
1014 ;; ::::::::::::::::::::
1018 ;; ::::::::::::::::::::
1020 ;; Signed conversions from a smaller integer to a larger integer
1022 (define_insn "extendqidi2"
1023 [(set (match_operand:DI 0 "gr_register_operand" "=r")
1024 (sign_extend:DI (match_operand:QI 1 "gr_register_operand" "r")))]
1027 [(set_attr "itanium_class" "xtd")])
1029 (define_insn "extendhidi2"
1030 [(set (match_operand:DI 0 "gr_register_operand" "=r")
1031 (sign_extend:DI (match_operand:HI 1 "gr_register_operand" "r")))]
1034 [(set_attr "itanium_class" "xtd")])
1036 (define_insn "extendsidi2"
1037 [(set (match_operand:DI 0 "grfr_register_operand" "=r,?f")
1038 (sign_extend:DI (match_operand:SI 1 "grfr_register_operand" "r,f")))]
1042 fsxt.r %0 = %1, %1%B0"
1043 [(set_attr "itanium_class" "xtd,fmisc")])
1045 ;; Unsigned conversions from a smaller integer to a larger integer
1047 (define_insn "zero_extendqidi2"
1048 [(set (match_operand:DI 0 "gr_register_operand" "=r,r")
1049 (zero_extend:DI (match_operand:QI 1 "gr_nonimmediate_operand" "r,m")))]
1054 [(set_attr "itanium_class" "xtd,ld")])
1056 (define_insn "zero_extendhidi2"
1057 [(set (match_operand:DI 0 "gr_register_operand" "=r,r")
1058 (zero_extend:DI (match_operand:HI 1 "gr_nonimmediate_operand" "r,m")))]
1063 [(set_attr "itanium_class" "xtd,ld")])
1065 (define_insn "zero_extendsidi2"
1066 [(set (match_operand:DI 0 "grfr_register_operand" "=r,r,?f")
1068 (match_operand:SI 1 "grfr_nonimmediate_operand" "r,m,f")))]
1073 fmix.r %0 = f0, %1%B0"
1074 [(set_attr "itanium_class" "xtd,ld,fmisc")])
1076 ;; Convert between floating point types of different sizes.
1078 ;; ??? Optimization opportunity here. Get rid of the insn altogether
1079 ;; when we can. Should probably use a scheme like has been proposed
1080 ;; for ia32 in dealing with operands that match unary operators. This
1081 ;; would let combine merge the thing into adjacent insns.
1083 (define_insn_and_split "extendsfdf2"
1084 [(set (match_operand:DF 0 "grfr_nonimmediate_operand" "=f,f,f,f,m,*r")
1086 (match_operand:SF 1 "grfr_nonimmediate_operand" "0,f,m,*r,f,f")))]
1096 [(set (match_dup 0) (float_extend:DF (match_dup 1)))]
1099 if (true_regnum (operands[0]) == true_regnum (operands[1]))
1101 emit_insn (gen_movdi (pic_offset_table_rtx, pic_offset_table_rtx));
1105 [(set_attr "itanium_class" "unknown,fmisc,fld,tofr,stf,frfr")])
1107 (define_insn_and_split "extendsftf2"
1108 [(set (match_operand:TF 0 "fr_nonimmediate_operand" "=f,f,f,f,Q")
1110 (match_operand:SF 1 "grfr_nonimmediate_operand" "0,f,Q,*r,f")))]
1119 [(set (match_dup 0) (float_extend:TF (match_dup 1)))]
1122 if (true_regnum (operands[0]) == true_regnum (operands[1]))
1124 emit_insn (gen_movdi (pic_offset_table_rtx, pic_offset_table_rtx));
1128 [(set_attr "itanium_class" "unknown,fmisc,fld,frfr,stf")])
1130 (define_insn_and_split "extenddftf2"
1131 [(set (match_operand:TF 0 "fr_nonimmediate_operand" "=f,f,f,f,Q")
1133 (match_operand:DF 1 "grfr_nonimmediate_operand" "0,f,Q,*r,f")))]
1142 [(set (match_dup 0) (float_extend:TF (match_dup 1)))]
1145 if (true_regnum (operands[0]) == true_regnum (operands[1]))
1147 emit_insn (gen_movdi (pic_offset_table_rtx, pic_offset_table_rtx));
1151 [(set_attr "itanium_class" "unknown,fmisc,fld,frfr,stf")])
1153 (define_insn "truncdfsf2"
1154 [(set (match_operand:SF 0 "fr_register_operand" "=f")
1155 (float_truncate:SF (match_operand:DF 1 "fr_register_operand" "f")))]
1157 "fnorm.s %0 = %1%B0"
1158 [(set_attr "itanium_class" "fmac")])
1160 (define_insn "trunctfsf2"
1161 [(set (match_operand:SF 0 "fr_register_operand" "=f")
1162 (float_truncate:SF (match_operand:TF 1 "fr_register_operand" "f")))]
1164 "fnorm.s %0 = %1%B0"
1165 [(set_attr "itanium_class" "fmac")])
1167 (define_insn "trunctfdf2"
1168 [(set (match_operand:DF 0 "fr_register_operand" "=f")
1169 (float_truncate:DF (match_operand:TF 1 "fr_register_operand" "f")))]
1171 "fnorm.d %0 = %1%B0"
1172 [(set_attr "itanium_class" "fmac")])
1174 ;; Convert between signed integer types and floating point.
1176 (define_insn "floatditf2"
1177 [(set (match_operand:TF 0 "fr_register_operand" "=f")
1178 (float:TF (match_operand:DI 1 "fr_register_operand" "f")))]
1181 [(set_attr "itanium_class" "fcvtfx")])
1183 (define_insn "fix_truncsfdi2"
1184 [(set (match_operand:DI 0 "fr_register_operand" "=f")
1185 (fix:DI (match_operand:SF 1 "fr_register_operand" "f")))]
1187 "fcvt.fx.trunc %0 = %1%B0"
1188 [(set_attr "itanium_class" "fcvtfx")])
1190 (define_insn "fix_truncdfdi2"
1191 [(set (match_operand:DI 0 "fr_register_operand" "=f")
1192 (fix:DI (match_operand:DF 1 "fr_register_operand" "f")))]
1194 "fcvt.fx.trunc %0 = %1%B0"
1195 [(set_attr "itanium_class" "fcvtfx")])
1197 (define_insn "fix_trunctfdi2"
1198 [(set (match_operand:DI 0 "fr_register_operand" "=f")
1199 (fix:DI (match_operand:TF 1 "fr_register_operand" "f")))]
1201 "fcvt.fx.trunc %0 = %1%B0"
1202 [(set_attr "itanium_class" "fcvtfx")])
1204 (define_insn "fix_trunctfdi2_alts"
1205 [(set (match_operand:DI 0 "fr_register_operand" "=f")
1206 (fix:DI (match_operand:TF 1 "fr_register_operand" "f")))
1207 (use (match_operand:SI 2 "const_int_operand" ""))]
1209 "fcvt.fx.trunc.s%2 %0 = %1%B0"
1210 [(set_attr "itanium_class" "fcvtfx")])
1212 ;; Convert between unsigned integer types and floating point.
1214 (define_insn "floatunsdisf2"
1215 [(set (match_operand:SF 0 "fr_register_operand" "=f")
1216 (unsigned_float:SF (match_operand:DI 1 "fr_register_operand" "f")))]
1218 "fcvt.xuf.s %0 = %1%B0"
1219 [(set_attr "itanium_class" "fcvtfx")])
1221 (define_insn "floatunsdidf2"
1222 [(set (match_operand:DF 0 "fr_register_operand" "=f")
1223 (unsigned_float:DF (match_operand:DI 1 "fr_register_operand" "f")))]
1225 "fcvt.xuf.d %0 = %1%B0"
1226 [(set_attr "itanium_class" "fcvtfx")])
1228 (define_insn "floatunsditf2"
1229 [(set (match_operand:TF 0 "fr_register_operand" "=f")
1230 (unsigned_float:TF (match_operand:DI 1 "fr_register_operand" "f")))]
1232 "fcvt.xuf %0 = %1%B0"
1233 [(set_attr "itanium_class" "fcvtfx")])
1235 (define_insn "fixuns_truncsfdi2"
1236 [(set (match_operand:DI 0 "fr_register_operand" "=f")
1237 (unsigned_fix:DI (match_operand:SF 1 "fr_register_operand" "f")))]
1239 "fcvt.fxu.trunc %0 = %1%B0"
1240 [(set_attr "itanium_class" "fcvtfx")])
1242 (define_insn "fixuns_truncdfdi2"
1243 [(set (match_operand:DI 0 "fr_register_operand" "=f")
1244 (unsigned_fix:DI (match_operand:DF 1 "fr_register_operand" "f")))]
1246 "fcvt.fxu.trunc %0 = %1%B0"
1247 [(set_attr "itanium_class" "fcvtfx")])
1249 (define_insn "fixuns_trunctfdi2"
1250 [(set (match_operand:DI 0 "fr_register_operand" "=f")
1251 (unsigned_fix:DI (match_operand:TF 1 "fr_register_operand" "f")))]
1253 "fcvt.fxu.trunc %0 = %1%B0"
1254 [(set_attr "itanium_class" "fcvtfx")])
1256 (define_insn "fixuns_trunctfdi2_alts"
1257 [(set (match_operand:DI 0 "fr_register_operand" "=f")
1258 (unsigned_fix:DI (match_operand:TF 1 "fr_register_operand" "f")))
1259 (use (match_operand:SI 2 "const_int_operand" ""))]
1261 "fcvt.fxu.trunc.s%2 %0 = %1%B0"
1262 [(set_attr "itanium_class" "fcvtfx")])
1264 ;; ::::::::::::::::::::
1266 ;; :: Bit field extraction
1268 ;; ::::::::::::::::::::
1271 [(set (match_operand:DI 0 "gr_register_operand" "=r")
1272 (sign_extract:DI (match_operand:DI 1 "gr_register_operand" "r")
1273 (match_operand:DI 2 "const_int_operand" "n")
1274 (match_operand:DI 3 "const_int_operand" "n")))]
1276 "extr %0 = %1, %3, %2"
1277 [(set_attr "itanium_class" "ishf")])
1279 (define_insn "extzv"
1280 [(set (match_operand:DI 0 "gr_register_operand" "=r")
1281 (zero_extract:DI (match_operand:DI 1 "gr_register_operand" "r")
1282 (match_operand:DI 2 "const_int_operand" "n")
1283 (match_operand:DI 3 "const_int_operand" "n")))]
1285 "extr.u %0 = %1, %3, %2"
1286 [(set_attr "itanium_class" "ishf")])
1288 ;; Insert a bit field.
1289 ;; Can have 3 operands, source1 (inserter), source2 (insertee), dest.
1290 ;; Source1 can be 0 or -1.
1291 ;; Source2 can be 0.
1293 ;; ??? Actual dep instruction is more powerful than what these insv
1294 ;; patterns support. Unfortunately, combine is unable to create patterns
1295 ;; where source2 != dest.
1297 (define_expand "insv"
1298 [(set (zero_extract:DI (match_operand:DI 0 "gr_register_operand" "")
1299 (match_operand:DI 1 "const_int_operand" "")
1300 (match_operand:DI 2 "const_int_operand" ""))
1301 (match_operand:DI 3 "nonmemory_operand" ""))]
1305 int width = INTVAL (operands[1]);
1306 int shift = INTVAL (operands[2]);
1308 /* If operand[3] is a constant, and isn't 0 or -1, then load it into a
1310 if (! register_operand (operands[3], DImode)
1311 && operands[3] != const0_rtx && operands[3] != constm1_rtx)
1312 operands[3] = force_reg (DImode, operands[3]);
1314 /* If this is a single dep instruction, we have nothing to do. */
1315 if (! ((register_operand (operands[3], DImode) && width <= 16)
1316 || operands[3] == const0_rtx || operands[3] == constm1_rtx))
1318 /* Check for cases that can be implemented with a mix instruction. */
1319 if (width == 32 && shift == 0)
1321 /* Directly generating the mix4left instruction confuses
1322 optimize_bit_field in function.c. Since this is performing
1323 a useful optimization, we defer generation of the complicated
1324 mix4left RTL to the first splitting phase. */
1325 rtx tmp = gen_reg_rtx (DImode);
1326 emit_insn (gen_shift_mix4left (operands[0], operands[3], tmp));
1329 else if (width == 32 && shift == 32)
1331 emit_insn (gen_mix4right (operands[0], operands[3]));
1335 /* We could handle remaining cases by emitting multiple dep
1338 If we need more than two dep instructions then we lose. A 6
1339 insn sequence mov mask1,mov mask2,shl;;and,and;;or is better than
1340 mov;;dep,shr;;dep,shr;;dep. The former can be executed in 3 cycles,
1341 the latter is 6 cycles on an Itanium (TM) processor, because there is
1342 only one function unit that can execute dep and shr immed.
1344 If we only need two dep instruction, then we still lose.
1345 mov;;dep,shr;;dep is still 4 cycles. Even if we optimize away
1346 the unnecessary mov, this is still undesirable because it will be
1347 hard to optimize, and it creates unnecessary pressure on the I0
1353 /* This code may be useful for other IA-64 processors, so we leave it in
1359 emit_insn (gen_insv (operands[0], GEN_INT (16), GEN_INT (shift),
1363 tmp = gen_reg_rtx (DImode);
1364 emit_insn (gen_lshrdi3 (tmp, operands[3], GEN_INT (16)));
1367 operands[1] = GEN_INT (width);
1368 operands[2] = GEN_INT (shift);
1373 (define_insn "*insv_internal"
1374 [(set (zero_extract:DI (match_operand:DI 0 "gr_register_operand" "+r")
1375 (match_operand:DI 1 "const_int_operand" "n")
1376 (match_operand:DI 2 "const_int_operand" "n"))
1377 (match_operand:DI 3 "nonmemory_operand" "rP"))]
1378 "(gr_register_operand (operands[3], DImode) && INTVAL (operands[1]) <= 16)
1379 || operands[3] == const0_rtx || operands[3] == constm1_rtx"
1380 "dep %0 = %3, %0, %2, %1"
1381 [(set_attr "itanium_class" "ishf")])
1383 ;; Combine doesn't like to create bitfield insertions into zero.
1384 (define_insn "*depz_internal"
1385 [(set (match_operand:DI 0 "gr_register_operand" "=r")
1386 (and:DI (ashift:DI (match_operand:DI 1 "gr_register_operand" "r")
1387 (match_operand:DI 2 "const_int_operand" "n"))
1388 (match_operand:DI 3 "const_int_operand" "n")))]
1389 "CONST_OK_FOR_M (INTVAL (operands[2]))
1390 && ia64_depz_field_mask (operands[3], operands[2]) > 0"
1393 operands[3] = GEN_INT (ia64_depz_field_mask (operands[3], operands[2]));
1394 return \"%,dep.z %0 = %1, %2, %3\";
1396 [(set_attr "itanium_class" "ishf")])
1398 (define_insn "shift_mix4left"
1399 [(set (zero_extract:DI (match_operand:DI 0 "gr_register_operand" "+r")
1400 (const_int 32) (const_int 0))
1401 (match_operand:DI 1 "gr_register_operand" "r"))
1402 (clobber (match_operand:DI 2 "gr_register_operand" "=r"))]
1405 [(set_attr "itanium_class" "unknown")])
1408 [(set (zero_extract:DI (match_operand:DI 0 "register_operand" "")
1409 (const_int 32) (const_int 0))
1410 (match_operand:DI 1 "register_operand" ""))
1411 (clobber (match_operand:DI 2 "register_operand" ""))]
1413 [(set (match_dup 3) (ashift:DI (match_dup 1) (const_int 32)))
1414 (unspec_volatile [(const_int 0)] 2)
1415 (set (zero_extract:DI (match_dup 0) (const_int 32) (const_int 0))
1416 (lshiftrt:DI (match_dup 3) (const_int 32)))]
1417 "operands[3] = operands[2];")
1420 [(set (zero_extract:DI (match_operand:DI 0 "register_operand" "")
1421 (const_int 32) (const_int 0))
1422 (match_operand:DI 1 "register_operand" ""))
1423 (clobber (match_operand:DI 2 "register_operand" ""))]
1424 "! reload_completed"
1425 [(set (match_dup 3) (ashift:DI (match_dup 1) (const_int 32)))
1426 (set (zero_extract:DI (match_dup 0) (const_int 32) (const_int 0))
1427 (lshiftrt:DI (match_dup 3) (const_int 32)))]
1428 "operands[3] = operands[2];")
1430 (define_insn "*mix4left"
1431 [(set (zero_extract:DI (match_operand:DI 0 "gr_register_operand" "+r")
1432 (const_int 32) (const_int 0))
1433 (lshiftrt:DI (match_operand:DI 1 "gr_register_operand" "r")
1436 "mix4.l %0 = %0, %r1"
1437 [(set_attr "itanium_class" "mmshf")])
1439 (define_insn "mix4right"
1440 [(set (zero_extract:DI (match_operand:DI 0 "gr_register_operand" "+r")
1441 (const_int 32) (const_int 32))
1442 (match_operand:DI 1 "gr_reg_or_0_operand" "rO"))]
1444 "mix4.r %0 = %r1, %0"
1445 [(set_attr "itanium_class" "mmshf")])
1447 ;; This is used by the rotrsi3 pattern.
1449 (define_insn "*mix4right_3op"
1450 [(set (match_operand:DI 0 "gr_register_operand" "=r")
1451 (ior:DI (zero_extend:DI (match_operand:SI 1 "gr_register_operand" "r"))
1452 (ashift:DI (zero_extend:DI
1453 (match_operand:SI 2 "gr_register_operand" "r"))
1456 "mix4.r %0 = %2, %1"
1457 [(set_attr "itanium_class" "mmshf")])
1460 ;; ::::::::::::::::::::
1462 ;; :: 1 bit Integer arithmetic
1464 ;; ::::::::::::::::::::
1466 (define_insn_and_split "andbi3"
1467 [(set (match_operand:BI 0 "register_operand" "=c,c,r")
1468 (and:BI (match_operand:BI 1 "register_operand" "%0,0,r")
1469 (match_operand:BI 2 "register_operand" "c,r,r")))]
1473 tbit.nz.and.orcm %0, %I0 = %2, 0
1476 && GET_CODE (operands[0]) == REG && PR_REGNO_P (REGNO (operands[0]))
1477 && GET_CODE (operands[2]) == REG && PR_REGNO_P (REGNO (operands[2]))"
1478 [(cond_exec (eq (match_dup 2) (const_int 0))
1479 (set (match_dup 0) (and:BI (ne:BI (const_int 0) (const_int 0))
1482 [(set_attr "itanium_class" "unknown,tbit,ilog")])
1484 (define_insn_and_split "*andcmbi3"
1485 [(set (match_operand:BI 0 "register_operand" "=c,c,r")
1486 (and:BI (not:BI (match_operand:BI 1 "register_operand" "c,r,r"))
1487 (match_operand:BI 2 "register_operand" "0,0,r")))]
1491 tbit.z.and.orcm %0, %I0 = %2, 0
1494 && GET_CODE (operands[0]) == REG && PR_REGNO_P (REGNO (operands[0]))
1495 && GET_CODE (operands[2]) == REG && PR_REGNO_P (REGNO (operands[2]))"
1496 [(cond_exec (ne (match_dup 1) (const_int 0))
1497 (set (match_dup 0) (and:BI (ne:BI (const_int 0) (const_int 0))
1500 [(set_attr "itanium_class" "unknown,tbit,ilog")])
1502 (define_insn_and_split "iorbi3"
1503 [(set (match_operand:BI 0 "register_operand" "=c,c,r")
1504 (ior:BI (match_operand:BI 1 "register_operand" "%0,0,r")
1505 (match_operand:BI 2 "register_operand" "c,r,r")))]
1509 tbit.nz.or.andcm %0, %I0 = %2, 0
1512 && GET_CODE (operands[0]) == REG && PR_REGNO_P (REGNO (operands[0]))
1513 && GET_CODE (operands[2]) == REG && PR_REGNO_P (REGNO (operands[2]))"
1514 [(cond_exec (ne (match_dup 2) (const_int 0))
1515 (set (match_dup 0) (ior:BI (eq:BI (const_int 0) (const_int 0))
1518 [(set_attr "itanium_class" "unknown,tbit,ilog")])
1520 (define_insn_and_split "*iorcmbi3"
1521 [(set (match_operand:BI 0 "register_operand" "=c,c")
1522 (ior:BI (not:BI (match_operand:BI 1 "register_operand" "c,r"))
1523 (match_operand:BI 2 "register_operand" "0,0")))]
1527 tbit.z.or.andcm %0, %I0 = %2, 0"
1529 && GET_CODE (operands[0]) == REG && PR_REGNO_P (REGNO (operands[0]))
1530 && GET_CODE (operands[2]) == REG && PR_REGNO_P (REGNO (operands[2]))"
1531 [(cond_exec (eq (match_dup 1) (const_int 0))
1532 (set (match_dup 0) (ior:BI (eq:BI (const_int 0) (const_int 0))
1535 [(set_attr "itanium_class" "unknown,tbit")])
1537 (define_insn "one_cmplbi2"
1538 [(set (match_operand:BI 0 "register_operand" "=c,r,c,&c")
1539 (not:BI (match_operand:BI 1 "register_operand" "r,r,0,c")))
1540 (clobber (match_scratch:BI 2 "=X,X,c,X"))]
1543 tbit.z %0, %I0 = %1, 0
1547 [(set_attr "itanium_class" "tbit,ilog,unknown,unknown")])
1550 [(set (match_operand:BI 0 "register_operand" "")
1551 (not:BI (match_operand:BI 1 "register_operand" "")))
1552 (clobber (match_scratch:BI 2 ""))]
1554 && GET_CODE (operands[0]) == REG && PR_REGNO_P (REGNO (operands[0]))
1555 && GET_CODE (operands[1]) == REG && PR_REGNO_P (REGNO (operands[1]))
1556 && rtx_equal_p (operands[0], operands[1])"
1557 [(set (match_dup 4) (match_dup 3))
1558 (set (match_dup 0) (const_int 1))
1559 (cond_exec (ne (match_dup 2) (const_int 0))
1560 (set (match_dup 0) (const_int 0)))
1561 (set (match_dup 0) (unspec:BI [(match_dup 0)] 7))]
1562 "operands[3] = gen_rtx_REG (CCImode, REGNO (operands[1]));
1563 operands[4] = gen_rtx_REG (CCImode, REGNO (operands[2]));")
1566 [(set (match_operand:BI 0 "register_operand" "")
1567 (not:BI (match_operand:BI 1 "register_operand" "")))
1568 (clobber (match_scratch:BI 2 ""))]
1570 && GET_CODE (operands[0]) == REG && PR_REGNO_P (REGNO (operands[0]))
1571 && GET_CODE (operands[1]) == REG && PR_REGNO_P (REGNO (operands[1]))
1572 && ! rtx_equal_p (operands[0], operands[1])"
1573 [(cond_exec (ne (match_dup 1) (const_int 0))
1574 (set (match_dup 0) (const_int 0)))
1575 (cond_exec (eq (match_dup 1) (const_int 0))
1576 (set (match_dup 0) (const_int 1)))
1577 (set (match_dup 0) (unspec:BI [(match_dup 0)] 7))]
1580 (define_insn "*cmpsi_and_0"
1581 [(set (match_operand:BI 0 "register_operand" "=c")
1582 (and:BI (match_operator:BI 4 "predicate_operator"
1583 [(match_operand:SI 2 "gr_reg_or_0_operand" "rO")
1584 (match_operand:SI 3 "gr_reg_or_8bit_operand" "rK")])
1585 (match_operand:BI 1 "register_operand" "0")))]
1587 "cmp4.%C4.and.orcm %0, %I0 = %3, %r2"
1588 [(set_attr "itanium_class" "icmp")])
1590 (define_insn "*cmpsi_and_1"
1591 [(set (match_operand:BI 0 "register_operand" "=c")
1592 (and:BI (match_operator:BI 3 "signed_inequality_operator"
1593 [(match_operand:SI 2 "gr_register_operand" "r")
1595 (match_operand:BI 1 "register_operand" "0")))]
1597 "cmp4.%C3.and.orcm %0, %I0 = r0, %2"
1598 [(set_attr "itanium_class" "icmp")])
1600 (define_insn "*cmpsi_andnot_0"
1601 [(set (match_operand:BI 0 "register_operand" "=c")
1602 (and:BI (not:BI (match_operator:BI 4 "predicate_operator"
1603 [(match_operand:SI 2 "gr_reg_or_0_operand" "rO")
1604 (match_operand:SI 3 "gr_reg_or_8bit_operand" "rK")]))
1605 (match_operand:BI 1 "register_operand" "0")))]
1607 "cmp4.%C4.or.andcm %I0, %0 = %3, %r2"
1608 [(set_attr "itanium_class" "icmp")])
1610 (define_insn "*cmpsi_andnot_1"
1611 [(set (match_operand:BI 0 "register_operand" "=c")
1612 (and:BI (not:BI (match_operator:BI 3 "signed_inequality_operator"
1613 [(match_operand:SI 2 "gr_register_operand" "r")
1615 (match_operand:BI 1 "register_operand" "0")))]
1617 "cmp4.%C3.or.andcm %I0, %0 = r0, %2"
1618 [(set_attr "itanium_class" "icmp")])
1620 (define_insn "*cmpdi_and_0"
1621 [(set (match_operand:BI 0 "register_operand" "=c")
1622 (and:BI (match_operator:BI 4 "predicate_operator"
1623 [(match_operand:DI 2 "gr_register_operand" "r")
1624 (match_operand:DI 3 "gr_reg_or_8bit_operand" "rK")])
1625 (match_operand:BI 1 "register_operand" "0")))]
1627 "cmp.%C4.and.orcm %0, %I0 = %3, %2"
1628 [(set_attr "itanium_class" "icmp")])
1630 (define_insn "*cmpdi_and_1"
1631 [(set (match_operand:BI 0 "register_operand" "=c")
1632 (and:BI (match_operator:BI 3 "signed_inequality_operator"
1633 [(match_operand:DI 2 "gr_register_operand" "r")
1635 (match_operand:BI 1 "register_operand" "0")))]
1637 "cmp.%C3.and.orcm %0, %I0 = r0, %2"
1638 [(set_attr "itanium_class" "icmp")])
1640 (define_insn "*cmpdi_andnot_0"
1641 [(set (match_operand:BI 0 "register_operand" "=c")
1642 (and:BI (not:BI (match_operator:BI 4 "predicate_operator"
1643 [(match_operand:DI 2 "gr_register_operand" "r")
1644 (match_operand:DI 3 "gr_reg_or_8bit_operand" "rK")]))
1645 (match_operand:BI 1 "register_operand" "0")))]
1647 "cmp.%C4.or.andcm %I0, %0 = %3, %2"
1648 [(set_attr "itanium_class" "icmp")])
1650 (define_insn "*cmpdi_andnot_1"
1651 [(set (match_operand:BI 0 "register_operand" "=c")
1652 (and:BI (not:BI (match_operator:BI 3 "signed_inequality_operator"
1653 [(match_operand:DI 2 "gr_register_operand" "r")
1655 (match_operand:BI 1 "register_operand" "0")))]
1657 "cmp.%C3.or.andcm %I0, %0 = r0, %2"
1658 [(set_attr "itanium_class" "icmp")])
1660 (define_insn "*tbit_and_0"
1661 [(set (match_operand:BI 0 "register_operand" "=c")
1662 (and:BI (ne:BI (and:DI (match_operand:DI 1 "gr_register_operand" "r")
1665 (match_operand:BI 3 "register_operand" "0")))]
1667 "tbit.nz.and.orcm %0, %I0 = %1, 0"
1668 [(set_attr "itanium_class" "tbit")])
1670 (define_insn "*tbit_and_1"
1671 [(set (match_operand:BI 0 "register_operand" "=c")
1672 (and:BI (eq:BI (and:DI (match_operand:DI 1 "gr_register_operand" "r")
1675 (match_operand:BI 3 "register_operand" "0")))]
1677 "tbit.z.and.orcm %0, %I0 = %1, 0"
1678 [(set_attr "itanium_class" "tbit")])
1680 (define_insn "*tbit_and_2"
1681 [(set (match_operand:BI 0 "register_operand" "=c")
1682 (and:BI (ne:BI (zero_extract:DI
1683 (match_operand:DI 1 "gr_register_operand" "r")
1685 (match_operand:DI 2 "const_int_operand" "n"))
1687 (match_operand:BI 3 "register_operand" "0")))]
1689 "tbit.nz.and.orcm %0, %I0 = %1, %2"
1690 [(set_attr "itanium_class" "tbit")])
1692 (define_insn "*tbit_and_3"
1693 [(set (match_operand:BI 0 "register_operand" "=c")
1694 (and:BI (eq:BI (zero_extract:DI
1695 (match_operand:DI 1 "gr_register_operand" "r")
1697 (match_operand:DI 2 "const_int_operand" "n"))
1699 (match_operand:BI 3 "register_operand" "0")))]
1701 "tbit.z.and.orcm %0, %I0 = %1, %2"
1702 [(set_attr "itanium_class" "tbit")])
1704 (define_insn "*cmpsi_or_0"
1705 [(set (match_operand:BI 0 "register_operand" "=c")
1706 (ior:BI (match_operator:BI 4 "predicate_operator"
1707 [(match_operand:SI 2 "gr_reg_or_0_operand" "rO")
1708 (match_operand:SI 3 "gr_reg_or_8bit_operand" "rK")])
1709 (match_operand:BI 1 "register_operand" "0")))]
1711 "cmp4.%C4.or.andcm %0, %I0 = %3, %r2"
1712 [(set_attr "itanium_class" "icmp")])
1714 (define_insn "*cmpsi_or_1"
1715 [(set (match_operand:BI 0 "register_operand" "=c")
1716 (ior:BI (match_operator:BI 3 "signed_inequality_operator"
1717 [(match_operand:SI 2 "gr_register_operand" "r")
1719 (match_operand:BI 1 "register_operand" "0")))]
1721 "cmp4.%C3.or.andcm %0, %I0 = r0, %2"
1722 [(set_attr "itanium_class" "icmp")])
1724 (define_insn "*cmpsi_orcm_0"
1725 [(set (match_operand:BI 0 "register_operand" "=c")
1726 (ior:BI (not:BI (match_operator:BI 4 "predicate_operator"
1727 [(match_operand:SI 2 "gr_reg_or_0_operand" "rO")
1728 (match_operand:SI 3 "gr_reg_or_8bit_operand" "rK")]))
1729 (match_operand:BI 1 "register_operand" "0")))]
1731 "cmp4.%C4.and.orcm %I0, %0 = %3, %r2"
1732 [(set_attr "itanium_class" "icmp")])
1734 (define_insn "*cmpsi_orcm_1"
1735 [(set (match_operand:BI 0 "register_operand" "=c")
1736 (ior:BI (not:BI (match_operator:BI 3 "signed_inequality_operator"
1737 [(match_operand:SI 2 "gr_register_operand" "r")
1739 (match_operand:BI 1 "register_operand" "0")))]
1741 "cmp4.%C3.and.orcm %I0, %0 = r0, %2"
1742 [(set_attr "itanium_class" "icmp")])
1744 (define_insn "*cmpdi_or_0"
1745 [(set (match_operand:BI 0 "register_operand" "=c")
1746 (ior:BI (match_operator:BI 4 "predicate_operator"
1747 [(match_operand:DI 2 "gr_register_operand" "r")
1748 (match_operand:DI 3 "gr_reg_or_8bit_operand" "rK")])
1749 (match_operand:BI 1 "register_operand" "0")))]
1751 "cmp.%C4.or.andcm %0, %I0 = %3, %2"
1752 [(set_attr "itanium_class" "icmp")])
1754 (define_insn "*cmpdi_or_1"
1755 [(set (match_operand:BI 0 "register_operand" "=c")
1756 (ior:BI (match_operator:BI 3 "signed_inequality_operator"
1757 [(match_operand:DI 2 "gr_register_operand" "r")
1759 (match_operand:BI 1 "register_operand" "0")))]
1761 "cmp.%C3.or.andcm %0, %I0 = r0, %2"
1762 [(set_attr "itanium_class" "icmp")])
1764 (define_insn "*cmpdi_orcm_0"
1765 [(set (match_operand:BI 0 "register_operand" "=c")
1766 (ior:BI (not:BI (match_operator:BI 4 "predicate_operator"
1767 [(match_operand:DI 2 "gr_register_operand" "r")
1768 (match_operand:DI 3 "gr_reg_or_8bit_operand" "rK")]))
1769 (match_operand:BI 1 "register_operand" "0")))]
1771 "cmp.%C4.and.orcm %I0, %0 = %3, %2"
1772 [(set_attr "itanium_class" "icmp")])
1774 (define_insn "*cmpdi_orcm_1"
1775 [(set (match_operand:BI 0 "register_operand" "=c")
1776 (ior:BI (not:BI (match_operator:BI 3 "signed_inequality_operator"
1777 [(match_operand:DI 2 "gr_register_operand" "r")
1779 (match_operand:BI 1 "register_operand" "0")))]
1781 "cmp.%C3.and.orcm %I0, %0 = r0, %2"
1782 [(set_attr "itanium_class" "icmp")])
1784 (define_insn "*tbit_or_0"
1785 [(set (match_operand:BI 0 "register_operand" "=c")
1786 (ior:BI (ne:BI (and:DI (match_operand:DI 1 "gr_register_operand" "r")
1789 (match_operand:BI 3 "register_operand" "0")))]
1791 "tbit.nz.or.andcm %0, %I0 = %1, 0"
1792 [(set_attr "itanium_class" "tbit")])
1794 (define_insn "*tbit_or_1"
1795 [(set (match_operand:BI 0 "register_operand" "=c")
1796 (ior:BI (eq:BI (and:DI (match_operand:DI 1 "gr_register_operand" "r")
1799 (match_operand:BI 3 "register_operand" "0")))]
1801 "tbit.z.or.andcm %0, %I0 = %1, 0"
1802 [(set_attr "itanium_class" "tbit")])
1804 (define_insn "*tbit_or_2"
1805 [(set (match_operand:BI 0 "register_operand" "=c")
1806 (ior:BI (ne:BI (zero_extract:DI
1807 (match_operand:DI 1 "gr_register_operand" "r")
1809 (match_operand:DI 2 "const_int_operand" "n"))
1811 (match_operand:BI 3 "register_operand" "0")))]
1813 "tbit.nz.or.andcm %0, %I0 = %1, %2"
1814 [(set_attr "itanium_class" "tbit")])
1816 (define_insn "*tbit_or_3"
1817 [(set (match_operand:BI 0 "register_operand" "=c")
1818 (ior:BI (eq:BI (zero_extract:DI
1819 (match_operand:DI 1 "gr_register_operand" "r")
1821 (match_operand:DI 2 "const_int_operand" "n"))
1823 (match_operand:BI 3 "register_operand" "0")))]
1825 "tbit.z.or.andcm %0, %I0 = %1, %2"
1826 [(set_attr "itanium_class" "tbit")])
1828 ;; Transform test of and/or of setcc into parallel comparisons.
1831 [(set (match_operand:BI 0 "register_operand" "")
1832 (ne:BI (and:DI (ne:DI (match_operand:BI 2 "register_operand" "")
1834 (match_operand:DI 3 "register_operand" ""))
1838 (and:BI (ne:BI (and:DI (match_dup 3) (const_int 1)) (const_int 0))
1843 [(set (match_operand:BI 0 "register_operand" "")
1844 (eq:BI (and:DI (ne:DI (match_operand:BI 2 "register_operand" "")
1846 (match_operand:DI 3 "register_operand" ""))
1850 (and:BI (ne:BI (and:DI (match_dup 3) (const_int 1)) (const_int 0))
1852 (parallel [(set (match_dup 0) (not:BI (match_dup 0)))
1853 (clobber (scratch))])]
1857 [(set (match_operand:BI 0 "register_operand" "")
1858 (ne:BI (ior:DI (ne:DI (match_operand:BI 2 "register_operand" "")
1860 (match_operand:DI 3 "register_operand" ""))
1864 (ior:BI (ne:BI (match_dup 3) (const_int 0))
1869 [(set (match_operand:BI 0 "register_operand" "")
1870 (eq:BI (ior:DI (ne:DI (match_operand:BI 2 "register_operand" "")
1872 (match_operand:DI 3 "register_operand" ""))
1876 (ior:BI (ne:BI (match_dup 3) (const_int 0))
1878 (parallel [(set (match_dup 0) (not:BI (match_dup 0)))
1879 (clobber (scratch))])]
1882 ;; ??? Incredibly hackish. Either need four proper patterns with all
1883 ;; the alternatives, or rely on sched1 to split the insn and hope that
1884 ;; nothing bad happens to the comparisons in the meantime.
1886 ;; Alternately, adjust combine to allow 2->2 and 3->3 splits, assuming
1887 ;; that we're doing height reduction.
1889 ;(define_insn_and_split ""
1890 ; [(set (match_operand:BI 0 "register_operand" "=c")
1891 ; (and:BI (and:BI (match_operator:BI 1 "comparison_operator"
1892 ; [(match_operand 2 "" "")
1893 ; (match_operand 3 "" "")])
1894 ; (match_operator:BI 4 "comparison_operator"
1895 ; [(match_operand 5 "" "")
1896 ; (match_operand 6 "" "")]))
1898 ; "flag_schedule_insns"
1901 ; [(set (match_dup 0) (and:BI (match_dup 1) (match_dup 0)))
1902 ; (set (match_dup 0) (and:BI (match_dup 4) (match_dup 0)))]
1905 ;(define_insn_and_split ""
1906 ; [(set (match_operand:BI 0 "register_operand" "=c")
1907 ; (ior:BI (ior:BI (match_operator:BI 1 "comparison_operator"
1908 ; [(match_operand 2 "" "")
1909 ; (match_operand 3 "" "")])
1910 ; (match_operator:BI 4 "comparison_operator"
1911 ; [(match_operand 5 "" "")
1912 ; (match_operand 6 "" "")]))
1914 ; "flag_schedule_insns"
1917 ; [(set (match_dup 0) (ior:BI (match_dup 1) (match_dup 0)))
1918 ; (set (match_dup 0) (ior:BI (match_dup 4) (match_dup 0)))]
1922 ; [(set (match_operand:BI 0 "register_operand" "")
1923 ; (and:BI (and:BI (match_operator:BI 1 "comparison_operator"
1924 ; [(match_operand 2 "" "")
1925 ; (match_operand 3 "" "")])
1926 ; (match_operand:BI 7 "register_operand" ""))
1927 ; (and:BI (match_operator:BI 4 "comparison_operator"
1928 ; [(match_operand 5 "" "")
1929 ; (match_operand 6 "" "")])
1930 ; (match_operand:BI 8 "register_operand" ""))))]
1932 ; [(set (match_dup 0) (and:BI (match_dup 7) (match_dup 8)))
1933 ; (set (match_dup 0) (and:BI (and:BI (match_dup 1) (match_dup 4))
1938 ; [(set (match_operand:BI 0 "register_operand" "")
1939 ; (ior:BI (ior:BI (match_operator:BI 1 "comparison_operator"
1940 ; [(match_operand 2 "" "")
1941 ; (match_operand 3 "" "")])
1942 ; (match_operand:BI 7 "register_operand" ""))
1943 ; (ior:BI (match_operator:BI 4 "comparison_operator"
1944 ; [(match_operand 5 "" "")
1945 ; (match_operand 6 "" "")])
1946 ; (match_operand:BI 8 "register_operand" ""))))]
1948 ; [(set (match_dup 0) (ior:BI (match_dup 7) (match_dup 8)))
1949 ; (set (match_dup 0) (ior:BI (ior:BI (match_dup 1) (match_dup 4))
1953 ;; Try harder to avoid predicate copies by duplicating compares.
1954 ;; Note that we'll have already split the predicate copy, which
1955 ;; is kind of a pain, but oh well.
1958 [(set (match_operand:BI 0 "register_operand" "")
1959 (match_operand:BI 1 "comparison_operator" ""))
1960 (set (match_operand:CCI 2 "register_operand" "")
1961 (match_operand:CCI 3 "register_operand" ""))
1962 (set (match_operand:CCI 4 "register_operand" "")
1963 (match_operand:CCI 5 "register_operand" ""))
1964 (set (match_operand:BI 6 "register_operand" "")
1965 (unspec:BI [(match_dup 6)] 7))]
1966 "REGNO (operands[3]) == REGNO (operands[0])
1967 && REGNO (operands[4]) == REGNO (operands[0]) + 1
1968 && REGNO (operands[4]) == REGNO (operands[2]) + 1
1969 && REGNO (operands[6]) == REGNO (operands[2])"
1970 [(set (match_dup 0) (match_dup 1))
1971 (set (match_dup 6) (match_dup 7))]
1972 "operands[7] = copy_rtx (operands[1]);")
1974 ;; ::::::::::::::::::::
1976 ;; :: 16 bit Integer arithmetic
1978 ;; ::::::::::::::::::::
1980 (define_insn "mulhi3"
1981 [(set (match_operand:HI 0 "gr_register_operand" "=r")
1982 (mult:HI (match_operand:HI 1 "gr_register_operand" "r")
1983 (match_operand:HI 2 "gr_register_operand" "r")))]
1985 "pmpy2.r %0 = %1, %2"
1986 [(set_attr "itanium_class" "mmmul")])
1989 ;; ::::::::::::::::::::
1991 ;; :: 32 bit Integer arithmetic
1993 ;; ::::::::::::::::::::
1995 (define_insn "addsi3"
1996 [(set (match_operand:SI 0 "gr_register_operand" "=r,r,r")
1997 (plus:SI (match_operand:SI 1 "gr_register_operand" "%r,r,a")
1998 (match_operand:SI 2 "gr_reg_or_22bit_operand" "r,I,J")))]
2004 [(set_attr "itanium_class" "ialu")])
2006 (define_insn "*addsi3_plus1"
2007 [(set (match_operand:SI 0 "gr_register_operand" "=r")
2008 (plus:SI (plus:SI (match_operand:SI 1 "gr_register_operand" "r")
2009 (match_operand:SI 2 "gr_register_operand" "r"))
2012 "add %0 = %1, %2, 1"
2013 [(set_attr "itanium_class" "ialu")])
2015 (define_insn "*addsi3_plus1_alt"
2016 [(set (match_operand:SI 0 "gr_register_operand" "=r")
2017 (plus:SI (mult:SI (match_operand:SI 1 "gr_register_operand" "r")
2021 "add %0 = %1, %1, 1"
2022 [(set_attr "itanium_class" "ialu")])
2024 (define_insn "*addsi3_shladd"
2025 [(set (match_operand:SI 0 "gr_register_operand" "=r")
2026 (plus:SI (mult:SI (match_operand:SI 1 "gr_register_operand" "r")
2027 (match_operand:SI 2 "shladd_operand" "n"))
2028 (match_operand:SI 3 "gr_register_operand" "r")))]
2030 "shladd %0 = %1, %S2, %3"
2031 [(set_attr "itanium_class" "ialu")])
2033 (define_insn "subsi3"
2034 [(set (match_operand:SI 0 "gr_register_operand" "=r")
2035 (minus:SI (match_operand:SI 1 "gr_reg_or_8bit_operand" "rK")
2036 (match_operand:SI 2 "gr_register_operand" "r")))]
2039 [(set_attr "itanium_class" "ialu")])
2041 (define_insn "*subsi3_minus1"
2042 [(set (match_operand:SI 0 "gr_register_operand" "=r")
2043 (plus:SI (not:SI (match_operand:SI 1 "gr_register_operand" "r"))
2044 (match_operand:SI 2 "gr_register_operand" "r")))]
2046 "sub %0 = %2, %1, 1"
2047 [(set_attr "itanium_class" "ialu")])
2049 ;; ??? Could add maddsi3 patterns patterned after the madddi3 patterns.
2051 (define_insn "mulsi3"
2052 [(set (match_operand:SI 0 "fr_register_operand" "=f")
2053 (mult:SI (match_operand:SI 1 "grfr_register_operand" "f")
2054 (match_operand:SI 2 "grfr_register_operand" "f")))]
2056 "xmpy.l %0 = %1, %2%B0"
2057 [(set_attr "itanium_class" "xmpy")])
2059 (define_insn "maddsi4"
2060 [(set (match_operand:SI 0 "fr_register_operand" "=f")
2061 (plus:SI (mult:SI (match_operand:SI 1 "grfr_register_operand" "f")
2062 (match_operand:SI 2 "grfr_register_operand" "f"))
2063 (match_operand:SI 3 "grfr_register_operand" "f")))]
2065 "xma.l %0 = %1, %2, %3%B0"
2066 [(set_attr "itanium_class" "xmpy")])
2068 (define_insn "negsi2"
2069 [(set (match_operand:SI 0 "gr_register_operand" "=r")
2070 (neg:SI (match_operand:SI 1 "gr_register_operand" "r")))]
2073 [(set_attr "itanium_class" "ialu")])
2075 (define_expand "abssi2"
2077 (ge:BI (match_operand:SI 1 "gr_register_operand" "") (const_int 0)))
2078 (set (match_operand:SI 0 "gr_register_operand" "")
2079 (if_then_else:SI (eq (match_dup 2) (const_int 0))
2080 (neg:SI (match_dup 1))
2085 operands[2] = gen_reg_rtx (BImode);
2088 (define_expand "sminsi3"
2090 (ge:BI (match_operand:SI 1 "gr_register_operand" "")
2091 (match_operand:SI 2 "gr_register_operand" "")))
2092 (set (match_operand:SI 0 "gr_register_operand" "")
2093 (if_then_else:SI (ne (match_dup 3) (const_int 0))
2094 (match_dup 2) (match_dup 1)))]
2098 operands[3] = gen_reg_rtx (BImode);
2101 (define_expand "smaxsi3"
2103 (ge:BI (match_operand:SI 1 "gr_register_operand" "")
2104 (match_operand:SI 2 "gr_register_operand" "")))
2105 (set (match_operand:SI 0 "gr_register_operand" "")
2106 (if_then_else:SI (ne (match_dup 3) (const_int 0))
2107 (match_dup 1) (match_dup 2)))]
2111 operands[3] = gen_reg_rtx (BImode);
2114 (define_expand "uminsi3"
2116 (geu:BI (match_operand:SI 1 "gr_register_operand" "")
2117 (match_operand:SI 2 "gr_register_operand" "")))
2118 (set (match_operand:SI 0 "gr_register_operand" "")
2119 (if_then_else:SI (ne (match_dup 3) (const_int 0))
2120 (match_dup 2) (match_dup 1)))]
2124 operands[3] = gen_reg_rtx (BImode);
2127 (define_expand "umaxsi3"
2129 (geu:BI (match_operand:SI 1 "gr_register_operand" "")
2130 (match_operand:SI 2 "gr_register_operand" "")))
2131 (set (match_operand:SI 0 "gr_register_operand" "")
2132 (if_then_else:SI (ne (match_dup 3) (const_int 0))
2133 (match_dup 1) (match_dup 2)))]
2137 operands[3] = gen_reg_rtx (BImode);
2140 (define_expand "divsi3"
2141 [(set (match_operand:SI 0 "register_operand" "")
2142 (div:SI (match_operand:SI 1 "general_operand" "")
2143 (match_operand:SI 2 "general_operand" "")))]
2147 rtx op1_tf, op2_tf, op0_tf, op0_di, twon34;
2149 op0_tf = gen_reg_rtx (TFmode);
2150 op0_di = gen_reg_rtx (DImode);
2152 if (CONSTANT_P (operands[1]))
2153 operands[1] = force_reg (SImode, operands[1]);
2154 op1_tf = gen_reg_rtx (TFmode);
2155 expand_float (op1_tf, operands[1], 0);
2157 if (CONSTANT_P (operands[2]))
2158 operands[2] = force_reg (SImode, operands[2]);
2159 op2_tf = gen_reg_rtx (TFmode);
2160 expand_float (op2_tf, operands[2], 0);
2164 twon34 = (CONST_DOUBLE_FROM_REAL_VALUE
2165 (REAL_VALUE_FROM_TARGET_SINGLE (0x2e800000), TFmode));
2166 twon34 = force_reg (TFmode, twon34);
2168 twon34 = gen_reg_rtx (TFmode);
2169 convert_move (twon34, force_const_mem (SFmode, CONST_DOUBLE_FROM_REAL_VALUE (REAL_VALUE_FROM_TARGET_SINGLE (0x2e800000), SFmode)), 0);
2172 emit_insn (gen_divsi3_internal (op0_tf, op1_tf, op2_tf, twon34));
2174 emit_insn (gen_fix_trunctfdi2_alts (op0_di, op0_tf, const1_rtx));
2175 emit_move_insn (operands[0], gen_lowpart (SImode, op0_di));
2179 (define_expand "modsi3"
2180 [(set (match_operand:SI 0 "register_operand" "")
2181 (mod:SI (match_operand:SI 1 "general_operand" "")
2182 (match_operand:SI 2 "general_operand" "")))]
2186 rtx op2_neg, op1_di, div;
2188 div = gen_reg_rtx (SImode);
2189 emit_insn (gen_divsi3 (div, operands[1], operands[2]));
2191 op2_neg = expand_unop (SImode, neg_optab, operands[2], NULL_RTX, 0);
2193 /* This is a trick to get us to reuse the value that we're sure to
2194 have already copied to the FP regs. */
2195 op1_di = gen_reg_rtx (DImode);
2196 convert_move (op1_di, operands[1], 0);
2198 emit_insn (gen_maddsi4 (operands[0], div, op2_neg,
2199 gen_lowpart (SImode, op1_di)));
2203 (define_expand "udivsi3"
2204 [(set (match_operand:SI 0 "register_operand" "")
2205 (udiv:SI (match_operand:SI 1 "general_operand" "")
2206 (match_operand:SI 2 "general_operand" "")))]
2210 rtx op1_tf, op2_tf, op0_tf, op0_di, twon34;
2212 op0_tf = gen_reg_rtx (TFmode);
2213 op0_di = gen_reg_rtx (DImode);
2215 if (CONSTANT_P (operands[1]))
2216 operands[1] = force_reg (SImode, operands[1]);
2217 op1_tf = gen_reg_rtx (TFmode);
2218 expand_float (op1_tf, operands[1], 1);
2220 if (CONSTANT_P (operands[2]))
2221 operands[2] = force_reg (SImode, operands[2]);
2222 op2_tf = gen_reg_rtx (TFmode);
2223 expand_float (op2_tf, operands[2], 1);
2227 twon34 = (CONST_DOUBLE_FROM_REAL_VALUE
2228 (REAL_VALUE_FROM_TARGET_SINGLE (0x2e800000), TFmode));
2229 twon34 = force_reg (TFmode, twon34);
2231 twon34 = gen_reg_rtx (TFmode);
2232 convert_move (twon34, force_const_mem (SFmode, CONST_DOUBLE_FROM_REAL_VALUE (REAL_VALUE_FROM_TARGET_SINGLE (0x2e800000), SFmode)), 0);
2235 emit_insn (gen_divsi3_internal (op0_tf, op1_tf, op2_tf, twon34));
2237 emit_insn (gen_fixuns_trunctfdi2_alts (op0_di, op0_tf, const1_rtx));
2238 emit_move_insn (operands[0], gen_lowpart (SImode, op0_di));
2242 (define_expand "umodsi3"
2243 [(set (match_operand:SI 0 "register_operand" "")
2244 (umod:SI (match_operand:SI 1 "general_operand" "")
2245 (match_operand:SI 2 "general_operand" "")))]
2249 rtx op2_neg, op1_di, div;
2251 div = gen_reg_rtx (SImode);
2252 emit_insn (gen_udivsi3 (div, operands[1], operands[2]));
2254 op2_neg = expand_unop (SImode, neg_optab, operands[2], NULL_RTX, 0);
2256 /* This is a trick to get us to reuse the value that we're sure to
2257 have already copied to the FP regs. */
2258 op1_di = gen_reg_rtx (DImode);
2259 convert_move (op1_di, operands[1], 1);
2261 emit_insn (gen_maddsi4 (operands[0], div, op2_neg,
2262 gen_lowpart (SImode, op1_di)));
2266 (define_insn_and_split "divsi3_internal"
2267 [(set (match_operand:TF 0 "fr_register_operand" "=&f")
2268 (float:TF (div:SI (match_operand:TF 1 "fr_register_operand" "f")
2269 (match_operand:TF 2 "fr_register_operand" "f"))))
2270 (clobber (match_scratch:TF 4 "=&f"))
2271 (clobber (match_scratch:TF 5 "=&f"))
2272 (clobber (match_scratch:BI 6 "=c"))
2273 (use (match_operand:TF 3 "fr_register_operand" "f"))]
2276 "&& reload_completed"
2277 [(parallel [(set (match_dup 0) (div:TF (const_int 1) (match_dup 2)))
2278 (set (match_dup 6) (unspec:BI [(match_dup 1) (match_dup 2)] 5))
2279 (use (const_int 1))])
2280 (cond_exec (ne (match_dup 6) (const_int 0))
2281 (parallel [(set (match_dup 4) (mult:TF (match_dup 1) (match_dup 0)))
2282 (use (const_int 1))]))
2283 (cond_exec (ne (match_dup 6) (const_int 0))
2284 (parallel [(set (match_dup 5)
2285 (plus:TF (neg:TF (mult:TF (match_dup 2) (match_dup 0)))
2287 (use (const_int 1))]))
2288 (cond_exec (ne (match_dup 6) (const_int 0))
2289 (parallel [(set (match_dup 4)
2290 (plus:TF (mult:TF (match_dup 5) (match_dup 4))
2292 (use (const_int 1))]))
2293 (cond_exec (ne (match_dup 6) (const_int 0))
2294 (parallel [(set (match_dup 5)
2295 (plus:TF (mult:TF (match_dup 5) (match_dup 5))
2297 (use (const_int 1))]))
2298 (cond_exec (ne (match_dup 6) (const_int 0))
2299 (parallel [(set (match_dup 0)
2300 (plus:TF (mult:TF (match_dup 5) (match_dup 4))
2302 (use (const_int 1))]))
2304 "operands[7] = CONST1_RTX (TFmode);"
2305 [(set_attr "predicable" "no")])
2307 ;; ::::::::::::::::::::
2309 ;; :: 64 bit Integer arithmetic
2311 ;; ::::::::::::::::::::
2313 (define_insn "adddi3"
2314 [(set (match_operand:DI 0 "gr_register_operand" "=r,r,r")
2315 (plus:DI (match_operand:DI 1 "gr_register_operand" "%r,r,a")
2316 (match_operand:DI 2 "gr_reg_or_22bit_operand" "r,I,J")))]
2322 [(set_attr "itanium_class" "ialu")])
2324 (define_insn "*adddi3_plus1"
2325 [(set (match_operand:DI 0 "gr_register_operand" "=r")
2326 (plus:DI (plus:DI (match_operand:DI 1 "gr_register_operand" "r")
2327 (match_operand:DI 2 "gr_register_operand" "r"))
2330 "add %0 = %1, %2, 1"
2331 [(set_attr "itanium_class" "ialu")])
2333 ;; This has some of the same problems as shladd. We let the shladd
2334 ;; eliminator hack handle it, which results in the 1 being forced into
2335 ;; a register, but not more ugliness here.
2336 (define_insn "*adddi3_plus1_alt"
2337 [(set (match_operand:DI 0 "gr_register_operand" "=r")
2338 (plus:DI (mult:DI (match_operand:DI 1 "gr_register_operand" "r")
2342 "add %0 = %1, %1, 1"
2343 [(set_attr "itanium_class" "ialu")])
2345 (define_insn "subdi3"
2346 [(set (match_operand:DI 0 "gr_register_operand" "=r")
2347 (minus:DI (match_operand:DI 1 "gr_reg_or_8bit_operand" "rK")
2348 (match_operand:DI 2 "gr_register_operand" "r")))]
2351 [(set_attr "itanium_class" "ialu")])
2353 (define_insn "*subdi3_minus1"
2354 [(set (match_operand:DI 0 "gr_register_operand" "=r")
2355 (plus:DI (not:DI (match_operand:DI 1 "gr_register_operand" "r"))
2356 (match_operand:DI 2 "gr_register_operand" "r")))]
2358 "sub %0 = %2, %1, 1"
2359 [(set_attr "itanium_class" "ialu")])
2361 ;; ??? Use grfr instead of fr because of virtual register elimination
2362 ;; and silly test cases multiplying by the frame pointer.
2363 (define_insn "muldi3"
2364 [(set (match_operand:DI 0 "fr_register_operand" "=f")
2365 (mult:DI (match_operand:DI 1 "grfr_register_operand" "f")
2366 (match_operand:DI 2 "grfr_register_operand" "f")))]
2368 "xmpy.l %0 = %1, %2%B0"
2369 [(set_attr "itanium_class" "xmpy")])
2371 ;; ??? If operand 3 is an eliminable reg, then register elimination causes the
2372 ;; same problem that we have with shladd below. Unfortunately, this case is
2373 ;; much harder to fix because the multiply puts the result in an FP register,
2374 ;; but the add needs inputs from a general register. We add a spurious clobber
2375 ;; here so that it will be present just in case register elimination gives us
2376 ;; the funny result.
2378 ;; ??? Maybe validate_changes should try adding match_scratch clobbers?
2380 ;; ??? Maybe we should change how adds are canonicalized.
2382 (define_insn "madddi4"
2383 [(set (match_operand:DI 0 "fr_register_operand" "=f")
2384 (plus:DI (mult:DI (match_operand:DI 1 "grfr_register_operand" "f")
2385 (match_operand:DI 2 "grfr_register_operand" "f"))
2386 (match_operand:DI 3 "grfr_register_operand" "f")))
2387 (clobber (match_scratch:DI 4 "=X"))]
2389 "xma.l %0 = %1, %2, %3%B0"
2390 [(set_attr "itanium_class" "xmpy")])
2392 ;; This can be created by register elimination if operand3 of shladd is an
2393 ;; eliminable register or has reg_equiv_constant set.
2395 ;; We have to use nonmemory_operand for operand 4, to ensure that the
2396 ;; validate_changes call inside eliminate_regs will always succeed. If it
2397 ;; doesn't succeed, then this remain a madddi4 pattern, and will be reloaded
2400 (define_insn "*madddi4_elim"
2401 [(set (match_operand:DI 0 "register_operand" "=&r")
2402 (plus:DI (plus:DI (mult:DI (match_operand:DI 1 "register_operand" "f")
2403 (match_operand:DI 2 "register_operand" "f"))
2404 (match_operand:DI 3 "register_operand" "f"))
2405 (match_operand:DI 4 "nonmemory_operand" "rI")))
2406 (clobber (match_scratch:DI 5 "=f"))]
2407 "reload_in_progress"
2409 [(set_attr "itanium_class" "unknown")])
2411 ;; ??? Need to emit an instruction group barrier here because this gets split
2415 [(set (match_operand:DI 0 "register_operand" "")
2416 (plus:DI (plus:DI (mult:DI (match_operand:DI 1 "register_operand" "")
2417 (match_operand:DI 2 "register_operand" ""))
2418 (match_operand:DI 3 "register_operand" ""))
2419 (match_operand:DI 4 "gr_reg_or_14bit_operand" "")))
2420 (clobber (match_scratch:DI 5 ""))]
2422 [(parallel [(set (match_dup 5) (plus:DI (mult:DI (match_dup 1) (match_dup 2))
2424 (clobber (match_dup 0))])
2425 (unspec_volatile [(const_int 0)] 2)
2426 (set (match_dup 0) (match_dup 5))
2427 (unspec_volatile [(const_int 0)] 2)
2428 (set (match_dup 0) (plus:DI (match_dup 0) (match_dup 4)))]
2431 ;; ??? There are highpart multiply and add instructions, but we have no way
2432 ;; to generate them.
2434 (define_insn "smuldi3_highpart"
2435 [(set (match_operand:DI 0 "fr_register_operand" "=f")
2438 (mult:TI (sign_extend:TI
2439 (match_operand:DI 1 "fr_register_operand" "f"))
2441 (match_operand:DI 2 "fr_register_operand" "f")))
2444 "xmpy.h %0 = %1, %2%B0"
2445 [(set_attr "itanium_class" "xmpy")])
2447 (define_insn "umuldi3_highpart"
2448 [(set (match_operand:DI 0 "fr_register_operand" "=f")
2451 (mult:TI (zero_extend:TI
2452 (match_operand:DI 1 "fr_register_operand" "f"))
2454 (match_operand:DI 2 "fr_register_operand" "f")))
2457 "xmpy.hu %0 = %1, %2%B0"
2458 [(set_attr "itanium_class" "xmpy")])
2460 (define_insn "negdi2"
2461 [(set (match_operand:DI 0 "gr_register_operand" "=r")
2462 (neg:DI (match_operand:DI 1 "gr_register_operand" "r")))]
2465 [(set_attr "itanium_class" "ialu")])
2467 (define_expand "absdi2"
2469 (ge:BI (match_operand:DI 1 "gr_register_operand" "") (const_int 0)))
2470 (set (match_operand:DI 0 "gr_register_operand" "")
2471 (if_then_else:DI (eq (match_dup 2) (const_int 0))
2472 (neg:DI (match_dup 1))
2477 operands[2] = gen_reg_rtx (BImode);
2480 (define_expand "smindi3"
2482 (ge:BI (match_operand:DI 1 "gr_register_operand" "")
2483 (match_operand:DI 2 "gr_register_operand" "")))
2484 (set (match_operand:DI 0 "gr_register_operand" "")
2485 (if_then_else:DI (ne (match_dup 3) (const_int 0))
2486 (match_dup 2) (match_dup 1)))]
2490 operands[3] = gen_reg_rtx (BImode);
2493 (define_expand "smaxdi3"
2495 (ge:BI (match_operand:DI 1 "gr_register_operand" "")
2496 (match_operand:DI 2 "gr_register_operand" "")))
2497 (set (match_operand:DI 0 "gr_register_operand" "")
2498 (if_then_else:DI (ne (match_dup 3) (const_int 0))
2499 (match_dup 1) (match_dup 2)))]
2503 operands[3] = gen_reg_rtx (BImode);
2506 (define_expand "umindi3"
2508 (geu:BI (match_operand:DI 1 "gr_register_operand" "")
2509 (match_operand:DI 2 "gr_register_operand" "")))
2510 (set (match_operand:DI 0 "gr_register_operand" "")
2511 (if_then_else:DI (ne (match_dup 3) (const_int 0))
2512 (match_dup 2) (match_dup 1)))]
2516 operands[3] = gen_reg_rtx (BImode);
2519 (define_expand "umaxdi3"
2521 (geu:BI (match_operand:DI 1 "gr_register_operand" "")
2522 (match_operand:DI 2 "gr_register_operand" "")))
2523 (set (match_operand:DI 0 "gr_register_operand" "")
2524 (if_then_else:DI (ne (match_dup 3) (const_int 0))
2525 (match_dup 1) (match_dup 2)))]
2529 operands[3] = gen_reg_rtx (BImode);
2532 (define_expand "ffsdi2"
2534 (eq:BI (match_operand:DI 1 "gr_register_operand" "") (const_int 0)))
2535 (set (match_dup 2) (plus:DI (match_dup 1) (const_int -1)))
2536 (set (match_dup 5) (const_int 0))
2537 (set (match_dup 3) (xor:DI (match_dup 1) (match_dup 2)))
2538 (set (match_dup 4) (unspec:DI [(match_dup 3)] 8))
2539 (set (match_operand:DI 0 "gr_register_operand" "")
2540 (if_then_else:DI (ne (match_dup 6) (const_int 0))
2541 (match_dup 5) (match_dup 4)))]
2545 operands[2] = gen_reg_rtx (DImode);
2546 operands[3] = gen_reg_rtx (DImode);
2547 operands[4] = gen_reg_rtx (DImode);
2548 operands[5] = gen_reg_rtx (DImode);
2549 operands[6] = gen_reg_rtx (BImode);
2552 (define_insn "*popcnt"
2553 [(set (match_operand:DI 0 "gr_register_operand" "=r")
2554 (unspec:DI [(match_operand:DI 1 "gr_register_operand" "r")] 8))]
2557 [(set_attr "itanium_class" "mmmul")])
2559 (define_expand "divdi3"
2560 [(set (match_operand:DI 0 "register_operand" "")
2561 (div:DI (match_operand:DI 1 "general_operand" "")
2562 (match_operand:DI 2 "general_operand" "")))]
2566 rtx op1_tf, op2_tf, op0_tf;
2568 op0_tf = gen_reg_rtx (TFmode);
2570 if (CONSTANT_P (operands[1]))
2571 operands[1] = force_reg (DImode, operands[1]);
2572 op1_tf = gen_reg_rtx (TFmode);
2573 expand_float (op1_tf, operands[1], 0);
2575 if (CONSTANT_P (operands[2]))
2576 operands[2] = force_reg (DImode, operands[2]);
2577 op2_tf = gen_reg_rtx (TFmode);
2578 expand_float (op2_tf, operands[2], 0);
2580 if (TARGET_INLINE_DIV_LAT)
2581 emit_insn (gen_divdi3_internal_lat (op0_tf, op1_tf, op2_tf));
2583 emit_insn (gen_divdi3_internal_thr (op0_tf, op1_tf, op2_tf));
2585 emit_insn (gen_fix_trunctfdi2_alts (operands[0], op0_tf, const1_rtx));
2589 (define_expand "moddi3"
2590 [(set (match_operand:DI 0 "register_operand" "")
2591 (mod:SI (match_operand:DI 1 "general_operand" "")
2592 (match_operand:DI 2 "general_operand" "")))]
2598 div = gen_reg_rtx (DImode);
2599 emit_insn (gen_divdi3 (div, operands[1], operands[2]));
2601 op2_neg = expand_unop (DImode, neg_optab, operands[2], NULL_RTX, 0);
2603 emit_insn (gen_madddi4 (operands[0], div, op2_neg, operands[1]));
2607 (define_expand "udivdi3"
2608 [(set (match_operand:DI 0 "register_operand" "")
2609 (udiv:DI (match_operand:DI 1 "general_operand" "")
2610 (match_operand:DI 2 "general_operand" "")))]
2614 rtx op1_tf, op2_tf, op0_tf;
2616 op0_tf = gen_reg_rtx (TFmode);
2618 if (CONSTANT_P (operands[1]))
2619 operands[1] = force_reg (DImode, operands[1]);
2620 op1_tf = gen_reg_rtx (TFmode);
2621 expand_float (op1_tf, operands[1], 1);
2623 if (CONSTANT_P (operands[2]))
2624 operands[2] = force_reg (DImode, operands[2]);
2625 op2_tf = gen_reg_rtx (TFmode);
2626 expand_float (op2_tf, operands[2], 1);
2628 if (TARGET_INLINE_DIV_LAT)
2629 emit_insn (gen_divdi3_internal_lat (op0_tf, op1_tf, op2_tf));
2631 emit_insn (gen_divdi3_internal_thr (op0_tf, op1_tf, op2_tf));
2633 emit_insn (gen_fixuns_trunctfdi2_alts (operands[0], op0_tf, const1_rtx));
2637 (define_expand "umoddi3"
2638 [(set (match_operand:DI 0 "register_operand" "")
2639 (umod:DI (match_operand:DI 1 "general_operand" "")
2640 (match_operand:DI 2 "general_operand" "")))]
2646 div = gen_reg_rtx (DImode);
2647 emit_insn (gen_udivdi3 (div, operands[1], operands[2]));
2649 op2_neg = expand_unop (DImode, neg_optab, operands[2], NULL_RTX, 0);
2651 emit_insn (gen_madddi4 (operands[0], div, op2_neg, operands[1]));
2655 (define_insn_and_split "divdi3_internal_lat"
2656 [(set (match_operand:TF 0 "fr_register_operand" "=&f")
2657 (float:TF (div:SI (match_operand:TF 1 "fr_register_operand" "f")
2658 (match_operand:TF 2 "fr_register_operand" "f"))))
2659 (clobber (match_scratch:TF 3 "=&f"))
2660 (clobber (match_scratch:TF 4 "=&f"))
2661 (clobber (match_scratch:TF 5 "=&f"))
2662 (clobber (match_scratch:BI 6 "=c"))]
2663 "TARGET_INLINE_DIV_LAT"
2665 "&& reload_completed"
2666 [(parallel [(set (match_dup 0) (div:TF (const_int 1) (match_dup 2)))
2667 (set (match_dup 6) (unspec:BI [(match_dup 1) (match_dup 2)] 5))
2668 (use (const_int 1))])
2669 (cond_exec (ne (match_dup 6) (const_int 0))
2670 (parallel [(set (match_dup 3)
2671 (plus:TF (neg:TF (mult:TF (match_dup 2) (match_dup 0)))
2673 (use (const_int 1))]))
2674 (cond_exec (ne (match_dup 6) (const_int 0))
2675 (parallel [(set (match_dup 4) (mult:TF (match_dup 1) (match_dup 0)))
2676 (use (const_int 1))]))
2677 (cond_exec (ne (match_dup 6) (const_int 0))
2678 (parallel [(set (match_dup 5) (mult:TF (match_dup 3) (match_dup 3)))
2679 (use (const_int 1))]))
2680 (cond_exec (ne (match_dup 6) (const_int 0))
2681 (parallel [(set (match_dup 4)
2682 (plus:TF (mult:TF (match_dup 3) (match_dup 4))
2684 (use (const_int 1))]))
2685 (cond_exec (ne (match_dup 6) (const_int 0))
2686 (parallel [(set (match_dup 0)
2687 (plus:TF (mult:TF (match_dup 3) (match_dup 0))
2689 (use (const_int 1))]))
2690 (cond_exec (ne (match_dup 6) (const_int 0))
2691 (parallel [(set (match_dup 3)
2692 (plus:TF (mult:TF (match_dup 5) (match_dup 4))
2694 (use (const_int 1))]))
2695 (cond_exec (ne (match_dup 6) (const_int 0))
2696 (parallel [(set (match_dup 0)
2697 (plus:TF (mult:TF (match_dup 5) (match_dup 0))
2699 (use (const_int 1))]))
2700 (cond_exec (ne (match_dup 6) (const_int 0))
2701 (parallel [(set (match_dup 4)
2702 (plus:TF (neg:TF (mult:TF (match_dup 2) (match_dup 3)))
2704 (use (const_int 1))]))
2705 (cond_exec (ne (match_dup 6) (const_int 0))
2706 (parallel [(set (match_dup 0)
2707 (plus:TF (mult:TF (match_dup 4) (match_dup 0))
2709 (use (const_int 1))]))
2711 "operands[7] = CONST1_RTX (TFmode);"
2712 [(set_attr "predicable" "no")])
2714 (define_insn_and_split "divdi3_internal_thr"
2715 [(set (match_operand:TF 0 "fr_register_operand" "=&f")
2716 (float:TF (div:SI (match_operand:TF 1 "fr_register_operand" "f")
2717 (match_operand:TF 2 "fr_register_operand" "f"))))
2718 (clobber (match_scratch:TF 3 "=&f"))
2719 (clobber (match_scratch:TF 4 "=f"))
2720 (clobber (match_scratch:BI 5 "=c"))]
2721 "TARGET_INLINE_DIV_THR"
2723 "&& reload_completed"
2724 [(parallel [(set (match_dup 0) (div:TF (const_int 1) (match_dup 2)))
2725 (set (match_dup 5) (unspec:BI [(match_dup 1) (match_dup 2)] 5))
2726 (use (const_int 1))])
2727 (cond_exec (ne (match_dup 5) (const_int 0))
2728 (parallel [(set (match_dup 3)
2729 (plus:TF (neg:TF (mult:TF (match_dup 2) (match_dup 0)))
2731 (use (const_int 1))]))
2732 (cond_exec (ne (match_dup 5) (const_int 0))
2733 (parallel [(set (match_dup 0)
2734 (plus:TF (mult:TF (match_dup 3) (match_dup 0))
2736 (use (const_int 1))]))
2737 (cond_exec (ne (match_dup 5) (const_int 0))
2738 (parallel [(set (match_dup 3) (mult:TF (match_dup 3) (match_dup 3)))
2739 (use (const_int 1))]))
2740 (cond_exec (ne (match_dup 5) (const_int 0))
2741 (parallel [(set (match_dup 0)
2742 (plus:TF (mult:TF (match_dup 3) (match_dup 0))
2744 (use (const_int 1))]))
2745 (cond_exec (ne (match_dup 5) (const_int 0))
2746 (parallel [(set (match_dup 3) (mult:TF (match_dup 0) (match_dup 1)))
2747 (use (const_int 1))]))
2748 (cond_exec (ne (match_dup 5) (const_int 0))
2749 (parallel [(set (match_dup 4)
2750 (plus:TF (neg:TF (mult:TF (match_dup 2) (match_dup 3)))
2752 (use (const_int 1))]))
2753 (cond_exec (ne (match_dup 5) (const_int 0))
2754 (parallel [(set (match_dup 0)
2755 (plus:TF (mult:TF (match_dup 4) (match_dup 0))
2757 (use (const_int 1))]))
2759 "operands[6] = CONST1_RTX (TFmode);"
2760 [(set_attr "predicable" "no")])
2762 ;; ::::::::::::::::::::
2764 ;; :: 32 bit floating point arithmetic
2766 ;; ::::::::::::::::::::
2768 (define_insn "addsf3"
2769 [(set (match_operand:SF 0 "fr_register_operand" "=f")
2770 (plus:SF (match_operand:SF 1 "fr_register_operand" "%f")
2771 (match_operand:SF 2 "fr_reg_or_fp01_operand" "fG")))]
2773 "fadd.s %0 = %1, %F2%B0"
2774 [(set_attr "itanium_class" "fmac")])
2776 (define_insn "subsf3"
2777 [(set (match_operand:SF 0 "fr_register_operand" "=f")
2778 (minus:SF (match_operand:SF 1 "fr_reg_or_fp01_operand" "fG")
2779 (match_operand:SF 2 "fr_reg_or_fp01_operand" "fG")))]
2781 "fsub.s %0 = %F1, %F2%B0"
2782 [(set_attr "itanium_class" "fmac")])
2784 (define_insn "mulsf3"
2785 [(set (match_operand:SF 0 "fr_register_operand" "=f")
2786 (mult:SF (match_operand:SF 1 "fr_register_operand" "%f")
2787 (match_operand:SF 2 "fr_register_operand" "f")))]
2789 "fmpy.s %0 = %1, %2%B0"
2790 [(set_attr "itanium_class" "fmac")])
2792 (define_insn "abssf2"
2793 [(set (match_operand:SF 0 "fr_register_operand" "=f")
2794 (abs:SF (match_operand:SF 1 "fr_register_operand" "f")))]
2797 [(set_attr "itanium_class" "fmisc")])
2799 (define_insn "negsf2"
2800 [(set (match_operand:SF 0 "fr_register_operand" "=f")
2801 (neg:SF (match_operand:SF 1 "fr_register_operand" "f")))]
2804 [(set_attr "itanium_class" "fmisc")])
2806 (define_insn "*nabssf2"
2807 [(set (match_operand:SF 0 "fr_register_operand" "=f")
2808 (neg:SF (abs:SF (match_operand:SF 1 "fr_register_operand" "f"))))]
2810 "fnegabs %0 = %1%B0"
2811 [(set_attr "itanium_class" "fmisc")])
2813 (define_insn "minsf3"
2814 [(set (match_operand:SF 0 "fr_register_operand" "=f")
2815 (smin:SF (match_operand:SF 1 "fr_register_operand" "f")
2816 (match_operand:SF 2 "fr_reg_or_fp01_operand" "fG")))]
2818 "fmin %0 = %1, %F2%B0"
2819 [(set_attr "itanium_class" "fmisc")])
2821 (define_insn "maxsf3"
2822 [(set (match_operand:SF 0 "fr_register_operand" "=f")
2823 (smax:SF (match_operand:SF 1 "fr_register_operand" "f")
2824 (match_operand:SF 2 "fr_reg_or_fp01_operand" "fG")))]
2826 "fmax %0 = %1, %F2%B0"
2827 [(set_attr "itanium_class" "fmisc")])
2829 (define_insn "*maddsf4"
2830 [(set (match_operand:SF 0 "fr_register_operand" "=f")
2831 (plus:SF (mult:SF (match_operand:SF 1 "fr_register_operand" "f")
2832 (match_operand:SF 2 "fr_register_operand" "f"))
2833 (match_operand:SF 3 "fr_reg_or_fp01_operand" "fG")))]
2835 "fma.s %0 = %1, %2, %F3%B0"
2836 [(set_attr "itanium_class" "fmac")])
2838 (define_insn "*msubsf4"
2839 [(set (match_operand:SF 0 "fr_register_operand" "=f")
2840 (minus:SF (mult:SF (match_operand:SF 1 "fr_register_operand" "f")
2841 (match_operand:SF 2 "fr_register_operand" "f"))
2842 (match_operand:SF 3 "fr_reg_or_fp01_operand" "fG")))]
2844 "fms.s %0 = %1, %2, %F3%B0"
2845 [(set_attr "itanium_class" "fmac")])
2847 (define_insn "*nmulsf3"
2848 [(set (match_operand:SF 0 "fr_register_operand" "=f")
2849 (neg:SF (mult:SF (match_operand:SF 1 "fr_register_operand" "f")
2850 (match_operand:SF 2 "fr_register_operand" "f"))))]
2852 "fnmpy.s %0 = %1, %2%B0"
2853 [(set_attr "itanium_class" "fmac")])
2855 ;; ??? Is it possible to canonicalize this as (minus (reg) (mult))?
2857 (define_insn "*nmaddsf4"
2858 [(set (match_operand:SF 0 "fr_register_operand" "=f")
2859 (plus:SF (neg:SF (mult:SF
2860 (match_operand:SF 1 "fr_register_operand" "f")
2861 (match_operand:SF 2 "fr_register_operand" "f")))
2862 (match_operand:SF 3 "fr_reg_or_fp01_operand" "fG")))]
2864 "fnma.s %0 = %1, %2, %F3%B0"
2865 [(set_attr "itanium_class" "fmac")])
2867 (define_expand "divsf3"
2868 [(set (match_operand:SF 0 "fr_register_operand" "")
2869 (div:SF (match_operand:SF 1 "fr_register_operand" "")
2870 (match_operand:SF 2 "fr_register_operand" "")))]
2875 if (TARGET_INLINE_DIV_LAT)
2876 insn = gen_divsf3_internal_lat (operands[0], operands[1], operands[2]);
2878 insn = gen_divsf3_internal_thr (operands[0], operands[1], operands[2]);
2883 (define_insn_and_split "divsf3_internal_lat"
2884 [(set (match_operand:SF 0 "fr_register_operand" "=&f")
2885 (div:SF (match_operand:SF 1 "fr_register_operand" "f")
2886 (match_operand:SF 2 "fr_register_operand" "f")))
2887 (clobber (match_scratch:TF 3 "=&f"))
2888 (clobber (match_scratch:TF 4 "=f"))
2889 (clobber (match_scratch:BI 5 "=c"))]
2890 "TARGET_INLINE_DIV_LAT"
2892 "&& reload_completed"
2893 [(parallel [(set (match_dup 6) (div:TF (const_int 1) (match_dup 8)))
2894 (set (match_dup 5) (unspec:BI [(match_dup 7) (match_dup 8)] 5))
2895 (use (const_int 1))])
2896 (cond_exec (ne (match_dup 5) (const_int 0))
2897 (parallel [(set (match_dup 3) (mult:TF (match_dup 7) (match_dup 6)))
2898 (use (const_int 1))]))
2899 (cond_exec (ne (match_dup 5) (const_int 0))
2900 (parallel [(set (match_dup 4)
2901 (plus:TF (neg:TF (mult:TF (match_dup 8) (match_dup 6)))
2903 (use (const_int 1))]))
2904 (cond_exec (ne (match_dup 5) (const_int 0))
2905 (parallel [(set (match_dup 3)
2906 (plus:TF (mult:TF (match_dup 4) (match_dup 3))
2908 (use (const_int 1))]))
2909 (cond_exec (ne (match_dup 5) (const_int 0))
2910 (parallel [(set (match_dup 4) (mult:TF (match_dup 4) (match_dup 4)))
2911 (use (const_int 1))]))
2912 (cond_exec (ne (match_dup 5) (const_int 0))
2913 (parallel [(set (match_dup 3)
2914 (plus:TF (mult:TF (match_dup 4) (match_dup 3))
2916 (use (const_int 1))]))
2917 (cond_exec (ne (match_dup 5) (const_int 0))
2918 (parallel [(set (match_dup 4) (mult:TF (match_dup 4) (match_dup 4)))
2919 (use (const_int 1))]))
2920 (cond_exec (ne (match_dup 5) (const_int 0))
2921 (parallel [(set (match_dup 9)
2923 (plus:TF (mult:TF (match_dup 4) (match_dup 3))
2925 (use (const_int 1))]))
2926 (cond_exec (ne (match_dup 5) (const_int 0))
2928 (float_truncate:SF (match_dup 6))))
2930 "operands[6] = gen_rtx_REG (TFmode, REGNO (operands[0]));
2931 operands[7] = gen_rtx_REG (TFmode, REGNO (operands[1]));
2932 operands[8] = gen_rtx_REG (TFmode, REGNO (operands[2]));
2933 operands[9] = gen_rtx_REG (DFmode, REGNO (operands[0]));
2934 operands[10] = CONST1_RTX (TFmode);"
2935 [(set_attr "predicable" "no")])
2937 (define_insn_and_split "divsf3_internal_thr"
2938 [(set (match_operand:SF 0 "fr_register_operand" "=&f")
2939 (div:SF (match_operand:SF 1 "fr_register_operand" "f")
2940 (match_operand:SF 2 "fr_register_operand" "f")))
2941 (clobber (match_scratch:TF 3 "=&f"))
2942 (clobber (match_scratch:TF 4 "=f"))
2943 (clobber (match_scratch:BI 5 "=c"))]
2944 "TARGET_INLINE_DIV_THR"
2946 "&& reload_completed"
2947 [(parallel [(set (match_dup 6) (div:TF (const_int 1) (match_dup 8)))
2948 (set (match_dup 5) (unspec:BI [(match_dup 7) (match_dup 8)] 5))
2949 (use (const_int 1))])
2950 (cond_exec (ne (match_dup 5) (const_int 0))
2951 (parallel [(set (match_dup 3)
2952 (plus:TF (neg:TF (mult:TF (match_dup 8) (match_dup 6)))
2954 (use (const_int 1))]))
2955 (cond_exec (ne (match_dup 5) (const_int 0))
2956 (parallel [(set (match_dup 3)
2957 (plus:TF (mult:TF (match_dup 3) (match_dup 3))
2959 (use (const_int 1))]))
2960 (cond_exec (ne (match_dup 5) (const_int 0))
2961 (parallel [(set (match_dup 6)
2962 (plus:TF (mult:TF (match_dup 3) (match_dup 6))
2964 (use (const_int 1))]))
2965 (cond_exec (ne (match_dup 5) (const_int 0))
2966 (parallel [(set (match_dup 9)
2968 (mult:TF (match_dup 7) (match_dup 6))))
2969 (use (const_int 1))]))
2970 (cond_exec (ne (match_dup 5) (const_int 0))
2971 (parallel [(set (match_dup 4)
2972 (plus:TF (neg:TF (mult:TF (match_dup 8) (match_dup 3)))
2974 (use (const_int 1))]))
2975 (cond_exec (ne (match_dup 5) (const_int 0))
2978 (plus:TF (mult:TF (match_dup 4) (match_dup 6))
2981 "operands[6] = gen_rtx_REG (TFmode, REGNO (operands[0]));
2982 operands[7] = gen_rtx_REG (TFmode, REGNO (operands[1]));
2983 operands[8] = gen_rtx_REG (TFmode, REGNO (operands[2]));
2984 operands[9] = gen_rtx_REG (SFmode, REGNO (operands[3]));
2985 operands[10] = CONST1_RTX (TFmode);"
2986 [(set_attr "predicable" "no")])
2988 ;; ::::::::::::::::::::
2990 ;; :: 64 bit floating point arithmetic
2992 ;; ::::::::::::::::::::
2994 (define_insn "adddf3"
2995 [(set (match_operand:DF 0 "fr_register_operand" "=f")
2996 (plus:DF (match_operand:DF 1 "fr_register_operand" "%f")
2997 (match_operand:DF 2 "fr_reg_or_fp01_operand" "fG")))]
2999 "fadd.d %0 = %1, %F2%B0"
3000 [(set_attr "itanium_class" "fmac")])
3002 (define_insn "*adddf3_trunc"
3003 [(set (match_operand:SF 0 "fr_register_operand" "=f")
3005 (plus:DF (match_operand:DF 1 "fr_register_operand" "%f")
3006 (match_operand:DF 2 "fr_reg_or_fp01_operand" "fG"))))]
3008 "fadd.s %0 = %1, %F2%B0"
3009 [(set_attr "itanium_class" "fmac")])
3011 (define_insn "subdf3"
3012 [(set (match_operand:DF 0 "fr_register_operand" "=f")
3013 (minus:DF (match_operand:DF 1 "fr_reg_or_fp01_operand" "fG")
3014 (match_operand:DF 2 "fr_reg_or_fp01_operand" "fG")))]
3016 "fsub.d %0 = %F1, %F2%B0"
3017 [(set_attr "itanium_class" "fmac")])
3019 (define_insn "*subdf3_trunc"
3020 [(set (match_operand:SF 0 "fr_register_operand" "=f")
3022 (minus:DF (match_operand:DF 1 "fr_reg_or_fp01_operand" "fG")
3023 (match_operand:DF 2 "fr_reg_or_fp01_operand" "fG"))))]
3025 "fsub.s %0 = %F1, %F2%B0"
3026 [(set_attr "itanium_class" "fmac")])
3028 (define_insn "muldf3"
3029 [(set (match_operand:DF 0 "fr_register_operand" "=f")
3030 (mult:DF (match_operand:DF 1 "fr_register_operand" "f")
3031 (match_operand:DF 2 "fr_register_operand" "f")))]
3033 "fmpy.d %0 = %1, %2%B0"
3034 [(set_attr "itanium_class" "fmac")])
3036 (define_insn "*muldf3_trunc"
3037 [(set (match_operand:SF 0 "fr_register_operand" "=f")
3039 (mult:DF (match_operand:DF 1 "fr_register_operand" "f")
3040 (match_operand:DF 2 "fr_register_operand" "f"))))]
3042 "fmpy.s %0 = %1, %2%B0"
3043 [(set_attr "itanium_class" "fmac")])
3045 (define_insn "absdf2"
3046 [(set (match_operand:DF 0 "fr_register_operand" "=f")
3047 (abs:DF (match_operand:DF 1 "fr_register_operand" "f")))]
3050 [(set_attr "itanium_class" "fmisc")])
3052 (define_insn "negdf2"
3053 [(set (match_operand:DF 0 "fr_register_operand" "=f")
3054 (neg:DF (match_operand:DF 1 "fr_register_operand" "f")))]
3057 [(set_attr "itanium_class" "fmisc")])
3059 (define_insn "*nabsdf2"
3060 [(set (match_operand:DF 0 "fr_register_operand" "=f")
3061 (neg:DF (abs:DF (match_operand:DF 1 "fr_register_operand" "f"))))]
3063 "fnegabs %0 = %1%B0"
3064 [(set_attr "itanium_class" "fmisc")])
3066 (define_insn "mindf3"
3067 [(set (match_operand:DF 0 "fr_register_operand" "=f")
3068 (smin:DF (match_operand:DF 1 "fr_register_operand" "f")
3069 (match_operand:DF 2 "fr_reg_or_fp01_operand" "fG")))]
3071 "fmin %0 = %1, %F2%B0"
3072 [(set_attr "itanium_class" "fmisc")])
3074 (define_insn "maxdf3"
3075 [(set (match_operand:DF 0 "fr_register_operand" "=f")
3076 (smax:DF (match_operand:DF 1 "fr_register_operand" "f")
3077 (match_operand:DF 2 "fr_reg_or_fp01_operand" "fG")))]
3079 "fmax %0 = %1, %F2%B0"
3080 [(set_attr "itanium_class" "fmisc")])
3082 (define_insn "*madddf4"
3083 [(set (match_operand:DF 0 "fr_register_operand" "=f")
3084 (plus:DF (mult:DF (match_operand:DF 1 "fr_register_operand" "f")
3085 (match_operand:DF 2 "fr_register_operand" "f"))
3086 (match_operand:DF 3 "fr_reg_or_fp01_operand" "fG")))]
3088 "fma.d %0 = %1, %2, %F3%B0"
3089 [(set_attr "itanium_class" "fmac")])
3091 (define_insn "*madddf4_trunc"
3092 [(set (match_operand:SF 0 "fr_register_operand" "=f")
3094 (plus:DF (mult:DF (match_operand:DF 1 "fr_register_operand" "f")
3095 (match_operand:DF 2 "fr_register_operand" "f"))
3096 (match_operand:DF 3 "fr_reg_or_fp01_operand" "fG"))))]
3098 "fma.s %0 = %1, %2, %F3%B0"
3099 [(set_attr "itanium_class" "fmac")])
3101 (define_insn "*msubdf4"
3102 [(set (match_operand:DF 0 "fr_register_operand" "=f")
3103 (minus:DF (mult:DF (match_operand:DF 1 "fr_register_operand" "f")
3104 (match_operand:DF 2 "fr_register_operand" "f"))
3105 (match_operand:DF 3 "fr_reg_or_fp01_operand" "fG")))]
3107 "fms.d %0 = %1, %2, %F3%B0"
3108 [(set_attr "itanium_class" "fmac")])
3110 (define_insn "*msubdf4_trunc"
3111 [(set (match_operand:SF 0 "fr_register_operand" "=f")
3113 (minus:DF (mult:DF (match_operand:DF 1 "fr_register_operand" "f")
3114 (match_operand:DF 2 "fr_register_operand" "f"))
3115 (match_operand:DF 3 "fr_reg_or_fp01_operand" "fG"))))]
3117 "fms.s %0 = %1, %2, %F3%B0"
3118 [(set_attr "itanium_class" "fmac")])
3120 (define_insn "*nmuldf3"
3121 [(set (match_operand:DF 0 "fr_register_operand" "=f")
3122 (neg:DF (mult:DF (match_operand:DF 1 "fr_register_operand" "f")
3123 (match_operand:DF 2 "fr_register_operand" "f"))))]
3125 "fnmpy.d %0 = %1, %2%B0"
3126 [(set_attr "itanium_class" "fmac")])
3128 (define_insn "*nmuldf3_trunc"
3129 [(set (match_operand:SF 0 "fr_register_operand" "=f")
3131 (neg:DF (mult:DF (match_operand:DF 1 "fr_register_operand" "f")
3132 (match_operand:DF 2 "fr_register_operand" "f")))))]
3134 "fnmpy.s %0 = %1, %2%B0"
3135 [(set_attr "itanium_class" "fmac")])
3137 ;; ??? Is it possible to canonicalize this as (minus (reg) (mult))?
3139 (define_insn "*nmadddf4"
3140 [(set (match_operand:DF 0 "fr_register_operand" "=f")
3141 (plus:DF (neg:DF (mult:DF
3142 (match_operand:DF 1 "fr_register_operand" "f")
3143 (match_operand:DF 2 "fr_register_operand" "f")))
3144 (match_operand:DF 3 "fr_reg_or_fp01_operand" "fG")))]
3146 "fnma.d %0 = %1, %2, %F3%B0"
3147 [(set_attr "itanium_class" "fmac")])
3149 (define_insn "*nmadddf4_alts"
3150 [(set (match_operand:DF 0 "fr_register_operand" "=f")
3151 (plus:DF (neg:DF (mult:DF
3152 (match_operand:DF 1 "fr_register_operand" "f")
3153 (match_operand:DF 2 "fr_register_operand" "f")))
3154 (match_operand:DF 3 "fr_reg_or_fp01_operand" "fG")))
3155 (use (match_operand:SI 4 "const_int_operand" ""))]
3157 "fnma.d.s%4 %0 = %1, %2, %F3%B0"
3158 [(set_attr "itanium_class" "fmac")])
3160 (define_insn "*nmadddf4_trunc"
3161 [(set (match_operand:SF 0 "fr_register_operand" "=f")
3163 (plus:DF (neg:DF (mult:DF
3164 (match_operand:DF 1 "fr_register_operand" "f")
3165 (match_operand:DF 2 "fr_register_operand" "f")))
3166 (match_operand:DF 3 "fr_reg_or_fp01_operand" "fG"))))]
3168 "fnma.s %0 = %1, %2, %F3%B0"
3169 [(set_attr "itanium_class" "fmac")])
3171 (define_expand "divdf3"
3172 [(set (match_operand:DF 0 "fr_register_operand" "")
3173 (div:DF (match_operand:DF 1 "fr_register_operand" "")
3174 (match_operand:DF 2 "fr_register_operand" "")))]
3179 if (TARGET_INLINE_DIV_LAT)
3180 insn = gen_divdf3_internal_lat (operands[0], operands[1], operands[2]);
3182 insn = gen_divdf3_internal_thr (operands[0], operands[1], operands[2]);
3187 (define_insn_and_split "divdf3_internal_lat"
3188 [(set (match_operand:DF 0 "fr_register_operand" "=&f")
3189 (div:DF (match_operand:DF 1 "fr_register_operand" "f")
3190 (match_operand:DF 2 "fr_register_operand" "f")))
3191 (clobber (match_scratch:TF 3 "=&f"))
3192 (clobber (match_scratch:TF 4 "=&f"))
3193 (clobber (match_scratch:TF 5 "=&f"))
3194 (clobber (match_scratch:BI 6 "=c"))]
3195 "TARGET_INLINE_DIV_LAT"
3197 "&& reload_completed"
3198 [(parallel [(set (match_dup 7) (div:TF (const_int 1) (match_dup 9)))
3199 (set (match_dup 6) (unspec:BI [(match_dup 8) (match_dup 9)] 5))
3200 (use (const_int 1))])
3201 (cond_exec (ne (match_dup 6) (const_int 0))
3202 (parallel [(set (match_dup 3) (mult:TF (match_dup 8) (match_dup 7)))
3203 (use (const_int 1))]))
3204 (cond_exec (ne (match_dup 6) (const_int 0))
3205 (parallel [(set (match_dup 4)
3206 (plus:TF (neg:TF (mult:TF (match_dup 9) (match_dup 7)))
3208 (use (const_int 1))]))
3209 (cond_exec (ne (match_dup 6) (const_int 0))
3210 (parallel [(set (match_dup 3)
3211 (plus:TF (mult:TF (match_dup 4) (match_dup 3))
3213 (use (const_int 1))]))
3214 (cond_exec (ne (match_dup 6) (const_int 0))
3215 (parallel [(set (match_dup 5) (mult:TF (match_dup 4) (match_dup 4)))
3216 (use (const_int 1))]))
3217 (cond_exec (ne (match_dup 6) (const_int 0))
3218 (parallel [(set (match_dup 7)
3219 (plus:TF (mult:TF (match_dup 4) (match_dup 7))
3221 (use (const_int 1))]))
3222 (cond_exec (ne (match_dup 6) (const_int 0))
3223 (parallel [(set (match_dup 3)
3224 (plus:TF (mult:TF (match_dup 5) (match_dup 3))
3226 (use (const_int 1))]))
3227 (cond_exec (ne (match_dup 6) (const_int 0))
3228 (parallel [(set (match_dup 4) (mult:TF (match_dup 5) (match_dup 5)))
3229 (use (const_int 1))]))
3230 (cond_exec (ne (match_dup 6) (const_int 0))
3231 (parallel [(set (match_dup 7)
3232 (plus:TF (mult:TF (match_dup 5) (match_dup 7))
3234 (use (const_int 1))]))
3235 (cond_exec (ne (match_dup 6) (const_int 0))
3236 (parallel [(set (match_dup 10)
3238 (plus:TF (mult:TF (match_dup 4) (match_dup 3))
3240 (use (const_int 1))]))
3241 (cond_exec (ne (match_dup 6) (const_int 0))
3242 (parallel [(set (match_dup 7)
3243 (plus:TF (mult:TF (match_dup 4) (match_dup 7))
3245 (use (const_int 1))]))
3246 (cond_exec (ne (match_dup 6) (const_int 0))
3247 (parallel [(set (match_dup 11)
3249 (plus:TF (neg:TF (mult:TF (match_dup 9) (match_dup 3)))
3251 (use (const_int 1))]))
3252 (cond_exec (ne (match_dup 6) (const_int 0))
3254 (float_truncate:DF (plus:TF (mult:TF (match_dup 5) (match_dup 7))
3257 "operands[7] = gen_rtx_REG (TFmode, REGNO (operands[0]));
3258 operands[8] = gen_rtx_REG (TFmode, REGNO (operands[1]));
3259 operands[9] = gen_rtx_REG (TFmode, REGNO (operands[2]));
3260 operands[10] = gen_rtx_REG (DFmode, REGNO (operands[3]));
3261 operands[11] = gen_rtx_REG (DFmode, REGNO (operands[5]));
3262 operands[12] = CONST1_RTX (TFmode);"
3263 [(set_attr "predicable" "no")])
3265 (define_insn_and_split "divdf3_internal_thr"
3266 [(set (match_operand:DF 0 "fr_register_operand" "=&f")
3267 (div:DF (match_operand:DF 1 "fr_register_operand" "f")
3268 (match_operand:DF 2 "fr_register_operand" "f")))
3269 (clobber (match_scratch:TF 3 "=&f"))
3270 (clobber (match_scratch:DF 4 "=f"))
3271 (clobber (match_scratch:BI 5 "=c"))]
3272 "TARGET_INLINE_DIV_THR"
3274 "&& reload_completed"
3275 [(parallel [(set (match_dup 6) (div:TF (const_int 1) (match_dup 8)))
3276 (set (match_dup 5) (unspec:BI [(match_dup 7) (match_dup 8)] 5))
3277 (use (const_int 1))])
3278 (cond_exec (ne (match_dup 5) (const_int 0))
3279 (parallel [(set (match_dup 3)
3280 (plus:TF (neg:TF (mult:TF (match_dup 8) (match_dup 6)))
3282 (use (const_int 1))]))
3283 (cond_exec (ne (match_dup 5) (const_int 0))
3284 (parallel [(set (match_dup 6)
3285 (plus:TF (mult:TF (match_dup 3) (match_dup 6))
3287 (use (const_int 1))]))
3288 (cond_exec (ne (match_dup 5) (const_int 0))
3289 (parallel [(set (match_dup 3)
3290 (mult:TF (match_dup 3) (match_dup 3)))
3291 (use (const_int 1))]))
3292 (cond_exec (ne (match_dup 5) (const_int 0))
3293 (parallel [(set (match_dup 6)
3294 (plus:TF (mult:TF (match_dup 3) (match_dup 6))
3296 (use (const_int 1))]))
3297 (cond_exec (ne (match_dup 5) (const_int 0))
3298 (parallel [(set (match_dup 3)
3299 (mult:TF (match_dup 3) (match_dup 3)))
3300 (use (const_int 1))]))
3301 (cond_exec (ne (match_dup 5) (const_int 0))
3302 (parallel [(set (match_dup 6)
3303 (plus:TF (mult:TF (match_dup 3) (match_dup 6))
3305 (use (const_int 1))]))
3306 (cond_exec (ne (match_dup 5) (const_int 0))
3307 (parallel [(set (match_dup 9)
3309 (mult:TF (match_dup 7) (match_dup 3))))
3310 (use (const_int 1))]))
3311 (cond_exec (ne (match_dup 5) (const_int 0))
3312 (parallel [(set (match_dup 4)
3313 (plus:DF (neg:DF (mult:DF (match_dup 2) (match_dup 9)))
3315 (use (const_int 1))]))
3316 (cond_exec (ne (match_dup 5) (const_int 0))
3318 (plus:DF (mult:DF (match_dup 4) (match_dup 0))
3321 "operands[6] = gen_rtx_REG (TFmode, REGNO (operands[0]));
3322 operands[7] = gen_rtx_REG (TFmode, REGNO (operands[1]));
3323 operands[8] = gen_rtx_REG (TFmode, REGNO (operands[2]));
3324 operands[9] = gen_rtx_REG (DFmode, REGNO (operands[3]));
3325 operands[10] = CONST1_RTX (TFmode);"
3326 [(set_attr "predicable" "no")])
3328 ;; ::::::::::::::::::::
3330 ;; :: 80 bit floating point arithmetic
3332 ;; ::::::::::::::::::::
3334 (define_insn "addtf3"
3335 [(set (match_operand:TF 0 "fr_register_operand" "=f")
3336 (plus:TF (match_operand:TF 1 "tfreg_or_fp01_operand" "fG")
3337 (match_operand:TF 2 "tfreg_or_fp01_operand" "fG")))]
3339 "fadd %0 = %F1, %F2%B0"
3340 [(set_attr "itanium_class" "fmac")])
3342 (define_insn "*addtf3_truncsf"
3343 [(set (match_operand:SF 0 "fr_register_operand" "=f")
3345 (plus:TF (match_operand:TF 1 "tfreg_or_fp01_operand" "fG")
3346 (match_operand:TF 2 "tfreg_or_fp01_operand" "fG"))))]
3348 "fadd.s %0 = %F1, %F2%B0"
3349 [(set_attr "itanium_class" "fmac")])
3351 (define_insn "*addtf3_truncdf"
3352 [(set (match_operand:DF 0 "fr_register_operand" "=f")
3354 (plus:TF (match_operand:TF 1 "tfreg_or_fp01_operand" "fG")
3355 (match_operand:TF 2 "tfreg_or_fp01_operand" "fG"))))]
3357 "fadd.d %0 = %F1, %F2%B0"
3358 [(set_attr "itanium_class" "fmac")])
3360 (define_insn "subtf3"
3361 [(set (match_operand:TF 0 "fr_register_operand" "=f")
3362 (minus:TF (match_operand:TF 1 "tfreg_or_fp01_operand" "fG")
3363 (match_operand:TF 2 "tfreg_or_fp01_operand" "fG")))]
3365 "fsub %0 = %F1, %F2%B0"
3366 [(set_attr "itanium_class" "fmac")])
3368 (define_insn "*subtf3_truncsf"
3369 [(set (match_operand:SF 0 "fr_register_operand" "=f")
3371 (minus:TF (match_operand:TF 1 "tfreg_or_fp01_operand" "fG")
3372 (match_operand:TF 2 "tfreg_or_fp01_operand" "fG"))))]
3374 "fsub.s %0 = %F1, %F2%B0"
3375 [(set_attr "itanium_class" "fmac")])
3377 (define_insn "*subtf3_truncdf"
3378 [(set (match_operand:DF 0 "fr_register_operand" "=f")
3380 (minus:TF (match_operand:TF 1 "tfreg_or_fp01_operand" "fG")
3381 (match_operand:TF 2 "tfreg_or_fp01_operand" "fG"))))]
3383 "fsub.d %0 = %F1, %F2%B0"
3384 [(set_attr "itanium_class" "fmac")])
3386 (define_insn "multf3"
3387 [(set (match_operand:TF 0 "fr_register_operand" "=f")
3388 (mult:TF (match_operand:TF 1 "tfreg_or_fp01_operand" "fG")
3389 (match_operand:TF 2 "tfreg_or_fp01_operand" "fG")))]
3391 "fmpy %0 = %F1, %F2%B0"
3392 [(set_attr "itanium_class" "fmac")])
3394 (define_insn "*multf3_truncsf"
3395 [(set (match_operand:SF 0 "fr_register_operand" "=f")
3397 (mult:TF (match_operand:TF 1 "tfreg_or_fp01_operand" "fG")
3398 (match_operand:TF 2 "tfreg_or_fp01_operand" "fG"))))]
3400 "fmpy.s %0 = %F1, %F2%B0"
3401 [(set_attr "itanium_class" "fmac")])
3403 (define_insn "*multf3_truncdf"
3404 [(set (match_operand:DF 0 "fr_register_operand" "=f")
3406 (mult:TF (match_operand:TF 1 "tfreg_or_fp01_operand" "fG")
3407 (match_operand:TF 2 "tfreg_or_fp01_operand" "fG"))))]
3409 "fmpy.d %0 = %F1, %F2%B0"
3410 [(set_attr "itanium_class" "fmac")])
3412 (define_insn "*multf3_alts"
3413 [(set (match_operand:TF 0 "fr_register_operand" "=f")
3414 (mult:TF (match_operand:TF 1 "tfreg_or_fp01_operand" "fG")
3415 (match_operand:TF 2 "tfreg_or_fp01_operand" "fG")))
3416 (use (match_operand:SI 3 "const_int_operand" ""))]
3418 "fmpy.s%3 %0 = %F1, %F2%B0"
3419 [(set_attr "itanium_class" "fmac")])
3421 (define_insn "*multf3_truncsf_alts"
3422 [(set (match_operand:SF 0 "fr_register_operand" "=f")
3424 (mult:TF (match_operand:TF 1 "tfreg_or_fp01_operand" "fG")
3425 (match_operand:TF 2 "tfreg_or_fp01_operand" "fG"))))
3426 (use (match_operand:SI 3 "const_int_operand" ""))]
3428 "fmpy.s.s%3 %0 = %F1, %F2%B0"
3429 [(set_attr "itanium_class" "fmac")])
3431 (define_insn "*multf3_truncdf_alts"
3432 [(set (match_operand:DF 0 "fr_register_operand" "=f")
3434 (mult:TF (match_operand:TF 1 "tfreg_or_fp01_operand" "fG")
3435 (match_operand:TF 2 "tfreg_or_fp01_operand" "fG"))))
3436 (use (match_operand:SI 3 "const_int_operand" ""))]
3438 "fmpy.d.s%3 %0 = %F1, %F2%B0"
3439 [(set_attr "itanium_class" "fmac")])
3441 (define_insn "abstf2"
3442 [(set (match_operand:TF 0 "fr_register_operand" "=f")
3443 (abs:TF (match_operand:TF 1 "tfreg_or_fp01_operand" "fG")))]
3446 [(set_attr "itanium_class" "fmisc")])
3448 (define_insn "negtf2"
3449 [(set (match_operand:TF 0 "fr_register_operand" "=f")
3450 (neg:TF (match_operand:TF 1 "tfreg_or_fp01_operand" "fG")))]
3453 [(set_attr "itanium_class" "fmisc")])
3455 (define_insn "*nabstf2"
3456 [(set (match_operand:TF 0 "fr_register_operand" "=f")
3457 (neg:TF (abs:TF (match_operand:TF 1 "tfreg_or_fp01_operand" "fG"))))]
3459 "fnegabs %0 = %F1%B0"
3460 [(set_attr "itanium_class" "fmisc")])
3462 (define_insn "mintf3"
3463 [(set (match_operand:TF 0 "fr_register_operand" "=f")
3464 (smin:TF (match_operand:TF 1 "tfreg_or_fp01_operand" "fG")
3465 (match_operand:TF 2 "tfreg_or_fp01_operand" "fG")))]
3467 "fmin %0 = %F1, %F2%B0"
3468 [(set_attr "itanium_class" "fmisc")])
3470 (define_insn "maxtf3"
3471 [(set (match_operand:TF 0 "fr_register_operand" "=f")
3472 (smax:TF (match_operand:TF 1 "tfreg_or_fp01_operand" "fG")
3473 (match_operand:TF 2 "tfreg_or_fp01_operand" "fG")))]
3475 "fmax %0 = %F1, %F2%B0"
3476 [(set_attr "itanium_class" "fmisc")])
3478 (define_insn "*maddtf4"
3479 [(set (match_operand:TF 0 "fr_register_operand" "=f")
3480 (plus:TF (mult:TF (match_operand:TF 1 "tfreg_or_fp01_operand" "fG")
3481 (match_operand:TF 2 "tfreg_or_fp01_operand" "fG"))
3482 (match_operand:TF 3 "tfreg_or_fp01_operand" "fG")))]
3484 "fma %0 = %F1, %F2, %F3%B0"
3485 [(set_attr "itanium_class" "fmac")])
3487 (define_insn "*maddtf4_truncsf"
3488 [(set (match_operand:SF 0 "fr_register_operand" "=f")
3490 (plus:TF (mult:TF (match_operand:TF 1 "tfreg_or_fp01_operand" "fG")
3491 (match_operand:TF 2 "tfreg_or_fp01_operand" "fG"))
3492 (match_operand:TF 3 "tfreg_or_fp01_operand" "fG"))))]
3494 "fma.s %0 = %F1, %F2, %F3%B0"
3495 [(set_attr "itanium_class" "fmac")])
3497 (define_insn "*maddtf4_truncdf"
3498 [(set (match_operand:DF 0 "fr_register_operand" "=f")
3500 (plus:TF (mult:TF (match_operand:TF 1 "tfreg_or_fp01_operand" "fG")
3501 (match_operand:TF 2 "tfreg_or_fp01_operand" "fG"))
3502 (match_operand:TF 3 "tfreg_or_fp01_operand" "fG"))))]
3504 "fma.d %0 = %F1, %F2, %F3%B0"
3505 [(set_attr "itanium_class" "fmac")])
3507 (define_insn "*maddtf4_alts"
3508 [(set (match_operand:TF 0 "fr_register_operand" "=f")
3509 (plus:TF (mult:TF (match_operand:TF 1 "tfreg_or_fp01_operand" "fG")
3510 (match_operand:TF 2 "tfreg_or_fp01_operand" "fG"))
3511 (match_operand:TF 3 "tfreg_or_fp01_operand" "fG")))
3512 (use (match_operand:SI 4 "const_int_operand" ""))]
3514 "fma.s%4 %0 = %F1, %F2, %F3%B0"
3515 [(set_attr "itanium_class" "fmac")])
3517 (define_insn "*maddtf4_alts_truncdf"
3518 [(set (match_operand:DF 0 "fr_register_operand" "=f")
3520 (plus:TF (mult:TF (match_operand:TF 1 "tfreg_or_fp01_operand" "fG")
3521 (match_operand:TF 2 "tfreg_or_fp01_operand" "fG"))
3522 (match_operand:TF 3 "tfreg_or_fp01_operand" "fG"))))
3523 (use (match_operand:SI 4 "const_int_operand" ""))]
3525 "fma.d.s%4 %0 = %F1, %F2, %F3%B0"
3526 [(set_attr "itanium_class" "fmac")])
3528 (define_insn "*msubtf4"
3529 [(set (match_operand:TF 0 "fr_register_operand" "=f")
3530 (minus:TF (mult:TF (match_operand:TF 1 "tfreg_or_fp01_operand" "fG")
3531 (match_operand:TF 2 "tfreg_or_fp01_operand" "fG"))
3532 (match_operand:TF 3 "tfreg_or_fp01_operand" "fG")))]
3534 "fms %0 = %F1, %F2, %F3%B0"
3535 [(set_attr "itanium_class" "fmac")])
3537 (define_insn "*msubtf4_truncsf"
3538 [(set (match_operand:SF 0 "fr_register_operand" "=f")
3540 (minus:TF (mult:TF (match_operand:TF 1 "tfreg_or_fp01_operand" "fG")
3541 (match_operand:TF 2 "tfreg_or_fp01_operand" "fG"))
3542 (match_operand:TF 3 "tfreg_or_fp01_operand" "fG"))))]
3544 "fms.s %0 = %F1, %F2, %F3%B0"
3545 [(set_attr "itanium_class" "fmac")])
3547 (define_insn "*msubtf4_truncdf"
3548 [(set (match_operand:DF 0 "fr_register_operand" "=f")
3550 (minus:TF (mult:TF (match_operand:TF 1 "tfreg_or_fp01_operand" "fG")
3551 (match_operand:TF 2 "tfreg_or_fp01_operand" "fG"))
3552 (match_operand:TF 3 "tfreg_or_fp01_operand" "fG"))))]
3554 "fms.d %0 = %F1, %F2, %F3%B0"
3555 [(set_attr "itanium_class" "fmac")])
3557 (define_insn "*nmultf3"
3558 [(set (match_operand:TF 0 "fr_register_operand" "=f")
3559 (neg:TF (mult:TF (match_operand:TF 1 "tfreg_or_fp01_operand" "fG")
3560 (match_operand:TF 2 "tfreg_or_fp01_operand" "fG"))))]
3562 "fnmpy %0 = %F1, %F2%B0"
3563 [(set_attr "itanium_class" "fmac")])
3565 (define_insn "*nmultf3_truncsf"
3566 [(set (match_operand:SF 0 "fr_register_operand" "=f")
3569 (match_operand:TF 1 "tfreg_or_fp01_operand" "fG")
3570 (match_operand:TF 2 "tfreg_or_fp01_operand" "fG")))))]
3572 "fnmpy.s %0 = %F1, %F2%B0"
3573 [(set_attr "itanium_class" "fmac")])
3575 (define_insn "*nmultf3_truncdf"
3576 [(set (match_operand:DF 0 "fr_register_operand" "=f")
3579 (match_operand:TF 1 "tfreg_or_fp01_operand" "fG")
3580 (match_operand:TF 2 "tfreg_or_fp01_operand" "fG")))))]
3582 "fnmpy.d %0 = %F1, %F2%B0"
3583 [(set_attr "itanium_class" "fmac")])
3585 ;; ??? Is it possible to canonicalize this as (minus (reg) (mult))?
3587 (define_insn "*nmaddtf4"
3588 [(set (match_operand:TF 0 "fr_register_operand" "=f")
3589 (plus:TF (neg:TF (mult:TF
3590 (match_operand:TF 1 "tfreg_or_fp01_operand" "fG")
3591 (match_operand:TF 2 "tfreg_or_fp01_operand" "fG")))
3592 (match_operand:TF 3 "tfreg_or_fp01_operand" "fG")))]
3594 "fnma %0 = %F1, %F2, %F3%B0"
3595 [(set_attr "itanium_class" "fmac")])
3597 (define_insn "*nmaddtf4_truncsf"
3598 [(set (match_operand:SF 0 "fr_register_operand" "=f")
3600 (plus:TF (neg:TF (mult:TF
3601 (match_operand:TF 1 "tfreg_or_fp01_operand" "fG")
3602 (match_operand:TF 2 "tfreg_or_fp01_operand" "fG")))
3603 (match_operand:TF 3 "tfreg_or_fp01_operand" "fG"))))]
3605 "fnma.s %0 = %F1, %F2, %F3%B0"
3606 [(set_attr "itanium_class" "fmac")])
3608 (define_insn "*nmaddtf4_truncdf"
3609 [(set (match_operand:DF 0 "fr_register_operand" "=f")
3611 (plus:TF (neg:TF (mult:TF
3612 (match_operand:TF 1 "tfreg_or_fp01_operand" "fG")
3613 (match_operand:TF 2 "tfreg_or_fp01_operand" "fG")))
3614 (match_operand:TF 3 "tfreg_or_fp01_operand" "fG"))))]
3616 "fnma.d %0 = %F1, %F2, %F3%B0"
3617 [(set_attr "itanium_class" "fmac")])
3619 (define_insn "*nmaddtf4_alts"
3620 [(set (match_operand:TF 0 "fr_register_operand" "=f")
3621 (plus:TF (neg:TF (mult:TF
3622 (match_operand:TF 1 "tfreg_or_fp01_operand" "fG")
3623 (match_operand:TF 2 "tfreg_or_fp01_operand" "fG")))
3624 (match_operand:TF 3 "tfreg_or_fp01_operand" "fG")))
3625 (use (match_operand:SI 4 "const_int_operand" ""))]
3627 "fnma.s%4 %0 = %F1, %F2, %F3%B0"
3628 [(set_attr "itanium_class" "fmac")])
3630 (define_insn "*nmaddtf4_truncdf_alts"
3631 [(set (match_operand:DF 0 "fr_register_operand" "=f")
3635 (match_operand:TF 1 "tfreg_or_fp01_operand" "fG")
3636 (match_operand:TF 2 "tfreg_or_fp01_operand" "fG")))
3637 (match_operand:TF 3 "tfreg_or_fp01_operand" "fG"))))
3638 (use (match_operand:SI 4 "const_int_operand" ""))]
3640 "fnma.d.s%4 %0 = %F1, %F2, %F3%B0"
3641 [(set_attr "itanium_class" "fmac")])
3643 (define_expand "divtf3"
3644 [(set (match_operand:TF 0 "fr_register_operand" "")
3645 (div:TF (match_operand:TF 1 "fr_register_operand" "")
3646 (match_operand:TF 2 "fr_register_operand" "")))]
3651 if (TARGET_INLINE_DIV_LAT)
3652 insn = gen_divtf3_internal_lat (operands[0], operands[1], operands[2]);
3654 insn = gen_divtf3_internal_thr (operands[0], operands[1], operands[2]);
3659 (define_insn_and_split "divtf3_internal_lat"
3660 [(set (match_operand:TF 0 "fr_register_operand" "=&f")
3661 (div:TF (match_operand:TF 1 "fr_register_operand" "f")
3662 (match_operand:TF 2 "fr_register_operand" "f")))
3663 (clobber (match_scratch:TF 3 "=&f"))
3664 (clobber (match_scratch:TF 4 "=&f"))
3665 (clobber (match_scratch:TF 5 "=&f"))
3666 (clobber (match_scratch:TF 6 "=&f"))
3667 (clobber (match_scratch:BI 7 "=c"))]
3668 "TARGET_INLINE_DIV_LAT"
3670 "&& reload_completed"
3671 [(parallel [(set (match_dup 0) (div:TF (const_int 1) (match_dup 2)))
3672 (set (match_dup 7) (unspec:BI [(match_dup 1) (match_dup 2)] 5))
3673 (use (const_int 1))])
3674 (cond_exec (ne (match_dup 7) (const_int 0))
3675 (parallel [(set (match_dup 3)
3676 (plus:TF (neg:TF (mult:TF (match_dup 2) (match_dup 0)))
3678 (use (const_int 1))]))
3679 (cond_exec (ne (match_dup 7) (const_int 0))
3680 (parallel [(set (match_dup 4) (mult:TF (match_dup 1) (match_dup 0)))
3681 (use (const_int 1))]))
3682 (cond_exec (ne (match_dup 7) (const_int 0))
3683 (parallel [(set (match_dup 5) (mult:TF (match_dup 3) (match_dup 3)))
3684 (use (const_int 1))]))
3685 (cond_exec (ne (match_dup 7) (const_int 0))
3686 (parallel [(set (match_dup 6)
3687 (plus:TF (mult:TF (match_dup 3) (match_dup 3))
3689 (use (const_int 1))]))
3690 (cond_exec (ne (match_dup 7) (const_int 0))
3691 (parallel [(set (match_dup 3)
3692 (plus:TF (mult:TF (match_dup 5) (match_dup 5))
3694 (use (const_int 1))]))
3695 (cond_exec (ne (match_dup 7) (const_int 0))
3696 (parallel [(set (match_dup 5)
3697 (plus:TF (mult:TF (match_dup 6) (match_dup 0))
3699 (use (const_int 1))]))
3700 (cond_exec (ne (match_dup 7) (const_int 0))
3701 (parallel [(set (match_dup 0)
3702 (plus:TF (mult:TF (match_dup 5) (match_dup 3))
3704 (use (const_int 1))]))
3705 (cond_exec (ne (match_dup 7) (const_int 0))
3706 (parallel [(set (match_dup 4)
3707 (plus:TF (neg:TF (mult:TF (match_dup 2) (match_dup 4)))
3709 (use (const_int 1))]))
3710 (cond_exec (ne (match_dup 7) (const_int 0))
3711 (parallel [(set (match_dup 3)
3712 (plus:TF (mult:TF (match_dup 3) (match_dup 0))
3714 (use (const_int 1))]))
3715 (cond_exec (ne (match_dup 7) (const_int 0))
3716 (parallel [(set (match_dup 5)
3717 (plus:TF (neg:TF (mult:TF (match_dup 2) (match_dup 0)))
3719 (use (const_int 1))]))
3720 (cond_exec (ne (match_dup 7) (const_int 0))
3721 (parallel [(set (match_dup 0)
3722 (plus:TF (mult:TF (match_dup 4) (match_dup 0))
3724 (use (const_int 1))]))
3725 (cond_exec (ne (match_dup 7) (const_int 0))
3726 (parallel [(set (match_dup 4)
3727 (plus:TF (neg:TF (mult:TF (match_dup 2) (match_dup 3)))
3729 (use (const_int 1))]))
3730 (cond_exec (ne (match_dup 7) (const_int 0))
3732 (plus:TF (mult:TF (match_dup 4) (match_dup 0))
3735 "operands[8] = CONST1_RTX (TFmode);"
3736 [(set_attr "predicable" "no")])
3738 (define_insn_and_split "divtf3_internal_thr"
3739 [(set (match_operand:TF 0 "fr_register_operand" "=&f")
3740 (div:TF (match_operand:TF 1 "fr_register_operand" "f")
3741 (match_operand:TF 2 "fr_register_operand" "f")))
3742 (clobber (match_scratch:TF 3 "=&f"))
3743 (clobber (match_scratch:TF 4 "=&f"))
3744 (clobber (match_scratch:BI 5 "=c"))]
3745 "TARGET_INLINE_DIV_THR"
3747 "&& reload_completed"
3748 [(parallel [(set (match_dup 0) (div:TF (const_int 1) (match_dup 2)))
3749 (set (match_dup 5) (unspec:BI [(match_dup 1) (match_dup 2)] 5))
3750 (use (const_int 1))])
3751 (cond_exec (ne (match_dup 5) (const_int 0))
3752 (parallel [(set (match_dup 3)
3753 (plus:TF (neg:TF (mult:TF (match_dup 2) (match_dup 0)))
3755 (use (const_int 1))]))
3756 (cond_exec (ne (match_dup 5) (const_int 0))
3757 (parallel [(set (match_dup 4)
3758 (plus:TF (mult:TF (match_dup 3) (match_dup 0))
3760 (use (const_int 1))]))
3761 (cond_exec (ne (match_dup 5) (const_int 0))
3762 (parallel [(set (match_dup 3) (mult:TF (match_dup 3) (match_dup 3)))
3763 (use (const_int 1))]))
3764 (cond_exec (ne (match_dup 5) (const_int 0))
3765 (parallel [(set (match_dup 3)
3766 (plus:TF (mult:TF (match_dup 3) (match_dup 4))
3768 (use (const_int 1))]))
3769 (cond_exec (ne (match_dup 5) (const_int 0))
3770 (parallel [(set (match_dup 4) (mult:TF (match_dup 1) (match_dup 0)))
3771 (use (const_int 1))]))
3772 (cond_exec (ne (match_dup 5) (const_int 0))
3773 (parallel [(set (match_dup 0)
3774 (plus:TF (neg:TF (mult:TF (match_dup 2) (match_dup 3)))
3776 (use (const_int 1))]))
3777 (cond_exec (ne (match_dup 5) (const_int 0))
3778 (parallel [(set (match_dup 0)
3779 (plus:TF (mult:TF (match_dup 0) (match_dup 3))
3781 (use (const_int 1))]))
3782 (cond_exec (ne (match_dup 5) (const_int 0))
3783 (parallel [(set (match_dup 3)
3784 (plus:TF (neg:TF (mult:TF (match_dup 2) (match_dup 4)))
3786 (use (const_int 1))]))
3787 (cond_exec (ne (match_dup 5) (const_int 0))
3788 (parallel [(set (match_dup 3)
3789 (plus:TF (mult:TF (match_dup 3) (match_dup 0))
3791 (use (const_int 1))]))
3792 (cond_exec (ne (match_dup 5) (const_int 0))
3793 (parallel [(set (match_dup 4)
3794 (plus:TF (neg:TF (mult:TF (match_dup 2) (match_dup 0)))
3796 (use (const_int 1))]))
3797 (cond_exec (ne (match_dup 5) (const_int 0))
3798 (parallel [(set (match_dup 0)
3799 (plus:TF (mult:TF (match_dup 4) (match_dup 0))
3801 (use (const_int 1))]))
3802 (cond_exec (ne (match_dup 5) (const_int 0))
3803 (parallel [(set (match_dup 4)
3804 (plus:TF (neg:TF (mult:TF (match_dup 2) (match_dup 3)))
3806 (use (const_int 1))]))
3807 (cond_exec (ne (match_dup 5) (const_int 0))
3809 (plus:TF (mult:TF (match_dup 4) (match_dup 0))
3812 "operands[6] = CONST1_RTX (TFmode);"
3813 [(set_attr "predicable" "no")])
3815 ;; ??? frcpa works like cmp.foo.unc.
3817 (define_insn "*recip_approx"
3818 [(set (match_operand:TF 0 "fr_register_operand" "=f")
3819 (div:TF (const_int 1)
3820 (match_operand:TF 3 "fr_register_operand" "f")))
3821 (set (match_operand:BI 1 "register_operand" "=c")
3822 (unspec:BI [(match_operand:TF 2 "fr_register_operand" "f")
3824 (use (match_operand:SI 4 "const_int_operand" ""))]
3826 "frcpa.s%4 %0, %1 = %2, %3"
3827 [(set_attr "itanium_class" "fmisc")
3828 (set_attr "predicable" "no")])
3830 ;; ::::::::::::::::::::
3832 ;; :: 32 bit Integer Shifts and Rotates
3834 ;; ::::::::::::::::::::
3836 (define_expand "ashlsi3"
3837 [(set (match_operand:SI 0 "gr_register_operand" "")
3838 (ashift:SI (match_operand:SI 1 "gr_register_operand" "")
3839 (match_operand:SI 2 "gr_reg_or_5bit_operand" "")))]
3843 if (GET_CODE (operands[2]) != CONST_INT)
3845 /* Why oh why didn't Intel arrange for SHIFT_COUNT_TRUNCATED? Now
3846 we've got to get rid of stray bits outside the SImode register. */
3847 rtx subshift = gen_reg_rtx (DImode);
3848 emit_insn (gen_zero_extendsidi2 (subshift, operands[2]));
3849 operands[2] = subshift;
3853 (define_insn "*ashlsi3_internal"
3854 [(set (match_operand:SI 0 "gr_register_operand" "=r,r,r")
3855 (ashift:SI (match_operand:SI 1 "gr_register_operand" "r,r,r")
3856 (match_operand:DI 2 "gr_reg_or_5bit_operand" "R,n,r")))]
3859 shladd %0 = %1, %2, r0
3860 dep.z %0 = %1, %2, %E2
3862 [(set_attr "itanium_class" "ialu,ishf,mmshf")])
3864 (define_expand "ashrsi3"
3865 [(set (match_operand:SI 0 "gr_register_operand" "")
3866 (ashiftrt:SI (match_operand:SI 1 "gr_register_operand" "")
3867 (match_operand:SI 2 "gr_reg_or_5bit_operand" "")))]
3871 rtx subtarget = gen_reg_rtx (DImode);
3872 if (GET_CODE (operands[2]) == CONST_INT)
3873 emit_insn (gen_extv (subtarget, gen_lowpart (DImode, operands[1]),
3874 GEN_INT (32 - INTVAL (operands[2])), operands[2]));
3877 rtx subshift = gen_reg_rtx (DImode);
3878 emit_insn (gen_extendsidi2 (subtarget, operands[1]));
3879 emit_insn (gen_zero_extendsidi2 (subshift, operands[2]));
3880 emit_insn (gen_ashrdi3 (subtarget, subtarget, subshift));
3882 emit_move_insn (gen_lowpart (DImode, operands[0]), subtarget);
3886 (define_expand "lshrsi3"
3887 [(set (match_operand:SI 0 "gr_register_operand" "")
3888 (lshiftrt:SI (match_operand:SI 1 "gr_register_operand" "")
3889 (match_operand:SI 2 "gr_reg_or_5bit_operand" "")))]
3893 rtx subtarget = gen_reg_rtx (DImode);
3894 if (GET_CODE (operands[2]) == CONST_INT)
3895 emit_insn (gen_extzv (subtarget, gen_lowpart (DImode, operands[1]),
3896 GEN_INT (32 - INTVAL (operands[2])), operands[2]));
3899 rtx subshift = gen_reg_rtx (DImode);
3900 emit_insn (gen_zero_extendsidi2 (subtarget, operands[1]));
3901 emit_insn (gen_zero_extendsidi2 (subshift, operands[2]));
3902 emit_insn (gen_lshrdi3 (subtarget, subtarget, subshift));
3904 emit_move_insn (gen_lowpart (DImode, operands[0]), subtarget);
3908 ;; Use mix4.r/shr to implement rotrsi3. We only get 32 bits of valid result
3909 ;; here, instead of 64 like the patterns above. Keep the pattern together
3910 ;; until after combine; otherwise it won't get matched often.
3912 (define_expand "rotrsi3"
3913 [(set (match_operand:SI 0 "gr_register_operand" "")
3914 (rotatert:SI (match_operand:SI 1 "gr_register_operand" "")
3915 (match_operand:SI 2 "gr_reg_or_5bit_operand" "")))]
3919 if (GET_MODE (operands[2]) != VOIDmode)
3921 rtx tmp = gen_reg_rtx (DImode);
3922 emit_insn (gen_zero_extendsidi2 (tmp, operands[2]));
3927 (define_insn_and_split "*rotrsi3_internal"
3928 [(set (match_operand:SI 0 "gr_register_operand" "=&r")
3929 (rotatert:SI (match_operand:SI 1 "gr_register_operand" "r")
3930 (match_operand:DI 2 "gr_reg_or_5bit_operand" "rM")))]
3935 (ior:DI (zero_extend:DI (match_dup 1))
3936 (ashift:DI (zero_extend:DI (match_dup 1)) (const_int 32))))
3938 (lshiftrt:DI (match_dup 3) (match_dup 2)))]
3939 "operands[3] = gen_rtx_REG (DImode, REGNO (operands[0]));")
3941 (define_expand "rotlsi3"
3942 [(set (match_operand:SI 0 "gr_register_operand" "")
3943 (rotate:SI (match_operand:SI 1 "gr_register_operand" "")
3944 (match_operand:SI 2 "gr_reg_or_5bit_operand" "")))]
3948 if (! shift_32bit_count_operand (operands[2], SImode))
3950 rtx tmp = gen_reg_rtx (SImode);
3951 emit_insn (gen_subsi3 (tmp, GEN_INT (32), operands[2]));
3952 emit_insn (gen_rotrsi3 (operands[0], operands[1], tmp));
3957 (define_insn_and_split "*rotlsi3_internal"
3958 [(set (match_operand:SI 0 "gr_register_operand" "=r")
3959 (rotate:SI (match_operand:SI 1 "gr_register_operand" "r")
3960 (match_operand:SI 2 "shift_32bit_count_operand" "n")))]
3965 (ior:DI (zero_extend:DI (match_dup 1))
3966 (ashift:DI (zero_extend:DI (match_dup 1)) (const_int 32))))
3968 (lshiftrt:DI (match_dup 3) (match_dup 2)))]
3969 "operands[3] = gen_rtx_REG (DImode, REGNO (operands[0]));
3970 operands[2] = GEN_INT (32 - INTVAL (operands[2]));")
3972 ;; ::::::::::::::::::::
3974 ;; :: 64 bit Integer Shifts and Rotates
3976 ;; ::::::::::::::::::::
3978 (define_insn "ashldi3"
3979 [(set (match_operand:DI 0 "gr_register_operand" "=r,r,r")
3980 (ashift:DI (match_operand:DI 1 "gr_register_operand" "r,r,r")
3981 (match_operand:DI 2 "gr_reg_or_6bit_operand" "R,r,rM")))]
3984 shladd %0 = %1, %2, r0
3987 [(set_attr "itanium_class" "ialu,mmshf,mmshfi")])
3989 ;; ??? Maybe combine this with the multiply and add instruction?
3991 (define_insn "*shladd"
3992 [(set (match_operand:DI 0 "gr_register_operand" "=r")
3993 (plus:DI (mult:DI (match_operand:DI 1 "gr_register_operand" "r")
3994 (match_operand:DI 2 "shladd_operand" "n"))
3995 (match_operand:DI 3 "gr_register_operand" "r")))]
3997 "shladd %0 = %1, %S2, %3"
3998 [(set_attr "itanium_class" "ialu")])
4000 ;; This can be created by register elimination if operand3 of shladd is an
4001 ;; eliminable register or has reg_equiv_constant set.
4003 ;; We have to use nonmemory_operand for operand 4, to ensure that the
4004 ;; validate_changes call inside eliminate_regs will always succeed. If it
4005 ;; doesn't succeed, then this remain a shladd pattern, and will be reloaded
4008 (define_insn_and_split "*shladd_elim"
4009 [(set (match_operand:DI 0 "gr_register_operand" "=&r")
4010 (plus:DI (plus:DI (mult:DI (match_operand:DI 1 "gr_register_operand" "r")
4011 (match_operand:DI 2 "shladd_operand" "n"))
4012 (match_operand:DI 3 "nonmemory_operand" "r"))
4013 (match_operand:DI 4 "nonmemory_operand" "rI")))]
4014 "reload_in_progress"
4017 [(set (match_dup 0) (plus:DI (mult:DI (match_dup 1) (match_dup 2))
4019 (set (match_dup 0) (plus:DI (match_dup 0) (match_dup 4)))]
4021 [(set_attr "itanium_class" "unknown")])
4023 (define_insn "ashrdi3"
4024 [(set (match_operand:DI 0 "gr_register_operand" "=r,r")
4025 (ashiftrt:DI (match_operand:DI 1 "gr_register_operand" "r,r")
4026 (match_operand:DI 2 "gr_reg_or_6bit_operand" "r,rM")))]
4031 [(set_attr "itanium_class" "mmshf,mmshfi")])
4033 (define_insn "lshrdi3"
4034 [(set (match_operand:DI 0 "gr_register_operand" "=r,r")
4035 (lshiftrt:DI (match_operand:DI 1 "gr_register_operand" "r,r")
4036 (match_operand:DI 2 "gr_reg_or_6bit_operand" "r,rM")))]
4041 [(set_attr "itanium_class" "mmshf,mmshfi")])
4043 ;; Using a predicate that accepts only constants doesn't work, because optabs
4044 ;; will load the operand into a register and call the pattern if the predicate
4045 ;; did not accept it on the first try. So we use nonmemory_operand and then
4046 ;; verify that we have an appropriate constant in the expander.
4048 (define_expand "rotrdi3"
4049 [(set (match_operand:DI 0 "gr_register_operand" "")
4050 (rotatert:DI (match_operand:DI 1 "gr_register_operand" "")
4051 (match_operand:DI 2 "nonmemory_operand" "")))]
4055 if (! shift_count_operand (operands[2], DImode))
4059 (define_insn "*rotrdi3_internal"
4060 [(set (match_operand:DI 0 "gr_register_operand" "=r")
4061 (rotatert:DI (match_operand:DI 1 "gr_register_operand" "r")
4062 (match_operand:DI 2 "shift_count_operand" "M")))]
4064 "shrp %0 = %1, %1, %2"
4065 [(set_attr "itanium_class" "ishf")])
4067 (define_expand "rotldi3"
4068 [(set (match_operand:DI 0 "gr_register_operand" "")
4069 (rotate:DI (match_operand:DI 1 "gr_register_operand" "")
4070 (match_operand:DI 2 "nonmemory_operand" "")))]
4074 if (! shift_count_operand (operands[2], DImode))
4078 (define_insn "*rotldi3_internal"
4079 [(set (match_operand:DI 0 "gr_register_operand" "=r")
4080 (rotate:DI (match_operand:DI 1 "gr_register_operand" "r")
4081 (match_operand:DI 2 "shift_count_operand" "M")))]
4083 "shrp %0 = %1, %1, %e2"
4084 [(set_attr "itanium_class" "ishf")])
4086 ;; ::::::::::::::::::::
4088 ;; :: 32 bit Integer Logical operations
4090 ;; ::::::::::::::::::::
4092 ;; We don't seem to need any other 32-bit logical operations, because gcc
4093 ;; generates zero-extend;zero-extend;DImode-op, which combine optimizes to
4094 ;; DImode-op;zero-extend, and then we can optimize away the zero-extend.
4095 ;; This doesn't work for unary logical operations, because we don't call
4096 ;; apply_distributive_law for them.
4098 ;; ??? Likewise, this doesn't work for andnot, which isn't handled by
4099 ;; apply_distributive_law. We get inefficient code for
4100 ;; int sub4 (int i, int j) { return i & ~j; }
4101 ;; We could convert (and (not (sign_extend A)) (sign_extend B)) to
4102 ;; (zero_extend (and (not A) B)) in combine.
4103 ;; Or maybe fix this by adding andsi3/iorsi3/xorsi3 patterns like the
4104 ;; one_cmplsi2 pattern.
4106 (define_insn "one_cmplsi2"
4107 [(set (match_operand:SI 0 "gr_register_operand" "=r")
4108 (not:SI (match_operand:SI 1 "gr_register_operand" "r")))]
4111 [(set_attr "itanium_class" "ilog")])
4113 ;; ::::::::::::::::::::
4115 ;; :: 64 bit Integer Logical operations
4117 ;; ::::::::::::::::::::
4119 (define_insn "anddi3"
4120 [(set (match_operand:DI 0 "grfr_register_operand" "=r,*f")
4121 (and:DI (match_operand:DI 1 "grfr_register_operand" "%r,*f")
4122 (match_operand:DI 2 "grfr_reg_or_8bit_operand" "rK,*f")))]
4126 fand %0 = %2, %1%B0"
4127 [(set_attr "itanium_class" "ilog,fmisc")])
4129 (define_insn "*andnot"
4130 [(set (match_operand:DI 0 "grfr_register_operand" "=r,*f")
4131 (and:DI (not:DI (match_operand:DI 1 "grfr_register_operand" "r,*f"))
4132 (match_operand:DI 2 "grfr_reg_or_8bit_operand" "rK,*f")))]
4136 fandcm %0 = %2, %1%B0"
4137 [(set_attr "itanium_class" "ilog,fmisc")])
4139 (define_insn "iordi3"
4140 [(set (match_operand:DI 0 "grfr_register_operand" "=r,*f")
4141 (ior:DI (match_operand:DI 1 "grfr_register_operand" "%r,*f")
4142 (match_operand:DI 2 "grfr_reg_or_8bit_operand" "rK,*f")))]
4147 [(set_attr "itanium_class" "ilog,fmisc")])
4149 (define_insn "xordi3"
4150 [(set (match_operand:DI 0 "grfr_register_operand" "=r,*f")
4151 (xor:DI (match_operand:DI 1 "grfr_register_operand" "%r,*f")
4152 (match_operand:DI 2 "grfr_reg_or_8bit_operand" "rK,*f")))]
4156 fxor %0 = %2, %1%B0"
4157 [(set_attr "itanium_class" "ilog,fmisc")])
4159 (define_insn "one_cmpldi2"
4160 [(set (match_operand:DI 0 "gr_register_operand" "=r")
4161 (not:DI (match_operand:DI 1 "gr_register_operand" "r")))]
4164 [(set_attr "itanium_class" "ilog")])
4166 ;; ::::::::::::::::::::
4170 ;; ::::::::::::::::::::
4172 (define_expand "cmpbi"
4174 (compare (match_operand:BI 0 "register_operand" "")
4175 (match_operand:BI 1 "const_int_operand" "")))]
4179 ia64_compare_op0 = operands[0];
4180 ia64_compare_op1 = operands[1];
4184 (define_expand "cmpsi"
4186 (compare (match_operand:SI 0 "gr_register_operand" "")
4187 (match_operand:SI 1 "gr_reg_or_8bit_and_adjusted_operand" "")))]
4191 ia64_compare_op0 = operands[0];
4192 ia64_compare_op1 = operands[1];
4196 (define_expand "cmpdi"
4198 (compare (match_operand:DI 0 "gr_register_operand" "")
4199 (match_operand:DI 1 "gr_reg_or_8bit_and_adjusted_operand" "")))]
4203 ia64_compare_op0 = operands[0];
4204 ia64_compare_op1 = operands[1];
4208 (define_expand "cmpsf"
4210 (compare (match_operand:SF 0 "fr_reg_or_fp01_operand" "")
4211 (match_operand:SF 1 "fr_reg_or_fp01_operand" "")))]
4215 ia64_compare_op0 = operands[0];
4216 ia64_compare_op1 = operands[1];
4220 (define_expand "cmpdf"
4222 (compare (match_operand:DF 0 "fr_reg_or_fp01_operand" "")
4223 (match_operand:DF 1 "fr_reg_or_fp01_operand" "")))]
4227 ia64_compare_op0 = operands[0];
4228 ia64_compare_op1 = operands[1];
4232 (define_expand "cmptf"
4234 (compare (match_operand:TF 0 "tfreg_or_fp01_operand" "")
4235 (match_operand:TF 1 "tfreg_or_fp01_operand" "")))]
4239 ia64_compare_op0 = operands[0];
4240 ia64_compare_op1 = operands[1];
4244 (define_insn "*cmpsi_normal"
4245 [(set (match_operand:BI 0 "register_operand" "=c")
4246 (match_operator:BI 1 "normal_comparison_operator"
4247 [(match_operand:SI 2 "gr_register_operand" "r")
4248 (match_operand:SI 3 "gr_reg_or_8bit_operand" "rK")]))]
4250 "cmp4.%C1 %0, %I0 = %3, %2"
4251 [(set_attr "itanium_class" "icmp")])
4253 ;; We use %r3 because it is possible for us to match a 0, and two of the
4254 ;; unsigned comparisons don't accept immediate operands of zero.
4256 (define_insn "*cmpsi_adjusted"
4257 [(set (match_operand:BI 0 "register_operand" "=c")
4258 (match_operator:BI 1 "adjusted_comparison_operator"
4259 [(match_operand:SI 2 "gr_register_operand" "r")
4260 (match_operand:SI 3 "gr_reg_or_8bit_adjusted_operand" "rL")]))]
4262 "cmp4.%C1 %0, %I0 = %r3, %2"
4263 [(set_attr "itanium_class" "icmp")])
4265 (define_insn "*cmpdi_normal"
4266 [(set (match_operand:BI 0 "register_operand" "=c")
4267 (match_operator:BI 1 "normal_comparison_operator"
4268 [(match_operand:DI 2 "gr_reg_or_0_operand" "rO")
4269 (match_operand:DI 3 "gr_reg_or_8bit_operand" "rK")]))]
4271 "cmp.%C1 %0, %I0 = %3, %r2"
4272 [(set_attr "itanium_class" "icmp")])
4274 ;; We use %r3 because it is possible for us to match a 0, and two of the
4275 ;; unsigned comparisons don't accept immediate operands of zero.
4277 (define_insn "*cmpdi_adjusted"
4278 [(set (match_operand:BI 0 "register_operand" "=c")
4279 (match_operator:BI 1 "adjusted_comparison_operator"
4280 [(match_operand:DI 2 "gr_register_operand" "r")
4281 (match_operand:DI 3 "gr_reg_or_8bit_adjusted_operand" "rL")]))]
4283 "cmp.%C1 %0, %I0 = %r3, %2"
4284 [(set_attr "itanium_class" "icmp")])
4286 (define_insn "*cmpsf_internal"
4287 [(set (match_operand:BI 0 "register_operand" "=c")
4288 (match_operator:BI 1 "comparison_operator"
4289 [(match_operand:SF 2 "fr_reg_or_fp01_operand" "fG")
4290 (match_operand:SF 3 "fr_reg_or_fp01_operand" "fG")]))]
4292 "fcmp.%D1 %0, %I0 = %F2, %F3"
4293 [(set_attr "itanium_class" "fcmp")])
4295 (define_insn "*cmpdf_internal"
4296 [(set (match_operand:BI 0 "register_operand" "=c")
4297 (match_operator:BI 1 "comparison_operator"
4298 [(match_operand:DF 2 "fr_reg_or_fp01_operand" "fG")
4299 (match_operand:DF 3 "fr_reg_or_fp01_operand" "fG")]))]
4301 "fcmp.%D1 %0, %I0 = %F2, %F3"
4302 [(set_attr "itanium_class" "fcmp")])
4304 (define_insn "*cmptf_internal"
4305 [(set (match_operand:BI 0 "register_operand" "=c")
4306 (match_operator:BI 1 "comparison_operator"
4307 [(match_operand:TF 2 "tfreg_or_fp01_operand" "fG")
4308 (match_operand:TF 3 "tfreg_or_fp01_operand" "fG")]))]
4310 "fcmp.%D1 %0, %I0 = %F2, %F3"
4311 [(set_attr "itanium_class" "fcmp")])
4313 ;; ??? Can this pattern be generated?
4315 (define_insn "*bit_zero"
4316 [(set (match_operand:BI 0 "register_operand" "=c")
4317 (eq:BI (zero_extract:DI (match_operand:DI 1 "gr_register_operand" "r")
4319 (match_operand:DI 2 "immediate_operand" "n"))
4322 "tbit.z %0, %I0 = %1, %2"
4323 [(set_attr "itanium_class" "tbit")])
4325 (define_insn "*bit_one"
4326 [(set (match_operand:BI 0 "register_operand" "=c")
4327 (ne:BI (zero_extract:DI (match_operand:DI 1 "gr_register_operand" "r")
4329 (match_operand:DI 2 "immediate_operand" "n"))
4332 "tbit.nz %0, %I0 = %1, %2"
4333 [(set_attr "itanium_class" "tbit")])
4335 ;; ::::::::::::::::::::
4339 ;; ::::::::::::::::::::
4341 (define_expand "beq"
4343 (if_then_else (match_dup 1)
4344 (label_ref (match_operand 0 "" ""))
4347 "operands[1] = ia64_expand_compare (EQ, VOIDmode);")
4349 (define_expand "bne"
4351 (if_then_else (match_dup 1)
4352 (label_ref (match_operand 0 "" ""))
4355 "operands[1] = ia64_expand_compare (NE, VOIDmode);")
4357 (define_expand "blt"
4359 (if_then_else (match_dup 1)
4360 (label_ref (match_operand 0 "" ""))
4363 "operands[1] = ia64_expand_compare (LT, VOIDmode);")
4365 (define_expand "ble"
4367 (if_then_else (match_dup 1)
4368 (label_ref (match_operand 0 "" ""))
4371 "operands[1] = ia64_expand_compare (LE, VOIDmode);")
4373 (define_expand "bgt"
4375 (if_then_else (match_dup 1)
4376 (label_ref (match_operand 0 "" ""))
4379 "operands[1] = ia64_expand_compare (GT, VOIDmode);")
4381 (define_expand "bge"
4383 (if_then_else (match_dup 1)
4384 (label_ref (match_operand 0 "" ""))
4387 "operands[1] = ia64_expand_compare (GE, VOIDmode);")
4389 (define_expand "bltu"
4391 (if_then_else (match_dup 1)
4392 (label_ref (match_operand 0 "" ""))
4395 "operands[1] = ia64_expand_compare (LTU, VOIDmode);")
4397 (define_expand "bleu"
4399 (if_then_else (match_dup 1)
4400 (label_ref (match_operand 0 "" ""))
4403 "operands[1] = ia64_expand_compare (LEU, VOIDmode);")
4405 (define_expand "bgtu"
4407 (if_then_else (match_dup 1)
4408 (label_ref (match_operand 0 "" ""))
4411 "operands[1] = ia64_expand_compare (GTU, VOIDmode);")
4413 (define_expand "bgeu"
4415 (if_then_else (match_dup 1)
4416 (label_ref (match_operand 0 "" ""))
4419 "operands[1] = ia64_expand_compare (GEU, VOIDmode);")
4421 (define_expand "bunordered"
4423 (if_then_else (match_dup 1)
4424 (label_ref (match_operand 0 "" ""))
4427 "operands[1] = ia64_expand_compare (UNORDERED, VOIDmode);")
4429 (define_expand "bordered"
4431 (if_then_else (match_dup 1)
4432 (label_ref (match_operand 0 "" ""))
4435 "operands[1] = ia64_expand_compare (ORDERED, VOIDmode);")
4437 (define_insn "*br_true"
4439 (if_then_else (match_operator 0 "predicate_operator"
4440 [(match_operand:BI 1 "register_operand" "c")
4442 (label_ref (match_operand 2 "" ""))
4445 "(%J0) br.cond%+ %l2"
4446 [(set_attr "itanium_class" "br")
4447 (set_attr "predicable" "no")])
4449 (define_insn "*br_false"
4451 (if_then_else (match_operator 0 "predicate_operator"
4452 [(match_operand:BI 1 "register_operand" "c")
4455 (label_ref (match_operand 2 "" ""))))]
4457 "(%j0) br.cond%+ %l2"
4458 [(set_attr "itanium_class" "br")
4459 (set_attr "predicable" "no")])
4461 ;; ::::::::::::::::::::
4463 ;; :: Counted loop operations
4465 ;; ::::::::::::::::::::
4467 (define_expand "doloop_end"
4468 [(use (match_operand 0 "" "")) ; loop pseudo
4469 (use (match_operand 1 "" "")) ; iterations; zero if unknown
4470 (use (match_operand 2 "" "")) ; max iterations
4471 (use (match_operand 3 "" "")) ; loop level
4472 (use (match_operand 4 "" ""))] ; label
4476 /* Only use cloop on innermost loops. */
4477 if (INTVAL (operands[3]) > 1)
4479 emit_jump_insn (gen_doloop_end_internal (gen_rtx_REG (DImode, AR_LC_REGNUM),
4484 (define_insn "doloop_end_internal"
4485 [(set (pc) (if_then_else (ne (match_operand:DI 0 "ar_lc_reg_operand" "")
4487 (label_ref (match_operand 1 "" ""))
4489 (set (match_dup 0) (if_then_else:DI (ne (match_dup 0) (const_int 0))
4491 (plus:DI (match_dup 0) (const_int -1))))]
4493 "br.cloop.sptk.few %l1"
4494 [(set_attr "itanium_class" "br")
4495 (set_attr "predicable" "no")])
4497 ;; ::::::::::::::::::::
4499 ;; :: Set flag operations
4501 ;; ::::::::::::::::::::
4503 (define_expand "seq"
4504 [(set (match_operand:DI 0 "gr_register_operand" "") (match_dup 1))]
4506 "operands[1] = ia64_expand_compare (EQ, DImode);")
4508 (define_expand "sne"
4509 [(set (match_operand:DI 0 "gr_register_operand" "") (match_dup 1))]
4511 "operands[1] = ia64_expand_compare (NE, DImode);")
4513 (define_expand "slt"
4514 [(set (match_operand:DI 0 "gr_register_operand" "") (match_dup 1))]
4516 "operands[1] = ia64_expand_compare (LT, DImode);")
4518 (define_expand "sle"
4519 [(set (match_operand:DI 0 "gr_register_operand" "") (match_dup 1))]
4521 "operands[1] = ia64_expand_compare (LE, DImode);")
4523 (define_expand "sgt"
4524 [(set (match_operand:DI 0 "gr_register_operand" "") (match_dup 1))]
4526 "operands[1] = ia64_expand_compare (GT, DImode);")
4528 (define_expand "sge"
4529 [(set (match_operand:DI 0 "gr_register_operand" "") (match_dup 1))]
4531 "operands[1] = ia64_expand_compare (GE, DImode);")
4533 (define_expand "sltu"
4534 [(set (match_operand:DI 0 "gr_register_operand" "") (match_dup 1))]
4536 "operands[1] = ia64_expand_compare (LTU, DImode);")
4538 (define_expand "sleu"
4539 [(set (match_operand:DI 0 "gr_register_operand" "") (match_dup 1))]
4541 "operands[1] = ia64_expand_compare (LEU, DImode);")
4543 (define_expand "sgtu"
4544 [(set (match_operand:DI 0 "gr_register_operand" "") (match_dup 1))]
4546 "operands[1] = ia64_expand_compare (GTU, DImode);")
4548 (define_expand "sgeu"
4549 [(set (match_operand:DI 0 "gr_register_operand" "") (match_dup 1))]
4551 "operands[1] = ia64_expand_compare (GEU, DImode);")
4553 (define_expand "sunordered"
4554 [(set (match_operand:DI 0 "gr_register_operand" "") (match_dup 1))]
4556 "operands[1] = ia64_expand_compare (UNORDERED, DImode);")
4558 (define_expand "sordered"
4559 [(set (match_operand:DI 0 "gr_register_operand" "") (match_dup 1))]
4561 "operands[1] = ia64_expand_compare (ORDERED, DImode);")
4563 ;; Don't allow memory as destination here, because cmov/cmov/st is more
4564 ;; efficient than mov/mov/cst/cst.
4566 (define_insn_and_split "*sne_internal"
4567 [(set (match_operand:DI 0 "gr_register_operand" "=r")
4568 (ne:DI (match_operand:BI 1 "register_operand" "c")
4573 [(cond_exec (ne (match_dup 1) (const_int 0))
4574 (set (match_dup 0) (const_int 1)))
4575 (cond_exec (eq (match_dup 1) (const_int 0))
4576 (set (match_dup 0) (const_int 0)))]
4578 [(set_attr "itanium_class" "unknown")])
4580 (define_insn_and_split "*seq_internal"
4581 [(set (match_operand:DI 0 "gr_register_operand" "=r")
4582 (eq:DI (match_operand:BI 1 "register_operand" "c")
4587 [(cond_exec (ne (match_dup 1) (const_int 0))
4588 (set (match_dup 0) (const_int 0)))
4589 (cond_exec (eq (match_dup 1) (const_int 0))
4590 (set (match_dup 0) (const_int 1)))]
4592 [(set_attr "itanium_class" "unknown")])
4594 ;; ::::::::::::::::::::
4596 ;; :: Conditional move instructions.
4598 ;; ::::::::::::::::::::
4600 ;; ??? Add movXXcc patterns?
4603 ;; DImode if_then_else patterns.
4606 ;; Errata 72 workaround.
4607 (define_insn "*cmovdi_internal_astep"
4608 [(set (match_operand:DI 0 "register_operand"
4609 "=r, r, r, r, r, r, r, r, r, r,*f,*b,*d*e")
4611 (match_operator 4 "predicate_operator"
4612 [(match_operand:BI 1 "register_operand"
4613 " c, c, c, c, c, c, c, c, c, c, c, c, c")
4615 (match_operand:DI 2 "move_operand"
4616 "ri,*f,*b,*d*e,ri,ri, ri,*f,*b,*d*e,rO,rO, rK")
4617 (match_operand:DI 3 "move_operand"
4618 "ri,ri,ri, ri,*f,*b,*d*e,*f,*b,*d*e,rO,rO, rK")))]
4620 && ia64_move_ok (operands[0], operands[2])
4621 && ia64_move_ok (operands[0], operands[3])"
4623 [(set_attr "predicable" "no")])
4625 (define_insn "*cmovdi_internal"
4626 [(set (match_operand:DI 0 "destination_operand"
4627 "= r, r, r, r, r, r, r, r, r, r, m, Q, *f,*b,*d*e")
4629 (match_operator 4 "predicate_operator"
4630 [(match_operand:BI 1 "register_operand"
4631 "c,c,c,c,c,c,c,c,c,c,c,c,c,c,c")
4633 (match_operand:DI 2 "move_operand"
4634 "rim, *f, *b,*d*e,rim,rim, rim,*f,*b,*d*e,rO,*f,rOQ,rO, rK")
4635 (match_operand:DI 3 "move_operand"
4636 "rim,rim,rim, rim, *f, *b,*d*e,*f,*b,*d*e,rO,*f,rOQ,rO, rK")))]
4638 && ia64_move_ok (operands[0], operands[2])
4639 && ia64_move_ok (operands[0], operands[3])"
4641 [(set_attr "predicable" "no")])
4644 [(set (match_operand 0 "destination_operand" "")
4646 (match_operator 4 "predicate_operator"
4647 [(match_operand:BI 1 "register_operand" "")
4649 (match_operand 2 "move_operand" "")
4650 (match_operand 3 "move_operand" "")))]
4656 if (! rtx_equal_p (operands[0], operands[2]))
4658 tmp = gen_rtx_SET (VOIDmode, operands[0], operands[2]);
4659 tmp = gen_rtx_COND_EXEC (VOIDmode, operands[4], tmp);
4662 if (! rtx_equal_p (operands[0], operands[3]))
4664 tmp = gen_rtx_fmt_ee (GET_CODE (operands[4]) == NE ? EQ : NE,
4665 VOIDmode, operands[1], const0_rtx);
4666 tmp = gen_rtx_COND_EXEC (VOIDmode, tmp,
4667 gen_rtx_SET (VOIDmode, operands[0],
4674 ;; Absolute value pattern.
4676 (define_insn "*absdi2_internal"
4677 [(set (match_operand:DI 0 "gr_register_operand" "=r,r")
4679 (match_operator 4 "predicate_operator"
4680 [(match_operand:BI 1 "register_operand" "c,c")
4682 (neg:DI (match_operand:DI 2 "gr_reg_or_22bit_operand" "rI,rI"))
4683 (match_operand:DI 3 "gr_reg_or_22bit_operand" "0,rI")))]
4686 [(set_attr "itanium_class" "ialu,unknown")
4687 (set_attr "predicable" "no")])
4690 [(set (match_operand:DI 0 "register_operand" "")
4692 (match_operator 4 "predicate_operator"
4693 [(match_operand:BI 1 "register_operand" "c,c")
4695 (neg:DI (match_operand:DI 2 "gr_reg_or_22bit_operand" ""))
4696 (match_operand:DI 3 "gr_reg_or_22bit_operand" "")))]
4697 "reload_completed && rtx_equal_p (operands[0], operands[3])"
4701 (neg:DI (match_dup 2))))]
4705 [(set (match_operand:DI 0 "register_operand" "")
4707 (match_operator 4 "predicate_operator"
4708 [(match_operand:BI 1 "register_operand" "c,c")
4710 (neg:DI (match_operand:DI 2 "gr_reg_or_22bit_operand" ""))
4711 (match_operand:DI 3 "gr_reg_or_22bit_operand" "")))]
4715 (set (match_dup 0) (neg:DI (match_dup 2))))
4718 (set (match_dup 0) (match_dup 3)))]
4721 operands[5] = gen_rtx_fmt_ee (GET_CODE (operands[4]) == NE ? EQ : NE,
4722 VOIDmode, operands[1], const0_rtx);
4726 ;; SImode if_then_else patterns.
4729 (define_insn "*cmovsi_internal_astep"
4730 [(set (match_operand:SI 0 "register_operand" "=r,*f,r,*f,r,*f")
4732 (match_operator 4 "predicate_operator"
4733 [(match_operand:BI 1 "register_operand" "c,c,c,c,c,c")
4735 (match_operand:SI 2 "move_operand" "0,0,ri*f,rO,ri*f,rO")
4736 (match_operand:SI 3 "move_operand" "ri*f,rO,0,0,ri*f,rO")))]
4738 && ia64_move_ok (operands[0], operands[2])
4739 && ia64_move_ok (operands[0], operands[3])"
4741 [(set_attr "predicable" "no")])
4743 (define_insn "*cmovsi_internal"
4744 [(set (match_operand:SI 0 "destination_operand" "=r,m,*f,r,m,*f,r,m,*f")
4746 (match_operator 4 "predicate_operator"
4747 [(match_operand:BI 1 "register_operand" "c,c,c,c,c,c,c,c,c")
4749 (match_operand:SI 2 "move_operand"
4750 "0,0,0,rim*f,rO,rO,rim*f,rO,rO")
4751 (match_operand:SI 3 "move_operand"
4752 "rim*f,rO,rO,0,0,0,rim*f,rO,rO")))]
4754 && ia64_move_ok (operands[0], operands[2])
4755 && ia64_move_ok (operands[0], operands[3])"
4757 [(set_attr "predicable" "no")])
4759 (define_insn "*abssi2_internal"
4760 [(set (match_operand:SI 0 "gr_register_operand" "=r,r")
4762 (match_operator 4 "predicate_operator"
4763 [(match_operand:BI 1 "register_operand" "c,c")
4765 (neg:SI (match_operand:SI 3 "gr_reg_or_22bit_operand" "rI,rI"))
4766 (match_operand:SI 2 "gr_reg_or_22bit_operand" "0,rI")))]
4769 [(set_attr "itanium_class" "ialu,unknown")
4770 (set_attr "predicable" "no")])
4773 [(set (match_operand:SI 0 "register_operand" "")
4775 (match_operator 4 "predicate_operator"
4776 [(match_operand:BI 1 "register_operand" "c,c")
4778 (neg:SI (match_operand:SI 2 "gr_reg_or_22bit_operand" ""))
4779 (match_operand:SI 3 "gr_reg_or_22bit_operand" "")))]
4780 "reload_completed && rtx_equal_p (operands[0], operands[3])"
4784 (neg:SI (match_dup 2))))]
4788 [(set (match_operand:SI 0 "register_operand" "")
4790 (match_operator 4 "predicate_operator"
4791 [(match_operand:BI 1 "register_operand" "c,c")
4793 (neg:SI (match_operand:SI 2 "gr_reg_or_22bit_operand" ""))
4794 (match_operand:SI 3 "gr_reg_or_22bit_operand" "")))]
4798 (set (match_dup 0) (neg:SI (match_dup 2))))
4801 (set (match_dup 0) (match_dup 3)))]
4804 operands[5] = gen_rtx_fmt_ee (GET_CODE (operands[4]) == NE ? EQ : NE,
4805 VOIDmode, operands[1], const0_rtx);
4809 ;; ::::::::::::::::::::
4811 ;; :: Call and branch instructions
4813 ;; ::::::::::::::::::::
4815 ;; Subroutine call instruction returning no value. Operand 0 is the function
4816 ;; to call; operand 1 is the number of bytes of arguments pushed (in mode
4817 ;; `SImode', except it is normally a `const_int'); operand 2 is the number of
4818 ;; registers used as operands.
4820 ;; On most machines, operand 2 is not actually stored into the RTL pattern. It
4821 ;; is supplied for the sake of some RISC machines which need to put this
4822 ;; information into the assembler code; they can put it in the RTL instead of
4825 (define_expand "call"
4826 [(use (match_operand:DI 0 "" ""))
4827 (use (match_operand 1 "" ""))
4828 (use (match_operand 2 "" ""))
4829 (use (match_operand 3 "" ""))]
4833 ia64_expand_call (NULL_RTX, operands[0], operands[2], 0);
4837 (define_expand "sibcall"
4838 [(use (match_operand:DI 0 "" ""))
4839 (use (match_operand 1 "" ""))
4840 (use (match_operand 2 "" ""))
4841 (use (match_operand 3 "" ""))]
4845 ia64_expand_call (NULL_RTX, operands[0], operands[2], 1);
4849 ;; Subroutine call instruction returning a value. Operand 0 is the hard
4850 ;; register in which the value is returned. There are three more operands,
4851 ;; the same as the three operands of the `call' instruction (but with numbers
4852 ;; increased by one).
4854 ;; Subroutines that return `BLKmode' objects use the `call' insn.
4856 (define_expand "call_value"
4857 [(use (match_operand 0 "" ""))
4858 (use (match_operand:DI 1 "" ""))
4859 (use (match_operand 2 "" ""))
4860 (use (match_operand 3 "" ""))
4861 (use (match_operand 4 "" ""))]
4865 ia64_expand_call (operands[0], operands[1], operands[3], 0);
4869 (define_expand "sibcall_value"
4870 [(use (match_operand 0 "" ""))
4871 (use (match_operand:DI 1 "" ""))
4872 (use (match_operand 2 "" ""))
4873 (use (match_operand 3 "" ""))
4874 (use (match_operand 4 "" ""))]
4878 ia64_expand_call (operands[0], operands[1], operands[3], 1);
4882 ;; Call subroutine returning any type.
4884 (define_expand "untyped_call"
4885 [(parallel [(call (match_operand 0 "" "")
4887 (match_operand 1 "" "")
4888 (match_operand 2 "" "")])]
4894 emit_call_insn (gen_call (operands[0], const0_rtx, NULL, const0_rtx));
4896 for (i = 0; i < XVECLEN (operands[2], 0); i++)
4898 rtx set = XVECEXP (operands[2], 0, i);
4899 emit_move_insn (SET_DEST (set), SET_SRC (set));
4902 /* The optimizer does not know that the call sets the function value
4903 registers we stored in the result block. We avoid problems by
4904 claiming that all hard registers are used and clobbered at this
4906 emit_insn (gen_blockage ());
4911 (define_insn "call_nopic"
4912 [(call (mem:DI (match_operand:DI 0 "call_operand" "b,i"))
4913 (match_operand 1 "" ""))
4914 (clobber (match_operand:DI 2 "register_operand" "=b,b"))]
4916 "br.call%+.many %2 = %0"
4917 [(set_attr "itanium_class" "br,scall")])
4919 (define_insn "call_value_nopic"
4920 [(set (match_operand 0 "" "")
4921 (call (mem:DI (match_operand:DI 1 "call_operand" "b,i"))
4922 (match_operand 2 "" "")))
4923 (clobber (match_operand:DI 3 "register_operand" "=b,b"))]
4925 "br.call%+.many %3 = %1"
4926 [(set_attr "itanium_class" "br,scall")])
4928 (define_insn "sibcall_nopic"
4929 [(call (mem:DI (match_operand:DI 0 "call_operand" "b,i"))
4930 (match_operand 1 "" ""))
4931 (use (match_operand:DI 2 "register_operand" "=b,b"))]
4934 [(set_attr "itanium_class" "br,scall")])
4936 (define_insn "call_pic"
4937 [(call (mem:DI (match_operand:DI 0 "call_operand" "b,i"))
4938 (match_operand 1 "" ""))
4939 (use (unspec [(reg:DI 1)] 9))
4940 (clobber (match_operand:DI 2 "register_operand" "=b,b"))]
4942 "br.call%+.many %2 = %0"
4943 [(set_attr "itanium_class" "br,scall")])
4945 (define_insn "call_value_pic"
4946 [(set (match_operand 0 "" "")
4947 (call (mem:DI (match_operand:DI 1 "call_operand" "b,i"))
4948 (match_operand 2 "" "")))
4949 (use (unspec [(reg:DI 1)] 9))
4950 (clobber (match_operand:DI 3 "register_operand" "=b,b"))]
4952 "br.call%+.many %3 = %1"
4953 [(set_attr "itanium_class" "br,scall")])
4955 (define_insn "sibcall_pic"
4956 [(call (mem:DI (match_operand:DI 0 "call_operand" "bi"))
4957 (match_operand 1 "" ""))
4958 (use (unspec [(reg:DI 1)] 9))
4959 (use (match_operand:DI 2 "register_operand" "=b"))]
4962 [(set_attr "itanium_class" "br")])
4964 (define_insn "return_internal"
4966 (use (match_operand:DI 0 "register_operand" "b"))]
4968 "br.ret.sptk.many %0"
4969 [(set_attr "itanium_class" "br")])
4971 (define_insn "return"
4973 "ia64_direct_return ()"
4974 "br.ret.sptk.many rp"
4975 [(set_attr "itanium_class" "br")])
4977 (define_insn "*return_true"
4979 (if_then_else (match_operator 0 "predicate_operator"
4980 [(match_operand:BI 1 "register_operand" "c")
4984 "ia64_direct_return ()"
4985 "(%J0) br.ret%+.many rp"
4986 [(set_attr "itanium_class" "br")
4987 (set_attr "predicable" "no")])
4989 (define_insn "*return_false"
4991 (if_then_else (match_operator 0 "predicate_operator"
4992 [(match_operand:BI 1 "register_operand" "c")
4996 "ia64_direct_return ()"
4997 "(%j0) br.ret%+.many rp"
4998 [(set_attr "itanium_class" "br")
4999 (set_attr "predicable" "no")])
5002 [(set (pc) (label_ref (match_operand 0 "" "")))]
5005 [(set_attr "itanium_class" "br")])
5007 (define_insn "indirect_jump"
5008 [(set (pc) (match_operand:DI 0 "register_operand" "b"))]
5011 [(set_attr "itanium_class" "br")])
5013 (define_expand "tablejump"
5014 [(match_operand:DI 0 "register_operand" "")
5015 (match_operand 1 "" "")]
5019 rtx tmp1 = gen_reg_rtx (DImode);
5020 rtx tmp2 = gen_reg_rtx (DImode);
5022 emit_move_insn (tmp1, gen_rtx_LABEL_REF (Pmode, operands[1]));
5023 emit_insn (gen_adddi3 (tmp2, operands[0], tmp1));
5024 emit_jump_insn (gen_tablejump_internal (tmp2, operands[1]));
5028 (define_insn "tablejump_internal"
5029 [(set (pc) (match_operand:DI 0 "register_operand" "b"))
5030 (use (label_ref (match_operand 1 "" "")))]
5033 [(set_attr "itanium_class" "br")])
5036 ;; ::::::::::::::::::::
5038 ;; :: Prologue and Epilogue instructions
5040 ;; ::::::::::::::::::::
5042 (define_expand "prologue"
5047 ia64_expand_prologue ();
5051 (define_expand "epilogue"
5056 ia64_expand_epilogue (0);
5060 (define_expand "sibcall_epilogue"
5065 ia64_expand_epilogue (1);
5069 ;; This prevents the scheduler from moving the SP decrement past FP-relative
5070 ;; stack accesses. This is the same as adddi3 plus the extra set.
5072 (define_insn "prologue_allocate_stack"
5073 [(set (match_operand:DI 0 "register_operand" "=r,r,r")
5074 (plus:DI (match_operand:DI 1 "register_operand" "%r,r,a")
5075 (match_operand:DI 2 "gr_reg_or_22bit_operand" "r,I,J")))
5076 (set (match_operand:DI 3 "register_operand" "=r,r,r")
5083 [(set_attr "itanium_class" "ialu")])
5085 ;; This prevents the scheduler from moving the SP restore past FP-relative
5086 ;; stack accesses. This is similar to movdi plus the extra set.
5088 (define_insn "epilogue_deallocate_stack"
5089 [(set (match_operand:DI 0 "register_operand" "=r")
5090 (match_operand:DI 1 "register_operand" "+r"))
5091 (set (match_dup 1) (match_dup 1))]
5094 [(set_attr "itanium_class" "ialu")])
5096 ;; Allocate a new register frame.
5098 (define_insn "alloc"
5099 [(set (match_operand:DI 0 "register_operand" "=r")
5100 (unspec_volatile:DI [(const_int 0)] 0))
5101 (use (match_operand:DI 1 "const_int_operand" "i"))
5102 (use (match_operand:DI 2 "const_int_operand" "i"))
5103 (use (match_operand:DI 3 "const_int_operand" "i"))
5104 (use (match_operand:DI 4 "const_int_operand" "i"))]
5106 "alloc %0 = ar.pfs, %1, %2, %3, %4"
5107 [(set_attr "itanium_class" "syst_m0")
5108 (set_attr "predicable" "no")])
5111 (define_expand "gr_spill"
5112 [(parallel [(set (match_operand:DI 0 "memory_operand" "=m")
5113 (unspec:DI [(match_operand:DI 1 "register_operand" "r")
5114 (match_operand:DI 2 "const_int_operand" "")] 1))
5115 (clobber (match_dup 3))])]
5117 "operands[3] = gen_rtx_REG (DImode, AR_UNAT_REGNUM);")
5119 (define_insn "gr_spill_internal"
5120 [(set (match_operand:DI 0 "memory_operand" "=m")
5121 (unspec:DI [(match_operand:DI 1 "register_operand" "r")
5122 (match_operand:DI 2 "const_int_operand" "")] 1))
5123 (clobber (match_operand:DI 3 "register_operand" ""))]
5125 ".mem.offset %2, 0\;st8.spill %0 = %1%P0"
5126 [(set_attr "itanium_class" "st")])
5129 (define_expand "gr_restore"
5130 [(parallel [(set (match_operand:DI 0 "register_operand" "=r")
5131 (unspec:DI [(match_operand:DI 1 "memory_operand" "m")
5132 (match_operand:DI 2 "const_int_operand" "")] 2))
5133 (use (match_dup 3))])]
5135 "operands[3] = gen_rtx_REG (DImode, AR_UNAT_REGNUM);")
5137 (define_insn "gr_restore_internal"
5138 [(set (match_operand:DI 0 "register_operand" "=r")
5139 (unspec:DI [(match_operand:DI 1 "memory_operand" "m")
5140 (match_operand:DI 2 "const_int_operand" "")] 2))
5141 (use (match_operand:DI 3 "register_operand" ""))]
5143 ".mem.offset %2, 0\;ld8.fill %0 = %1%P1"
5144 [(set_attr "itanium_class" "ld")])
5146 (define_insn "fr_spill"
5147 [(set (match_operand:TF 0 "memory_operand" "=m")
5148 (unspec:TF [(match_operand:TF 1 "register_operand" "f")] 3))]
5150 "stf.spill %0 = %1%P0"
5151 [(set_attr "itanium_class" "stf")])
5153 (define_insn "fr_restore"
5154 [(set (match_operand:TF 0 "register_operand" "=f")
5155 (unspec:TF [(match_operand:TF 1 "memory_operand" "m")] 4))]
5157 "ldf.fill %0 = %1%P1"
5158 [(set_attr "itanium_class" "fld")])
5160 (define_insn "bsp_value"
5161 [(set (match_operand:DI 0 "register_operand" "=r")
5162 (unspec:DI [(const_int 0)] 20))]
5165 [(set_attr "itanium_class" "frar_i")])
5167 (define_insn "set_bsp"
5168 [(unspec_volatile [(match_operand:DI 0 "register_operand" "r")] 5)]
5170 "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"
5171 [(set_attr "itanium_class" "unknown")
5172 (set_attr "predicable" "no")])
5174 (define_insn "flushrs"
5175 [(unspec [(const_int 0)] 21)]
5178 [(set_attr "itanium_class" "rse_m")])
5180 ;; ::::::::::::::::::::
5182 ;; :: Miscellaneous instructions
5184 ;; ::::::::::::::::::::
5186 ;; ??? Emiting a NOP instruction isn't very useful. This should probably
5187 ;; be emitting ";;" to force a break in the instruction packing.
5189 ;; No operation, needed in case the user uses -g but not -O.
5194 [(set_attr "itanium_class" "unknown")])
5196 ;; Pseudo instruction that prevents the scheduler from moving code above this
5198 (define_insn "blockage"
5199 [(unspec_volatile [(const_int 0)] 1)]
5202 [(set_attr "itanium_class" "ignore")
5203 (set_attr "predicable" "no")])
5205 (define_insn "insn_group_barrier"
5206 [(unspec_volatile [(const_int 0)] 2)]
5209 [(set_attr "itanium_class" "stop_bit")
5210 (set_attr "predicable" "no")])
5213 ;; Non-local goto support.
5215 (define_expand "save_stack_nonlocal"
5216 [(use (match_operand:OI 0 "memory_operand" ""))
5217 (use (match_operand:DI 1 "register_operand" ""))]
5221 emit_library_call (gen_rtx_SYMBOL_REF (Pmode,
5222 \"__ia64_save_stack_nonlocal\"),
5223 0, VOIDmode, 2, XEXP (operands[0], 0), Pmode,
5224 operands[1], Pmode);
5228 (define_expand "nonlocal_goto"
5229 [(use (match_operand 0 "general_operand" ""))
5230 (use (match_operand 1 "general_operand" ""))
5231 (use (match_operand 2 "general_operand" ""))
5232 (use (match_operand 3 "general_operand" ""))]
5236 emit_library_call (gen_rtx_SYMBOL_REF (Pmode, \"__ia64_nonlocal_goto\"),
5239 copy_to_reg (XEXP (operands[2], 0)), Pmode,
5240 operands[3], Pmode);
5245 ;; Restore the GP after the exception/longjmp. The preceeding call will
5246 ;; have tucked it away.
5247 (define_expand "exception_receiver"
5248 [(set (reg:DI 1) (match_dup 0))]
5250 "operands[0] = ia64_gp_save_reg (0);")
5252 ;; The rest of the setjmp processing happens with the nonlocal_goto expander.
5253 ;; ??? This is not tested.
5254 (define_expand "builtin_setjmp_setup"
5255 [(use (match_operand:DI 0 "" ""))]
5259 emit_move_insn (ia64_gp_save_reg (0), gen_rtx_REG (DImode, GR_REG (1)));
5263 (define_expand "builtin_setjmp_receiver"
5264 [(use (match_operand:DI 0 "" ""))]
5268 emit_move_insn (gen_rtx_REG (DImode, GR_REG (1)), ia64_gp_save_reg (0));
5272 (define_expand "eh_epilogue"
5273 [(use (match_operand:DI 0 "register_operand" "r"))
5274 (use (match_operand:DI 1 "register_operand" "r"))
5275 (use (match_operand:DI 2 "register_operand" "r"))]
5279 rtx bsp = gen_rtx_REG (Pmode, 10);
5280 rtx sp = gen_rtx_REG (Pmode, 9);
5282 if (GET_CODE (operands[0]) != REG || REGNO (operands[0]) != 10)
5284 emit_move_insn (bsp, operands[0]);
5287 if (GET_CODE (operands[2]) != REG || REGNO (operands[2]) != 9)
5289 emit_move_insn (sp, operands[2]);
5292 emit_insn (gen_rtx_USE (VOIDmode, sp));
5293 emit_insn (gen_rtx_USE (VOIDmode, bsp));
5295 cfun->machine->ia64_eh_epilogue_sp = sp;
5296 cfun->machine->ia64_eh_epilogue_bsp = bsp;
5299 ;; Builtin apply support.
5301 (define_expand "restore_stack_nonlocal"
5302 [(use (match_operand:DI 0 "register_operand" ""))
5303 (use (match_operand:OI 1 "memory_operand" ""))]
5307 emit_library_call (gen_rtx_SYMBOL_REF (Pmode,
5308 \"__ia64_restore_stack_nonlocal\"),
5310 copy_to_reg (XEXP (operands[1], 0)), Pmode);
5315 ;;; Intrinsics support.
5318 [(set (mem:BLK (match_dup 0))
5319 (unspec:BLK [(mem:BLK (match_dup 0))] 12))]
5323 operands[0] = gen_rtx_MEM (BLKmode, gen_rtx_SCRATCH (DImode));
5324 MEM_VOLATILE_P (operands[0]) = 1;
5327 (define_insn "*mf_internal"
5328 [(set (match_operand:BLK 0 "" "")
5329 (unspec:BLK [(match_operand:BLK 1 "" "")] 12))]
5332 [(set_attr "itanium_class" "syst_m")])
5334 (define_insn "fetchadd_acq_si"
5335 [(set (match_operand:SI 0 "gr_register_operand" "=r")
5337 (set (match_operand:SI 1 "not_postinc_memory_operand" "+S")
5338 (unspec:SI [(match_dup 1)
5339 (match_operand:SI 2 "fetchadd_operand" "n")] 19))]
5341 "fetchadd4.acq %0 = %1, %2"
5342 [(set_attr "itanium_class" "sem")])
5344 (define_insn "fetchadd_acq_di"
5345 [(set (match_operand:DI 0 "gr_register_operand" "=r")
5347 (set (match_operand:DI 1 "not_postinc_memory_operand" "+S")
5348 (unspec:DI [(match_dup 1)
5349 (match_operand:DI 2 "fetchadd_operand" "n")] 19))]
5351 "fetchadd8.acq %0 = %1, %2"
5352 [(set_attr "itanium_class" "sem")])
5354 (define_insn "cmpxchg_acq_si"
5355 [(set (match_operand:SI 0 "gr_register_operand" "=r")
5357 (set (match_operand:SI 1 "not_postinc_memory_operand" "+S")
5358 (unspec:SI [(match_dup 1)
5359 (match_operand:SI 2 "gr_register_operand" "r")
5360 (match_operand:SI 3 "ar_ccv_reg_operand" "")] 13))]
5362 "cmpxchg4.acq %0 = %1, %2, %3"
5363 [(set_attr "itanium_class" "sem")])
5365 (define_insn "cmpxchg_acq_di"
5366 [(set (match_operand:DI 0 "gr_register_operand" "=r")
5368 (set (match_operand:DI 1 "not_postinc_memory_operand" "+S")
5369 (unspec:DI [(match_dup 1)
5370 (match_operand:DI 2 "gr_register_operand" "r")
5371 (match_operand:DI 3 "ar_ccv_reg_operand" "")] 13))]
5373 "cmpxchg8.acq %0 = %1, %2, %3"
5374 [(set_attr "itanium_class" "sem")])
5376 (define_insn "xchgsi"
5377 [(set (match_operand:SI 0 "gr_register_operand" "=r")
5378 (match_operand:SI 1 "not_postinc_memory_operand" "+S"))
5380 (match_operand:SI 2 "gr_register_operand" "r"))]
5383 [(set_attr "itanium_class" "sem")])
5385 (define_insn "xchgdi"
5386 [(set (match_operand:DI 0 "gr_register_operand" "=r")
5387 (match_operand:DI 1 "not_postinc_memory_operand" "+S"))
5389 (match_operand:DI 2 "gr_register_operand" "r"))]
5392 [(set_attr "itanium_class" "sem")])
5397 [(match_operator 0 "predicate_operator"
5398 [(match_operand:BI 1 "register_operand" "c")
5403 (define_insn "pred_rel_mutex"
5404 [(set (match_operand:BI 0 "register_operand" "+c")
5405 (unspec:BI [(match_dup 0)] 7))]
5407 ".pred.rel.mutex %0, %I0"
5408 [(set_attr "itanium_class" "ignore")
5409 (set_attr "predicable" "no")])
5411 (define_insn "safe_across_calls_all"
5412 [(unspec_volatile [(const_int 0)] 8)]
5414 ".pred.safe_across_calls p1-p63"
5415 [(set_attr "itanium_class" "ignore")
5416 (set_attr "predicable" "no")])
5418 (define_insn "safe_across_calls_normal"
5419 [(unspec_volatile [(const_int 0)] 9)]
5423 emit_safe_across_calls (asm_out_file);
5426 [(set_attr "itanium_class" "ignore")
5427 (set_attr "predicable" "no")])