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 Free Software Foundation, Inc.
4 ;; Contributed by Richard Kenner (kenner@vlsi1.ultra.nyu.edu)
6 ;; This file is part of GNU CC.
8 ;; GNU CC is free software; you can redistribute it and/or modify
9 ;; it under the terms of the GNU General Public License as published by
10 ;; the Free Software Foundation; either version 2, or (at your option)
13 ;; GNU CC is distributed in the hope that it will be useful,
14 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
15 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 ;; GNU General Public License for more details.
18 ;; You should have received a copy of the GNU General Public License
19 ;; along with GNU CC; see the file COPYING. If not, write to
20 ;; the Free Software Foundation, 59 Temple Place - Suite 330,
21 ;; Boston, MA 02111-1307, USA.
23 ;;- See file "rtl.def" for documentation on define_insn, match_*, et. al.
25 ;; 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,icmp,imul,\
101 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 controled 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 controled 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")))
158 ;; Include scheduling descriptions.
164 ;; First define the arithmetic insns. Note that the 32-bit forms also
167 ;; Handle 32-64 bit extension from memory to a floating point register
168 ;; specially, since this occurs frequently in int->double conversions.
170 ;; Note that while we must retain the =f case in the insn for reload's
171 ;; benefit, it should be eliminated after reload, so we should never emit
172 ;; code for that case. But we don't reject the possibility.
174 (define_expand "extendsidi2"
175 [(set (match_operand:DI 0 "register_operand" "")
176 (sign_extend:DI (match_operand:SI 1 "nonimmediate_operand" "")))]
180 (define_insn "*extendsidi2_nofix"
181 [(set (match_operand:DI 0 "register_operand" "=r,r,*f,?*f")
183 (match_operand:SI 1 "nonimmediate_operand" "r,m,*f,m")))]
189 lds %0,%1\;cvtlq %0,%0"
190 [(set_attr "type" "iadd,ild,fadd,fld")
191 (set_attr "length" "*,*,*,8")])
193 (define_insn "*extendsidi2_fix"
194 [(set (match_operand:DI 0 "register_operand" "=r,r,r,?*f,?*f")
196 (match_operand:SI 1 "nonimmediate_operand" "r,m,*f,*f,m")))]
203 lds %0,%1\;cvtlq %0,%0"
204 [(set_attr "type" "iadd,ild,ftoi,fadd,fld")
205 (set_attr "length" "*,*,*,*,8")])
207 ;; Due to issues with CLASS_CANNOT_CHANGE_SIZE, we cannot use a subreg here.
209 [(set (match_operand:DI 0 "hard_fp_register_operand" "")
210 (sign_extend:DI (match_operand:SI 1 "memory_operand" "")))]
212 [(set (match_dup 2) (match_dup 1))
213 (set (match_dup 0) (sign_extend:DI (match_dup 2)))]
214 "operands[2] = gen_rtx_REG (SImode, REGNO (operands[0]));")
216 ;; Optimize sign-extension of SImode loads. This shows up in the wake of
217 ;; reload when converting fp->int.
220 [(set (match_operand:SI 0 "hard_int_register_operand" "")
221 (match_operand:SI 1 "memory_operand" ""))
222 (set (match_operand:DI 2 "hard_int_register_operand" "")
223 (sign_extend:DI (match_dup 0)))]
224 "true_regnum (operands[0]) == true_regnum (operands[2])
225 || peep2_reg_dead_p (2, operands[0])"
227 (sign_extend:DI (match_dup 1)))]
231 [(set (match_operand:SI 0 "hard_int_register_operand" "")
232 (match_operand:SI 1 "hard_fp_register_operand" ""))
233 (set (match_operand:DI 2 "hard_int_register_operand" "")
234 (sign_extend:DI (match_dup 0)))]
236 && (true_regnum (operands[0]) == true_regnum (operands[2])
237 || peep2_reg_dead_p (2, operands[0]))"
239 (sign_extend:DI (match_dup 1)))]
243 [(set (match_operand:DI 0 "hard_fp_register_operand" "")
244 (sign_extend:DI (match_operand:SI 1 "hard_fp_register_operand" "")))
245 (set (match_operand:DI 2 "hard_int_register_operand" "")
247 "TARGET_FIX && peep2_reg_dead_p (2, operands[0])"
249 (sign_extend:DI (match_dup 1)))]
252 ;; Don't say we have addsi3 if optimizing. This generates better code. We
253 ;; have the anonymous addsi3 pattern below in case combine wants to make it.
254 (define_expand "addsi3"
255 [(set (match_operand:SI 0 "register_operand" "")
256 (plus:SI (match_operand:SI 1 "reg_or_0_operand" "")
257 (match_operand:SI 2 "add_operand" "")))]
261 (define_insn "*addsi_internal"
262 [(set (match_operand:SI 0 "register_operand" "=r,r,r,r")
263 (plus:SI (match_operand:SI 1 "reg_or_0_operand" "%rJ,rJ,rJ,rJ")
264 (match_operand:SI 2 "add_operand" "rI,O,K,L")))]
273 [(set (match_operand:SI 0 "register_operand" "")
274 (plus:SI (match_operand:SI 1 "register_operand" "")
275 (match_operand:SI 2 "const_int_operand" "")))]
276 "! add_operand (operands[2], SImode)"
277 [(set (match_dup 0) (plus:SI (match_dup 1) (match_dup 3)))
278 (set (match_dup 0) (plus:SI (match_dup 0) (match_dup 4)))]
280 HOST_WIDE_INT val = INTVAL (operands[2]);
281 HOST_WIDE_INT low = (val & 0xffff) - 2 * (val & 0x8000);
282 HOST_WIDE_INT rest = val - low;
284 operands[3] = GEN_INT (rest);
285 operands[4] = GEN_INT (low);
288 (define_insn "*addsi_se"
289 [(set (match_operand:DI 0 "register_operand" "=r,r")
291 (plus:SI (match_operand:SI 1 "reg_or_0_operand" "%rJ,rJ")
292 (match_operand:SI 2 "sext_add_operand" "rI,O"))))]
298 (define_insn "*addsi_se2"
299 [(set (match_operand:DI 0 "register_operand" "=r,r")
301 (subreg:SI (plus:DI (match_operand:DI 1 "reg_or_0_operand" "%rJ,rJ")
302 (match_operand:DI 2 "sext_add_operand" "rI,O"))
310 [(set (match_operand:DI 0 "register_operand" "")
312 (plus:SI (match_operand:SI 1 "reg_not_elim_operand" "")
313 (match_operand:SI 2 "const_int_operand" ""))))
314 (clobber (match_operand:SI 3 "reg_not_elim_operand" ""))]
315 "! sext_add_operand (operands[2], SImode) && INTVAL (operands[2]) > 0
316 && INTVAL (operands[2]) % 4 == 0"
317 [(set (match_dup 3) (match_dup 4))
318 (set (match_dup 0) (sign_extend:DI (plus:SI (mult:SI (match_dup 3)
322 HOST_WIDE_INT val = INTVAL (operands[2]) / 4;
328 operands[4] = GEN_INT (val);
329 operands[5] = GEN_INT (mult);
333 [(set (match_operand:DI 0 "register_operand" "")
335 (plus:SI (match_operator:SI 1 "comparison_operator"
336 [(match_operand 2 "" "")
337 (match_operand 3 "" "")])
338 (match_operand:SI 4 "add_operand" ""))))
339 (clobber (match_operand:DI 5 "register_operand" ""))]
341 [(set (match_dup 5) (match_dup 6))
342 (set (match_dup 0) (sign_extend:DI (plus:SI (match_dup 7) (match_dup 4))))]
344 operands[6] = gen_rtx_fmt_ee (GET_CODE (operands[1]), DImode,
345 operands[2], operands[3]);
346 operands[7] = gen_lowpart (SImode, operands[5]);
349 (define_insn "addvsi3"
350 [(set (match_operand:SI 0 "register_operand" "=r,r")
351 (plus:SI (match_operand:SI 1 "reg_or_0_operand" "%rJ,rJ")
352 (match_operand:SI 2 "sext_add_operand" "rI,O")))
353 (trap_if (ne (plus:DI (sign_extend:DI (match_dup 1))
354 (sign_extend:DI (match_dup 2)))
355 (sign_extend:DI (plus:SI (match_dup 1)
363 (define_expand "adddi3"
364 [(set (match_operand:DI 0 "register_operand" "")
365 (plus:DI (match_operand:DI 1 "register_operand" "")
366 (match_operand:DI 2 "add_operand" "")))]
370 (define_insn "*adddi_er_lo16_dtp"
371 [(set (match_operand:DI 0 "register_operand" "=r")
372 (lo_sum:DI (match_operand:DI 1 "register_operand" "r")
373 (match_operand:DI 2 "dtp16_symbolic_operand" "")))]
375 "lda %0,%2(%1)\t\t!dtprel")
377 (define_insn "*adddi_er_hi32_dtp"
378 [(set (match_operand:DI 0 "register_operand" "=r")
379 (plus:DI (match_operand:DI 1 "register_operand" "r")
380 (high:DI (match_operand:DI 2 "dtp32_symbolic_operand" ""))))]
382 "ldah %0,%2(%1)\t\t!dtprelhi")
384 (define_insn "*adddi_er_lo32_dtp"
385 [(set (match_operand:DI 0 "register_operand" "=r")
386 (lo_sum:DI (match_operand:DI 1 "register_operand" "r")
387 (match_operand:DI 2 "dtp32_symbolic_operand" "")))]
389 "lda %0,%2(%1)\t\t!dtprello")
391 (define_insn "*adddi_er_lo16_tp"
392 [(set (match_operand:DI 0 "register_operand" "=r")
393 (lo_sum:DI (match_operand:DI 1 "register_operand" "r")
394 (match_operand:DI 2 "tp16_symbolic_operand" "")))]
396 "lda %0,%2(%1)\t\t!tprel")
398 (define_insn "*adddi_er_hi32_tp"
399 [(set (match_operand:DI 0 "register_operand" "=r")
400 (plus:DI (match_operand:DI 1 "register_operand" "r")
401 (high:DI (match_operand:DI 2 "tp32_symbolic_operand" ""))))]
403 "ldah %0,%2(%1)\t\t!tprelhi")
405 (define_insn "*adddi_er_lo32_tp"
406 [(set (match_operand:DI 0 "register_operand" "=r")
407 (lo_sum:DI (match_operand:DI 1 "register_operand" "r")
408 (match_operand:DI 2 "tp32_symbolic_operand" "")))]
410 "lda %0,%2(%1)\t\t!tprello")
412 (define_insn "*adddi_er_high_l"
413 [(set (match_operand:DI 0 "register_operand" "=r")
414 (plus:DI (match_operand:DI 1 "register_operand" "r")
415 (high:DI (match_operand:DI 2 "local_symbolic_operand" ""))))]
416 "TARGET_EXPLICIT_RELOCS"
417 "ldah %0,%2(%1)\t\t!gprelhigh"
418 [(set_attr "usegp" "yes")])
421 [(set (match_operand:DI 0 "register_operand" "")
422 (high:DI (match_operand:DI 1 "local_symbolic_operand" "")))]
423 "TARGET_EXPLICIT_RELOCS && reload_completed"
425 (plus:DI (match_dup 2) (high:DI (match_dup 1))))]
426 "operands[2] = pic_offset_table_rtx;")
428 ;; We used to expend quite a lot of effort choosing addq/subq/lda.
429 ;; With complications like
431 ;; The NT stack unwind code can't handle a subq to adjust the stack
432 ;; (that's a bug, but not one we can do anything about). As of NT4.0 SP3,
433 ;; the exception handling code will loop if a subq is used and an
436 ;; The 19980616 change to emit prologues as RTL also confused some
437 ;; versions of GDB, which also interprets prologues. This has been
438 ;; fixed as of GDB 4.18, but it does not harm to unconditionally
441 ;; and the fact that the three insns schedule exactly the same, it's
442 ;; just not worth the effort.
444 (define_insn "*adddi_internal"
445 [(set (match_operand:DI 0 "register_operand" "=r,r,r")
446 (plus:DI (match_operand:DI 1 "register_operand" "%r,r,r")
447 (match_operand:DI 2 "add_operand" "r,K,L")))]
454 ;; ??? Allow large constants when basing off the frame pointer or some
455 ;; virtual register that may eliminate to the frame pointer. This is
456 ;; done because register elimination offsets will change the hi/lo split,
457 ;; and if we split before reload, we will require additional instructions.
459 (define_insn "*adddi_fp_hack"
460 [(set (match_operand:DI 0 "register_operand" "=r")
461 (plus:DI (match_operand:DI 1 "reg_no_subreg_operand" "r")
462 (match_operand:DI 2 "const_int_operand" "n")))]
463 "NONSTRICT_REG_OK_FP_BASE_P (operands[1])
464 && INTVAL (operands[2]) >= 0
465 /* This is the largest constant an lda+ldah pair can add, minus
466 an upper bound on the displacement between SP and AP during
467 register elimination. See INITIAL_ELIMINATION_OFFSET. */
468 && INTVAL (operands[2])
470 - FIRST_PSEUDO_REGISTER * UNITS_PER_WORD
471 - ALPHA_ROUND(current_function_outgoing_args_size)
472 - (ALPHA_ROUND (get_frame_size ()
473 + max_reg_num () * UNITS_PER_WORD
474 + current_function_pretend_args_size)
475 - current_function_pretend_args_size))"
478 ;; Don't do this if we are adjusting SP since we don't want to do it
479 ;; in two steps. Don't split FP sources for the reason listed above.
481 [(set (match_operand:DI 0 "register_operand" "")
482 (plus:DI (match_operand:DI 1 "register_operand" "")
483 (match_operand:DI 2 "const_int_operand" "")))]
484 "! add_operand (operands[2], DImode)
485 && operands[0] != stack_pointer_rtx
486 && operands[1] != frame_pointer_rtx
487 && operands[1] != arg_pointer_rtx"
488 [(set (match_dup 0) (plus:DI (match_dup 1) (match_dup 3)))
489 (set (match_dup 0) (plus:DI (match_dup 0) (match_dup 4)))]
491 HOST_WIDE_INT val = INTVAL (operands[2]);
492 HOST_WIDE_INT low = (val & 0xffff) - 2 * (val & 0x8000);
493 HOST_WIDE_INT rest = val - low;
495 operands[4] = GEN_INT (low);
496 if (CONST_OK_FOR_LETTER_P (rest, 'L'))
497 operands[3] = GEN_INT (rest);
498 else if (! no_new_pseudos)
500 operands[3] = gen_reg_rtx (DImode);
501 emit_move_insn (operands[3], operands[2]);
502 emit_insn (gen_adddi3 (operands[0], operands[1], operands[3]));
509 (define_insn "*saddl"
510 [(set (match_operand:SI 0 "register_operand" "=r,r")
511 (plus:SI (mult:SI (match_operand:SI 1 "reg_not_elim_operand" "r,r")
512 (match_operand:SI 2 "const48_operand" "I,I"))
513 (match_operand:SI 3 "sext_add_operand" "rI,O")))]
519 (define_insn "*saddl_se"
520 [(set (match_operand:DI 0 "register_operand" "=r,r")
522 (plus:SI (mult:SI (match_operand:SI 1 "reg_not_elim_operand" "r,r")
523 (match_operand:SI 2 "const48_operand" "I,I"))
524 (match_operand:SI 3 "sext_add_operand" "rI,O"))))]
531 [(set (match_operand:DI 0 "register_operand" "")
533 (plus:SI (mult:SI (match_operator:SI 1 "comparison_operator"
534 [(match_operand 2 "" "")
535 (match_operand 3 "" "")])
536 (match_operand:SI 4 "const48_operand" ""))
537 (match_operand:SI 5 "sext_add_operand" ""))))
538 (clobber (match_operand:DI 6 "reg_not_elim_operand" ""))]
540 [(set (match_dup 6) (match_dup 7))
542 (sign_extend:DI (plus:SI (mult:SI (match_dup 8) (match_dup 4))
545 operands[7] = gen_rtx_fmt_ee (GET_CODE (operands[1]), DImode,
546 operands[2], operands[3]);
547 operands[8] = gen_lowpart (SImode, operands[6]);
550 (define_insn "*saddq"
551 [(set (match_operand:DI 0 "register_operand" "=r,r")
552 (plus:DI (mult:DI (match_operand:DI 1 "reg_not_elim_operand" "r,r")
553 (match_operand:DI 2 "const48_operand" "I,I"))
554 (match_operand:DI 3 "sext_add_operand" "rI,O")))]
560 (define_insn "addvdi3"
561 [(set (match_operand:DI 0 "register_operand" "=r,r")
562 (plus:DI (match_operand:DI 1 "reg_or_0_operand" "%rJ,rJ")
563 (match_operand:DI 2 "sext_add_operand" "rI,O")))
564 (trap_if (ne (plus:TI (sign_extend:TI (match_dup 1))
565 (sign_extend:TI (match_dup 2)))
566 (sign_extend:TI (plus:DI (match_dup 1)
574 (define_insn "negsi2"
575 [(set (match_operand:SI 0 "register_operand" "=r")
576 (neg:SI (match_operand:SI 1 "reg_or_8bit_operand" "rI")))]
580 (define_insn "*negsi_se"
581 [(set (match_operand:DI 0 "register_operand" "=r")
582 (sign_extend:DI (neg:SI
583 (match_operand:SI 1 "reg_or_8bit_operand" "rI"))))]
587 (define_insn "negvsi2"
588 [(set (match_operand:SI 0 "register_operand" "=r")
589 (neg:SI (match_operand:SI 1 "register_operand" "r")))
590 (trap_if (ne (neg:DI (sign_extend:DI (match_dup 1)))
591 (sign_extend:DI (neg:SI (match_dup 1))))
596 (define_insn "negdi2"
597 [(set (match_operand:DI 0 "register_operand" "=r")
598 (neg:DI (match_operand:DI 1 "reg_or_8bit_operand" "rI")))]
602 (define_insn "negvdi2"
603 [(set (match_operand:DI 0 "register_operand" "=r")
604 (neg:DI (match_operand:DI 1 "register_operand" "r")))
605 (trap_if (ne (neg:TI (sign_extend:TI (match_dup 1)))
606 (sign_extend:TI (neg:DI (match_dup 1))))
611 (define_expand "subsi3"
612 [(set (match_operand:SI 0 "register_operand" "")
613 (minus:SI (match_operand:SI 1 "reg_or_0_operand" "")
614 (match_operand:SI 2 "reg_or_8bit_operand" "")))]
618 (define_insn "*subsi_internal"
619 [(set (match_operand:SI 0 "register_operand" "=r")
620 (minus:SI (match_operand:SI 1 "reg_or_0_operand" "rJ")
621 (match_operand:SI 2 "reg_or_8bit_operand" "rI")))]
625 (define_insn "*subsi_se"
626 [(set (match_operand:DI 0 "register_operand" "=r")
627 (sign_extend:DI (minus:SI (match_operand:SI 1 "reg_or_0_operand" "rJ")
628 (match_operand:SI 2 "reg_or_8bit_operand" "rI"))))]
632 (define_insn "*subsi_se2"
633 [(set (match_operand:DI 0 "register_operand" "=r")
635 (subreg:SI (minus:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
636 (match_operand:DI 2 "reg_or_8bit_operand" "rI"))
641 (define_insn "subvsi3"
642 [(set (match_operand:SI 0 "register_operand" "=r")
643 (minus:SI (match_operand:SI 1 "reg_or_0_operand" "rJ")
644 (match_operand:SI 2 "reg_or_8bit_operand" "rI")))
645 (trap_if (ne (minus:DI (sign_extend:DI (match_dup 1))
646 (sign_extend:DI (match_dup 2)))
647 (sign_extend:DI (minus:SI (match_dup 1)
653 (define_insn "subdi3"
654 [(set (match_operand:DI 0 "register_operand" "=r")
655 (minus:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
656 (match_operand:DI 2 "reg_or_8bit_operand" "rI")))]
660 (define_insn "*ssubl"
661 [(set (match_operand:SI 0 "register_operand" "=r")
662 (minus:SI (mult:SI (match_operand:SI 1 "reg_not_elim_operand" "r")
663 (match_operand:SI 2 "const48_operand" "I"))
664 (match_operand:SI 3 "reg_or_8bit_operand" "rI")))]
668 (define_insn "*ssubl_se"
669 [(set (match_operand:DI 0 "register_operand" "=r")
671 (minus:SI (mult:SI (match_operand:SI 1 "reg_not_elim_operand" "r")
672 (match_operand:SI 2 "const48_operand" "I"))
673 (match_operand:SI 3 "reg_or_8bit_operand" "rI"))))]
677 (define_insn "*ssubq"
678 [(set (match_operand:DI 0 "register_operand" "=r")
679 (minus:DI (mult:DI (match_operand:DI 1 "reg_not_elim_operand" "r")
680 (match_operand:DI 2 "const48_operand" "I"))
681 (match_operand:DI 3 "reg_or_8bit_operand" "rI")))]
685 (define_insn "subvdi3"
686 [(set (match_operand:DI 0 "register_operand" "=r")
687 (minus:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
688 (match_operand:DI 2 "reg_or_8bit_operand" "rI")))
689 (trap_if (ne (minus:TI (sign_extend:TI (match_dup 1))
690 (sign_extend:TI (match_dup 2)))
691 (sign_extend:TI (minus:DI (match_dup 1)
697 ;; The Unicos/Mk assembler doesn't support mull.
699 (define_insn "mulsi3"
700 [(set (match_operand:SI 0 "register_operand" "=r")
701 (mult:SI (match_operand:SI 1 "reg_or_0_operand" "%rJ")
702 (match_operand:SI 2 "reg_or_8bit_operand" "rI")))]
703 "!TARGET_ABI_UNICOSMK"
705 [(set_attr "type" "imul")
706 (set_attr "opsize" "si")])
708 (define_insn "*mulsi_se"
709 [(set (match_operand:DI 0 "register_operand" "=r")
711 (mult:SI (match_operand:SI 1 "reg_or_0_operand" "%rJ")
712 (match_operand:SI 2 "reg_or_8bit_operand" "rI"))))]
713 "!TARGET_ABI_UNICOSMK"
715 [(set_attr "type" "imul")
716 (set_attr "opsize" "si")])
718 (define_insn "mulvsi3"
719 [(set (match_operand:SI 0 "register_operand" "=r")
720 (mult:SI (match_operand:SI 1 "reg_or_0_operand" "%rJ")
721 (match_operand:SI 2 "reg_or_8bit_operand" "rI")))
722 (trap_if (ne (mult:DI (sign_extend:DI (match_dup 1))
723 (sign_extend:DI (match_dup 2)))
724 (sign_extend:DI (mult:SI (match_dup 1)
727 "!TARGET_ABI_UNICOSMK"
729 [(set_attr "type" "imul")
730 (set_attr "opsize" "si")])
732 (define_insn "muldi3"
733 [(set (match_operand:DI 0 "register_operand" "=r")
734 (mult:DI (match_operand:DI 1 "reg_or_0_operand" "%rJ")
735 (match_operand:DI 2 "reg_or_8bit_operand" "rI")))]
738 [(set_attr "type" "imul")])
740 (define_insn "mulvdi3"
741 [(set (match_operand:DI 0 "register_operand" "=r")
742 (mult:DI (match_operand:DI 1 "reg_or_0_operand" "%rJ")
743 (match_operand:DI 2 "reg_or_8bit_operand" "rI")))
744 (trap_if (ne (mult:TI (sign_extend:TI (match_dup 1))
745 (sign_extend:TI (match_dup 2)))
746 (sign_extend:TI (mult:DI (match_dup 1)
751 [(set_attr "type" "imul")])
753 (define_insn "umuldi3_highpart"
754 [(set (match_operand:DI 0 "register_operand" "=r")
757 (mult:TI (zero_extend:TI
758 (match_operand:DI 1 "reg_or_0_operand" "%rJ"))
760 (match_operand:DI 2 "reg_or_8bit_operand" "rI")))
764 [(set_attr "type" "imul")
765 (set_attr "opsize" "udi")])
767 (define_insn "*umuldi3_highpart_const"
768 [(set (match_operand:DI 0 "register_operand" "=r")
771 (mult:TI (zero_extend:TI (match_operand:DI 1 "register_operand" "r"))
772 (match_operand:TI 2 "cint8_operand" "I"))
776 [(set_attr "type" "imul")
777 (set_attr "opsize" "udi")])
779 ;; The divide and remainder operations take their inputs from r24 and
780 ;; r25, put their output in r27, and clobber r23 and r28 on all
781 ;; systems except Unicos/Mk. On Unicos, the standard library provides
782 ;; subroutines which use the standard calling convention and work on
785 ;; ??? Force sign-extension here because some versions of OSF/1 and
786 ;; Interix/NT don't do the right thing if the inputs are not properly
787 ;; sign-extended. But Linux, for instance, does not have this
788 ;; problem. Is it worth the complication here to eliminate the sign
791 (define_expand "divsi3"
793 (sign_extend:DI (match_operand:SI 1 "nonimmediate_operand" "")))
795 (sign_extend:DI (match_operand:SI 2 "nonimmediate_operand" "")))
796 (parallel [(set (match_dup 5)
797 (sign_extend:DI (div:SI (match_dup 3) (match_dup 4))))
798 (clobber (reg:DI 23))
799 (clobber (reg:DI 28))])
800 (set (match_operand:SI 0 "nonimmediate_operand" "")
801 (subreg:SI (match_dup 5) 0))]
802 "! TARGET_ABI_OPEN_VMS && ! TARGET_ABI_UNICOSMK"
804 operands[3] = gen_reg_rtx (DImode);
805 operands[4] = gen_reg_rtx (DImode);
806 operands[5] = gen_reg_rtx (DImode);
809 (define_expand "udivsi3"
811 (sign_extend:DI (match_operand:SI 1 "nonimmediate_operand" "")))
813 (sign_extend:DI (match_operand:SI 2 "nonimmediate_operand" "")))
814 (parallel [(set (match_dup 5)
815 (sign_extend:DI (udiv:SI (match_dup 3) (match_dup 4))))
816 (clobber (reg:DI 23))
817 (clobber (reg:DI 28))])
818 (set (match_operand:SI 0 "nonimmediate_operand" "")
819 (subreg:SI (match_dup 5) 0))]
820 "! TARGET_ABI_OPEN_VMS && ! TARGET_ABI_UNICOSMK"
822 operands[3] = gen_reg_rtx (DImode);
823 operands[4] = gen_reg_rtx (DImode);
824 operands[5] = gen_reg_rtx (DImode);
827 (define_expand "modsi3"
829 (sign_extend:DI (match_operand:SI 1 "nonimmediate_operand" "")))
831 (sign_extend:DI (match_operand:SI 2 "nonimmediate_operand" "")))
832 (parallel [(set (match_dup 5)
833 (sign_extend:DI (mod:SI (match_dup 3) (match_dup 4))))
834 (clobber (reg:DI 23))
835 (clobber (reg:DI 28))])
836 (set (match_operand:SI 0 "nonimmediate_operand" "")
837 (subreg:SI (match_dup 5) 0))]
838 "! TARGET_ABI_OPEN_VMS && ! TARGET_ABI_UNICOSMK"
840 operands[3] = gen_reg_rtx (DImode);
841 operands[4] = gen_reg_rtx (DImode);
842 operands[5] = gen_reg_rtx (DImode);
845 (define_expand "umodsi3"
847 (sign_extend:DI (match_operand:SI 1 "nonimmediate_operand" "")))
849 (sign_extend:DI (match_operand:SI 2 "nonimmediate_operand" "")))
850 (parallel [(set (match_dup 5)
851 (sign_extend:DI (umod:SI (match_dup 3) (match_dup 4))))
852 (clobber (reg:DI 23))
853 (clobber (reg:DI 28))])
854 (set (match_operand:SI 0 "nonimmediate_operand" "")
855 (subreg:SI (match_dup 5) 0))]
856 "! TARGET_ABI_OPEN_VMS && ! TARGET_ABI_UNICOSMK"
858 operands[3] = gen_reg_rtx (DImode);
859 operands[4] = gen_reg_rtx (DImode);
860 operands[5] = gen_reg_rtx (DImode);
863 (define_expand "divdi3"
864 [(parallel [(set (match_operand:DI 0 "register_operand" "")
865 (div:DI (match_operand:DI 1 "register_operand" "")
866 (match_operand:DI 2 "register_operand" "")))
867 (clobber (reg:DI 23))
868 (clobber (reg:DI 28))])]
869 "! TARGET_ABI_OPEN_VMS && ! TARGET_ABI_UNICOSMK"
872 (define_expand "udivdi3"
873 [(parallel [(set (match_operand:DI 0 "register_operand" "")
874 (udiv:DI (match_operand:DI 1 "register_operand" "")
875 (match_operand:DI 2 "register_operand" "")))
876 (clobber (reg:DI 23))
877 (clobber (reg:DI 28))])]
878 "! TARGET_ABI_OPEN_VMS && ! TARGET_ABI_UNICOSMK"
881 (define_expand "moddi3"
882 [(use (match_operand:DI 0 "register_operand" ""))
883 (use (match_operand:DI 1 "register_operand" ""))
884 (use (match_operand:DI 2 "register_operand" ""))]
885 "!TARGET_ABI_OPEN_VMS"
887 if (TARGET_ABI_UNICOSMK)
888 emit_insn (gen_moddi3_umk (operands[0], operands[1], operands[2]));
890 emit_insn (gen_moddi3_dft (operands[0], operands[1], operands[2]));
894 (define_expand "moddi3_dft"
895 [(parallel [(set (match_operand:DI 0 "register_operand" "")
896 (mod:DI (match_operand:DI 1 "register_operand" "")
897 (match_operand:DI 2 "register_operand" "")))
898 (clobber (reg:DI 23))
899 (clobber (reg:DI 28))])]
900 "! TARGET_ABI_OPEN_VMS && ! TARGET_ABI_UNICOSMK"
903 ;; On Unicos/Mk, we do as the system's C compiler does:
904 ;; compute the quotient, multiply and subtract.
906 (define_expand "moddi3_umk"
907 [(use (match_operand:DI 0 "register_operand" ""))
908 (use (match_operand:DI 1 "register_operand" ""))
909 (use (match_operand:DI 2 "register_operand" ""))]
910 "TARGET_ABI_UNICOSMK"
912 rtx div, mul = gen_reg_rtx (DImode);
914 div = expand_binop (DImode, sdiv_optab, operands[1], operands[2],
915 NULL_RTX, 0, OPTAB_LIB);
916 div = force_reg (DImode, div);
917 emit_insn (gen_muldi3 (mul, operands[2], div));
918 emit_insn (gen_subdi3 (operands[0], operands[1], mul));
922 (define_expand "umoddi3"
923 [(use (match_operand:DI 0 "register_operand" ""))
924 (use (match_operand:DI 1 "register_operand" ""))
925 (use (match_operand:DI 2 "register_operand" ""))]
926 "! TARGET_ABI_OPEN_VMS"
928 if (TARGET_ABI_UNICOSMK)
929 emit_insn (gen_umoddi3_umk (operands[0], operands[1], operands[2]));
931 emit_insn (gen_umoddi3_dft (operands[0], operands[1], operands[2]));
935 (define_expand "umoddi3_dft"
936 [(parallel [(set (match_operand:DI 0 "register_operand" "")
937 (umod:DI (match_operand:DI 1 "register_operand" "")
938 (match_operand:DI 2 "register_operand" "")))
939 (clobber (reg:DI 23))
940 (clobber (reg:DI 28))])]
941 "! TARGET_ABI_OPEN_VMS && ! TARGET_ABI_UNICOSMK"
944 (define_expand "umoddi3_umk"
945 [(use (match_operand:DI 0 "register_operand" ""))
946 (use (match_operand:DI 1 "register_operand" ""))
947 (use (match_operand:DI 2 "register_operand" ""))]
948 "TARGET_ABI_UNICOSMK"
950 rtx div, mul = gen_reg_rtx (DImode);
952 div = expand_binop (DImode, udiv_optab, operands[1], operands[2],
953 NULL_RTX, 1, OPTAB_LIB);
954 div = force_reg (DImode, div);
955 emit_insn (gen_muldi3 (mul, operands[2], div));
956 emit_insn (gen_subdi3 (operands[0], operands[1], mul));
960 ;; Lengths of 8 for ldq $t12,__divq($gp); jsr $t9,($t12),__divq as
961 ;; expanded by the assembler.
963 (define_insn_and_split "*divmodsi_internal_er"
964 [(set (match_operand:DI 0 "register_operand" "=c")
965 (sign_extend:DI (match_operator:SI 3 "divmod_operator"
966 [(match_operand:DI 1 "register_operand" "a")
967 (match_operand:DI 2 "register_operand" "b")])))
968 (clobber (reg:DI 23))
969 (clobber (reg:DI 28))]
970 "TARGET_EXPLICIT_RELOCS && ! TARGET_ABI_OPEN_VMS"
971 "ldq $27,__%E3($29)\t\t!literal!%#\;jsr $23,($27),__%E3\t\t!lituse_jsr!%#"
972 "&& reload_completed"
973 [(parallel [(set (match_dup 0)
974 (sign_extend:DI (match_dup 3)))
977 (clobber (reg:DI 23))
978 (clobber (reg:DI 28))])]
981 switch (GET_CODE (operands[3]))
998 operands[4] = GEN_INT (alpha_next_sequence_number++);
999 emit_insn (gen_movdi_er_high_g (operands[0], pic_offset_table_rtx,
1000 gen_rtx_SYMBOL_REF (DImode, str),
1003 [(set_attr "type" "jsr")
1004 (set_attr "length" "8")])
1006 (define_insn "*divmodsi_internal_er_1"
1007 [(set (match_operand:DI 0 "register_operand" "=c")
1008 (sign_extend:DI (match_operator:SI 3 "divmod_operator"
1009 [(match_operand:DI 1 "register_operand" "a")
1010 (match_operand:DI 2 "register_operand" "b")])))
1011 (use (match_operand:DI 4 "register_operand" "c"))
1012 (use (match_operand 5 "const_int_operand" ""))
1013 (clobber (reg:DI 23))
1014 (clobber (reg:DI 28))]
1015 "TARGET_EXPLICIT_RELOCS && ! TARGET_ABI_OPEN_VMS"
1016 "jsr $23,($27),__%E3%J5"
1017 [(set_attr "type" "jsr")
1018 (set_attr "length" "4")])
1020 (define_insn "*divmodsi_internal"
1021 [(set (match_operand:DI 0 "register_operand" "=c")
1022 (sign_extend:DI (match_operator:SI 3 "divmod_operator"
1023 [(match_operand:DI 1 "register_operand" "a")
1024 (match_operand:DI 2 "register_operand" "b")])))
1025 (clobber (reg:DI 23))
1026 (clobber (reg:DI 28))]
1027 "! TARGET_ABI_OPEN_VMS && ! TARGET_ABI_UNICOSMK"
1029 [(set_attr "type" "jsr")
1030 (set_attr "length" "8")])
1032 (define_insn_and_split "*divmoddi_internal_er"
1033 [(set (match_operand:DI 0 "register_operand" "=c")
1034 (match_operator:DI 3 "divmod_operator"
1035 [(match_operand:DI 1 "register_operand" "a")
1036 (match_operand:DI 2 "register_operand" "b")]))
1037 (clobber (reg:DI 23))
1038 (clobber (reg:DI 28))]
1039 "TARGET_EXPLICIT_RELOCS && ! TARGET_ABI_OPEN_VMS"
1040 "ldq $27,__%E3($29)\t\t!literal!%#\;jsr $23,($27),__%E3\t\t!lituse_jsr!%#"
1041 "&& reload_completed"
1042 [(parallel [(set (match_dup 0) (match_dup 3))
1045 (clobber (reg:DI 23))
1046 (clobber (reg:DI 28))])]
1049 switch (GET_CODE (operands[3]))
1066 operands[4] = GEN_INT (alpha_next_sequence_number++);
1067 emit_insn (gen_movdi_er_high_g (operands[0], pic_offset_table_rtx,
1068 gen_rtx_SYMBOL_REF (DImode, str),
1071 [(set_attr "type" "jsr")
1072 (set_attr "length" "8")])
1074 (define_insn "*divmoddi_internal_er_1"
1075 [(set (match_operand:DI 0 "register_operand" "=c")
1076 (match_operator:DI 3 "divmod_operator"
1077 [(match_operand:DI 1 "register_operand" "a")
1078 (match_operand:DI 2 "register_operand" "b")]))
1079 (use (match_operand:DI 4 "register_operand" "c"))
1080 (use (match_operand 5 "const_int_operand" ""))
1081 (clobber (reg:DI 23))
1082 (clobber (reg:DI 28))]
1083 "TARGET_EXPLICIT_RELOCS && ! TARGET_ABI_OPEN_VMS"
1084 "jsr $23,($27),__%E3%J5"
1085 [(set_attr "type" "jsr")
1086 (set_attr "length" "4")])
1088 (define_insn "*divmoddi_internal"
1089 [(set (match_operand:DI 0 "register_operand" "=c")
1090 (match_operator:DI 3 "divmod_operator"
1091 [(match_operand:DI 1 "register_operand" "a")
1092 (match_operand:DI 2 "register_operand" "b")]))
1093 (clobber (reg:DI 23))
1094 (clobber (reg:DI 28))]
1095 "! TARGET_ABI_OPEN_VMS && ! TARGET_ABI_UNICOSMK"
1097 [(set_attr "type" "jsr")
1098 (set_attr "length" "8")])
1100 ;; Next are the basic logical operations. These only exist in DImode.
1102 (define_insn "anddi3"
1103 [(set (match_operand:DI 0 "register_operand" "=r,r,r")
1104 (and:DI (match_operand:DI 1 "reg_or_0_operand" "%rJ,rJ,rJ")
1105 (match_operand:DI 2 "and_operand" "rI,N,MH")))]
1111 [(set_attr "type" "ilog,ilog,shift")])
1113 ;; There are times when we can split an AND into two AND insns. This occurs
1114 ;; when we can first clear any bytes and then clear anything else. For
1115 ;; example "I & 0xffff07" is "(I & 0xffffff) & 0xffffffffffffff07".
1116 ;; Only do this when running on 64-bit host since the computations are
1117 ;; too messy otherwise.
1120 [(set (match_operand:DI 0 "register_operand" "")
1121 (and:DI (match_operand:DI 1 "register_operand" "")
1122 (match_operand:DI 2 "const_int_operand" "")))]
1123 "HOST_BITS_PER_WIDE_INT == 64 && ! and_operand (operands[2], DImode)"
1124 [(set (match_dup 0) (and:DI (match_dup 1) (match_dup 3)))
1125 (set (match_dup 0) (and:DI (match_dup 0) (match_dup 4)))]
1127 unsigned HOST_WIDE_INT mask1 = INTVAL (operands[2]);
1128 unsigned HOST_WIDE_INT mask2 = mask1;
1131 /* For each byte that isn't all zeros, make it all ones. */
1132 for (i = 0; i < 64; i += 8)
1133 if ((mask1 & ((HOST_WIDE_INT) 0xff << i)) != 0)
1134 mask1 |= (HOST_WIDE_INT) 0xff << i;
1136 /* Now turn on any bits we've just turned off. */
1139 operands[3] = GEN_INT (mask1);
1140 operands[4] = GEN_INT (mask2);
1143 (define_expand "zero_extendqihi2"
1144 [(set (match_operand:HI 0 "register_operand" "")
1145 (zero_extend:HI (match_operand:QI 1 "nonimmediate_operand" "")))]
1149 operands[1] = force_reg (QImode, operands[1]);
1152 (define_insn "*zero_extendqihi2_bwx"
1153 [(set (match_operand:HI 0 "register_operand" "=r,r")
1154 (zero_extend:HI (match_operand:QI 1 "nonimmediate_operand" "r,m")))]
1159 [(set_attr "type" "ilog,ild")])
1161 (define_insn "*zero_extendqihi2_nobwx"
1162 [(set (match_operand:HI 0 "register_operand" "=r")
1163 (zero_extend:HI (match_operand:QI 1 "register_operand" "r")))]
1166 [(set_attr "type" "ilog")])
1168 (define_expand "zero_extendqisi2"
1169 [(set (match_operand:SI 0 "register_operand" "")
1170 (zero_extend:SI (match_operand:QI 1 "nonimmediate_operand" "")))]
1174 operands[1] = force_reg (QImode, operands[1]);
1177 (define_insn "*zero_extendqisi2_bwx"
1178 [(set (match_operand:SI 0 "register_operand" "=r,r")
1179 (zero_extend:SI (match_operand:QI 1 "nonimmediate_operand" "r,m")))]
1184 [(set_attr "type" "ilog,ild")])
1186 (define_insn "*zero_extendqisi2_nobwx"
1187 [(set (match_operand:SI 0 "register_operand" "=r")
1188 (zero_extend:SI (match_operand:QI 1 "register_operand" "r")))]
1191 [(set_attr "type" "ilog")])
1193 (define_expand "zero_extendqidi2"
1194 [(set (match_operand:DI 0 "register_operand" "")
1195 (zero_extend:DI (match_operand:QI 1 "nonimmediate_operand" "")))]
1199 operands[1] = force_reg (QImode, operands[1]);
1202 (define_insn "*zero_extendqidi2_bwx"
1203 [(set (match_operand:DI 0 "register_operand" "=r,r")
1204 (zero_extend:DI (match_operand:QI 1 "nonimmediate_operand" "r,m")))]
1209 [(set_attr "type" "ilog,ild")])
1211 (define_insn "*zero_extendqidi2_nobwx"
1212 [(set (match_operand:DI 0 "register_operand" "=r")
1213 (zero_extend:DI (match_operand:QI 1 "register_operand" "r")))]
1216 [(set_attr "type" "ilog")])
1218 (define_expand "zero_extendhisi2"
1219 [(set (match_operand:SI 0 "register_operand" "")
1220 (zero_extend:SI (match_operand:HI 1 "nonimmediate_operand" "")))]
1224 operands[1] = force_reg (HImode, operands[1]);
1227 (define_insn "*zero_extendhisi2_bwx"
1228 [(set (match_operand:SI 0 "register_operand" "=r,r")
1229 (zero_extend:SI (match_operand:HI 1 "nonimmediate_operand" "r,m")))]
1234 [(set_attr "type" "shift,ild")])
1236 (define_insn "*zero_extendhisi2_nobwx"
1237 [(set (match_operand:SI 0 "register_operand" "=r")
1238 (zero_extend:SI (match_operand:HI 1 "register_operand" "r")))]
1241 [(set_attr "type" "shift")])
1243 (define_expand "zero_extendhidi2"
1244 [(set (match_operand:DI 0 "register_operand" "")
1245 (zero_extend:DI (match_operand:HI 1 "nonimmediate_operand" "")))]
1249 operands[1] = force_reg (HImode, operands[1]);
1252 (define_insn "*zero_extendhidi2_bwx"
1253 [(set (match_operand:DI 0 "register_operand" "=r,r")
1254 (zero_extend:DI (match_operand:HI 1 "nonimmediate_operand" "r,m")))]
1259 [(set_attr "type" "shift,ild")])
1261 (define_insn "*zero_extendhidi2_nobwx"
1262 [(set (match_operand:DI 0 "register_operand" "=r")
1263 (zero_extend:DI (match_operand:HI 1 "register_operand" "r")))]
1266 [(set_attr "type" "shift")])
1268 (define_insn "zero_extendsidi2"
1269 [(set (match_operand:DI 0 "register_operand" "=r")
1270 (zero_extend:DI (match_operand:SI 1 "register_operand" "r")))]
1273 [(set_attr "type" "shift")])
1275 (define_insn "andnotdi3"
1276 [(set (match_operand:DI 0 "register_operand" "=r")
1277 (and:DI (not:DI (match_operand:DI 1 "reg_or_8bit_operand" "rI"))
1278 (match_operand:DI 2 "reg_or_0_operand" "rJ")))]
1281 [(set_attr "type" "ilog")])
1283 (define_insn "iordi3"
1284 [(set (match_operand:DI 0 "register_operand" "=r,r")
1285 (ior:DI (match_operand:DI 1 "reg_or_0_operand" "%rJ,rJ")
1286 (match_operand:DI 2 "or_operand" "rI,N")))]
1291 [(set_attr "type" "ilog")])
1293 (define_insn "one_cmpldi2"
1294 [(set (match_operand:DI 0 "register_operand" "=r")
1295 (not:DI (match_operand:DI 1 "reg_or_8bit_operand" "rI")))]
1298 [(set_attr "type" "ilog")])
1300 (define_insn "*iornot"
1301 [(set (match_operand:DI 0 "register_operand" "=r")
1302 (ior:DI (not:DI (match_operand:DI 1 "reg_or_8bit_operand" "rI"))
1303 (match_operand:DI 2 "reg_or_0_operand" "rJ")))]
1306 [(set_attr "type" "ilog")])
1308 (define_insn "xordi3"
1309 [(set (match_operand:DI 0 "register_operand" "=r,r")
1310 (xor:DI (match_operand:DI 1 "reg_or_0_operand" "%rJ,rJ")
1311 (match_operand:DI 2 "or_operand" "rI,N")))]
1316 [(set_attr "type" "ilog")])
1318 (define_insn "*xornot"
1319 [(set (match_operand:DI 0 "register_operand" "=r")
1320 (not:DI (xor:DI (match_operand:DI 1 "register_operand" "%rJ")
1321 (match_operand:DI 2 "register_operand" "rI"))))]
1324 [(set_attr "type" "ilog")])
1326 ;; Handle FFS and related insns iff we support CIX.
1328 (define_expand "ffsdi2"
1330 (unspec:DI [(match_operand:DI 1 "register_operand" "")] UNSPEC_CTTZ))
1332 (plus:DI (match_dup 2) (const_int 1)))
1333 (set (match_operand:DI 0 "register_operand" "")
1334 (if_then_else:DI (eq (match_dup 1) (const_int 0))
1335 (const_int 0) (match_dup 3)))]
1338 operands[2] = gen_reg_rtx (DImode);
1339 operands[3] = gen_reg_rtx (DImode);
1342 (define_insn "*cttz"
1343 [(set (match_operand:DI 0 "register_operand" "=r")
1344 (unspec:DI [(match_operand:DI 1 "register_operand" "r")] UNSPEC_CTTZ))]
1347 ; EV6 calls all mvi and cttz/ctlz/popc class imisc, so just
1348 ; reuse the existing type name.
1349 [(set_attr "type" "mvi")])
1351 (define_insn "clzdi2"
1352 [(set (match_operand:DI 0 "register_operand" "=r")
1353 (clz:DI (match_operand:DI 1 "register_operand" "r")))]
1356 [(set_attr "type" "mvi")])
1358 (define_insn "ctzdi2"
1359 [(set (match_operand:DI 0 "register_operand" "=r")
1360 (ctz:DI (match_operand:DI 1 "register_operand" "r")))]
1363 [(set_attr "type" "mvi")])
1365 (define_insn "popcountdi2"
1366 [(set (match_operand:DI 0 "register_operand" "=r")
1367 (popcount:DI (match_operand:DI 1 "register_operand" "r")))]
1370 [(set_attr "type" "mvi")])
1372 ;; Next come the shifts and the various extract and insert operations.
1374 (define_insn "ashldi3"
1375 [(set (match_operand:DI 0 "register_operand" "=r,r")
1376 (ashift:DI (match_operand:DI 1 "reg_or_0_operand" "rJ,rJ")
1377 (match_operand:DI 2 "reg_or_6bit_operand" "P,rS")))]
1380 switch (which_alternative)
1383 if (operands[2] == const1_rtx)
1384 return "addq %r1,%r1,%0";
1386 return "s%P2addq %r1,0,%0";
1388 return "sll %r1,%2,%0";
1393 [(set_attr "type" "iadd,shift")])
1395 (define_insn "*ashldi_se"
1396 [(set (match_operand:DI 0 "register_operand" "=r")
1398 (subreg:SI (ashift:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
1399 (match_operand:DI 2 "const_int_operand" "P"))
1401 "INTVAL (operands[2]) >= 1 && INTVAL (operands[2]) <= 3"
1403 if (operands[2] == const1_rtx)
1404 return "addl %r1,%r1,%0";
1406 return "s%P2addl %r1,0,%0";
1408 [(set_attr "type" "iadd")])
1410 (define_insn "lshrdi3"
1411 [(set (match_operand:DI 0 "register_operand" "=r")
1412 (lshiftrt:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
1413 (match_operand:DI 2 "reg_or_6bit_operand" "rS")))]
1416 [(set_attr "type" "shift")])
1418 (define_insn "ashrdi3"
1419 [(set (match_operand:DI 0 "register_operand" "=r")
1420 (ashiftrt:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
1421 (match_operand:DI 2 "reg_or_6bit_operand" "rS")))]
1424 [(set_attr "type" "shift")])
1426 (define_expand "extendqihi2"
1428 (ashift:DI (match_operand:QI 1 "some_operand" "")
1430 (set (match_operand:HI 0 "register_operand" "")
1431 (ashiftrt:DI (match_dup 2)
1437 emit_insn (gen_extendqihi2x (operands[0],
1438 force_reg (QImode, operands[1])));
1442 /* If we have an unaligned MEM, extend to DImode (which we do
1443 specially) and then copy to the result. */
1444 if (unaligned_memory_operand (operands[1], HImode))
1446 rtx temp = gen_reg_rtx (DImode);
1448 emit_insn (gen_extendqidi2 (temp, operands[1]));
1449 emit_move_insn (operands[0], gen_lowpart (HImode, temp));
1453 operands[0] = gen_lowpart (DImode, operands[0]);
1454 operands[1] = gen_lowpart (DImode, force_reg (QImode, operands[1]));
1455 operands[2] = gen_reg_rtx (DImode);
1458 (define_insn "extendqidi2x"
1459 [(set (match_operand:DI 0 "register_operand" "=r")
1460 (sign_extend:DI (match_operand:QI 1 "register_operand" "r")))]
1463 [(set_attr "type" "shift")])
1465 (define_insn "extendhidi2x"
1466 [(set (match_operand:DI 0 "register_operand" "=r")
1467 (sign_extend:DI (match_operand:HI 1 "register_operand" "r")))]
1470 [(set_attr "type" "shift")])
1472 (define_insn "extendqisi2x"
1473 [(set (match_operand:SI 0 "register_operand" "=r")
1474 (sign_extend:SI (match_operand:QI 1 "register_operand" "r")))]
1477 [(set_attr "type" "shift")])
1479 (define_insn "extendhisi2x"
1480 [(set (match_operand:SI 0 "register_operand" "=r")
1481 (sign_extend:SI (match_operand:HI 1 "register_operand" "r")))]
1484 [(set_attr "type" "shift")])
1486 (define_insn "extendqihi2x"
1487 [(set (match_operand:HI 0 "register_operand" "=r")
1488 (sign_extend:HI (match_operand:QI 1 "register_operand" "r")))]
1491 [(set_attr "type" "shift")])
1493 (define_expand "extendqisi2"
1495 (ashift:DI (match_operand:QI 1 "some_operand" "")
1497 (set (match_operand:SI 0 "register_operand" "")
1498 (ashiftrt:DI (match_dup 2)
1504 emit_insn (gen_extendqisi2x (operands[0],
1505 force_reg (QImode, operands[1])));
1509 /* If we have an unaligned MEM, extend to a DImode form of
1510 the result (which we do specially). */
1511 if (unaligned_memory_operand (operands[1], QImode))
1513 rtx temp = gen_reg_rtx (DImode);
1515 emit_insn (gen_extendqidi2 (temp, operands[1]));
1516 emit_move_insn (operands[0], gen_lowpart (SImode, temp));
1520 operands[0] = gen_lowpart (DImode, operands[0]);
1521 operands[1] = gen_lowpart (DImode, force_reg (QImode, operands[1]));
1522 operands[2] = gen_reg_rtx (DImode);
1525 (define_expand "extendqidi2"
1527 (ashift:DI (match_operand:QI 1 "some_operand" "")
1529 (set (match_operand:DI 0 "register_operand" "")
1530 (ashiftrt:DI (match_dup 2)
1536 emit_insn (gen_extendqidi2x (operands[0],
1537 force_reg (QImode, operands[1])));
1541 if (unaligned_memory_operand (operands[1], QImode))
1544 = gen_unaligned_extendqidi (operands[0],
1545 get_unaligned_address (operands[1], 1));
1547 alpha_set_memflags (seq, operands[1]);
1552 operands[1] = gen_lowpart (DImode, force_reg (QImode, operands[1]));
1553 operands[2] = gen_reg_rtx (DImode);
1556 (define_expand "extendhisi2"
1558 (ashift:DI (match_operand:HI 1 "some_operand" "")
1560 (set (match_operand:SI 0 "register_operand" "")
1561 (ashiftrt:DI (match_dup 2)
1567 emit_insn (gen_extendhisi2x (operands[0],
1568 force_reg (HImode, operands[1])));
1572 /* If we have an unaligned MEM, extend to a DImode form of
1573 the result (which we do specially). */
1574 if (unaligned_memory_operand (operands[1], HImode))
1576 rtx temp = gen_reg_rtx (DImode);
1578 emit_insn (gen_extendhidi2 (temp, operands[1]));
1579 emit_move_insn (operands[0], gen_lowpart (SImode, temp));
1583 operands[0] = gen_lowpart (DImode, operands[0]);
1584 operands[1] = gen_lowpart (DImode, force_reg (HImode, operands[1]));
1585 operands[2] = gen_reg_rtx (DImode);
1588 (define_expand "extendhidi2"
1590 (ashift:DI (match_operand:HI 1 "some_operand" "")
1592 (set (match_operand:DI 0 "register_operand" "")
1593 (ashiftrt:DI (match_dup 2)
1599 emit_insn (gen_extendhidi2x (operands[0],
1600 force_reg (HImode, operands[1])));
1604 if (unaligned_memory_operand (operands[1], HImode))
1607 = gen_unaligned_extendhidi (operands[0],
1608 get_unaligned_address (operands[1], 2));
1610 alpha_set_memflags (seq, operands[1]);
1615 operands[1] = gen_lowpart (DImode, force_reg (HImode, operands[1]));
1616 operands[2] = gen_reg_rtx (DImode);
1619 ;; Here's how we sign extend an unaligned byte and halfword. Doing this
1620 ;; as a pattern saves one instruction. The code is similar to that for
1621 ;; the unaligned loads (see below).
1623 ;; Operand 1 is the address + 1 (+2 for HI), operand 0 is the result.
1624 (define_expand "unaligned_extendqidi"
1625 [(use (match_operand:QI 0 "register_operand" ""))
1626 (use (match_operand:DI 1 "address_operand" ""))]
1629 if (WORDS_BIG_ENDIAN)
1630 emit_insn (gen_unaligned_extendqidi_be (operands[0], operands[1]));
1632 emit_insn (gen_unaligned_extendqidi_le (operands[0], operands[1]));
1636 (define_expand "unaligned_extendqidi_le"
1637 [(set (match_dup 2) (match_operand:DI 1 "address_operand" ""))
1639 (mem:DI (and:DI (plus:DI (match_dup 2) (const_int -1))
1642 (ashift:DI (match_dup 3)
1643 (minus:DI (const_int 64)
1645 (and:DI (match_dup 2) (const_int 7))
1647 (set (subreg:DI (match_operand:QI 0 "register_operand" "") 0)
1648 (ashiftrt:DI (match_dup 4) (const_int 56)))]
1649 "! WORDS_BIG_ENDIAN"
1651 operands[2] = gen_reg_rtx (DImode);
1652 operands[3] = gen_reg_rtx (DImode);
1653 operands[4] = gen_reg_rtx (DImode);
1656 (define_expand "unaligned_extendqidi_be"
1657 [(set (match_dup 2) (match_operand:DI 1 "address_operand" ""))
1658 (set (match_dup 3) (plus:DI (match_dup 2) (const_int -1)))
1660 (mem:DI (and:DI (match_dup 3)
1662 (set (match_dup 5) (plus:DI (match_dup 2) (const_int -2)))
1664 (ashift:DI (match_dup 4)
1667 (plus:DI (match_dup 5) (const_int 1))
1670 (set (subreg:DI (match_operand:QI 0 "register_operand" "") 0)
1671 (ashiftrt:DI (match_dup 6) (const_int 56)))]
1674 operands[2] = gen_reg_rtx (DImode);
1675 operands[3] = gen_reg_rtx (DImode);
1676 operands[4] = gen_reg_rtx (DImode);
1677 operands[5] = gen_reg_rtx (DImode);
1678 operands[6] = gen_reg_rtx (DImode);
1681 (define_expand "unaligned_extendhidi"
1682 [(use (match_operand:QI 0 "register_operand" ""))
1683 (use (match_operand:DI 1 "address_operand" ""))]
1686 operands[0] = gen_lowpart (DImode, operands[0]);
1687 emit_insn ((WORDS_BIG_ENDIAN
1688 ? gen_unaligned_extendhidi_be
1689 : gen_unaligned_extendhidi_le) (operands[0], operands[1]));
1693 (define_expand "unaligned_extendhidi_le"
1694 [(set (match_dup 2) (match_operand:DI 1 "address_operand" ""))
1696 (mem:DI (and:DI (plus:DI (match_dup 2) (const_int -2))
1699 (ashift:DI (match_dup 3)
1700 (minus:DI (const_int 64)
1702 (and:DI (match_dup 2) (const_int 7))
1704 (set (match_operand:DI 0 "register_operand" "")
1705 (ashiftrt:DI (match_dup 4) (const_int 48)))]
1706 "! WORDS_BIG_ENDIAN"
1708 operands[2] = gen_reg_rtx (DImode);
1709 operands[3] = gen_reg_rtx (DImode);
1710 operands[4] = gen_reg_rtx (DImode);
1713 (define_expand "unaligned_extendhidi_be"
1714 [(set (match_dup 2) (match_operand:DI 1 "address_operand" ""))
1715 (set (match_dup 3) (plus:DI (match_dup 2) (const_int -2)))
1717 (mem:DI (and:DI (match_dup 3)
1719 (set (match_dup 5) (plus:DI (match_dup 2) (const_int -3)))
1721 (ashift:DI (match_dup 4)
1724 (plus:DI (match_dup 5) (const_int 1))
1727 (set (match_operand:DI 0 "register_operand" "")
1728 (ashiftrt:DI (match_dup 6) (const_int 48)))]
1731 operands[2] = gen_reg_rtx (DImode);
1732 operands[3] = gen_reg_rtx (DImode);
1733 operands[4] = gen_reg_rtx (DImode);
1734 operands[5] = gen_reg_rtx (DImode);
1735 operands[6] = gen_reg_rtx (DImode);
1738 (define_insn "*extxl_const"
1739 [(set (match_operand:DI 0 "register_operand" "=r")
1740 (zero_extract:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
1741 (match_operand:DI 2 "mode_width_operand" "n")
1742 (match_operand:DI 3 "mul8_operand" "I")))]
1744 "ext%M2l %r1,%s3,%0"
1745 [(set_attr "type" "shift")])
1747 (define_insn "extxl_le"
1748 [(set (match_operand:DI 0 "register_operand" "=r")
1749 (zero_extract:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
1750 (match_operand:DI 2 "mode_width_operand" "n")
1751 (ashift:DI (match_operand:DI 3 "reg_or_8bit_operand" "rI")
1753 "! WORDS_BIG_ENDIAN"
1755 [(set_attr "type" "shift")])
1757 (define_insn "extxl_be"
1758 [(set (match_operand:DI 0 "register_operand" "=r")
1759 (zero_extract:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
1760 (match_operand:DI 2 "mode_width_operand" "n")
1764 (match_operand:DI 3 "reg_or_8bit_operand" "rI")
1768 [(set_attr "type" "shift")])
1770 ;; Combine has some strange notion of preserving existing undefined behavior
1771 ;; in shifts larger than a word size. So capture these patterns that it
1772 ;; should have turned into zero_extracts.
1774 (define_insn "*extxl_1_le"
1775 [(set (match_operand:DI 0 "register_operand" "=r")
1776 (and:DI (lshiftrt:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
1777 (ashift:DI (match_operand:DI 2 "reg_or_8bit_operand" "rI")
1779 (match_operand:DI 3 "mode_mask_operand" "n")))]
1780 "! WORDS_BIG_ENDIAN"
1782 [(set_attr "type" "shift")])
1784 (define_insn "*extxl_1_be"
1785 [(set (match_operand:DI 0 "register_operand" "=r")
1786 (and:DI (lshiftrt:DI
1787 (match_operand:DI 1 "reg_or_0_operand" "rJ")
1788 (minus:DI (const_int 56)
1789 (ashift:DI (match_operand:DI 2 "reg_or_8bit_operand" "rI")
1791 (match_operand:DI 3 "mode_mask_operand" "n")))]
1794 [(set_attr "type" "shift")])
1796 (define_insn "*extql_2_le"
1797 [(set (match_operand:DI 0 "register_operand" "=r")
1798 (lshiftrt:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
1799 (ashift:DI (match_operand:DI 2 "reg_or_8bit_operand" "rI")
1801 "! WORDS_BIG_ENDIAN"
1803 [(set_attr "type" "shift")])
1805 (define_insn "*extql_2_be"
1806 [(set (match_operand:DI 0 "register_operand" "=r")
1808 (match_operand:DI 1 "reg_or_0_operand" "rJ")
1809 (minus:DI (const_int 56)
1811 (match_operand:DI 2 "reg_or_8bit_operand" "rI")
1815 [(set_attr "type" "shift")])
1817 (define_insn "extqh_le"
1818 [(set (match_operand:DI 0 "register_operand" "=r")
1820 (match_operand:DI 1 "reg_or_0_operand" "rJ")
1821 (minus:DI (const_int 64)
1824 (match_operand:DI 2 "reg_or_8bit_operand" "rI")
1827 "! WORDS_BIG_ENDIAN"
1829 [(set_attr "type" "shift")])
1831 (define_insn "extqh_be"
1832 [(set (match_operand:DI 0 "register_operand" "=r")
1834 (match_operand:DI 1 "reg_or_0_operand" "rJ")
1837 (plus:DI (match_operand:DI 2 "reg_or_8bit_operand" "rI")
1843 [(set_attr "type" "shift")])
1845 (define_insn "extlh_le"
1846 [(set (match_operand:DI 0 "register_operand" "=r")
1848 (and:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
1849 (const_int 2147483647))
1850 (minus:DI (const_int 64)
1853 (match_operand:DI 2 "reg_or_8bit_operand" "rI")
1856 "! WORDS_BIG_ENDIAN"
1858 [(set_attr "type" "shift")])
1860 (define_insn "extlh_be"
1861 [(set (match_operand:DI 0 "register_operand" "=r")
1864 (match_operand:DI 1 "reg_or_0_operand" "rJ")
1868 (match_operand:DI 2 "reg_or_8bit_operand" "rI")
1872 (const_int 2147483647)))]
1875 [(set_attr "type" "shift")])
1877 (define_insn "extwh_le"
1878 [(set (match_operand:DI 0 "register_operand" "=r")
1880 (and:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
1882 (minus:DI (const_int 64)
1885 (match_operand:DI 2 "reg_or_8bit_operand" "rI")
1888 "! WORDS_BIG_ENDIAN"
1890 [(set_attr "type" "shift")])
1892 (define_insn "extwh_be"
1893 [(set (match_operand:DI 0 "register_operand" "=r")
1895 (ashift:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
1899 (match_operand:DI 2 "reg_or_8bit_operand" "rI")
1903 (const_int 65535)))]
1906 [(set_attr "type" "shift")])
1908 ;; This converts an extXl into an extXh with an appropriate adjustment
1909 ;; to the address calculation.
1912 ;; [(set (match_operand:DI 0 "register_operand" "")
1913 ;; (ashift:DI (zero_extract:DI (match_operand:DI 1 "register_operand" "")
1914 ;; (match_operand:DI 2 "mode_width_operand" "")
1915 ;; (ashift:DI (match_operand:DI 3 "" "")
1917 ;; (match_operand:DI 4 "const_int_operand" "")))
1918 ;; (clobber (match_operand:DI 5 "register_operand" ""))]
1919 ;; "INTVAL (operands[4]) == 64 - INTVAL (operands[2])"
1920 ;; [(set (match_dup 5) (match_dup 6))
1921 ;; (set (match_dup 0)
1922 ;; (ashift:DI (zero_extract:DI (match_dup 1) (match_dup 2)
1923 ;; (ashift:DI (plus:DI (match_dup 5)
1929 ;; operands[6] = plus_constant (operands[3],
1930 ;; INTVAL (operands[2]) / BITS_PER_UNIT);
1931 ;; operands[7] = GEN_INT (- INTVAL (operands[2]) / BITS_PER_UNIT);
1934 (define_insn "*insbl_const"
1935 [(set (match_operand:DI 0 "register_operand" "=r")
1936 (ashift:DI (zero_extend:DI (match_operand:QI 1 "register_operand" "r"))
1937 (match_operand:DI 2 "mul8_operand" "I")))]
1940 [(set_attr "type" "shift")])
1942 (define_insn "*inswl_const"
1943 [(set (match_operand:DI 0 "register_operand" "=r")
1944 (ashift:DI (zero_extend:DI (match_operand:HI 1 "register_operand" "r"))
1945 (match_operand:DI 2 "mul8_operand" "I")))]
1948 [(set_attr "type" "shift")])
1950 (define_insn "*insll_const"
1951 [(set (match_operand:DI 0 "register_operand" "=r")
1952 (ashift:DI (zero_extend:DI (match_operand:SI 1 "register_operand" "r"))
1953 (match_operand:DI 2 "mul8_operand" "I")))]
1956 [(set_attr "type" "shift")])
1958 (define_insn "insbl_le"
1959 [(set (match_operand:DI 0 "register_operand" "=r")
1960 (ashift:DI (zero_extend:DI (match_operand:QI 1 "register_operand" "r"))
1961 (ashift:DI (match_operand:DI 2 "reg_or_8bit_operand" "rI")
1963 "! WORDS_BIG_ENDIAN"
1965 [(set_attr "type" "shift")])
1967 (define_insn "insbl_be"
1968 [(set (match_operand:DI 0 "register_operand" "=r")
1969 (ashift:DI (zero_extend:DI (match_operand:QI 1 "register_operand" "r"))
1970 (minus:DI (const_int 56)
1971 (ashift:DI (match_operand:DI 2 "reg_or_8bit_operand" "rI")
1975 [(set_attr "type" "shift")])
1977 (define_insn "inswl_le"
1978 [(set (match_operand:DI 0 "register_operand" "=r")
1979 (ashift:DI (zero_extend:DI (match_operand:HI 1 "register_operand" "r"))
1980 (ashift:DI (match_operand:DI 2 "reg_or_8bit_operand" "rI")
1982 "! WORDS_BIG_ENDIAN"
1984 [(set_attr "type" "shift")])
1986 (define_insn "inswl_be"
1987 [(set (match_operand:DI 0 "register_operand" "=r")
1988 (ashift:DI (zero_extend:DI (match_operand:HI 1 "register_operand" "r"))
1989 (minus:DI (const_int 56)
1990 (ashift:DI (match_operand:DI 2 "reg_or_8bit_operand" "rI")
1994 [(set_attr "type" "shift")])
1996 (define_insn "insll_le"
1997 [(set (match_operand:DI 0 "register_operand" "=r")
1998 (ashift:DI (zero_extend:DI (match_operand:SI 1 "register_operand" "r"))
1999 (ashift:DI (match_operand:DI 2 "reg_or_8bit_operand" "rI")
2001 "! WORDS_BIG_ENDIAN"
2003 [(set_attr "type" "shift")])
2005 (define_insn "insll_be"
2006 [(set (match_operand:DI 0 "register_operand" "=r")
2007 (ashift:DI (zero_extend:DI (match_operand:SI 1 "register_operand" "r"))
2008 (minus:DI (const_int 56)
2009 (ashift:DI (match_operand:DI 2 "reg_or_8bit_operand" "rI")
2013 [(set_attr "type" "shift")])
2015 (define_insn "insql_le"
2016 [(set (match_operand:DI 0 "register_operand" "=r")
2017 (ashift:DI (match_operand:DI 1 "register_operand" "r")
2018 (ashift:DI (match_operand:DI 2 "reg_or_8bit_operand" "rI")
2020 "! WORDS_BIG_ENDIAN"
2022 [(set_attr "type" "shift")])
2024 (define_insn "insql_be"
2025 [(set (match_operand:DI 0 "register_operand" "=r")
2026 (ashift:DI (match_operand:DI 1 "register_operand" "r")
2027 (minus:DI (const_int 56)
2028 (ashift:DI (match_operand:DI 2 "reg_or_8bit_operand" "rI")
2032 [(set_attr "type" "shift")])
2034 ;; Combine has this sometimes habit of moving the and outside of the
2035 ;; shift, making life more interesting.
2037 (define_insn "*insxl"
2038 [(set (match_operand:DI 0 "register_operand" "=r")
2039 (and:DI (ashift:DI (match_operand:DI 1 "register_operand" "r")
2040 (match_operand:DI 2 "mul8_operand" "I"))
2041 (match_operand:DI 3 "immediate_operand" "i")))]
2042 "HOST_BITS_PER_WIDE_INT == 64
2043 && GET_CODE (operands[3]) == CONST_INT
2044 && (((unsigned HOST_WIDE_INT) 0xff << INTVAL (operands[2])
2045 == (unsigned HOST_WIDE_INT) INTVAL (operands[3]))
2046 || ((unsigned HOST_WIDE_INT) 0xffff << INTVAL (operands[2])
2047 == (unsigned HOST_WIDE_INT) INTVAL (operands[3]))
2048 || ((unsigned HOST_WIDE_INT) 0xffffffff << INTVAL (operands[2])
2049 == (unsigned HOST_WIDE_INT) INTVAL (operands[3])))"
2051 #if HOST_BITS_PER_WIDE_INT == 64
2052 if ((unsigned HOST_WIDE_INT) 0xff << INTVAL (operands[2])
2053 == (unsigned HOST_WIDE_INT) INTVAL (operands[3]))
2054 return "insbl %1,%s2,%0";
2055 if ((unsigned HOST_WIDE_INT) 0xffff << INTVAL (operands[2])
2056 == (unsigned HOST_WIDE_INT) INTVAL (operands[3]))
2057 return "inswl %1,%s2,%0";
2058 if ((unsigned HOST_WIDE_INT) 0xffffffff << INTVAL (operands[2])
2059 == (unsigned HOST_WIDE_INT) INTVAL (operands[3]))
2060 return "insll %1,%s2,%0";
2064 [(set_attr "type" "shift")])
2066 ;; We do not include the insXh insns because they are complex to express
2067 ;; and it does not appear that we would ever want to generate them.
2069 ;; Since we need them for block moves, though, cop out and use unspec.
2071 (define_insn "insxh"
2072 [(set (match_operand:DI 0 "register_operand" "=r")
2073 (unspec:DI [(match_operand:DI 1 "register_operand" "r")
2074 (match_operand:DI 2 "mode_width_operand" "n")
2075 (match_operand:DI 3 "reg_or_8bit_operand" "rI")]
2079 [(set_attr "type" "shift")])
2081 (define_insn "mskxl_le"
2082 [(set (match_operand:DI 0 "register_operand" "=r")
2083 (and:DI (not:DI (ashift:DI
2084 (match_operand:DI 2 "mode_mask_operand" "n")
2086 (match_operand:DI 3 "reg_or_8bit_operand" "rI")
2088 (match_operand:DI 1 "reg_or_0_operand" "rJ")))]
2089 "! WORDS_BIG_ENDIAN"
2091 [(set_attr "type" "shift")])
2093 (define_insn "mskxl_be"
2094 [(set (match_operand:DI 0 "register_operand" "=r")
2095 (and:DI (not:DI (ashift:DI
2096 (match_operand:DI 2 "mode_mask_operand" "n")
2097 (minus:DI (const_int 56)
2099 (match_operand:DI 3 "reg_or_8bit_operand" "rI")
2101 (match_operand:DI 1 "reg_or_0_operand" "rJ")))]
2104 [(set_attr "type" "shift")])
2106 ;; We do not include the mskXh insns because it does not appear we would
2107 ;; ever generate one.
2109 ;; Again, we do for block moves and we use unspec again.
2111 (define_insn "mskxh"
2112 [(set (match_operand:DI 0 "register_operand" "=r")
2113 (unspec:DI [(match_operand:DI 1 "register_operand" "r")
2114 (match_operand:DI 2 "mode_width_operand" "n")
2115 (match_operand:DI 3 "reg_or_8bit_operand" "rI")]
2119 [(set_attr "type" "shift")])
2121 ;; Prefer AND + NE over LSHIFTRT + AND.
2123 (define_insn_and_split "*ze_and_ne"
2124 [(set (match_operand:DI 0 "register_operand" "=r")
2125 (zero_extract:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
2127 (match_operand 2 "const_int_operand" "I")))]
2128 "(unsigned HOST_WIDE_INT) INTVAL (operands[2]) < 8"
2130 "(unsigned HOST_WIDE_INT) INTVAL (operands[2]) < 8"
2132 (and:DI (match_dup 1) (match_dup 3)))
2134 (ne:DI (match_dup 0) (const_int 0)))]
2135 "operands[3] = GEN_INT (1 << INTVAL (operands[2]));")
2137 ;; Floating-point operations. All the double-precision insns can extend
2138 ;; from single, so indicate that. The exception are the ones that simply
2139 ;; play with the sign bits; it's not clear what to do there.
2141 (define_insn "abssf2"
2142 [(set (match_operand:SF 0 "register_operand" "=f")
2143 (abs:SF (match_operand:SF 1 "reg_or_0_operand" "fG")))]
2146 [(set_attr "type" "fcpys")])
2148 (define_insn "*nabssf2"
2149 [(set (match_operand:SF 0 "register_operand" "=f")
2150 (neg:SF (abs:SF (match_operand:SF 1 "reg_or_0_operand" "fG"))))]
2153 [(set_attr "type" "fadd")])
2155 (define_insn "absdf2"
2156 [(set (match_operand:DF 0 "register_operand" "=f")
2157 (abs:DF (match_operand:DF 1 "reg_or_0_operand" "fG")))]
2160 [(set_attr "type" "fcpys")])
2162 (define_insn "*nabsdf2"
2163 [(set (match_operand:DF 0 "register_operand" "=f")
2164 (neg:DF (abs:DF (match_operand:DF 1 "reg_or_0_operand" "fG"))))]
2167 [(set_attr "type" "fadd")])
2169 (define_expand "abstf2"
2170 [(parallel [(set (match_operand:TF 0 "register_operand" "")
2171 (abs:TF (match_operand:TF 1 "reg_or_0_operand" "")))
2172 (use (match_dup 2))])]
2173 "TARGET_HAS_XFLOATING_LIBS"
2175 #if HOST_BITS_PER_WIDE_INT >= 64
2176 operands[2] = force_reg (DImode, GEN_INT ((HOST_WIDE_INT) 1 << 63));
2178 operands[2] = force_reg (DImode, immed_double_const (0, 0x80000000, DImode));
2182 (define_insn_and_split "*abstf_internal"
2183 [(set (match_operand:TF 0 "register_operand" "=r")
2184 (abs:TF (match_operand:TF 1 "reg_or_0_operand" "rG")))
2185 (use (match_operand:DI 2 "register_operand" "r"))]
2186 "TARGET_HAS_XFLOATING_LIBS"
2188 "&& reload_completed"
2190 "alpha_split_tfmode_frobsign (operands, gen_andnotdi3); DONE;")
2192 (define_insn "negsf2"
2193 [(set (match_operand:SF 0 "register_operand" "=f")
2194 (neg:SF (match_operand:SF 1 "reg_or_0_operand" "fG")))]
2197 [(set_attr "type" "fadd")])
2199 (define_insn "negdf2"
2200 [(set (match_operand:DF 0 "register_operand" "=f")
2201 (neg:DF (match_operand:DF 1 "reg_or_0_operand" "fG")))]
2204 [(set_attr "type" "fadd")])
2206 (define_expand "negtf2"
2207 [(parallel [(set (match_operand:TF 0 "register_operand" "")
2208 (neg:TF (match_operand:TF 1 "reg_or_0_operand" "")))
2209 (use (match_dup 2))])]
2210 "TARGET_HAS_XFLOATING_LIBS"
2212 #if HOST_BITS_PER_WIDE_INT >= 64
2213 operands[2] = force_reg (DImode, GEN_INT ((HOST_WIDE_INT) 1 << 63));
2215 operands[2] = force_reg (DImode, immed_double_const (0, 0x80000000, DImode));
2219 (define_insn_and_split "*negtf_internal"
2220 [(set (match_operand:TF 0 "register_operand" "=r")
2221 (neg:TF (match_operand:TF 1 "reg_or_0_operand" "rG")))
2222 (use (match_operand:DI 2 "register_operand" "r"))]
2223 "TARGET_HAS_XFLOATING_LIBS"
2225 "&& reload_completed"
2227 "alpha_split_tfmode_frobsign (operands, gen_xordi3); DONE;")
2229 (define_insn "*addsf_ieee"
2230 [(set (match_operand:SF 0 "register_operand" "=&f")
2231 (plus:SF (match_operand:SF 1 "reg_or_0_operand" "%fG")
2232 (match_operand:SF 2 "reg_or_0_operand" "fG")))]
2233 "TARGET_FP && alpha_fptm >= ALPHA_FPTM_SU"
2234 "add%,%/ %R1,%R2,%0"
2235 [(set_attr "type" "fadd")
2236 (set_attr "trap" "yes")
2237 (set_attr "round_suffix" "normal")
2238 (set_attr "trap_suffix" "u_su_sui")])
2240 (define_insn "addsf3"
2241 [(set (match_operand:SF 0 "register_operand" "=f")
2242 (plus:SF (match_operand:SF 1 "reg_or_0_operand" "%fG")
2243 (match_operand:SF 2 "reg_or_0_operand" "fG")))]
2245 "add%,%/ %R1,%R2,%0"
2246 [(set_attr "type" "fadd")
2247 (set_attr "trap" "yes")
2248 (set_attr "round_suffix" "normal")
2249 (set_attr "trap_suffix" "u_su_sui")])
2251 (define_insn "*adddf_ieee"
2252 [(set (match_operand:DF 0 "register_operand" "=&f")
2253 (plus:DF (match_operand:DF 1 "reg_or_0_operand" "%fG")
2254 (match_operand:DF 2 "reg_or_0_operand" "fG")))]
2255 "TARGET_FP && alpha_fptm >= ALPHA_FPTM_SU"
2256 "add%-%/ %R1,%R2,%0"
2257 [(set_attr "type" "fadd")
2258 (set_attr "trap" "yes")
2259 (set_attr "round_suffix" "normal")
2260 (set_attr "trap_suffix" "u_su_sui")])
2262 (define_insn "adddf3"
2263 [(set (match_operand:DF 0 "register_operand" "=f")
2264 (plus:DF (match_operand:DF 1 "reg_or_0_operand" "%fG")
2265 (match_operand:DF 2 "reg_or_0_operand" "fG")))]
2267 "add%-%/ %R1,%R2,%0"
2268 [(set_attr "type" "fadd")
2269 (set_attr "trap" "yes")
2270 (set_attr "round_suffix" "normal")
2271 (set_attr "trap_suffix" "u_su_sui")])
2273 (define_insn "*adddf_ext1"
2274 [(set (match_operand:DF 0 "register_operand" "=f")
2275 (plus:DF (float_extend:DF
2276 (match_operand:SF 1 "reg_or_0_operand" "fG"))
2277 (match_operand:DF 2 "reg_or_0_operand" "fG")))]
2278 "TARGET_FP && alpha_fptm < ALPHA_FPTM_SU"
2279 "add%-%/ %R1,%R2,%0"
2280 [(set_attr "type" "fadd")
2281 (set_attr "trap" "yes")
2282 (set_attr "round_suffix" "normal")
2283 (set_attr "trap_suffix" "u_su_sui")])
2285 (define_insn "*adddf_ext2"
2286 [(set (match_operand:DF 0 "register_operand" "=f")
2287 (plus:DF (float_extend:DF
2288 (match_operand:SF 1 "reg_or_0_operand" "%fG"))
2290 (match_operand:SF 2 "reg_or_0_operand" "fG"))))]
2291 "TARGET_FP && alpha_fptm < ALPHA_FPTM_SU"
2292 "add%-%/ %R1,%R2,%0"
2293 [(set_attr "type" "fadd")
2294 (set_attr "trap" "yes")
2295 (set_attr "round_suffix" "normal")
2296 (set_attr "trap_suffix" "u_su_sui")])
2298 (define_expand "addtf3"
2299 [(use (match_operand 0 "register_operand" ""))
2300 (use (match_operand 1 "general_operand" ""))
2301 (use (match_operand 2 "general_operand" ""))]
2302 "TARGET_HAS_XFLOATING_LIBS"
2303 "alpha_emit_xfloating_arith (PLUS, operands); DONE;")
2305 ;; Define conversion operators between DFmode and SImode, using the cvtql
2306 ;; instruction. To allow combine et al to do useful things, we keep the
2307 ;; operation as a unit until after reload, at which point we split the
2310 ;; Note that we (attempt to) only consider this optimization when the
2311 ;; ultimate destination is memory. If we will be doing further integer
2312 ;; processing, it is cheaper to do the truncation in the int regs.
2314 (define_insn "*cvtql"
2315 [(set (match_operand:SI 0 "register_operand" "=f")
2316 (unspec:SI [(match_operand:DI 1 "reg_or_0_operand" "fG")]
2320 [(set_attr "type" "fadd")
2321 (set_attr "trap" "yes")
2322 (set_attr "trap_suffix" "v_sv")])
2324 (define_insn_and_split "*fix_truncdfsi_ieee"
2325 [(set (match_operand:SI 0 "memory_operand" "=m")
2326 (subreg:SI (fix:DI (match_operand:DF 1 "reg_or_0_operand" "fG")) 0))
2327 (clobber (match_scratch:DI 2 "=&f"))
2328 (clobber (match_scratch:SI 3 "=&f"))]
2329 "TARGET_FP && alpha_fptm >= ALPHA_FPTM_SU"
2331 "&& reload_completed"
2332 [(set (match_dup 2) (fix:DI (match_dup 1)))
2333 (set (match_dup 3) (unspec:SI [(match_dup 2)] UNSPEC_CVTQL))
2334 (set (match_dup 0) (match_dup 3))]
2336 [(set_attr "type" "fadd")
2337 (set_attr "trap" "yes")])
2339 (define_insn_and_split "*fix_truncdfsi_internal"
2340 [(set (match_operand:SI 0 "memory_operand" "=m")
2341 (subreg:SI (fix:DI (match_operand:DF 1 "reg_or_0_operand" "fG")) 0))
2342 (clobber (match_scratch:DI 2 "=f"))]
2343 "TARGET_FP && alpha_fptm < ALPHA_FPTM_SU"
2345 "&& reload_completed"
2346 [(set (match_dup 2) (fix:DI (match_dup 1)))
2347 (set (match_dup 3) (unspec:SI [(match_dup 2)] UNSPEC_CVTQL))
2348 (set (match_dup 0) (match_dup 3))]
2349 ;; Due to REG_CANNOT_CHANGE_SIZE issues, we cannot simply use SUBREG.
2350 "operands[3] = gen_rtx_REG (SImode, REGNO (operands[2]));"
2351 [(set_attr "type" "fadd")
2352 (set_attr "trap" "yes")])
2354 (define_insn "*fix_truncdfdi_ieee"
2355 [(set (match_operand:DI 0 "reg_no_subreg_operand" "=&f")
2356 (fix:DI (match_operand:DF 1 "reg_or_0_operand" "fG")))]
2357 "TARGET_FP && alpha_fptm >= ALPHA_FPTM_SU"
2359 [(set_attr "type" "fadd")
2360 (set_attr "trap" "yes")
2361 (set_attr "round_suffix" "c")
2362 (set_attr "trap_suffix" "v_sv_svi")])
2364 (define_insn "fix_truncdfdi2"
2365 [(set (match_operand:DI 0 "reg_no_subreg_operand" "=f")
2366 (fix:DI (match_operand:DF 1 "reg_or_0_operand" "fG")))]
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 ;; Likewise between SFmode and SImode.
2376 (define_insn_and_split "*fix_truncsfsi_ieee"
2377 [(set (match_operand:SI 0 "memory_operand" "=m")
2378 (subreg:SI (fix:DI (float_extend:DF
2379 (match_operand:SF 1 "reg_or_0_operand" "fG"))) 0))
2380 (clobber (match_scratch:DI 2 "=&f"))
2381 (clobber (match_scratch:SI 3 "=&f"))]
2382 "TARGET_FP && alpha_fptm >= ALPHA_FPTM_SU"
2384 "&& reload_completed"
2385 [(set (match_dup 2) (fix:DI (float_extend:DF (match_dup 1))))
2386 (set (match_dup 3) (unspec:SI [(match_dup 2)] UNSPEC_CVTQL))
2387 (set (match_dup 0) (match_dup 3))]
2389 [(set_attr "type" "fadd")
2390 (set_attr "trap" "yes")])
2392 (define_insn_and_split "*fix_truncsfsi_internal"
2393 [(set (match_operand:SI 0 "memory_operand" "=m")
2394 (subreg:SI (fix:DI (float_extend:DF
2395 (match_operand:SF 1 "reg_or_0_operand" "fG"))) 0))
2396 (clobber (match_scratch:DI 2 "=f"))]
2397 "TARGET_FP && alpha_fptm < ALPHA_FPTM_SU"
2399 "&& reload_completed"
2400 [(set (match_dup 2) (fix:DI (float_extend:DF (match_dup 1))))
2401 (set (match_dup 3) (unspec:SI [(match_dup 2)] UNSPEC_CVTQL))
2402 (set (match_dup 0) (match_dup 3))]
2403 ;; Due to REG_CANNOT_CHANGE_SIZE issues, we cannot simply use SUBREG.
2404 "operands[3] = gen_rtx_REG (SImode, REGNO (operands[2]));"
2405 [(set_attr "type" "fadd")
2406 (set_attr "trap" "yes")])
2408 (define_insn "*fix_truncsfdi_ieee"
2409 [(set (match_operand:DI 0 "reg_no_subreg_operand" "=&f")
2410 (fix:DI (float_extend:DF
2411 (match_operand:SF 1 "reg_or_0_operand" "fG"))))]
2412 "TARGET_FP && alpha_fptm >= ALPHA_FPTM_SU"
2414 [(set_attr "type" "fadd")
2415 (set_attr "trap" "yes")
2416 (set_attr "round_suffix" "c")
2417 (set_attr "trap_suffix" "v_sv_svi")])
2419 (define_insn "fix_truncsfdi2"
2420 [(set (match_operand:DI 0 "reg_no_subreg_operand" "=f")
2421 (fix:DI (float_extend:DF
2422 (match_operand:SF 1 "reg_or_0_operand" "fG"))))]
2425 [(set_attr "type" "fadd")
2426 (set_attr "trap" "yes")
2427 (set_attr "round_suffix" "c")
2428 (set_attr "trap_suffix" "v_sv_svi")])
2430 (define_expand "fix_trunctfdi2"
2431 [(use (match_operand:DI 0 "register_operand" ""))
2432 (use (match_operand:TF 1 "general_operand" ""))]
2433 "TARGET_HAS_XFLOATING_LIBS"
2434 "alpha_emit_xfloating_cvt (FIX, operands); DONE;")
2436 (define_insn "*floatdisf_ieee"
2437 [(set (match_operand:SF 0 "register_operand" "=&f")
2438 (float:SF (match_operand:DI 1 "reg_no_subreg_operand" "f")))]
2439 "TARGET_FP && alpha_fptm >= ALPHA_FPTM_SU"
2441 [(set_attr "type" "fadd")
2442 (set_attr "trap" "yes")
2443 (set_attr "round_suffix" "normal")
2444 (set_attr "trap_suffix" "sui")])
2446 (define_insn "floatdisf2"
2447 [(set (match_operand:SF 0 "register_operand" "=f")
2448 (float:SF (match_operand:DI 1 "reg_no_subreg_operand" "f")))]
2451 [(set_attr "type" "fadd")
2452 (set_attr "trap" "yes")
2453 (set_attr "round_suffix" "normal")
2454 (set_attr "trap_suffix" "sui")])
2456 (define_insn "*floatdidf_ieee"
2457 [(set (match_operand:DF 0 "register_operand" "=&f")
2458 (float:DF (match_operand:DI 1 "reg_no_subreg_operand" "f")))]
2459 "TARGET_FP && alpha_fptm >= ALPHA_FPTM_SU"
2461 [(set_attr "type" "fadd")
2462 (set_attr "trap" "yes")
2463 (set_attr "round_suffix" "normal")
2464 (set_attr "trap_suffix" "sui")])
2466 (define_insn "floatdidf2"
2467 [(set (match_operand:DF 0 "register_operand" "=f")
2468 (float:DF (match_operand:DI 1 "reg_no_subreg_operand" "f")))]
2471 [(set_attr "type" "fadd")
2472 (set_attr "trap" "yes")
2473 (set_attr "round_suffix" "normal")
2474 (set_attr "trap_suffix" "sui")])
2476 (define_expand "floatditf2"
2477 [(use (match_operand:TF 0 "register_operand" ""))
2478 (use (match_operand:DI 1 "general_operand" ""))]
2479 "TARGET_HAS_XFLOATING_LIBS"
2480 "alpha_emit_xfloating_cvt (FLOAT, operands); DONE;")
2482 (define_expand "floatunsdisf2"
2483 [(use (match_operand:SF 0 "register_operand" ""))
2484 (use (match_operand:DI 1 "register_operand" ""))]
2486 "alpha_emit_floatuns (operands); DONE;")
2488 (define_expand "floatunsdidf2"
2489 [(use (match_operand:DF 0 "register_operand" ""))
2490 (use (match_operand:DI 1 "register_operand" ""))]
2492 "alpha_emit_floatuns (operands); DONE;")
2494 (define_expand "floatunsditf2"
2495 [(use (match_operand:TF 0 "register_operand" ""))
2496 (use (match_operand:DI 1 "general_operand" ""))]
2497 "TARGET_HAS_XFLOATING_LIBS"
2498 "alpha_emit_xfloating_cvt (UNSIGNED_FLOAT, operands); DONE;")
2500 (define_expand "extendsfdf2"
2501 [(set (match_operand:DF 0 "register_operand" "")
2502 (float_extend:DF (match_operand:SF 1 "nonimmediate_operand" "")))]
2505 if (alpha_fptm >= ALPHA_FPTM_SU)
2506 operands[1] = force_reg (SFmode, operands[1]);
2509 ;; The Unicos/Mk assembler doesn't support cvtst, but we've already
2510 ;; asserted that alpha_fptm == ALPHA_FPTM_N.
2512 (define_insn "*extendsfdf2_ieee"
2513 [(set (match_operand:DF 0 "register_operand" "=&f")
2514 (float_extend:DF (match_operand:SF 1 "register_operand" "f")))]
2515 "TARGET_FP && alpha_fptm >= ALPHA_FPTM_SU"
2517 [(set_attr "type" "fadd")
2518 (set_attr "trap" "yes")])
2520 (define_insn "*extendsfdf2_internal"
2521 [(set (match_operand:DF 0 "register_operand" "=f,f,m")
2522 (float_extend:DF (match_operand:SF 1 "nonimmediate_operand" "f,m,f")))]
2523 "TARGET_FP && alpha_fptm < ALPHA_FPTM_SU"
2528 [(set_attr "type" "fcpys,fld,fst")])
2530 (define_expand "extendsftf2"
2531 [(use (match_operand:TF 0 "register_operand" ""))
2532 (use (match_operand:SF 1 "general_operand" ""))]
2533 "TARGET_HAS_XFLOATING_LIBS"
2535 rtx tmp = gen_reg_rtx (DFmode);
2536 emit_insn (gen_extendsfdf2 (tmp, operands[1]));
2537 emit_insn (gen_extenddftf2 (operands[0], tmp));
2541 (define_expand "extenddftf2"
2542 [(use (match_operand:TF 0 "register_operand" ""))
2543 (use (match_operand:DF 1 "general_operand" ""))]
2544 "TARGET_HAS_XFLOATING_LIBS"
2545 "alpha_emit_xfloating_cvt (FLOAT_EXTEND, operands); DONE;")
2547 (define_insn "*truncdfsf2_ieee"
2548 [(set (match_operand:SF 0 "register_operand" "=&f")
2549 (float_truncate:SF (match_operand:DF 1 "reg_or_0_operand" "fG")))]
2550 "TARGET_FP && alpha_fptm >= ALPHA_FPTM_SU"
2552 [(set_attr "type" "fadd")
2553 (set_attr "trap" "yes")
2554 (set_attr "round_suffix" "normal")
2555 (set_attr "trap_suffix" "u_su_sui")])
2557 (define_insn "truncdfsf2"
2558 [(set (match_operand:SF 0 "register_operand" "=f")
2559 (float_truncate:SF (match_operand:DF 1 "reg_or_0_operand" "fG")))]
2562 [(set_attr "type" "fadd")
2563 (set_attr "trap" "yes")
2564 (set_attr "round_suffix" "normal")
2565 (set_attr "trap_suffix" "u_su_sui")])
2567 (define_expand "trunctfdf2"
2568 [(use (match_operand:DF 0 "register_operand" ""))
2569 (use (match_operand:TF 1 "general_operand" ""))]
2570 "TARGET_HAS_XFLOATING_LIBS"
2571 "alpha_emit_xfloating_cvt (FLOAT_TRUNCATE, operands); DONE;")
2573 (define_expand "trunctfsf2"
2574 [(use (match_operand:SF 0 "register_operand" ""))
2575 (use (match_operand:TF 1 "general_operand" ""))]
2576 "TARGET_FP && TARGET_HAS_XFLOATING_LIBS"
2578 rtx tmpf, sticky, arg, lo, hi;
2580 tmpf = gen_reg_rtx (DFmode);
2581 sticky = gen_reg_rtx (DImode);
2582 arg = copy_to_mode_reg (TFmode, operands[1]);
2583 lo = gen_lowpart (DImode, arg);
2584 hi = gen_highpart (DImode, arg);
2586 /* Convert the low word of the TFmode value into a sticky rounding bit,
2587 then or it into the low bit of the high word. This leaves the sticky
2588 bit at bit 48 of the fraction, which is representable in DFmode,
2589 which prevents rounding error in the final conversion to SFmode. */
2591 emit_insn (gen_rtx_SET (VOIDmode, sticky,
2592 gen_rtx_NE (DImode, lo, const0_rtx)));
2593 emit_insn (gen_iordi3 (hi, hi, sticky));
2594 emit_insn (gen_trunctfdf2 (tmpf, arg));
2595 emit_insn (gen_truncdfsf2 (operands[0], tmpf));
2599 (define_insn "*divsf3_ieee"
2600 [(set (match_operand:SF 0 "register_operand" "=&f")
2601 (div:SF (match_operand:SF 1 "reg_or_0_operand" "fG")
2602 (match_operand:SF 2 "reg_or_0_operand" "fG")))]
2603 "TARGET_FP && alpha_fptm >= ALPHA_FPTM_SU"
2604 "div%,%/ %R1,%R2,%0"
2605 [(set_attr "type" "fdiv")
2606 (set_attr "opsize" "si")
2607 (set_attr "trap" "yes")
2608 (set_attr "round_suffix" "normal")
2609 (set_attr "trap_suffix" "u_su_sui")])
2611 (define_insn "divsf3"
2612 [(set (match_operand:SF 0 "register_operand" "=f")
2613 (div:SF (match_operand:SF 1 "reg_or_0_operand" "fG")
2614 (match_operand:SF 2 "reg_or_0_operand" "fG")))]
2616 "div%,%/ %R1,%R2,%0"
2617 [(set_attr "type" "fdiv")
2618 (set_attr "opsize" "si")
2619 (set_attr "trap" "yes")
2620 (set_attr "round_suffix" "normal")
2621 (set_attr "trap_suffix" "u_su_sui")])
2623 (define_insn "*divdf3_ieee"
2624 [(set (match_operand:DF 0 "register_operand" "=&f")
2625 (div:DF (match_operand:DF 1 "reg_or_0_operand" "fG")
2626 (match_operand:DF 2 "reg_or_0_operand" "fG")))]
2627 "TARGET_FP && alpha_fptm >= ALPHA_FPTM_SU"
2628 "div%-%/ %R1,%R2,%0"
2629 [(set_attr "type" "fdiv")
2630 (set_attr "trap" "yes")
2631 (set_attr "round_suffix" "normal")
2632 (set_attr "trap_suffix" "u_su_sui")])
2634 (define_insn "divdf3"
2635 [(set (match_operand:DF 0 "register_operand" "=f")
2636 (div:DF (match_operand:DF 1 "reg_or_0_operand" "fG")
2637 (match_operand:DF 2 "reg_or_0_operand" "fG")))]
2639 "div%-%/ %R1,%R2,%0"
2640 [(set_attr "type" "fdiv")
2641 (set_attr "trap" "yes")
2642 (set_attr "round_suffix" "normal")
2643 (set_attr "trap_suffix" "u_su_sui")])
2645 (define_insn "*divdf_ext1"
2646 [(set (match_operand:DF 0 "register_operand" "=f")
2647 (div:DF (float_extend:DF (match_operand:SF 1 "reg_or_0_operand" "fG"))
2648 (match_operand:DF 2 "reg_or_0_operand" "fG")))]
2649 "TARGET_FP && alpha_fptm < ALPHA_FPTM_SU"
2650 "div%-%/ %R1,%R2,%0"
2651 [(set_attr "type" "fdiv")
2652 (set_attr "trap" "yes")
2653 (set_attr "round_suffix" "normal")
2654 (set_attr "trap_suffix" "u_su_sui")])
2656 (define_insn "*divdf_ext2"
2657 [(set (match_operand:DF 0 "register_operand" "=f")
2658 (div:DF (match_operand:DF 1 "reg_or_0_operand" "fG")
2660 (match_operand:SF 2 "reg_or_0_operand" "fG"))))]
2661 "TARGET_FP && alpha_fptm < ALPHA_FPTM_SU"
2662 "div%-%/ %R1,%R2,%0"
2663 [(set_attr "type" "fdiv")
2664 (set_attr "trap" "yes")
2665 (set_attr "round_suffix" "normal")
2666 (set_attr "trap_suffix" "u_su_sui")])
2668 (define_insn "*divdf_ext3"
2669 [(set (match_operand:DF 0 "register_operand" "=f")
2670 (div:DF (float_extend:DF (match_operand:SF 1 "reg_or_0_operand" "fG"))
2671 (float_extend:DF (match_operand:SF 2 "reg_or_0_operand" "fG"))))]
2672 "TARGET_FP && alpha_fptm < ALPHA_FPTM_SU"
2673 "div%-%/ %R1,%R2,%0"
2674 [(set_attr "type" "fdiv")
2675 (set_attr "trap" "yes")
2676 (set_attr "round_suffix" "normal")
2677 (set_attr "trap_suffix" "u_su_sui")])
2679 (define_expand "divtf3"
2680 [(use (match_operand 0 "register_operand" ""))
2681 (use (match_operand 1 "general_operand" ""))
2682 (use (match_operand 2 "general_operand" ""))]
2683 "TARGET_HAS_XFLOATING_LIBS"
2684 "alpha_emit_xfloating_arith (DIV, operands); DONE;")
2686 (define_insn "*mulsf3_ieee"
2687 [(set (match_operand:SF 0 "register_operand" "=&f")
2688 (mult:SF (match_operand:SF 1 "reg_or_0_operand" "%fG")
2689 (match_operand:SF 2 "reg_or_0_operand" "fG")))]
2690 "TARGET_FP && alpha_fptm >= ALPHA_FPTM_SU"
2691 "mul%,%/ %R1,%R2,%0"
2692 [(set_attr "type" "fmul")
2693 (set_attr "trap" "yes")
2694 (set_attr "round_suffix" "normal")
2695 (set_attr "trap_suffix" "u_su_sui")])
2697 (define_insn "mulsf3"
2698 [(set (match_operand:SF 0 "register_operand" "=f")
2699 (mult:SF (match_operand:SF 1 "reg_or_0_operand" "%fG")
2700 (match_operand:SF 2 "reg_or_0_operand" "fG")))]
2702 "mul%,%/ %R1,%R2,%0"
2703 [(set_attr "type" "fmul")
2704 (set_attr "trap" "yes")
2705 (set_attr "round_suffix" "normal")
2706 (set_attr "trap_suffix" "u_su_sui")])
2708 (define_insn "*muldf3_ieee"
2709 [(set (match_operand:DF 0 "register_operand" "=&f")
2710 (mult:DF (match_operand:DF 1 "reg_or_0_operand" "%fG")
2711 (match_operand:DF 2 "reg_or_0_operand" "fG")))]
2712 "TARGET_FP && alpha_fptm >= ALPHA_FPTM_SU"
2713 "mul%-%/ %R1,%R2,%0"
2714 [(set_attr "type" "fmul")
2715 (set_attr "trap" "yes")
2716 (set_attr "round_suffix" "normal")
2717 (set_attr "trap_suffix" "u_su_sui")])
2719 (define_insn "muldf3"
2720 [(set (match_operand:DF 0 "register_operand" "=f")
2721 (mult:DF (match_operand:DF 1 "reg_or_0_operand" "%fG")
2722 (match_operand:DF 2 "reg_or_0_operand" "fG")))]
2724 "mul%-%/ %R1,%R2,%0"
2725 [(set_attr "type" "fmul")
2726 (set_attr "trap" "yes")
2727 (set_attr "round_suffix" "normal")
2728 (set_attr "trap_suffix" "u_su_sui")])
2730 (define_insn "*muldf_ext1"
2731 [(set (match_operand:DF 0 "register_operand" "=f")
2732 (mult:DF (float_extend:DF
2733 (match_operand:SF 1 "reg_or_0_operand" "fG"))
2734 (match_operand:DF 2 "reg_or_0_operand" "fG")))]
2735 "TARGET_FP && alpha_fptm < ALPHA_FPTM_SU"
2736 "mul%-%/ %R1,%R2,%0"
2737 [(set_attr "type" "fmul")
2738 (set_attr "trap" "yes")
2739 (set_attr "round_suffix" "normal")
2740 (set_attr "trap_suffix" "u_su_sui")])
2742 (define_insn "*muldf_ext2"
2743 [(set (match_operand:DF 0 "register_operand" "=f")
2744 (mult:DF (float_extend:DF
2745 (match_operand:SF 1 "reg_or_0_operand" "%fG"))
2747 (match_operand:SF 2 "reg_or_0_operand" "fG"))))]
2748 "TARGET_FP && alpha_fptm < ALPHA_FPTM_SU"
2749 "mul%-%/ %R1,%R2,%0"
2750 [(set_attr "type" "fmul")
2751 (set_attr "trap" "yes")
2752 (set_attr "round_suffix" "normal")
2753 (set_attr "trap_suffix" "u_su_sui")])
2755 (define_expand "multf3"
2756 [(use (match_operand 0 "register_operand" ""))
2757 (use (match_operand 1 "general_operand" ""))
2758 (use (match_operand 2 "general_operand" ""))]
2759 "TARGET_HAS_XFLOATING_LIBS"
2760 "alpha_emit_xfloating_arith (MULT, operands); DONE;")
2762 (define_insn "*subsf3_ieee"
2763 [(set (match_operand:SF 0 "register_operand" "=&f")
2764 (minus:SF (match_operand:SF 1 "reg_or_0_operand" "fG")
2765 (match_operand:SF 2 "reg_or_0_operand" "fG")))]
2766 "TARGET_FP && alpha_fptm >= ALPHA_FPTM_SU"
2767 "sub%,%/ %R1,%R2,%0"
2768 [(set_attr "type" "fadd")
2769 (set_attr "trap" "yes")
2770 (set_attr "round_suffix" "normal")
2771 (set_attr "trap_suffix" "u_su_sui")])
2773 (define_insn "subsf3"
2774 [(set (match_operand:SF 0 "register_operand" "=f")
2775 (minus:SF (match_operand:SF 1 "reg_or_0_operand" "fG")
2776 (match_operand:SF 2 "reg_or_0_operand" "fG")))]
2778 "sub%,%/ %R1,%R2,%0"
2779 [(set_attr "type" "fadd")
2780 (set_attr "trap" "yes")
2781 (set_attr "round_suffix" "normal")
2782 (set_attr "trap_suffix" "u_su_sui")])
2784 (define_insn "*subdf3_ieee"
2785 [(set (match_operand:DF 0 "register_operand" "=&f")
2786 (minus:DF (match_operand:DF 1 "reg_or_0_operand" "fG")
2787 (match_operand:DF 2 "reg_or_0_operand" "fG")))]
2788 "TARGET_FP && alpha_fptm >= ALPHA_FPTM_SU"
2789 "sub%-%/ %R1,%R2,%0"
2790 [(set_attr "type" "fadd")
2791 (set_attr "trap" "yes")
2792 (set_attr "round_suffix" "normal")
2793 (set_attr "trap_suffix" "u_su_sui")])
2795 (define_insn "subdf3"
2796 [(set (match_operand:DF 0 "register_operand" "=f")
2797 (minus:DF (match_operand:DF 1 "reg_or_0_operand" "fG")
2798 (match_operand:DF 2 "reg_or_0_operand" "fG")))]
2800 "sub%-%/ %R1,%R2,%0"
2801 [(set_attr "type" "fadd")
2802 (set_attr "trap" "yes")
2803 (set_attr "round_suffix" "normal")
2804 (set_attr "trap_suffix" "u_su_sui")])
2806 (define_insn "*subdf_ext1"
2807 [(set (match_operand:DF 0 "register_operand" "=f")
2808 (minus:DF (float_extend:DF
2809 (match_operand:SF 1 "reg_or_0_operand" "fG"))
2810 (match_operand:DF 2 "reg_or_0_operand" "fG")))]
2811 "TARGET_FP && alpha_fptm < ALPHA_FPTM_SU"
2812 "sub%-%/ %R1,%R2,%0"
2813 [(set_attr "type" "fadd")
2814 (set_attr "trap" "yes")
2815 (set_attr "round_suffix" "normal")
2816 (set_attr "trap_suffix" "u_su_sui")])
2818 (define_insn "*subdf_ext2"
2819 [(set (match_operand:DF 0 "register_operand" "=f")
2820 (minus:DF (match_operand:DF 1 "reg_or_0_operand" "fG")
2822 (match_operand:SF 2 "reg_or_0_operand" "fG"))))]
2823 "TARGET_FP && alpha_fptm < ALPHA_FPTM_SU"
2824 "sub%-%/ %R1,%R2,%0"
2825 [(set_attr "type" "fadd")
2826 (set_attr "trap" "yes")
2827 (set_attr "round_suffix" "normal")
2828 (set_attr "trap_suffix" "u_su_sui")])
2830 (define_insn "*subdf_ext3"
2831 [(set (match_operand:DF 0 "register_operand" "=f")
2832 (minus:DF (float_extend:DF
2833 (match_operand:SF 1 "reg_or_0_operand" "fG"))
2835 (match_operand:SF 2 "reg_or_0_operand" "fG"))))]
2836 "TARGET_FP && alpha_fptm < ALPHA_FPTM_SU"
2837 "sub%-%/ %R1,%R2,%0"
2838 [(set_attr "type" "fadd")
2839 (set_attr "trap" "yes")
2840 (set_attr "round_suffix" "normal")
2841 (set_attr "trap_suffix" "u_su_sui")])
2843 (define_expand "subtf3"
2844 [(use (match_operand 0 "register_operand" ""))
2845 (use (match_operand 1 "general_operand" ""))
2846 (use (match_operand 2 "general_operand" ""))]
2847 "TARGET_HAS_XFLOATING_LIBS"
2848 "alpha_emit_xfloating_arith (MINUS, operands); DONE;")
2850 (define_insn "*sqrtsf2_ieee"
2851 [(set (match_operand:SF 0 "register_operand" "=&f")
2852 (sqrt:SF (match_operand:SF 1 "reg_or_0_operand" "fG")))]
2853 "TARGET_FP && TARGET_FIX && alpha_fptm >= ALPHA_FPTM_SU"
2855 [(set_attr "type" "fsqrt")
2856 (set_attr "opsize" "si")
2857 (set_attr "trap" "yes")
2858 (set_attr "round_suffix" "normal")
2859 (set_attr "trap_suffix" "u_su_sui")])
2861 (define_insn "sqrtsf2"
2862 [(set (match_operand:SF 0 "register_operand" "=f")
2863 (sqrt:SF (match_operand:SF 1 "reg_or_0_operand" "fG")))]
2864 "TARGET_FP && TARGET_FIX"
2866 [(set_attr "type" "fsqrt")
2867 (set_attr "opsize" "si")
2868 (set_attr "trap" "yes")
2869 (set_attr "round_suffix" "normal")
2870 (set_attr "trap_suffix" "u_su_sui")])
2872 (define_insn "*sqrtdf2_ieee"
2873 [(set (match_operand:DF 0 "register_operand" "=&f")
2874 (sqrt:DF (match_operand:DF 1 "reg_or_0_operand" "fG")))]
2875 "TARGET_FP && TARGET_FIX && alpha_fptm >= ALPHA_FPTM_SU"
2877 [(set_attr "type" "fsqrt")
2878 (set_attr "trap" "yes")
2879 (set_attr "round_suffix" "normal")
2880 (set_attr "trap_suffix" "u_su_sui")])
2882 (define_insn "sqrtdf2"
2883 [(set (match_operand:DF 0 "register_operand" "=f")
2884 (sqrt:DF (match_operand:DF 1 "reg_or_0_operand" "fG")))]
2885 "TARGET_FP && TARGET_FIX"
2887 [(set_attr "type" "fsqrt")
2888 (set_attr "trap" "yes")
2889 (set_attr "round_suffix" "normal")
2890 (set_attr "trap_suffix" "u_su_sui")])
2892 ;; Next are all the integer comparisons, and conditional moves and branches
2893 ;; and some of the related define_expand's and define_split's.
2895 (define_insn "*setcc_internal"
2896 [(set (match_operand 0 "register_operand" "=r")
2897 (match_operator 1 "alpha_comparison_operator"
2898 [(match_operand:DI 2 "register_operand" "r")
2899 (match_operand:DI 3 "reg_or_8bit_operand" "rI")]))]
2900 "GET_MODE_CLASS (GET_MODE (operands[0])) == MODE_INT
2901 && GET_MODE_SIZE (GET_MODE (operands[0])) <= 8
2902 && GET_MODE (operands[0]) == GET_MODE (operands[1])"
2904 [(set_attr "type" "icmp")])
2906 ;; Yes, we can technically support reg_or_8bit_operand in operand 2,
2907 ;; but that's non-canonical rtl and allowing that causes inefficiencies
2909 (define_insn "*setcc_swapped_internal"
2910 [(set (match_operand 0 "register_operand" "=r")
2911 (match_operator 1 "alpha_swapped_comparison_operator"
2912 [(match_operand:DI 2 "register_operand" "r")
2913 (match_operand:DI 3 "reg_or_0_operand" "rJ")]))]
2914 "GET_MODE_CLASS (GET_MODE (operands[0])) == MODE_INT
2915 && GET_MODE_SIZE (GET_MODE (operands[0])) <= 8
2916 && GET_MODE (operands[0]) == GET_MODE (operands[1])"
2918 [(set_attr "type" "icmp")])
2920 ;; Use match_operator rather than ne directly so that we can match
2921 ;; multiple integer modes.
2922 (define_insn "*setne_internal"
2923 [(set (match_operand 0 "register_operand" "=r")
2924 (match_operator 1 "signed_comparison_operator"
2925 [(match_operand:DI 2 "register_operand" "r")
2927 "GET_MODE_CLASS (GET_MODE (operands[0])) == MODE_INT
2928 && GET_MODE_SIZE (GET_MODE (operands[0])) <= 8
2929 && GET_CODE (operands[1]) == NE
2930 && GET_MODE (operands[0]) == GET_MODE (operands[1])"
2932 [(set_attr "type" "icmp")])
2934 ;; The mode folding trick can't be used with const_int operands, since
2935 ;; reload needs to know the proper mode.
2937 ;; Use add_operand instead of the more seemingly natural reg_or_8bit_operand
2938 ;; in order to create more pairs of constants. As long as we're allowing
2939 ;; two constants at the same time, and will have to reload one of them...
2941 (define_insn "*movqicc_internal"
2942 [(set (match_operand:QI 0 "register_operand" "=r,r,r,r")
2944 (match_operator 2 "signed_comparison_operator"
2945 [(match_operand:DI 3 "reg_or_0_operand" "rJ,rJ,J,J")
2946 (match_operand:DI 4 "reg_or_0_operand" "J,J,rJ,rJ")])
2947 (match_operand:QI 1 "add_operand" "rI,0,rI,0")
2948 (match_operand:QI 5 "add_operand" "0,rI,0,rI")))]
2949 "(operands[3] == const0_rtx || operands[4] == const0_rtx)"
2955 [(set_attr "type" "icmov")])
2957 (define_insn "*movhicc_internal"
2958 [(set (match_operand:HI 0 "register_operand" "=r,r,r,r")
2960 (match_operator 2 "signed_comparison_operator"
2961 [(match_operand:DI 3 "reg_or_0_operand" "rJ,rJ,J,J")
2962 (match_operand:DI 4 "reg_or_0_operand" "J,J,rJ,rJ")])
2963 (match_operand:HI 1 "add_operand" "rI,0,rI,0")
2964 (match_operand:HI 5 "add_operand" "0,rI,0,rI")))]
2965 "(operands[3] == const0_rtx || operands[4] == const0_rtx)"
2971 [(set_attr "type" "icmov")])
2973 (define_insn "*movsicc_internal"
2974 [(set (match_operand:SI 0 "register_operand" "=r,r,r,r")
2976 (match_operator 2 "signed_comparison_operator"
2977 [(match_operand:DI 3 "reg_or_0_operand" "rJ,rJ,J,J")
2978 (match_operand:DI 4 "reg_or_0_operand" "J,J,rJ,rJ")])
2979 (match_operand:SI 1 "add_operand" "rI,0,rI,0")
2980 (match_operand:SI 5 "add_operand" "0,rI,0,rI")))]
2981 "(operands[3] == const0_rtx || operands[4] == const0_rtx)"
2987 [(set_attr "type" "icmov")])
2989 (define_insn "*movdicc_internal"
2990 [(set (match_operand:DI 0 "register_operand" "=r,r,r,r")
2992 (match_operator 2 "signed_comparison_operator"
2993 [(match_operand:DI 3 "reg_or_0_operand" "rJ,rJ,J,J")
2994 (match_operand:DI 4 "reg_or_0_operand" "J,J,rJ,rJ")])
2995 (match_operand:DI 1 "add_operand" "rI,0,rI,0")
2996 (match_operand:DI 5 "add_operand" "0,rI,0,rI")))]
2997 "(operands[3] == const0_rtx || operands[4] == const0_rtx)"
3003 [(set_attr "type" "icmov")])
3005 (define_insn "*movqicc_lbc"
3006 [(set (match_operand:QI 0 "register_operand" "=r,r")
3008 (eq (zero_extract:DI (match_operand:DI 2 "reg_or_0_operand" "rJ,rJ")
3012 (match_operand:QI 1 "reg_or_8bit_operand" "rI,0")
3013 (match_operand:QI 3 "reg_or_8bit_operand" "0,rI")))]
3018 [(set_attr "type" "icmov")])
3020 (define_insn "*movhicc_lbc"
3021 [(set (match_operand:HI 0 "register_operand" "=r,r")
3023 (eq (zero_extract:DI (match_operand:DI 2 "reg_or_0_operand" "rJ,rJ")
3027 (match_operand:HI 1 "reg_or_8bit_operand" "rI,0")
3028 (match_operand:HI 3 "reg_or_8bit_operand" "0,rI")))]
3033 [(set_attr "type" "icmov")])
3035 (define_insn "*movsicc_lbc"
3036 [(set (match_operand:SI 0 "register_operand" "=r,r")
3038 (eq (zero_extract:DI (match_operand:DI 2 "reg_or_0_operand" "rJ,rJ")
3042 (match_operand:SI 1 "reg_or_8bit_operand" "rI,0")
3043 (match_operand:SI 3 "reg_or_8bit_operand" "0,rI")))]
3048 [(set_attr "type" "icmov")])
3050 (define_insn "*movdicc_lbc"
3051 [(set (match_operand:DI 0 "register_operand" "=r,r")
3053 (eq (zero_extract:DI (match_operand:DI 2 "reg_or_0_operand" "rJ,rJ")
3057 (match_operand:DI 1 "reg_or_8bit_operand" "rI,0")
3058 (match_operand:DI 3 "reg_or_8bit_operand" "0,rI")))]
3063 [(set_attr "type" "icmov")])
3065 (define_insn "*movqicc_lbs"
3066 [(set (match_operand:QI 0 "register_operand" "=r,r")
3068 (ne (zero_extract:DI (match_operand:DI 2 "reg_or_0_operand" "rJ,rJ")
3072 (match_operand:QI 1 "reg_or_8bit_operand" "rI,0")
3073 (match_operand:QI 3 "reg_or_8bit_operand" "0,rI")))]
3078 [(set_attr "type" "icmov")])
3080 (define_insn "*movhicc_lbs"
3081 [(set (match_operand:HI 0 "register_operand" "=r,r")
3083 (ne (zero_extract:DI (match_operand:DI 2 "reg_or_0_operand" "rJ,rJ")
3087 (match_operand:HI 1 "reg_or_8bit_operand" "rI,0")
3088 (match_operand:HI 3 "reg_or_8bit_operand" "0,rI")))]
3093 [(set_attr "type" "icmov")])
3095 (define_insn "*movsicc_lbs"
3096 [(set (match_operand:SI 0 "register_operand" "=r,r")
3098 (ne (zero_extract:DI (match_operand:DI 2 "reg_or_0_operand" "rJ,rJ")
3102 (match_operand:SI 1 "reg_or_8bit_operand" "rI,0")
3103 (match_operand:SI 3 "reg_or_8bit_operand" "0,rI")))]
3108 [(set_attr "type" "icmov")])
3110 (define_insn "*movdicc_lbs"
3111 [(set (match_operand:DI 0 "register_operand" "=r,r")
3113 (ne (zero_extract:DI (match_operand:DI 2 "reg_or_0_operand" "rJ,rJ")
3117 (match_operand:DI 1 "reg_or_8bit_operand" "rI,0")
3118 (match_operand:DI 3 "reg_or_8bit_operand" "0,rI")))]
3123 [(set_attr "type" "icmov")])
3125 ;; For ABS, we have two choices, depending on whether the input and output
3126 ;; registers are the same or not.
3127 (define_expand "absdi2"
3128 [(set (match_operand:DI 0 "register_operand" "")
3129 (abs:DI (match_operand:DI 1 "register_operand" "")))]
3132 if (rtx_equal_p (operands[0], operands[1]))
3133 emit_insn (gen_absdi2_same (operands[0], gen_reg_rtx (DImode)));
3135 emit_insn (gen_absdi2_diff (operands[0], operands[1]));
3139 (define_expand "absdi2_same"
3140 [(set (match_operand:DI 1 "register_operand" "")
3141 (neg:DI (match_operand:DI 0 "register_operand" "")))
3143 (if_then_else:DI (ge (match_dup 0) (const_int 0))
3149 (define_expand "absdi2_diff"
3150 [(set (match_operand:DI 0 "register_operand" "")
3151 (neg:DI (match_operand:DI 1 "register_operand" "")))
3153 (if_then_else:DI (lt (match_dup 1) (const_int 0))
3160 [(set (match_operand:DI 0 "register_operand" "")
3161 (abs:DI (match_dup 0)))
3162 (clobber (match_operand:DI 1 "register_operand" ""))]
3164 [(set (match_dup 1) (neg:DI (match_dup 0)))
3165 (set (match_dup 0) (if_then_else:DI (ge (match_dup 0) (const_int 0))
3166 (match_dup 0) (match_dup 1)))]
3170 [(set (match_operand:DI 0 "register_operand" "")
3171 (abs:DI (match_operand:DI 1 "register_operand" "")))]
3172 "! rtx_equal_p (operands[0], operands[1])"
3173 [(set (match_dup 0) (neg:DI (match_dup 1)))
3174 (set (match_dup 0) (if_then_else:DI (lt (match_dup 1) (const_int 0))
3175 (match_dup 0) (match_dup 1)))]
3179 [(set (match_operand:DI 0 "register_operand" "")
3180 (neg:DI (abs:DI (match_dup 0))))
3181 (clobber (match_operand:DI 1 "register_operand" ""))]
3183 [(set (match_dup 1) (neg:DI (match_dup 0)))
3184 (set (match_dup 0) (if_then_else:DI (le (match_dup 0) (const_int 0))
3185 (match_dup 0) (match_dup 1)))]
3189 [(set (match_operand:DI 0 "register_operand" "")
3190 (neg:DI (abs:DI (match_operand:DI 1 "register_operand" ""))))]
3191 "! rtx_equal_p (operands[0], operands[1])"
3192 [(set (match_dup 0) (neg:DI (match_dup 1)))
3193 (set (match_dup 0) (if_then_else:DI (gt (match_dup 1) (const_int 0))
3194 (match_dup 0) (match_dup 1)))]
3197 (define_insn "sminqi3"
3198 [(set (match_operand:QI 0 "register_operand" "=r")
3199 (smin:QI (match_operand:QI 1 "reg_or_0_operand" "%rJ")
3200 (match_operand:QI 2 "reg_or_8bit_operand" "rI")))]
3203 [(set_attr "type" "mvi")])
3205 (define_insn "uminqi3"
3206 [(set (match_operand:QI 0 "register_operand" "=r")
3207 (umin:QI (match_operand:QI 1 "reg_or_0_operand" "%rJ")
3208 (match_operand:QI 2 "reg_or_8bit_operand" "rI")))]
3211 [(set_attr "type" "mvi")])
3213 (define_insn "smaxqi3"
3214 [(set (match_operand:QI 0 "register_operand" "=r")
3215 (smax:QI (match_operand:QI 1 "reg_or_0_operand" "%rJ")
3216 (match_operand:QI 2 "reg_or_8bit_operand" "rI")))]
3219 [(set_attr "type" "mvi")])
3221 (define_insn "umaxqi3"
3222 [(set (match_operand:QI 0 "register_operand" "=r")
3223 (umax:QI (match_operand:QI 1 "reg_or_0_operand" "%rJ")
3224 (match_operand:QI 2 "reg_or_8bit_operand" "rI")))]
3227 [(set_attr "type" "mvi")])
3229 (define_insn "sminhi3"
3230 [(set (match_operand:HI 0 "register_operand" "=r")
3231 (smin:HI (match_operand:HI 1 "reg_or_0_operand" "%rJ")
3232 (match_operand:HI 2 "reg_or_8bit_operand" "rI")))]
3235 [(set_attr "type" "mvi")])
3237 (define_insn "uminhi3"
3238 [(set (match_operand:HI 0 "register_operand" "=r")
3239 (umin:HI (match_operand:HI 1 "reg_or_0_operand" "%rJ")
3240 (match_operand:HI 2 "reg_or_8bit_operand" "rI")))]
3243 [(set_attr "type" "mvi")])
3245 (define_insn "smaxhi3"
3246 [(set (match_operand:HI 0 "register_operand" "=r")
3247 (smax:HI (match_operand:HI 1 "reg_or_0_operand" "%rJ")
3248 (match_operand:HI 2 "reg_or_8bit_operand" "rI")))]
3251 [(set_attr "type" "mvi")])
3253 (define_insn "umaxhi3"
3254 [(set (match_operand:HI 0 "register_operand" "=r")
3255 (umax:HI (match_operand:HI 1 "reg_or_0_operand" "%rJ")
3256 (match_operand:HI 2 "reg_or_8bit_operand" "rI")))]
3259 [(set_attr "type" "mvi")])
3261 (define_expand "smaxdi3"
3263 (le:DI (match_operand:DI 1 "reg_or_0_operand" "")
3264 (match_operand:DI 2 "reg_or_8bit_operand" "")))
3265 (set (match_operand:DI 0 "register_operand" "")
3266 (if_then_else:DI (eq (match_dup 3) (const_int 0))
3267 (match_dup 1) (match_dup 2)))]
3269 { operands[3] = gen_reg_rtx (DImode); })
3272 [(set (match_operand:DI 0 "register_operand" "")
3273 (smax:DI (match_operand:DI 1 "reg_or_0_operand" "")
3274 (match_operand:DI 2 "reg_or_8bit_operand" "")))
3275 (clobber (match_operand:DI 3 "register_operand" ""))]
3276 "operands[2] != const0_rtx"
3277 [(set (match_dup 3) (le:DI (match_dup 1) (match_dup 2)))
3278 (set (match_dup 0) (if_then_else:DI (eq (match_dup 3) (const_int 0))
3279 (match_dup 1) (match_dup 2)))]
3282 (define_insn "*smax_const0"
3283 [(set (match_operand:DI 0 "register_operand" "=r")
3284 (smax:DI (match_operand:DI 1 "register_operand" "0")
3288 [(set_attr "type" "icmov")])
3290 (define_expand "smindi3"
3292 (lt:DI (match_operand:DI 1 "reg_or_0_operand" "")
3293 (match_operand:DI 2 "reg_or_8bit_operand" "")))
3294 (set (match_operand:DI 0 "register_operand" "")
3295 (if_then_else:DI (ne (match_dup 3) (const_int 0))
3296 (match_dup 1) (match_dup 2)))]
3298 { operands[3] = gen_reg_rtx (DImode); })
3301 [(set (match_operand:DI 0 "register_operand" "")
3302 (smin:DI (match_operand:DI 1 "reg_or_0_operand" "")
3303 (match_operand:DI 2 "reg_or_8bit_operand" "")))
3304 (clobber (match_operand:DI 3 "register_operand" ""))]
3305 "operands[2] != const0_rtx"
3306 [(set (match_dup 3) (lt:DI (match_dup 1) (match_dup 2)))
3307 (set (match_dup 0) (if_then_else:DI (ne (match_dup 3) (const_int 0))
3308 (match_dup 1) (match_dup 2)))]
3311 (define_insn "*smin_const0"
3312 [(set (match_operand:DI 0 "register_operand" "=r")
3313 (smin:DI (match_operand:DI 1 "register_operand" "0")
3317 [(set_attr "type" "icmov")])
3319 (define_expand "umaxdi3"
3321 (leu:DI (match_operand:DI 1 "reg_or_0_operand" "")
3322 (match_operand:DI 2 "reg_or_8bit_operand" "")))
3323 (set (match_operand:DI 0 "register_operand" "")
3324 (if_then_else:DI (eq (match_dup 3) (const_int 0))
3325 (match_dup 1) (match_dup 2)))]
3327 "operands[3] = gen_reg_rtx (DImode);")
3330 [(set (match_operand:DI 0 "register_operand" "")
3331 (umax:DI (match_operand:DI 1 "reg_or_0_operand" "")
3332 (match_operand:DI 2 "reg_or_8bit_operand" "")))
3333 (clobber (match_operand:DI 3 "register_operand" ""))]
3334 "operands[2] != const0_rtx"
3335 [(set (match_dup 3) (leu:DI (match_dup 1) (match_dup 2)))
3336 (set (match_dup 0) (if_then_else:DI (eq (match_dup 3) (const_int 0))
3337 (match_dup 1) (match_dup 2)))]
3340 (define_expand "umindi3"
3342 (ltu:DI (match_operand:DI 1 "reg_or_0_operand" "")
3343 (match_operand:DI 2 "reg_or_8bit_operand" "")))
3344 (set (match_operand:DI 0 "register_operand" "")
3345 (if_then_else:DI (ne (match_dup 3) (const_int 0))
3346 (match_dup 1) (match_dup 2)))]
3348 "operands[3] = gen_reg_rtx (DImode);")
3351 [(set (match_operand:DI 0 "register_operand" "")
3352 (umin:DI (match_operand:DI 1 "reg_or_0_operand" "")
3353 (match_operand:DI 2 "reg_or_8bit_operand" "")))
3354 (clobber (match_operand:DI 3 "register_operand" ""))]
3355 "operands[2] != const0_rtx"
3356 [(set (match_dup 3) (ltu:DI (match_dup 1) (match_dup 2)))
3357 (set (match_dup 0) (if_then_else:DI (ne (match_dup 3) (const_int 0))
3358 (match_dup 1) (match_dup 2)))]
3361 (define_insn "*bcc_normal"
3364 (match_operator 1 "signed_comparison_operator"
3365 [(match_operand:DI 2 "reg_or_0_operand" "rJ")
3367 (label_ref (match_operand 0 "" ""))
3371 [(set_attr "type" "ibr")])
3373 (define_insn "*bcc_reverse"
3376 (match_operator 1 "signed_comparison_operator"
3377 [(match_operand:DI 2 "register_operand" "r")
3381 (label_ref (match_operand 0 "" ""))))]
3384 [(set_attr "type" "ibr")])
3386 (define_insn "*blbs_normal"
3389 (ne (zero_extract:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
3393 (label_ref (match_operand 0 "" ""))
3397 [(set_attr "type" "ibr")])
3399 (define_insn "*blbc_normal"
3402 (eq (zero_extract:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
3406 (label_ref (match_operand 0 "" ""))
3410 [(set_attr "type" "ibr")])
3416 (match_operator 1 "comparison_operator"
3417 [(zero_extract:DI (match_operand:DI 2 "register_operand" "")
3419 (match_operand:DI 3 "const_int_operand" ""))
3421 (label_ref (match_operand 0 "" ""))
3423 (clobber (match_operand:DI 4 "register_operand" ""))])]
3424 "INTVAL (operands[3]) != 0"
3426 (lshiftrt:DI (match_dup 2) (match_dup 3)))
3428 (if_then_else (match_op_dup 1
3429 [(zero_extract:DI (match_dup 4)
3433 (label_ref (match_dup 0))
3437 ;; The following are the corresponding floating-point insns. Recall
3438 ;; we need to have variants that expand the arguments from SFmode
3441 (define_insn "*cmpdf_ieee"
3442 [(set (match_operand:DF 0 "register_operand" "=&f")
3443 (match_operator:DF 1 "alpha_fp_comparison_operator"
3444 [(match_operand:DF 2 "reg_or_0_operand" "fG")
3445 (match_operand:DF 3 "reg_or_0_operand" "fG")]))]
3446 "TARGET_FP && alpha_fptm >= ALPHA_FPTM_SU"
3447 "cmp%-%C1%/ %R2,%R3,%0"
3448 [(set_attr "type" "fadd")
3449 (set_attr "trap" "yes")
3450 (set_attr "trap_suffix" "su")])
3452 (define_insn "*cmpdf_internal"
3453 [(set (match_operand:DF 0 "register_operand" "=f")
3454 (match_operator:DF 1 "alpha_fp_comparison_operator"
3455 [(match_operand:DF 2 "reg_or_0_operand" "fG")
3456 (match_operand:DF 3 "reg_or_0_operand" "fG")]))]
3457 "TARGET_FP && alpha_fptm < ALPHA_FPTM_SU"
3458 "cmp%-%C1%/ %R2,%R3,%0"
3459 [(set_attr "type" "fadd")
3460 (set_attr "trap" "yes")
3461 (set_attr "trap_suffix" "su")])
3463 (define_insn "*cmpdf_ieee_ext1"
3464 [(set (match_operand:DF 0 "register_operand" "=&f")
3465 (match_operator:DF 1 "alpha_fp_comparison_operator"
3467 (match_operand:SF 2 "reg_or_0_operand" "fG"))
3468 (match_operand:DF 3 "reg_or_0_operand" "fG")]))]
3469 "TARGET_FP && alpha_fptm >= ALPHA_FPTM_SU"
3470 "cmp%-%C1%/ %R2,%R3,%0"
3471 [(set_attr "type" "fadd")
3472 (set_attr "trap" "yes")
3473 (set_attr "trap_suffix" "su")])
3475 (define_insn "*cmpdf_ext1"
3476 [(set (match_operand:DF 0 "register_operand" "=f")
3477 (match_operator:DF 1 "alpha_fp_comparison_operator"
3479 (match_operand:SF 2 "reg_or_0_operand" "fG"))
3480 (match_operand:DF 3 "reg_or_0_operand" "fG")]))]
3481 "TARGET_FP && alpha_fptm < ALPHA_FPTM_SU"
3482 "cmp%-%C1%/ %R2,%R3,%0"
3483 [(set_attr "type" "fadd")
3484 (set_attr "trap" "yes")
3485 (set_attr "trap_suffix" "su")])
3487 (define_insn "*cmpdf_ieee_ext2"
3488 [(set (match_operand:DF 0 "register_operand" "=&f")
3489 (match_operator:DF 1 "alpha_fp_comparison_operator"
3490 [(match_operand:DF 2 "reg_or_0_operand" "fG")
3492 (match_operand:SF 3 "reg_or_0_operand" "fG"))]))]
3493 "TARGET_FP && alpha_fptm >= ALPHA_FPTM_SU"
3494 "cmp%-%C1%/ %R2,%R3,%0"
3495 [(set_attr "type" "fadd")
3496 (set_attr "trap" "yes")
3497 (set_attr "trap_suffix" "su")])
3499 (define_insn "*cmpdf_ext2"
3500 [(set (match_operand:DF 0 "register_operand" "=f")
3501 (match_operator:DF 1 "alpha_fp_comparison_operator"
3502 [(match_operand:DF 2 "reg_or_0_operand" "fG")
3504 (match_operand:SF 3 "reg_or_0_operand" "fG"))]))]
3505 "TARGET_FP && alpha_fptm < ALPHA_FPTM_SU"
3506 "cmp%-%C1%/ %R2,%R3,%0"
3507 [(set_attr "type" "fadd")
3508 (set_attr "trap" "yes")
3509 (set_attr "trap_suffix" "su")])
3511 (define_insn "*cmpdf_ieee_ext3"
3512 [(set (match_operand:DF 0 "register_operand" "=&f")
3513 (match_operator:DF 1 "alpha_fp_comparison_operator"
3515 (match_operand:SF 2 "reg_or_0_operand" "fG"))
3517 (match_operand:SF 3 "reg_or_0_operand" "fG"))]))]
3518 "TARGET_FP && alpha_fptm >= ALPHA_FPTM_SU"
3519 "cmp%-%C1%/ %R2,%R3,%0"
3520 [(set_attr "type" "fadd")
3521 (set_attr "trap" "yes")
3522 (set_attr "trap_suffix" "su")])
3524 (define_insn "*cmpdf_ext3"
3525 [(set (match_operand:DF 0 "register_operand" "=f")
3526 (match_operator:DF 1 "alpha_fp_comparison_operator"
3528 (match_operand:SF 2 "reg_or_0_operand" "fG"))
3530 (match_operand:SF 3 "reg_or_0_operand" "fG"))]))]
3531 "TARGET_FP && alpha_fptm < ALPHA_FPTM_SU"
3532 "cmp%-%C1%/ %R2,%R3,%0"
3533 [(set_attr "type" "fadd")
3534 (set_attr "trap" "yes")
3535 (set_attr "trap_suffix" "su")])
3537 (define_insn "*movdfcc_internal"
3538 [(set (match_operand:DF 0 "register_operand" "=f,f")
3540 (match_operator 3 "signed_comparison_operator"
3541 [(match_operand:DF 4 "reg_or_0_operand" "fG,fG")
3542 (match_operand:DF 2 "const0_operand" "G,G")])
3543 (match_operand:DF 1 "reg_or_0_operand" "fG,0")
3544 (match_operand:DF 5 "reg_or_0_operand" "0,fG")))]
3548 fcmov%D3 %R4,%R5,%0"
3549 [(set_attr "type" "fcmov")])
3551 (define_insn "*movsfcc_internal"
3552 [(set (match_operand:SF 0 "register_operand" "=f,f")
3554 (match_operator 3 "signed_comparison_operator"
3555 [(match_operand:DF 4 "reg_or_0_operand" "fG,fG")
3556 (match_operand:DF 2 "const0_operand" "G,G")])
3557 (match_operand:SF 1 "reg_or_0_operand" "fG,0")
3558 (match_operand:SF 5 "reg_or_0_operand" "0,fG")))]
3562 fcmov%D3 %R4,%R5,%0"
3563 [(set_attr "type" "fcmov")])
3565 (define_insn "*movdfcc_ext1"
3566 [(set (match_operand:DF 0 "register_operand" "=f,f")
3568 (match_operator 3 "signed_comparison_operator"
3569 [(match_operand:DF 4 "reg_or_0_operand" "fG,fG")
3570 (match_operand:DF 2 "const0_operand" "G,G")])
3571 (float_extend:DF (match_operand:SF 1 "reg_or_0_operand" "fG,0"))
3572 (match_operand:DF 5 "reg_or_0_operand" "0,fG")))]
3576 fcmov%D3 %R4,%R5,%0"
3577 [(set_attr "type" "fcmov")])
3579 (define_insn "*movdfcc_ext2"
3580 [(set (match_operand:DF 0 "register_operand" "=f,f")
3582 (match_operator 3 "signed_comparison_operator"
3584 (match_operand:SF 4 "reg_or_0_operand" "fG,fG"))
3585 (match_operand:DF 2 "const0_operand" "G,G")])
3586 (match_operand:DF 1 "reg_or_0_operand" "fG,0")
3587 (match_operand:DF 5 "reg_or_0_operand" "0,fG")))]
3591 fcmov%D3 %R4,%R5,%0"
3592 [(set_attr "type" "fcmov")])
3594 (define_insn "*movdfcc_ext3"
3595 [(set (match_operand:SF 0 "register_operand" "=f,f")
3597 (match_operator 3 "signed_comparison_operator"
3599 (match_operand:SF 4 "reg_or_0_operand" "fG,fG"))
3600 (match_operand:DF 2 "const0_operand" "G,G")])
3601 (match_operand:SF 1 "reg_or_0_operand" "fG,0")
3602 (match_operand:SF 5 "reg_or_0_operand" "0,fG")))]
3606 fcmov%D3 %R4,%R5,%0"
3607 [(set_attr "type" "fcmov")])
3609 (define_insn "*movdfcc_ext4"
3610 [(set (match_operand:DF 0 "register_operand" "=f,f")
3612 (match_operator 3 "signed_comparison_operator"
3614 (match_operand:SF 4 "reg_or_0_operand" "fG,fG"))
3615 (match_operand:DF 2 "const0_operand" "G,G")])
3616 (float_extend:DF (match_operand:SF 1 "reg_or_0_operand" "fG,0"))
3617 (match_operand:DF 5 "reg_or_0_operand" "0,fG")))]
3621 fcmov%D3 %R4,%R5,%0"
3622 [(set_attr "type" "fcmov")])
3624 (define_expand "maxdf3"
3626 (le:DF (match_operand:DF 1 "reg_or_0_operand" "")
3627 (match_operand:DF 2 "reg_or_0_operand" "")))
3628 (set (match_operand:DF 0 "register_operand" "")
3629 (if_then_else:DF (eq (match_dup 3) (match_dup 4))
3630 (match_dup 1) (match_dup 2)))]
3633 operands[3] = gen_reg_rtx (DFmode);
3634 operands[4] = CONST0_RTX (DFmode);
3637 (define_expand "mindf3"
3639 (lt:DF (match_operand:DF 1 "reg_or_0_operand" "")
3640 (match_operand:DF 2 "reg_or_0_operand" "")))
3641 (set (match_operand:DF 0 "register_operand" "")
3642 (if_then_else:DF (ne (match_dup 3) (match_dup 4))
3643 (match_dup 1) (match_dup 2)))]
3646 operands[3] = gen_reg_rtx (DFmode);
3647 operands[4] = CONST0_RTX (DFmode);
3650 (define_expand "maxsf3"
3652 (le:DF (float_extend:DF (match_operand:SF 1 "reg_or_0_operand" ""))
3653 (float_extend:DF (match_operand:SF 2 "reg_or_0_operand" ""))))
3654 (set (match_operand:SF 0 "register_operand" "")
3655 (if_then_else:SF (eq (match_dup 3) (match_dup 4))
3656 (match_dup 1) (match_dup 2)))]
3659 operands[3] = gen_reg_rtx (DFmode);
3660 operands[4] = CONST0_RTX (DFmode);
3663 (define_expand "minsf3"
3665 (lt:DF (float_extend:DF (match_operand:SF 1 "reg_or_0_operand" ""))
3666 (float_extend:DF (match_operand:SF 2 "reg_or_0_operand" ""))))
3667 (set (match_operand:SF 0 "register_operand" "")
3668 (if_then_else:SF (ne (match_dup 3) (match_dup 4))
3669 (match_dup 1) (match_dup 2)))]
3672 operands[3] = gen_reg_rtx (DFmode);
3673 operands[4] = CONST0_RTX (DFmode);
3676 (define_insn "*fbcc_normal"
3679 (match_operator 1 "signed_comparison_operator"
3680 [(match_operand:DF 2 "reg_or_0_operand" "fG")
3681 (match_operand:DF 3 "const0_operand" "G")])
3682 (label_ref (match_operand 0 "" ""))
3686 [(set_attr "type" "fbr")])
3688 (define_insn "*fbcc_ext_normal"
3691 (match_operator 1 "signed_comparison_operator"
3693 (match_operand:SF 2 "reg_or_0_operand" "fG"))
3694 (match_operand:DF 3 "const0_operand" "G")])
3695 (label_ref (match_operand 0 "" ""))
3699 [(set_attr "type" "fbr")])
3701 ;; These are the main define_expand's used to make conditional branches
3704 (define_expand "cmpdf"
3705 [(set (cc0) (compare (match_operand:DF 0 "reg_or_0_operand" "")
3706 (match_operand:DF 1 "reg_or_0_operand" "")))]
3709 alpha_compare.op0 = operands[0];
3710 alpha_compare.op1 = operands[1];
3711 alpha_compare.fp_p = 1;
3715 (define_expand "cmptf"
3716 [(set (cc0) (compare (match_operand:TF 0 "general_operand" "")
3717 (match_operand:TF 1 "general_operand" "")))]
3718 "TARGET_HAS_XFLOATING_LIBS"
3720 alpha_compare.op0 = operands[0];
3721 alpha_compare.op1 = operands[1];
3722 alpha_compare.fp_p = 1;
3726 (define_expand "cmpdi"
3727 [(set (cc0) (compare (match_operand:DI 0 "general_operand" "")
3728 (match_operand:DI 1 "general_operand" "")))]
3731 alpha_compare.op0 = operands[0];
3732 alpha_compare.op1 = operands[1];
3733 alpha_compare.fp_p = 0;
3737 (define_expand "beq"
3739 (if_then_else (match_dup 1)
3740 (label_ref (match_operand 0 "" ""))
3743 "{ operands[1] = alpha_emit_conditional_branch (EQ); }")
3745 (define_expand "bne"
3747 (if_then_else (match_dup 1)
3748 (label_ref (match_operand 0 "" ""))
3751 "{ operands[1] = alpha_emit_conditional_branch (NE); }")
3753 (define_expand "blt"
3755 (if_then_else (match_dup 1)
3756 (label_ref (match_operand 0 "" ""))
3759 "{ operands[1] = alpha_emit_conditional_branch (LT); }")
3761 (define_expand "ble"
3763 (if_then_else (match_dup 1)
3764 (label_ref (match_operand 0 "" ""))
3767 "{ operands[1] = alpha_emit_conditional_branch (LE); }")
3769 (define_expand "bgt"
3771 (if_then_else (match_dup 1)
3772 (label_ref (match_operand 0 "" ""))
3775 "{ operands[1] = alpha_emit_conditional_branch (GT); }")
3777 (define_expand "bge"
3779 (if_then_else (match_dup 1)
3780 (label_ref (match_operand 0 "" ""))
3783 "{ operands[1] = alpha_emit_conditional_branch (GE); }")
3785 (define_expand "bltu"
3787 (if_then_else (match_dup 1)
3788 (label_ref (match_operand 0 "" ""))
3791 "{ operands[1] = alpha_emit_conditional_branch (LTU); }")
3793 (define_expand "bleu"
3795 (if_then_else (match_dup 1)
3796 (label_ref (match_operand 0 "" ""))
3799 "{ operands[1] = alpha_emit_conditional_branch (LEU); }")
3801 (define_expand "bgtu"
3803 (if_then_else (match_dup 1)
3804 (label_ref (match_operand 0 "" ""))
3807 "{ operands[1] = alpha_emit_conditional_branch (GTU); }")
3809 (define_expand "bgeu"
3811 (if_then_else (match_dup 1)
3812 (label_ref (match_operand 0 "" ""))
3815 "{ operands[1] = alpha_emit_conditional_branch (GEU); }")
3817 (define_expand "bunordered"
3819 (if_then_else (match_dup 1)
3820 (label_ref (match_operand 0 "" ""))
3823 "{ operands[1] = alpha_emit_conditional_branch (UNORDERED); }")
3825 (define_expand "bordered"
3827 (if_then_else (match_dup 1)
3828 (label_ref (match_operand 0 "" ""))
3831 "{ operands[1] = alpha_emit_conditional_branch (ORDERED); }")
3833 (define_expand "seq"
3834 [(set (match_operand:DI 0 "register_operand" "")
3837 "{ if ((operands[1] = alpha_emit_setcc (EQ)) == NULL_RTX) FAIL; }")
3839 (define_expand "sne"
3840 [(set (match_operand:DI 0 "register_operand" "")
3843 "{ if ((operands[1] = alpha_emit_setcc (NE)) == NULL_RTX) FAIL; }")
3845 (define_expand "slt"
3846 [(set (match_operand:DI 0 "register_operand" "")
3849 "{ if ((operands[1] = alpha_emit_setcc (LT)) == NULL_RTX) FAIL; }")
3851 (define_expand "sle"
3852 [(set (match_operand:DI 0 "register_operand" "")
3855 "{ if ((operands[1] = alpha_emit_setcc (LE)) == NULL_RTX) FAIL; }")
3857 (define_expand "sgt"
3858 [(set (match_operand:DI 0 "register_operand" "")
3861 "{ if ((operands[1] = alpha_emit_setcc (GT)) == NULL_RTX) FAIL; }")
3863 (define_expand "sge"
3864 [(set (match_operand:DI 0 "register_operand" "")
3867 "{ if ((operands[1] = alpha_emit_setcc (GE)) == NULL_RTX) FAIL; }")
3869 (define_expand "sltu"
3870 [(set (match_operand:DI 0 "register_operand" "")
3873 "{ if ((operands[1] = alpha_emit_setcc (LTU)) == NULL_RTX) FAIL; }")
3875 (define_expand "sleu"
3876 [(set (match_operand:DI 0 "register_operand" "")
3879 "{ if ((operands[1] = alpha_emit_setcc (LEU)) == NULL_RTX) FAIL; }")
3881 (define_expand "sgtu"
3882 [(set (match_operand:DI 0 "register_operand" "")
3885 "{ if ((operands[1] = alpha_emit_setcc (GTU)) == NULL_RTX) FAIL; }")
3887 (define_expand "sgeu"
3888 [(set (match_operand:DI 0 "register_operand" "")
3891 "{ if ((operands[1] = alpha_emit_setcc (GEU)) == NULL_RTX) FAIL; }")
3893 (define_expand "sunordered"
3894 [(set (match_operand:DI 0 "register_operand" "")
3897 "{ if ((operands[1] = alpha_emit_setcc (UNORDERED)) == NULL_RTX) FAIL; }")
3899 (define_expand "sordered"
3900 [(set (match_operand:DI 0 "register_operand" "")
3903 "{ if ((operands[1] = alpha_emit_setcc (ORDERED)) == NULL_RTX) FAIL; }")
3905 ;; These are the main define_expand's used to make conditional moves.
3907 (define_expand "movsicc"
3908 [(set (match_operand:SI 0 "register_operand" "")
3909 (if_then_else:SI (match_operand 1 "comparison_operator" "")
3910 (match_operand:SI 2 "reg_or_8bit_operand" "")
3911 (match_operand:SI 3 "reg_or_8bit_operand" "")))]
3914 if ((operands[1] = alpha_emit_conditional_move (operands[1], SImode)) == 0)
3918 (define_expand "movdicc"
3919 [(set (match_operand:DI 0 "register_operand" "")
3920 (if_then_else:DI (match_operand 1 "comparison_operator" "")
3921 (match_operand:DI 2 "reg_or_8bit_operand" "")
3922 (match_operand:DI 3 "reg_or_8bit_operand" "")))]
3925 if ((operands[1] = alpha_emit_conditional_move (operands[1], DImode)) == 0)
3929 (define_expand "movsfcc"
3930 [(set (match_operand:SF 0 "register_operand" "")
3931 (if_then_else:SF (match_operand 1 "comparison_operator" "")
3932 (match_operand:SF 2 "reg_or_8bit_operand" "")
3933 (match_operand:SF 3 "reg_or_8bit_operand" "")))]
3936 if ((operands[1] = alpha_emit_conditional_move (operands[1], SFmode)) == 0)
3940 (define_expand "movdfcc"
3941 [(set (match_operand:DF 0 "register_operand" "")
3942 (if_then_else:DF (match_operand 1 "comparison_operator" "")
3943 (match_operand:DF 2 "reg_or_8bit_operand" "")
3944 (match_operand:DF 3 "reg_or_8bit_operand" "")))]
3947 if ((operands[1] = alpha_emit_conditional_move (operands[1], DFmode)) == 0)
3951 ;; These define_split definitions are used in cases when comparisons have
3952 ;; not be stated in the correct way and we need to reverse the second
3953 ;; comparison. For example, x >= 7 has to be done as x < 6 with the
3954 ;; comparison that tests the result being reversed. We have one define_split
3955 ;; for each use of a comparison. They do not match valid insns and need
3956 ;; not generate valid insns.
3958 ;; We can also handle equality comparisons (and inequality comparisons in
3959 ;; cases where the resulting add cannot overflow) by doing an add followed by
3960 ;; a comparison with zero. This is faster since the addition takes one
3961 ;; less cycle than a compare when feeding into a conditional move.
3962 ;; For this case, we also have an SImode pattern since we can merge the add
3963 ;; and sign extend and the order doesn't matter.
3965 ;; We do not do this for floating-point, since it isn't clear how the "wrong"
3966 ;; operation could have been generated.
3969 [(set (match_operand:DI 0 "register_operand" "")
3971 (match_operator 1 "comparison_operator"
3972 [(match_operand:DI 2 "reg_or_0_operand" "")
3973 (match_operand:DI 3 "reg_or_cint_operand" "")])
3974 (match_operand:DI 4 "reg_or_cint_operand" "")
3975 (match_operand:DI 5 "reg_or_cint_operand" "")))
3976 (clobber (match_operand:DI 6 "register_operand" ""))]
3977 "operands[3] != const0_rtx"
3978 [(set (match_dup 6) (match_dup 7))
3980 (if_then_else:DI (match_dup 8) (match_dup 4) (match_dup 5)))]
3982 enum rtx_code code = GET_CODE (operands[1]);
3983 int unsignedp = (code == GEU || code == LEU || code == GTU || code == LTU);
3985 /* If we are comparing for equality with a constant and that constant
3986 appears in the arm when the register equals the constant, use the
3987 register since that is more likely to match (and to produce better code
3990 if (code == EQ && GET_CODE (operands[3]) == CONST_INT
3991 && rtx_equal_p (operands[4], operands[3]))
3992 operands[4] = operands[2];
3994 else if (code == NE && GET_CODE (operands[3]) == CONST_INT
3995 && rtx_equal_p (operands[5], operands[3]))
3996 operands[5] = operands[2];
3998 if (code == NE || code == EQ
3999 || (extended_count (operands[2], DImode, unsignedp) >= 1
4000 && extended_count (operands[3], DImode, unsignedp) >= 1))
4002 if (GET_CODE (operands[3]) == CONST_INT)
4003 operands[7] = gen_rtx_PLUS (DImode, operands[2],
4004 GEN_INT (- INTVAL (operands[3])));
4006 operands[7] = gen_rtx_MINUS (DImode, operands[2], operands[3]);
4008 operands[8] = gen_rtx_fmt_ee (code, VOIDmode, operands[6], const0_rtx);
4011 else if (code == EQ || code == LE || code == LT
4012 || code == LEU || code == LTU)
4014 operands[7] = gen_rtx_fmt_ee (code, DImode, operands[2], operands[3]);
4015 operands[8] = gen_rtx_NE (VOIDmode, operands[6], const0_rtx);
4019 operands[7] = gen_rtx_fmt_ee (reverse_condition (code), DImode,
4020 operands[2], operands[3]);
4021 operands[8] = gen_rtx_EQ (VOIDmode, operands[6], const0_rtx);
4026 [(set (match_operand:DI 0 "register_operand" "")
4028 (match_operator 1 "comparison_operator"
4029 [(match_operand:SI 2 "reg_or_0_operand" "")
4030 (match_operand:SI 3 "reg_or_cint_operand" "")])
4031 (match_operand:DI 4 "reg_or_8bit_operand" "")
4032 (match_operand:DI 5 "reg_or_8bit_operand" "")))
4033 (clobber (match_operand:DI 6 "register_operand" ""))]
4034 "operands[3] != const0_rtx
4035 && (GET_CODE (operands[1]) == EQ || GET_CODE (operands[1]) == NE)"
4036 [(set (match_dup 6) (match_dup 7))
4038 (if_then_else:DI (match_dup 8) (match_dup 4) (match_dup 5)))]
4040 enum rtx_code code = GET_CODE (operands[1]);
4041 int unsignedp = (code == GEU || code == LEU || code == GTU || code == LTU);
4044 if ((code != NE && code != EQ
4045 && ! (extended_count (operands[2], DImode, unsignedp) >= 1
4046 && extended_count (operands[3], DImode, unsignedp) >= 1)))
4049 if (GET_CODE (operands[3]) == CONST_INT)
4050 tem = gen_rtx_PLUS (SImode, operands[2],
4051 GEN_INT (- INTVAL (operands[3])));
4053 tem = gen_rtx_MINUS (SImode, operands[2], operands[3]);
4055 operands[7] = gen_rtx_SIGN_EXTEND (DImode, tem);
4056 operands[8] = gen_rtx_fmt_ee (GET_CODE (operands[1]), VOIDmode,
4057 operands[6], const0_rtx);
4063 (match_operator 1 "comparison_operator"
4064 [(match_operand:DI 2 "reg_or_0_operand" "")
4065 (match_operand:DI 3 "reg_or_cint_operand" "")])
4066 (label_ref (match_operand 0 "" ""))
4068 (clobber (match_operand:DI 4 "register_operand" ""))]
4069 "operands[3] != const0_rtx"
4070 [(set (match_dup 4) (match_dup 5))
4071 (set (pc) (if_then_else (match_dup 6) (label_ref (match_dup 0)) (pc)))]
4073 enum rtx_code code = GET_CODE (operands[1]);
4074 int unsignedp = (code == GEU || code == LEU || code == GTU || code == LTU);
4076 if (code == NE || code == EQ
4077 || (extended_count (operands[2], DImode, unsignedp) >= 1
4078 && extended_count (operands[3], DImode, unsignedp) >= 1))
4080 if (GET_CODE (operands[3]) == CONST_INT)
4081 operands[5] = gen_rtx_PLUS (DImode, operands[2],
4082 GEN_INT (- INTVAL (operands[3])));
4084 operands[5] = gen_rtx_MINUS (DImode, operands[2], operands[3]);
4086 operands[6] = gen_rtx_fmt_ee (code, VOIDmode, operands[4], const0_rtx);
4089 else if (code == EQ || code == LE || code == LT
4090 || code == LEU || code == LTU)
4092 operands[5] = gen_rtx_fmt_ee (code, DImode, operands[2], operands[3]);
4093 operands[6] = gen_rtx_NE (VOIDmode, operands[4], const0_rtx);
4097 operands[5] = gen_rtx_fmt_ee (reverse_condition (code), DImode,
4098 operands[2], operands[3]);
4099 operands[6] = gen_rtx_EQ (VOIDmode, operands[4], const0_rtx);
4106 (match_operator 1 "comparison_operator"
4107 [(match_operand:SI 2 "reg_or_0_operand" "")
4108 (match_operand:SI 3 "const_int_operand" "")])
4109 (label_ref (match_operand 0 "" ""))
4111 (clobber (match_operand:DI 4 "register_operand" ""))]
4112 "operands[3] != const0_rtx
4113 && (GET_CODE (operands[1]) == EQ || GET_CODE (operands[1]) == NE)"
4114 [(set (match_dup 4) (match_dup 5))
4115 (set (pc) (if_then_else (match_dup 6) (label_ref (match_dup 0)) (pc)))]
4119 if (GET_CODE (operands[3]) == CONST_INT)
4120 tem = gen_rtx_PLUS (SImode, operands[2],
4121 GEN_INT (- INTVAL (operands[3])));
4123 tem = gen_rtx_MINUS (SImode, operands[2], operands[3]);
4125 operands[5] = gen_rtx_SIGN_EXTEND (DImode, tem);
4126 operands[6] = gen_rtx_fmt_ee (GET_CODE (operands[1]), VOIDmode,
4127 operands[4], const0_rtx);
4130 ;; We can convert such things as "a > 0xffff" to "t = a & ~ 0xffff; t != 0".
4131 ;; This eliminates one, and sometimes two, insns when the AND can be done
4134 [(set (match_operand:DI 0 "register_operand" "")
4135 (match_operator:DI 1 "comparison_operator"
4136 [(match_operand:DI 2 "register_operand" "")
4137 (match_operand:DI 3 "const_int_operand" "")]))
4138 (clobber (match_operand:DI 4 "register_operand" ""))]
4139 "exact_log2 (INTVAL (operands[3]) + 1) >= 0
4140 && (GET_CODE (operands[1]) == GTU
4141 || GET_CODE (operands[1]) == LEU
4142 || ((GET_CODE (operands[1]) == GT || GET_CODE (operands[1]) == LE)
4143 && extended_count (operands[2], DImode, 1) > 0))"
4144 [(set (match_dup 4) (and:DI (match_dup 2) (match_dup 5)))
4145 (set (match_dup 0) (match_dup 6))]
4147 operands[5] = GEN_INT (~ INTVAL (operands[3]));
4148 operands[6] = gen_rtx_fmt_ee (((GET_CODE (operands[1]) == GTU
4149 || GET_CODE (operands[1]) == GT)
4151 DImode, operands[4], const0_rtx);
4154 ;; Prefer to use cmp and arithmetic when possible instead of a cmove.
4157 [(set (match_operand 0 "register_operand" "")
4158 (if_then_else (match_operator 1 "signed_comparison_operator"
4159 [(match_operand:DI 2 "reg_or_0_operand" "")
4161 (match_operand 3 "const_int_operand" "")
4162 (match_operand 4 "const_int_operand" "")))]
4166 if (alpha_split_conditional_move (GET_CODE (operands[1]), operands[0],
4167 operands[2], operands[3], operands[4]))
4173 ;; ??? Why combine is allowed to create such non-canonical rtl, I don't know.
4174 ;; Oh well, we match it in movcc, so it must be partially our fault.
4176 [(set (match_operand 0 "register_operand" "")
4177 (if_then_else (match_operator 1 "signed_comparison_operator"
4179 (match_operand:DI 2 "reg_or_0_operand" "")])
4180 (match_operand 3 "const_int_operand" "")
4181 (match_operand 4 "const_int_operand" "")))]
4185 if (alpha_split_conditional_move (swap_condition (GET_CODE (operands[1])),
4186 operands[0], operands[2], operands[3],
4193 (define_insn_and_split "*cmp_sadd_di"
4194 [(set (match_operand:DI 0 "register_operand" "=r")
4195 (plus:DI (if_then_else:DI
4196 (match_operator 1 "alpha_zero_comparison_operator"
4197 [(match_operand:DI 2 "reg_or_0_operand" "rJ")
4199 (match_operand:DI 3 "const48_operand" "I")
4201 (match_operand:DI 4 "sext_add_operand" "rIO")))
4202 (clobber (match_scratch:DI 5 "=r"))]
4205 "! no_new_pseudos || reload_completed"
4207 (match_op_dup:DI 1 [(match_dup 2) (const_int 0)]))
4209 (plus:DI (mult:DI (match_dup 5) (match_dup 3))
4212 if (! no_new_pseudos)
4213 operands[5] = gen_reg_rtx (DImode);
4214 else if (reg_overlap_mentioned_p (operands[5], operands[4]))
4215 operands[5] = operands[0];
4218 (define_insn_and_split "*cmp_sadd_si"
4219 [(set (match_operand:SI 0 "register_operand" "=r")
4220 (plus:SI (if_then_else:SI
4221 (match_operator 1 "alpha_zero_comparison_operator"
4222 [(match_operand:DI 2 "reg_or_0_operand" "rJ")
4224 (match_operand:SI 3 "const48_operand" "I")
4226 (match_operand:SI 4 "sext_add_operand" "rIO")))
4227 (clobber (match_scratch:SI 5 "=r"))]
4230 "! no_new_pseudos || reload_completed"
4232 (match_op_dup:SI 1 [(match_dup 2) (const_int 0)]))
4234 (plus:SI (mult:SI (match_dup 5) (match_dup 3))
4237 if (! no_new_pseudos)
4238 operands[5] = gen_reg_rtx (DImode);
4239 else if (reg_overlap_mentioned_p (operands[5], operands[4]))
4240 operands[5] = operands[0];
4243 (define_insn_and_split "*cmp_sadd_sidi"
4244 [(set (match_operand:DI 0 "register_operand" "=r")
4246 (plus:SI (if_then_else:SI
4247 (match_operator 1 "alpha_zero_comparison_operator"
4248 [(match_operand:DI 2 "reg_or_0_operand" "rJ")
4250 (match_operand:SI 3 "const48_operand" "I")
4252 (match_operand:SI 4 "sext_add_operand" "rIO"))))
4253 (clobber (match_scratch:SI 5 "=r"))]
4256 "! no_new_pseudos || reload_completed"
4258 (match_op_dup:SI 1 [(match_dup 2) (const_int 0)]))
4260 (sign_extend:DI (plus:SI (mult:SI (match_dup 5) (match_dup 3))
4263 if (! no_new_pseudos)
4264 operands[5] = gen_reg_rtx (DImode);
4265 else if (reg_overlap_mentioned_p (operands[5], operands[4]))
4266 operands[5] = operands[0];
4269 (define_insn_and_split "*cmp_ssub_di"
4270 [(set (match_operand:DI 0 "register_operand" "=r")
4271 (minus:DI (if_then_else:DI
4272 (match_operator 1 "alpha_zero_comparison_operator"
4273 [(match_operand:DI 2 "reg_or_0_operand" "rJ")
4275 (match_operand:DI 3 "const48_operand" "I")
4277 (match_operand:DI 4 "reg_or_8bit_operand" "rI")))
4278 (clobber (match_scratch:DI 5 "=r"))]
4281 "! no_new_pseudos || reload_completed"
4283 (match_op_dup:DI 1 [(match_dup 2) (const_int 0)]))
4285 (minus:DI (mult:DI (match_dup 5) (match_dup 3))
4288 if (! no_new_pseudos)
4289 operands[5] = gen_reg_rtx (DImode);
4290 else if (reg_overlap_mentioned_p (operands[5], operands[4]))
4291 operands[5] = operands[0];
4294 (define_insn_and_split "*cmp_ssub_si"
4295 [(set (match_operand:SI 0 "register_operand" "=r")
4296 (minus:SI (if_then_else:SI
4297 (match_operator 1 "alpha_zero_comparison_operator"
4298 [(match_operand:DI 2 "reg_or_0_operand" "rJ")
4300 (match_operand:SI 3 "const48_operand" "I")
4302 (match_operand:SI 4 "reg_or_8bit_operand" "rI")))
4303 (clobber (match_scratch:SI 5 "=r"))]
4306 "! no_new_pseudos || reload_completed"
4308 (match_op_dup:SI 1 [(match_dup 2) (const_int 0)]))
4310 (minus:SI (mult:SI (match_dup 5) (match_dup 3))
4313 if (! no_new_pseudos)
4314 operands[5] = gen_reg_rtx (DImode);
4315 else if (reg_overlap_mentioned_p (operands[5], operands[4]))
4316 operands[5] = operands[0];
4319 (define_insn_and_split "*cmp_ssub_sidi"
4320 [(set (match_operand:DI 0 "register_operand" "=r")
4322 (minus:SI (if_then_else:SI
4323 (match_operator 1 "alpha_zero_comparison_operator"
4324 [(match_operand:DI 2 "reg_or_0_operand" "rJ")
4326 (match_operand:SI 3 "const48_operand" "I")
4328 (match_operand:SI 4 "reg_or_8bit_operand" "rI"))))
4329 (clobber (match_scratch:SI 5 "=r"))]
4332 "! no_new_pseudos || reload_completed"
4334 (match_op_dup:SI 1 [(match_dup 2) (const_int 0)]))
4336 (sign_extend:DI (minus:SI (mult:SI (match_dup 5) (match_dup 3))
4339 if (! no_new_pseudos)
4340 operands[5] = gen_reg_rtx (DImode);
4341 else if (reg_overlap_mentioned_p (operands[5], operands[4]))
4342 operands[5] = operands[0];
4345 ;; Here are the CALL and unconditional branch insns. Calls on NT and OSF
4346 ;; work differently, so we have different patterns for each.
4348 ;; On Unicos/Mk a call information word (CIW) must be generated for each
4349 ;; call. The CIW contains information about arguments passed in registers
4350 ;; and is stored in the caller's SSIB. Its offset relative to the beginning
4351 ;; of the SSIB is passed in $25. Handling this properly is quite complicated
4352 ;; in the presence of inlining since the CIWs for calls performed by the
4353 ;; inlined function must be stored in the SSIB of the function it is inlined
4354 ;; into as well. We encode the CIW in an unspec and append it to the list
4355 ;; of the CIWs for the current function only when the instruction for loading
4356 ;; $25 is generated.
4358 (define_expand "call"
4359 [(use (match_operand:DI 0 "" ""))
4360 (use (match_operand 1 "" ""))
4361 (use (match_operand 2 "" ""))
4362 (use (match_operand 3 "" ""))]
4365 if (TARGET_ABI_WINDOWS_NT)
4366 emit_call_insn (gen_call_nt (operands[0], operands[1]));
4367 else if (TARGET_ABI_OPEN_VMS)
4368 emit_call_insn (gen_call_vms (operands[0], operands[2]));
4369 else if (TARGET_ABI_UNICOSMK)
4370 emit_call_insn (gen_call_umk (operands[0], operands[2]));
4372 emit_call_insn (gen_call_osf (operands[0], operands[1]));
4376 (define_expand "sibcall"
4377 [(parallel [(call (mem:DI (match_operand 0 "" ""))
4378 (match_operand 1 "" ""))
4379 (unspec [(reg:DI 29)] UNSPEC_SIBCALL)])]
4382 if (GET_CODE (operands[0]) != MEM)
4384 operands[0] = XEXP (operands[0], 0);
4387 (define_expand "call_osf"
4388 [(parallel [(call (mem:DI (match_operand 0 "" ""))
4389 (match_operand 1 "" ""))
4391 (clobber (reg:DI 26))])]
4394 if (GET_CODE (operands[0]) != MEM)
4397 operands[0] = XEXP (operands[0], 0);
4398 if (! call_operand (operands[0], Pmode))
4399 operands[0] = copy_to_mode_reg (Pmode, operands[0]);
4402 (define_expand "call_nt"
4403 [(parallel [(call (mem:DI (match_operand 0 "" ""))
4404 (match_operand 1 "" ""))
4405 (clobber (reg:DI 26))])]
4408 if (GET_CODE (operands[0]) != MEM)
4411 operands[0] = XEXP (operands[0], 0);
4412 if (GET_CODE (operands[0]) != SYMBOL_REF && GET_CODE (operands[0]) != REG)
4413 operands[0] = force_reg (DImode, operands[0]);
4416 ;; Calls on Unicos/Mk are always indirect.
4417 ;; op 0: symbol ref for called function
4418 ;; op 1: CIW for $25 represented by an unspec
4420 (define_expand "call_umk"
4421 [(parallel [(call (mem:DI (match_operand 0 "" ""))
4422 (match_operand 1 "" ""))
4424 (clobber (reg:DI 26))])]
4427 if (GET_CODE (operands[0]) != MEM)
4430 /* Always load the address of the called function into a register;
4431 load the CIW in $25. */
4433 operands[0] = XEXP (operands[0], 0);
4434 if (GET_CODE (operands[0]) != REG)
4435 operands[0] = force_reg (DImode, operands[0]);
4437 emit_move_insn (gen_rtx_REG (DImode, 25), operands[1]);
4441 ;; call openvms/alpha
4442 ;; op 0: symbol ref for called function
4443 ;; op 1: next_arg_reg (argument information value for R25)
4445 (define_expand "call_vms"
4446 [(parallel [(call (mem:DI (match_operand 0 "" ""))
4447 (match_operand 1 "" ""))
4451 (clobber (reg:DI 27))])]
4454 if (GET_CODE (operands[0]) != MEM)
4457 operands[0] = XEXP (operands[0], 0);
4459 /* Always load AI with argument information, then handle symbolic and
4460 indirect call differently. Load RA and set operands[2] to PV in
4463 emit_move_insn (gen_rtx_REG (DImode, 25), operands[1]);
4464 if (GET_CODE (operands[0]) == SYMBOL_REF)
4466 alpha_need_linkage (XSTR (operands[0], 0), 0);
4468 operands[2] = const0_rtx;
4472 emit_move_insn (gen_rtx_REG (Pmode, 26),
4473 gen_rtx_MEM (Pmode, plus_constant (operands[0], 8)));
4474 operands[2] = operands[0];
4479 (define_expand "call_value"
4480 [(use (match_operand 0 "" ""))
4481 (use (match_operand:DI 1 "" ""))
4482 (use (match_operand 2 "" ""))
4483 (use (match_operand 3 "" ""))
4484 (use (match_operand 4 "" ""))]
4487 if (TARGET_ABI_WINDOWS_NT)
4488 emit_call_insn (gen_call_value_nt (operands[0], operands[1], operands[2]));
4489 else if (TARGET_ABI_OPEN_VMS)
4490 emit_call_insn (gen_call_value_vms (operands[0], operands[1],
4492 else if (TARGET_ABI_UNICOSMK)
4493 emit_call_insn (gen_call_value_umk (operands[0], operands[1],
4496 emit_call_insn (gen_call_value_osf (operands[0], operands[1],
4501 (define_expand "sibcall_value"
4502 [(parallel [(set (match_operand 0 "" "")
4503 (call (mem:DI (match_operand 1 "" ""))
4504 (match_operand 2 "" "")))
4505 (unspec [(reg:DI 29)] UNSPEC_SIBCALL)])]
4508 if (GET_CODE (operands[1]) != MEM)
4510 operands[1] = XEXP (operands[1], 0);
4513 (define_expand "call_value_osf"
4514 [(parallel [(set (match_operand 0 "" "")
4515 (call (mem:DI (match_operand 1 "" ""))
4516 (match_operand 2 "" "")))
4518 (clobber (reg:DI 26))])]
4521 if (GET_CODE (operands[1]) != MEM)
4524 operands[1] = XEXP (operands[1], 0);
4525 if (! call_operand (operands[1], Pmode))
4526 operands[1] = copy_to_mode_reg (Pmode, operands[1]);
4529 (define_expand "call_value_nt"
4530 [(parallel [(set (match_operand 0 "" "")
4531 (call (mem:DI (match_operand 1 "" ""))
4532 (match_operand 2 "" "")))
4533 (clobber (reg:DI 26))])]
4536 if (GET_CODE (operands[1]) != MEM)
4539 operands[1] = XEXP (operands[1], 0);
4540 if (GET_CODE (operands[1]) != SYMBOL_REF && GET_CODE (operands[1]) != REG)
4541 operands[1] = force_reg (DImode, operands[1]);
4544 (define_expand "call_value_vms"
4545 [(parallel [(set (match_operand 0 "" "")
4546 (call (mem:DI (match_operand:DI 1 "" ""))
4547 (match_operand 2 "" "")))
4551 (clobber (reg:DI 27))])]
4554 if (GET_CODE (operands[1]) != MEM)
4557 operands[1] = XEXP (operands[1], 0);
4559 /* Always load AI with argument information, then handle symbolic and
4560 indirect call differently. Load RA and set operands[3] to PV in
4563 emit_move_insn (gen_rtx_REG (DImode, 25), operands[2]);
4564 if (GET_CODE (operands[1]) == SYMBOL_REF)
4566 alpha_need_linkage (XSTR (operands[1], 0), 0);
4568 operands[3] = const0_rtx;
4572 emit_move_insn (gen_rtx_REG (Pmode, 26),
4573 gen_rtx_MEM (Pmode, plus_constant (operands[1], 8)));
4574 operands[3] = operands[1];
4578 (define_expand "call_value_umk"
4579 [(parallel [(set (match_operand 0 "" "")
4580 (call (mem:DI (match_operand 1 "" ""))
4581 (match_operand 2 "" "")))
4583 (clobber (reg:DI 26))])]
4586 if (GET_CODE (operands[1]) != MEM)
4589 operands[1] = XEXP (operands[1], 0);
4590 if (GET_CODE (operands[1]) != REG)
4591 operands[1] = force_reg (DImode, operands[1]);
4593 emit_move_insn (gen_rtx_REG (DImode, 25), operands[2]);
4596 (define_insn "*call_osf_1_er"
4597 [(call (mem:DI (match_operand:DI 0 "call_operand" "c,R,s"))
4598 (match_operand 1 "" ""))
4600 (clobber (reg:DI 26))]
4601 "TARGET_EXPLICIT_RELOCS && TARGET_ABI_OSF"
4603 jsr $26,(%0),0\;ldah $29,0($26)\t\t!gpdisp!%*\;lda $29,0($29)\t\t!gpdisp!%*
4604 bsr $26,%0\t\t!samegp
4605 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!%*"
4606 [(set_attr "type" "jsr")
4607 (set_attr "length" "12,*,16")])
4609 ;; We must use peep2 instead of a split because we need accurate life
4610 ;; information for $gp. Consider the case of { bar(); while (1); }.
4612 [(parallel [(call (mem:DI (match_operand:DI 0 "call_operand" ""))
4613 (match_operand 1 "" ""))
4615 (clobber (reg:DI 26))])]
4616 "TARGET_EXPLICIT_RELOCS && TARGET_ABI_OSF && reload_completed
4617 && ! samegp_function_operand (operands[0], Pmode)
4618 && peep2_regno_dead_p (1, 29)"
4619 [(parallel [(call (mem:DI (match_dup 2))
4621 (set (reg:DI 26) (plus:DI (pc) (const_int 4)))
4622 (unspec_volatile [(reg:DI 29)] UNSPECV_BLOCKAGE)
4624 (use (match_dup 3))])]
4626 if (CONSTANT_P (operands[0]))
4628 operands[2] = gen_rtx_REG (Pmode, 27);
4629 operands[3] = GEN_INT (alpha_next_sequence_number++);
4630 emit_insn (gen_movdi_er_high_g (operands[2], pic_offset_table_rtx,
4631 operands[0], operands[3]));
4635 operands[2] = operands[0];
4636 operands[0] = const0_rtx;
4637 operands[3] = const0_rtx;
4642 [(parallel [(call (mem:DI (match_operand:DI 0 "call_operand" ""))
4643 (match_operand 1 "" ""))
4645 (clobber (reg:DI 26))])]
4646 "TARGET_EXPLICIT_RELOCS && TARGET_ABI_OSF && reload_completed
4647 && ! samegp_function_operand (operands[0], Pmode)
4648 && ! peep2_regno_dead_p (1, 29)"
4649 [(parallel [(call (mem:DI (match_dup 2))
4651 (set (reg:DI 26) (plus:DI (pc) (const_int 4)))
4652 (unspec_volatile [(reg:DI 29)] UNSPECV_BLOCKAGE)
4654 (use (match_dup 4))])
4656 (unspec_volatile:DI [(reg:DI 26) (match_dup 3)] UNSPECV_LDGP1))
4658 (unspec:DI [(reg:DI 29) (match_dup 3)] UNSPEC_LDGP2))]
4660 if (CONSTANT_P (operands[0]))
4662 operands[2] = gen_rtx_REG (Pmode, 27);
4663 operands[4] = GEN_INT (alpha_next_sequence_number++);
4664 emit_insn (gen_movdi_er_high_g (operands[2], pic_offset_table_rtx,
4665 operands[0], operands[4]));
4669 operands[2] = operands[0];
4670 operands[0] = const0_rtx;
4671 operands[4] = const0_rtx;
4673 operands[3] = GEN_INT (alpha_next_sequence_number++);
4676 ;; We add a blockage unspec_volatile to prevent insns from moving down
4677 ;; from above the call to in between the call and the ldah gpdisp.
4679 (define_insn "*call_osf_2_er"
4680 [(call (mem:DI (match_operand:DI 0 "register_operand" "c"))
4681 (match_operand 1 "" ""))
4682 (set (reg:DI 26) (plus:DI (pc) (const_int 4)))
4683 (unspec_volatile [(reg:DI 29)] UNSPECV_BLOCKAGE)
4684 (use (match_operand 2 "" ""))
4685 (use (match_operand 3 "const_int_operand" ""))]
4686 "TARGET_EXPLICIT_RELOCS && TARGET_ABI_OSF"
4687 "jsr $26,(%0),%2%J3"
4688 [(set_attr "type" "jsr")])
4690 (define_insn "*call_osf_1_noreturn"
4691 [(call (mem:DI (match_operand:DI 0 "call_operand" "c,R,s"))
4692 (match_operand 1 "" ""))
4694 (clobber (reg:DI 26))]
4695 "! TARGET_EXPLICIT_RELOCS && TARGET_ABI_OSF
4696 && find_reg_note (insn, REG_NORETURN, NULL_RTX)"
4701 [(set_attr "type" "jsr")
4702 (set_attr "length" "*,*,8")])
4704 (define_insn "*call_osf_1"
4705 [(call (mem:DI (match_operand:DI 0 "call_operand" "c,R,s"))
4706 (match_operand 1 "" ""))
4708 (clobber (reg:DI 26))]
4709 "! TARGET_EXPLICIT_RELOCS && TARGET_ABI_OSF"
4711 jsr $26,($27),0\;ldgp $29,0($26)
4713 jsr $26,%0\;ldgp $29,0($26)"
4714 [(set_attr "type" "jsr")
4715 (set_attr "length" "12,*,16")])
4717 ;; Note that the DEC assembler expands "jmp foo" with $at, which
4718 ;; doesn't do what we want.
4719 (define_insn "*sibcall_osf_1_er"
4720 [(call (mem:DI (match_operand:DI 0 "symbolic_operand" "R,s"))
4721 (match_operand 1 "" ""))
4722 (unspec [(reg:DI 29)] UNSPEC_SIBCALL)]
4723 "TARGET_EXPLICIT_RELOCS && TARGET_ABI_OSF"
4725 br $31,%0\t\t!samegp
4726 ldq $27,%0($29)\t\t!literal!%#\;jmp $31,($27),%0\t\t!lituse_jsr!%#"
4727 [(set_attr "type" "jsr")
4728 (set_attr "length" "*,8")])
4730 (define_insn "*sibcall_osf_1"
4731 [(call (mem:DI (match_operand:DI 0 "symbolic_operand" "R,s"))
4732 (match_operand 1 "" ""))
4733 (unspec [(reg:DI 29)] UNSPEC_SIBCALL)]
4734 "! TARGET_EXPLICIT_RELOCS && TARGET_ABI_OSF"
4737 lda $27,%0\;jmp $31,($27),%0"
4738 [(set_attr "type" "jsr")
4739 (set_attr "length" "*,8")])
4741 (define_insn "*call_nt_1"
4742 [(call (mem:DI (match_operand:DI 0 "call_operand" "r,R,s"))
4743 (match_operand 1 "" ""))
4744 (clobber (reg:DI 26))]
4745 "TARGET_ABI_WINDOWS_NT"
4750 [(set_attr "type" "jsr")
4751 (set_attr "length" "*,*,12")])
4753 ; GAS relies on the order and position of instructions output below in order
4754 ; to generate relocs for VMS link to potentially optimize the call.
4755 ; Please do not molest.
4756 (define_insn "*call_vms_1"
4757 [(call (mem:DI (match_operand:DI 0 "call_operand" "r,s"))
4758 (match_operand 1 "" ""))
4759 (use (match_operand:DI 2 "nonmemory_operand" "r,n"))
4762 (clobber (reg:DI 27))]
4763 "TARGET_ABI_OPEN_VMS"
4765 switch (which_alternative)
4768 return "mov %2,$27\;jsr $26,0\;ldq $27,0($29)";
4770 operands [2] = alpha_use_linkage (operands [0], cfun->decl, 1, 0);
4771 operands [3] = alpha_use_linkage (operands [0], cfun->decl, 0, 0);
4772 return "ldq $26,%3\;ldq $27,%2\;jsr $26,%0\;ldq $27,0($29)";
4777 [(set_attr "type" "jsr")
4778 (set_attr "length" "12,16")])
4780 (define_insn "*call_umk_1"
4781 [(call (mem:DI (match_operand:DI 0 "call_operand" "r"))
4782 (match_operand 1 "" ""))
4784 (clobber (reg:DI 26))]
4785 "TARGET_ABI_UNICOSMK"
4787 [(set_attr "type" "jsr")])
4789 ;; Call subroutine returning any type.
4791 (define_expand "untyped_call"
4792 [(parallel [(call (match_operand 0 "" "")
4794 (match_operand 1 "" "")
4795 (match_operand 2 "" "")])]
4800 emit_call_insn (GEN_CALL (operands[0], const0_rtx, NULL, const0_rtx));
4802 for (i = 0; i < XVECLEN (operands[2], 0); i++)
4804 rtx set = XVECEXP (operands[2], 0, i);
4805 emit_move_insn (SET_DEST (set), SET_SRC (set));
4808 /* The optimizer does not know that the call sets the function value
4809 registers we stored in the result block. We avoid problems by
4810 claiming that all hard registers are used and clobbered at this
4812 emit_insn (gen_blockage ());
4817 ;; UNSPEC_VOLATILE is considered to use and clobber all hard registers and
4818 ;; all of memory. This blocks insns from being moved across this point.
4820 (define_insn "blockage"
4821 [(unspec_volatile [(const_int 0)] UNSPECV_BLOCKAGE)]
4824 [(set_attr "length" "0")
4825 (set_attr "type" "none")])
4829 (label_ref (match_operand 0 "" "")))]
4832 [(set_attr "type" "ibr")])
4834 (define_expand "return"
4839 (define_insn "*return_internal"
4843 [(set_attr "type" "ibr")])
4845 (define_insn "indirect_jump"
4846 [(set (pc) (match_operand:DI 0 "register_operand" "r"))]
4849 [(set_attr "type" "ibr")])
4851 (define_expand "tablejump"
4852 [(parallel [(set (pc)
4853 (match_operand 0 "register_operand" ""))
4854 (use (label_ref:DI (match_operand 1 "" "")))])]
4857 if (TARGET_ABI_WINDOWS_NT)
4859 rtx dest = gen_reg_rtx (DImode);
4860 emit_insn (gen_extendsidi2 (dest, operands[0]));
4863 else if (TARGET_ABI_OSF)
4865 rtx dest = gen_reg_rtx (DImode);
4866 emit_insn (gen_extendsidi2 (dest, operands[0]));
4867 emit_insn (gen_adddi3 (dest, pic_offset_table_rtx, dest));
4872 (define_insn "*tablejump_osf_nt_internal"
4874 (match_operand:DI 0 "register_operand" "r"))
4875 (use (label_ref:DI (match_operand 1 "" "")))]
4876 "(TARGET_ABI_OSF || TARGET_ABI_WINDOWS_NT)
4877 && alpha_tablejump_addr_vec (insn)"
4879 operands[2] = alpha_tablejump_best_label (insn);
4880 return "jmp $31,(%0),%2";
4882 [(set_attr "type" "ibr")])
4884 (define_insn "*tablejump_internal"
4886 (match_operand:DI 0 "register_operand" "r"))
4887 (use (label_ref (match_operand 1 "" "")))]
4890 [(set_attr "type" "ibr")])
4892 ;; Cache flush. Used by INITIALIZE_TRAMPOLINE. 0x86 is PAL_imb, but we don't
4893 ;; want to have to include pal.h in our .s file.
4895 ;; Technically the type for call_pal is jsr, but we use that for determining
4896 ;; if we need a GP. Use ibr instead since it has the same EV5 scheduling
4899 [(unspec_volatile [(const_int 0)] UNSPECV_IMB)]
4902 [(set_attr "type" "callpal")])
4904 ;; BUGCHK is documented common to OSF/1 and VMS PALcode.
4905 ;; NT does not document anything at 0x81 -- presumably it would generate
4906 ;; the equivalent of SIGILL, but this isn't that important.
4907 ;; ??? Presuming unicosmk uses either OSF/1 or VMS PALcode.
4909 [(trap_if (const_int 1) (const_int 0))]
4910 "!TARGET_ABI_WINDOWS_NT"
4912 [(set_attr "type" "callpal")])
4914 ;; For userland, we load the thread pointer from the TCB.
4915 ;; For the kernel, we load the per-cpu private value.
4917 (define_insn "load_tp"
4918 [(set (match_operand:DI 0 "register_operand" "=v")
4919 (unspec:DI [(const_int 0)] UNSPEC_TP))]
4922 if (TARGET_TLS_KERNEL)
4923 return "call_pal 0x32";
4925 return "call_pal 0x9e";
4927 [(set_attr "type" "callpal")])
4929 ;; For completeness, and possibly a __builtin function, here's how to
4930 ;; set the thread pointer. Since we don't describe enough of this
4931 ;; quantity for CSE, we have to use a volatile unspec, and then there's
4932 ;; not much point in creating an R16_REG register class.
4934 (define_expand "set_tp"
4935 [(set (reg:DI 16) (match_operand:DI 0 "input_operand" ""))
4936 (unspec_volatile [(reg:DI 16)] UNSPECV_SET_TP)]
4940 (define_insn "*set_tp"
4941 [(unspec_volatile [(reg:DI 16)] UNSPECV_SET_TP)]
4944 if (TARGET_TLS_KERNEL)
4945 return "call_pal 0x31";
4947 return "call_pal 0x9f";
4949 [(set_attr "type" "callpal")])
4951 ;; Finally, we have the basic data motion insns. The byte and word insns
4952 ;; are done via define_expand. Start with the floating-point insns, since
4953 ;; they are simpler.
4955 (define_insn "*movsf_nofix"
4956 [(set (match_operand:SF 0 "nonimmediate_operand" "=f,f,*r,*r,m,m")
4957 (match_operand:SF 1 "input_operand" "fG,m,*rG,m,fG,*r"))]
4958 "TARGET_FPREGS && ! TARGET_FIX
4959 && (register_operand (operands[0], SFmode)
4960 || reg_or_0_operand (operands[1], SFmode))"
4968 [(set_attr "type" "fcpys,fld,ilog,ild,fst,ist")])
4970 (define_insn "*movsf_fix"
4971 [(set (match_operand:SF 0 "nonimmediate_operand" "=f,f,*r,*r,m,m,f,*r")
4972 (match_operand:SF 1 "input_operand" "fG,m,*rG,m,fG,*r,*r,f"))]
4973 "TARGET_FPREGS && TARGET_FIX
4974 && (register_operand (operands[0], SFmode)
4975 || reg_or_0_operand (operands[1], SFmode))"
4985 [(set_attr "type" "fcpys,fld,ilog,ild,fst,ist,itof,ftoi")])
4987 (define_insn "*movsf_nofp"
4988 [(set (match_operand:SF 0 "nonimmediate_operand" "=r,r,m")
4989 (match_operand:SF 1 "input_operand" "rG,m,r"))]
4991 && (register_operand (operands[0], SFmode)
4992 || reg_or_0_operand (operands[1], SFmode))"
4997 [(set_attr "type" "ilog,ild,ist")])
4999 (define_insn "*movdf_nofix"
5000 [(set (match_operand:DF 0 "nonimmediate_operand" "=f,f,*r,*r,m,m")
5001 (match_operand:DF 1 "input_operand" "fG,m,*rG,m,fG,*r"))]
5002 "TARGET_FPREGS && ! TARGET_FIX
5003 && (register_operand (operands[0], DFmode)
5004 || reg_or_0_operand (operands[1], DFmode))"
5012 [(set_attr "type" "fcpys,fld,ilog,ild,fst,ist")])
5014 (define_insn "*movdf_fix"
5015 [(set (match_operand:DF 0 "nonimmediate_operand" "=f,f,*r,*r,m,m,f,*r")
5016 (match_operand:DF 1 "input_operand" "fG,m,*rG,m,fG,*r,*r,f"))]
5017 "TARGET_FPREGS && TARGET_FIX
5018 && (register_operand (operands[0], DFmode)
5019 || reg_or_0_operand (operands[1], DFmode))"
5029 [(set_attr "type" "fcpys,fld,ilog,ild,fst,ist,itof,ftoi")])
5031 (define_insn "*movdf_nofp"
5032 [(set (match_operand:DF 0 "nonimmediate_operand" "=r,r,m")
5033 (match_operand:DF 1 "input_operand" "rG,m,r"))]
5035 && (register_operand (operands[0], DFmode)
5036 || reg_or_0_operand (operands[1], DFmode))"
5041 [(set_attr "type" "ilog,ild,ist")])
5043 ;; Subregs suck for register allocation. Pretend we can move TFmode
5044 ;; data between general registers until after reload.
5046 (define_insn_and_split "*movtf_internal"
5047 [(set (match_operand:TF 0 "nonimmediate_operand" "=r,o")
5048 (match_operand:TF 1 "input_operand" "roG,rG"))]
5049 "register_operand (operands[0], TFmode)
5050 || reg_or_0_operand (operands[1], TFmode)"
5053 [(set (match_dup 0) (match_dup 2))
5054 (set (match_dup 1) (match_dup 3))]
5056 alpha_split_tfmode_pair (operands);
5057 if (reg_overlap_mentioned_p (operands[0], operands[3]))
5060 tmp = operands[0], operands[0] = operands[1], operands[1] = tmp;
5061 tmp = operands[2], operands[2] = operands[3], operands[3] = tmp;
5065 (define_expand "movsf"
5066 [(set (match_operand:SF 0 "nonimmediate_operand" "")
5067 (match_operand:SF 1 "general_operand" ""))]
5070 if (GET_CODE (operands[0]) == MEM
5071 && ! reg_or_0_operand (operands[1], SFmode))
5072 operands[1] = force_reg (SFmode, operands[1]);
5075 (define_expand "movdf"
5076 [(set (match_operand:DF 0 "nonimmediate_operand" "")
5077 (match_operand:DF 1 "general_operand" ""))]
5080 if (GET_CODE (operands[0]) == MEM
5081 && ! reg_or_0_operand (operands[1], DFmode))
5082 operands[1] = force_reg (DFmode, operands[1]);
5085 (define_expand "movtf"
5086 [(set (match_operand:TF 0 "nonimmediate_operand" "")
5087 (match_operand:TF 1 "general_operand" ""))]
5090 if (GET_CODE (operands[0]) == MEM
5091 && ! reg_or_0_operand (operands[1], TFmode))
5092 operands[1] = force_reg (TFmode, operands[1]);
5095 (define_insn "*movsi_nofix"
5096 [(set (match_operand:SI 0 "nonimmediate_operand" "=r,r,r,r,m,*f,*f,m")
5097 (match_operand:SI 1 "input_operand" "rJ,K,L,m,rJ,*fJ,m,*f"))]
5098 "(TARGET_ABI_OSF || TARGET_ABI_UNICOSMK) && ! TARGET_FIX
5099 && (register_operand (operands[0], SImode)
5100 || reg_or_0_operand (operands[1], SImode))"
5110 [(set_attr "type" "ilog,iadd,iadd,ild,ist,fcpys,fld,fst")])
5112 (define_insn "*movsi_fix"
5113 [(set (match_operand:SI 0 "nonimmediate_operand" "=r,r,r,r,m,*f,*f,m,r,*f")
5114 (match_operand:SI 1 "input_operand" "rJ,K,L,m,rJ,*fJ,m,*f,*f,r"))]
5115 "TARGET_ABI_OSF && TARGET_FIX
5116 && (register_operand (operands[0], SImode)
5117 || reg_or_0_operand (operands[1], SImode))"
5129 [(set_attr "type" "ilog,iadd,iadd,ild,ist,fcpys,fld,fst,ftoi,itof")])
5131 (define_insn "*movsi_nt_vms_nofix"
5132 [(set (match_operand:SI 0 "nonimmediate_operand" "=r,r,r,r,r,m,*f,*f,m")
5133 (match_operand:SI 1 "input_operand" "rJ,K,L,s,m,rJ,*fJ,m,*f"))]
5134 "(TARGET_ABI_WINDOWS_NT || TARGET_ABI_OPEN_VMS)
5136 && (register_operand (operands[0], SImode)
5137 || reg_or_0_operand (operands[1], SImode))"
5148 [(set_attr "type" "ilog,iadd,iadd,ldsym,ild,ist,fcpys,fld,fst")])
5150 (define_insn "*movsi_nt_vms_fix"
5151 [(set (match_operand:SI 0 "nonimmediate_operand" "=r,r,r,r,r,m,*f,*f,m,r,*f")
5152 (match_operand:SI 1 "input_operand" "rJ,K,L,s,m,rJ,*fJ,m,*f,*f,r"))]
5153 "(TARGET_ABI_WINDOWS_NT || TARGET_ABI_OPEN_VMS)
5155 && (register_operand (operands[0], SImode)
5156 || reg_or_0_operand (operands[1], SImode))"
5169 [(set_attr "type" "ilog,iadd,iadd,ldsym,ild,ist,fcpys,fld,fst,ftoi,itof")])
5171 (define_insn "*movhi_nobwx"
5172 [(set (match_operand:HI 0 "register_operand" "=r,r")
5173 (match_operand:HI 1 "input_operand" "rJ,n"))]
5175 && (register_operand (operands[0], HImode)
5176 || register_operand (operands[1], HImode))"
5180 [(set_attr "type" "ilog,iadd")])
5182 (define_insn "*movhi_bwx"
5183 [(set (match_operand:HI 0 "nonimmediate_operand" "=r,r,r,m")
5184 (match_operand:HI 1 "input_operand" "rJ,n,m,rJ"))]
5186 && (register_operand (operands[0], HImode)
5187 || reg_or_0_operand (operands[1], HImode))"
5193 [(set_attr "type" "ilog,iadd,ild,ist")])
5195 (define_insn "*movqi_nobwx"
5196 [(set (match_operand:QI 0 "register_operand" "=r,r")
5197 (match_operand:QI 1 "input_operand" "rJ,n"))]
5199 && (register_operand (operands[0], QImode)
5200 || register_operand (operands[1], QImode))"
5204 [(set_attr "type" "ilog,iadd")])
5206 (define_insn "*movqi_bwx"
5207 [(set (match_operand:QI 0 "nonimmediate_operand" "=r,r,r,m")
5208 (match_operand:QI 1 "input_operand" "rJ,n,m,rJ"))]
5210 && (register_operand (operands[0], QImode)
5211 || reg_or_0_operand (operands[1], QImode))"
5217 [(set_attr "type" "ilog,iadd,ild,ist")])
5219 ;; We do two major things here: handle mem->mem and construct long
5222 (define_expand "movsi"
5223 [(set (match_operand:SI 0 "nonimmediate_operand" "")
5224 (match_operand:SI 1 "general_operand" ""))]
5227 if (alpha_expand_mov (SImode, operands))
5231 ;; Split a load of a large constant into the appropriate two-insn
5235 [(set (match_operand:SI 0 "register_operand" "")
5236 (match_operand:SI 1 "const_int_operand" ""))]
5237 "! add_operand (operands[1], SImode)"
5238 [(set (match_dup 0) (match_dup 2))
5239 (set (match_dup 0) (plus:SI (match_dup 0) (match_dup 3)))]
5242 = alpha_emit_set_const (operands[0], SImode, INTVAL (operands[1]), 2);
5244 if (tem == operands[0])
5250 ;; Split the load of an address into a four-insn sequence on Unicos/Mk.
5251 ;; Always generate a REG_EQUAL note for the last instruction to facilitate
5252 ;; optimisations. If the symbolic operand is a label_ref, generate REG_LABEL
5253 ;; notes and update LABEL_NUSES because this is not done automatically.
5254 ;; Labels may be incorrectly deleted if we don't do this.
5256 ;; Describing what the individual instructions do correctly is too complicated
5257 ;; so use UNSPECs for each of the three parts of an address.
5260 [(set (match_operand:DI 0 "register_operand" "")
5261 (match_operand:DI 1 "symbolic_operand" ""))]
5262 "TARGET_ABI_UNICOSMK && reload_completed"
5265 rtx insn1, insn2, insn3;
5267 insn1 = emit_insn (gen_umk_laum (operands[0], operands[1]));
5268 emit_insn (gen_ashldi3 (operands[0], operands[0], GEN_INT (32)));
5269 insn2 = emit_insn (gen_umk_lalm (operands[0], operands[0], operands[1]));
5270 insn3 = emit_insn (gen_umk_lal (operands[0], operands[0], operands[1]));
5271 REG_NOTES (insn3) = gen_rtx_EXPR_LIST (REG_EQUAL, operands[1],
5273 if (GET_CODE (operands[1]) == LABEL_REF)
5277 label = XEXP (operands[1], 0);
5278 REG_NOTES (insn1) = gen_rtx_EXPR_LIST (REG_LABEL, label,
5280 REG_NOTES (insn2) = gen_rtx_EXPR_LIST (REG_LABEL, label,
5282 REG_NOTES (insn3) = gen_rtx_EXPR_LIST (REG_LABEL, label,
5284 LABEL_NUSES (label) += 3;
5289 ;; Instructions for loading the three parts of an address on Unicos/Mk.
5291 (define_insn "umk_laum"
5292 [(set (match_operand:DI 0 "register_operand" "=r")
5293 (unspec:DI [(match_operand:DI 1 "symbolic_operand" "")]
5295 "TARGET_ABI_UNICOSMK"
5297 [(set_attr "type" "iadd")])
5299 (define_insn "umk_lalm"
5300 [(set (match_operand:DI 0 "register_operand" "=r")
5301 (plus:DI (match_operand:DI 1 "register_operand" "r")
5302 (unspec:DI [(match_operand:DI 2 "symbolic_operand" "")]
5304 "TARGET_ABI_UNICOSMK"
5306 [(set_attr "type" "iadd")])
5308 (define_insn "umk_lal"
5309 [(set (match_operand:DI 0 "register_operand" "=r")
5310 (plus:DI (match_operand:DI 1 "register_operand" "r")
5311 (unspec:DI [(match_operand:DI 2 "symbolic_operand" "")]
5313 "TARGET_ABI_UNICOSMK"
5315 [(set_attr "type" "iadd")])
5317 ;; Add a new call information word to the current function's list of CIWs
5318 ;; and load its index into $25. Doing it here ensures that the CIW will be
5319 ;; associated with the correct function even in the presence of inlining.
5321 (define_insn "*umk_load_ciw"
5323 (unspec:DI [(match_operand 0 "" "")] UNSPEC_UMK_LOAD_CIW))]
5324 "TARGET_ABI_UNICOSMK"
5326 operands[0] = unicosmk_add_call_info_word (operands[0]);
5327 return "lda $25,%0";
5329 [(set_attr "type" "iadd")])
5331 (define_insn "*movdi_er_low_l"
5332 [(set (match_operand:DI 0 "register_operand" "=r")
5333 (lo_sum:DI (match_operand:DI 1 "register_operand" "r")
5334 (match_operand:DI 2 "local_symbolic_operand" "")))]
5335 "TARGET_EXPLICIT_RELOCS"
5337 if (true_regnum (operands[1]) == 29)
5338 return "lda %0,%2(%1)\t\t!gprel";
5340 return "lda %0,%2(%1)\t\t!gprellow";
5342 [(set_attr "usegp" "yes")])
5345 [(set (match_operand:DI 0 "register_operand" "")
5346 (match_operand:DI 1 "small_symbolic_operand" ""))]
5347 "TARGET_EXPLICIT_RELOCS && reload_completed"
5349 (lo_sum:DI (match_dup 2) (match_dup 1)))]
5350 "operands[2] = pic_offset_table_rtx;")
5353 [(set (match_operand:DI 0 "register_operand" "")
5354 (match_operand:DI 1 "local_symbolic_operand" ""))]
5355 "TARGET_EXPLICIT_RELOCS && reload_completed"
5357 (plus:DI (match_dup 2) (high:DI (match_dup 1))))
5359 (lo_sum:DI (match_dup 0) (match_dup 1)))]
5360 "operands[2] = pic_offset_table_rtx;")
5363 [(match_operand 0 "some_small_symbolic_operand" "")]
5364 "TARGET_EXPLICIT_RELOCS && reload_completed"
5366 "operands[0] = split_small_symbolic_operand (operands[0]);")
5368 ;; Accepts any symbolic, not just global, since function calls that
5369 ;; don't go via bsr still use !literal in hopes of linker relaxation.
5370 (define_insn "movdi_er_high_g"
5371 [(set (match_operand:DI 0 "register_operand" "=r")
5372 (unspec:DI [(match_operand:DI 1 "register_operand" "r")
5373 (match_operand:DI 2 "symbolic_operand" "")
5374 (match_operand 3 "const_int_operand" "")]
5376 "TARGET_EXPLICIT_RELOCS"
5378 if (INTVAL (operands[3]) == 0)
5379 return "ldq %0,%2(%1)\t\t!literal";
5381 return "ldq %0,%2(%1)\t\t!literal!%3";
5383 [(set_attr "type" "ldsym")])
5386 [(set (match_operand:DI 0 "register_operand" "")
5387 (match_operand:DI 1 "global_symbolic_operand" ""))]
5388 "TARGET_EXPLICIT_RELOCS && reload_completed"
5390 (unspec:DI [(match_dup 2)
5392 (const_int 0)] UNSPEC_LITERAL))]
5393 "operands[2] = pic_offset_table_rtx;")
5395 ;; With RTL inlining, at -O3, rtl is generated, stored, then actually
5396 ;; compiled at the end of compilation. In the meantime, someone can
5397 ;; re-encode-section-info on some symbol changing it e.g. from global
5398 ;; to local-not-small. If this happens, we'd have emitted a plain
5399 ;; load rather than a high+losum load and not recognize the insn.
5401 ;; So if rtl inlining is in effect, we delay the global/not-global
5402 ;; decision until rest_of_compilation by wrapping it in an UNSPEC_SYMBOL.
5404 (define_insn_and_split "movdi_er_maybe_g"
5405 [(set (match_operand:DI 0 "register_operand" "=r")
5406 (unspec:DI [(match_operand:DI 1 "symbolic_operand" "")]
5408 "TARGET_EXPLICIT_RELOCS && flag_inline_functions"
5411 [(set (match_dup 0) (match_dup 1))]
5413 if (local_symbolic_operand (operands[1], Pmode)
5414 && !small_symbolic_operand (operands[1], Pmode))
5416 rtx subtarget = no_new_pseudos ? operands[0] : gen_reg_rtx (Pmode);
5419 tmp = gen_rtx_HIGH (Pmode, operands[1]);
5420 if (reload_completed)
5421 tmp = gen_rtx_PLUS (Pmode, pic_offset_table_rtx, tmp);
5422 emit_insn (gen_rtx_SET (VOIDmode, subtarget, tmp));
5424 tmp = gen_rtx_LO_SUM (Pmode, subtarget, operands[1]);
5425 emit_insn (gen_rtx_SET (VOIDmode, operands[0], tmp));
5430 (define_insn "movdi_er_tlsgd"
5431 [(set (match_operand:DI 0 "register_operand" "=r")
5432 (unspec:DI [(match_operand:DI 1 "register_operand" "r")
5433 (match_operand:DI 2 "symbolic_operand" "")
5434 (match_operand 3 "const_int_operand" "")]
5438 if (INTVAL (operands[3]) == 0)
5439 return "lda %0,%2(%1)\t\t!tlsgd";
5441 return "lda %0,%2(%1)\t\t!tlsgd!%3";
5444 (define_insn "movdi_er_tlsldm"
5445 [(set (match_operand:DI 0 "register_operand" "=r")
5446 (unspec:DI [(match_operand:DI 1 "register_operand" "r")
5447 (match_operand 2 "const_int_operand" "")]
5451 if (INTVAL (operands[2]) == 0)
5452 return "lda %0,%&(%1)\t\t!tlsldm";
5454 return "lda %0,%&(%1)\t\t!tlsldm!%2";
5457 (define_insn "*movdi_er_gotdtp"
5458 [(set (match_operand:DI 0 "register_operand" "=r")
5459 (unspec:DI [(match_operand:DI 1 "register_operand" "r")
5460 (match_operand:DI 2 "symbolic_operand" "")]
5463 "ldq %0,%2(%1)\t\t!gotdtprel"
5464 [(set_attr "type" "ild")
5465 (set_attr "usegp" "yes")])
5468 [(set (match_operand:DI 0 "register_operand" "")
5469 (match_operand:DI 1 "gotdtp_symbolic_operand" ""))]
5470 "HAVE_AS_TLS && reload_completed"
5472 (unspec:DI [(match_dup 2)
5473 (match_dup 1)] UNSPEC_DTPREL))]
5475 operands[1] = XVECEXP (XEXP (operands[1], 0), 0, 0);
5476 operands[2] = pic_offset_table_rtx;
5479 (define_insn "*movdi_er_gottp"
5480 [(set (match_operand:DI 0 "register_operand" "=r")
5481 (unspec:DI [(match_operand:DI 1 "register_operand" "r")
5482 (match_operand:DI 2 "symbolic_operand" "")]
5485 "ldq %0,%2(%1)\t\t!gottprel"
5486 [(set_attr "type" "ild")
5487 (set_attr "usegp" "yes")])
5490 [(set (match_operand:DI 0 "register_operand" "")
5491 (match_operand:DI 1 "gottp_symbolic_operand" ""))]
5492 "HAVE_AS_TLS && reload_completed"
5494 (unspec:DI [(match_dup 2)
5495 (match_dup 1)] UNSPEC_TPREL))]
5497 operands[1] = XVECEXP (XEXP (operands[1], 0), 0, 0);
5498 operands[2] = pic_offset_table_rtx;
5501 (define_insn "*movdi_er_nofix"
5502 [(set (match_operand:DI 0 "nonimmediate_operand" "=r,r,r,r,r,r,m,*f,*f,Q")
5503 (match_operand:DI 1 "input_operand" "rJ,K,L,T,s,m,rJ,*fJ,Q,*f"))]
5504 "TARGET_EXPLICIT_RELOCS && ! TARGET_FIX
5505 && (register_operand (operands[0], DImode)
5506 || reg_or_0_operand (operands[1], DImode))"
5518 [(set_attr "type" "ilog,iadd,iadd,iadd,ldsym,ild,ist,fcpys,fld,fst")
5519 (set_attr "usegp" "*,*,*,yes,*,*,*,*,*,*")])
5521 ;; The 'U' constraint matches symbolic operands on Unicos/Mk. Those should
5522 ;; have been split up by the rules above but we shouldn't reject the
5523 ;; possibility of them getting through.
5525 (define_insn "*movdi_nofix"
5526 [(set (match_operand:DI 0 "nonimmediate_operand" "=r,r,r,r,r,r,m,*f,*f,Q")
5527 (match_operand:DI 1 "input_operand" "rJ,K,L,U,s,m,rJ,*fJ,Q,*f"))]
5529 && (register_operand (operands[0], DImode)
5530 || reg_or_0_operand (operands[1], DImode))"
5535 laum %0,%t1($31)\;sll %0,32,%0\;lalm %0,%t1(%0)\;lal %0,%t1(%0)
5542 [(set_attr "type" "ilog,iadd,iadd,ldsym,ldsym,ild,ist,fcpys,fld,fst")
5543 (set_attr "length" "*,*,*,16,*,*,*,*,*,*")])
5545 (define_insn "*movdi_er_fix"
5546 [(set (match_operand:DI 0 "nonimmediate_operand"
5547 "=r,r,r,r,r,r, m, *f,*f, Q, r,*f")
5548 (match_operand:DI 1 "input_operand"
5549 "rJ,K,L,T,s,m,rJ,*fJ, Q,*f,*f, r"))]
5550 "TARGET_EXPLICIT_RELOCS && TARGET_FIX
5551 && (register_operand (operands[0], DImode)
5552 || reg_or_0_operand (operands[1], DImode))"
5566 [(set_attr "type" "ilog,iadd,iadd,iadd,ldsym,ild,ist,fcpys,fld,fst,ftoi,itof")
5567 (set_attr "usegp" "*,*,*,yes,*,*,*,*,*,*,*,*")])
5569 (define_insn "*movdi_fix"
5570 [(set (match_operand:DI 0 "nonimmediate_operand" "=r,r,r,r,r,m,*f,*f,Q,r,*f")
5571 (match_operand:DI 1 "input_operand" "rJ,K,L,s,m,rJ,*fJ,Q,*f,*f,r"))]
5572 "! TARGET_EXPLICIT_RELOCS && TARGET_FIX
5573 && (register_operand (operands[0], DImode)
5574 || reg_or_0_operand (operands[1], DImode))"
5587 [(set_attr "type" "ilog,iadd,iadd,ldsym,ild,ist,fcpys,fld,fst,ftoi,itof")])
5589 ;; VMS needs to set up "vms_base_regno" for unwinding. This move
5590 ;; often appears dead to the life analysis code, at which point we
5591 ;; abort for emitting dead prologue instructions. Force this live.
5593 (define_insn "force_movdi"
5594 [(set (match_operand:DI 0 "register_operand" "=r")
5595 (unspec_volatile:DI [(match_operand:DI 1 "register_operand" "r")]
5596 UNSPECV_FORCE_MOV))]
5599 [(set_attr "type" "ilog")])
5601 ;; We do three major things here: handle mem->mem, put 64-bit constants in
5602 ;; memory, and construct long 32-bit constants.
5604 (define_expand "movdi"
5605 [(set (match_operand:DI 0 "nonimmediate_operand" "")
5606 (match_operand:DI 1 "general_operand" ""))]
5609 if (alpha_expand_mov (DImode, operands))
5613 ;; Split a load of a large constant into the appropriate two-insn
5617 [(set (match_operand:DI 0 "register_operand" "")
5618 (match_operand:DI 1 "const_int_operand" ""))]
5619 "! add_operand (operands[1], DImode)"
5620 [(set (match_dup 0) (match_dup 2))
5621 (set (match_dup 0) (plus:DI (match_dup 0) (match_dup 3)))]
5624 = alpha_emit_set_const (operands[0], DImode, INTVAL (operands[1]), 2);
5626 if (tem == operands[0])
5632 ;; These are the partial-word cases.
5634 ;; First we have the code to load an aligned word. Operand 0 is the register
5635 ;; in which to place the result. It's mode is QImode or HImode. Operand 1
5636 ;; is an SImode MEM at the low-order byte of the proper word. Operand 2 is the
5637 ;; number of bits within the word that the value is. Operand 3 is an SImode
5638 ;; scratch register. If operand 0 is a hard register, operand 3 may be the
5639 ;; same register. It is allowed to conflict with operand 1 as well.
5641 (define_expand "aligned_loadqi"
5642 [(set (match_operand:SI 3 "register_operand" "")
5643 (match_operand:SI 1 "memory_operand" ""))
5644 (set (subreg:DI (match_operand:QI 0 "register_operand" "") 0)
5645 (zero_extract:DI (subreg:DI (match_dup 3) 0)
5647 (match_operand:DI 2 "const_int_operand" "")))]
5652 (define_expand "aligned_loadhi"
5653 [(set (match_operand:SI 3 "register_operand" "")
5654 (match_operand:SI 1 "memory_operand" ""))
5655 (set (subreg:DI (match_operand:HI 0 "register_operand" "") 0)
5656 (zero_extract:DI (subreg:DI (match_dup 3) 0)
5658 (match_operand:DI 2 "const_int_operand" "")))]
5663 ;; Similar for unaligned loads, where we use the sequence from the
5664 ;; Alpha Architecture manual. We have to distinguish between little-endian
5665 ;; and big-endian systems as the sequences are different.
5667 ;; Operand 1 is the address. Operands 2 and 3 are temporaries, where
5668 ;; operand 3 can overlap the input and output registers.
5670 (define_expand "unaligned_loadqi"
5671 [(use (match_operand:QI 0 "register_operand" ""))
5672 (use (match_operand:DI 1 "address_operand" ""))
5673 (use (match_operand:DI 2 "register_operand" ""))
5674 (use (match_operand:DI 3 "register_operand" ""))]
5677 if (WORDS_BIG_ENDIAN)
5678 emit_insn (gen_unaligned_loadqi_be (operands[0], operands[1],
5679 operands[2], operands[3]));
5681 emit_insn (gen_unaligned_loadqi_le (operands[0], operands[1],
5682 operands[2], operands[3]));
5686 (define_expand "unaligned_loadqi_le"
5687 [(set (match_operand:DI 2 "register_operand" "")
5688 (mem:DI (and:DI (match_operand:DI 1 "address_operand" "")
5690 (set (match_operand:DI 3 "register_operand" "")
5692 (set (subreg:DI (match_operand:QI 0 "register_operand" "") 0)
5693 (zero_extract:DI (match_dup 2)
5695 (ashift:DI (match_dup 3) (const_int 3))))]
5696 "! WORDS_BIG_ENDIAN"
5699 (define_expand "unaligned_loadqi_be"
5700 [(set (match_operand:DI 2 "register_operand" "")
5701 (mem:DI (and:DI (match_operand:DI 1 "address_operand" "")
5703 (set (match_operand:DI 3 "register_operand" "")
5705 (set (subreg:DI (match_operand:QI 0 "register_operand" "") 0)
5706 (zero_extract:DI (match_dup 2)
5710 (ashift:DI (match_dup 3) (const_int 3)))))]
5714 (define_expand "unaligned_loadhi"
5715 [(use (match_operand:QI 0 "register_operand" ""))
5716 (use (match_operand:DI 1 "address_operand" ""))
5717 (use (match_operand:DI 2 "register_operand" ""))
5718 (use (match_operand:DI 3 "register_operand" ""))]
5721 if (WORDS_BIG_ENDIAN)
5722 emit_insn (gen_unaligned_loadhi_be (operands[0], operands[1],
5723 operands[2], operands[3]));
5725 emit_insn (gen_unaligned_loadhi_le (operands[0], operands[1],
5726 operands[2], operands[3]));
5730 (define_expand "unaligned_loadhi_le"
5731 [(set (match_operand:DI 2 "register_operand" "")
5732 (mem:DI (and:DI (match_operand:DI 1 "address_operand" "")
5734 (set (match_operand:DI 3 "register_operand" "")
5736 (set (subreg:DI (match_operand:QI 0 "register_operand" "") 0)
5737 (zero_extract:DI (match_dup 2)
5739 (ashift:DI (match_dup 3) (const_int 3))))]
5740 "! WORDS_BIG_ENDIAN"
5743 (define_expand "unaligned_loadhi_be"
5744 [(set (match_operand:DI 2 "register_operand" "")
5745 (mem:DI (and:DI (match_operand:DI 1 "address_operand" "")
5747 (set (match_operand:DI 3 "register_operand" "")
5748 (plus:DI (match_dup 1) (const_int 1)))
5749 (set (subreg:DI (match_operand:QI 0 "register_operand" "") 0)
5750 (zero_extract:DI (match_dup 2)
5754 (ashift:DI (match_dup 3) (const_int 3)))))]
5758 ;; Storing an aligned byte or word requires two temporaries. Operand 0 is the
5759 ;; aligned SImode MEM. Operand 1 is the register containing the
5760 ;; byte or word to store. Operand 2 is the number of bits within the word that
5761 ;; the value should be placed. Operands 3 and 4 are SImode temporaries.
5763 (define_expand "aligned_store"
5764 [(set (match_operand:SI 3 "register_operand" "")
5765 (match_operand:SI 0 "memory_operand" ""))
5766 (set (subreg:DI (match_dup 3) 0)
5767 (and:DI (subreg:DI (match_dup 3) 0) (match_dup 5)))
5768 (set (subreg:DI (match_operand:SI 4 "register_operand" "") 0)
5769 (ashift:DI (zero_extend:DI (match_operand 1 "register_operand" ""))
5770 (match_operand:DI 2 "const_int_operand" "")))
5771 (set (subreg:DI (match_dup 4) 0)
5772 (ior:DI (subreg:DI (match_dup 4) 0) (subreg:DI (match_dup 3) 0)))
5773 (set (match_dup 0) (match_dup 4))]
5776 operands[5] = GEN_INT (~ (GET_MODE_MASK (GET_MODE (operands[1]))
5777 << INTVAL (operands[2])));
5780 ;; For the unaligned byte and halfword cases, we use code similar to that
5781 ;; in the ;; Architecture book, but reordered to lower the number of registers
5782 ;; required. Operand 0 is the address. Operand 1 is the data to store.
5783 ;; Operands 2, 3, and 4 are DImode temporaries, where operands 2 and 4 may
5784 ;; be the same temporary, if desired. If the address is in a register,
5785 ;; operand 2 can be that register.
5787 (define_expand "unaligned_storeqi"
5788 [(use (match_operand:DI 0 "address_operand" ""))
5789 (use (match_operand:QI 1 "register_operand" ""))
5790 (use (match_operand:DI 2 "register_operand" ""))
5791 (use (match_operand:DI 3 "register_operand" ""))
5792 (use (match_operand:DI 4 "register_operand" ""))]
5795 if (WORDS_BIG_ENDIAN)
5796 emit_insn (gen_unaligned_storeqi_be (operands[0], operands[1],
5797 operands[2], operands[3],
5800 emit_insn (gen_unaligned_storeqi_le (operands[0], operands[1],
5801 operands[2], operands[3],
5806 (define_expand "unaligned_storeqi_le"
5807 [(set (match_operand:DI 3 "register_operand" "")
5808 (mem:DI (and:DI (match_operand:DI 0 "address_operand" "")
5810 (set (match_operand:DI 2 "register_operand" "")
5813 (and:DI (not:DI (ashift:DI (const_int 255)
5814 (ashift:DI (match_dup 2) (const_int 3))))
5816 (set (match_operand:DI 4 "register_operand" "")
5817 (ashift:DI (zero_extend:DI (match_operand:QI 1 "register_operand" ""))
5818 (ashift:DI (match_dup 2) (const_int 3))))
5819 (set (match_dup 4) (ior:DI (match_dup 4) (match_dup 3)))
5820 (set (mem:DI (and:DI (match_dup 0) (const_int -8)))
5822 "! WORDS_BIG_ENDIAN"
5825 (define_expand "unaligned_storeqi_be"
5826 [(set (match_operand:DI 3 "register_operand" "")
5827 (mem:DI (and:DI (match_operand:DI 0 "address_operand" "")
5829 (set (match_operand:DI 2 "register_operand" "")
5832 (and:DI (not:DI (ashift:DI (const_int 255)
5833 (minus:DI (const_int 56)
5834 (ashift:DI (match_dup 2) (const_int 3)))))
5836 (set (match_operand:DI 4 "register_operand" "")
5837 (ashift:DI (zero_extend:DI (match_operand:QI 1 "register_operand" ""))
5838 (minus:DI (const_int 56)
5839 (ashift:DI (match_dup 2) (const_int 3)))))
5840 (set (match_dup 4) (ior:DI (match_dup 4) (match_dup 3)))
5841 (set (mem:DI (and:DI (match_dup 0) (const_int -8)))
5846 (define_expand "unaligned_storehi"
5847 [(use (match_operand:DI 0 "address_operand" ""))
5848 (use (match_operand:HI 1 "register_operand" ""))
5849 (use (match_operand:DI 2 "register_operand" ""))
5850 (use (match_operand:DI 3 "register_operand" ""))
5851 (use (match_operand:DI 4 "register_operand" ""))]
5854 if (WORDS_BIG_ENDIAN)
5855 emit_insn (gen_unaligned_storehi_be (operands[0], operands[1],
5856 operands[2], operands[3],
5859 emit_insn (gen_unaligned_storehi_le (operands[0], operands[1],
5860 operands[2], operands[3],
5865 (define_expand "unaligned_storehi_le"
5866 [(set (match_operand:DI 3 "register_operand" "")
5867 (mem:DI (and:DI (match_operand:DI 0 "address_operand" "")
5869 (set (match_operand:DI 2 "register_operand" "")
5872 (and:DI (not:DI (ashift:DI (const_int 65535)
5873 (ashift:DI (match_dup 2) (const_int 3))))
5875 (set (match_operand:DI 4 "register_operand" "")
5876 (ashift:DI (zero_extend:DI (match_operand:HI 1 "register_operand" ""))
5877 (ashift:DI (match_dup 2) (const_int 3))))
5878 (set (match_dup 4) (ior:DI (match_dup 4) (match_dup 3)))
5879 (set (mem:DI (and:DI (match_dup 0) (const_int -8)))
5881 "! WORDS_BIG_ENDIAN"
5884 (define_expand "unaligned_storehi_be"
5885 [(set (match_operand:DI 3 "register_operand" "")
5886 (mem:DI (and:DI (match_operand:DI 0 "address_operand" "")
5888 (set (match_operand:DI 2 "register_operand" "")
5889 (plus:DI (match_dup 0) (const_int 1)))
5891 (and:DI (not:DI (ashift:DI
5893 (minus:DI (const_int 56)
5894 (ashift:DI (match_dup 2) (const_int 3)))))
5896 (set (match_operand:DI 4 "register_operand" "")
5897 (ashift:DI (zero_extend:DI (match_operand:HI 1 "register_operand" ""))
5898 (minus:DI (const_int 56)
5899 (ashift:DI (match_dup 2) (const_int 3)))))
5900 (set (match_dup 4) (ior:DI (match_dup 4) (match_dup 3)))
5901 (set (mem:DI (and:DI (match_dup 0) (const_int -8)))
5906 ;; Here are the define_expand's for QI and HI moves that use the above
5907 ;; patterns. We have the normal sets, plus the ones that need scratch
5908 ;; registers for reload.
5910 (define_expand "movqi"
5911 [(set (match_operand:QI 0 "nonimmediate_operand" "")
5912 (match_operand:QI 1 "general_operand" ""))]
5916 ? alpha_expand_mov (QImode, operands)
5917 : alpha_expand_mov_nobwx (QImode, operands))
5921 (define_expand "movhi"
5922 [(set (match_operand:HI 0 "nonimmediate_operand" "")
5923 (match_operand:HI 1 "general_operand" ""))]
5927 ? alpha_expand_mov (HImode, operands)
5928 : alpha_expand_mov_nobwx (HImode, operands))
5932 ;; Here are the versions for reload. Note that in the unaligned cases
5933 ;; we know that the operand must not be a pseudo-register because stack
5934 ;; slots are always aligned references.
5936 (define_expand "reload_inqi"
5937 [(parallel [(match_operand:QI 0 "register_operand" "=r")
5938 (match_operand:QI 1 "any_memory_operand" "m")
5939 (match_operand:TI 2 "register_operand" "=&r")])]
5944 if (GET_CODE (operands[1]) != MEM)
5947 if (aligned_memory_operand (operands[1], QImode))
5949 seq = gen_reload_inqi_help (operands[0], operands[1],
5950 gen_rtx_REG (SImode, REGNO (operands[2])));
5956 /* It is possible that one of the registers we got for operands[2]
5957 might coincide with that of operands[0] (which is why we made
5958 it TImode). Pick the other one to use as our scratch. */
5959 if (REGNO (operands[0]) == REGNO (operands[2]))
5960 scratch = gen_rtx_REG (DImode, REGNO (operands[2]) + 1);
5962 scratch = gen_rtx_REG (DImode, REGNO (operands[2]));
5964 addr = get_unaligned_address (operands[1], 0);
5965 seq = gen_unaligned_loadqi (operands[0], addr, scratch,
5966 gen_rtx_REG (DImode, REGNO (operands[0])));
5967 alpha_set_memflags (seq, operands[1]);
5973 (define_expand "reload_inhi"
5974 [(parallel [(match_operand:HI 0 "register_operand" "=r")
5975 (match_operand:HI 1 "any_memory_operand" "m")
5976 (match_operand:TI 2 "register_operand" "=&r")])]
5981 if (GET_CODE (operands[1]) != MEM)
5984 if (aligned_memory_operand (operands[1], HImode))
5986 seq = gen_reload_inhi_help (operands[0], operands[1],
5987 gen_rtx_REG (SImode, REGNO (operands[2])));
5993 /* It is possible that one of the registers we got for operands[2]
5994 might coincide with that of operands[0] (which is why we made
5995 it TImode). Pick the other one to use as our scratch. */
5996 if (REGNO (operands[0]) == REGNO (operands[2]))
5997 scratch = gen_rtx_REG (DImode, REGNO (operands[2]) + 1);
5999 scratch = gen_rtx_REG (DImode, REGNO (operands[2]));
6001 addr = get_unaligned_address (operands[1], 0);
6002 seq = gen_unaligned_loadhi (operands[0], addr, scratch,
6003 gen_rtx_REG (DImode, REGNO (operands[0])));
6004 alpha_set_memflags (seq, operands[1]);
6010 (define_expand "reload_outqi"
6011 [(parallel [(match_operand:QI 0 "any_memory_operand" "=m")
6012 (match_operand:QI 1 "register_operand" "r")
6013 (match_operand:TI 2 "register_operand" "=&r")])]
6016 if (GET_CODE (operands[0]) != MEM)
6019 if (aligned_memory_operand (operands[0], QImode))
6021 emit_insn (gen_reload_outqi_help
6022 (operands[0], operands[1],
6023 gen_rtx_REG (SImode, REGNO (operands[2])),
6024 gen_rtx_REG (SImode, REGNO (operands[2]) + 1)));
6028 rtx addr = get_unaligned_address (operands[0], 0);
6029 rtx scratch1 = gen_rtx_REG (DImode, REGNO (operands[2]));
6030 rtx scratch2 = gen_rtx_REG (DImode, REGNO (operands[2]) + 1);
6031 rtx scratch3 = scratch1;
6034 if (GET_CODE (addr) == REG)
6037 seq = gen_unaligned_storeqi (addr, operands[1], scratch1,
6038 scratch2, scratch3);
6039 alpha_set_memflags (seq, operands[0]);
6045 (define_expand "reload_outhi"
6046 [(parallel [(match_operand:HI 0 "any_memory_operand" "=m")
6047 (match_operand:HI 1 "register_operand" "r")
6048 (match_operand:TI 2 "register_operand" "=&r")])]
6051 if (GET_CODE (operands[0]) != MEM)
6054 if (aligned_memory_operand (operands[0], HImode))
6056 emit_insn (gen_reload_outhi_help
6057 (operands[0], operands[1],
6058 gen_rtx_REG (SImode, REGNO (operands[2])),
6059 gen_rtx_REG (SImode, REGNO (operands[2]) + 1)));
6063 rtx addr = get_unaligned_address (operands[0], 0);
6064 rtx scratch1 = gen_rtx_REG (DImode, REGNO (operands[2]));
6065 rtx scratch2 = gen_rtx_REG (DImode, REGNO (operands[2]) + 1);
6066 rtx scratch3 = scratch1;
6069 if (GET_CODE (addr) == REG)
6072 seq = gen_unaligned_storehi (addr, operands[1], scratch1,
6073 scratch2, scratch3);
6074 alpha_set_memflags (seq, operands[0]);
6080 ;; Helpers for the above. The way reload is structured, we can't
6081 ;; always get a proper address for a stack slot during reload_foo
6082 ;; expansion, so we must delay our address manipulations until after.
6084 (define_insn "reload_inqi_help"
6085 [(set (match_operand:QI 0 "register_operand" "=r")
6086 (match_operand:QI 1 "memory_operand" "m"))
6087 (clobber (match_operand:SI 2 "register_operand" "=r"))]
6088 "! TARGET_BWX && (reload_in_progress || reload_completed)"
6091 (define_insn "reload_inhi_help"
6092 [(set (match_operand:HI 0 "register_operand" "=r")
6093 (match_operand:HI 1 "memory_operand" "m"))
6094 (clobber (match_operand:SI 2 "register_operand" "=r"))]
6095 "! TARGET_BWX && (reload_in_progress || reload_completed)"
6098 (define_insn "reload_outqi_help"
6099 [(set (match_operand:QI 0 "memory_operand" "=m")
6100 (match_operand:QI 1 "register_operand" "r"))
6101 (clobber (match_operand:SI 2 "register_operand" "=r"))
6102 (clobber (match_operand:SI 3 "register_operand" "=r"))]
6103 "! TARGET_BWX && (reload_in_progress || reload_completed)"
6106 (define_insn "reload_outhi_help"
6107 [(set (match_operand:HI 0 "memory_operand" "=m")
6108 (match_operand:HI 1 "register_operand" "r"))
6109 (clobber (match_operand:SI 2 "register_operand" "=r"))
6110 (clobber (match_operand:SI 3 "register_operand" "=r"))]
6111 "! TARGET_BWX && (reload_in_progress || reload_completed)"
6115 [(set (match_operand:QI 0 "register_operand" "")
6116 (match_operand:QI 1 "memory_operand" ""))
6117 (clobber (match_operand:SI 2 "register_operand" ""))]
6118 "! TARGET_BWX && reload_completed"
6121 rtx aligned_mem, bitnum;
6122 get_aligned_mem (operands[1], &aligned_mem, &bitnum);
6124 emit_insn (gen_aligned_loadqi (operands[0], aligned_mem, bitnum,
6130 [(set (match_operand:HI 0 "register_operand" "")
6131 (match_operand:HI 1 "memory_operand" ""))
6132 (clobber (match_operand:SI 2 "register_operand" ""))]
6133 "! TARGET_BWX && reload_completed"
6136 rtx aligned_mem, bitnum;
6137 get_aligned_mem (operands[1], &aligned_mem, &bitnum);
6139 emit_insn (gen_aligned_loadhi (operands[0], aligned_mem, bitnum,
6145 [(set (match_operand:QI 0 "memory_operand" "")
6146 (match_operand:QI 1 "register_operand" ""))
6147 (clobber (match_operand:SI 2 "register_operand" ""))
6148 (clobber (match_operand:SI 3 "register_operand" ""))]
6149 "! TARGET_BWX && reload_completed"
6152 rtx aligned_mem, bitnum;
6153 get_aligned_mem (operands[0], &aligned_mem, &bitnum);
6154 emit_insn (gen_aligned_store (aligned_mem, operands[1], bitnum,
6155 operands[2], operands[3]));
6160 [(set (match_operand:HI 0 "memory_operand" "")
6161 (match_operand:HI 1 "register_operand" ""))
6162 (clobber (match_operand:SI 2 "register_operand" ""))
6163 (clobber (match_operand:SI 3 "register_operand" ""))]
6164 "! TARGET_BWX && reload_completed"
6167 rtx aligned_mem, bitnum;
6168 get_aligned_mem (operands[0], &aligned_mem, &bitnum);
6169 emit_insn (gen_aligned_store (aligned_mem, operands[1], bitnum,
6170 operands[2], operands[3]));
6174 ;; Vector operations
6176 (define_expand "movv8qi"
6177 [(set (match_operand:V8QI 0 "nonimmediate_operand" "")
6178 (match_operand:V8QI 1 "general_operand" ""))]
6181 if (alpha_expand_mov (V8QImode, operands))
6185 (define_insn "*movv8qi_fix"
6186 [(set (match_operand:V8QI 0 "nonimmediate_operand" "=r,r,m,*f,*f,m,r,*f")
6187 (match_operand:V8QI 1 "input_operand" "rW,m,rW,*fW,m,*f,*f,r"))]
6189 && (register_operand (operands[0], V8QImode)
6190 || reg_or_0_operand (operands[1], V8QImode))"
6200 [(set_attr "type" "ilog,ild,ist,fcpys,fld,fst,ftoi,itof")])
6202 (define_insn "*movv8qi_nofix"
6203 [(set (match_operand:V8QI 0 "nonimmediate_operand" "=r,r,m,*f,*f,m")
6204 (match_operand:V8QI 1 "input_operand" "rW,m,rW,*fW,m,*f"))]
6206 && (register_operand (operands[0], V8QImode)
6207 || reg_or_0_operand (operands[1], V8QImode))"
6215 [(set_attr "type" "ilog,ild,ist,fcpys,fld,fst")])
6217 (define_expand "movv4hi"
6218 [(set (match_operand:V4HI 0 "nonimmediate_operand" "")
6219 (match_operand:V4HI 1 "general_operand" ""))]
6222 if (alpha_expand_mov (V4HImode, operands))
6226 (define_insn "*movv4hi_fix"
6227 [(set (match_operand:V4HI 0 "nonimmediate_operand" "=r,r,m,*f,*f,m,r,*f")
6228 (match_operand:V4HI 1 "input_operand" "rW,m,rW,*fW,m,*f,*f,r"))]
6230 && (register_operand (operands[0], V4HImode)
6231 || reg_or_0_operand (operands[1], V4HImode))"
6241 [(set_attr "type" "ilog,ild,ist,fcpys,fld,fst,ftoi,itof")])
6243 (define_insn "*movv4hi_nofix"
6244 [(set (match_operand:V4HI 0 "nonimmediate_operand" "=r,r,m,*f,*f,m")
6245 (match_operand:V4HI 1 "input_operand" "rW,m,rW,*fW,m,*f"))]
6247 && (register_operand (operands[0], V4HImode)
6248 || reg_or_0_operand (operands[1], V4HImode))"
6256 [(set_attr "type" "ilog,ild,ist,fcpys,fld,fst")])
6258 (define_expand "movv2si"
6259 [(set (match_operand:V2SI 0 "nonimmediate_operand" "")
6260 (match_operand:V2SI 1 "general_operand" ""))]
6263 if (alpha_expand_mov (V2SImode, operands))
6267 (define_insn "*movv2si_fix"
6268 [(set (match_operand:V2SI 0 "nonimmediate_operand" "=r,r,m,*f,*f,m,r,*f")
6269 (match_operand:V2SI 1 "input_operand" "rW,m,rW,*fW,m,*f,*f,r"))]
6271 && (register_operand (operands[0], V2SImode)
6272 || reg_or_0_operand (operands[1], V2SImode))"
6282 [(set_attr "type" "ilog,ild,ist,fcpys,fld,fst,ftoi,itof")])
6284 (define_insn "*movv2si_nofix"
6285 [(set (match_operand:V2SI 0 "nonimmediate_operand" "=r,r,m,*f,*f,m")
6286 (match_operand:V2SI 1 "input_operand" "rW,m,rW,*fW,m,*f"))]
6288 && (register_operand (operands[0], V2SImode)
6289 || reg_or_0_operand (operands[1], V2SImode))"
6297 [(set_attr "type" "ilog,ild,ist,fcpys,fld,fst")])
6299 (define_insn "uminv8qi3"
6300 [(set (match_operand:V8QI 0 "register_operand" "=r")
6301 (umin:V8QI (match_operand:V8QI 1 "reg_or_0_operand" "rW")
6302 (match_operand:V8QI 2 "reg_or_0_operand" "rW")))]
6305 [(set_attr "type" "mvi")])
6307 (define_insn "sminv8qi3"
6308 [(set (match_operand:V8QI 0 "register_operand" "=r")
6309 (smin:V8QI (match_operand:V8QI 1 "reg_or_0_operand" "rW")
6310 (match_operand:V8QI 2 "reg_or_0_operand" "rW")))]
6313 [(set_attr "type" "mvi")])
6315 (define_insn "uminv4hi3"
6316 [(set (match_operand:V4HI 0 "register_operand" "=r")
6317 (umin:V4HI (match_operand:V4HI 1 "reg_or_0_operand" "rW")
6318 (match_operand:V4HI 2 "reg_or_0_operand" "rW")))]
6321 [(set_attr "type" "mvi")])
6323 (define_insn "sminv4hi3"
6324 [(set (match_operand:V4HI 0 "register_operand" "=r")
6325 (smin:V4HI (match_operand:V4HI 1 "reg_or_0_operand" "rW")
6326 (match_operand:V4HI 2 "reg_or_0_operand" "rW")))]
6329 [(set_attr "type" "mvi")])
6331 (define_insn "umaxv8qi3"
6332 [(set (match_operand:V8QI 0 "register_operand" "=r")
6333 (umax:V8QI (match_operand:V8QI 1 "reg_or_0_operand" "rW")
6334 (match_operand:V8QI 2 "reg_or_0_operand" "rW")))]
6337 [(set_attr "type" "mvi")])
6339 (define_insn "smaxv8qi3"
6340 [(set (match_operand:V8QI 0 "register_operand" "=r")
6341 (smax:V8QI (match_operand:V8QI 1 "reg_or_0_operand" "rW")
6342 (match_operand:V8QI 2 "reg_or_0_operand" "rW")))]
6345 [(set_attr "type" "mvi")])
6347 (define_insn "umaxv4hi3"
6348 [(set (match_operand:V4HI 0 "register_operand" "=r")
6349 (umax:V4HI (match_operand:V4HI 1 "reg_or_0_operand" "rW")
6350 (match_operand:V4HI 2 "reg_or_0_operand" "rW")))]
6353 [(set_attr "type" "mvi")])
6355 (define_insn "smaxv4hi3"
6356 [(set (match_operand:V4HI 0 "register_operand" "=r")
6357 (smax:V4HI (match_operand:V4HI 1 "reg_or_0_operand" "rW")
6358 (match_operand:V4HI 2 "reg_or_0_operand" "rW")))]
6361 [(set_attr "type" "mvi")])
6363 ;; Bit field extract patterns which use ext[wlq][lh]
6365 (define_expand "extv"
6366 [(set (match_operand:DI 0 "register_operand" "")
6367 (sign_extract:DI (match_operand:QI 1 "memory_operand" "")
6368 (match_operand:DI 2 "immediate_operand" "")
6369 (match_operand:DI 3 "immediate_operand" "")))]
6374 /* We can do 16, 32 and 64 bit fields, if aligned on byte boundaries. */
6375 if (INTVAL (operands[3]) % 8 != 0
6376 || (INTVAL (operands[2]) != 16
6377 && INTVAL (operands[2]) != 32
6378 && INTVAL (operands[2]) != 64))
6381 /* From mips.md: extract_bit_field doesn't verify that our source
6382 matches the predicate, so we force it to be a MEM here. */
6383 if (GET_CODE (operands[1]) != MEM)
6386 /* The bit number is relative to the mode of operand 1 which is
6387 usually QImode (this might actually be a bug in expmed.c). Note
6388 that the bit number is negative in big-endian mode in this case.
6389 We have to convert that to the offset. */
6390 if (WORDS_BIG_ENDIAN)
6391 ofs = GET_MODE_BITSIZE (GET_MODE (operands[1]))
6392 - INTVAL (operands[2]) - INTVAL (operands[3]);
6394 ofs = INTVAL (operands[3]);
6398 alpha_expand_unaligned_load (operands[0], operands[1],
6399 INTVAL (operands[2]) / 8,
6404 (define_expand "extzv"
6405 [(set (match_operand:DI 0 "register_operand" "")
6406 (zero_extract:DI (match_operand:DI 1 "nonimmediate_operand" "")
6407 (match_operand:DI 2 "immediate_operand" "")
6408 (match_operand:DI 3 "immediate_operand" "")))]
6411 /* We can do 8, 16, 32 and 64 bit fields, if aligned on byte boundaries. */
6412 if (INTVAL (operands[3]) % 8 != 0
6413 || (INTVAL (operands[2]) != 8
6414 && INTVAL (operands[2]) != 16
6415 && INTVAL (operands[2]) != 32
6416 && INTVAL (operands[2]) != 64))
6419 if (GET_CODE (operands[1]) == MEM)
6423 /* Fail 8 bit fields, falling back on a simple byte load. */
6424 if (INTVAL (operands[2]) == 8)
6427 /* The bit number is relative to the mode of operand 1 which is
6428 usually QImode (this might actually be a bug in expmed.c). Note
6429 that the bit number is negative in big-endian mode in this case.
6430 We have to convert that to the offset. */
6431 if (WORDS_BIG_ENDIAN)
6432 ofs = GET_MODE_BITSIZE (GET_MODE (operands[1]))
6433 - INTVAL (operands[2]) - INTVAL (operands[3]);
6435 ofs = INTVAL (operands[3]);
6439 alpha_expand_unaligned_load (operands[0], operands[1],
6440 INTVAL (operands[2]) / 8,
6446 (define_expand "insv"
6447 [(set (zero_extract:DI (match_operand:QI 0 "memory_operand" "")
6448 (match_operand:DI 1 "immediate_operand" "")
6449 (match_operand:DI 2 "immediate_operand" ""))
6450 (match_operand:DI 3 "register_operand" ""))]
6455 /* We can do 16, 32 and 64 bit fields, if aligned on byte boundaries. */
6456 if (INTVAL (operands[2]) % 8 != 0
6457 || (INTVAL (operands[1]) != 16
6458 && INTVAL (operands[1]) != 32
6459 && INTVAL (operands[1]) != 64))
6462 /* From mips.md: store_bit_field doesn't verify that our source
6463 matches the predicate, so we force it to be a MEM here. */
6464 if (GET_CODE (operands[0]) != MEM)
6467 /* The bit number is relative to the mode of operand 1 which is
6468 usually QImode (this might actually be a bug in expmed.c). Note
6469 that the bit number is negative in big-endian mode in this case.
6470 We have to convert that to the offset. */
6471 if (WORDS_BIG_ENDIAN)
6472 ofs = GET_MODE_BITSIZE (GET_MODE (operands[0]))
6473 - INTVAL (operands[1]) - INTVAL (operands[2]);
6475 ofs = INTVAL (operands[2]);
6479 alpha_expand_unaligned_store (operands[0], operands[3],
6480 INTVAL (operands[1]) / 8, ofs);
6484 ;; Block move/clear, see alpha.c for more details.
6485 ;; Argument 0 is the destination
6486 ;; Argument 1 is the source
6487 ;; Argument 2 is the length
6488 ;; Argument 3 is the alignment
6490 (define_expand "movstrqi"
6491 [(parallel [(set (match_operand:BLK 0 "memory_operand" "")
6492 (match_operand:BLK 1 "memory_operand" ""))
6493 (use (match_operand:DI 2 "immediate_operand" ""))
6494 (use (match_operand:DI 3 "immediate_operand" ""))])]
6497 if (alpha_expand_block_move (operands))
6503 (define_expand "movstrdi"
6504 [(parallel [(set (match_operand:BLK 0 "memory_operand" "")
6505 (match_operand:BLK 1 "memory_operand" ""))
6506 (use (match_operand:DI 2 "immediate_operand" ""))
6507 (use (match_operand:DI 3 "immediate_operand" ""))
6509 (clobber (reg:DI 25))
6510 (clobber (reg:DI 16))
6511 (clobber (reg:DI 17))
6512 (clobber (reg:DI 18))
6513 (clobber (reg:DI 19))
6514 (clobber (reg:DI 20))
6515 (clobber (reg:DI 26))
6516 (clobber (reg:DI 27))])]
6517 "TARGET_ABI_OPEN_VMS"
6519 operands[4] = gen_rtx_SYMBOL_REF (Pmode, "OTS$MOVE");
6520 alpha_need_linkage (XSTR (operands[4], 0), 0);
6523 (define_insn "*movstrdi_1"
6524 [(set (match_operand:BLK 0 "memory_operand" "=m,=m")
6525 (match_operand:BLK 1 "memory_operand" "m,m"))
6526 (use (match_operand:DI 2 "nonmemory_operand" "r,i"))
6527 (use (match_operand:DI 3 "immediate_operand" ""))
6528 (use (match_operand:DI 4 "call_operand" "i,i"))
6529 (clobber (reg:DI 25))
6530 (clobber (reg:DI 16))
6531 (clobber (reg:DI 17))
6532 (clobber (reg:DI 18))
6533 (clobber (reg:DI 19))
6534 (clobber (reg:DI 20))
6535 (clobber (reg:DI 26))
6536 (clobber (reg:DI 27))]
6537 "TARGET_ABI_OPEN_VMS"
6539 operands [5] = alpha_use_linkage (operands [4], cfun->decl, 0, 1);
6540 switch (which_alternative)
6543 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)";
6545 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)";
6550 [(set_attr "type" "multi")
6551 (set_attr "length" "28")])
6553 (define_expand "clrstrqi"
6554 [(parallel [(set (match_operand:BLK 0 "memory_operand" "")
6556 (use (match_operand:DI 1 "immediate_operand" ""))
6557 (use (match_operand:DI 2 "immediate_operand" ""))])]
6560 if (alpha_expand_block_clear (operands))
6566 (define_expand "clrstrdi"
6567 [(parallel [(set (match_operand:BLK 0 "memory_operand" "")
6569 (use (match_operand:DI 1 "immediate_operand" ""))
6570 (use (match_operand:DI 2 "immediate_operand" ""))
6572 (clobber (reg:DI 25))
6573 (clobber (reg:DI 16))
6574 (clobber (reg:DI 17))
6575 (clobber (reg:DI 26))
6576 (clobber (reg:DI 27))])]
6577 "TARGET_ABI_OPEN_VMS"
6579 operands[3] = gen_rtx_SYMBOL_REF (Pmode, "OTS$ZERO");
6580 alpha_need_linkage (XSTR (operands[3], 0), 0);
6583 (define_insn "*clrstrdi_1"
6584 [(set (match_operand:BLK 0 "memory_operand" "=m,=m")
6586 (use (match_operand:DI 1 "nonmemory_operand" "r,i"))
6587 (use (match_operand:DI 2 "immediate_operand" ""))
6588 (use (match_operand:DI 3 "call_operand" "i,i"))
6589 (clobber (reg:DI 25))
6590 (clobber (reg:DI 16))
6591 (clobber (reg:DI 17))
6592 (clobber (reg:DI 26))
6593 (clobber (reg:DI 27))]
6594 "TARGET_ABI_OPEN_VMS"
6596 operands [4] = alpha_use_linkage (operands [3], cfun->decl, 0, 1);
6597 switch (which_alternative)
6600 return "lda $16,%0\;bis $31,%1,$17\;ldq $26,%4\;lda $25,2($31)\;jsr $26,%3\;ldq $27,0($29)";
6602 return "lda $16,%0\;lda $17,%1($31)\;ldq $26,%4\;lda $25,2($31)\;jsr $26,%3\;ldq $27,0($29)";
6607 [(set_attr "type" "multi")
6608 (set_attr "length" "24")])
6611 ;; Subroutine of stack space allocation. Perform a stack probe.
6612 (define_expand "probe_stack"
6613 [(set (match_dup 1) (match_operand:DI 0 "const_int_operand" ""))]
6616 operands[1] = gen_rtx_MEM (DImode, plus_constant (stack_pointer_rtx,
6617 INTVAL (operands[0])));
6618 MEM_VOLATILE_P (operands[1]) = 1;
6620 operands[0] = const0_rtx;
6623 ;; This is how we allocate stack space. If we are allocating a
6624 ;; constant amount of space and we know it is less than 4096
6625 ;; bytes, we need do nothing.
6627 ;; If it is more than 4096 bytes, we need to probe the stack
6629 (define_expand "allocate_stack"
6631 (plus:DI (reg:DI 30)
6632 (match_operand:DI 1 "reg_or_cint_operand" "")))
6633 (set (match_operand:DI 0 "register_operand" "=r")
6637 if (GET_CODE (operands[1]) == CONST_INT
6638 && INTVAL (operands[1]) < 32768)
6640 if (INTVAL (operands[1]) >= 4096)
6642 /* We do this the same way as in the prologue and generate explicit
6643 probes. Then we update the stack by the constant. */
6647 emit_insn (gen_probe_stack (GEN_INT (- probed)));
6648 while (probed + 8192 < INTVAL (operands[1]))
6649 emit_insn (gen_probe_stack (GEN_INT (- (probed += 8192))));
6651 if (probed + 4096 < INTVAL (operands[1]))
6652 emit_insn (gen_probe_stack (GEN_INT (- INTVAL(operands[1]))));
6655 operands[1] = GEN_INT (- INTVAL (operands[1]));
6656 operands[2] = virtual_stack_dynamic_rtx;
6661 rtx loop_label = gen_label_rtx ();
6662 rtx want = gen_reg_rtx (Pmode);
6663 rtx tmp = gen_reg_rtx (Pmode);
6666 emit_insn (gen_subdi3 (want, stack_pointer_rtx,
6667 force_reg (Pmode, operands[1])));
6668 emit_insn (gen_adddi3 (tmp, stack_pointer_rtx, GEN_INT (-4096)));
6670 if (GET_CODE (operands[1]) != CONST_INT)
6672 out_label = gen_label_rtx ();
6673 emit_insn (gen_cmpdi (want, tmp));
6674 emit_jump_insn (gen_bgeu (out_label));
6677 emit_label (loop_label);
6678 memref = gen_rtx_MEM (DImode, tmp);
6679 MEM_VOLATILE_P (memref) = 1;
6680 emit_move_insn (memref, const0_rtx);
6681 emit_insn (gen_adddi3 (tmp, tmp, GEN_INT(-8192)));
6682 emit_insn (gen_cmpdi (tmp, want));
6683 emit_jump_insn (gen_bgtu (loop_label));
6685 memref = gen_rtx_MEM (DImode, want);
6686 MEM_VOLATILE_P (memref) = 1;
6687 emit_move_insn (memref, const0_rtx);
6690 emit_label (out_label);
6692 emit_move_insn (stack_pointer_rtx, want);
6693 emit_move_insn (operands[0], virtual_stack_dynamic_rtx);
6698 ;; This is used by alpha_expand_prolog to do the same thing as above,
6699 ;; except we cannot at that time generate new basic blocks, so we hide
6700 ;; the loop in this one insn.
6702 (define_insn "prologue_stack_probe_loop"
6703 [(unspec_volatile [(match_operand:DI 0 "register_operand" "r")
6704 (match_operand:DI 1 "register_operand" "r")]
6708 operands[2] = gen_label_rtx ();
6709 (*targetm.asm_out.internal_label) (asm_out_file, "L",
6710 CODE_LABEL_NUMBER (operands[2]));
6712 return "stq $31,-8192(%1)\;subq %0,1,%0\;lda %1,-8192(%1)\;bne %0,%l2";
6714 [(set_attr "length" "16")
6715 (set_attr "type" "multi")])
6717 (define_expand "prologue"
6718 [(clobber (const_int 0))]
6721 alpha_expand_prologue ();
6725 ;; These take care of emitting the ldgp insn in the prologue. This will be
6726 ;; an lda/ldah pair and we want to align them properly. So we have two
6727 ;; unspec_volatile insns, the first of which emits the ldgp assembler macro
6728 ;; and the second of which emits nothing. However, both are marked as type
6729 ;; IADD (the default) so the alignment code in alpha.c does the right thing
6732 (define_expand "prologue_ldgp"
6734 (unspec_volatile:DI [(match_dup 1) (match_dup 2)] UNSPECV_LDGP1))
6736 (unspec_volatile:DI [(match_dup 0) (match_dup 2)] UNSPECV_PLDGP2))]
6739 operands[0] = pic_offset_table_rtx;
6740 operands[1] = gen_rtx_REG (Pmode, 27);
6741 operands[2] = (TARGET_EXPLICIT_RELOCS
6742 ? GEN_INT (alpha_next_sequence_number++)
6746 (define_insn "*ldgp_er_1"
6747 [(set (match_operand:DI 0 "register_operand" "=r")
6748 (unspec_volatile:DI [(match_operand:DI 1 "register_operand" "r")
6749 (match_operand 2 "const_int_operand" "")]
6751 "TARGET_EXPLICIT_RELOCS && TARGET_ABI_OSF"
6752 "ldah %0,0(%1)\t\t!gpdisp!%2")
6754 (define_insn "*ldgp_er_2"
6755 [(set (match_operand:DI 0 "register_operand" "=r")
6756 (unspec:DI [(match_operand:DI 1 "register_operand" "r")
6757 (match_operand 2 "const_int_operand" "")]
6759 "TARGET_EXPLICIT_RELOCS && TARGET_ABI_OSF"
6760 "lda %0,0(%1)\t\t!gpdisp!%2")
6762 (define_insn "*prologue_ldgp_er_2"
6763 [(set (match_operand:DI 0 "register_operand" "=r")
6764 (unspec_volatile:DI [(match_operand:DI 1 "register_operand" "r")
6765 (match_operand 2 "const_int_operand" "")]
6767 "TARGET_EXPLICIT_RELOCS && TARGET_ABI_OSF"
6768 "lda %0,0(%1)\t\t!gpdisp!%2\n$%~..ng:")
6770 (define_insn "*prologue_ldgp_1"
6771 [(set (match_operand:DI 0 "register_operand" "=r")
6772 (unspec_volatile:DI [(match_operand:DI 1 "register_operand" "r")
6773 (match_operand 2 "const_int_operand" "")]
6776 "ldgp %0,0(%1)\n$%~..ng:")
6778 (define_insn "*prologue_ldgp_2"
6779 [(set (match_operand:DI 0 "register_operand" "=r")
6780 (unspec_volatile:DI [(match_operand:DI 1 "register_operand" "r")
6781 (match_operand 2 "const_int_operand" "")]
6786 ;; The _mcount profiling hook has special calling conventions, and
6787 ;; does not clobber all the registers that a normal call would. So
6788 ;; hide the fact this is a call at all.
6790 (define_insn "prologue_mcount"
6791 [(unspec_volatile [(const_int 0)] UNSPECV_MCOUNT)]
6794 if (TARGET_EXPLICIT_RELOCS)
6795 /* Note that we cannot use a lituse_jsr reloc, since _mcount
6796 cannot be called via the PLT. */
6797 return "ldq $28,_mcount($29)\t\t!literal\;jsr $28,($28),_mcount";
6799 return "lda $28,_mcount\;jsr $28,($28),_mcount";
6801 [(set_attr "type" "multi")
6802 (set_attr "length" "8")])
6804 (define_insn "init_fp"
6805 [(set (match_operand:DI 0 "register_operand" "=r")
6806 (match_operand:DI 1 "register_operand" "r"))
6807 (clobber (mem:BLK (match_operand:DI 2 "register_operand" "=r")))]
6811 (define_expand "epilogue"
6815 alpha_expand_epilogue ();
6818 (define_expand "sibcall_epilogue"
6822 alpha_expand_epilogue ();
6826 ;; In creating a large stack frame, NT _must_ use ldah+lda to load
6827 ;; the frame size into a register. We use this pattern to ensure
6828 ;; we get lda instead of addq.
6829 (define_insn "nt_lda"
6830 [(set (match_operand:DI 0 "register_operand" "=r")
6831 (unspec:DI [(match_dup 0)
6832 (match_operand:DI 1 "const_int_operand" "n")]
6837 (define_expand "builtin_longjmp"
6838 [(use (match_operand:DI 0 "register_operand" "r"))]
6841 /* The elements of the buffer are, in order: */
6842 rtx fp = gen_rtx_MEM (Pmode, operands[0]);
6843 rtx lab = gen_rtx_MEM (Pmode, plus_constant (operands[0], 8));
6844 rtx stack = gen_rtx_MEM (Pmode, plus_constant (operands[0], 16));
6845 rtx pv = gen_rtx_REG (Pmode, 27);
6847 /* This bit is the same as expand_builtin_longjmp. */
6848 emit_move_insn (hard_frame_pointer_rtx, fp);
6849 emit_move_insn (pv, lab);
6850 emit_stack_restore (SAVE_NONLOCAL, stack, NULL_RTX);
6851 emit_insn (gen_rtx_USE (VOIDmode, hard_frame_pointer_rtx));
6852 emit_insn (gen_rtx_USE (VOIDmode, stack_pointer_rtx));
6854 /* Load the label we are jumping through into $27 so that we know
6855 where to look for it when we get back to setjmp's function for
6856 restoring the gp. */
6857 emit_jump_insn (gen_builtin_longjmp_internal (pv));
6862 ;; This is effectively a copy of indirect_jump, but constrained such
6863 ;; that register renaming cannot foil our cunning plan with $27.
6864 (define_insn "builtin_longjmp_internal"
6866 (unspec_volatile [(match_operand:DI 0 "register_operand" "c")]
6870 [(set_attr "type" "ibr")])
6872 (define_insn "*builtin_setjmp_receiver_er_sl_1"
6873 [(unspec_volatile [(label_ref (match_operand 0 "" ""))] UNSPECV_SETJMPR)]
6874 "TARGET_EXPLICIT_RELOCS && TARGET_ABI_OSF && TARGET_AS_CAN_SUBTRACT_LABELS"
6875 "lda $27,$LSJ%=-%l0($27)\n$LSJ%=:")
6877 (define_insn "*builtin_setjmp_receiver_er_1"
6878 [(unspec_volatile [(label_ref (match_operand 0 "" ""))] UNSPECV_SETJMPR)]
6879 "TARGET_EXPLICIT_RELOCS && TARGET_ABI_OSF"
6880 "br $27,$LSJ%=\n$LSJ%=:"
6881 [(set_attr "type" "ibr")])
6884 [(unspec_volatile [(label_ref (match_operand 0 "" ""))] UNSPECV_SETJMPR)]
6885 "TARGET_EXPLICIT_RELOCS && TARGET_ABI_OSF
6886 && prev_nonnote_insn (insn) == operands[0]"
6890 emit_note (NULL, NOTE_INSN_DELETED);
6894 (define_insn "*builtin_setjmp_receiver_1"
6895 [(unspec_volatile [(label_ref (match_operand 0 "" ""))] UNSPECV_SETJMPR)]
6897 "br $27,$LSJ%=\n$LSJ%=:\;ldgp $29,0($27)"
6898 [(set_attr "length" "12")
6899 (set_attr "type" "multi")])
6901 (define_expand "builtin_setjmp_receiver_er"
6902 [(unspec_volatile [(label_ref (match_operand 0 "" ""))] UNSPECV_SETJMPR)
6904 (unspec_volatile:DI [(match_dup 2) (match_dup 3)] UNSPECV_LDGP1))
6906 (unspec:DI [(match_dup 1) (match_dup 3)] UNSPEC_LDGP2))]
6909 operands[1] = pic_offset_table_rtx;
6910 operands[2] = gen_rtx_REG (Pmode, 27);
6911 operands[3] = GEN_INT (alpha_next_sequence_number++);
6914 (define_expand "builtin_setjmp_receiver"
6915 [(unspec_volatile [(label_ref (match_operand 0 "" ""))] UNSPECV_SETJMPR)]
6918 if (TARGET_EXPLICIT_RELOCS)
6920 emit_insn (gen_builtin_setjmp_receiver_er (operands[0]));
6925 (define_expand "exception_receiver_er"
6927 (unspec_volatile:DI [(match_dup 1) (match_dup 2)] UNSPECV_LDGP1))
6929 (unspec:DI [(match_dup 0) (match_dup 2)] UNSPEC_LDGP2))]
6932 operands[0] = pic_offset_table_rtx;
6933 operands[1] = gen_rtx_REG (Pmode, 26);
6934 operands[2] = GEN_INT (alpha_next_sequence_number++);
6937 (define_expand "exception_receiver"
6938 [(unspec_volatile [(match_dup 0)] UNSPECV_EHR)]
6941 if (TARGET_LD_BUGGY_LDGP)
6942 operands[0] = alpha_gp_save_rtx ();
6943 else if (TARGET_EXPLICIT_RELOCS)
6945 emit_insn (gen_exception_receiver_er ());
6949 operands[0] = const0_rtx;
6952 (define_insn "*exception_receiver_1"
6953 [(unspec_volatile [(const_int 0)] UNSPECV_EHR)]
6954 "! TARGET_LD_BUGGY_LDGP"
6956 [(set_attr "length" "8")
6957 (set_attr "type" "multi")])
6959 (define_insn "*exception_receiver_2"
6960 [(unspec_volatile [(match_operand:DI 0 "memory_operand" "m")] UNSPECV_EHR)]
6961 "TARGET_LD_BUGGY_LDGP"
6963 [(set_attr "type" "ild")])
6965 (define_expand "nonlocal_goto_receiver"
6966 [(unspec_volatile [(const_int 0)] UNSPECV_BLOCKAGE)
6967 (set (reg:DI 27) (mem:DI (reg:DI 29)))
6968 (unspec_volatile [(const_int 0)] UNSPECV_BLOCKAGE)
6970 "TARGET_ABI_OPEN_VMS"
6973 (define_insn "arg_home"
6974 [(unspec [(const_int 0)] UNSPEC_ARG_HOME)
6989 (clobber (mem:BLK (const_int 0)))
6990 (clobber (reg:DI 24))
6991 (clobber (reg:DI 25))
6992 (clobber (reg:DI 0))]
6993 "TARGET_ABI_OPEN_VMS"
6994 "lda $0,OTS$HOME_ARGS\;ldq $0,8($0)\;jsr $0,OTS$HOME_ARGS"
6995 [(set_attr "length" "16")
6996 (set_attr "type" "multi")])
6998 ;; Load the CIW into r2 for calling __T3E_MISMATCH
7000 (define_expand "umk_mismatch_args"
7001 [(set:DI (match_dup 1) (mem:DI (plus:DI (reg:DI 15) (const_int -16))))
7002 (set:DI (match_dup 2) (mem:DI (plus:DI (match_dup 1) (const_int -32))))
7003 (set:DI (reg:DI 1) (match_operand:DI 0 "const_int_operand" ""))
7004 (set:DI (match_dup 3) (plus:DI (mult:DI (reg:DI 25)
7007 (set:DI (reg:DI 2) (mem:DI (match_dup 3)))]
7008 "TARGET_ABI_UNICOSMK"
7010 operands[1] = gen_reg_rtx (DImode);
7011 operands[2] = gen_reg_rtx (DImode);
7012 operands[3] = gen_reg_rtx (DImode);
7015 (define_insn "arg_home_umk"
7016 [(unspec [(const_int 0)] UNSPEC_ARG_HOME)
7031 (clobber (mem:BLK (const_int 0)))
7033 (clobber (reg:DI 22))
7034 (clobber (reg:DI 23))
7035 (clobber (reg:DI 24))
7036 (clobber (reg:DI 0))
7037 (clobber (reg:DI 1))
7038 (clobber (reg:DI 2))
7039 (clobber (reg:DI 3))
7040 (clobber (reg:DI 4))
7041 (clobber (reg:DI 5))
7042 (clobber (reg:DI 6))
7043 (clobber (reg:DI 7))
7044 (clobber (reg:DI 8))])]
7045 "TARGET_ABI_UNICOSMK"
7046 "laum $4,__T3E_MISMATCH($31)\;sll $4,32,$4\;lalm $4,__T3E_MISMATCH($4)\;lal $4,__T3E_MISMATCH($4)\;jsr $3,($4)"
7047 [(set_attr "length" "16")
7048 (set_attr "type" "multi")])
7052 ;; On EV4, these instructions are nops -- no load occurs.
7054 ;; On EV5, these instructions act as a normal load, and thus can trap
7055 ;; if the address is invalid. The OS may (or may not) handle this in
7056 ;; the entMM fault handler and suppress the fault. If so, then this
7057 ;; has the effect of a read prefetch instruction.
7059 ;; On EV6, these become official prefetch instructions.
7061 (define_insn "prefetch"
7062 [(prefetch (match_operand:DI 0 "address_operand" "p")
7063 (match_operand:DI 1 "const_int_operand" "n")
7064 (match_operand:DI 2 "const_int_operand" "n"))]
7065 "TARGET_FIXUP_EV5_PREFETCH || TARGET_CPU_EV6"
7067 /* Interpret "no temporal locality" as this data should be evicted once
7068 it is used. The "evict next" alternatives load the data into the cache
7069 and leave the LRU eviction counter pointing to that block. */
7070 static const char * const alt[2][2] = {
7072 "ldq $31,%a0", /* read, evict next */
7073 "ldl $31,%a0", /* read, evict last */
7076 "ldt $f31,%a0", /* write, evict next */
7077 "lds $f31,%a0", /* write, evict last */
7081 bool write = INTVAL (operands[1]) != 0;
7082 bool lru = INTVAL (operands[2]) != 0;
7084 return alt[write][lru];
7086 [(set_attr "type" "ild")])
7088 ;; Close the trap shadow of preceding instructions. This is generated
7091 (define_insn "trapb"
7092 [(unspec_volatile [(const_int 0)] UNSPECV_TRAPB)]
7095 [(set_attr "type" "misc")])
7097 ;; No-op instructions used by machine-dependent reorg to preserve
7098 ;; alignment for instruction issue.
7099 ;; The Unicos/Mk assembler does not support these opcodes.
7105 [(set_attr "type" "ilog")])
7110 "cpys $f31,$f31,$f31"
7111 [(set_attr "type" "fcpys")])
7118 ;; On Unicos/Mk we use a macro for aligning code.
7120 (define_insn "realign"
7121 [(unspec_volatile [(match_operand 0 "immediate_operand" "i")]
7125 if (TARGET_ABI_UNICOSMK)
7126 return "gcc@code@align %0";
7128 return ".align %0 #realign";
7131 ;; Instructions to be emitted from __builtins.
7133 (define_insn "builtin_cmpbge"
7134 [(set (match_operand:DI 0 "register_operand" "=r")
7135 (unspec:DI [(match_operand:DI 1 "reg_or_0_operand" "rJ")
7136 (match_operand:DI 2 "reg_or_8bit_operand" "rI")]
7140 ;; The EV6 data sheets list this as ILOG. OTOH, EV6 doesn't
7141 ;; actually differentiate between ILOG and ICMP in the schedule.
7142 [(set_attr "type" "icmp")])
7144 (define_expand "builtin_extbl"
7145 [(match_operand:DI 0 "register_operand" "")
7146 (match_operand:DI 1 "reg_or_0_operand" "")
7147 (match_operand:DI 2 "reg_or_8bit_operand" "")]
7150 rtx (*gen) PARAMS ((rtx, rtx, rtx, rtx));
7151 if (WORDS_BIG_ENDIAN)
7155 emit_insn ((*gen) (operands[0], operands[1], GEN_INT (8), operands[2]));
7159 (define_expand "builtin_extwl"
7160 [(match_operand:DI 0 "register_operand" "")
7161 (match_operand:DI 1 "reg_or_0_operand" "")
7162 (match_operand:DI 2 "reg_or_8bit_operand" "")]
7165 rtx (*gen) PARAMS ((rtx, rtx, rtx, rtx));
7166 if (WORDS_BIG_ENDIAN)
7170 emit_insn ((*gen) (operands[0], operands[1], GEN_INT (16), operands[2]));
7174 (define_expand "builtin_extll"
7175 [(match_operand:DI 0 "register_operand" "")
7176 (match_operand:DI 1 "reg_or_0_operand" "")
7177 (match_operand:DI 2 "reg_or_8bit_operand" "")]
7180 rtx (*gen) PARAMS ((rtx, rtx, rtx, rtx));
7181 if (WORDS_BIG_ENDIAN)
7185 emit_insn ((*gen) (operands[0], operands[1], GEN_INT (32), operands[2]));
7189 (define_expand "builtin_extql"
7190 [(match_operand:DI 0 "register_operand" "")
7191 (match_operand:DI 1 "reg_or_0_operand" "")
7192 (match_operand:DI 2 "reg_or_8bit_operand" "")]
7195 rtx (*gen) PARAMS ((rtx, rtx, rtx, rtx));
7196 if (WORDS_BIG_ENDIAN)
7200 emit_insn ((*gen) (operands[0], operands[1], GEN_INT (64), operands[2]));
7204 (define_expand "builtin_extwh"
7205 [(match_operand:DI 0 "register_operand" "")
7206 (match_operand:DI 1 "reg_or_0_operand" "")
7207 (match_operand:DI 2 "reg_or_8bit_operand" "")]
7210 rtx (*gen) PARAMS ((rtx, rtx, rtx));
7211 if (WORDS_BIG_ENDIAN)
7215 emit_insn ((*gen) (operands[0], operands[1], operands[2]));
7219 (define_expand "builtin_extlh"
7220 [(match_operand:DI 0 "register_operand" "")
7221 (match_operand:DI 1 "reg_or_0_operand" "")
7222 (match_operand:DI 2 "reg_or_8bit_operand" "")]
7225 rtx (*gen) PARAMS ((rtx, rtx, rtx));
7226 if (WORDS_BIG_ENDIAN)
7230 emit_insn ((*gen) (operands[0], operands[1], operands[2]));
7234 (define_expand "builtin_extqh"
7235 [(match_operand:DI 0 "register_operand" "")
7236 (match_operand:DI 1 "reg_or_0_operand" "")
7237 (match_operand:DI 2 "reg_or_8bit_operand" "")]
7240 rtx (*gen) PARAMS ((rtx, rtx, rtx));
7241 if (WORDS_BIG_ENDIAN)
7245 emit_insn ((*gen) (operands[0], operands[1], operands[2]));
7249 (define_expand "builtin_insbl"
7250 [(match_operand:DI 0 "register_operand" "")
7251 (match_operand:DI 1 "reg_or_0_operand" "")
7252 (match_operand:DI 2 "reg_or_8bit_operand" "")]
7255 rtx (*gen) PARAMS ((rtx, rtx, rtx));
7256 if (WORDS_BIG_ENDIAN)
7260 operands[1] = gen_lowpart (QImode, operands[1]);
7261 emit_insn ((*gen) (operands[0], operands[1], operands[2]));
7265 (define_expand "builtin_inswl"
7266 [(match_operand:DI 0 "register_operand" "")
7267 (match_operand:DI 1 "reg_or_0_operand" "")
7268 (match_operand:DI 2 "reg_or_8bit_operand" "")]
7271 rtx (*gen) PARAMS ((rtx, rtx, rtx));
7272 if (WORDS_BIG_ENDIAN)
7276 operands[1] = gen_lowpart (HImode, operands[1]);
7277 emit_insn ((*gen) (operands[0], operands[1], operands[2]));
7281 (define_expand "builtin_insll"
7282 [(match_operand:DI 0 "register_operand" "")
7283 (match_operand:DI 1 "reg_or_0_operand" "")
7284 (match_operand:DI 2 "reg_or_8bit_operand" "")]
7287 rtx (*gen) PARAMS ((rtx, rtx, rtx));
7288 if (WORDS_BIG_ENDIAN)
7292 operands[1] = gen_lowpart (SImode, operands[1]);
7293 emit_insn ((*gen) (operands[0], operands[1], operands[2]));
7294 emit_insn ((*gen) (operands[0], operands[1], operands[2]));
7298 (define_expand "builtin_insql"
7299 [(match_operand:DI 0 "register_operand" "")
7300 (match_operand:DI 1 "reg_or_0_operand" "")
7301 (match_operand:DI 2 "reg_or_8bit_operand" "")]
7304 rtx (*gen) PARAMS ((rtx, rtx, rtx));
7305 if (WORDS_BIG_ENDIAN)
7309 emit_insn ((*gen) (operands[0], operands[1], operands[2]));
7313 (define_expand "builtin_inswh"
7314 [(match_operand:DI 0 "register_operand" "")
7315 (match_operand:DI 1 "register_operand" "")
7316 (match_operand:DI 2 "reg_or_8bit_operand" "")]
7319 emit_insn (gen_insxh (operands[0], operands[1], GEN_INT (16), operands[2]));
7323 (define_expand "builtin_inslh"
7324 [(match_operand:DI 0 "register_operand" "")
7325 (match_operand:DI 1 "register_operand" "")
7326 (match_operand:DI 2 "reg_or_8bit_operand" "")]
7329 emit_insn (gen_insxh (operands[0], operands[1], GEN_INT (32), operands[2]));
7333 (define_expand "builtin_insqh"
7334 [(match_operand:DI 0 "register_operand" "")
7335 (match_operand:DI 1 "register_operand" "")
7336 (match_operand:DI 2 "reg_or_8bit_operand" "")]
7339 emit_insn (gen_insxh (operands[0], operands[1], GEN_INT (64), operands[2]));
7343 (define_expand "builtin_mskbl"
7344 [(match_operand:DI 0 "register_operand" "")
7345 (match_operand:DI 1 "reg_or_0_operand" "")
7346 (match_operand:DI 2 "reg_or_8bit_operand" "")]
7349 rtx (*gen) PARAMS ((rtx, rtx, rtx, rtx));
7351 if (WORDS_BIG_ENDIAN)
7355 mask = GEN_INT (0xff);
7356 emit_insn ((*gen) (operands[0], operands[1], mask, operands[2]));
7360 (define_expand "builtin_mskwl"
7361 [(match_operand:DI 0 "register_operand" "")
7362 (match_operand:DI 1 "reg_or_0_operand" "")
7363 (match_operand:DI 2 "reg_or_8bit_operand" "")]
7366 rtx (*gen) PARAMS ((rtx, rtx, rtx, rtx));
7368 if (WORDS_BIG_ENDIAN)
7372 mask = GEN_INT (0xffff);
7373 emit_insn ((*gen) (operands[0], operands[1], mask, operands[2]));
7377 (define_expand "builtin_mskll"
7378 [(match_operand:DI 0 "register_operand" "")
7379 (match_operand:DI 1 "reg_or_0_operand" "")
7380 (match_operand:DI 2 "reg_or_8bit_operand" "")]
7383 rtx (*gen) PARAMS ((rtx, rtx, rtx, rtx));
7385 if (WORDS_BIG_ENDIAN)
7389 mask = immed_double_const (0xffffffff, 0, DImode);
7390 emit_insn ((*gen) (operands[0], operands[1], mask, operands[2]));
7394 (define_expand "builtin_mskql"
7395 [(match_operand:DI 0 "register_operand" "")
7396 (match_operand:DI 1 "reg_or_0_operand" "")
7397 (match_operand:DI 2 "reg_or_8bit_operand" "")]
7400 rtx (*gen) PARAMS ((rtx, rtx, rtx, rtx));
7402 if (WORDS_BIG_ENDIAN)
7407 emit_insn ((*gen) (operands[0], operands[1], mask, operands[2]));
7411 (define_expand "builtin_mskwh"
7412 [(match_operand:DI 0 "register_operand" "")
7413 (match_operand:DI 1 "register_operand" "")
7414 (match_operand:DI 2 "reg_or_8bit_operand" "")]
7417 emit_insn (gen_mskxh (operands[0], operands[1], GEN_INT (16), operands[2]));
7421 (define_expand "builtin_msklh"
7422 [(match_operand:DI 0 "register_operand" "")
7423 (match_operand:DI 1 "register_operand" "")
7424 (match_operand:DI 2 "reg_or_8bit_operand" "")]
7427 emit_insn (gen_mskxh (operands[0], operands[1], GEN_INT (32), operands[2]));
7431 (define_expand "builtin_mskqh"
7432 [(match_operand:DI 0 "register_operand" "")
7433 (match_operand:DI 1 "register_operand" "")
7434 (match_operand:DI 2 "reg_or_8bit_operand" "")]
7437 emit_insn (gen_mskxh (operands[0], operands[1], GEN_INT (64), operands[2]));
7441 (define_expand "builtin_zap"
7442 [(set (match_operand:DI 0 "register_operand" "")
7444 [(match_operand:DI 2 "reg_or_const_int_operand" "")]
7446 (match_operand:DI 1 "reg_or_const_int_operand" "")))]
7449 if (GET_CODE (operands[2]) == CONST_INT)
7451 rtx mask = alpha_expand_zap_mask (INTVAL (operands[2]));
7453 if (mask == const0_rtx)
7455 emit_move_insn (operands[0], const0_rtx);
7458 if (mask == constm1_rtx)
7460 emit_move_insn (operands[0], operands[1]);
7464 operands[1] = force_reg (DImode, operands[1]);
7465 emit_insn (gen_anddi3 (operands[0], operands[1], mask));
7469 operands[1] = force_reg (DImode, operands[1]);
7470 operands[2] = gen_lowpart (QImode, operands[2]);
7473 (define_insn "*builtin_zap_1"
7474 [(set (match_operand:DI 0 "register_operand" "=r,r,r,r")
7476 [(match_operand:QI 2 "reg_or_const_int_operand" "n,n,r,r")]
7478 (match_operand:DI 1 "reg_or_const_int_operand" "n,r,J,r")))]
7485 [(set_attr "type" "shift,shift,ilog,shift")])
7488 [(set (match_operand:DI 0 "register_operand" "")
7490 [(match_operand:QI 2 "const_int_operand" "")]
7492 (match_operand:DI 1 "const_int_operand" "")))]
7496 rtx mask = alpha_expand_zap_mask (INTVAL (operands[2]));
7497 if (HOST_BITS_PER_WIDE_INT >= 64 || GET_CODE (mask) == CONST_INT)
7498 operands[1] = gen_int_mode (INTVAL (operands[1]) & INTVAL (mask), DImode);
7501 HOST_WIDE_INT c_lo = INTVAL (operands[1]);
7502 HOST_WIDE_INT c_hi = (c_lo < 0 ? -1 : 0);
7503 operands[1] = immed_double_const (c_lo & CONST_DOUBLE_LOW (mask),
7504 c_hi & CONST_DOUBLE_HIGH (mask),
7507 emit_move_insn (operands[0], operands[1]);
7512 [(set (match_operand:DI 0 "register_operand" "")
7514 [(match_operand:QI 2 "const_int_operand" "")]
7516 (match_operand:DI 1 "register_operand" "")))]
7519 (and:DI (match_dup 1) (match_dup 2)))]
7521 operands[2] = alpha_expand_zap_mask (INTVAL (operands[2]));
7522 if (operands[2] == const0_rtx)
7524 emit_move_insn (operands[0], const0_rtx);
7527 if (operands[2] == constm1_rtx)
7529 emit_move_insn (operands[0], operands[1]);
7534 (define_expand "builtin_zapnot"
7535 [(set (match_operand:DI 0 "register_operand" "")
7537 [(not:QI (match_operand:DI 2 "reg_or_const_int_operand" ""))]
7539 (match_operand:DI 1 "reg_or_const_int_operand" "")))]
7542 if (GET_CODE (operands[2]) == CONST_INT)
7544 rtx mask = alpha_expand_zap_mask (~ INTVAL (operands[2]));
7546 if (mask == const0_rtx)
7548 emit_move_insn (operands[0], const0_rtx);
7551 if (mask == constm1_rtx)
7553 emit_move_insn (operands[0], operands[1]);
7557 operands[1] = force_reg (DImode, operands[1]);
7558 emit_insn (gen_anddi3 (operands[0], operands[1], mask));
7562 operands[1] = force_reg (DImode, operands[1]);
7563 operands[2] = gen_lowpart (QImode, operands[2]);
7566 (define_insn "*builtin_zapnot_1"
7567 [(set (match_operand:DI 0 "register_operand" "=r")
7569 [(not:QI (match_operand:QI 2 "register_operand" "r"))]
7571 (match_operand:DI 1 "reg_or_0_operand" "rJ")))]
7574 [(set_attr "type" "shift")])
7576 (define_insn "builtin_amask"
7577 [(set (match_operand:DI 0 "register_operand" "=r")
7578 (unspec:DI [(match_operand:DI 1 "reg_or_8bit_operand" "rI")]
7582 [(set_attr "type" "ilog")])
7584 (define_insn "builtin_implver"
7585 [(set (match_operand:DI 0 "register_operand" "=r")
7586 (unspec:DI [(const_int 0)] UNSPEC_IMPLVER))]
7589 [(set_attr "type" "ilog")])
7591 (define_insn "builtin_rpcc"
7592 [(set (match_operand:DI 0 "register_operand" "=r")
7593 (unspec_volatile:DI [(const_int 0)] UNSPECV_RPCC))]
7596 [(set_attr "type" "ilog")])
7598 (define_expand "builtin_minub8"
7599 [(match_operand:DI 0 "register_operand" "")
7600 (match_operand:DI 1 "reg_or_0_operand" "")
7601 (match_operand:DI 2 "reg_or_0_operand" "")]
7604 alpha_expand_builtin_vector_binop (gen_uminv8qi3, V8QImode, operands[0],
7605 operands[1], operands[2]);
7609 (define_expand "builtin_minsb8"
7610 [(match_operand:DI 0 "register_operand" "")
7611 (match_operand:DI 1 "reg_or_0_operand" "")
7612 (match_operand:DI 2 "reg_or_0_operand" "")]
7615 alpha_expand_builtin_vector_binop (gen_sminv8qi3, V8QImode, operands[0],
7616 operands[1], operands[2]);
7620 (define_expand "builtin_minuw4"
7621 [(match_operand:DI 0 "register_operand" "")
7622 (match_operand:DI 1 "reg_or_0_operand" "")
7623 (match_operand:DI 2 "reg_or_0_operand" "")]
7626 alpha_expand_builtin_vector_binop (gen_uminv4hi3, V4HImode, operands[0],
7627 operands[1], operands[2]);
7631 (define_expand "builtin_minsw4"
7632 [(match_operand:DI 0 "register_operand" "")
7633 (match_operand:DI 1 "reg_or_0_operand" "")
7634 (match_operand:DI 2 "reg_or_0_operand" "")]
7637 alpha_expand_builtin_vector_binop (gen_sminv4hi3, V4HImode, operands[0],
7638 operands[1], operands[2]);
7642 (define_expand "builtin_maxub8"
7643 [(match_operand:DI 0 "register_operand" "")
7644 (match_operand:DI 1 "reg_or_0_operand" "")
7645 (match_operand:DI 2 "reg_or_0_operand" "")]
7648 alpha_expand_builtin_vector_binop (gen_umaxv8qi3, V8QImode, operands[0],
7649 operands[1], operands[2]);
7653 (define_expand "builtin_maxsb8"
7654 [(match_operand:DI 0 "register_operand" "")
7655 (match_operand:DI 1 "reg_or_0_operand" "")
7656 (match_operand:DI 2 "reg_or_0_operand" "")]
7659 alpha_expand_builtin_vector_binop (gen_smaxv8qi3, V8QImode, operands[0],
7660 operands[1], operands[2]);
7664 (define_expand "builtin_maxuw4"
7665 [(match_operand:DI 0 "register_operand" "")
7666 (match_operand:DI 1 "reg_or_0_operand" "")
7667 (match_operand:DI 2 "reg_or_0_operand" "")]
7670 alpha_expand_builtin_vector_binop (gen_umaxv4hi3, V4HImode, operands[0],
7671 operands[1], operands[2]);
7675 (define_expand "builtin_maxsw4"
7676 [(match_operand:DI 0 "register_operand" "")
7677 (match_operand:DI 1 "reg_or_0_operand" "")
7678 (match_operand:DI 2 "reg_or_0_operand" "")]
7681 alpha_expand_builtin_vector_binop (gen_smaxv4hi3, V4HImode, operands[0],
7682 operands[1], operands[2]);
7686 (define_insn "builtin_perr"
7687 [(set (match_operand:DI 0 "register_operand" "=r")
7688 (unspec:DI [(match_operand:DI 1 "reg_or_0_operand" "%rJ")
7689 (match_operand:DI 2 "reg_or_8bit_operand" "rJ")]
7693 [(set_attr "type" "mvi")])
7695 (define_expand "builtin_pklb"
7696 [(set (match_operand:DI 0 "register_operand" "")
7699 (truncate:V2QI (match_operand:DI 1 "register_operand" ""))
7704 operands[0] = gen_lowpart (V8QImode, operands[0]);
7705 operands[1] = gen_lowpart (V2SImode, operands[1]);
7706 operands[2] = CONST0_RTX (V2QImode);
7707 operands[3] = CONST0_RTX (V4QImode);
7710 (define_insn "*pklb"
7711 [(set (match_operand:V8QI 0 "register_operand" "=r")
7714 (truncate:V2QI (match_operand:V2SI 1 "register_operand" "r"))
7715 (match_operand:V2QI 2 "const0_operand" ""))
7716 (match_operand:V4QI 3 "const0_operand" "")))]
7719 [(set_attr "type" "mvi")])
7721 (define_expand "builtin_pkwb"
7722 [(set (match_operand:DI 0 "register_operand" "")
7724 (truncate:V4QI (match_operand:DI 1 "register_operand" ""))
7728 operands[0] = gen_lowpart (V8QImode, operands[0]);
7729 operands[1] = gen_lowpart (V4HImode, operands[1]);
7730 operands[2] = CONST0_RTX (V4QImode);
7733 (define_insn "*pkwb"
7734 [(set (match_operand:V8QI 0 "register_operand" "=r")
7736 (truncate:V4QI (match_operand:V4HI 1 "register_operand" "r"))
7737 (match_operand:V4QI 2 "const0_operand" "")))]
7740 [(set_attr "type" "mvi")])
7742 (define_expand "builtin_unpkbl"
7743 [(set (match_operand:DI 0 "register_operand" "")
7745 (vec_select:V2QI (match_operand:DI 1 "register_operand" "")
7746 (parallel [(const_int 0) (const_int 1)]))))]
7749 operands[0] = gen_lowpart (V2SImode, operands[0]);
7750 operands[1] = gen_lowpart (V8QImode, operands[1]);
7753 (define_insn "*unpkbl"
7754 [(set (match_operand:V2SI 0 "register_operand" "=r")
7756 (vec_select:V2QI (match_operand:V8QI 1 "reg_or_0_operand" "rW")
7757 (parallel [(const_int 0) (const_int 1)]))))]
7760 [(set_attr "type" "mvi")])
7762 (define_expand "builtin_unpkbw"
7763 [(set (match_operand:DI 0 "register_operand" "")
7765 (vec_select:V4QI (match_operand:DI 1 "register_operand" "")
7766 (parallel [(const_int 0)
7772 operands[0] = gen_lowpart (V4HImode, operands[0]);
7773 operands[1] = gen_lowpart (V8QImode, operands[1]);
7776 (define_insn "*unpkbw"
7777 [(set (match_operand:V4HI 0 "register_operand" "=r")
7779 (vec_select:V4QI (match_operand:V8QI 1 "reg_or_0_operand" "rW")
7780 (parallel [(const_int 0)
7786 [(set_attr "type" "mvi")])
7788 (define_expand "builtin_cttz"
7789 [(set (match_operand:DI 0 "register_operand" "")
7790 (unspec:DI [(match_operand:DI 1 "register_operand" "")]
7795 (define_insn "builtin_ctlz"
7796 [(set (match_operand:DI 0 "register_operand" "=r")
7797 (unspec:DI [(match_operand:DI 1 "register_operand" "r")]
7801 [(set_attr "type" "mvi")])
7803 (define_insn "builtin_ctpop"
7804 [(set (match_operand:DI 0 "register_operand" "=r")
7805 (unspec:DI [(match_operand:DI 1 "register_operand" "r")]
7809 [(set_attr "type" "mvi")])
7811 ;; The call patterns are at the end of the file because their
7812 ;; wildcard operand0 interferes with nice recognition.
7814 (define_insn "*call_value_osf_1_er"
7815 [(set (match_operand 0 "" "")
7816 (call (mem:DI (match_operand:DI 1 "call_operand" "c,R,s"))
7817 (match_operand 2 "" "")))
7819 (clobber (reg:DI 26))]
7820 "TARGET_EXPLICIT_RELOCS && TARGET_ABI_OSF"
7822 jsr $26,(%1),0\;ldah $29,0($26)\t\t!gpdisp!%*\;lda $29,0($29)\t\t!gpdisp!%*
7823 bsr $26,%1\t\t!samegp
7824 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!%*"
7825 [(set_attr "type" "jsr")
7826 (set_attr "length" "12,*,16")])
7828 ;; We must use peep2 instead of a split because we need accurate life
7829 ;; information for $gp. Consider the case of { bar(); while (1); }.
7831 [(parallel [(set (match_operand 0 "" "")
7832 (call (mem:DI (match_operand:DI 1 "call_operand" ""))
7833 (match_operand 2 "" "")))
7835 (clobber (reg:DI 26))])]
7836 "TARGET_EXPLICIT_RELOCS && TARGET_ABI_OSF && reload_completed
7837 && ! samegp_function_operand (operands[1], Pmode)
7838 && peep2_regno_dead_p (1, 29)"
7839 [(parallel [(set (match_dup 0)
7840 (call (mem:DI (match_dup 3))
7842 (set (reg:DI 26) (plus:DI (pc) (const_int 4)))
7843 (unspec_volatile [(reg:DI 29)] UNSPECV_BLOCKAGE)
7845 (use (match_dup 4))])]
7847 if (CONSTANT_P (operands[1]))
7849 operands[3] = gen_rtx_REG (Pmode, 27);
7850 operands[4] = GEN_INT (alpha_next_sequence_number++);
7851 emit_insn (gen_movdi_er_high_g (operands[3], pic_offset_table_rtx,
7852 operands[1], operands[4]));
7856 operands[3] = operands[1];
7857 operands[1] = const0_rtx;
7858 operands[4] = const0_rtx;
7863 [(parallel [(set (match_operand 0 "" "")
7864 (call (mem:DI (match_operand:DI 1 "call_operand" ""))
7865 (match_operand 2 "" "")))
7867 (clobber (reg:DI 26))])]
7868 "TARGET_EXPLICIT_RELOCS && TARGET_ABI_OSF && reload_completed
7869 && ! samegp_function_operand (operands[1], Pmode)
7870 && ! peep2_regno_dead_p (1, 29)"
7871 [(parallel [(set (match_dup 0)
7872 (call (mem:DI (match_dup 3))
7874 (set (reg:DI 26) (plus:DI (pc) (const_int 4)))
7875 (unspec_volatile [(reg:DI 29)] UNSPECV_BLOCKAGE)
7877 (use (match_dup 5))])
7879 (unspec_volatile:DI [(reg:DI 26) (match_dup 4)] UNSPECV_LDGP1))
7881 (unspec:DI [(reg:DI 29) (match_dup 4)] UNSPEC_LDGP2))]
7883 if (CONSTANT_P (operands[1]))
7885 operands[3] = gen_rtx_REG (Pmode, 27);
7886 operands[5] = GEN_INT (alpha_next_sequence_number++);
7887 emit_insn (gen_movdi_er_high_g (operands[3], pic_offset_table_rtx,
7888 operands[1], operands[5]));
7892 operands[3] = operands[1];
7893 operands[1] = const0_rtx;
7894 operands[5] = const0_rtx;
7896 operands[4] = GEN_INT (alpha_next_sequence_number++);
7899 ;; We add a blockage unspec_volatile to prevent insns from moving down
7900 ;; from above the call to in between the call and the ldah gpdisp.
7901 (define_insn "*call_value_osf_2_er"
7902 [(set (match_operand 0 "" "")
7903 (call (mem:DI (match_operand:DI 1 "register_operand" "c"))
7904 (match_operand 2 "" "")))
7906 (plus:DI (pc) (const_int 4)))
7907 (unspec_volatile [(reg:DI 29)] UNSPECV_BLOCKAGE)
7908 (use (match_operand 3 "" ""))
7909 (use (match_operand 4 "" ""))]
7910 "TARGET_EXPLICIT_RELOCS && TARGET_ABI_OSF"
7911 "jsr $26,(%1),%3%J4"
7912 [(set_attr "type" "jsr")])
7914 (define_insn "*call_value_osf_1_noreturn"
7915 [(set (match_operand 0 "" "")
7916 (call (mem:DI (match_operand:DI 1 "call_operand" "c,R,s"))
7917 (match_operand 2 "" "")))
7919 (clobber (reg:DI 26))]
7920 "! TARGET_EXPLICIT_RELOCS && TARGET_ABI_OSF
7921 && find_reg_note (insn, REG_NORETURN, NULL_RTX)"
7926 [(set_attr "type" "jsr")
7927 (set_attr "length" "*,*,8")])
7929 (define_insn_and_split "call_value_osf_tlsgd"
7930 [(set (match_operand 0 "" "")
7931 (call (mem:DI (match_operand:DI 1 "symbolic_operand" ""))
7933 (unspec [(match_operand:DI 2 "const_int_operand" "")] UNSPEC_TLSGD_CALL)
7935 (clobber (reg:DI 26))]
7938 "&& reload_completed"
7940 (unspec:DI [(match_dup 5)
7942 (match_dup 2)] UNSPEC_LITERAL))
7943 (parallel [(set (match_dup 0)
7944 (call (mem:DI (match_dup 3))
7946 (set (reg:DI 26) (plus:DI (pc) (const_int 4)))
7947 (unspec_volatile [(match_dup 5)] UNSPECV_BLOCKAGE)
7949 (use (unspec [(match_dup 2)] UNSPEC_TLSGD_CALL))])
7951 (unspec_volatile:DI [(reg:DI 26) (match_dup 4)] UNSPECV_LDGP1))
7953 (unspec:DI [(match_dup 5) (match_dup 4)] UNSPEC_LDGP2))]
7955 operands[3] = gen_rtx_REG (Pmode, 27);
7956 operands[4] = GEN_INT (alpha_next_sequence_number++);
7957 operands[5] = pic_offset_table_rtx;
7959 [(set_attr "type" "multi")])
7961 (define_insn_and_split "call_value_osf_tlsldm"
7962 [(set (match_operand 0 "" "")
7963 (call (mem:DI (match_operand:DI 1 "symbolic_operand" ""))
7965 (unspec [(match_operand:DI 2 "const_int_operand" "")] UNSPEC_TLSLDM_CALL)
7967 (clobber (reg:DI 26))]
7970 "&& reload_completed"
7972 (unspec:DI [(match_dup 5)
7974 (match_dup 2)] UNSPEC_LITERAL))
7975 (parallel [(set (match_dup 0)
7976 (call (mem:DI (match_dup 3))
7978 (set (reg:DI 26) (plus:DI (pc) (const_int 4)))
7979 (unspec_volatile [(match_dup 5)] UNSPECV_BLOCKAGE)
7981 (use (unspec [(match_dup 2)] UNSPEC_TLSLDM_CALL))])
7983 (unspec_volatile:DI [(reg:DI 26) (match_dup 4)] UNSPECV_LDGP1))
7985 (unspec:DI [(reg:DI 29) (match_dup 4)] UNSPEC_LDGP2))]
7987 operands[3] = gen_rtx_REG (Pmode, 27);
7988 operands[4] = GEN_INT (alpha_next_sequence_number++);
7989 operands[5] = pic_offset_table_rtx;
7991 [(set_attr "type" "multi")])
7993 (define_insn "*call_value_osf_1"
7994 [(set (match_operand 0 "" "")
7995 (call (mem:DI (match_operand:DI 1 "call_operand" "c,R,s"))
7996 (match_operand 2 "" "")))
7998 (clobber (reg:DI 26))]
7999 "! TARGET_EXPLICIT_RELOCS && TARGET_ABI_OSF"
8001 jsr $26,($27),0\;ldgp $29,0($26)
8003 jsr $26,%1\;ldgp $29,0($26)"
8004 [(set_attr "type" "jsr")
8005 (set_attr "length" "12,*,16")])
8007 (define_insn "*sibcall_value_osf_1_er"
8008 [(set (match_operand 0 "" "")
8009 (call (mem:DI (match_operand:DI 1 "symbolic_operand" "R,s"))
8010 (match_operand 2 "" "")))
8011 (unspec [(reg:DI 29)] UNSPEC_SIBCALL)]
8012 "TARGET_EXPLICIT_RELOCS && TARGET_ABI_OSF"
8014 br $31,%1\t\t!samegp
8015 ldq $27,%1($29)\t\t!literal!%#\;jmp $31,($27),%1\t\t!lituse_jsr!%#"
8016 [(set_attr "type" "jsr")
8017 (set_attr "length" "*,8")])
8019 (define_insn "*sibcall_value_osf_1"
8020 [(set (match_operand 0 "" "")
8021 (call (mem:DI (match_operand:DI 1 "symbolic_operand" "R,s"))
8022 (match_operand 2 "" "")))
8023 (unspec [(reg:DI 29)] UNSPEC_SIBCALL)]
8024 "! TARGET_EXPLICIT_RELOCS && TARGET_ABI_OSF"
8027 lda $27,%1\;jmp $31,($27),%1"
8028 [(set_attr "type" "jsr")
8029 (set_attr "length" "*,8")])
8031 (define_insn "*call_value_nt_1"
8032 [(set (match_operand 0 "" "")
8033 (call (mem:DI (match_operand:DI 1 "call_operand" "r,R,s"))
8034 (match_operand 2 "" "")))
8035 (clobber (reg:DI 26))]
8036 "TARGET_ABI_WINDOWS_NT"
8041 [(set_attr "type" "jsr")
8042 (set_attr "length" "*,*,12")])
8044 ; GAS relies on the order and position of instructions output below in order
8045 ; to generate relocs for VMS link to potentially optimize the call.
8046 ; Please do not molest.
8047 (define_insn "*call_value_vms_1"
8048 [(set (match_operand 0 "" "")
8049 (call (mem:DI (match_operand:DI 1 "call_operand" "r,s"))
8050 (match_operand 2 "" "")))
8051 (use (match_operand:DI 3 "nonmemory_operand" "r,n"))
8054 (clobber (reg:DI 27))]
8055 "TARGET_ABI_OPEN_VMS"
8057 switch (which_alternative)
8060 return "mov %3,$27\;jsr $26,0\;ldq $27,0($29)";
8062 operands [3] = alpha_use_linkage (operands [1], cfun->decl, 1, 0);
8063 operands [4] = alpha_use_linkage (operands [1], cfun->decl, 0, 0);
8064 return "ldq $26,%4\;ldq $27,%3\;jsr $26,%1\;ldq $27,0($29)";
8069 [(set_attr "type" "jsr")
8070 (set_attr "length" "12,16")])
8072 (define_insn "*call_value_umk"
8073 [(set (match_operand 0 "" "")
8074 (call (mem:DI (match_operand:DI 1 "call_operand" "r"))
8075 (match_operand 2 "" "")))
8077 (clobber (reg:DI 26))]
8078 "TARGET_ABI_UNICOSMK"
8080 [(set_attr "type" "jsr")])