1 ;; Machine description for DEC Alpha for GNU C compiler
2 ;; Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
3 ;; 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
4 ;; Contributed by Richard Kenner (kenner@vlsi1.ultra.nyu.edu)
6 ;; This file is part of GCC.
8 ;; GCC is free software; you can redistribute it and/or modify
9 ;; it under the terms of the GNU General Public License as published by
10 ;; the Free Software Foundation; either version 2, or (at your option)
13 ;; GCC is distributed in the hope that it will be useful,
14 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
15 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 ;; GNU General Public License for more details.
18 ;; You should have received a copy of the GNU General Public License
19 ;; along with GCC; see the file COPYING. If not, write to
20 ;; the Free Software Foundation, 59 Temple Place - Suite 330,
21 ;; Boston, MA 02111-1307, USA.
23 ;;- See file "rtl.def" for documentation on define_insn, match_*, et. al.
25 ;; Uses of UNSPEC in this file:
37 (UNSPEC_UMK_LOAD_CIW 9)
45 (UNSPEC_TLSGD_CALL 15)
46 (UNSPEC_TLSLDM_CALL 16)
68 (UNSPECV_SETJMPR 2) ; builtin_setjmp_receiver
69 (UNSPECV_LONGJMP 3) ; builtin_longjmp
71 (UNSPECV_PSPL 5) ; prologue_stack_probe_loop
73 (UNSPECV_EHR 7) ; exception_receiver
77 (UNSPECV_PLDGP2 11) ; prologue ldgp
82 ;; Where necessary, the suffixes _le and _be are used to distinguish between
83 ;; little-endian and big-endian patterns.
85 ;; Note that the Unicos/Mk assembler does not support the following
86 ;; opcodes: mov, fmov, nop, fnop, unop.
88 ;; Processor type -- this attribute must exactly match the processor_type
89 ;; enumeration in alpha.h.
91 (define_attr "cpu" "ev4,ev5,ev6"
92 (const (symbol_ref "alpha_cpu")))
94 ;; Define an insn type attribute. This is used in function unit delay
95 ;; computations, among other purposes. For the most part, we use the names
96 ;; defined in the EV4 documentation, but add a few that we have to know about
100 "ild,fld,ldsym,ist,fst,ibr,callpal,fbr,jsr,iadd,ilog,shift,icmov,fcmov,
101 icmp,imul,fadd,fmul,fcpys,fdiv,fsqrt,misc,mvi,ftoi,itof,multi,none"
102 (const_string "iadd"))
104 ;; Describe a user's asm statement.
105 (define_asm_attributes
106 [(set_attr "type" "multi")])
108 ;; Define the operand size an insn operates on. Used primarily by mul
109 ;; and div operations that have size dependent timings.
111 (define_attr "opsize" "si,di,udi"
114 ;; The TRAP attribute marks instructions that may generate traps
115 ;; (which are imprecise and may need a trapb if software completion
118 (define_attr "trap" "no,yes"
121 ;; The ROUND_SUFFIX attribute marks which instructions require a
122 ;; rounding-mode suffix. The value NONE indicates no suffix,
123 ;; the value NORMAL indicates a suffix controlled by alpha_fprm.
125 (define_attr "round_suffix" "none,normal,c"
126 (const_string "none"))
128 ;; The TRAP_SUFFIX attribute marks instructions requiring a trap-mode suffix:
130 ;; SU accepts only /su (cmpt et al)
131 ;; SUI accepts only /sui (cvtqt and cvtqs)
132 ;; V_SV accepts /v and /sv (cvtql only)
133 ;; V_SV_SVI accepts /v, /sv and /svi (cvttq only)
134 ;; U_SU_SUI accepts /u, /su and /sui (most fp instructions)
136 ;; The actual suffix emitted is controlled by alpha_fptm.
138 (define_attr "trap_suffix" "none,su,sui,v_sv,v_sv_svi,u_su_sui"
139 (const_string "none"))
141 ;; The length of an instruction sequence in bytes.
143 (define_attr "length" ""
146 ;; The USEGP attribute marks instructions that have relocations that use
149 (define_attr "usegp" "no,yes"
150 (cond [(eq_attr "type" "ldsym,jsr")
152 (eq_attr "type" "ild,fld,ist,fst")
153 (symbol_ref "alpha_find_lo_sum_using_gp(insn)")
155 (const_string "no")))
157 ;; The CANNOT_COPY attribute marks instructions with relocations that
158 ;; cannot easily be duplicated. This includes insns with gpdisp relocs
159 ;; since they have to stay in 1-1 correspondence with one another. This
160 ;; also includes jsr insns, since they must stay in correspondence with
161 ;; the immediately following gpdisp instructions.
163 (define_attr "cannot_copy" "false,true"
164 (const_string "false"))
166 ;; Include scheduling descriptions.
173 ;; Include predicate definitions
175 (include "predicates.md")
178 ;; First define the arithmetic insns. Note that the 32-bit forms also
181 ;; Handle 32-64 bit extension from memory to a floating point register
182 ;; specially, since this occurs frequently in int->double conversions.
184 ;; Note that while we must retain the =f case in the insn for reload's
185 ;; benefit, it should be eliminated after reload, so we should never emit
186 ;; code for that case. But we don't reject the possibility.
188 (define_expand "extendsidi2"
189 [(set (match_operand:DI 0 "register_operand" "")
190 (sign_extend:DI (match_operand:SI 1 "nonimmediate_operand" "")))]
194 (define_insn "*cvtlq"
195 [(set (match_operand:DI 0 "register_operand" "=f")
196 (unspec:DI [(match_operand:SF 1 "reg_or_0_operand" "fG")]
200 [(set_attr "type" "fadd")])
202 (define_insn "*extendsidi2_1"
203 [(set (match_operand:DI 0 "register_operand" "=r,r,!*f")
205 (match_operand:SI 1 "nonimmediate_operand" "r,m,m")))]
210 lds %0,%1\;cvtlq %0,%0"
211 [(set_attr "type" "iadd,ild,fld")
212 (set_attr "length" "*,*,8")])
215 [(set (match_operand:DI 0 "hard_fp_register_operand" "")
216 (sign_extend:DI (match_operand:SI 1 "memory_operand" "")))]
218 [(set (match_dup 2) (match_dup 1))
219 (set (match_dup 0) (unspec:DI [(match_dup 2)] UNSPEC_CVTLQ))]
221 operands[1] = adjust_address (operands[1], SFmode, 0);
222 operands[2] = gen_rtx_REG (SFmode, REGNO (operands[0]));
225 ;; Optimize sign-extension of SImode loads. This shows up in the wake of
226 ;; reload when converting fp->int.
229 [(set (match_operand:SI 0 "hard_int_register_operand" "")
230 (match_operand:SI 1 "memory_operand" ""))
231 (set (match_operand:DI 2 "hard_int_register_operand" "")
232 (sign_extend:DI (match_dup 0)))]
233 "true_regnum (operands[0]) == true_regnum (operands[2])
234 || peep2_reg_dead_p (2, operands[0])"
236 (sign_extend:DI (match_dup 1)))]
239 ;; Don't say we have addsi3 if optimizing. This generates better code. We
240 ;; have the anonymous addsi3 pattern below in case combine wants to make it.
241 (define_expand "addsi3"
242 [(set (match_operand:SI 0 "register_operand" "")
243 (plus:SI (match_operand:SI 1 "reg_or_0_operand" "")
244 (match_operand:SI 2 "add_operand" "")))]
248 (define_insn "*addsi_internal"
249 [(set (match_operand:SI 0 "register_operand" "=r,r,r,r")
250 (plus:SI (match_operand:SI 1 "reg_or_0_operand" "%rJ,rJ,rJ,rJ")
251 (match_operand:SI 2 "add_operand" "rI,O,K,L")))]
260 [(set (match_operand:SI 0 "register_operand" "")
261 (plus:SI (match_operand:SI 1 "register_operand" "")
262 (match_operand:SI 2 "const_int_operand" "")))]
263 "! add_operand (operands[2], SImode)"
264 [(set (match_dup 0) (plus:SI (match_dup 1) (match_dup 3)))
265 (set (match_dup 0) (plus:SI (match_dup 0) (match_dup 4)))]
267 HOST_WIDE_INT val = INTVAL (operands[2]);
268 HOST_WIDE_INT low = (val & 0xffff) - 2 * (val & 0x8000);
269 HOST_WIDE_INT rest = val - low;
271 operands[3] = GEN_INT (rest);
272 operands[4] = GEN_INT (low);
275 (define_insn "*addsi_se"
276 [(set (match_operand:DI 0 "register_operand" "=r,r")
278 (plus:SI (match_operand:SI 1 "reg_or_0_operand" "%rJ,rJ")
279 (match_operand:SI 2 "sext_add_operand" "rI,O"))))]
285 (define_insn "*addsi_se2"
286 [(set (match_operand:DI 0 "register_operand" "=r,r")
288 (subreg:SI (plus:DI (match_operand:DI 1 "reg_or_0_operand" "%rJ,rJ")
289 (match_operand:DI 2 "sext_add_operand" "rI,O"))
297 [(set (match_operand:DI 0 "register_operand" "")
299 (plus:SI (match_operand:SI 1 "reg_not_elim_operand" "")
300 (match_operand:SI 2 "const_int_operand" ""))))
301 (clobber (match_operand:SI 3 "reg_not_elim_operand" ""))]
302 "! sext_add_operand (operands[2], SImode) && INTVAL (operands[2]) > 0
303 && INTVAL (operands[2]) % 4 == 0"
304 [(set (match_dup 3) (match_dup 4))
305 (set (match_dup 0) (sign_extend:DI (plus:SI (mult:SI (match_dup 3)
309 HOST_WIDE_INT val = INTVAL (operands[2]) / 4;
315 operands[4] = GEN_INT (val);
316 operands[5] = GEN_INT (mult);
320 [(set (match_operand:DI 0 "register_operand" "")
322 (plus:SI (match_operator:SI 1 "comparison_operator"
323 [(match_operand 2 "" "")
324 (match_operand 3 "" "")])
325 (match_operand:SI 4 "add_operand" ""))))
326 (clobber (match_operand:DI 5 "register_operand" ""))]
328 [(set (match_dup 5) (match_dup 6))
329 (set (match_dup 0) (sign_extend:DI (plus:SI (match_dup 7) (match_dup 4))))]
331 operands[6] = gen_rtx_fmt_ee (GET_CODE (operands[1]), DImode,
332 operands[2], operands[3]);
333 operands[7] = gen_lowpart (SImode, operands[5]);
336 (define_insn "addvsi3"
337 [(set (match_operand:SI 0 "register_operand" "=r,r")
338 (plus:SI (match_operand:SI 1 "reg_or_0_operand" "%rJ,rJ")
339 (match_operand:SI 2 "sext_add_operand" "rI,O")))
340 (trap_if (ne (plus:DI (sign_extend:DI (match_dup 1))
341 (sign_extend:DI (match_dup 2)))
342 (sign_extend:DI (plus:SI (match_dup 1)
350 (define_expand "adddi3"
351 [(set (match_operand:DI 0 "register_operand" "")
352 (plus:DI (match_operand:DI 1 "register_operand" "")
353 (match_operand:DI 2 "add_operand" "")))]
357 (define_insn "*adddi_er_lo16_dtp"
358 [(set (match_operand:DI 0 "register_operand" "=r")
359 (lo_sum:DI (match_operand:DI 1 "register_operand" "r")
360 (match_operand:DI 2 "dtp16_symbolic_operand" "")))]
362 "lda %0,%2(%1)\t\t!dtprel")
364 (define_insn "*adddi_er_hi32_dtp"
365 [(set (match_operand:DI 0 "register_operand" "=r")
366 (plus:DI (match_operand:DI 1 "register_operand" "r")
367 (high:DI (match_operand:DI 2 "dtp32_symbolic_operand" ""))))]
369 "ldah %0,%2(%1)\t\t!dtprelhi")
371 (define_insn "*adddi_er_lo32_dtp"
372 [(set (match_operand:DI 0 "register_operand" "=r")
373 (lo_sum:DI (match_operand:DI 1 "register_operand" "r")
374 (match_operand:DI 2 "dtp32_symbolic_operand" "")))]
376 "lda %0,%2(%1)\t\t!dtprello")
378 (define_insn "*adddi_er_lo16_tp"
379 [(set (match_operand:DI 0 "register_operand" "=r")
380 (lo_sum:DI (match_operand:DI 1 "register_operand" "r")
381 (match_operand:DI 2 "tp16_symbolic_operand" "")))]
383 "lda %0,%2(%1)\t\t!tprel")
385 (define_insn "*adddi_er_hi32_tp"
386 [(set (match_operand:DI 0 "register_operand" "=r")
387 (plus:DI (match_operand:DI 1 "register_operand" "r")
388 (high:DI (match_operand:DI 2 "tp32_symbolic_operand" ""))))]
390 "ldah %0,%2(%1)\t\t!tprelhi")
392 (define_insn "*adddi_er_lo32_tp"
393 [(set (match_operand:DI 0 "register_operand" "=r")
394 (lo_sum:DI (match_operand:DI 1 "register_operand" "r")
395 (match_operand:DI 2 "tp32_symbolic_operand" "")))]
397 "lda %0,%2(%1)\t\t!tprello")
399 (define_insn "*adddi_er_high_l"
400 [(set (match_operand:DI 0 "register_operand" "=r")
401 (plus:DI (match_operand:DI 1 "register_operand" "r")
402 (high:DI (match_operand:DI 2 "local_symbolic_operand" ""))))]
403 "TARGET_EXPLICIT_RELOCS && reload_completed"
404 "ldah %0,%2(%1)\t\t!gprelhigh"
405 [(set_attr "usegp" "yes")])
408 [(set (match_operand:DI 0 "register_operand" "")
409 (high:DI (match_operand:DI 1 "local_symbolic_operand" "")))]
410 "TARGET_EXPLICIT_RELOCS && reload_completed"
412 (plus:DI (match_dup 2) (high:DI (match_dup 1))))]
413 "operands[2] = pic_offset_table_rtx;")
415 ;; We used to expend quite a lot of effort choosing addq/subq/lda.
416 ;; With complications like
418 ;; The NT stack unwind code can't handle a subq to adjust the stack
419 ;; (that's a bug, but not one we can do anything about). As of NT4.0 SP3,
420 ;; the exception handling code will loop if a subq is used and an
423 ;; The 19980616 change to emit prologues as RTL also confused some
424 ;; versions of GDB, which also interprets prologues. This has been
425 ;; fixed as of GDB 4.18, but it does not harm to unconditionally
428 ;; and the fact that the three insns schedule exactly the same, it's
429 ;; just not worth the effort.
431 (define_insn "*adddi_internal"
432 [(set (match_operand:DI 0 "register_operand" "=r,r,r")
433 (plus:DI (match_operand:DI 1 "register_operand" "%r,r,r")
434 (match_operand:DI 2 "add_operand" "r,K,L")))]
441 ;; ??? Allow large constants when basing off the frame pointer or some
442 ;; virtual register that may eliminate to the frame pointer. This is
443 ;; done because register elimination offsets will change the hi/lo split,
444 ;; and if we split before reload, we will require additional instructions.
446 (define_insn "*adddi_fp_hack"
447 [(set (match_operand:DI 0 "register_operand" "=r")
448 (plus:DI (match_operand:DI 1 "reg_no_subreg_operand" "r")
449 (match_operand:DI 2 "const_int_operand" "n")))]
450 "NONSTRICT_REG_OK_FP_BASE_P (operands[1])
451 && INTVAL (operands[2]) >= 0
452 /* This is the largest constant an lda+ldah pair can add, minus
453 an upper bound on the displacement between SP and AP during
454 register elimination. See INITIAL_ELIMINATION_OFFSET. */
455 && INTVAL (operands[2])
457 - FIRST_PSEUDO_REGISTER * UNITS_PER_WORD
458 - ALPHA_ROUND(current_function_outgoing_args_size)
459 - (ALPHA_ROUND (get_frame_size ()
460 + max_reg_num () * UNITS_PER_WORD
461 + current_function_pretend_args_size)
462 - current_function_pretend_args_size))"
465 ;; Don't do this if we are adjusting SP since we don't want to do it
466 ;; in two steps. Don't split FP sources for the reason listed above.
468 [(set (match_operand:DI 0 "register_operand" "")
469 (plus:DI (match_operand:DI 1 "register_operand" "")
470 (match_operand:DI 2 "const_int_operand" "")))]
471 "! add_operand (operands[2], DImode)
472 && operands[0] != stack_pointer_rtx
473 && operands[1] != frame_pointer_rtx
474 && operands[1] != arg_pointer_rtx"
475 [(set (match_dup 0) (plus:DI (match_dup 1) (match_dup 3)))
476 (set (match_dup 0) (plus:DI (match_dup 0) (match_dup 4)))]
478 HOST_WIDE_INT val = INTVAL (operands[2]);
479 HOST_WIDE_INT low = (val & 0xffff) - 2 * (val & 0x8000);
480 HOST_WIDE_INT rest = val - low;
482 operands[4] = GEN_INT (low);
483 if (CONST_OK_FOR_LETTER_P (rest, 'L'))
484 operands[3] = GEN_INT (rest);
485 else if (! no_new_pseudos)
487 operands[3] = gen_reg_rtx (DImode);
488 emit_move_insn (operands[3], operands[2]);
489 emit_insn (gen_adddi3 (operands[0], operands[1], operands[3]));
496 (define_insn "*saddl"
497 [(set (match_operand:SI 0 "register_operand" "=r,r")
498 (plus:SI (mult:SI (match_operand:SI 1 "reg_not_elim_operand" "r,r")
499 (match_operand:SI 2 "const48_operand" "I,I"))
500 (match_operand:SI 3 "sext_add_operand" "rI,O")))]
506 (define_insn "*saddl_se"
507 [(set (match_operand:DI 0 "register_operand" "=r,r")
509 (plus:SI (mult:SI (match_operand:SI 1 "reg_not_elim_operand" "r,r")
510 (match_operand:SI 2 "const48_operand" "I,I"))
511 (match_operand:SI 3 "sext_add_operand" "rI,O"))))]
518 [(set (match_operand:DI 0 "register_operand" "")
520 (plus:SI (mult:SI (match_operator:SI 1 "comparison_operator"
521 [(match_operand 2 "" "")
522 (match_operand 3 "" "")])
523 (match_operand:SI 4 "const48_operand" ""))
524 (match_operand:SI 5 "sext_add_operand" ""))))
525 (clobber (match_operand:DI 6 "reg_not_elim_operand" ""))]
527 [(set (match_dup 6) (match_dup 7))
529 (sign_extend:DI (plus:SI (mult:SI (match_dup 8) (match_dup 4))
532 operands[7] = gen_rtx_fmt_ee (GET_CODE (operands[1]), DImode,
533 operands[2], operands[3]);
534 operands[8] = gen_lowpart (SImode, operands[6]);
537 (define_insn "*saddq"
538 [(set (match_operand:DI 0 "register_operand" "=r,r")
539 (plus:DI (mult:DI (match_operand:DI 1 "reg_not_elim_operand" "r,r")
540 (match_operand:DI 2 "const48_operand" "I,I"))
541 (match_operand:DI 3 "sext_add_operand" "rI,O")))]
547 (define_insn "addvdi3"
548 [(set (match_operand:DI 0 "register_operand" "=r,r")
549 (plus:DI (match_operand:DI 1 "reg_or_0_operand" "%rJ,rJ")
550 (match_operand:DI 2 "sext_add_operand" "rI,O")))
551 (trap_if (ne (plus:TI (sign_extend:TI (match_dup 1))
552 (sign_extend:TI (match_dup 2)))
553 (sign_extend:TI (plus:DI (match_dup 1)
561 (define_insn "negsi2"
562 [(set (match_operand:SI 0 "register_operand" "=r")
563 (neg:SI (match_operand:SI 1 "reg_or_8bit_operand" "rI")))]
567 (define_insn "*negsi_se"
568 [(set (match_operand:DI 0 "register_operand" "=r")
569 (sign_extend:DI (neg:SI
570 (match_operand:SI 1 "reg_or_8bit_operand" "rI"))))]
574 (define_insn "negvsi2"
575 [(set (match_operand:SI 0 "register_operand" "=r")
576 (neg:SI (match_operand:SI 1 "register_operand" "r")))
577 (trap_if (ne (neg:DI (sign_extend:DI (match_dup 1)))
578 (sign_extend:DI (neg:SI (match_dup 1))))
583 (define_insn "negdi2"
584 [(set (match_operand:DI 0 "register_operand" "=r")
585 (neg:DI (match_operand:DI 1 "reg_or_8bit_operand" "rI")))]
589 (define_insn "negvdi2"
590 [(set (match_operand:DI 0 "register_operand" "=r")
591 (neg:DI (match_operand:DI 1 "register_operand" "r")))
592 (trap_if (ne (neg:TI (sign_extend:TI (match_dup 1)))
593 (sign_extend:TI (neg:DI (match_dup 1))))
598 (define_expand "subsi3"
599 [(set (match_operand:SI 0 "register_operand" "")
600 (minus:SI (match_operand:SI 1 "reg_or_0_operand" "")
601 (match_operand:SI 2 "reg_or_8bit_operand" "")))]
605 (define_insn "*subsi_internal"
606 [(set (match_operand:SI 0 "register_operand" "=r")
607 (minus:SI (match_operand:SI 1 "reg_or_0_operand" "rJ")
608 (match_operand:SI 2 "reg_or_8bit_operand" "rI")))]
612 (define_insn "*subsi_se"
613 [(set (match_operand:DI 0 "register_operand" "=r")
614 (sign_extend:DI (minus:SI (match_operand:SI 1 "reg_or_0_operand" "rJ")
615 (match_operand:SI 2 "reg_or_8bit_operand" "rI"))))]
619 (define_insn "*subsi_se2"
620 [(set (match_operand:DI 0 "register_operand" "=r")
622 (subreg:SI (minus:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
623 (match_operand:DI 2 "reg_or_8bit_operand" "rI"))
628 (define_insn "subvsi3"
629 [(set (match_operand:SI 0 "register_operand" "=r")
630 (minus:SI (match_operand:SI 1 "reg_or_0_operand" "rJ")
631 (match_operand:SI 2 "reg_or_8bit_operand" "rI")))
632 (trap_if (ne (minus:DI (sign_extend:DI (match_dup 1))
633 (sign_extend:DI (match_dup 2)))
634 (sign_extend:DI (minus:SI (match_dup 1)
640 (define_insn "subdi3"
641 [(set (match_operand:DI 0 "register_operand" "=r")
642 (minus:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
643 (match_operand:DI 2 "reg_or_8bit_operand" "rI")))]
647 (define_insn "*ssubl"
648 [(set (match_operand:SI 0 "register_operand" "=r")
649 (minus:SI (mult:SI (match_operand:SI 1 "reg_not_elim_operand" "r")
650 (match_operand:SI 2 "const48_operand" "I"))
651 (match_operand:SI 3 "reg_or_8bit_operand" "rI")))]
655 (define_insn "*ssubl_se"
656 [(set (match_operand:DI 0 "register_operand" "=r")
658 (minus:SI (mult:SI (match_operand:SI 1 "reg_not_elim_operand" "r")
659 (match_operand:SI 2 "const48_operand" "I"))
660 (match_operand:SI 3 "reg_or_8bit_operand" "rI"))))]
664 (define_insn "*ssubq"
665 [(set (match_operand:DI 0 "register_operand" "=r")
666 (minus:DI (mult:DI (match_operand:DI 1 "reg_not_elim_operand" "r")
667 (match_operand:DI 2 "const48_operand" "I"))
668 (match_operand:DI 3 "reg_or_8bit_operand" "rI")))]
672 (define_insn "subvdi3"
673 [(set (match_operand:DI 0 "register_operand" "=r")
674 (minus:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
675 (match_operand:DI 2 "reg_or_8bit_operand" "rI")))
676 (trap_if (ne (minus:TI (sign_extend:TI (match_dup 1))
677 (sign_extend:TI (match_dup 2)))
678 (sign_extend:TI (minus:DI (match_dup 1)
684 ;; The Unicos/Mk assembler doesn't support mull.
686 (define_insn "mulsi3"
687 [(set (match_operand:SI 0 "register_operand" "=r")
688 (mult:SI (match_operand:SI 1 "reg_or_0_operand" "%rJ")
689 (match_operand:SI 2 "reg_or_8bit_operand" "rI")))]
690 "!TARGET_ABI_UNICOSMK"
692 [(set_attr "type" "imul")
693 (set_attr "opsize" "si")])
695 (define_insn "*mulsi_se"
696 [(set (match_operand:DI 0 "register_operand" "=r")
698 (mult:SI (match_operand:SI 1 "reg_or_0_operand" "%rJ")
699 (match_operand:SI 2 "reg_or_8bit_operand" "rI"))))]
700 "!TARGET_ABI_UNICOSMK"
702 [(set_attr "type" "imul")
703 (set_attr "opsize" "si")])
705 (define_insn "mulvsi3"
706 [(set (match_operand:SI 0 "register_operand" "=r")
707 (mult:SI (match_operand:SI 1 "reg_or_0_operand" "%rJ")
708 (match_operand:SI 2 "reg_or_8bit_operand" "rI")))
709 (trap_if (ne (mult:DI (sign_extend:DI (match_dup 1))
710 (sign_extend:DI (match_dup 2)))
711 (sign_extend:DI (mult:SI (match_dup 1)
714 "!TARGET_ABI_UNICOSMK"
716 [(set_attr "type" "imul")
717 (set_attr "opsize" "si")])
719 (define_insn "muldi3"
720 [(set (match_operand:DI 0 "register_operand" "=r")
721 (mult:DI (match_operand:DI 1 "reg_or_0_operand" "%rJ")
722 (match_operand:DI 2 "reg_or_8bit_operand" "rI")))]
725 [(set_attr "type" "imul")])
727 (define_insn "mulvdi3"
728 [(set (match_operand:DI 0 "register_operand" "=r")
729 (mult:DI (match_operand:DI 1 "reg_or_0_operand" "%rJ")
730 (match_operand:DI 2 "reg_or_8bit_operand" "rI")))
731 (trap_if (ne (mult:TI (sign_extend:TI (match_dup 1))
732 (sign_extend:TI (match_dup 2)))
733 (sign_extend:TI (mult:DI (match_dup 1)
738 [(set_attr "type" "imul")])
740 (define_expand "umuldi3_highpart"
741 [(set (match_operand:DI 0 "register_operand" "")
744 (mult:TI (zero_extend:TI
745 (match_operand:DI 1 "register_operand" ""))
746 (match_operand:DI 2 "reg_or_8bit_operand" ""))
750 if (REG_P (operands[2]))
751 operands[2] = gen_rtx_ZERO_EXTEND (TImode, operands[2]);
754 (define_insn "*umuldi3_highpart_reg"
755 [(set (match_operand:DI 0 "register_operand" "=r")
758 (mult:TI (zero_extend:TI
759 (match_operand:DI 1 "register_operand" "r"))
761 (match_operand:DI 2 "register_operand" "r")))
765 [(set_attr "type" "imul")
766 (set_attr "opsize" "udi")])
768 (define_insn "*umuldi3_highpart_const"
769 [(set (match_operand:DI 0 "register_operand" "=r")
772 (mult:TI (zero_extend:TI (match_operand:DI 1 "register_operand" "r"))
773 (match_operand:TI 2 "cint8_operand" "I"))
777 [(set_attr "type" "imul")
778 (set_attr "opsize" "udi")])
780 ;; The divide and remainder operations take their inputs from r24 and
781 ;; r25, put their output in r27, and clobber r23 and r28 on all
782 ;; systems except Unicos/Mk. On Unicos, the standard library provides
783 ;; subroutines which use the standard calling convention and work on
786 ;; ??? Force sign-extension here because some versions of OSF/1 and
787 ;; Interix/NT don't do the right thing if the inputs are not properly
788 ;; sign-extended. But Linux, for instance, does not have this
789 ;; problem. Is it worth the complication here to eliminate the sign
792 (define_expand "divsi3"
794 (sign_extend:DI (match_operand:SI 1 "nonimmediate_operand" "")))
796 (sign_extend:DI (match_operand:SI 2 "nonimmediate_operand" "")))
797 (parallel [(set (match_dup 5)
798 (sign_extend:DI (div:SI (match_dup 3) (match_dup 4))))
799 (clobber (reg:DI 23))
800 (clobber (reg:DI 28))])
801 (set (match_operand:SI 0 "nonimmediate_operand" "")
802 (subreg:SI (match_dup 5) 0))]
803 "! TARGET_ABI_OPEN_VMS && ! TARGET_ABI_UNICOSMK"
805 operands[3] = gen_reg_rtx (DImode);
806 operands[4] = gen_reg_rtx (DImode);
807 operands[5] = gen_reg_rtx (DImode);
810 (define_expand "udivsi3"
812 (sign_extend:DI (match_operand:SI 1 "nonimmediate_operand" "")))
814 (sign_extend:DI (match_operand:SI 2 "nonimmediate_operand" "")))
815 (parallel [(set (match_dup 5)
816 (sign_extend:DI (udiv:SI (match_dup 3) (match_dup 4))))
817 (clobber (reg:DI 23))
818 (clobber (reg:DI 28))])
819 (set (match_operand:SI 0 "nonimmediate_operand" "")
820 (subreg:SI (match_dup 5) 0))]
821 "! TARGET_ABI_OPEN_VMS && ! TARGET_ABI_UNICOSMK"
823 operands[3] = gen_reg_rtx (DImode);
824 operands[4] = gen_reg_rtx (DImode);
825 operands[5] = gen_reg_rtx (DImode);
828 (define_expand "modsi3"
830 (sign_extend:DI (match_operand:SI 1 "nonimmediate_operand" "")))
832 (sign_extend:DI (match_operand:SI 2 "nonimmediate_operand" "")))
833 (parallel [(set (match_dup 5)
834 (sign_extend:DI (mod:SI (match_dup 3) (match_dup 4))))
835 (clobber (reg:DI 23))
836 (clobber (reg:DI 28))])
837 (set (match_operand:SI 0 "nonimmediate_operand" "")
838 (subreg:SI (match_dup 5) 0))]
839 "! TARGET_ABI_OPEN_VMS && ! TARGET_ABI_UNICOSMK"
841 operands[3] = gen_reg_rtx (DImode);
842 operands[4] = gen_reg_rtx (DImode);
843 operands[5] = gen_reg_rtx (DImode);
846 (define_expand "umodsi3"
848 (sign_extend:DI (match_operand:SI 1 "nonimmediate_operand" "")))
850 (sign_extend:DI (match_operand:SI 2 "nonimmediate_operand" "")))
851 (parallel [(set (match_dup 5)
852 (sign_extend:DI (umod:SI (match_dup 3) (match_dup 4))))
853 (clobber (reg:DI 23))
854 (clobber (reg:DI 28))])
855 (set (match_operand:SI 0 "nonimmediate_operand" "")
856 (subreg:SI (match_dup 5) 0))]
857 "! TARGET_ABI_OPEN_VMS && ! TARGET_ABI_UNICOSMK"
859 operands[3] = gen_reg_rtx (DImode);
860 operands[4] = gen_reg_rtx (DImode);
861 operands[5] = gen_reg_rtx (DImode);
864 (define_expand "divdi3"
865 [(parallel [(set (match_operand:DI 0 "register_operand" "")
866 (div:DI (match_operand:DI 1 "register_operand" "")
867 (match_operand:DI 2 "register_operand" "")))
868 (clobber (reg:DI 23))
869 (clobber (reg:DI 28))])]
870 "! TARGET_ABI_OPEN_VMS && ! TARGET_ABI_UNICOSMK"
873 (define_expand "udivdi3"
874 [(parallel [(set (match_operand:DI 0 "register_operand" "")
875 (udiv:DI (match_operand:DI 1 "register_operand" "")
876 (match_operand:DI 2 "register_operand" "")))
877 (clobber (reg:DI 23))
878 (clobber (reg:DI 28))])]
879 "! TARGET_ABI_OPEN_VMS && ! TARGET_ABI_UNICOSMK"
882 (define_expand "moddi3"
883 [(use (match_operand:DI 0 "register_operand" ""))
884 (use (match_operand:DI 1 "register_operand" ""))
885 (use (match_operand:DI 2 "register_operand" ""))]
886 "!TARGET_ABI_OPEN_VMS"
888 if (TARGET_ABI_UNICOSMK)
889 emit_insn (gen_moddi3_umk (operands[0], operands[1], operands[2]));
891 emit_insn (gen_moddi3_dft (operands[0], operands[1], operands[2]));
895 (define_expand "moddi3_dft"
896 [(parallel [(set (match_operand:DI 0 "register_operand" "")
897 (mod:DI (match_operand:DI 1 "register_operand" "")
898 (match_operand:DI 2 "register_operand" "")))
899 (clobber (reg:DI 23))
900 (clobber (reg:DI 28))])]
901 "! TARGET_ABI_OPEN_VMS && ! TARGET_ABI_UNICOSMK"
904 ;; On Unicos/Mk, we do as the system's C compiler does:
905 ;; compute the quotient, multiply and subtract.
907 (define_expand "moddi3_umk"
908 [(use (match_operand:DI 0 "register_operand" ""))
909 (use (match_operand:DI 1 "register_operand" ""))
910 (use (match_operand:DI 2 "register_operand" ""))]
911 "TARGET_ABI_UNICOSMK"
913 rtx div, mul = gen_reg_rtx (DImode);
915 div = expand_binop (DImode, sdiv_optab, operands[1], operands[2],
916 NULL_RTX, 0, OPTAB_LIB);
917 div = force_reg (DImode, div);
918 emit_insn (gen_muldi3 (mul, operands[2], div));
919 emit_insn (gen_subdi3 (operands[0], operands[1], mul));
923 (define_expand "umoddi3"
924 [(use (match_operand:DI 0 "register_operand" ""))
925 (use (match_operand:DI 1 "register_operand" ""))
926 (use (match_operand:DI 2 "register_operand" ""))]
927 "! TARGET_ABI_OPEN_VMS"
929 if (TARGET_ABI_UNICOSMK)
930 emit_insn (gen_umoddi3_umk (operands[0], operands[1], operands[2]));
932 emit_insn (gen_umoddi3_dft (operands[0], operands[1], operands[2]));
936 (define_expand "umoddi3_dft"
937 [(parallel [(set (match_operand:DI 0 "register_operand" "")
938 (umod:DI (match_operand:DI 1 "register_operand" "")
939 (match_operand:DI 2 "register_operand" "")))
940 (clobber (reg:DI 23))
941 (clobber (reg:DI 28))])]
942 "! TARGET_ABI_OPEN_VMS && ! TARGET_ABI_UNICOSMK"
945 (define_expand "umoddi3_umk"
946 [(use (match_operand:DI 0 "register_operand" ""))
947 (use (match_operand:DI 1 "register_operand" ""))
948 (use (match_operand:DI 2 "register_operand" ""))]
949 "TARGET_ABI_UNICOSMK"
951 rtx div, mul = gen_reg_rtx (DImode);
953 div = expand_binop (DImode, udiv_optab, operands[1], operands[2],
954 NULL_RTX, 1, OPTAB_LIB);
955 div = force_reg (DImode, div);
956 emit_insn (gen_muldi3 (mul, operands[2], div));
957 emit_insn (gen_subdi3 (operands[0], operands[1], mul));
961 ;; Lengths of 8 for ldq $t12,__divq($gp); jsr $t9,($t12),__divq as
962 ;; expanded by the assembler.
964 (define_insn_and_split "*divmodsi_internal_er"
965 [(set (match_operand:DI 0 "register_operand" "=c")
966 (sign_extend:DI (match_operator:SI 3 "divmod_operator"
967 [(match_operand:DI 1 "register_operand" "a")
968 (match_operand:DI 2 "register_operand" "b")])))
969 (clobber (reg:DI 23))
970 (clobber (reg:DI 28))]
971 "TARGET_EXPLICIT_RELOCS && ! TARGET_ABI_OPEN_VMS"
972 "ldq $27,__%E3($29)\t\t!literal!%#\;jsr $23,($27),__%E3\t\t!lituse_jsr!%#"
973 "&& reload_completed"
974 [(parallel [(set (match_dup 0)
975 (sign_extend:DI (match_dup 3)))
978 (clobber (reg:DI 23))
979 (clobber (reg:DI 28))])]
982 switch (GET_CODE (operands[3]))
999 operands[4] = GEN_INT (alpha_next_sequence_number++);
1000 emit_insn (gen_movdi_er_high_g (operands[0], pic_offset_table_rtx,
1001 gen_rtx_SYMBOL_REF (DImode, str),
1004 [(set_attr "type" "jsr")
1005 (set_attr "length" "8")])
1007 (define_insn "*divmodsi_internal_er_1"
1008 [(set (match_operand:DI 0 "register_operand" "=c")
1009 (sign_extend:DI (match_operator:SI 3 "divmod_operator"
1010 [(match_operand:DI 1 "register_operand" "a")
1011 (match_operand:DI 2 "register_operand" "b")])))
1012 (use (match_operand:DI 4 "register_operand" "c"))
1013 (use (match_operand 5 "const_int_operand" ""))
1014 (clobber (reg:DI 23))
1015 (clobber (reg:DI 28))]
1016 "TARGET_EXPLICIT_RELOCS && ! TARGET_ABI_OPEN_VMS"
1017 "jsr $23,($27),__%E3%J5"
1018 [(set_attr "type" "jsr")
1019 (set_attr "length" "4")])
1021 (define_insn "*divmodsi_internal"
1022 [(set (match_operand:DI 0 "register_operand" "=c")
1023 (sign_extend:DI (match_operator:SI 3 "divmod_operator"
1024 [(match_operand:DI 1 "register_operand" "a")
1025 (match_operand:DI 2 "register_operand" "b")])))
1026 (clobber (reg:DI 23))
1027 (clobber (reg:DI 28))]
1028 "! TARGET_ABI_OPEN_VMS && ! TARGET_ABI_UNICOSMK"
1030 [(set_attr "type" "jsr")
1031 (set_attr "length" "8")])
1033 (define_insn_and_split "*divmoddi_internal_er"
1034 [(set (match_operand:DI 0 "register_operand" "=c")
1035 (match_operator:DI 3 "divmod_operator"
1036 [(match_operand:DI 1 "register_operand" "a")
1037 (match_operand:DI 2 "register_operand" "b")]))
1038 (clobber (reg:DI 23))
1039 (clobber (reg:DI 28))]
1040 "TARGET_EXPLICIT_RELOCS && ! TARGET_ABI_OPEN_VMS"
1041 "ldq $27,__%E3($29)\t\t!literal!%#\;jsr $23,($27),__%E3\t\t!lituse_jsr!%#"
1042 "&& reload_completed"
1043 [(parallel [(set (match_dup 0) (match_dup 3))
1046 (clobber (reg:DI 23))
1047 (clobber (reg:DI 28))])]
1050 switch (GET_CODE (operands[3]))
1067 operands[4] = GEN_INT (alpha_next_sequence_number++);
1068 emit_insn (gen_movdi_er_high_g (operands[0], pic_offset_table_rtx,
1069 gen_rtx_SYMBOL_REF (DImode, str),
1072 [(set_attr "type" "jsr")
1073 (set_attr "length" "8")])
1075 (define_insn "*divmoddi_internal_er_1"
1076 [(set (match_operand:DI 0 "register_operand" "=c")
1077 (match_operator:DI 3 "divmod_operator"
1078 [(match_operand:DI 1 "register_operand" "a")
1079 (match_operand:DI 2 "register_operand" "b")]))
1080 (use (match_operand:DI 4 "register_operand" "c"))
1081 (use (match_operand 5 "const_int_operand" ""))
1082 (clobber (reg:DI 23))
1083 (clobber (reg:DI 28))]
1084 "TARGET_EXPLICIT_RELOCS && ! TARGET_ABI_OPEN_VMS"
1085 "jsr $23,($27),__%E3%J5"
1086 [(set_attr "type" "jsr")
1087 (set_attr "length" "4")])
1089 (define_insn "*divmoddi_internal"
1090 [(set (match_operand:DI 0 "register_operand" "=c")
1091 (match_operator:DI 3 "divmod_operator"
1092 [(match_operand:DI 1 "register_operand" "a")
1093 (match_operand:DI 2 "register_operand" "b")]))
1094 (clobber (reg:DI 23))
1095 (clobber (reg:DI 28))]
1096 "! TARGET_ABI_OPEN_VMS && ! TARGET_ABI_UNICOSMK"
1098 [(set_attr "type" "jsr")
1099 (set_attr "length" "8")])
1101 ;; Next are the basic logical operations. These only exist in DImode.
1103 (define_insn "anddi3"
1104 [(set (match_operand:DI 0 "register_operand" "=r,r,r")
1105 (and:DI (match_operand:DI 1 "reg_or_0_operand" "%rJ,rJ,rJ")
1106 (match_operand:DI 2 "and_operand" "rI,N,MH")))]
1112 [(set_attr "type" "ilog,ilog,shift")])
1114 ;; There are times when we can split an AND into two AND insns. This occurs
1115 ;; when we can first clear any bytes and then clear anything else. For
1116 ;; example "I & 0xffff07" is "(I & 0xffffff) & 0xffffffffffffff07".
1117 ;; Only do this when running on 64-bit host since the computations are
1118 ;; too messy otherwise.
1121 [(set (match_operand:DI 0 "register_operand" "")
1122 (and:DI (match_operand:DI 1 "register_operand" "")
1123 (match_operand:DI 2 "const_int_operand" "")))]
1124 "HOST_BITS_PER_WIDE_INT == 64 && ! and_operand (operands[2], DImode)"
1125 [(set (match_dup 0) (and:DI (match_dup 1) (match_dup 3)))
1126 (set (match_dup 0) (and:DI (match_dup 0) (match_dup 4)))]
1128 unsigned HOST_WIDE_INT mask1 = INTVAL (operands[2]);
1129 unsigned HOST_WIDE_INT mask2 = mask1;
1132 /* For each byte that isn't all zeros, make it all ones. */
1133 for (i = 0; i < 64; i += 8)
1134 if ((mask1 & ((HOST_WIDE_INT) 0xff << i)) != 0)
1135 mask1 |= (HOST_WIDE_INT) 0xff << i;
1137 /* Now turn on any bits we've just turned off. */
1140 operands[3] = GEN_INT (mask1);
1141 operands[4] = GEN_INT (mask2);
1144 (define_expand "zero_extendqihi2"
1145 [(set (match_operand:HI 0 "register_operand" "")
1146 (zero_extend:HI (match_operand:QI 1 "nonimmediate_operand" "")))]
1150 operands[1] = force_reg (QImode, operands[1]);
1153 (define_insn "*zero_extendqihi2_bwx"
1154 [(set (match_operand:HI 0 "register_operand" "=r,r")
1155 (zero_extend:HI (match_operand:QI 1 "nonimmediate_operand" "r,m")))]
1160 [(set_attr "type" "ilog,ild")])
1162 (define_insn "*zero_extendqihi2_nobwx"
1163 [(set (match_operand:HI 0 "register_operand" "=r")
1164 (zero_extend:HI (match_operand:QI 1 "register_operand" "r")))]
1167 [(set_attr "type" "ilog")])
1169 (define_expand "zero_extendqisi2"
1170 [(set (match_operand:SI 0 "register_operand" "")
1171 (zero_extend:SI (match_operand:QI 1 "nonimmediate_operand" "")))]
1175 operands[1] = force_reg (QImode, operands[1]);
1178 (define_insn "*zero_extendqisi2_bwx"
1179 [(set (match_operand:SI 0 "register_operand" "=r,r")
1180 (zero_extend:SI (match_operand:QI 1 "nonimmediate_operand" "r,m")))]
1185 [(set_attr "type" "ilog,ild")])
1187 (define_insn "*zero_extendqisi2_nobwx"
1188 [(set (match_operand:SI 0 "register_operand" "=r")
1189 (zero_extend:SI (match_operand:QI 1 "register_operand" "r")))]
1192 [(set_attr "type" "ilog")])
1194 (define_expand "zero_extendqidi2"
1195 [(set (match_operand:DI 0 "register_operand" "")
1196 (zero_extend:DI (match_operand:QI 1 "nonimmediate_operand" "")))]
1200 operands[1] = force_reg (QImode, operands[1]);
1203 (define_insn "*zero_extendqidi2_bwx"
1204 [(set (match_operand:DI 0 "register_operand" "=r,r")
1205 (zero_extend:DI (match_operand:QI 1 "nonimmediate_operand" "r,m")))]
1210 [(set_attr "type" "ilog,ild")])
1212 (define_insn "*zero_extendqidi2_nobwx"
1213 [(set (match_operand:DI 0 "register_operand" "=r")
1214 (zero_extend:DI (match_operand:QI 1 "register_operand" "r")))]
1217 [(set_attr "type" "ilog")])
1219 (define_expand "zero_extendhisi2"
1220 [(set (match_operand:SI 0 "register_operand" "")
1221 (zero_extend:SI (match_operand:HI 1 "nonimmediate_operand" "")))]
1225 operands[1] = force_reg (HImode, operands[1]);
1228 (define_insn "*zero_extendhisi2_bwx"
1229 [(set (match_operand:SI 0 "register_operand" "=r,r")
1230 (zero_extend:SI (match_operand:HI 1 "nonimmediate_operand" "r,m")))]
1235 [(set_attr "type" "shift,ild")])
1237 (define_insn "*zero_extendhisi2_nobwx"
1238 [(set (match_operand:SI 0 "register_operand" "=r")
1239 (zero_extend:SI (match_operand:HI 1 "register_operand" "r")))]
1242 [(set_attr "type" "shift")])
1244 (define_expand "zero_extendhidi2"
1245 [(set (match_operand:DI 0 "register_operand" "")
1246 (zero_extend:DI (match_operand:HI 1 "nonimmediate_operand" "")))]
1250 operands[1] = force_reg (HImode, operands[1]);
1253 (define_insn "*zero_extendhidi2_bwx"
1254 [(set (match_operand:DI 0 "register_operand" "=r,r")
1255 (zero_extend:DI (match_operand:HI 1 "nonimmediate_operand" "r,m")))]
1260 [(set_attr "type" "shift,ild")])
1262 (define_insn "*zero_extendhidi2_nobwx"
1263 [(set (match_operand:DI 0 "register_operand" "=r")
1264 (zero_extend:DI (match_operand:HI 1 "register_operand" "r")))]
1267 [(set_attr "type" "shift")])
1269 (define_insn "zero_extendsidi2"
1270 [(set (match_operand:DI 0 "register_operand" "=r")
1271 (zero_extend:DI (match_operand:SI 1 "register_operand" "r")))]
1274 [(set_attr "type" "shift")])
1276 (define_insn "andnotdi3"
1277 [(set (match_operand:DI 0 "register_operand" "=r")
1278 (and:DI (not:DI (match_operand:DI 1 "reg_or_8bit_operand" "rI"))
1279 (match_operand:DI 2 "reg_or_0_operand" "rJ")))]
1282 [(set_attr "type" "ilog")])
1284 (define_insn "iordi3"
1285 [(set (match_operand:DI 0 "register_operand" "=r,r")
1286 (ior:DI (match_operand:DI 1 "reg_or_0_operand" "%rJ,rJ")
1287 (match_operand:DI 2 "or_operand" "rI,N")))]
1292 [(set_attr "type" "ilog")])
1294 (define_insn "one_cmpldi2"
1295 [(set (match_operand:DI 0 "register_operand" "=r")
1296 (not:DI (match_operand:DI 1 "reg_or_8bit_operand" "rI")))]
1299 [(set_attr "type" "ilog")])
1301 (define_insn "*iornot"
1302 [(set (match_operand:DI 0 "register_operand" "=r")
1303 (ior:DI (not:DI (match_operand:DI 1 "reg_or_8bit_operand" "rI"))
1304 (match_operand:DI 2 "reg_or_0_operand" "rJ")))]
1307 [(set_attr "type" "ilog")])
1309 (define_insn "xordi3"
1310 [(set (match_operand:DI 0 "register_operand" "=r,r")
1311 (xor:DI (match_operand:DI 1 "reg_or_0_operand" "%rJ,rJ")
1312 (match_operand:DI 2 "or_operand" "rI,N")))]
1317 [(set_attr "type" "ilog")])
1319 (define_insn "*xornot"
1320 [(set (match_operand:DI 0 "register_operand" "=r")
1321 (not:DI (xor:DI (match_operand:DI 1 "register_operand" "%rJ")
1322 (match_operand:DI 2 "register_operand" "rI"))))]
1325 [(set_attr "type" "ilog")])
1327 ;; Handle FFS and related insns iff we support CIX.
1329 (define_expand "ffsdi2"
1331 (unspec:DI [(match_operand:DI 1 "register_operand" "")] UNSPEC_CTTZ))
1333 (plus:DI (match_dup 2) (const_int 1)))
1334 (set (match_operand:DI 0 "register_operand" "")
1335 (if_then_else:DI (eq (match_dup 1) (const_int 0))
1336 (const_int 0) (match_dup 3)))]
1339 operands[2] = gen_reg_rtx (DImode);
1340 operands[3] = gen_reg_rtx (DImode);
1343 (define_insn "*cttz"
1344 [(set (match_operand:DI 0 "register_operand" "=r")
1345 (unspec:DI [(match_operand:DI 1 "register_operand" "r")] UNSPEC_CTTZ))]
1348 ; EV6 calls all mvi and cttz/ctlz/popc class imisc, so just
1349 ; reuse the existing type name.
1350 [(set_attr "type" "mvi")])
1352 (define_insn "clzdi2"
1353 [(set (match_operand:DI 0 "register_operand" "=r")
1354 (clz:DI (match_operand:DI 1 "register_operand" "r")))]
1357 [(set_attr "type" "mvi")])
1359 (define_insn "ctzdi2"
1360 [(set (match_operand:DI 0 "register_operand" "=r")
1361 (ctz:DI (match_operand:DI 1 "register_operand" "r")))]
1364 [(set_attr "type" "mvi")])
1366 (define_insn "popcountdi2"
1367 [(set (match_operand:DI 0 "register_operand" "=r")
1368 (popcount:DI (match_operand:DI 1 "register_operand" "r")))]
1371 [(set_attr "type" "mvi")])
1373 ;; Next come the shifts and the various extract and insert operations.
1375 (define_insn "ashldi3"
1376 [(set (match_operand:DI 0 "register_operand" "=r,r")
1377 (ashift:DI (match_operand:DI 1 "reg_or_0_operand" "rJ,rJ")
1378 (match_operand:DI 2 "reg_or_6bit_operand" "P,rS")))]
1381 switch (which_alternative)
1384 if (operands[2] == const1_rtx)
1385 return "addq %r1,%r1,%0";
1387 return "s%P2addq %r1,0,%0";
1389 return "sll %r1,%2,%0";
1394 [(set_attr "type" "iadd,shift")])
1396 (define_insn "*ashldi_se"
1397 [(set (match_operand:DI 0 "register_operand" "=r")
1399 (subreg:SI (ashift:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
1400 (match_operand:DI 2 "const_int_operand" "P"))
1402 "INTVAL (operands[2]) >= 1 && INTVAL (operands[2]) <= 3"
1404 if (operands[2] == const1_rtx)
1405 return "addl %r1,%r1,%0";
1407 return "s%P2addl %r1,0,%0";
1409 [(set_attr "type" "iadd")])
1411 (define_insn "lshrdi3"
1412 [(set (match_operand:DI 0 "register_operand" "=r")
1413 (lshiftrt:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
1414 (match_operand:DI 2 "reg_or_6bit_operand" "rS")))]
1417 [(set_attr "type" "shift")])
1419 (define_insn "ashrdi3"
1420 [(set (match_operand:DI 0 "register_operand" "=r")
1421 (ashiftrt:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
1422 (match_operand:DI 2 "reg_or_6bit_operand" "rS")))]
1425 [(set_attr "type" "shift")])
1427 (define_expand "extendqihi2"
1429 (ashift:DI (match_operand:QI 1 "some_operand" "")
1431 (set (match_operand:HI 0 "register_operand" "")
1432 (ashiftrt:DI (match_dup 2)
1438 emit_insn (gen_extendqihi2x (operands[0],
1439 force_reg (QImode, operands[1])));
1443 /* If we have an unaligned MEM, extend to DImode (which we do
1444 specially) and then copy to the result. */
1445 if (unaligned_memory_operand (operands[1], HImode))
1447 rtx temp = gen_reg_rtx (DImode);
1449 emit_insn (gen_extendqidi2 (temp, operands[1]));
1450 emit_move_insn (operands[0], gen_lowpart (HImode, temp));
1454 operands[0] = gen_lowpart (DImode, operands[0]);
1455 operands[1] = gen_lowpart (DImode, force_reg (QImode, operands[1]));
1456 operands[2] = gen_reg_rtx (DImode);
1459 (define_insn "extendqidi2x"
1460 [(set (match_operand:DI 0 "register_operand" "=r")
1461 (sign_extend:DI (match_operand:QI 1 "register_operand" "r")))]
1464 [(set_attr "type" "shift")])
1466 (define_insn "extendhidi2x"
1467 [(set (match_operand:DI 0 "register_operand" "=r")
1468 (sign_extend:DI (match_operand:HI 1 "register_operand" "r")))]
1471 [(set_attr "type" "shift")])
1473 (define_insn "extendqisi2x"
1474 [(set (match_operand:SI 0 "register_operand" "=r")
1475 (sign_extend:SI (match_operand:QI 1 "register_operand" "r")))]
1478 [(set_attr "type" "shift")])
1480 (define_insn "extendhisi2x"
1481 [(set (match_operand:SI 0 "register_operand" "=r")
1482 (sign_extend:SI (match_operand:HI 1 "register_operand" "r")))]
1485 [(set_attr "type" "shift")])
1487 (define_insn "extendqihi2x"
1488 [(set (match_operand:HI 0 "register_operand" "=r")
1489 (sign_extend:HI (match_operand:QI 1 "register_operand" "r")))]
1492 [(set_attr "type" "shift")])
1494 (define_expand "extendqisi2"
1496 (ashift:DI (match_operand:QI 1 "some_operand" "")
1498 (set (match_operand:SI 0 "register_operand" "")
1499 (ashiftrt:DI (match_dup 2)
1505 emit_insn (gen_extendqisi2x (operands[0],
1506 force_reg (QImode, operands[1])));
1510 /* If we have an unaligned MEM, extend to a DImode form of
1511 the result (which we do specially). */
1512 if (unaligned_memory_operand (operands[1], QImode))
1514 rtx temp = gen_reg_rtx (DImode);
1516 emit_insn (gen_extendqidi2 (temp, operands[1]));
1517 emit_move_insn (operands[0], gen_lowpart (SImode, temp));
1521 operands[0] = gen_lowpart (DImode, operands[0]);
1522 operands[1] = gen_lowpart (DImode, force_reg (QImode, operands[1]));
1523 operands[2] = gen_reg_rtx (DImode);
1526 (define_expand "extendqidi2"
1528 (ashift:DI (match_operand:QI 1 "some_operand" "")
1530 (set (match_operand:DI 0 "register_operand" "")
1531 (ashiftrt:DI (match_dup 2)
1537 emit_insn (gen_extendqidi2x (operands[0],
1538 force_reg (QImode, operands[1])));
1542 if (unaligned_memory_operand (operands[1], QImode))
1545 = gen_unaligned_extendqidi (operands[0],
1546 get_unaligned_address (operands[1], 1));
1548 alpha_set_memflags (seq, operands[1]);
1553 operands[1] = gen_lowpart (DImode, force_reg (QImode, operands[1]));
1554 operands[2] = gen_reg_rtx (DImode);
1557 (define_expand "extendhisi2"
1559 (ashift:DI (match_operand:HI 1 "some_operand" "")
1561 (set (match_operand:SI 0 "register_operand" "")
1562 (ashiftrt:DI (match_dup 2)
1568 emit_insn (gen_extendhisi2x (operands[0],
1569 force_reg (HImode, operands[1])));
1573 /* If we have an unaligned MEM, extend to a DImode form of
1574 the result (which we do specially). */
1575 if (unaligned_memory_operand (operands[1], HImode))
1577 rtx temp = gen_reg_rtx (DImode);
1579 emit_insn (gen_extendhidi2 (temp, operands[1]));
1580 emit_move_insn (operands[0], gen_lowpart (SImode, temp));
1584 operands[0] = gen_lowpart (DImode, operands[0]);
1585 operands[1] = gen_lowpart (DImode, force_reg (HImode, operands[1]));
1586 operands[2] = gen_reg_rtx (DImode);
1589 (define_expand "extendhidi2"
1591 (ashift:DI (match_operand:HI 1 "some_operand" "")
1593 (set (match_operand:DI 0 "register_operand" "")
1594 (ashiftrt:DI (match_dup 2)
1600 emit_insn (gen_extendhidi2x (operands[0],
1601 force_reg (HImode, operands[1])));
1605 if (unaligned_memory_operand (operands[1], HImode))
1608 = gen_unaligned_extendhidi (operands[0],
1609 get_unaligned_address (operands[1], 2));
1611 alpha_set_memflags (seq, operands[1]);
1616 operands[1] = gen_lowpart (DImode, force_reg (HImode, operands[1]));
1617 operands[2] = gen_reg_rtx (DImode);
1620 ;; Here's how we sign extend an unaligned byte and halfword. Doing this
1621 ;; as a pattern saves one instruction. The code is similar to that for
1622 ;; the unaligned loads (see below).
1624 ;; Operand 1 is the address + 1 (+2 for HI), operand 0 is the result.
1625 (define_expand "unaligned_extendqidi"
1626 [(use (match_operand:QI 0 "register_operand" ""))
1627 (use (match_operand:DI 1 "address_operand" ""))]
1630 if (WORDS_BIG_ENDIAN)
1631 emit_insn (gen_unaligned_extendqidi_be (operands[0], operands[1]));
1633 emit_insn (gen_unaligned_extendqidi_le (operands[0], operands[1]));
1637 (define_expand "unaligned_extendqidi_le"
1638 [(set (match_dup 2) (match_operand:DI 1 "address_operand" ""))
1640 (mem:DI (and:DI (plus:DI (match_dup 2) (const_int -1))
1643 (ashift:DI (match_dup 3)
1644 (minus:DI (const_int 64)
1646 (and:DI (match_dup 2) (const_int 7))
1648 (set (subreg:DI (match_operand:QI 0 "register_operand" "") 0)
1649 (ashiftrt:DI (match_dup 4) (const_int 56)))]
1650 "! WORDS_BIG_ENDIAN"
1652 operands[2] = gen_reg_rtx (DImode);
1653 operands[3] = gen_reg_rtx (DImode);
1654 operands[4] = gen_reg_rtx (DImode);
1657 (define_expand "unaligned_extendqidi_be"
1658 [(set (match_dup 2) (match_operand:DI 1 "address_operand" ""))
1659 (set (match_dup 3) (plus:DI (match_dup 2) (const_int -1)))
1661 (mem:DI (and:DI (match_dup 3)
1663 (set (match_dup 5) (plus:DI (match_dup 2) (const_int -2)))
1665 (ashift:DI (match_dup 4)
1668 (plus:DI (match_dup 5) (const_int 1))
1671 (set (subreg:DI (match_operand:QI 0 "register_operand" "") 0)
1672 (ashiftrt:DI (match_dup 6) (const_int 56)))]
1675 operands[2] = gen_reg_rtx (DImode);
1676 operands[3] = gen_reg_rtx (DImode);
1677 operands[4] = gen_reg_rtx (DImode);
1678 operands[5] = gen_reg_rtx (DImode);
1679 operands[6] = gen_reg_rtx (DImode);
1682 (define_expand "unaligned_extendhidi"
1683 [(use (match_operand:QI 0 "register_operand" ""))
1684 (use (match_operand:DI 1 "address_operand" ""))]
1687 operands[0] = gen_lowpart (DImode, operands[0]);
1688 emit_insn ((WORDS_BIG_ENDIAN
1689 ? gen_unaligned_extendhidi_be
1690 : gen_unaligned_extendhidi_le) (operands[0], operands[1]));
1694 (define_expand "unaligned_extendhidi_le"
1695 [(set (match_dup 2) (match_operand:DI 1 "address_operand" ""))
1697 (mem:DI (and:DI (plus:DI (match_dup 2) (const_int -2))
1700 (ashift:DI (match_dup 3)
1701 (minus:DI (const_int 64)
1703 (and:DI (match_dup 2) (const_int 7))
1705 (set (match_operand:DI 0 "register_operand" "")
1706 (ashiftrt:DI (match_dup 4) (const_int 48)))]
1707 "! WORDS_BIG_ENDIAN"
1709 operands[2] = gen_reg_rtx (DImode);
1710 operands[3] = gen_reg_rtx (DImode);
1711 operands[4] = gen_reg_rtx (DImode);
1714 (define_expand "unaligned_extendhidi_be"
1715 [(set (match_dup 2) (match_operand:DI 1 "address_operand" ""))
1716 (set (match_dup 3) (plus:DI (match_dup 2) (const_int -2)))
1718 (mem:DI (and:DI (match_dup 3)
1720 (set (match_dup 5) (plus:DI (match_dup 2) (const_int -3)))
1722 (ashift:DI (match_dup 4)
1725 (plus:DI (match_dup 5) (const_int 1))
1728 (set (match_operand:DI 0 "register_operand" "")
1729 (ashiftrt:DI (match_dup 6) (const_int 48)))]
1732 operands[2] = gen_reg_rtx (DImode);
1733 operands[3] = gen_reg_rtx (DImode);
1734 operands[4] = gen_reg_rtx (DImode);
1735 operands[5] = gen_reg_rtx (DImode);
1736 operands[6] = gen_reg_rtx (DImode);
1739 (define_insn "*extxl_const"
1740 [(set (match_operand:DI 0 "register_operand" "=r")
1741 (zero_extract:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
1742 (match_operand:DI 2 "mode_width_operand" "n")
1743 (match_operand:DI 3 "mul8_operand" "I")))]
1745 "ext%M2l %r1,%s3,%0"
1746 [(set_attr "type" "shift")])
1748 (define_insn "extxl_le"
1749 [(set (match_operand:DI 0 "register_operand" "=r")
1750 (zero_extract:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
1751 (match_operand:DI 2 "mode_width_operand" "n")
1752 (ashift:DI (match_operand:DI 3 "reg_or_8bit_operand" "rI")
1754 "! WORDS_BIG_ENDIAN"
1756 [(set_attr "type" "shift")])
1758 (define_insn "extxl_be"
1759 [(set (match_operand:DI 0 "register_operand" "=r")
1760 (zero_extract:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
1761 (match_operand:DI 2 "mode_width_operand" "n")
1765 (match_operand:DI 3 "reg_or_8bit_operand" "rI")
1769 [(set_attr "type" "shift")])
1771 ;; Combine has some strange notion of preserving existing undefined behavior
1772 ;; in shifts larger than a word size. So capture these patterns that it
1773 ;; should have turned into zero_extracts.
1775 (define_insn "*extxl_1_le"
1776 [(set (match_operand:DI 0 "register_operand" "=r")
1777 (and:DI (lshiftrt:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
1778 (ashift:DI (match_operand:DI 2 "reg_or_8bit_operand" "rI")
1780 (match_operand:DI 3 "mode_mask_operand" "n")))]
1781 "! WORDS_BIG_ENDIAN"
1783 [(set_attr "type" "shift")])
1785 (define_insn "*extxl_1_be"
1786 [(set (match_operand:DI 0 "register_operand" "=r")
1787 (and:DI (lshiftrt:DI
1788 (match_operand:DI 1 "reg_or_0_operand" "rJ")
1789 (minus:DI (const_int 56)
1790 (ashift:DI (match_operand:DI 2 "reg_or_8bit_operand" "rI")
1792 (match_operand:DI 3 "mode_mask_operand" "n")))]
1795 [(set_attr "type" "shift")])
1797 (define_insn "*extql_2_le"
1798 [(set (match_operand:DI 0 "register_operand" "=r")
1799 (lshiftrt:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
1800 (ashift:DI (match_operand:DI 2 "reg_or_8bit_operand" "rI")
1802 "! WORDS_BIG_ENDIAN"
1804 [(set_attr "type" "shift")])
1806 (define_insn "*extql_2_be"
1807 [(set (match_operand:DI 0 "register_operand" "=r")
1809 (match_operand:DI 1 "reg_or_0_operand" "rJ")
1810 (minus:DI (const_int 56)
1812 (match_operand:DI 2 "reg_or_8bit_operand" "rI")
1816 [(set_attr "type" "shift")])
1818 (define_insn "extqh_le"
1819 [(set (match_operand:DI 0 "register_operand" "=r")
1821 (match_operand:DI 1 "reg_or_0_operand" "rJ")
1822 (minus:DI (const_int 64)
1825 (match_operand:DI 2 "reg_or_8bit_operand" "rI")
1828 "! WORDS_BIG_ENDIAN"
1830 [(set_attr "type" "shift")])
1832 (define_insn "extqh_be"
1833 [(set (match_operand:DI 0 "register_operand" "=r")
1835 (match_operand:DI 1 "reg_or_0_operand" "rJ")
1838 (plus:DI (match_operand:DI 2 "reg_or_8bit_operand" "rI")
1844 [(set_attr "type" "shift")])
1846 (define_insn "extlh_le"
1847 [(set (match_operand:DI 0 "register_operand" "=r")
1849 (and:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
1850 (const_int 2147483647))
1851 (minus:DI (const_int 64)
1854 (match_operand:DI 2 "reg_or_8bit_operand" "rI")
1857 "! WORDS_BIG_ENDIAN"
1859 [(set_attr "type" "shift")])
1861 (define_insn "extlh_be"
1862 [(set (match_operand:DI 0 "register_operand" "=r")
1865 (match_operand:DI 1 "reg_or_0_operand" "rJ")
1869 (match_operand:DI 2 "reg_or_8bit_operand" "rI")
1873 (const_int 2147483647)))]
1876 [(set_attr "type" "shift")])
1878 (define_insn "extwh_le"
1879 [(set (match_operand:DI 0 "register_operand" "=r")
1881 (and:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
1883 (minus:DI (const_int 64)
1886 (match_operand:DI 2 "reg_or_8bit_operand" "rI")
1889 "! WORDS_BIG_ENDIAN"
1891 [(set_attr "type" "shift")])
1893 (define_insn "extwh_be"
1894 [(set (match_operand:DI 0 "register_operand" "=r")
1896 (ashift:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
1900 (match_operand:DI 2 "reg_or_8bit_operand" "rI")
1904 (const_int 65535)))]
1907 [(set_attr "type" "shift")])
1909 ;; This converts an extXl into an extXh with an appropriate adjustment
1910 ;; to the address calculation.
1913 ;; [(set (match_operand:DI 0 "register_operand" "")
1914 ;; (ashift:DI (zero_extract:DI (match_operand:DI 1 "register_operand" "")
1915 ;; (match_operand:DI 2 "mode_width_operand" "")
1916 ;; (ashift:DI (match_operand:DI 3 "" "")
1918 ;; (match_operand:DI 4 "const_int_operand" "")))
1919 ;; (clobber (match_operand:DI 5 "register_operand" ""))]
1920 ;; "INTVAL (operands[4]) == 64 - INTVAL (operands[2])"
1921 ;; [(set (match_dup 5) (match_dup 6))
1922 ;; (set (match_dup 0)
1923 ;; (ashift:DI (zero_extract:DI (match_dup 1) (match_dup 2)
1924 ;; (ashift:DI (plus:DI (match_dup 5)
1930 ;; operands[6] = plus_constant (operands[3],
1931 ;; INTVAL (operands[2]) / BITS_PER_UNIT);
1932 ;; operands[7] = GEN_INT (- INTVAL (operands[2]) / BITS_PER_UNIT);
1935 (define_insn "*insbl_const"
1936 [(set (match_operand:DI 0 "register_operand" "=r")
1937 (ashift:DI (zero_extend:DI (match_operand:QI 1 "register_operand" "r"))
1938 (match_operand:DI 2 "mul8_operand" "I")))]
1941 [(set_attr "type" "shift")])
1943 (define_insn "*inswl_const"
1944 [(set (match_operand:DI 0 "register_operand" "=r")
1945 (ashift:DI (zero_extend:DI (match_operand:HI 1 "register_operand" "r"))
1946 (match_operand:DI 2 "mul8_operand" "I")))]
1949 [(set_attr "type" "shift")])
1951 (define_insn "*insll_const"
1952 [(set (match_operand:DI 0 "register_operand" "=r")
1953 (ashift:DI (zero_extend:DI (match_operand:SI 1 "register_operand" "r"))
1954 (match_operand:DI 2 "mul8_operand" "I")))]
1957 [(set_attr "type" "shift")])
1959 (define_insn "insbl_le"
1960 [(set (match_operand:DI 0 "register_operand" "=r")
1961 (ashift:DI (zero_extend:DI (match_operand:QI 1 "register_operand" "r"))
1962 (ashift:DI (match_operand:DI 2 "reg_or_8bit_operand" "rI")
1964 "! WORDS_BIG_ENDIAN"
1966 [(set_attr "type" "shift")])
1968 (define_insn "insbl_be"
1969 [(set (match_operand:DI 0 "register_operand" "=r")
1970 (ashift:DI (zero_extend:DI (match_operand:QI 1 "register_operand" "r"))
1971 (minus:DI (const_int 56)
1972 (ashift:DI (match_operand:DI 2 "reg_or_8bit_operand" "rI")
1976 [(set_attr "type" "shift")])
1978 (define_insn "inswl_le"
1979 [(set (match_operand:DI 0 "register_operand" "=r")
1980 (ashift:DI (zero_extend:DI (match_operand:HI 1 "register_operand" "r"))
1981 (ashift:DI (match_operand:DI 2 "reg_or_8bit_operand" "rI")
1983 "! WORDS_BIG_ENDIAN"
1985 [(set_attr "type" "shift")])
1987 (define_insn "inswl_be"
1988 [(set (match_operand:DI 0 "register_operand" "=r")
1989 (ashift:DI (zero_extend:DI (match_operand:HI 1 "register_operand" "r"))
1990 (minus:DI (const_int 56)
1991 (ashift:DI (match_operand:DI 2 "reg_or_8bit_operand" "rI")
1995 [(set_attr "type" "shift")])
1997 (define_insn "insll_le"
1998 [(set (match_operand:DI 0 "register_operand" "=r")
1999 (ashift:DI (zero_extend:DI (match_operand:SI 1 "register_operand" "r"))
2000 (ashift:DI (match_operand:DI 2 "reg_or_8bit_operand" "rI")
2002 "! WORDS_BIG_ENDIAN"
2004 [(set_attr "type" "shift")])
2006 (define_insn "insll_be"
2007 [(set (match_operand:DI 0 "register_operand" "=r")
2008 (ashift:DI (zero_extend:DI (match_operand:SI 1 "register_operand" "r"))
2009 (minus:DI (const_int 56)
2010 (ashift:DI (match_operand:DI 2 "reg_or_8bit_operand" "rI")
2014 [(set_attr "type" "shift")])
2016 (define_insn "insql_le"
2017 [(set (match_operand:DI 0 "register_operand" "=r")
2018 (ashift:DI (match_operand:DI 1 "register_operand" "r")
2019 (ashift:DI (match_operand:DI 2 "reg_or_8bit_operand" "rI")
2021 "! WORDS_BIG_ENDIAN"
2023 [(set_attr "type" "shift")])
2025 (define_insn "insql_be"
2026 [(set (match_operand:DI 0 "register_operand" "=r")
2027 (ashift:DI (match_operand:DI 1 "register_operand" "r")
2028 (minus:DI (const_int 56)
2029 (ashift:DI (match_operand:DI 2 "reg_or_8bit_operand" "rI")
2033 [(set_attr "type" "shift")])
2035 ;; Combine has this sometimes habit of moving the and outside of the
2036 ;; shift, making life more interesting.
2038 (define_insn "*insxl"
2039 [(set (match_operand:DI 0 "register_operand" "=r")
2040 (and:DI (ashift:DI (match_operand:DI 1 "register_operand" "r")
2041 (match_operand:DI 2 "mul8_operand" "I"))
2042 (match_operand:DI 3 "immediate_operand" "i")))]
2043 "HOST_BITS_PER_WIDE_INT == 64
2044 && GET_CODE (operands[3]) == CONST_INT
2045 && (((unsigned HOST_WIDE_INT) 0xff << INTVAL (operands[2])
2046 == (unsigned HOST_WIDE_INT) INTVAL (operands[3]))
2047 || ((unsigned HOST_WIDE_INT) 0xffff << INTVAL (operands[2])
2048 == (unsigned HOST_WIDE_INT) INTVAL (operands[3]))
2049 || ((unsigned HOST_WIDE_INT) 0xffffffff << INTVAL (operands[2])
2050 == (unsigned HOST_WIDE_INT) INTVAL (operands[3])))"
2052 #if HOST_BITS_PER_WIDE_INT == 64
2053 if ((unsigned HOST_WIDE_INT) 0xff << INTVAL (operands[2])
2054 == (unsigned HOST_WIDE_INT) INTVAL (operands[3]))
2055 return "insbl %1,%s2,%0";
2056 if ((unsigned HOST_WIDE_INT) 0xffff << INTVAL (operands[2])
2057 == (unsigned HOST_WIDE_INT) INTVAL (operands[3]))
2058 return "inswl %1,%s2,%0";
2059 if ((unsigned HOST_WIDE_INT) 0xffffffff << INTVAL (operands[2])
2060 == (unsigned HOST_WIDE_INT) INTVAL (operands[3]))
2061 return "insll %1,%s2,%0";
2065 [(set_attr "type" "shift")])
2067 ;; We do not include the insXh insns because they are complex to express
2068 ;; and it does not appear that we would ever want to generate them.
2070 ;; Since we need them for block moves, though, cop out and use unspec.
2072 (define_insn "insxh"
2073 [(set (match_operand:DI 0 "register_operand" "=r")
2074 (unspec:DI [(match_operand:DI 1 "register_operand" "r")
2075 (match_operand:DI 2 "mode_width_operand" "n")
2076 (match_operand:DI 3 "reg_or_8bit_operand" "rI")]
2080 [(set_attr "type" "shift")])
2082 (define_insn "mskxl_le"
2083 [(set (match_operand:DI 0 "register_operand" "=r")
2084 (and:DI (not:DI (ashift:DI
2085 (match_operand:DI 2 "mode_mask_operand" "n")
2087 (match_operand:DI 3 "reg_or_8bit_operand" "rI")
2089 (match_operand:DI 1 "reg_or_0_operand" "rJ")))]
2090 "! WORDS_BIG_ENDIAN"
2092 [(set_attr "type" "shift")])
2094 (define_insn "mskxl_be"
2095 [(set (match_operand:DI 0 "register_operand" "=r")
2096 (and:DI (not:DI (ashift:DI
2097 (match_operand:DI 2 "mode_mask_operand" "n")
2098 (minus:DI (const_int 56)
2100 (match_operand:DI 3 "reg_or_8bit_operand" "rI")
2102 (match_operand:DI 1 "reg_or_0_operand" "rJ")))]
2105 [(set_attr "type" "shift")])
2107 ;; We do not include the mskXh insns because it does not appear we would
2108 ;; ever generate one.
2110 ;; Again, we do for block moves and we use unspec again.
2112 (define_insn "mskxh"
2113 [(set (match_operand:DI 0 "register_operand" "=r")
2114 (unspec:DI [(match_operand:DI 1 "register_operand" "r")
2115 (match_operand:DI 2 "mode_width_operand" "n")
2116 (match_operand:DI 3 "reg_or_8bit_operand" "rI")]
2120 [(set_attr "type" "shift")])
2122 ;; Prefer AND + NE over LSHIFTRT + AND.
2124 (define_insn_and_split "*ze_and_ne"
2125 [(set (match_operand:DI 0 "register_operand" "=r")
2126 (zero_extract:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
2128 (match_operand 2 "const_int_operand" "I")))]
2129 "(unsigned HOST_WIDE_INT) INTVAL (operands[2]) < 8"
2131 "(unsigned HOST_WIDE_INT) INTVAL (operands[2]) < 8"
2133 (and:DI (match_dup 1) (match_dup 3)))
2135 (ne:DI (match_dup 0) (const_int 0)))]
2136 "operands[3] = GEN_INT (1 << INTVAL (operands[2]));")
2138 ;; Floating-point operations. All the double-precision insns can extend
2139 ;; from single, so indicate that. The exception are the ones that simply
2140 ;; play with the sign bits; it's not clear what to do there.
2142 (define_insn "abssf2"
2143 [(set (match_operand:SF 0 "register_operand" "=f")
2144 (abs:SF (match_operand:SF 1 "reg_or_0_operand" "fG")))]
2147 [(set_attr "type" "fcpys")])
2149 (define_insn "*nabssf2"
2150 [(set (match_operand:SF 0 "register_operand" "=f")
2151 (neg:SF (abs:SF (match_operand:SF 1 "reg_or_0_operand" "fG"))))]
2154 [(set_attr "type" "fadd")])
2156 (define_insn "absdf2"
2157 [(set (match_operand:DF 0 "register_operand" "=f")
2158 (abs:DF (match_operand:DF 1 "reg_or_0_operand" "fG")))]
2161 [(set_attr "type" "fcpys")])
2163 (define_insn "*nabsdf2"
2164 [(set (match_operand:DF 0 "register_operand" "=f")
2165 (neg:DF (abs:DF (match_operand:DF 1 "reg_or_0_operand" "fG"))))]
2168 [(set_attr "type" "fadd")])
2170 (define_expand "abstf2"
2171 [(parallel [(set (match_operand:TF 0 "register_operand" "")
2172 (abs:TF (match_operand:TF 1 "reg_or_0_operand" "")))
2173 (use (match_dup 2))])]
2174 "TARGET_HAS_XFLOATING_LIBS"
2176 #if HOST_BITS_PER_WIDE_INT >= 64
2177 operands[2] = force_reg (DImode, GEN_INT ((HOST_WIDE_INT) 1 << 63));
2179 operands[2] = force_reg (DImode, immed_double_const (0, 0x80000000, DImode));
2183 (define_insn_and_split "*abstf_internal"
2184 [(set (match_operand:TF 0 "register_operand" "=r")
2185 (abs:TF (match_operand:TF 1 "reg_or_0_operand" "rG")))
2186 (use (match_operand:DI 2 "register_operand" "r"))]
2187 "TARGET_HAS_XFLOATING_LIBS"
2189 "&& reload_completed"
2191 "alpha_split_tfmode_frobsign (operands, gen_andnotdi3); DONE;")
2193 (define_insn "negsf2"
2194 [(set (match_operand:SF 0 "register_operand" "=f")
2195 (neg:SF (match_operand:SF 1 "reg_or_0_operand" "fG")))]
2198 [(set_attr "type" "fadd")])
2200 (define_insn "negdf2"
2201 [(set (match_operand:DF 0 "register_operand" "=f")
2202 (neg:DF (match_operand:DF 1 "reg_or_0_operand" "fG")))]
2205 [(set_attr "type" "fadd")])
2207 (define_expand "negtf2"
2208 [(parallel [(set (match_operand:TF 0 "register_operand" "")
2209 (neg:TF (match_operand:TF 1 "reg_or_0_operand" "")))
2210 (use (match_dup 2))])]
2211 "TARGET_HAS_XFLOATING_LIBS"
2213 #if HOST_BITS_PER_WIDE_INT >= 64
2214 operands[2] = force_reg (DImode, GEN_INT ((HOST_WIDE_INT) 1 << 63));
2216 operands[2] = force_reg (DImode, immed_double_const (0, 0x80000000, DImode));
2220 (define_insn_and_split "*negtf_internal"
2221 [(set (match_operand:TF 0 "register_operand" "=r")
2222 (neg:TF (match_operand:TF 1 "reg_or_0_operand" "rG")))
2223 (use (match_operand:DI 2 "register_operand" "r"))]
2224 "TARGET_HAS_XFLOATING_LIBS"
2226 "&& reload_completed"
2228 "alpha_split_tfmode_frobsign (operands, gen_xordi3); DONE;")
2230 (define_insn "*addsf_ieee"
2231 [(set (match_operand:SF 0 "register_operand" "=&f")
2232 (plus:SF (match_operand:SF 1 "reg_or_0_operand" "%fG")
2233 (match_operand:SF 2 "reg_or_0_operand" "fG")))]
2234 "TARGET_FP && alpha_fptm >= ALPHA_FPTM_SU"
2235 "add%,%/ %R1,%R2,%0"
2236 [(set_attr "type" "fadd")
2237 (set_attr "trap" "yes")
2238 (set_attr "round_suffix" "normal")
2239 (set_attr "trap_suffix" "u_su_sui")])
2241 (define_insn "addsf3"
2242 [(set (match_operand:SF 0 "register_operand" "=f")
2243 (plus:SF (match_operand:SF 1 "reg_or_0_operand" "%fG")
2244 (match_operand:SF 2 "reg_or_0_operand" "fG")))]
2246 "add%,%/ %R1,%R2,%0"
2247 [(set_attr "type" "fadd")
2248 (set_attr "trap" "yes")
2249 (set_attr "round_suffix" "normal")
2250 (set_attr "trap_suffix" "u_su_sui")])
2252 (define_insn "*adddf_ieee"
2253 [(set (match_operand:DF 0 "register_operand" "=&f")
2254 (plus:DF (match_operand:DF 1 "reg_or_0_operand" "%fG")
2255 (match_operand:DF 2 "reg_or_0_operand" "fG")))]
2256 "TARGET_FP && alpha_fptm >= ALPHA_FPTM_SU"
2257 "add%-%/ %R1,%R2,%0"
2258 [(set_attr "type" "fadd")
2259 (set_attr "trap" "yes")
2260 (set_attr "round_suffix" "normal")
2261 (set_attr "trap_suffix" "u_su_sui")])
2263 (define_insn "adddf3"
2264 [(set (match_operand:DF 0 "register_operand" "=f")
2265 (plus:DF (match_operand:DF 1 "reg_or_0_operand" "%fG")
2266 (match_operand:DF 2 "reg_or_0_operand" "fG")))]
2268 "add%-%/ %R1,%R2,%0"
2269 [(set_attr "type" "fadd")
2270 (set_attr "trap" "yes")
2271 (set_attr "round_suffix" "normal")
2272 (set_attr "trap_suffix" "u_su_sui")])
2274 (define_insn "*adddf_ext1"
2275 [(set (match_operand:DF 0 "register_operand" "=f")
2276 (plus:DF (float_extend:DF
2277 (match_operand:SF 1 "reg_or_0_operand" "fG"))
2278 (match_operand:DF 2 "reg_or_0_operand" "fG")))]
2279 "TARGET_FP && alpha_fptm < ALPHA_FPTM_SU"
2280 "add%-%/ %R1,%R2,%0"
2281 [(set_attr "type" "fadd")
2282 (set_attr "trap" "yes")
2283 (set_attr "round_suffix" "normal")
2284 (set_attr "trap_suffix" "u_su_sui")])
2286 (define_insn "*adddf_ext2"
2287 [(set (match_operand:DF 0 "register_operand" "=f")
2288 (plus:DF (float_extend:DF
2289 (match_operand:SF 1 "reg_or_0_operand" "%fG"))
2291 (match_operand:SF 2 "reg_or_0_operand" "fG"))))]
2292 "TARGET_FP && alpha_fptm < ALPHA_FPTM_SU"
2293 "add%-%/ %R1,%R2,%0"
2294 [(set_attr "type" "fadd")
2295 (set_attr "trap" "yes")
2296 (set_attr "round_suffix" "normal")
2297 (set_attr "trap_suffix" "u_su_sui")])
2299 (define_expand "addtf3"
2300 [(use (match_operand 0 "register_operand" ""))
2301 (use (match_operand 1 "general_operand" ""))
2302 (use (match_operand 2 "general_operand" ""))]
2303 "TARGET_HAS_XFLOATING_LIBS"
2304 "alpha_emit_xfloating_arith (PLUS, operands); DONE;")
2306 ;; Define conversion operators between DFmode and SImode, using the cvtql
2307 ;; instruction. To allow combine et al to do useful things, we keep the
2308 ;; operation as a unit until after reload, at which point we split the
2311 ;; Note that we (attempt to) only consider this optimization when the
2312 ;; ultimate destination is memory. If we will be doing further integer
2313 ;; processing, it is cheaper to do the truncation in the int regs.
2315 (define_insn "*cvtql"
2316 [(set (match_operand:SF 0 "register_operand" "=f")
2317 (unspec:SF [(match_operand:DI 1 "reg_or_0_operand" "fG")]
2321 [(set_attr "type" "fadd")
2322 (set_attr "trap" "yes")
2323 (set_attr "trap_suffix" "v_sv")])
2325 (define_insn_and_split "*fix_truncdfsi_ieee"
2326 [(set (match_operand:SI 0 "memory_operand" "=m")
2328 (match_operator:DI 4 "fix_operator"
2329 [(match_operand:DF 1 "reg_or_0_operand" "fG")]) 0))
2330 (clobber (match_scratch:DI 2 "=&f"))
2331 (clobber (match_scratch:SF 3 "=&f"))]
2332 "TARGET_FP && alpha_fptm >= ALPHA_FPTM_SU"
2334 "&& reload_completed"
2335 [(set (match_dup 2) (match_op_dup 4 [(match_dup 1)]))
2336 (set (match_dup 3) (unspec:SF [(match_dup 2)] UNSPEC_CVTQL))
2337 (set (match_dup 5) (match_dup 3))]
2339 operands[5] = adjust_address (operands[0], SFmode, 0);
2341 [(set_attr "type" "fadd")
2342 (set_attr "trap" "yes")])
2344 (define_insn_and_split "*fix_truncdfsi_internal"
2345 [(set (match_operand:SI 0 "memory_operand" "=m")
2347 (match_operator:DI 3 "fix_operator"
2348 [(match_operand:DF 1 "reg_or_0_operand" "fG")]) 0))
2349 (clobber (match_scratch:DI 2 "=f"))]
2350 "TARGET_FP && alpha_fptm < ALPHA_FPTM_SU"
2352 "&& reload_completed"
2353 [(set (match_dup 2) (match_op_dup 3 [(match_dup 1)]))
2354 (set (match_dup 4) (unspec:SF [(match_dup 2)] UNSPEC_CVTQL))
2355 (set (match_dup 5) (match_dup 4))]
2357 operands[4] = gen_rtx_REG (SFmode, REGNO (operands[2]));
2358 operands[5] = adjust_address (operands[0], SFmode, 0);
2360 [(set_attr "type" "fadd")
2361 (set_attr "trap" "yes")])
2363 (define_insn "*fix_truncdfdi_ieee"
2364 [(set (match_operand:DI 0 "reg_no_subreg_operand" "=&f")
2365 (match_operator:DI 2 "fix_operator"
2366 [(match_operand:DF 1 "reg_or_0_operand" "fG")]))]
2367 "TARGET_FP && alpha_fptm >= ALPHA_FPTM_SU"
2369 [(set_attr "type" "fadd")
2370 (set_attr "trap" "yes")
2371 (set_attr "round_suffix" "c")
2372 (set_attr "trap_suffix" "v_sv_svi")])
2374 (define_insn "*fix_truncdfdi2"
2375 [(set (match_operand:DI 0 "reg_no_subreg_operand" "=f")
2376 (match_operator:DI 2 "fix_operator"
2377 [(match_operand:DF 1 "reg_or_0_operand" "fG")]))]
2380 [(set_attr "type" "fadd")
2381 (set_attr "trap" "yes")
2382 (set_attr "round_suffix" "c")
2383 (set_attr "trap_suffix" "v_sv_svi")])
2385 (define_expand "fix_truncdfdi2"
2386 [(set (match_operand:DI 0 "reg_no_subreg_operand" "")
2387 (fix:DI (match_operand:DF 1 "reg_or_0_operand" "")))]
2391 (define_expand "fixuns_truncdfdi2"
2392 [(set (match_operand:DI 0 "reg_no_subreg_operand" "")
2393 (unsigned_fix:DI (match_operand:DF 1 "reg_or_0_operand" "")))]
2397 ;; Likewise between SFmode and SImode.
2399 (define_insn_and_split "*fix_truncsfsi_ieee"
2400 [(set (match_operand:SI 0 "memory_operand" "=m")
2402 (match_operator:DI 4 "fix_operator"
2404 (match_operand:SF 1 "reg_or_0_operand" "fG"))]) 0))
2405 (clobber (match_scratch:DI 2 "=&f"))
2406 (clobber (match_scratch:SF 3 "=&f"))]
2407 "TARGET_FP && alpha_fptm >= ALPHA_FPTM_SU"
2409 "&& reload_completed"
2410 [(set (match_dup 2) (match_op_dup 4 [(float_extend:DF (match_dup 1))]))
2411 (set (match_dup 3) (unspec:SF [(match_dup 2)] UNSPEC_CVTQL))
2412 (set (match_dup 5) (match_dup 3))]
2414 operands[5] = adjust_address (operands[0], SFmode, 0);
2416 [(set_attr "type" "fadd")
2417 (set_attr "trap" "yes")])
2419 (define_insn_and_split "*fix_truncsfsi_internal"
2420 [(set (match_operand:SI 0 "memory_operand" "=m")
2422 (match_operator:DI 3 "fix_operator"
2424 (match_operand:SF 1 "reg_or_0_operand" "fG"))]) 0))
2425 (clobber (match_scratch:DI 2 "=f"))]
2426 "TARGET_FP && alpha_fptm < ALPHA_FPTM_SU"
2428 "&& reload_completed"
2429 [(set (match_dup 2) (match_op_dup 3 [(float_extend:DF (match_dup 1))]))
2430 (set (match_dup 4) (unspec:SF [(match_dup 2)] UNSPEC_CVTQL))
2431 (set (match_dup 5) (match_dup 4))]
2433 operands[4] = gen_rtx_REG (SFmode, REGNO (operands[2]));
2434 operands[5] = adjust_address (operands[0], SFmode, 0);
2436 [(set_attr "type" "fadd")
2437 (set_attr "trap" "yes")])
2439 (define_insn "*fix_truncsfdi_ieee"
2440 [(set (match_operand:DI 0 "reg_no_subreg_operand" "=&f")
2441 (match_operator:DI 2 "fix_operator"
2442 [(float_extend:DF (match_operand:SF 1 "reg_or_0_operand" "fG"))]))]
2443 "TARGET_FP && alpha_fptm >= ALPHA_FPTM_SU"
2445 [(set_attr "type" "fadd")
2446 (set_attr "trap" "yes")
2447 (set_attr "round_suffix" "c")
2448 (set_attr "trap_suffix" "v_sv_svi")])
2450 (define_insn "*fix_truncsfdi2"
2451 [(set (match_operand:DI 0 "reg_no_subreg_operand" "=f")
2452 (match_operator:DI 2 "fix_operator"
2453 [(float_extend:DF (match_operand:SF 1 "reg_or_0_operand" "fG"))]))]
2456 [(set_attr "type" "fadd")
2457 (set_attr "trap" "yes")
2458 (set_attr "round_suffix" "c")
2459 (set_attr "trap_suffix" "v_sv_svi")])
2461 (define_expand "fix_truncsfdi2"
2462 [(set (match_operand:DI 0 "reg_no_subreg_operand" "")
2463 (fix:DI (float_extend:DF (match_operand:SF 1 "reg_or_0_operand" ""))))]
2467 (define_expand "fixuns_truncsfdi2"
2468 [(set (match_operand:DI 0 "reg_no_subreg_operand" "")
2470 (float_extend:DF (match_operand:SF 1 "reg_or_0_operand" ""))))]
2474 (define_expand "fix_trunctfdi2"
2475 [(use (match_operand:DI 0 "register_operand" ""))
2476 (use (match_operand:TF 1 "general_operand" ""))]
2477 "TARGET_HAS_XFLOATING_LIBS"
2478 "alpha_emit_xfloating_cvt (FIX, operands); DONE;")
2480 (define_expand "fixuns_trunctfdi2"
2481 [(use (match_operand:DI 0 "register_operand" ""))
2482 (use (match_operand:TF 1 "general_operand" ""))]
2483 "TARGET_HAS_XFLOATING_LIBS"
2484 "alpha_emit_xfloating_cvt (UNSIGNED_FIX, operands); DONE;")
2486 (define_insn "*floatdisf_ieee"
2487 [(set (match_operand:SF 0 "register_operand" "=&f")
2488 (float:SF (match_operand:DI 1 "reg_no_subreg_operand" "f")))]
2489 "TARGET_FP && alpha_fptm >= ALPHA_FPTM_SU"
2491 [(set_attr "type" "fadd")
2492 (set_attr "trap" "yes")
2493 (set_attr "round_suffix" "normal")
2494 (set_attr "trap_suffix" "sui")])
2496 (define_insn "floatdisf2"
2497 [(set (match_operand:SF 0 "register_operand" "=f")
2498 (float:SF (match_operand:DI 1 "reg_no_subreg_operand" "f")))]
2501 [(set_attr "type" "fadd")
2502 (set_attr "trap" "yes")
2503 (set_attr "round_suffix" "normal")
2504 (set_attr "trap_suffix" "sui")])
2506 (define_insn_and_split "*floatsisf2_ieee"
2507 [(set (match_operand:SF 0 "register_operand" "=&f")
2508 (float:SF (match_operand:SI 1 "memory_operand" "m")))
2509 (clobber (match_scratch:DI 2 "=&f"))
2510 (clobber (match_scratch:SF 3 "=&f"))]
2511 "TARGET_FP && alpha_fptm >= ALPHA_FPTM_SU"
2513 "&& reload_completed"
2514 [(set (match_dup 3) (match_dup 1))
2515 (set (match_dup 2) (unspec:DI [(match_dup 3)] UNSPEC_CVTLQ))
2516 (set (match_dup 0) (float:SF (match_dup 2)))]
2518 operands[1] = adjust_address (operands[1], SFmode, 0);
2521 (define_insn_and_split "*floatsisf2"
2522 [(set (match_operand:SF 0 "register_operand" "=f")
2523 (float:SF (match_operand:SI 1 "memory_operand" "m")))]
2526 "&& reload_completed"
2527 [(set (match_dup 0) (match_dup 1))
2528 (set (match_dup 2) (unspec:DI [(match_dup 0)] UNSPEC_CVTLQ))
2529 (set (match_dup 0) (float:SF (match_dup 2)))]
2531 operands[1] = adjust_address (operands[1], SFmode, 0);
2532 operands[2] = gen_rtx_REG (DImode, REGNO (operands[0]));
2535 (define_insn "*floatdidf_ieee"
2536 [(set (match_operand:DF 0 "register_operand" "=&f")
2537 (float:DF (match_operand:DI 1 "reg_no_subreg_operand" "f")))]
2538 "TARGET_FP && alpha_fptm >= ALPHA_FPTM_SU"
2540 [(set_attr "type" "fadd")
2541 (set_attr "trap" "yes")
2542 (set_attr "round_suffix" "normal")
2543 (set_attr "trap_suffix" "sui")])
2545 (define_insn "floatdidf2"
2546 [(set (match_operand:DF 0 "register_operand" "=f")
2547 (float:DF (match_operand:DI 1 "reg_no_subreg_operand" "f")))]
2550 [(set_attr "type" "fadd")
2551 (set_attr "trap" "yes")
2552 (set_attr "round_suffix" "normal")
2553 (set_attr "trap_suffix" "sui")])
2555 (define_insn_and_split "*floatsidf2_ieee"
2556 [(set (match_operand:DF 0 "register_operand" "=&f")
2557 (float:DF (match_operand:SI 1 "memory_operand" "m")))
2558 (clobber (match_scratch:DI 2 "=&f"))
2559 (clobber (match_scratch:SF 3 "=&f"))]
2560 "TARGET_FP && alpha_fptm >= ALPHA_FPTM_SU"
2562 "&& reload_completed"
2563 [(set (match_dup 3) (match_dup 1))
2564 (set (match_dup 2) (unspec:DI [(match_dup 3)] UNSPEC_CVTLQ))
2565 (set (match_dup 0) (float:DF (match_dup 2)))]
2567 operands[1] = adjust_address (operands[1], SFmode, 0);
2570 (define_insn_and_split "*floatsidf2"
2571 [(set (match_operand:DF 0 "register_operand" "=f")
2572 (float:DF (match_operand:SI 1 "memory_operand" "m")))]
2575 "&& reload_completed"
2576 [(set (match_dup 3) (match_dup 1))
2577 (set (match_dup 2) (unspec:DI [(match_dup 3)] UNSPEC_CVTLQ))
2578 (set (match_dup 0) (float:DF (match_dup 2)))]
2580 operands[1] = adjust_address (operands[1], SFmode, 0);
2581 operands[2] = gen_rtx_REG (DImode, REGNO (operands[0]));
2582 operands[3] = gen_rtx_REG (SFmode, REGNO (operands[0]));
2585 (define_expand "floatditf2"
2586 [(use (match_operand:TF 0 "register_operand" ""))
2587 (use (match_operand:DI 1 "general_operand" ""))]
2588 "TARGET_HAS_XFLOATING_LIBS"
2589 "alpha_emit_xfloating_cvt (FLOAT, operands); DONE;")
2591 (define_expand "floatunsdisf2"
2592 [(use (match_operand:SF 0 "register_operand" ""))
2593 (use (match_operand:DI 1 "register_operand" ""))]
2595 "alpha_emit_floatuns (operands); DONE;")
2597 (define_expand "floatunsdidf2"
2598 [(use (match_operand:DF 0 "register_operand" ""))
2599 (use (match_operand:DI 1 "register_operand" ""))]
2601 "alpha_emit_floatuns (operands); DONE;")
2603 (define_expand "floatunsditf2"
2604 [(use (match_operand:TF 0 "register_operand" ""))
2605 (use (match_operand:DI 1 "general_operand" ""))]
2606 "TARGET_HAS_XFLOATING_LIBS"
2607 "alpha_emit_xfloating_cvt (UNSIGNED_FLOAT, operands); DONE;")
2609 (define_expand "extendsfdf2"
2610 [(set (match_operand:DF 0 "register_operand" "")
2611 (float_extend:DF (match_operand:SF 1 "nonimmediate_operand" "")))]
2614 if (alpha_fptm >= ALPHA_FPTM_SU)
2615 operands[1] = force_reg (SFmode, operands[1]);
2618 ;; The Unicos/Mk assembler doesn't support cvtst, but we've already
2619 ;; asserted that alpha_fptm == ALPHA_FPTM_N.
2621 (define_insn "*extendsfdf2_ieee"
2622 [(set (match_operand:DF 0 "register_operand" "=&f")
2623 (float_extend:DF (match_operand:SF 1 "register_operand" "f")))]
2624 "TARGET_FP && alpha_fptm >= ALPHA_FPTM_SU"
2626 [(set_attr "type" "fadd")
2627 (set_attr "trap" "yes")])
2629 (define_insn "*extendsfdf2_internal"
2630 [(set (match_operand:DF 0 "register_operand" "=f,f,m")
2631 (float_extend:DF (match_operand:SF 1 "nonimmediate_operand" "f,m,f")))]
2632 "TARGET_FP && alpha_fptm < ALPHA_FPTM_SU"
2637 [(set_attr "type" "fcpys,fld,fst")])
2639 ;; Use register_operand for operand 1 to prevent compress_float_constant
2640 ;; from doing something silly. When optimizing we'll put things back
2642 (define_expand "extendsftf2"
2643 [(use (match_operand:TF 0 "register_operand" ""))
2644 (use (match_operand:SF 1 "register_operand" ""))]
2645 "TARGET_HAS_XFLOATING_LIBS"
2647 rtx tmp = gen_reg_rtx (DFmode);
2648 emit_insn (gen_extendsfdf2 (tmp, operands[1]));
2649 emit_insn (gen_extenddftf2 (operands[0], tmp));
2653 (define_expand "extenddftf2"
2654 [(use (match_operand:TF 0 "register_operand" ""))
2655 (use (match_operand:DF 1 "register_operand" ""))]
2656 "TARGET_HAS_XFLOATING_LIBS"
2657 "alpha_emit_xfloating_cvt (FLOAT_EXTEND, operands); DONE;")
2659 (define_insn "*truncdfsf2_ieee"
2660 [(set (match_operand:SF 0 "register_operand" "=&f")
2661 (float_truncate:SF (match_operand:DF 1 "reg_or_0_operand" "fG")))]
2662 "TARGET_FP && alpha_fptm >= ALPHA_FPTM_SU"
2664 [(set_attr "type" "fadd")
2665 (set_attr "trap" "yes")
2666 (set_attr "round_suffix" "normal")
2667 (set_attr "trap_suffix" "u_su_sui")])
2669 (define_insn "truncdfsf2"
2670 [(set (match_operand:SF 0 "register_operand" "=f")
2671 (float_truncate:SF (match_operand:DF 1 "reg_or_0_operand" "fG")))]
2674 [(set_attr "type" "fadd")
2675 (set_attr "trap" "yes")
2676 (set_attr "round_suffix" "normal")
2677 (set_attr "trap_suffix" "u_su_sui")])
2679 (define_expand "trunctfdf2"
2680 [(use (match_operand:DF 0 "register_operand" ""))
2681 (use (match_operand:TF 1 "general_operand" ""))]
2682 "TARGET_HAS_XFLOATING_LIBS"
2683 "alpha_emit_xfloating_cvt (FLOAT_TRUNCATE, operands); DONE;")
2685 (define_expand "trunctfsf2"
2686 [(use (match_operand:SF 0 "register_operand" ""))
2687 (use (match_operand:TF 1 "general_operand" ""))]
2688 "TARGET_FP && TARGET_HAS_XFLOATING_LIBS"
2690 rtx tmpf, sticky, arg, lo, hi;
2692 tmpf = gen_reg_rtx (DFmode);
2693 sticky = gen_reg_rtx (DImode);
2694 arg = copy_to_mode_reg (TFmode, operands[1]);
2695 lo = gen_lowpart (DImode, arg);
2696 hi = gen_highpart (DImode, arg);
2698 /* Convert the low word of the TFmode value into a sticky rounding bit,
2699 then or it into the low bit of the high word. This leaves the sticky
2700 bit at bit 48 of the fraction, which is representable in DFmode,
2701 which prevents rounding error in the final conversion to SFmode. */
2703 emit_insn (gen_rtx_SET (VOIDmode, sticky,
2704 gen_rtx_NE (DImode, lo, const0_rtx)));
2705 emit_insn (gen_iordi3 (hi, hi, sticky));
2706 emit_insn (gen_trunctfdf2 (tmpf, arg));
2707 emit_insn (gen_truncdfsf2 (operands[0], tmpf));
2711 (define_insn "*divsf3_ieee"
2712 [(set (match_operand:SF 0 "register_operand" "=&f")
2713 (div:SF (match_operand:SF 1 "reg_or_0_operand" "fG")
2714 (match_operand:SF 2 "reg_or_0_operand" "fG")))]
2715 "TARGET_FP && alpha_fptm >= ALPHA_FPTM_SU"
2716 "div%,%/ %R1,%R2,%0"
2717 [(set_attr "type" "fdiv")
2718 (set_attr "opsize" "si")
2719 (set_attr "trap" "yes")
2720 (set_attr "round_suffix" "normal")
2721 (set_attr "trap_suffix" "u_su_sui")])
2723 (define_insn "divsf3"
2724 [(set (match_operand:SF 0 "register_operand" "=f")
2725 (div:SF (match_operand:SF 1 "reg_or_0_operand" "fG")
2726 (match_operand:SF 2 "reg_or_0_operand" "fG")))]
2728 "div%,%/ %R1,%R2,%0"
2729 [(set_attr "type" "fdiv")
2730 (set_attr "opsize" "si")
2731 (set_attr "trap" "yes")
2732 (set_attr "round_suffix" "normal")
2733 (set_attr "trap_suffix" "u_su_sui")])
2735 (define_insn "*divdf3_ieee"
2736 [(set (match_operand:DF 0 "register_operand" "=&f")
2737 (div:DF (match_operand:DF 1 "reg_or_0_operand" "fG")
2738 (match_operand:DF 2 "reg_or_0_operand" "fG")))]
2739 "TARGET_FP && alpha_fptm >= ALPHA_FPTM_SU"
2740 "div%-%/ %R1,%R2,%0"
2741 [(set_attr "type" "fdiv")
2742 (set_attr "trap" "yes")
2743 (set_attr "round_suffix" "normal")
2744 (set_attr "trap_suffix" "u_su_sui")])
2746 (define_insn "divdf3"
2747 [(set (match_operand:DF 0 "register_operand" "=f")
2748 (div:DF (match_operand:DF 1 "reg_or_0_operand" "fG")
2749 (match_operand:DF 2 "reg_or_0_operand" "fG")))]
2751 "div%-%/ %R1,%R2,%0"
2752 [(set_attr "type" "fdiv")
2753 (set_attr "trap" "yes")
2754 (set_attr "round_suffix" "normal")
2755 (set_attr "trap_suffix" "u_su_sui")])
2757 (define_insn "*divdf_ext1"
2758 [(set (match_operand:DF 0 "register_operand" "=f")
2759 (div:DF (float_extend:DF (match_operand:SF 1 "reg_or_0_operand" "fG"))
2760 (match_operand:DF 2 "reg_or_0_operand" "fG")))]
2761 "TARGET_FP && alpha_fptm < ALPHA_FPTM_SU"
2762 "div%-%/ %R1,%R2,%0"
2763 [(set_attr "type" "fdiv")
2764 (set_attr "trap" "yes")
2765 (set_attr "round_suffix" "normal")
2766 (set_attr "trap_suffix" "u_su_sui")])
2768 (define_insn "*divdf_ext2"
2769 [(set (match_operand:DF 0 "register_operand" "=f")
2770 (div:DF (match_operand:DF 1 "reg_or_0_operand" "fG")
2772 (match_operand:SF 2 "reg_or_0_operand" "fG"))))]
2773 "TARGET_FP && alpha_fptm < ALPHA_FPTM_SU"
2774 "div%-%/ %R1,%R2,%0"
2775 [(set_attr "type" "fdiv")
2776 (set_attr "trap" "yes")
2777 (set_attr "round_suffix" "normal")
2778 (set_attr "trap_suffix" "u_su_sui")])
2780 (define_insn "*divdf_ext3"
2781 [(set (match_operand:DF 0 "register_operand" "=f")
2782 (div:DF (float_extend:DF (match_operand:SF 1 "reg_or_0_operand" "fG"))
2783 (float_extend:DF (match_operand:SF 2 "reg_or_0_operand" "fG"))))]
2784 "TARGET_FP && alpha_fptm < ALPHA_FPTM_SU"
2785 "div%-%/ %R1,%R2,%0"
2786 [(set_attr "type" "fdiv")
2787 (set_attr "trap" "yes")
2788 (set_attr "round_suffix" "normal")
2789 (set_attr "trap_suffix" "u_su_sui")])
2791 (define_expand "divtf3"
2792 [(use (match_operand 0 "register_operand" ""))
2793 (use (match_operand 1 "general_operand" ""))
2794 (use (match_operand 2 "general_operand" ""))]
2795 "TARGET_HAS_XFLOATING_LIBS"
2796 "alpha_emit_xfloating_arith (DIV, operands); DONE;")
2798 (define_insn "*mulsf3_ieee"
2799 [(set (match_operand:SF 0 "register_operand" "=&f")
2800 (mult:SF (match_operand:SF 1 "reg_or_0_operand" "%fG")
2801 (match_operand:SF 2 "reg_or_0_operand" "fG")))]
2802 "TARGET_FP && alpha_fptm >= ALPHA_FPTM_SU"
2803 "mul%,%/ %R1,%R2,%0"
2804 [(set_attr "type" "fmul")
2805 (set_attr "trap" "yes")
2806 (set_attr "round_suffix" "normal")
2807 (set_attr "trap_suffix" "u_su_sui")])
2809 (define_insn "mulsf3"
2810 [(set (match_operand:SF 0 "register_operand" "=f")
2811 (mult:SF (match_operand:SF 1 "reg_or_0_operand" "%fG")
2812 (match_operand:SF 2 "reg_or_0_operand" "fG")))]
2814 "mul%,%/ %R1,%R2,%0"
2815 [(set_attr "type" "fmul")
2816 (set_attr "trap" "yes")
2817 (set_attr "round_suffix" "normal")
2818 (set_attr "trap_suffix" "u_su_sui")])
2820 (define_insn "*muldf3_ieee"
2821 [(set (match_operand:DF 0 "register_operand" "=&f")
2822 (mult:DF (match_operand:DF 1 "reg_or_0_operand" "%fG")
2823 (match_operand:DF 2 "reg_or_0_operand" "fG")))]
2824 "TARGET_FP && alpha_fptm >= ALPHA_FPTM_SU"
2825 "mul%-%/ %R1,%R2,%0"
2826 [(set_attr "type" "fmul")
2827 (set_attr "trap" "yes")
2828 (set_attr "round_suffix" "normal")
2829 (set_attr "trap_suffix" "u_su_sui")])
2831 (define_insn "muldf3"
2832 [(set (match_operand:DF 0 "register_operand" "=f")
2833 (mult:DF (match_operand:DF 1 "reg_or_0_operand" "%fG")
2834 (match_operand:DF 2 "reg_or_0_operand" "fG")))]
2836 "mul%-%/ %R1,%R2,%0"
2837 [(set_attr "type" "fmul")
2838 (set_attr "trap" "yes")
2839 (set_attr "round_suffix" "normal")
2840 (set_attr "trap_suffix" "u_su_sui")])
2842 (define_insn "*muldf_ext1"
2843 [(set (match_operand:DF 0 "register_operand" "=f")
2844 (mult:DF (float_extend:DF
2845 (match_operand:SF 1 "reg_or_0_operand" "fG"))
2846 (match_operand:DF 2 "reg_or_0_operand" "fG")))]
2847 "TARGET_FP && alpha_fptm < ALPHA_FPTM_SU"
2848 "mul%-%/ %R1,%R2,%0"
2849 [(set_attr "type" "fmul")
2850 (set_attr "trap" "yes")
2851 (set_attr "round_suffix" "normal")
2852 (set_attr "trap_suffix" "u_su_sui")])
2854 (define_insn "*muldf_ext2"
2855 [(set (match_operand:DF 0 "register_operand" "=f")
2856 (mult:DF (float_extend:DF
2857 (match_operand:SF 1 "reg_or_0_operand" "%fG"))
2859 (match_operand:SF 2 "reg_or_0_operand" "fG"))))]
2860 "TARGET_FP && alpha_fptm < ALPHA_FPTM_SU"
2861 "mul%-%/ %R1,%R2,%0"
2862 [(set_attr "type" "fmul")
2863 (set_attr "trap" "yes")
2864 (set_attr "round_suffix" "normal")
2865 (set_attr "trap_suffix" "u_su_sui")])
2867 (define_expand "multf3"
2868 [(use (match_operand 0 "register_operand" ""))
2869 (use (match_operand 1 "general_operand" ""))
2870 (use (match_operand 2 "general_operand" ""))]
2871 "TARGET_HAS_XFLOATING_LIBS"
2872 "alpha_emit_xfloating_arith (MULT, operands); DONE;")
2874 (define_insn "*subsf3_ieee"
2875 [(set (match_operand:SF 0 "register_operand" "=&f")
2876 (minus:SF (match_operand:SF 1 "reg_or_0_operand" "fG")
2877 (match_operand:SF 2 "reg_or_0_operand" "fG")))]
2878 "TARGET_FP && alpha_fptm >= ALPHA_FPTM_SU"
2879 "sub%,%/ %R1,%R2,%0"
2880 [(set_attr "type" "fadd")
2881 (set_attr "trap" "yes")
2882 (set_attr "round_suffix" "normal")
2883 (set_attr "trap_suffix" "u_su_sui")])
2885 (define_insn "subsf3"
2886 [(set (match_operand:SF 0 "register_operand" "=f")
2887 (minus:SF (match_operand:SF 1 "reg_or_0_operand" "fG")
2888 (match_operand:SF 2 "reg_or_0_operand" "fG")))]
2890 "sub%,%/ %R1,%R2,%0"
2891 [(set_attr "type" "fadd")
2892 (set_attr "trap" "yes")
2893 (set_attr "round_suffix" "normal")
2894 (set_attr "trap_suffix" "u_su_sui")])
2896 (define_insn "*subdf3_ieee"
2897 [(set (match_operand:DF 0 "register_operand" "=&f")
2898 (minus:DF (match_operand:DF 1 "reg_or_0_operand" "fG")
2899 (match_operand:DF 2 "reg_or_0_operand" "fG")))]
2900 "TARGET_FP && alpha_fptm >= ALPHA_FPTM_SU"
2901 "sub%-%/ %R1,%R2,%0"
2902 [(set_attr "type" "fadd")
2903 (set_attr "trap" "yes")
2904 (set_attr "round_suffix" "normal")
2905 (set_attr "trap_suffix" "u_su_sui")])
2907 (define_insn "subdf3"
2908 [(set (match_operand:DF 0 "register_operand" "=f")
2909 (minus:DF (match_operand:DF 1 "reg_or_0_operand" "fG")
2910 (match_operand:DF 2 "reg_or_0_operand" "fG")))]
2912 "sub%-%/ %R1,%R2,%0"
2913 [(set_attr "type" "fadd")
2914 (set_attr "trap" "yes")
2915 (set_attr "round_suffix" "normal")
2916 (set_attr "trap_suffix" "u_su_sui")])
2918 (define_insn "*subdf_ext1"
2919 [(set (match_operand:DF 0 "register_operand" "=f")
2920 (minus:DF (float_extend:DF
2921 (match_operand:SF 1 "reg_or_0_operand" "fG"))
2922 (match_operand:DF 2 "reg_or_0_operand" "fG")))]
2923 "TARGET_FP && alpha_fptm < ALPHA_FPTM_SU"
2924 "sub%-%/ %R1,%R2,%0"
2925 [(set_attr "type" "fadd")
2926 (set_attr "trap" "yes")
2927 (set_attr "round_suffix" "normal")
2928 (set_attr "trap_suffix" "u_su_sui")])
2930 (define_insn "*subdf_ext2"
2931 [(set (match_operand:DF 0 "register_operand" "=f")
2932 (minus:DF (match_operand:DF 1 "reg_or_0_operand" "fG")
2934 (match_operand:SF 2 "reg_or_0_operand" "fG"))))]
2935 "TARGET_FP && alpha_fptm < ALPHA_FPTM_SU"
2936 "sub%-%/ %R1,%R2,%0"
2937 [(set_attr "type" "fadd")
2938 (set_attr "trap" "yes")
2939 (set_attr "round_suffix" "normal")
2940 (set_attr "trap_suffix" "u_su_sui")])
2942 (define_insn "*subdf_ext3"
2943 [(set (match_operand:DF 0 "register_operand" "=f")
2944 (minus:DF (float_extend:DF
2945 (match_operand:SF 1 "reg_or_0_operand" "fG"))
2947 (match_operand:SF 2 "reg_or_0_operand" "fG"))))]
2948 "TARGET_FP && alpha_fptm < ALPHA_FPTM_SU"
2949 "sub%-%/ %R1,%R2,%0"
2950 [(set_attr "type" "fadd")
2951 (set_attr "trap" "yes")
2952 (set_attr "round_suffix" "normal")
2953 (set_attr "trap_suffix" "u_su_sui")])
2955 (define_expand "subtf3"
2956 [(use (match_operand 0 "register_operand" ""))
2957 (use (match_operand 1 "general_operand" ""))
2958 (use (match_operand 2 "general_operand" ""))]
2959 "TARGET_HAS_XFLOATING_LIBS"
2960 "alpha_emit_xfloating_arith (MINUS, operands); DONE;")
2962 (define_insn "*sqrtsf2_ieee"
2963 [(set (match_operand:SF 0 "register_operand" "=&f")
2964 (sqrt:SF (match_operand:SF 1 "reg_or_0_operand" "fG")))]
2965 "TARGET_FP && TARGET_FIX && alpha_fptm >= ALPHA_FPTM_SU"
2967 [(set_attr "type" "fsqrt")
2968 (set_attr "opsize" "si")
2969 (set_attr "trap" "yes")
2970 (set_attr "round_suffix" "normal")
2971 (set_attr "trap_suffix" "u_su_sui")])
2973 (define_insn "sqrtsf2"
2974 [(set (match_operand:SF 0 "register_operand" "=f")
2975 (sqrt:SF (match_operand:SF 1 "reg_or_0_operand" "fG")))]
2976 "TARGET_FP && TARGET_FIX"
2978 [(set_attr "type" "fsqrt")
2979 (set_attr "opsize" "si")
2980 (set_attr "trap" "yes")
2981 (set_attr "round_suffix" "normal")
2982 (set_attr "trap_suffix" "u_su_sui")])
2984 (define_insn "*sqrtdf2_ieee"
2985 [(set (match_operand:DF 0 "register_operand" "=&f")
2986 (sqrt:DF (match_operand:DF 1 "reg_or_0_operand" "fG")))]
2987 "TARGET_FP && TARGET_FIX && alpha_fptm >= ALPHA_FPTM_SU"
2989 [(set_attr "type" "fsqrt")
2990 (set_attr "trap" "yes")
2991 (set_attr "round_suffix" "normal")
2992 (set_attr "trap_suffix" "u_su_sui")])
2994 (define_insn "sqrtdf2"
2995 [(set (match_operand:DF 0 "register_operand" "=f")
2996 (sqrt:DF (match_operand:DF 1 "reg_or_0_operand" "fG")))]
2997 "TARGET_FP && TARGET_FIX"
2999 [(set_attr "type" "fsqrt")
3000 (set_attr "trap" "yes")
3001 (set_attr "round_suffix" "normal")
3002 (set_attr "trap_suffix" "u_su_sui")])
3004 ;; Next are all the integer comparisons, and conditional moves and branches
3005 ;; and some of the related define_expand's and define_split's.
3007 (define_insn "*setcc_internal"
3008 [(set (match_operand 0 "register_operand" "=r")
3009 (match_operator 1 "alpha_comparison_operator"
3010 [(match_operand:DI 2 "register_operand" "r")
3011 (match_operand:DI 3 "reg_or_8bit_operand" "rI")]))]
3012 "GET_MODE_CLASS (GET_MODE (operands[0])) == MODE_INT
3013 && GET_MODE_SIZE (GET_MODE (operands[0])) <= 8
3014 && GET_MODE (operands[0]) == GET_MODE (operands[1])"
3016 [(set_attr "type" "icmp")])
3018 ;; Yes, we can technically support reg_or_8bit_operand in operand 2,
3019 ;; but that's non-canonical rtl and allowing that causes inefficiencies
3021 (define_insn "*setcc_swapped_internal"
3022 [(set (match_operand 0 "register_operand" "=r")
3023 (match_operator 1 "alpha_swapped_comparison_operator"
3024 [(match_operand:DI 2 "register_operand" "r")
3025 (match_operand:DI 3 "reg_or_0_operand" "rJ")]))]
3026 "GET_MODE_CLASS (GET_MODE (operands[0])) == MODE_INT
3027 && GET_MODE_SIZE (GET_MODE (operands[0])) <= 8
3028 && GET_MODE (operands[0]) == GET_MODE (operands[1])"
3030 [(set_attr "type" "icmp")])
3032 ;; Use match_operator rather than ne directly so that we can match
3033 ;; multiple integer modes.
3034 (define_insn "*setne_internal"
3035 [(set (match_operand 0 "register_operand" "=r")
3036 (match_operator 1 "signed_comparison_operator"
3037 [(match_operand:DI 2 "register_operand" "r")
3039 "GET_MODE_CLASS (GET_MODE (operands[0])) == MODE_INT
3040 && GET_MODE_SIZE (GET_MODE (operands[0])) <= 8
3041 && GET_CODE (operands[1]) == NE
3042 && GET_MODE (operands[0]) == GET_MODE (operands[1])"
3044 [(set_attr "type" "icmp")])
3046 ;; The mode folding trick can't be used with const_int operands, since
3047 ;; reload needs to know the proper mode.
3049 ;; Use add_operand instead of the more seemingly natural reg_or_8bit_operand
3050 ;; in order to create more pairs of constants. As long as we're allowing
3051 ;; two constants at the same time, and will have to reload one of them...
3053 (define_insn "*movqicc_internal"
3054 [(set (match_operand:QI 0 "register_operand" "=r,r,r,r")
3056 (match_operator 2 "signed_comparison_operator"
3057 [(match_operand:DI 3 "reg_or_0_operand" "rJ,rJ,J,J")
3058 (match_operand:DI 4 "reg_or_0_operand" "J,J,rJ,rJ")])
3059 (match_operand:QI 1 "add_operand" "rI,0,rI,0")
3060 (match_operand:QI 5 "add_operand" "0,rI,0,rI")))]
3061 "(operands[3] == const0_rtx || operands[4] == const0_rtx)"
3067 [(set_attr "type" "icmov")])
3069 (define_insn "*movhicc_internal"
3070 [(set (match_operand:HI 0 "register_operand" "=r,r,r,r")
3072 (match_operator 2 "signed_comparison_operator"
3073 [(match_operand:DI 3 "reg_or_0_operand" "rJ,rJ,J,J")
3074 (match_operand:DI 4 "reg_or_0_operand" "J,J,rJ,rJ")])
3075 (match_operand:HI 1 "add_operand" "rI,0,rI,0")
3076 (match_operand:HI 5 "add_operand" "0,rI,0,rI")))]
3077 "(operands[3] == const0_rtx || operands[4] == const0_rtx)"
3083 [(set_attr "type" "icmov")])
3085 (define_insn "*movsicc_internal"
3086 [(set (match_operand:SI 0 "register_operand" "=r,r,r,r")
3088 (match_operator 2 "signed_comparison_operator"
3089 [(match_operand:DI 3 "reg_or_0_operand" "rJ,rJ,J,J")
3090 (match_operand:DI 4 "reg_or_0_operand" "J,J,rJ,rJ")])
3091 (match_operand:SI 1 "add_operand" "rI,0,rI,0")
3092 (match_operand:SI 5 "add_operand" "0,rI,0,rI")))]
3093 "(operands[3] == const0_rtx || operands[4] == const0_rtx)"
3099 [(set_attr "type" "icmov")])
3101 (define_insn "*movdicc_internal"
3102 [(set (match_operand:DI 0 "register_operand" "=r,r,r,r")
3104 (match_operator 2 "signed_comparison_operator"
3105 [(match_operand:DI 3 "reg_or_0_operand" "rJ,rJ,J,J")
3106 (match_operand:DI 4 "reg_or_0_operand" "J,J,rJ,rJ")])
3107 (match_operand:DI 1 "add_operand" "rI,0,rI,0")
3108 (match_operand:DI 5 "add_operand" "0,rI,0,rI")))]
3109 "(operands[3] == const0_rtx || operands[4] == const0_rtx)"
3115 [(set_attr "type" "icmov")])
3117 (define_insn "*movqicc_lbc"
3118 [(set (match_operand:QI 0 "register_operand" "=r,r")
3120 (eq (zero_extract:DI (match_operand:DI 2 "reg_or_0_operand" "rJ,rJ")
3124 (match_operand:QI 1 "reg_or_8bit_operand" "rI,0")
3125 (match_operand:QI 3 "reg_or_8bit_operand" "0,rI")))]
3130 [(set_attr "type" "icmov")])
3132 (define_insn "*movhicc_lbc"
3133 [(set (match_operand:HI 0 "register_operand" "=r,r")
3135 (eq (zero_extract:DI (match_operand:DI 2 "reg_or_0_operand" "rJ,rJ")
3139 (match_operand:HI 1 "reg_or_8bit_operand" "rI,0")
3140 (match_operand:HI 3 "reg_or_8bit_operand" "0,rI")))]
3145 [(set_attr "type" "icmov")])
3147 (define_insn "*movsicc_lbc"
3148 [(set (match_operand:SI 0 "register_operand" "=r,r")
3150 (eq (zero_extract:DI (match_operand:DI 2 "reg_or_0_operand" "rJ,rJ")
3154 (match_operand:SI 1 "reg_or_8bit_operand" "rI,0")
3155 (match_operand:SI 3 "reg_or_8bit_operand" "0,rI")))]
3160 [(set_attr "type" "icmov")])
3162 (define_insn "*movdicc_lbc"
3163 [(set (match_operand:DI 0 "register_operand" "=r,r")
3165 (eq (zero_extract:DI (match_operand:DI 2 "reg_or_0_operand" "rJ,rJ")
3169 (match_operand:DI 1 "reg_or_8bit_operand" "rI,0")
3170 (match_operand:DI 3 "reg_or_8bit_operand" "0,rI")))]
3175 [(set_attr "type" "icmov")])
3177 (define_insn "*movqicc_lbs"
3178 [(set (match_operand:QI 0 "register_operand" "=r,r")
3180 (ne (zero_extract:DI (match_operand:DI 2 "reg_or_0_operand" "rJ,rJ")
3184 (match_operand:QI 1 "reg_or_8bit_operand" "rI,0")
3185 (match_operand:QI 3 "reg_or_8bit_operand" "0,rI")))]
3190 [(set_attr "type" "icmov")])
3192 (define_insn "*movhicc_lbs"
3193 [(set (match_operand:HI 0 "register_operand" "=r,r")
3195 (ne (zero_extract:DI (match_operand:DI 2 "reg_or_0_operand" "rJ,rJ")
3199 (match_operand:HI 1 "reg_or_8bit_operand" "rI,0")
3200 (match_operand:HI 3 "reg_or_8bit_operand" "0,rI")))]
3205 [(set_attr "type" "icmov")])
3207 (define_insn "*movsicc_lbs"
3208 [(set (match_operand:SI 0 "register_operand" "=r,r")
3210 (ne (zero_extract:DI (match_operand:DI 2 "reg_or_0_operand" "rJ,rJ")
3214 (match_operand:SI 1 "reg_or_8bit_operand" "rI,0")
3215 (match_operand:SI 3 "reg_or_8bit_operand" "0,rI")))]
3220 [(set_attr "type" "icmov")])
3222 (define_insn "*movdicc_lbs"
3223 [(set (match_operand:DI 0 "register_operand" "=r,r")
3225 (ne (zero_extract:DI (match_operand:DI 2 "reg_or_0_operand" "rJ,rJ")
3229 (match_operand:DI 1 "reg_or_8bit_operand" "rI,0")
3230 (match_operand:DI 3 "reg_or_8bit_operand" "0,rI")))]
3235 [(set_attr "type" "icmov")])
3237 ;; For ABS, we have two choices, depending on whether the input and output
3238 ;; registers are the same or not.
3239 (define_expand "absdi2"
3240 [(set (match_operand:DI 0 "register_operand" "")
3241 (abs:DI (match_operand:DI 1 "register_operand" "")))]
3244 if (rtx_equal_p (operands[0], operands[1]))
3245 emit_insn (gen_absdi2_same (operands[0], gen_reg_rtx (DImode)));
3247 emit_insn (gen_absdi2_diff (operands[0], operands[1]));
3251 (define_expand "absdi2_same"
3252 [(set (match_operand:DI 1 "register_operand" "")
3253 (neg:DI (match_operand:DI 0 "register_operand" "")))
3255 (if_then_else:DI (ge (match_dup 0) (const_int 0))
3261 (define_expand "absdi2_diff"
3262 [(set (match_operand:DI 0 "register_operand" "")
3263 (neg:DI (match_operand:DI 1 "register_operand" "")))
3265 (if_then_else:DI (lt (match_dup 1) (const_int 0))
3272 [(set (match_operand:DI 0 "register_operand" "")
3273 (abs:DI (match_dup 0)))
3274 (clobber (match_operand:DI 1 "register_operand" ""))]
3276 [(set (match_dup 1) (neg:DI (match_dup 0)))
3277 (set (match_dup 0) (if_then_else:DI (ge (match_dup 0) (const_int 0))
3278 (match_dup 0) (match_dup 1)))]
3282 [(set (match_operand:DI 0 "register_operand" "")
3283 (abs:DI (match_operand:DI 1 "register_operand" "")))]
3284 "! rtx_equal_p (operands[0], operands[1])"
3285 [(set (match_dup 0) (neg:DI (match_dup 1)))
3286 (set (match_dup 0) (if_then_else:DI (lt (match_dup 1) (const_int 0))
3287 (match_dup 0) (match_dup 1)))]
3291 [(set (match_operand:DI 0 "register_operand" "")
3292 (neg:DI (abs:DI (match_dup 0))))
3293 (clobber (match_operand:DI 1 "register_operand" ""))]
3295 [(set (match_dup 1) (neg:DI (match_dup 0)))
3296 (set (match_dup 0) (if_then_else:DI (le (match_dup 0) (const_int 0))
3297 (match_dup 0) (match_dup 1)))]
3301 [(set (match_operand:DI 0 "register_operand" "")
3302 (neg:DI (abs:DI (match_operand:DI 1 "register_operand" ""))))]
3303 "! rtx_equal_p (operands[0], operands[1])"
3304 [(set (match_dup 0) (neg:DI (match_dup 1)))
3305 (set (match_dup 0) (if_then_else:DI (gt (match_dup 1) (const_int 0))
3306 (match_dup 0) (match_dup 1)))]
3309 (define_insn "sminqi3"
3310 [(set (match_operand:QI 0 "register_operand" "=r")
3311 (smin:QI (match_operand:QI 1 "reg_or_0_operand" "%rJ")
3312 (match_operand:QI 2 "reg_or_8bit_operand" "rI")))]
3315 [(set_attr "type" "mvi")])
3317 (define_insn "uminqi3"
3318 [(set (match_operand:QI 0 "register_operand" "=r")
3319 (umin:QI (match_operand:QI 1 "reg_or_0_operand" "%rJ")
3320 (match_operand:QI 2 "reg_or_8bit_operand" "rI")))]
3323 [(set_attr "type" "mvi")])
3325 (define_insn "smaxqi3"
3326 [(set (match_operand:QI 0 "register_operand" "=r")
3327 (smax:QI (match_operand:QI 1 "reg_or_0_operand" "%rJ")
3328 (match_operand:QI 2 "reg_or_8bit_operand" "rI")))]
3331 [(set_attr "type" "mvi")])
3333 (define_insn "umaxqi3"
3334 [(set (match_operand:QI 0 "register_operand" "=r")
3335 (umax:QI (match_operand:QI 1 "reg_or_0_operand" "%rJ")
3336 (match_operand:QI 2 "reg_or_8bit_operand" "rI")))]
3339 [(set_attr "type" "mvi")])
3341 (define_insn "sminhi3"
3342 [(set (match_operand:HI 0 "register_operand" "=r")
3343 (smin:HI (match_operand:HI 1 "reg_or_0_operand" "%rJ")
3344 (match_operand:HI 2 "reg_or_8bit_operand" "rI")))]
3347 [(set_attr "type" "mvi")])
3349 (define_insn "uminhi3"
3350 [(set (match_operand:HI 0 "register_operand" "=r")
3351 (umin:HI (match_operand:HI 1 "reg_or_0_operand" "%rJ")
3352 (match_operand:HI 2 "reg_or_8bit_operand" "rI")))]
3355 [(set_attr "type" "mvi")])
3357 (define_insn "smaxhi3"
3358 [(set (match_operand:HI 0 "register_operand" "=r")
3359 (smax:HI (match_operand:HI 1 "reg_or_0_operand" "%rJ")
3360 (match_operand:HI 2 "reg_or_8bit_operand" "rI")))]
3363 [(set_attr "type" "mvi")])
3365 (define_insn "umaxhi3"
3366 [(set (match_operand:HI 0 "register_operand" "=r")
3367 (umax:HI (match_operand:HI 1 "reg_or_0_operand" "%rJ")
3368 (match_operand:HI 2 "reg_or_8bit_operand" "rI")))]
3371 [(set_attr "type" "mvi")])
3373 (define_expand "smaxdi3"
3375 (le:DI (match_operand:DI 1 "reg_or_0_operand" "")
3376 (match_operand:DI 2 "reg_or_8bit_operand" "")))
3377 (set (match_operand:DI 0 "register_operand" "")
3378 (if_then_else:DI (eq (match_dup 3) (const_int 0))
3379 (match_dup 1) (match_dup 2)))]
3381 { operands[3] = gen_reg_rtx (DImode); })
3384 [(set (match_operand:DI 0 "register_operand" "")
3385 (smax:DI (match_operand:DI 1 "reg_or_0_operand" "")
3386 (match_operand:DI 2 "reg_or_8bit_operand" "")))
3387 (clobber (match_operand:DI 3 "register_operand" ""))]
3388 "operands[2] != const0_rtx"
3389 [(set (match_dup 3) (le:DI (match_dup 1) (match_dup 2)))
3390 (set (match_dup 0) (if_then_else:DI (eq (match_dup 3) (const_int 0))
3391 (match_dup 1) (match_dup 2)))]
3394 (define_insn "*smax_const0"
3395 [(set (match_operand:DI 0 "register_operand" "=r")
3396 (smax:DI (match_operand:DI 1 "register_operand" "0")
3400 [(set_attr "type" "icmov")])
3402 (define_expand "smindi3"
3404 (lt:DI (match_operand:DI 1 "reg_or_0_operand" "")
3405 (match_operand:DI 2 "reg_or_8bit_operand" "")))
3406 (set (match_operand:DI 0 "register_operand" "")
3407 (if_then_else:DI (ne (match_dup 3) (const_int 0))
3408 (match_dup 1) (match_dup 2)))]
3410 { operands[3] = gen_reg_rtx (DImode); })
3413 [(set (match_operand:DI 0 "register_operand" "")
3414 (smin:DI (match_operand:DI 1 "reg_or_0_operand" "")
3415 (match_operand:DI 2 "reg_or_8bit_operand" "")))
3416 (clobber (match_operand:DI 3 "register_operand" ""))]
3417 "operands[2] != const0_rtx"
3418 [(set (match_dup 3) (lt:DI (match_dup 1) (match_dup 2)))
3419 (set (match_dup 0) (if_then_else:DI (ne (match_dup 3) (const_int 0))
3420 (match_dup 1) (match_dup 2)))]
3423 (define_insn "*smin_const0"
3424 [(set (match_operand:DI 0 "register_operand" "=r")
3425 (smin:DI (match_operand:DI 1 "register_operand" "0")
3429 [(set_attr "type" "icmov")])
3431 (define_expand "umaxdi3"
3433 (leu:DI (match_operand:DI 1 "reg_or_0_operand" "")
3434 (match_operand:DI 2 "reg_or_8bit_operand" "")))
3435 (set (match_operand:DI 0 "register_operand" "")
3436 (if_then_else:DI (eq (match_dup 3) (const_int 0))
3437 (match_dup 1) (match_dup 2)))]
3439 "operands[3] = gen_reg_rtx (DImode);")
3442 [(set (match_operand:DI 0 "register_operand" "")
3443 (umax:DI (match_operand:DI 1 "reg_or_0_operand" "")
3444 (match_operand:DI 2 "reg_or_8bit_operand" "")))
3445 (clobber (match_operand:DI 3 "register_operand" ""))]
3446 "operands[2] != const0_rtx"
3447 [(set (match_dup 3) (leu:DI (match_dup 1) (match_dup 2)))
3448 (set (match_dup 0) (if_then_else:DI (eq (match_dup 3) (const_int 0))
3449 (match_dup 1) (match_dup 2)))]
3452 (define_expand "umindi3"
3454 (ltu:DI (match_operand:DI 1 "reg_or_0_operand" "")
3455 (match_operand:DI 2 "reg_or_8bit_operand" "")))
3456 (set (match_operand:DI 0 "register_operand" "")
3457 (if_then_else:DI (ne (match_dup 3) (const_int 0))
3458 (match_dup 1) (match_dup 2)))]
3460 "operands[3] = gen_reg_rtx (DImode);")
3463 [(set (match_operand:DI 0 "register_operand" "")
3464 (umin:DI (match_operand:DI 1 "reg_or_0_operand" "")
3465 (match_operand:DI 2 "reg_or_8bit_operand" "")))
3466 (clobber (match_operand:DI 3 "register_operand" ""))]
3467 "operands[2] != const0_rtx"
3468 [(set (match_dup 3) (ltu:DI (match_dup 1) (match_dup 2)))
3469 (set (match_dup 0) (if_then_else:DI (ne (match_dup 3) (const_int 0))
3470 (match_dup 1) (match_dup 2)))]
3473 (define_insn "*bcc_normal"
3476 (match_operator 1 "signed_comparison_operator"
3477 [(match_operand:DI 2 "reg_or_0_operand" "rJ")
3479 (label_ref (match_operand 0 "" ""))
3483 [(set_attr "type" "ibr")])
3485 (define_insn "*bcc_reverse"
3488 (match_operator 1 "signed_comparison_operator"
3489 [(match_operand:DI 2 "register_operand" "r")
3493 (label_ref (match_operand 0 "" ""))))]
3496 [(set_attr "type" "ibr")])
3498 (define_insn "*blbs_normal"
3501 (ne (zero_extract:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
3505 (label_ref (match_operand 0 "" ""))
3509 [(set_attr "type" "ibr")])
3511 (define_insn "*blbc_normal"
3514 (eq (zero_extract:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
3518 (label_ref (match_operand 0 "" ""))
3522 [(set_attr "type" "ibr")])
3528 (match_operator 1 "comparison_operator"
3529 [(zero_extract:DI (match_operand:DI 2 "register_operand" "")
3531 (match_operand:DI 3 "const_int_operand" ""))
3533 (label_ref (match_operand 0 "" ""))
3535 (clobber (match_operand:DI 4 "register_operand" ""))])]
3536 "INTVAL (operands[3]) != 0"
3538 (lshiftrt:DI (match_dup 2) (match_dup 3)))
3540 (if_then_else (match_op_dup 1
3541 [(zero_extract:DI (match_dup 4)
3545 (label_ref (match_dup 0))
3549 ;; The following are the corresponding floating-point insns. Recall
3550 ;; we need to have variants that expand the arguments from SFmode
3553 (define_insn "*cmpdf_ieee"
3554 [(set (match_operand:DF 0 "register_operand" "=&f")
3555 (match_operator:DF 1 "alpha_fp_comparison_operator"
3556 [(match_operand:DF 2 "reg_or_0_operand" "fG")
3557 (match_operand:DF 3 "reg_or_0_operand" "fG")]))]
3558 "TARGET_FP && alpha_fptm >= ALPHA_FPTM_SU"
3559 "cmp%-%C1%/ %R2,%R3,%0"
3560 [(set_attr "type" "fadd")
3561 (set_attr "trap" "yes")
3562 (set_attr "trap_suffix" "su")])
3564 (define_insn "*cmpdf_internal"
3565 [(set (match_operand:DF 0 "register_operand" "=f")
3566 (match_operator:DF 1 "alpha_fp_comparison_operator"
3567 [(match_operand:DF 2 "reg_or_0_operand" "fG")
3568 (match_operand:DF 3 "reg_or_0_operand" "fG")]))]
3569 "TARGET_FP && alpha_fptm < ALPHA_FPTM_SU"
3570 "cmp%-%C1%/ %R2,%R3,%0"
3571 [(set_attr "type" "fadd")
3572 (set_attr "trap" "yes")
3573 (set_attr "trap_suffix" "su")])
3575 (define_insn "*cmpdf_ieee_ext1"
3576 [(set (match_operand:DF 0 "register_operand" "=&f")
3577 (match_operator:DF 1 "alpha_fp_comparison_operator"
3579 (match_operand:SF 2 "reg_or_0_operand" "fG"))
3580 (match_operand:DF 3 "reg_or_0_operand" "fG")]))]
3581 "TARGET_FP && alpha_fptm >= ALPHA_FPTM_SU"
3582 "cmp%-%C1%/ %R2,%R3,%0"
3583 [(set_attr "type" "fadd")
3584 (set_attr "trap" "yes")
3585 (set_attr "trap_suffix" "su")])
3587 (define_insn "*cmpdf_ext1"
3588 [(set (match_operand:DF 0 "register_operand" "=f")
3589 (match_operator:DF 1 "alpha_fp_comparison_operator"
3591 (match_operand:SF 2 "reg_or_0_operand" "fG"))
3592 (match_operand:DF 3 "reg_or_0_operand" "fG")]))]
3593 "TARGET_FP && alpha_fptm < ALPHA_FPTM_SU"
3594 "cmp%-%C1%/ %R2,%R3,%0"
3595 [(set_attr "type" "fadd")
3596 (set_attr "trap" "yes")
3597 (set_attr "trap_suffix" "su")])
3599 (define_insn "*cmpdf_ieee_ext2"
3600 [(set (match_operand:DF 0 "register_operand" "=&f")
3601 (match_operator:DF 1 "alpha_fp_comparison_operator"
3602 [(match_operand:DF 2 "reg_or_0_operand" "fG")
3604 (match_operand:SF 3 "reg_or_0_operand" "fG"))]))]
3605 "TARGET_FP && alpha_fptm >= ALPHA_FPTM_SU"
3606 "cmp%-%C1%/ %R2,%R3,%0"
3607 [(set_attr "type" "fadd")
3608 (set_attr "trap" "yes")
3609 (set_attr "trap_suffix" "su")])
3611 (define_insn "*cmpdf_ext2"
3612 [(set (match_operand:DF 0 "register_operand" "=f")
3613 (match_operator:DF 1 "alpha_fp_comparison_operator"
3614 [(match_operand:DF 2 "reg_or_0_operand" "fG")
3616 (match_operand:SF 3 "reg_or_0_operand" "fG"))]))]
3617 "TARGET_FP && alpha_fptm < ALPHA_FPTM_SU"
3618 "cmp%-%C1%/ %R2,%R3,%0"
3619 [(set_attr "type" "fadd")
3620 (set_attr "trap" "yes")
3621 (set_attr "trap_suffix" "su")])
3623 (define_insn "*cmpdf_ieee_ext3"
3624 [(set (match_operand:DF 0 "register_operand" "=&f")
3625 (match_operator:DF 1 "alpha_fp_comparison_operator"
3627 (match_operand:SF 2 "reg_or_0_operand" "fG"))
3629 (match_operand:SF 3 "reg_or_0_operand" "fG"))]))]
3630 "TARGET_FP && alpha_fptm >= ALPHA_FPTM_SU"
3631 "cmp%-%C1%/ %R2,%R3,%0"
3632 [(set_attr "type" "fadd")
3633 (set_attr "trap" "yes")
3634 (set_attr "trap_suffix" "su")])
3636 (define_insn "*cmpdf_ext3"
3637 [(set (match_operand:DF 0 "register_operand" "=f")
3638 (match_operator:DF 1 "alpha_fp_comparison_operator"
3640 (match_operand:SF 2 "reg_or_0_operand" "fG"))
3642 (match_operand:SF 3 "reg_or_0_operand" "fG"))]))]
3643 "TARGET_FP && alpha_fptm < ALPHA_FPTM_SU"
3644 "cmp%-%C1%/ %R2,%R3,%0"
3645 [(set_attr "type" "fadd")
3646 (set_attr "trap" "yes")
3647 (set_attr "trap_suffix" "su")])
3649 (define_insn "*movdfcc_internal"
3650 [(set (match_operand:DF 0 "register_operand" "=f,f")
3652 (match_operator 3 "signed_comparison_operator"
3653 [(match_operand:DF 4 "reg_or_0_operand" "fG,fG")
3654 (match_operand:DF 2 "const0_operand" "G,G")])
3655 (match_operand:DF 1 "reg_or_0_operand" "fG,0")
3656 (match_operand:DF 5 "reg_or_0_operand" "0,fG")))]
3660 fcmov%D3 %R4,%R5,%0"
3661 [(set_attr "type" "fcmov")])
3663 (define_insn "*movsfcc_internal"
3664 [(set (match_operand:SF 0 "register_operand" "=f,f")
3666 (match_operator 3 "signed_comparison_operator"
3667 [(match_operand:DF 4 "reg_or_0_operand" "fG,fG")
3668 (match_operand:DF 2 "const0_operand" "G,G")])
3669 (match_operand:SF 1 "reg_or_0_operand" "fG,0")
3670 (match_operand:SF 5 "reg_or_0_operand" "0,fG")))]
3674 fcmov%D3 %R4,%R5,%0"
3675 [(set_attr "type" "fcmov")])
3677 (define_insn "*movdfcc_ext1"
3678 [(set (match_operand:DF 0 "register_operand" "=f,f")
3680 (match_operator 3 "signed_comparison_operator"
3681 [(match_operand:DF 4 "reg_or_0_operand" "fG,fG")
3682 (match_operand:DF 2 "const0_operand" "G,G")])
3683 (float_extend:DF (match_operand:SF 1 "reg_or_0_operand" "fG,0"))
3684 (match_operand:DF 5 "reg_or_0_operand" "0,fG")))]
3688 fcmov%D3 %R4,%R5,%0"
3689 [(set_attr "type" "fcmov")])
3691 (define_insn "*movdfcc_ext2"
3692 [(set (match_operand:DF 0 "register_operand" "=f,f")
3694 (match_operator 3 "signed_comparison_operator"
3696 (match_operand:SF 4 "reg_or_0_operand" "fG,fG"))
3697 (match_operand:DF 2 "const0_operand" "G,G")])
3698 (match_operand:DF 1 "reg_or_0_operand" "fG,0")
3699 (match_operand:DF 5 "reg_or_0_operand" "0,fG")))]
3703 fcmov%D3 %R4,%R5,%0"
3704 [(set_attr "type" "fcmov")])
3706 (define_insn "*movdfcc_ext3"
3707 [(set (match_operand:SF 0 "register_operand" "=f,f")
3709 (match_operator 3 "signed_comparison_operator"
3711 (match_operand:SF 4 "reg_or_0_operand" "fG,fG"))
3712 (match_operand:DF 2 "const0_operand" "G,G")])
3713 (match_operand:SF 1 "reg_or_0_operand" "fG,0")
3714 (match_operand:SF 5 "reg_or_0_operand" "0,fG")))]
3718 fcmov%D3 %R4,%R5,%0"
3719 [(set_attr "type" "fcmov")])
3721 (define_insn "*movdfcc_ext4"
3722 [(set (match_operand:DF 0 "register_operand" "=f,f")
3724 (match_operator 3 "signed_comparison_operator"
3726 (match_operand:SF 4 "reg_or_0_operand" "fG,fG"))
3727 (match_operand:DF 2 "const0_operand" "G,G")])
3728 (float_extend:DF (match_operand:SF 1 "reg_or_0_operand" "fG,0"))
3729 (match_operand:DF 5 "reg_or_0_operand" "0,fG")))]
3733 fcmov%D3 %R4,%R5,%0"
3734 [(set_attr "type" "fcmov")])
3736 (define_expand "maxdf3"
3738 (le:DF (match_operand:DF 1 "reg_or_0_operand" "")
3739 (match_operand:DF 2 "reg_or_0_operand" "")))
3740 (set (match_operand:DF 0 "register_operand" "")
3741 (if_then_else:DF (eq (match_dup 3) (match_dup 4))
3742 (match_dup 1) (match_dup 2)))]
3745 operands[3] = gen_reg_rtx (DFmode);
3746 operands[4] = CONST0_RTX (DFmode);
3749 (define_expand "mindf3"
3751 (lt:DF (match_operand:DF 1 "reg_or_0_operand" "")
3752 (match_operand:DF 2 "reg_or_0_operand" "")))
3753 (set (match_operand:DF 0 "register_operand" "")
3754 (if_then_else:DF (ne (match_dup 3) (match_dup 4))
3755 (match_dup 1) (match_dup 2)))]
3758 operands[3] = gen_reg_rtx (DFmode);
3759 operands[4] = CONST0_RTX (DFmode);
3762 (define_expand "maxsf3"
3764 (le:DF (float_extend:DF (match_operand:SF 1 "reg_or_0_operand" ""))
3765 (float_extend:DF (match_operand:SF 2 "reg_or_0_operand" ""))))
3766 (set (match_operand:SF 0 "register_operand" "")
3767 (if_then_else:SF (eq (match_dup 3) (match_dup 4))
3768 (match_dup 1) (match_dup 2)))]
3771 operands[3] = gen_reg_rtx (DFmode);
3772 operands[4] = CONST0_RTX (DFmode);
3775 (define_expand "minsf3"
3777 (lt:DF (float_extend:DF (match_operand:SF 1 "reg_or_0_operand" ""))
3778 (float_extend:DF (match_operand:SF 2 "reg_or_0_operand" ""))))
3779 (set (match_operand:SF 0 "register_operand" "")
3780 (if_then_else:SF (ne (match_dup 3) (match_dup 4))
3781 (match_dup 1) (match_dup 2)))]
3784 operands[3] = gen_reg_rtx (DFmode);
3785 operands[4] = CONST0_RTX (DFmode);
3788 (define_insn "*fbcc_normal"
3791 (match_operator 1 "signed_comparison_operator"
3792 [(match_operand:DF 2 "reg_or_0_operand" "fG")
3793 (match_operand:DF 3 "const0_operand" "G")])
3794 (label_ref (match_operand 0 "" ""))
3798 [(set_attr "type" "fbr")])
3800 (define_insn "*fbcc_ext_normal"
3803 (match_operator 1 "signed_comparison_operator"
3805 (match_operand:SF 2 "reg_or_0_operand" "fG"))
3806 (match_operand:DF 3 "const0_operand" "G")])
3807 (label_ref (match_operand 0 "" ""))
3811 [(set_attr "type" "fbr")])
3813 ;; These are the main define_expand's used to make conditional branches
3816 (define_expand "cmpdf"
3817 [(set (cc0) (compare (match_operand:DF 0 "reg_or_0_operand" "")
3818 (match_operand:DF 1 "reg_or_0_operand" "")))]
3821 alpha_compare.op0 = operands[0];
3822 alpha_compare.op1 = operands[1];
3823 alpha_compare.fp_p = 1;
3827 (define_expand "cmptf"
3828 [(set (cc0) (compare (match_operand:TF 0 "general_operand" "")
3829 (match_operand:TF 1 "general_operand" "")))]
3830 "TARGET_HAS_XFLOATING_LIBS"
3832 alpha_compare.op0 = operands[0];
3833 alpha_compare.op1 = operands[1];
3834 alpha_compare.fp_p = 1;
3838 (define_expand "cmpdi"
3839 [(set (cc0) (compare (match_operand:DI 0 "some_operand" "")
3840 (match_operand:DI 1 "some_operand" "")))]
3843 alpha_compare.op0 = operands[0];
3844 alpha_compare.op1 = operands[1];
3845 alpha_compare.fp_p = 0;
3849 (define_expand "beq"
3851 (if_then_else (match_dup 1)
3852 (label_ref (match_operand 0 "" ""))
3855 "{ operands[1] = alpha_emit_conditional_branch (EQ); }")
3857 (define_expand "bne"
3859 (if_then_else (match_dup 1)
3860 (label_ref (match_operand 0 "" ""))
3863 "{ operands[1] = alpha_emit_conditional_branch (NE); }")
3865 (define_expand "blt"
3867 (if_then_else (match_dup 1)
3868 (label_ref (match_operand 0 "" ""))
3871 "{ operands[1] = alpha_emit_conditional_branch (LT); }")
3873 (define_expand "ble"
3875 (if_then_else (match_dup 1)
3876 (label_ref (match_operand 0 "" ""))
3879 "{ operands[1] = alpha_emit_conditional_branch (LE); }")
3881 (define_expand "bgt"
3883 (if_then_else (match_dup 1)
3884 (label_ref (match_operand 0 "" ""))
3887 "{ operands[1] = alpha_emit_conditional_branch (GT); }")
3889 (define_expand "bge"
3891 (if_then_else (match_dup 1)
3892 (label_ref (match_operand 0 "" ""))
3895 "{ operands[1] = alpha_emit_conditional_branch (GE); }")
3897 (define_expand "bltu"
3899 (if_then_else (match_dup 1)
3900 (label_ref (match_operand 0 "" ""))
3903 "{ operands[1] = alpha_emit_conditional_branch (LTU); }")
3905 (define_expand "bleu"
3907 (if_then_else (match_dup 1)
3908 (label_ref (match_operand 0 "" ""))
3911 "{ operands[1] = alpha_emit_conditional_branch (LEU); }")
3913 (define_expand "bgtu"
3915 (if_then_else (match_dup 1)
3916 (label_ref (match_operand 0 "" ""))
3919 "{ operands[1] = alpha_emit_conditional_branch (GTU); }")
3921 (define_expand "bgeu"
3923 (if_then_else (match_dup 1)
3924 (label_ref (match_operand 0 "" ""))
3927 "{ operands[1] = alpha_emit_conditional_branch (GEU); }")
3929 (define_expand "bunordered"
3931 (if_then_else (match_dup 1)
3932 (label_ref (match_operand 0 "" ""))
3935 "{ operands[1] = alpha_emit_conditional_branch (UNORDERED); }")
3937 (define_expand "bordered"
3939 (if_then_else (match_dup 1)
3940 (label_ref (match_operand 0 "" ""))
3943 "{ operands[1] = alpha_emit_conditional_branch (ORDERED); }")
3945 (define_expand "seq"
3946 [(set (match_operand:DI 0 "register_operand" "")
3949 "{ if ((operands[1] = alpha_emit_setcc (EQ)) == NULL_RTX) FAIL; }")
3951 (define_expand "sne"
3952 [(set (match_operand:DI 0 "register_operand" "")
3955 "{ if ((operands[1] = alpha_emit_setcc (NE)) == NULL_RTX) FAIL; }")
3957 (define_expand "slt"
3958 [(set (match_operand:DI 0 "register_operand" "")
3961 "{ if ((operands[1] = alpha_emit_setcc (LT)) == NULL_RTX) FAIL; }")
3963 (define_expand "sle"
3964 [(set (match_operand:DI 0 "register_operand" "")
3967 "{ if ((operands[1] = alpha_emit_setcc (LE)) == NULL_RTX) FAIL; }")
3969 (define_expand "sgt"
3970 [(set (match_operand:DI 0 "register_operand" "")
3973 "{ if ((operands[1] = alpha_emit_setcc (GT)) == NULL_RTX) FAIL; }")
3975 (define_expand "sge"
3976 [(set (match_operand:DI 0 "register_operand" "")
3979 "{ if ((operands[1] = alpha_emit_setcc (GE)) == NULL_RTX) FAIL; }")
3981 (define_expand "sltu"
3982 [(set (match_operand:DI 0 "register_operand" "")
3985 "{ if ((operands[1] = alpha_emit_setcc (LTU)) == NULL_RTX) FAIL; }")
3987 (define_expand "sleu"
3988 [(set (match_operand:DI 0 "register_operand" "")
3991 "{ if ((operands[1] = alpha_emit_setcc (LEU)) == NULL_RTX) FAIL; }")
3993 (define_expand "sgtu"
3994 [(set (match_operand:DI 0 "register_operand" "")
3997 "{ if ((operands[1] = alpha_emit_setcc (GTU)) == NULL_RTX) FAIL; }")
3999 (define_expand "sgeu"
4000 [(set (match_operand:DI 0 "register_operand" "")
4003 "{ if ((operands[1] = alpha_emit_setcc (GEU)) == NULL_RTX) FAIL; }")
4005 (define_expand "sunordered"
4006 [(set (match_operand:DI 0 "register_operand" "")
4009 "{ if ((operands[1] = alpha_emit_setcc (UNORDERED)) == NULL_RTX) FAIL; }")
4011 (define_expand "sordered"
4012 [(set (match_operand:DI 0 "register_operand" "")
4015 "{ if ((operands[1] = alpha_emit_setcc (ORDERED)) == NULL_RTX) FAIL; }")
4017 ;; These are the main define_expand's used to make conditional moves.
4019 (define_expand "movsicc"
4020 [(set (match_operand:SI 0 "register_operand" "")
4021 (if_then_else:SI (match_operand 1 "comparison_operator" "")
4022 (match_operand:SI 2 "reg_or_8bit_operand" "")
4023 (match_operand:SI 3 "reg_or_8bit_operand" "")))]
4026 if ((operands[1] = alpha_emit_conditional_move (operands[1], SImode)) == 0)
4030 (define_expand "movdicc"
4031 [(set (match_operand:DI 0 "register_operand" "")
4032 (if_then_else:DI (match_operand 1 "comparison_operator" "")
4033 (match_operand:DI 2 "reg_or_8bit_operand" "")
4034 (match_operand:DI 3 "reg_or_8bit_operand" "")))]
4037 if ((operands[1] = alpha_emit_conditional_move (operands[1], DImode)) == 0)
4041 (define_expand "movsfcc"
4042 [(set (match_operand:SF 0 "register_operand" "")
4043 (if_then_else:SF (match_operand 1 "comparison_operator" "")
4044 (match_operand:SF 2 "reg_or_8bit_operand" "")
4045 (match_operand:SF 3 "reg_or_8bit_operand" "")))]
4048 if ((operands[1] = alpha_emit_conditional_move (operands[1], SFmode)) == 0)
4052 (define_expand "movdfcc"
4053 [(set (match_operand:DF 0 "register_operand" "")
4054 (if_then_else:DF (match_operand 1 "comparison_operator" "")
4055 (match_operand:DF 2 "reg_or_8bit_operand" "")
4056 (match_operand:DF 3 "reg_or_8bit_operand" "")))]
4059 if ((operands[1] = alpha_emit_conditional_move (operands[1], DFmode)) == 0)
4063 ;; These define_split definitions are used in cases when comparisons have
4064 ;; not be stated in the correct way and we need to reverse the second
4065 ;; comparison. For example, x >= 7 has to be done as x < 6 with the
4066 ;; comparison that tests the result being reversed. We have one define_split
4067 ;; for each use of a comparison. They do not match valid insns and need
4068 ;; not generate valid insns.
4070 ;; We can also handle equality comparisons (and inequality comparisons in
4071 ;; cases where the resulting add cannot overflow) by doing an add followed by
4072 ;; a comparison with zero. This is faster since the addition takes one
4073 ;; less cycle than a compare when feeding into a conditional move.
4074 ;; For this case, we also have an SImode pattern since we can merge the add
4075 ;; and sign extend and the order doesn't matter.
4077 ;; We do not do this for floating-point, since it isn't clear how the "wrong"
4078 ;; operation could have been generated.
4081 [(set (match_operand:DI 0 "register_operand" "")
4083 (match_operator 1 "comparison_operator"
4084 [(match_operand:DI 2 "reg_or_0_operand" "")
4085 (match_operand:DI 3 "reg_or_cint_operand" "")])
4086 (match_operand:DI 4 "reg_or_cint_operand" "")
4087 (match_operand:DI 5 "reg_or_cint_operand" "")))
4088 (clobber (match_operand:DI 6 "register_operand" ""))]
4089 "operands[3] != const0_rtx"
4090 [(set (match_dup 6) (match_dup 7))
4092 (if_then_else:DI (match_dup 8) (match_dup 4) (match_dup 5)))]
4094 enum rtx_code code = GET_CODE (operands[1]);
4095 int unsignedp = (code == GEU || code == LEU || code == GTU || code == LTU);
4097 /* If we are comparing for equality with a constant and that constant
4098 appears in the arm when the register equals the constant, use the
4099 register since that is more likely to match (and to produce better code
4102 if (code == EQ && GET_CODE (operands[3]) == CONST_INT
4103 && rtx_equal_p (operands[4], operands[3]))
4104 operands[4] = operands[2];
4106 else if (code == NE && GET_CODE (operands[3]) == CONST_INT
4107 && rtx_equal_p (operands[5], operands[3]))
4108 operands[5] = operands[2];
4110 if (code == NE || code == EQ
4111 || (extended_count (operands[2], DImode, unsignedp) >= 1
4112 && extended_count (operands[3], DImode, unsignedp) >= 1))
4114 if (GET_CODE (operands[3]) == CONST_INT)
4115 operands[7] = gen_rtx_PLUS (DImode, operands[2],
4116 GEN_INT (- INTVAL (operands[3])));
4118 operands[7] = gen_rtx_MINUS (DImode, operands[2], operands[3]);
4120 operands[8] = gen_rtx_fmt_ee (code, VOIDmode, operands[6], const0_rtx);
4123 else if (code == EQ || code == LE || code == LT
4124 || code == LEU || code == LTU)
4126 operands[7] = gen_rtx_fmt_ee (code, DImode, operands[2], operands[3]);
4127 operands[8] = gen_rtx_NE (VOIDmode, operands[6], const0_rtx);
4131 operands[7] = gen_rtx_fmt_ee (reverse_condition (code), DImode,
4132 operands[2], operands[3]);
4133 operands[8] = gen_rtx_EQ (VOIDmode, operands[6], const0_rtx);
4138 [(set (match_operand:DI 0 "register_operand" "")
4140 (match_operator 1 "comparison_operator"
4141 [(match_operand:SI 2 "reg_or_0_operand" "")
4142 (match_operand:SI 3 "reg_or_cint_operand" "")])
4143 (match_operand:DI 4 "reg_or_8bit_operand" "")
4144 (match_operand:DI 5 "reg_or_8bit_operand" "")))
4145 (clobber (match_operand:DI 6 "register_operand" ""))]
4146 "operands[3] != const0_rtx
4147 && (GET_CODE (operands[1]) == EQ || GET_CODE (operands[1]) == NE)"
4148 [(set (match_dup 6) (match_dup 7))
4150 (if_then_else:DI (match_dup 8) (match_dup 4) (match_dup 5)))]
4152 enum rtx_code code = GET_CODE (operands[1]);
4153 int unsignedp = (code == GEU || code == LEU || code == GTU || code == LTU);
4156 if ((code != NE && code != EQ
4157 && ! (extended_count (operands[2], DImode, unsignedp) >= 1
4158 && extended_count (operands[3], DImode, unsignedp) >= 1)))
4161 if (GET_CODE (operands[3]) == CONST_INT)
4162 tem = gen_rtx_PLUS (SImode, operands[2],
4163 GEN_INT (- INTVAL (operands[3])));
4165 tem = gen_rtx_MINUS (SImode, operands[2], operands[3]);
4167 operands[7] = gen_rtx_SIGN_EXTEND (DImode, tem);
4168 operands[8] = gen_rtx_fmt_ee (GET_CODE (operands[1]), VOIDmode,
4169 operands[6], const0_rtx);
4172 ;; Prefer to use cmp and arithmetic when possible instead of a cmove.
4175 [(set (match_operand 0 "register_operand" "")
4176 (if_then_else (match_operator 1 "signed_comparison_operator"
4177 [(match_operand:DI 2 "reg_or_0_operand" "")
4179 (match_operand 3 "const_int_operand" "")
4180 (match_operand 4 "const_int_operand" "")))]
4184 if (alpha_split_conditional_move (GET_CODE (operands[1]), operands[0],
4185 operands[2], operands[3], operands[4]))
4191 ;; ??? Why combine is allowed to create such non-canonical rtl, I don't know.
4192 ;; Oh well, we match it in movcc, so it must be partially our fault.
4194 [(set (match_operand 0 "register_operand" "")
4195 (if_then_else (match_operator 1 "signed_comparison_operator"
4197 (match_operand:DI 2 "reg_or_0_operand" "")])
4198 (match_operand 3 "const_int_operand" "")
4199 (match_operand 4 "const_int_operand" "")))]
4203 if (alpha_split_conditional_move (swap_condition (GET_CODE (operands[1])),
4204 operands[0], operands[2], operands[3],
4211 (define_insn_and_split "*cmp_sadd_di"
4212 [(set (match_operand:DI 0 "register_operand" "=r")
4213 (plus:DI (if_then_else:DI
4214 (match_operator 1 "alpha_zero_comparison_operator"
4215 [(match_operand:DI 2 "reg_or_0_operand" "rJ")
4217 (match_operand:DI 3 "const48_operand" "I")
4219 (match_operand:DI 4 "sext_add_operand" "rIO")))
4220 (clobber (match_scratch:DI 5 "=r"))]
4223 "! no_new_pseudos || reload_completed"
4225 (match_op_dup:DI 1 [(match_dup 2) (const_int 0)]))
4227 (plus:DI (mult:DI (match_dup 5) (match_dup 3))
4230 if (! no_new_pseudos)
4231 operands[5] = gen_reg_rtx (DImode);
4232 else if (reg_overlap_mentioned_p (operands[5], operands[4]))
4233 operands[5] = operands[0];
4236 (define_insn_and_split "*cmp_sadd_si"
4237 [(set (match_operand:SI 0 "register_operand" "=r")
4238 (plus:SI (if_then_else:SI
4239 (match_operator 1 "alpha_zero_comparison_operator"
4240 [(match_operand:DI 2 "reg_or_0_operand" "rJ")
4242 (match_operand:SI 3 "const48_operand" "I")
4244 (match_operand:SI 4 "sext_add_operand" "rIO")))
4245 (clobber (match_scratch:SI 5 "=r"))]
4248 "! no_new_pseudos || reload_completed"
4250 (match_op_dup:SI 1 [(match_dup 2) (const_int 0)]))
4252 (plus:SI (mult:SI (match_dup 5) (match_dup 3))
4255 if (! no_new_pseudos)
4256 operands[5] = gen_reg_rtx (DImode);
4257 else if (reg_overlap_mentioned_p (operands[5], operands[4]))
4258 operands[5] = operands[0];
4261 (define_insn_and_split "*cmp_sadd_sidi"
4262 [(set (match_operand:DI 0 "register_operand" "=r")
4264 (plus:SI (if_then_else:SI
4265 (match_operator 1 "alpha_zero_comparison_operator"
4266 [(match_operand:DI 2 "reg_or_0_operand" "rJ")
4268 (match_operand:SI 3 "const48_operand" "I")
4270 (match_operand:SI 4 "sext_add_operand" "rIO"))))
4271 (clobber (match_scratch:SI 5 "=r"))]
4274 "! no_new_pseudos || reload_completed"
4276 (match_op_dup:SI 1 [(match_dup 2) (const_int 0)]))
4278 (sign_extend:DI (plus:SI (mult:SI (match_dup 5) (match_dup 3))
4281 if (! no_new_pseudos)
4282 operands[5] = gen_reg_rtx (DImode);
4283 else if (reg_overlap_mentioned_p (operands[5], operands[4]))
4284 operands[5] = operands[0];
4287 (define_insn_and_split "*cmp_ssub_di"
4288 [(set (match_operand:DI 0 "register_operand" "=r")
4289 (minus:DI (if_then_else:DI
4290 (match_operator 1 "alpha_zero_comparison_operator"
4291 [(match_operand:DI 2 "reg_or_0_operand" "rJ")
4293 (match_operand:DI 3 "const48_operand" "I")
4295 (match_operand:DI 4 "reg_or_8bit_operand" "rI")))
4296 (clobber (match_scratch:DI 5 "=r"))]
4299 "! no_new_pseudos || reload_completed"
4301 (match_op_dup:DI 1 [(match_dup 2) (const_int 0)]))
4303 (minus:DI (mult:DI (match_dup 5) (match_dup 3))
4306 if (! no_new_pseudos)
4307 operands[5] = gen_reg_rtx (DImode);
4308 else if (reg_overlap_mentioned_p (operands[5], operands[4]))
4309 operands[5] = operands[0];
4312 (define_insn_and_split "*cmp_ssub_si"
4313 [(set (match_operand:SI 0 "register_operand" "=r")
4314 (minus:SI (if_then_else:SI
4315 (match_operator 1 "alpha_zero_comparison_operator"
4316 [(match_operand:DI 2 "reg_or_0_operand" "rJ")
4318 (match_operand:SI 3 "const48_operand" "I")
4320 (match_operand:SI 4 "reg_or_8bit_operand" "rI")))
4321 (clobber (match_scratch:SI 5 "=r"))]
4324 "! no_new_pseudos || reload_completed"
4326 (match_op_dup:SI 1 [(match_dup 2) (const_int 0)]))
4328 (minus:SI (mult:SI (match_dup 5) (match_dup 3))
4331 if (! no_new_pseudos)
4332 operands[5] = gen_reg_rtx (DImode);
4333 else if (reg_overlap_mentioned_p (operands[5], operands[4]))
4334 operands[5] = operands[0];
4337 (define_insn_and_split "*cmp_ssub_sidi"
4338 [(set (match_operand:DI 0 "register_operand" "=r")
4340 (minus:SI (if_then_else:SI
4341 (match_operator 1 "alpha_zero_comparison_operator"
4342 [(match_operand:DI 2 "reg_or_0_operand" "rJ")
4344 (match_operand:SI 3 "const48_operand" "I")
4346 (match_operand:SI 4 "reg_or_8bit_operand" "rI"))))
4347 (clobber (match_scratch:SI 5 "=r"))]
4350 "! no_new_pseudos || reload_completed"
4352 (match_op_dup:SI 1 [(match_dup 2) (const_int 0)]))
4354 (sign_extend:DI (minus:SI (mult:SI (match_dup 5) (match_dup 3))
4357 if (! no_new_pseudos)
4358 operands[5] = gen_reg_rtx (DImode);
4359 else if (reg_overlap_mentioned_p (operands[5], operands[4]))
4360 operands[5] = operands[0];
4363 ;; Here are the CALL and unconditional branch insns. Calls on NT and OSF
4364 ;; work differently, so we have different patterns for each.
4366 ;; On Unicos/Mk a call information word (CIW) must be generated for each
4367 ;; call. The CIW contains information about arguments passed in registers
4368 ;; and is stored in the caller's SSIB. Its offset relative to the beginning
4369 ;; of the SSIB is passed in $25. Handling this properly is quite complicated
4370 ;; in the presence of inlining since the CIWs for calls performed by the
4371 ;; inlined function must be stored in the SSIB of the function it is inlined
4372 ;; into as well. We encode the CIW in an unspec and append it to the list
4373 ;; of the CIWs for the current function only when the instruction for loading
4374 ;; $25 is generated.
4376 (define_expand "call"
4377 [(use (match_operand:DI 0 "" ""))
4378 (use (match_operand 1 "" ""))
4379 (use (match_operand 2 "" ""))
4380 (use (match_operand 3 "" ""))]
4383 if (TARGET_ABI_WINDOWS_NT)
4384 emit_call_insn (gen_call_nt (operands[0], operands[1]));
4385 else if (TARGET_ABI_OPEN_VMS)
4386 emit_call_insn (gen_call_vms (operands[0], operands[2]));
4387 else if (TARGET_ABI_UNICOSMK)
4388 emit_call_insn (gen_call_umk (operands[0], operands[2]));
4390 emit_call_insn (gen_call_osf (operands[0], operands[1]));
4394 (define_expand "sibcall"
4395 [(parallel [(call (mem:DI (match_operand 0 "" ""))
4396 (match_operand 1 "" ""))
4397 (unspec [(reg:DI 29)] UNSPEC_SIBCALL)])]
4400 if (GET_CODE (operands[0]) != MEM)
4402 operands[0] = XEXP (operands[0], 0);
4405 (define_expand "call_osf"
4406 [(parallel [(call (mem:DI (match_operand 0 "" ""))
4407 (match_operand 1 "" ""))
4409 (clobber (reg:DI 26))])]
4412 if (GET_CODE (operands[0]) != MEM)
4415 operands[0] = XEXP (operands[0], 0);
4416 if (! call_operand (operands[0], Pmode))
4417 operands[0] = copy_to_mode_reg (Pmode, operands[0]);
4420 (define_expand "call_nt"
4421 [(parallel [(call (mem:DI (match_operand 0 "" ""))
4422 (match_operand 1 "" ""))
4423 (clobber (reg:DI 26))])]
4426 if (GET_CODE (operands[0]) != MEM)
4429 operands[0] = XEXP (operands[0], 0);
4430 if (GET_CODE (operands[0]) != SYMBOL_REF && GET_CODE (operands[0]) != REG)
4431 operands[0] = force_reg (DImode, operands[0]);
4434 ;; Calls on Unicos/Mk are always indirect.
4435 ;; op 0: symbol ref for called function
4436 ;; op 1: CIW for $25 represented by an unspec
4438 (define_expand "call_umk"
4439 [(parallel [(call (mem:DI (match_operand 0 "" ""))
4440 (match_operand 1 "" ""))
4442 (clobber (reg:DI 26))])]
4445 if (GET_CODE (operands[0]) != MEM)
4448 /* Always load the address of the called function into a register;
4449 load the CIW in $25. */
4451 operands[0] = XEXP (operands[0], 0);
4452 if (GET_CODE (operands[0]) != REG)
4453 operands[0] = force_reg (DImode, operands[0]);
4455 emit_move_insn (gen_rtx_REG (DImode, 25), operands[1]);
4459 ;; call openvms/alpha
4460 ;; op 0: symbol ref for called function
4461 ;; op 1: next_arg_reg (argument information value for R25)
4463 (define_expand "call_vms"
4464 [(parallel [(call (mem:DI (match_operand 0 "" ""))
4465 (match_operand 1 "" ""))
4469 (clobber (reg:DI 27))])]
4472 if (GET_CODE (operands[0]) != MEM)
4475 operands[0] = XEXP (operands[0], 0);
4477 /* Always load AI with argument information, then handle symbolic and
4478 indirect call differently. Load RA and set operands[2] to PV in
4481 emit_move_insn (gen_rtx_REG (DImode, 25), operands[1]);
4482 if (GET_CODE (operands[0]) == SYMBOL_REF)
4484 alpha_need_linkage (XSTR (operands[0], 0), 0);
4486 operands[2] = const0_rtx;
4490 emit_move_insn (gen_rtx_REG (Pmode, 26),
4491 gen_rtx_MEM (Pmode, plus_constant (operands[0], 8)));
4492 operands[2] = operands[0];
4497 (define_expand "call_value"
4498 [(use (match_operand 0 "" ""))
4499 (use (match_operand:DI 1 "" ""))
4500 (use (match_operand 2 "" ""))
4501 (use (match_operand 3 "" ""))
4502 (use (match_operand 4 "" ""))]
4505 if (TARGET_ABI_WINDOWS_NT)
4506 emit_call_insn (gen_call_value_nt (operands[0], operands[1], operands[2]));
4507 else if (TARGET_ABI_OPEN_VMS)
4508 emit_call_insn (gen_call_value_vms (operands[0], operands[1],
4510 else if (TARGET_ABI_UNICOSMK)
4511 emit_call_insn (gen_call_value_umk (operands[0], operands[1],
4514 emit_call_insn (gen_call_value_osf (operands[0], operands[1],
4519 (define_expand "sibcall_value"
4520 [(parallel [(set (match_operand 0 "" "")
4521 (call (mem:DI (match_operand 1 "" ""))
4522 (match_operand 2 "" "")))
4523 (unspec [(reg:DI 29)] UNSPEC_SIBCALL)])]
4526 if (GET_CODE (operands[1]) != MEM)
4528 operands[1] = XEXP (operands[1], 0);
4531 (define_expand "call_value_osf"
4532 [(parallel [(set (match_operand 0 "" "")
4533 (call (mem:DI (match_operand 1 "" ""))
4534 (match_operand 2 "" "")))
4536 (clobber (reg:DI 26))])]
4539 if (GET_CODE (operands[1]) != MEM)
4542 operands[1] = XEXP (operands[1], 0);
4543 if (! call_operand (operands[1], Pmode))
4544 operands[1] = copy_to_mode_reg (Pmode, operands[1]);
4547 (define_expand "call_value_nt"
4548 [(parallel [(set (match_operand 0 "" "")
4549 (call (mem:DI (match_operand 1 "" ""))
4550 (match_operand 2 "" "")))
4551 (clobber (reg:DI 26))])]
4554 if (GET_CODE (operands[1]) != MEM)
4557 operands[1] = XEXP (operands[1], 0);
4558 if (GET_CODE (operands[1]) != SYMBOL_REF && GET_CODE (operands[1]) != REG)
4559 operands[1] = force_reg (DImode, operands[1]);
4562 (define_expand "call_value_vms"
4563 [(parallel [(set (match_operand 0 "" "")
4564 (call (mem:DI (match_operand:DI 1 "" ""))
4565 (match_operand 2 "" "")))
4569 (clobber (reg:DI 27))])]
4572 if (GET_CODE (operands[1]) != MEM)
4575 operands[1] = XEXP (operands[1], 0);
4577 /* Always load AI with argument information, then handle symbolic and
4578 indirect call differently. Load RA and set operands[3] to PV in
4581 emit_move_insn (gen_rtx_REG (DImode, 25), operands[2]);
4582 if (GET_CODE (operands[1]) == SYMBOL_REF)
4584 alpha_need_linkage (XSTR (operands[1], 0), 0);
4586 operands[3] = const0_rtx;
4590 emit_move_insn (gen_rtx_REG (Pmode, 26),
4591 gen_rtx_MEM (Pmode, plus_constant (operands[1], 8)));
4592 operands[3] = operands[1];
4596 (define_expand "call_value_umk"
4597 [(parallel [(set (match_operand 0 "" "")
4598 (call (mem:DI (match_operand 1 "" ""))
4599 (match_operand 2 "" "")))
4601 (clobber (reg:DI 26))])]
4604 if (GET_CODE (operands[1]) != MEM)
4607 operands[1] = XEXP (operands[1], 0);
4608 if (GET_CODE (operands[1]) != REG)
4609 operands[1] = force_reg (DImode, operands[1]);
4611 emit_move_insn (gen_rtx_REG (DImode, 25), operands[2]);
4614 (define_insn "*call_osf_1_er"
4615 [(call (mem:DI (match_operand:DI 0 "call_operand" "c,R,s"))
4616 (match_operand 1 "" ""))
4618 (clobber (reg:DI 26))]
4619 "TARGET_EXPLICIT_RELOCS && TARGET_ABI_OSF"
4621 jsr $26,(%0),0\;ldah $29,0($26)\t\t!gpdisp!%*\;lda $29,0($29)\t\t!gpdisp!%*
4622 bsr $26,%0\t\t!samegp
4623 ldq $27,%0($29)\t\t!literal!%#\;jsr $26,($27),%0\t\t!lituse_jsr!%#\;ldah $29,0($26)\t\t!gpdisp!%*\;lda $29,0($29)\t\t!gpdisp!%*"
4624 [(set_attr "type" "jsr")
4625 (set_attr "length" "12,*,16")])
4627 ;; We must use peep2 instead of a split because we need accurate life
4628 ;; information for $gp. Consider the case of { bar(); while (1); }.
4630 [(parallel [(call (mem:DI (match_operand:DI 0 "call_operand" ""))
4631 (match_operand 1 "" ""))
4633 (clobber (reg:DI 26))])]
4634 "TARGET_EXPLICIT_RELOCS && TARGET_ABI_OSF && reload_completed
4635 && ! samegp_function_operand (operands[0], Pmode)
4636 && (peep2_regno_dead_p (1, 29)
4637 || find_reg_note (insn, REG_NORETURN, NULL_RTX))"
4638 [(parallel [(call (mem:DI (match_dup 2))
4640 (set (reg:DI 26) (plus:DI (pc) (const_int 4)))
4641 (unspec_volatile [(reg:DI 29)] UNSPECV_BLOCKAGE)
4643 (use (match_dup 3))])]
4645 if (CONSTANT_P (operands[0]))
4647 operands[2] = gen_rtx_REG (Pmode, 27);
4648 operands[3] = GEN_INT (alpha_next_sequence_number++);
4649 emit_insn (gen_movdi_er_high_g (operands[2], pic_offset_table_rtx,
4650 operands[0], operands[3]));
4654 operands[2] = operands[0];
4655 operands[0] = const0_rtx;
4656 operands[3] = const0_rtx;
4661 [(parallel [(call (mem:DI (match_operand:DI 0 "call_operand" ""))
4662 (match_operand 1 "" ""))
4664 (clobber (reg:DI 26))])]
4665 "TARGET_EXPLICIT_RELOCS && TARGET_ABI_OSF && reload_completed
4666 && ! samegp_function_operand (operands[0], Pmode)
4667 && ! (peep2_regno_dead_p (1, 29)
4668 || find_reg_note (insn, REG_NORETURN, NULL_RTX))"
4669 [(parallel [(call (mem:DI (match_dup 2))
4671 (set (reg:DI 26) (plus:DI (pc) (const_int 4)))
4672 (unspec_volatile [(reg:DI 29)] UNSPECV_BLOCKAGE)
4674 (use (match_dup 4))])
4676 (unspec_volatile:DI [(reg:DI 26) (match_dup 3)] UNSPECV_LDGP1))
4678 (unspec:DI [(reg:DI 29) (match_dup 3)] UNSPEC_LDGP2))]
4680 if (CONSTANT_P (operands[0]))
4682 operands[2] = gen_rtx_REG (Pmode, 27);
4683 operands[4] = GEN_INT (alpha_next_sequence_number++);
4684 emit_insn (gen_movdi_er_high_g (operands[2], pic_offset_table_rtx,
4685 operands[0], operands[4]));
4689 operands[2] = operands[0];
4690 operands[0] = const0_rtx;
4691 operands[4] = const0_rtx;
4693 operands[3] = GEN_INT (alpha_next_sequence_number++);
4696 ;; We add a blockage unspec_volatile to prevent insns from moving down
4697 ;; from above the call to in between the call and the ldah gpdisp.
4699 (define_insn "*call_osf_2_er"
4700 [(call (mem:DI (match_operand:DI 0 "register_operand" "c"))
4701 (match_operand 1 "" ""))
4702 (set (reg:DI 26) (plus:DI (pc) (const_int 4)))
4703 (unspec_volatile [(reg:DI 29)] UNSPECV_BLOCKAGE)
4704 (use (match_operand 2 "" ""))
4705 (use (match_operand 3 "const_int_operand" ""))]
4706 "TARGET_EXPLICIT_RELOCS && TARGET_ABI_OSF"
4707 "jsr $26,(%0),%2%J3"
4708 [(set_attr "type" "jsr")
4709 (set_attr "cannot_copy" "true")])
4711 ;; We output a nop after noreturn calls at the very end of the function to
4712 ;; ensure that the return address always remains in the caller's code range,
4713 ;; as not doing so might confuse unwinding engines.
4715 ;; The potential change in insn length is not reflected in the length
4716 ;; attributes at this stage. Since the extra space is only actually added at
4717 ;; the very end of the compilation process (via final/print_operand), it
4718 ;; really seems harmless and not worth the trouble of some extra computation
4719 ;; cost and complexity.
4721 (define_insn "*call_osf_1_noreturn"
4722 [(call (mem:DI (match_operand:DI 0 "call_operand" "c,R,s"))
4723 (match_operand 1 "" ""))
4725 (clobber (reg:DI 26))]
4726 "! TARGET_EXPLICIT_RELOCS && TARGET_ABI_OSF
4727 && find_reg_note (insn, REG_NORETURN, NULL_RTX)"
4732 [(set_attr "type" "jsr")
4733 (set_attr "length" "*,*,8")])
4735 (define_insn "*call_osf_1"
4736 [(call (mem:DI (match_operand:DI 0 "call_operand" "c,R,s"))
4737 (match_operand 1 "" ""))
4739 (clobber (reg:DI 26))]
4740 "! TARGET_EXPLICIT_RELOCS && TARGET_ABI_OSF"
4742 jsr $26,($27),0\;ldgp $29,0($26)
4744 jsr $26,%0\;ldgp $29,0($26)"
4745 [(set_attr "type" "jsr")
4746 (set_attr "length" "12,*,16")])
4748 ;; Note that the DEC assembler expands "jmp foo" with $at, which
4749 ;; doesn't do what we want.
4750 (define_insn "*sibcall_osf_1_er"
4751 [(call (mem:DI (match_operand:DI 0 "symbolic_operand" "R,s"))
4752 (match_operand 1 "" ""))
4753 (unspec [(reg:DI 29)] UNSPEC_SIBCALL)]
4754 "TARGET_EXPLICIT_RELOCS && TARGET_ABI_OSF"
4756 br $31,%0\t\t!samegp
4757 ldq $27,%0($29)\t\t!literal!%#\;jmp $31,($27),%0\t\t!lituse_jsr!%#"
4758 [(set_attr "type" "jsr")
4759 (set_attr "length" "*,8")])
4761 (define_insn "*sibcall_osf_1"
4762 [(call (mem:DI (match_operand:DI 0 "symbolic_operand" "R,s"))
4763 (match_operand 1 "" ""))
4764 (unspec [(reg:DI 29)] UNSPEC_SIBCALL)]
4765 "! TARGET_EXPLICIT_RELOCS && TARGET_ABI_OSF"
4768 lda $27,%0\;jmp $31,($27),%0"
4769 [(set_attr "type" "jsr")
4770 (set_attr "length" "*,8")])
4772 (define_insn "*call_nt_1"
4773 [(call (mem:DI (match_operand:DI 0 "call_operand" "r,R,s"))
4774 (match_operand 1 "" ""))
4775 (clobber (reg:DI 26))]
4776 "TARGET_ABI_WINDOWS_NT"
4781 [(set_attr "type" "jsr")
4782 (set_attr "length" "*,*,12")])
4784 ; GAS relies on the order and position of instructions output below in order
4785 ; to generate relocs for VMS link to potentially optimize the call.
4786 ; Please do not molest.
4787 (define_insn "*call_vms_1"
4788 [(call (mem:DI (match_operand:DI 0 "call_operand" "r,s"))
4789 (match_operand 1 "" ""))
4790 (use (match_operand:DI 2 "nonmemory_operand" "r,n"))
4793 (clobber (reg:DI 27))]
4794 "TARGET_ABI_OPEN_VMS"
4796 switch (which_alternative)
4799 return "mov %2,$27\;jsr $26,0\;ldq $27,0($29)";
4801 operands [2] = alpha_use_linkage (operands [0], cfun->decl, 1, 0);
4802 operands [3] = alpha_use_linkage (operands [0], cfun->decl, 0, 0);
4803 return "ldq $26,%3\;ldq $27,%2\;jsr $26,%0\;ldq $27,0($29)";
4808 [(set_attr "type" "jsr")
4809 (set_attr "length" "12,16")])
4811 (define_insn "*call_umk_1"
4812 [(call (mem:DI (match_operand:DI 0 "call_operand" "r"))
4813 (match_operand 1 "" ""))
4815 (clobber (reg:DI 26))]
4816 "TARGET_ABI_UNICOSMK"
4818 [(set_attr "type" "jsr")])
4820 ;; Call subroutine returning any type.
4822 (define_expand "untyped_call"
4823 [(parallel [(call (match_operand 0 "" "")
4825 (match_operand 1 "" "")
4826 (match_operand 2 "" "")])]
4831 emit_call_insn (GEN_CALL (operands[0], const0_rtx, NULL, const0_rtx));
4833 for (i = 0; i < XVECLEN (operands[2], 0); i++)
4835 rtx set = XVECEXP (operands[2], 0, i);
4836 emit_move_insn (SET_DEST (set), SET_SRC (set));
4839 /* The optimizer does not know that the call sets the function value
4840 registers we stored in the result block. We avoid problems by
4841 claiming that all hard registers are used and clobbered at this
4843 emit_insn (gen_blockage ());
4848 ;; UNSPEC_VOLATILE is considered to use and clobber all hard registers and
4849 ;; all of memory. This blocks insns from being moved across this point.
4851 (define_insn "blockage"
4852 [(unspec_volatile [(const_int 0)] UNSPECV_BLOCKAGE)]
4855 [(set_attr "length" "0")
4856 (set_attr "type" "none")])
4860 (label_ref (match_operand 0 "" "")))]
4863 [(set_attr "type" "ibr")])
4865 (define_expand "return"
4870 (define_insn "*return_internal"
4874 [(set_attr "type" "ibr")])
4876 (define_insn "indirect_jump"
4877 [(set (pc) (match_operand:DI 0 "register_operand" "r"))]
4880 [(set_attr "type" "ibr")])
4882 (define_expand "tablejump"
4883 [(parallel [(set (pc)
4884 (match_operand 0 "register_operand" ""))
4885 (use (label_ref:DI (match_operand 1 "" "")))])]
4888 if (TARGET_ABI_WINDOWS_NT)
4890 rtx dest = gen_reg_rtx (DImode);
4891 emit_insn (gen_extendsidi2 (dest, operands[0]));
4894 else if (TARGET_ABI_OSF)
4896 rtx dest = gen_reg_rtx (DImode);
4897 emit_insn (gen_extendsidi2 (dest, operands[0]));
4898 emit_insn (gen_adddi3 (dest, pic_offset_table_rtx, dest));
4903 (define_insn "*tablejump_osf_nt_internal"
4905 (match_operand:DI 0 "register_operand" "r"))
4906 (use (label_ref:DI (match_operand 1 "" "")))]
4907 "(TARGET_ABI_OSF || TARGET_ABI_WINDOWS_NT)
4908 && alpha_tablejump_addr_vec (insn)"
4910 operands[2] = alpha_tablejump_best_label (insn);
4911 return "jmp $31,(%0),%2";
4913 [(set_attr "type" "ibr")])
4915 (define_insn "*tablejump_internal"
4917 (match_operand:DI 0 "register_operand" "r"))
4918 (use (label_ref (match_operand 1 "" "")))]
4921 [(set_attr "type" "ibr")])
4923 ;; Cache flush. Used by INITIALIZE_TRAMPOLINE. 0x86 is PAL_imb, but we don't
4924 ;; want to have to include pal.h in our .s file.
4926 ;; Technically the type for call_pal is jsr, but we use that for determining
4927 ;; if we need a GP. Use ibr instead since it has the same EV5 scheduling
4930 [(unspec_volatile [(const_int 0)] UNSPECV_IMB)]
4933 [(set_attr "type" "callpal")])
4935 ;; BUGCHK is documented common to OSF/1 and VMS PALcode.
4936 ;; NT does not document anything at 0x81 -- presumably it would generate
4937 ;; the equivalent of SIGILL, but this isn't that important.
4938 ;; ??? Presuming unicosmk uses either OSF/1 or VMS PALcode.
4940 [(trap_if (const_int 1) (const_int 0))]
4941 "!TARGET_ABI_WINDOWS_NT"
4943 [(set_attr "type" "callpal")])
4945 ;; For userland, we load the thread pointer from the TCB.
4946 ;; For the kernel, we load the per-cpu private value.
4948 (define_insn "load_tp"
4949 [(set (match_operand:DI 0 "register_operand" "=v")
4950 (unspec:DI [(const_int 0)] UNSPEC_TP))]
4953 if (TARGET_TLS_KERNEL)
4954 return "call_pal 0x32";
4956 return "call_pal 0x9e";
4958 [(set_attr "type" "callpal")])
4960 ;; For completeness, and possibly a __builtin function, here's how to
4961 ;; set the thread pointer. Since we don't describe enough of this
4962 ;; quantity for CSE, we have to use a volatile unspec, and then there's
4963 ;; not much point in creating an R16_REG register class.
4965 (define_expand "set_tp"
4966 [(set (reg:DI 16) (match_operand:DI 0 "input_operand" ""))
4967 (unspec_volatile [(reg:DI 16)] UNSPECV_SET_TP)]
4971 (define_insn "*set_tp"
4972 [(unspec_volatile [(reg:DI 16)] UNSPECV_SET_TP)]
4975 if (TARGET_TLS_KERNEL)
4976 return "call_pal 0x31";
4978 return "call_pal 0x9f";
4980 [(set_attr "type" "callpal")])
4982 ;; Finally, we have the basic data motion insns. The byte and word insns
4983 ;; are done via define_expand. Start with the floating-point insns, since
4984 ;; they are simpler.
4986 (define_insn "*movsf_nofix"
4987 [(set (match_operand:SF 0 "nonimmediate_operand" "=f,f,*r,*r,m,m")
4988 (match_operand:SF 1 "input_operand" "fG,m,*rG,m,fG,*r"))]
4989 "TARGET_FPREGS && ! TARGET_FIX
4990 && (register_operand (operands[0], SFmode)
4991 || reg_or_0_operand (operands[1], SFmode))"
4999 [(set_attr "type" "fcpys,fld,ilog,ild,fst,ist")])
5001 (define_insn "*movsf_fix"
5002 [(set (match_operand:SF 0 "nonimmediate_operand" "=f,f,*r,*r,m,m,f,*r")
5003 (match_operand:SF 1 "input_operand" "fG,m,*rG,m,fG,*r,*r,f"))]
5004 "TARGET_FPREGS && TARGET_FIX
5005 && (register_operand (operands[0], SFmode)
5006 || reg_or_0_operand (operands[1], SFmode))"
5016 [(set_attr "type" "fcpys,fld,ilog,ild,fst,ist,itof,ftoi")])
5018 (define_insn "*movsf_nofp"
5019 [(set (match_operand:SF 0 "nonimmediate_operand" "=r,r,m")
5020 (match_operand:SF 1 "input_operand" "rG,m,r"))]
5022 && (register_operand (operands[0], SFmode)
5023 || reg_or_0_operand (operands[1], SFmode))"
5028 [(set_attr "type" "ilog,ild,ist")])
5030 (define_insn "*movdf_nofix"
5031 [(set (match_operand:DF 0 "nonimmediate_operand" "=f,f,*r,*r,m,m")
5032 (match_operand:DF 1 "input_operand" "fG,m,*rG,m,fG,*r"))]
5033 "TARGET_FPREGS && ! TARGET_FIX
5034 && (register_operand (operands[0], DFmode)
5035 || reg_or_0_operand (operands[1], DFmode))"
5043 [(set_attr "type" "fcpys,fld,ilog,ild,fst,ist")])
5045 (define_insn "*movdf_fix"
5046 [(set (match_operand:DF 0 "nonimmediate_operand" "=f,f,*r,*r,m,m,f,*r")
5047 (match_operand:DF 1 "input_operand" "fG,m,*rG,m,fG,*r,*r,f"))]
5048 "TARGET_FPREGS && TARGET_FIX
5049 && (register_operand (operands[0], DFmode)
5050 || reg_or_0_operand (operands[1], DFmode))"
5060 [(set_attr "type" "fcpys,fld,ilog,ild,fst,ist,itof,ftoi")])
5062 (define_insn "*movdf_nofp"
5063 [(set (match_operand:DF 0 "nonimmediate_operand" "=r,r,m")
5064 (match_operand:DF 1 "input_operand" "rG,m,r"))]
5066 && (register_operand (operands[0], DFmode)
5067 || reg_or_0_operand (operands[1], DFmode))"
5072 [(set_attr "type" "ilog,ild,ist")])
5074 ;; Subregs suck for register allocation. Pretend we can move TFmode
5075 ;; data between general registers until after reload.
5077 (define_insn_and_split "*movtf_internal"
5078 [(set (match_operand:TF 0 "nonimmediate_operand" "=r,o")
5079 (match_operand:TF 1 "input_operand" "roG,rG"))]
5080 "register_operand (operands[0], TFmode)
5081 || reg_or_0_operand (operands[1], TFmode)"
5084 [(set (match_dup 0) (match_dup 2))
5085 (set (match_dup 1) (match_dup 3))]
5087 alpha_split_tfmode_pair (operands);
5088 if (reg_overlap_mentioned_p (operands[0], operands[3]))
5091 tmp = operands[0], operands[0] = operands[1], operands[1] = tmp;
5092 tmp = operands[2], operands[2] = operands[3], operands[3] = tmp;
5096 (define_expand "movsf"
5097 [(set (match_operand:SF 0 "nonimmediate_operand" "")
5098 (match_operand:SF 1 "general_operand" ""))]
5101 if (GET_CODE (operands[0]) == MEM
5102 && ! reg_or_0_operand (operands[1], SFmode))
5103 operands[1] = force_reg (SFmode, operands[1]);
5106 (define_expand "movdf"
5107 [(set (match_operand:DF 0 "nonimmediate_operand" "")
5108 (match_operand:DF 1 "general_operand" ""))]
5111 if (GET_CODE (operands[0]) == MEM
5112 && ! reg_or_0_operand (operands[1], DFmode))
5113 operands[1] = force_reg (DFmode, operands[1]);
5116 (define_expand "movtf"
5117 [(set (match_operand:TF 0 "nonimmediate_operand" "")
5118 (match_operand:TF 1 "general_operand" ""))]
5121 if (GET_CODE (operands[0]) == MEM
5122 && ! reg_or_0_operand (operands[1], TFmode))
5123 operands[1] = force_reg (TFmode, operands[1]);
5126 (define_insn "*movsi"
5127 [(set (match_operand:SI 0 "nonimmediate_operand" "=r,r,r,r,m")
5128 (match_operand:SI 1 "input_operand" "rJ,K,L,m,rJ"))]
5129 "(TARGET_ABI_OSF || TARGET_ABI_UNICOSMK)
5130 && (register_operand (operands[0], SImode)
5131 || reg_or_0_operand (operands[1], SImode))"
5138 [(set_attr "type" "ilog,iadd,iadd,ild,ist")])
5140 (define_insn "*movsi_nt_vms"
5141 [(set (match_operand:SI 0 "nonimmediate_operand" "=r,r,r,r,r,m")
5142 (match_operand:SI 1 "input_operand" "rJ,K,L,s,m,rJ"))]
5143 "(TARGET_ABI_WINDOWS_NT || TARGET_ABI_OPEN_VMS)
5144 && (register_operand (operands[0], SImode)
5145 || reg_or_0_operand (operands[1], SImode))"
5153 [(set_attr "type" "ilog,iadd,iadd,ldsym,ild,ist")])
5155 (define_insn "*movhi_nobwx"
5156 [(set (match_operand:HI 0 "register_operand" "=r,r")
5157 (match_operand:HI 1 "input_operand" "rJ,n"))]
5159 && (register_operand (operands[0], HImode)
5160 || register_operand (operands[1], HImode))"
5164 [(set_attr "type" "ilog,iadd")])
5166 (define_insn "*movhi_bwx"
5167 [(set (match_operand:HI 0 "nonimmediate_operand" "=r,r,r,m")
5168 (match_operand:HI 1 "input_operand" "rJ,n,m,rJ"))]
5170 && (register_operand (operands[0], HImode)
5171 || reg_or_0_operand (operands[1], HImode))"
5177 [(set_attr "type" "ilog,iadd,ild,ist")])
5179 (define_insn "*movqi_nobwx"
5180 [(set (match_operand:QI 0 "register_operand" "=r,r")
5181 (match_operand:QI 1 "input_operand" "rJ,n"))]
5183 && (register_operand (operands[0], QImode)
5184 || register_operand (operands[1], QImode))"
5188 [(set_attr "type" "ilog,iadd")])
5190 (define_insn "*movqi_bwx"
5191 [(set (match_operand:QI 0 "nonimmediate_operand" "=r,r,r,m")
5192 (match_operand:QI 1 "input_operand" "rJ,n,m,rJ"))]
5194 && (register_operand (operands[0], QImode)
5195 || reg_or_0_operand (operands[1], QImode))"
5201 [(set_attr "type" "ilog,iadd,ild,ist")])
5203 ;; We do two major things here: handle mem->mem and construct long
5206 (define_expand "movsi"
5207 [(set (match_operand:SI 0 "nonimmediate_operand" "")
5208 (match_operand:SI 1 "general_operand" ""))]
5211 if (alpha_expand_mov (SImode, operands))
5215 ;; Split a load of a large constant into the appropriate two-insn
5219 [(set (match_operand:SI 0 "register_operand" "")
5220 (match_operand:SI 1 "const_int_operand" ""))]
5221 "! add_operand (operands[1], SImode)"
5222 [(set (match_dup 0) (match_dup 2))
5223 (set (match_dup 0) (plus:SI (match_dup 0) (match_dup 3)))]
5226 = alpha_emit_set_const (operands[0], SImode, INTVAL (operands[1]), 2);
5228 if (tem == operands[0])
5234 ;; Split the load of an address into a four-insn sequence on Unicos/Mk.
5235 ;; Always generate a REG_EQUAL note for the last instruction to facilitate
5236 ;; optimizations. If the symbolic operand is a label_ref, generate REG_LABEL
5237 ;; notes and update LABEL_NUSES because this is not done automatically.
5238 ;; Labels may be incorrectly deleted if we don't do this.
5240 ;; Describing what the individual instructions do correctly is too complicated
5241 ;; so use UNSPECs for each of the three parts of an address.
5244 [(set (match_operand:DI 0 "register_operand" "")
5245 (match_operand:DI 1 "symbolic_operand" ""))]
5246 "TARGET_ABI_UNICOSMK && reload_completed"
5249 rtx insn1, insn2, insn3;
5251 insn1 = emit_insn (gen_umk_laum (operands[0], operands[1]));
5252 emit_insn (gen_ashldi3 (operands[0], operands[0], GEN_INT (32)));
5253 insn2 = emit_insn (gen_umk_lalm (operands[0], operands[0], operands[1]));
5254 insn3 = emit_insn (gen_umk_lal (operands[0], operands[0], operands[1]));
5255 REG_NOTES (insn3) = gen_rtx_EXPR_LIST (REG_EQUAL, operands[1],
5257 if (GET_CODE (operands[1]) == LABEL_REF)
5261 label = XEXP (operands[1], 0);
5262 REG_NOTES (insn1) = gen_rtx_EXPR_LIST (REG_LABEL, label,
5264 REG_NOTES (insn2) = gen_rtx_EXPR_LIST (REG_LABEL, label,
5266 REG_NOTES (insn3) = gen_rtx_EXPR_LIST (REG_LABEL, label,
5268 LABEL_NUSES (label) += 3;
5273 ;; Instructions for loading the three parts of an address on Unicos/Mk.
5275 (define_insn "umk_laum"
5276 [(set (match_operand:DI 0 "register_operand" "=r")
5277 (unspec:DI [(match_operand:DI 1 "symbolic_operand" "")]
5279 "TARGET_ABI_UNICOSMK"
5281 [(set_attr "type" "iadd")])
5283 (define_insn "umk_lalm"
5284 [(set (match_operand:DI 0 "register_operand" "=r")
5285 (plus:DI (match_operand:DI 1 "register_operand" "r")
5286 (unspec:DI [(match_operand:DI 2 "symbolic_operand" "")]
5288 "TARGET_ABI_UNICOSMK"
5290 [(set_attr "type" "iadd")])
5292 (define_insn "umk_lal"
5293 [(set (match_operand:DI 0 "register_operand" "=r")
5294 (plus:DI (match_operand:DI 1 "register_operand" "r")
5295 (unspec:DI [(match_operand:DI 2 "symbolic_operand" "")]
5297 "TARGET_ABI_UNICOSMK"
5299 [(set_attr "type" "iadd")])
5301 ;; Add a new call information word to the current function's list of CIWs
5302 ;; and load its index into $25. Doing it here ensures that the CIW will be
5303 ;; associated with the correct function even in the presence of inlining.
5305 (define_insn "*umk_load_ciw"
5307 (unspec:DI [(match_operand 0 "" "")] UNSPEC_UMK_LOAD_CIW))]
5308 "TARGET_ABI_UNICOSMK"
5310 operands[0] = unicosmk_add_call_info_word (operands[0]);
5311 return "lda $25,%0";
5313 [(set_attr "type" "iadd")])
5315 (define_insn "*movdi_er_low_l"
5316 [(set (match_operand:DI 0 "register_operand" "=r")
5317 (lo_sum:DI (match_operand:DI 1 "register_operand" "r")
5318 (match_operand:DI 2 "local_symbolic_operand" "")))]
5319 "TARGET_EXPLICIT_RELOCS"
5321 if (true_regnum (operands[1]) == 29)
5322 return "lda %0,%2(%1)\t\t!gprel";
5324 return "lda %0,%2(%1)\t\t!gprellow";
5326 [(set_attr "usegp" "yes")])
5329 [(set (match_operand:DI 0 "register_operand" "")
5330 (match_operand:DI 1 "small_symbolic_operand" ""))]
5331 "TARGET_EXPLICIT_RELOCS && reload_completed"
5333 (lo_sum:DI (match_dup 2) (match_dup 1)))]
5334 "operands[2] = pic_offset_table_rtx;")
5337 [(set (match_operand:DI 0 "register_operand" "")
5338 (match_operand:DI 1 "local_symbolic_operand" ""))]
5339 "TARGET_EXPLICIT_RELOCS && reload_completed"
5341 (plus:DI (match_dup 2) (high:DI (match_dup 1))))
5343 (lo_sum:DI (match_dup 0) (match_dup 1)))]
5344 "operands[2] = pic_offset_table_rtx;")
5347 [(match_operand 0 "some_small_symbolic_operand" "")]
5348 "TARGET_EXPLICIT_RELOCS && reload_completed"
5350 "operands[0] = split_small_symbolic_operand (operands[0]);")
5352 ;; Accepts any symbolic, not just global, since function calls that
5353 ;; don't go via bsr still use !literal in hopes of linker relaxation.
5354 (define_insn "movdi_er_high_g"
5355 [(set (match_operand:DI 0 "register_operand" "=r")
5356 (unspec:DI [(match_operand:DI 1 "register_operand" "r")
5357 (match_operand:DI 2 "symbolic_operand" "")
5358 (match_operand 3 "const_int_operand" "")]
5360 "TARGET_EXPLICIT_RELOCS"
5362 if (INTVAL (operands[3]) == 0)
5363 return "ldq %0,%2(%1)\t\t!literal";
5365 return "ldq %0,%2(%1)\t\t!literal!%3";
5367 [(set_attr "type" "ldsym")])
5370 [(set (match_operand:DI 0 "register_operand" "")
5371 (match_operand:DI 1 "global_symbolic_operand" ""))]
5372 "TARGET_EXPLICIT_RELOCS && reload_completed"
5374 (unspec:DI [(match_dup 2)
5376 (const_int 0)] UNSPEC_LITERAL))]
5377 "operands[2] = pic_offset_table_rtx;")
5379 ;; With RTL inlining, at -O3, rtl is generated, stored, then actually
5380 ;; compiled at the end of compilation. In the meantime, someone can
5381 ;; re-encode-section-info on some symbol changing it e.g. from global
5382 ;; to local-not-small. If this happens, we'd have emitted a plain
5383 ;; load rather than a high+losum load and not recognize the insn.
5385 ;; So if rtl inlining is in effect, we delay the global/not-global
5386 ;; decision until rest_of_compilation by wrapping it in an UNSPEC_SYMBOL.
5388 (define_insn_and_split "movdi_er_maybe_g"
5389 [(set (match_operand:DI 0 "register_operand" "=r")
5390 (unspec:DI [(match_operand:DI 1 "symbolic_operand" "")]
5392 "TARGET_EXPLICIT_RELOCS && flag_inline_functions"
5395 [(set (match_dup 0) (match_dup 1))]
5397 if (local_symbolic_operand (operands[1], Pmode)
5398 && !small_symbolic_operand (operands[1], Pmode))
5400 rtx subtarget = no_new_pseudos ? operands[0] : gen_reg_rtx (Pmode);
5403 tmp = gen_rtx_HIGH (Pmode, operands[1]);
5404 if (reload_completed)
5405 tmp = gen_rtx_PLUS (Pmode, pic_offset_table_rtx, tmp);
5406 emit_insn (gen_rtx_SET (VOIDmode, subtarget, tmp));
5408 tmp = gen_rtx_LO_SUM (Pmode, subtarget, operands[1]);
5409 emit_insn (gen_rtx_SET (VOIDmode, operands[0], tmp));
5414 (define_insn "movdi_er_tlsgd"
5415 [(set (match_operand:DI 0 "register_operand" "=r")
5416 (unspec:DI [(match_operand:DI 1 "register_operand" "r")
5417 (match_operand:DI 2 "symbolic_operand" "")
5418 (match_operand 3 "const_int_operand" "")]
5422 if (INTVAL (operands[3]) == 0)
5423 return "lda %0,%2(%1)\t\t!tlsgd";
5425 return "lda %0,%2(%1)\t\t!tlsgd!%3";
5428 (define_insn "movdi_er_tlsldm"
5429 [(set (match_operand:DI 0 "register_operand" "=r")
5430 (unspec:DI [(match_operand:DI 1 "register_operand" "r")
5431 (match_operand 2 "const_int_operand" "")]
5435 if (INTVAL (operands[2]) == 0)
5436 return "lda %0,%&(%1)\t\t!tlsldm";
5438 return "lda %0,%&(%1)\t\t!tlsldm!%2";
5441 (define_insn "*movdi_er_gotdtp"
5442 [(set (match_operand:DI 0 "register_operand" "=r")
5443 (unspec:DI [(match_operand:DI 1 "register_operand" "r")
5444 (match_operand:DI 2 "symbolic_operand" "")]
5447 "ldq %0,%2(%1)\t\t!gotdtprel"
5448 [(set_attr "type" "ild")
5449 (set_attr "usegp" "yes")])
5452 [(set (match_operand:DI 0 "register_operand" "")
5453 (match_operand:DI 1 "gotdtp_symbolic_operand" ""))]
5454 "HAVE_AS_TLS && reload_completed"
5456 (unspec:DI [(match_dup 2)
5457 (match_dup 1)] UNSPEC_DTPREL))]
5459 operands[1] = XVECEXP (XEXP (operands[1], 0), 0, 0);
5460 operands[2] = pic_offset_table_rtx;
5463 (define_insn "*movdi_er_gottp"
5464 [(set (match_operand:DI 0 "register_operand" "=r")
5465 (unspec:DI [(match_operand:DI 1 "register_operand" "r")
5466 (match_operand:DI 2 "symbolic_operand" "")]
5469 "ldq %0,%2(%1)\t\t!gottprel"
5470 [(set_attr "type" "ild")
5471 (set_attr "usegp" "yes")])
5474 [(set (match_operand:DI 0 "register_operand" "")
5475 (match_operand:DI 1 "gottp_symbolic_operand" ""))]
5476 "HAVE_AS_TLS && reload_completed"
5478 (unspec:DI [(match_dup 2)
5479 (match_dup 1)] UNSPEC_TPREL))]
5481 operands[1] = XVECEXP (XEXP (operands[1], 0), 0, 0);
5482 operands[2] = pic_offset_table_rtx;
5485 (define_insn "*movdi_er_nofix"
5486 [(set (match_operand:DI 0 "nonimmediate_operand" "=r,r,r,r,r,r,m,*f,*f,Q")
5487 (match_operand:DI 1 "input_operand" "rJ,K,L,T,s,m,rJ,*fJ,Q,*f"))]
5488 "TARGET_EXPLICIT_RELOCS && ! TARGET_FIX
5489 && (register_operand (operands[0], DImode)
5490 || reg_or_0_operand (operands[1], DImode))"
5502 [(set_attr "type" "ilog,iadd,iadd,iadd,ldsym,ild,ist,fcpys,fld,fst")
5503 (set_attr "usegp" "*,*,*,yes,*,*,*,*,*,*")])
5505 ;; The 'U' constraint matches symbolic operands on Unicos/Mk. Those should
5506 ;; have been split up by the rules above but we shouldn't reject the
5507 ;; possibility of them getting through.
5509 (define_insn "*movdi_nofix"
5510 [(set (match_operand:DI 0 "nonimmediate_operand" "=r,r,r,r,r,r,m,*f,*f,Q")
5511 (match_operand:DI 1 "input_operand" "rJ,K,L,U,s,m,rJ,*fJ,Q,*f"))]
5513 && (register_operand (operands[0], DImode)
5514 || reg_or_0_operand (operands[1], DImode))"
5519 laum %0,%t1($31)\;sll %0,32,%0\;lalm %0,%t1(%0)\;lal %0,%t1(%0)
5526 [(set_attr "type" "ilog,iadd,iadd,ldsym,ldsym,ild,ist,fcpys,fld,fst")
5527 (set_attr "length" "*,*,*,16,*,*,*,*,*,*")])
5529 (define_insn "*movdi_er_fix"
5530 [(set (match_operand:DI 0 "nonimmediate_operand"
5531 "=r,r,r,r,r,r, m, *f,*f, Q, r,*f")
5532 (match_operand:DI 1 "input_operand"
5533 "rJ,K,L,T,s,m,rJ,*fJ, Q,*f,*f, r"))]
5534 "TARGET_EXPLICIT_RELOCS && TARGET_FIX
5535 && (register_operand (operands[0], DImode)
5536 || reg_or_0_operand (operands[1], DImode))"
5550 [(set_attr "type" "ilog,iadd,iadd,iadd,ldsym,ild,ist,fcpys,fld,fst,ftoi,itof")
5551 (set_attr "usegp" "*,*,*,yes,*,*,*,*,*,*,*,*")])
5553 (define_insn "*movdi_fix"
5554 [(set (match_operand:DI 0 "nonimmediate_operand" "=r,r,r,r,r,m,*f,*f,Q,r,*f")
5555 (match_operand:DI 1 "input_operand" "rJ,K,L,s,m,rJ,*fJ,Q,*f,*f,r"))]
5556 "! TARGET_EXPLICIT_RELOCS && TARGET_FIX
5557 && (register_operand (operands[0], DImode)
5558 || reg_or_0_operand (operands[1], DImode))"
5571 [(set_attr "type" "ilog,iadd,iadd,ldsym,ild,ist,fcpys,fld,fst,ftoi,itof")])
5573 ;; VMS needs to set up "vms_base_regno" for unwinding. This move
5574 ;; often appears dead to the life analysis code, at which point we
5575 ;; abort for emitting dead prologue instructions. Force this live.
5577 (define_insn "force_movdi"
5578 [(set (match_operand:DI 0 "register_operand" "=r")
5579 (unspec_volatile:DI [(match_operand:DI 1 "register_operand" "r")]
5580 UNSPECV_FORCE_MOV))]
5583 [(set_attr "type" "ilog")])
5585 ;; We do three major things here: handle mem->mem, put 64-bit constants in
5586 ;; memory, and construct long 32-bit constants.
5588 (define_expand "movdi"
5589 [(set (match_operand:DI 0 "nonimmediate_operand" "")
5590 (match_operand:DI 1 "general_operand" ""))]
5593 if (alpha_expand_mov (DImode, operands))
5597 ;; Split a load of a large constant into the appropriate two-insn
5601 [(set (match_operand:DI 0 "register_operand" "")
5602 (match_operand:DI 1 "const_int_operand" ""))]
5603 "! add_operand (operands[1], DImode)"
5604 [(set (match_dup 0) (match_dup 2))
5605 (set (match_dup 0) (plus:DI (match_dup 0) (match_dup 3)))]
5608 = alpha_emit_set_const (operands[0], DImode, INTVAL (operands[1]), 2);
5610 if (tem == operands[0])
5616 ;; These are the partial-word cases.
5618 ;; First we have the code to load an aligned word. Operand 0 is the register
5619 ;; in which to place the result. It's mode is QImode or HImode. Operand 1
5620 ;; is an SImode MEM at the low-order byte of the proper word. Operand 2 is the
5621 ;; number of bits within the word that the value is. Operand 3 is an SImode
5622 ;; scratch register. If operand 0 is a hard register, operand 3 may be the
5623 ;; same register. It is allowed to conflict with operand 1 as well.
5625 (define_expand "aligned_loadqi"
5626 [(set (match_operand:SI 3 "register_operand" "")
5627 (match_operand:SI 1 "memory_operand" ""))
5628 (set (match_operand:DI 0 "register_operand" "")
5629 (zero_extract:DI (subreg:DI (match_dup 3) 0)
5631 (match_operand:DI 2 "const_int_operand" "")))]
5636 (define_expand "aligned_loadhi"
5637 [(set (match_operand:SI 3 "register_operand" "")
5638 (match_operand:SI 1 "memory_operand" ""))
5639 (set (match_operand:DI 0 "register_operand" "")
5640 (zero_extract:DI (subreg:DI (match_dup 3) 0)
5642 (match_operand:DI 2 "const_int_operand" "")))]
5647 ;; Similar for unaligned loads, where we use the sequence from the
5648 ;; Alpha Architecture manual. We have to distinguish between little-endian
5649 ;; and big-endian systems as the sequences are different.
5651 ;; Operand 1 is the address. Operands 2 and 3 are temporaries, where
5652 ;; operand 3 can overlap the input and output registers.
5654 (define_expand "unaligned_loadqi"
5655 [(use (match_operand:DI 0 "register_operand" ""))
5656 (use (match_operand:DI 1 "address_operand" ""))
5657 (use (match_operand:DI 2 "register_operand" ""))
5658 (use (match_operand:DI 3 "register_operand" ""))]
5661 if (WORDS_BIG_ENDIAN)
5662 emit_insn (gen_unaligned_loadqi_be (operands[0], operands[1],
5663 operands[2], operands[3]));
5665 emit_insn (gen_unaligned_loadqi_le (operands[0], operands[1],
5666 operands[2], operands[3]));
5670 (define_expand "unaligned_loadqi_le"
5671 [(set (match_operand:DI 2 "register_operand" "")
5672 (mem:DI (and:DI (match_operand:DI 1 "address_operand" "")
5674 (set (match_operand:DI 3 "register_operand" "")
5676 (set (match_operand:DI 0 "register_operand" "")
5677 (zero_extract:DI (match_dup 2)
5679 (ashift:DI (match_dup 3) (const_int 3))))]
5680 "! WORDS_BIG_ENDIAN"
5683 (define_expand "unaligned_loadqi_be"
5684 [(set (match_operand:DI 2 "register_operand" "")
5685 (mem:DI (and:DI (match_operand:DI 1 "address_operand" "")
5687 (set (match_operand:DI 3 "register_operand" "")
5689 (set (match_operand:DI 0 "register_operand" "")
5690 (zero_extract:DI (match_dup 2)
5694 (ashift:DI (match_dup 3) (const_int 3)))))]
5698 (define_expand "unaligned_loadhi"
5699 [(use (match_operand:DI 0 "register_operand" ""))
5700 (use (match_operand:DI 1 "address_operand" ""))
5701 (use (match_operand:DI 2 "register_operand" ""))
5702 (use (match_operand:DI 3 "register_operand" ""))]
5705 if (WORDS_BIG_ENDIAN)
5706 emit_insn (gen_unaligned_loadhi_be (operands[0], operands[1],
5707 operands[2], operands[3]));
5709 emit_insn (gen_unaligned_loadhi_le (operands[0], operands[1],
5710 operands[2], operands[3]));
5714 (define_expand "unaligned_loadhi_le"
5715 [(set (match_operand:DI 2 "register_operand" "")
5716 (mem:DI (and:DI (match_operand:DI 1 "address_operand" "")
5718 (set (match_operand:DI 3 "register_operand" "")
5720 (set (match_operand:DI 0 "register_operand" "")
5721 (zero_extract:DI (match_dup 2)
5723 (ashift:DI (match_dup 3) (const_int 3))))]
5724 "! WORDS_BIG_ENDIAN"
5727 (define_expand "unaligned_loadhi_be"
5728 [(set (match_operand:DI 2 "register_operand" "")
5729 (mem:DI (and:DI (match_operand:DI 1 "address_operand" "")
5731 (set (match_operand:DI 3 "register_operand" "")
5732 (plus:DI (match_dup 1) (const_int 1)))
5733 (set (match_operand:DI 0 "register_operand" "")
5734 (zero_extract:DI (match_dup 2)
5738 (ashift:DI (match_dup 3) (const_int 3)))))]
5742 ;; Storing an aligned byte or word requires two temporaries. Operand 0 is the
5743 ;; aligned SImode MEM. Operand 1 is the register containing the
5744 ;; byte or word to store. Operand 2 is the number of bits within the word that
5745 ;; the value should be placed. Operands 3 and 4 are SImode temporaries.
5747 (define_expand "aligned_store"
5748 [(set (match_operand:SI 3 "register_operand" "")
5749 (match_operand:SI 0 "memory_operand" ""))
5750 (set (subreg:DI (match_dup 3) 0)
5751 (and:DI (subreg:DI (match_dup 3) 0) (match_dup 5)))
5752 (set (subreg:DI (match_operand:SI 4 "register_operand" "") 0)
5753 (ashift:DI (zero_extend:DI (match_operand 1 "register_operand" ""))
5754 (match_operand:DI 2 "const_int_operand" "")))
5755 (set (subreg:DI (match_dup 4) 0)
5756 (ior:DI (subreg:DI (match_dup 4) 0) (subreg:DI (match_dup 3) 0)))
5757 (set (match_dup 0) (match_dup 4))]
5760 operands[5] = GEN_INT (~ (GET_MODE_MASK (GET_MODE (operands[1]))
5761 << INTVAL (operands[2])));
5764 ;; For the unaligned byte and halfword cases, we use code similar to that
5765 ;; in the ;; Architecture book, but reordered to lower the number of registers
5766 ;; required. Operand 0 is the address. Operand 1 is the data to store.
5767 ;; Operands 2, 3, and 4 are DImode temporaries, where operands 2 and 4 may
5768 ;; be the same temporary, if desired. If the address is in a register,
5769 ;; operand 2 can be that register.
5771 (define_expand "unaligned_storeqi"
5772 [(use (match_operand:DI 0 "address_operand" ""))
5773 (use (match_operand:QI 1 "register_operand" ""))
5774 (use (match_operand:DI 2 "register_operand" ""))
5775 (use (match_operand:DI 3 "register_operand" ""))
5776 (use (match_operand:DI 4 "register_operand" ""))]
5779 if (WORDS_BIG_ENDIAN)
5780 emit_insn (gen_unaligned_storeqi_be (operands[0], operands[1],
5781 operands[2], operands[3],
5784 emit_insn (gen_unaligned_storeqi_le (operands[0], operands[1],
5785 operands[2], operands[3],
5790 (define_expand "unaligned_storeqi_le"
5791 [(set (match_operand:DI 3 "register_operand" "")
5792 (mem:DI (and:DI (match_operand:DI 0 "address_operand" "")
5794 (set (match_operand:DI 2 "register_operand" "")
5797 (and:DI (not:DI (ashift:DI (const_int 255)
5798 (ashift:DI (match_dup 2) (const_int 3))))
5800 (set (match_operand:DI 4 "register_operand" "")
5801 (ashift:DI (zero_extend:DI (match_operand:QI 1 "register_operand" ""))
5802 (ashift:DI (match_dup 2) (const_int 3))))
5803 (set (match_dup 4) (ior:DI (match_dup 4) (match_dup 3)))
5804 (set (mem:DI (and:DI (match_dup 0) (const_int -8)))
5806 "! WORDS_BIG_ENDIAN"
5809 (define_expand "unaligned_storeqi_be"
5810 [(set (match_operand:DI 3 "register_operand" "")
5811 (mem:DI (and:DI (match_operand:DI 0 "address_operand" "")
5813 (set (match_operand:DI 2 "register_operand" "")
5816 (and:DI (not:DI (ashift:DI (const_int 255)
5817 (minus:DI (const_int 56)
5818 (ashift:DI (match_dup 2) (const_int 3)))))
5820 (set (match_operand:DI 4 "register_operand" "")
5821 (ashift:DI (zero_extend:DI (match_operand:QI 1 "register_operand" ""))
5822 (minus:DI (const_int 56)
5823 (ashift:DI (match_dup 2) (const_int 3)))))
5824 (set (match_dup 4) (ior:DI (match_dup 4) (match_dup 3)))
5825 (set (mem:DI (and:DI (match_dup 0) (const_int -8)))
5830 (define_expand "unaligned_storehi"
5831 [(use (match_operand:DI 0 "address_operand" ""))
5832 (use (match_operand:HI 1 "register_operand" ""))
5833 (use (match_operand:DI 2 "register_operand" ""))
5834 (use (match_operand:DI 3 "register_operand" ""))
5835 (use (match_operand:DI 4 "register_operand" ""))]
5838 if (WORDS_BIG_ENDIAN)
5839 emit_insn (gen_unaligned_storehi_be (operands[0], operands[1],
5840 operands[2], operands[3],
5843 emit_insn (gen_unaligned_storehi_le (operands[0], operands[1],
5844 operands[2], operands[3],
5849 (define_expand "unaligned_storehi_le"
5850 [(set (match_operand:DI 3 "register_operand" "")
5851 (mem:DI (and:DI (match_operand:DI 0 "address_operand" "")
5853 (set (match_operand:DI 2 "register_operand" "")
5856 (and:DI (not:DI (ashift:DI (const_int 65535)
5857 (ashift:DI (match_dup 2) (const_int 3))))
5859 (set (match_operand:DI 4 "register_operand" "")
5860 (ashift:DI (zero_extend:DI (match_operand:HI 1 "register_operand" ""))
5861 (ashift:DI (match_dup 2) (const_int 3))))
5862 (set (match_dup 4) (ior:DI (match_dup 4) (match_dup 3)))
5863 (set (mem:DI (and:DI (match_dup 0) (const_int -8)))
5865 "! WORDS_BIG_ENDIAN"
5868 (define_expand "unaligned_storehi_be"
5869 [(set (match_operand:DI 3 "register_operand" "")
5870 (mem:DI (and:DI (match_operand:DI 0 "address_operand" "")
5872 (set (match_operand:DI 2 "register_operand" "")
5873 (plus:DI (match_dup 0) (const_int 1)))
5875 (and:DI (not:DI (ashift:DI
5877 (minus:DI (const_int 56)
5878 (ashift:DI (match_dup 2) (const_int 3)))))
5880 (set (match_operand:DI 4 "register_operand" "")
5881 (ashift:DI (zero_extend:DI (match_operand:HI 1 "register_operand" ""))
5882 (minus:DI (const_int 56)
5883 (ashift:DI (match_dup 2) (const_int 3)))))
5884 (set (match_dup 4) (ior:DI (match_dup 4) (match_dup 3)))
5885 (set (mem:DI (and:DI (match_dup 0) (const_int -8)))
5890 ;; Here are the define_expand's for QI and HI moves that use the above
5891 ;; patterns. We have the normal sets, plus the ones that need scratch
5892 ;; registers for reload.
5894 (define_expand "movqi"
5895 [(set (match_operand:QI 0 "nonimmediate_operand" "")
5896 (match_operand:QI 1 "general_operand" ""))]
5900 ? alpha_expand_mov (QImode, operands)
5901 : alpha_expand_mov_nobwx (QImode, operands))
5905 (define_expand "movhi"
5906 [(set (match_operand:HI 0 "nonimmediate_operand" "")
5907 (match_operand:HI 1 "general_operand" ""))]
5911 ? alpha_expand_mov (HImode, operands)
5912 : alpha_expand_mov_nobwx (HImode, operands))
5916 ;; Here are the versions for reload. Note that in the unaligned cases
5917 ;; we know that the operand must not be a pseudo-register because stack
5918 ;; slots are always aligned references.
5920 (define_expand "reload_inqi"
5921 [(parallel [(match_operand:QI 0 "register_operand" "=r")
5922 (match_operand:QI 1 "any_memory_operand" "m")
5923 (match_operand:TI 2 "register_operand" "=&r")])]
5928 if (aligned_memory_operand (operands[1], QImode))
5930 seq = gen_reload_inqi_help (operands[0], operands[1],
5931 gen_rtx_REG (SImode, REGNO (operands[2])));
5937 /* It is possible that one of the registers we got for operands[2]
5938 might coincide with that of operands[0] (which is why we made
5939 it TImode). Pick the other one to use as our scratch. */
5940 if (REGNO (operands[0]) == REGNO (operands[2]))
5941 scratch = gen_rtx_REG (DImode, REGNO (operands[2]) + 1);
5943 scratch = gen_rtx_REG (DImode, REGNO (operands[2]));
5945 addr = get_unaligned_address (operands[1], 0);
5946 operands[0] = gen_rtx_REG (DImode, REGNO (operands[0]));
5947 seq = gen_unaligned_loadqi (operands[0], addr, scratch, operands[0]);
5948 alpha_set_memflags (seq, operands[1]);
5954 (define_expand "reload_inhi"
5955 [(parallel [(match_operand:HI 0 "register_operand" "=r")
5956 (match_operand:HI 1 "any_memory_operand" "m")
5957 (match_operand:TI 2 "register_operand" "=&r")])]
5962 if (aligned_memory_operand (operands[1], HImode))
5964 seq = gen_reload_inhi_help (operands[0], operands[1],
5965 gen_rtx_REG (SImode, REGNO (operands[2])));
5971 /* It is possible that one of the registers we got for operands[2]
5972 might coincide with that of operands[0] (which is why we made
5973 it TImode). Pick the other one to use as our scratch. */
5974 if (REGNO (operands[0]) == REGNO (operands[2]))
5975 scratch = gen_rtx_REG (DImode, REGNO (operands[2]) + 1);
5977 scratch = gen_rtx_REG (DImode, REGNO (operands[2]));
5979 addr = get_unaligned_address (operands[1], 0);
5980 operands[0] = gen_rtx_REG (DImode, REGNO (operands[0]));
5981 seq = gen_unaligned_loadhi (operands[0], addr, scratch, operands[0]);
5982 alpha_set_memflags (seq, operands[1]);
5988 (define_expand "reload_outqi"
5989 [(parallel [(match_operand:QI 0 "any_memory_operand" "=m")
5990 (match_operand:QI 1 "register_operand" "r")
5991 (match_operand:TI 2 "register_operand" "=&r")])]
5994 if (aligned_memory_operand (operands[0], QImode))
5996 emit_insn (gen_reload_outqi_help
5997 (operands[0], operands[1],
5998 gen_rtx_REG (SImode, REGNO (operands[2])),
5999 gen_rtx_REG (SImode, REGNO (operands[2]) + 1)));
6003 rtx addr = get_unaligned_address (operands[0], 0);
6004 rtx scratch1 = gen_rtx_REG (DImode, REGNO (operands[2]));
6005 rtx scratch2 = gen_rtx_REG (DImode, REGNO (operands[2]) + 1);
6006 rtx scratch3 = scratch1;
6009 if (GET_CODE (addr) == REG)
6012 seq = gen_unaligned_storeqi (addr, operands[1], scratch1,
6013 scratch2, scratch3);
6014 alpha_set_memflags (seq, operands[0]);
6020 (define_expand "reload_outhi"
6021 [(parallel [(match_operand:HI 0 "any_memory_operand" "=m")
6022 (match_operand:HI 1 "register_operand" "r")
6023 (match_operand:TI 2 "register_operand" "=&r")])]
6026 if (aligned_memory_operand (operands[0], HImode))
6028 emit_insn (gen_reload_outhi_help
6029 (operands[0], operands[1],
6030 gen_rtx_REG (SImode, REGNO (operands[2])),
6031 gen_rtx_REG (SImode, REGNO (operands[2]) + 1)));
6035 rtx addr = get_unaligned_address (operands[0], 0);
6036 rtx scratch1 = gen_rtx_REG (DImode, REGNO (operands[2]));
6037 rtx scratch2 = gen_rtx_REG (DImode, REGNO (operands[2]) + 1);
6038 rtx scratch3 = scratch1;
6041 if (GET_CODE (addr) == REG)
6044 seq = gen_unaligned_storehi (addr, operands[1], scratch1,
6045 scratch2, scratch3);
6046 alpha_set_memflags (seq, operands[0]);
6052 ;; Helpers for the above. The way reload is structured, we can't
6053 ;; always get a proper address for a stack slot during reload_foo
6054 ;; expansion, so we must delay our address manipulations until after.
6056 (define_insn_and_split "reload_inqi_help"
6057 [(set (match_operand:QI 0 "register_operand" "=r")
6058 (match_operand:QI 1 "memory_operand" "m"))
6059 (clobber (match_operand:SI 2 "register_operand" "=r"))]
6060 "! TARGET_BWX && (reload_in_progress || reload_completed)"
6062 "! TARGET_BWX && reload_completed"
6065 rtx aligned_mem, bitnum;
6066 get_aligned_mem (operands[1], &aligned_mem, &bitnum);
6067 operands[0] = gen_lowpart (DImode, operands[0]);
6068 emit_insn (gen_aligned_loadqi (operands[0], aligned_mem, bitnum,
6073 (define_insn_and_split "reload_inhi_help"
6074 [(set (match_operand:HI 0 "register_operand" "=r")
6075 (match_operand:HI 1 "memory_operand" "m"))
6076 (clobber (match_operand:SI 2 "register_operand" "=r"))]
6077 "! TARGET_BWX && (reload_in_progress || reload_completed)"
6079 "! TARGET_BWX && reload_completed"
6082 rtx aligned_mem, bitnum;
6083 get_aligned_mem (operands[1], &aligned_mem, &bitnum);
6084 operands[0] = gen_lowpart (DImode, operands[0]);
6085 emit_insn (gen_aligned_loadhi (operands[0], aligned_mem, bitnum,
6090 (define_insn_and_split "reload_outqi_help"
6091 [(set (match_operand:QI 0 "memory_operand" "=m")
6092 (match_operand:QI 1 "register_operand" "r"))
6093 (clobber (match_operand:SI 2 "register_operand" "=r"))
6094 (clobber (match_operand:SI 3 "register_operand" "=r"))]
6095 "! TARGET_BWX && (reload_in_progress || reload_completed)"
6097 "! TARGET_BWX && reload_completed"
6100 rtx aligned_mem, bitnum;
6101 get_aligned_mem (operands[0], &aligned_mem, &bitnum);
6102 emit_insn (gen_aligned_store (aligned_mem, operands[1], bitnum,
6103 operands[2], operands[3]));
6107 (define_insn_and_split "reload_outhi_help"
6108 [(set (match_operand:HI 0 "memory_operand" "=m")
6109 (match_operand:HI 1 "register_operand" "r"))
6110 (clobber (match_operand:SI 2 "register_operand" "=r"))
6111 (clobber (match_operand:SI 3 "register_operand" "=r"))]
6112 "! TARGET_BWX && (reload_in_progress || reload_completed)"
6114 "! TARGET_BWX && reload_completed"
6117 rtx aligned_mem, bitnum;
6118 get_aligned_mem (operands[0], &aligned_mem, &bitnum);
6119 emit_insn (gen_aligned_store (aligned_mem, operands[1], bitnum,
6120 operands[2], operands[3]));
6124 ;; Vector operations
6126 (define_expand "movv8qi"
6127 [(set (match_operand:V8QI 0 "nonimmediate_operand" "")
6128 (match_operand:V8QI 1 "general_operand" ""))]
6131 if (alpha_expand_mov (V8QImode, operands))
6135 (define_insn "*movv8qi_fix"
6136 [(set (match_operand:V8QI 0 "nonimmediate_operand" "=r,r,m,*f,*f,m,r,*f")
6137 (match_operand:V8QI 1 "input_operand" "rW,m,rW,*fW,m,*f,*f,r"))]
6139 && (register_operand (operands[0], V8QImode)
6140 || reg_or_0_operand (operands[1], V8QImode))"
6150 [(set_attr "type" "ilog,ild,ist,fcpys,fld,fst,ftoi,itof")])
6152 (define_insn "*movv8qi_nofix"
6153 [(set (match_operand:V8QI 0 "nonimmediate_operand" "=r,r,m,*f,*f,m")
6154 (match_operand:V8QI 1 "input_operand" "rW,m,rW,*fW,m,*f"))]
6156 && (register_operand (operands[0], V8QImode)
6157 || reg_or_0_operand (operands[1], V8QImode))"
6165 [(set_attr "type" "ilog,ild,ist,fcpys,fld,fst")])
6167 (define_expand "movv4hi"
6168 [(set (match_operand:V4HI 0 "nonimmediate_operand" "")
6169 (match_operand:V4HI 1 "general_operand" ""))]
6172 if (alpha_expand_mov (V4HImode, operands))
6176 (define_insn "*movv4hi_fix"
6177 [(set (match_operand:V4HI 0 "nonimmediate_operand" "=r,r,m,*f,*f,m,r,*f")
6178 (match_operand:V4HI 1 "input_operand" "rW,m,rW,*fW,m,*f,*f,r"))]
6180 && (register_operand (operands[0], V4HImode)
6181 || reg_or_0_operand (operands[1], V4HImode))"
6191 [(set_attr "type" "ilog,ild,ist,fcpys,fld,fst,ftoi,itof")])
6193 (define_insn "*movv4hi_nofix"
6194 [(set (match_operand:V4HI 0 "nonimmediate_operand" "=r,r,m,*f,*f,m")
6195 (match_operand:V4HI 1 "input_operand" "rW,m,rW,*fW,m,*f"))]
6197 && (register_operand (operands[0], V4HImode)
6198 || reg_or_0_operand (operands[1], V4HImode))"
6206 [(set_attr "type" "ilog,ild,ist,fcpys,fld,fst")])
6208 (define_expand "movv2si"
6209 [(set (match_operand:V2SI 0 "nonimmediate_operand" "")
6210 (match_operand:V2SI 1 "general_operand" ""))]
6213 if (alpha_expand_mov (V2SImode, operands))
6217 (define_insn "*movv2si_fix"
6218 [(set (match_operand:V2SI 0 "nonimmediate_operand" "=r,r,m,*f,*f,m,r,*f")
6219 (match_operand:V2SI 1 "input_operand" "rW,m,rW,*fW,m,*f,*f,r"))]
6221 && (register_operand (operands[0], V2SImode)
6222 || reg_or_0_operand (operands[1], V2SImode))"
6232 [(set_attr "type" "ilog,ild,ist,fcpys,fld,fst,ftoi,itof")])
6234 (define_insn "*movv2si_nofix"
6235 [(set (match_operand:V2SI 0 "nonimmediate_operand" "=r,r,m,*f,*f,m")
6236 (match_operand:V2SI 1 "input_operand" "rW,m,rW,*fW,m,*f"))]
6238 && (register_operand (operands[0], V2SImode)
6239 || reg_or_0_operand (operands[1], V2SImode))"
6247 [(set_attr "type" "ilog,ild,ist,fcpys,fld,fst")])
6249 (define_insn "uminv8qi3"
6250 [(set (match_operand:V8QI 0 "register_operand" "=r")
6251 (umin:V8QI (match_operand:V8QI 1 "reg_or_0_operand" "rW")
6252 (match_operand:V8QI 2 "reg_or_0_operand" "rW")))]
6255 [(set_attr "type" "mvi")])
6257 (define_insn "sminv8qi3"
6258 [(set (match_operand:V8QI 0 "register_operand" "=r")
6259 (smin:V8QI (match_operand:V8QI 1 "reg_or_0_operand" "rW")
6260 (match_operand:V8QI 2 "reg_or_0_operand" "rW")))]
6263 [(set_attr "type" "mvi")])
6265 (define_insn "uminv4hi3"
6266 [(set (match_operand:V4HI 0 "register_operand" "=r")
6267 (umin:V4HI (match_operand:V4HI 1 "reg_or_0_operand" "rW")
6268 (match_operand:V4HI 2 "reg_or_0_operand" "rW")))]
6271 [(set_attr "type" "mvi")])
6273 (define_insn "sminv4hi3"
6274 [(set (match_operand:V4HI 0 "register_operand" "=r")
6275 (smin:V4HI (match_operand:V4HI 1 "reg_or_0_operand" "rW")
6276 (match_operand:V4HI 2 "reg_or_0_operand" "rW")))]
6279 [(set_attr "type" "mvi")])
6281 (define_insn "umaxv8qi3"
6282 [(set (match_operand:V8QI 0 "register_operand" "=r")
6283 (umax:V8QI (match_operand:V8QI 1 "reg_or_0_operand" "rW")
6284 (match_operand:V8QI 2 "reg_or_0_operand" "rW")))]
6287 [(set_attr "type" "mvi")])
6289 (define_insn "smaxv8qi3"
6290 [(set (match_operand:V8QI 0 "register_operand" "=r")
6291 (smax:V8QI (match_operand:V8QI 1 "reg_or_0_operand" "rW")
6292 (match_operand:V8QI 2 "reg_or_0_operand" "rW")))]
6295 [(set_attr "type" "mvi")])
6297 (define_insn "umaxv4hi3"
6298 [(set (match_operand:V4HI 0 "register_operand" "=r")
6299 (umax:V4HI (match_operand:V4HI 1 "reg_or_0_operand" "rW")
6300 (match_operand:V4HI 2 "reg_or_0_operand" "rW")))]
6303 [(set_attr "type" "mvi")])
6305 (define_insn "smaxv4hi3"
6306 [(set (match_operand:V4HI 0 "register_operand" "=r")
6307 (smax:V4HI (match_operand:V4HI 1 "reg_or_0_operand" "rW")
6308 (match_operand:V4HI 2 "reg_or_0_operand" "rW")))]
6311 [(set_attr "type" "mvi")])
6313 ;; Bit field extract patterns which use ext[wlq][lh]
6315 (define_expand "extv"
6316 [(set (match_operand:DI 0 "register_operand" "")
6317 (sign_extract:DI (match_operand:QI 1 "memory_operand" "")
6318 (match_operand:DI 2 "immediate_operand" "")
6319 (match_operand:DI 3 "immediate_operand" "")))]
6324 /* We can do 16, 32 and 64 bit fields, if aligned on byte boundaries. */
6325 if (INTVAL (operands[3]) % 8 != 0
6326 || (INTVAL (operands[2]) != 16
6327 && INTVAL (operands[2]) != 32
6328 && INTVAL (operands[2]) != 64))
6331 /* From mips.md: extract_bit_field doesn't verify that our source
6332 matches the predicate, so we force it to be a MEM here. */
6333 if (GET_CODE (operands[1]) != MEM)
6336 /* The bit number is relative to the mode of operand 1 which is
6337 usually QImode (this might actually be a bug in expmed.c). Note
6338 that the bit number is negative in big-endian mode in this case.
6339 We have to convert that to the offset. */
6340 if (WORDS_BIG_ENDIAN)
6341 ofs = GET_MODE_BITSIZE (GET_MODE (operands[1]))
6342 - INTVAL (operands[2]) - INTVAL (operands[3]);
6344 ofs = INTVAL (operands[3]);
6348 alpha_expand_unaligned_load (operands[0], operands[1],
6349 INTVAL (operands[2]) / 8,
6354 (define_expand "extzv"
6355 [(set (match_operand:DI 0 "register_operand" "")
6356 (zero_extract:DI (match_operand:DI 1 "nonimmediate_operand" "")
6357 (match_operand:DI 2 "immediate_operand" "")
6358 (match_operand:DI 3 "immediate_operand" "")))]
6361 /* We can do 8, 16, 32 and 64 bit fields, if aligned on byte boundaries. */
6362 if (INTVAL (operands[3]) % 8 != 0
6363 || (INTVAL (operands[2]) != 8
6364 && INTVAL (operands[2]) != 16
6365 && INTVAL (operands[2]) != 32
6366 && INTVAL (operands[2]) != 64))
6369 if (GET_CODE (operands[1]) == MEM)
6373 /* Fail 8 bit fields, falling back on a simple byte load. */
6374 if (INTVAL (operands[2]) == 8)
6377 /* The bit number is relative to the mode of operand 1 which is
6378 usually QImode (this might actually be a bug in expmed.c). Note
6379 that the bit number is negative in big-endian mode in this case.
6380 We have to convert that to the offset. */
6381 if (WORDS_BIG_ENDIAN)
6382 ofs = GET_MODE_BITSIZE (GET_MODE (operands[1]))
6383 - INTVAL (operands[2]) - INTVAL (operands[3]);
6385 ofs = INTVAL (operands[3]);
6389 alpha_expand_unaligned_load (operands[0], operands[1],
6390 INTVAL (operands[2]) / 8,
6396 (define_expand "insv"
6397 [(set (zero_extract:DI (match_operand:QI 0 "memory_operand" "")
6398 (match_operand:DI 1 "immediate_operand" "")
6399 (match_operand:DI 2 "immediate_operand" ""))
6400 (match_operand:DI 3 "register_operand" ""))]
6405 /* We can do 16, 32 and 64 bit fields, if aligned on byte boundaries. */
6406 if (INTVAL (operands[2]) % 8 != 0
6407 || (INTVAL (operands[1]) != 16
6408 && INTVAL (operands[1]) != 32
6409 && INTVAL (operands[1]) != 64))
6412 /* From mips.md: store_bit_field doesn't verify that our source
6413 matches the predicate, so we force it to be a MEM here. */
6414 if (GET_CODE (operands[0]) != MEM)
6417 /* The bit number is relative to the mode of operand 1 which is
6418 usually QImode (this might actually be a bug in expmed.c). Note
6419 that the bit number is negative in big-endian mode in this case.
6420 We have to convert that to the offset. */
6421 if (WORDS_BIG_ENDIAN)
6422 ofs = GET_MODE_BITSIZE (GET_MODE (operands[0]))
6423 - INTVAL (operands[1]) - INTVAL (operands[2]);
6425 ofs = INTVAL (operands[2]);
6429 alpha_expand_unaligned_store (operands[0], operands[3],
6430 INTVAL (operands[1]) / 8, ofs);
6434 ;; Block move/clear, see alpha.c for more details.
6435 ;; Argument 0 is the destination
6436 ;; Argument 1 is the source
6437 ;; Argument 2 is the length
6438 ;; Argument 3 is the alignment
6440 (define_expand "movmemqi"
6441 [(parallel [(set (match_operand:BLK 0 "memory_operand" "")
6442 (match_operand:BLK 1 "memory_operand" ""))
6443 (use (match_operand:DI 2 "immediate_operand" ""))
6444 (use (match_operand:DI 3 "immediate_operand" ""))])]
6447 if (alpha_expand_block_move (operands))
6453 (define_expand "movmemdi"
6454 [(parallel [(set (match_operand:BLK 0 "memory_operand" "")
6455 (match_operand:BLK 1 "memory_operand" ""))
6456 (use (match_operand:DI 2 "immediate_operand" ""))
6457 (use (match_operand:DI 3 "immediate_operand" ""))
6459 (clobber (reg:DI 25))
6460 (clobber (reg:DI 16))
6461 (clobber (reg:DI 17))
6462 (clobber (reg:DI 18))
6463 (clobber (reg:DI 19))
6464 (clobber (reg:DI 20))
6465 (clobber (reg:DI 26))
6466 (clobber (reg:DI 27))])]
6467 "TARGET_ABI_OPEN_VMS"
6469 operands[4] = gen_rtx_SYMBOL_REF (Pmode, "OTS$MOVE");
6470 alpha_need_linkage (XSTR (operands[4], 0), 0);
6473 (define_insn "*movmemdi_1"
6474 [(set (match_operand:BLK 0 "memory_operand" "=m,=m")
6475 (match_operand:BLK 1 "memory_operand" "m,m"))
6476 (use (match_operand:DI 2 "nonmemory_operand" "r,i"))
6477 (use (match_operand:DI 3 "immediate_operand" ""))
6478 (use (match_operand:DI 4 "call_operand" "i,i"))
6479 (clobber (reg:DI 25))
6480 (clobber (reg:DI 16))
6481 (clobber (reg:DI 17))
6482 (clobber (reg:DI 18))
6483 (clobber (reg:DI 19))
6484 (clobber (reg:DI 20))
6485 (clobber (reg:DI 26))
6486 (clobber (reg:DI 27))]
6487 "TARGET_ABI_OPEN_VMS"
6489 operands [5] = alpha_use_linkage (operands [4], cfun->decl, 0, 1);
6490 switch (which_alternative)
6493 return "lda $16,%0\;bis $31,%2,$17\;lda $18,%1\;ldq $26,%5\;lda $25,3($31)\;jsr $26,%4\;ldq $27,0($29)";
6495 return "lda $16,%0\;lda $17,%2($31)\;lda $18,%1\;ldq $26,%5\;lda $25,3($31)\;jsr $26,%4\;ldq $27,0($29)";
6500 [(set_attr "type" "multi")
6501 (set_attr "length" "28")])
6503 (define_expand "clrmemqi"
6504 [(parallel [(set (match_operand:BLK 0 "memory_operand" "")
6506 (use (match_operand:DI 1 "immediate_operand" ""))
6507 (use (match_operand:DI 2 "immediate_operand" ""))])]
6510 if (alpha_expand_block_clear (operands))
6516 (define_expand "clrmemdi"
6517 [(parallel [(set (match_operand:BLK 0 "memory_operand" "")
6519 (use (match_operand:DI 1 "immediate_operand" ""))
6520 (use (match_operand:DI 2 "immediate_operand" ""))
6522 (clobber (reg:DI 25))
6523 (clobber (reg:DI 16))
6524 (clobber (reg:DI 17))
6525 (clobber (reg:DI 26))
6526 (clobber (reg:DI 27))])]
6527 "TARGET_ABI_OPEN_VMS"
6529 operands[3] = gen_rtx_SYMBOL_REF (Pmode, "OTS$ZERO");
6530 alpha_need_linkage (XSTR (operands[3], 0), 0);
6533 (define_insn "*clrmemdi_1"
6534 [(set (match_operand:BLK 0 "memory_operand" "=m,=m")
6536 (use (match_operand:DI 1 "nonmemory_operand" "r,i"))
6537 (use (match_operand:DI 2 "immediate_operand" ""))
6538 (use (match_operand:DI 3 "call_operand" "i,i"))
6539 (clobber (reg:DI 25))
6540 (clobber (reg:DI 16))
6541 (clobber (reg:DI 17))
6542 (clobber (reg:DI 26))
6543 (clobber (reg:DI 27))]
6544 "TARGET_ABI_OPEN_VMS"
6546 operands [4] = alpha_use_linkage (operands [3], cfun->decl, 0, 1);
6547 switch (which_alternative)
6550 return "lda $16,%0\;bis $31,%1,$17\;ldq $26,%4\;lda $25,2($31)\;jsr $26,%3\;ldq $27,0($29)";
6552 return "lda $16,%0\;lda $17,%1($31)\;ldq $26,%4\;lda $25,2($31)\;jsr $26,%3\;ldq $27,0($29)";
6557 [(set_attr "type" "multi")
6558 (set_attr "length" "24")])
6561 ;; Subroutine of stack space allocation. Perform a stack probe.
6562 (define_expand "probe_stack"
6563 [(set (match_dup 1) (match_operand:DI 0 "const_int_operand" ""))]
6566 operands[1] = gen_rtx_MEM (DImode, plus_constant (stack_pointer_rtx,
6567 INTVAL (operands[0])));
6568 MEM_VOLATILE_P (operands[1]) = 1;
6570 operands[0] = const0_rtx;
6573 ;; This is how we allocate stack space. If we are allocating a
6574 ;; constant amount of space and we know it is less than 4096
6575 ;; bytes, we need do nothing.
6577 ;; If it is more than 4096 bytes, we need to probe the stack
6579 (define_expand "allocate_stack"
6581 (plus:DI (reg:DI 30)
6582 (match_operand:DI 1 "reg_or_cint_operand" "")))
6583 (set (match_operand:DI 0 "register_operand" "=r")
6587 if (GET_CODE (operands[1]) == CONST_INT
6588 && INTVAL (operands[1]) < 32768)
6590 if (INTVAL (operands[1]) >= 4096)
6592 /* We do this the same way as in the prologue and generate explicit
6593 probes. Then we update the stack by the constant. */
6597 emit_insn (gen_probe_stack (GEN_INT (- probed)));
6598 while (probed + 8192 < INTVAL (operands[1]))
6599 emit_insn (gen_probe_stack (GEN_INT (- (probed += 8192))));
6601 if (probed + 4096 < INTVAL (operands[1]))
6602 emit_insn (gen_probe_stack (GEN_INT (- INTVAL(operands[1]))));
6605 operands[1] = GEN_INT (- INTVAL (operands[1]));
6606 operands[2] = virtual_stack_dynamic_rtx;
6611 rtx loop_label = gen_label_rtx ();
6612 rtx want = gen_reg_rtx (Pmode);
6613 rtx tmp = gen_reg_rtx (Pmode);
6616 emit_insn (gen_subdi3 (want, stack_pointer_rtx,
6617 force_reg (Pmode, operands[1])));
6618 emit_insn (gen_adddi3 (tmp, stack_pointer_rtx, GEN_INT (-4096)));
6620 if (GET_CODE (operands[1]) != CONST_INT)
6622 out_label = gen_label_rtx ();
6623 emit_insn (gen_cmpdi (want, tmp));
6624 emit_jump_insn (gen_bgeu (out_label));
6627 emit_label (loop_label);
6628 memref = gen_rtx_MEM (DImode, tmp);
6629 MEM_VOLATILE_P (memref) = 1;
6630 emit_move_insn (memref, const0_rtx);
6631 emit_insn (gen_adddi3 (tmp, tmp, GEN_INT(-8192)));
6632 emit_insn (gen_cmpdi (tmp, want));
6633 emit_jump_insn (gen_bgtu (loop_label));
6635 memref = gen_rtx_MEM (DImode, want);
6636 MEM_VOLATILE_P (memref) = 1;
6637 emit_move_insn (memref, const0_rtx);
6640 emit_label (out_label);
6642 emit_move_insn (stack_pointer_rtx, want);
6643 emit_move_insn (operands[0], virtual_stack_dynamic_rtx);
6648 ;; This is used by alpha_expand_prolog to do the same thing as above,
6649 ;; except we cannot at that time generate new basic blocks, so we hide
6650 ;; the loop in this one insn.
6652 (define_insn "prologue_stack_probe_loop"
6653 [(unspec_volatile [(match_operand:DI 0 "register_operand" "r")
6654 (match_operand:DI 1 "register_operand" "r")]
6658 operands[2] = gen_label_rtx ();
6659 (*targetm.asm_out.internal_label) (asm_out_file, "L",
6660 CODE_LABEL_NUMBER (operands[2]));
6662 return "stq $31,-8192(%1)\;subq %0,1,%0\;lda %1,-8192(%1)\;bne %0,%l2";
6664 [(set_attr "length" "16")
6665 (set_attr "type" "multi")])
6667 (define_expand "prologue"
6668 [(clobber (const_int 0))]
6671 alpha_expand_prologue ();
6675 ;; These take care of emitting the ldgp insn in the prologue. This will be
6676 ;; an lda/ldah pair and we want to align them properly. So we have two
6677 ;; unspec_volatile insns, the first of which emits the ldgp assembler macro
6678 ;; and the second of which emits nothing. However, both are marked as type
6679 ;; IADD (the default) so the alignment code in alpha.c does the right thing
6682 (define_expand "prologue_ldgp"
6684 (unspec_volatile:DI [(match_dup 1) (match_dup 2)] UNSPECV_LDGP1))
6686 (unspec_volatile:DI [(match_dup 0) (match_dup 2)] UNSPECV_PLDGP2))]
6689 operands[0] = pic_offset_table_rtx;
6690 operands[1] = gen_rtx_REG (Pmode, 27);
6691 operands[2] = (TARGET_EXPLICIT_RELOCS
6692 ? GEN_INT (alpha_next_sequence_number++)
6696 (define_insn "*ldgp_er_1"
6697 [(set (match_operand:DI 0 "register_operand" "=r")
6698 (unspec_volatile:DI [(match_operand:DI 1 "register_operand" "r")
6699 (match_operand 2 "const_int_operand" "")]
6701 "TARGET_EXPLICIT_RELOCS && TARGET_ABI_OSF"
6702 "ldah %0,0(%1)\t\t!gpdisp!%2"
6703 [(set_attr "cannot_copy" "true")])
6705 (define_insn "*ldgp_er_2"
6706 [(set (match_operand:DI 0 "register_operand" "=r")
6707 (unspec:DI [(match_operand:DI 1 "register_operand" "r")
6708 (match_operand 2 "const_int_operand" "")]
6710 "TARGET_EXPLICIT_RELOCS && TARGET_ABI_OSF"
6711 "lda %0,0(%1)\t\t!gpdisp!%2"
6712 [(set_attr "cannot_copy" "true")])
6714 (define_insn "*prologue_ldgp_er_2"
6715 [(set (match_operand:DI 0 "register_operand" "=r")
6716 (unspec_volatile:DI [(match_operand:DI 1 "register_operand" "r")
6717 (match_operand 2 "const_int_operand" "")]
6719 "TARGET_EXPLICIT_RELOCS && TARGET_ABI_OSF"
6720 "lda %0,0(%1)\t\t!gpdisp!%2\n$%~..ng:"
6721 [(set_attr "cannot_copy" "true")])
6723 (define_insn "*prologue_ldgp_1"
6724 [(set (match_operand:DI 0 "register_operand" "=r")
6725 (unspec_volatile:DI [(match_operand:DI 1 "register_operand" "r")
6726 (match_operand 2 "const_int_operand" "")]
6729 "ldgp %0,0(%1)\n$%~..ng:"
6730 [(set_attr "cannot_copy" "true")])
6732 (define_insn "*prologue_ldgp_2"
6733 [(set (match_operand:DI 0 "register_operand" "=r")
6734 (unspec_volatile:DI [(match_operand:DI 1 "register_operand" "r")
6735 (match_operand 2 "const_int_operand" "")]
6740 ;; The _mcount profiling hook has special calling conventions, and
6741 ;; does not clobber all the registers that a normal call would. So
6742 ;; hide the fact this is a call at all.
6744 (define_insn "prologue_mcount"
6745 [(unspec_volatile [(const_int 0)] UNSPECV_MCOUNT)]
6748 if (TARGET_EXPLICIT_RELOCS)
6749 /* Note that we cannot use a lituse_jsr reloc, since _mcount
6750 cannot be called via the PLT. */
6751 return "ldq $28,_mcount($29)\t\t!literal\;jsr $28,($28),_mcount";
6753 return "lda $28,_mcount\;jsr $28,($28),_mcount";
6755 [(set_attr "type" "multi")
6756 (set_attr "length" "8")])
6758 (define_insn "init_fp"
6759 [(set (match_operand:DI 0 "register_operand" "=r")
6760 (match_operand:DI 1 "register_operand" "r"))
6761 (clobber (mem:BLK (match_operand:DI 2 "register_operand" "=r")))]
6765 (define_expand "epilogue"
6769 alpha_expand_epilogue ();
6772 (define_expand "sibcall_epilogue"
6776 alpha_expand_epilogue ();
6780 (define_expand "builtin_longjmp"
6781 [(use (match_operand:DI 0 "register_operand" "r"))]
6784 /* The elements of the buffer are, in order: */
6785 rtx fp = gen_rtx_MEM (Pmode, operands[0]);
6786 rtx lab = gen_rtx_MEM (Pmode, plus_constant (operands[0], 8));
6787 rtx stack = gen_rtx_MEM (Pmode, plus_constant (operands[0], 16));
6788 rtx pv = gen_rtx_REG (Pmode, 27);
6790 /* This bit is the same as expand_builtin_longjmp. */
6791 emit_move_insn (hard_frame_pointer_rtx, fp);
6792 emit_move_insn (pv, lab);
6793 emit_stack_restore (SAVE_NONLOCAL, stack, NULL_RTX);
6794 emit_insn (gen_rtx_USE (VOIDmode, hard_frame_pointer_rtx));
6795 emit_insn (gen_rtx_USE (VOIDmode, stack_pointer_rtx));
6797 /* Load the label we are jumping through into $27 so that we know
6798 where to look for it when we get back to setjmp's function for
6799 restoring the gp. */
6800 emit_jump_insn (gen_builtin_longjmp_internal (pv));
6805 ;; This is effectively a copy of indirect_jump, but constrained such
6806 ;; that register renaming cannot foil our cunning plan with $27.
6807 (define_insn "builtin_longjmp_internal"
6809 (unspec_volatile [(match_operand:DI 0 "register_operand" "c")]
6813 [(set_attr "type" "ibr")])
6815 (define_insn "*builtin_setjmp_receiver_er_sl_1"
6816 [(unspec_volatile [(label_ref (match_operand 0 "" ""))] UNSPECV_SETJMPR)]
6817 "TARGET_EXPLICIT_RELOCS && TARGET_ABI_OSF && TARGET_AS_CAN_SUBTRACT_LABELS"
6818 "lda $27,$LSJ%=-%l0($27)\n$LSJ%=:")
6820 (define_insn "*builtin_setjmp_receiver_er_1"
6821 [(unspec_volatile [(label_ref (match_operand 0 "" ""))] UNSPECV_SETJMPR)]
6822 "TARGET_EXPLICIT_RELOCS && TARGET_ABI_OSF"
6823 "br $27,$LSJ%=\n$LSJ%=:"
6824 [(set_attr "type" "ibr")])
6827 [(unspec_volatile [(label_ref (match_operand 0 "" ""))] UNSPECV_SETJMPR)]
6828 "TARGET_EXPLICIT_RELOCS && TARGET_ABI_OSF
6829 && prev_nonnote_insn (insn) == operands[0]"
6833 emit_note (NOTE_INSN_DELETED);
6837 (define_insn "*builtin_setjmp_receiver_1"
6838 [(unspec_volatile [(label_ref (match_operand 0 "" ""))] UNSPECV_SETJMPR)]
6840 "br $27,$LSJ%=\n$LSJ%=:\;ldgp $29,0($27)"
6841 [(set_attr "length" "12")
6842 (set_attr "type" "multi")])
6844 (define_expand "builtin_setjmp_receiver_er"
6845 [(unspec_volatile [(label_ref (match_operand 0 "" ""))] UNSPECV_SETJMPR)
6847 (unspec_volatile:DI [(match_dup 2) (match_dup 3)] UNSPECV_LDGP1))
6849 (unspec:DI [(match_dup 1) (match_dup 3)] UNSPEC_LDGP2))]
6852 operands[1] = pic_offset_table_rtx;
6853 operands[2] = gen_rtx_REG (Pmode, 27);
6854 operands[3] = GEN_INT (alpha_next_sequence_number++);
6857 (define_expand "builtin_setjmp_receiver"
6858 [(unspec_volatile [(label_ref (match_operand 0 "" ""))] UNSPECV_SETJMPR)]
6861 if (TARGET_EXPLICIT_RELOCS)
6863 emit_insn (gen_builtin_setjmp_receiver_er (operands[0]));
6868 (define_expand "exception_receiver_er"
6870 (unspec_volatile:DI [(match_dup 1) (match_dup 2)] UNSPECV_LDGP1))
6872 (unspec:DI [(match_dup 0) (match_dup 2)] UNSPEC_LDGP2))]
6875 operands[0] = pic_offset_table_rtx;
6876 operands[1] = gen_rtx_REG (Pmode, 26);
6877 operands[2] = GEN_INT (alpha_next_sequence_number++);
6880 (define_expand "exception_receiver"
6881 [(unspec_volatile [(match_dup 0)] UNSPECV_EHR)]
6884 if (TARGET_LD_BUGGY_LDGP)
6885 operands[0] = alpha_gp_save_rtx ();
6886 else if (TARGET_EXPLICIT_RELOCS)
6888 emit_insn (gen_exception_receiver_er ());
6892 operands[0] = const0_rtx;
6895 (define_insn "*exception_receiver_1"
6896 [(unspec_volatile [(const_int 0)] UNSPECV_EHR)]
6897 "! TARGET_LD_BUGGY_LDGP"
6899 [(set_attr "length" "8")
6900 (set_attr "type" "multi")])
6902 (define_insn "*exception_receiver_2"
6903 [(unspec_volatile [(match_operand:DI 0 "memory_operand" "m")] UNSPECV_EHR)]
6904 "TARGET_LD_BUGGY_LDGP"
6906 [(set_attr "type" "ild")])
6908 (define_expand "nonlocal_goto_receiver"
6909 [(unspec_volatile [(const_int 0)] UNSPECV_BLOCKAGE)
6910 (set (reg:DI 27) (mem:DI (reg:DI 29)))
6911 (unspec_volatile [(const_int 0)] UNSPECV_BLOCKAGE)
6913 "TARGET_ABI_OPEN_VMS"
6916 (define_insn "arg_home"
6917 [(unspec [(const_int 0)] UNSPEC_ARG_HOME)
6932 (clobber (mem:BLK (const_int 0)))
6933 (clobber (reg:DI 24))
6934 (clobber (reg:DI 25))
6935 (clobber (reg:DI 0))]
6936 "TARGET_ABI_OPEN_VMS"
6937 "lda $0,OTS$HOME_ARGS\;ldq $0,8($0)\;jsr $0,OTS$HOME_ARGS"
6938 [(set_attr "length" "16")
6939 (set_attr "type" "multi")])
6941 ;; Load the CIW into r2 for calling __T3E_MISMATCH
6943 (define_expand "umk_mismatch_args"
6944 [(set:DI (match_dup 1) (mem:DI (plus:DI (reg:DI 15) (const_int -16))))
6945 (set:DI (match_dup 2) (mem:DI (plus:DI (match_dup 1) (const_int -32))))
6946 (set:DI (reg:DI 1) (match_operand:DI 0 "const_int_operand" ""))
6947 (set:DI (match_dup 3) (plus:DI (mult:DI (reg:DI 25)
6950 (set:DI (reg:DI 2) (mem:DI (match_dup 3)))]
6951 "TARGET_ABI_UNICOSMK"
6953 operands[1] = gen_reg_rtx (DImode);
6954 operands[2] = gen_reg_rtx (DImode);
6955 operands[3] = gen_reg_rtx (DImode);
6958 (define_insn "arg_home_umk"
6959 [(unspec [(const_int 0)] UNSPEC_ARG_HOME)
6974 (clobber (mem:BLK (const_int 0)))
6976 (clobber (reg:DI 22))
6977 (clobber (reg:DI 23))
6978 (clobber (reg:DI 24))
6979 (clobber (reg:DI 0))
6980 (clobber (reg:DI 1))
6981 (clobber (reg:DI 2))
6982 (clobber (reg:DI 3))
6983 (clobber (reg:DI 4))
6984 (clobber (reg:DI 5))
6985 (clobber (reg:DI 6))
6986 (clobber (reg:DI 7))
6987 (clobber (reg:DI 8))])]
6988 "TARGET_ABI_UNICOSMK"
6989 "laum $4,__T3E_MISMATCH($31)\;sll $4,32,$4\;lalm $4,__T3E_MISMATCH($4)\;lal $4,__T3E_MISMATCH($4)\;jsr $3,($4)"
6990 [(set_attr "length" "16")
6991 (set_attr "type" "multi")])
6995 ;; On EV4, these instructions are nops -- no load occurs.
6997 ;; On EV5, these instructions act as a normal load, and thus can trap
6998 ;; if the address is invalid. The OS may (or may not) handle this in
6999 ;; the entMM fault handler and suppress the fault. If so, then this
7000 ;; has the effect of a read prefetch instruction.
7002 ;; On EV6, these become official prefetch instructions.
7004 (define_insn "prefetch"
7005 [(prefetch (match_operand:DI 0 "address_operand" "p")
7006 (match_operand:DI 1 "const_int_operand" "n")
7007 (match_operand:DI 2 "const_int_operand" "n"))]
7008 "TARGET_FIXUP_EV5_PREFETCH || TARGET_CPU_EV6"
7010 /* Interpret "no temporal locality" as this data should be evicted once
7011 it is used. The "evict next" alternatives load the data into the cache
7012 and leave the LRU eviction counter pointing to that block. */
7013 static const char * const alt[2][2] = {
7015 "ldq $31,%a0", /* read, evict next */
7016 "ldl $31,%a0", /* read, evict last */
7019 "ldt $f31,%a0", /* write, evict next */
7020 "lds $f31,%a0", /* write, evict last */
7024 bool write = INTVAL (operands[1]) != 0;
7025 bool lru = INTVAL (operands[2]) != 0;
7027 return alt[write][lru];
7029 [(set_attr "type" "ild")])
7031 ;; Close the trap shadow of preceding instructions. This is generated
7034 (define_insn "trapb"
7035 [(unspec_volatile [(const_int 0)] UNSPECV_TRAPB)]
7038 [(set_attr "type" "misc")])
7040 ;; No-op instructions used by machine-dependent reorg to preserve
7041 ;; alignment for instruction issue.
7042 ;; The Unicos/Mk assembler does not support these opcodes.
7048 [(set_attr "type" "ilog")])
7053 "cpys $f31,$f31,$f31"
7054 [(set_attr "type" "fcpys")])
7061 ;; On Unicos/Mk we use a macro for aligning code.
7063 (define_insn "realign"
7064 [(unspec_volatile [(match_operand 0 "immediate_operand" "i")]
7068 if (TARGET_ABI_UNICOSMK)
7069 return "gcc@code@align %0";
7071 return ".align %0 #realign";
7074 ;; Instructions to be emitted from __builtins.
7076 (define_insn "builtin_cmpbge"
7077 [(set (match_operand:DI 0 "register_operand" "=r")
7078 (unspec:DI [(match_operand:DI 1 "reg_or_0_operand" "rJ")
7079 (match_operand:DI 2 "reg_or_8bit_operand" "rI")]
7083 ;; The EV6 data sheets list this as ILOG. OTOH, EV6 doesn't
7084 ;; actually differentiate between ILOG and ICMP in the schedule.
7085 [(set_attr "type" "icmp")])
7087 (define_expand "builtin_extbl"
7088 [(match_operand:DI 0 "register_operand" "")
7089 (match_operand:DI 1 "reg_or_0_operand" "")
7090 (match_operand:DI 2 "reg_or_8bit_operand" "")]
7093 rtx (*gen) (rtx, rtx, rtx, rtx);
7094 if (WORDS_BIG_ENDIAN)
7098 emit_insn ((*gen) (operands[0], operands[1], GEN_INT (8), operands[2]));
7102 (define_expand "builtin_extwl"
7103 [(match_operand:DI 0 "register_operand" "")
7104 (match_operand:DI 1 "reg_or_0_operand" "")
7105 (match_operand:DI 2 "reg_or_8bit_operand" "")]
7108 rtx (*gen) (rtx, rtx, rtx, rtx);
7109 if (WORDS_BIG_ENDIAN)
7113 emit_insn ((*gen) (operands[0], operands[1], GEN_INT (16), operands[2]));
7117 (define_expand "builtin_extll"
7118 [(match_operand:DI 0 "register_operand" "")
7119 (match_operand:DI 1 "reg_or_0_operand" "")
7120 (match_operand:DI 2 "reg_or_8bit_operand" "")]
7123 rtx (*gen) (rtx, rtx, rtx, rtx);
7124 if (WORDS_BIG_ENDIAN)
7128 emit_insn ((*gen) (operands[0], operands[1], GEN_INT (32), operands[2]));
7132 (define_expand "builtin_extql"
7133 [(match_operand:DI 0 "register_operand" "")
7134 (match_operand:DI 1 "reg_or_0_operand" "")
7135 (match_operand:DI 2 "reg_or_8bit_operand" "")]
7138 rtx (*gen) (rtx, rtx, rtx, rtx);
7139 if (WORDS_BIG_ENDIAN)
7143 emit_insn ((*gen) (operands[0], operands[1], GEN_INT (64), operands[2]));
7147 (define_expand "builtin_extwh"
7148 [(match_operand:DI 0 "register_operand" "")
7149 (match_operand:DI 1 "reg_or_0_operand" "")
7150 (match_operand:DI 2 "reg_or_8bit_operand" "")]
7153 rtx (*gen) (rtx, rtx, rtx);
7154 if (WORDS_BIG_ENDIAN)
7158 emit_insn ((*gen) (operands[0], operands[1], operands[2]));
7162 (define_expand "builtin_extlh"
7163 [(match_operand:DI 0 "register_operand" "")
7164 (match_operand:DI 1 "reg_or_0_operand" "")
7165 (match_operand:DI 2 "reg_or_8bit_operand" "")]
7168 rtx (*gen) (rtx, rtx, rtx);
7169 if (WORDS_BIG_ENDIAN)
7173 emit_insn ((*gen) (operands[0], operands[1], operands[2]));
7177 (define_expand "builtin_extqh"
7178 [(match_operand:DI 0 "register_operand" "")
7179 (match_operand:DI 1 "reg_or_0_operand" "")
7180 (match_operand:DI 2 "reg_or_8bit_operand" "")]
7183 rtx (*gen) (rtx, rtx, rtx);
7184 if (WORDS_BIG_ENDIAN)
7188 emit_insn ((*gen) (operands[0], operands[1], operands[2]));
7192 (define_expand "builtin_insbl"
7193 [(match_operand:DI 0 "register_operand" "")
7194 (match_operand:DI 1 "register_operand" "")
7195 (match_operand:DI 2 "reg_or_8bit_operand" "")]
7198 rtx (*gen) (rtx, rtx, rtx);
7199 if (WORDS_BIG_ENDIAN)
7203 operands[1] = gen_lowpart (QImode, operands[1]);
7204 emit_insn ((*gen) (operands[0], operands[1], operands[2]));
7208 (define_expand "builtin_inswl"
7209 [(match_operand:DI 0 "register_operand" "")
7210 (match_operand:DI 1 "register_operand" "")
7211 (match_operand:DI 2 "reg_or_8bit_operand" "")]
7214 rtx (*gen) (rtx, rtx, rtx);
7215 if (WORDS_BIG_ENDIAN)
7219 operands[1] = gen_lowpart (HImode, operands[1]);
7220 emit_insn ((*gen) (operands[0], operands[1], operands[2]));
7224 (define_expand "builtin_insll"
7225 [(match_operand:DI 0 "register_operand" "")
7226 (match_operand:DI 1 "register_operand" "")
7227 (match_operand:DI 2 "reg_or_8bit_operand" "")]
7230 rtx (*gen) (rtx, rtx, rtx);
7231 if (WORDS_BIG_ENDIAN)
7235 operands[1] = gen_lowpart (SImode, operands[1]);
7236 emit_insn ((*gen) (operands[0], operands[1], operands[2]));
7237 emit_insn ((*gen) (operands[0], operands[1], operands[2]));
7241 (define_expand "builtin_insql"
7242 [(match_operand:DI 0 "register_operand" "")
7243 (match_operand:DI 1 "reg_or_0_operand" "")
7244 (match_operand:DI 2 "reg_or_8bit_operand" "")]
7247 rtx (*gen) (rtx, rtx, rtx);
7248 if (WORDS_BIG_ENDIAN)
7252 emit_insn ((*gen) (operands[0], operands[1], operands[2]));
7256 (define_expand "builtin_inswh"
7257 [(match_operand:DI 0 "register_operand" "")
7258 (match_operand:DI 1 "register_operand" "")
7259 (match_operand:DI 2 "reg_or_8bit_operand" "")]
7262 emit_insn (gen_insxh (operands[0], operands[1], GEN_INT (16), operands[2]));
7266 (define_expand "builtin_inslh"
7267 [(match_operand:DI 0 "register_operand" "")
7268 (match_operand:DI 1 "register_operand" "")
7269 (match_operand:DI 2 "reg_or_8bit_operand" "")]
7272 emit_insn (gen_insxh (operands[0], operands[1], GEN_INT (32), operands[2]));
7276 (define_expand "builtin_insqh"
7277 [(match_operand:DI 0 "register_operand" "")
7278 (match_operand:DI 1 "register_operand" "")
7279 (match_operand:DI 2 "reg_or_8bit_operand" "")]
7282 emit_insn (gen_insxh (operands[0], operands[1], GEN_INT (64), operands[2]));
7286 (define_expand "builtin_mskbl"
7287 [(match_operand:DI 0 "register_operand" "")
7288 (match_operand:DI 1 "reg_or_0_operand" "")
7289 (match_operand:DI 2 "reg_or_8bit_operand" "")]
7292 rtx (*gen) (rtx, rtx, rtx, rtx);
7294 if (WORDS_BIG_ENDIAN)
7298 mask = GEN_INT (0xff);
7299 emit_insn ((*gen) (operands[0], operands[1], mask, operands[2]));
7303 (define_expand "builtin_mskwl"
7304 [(match_operand:DI 0 "register_operand" "")
7305 (match_operand:DI 1 "reg_or_0_operand" "")
7306 (match_operand:DI 2 "reg_or_8bit_operand" "")]
7309 rtx (*gen) (rtx, rtx, rtx, rtx);
7311 if (WORDS_BIG_ENDIAN)
7315 mask = GEN_INT (0xffff);
7316 emit_insn ((*gen) (operands[0], operands[1], mask, operands[2]));
7320 (define_expand "builtin_mskll"
7321 [(match_operand:DI 0 "register_operand" "")
7322 (match_operand:DI 1 "reg_or_0_operand" "")
7323 (match_operand:DI 2 "reg_or_8bit_operand" "")]
7326 rtx (*gen) (rtx, rtx, rtx, rtx);
7328 if (WORDS_BIG_ENDIAN)
7332 mask = immed_double_const (0xffffffff, 0, DImode);
7333 emit_insn ((*gen) (operands[0], operands[1], mask, operands[2]));
7337 (define_expand "builtin_mskql"
7338 [(match_operand:DI 0 "register_operand" "")
7339 (match_operand:DI 1 "reg_or_0_operand" "")
7340 (match_operand:DI 2 "reg_or_8bit_operand" "")]
7343 rtx (*gen) (rtx, rtx, rtx, rtx);
7345 if (WORDS_BIG_ENDIAN)
7350 emit_insn ((*gen) (operands[0], operands[1], mask, operands[2]));
7354 (define_expand "builtin_mskwh"
7355 [(match_operand:DI 0 "register_operand" "")
7356 (match_operand:DI 1 "register_operand" "")
7357 (match_operand:DI 2 "reg_or_8bit_operand" "")]
7360 emit_insn (gen_mskxh (operands[0], operands[1], GEN_INT (16), operands[2]));
7364 (define_expand "builtin_msklh"
7365 [(match_operand:DI 0 "register_operand" "")
7366 (match_operand:DI 1 "register_operand" "")
7367 (match_operand:DI 2 "reg_or_8bit_operand" "")]
7370 emit_insn (gen_mskxh (operands[0], operands[1], GEN_INT (32), operands[2]));
7374 (define_expand "builtin_mskqh"
7375 [(match_operand:DI 0 "register_operand" "")
7376 (match_operand:DI 1 "register_operand" "")
7377 (match_operand:DI 2 "reg_or_8bit_operand" "")]
7380 emit_insn (gen_mskxh (operands[0], operands[1], GEN_INT (64), operands[2]));
7384 (define_expand "builtin_zap"
7385 [(set (match_operand:DI 0 "register_operand" "")
7387 [(match_operand:DI 2 "reg_or_cint_operand" "")]
7389 (match_operand:DI 1 "reg_or_cint_operand" "")))]
7392 if (GET_CODE (operands[2]) == CONST_INT)
7394 rtx mask = alpha_expand_zap_mask (INTVAL (operands[2]));
7396 if (mask == const0_rtx)
7398 emit_move_insn (operands[0], const0_rtx);
7401 if (mask == constm1_rtx)
7403 emit_move_insn (operands[0], operands[1]);
7407 operands[1] = force_reg (DImode, operands[1]);
7408 emit_insn (gen_anddi3 (operands[0], operands[1], mask));
7412 operands[1] = force_reg (DImode, operands[1]);
7413 operands[2] = gen_lowpart (QImode, operands[2]);
7416 (define_insn "*builtin_zap_1"
7417 [(set (match_operand:DI 0 "register_operand" "=r,r,r,r")
7419 [(match_operand:QI 2 "reg_or_cint_operand" "n,n,r,r")]
7421 (match_operand:DI 1 "reg_or_cint_operand" "n,r,J,r")))]
7428 [(set_attr "type" "shift,shift,ilog,shift")])
7431 [(set (match_operand:DI 0 "register_operand" "")
7433 [(match_operand:QI 2 "const_int_operand" "")]
7435 (match_operand:DI 1 "const_int_operand" "")))]
7439 rtx mask = alpha_expand_zap_mask (INTVAL (operands[2]));
7440 if (HOST_BITS_PER_WIDE_INT >= 64 || GET_CODE (mask) == CONST_INT)
7441 operands[1] = gen_int_mode (INTVAL (operands[1]) & INTVAL (mask), DImode);
7444 HOST_WIDE_INT c_lo = INTVAL (operands[1]);
7445 HOST_WIDE_INT c_hi = (c_lo < 0 ? -1 : 0);
7446 operands[1] = immed_double_const (c_lo & CONST_DOUBLE_LOW (mask),
7447 c_hi & CONST_DOUBLE_HIGH (mask),
7450 emit_move_insn (operands[0], operands[1]);
7455 [(set (match_operand:DI 0 "register_operand" "")
7457 [(match_operand:QI 2 "const_int_operand" "")]
7459 (match_operand:DI 1 "register_operand" "")))]
7462 (and:DI (match_dup 1) (match_dup 2)))]
7464 operands[2] = alpha_expand_zap_mask (INTVAL (operands[2]));
7465 if (operands[2] == const0_rtx)
7467 emit_move_insn (operands[0], const0_rtx);
7470 if (operands[2] == constm1_rtx)
7472 emit_move_insn (operands[0], operands[1]);
7477 (define_expand "builtin_zapnot"
7478 [(set (match_operand:DI 0 "register_operand" "")
7480 [(not:QI (match_operand:DI 2 "reg_or_cint_operand" ""))]
7482 (match_operand:DI 1 "reg_or_cint_operand" "")))]
7485 if (GET_CODE (operands[2]) == CONST_INT)
7487 rtx mask = alpha_expand_zap_mask (~ INTVAL (operands[2]));
7489 if (mask == const0_rtx)
7491 emit_move_insn (operands[0], const0_rtx);
7494 if (mask == constm1_rtx)
7496 emit_move_insn (operands[0], operands[1]);
7500 operands[1] = force_reg (DImode, operands[1]);
7501 emit_insn (gen_anddi3 (operands[0], operands[1], mask));
7505 operands[1] = force_reg (DImode, operands[1]);
7506 operands[2] = gen_lowpart (QImode, operands[2]);
7509 (define_insn "*builtin_zapnot_1"
7510 [(set (match_operand:DI 0 "register_operand" "=r")
7512 [(not:QI (match_operand:QI 2 "register_operand" "r"))]
7514 (match_operand:DI 1 "reg_or_0_operand" "rJ")))]
7517 [(set_attr "type" "shift")])
7519 (define_insn "builtin_amask"
7520 [(set (match_operand:DI 0 "register_operand" "=r")
7521 (unspec:DI [(match_operand:DI 1 "reg_or_8bit_operand" "rI")]
7525 [(set_attr "type" "ilog")])
7527 (define_insn "builtin_implver"
7528 [(set (match_operand:DI 0 "register_operand" "=r")
7529 (unspec:DI [(const_int 0)] UNSPEC_IMPLVER))]
7532 [(set_attr "type" "ilog")])
7534 (define_insn "builtin_rpcc"
7535 [(set (match_operand:DI 0 "register_operand" "=r")
7536 (unspec_volatile:DI [(const_int 0)] UNSPECV_RPCC))]
7539 [(set_attr "type" "ilog")])
7541 (define_expand "builtin_minub8"
7542 [(match_operand:DI 0 "register_operand" "")
7543 (match_operand:DI 1 "reg_or_0_operand" "")
7544 (match_operand:DI 2 "reg_or_0_operand" "")]
7547 alpha_expand_builtin_vector_binop (gen_uminv8qi3, V8QImode, operands[0],
7548 operands[1], operands[2]);
7552 (define_expand "builtin_minsb8"
7553 [(match_operand:DI 0 "register_operand" "")
7554 (match_operand:DI 1 "reg_or_0_operand" "")
7555 (match_operand:DI 2 "reg_or_0_operand" "")]
7558 alpha_expand_builtin_vector_binop (gen_sminv8qi3, V8QImode, operands[0],
7559 operands[1], operands[2]);
7563 (define_expand "builtin_minuw4"
7564 [(match_operand:DI 0 "register_operand" "")
7565 (match_operand:DI 1 "reg_or_0_operand" "")
7566 (match_operand:DI 2 "reg_or_0_operand" "")]
7569 alpha_expand_builtin_vector_binop (gen_uminv4hi3, V4HImode, operands[0],
7570 operands[1], operands[2]);
7574 (define_expand "builtin_minsw4"
7575 [(match_operand:DI 0 "register_operand" "")
7576 (match_operand:DI 1 "reg_or_0_operand" "")
7577 (match_operand:DI 2 "reg_or_0_operand" "")]
7580 alpha_expand_builtin_vector_binop (gen_sminv4hi3, V4HImode, operands[0],
7581 operands[1], operands[2]);
7585 (define_expand "builtin_maxub8"
7586 [(match_operand:DI 0 "register_operand" "")
7587 (match_operand:DI 1 "reg_or_0_operand" "")
7588 (match_operand:DI 2 "reg_or_0_operand" "")]
7591 alpha_expand_builtin_vector_binop (gen_umaxv8qi3, V8QImode, operands[0],
7592 operands[1], operands[2]);
7596 (define_expand "builtin_maxsb8"
7597 [(match_operand:DI 0 "register_operand" "")
7598 (match_operand:DI 1 "reg_or_0_operand" "")
7599 (match_operand:DI 2 "reg_or_0_operand" "")]
7602 alpha_expand_builtin_vector_binop (gen_smaxv8qi3, V8QImode, operands[0],
7603 operands[1], operands[2]);
7607 (define_expand "builtin_maxuw4"
7608 [(match_operand:DI 0 "register_operand" "")
7609 (match_operand:DI 1 "reg_or_0_operand" "")
7610 (match_operand:DI 2 "reg_or_0_operand" "")]
7613 alpha_expand_builtin_vector_binop (gen_umaxv4hi3, V4HImode, operands[0],
7614 operands[1], operands[2]);
7618 (define_expand "builtin_maxsw4"
7619 [(match_operand:DI 0 "register_operand" "")
7620 (match_operand:DI 1 "reg_or_0_operand" "")
7621 (match_operand:DI 2 "reg_or_0_operand" "")]
7624 alpha_expand_builtin_vector_binop (gen_smaxv4hi3, V4HImode, operands[0],
7625 operands[1], operands[2]);
7629 (define_insn "builtin_perr"
7630 [(set (match_operand:DI 0 "register_operand" "=r")
7631 (unspec:DI [(match_operand:DI 1 "reg_or_0_operand" "%rJ")
7632 (match_operand:DI 2 "reg_or_8bit_operand" "rJ")]
7636 [(set_attr "type" "mvi")])
7638 (define_expand "builtin_pklb"
7639 [(set (match_operand:DI 0 "register_operand" "")
7642 (truncate:V2QI (match_operand:DI 1 "register_operand" ""))
7647 operands[0] = gen_lowpart (V8QImode, operands[0]);
7648 operands[1] = gen_lowpart (V2SImode, operands[1]);
7649 operands[2] = CONST0_RTX (V2QImode);
7650 operands[3] = CONST0_RTX (V4QImode);
7653 (define_insn "*pklb"
7654 [(set (match_operand:V8QI 0 "register_operand" "=r")
7657 (truncate:V2QI (match_operand:V2SI 1 "register_operand" "r"))
7658 (match_operand:V2QI 2 "const0_operand" ""))
7659 (match_operand:V4QI 3 "const0_operand" "")))]
7662 [(set_attr "type" "mvi")])
7664 (define_expand "builtin_pkwb"
7665 [(set (match_operand:DI 0 "register_operand" "")
7667 (truncate:V4QI (match_operand:DI 1 "register_operand" ""))
7671 operands[0] = gen_lowpart (V8QImode, operands[0]);
7672 operands[1] = gen_lowpart (V4HImode, operands[1]);
7673 operands[2] = CONST0_RTX (V4QImode);
7676 (define_insn "*pkwb"
7677 [(set (match_operand:V8QI 0 "register_operand" "=r")
7679 (truncate:V4QI (match_operand:V4HI 1 "register_operand" "r"))
7680 (match_operand:V4QI 2 "const0_operand" "")))]
7683 [(set_attr "type" "mvi")])
7685 (define_expand "builtin_unpkbl"
7686 [(set (match_operand:DI 0 "register_operand" "")
7688 (vec_select:V2QI (match_operand:DI 1 "register_operand" "")
7689 (parallel [(const_int 0) (const_int 1)]))))]
7692 operands[0] = gen_lowpart (V2SImode, operands[0]);
7693 operands[1] = gen_lowpart (V8QImode, operands[1]);
7696 (define_insn "*unpkbl"
7697 [(set (match_operand:V2SI 0 "register_operand" "=r")
7699 (vec_select:V2QI (match_operand:V8QI 1 "reg_or_0_operand" "rW")
7700 (parallel [(const_int 0) (const_int 1)]))))]
7703 [(set_attr "type" "mvi")])
7705 (define_expand "builtin_unpkbw"
7706 [(set (match_operand:DI 0 "register_operand" "")
7708 (vec_select:V4QI (match_operand:DI 1 "register_operand" "")
7709 (parallel [(const_int 0)
7715 operands[0] = gen_lowpart (V4HImode, operands[0]);
7716 operands[1] = gen_lowpart (V8QImode, operands[1]);
7719 (define_insn "*unpkbw"
7720 [(set (match_operand:V4HI 0 "register_operand" "=r")
7722 (vec_select:V4QI (match_operand:V8QI 1 "reg_or_0_operand" "rW")
7723 (parallel [(const_int 0)
7729 [(set_attr "type" "mvi")])
7731 (define_expand "builtin_cttz"
7732 [(set (match_operand:DI 0 "register_operand" "")
7733 (unspec:DI [(match_operand:DI 1 "register_operand" "")]
7738 (define_insn "builtin_ctlz"
7739 [(set (match_operand:DI 0 "register_operand" "=r")
7740 (unspec:DI [(match_operand:DI 1 "register_operand" "r")]
7744 [(set_attr "type" "mvi")])
7746 (define_insn "builtin_ctpop"
7747 [(set (match_operand:DI 0 "register_operand" "=r")
7748 (unspec:DI [(match_operand:DI 1 "register_operand" "r")]
7752 [(set_attr "type" "mvi")])
7754 ;; The call patterns are at the end of the file because their
7755 ;; wildcard operand0 interferes with nice recognition.
7757 (define_insn "*call_value_osf_1_er"
7758 [(set (match_operand 0 "" "")
7759 (call (mem:DI (match_operand:DI 1 "call_operand" "c,R,s"))
7760 (match_operand 2 "" "")))
7762 (clobber (reg:DI 26))]
7763 "TARGET_EXPLICIT_RELOCS && TARGET_ABI_OSF"
7765 jsr $26,(%1),0\;ldah $29,0($26)\t\t!gpdisp!%*\;lda $29,0($29)\t\t!gpdisp!%*
7766 bsr $26,%1\t\t!samegp
7767 ldq $27,%1($29)\t\t!literal!%#\;jsr $26,($27),0\t\t!lituse_jsr!%#\;ldah $29,0($26)\t\t!gpdisp!%*\;lda $29,0($29)\t\t!gpdisp!%*"
7768 [(set_attr "type" "jsr")
7769 (set_attr "length" "12,*,16")])
7771 ;; We must use peep2 instead of a split because we need accurate life
7772 ;; information for $gp. Consider the case of { bar(); while (1); }.
7774 [(parallel [(set (match_operand 0 "" "")
7775 (call (mem:DI (match_operand:DI 1 "call_operand" ""))
7776 (match_operand 2 "" "")))
7778 (clobber (reg:DI 26))])]
7779 "TARGET_EXPLICIT_RELOCS && TARGET_ABI_OSF && reload_completed
7780 && ! samegp_function_operand (operands[1], Pmode)
7781 && (peep2_regno_dead_p (1, 29)
7782 || find_reg_note (insn, REG_NORETURN, NULL_RTX))"
7783 [(parallel [(set (match_dup 0)
7784 (call (mem:DI (match_dup 3))
7786 (set (reg:DI 26) (plus:DI (pc) (const_int 4)))
7787 (unspec_volatile [(reg:DI 29)] UNSPECV_BLOCKAGE)
7789 (use (match_dup 4))])]
7791 if (CONSTANT_P (operands[1]))
7793 operands[3] = gen_rtx_REG (Pmode, 27);
7794 operands[4] = GEN_INT (alpha_next_sequence_number++);
7795 emit_insn (gen_movdi_er_high_g (operands[3], pic_offset_table_rtx,
7796 operands[1], operands[4]));
7800 operands[3] = operands[1];
7801 operands[1] = const0_rtx;
7802 operands[4] = const0_rtx;
7807 [(parallel [(set (match_operand 0 "" "")
7808 (call (mem:DI (match_operand:DI 1 "call_operand" ""))
7809 (match_operand 2 "" "")))
7811 (clobber (reg:DI 26))])]
7812 "TARGET_EXPLICIT_RELOCS && TARGET_ABI_OSF && reload_completed
7813 && ! samegp_function_operand (operands[1], Pmode)
7814 && ! (peep2_regno_dead_p (1, 29)
7815 || find_reg_note (insn, REG_NORETURN, NULL_RTX))"
7816 [(parallel [(set (match_dup 0)
7817 (call (mem:DI (match_dup 3))
7819 (set (reg:DI 26) (plus:DI (pc) (const_int 4)))
7820 (unspec_volatile [(reg:DI 29)] UNSPECV_BLOCKAGE)
7822 (use (match_dup 5))])
7824 (unspec_volatile:DI [(reg:DI 26) (match_dup 4)] UNSPECV_LDGP1))
7826 (unspec:DI [(reg:DI 29) (match_dup 4)] UNSPEC_LDGP2))]
7828 if (CONSTANT_P (operands[1]))
7830 operands[3] = gen_rtx_REG (Pmode, 27);
7831 operands[5] = GEN_INT (alpha_next_sequence_number++);
7832 emit_insn (gen_movdi_er_high_g (operands[3], pic_offset_table_rtx,
7833 operands[1], operands[5]));
7837 operands[3] = operands[1];
7838 operands[1] = const0_rtx;
7839 operands[5] = const0_rtx;
7841 operands[4] = GEN_INT (alpha_next_sequence_number++);
7844 ;; We add a blockage unspec_volatile to prevent insns from moving down
7845 ;; from above the call to in between the call and the ldah gpdisp.
7846 (define_insn "*call_value_osf_2_er"
7847 [(set (match_operand 0 "" "")
7848 (call (mem:DI (match_operand:DI 1 "register_operand" "c"))
7849 (match_operand 2 "" "")))
7851 (plus:DI (pc) (const_int 4)))
7852 (unspec_volatile [(reg:DI 29)] UNSPECV_BLOCKAGE)
7853 (use (match_operand 3 "" ""))
7854 (use (match_operand 4 "" ""))]
7855 "TARGET_EXPLICIT_RELOCS && TARGET_ABI_OSF"
7856 "jsr $26,(%1),%3%J4"
7857 [(set_attr "type" "jsr")
7858 (set_attr "cannot_copy" "true")])
7860 (define_insn "*call_value_osf_1_noreturn"
7861 [(set (match_operand 0 "" "")
7862 (call (mem:DI (match_operand:DI 1 "call_operand" "c,R,s"))
7863 (match_operand 2 "" "")))
7865 (clobber (reg:DI 26))]
7866 "! TARGET_EXPLICIT_RELOCS && TARGET_ABI_OSF
7867 && find_reg_note (insn, REG_NORETURN, NULL_RTX)"
7872 [(set_attr "type" "jsr")
7873 (set_attr "length" "*,*,8")])
7875 (define_insn_and_split "call_value_osf_tlsgd"
7876 [(set (match_operand 0 "" "")
7877 (call (mem:DI (match_operand:DI 1 "symbolic_operand" ""))
7879 (unspec [(match_operand:DI 2 "const_int_operand" "")] UNSPEC_TLSGD_CALL)
7881 (clobber (reg:DI 26))]
7884 "&& reload_completed"
7886 (unspec:DI [(match_dup 5)
7888 (match_dup 2)] UNSPEC_LITERAL))
7889 (parallel [(set (match_dup 0)
7890 (call (mem:DI (match_dup 3))
7892 (set (reg:DI 26) (plus:DI (pc) (const_int 4)))
7893 (unspec_volatile [(match_dup 5)] UNSPECV_BLOCKAGE)
7895 (use (unspec [(match_dup 2)] UNSPEC_TLSGD_CALL))])
7897 (unspec_volatile:DI [(reg:DI 26) (match_dup 4)] UNSPECV_LDGP1))
7899 (unspec:DI [(match_dup 5) (match_dup 4)] UNSPEC_LDGP2))]
7901 operands[3] = gen_rtx_REG (Pmode, 27);
7902 operands[4] = GEN_INT (alpha_next_sequence_number++);
7903 operands[5] = pic_offset_table_rtx;
7905 [(set_attr "type" "multi")])
7907 (define_insn_and_split "call_value_osf_tlsldm"
7908 [(set (match_operand 0 "" "")
7909 (call (mem:DI (match_operand:DI 1 "symbolic_operand" ""))
7911 (unspec [(match_operand:DI 2 "const_int_operand" "")] UNSPEC_TLSLDM_CALL)
7913 (clobber (reg:DI 26))]
7916 "&& reload_completed"
7918 (unspec:DI [(match_dup 5)
7920 (match_dup 2)] UNSPEC_LITERAL))
7921 (parallel [(set (match_dup 0)
7922 (call (mem:DI (match_dup 3))
7924 (set (reg:DI 26) (plus:DI (pc) (const_int 4)))
7925 (unspec_volatile [(match_dup 5)] UNSPECV_BLOCKAGE)
7927 (use (unspec [(match_dup 2)] UNSPEC_TLSLDM_CALL))])
7929 (unspec_volatile:DI [(reg:DI 26) (match_dup 4)] UNSPECV_LDGP1))
7931 (unspec:DI [(reg:DI 29) (match_dup 4)] UNSPEC_LDGP2))]
7933 operands[3] = gen_rtx_REG (Pmode, 27);
7934 operands[4] = GEN_INT (alpha_next_sequence_number++);
7935 operands[5] = pic_offset_table_rtx;
7937 [(set_attr "type" "multi")])
7939 (define_insn "*call_value_osf_1"
7940 [(set (match_operand 0 "" "")
7941 (call (mem:DI (match_operand:DI 1 "call_operand" "c,R,s"))
7942 (match_operand 2 "" "")))
7944 (clobber (reg:DI 26))]
7945 "! TARGET_EXPLICIT_RELOCS && TARGET_ABI_OSF"
7947 jsr $26,($27),0\;ldgp $29,0($26)
7949 jsr $26,%1\;ldgp $29,0($26)"
7950 [(set_attr "type" "jsr")
7951 (set_attr "length" "12,*,16")])
7953 (define_insn "*sibcall_value_osf_1_er"
7954 [(set (match_operand 0 "" "")
7955 (call (mem:DI (match_operand:DI 1 "symbolic_operand" "R,s"))
7956 (match_operand 2 "" "")))
7957 (unspec [(reg:DI 29)] UNSPEC_SIBCALL)]
7958 "TARGET_EXPLICIT_RELOCS && TARGET_ABI_OSF"
7960 br $31,%1\t\t!samegp
7961 ldq $27,%1($29)\t\t!literal!%#\;jmp $31,($27),%1\t\t!lituse_jsr!%#"
7962 [(set_attr "type" "jsr")
7963 (set_attr "length" "*,8")])
7965 (define_insn "*sibcall_value_osf_1"
7966 [(set (match_operand 0 "" "")
7967 (call (mem:DI (match_operand:DI 1 "symbolic_operand" "R,s"))
7968 (match_operand 2 "" "")))
7969 (unspec [(reg:DI 29)] UNSPEC_SIBCALL)]
7970 "! TARGET_EXPLICIT_RELOCS && TARGET_ABI_OSF"
7973 lda $27,%1\;jmp $31,($27),%1"
7974 [(set_attr "type" "jsr")
7975 (set_attr "length" "*,8")])
7977 (define_insn "*call_value_nt_1"
7978 [(set (match_operand 0 "" "")
7979 (call (mem:DI (match_operand:DI 1 "call_operand" "r,R,s"))
7980 (match_operand 2 "" "")))
7981 (clobber (reg:DI 26))]
7982 "TARGET_ABI_WINDOWS_NT"
7987 [(set_attr "type" "jsr")
7988 (set_attr "length" "*,*,12")])
7990 ; GAS relies on the order and position of instructions output below in order
7991 ; to generate relocs for VMS link to potentially optimize the call.
7992 ; Please do not molest.
7993 (define_insn "*call_value_vms_1"
7994 [(set (match_operand 0 "" "")
7995 (call (mem:DI (match_operand:DI 1 "call_operand" "r,s"))
7996 (match_operand 2 "" "")))
7997 (use (match_operand:DI 3 "nonmemory_operand" "r,n"))
8000 (clobber (reg:DI 27))]
8001 "TARGET_ABI_OPEN_VMS"
8003 switch (which_alternative)
8006 return "mov %3,$27\;jsr $26,0\;ldq $27,0($29)";
8008 operands [3] = alpha_use_linkage (operands [1], cfun->decl, 1, 0);
8009 operands [4] = alpha_use_linkage (operands [1], cfun->decl, 0, 0);
8010 return "ldq $26,%4\;ldq $27,%3\;jsr $26,%1\;ldq $27,0($29)";
8015 [(set_attr "type" "jsr")
8016 (set_attr "length" "12,16")])
8018 (define_insn "*call_value_umk"
8019 [(set (match_operand 0 "" "")
8020 (call (mem:DI (match_operand:DI 1 "call_operand" "r"))
8021 (match_operand 2 "" "")))
8023 (clobber (reg:DI 26))]
8024 "TARGET_ABI_UNICOSMK"
8026 [(set_attr "type" "jsr")])