1 ;; Machine description for DEC Alpha for GNU C compiler
2 ;; Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
3 ;; 2000, 2001, 2002, 2003, 2004, 2005, 2007 Free Software Foundation, Inc.
4 ;; Contributed by Richard Kenner (kenner@vlsi1.ultra.nyu.edu)
6 ;; This file is part of GCC.
8 ;; GCC is free software; you can redistribute it and/or modify
9 ;; it under the terms of the GNU General Public License as published by
10 ;; the Free Software Foundation; either version 2, or (at your option)
13 ;; GCC is distributed in the hope that it will be useful,
14 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
15 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 ;; GNU General Public License for more details.
18 ;; You should have received a copy of the GNU General Public License
19 ;; along with GCC; see the file COPYING. If not, write to
20 ;; the Free Software Foundation, 51 Franklin Street, Fifth Floor,
21 ;; Boston, MA 02110-1301, 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)
73 (UNSPECV_SETJMPR 2) ; builtin_setjmp_receiver
74 (UNSPECV_LONGJMP 3) ; builtin_longjmp
76 (UNSPECV_PSPL 5) ; prologue_stack_probe_loop
78 (UNSPECV_EHR 7) ; exception_receiver
82 (UNSPECV_PLDGP2 11) ; prologue ldgp
85 (UNSPECV_SETJMPR_ER 14) ; builtin_setjmp_receiver fragment
86 (UNSPECV_LL 15) ; load-locked
87 (UNSPECV_SC 16) ; store-conditional
90 ;; Where necessary, the suffixes _le and _be are used to distinguish between
91 ;; little-endian and big-endian patterns.
93 ;; Note that the Unicos/Mk assembler does not support the following
94 ;; opcodes: mov, fmov, nop, fnop, unop.
96 ;; Processor type -- this attribute must exactly match the processor_type
97 ;; enumeration in alpha.h.
99 (define_attr "tune" "ev4,ev5,ev6"
100 (const (symbol_ref "alpha_tune")))
102 ;; Define an insn type attribute. This is used in function unit delay
103 ;; computations, among other purposes. For the most part, we use the names
104 ;; defined in the EV4 documentation, but add a few that we have to know about
108 "ild,fld,ldsym,ist,fst,ibr,callpal,fbr,jsr,iadd,ilog,shift,icmov,fcmov,
109 icmp,imul,fadd,fmul,fcpys,fdiv,fsqrt,misc,mvi,ftoi,itof,mb,ld_l,st_c,
111 (const_string "iadd"))
113 ;; Describe a user's asm statement.
114 (define_asm_attributes
115 [(set_attr "type" "multi")])
117 ;; Define the operand size an insn operates on. Used primarily by mul
118 ;; and div operations that have size dependent timings.
120 (define_attr "opsize" "si,di,udi"
123 ;; The TRAP attribute marks instructions that may generate traps
124 ;; (which are imprecise and may need a trapb if software completion
127 (define_attr "trap" "no,yes"
130 ;; The ROUND_SUFFIX attribute marks which instructions require a
131 ;; rounding-mode suffix. The value NONE indicates no suffix,
132 ;; the value NORMAL indicates a suffix controlled by alpha_fprm.
134 (define_attr "round_suffix" "none,normal,c"
135 (const_string "none"))
137 ;; The TRAP_SUFFIX attribute marks instructions requiring a trap-mode suffix:
139 ;; SU accepts only /su (cmpt et al)
140 ;; SUI accepts only /sui (cvtqt and cvtqs)
141 ;; V_SV accepts /v and /sv (cvtql only)
142 ;; V_SV_SVI accepts /v, /sv and /svi (cvttq only)
143 ;; U_SU_SUI accepts /u, /su and /sui (most fp instructions)
145 ;; The actual suffix emitted is controlled by alpha_fptm.
147 (define_attr "trap_suffix" "none,su,sui,v_sv,v_sv_svi,u_su_sui"
148 (const_string "none"))
150 ;; The length of an instruction sequence in bytes.
152 (define_attr "length" ""
155 ;; The USEGP attribute marks instructions that have relocations that use
158 (define_attr "usegp" "no,yes"
159 (cond [(eq_attr "type" "ldsym,jsr")
161 (eq_attr "type" "ild,fld,ist,fst")
162 (symbol_ref "alpha_find_lo_sum_using_gp(insn)")
164 (const_string "no")))
166 ;; The CANNOT_COPY attribute marks instructions with relocations that
167 ;; cannot easily be duplicated. This includes insns with gpdisp relocs
168 ;; since they have to stay in 1-1 correspondence with one another. This
169 ;; also includes jsr insns, since they must stay in correspondence with
170 ;; the immediately following gpdisp instructions.
172 (define_attr "cannot_copy" "false,true"
173 (const_string "false"))
175 ;; Include scheduling descriptions.
182 ;; Operand and operator predicates and constraints
184 (include "predicates.md")
185 (include "constraints.md")
188 ;; First define the arithmetic insns. Note that the 32-bit forms also
191 ;; Handle 32-64 bit extension from memory to a floating point register
192 ;; specially, since this occurs frequently in int->double conversions.
194 ;; Note that while we must retain the =f case in the insn for reload's
195 ;; benefit, it should be eliminated after reload, so we should never emit
196 ;; code for that case. But we don't reject the possibility.
198 (define_expand "extendsidi2"
199 [(set (match_operand:DI 0 "register_operand" "")
200 (sign_extend:DI (match_operand:SI 1 "nonimmediate_operand" "")))]
204 (define_insn "*cvtlq"
205 [(set (match_operand:DI 0 "register_operand" "=f")
206 (unspec:DI [(match_operand:SF 1 "reg_or_0_operand" "fG")]
210 [(set_attr "type" "fadd")])
212 (define_insn "*extendsidi2_1"
213 [(set (match_operand:DI 0 "register_operand" "=r,r,!*f")
215 (match_operand:SI 1 "nonimmediate_operand" "r,m,m")))]
220 lds %0,%1\;cvtlq %0,%0"
221 [(set_attr "type" "iadd,ild,fld")
222 (set_attr "length" "*,*,8")])
225 [(set (match_operand:DI 0 "hard_fp_register_operand" "")
226 (sign_extend:DI (match_operand:SI 1 "memory_operand" "")))]
228 [(set (match_dup 2) (match_dup 1))
229 (set (match_dup 0) (unspec:DI [(match_dup 2)] UNSPEC_CVTLQ))]
231 operands[1] = adjust_address (operands[1], SFmode, 0);
232 operands[2] = gen_rtx_REG (SFmode, REGNO (operands[0]));
235 ;; Optimize sign-extension of SImode loads. This shows up in the wake of
236 ;; reload when converting fp->int.
239 [(set (match_operand:SI 0 "hard_int_register_operand" "")
240 (match_operand:SI 1 "memory_operand" ""))
241 (set (match_operand:DI 2 "hard_int_register_operand" "")
242 (sign_extend:DI (match_dup 0)))]
243 "true_regnum (operands[0]) == true_regnum (operands[2])
244 || peep2_reg_dead_p (2, operands[0])"
246 (sign_extend:DI (match_dup 1)))]
249 ;; Don't say we have addsi3 if optimizing. This generates better code. We
250 ;; have the anonymous addsi3 pattern below in case combine wants to make it.
251 (define_expand "addsi3"
252 [(set (match_operand:SI 0 "register_operand" "")
253 (plus:SI (match_operand:SI 1 "reg_or_0_operand" "")
254 (match_operand:SI 2 "add_operand" "")))]
258 (define_insn "*addsi_internal"
259 [(set (match_operand:SI 0 "register_operand" "=r,r,r,r")
260 (plus:SI (match_operand:SI 1 "reg_or_0_operand" "%rJ,rJ,rJ,rJ")
261 (match_operand:SI 2 "add_operand" "rI,O,K,L")))]
270 [(set (match_operand:SI 0 "register_operand" "")
271 (plus:SI (match_operand:SI 1 "register_operand" "")
272 (match_operand:SI 2 "const_int_operand" "")))]
273 "! add_operand (operands[2], SImode)"
274 [(set (match_dup 0) (plus:SI (match_dup 1) (match_dup 3)))
275 (set (match_dup 0) (plus:SI (match_dup 0) (match_dup 4)))]
277 HOST_WIDE_INT val = INTVAL (operands[2]);
278 HOST_WIDE_INT low = (val & 0xffff) - 2 * (val & 0x8000);
279 HOST_WIDE_INT rest = val - low;
281 operands[3] = GEN_INT (rest);
282 operands[4] = GEN_INT (low);
285 (define_insn "*addsi_se"
286 [(set (match_operand:DI 0 "register_operand" "=r,r")
288 (plus:SI (match_operand:SI 1 "reg_or_0_operand" "%rJ,rJ")
289 (match_operand:SI 2 "sext_add_operand" "rI,O"))))]
295 (define_insn "*addsi_se2"
296 [(set (match_operand:DI 0 "register_operand" "=r,r")
298 (subreg:SI (plus:DI (match_operand:DI 1 "reg_or_0_operand" "%rJ,rJ")
299 (match_operand:DI 2 "sext_add_operand" "rI,O"))
307 [(set (match_operand:DI 0 "register_operand" "")
309 (plus:SI (match_operand:SI 1 "reg_not_elim_operand" "")
310 (match_operand:SI 2 "const_int_operand" ""))))
311 (clobber (match_operand:SI 3 "reg_not_elim_operand" ""))]
312 "! sext_add_operand (operands[2], SImode) && INTVAL (operands[2]) > 0
313 && INTVAL (operands[2]) % 4 == 0"
314 [(set (match_dup 3) (match_dup 4))
315 (set (match_dup 0) (sign_extend:DI (plus:SI (mult:SI (match_dup 3)
319 HOST_WIDE_INT val = INTVAL (operands[2]) / 4;
325 operands[4] = GEN_INT (val);
326 operands[5] = GEN_INT (mult);
330 [(set (match_operand:DI 0 "register_operand" "")
332 (plus:SI (match_operator:SI 1 "comparison_operator"
333 [(match_operand 2 "" "")
334 (match_operand 3 "" "")])
335 (match_operand:SI 4 "add_operand" ""))))
336 (clobber (match_operand:DI 5 "register_operand" ""))]
338 [(set (match_dup 5) (match_dup 6))
339 (set (match_dup 0) (sign_extend:DI (plus:SI (match_dup 7) (match_dup 4))))]
341 operands[6] = gen_rtx_fmt_ee (GET_CODE (operands[1]), DImode,
342 operands[2], operands[3]);
343 operands[7] = gen_lowpart (SImode, operands[5]);
346 (define_insn "addvsi3"
347 [(set (match_operand:SI 0 "register_operand" "=r,r")
348 (plus:SI (match_operand:SI 1 "reg_or_0_operand" "%rJ,rJ")
349 (match_operand:SI 2 "sext_add_operand" "rI,O")))
350 (trap_if (ne (plus:DI (sign_extend:DI (match_dup 1))
351 (sign_extend:DI (match_dup 2)))
352 (sign_extend:DI (plus:SI (match_dup 1)
360 (define_expand "adddi3"
361 [(set (match_operand:DI 0 "register_operand" "")
362 (plus:DI (match_operand:DI 1 "register_operand" "")
363 (match_operand:DI 2 "add_operand" "")))]
367 (define_insn "*adddi_er_lo16_dtp"
368 [(set (match_operand:DI 0 "register_operand" "=r")
369 (lo_sum:DI (match_operand:DI 1 "register_operand" "r")
370 (match_operand:DI 2 "dtp16_symbolic_operand" "")))]
372 "lda %0,%2(%1)\t\t!dtprel")
374 (define_insn "*adddi_er_hi32_dtp"
375 [(set (match_operand:DI 0 "register_operand" "=r")
376 (plus:DI (match_operand:DI 1 "register_operand" "r")
377 (high:DI (match_operand:DI 2 "dtp32_symbolic_operand" ""))))]
379 "ldah %0,%2(%1)\t\t!dtprelhi")
381 (define_insn "*adddi_er_lo32_dtp"
382 [(set (match_operand:DI 0 "register_operand" "=r")
383 (lo_sum:DI (match_operand:DI 1 "register_operand" "r")
384 (match_operand:DI 2 "dtp32_symbolic_operand" "")))]
386 "lda %0,%2(%1)\t\t!dtprello")
388 (define_insn "*adddi_er_lo16_tp"
389 [(set (match_operand:DI 0 "register_operand" "=r")
390 (lo_sum:DI (match_operand:DI 1 "register_operand" "r")
391 (match_operand:DI 2 "tp16_symbolic_operand" "")))]
393 "lda %0,%2(%1)\t\t!tprel")
395 (define_insn "*adddi_er_hi32_tp"
396 [(set (match_operand:DI 0 "register_operand" "=r")
397 (plus:DI (match_operand:DI 1 "register_operand" "r")
398 (high:DI (match_operand:DI 2 "tp32_symbolic_operand" ""))))]
400 "ldah %0,%2(%1)\t\t!tprelhi")
402 (define_insn "*adddi_er_lo32_tp"
403 [(set (match_operand:DI 0 "register_operand" "=r")
404 (lo_sum:DI (match_operand:DI 1 "register_operand" "r")
405 (match_operand:DI 2 "tp32_symbolic_operand" "")))]
407 "lda %0,%2(%1)\t\t!tprello")
409 (define_insn "*adddi_er_high_l"
410 [(set (match_operand:DI 0 "register_operand" "=r")
411 (plus:DI (match_operand:DI 1 "register_operand" "r")
412 (high:DI (match_operand:DI 2 "local_symbolic_operand" ""))))]
413 "TARGET_EXPLICIT_RELOCS && reload_completed"
414 "ldah %0,%2(%1)\t\t!gprelhigh"
415 [(set_attr "usegp" "yes")])
418 [(set (match_operand:DI 0 "register_operand" "")
419 (high:DI (match_operand:DI 1 "local_symbolic_operand" "")))]
420 "TARGET_EXPLICIT_RELOCS && reload_completed"
422 (plus:DI (match_dup 2) (high:DI (match_dup 1))))]
423 "operands[2] = pic_offset_table_rtx;")
425 ;; We used to expend quite a lot of effort choosing addq/subq/lda.
426 ;; With complications like
428 ;; The NT stack unwind code can't handle a subq to adjust the stack
429 ;; (that's a bug, but not one we can do anything about). As of NT4.0 SP3,
430 ;; the exception handling code will loop if a subq is used and an
433 ;; The 19980616 change to emit prologues as RTL also confused some
434 ;; versions of GDB, which also interprets prologues. This has been
435 ;; fixed as of GDB 4.18, but it does not harm to unconditionally
438 ;; and the fact that the three insns schedule exactly the same, it's
439 ;; just not worth the effort.
441 (define_insn "*adddi_internal"
442 [(set (match_operand:DI 0 "register_operand" "=r,r,r")
443 (plus:DI (match_operand:DI 1 "register_operand" "%r,r,r")
444 (match_operand:DI 2 "add_operand" "r,K,L")))]
451 ;; ??? Allow large constants when basing off the frame pointer or some
452 ;; virtual register that may eliminate to the frame pointer. This is
453 ;; done because register elimination offsets will change the hi/lo split,
454 ;; and if we split before reload, we will require additional instructions.
456 (define_insn "*adddi_fp_hack"
457 [(set (match_operand:DI 0 "register_operand" "=r,r,r")
458 (plus:DI (match_operand:DI 1 "reg_no_subreg_operand" "r,r,r")
459 (match_operand:DI 2 "const_int_operand" "K,L,n")))]
460 "NONSTRICT_REG_OK_FP_BASE_P (operands[1])
461 && INTVAL (operands[2]) >= 0
462 /* This is the largest constant an lda+ldah pair can add, minus
463 an upper bound on the displacement between SP and AP during
464 register elimination. See INITIAL_ELIMINATION_OFFSET. */
465 && INTVAL (operands[2])
467 - FIRST_PSEUDO_REGISTER * UNITS_PER_WORD
468 - ALPHA_ROUND(current_function_outgoing_args_size)
469 - (ALPHA_ROUND (get_frame_size ()
470 + max_reg_num () * UNITS_PER_WORD
471 + current_function_pretend_args_size)
472 - 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;
494 rtx rest_rtx = GEN_INT (rest);
496 operands[4] = GEN_INT (low);
497 if (satisfies_constraint_L (rest_rtx))
498 operands[3] = rest_rtx;
499 else if (! no_new_pseudos)
501 operands[3] = gen_reg_rtx (DImode);
502 emit_move_insn (operands[3], operands[2]);
503 emit_insn (gen_adddi3 (operands[0], operands[1], operands[3]));
510 (define_insn "*saddl"
511 [(set (match_operand:SI 0 "register_operand" "=r,r")
512 (plus:SI (mult:SI (match_operand:SI 1 "reg_not_elim_operand" "r,r")
513 (match_operand:SI 2 "const48_operand" "I,I"))
514 (match_operand:SI 3 "sext_add_operand" "rI,O")))]
520 (define_insn "*saddl_se"
521 [(set (match_operand:DI 0 "register_operand" "=r,r")
523 (plus:SI (mult:SI (match_operand:SI 1 "reg_not_elim_operand" "r,r")
524 (match_operand:SI 2 "const48_operand" "I,I"))
525 (match_operand:SI 3 "sext_add_operand" "rI,O"))))]
532 [(set (match_operand:DI 0 "register_operand" "")
534 (plus:SI (mult:SI (match_operator:SI 1 "comparison_operator"
535 [(match_operand 2 "" "")
536 (match_operand 3 "" "")])
537 (match_operand:SI 4 "const48_operand" ""))
538 (match_operand:SI 5 "sext_add_operand" ""))))
539 (clobber (match_operand:DI 6 "reg_not_elim_operand" ""))]
541 [(set (match_dup 6) (match_dup 7))
543 (sign_extend:DI (plus:SI (mult:SI (match_dup 8) (match_dup 4))
546 operands[7] = gen_rtx_fmt_ee (GET_CODE (operands[1]), DImode,
547 operands[2], operands[3]);
548 operands[8] = gen_lowpart (SImode, operands[6]);
551 (define_insn "*saddq"
552 [(set (match_operand:DI 0 "register_operand" "=r,r")
553 (plus:DI (mult:DI (match_operand:DI 1 "reg_not_elim_operand" "r,r")
554 (match_operand:DI 2 "const48_operand" "I,I"))
555 (match_operand:DI 3 "sext_add_operand" "rI,O")))]
561 (define_insn "addvdi3"
562 [(set (match_operand:DI 0 "register_operand" "=r,r")
563 (plus:DI (match_operand:DI 1 "reg_or_0_operand" "%rJ,rJ")
564 (match_operand:DI 2 "sext_add_operand" "rI,O")))
565 (trap_if (ne (plus:TI (sign_extend:TI (match_dup 1))
566 (sign_extend:TI (match_dup 2)))
567 (sign_extend:TI (plus:DI (match_dup 1)
575 (define_insn "negsi2"
576 [(set (match_operand:SI 0 "register_operand" "=r")
577 (neg:SI (match_operand:SI 1 "reg_or_8bit_operand" "rI")))]
581 (define_insn "*negsi_se"
582 [(set (match_operand:DI 0 "register_operand" "=r")
583 (sign_extend:DI (neg:SI
584 (match_operand:SI 1 "reg_or_8bit_operand" "rI"))))]
588 (define_insn "negvsi2"
589 [(set (match_operand:SI 0 "register_operand" "=r")
590 (neg:SI (match_operand:SI 1 "register_operand" "r")))
591 (trap_if (ne (neg:DI (sign_extend:DI (match_dup 1)))
592 (sign_extend:DI (neg:SI (match_dup 1))))
597 (define_insn "negdi2"
598 [(set (match_operand:DI 0 "register_operand" "=r")
599 (neg:DI (match_operand:DI 1 "reg_or_8bit_operand" "rI")))]
603 (define_insn "negvdi2"
604 [(set (match_operand:DI 0 "register_operand" "=r")
605 (neg:DI (match_operand:DI 1 "register_operand" "r")))
606 (trap_if (ne (neg:TI (sign_extend:TI (match_dup 1)))
607 (sign_extend:TI (neg:DI (match_dup 1))))
612 (define_expand "subsi3"
613 [(set (match_operand:SI 0 "register_operand" "")
614 (minus:SI (match_operand:SI 1 "reg_or_0_operand" "")
615 (match_operand:SI 2 "reg_or_8bit_operand" "")))]
619 (define_insn "*subsi_internal"
620 [(set (match_operand:SI 0 "register_operand" "=r")
621 (minus:SI (match_operand:SI 1 "reg_or_0_operand" "rJ")
622 (match_operand:SI 2 "reg_or_8bit_operand" "rI")))]
626 (define_insn "*subsi_se"
627 [(set (match_operand:DI 0 "register_operand" "=r")
628 (sign_extend:DI (minus:SI (match_operand:SI 1 "reg_or_0_operand" "rJ")
629 (match_operand:SI 2 "reg_or_8bit_operand" "rI"))))]
633 (define_insn "*subsi_se2"
634 [(set (match_operand:DI 0 "register_operand" "=r")
636 (subreg:SI (minus:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
637 (match_operand:DI 2 "reg_or_8bit_operand" "rI"))
642 (define_insn "subvsi3"
643 [(set (match_operand:SI 0 "register_operand" "=r")
644 (minus:SI (match_operand:SI 1 "reg_or_0_operand" "rJ")
645 (match_operand:SI 2 "reg_or_8bit_operand" "rI")))
646 (trap_if (ne (minus:DI (sign_extend:DI (match_dup 1))
647 (sign_extend:DI (match_dup 2)))
648 (sign_extend:DI (minus:SI (match_dup 1)
654 (define_insn "subdi3"
655 [(set (match_operand:DI 0 "register_operand" "=r")
656 (minus:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
657 (match_operand:DI 2 "reg_or_8bit_operand" "rI")))]
661 (define_insn "*ssubl"
662 [(set (match_operand:SI 0 "register_operand" "=r")
663 (minus:SI (mult:SI (match_operand:SI 1 "reg_not_elim_operand" "r")
664 (match_operand:SI 2 "const48_operand" "I"))
665 (match_operand:SI 3 "reg_or_8bit_operand" "rI")))]
669 (define_insn "*ssubl_se"
670 [(set (match_operand:DI 0 "register_operand" "=r")
672 (minus:SI (mult:SI (match_operand:SI 1 "reg_not_elim_operand" "r")
673 (match_operand:SI 2 "const48_operand" "I"))
674 (match_operand:SI 3 "reg_or_8bit_operand" "rI"))))]
678 (define_insn "*ssubq"
679 [(set (match_operand:DI 0 "register_operand" "=r")
680 (minus:DI (mult:DI (match_operand:DI 1 "reg_not_elim_operand" "r")
681 (match_operand:DI 2 "const48_operand" "I"))
682 (match_operand:DI 3 "reg_or_8bit_operand" "rI")))]
686 (define_insn "subvdi3"
687 [(set (match_operand:DI 0 "register_operand" "=r")
688 (minus:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
689 (match_operand:DI 2 "reg_or_8bit_operand" "rI")))
690 (trap_if (ne (minus:TI (sign_extend:TI (match_dup 1))
691 (sign_extend:TI (match_dup 2)))
692 (sign_extend:TI (minus:DI (match_dup 1)
698 ;; The Unicos/Mk assembler doesn't support mull.
700 (define_insn "mulsi3"
701 [(set (match_operand:SI 0 "register_operand" "=r")
702 (mult:SI (match_operand:SI 1 "reg_or_0_operand" "%rJ")
703 (match_operand:SI 2 "reg_or_8bit_operand" "rI")))]
704 "!TARGET_ABI_UNICOSMK"
706 [(set_attr "type" "imul")
707 (set_attr "opsize" "si")])
709 (define_insn "*mulsi_se"
710 [(set (match_operand:DI 0 "register_operand" "=r")
712 (mult:SI (match_operand:SI 1 "reg_or_0_operand" "%rJ")
713 (match_operand:SI 2 "reg_or_8bit_operand" "rI"))))]
714 "!TARGET_ABI_UNICOSMK"
716 [(set_attr "type" "imul")
717 (set_attr "opsize" "si")])
719 (define_insn "mulvsi3"
720 [(set (match_operand:SI 0 "register_operand" "=r")
721 (mult:SI (match_operand:SI 1 "reg_or_0_operand" "%rJ")
722 (match_operand:SI 2 "reg_or_8bit_operand" "rI")))
723 (trap_if (ne (mult:DI (sign_extend:DI (match_dup 1))
724 (sign_extend:DI (match_dup 2)))
725 (sign_extend:DI (mult:SI (match_dup 1)
728 "!TARGET_ABI_UNICOSMK"
730 [(set_attr "type" "imul")
731 (set_attr "opsize" "si")])
733 (define_insn "muldi3"
734 [(set (match_operand:DI 0 "register_operand" "=r")
735 (mult:DI (match_operand:DI 1 "reg_or_0_operand" "%rJ")
736 (match_operand:DI 2 "reg_or_8bit_operand" "rI")))]
739 [(set_attr "type" "imul")])
741 (define_insn "mulvdi3"
742 [(set (match_operand:DI 0 "register_operand" "=r")
743 (mult:DI (match_operand:DI 1 "reg_or_0_operand" "%rJ")
744 (match_operand:DI 2 "reg_or_8bit_operand" "rI")))
745 (trap_if (ne (mult:TI (sign_extend:TI (match_dup 1))
746 (sign_extend:TI (match_dup 2)))
747 (sign_extend:TI (mult:DI (match_dup 1)
752 [(set_attr "type" "imul")])
754 (define_expand "umuldi3_highpart"
755 [(set (match_operand:DI 0 "register_operand" "")
758 (mult:TI (zero_extend:TI
759 (match_operand:DI 1 "register_operand" ""))
760 (match_operand:DI 2 "reg_or_8bit_operand" ""))
764 if (REG_P (operands[2]))
765 operands[2] = gen_rtx_ZERO_EXTEND (TImode, operands[2]);
768 (define_insn "*umuldi3_highpart_reg"
769 [(set (match_operand:DI 0 "register_operand" "=r")
772 (mult:TI (zero_extend:TI
773 (match_operand:DI 1 "register_operand" "r"))
775 (match_operand:DI 2 "register_operand" "r")))
779 [(set_attr "type" "imul")
780 (set_attr "opsize" "udi")])
782 (define_insn "*umuldi3_highpart_const"
783 [(set (match_operand:DI 0 "register_operand" "=r")
786 (mult:TI (zero_extend:TI (match_operand:DI 1 "register_operand" "r"))
787 (match_operand:TI 2 "cint8_operand" "I"))
791 [(set_attr "type" "imul")
792 (set_attr "opsize" "udi")])
794 ;; The divide and remainder operations take their inputs from r24 and
795 ;; r25, put their output in r27, and clobber r23 and r28 on all
796 ;; systems except Unicos/Mk. On Unicos, the standard library provides
797 ;; subroutines which use the standard calling convention and work on
800 ;; ??? Force sign-extension here because some versions of OSF/1 and
801 ;; Interix/NT don't do the right thing if the inputs are not properly
802 ;; sign-extended. But Linux, for instance, does not have this
803 ;; problem. Is it worth the complication here to eliminate the sign
806 (define_expand "divsi3"
808 (sign_extend:DI (match_operand:SI 1 "nonimmediate_operand" "")))
810 (sign_extend:DI (match_operand:SI 2 "nonimmediate_operand" "")))
811 (parallel [(set (match_dup 5)
812 (sign_extend:DI (div:SI (match_dup 3) (match_dup 4))))
813 (clobber (reg:DI 23))
814 (clobber (reg:DI 28))])
815 (set (match_operand:SI 0 "nonimmediate_operand" "")
816 (subreg:SI (match_dup 5) 0))]
817 "! TARGET_ABI_OPEN_VMS && ! TARGET_ABI_UNICOSMK"
819 operands[3] = gen_reg_rtx (DImode);
820 operands[4] = gen_reg_rtx (DImode);
821 operands[5] = gen_reg_rtx (DImode);
824 (define_expand "udivsi3"
826 (sign_extend:DI (match_operand:SI 1 "nonimmediate_operand" "")))
828 (sign_extend:DI (match_operand:SI 2 "nonimmediate_operand" "")))
829 (parallel [(set (match_dup 5)
830 (sign_extend:DI (udiv:SI (match_dup 3) (match_dup 4))))
831 (clobber (reg:DI 23))
832 (clobber (reg:DI 28))])
833 (set (match_operand:SI 0 "nonimmediate_operand" "")
834 (subreg:SI (match_dup 5) 0))]
835 "! TARGET_ABI_OPEN_VMS && ! TARGET_ABI_UNICOSMK"
837 operands[3] = gen_reg_rtx (DImode);
838 operands[4] = gen_reg_rtx (DImode);
839 operands[5] = gen_reg_rtx (DImode);
842 (define_expand "modsi3"
844 (sign_extend:DI (match_operand:SI 1 "nonimmediate_operand" "")))
846 (sign_extend:DI (match_operand:SI 2 "nonimmediate_operand" "")))
847 (parallel [(set (match_dup 5)
848 (sign_extend:DI (mod:SI (match_dup 3) (match_dup 4))))
849 (clobber (reg:DI 23))
850 (clobber (reg:DI 28))])
851 (set (match_operand:SI 0 "nonimmediate_operand" "")
852 (subreg:SI (match_dup 5) 0))]
853 "! TARGET_ABI_OPEN_VMS && ! TARGET_ABI_UNICOSMK"
855 operands[3] = gen_reg_rtx (DImode);
856 operands[4] = gen_reg_rtx (DImode);
857 operands[5] = gen_reg_rtx (DImode);
860 (define_expand "umodsi3"
862 (sign_extend:DI (match_operand:SI 1 "nonimmediate_operand" "")))
864 (sign_extend:DI (match_operand:SI 2 "nonimmediate_operand" "")))
865 (parallel [(set (match_dup 5)
866 (sign_extend:DI (umod:SI (match_dup 3) (match_dup 4))))
867 (clobber (reg:DI 23))
868 (clobber (reg:DI 28))])
869 (set (match_operand:SI 0 "nonimmediate_operand" "")
870 (subreg:SI (match_dup 5) 0))]
871 "! TARGET_ABI_OPEN_VMS && ! TARGET_ABI_UNICOSMK"
873 operands[3] = gen_reg_rtx (DImode);
874 operands[4] = gen_reg_rtx (DImode);
875 operands[5] = gen_reg_rtx (DImode);
878 (define_expand "divdi3"
879 [(parallel [(set (match_operand:DI 0 "register_operand" "")
880 (div:DI (match_operand:DI 1 "register_operand" "")
881 (match_operand:DI 2 "register_operand" "")))
882 (clobber (reg:DI 23))
883 (clobber (reg:DI 28))])]
884 "! TARGET_ABI_OPEN_VMS && ! TARGET_ABI_UNICOSMK"
887 (define_expand "udivdi3"
888 [(parallel [(set (match_operand:DI 0 "register_operand" "")
889 (udiv:DI (match_operand:DI 1 "register_operand" "")
890 (match_operand:DI 2 "register_operand" "")))
891 (clobber (reg:DI 23))
892 (clobber (reg:DI 28))])]
893 "! TARGET_ABI_OPEN_VMS && ! TARGET_ABI_UNICOSMK"
896 (define_expand "moddi3"
897 [(use (match_operand:DI 0 "register_operand" ""))
898 (use (match_operand:DI 1 "register_operand" ""))
899 (use (match_operand:DI 2 "register_operand" ""))]
900 "!TARGET_ABI_OPEN_VMS"
902 if (TARGET_ABI_UNICOSMK)
903 emit_insn (gen_moddi3_umk (operands[0], operands[1], operands[2]));
905 emit_insn (gen_moddi3_dft (operands[0], operands[1], operands[2]));
909 (define_expand "moddi3_dft"
910 [(parallel [(set (match_operand:DI 0 "register_operand" "")
911 (mod:DI (match_operand:DI 1 "register_operand" "")
912 (match_operand:DI 2 "register_operand" "")))
913 (clobber (reg:DI 23))
914 (clobber (reg:DI 28))])]
915 "! TARGET_ABI_OPEN_VMS && ! TARGET_ABI_UNICOSMK"
918 ;; On Unicos/Mk, we do as the system's C compiler does:
919 ;; compute the quotient, multiply and subtract.
921 (define_expand "moddi3_umk"
922 [(use (match_operand:DI 0 "register_operand" ""))
923 (use (match_operand:DI 1 "register_operand" ""))
924 (use (match_operand:DI 2 "register_operand" ""))]
925 "TARGET_ABI_UNICOSMK"
927 rtx div, mul = gen_reg_rtx (DImode);
929 div = expand_binop (DImode, sdiv_optab, operands[1], operands[2],
930 NULL_RTX, 0, OPTAB_LIB);
931 div = force_reg (DImode, div);
932 emit_insn (gen_muldi3 (mul, operands[2], div));
933 emit_insn (gen_subdi3 (operands[0], operands[1], mul));
937 (define_expand "umoddi3"
938 [(use (match_operand:DI 0 "register_operand" ""))
939 (use (match_operand:DI 1 "register_operand" ""))
940 (use (match_operand:DI 2 "register_operand" ""))]
941 "! TARGET_ABI_OPEN_VMS"
943 if (TARGET_ABI_UNICOSMK)
944 emit_insn (gen_umoddi3_umk (operands[0], operands[1], operands[2]));
946 emit_insn (gen_umoddi3_dft (operands[0], operands[1], operands[2]));
950 (define_expand "umoddi3_dft"
951 [(parallel [(set (match_operand:DI 0 "register_operand" "")
952 (umod:DI (match_operand:DI 1 "register_operand" "")
953 (match_operand:DI 2 "register_operand" "")))
954 (clobber (reg:DI 23))
955 (clobber (reg:DI 28))])]
956 "! TARGET_ABI_OPEN_VMS && ! TARGET_ABI_UNICOSMK"
959 (define_expand "umoddi3_umk"
960 [(use (match_operand:DI 0 "register_operand" ""))
961 (use (match_operand:DI 1 "register_operand" ""))
962 (use (match_operand:DI 2 "register_operand" ""))]
963 "TARGET_ABI_UNICOSMK"
965 rtx div, mul = gen_reg_rtx (DImode);
967 div = expand_binop (DImode, udiv_optab, operands[1], operands[2],
968 NULL_RTX, 1, OPTAB_LIB);
969 div = force_reg (DImode, div);
970 emit_insn (gen_muldi3 (mul, operands[2], div));
971 emit_insn (gen_subdi3 (operands[0], operands[1], mul));
975 ;; Lengths of 8 for ldq $t12,__divq($gp); jsr $t9,($t12),__divq as
976 ;; expanded by the assembler.
978 (define_insn_and_split "*divmodsi_internal_er"
979 [(set (match_operand:DI 0 "register_operand" "=c")
980 (sign_extend:DI (match_operator:SI 3 "divmod_operator"
981 [(match_operand:DI 1 "register_operand" "a")
982 (match_operand:DI 2 "register_operand" "b")])))
983 (clobber (reg:DI 23))
984 (clobber (reg:DI 28))]
985 "TARGET_EXPLICIT_RELOCS && ! TARGET_ABI_OPEN_VMS"
987 "&& reload_completed"
988 [(parallel [(set (match_dup 0)
989 (sign_extend:DI (match_dup 3)))
992 (clobber (reg:DI 23))
993 (clobber (reg:DI 28))])]
996 switch (GET_CODE (operands[3]))
1013 operands[4] = GEN_INT (alpha_next_sequence_number++);
1014 emit_insn (gen_movdi_er_high_g (operands[0], pic_offset_table_rtx,
1015 gen_rtx_SYMBOL_REF (DImode, str),
1018 [(set_attr "type" "jsr")
1019 (set_attr "length" "8")])
1021 (define_insn "*divmodsi_internal_er_1"
1022 [(set (match_operand:DI 0 "register_operand" "=c")
1023 (sign_extend:DI (match_operator:SI 3 "divmod_operator"
1024 [(match_operand:DI 1 "register_operand" "a")
1025 (match_operand:DI 2 "register_operand" "b")])))
1026 (use (match_operand:DI 4 "register_operand" "c"))
1027 (use (match_operand 5 "const_int_operand" ""))
1028 (clobber (reg:DI 23))
1029 (clobber (reg:DI 28))]
1030 "TARGET_EXPLICIT_RELOCS && ! TARGET_ABI_OPEN_VMS"
1031 "jsr $23,($27),__%E3%j5"
1032 [(set_attr "type" "jsr")
1033 (set_attr "length" "4")])
1035 (define_insn "*divmodsi_internal"
1036 [(set (match_operand:DI 0 "register_operand" "=c")
1037 (sign_extend:DI (match_operator:SI 3 "divmod_operator"
1038 [(match_operand:DI 1 "register_operand" "a")
1039 (match_operand:DI 2 "register_operand" "b")])))
1040 (clobber (reg:DI 23))
1041 (clobber (reg:DI 28))]
1042 "! TARGET_ABI_OPEN_VMS && ! TARGET_ABI_UNICOSMK"
1044 [(set_attr "type" "jsr")
1045 (set_attr "length" "8")])
1047 (define_insn_and_split "*divmoddi_internal_er"
1048 [(set (match_operand:DI 0 "register_operand" "=c")
1049 (match_operator:DI 3 "divmod_operator"
1050 [(match_operand:DI 1 "register_operand" "a")
1051 (match_operand:DI 2 "register_operand" "b")]))
1052 (clobber (reg:DI 23))
1053 (clobber (reg:DI 28))]
1054 "TARGET_EXPLICIT_RELOCS && ! TARGET_ABI_OPEN_VMS"
1056 "&& reload_completed"
1057 [(parallel [(set (match_dup 0) (match_dup 3))
1060 (clobber (reg:DI 23))
1061 (clobber (reg:DI 28))])]
1064 switch (GET_CODE (operands[3]))
1081 operands[4] = GEN_INT (alpha_next_sequence_number++);
1082 emit_insn (gen_movdi_er_high_g (operands[0], pic_offset_table_rtx,
1083 gen_rtx_SYMBOL_REF (DImode, str),
1086 [(set_attr "type" "jsr")
1087 (set_attr "length" "8")])
1089 (define_insn "*divmoddi_internal_er_1"
1090 [(set (match_operand:DI 0 "register_operand" "=c")
1091 (match_operator:DI 3 "divmod_operator"
1092 [(match_operand:DI 1 "register_operand" "a")
1093 (match_operand:DI 2 "register_operand" "b")]))
1094 (use (match_operand:DI 4 "register_operand" "c"))
1095 (use (match_operand 5 "const_int_operand" ""))
1096 (clobber (reg:DI 23))
1097 (clobber (reg:DI 28))]
1098 "TARGET_EXPLICIT_RELOCS && ! TARGET_ABI_OPEN_VMS"
1099 "jsr $23,($27),__%E3%j5"
1100 [(set_attr "type" "jsr")
1101 (set_attr "length" "4")])
1103 (define_insn "*divmoddi_internal"
1104 [(set (match_operand:DI 0 "register_operand" "=c")
1105 (match_operator:DI 3 "divmod_operator"
1106 [(match_operand:DI 1 "register_operand" "a")
1107 (match_operand:DI 2 "register_operand" "b")]))
1108 (clobber (reg:DI 23))
1109 (clobber (reg:DI 28))]
1110 "! TARGET_ABI_OPEN_VMS && ! TARGET_ABI_UNICOSMK"
1112 [(set_attr "type" "jsr")
1113 (set_attr "length" "8")])
1115 ;; Next are the basic logical operations. We only expose the DImode operations
1116 ;; to the rtl expanders, but SImode versions exist for combine as well as for
1117 ;; the atomic operation splitters.
1119 (define_insn "*andsi_internal"
1120 [(set (match_operand:SI 0 "register_operand" "=r,r,r")
1121 (and:SI (match_operand:SI 1 "reg_or_0_operand" "%rJ,rJ,rJ")
1122 (match_operand:SI 2 "and_operand" "rI,N,MH")))]
1128 [(set_attr "type" "ilog,ilog,shift")])
1130 (define_insn "anddi3"
1131 [(set (match_operand:DI 0 "register_operand" "=r,r,r")
1132 (and:DI (match_operand:DI 1 "reg_or_0_operand" "%rJ,rJ,rJ")
1133 (match_operand:DI 2 "and_operand" "rI,N,MH")))]
1139 [(set_attr "type" "ilog,ilog,shift")])
1141 ;; There are times when we can split an AND into two AND insns. This occurs
1142 ;; when we can first clear any bytes and then clear anything else. For
1143 ;; example "I & 0xffff07" is "(I & 0xffffff) & 0xffffffffffffff07".
1144 ;; Only do this when running on 64-bit host since the computations are
1145 ;; too messy otherwise.
1148 [(set (match_operand:DI 0 "register_operand" "")
1149 (and:DI (match_operand:DI 1 "register_operand" "")
1150 (match_operand:DI 2 "const_int_operand" "")))]
1151 "HOST_BITS_PER_WIDE_INT == 64 && ! and_operand (operands[2], DImode)"
1152 [(set (match_dup 0) (and:DI (match_dup 1) (match_dup 3)))
1153 (set (match_dup 0) (and:DI (match_dup 0) (match_dup 4)))]
1155 unsigned HOST_WIDE_INT mask1 = INTVAL (operands[2]);
1156 unsigned HOST_WIDE_INT mask2 = mask1;
1159 /* For each byte that isn't all zeros, make it all ones. */
1160 for (i = 0; i < 64; i += 8)
1161 if ((mask1 & ((HOST_WIDE_INT) 0xff << i)) != 0)
1162 mask1 |= (HOST_WIDE_INT) 0xff << i;
1164 /* Now turn on any bits we've just turned off. */
1167 operands[3] = GEN_INT (mask1);
1168 operands[4] = GEN_INT (mask2);
1171 (define_expand "zero_extendqihi2"
1172 [(set (match_operand:HI 0 "register_operand" "")
1173 (zero_extend:HI (match_operand:QI 1 "nonimmediate_operand" "")))]
1177 operands[1] = force_reg (QImode, operands[1]);
1180 (define_insn "*zero_extendqihi2_bwx"
1181 [(set (match_operand:HI 0 "register_operand" "=r,r")
1182 (zero_extend:HI (match_operand:QI 1 "nonimmediate_operand" "r,m")))]
1187 [(set_attr "type" "ilog,ild")])
1189 (define_insn "*zero_extendqihi2_nobwx"
1190 [(set (match_operand:HI 0 "register_operand" "=r")
1191 (zero_extend:HI (match_operand:QI 1 "register_operand" "r")))]
1194 [(set_attr "type" "ilog")])
1196 (define_expand "zero_extendqisi2"
1197 [(set (match_operand:SI 0 "register_operand" "")
1198 (zero_extend:SI (match_operand:QI 1 "nonimmediate_operand" "")))]
1202 operands[1] = force_reg (QImode, operands[1]);
1205 (define_insn "*zero_extendqisi2_bwx"
1206 [(set (match_operand:SI 0 "register_operand" "=r,r")
1207 (zero_extend:SI (match_operand:QI 1 "nonimmediate_operand" "r,m")))]
1212 [(set_attr "type" "ilog,ild")])
1214 (define_insn "*zero_extendqisi2_nobwx"
1215 [(set (match_operand:SI 0 "register_operand" "=r")
1216 (zero_extend:SI (match_operand:QI 1 "register_operand" "r")))]
1219 [(set_attr "type" "ilog")])
1221 (define_expand "zero_extendqidi2"
1222 [(set (match_operand:DI 0 "register_operand" "")
1223 (zero_extend:DI (match_operand:QI 1 "nonimmediate_operand" "")))]
1227 operands[1] = force_reg (QImode, operands[1]);
1230 (define_insn "*zero_extendqidi2_bwx"
1231 [(set (match_operand:DI 0 "register_operand" "=r,r")
1232 (zero_extend:DI (match_operand:QI 1 "nonimmediate_operand" "r,m")))]
1237 [(set_attr "type" "ilog,ild")])
1239 (define_insn "*zero_extendqidi2_nobwx"
1240 [(set (match_operand:DI 0 "register_operand" "=r")
1241 (zero_extend:DI (match_operand:QI 1 "register_operand" "r")))]
1244 [(set_attr "type" "ilog")])
1246 (define_expand "zero_extendhisi2"
1247 [(set (match_operand:SI 0 "register_operand" "")
1248 (zero_extend:SI (match_operand:HI 1 "nonimmediate_operand" "")))]
1252 operands[1] = force_reg (HImode, operands[1]);
1255 (define_insn "*zero_extendhisi2_bwx"
1256 [(set (match_operand:SI 0 "register_operand" "=r,r")
1257 (zero_extend:SI (match_operand:HI 1 "nonimmediate_operand" "r,m")))]
1262 [(set_attr "type" "shift,ild")])
1264 (define_insn "*zero_extendhisi2_nobwx"
1265 [(set (match_operand:SI 0 "register_operand" "=r")
1266 (zero_extend:SI (match_operand:HI 1 "register_operand" "r")))]
1269 [(set_attr "type" "shift")])
1271 (define_expand "zero_extendhidi2"
1272 [(set (match_operand:DI 0 "register_operand" "")
1273 (zero_extend:DI (match_operand:HI 1 "nonimmediate_operand" "")))]
1277 operands[1] = force_reg (HImode, operands[1]);
1280 (define_insn "*zero_extendhidi2_bwx"
1281 [(set (match_operand:DI 0 "register_operand" "=r,r")
1282 (zero_extend:DI (match_operand:HI 1 "nonimmediate_operand" "r,m")))]
1287 [(set_attr "type" "shift,ild")])
1289 (define_insn "*zero_extendhidi2_nobwx"
1290 [(set (match_operand:DI 0 "register_operand" "=r")
1291 (zero_extend:DI (match_operand:HI 1 "register_operand" "r")))]
1294 [(set_attr "type" "shift")])
1296 (define_insn "zero_extendsidi2"
1297 [(set (match_operand:DI 0 "register_operand" "=r")
1298 (zero_extend:DI (match_operand:SI 1 "register_operand" "r")))]
1301 [(set_attr "type" "shift")])
1303 (define_insn "*andnotsi3"
1304 [(set (match_operand:SI 0 "register_operand" "=r")
1305 (and:SI (not:SI (match_operand:SI 1 "reg_or_8bit_operand" "rI"))
1306 (match_operand:SI 2 "reg_or_0_operand" "rJ")))]
1309 [(set_attr "type" "ilog")])
1311 (define_insn "andnotdi3"
1312 [(set (match_operand:DI 0 "register_operand" "=r")
1313 (and:DI (not:DI (match_operand:DI 1 "reg_or_8bit_operand" "rI"))
1314 (match_operand:DI 2 "reg_or_0_operand" "rJ")))]
1317 [(set_attr "type" "ilog")])
1319 (define_insn "*iorsi_internal"
1320 [(set (match_operand:SI 0 "register_operand" "=r,r")
1321 (ior:SI (match_operand:SI 1 "reg_or_0_operand" "%rJ,rJ")
1322 (match_operand:SI 2 "or_operand" "rI,N")))]
1327 [(set_attr "type" "ilog")])
1329 (define_insn "iordi3"
1330 [(set (match_operand:DI 0 "register_operand" "=r,r")
1331 (ior:DI (match_operand:DI 1 "reg_or_0_operand" "%rJ,rJ")
1332 (match_operand:DI 2 "or_operand" "rI,N")))]
1337 [(set_attr "type" "ilog")])
1339 (define_insn "*one_cmplsi_internal"
1340 [(set (match_operand:SI 0 "register_operand" "=r")
1341 (not:SI (match_operand:SI 1 "reg_or_8bit_operand" "rI")))]
1344 [(set_attr "type" "ilog")])
1346 (define_insn "one_cmpldi2"
1347 [(set (match_operand:DI 0 "register_operand" "=r")
1348 (not:DI (match_operand:DI 1 "reg_or_8bit_operand" "rI")))]
1351 [(set_attr "type" "ilog")])
1353 (define_insn "*iornotsi3"
1354 [(set (match_operand:SI 0 "register_operand" "=r")
1355 (ior:SI (not:SI (match_operand:SI 1 "reg_or_8bit_operand" "rI"))
1356 (match_operand:SI 2 "reg_or_0_operand" "rJ")))]
1359 [(set_attr "type" "ilog")])
1361 (define_insn "*iornotdi3"
1362 [(set (match_operand:DI 0 "register_operand" "=r")
1363 (ior:DI (not:DI (match_operand:DI 1 "reg_or_8bit_operand" "rI"))
1364 (match_operand:DI 2 "reg_or_0_operand" "rJ")))]
1367 [(set_attr "type" "ilog")])
1369 (define_insn "*xorsi_internal"
1370 [(set (match_operand:SI 0 "register_operand" "=r,r")
1371 (xor:SI (match_operand:SI 1 "reg_or_0_operand" "%rJ,rJ")
1372 (match_operand:SI 2 "or_operand" "rI,N")))]
1377 [(set_attr "type" "ilog")])
1379 (define_insn "xordi3"
1380 [(set (match_operand:DI 0 "register_operand" "=r,r")
1381 (xor:DI (match_operand:DI 1 "reg_or_0_operand" "%rJ,rJ")
1382 (match_operand:DI 2 "or_operand" "rI,N")))]
1387 [(set_attr "type" "ilog")])
1389 (define_insn "*xornotsi3"
1390 [(set (match_operand:SI 0 "register_operand" "=r")
1391 (not:SI (xor:SI (match_operand:SI 1 "register_operand" "%rJ")
1392 (match_operand:SI 2 "register_operand" "rI"))))]
1395 [(set_attr "type" "ilog")])
1397 (define_insn "*xornotdi3"
1398 [(set (match_operand:DI 0 "register_operand" "=r")
1399 (not:DI (xor:DI (match_operand:DI 1 "register_operand" "%rJ")
1400 (match_operand:DI 2 "register_operand" "rI"))))]
1403 [(set_attr "type" "ilog")])
1405 ;; Handle FFS and related insns iff we support CIX.
1407 (define_expand "ffsdi2"
1409 (ctz:DI (match_operand:DI 1 "register_operand" "")))
1411 (plus:DI (match_dup 2) (const_int 1)))
1412 (set (match_operand:DI 0 "register_operand" "")
1413 (if_then_else:DI (eq (match_dup 1) (const_int 0))
1414 (const_int 0) (match_dup 3)))]
1417 operands[2] = gen_reg_rtx (DImode);
1418 operands[3] = gen_reg_rtx (DImode);
1421 (define_insn "clzdi2"
1422 [(set (match_operand:DI 0 "register_operand" "=r")
1423 (clz:DI (match_operand:DI 1 "register_operand" "r")))]
1426 [(set_attr "type" "mvi")])
1428 (define_insn "ctzdi2"
1429 [(set (match_operand:DI 0 "register_operand" "=r")
1430 (ctz:DI (match_operand:DI 1 "register_operand" "r")))]
1433 [(set_attr "type" "mvi")])
1435 (define_insn "popcountdi2"
1436 [(set (match_operand:DI 0 "register_operand" "=r")
1437 (popcount:DI (match_operand:DI 1 "register_operand" "r")))]
1440 [(set_attr "type" "mvi")])
1442 (define_expand "bswapsi2"
1443 [(set (match_operand:SI 0 "register_operand" "")
1444 (bswap:SI (match_operand:SI 1 "register_operand" "")))]
1449 t0 = gen_reg_rtx (DImode);
1450 t1 = gen_reg_rtx (DImode);
1452 emit_insn (gen_insxh (t0, gen_lowpart (DImode, operands[1]),
1453 GEN_INT (32), GEN_INT (WORDS_BIG_ENDIAN ? 0 : 7)));
1454 emit_insn (gen_inswl_const (t1, gen_lowpart (HImode, operands[1]),
1456 emit_insn (gen_iordi3 (t1, t0, t1));
1457 emit_insn (gen_lshrdi3 (t0, t1, GEN_INT (16)));
1458 emit_insn (gen_anddi3 (t1, t1, alpha_expand_zap_mask (0x5)));
1459 emit_insn (gen_anddi3 (t0, t0, alpha_expand_zap_mask (0xa)));
1460 emit_insn (gen_addsi3 (operands[0], gen_lowpart (SImode, t0),
1461 gen_lowpart (SImode, t1)));
1465 (define_expand "bswapdi2"
1466 [(set (match_operand:DI 0 "register_operand" "")
1467 (bswap:DI (match_operand:DI 1 "register_operand" "")))]
1472 t0 = gen_reg_rtx (DImode);
1473 t1 = gen_reg_rtx (DImode);
1475 /* This method of shifting and masking is not specific to Alpha, but
1476 is only profitable on Alpha because of our handy byte zap insn. */
1478 emit_insn (gen_lshrdi3 (t0, operands[1], GEN_INT (32)));
1479 emit_insn (gen_ashldi3 (t1, operands[1], GEN_INT (32)));
1480 emit_insn (gen_iordi3 (t1, t0, t1));
1482 emit_insn (gen_lshrdi3 (t0, t1, GEN_INT (16)));
1483 emit_insn (gen_ashldi3 (t1, t1, GEN_INT (16)));
1484 emit_insn (gen_anddi3 (t0, t0, alpha_expand_zap_mask (0xcc)));
1485 emit_insn (gen_anddi3 (t1, t1, alpha_expand_zap_mask (0x33)));
1486 emit_insn (gen_iordi3 (t1, t0, t1));
1488 emit_insn (gen_lshrdi3 (t0, t1, GEN_INT (8)));
1489 emit_insn (gen_ashldi3 (t1, t1, GEN_INT (8)));
1490 emit_insn (gen_anddi3 (t0, t0, alpha_expand_zap_mask (0xaa)));
1491 emit_insn (gen_anddi3 (t1, t1, alpha_expand_zap_mask (0x55)));
1492 emit_insn (gen_iordi3 (operands[0], t0, t1));
1496 ;; Next come the shifts and the various extract and insert operations.
1498 (define_insn "ashldi3"
1499 [(set (match_operand:DI 0 "register_operand" "=r,r")
1500 (ashift:DI (match_operand:DI 1 "reg_or_0_operand" "rJ,rJ")
1501 (match_operand:DI 2 "reg_or_6bit_operand" "P,rS")))]
1504 switch (which_alternative)
1507 if (operands[2] == const1_rtx)
1508 return "addq %r1,%r1,%0";
1510 return "s%P2addq %r1,0,%0";
1512 return "sll %r1,%2,%0";
1517 [(set_attr "type" "iadd,shift")])
1519 (define_insn "*ashldi_se"
1520 [(set (match_operand:DI 0 "register_operand" "=r")
1522 (subreg:SI (ashift:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
1523 (match_operand:DI 2 "const_int_operand" "P"))
1525 "INTVAL (operands[2]) >= 1 && INTVAL (operands[2]) <= 3"
1527 if (operands[2] == const1_rtx)
1528 return "addl %r1,%r1,%0";
1530 return "s%P2addl %r1,0,%0";
1532 [(set_attr "type" "iadd")])
1534 (define_insn "lshrdi3"
1535 [(set (match_operand:DI 0 "register_operand" "=r")
1536 (lshiftrt:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
1537 (match_operand:DI 2 "reg_or_6bit_operand" "rS")))]
1540 [(set_attr "type" "shift")])
1542 (define_insn "ashrdi3"
1543 [(set (match_operand:DI 0 "register_operand" "=r")
1544 (ashiftrt:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
1545 (match_operand:DI 2 "reg_or_6bit_operand" "rS")))]
1548 [(set_attr "type" "shift")])
1550 (define_expand "extendqihi2"
1552 (ashift:DI (match_operand:QI 1 "some_operand" "")
1554 (set (match_operand:HI 0 "register_operand" "")
1555 (ashiftrt:DI (match_dup 2)
1561 emit_insn (gen_extendqihi2x (operands[0],
1562 force_reg (QImode, operands[1])));
1566 /* If we have an unaligned MEM, extend to DImode (which we do
1567 specially) and then copy to the result. */
1568 if (unaligned_memory_operand (operands[1], HImode))
1570 rtx temp = gen_reg_rtx (DImode);
1572 emit_insn (gen_extendqidi2 (temp, operands[1]));
1573 emit_move_insn (operands[0], gen_lowpart (HImode, temp));
1577 operands[0] = gen_lowpart (DImode, operands[0]);
1578 operands[1] = gen_lowpart (DImode, force_reg (QImode, operands[1]));
1579 operands[2] = gen_reg_rtx (DImode);
1582 (define_insn "extendqidi2x"
1583 [(set (match_operand:DI 0 "register_operand" "=r")
1584 (sign_extend:DI (match_operand:QI 1 "register_operand" "r")))]
1587 [(set_attr "type" "shift")])
1589 (define_insn "extendhidi2x"
1590 [(set (match_operand:DI 0 "register_operand" "=r")
1591 (sign_extend:DI (match_operand:HI 1 "register_operand" "r")))]
1594 [(set_attr "type" "shift")])
1596 (define_insn "extendqisi2x"
1597 [(set (match_operand:SI 0 "register_operand" "=r")
1598 (sign_extend:SI (match_operand:QI 1 "register_operand" "r")))]
1601 [(set_attr "type" "shift")])
1603 (define_insn "extendhisi2x"
1604 [(set (match_operand:SI 0 "register_operand" "=r")
1605 (sign_extend:SI (match_operand:HI 1 "register_operand" "r")))]
1608 [(set_attr "type" "shift")])
1610 (define_insn "extendqihi2x"
1611 [(set (match_operand:HI 0 "register_operand" "=r")
1612 (sign_extend:HI (match_operand:QI 1 "register_operand" "r")))]
1615 [(set_attr "type" "shift")])
1617 (define_expand "extendqisi2"
1619 (ashift:DI (match_operand:QI 1 "some_operand" "")
1621 (set (match_operand:SI 0 "register_operand" "")
1622 (ashiftrt:DI (match_dup 2)
1628 emit_insn (gen_extendqisi2x (operands[0],
1629 force_reg (QImode, operands[1])));
1633 /* If we have an unaligned MEM, extend to a DImode form of
1634 the result (which we do specially). */
1635 if (unaligned_memory_operand (operands[1], QImode))
1637 rtx temp = gen_reg_rtx (DImode);
1639 emit_insn (gen_extendqidi2 (temp, operands[1]));
1640 emit_move_insn (operands[0], gen_lowpart (SImode, temp));
1644 operands[0] = gen_lowpart (DImode, operands[0]);
1645 operands[1] = gen_lowpart (DImode, force_reg (QImode, operands[1]));
1646 operands[2] = gen_reg_rtx (DImode);
1649 (define_expand "extendqidi2"
1651 (ashift:DI (match_operand:QI 1 "some_operand" "")
1653 (set (match_operand:DI 0 "register_operand" "")
1654 (ashiftrt:DI (match_dup 2)
1660 emit_insn (gen_extendqidi2x (operands[0],
1661 force_reg (QImode, operands[1])));
1665 if (unaligned_memory_operand (operands[1], QImode))
1668 = gen_unaligned_extendqidi (operands[0],
1669 get_unaligned_address (operands[1], 1));
1671 alpha_set_memflags (seq, operands[1]);
1676 operands[1] = gen_lowpart (DImode, force_reg (QImode, operands[1]));
1677 operands[2] = gen_reg_rtx (DImode);
1680 (define_expand "extendhisi2"
1682 (ashift:DI (match_operand:HI 1 "some_operand" "")
1684 (set (match_operand:SI 0 "register_operand" "")
1685 (ashiftrt:DI (match_dup 2)
1691 emit_insn (gen_extendhisi2x (operands[0],
1692 force_reg (HImode, operands[1])));
1696 /* If we have an unaligned MEM, extend to a DImode form of
1697 the result (which we do specially). */
1698 if (unaligned_memory_operand (operands[1], HImode))
1700 rtx temp = gen_reg_rtx (DImode);
1702 emit_insn (gen_extendhidi2 (temp, operands[1]));
1703 emit_move_insn (operands[0], gen_lowpart (SImode, temp));
1707 operands[0] = gen_lowpart (DImode, operands[0]);
1708 operands[1] = gen_lowpart (DImode, force_reg (HImode, operands[1]));
1709 operands[2] = gen_reg_rtx (DImode);
1712 (define_expand "extendhidi2"
1714 (ashift:DI (match_operand:HI 1 "some_operand" "")
1716 (set (match_operand:DI 0 "register_operand" "")
1717 (ashiftrt:DI (match_dup 2)
1723 emit_insn (gen_extendhidi2x (operands[0],
1724 force_reg (HImode, operands[1])));
1728 if (unaligned_memory_operand (operands[1], HImode))
1731 = gen_unaligned_extendhidi (operands[0],
1732 get_unaligned_address (operands[1], 2));
1734 alpha_set_memflags (seq, operands[1]);
1739 operands[1] = gen_lowpart (DImode, force_reg (HImode, operands[1]));
1740 operands[2] = gen_reg_rtx (DImode);
1743 ;; Here's how we sign extend an unaligned byte and halfword. Doing this
1744 ;; as a pattern saves one instruction. The code is similar to that for
1745 ;; the unaligned loads (see below).
1747 ;; Operand 1 is the address + 1 (+2 for HI), operand 0 is the result.
1748 (define_expand "unaligned_extendqidi"
1749 [(use (match_operand:QI 0 "register_operand" ""))
1750 (use (match_operand:DI 1 "address_operand" ""))]
1753 if (WORDS_BIG_ENDIAN)
1754 emit_insn (gen_unaligned_extendqidi_be (operands[0], operands[1]));
1756 emit_insn (gen_unaligned_extendqidi_le (operands[0], operands[1]));
1760 (define_expand "unaligned_extendqidi_le"
1761 [(set (match_dup 2) (match_operand:DI 1 "address_operand" ""))
1763 (mem:DI (and:DI (plus:DI (match_dup 2) (const_int -1))
1766 (ashift:DI (match_dup 3)
1767 (minus:DI (const_int 64)
1769 (and:DI (match_dup 2) (const_int 7))
1771 (set (subreg:DI (match_operand:QI 0 "register_operand" "") 0)
1772 (ashiftrt:DI (match_dup 4) (const_int 56)))]
1773 "! WORDS_BIG_ENDIAN"
1775 operands[2] = gen_reg_rtx (DImode);
1776 operands[3] = gen_reg_rtx (DImode);
1777 operands[4] = gen_reg_rtx (DImode);
1780 (define_expand "unaligned_extendqidi_be"
1781 [(set (match_dup 2) (match_operand:DI 1 "address_operand" ""))
1782 (set (match_dup 3) (plus:DI (match_dup 2) (const_int -1)))
1784 (mem:DI (and:DI (match_dup 3)
1786 (set (match_dup 5) (plus:DI (match_dup 2) (const_int -2)))
1788 (ashift:DI (match_dup 4)
1791 (plus:DI (match_dup 5) (const_int 1))
1794 (set (subreg:DI (match_operand:QI 0 "register_operand" "") 0)
1795 (ashiftrt:DI (match_dup 6) (const_int 56)))]
1798 operands[2] = gen_reg_rtx (DImode);
1799 operands[3] = gen_reg_rtx (DImode);
1800 operands[4] = gen_reg_rtx (DImode);
1801 operands[5] = gen_reg_rtx (DImode);
1802 operands[6] = gen_reg_rtx (DImode);
1805 (define_expand "unaligned_extendhidi"
1806 [(use (match_operand:QI 0 "register_operand" ""))
1807 (use (match_operand:DI 1 "address_operand" ""))]
1810 operands[0] = gen_lowpart (DImode, operands[0]);
1811 emit_insn ((WORDS_BIG_ENDIAN
1812 ? gen_unaligned_extendhidi_be
1813 : gen_unaligned_extendhidi_le) (operands[0], operands[1]));
1817 (define_expand "unaligned_extendhidi_le"
1818 [(set (match_dup 2) (match_operand:DI 1 "address_operand" ""))
1820 (mem:DI (and:DI (plus:DI (match_dup 2) (const_int -2))
1823 (ashift:DI (match_dup 3)
1824 (minus:DI (const_int 64)
1826 (and:DI (match_dup 2) (const_int 7))
1828 (set (match_operand:DI 0 "register_operand" "")
1829 (ashiftrt:DI (match_dup 4) (const_int 48)))]
1830 "! WORDS_BIG_ENDIAN"
1832 operands[2] = gen_reg_rtx (DImode);
1833 operands[3] = gen_reg_rtx (DImode);
1834 operands[4] = gen_reg_rtx (DImode);
1837 (define_expand "unaligned_extendhidi_be"
1838 [(set (match_dup 2) (match_operand:DI 1 "address_operand" ""))
1839 (set (match_dup 3) (plus:DI (match_dup 2) (const_int -2)))
1841 (mem:DI (and:DI (match_dup 3)
1843 (set (match_dup 5) (plus:DI (match_dup 2) (const_int -3)))
1845 (ashift:DI (match_dup 4)
1848 (plus:DI (match_dup 5) (const_int 1))
1851 (set (match_operand:DI 0 "register_operand" "")
1852 (ashiftrt:DI (match_dup 6) (const_int 48)))]
1855 operands[2] = gen_reg_rtx (DImode);
1856 operands[3] = gen_reg_rtx (DImode);
1857 operands[4] = gen_reg_rtx (DImode);
1858 operands[5] = gen_reg_rtx (DImode);
1859 operands[6] = gen_reg_rtx (DImode);
1862 (define_insn "*extxl_const"
1863 [(set (match_operand:DI 0 "register_operand" "=r")
1864 (zero_extract:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
1865 (match_operand:DI 2 "mode_width_operand" "n")
1866 (match_operand:DI 3 "mul8_operand" "I")))]
1868 "ext%M2l %r1,%s3,%0"
1869 [(set_attr "type" "shift")])
1871 (define_insn "extxl_le"
1872 [(set (match_operand:DI 0 "register_operand" "=r")
1873 (zero_extract:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
1874 (match_operand:DI 2 "mode_width_operand" "n")
1875 (ashift:DI (match_operand:DI 3 "reg_or_8bit_operand" "rI")
1877 "! WORDS_BIG_ENDIAN"
1879 [(set_attr "type" "shift")])
1881 (define_insn "extxl_be"
1882 [(set (match_operand:DI 0 "register_operand" "=r")
1883 (zero_extract:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
1884 (match_operand:DI 2 "mode_width_operand" "n")
1888 (match_operand:DI 3 "reg_or_8bit_operand" "rI")
1892 [(set_attr "type" "shift")])
1894 ;; Combine has some strange notion of preserving existing undefined behavior
1895 ;; in shifts larger than a word size. So capture these patterns that it
1896 ;; should have turned into zero_extracts.
1898 (define_insn "*extxl_1_le"
1899 [(set (match_operand:DI 0 "register_operand" "=r")
1900 (and:DI (lshiftrt:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
1901 (ashift:DI (match_operand:DI 2 "reg_or_8bit_operand" "rI")
1903 (match_operand:DI 3 "mode_mask_operand" "n")))]
1904 "! WORDS_BIG_ENDIAN"
1906 [(set_attr "type" "shift")])
1908 (define_insn "*extxl_1_be"
1909 [(set (match_operand:DI 0 "register_operand" "=r")
1910 (and:DI (lshiftrt:DI
1911 (match_operand:DI 1 "reg_or_0_operand" "rJ")
1912 (minus:DI (const_int 56)
1913 (ashift:DI (match_operand:DI 2 "reg_or_8bit_operand" "rI")
1915 (match_operand:DI 3 "mode_mask_operand" "n")))]
1918 [(set_attr "type" "shift")])
1920 (define_insn "*extql_2_le"
1921 [(set (match_operand:DI 0 "register_operand" "=r")
1922 (lshiftrt:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
1923 (ashift:DI (match_operand:DI 2 "reg_or_8bit_operand" "rI")
1925 "! WORDS_BIG_ENDIAN"
1927 [(set_attr "type" "shift")])
1929 (define_insn "*extql_2_be"
1930 [(set (match_operand:DI 0 "register_operand" "=r")
1932 (match_operand:DI 1 "reg_or_0_operand" "rJ")
1933 (minus:DI (const_int 56)
1935 (match_operand:DI 2 "reg_or_8bit_operand" "rI")
1939 [(set_attr "type" "shift")])
1941 (define_insn "extqh_le"
1942 [(set (match_operand:DI 0 "register_operand" "=r")
1944 (match_operand:DI 1 "reg_or_0_operand" "rJ")
1945 (minus:DI (const_int 64)
1948 (match_operand:DI 2 "reg_or_8bit_operand" "rI")
1951 "! WORDS_BIG_ENDIAN"
1953 [(set_attr "type" "shift")])
1955 (define_insn "extqh_be"
1956 [(set (match_operand:DI 0 "register_operand" "=r")
1958 (match_operand:DI 1 "reg_or_0_operand" "rJ")
1961 (plus:DI (match_operand:DI 2 "reg_or_8bit_operand" "rI")
1967 [(set_attr "type" "shift")])
1969 (define_insn "extlh_le"
1970 [(set (match_operand:DI 0 "register_operand" "=r")
1972 (and:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
1973 (const_int 2147483647))
1974 (minus:DI (const_int 64)
1977 (match_operand:DI 2 "reg_or_8bit_operand" "rI")
1980 "! WORDS_BIG_ENDIAN"
1982 [(set_attr "type" "shift")])
1984 (define_insn "extlh_be"
1985 [(set (match_operand:DI 0 "register_operand" "=r")
1988 (match_operand:DI 1 "reg_or_0_operand" "rJ")
1992 (match_operand:DI 2 "reg_or_8bit_operand" "rI")
1996 (const_int 2147483647)))]
1999 [(set_attr "type" "shift")])
2001 (define_insn "extwh_le"
2002 [(set (match_operand:DI 0 "register_operand" "=r")
2004 (and:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
2006 (minus:DI (const_int 64)
2009 (match_operand:DI 2 "reg_or_8bit_operand" "rI")
2012 "! WORDS_BIG_ENDIAN"
2014 [(set_attr "type" "shift")])
2016 (define_insn "extwh_be"
2017 [(set (match_operand:DI 0 "register_operand" "=r")
2019 (ashift:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
2023 (match_operand:DI 2 "reg_or_8bit_operand" "rI")
2027 (const_int 65535)))]
2030 [(set_attr "type" "shift")])
2032 ;; This converts an extXl into an extXh with an appropriate adjustment
2033 ;; to the address calculation.
2036 ;; [(set (match_operand:DI 0 "register_operand" "")
2037 ;; (ashift:DI (zero_extract:DI (match_operand:DI 1 "register_operand" "")
2038 ;; (match_operand:DI 2 "mode_width_operand" "")
2039 ;; (ashift:DI (match_operand:DI 3 "" "")
2041 ;; (match_operand:DI 4 "const_int_operand" "")))
2042 ;; (clobber (match_operand:DI 5 "register_operand" ""))]
2043 ;; "INTVAL (operands[4]) == 64 - INTVAL (operands[2])"
2044 ;; [(set (match_dup 5) (match_dup 6))
2045 ;; (set (match_dup 0)
2046 ;; (ashift:DI (zero_extract:DI (match_dup 1) (match_dup 2)
2047 ;; (ashift:DI (plus:DI (match_dup 5)
2053 ;; operands[6] = plus_constant (operands[3],
2054 ;; INTVAL (operands[2]) / BITS_PER_UNIT);
2055 ;; operands[7] = GEN_INT (- INTVAL (operands[2]) / BITS_PER_UNIT);
2058 (define_insn "*insbl_const"
2059 [(set (match_operand:DI 0 "register_operand" "=r")
2060 (ashift:DI (zero_extend:DI (match_operand:QI 1 "register_operand" "r"))
2061 (match_operand:DI 2 "mul8_operand" "I")))]
2064 [(set_attr "type" "shift")])
2066 (define_insn "inswl_const"
2067 [(set (match_operand:DI 0 "register_operand" "=r")
2068 (ashift:DI (zero_extend:DI (match_operand:HI 1 "register_operand" "r"))
2069 (match_operand:DI 2 "mul8_operand" "I")))]
2072 [(set_attr "type" "shift")])
2074 (define_insn "*insll_const"
2075 [(set (match_operand:DI 0 "register_operand" "=r")
2076 (ashift:DI (zero_extend:DI (match_operand:SI 1 "register_operand" "r"))
2077 (match_operand:DI 2 "mul8_operand" "I")))]
2080 [(set_attr "type" "shift")])
2082 (define_insn "insbl_le"
2083 [(set (match_operand:DI 0 "register_operand" "=r")
2084 (ashift:DI (zero_extend:DI (match_operand:QI 1 "register_operand" "r"))
2085 (ashift:DI (match_operand:DI 2 "reg_or_8bit_operand" "rI")
2087 "! WORDS_BIG_ENDIAN"
2089 [(set_attr "type" "shift")])
2091 (define_insn "insbl_be"
2092 [(set (match_operand:DI 0 "register_operand" "=r")
2093 (ashift:DI (zero_extend:DI (match_operand:QI 1 "register_operand" "r"))
2094 (minus:DI (const_int 56)
2095 (ashift:DI (match_operand:DI 2 "reg_or_8bit_operand" "rI")
2099 [(set_attr "type" "shift")])
2101 (define_insn "inswl_le"
2102 [(set (match_operand:DI 0 "register_operand" "=r")
2103 (ashift:DI (zero_extend:DI (match_operand:HI 1 "register_operand" "r"))
2104 (ashift:DI (match_operand:DI 2 "reg_or_8bit_operand" "rI")
2106 "! WORDS_BIG_ENDIAN"
2108 [(set_attr "type" "shift")])
2110 (define_insn "inswl_be"
2111 [(set (match_operand:DI 0 "register_operand" "=r")
2112 (ashift:DI (zero_extend:DI (match_operand:HI 1 "register_operand" "r"))
2113 (minus:DI (const_int 56)
2114 (ashift:DI (match_operand:DI 2 "reg_or_8bit_operand" "rI")
2118 [(set_attr "type" "shift")])
2120 (define_insn "insll_le"
2121 [(set (match_operand:DI 0 "register_operand" "=r")
2122 (ashift:DI (zero_extend:DI (match_operand:SI 1 "register_operand" "r"))
2123 (ashift:DI (match_operand:DI 2 "reg_or_8bit_operand" "rI")
2125 "! WORDS_BIG_ENDIAN"
2127 [(set_attr "type" "shift")])
2129 (define_insn "insll_be"
2130 [(set (match_operand:DI 0 "register_operand" "=r")
2131 (ashift:DI (zero_extend:DI (match_operand:SI 1 "register_operand" "r"))
2132 (minus:DI (const_int 56)
2133 (ashift:DI (match_operand:DI 2 "reg_or_8bit_operand" "rI")
2137 [(set_attr "type" "shift")])
2139 (define_insn "insql_le"
2140 [(set (match_operand:DI 0 "register_operand" "=r")
2141 (ashift:DI (match_operand:DI 1 "register_operand" "r")
2142 (ashift:DI (match_operand:DI 2 "reg_or_8bit_operand" "rI")
2144 "! WORDS_BIG_ENDIAN"
2146 [(set_attr "type" "shift")])
2148 (define_insn "insql_be"
2149 [(set (match_operand:DI 0 "register_operand" "=r")
2150 (ashift:DI (match_operand:DI 1 "register_operand" "r")
2151 (minus:DI (const_int 56)
2152 (ashift:DI (match_operand:DI 2 "reg_or_8bit_operand" "rI")
2156 [(set_attr "type" "shift")])
2158 ;; Combine has this sometimes habit of moving the and outside of the
2159 ;; shift, making life more interesting.
2161 (define_insn "*insxl"
2162 [(set (match_operand:DI 0 "register_operand" "=r")
2163 (and:DI (ashift:DI (match_operand:DI 1 "register_operand" "r")
2164 (match_operand:DI 2 "mul8_operand" "I"))
2165 (match_operand:DI 3 "immediate_operand" "i")))]
2166 "HOST_BITS_PER_WIDE_INT == 64
2167 && GET_CODE (operands[3]) == CONST_INT
2168 && (((unsigned HOST_WIDE_INT) 0xff << INTVAL (operands[2])
2169 == (unsigned HOST_WIDE_INT) INTVAL (operands[3]))
2170 || ((unsigned HOST_WIDE_INT) 0xffff << INTVAL (operands[2])
2171 == (unsigned HOST_WIDE_INT) INTVAL (operands[3]))
2172 || ((unsigned HOST_WIDE_INT) 0xffffffff << INTVAL (operands[2])
2173 == (unsigned HOST_WIDE_INT) INTVAL (operands[3])))"
2175 #if HOST_BITS_PER_WIDE_INT == 64
2176 if ((unsigned HOST_WIDE_INT) 0xff << INTVAL (operands[2])
2177 == (unsigned HOST_WIDE_INT) INTVAL (operands[3]))
2178 return "insbl %1,%s2,%0";
2179 if ((unsigned HOST_WIDE_INT) 0xffff << INTVAL (operands[2])
2180 == (unsigned HOST_WIDE_INT) INTVAL (operands[3]))
2181 return "inswl %1,%s2,%0";
2182 if ((unsigned HOST_WIDE_INT) 0xffffffff << INTVAL (operands[2])
2183 == (unsigned HOST_WIDE_INT) INTVAL (operands[3]))
2184 return "insll %1,%s2,%0";
2188 [(set_attr "type" "shift")])
2190 ;; We do not include the insXh insns because they are complex to express
2191 ;; and it does not appear that we would ever want to generate them.
2193 ;; Since we need them for block moves, though, cop out and use unspec.
2195 (define_insn "insxh"
2196 [(set (match_operand:DI 0 "register_operand" "=r")
2197 (unspec:DI [(match_operand:DI 1 "register_operand" "r")
2198 (match_operand:DI 2 "mode_width_operand" "n")
2199 (match_operand:DI 3 "reg_or_8bit_operand" "rI")]
2203 [(set_attr "type" "shift")])
2205 (define_insn "mskxl_le"
2206 [(set (match_operand:DI 0 "register_operand" "=r")
2207 (and:DI (not:DI (ashift:DI
2208 (match_operand:DI 2 "mode_mask_operand" "n")
2210 (match_operand:DI 3 "reg_or_8bit_operand" "rI")
2212 (match_operand:DI 1 "reg_or_0_operand" "rJ")))]
2213 "! WORDS_BIG_ENDIAN"
2215 [(set_attr "type" "shift")])
2217 (define_insn "mskxl_be"
2218 [(set (match_operand:DI 0 "register_operand" "=r")
2219 (and:DI (not:DI (ashift:DI
2220 (match_operand:DI 2 "mode_mask_operand" "n")
2221 (minus:DI (const_int 56)
2223 (match_operand:DI 3 "reg_or_8bit_operand" "rI")
2225 (match_operand:DI 1 "reg_or_0_operand" "rJ")))]
2228 [(set_attr "type" "shift")])
2230 ;; We do not include the mskXh insns because it does not appear we would
2231 ;; ever generate one.
2233 ;; Again, we do for block moves and we use unspec again.
2235 (define_insn "mskxh"
2236 [(set (match_operand:DI 0 "register_operand" "=r")
2237 (unspec:DI [(match_operand:DI 1 "register_operand" "r")
2238 (match_operand:DI 2 "mode_width_operand" "n")
2239 (match_operand:DI 3 "reg_or_8bit_operand" "rI")]
2243 [(set_attr "type" "shift")])
2245 ;; Prefer AND + NE over LSHIFTRT + AND.
2247 (define_insn_and_split "*ze_and_ne"
2248 [(set (match_operand:DI 0 "register_operand" "=r")
2249 (zero_extract:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
2251 (match_operand 2 "const_int_operand" "I")))]
2252 "(unsigned HOST_WIDE_INT) INTVAL (operands[2]) < 8"
2254 "(unsigned HOST_WIDE_INT) INTVAL (operands[2]) < 8"
2256 (and:DI (match_dup 1) (match_dup 3)))
2258 (ne:DI (match_dup 0) (const_int 0)))]
2259 "operands[3] = GEN_INT (1 << INTVAL (operands[2]));")
2261 ;; Floating-point operations. All the double-precision insns can extend
2262 ;; from single, so indicate that. The exception are the ones that simply
2263 ;; play with the sign bits; it's not clear what to do there.
2265 (define_insn "abssf2"
2266 [(set (match_operand:SF 0 "register_operand" "=f")
2267 (abs:SF (match_operand:SF 1 "reg_or_0_operand" "fG")))]
2270 [(set_attr "type" "fcpys")])
2272 (define_insn "*nabssf2"
2273 [(set (match_operand:SF 0 "register_operand" "=f")
2274 (neg:SF (abs:SF (match_operand:SF 1 "reg_or_0_operand" "fG"))))]
2277 [(set_attr "type" "fadd")])
2279 (define_insn "absdf2"
2280 [(set (match_operand:DF 0 "register_operand" "=f")
2281 (abs:DF (match_operand:DF 1 "reg_or_0_operand" "fG")))]
2284 [(set_attr "type" "fcpys")])
2286 (define_insn "*nabsdf2"
2287 [(set (match_operand:DF 0 "register_operand" "=f")
2288 (neg:DF (abs:DF (match_operand:DF 1 "reg_or_0_operand" "fG"))))]
2291 [(set_attr "type" "fadd")])
2293 (define_expand "abstf2"
2294 [(parallel [(set (match_operand:TF 0 "register_operand" "")
2295 (abs:TF (match_operand:TF 1 "reg_or_0_operand" "")))
2296 (use (match_dup 2))])]
2297 "TARGET_HAS_XFLOATING_LIBS"
2299 #if HOST_BITS_PER_WIDE_INT >= 64
2300 operands[2] = force_reg (DImode, GEN_INT ((HOST_WIDE_INT) 1 << 63));
2302 operands[2] = force_reg (DImode, immed_double_const (0, 0x80000000, DImode));
2306 (define_insn_and_split "*abstf_internal"
2307 [(set (match_operand:TF 0 "register_operand" "=r")
2308 (abs:TF (match_operand:TF 1 "reg_or_0_operand" "rG")))
2309 (use (match_operand:DI 2 "register_operand" "r"))]
2310 "TARGET_HAS_XFLOATING_LIBS"
2312 "&& reload_completed"
2314 "alpha_split_tfmode_frobsign (operands, gen_andnotdi3); DONE;")
2316 (define_insn "negsf2"
2317 [(set (match_operand:SF 0 "register_operand" "=f")
2318 (neg:SF (match_operand:SF 1 "reg_or_0_operand" "fG")))]
2321 [(set_attr "type" "fadd")])
2323 (define_insn "negdf2"
2324 [(set (match_operand:DF 0 "register_operand" "=f")
2325 (neg:DF (match_operand:DF 1 "reg_or_0_operand" "fG")))]
2328 [(set_attr "type" "fadd")])
2330 (define_expand "negtf2"
2331 [(parallel [(set (match_operand:TF 0 "register_operand" "")
2332 (neg:TF (match_operand:TF 1 "reg_or_0_operand" "")))
2333 (use (match_dup 2))])]
2334 "TARGET_HAS_XFLOATING_LIBS"
2336 #if HOST_BITS_PER_WIDE_INT >= 64
2337 operands[2] = force_reg (DImode, GEN_INT ((HOST_WIDE_INT) 1 << 63));
2339 operands[2] = force_reg (DImode, immed_double_const (0, 0x80000000, DImode));
2343 (define_insn_and_split "*negtf_internal"
2344 [(set (match_operand:TF 0 "register_operand" "=r")
2345 (neg:TF (match_operand:TF 1 "reg_or_0_operand" "rG")))
2346 (use (match_operand:DI 2 "register_operand" "r"))]
2347 "TARGET_HAS_XFLOATING_LIBS"
2349 "&& reload_completed"
2351 "alpha_split_tfmode_frobsign (operands, gen_xordi3); DONE;")
2353 (define_insn "copysignsf3"
2354 [(set (match_operand:SF 0 "register_operand" "=f")
2355 (unspec:SF [(match_operand:SF 1 "reg_or_0_operand" "fG")
2356 (match_operand:SF 2 "reg_or_0_operand" "fG")]
2360 [(set_attr "type" "fadd")])
2362 (define_insn "*ncopysignsf3"
2363 [(set (match_operand:SF 0 "register_operand" "=f")
2364 (neg:SF (unspec:SF [(match_operand:SF 1 "reg_or_0_operand" "fG")
2365 (match_operand:SF 2 "reg_or_0_operand" "fG")]
2369 [(set_attr "type" "fadd")])
2371 (define_insn "copysigndf3"
2372 [(set (match_operand:DF 0 "register_operand" "=f")
2373 (unspec:DF [(match_operand:DF 1 "reg_or_0_operand" "fG")
2374 (match_operand:DF 2 "reg_or_0_operand" "fG")]
2378 [(set_attr "type" "fadd")])
2380 (define_insn "*ncopysigndf3"
2381 [(set (match_operand:DF 0 "register_operand" "=f")
2382 (neg:DF (unspec:DF [(match_operand:DF 1 "reg_or_0_operand" "fG")
2383 (match_operand:DF 2 "reg_or_0_operand" "fG")]
2387 [(set_attr "type" "fadd")])
2389 (define_insn "*addsf_ieee"
2390 [(set (match_operand:SF 0 "register_operand" "=&f")
2391 (plus:SF (match_operand:SF 1 "reg_or_0_operand" "%fG")
2392 (match_operand:SF 2 "reg_or_0_operand" "fG")))]
2393 "TARGET_FP && alpha_fptm >= ALPHA_FPTM_SU"
2394 "add%,%/ %R1,%R2,%0"
2395 [(set_attr "type" "fadd")
2396 (set_attr "trap" "yes")
2397 (set_attr "round_suffix" "normal")
2398 (set_attr "trap_suffix" "u_su_sui")])
2400 (define_insn "addsf3"
2401 [(set (match_operand:SF 0 "register_operand" "=f")
2402 (plus:SF (match_operand:SF 1 "reg_or_0_operand" "%fG")
2403 (match_operand:SF 2 "reg_or_0_operand" "fG")))]
2405 "add%,%/ %R1,%R2,%0"
2406 [(set_attr "type" "fadd")
2407 (set_attr "trap" "yes")
2408 (set_attr "round_suffix" "normal")
2409 (set_attr "trap_suffix" "u_su_sui")])
2411 (define_insn "*adddf_ieee"
2412 [(set (match_operand:DF 0 "register_operand" "=&f")
2413 (plus:DF (match_operand:DF 1 "reg_or_0_operand" "%fG")
2414 (match_operand:DF 2 "reg_or_0_operand" "fG")))]
2415 "TARGET_FP && alpha_fptm >= ALPHA_FPTM_SU"
2416 "add%-%/ %R1,%R2,%0"
2417 [(set_attr "type" "fadd")
2418 (set_attr "trap" "yes")
2419 (set_attr "round_suffix" "normal")
2420 (set_attr "trap_suffix" "u_su_sui")])
2422 (define_insn "adddf3"
2423 [(set (match_operand:DF 0 "register_operand" "=f")
2424 (plus:DF (match_operand:DF 1 "reg_or_0_operand" "%fG")
2425 (match_operand:DF 2 "reg_or_0_operand" "fG")))]
2427 "add%-%/ %R1,%R2,%0"
2428 [(set_attr "type" "fadd")
2429 (set_attr "trap" "yes")
2430 (set_attr "round_suffix" "normal")
2431 (set_attr "trap_suffix" "u_su_sui")])
2433 (define_insn "*adddf_ext1"
2434 [(set (match_operand:DF 0 "register_operand" "=f")
2435 (plus:DF (float_extend:DF
2436 (match_operand:SF 1 "reg_or_0_operand" "fG"))
2437 (match_operand:DF 2 "reg_or_0_operand" "fG")))]
2438 "TARGET_FP && alpha_fptm < ALPHA_FPTM_SU"
2439 "add%-%/ %R1,%R2,%0"
2440 [(set_attr "type" "fadd")
2441 (set_attr "trap" "yes")
2442 (set_attr "round_suffix" "normal")
2443 (set_attr "trap_suffix" "u_su_sui")])
2445 (define_insn "*adddf_ext2"
2446 [(set (match_operand:DF 0 "register_operand" "=f")
2447 (plus:DF (float_extend:DF
2448 (match_operand:SF 1 "reg_or_0_operand" "%fG"))
2450 (match_operand:SF 2 "reg_or_0_operand" "fG"))))]
2451 "TARGET_FP && alpha_fptm < ALPHA_FPTM_SU"
2452 "add%-%/ %R1,%R2,%0"
2453 [(set_attr "type" "fadd")
2454 (set_attr "trap" "yes")
2455 (set_attr "round_suffix" "normal")
2456 (set_attr "trap_suffix" "u_su_sui")])
2458 (define_expand "addtf3"
2459 [(use (match_operand 0 "register_operand" ""))
2460 (use (match_operand 1 "general_operand" ""))
2461 (use (match_operand 2 "general_operand" ""))]
2462 "TARGET_HAS_XFLOATING_LIBS"
2463 "alpha_emit_xfloating_arith (PLUS, operands); DONE;")
2465 ;; Define conversion operators between DFmode and SImode, using the cvtql
2466 ;; instruction. To allow combine et al to do useful things, we keep the
2467 ;; operation as a unit until after reload, at which point we split the
2470 ;; Note that we (attempt to) only consider this optimization when the
2471 ;; ultimate destination is memory. If we will be doing further integer
2472 ;; processing, it is cheaper to do the truncation in the int regs.
2474 (define_insn "*cvtql"
2475 [(set (match_operand:SF 0 "register_operand" "=f")
2476 (unspec:SF [(match_operand:DI 1 "reg_or_0_operand" "fG")]
2480 [(set_attr "type" "fadd")
2481 (set_attr "trap" "yes")
2482 (set_attr "trap_suffix" "v_sv")])
2484 (define_insn_and_split "*fix_truncdfsi_ieee"
2485 [(set (match_operand:SI 0 "memory_operand" "=m")
2487 (match_operator:DI 4 "fix_operator"
2488 [(match_operand:DF 1 "reg_or_0_operand" "fG")]) 0))
2489 (clobber (match_scratch:DI 2 "=&f"))
2490 (clobber (match_scratch:SF 3 "=&f"))]
2491 "TARGET_FP && alpha_fptm >= ALPHA_FPTM_SU"
2493 "&& reload_completed"
2494 [(set (match_dup 2) (match_op_dup 4 [(match_dup 1)]))
2495 (set (match_dup 3) (unspec:SF [(match_dup 2)] UNSPEC_CVTQL))
2496 (set (match_dup 5) (match_dup 3))]
2498 operands[5] = adjust_address (operands[0], SFmode, 0);
2500 [(set_attr "type" "fadd")
2501 (set_attr "trap" "yes")])
2503 (define_insn_and_split "*fix_truncdfsi_internal"
2504 [(set (match_operand:SI 0 "memory_operand" "=m")
2506 (match_operator:DI 3 "fix_operator"
2507 [(match_operand:DF 1 "reg_or_0_operand" "fG")]) 0))
2508 (clobber (match_scratch:DI 2 "=f"))]
2509 "TARGET_FP && alpha_fptm < ALPHA_FPTM_SU"
2511 "&& reload_completed"
2512 [(set (match_dup 2) (match_op_dup 3 [(match_dup 1)]))
2513 (set (match_dup 4) (unspec:SF [(match_dup 2)] UNSPEC_CVTQL))
2514 (set (match_dup 5) (match_dup 4))]
2516 operands[4] = gen_rtx_REG (SFmode, REGNO (operands[2]));
2517 operands[5] = adjust_address (operands[0], SFmode, 0);
2519 [(set_attr "type" "fadd")
2520 (set_attr "trap" "yes")])
2522 (define_insn "*fix_truncdfdi_ieee"
2523 [(set (match_operand:DI 0 "reg_no_subreg_operand" "=&f")
2524 (match_operator:DI 2 "fix_operator"
2525 [(match_operand:DF 1 "reg_or_0_operand" "fG")]))]
2526 "TARGET_FP && alpha_fptm >= ALPHA_FPTM_SU"
2528 [(set_attr "type" "fadd")
2529 (set_attr "trap" "yes")
2530 (set_attr "round_suffix" "c")
2531 (set_attr "trap_suffix" "v_sv_svi")])
2533 (define_insn "*fix_truncdfdi2"
2534 [(set (match_operand:DI 0 "reg_no_subreg_operand" "=f")
2535 (match_operator:DI 2 "fix_operator"
2536 [(match_operand:DF 1 "reg_or_0_operand" "fG")]))]
2539 [(set_attr "type" "fadd")
2540 (set_attr "trap" "yes")
2541 (set_attr "round_suffix" "c")
2542 (set_attr "trap_suffix" "v_sv_svi")])
2544 (define_expand "fix_truncdfdi2"
2545 [(set (match_operand:DI 0 "reg_no_subreg_operand" "")
2546 (fix:DI (match_operand:DF 1 "reg_or_0_operand" "")))]
2550 (define_expand "fixuns_truncdfdi2"
2551 [(set (match_operand:DI 0 "reg_no_subreg_operand" "")
2552 (unsigned_fix:DI (match_operand:DF 1 "reg_or_0_operand" "")))]
2556 ;; Likewise between SFmode and SImode.
2558 (define_insn_and_split "*fix_truncsfsi_ieee"
2559 [(set (match_operand:SI 0 "memory_operand" "=m")
2561 (match_operator:DI 4 "fix_operator"
2563 (match_operand:SF 1 "reg_or_0_operand" "fG"))]) 0))
2564 (clobber (match_scratch:DI 2 "=&f"))
2565 (clobber (match_scratch:SF 3 "=&f"))]
2566 "TARGET_FP && alpha_fptm >= ALPHA_FPTM_SU"
2568 "&& reload_completed"
2569 [(set (match_dup 2) (match_op_dup 4 [(float_extend:DF (match_dup 1))]))
2570 (set (match_dup 3) (unspec:SF [(match_dup 2)] UNSPEC_CVTQL))
2571 (set (match_dup 5) (match_dup 3))]
2573 operands[5] = adjust_address (operands[0], SFmode, 0);
2575 [(set_attr "type" "fadd")
2576 (set_attr "trap" "yes")])
2578 (define_insn_and_split "*fix_truncsfsi_internal"
2579 [(set (match_operand:SI 0 "memory_operand" "=m")
2581 (match_operator:DI 3 "fix_operator"
2583 (match_operand:SF 1 "reg_or_0_operand" "fG"))]) 0))
2584 (clobber (match_scratch:DI 2 "=f"))]
2585 "TARGET_FP && alpha_fptm < ALPHA_FPTM_SU"
2587 "&& reload_completed"
2588 [(set (match_dup 2) (match_op_dup 3 [(float_extend:DF (match_dup 1))]))
2589 (set (match_dup 4) (unspec:SF [(match_dup 2)] UNSPEC_CVTQL))
2590 (set (match_dup 5) (match_dup 4))]
2592 operands[4] = gen_rtx_REG (SFmode, REGNO (operands[2]));
2593 operands[5] = adjust_address (operands[0], SFmode, 0);
2595 [(set_attr "type" "fadd")
2596 (set_attr "trap" "yes")])
2598 (define_insn "*fix_truncsfdi_ieee"
2599 [(set (match_operand:DI 0 "reg_no_subreg_operand" "=&f")
2600 (match_operator:DI 2 "fix_operator"
2601 [(float_extend:DF (match_operand:SF 1 "reg_or_0_operand" "fG"))]))]
2602 "TARGET_FP && alpha_fptm >= ALPHA_FPTM_SU"
2604 [(set_attr "type" "fadd")
2605 (set_attr "trap" "yes")
2606 (set_attr "round_suffix" "c")
2607 (set_attr "trap_suffix" "v_sv_svi")])
2609 (define_insn "*fix_truncsfdi2"
2610 [(set (match_operand:DI 0 "reg_no_subreg_operand" "=f")
2611 (match_operator:DI 2 "fix_operator"
2612 [(float_extend:DF (match_operand:SF 1 "reg_or_0_operand" "fG"))]))]
2615 [(set_attr "type" "fadd")
2616 (set_attr "trap" "yes")
2617 (set_attr "round_suffix" "c")
2618 (set_attr "trap_suffix" "v_sv_svi")])
2620 (define_expand "fix_truncsfdi2"
2621 [(set (match_operand:DI 0 "reg_no_subreg_operand" "")
2622 (fix:DI (float_extend:DF (match_operand:SF 1 "reg_or_0_operand" ""))))]
2626 (define_expand "fixuns_truncsfdi2"
2627 [(set (match_operand:DI 0 "reg_no_subreg_operand" "")
2629 (float_extend:DF (match_operand:SF 1 "reg_or_0_operand" ""))))]
2633 (define_expand "fix_trunctfdi2"
2634 [(use (match_operand:DI 0 "register_operand" ""))
2635 (use (match_operand:TF 1 "general_operand" ""))]
2636 "TARGET_HAS_XFLOATING_LIBS"
2637 "alpha_emit_xfloating_cvt (FIX, operands); DONE;")
2639 (define_expand "fixuns_trunctfdi2"
2640 [(use (match_operand:DI 0 "register_operand" ""))
2641 (use (match_operand:TF 1 "general_operand" ""))]
2642 "TARGET_HAS_XFLOATING_LIBS"
2643 "alpha_emit_xfloating_cvt (UNSIGNED_FIX, operands); DONE;")
2645 (define_insn "*floatdisf_ieee"
2646 [(set (match_operand:SF 0 "register_operand" "=&f")
2647 (float:SF (match_operand:DI 1 "reg_no_subreg_operand" "f")))]
2648 "TARGET_FP && alpha_fptm >= ALPHA_FPTM_SU"
2650 [(set_attr "type" "fadd")
2651 (set_attr "trap" "yes")
2652 (set_attr "round_suffix" "normal")
2653 (set_attr "trap_suffix" "sui")])
2655 (define_insn "floatdisf2"
2656 [(set (match_operand:SF 0 "register_operand" "=f")
2657 (float:SF (match_operand:DI 1 "reg_no_subreg_operand" "f")))]
2660 [(set_attr "type" "fadd")
2661 (set_attr "trap" "yes")
2662 (set_attr "round_suffix" "normal")
2663 (set_attr "trap_suffix" "sui")])
2665 (define_insn_and_split "*floatsisf2_ieee"
2666 [(set (match_operand:SF 0 "register_operand" "=&f")
2667 (float:SF (match_operand:SI 1 "memory_operand" "m")))
2668 (clobber (match_scratch:DI 2 "=&f"))
2669 (clobber (match_scratch:SF 3 "=&f"))]
2670 "TARGET_FP && alpha_fptm >= ALPHA_FPTM_SU"
2672 "&& reload_completed"
2673 [(set (match_dup 3) (match_dup 1))
2674 (set (match_dup 2) (unspec:DI [(match_dup 3)] UNSPEC_CVTLQ))
2675 (set (match_dup 0) (float:SF (match_dup 2)))]
2677 operands[1] = adjust_address (operands[1], SFmode, 0);
2680 (define_insn_and_split "*floatsisf2"
2681 [(set (match_operand:SF 0 "register_operand" "=f")
2682 (float:SF (match_operand:SI 1 "memory_operand" "m")))]
2685 "&& reload_completed"
2686 [(set (match_dup 0) (match_dup 1))
2687 (set (match_dup 2) (unspec:DI [(match_dup 0)] UNSPEC_CVTLQ))
2688 (set (match_dup 0) (float:SF (match_dup 2)))]
2690 operands[1] = adjust_address (operands[1], SFmode, 0);
2691 operands[2] = gen_rtx_REG (DImode, REGNO (operands[0]));
2694 (define_insn "*floatdidf_ieee"
2695 [(set (match_operand:DF 0 "register_operand" "=&f")
2696 (float:DF (match_operand:DI 1 "reg_no_subreg_operand" "f")))]
2697 "TARGET_FP && alpha_fptm >= ALPHA_FPTM_SU"
2699 [(set_attr "type" "fadd")
2700 (set_attr "trap" "yes")
2701 (set_attr "round_suffix" "normal")
2702 (set_attr "trap_suffix" "sui")])
2704 (define_insn "floatdidf2"
2705 [(set (match_operand:DF 0 "register_operand" "=f")
2706 (float:DF (match_operand:DI 1 "reg_no_subreg_operand" "f")))]
2709 [(set_attr "type" "fadd")
2710 (set_attr "trap" "yes")
2711 (set_attr "round_suffix" "normal")
2712 (set_attr "trap_suffix" "sui")])
2714 (define_insn_and_split "*floatsidf2_ieee"
2715 [(set (match_operand:DF 0 "register_operand" "=&f")
2716 (float:DF (match_operand:SI 1 "memory_operand" "m")))
2717 (clobber (match_scratch:DI 2 "=&f"))
2718 (clobber (match_scratch:SF 3 "=&f"))]
2719 "TARGET_FP && alpha_fptm >= ALPHA_FPTM_SU"
2721 "&& reload_completed"
2722 [(set (match_dup 3) (match_dup 1))
2723 (set (match_dup 2) (unspec:DI [(match_dup 3)] UNSPEC_CVTLQ))
2724 (set (match_dup 0) (float:DF (match_dup 2)))]
2726 operands[1] = adjust_address (operands[1], SFmode, 0);
2729 (define_insn_and_split "*floatsidf2"
2730 [(set (match_operand:DF 0 "register_operand" "=f")
2731 (float:DF (match_operand:SI 1 "memory_operand" "m")))]
2734 "&& reload_completed"
2735 [(set (match_dup 3) (match_dup 1))
2736 (set (match_dup 2) (unspec:DI [(match_dup 3)] UNSPEC_CVTLQ))
2737 (set (match_dup 0) (float:DF (match_dup 2)))]
2739 operands[1] = adjust_address (operands[1], SFmode, 0);
2740 operands[2] = gen_rtx_REG (DImode, REGNO (operands[0]));
2741 operands[3] = gen_rtx_REG (SFmode, REGNO (operands[0]));
2744 (define_expand "floatditf2"
2745 [(use (match_operand:TF 0 "register_operand" ""))
2746 (use (match_operand:DI 1 "general_operand" ""))]
2747 "TARGET_HAS_XFLOATING_LIBS"
2748 "alpha_emit_xfloating_cvt (FLOAT, operands); DONE;")
2750 (define_expand "floatunsdisf2"
2751 [(use (match_operand:SF 0 "register_operand" ""))
2752 (use (match_operand:DI 1 "register_operand" ""))]
2754 "alpha_emit_floatuns (operands); DONE;")
2756 (define_expand "floatunsdidf2"
2757 [(use (match_operand:DF 0 "register_operand" ""))
2758 (use (match_operand:DI 1 "register_operand" ""))]
2760 "alpha_emit_floatuns (operands); DONE;")
2762 (define_expand "floatunsditf2"
2763 [(use (match_operand:TF 0 "register_operand" ""))
2764 (use (match_operand:DI 1 "general_operand" ""))]
2765 "TARGET_HAS_XFLOATING_LIBS"
2766 "alpha_emit_xfloating_cvt (UNSIGNED_FLOAT, operands); DONE;")
2768 (define_expand "extendsfdf2"
2769 [(set (match_operand:DF 0 "register_operand" "")
2770 (float_extend:DF (match_operand:SF 1 "nonimmediate_operand" "")))]
2773 if (alpha_fptm >= ALPHA_FPTM_SU)
2774 operands[1] = force_reg (SFmode, operands[1]);
2777 ;; The Unicos/Mk assembler doesn't support cvtst, but we've already
2778 ;; asserted that alpha_fptm == ALPHA_FPTM_N.
2780 (define_insn "*extendsfdf2_ieee"
2781 [(set (match_operand:DF 0 "register_operand" "=&f")
2782 (float_extend:DF (match_operand:SF 1 "register_operand" "f")))]
2783 "TARGET_FP && alpha_fptm >= ALPHA_FPTM_SU"
2785 [(set_attr "type" "fadd")
2786 (set_attr "trap" "yes")])
2788 (define_insn "*extendsfdf2_internal"
2789 [(set (match_operand:DF 0 "register_operand" "=f,f,m")
2790 (float_extend:DF (match_operand:SF 1 "nonimmediate_operand" "f,m,f")))]
2791 "TARGET_FP && alpha_fptm < ALPHA_FPTM_SU"
2796 [(set_attr "type" "fcpys,fld,fst")])
2798 ;; Use register_operand for operand 1 to prevent compress_float_constant
2799 ;; from doing something silly. When optimizing we'll put things back
2801 (define_expand "extendsftf2"
2802 [(use (match_operand:TF 0 "register_operand" ""))
2803 (use (match_operand:SF 1 "register_operand" ""))]
2804 "TARGET_HAS_XFLOATING_LIBS"
2806 rtx tmp = gen_reg_rtx (DFmode);
2807 emit_insn (gen_extendsfdf2 (tmp, operands[1]));
2808 emit_insn (gen_extenddftf2 (operands[0], tmp));
2812 (define_expand "extenddftf2"
2813 [(use (match_operand:TF 0 "register_operand" ""))
2814 (use (match_operand:DF 1 "register_operand" ""))]
2815 "TARGET_HAS_XFLOATING_LIBS"
2816 "alpha_emit_xfloating_cvt (FLOAT_EXTEND, operands); DONE;")
2818 (define_insn "*truncdfsf2_ieee"
2819 [(set (match_operand:SF 0 "register_operand" "=&f")
2820 (float_truncate:SF (match_operand:DF 1 "reg_or_0_operand" "fG")))]
2821 "TARGET_FP && alpha_fptm >= ALPHA_FPTM_SU"
2823 [(set_attr "type" "fadd")
2824 (set_attr "trap" "yes")
2825 (set_attr "round_suffix" "normal")
2826 (set_attr "trap_suffix" "u_su_sui")])
2828 (define_insn "truncdfsf2"
2829 [(set (match_operand:SF 0 "register_operand" "=f")
2830 (float_truncate:SF (match_operand:DF 1 "reg_or_0_operand" "fG")))]
2833 [(set_attr "type" "fadd")
2834 (set_attr "trap" "yes")
2835 (set_attr "round_suffix" "normal")
2836 (set_attr "trap_suffix" "u_su_sui")])
2838 (define_expand "trunctfdf2"
2839 [(use (match_operand:DF 0 "register_operand" ""))
2840 (use (match_operand:TF 1 "general_operand" ""))]
2841 "TARGET_HAS_XFLOATING_LIBS"
2842 "alpha_emit_xfloating_cvt (FLOAT_TRUNCATE, operands); DONE;")
2844 (define_expand "trunctfsf2"
2845 [(use (match_operand:SF 0 "register_operand" ""))
2846 (use (match_operand:TF 1 "general_operand" ""))]
2847 "TARGET_FP && TARGET_HAS_XFLOATING_LIBS"
2849 rtx tmpf, sticky, arg, lo, hi;
2851 tmpf = gen_reg_rtx (DFmode);
2852 sticky = gen_reg_rtx (DImode);
2853 arg = copy_to_mode_reg (TFmode, operands[1]);
2854 lo = gen_lowpart (DImode, arg);
2855 hi = gen_highpart (DImode, arg);
2857 /* Convert the low word of the TFmode value into a sticky rounding bit,
2858 then or it into the low bit of the high word. This leaves the sticky
2859 bit at bit 48 of the fraction, which is representable in DFmode,
2860 which prevents rounding error in the final conversion to SFmode. */
2862 emit_insn (gen_rtx_SET (VOIDmode, sticky,
2863 gen_rtx_NE (DImode, lo, const0_rtx)));
2864 emit_insn (gen_iordi3 (hi, hi, sticky));
2865 emit_insn (gen_trunctfdf2 (tmpf, arg));
2866 emit_insn (gen_truncdfsf2 (operands[0], tmpf));
2870 (define_insn "*divsf3_ieee"
2871 [(set (match_operand:SF 0 "register_operand" "=&f")
2872 (div:SF (match_operand:SF 1 "reg_or_0_operand" "fG")
2873 (match_operand:SF 2 "reg_or_0_operand" "fG")))]
2874 "TARGET_FP && alpha_fptm >= ALPHA_FPTM_SU"
2875 "div%,%/ %R1,%R2,%0"
2876 [(set_attr "type" "fdiv")
2877 (set_attr "opsize" "si")
2878 (set_attr "trap" "yes")
2879 (set_attr "round_suffix" "normal")
2880 (set_attr "trap_suffix" "u_su_sui")])
2882 (define_insn "divsf3"
2883 [(set (match_operand:SF 0 "register_operand" "=f")
2884 (div:SF (match_operand:SF 1 "reg_or_0_operand" "fG")
2885 (match_operand:SF 2 "reg_or_0_operand" "fG")))]
2887 "div%,%/ %R1,%R2,%0"
2888 [(set_attr "type" "fdiv")
2889 (set_attr "opsize" "si")
2890 (set_attr "trap" "yes")
2891 (set_attr "round_suffix" "normal")
2892 (set_attr "trap_suffix" "u_su_sui")])
2894 (define_insn "*divdf3_ieee"
2895 [(set (match_operand:DF 0 "register_operand" "=&f")
2896 (div:DF (match_operand:DF 1 "reg_or_0_operand" "fG")
2897 (match_operand:DF 2 "reg_or_0_operand" "fG")))]
2898 "TARGET_FP && alpha_fptm >= ALPHA_FPTM_SU"
2899 "div%-%/ %R1,%R2,%0"
2900 [(set_attr "type" "fdiv")
2901 (set_attr "trap" "yes")
2902 (set_attr "round_suffix" "normal")
2903 (set_attr "trap_suffix" "u_su_sui")])
2905 (define_insn "divdf3"
2906 [(set (match_operand:DF 0 "register_operand" "=f")
2907 (div:DF (match_operand:DF 1 "reg_or_0_operand" "fG")
2908 (match_operand:DF 2 "reg_or_0_operand" "fG")))]
2910 "div%-%/ %R1,%R2,%0"
2911 [(set_attr "type" "fdiv")
2912 (set_attr "trap" "yes")
2913 (set_attr "round_suffix" "normal")
2914 (set_attr "trap_suffix" "u_su_sui")])
2916 (define_insn "*divdf_ext1"
2917 [(set (match_operand:DF 0 "register_operand" "=f")
2918 (div:DF (float_extend:DF (match_operand:SF 1 "reg_or_0_operand" "fG"))
2919 (match_operand:DF 2 "reg_or_0_operand" "fG")))]
2920 "TARGET_FP && alpha_fptm < ALPHA_FPTM_SU"
2921 "div%-%/ %R1,%R2,%0"
2922 [(set_attr "type" "fdiv")
2923 (set_attr "trap" "yes")
2924 (set_attr "round_suffix" "normal")
2925 (set_attr "trap_suffix" "u_su_sui")])
2927 (define_insn "*divdf_ext2"
2928 [(set (match_operand:DF 0 "register_operand" "=f")
2929 (div:DF (match_operand:DF 1 "reg_or_0_operand" "fG")
2931 (match_operand:SF 2 "reg_or_0_operand" "fG"))))]
2932 "TARGET_FP && alpha_fptm < ALPHA_FPTM_SU"
2933 "div%-%/ %R1,%R2,%0"
2934 [(set_attr "type" "fdiv")
2935 (set_attr "trap" "yes")
2936 (set_attr "round_suffix" "normal")
2937 (set_attr "trap_suffix" "u_su_sui")])
2939 (define_insn "*divdf_ext3"
2940 [(set (match_operand:DF 0 "register_operand" "=f")
2941 (div:DF (float_extend:DF (match_operand:SF 1 "reg_or_0_operand" "fG"))
2942 (float_extend:DF (match_operand:SF 2 "reg_or_0_operand" "fG"))))]
2943 "TARGET_FP && alpha_fptm < ALPHA_FPTM_SU"
2944 "div%-%/ %R1,%R2,%0"
2945 [(set_attr "type" "fdiv")
2946 (set_attr "trap" "yes")
2947 (set_attr "round_suffix" "normal")
2948 (set_attr "trap_suffix" "u_su_sui")])
2950 (define_expand "divtf3"
2951 [(use (match_operand 0 "register_operand" ""))
2952 (use (match_operand 1 "general_operand" ""))
2953 (use (match_operand 2 "general_operand" ""))]
2954 "TARGET_HAS_XFLOATING_LIBS"
2955 "alpha_emit_xfloating_arith (DIV, operands); DONE;")
2957 (define_insn "*mulsf3_ieee"
2958 [(set (match_operand:SF 0 "register_operand" "=&f")
2959 (mult:SF (match_operand:SF 1 "reg_or_0_operand" "%fG")
2960 (match_operand:SF 2 "reg_or_0_operand" "fG")))]
2961 "TARGET_FP && alpha_fptm >= ALPHA_FPTM_SU"
2962 "mul%,%/ %R1,%R2,%0"
2963 [(set_attr "type" "fmul")
2964 (set_attr "trap" "yes")
2965 (set_attr "round_suffix" "normal")
2966 (set_attr "trap_suffix" "u_su_sui")])
2968 (define_insn "mulsf3"
2969 [(set (match_operand:SF 0 "register_operand" "=f")
2970 (mult:SF (match_operand:SF 1 "reg_or_0_operand" "%fG")
2971 (match_operand:SF 2 "reg_or_0_operand" "fG")))]
2973 "mul%,%/ %R1,%R2,%0"
2974 [(set_attr "type" "fmul")
2975 (set_attr "trap" "yes")
2976 (set_attr "round_suffix" "normal")
2977 (set_attr "trap_suffix" "u_su_sui")])
2979 (define_insn "*muldf3_ieee"
2980 [(set (match_operand:DF 0 "register_operand" "=&f")
2981 (mult:DF (match_operand:DF 1 "reg_or_0_operand" "%fG")
2982 (match_operand:DF 2 "reg_or_0_operand" "fG")))]
2983 "TARGET_FP && alpha_fptm >= ALPHA_FPTM_SU"
2984 "mul%-%/ %R1,%R2,%0"
2985 [(set_attr "type" "fmul")
2986 (set_attr "trap" "yes")
2987 (set_attr "round_suffix" "normal")
2988 (set_attr "trap_suffix" "u_su_sui")])
2990 (define_insn "muldf3"
2991 [(set (match_operand:DF 0 "register_operand" "=f")
2992 (mult:DF (match_operand:DF 1 "reg_or_0_operand" "%fG")
2993 (match_operand:DF 2 "reg_or_0_operand" "fG")))]
2995 "mul%-%/ %R1,%R2,%0"
2996 [(set_attr "type" "fmul")
2997 (set_attr "trap" "yes")
2998 (set_attr "round_suffix" "normal")
2999 (set_attr "trap_suffix" "u_su_sui")])
3001 (define_insn "*muldf_ext1"
3002 [(set (match_operand:DF 0 "register_operand" "=f")
3003 (mult:DF (float_extend:DF
3004 (match_operand:SF 1 "reg_or_0_operand" "fG"))
3005 (match_operand:DF 2 "reg_or_0_operand" "fG")))]
3006 "TARGET_FP && alpha_fptm < ALPHA_FPTM_SU"
3007 "mul%-%/ %R1,%R2,%0"
3008 [(set_attr "type" "fmul")
3009 (set_attr "trap" "yes")
3010 (set_attr "round_suffix" "normal")
3011 (set_attr "trap_suffix" "u_su_sui")])
3013 (define_insn "*muldf_ext2"
3014 [(set (match_operand:DF 0 "register_operand" "=f")
3015 (mult:DF (float_extend:DF
3016 (match_operand:SF 1 "reg_or_0_operand" "%fG"))
3018 (match_operand:SF 2 "reg_or_0_operand" "fG"))))]
3019 "TARGET_FP && alpha_fptm < ALPHA_FPTM_SU"
3020 "mul%-%/ %R1,%R2,%0"
3021 [(set_attr "type" "fmul")
3022 (set_attr "trap" "yes")
3023 (set_attr "round_suffix" "normal")
3024 (set_attr "trap_suffix" "u_su_sui")])
3026 (define_expand "multf3"
3027 [(use (match_operand 0 "register_operand" ""))
3028 (use (match_operand 1 "general_operand" ""))
3029 (use (match_operand 2 "general_operand" ""))]
3030 "TARGET_HAS_XFLOATING_LIBS"
3031 "alpha_emit_xfloating_arith (MULT, operands); DONE;")
3033 (define_insn "*subsf3_ieee"
3034 [(set (match_operand:SF 0 "register_operand" "=&f")
3035 (minus:SF (match_operand:SF 1 "reg_or_0_operand" "fG")
3036 (match_operand:SF 2 "reg_or_0_operand" "fG")))]
3037 "TARGET_FP && alpha_fptm >= ALPHA_FPTM_SU"
3038 "sub%,%/ %R1,%R2,%0"
3039 [(set_attr "type" "fadd")
3040 (set_attr "trap" "yes")
3041 (set_attr "round_suffix" "normal")
3042 (set_attr "trap_suffix" "u_su_sui")])
3044 (define_insn "subsf3"
3045 [(set (match_operand:SF 0 "register_operand" "=f")
3046 (minus:SF (match_operand:SF 1 "reg_or_0_operand" "fG")
3047 (match_operand:SF 2 "reg_or_0_operand" "fG")))]
3049 "sub%,%/ %R1,%R2,%0"
3050 [(set_attr "type" "fadd")
3051 (set_attr "trap" "yes")
3052 (set_attr "round_suffix" "normal")
3053 (set_attr "trap_suffix" "u_su_sui")])
3055 (define_insn "*subdf3_ieee"
3056 [(set (match_operand:DF 0 "register_operand" "=&f")
3057 (minus:DF (match_operand:DF 1 "reg_or_0_operand" "fG")
3058 (match_operand:DF 2 "reg_or_0_operand" "fG")))]
3059 "TARGET_FP && alpha_fptm >= ALPHA_FPTM_SU"
3060 "sub%-%/ %R1,%R2,%0"
3061 [(set_attr "type" "fadd")
3062 (set_attr "trap" "yes")
3063 (set_attr "round_suffix" "normal")
3064 (set_attr "trap_suffix" "u_su_sui")])
3066 (define_insn "subdf3"
3067 [(set (match_operand:DF 0 "register_operand" "=f")
3068 (minus:DF (match_operand:DF 1 "reg_or_0_operand" "fG")
3069 (match_operand:DF 2 "reg_or_0_operand" "fG")))]
3071 "sub%-%/ %R1,%R2,%0"
3072 [(set_attr "type" "fadd")
3073 (set_attr "trap" "yes")
3074 (set_attr "round_suffix" "normal")
3075 (set_attr "trap_suffix" "u_su_sui")])
3077 (define_insn "*subdf_ext1"
3078 [(set (match_operand:DF 0 "register_operand" "=f")
3079 (minus:DF (float_extend:DF
3080 (match_operand:SF 1 "reg_or_0_operand" "fG"))
3081 (match_operand:DF 2 "reg_or_0_operand" "fG")))]
3082 "TARGET_FP && alpha_fptm < ALPHA_FPTM_SU"
3083 "sub%-%/ %R1,%R2,%0"
3084 [(set_attr "type" "fadd")
3085 (set_attr "trap" "yes")
3086 (set_attr "round_suffix" "normal")
3087 (set_attr "trap_suffix" "u_su_sui")])
3089 (define_insn "*subdf_ext2"
3090 [(set (match_operand:DF 0 "register_operand" "=f")
3091 (minus:DF (match_operand:DF 1 "reg_or_0_operand" "fG")
3093 (match_operand:SF 2 "reg_or_0_operand" "fG"))))]
3094 "TARGET_FP && alpha_fptm < ALPHA_FPTM_SU"
3095 "sub%-%/ %R1,%R2,%0"
3096 [(set_attr "type" "fadd")
3097 (set_attr "trap" "yes")
3098 (set_attr "round_suffix" "normal")
3099 (set_attr "trap_suffix" "u_su_sui")])
3101 (define_insn "*subdf_ext3"
3102 [(set (match_operand:DF 0 "register_operand" "=f")
3103 (minus:DF (float_extend:DF
3104 (match_operand:SF 1 "reg_or_0_operand" "fG"))
3106 (match_operand:SF 2 "reg_or_0_operand" "fG"))))]
3107 "TARGET_FP && alpha_fptm < ALPHA_FPTM_SU"
3108 "sub%-%/ %R1,%R2,%0"
3109 [(set_attr "type" "fadd")
3110 (set_attr "trap" "yes")
3111 (set_attr "round_suffix" "normal")
3112 (set_attr "trap_suffix" "u_su_sui")])
3114 (define_expand "subtf3"
3115 [(use (match_operand 0 "register_operand" ""))
3116 (use (match_operand 1 "general_operand" ""))
3117 (use (match_operand 2 "general_operand" ""))]
3118 "TARGET_HAS_XFLOATING_LIBS"
3119 "alpha_emit_xfloating_arith (MINUS, operands); DONE;")
3121 (define_insn "*sqrtsf2_ieee"
3122 [(set (match_operand:SF 0 "register_operand" "=&f")
3123 (sqrt:SF (match_operand:SF 1 "reg_or_0_operand" "fG")))]
3124 "TARGET_FP && TARGET_FIX && alpha_fptm >= ALPHA_FPTM_SU"
3126 [(set_attr "type" "fsqrt")
3127 (set_attr "opsize" "si")
3128 (set_attr "trap" "yes")
3129 (set_attr "round_suffix" "normal")
3130 (set_attr "trap_suffix" "u_su_sui")])
3132 (define_insn "sqrtsf2"
3133 [(set (match_operand:SF 0 "register_operand" "=f")
3134 (sqrt:SF (match_operand:SF 1 "reg_or_0_operand" "fG")))]
3135 "TARGET_FP && TARGET_FIX"
3137 [(set_attr "type" "fsqrt")
3138 (set_attr "opsize" "si")
3139 (set_attr "trap" "yes")
3140 (set_attr "round_suffix" "normal")
3141 (set_attr "trap_suffix" "u_su_sui")])
3143 (define_insn "*sqrtdf2_ieee"
3144 [(set (match_operand:DF 0 "register_operand" "=&f")
3145 (sqrt:DF (match_operand:DF 1 "reg_or_0_operand" "fG")))]
3146 "TARGET_FP && TARGET_FIX && alpha_fptm >= ALPHA_FPTM_SU"
3148 [(set_attr "type" "fsqrt")
3149 (set_attr "trap" "yes")
3150 (set_attr "round_suffix" "normal")
3151 (set_attr "trap_suffix" "u_su_sui")])
3153 (define_insn "sqrtdf2"
3154 [(set (match_operand:DF 0 "register_operand" "=f")
3155 (sqrt:DF (match_operand:DF 1 "reg_or_0_operand" "fG")))]
3156 "TARGET_FP && TARGET_FIX"
3158 [(set_attr "type" "fsqrt")
3159 (set_attr "trap" "yes")
3160 (set_attr "round_suffix" "normal")
3161 (set_attr "trap_suffix" "u_su_sui")])
3163 ;; Next are all the integer comparisons, and conditional moves and branches
3164 ;; and some of the related define_expand's and define_split's.
3166 (define_insn "*setcc_internal"
3167 [(set (match_operand 0 "register_operand" "=r")
3168 (match_operator 1 "alpha_comparison_operator"
3169 [(match_operand:DI 2 "register_operand" "r")
3170 (match_operand:DI 3 "reg_or_8bit_operand" "rI")]))]
3171 "GET_MODE_CLASS (GET_MODE (operands[0])) == MODE_INT
3172 && GET_MODE_SIZE (GET_MODE (operands[0])) <= 8
3173 && GET_MODE (operands[0]) == GET_MODE (operands[1])"
3175 [(set_attr "type" "icmp")])
3177 ;; Yes, we can technically support reg_or_8bit_operand in operand 2,
3178 ;; but that's non-canonical rtl and allowing that causes inefficiencies
3180 (define_insn "*setcc_swapped_internal"
3181 [(set (match_operand 0 "register_operand" "=r")
3182 (match_operator 1 "alpha_swapped_comparison_operator"
3183 [(match_operand:DI 2 "register_operand" "r")
3184 (match_operand:DI 3 "reg_or_0_operand" "rJ")]))]
3185 "GET_MODE_CLASS (GET_MODE (operands[0])) == MODE_INT
3186 && GET_MODE_SIZE (GET_MODE (operands[0])) <= 8
3187 && GET_MODE (operands[0]) == GET_MODE (operands[1])"
3189 [(set_attr "type" "icmp")])
3191 ;; Use match_operator rather than ne directly so that we can match
3192 ;; multiple integer modes.
3193 (define_insn "*setne_internal"
3194 [(set (match_operand 0 "register_operand" "=r")
3195 (match_operator 1 "signed_comparison_operator"
3196 [(match_operand:DI 2 "register_operand" "r")
3198 "GET_MODE_CLASS (GET_MODE (operands[0])) == MODE_INT
3199 && GET_MODE_SIZE (GET_MODE (operands[0])) <= 8
3200 && GET_CODE (operands[1]) == NE
3201 && GET_MODE (operands[0]) == GET_MODE (operands[1])"
3203 [(set_attr "type" "icmp")])
3205 ;; The mode folding trick can't be used with const_int operands, since
3206 ;; reload needs to know the proper mode.
3208 ;; Use add_operand instead of the more seemingly natural reg_or_8bit_operand
3209 ;; in order to create more pairs of constants. As long as we're allowing
3210 ;; two constants at the same time, and will have to reload one of them...
3212 (define_insn "*movqicc_internal"
3213 [(set (match_operand:QI 0 "register_operand" "=r,r,r,r")
3215 (match_operator 2 "signed_comparison_operator"
3216 [(match_operand:DI 3 "reg_or_0_operand" "rJ,rJ,J,J")
3217 (match_operand:DI 4 "reg_or_0_operand" "J,J,rJ,rJ")])
3218 (match_operand:QI 1 "add_operand" "rI,0,rI,0")
3219 (match_operand:QI 5 "add_operand" "0,rI,0,rI")))]
3220 "(operands[3] == const0_rtx) ^ (operands[4] == const0_rtx)"
3226 [(set_attr "type" "icmov")])
3228 (define_insn "*movhicc_internal"
3229 [(set (match_operand:HI 0 "register_operand" "=r,r,r,r")
3231 (match_operator 2 "signed_comparison_operator"
3232 [(match_operand:DI 3 "reg_or_0_operand" "rJ,rJ,J,J")
3233 (match_operand:DI 4 "reg_or_0_operand" "J,J,rJ,rJ")])
3234 (match_operand:HI 1 "add_operand" "rI,0,rI,0")
3235 (match_operand:HI 5 "add_operand" "0,rI,0,rI")))]
3236 "(operands[3] == const0_rtx) ^ (operands[4] == const0_rtx)"
3242 [(set_attr "type" "icmov")])
3244 (define_insn "*movsicc_internal"
3245 [(set (match_operand:SI 0 "register_operand" "=r,r,r,r")
3247 (match_operator 2 "signed_comparison_operator"
3248 [(match_operand:DI 3 "reg_or_0_operand" "rJ,rJ,J,J")
3249 (match_operand:DI 4 "reg_or_0_operand" "J,J,rJ,rJ")])
3250 (match_operand:SI 1 "add_operand" "rI,0,rI,0")
3251 (match_operand:SI 5 "add_operand" "0,rI,0,rI")))]
3252 "(operands[3] == const0_rtx) ^ (operands[4] == const0_rtx)"
3258 [(set_attr "type" "icmov")])
3260 (define_insn "*movdicc_internal"
3261 [(set (match_operand:DI 0 "register_operand" "=r,r,r,r")
3263 (match_operator 2 "signed_comparison_operator"
3264 [(match_operand:DI 3 "reg_or_0_operand" "rJ,rJ,J,J")
3265 (match_operand:DI 4 "reg_or_0_operand" "J,J,rJ,rJ")])
3266 (match_operand:DI 1 "add_operand" "rI,0,rI,0")
3267 (match_operand:DI 5 "add_operand" "0,rI,0,rI")))]
3268 "(operands[3] == const0_rtx) ^ (operands[4] == const0_rtx)"
3274 [(set_attr "type" "icmov")])
3276 (define_insn "*movqicc_lbc"
3277 [(set (match_operand:QI 0 "register_operand" "=r,r")
3279 (eq (zero_extract:DI (match_operand:DI 2 "reg_or_0_operand" "rJ,rJ")
3283 (match_operand:QI 1 "reg_or_8bit_operand" "rI,0")
3284 (match_operand:QI 3 "reg_or_8bit_operand" "0,rI")))]
3289 [(set_attr "type" "icmov")])
3291 (define_insn "*movhicc_lbc"
3292 [(set (match_operand:HI 0 "register_operand" "=r,r")
3294 (eq (zero_extract:DI (match_operand:DI 2 "reg_or_0_operand" "rJ,rJ")
3298 (match_operand:HI 1 "reg_or_8bit_operand" "rI,0")
3299 (match_operand:HI 3 "reg_or_8bit_operand" "0,rI")))]
3304 [(set_attr "type" "icmov")])
3306 (define_insn "*movsicc_lbc"
3307 [(set (match_operand:SI 0 "register_operand" "=r,r")
3309 (eq (zero_extract:DI (match_operand:DI 2 "reg_or_0_operand" "rJ,rJ")
3313 (match_operand:SI 1 "reg_or_8bit_operand" "rI,0")
3314 (match_operand:SI 3 "reg_or_8bit_operand" "0,rI")))]
3319 [(set_attr "type" "icmov")])
3321 (define_insn "*movdicc_lbc"
3322 [(set (match_operand:DI 0 "register_operand" "=r,r")
3324 (eq (zero_extract:DI (match_operand:DI 2 "reg_or_0_operand" "rJ,rJ")
3328 (match_operand:DI 1 "reg_or_8bit_operand" "rI,0")
3329 (match_operand:DI 3 "reg_or_8bit_operand" "0,rI")))]
3334 [(set_attr "type" "icmov")])
3336 (define_insn "*movqicc_lbs"
3337 [(set (match_operand:QI 0 "register_operand" "=r,r")
3339 (ne (zero_extract:DI (match_operand:DI 2 "reg_or_0_operand" "rJ,rJ")
3343 (match_operand:QI 1 "reg_or_8bit_operand" "rI,0")
3344 (match_operand:QI 3 "reg_or_8bit_operand" "0,rI")))]
3349 [(set_attr "type" "icmov")])
3351 (define_insn "*movhicc_lbs"
3352 [(set (match_operand:HI 0 "register_operand" "=r,r")
3354 (ne (zero_extract:DI (match_operand:DI 2 "reg_or_0_operand" "rJ,rJ")
3358 (match_operand:HI 1 "reg_or_8bit_operand" "rI,0")
3359 (match_operand:HI 3 "reg_or_8bit_operand" "0,rI")))]
3364 [(set_attr "type" "icmov")])
3366 (define_insn "*movsicc_lbs"
3367 [(set (match_operand:SI 0 "register_operand" "=r,r")
3369 (ne (zero_extract:DI (match_operand:DI 2 "reg_or_0_operand" "rJ,rJ")
3373 (match_operand:SI 1 "reg_or_8bit_operand" "rI,0")
3374 (match_operand:SI 3 "reg_or_8bit_operand" "0,rI")))]
3379 [(set_attr "type" "icmov")])
3381 (define_insn "*movdicc_lbs"
3382 [(set (match_operand:DI 0 "register_operand" "=r,r")
3384 (ne (zero_extract:DI (match_operand:DI 2 "reg_or_0_operand" "rJ,rJ")
3388 (match_operand:DI 1 "reg_or_8bit_operand" "rI,0")
3389 (match_operand:DI 3 "reg_or_8bit_operand" "0,rI")))]
3394 [(set_attr "type" "icmov")])
3396 ;; For ABS, we have two choices, depending on whether the input and output
3397 ;; registers are the same or not.
3398 (define_expand "absdi2"
3399 [(set (match_operand:DI 0 "register_operand" "")
3400 (abs:DI (match_operand:DI 1 "register_operand" "")))]
3403 if (rtx_equal_p (operands[0], operands[1]))
3404 emit_insn (gen_absdi2_same (operands[0], gen_reg_rtx (DImode)));
3406 emit_insn (gen_absdi2_diff (operands[0], operands[1]));
3410 (define_expand "absdi2_same"
3411 [(set (match_operand:DI 1 "register_operand" "")
3412 (neg:DI (match_operand:DI 0 "register_operand" "")))
3414 (if_then_else:DI (ge (match_dup 0) (const_int 0))
3420 (define_expand "absdi2_diff"
3421 [(set (match_operand:DI 0 "register_operand" "")
3422 (neg:DI (match_operand:DI 1 "register_operand" "")))
3424 (if_then_else:DI (lt (match_dup 1) (const_int 0))
3431 [(set (match_operand:DI 0 "register_operand" "")
3432 (abs:DI (match_dup 0)))
3433 (clobber (match_operand:DI 1 "register_operand" ""))]
3435 [(set (match_dup 1) (neg:DI (match_dup 0)))
3436 (set (match_dup 0) (if_then_else:DI (ge (match_dup 0) (const_int 0))
3437 (match_dup 0) (match_dup 1)))]
3441 [(set (match_operand:DI 0 "register_operand" "")
3442 (abs:DI (match_operand:DI 1 "register_operand" "")))]
3443 "! rtx_equal_p (operands[0], operands[1])"
3444 [(set (match_dup 0) (neg:DI (match_dup 1)))
3445 (set (match_dup 0) (if_then_else:DI (lt (match_dup 1) (const_int 0))
3446 (match_dup 0) (match_dup 1)))]
3450 [(set (match_operand:DI 0 "register_operand" "")
3451 (neg:DI (abs:DI (match_dup 0))))
3452 (clobber (match_operand:DI 1 "register_operand" ""))]
3454 [(set (match_dup 1) (neg:DI (match_dup 0)))
3455 (set (match_dup 0) (if_then_else:DI (le (match_dup 0) (const_int 0))
3456 (match_dup 0) (match_dup 1)))]
3460 [(set (match_operand:DI 0 "register_operand" "")
3461 (neg:DI (abs:DI (match_operand:DI 1 "register_operand" ""))))]
3462 "! rtx_equal_p (operands[0], operands[1])"
3463 [(set (match_dup 0) (neg:DI (match_dup 1)))
3464 (set (match_dup 0) (if_then_else:DI (gt (match_dup 1) (const_int 0))
3465 (match_dup 0) (match_dup 1)))]
3468 (define_insn "sminqi3"
3469 [(set (match_operand:QI 0 "register_operand" "=r")
3470 (smin:QI (match_operand:QI 1 "reg_or_0_operand" "%rJ")
3471 (match_operand:QI 2 "reg_or_8bit_operand" "rI")))]
3474 [(set_attr "type" "mvi")])
3476 (define_insn "uminqi3"
3477 [(set (match_operand:QI 0 "register_operand" "=r")
3478 (umin:QI (match_operand:QI 1 "reg_or_0_operand" "%rJ")
3479 (match_operand:QI 2 "reg_or_8bit_operand" "rI")))]
3482 [(set_attr "type" "mvi")])
3484 (define_insn "smaxqi3"
3485 [(set (match_operand:QI 0 "register_operand" "=r")
3486 (smax:QI (match_operand:QI 1 "reg_or_0_operand" "%rJ")
3487 (match_operand:QI 2 "reg_or_8bit_operand" "rI")))]
3490 [(set_attr "type" "mvi")])
3492 (define_insn "umaxqi3"
3493 [(set (match_operand:QI 0 "register_operand" "=r")
3494 (umax:QI (match_operand:QI 1 "reg_or_0_operand" "%rJ")
3495 (match_operand:QI 2 "reg_or_8bit_operand" "rI")))]
3498 [(set_attr "type" "mvi")])
3500 (define_insn "sminhi3"
3501 [(set (match_operand:HI 0 "register_operand" "=r")
3502 (smin:HI (match_operand:HI 1 "reg_or_0_operand" "%rJ")
3503 (match_operand:HI 2 "reg_or_8bit_operand" "rI")))]
3506 [(set_attr "type" "mvi")])
3508 (define_insn "uminhi3"
3509 [(set (match_operand:HI 0 "register_operand" "=r")
3510 (umin:HI (match_operand:HI 1 "reg_or_0_operand" "%rJ")
3511 (match_operand:HI 2 "reg_or_8bit_operand" "rI")))]
3514 [(set_attr "type" "mvi")])
3516 (define_insn "smaxhi3"
3517 [(set (match_operand:HI 0 "register_operand" "=r")
3518 (smax:HI (match_operand:HI 1 "reg_or_0_operand" "%rJ")
3519 (match_operand:HI 2 "reg_or_8bit_operand" "rI")))]
3522 [(set_attr "type" "mvi")])
3524 (define_insn "umaxhi3"
3525 [(set (match_operand:HI 0 "register_operand" "=r")
3526 (umax:HI (match_operand:HI 1 "reg_or_0_operand" "%rJ")
3527 (match_operand:HI 2 "reg_or_8bit_operand" "rI")))]
3530 [(set_attr "type" "mvi")])
3532 (define_expand "smaxdi3"
3534 (le:DI (match_operand:DI 1 "reg_or_0_operand" "")
3535 (match_operand:DI 2 "reg_or_8bit_operand" "")))
3536 (set (match_operand:DI 0 "register_operand" "")
3537 (if_then_else:DI (eq (match_dup 3) (const_int 0))
3538 (match_dup 1) (match_dup 2)))]
3540 { operands[3] = gen_reg_rtx (DImode); })
3543 [(set (match_operand:DI 0 "register_operand" "")
3544 (smax:DI (match_operand:DI 1 "reg_or_0_operand" "")
3545 (match_operand:DI 2 "reg_or_8bit_operand" "")))
3546 (clobber (match_operand:DI 3 "register_operand" ""))]
3547 "operands[2] != const0_rtx"
3548 [(set (match_dup 3) (le:DI (match_dup 1) (match_dup 2)))
3549 (set (match_dup 0) (if_then_else:DI (eq (match_dup 3) (const_int 0))
3550 (match_dup 1) (match_dup 2)))]
3553 (define_insn "*smax_const0"
3554 [(set (match_operand:DI 0 "register_operand" "=r")
3555 (smax:DI (match_operand:DI 1 "register_operand" "0")
3559 [(set_attr "type" "icmov")])
3561 (define_expand "smindi3"
3563 (lt:DI (match_operand:DI 1 "reg_or_0_operand" "")
3564 (match_operand:DI 2 "reg_or_8bit_operand" "")))
3565 (set (match_operand:DI 0 "register_operand" "")
3566 (if_then_else:DI (ne (match_dup 3) (const_int 0))
3567 (match_dup 1) (match_dup 2)))]
3569 { operands[3] = gen_reg_rtx (DImode); })
3572 [(set (match_operand:DI 0 "register_operand" "")
3573 (smin:DI (match_operand:DI 1 "reg_or_0_operand" "")
3574 (match_operand:DI 2 "reg_or_8bit_operand" "")))
3575 (clobber (match_operand:DI 3 "register_operand" ""))]
3576 "operands[2] != const0_rtx"
3577 [(set (match_dup 3) (lt:DI (match_dup 1) (match_dup 2)))
3578 (set (match_dup 0) (if_then_else:DI (ne (match_dup 3) (const_int 0))
3579 (match_dup 1) (match_dup 2)))]
3582 (define_insn "*smin_const0"
3583 [(set (match_operand:DI 0 "register_operand" "=r")
3584 (smin:DI (match_operand:DI 1 "register_operand" "0")
3588 [(set_attr "type" "icmov")])
3590 (define_expand "umaxdi3"
3592 (leu:DI (match_operand:DI 1 "reg_or_0_operand" "")
3593 (match_operand:DI 2 "reg_or_8bit_operand" "")))
3594 (set (match_operand:DI 0 "register_operand" "")
3595 (if_then_else:DI (eq (match_dup 3) (const_int 0))
3596 (match_dup 1) (match_dup 2)))]
3598 "operands[3] = gen_reg_rtx (DImode);")
3601 [(set (match_operand:DI 0 "register_operand" "")
3602 (umax:DI (match_operand:DI 1 "reg_or_0_operand" "")
3603 (match_operand:DI 2 "reg_or_8bit_operand" "")))
3604 (clobber (match_operand:DI 3 "register_operand" ""))]
3605 "operands[2] != const0_rtx"
3606 [(set (match_dup 3) (leu:DI (match_dup 1) (match_dup 2)))
3607 (set (match_dup 0) (if_then_else:DI (eq (match_dup 3) (const_int 0))
3608 (match_dup 1) (match_dup 2)))]
3611 (define_expand "umindi3"
3613 (ltu:DI (match_operand:DI 1 "reg_or_0_operand" "")
3614 (match_operand:DI 2 "reg_or_8bit_operand" "")))
3615 (set (match_operand:DI 0 "register_operand" "")
3616 (if_then_else:DI (ne (match_dup 3) (const_int 0))
3617 (match_dup 1) (match_dup 2)))]
3619 "operands[3] = gen_reg_rtx (DImode);")
3622 [(set (match_operand:DI 0 "register_operand" "")
3623 (umin:DI (match_operand:DI 1 "reg_or_0_operand" "")
3624 (match_operand:DI 2 "reg_or_8bit_operand" "")))
3625 (clobber (match_operand:DI 3 "register_operand" ""))]
3626 "operands[2] != const0_rtx"
3627 [(set (match_dup 3) (ltu:DI (match_dup 1) (match_dup 2)))
3628 (set (match_dup 0) (if_then_else:DI (ne (match_dup 3) (const_int 0))
3629 (match_dup 1) (match_dup 2)))]
3632 (define_insn "*bcc_normal"
3635 (match_operator 1 "signed_comparison_operator"
3636 [(match_operand:DI 2 "reg_or_0_operand" "rJ")
3638 (label_ref (match_operand 0 "" ""))
3642 [(set_attr "type" "ibr")])
3644 (define_insn "*bcc_reverse"
3647 (match_operator 1 "signed_comparison_operator"
3648 [(match_operand:DI 2 "register_operand" "r")
3652 (label_ref (match_operand 0 "" ""))))]
3655 [(set_attr "type" "ibr")])
3657 (define_insn "*blbs_normal"
3660 (ne (zero_extract:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
3664 (label_ref (match_operand 0 "" ""))
3668 [(set_attr "type" "ibr")])
3670 (define_insn "*blbc_normal"
3673 (eq (zero_extract:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
3677 (label_ref (match_operand 0 "" ""))
3681 [(set_attr "type" "ibr")])
3687 (match_operator 1 "comparison_operator"
3688 [(zero_extract:DI (match_operand:DI 2 "register_operand" "")
3690 (match_operand:DI 3 "const_int_operand" ""))
3692 (label_ref (match_operand 0 "" ""))
3694 (clobber (match_operand:DI 4 "register_operand" ""))])]
3695 "INTVAL (operands[3]) != 0"
3697 (lshiftrt:DI (match_dup 2) (match_dup 3)))
3699 (if_then_else (match_op_dup 1
3700 [(zero_extract:DI (match_dup 4)
3704 (label_ref (match_dup 0))
3708 ;; The following are the corresponding floating-point insns. Recall
3709 ;; we need to have variants that expand the arguments from SFmode
3712 (define_insn "*cmpdf_ieee"
3713 [(set (match_operand:DF 0 "register_operand" "=&f")
3714 (match_operator:DF 1 "alpha_fp_comparison_operator"
3715 [(match_operand:DF 2 "reg_or_0_operand" "fG")
3716 (match_operand:DF 3 "reg_or_0_operand" "fG")]))]
3717 "TARGET_FP && alpha_fptm >= ALPHA_FPTM_SU"
3718 "cmp%-%C1%/ %R2,%R3,%0"
3719 [(set_attr "type" "fadd")
3720 (set_attr "trap" "yes")
3721 (set_attr "trap_suffix" "su")])
3723 (define_insn "*cmpdf_internal"
3724 [(set (match_operand:DF 0 "register_operand" "=f")
3725 (match_operator:DF 1 "alpha_fp_comparison_operator"
3726 [(match_operand:DF 2 "reg_or_0_operand" "fG")
3727 (match_operand:DF 3 "reg_or_0_operand" "fG")]))]
3728 "TARGET_FP && alpha_fptm < ALPHA_FPTM_SU"
3729 "cmp%-%C1%/ %R2,%R3,%0"
3730 [(set_attr "type" "fadd")
3731 (set_attr "trap" "yes")
3732 (set_attr "trap_suffix" "su")])
3734 (define_insn "*cmpdf_ieee_ext1"
3735 [(set (match_operand:DF 0 "register_operand" "=&f")
3736 (match_operator:DF 1 "alpha_fp_comparison_operator"
3738 (match_operand:SF 2 "reg_or_0_operand" "fG"))
3739 (match_operand:DF 3 "reg_or_0_operand" "fG")]))]
3740 "TARGET_FP && alpha_fptm >= ALPHA_FPTM_SU"
3741 "cmp%-%C1%/ %R2,%R3,%0"
3742 [(set_attr "type" "fadd")
3743 (set_attr "trap" "yes")
3744 (set_attr "trap_suffix" "su")])
3746 (define_insn "*cmpdf_ext1"
3747 [(set (match_operand:DF 0 "register_operand" "=f")
3748 (match_operator:DF 1 "alpha_fp_comparison_operator"
3750 (match_operand:SF 2 "reg_or_0_operand" "fG"))
3751 (match_operand:DF 3 "reg_or_0_operand" "fG")]))]
3752 "TARGET_FP && alpha_fptm < ALPHA_FPTM_SU"
3753 "cmp%-%C1%/ %R2,%R3,%0"
3754 [(set_attr "type" "fadd")
3755 (set_attr "trap" "yes")
3756 (set_attr "trap_suffix" "su")])
3758 (define_insn "*cmpdf_ieee_ext2"
3759 [(set (match_operand:DF 0 "register_operand" "=&f")
3760 (match_operator:DF 1 "alpha_fp_comparison_operator"
3761 [(match_operand:DF 2 "reg_or_0_operand" "fG")
3763 (match_operand:SF 3 "reg_or_0_operand" "fG"))]))]
3764 "TARGET_FP && alpha_fptm >= ALPHA_FPTM_SU"
3765 "cmp%-%C1%/ %R2,%R3,%0"
3766 [(set_attr "type" "fadd")
3767 (set_attr "trap" "yes")
3768 (set_attr "trap_suffix" "su")])
3770 (define_insn "*cmpdf_ext2"
3771 [(set (match_operand:DF 0 "register_operand" "=f")
3772 (match_operator:DF 1 "alpha_fp_comparison_operator"
3773 [(match_operand:DF 2 "reg_or_0_operand" "fG")
3775 (match_operand:SF 3 "reg_or_0_operand" "fG"))]))]
3776 "TARGET_FP && alpha_fptm < ALPHA_FPTM_SU"
3777 "cmp%-%C1%/ %R2,%R3,%0"
3778 [(set_attr "type" "fadd")
3779 (set_attr "trap" "yes")
3780 (set_attr "trap_suffix" "su")])
3782 (define_insn "*cmpdf_ieee_ext3"
3783 [(set (match_operand:DF 0 "register_operand" "=&f")
3784 (match_operator:DF 1 "alpha_fp_comparison_operator"
3786 (match_operand:SF 2 "reg_or_0_operand" "fG"))
3788 (match_operand:SF 3 "reg_or_0_operand" "fG"))]))]
3789 "TARGET_FP && alpha_fptm >= ALPHA_FPTM_SU"
3790 "cmp%-%C1%/ %R2,%R3,%0"
3791 [(set_attr "type" "fadd")
3792 (set_attr "trap" "yes")
3793 (set_attr "trap_suffix" "su")])
3795 (define_insn "*cmpdf_ext3"
3796 [(set (match_operand:DF 0 "register_operand" "=f")
3797 (match_operator:DF 1 "alpha_fp_comparison_operator"
3799 (match_operand:SF 2 "reg_or_0_operand" "fG"))
3801 (match_operand:SF 3 "reg_or_0_operand" "fG"))]))]
3802 "TARGET_FP && alpha_fptm < ALPHA_FPTM_SU"
3803 "cmp%-%C1%/ %R2,%R3,%0"
3804 [(set_attr "type" "fadd")
3805 (set_attr "trap" "yes")
3806 (set_attr "trap_suffix" "su")])
3808 (define_insn "*movdfcc_internal"
3809 [(set (match_operand:DF 0 "register_operand" "=f,f")
3811 (match_operator 3 "signed_comparison_operator"
3812 [(match_operand:DF 4 "reg_or_0_operand" "fG,fG")
3813 (match_operand:DF 2 "const0_operand" "G,G")])
3814 (match_operand:DF 1 "reg_or_0_operand" "fG,0")
3815 (match_operand:DF 5 "reg_or_0_operand" "0,fG")))]
3819 fcmov%D3 %R4,%R5,%0"
3820 [(set_attr "type" "fcmov")])
3822 (define_insn "*movsfcc_internal"
3823 [(set (match_operand:SF 0 "register_operand" "=f,f")
3825 (match_operator 3 "signed_comparison_operator"
3826 [(match_operand:DF 4 "reg_or_0_operand" "fG,fG")
3827 (match_operand:DF 2 "const0_operand" "G,G")])
3828 (match_operand:SF 1 "reg_or_0_operand" "fG,0")
3829 (match_operand:SF 5 "reg_or_0_operand" "0,fG")))]
3833 fcmov%D3 %R4,%R5,%0"
3834 [(set_attr "type" "fcmov")])
3836 (define_insn "*movdfcc_ext1"
3837 [(set (match_operand:DF 0 "register_operand" "=f,f")
3839 (match_operator 3 "signed_comparison_operator"
3840 [(match_operand:DF 4 "reg_or_0_operand" "fG,fG")
3841 (match_operand:DF 2 "const0_operand" "G,G")])
3842 (float_extend:DF (match_operand:SF 1 "reg_or_0_operand" "fG,0"))
3843 (match_operand:DF 5 "reg_or_0_operand" "0,fG")))]
3847 fcmov%D3 %R4,%R5,%0"
3848 [(set_attr "type" "fcmov")])
3850 (define_insn "*movdfcc_ext2"
3851 [(set (match_operand:DF 0 "register_operand" "=f,f")
3853 (match_operator 3 "signed_comparison_operator"
3855 (match_operand:SF 4 "reg_or_0_operand" "fG,fG"))
3856 (match_operand:DF 2 "const0_operand" "G,G")])
3857 (match_operand:DF 1 "reg_or_0_operand" "fG,0")
3858 (match_operand:DF 5 "reg_or_0_operand" "0,fG")))]
3862 fcmov%D3 %R4,%R5,%0"
3863 [(set_attr "type" "fcmov")])
3865 (define_insn "*movdfcc_ext3"
3866 [(set (match_operand:SF 0 "register_operand" "=f,f")
3868 (match_operator 3 "signed_comparison_operator"
3870 (match_operand:SF 4 "reg_or_0_operand" "fG,fG"))
3871 (match_operand:DF 2 "const0_operand" "G,G")])
3872 (match_operand:SF 1 "reg_or_0_operand" "fG,0")
3873 (match_operand:SF 5 "reg_or_0_operand" "0,fG")))]
3877 fcmov%D3 %R4,%R5,%0"
3878 [(set_attr "type" "fcmov")])
3880 (define_insn "*movdfcc_ext4"
3881 [(set (match_operand:DF 0 "register_operand" "=f,f")
3883 (match_operator 3 "signed_comparison_operator"
3885 (match_operand:SF 4 "reg_or_0_operand" "fG,fG"))
3886 (match_operand:DF 2 "const0_operand" "G,G")])
3887 (float_extend:DF (match_operand:SF 1 "reg_or_0_operand" "fG,0"))
3888 (match_operand:DF 5 "reg_or_0_operand" "0,fG")))]
3892 fcmov%D3 %R4,%R5,%0"
3893 [(set_attr "type" "fcmov")])
3895 (define_expand "smaxdf3"
3897 (le:DF (match_operand:DF 1 "reg_or_0_operand" "")
3898 (match_operand:DF 2 "reg_or_0_operand" "")))
3899 (set (match_operand:DF 0 "register_operand" "")
3900 (if_then_else:DF (eq (match_dup 3) (match_dup 4))
3901 (match_dup 1) (match_dup 2)))]
3904 operands[3] = gen_reg_rtx (DFmode);
3905 operands[4] = CONST0_RTX (DFmode);
3908 (define_expand "smindf3"
3910 (lt:DF (match_operand:DF 1 "reg_or_0_operand" "")
3911 (match_operand:DF 2 "reg_or_0_operand" "")))
3912 (set (match_operand:DF 0 "register_operand" "")
3913 (if_then_else:DF (ne (match_dup 3) (match_dup 4))
3914 (match_dup 1) (match_dup 2)))]
3917 operands[3] = gen_reg_rtx (DFmode);
3918 operands[4] = CONST0_RTX (DFmode);
3921 (define_expand "smaxsf3"
3923 (le:DF (float_extend:DF (match_operand:SF 1 "reg_or_0_operand" ""))
3924 (float_extend:DF (match_operand:SF 2 "reg_or_0_operand" ""))))
3925 (set (match_operand:SF 0 "register_operand" "")
3926 (if_then_else:SF (eq (match_dup 3) (match_dup 4))
3927 (match_dup 1) (match_dup 2)))]
3930 operands[3] = gen_reg_rtx (DFmode);
3931 operands[4] = CONST0_RTX (DFmode);
3934 (define_expand "sminsf3"
3936 (lt:DF (float_extend:DF (match_operand:SF 1 "reg_or_0_operand" ""))
3937 (float_extend:DF (match_operand:SF 2 "reg_or_0_operand" ""))))
3938 (set (match_operand:SF 0 "register_operand" "")
3939 (if_then_else:SF (ne (match_dup 3) (match_dup 4))
3940 (match_dup 1) (match_dup 2)))]
3943 operands[3] = gen_reg_rtx (DFmode);
3944 operands[4] = CONST0_RTX (DFmode);
3947 (define_insn "*fbcc_normal"
3950 (match_operator 1 "signed_comparison_operator"
3951 [(match_operand:DF 2 "reg_or_0_operand" "fG")
3952 (match_operand:DF 3 "const0_operand" "G")])
3953 (label_ref (match_operand 0 "" ""))
3957 [(set_attr "type" "fbr")])
3959 (define_insn "*fbcc_ext_normal"
3962 (match_operator 1 "signed_comparison_operator"
3964 (match_operand:SF 2 "reg_or_0_operand" "fG"))
3965 (match_operand:DF 3 "const0_operand" "G")])
3966 (label_ref (match_operand 0 "" ""))
3970 [(set_attr "type" "fbr")])
3972 ;; These are the main define_expand's used to make conditional branches
3975 (define_expand "cmpdf"
3976 [(set (cc0) (compare (match_operand:DF 0 "reg_or_0_operand" "")
3977 (match_operand:DF 1 "reg_or_0_operand" "")))]
3980 alpha_compare.op0 = operands[0];
3981 alpha_compare.op1 = operands[1];
3982 alpha_compare.fp_p = 1;
3986 (define_expand "cmptf"
3987 [(set (cc0) (compare (match_operand:TF 0 "general_operand" "")
3988 (match_operand:TF 1 "general_operand" "")))]
3989 "TARGET_HAS_XFLOATING_LIBS"
3991 alpha_compare.op0 = operands[0];
3992 alpha_compare.op1 = operands[1];
3993 alpha_compare.fp_p = 1;
3997 (define_expand "cmpdi"
3998 [(set (cc0) (compare (match_operand:DI 0 "some_operand" "")
3999 (match_operand:DI 1 "some_operand" "")))]
4002 alpha_compare.op0 = operands[0];
4003 alpha_compare.op1 = operands[1];
4004 alpha_compare.fp_p = 0;
4008 (define_expand "beq"
4010 (if_then_else (match_dup 1)
4011 (label_ref (match_operand 0 "" ""))
4014 "{ operands[1] = alpha_emit_conditional_branch (EQ); }")
4016 (define_expand "bne"
4018 (if_then_else (match_dup 1)
4019 (label_ref (match_operand 0 "" ""))
4022 "{ operands[1] = alpha_emit_conditional_branch (NE); }")
4024 (define_expand "blt"
4026 (if_then_else (match_dup 1)
4027 (label_ref (match_operand 0 "" ""))
4030 "{ operands[1] = alpha_emit_conditional_branch (LT); }")
4032 (define_expand "ble"
4034 (if_then_else (match_dup 1)
4035 (label_ref (match_operand 0 "" ""))
4038 "{ operands[1] = alpha_emit_conditional_branch (LE); }")
4040 (define_expand "bgt"
4042 (if_then_else (match_dup 1)
4043 (label_ref (match_operand 0 "" ""))
4046 "{ operands[1] = alpha_emit_conditional_branch (GT); }")
4048 (define_expand "bge"
4050 (if_then_else (match_dup 1)
4051 (label_ref (match_operand 0 "" ""))
4054 "{ operands[1] = alpha_emit_conditional_branch (GE); }")
4056 (define_expand "bltu"
4058 (if_then_else (match_dup 1)
4059 (label_ref (match_operand 0 "" ""))
4062 "{ operands[1] = alpha_emit_conditional_branch (LTU); }")
4064 (define_expand "bleu"
4066 (if_then_else (match_dup 1)
4067 (label_ref (match_operand 0 "" ""))
4070 "{ operands[1] = alpha_emit_conditional_branch (LEU); }")
4072 (define_expand "bgtu"
4074 (if_then_else (match_dup 1)
4075 (label_ref (match_operand 0 "" ""))
4078 "{ operands[1] = alpha_emit_conditional_branch (GTU); }")
4080 (define_expand "bgeu"
4082 (if_then_else (match_dup 1)
4083 (label_ref (match_operand 0 "" ""))
4086 "{ operands[1] = alpha_emit_conditional_branch (GEU); }")
4088 (define_expand "bunordered"
4090 (if_then_else (match_dup 1)
4091 (label_ref (match_operand 0 "" ""))
4094 "{ operands[1] = alpha_emit_conditional_branch (UNORDERED); }")
4096 (define_expand "bordered"
4098 (if_then_else (match_dup 1)
4099 (label_ref (match_operand 0 "" ""))
4102 "{ operands[1] = alpha_emit_conditional_branch (ORDERED); }")
4104 (define_expand "seq"
4105 [(set (match_operand:DI 0 "register_operand" "")
4108 "{ if ((operands[1] = alpha_emit_setcc (EQ)) == NULL_RTX) FAIL; }")
4110 (define_expand "sne"
4111 [(set (match_operand:DI 0 "register_operand" "")
4114 "{ if ((operands[1] = alpha_emit_setcc (NE)) == NULL_RTX) FAIL; }")
4116 (define_expand "slt"
4117 [(set (match_operand:DI 0 "register_operand" "")
4120 "{ if ((operands[1] = alpha_emit_setcc (LT)) == NULL_RTX) FAIL; }")
4122 (define_expand "sle"
4123 [(set (match_operand:DI 0 "register_operand" "")
4126 "{ if ((operands[1] = alpha_emit_setcc (LE)) == NULL_RTX) FAIL; }")
4128 (define_expand "sgt"
4129 [(set (match_operand:DI 0 "register_operand" "")
4132 "{ if ((operands[1] = alpha_emit_setcc (GT)) == NULL_RTX) FAIL; }")
4134 (define_expand "sge"
4135 [(set (match_operand:DI 0 "register_operand" "")
4138 "{ if ((operands[1] = alpha_emit_setcc (GE)) == NULL_RTX) FAIL; }")
4140 (define_expand "sltu"
4141 [(set (match_operand:DI 0 "register_operand" "")
4144 "{ if ((operands[1] = alpha_emit_setcc (LTU)) == NULL_RTX) FAIL; }")
4146 (define_expand "sleu"
4147 [(set (match_operand:DI 0 "register_operand" "")
4150 "{ if ((operands[1] = alpha_emit_setcc (LEU)) == NULL_RTX) FAIL; }")
4152 (define_expand "sgtu"
4153 [(set (match_operand:DI 0 "register_operand" "")
4156 "{ if ((operands[1] = alpha_emit_setcc (GTU)) == NULL_RTX) FAIL; }")
4158 (define_expand "sgeu"
4159 [(set (match_operand:DI 0 "register_operand" "")
4162 "{ if ((operands[1] = alpha_emit_setcc (GEU)) == NULL_RTX) FAIL; }")
4164 (define_expand "sunordered"
4165 [(set (match_operand:DI 0 "register_operand" "")
4168 "{ if ((operands[1] = alpha_emit_setcc (UNORDERED)) == NULL_RTX) FAIL; }")
4170 (define_expand "sordered"
4171 [(set (match_operand:DI 0 "register_operand" "")
4174 "{ if ((operands[1] = alpha_emit_setcc (ORDERED)) == NULL_RTX) FAIL; }")
4176 ;; These are the main define_expand's used to make conditional moves.
4178 (define_expand "movsicc"
4179 [(set (match_operand:SI 0 "register_operand" "")
4180 (if_then_else:SI (match_operand 1 "comparison_operator" "")
4181 (match_operand:SI 2 "reg_or_8bit_operand" "")
4182 (match_operand:SI 3 "reg_or_8bit_operand" "")))]
4185 if ((operands[1] = alpha_emit_conditional_move (operands[1], SImode)) == 0)
4189 (define_expand "movdicc"
4190 [(set (match_operand:DI 0 "register_operand" "")
4191 (if_then_else:DI (match_operand 1 "comparison_operator" "")
4192 (match_operand:DI 2 "reg_or_8bit_operand" "")
4193 (match_operand:DI 3 "reg_or_8bit_operand" "")))]
4196 if ((operands[1] = alpha_emit_conditional_move (operands[1], DImode)) == 0)
4200 (define_expand "movsfcc"
4201 [(set (match_operand:SF 0 "register_operand" "")
4202 (if_then_else:SF (match_operand 1 "comparison_operator" "")
4203 (match_operand:SF 2 "reg_or_8bit_operand" "")
4204 (match_operand:SF 3 "reg_or_8bit_operand" "")))]
4207 if ((operands[1] = alpha_emit_conditional_move (operands[1], SFmode)) == 0)
4211 (define_expand "movdfcc"
4212 [(set (match_operand:DF 0 "register_operand" "")
4213 (if_then_else:DF (match_operand 1 "comparison_operator" "")
4214 (match_operand:DF 2 "reg_or_8bit_operand" "")
4215 (match_operand:DF 3 "reg_or_8bit_operand" "")))]
4218 if ((operands[1] = alpha_emit_conditional_move (operands[1], DFmode)) == 0)
4222 ;; These define_split definitions are used in cases when comparisons have
4223 ;; not be stated in the correct way and we need to reverse the second
4224 ;; comparison. For example, x >= 7 has to be done as x < 6 with the
4225 ;; comparison that tests the result being reversed. We have one define_split
4226 ;; for each use of a comparison. They do not match valid insns and need
4227 ;; not generate valid insns.
4229 ;; We can also handle equality comparisons (and inequality comparisons in
4230 ;; cases where the resulting add cannot overflow) by doing an add followed by
4231 ;; a comparison with zero. This is faster since the addition takes one
4232 ;; less cycle than a compare when feeding into a conditional move.
4233 ;; For this case, we also have an SImode pattern since we can merge the add
4234 ;; and sign extend and the order doesn't matter.
4236 ;; We do not do this for floating-point, since it isn't clear how the "wrong"
4237 ;; operation could have been generated.
4240 [(set (match_operand:DI 0 "register_operand" "")
4242 (match_operator 1 "comparison_operator"
4243 [(match_operand:DI 2 "reg_or_0_operand" "")
4244 (match_operand:DI 3 "reg_or_cint_operand" "")])
4245 (match_operand:DI 4 "reg_or_cint_operand" "")
4246 (match_operand:DI 5 "reg_or_cint_operand" "")))
4247 (clobber (match_operand:DI 6 "register_operand" ""))]
4248 "operands[3] != const0_rtx"
4249 [(set (match_dup 6) (match_dup 7))
4251 (if_then_else:DI (match_dup 8) (match_dup 4) (match_dup 5)))]
4253 enum rtx_code code = GET_CODE (operands[1]);
4254 int unsignedp = (code == GEU || code == LEU || code == GTU || code == LTU);
4256 /* If we are comparing for equality with a constant and that constant
4257 appears in the arm when the register equals the constant, use the
4258 register since that is more likely to match (and to produce better code
4261 if (code == EQ && GET_CODE (operands[3]) == CONST_INT
4262 && rtx_equal_p (operands[4], operands[3]))
4263 operands[4] = operands[2];
4265 else if (code == NE && GET_CODE (operands[3]) == CONST_INT
4266 && rtx_equal_p (operands[5], operands[3]))
4267 operands[5] = operands[2];
4269 if (code == NE || code == EQ
4270 || (extended_count (operands[2], DImode, unsignedp) >= 1
4271 && extended_count (operands[3], DImode, unsignedp) >= 1))
4273 if (GET_CODE (operands[3]) == CONST_INT)
4274 operands[7] = gen_rtx_PLUS (DImode, operands[2],
4275 GEN_INT (- INTVAL (operands[3])));
4277 operands[7] = gen_rtx_MINUS (DImode, operands[2], operands[3]);
4279 operands[8] = gen_rtx_fmt_ee (code, VOIDmode, operands[6], const0_rtx);
4282 else if (code == EQ || code == LE || code == LT
4283 || code == LEU || code == LTU)
4285 operands[7] = gen_rtx_fmt_ee (code, DImode, operands[2], operands[3]);
4286 operands[8] = gen_rtx_NE (VOIDmode, operands[6], const0_rtx);
4290 operands[7] = gen_rtx_fmt_ee (reverse_condition (code), DImode,
4291 operands[2], operands[3]);
4292 operands[8] = gen_rtx_EQ (VOIDmode, operands[6], const0_rtx);
4297 [(set (match_operand:DI 0 "register_operand" "")
4299 (match_operator 1 "comparison_operator"
4300 [(match_operand:SI 2 "reg_or_0_operand" "")
4301 (match_operand:SI 3 "reg_or_cint_operand" "")])
4302 (match_operand:DI 4 "reg_or_8bit_operand" "")
4303 (match_operand:DI 5 "reg_or_8bit_operand" "")))
4304 (clobber (match_operand:DI 6 "register_operand" ""))]
4305 "operands[3] != const0_rtx
4306 && (GET_CODE (operands[1]) == EQ || GET_CODE (operands[1]) == NE)"
4307 [(set (match_dup 6) (match_dup 7))
4309 (if_then_else:DI (match_dup 8) (match_dup 4) (match_dup 5)))]
4311 enum rtx_code code = GET_CODE (operands[1]);
4312 int unsignedp = (code == GEU || code == LEU || code == GTU || code == LTU);
4315 if ((code != NE && code != EQ
4316 && ! (extended_count (operands[2], DImode, unsignedp) >= 1
4317 && extended_count (operands[3], DImode, unsignedp) >= 1)))
4320 if (GET_CODE (operands[3]) == CONST_INT)
4321 tem = gen_rtx_PLUS (SImode, operands[2],
4322 GEN_INT (- INTVAL (operands[3])));
4324 tem = gen_rtx_MINUS (SImode, operands[2], operands[3]);
4326 operands[7] = gen_rtx_SIGN_EXTEND (DImode, tem);
4327 operands[8] = gen_rtx_fmt_ee (GET_CODE (operands[1]), VOIDmode,
4328 operands[6], const0_rtx);
4331 ;; Prefer to use cmp and arithmetic when possible instead of a cmove.
4334 [(set (match_operand 0 "register_operand" "")
4335 (if_then_else (match_operator 1 "signed_comparison_operator"
4336 [(match_operand:DI 2 "reg_or_0_operand" "")
4338 (match_operand 3 "const_int_operand" "")
4339 (match_operand 4 "const_int_operand" "")))]
4343 if (alpha_split_conditional_move (GET_CODE (operands[1]), operands[0],
4344 operands[2], operands[3], operands[4]))
4350 ;; ??? Why combine is allowed to create such non-canonical rtl, I don't know.
4351 ;; Oh well, we match it in movcc, so it must be partially our fault.
4353 [(set (match_operand 0 "register_operand" "")
4354 (if_then_else (match_operator 1 "signed_comparison_operator"
4356 (match_operand:DI 2 "reg_or_0_operand" "")])
4357 (match_operand 3 "const_int_operand" "")
4358 (match_operand 4 "const_int_operand" "")))]
4362 if (alpha_split_conditional_move (swap_condition (GET_CODE (operands[1])),
4363 operands[0], operands[2], operands[3],
4370 (define_insn_and_split "*cmp_sadd_di"
4371 [(set (match_operand:DI 0 "register_operand" "=r")
4372 (plus:DI (if_then_else:DI
4373 (match_operator 1 "alpha_zero_comparison_operator"
4374 [(match_operand:DI 2 "reg_or_0_operand" "rJ")
4376 (match_operand:DI 3 "const48_operand" "I")
4378 (match_operand:DI 4 "sext_add_operand" "rIO")))
4379 (clobber (match_scratch:DI 5 "=r"))]
4382 "! no_new_pseudos || reload_completed"
4384 (match_op_dup:DI 1 [(match_dup 2) (const_int 0)]))
4386 (plus:DI (mult:DI (match_dup 5) (match_dup 3))
4389 if (! no_new_pseudos)
4390 operands[5] = gen_reg_rtx (DImode);
4391 else if (reg_overlap_mentioned_p (operands[5], operands[4]))
4392 operands[5] = operands[0];
4395 (define_insn_and_split "*cmp_sadd_si"
4396 [(set (match_operand:SI 0 "register_operand" "=r")
4397 (plus:SI (if_then_else:SI
4398 (match_operator 1 "alpha_zero_comparison_operator"
4399 [(match_operand:DI 2 "reg_or_0_operand" "rJ")
4401 (match_operand:SI 3 "const48_operand" "I")
4403 (match_operand:SI 4 "sext_add_operand" "rIO")))
4404 (clobber (match_scratch:SI 5 "=r"))]
4407 "! no_new_pseudos || reload_completed"
4409 (match_op_dup:SI 1 [(match_dup 2) (const_int 0)]))
4411 (plus:SI (mult:SI (match_dup 5) (match_dup 3))
4414 if (! no_new_pseudos)
4415 operands[5] = gen_reg_rtx (DImode);
4416 else if (reg_overlap_mentioned_p (operands[5], operands[4]))
4417 operands[5] = operands[0];
4420 (define_insn_and_split "*cmp_sadd_sidi"
4421 [(set (match_operand:DI 0 "register_operand" "=r")
4423 (plus:SI (if_then_else:SI
4424 (match_operator 1 "alpha_zero_comparison_operator"
4425 [(match_operand:DI 2 "reg_or_0_operand" "rJ")
4427 (match_operand:SI 3 "const48_operand" "I")
4429 (match_operand:SI 4 "sext_add_operand" "rIO"))))
4430 (clobber (match_scratch:SI 5 "=r"))]
4433 "! no_new_pseudos || reload_completed"
4435 (match_op_dup:SI 1 [(match_dup 2) (const_int 0)]))
4437 (sign_extend:DI (plus:SI (mult:SI (match_dup 5) (match_dup 3))
4440 if (! no_new_pseudos)
4441 operands[5] = gen_reg_rtx (DImode);
4442 else if (reg_overlap_mentioned_p (operands[5], operands[4]))
4443 operands[5] = operands[0];
4446 (define_insn_and_split "*cmp_ssub_di"
4447 [(set (match_operand:DI 0 "register_operand" "=r")
4448 (minus:DI (if_then_else:DI
4449 (match_operator 1 "alpha_zero_comparison_operator"
4450 [(match_operand:DI 2 "reg_or_0_operand" "rJ")
4452 (match_operand:DI 3 "const48_operand" "I")
4454 (match_operand:DI 4 "reg_or_8bit_operand" "rI")))
4455 (clobber (match_scratch:DI 5 "=r"))]
4458 "! no_new_pseudos || reload_completed"
4460 (match_op_dup:DI 1 [(match_dup 2) (const_int 0)]))
4462 (minus:DI (mult:DI (match_dup 5) (match_dup 3))
4465 if (! no_new_pseudos)
4466 operands[5] = gen_reg_rtx (DImode);
4467 else if (reg_overlap_mentioned_p (operands[5], operands[4]))
4468 operands[5] = operands[0];
4471 (define_insn_and_split "*cmp_ssub_si"
4472 [(set (match_operand:SI 0 "register_operand" "=r")
4473 (minus:SI (if_then_else:SI
4474 (match_operator 1 "alpha_zero_comparison_operator"
4475 [(match_operand:DI 2 "reg_or_0_operand" "rJ")
4477 (match_operand:SI 3 "const48_operand" "I")
4479 (match_operand:SI 4 "reg_or_8bit_operand" "rI")))
4480 (clobber (match_scratch:SI 5 "=r"))]
4483 "! no_new_pseudos || reload_completed"
4485 (match_op_dup:SI 1 [(match_dup 2) (const_int 0)]))
4487 (minus:SI (mult:SI (match_dup 5) (match_dup 3))
4490 if (! no_new_pseudos)
4491 operands[5] = gen_reg_rtx (DImode);
4492 else if (reg_overlap_mentioned_p (operands[5], operands[4]))
4493 operands[5] = operands[0];
4496 (define_insn_and_split "*cmp_ssub_sidi"
4497 [(set (match_operand:DI 0 "register_operand" "=r")
4499 (minus:SI (if_then_else:SI
4500 (match_operator 1 "alpha_zero_comparison_operator"
4501 [(match_operand:DI 2 "reg_or_0_operand" "rJ")
4503 (match_operand:SI 3 "const48_operand" "I")
4505 (match_operand:SI 4 "reg_or_8bit_operand" "rI"))))
4506 (clobber (match_scratch:SI 5 "=r"))]
4509 "! no_new_pseudos || reload_completed"
4511 (match_op_dup:SI 1 [(match_dup 2) (const_int 0)]))
4513 (sign_extend:DI (minus:SI (mult:SI (match_dup 5) (match_dup 3))
4516 if (! no_new_pseudos)
4517 operands[5] = gen_reg_rtx (DImode);
4518 else if (reg_overlap_mentioned_p (operands[5], operands[4]))
4519 operands[5] = operands[0];
4522 ;; Here are the CALL and unconditional branch insns. Calls on NT and OSF
4523 ;; work differently, so we have different patterns for each.
4525 ;; On Unicos/Mk a call information word (CIW) must be generated for each
4526 ;; call. The CIW contains information about arguments passed in registers
4527 ;; and is stored in the caller's SSIB. Its offset relative to the beginning
4528 ;; of the SSIB is passed in $25. Handling this properly is quite complicated
4529 ;; in the presence of inlining since the CIWs for calls performed by the
4530 ;; inlined function must be stored in the SSIB of the function it is inlined
4531 ;; into as well. We encode the CIW in an unspec and append it to the list
4532 ;; of the CIWs for the current function only when the instruction for loading
4533 ;; $25 is generated.
4535 (define_expand "call"
4536 [(use (match_operand:DI 0 "" ""))
4537 (use (match_operand 1 "" ""))
4538 (use (match_operand 2 "" ""))
4539 (use (match_operand 3 "" ""))]
4542 if (TARGET_ABI_WINDOWS_NT)
4543 emit_call_insn (gen_call_nt (operands[0], operands[1]));
4544 else if (TARGET_ABI_OPEN_VMS)
4545 emit_call_insn (gen_call_vms (operands[0], operands[2]));
4546 else if (TARGET_ABI_UNICOSMK)
4547 emit_call_insn (gen_call_umk (operands[0], operands[2]));
4549 emit_call_insn (gen_call_osf (operands[0], operands[1]));
4553 (define_expand "sibcall"
4554 [(parallel [(call (mem:DI (match_operand 0 "" ""))
4555 (match_operand 1 "" ""))
4556 (unspec [(reg:DI 29)] UNSPEC_SIBCALL)])]
4559 gcc_assert (GET_CODE (operands[0]) == MEM);
4560 operands[0] = XEXP (operands[0], 0);
4563 (define_expand "call_osf"
4564 [(parallel [(call (mem:DI (match_operand 0 "" ""))
4565 (match_operand 1 "" ""))
4567 (clobber (reg:DI 26))])]
4570 gcc_assert (GET_CODE (operands[0]) == MEM);
4572 operands[0] = XEXP (operands[0], 0);
4573 if (! call_operand (operands[0], Pmode))
4574 operands[0] = copy_to_mode_reg (Pmode, operands[0]);
4577 (define_expand "call_nt"
4578 [(parallel [(call (mem:DI (match_operand 0 "" ""))
4579 (match_operand 1 "" ""))
4580 (clobber (reg:DI 26))])]
4583 gcc_assert (GET_CODE (operands[0]) == MEM);
4585 operands[0] = XEXP (operands[0], 0);
4586 if (GET_CODE (operands[0]) != SYMBOL_REF && GET_CODE (operands[0]) != REG)
4587 operands[0] = force_reg (DImode, operands[0]);
4590 ;; Calls on Unicos/Mk are always indirect.
4591 ;; op 0: symbol ref for called function
4592 ;; op 1: CIW for $25 represented by an unspec
4594 (define_expand "call_umk"
4595 [(parallel [(call (mem:DI (match_operand 0 "" ""))
4596 (match_operand 1 "" ""))
4598 (clobber (reg:DI 26))])]
4601 gcc_assert (GET_CODE (operands[0]) == MEM);
4603 /* Always load the address of the called function into a register;
4604 load the CIW in $25. */
4606 operands[0] = XEXP (operands[0], 0);
4607 if (GET_CODE (operands[0]) != REG)
4608 operands[0] = force_reg (DImode, operands[0]);
4610 emit_move_insn (gen_rtx_REG (DImode, 25), operands[1]);
4614 ;; call openvms/alpha
4615 ;; op 0: symbol ref for called function
4616 ;; op 1: next_arg_reg (argument information value for R25)
4618 (define_expand "call_vms"
4619 [(parallel [(call (mem:DI (match_operand 0 "" ""))
4620 (match_operand 1 "" ""))
4624 (clobber (reg:DI 27))])]
4627 gcc_assert (GET_CODE (operands[0]) == MEM);
4629 operands[0] = XEXP (operands[0], 0);
4631 /* Always load AI with argument information, then handle symbolic and
4632 indirect call differently. Load RA and set operands[2] to PV in
4635 emit_move_insn (gen_rtx_REG (DImode, 25), operands[1]);
4636 if (GET_CODE (operands[0]) == SYMBOL_REF)
4638 alpha_need_linkage (XSTR (operands[0], 0), 0);
4640 operands[2] = const0_rtx;
4644 emit_move_insn (gen_rtx_REG (Pmode, 26),
4645 gen_rtx_MEM (Pmode, plus_constant (operands[0], 8)));
4646 operands[2] = operands[0];
4651 (define_expand "call_value"
4652 [(use (match_operand 0 "" ""))
4653 (use (match_operand:DI 1 "" ""))
4654 (use (match_operand 2 "" ""))
4655 (use (match_operand 3 "" ""))
4656 (use (match_operand 4 "" ""))]
4659 if (TARGET_ABI_WINDOWS_NT)
4660 emit_call_insn (gen_call_value_nt (operands[0], operands[1], operands[2]));
4661 else if (TARGET_ABI_OPEN_VMS)
4662 emit_call_insn (gen_call_value_vms (operands[0], operands[1],
4664 else if (TARGET_ABI_UNICOSMK)
4665 emit_call_insn (gen_call_value_umk (operands[0], operands[1],
4668 emit_call_insn (gen_call_value_osf (operands[0], operands[1],
4673 (define_expand "sibcall_value"
4674 [(parallel [(set (match_operand 0 "" "")
4675 (call (mem:DI (match_operand 1 "" ""))
4676 (match_operand 2 "" "")))
4677 (unspec [(reg:DI 29)] UNSPEC_SIBCALL)])]
4680 gcc_assert (GET_CODE (operands[1]) == MEM);
4681 operands[1] = XEXP (operands[1], 0);
4684 (define_expand "call_value_osf"
4685 [(parallel [(set (match_operand 0 "" "")
4686 (call (mem:DI (match_operand 1 "" ""))
4687 (match_operand 2 "" "")))
4689 (clobber (reg:DI 26))])]
4692 gcc_assert (GET_CODE (operands[1]) == MEM);
4694 operands[1] = XEXP (operands[1], 0);
4695 if (! call_operand (operands[1], Pmode))
4696 operands[1] = copy_to_mode_reg (Pmode, operands[1]);
4699 (define_expand "call_value_nt"
4700 [(parallel [(set (match_operand 0 "" "")
4701 (call (mem:DI (match_operand 1 "" ""))
4702 (match_operand 2 "" "")))
4703 (clobber (reg:DI 26))])]
4706 gcc_assert (GET_CODE (operands[1]) == MEM);
4708 operands[1] = XEXP (operands[1], 0);
4709 if (GET_CODE (operands[1]) != SYMBOL_REF && GET_CODE (operands[1]) != REG)
4710 operands[1] = force_reg (DImode, operands[1]);
4713 (define_expand "call_value_vms"
4714 [(parallel [(set (match_operand 0 "" "")
4715 (call (mem:DI (match_operand:DI 1 "" ""))
4716 (match_operand 2 "" "")))
4720 (clobber (reg:DI 27))])]
4723 gcc_assert (GET_CODE (operands[1]) == MEM);
4725 operands[1] = XEXP (operands[1], 0);
4727 /* Always load AI with argument information, then handle symbolic and
4728 indirect call differently. Load RA and set operands[3] to PV in
4731 emit_move_insn (gen_rtx_REG (DImode, 25), operands[2]);
4732 if (GET_CODE (operands[1]) == SYMBOL_REF)
4734 alpha_need_linkage (XSTR (operands[1], 0), 0);
4736 operands[3] = const0_rtx;
4740 emit_move_insn (gen_rtx_REG (Pmode, 26),
4741 gen_rtx_MEM (Pmode, plus_constant (operands[1], 8)));
4742 operands[3] = operands[1];
4746 (define_expand "call_value_umk"
4747 [(parallel [(set (match_operand 0 "" "")
4748 (call (mem:DI (match_operand 1 "" ""))
4749 (match_operand 2 "" "")))
4751 (clobber (reg:DI 26))])]
4754 gcc_assert (GET_CODE (operands[1]) == MEM);
4756 operands[1] = XEXP (operands[1], 0);
4757 if (GET_CODE (operands[1]) != REG)
4758 operands[1] = force_reg (DImode, operands[1]);
4760 emit_move_insn (gen_rtx_REG (DImode, 25), operands[2]);
4763 (define_insn "*call_osf_1_er_noreturn"
4764 [(call (mem:DI (match_operand:DI 0 "call_operand" "c,R,s"))
4765 (match_operand 1 "" ""))
4767 (clobber (reg:DI 26))]
4768 "TARGET_EXPLICIT_RELOCS && TARGET_ABI_OSF
4769 && find_reg_note (insn, REG_NORETURN, NULL_RTX)"
4772 bsr $26,%0\t\t!samegp
4773 ldq $27,%0($29)\t\t!literal!%#\;jsr $26,($27),%0\t\t!lituse_jsr!%#"
4774 [(set_attr "type" "jsr")
4775 (set_attr "length" "*,*,8")])
4777 (define_insn "*call_osf_1_er"
4778 [(call (mem:DI (match_operand:DI 0 "call_operand" "c,R,s"))
4779 (match_operand 1 "" ""))
4781 (clobber (reg:DI 26))]
4782 "TARGET_EXPLICIT_RELOCS && TARGET_ABI_OSF"
4784 jsr $26,(%0),0\;ldah $29,0($26)\t\t!gpdisp!%*\;lda $29,0($29)\t\t!gpdisp!%*
4785 bsr $26,%0\t\t!samegp
4786 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!%*"
4787 [(set_attr "type" "jsr")
4788 (set_attr "length" "12,*,16")])
4790 ;; We must use peep2 instead of a split because we need accurate life
4791 ;; information for $gp. Consider the case of { bar(); while (1); }.
4793 [(parallel [(call (mem:DI (match_operand:DI 0 "call_operand" ""))
4794 (match_operand 1 "" ""))
4796 (clobber (reg:DI 26))])]
4797 "TARGET_EXPLICIT_RELOCS && TARGET_ABI_OSF && reload_completed
4798 && ! samegp_function_operand (operands[0], Pmode)
4799 && (peep2_regno_dead_p (1, 29)
4800 || find_reg_note (insn, REG_NORETURN, NULL_RTX))"
4801 [(parallel [(call (mem:DI (match_dup 2))
4806 (clobber (reg:DI 26))])]
4808 if (CONSTANT_P (operands[0]))
4810 operands[2] = gen_rtx_REG (Pmode, 27);
4811 operands[3] = GEN_INT (alpha_next_sequence_number++);
4812 emit_insn (gen_movdi_er_high_g (operands[2], pic_offset_table_rtx,
4813 operands[0], operands[3]));
4817 operands[2] = operands[0];
4818 operands[0] = const0_rtx;
4819 operands[3] = const0_rtx;
4824 [(parallel [(call (mem:DI (match_operand:DI 0 "call_operand" ""))
4825 (match_operand 1 "" ""))
4827 (clobber (reg:DI 26))])]
4828 "TARGET_EXPLICIT_RELOCS && TARGET_ABI_OSF && reload_completed
4829 && ! samegp_function_operand (operands[0], Pmode)
4830 && ! (peep2_regno_dead_p (1, 29)
4831 || find_reg_note (insn, REG_NORETURN, NULL_RTX))"
4832 [(parallel [(call (mem:DI (match_dup 2))
4835 (unspec:DI [(match_dup 5) (match_dup 3)] UNSPEC_LDGP1))
4838 (clobber (reg:DI 26))])
4840 (unspec:DI [(match_dup 5) (match_dup 3)] UNSPEC_LDGP2))]
4842 if (CONSTANT_P (operands[0]))
4844 operands[2] = gen_rtx_REG (Pmode, 27);
4845 operands[4] = GEN_INT (alpha_next_sequence_number++);
4846 emit_insn (gen_movdi_er_high_g (operands[2], pic_offset_table_rtx,
4847 operands[0], operands[4]));
4851 operands[2] = operands[0];
4852 operands[0] = const0_rtx;
4853 operands[4] = const0_rtx;
4855 operands[3] = GEN_INT (alpha_next_sequence_number++);
4856 operands[5] = pic_offset_table_rtx;
4859 (define_insn "*call_osf_2_er_nogp"
4860 [(call (mem:DI (match_operand:DI 0 "register_operand" "c"))
4861 (match_operand 1 "" ""))
4863 (use (match_operand 2 "" ""))
4864 (use (match_operand 3 "const_int_operand" ""))
4865 (clobber (reg:DI 26))]
4866 "TARGET_EXPLICIT_RELOCS && TARGET_ABI_OSF"
4867 "jsr $26,(%0),%2%J3"
4868 [(set_attr "type" "jsr")])
4870 (define_insn "*call_osf_2_er"
4871 [(call (mem:DI (match_operand:DI 0 "register_operand" "c"))
4872 (match_operand 1 "" ""))
4874 (unspec:DI [(reg:DI 29) (match_operand 4 "const_int_operand" "")]
4876 (use (match_operand 2 "" ""))
4877 (use (match_operand 3 "const_int_operand" ""))
4878 (clobber (reg:DI 26))]
4879 "TARGET_EXPLICIT_RELOCS && TARGET_ABI_OSF"
4880 "jsr $26,(%0),%2%J3\;ldah $29,0($26)\t\t!gpdisp!%4"
4881 [(set_attr "type" "jsr")
4882 (set_attr "cannot_copy" "true")
4883 (set_attr "length" "8")])
4885 (define_insn "*call_osf_1_noreturn"
4886 [(call (mem:DI (match_operand:DI 0 "call_operand" "c,R,s"))
4887 (match_operand 1 "" ""))
4889 (clobber (reg:DI 26))]
4890 "! TARGET_EXPLICIT_RELOCS && TARGET_ABI_OSF
4891 && find_reg_note (insn, REG_NORETURN, NULL_RTX)"
4896 [(set_attr "type" "jsr")
4897 (set_attr "length" "*,*,8")])
4899 (define_insn "*call_osf_1"
4900 [(call (mem:DI (match_operand:DI 0 "call_operand" "c,R,s"))
4901 (match_operand 1 "" ""))
4903 (clobber (reg:DI 26))]
4904 "! TARGET_EXPLICIT_RELOCS && TARGET_ABI_OSF"
4906 jsr $26,($27),0\;ldgp $29,0($26)
4908 jsr $26,%0\;ldgp $29,0($26)"
4909 [(set_attr "type" "jsr")
4910 (set_attr "length" "12,*,16")])
4912 (define_insn "*sibcall_osf_1_er"
4913 [(call (mem:DI (match_operand:DI 0 "symbolic_operand" "R,s"))
4914 (match_operand 1 "" ""))
4915 (unspec [(reg:DI 29)] UNSPEC_SIBCALL)]
4916 "TARGET_EXPLICIT_RELOCS && TARGET_ABI_OSF"
4918 br $31,%0\t\t!samegp
4919 ldq $27,%0($29)\t\t!literal!%#\;jmp $31,($27),%0\t\t!lituse_jsr!%#"
4920 [(set_attr "type" "jsr")
4921 (set_attr "length" "*,8")])
4923 ;; Note that the DEC assembler expands "jmp foo" with $at, which
4924 ;; doesn't do what we want.
4925 (define_insn "*sibcall_osf_1"
4926 [(call (mem:DI (match_operand:DI 0 "symbolic_operand" "R,s"))
4927 (match_operand 1 "" ""))
4928 (unspec [(reg:DI 29)] UNSPEC_SIBCALL)]
4929 "! TARGET_EXPLICIT_RELOCS && TARGET_ABI_OSF"
4932 lda $27,%0\;jmp $31,($27),%0"
4933 [(set_attr "type" "jsr")
4934 (set_attr "length" "*,8")])
4936 (define_insn "*call_nt_1"
4937 [(call (mem:DI (match_operand:DI 0 "call_operand" "r,R,s"))
4938 (match_operand 1 "" ""))
4939 (clobber (reg:DI 26))]
4940 "TARGET_ABI_WINDOWS_NT"
4945 [(set_attr "type" "jsr")
4946 (set_attr "length" "*,*,12")])
4948 ; GAS relies on the order and position of instructions output below in order
4949 ; to generate relocs for VMS link to potentially optimize the call.
4950 ; Please do not molest.
4951 (define_insn "*call_vms_1"
4952 [(call (mem:DI (match_operand:DI 0 "call_operand" "r,s"))
4953 (match_operand 1 "" ""))
4954 (use (match_operand:DI 2 "nonmemory_operand" "r,n"))
4957 (clobber (reg:DI 27))]
4958 "TARGET_ABI_OPEN_VMS"
4960 switch (which_alternative)
4963 return "mov %2,$27\;jsr $26,0\;ldq $27,0($29)";
4965 operands [2] = alpha_use_linkage (operands [0], cfun->decl, 1, 0);
4966 operands [3] = alpha_use_linkage (operands [0], cfun->decl, 0, 0);
4967 return "ldq $26,%3\;ldq $27,%2\;jsr $26,%0\;ldq $27,0($29)";
4972 [(set_attr "type" "jsr")
4973 (set_attr "length" "12,16")])
4975 (define_insn "*call_umk_1"
4976 [(call (mem:DI (match_operand:DI 0 "call_operand" "r"))
4977 (match_operand 1 "" ""))
4979 (clobber (reg:DI 26))]
4980 "TARGET_ABI_UNICOSMK"
4982 [(set_attr "type" "jsr")])
4984 ;; Call subroutine returning any type.
4986 (define_expand "untyped_call"
4987 [(parallel [(call (match_operand 0 "" "")
4989 (match_operand 1 "" "")
4990 (match_operand 2 "" "")])]
4995 emit_call_insn (GEN_CALL (operands[0], const0_rtx, NULL, const0_rtx));
4997 for (i = 0; i < XVECLEN (operands[2], 0); i++)
4999 rtx set = XVECEXP (operands[2], 0, i);
5000 emit_move_insn (SET_DEST (set), SET_SRC (set));
5003 /* The optimizer does not know that the call sets the function value
5004 registers we stored in the result block. We avoid problems by
5005 claiming that all hard registers are used and clobbered at this
5007 emit_insn (gen_blockage ());
5012 ;; UNSPEC_VOLATILE is considered to use and clobber all hard registers and
5013 ;; all of memory. This blocks insns from being moved across this point.
5015 (define_insn "blockage"
5016 [(unspec_volatile [(const_int 0)] UNSPECV_BLOCKAGE)]
5019 [(set_attr "length" "0")
5020 (set_attr "type" "none")])
5024 (label_ref (match_operand 0 "" "")))]
5027 [(set_attr "type" "ibr")])
5029 (define_expand "return"
5034 (define_insn "*return_internal"
5038 [(set_attr "type" "ibr")])
5040 (define_insn "indirect_jump"
5041 [(set (pc) (match_operand:DI 0 "register_operand" "r"))]
5044 [(set_attr "type" "ibr")])
5046 (define_expand "tablejump"
5047 [(parallel [(set (pc)
5048 (match_operand 0 "register_operand" ""))
5049 (use (label_ref:DI (match_operand 1 "" "")))])]
5052 if (TARGET_ABI_WINDOWS_NT)
5054 rtx dest = gen_reg_rtx (DImode);
5055 emit_insn (gen_extendsidi2 (dest, operands[0]));
5058 else if (TARGET_ABI_OSF)
5060 rtx dest = gen_reg_rtx (DImode);
5061 emit_insn (gen_extendsidi2 (dest, operands[0]));
5062 emit_insn (gen_adddi3 (dest, pic_offset_table_rtx, dest));
5067 (define_insn "*tablejump_osf_nt_internal"
5069 (match_operand:DI 0 "register_operand" "r"))
5070 (use (label_ref:DI (match_operand 1 "" "")))]
5071 "(TARGET_ABI_OSF || TARGET_ABI_WINDOWS_NT)
5072 && alpha_tablejump_addr_vec (insn)"
5074 operands[2] = alpha_tablejump_best_label (insn);
5075 return "jmp $31,(%0),%2";
5077 [(set_attr "type" "ibr")])
5079 (define_insn "*tablejump_internal"
5081 (match_operand:DI 0 "register_operand" "r"))
5082 (use (label_ref (match_operand 1 "" "")))]
5085 [(set_attr "type" "ibr")])
5087 ;; Cache flush. Used by INITIALIZE_TRAMPOLINE. 0x86 is PAL_imb, but we don't
5088 ;; want to have to include pal.h in our .s file.
5090 [(unspec_volatile [(const_int 0)] UNSPECV_IMB)]
5093 [(set_attr "type" "callpal")])
5095 ;; BUGCHK is documented common to OSF/1 and VMS PALcode.
5096 ;; NT does not document anything at 0x81 -- presumably it would generate
5097 ;; the equivalent of SIGILL, but this isn't that important.
5098 ;; ??? Presuming unicosmk uses either OSF/1 or VMS PALcode.
5100 [(trap_if (const_int 1) (const_int 0))]
5101 "!TARGET_ABI_WINDOWS_NT"
5103 [(set_attr "type" "callpal")])
5105 ;; For userland, we load the thread pointer from the TCB.
5106 ;; For the kernel, we load the per-cpu private value.
5108 (define_insn "load_tp"
5109 [(set (match_operand:DI 0 "register_operand" "=v")
5110 (unspec:DI [(const_int 0)] UNSPEC_TP))]
5113 if (TARGET_TLS_KERNEL)
5114 return "call_pal 0x32";
5116 return "call_pal 0x9e";
5118 [(set_attr "type" "callpal")])
5120 ;; For completeness, and possibly a __builtin function, here's how to
5121 ;; set the thread pointer. Since we don't describe enough of this
5122 ;; quantity for CSE, we have to use a volatile unspec, and then there's
5123 ;; not much point in creating an R16_REG register class.
5125 (define_expand "set_tp"
5126 [(set (reg:DI 16) (match_operand:DI 0 "input_operand" ""))
5127 (unspec_volatile [(reg:DI 16)] UNSPECV_SET_TP)]
5131 (define_insn "*set_tp"
5132 [(unspec_volatile [(reg:DI 16)] UNSPECV_SET_TP)]
5135 if (TARGET_TLS_KERNEL)
5136 return "call_pal 0x31";
5138 return "call_pal 0x9f";
5140 [(set_attr "type" "callpal")])
5142 ;; Finally, we have the basic data motion insns. The byte and word insns
5143 ;; are done via define_expand. Start with the floating-point insns, since
5144 ;; they are simpler.
5146 (define_insn "*movsf_nofix"
5147 [(set (match_operand:SF 0 "nonimmediate_operand" "=f,f,*r,*r,m,m")
5148 (match_operand:SF 1 "input_operand" "fG,m,*rG,m,fG,*r"))]
5149 "TARGET_FPREGS && ! TARGET_FIX
5150 && (register_operand (operands[0], SFmode)
5151 || reg_or_0_operand (operands[1], SFmode))"
5159 [(set_attr "type" "fcpys,fld,ilog,ild,fst,ist")])
5161 (define_insn "*movsf_fix"
5162 [(set (match_operand:SF 0 "nonimmediate_operand" "=f,f,*r,*r,m,m,f,*r")
5163 (match_operand:SF 1 "input_operand" "fG,m,*rG,m,fG,*r,*r,f"))]
5164 "TARGET_FPREGS && TARGET_FIX
5165 && (register_operand (operands[0], SFmode)
5166 || reg_or_0_operand (operands[1], SFmode))"
5176 [(set_attr "type" "fcpys,fld,ilog,ild,fst,ist,itof,ftoi")])
5178 (define_insn "*movsf_nofp"
5179 [(set (match_operand:SF 0 "nonimmediate_operand" "=r,r,m")
5180 (match_operand:SF 1 "input_operand" "rG,m,r"))]
5182 && (register_operand (operands[0], SFmode)
5183 || reg_or_0_operand (operands[1], SFmode))"
5188 [(set_attr "type" "ilog,ild,ist")])
5190 (define_insn "*movdf_nofix"
5191 [(set (match_operand:DF 0 "nonimmediate_operand" "=f,f,*r,*r,m,m")
5192 (match_operand:DF 1 "input_operand" "fG,m,*rG,m,fG,*r"))]
5193 "TARGET_FPREGS && ! TARGET_FIX
5194 && (register_operand (operands[0], DFmode)
5195 || reg_or_0_operand (operands[1], DFmode))"
5203 [(set_attr "type" "fcpys,fld,ilog,ild,fst,ist")])
5205 (define_insn "*movdf_fix"
5206 [(set (match_operand:DF 0 "nonimmediate_operand" "=f,f,*r,*r,m,m,f,*r")
5207 (match_operand:DF 1 "input_operand" "fG,m,*rG,m,fG,*r,*r,f"))]
5208 "TARGET_FPREGS && TARGET_FIX
5209 && (register_operand (operands[0], DFmode)
5210 || reg_or_0_operand (operands[1], DFmode))"
5220 [(set_attr "type" "fcpys,fld,ilog,ild,fst,ist,itof,ftoi")])
5222 (define_insn "*movdf_nofp"
5223 [(set (match_operand:DF 0 "nonimmediate_operand" "=r,r,m")
5224 (match_operand:DF 1 "input_operand" "rG,m,r"))]
5226 && (register_operand (operands[0], DFmode)
5227 || reg_or_0_operand (operands[1], DFmode))"
5232 [(set_attr "type" "ilog,ild,ist")])
5234 ;; Subregs suck for register allocation. Pretend we can move TFmode
5235 ;; data between general registers until after reload.
5237 (define_insn_and_split "*movtf_internal"
5238 [(set (match_operand:TF 0 "nonimmediate_operand" "=r,o")
5239 (match_operand:TF 1 "input_operand" "roG,rG"))]
5240 "register_operand (operands[0], TFmode)
5241 || reg_or_0_operand (operands[1], TFmode)"
5244 [(set (match_dup 0) (match_dup 2))
5245 (set (match_dup 1) (match_dup 3))]
5247 alpha_split_tmode_pair (operands, TFmode, true);
5250 (define_expand "movsf"
5251 [(set (match_operand:SF 0 "nonimmediate_operand" "")
5252 (match_operand:SF 1 "general_operand" ""))]
5255 if (GET_CODE (operands[0]) == MEM
5256 && ! reg_or_0_operand (operands[1], SFmode))
5257 operands[1] = force_reg (SFmode, operands[1]);
5260 (define_expand "movdf"
5261 [(set (match_operand:DF 0 "nonimmediate_operand" "")
5262 (match_operand:DF 1 "general_operand" ""))]
5265 if (GET_CODE (operands[0]) == MEM
5266 && ! reg_or_0_operand (operands[1], DFmode))
5267 operands[1] = force_reg (DFmode, operands[1]);
5270 (define_expand "movtf"
5271 [(set (match_operand:TF 0 "nonimmediate_operand" "")
5272 (match_operand:TF 1 "general_operand" ""))]
5275 if (GET_CODE (operands[0]) == MEM
5276 && ! reg_or_0_operand (operands[1], TFmode))
5277 operands[1] = force_reg (TFmode, operands[1]);
5280 (define_insn "*movsi"
5281 [(set (match_operand:SI 0 "nonimmediate_operand" "=r,r,r,r,r,m")
5282 (match_operand:SI 1 "input_operand" "rJ,K,L,n,m,rJ"))]
5283 "(TARGET_ABI_OSF || TARGET_ABI_UNICOSMK)
5284 && (register_operand (operands[0], SImode)
5285 || reg_or_0_operand (operands[1], SImode))"
5293 [(set_attr "type" "ilog,iadd,iadd,multi,ild,ist")])
5295 (define_insn "*movsi_nt_vms"
5296 [(set (match_operand:SI 0 "nonimmediate_operand" "=r,r,r,r,r,r,m")
5297 (match_operand:SI 1 "input_operand" "rJ,K,L,s,n,m,rJ"))]
5298 "(TARGET_ABI_WINDOWS_NT || TARGET_ABI_OPEN_VMS)
5299 && (register_operand (operands[0], SImode)
5300 || reg_or_0_operand (operands[1], SImode))"
5309 [(set_attr "type" "ilog,iadd,iadd,ldsym,multi,ild,ist")])
5311 (define_insn "*movhi_nobwx"
5312 [(set (match_operand:HI 0 "register_operand" "=r,r")
5313 (match_operand:HI 1 "input_operand" "rJ,n"))]
5315 && (register_operand (operands[0], HImode)
5316 || register_operand (operands[1], HImode))"
5320 [(set_attr "type" "ilog,iadd")])
5322 (define_insn "*movhi_bwx"
5323 [(set (match_operand:HI 0 "nonimmediate_operand" "=r,r,r,m")
5324 (match_operand:HI 1 "input_operand" "rJ,n,m,rJ"))]
5326 && (register_operand (operands[0], HImode)
5327 || reg_or_0_operand (operands[1], HImode))"
5333 [(set_attr "type" "ilog,iadd,ild,ist")])
5335 (define_insn "*movqi_nobwx"
5336 [(set (match_operand:QI 0 "register_operand" "=r,r")
5337 (match_operand:QI 1 "input_operand" "rJ,n"))]
5339 && (register_operand (operands[0], QImode)
5340 || register_operand (operands[1], QImode))"
5344 [(set_attr "type" "ilog,iadd")])
5346 (define_insn "*movqi_bwx"
5347 [(set (match_operand:QI 0 "nonimmediate_operand" "=r,r,r,m")
5348 (match_operand:QI 1 "input_operand" "rJ,n,m,rJ"))]
5350 && (register_operand (operands[0], QImode)
5351 || reg_or_0_operand (operands[1], QImode))"
5357 [(set_attr "type" "ilog,iadd,ild,ist")])
5359 ;; We do two major things here: handle mem->mem and construct long
5362 (define_expand "movsi"
5363 [(set (match_operand:SI 0 "nonimmediate_operand" "")
5364 (match_operand:SI 1 "general_operand" ""))]
5367 if (alpha_expand_mov (SImode, operands))
5371 ;; Split a load of a large constant into the appropriate two-insn
5375 [(set (match_operand:SI 0 "register_operand" "")
5376 (match_operand:SI 1 "non_add_const_operand" ""))]
5380 if (alpha_split_const_mov (SImode, operands))
5386 ;; Split the load of an address into a four-insn sequence on Unicos/Mk.
5387 ;; Always generate a REG_EQUAL note for the last instruction to facilitate
5388 ;; optimizations. If the symbolic operand is a label_ref, generate REG_LABEL
5389 ;; notes and update LABEL_NUSES because this is not done automatically.
5390 ;; Labels may be incorrectly deleted if we don't do this.
5392 ;; Describing what the individual instructions do correctly is too complicated
5393 ;; so use UNSPECs for each of the three parts of an address.
5396 [(set (match_operand:DI 0 "register_operand" "")
5397 (match_operand:DI 1 "symbolic_operand" ""))]
5398 "TARGET_ABI_UNICOSMK && reload_completed"
5401 rtx insn1, insn2, insn3;
5403 insn1 = emit_insn (gen_umk_laum (operands[0], operands[1]));
5404 emit_insn (gen_ashldi3 (operands[0], operands[0], GEN_INT (32)));
5405 insn2 = emit_insn (gen_umk_lalm (operands[0], operands[0], operands[1]));
5406 insn3 = emit_insn (gen_umk_lal (operands[0], operands[0], operands[1]));
5407 set_unique_reg_note (insn3, REG_EQUAL, operands[1]);
5409 if (GET_CODE (operands[1]) == LABEL_REF)
5413 label = XEXP (operands[1], 0);
5414 REG_NOTES (insn1) = gen_rtx_EXPR_LIST (REG_LABEL, label,
5416 REG_NOTES (insn2) = gen_rtx_EXPR_LIST (REG_LABEL, label,
5418 REG_NOTES (insn3) = gen_rtx_EXPR_LIST (REG_LABEL, label,
5420 LABEL_NUSES (label) += 3;
5425 ;; Instructions for loading the three parts of an address on Unicos/Mk.
5427 (define_insn "umk_laum"
5428 [(set (match_operand:DI 0 "register_operand" "=r")
5429 (unspec:DI [(match_operand:DI 1 "symbolic_operand" "")]
5431 "TARGET_ABI_UNICOSMK"
5433 [(set_attr "type" "iadd")])
5435 (define_insn "umk_lalm"
5436 [(set (match_operand:DI 0 "register_operand" "=r")
5437 (plus:DI (match_operand:DI 1 "register_operand" "r")
5438 (unspec:DI [(match_operand:DI 2 "symbolic_operand" "")]
5440 "TARGET_ABI_UNICOSMK"
5442 [(set_attr "type" "iadd")])
5444 (define_insn "umk_lal"
5445 [(set (match_operand:DI 0 "register_operand" "=r")
5446 (plus:DI (match_operand:DI 1 "register_operand" "r")
5447 (unspec:DI [(match_operand:DI 2 "symbolic_operand" "")]
5449 "TARGET_ABI_UNICOSMK"
5451 [(set_attr "type" "iadd")])
5453 ;; Add a new call information word to the current function's list of CIWs
5454 ;; and load its index into $25. Doing it here ensures that the CIW will be
5455 ;; associated with the correct function even in the presence of inlining.
5457 (define_insn "*umk_load_ciw"
5459 (unspec:DI [(match_operand 0 "" "")] UNSPEC_UMK_LOAD_CIW))]
5460 "TARGET_ABI_UNICOSMK"
5462 operands[0] = unicosmk_add_call_info_word (operands[0]);
5463 return "lda $25,%0";
5465 [(set_attr "type" "iadd")])
5467 (define_insn "*movdi_er_low_l"
5468 [(set (match_operand:DI 0 "register_operand" "=r")
5469 (lo_sum:DI (match_operand:DI 1 "register_operand" "r")
5470 (match_operand:DI 2 "local_symbolic_operand" "")))]
5471 "TARGET_EXPLICIT_RELOCS"
5473 if (true_regnum (operands[1]) == 29)
5474 return "lda %0,%2(%1)\t\t!gprel";
5476 return "lda %0,%2(%1)\t\t!gprellow";
5478 [(set_attr "usegp" "yes")])
5481 [(set (match_operand:DI 0 "register_operand" "")
5482 (match_operand:DI 1 "small_symbolic_operand" ""))]
5483 "TARGET_EXPLICIT_RELOCS && reload_completed"
5485 (lo_sum:DI (match_dup 2) (match_dup 1)))]
5486 "operands[2] = pic_offset_table_rtx;")
5489 [(set (match_operand:DI 0 "register_operand" "")
5490 (match_operand:DI 1 "local_symbolic_operand" ""))]
5491 "TARGET_EXPLICIT_RELOCS && reload_completed"
5493 (plus:DI (match_dup 2) (high:DI (match_dup 1))))
5495 (lo_sum:DI (match_dup 0) (match_dup 1)))]
5496 "operands[2] = pic_offset_table_rtx;")
5499 [(match_operand 0 "some_small_symbolic_operand" "")]
5502 "operands[0] = split_small_symbolic_operand (operands[0]);")
5504 ;; Accepts any symbolic, not just global, since function calls that
5505 ;; don't go via bsr still use !literal in hopes of linker relaxation.
5506 (define_insn "movdi_er_high_g"
5507 [(set (match_operand:DI 0 "register_operand" "=r")
5508 (unspec:DI [(match_operand:DI 1 "register_operand" "r")
5509 (match_operand:DI 2 "symbolic_operand" "")
5510 (match_operand 3 "const_int_operand" "")]
5512 "TARGET_EXPLICIT_RELOCS"
5514 if (INTVAL (operands[3]) == 0)
5515 return "ldq %0,%2(%1)\t\t!literal";
5517 return "ldq %0,%2(%1)\t\t!literal!%3";
5519 [(set_attr "type" "ldsym")])
5522 [(set (match_operand:DI 0 "register_operand" "")
5523 (match_operand:DI 1 "global_symbolic_operand" ""))]
5524 "TARGET_EXPLICIT_RELOCS && reload_completed"
5526 (unspec:DI [(match_dup 2)
5528 (const_int 0)] UNSPEC_LITERAL))]
5529 "operands[2] = pic_offset_table_rtx;")
5531 (define_insn "movdi_er_tlsgd"
5532 [(set (match_operand:DI 0 "register_operand" "=r")
5533 (unspec:DI [(match_operand:DI 1 "register_operand" "r")
5534 (match_operand:DI 2 "symbolic_operand" "")
5535 (match_operand 3 "const_int_operand" "")]
5539 if (INTVAL (operands[3]) == 0)
5540 return "lda %0,%2(%1)\t\t!tlsgd";
5542 return "lda %0,%2(%1)\t\t!tlsgd!%3";
5545 (define_insn "movdi_er_tlsldm"
5546 [(set (match_operand:DI 0 "register_operand" "=r")
5547 (unspec:DI [(match_operand:DI 1 "register_operand" "r")
5548 (match_operand 2 "const_int_operand" "")]
5552 if (INTVAL (operands[2]) == 0)
5553 return "lda %0,%&(%1)\t\t!tlsldm";
5555 return "lda %0,%&(%1)\t\t!tlsldm!%2";
5558 (define_insn "*movdi_er_gotdtp"
5559 [(set (match_operand:DI 0 "register_operand" "=r")
5560 (unspec:DI [(match_operand:DI 1 "register_operand" "r")
5561 (match_operand:DI 2 "symbolic_operand" "")]
5564 "ldq %0,%2(%1)\t\t!gotdtprel"
5565 [(set_attr "type" "ild")
5566 (set_attr "usegp" "yes")])
5569 [(set (match_operand:DI 0 "register_operand" "")
5570 (match_operand:DI 1 "gotdtp_symbolic_operand" ""))]
5571 "HAVE_AS_TLS && reload_completed"
5573 (unspec:DI [(match_dup 2)
5574 (match_dup 1)] UNSPEC_DTPREL))]
5576 operands[1] = XVECEXP (XEXP (operands[1], 0), 0, 0);
5577 operands[2] = pic_offset_table_rtx;
5580 (define_insn "*movdi_er_gottp"
5581 [(set (match_operand:DI 0 "register_operand" "=r")
5582 (unspec:DI [(match_operand:DI 1 "register_operand" "r")
5583 (match_operand:DI 2 "symbolic_operand" "")]
5586 "ldq %0,%2(%1)\t\t!gottprel"
5587 [(set_attr "type" "ild")
5588 (set_attr "usegp" "yes")])
5591 [(set (match_operand:DI 0 "register_operand" "")
5592 (match_operand:DI 1 "gottp_symbolic_operand" ""))]
5593 "HAVE_AS_TLS && reload_completed"
5595 (unspec:DI [(match_dup 2)
5596 (match_dup 1)] UNSPEC_TPREL))]
5598 operands[1] = XVECEXP (XEXP (operands[1], 0), 0, 0);
5599 operands[2] = pic_offset_table_rtx;
5602 (define_insn "*movdi_er_nofix"
5603 [(set (match_operand:DI 0 "nonimmediate_operand" "=r,r,r,r,r,r,r,m,*f,*f,Q")
5604 (match_operand:DI 1 "input_operand" "rJ,K,L,T,s,n,m,rJ,*fJ,Q,*f"))]
5605 "TARGET_EXPLICIT_RELOCS && ! TARGET_FIX
5606 && (register_operand (operands[0], DImode)
5607 || reg_or_0_operand (operands[1], DImode))"
5620 [(set_attr "type" "ilog,iadd,iadd,iadd,ldsym,multi,ild,ist,fcpys,fld,fst")
5621 (set_attr "usegp" "*,*,*,yes,*,*,*,*,*,*,*")])
5623 ;; The 'U' constraint matches symbolic operands on Unicos/Mk. Those should
5624 ;; have been split up by the rules above but we shouldn't reject the
5625 ;; possibility of them getting through.
5627 (define_insn "*movdi_nofix"
5628 [(set (match_operand:DI 0 "nonimmediate_operand" "=r,r,r,r,r,r,r,m,*f,*f,Q")
5629 (match_operand:DI 1 "input_operand" "rJ,K,L,U,s,n,m,rJ,*fJ,Q,*f"))]
5631 && (register_operand (operands[0], DImode)
5632 || reg_or_0_operand (operands[1], DImode))"
5637 laum %0,%t1($31)\;sll %0,32,%0\;lalm %0,%t1(%0)\;lal %0,%t1(%0)
5645 [(set_attr "type" "ilog,iadd,iadd,ldsym,ldsym,multi,ild,ist,fcpys,fld,fst")
5646 (set_attr "length" "*,*,*,16,*,*,*,*,*,*,*")])
5648 (define_insn "*movdi_er_fix"
5649 [(set (match_operand:DI 0 "nonimmediate_operand"
5650 "=r,r,r,r,r,r,r, m, *f,*f, Q, r,*f")
5651 (match_operand:DI 1 "input_operand"
5652 "rJ,K,L,T,s,n,m,rJ,*fJ, Q,*f,*f, r"))]
5653 "TARGET_EXPLICIT_RELOCS && TARGET_FIX
5654 && (register_operand (operands[0], DImode)
5655 || reg_or_0_operand (operands[1], DImode))"
5670 [(set_attr "type" "ilog,iadd,iadd,iadd,ldsym,multi,ild,ist,fcpys,fld,fst,ftoi,itof")
5671 (set_attr "usegp" "*,*,*,yes,*,*,*,*,*,*,*,*,*")])
5673 (define_insn "*movdi_fix"
5674 [(set (match_operand:DI 0 "nonimmediate_operand" "=r,r,r,r,r,r,m,*f,*f,Q,r,*f")
5675 (match_operand:DI 1 "input_operand" "rJ,K,L,s,n,m,rJ,*fJ,Q,*f,*f,r"))]
5676 "! TARGET_EXPLICIT_RELOCS && TARGET_FIX
5677 && (register_operand (operands[0], DImode)
5678 || reg_or_0_operand (operands[1], DImode))"
5692 [(set_attr "type" "ilog,iadd,iadd,ldsym,multi,ild,ist,fcpys,fld,fst,ftoi,itof")])
5694 ;; VMS needs to set up "vms_base_regno" for unwinding. This move
5695 ;; often appears dead to the life analysis code, at which point we
5696 ;; die for emitting dead prologue instructions. Force this live.
5698 (define_insn "force_movdi"
5699 [(set (match_operand:DI 0 "register_operand" "=r")
5700 (unspec_volatile:DI [(match_operand:DI 1 "register_operand" "r")]
5701 UNSPECV_FORCE_MOV))]
5704 [(set_attr "type" "ilog")])
5706 ;; We do three major things here: handle mem->mem, put 64-bit constants in
5707 ;; memory, and construct long 32-bit constants.
5709 (define_expand "movdi"
5710 [(set (match_operand:DI 0 "nonimmediate_operand" "")
5711 (match_operand:DI 1 "general_operand" ""))]
5714 if (alpha_expand_mov (DImode, operands))
5718 ;; Split a load of a large constant into the appropriate two-insn
5722 [(set (match_operand:DI 0 "register_operand" "")
5723 (match_operand:DI 1 "non_add_const_operand" ""))]
5727 if (alpha_split_const_mov (DImode, operands))
5733 ;; We need to prevent reload from splitting TImode moves, because it
5734 ;; might decide to overwrite a pointer with the value it points to.
5735 ;; In that case we have to do the loads in the appropriate order so
5736 ;; that the pointer is not destroyed too early.
5738 (define_insn_and_split "*movti_internal"
5739 [(set (match_operand:TI 0 "nonimmediate_operand" "=r,o")
5740 (match_operand:TI 1 "input_operand" "roJ,rJ"))]
5741 "(register_operand (operands[0], TImode)
5742 /* Prevent rematerialization of constants. */
5743 && ! CONSTANT_P (operands[1]))
5744 || reg_or_0_operand (operands[1], TImode)"
5747 [(set (match_dup 0) (match_dup 2))
5748 (set (match_dup 1) (match_dup 3))]
5750 alpha_split_tmode_pair (operands, TImode, true);
5753 (define_expand "movti"
5754 [(set (match_operand:TI 0 "nonimmediate_operand" "")
5755 (match_operand:TI 1 "general_operand" ""))]
5758 if (GET_CODE (operands[0]) == MEM
5759 && ! reg_or_0_operand (operands[1], TImode))
5760 operands[1] = force_reg (TImode, operands[1]);
5762 if (operands[1] == const0_rtx)
5764 /* We must put 64-bit constants in memory. We could keep the
5765 32-bit constants in TImode and rely on the splitter, but
5766 this doesn't seem to be worth the pain. */
5767 else if (GET_CODE (operands[1]) == CONST_INT
5768 || GET_CODE (operands[1]) == CONST_DOUBLE)
5770 rtx in[2], out[2], target;
5772 gcc_assert (!no_new_pseudos);
5774 split_double (operands[1], &in[0], &in[1]);
5776 if (in[0] == const0_rtx)
5777 out[0] = const0_rtx;
5780 out[0] = gen_reg_rtx (DImode);
5781 emit_insn (gen_movdi (out[0], in[0]));
5784 if (in[1] == const0_rtx)
5785 out[1] = const0_rtx;
5788 out[1] = gen_reg_rtx (DImode);
5789 emit_insn (gen_movdi (out[1], in[1]));
5792 if (GET_CODE (operands[0]) != REG)
5793 target = gen_reg_rtx (TImode);
5795 target = operands[0];
5797 emit_insn (gen_movdi (gen_rtx_SUBREG (DImode, target, 0), out[0]));
5798 emit_insn (gen_movdi (gen_rtx_SUBREG (DImode, target, 8), out[1]));
5800 if (target != operands[0])
5801 emit_insn (gen_rtx_SET (VOIDmode, operands[0], target));
5807 ;; These are the partial-word cases.
5809 ;; First we have the code to load an aligned word. Operand 0 is the register
5810 ;; in which to place the result. It's mode is QImode or HImode. Operand 1
5811 ;; is an SImode MEM at the low-order byte of the proper word. Operand 2 is the
5812 ;; number of bits within the word that the value is. Operand 3 is an SImode
5813 ;; scratch register. If operand 0 is a hard register, operand 3 may be the
5814 ;; same register. It is allowed to conflict with operand 1 as well.
5816 (define_expand "aligned_loadqi"
5817 [(set (match_operand:SI 3 "register_operand" "")
5818 (match_operand:SI 1 "memory_operand" ""))
5819 (set (match_operand:DI 0 "register_operand" "")
5820 (zero_extract:DI (subreg:DI (match_dup 3) 0)
5822 (match_operand:DI 2 "const_int_operand" "")))]
5827 (define_expand "aligned_loadhi"
5828 [(set (match_operand:SI 3 "register_operand" "")
5829 (match_operand:SI 1 "memory_operand" ""))
5830 (set (match_operand:DI 0 "register_operand" "")
5831 (zero_extract:DI (subreg:DI (match_dup 3) 0)
5833 (match_operand:DI 2 "const_int_operand" "")))]
5838 ;; Similar for unaligned loads, where we use the sequence from the
5839 ;; Alpha Architecture manual. We have to distinguish between little-endian
5840 ;; and big-endian systems as the sequences are different.
5842 ;; Operand 1 is the address. Operands 2 and 3 are temporaries, where
5843 ;; operand 3 can overlap the input and output registers.
5845 (define_expand "unaligned_loadqi"
5846 [(use (match_operand:DI 0 "register_operand" ""))
5847 (use (match_operand:DI 1 "address_operand" ""))
5848 (use (match_operand:DI 2 "register_operand" ""))
5849 (use (match_operand:DI 3 "register_operand" ""))]
5852 if (WORDS_BIG_ENDIAN)
5853 emit_insn (gen_unaligned_loadqi_be (operands[0], operands[1],
5854 operands[2], operands[3]));
5856 emit_insn (gen_unaligned_loadqi_le (operands[0], operands[1],
5857 operands[2], operands[3]));
5861 (define_expand "unaligned_loadqi_le"
5862 [(set (match_operand:DI 2 "register_operand" "")
5863 (mem:DI (and:DI (match_operand:DI 1 "address_operand" "")
5865 (set (match_operand:DI 3 "register_operand" "")
5867 (set (match_operand:DI 0 "register_operand" "")
5868 (zero_extract:DI (match_dup 2)
5870 (ashift:DI (match_dup 3) (const_int 3))))]
5871 "! WORDS_BIG_ENDIAN"
5874 (define_expand "unaligned_loadqi_be"
5875 [(set (match_operand:DI 2 "register_operand" "")
5876 (mem:DI (and:DI (match_operand:DI 1 "address_operand" "")
5878 (set (match_operand:DI 3 "register_operand" "")
5880 (set (match_operand:DI 0 "register_operand" "")
5881 (zero_extract:DI (match_dup 2)
5885 (ashift:DI (match_dup 3) (const_int 3)))))]
5889 (define_expand "unaligned_loadhi"
5890 [(use (match_operand:DI 0 "register_operand" ""))
5891 (use (match_operand:DI 1 "address_operand" ""))
5892 (use (match_operand:DI 2 "register_operand" ""))
5893 (use (match_operand:DI 3 "register_operand" ""))]
5896 if (WORDS_BIG_ENDIAN)
5897 emit_insn (gen_unaligned_loadhi_be (operands[0], operands[1],
5898 operands[2], operands[3]));
5900 emit_insn (gen_unaligned_loadhi_le (operands[0], operands[1],
5901 operands[2], operands[3]));
5905 (define_expand "unaligned_loadhi_le"
5906 [(set (match_operand:DI 2 "register_operand" "")
5907 (mem:DI (and:DI (match_operand:DI 1 "address_operand" "")
5909 (set (match_operand:DI 3 "register_operand" "")
5911 (set (match_operand:DI 0 "register_operand" "")
5912 (zero_extract:DI (match_dup 2)
5914 (ashift:DI (match_dup 3) (const_int 3))))]
5915 "! WORDS_BIG_ENDIAN"
5918 (define_expand "unaligned_loadhi_be"
5919 [(set (match_operand:DI 2 "register_operand" "")
5920 (mem:DI (and:DI (match_operand:DI 1 "address_operand" "")
5922 (set (match_operand:DI 3 "register_operand" "")
5923 (plus:DI (match_dup 1) (const_int 1)))
5924 (set (match_operand:DI 0 "register_operand" "")
5925 (zero_extract:DI (match_dup 2)
5929 (ashift:DI (match_dup 3) (const_int 3)))))]
5933 ;; Storing an aligned byte or word requires two temporaries. Operand 0 is the
5934 ;; aligned SImode MEM. Operand 1 is the register containing the
5935 ;; byte or word to store. Operand 2 is the number of bits within the word that
5936 ;; the value should be placed. Operands 3 and 4 are SImode temporaries.
5938 (define_expand "aligned_store"
5939 [(set (match_operand:SI 3 "register_operand" "")
5940 (match_operand:SI 0 "memory_operand" ""))
5941 (set (subreg:DI (match_dup 3) 0)
5942 (and:DI (subreg:DI (match_dup 3) 0) (match_dup 5)))
5943 (set (subreg:DI (match_operand:SI 4 "register_operand" "") 0)
5944 (ashift:DI (zero_extend:DI (match_operand 1 "register_operand" ""))
5945 (match_operand:DI 2 "const_int_operand" "")))
5946 (set (subreg:DI (match_dup 4) 0)
5947 (ior:DI (subreg:DI (match_dup 4) 0) (subreg:DI (match_dup 3) 0)))
5948 (set (match_dup 0) (match_dup 4))]
5951 operands[5] = GEN_INT (~ (GET_MODE_MASK (GET_MODE (operands[1]))
5952 << INTVAL (operands[2])));
5955 ;; For the unaligned byte and halfword cases, we use code similar to that
5956 ;; in the ;; Architecture book, but reordered to lower the number of registers
5957 ;; required. Operand 0 is the address. Operand 1 is the data to store.
5958 ;; Operands 2, 3, and 4 are DImode temporaries, where operands 2 and 4 may
5959 ;; be the same temporary, if desired. If the address is in a register,
5960 ;; operand 2 can be that register.
5962 (define_expand "unaligned_storeqi"
5963 [(use (match_operand:DI 0 "address_operand" ""))
5964 (use (match_operand:QI 1 "register_operand" ""))
5965 (use (match_operand:DI 2 "register_operand" ""))
5966 (use (match_operand:DI 3 "register_operand" ""))
5967 (use (match_operand:DI 4 "register_operand" ""))]
5970 if (WORDS_BIG_ENDIAN)
5971 emit_insn (gen_unaligned_storeqi_be (operands[0], operands[1],
5972 operands[2], operands[3],
5975 emit_insn (gen_unaligned_storeqi_le (operands[0], operands[1],
5976 operands[2], operands[3],
5981 (define_expand "unaligned_storeqi_le"
5982 [(set (match_operand:DI 3 "register_operand" "")
5983 (mem:DI (and:DI (match_operand:DI 0 "address_operand" "")
5985 (set (match_operand:DI 2 "register_operand" "")
5988 (and:DI (not:DI (ashift:DI (const_int 255)
5989 (ashift:DI (match_dup 2) (const_int 3))))
5991 (set (match_operand:DI 4 "register_operand" "")
5992 (ashift:DI (zero_extend:DI (match_operand:QI 1 "register_operand" ""))
5993 (ashift:DI (match_dup 2) (const_int 3))))
5994 (set (match_dup 4) (ior:DI (match_dup 4) (match_dup 3)))
5995 (set (mem:DI (and:DI (match_dup 0) (const_int -8)))
5997 "! WORDS_BIG_ENDIAN"
6000 (define_expand "unaligned_storeqi_be"
6001 [(set (match_operand:DI 3 "register_operand" "")
6002 (mem:DI (and:DI (match_operand:DI 0 "address_operand" "")
6004 (set (match_operand:DI 2 "register_operand" "")
6007 (and:DI (not:DI (ashift:DI (const_int 255)
6008 (minus:DI (const_int 56)
6009 (ashift:DI (match_dup 2) (const_int 3)))))
6011 (set (match_operand:DI 4 "register_operand" "")
6012 (ashift:DI (zero_extend:DI (match_operand:QI 1 "register_operand" ""))
6013 (minus:DI (const_int 56)
6014 (ashift:DI (match_dup 2) (const_int 3)))))
6015 (set (match_dup 4) (ior:DI (match_dup 4) (match_dup 3)))
6016 (set (mem:DI (and:DI (match_dup 0) (const_int -8)))
6021 (define_expand "unaligned_storehi"
6022 [(use (match_operand:DI 0 "address_operand" ""))
6023 (use (match_operand:HI 1 "register_operand" ""))
6024 (use (match_operand:DI 2 "register_operand" ""))
6025 (use (match_operand:DI 3 "register_operand" ""))
6026 (use (match_operand:DI 4 "register_operand" ""))]
6029 if (WORDS_BIG_ENDIAN)
6030 emit_insn (gen_unaligned_storehi_be (operands[0], operands[1],
6031 operands[2], operands[3],
6034 emit_insn (gen_unaligned_storehi_le (operands[0], operands[1],
6035 operands[2], operands[3],
6040 (define_expand "unaligned_storehi_le"
6041 [(set (match_operand:DI 3 "register_operand" "")
6042 (mem:DI (and:DI (match_operand:DI 0 "address_operand" "")
6044 (set (match_operand:DI 2 "register_operand" "")
6047 (and:DI (not:DI (ashift:DI (const_int 65535)
6048 (ashift:DI (match_dup 2) (const_int 3))))
6050 (set (match_operand:DI 4 "register_operand" "")
6051 (ashift:DI (zero_extend:DI (match_operand:HI 1 "register_operand" ""))
6052 (ashift:DI (match_dup 2) (const_int 3))))
6053 (set (match_dup 4) (ior:DI (match_dup 4) (match_dup 3)))
6054 (set (mem:DI (and:DI (match_dup 0) (const_int -8)))
6056 "! WORDS_BIG_ENDIAN"
6059 (define_expand "unaligned_storehi_be"
6060 [(set (match_operand:DI 3 "register_operand" "")
6061 (mem:DI (and:DI (match_operand:DI 0 "address_operand" "")
6063 (set (match_operand:DI 2 "register_operand" "")
6064 (plus:DI (match_dup 0) (const_int 1)))
6066 (and:DI (not:DI (ashift:DI
6068 (minus:DI (const_int 56)
6069 (ashift:DI (match_dup 2) (const_int 3)))))
6071 (set (match_operand:DI 4 "register_operand" "")
6072 (ashift:DI (zero_extend:DI (match_operand:HI 1 "register_operand" ""))
6073 (minus:DI (const_int 56)
6074 (ashift:DI (match_dup 2) (const_int 3)))))
6075 (set (match_dup 4) (ior:DI (match_dup 4) (match_dup 3)))
6076 (set (mem:DI (and:DI (match_dup 0) (const_int -8)))
6081 ;; Here are the define_expand's for QI and HI moves that use the above
6082 ;; patterns. We have the normal sets, plus the ones that need scratch
6083 ;; registers for reload.
6085 (define_expand "movqi"
6086 [(set (match_operand:QI 0 "nonimmediate_operand" "")
6087 (match_operand:QI 1 "general_operand" ""))]
6091 ? alpha_expand_mov (QImode, operands)
6092 : alpha_expand_mov_nobwx (QImode, operands))
6096 (define_expand "movhi"
6097 [(set (match_operand:HI 0 "nonimmediate_operand" "")
6098 (match_operand:HI 1 "general_operand" ""))]
6102 ? alpha_expand_mov (HImode, operands)
6103 : alpha_expand_mov_nobwx (HImode, operands))
6107 ;; Here are the versions for reload. Note that in the unaligned cases
6108 ;; we know that the operand must not be a pseudo-register because stack
6109 ;; slots are always aligned references.
6111 (define_expand "reload_inqi"
6112 [(parallel [(match_operand:QI 0 "register_operand" "=r")
6113 (match_operand:QI 1 "any_memory_operand" "m")
6114 (match_operand:TI 2 "register_operand" "=&r")])]
6119 if (aligned_memory_operand (operands[1], QImode))
6121 seq = gen_reload_inqi_help (operands[0], operands[1],
6122 gen_rtx_REG (SImode, REGNO (operands[2])));
6128 /* It is possible that one of the registers we got for operands[2]
6129 might coincide with that of operands[0] (which is why we made
6130 it TImode). Pick the other one to use as our scratch. */
6131 if (REGNO (operands[0]) == REGNO (operands[2]))
6132 scratch = gen_rtx_REG (DImode, REGNO (operands[2]) + 1);
6134 scratch = gen_rtx_REG (DImode, REGNO (operands[2]));
6136 addr = get_unaligned_address (operands[1], 0);
6137 operands[0] = gen_rtx_REG (DImode, REGNO (operands[0]));
6138 seq = gen_unaligned_loadqi (operands[0], addr, scratch, operands[0]);
6139 alpha_set_memflags (seq, operands[1]);
6145 (define_expand "reload_inhi"
6146 [(parallel [(match_operand:HI 0 "register_operand" "=r")
6147 (match_operand:HI 1 "any_memory_operand" "m")
6148 (match_operand:TI 2 "register_operand" "=&r")])]
6153 if (aligned_memory_operand (operands[1], HImode))
6155 seq = gen_reload_inhi_help (operands[0], operands[1],
6156 gen_rtx_REG (SImode, REGNO (operands[2])));
6162 /* It is possible that one of the registers we got for operands[2]
6163 might coincide with that of operands[0] (which is why we made
6164 it TImode). Pick the other one to use as our scratch. */
6165 if (REGNO (operands[0]) == REGNO (operands[2]))
6166 scratch = gen_rtx_REG (DImode, REGNO (operands[2]) + 1);
6168 scratch = gen_rtx_REG (DImode, REGNO (operands[2]));
6170 addr = get_unaligned_address (operands[1], 0);
6171 operands[0] = gen_rtx_REG (DImode, REGNO (operands[0]));
6172 seq = gen_unaligned_loadhi (operands[0], addr, scratch, operands[0]);
6173 alpha_set_memflags (seq, operands[1]);
6179 (define_expand "reload_outqi"
6180 [(parallel [(match_operand:QI 0 "any_memory_operand" "=m")
6181 (match_operand:QI 1 "register_operand" "r")
6182 (match_operand:TI 2 "register_operand" "=&r")])]
6185 if (aligned_memory_operand (operands[0], QImode))
6187 emit_insn (gen_reload_outqi_help
6188 (operands[0], operands[1],
6189 gen_rtx_REG (SImode, REGNO (operands[2])),
6190 gen_rtx_REG (SImode, REGNO (operands[2]) + 1)));
6194 rtx addr = get_unaligned_address (operands[0], 0);
6195 rtx scratch1 = gen_rtx_REG (DImode, REGNO (operands[2]));
6196 rtx scratch2 = gen_rtx_REG (DImode, REGNO (operands[2]) + 1);
6197 rtx scratch3 = scratch1;
6200 if (GET_CODE (addr) == REG)
6203 seq = gen_unaligned_storeqi (addr, operands[1], scratch1,
6204 scratch2, scratch3);
6205 alpha_set_memflags (seq, operands[0]);
6211 (define_expand "reload_outhi"
6212 [(parallel [(match_operand:HI 0 "any_memory_operand" "=m")
6213 (match_operand:HI 1 "register_operand" "r")
6214 (match_operand:TI 2 "register_operand" "=&r")])]
6217 if (aligned_memory_operand (operands[0], HImode))
6219 emit_insn (gen_reload_outhi_help
6220 (operands[0], operands[1],
6221 gen_rtx_REG (SImode, REGNO (operands[2])),
6222 gen_rtx_REG (SImode, REGNO (operands[2]) + 1)));
6226 rtx addr = get_unaligned_address (operands[0], 0);
6227 rtx scratch1 = gen_rtx_REG (DImode, REGNO (operands[2]));
6228 rtx scratch2 = gen_rtx_REG (DImode, REGNO (operands[2]) + 1);
6229 rtx scratch3 = scratch1;
6232 if (GET_CODE (addr) == REG)
6235 seq = gen_unaligned_storehi (addr, operands[1], scratch1,
6236 scratch2, scratch3);
6237 alpha_set_memflags (seq, operands[0]);
6243 ;; Helpers for the above. The way reload is structured, we can't
6244 ;; always get a proper address for a stack slot during reload_foo
6245 ;; expansion, so we must delay our address manipulations until after.
6247 (define_insn_and_split "reload_inqi_help"
6248 [(set (match_operand:QI 0 "register_operand" "=r")
6249 (match_operand:QI 1 "memory_operand" "m"))
6250 (clobber (match_operand:SI 2 "register_operand" "=r"))]
6251 "! TARGET_BWX && (reload_in_progress || reload_completed)"
6253 "! TARGET_BWX && reload_completed"
6256 rtx aligned_mem, bitnum;
6257 get_aligned_mem (operands[1], &aligned_mem, &bitnum);
6258 operands[0] = gen_lowpart (DImode, operands[0]);
6259 emit_insn (gen_aligned_loadqi (operands[0], aligned_mem, bitnum,
6264 (define_insn_and_split "reload_inhi_help"
6265 [(set (match_operand:HI 0 "register_operand" "=r")
6266 (match_operand:HI 1 "memory_operand" "m"))
6267 (clobber (match_operand:SI 2 "register_operand" "=r"))]
6268 "! TARGET_BWX && (reload_in_progress || reload_completed)"
6270 "! TARGET_BWX && reload_completed"
6273 rtx aligned_mem, bitnum;
6274 get_aligned_mem (operands[1], &aligned_mem, &bitnum);
6275 operands[0] = gen_lowpart (DImode, operands[0]);
6276 emit_insn (gen_aligned_loadhi (operands[0], aligned_mem, bitnum,
6281 (define_insn_and_split "reload_outqi_help"
6282 [(set (match_operand:QI 0 "memory_operand" "=m")
6283 (match_operand:QI 1 "register_operand" "r"))
6284 (clobber (match_operand:SI 2 "register_operand" "=r"))
6285 (clobber (match_operand:SI 3 "register_operand" "=r"))]
6286 "! TARGET_BWX && (reload_in_progress || reload_completed)"
6288 "! TARGET_BWX && reload_completed"
6291 rtx aligned_mem, bitnum;
6292 get_aligned_mem (operands[0], &aligned_mem, &bitnum);
6293 emit_insn (gen_aligned_store (aligned_mem, operands[1], bitnum,
6294 operands[2], operands[3]));
6298 (define_insn_and_split "reload_outhi_help"
6299 [(set (match_operand:HI 0 "memory_operand" "=m")
6300 (match_operand:HI 1 "register_operand" "r"))
6301 (clobber (match_operand:SI 2 "register_operand" "=r"))
6302 (clobber (match_operand:SI 3 "register_operand" "=r"))]
6303 "! TARGET_BWX && (reload_in_progress || reload_completed)"
6305 "! TARGET_BWX && reload_completed"
6308 rtx aligned_mem, bitnum;
6309 get_aligned_mem (operands[0], &aligned_mem, &bitnum);
6310 emit_insn (gen_aligned_store (aligned_mem, operands[1], bitnum,
6311 operands[2], operands[3]));
6315 ;; Vector operations
6317 (define_mode_macro VEC [V8QI V4HI V2SI])
6319 (define_expand "mov<mode>"
6320 [(set (match_operand:VEC 0 "nonimmediate_operand" "")
6321 (match_operand:VEC 1 "general_operand" ""))]
6324 if (alpha_expand_mov (<MODE>mode, operands))
6329 [(set (match_operand:VEC 0 "register_operand" "")
6330 (match_operand:VEC 1 "non_zero_const_operand" ""))]
6334 if (alpha_split_const_mov (<MODE>mode, operands))
6341 (define_expand "movmisalign<mode>"
6342 [(set (match_operand:VEC 0 "nonimmediate_operand" "")
6343 (match_operand:VEC 1 "general_operand" ""))]
6346 alpha_expand_movmisalign (<MODE>mode, operands);
6350 (define_insn "*mov<mode>_fix"
6351 [(set (match_operand:VEC 0 "nonimmediate_operand" "=r,r,r,m,*f,*f,m,r,*f")
6352 (match_operand:VEC 1 "input_operand" "rW,i,m,rW,*fW,m,*f,*f,r"))]
6354 && (register_operand (operands[0], <MODE>mode)
6355 || reg_or_0_operand (operands[1], <MODE>mode))"
6366 [(set_attr "type" "ilog,multi,ild,ist,fcpys,fld,fst,ftoi,itof")])
6368 (define_insn "*mov<mode>_nofix"
6369 [(set (match_operand:VEC 0 "nonimmediate_operand" "=r,r,r,m,*f,*f,m")
6370 (match_operand:VEC 1 "input_operand" "rW,i,m,rW,*fW,m,*f"))]
6372 && (register_operand (operands[0], <MODE>mode)
6373 || reg_or_0_operand (operands[1], <MODE>mode))"
6382 [(set_attr "type" "ilog,multi,ild,ist,fcpys,fld,fst")])
6384 (define_insn "uminv8qi3"
6385 [(set (match_operand:V8QI 0 "register_operand" "=r")
6386 (umin:V8QI (match_operand:V8QI 1 "reg_or_0_operand" "rW")
6387 (match_operand:V8QI 2 "reg_or_0_operand" "rW")))]
6390 [(set_attr "type" "mvi")])
6392 (define_insn "sminv8qi3"
6393 [(set (match_operand:V8QI 0 "register_operand" "=r")
6394 (smin:V8QI (match_operand:V8QI 1 "reg_or_0_operand" "rW")
6395 (match_operand:V8QI 2 "reg_or_0_operand" "rW")))]
6398 [(set_attr "type" "mvi")])
6400 (define_insn "uminv4hi3"
6401 [(set (match_operand:V4HI 0 "register_operand" "=r")
6402 (umin:V4HI (match_operand:V4HI 1 "reg_or_0_operand" "rW")
6403 (match_operand:V4HI 2 "reg_or_0_operand" "rW")))]
6406 [(set_attr "type" "mvi")])
6408 (define_insn "sminv4hi3"
6409 [(set (match_operand:V4HI 0 "register_operand" "=r")
6410 (smin:V4HI (match_operand:V4HI 1 "reg_or_0_operand" "rW")
6411 (match_operand:V4HI 2 "reg_or_0_operand" "rW")))]
6414 [(set_attr "type" "mvi")])
6416 (define_insn "umaxv8qi3"
6417 [(set (match_operand:V8QI 0 "register_operand" "=r")
6418 (umax:V8QI (match_operand:V8QI 1 "reg_or_0_operand" "rW")
6419 (match_operand:V8QI 2 "reg_or_0_operand" "rW")))]
6422 [(set_attr "type" "mvi")])
6424 (define_insn "smaxv8qi3"
6425 [(set (match_operand:V8QI 0 "register_operand" "=r")
6426 (smax:V8QI (match_operand:V8QI 1 "reg_or_0_operand" "rW")
6427 (match_operand:V8QI 2 "reg_or_0_operand" "rW")))]
6430 [(set_attr "type" "mvi")])
6432 (define_insn "umaxv4hi3"
6433 [(set (match_operand:V4HI 0 "register_operand" "=r")
6434 (umax:V4HI (match_operand:V4HI 1 "reg_or_0_operand" "rW")
6435 (match_operand:V4HI 2 "reg_or_0_operand" "rW")))]
6438 [(set_attr "type" "mvi")])
6440 (define_insn "smaxv4hi3"
6441 [(set (match_operand:V4HI 0 "register_operand" "=r")
6442 (smax:V4HI (match_operand:V4HI 1 "reg_or_0_operand" "rW")
6443 (match_operand:V4HI 2 "reg_or_0_operand" "rW")))]
6446 [(set_attr "type" "mvi")])
6448 (define_insn "one_cmpl<mode>2"
6449 [(set (match_operand:VEC 0 "register_operand" "=r")
6450 (not:VEC (match_operand:VEC 1 "register_operand" "r")))]
6453 [(set_attr "type" "ilog")])
6455 (define_insn "and<mode>3"
6456 [(set (match_operand:VEC 0 "register_operand" "=r")
6457 (and:VEC (match_operand:VEC 1 "register_operand" "r")
6458 (match_operand:VEC 2 "register_operand" "r")))]
6461 [(set_attr "type" "ilog")])
6463 (define_insn "*andnot<mode>3"
6464 [(set (match_operand:VEC 0 "register_operand" "=r")
6465 (and:VEC (not:VEC (match_operand:VEC 1 "register_operand" "r"))
6466 (match_operand:VEC 2 "register_operand" "r")))]
6469 [(set_attr "type" "ilog")])
6471 (define_insn "ior<mode>3"
6472 [(set (match_operand:VEC 0 "register_operand" "=r")
6473 (ior:VEC (match_operand:VEC 1 "register_operand" "r")
6474 (match_operand:VEC 2 "register_operand" "r")))]
6477 [(set_attr "type" "ilog")])
6479 (define_insn "*iornot<mode>3"
6480 [(set (match_operand:VEC 0 "register_operand" "=r")
6481 (ior:VEC (not:DI (match_operand:VEC 1 "register_operand" "r"))
6482 (match_operand:VEC 2 "register_operand" "r")))]
6485 [(set_attr "type" "ilog")])
6487 (define_insn "xor<mode>3"
6488 [(set (match_operand:VEC 0 "register_operand" "=r")
6489 (xor:VEC (match_operand:VEC 1 "register_operand" "r")
6490 (match_operand:VEC 2 "register_operand" "r")))]
6493 [(set_attr "type" "ilog")])
6495 (define_insn "*xornot<mode>3"
6496 [(set (match_operand:VEC 0 "register_operand" "=r")
6497 (not:VEC (xor:VEC (match_operand:VEC 1 "register_operand" "r")
6498 (match_operand:VEC 2 "register_operand" "r"))))]
6501 [(set_attr "type" "ilog")])
6503 (define_expand "vec_shl_<mode>"
6504 [(set (match_operand:VEC 0 "register_operand" "")
6505 (ashift:DI (match_operand:VEC 1 "register_operand" "")
6506 (match_operand:DI 2 "reg_or_6bit_operand" "")))]
6509 operands[0] = gen_lowpart (DImode, operands[0]);
6510 operands[1] = gen_lowpart (DImode, operands[1]);
6513 (define_expand "vec_shr_<mode>"
6514 [(set (match_operand:VEC 0 "register_operand" "")
6515 (lshiftrt:DI (match_operand:VEC 1 "register_operand" "")
6516 (match_operand:DI 2 "reg_or_6bit_operand" "")))]
6519 operands[0] = gen_lowpart (DImode, operands[0]);
6520 operands[1] = gen_lowpart (DImode, operands[1]);
6523 ;; Bit field extract patterns which use ext[wlq][lh]
6525 (define_expand "extv"
6526 [(set (match_operand:DI 0 "register_operand" "")
6527 (sign_extract:DI (match_operand:QI 1 "memory_operand" "")
6528 (match_operand:DI 2 "immediate_operand" "")
6529 (match_operand:DI 3 "immediate_operand" "")))]
6534 /* We can do 16, 32 and 64 bit fields, if aligned on byte boundaries. */
6535 if (INTVAL (operands[3]) % 8 != 0
6536 || (INTVAL (operands[2]) != 16
6537 && INTVAL (operands[2]) != 32
6538 && INTVAL (operands[2]) != 64))
6541 /* From mips.md: extract_bit_field doesn't verify that our source
6542 matches the predicate, so we force it to be a MEM here. */
6543 if (GET_CODE (operands[1]) != MEM)
6546 /* The bit number is relative to the mode of operand 1 which is
6547 usually QImode (this might actually be a bug in expmed.c). Note
6548 that the bit number is negative in big-endian mode in this case.
6549 We have to convert that to the offset. */
6550 if (WORDS_BIG_ENDIAN)
6551 ofs = GET_MODE_BITSIZE (GET_MODE (operands[1]))
6552 - INTVAL (operands[2]) - INTVAL (operands[3]);
6554 ofs = INTVAL (operands[3]);
6558 alpha_expand_unaligned_load (operands[0], operands[1],
6559 INTVAL (operands[2]) / 8,
6564 (define_expand "extzv"
6565 [(set (match_operand:DI 0 "register_operand" "")
6566 (zero_extract:DI (match_operand:DI 1 "nonimmediate_operand" "")
6567 (match_operand:DI 2 "immediate_operand" "")
6568 (match_operand:DI 3 "immediate_operand" "")))]
6571 /* We can do 8, 16, 32 and 64 bit fields, if aligned on byte boundaries. */
6572 if (INTVAL (operands[3]) % 8 != 0
6573 || (INTVAL (operands[2]) != 8
6574 && INTVAL (operands[2]) != 16
6575 && INTVAL (operands[2]) != 32
6576 && INTVAL (operands[2]) != 64))
6579 if (GET_CODE (operands[1]) == MEM)
6583 /* Fail 8-bit fields, falling back on a simple byte load. */
6584 if (INTVAL (operands[2]) == 8)
6587 /* The bit number is relative to the mode of operand 1 which is
6588 usually QImode (this might actually be a bug in expmed.c). Note
6589 that the bit number is negative in big-endian mode in this case.
6590 We have to convert that to the offset. */
6591 if (WORDS_BIG_ENDIAN)
6592 ofs = GET_MODE_BITSIZE (GET_MODE (operands[1]))
6593 - INTVAL (operands[2]) - INTVAL (operands[3]);
6595 ofs = INTVAL (operands[3]);
6599 alpha_expand_unaligned_load (operands[0], operands[1],
6600 INTVAL (operands[2]) / 8,
6606 (define_expand "insv"
6607 [(set (zero_extract:DI (match_operand:QI 0 "memory_operand" "")
6608 (match_operand:DI 1 "immediate_operand" "")
6609 (match_operand:DI 2 "immediate_operand" ""))
6610 (match_operand:DI 3 "register_operand" ""))]
6615 /* We can do 16, 32 and 64 bit fields, if aligned on byte boundaries. */
6616 if (INTVAL (operands[2]) % 8 != 0
6617 || (INTVAL (operands[1]) != 16
6618 && INTVAL (operands[1]) != 32
6619 && INTVAL (operands[1]) != 64))
6622 /* From mips.md: store_bit_field doesn't verify that our source
6623 matches the predicate, so we force it to be a MEM here. */
6624 if (GET_CODE (operands[0]) != MEM)
6627 /* The bit number is relative to the mode of operand 1 which is
6628 usually QImode (this might actually be a bug in expmed.c). Note
6629 that the bit number is negative in big-endian mode in this case.
6630 We have to convert that to the offset. */
6631 if (WORDS_BIG_ENDIAN)
6632 ofs = GET_MODE_BITSIZE (GET_MODE (operands[0]))
6633 - INTVAL (operands[1]) - INTVAL (operands[2]);
6635 ofs = INTVAL (operands[2]);
6639 alpha_expand_unaligned_store (operands[0], operands[3],
6640 INTVAL (operands[1]) / 8, ofs);
6644 ;; Block move/clear, see alpha.c for more details.
6645 ;; Argument 0 is the destination
6646 ;; Argument 1 is the source
6647 ;; Argument 2 is the length
6648 ;; Argument 3 is the alignment
6650 (define_expand "movmemqi"
6651 [(parallel [(set (match_operand:BLK 0 "memory_operand" "")
6652 (match_operand:BLK 1 "memory_operand" ""))
6653 (use (match_operand:DI 2 "immediate_operand" ""))
6654 (use (match_operand:DI 3 "immediate_operand" ""))])]
6657 if (alpha_expand_block_move (operands))
6663 (define_expand "movmemdi"
6664 [(parallel [(set (match_operand:BLK 0 "memory_operand" "")
6665 (match_operand:BLK 1 "memory_operand" ""))
6666 (use (match_operand:DI 2 "immediate_operand" ""))
6667 (use (match_operand:DI 3 "immediate_operand" ""))
6669 (clobber (reg:DI 25))
6670 (clobber (reg:DI 16))
6671 (clobber (reg:DI 17))
6672 (clobber (reg:DI 18))
6673 (clobber (reg:DI 19))
6674 (clobber (reg:DI 20))
6675 (clobber (reg:DI 26))
6676 (clobber (reg:DI 27))])]
6677 "TARGET_ABI_OPEN_VMS"
6679 operands[4] = gen_rtx_SYMBOL_REF (Pmode, "OTS$MOVE");
6680 alpha_need_linkage (XSTR (operands[4], 0), 0);
6683 (define_insn "*movmemdi_1"
6684 [(set (match_operand:BLK 0 "memory_operand" "=m,=m")
6685 (match_operand:BLK 1 "memory_operand" "m,m"))
6686 (use (match_operand:DI 2 "nonmemory_operand" "r,i"))
6687 (use (match_operand:DI 3 "immediate_operand" ""))
6688 (use (match_operand:DI 4 "call_operand" "i,i"))
6689 (clobber (reg:DI 25))
6690 (clobber (reg:DI 16))
6691 (clobber (reg:DI 17))
6692 (clobber (reg:DI 18))
6693 (clobber (reg:DI 19))
6694 (clobber (reg:DI 20))
6695 (clobber (reg:DI 26))
6696 (clobber (reg:DI 27))]
6697 "TARGET_ABI_OPEN_VMS"
6699 operands [5] = alpha_use_linkage (operands [4], cfun->decl, 0, 1);
6700 switch (which_alternative)
6703 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)";
6705 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)";
6710 [(set_attr "type" "multi")
6711 (set_attr "length" "28")])
6713 (define_expand "setmemqi"
6714 [(parallel [(set (match_operand:BLK 0 "memory_operand" "")
6715 (match_operand 2 "const_int_operand" ""))
6716 (use (match_operand:DI 1 "immediate_operand" ""))
6717 (use (match_operand:DI 3 "immediate_operand" ""))])]
6720 /* If value to set is not zero, use the library routine. */
6721 if (operands[2] != const0_rtx)
6724 if (alpha_expand_block_clear (operands))
6730 (define_expand "setmemdi"
6731 [(parallel [(set (match_operand:BLK 0 "memory_operand" "")
6732 (match_operand 2 "const_int_operand" ""))
6733 (use (match_operand:DI 1 "immediate_operand" ""))
6734 (use (match_operand:DI 3 "immediate_operand" ""))
6736 (clobber (reg:DI 25))
6737 (clobber (reg:DI 16))
6738 (clobber (reg:DI 17))
6739 (clobber (reg:DI 26))
6740 (clobber (reg:DI 27))])]
6741 "TARGET_ABI_OPEN_VMS"
6743 /* If value to set is not zero, use the library routine. */
6744 if (operands[2] != const0_rtx)
6747 operands[4] = gen_rtx_SYMBOL_REF (Pmode, "OTS$ZERO");
6748 alpha_need_linkage (XSTR (operands[4], 0), 0);
6751 (define_insn "*clrmemdi_1"
6752 [(set (match_operand:BLK 0 "memory_operand" "=m,=m")
6754 (use (match_operand:DI 1 "nonmemory_operand" "r,i"))
6755 (use (match_operand:DI 2 "immediate_operand" ""))
6756 (use (match_operand:DI 3 "call_operand" "i,i"))
6757 (clobber (reg:DI 25))
6758 (clobber (reg:DI 16))
6759 (clobber (reg:DI 17))
6760 (clobber (reg:DI 26))
6761 (clobber (reg:DI 27))]
6762 "TARGET_ABI_OPEN_VMS"
6764 operands [4] = alpha_use_linkage (operands [3], cfun->decl, 0, 1);
6765 switch (which_alternative)
6768 return "lda $16,%0\;bis $31,%1,$17\;ldq $26,%4\;lda $25,2($31)\;jsr $26,%3\;ldq $27,0($29)";
6770 return "lda $16,%0\;lda $17,%1($31)\;ldq $26,%4\;lda $25,2($31)\;jsr $26,%3\;ldq $27,0($29)";
6775 [(set_attr "type" "multi")
6776 (set_attr "length" "24")])
6779 ;; Subroutine of stack space allocation. Perform a stack probe.
6780 (define_expand "probe_stack"
6781 [(set (match_dup 1) (match_operand:DI 0 "const_int_operand" ""))]
6784 operands[1] = gen_rtx_MEM (DImode, plus_constant (stack_pointer_rtx,
6785 INTVAL (operands[0])));
6786 MEM_VOLATILE_P (operands[1]) = 1;
6788 operands[0] = const0_rtx;
6791 ;; This is how we allocate stack space. If we are allocating a
6792 ;; constant amount of space and we know it is less than 4096
6793 ;; bytes, we need do nothing.
6795 ;; If it is more than 4096 bytes, we need to probe the stack
6797 (define_expand "allocate_stack"
6799 (plus:DI (reg:DI 30)
6800 (match_operand:DI 1 "reg_or_cint_operand" "")))
6801 (set (match_operand:DI 0 "register_operand" "=r")
6805 if (GET_CODE (operands[1]) == CONST_INT
6806 && INTVAL (operands[1]) < 32768)
6808 if (INTVAL (operands[1]) >= 4096)
6810 /* We do this the same way as in the prologue and generate explicit
6811 probes. Then we update the stack by the constant. */
6815 emit_insn (gen_probe_stack (GEN_INT (- probed)));
6816 while (probed + 8192 < INTVAL (operands[1]))
6817 emit_insn (gen_probe_stack (GEN_INT (- (probed += 8192))));
6819 if (probed + 4096 < INTVAL (operands[1]))
6820 emit_insn (gen_probe_stack (GEN_INT (- INTVAL(operands[1]))));
6823 operands[1] = GEN_INT (- INTVAL (operands[1]));
6824 operands[2] = virtual_stack_dynamic_rtx;
6829 rtx loop_label = gen_label_rtx ();
6830 rtx want = gen_reg_rtx (Pmode);
6831 rtx tmp = gen_reg_rtx (Pmode);
6834 emit_insn (gen_subdi3 (want, stack_pointer_rtx,
6835 force_reg (Pmode, operands[1])));
6836 emit_insn (gen_adddi3 (tmp, stack_pointer_rtx, GEN_INT (-4096)));
6838 if (GET_CODE (operands[1]) != CONST_INT)
6840 out_label = gen_label_rtx ();
6841 emit_insn (gen_cmpdi (want, tmp));
6842 emit_jump_insn (gen_bgeu (out_label));
6845 emit_label (loop_label);
6846 memref = gen_rtx_MEM (DImode, tmp);
6847 MEM_VOLATILE_P (memref) = 1;
6848 emit_move_insn (memref, const0_rtx);
6849 emit_insn (gen_adddi3 (tmp, tmp, GEN_INT(-8192)));
6850 emit_insn (gen_cmpdi (tmp, want));
6851 emit_jump_insn (gen_bgtu (loop_label));
6853 memref = gen_rtx_MEM (DImode, want);
6854 MEM_VOLATILE_P (memref) = 1;
6855 emit_move_insn (memref, const0_rtx);
6858 emit_label (out_label);
6860 emit_move_insn (stack_pointer_rtx, want);
6861 emit_move_insn (operands[0], virtual_stack_dynamic_rtx);
6866 ;; This is used by alpha_expand_prolog to do the same thing as above,
6867 ;; except we cannot at that time generate new basic blocks, so we hide
6868 ;; the loop in this one insn.
6870 (define_insn "prologue_stack_probe_loop"
6871 [(unspec_volatile [(match_operand:DI 0 "register_operand" "r")
6872 (match_operand:DI 1 "register_operand" "r")]
6876 operands[2] = gen_label_rtx ();
6877 (*targetm.asm_out.internal_label) (asm_out_file, "L",
6878 CODE_LABEL_NUMBER (operands[2]));
6880 return "stq $31,-8192(%1)\;subq %0,1,%0\;lda %1,-8192(%1)\;bne %0,%l2";
6882 [(set_attr "length" "16")
6883 (set_attr "type" "multi")])
6885 (define_expand "prologue"
6886 [(clobber (const_int 0))]
6889 alpha_expand_prologue ();
6893 ;; These take care of emitting the ldgp insn in the prologue. This will be
6894 ;; an lda/ldah pair and we want to align them properly. So we have two
6895 ;; unspec_volatile insns, the first of which emits the ldgp assembler macro
6896 ;; and the second of which emits nothing. However, both are marked as type
6897 ;; IADD (the default) so the alignment code in alpha.c does the right thing
6900 (define_expand "prologue_ldgp"
6902 (unspec_volatile:DI [(match_dup 1) (match_dup 2)] UNSPECV_LDGP1))
6904 (unspec_volatile:DI [(match_dup 0) (match_dup 2)] UNSPECV_PLDGP2))]
6907 operands[0] = pic_offset_table_rtx;
6908 operands[1] = gen_rtx_REG (Pmode, 27);
6909 operands[2] = (TARGET_EXPLICIT_RELOCS
6910 ? GEN_INT (alpha_next_sequence_number++)
6914 (define_insn "*ldgp_er_1"
6915 [(set (match_operand:DI 0 "register_operand" "=r")
6916 (unspec_volatile:DI [(match_operand:DI 1 "register_operand" "r")
6917 (match_operand 2 "const_int_operand" "")]
6919 "TARGET_EXPLICIT_RELOCS && TARGET_ABI_OSF"
6920 "ldah %0,0(%1)\t\t!gpdisp!%2"
6921 [(set_attr "cannot_copy" "true")])
6923 (define_insn "*ldgp_er_2"
6924 [(set (match_operand:DI 0 "register_operand" "=r")
6925 (unspec:DI [(match_operand:DI 1 "register_operand" "r")
6926 (match_operand 2 "const_int_operand" "")]
6928 "TARGET_EXPLICIT_RELOCS && TARGET_ABI_OSF"
6929 "lda %0,0(%1)\t\t!gpdisp!%2"
6930 [(set_attr "cannot_copy" "true")])
6932 (define_insn "*prologue_ldgp_er_2"
6933 [(set (match_operand:DI 0 "register_operand" "=r")
6934 (unspec_volatile:DI [(match_operand:DI 1 "register_operand" "r")
6935 (match_operand 2 "const_int_operand" "")]
6937 "TARGET_EXPLICIT_RELOCS && TARGET_ABI_OSF"
6938 "lda %0,0(%1)\t\t!gpdisp!%2\n$%~..ng:"
6939 [(set_attr "cannot_copy" "true")])
6941 (define_insn "*prologue_ldgp_1"
6942 [(set (match_operand:DI 0 "register_operand" "=r")
6943 (unspec_volatile:DI [(match_operand:DI 1 "register_operand" "r")
6944 (match_operand 2 "const_int_operand" "")]
6947 "ldgp %0,0(%1)\n$%~..ng:"
6948 [(set_attr "cannot_copy" "true")])
6950 (define_insn "*prologue_ldgp_2"
6951 [(set (match_operand:DI 0 "register_operand" "=r")
6952 (unspec_volatile:DI [(match_operand:DI 1 "register_operand" "r")
6953 (match_operand 2 "const_int_operand" "")]
6958 ;; The _mcount profiling hook has special calling conventions, and
6959 ;; does not clobber all the registers that a normal call would. So
6960 ;; hide the fact this is a call at all.
6962 (define_insn "prologue_mcount"
6963 [(unspec_volatile [(const_int 0)] UNSPECV_MCOUNT)]
6966 if (TARGET_EXPLICIT_RELOCS)
6967 /* Note that we cannot use a lituse_jsr reloc, since _mcount
6968 cannot be called via the PLT. */
6969 return "ldq $28,_mcount($29)\t\t!literal\;jsr $28,($28),_mcount";
6971 return "lda $28,_mcount\;jsr $28,($28),_mcount";
6973 [(set_attr "type" "multi")
6974 (set_attr "length" "8")])
6976 (define_insn "init_fp"
6977 [(set (match_operand:DI 0 "register_operand" "=r")
6978 (match_operand:DI 1 "register_operand" "r"))
6979 (clobber (mem:BLK (match_operand:DI 2 "register_operand" "=r")))]
6983 (define_expand "epilogue"
6987 alpha_expand_epilogue ();
6990 (define_expand "sibcall_epilogue"
6994 alpha_expand_epilogue ();
6998 (define_expand "builtin_longjmp"
6999 [(use (match_operand:DI 0 "register_operand" "r"))]
7002 /* The elements of the buffer are, in order: */
7003 rtx fp = gen_rtx_MEM (Pmode, operands[0]);
7004 rtx lab = gen_rtx_MEM (Pmode, plus_constant (operands[0], 8));
7005 rtx stack = gen_rtx_MEM (Pmode, plus_constant (operands[0], 16));
7006 rtx pv = gen_rtx_REG (Pmode, 27);
7008 /* This bit is the same as expand_builtin_longjmp. */
7009 emit_move_insn (hard_frame_pointer_rtx, fp);
7010 emit_move_insn (pv, lab);
7011 emit_stack_restore (SAVE_NONLOCAL, stack, NULL_RTX);
7012 emit_insn (gen_rtx_USE (VOIDmode, hard_frame_pointer_rtx));
7013 emit_insn (gen_rtx_USE (VOIDmode, stack_pointer_rtx));
7015 /* Load the label we are jumping through into $27 so that we know
7016 where to look for it when we get back to setjmp's function for
7017 restoring the gp. */
7018 emit_jump_insn (gen_builtin_longjmp_internal (pv));
7023 ;; This is effectively a copy of indirect_jump, but constrained such
7024 ;; that register renaming cannot foil our cunning plan with $27.
7025 (define_insn "builtin_longjmp_internal"
7027 (unspec_volatile [(match_operand:DI 0 "register_operand" "c")]
7031 [(set_attr "type" "ibr")])
7033 (define_expand "builtin_setjmp_receiver"
7034 [(unspec_volatile [(label_ref (match_operand 0 "" ""))] UNSPECV_SETJMPR)]
7038 (define_insn_and_split "*builtin_setjmp_receiver_1"
7039 [(unspec_volatile [(match_operand 0 "" "")] UNSPECV_SETJMPR)]
7042 if (TARGET_EXPLICIT_RELOCS)
7045 return "br $27,$LSJ%=\n$LSJ%=:\;ldgp $29,0($27)";
7047 "&& TARGET_EXPLICIT_RELOCS && reload_completed"
7049 (unspec_volatile:DI [(match_dup 2) (match_dup 3)] UNSPECV_LDGP1))
7051 (unspec:DI [(match_dup 1) (match_dup 3)] UNSPEC_LDGP2))]
7053 if (prev_nonnote_insn (curr_insn) != XEXP (operands[0], 0))
7054 emit_insn (gen_rtx_UNSPEC_VOLATILE (VOIDmode, gen_rtvec (1, operands[0]),
7055 UNSPECV_SETJMPR_ER));
7056 operands[1] = pic_offset_table_rtx;
7057 operands[2] = gen_rtx_REG (Pmode, 27);
7058 operands[3] = GEN_INT (alpha_next_sequence_number++);
7060 [(set_attr "length" "12")
7061 (set_attr "type" "multi")])
7063 (define_insn "*builtin_setjmp_receiver_er_sl_1"
7064 [(unspec_volatile [(match_operand 0 "" "")] UNSPECV_SETJMPR_ER)]
7065 "TARGET_ABI_OSF && TARGET_EXPLICIT_RELOCS && TARGET_AS_CAN_SUBTRACT_LABELS"
7066 "lda $27,$LSJ%=-%l0($27)\n$LSJ%=:")
7068 (define_insn "*builtin_setjmp_receiver_er_1"
7069 [(unspec_volatile [(match_operand 0 "" "")] UNSPECV_SETJMPR_ER)]
7070 "TARGET_ABI_OSF && TARGET_EXPLICIT_RELOCS"
7071 "br $27,$LSJ%=\n$LSJ%=:"
7072 [(set_attr "type" "ibr")])
7074 (define_expand "exception_receiver"
7075 [(unspec_volatile [(match_dup 0)] UNSPECV_EHR)]
7078 if (TARGET_LD_BUGGY_LDGP)
7079 operands[0] = alpha_gp_save_rtx ();
7081 operands[0] = const0_rtx;
7084 (define_insn "*exception_receiver_2"
7085 [(unspec_volatile [(match_operand:DI 0 "memory_operand" "m")] UNSPECV_EHR)]
7086 "TARGET_ABI_OSF && TARGET_LD_BUGGY_LDGP"
7088 [(set_attr "type" "ild")])
7090 (define_insn_and_split "*exception_receiver_1"
7091 [(unspec_volatile [(const_int 0)] UNSPECV_EHR)]
7094 if (TARGET_EXPLICIT_RELOCS)
7095 return "ldah $29,0($26)\t\t!gpdisp!%*\;lda $29,0($29)\t\t!gpdisp!%*";
7097 return "ldgp $29,0($26)";
7099 "&& TARGET_EXPLICIT_RELOCS && reload_completed"
7101 (unspec_volatile:DI [(match_dup 1) (match_dup 2)] UNSPECV_LDGP1))
7103 (unspec:DI [(match_dup 0) (match_dup 2)] UNSPEC_LDGP2))]
7105 operands[0] = pic_offset_table_rtx;
7106 operands[1] = gen_rtx_REG (Pmode, 26);
7107 operands[2] = GEN_INT (alpha_next_sequence_number++);
7109 [(set_attr "length" "8")
7110 (set_attr "type" "multi")])
7112 (define_expand "nonlocal_goto_receiver"
7113 [(unspec_volatile [(const_int 0)] UNSPECV_BLOCKAGE)
7114 (set (reg:DI 27) (mem:DI (reg:DI 29)))
7115 (unspec_volatile [(const_int 0)] UNSPECV_BLOCKAGE)
7117 "TARGET_ABI_OPEN_VMS"
7120 (define_insn "arg_home"
7121 [(unspec [(const_int 0)] UNSPEC_ARG_HOME)
7136 (clobber (mem:BLK (const_int 0)))
7137 (clobber (reg:DI 24))
7138 (clobber (reg:DI 25))
7139 (clobber (reg:DI 0))]
7140 "TARGET_ABI_OPEN_VMS"
7141 "lda $0,OTS$HOME_ARGS\;ldq $0,8($0)\;jsr $0,OTS$HOME_ARGS"
7142 [(set_attr "length" "16")
7143 (set_attr "type" "multi")])
7145 ;; Load the CIW into r2 for calling __T3E_MISMATCH
7147 (define_expand "umk_mismatch_args"
7148 [(set:DI (match_dup 1) (mem:DI (plus:DI (reg:DI 15) (const_int -16))))
7149 (set:DI (match_dup 2) (mem:DI (plus:DI (match_dup 1) (const_int -32))))
7150 (set:DI (reg:DI 1) (match_operand:DI 0 "const_int_operand" ""))
7151 (set:DI (match_dup 3) (plus:DI (mult:DI (reg:DI 25)
7154 (set:DI (reg:DI 2) (mem:DI (match_dup 3)))]
7155 "TARGET_ABI_UNICOSMK"
7157 operands[1] = gen_reg_rtx (DImode);
7158 operands[2] = gen_reg_rtx (DImode);
7159 operands[3] = gen_reg_rtx (DImode);
7162 (define_insn "arg_home_umk"
7163 [(unspec [(const_int 0)] UNSPEC_ARG_HOME)
7178 (clobber (mem:BLK (const_int 0)))
7180 (clobber (reg:DI 22))
7181 (clobber (reg:DI 23))
7182 (clobber (reg:DI 24))
7183 (clobber (reg:DI 0))
7184 (clobber (reg:DI 1))
7185 (clobber (reg:DI 2))
7186 (clobber (reg:DI 3))
7187 (clobber (reg:DI 4))
7188 (clobber (reg:DI 5))
7189 (clobber (reg:DI 6))
7190 (clobber (reg:DI 7))
7191 (clobber (reg:DI 8))])]
7192 "TARGET_ABI_UNICOSMK"
7193 "laum $4,__T3E_MISMATCH($31)\;sll $4,32,$4\;lalm $4,__T3E_MISMATCH($4)\;lal $4,__T3E_MISMATCH($4)\;jsr $3,($4)"
7194 [(set_attr "length" "16")
7195 (set_attr "type" "multi")])
7199 ;; On EV4, these instructions are nops -- no load occurs.
7201 ;; On EV5, these instructions act as a normal load, and thus can trap
7202 ;; if the address is invalid. The OS may (or may not) handle this in
7203 ;; the entMM fault handler and suppress the fault. If so, then this
7204 ;; has the effect of a read prefetch instruction.
7206 ;; On EV6, these become official prefetch instructions.
7208 (define_insn "prefetch"
7209 [(prefetch (match_operand:DI 0 "address_operand" "p")
7210 (match_operand:DI 1 "const_int_operand" "n")
7211 (match_operand:DI 2 "const_int_operand" "n"))]
7212 "TARGET_FIXUP_EV5_PREFETCH || alpha_cpu == PROCESSOR_EV6"
7214 /* Interpret "no temporal locality" as this data should be evicted once
7215 it is used. The "evict next" alternatives load the data into the cache
7216 and leave the LRU eviction counter pointing to that block. */
7217 static const char * const alt[2][2] = {
7219 "ldq $31,%a0", /* read, evict next */
7220 "ldl $31,%a0", /* read, evict last */
7223 "ldt $f31,%a0", /* write, evict next */
7224 "lds $f31,%a0", /* write, evict last */
7228 bool write = INTVAL (operands[1]) != 0;
7229 bool lru = INTVAL (operands[2]) != 0;
7231 return alt[write][lru];
7233 [(set_attr "type" "ild")])
7235 ;; Close the trap shadow of preceding instructions. This is generated
7238 (define_insn "trapb"
7239 [(unspec_volatile [(const_int 0)] UNSPECV_TRAPB)]
7242 [(set_attr "type" "misc")])
7244 ;; No-op instructions used by machine-dependent reorg to preserve
7245 ;; alignment for instruction issue.
7246 ;; The Unicos/Mk assembler does not support these opcodes.
7252 [(set_attr "type" "ilog")])
7257 "cpys $f31,$f31,$f31"
7258 [(set_attr "type" "fcpys")])
7265 ;; On Unicos/Mk we use a macro for aligning code.
7267 (define_insn "realign"
7268 [(unspec_volatile [(match_operand 0 "immediate_operand" "i")]
7272 if (TARGET_ABI_UNICOSMK)
7273 return "gcc@code@align %0";
7275 return ".align %0 #realign";
7278 ;; Instructions to be emitted from __builtins.
7280 (define_insn "builtin_cmpbge"
7281 [(set (match_operand:DI 0 "register_operand" "=r")
7282 (unspec:DI [(match_operand:DI 1 "reg_or_0_operand" "rJ")
7283 (match_operand:DI 2 "reg_or_8bit_operand" "rI")]
7287 ;; The EV6 data sheets list this as ILOG. OTOH, EV6 doesn't
7288 ;; actually differentiate between ILOG and ICMP in the schedule.
7289 [(set_attr "type" "icmp")])
7291 (define_expand "builtin_extbl"
7292 [(match_operand:DI 0 "register_operand" "")
7293 (match_operand:DI 1 "reg_or_0_operand" "")
7294 (match_operand:DI 2 "reg_or_8bit_operand" "")]
7297 rtx (*gen) (rtx, rtx, rtx, rtx);
7298 if (WORDS_BIG_ENDIAN)
7302 emit_insn ((*gen) (operands[0], operands[1], GEN_INT (8), operands[2]));
7306 (define_expand "builtin_extwl"
7307 [(match_operand:DI 0 "register_operand" "")
7308 (match_operand:DI 1 "reg_or_0_operand" "")
7309 (match_operand:DI 2 "reg_or_8bit_operand" "")]
7312 rtx (*gen) (rtx, rtx, rtx, rtx);
7313 if (WORDS_BIG_ENDIAN)
7317 emit_insn ((*gen) (operands[0], operands[1], GEN_INT (16), operands[2]));
7321 (define_expand "builtin_extll"
7322 [(match_operand:DI 0 "register_operand" "")
7323 (match_operand:DI 1 "reg_or_0_operand" "")
7324 (match_operand:DI 2 "reg_or_8bit_operand" "")]
7327 rtx (*gen) (rtx, rtx, rtx, rtx);
7328 if (WORDS_BIG_ENDIAN)
7332 emit_insn ((*gen) (operands[0], operands[1], GEN_INT (32), operands[2]));
7336 (define_expand "builtin_extql"
7337 [(match_operand:DI 0 "register_operand" "")
7338 (match_operand:DI 1 "reg_or_0_operand" "")
7339 (match_operand:DI 2 "reg_or_8bit_operand" "")]
7342 rtx (*gen) (rtx, rtx, rtx, rtx);
7343 if (WORDS_BIG_ENDIAN)
7347 emit_insn ((*gen) (operands[0], operands[1], GEN_INT (64), operands[2]));
7351 (define_expand "builtin_extwh"
7352 [(match_operand:DI 0 "register_operand" "")
7353 (match_operand:DI 1 "reg_or_0_operand" "")
7354 (match_operand:DI 2 "reg_or_8bit_operand" "")]
7357 rtx (*gen) (rtx, rtx, rtx);
7358 if (WORDS_BIG_ENDIAN)
7362 emit_insn ((*gen) (operands[0], operands[1], operands[2]));
7366 (define_expand "builtin_extlh"
7367 [(match_operand:DI 0 "register_operand" "")
7368 (match_operand:DI 1 "reg_or_0_operand" "")
7369 (match_operand:DI 2 "reg_or_8bit_operand" "")]
7372 rtx (*gen) (rtx, rtx, rtx);
7373 if (WORDS_BIG_ENDIAN)
7377 emit_insn ((*gen) (operands[0], operands[1], operands[2]));
7381 (define_expand "builtin_extqh"
7382 [(match_operand:DI 0 "register_operand" "")
7383 (match_operand:DI 1 "reg_or_0_operand" "")
7384 (match_operand:DI 2 "reg_or_8bit_operand" "")]
7387 rtx (*gen) (rtx, rtx, rtx);
7388 if (WORDS_BIG_ENDIAN)
7392 emit_insn ((*gen) (operands[0], operands[1], operands[2]));
7396 (define_expand "builtin_insbl"
7397 [(match_operand:DI 0 "register_operand" "")
7398 (match_operand:DI 1 "register_operand" "")
7399 (match_operand:DI 2 "reg_or_8bit_operand" "")]
7402 rtx (*gen) (rtx, rtx, rtx);
7403 if (WORDS_BIG_ENDIAN)
7407 operands[1] = gen_lowpart (QImode, operands[1]);
7408 emit_insn ((*gen) (operands[0], operands[1], operands[2]));
7412 (define_expand "builtin_inswl"
7413 [(match_operand:DI 0 "register_operand" "")
7414 (match_operand:DI 1 "register_operand" "")
7415 (match_operand:DI 2 "reg_or_8bit_operand" "")]
7418 rtx (*gen) (rtx, rtx, rtx);
7419 if (WORDS_BIG_ENDIAN)
7423 operands[1] = gen_lowpart (HImode, operands[1]);
7424 emit_insn ((*gen) (operands[0], operands[1], operands[2]));
7428 (define_expand "builtin_insll"
7429 [(match_operand:DI 0 "register_operand" "")
7430 (match_operand:DI 1 "register_operand" "")
7431 (match_operand:DI 2 "reg_or_8bit_operand" "")]
7434 rtx (*gen) (rtx, rtx, rtx);
7435 if (WORDS_BIG_ENDIAN)
7439 operands[1] = gen_lowpart (SImode, operands[1]);
7440 emit_insn ((*gen) (operands[0], operands[1], operands[2]));
7441 emit_insn ((*gen) (operands[0], operands[1], operands[2]));
7445 (define_expand "builtin_insql"
7446 [(match_operand:DI 0 "register_operand" "")
7447 (match_operand:DI 1 "reg_or_0_operand" "")
7448 (match_operand:DI 2 "reg_or_8bit_operand" "")]
7451 rtx (*gen) (rtx, rtx, rtx);
7452 if (WORDS_BIG_ENDIAN)
7456 emit_insn ((*gen) (operands[0], operands[1], operands[2]));
7460 (define_expand "builtin_inswh"
7461 [(match_operand:DI 0 "register_operand" "")
7462 (match_operand:DI 1 "register_operand" "")
7463 (match_operand:DI 2 "reg_or_8bit_operand" "")]
7466 emit_insn (gen_insxh (operands[0], operands[1], GEN_INT (16), operands[2]));
7470 (define_expand "builtin_inslh"
7471 [(match_operand:DI 0 "register_operand" "")
7472 (match_operand:DI 1 "register_operand" "")
7473 (match_operand:DI 2 "reg_or_8bit_operand" "")]
7476 emit_insn (gen_insxh (operands[0], operands[1], GEN_INT (32), operands[2]));
7480 (define_expand "builtin_insqh"
7481 [(match_operand:DI 0 "register_operand" "")
7482 (match_operand:DI 1 "register_operand" "")
7483 (match_operand:DI 2 "reg_or_8bit_operand" "")]
7486 emit_insn (gen_insxh (operands[0], operands[1], GEN_INT (64), operands[2]));
7490 (define_expand "builtin_mskbl"
7491 [(match_operand:DI 0 "register_operand" "")
7492 (match_operand:DI 1 "reg_or_0_operand" "")
7493 (match_operand:DI 2 "reg_or_8bit_operand" "")]
7496 rtx (*gen) (rtx, rtx, rtx, rtx);
7498 if (WORDS_BIG_ENDIAN)
7502 mask = GEN_INT (0xff);
7503 emit_insn ((*gen) (operands[0], operands[1], mask, operands[2]));
7507 (define_expand "builtin_mskwl"
7508 [(match_operand:DI 0 "register_operand" "")
7509 (match_operand:DI 1 "reg_or_0_operand" "")
7510 (match_operand:DI 2 "reg_or_8bit_operand" "")]
7513 rtx (*gen) (rtx, rtx, rtx, rtx);
7515 if (WORDS_BIG_ENDIAN)
7519 mask = GEN_INT (0xffff);
7520 emit_insn ((*gen) (operands[0], operands[1], mask, operands[2]));
7524 (define_expand "builtin_mskll"
7525 [(match_operand:DI 0 "register_operand" "")
7526 (match_operand:DI 1 "reg_or_0_operand" "")
7527 (match_operand:DI 2 "reg_or_8bit_operand" "")]
7530 rtx (*gen) (rtx, rtx, rtx, rtx);
7532 if (WORDS_BIG_ENDIAN)
7536 mask = immed_double_const (0xffffffff, 0, DImode);
7537 emit_insn ((*gen) (operands[0], operands[1], mask, operands[2]));
7541 (define_expand "builtin_mskql"
7542 [(match_operand:DI 0 "register_operand" "")
7543 (match_operand:DI 1 "reg_or_0_operand" "")
7544 (match_operand:DI 2 "reg_or_8bit_operand" "")]
7547 rtx (*gen) (rtx, rtx, rtx, rtx);
7549 if (WORDS_BIG_ENDIAN)
7554 emit_insn ((*gen) (operands[0], operands[1], mask, operands[2]));
7558 (define_expand "builtin_mskwh"
7559 [(match_operand:DI 0 "register_operand" "")
7560 (match_operand:DI 1 "register_operand" "")
7561 (match_operand:DI 2 "reg_or_8bit_operand" "")]
7564 emit_insn (gen_mskxh (operands[0], operands[1], GEN_INT (16), operands[2]));
7568 (define_expand "builtin_msklh"
7569 [(match_operand:DI 0 "register_operand" "")
7570 (match_operand:DI 1 "register_operand" "")
7571 (match_operand:DI 2 "reg_or_8bit_operand" "")]
7574 emit_insn (gen_mskxh (operands[0], operands[1], GEN_INT (32), operands[2]));
7578 (define_expand "builtin_mskqh"
7579 [(match_operand:DI 0 "register_operand" "")
7580 (match_operand:DI 1 "register_operand" "")
7581 (match_operand:DI 2 "reg_or_8bit_operand" "")]
7584 emit_insn (gen_mskxh (operands[0], operands[1], GEN_INT (64), operands[2]));
7588 (define_expand "builtin_zap"
7589 [(set (match_operand:DI 0 "register_operand" "")
7591 [(match_operand:DI 2 "reg_or_cint_operand" "")]
7593 (match_operand:DI 1 "reg_or_cint_operand" "")))]
7596 if (GET_CODE (operands[2]) == CONST_INT)
7598 rtx mask = alpha_expand_zap_mask (INTVAL (operands[2]));
7600 if (mask == const0_rtx)
7602 emit_move_insn (operands[0], const0_rtx);
7605 if (mask == constm1_rtx)
7607 emit_move_insn (operands[0], operands[1]);
7611 operands[1] = force_reg (DImode, operands[1]);
7612 emit_insn (gen_anddi3 (operands[0], operands[1], mask));
7616 operands[1] = force_reg (DImode, operands[1]);
7617 operands[2] = gen_lowpart (QImode, operands[2]);
7620 (define_insn "*builtin_zap_1"
7621 [(set (match_operand:DI 0 "register_operand" "=r,r,r,r")
7623 [(match_operand:QI 2 "reg_or_cint_operand" "n,n,r,r")]
7625 (match_operand:DI 1 "reg_or_cint_operand" "n,r,J,r")))]
7632 [(set_attr "type" "shift,shift,ilog,shift")])
7635 [(set (match_operand:DI 0 "register_operand" "")
7637 [(match_operand:QI 2 "const_int_operand" "")]
7639 (match_operand:DI 1 "const_int_operand" "")))]
7643 rtx mask = alpha_expand_zap_mask (INTVAL (operands[2]));
7644 if (HOST_BITS_PER_WIDE_INT >= 64 || GET_CODE (mask) == CONST_INT)
7645 operands[1] = gen_int_mode (INTVAL (operands[1]) & INTVAL (mask), DImode);
7648 HOST_WIDE_INT c_lo = INTVAL (operands[1]);
7649 HOST_WIDE_INT c_hi = (c_lo < 0 ? -1 : 0);
7650 operands[1] = immed_double_const (c_lo & CONST_DOUBLE_LOW (mask),
7651 c_hi & CONST_DOUBLE_HIGH (mask),
7654 emit_move_insn (operands[0], operands[1]);
7659 [(set (match_operand:DI 0 "register_operand" "")
7661 [(match_operand:QI 2 "const_int_operand" "")]
7663 (match_operand:DI 1 "register_operand" "")))]
7666 (and:DI (match_dup 1) (match_dup 2)))]
7668 operands[2] = alpha_expand_zap_mask (INTVAL (operands[2]));
7669 if (operands[2] == const0_rtx)
7671 emit_move_insn (operands[0], const0_rtx);
7674 if (operands[2] == constm1_rtx)
7676 emit_move_insn (operands[0], operands[1]);
7681 (define_expand "builtin_zapnot"
7682 [(set (match_operand:DI 0 "register_operand" "")
7684 [(not:QI (match_operand:DI 2 "reg_or_cint_operand" ""))]
7686 (match_operand:DI 1 "reg_or_cint_operand" "")))]
7689 if (GET_CODE (operands[2]) == CONST_INT)
7691 rtx mask = alpha_expand_zap_mask (~ INTVAL (operands[2]));
7693 if (mask == const0_rtx)
7695 emit_move_insn (operands[0], const0_rtx);
7698 if (mask == constm1_rtx)
7700 emit_move_insn (operands[0], operands[1]);
7704 operands[1] = force_reg (DImode, operands[1]);
7705 emit_insn (gen_anddi3 (operands[0], operands[1], mask));
7709 operands[1] = force_reg (DImode, operands[1]);
7710 operands[2] = gen_lowpart (QImode, operands[2]);
7713 (define_insn "*builtin_zapnot_1"
7714 [(set (match_operand:DI 0 "register_operand" "=r")
7716 [(not:QI (match_operand:QI 2 "register_operand" "r"))]
7718 (match_operand:DI 1 "reg_or_0_operand" "rJ")))]
7721 [(set_attr "type" "shift")])
7723 (define_insn "builtin_amask"
7724 [(set (match_operand:DI 0 "register_operand" "=r")
7725 (unspec:DI [(match_operand:DI 1 "reg_or_8bit_operand" "rI")]
7729 [(set_attr "type" "ilog")])
7731 (define_insn "builtin_implver"
7732 [(set (match_operand:DI 0 "register_operand" "=r")
7733 (unspec:DI [(const_int 0)] UNSPEC_IMPLVER))]
7736 [(set_attr "type" "ilog")])
7738 (define_insn "builtin_rpcc"
7739 [(set (match_operand:DI 0 "register_operand" "=r")
7740 (unspec_volatile:DI [(const_int 0)] UNSPECV_RPCC))]
7743 [(set_attr "type" "ilog")])
7745 (define_expand "builtin_minub8"
7746 [(match_operand:DI 0 "register_operand" "")
7747 (match_operand:DI 1 "reg_or_0_operand" "")
7748 (match_operand:DI 2 "reg_or_0_operand" "")]
7751 alpha_expand_builtin_vector_binop (gen_uminv8qi3, V8QImode, operands[0],
7752 operands[1], operands[2]);
7756 (define_expand "builtin_minsb8"
7757 [(match_operand:DI 0 "register_operand" "")
7758 (match_operand:DI 1 "reg_or_0_operand" "")
7759 (match_operand:DI 2 "reg_or_0_operand" "")]
7762 alpha_expand_builtin_vector_binop (gen_sminv8qi3, V8QImode, operands[0],
7763 operands[1], operands[2]);
7767 (define_expand "builtin_minuw4"
7768 [(match_operand:DI 0 "register_operand" "")
7769 (match_operand:DI 1 "reg_or_0_operand" "")
7770 (match_operand:DI 2 "reg_or_0_operand" "")]
7773 alpha_expand_builtin_vector_binop (gen_uminv4hi3, V4HImode, operands[0],
7774 operands[1], operands[2]);
7778 (define_expand "builtin_minsw4"
7779 [(match_operand:DI 0 "register_operand" "")
7780 (match_operand:DI 1 "reg_or_0_operand" "")
7781 (match_operand:DI 2 "reg_or_0_operand" "")]
7784 alpha_expand_builtin_vector_binop (gen_sminv4hi3, V4HImode, operands[0],
7785 operands[1], operands[2]);
7789 (define_expand "builtin_maxub8"
7790 [(match_operand:DI 0 "register_operand" "")
7791 (match_operand:DI 1 "reg_or_0_operand" "")
7792 (match_operand:DI 2 "reg_or_0_operand" "")]
7795 alpha_expand_builtin_vector_binop (gen_umaxv8qi3, V8QImode, operands[0],
7796 operands[1], operands[2]);
7800 (define_expand "builtin_maxsb8"
7801 [(match_operand:DI 0 "register_operand" "")
7802 (match_operand:DI 1 "reg_or_0_operand" "")
7803 (match_operand:DI 2 "reg_or_0_operand" "")]
7806 alpha_expand_builtin_vector_binop (gen_smaxv8qi3, V8QImode, operands[0],
7807 operands[1], operands[2]);
7811 (define_expand "builtin_maxuw4"
7812 [(match_operand:DI 0 "register_operand" "")
7813 (match_operand:DI 1 "reg_or_0_operand" "")
7814 (match_operand:DI 2 "reg_or_0_operand" "")]
7817 alpha_expand_builtin_vector_binop (gen_umaxv4hi3, V4HImode, operands[0],
7818 operands[1], operands[2]);
7822 (define_expand "builtin_maxsw4"
7823 [(match_operand:DI 0 "register_operand" "")
7824 (match_operand:DI 1 "reg_or_0_operand" "")
7825 (match_operand:DI 2 "reg_or_0_operand" "")]
7828 alpha_expand_builtin_vector_binop (gen_smaxv4hi3, V4HImode, operands[0],
7829 operands[1], operands[2]);
7833 (define_insn "builtin_perr"
7834 [(set (match_operand:DI 0 "register_operand" "=r")
7835 (unspec:DI [(match_operand:DI 1 "reg_or_0_operand" "%rJ")
7836 (match_operand:DI 2 "reg_or_8bit_operand" "rJ")]
7840 [(set_attr "type" "mvi")])
7842 (define_expand "builtin_pklb"
7843 [(set (match_operand:DI 0 "register_operand" "")
7846 (truncate:V2QI (match_operand:DI 1 "register_operand" ""))
7851 operands[0] = gen_lowpart (V8QImode, operands[0]);
7852 operands[1] = gen_lowpart (V2SImode, operands[1]);
7853 operands[2] = CONST0_RTX (V2QImode);
7854 operands[3] = CONST0_RTX (V4QImode);
7857 (define_insn "*pklb"
7858 [(set (match_operand:V8QI 0 "register_operand" "=r")
7861 (truncate:V2QI (match_operand:V2SI 1 "register_operand" "r"))
7862 (match_operand:V2QI 2 "const0_operand" ""))
7863 (match_operand:V4QI 3 "const0_operand" "")))]
7866 [(set_attr "type" "mvi")])
7868 (define_expand "builtin_pkwb"
7869 [(set (match_operand:DI 0 "register_operand" "")
7871 (truncate:V4QI (match_operand:DI 1 "register_operand" ""))
7875 operands[0] = gen_lowpart (V8QImode, operands[0]);
7876 operands[1] = gen_lowpart (V4HImode, operands[1]);
7877 operands[2] = CONST0_RTX (V4QImode);
7880 (define_insn "*pkwb"
7881 [(set (match_operand:V8QI 0 "register_operand" "=r")
7883 (truncate:V4QI (match_operand:V4HI 1 "register_operand" "r"))
7884 (match_operand:V4QI 2 "const0_operand" "")))]
7887 [(set_attr "type" "mvi")])
7889 (define_expand "builtin_unpkbl"
7890 [(set (match_operand:DI 0 "register_operand" "")
7892 (vec_select:V2QI (match_operand:DI 1 "register_operand" "")
7893 (parallel [(const_int 0) (const_int 1)]))))]
7896 operands[0] = gen_lowpart (V2SImode, operands[0]);
7897 operands[1] = gen_lowpart (V8QImode, operands[1]);
7900 (define_insn "*unpkbl"
7901 [(set (match_operand:V2SI 0 "register_operand" "=r")
7903 (vec_select:V2QI (match_operand:V8QI 1 "reg_or_0_operand" "rW")
7904 (parallel [(const_int 0) (const_int 1)]))))]
7907 [(set_attr "type" "mvi")])
7909 (define_expand "builtin_unpkbw"
7910 [(set (match_operand:DI 0 "register_operand" "")
7912 (vec_select:V4QI (match_operand:DI 1 "register_operand" "")
7913 (parallel [(const_int 0)
7919 operands[0] = gen_lowpart (V4HImode, operands[0]);
7920 operands[1] = gen_lowpart (V8QImode, operands[1]);
7923 (define_insn "*unpkbw"
7924 [(set (match_operand:V4HI 0 "register_operand" "=r")
7926 (vec_select:V4QI (match_operand:V8QI 1 "reg_or_0_operand" "rW")
7927 (parallel [(const_int 0)
7933 [(set_attr "type" "mvi")])
7937 ;; The call patterns are at the end of the file because their
7938 ;; wildcard operand0 interferes with nice recognition.
7940 (define_insn "*call_value_osf_1_er_noreturn"
7941 [(set (match_operand 0 "" "")
7942 (call (mem:DI (match_operand:DI 1 "call_operand" "c,R,s"))
7943 (match_operand 2 "" "")))
7945 (clobber (reg:DI 26))]
7946 "TARGET_EXPLICIT_RELOCS && TARGET_ABI_OSF
7947 && find_reg_note (insn, REG_NORETURN, NULL_RTX)"
7950 bsr $26,%1\t\t!samegp
7951 ldq $27,%1($29)\t\t!literal!%#\;jsr $26,($27),%1\t\t!lituse_jsr!%#"
7952 [(set_attr "type" "jsr")
7953 (set_attr "length" "*,*,8")])
7955 (define_insn "*call_value_osf_1_er"
7956 [(set (match_operand 0 "" "")
7957 (call (mem:DI (match_operand:DI 1 "call_operand" "c,R,s"))
7958 (match_operand 2 "" "")))
7960 (clobber (reg:DI 26))]
7961 "TARGET_EXPLICIT_RELOCS && TARGET_ABI_OSF"
7963 jsr $26,(%1),0\;ldah $29,0($26)\t\t!gpdisp!%*\;lda $29,0($29)\t\t!gpdisp!%*
7964 bsr $26,%1\t\t!samegp
7965 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!%*"
7966 [(set_attr "type" "jsr")
7967 (set_attr "length" "12,*,16")])
7969 ;; We must use peep2 instead of a split because we need accurate life
7970 ;; information for $gp. Consider the case of { bar(); while (1); }.
7972 [(parallel [(set (match_operand 0 "" "")
7973 (call (mem:DI (match_operand:DI 1 "call_operand" ""))
7974 (match_operand 2 "" "")))
7976 (clobber (reg:DI 26))])]
7977 "TARGET_EXPLICIT_RELOCS && TARGET_ABI_OSF && reload_completed
7978 && ! samegp_function_operand (operands[1], Pmode)
7979 && (peep2_regno_dead_p (1, 29)
7980 || find_reg_note (insn, REG_NORETURN, NULL_RTX))"
7981 [(parallel [(set (match_dup 0)
7982 (call (mem:DI (match_dup 3))
7987 (clobber (reg:DI 26))])]
7989 if (CONSTANT_P (operands[1]))
7991 operands[3] = gen_rtx_REG (Pmode, 27);
7992 operands[4] = GEN_INT (alpha_next_sequence_number++);
7993 emit_insn (gen_movdi_er_high_g (operands[3], pic_offset_table_rtx,
7994 operands[1], operands[4]));
7998 operands[3] = operands[1];
7999 operands[1] = const0_rtx;
8000 operands[4] = const0_rtx;
8005 [(parallel [(set (match_operand 0 "" "")
8006 (call (mem:DI (match_operand:DI 1 "call_operand" ""))
8007 (match_operand 2 "" "")))
8009 (clobber (reg:DI 26))])]
8010 "TARGET_EXPLICIT_RELOCS && TARGET_ABI_OSF && reload_completed
8011 && ! samegp_function_operand (operands[1], Pmode)
8012 && ! (peep2_regno_dead_p (1, 29)
8013 || find_reg_note (insn, REG_NORETURN, NULL_RTX))"
8014 [(parallel [(set (match_dup 0)
8015 (call (mem:DI (match_dup 3))
8018 (unspec:DI [(match_dup 6) (match_dup 4)] UNSPEC_LDGP1))
8021 (clobber (reg:DI 26))])
8023 (unspec:DI [(match_dup 6) (match_dup 4)] UNSPEC_LDGP2))]
8025 if (CONSTANT_P (operands[1]))
8027 operands[3] = gen_rtx_REG (Pmode, 27);
8028 operands[5] = GEN_INT (alpha_next_sequence_number++);
8029 emit_insn (gen_movdi_er_high_g (operands[3], pic_offset_table_rtx,
8030 operands[1], operands[5]));
8034 operands[3] = operands[1];
8035 operands[1] = const0_rtx;
8036 operands[5] = const0_rtx;
8038 operands[4] = GEN_INT (alpha_next_sequence_number++);
8039 operands[6] = pic_offset_table_rtx;
8042 (define_insn "*call_value_osf_2_er_nogp"
8043 [(set (match_operand 0 "" "")
8044 (call (mem:DI (match_operand:DI 1 "register_operand" "c"))
8045 (match_operand 2 "" "")))
8047 (use (match_operand 3 "" ""))
8048 (use (match_operand 4 "" ""))
8049 (clobber (reg:DI 26))]
8050 "TARGET_EXPLICIT_RELOCS && TARGET_ABI_OSF"
8051 "jsr $26,(%1),%3%J4"
8052 [(set_attr "type" "jsr")])
8054 (define_insn "*call_value_osf_2_er"
8055 [(set (match_operand 0 "" "")
8056 (call (mem:DI (match_operand:DI 1 "register_operand" "c"))
8057 (match_operand 2 "" "")))
8059 (unspec:DI [(reg:DI 29) (match_operand 5 "const_int_operand" "")]
8061 (use (match_operand 3 "" ""))
8062 (use (match_operand 4 "" ""))
8063 (clobber (reg:DI 26))]
8064 "TARGET_EXPLICIT_RELOCS && TARGET_ABI_OSF"
8065 "jsr $26,(%1),%3%J4\;ldah $29,0($26)\t\t!gpdisp!%5"
8066 [(set_attr "type" "jsr")
8067 (set_attr "cannot_copy" "true")
8068 (set_attr "length" "8")])
8070 (define_insn "*call_value_osf_1_noreturn"
8071 [(set (match_operand 0 "" "")
8072 (call (mem:DI (match_operand:DI 1 "call_operand" "c,R,s"))
8073 (match_operand 2 "" "")))
8075 (clobber (reg:DI 26))]
8076 "! TARGET_EXPLICIT_RELOCS && TARGET_ABI_OSF
8077 && find_reg_note (insn, REG_NORETURN, NULL_RTX)"
8082 [(set_attr "type" "jsr")
8083 (set_attr "length" "*,*,8")])
8085 (define_insn_and_split "call_value_osf_tlsgd"
8086 [(set (match_operand 0 "" "")
8087 (call (mem:DI (match_operand:DI 1 "symbolic_operand" ""))
8089 (unspec [(match_operand:DI 2 "const_int_operand" "")] UNSPEC_TLSGD_CALL)
8091 (clobber (reg:DI 26))]
8094 "&& reload_completed"
8096 (unspec:DI [(match_dup 5)
8098 (match_dup 2)] UNSPEC_LITERAL))
8099 (parallel [(set (match_dup 0)
8100 (call (mem:DI (match_dup 3))
8103 (unspec:DI [(match_dup 5) (match_dup 4)] UNSPEC_LDGP1))
8105 (use (unspec [(match_dup 2)] UNSPEC_TLSGD_CALL))
8106 (clobber (reg:DI 26))])
8108 (unspec:DI [(match_dup 5) (match_dup 4)] UNSPEC_LDGP2))]
8110 operands[3] = gen_rtx_REG (Pmode, 27);
8111 operands[4] = GEN_INT (alpha_next_sequence_number++);
8112 operands[5] = pic_offset_table_rtx;
8114 [(set_attr "type" "multi")])
8116 (define_insn_and_split "call_value_osf_tlsldm"
8117 [(set (match_operand 0 "" "")
8118 (call (mem:DI (match_operand:DI 1 "symbolic_operand" ""))
8120 (unspec [(match_operand:DI 2 "const_int_operand" "")] UNSPEC_TLSLDM_CALL)
8122 (clobber (reg:DI 26))]
8125 "&& reload_completed"
8127 (unspec:DI [(match_dup 5)
8129 (match_dup 2)] UNSPEC_LITERAL))
8130 (parallel [(set (match_dup 0)
8131 (call (mem:DI (match_dup 3))
8134 (unspec:DI [(match_dup 5) (match_dup 4)] UNSPEC_LDGP1))
8136 (use (unspec [(match_dup 2)] UNSPEC_TLSLDM_CALL))
8137 (clobber (reg:DI 26))])
8139 (unspec:DI [(match_dup 5) (match_dup 4)] UNSPEC_LDGP2))]
8141 operands[3] = gen_rtx_REG (Pmode, 27);
8142 operands[4] = GEN_INT (alpha_next_sequence_number++);
8143 operands[5] = pic_offset_table_rtx;
8145 [(set_attr "type" "multi")])
8147 (define_insn "*call_value_osf_1"
8148 [(set (match_operand 0 "" "")
8149 (call (mem:DI (match_operand:DI 1 "call_operand" "c,R,s"))
8150 (match_operand 2 "" "")))
8152 (clobber (reg:DI 26))]
8153 "! TARGET_EXPLICIT_RELOCS && TARGET_ABI_OSF"
8155 jsr $26,($27),0\;ldgp $29,0($26)
8157 jsr $26,%1\;ldgp $29,0($26)"
8158 [(set_attr "type" "jsr")
8159 (set_attr "length" "12,*,16")])
8161 (define_insn "*sibcall_value_osf_1_er"
8162 [(set (match_operand 0 "" "")
8163 (call (mem:DI (match_operand:DI 1 "symbolic_operand" "R,s"))
8164 (match_operand 2 "" "")))
8165 (unspec [(reg:DI 29)] UNSPEC_SIBCALL)]
8166 "TARGET_EXPLICIT_RELOCS && TARGET_ABI_OSF"
8168 br $31,%1\t\t!samegp
8169 ldq $27,%1($29)\t\t!literal!%#\;jmp $31,($27),%1\t\t!lituse_jsr!%#"
8170 [(set_attr "type" "jsr")
8171 (set_attr "length" "*,8")])
8173 (define_insn "*sibcall_value_osf_1"
8174 [(set (match_operand 0 "" "")
8175 (call (mem:DI (match_operand:DI 1 "symbolic_operand" "R,s"))
8176 (match_operand 2 "" "")))
8177 (unspec [(reg:DI 29)] UNSPEC_SIBCALL)]
8178 "! TARGET_EXPLICIT_RELOCS && TARGET_ABI_OSF"
8181 lda $27,%1\;jmp $31,($27),%1"
8182 [(set_attr "type" "jsr")
8183 (set_attr "length" "*,8")])
8185 (define_insn "*call_value_nt_1"
8186 [(set (match_operand 0 "" "")
8187 (call (mem:DI (match_operand:DI 1 "call_operand" "r,R,s"))
8188 (match_operand 2 "" "")))
8189 (clobber (reg:DI 26))]
8190 "TARGET_ABI_WINDOWS_NT"
8195 [(set_attr "type" "jsr")
8196 (set_attr "length" "*,*,12")])
8198 ; GAS relies on the order and position of instructions output below in order
8199 ; to generate relocs for VMS link to potentially optimize the call.
8200 ; Please do not molest.
8201 (define_insn "*call_value_vms_1"
8202 [(set (match_operand 0 "" "")
8203 (call (mem:DI (match_operand:DI 1 "call_operand" "r,s"))
8204 (match_operand 2 "" "")))
8205 (use (match_operand:DI 3 "nonmemory_operand" "r,n"))
8208 (clobber (reg:DI 27))]
8209 "TARGET_ABI_OPEN_VMS"
8211 switch (which_alternative)
8214 return "mov %3,$27\;jsr $26,0\;ldq $27,0($29)";
8216 operands [3] = alpha_use_linkage (operands [1], cfun->decl, 1, 0);
8217 operands [4] = alpha_use_linkage (operands [1], cfun->decl, 0, 0);
8218 return "ldq $26,%4\;ldq $27,%3\;jsr $26,%1\;ldq $27,0($29)";
8223 [(set_attr "type" "jsr")
8224 (set_attr "length" "12,16")])
8226 (define_insn "*call_value_umk"
8227 [(set (match_operand 0 "" "")
8228 (call (mem:DI (match_operand:DI 1 "call_operand" "r"))
8229 (match_operand 2 "" "")))
8231 (clobber (reg:DI 26))]
8232 "TARGET_ABI_UNICOSMK"
8234 [(set_attr "type" "jsr")])