1 ;; IA-64 Machine description template
2 ;; Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004
3 ;; Free Software Foundation, Inc.
4 ;; Contributed by James E. Wilson <wilson@cygnus.com> and
5 ;; David Mosberger <davidm@hpl.hp.com>.
7 ;; This file is part of GCC.
9 ;; GCC is free software; you can redistribute it and/or modify
10 ;; it under the terms of the GNU General Public License as published by
11 ;; the Free Software Foundation; either version 2, or (at your option)
14 ;; GCC is distributed in the hope that it will be useful,
15 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
16 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 ;; GNU General Public License for more details.
19 ;; You should have received a copy of the GNU General Public License
20 ;; along with GCC; see the file COPYING. If not, write to
21 ;; the Free Software Foundation, 59 Temple Place - Suite 330,
22 ;; Boston, MA 02111-1307, USA.
24 ;;- See file "rtl.def" for documentation on define_insn, match_*, et. al.
26 ;; ??? register_operand accepts (subreg:DI (mem:SI X)) which forces later
27 ;; reload. This will be fixed once scheduling support is turned on.
29 ;; ??? Optimize for post-increment addressing modes.
31 ;; ??? fselect is not supported, because there is no integer register
34 ;; ??? fp abs/min/max instructions may also work for integer values.
36 ;; ??? Would a predicate_reg_operand predicate be useful? The HP one is buggy,
37 ;; it assumes the operand is a register and takes REGNO of it without checking.
39 ;; ??? Would a branch_reg_operand predicate be useful? The HP one is buggy,
40 ;; it assumes the operand is a register and takes REGNO of it without checking.
42 ;; ??? Go through list of documented named patterns and look for more to
45 ;; ??? Go through instruction manual and look for more instructions that
48 ;; ??? Add function unit scheduling info for Itanium (TM) processor.
50 ;; ??? Need a better way to describe alternate fp status registers.
54 (UNSPEC_LTOFF_DTPMOD 0)
55 (UNSPEC_LTOFF_DTPREL 1)
57 (UNSPEC_LTOFF_TPREL 3)
62 (UNSPEC_GR_RESTORE 11)
64 (UNSPEC_FR_RESTORE 13)
65 (UNSPEC_FR_RECIP_APPROX 14)
66 (UNSPEC_PRED_REL_MUTEX 15)
70 (UNSPEC_CMPXCHG_ACQ 19)
71 (UNSPEC_FETCHADD_ACQ 20)
74 (UNSPEC_BUNDLE_SELECTOR 23)
76 (UNSPEC_PROLOGUE_USE 25)
79 (UNSPEC_FR_SQRT_RECIP_APPROX 28)
86 (UNSPECV_INSN_GROUP_BARRIER 2)
89 (UNSPECV_PSAC_ALL 5) ; pred.safe_across_calls
90 (UNSPECV_PSAC_NORMAL 6)
91 (UNSPECV_SETJMP_RECEIVER 7)
94 ;; ::::::::::::::::::::
98 ;; ::::::::::::::::::::
100 ;; True if OP is a valid operand for the MEM of a CALL insn.
101 (define_predicate "call_operand"
102 (ior (match_code "symbol_ref")
103 (match_operand 0 "register_operand")))
105 ;; True if OP refers to any kind of symbol.
106 ;; For roughly the same reasons that pmode_register_operand exists, this
107 ;; predicate ignores its mode argument.
108 (define_special_predicate "symbolic_operand"
109 (match_code "symbol_ref,const,label_ref"))
111 ;; True if OP is a SYMBOL_REF which refers to a function.
112 (define_predicate "function_operand"
113 (and (match_code "symbol_ref")
114 (match_test "SYMBOL_REF_FUNCTION_P (op)")))
116 ;; True if OP refers to a symbol, and is appropriate for a GOT load.
117 (define_predicate "got_symbolic_operand"
118 (match_operand 0 "symbolic_operand" "")
120 switch (GET_CODE (op))
126 /* This sort of load should not be used for things in sdata. */
127 return !SYMBOL_REF_SMALL_ADDR_P (op);
130 /* Accept only (plus (symbol_ref) (const_int)). */
132 if (GET_CODE (op) != PLUS
133 || GET_CODE (XEXP (op, 0)) != SYMBOL_REF
134 || GET_CODE (XEXP (op, 1)) != CONST_INT)
137 /* Ok if we're not using GOT entries at all. */
138 if (TARGET_NO_PIC || TARGET_AUTO_PIC)
141 /* The low 14 bits of the constant have been forced to zero
142 by ia64_expand_load_address, so that we do not use up so
143 many GOT entries. Prevent cse from undoing this. */
145 return (INTVAL (op) & 0x3fff) == 0;
152 ;; True if OP refers to a symbol in the sdata section.
153 (define_predicate "sdata_symbolic_operand"
154 (match_code "symbol_ref,const")
156 switch (GET_CODE (op))
160 if (GET_CODE (op) != PLUS
161 || GET_CODE (XEXP (op, 0)) != SYMBOL_REF)
167 if (CONSTANT_POOL_ADDRESS_P (op))
168 return GET_MODE_SIZE (get_pool_mode (op)) <= ia64_section_threshold;
170 return SYMBOL_REF_LOCAL_P (op) && SYMBOL_REF_SMALL_P (op);
177 ;; Like nonimmediate_operand, but don't allow MEMs that try to use a
178 ;; POST_MODIFY with a REG as displacement.
179 (define_predicate "destination_operand"
180 (and (match_operand 0 "nonimmediate_operand")
181 (match_test "GET_CODE (op) != MEM
182 || GET_CODE (XEXP (op, 0)) != POST_MODIFY
183 || GET_CODE (XEXP (XEXP (XEXP (op, 0), 1), 1)) != REG")))
185 ;; Like memory_operand, but don't allow post-increments.
186 (define_predicate "not_postinc_memory_operand"
187 (and (match_operand 0 "memory_operand")
188 (match_test "GET_RTX_CLASS (GET_CODE (XEXP (op, 0))) != RTX_AUTOINC")))
190 ;; True if OP is a general operand, excluding tls symbolic operands.
191 (define_predicate "move_operand"
192 (and (match_operand 0 "general_operand")
194 "GET_CODE (op) == SYMBOL_REF && SYMBOL_REF_TLS_MODEL (op)"))))
196 ;; True if OP is a register operand that is (or could be) a GR reg.
197 (define_predicate "gr_register_operand"
198 (match_operand 0 "register_operand")
201 if (GET_CODE (op) == SUBREG)
202 op = SUBREG_REG (op);
205 return (regno >= FIRST_PSEUDO_REGISTER || GENERAL_REGNO_P (regno));
208 ;; True if OP is a register operand that is (or could be) an FR reg.
209 (define_predicate "fr_register_operand"
210 (match_operand 0 "register_operand")
213 if (GET_CODE (op) == SUBREG)
214 op = SUBREG_REG (op);
217 return (regno >= FIRST_PSEUDO_REGISTER || FR_REGNO_P (regno));
220 ;; True if OP is a register operand that is (or could be) a GR/FR reg.
221 (define_predicate "grfr_register_operand"
222 (match_operand 0 "register_operand")
225 if (GET_CODE (op) == SUBREG)
226 op = SUBREG_REG (op);
229 return (regno >= FIRST_PSEUDO_REGISTER
230 || GENERAL_REGNO_P (regno)
231 || FR_REGNO_P (regno));
234 ;; True if OP is a nonimmediate operand that is (or could be) a GR reg.
235 (define_predicate "gr_nonimmediate_operand"
236 (match_operand 0 "nonimmediate_operand")
240 if (GET_CODE (op) == MEM)
242 if (GET_CODE (op) == SUBREG)
243 op = SUBREG_REG (op);
246 return (regno >= FIRST_PSEUDO_REGISTER || GENERAL_REGNO_P (regno));
249 ;; True if OP is a nonimmediate operand that is (or could be) a FR reg.
250 (define_predicate "fr_nonimmediate_operand"
251 (match_operand 0 "nonimmediate_operand")
255 if (GET_CODE (op) == MEM)
257 if (GET_CODE (op) == SUBREG)
258 op = SUBREG_REG (op);
261 return (regno >= FIRST_PSEUDO_REGISTER || FR_REGNO_P (regno));
264 ;; True if OP is a nonimmediate operand that is (or could be) a GR/FR reg.
265 (define_predicate "grfr_nonimmediate_operand"
266 (match_operand 0 "nonimmediate_operand")
270 if (GET_CODE (op) == MEM)
272 if (GET_CODE (op) == SUBREG)
273 op = SUBREG_REG (op);
276 return (regno >= FIRST_PSEUDO_REGISTER
277 || GENERAL_REGNO_P (regno)
278 || FR_REGNO_P (regno));
281 ;; True if OP is a GR register operand, or zero.
282 (define_predicate "gr_reg_or_0_operand"
283 (ior (match_operand 0 "gr_register_operand")
284 (and (match_code "const_int")
285 (match_test "op == const0_rtx"))))
287 ;; True if OP is a GR register operand, or a 5 bit immediate operand.
288 (define_predicate "gr_reg_or_5bit_operand"
289 (ior (match_operand 0 "gr_register_operand")
290 (and (match_code "const_int")
291 (match_test "INTVAL (op) >= 0 && INTVAL (op) < 32"))))
293 ;; True if OP is a GR register operand, or a 6 bit immediate operand.
294 (define_predicate "gr_reg_or_6bit_operand"
295 (ior (match_operand 0 "gr_register_operand")
296 (and (match_code "const_int")
297 (match_test "CONST_OK_FOR_M (INTVAL (op))"))))
299 ;; True if OP is a GR register operand, or an 8 bit immediate operand.
300 (define_predicate "gr_reg_or_8bit_operand"
301 (ior (match_operand 0 "gr_register_operand")
302 (and (match_code "const_int")
303 (match_test "CONST_OK_FOR_K (INTVAL (op))"))))
305 ;; True if OP is a GR/FR register operand, or an 8 bit immediate operand.
306 (define_predicate "grfr_reg_or_8bit_operand"
307 (ior (match_operand 0 "grfr_register_operand")
308 (and (match_code "const_int")
309 (match_test "CONST_OK_FOR_K (INTVAL (op))"))))
311 ;; True if OP is a register operand, or an 8 bit adjusted immediate operand.
312 (define_predicate "gr_reg_or_8bit_adjusted_operand"
313 (ior (match_operand 0 "gr_register_operand")
314 (and (match_code "const_int")
315 (match_test "CONST_OK_FOR_L (INTVAL (op))"))))
317 ;; True if OP is a register operand, or is valid for both an 8 bit
318 ;; immediate and an 8 bit adjusted immediate operand. This is necessary
319 ;; because when we emit a compare, we don't know what the condition will be,
320 ;; so we need the union of the immediates accepted by GT and LT.
321 (define_predicate "gr_reg_or_8bit_and_adjusted_operand"
322 (ior (match_operand 0 "gr_register_operand")
323 (and (match_code "const_int")
324 (match_test "CONST_OK_FOR_K (INTVAL (op))
325 && CONST_OK_FOR_L (INTVAL (op))"))))
327 ;; True if OP is a register operand, or a 14 bit immediate operand.
328 (define_predicate "gr_reg_or_14bit_operand"
329 (ior (match_operand 0 "gr_register_operand")
330 (and (match_code "const_int")
331 (match_test "CONST_OK_FOR_I (INTVAL (op))"))))
333 ;; True if OP is a register operand, or a 22 bit immediate operand.
334 (define_predicate "gr_reg_or_22bit_operand"
335 (ior (match_operand 0 "gr_register_operand")
336 (and (match_code "const_int")
337 (match_test "CONST_OK_FOR_J (INTVAL (op))"))))
339 ;; True if OP is a 7 bit immediate operand.
340 (define_predicate "dshift_count_operand"
341 (and (match_code "const_int")
342 (match_test "INTVAL (op) >= 0 && INTVAL (op) < 128")))
344 ;; True if OP is a 6 bit immediate operand.
345 (define_predicate "shift_count_operand"
346 (and (match_code "const_int")
347 (match_test "CONST_OK_FOR_M (INTVAL (op))")))
349 ;; True if OP is a 5 bit immediate operand.
350 (define_predicate "shift_32bit_count_operand"
351 (and (match_code "const_int")
352 (match_test "INTVAL (op) >= 0 && INTVAL (op) < 32")))
354 ;; True if OP is one of the immediate values 2, 4, 8, or 16.
355 (define_predicate "shladd_operand"
356 (and (match_code "const_int")
357 (match_test "INTVAL (op) == 2 || INTVAL (op) == 4 ||
358 INTVAL (op) == 8 || INTVAL (op) == 16")))
360 ;; True if OP is one of the immediate values -16, -8, -4, -1, 1, 4, 8, 16.
361 (define_predicate "fetchadd_operand"
362 (and (match_code "const_int")
363 (match_test "INTVAL (op) == -16 || INTVAL (op) == -8 ||
364 INTVAL (op) == -4 || INTVAL (op) == -1 ||
365 INTVAL (op) == 1 || INTVAL (op) == 4 ||
366 INTVAL (op) == 8 || INTVAL (op) == 16")))
369 ;; True if OP is a floating-point constant zero, one, or a register.
370 (define_predicate "fr_reg_or_fp01_operand"
371 (ior (match_operand 0 "fr_register_operand")
372 (and (match_code "const_double")
373 (match_test "CONST_DOUBLE_OK_FOR_G (op)"))))
375 ;; Like fr_reg_or_fp01_operand, but don't allow any SUBREGs.
376 (define_predicate "xfreg_or_fp01_operand"
377 (and (match_operand 0 "fr_reg_or_fp01_operand")
378 (not (match_code "subreg"))))
380 ;; True if this is a comparison operator, which accepts a normal 8-bit
381 ;; signed immediate operand.
382 (define_predicate "normal_comparison_operator"
383 (match_code "eq,ne,gt,le,gtu,leu"))
385 ;; True if this is a comparison operator, which accepts an adjusted 8-bit
386 ;; signed immediate operand.
387 (define_predicate "adjusted_comparison_operator"
388 (match_code "lt,ge,ltu,geu"))
390 ;; True if this is a signed inequality operator.
391 (define_predicate "signed_inequality_operator"
392 (match_code "ge,gt,le,lt"))
394 ;; True if this operator is valid for predication.
395 (define_predicate "predicate_operator"
396 (match_code "eq,ne"))
398 ;; True if this operator can be used in a conditional operation.
399 (define_predicate "condop_operator"
400 (match_code "plus,minus,ior,xor,and"))
402 ;; These three are hardware registers that can only be addressed in
403 ;; DImode. It's not strictly necessary to test mode == DImode here,
404 ;; but it makes decent insurance against someone writing a
405 ;; match_operand wrong.
407 ;; True if this is the ar.lc register.
408 (define_predicate "ar_lc_reg_operand"
409 (and (match_code "reg")
410 (match_test "mode == DImode && REGNO (op) == AR_LC_REGNUM")))
412 ;; True if this is the ar.ccv register.
413 (define_predicate "ar_ccv_reg_operand"
414 (and (match_code "reg")
415 (match_test "mode == DImode && REGNO (op) == AR_CCV_REGNUM")))
417 ;; True if this is the ar.pfs register.
418 (define_predicate "ar_pfs_reg_operand"
419 (and (match_code "reg")
420 (match_test "mode == DImode && REGNO (op) == AR_PFS_REGNUM")))
422 ;; True if OP is valid as a base register in a reg + offset address.
423 ;; ??? Should I copy the flag_omit_frame_pointer and cse_not_expected
424 ;; checks from pa.c basereg_operand as well? Seems to be OK without them
426 (define_predicate "basereg_operand"
427 (match_operand 0 "register_operand")
429 if (GET_CODE (op) == SUBREG)
430 op = SUBREG_REG (op);
431 return REG_POINTER (op);
435 ;; ::::::::::::::::::::
439 ;; ::::::::::::::::::::
441 ;; Processor type. This attribute must exactly match the processor_type
442 ;; enumeration in ia64.h.
443 (define_attr "cpu" "itanium,itanium2" (const (symbol_ref "ia64_tune")))
445 ;; Instruction type. This primarily determines how instructions can be
446 ;; packed in bundles, and secondarily affects scheduling to function units.
448 ;; A alu, can go in I or M syllable of a bundle
453 ;; L long immediate, takes two syllables
456 ;; ??? Should not have any pattern with type unknown. Perhaps add code to
457 ;; check this in md_reorg? Currently use unknown for patterns which emit
458 ;; multiple instructions, patterns which emit 0 instructions, and patterns
459 ;; which emit instruction that can go in any slot (e.g. nop).
461 (define_attr "itanium_class" "unknown,ignore,stop_bit,br,fcmp,fcvtfx,fld,
462 fmac,fmisc,frar_i,frar_m,frbr,frfr,frpr,ialu,icmp,ilog,ishf,ld,
463 chk_s,long_i,mmmul,mmshf,mmshfi,rse_m,scall,sem,stf,st,syst_m0,
464 syst_m,tbit,toar_i,toar_m,tobr,tofr,topr,xmpy,xtd,nop,nop_b,nop_f,
465 nop_i,nop_m,nop_x,lfetch,pre_cycle"
466 (const_string "unknown"))
468 ;; chk_s has an I and an M form; use type A for convenience.
469 (define_attr "type" "unknown,A,I,M,F,B,L,X,S"
470 (cond [(eq_attr "itanium_class" "ld,st,fld,stf,sem,nop_m") (const_string "M")
471 (eq_attr "itanium_class" "rse_m,syst_m,syst_m0") (const_string "M")
472 (eq_attr "itanium_class" "frar_m,toar_m,frfr,tofr") (const_string "M")
473 (eq_attr "itanium_class" "lfetch") (const_string "M")
474 (eq_attr "itanium_class" "chk_s,ialu,icmp,ilog") (const_string "A")
475 (eq_attr "itanium_class" "fmisc,fmac,fcmp,xmpy") (const_string "F")
476 (eq_attr "itanium_class" "fcvtfx,nop_f") (const_string "F")
477 (eq_attr "itanium_class" "frar_i,toar_i,frbr,tobr") (const_string "I")
478 (eq_attr "itanium_class" "frpr,topr,ishf,xtd,tbit") (const_string "I")
479 (eq_attr "itanium_class" "mmmul,mmshf,mmshfi,nop_i") (const_string "I")
480 (eq_attr "itanium_class" "br,scall,nop_b") (const_string "B")
481 (eq_attr "itanium_class" "stop_bit") (const_string "S")
482 (eq_attr "itanium_class" "nop_x") (const_string "X")
483 (eq_attr "itanium_class" "long_i") (const_string "L")]
484 (const_string "unknown")))
486 (define_attr "itanium_requires_unit0" "no,yes"
487 (cond [(eq_attr "itanium_class" "syst_m0,sem,frfr,rse_m") (const_string "yes")
488 (eq_attr "itanium_class" "toar_m,frar_m") (const_string "yes")
489 (eq_attr "itanium_class" "frbr,tobr,mmmul") (const_string "yes")
490 (eq_attr "itanium_class" "tbit,ishf,topr,frpr") (const_string "yes")
491 (eq_attr "itanium_class" "toar_i,frar_i") (const_string "yes")
492 (eq_attr "itanium_class" "fmisc,fcmp") (const_string "yes")]
493 (const_string "no")))
495 ;; Predication. True iff this instruction can be predicated.
497 (define_attr "predicable" "no,yes" (const_string "yes"))
499 ;; Empty. True iff this insn does not generate any code.
501 (define_attr "empty" "no,yes" (const_string "no"))
505 ;; DFA descriptions of ia64 processors used for insn scheduling and
508 (automata_option "ndfa")
510 ;; Uncomment the following line to output automata for debugging.
511 ;; (automata_option "v")
513 (automata_option "w")
515 ;;(automata_option "no-minimization")
518 (include "itanium1.md")
519 (include "itanium2.md")
522 ;; ::::::::::::::::::::
526 ;; ::::::::::::::::::::
528 ;; Set of a single predicate register. This is only used to implement
529 ;; pr-to-pr move and complement.
531 (define_insn "*movcci"
532 [(set (match_operand:CCI 0 "register_operand" "=c,c,c")
533 (match_operand:CCI 1 "nonmemory_operand" "O,n,c"))]
536 cmp.ne %0, p0 = r0, r0
537 cmp.eq %0, p0 = r0, r0
538 (%1) cmp.eq.unc %0, p0 = r0, r0"
539 [(set_attr "itanium_class" "icmp")
540 (set_attr "predicable" "no")])
543 [(set (match_operand:BI 0 "nonimmediate_operand" "=c,c,?c,?*r, c,*r,*r,*m,*r")
544 (match_operand:BI 1 "move_operand" " O,n, c, c,*r, n,*m,*r,*r"))]
547 cmp.ne %0, %I0 = r0, r0
548 cmp.eq %0, %I0 = r0, r0
551 tbit.nz %0, %I0 = %1, 0
556 [(set_attr "itanium_class" "icmp,icmp,unknown,unknown,tbit,ialu,ld,st,ialu")])
559 [(set (match_operand:BI 0 "register_operand" "")
560 (match_operand:BI 1 "register_operand" ""))]
562 && GET_CODE (operands[0]) == REG && GR_REGNO_P (REGNO (operands[0]))
563 && GET_CODE (operands[1]) == REG && PR_REGNO_P (REGNO (operands[1]))"
564 [(cond_exec (ne (match_dup 1) (const_int 0))
565 (set (match_dup 0) (const_int 1)))
566 (cond_exec (eq (match_dup 1) (const_int 0))
567 (set (match_dup 0) (const_int 0)))]
571 [(set (match_operand:BI 0 "register_operand" "")
572 (match_operand:BI 1 "register_operand" ""))]
574 && GET_CODE (operands[0]) == REG && PR_REGNO_P (REGNO (operands[0]))
575 && GET_CODE (operands[1]) == REG && PR_REGNO_P (REGNO (operands[1]))"
576 [(set (match_dup 2) (match_dup 4))
577 (set (match_dup 3) (match_dup 5))
578 (set (match_dup 0) (unspec:BI [(match_dup 0)] UNSPEC_PRED_REL_MUTEX))]
579 "operands[2] = gen_rtx_REG (CCImode, REGNO (operands[0]));
580 operands[3] = gen_rtx_REG (CCImode, REGNO (operands[0]) + 1);
581 operands[4] = gen_rtx_REG (CCImode, REGNO (operands[1]));
582 operands[5] = gen_rtx_REG (CCImode, REGNO (operands[1]) + 1);")
584 (define_expand "movqi"
585 [(set (match_operand:QI 0 "general_operand" "")
586 (match_operand:QI 1 "general_operand" ""))]
589 rtx op1 = ia64_expand_move (operands[0], operands[1]);
595 (define_insn "*movqi_internal"
596 [(set (match_operand:QI 0 "destination_operand" "=r,r,r, m, r,*f,*f")
597 (match_operand:QI 1 "move_operand" "rO,J,m,rO,*f,rO,*f"))]
598 "ia64_move_ok (operands[0], operands[1])"
607 [(set_attr "itanium_class" "ialu,ialu,ld,st,frfr,tofr,fmisc")])
609 (define_expand "movhi"
610 [(set (match_operand:HI 0 "general_operand" "")
611 (match_operand:HI 1 "general_operand" ""))]
614 rtx op1 = ia64_expand_move (operands[0], operands[1]);
620 (define_insn "*movhi_internal"
621 [(set (match_operand:HI 0 "destination_operand" "=r,r,r, m, r,*f,*f")
622 (match_operand:HI 1 "move_operand" "rO,J,m,rO,*f,rO,*f"))]
623 "ia64_move_ok (operands[0], operands[1])"
632 [(set_attr "itanium_class" "ialu,ialu,ld,st,frfr,tofr,fmisc")])
634 (define_expand "movsi"
635 [(set (match_operand:SI 0 "general_operand" "")
636 (match_operand:SI 1 "general_operand" ""))]
639 rtx op1 = ia64_expand_move (operands[0], operands[1]);
645 (define_insn "*movsi_internal"
646 [(set (match_operand:SI 0 "destination_operand" "=r,r,r,r, m, r,*f,*f, r,*d")
647 (match_operand:SI 1 "move_operand" "rO,J,i,m,rO,*f,rO,*f,*d,rK"))]
648 "ia64_move_ok (operands[0], operands[1])"
660 ;; frar_m, toar_m ??? why not frar_i and toar_i
661 [(set_attr "itanium_class" "ialu,ialu,long_i,ld,st,frfr,tofr,fmisc,frar_m,toar_m")])
663 (define_expand "movdi"
664 [(set (match_operand:DI 0 "general_operand" "")
665 (match_operand:DI 1 "general_operand" ""))]
668 rtx op1 = ia64_expand_move (operands[0], operands[1]);
674 (define_insn "*movdi_internal"
675 [(set (match_operand:DI 0 "destination_operand"
676 "=r,r,r,r, m, r,*f,*f,*f, Q, r,*b, r,*e, r,*d, r,*c")
677 (match_operand:DI 1 "move_operand"
678 "rO,JT,i,m,rO,*f,rO,*f, Q,*f,*b,rO,*e,rK,*d,rK,*c,rO"))]
679 "ia64_move_ok (operands[0], operands[1])"
681 static const char * const alt[] = {
683 "%,addl %0 = %1, r0",
685 "%,ld8%O1 %0 = %1%P1",
686 "%,st8%Q0 %0 = %r1%P0",
687 "%,getf.sig %0 = %1",
688 "%,setf.sig %0 = %r1",
702 if (which_alternative == 2 && ! TARGET_NO_PIC
703 && symbolic_operand (operands[1], VOIDmode))
706 return alt[which_alternative];
708 [(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")])
711 [(set (match_operand 0 "register_operand" "")
712 (match_operand 1 "symbolic_operand" ""))]
713 "reload_completed && ! TARGET_NO_PIC"
716 ia64_expand_load_address (operands[0], operands[1]);
720 (define_expand "load_fptr"
722 (plus:DI (reg:DI 1) (match_operand 1 "function_operand" "")))
723 (set (match_operand:DI 0 "register_operand" "") (match_dup 3))]
726 operands[2] = no_new_pseudos ? operands[0] : gen_reg_rtx (DImode);
727 operands[3] = gen_const_mem (DImode, operands[2]);
730 (define_insn "*load_fptr_internal1"
731 [(set (match_operand:DI 0 "register_operand" "=r")
732 (plus:DI (reg:DI 1) (match_operand 1 "function_operand" "s")))]
734 "addl %0 = @ltoff(@fptr(%1)), gp"
735 [(set_attr "itanium_class" "ialu")])
737 (define_insn "load_gprel"
738 [(set (match_operand:DI 0 "register_operand" "=r")
739 (plus:DI (reg:DI 1) (match_operand 1 "sdata_symbolic_operand" "s")))]
741 "addl %0 = @gprel(%1), gp"
742 [(set_attr "itanium_class" "ialu")])
744 (define_insn "gprel64_offset"
745 [(set (match_operand:DI 0 "register_operand" "=r")
746 (minus:DI (match_operand:DI 1 "symbolic_operand" "") (reg:DI 1)))]
748 "movl %0 = @gprel(%1)"
749 [(set_attr "itanium_class" "long_i")])
751 (define_expand "load_gprel64"
753 (minus:DI (match_operand:DI 1 "symbolic_operand" "") (match_dup 3)))
754 (set (match_operand:DI 0 "register_operand" "")
755 (plus:DI (match_dup 3) (match_dup 2)))]
758 operands[2] = no_new_pseudos ? operands[0] : gen_reg_rtx (DImode);
759 operands[3] = pic_offset_table_rtx;
762 ;; This is used as a placeholder for the return address during early
763 ;; compilation. We won't know where we've placed this until during
764 ;; reload, at which point it can wind up in b0, a general register,
765 ;; or memory. The only safe destination under these conditions is a
768 (define_insn_and_split "*movdi_ret_addr"
769 [(set (match_operand:DI 0 "register_operand" "=r")
770 (unspec:DI [(const_int 0)] UNSPEC_RET_ADDR))]
776 ia64_split_return_addr_rtx (operands[0]);
779 [(set_attr "itanium_class" "ialu")])
781 (define_insn "*load_symptr_high"
782 [(set (match_operand:DI 0 "register_operand" "=r")
783 (plus:DI (high:DI (match_operand 1 "got_symbolic_operand" "s"))
784 (match_operand:DI 2 "register_operand" "a")))]
787 if (HAVE_AS_LTOFFX_LDXMOV_RELOCS)
788 return "%,addl %0 = @ltoffx(%1), %2";
790 return "%,addl %0 = @ltoff(%1), %2";
792 [(set_attr "itanium_class" "ialu")])
794 (define_insn "*load_symptr_low"
795 [(set (match_operand:DI 0 "register_operand" "=r")
796 (lo_sum:DI (match_operand:DI 1 "register_operand" "r")
797 (match_operand 2 "got_symbolic_operand" "s")))]
800 if (HAVE_AS_LTOFFX_LDXMOV_RELOCS)
801 return "%,ld8.mov %0 = [%1], %2";
803 return "%,ld8 %0 = [%1]";
805 [(set_attr "itanium_class" "ld")])
807 (define_insn "load_ltoff_dtpmod"
808 [(set (match_operand:DI 0 "register_operand" "=r")
810 (unspec:DI [(match_operand:DI 1 "symbolic_operand" "")]
811 UNSPEC_LTOFF_DTPMOD)))]
813 "addl %0 = @ltoff(@dtpmod(%1)), gp"
814 [(set_attr "itanium_class" "ialu")])
816 (define_insn "load_ltoff_dtprel"
817 [(set (match_operand:DI 0 "register_operand" "=r")
819 (unspec:DI [(match_operand:DI 1 "symbolic_operand" "")]
820 UNSPEC_LTOFF_DTPREL)))]
822 "addl %0 = @ltoff(@dtprel(%1)), gp"
823 [(set_attr "itanium_class" "ialu")])
825 (define_expand "load_dtprel"
826 [(set (match_operand:DI 0 "register_operand" "")
827 (unspec:DI [(match_operand:DI 1 "symbolic_operand" "")]
832 (define_insn "*load_dtprel64"
833 [(set (match_operand:DI 0 "register_operand" "=r")
834 (unspec:DI [(match_operand:DI 1 "symbolic_operand" "")]
837 "movl %0 = @dtprel(%1)"
838 [(set_attr "itanium_class" "long_i")])
840 (define_insn "*load_dtprel22"
841 [(set (match_operand:DI 0 "register_operand" "=r")
842 (unspec:DI [(match_operand:DI 1 "symbolic_operand" "")]
845 "addl %0 = @dtprel(%1), r0"
846 [(set_attr "itanium_class" "ialu")])
848 (define_expand "add_dtprel"
849 [(set (match_operand:DI 0 "register_operand" "")
850 (plus:DI (match_operand:DI 1 "register_operand" "")
851 (unspec:DI [(match_operand:DI 2 "symbolic_operand" "")]
856 (define_insn "*add_dtprel14"
857 [(set (match_operand:DI 0 "register_operand" "=r")
858 (plus:DI (match_operand:DI 1 "register_operand" "r")
859 (unspec:DI [(match_operand:DI 2 "symbolic_operand" "")]
862 "adds %0 = @dtprel(%2), %1"
863 [(set_attr "itanium_class" "ialu")])
865 (define_insn "*add_dtprel22"
866 [(set (match_operand:DI 0 "register_operand" "=r")
867 (plus:DI (match_operand:DI 1 "register_operand" "a")
868 (unspec:DI [(match_operand:DI 2 "symbolic_operand" "")]
871 "addl %0 = @dtprel(%2), %1"
872 [(set_attr "itanium_class" "ialu")])
874 (define_insn "load_ltoff_tprel"
875 [(set (match_operand:DI 0 "register_operand" "=r")
877 (unspec:DI [(match_operand:DI 1 "symbolic_operand" "")]
878 UNSPEC_LTOFF_TPREL)))]
880 "addl %0 = @ltoff(@tprel(%1)), gp"
881 [(set_attr "itanium_class" "ialu")])
883 (define_expand "load_tprel"
884 [(set (match_operand:DI 0 "register_operand" "")
885 (unspec:DI [(match_operand:DI 1 "symbolic_operand" "")]
890 (define_insn "*load_tprel64"
891 [(set (match_operand:DI 0 "register_operand" "=r")
892 (unspec:DI [(match_operand:DI 1 "symbolic_operand" "")]
895 "movl %0 = @tprel(%1)"
896 [(set_attr "itanium_class" "long_i")])
898 (define_insn "*load_tprel22"
899 [(set (match_operand:DI 0 "register_operand" "=r")
900 (unspec:DI [(match_operand:DI 1 "symbolic_operand" "")]
903 "addl %0 = @tprel(%1), r0"
904 [(set_attr "itanium_class" "ialu")])
906 (define_expand "add_tprel"
907 [(set (match_operand:DI 0 "register_operand" "")
908 (plus:DI (match_operand:DI 1 "register_operand" "")
909 (unspec:DI [(match_operand:DI 2 "symbolic_operand" "")]
914 (define_insn "*add_tprel14"
915 [(set (match_operand:DI 0 "register_operand" "=r")
916 (plus:DI (match_operand:DI 1 "register_operand" "r")
917 (unspec:DI [(match_operand:DI 2 "symbolic_operand" "")]
920 "adds %0 = @tprel(%2), %1"
921 [(set_attr "itanium_class" "ialu")])
923 (define_insn "*add_tprel22"
924 [(set (match_operand:DI 0 "register_operand" "=r")
925 (plus:DI (match_operand:DI 1 "register_operand" "a")
926 (unspec:DI [(match_operand:DI 2 "symbolic_operand" "")]
929 "addl %0 = @tprel(%2), %1"
930 [(set_attr "itanium_class" "ialu")])
932 ;; With no offsettable memory references, we've got to have a scratch
933 ;; around to play with the second word. However, in order to avoid a
934 ;; reload nightmare we lie, claim we don't need one, and fix it up
935 ;; in ia64_split_tmode_move.
936 (define_expand "movti"
937 [(set (match_operand:TI 0 "general_operand" "")
938 (match_operand:TI 1 "general_operand" ""))]
941 rtx op1 = ia64_expand_move (operands[0], operands[1]);
947 (define_insn_and_split "*movti_internal"
948 [(set (match_operand:TI 0 "nonimmediate_operand" "=r,r,m")
949 (match_operand:TI 1 "general_operand" "ri,m,r"))]
950 "ia64_move_ok (operands[0], operands[1])"
955 ia64_split_tmode_move (operands);
958 [(set_attr "itanium_class" "unknown")
959 (set_attr "predicable" "no")])
961 ;; Floating Point Moves
963 ;; Note - Patterns for SF mode moves are compulsory, but
964 ;; patterns for DF are optional, as GCC can synthesize them.
966 (define_expand "movsf"
967 [(set (match_operand:SF 0 "general_operand" "")
968 (match_operand:SF 1 "general_operand" ""))]
971 rtx op1 = ia64_expand_move (operands[0], operands[1]);
977 (define_insn "*movsf_internal"
978 [(set (match_operand:SF 0 "destination_operand" "=f,f, Q,*r, f,*r,*r, m")
979 (match_operand:SF 1 "general_operand" "fG,Q,fG,fG,*r,*r, m,*r"))]
980 "ia64_move_ok (operands[0], operands[1])"
990 [(set_attr "itanium_class" "fmisc,fld,stf,frfr,tofr,ialu,ld,st")])
992 (define_expand "movdf"
993 [(set (match_operand:DF 0 "general_operand" "")
994 (match_operand:DF 1 "general_operand" ""))]
997 rtx op1 = ia64_expand_move (operands[0], operands[1]);
1003 (define_insn "*movdf_internal"
1004 [(set (match_operand:DF 0 "destination_operand" "=f,f, Q,*r, f,*r,*r, m")
1005 (match_operand:DF 1 "general_operand" "fG,Q,fG,fG,*r,*r, m,*r"))]
1006 "ia64_move_ok (operands[0], operands[1])"
1016 [(set_attr "itanium_class" "fmisc,fld,stf,frfr,tofr,ialu,ld,st")])
1018 ;; With no offsettable memory references, we've got to have a scratch
1019 ;; around to play with the second word if the variable winds up in GRs.
1020 (define_expand "movxf"
1021 [(set (match_operand:XF 0 "general_operand" "")
1022 (match_operand:XF 1 "general_operand" ""))]
1025 rtx op0 = operands[0];
1027 if (GET_CODE (op0) == SUBREG)
1028 op0 = SUBREG_REG (op0);
1030 /* We must support XFmode loads into general registers for stdarg/vararg
1031 and unprototyped calls. We split them into DImode loads for convenience.
1032 We don't need XFmode stores from general regs, because a stdarg/vararg
1033 routine does a block store to memory of unnamed arguments. */
1035 if (GET_CODE (op0) == REG && GR_REGNO_P (REGNO (op0)))
1037 /* We're hoping to transform everything that deals with XFmode
1038 quantities and GR registers early in the compiler. */
1042 /* Struct to register can just use TImode instead. */
1043 if ((GET_CODE (operands[1]) == SUBREG
1044 && GET_MODE (SUBREG_REG (operands[1])) == TImode)
1045 || (GET_CODE (operands[1]) == REG
1046 && GR_REGNO_P (REGNO (operands[1]))))
1048 rtx op1 = operands[1];
1050 if (GET_CODE (op1) == SUBREG)
1051 op1 = SUBREG_REG (op1);
1053 /* ??? Maybe we should make a SUBREG here? */
1054 op1 = gen_rtx_REG (TImode, REGNO (op1));
1056 emit_move_insn (gen_rtx_REG (TImode, REGNO (op0)), op1);
1060 if (GET_CODE (operands[1]) == CONST_DOUBLE)
1062 emit_move_insn (gen_rtx_REG (DImode, REGNO (op0)),
1063 operand_subword (operands[1], 0, 0, XFmode));
1064 emit_move_insn (gen_rtx_REG (DImode, REGNO (op0) + 1),
1065 operand_subword (operands[1], 1, 0, XFmode));
1069 /* If the quantity is in a register not known to be GR, spill it. */
1070 if (register_operand (operands[1], XFmode))
1071 operands[1] = spill_xfmode_operand (operands[1], 1);
1073 if (GET_CODE (operands[1]) == MEM)
1077 out[WORDS_BIG_ENDIAN] = gen_rtx_REG (DImode, REGNO (op0));
1078 out[!WORDS_BIG_ENDIAN] = gen_rtx_REG (DImode, REGNO (op0) + 1);
1080 emit_move_insn (out[0], adjust_address (operands[1], DImode, 0));
1081 emit_move_insn (out[1], adjust_address (operands[1], DImode, 8));
1088 if (! reload_in_progress && ! reload_completed)
1090 operands[1] = spill_xfmode_operand (operands[1], 0);
1092 if (GET_MODE (op0) == TImode && GET_CODE (op0) == REG)
1094 rtx memt, memx, in = operands[1];
1095 if (CONSTANT_P (in))
1096 in = validize_mem (force_const_mem (XFmode, in));
1097 if (GET_CODE (in) == MEM)
1098 memt = adjust_address (in, TImode, 0);
1101 memt = assign_stack_temp (TImode, 16, 0);
1102 memx = adjust_address (memt, XFmode, 0);
1103 emit_move_insn (memx, in);
1105 emit_move_insn (op0, memt);
1109 if (! ia64_move_ok (operands[0], operands[1]))
1110 operands[1] = force_reg (XFmode, operands[1]);
1114 ;; ??? There's no easy way to mind volatile acquire/release semantics.
1116 (define_insn "*movxf_internal"
1117 [(set (match_operand:XF 0 "destination_operand" "=f,f, m")
1118 (match_operand:XF 1 "general_operand" "fG,m,fG"))]
1119 "ia64_move_ok (operands[0], operands[1])"
1124 [(set_attr "itanium_class" "fmisc,fld,stf")])
1126 ;; Better code generation via insns that deal with TFmode register pairs
1127 ;; directly. Same concerns apply as for TImode.
1128 (define_expand "movtf"
1129 [(set (match_operand:TF 0 "general_operand" "")
1130 (match_operand:TF 1 "general_operand" ""))]
1133 rtx op1 = ia64_expand_move (operands[0], operands[1]);
1139 (define_insn_and_split "*movtf_internal"
1140 [(set (match_operand:TF 0 "nonimmediate_operand" "=r,r,m")
1141 (match_operand:TF 1 "general_operand" "ri,m,r"))]
1142 "ia64_move_ok (operands[0], operands[1])"
1147 ia64_split_tmode_move (operands);
1150 [(set_attr "itanium_class" "unknown")
1151 (set_attr "predicable" "no")])
1154 ;; ::::::::::::::::::::
1158 ;; ::::::::::::::::::::
1160 ;; Signed conversions from a smaller integer to a larger integer
1162 (define_insn "extendqidi2"
1163 [(set (match_operand:DI 0 "gr_register_operand" "=r")
1164 (sign_extend:DI (match_operand:QI 1 "gr_register_operand" "r")))]
1167 [(set_attr "itanium_class" "xtd")])
1169 (define_insn "extendhidi2"
1170 [(set (match_operand:DI 0 "gr_register_operand" "=r")
1171 (sign_extend:DI (match_operand:HI 1 "gr_register_operand" "r")))]
1174 [(set_attr "itanium_class" "xtd")])
1176 (define_insn "extendsidi2"
1177 [(set (match_operand:DI 0 "grfr_register_operand" "=r,?f")
1178 (sign_extend:DI (match_operand:SI 1 "grfr_register_operand" "r,f")))]
1183 [(set_attr "itanium_class" "xtd,fmisc")])
1185 ;; Unsigned conversions from a smaller integer to a larger integer
1187 (define_insn "zero_extendqidi2"
1188 [(set (match_operand:DI 0 "gr_register_operand" "=r,r")
1189 (zero_extend:DI (match_operand:QI 1 "gr_nonimmediate_operand" "r,m")))]
1194 [(set_attr "itanium_class" "xtd,ld")])
1196 (define_insn "zero_extendhidi2"
1197 [(set (match_operand:DI 0 "gr_register_operand" "=r,r")
1198 (zero_extend:DI (match_operand:HI 1 "gr_nonimmediate_operand" "r,m")))]
1203 [(set_attr "itanium_class" "xtd,ld")])
1205 (define_insn "zero_extendsidi2"
1206 [(set (match_operand:DI 0 "grfr_register_operand" "=r,r,?f")
1208 (match_operand:SI 1 "grfr_nonimmediate_operand" "r,m,f")))]
1214 [(set_attr "itanium_class" "xtd,ld,fmisc")])
1216 ;; Convert between floating point types of different sizes.
1218 ;; At first glance, it would appear that emitting fnorm for an extending
1219 ;; conversion is unnecessary. However, the stf and getf instructions work
1220 ;; correctly only if the input is properly rounded for its type. In
1221 ;; particular, we get the wrong result for getf.d/stfd if the input is a
1222 ;; denorm single. Since we don't know what the next instruction will be, we
1223 ;; have to emit an fnorm.
1225 ;; ??? Optimization opportunity here. Get rid of the insn altogether
1226 ;; when we can. Should probably use a scheme like has been proposed
1227 ;; for ia32 in dealing with operands that match unary operators. This
1228 ;; would let combine merge the thing into adjacent insns. See also how the
1229 ;; mips port handles SIGN_EXTEND as operands to integer arithmetic insns via
1230 ;; se_register_operand.
1232 (define_insn "extendsfdf2"
1233 [(set (match_operand:DF 0 "fr_register_operand" "=f")
1234 (float_extend:DF (match_operand:SF 1 "fr_register_operand" "f")))]
1237 [(set_attr "itanium_class" "fmac")])
1239 (define_insn "extendsfxf2"
1240 [(set (match_operand:XF 0 "fr_register_operand" "=f")
1241 (float_extend:XF (match_operand:SF 1 "fr_register_operand" "f")))]
1244 [(set_attr "itanium_class" "fmac")])
1246 (define_insn "extenddfxf2"
1247 [(set (match_operand:XF 0 "fr_register_operand" "=f")
1248 (float_extend:XF (match_operand:DF 1 "fr_register_operand" "f")))]
1251 [(set_attr "itanium_class" "fmac")])
1253 (define_insn "truncdfsf2"
1254 [(set (match_operand:SF 0 "fr_register_operand" "=f")
1255 (float_truncate:SF (match_operand:DF 1 "fr_register_operand" "f")))]
1258 [(set_attr "itanium_class" "fmac")])
1260 (define_insn "truncxfsf2"
1261 [(set (match_operand:SF 0 "fr_register_operand" "=f")
1262 (float_truncate:SF (match_operand:XF 1 "fr_register_operand" "f")))]
1265 [(set_attr "itanium_class" "fmac")])
1267 (define_insn "truncxfdf2"
1268 [(set (match_operand:DF 0 "fr_register_operand" "=f")
1269 (float_truncate:DF (match_operand:XF 1 "fr_register_operand" "f")))]
1272 [(set_attr "itanium_class" "fmac")])
1274 ;; Convert between signed integer types and floating point.
1276 (define_insn "floatdixf2"
1277 [(set (match_operand:XF 0 "fr_register_operand" "=f")
1278 (float:XF (match_operand:DI 1 "fr_register_operand" "f")))]
1281 [(set_attr "itanium_class" "fcvtfx")])
1283 (define_insn "fix_truncsfdi2"
1284 [(set (match_operand:DI 0 "fr_register_operand" "=f")
1285 (fix:DI (match_operand:SF 1 "fr_register_operand" "f")))]
1287 "fcvt.fx.trunc %0 = %1"
1288 [(set_attr "itanium_class" "fcvtfx")])
1290 (define_insn "fix_truncdfdi2"
1291 [(set (match_operand:DI 0 "fr_register_operand" "=f")
1292 (fix:DI (match_operand:DF 1 "fr_register_operand" "f")))]
1294 "fcvt.fx.trunc %0 = %1"
1295 [(set_attr "itanium_class" "fcvtfx")])
1297 (define_insn "fix_truncxfdi2"
1298 [(set (match_operand:DI 0 "fr_register_operand" "=f")
1299 (fix:DI (match_operand:XF 1 "fr_register_operand" "f")))]
1301 "fcvt.fx.trunc %0 = %1"
1302 [(set_attr "itanium_class" "fcvtfx")])
1304 (define_insn "fix_truncxfdi2_alts"
1305 [(set (match_operand:DI 0 "fr_register_operand" "=f")
1306 (fix:DI (match_operand:XF 1 "fr_register_operand" "f")))
1307 (use (match_operand:SI 2 "const_int_operand" ""))]
1309 "fcvt.fx.trunc.s%2 %0 = %1"
1310 [(set_attr "itanium_class" "fcvtfx")])
1312 ;; Convert between unsigned integer types and floating point.
1314 (define_insn "floatunsdisf2"
1315 [(set (match_operand:SF 0 "fr_register_operand" "=f")
1316 (unsigned_float:SF (match_operand:DI 1 "fr_register_operand" "f")))]
1318 "fcvt.xuf.s %0 = %1"
1319 [(set_attr "itanium_class" "fcvtfx")])
1321 (define_insn "floatunsdidf2"
1322 [(set (match_operand:DF 0 "fr_register_operand" "=f")
1323 (unsigned_float:DF (match_operand:DI 1 "fr_register_operand" "f")))]
1325 "fcvt.xuf.d %0 = %1"
1326 [(set_attr "itanium_class" "fcvtfx")])
1328 (define_insn "floatunsdixf2"
1329 [(set (match_operand:XF 0 "fr_register_operand" "=f")
1330 (unsigned_float:XF (match_operand:DI 1 "fr_register_operand" "f")))]
1333 [(set_attr "itanium_class" "fcvtfx")])
1335 (define_insn "fixuns_truncsfdi2"
1336 [(set (match_operand:DI 0 "fr_register_operand" "=f")
1337 (unsigned_fix:DI (match_operand:SF 1 "fr_register_operand" "f")))]
1339 "fcvt.fxu.trunc %0 = %1"
1340 [(set_attr "itanium_class" "fcvtfx")])
1342 (define_insn "fixuns_truncdfdi2"
1343 [(set (match_operand:DI 0 "fr_register_operand" "=f")
1344 (unsigned_fix:DI (match_operand:DF 1 "fr_register_operand" "f")))]
1346 "fcvt.fxu.trunc %0 = %1"
1347 [(set_attr "itanium_class" "fcvtfx")])
1349 (define_insn "fixuns_truncxfdi2"
1350 [(set (match_operand:DI 0 "fr_register_operand" "=f")
1351 (unsigned_fix:DI (match_operand:XF 1 "fr_register_operand" "f")))]
1353 "fcvt.fxu.trunc %0 = %1"
1354 [(set_attr "itanium_class" "fcvtfx")])
1356 (define_insn "fixuns_truncxfdi2_alts"
1357 [(set (match_operand:DI 0 "fr_register_operand" "=f")
1358 (unsigned_fix:DI (match_operand:XF 1 "fr_register_operand" "f")))
1359 (use (match_operand:SI 2 "const_int_operand" ""))]
1361 "fcvt.fxu.trunc.s%2 %0 = %1"
1362 [(set_attr "itanium_class" "fcvtfx")])
1364 ;; ::::::::::::::::::::
1366 ;; :: Bit field extraction
1368 ;; ::::::::::::::::::::
1371 [(set (match_operand:DI 0 "gr_register_operand" "=r")
1372 (sign_extract:DI (match_operand:DI 1 "gr_register_operand" "r")
1373 (match_operand:DI 2 "const_int_operand" "n")
1374 (match_operand:DI 3 "const_int_operand" "n")))]
1376 "extr %0 = %1, %3, %2"
1377 [(set_attr "itanium_class" "ishf")])
1379 (define_insn "extzv"
1380 [(set (match_operand:DI 0 "gr_register_operand" "=r")
1381 (zero_extract:DI (match_operand:DI 1 "gr_register_operand" "r")
1382 (match_operand:DI 2 "const_int_operand" "n")
1383 (match_operand:DI 3 "const_int_operand" "n")))]
1385 "extr.u %0 = %1, %3, %2"
1386 [(set_attr "itanium_class" "ishf")])
1388 ;; Insert a bit field.
1389 ;; Can have 3 operands, source1 (inserter), source2 (insertee), dest.
1390 ;; Source1 can be 0 or -1.
1391 ;; Source2 can be 0.
1393 ;; ??? Actual dep instruction is more powerful than what these insv
1394 ;; patterns support. Unfortunately, combine is unable to create patterns
1395 ;; where source2 != dest.
1397 (define_expand "insv"
1398 [(set (zero_extract:DI (match_operand:DI 0 "gr_register_operand" "")
1399 (match_operand:DI 1 "const_int_operand" "")
1400 (match_operand:DI 2 "const_int_operand" ""))
1401 (match_operand:DI 3 "nonmemory_operand" ""))]
1404 int width = INTVAL (operands[1]);
1405 int shift = INTVAL (operands[2]);
1407 /* If operand[3] is a constant, and isn't 0 or -1, then load it into a
1409 if (! register_operand (operands[3], DImode)
1410 && operands[3] != const0_rtx && operands[3] != constm1_rtx)
1411 operands[3] = force_reg (DImode, operands[3]);
1413 /* If this is a single dep instruction, we have nothing to do. */
1414 if (! ((register_operand (operands[3], DImode) && width <= 16)
1415 || operands[3] == const0_rtx || operands[3] == constm1_rtx))
1417 /* Check for cases that can be implemented with a mix instruction. */
1418 if (width == 32 && shift == 0)
1420 /* Directly generating the mix4left instruction confuses
1421 optimize_bit_field in function.c. Since this is performing
1422 a useful optimization, we defer generation of the complicated
1423 mix4left RTL to the first splitting phase. */
1424 rtx tmp = gen_reg_rtx (DImode);
1425 emit_insn (gen_shift_mix4left (operands[0], operands[3], tmp));
1428 else if (width == 32 && shift == 32)
1430 emit_insn (gen_mix4right (operands[0], operands[3]));
1434 /* We could handle remaining cases by emitting multiple dep
1437 If we need more than two dep instructions then we lose. A 6
1438 insn sequence mov mask1,mov mask2,shl;;and,and;;or is better than
1439 mov;;dep,shr;;dep,shr;;dep. The former can be executed in 3 cycles,
1440 the latter is 6 cycles on an Itanium (TM) processor, because there is
1441 only one function unit that can execute dep and shr immed.
1443 If we only need two dep instruction, then we still lose.
1444 mov;;dep,shr;;dep is still 4 cycles. Even if we optimize away
1445 the unnecessary mov, this is still undesirable because it will be
1446 hard to optimize, and it creates unnecessary pressure on the I0
1452 /* This code may be useful for other IA-64 processors, so we leave it in
1458 emit_insn (gen_insv (operands[0], GEN_INT (16), GEN_INT (shift),
1462 tmp = gen_reg_rtx (DImode);
1463 emit_insn (gen_lshrdi3 (tmp, operands[3], GEN_INT (16)));
1466 operands[1] = GEN_INT (width);
1467 operands[2] = GEN_INT (shift);
1472 (define_insn "*insv_internal"
1473 [(set (zero_extract:DI (match_operand:DI 0 "gr_register_operand" "+r")
1474 (match_operand:DI 1 "const_int_operand" "n")
1475 (match_operand:DI 2 "const_int_operand" "n"))
1476 (match_operand:DI 3 "nonmemory_operand" "rP"))]
1477 "(gr_register_operand (operands[3], DImode) && INTVAL (operands[1]) <= 16)
1478 || operands[3] == const0_rtx || operands[3] == constm1_rtx"
1479 "dep %0 = %3, %0, %2, %1"
1480 [(set_attr "itanium_class" "ishf")])
1482 ;; Combine doesn't like to create bit-field insertions into zero.
1483 (define_insn "*depz_internal"
1484 [(set (match_operand:DI 0 "gr_register_operand" "=r")
1485 (and:DI (ashift:DI (match_operand:DI 1 "gr_register_operand" "r")
1486 (match_operand:DI 2 "const_int_operand" "n"))
1487 (match_operand:DI 3 "const_int_operand" "n")))]
1488 "CONST_OK_FOR_M (INTVAL (operands[2]))
1489 && ia64_depz_field_mask (operands[3], operands[2]) > 0"
1491 operands[3] = GEN_INT (ia64_depz_field_mask (operands[3], operands[2]));
1492 return "%,dep.z %0 = %1, %2, %3";
1494 [(set_attr "itanium_class" "ishf")])
1496 (define_insn "shift_mix4left"
1497 [(set (zero_extract:DI (match_operand:DI 0 "gr_register_operand" "+r")
1498 (const_int 32) (const_int 0))
1499 (match_operand:DI 1 "gr_register_operand" "r"))
1500 (clobber (match_operand:DI 2 "gr_register_operand" "=r"))]
1503 [(set_attr "itanium_class" "unknown")])
1506 [(set (zero_extract:DI (match_operand:DI 0 "register_operand" "")
1507 (const_int 32) (const_int 0))
1508 (match_operand:DI 1 "register_operand" ""))
1509 (clobber (match_operand:DI 2 "register_operand" ""))]
1511 [(set (match_dup 3) (ashift:DI (match_dup 1) (const_int 32)))
1512 (set (zero_extract:DI (match_dup 0) (const_int 32) (const_int 0))
1513 (lshiftrt:DI (match_dup 3) (const_int 32)))]
1514 "operands[3] = operands[2];")
1516 (define_insn "*mix4left"
1517 [(set (zero_extract:DI (match_operand:DI 0 "gr_register_operand" "+r")
1518 (const_int 32) (const_int 0))
1519 (lshiftrt:DI (match_operand:DI 1 "gr_register_operand" "r")
1522 "mix4.l %0 = %0, %r1"
1523 [(set_attr "itanium_class" "mmshf")])
1525 (define_insn "mix4right"
1526 [(set (zero_extract:DI (match_operand:DI 0 "gr_register_operand" "+r")
1527 (const_int 32) (const_int 32))
1528 (match_operand:DI 1 "gr_reg_or_0_operand" "rO"))]
1530 "mix4.r %0 = %r1, %0"
1531 [(set_attr "itanium_class" "mmshf")])
1533 ;; This is used by the rotrsi3 pattern.
1535 (define_insn "*mix4right_3op"
1536 [(set (match_operand:DI 0 "gr_register_operand" "=r")
1537 (ior:DI (zero_extend:DI (match_operand:SI 1 "gr_register_operand" "r"))
1538 (ashift:DI (zero_extend:DI
1539 (match_operand:SI 2 "gr_register_operand" "r"))
1542 "mix4.r %0 = %2, %1"
1543 [(set_attr "itanium_class" "mmshf")])
1546 ;; ::::::::::::::::::::
1548 ;; :: 1 bit Integer arithmetic
1550 ;; ::::::::::::::::::::
1552 (define_insn_and_split "andbi3"
1553 [(set (match_operand:BI 0 "register_operand" "=c,c,r")
1554 (and:BI (match_operand:BI 1 "register_operand" "%0,0,r")
1555 (match_operand:BI 2 "register_operand" "c,r,r")))]
1559 tbit.nz.and.orcm %0, %I0 = %2, 0
1562 && GET_CODE (operands[0]) == REG && PR_REGNO_P (REGNO (operands[0]))
1563 && GET_CODE (operands[2]) == REG && PR_REGNO_P (REGNO (operands[2]))"
1564 [(cond_exec (eq (match_dup 2) (const_int 0))
1565 (set (match_dup 0) (and:BI (ne:BI (const_int 0) (const_int 0))
1568 [(set_attr "itanium_class" "unknown,tbit,ilog")])
1570 (define_insn_and_split "*andcmbi3"
1571 [(set (match_operand:BI 0 "register_operand" "=c,c,r")
1572 (and:BI (not:BI (match_operand:BI 1 "register_operand" "c,r,r"))
1573 (match_operand:BI 2 "register_operand" "0,0,r")))]
1577 tbit.z.and.orcm %0, %I0 = %1, 0
1580 && GET_CODE (operands[0]) == REG && PR_REGNO_P (REGNO (operands[0]))
1581 && GET_CODE (operands[1]) == REG && PR_REGNO_P (REGNO (operands[1]))"
1582 [(cond_exec (ne (match_dup 1) (const_int 0))
1583 (set (match_dup 0) (and:BI (ne:BI (const_int 0) (const_int 0))
1586 [(set_attr "itanium_class" "unknown,tbit,ilog")])
1588 (define_insn_and_split "iorbi3"
1589 [(set (match_operand:BI 0 "register_operand" "=c,c,r")
1590 (ior:BI (match_operand:BI 1 "register_operand" "%0,0,r")
1591 (match_operand:BI 2 "register_operand" "c,r,r")))]
1595 tbit.nz.or.andcm %0, %I0 = %2, 0
1598 && GET_CODE (operands[0]) == REG && PR_REGNO_P (REGNO (operands[0]))
1599 && GET_CODE (operands[2]) == REG && PR_REGNO_P (REGNO (operands[2]))"
1600 [(cond_exec (ne (match_dup 2) (const_int 0))
1601 (set (match_dup 0) (ior:BI (eq:BI (const_int 0) (const_int 0))
1604 [(set_attr "itanium_class" "unknown,tbit,ilog")])
1606 (define_insn_and_split "*iorcmbi3"
1607 [(set (match_operand:BI 0 "register_operand" "=c,c")
1608 (ior:BI (not:BI (match_operand:BI 1 "register_operand" "c,r"))
1609 (match_operand:BI 2 "register_operand" "0,0")))]
1613 tbit.z.or.andcm %0, %I0 = %1, 0"
1615 && GET_CODE (operands[0]) == REG && PR_REGNO_P (REGNO (operands[0]))
1616 && GET_CODE (operands[1]) == REG && PR_REGNO_P (REGNO (operands[1]))"
1617 [(cond_exec (eq (match_dup 1) (const_int 0))
1618 (set (match_dup 0) (ior:BI (eq:BI (const_int 0) (const_int 0))
1621 [(set_attr "itanium_class" "unknown,tbit")])
1623 (define_insn "one_cmplbi2"
1624 [(set (match_operand:BI 0 "register_operand" "=c,r,c,&c")
1625 (not:BI (match_operand:BI 1 "register_operand" "r,r,0,c")))
1626 (clobber (match_scratch:BI 2 "=X,X,c,X"))]
1629 tbit.z %0, %I0 = %1, 0
1633 [(set_attr "itanium_class" "tbit,ilog,unknown,unknown")])
1636 [(set (match_operand:BI 0 "register_operand" "")
1637 (not:BI (match_operand:BI 1 "register_operand" "")))
1638 (clobber (match_scratch:BI 2 ""))]
1640 && GET_CODE (operands[0]) == REG && PR_REGNO_P (REGNO (operands[0]))
1641 && rtx_equal_p (operands[0], operands[1])"
1642 [(set (match_dup 4) (match_dup 3))
1643 (set (match_dup 0) (const_int 1))
1644 (cond_exec (ne (match_dup 2) (const_int 0))
1645 (set (match_dup 0) (const_int 0)))
1646 (set (match_dup 0) (unspec:BI [(match_dup 0)] UNSPEC_PRED_REL_MUTEX))]
1647 "operands[3] = gen_rtx_REG (CCImode, REGNO (operands[1]));
1648 operands[4] = gen_rtx_REG (CCImode, REGNO (operands[2]));")
1651 [(set (match_operand:BI 0 "register_operand" "")
1652 (not:BI (match_operand:BI 1 "register_operand" "")))
1653 (clobber (match_scratch:BI 2 ""))]
1655 && GET_CODE (operands[0]) == REG && PR_REGNO_P (REGNO (operands[0]))
1656 && GET_CODE (operands[1]) == REG && PR_REGNO_P (REGNO (operands[1]))
1657 && ! rtx_equal_p (operands[0], operands[1])"
1658 [(cond_exec (ne (match_dup 1) (const_int 0))
1659 (set (match_dup 0) (const_int 0)))
1660 (cond_exec (eq (match_dup 1) (const_int 0))
1661 (set (match_dup 0) (const_int 1)))
1662 (set (match_dup 0) (unspec:BI [(match_dup 0)] UNSPEC_PRED_REL_MUTEX))]
1665 (define_insn "*cmpsi_and_0"
1666 [(set (match_operand:BI 0 "register_operand" "=c")
1667 (and:BI (match_operator:BI 4 "predicate_operator"
1668 [(match_operand:SI 2 "gr_reg_or_0_operand" "rO")
1669 (match_operand:SI 3 "gr_reg_or_8bit_operand" "rK")])
1670 (match_operand:BI 1 "register_operand" "0")))]
1672 "cmp4.%C4.and.orcm %0, %I0 = %3, %r2"
1673 [(set_attr "itanium_class" "icmp")])
1675 (define_insn "*cmpsi_and_1"
1676 [(set (match_operand:BI 0 "register_operand" "=c")
1677 (and:BI (match_operator:BI 3 "signed_inequality_operator"
1678 [(match_operand:SI 2 "gr_register_operand" "r")
1680 (match_operand:BI 1 "register_operand" "0")))]
1682 "cmp4.%C3.and.orcm %0, %I0 = r0, %2"
1683 [(set_attr "itanium_class" "icmp")])
1685 (define_insn "*cmpsi_andnot_0"
1686 [(set (match_operand:BI 0 "register_operand" "=c")
1687 (and:BI (not:BI (match_operator:BI 4 "predicate_operator"
1688 [(match_operand:SI 2 "gr_reg_or_0_operand" "rO")
1689 (match_operand:SI 3 "gr_reg_or_8bit_operand" "rK")]))
1690 (match_operand:BI 1 "register_operand" "0")))]
1692 "cmp4.%C4.or.andcm %I0, %0 = %3, %r2"
1693 [(set_attr "itanium_class" "icmp")])
1695 (define_insn "*cmpsi_andnot_1"
1696 [(set (match_operand:BI 0 "register_operand" "=c")
1697 (and:BI (not:BI (match_operator:BI 3 "signed_inequality_operator"
1698 [(match_operand:SI 2 "gr_register_operand" "r")
1700 (match_operand:BI 1 "register_operand" "0")))]
1702 "cmp4.%C3.or.andcm %I0, %0 = r0, %2"
1703 [(set_attr "itanium_class" "icmp")])
1705 (define_insn "*cmpdi_and_0"
1706 [(set (match_operand:BI 0 "register_operand" "=c")
1707 (and:BI (match_operator:BI 4 "predicate_operator"
1708 [(match_operand:DI 2 "gr_register_operand" "r")
1709 (match_operand:DI 3 "gr_reg_or_8bit_operand" "rK")])
1710 (match_operand:BI 1 "register_operand" "0")))]
1712 "cmp.%C4.and.orcm %0, %I0 = %3, %2"
1713 [(set_attr "itanium_class" "icmp")])
1715 (define_insn "*cmpdi_and_1"
1716 [(set (match_operand:BI 0 "register_operand" "=c")
1717 (and:BI (match_operator:BI 3 "signed_inequality_operator"
1718 [(match_operand:DI 2 "gr_register_operand" "r")
1720 (match_operand:BI 1 "register_operand" "0")))]
1722 "cmp.%C3.and.orcm %0, %I0 = r0, %2"
1723 [(set_attr "itanium_class" "icmp")])
1725 (define_insn "*cmpdi_andnot_0"
1726 [(set (match_operand:BI 0 "register_operand" "=c")
1727 (and:BI (not:BI (match_operator:BI 4 "predicate_operator"
1728 [(match_operand:DI 2 "gr_register_operand" "r")
1729 (match_operand:DI 3 "gr_reg_or_8bit_operand" "rK")]))
1730 (match_operand:BI 1 "register_operand" "0")))]
1732 "cmp.%C4.or.andcm %I0, %0 = %3, %2"
1733 [(set_attr "itanium_class" "icmp")])
1735 (define_insn "*cmpdi_andnot_1"
1736 [(set (match_operand:BI 0 "register_operand" "=c")
1737 (and:BI (not:BI (match_operator:BI 3 "signed_inequality_operator"
1738 [(match_operand:DI 2 "gr_register_operand" "r")
1740 (match_operand:BI 1 "register_operand" "0")))]
1742 "cmp.%C3.or.andcm %I0, %0 = r0, %2"
1743 [(set_attr "itanium_class" "icmp")])
1745 (define_insn "*tbit_and_0"
1746 [(set (match_operand:BI 0 "register_operand" "=c")
1747 (and:BI (ne:BI (and:DI (match_operand:DI 1 "gr_register_operand" "r")
1750 (match_operand:BI 2 "register_operand" "0")))]
1752 "tbit.nz.and.orcm %0, %I0 = %1, 0"
1753 [(set_attr "itanium_class" "tbit")])
1755 (define_insn "*tbit_and_1"
1756 [(set (match_operand:BI 0 "register_operand" "=c")
1757 (and:BI (eq:BI (and:DI (match_operand:DI 1 "gr_register_operand" "r")
1760 (match_operand:BI 2 "register_operand" "0")))]
1762 "tbit.z.and.orcm %0, %I0 = %1, 0"
1763 [(set_attr "itanium_class" "tbit")])
1765 (define_insn "*tbit_and_2"
1766 [(set (match_operand:BI 0 "register_operand" "=c")
1767 (and:BI (ne:BI (zero_extract:DI
1768 (match_operand:DI 1 "gr_register_operand" "r")
1770 (match_operand:DI 2 "const_int_operand" "n"))
1772 (match_operand:BI 3 "register_operand" "0")))]
1774 "tbit.nz.and.orcm %0, %I0 = %1, %2"
1775 [(set_attr "itanium_class" "tbit")])
1777 (define_insn "*tbit_and_3"
1778 [(set (match_operand:BI 0 "register_operand" "=c")
1779 (and:BI (eq:BI (zero_extract:DI
1780 (match_operand:DI 1 "gr_register_operand" "r")
1782 (match_operand:DI 2 "const_int_operand" "n"))
1784 (match_operand:BI 3 "register_operand" "0")))]
1786 "tbit.z.and.orcm %0, %I0 = %1, %2"
1787 [(set_attr "itanium_class" "tbit")])
1789 (define_insn "*cmpsi_or_0"
1790 [(set (match_operand:BI 0 "register_operand" "=c")
1791 (ior:BI (match_operator:BI 4 "predicate_operator"
1792 [(match_operand:SI 2 "gr_reg_or_0_operand" "rO")
1793 (match_operand:SI 3 "gr_reg_or_8bit_operand" "rK")])
1794 (match_operand:BI 1 "register_operand" "0")))]
1796 "cmp4.%C4.or.andcm %0, %I0 = %3, %r2"
1797 [(set_attr "itanium_class" "icmp")])
1799 (define_insn "*cmpsi_or_1"
1800 [(set (match_operand:BI 0 "register_operand" "=c")
1801 (ior:BI (match_operator:BI 3 "signed_inequality_operator"
1802 [(match_operand:SI 2 "gr_register_operand" "r")
1804 (match_operand:BI 1 "register_operand" "0")))]
1806 "cmp4.%C3.or.andcm %0, %I0 = r0, %2"
1807 [(set_attr "itanium_class" "icmp")])
1809 (define_insn "*cmpsi_orcm_0"
1810 [(set (match_operand:BI 0 "register_operand" "=c")
1811 (ior:BI (not:BI (match_operator:BI 4 "predicate_operator"
1812 [(match_operand:SI 2 "gr_reg_or_0_operand" "rO")
1813 (match_operand:SI 3 "gr_reg_or_8bit_operand" "rK")]))
1814 (match_operand:BI 1 "register_operand" "0")))]
1816 "cmp4.%C4.and.orcm %I0, %0 = %3, %r2"
1817 [(set_attr "itanium_class" "icmp")])
1819 (define_insn "*cmpsi_orcm_1"
1820 [(set (match_operand:BI 0 "register_operand" "=c")
1821 (ior:BI (not:BI (match_operator:BI 3 "signed_inequality_operator"
1822 [(match_operand:SI 2 "gr_register_operand" "r")
1824 (match_operand:BI 1 "register_operand" "0")))]
1826 "cmp4.%C3.and.orcm %I0, %0 = r0, %2"
1827 [(set_attr "itanium_class" "icmp")])
1829 (define_insn "*cmpdi_or_0"
1830 [(set (match_operand:BI 0 "register_operand" "=c")
1831 (ior:BI (match_operator:BI 4 "predicate_operator"
1832 [(match_operand:DI 2 "gr_register_operand" "r")
1833 (match_operand:DI 3 "gr_reg_or_8bit_operand" "rK")])
1834 (match_operand:BI 1 "register_operand" "0")))]
1836 "cmp.%C4.or.andcm %0, %I0 = %3, %2"
1837 [(set_attr "itanium_class" "icmp")])
1839 (define_insn "*cmpdi_or_1"
1840 [(set (match_operand:BI 0 "register_operand" "=c")
1841 (ior:BI (match_operator:BI 3 "signed_inequality_operator"
1842 [(match_operand:DI 2 "gr_register_operand" "r")
1844 (match_operand:BI 1 "register_operand" "0")))]
1846 "cmp.%C3.or.andcm %0, %I0 = r0, %2"
1847 [(set_attr "itanium_class" "icmp")])
1849 (define_insn "*cmpdi_orcm_0"
1850 [(set (match_operand:BI 0 "register_operand" "=c")
1851 (ior:BI (not:BI (match_operator:BI 4 "predicate_operator"
1852 [(match_operand:DI 2 "gr_register_operand" "r")
1853 (match_operand:DI 3 "gr_reg_or_8bit_operand" "rK")]))
1854 (match_operand:BI 1 "register_operand" "0")))]
1856 "cmp.%C4.and.orcm %I0, %0 = %3, %2"
1857 [(set_attr "itanium_class" "icmp")])
1859 (define_insn "*cmpdi_orcm_1"
1860 [(set (match_operand:BI 0 "register_operand" "=c")
1861 (ior:BI (not:BI (match_operator:BI 3 "signed_inequality_operator"
1862 [(match_operand:DI 2 "gr_register_operand" "r")
1864 (match_operand:BI 1 "register_operand" "0")))]
1866 "cmp.%C3.and.orcm %I0, %0 = r0, %2"
1867 [(set_attr "itanium_class" "icmp")])
1869 (define_insn "*tbit_or_0"
1870 [(set (match_operand:BI 0 "register_operand" "=c")
1871 (ior:BI (ne:BI (and:DI (match_operand:DI 1 "gr_register_operand" "r")
1874 (match_operand:BI 2 "register_operand" "0")))]
1876 "tbit.nz.or.andcm %0, %I0 = %1, 0"
1877 [(set_attr "itanium_class" "tbit")])
1879 (define_insn "*tbit_or_1"
1880 [(set (match_operand:BI 0 "register_operand" "=c")
1881 (ior:BI (eq:BI (and:DI (match_operand:DI 1 "gr_register_operand" "r")
1884 (match_operand:BI 2 "register_operand" "0")))]
1886 "tbit.z.or.andcm %0, %I0 = %1, 0"
1887 [(set_attr "itanium_class" "tbit")])
1889 (define_insn "*tbit_or_2"
1890 [(set (match_operand:BI 0 "register_operand" "=c")
1891 (ior:BI (ne:BI (zero_extract:DI
1892 (match_operand:DI 1 "gr_register_operand" "r")
1894 (match_operand:DI 2 "const_int_operand" "n"))
1896 (match_operand:BI 3 "register_operand" "0")))]
1898 "tbit.nz.or.andcm %0, %I0 = %1, %2"
1899 [(set_attr "itanium_class" "tbit")])
1901 (define_insn "*tbit_or_3"
1902 [(set (match_operand:BI 0 "register_operand" "=c")
1903 (ior:BI (eq:BI (zero_extract:DI
1904 (match_operand:DI 1 "gr_register_operand" "r")
1906 (match_operand:DI 2 "const_int_operand" "n"))
1908 (match_operand:BI 3 "register_operand" "0")))]
1910 "tbit.z.or.andcm %0, %I0 = %1, %2"
1911 [(set_attr "itanium_class" "tbit")])
1913 ;; Transform test of and/or of setcc into parallel comparisons.
1916 [(set (match_operand:BI 0 "register_operand" "")
1917 (ne:BI (and:DI (ne:DI (match_operand:BI 2 "register_operand" "")
1919 (match_operand:DI 3 "register_operand" ""))
1923 (and:BI (ne:BI (and:DI (match_dup 3) (const_int 1)) (const_int 0))
1928 [(set (match_operand:BI 0 "register_operand" "")
1929 (eq:BI (and:DI (ne:DI (match_operand:BI 2 "register_operand" "")
1931 (match_operand:DI 3 "register_operand" ""))
1935 (and:BI (ne:BI (and:DI (match_dup 3) (const_int 1)) (const_int 0))
1937 (parallel [(set (match_dup 0) (not:BI (match_dup 0)))
1938 (clobber (scratch))])]
1942 [(set (match_operand:BI 0 "register_operand" "")
1943 (ne:BI (ior:DI (ne:DI (match_operand:BI 2 "register_operand" "")
1945 (match_operand:DI 3 "register_operand" ""))
1949 (ior:BI (ne:BI (match_dup 3) (const_int 0))
1954 [(set (match_operand:BI 0 "register_operand" "")
1955 (eq:BI (ior:DI (ne:DI (match_operand:BI 2 "register_operand" "")
1957 (match_operand:DI 3 "register_operand" ""))
1961 (ior:BI (ne:BI (match_dup 3) (const_int 0))
1963 (parallel [(set (match_dup 0) (not:BI (match_dup 0)))
1964 (clobber (scratch))])]
1967 ;; ??? Incredibly hackish. Either need four proper patterns with all
1968 ;; the alternatives, or rely on sched1 to split the insn and hope that
1969 ;; nothing bad happens to the comparisons in the meantime.
1971 ;; Alternately, adjust combine to allow 2->2 and 3->3 splits, assuming
1972 ;; that we're doing height reduction.
1974 ;(define_insn_and_split ""
1975 ; [(set (match_operand:BI 0 "register_operand" "=c")
1976 ; (and:BI (and:BI (match_operator:BI 1 "comparison_operator"
1977 ; [(match_operand 2 "" "")
1978 ; (match_operand 3 "" "")])
1979 ; (match_operator:BI 4 "comparison_operator"
1980 ; [(match_operand 5 "" "")
1981 ; (match_operand 6 "" "")]))
1983 ; "flag_schedule_insns"
1986 ; [(set (match_dup 0) (and:BI (match_dup 1) (match_dup 0)))
1987 ; (set (match_dup 0) (and:BI (match_dup 4) (match_dup 0)))]
1990 ;(define_insn_and_split ""
1991 ; [(set (match_operand:BI 0 "register_operand" "=c")
1992 ; (ior:BI (ior:BI (match_operator:BI 1 "comparison_operator"
1993 ; [(match_operand 2 "" "")
1994 ; (match_operand 3 "" "")])
1995 ; (match_operator:BI 4 "comparison_operator"
1996 ; [(match_operand 5 "" "")
1997 ; (match_operand 6 "" "")]))
1999 ; "flag_schedule_insns"
2002 ; [(set (match_dup 0) (ior:BI (match_dup 1) (match_dup 0)))
2003 ; (set (match_dup 0) (ior:BI (match_dup 4) (match_dup 0)))]
2007 ; [(set (match_operand:BI 0 "register_operand" "")
2008 ; (and:BI (and:BI (match_operator:BI 1 "comparison_operator"
2009 ; [(match_operand 2 "" "")
2010 ; (match_operand 3 "" "")])
2011 ; (match_operand:BI 7 "register_operand" ""))
2012 ; (and:BI (match_operator:BI 4 "comparison_operator"
2013 ; [(match_operand 5 "" "")
2014 ; (match_operand 6 "" "")])
2015 ; (match_operand:BI 8 "register_operand" ""))))]
2017 ; [(set (match_dup 0) (and:BI (match_dup 7) (match_dup 8)))
2018 ; (set (match_dup 0) (and:BI (and:BI (match_dup 1) (match_dup 4))
2023 ; [(set (match_operand:BI 0 "register_operand" "")
2024 ; (ior:BI (ior:BI (match_operator:BI 1 "comparison_operator"
2025 ; [(match_operand 2 "" "")
2026 ; (match_operand 3 "" "")])
2027 ; (match_operand:BI 7 "register_operand" ""))
2028 ; (ior:BI (match_operator:BI 4 "comparison_operator"
2029 ; [(match_operand 5 "" "")
2030 ; (match_operand 6 "" "")])
2031 ; (match_operand:BI 8 "register_operand" ""))))]
2033 ; [(set (match_dup 0) (ior:BI (match_dup 7) (match_dup 8)))
2034 ; (set (match_dup 0) (ior:BI (ior:BI (match_dup 1) (match_dup 4))
2038 ;; Try harder to avoid predicate copies by duplicating compares.
2039 ;; Note that we'll have already split the predicate copy, which
2040 ;; is kind of a pain, but oh well.
2043 [(set (match_operand:BI 0 "register_operand" "")
2044 (match_operand:BI 1 "comparison_operator" ""))
2045 (set (match_operand:CCI 2 "register_operand" "")
2046 (match_operand:CCI 3 "register_operand" ""))
2047 (set (match_operand:CCI 4 "register_operand" "")
2048 (match_operand:CCI 5 "register_operand" ""))
2049 (set (match_operand:BI 6 "register_operand" "")
2050 (unspec:BI [(match_dup 6)] UNSPEC_PRED_REL_MUTEX))]
2051 "REGNO (operands[3]) == REGNO (operands[0])
2052 && REGNO (operands[4]) == REGNO (operands[0]) + 1
2053 && REGNO (operands[4]) == REGNO (operands[2]) + 1
2054 && REGNO (operands[6]) == REGNO (operands[2])"
2055 [(set (match_dup 0) (match_dup 1))
2056 (set (match_dup 6) (match_dup 7))]
2057 "operands[7] = copy_rtx (operands[1]);")
2059 ;; ::::::::::::::::::::
2061 ;; :: 16 bit Integer arithmetic
2063 ;; ::::::::::::::::::::
2065 (define_insn "mulhi3"
2066 [(set (match_operand:HI 0 "gr_register_operand" "=r")
2067 (mult:HI (match_operand:HI 1 "gr_register_operand" "r")
2068 (match_operand:HI 2 "gr_register_operand" "r")))]
2070 "pmpy2.r %0 = %1, %2"
2071 [(set_attr "itanium_class" "mmmul")])
2074 ;; ::::::::::::::::::::
2076 ;; :: 32 bit Integer arithmetic
2078 ;; ::::::::::::::::::::
2080 (define_insn "addsi3"
2081 [(set (match_operand:SI 0 "gr_register_operand" "=r,r,r")
2082 (plus:SI (match_operand:SI 1 "gr_register_operand" "%r,r,a")
2083 (match_operand:SI 2 "gr_reg_or_22bit_operand" "r,I,J")))]
2089 [(set_attr "itanium_class" "ialu")])
2091 (define_insn "*addsi3_plus1"
2092 [(set (match_operand:SI 0 "gr_register_operand" "=r")
2093 (plus:SI (plus:SI (match_operand:SI 1 "gr_register_operand" "r")
2094 (match_operand:SI 2 "gr_register_operand" "r"))
2097 "add %0 = %1, %2, 1"
2098 [(set_attr "itanium_class" "ialu")])
2100 (define_insn "*addsi3_plus1_alt"
2101 [(set (match_operand:SI 0 "gr_register_operand" "=r")
2102 (plus:SI (mult:SI (match_operand:SI 1 "gr_register_operand" "r")
2106 "add %0 = %1, %1, 1"
2107 [(set_attr "itanium_class" "ialu")])
2109 (define_insn "*addsi3_shladd"
2110 [(set (match_operand:SI 0 "gr_register_operand" "=r")
2111 (plus:SI (mult:SI (match_operand:SI 1 "gr_register_operand" "r")
2112 (match_operand:SI 2 "shladd_operand" "n"))
2113 (match_operand:SI 3 "gr_register_operand" "r")))]
2115 "shladd %0 = %1, %S2, %3"
2116 [(set_attr "itanium_class" "ialu")])
2118 (define_insn "subsi3"
2119 [(set (match_operand:SI 0 "gr_register_operand" "=r")
2120 (minus:SI (match_operand:SI 1 "gr_reg_or_8bit_operand" "rK")
2121 (match_operand:SI 2 "gr_register_operand" "r")))]
2124 [(set_attr "itanium_class" "ialu")])
2126 (define_insn "*subsi3_minus1"
2127 [(set (match_operand:SI 0 "gr_register_operand" "=r")
2128 (plus:SI (not:SI (match_operand:SI 1 "gr_register_operand" "r"))
2129 (match_operand:SI 2 "gr_register_operand" "r")))]
2131 "sub %0 = %2, %1, 1"
2132 [(set_attr "itanium_class" "ialu")])
2134 ;; ??? Could add maddsi3 patterns patterned after the madddi3 patterns.
2136 (define_insn "mulsi3"
2137 [(set (match_operand:SI 0 "fr_register_operand" "=f")
2138 (mult:SI (match_operand:SI 1 "grfr_register_operand" "f")
2139 (match_operand:SI 2 "grfr_register_operand" "f")))]
2141 "xmpy.l %0 = %1, %2"
2142 [(set_attr "itanium_class" "xmpy")])
2144 (define_insn "maddsi4"
2145 [(set (match_operand:SI 0 "fr_register_operand" "=f")
2146 (plus:SI (mult:SI (match_operand:SI 1 "grfr_register_operand" "f")
2147 (match_operand:SI 2 "grfr_register_operand" "f"))
2148 (match_operand:SI 3 "grfr_register_operand" "f")))]
2150 "xma.l %0 = %1, %2, %3"
2151 [(set_attr "itanium_class" "xmpy")])
2153 (define_insn "negsi2"
2154 [(set (match_operand:SI 0 "gr_register_operand" "=r")
2155 (neg:SI (match_operand:SI 1 "gr_register_operand" "r")))]
2158 [(set_attr "itanium_class" "ialu")])
2160 (define_expand "abssi2"
2162 (ge:BI (match_operand:SI 1 "gr_register_operand" "") (const_int 0)))
2163 (set (match_operand:SI 0 "gr_register_operand" "")
2164 (if_then_else:SI (eq (match_dup 2) (const_int 0))
2165 (neg:SI (match_dup 1))
2168 { operands[2] = gen_reg_rtx (BImode); })
2170 (define_expand "sminsi3"
2172 (ge:BI (match_operand:SI 1 "gr_register_operand" "")
2173 (match_operand:SI 2 "gr_register_operand" "")))
2174 (set (match_operand:SI 0 "gr_register_operand" "")
2175 (if_then_else:SI (ne (match_dup 3) (const_int 0))
2176 (match_dup 2) (match_dup 1)))]
2178 { operands[3] = gen_reg_rtx (BImode); })
2180 (define_expand "smaxsi3"
2182 (ge:BI (match_operand:SI 1 "gr_register_operand" "")
2183 (match_operand:SI 2 "gr_register_operand" "")))
2184 (set (match_operand:SI 0 "gr_register_operand" "")
2185 (if_then_else:SI (ne (match_dup 3) (const_int 0))
2186 (match_dup 1) (match_dup 2)))]
2188 { operands[3] = gen_reg_rtx (BImode); })
2190 (define_expand "uminsi3"
2192 (geu:BI (match_operand:SI 1 "gr_register_operand" "")
2193 (match_operand:SI 2 "gr_register_operand" "")))
2194 (set (match_operand:SI 0 "gr_register_operand" "")
2195 (if_then_else:SI (ne (match_dup 3) (const_int 0))
2196 (match_dup 2) (match_dup 1)))]
2198 { operands[3] = gen_reg_rtx (BImode); })
2200 (define_expand "umaxsi3"
2202 (geu:BI (match_operand:SI 1 "gr_register_operand" "")
2203 (match_operand:SI 2 "gr_register_operand" "")))
2204 (set (match_operand:SI 0 "gr_register_operand" "")
2205 (if_then_else:SI (ne (match_dup 3) (const_int 0))
2206 (match_dup 1) (match_dup 2)))]
2208 { operands[3] = gen_reg_rtx (BImode); })
2210 (define_expand "divsi3"
2211 [(set (match_operand:SI 0 "register_operand" "")
2212 (div:SI (match_operand:SI 1 "general_operand" "")
2213 (match_operand:SI 2 "general_operand" "")))]
2214 "TARGET_INLINE_INT_DIV"
2216 rtx op1_xf, op2_xf, op0_xf, op0_di, twon34, twon34_exp;
2218 op0_xf = gen_reg_rtx (XFmode);
2219 op0_di = gen_reg_rtx (DImode);
2221 if (CONSTANT_P (operands[1]))
2222 operands[1] = force_reg (SImode, operands[1]);
2223 op1_xf = gen_reg_rtx (XFmode);
2224 expand_float (op1_xf, operands[1], 0);
2226 if (CONSTANT_P (operands[2]))
2227 operands[2] = force_reg (SImode, operands[2]);
2228 op2_xf = gen_reg_rtx (XFmode);
2229 expand_float (op2_xf, operands[2], 0);
2232 twon34_exp = gen_reg_rtx (DImode);
2233 emit_move_insn (twon34_exp, GEN_INT (65501));
2234 twon34 = gen_reg_rtx (XFmode);
2235 emit_insn (gen_setf_exp_xf (twon34, twon34_exp));
2237 emit_insn (gen_divsi3_internal (op0_xf, op1_xf, op2_xf, twon34));
2239 emit_insn (gen_fix_truncxfdi2_alts (op0_di, op0_xf, const1_rtx));
2240 emit_move_insn (operands[0], gen_lowpart (SImode, op0_di));
2244 (define_expand "modsi3"
2245 [(set (match_operand:SI 0 "register_operand" "")
2246 (mod:SI (match_operand:SI 1 "general_operand" "")
2247 (match_operand:SI 2 "general_operand" "")))]
2248 "TARGET_INLINE_INT_DIV"
2250 rtx op2_neg, op1_di, div;
2252 div = gen_reg_rtx (SImode);
2253 emit_insn (gen_divsi3 (div, operands[1], operands[2]));
2255 op2_neg = expand_unop (SImode, neg_optab, operands[2], NULL_RTX, 0);
2257 /* This is a trick to get us to reuse the value that we're sure to
2258 have already copied to the FP regs. */
2259 op1_di = gen_reg_rtx (DImode);
2260 convert_move (op1_di, operands[1], 0);
2262 emit_insn (gen_maddsi4 (operands[0], div, op2_neg,
2263 gen_lowpart (SImode, op1_di)));
2267 (define_expand "udivsi3"
2268 [(set (match_operand:SI 0 "register_operand" "")
2269 (udiv:SI (match_operand:SI 1 "general_operand" "")
2270 (match_operand:SI 2 "general_operand" "")))]
2271 "TARGET_INLINE_INT_DIV"
2273 rtx op1_xf, op2_xf, op0_xf, op0_di, twon34, twon34_exp;
2275 op0_xf = gen_reg_rtx (XFmode);
2276 op0_di = gen_reg_rtx (DImode);
2278 if (CONSTANT_P (operands[1]))
2279 operands[1] = force_reg (SImode, operands[1]);
2280 op1_xf = gen_reg_rtx (XFmode);
2281 expand_float (op1_xf, operands[1], 1);
2283 if (CONSTANT_P (operands[2]))
2284 operands[2] = force_reg (SImode, operands[2]);
2285 op2_xf = gen_reg_rtx (XFmode);
2286 expand_float (op2_xf, operands[2], 1);
2289 twon34_exp = gen_reg_rtx (DImode);
2290 emit_move_insn (twon34_exp, GEN_INT (65501));
2291 twon34 = gen_reg_rtx (XFmode);
2292 emit_insn (gen_setf_exp_xf (twon34, twon34_exp));
2294 emit_insn (gen_divsi3_internal (op0_xf, op1_xf, op2_xf, twon34));
2296 emit_insn (gen_fixuns_truncxfdi2_alts (op0_di, op0_xf, const1_rtx));
2297 emit_move_insn (operands[0], gen_lowpart (SImode, op0_di));
2301 (define_expand "umodsi3"
2302 [(set (match_operand:SI 0 "register_operand" "")
2303 (umod:SI (match_operand:SI 1 "general_operand" "")
2304 (match_operand:SI 2 "general_operand" "")))]
2305 "TARGET_INLINE_INT_DIV"
2307 rtx op2_neg, op1_di, div;
2309 div = gen_reg_rtx (SImode);
2310 emit_insn (gen_udivsi3 (div, operands[1], operands[2]));
2312 op2_neg = expand_unop (SImode, neg_optab, operands[2], NULL_RTX, 0);
2314 /* This is a trick to get us to reuse the value that we're sure to
2315 have already copied to the FP regs. */
2316 op1_di = gen_reg_rtx (DImode);
2317 convert_move (op1_di, operands[1], 1);
2319 emit_insn (gen_maddsi4 (operands[0], div, op2_neg,
2320 gen_lowpart (SImode, op1_di)));
2324 (define_insn_and_split "divsi3_internal"
2325 [(set (match_operand:XF 0 "fr_register_operand" "=&f")
2326 (float:XF (div:SI (match_operand:XF 1 "fr_register_operand" "f")
2327 (match_operand:XF 2 "fr_register_operand" "f"))))
2328 (clobber (match_scratch:XF 4 "=&f"))
2329 (clobber (match_scratch:XF 5 "=&f"))
2330 (clobber (match_scratch:BI 6 "=c"))
2331 (use (match_operand:XF 3 "fr_register_operand" "f"))]
2332 "TARGET_INLINE_INT_DIV"
2334 "&& reload_completed"
2335 [(parallel [(set (match_dup 0) (div:XF (const_int 1) (match_dup 2)))
2336 (set (match_dup 6) (unspec:BI [(match_dup 1) (match_dup 2)]
2337 UNSPEC_FR_RECIP_APPROX))
2338 (use (const_int 1))])
2339 (cond_exec (ne (match_dup 6) (const_int 0))
2340 (parallel [(set (match_dup 4) (mult:XF (match_dup 1) (match_dup 0)))
2341 (use (const_int 1))]))
2342 (cond_exec (ne (match_dup 6) (const_int 0))
2343 (parallel [(set (match_dup 5)
2344 (minus:XF (match_dup 7)
2345 (mult:XF (match_dup 2) (match_dup 0))))
2346 (use (const_int 1))]))
2347 (cond_exec (ne (match_dup 6) (const_int 0))
2348 (parallel [(set (match_dup 4)
2349 (plus:XF (mult:XF (match_dup 5) (match_dup 4))
2351 (use (const_int 1))]))
2352 (cond_exec (ne (match_dup 6) (const_int 0))
2353 (parallel [(set (match_dup 5)
2354 (plus:XF (mult:XF (match_dup 5) (match_dup 5))
2356 (use (const_int 1))]))
2357 (cond_exec (ne (match_dup 6) (const_int 0))
2358 (parallel [(set (match_dup 0)
2359 (plus:XF (mult:XF (match_dup 5) (match_dup 4))
2361 (use (const_int 1))]))
2363 "operands[7] = CONST1_RTX (XFmode);"
2364 [(set_attr "predicable" "no")])
2366 ;; ::::::::::::::::::::
2368 ;; :: 64 bit Integer arithmetic
2370 ;; ::::::::::::::::::::
2372 (define_insn "adddi3"
2373 [(set (match_operand:DI 0 "gr_register_operand" "=r,r,r")
2374 (plus:DI (match_operand:DI 1 "gr_register_operand" "%r,r,a")
2375 (match_operand:DI 2 "gr_reg_or_22bit_operand" "r,I,J")))]
2381 [(set_attr "itanium_class" "ialu")])
2383 (define_insn "*adddi3_plus1"
2384 [(set (match_operand:DI 0 "gr_register_operand" "=r")
2385 (plus:DI (plus:DI (match_operand:DI 1 "gr_register_operand" "r")
2386 (match_operand:DI 2 "gr_register_operand" "r"))
2389 "add %0 = %1, %2, 1"
2390 [(set_attr "itanium_class" "ialu")])
2392 ;; This has some of the same problems as shladd. We let the shladd
2393 ;; eliminator hack handle it, which results in the 1 being forced into
2394 ;; a register, but not more ugliness here.
2395 (define_insn "*adddi3_plus1_alt"
2396 [(set (match_operand:DI 0 "gr_register_operand" "=r")
2397 (plus:DI (mult:DI (match_operand:DI 1 "gr_register_operand" "r")
2401 "add %0 = %1, %1, 1"
2402 [(set_attr "itanium_class" "ialu")])
2404 (define_insn "subdi3"
2405 [(set (match_operand:DI 0 "gr_register_operand" "=r")
2406 (minus:DI (match_operand:DI 1 "gr_reg_or_8bit_operand" "rK")
2407 (match_operand:DI 2 "gr_register_operand" "r")))]
2410 [(set_attr "itanium_class" "ialu")])
2412 (define_insn "*subdi3_minus1"
2413 [(set (match_operand:DI 0 "gr_register_operand" "=r")
2414 (plus:DI (not:DI (match_operand:DI 1 "gr_register_operand" "r"))
2415 (match_operand:DI 2 "gr_register_operand" "r")))]
2417 "sub %0 = %2, %1, 1"
2418 [(set_attr "itanium_class" "ialu")])
2420 ;; ??? Use grfr instead of fr because of virtual register elimination
2421 ;; and silly test cases multiplying by the frame pointer.
2422 (define_insn "muldi3"
2423 [(set (match_operand:DI 0 "fr_register_operand" "=f")
2424 (mult:DI (match_operand:DI 1 "grfr_register_operand" "f")
2425 (match_operand:DI 2 "grfr_register_operand" "f")))]
2427 "xmpy.l %0 = %1, %2"
2428 [(set_attr "itanium_class" "xmpy")])
2430 ;; ??? If operand 3 is an eliminable reg, then register elimination causes the
2431 ;; same problem that we have with shladd below. Unfortunately, this case is
2432 ;; much harder to fix because the multiply puts the result in an FP register,
2433 ;; but the add needs inputs from a general register. We add a spurious clobber
2434 ;; here so that it will be present just in case register elimination gives us
2435 ;; the funny result.
2437 ;; ??? Maybe validate_changes should try adding match_scratch clobbers?
2439 ;; ??? Maybe we should change how adds are canonicalized.
2441 (define_insn "madddi4"
2442 [(set (match_operand:DI 0 "fr_register_operand" "=f")
2443 (plus:DI (mult:DI (match_operand:DI 1 "grfr_register_operand" "f")
2444 (match_operand:DI 2 "grfr_register_operand" "f"))
2445 (match_operand:DI 3 "grfr_register_operand" "f")))
2446 (clobber (match_scratch:DI 4 "=X"))]
2448 "xma.l %0 = %1, %2, %3"
2449 [(set_attr "itanium_class" "xmpy")])
2451 ;; This can be created by register elimination if operand3 of shladd is an
2452 ;; eliminable register or has reg_equiv_constant set.
2454 ;; We have to use nonmemory_operand for operand 4, to ensure that the
2455 ;; validate_changes call inside eliminate_regs will always succeed. If it
2456 ;; doesn't succeed, then this remain a madddi4 pattern, and will be reloaded
2459 (define_insn "*madddi4_elim"
2460 [(set (match_operand:DI 0 "register_operand" "=&r")
2461 (plus:DI (plus:DI (mult:DI (match_operand:DI 1 "register_operand" "f")
2462 (match_operand:DI 2 "register_operand" "f"))
2463 (match_operand:DI 3 "register_operand" "f"))
2464 (match_operand:DI 4 "nonmemory_operand" "rI")))
2465 (clobber (match_scratch:DI 5 "=f"))]
2466 "reload_in_progress"
2468 [(set_attr "itanium_class" "unknown")])
2471 [(set (match_operand:DI 0 "register_operand" "")
2472 (plus:DI (plus:DI (mult:DI (match_operand:DI 1 "register_operand" "")
2473 (match_operand:DI 2 "register_operand" ""))
2474 (match_operand:DI 3 "register_operand" ""))
2475 (match_operand:DI 4 "gr_reg_or_14bit_operand" "")))
2476 (clobber (match_scratch:DI 5 ""))]
2478 [(parallel [(set (match_dup 5) (plus:DI (mult:DI (match_dup 1) (match_dup 2))
2480 (clobber (match_dup 0))])
2481 (set (match_dup 0) (match_dup 5))
2482 (set (match_dup 0) (plus:DI (match_dup 0) (match_dup 4)))]
2485 ;; ??? There are highpart multiply and add instructions, but we have no way
2486 ;; to generate them.
2488 (define_insn "smuldi3_highpart"
2489 [(set (match_operand:DI 0 "fr_register_operand" "=f")
2492 (mult:TI (sign_extend:TI
2493 (match_operand:DI 1 "fr_register_operand" "f"))
2495 (match_operand:DI 2 "fr_register_operand" "f")))
2498 "xmpy.h %0 = %1, %2"
2499 [(set_attr "itanium_class" "xmpy")])
2501 (define_insn "umuldi3_highpart"
2502 [(set (match_operand:DI 0 "fr_register_operand" "=f")
2505 (mult:TI (zero_extend:TI
2506 (match_operand:DI 1 "fr_register_operand" "f"))
2508 (match_operand:DI 2 "fr_register_operand" "f")))
2511 "xmpy.hu %0 = %1, %2"
2512 [(set_attr "itanium_class" "xmpy")])
2514 (define_insn "negdi2"
2515 [(set (match_operand:DI 0 "gr_register_operand" "=r")
2516 (neg:DI (match_operand:DI 1 "gr_register_operand" "r")))]
2519 [(set_attr "itanium_class" "ialu")])
2521 (define_expand "absdi2"
2523 (ge:BI (match_operand:DI 1 "gr_register_operand" "") (const_int 0)))
2524 (set (match_operand:DI 0 "gr_register_operand" "")
2525 (if_then_else:DI (eq (match_dup 2) (const_int 0))
2526 (neg:DI (match_dup 1))
2529 { operands[2] = gen_reg_rtx (BImode); })
2531 (define_expand "smindi3"
2533 (ge:BI (match_operand:DI 1 "gr_register_operand" "")
2534 (match_operand:DI 2 "gr_register_operand" "")))
2535 (set (match_operand:DI 0 "gr_register_operand" "")
2536 (if_then_else:DI (ne (match_dup 3) (const_int 0))
2537 (match_dup 2) (match_dup 1)))]
2539 { operands[3] = gen_reg_rtx (BImode); })
2541 (define_expand "smaxdi3"
2543 (ge:BI (match_operand:DI 1 "gr_register_operand" "")
2544 (match_operand:DI 2 "gr_register_operand" "")))
2545 (set (match_operand:DI 0 "gr_register_operand" "")
2546 (if_then_else:DI (ne (match_dup 3) (const_int 0))
2547 (match_dup 1) (match_dup 2)))]
2549 { operands[3] = gen_reg_rtx (BImode); })
2551 (define_expand "umindi3"
2553 (geu:BI (match_operand:DI 1 "gr_register_operand" "")
2554 (match_operand:DI 2 "gr_register_operand" "")))
2555 (set (match_operand:DI 0 "gr_register_operand" "")
2556 (if_then_else:DI (ne (match_dup 3) (const_int 0))
2557 (match_dup 2) (match_dup 1)))]
2559 { operands[3] = gen_reg_rtx (BImode); })
2561 (define_expand "umaxdi3"
2563 (geu:BI (match_operand:DI 1 "gr_register_operand" "")
2564 (match_operand:DI 2 "gr_register_operand" "")))
2565 (set (match_operand:DI 0 "gr_register_operand" "")
2566 (if_then_else:DI (ne (match_dup 3) (const_int 0))
2567 (match_dup 1) (match_dup 2)))]
2569 { operands[3] = gen_reg_rtx (BImode); })
2571 (define_expand "ffsdi2"
2573 (eq:BI (match_operand:DI 1 "gr_register_operand" "") (const_int 0)))
2574 (set (match_dup 2) (plus:DI (match_dup 1) (const_int -1)))
2575 (set (match_dup 5) (const_int 0))
2576 (set (match_dup 3) (xor:DI (match_dup 1) (match_dup 2)))
2577 (set (match_dup 4) (popcount:DI (match_dup 3)))
2578 (set (match_operand:DI 0 "gr_register_operand" "")
2579 (if_then_else:DI (ne (match_dup 6) (const_int 0))
2580 (match_dup 5) (match_dup 4)))]
2583 operands[2] = gen_reg_rtx (DImode);
2584 operands[3] = gen_reg_rtx (DImode);
2585 operands[4] = gen_reg_rtx (DImode);
2586 operands[5] = gen_reg_rtx (DImode);
2587 operands[6] = gen_reg_rtx (BImode);
2590 (define_expand "ctzdi2"
2591 [(set (match_dup 2) (plus:DI (match_operand:DI 1 "gr_register_operand" "")
2593 (set (match_dup 3) (not:DI (match_dup 1)))
2594 (set (match_dup 4) (and:DI (match_dup 2) (match_dup 3)))
2595 (set (match_operand:DI 0 "gr_register_operand" "")
2596 (popcount:DI (match_dup 4)))]
2599 operands[2] = gen_reg_rtx (DImode);
2600 operands[3] = gen_reg_rtx (DImode);
2601 operands[4] = gen_reg_rtx (DImode);
2604 ;; Note the computation here is op0 = 63 - (exp - 0xffff).
2605 (define_expand "clzdi2"
2607 (unsigned_float:XF (match_operand:DI 1 "fr_register_operand" "")))
2609 (unspec:DI [(match_dup 2)] UNSPEC_GETF_EXP))
2610 (set (match_dup 4) (const_int 65598))
2611 (set (match_operand:DI 0 "gr_register_operand" "")
2612 (minus:DI (match_dup 4) (match_dup 3)))]
2615 operands[2] = gen_reg_rtx (XFmode);
2616 operands[3] = gen_reg_rtx (DImode);
2617 operands[4] = gen_reg_rtx (DImode);
2620 (define_insn "popcountdi2"
2621 [(set (match_operand:DI 0 "gr_register_operand" "=r")
2622 (popcount:DI (match_operand:DI 1 "gr_register_operand" "r")))]
2625 [(set_attr "itanium_class" "mmmul")])
2627 (define_insn "*getf_exp_xf"
2628 [(set (match_operand:DI 0 "gr_register_operand" "=r")
2629 (unspec:DI [(match_operand:XF 1 "fr_register_operand" "f")]
2633 [(set_attr "itanium_class" "frfr")])
2635 (define_expand "divdi3"
2636 [(set (match_operand:DI 0 "register_operand" "")
2637 (div:DI (match_operand:DI 1 "general_operand" "")
2638 (match_operand:DI 2 "general_operand" "")))]
2639 "TARGET_INLINE_INT_DIV"
2641 rtx op1_xf, op2_xf, op0_xf;
2643 op0_xf = gen_reg_rtx (XFmode);
2645 if (CONSTANT_P (operands[1]))
2646 operands[1] = force_reg (DImode, operands[1]);
2647 op1_xf = gen_reg_rtx (XFmode);
2648 expand_float (op1_xf, operands[1], 0);
2650 if (CONSTANT_P (operands[2]))
2651 operands[2] = force_reg (DImode, operands[2]);
2652 op2_xf = gen_reg_rtx (XFmode);
2653 expand_float (op2_xf, operands[2], 0);
2655 if (TARGET_INLINE_INT_DIV_LAT)
2656 emit_insn (gen_divdi3_internal_lat (op0_xf, op1_xf, op2_xf));
2658 emit_insn (gen_divdi3_internal_thr (op0_xf, op1_xf, op2_xf));
2660 emit_insn (gen_fix_truncxfdi2_alts (operands[0], op0_xf, const1_rtx));
2664 (define_expand "moddi3"
2665 [(set (match_operand:DI 0 "register_operand" "")
2666 (mod:SI (match_operand:DI 1 "general_operand" "")
2667 (match_operand:DI 2 "general_operand" "")))]
2668 "TARGET_INLINE_INT_DIV"
2672 div = gen_reg_rtx (DImode);
2673 emit_insn (gen_divdi3 (div, operands[1], operands[2]));
2675 op2_neg = expand_unop (DImode, neg_optab, operands[2], NULL_RTX, 0);
2677 emit_insn (gen_madddi4 (operands[0], div, op2_neg, operands[1]));
2681 (define_expand "udivdi3"
2682 [(set (match_operand:DI 0 "register_operand" "")
2683 (udiv:DI (match_operand:DI 1 "general_operand" "")
2684 (match_operand:DI 2 "general_operand" "")))]
2685 "TARGET_INLINE_INT_DIV"
2687 rtx op1_xf, op2_xf, op0_xf;
2689 op0_xf = gen_reg_rtx (XFmode);
2691 if (CONSTANT_P (operands[1]))
2692 operands[1] = force_reg (DImode, operands[1]);
2693 op1_xf = gen_reg_rtx (XFmode);
2694 expand_float (op1_xf, operands[1], 1);
2696 if (CONSTANT_P (operands[2]))
2697 operands[2] = force_reg (DImode, operands[2]);
2698 op2_xf = gen_reg_rtx (XFmode);
2699 expand_float (op2_xf, operands[2], 1);
2701 if (TARGET_INLINE_INT_DIV_LAT)
2702 emit_insn (gen_divdi3_internal_lat (op0_xf, op1_xf, op2_xf));
2704 emit_insn (gen_divdi3_internal_thr (op0_xf, op1_xf, op2_xf));
2706 emit_insn (gen_fixuns_truncxfdi2_alts (operands[0], op0_xf, const1_rtx));
2710 (define_expand "umoddi3"
2711 [(set (match_operand:DI 0 "register_operand" "")
2712 (umod:DI (match_operand:DI 1 "general_operand" "")
2713 (match_operand:DI 2 "general_operand" "")))]
2714 "TARGET_INLINE_INT_DIV"
2718 div = gen_reg_rtx (DImode);
2719 emit_insn (gen_udivdi3 (div, operands[1], operands[2]));
2721 op2_neg = expand_unop (DImode, neg_optab, operands[2], NULL_RTX, 0);
2723 emit_insn (gen_madddi4 (operands[0], div, op2_neg, operands[1]));
2727 (define_insn_and_split "divdi3_internal_lat"
2728 [(set (match_operand:XF 0 "fr_register_operand" "=&f")
2729 (float:XF (div:SI (match_operand:XF 1 "fr_register_operand" "f")
2730 (match_operand:XF 2 "fr_register_operand" "f"))))
2731 (clobber (match_scratch:XF 3 "=&f"))
2732 (clobber (match_scratch:XF 4 "=&f"))
2733 (clobber (match_scratch:XF 5 "=&f"))
2734 (clobber (match_scratch:BI 6 "=c"))]
2735 "TARGET_INLINE_INT_DIV_LAT"
2737 "&& reload_completed"
2738 [(parallel [(set (match_dup 0) (div:XF (const_int 1) (match_dup 2)))
2739 (set (match_dup 6) (unspec:BI [(match_dup 1) (match_dup 2)]
2740 UNSPEC_FR_RECIP_APPROX))
2741 (use (const_int 1))])
2742 (cond_exec (ne (match_dup 6) (const_int 0))
2743 (parallel [(set (match_dup 3)
2744 (minus:XF (match_dup 7)
2745 (mult:XF (match_dup 2) (match_dup 0))))
2746 (use (const_int 1))]))
2747 (cond_exec (ne (match_dup 6) (const_int 0))
2748 (parallel [(set (match_dup 4) (mult:XF (match_dup 1) (match_dup 0)))
2749 (use (const_int 1))]))
2750 (cond_exec (ne (match_dup 6) (const_int 0))
2751 (parallel [(set (match_dup 5) (mult:XF (match_dup 3) (match_dup 3)))
2752 (use (const_int 1))]))
2753 (cond_exec (ne (match_dup 6) (const_int 0))
2754 (parallel [(set (match_dup 4)
2755 (plus:XF (mult:XF (match_dup 3) (match_dup 4))
2757 (use (const_int 1))]))
2758 (cond_exec (ne (match_dup 6) (const_int 0))
2759 (parallel [(set (match_dup 0)
2760 (plus:XF (mult:XF (match_dup 3) (match_dup 0))
2762 (use (const_int 1))]))
2763 (cond_exec (ne (match_dup 6) (const_int 0))
2764 (parallel [(set (match_dup 3)
2765 (plus:XF (mult:XF (match_dup 5) (match_dup 4))
2767 (use (const_int 1))]))
2768 (cond_exec (ne (match_dup 6) (const_int 0))
2769 (parallel [(set (match_dup 0)
2770 (plus:XF (mult:XF (match_dup 5) (match_dup 0))
2772 (use (const_int 1))]))
2773 (cond_exec (ne (match_dup 6) (const_int 0))
2774 (parallel [(set (match_dup 4)
2775 (minus:XF (match_dup 1)
2776 (mult:XF (match_dup 2) (match_dup 3))))
2777 (use (const_int 1))]))
2778 (cond_exec (ne (match_dup 6) (const_int 0))
2779 (parallel [(set (match_dup 0)
2780 (plus:XF (mult:XF (match_dup 4) (match_dup 0))
2782 (use (const_int 1))]))
2784 "operands[7] = CONST1_RTX (XFmode);"
2785 [(set_attr "predicable" "no")])
2787 (define_insn_and_split "divdi3_internal_thr"
2788 [(set (match_operand:XF 0 "fr_register_operand" "=&f")
2789 (float:XF (div:SI (match_operand:XF 1 "fr_register_operand" "f")
2790 (match_operand:XF 2 "fr_register_operand" "f"))))
2791 (clobber (match_scratch:XF 3 "=&f"))
2792 (clobber (match_scratch:XF 4 "=f"))
2793 (clobber (match_scratch:BI 5 "=c"))]
2794 "TARGET_INLINE_INT_DIV_THR"
2796 "&& reload_completed"
2797 [(parallel [(set (match_dup 0) (div:XF (const_int 1) (match_dup 2)))
2798 (set (match_dup 5) (unspec:BI [(match_dup 1) (match_dup 2)]
2799 UNSPEC_FR_RECIP_APPROX))
2800 (use (const_int 1))])
2801 (cond_exec (ne (match_dup 5) (const_int 0))
2802 (parallel [(set (match_dup 3)
2803 (minus:XF (match_dup 6)
2804 (mult:XF (match_dup 2) (match_dup 0))))
2805 (use (const_int 1))]))
2806 (cond_exec (ne (match_dup 5) (const_int 0))
2807 (parallel [(set (match_dup 0)
2808 (plus:XF (mult:XF (match_dup 3) (match_dup 0))
2810 (use (const_int 1))]))
2811 (cond_exec (ne (match_dup 5) (const_int 0))
2812 (parallel [(set (match_dup 3) (mult:XF (match_dup 3) (match_dup 3)))
2813 (use (const_int 1))]))
2814 (cond_exec (ne (match_dup 5) (const_int 0))
2815 (parallel [(set (match_dup 0)
2816 (plus:XF (mult:XF (match_dup 3) (match_dup 0))
2818 (use (const_int 1))]))
2819 (cond_exec (ne (match_dup 5) (const_int 0))
2820 (parallel [(set (match_dup 3) (mult:XF (match_dup 0) (match_dup 1)))
2821 (use (const_int 1))]))
2822 (cond_exec (ne (match_dup 5) (const_int 0))
2823 (parallel [(set (match_dup 4)
2824 (minus:XF (match_dup 1)
2825 (mult:XF (match_dup 2) (match_dup 3))))
2826 (use (const_int 1))]))
2827 (cond_exec (ne (match_dup 5) (const_int 0))
2828 (parallel [(set (match_dup 0)
2829 (plus:XF (mult:XF (match_dup 4) (match_dup 0))
2831 (use (const_int 1))]))
2833 "operands[6] = CONST1_RTX (XFmode);"
2834 [(set_attr "predicable" "no")])
2836 ;; ::::::::::::::::::::
2838 ;; :: 32 bit floating point arithmetic
2840 ;; ::::::::::::::::::::
2842 (define_insn "addsf3"
2843 [(set (match_operand:SF 0 "fr_register_operand" "=f")
2844 (plus:SF (match_operand:SF 1 "fr_register_operand" "%f")
2845 (match_operand:SF 2 "fr_reg_or_fp01_operand" "fG")))]
2847 "fadd.s %0 = %1, %F2"
2848 [(set_attr "itanium_class" "fmac")])
2850 (define_insn "subsf3"
2851 [(set (match_operand:SF 0 "fr_register_operand" "=f")
2852 (minus:SF (match_operand:SF 1 "fr_reg_or_fp01_operand" "fG")
2853 (match_operand:SF 2 "fr_reg_or_fp01_operand" "fG")))]
2855 "fsub.s %0 = %F1, %F2"
2856 [(set_attr "itanium_class" "fmac")])
2858 (define_insn "mulsf3"
2859 [(set (match_operand:SF 0 "fr_register_operand" "=f")
2860 (mult:SF (match_operand:SF 1 "fr_register_operand" "%f")
2861 (match_operand:SF 2 "fr_register_operand" "f")))]
2863 "fmpy.s %0 = %1, %2"
2864 [(set_attr "itanium_class" "fmac")])
2866 (define_insn "abssf2"
2867 [(set (match_operand:SF 0 "fr_register_operand" "=f")
2868 (abs:SF (match_operand:SF 1 "fr_register_operand" "f")))]
2871 [(set_attr "itanium_class" "fmisc")])
2873 (define_insn "negsf2"
2874 [(set (match_operand:SF 0 "fr_register_operand" "=f")
2875 (neg:SF (match_operand:SF 1 "fr_register_operand" "f")))]
2878 [(set_attr "itanium_class" "fmisc")])
2880 (define_insn "*nabssf2"
2881 [(set (match_operand:SF 0 "fr_register_operand" "=f")
2882 (neg:SF (abs:SF (match_operand:SF 1 "fr_register_operand" "f"))))]
2885 [(set_attr "itanium_class" "fmisc")])
2887 (define_insn "minsf3"
2888 [(set (match_operand:SF 0 "fr_register_operand" "=f")
2889 (smin:SF (match_operand:SF 1 "fr_register_operand" "f")
2890 (match_operand:SF 2 "fr_reg_or_fp01_operand" "fG")))]
2893 [(set_attr "itanium_class" "fmisc")])
2895 (define_insn "maxsf3"
2896 [(set (match_operand:SF 0 "fr_register_operand" "=f")
2897 (smax:SF (match_operand:SF 1 "fr_register_operand" "f")
2898 (match_operand:SF 2 "fr_reg_or_fp01_operand" "fG")))]
2901 [(set_attr "itanium_class" "fmisc")])
2903 (define_insn "*maddsf4"
2904 [(set (match_operand:SF 0 "fr_register_operand" "=f")
2905 (plus:SF (mult:SF (match_operand:SF 1 "fr_register_operand" "f")
2906 (match_operand:SF 2 "fr_register_operand" "f"))
2907 (match_operand:SF 3 "fr_reg_or_fp01_operand" "fG")))]
2909 "fma.s %0 = %1, %2, %F3"
2910 [(set_attr "itanium_class" "fmac")])
2912 (define_insn "*msubsf4"
2913 [(set (match_operand:SF 0 "fr_register_operand" "=f")
2914 (minus:SF (mult:SF (match_operand:SF 1 "fr_register_operand" "f")
2915 (match_operand:SF 2 "fr_register_operand" "f"))
2916 (match_operand:SF 3 "fr_reg_or_fp01_operand" "fG")))]
2918 "fms.s %0 = %1, %2, %F3"
2919 [(set_attr "itanium_class" "fmac")])
2921 (define_insn "*nmulsf3"
2922 [(set (match_operand:SF 0 "fr_register_operand" "=f")
2923 (neg:SF (mult:SF (match_operand:SF 1 "fr_register_operand" "f")
2924 (match_operand:SF 2 "fr_register_operand" "f"))))]
2926 "fnmpy.s %0 = %1, %2"
2927 [(set_attr "itanium_class" "fmac")])
2929 (define_insn "*nmaddsf4"
2930 [(set (match_operand:SF 0 "fr_register_operand" "=f")
2931 (minus:SF (match_operand:SF 3 "fr_reg_or_fp01_operand" "fG")
2932 (mult:SF (match_operand:SF 1 "fr_register_operand" "f")
2933 (match_operand:SF 2 "fr_register_operand" "f"))))]
2935 "fnma.s %0 = %1, %2, %F3"
2936 [(set_attr "itanium_class" "fmac")])
2938 (define_insn "*nmaddsf4_alts"
2939 [(set (match_operand:SF 0 "fr_register_operand" "=f")
2940 (minus:SF (match_operand:SF 3 "fr_reg_or_fp01_operand" "fG")
2941 (mult:SF (match_operand:SF 1 "fr_register_operand" "f")
2942 (match_operand:SF 2 "fr_register_operand" "f"))))
2943 (use (match_operand:SI 4 "const_int_operand" ""))]
2945 "fnma.s.s%4 %0 = %1, %2, %F3"
2946 [(set_attr "itanium_class" "fmac")])
2948 (define_expand "divsf3"
2949 [(set (match_operand:SF 0 "fr_register_operand" "")
2950 (div:SF (match_operand:SF 1 "fr_register_operand" "")
2951 (match_operand:SF 2 "fr_register_operand" "")))]
2952 "TARGET_INLINE_FLOAT_DIV"
2955 if (TARGET_INLINE_FLOAT_DIV_LAT)
2956 insn = gen_divsf3_internal_lat (operands[0], operands[1], operands[2]);
2958 insn = gen_divsf3_internal_thr (operands[0], operands[1], operands[2]);
2963 (define_insn_and_split "divsf3_internal_lat"
2964 [(set (match_operand:SF 0 "fr_register_operand" "=&f")
2965 (div:SF (match_operand:SF 1 "fr_register_operand" "f")
2966 (match_operand:SF 2 "fr_register_operand" "f")))
2967 (clobber (match_scratch:XF 3 "=&f"))
2968 (clobber (match_scratch:XF 4 "=f"))
2969 (clobber (match_scratch:BI 5 "=c"))]
2970 "TARGET_INLINE_FLOAT_DIV_LAT"
2972 "&& reload_completed"
2973 [(parallel [(set (match_dup 6) (div:XF (const_int 1) (match_dup 8)))
2974 (set (match_dup 5) (unspec:BI [(match_dup 7) (match_dup 8)]
2975 UNSPEC_FR_RECIP_APPROX))
2976 (use (const_int 1))])
2977 (cond_exec (ne (match_dup 5) (const_int 0))
2978 (parallel [(set (match_dup 3) (mult:XF (match_dup 7) (match_dup 6)))
2979 (use (const_int 1))]))
2980 (cond_exec (ne (match_dup 5) (const_int 0))
2981 (parallel [(set (match_dup 4)
2982 (minus:XF (match_dup 10)
2983 (mult:XF (match_dup 8) (match_dup 6))))
2984 (use (const_int 1))]))
2985 (cond_exec (ne (match_dup 5) (const_int 0))
2986 (parallel [(set (match_dup 3)
2987 (plus:XF (mult:XF (match_dup 4) (match_dup 3))
2989 (use (const_int 1))]))
2990 (cond_exec (ne (match_dup 5) (const_int 0))
2991 (parallel [(set (match_dup 4) (mult:XF (match_dup 4) (match_dup 4)))
2992 (use (const_int 1))]))
2993 (cond_exec (ne (match_dup 5) (const_int 0))
2994 (parallel [(set (match_dup 3)
2995 (plus:XF (mult:XF (match_dup 4) (match_dup 3))
2997 (use (const_int 1))]))
2998 (cond_exec (ne (match_dup 5) (const_int 0))
2999 (parallel [(set (match_dup 4) (mult:XF (match_dup 4) (match_dup 4)))
3000 (use (const_int 1))]))
3001 (cond_exec (ne (match_dup 5) (const_int 0))
3002 (parallel [(set (match_dup 9)
3004 (plus:XF (mult:XF (match_dup 4) (match_dup 3))
3006 (use (const_int 1))]))
3007 (cond_exec (ne (match_dup 5) (const_int 0))
3009 (float_truncate:SF (match_dup 6))))
3012 operands[6] = gen_rtx_REG (XFmode, REGNO (operands[0]));
3013 operands[7] = gen_rtx_REG (XFmode, REGNO (operands[1]));
3014 operands[8] = gen_rtx_REG (XFmode, REGNO (operands[2]));
3015 operands[9] = gen_rtx_REG (DFmode, REGNO (operands[0]));
3016 operands[10] = CONST1_RTX (XFmode);
3018 [(set_attr "predicable" "no")])
3020 (define_insn_and_split "divsf3_internal_thr"
3021 [(set (match_operand:SF 0 "fr_register_operand" "=&f")
3022 (div:SF (match_operand:SF 1 "fr_register_operand" "f")
3023 (match_operand:SF 2 "fr_register_operand" "f")))
3024 (clobber (match_scratch:XF 3 "=&f"))
3025 (clobber (match_scratch:XF 4 "=f"))
3026 (clobber (match_scratch:BI 5 "=c"))]
3027 "TARGET_INLINE_FLOAT_DIV_THR"
3029 "&& reload_completed"
3030 [(parallel [(set (match_dup 6) (div:XF (const_int 1) (match_dup 8)))
3031 (set (match_dup 5) (unspec:BI [(match_dup 7) (match_dup 8)]
3032 UNSPEC_FR_RECIP_APPROX))
3033 (use (const_int 1))])
3034 (cond_exec (ne (match_dup 5) (const_int 0))
3035 (parallel [(set (match_dup 3)
3036 (minus:XF (match_dup 10)
3037 (mult:XF (match_dup 8) (match_dup 6))))
3038 (use (const_int 1))]))
3039 (cond_exec (ne (match_dup 5) (const_int 0))
3040 (parallel [(set (match_dup 3)
3041 (plus:XF (mult:XF (match_dup 3) (match_dup 3))
3043 (use (const_int 1))]))
3044 (cond_exec (ne (match_dup 5) (const_int 0))
3045 (parallel [(set (match_dup 6)
3046 (plus:XF (mult:XF (match_dup 3) (match_dup 6))
3048 (use (const_int 1))]))
3049 (cond_exec (ne (match_dup 5) (const_int 0))
3050 (parallel [(set (match_dup 9)
3052 (mult:XF (match_dup 7) (match_dup 6))))
3053 (use (const_int 1))]))
3054 (cond_exec (ne (match_dup 5) (const_int 0))
3055 (parallel [(set (match_dup 4)
3056 (minus:XF (match_dup 7)
3057 (mult:XF (match_dup 8) (match_dup 3))))
3058 (use (const_int 1))]))
3059 (cond_exec (ne (match_dup 5) (const_int 0))
3062 (plus:XF (mult:XF (match_dup 4) (match_dup 6))
3066 operands[6] = gen_rtx_REG (XFmode, REGNO (operands[0]));
3067 operands[7] = gen_rtx_REG (XFmode, REGNO (operands[1]));
3068 operands[8] = gen_rtx_REG (XFmode, REGNO (operands[2]));
3069 operands[9] = gen_rtx_REG (SFmode, REGNO (operands[3]));
3070 operands[10] = CONST1_RTX (XFmode);
3072 [(set_attr "predicable" "no")])
3074 ;; Inline square root.
3076 (define_insn "*sqrt_approx"
3077 [(set (match_operand:XF 0 "fr_register_operand" "=f")
3078 (div:XF (const_int 1)
3079 (sqrt:XF (match_operand:XF 2 "fr_register_operand" "f"))))
3080 (set (match_operand:BI 1 "register_operand" "=c")
3081 (unspec:BI [(match_dup 2)] UNSPEC_FR_SQRT_RECIP_APPROX))
3082 (use (match_operand:SI 3 "const_int_operand" "")) ]
3084 "frsqrta.s%3 %0, %1 = %2"
3085 [(set_attr "itanium_class" "fmisc")
3086 (set_attr "predicable" "no")])
3088 (define_insn "setf_exp_xf"
3089 [(set (match_operand:XF 0 "fr_register_operand" "=f")
3090 (unspec:XF [(match_operand:DI 1 "register_operand" "r")]
3094 [(set_attr "itanium_class" "frfr")])
3096 (define_expand "sqrtsf2"
3097 [(set (match_operand:SF 0 "fr_register_operand" "=&f")
3098 (sqrt:SF (match_operand:SF 1 "fr_register_operand" "f")))]
3099 "TARGET_INLINE_SQRT"
3102 if (TARGET_INLINE_SQRT_LAT)
3104 insn = gen_sqrtsf2_internal_lat (operands[0], operands[1]);
3109 insn = gen_sqrtsf2_internal_thr (operands[0], operands[1]);
3114 ;; Latency-optimized square root.
3115 ;; FIXME: Implement.
3117 ;; Throughput-optimized square root.
3119 (define_insn_and_split "sqrtsf2_internal_thr"
3120 [(set (match_operand:SF 0 "fr_register_operand" "=&f")
3121 (sqrt:SF (match_operand:SF 1 "fr_register_operand" "f")))
3122 ;; Register r2 in optimization guide.
3123 (clobber (match_scratch:DI 2 "=r"))
3124 ;; Register f8 in optimization guide
3125 (clobber (match_scratch:XF 3 "=&f"))
3126 ;; Register f9 in optimization guide
3127 (clobber (match_scratch:XF 4 "=&f"))
3128 ;; Register f10 in optimization guide
3129 (clobber (match_scratch:XF 5 "=&f"))
3130 ;; Register p6 in optimization guide.
3131 (clobber (match_scratch:BI 6 "=c"))]
3132 "TARGET_INLINE_SQRT_THR"
3134 "&& reload_completed"
3135 [ ;; exponent of +1/2 in r2
3136 (set (match_dup 2) (const_int 65534))
3139 (unspec:XF [(match_dup 2)] UNSPEC_SETF_EXP))
3141 ;; y0 = 1/sqrt(a) in f7
3142 (parallel [(set (match_dup 7)
3143 (div:XF (const_int 1)
3144 (sqrt:XF (match_dup 8))))
3146 (unspec:BI [(match_dup 8)]
3147 UNSPEC_FR_SQRT_RECIP_APPROX))
3148 (use (const_int 0))])
3150 ;; H0 = 1/2 * y0 in f9
3151 (cond_exec (ne (match_dup 6) (const_int 0))
3152 (parallel [(set (match_dup 4)
3153 (plus:XF (mult:XF (match_dup 3) (match_dup 7))
3155 (use (const_int 1))]))
3157 ;; S0 = a * y0 in f7
3158 (cond_exec (ne (match_dup 6) (const_int 0))
3159 (parallel [(set (match_dup 7)
3160 (plus:XF (mult:XF (match_dup 8) (match_dup 7))
3162 (use (const_int 1))]))
3164 ;; d = 1/2 - S0 * H0 in f10
3165 (cond_exec (ne (match_dup 6) (const_int 0))
3166 (parallel [(set (match_dup 5)
3167 (minus:XF (match_dup 3)
3168 (mult:XF (match_dup 7) (match_dup 4))))
3169 (use (const_int 1))]))
3171 ;; d' = d + 1/2 * d in f8
3172 (cond_exec (ne (match_dup 6) (const_int 0))
3173 (parallel [(set (match_dup 3)
3174 (plus:XF (mult:XF (match_dup 3) (match_dup 5))
3176 (use (const_int 1))]))
3178 ;; e = d + d * d' in f8
3179 (cond_exec (ne (match_dup 6) (const_int 0))
3180 (parallel [(set (match_dup 3)
3181 (plus:XF (mult:XF (match_dup 5) (match_dup 3))
3183 (use (const_int 1))]))
3185 ;; S1 = S0 + e * S0 in f7
3186 (cond_exec (ne (match_dup 6) (const_int 0))
3187 (parallel [(set (match_dup 0)
3189 (plus:XF (mult:XF (match_dup 3) (match_dup 7))
3191 (use (const_int 1))]))
3193 ;; H1 = H0 + e * H0 in f8
3194 (cond_exec (ne (match_dup 6) (const_int 0))
3195 (parallel [(set (match_dup 3)
3196 (plus:XF (mult:XF (match_dup 3) (match_dup 4))
3198 (use (const_int 1))]))
3200 ;; d1 = a - S1 * S1 in f9
3201 (cond_exec (ne (match_dup 6) (const_int 0))
3202 (parallel [(set (match_dup 4)
3203 (minus:XF (match_dup 8)
3204 (mult:XF (match_dup 7) (match_dup 7))))
3205 (use (const_int 1))]))
3207 ;; S = S1 + d1 * H1 in f7
3208 (cond_exec (ne (match_dup 6) (const_int 0))
3209 (parallel [(set (match_dup 0)
3211 (plus:XF (mult:XF (match_dup 4) (match_dup 3))
3213 (use (const_int 0))]))]
3215 /* Generate 82-bit versions of the input and output operands. */
3216 operands[7] = gen_rtx_REG (XFmode, REGNO (operands[0]));
3217 operands[8] = gen_rtx_REG (XFmode, REGNO (operands[1]));
3218 /* Generate required floating-point constants. */
3219 operands[9] = CONST0_RTX (XFmode);
3221 [(set_attr "predicable" "no")])
3223 ;; ::::::::::::::::::::
3225 ;; :: 64 bit floating point arithmetic
3227 ;; ::::::::::::::::::::
3229 (define_insn "adddf3"
3230 [(set (match_operand:DF 0 "fr_register_operand" "=f")
3231 (plus:DF (match_operand:DF 1 "fr_register_operand" "%f")
3232 (match_operand:DF 2 "fr_reg_or_fp01_operand" "fG")))]
3234 "fadd.d %0 = %1, %F2"
3235 [(set_attr "itanium_class" "fmac")])
3237 (define_insn "*adddf3_trunc"
3238 [(set (match_operand:SF 0 "fr_register_operand" "=f")
3240 (plus:DF (match_operand:DF 1 "fr_register_operand" "%f")
3241 (match_operand:DF 2 "fr_reg_or_fp01_operand" "fG"))))]
3243 "fadd.s %0 = %1, %F2"
3244 [(set_attr "itanium_class" "fmac")])
3246 (define_insn "subdf3"
3247 [(set (match_operand:DF 0 "fr_register_operand" "=f")
3248 (minus:DF (match_operand:DF 1 "fr_reg_or_fp01_operand" "fG")
3249 (match_operand:DF 2 "fr_reg_or_fp01_operand" "fG")))]
3251 "fsub.d %0 = %F1, %F2"
3252 [(set_attr "itanium_class" "fmac")])
3254 (define_insn "*subdf3_trunc"
3255 [(set (match_operand:SF 0 "fr_register_operand" "=f")
3257 (minus:DF (match_operand:DF 1 "fr_reg_or_fp01_operand" "fG")
3258 (match_operand:DF 2 "fr_reg_or_fp01_operand" "fG"))))]
3260 "fsub.s %0 = %F1, %F2"
3261 [(set_attr "itanium_class" "fmac")])
3263 (define_insn "muldf3"
3264 [(set (match_operand:DF 0 "fr_register_operand" "=f")
3265 (mult:DF (match_operand:DF 1 "fr_register_operand" "f")
3266 (match_operand:DF 2 "fr_register_operand" "f")))]
3268 "fmpy.d %0 = %1, %2"
3269 [(set_attr "itanium_class" "fmac")])
3271 (define_insn "*muldf3_trunc"
3272 [(set (match_operand:SF 0 "fr_register_operand" "=f")
3274 (mult:DF (match_operand:DF 1 "fr_register_operand" "f")
3275 (match_operand:DF 2 "fr_register_operand" "f"))))]
3277 "fmpy.s %0 = %1, %2"
3278 [(set_attr "itanium_class" "fmac")])
3280 (define_insn "absdf2"
3281 [(set (match_operand:DF 0 "fr_register_operand" "=f")
3282 (abs:DF (match_operand:DF 1 "fr_register_operand" "f")))]
3285 [(set_attr "itanium_class" "fmisc")])
3287 (define_insn "negdf2"
3288 [(set (match_operand:DF 0 "fr_register_operand" "=f")
3289 (neg:DF (match_operand:DF 1 "fr_register_operand" "f")))]
3292 [(set_attr "itanium_class" "fmisc")])
3294 (define_insn "*nabsdf2"
3295 [(set (match_operand:DF 0 "fr_register_operand" "=f")
3296 (neg:DF (abs:DF (match_operand:DF 1 "fr_register_operand" "f"))))]
3299 [(set_attr "itanium_class" "fmisc")])
3301 (define_insn "mindf3"
3302 [(set (match_operand:DF 0 "fr_register_operand" "=f")
3303 (smin:DF (match_operand:DF 1 "fr_register_operand" "f")
3304 (match_operand:DF 2 "fr_reg_or_fp01_operand" "fG")))]
3307 [(set_attr "itanium_class" "fmisc")])
3309 (define_insn "maxdf3"
3310 [(set (match_operand:DF 0 "fr_register_operand" "=f")
3311 (smax:DF (match_operand:DF 1 "fr_register_operand" "f")
3312 (match_operand:DF 2 "fr_reg_or_fp01_operand" "fG")))]
3315 [(set_attr "itanium_class" "fmisc")])
3317 (define_insn "*madddf4"
3318 [(set (match_operand:DF 0 "fr_register_operand" "=f")
3319 (plus:DF (mult:DF (match_operand:DF 1 "fr_register_operand" "f")
3320 (match_operand:DF 2 "fr_register_operand" "f"))
3321 (match_operand:DF 3 "fr_reg_or_fp01_operand" "fG")))]
3323 "fma.d %0 = %1, %2, %F3"
3324 [(set_attr "itanium_class" "fmac")])
3326 (define_insn "*madddf4_trunc"
3327 [(set (match_operand:SF 0 "fr_register_operand" "=f")
3329 (plus:DF (mult:DF (match_operand:DF 1 "fr_register_operand" "f")
3330 (match_operand:DF 2 "fr_register_operand" "f"))
3331 (match_operand:DF 3 "fr_reg_or_fp01_operand" "fG"))))]
3333 "fma.s %0 = %1, %2, %F3"
3334 [(set_attr "itanium_class" "fmac")])
3336 (define_insn "*msubdf4"
3337 [(set (match_operand:DF 0 "fr_register_operand" "=f")
3338 (minus:DF (mult:DF (match_operand:DF 1 "fr_register_operand" "f")
3339 (match_operand:DF 2 "fr_register_operand" "f"))
3340 (match_operand:DF 3 "fr_reg_or_fp01_operand" "fG")))]
3342 "fms.d %0 = %1, %2, %F3"
3343 [(set_attr "itanium_class" "fmac")])
3345 (define_insn "*msubdf4_trunc"
3346 [(set (match_operand:SF 0 "fr_register_operand" "=f")
3348 (minus:DF (mult:DF (match_operand:DF 1 "fr_register_operand" "f")
3349 (match_operand:DF 2 "fr_register_operand" "f"))
3350 (match_operand:DF 3 "fr_reg_or_fp01_operand" "fG"))))]
3352 "fms.s %0 = %1, %2, %F3"
3353 [(set_attr "itanium_class" "fmac")])
3355 (define_insn "*nmuldf3"
3356 [(set (match_operand:DF 0 "fr_register_operand" "=f")
3357 (neg:DF (mult:DF (match_operand:DF 1 "fr_register_operand" "f")
3358 (match_operand:DF 2 "fr_register_operand" "f"))))]
3360 "fnmpy.d %0 = %1, %2"
3361 [(set_attr "itanium_class" "fmac")])
3363 (define_insn "*nmuldf3_trunc"
3364 [(set (match_operand:SF 0 "fr_register_operand" "=f")
3366 (neg:DF (mult:DF (match_operand:DF 1 "fr_register_operand" "f")
3367 (match_operand:DF 2 "fr_register_operand" "f")))))]
3369 "fnmpy.s %0 = %1, %2"
3370 [(set_attr "itanium_class" "fmac")])
3372 (define_insn "*nmadddf4"
3373 [(set (match_operand:DF 0 "fr_register_operand" "=f")
3374 (minus:DF (match_operand:DF 3 "fr_reg_or_fp01_operand" "fG")
3375 (mult:DF (match_operand:DF 1 "fr_register_operand" "f")
3376 (match_operand:DF 2 "fr_register_operand" "f"))))]
3378 "fnma.d %0 = %1, %2, %F3"
3379 [(set_attr "itanium_class" "fmac")])
3381 (define_insn "*nmadddf4_alts"
3382 [(set (match_operand:DF 0 "fr_register_operand" "=f")
3383 (minus:DF (match_operand:DF 3 "fr_reg_or_fp01_operand" "fG")
3384 (mult:DF (match_operand:DF 1 "fr_register_operand" "f")
3385 (match_operand:DF 2 "fr_register_operand" "f"))))
3386 (use (match_operand:SI 4 "const_int_operand" ""))]
3388 "fnma.d.s%4 %0 = %1, %2, %F3"
3389 [(set_attr "itanium_class" "fmac")])
3391 (define_insn "*nmadddf4_truncsf"
3392 [(set (match_operand:SF 0 "fr_register_operand" "=f")
3394 (minus:DF (match_operand:DF 3 "fr_reg_or_fp01_operand" "fG")
3395 (mult:DF (match_operand:DF 1 "fr_register_operand" "f")
3396 (match_operand:DF 2 "fr_register_operand" "f")))))]
3398 "fnma.s %0 = %1, %2, %F3"
3399 [(set_attr "itanium_class" "fmac")])
3401 (define_insn "*nmadddf4_truncsf_alts"
3402 [(set (match_operand:SF 0 "fr_register_operand" "=f")
3404 (minus:DF (match_operand:DF 3 "fr_reg_or_fp01_operand" "fG")
3405 (mult:DF (match_operand:DF 1 "fr_register_operand" "f")
3406 (match_operand:DF 2 "fr_register_operand" "f")))))
3407 (use (match_operand:SI 4 "const_int_operand" ""))]
3409 "fnma.s.s%4 %0 = %1, %2, %F3"
3410 [(set_attr "itanium_class" "fmac")])
3412 (define_expand "divdf3"
3413 [(set (match_operand:DF 0 "fr_register_operand" "")
3414 (div:DF (match_operand:DF 1 "fr_register_operand" "")
3415 (match_operand:DF 2 "fr_register_operand" "")))]
3416 "TARGET_INLINE_FLOAT_DIV"
3419 if (TARGET_INLINE_FLOAT_DIV_LAT)
3420 insn = gen_divdf3_internal_lat (operands[0], operands[1], operands[2]);
3422 insn = gen_divdf3_internal_thr (operands[0], operands[1], operands[2]);
3427 (define_insn_and_split "divdf3_internal_lat"
3428 [(set (match_operand:DF 0 "fr_register_operand" "=&f")
3429 (div:DF (match_operand:DF 1 "fr_register_operand" "f")
3430 (match_operand:DF 2 "fr_register_operand" "f")))
3431 (clobber (match_scratch:XF 3 "=&f"))
3432 (clobber (match_scratch:XF 4 "=&f"))
3433 (clobber (match_scratch:XF 5 "=&f"))
3434 (clobber (match_scratch:BI 6 "=c"))]
3435 "TARGET_INLINE_FLOAT_DIV_LAT"
3437 "&& reload_completed"
3438 [(parallel [(set (match_dup 7) (div:XF (const_int 1) (match_dup 9)))
3439 (set (match_dup 6) (unspec:BI [(match_dup 8) (match_dup 9)]
3440 UNSPEC_FR_RECIP_APPROX))
3441 (use (const_int 1))])
3442 (cond_exec (ne (match_dup 6) (const_int 0))
3443 (parallel [(set (match_dup 3) (mult:XF (match_dup 8) (match_dup 7)))
3444 (use (const_int 1))]))
3445 (cond_exec (ne (match_dup 6) (const_int 0))
3446 (parallel [(set (match_dup 4)
3447 (minus:XF (match_dup 12)
3448 (mult:XF (match_dup 9) (match_dup 7))))
3449 (use (const_int 1))]))
3450 (cond_exec (ne (match_dup 6) (const_int 0))
3451 (parallel [(set (match_dup 3)
3452 (plus:XF (mult:XF (match_dup 4) (match_dup 3))
3454 (use (const_int 1))]))
3455 (cond_exec (ne (match_dup 6) (const_int 0))
3456 (parallel [(set (match_dup 5) (mult:XF (match_dup 4) (match_dup 4)))
3457 (use (const_int 1))]))
3458 (cond_exec (ne (match_dup 6) (const_int 0))
3459 (parallel [(set (match_dup 7)
3460 (plus:XF (mult:XF (match_dup 4) (match_dup 7))
3462 (use (const_int 1))]))
3463 (cond_exec (ne (match_dup 6) (const_int 0))
3464 (parallel [(set (match_dup 3)
3465 (plus:XF (mult:XF (match_dup 5) (match_dup 3))
3467 (use (const_int 1))]))
3468 (cond_exec (ne (match_dup 6) (const_int 0))
3469 (parallel [(set (match_dup 4) (mult:XF (match_dup 5) (match_dup 5)))
3470 (use (const_int 1))]))
3471 (cond_exec (ne (match_dup 6) (const_int 0))
3472 (parallel [(set (match_dup 7)
3473 (plus:XF (mult:XF (match_dup 5) (match_dup 7))
3475 (use (const_int 1))]))
3476 (cond_exec (ne (match_dup 6) (const_int 0))
3477 (parallel [(set (match_dup 10)
3479 (plus:XF (mult:XF (match_dup 4) (match_dup 3))
3481 (use (const_int 1))]))
3482 (cond_exec (ne (match_dup 6) (const_int 0))
3483 (parallel [(set (match_dup 7)
3484 (plus:XF (mult:XF (match_dup 4) (match_dup 7))
3486 (use (const_int 1))]))
3487 (cond_exec (ne (match_dup 6) (const_int 0))
3488 (parallel [(set (match_dup 11)
3490 (minus:XF (match_dup 8)
3491 (mult:XF (match_dup 9) (match_dup 3)))))
3492 (use (const_int 1))]))
3493 (cond_exec (ne (match_dup 6) (const_int 0))
3495 (float_truncate:DF (plus:XF (mult:XF (match_dup 5) (match_dup 7))
3499 operands[7] = gen_rtx_REG (XFmode, REGNO (operands[0]));
3500 operands[8] = gen_rtx_REG (XFmode, REGNO (operands[1]));
3501 operands[9] = gen_rtx_REG (XFmode, REGNO (operands[2]));
3502 operands[10] = gen_rtx_REG (DFmode, REGNO (operands[3]));
3503 operands[11] = gen_rtx_REG (DFmode, REGNO (operands[5]));
3504 operands[12] = CONST1_RTX (XFmode);
3506 [(set_attr "predicable" "no")])
3508 (define_insn_and_split "divdf3_internal_thr"
3509 [(set (match_operand:DF 0 "fr_register_operand" "=&f")
3510 (div:DF (match_operand:DF 1 "fr_register_operand" "f")
3511 (match_operand:DF 2 "fr_register_operand" "f")))
3512 (clobber (match_scratch:XF 3 "=&f"))
3513 (clobber (match_scratch:DF 4 "=f"))
3514 (clobber (match_scratch:BI 5 "=c"))]
3515 "TARGET_INLINE_FLOAT_DIV_THR"
3517 "&& reload_completed"
3518 [(parallel [(set (match_dup 6) (div:XF (const_int 1) (match_dup 8)))
3519 (set (match_dup 5) (unspec:BI [(match_dup 7) (match_dup 8)]
3520 UNSPEC_FR_RECIP_APPROX))
3521 (use (const_int 1))])
3522 (cond_exec (ne (match_dup 5) (const_int 0))
3523 (parallel [(set (match_dup 3)
3524 (minus:XF (match_dup 10)
3525 (mult:XF (match_dup 8) (match_dup 6))))
3526 (use (const_int 1))]))
3527 (cond_exec (ne (match_dup 5) (const_int 0))
3528 (parallel [(set (match_dup 6)
3529 (plus:XF (mult:XF (match_dup 3) (match_dup 6))
3531 (use (const_int 1))]))
3532 (cond_exec (ne (match_dup 5) (const_int 0))
3533 (parallel [(set (match_dup 3)
3534 (mult:XF (match_dup 3) (match_dup 3)))
3535 (use (const_int 1))]))
3536 (cond_exec (ne (match_dup 5) (const_int 0))
3537 (parallel [(set (match_dup 6)
3538 (plus:XF (mult:XF (match_dup 3) (match_dup 6))
3540 (use (const_int 1))]))
3541 (cond_exec (ne (match_dup 5) (const_int 0))
3542 (parallel [(set (match_dup 3)
3543 (mult:XF (match_dup 3) (match_dup 3)))
3544 (use (const_int 1))]))
3545 (cond_exec (ne (match_dup 5) (const_int 0))
3546 (parallel [(set (match_dup 6)
3547 (plus:XF (mult:XF (match_dup 3) (match_dup 6))
3549 (use (const_int 1))]))
3550 (cond_exec (ne (match_dup 5) (const_int 0))
3551 (parallel [(set (match_dup 9)
3553 (mult:XF (match_dup 7) (match_dup 6))))
3554 (use (const_int 1))]))
3555 (cond_exec (ne (match_dup 5) (const_int 0))
3556 (parallel [(set (match_dup 4)
3557 (minus:DF (match_dup 1)
3558 (mult:DF (match_dup 2) (match_dup 9))))
3559 (use (const_int 1))]))
3560 (cond_exec (ne (match_dup 5) (const_int 0))
3562 (plus:DF (mult:DF (match_dup 4) (match_dup 0))
3566 operands[6] = gen_rtx_REG (XFmode, REGNO (operands[0]));
3567 operands[7] = gen_rtx_REG (XFmode, REGNO (operands[1]));
3568 operands[8] = gen_rtx_REG (XFmode, REGNO (operands[2]));
3569 operands[9] = gen_rtx_REG (DFmode, REGNO (operands[3]));
3570 operands[10] = CONST1_RTX (XFmode);
3572 [(set_attr "predicable" "no")])
3574 ;; Inline square root.
3576 (define_expand "sqrtdf2"
3577 [(set (match_operand:DF 0 "fr_register_operand" "=&f")
3578 (sqrt:DF (match_operand:DF 1 "fr_register_operand" "f")))]
3579 "TARGET_INLINE_SQRT"
3582 if (TARGET_INLINE_SQRT_LAT)
3584 insn = gen_sqrtdf2_internal_lat (operands[0], operands[1]);
3589 insn = gen_sqrtdf2_internal_thr (operands[0], operands[1]);
3594 ;; Latency-optimized square root.
3595 ;; FIXME: Implement.
3597 ;; Throughput-optimized square root.
3599 (define_insn_and_split "sqrtdf2_internal_thr"
3600 [(set (match_operand:DF 0 "fr_register_operand" "=&f")
3601 (sqrt:DF (match_operand:DF 1 "fr_register_operand" "f")))
3602 ;; Register r2 in optimization guide.
3603 (clobber (match_scratch:DI 2 "=r"))
3604 ;; Register f8 in optimization guide
3605 (clobber (match_scratch:XF 3 "=&f"))
3606 ;; Register f9 in optimization guide
3607 (clobber (match_scratch:XF 4 "=&f"))
3608 ;; Register f10 in optimization guide
3609 (clobber (match_scratch:XF 5 "=&f"))
3610 ;; Register p6 in optimization guide.
3611 (clobber (match_scratch:BI 6 "=c"))]
3612 "TARGET_INLINE_SQRT_THR"
3614 "&& reload_completed"
3615 [ ;; exponent of +1/2 in r2
3616 (set (match_dup 2) (const_int 65534))
3619 (unspec:XF [(match_dup 2)] UNSPEC_SETF_EXP))
3621 ;; y0 = 1/sqrt(a) in f7
3622 (parallel [(set (match_dup 7)
3623 (div:XF (const_int 1)
3624 (sqrt:XF (match_dup 8))))
3626 (unspec:BI [(match_dup 8)]
3627 UNSPEC_FR_SQRT_RECIP_APPROX))
3628 (use (const_int 0))])
3630 ;; H0 = 1/2 * y0 in f8
3631 (cond_exec (ne (match_dup 6) (const_int 0))
3632 (parallel [(set (match_dup 3)
3633 (plus:XF (mult:XF (match_dup 5) (match_dup 7))
3635 (use (const_int 1))]))
3637 ;; G0 = a * y0 in f7
3638 (cond_exec (ne (match_dup 6) (const_int 0))
3639 (parallel [(set (match_dup 7)
3640 (plus:XF (mult:XF (match_dup 8) (match_dup 7))
3642 (use (const_int 1))]))
3644 ;; r0 = 1/2 - G0 * H0 in f9
3645 (cond_exec (ne (match_dup 6) (const_int 0))
3646 (parallel [(set (match_dup 4)
3647 (minus:XF (match_dup 5)
3648 (mult:XF (match_dup 7) (match_dup 3))))
3649 (use (const_int 1))]))
3651 ;; H1 = H0 + r0 * H0 in f8
3652 (cond_exec (ne (match_dup 6) (const_int 0))
3653 (parallel [(set (match_dup 3)
3654 (plus:XF (mult:XF (match_dup 4) (match_dup 3))
3656 (use (const_int 1))]))
3658 ;; G1 = G0 + r0 * G0 in f7
3659 (cond_exec (ne (match_dup 6) (const_int 0))
3660 (parallel [(set (match_dup 7)
3661 (plus:XF (mult:XF (match_dup 4) (match_dup 7))
3663 (use (const_int 1))]))
3665 ;; r1 = 1/2 - G1 * H1 in f9
3666 (cond_exec (ne (match_dup 6) (const_int 0))
3667 (parallel [(set (match_dup 4)
3668 (minus:XF (match_dup 5)
3669 (mult:XF (match_dup 7) (match_dup 3))))
3670 (use (const_int 1))]))
3672 ;; H2 = H1 + r1 * H1 in f8
3673 (cond_exec (ne (match_dup 6) (const_int 0))
3674 (parallel [(set (match_dup 3)
3675 (plus:XF (mult:XF (match_dup 4) (match_dup 3))
3677 (use (const_int 1))]))
3679 ;; G2 = G1 + r1 * G1 in f7
3680 (cond_exec (ne (match_dup 6) (const_int 0))
3681 (parallel [(set (match_dup 7)
3682 (plus:XF (mult:XF (match_dup 4) (match_dup 7))
3684 (use (const_int 1))]))
3686 ;; d2 = a - G2 * G2 in f9
3687 (cond_exec (ne (match_dup 6) (const_int 0))
3688 (parallel [(set (match_dup 4)
3689 (minus:XF (match_dup 8)
3690 (mult:XF (match_dup 7) (match_dup 7))))
3691 (use (const_int 1))]))
3693 ;; G3 = G2 + d2 * H2 in f7
3694 (cond_exec (ne (match_dup 6) (const_int 0))
3695 (parallel [(set (match_dup 7)
3696 (plus:XF (mult:XF (match_dup 4) (match_dup 3))
3698 (use (const_int 1))]))
3700 ;; d3 = a - G3 * G3 in f9
3701 (cond_exec (ne (match_dup 6) (const_int 0))
3702 (parallel [(set (match_dup 4)
3703 (minus:XF (match_dup 8)
3704 (mult:XF (match_dup 7) (match_dup 7))))
3705 (use (const_int 1))]))
3707 ;; S = G3 + d3 * H2 in f7
3708 (cond_exec (ne (match_dup 6) (const_int 0))
3709 (parallel [(set (match_dup 0)
3711 (plus:XF (mult:XF (match_dup 4) (match_dup 3))
3713 (use (const_int 0))]))]
3715 /* Generate 82-bit versions of the input and output operands. */
3716 operands[7] = gen_rtx_REG (XFmode, REGNO (operands[0]));
3717 operands[8] = gen_rtx_REG (XFmode, REGNO (operands[1]));
3718 /* Generate required floating-point constants. */
3719 operands[9] = CONST0_RTX (XFmode);
3721 [(set_attr "predicable" "no")])
3723 ;; ::::::::::::::::::::
3725 ;; :: 80 bit floating point arithmetic
3727 ;; ::::::::::::::::::::
3729 (define_insn "addxf3"
3730 [(set (match_operand:XF 0 "fr_register_operand" "=f")
3731 (plus:XF (match_operand:XF 1 "xfreg_or_fp01_operand" "fG")
3732 (match_operand:XF 2 "xfreg_or_fp01_operand" "fG")))]
3734 "fadd %0 = %F1, %F2"
3735 [(set_attr "itanium_class" "fmac")])
3737 (define_insn "*addxf3_truncsf"
3738 [(set (match_operand:SF 0 "fr_register_operand" "=f")
3740 (plus:XF (match_operand:XF 1 "xfreg_or_fp01_operand" "fG")
3741 (match_operand:XF 2 "xfreg_or_fp01_operand" "fG"))))]
3743 "fadd.s %0 = %F1, %F2"
3744 [(set_attr "itanium_class" "fmac")])
3746 (define_insn "*addxf3_truncdf"
3747 [(set (match_operand:DF 0 "fr_register_operand" "=f")
3749 (plus:XF (match_operand:XF 1 "xfreg_or_fp01_operand" "fG")
3750 (match_operand:XF 2 "xfreg_or_fp01_operand" "fG"))))]
3752 "fadd.d %0 = %F1, %F2"
3753 [(set_attr "itanium_class" "fmac")])
3755 (define_insn "subxf3"
3756 [(set (match_operand:XF 0 "fr_register_operand" "=f")
3757 (minus:XF (match_operand:XF 1 "xfreg_or_fp01_operand" "fG")
3758 (match_operand:XF 2 "xfreg_or_fp01_operand" "fG")))]
3760 "fsub %0 = %F1, %F2"
3761 [(set_attr "itanium_class" "fmac")])
3763 (define_insn "*subxf3_truncsf"
3764 [(set (match_operand:SF 0 "fr_register_operand" "=f")
3766 (minus:XF (match_operand:XF 1 "xfreg_or_fp01_operand" "fG")
3767 (match_operand:XF 2 "xfreg_or_fp01_operand" "fG"))))]
3769 "fsub.s %0 = %F1, %F2"
3770 [(set_attr "itanium_class" "fmac")])
3772 (define_insn "*subxf3_truncdf"
3773 [(set (match_operand:DF 0 "fr_register_operand" "=f")
3775 (minus:XF (match_operand:XF 1 "xfreg_or_fp01_operand" "fG")
3776 (match_operand:XF 2 "xfreg_or_fp01_operand" "fG"))))]
3778 "fsub.d %0 = %F1, %F2"
3779 [(set_attr "itanium_class" "fmac")])
3781 (define_insn "mulxf3"
3782 [(set (match_operand:XF 0 "fr_register_operand" "=f")
3783 (mult:XF (match_operand:XF 1 "xfreg_or_fp01_operand" "fG")
3784 (match_operand:XF 2 "xfreg_or_fp01_operand" "fG")))]
3786 "fmpy %0 = %F1, %F2"
3787 [(set_attr "itanium_class" "fmac")])
3789 (define_insn "*mulxf3_truncsf"
3790 [(set (match_operand:SF 0 "fr_register_operand" "=f")
3792 (mult:XF (match_operand:XF 1 "xfreg_or_fp01_operand" "fG")
3793 (match_operand:XF 2 "xfreg_or_fp01_operand" "fG"))))]
3795 "fmpy.s %0 = %F1, %F2"
3796 [(set_attr "itanium_class" "fmac")])
3798 (define_insn "*mulxf3_truncdf"
3799 [(set (match_operand:DF 0 "fr_register_operand" "=f")
3801 (mult:XF (match_operand:XF 1 "xfreg_or_fp01_operand" "fG")
3802 (match_operand:XF 2 "xfreg_or_fp01_operand" "fG"))))]
3804 "fmpy.d %0 = %F1, %F2"
3805 [(set_attr "itanium_class" "fmac")])
3807 (define_insn "*mulxf3_alts"
3808 [(set (match_operand:XF 0 "fr_register_operand" "=f")
3809 (mult:XF (match_operand:XF 1 "xfreg_or_fp01_operand" "fG")
3810 (match_operand:XF 2 "xfreg_or_fp01_operand" "fG")))
3811 (use (match_operand:SI 3 "const_int_operand" ""))]
3813 "fmpy.s%3 %0 = %F1, %F2"
3814 [(set_attr "itanium_class" "fmac")])
3816 (define_insn "*mulxf3_truncsf_alts"
3817 [(set (match_operand:SF 0 "fr_register_operand" "=f")
3819 (mult:XF (match_operand:XF 1 "xfreg_or_fp01_operand" "fG")
3820 (match_operand:XF 2 "xfreg_or_fp01_operand" "fG"))))
3821 (use (match_operand:SI 3 "const_int_operand" ""))]
3823 "fmpy.s.s%3 %0 = %F1, %F2"
3824 [(set_attr "itanium_class" "fmac")])
3826 (define_insn "*mulxf3_truncdf_alts"
3827 [(set (match_operand:DF 0 "fr_register_operand" "=f")
3829 (mult:XF (match_operand:XF 1 "xfreg_or_fp01_operand" "fG")
3830 (match_operand:XF 2 "xfreg_or_fp01_operand" "fG"))))
3831 (use (match_operand:SI 3 "const_int_operand" ""))]
3833 "fmpy.d.s%3 %0 = %F1, %F2"
3834 [(set_attr "itanium_class" "fmac")])
3836 (define_insn "absxf2"
3837 [(set (match_operand:XF 0 "fr_register_operand" "=f")
3838 (abs:XF (match_operand:XF 1 "xfreg_or_fp01_operand" "fG")))]
3841 [(set_attr "itanium_class" "fmisc")])
3843 (define_insn "negxf2"
3844 [(set (match_operand:XF 0 "fr_register_operand" "=f")
3845 (neg:XF (match_operand:XF 1 "xfreg_or_fp01_operand" "fG")))]
3848 [(set_attr "itanium_class" "fmisc")])
3850 (define_insn "*nabsxf2"
3851 [(set (match_operand:XF 0 "fr_register_operand" "=f")
3852 (neg:XF (abs:XF (match_operand:XF 1 "xfreg_or_fp01_operand" "fG"))))]
3855 [(set_attr "itanium_class" "fmisc")])
3857 (define_insn "minxf3"
3858 [(set (match_operand:XF 0 "fr_register_operand" "=f")
3859 (smin:XF (match_operand:XF 1 "xfreg_or_fp01_operand" "fG")
3860 (match_operand:XF 2 "xfreg_or_fp01_operand" "fG")))]
3862 "fmin %0 = %F1, %F2"
3863 [(set_attr "itanium_class" "fmisc")])
3865 (define_insn "maxxf3"
3866 [(set (match_operand:XF 0 "fr_register_operand" "=f")
3867 (smax:XF (match_operand:XF 1 "xfreg_or_fp01_operand" "fG")
3868 (match_operand:XF 2 "xfreg_or_fp01_operand" "fG")))]
3870 "fmax %0 = %F1, %F2"
3871 [(set_attr "itanium_class" "fmisc")])
3873 (define_insn "*maddxf4"
3874 [(set (match_operand:XF 0 "fr_register_operand" "=f")
3875 (plus:XF (mult:XF (match_operand:XF 1 "xfreg_or_fp01_operand" "fG")
3876 (match_operand:XF 2 "xfreg_or_fp01_operand" "fG"))
3877 (match_operand:XF 3 "xfreg_or_fp01_operand" "fG")))]
3879 "fma %0 = %F1, %F2, %F3"
3880 [(set_attr "itanium_class" "fmac")])
3882 (define_insn "*maddxf4_truncsf"
3883 [(set (match_operand:SF 0 "fr_register_operand" "=f")
3885 (plus:XF (mult:XF (match_operand:XF 1 "xfreg_or_fp01_operand" "fG")
3886 (match_operand:XF 2 "xfreg_or_fp01_operand" "fG"))
3887 (match_operand:XF 3 "xfreg_or_fp01_operand" "fG"))))]
3889 "fma.s %0 = %F1, %F2, %F3"
3890 [(set_attr "itanium_class" "fmac")])
3892 (define_insn "*maddxf4_truncdf"
3893 [(set (match_operand:DF 0 "fr_register_operand" "=f")
3895 (plus:XF (mult:XF (match_operand:XF 1 "xfreg_or_fp01_operand" "fG")
3896 (match_operand:XF 2 "xfreg_or_fp01_operand" "fG"))
3897 (match_operand:XF 3 "xfreg_or_fp01_operand" "fG"))))]
3899 "fma.d %0 = %F1, %F2, %F3"
3900 [(set_attr "itanium_class" "fmac")])
3902 (define_insn "*maddxf4_alts"
3903 [(set (match_operand:XF 0 "fr_register_operand" "=f")
3904 (plus:XF (mult:XF (match_operand:XF 1 "xfreg_or_fp01_operand" "fG")
3905 (match_operand:XF 2 "xfreg_or_fp01_operand" "fG"))
3906 (match_operand:XF 3 "xfreg_or_fp01_operand" "fG")))
3907 (use (match_operand:SI 4 "const_int_operand" ""))]
3909 "fma.s%4 %0 = %F1, %F2, %F3"
3910 [(set_attr "itanium_class" "fmac")])
3912 (define_insn "*maddxf4_alts_truncsf"
3913 [(set (match_operand:SF 0 "fr_register_operand" "=f")
3915 (plus:XF (mult:XF (match_operand:XF 1 "xfreg_or_fp01_operand" "fG")
3916 (match_operand:XF 2 "xfreg_or_fp01_operand" "fG"))
3917 (match_operand:XF 3 "xfreg_or_fp01_operand" "fG"))))
3918 (use (match_operand:SI 4 "const_int_operand" ""))]
3920 "fma.s.s%4 %0 = %F1, %F2, %F3"
3921 [(set_attr "itanium_class" "fmac")])
3923 (define_insn "*maddxf4_alts_truncdf"
3924 [(set (match_operand:DF 0 "fr_register_operand" "=f")
3926 (plus:XF (mult:XF (match_operand:XF 1 "xfreg_or_fp01_operand" "fG")
3927 (match_operand:XF 2 "xfreg_or_fp01_operand" "fG"))
3928 (match_operand:XF 3 "xfreg_or_fp01_operand" "fG"))))
3929 (use (match_operand:SI 4 "const_int_operand" ""))]
3931 "fma.d.s%4 %0 = %F1, %F2, %F3"
3932 [(set_attr "itanium_class" "fmac")])
3934 (define_insn "*msubxf4"
3935 [(set (match_operand:XF 0 "fr_register_operand" "=f")
3936 (minus:XF (mult:XF (match_operand:XF 1 "xfreg_or_fp01_operand" "fG")
3937 (match_operand:XF 2 "xfreg_or_fp01_operand" "fG"))
3938 (match_operand:XF 3 "xfreg_or_fp01_operand" "fG")))]
3940 "fms %0 = %F1, %F2, %F3"
3941 [(set_attr "itanium_class" "fmac")])
3943 (define_insn "*msubxf4_truncsf"
3944 [(set (match_operand:SF 0 "fr_register_operand" "=f")
3946 (minus:XF (mult:XF (match_operand:XF 1 "xfreg_or_fp01_operand" "fG")
3947 (match_operand:XF 2 "xfreg_or_fp01_operand" "fG"))
3948 (match_operand:XF 3 "xfreg_or_fp01_operand" "fG"))))]
3950 "fms.s %0 = %F1, %F2, %F3"
3951 [(set_attr "itanium_class" "fmac")])
3953 (define_insn "*msubxf4_truncdf"
3954 [(set (match_operand:DF 0 "fr_register_operand" "=f")
3956 (minus:XF (mult:XF (match_operand:XF 1 "xfreg_or_fp01_operand" "fG")
3957 (match_operand:XF 2 "xfreg_or_fp01_operand" "fG"))
3958 (match_operand:XF 3 "xfreg_or_fp01_operand" "fG"))))]
3960 "fms.d %0 = %F1, %F2, %F3"
3961 [(set_attr "itanium_class" "fmac")])
3963 (define_insn "*nmulxf3"
3964 [(set (match_operand:XF 0 "fr_register_operand" "=f")
3965 (neg:XF (mult:XF (match_operand:XF 1 "xfreg_or_fp01_operand" "fG")
3966 (match_operand:XF 2 "xfreg_or_fp01_operand" "fG"))))]
3968 "fnmpy %0 = %F1, %F2"
3969 [(set_attr "itanium_class" "fmac")])
3971 (define_insn "*nmulxf3_truncsf"
3972 [(set (match_operand:SF 0 "fr_register_operand" "=f")
3975 (match_operand:XF 1 "xfreg_or_fp01_operand" "fG")
3976 (match_operand:XF 2 "xfreg_or_fp01_operand" "fG")))))]
3978 "fnmpy.s %0 = %F1, %F2"
3979 [(set_attr "itanium_class" "fmac")])
3981 (define_insn "*nmulxf3_truncdf"
3982 [(set (match_operand:DF 0 "fr_register_operand" "=f")
3985 (match_operand:XF 1 "xfreg_or_fp01_operand" "fG")
3986 (match_operand:XF 2 "xfreg_or_fp01_operand" "fG")))))]
3988 "fnmpy.d %0 = %F1, %F2"
3989 [(set_attr "itanium_class" "fmac")])
3991 (define_insn "*nmaddxf4"
3992 [(set (match_operand:XF 0 "fr_register_operand" "=f")
3993 (minus:XF (match_operand:XF 3 "xfreg_or_fp01_operand" "fG")
3994 (mult:XF (match_operand:XF 1 "xfreg_or_fp01_operand" "fG")
3995 (match_operand:XF 2 "xfreg_or_fp01_operand" "fG")
3998 "fnma %0 = %F1, %F2, %F3"
3999 [(set_attr "itanium_class" "fmac")])
4001 (define_insn "*nmaddxf4_truncsf"
4002 [(set (match_operand:SF 0 "fr_register_operand" "=f")
4004 (minus:XF (match_operand:XF 3 "xfreg_or_fp01_operand" "fG")
4005 (mult:XF (match_operand:XF 1 "xfreg_or_fp01_operand" "fG")
4006 (match_operand:XF 2 "xfreg_or_fp01_operand" "fG")
4009 "fnma.s %0 = %F1, %F2, %F3"
4010 [(set_attr "itanium_class" "fmac")])
4012 (define_insn "*nmaddxf4_truncdf"
4013 [(set (match_operand:DF 0 "fr_register_operand" "=f")
4015 (minus:XF (match_operand:XF 3 "xfreg_or_fp01_operand" "fG")
4016 (mult:XF (match_operand:XF 1 "xfreg_or_fp01_operand" "fG")
4017 (match_operand:XF 2 "xfreg_or_fp01_operand" "fG")
4020 "fnma.d %0 = %F1, %F2, %F3"
4021 [(set_attr "itanium_class" "fmac")])
4023 (define_insn "*nmaddxf4_alts"
4024 [(set (match_operand:XF 0 "fr_register_operand" "=f")
4025 (minus:XF (match_operand:XF 3 "xfreg_or_fp01_operand" "fG")
4026 (mult:XF (match_operand:XF 1 "xfreg_or_fp01_operand" "fG")
4027 (match_operand:XF 2 "xfreg_or_fp01_operand" "fG")
4029 (use (match_operand:SI 4 "const_int_operand" ""))]
4031 "fnma.s%4 %0 = %F1, %F2, %F3"
4032 [(set_attr "itanium_class" "fmac")])
4034 (define_insn "*nmaddxf4_truncsf_alts"
4035 [(set (match_operand:SF 0 "fr_register_operand" "=f")
4037 (minus:XF (match_operand:XF 3 "xfreg_or_fp01_operand" "fG")
4038 (mult:XF (match_operand:XF 1 "xfreg_or_fp01_operand" "fG")
4039 (match_operand:XF 2 "xfreg_or_fp01_operand" "fG")
4041 (use (match_operand:SI 4 "const_int_operand" ""))]
4043 "fnma.s.s%4 %0 = %F1, %F2, %F3"
4044 [(set_attr "itanium_class" "fmac")])
4046 (define_insn "*nmaddxf4_truncdf_alts"
4047 [(set (match_operand:DF 0 "fr_register_operand" "=f")
4049 (minus:XF (match_operand:XF 3 "xfreg_or_fp01_operand" "fG")
4050 (mult:XF (match_operand:XF 1 "xfreg_or_fp01_operand" "fG")
4051 (match_operand:XF 2 "xfreg_or_fp01_operand" "fG")
4053 (use (match_operand:SI 4 "const_int_operand" ""))]
4055 "fnma.d.s%4 %0 = %F1, %F2, %F3"
4056 [(set_attr "itanium_class" "fmac")])
4058 (define_expand "divxf3"
4059 [(set (match_operand:XF 0 "fr_register_operand" "")
4060 (div:XF (match_operand:XF 1 "fr_register_operand" "")
4061 (match_operand:XF 2 "fr_register_operand" "")))]
4062 "TARGET_INLINE_FLOAT_DIV"
4065 if (TARGET_INLINE_FLOAT_DIV_LAT)
4066 insn = gen_divxf3_internal_lat (operands[0], operands[1], operands[2]);
4068 insn = gen_divxf3_internal_thr (operands[0], operands[1], operands[2]);
4073 (define_insn_and_split "divxf3_internal_lat"
4074 [(set (match_operand:XF 0 "fr_register_operand" "=&f")
4075 (div:XF (match_operand:XF 1 "fr_register_operand" "f")
4076 (match_operand:XF 2 "fr_register_operand" "f")))
4077 (clobber (match_scratch:XF 3 "=&f"))
4078 (clobber (match_scratch:XF 4 "=&f"))
4079 (clobber (match_scratch:XF 5 "=&f"))
4080 (clobber (match_scratch:XF 6 "=&f"))
4081 (clobber (match_scratch:BI 7 "=c"))]
4082 "TARGET_INLINE_FLOAT_DIV_LAT"
4084 "&& reload_completed"
4085 [(parallel [(set (match_dup 0) (div:XF (const_int 1) (match_dup 2)))
4086 (set (match_dup 7) (unspec:BI [(match_dup 1) (match_dup 2)]
4087 UNSPEC_FR_RECIP_APPROX))
4088 (use (const_int 1))])
4089 (cond_exec (ne (match_dup 7) (const_int 0))
4090 (parallel [(set (match_dup 3)
4091 (minus:XF (match_dup 8)
4092 (mult:XF (match_dup 2) (match_dup 0))))
4093 (use (const_int 1))]))
4094 (cond_exec (ne (match_dup 7) (const_int 0))
4095 (parallel [(set (match_dup 4) (mult:XF (match_dup 1) (match_dup 0)))
4096 (use (const_int 1))]))
4097 (cond_exec (ne (match_dup 7) (const_int 0))
4098 (parallel [(set (match_dup 5) (mult:XF (match_dup 3) (match_dup 3)))
4099 (use (const_int 1))]))
4100 (cond_exec (ne (match_dup 7) (const_int 0))
4101 (parallel [(set (match_dup 6)
4102 (plus:XF (mult:XF (match_dup 3) (match_dup 3))
4104 (use (const_int 1))]))
4105 (cond_exec (ne (match_dup 7) (const_int 0))
4106 (parallel [(set (match_dup 3)
4107 (plus:XF (mult:XF (match_dup 5) (match_dup 5))
4109 (use (const_int 1))]))
4110 (cond_exec (ne (match_dup 7) (const_int 0))
4111 (parallel [(set (match_dup 5)
4112 (plus:XF (mult:XF (match_dup 6) (match_dup 0))
4114 (use (const_int 1))]))
4115 (cond_exec (ne (match_dup 7) (const_int 0))
4116 (parallel [(set (match_dup 0)
4117 (plus:XF (mult:XF (match_dup 5) (match_dup 3))
4119 (use (const_int 1))]))
4120 (cond_exec (ne (match_dup 7) (const_int 0))
4121 (parallel [(set (match_dup 4)
4122 (minus:XF (match_dup 1)
4123 (mult:XF (match_dup 2) (match_dup 4))))
4124 (use (const_int 1))]))
4125 (cond_exec (ne (match_dup 7) (const_int 0))
4126 (parallel [(set (match_dup 3)
4127 (plus:XF (mult:XF (match_dup 3) (match_dup 0))
4129 (use (const_int 1))]))
4130 (cond_exec (ne (match_dup 7) (const_int 0))
4131 (parallel [(set (match_dup 5)
4132 (minus:XF (match_dup 8)
4133 (mult:XF (match_dup 2) (match_dup 0))))
4134 (use (const_int 1))]))
4135 (cond_exec (ne (match_dup 7) (const_int 0))
4136 (parallel [(set (match_dup 0)
4137 (plus:XF (mult:XF (match_dup 4) (match_dup 0))
4139 (use (const_int 1))]))
4140 (cond_exec (ne (match_dup 7) (const_int 0))
4141 (parallel [(set (match_dup 4)
4142 (minus:XF (match_dup 1)
4143 (mult:XF (match_dup 2) (match_dup 3))))
4144 (use (const_int 1))]))
4145 (cond_exec (ne (match_dup 7) (const_int 0))
4147 (plus:XF (mult:XF (match_dup 4) (match_dup 0))
4150 "operands[8] = CONST1_RTX (XFmode);"
4151 [(set_attr "predicable" "no")])
4153 (define_insn_and_split "divxf3_internal_thr"
4154 [(set (match_operand:XF 0 "fr_register_operand" "=&f")
4155 (div:XF (match_operand:XF 1 "fr_register_operand" "f")
4156 (match_operand:XF 2 "fr_register_operand" "f")))
4157 (clobber (match_scratch:XF 3 "=&f"))
4158 (clobber (match_scratch:XF 4 "=&f"))
4159 (clobber (match_scratch:BI 5 "=c"))]
4160 "TARGET_INLINE_FLOAT_DIV_THR"
4162 "&& reload_completed"
4163 [(parallel [(set (match_dup 0) (div:XF (const_int 1) (match_dup 2)))
4164 (set (match_dup 5) (unspec:BI [(match_dup 1) (match_dup 2)]
4165 UNSPEC_FR_RECIP_APPROX))
4166 (use (const_int 1))])
4167 (cond_exec (ne (match_dup 5) (const_int 0))
4168 (parallel [(set (match_dup 3)
4169 (minus:XF (match_dup 6)
4170 (mult:XF (match_dup 2) (match_dup 0))))
4171 (use (const_int 1))]))
4172 (cond_exec (ne (match_dup 5) (const_int 0))
4173 (parallel [(set (match_dup 4)
4174 (plus:XF (mult:XF (match_dup 3) (match_dup 0))
4176 (use (const_int 1))]))
4177 (cond_exec (ne (match_dup 5) (const_int 0))
4178 (parallel [(set (match_dup 3) (mult:XF (match_dup 3) (match_dup 3)))
4179 (use (const_int 1))]))
4180 (cond_exec (ne (match_dup 5) (const_int 0))
4181 (parallel [(set (match_dup 3)
4182 (plus:XF (mult:XF (match_dup 3) (match_dup 4))
4184 (use (const_int 1))]))
4185 (cond_exec (ne (match_dup 5) (const_int 0))
4186 (parallel [(set (match_dup 4) (mult:XF (match_dup 1) (match_dup 0)))
4187 (use (const_int 1))]))
4188 (cond_exec (ne (match_dup 5) (const_int 0))
4189 (parallel [(set (match_dup 0)
4190 (minus:XF (match_dup 6)
4191 (mult:XF (match_dup 2) (match_dup 3))))
4192 (use (const_int 1))]))
4193 (cond_exec (ne (match_dup 5) (const_int 0))
4194 (parallel [(set (match_dup 0)
4195 (plus:XF (mult:XF (match_dup 0) (match_dup 3))
4197 (use (const_int 1))]))
4198 (cond_exec (ne (match_dup 5) (const_int 0))
4199 (parallel [(set (match_dup 3)
4200 (minus:XF (match_dup 1)
4201 (mult:XF (match_dup 2) (match_dup 4))))
4202 (use (const_int 1))]))
4203 (cond_exec (ne (match_dup 5) (const_int 0))
4204 (parallel [(set (match_dup 3)
4205 (plus:XF (mult:XF (match_dup 3) (match_dup 0))
4207 (use (const_int 1))]))
4208 (cond_exec (ne (match_dup 5) (const_int 0))
4209 (parallel [(set (match_dup 4)
4210 (minus:XF (match_dup 6)
4211 (mult:XF (match_dup 2) (match_dup 0))))
4212 (use (const_int 1))]))
4213 (cond_exec (ne (match_dup 5) (const_int 0))
4214 (parallel [(set (match_dup 0)
4215 (plus:XF (mult:XF (match_dup 4) (match_dup 0))
4217 (use (const_int 1))]))
4218 (cond_exec (ne (match_dup 5) (const_int 0))
4219 (parallel [(set (match_dup 4)
4220 (minus:XF (match_dup 1)
4221 (mult:XF (match_dup 2) (match_dup 3))))
4222 (use (const_int 1))]))
4223 (cond_exec (ne (match_dup 5) (const_int 0))
4225 (plus:XF (mult:XF (match_dup 4) (match_dup 0))
4228 "operands[6] = CONST1_RTX (XFmode);"
4229 [(set_attr "predicable" "no")])
4231 ;; Inline square root.
4233 (define_expand "sqrtxf2"
4234 [(set (match_operand:XF 0 "fr_register_operand" "=&f")
4235 (sqrt:XF (match_operand:XF 1 "fr_register_operand" "f")))]
4236 "TARGET_INLINE_SQRT"
4239 if (TARGET_INLINE_SQRT_LAT)
4241 insn = gen_sqrtxf2_internal_lat (operands[0], operands[1]);
4246 insn = gen_sqrtxf2_internal_thr (operands[0], operands[1]);
4251 ;; Latency-optimized square root.
4252 ;; FIXME: Implement.
4254 ;; Throughput-optimized square root.
4256 (define_insn_and_split "sqrtxf2_internal_thr"
4257 [(set (match_operand:XF 0 "fr_register_operand" "=&f")
4258 (sqrt:XF (match_operand:XF 1 "fr_register_operand" "f")))
4259 ;; Register r2 in optimization guide.
4260 (clobber (match_scratch:DI 2 "=r"))
4261 ;; Register f8 in optimization guide
4262 (clobber (match_scratch:XF 3 "=&f"))
4263 ;; Register f9 in optimization guide
4264 (clobber (match_scratch:XF 4 "=&f"))
4265 ;; Register f10 in optimization guide
4266 (clobber (match_scratch:XF 5 "=&f"))
4267 ;; Register f11 in optimization guide
4268 (clobber (match_scratch:XF 6 "=&f"))
4269 ;; Register p6 in optimization guide.
4270 (clobber (match_scratch:BI 7 "=c"))]
4271 "TARGET_INLINE_SQRT_THR"
4273 "&& reload_completed"
4274 [ ;; exponent of +1/2 in r2
4275 (set (match_dup 2) (const_int 65534))
4276 ;; +1/2 in f8. The Intel manual mistakenly specifies f10.
4278 (unspec:XF [(match_dup 2)] UNSPEC_SETF_EXP))
4280 ;; y0 = 1/sqrt(a) in f7
4281 (parallel [(set (match_dup 8)
4282 (div:XF (const_int 1)
4283 (sqrt:XF (match_dup 9))))
4285 (unspec:BI [(match_dup 9)]
4286 UNSPEC_FR_SQRT_RECIP_APPROX))
4287 (use (const_int 0))])
4289 ;; H0 = 1/2 * y0 in f9
4290 (cond_exec (ne (match_dup 7) (const_int 0))
4291 (parallel [(set (match_dup 4)
4292 (plus:XF (mult:XF (match_dup 3) (match_dup 8))
4294 (use (const_int 1))]))
4296 ;; S0 = a * y0 in f7
4297 (cond_exec (ne (match_dup 7) (const_int 0))
4298 (parallel [(set (match_dup 8)
4299 (plus:XF (mult:XF (match_dup 9) (match_dup 8))
4301 (use (const_int 1))]))
4303 ;; d0 = 1/2 - S0 * H0 in f10
4304 (cond_exec (ne (match_dup 7) (const_int 0))
4305 (parallel [(set (match_dup 5)
4306 (minus:XF (match_dup 3)
4307 (mult:XF (match_dup 8) (match_dup 4))))
4308 (use (const_int 1))]))
4310 ;; H1 = H0 + d0 * H0 in f9
4311 (cond_exec (ne (match_dup 7) (const_int 0))
4312 (parallel [(set (match_dup 4)
4313 (plus:XF (mult:XF (match_dup 5) (match_dup 4))
4315 (use (const_int 1))]))
4317 ;; S1 = S0 + d0 * S0 in f7
4318 (cond_exec (ne (match_dup 7) (const_int 0))
4319 (parallel [(set (match_dup 8)
4320 (plus:XF (mult:XF (match_dup 5) (match_dup 8))
4322 (use (const_int 1))]))
4324 ;; d1 = 1/2 - S1 * H1 in f10
4325 (cond_exec (ne (match_dup 7) (const_int 0))
4326 (parallel [(set (match_dup 5)
4327 (minus:XF (match_dup 3)
4328 (mult:XF (match_dup 8) (match_dup 4))))
4329 (use (const_int 1))]))
4331 ;; H2 = H1 + d1 * H1 in f9
4332 (cond_exec (ne (match_dup 7) (const_int 0))
4333 (parallel [(set (match_dup 4)
4334 (plus:XF (mult:XF (match_dup 5) (match_dup 4))
4336 (use (const_int 1))]))
4338 ;; S2 = S1 + d1 * S1 in f7
4339 (cond_exec (ne (match_dup 7) (const_int 0))
4340 (parallel [(set (match_dup 8)
4341 (plus:XF (mult:XF (match_dup 5) (match_dup 8))
4343 (use (const_int 1))]))
4345 ;; d2 = 1/2 - S2 * H2 in f10
4346 (cond_exec (ne (match_dup 7) (const_int 0))
4347 (parallel [(set (match_dup 5)
4348 (minus:XF (match_dup 3)
4349 (mult:XF (match_dup 8) (match_dup 4))))
4350 (use (const_int 1))]))
4352 ;; e2 = a - S2 * S2 in f8
4353 (cond_exec (ne (match_dup 7) (const_int 0))
4354 (parallel [(set (match_dup 3)
4355 (minus:XF (match_dup 9)
4356 (mult:XF (match_dup 8) (match_dup 8))))
4357 (use (const_int 1))]))
4359 ;; S3 = S2 + e2 * H2 in f7
4360 (cond_exec (ne (match_dup 7) (const_int 0))
4361 (parallel [(set (match_dup 8)
4362 (plus:XF (mult:XF (match_dup 3) (match_dup 4))
4364 (use (const_int 1))]))
4366 ;; H3 = H2 + d2 * H2 in f9
4367 (cond_exec (ne (match_dup 7) (const_int 0))
4368 (parallel [(set (match_dup 4)
4369 (plus:XF (mult:XF (match_dup 5) (match_dup 4))
4371 (use (const_int 1))]))
4373 ;; e3 = a - S3 * S3 in f8
4374 (cond_exec (ne (match_dup 7) (const_int 0))
4375 (parallel [(set (match_dup 3)
4376 (minus:XF (match_dup 9)
4377 (mult:XF (match_dup 8) (match_dup 8))))
4378 (use (const_int 1))]))
4380 ;; S = S3 + e3 * H3 in f7
4381 (cond_exec (ne (match_dup 7) (const_int 0))
4382 (parallel [(set (match_dup 0)
4383 (plus:XF (mult:XF (match_dup 3) (match_dup 4))
4385 (use (const_int 0))]))]
4387 /* Generate 82-bit versions of the input and output operands. */
4388 operands[8] = gen_rtx_REG (XFmode, REGNO (operands[0]));
4389 operands[9] = gen_rtx_REG (XFmode, REGNO (operands[1]));
4390 /* Generate required floating-point constants. */
4391 operands[10] = CONST0_RTX (XFmode);
4393 [(set_attr "predicable" "no")])
4395 ;; ??? frcpa works like cmp.foo.unc.
4397 (define_insn "*recip_approx"
4398 [(set (match_operand:XF 0 "fr_register_operand" "=f")
4399 (div:XF (const_int 1)
4400 (match_operand:XF 3 "fr_register_operand" "f")))
4401 (set (match_operand:BI 1 "register_operand" "=c")
4402 (unspec:BI [(match_operand:XF 2 "fr_register_operand" "f")
4403 (match_dup 3)] UNSPEC_FR_RECIP_APPROX))
4404 (use (match_operand:SI 4 "const_int_operand" ""))]
4406 "frcpa.s%4 %0, %1 = %2, %3"
4407 [(set_attr "itanium_class" "fmisc")
4408 (set_attr "predicable" "no")])
4410 ;; ::::::::::::::::::::
4412 ;; :: 32 bit Integer Shifts and Rotates
4414 ;; ::::::::::::::::::::
4416 (define_expand "ashlsi3"
4417 [(set (match_operand:SI 0 "gr_register_operand" "")
4418 (ashift:SI (match_operand:SI 1 "gr_register_operand" "")
4419 (match_operand:SI 2 "gr_reg_or_5bit_operand" "")))]
4422 if (GET_CODE (operands[2]) != CONST_INT)
4424 /* Why oh why didn't Intel arrange for SHIFT_COUNT_TRUNCATED? Now
4425 we've got to get rid of stray bits outside the SImode register. */
4426 rtx subshift = gen_reg_rtx (DImode);
4427 emit_insn (gen_zero_extendsidi2 (subshift, operands[2]));
4428 operands[2] = subshift;
4432 (define_insn "*ashlsi3_internal"
4433 [(set (match_operand:SI 0 "gr_register_operand" "=r,r,r")
4434 (ashift:SI (match_operand:SI 1 "gr_register_operand" "r,r,r")
4435 (match_operand:DI 2 "gr_reg_or_5bit_operand" "R,n,r")))]
4438 shladd %0 = %1, %2, r0
4439 dep.z %0 = %1, %2, %E2
4441 [(set_attr "itanium_class" "ialu,ishf,mmshf")])
4443 (define_expand "ashrsi3"
4444 [(set (match_operand:SI 0 "gr_register_operand" "")
4445 (ashiftrt:SI (match_operand:SI 1 "gr_register_operand" "")
4446 (match_operand:SI 2 "gr_reg_or_5bit_operand" "")))]
4449 rtx subtarget = gen_reg_rtx (DImode);
4450 if (GET_CODE (operands[2]) == CONST_INT)
4451 emit_insn (gen_extv (subtarget, gen_lowpart (DImode, operands[1]),
4452 GEN_INT (32 - INTVAL (operands[2])), operands[2]));
4455 rtx subshift = gen_reg_rtx (DImode);
4456 emit_insn (gen_extendsidi2 (subtarget, operands[1]));
4457 emit_insn (gen_zero_extendsidi2 (subshift, operands[2]));
4458 emit_insn (gen_ashrdi3 (subtarget, subtarget, subshift));
4460 emit_move_insn (gen_lowpart (DImode, operands[0]), subtarget);
4464 (define_expand "lshrsi3"
4465 [(set (match_operand:SI 0 "gr_register_operand" "")
4466 (lshiftrt:SI (match_operand:SI 1 "gr_register_operand" "")
4467 (match_operand:SI 2 "gr_reg_or_5bit_operand" "")))]
4470 rtx subtarget = gen_reg_rtx (DImode);
4471 if (GET_CODE (operands[2]) == CONST_INT)
4472 emit_insn (gen_extzv (subtarget, gen_lowpart (DImode, operands[1]),
4473 GEN_INT (32 - INTVAL (operands[2])), operands[2]));
4476 rtx subshift = gen_reg_rtx (DImode);
4477 emit_insn (gen_zero_extendsidi2 (subtarget, operands[1]));
4478 emit_insn (gen_zero_extendsidi2 (subshift, operands[2]));
4479 emit_insn (gen_lshrdi3 (subtarget, subtarget, subshift));
4481 emit_move_insn (gen_lowpart (DImode, operands[0]), subtarget);
4485 ;; Use mix4.r/shr to implement rotrsi3. We only get 32 bits of valid result
4486 ;; here, instead of 64 like the patterns above. Keep the pattern together
4487 ;; until after combine; otherwise it won't get matched often.
4489 (define_expand "rotrsi3"
4490 [(set (match_operand:SI 0 "gr_register_operand" "")
4491 (rotatert:SI (match_operand:SI 1 "gr_register_operand" "")
4492 (match_operand:SI 2 "gr_reg_or_5bit_operand" "")))]
4495 if (GET_MODE (operands[2]) != VOIDmode)
4497 rtx tmp = gen_reg_rtx (DImode);
4498 emit_insn (gen_zero_extendsidi2 (tmp, operands[2]));
4503 (define_insn_and_split "*rotrsi3_internal"
4504 [(set (match_operand:SI 0 "gr_register_operand" "=&r")
4505 (rotatert:SI (match_operand:SI 1 "gr_register_operand" "r")
4506 (match_operand:DI 2 "gr_reg_or_5bit_operand" "rM")))]
4511 (ior:DI (zero_extend:DI (match_dup 1))
4512 (ashift:DI (zero_extend:DI (match_dup 1)) (const_int 32))))
4514 (lshiftrt:DI (match_dup 3) (match_dup 2)))]
4515 "operands[3] = gen_rtx_REG (DImode, REGNO (operands[0]));")
4517 (define_expand "rotlsi3"
4518 [(set (match_operand:SI 0 "gr_register_operand" "")
4519 (rotate:SI (match_operand:SI 1 "gr_register_operand" "")
4520 (match_operand:SI 2 "gr_reg_or_5bit_operand" "")))]
4523 if (! shift_32bit_count_operand (operands[2], SImode))
4525 rtx tmp = gen_reg_rtx (SImode);
4526 emit_insn (gen_subsi3 (tmp, GEN_INT (32), operands[2]));
4527 emit_insn (gen_rotrsi3 (operands[0], operands[1], tmp));
4532 (define_insn_and_split "*rotlsi3_internal"
4533 [(set (match_operand:SI 0 "gr_register_operand" "=r")
4534 (rotate:SI (match_operand:SI 1 "gr_register_operand" "r")
4535 (match_operand:SI 2 "shift_32bit_count_operand" "n")))]
4540 (ior:DI (zero_extend:DI (match_dup 1))
4541 (ashift:DI (zero_extend:DI (match_dup 1)) (const_int 32))))
4543 (lshiftrt:DI (match_dup 3) (match_dup 2)))]
4545 operands[3] = gen_rtx_REG (DImode, REGNO (operands[0]));
4546 operands[2] = GEN_INT (32 - INTVAL (operands[2]));
4549 ;; ::::::::::::::::::::
4551 ;; :: 64 bit Integer Shifts and Rotates
4553 ;; ::::::::::::::::::::
4555 (define_insn "ashldi3"
4556 [(set (match_operand:DI 0 "gr_register_operand" "=r,r,r")
4557 (ashift:DI (match_operand:DI 1 "gr_register_operand" "r,r,r")
4558 (match_operand:DI 2 "gr_reg_or_6bit_operand" "R,r,rM")))]
4561 shladd %0 = %1, %2, r0
4564 [(set_attr "itanium_class" "ialu,mmshf,mmshfi")])
4566 ;; ??? Maybe combine this with the multiply and add instruction?
4568 (define_insn "*shladd"
4569 [(set (match_operand:DI 0 "gr_register_operand" "=r")
4570 (plus:DI (mult:DI (match_operand:DI 1 "gr_register_operand" "r")
4571 (match_operand:DI 2 "shladd_operand" "n"))
4572 (match_operand:DI 3 "gr_register_operand" "r")))]
4574 "shladd %0 = %1, %S2, %3"
4575 [(set_attr "itanium_class" "ialu")])
4577 ;; This can be created by register elimination if operand3 of shladd is an
4578 ;; eliminable register or has reg_equiv_constant set.
4580 ;; We have to use nonmemory_operand for operand 4, to ensure that the
4581 ;; validate_changes call inside eliminate_regs will always succeed. If it
4582 ;; doesn't succeed, then this remain a shladd pattern, and will be reloaded
4585 (define_insn_and_split "*shladd_elim"
4586 [(set (match_operand:DI 0 "gr_register_operand" "=&r")
4587 (plus:DI (plus:DI (mult:DI (match_operand:DI 1 "gr_register_operand" "r")
4588 (match_operand:DI 2 "shladd_operand" "n"))
4589 (match_operand:DI 3 "nonmemory_operand" "r"))
4590 (match_operand:DI 4 "nonmemory_operand" "rI")))]
4591 "reload_in_progress"
4594 [(set (match_dup 0) (plus:DI (mult:DI (match_dup 1) (match_dup 2))
4596 (set (match_dup 0) (plus:DI (match_dup 0) (match_dup 4)))]
4598 [(set_attr "itanium_class" "unknown")])
4600 (define_insn "ashrdi3"
4601 [(set (match_operand:DI 0 "gr_register_operand" "=r,r")
4602 (ashiftrt:DI (match_operand:DI 1 "gr_register_operand" "r,r")
4603 (match_operand:DI 2 "gr_reg_or_6bit_operand" "r,rM")))]
4608 [(set_attr "itanium_class" "mmshf,mmshfi")])
4610 (define_insn "lshrdi3"
4611 [(set (match_operand:DI 0 "gr_register_operand" "=r,r")
4612 (lshiftrt:DI (match_operand:DI 1 "gr_register_operand" "r,r")
4613 (match_operand:DI 2 "gr_reg_or_6bit_operand" "r,rM")))]
4618 [(set_attr "itanium_class" "mmshf,mmshfi")])
4620 ;; Using a predicate that accepts only constants doesn't work, because optabs
4621 ;; will load the operand into a register and call the pattern if the predicate
4622 ;; did not accept it on the first try. So we use nonmemory_operand and then
4623 ;; verify that we have an appropriate constant in the expander.
4625 (define_expand "rotrdi3"
4626 [(set (match_operand:DI 0 "gr_register_operand" "")
4627 (rotatert:DI (match_operand:DI 1 "gr_register_operand" "")
4628 (match_operand:DI 2 "nonmemory_operand" "")))]
4631 if (! shift_count_operand (operands[2], DImode))
4635 (define_insn "*rotrdi3_internal"
4636 [(set (match_operand:DI 0 "gr_register_operand" "=r")
4637 (rotatert:DI (match_operand:DI 1 "gr_register_operand" "r")
4638 (match_operand:DI 2 "shift_count_operand" "M")))]
4640 "shrp %0 = %1, %1, %2"
4641 [(set_attr "itanium_class" "ishf")])
4643 (define_expand "rotldi3"
4644 [(set (match_operand:DI 0 "gr_register_operand" "")
4645 (rotate:DI (match_operand:DI 1 "gr_register_operand" "")
4646 (match_operand:DI 2 "nonmemory_operand" "")))]
4649 if (! shift_count_operand (operands[2], DImode))
4653 (define_insn "*rotldi3_internal"
4654 [(set (match_operand:DI 0 "gr_register_operand" "=r")
4655 (rotate:DI (match_operand:DI 1 "gr_register_operand" "r")
4656 (match_operand:DI 2 "shift_count_operand" "M")))]
4658 "shrp %0 = %1, %1, %e2"
4659 [(set_attr "itanium_class" "ishf")])
4661 ;; ::::::::::::::::::::
4663 ;; :: 128 bit Integer Shifts and Rotates
4665 ;; ::::::::::::::::::::
4667 (define_expand "ashrti3"
4668 [(set (match_operand:TI 0 "gr_register_operand" "")
4669 (ashiftrt:TI (match_operand:TI 1 "gr_register_operand" "")
4670 (match_operand:DI 2 "nonmemory_operand" "")))]
4673 if (!dshift_count_operand (operands[2], DImode))
4677 (define_insn_and_split "*ashrti3_internal"
4678 [(set (match_operand:TI 0 "gr_register_operand" "=r")
4679 (ashiftrt:TI (match_operand:TI 1 "gr_register_operand" "r")
4680 (match_operand:DI 2 "dshift_count_operand" "n")))]
4686 HOST_WIDE_INT shift = INTVAL (operands[2]);
4687 rtx lo = gen_lowpart (DImode, operands[1]);
4688 rtx hi = gen_highpart (DImode, operands[1]);
4689 rtx shiftlo = GEN_INT (shift & 63);
4693 emit_insn (gen_ashrdi3 (lo, hi, shiftlo));
4694 emit_insn (gen_ashrdi3 (hi, hi, GEN_INT (63)));
4698 emit_insn (gen_shrp (lo, hi, lo, shiftlo));
4699 emit_insn (gen_ashrdi3 (hi, hi, shiftlo));
4704 (define_expand "lshrti3"
4705 [(set (match_operand:TI 0 "gr_register_operand" "")
4706 (lshiftrt:TI (match_operand:TI 1 "gr_register_operand" "")
4707 (match_operand:DI 2 "nonmemory_operand" "")))]
4710 if (!dshift_count_operand (operands[2], DImode))
4714 (define_insn_and_split "*lshrti3_internal"
4715 [(set (match_operand:TI 0 "gr_register_operand" "=r")
4716 (lshiftrt:TI (match_operand:TI 1 "gr_register_operand" "r")
4717 (match_operand:DI 2 "dshift_count_operand" "n")))]
4723 HOST_WIDE_INT shift = INTVAL (operands[2]);
4724 rtx lo = gen_lowpart (DImode, operands[1]);
4725 rtx hi = gen_highpart (DImode, operands[1]);
4726 rtx shiftlo = GEN_INT (shift & 63);
4730 emit_insn (gen_lshrdi3 (lo, hi, shiftlo));
4731 emit_move_insn (hi, const0_rtx);
4735 emit_insn (gen_shrp (lo, hi, lo, shiftlo));
4736 emit_insn (gen_lshrdi3 (hi, hi, shiftlo));
4742 [(set (match_operand:DI 0 "gr_register_operand" "=r")
4743 (unspec:DI [(match_operand:DI 1 "gr_register_operand" "r")
4744 (match_operand:DI 2 "gr_register_operand" "r")
4745 (match_operand:DI 3 "shift_count_operand" "M")]
4748 "shrp %0 = %1, %2, %3"
4749 [(set_attr "itanium_class" "ishf")])
4751 ;; ::::::::::::::::::::
4753 ;; :: 32 bit Integer Logical operations
4755 ;; ::::::::::::::::::::
4757 ;; We don't seem to need any other 32-bit logical operations, because gcc
4758 ;; generates zero-extend;zero-extend;DImode-op, which combine optimizes to
4759 ;; DImode-op;zero-extend, and then we can optimize away the zero-extend.
4760 ;; This doesn't work for unary logical operations, because we don't call
4761 ;; apply_distributive_law for them.
4763 ;; ??? Likewise, this doesn't work for andnot, which isn't handled by
4764 ;; apply_distributive_law. We get inefficient code for
4765 ;; int sub4 (int i, int j) { return i & ~j; }
4766 ;; We could convert (and (not (sign_extend A)) (sign_extend B)) to
4767 ;; (zero_extend (and (not A) B)) in combine.
4768 ;; Or maybe fix this by adding andsi3/iorsi3/xorsi3 patterns like the
4769 ;; one_cmplsi2 pattern.
4771 (define_insn "one_cmplsi2"
4772 [(set (match_operand:SI 0 "gr_register_operand" "=r")
4773 (not:SI (match_operand:SI 1 "gr_register_operand" "r")))]
4776 [(set_attr "itanium_class" "ilog")])
4778 ;; ::::::::::::::::::::
4780 ;; :: 64 bit Integer Logical operations
4782 ;; ::::::::::::::::::::
4784 (define_insn "anddi3"
4785 [(set (match_operand:DI 0 "grfr_register_operand" "=r,*f")
4786 (and:DI (match_operand:DI 1 "grfr_register_operand" "%r,*f")
4787 (match_operand:DI 2 "grfr_reg_or_8bit_operand" "rK,*f")))]
4792 [(set_attr "itanium_class" "ilog,fmisc")])
4794 (define_insn "*andnot"
4795 [(set (match_operand:DI 0 "grfr_register_operand" "=r,*f")
4796 (and:DI (not:DI (match_operand:DI 1 "grfr_register_operand" "r,*f"))
4797 (match_operand:DI 2 "grfr_reg_or_8bit_operand" "rK,*f")))]
4802 [(set_attr "itanium_class" "ilog,fmisc")])
4804 (define_insn "iordi3"
4805 [(set (match_operand:DI 0 "grfr_register_operand" "=r,*f")
4806 (ior:DI (match_operand:DI 1 "grfr_register_operand" "%r,*f")
4807 (match_operand:DI 2 "grfr_reg_or_8bit_operand" "rK,*f")))]
4812 [(set_attr "itanium_class" "ilog,fmisc")])
4814 (define_insn "xordi3"
4815 [(set (match_operand:DI 0 "grfr_register_operand" "=r,*f")
4816 (xor:DI (match_operand:DI 1 "grfr_register_operand" "%r,*f")
4817 (match_operand:DI 2 "grfr_reg_or_8bit_operand" "rK,*f")))]
4822 [(set_attr "itanium_class" "ilog,fmisc")])
4824 (define_insn "one_cmpldi2"
4825 [(set (match_operand:DI 0 "gr_register_operand" "=r")
4826 (not:DI (match_operand:DI 1 "gr_register_operand" "r")))]
4829 [(set_attr "itanium_class" "ilog")])
4831 ;; ::::::::::::::::::::
4835 ;; ::::::::::::::::::::
4837 (define_expand "cmpbi"
4839 (compare (match_operand:BI 0 "register_operand" "")
4840 (match_operand:BI 1 "const_int_operand" "")))]
4843 ia64_compare_op0 = operands[0];
4844 ia64_compare_op1 = operands[1];
4848 (define_expand "cmpsi"
4850 (compare (match_operand:SI 0 "gr_register_operand" "")
4851 (match_operand:SI 1 "gr_reg_or_8bit_and_adjusted_operand" "")))]
4854 ia64_compare_op0 = operands[0];
4855 ia64_compare_op1 = operands[1];
4859 (define_expand "cmpdi"
4861 (compare (match_operand:DI 0 "gr_register_operand" "")
4862 (match_operand:DI 1 "gr_reg_or_8bit_and_adjusted_operand" "")))]
4865 ia64_compare_op0 = operands[0];
4866 ia64_compare_op1 = operands[1];
4870 (define_expand "cmpsf"
4872 (compare (match_operand:SF 0 "fr_reg_or_fp01_operand" "")
4873 (match_operand:SF 1 "fr_reg_or_fp01_operand" "")))]
4876 ia64_compare_op0 = operands[0];
4877 ia64_compare_op1 = operands[1];
4881 (define_expand "cmpdf"
4883 (compare (match_operand:DF 0 "fr_reg_or_fp01_operand" "")
4884 (match_operand:DF 1 "fr_reg_or_fp01_operand" "")))]
4887 ia64_compare_op0 = operands[0];
4888 ia64_compare_op1 = operands[1];
4892 (define_expand "cmpxf"
4894 (compare (match_operand:XF 0 "xfreg_or_fp01_operand" "")
4895 (match_operand:XF 1 "xfreg_or_fp01_operand" "")))]
4898 ia64_compare_op0 = operands[0];
4899 ia64_compare_op1 = operands[1];
4903 (define_expand "cmptf"
4905 (compare (match_operand:TF 0 "gr_register_operand" "")
4906 (match_operand:TF 1 "gr_register_operand" "")))]
4909 ia64_compare_op0 = operands[0];
4910 ia64_compare_op1 = operands[1];
4914 (define_insn "*cmpsi_normal"
4915 [(set (match_operand:BI 0 "register_operand" "=c")
4916 (match_operator:BI 1 "normal_comparison_operator"
4917 [(match_operand:SI 2 "gr_register_operand" "r")
4918 (match_operand:SI 3 "gr_reg_or_8bit_operand" "rK")]))]
4920 "cmp4.%C1 %0, %I0 = %3, %2"
4921 [(set_attr "itanium_class" "icmp")])
4923 ;; We use %r3 because it is possible for us to match a 0, and two of the
4924 ;; unsigned comparisons don't accept immediate operands of zero.
4926 (define_insn "*cmpsi_adjusted"
4927 [(set (match_operand:BI 0 "register_operand" "=c")
4928 (match_operator:BI 1 "adjusted_comparison_operator"
4929 [(match_operand:SI 2 "gr_register_operand" "r")
4930 (match_operand:SI 3 "gr_reg_or_8bit_adjusted_operand" "rL")]))]
4932 "cmp4.%C1 %0, %I0 = %r3, %2"
4933 [(set_attr "itanium_class" "icmp")])
4935 (define_insn "*cmpdi_normal"
4936 [(set (match_operand:BI 0 "register_operand" "=c")
4937 (match_operator:BI 1 "normal_comparison_operator"
4938 [(match_operand:DI 2 "gr_reg_or_0_operand" "rO")
4939 (match_operand:DI 3 "gr_reg_or_8bit_operand" "rK")]))]
4941 "cmp.%C1 %0, %I0 = %3, %r2"
4942 [(set_attr "itanium_class" "icmp")])
4944 ;; We use %r3 because it is possible for us to match a 0, and two of the
4945 ;; unsigned comparisons don't accept immediate operands of zero.
4947 (define_insn "*cmpdi_adjusted"
4948 [(set (match_operand:BI 0 "register_operand" "=c")
4949 (match_operator:BI 1 "adjusted_comparison_operator"
4950 [(match_operand:DI 2 "gr_register_operand" "r")
4951 (match_operand:DI 3 "gr_reg_or_8bit_adjusted_operand" "rL")]))]
4953 "cmp.%C1 %0, %I0 = %r3, %2"
4954 [(set_attr "itanium_class" "icmp")])
4956 (define_insn "*cmpsf_internal"
4957 [(set (match_operand:BI 0 "register_operand" "=c")
4958 (match_operator:BI 1 "comparison_operator"
4959 [(match_operand:SF 2 "fr_reg_or_fp01_operand" "fG")
4960 (match_operand:SF 3 "fr_reg_or_fp01_operand" "fG")]))]
4962 "fcmp.%D1 %0, %I0 = %F2, %F3"
4963 [(set_attr "itanium_class" "fcmp")])
4965 (define_insn "*cmpdf_internal"
4966 [(set (match_operand:BI 0 "register_operand" "=c")
4967 (match_operator:BI 1 "comparison_operator"
4968 [(match_operand:DF 2 "fr_reg_or_fp01_operand" "fG")
4969 (match_operand:DF 3 "fr_reg_or_fp01_operand" "fG")]))]
4971 "fcmp.%D1 %0, %I0 = %F2, %F3"
4972 [(set_attr "itanium_class" "fcmp")])
4974 (define_insn "*cmpxf_internal"
4975 [(set (match_operand:BI 0 "register_operand" "=c")
4976 (match_operator:BI 1 "comparison_operator"
4977 [(match_operand:XF 2 "xfreg_or_fp01_operand" "fG")
4978 (match_operand:XF 3 "xfreg_or_fp01_operand" "fG")]))]
4980 "fcmp.%D1 %0, %I0 = %F2, %F3"
4981 [(set_attr "itanium_class" "fcmp")])
4983 ;; ??? Can this pattern be generated?
4985 (define_insn "*bit_zero"
4986 [(set (match_operand:BI 0 "register_operand" "=c")
4987 (eq:BI (zero_extract:DI (match_operand:DI 1 "gr_register_operand" "r")
4989 (match_operand:DI 2 "immediate_operand" "n"))
4992 "tbit.z %0, %I0 = %1, %2"
4993 [(set_attr "itanium_class" "tbit")])
4995 (define_insn "*bit_one"
4996 [(set (match_operand:BI 0 "register_operand" "=c")
4997 (ne:BI (zero_extract:DI (match_operand:DI 1 "gr_register_operand" "r")
4999 (match_operand:DI 2 "immediate_operand" "n"))
5002 "tbit.nz %0, %I0 = %1, %2"
5003 [(set_attr "itanium_class" "tbit")])
5005 ;; ::::::::::::::::::::
5009 ;; ::::::::::::::::::::
5011 (define_expand "beq"
5013 (if_then_else (match_dup 1)
5014 (label_ref (match_operand 0 "" ""))
5017 "operands[1] = ia64_expand_compare (EQ, VOIDmode);")
5019 (define_expand "bne"
5021 (if_then_else (match_dup 1)
5022 (label_ref (match_operand 0 "" ""))
5025 "operands[1] = ia64_expand_compare (NE, VOIDmode);")
5027 (define_expand "blt"
5029 (if_then_else (match_dup 1)
5030 (label_ref (match_operand 0 "" ""))
5033 "operands[1] = ia64_expand_compare (LT, VOIDmode);")
5035 (define_expand "ble"
5037 (if_then_else (match_dup 1)
5038 (label_ref (match_operand 0 "" ""))
5041 "operands[1] = ia64_expand_compare (LE, VOIDmode);")
5043 (define_expand "bgt"
5045 (if_then_else (match_dup 1)
5046 (label_ref (match_operand 0 "" ""))
5049 "operands[1] = ia64_expand_compare (GT, VOIDmode);")
5051 (define_expand "bge"
5053 (if_then_else (match_dup 1)
5054 (label_ref (match_operand 0 "" ""))
5057 "operands[1] = ia64_expand_compare (GE, VOIDmode);")
5059 (define_expand "bltu"
5061 (if_then_else (match_dup 1)
5062 (label_ref (match_operand 0 "" ""))
5065 "operands[1] = ia64_expand_compare (LTU, VOIDmode);")
5067 (define_expand "bleu"
5069 (if_then_else (match_dup 1)
5070 (label_ref (match_operand 0 "" ""))
5073 "operands[1] = ia64_expand_compare (LEU, VOIDmode);")
5075 (define_expand "bgtu"
5077 (if_then_else (match_dup 1)
5078 (label_ref (match_operand 0 "" ""))
5081 "operands[1] = ia64_expand_compare (GTU, VOIDmode);")
5083 (define_expand "bgeu"
5085 (if_then_else (match_dup 1)
5086 (label_ref (match_operand 0 "" ""))
5089 "operands[1] = ia64_expand_compare (GEU, VOIDmode);")
5091 (define_expand "bunordered"
5093 (if_then_else (match_dup 1)
5094 (label_ref (match_operand 0 "" ""))
5097 "operands[1] = ia64_expand_compare (UNORDERED, VOIDmode);")
5099 (define_expand "bordered"
5101 (if_then_else (match_dup 1)
5102 (label_ref (match_operand 0 "" ""))
5105 "operands[1] = ia64_expand_compare (ORDERED, VOIDmode);")
5107 (define_insn "*br_true"
5109 (if_then_else (match_operator 0 "predicate_operator"
5110 [(match_operand:BI 1 "register_operand" "c")
5112 (label_ref (match_operand 2 "" ""))
5115 "(%J0) br.cond%+ %l2"
5116 [(set_attr "itanium_class" "br")
5117 (set_attr "predicable" "no")])
5119 (define_insn "*br_false"
5121 (if_then_else (match_operator 0 "predicate_operator"
5122 [(match_operand:BI 1 "register_operand" "c")
5125 (label_ref (match_operand 2 "" ""))))]
5127 "(%j0) br.cond%+ %l2"
5128 [(set_attr "itanium_class" "br")
5129 (set_attr "predicable" "no")])
5131 ;; ::::::::::::::::::::
5133 ;; :: Counted loop operations
5135 ;; ::::::::::::::::::::
5137 (define_expand "doloop_end"
5138 [(use (match_operand 0 "" "")) ; loop pseudo
5139 (use (match_operand 1 "" "")) ; iterations; zero if unknown
5140 (use (match_operand 2 "" "")) ; max iterations
5141 (use (match_operand 3 "" "")) ; loop level
5142 (use (match_operand 4 "" ""))] ; label
5145 /* Only use cloop on innermost loops. */
5146 if (INTVAL (operands[3]) > 1)
5148 emit_jump_insn (gen_doloop_end_internal (gen_rtx_REG (DImode, AR_LC_REGNUM),
5153 (define_insn "doloop_end_internal"
5154 [(set (pc) (if_then_else (ne (match_operand:DI 0 "ar_lc_reg_operand" "")
5156 (label_ref (match_operand 1 "" ""))
5158 (set (match_dup 0) (if_then_else:DI (ne (match_dup 0) (const_int 0))
5159 (plus:DI (match_dup 0) (const_int -1))
5162 "br.cloop.sptk.few %l1"
5163 [(set_attr "itanium_class" "br")
5164 (set_attr "predicable" "no")])
5166 ;; ::::::::::::::::::::
5168 ;; :: Set flag operations
5170 ;; ::::::::::::::::::::
5172 (define_expand "seq"
5173 [(set (match_operand:DI 0 "gr_register_operand" "") (match_dup 1))]
5175 "operands[1] = ia64_expand_compare (EQ, DImode);")
5177 (define_expand "sne"
5178 [(set (match_operand:DI 0 "gr_register_operand" "") (match_dup 1))]
5180 "operands[1] = ia64_expand_compare (NE, DImode);")
5182 (define_expand "slt"
5183 [(set (match_operand:DI 0 "gr_register_operand" "") (match_dup 1))]
5185 "operands[1] = ia64_expand_compare (LT, DImode);")
5187 (define_expand "sle"
5188 [(set (match_operand:DI 0 "gr_register_operand" "") (match_dup 1))]
5190 "operands[1] = ia64_expand_compare (LE, DImode);")
5192 (define_expand "sgt"
5193 [(set (match_operand:DI 0 "gr_register_operand" "") (match_dup 1))]
5195 "operands[1] = ia64_expand_compare (GT, DImode);")
5197 (define_expand "sge"
5198 [(set (match_operand:DI 0 "gr_register_operand" "") (match_dup 1))]
5200 "operands[1] = ia64_expand_compare (GE, DImode);")
5202 (define_expand "sltu"
5203 [(set (match_operand:DI 0 "gr_register_operand" "") (match_dup 1))]
5205 "operands[1] = ia64_expand_compare (LTU, DImode);")
5207 (define_expand "sleu"
5208 [(set (match_operand:DI 0 "gr_register_operand" "") (match_dup 1))]
5210 "operands[1] = ia64_expand_compare (LEU, DImode);")
5212 (define_expand "sgtu"
5213 [(set (match_operand:DI 0 "gr_register_operand" "") (match_dup 1))]
5215 "operands[1] = ia64_expand_compare (GTU, DImode);")
5217 (define_expand "sgeu"
5218 [(set (match_operand:DI 0 "gr_register_operand" "") (match_dup 1))]
5220 "operands[1] = ia64_expand_compare (GEU, DImode);")
5222 (define_expand "sunordered"
5223 [(set (match_operand:DI 0 "gr_register_operand" "") (match_dup 1))]
5225 "operands[1] = ia64_expand_compare (UNORDERED, DImode);")
5227 (define_expand "sordered"
5228 [(set (match_operand:DI 0 "gr_register_operand" "") (match_dup 1))]
5230 "operands[1] = ia64_expand_compare (ORDERED, DImode);")
5232 ;; Don't allow memory as destination here, because cmov/cmov/st is more
5233 ;; efficient than mov/mov/cst/cst.
5235 (define_insn_and_split "*sne_internal"
5236 [(set (match_operand:DI 0 "gr_register_operand" "=r")
5237 (ne:DI (match_operand:BI 1 "register_operand" "c")
5242 [(cond_exec (ne (match_dup 1) (const_int 0))
5243 (set (match_dup 0) (const_int 1)))
5244 (cond_exec (eq (match_dup 1) (const_int 0))
5245 (set (match_dup 0) (const_int 0)))]
5247 [(set_attr "itanium_class" "unknown")])
5249 (define_insn_and_split "*seq_internal"
5250 [(set (match_operand:DI 0 "gr_register_operand" "=r")
5251 (eq:DI (match_operand:BI 1 "register_operand" "c")
5256 [(cond_exec (ne (match_dup 1) (const_int 0))
5257 (set (match_dup 0) (const_int 0)))
5258 (cond_exec (eq (match_dup 1) (const_int 0))
5259 (set (match_dup 0) (const_int 1)))]
5261 [(set_attr "itanium_class" "unknown")])
5263 ;; ::::::::::::::::::::
5265 ;; :: Conditional move instructions.
5267 ;; ::::::::::::::::::::
5269 ;; ??? Add movXXcc patterns?
5272 ;; DImode if_then_else patterns.
5275 (define_insn "*cmovdi_internal"
5276 [(set (match_operand:DI 0 "destination_operand"
5277 "= r, r, r, r, r, r, r, r, r, r, m, Q, *f,*b,*d*e")
5279 (match_operator 4 "predicate_operator"
5280 [(match_operand:BI 1 "register_operand"
5281 "c,c,c,c,c,c,c,c,c,c,c,c,c,c,c")
5283 (match_operand:DI 2 "move_operand"
5284 "rim, *f, *b,*d*e,rim,rim, rim,*f,*b,*d*e,rO,*f,rOQ,rO, rK")
5285 (match_operand:DI 3 "move_operand"
5286 "rim,rim,rim, rim, *f, *b,*d*e,*f,*b,*d*e,rO,*f,rOQ,rO, rK")))]
5287 "ia64_move_ok (operands[0], operands[2])
5288 && ia64_move_ok (operands[0], operands[3])"
5290 [(set_attr "predicable" "no")])
5293 [(set (match_operand 0 "destination_operand" "")
5295 (match_operator 4 "predicate_operator"
5296 [(match_operand:BI 1 "register_operand" "")
5298 (match_operand 2 "move_operand" "")
5299 (match_operand 3 "move_operand" "")))]
5303 bool emitted_something = false;
5304 rtx dest = operands[0];
5305 rtx srct = operands[2];
5306 rtx srcf = operands[3];
5307 rtx cond = operands[4];
5309 if (! rtx_equal_p (dest, srct))
5311 ia64_emit_cond_move (dest, srct, cond);
5312 emitted_something = true;
5314 if (! rtx_equal_p (dest, srcf))
5316 cond = gen_rtx_fmt_ee (GET_CODE (cond) == NE ? EQ : NE,
5317 VOIDmode, operands[1], const0_rtx);
5318 ia64_emit_cond_move (dest, srcf, cond);
5319 emitted_something = true;
5321 if (! emitted_something)
5322 emit_note (NOTE_INSN_DELETED);
5326 ;; Absolute value pattern.
5328 (define_insn "*absdi2_internal"
5329 [(set (match_operand:DI 0 "gr_register_operand" "=r,r")
5331 (match_operator 4 "predicate_operator"
5332 [(match_operand:BI 1 "register_operand" "c,c")
5334 (neg:DI (match_operand:DI 2 "gr_reg_or_22bit_operand" "rI,rI"))
5335 (match_operand:DI 3 "gr_reg_or_22bit_operand" "0,rI")))]
5338 [(set_attr "itanium_class" "ialu,unknown")
5339 (set_attr "predicable" "no")])
5342 [(set (match_operand:DI 0 "register_operand" "")
5344 (match_operator 4 "predicate_operator"
5345 [(match_operand:BI 1 "register_operand" "c,c")
5347 (neg:DI (match_operand:DI 2 "gr_reg_or_22bit_operand" ""))
5348 (match_operand:DI 3 "gr_reg_or_22bit_operand" "")))]
5349 "reload_completed && rtx_equal_p (operands[0], operands[3])"
5353 (neg:DI (match_dup 2))))]
5357 [(set (match_operand:DI 0 "register_operand" "")
5359 (match_operator 4 "predicate_operator"
5360 [(match_operand:BI 1 "register_operand" "c,c")
5362 (neg:DI (match_operand:DI 2 "gr_reg_or_22bit_operand" ""))
5363 (match_operand:DI 3 "gr_reg_or_22bit_operand" "")))]
5367 (set (match_dup 0) (neg:DI (match_dup 2))))
5370 (set (match_dup 0) (match_dup 3)))]
5372 operands[5] = gen_rtx_fmt_ee (GET_CODE (operands[4]) == NE ? EQ : NE,
5373 VOIDmode, operands[1], const0_rtx);
5377 ;; SImode if_then_else patterns.
5380 (define_insn "*cmovsi_internal"
5381 [(set (match_operand:SI 0 "destination_operand" "=r,m,*f,r,m,*f,r,m,*f")
5383 (match_operator 4 "predicate_operator"
5384 [(match_operand:BI 1 "register_operand" "c,c,c,c,c,c,c,c,c")
5386 (match_operand:SI 2 "move_operand"
5387 "0,0,0,rim*f,rO,rO,rim*f,rO,rO")
5388 (match_operand:SI 3 "move_operand"
5389 "rim*f,rO,rO,0,0,0,rim*f,rO,rO")))]
5390 "ia64_move_ok (operands[0], operands[2])
5391 && ia64_move_ok (operands[0], operands[3])"
5393 [(set_attr "predicable" "no")])
5395 (define_insn "*abssi2_internal"
5396 [(set (match_operand:SI 0 "gr_register_operand" "=r,r")
5398 (match_operator 4 "predicate_operator"
5399 [(match_operand:BI 1 "register_operand" "c,c")
5401 (neg:SI (match_operand:SI 3 "gr_reg_or_22bit_operand" "rI,rI"))
5402 (match_operand:SI 2 "gr_reg_or_22bit_operand" "0,rI")))]
5405 [(set_attr "itanium_class" "ialu,unknown")
5406 (set_attr "predicable" "no")])
5409 [(set (match_operand:SI 0 "register_operand" "")
5411 (match_operator 4 "predicate_operator"
5412 [(match_operand:BI 1 "register_operand" "c,c")
5414 (neg:SI (match_operand:SI 2 "gr_reg_or_22bit_operand" ""))
5415 (match_operand:SI 3 "gr_reg_or_22bit_operand" "")))]
5416 "reload_completed && rtx_equal_p (operands[0], operands[3])"
5420 (neg:SI (match_dup 2))))]
5424 [(set (match_operand:SI 0 "register_operand" "")
5426 (match_operator 4 "predicate_operator"
5427 [(match_operand:BI 1 "register_operand" "c,c")
5429 (neg:SI (match_operand:SI 2 "gr_reg_or_22bit_operand" ""))
5430 (match_operand:SI 3 "gr_reg_or_22bit_operand" "")))]
5434 (set (match_dup 0) (neg:SI (match_dup 2))))
5437 (set (match_dup 0) (match_dup 3)))]
5439 operands[5] = gen_rtx_fmt_ee (GET_CODE (operands[4]) == NE ? EQ : NE,
5440 VOIDmode, operands[1], const0_rtx);
5443 (define_insn_and_split "*cond_opsi2_internal"
5444 [(set (match_operand:SI 0 "gr_register_operand" "=r")
5445 (match_operator:SI 5 "condop_operator"
5447 (match_operator 6 "predicate_operator"
5448 [(match_operand:BI 1 "register_operand" "c")
5450 (match_operand:SI 2 "gr_register_operand" "r")
5451 (match_operand:SI 3 "gr_register_operand" "r"))
5452 (match_operand:SI 4 "gr_register_operand" "r")]))]
5458 (set (match_dup 0) (match_op_dup:SI 5 [(match_dup 2) (match_dup 4)])))
5461 (set (match_dup 0) (match_op_dup:SI 5 [(match_dup 3) (match_dup 4)])))]
5463 operands[7] = gen_rtx_fmt_ee (GET_CODE (operands[6]) == NE ? EQ : NE,
5464 VOIDmode, operands[1], const0_rtx);
5466 [(set_attr "itanium_class" "ialu")
5467 (set_attr "predicable" "no")])
5470 (define_insn_and_split "*cond_opsi2_internal_b"
5471 [(set (match_operand:SI 0 "gr_register_operand" "=r")
5472 (match_operator:SI 5 "condop_operator"
5473 [(match_operand:SI 4 "gr_register_operand" "r")
5475 (match_operator 6 "predicate_operator"
5476 [(match_operand:BI 1 "register_operand" "c")
5478 (match_operand:SI 2 "gr_register_operand" "r")
5479 (match_operand:SI 3 "gr_register_operand" "r"))]))]
5485 (set (match_dup 0) (match_op_dup:SI 5 [(match_dup 4) (match_dup 2)])))
5488 (set (match_dup 0) (match_op_dup:SI 5 [(match_dup 4) (match_dup 3)])))]
5490 operands[7] = gen_rtx_fmt_ee (GET_CODE (operands[6]) == NE ? EQ : NE,
5491 VOIDmode, operands[1], const0_rtx);
5493 [(set_attr "itanium_class" "ialu")
5494 (set_attr "predicable" "no")])
5497 ;; ::::::::::::::::::::
5499 ;; :: Call and branch instructions
5501 ;; ::::::::::::::::::::
5503 ;; Subroutine call instruction returning no value. Operand 0 is the function
5504 ;; to call; operand 1 is the number of bytes of arguments pushed (in mode
5505 ;; `SImode', except it is normally a `const_int'); operand 2 is the number of
5506 ;; registers used as operands.
5508 ;; On most machines, operand 2 is not actually stored into the RTL pattern. It
5509 ;; is supplied for the sake of some RISC machines which need to put this
5510 ;; information into the assembler code; they can put it in the RTL instead of
5513 (define_expand "call"
5514 [(use (match_operand:DI 0 "" ""))
5515 (use (match_operand 1 "" ""))
5516 (use (match_operand 2 "" ""))
5517 (use (match_operand 3 "" ""))]
5520 ia64_expand_call (NULL_RTX, operands[0], operands[2], false);
5524 (define_expand "sibcall"
5525 [(use (match_operand:DI 0 "" ""))
5526 (use (match_operand 1 "" ""))
5527 (use (match_operand 2 "" ""))
5528 (use (match_operand 3 "" ""))]
5531 ia64_expand_call (NULL_RTX, operands[0], operands[2], true);
5535 ;; Subroutine call instruction returning a value. Operand 0 is the hard
5536 ;; register in which the value is returned. There are three more operands,
5537 ;; the same as the three operands of the `call' instruction (but with numbers
5538 ;; increased by one).
5540 ;; Subroutines that return `BLKmode' objects use the `call' insn.
5542 (define_expand "call_value"
5543 [(use (match_operand 0 "" ""))
5544 (use (match_operand:DI 1 "" ""))
5545 (use (match_operand 2 "" ""))
5546 (use (match_operand 3 "" ""))
5547 (use (match_operand 4 "" ""))]
5550 ia64_expand_call (operands[0], operands[1], operands[3], false);
5554 (define_expand "sibcall_value"
5555 [(use (match_operand 0 "" ""))
5556 (use (match_operand:DI 1 "" ""))
5557 (use (match_operand 2 "" ""))
5558 (use (match_operand 3 "" ""))
5559 (use (match_operand 4 "" ""))]
5562 ia64_expand_call (operands[0], operands[1], operands[3], true);
5566 ;; Call subroutine returning any type.
5568 (define_expand "untyped_call"
5569 [(parallel [(call (match_operand 0 "" "")
5571 (match_operand 1 "" "")
5572 (match_operand 2 "" "")])]
5577 emit_call_insn (gen_call (operands[0], const0_rtx, NULL, const0_rtx));
5579 for (i = 0; i < XVECLEN (operands[2], 0); i++)
5581 rtx set = XVECEXP (operands[2], 0, i);
5582 emit_move_insn (SET_DEST (set), SET_SRC (set));
5585 /* The optimizer does not know that the call sets the function value
5586 registers we stored in the result block. We avoid problems by
5587 claiming that all hard registers are used and clobbered at this
5589 emit_insn (gen_blockage ());
5594 (define_insn "call_nogp"
5595 [(call (mem:DI (match_operand:DI 0 "call_operand" "?b,i"))
5597 (clobber (match_operand:DI 1 "register_operand" "=b,b"))]
5599 "br.call%+.many %1 = %0"
5600 [(set_attr "itanium_class" "br,scall")])
5602 (define_insn "call_value_nogp"
5603 [(set (match_operand 0 "" "=X,X")
5604 (call (mem:DI (match_operand:DI 1 "call_operand" "?b,i"))
5606 (clobber (match_operand:DI 2 "register_operand" "=b,b"))]
5608 "br.call%+.many %2 = %1"
5609 [(set_attr "itanium_class" "br,scall")])
5611 (define_insn "sibcall_nogp"
5612 [(call (mem:DI (match_operand:DI 0 "call_operand" "?b,i"))
5616 [(set_attr "itanium_class" "br,scall")])
5618 (define_insn "call_gp"
5619 [(call (mem:DI (match_operand:DI 0 "call_operand" "?r,i"))
5621 (clobber (match_operand:DI 1 "register_operand" "=b,b"))
5622 (clobber (match_scratch:DI 2 "=&r,X"))
5623 (clobber (match_scratch:DI 3 "=b,X"))]
5626 [(set_attr "itanium_class" "br,scall")])
5628 ;; Irritatingly, we don't have access to INSN within the split body.
5629 ;; See commentary in ia64_split_call as to why these aren't peep2.
5631 [(call (mem (match_operand 0 "call_operand" ""))
5633 (clobber (match_operand:DI 1 "register_operand" ""))
5634 (clobber (match_scratch:DI 2 ""))
5635 (clobber (match_scratch:DI 3 ""))]
5636 "reload_completed && find_reg_note (insn, REG_NORETURN, NULL_RTX)"
5639 ia64_split_call (NULL_RTX, operands[0], operands[1], operands[2],
5640 operands[3], true, false);
5645 [(call (mem (match_operand 0 "call_operand" ""))
5647 (clobber (match_operand:DI 1 "register_operand" ""))
5648 (clobber (match_scratch:DI 2 ""))
5649 (clobber (match_scratch:DI 3 ""))]
5653 ia64_split_call (NULL_RTX, operands[0], operands[1], operands[2],
5654 operands[3], false, false);
5658 (define_insn "call_value_gp"
5659 [(set (match_operand 0 "" "=X,X")
5660 (call (mem:DI (match_operand:DI 1 "call_operand" "?r,i"))
5662 (clobber (match_operand:DI 2 "register_operand" "=b,b"))
5663 (clobber (match_scratch:DI 3 "=&r,X"))
5664 (clobber (match_scratch:DI 4 "=b,X"))]
5667 [(set_attr "itanium_class" "br,scall")])
5670 [(set (match_operand 0 "" "")
5671 (call (mem:DI (match_operand:DI 1 "call_operand" ""))
5673 (clobber (match_operand:DI 2 "register_operand" ""))
5674 (clobber (match_scratch:DI 3 ""))
5675 (clobber (match_scratch:DI 4 ""))]
5676 "reload_completed && find_reg_note (insn, REG_NORETURN, NULL_RTX)"
5679 ia64_split_call (operands[0], operands[1], operands[2], operands[3],
5680 operands[4], true, false);
5685 [(set (match_operand 0 "" "")
5686 (call (mem:DI (match_operand:DI 1 "call_operand" ""))
5688 (clobber (match_operand:DI 2 "register_operand" ""))
5689 (clobber (match_scratch:DI 3 ""))
5690 (clobber (match_scratch:DI 4 ""))]
5694 ia64_split_call (operands[0], operands[1], operands[2], operands[3],
5695 operands[4], false, false);
5699 (define_insn_and_split "sibcall_gp"
5700 [(call (mem:DI (match_operand:DI 0 "call_operand" "?r,i"))
5702 (clobber (match_scratch:DI 1 "=&r,X"))
5703 (clobber (match_scratch:DI 2 "=b,X"))]
5709 ia64_split_call (NULL_RTX, operands[0], NULL_RTX, operands[1],
5710 operands[2], true, true);
5713 [(set_attr "itanium_class" "br")])
5715 (define_insn "return_internal"
5717 (use (match_operand:DI 0 "register_operand" "b"))]
5719 "br.ret.sptk.many %0"
5720 [(set_attr "itanium_class" "br")])
5722 (define_insn "return"
5724 "ia64_direct_return ()"
5725 "br.ret.sptk.many rp"
5726 [(set_attr "itanium_class" "br")])
5728 (define_insn "*return_true"
5730 (if_then_else (match_operator 0 "predicate_operator"
5731 [(match_operand:BI 1 "register_operand" "c")
5735 "ia64_direct_return ()"
5736 "(%J0) br.ret%+.many rp"
5737 [(set_attr "itanium_class" "br")
5738 (set_attr "predicable" "no")])
5740 (define_insn "*return_false"
5742 (if_then_else (match_operator 0 "predicate_operator"
5743 [(match_operand:BI 1 "register_operand" "c")
5747 "ia64_direct_return ()"
5748 "(%j0) br.ret%+.many rp"
5749 [(set_attr "itanium_class" "br")
5750 (set_attr "predicable" "no")])
5753 [(set (pc) (label_ref (match_operand 0 "" "")))]
5756 [(set_attr "itanium_class" "br")])
5758 (define_insn "indirect_jump"
5759 [(set (pc) (match_operand:DI 0 "register_operand" "b"))]
5762 [(set_attr "itanium_class" "br")])
5764 (define_expand "tablejump"
5765 [(parallel [(set (pc) (match_operand:DI 0 "memory_operand" ""))
5766 (use (label_ref (match_operand 1 "" "")))])]
5769 rtx op0 = operands[0];
5772 /* ??? Bother -- do_tablejump is "helpful" and pulls the table
5773 element into a register without bothering to see whether that
5774 is necessary given the operand predicate. Check for MEM just
5775 in case someone fixes this. */
5776 if (GET_CODE (op0) == MEM)
5777 addr = XEXP (op0, 0);
5780 /* Otherwise, cheat and guess that the previous insn in the
5781 stream was the memory load. Grab the address from that.
5782 Note we have to momentarily pop out of the sequence started
5783 by the insn-emit wrapper in order to grab the last insn. */
5787 last = get_last_insn ();
5789 set = single_set (last);
5791 if (! rtx_equal_p (SET_DEST (set), op0)
5792 || GET_CODE (SET_SRC (set)) != MEM)
5794 addr = XEXP (SET_SRC (set), 0);
5795 if (rtx_equal_p (addr, op0))
5799 /* Jump table elements are stored pc-relative. That is, a displacement
5800 from the entry to the label. Thus to convert to an absolute address
5801 we add the address of the memory from which the value is loaded. */
5802 operands[0] = expand_simple_binop (DImode, PLUS, op0, addr,
5803 NULL_RTX, 1, OPTAB_DIRECT);
5806 (define_insn "*tablejump_internal"
5807 [(set (pc) (match_operand:DI 0 "register_operand" "b"))
5808 (use (label_ref (match_operand 1 "" "")))]
5811 [(set_attr "itanium_class" "br")])
5814 ;; ::::::::::::::::::::
5816 ;; :: Prologue and Epilogue instructions
5818 ;; ::::::::::::::::::::
5820 (define_expand "prologue"
5824 ia64_expand_prologue ();
5828 (define_expand "epilogue"
5832 ia64_expand_epilogue (0);
5836 (define_expand "sibcall_epilogue"
5840 ia64_expand_epilogue (1);
5844 ;; This prevents the scheduler from moving the SP decrement past FP-relative
5845 ;; stack accesses. This is the same as adddi3 plus the extra set.
5847 (define_insn "prologue_allocate_stack"
5848 [(set (match_operand:DI 0 "register_operand" "=r,r,r")
5849 (plus:DI (match_operand:DI 1 "register_operand" "%r,r,a")
5850 (match_operand:DI 2 "gr_reg_or_22bit_operand" "r,I,J")))
5851 (set (match_operand:DI 3 "register_operand" "+r,r,r")
5858 [(set_attr "itanium_class" "ialu")])
5860 ;; This prevents the scheduler from moving the SP restore past FP-relative
5861 ;; stack accesses. This is similar to movdi plus the extra set.
5863 (define_insn "epilogue_deallocate_stack"
5864 [(set (match_operand:DI 0 "register_operand" "=r")
5865 (match_operand:DI 1 "register_operand" "+r"))
5866 (set (match_dup 1) (match_dup 1))]
5869 [(set_attr "itanium_class" "ialu")])
5871 ;; As USE insns aren't meaningful after reload, this is used instead
5872 ;; to prevent deleting instructions setting registers for EH handling
5873 (define_insn "prologue_use"
5874 [(unspec:DI [(match_operand:DI 0 "register_operand" "")]
5875 UNSPEC_PROLOGUE_USE)]
5878 [(set_attr "itanium_class" "ignore")
5879 (set_attr "predicable" "no")
5880 (set_attr "empty" "yes")])
5882 ;; Allocate a new register frame.
5884 (define_insn "alloc"
5885 [(set (match_operand:DI 0 "register_operand" "=r")
5886 (unspec_volatile:DI [(const_int 0)] UNSPECV_ALLOC))
5887 (use (match_operand:DI 1 "const_int_operand" "i"))
5888 (use (match_operand:DI 2 "const_int_operand" "i"))
5889 (use (match_operand:DI 3 "const_int_operand" "i"))
5890 (use (match_operand:DI 4 "const_int_operand" "i"))]
5892 "alloc %0 = ar.pfs, %1, %2, %3, %4"
5893 [(set_attr "itanium_class" "syst_m0")
5894 (set_attr "predicable" "no")])
5897 (define_expand "gr_spill"
5898 [(parallel [(set (match_operand:DI 0 "memory_operand" "=m")
5899 (unspec:DI [(match_operand:DI 1 "register_operand" "r")
5900 (match_operand:DI 2 "const_int_operand" "")]
5902 (clobber (match_dup 3))])]
5904 "operands[3] = gen_rtx_REG (DImode, AR_UNAT_REGNUM);")
5906 (define_insn "gr_spill_internal"
5907 [(set (match_operand:DI 0 "memory_operand" "=m")
5908 (unspec:DI [(match_operand:DI 1 "register_operand" "r")
5909 (match_operand:DI 2 "const_int_operand" "")]
5911 (clobber (match_operand:DI 3 "register_operand" ""))]
5914 /* Note that we use a C output pattern here to avoid the predicate
5915 being automatically added before the .mem.offset directive. */
5916 return ".mem.offset %2, 0\;%,st8.spill %0 = %1%P0";
5918 [(set_attr "itanium_class" "st")])
5921 (define_expand "gr_restore"
5922 [(parallel [(set (match_operand:DI 0 "register_operand" "=r")
5923 (unspec:DI [(match_operand:DI 1 "memory_operand" "m")
5924 (match_operand:DI 2 "const_int_operand" "")]
5926 (use (match_dup 3))])]
5928 "operands[3] = gen_rtx_REG (DImode, AR_UNAT_REGNUM);")
5930 (define_insn "gr_restore_internal"
5931 [(set (match_operand:DI 0 "register_operand" "=r")
5932 (unspec:DI [(match_operand:DI 1 "memory_operand" "m")
5933 (match_operand:DI 2 "const_int_operand" "")]
5935 (use (match_operand:DI 3 "register_operand" ""))]
5937 { return ".mem.offset %2, 0\;%,ld8.fill %0 = %1%P1"; }
5938 [(set_attr "itanium_class" "ld")])
5940 (define_insn "fr_spill"
5941 [(set (match_operand:XF 0 "memory_operand" "=m")
5942 (unspec:XF [(match_operand:XF 1 "register_operand" "f")]
5945 "stf.spill %0 = %1%P0"
5946 [(set_attr "itanium_class" "stf")])
5948 (define_insn "fr_restore"
5949 [(set (match_operand:XF 0 "register_operand" "=f")
5950 (unspec:XF [(match_operand:XF 1 "memory_operand" "m")]
5951 UNSPEC_FR_RESTORE))]
5953 "ldf.fill %0 = %1%P1"
5954 [(set_attr "itanium_class" "fld")])
5956 ;; ??? The explicit stop is not ideal. It would be better if
5957 ;; rtx_needs_barrier took care of this, but this is something that can be
5958 ;; fixed later. This avoids an RSE DV.
5960 (define_insn "bsp_value"
5961 [(set (match_operand:DI 0 "register_operand" "=r")
5962 (unspec:DI [(const_int 0)] UNSPEC_BSP_VALUE))]
5966 return \";;\;%,mov %0 = ar.bsp\";
5968 [(set_attr "itanium_class" "frar_i")])
5970 (define_insn "set_bsp"
5971 [(unspec_volatile [(match_operand:DI 0 "register_operand" "r")]
5989 [(set_attr "itanium_class" "unknown")
5990 (set_attr "predicable" "no")])
5992 ;; ??? The explicit stops are not ideal. It would be better if
5993 ;; rtx_needs_barrier took care of this, but this is something that can be
5994 ;; fixed later. This avoids an RSE DV.
5996 (define_insn "flushrs"
5997 [(unspec [(const_int 0)] UNSPEC_FLUSHRS)]
6000 [(set_attr "itanium_class" "rse_m")
6001 (set_attr "predicable" "no")])
6003 ;; ::::::::::::::::::::
6005 ;; :: Miscellaneous instructions
6007 ;; ::::::::::::::::::::
6009 ;; ??? Emitting a NOP instruction isn't very useful. This should probably
6010 ;; be emitting ";;" to force a break in the instruction packing.
6012 ;; No operation, needed in case the user uses -g but not -O.
6017 [(set_attr "itanium_class" "nop")])
6019 (define_insn "nop_m"
6023 [(set_attr "itanium_class" "nop_m")])
6025 (define_insn "nop_i"
6029 [(set_attr "itanium_class" "nop_i")])
6031 (define_insn "nop_f"
6035 [(set_attr "itanium_class" "nop_f")])
6037 (define_insn "nop_b"
6041 [(set_attr "itanium_class" "nop_b")])
6043 (define_insn "nop_x"
6047 [(set_attr "itanium_class" "nop_x")
6048 (set_attr "empty" "yes")])
6050 ;; The following insn will be never generated. It is used only by
6051 ;; insn scheduler to change state before advancing cycle.
6052 (define_insn "pre_cycle"
6056 [(set_attr "itanium_class" "pre_cycle")])
6058 (define_insn "bundle_selector"
6059 [(unspec [(match_operand 0 "const_int_operand" "")] UNSPEC_BUNDLE_SELECTOR)]
6061 { return get_bundle_name (INTVAL (operands[0])); }
6062 [(set_attr "itanium_class" "ignore")
6063 (set_attr "predicable" "no")])
6065 ;; Pseudo instruction that prevents the scheduler from moving code above this
6067 (define_insn "blockage"
6068 [(unspec_volatile [(const_int 0)] UNSPECV_BLOCKAGE)]
6071 [(set_attr "itanium_class" "ignore")
6072 (set_attr "predicable" "no")])
6074 (define_insn "insn_group_barrier"
6075 [(unspec_volatile [(match_operand 0 "const_int_operand" "")]
6076 UNSPECV_INSN_GROUP_BARRIER)]
6079 [(set_attr "itanium_class" "stop_bit")
6080 (set_attr "predicable" "no")
6081 (set_attr "empty" "yes")])
6083 (define_expand "trap"
6084 [(trap_if (const_int 1) (const_int 0))]
6088 ;; ??? We don't have a match-any slot type. Setting the type to unknown
6089 ;; produces worse code that setting the slot type to A.
6091 (define_insn "*trap"
6092 [(trap_if (const_int 1) (match_operand 0 "const_int_operand" ""))]
6095 [(set_attr "itanium_class" "chk_s")])
6097 (define_expand "conditional_trap"
6098 [(trap_if (match_operand 0 "" "") (match_operand 1 "" ""))]
6101 operands[0] = ia64_expand_compare (GET_CODE (operands[0]), VOIDmode);
6104 (define_insn "*conditional_trap"
6105 [(trap_if (match_operator 0 "predicate_operator"
6106 [(match_operand:BI 1 "register_operand" "c")
6108 (match_operand 2 "const_int_operand" ""))]
6111 [(set_attr "itanium_class" "chk_s")
6112 (set_attr "predicable" "no")])
6114 (define_insn "break_f"
6115 [(unspec_volatile [(const_int 0)] UNSPECV_BREAK)]
6118 [(set_attr "itanium_class" "nop_f")])
6120 (define_insn "prefetch"
6121 [(prefetch (match_operand:DI 0 "address_operand" "p")
6122 (match_operand:DI 1 "const_int_operand" "n")
6123 (match_operand:DI 2 "const_int_operand" "n"))]
6126 static const char * const alt[2][4] = {
6128 "%,lfetch.nta [%0]",
6129 "%,lfetch.nt1 [%0]",
6130 "%,lfetch.nt2 [%0]",
6134 "%,lfetch.excl.nta [%0]",
6135 "%,lfetch.excl.nt1 [%0]",
6136 "%,lfetch.excl.nt2 [%0]",
6137 "%,lfetch.excl [%0]"
6140 int i = (INTVAL (operands[1]));
6141 int j = (INTVAL (operands[2]));
6143 if (i != 0 && i != 1)
6149 [(set_attr "itanium_class" "lfetch")])
6151 ;; Non-local goto support.
6153 (define_expand "save_stack_nonlocal"
6154 [(use (match_operand:OI 0 "memory_operand" ""))
6155 (use (match_operand:DI 1 "register_operand" ""))]
6158 emit_library_call (gen_rtx_SYMBOL_REF (Pmode,
6159 \"__ia64_save_stack_nonlocal\"),
6160 0, VOIDmode, 2, XEXP (operands[0], 0), Pmode,
6161 operands[1], Pmode);
6165 (define_expand "nonlocal_goto"
6166 [(use (match_operand 0 "general_operand" ""))
6167 (use (match_operand 1 "general_operand" ""))
6168 (use (match_operand 2 "general_operand" ""))
6169 (use (match_operand 3 "general_operand" ""))]
6172 emit_library_call (gen_rtx_SYMBOL_REF (Pmode, \"__ia64_nonlocal_goto\"),
6173 LCT_NORETURN, VOIDmode, 3,
6175 copy_to_reg (XEXP (operands[2], 0)), Pmode,
6176 operands[3], Pmode);
6181 (define_insn_and_split "builtin_setjmp_receiver"
6182 [(unspec_volatile [(match_operand:DI 0 "" "")] UNSPECV_SETJMP_RECEIVER)]
6192 (define_expand "eh_epilogue"
6193 [(use (match_operand:DI 0 "register_operand" "r"))
6194 (use (match_operand:DI 1 "register_operand" "r"))
6195 (use (match_operand:DI 2 "register_operand" "r"))]
6198 rtx bsp = gen_rtx_REG (Pmode, 10);
6199 rtx sp = gen_rtx_REG (Pmode, 9);
6201 if (GET_CODE (operands[0]) != REG || REGNO (operands[0]) != 10)
6203 emit_move_insn (bsp, operands[0]);
6206 if (GET_CODE (operands[2]) != REG || REGNO (operands[2]) != 9)
6208 emit_move_insn (sp, operands[2]);
6211 emit_insn (gen_rtx_USE (VOIDmode, sp));
6212 emit_insn (gen_rtx_USE (VOIDmode, bsp));
6214 cfun->machine->ia64_eh_epilogue_sp = sp;
6215 cfun->machine->ia64_eh_epilogue_bsp = bsp;
6218 ;; Builtin apply support.
6220 (define_expand "restore_stack_nonlocal"
6221 [(use (match_operand:DI 0 "register_operand" ""))
6222 (use (match_operand:OI 1 "memory_operand" ""))]
6225 emit_library_call (gen_rtx_SYMBOL_REF (Pmode,
6226 "__ia64_restore_stack_nonlocal"),
6228 copy_to_reg (XEXP (operands[1], 0)), Pmode);
6233 ;;; Intrinsics support.
6236 [(set (mem:BLK (match_dup 0))
6237 (unspec:BLK [(mem:BLK (match_dup 0))] UNSPEC_MF))]
6240 operands[0] = gen_rtx_MEM (BLKmode, gen_rtx_SCRATCH (DImode));
6241 MEM_VOLATILE_P (operands[0]) = 1;
6244 (define_insn "*mf_internal"
6245 [(set (match_operand:BLK 0 "" "")
6246 (unspec:BLK [(match_operand:BLK 1 "" "")] UNSPEC_MF))]
6249 [(set_attr "itanium_class" "syst_m")])
6251 (define_insn "fetchadd_acq_si"
6252 [(set (match_operand:SI 0 "gr_register_operand" "=r")
6253 (match_operand:SI 1 "not_postinc_memory_operand" "+S"))
6255 (unspec:SI [(match_dup 1)
6256 (match_operand:SI 2 "fetchadd_operand" "n")]
6257 UNSPEC_FETCHADD_ACQ))]
6259 "fetchadd4.acq %0 = %1, %2"
6260 [(set_attr "itanium_class" "sem")])
6262 (define_insn "fetchadd_acq_di"
6263 [(set (match_operand:DI 0 "gr_register_operand" "=r")
6264 (match_operand:DI 1 "not_postinc_memory_operand" "+S"))
6266 (unspec:DI [(match_dup 1)
6267 (match_operand:DI 2 "fetchadd_operand" "n")]
6268 UNSPEC_FETCHADD_ACQ))]
6270 "fetchadd8.acq %0 = %1, %2"
6271 [(set_attr "itanium_class" "sem")])
6273 (define_insn "cmpxchg_acq_si"
6274 [(set (match_operand:SI 0 "gr_register_operand" "=r")
6275 (match_operand:SI 1 "not_postinc_memory_operand" "+S"))
6277 (unspec:SI [(match_dup 1)
6278 (match_operand:SI 2 "gr_register_operand" "r")
6279 (match_operand:DI 3 "ar_ccv_reg_operand" "")]
6280 UNSPEC_CMPXCHG_ACQ))]
6282 "cmpxchg4.acq %0 = %1, %2, %3"
6283 [(set_attr "itanium_class" "sem")])
6285 (define_insn "cmpxchg_acq_di"
6286 [(set (match_operand:DI 0 "gr_register_operand" "=r")
6287 (match_operand:DI 1 "not_postinc_memory_operand" "+S"))
6289 (unspec:DI [(match_dup 1)
6290 (match_operand:DI 2 "gr_register_operand" "r")
6291 (match_operand:DI 3 "ar_ccv_reg_operand" "")]
6292 UNSPEC_CMPXCHG_ACQ))]
6294 "cmpxchg8.acq %0 = %1, %2, %3"
6295 [(set_attr "itanium_class" "sem")])
6297 (define_insn "xchgsi"
6298 [(set (match_operand:SI 0 "gr_register_operand" "=r")
6299 (match_operand:SI 1 "not_postinc_memory_operand" "+S"))
6301 (match_operand:SI 2 "gr_register_operand" "r"))]
6304 [(set_attr "itanium_class" "sem")])
6306 (define_insn "xchgdi"
6307 [(set (match_operand:DI 0 "gr_register_operand" "=r")
6308 (match_operand:DI 1 "not_postinc_memory_operand" "+S"))
6310 (match_operand:DI 2 "gr_register_operand" "r"))]
6313 [(set_attr "itanium_class" "sem")])
6318 [(match_operator 0 "predicate_operator"
6319 [(match_operand:BI 1 "register_operand" "c")
6324 (define_insn "pred_rel_mutex"
6325 [(set (match_operand:BI 0 "register_operand" "+c")
6326 (unspec:BI [(match_dup 0)] UNSPEC_PRED_REL_MUTEX))]
6328 ".pred.rel.mutex %0, %I0"
6329 [(set_attr "itanium_class" "ignore")
6330 (set_attr "predicable" "no")])
6332 (define_insn "safe_across_calls_all"
6333 [(unspec_volatile [(const_int 0)] UNSPECV_PSAC_ALL)]
6335 ".pred.safe_across_calls p1-p63"
6336 [(set_attr "itanium_class" "ignore")
6337 (set_attr "predicable" "no")])
6339 (define_insn "safe_across_calls_normal"
6340 [(unspec_volatile [(const_int 0)] UNSPECV_PSAC_NORMAL)]
6343 emit_safe_across_calls ();
6346 [(set_attr "itanium_class" "ignore")
6347 (set_attr "predicable" "no")])
6349 ;; UNSPEC instruction definition to "swizzle" 32 bit pointer into 64 bit
6350 ;; pointer. This is used by the HP-UX 32 bit mode.
6352 (define_insn "ptr_extend"
6353 [(set (match_operand:DI 0 "gr_register_operand" "=r")
6354 (unspec:DI [(match_operand:SI 1 "gr_register_operand" "r")]
6358 [(set_attr "itanium_class" "ialu")])
6361 ;; Optimizations for ptr_extend
6363 (define_insn "ptr_extend_plus_imm"
6364 [(set (match_operand:DI 0 "gr_register_operand" "=r")
6366 [(plus:SI (match_operand:SI 1 "basereg_operand" "r")
6367 (match_operand:SI 2 "gr_reg_or_14bit_operand" "rI"))]
6369 "addp4_optimize_ok (operands[1], operands[2])"
6371 [(set_attr "itanium_class" "ialu")])
6373 (define_insn "*ptr_extend_plus_2"
6374 [(set (match_operand:DI 0 "gr_register_operand" "=r")
6376 [(plus:SI (match_operand:SI 1 "gr_register_operand" "r")
6377 (match_operand:SI 2 "basereg_operand" "r"))]
6379 "addp4_optimize_ok (operands[1], operands[2])"
6381 [(set_attr "itanium_class" "ialu")])