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 3, 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 COPYING3. If not see
20 ;; <http://www.gnu.org/licenses/>.
22 ;;- See file "rtl.def" for documentation on define_insn, match_*, et. al.
24 ;; Uses of UNSPEC in this file:
36 (UNSPEC_UMK_LOAD_CIW 9)
44 (UNSPEC_TLSGD_CALL 15)
45 (UNSPEC_TLSLDM_CALL 16)
72 (UNSPECV_SETJMPR 2) ; builtin_setjmp_receiver
73 (UNSPECV_LONGJMP 3) ; builtin_longjmp
75 (UNSPECV_PSPL 5) ; prologue_stack_probe_loop
77 (UNSPECV_EHR 7) ; exception_receiver
81 (UNSPECV_PLDGP2 11) ; prologue ldgp
84 (UNSPECV_SETJMPR_ER 14) ; builtin_setjmp_receiver fragment
85 (UNSPECV_LL 15) ; load-locked
86 (UNSPECV_SC 16) ; store-conditional
89 ;; On non-BWX targets, CQImode must be handled the similarly to HImode
90 ;; when generating reloads.
91 (define_mode_iterator RELOAD12 [QI HI CQI])
92 (define_mode_attr reloadmode [(QI "qi") (HI "hi") (CQI "hi")])
94 ;; Other mode iterators
95 (define_mode_iterator I12MODE [QI HI])
96 (define_mode_iterator I48MODE [SI DI])
97 (define_mode_attr modesuffix [(SI "l") (DI "q")])
99 ;; Where necessary, the suffixes _le and _be are used to distinguish between
100 ;; little-endian and big-endian patterns.
102 ;; Note that the Unicos/Mk assembler does not support the following
103 ;; opcodes: mov, fmov, nop, fnop, unop.
105 ;; Processor type -- this attribute must exactly match the processor_type
106 ;; enumeration in alpha.h.
108 (define_attr "tune" "ev4,ev5,ev6"
109 (const (symbol_ref "alpha_tune")))
111 ;; Define an insn type attribute. This is used in function unit delay
112 ;; computations, among other purposes. For the most part, we use the names
113 ;; defined in the EV4 documentation, but add a few that we have to know about
117 "ild,fld,ldsym,ist,fst,ibr,callpal,fbr,jsr,iadd,ilog,shift,icmov,fcmov,
118 icmp,imul,fadd,fmul,fcpys,fdiv,fsqrt,misc,mvi,ftoi,itof,mb,ld_l,st_c,
120 (const_string "iadd"))
122 ;; Describe a user's asm statement.
123 (define_asm_attributes
124 [(set_attr "type" "multi")])
126 ;; Define the operand size an insn operates on. Used primarily by mul
127 ;; and div operations that have size dependent timings.
129 (define_attr "opsize" "si,di,udi"
132 ;; The TRAP attribute marks instructions that may generate traps
133 ;; (which are imprecise and may need a trapb if software completion
136 (define_attr "trap" "no,yes"
139 ;; The ROUND_SUFFIX attribute marks which instructions require a
140 ;; rounding-mode suffix. The value NONE indicates no suffix,
141 ;; the value NORMAL indicates a suffix controlled by alpha_fprm.
143 (define_attr "round_suffix" "none,normal,c"
144 (const_string "none"))
146 ;; The TRAP_SUFFIX attribute marks instructions requiring a trap-mode suffix:
148 ;; SU accepts only /su (cmpt et al)
149 ;; SUI accepts only /sui (cvtqt and cvtqs)
150 ;; V_SV accepts /v and /sv (cvtql only)
151 ;; V_SV_SVI accepts /v, /sv and /svi (cvttq only)
152 ;; U_SU_SUI accepts /u, /su and /sui (most fp instructions)
154 ;; The actual suffix emitted is controlled by alpha_fptm.
156 (define_attr "trap_suffix" "none,su,sui,v_sv,v_sv_svi,u_su_sui"
157 (const_string "none"))
159 ;; The length of an instruction sequence in bytes.
161 (define_attr "length" ""
164 ;; The USEGP attribute marks instructions that have relocations that use
167 (define_attr "usegp" "no,yes"
168 (cond [(eq_attr "type" "ldsym,jsr")
170 (eq_attr "type" "ild,fld,ist,fst")
171 (symbol_ref "alpha_find_lo_sum_using_gp(insn)")
173 (const_string "no")))
175 ;; The CANNOT_COPY attribute marks instructions with relocations that
176 ;; cannot easily be duplicated. This includes insns with gpdisp relocs
177 ;; since they have to stay in 1-1 correspondence with one another. This
178 ;; also includes jsr insns, since they must stay in correspondence with
179 ;; the immediately following gpdisp instructions.
181 (define_attr "cannot_copy" "false,true"
182 (const_string "false"))
184 ;; Include scheduling descriptions.
191 ;; Operand and operator predicates and constraints
193 (include "predicates.md")
194 (include "constraints.md")
197 ;; First define the arithmetic insns. Note that the 32-bit forms also
200 ;; Handle 32-64 bit extension from memory to a floating point register
201 ;; specially, since this occurs frequently in int->double conversions.
203 ;; Note that while we must retain the =f case in the insn for reload's
204 ;; benefit, it should be eliminated after reload, so we should never emit
205 ;; code for that case. But we don't reject the possibility.
207 (define_expand "extendsidi2"
208 [(set (match_operand:DI 0 "register_operand" "")
209 (sign_extend:DI (match_operand:SI 1 "nonimmediate_operand" "")))]
213 (define_insn "*cvtlq"
214 [(set (match_operand:DI 0 "register_operand" "=f")
215 (unspec:DI [(match_operand:SF 1 "reg_or_0_operand" "fG")]
219 [(set_attr "type" "fadd")])
221 (define_insn "*extendsidi2_1"
222 [(set (match_operand:DI 0 "register_operand" "=r,r,!*f")
224 (match_operand:SI 1 "nonimmediate_operand" "r,m,m")))]
229 lds %0,%1\;cvtlq %0,%0"
230 [(set_attr "type" "iadd,ild,fld")
231 (set_attr "length" "*,*,8")])
234 [(set (match_operand:DI 0 "hard_fp_register_operand" "")
235 (sign_extend:DI (match_operand:SI 1 "memory_operand" "")))]
237 [(set (match_dup 2) (match_dup 1))
238 (set (match_dup 0) (unspec:DI [(match_dup 2)] UNSPEC_CVTLQ))]
240 operands[1] = adjust_address (operands[1], SFmode, 0);
241 operands[2] = gen_rtx_REG (SFmode, REGNO (operands[0]));
244 ;; Optimize sign-extension of SImode loads. This shows up in the wake of
245 ;; reload when converting fp->int.
248 [(set (match_operand:SI 0 "hard_int_register_operand" "")
249 (match_operand:SI 1 "memory_operand" ""))
250 (set (match_operand:DI 2 "hard_int_register_operand" "")
251 (sign_extend:DI (match_dup 0)))]
252 "true_regnum (operands[0]) == true_regnum (operands[2])
253 || peep2_reg_dead_p (2, operands[0])"
255 (sign_extend:DI (match_dup 1)))]
258 ;; Don't say we have addsi3 if optimizing. This generates better code. We
259 ;; have the anonymous addsi3 pattern below in case combine wants to make it.
260 (define_expand "addsi3"
261 [(set (match_operand:SI 0 "register_operand" "")
262 (plus:SI (match_operand:SI 1 "reg_or_0_operand" "")
263 (match_operand:SI 2 "add_operand" "")))]
267 (define_insn "*addsi_internal"
268 [(set (match_operand:SI 0 "register_operand" "=r,r,r,r")
269 (plus:SI (match_operand:SI 1 "reg_or_0_operand" "%rJ,rJ,rJ,rJ")
270 (match_operand:SI 2 "add_operand" "rI,O,K,L")))]
279 [(set (match_operand:SI 0 "register_operand" "")
280 (plus:SI (match_operand:SI 1 "register_operand" "")
281 (match_operand:SI 2 "const_int_operand" "")))]
282 "! add_operand (operands[2], SImode)"
283 [(set (match_dup 0) (plus:SI (match_dup 1) (match_dup 3)))
284 (set (match_dup 0) (plus:SI (match_dup 0) (match_dup 4)))]
286 HOST_WIDE_INT val = INTVAL (operands[2]);
287 HOST_WIDE_INT low = (val & 0xffff) - 2 * (val & 0x8000);
288 HOST_WIDE_INT rest = val - low;
290 operands[3] = GEN_INT (rest);
291 operands[4] = GEN_INT (low);
294 (define_insn "*addsi_se"
295 [(set (match_operand:DI 0 "register_operand" "=r,r")
297 (plus:SI (match_operand:SI 1 "reg_or_0_operand" "%rJ,rJ")
298 (match_operand:SI 2 "sext_add_operand" "rI,O"))))]
304 (define_insn "*addsi_se2"
305 [(set (match_operand:DI 0 "register_operand" "=r,r")
307 (subreg:SI (plus:DI (match_operand:DI 1 "reg_or_0_operand" "%rJ,rJ")
308 (match_operand:DI 2 "sext_add_operand" "rI,O"))
316 [(set (match_operand:DI 0 "register_operand" "")
318 (plus:SI (match_operand:SI 1 "reg_not_elim_operand" "")
319 (match_operand:SI 2 "const_int_operand" ""))))
320 (clobber (match_operand:SI 3 "reg_not_elim_operand" ""))]
321 "! sext_add_operand (operands[2], SImode) && INTVAL (operands[2]) > 0
322 && INTVAL (operands[2]) % 4 == 0"
323 [(set (match_dup 3) (match_dup 4))
324 (set (match_dup 0) (sign_extend:DI (plus:SI (mult:SI (match_dup 3)
328 HOST_WIDE_INT val = INTVAL (operands[2]) / 4;
334 operands[4] = GEN_INT (val);
335 operands[5] = GEN_INT (mult);
339 [(set (match_operand:DI 0 "register_operand" "")
341 (plus:SI (match_operator:SI 1 "comparison_operator"
342 [(match_operand 2 "" "")
343 (match_operand 3 "" "")])
344 (match_operand:SI 4 "add_operand" ""))))
345 (clobber (match_operand:DI 5 "register_operand" ""))]
347 [(set (match_dup 5) (match_dup 6))
348 (set (match_dup 0) (sign_extend:DI (plus:SI (match_dup 7) (match_dup 4))))]
350 operands[6] = gen_rtx_fmt_ee (GET_CODE (operands[1]), DImode,
351 operands[2], operands[3]);
352 operands[7] = gen_lowpart (SImode, operands[5]);
355 (define_insn "addvsi3"
356 [(set (match_operand:SI 0 "register_operand" "=r,r")
357 (plus:SI (match_operand:SI 1 "reg_or_0_operand" "%rJ,rJ")
358 (match_operand:SI 2 "sext_add_operand" "rI,O")))
359 (trap_if (ne (plus:DI (sign_extend:DI (match_dup 1))
360 (sign_extend:DI (match_dup 2)))
361 (sign_extend:DI (plus:SI (match_dup 1)
369 (define_expand "adddi3"
370 [(set (match_operand:DI 0 "register_operand" "")
371 (plus:DI (match_operand:DI 1 "register_operand" "")
372 (match_operand:DI 2 "add_operand" "")))]
376 (define_insn "*adddi_er_lo16_dtp"
377 [(set (match_operand:DI 0 "register_operand" "=r")
378 (lo_sum:DI (match_operand:DI 1 "register_operand" "r")
379 (match_operand:DI 2 "dtp16_symbolic_operand" "")))]
381 "lda %0,%2(%1)\t\t!dtprel")
383 (define_insn "*adddi_er_hi32_dtp"
384 [(set (match_operand:DI 0 "register_operand" "=r")
385 (plus:DI (match_operand:DI 1 "register_operand" "r")
386 (high:DI (match_operand:DI 2 "dtp32_symbolic_operand" ""))))]
388 "ldah %0,%2(%1)\t\t!dtprelhi")
390 (define_insn "*adddi_er_lo32_dtp"
391 [(set (match_operand:DI 0 "register_operand" "=r")
392 (lo_sum:DI (match_operand:DI 1 "register_operand" "r")
393 (match_operand:DI 2 "dtp32_symbolic_operand" "")))]
395 "lda %0,%2(%1)\t\t!dtprello")
397 (define_insn "*adddi_er_lo16_tp"
398 [(set (match_operand:DI 0 "register_operand" "=r")
399 (lo_sum:DI (match_operand:DI 1 "register_operand" "r")
400 (match_operand:DI 2 "tp16_symbolic_operand" "")))]
402 "lda %0,%2(%1)\t\t!tprel")
404 (define_insn "*adddi_er_hi32_tp"
405 [(set (match_operand:DI 0 "register_operand" "=r")
406 (plus:DI (match_operand:DI 1 "register_operand" "r")
407 (high:DI (match_operand:DI 2 "tp32_symbolic_operand" ""))))]
409 "ldah %0,%2(%1)\t\t!tprelhi")
411 (define_insn "*adddi_er_lo32_tp"
412 [(set (match_operand:DI 0 "register_operand" "=r")
413 (lo_sum:DI (match_operand:DI 1 "register_operand" "r")
414 (match_operand:DI 2 "tp32_symbolic_operand" "")))]
416 "lda %0,%2(%1)\t\t!tprello")
418 (define_insn "*adddi_er_high_l"
419 [(set (match_operand:DI 0 "register_operand" "=r")
420 (plus:DI (match_operand:DI 1 "register_operand" "r")
421 (high:DI (match_operand:DI 2 "local_symbolic_operand" ""))))]
422 "TARGET_EXPLICIT_RELOCS && reload_completed"
423 "ldah %0,%2(%1)\t\t!gprelhigh"
424 [(set_attr "usegp" "yes")])
427 [(set (match_operand:DI 0 "register_operand" "")
428 (high:DI (match_operand:DI 1 "local_symbolic_operand" "")))]
429 "TARGET_EXPLICIT_RELOCS && reload_completed"
431 (plus:DI (match_dup 2) (high:DI (match_dup 1))))]
432 "operands[2] = pic_offset_table_rtx;")
434 ;; We used to expend quite a lot of effort choosing addq/subq/lda.
435 ;; With complications like
437 ;; The NT stack unwind code can't handle a subq to adjust the stack
438 ;; (that's a bug, but not one we can do anything about). As of NT4.0 SP3,
439 ;; the exception handling code will loop if a subq is used and an
442 ;; The 19980616 change to emit prologues as RTL also confused some
443 ;; versions of GDB, which also interprets prologues. This has been
444 ;; fixed as of GDB 4.18, but it does not harm to unconditionally
447 ;; and the fact that the three insns schedule exactly the same, it's
448 ;; just not worth the effort.
450 (define_insn "*adddi_internal"
451 [(set (match_operand:DI 0 "register_operand" "=r,r,r")
452 (plus:DI (match_operand:DI 1 "register_operand" "%r,r,r")
453 (match_operand:DI 2 "add_operand" "r,K,L")))]
460 ;; ??? Allow large constants when basing off the frame pointer or some
461 ;; virtual register that may eliminate to the frame pointer. This is
462 ;; done because register elimination offsets will change the hi/lo split,
463 ;; and if we split before reload, we will require additional instructions.
465 (define_insn "*adddi_fp_hack"
466 [(set (match_operand:DI 0 "register_operand" "=r,r,r")
467 (plus:DI (match_operand:DI 1 "reg_no_subreg_operand" "r,r,r")
468 (match_operand:DI 2 "const_int_operand" "K,L,n")))]
469 "NONSTRICT_REG_OK_FP_BASE_P (operands[1])
470 && INTVAL (operands[2]) >= 0
471 /* This is the largest constant an lda+ldah pair can add, minus
472 an upper bound on the displacement between SP and AP during
473 register elimination. See INITIAL_ELIMINATION_OFFSET. */
474 && INTVAL (operands[2])
476 - FIRST_PSEUDO_REGISTER * UNITS_PER_WORD
477 - ALPHA_ROUND(crtl->outgoing_args_size)
478 - (ALPHA_ROUND (get_frame_size ()
479 + max_reg_num () * UNITS_PER_WORD
480 + crtl->args.pretend_args_size)
481 - crtl->args.pretend_args_size))"
487 ;; Don't do this if we are adjusting SP since we don't want to do it
488 ;; in two steps. Don't split FP sources for the reason listed above.
490 [(set (match_operand:DI 0 "register_operand" "")
491 (plus:DI (match_operand:DI 1 "register_operand" "")
492 (match_operand:DI 2 "const_int_operand" "")))]
493 "! add_operand (operands[2], DImode)
494 && operands[0] != stack_pointer_rtx
495 && operands[1] != frame_pointer_rtx
496 && operands[1] != arg_pointer_rtx"
497 [(set (match_dup 0) (plus:DI (match_dup 1) (match_dup 3)))
498 (set (match_dup 0) (plus:DI (match_dup 0) (match_dup 4)))]
500 HOST_WIDE_INT val = INTVAL (operands[2]);
501 HOST_WIDE_INT low = (val & 0xffff) - 2 * (val & 0x8000);
502 HOST_WIDE_INT rest = val - low;
503 rtx rest_rtx = GEN_INT (rest);
505 operands[4] = GEN_INT (low);
506 if (satisfies_constraint_L (rest_rtx))
507 operands[3] = rest_rtx;
508 else if (can_create_pseudo_p ())
510 operands[3] = gen_reg_rtx (DImode);
511 emit_move_insn (operands[3], operands[2]);
512 emit_insn (gen_adddi3 (operands[0], operands[1], operands[3]));
519 (define_insn "*saddl"
520 [(set (match_operand:SI 0 "register_operand" "=r,r")
521 (plus:SI (mult:SI (match_operand:SI 1 "reg_not_elim_operand" "r,r")
522 (match_operand:SI 2 "const48_operand" "I,I"))
523 (match_operand:SI 3 "sext_add_operand" "rI,O")))]
529 (define_insn "*saddl_se"
530 [(set (match_operand:DI 0 "register_operand" "=r,r")
532 (plus:SI (mult:SI (match_operand:SI 1 "reg_not_elim_operand" "r,r")
533 (match_operand:SI 2 "const48_operand" "I,I"))
534 (match_operand:SI 3 "sext_add_operand" "rI,O"))))]
541 [(set (match_operand:DI 0 "register_operand" "")
543 (plus:SI (mult:SI (match_operator:SI 1 "comparison_operator"
544 [(match_operand 2 "" "")
545 (match_operand 3 "" "")])
546 (match_operand:SI 4 "const48_operand" ""))
547 (match_operand:SI 5 "sext_add_operand" ""))))
548 (clobber (match_operand:DI 6 "reg_not_elim_operand" ""))]
550 [(set (match_dup 6) (match_dup 7))
552 (sign_extend:DI (plus:SI (mult:SI (match_dup 8) (match_dup 4))
555 operands[7] = gen_rtx_fmt_ee (GET_CODE (operands[1]), DImode,
556 operands[2], operands[3]);
557 operands[8] = gen_lowpart (SImode, operands[6]);
560 (define_insn "*saddq"
561 [(set (match_operand:DI 0 "register_operand" "=r,r")
562 (plus:DI (mult:DI (match_operand:DI 1 "reg_not_elim_operand" "r,r")
563 (match_operand:DI 2 "const48_operand" "I,I"))
564 (match_operand:DI 3 "sext_add_operand" "rI,O")))]
570 (define_insn "addvdi3"
571 [(set (match_operand:DI 0 "register_operand" "=r,r")
572 (plus:DI (match_operand:DI 1 "reg_or_0_operand" "%rJ,rJ")
573 (match_operand:DI 2 "sext_add_operand" "rI,O")))
574 (trap_if (ne (plus:TI (sign_extend:TI (match_dup 1))
575 (sign_extend:TI (match_dup 2)))
576 (sign_extend:TI (plus:DI (match_dup 1)
584 (define_insn "negsi2"
585 [(set (match_operand:SI 0 "register_operand" "=r")
586 (neg:SI (match_operand:SI 1 "reg_or_8bit_operand" "rI")))]
590 (define_insn "*negsi_se"
591 [(set (match_operand:DI 0 "register_operand" "=r")
592 (sign_extend:DI (neg:SI
593 (match_operand:SI 1 "reg_or_8bit_operand" "rI"))))]
597 (define_insn "negvsi2"
598 [(set (match_operand:SI 0 "register_operand" "=r")
599 (neg:SI (match_operand:SI 1 "register_operand" "r")))
600 (trap_if (ne (neg:DI (sign_extend:DI (match_dup 1)))
601 (sign_extend:DI (neg:SI (match_dup 1))))
606 (define_insn "negdi2"
607 [(set (match_operand:DI 0 "register_operand" "=r")
608 (neg:DI (match_operand:DI 1 "reg_or_8bit_operand" "rI")))]
612 (define_insn "negvdi2"
613 [(set (match_operand:DI 0 "register_operand" "=r")
614 (neg:DI (match_operand:DI 1 "register_operand" "r")))
615 (trap_if (ne (neg:TI (sign_extend:TI (match_dup 1)))
616 (sign_extend:TI (neg:DI (match_dup 1))))
621 (define_expand "subsi3"
622 [(set (match_operand:SI 0 "register_operand" "")
623 (minus:SI (match_operand:SI 1 "reg_or_0_operand" "")
624 (match_operand:SI 2 "reg_or_8bit_operand" "")))]
628 (define_insn "*subsi_internal"
629 [(set (match_operand:SI 0 "register_operand" "=r")
630 (minus:SI (match_operand:SI 1 "reg_or_0_operand" "rJ")
631 (match_operand:SI 2 "reg_or_8bit_operand" "rI")))]
635 (define_insn "*subsi_se"
636 [(set (match_operand:DI 0 "register_operand" "=r")
637 (sign_extend:DI (minus:SI (match_operand:SI 1 "reg_or_0_operand" "rJ")
638 (match_operand:SI 2 "reg_or_8bit_operand" "rI"))))]
642 (define_insn "*subsi_se2"
643 [(set (match_operand:DI 0 "register_operand" "=r")
645 (subreg:SI (minus:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
646 (match_operand:DI 2 "reg_or_8bit_operand" "rI"))
651 (define_insn "subvsi3"
652 [(set (match_operand:SI 0 "register_operand" "=r")
653 (minus:SI (match_operand:SI 1 "reg_or_0_operand" "rJ")
654 (match_operand:SI 2 "reg_or_8bit_operand" "rI")))
655 (trap_if (ne (minus:DI (sign_extend:DI (match_dup 1))
656 (sign_extend:DI (match_dup 2)))
657 (sign_extend:DI (minus:SI (match_dup 1)
663 (define_insn "subdi3"
664 [(set (match_operand:DI 0 "register_operand" "=r")
665 (minus:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
666 (match_operand:DI 2 "reg_or_8bit_operand" "rI")))]
670 (define_insn "*ssubl"
671 [(set (match_operand:SI 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 "*ssubl_se"
679 [(set (match_operand:DI 0 "register_operand" "=r")
681 (minus:SI (mult:SI (match_operand:SI 1 "reg_not_elim_operand" "r")
682 (match_operand:SI 2 "const48_operand" "I"))
683 (match_operand:SI 3 "reg_or_8bit_operand" "rI"))))]
687 (define_insn "*ssubq"
688 [(set (match_operand:DI 0 "register_operand" "=r")
689 (minus:DI (mult:DI (match_operand:DI 1 "reg_not_elim_operand" "r")
690 (match_operand:DI 2 "const48_operand" "I"))
691 (match_operand:DI 3 "reg_or_8bit_operand" "rI")))]
695 (define_insn "subvdi3"
696 [(set (match_operand:DI 0 "register_operand" "=r")
697 (minus:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
698 (match_operand:DI 2 "reg_or_8bit_operand" "rI")))
699 (trap_if (ne (minus:TI (sign_extend:TI (match_dup 1))
700 (sign_extend:TI (match_dup 2)))
701 (sign_extend:TI (minus:DI (match_dup 1)
707 ;; The Unicos/Mk assembler doesn't support mull.
709 (define_insn "mulsi3"
710 [(set (match_operand:SI 0 "register_operand" "=r")
711 (mult:SI (match_operand:SI 1 "reg_or_0_operand" "%rJ")
712 (match_operand:SI 2 "reg_or_8bit_operand" "rI")))]
713 "!TARGET_ABI_UNICOSMK"
715 [(set_attr "type" "imul")
716 (set_attr "opsize" "si")])
718 (define_insn "*mulsi_se"
719 [(set (match_operand:DI 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 "!TARGET_ABI_UNICOSMK"
725 [(set_attr "type" "imul")
726 (set_attr "opsize" "si")])
728 (define_insn "mulvsi3"
729 [(set (match_operand:SI 0 "register_operand" "=r")
730 (mult:SI (match_operand:SI 1 "reg_or_0_operand" "%rJ")
731 (match_operand:SI 2 "reg_or_8bit_operand" "rI")))
732 (trap_if (ne (mult:DI (sign_extend:DI (match_dup 1))
733 (sign_extend:DI (match_dup 2)))
734 (sign_extend:DI (mult:SI (match_dup 1)
737 "!TARGET_ABI_UNICOSMK"
739 [(set_attr "type" "imul")
740 (set_attr "opsize" "si")])
742 (define_insn "muldi3"
743 [(set (match_operand:DI 0 "register_operand" "=r")
744 (mult:DI (match_operand:DI 1 "reg_or_0_operand" "%rJ")
745 (match_operand:DI 2 "reg_or_8bit_operand" "rI")))]
748 [(set_attr "type" "imul")])
750 (define_insn "mulvdi3"
751 [(set (match_operand:DI 0 "register_operand" "=r")
752 (mult:DI (match_operand:DI 1 "reg_or_0_operand" "%rJ")
753 (match_operand:DI 2 "reg_or_8bit_operand" "rI")))
754 (trap_if (ne (mult:TI (sign_extend:TI (match_dup 1))
755 (sign_extend:TI (match_dup 2)))
756 (sign_extend:TI (mult:DI (match_dup 1)
761 [(set_attr "type" "imul")])
763 (define_expand "umuldi3_highpart"
764 [(set (match_operand:DI 0 "register_operand" "")
767 (mult:TI (zero_extend:TI
768 (match_operand:DI 1 "register_operand" ""))
769 (match_operand:DI 2 "reg_or_8bit_operand" ""))
773 if (REG_P (operands[2]))
774 operands[2] = gen_rtx_ZERO_EXTEND (TImode, operands[2]);
777 (define_insn "*umuldi3_highpart_reg"
778 [(set (match_operand:DI 0 "register_operand" "=r")
781 (mult:TI (zero_extend:TI
782 (match_operand:DI 1 "register_operand" "r"))
784 (match_operand:DI 2 "register_operand" "r")))
788 [(set_attr "type" "imul")
789 (set_attr "opsize" "udi")])
791 (define_insn "*umuldi3_highpart_const"
792 [(set (match_operand:DI 0 "register_operand" "=r")
795 (mult:TI (zero_extend:TI (match_operand:DI 1 "register_operand" "r"))
796 (match_operand:TI 2 "cint8_operand" "I"))
800 [(set_attr "type" "imul")
801 (set_attr "opsize" "udi")])
803 ;; The divide and remainder operations take their inputs from r24 and
804 ;; r25, put their output in r27, and clobber r23 and r28 on all
805 ;; systems except Unicos/Mk. On Unicos, the standard library provides
806 ;; subroutines which use the standard calling convention and work on
809 ;; ??? Force sign-extension here because some versions of OSF/1 and
810 ;; Interix/NT don't do the right thing if the inputs are not properly
811 ;; sign-extended. But Linux, for instance, does not have this
812 ;; problem. Is it worth the complication here to eliminate the sign
815 (define_expand "divsi3"
817 (sign_extend:DI (match_operand:SI 1 "nonimmediate_operand" "")))
819 (sign_extend:DI (match_operand:SI 2 "nonimmediate_operand" "")))
820 (parallel [(set (match_dup 5)
821 (sign_extend:DI (div:SI (match_dup 3) (match_dup 4))))
822 (clobber (reg:DI 23))
823 (clobber (reg:DI 28))])
824 (set (match_operand:SI 0 "nonimmediate_operand" "")
825 (subreg:SI (match_dup 5) 0))]
826 "! TARGET_ABI_OPEN_VMS && ! TARGET_ABI_UNICOSMK"
828 operands[3] = gen_reg_rtx (DImode);
829 operands[4] = gen_reg_rtx (DImode);
830 operands[5] = gen_reg_rtx (DImode);
833 (define_expand "udivsi3"
835 (sign_extend:DI (match_operand:SI 1 "nonimmediate_operand" "")))
837 (sign_extend:DI (match_operand:SI 2 "nonimmediate_operand" "")))
838 (parallel [(set (match_dup 5)
839 (sign_extend:DI (udiv:SI (match_dup 3) (match_dup 4))))
840 (clobber (reg:DI 23))
841 (clobber (reg:DI 28))])
842 (set (match_operand:SI 0 "nonimmediate_operand" "")
843 (subreg:SI (match_dup 5) 0))]
844 "! TARGET_ABI_OPEN_VMS && ! TARGET_ABI_UNICOSMK"
846 operands[3] = gen_reg_rtx (DImode);
847 operands[4] = gen_reg_rtx (DImode);
848 operands[5] = gen_reg_rtx (DImode);
851 (define_expand "modsi3"
853 (sign_extend:DI (match_operand:SI 1 "nonimmediate_operand" "")))
855 (sign_extend:DI (match_operand:SI 2 "nonimmediate_operand" "")))
856 (parallel [(set (match_dup 5)
857 (sign_extend:DI (mod:SI (match_dup 3) (match_dup 4))))
858 (clobber (reg:DI 23))
859 (clobber (reg:DI 28))])
860 (set (match_operand:SI 0 "nonimmediate_operand" "")
861 (subreg:SI (match_dup 5) 0))]
862 "! TARGET_ABI_OPEN_VMS && ! TARGET_ABI_UNICOSMK"
864 operands[3] = gen_reg_rtx (DImode);
865 operands[4] = gen_reg_rtx (DImode);
866 operands[5] = gen_reg_rtx (DImode);
869 (define_expand "umodsi3"
871 (sign_extend:DI (match_operand:SI 1 "nonimmediate_operand" "")))
873 (sign_extend:DI (match_operand:SI 2 "nonimmediate_operand" "")))
874 (parallel [(set (match_dup 5)
875 (sign_extend:DI (umod:SI (match_dup 3) (match_dup 4))))
876 (clobber (reg:DI 23))
877 (clobber (reg:DI 28))])
878 (set (match_operand:SI 0 "nonimmediate_operand" "")
879 (subreg:SI (match_dup 5) 0))]
880 "! TARGET_ABI_OPEN_VMS && ! TARGET_ABI_UNICOSMK"
882 operands[3] = gen_reg_rtx (DImode);
883 operands[4] = gen_reg_rtx (DImode);
884 operands[5] = gen_reg_rtx (DImode);
887 (define_expand "divdi3"
888 [(parallel [(set (match_operand:DI 0 "register_operand" "")
889 (div: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 "udivdi3"
897 [(parallel [(set (match_operand:DI 0 "register_operand" "")
898 (udiv:DI (match_operand:DI 1 "register_operand" "")
899 (match_operand:DI 2 "register_operand" "")))
900 (clobber (reg:DI 23))
901 (clobber (reg:DI 28))])]
902 "! TARGET_ABI_OPEN_VMS && ! TARGET_ABI_UNICOSMK"
905 (define_expand "moddi3"
906 [(use (match_operand:DI 0 "register_operand" ""))
907 (use (match_operand:DI 1 "register_operand" ""))
908 (use (match_operand:DI 2 "register_operand" ""))]
909 "!TARGET_ABI_OPEN_VMS"
911 if (TARGET_ABI_UNICOSMK)
912 emit_insn (gen_moddi3_umk (operands[0], operands[1], operands[2]));
914 emit_insn (gen_moddi3_dft (operands[0], operands[1], operands[2]));
918 (define_expand "moddi3_dft"
919 [(parallel [(set (match_operand:DI 0 "register_operand" "")
920 (mod:DI (match_operand:DI 1 "register_operand" "")
921 (match_operand:DI 2 "register_operand" "")))
922 (clobber (reg:DI 23))
923 (clobber (reg:DI 28))])]
924 "! TARGET_ABI_OPEN_VMS && ! TARGET_ABI_UNICOSMK"
927 ;; On Unicos/Mk, we do as the system's C compiler does:
928 ;; compute the quotient, multiply and subtract.
930 (define_expand "moddi3_umk"
931 [(use (match_operand:DI 0 "register_operand" ""))
932 (use (match_operand:DI 1 "register_operand" ""))
933 (use (match_operand:DI 2 "register_operand" ""))]
934 "TARGET_ABI_UNICOSMK"
936 rtx div, mul = gen_reg_rtx (DImode);
938 div = expand_binop (DImode, sdiv_optab, operands[1], operands[2],
939 NULL_RTX, 0, OPTAB_LIB);
940 div = force_reg (DImode, div);
941 emit_insn (gen_muldi3 (mul, operands[2], div));
942 emit_insn (gen_subdi3 (operands[0], operands[1], mul));
946 (define_expand "umoddi3"
947 [(use (match_operand:DI 0 "register_operand" ""))
948 (use (match_operand:DI 1 "register_operand" ""))
949 (use (match_operand:DI 2 "register_operand" ""))]
950 "! TARGET_ABI_OPEN_VMS"
952 if (TARGET_ABI_UNICOSMK)
953 emit_insn (gen_umoddi3_umk (operands[0], operands[1], operands[2]));
955 emit_insn (gen_umoddi3_dft (operands[0], operands[1], operands[2]));
959 (define_expand "umoddi3_dft"
960 [(parallel [(set (match_operand:DI 0 "register_operand" "")
961 (umod:DI (match_operand:DI 1 "register_operand" "")
962 (match_operand:DI 2 "register_operand" "")))
963 (clobber (reg:DI 23))
964 (clobber (reg:DI 28))])]
965 "! TARGET_ABI_OPEN_VMS && ! TARGET_ABI_UNICOSMK"
968 (define_expand "umoddi3_umk"
969 [(use (match_operand:DI 0 "register_operand" ""))
970 (use (match_operand:DI 1 "register_operand" ""))
971 (use (match_operand:DI 2 "register_operand" ""))]
972 "TARGET_ABI_UNICOSMK"
974 rtx div, mul = gen_reg_rtx (DImode);
976 div = expand_binop (DImode, udiv_optab, operands[1], operands[2],
977 NULL_RTX, 1, OPTAB_LIB);
978 div = force_reg (DImode, div);
979 emit_insn (gen_muldi3 (mul, operands[2], div));
980 emit_insn (gen_subdi3 (operands[0], operands[1], mul));
984 ;; Lengths of 8 for ldq $t12,__divq($gp); jsr $t9,($t12),__divq as
985 ;; expanded by the assembler.
987 (define_insn_and_split "*divmodsi_internal_er"
988 [(set (match_operand:DI 0 "register_operand" "=c")
989 (sign_extend:DI (match_operator:SI 3 "divmod_operator"
990 [(match_operand:DI 1 "register_operand" "a")
991 (match_operand:DI 2 "register_operand" "b")])))
992 (clobber (reg:DI 23))
993 (clobber (reg:DI 28))]
994 "TARGET_EXPLICIT_RELOCS && ! TARGET_ABI_OPEN_VMS"
996 "&& reload_completed"
997 [(parallel [(set (match_dup 0)
998 (sign_extend:DI (match_dup 3)))
1001 (clobber (reg:DI 23))
1002 (clobber (reg:DI 28))])]
1005 switch (GET_CODE (operands[3]))
1022 operands[4] = GEN_INT (alpha_next_sequence_number++);
1023 emit_insn (gen_movdi_er_high_g (operands[0], pic_offset_table_rtx,
1024 gen_rtx_SYMBOL_REF (DImode, str),
1027 [(set_attr "type" "jsr")
1028 (set_attr "length" "8")])
1030 (define_insn "*divmodsi_internal_er_1"
1031 [(set (match_operand:DI 0 "register_operand" "=c")
1032 (sign_extend:DI (match_operator:SI 3 "divmod_operator"
1033 [(match_operand:DI 1 "register_operand" "a")
1034 (match_operand:DI 2 "register_operand" "b")])))
1035 (use (match_operand:DI 4 "register_operand" "c"))
1036 (use (match_operand 5 "const_int_operand" ""))
1037 (clobber (reg:DI 23))
1038 (clobber (reg:DI 28))]
1039 "TARGET_EXPLICIT_RELOCS && ! TARGET_ABI_OPEN_VMS"
1040 "jsr $23,($27),__%E3%j5"
1041 [(set_attr "type" "jsr")
1042 (set_attr "length" "4")])
1044 (define_insn "*divmodsi_internal"
1045 [(set (match_operand:DI 0 "register_operand" "=c")
1046 (sign_extend:DI (match_operator:SI 3 "divmod_operator"
1047 [(match_operand:DI 1 "register_operand" "a")
1048 (match_operand:DI 2 "register_operand" "b")])))
1049 (clobber (reg:DI 23))
1050 (clobber (reg:DI 28))]
1051 "! TARGET_ABI_OPEN_VMS && ! TARGET_ABI_UNICOSMK"
1053 [(set_attr "type" "jsr")
1054 (set_attr "length" "8")])
1056 (define_insn_and_split "*divmoddi_internal_er"
1057 [(set (match_operand:DI 0 "register_operand" "=c")
1058 (match_operator:DI 3 "divmod_operator"
1059 [(match_operand:DI 1 "register_operand" "a")
1060 (match_operand:DI 2 "register_operand" "b")]))
1061 (clobber (reg:DI 23))
1062 (clobber (reg:DI 28))]
1063 "TARGET_EXPLICIT_RELOCS && ! TARGET_ABI_OPEN_VMS"
1065 "&& reload_completed"
1066 [(parallel [(set (match_dup 0) (match_dup 3))
1069 (clobber (reg:DI 23))
1070 (clobber (reg:DI 28))])]
1073 switch (GET_CODE (operands[3]))
1090 operands[4] = GEN_INT (alpha_next_sequence_number++);
1091 emit_insn (gen_movdi_er_high_g (operands[0], pic_offset_table_rtx,
1092 gen_rtx_SYMBOL_REF (DImode, str),
1095 [(set_attr "type" "jsr")
1096 (set_attr "length" "8")])
1098 (define_insn "*divmoddi_internal_er_1"
1099 [(set (match_operand:DI 0 "register_operand" "=c")
1100 (match_operator:DI 3 "divmod_operator"
1101 [(match_operand:DI 1 "register_operand" "a")
1102 (match_operand:DI 2 "register_operand" "b")]))
1103 (use (match_operand:DI 4 "register_operand" "c"))
1104 (use (match_operand 5 "const_int_operand" ""))
1105 (clobber (reg:DI 23))
1106 (clobber (reg:DI 28))]
1107 "TARGET_EXPLICIT_RELOCS && ! TARGET_ABI_OPEN_VMS"
1108 "jsr $23,($27),__%E3%j5"
1109 [(set_attr "type" "jsr")
1110 (set_attr "length" "4")])
1112 (define_insn "*divmoddi_internal"
1113 [(set (match_operand:DI 0 "register_operand" "=c")
1114 (match_operator:DI 3 "divmod_operator"
1115 [(match_operand:DI 1 "register_operand" "a")
1116 (match_operand:DI 2 "register_operand" "b")]))
1117 (clobber (reg:DI 23))
1118 (clobber (reg:DI 28))]
1119 "! TARGET_ABI_OPEN_VMS && ! TARGET_ABI_UNICOSMK"
1121 [(set_attr "type" "jsr")
1122 (set_attr "length" "8")])
1124 ;; Next are the basic logical operations. We only expose the DImode operations
1125 ;; to the rtl expanders, but SImode versions exist for combine as well as for
1126 ;; the atomic operation splitters.
1128 (define_insn "*andsi_internal"
1129 [(set (match_operand:SI 0 "register_operand" "=r,r,r")
1130 (and:SI (match_operand:SI 1 "reg_or_0_operand" "%rJ,rJ,rJ")
1131 (match_operand:SI 2 "and_operand" "rI,N,MH")))]
1137 [(set_attr "type" "ilog,ilog,shift")])
1139 (define_insn "anddi3"
1140 [(set (match_operand:DI 0 "register_operand" "=r,r,r")
1141 (and:DI (match_operand:DI 1 "reg_or_0_operand" "%rJ,rJ,rJ")
1142 (match_operand:DI 2 "and_operand" "rI,N,MH")))]
1148 [(set_attr "type" "ilog,ilog,shift")])
1150 ;; There are times when we can split an AND into two AND insns. This occurs
1151 ;; when we can first clear any bytes and then clear anything else. For
1152 ;; example "I & 0xffff07" is "(I & 0xffffff) & 0xffffffffffffff07".
1153 ;; Only do this when running on 64-bit host since the computations are
1154 ;; too messy otherwise.
1157 [(set (match_operand:DI 0 "register_operand" "")
1158 (and:DI (match_operand:DI 1 "register_operand" "")
1159 (match_operand:DI 2 "const_int_operand" "")))]
1160 "HOST_BITS_PER_WIDE_INT == 64 && ! and_operand (operands[2], DImode)"
1161 [(set (match_dup 0) (and:DI (match_dup 1) (match_dup 3)))
1162 (set (match_dup 0) (and:DI (match_dup 0) (match_dup 4)))]
1164 unsigned HOST_WIDE_INT mask1 = INTVAL (operands[2]);
1165 unsigned HOST_WIDE_INT mask2 = mask1;
1168 /* For each byte that isn't all zeros, make it all ones. */
1169 for (i = 0; i < 64; i += 8)
1170 if ((mask1 & ((HOST_WIDE_INT) 0xff << i)) != 0)
1171 mask1 |= (HOST_WIDE_INT) 0xff << i;
1173 /* Now turn on any bits we've just turned off. */
1176 operands[3] = GEN_INT (mask1);
1177 operands[4] = GEN_INT (mask2);
1180 (define_expand "zero_extendqihi2"
1181 [(set (match_operand:HI 0 "register_operand" "")
1182 (zero_extend:HI (match_operand:QI 1 "nonimmediate_operand" "")))]
1186 operands[1] = force_reg (QImode, operands[1]);
1189 (define_insn "*zero_extendqihi2_bwx"
1190 [(set (match_operand:HI 0 "register_operand" "=r,r")
1191 (zero_extend:HI (match_operand:QI 1 "nonimmediate_operand" "r,m")))]
1196 [(set_attr "type" "ilog,ild")])
1198 (define_insn "*zero_extendqihi2_nobwx"
1199 [(set (match_operand:HI 0 "register_operand" "=r")
1200 (zero_extend:HI (match_operand:QI 1 "register_operand" "r")))]
1203 [(set_attr "type" "ilog")])
1205 (define_expand "zero_extendqisi2"
1206 [(set (match_operand:SI 0 "register_operand" "")
1207 (zero_extend:SI (match_operand:QI 1 "nonimmediate_operand" "")))]
1211 operands[1] = force_reg (QImode, operands[1]);
1214 (define_insn "*zero_extendqisi2_bwx"
1215 [(set (match_operand:SI 0 "register_operand" "=r,r")
1216 (zero_extend:SI (match_operand:QI 1 "nonimmediate_operand" "r,m")))]
1221 [(set_attr "type" "ilog,ild")])
1223 (define_insn "*zero_extendqisi2_nobwx"
1224 [(set (match_operand:SI 0 "register_operand" "=r")
1225 (zero_extend:SI (match_operand:QI 1 "register_operand" "r")))]
1228 [(set_attr "type" "ilog")])
1230 (define_expand "zero_extendqidi2"
1231 [(set (match_operand:DI 0 "register_operand" "")
1232 (zero_extend:DI (match_operand:QI 1 "nonimmediate_operand" "")))]
1236 operands[1] = force_reg (QImode, operands[1]);
1239 (define_insn "*zero_extendqidi2_bwx"
1240 [(set (match_operand:DI 0 "register_operand" "=r,r")
1241 (zero_extend:DI (match_operand:QI 1 "nonimmediate_operand" "r,m")))]
1246 [(set_attr "type" "ilog,ild")])
1248 (define_insn "*zero_extendqidi2_nobwx"
1249 [(set (match_operand:DI 0 "register_operand" "=r")
1250 (zero_extend:DI (match_operand:QI 1 "register_operand" "r")))]
1253 [(set_attr "type" "ilog")])
1255 (define_expand "zero_extendhisi2"
1256 [(set (match_operand:SI 0 "register_operand" "")
1257 (zero_extend:SI (match_operand:HI 1 "nonimmediate_operand" "")))]
1261 operands[1] = force_reg (HImode, operands[1]);
1264 (define_insn "*zero_extendhisi2_bwx"
1265 [(set (match_operand:SI 0 "register_operand" "=r,r")
1266 (zero_extend:SI (match_operand:HI 1 "nonimmediate_operand" "r,m")))]
1271 [(set_attr "type" "shift,ild")])
1273 (define_insn "*zero_extendhisi2_nobwx"
1274 [(set (match_operand:SI 0 "register_operand" "=r")
1275 (zero_extend:SI (match_operand:HI 1 "register_operand" "r")))]
1278 [(set_attr "type" "shift")])
1280 (define_expand "zero_extendhidi2"
1281 [(set (match_operand:DI 0 "register_operand" "")
1282 (zero_extend:DI (match_operand:HI 1 "nonimmediate_operand" "")))]
1286 operands[1] = force_reg (HImode, operands[1]);
1289 (define_insn "*zero_extendhidi2_bwx"
1290 [(set (match_operand:DI 0 "register_operand" "=r,r")
1291 (zero_extend:DI (match_operand:HI 1 "nonimmediate_operand" "r,m")))]
1296 [(set_attr "type" "shift,ild")])
1298 (define_insn "*zero_extendhidi2_nobwx"
1299 [(set (match_operand:DI 0 "register_operand" "=r")
1300 (zero_extend:DI (match_operand:HI 1 "register_operand" "r")))]
1303 [(set_attr "type" "shift")])
1305 (define_insn "zero_extendsidi2"
1306 [(set (match_operand:DI 0 "register_operand" "=r")
1307 (zero_extend:DI (match_operand:SI 1 "register_operand" "r")))]
1310 [(set_attr "type" "shift")])
1312 (define_insn "*andnotsi3"
1313 [(set (match_operand:SI 0 "register_operand" "=r")
1314 (and:SI (not:SI (match_operand:SI 1 "reg_or_8bit_operand" "rI"))
1315 (match_operand:SI 2 "reg_or_0_operand" "rJ")))]
1318 [(set_attr "type" "ilog")])
1320 (define_insn "andnotdi3"
1321 [(set (match_operand:DI 0 "register_operand" "=r")
1322 (and:DI (not:DI (match_operand:DI 1 "reg_or_8bit_operand" "rI"))
1323 (match_operand:DI 2 "reg_or_0_operand" "rJ")))]
1326 [(set_attr "type" "ilog")])
1328 (define_insn "*iorsi_internal"
1329 [(set (match_operand:SI 0 "register_operand" "=r,r")
1330 (ior:SI (match_operand:SI 1 "reg_or_0_operand" "%rJ,rJ")
1331 (match_operand:SI 2 "or_operand" "rI,N")))]
1336 [(set_attr "type" "ilog")])
1338 (define_insn "iordi3"
1339 [(set (match_operand:DI 0 "register_operand" "=r,r")
1340 (ior:DI (match_operand:DI 1 "reg_or_0_operand" "%rJ,rJ")
1341 (match_operand:DI 2 "or_operand" "rI,N")))]
1346 [(set_attr "type" "ilog")])
1348 (define_insn "*one_cmplsi_internal"
1349 [(set (match_operand:SI 0 "register_operand" "=r")
1350 (not:SI (match_operand:SI 1 "reg_or_8bit_operand" "rI")))]
1353 [(set_attr "type" "ilog")])
1355 (define_insn "one_cmpldi2"
1356 [(set (match_operand:DI 0 "register_operand" "=r")
1357 (not:DI (match_operand:DI 1 "reg_or_8bit_operand" "rI")))]
1360 [(set_attr "type" "ilog")])
1362 (define_insn "*iornotsi3"
1363 [(set (match_operand:SI 0 "register_operand" "=r")
1364 (ior:SI (not:SI (match_operand:SI 1 "reg_or_8bit_operand" "rI"))
1365 (match_operand:SI 2 "reg_or_0_operand" "rJ")))]
1368 [(set_attr "type" "ilog")])
1370 (define_insn "*iornotdi3"
1371 [(set (match_operand:DI 0 "register_operand" "=r")
1372 (ior:DI (not:DI (match_operand:DI 1 "reg_or_8bit_operand" "rI"))
1373 (match_operand:DI 2 "reg_or_0_operand" "rJ")))]
1376 [(set_attr "type" "ilog")])
1378 (define_insn "*xorsi_internal"
1379 [(set (match_operand:SI 0 "register_operand" "=r,r")
1380 (xor:SI (match_operand:SI 1 "reg_or_0_operand" "%rJ,rJ")
1381 (match_operand:SI 2 "or_operand" "rI,N")))]
1386 [(set_attr "type" "ilog")])
1388 (define_insn "xordi3"
1389 [(set (match_operand:DI 0 "register_operand" "=r,r")
1390 (xor:DI (match_operand:DI 1 "reg_or_0_operand" "%rJ,rJ")
1391 (match_operand:DI 2 "or_operand" "rI,N")))]
1396 [(set_attr "type" "ilog")])
1398 (define_insn "*xornotsi3"
1399 [(set (match_operand:SI 0 "register_operand" "=r")
1400 (not:SI (xor:SI (match_operand:SI 1 "register_operand" "%rJ")
1401 (match_operand:SI 2 "register_operand" "rI"))))]
1404 [(set_attr "type" "ilog")])
1406 (define_insn "*xornotdi3"
1407 [(set (match_operand:DI 0 "register_operand" "=r")
1408 (not:DI (xor:DI (match_operand:DI 1 "register_operand" "%rJ")
1409 (match_operand:DI 2 "register_operand" "rI"))))]
1412 [(set_attr "type" "ilog")])
1414 ;; Handle FFS and related insns iff we support CIX.
1416 (define_expand "ffsdi2"
1418 (ctz:DI (match_operand:DI 1 "register_operand" "")))
1420 (plus:DI (match_dup 2) (const_int 1)))
1421 (set (match_operand:DI 0 "register_operand" "")
1422 (if_then_else:DI (eq (match_dup 1) (const_int 0))
1423 (const_int 0) (match_dup 3)))]
1426 operands[2] = gen_reg_rtx (DImode);
1427 operands[3] = gen_reg_rtx (DImode);
1430 (define_insn "clzdi2"
1431 [(set (match_operand:DI 0 "register_operand" "=r")
1432 (clz:DI (match_operand:DI 1 "register_operand" "r")))]
1435 [(set_attr "type" "mvi")])
1437 (define_insn "ctzdi2"
1438 [(set (match_operand:DI 0 "register_operand" "=r")
1439 (ctz:DI (match_operand:DI 1 "register_operand" "r")))]
1442 [(set_attr "type" "mvi")])
1444 (define_insn "popcountdi2"
1445 [(set (match_operand:DI 0 "register_operand" "=r")
1446 (popcount:DI (match_operand:DI 1 "register_operand" "r")))]
1449 [(set_attr "type" "mvi")])
1451 (define_expand "bswapsi2"
1452 [(set (match_operand:SI 0 "register_operand" "")
1453 (bswap:SI (match_operand:SI 1 "register_operand" "")))]
1458 t0 = gen_reg_rtx (DImode);
1459 t1 = gen_reg_rtx (DImode);
1461 emit_insn (gen_insxh (t0, gen_lowpart (DImode, operands[1]),
1462 GEN_INT (32), GEN_INT (WORDS_BIG_ENDIAN ? 0 : 7)));
1463 emit_insn (gen_inswl_const (t1, gen_lowpart (HImode, operands[1]),
1465 emit_insn (gen_iordi3 (t1, t0, t1));
1466 emit_insn (gen_lshrdi3 (t0, t1, GEN_INT (16)));
1467 emit_insn (gen_anddi3 (t1, t1, alpha_expand_zap_mask (0x5)));
1468 emit_insn (gen_anddi3 (t0, t0, alpha_expand_zap_mask (0xa)));
1469 emit_insn (gen_addsi3 (operands[0], gen_lowpart (SImode, t0),
1470 gen_lowpart (SImode, t1)));
1474 (define_expand "bswapdi2"
1475 [(set (match_operand:DI 0 "register_operand" "")
1476 (bswap:DI (match_operand:DI 1 "register_operand" "")))]
1481 t0 = gen_reg_rtx (DImode);
1482 t1 = gen_reg_rtx (DImode);
1484 /* This method of shifting and masking is not specific to Alpha, but
1485 is only profitable on Alpha because of our handy byte zap insn. */
1487 emit_insn (gen_lshrdi3 (t0, operands[1], GEN_INT (32)));
1488 emit_insn (gen_ashldi3 (t1, operands[1], GEN_INT (32)));
1489 emit_insn (gen_iordi3 (t1, t0, t1));
1491 emit_insn (gen_lshrdi3 (t0, t1, GEN_INT (16)));
1492 emit_insn (gen_ashldi3 (t1, t1, GEN_INT (16)));
1493 emit_insn (gen_anddi3 (t0, t0, alpha_expand_zap_mask (0xcc)));
1494 emit_insn (gen_anddi3 (t1, t1, alpha_expand_zap_mask (0x33)));
1495 emit_insn (gen_iordi3 (t1, t0, t1));
1497 emit_insn (gen_lshrdi3 (t0, t1, GEN_INT (8)));
1498 emit_insn (gen_ashldi3 (t1, t1, GEN_INT (8)));
1499 emit_insn (gen_anddi3 (t0, t0, alpha_expand_zap_mask (0xaa)));
1500 emit_insn (gen_anddi3 (t1, t1, alpha_expand_zap_mask (0x55)));
1501 emit_insn (gen_iordi3 (operands[0], t0, t1));
1505 ;; Next come the shifts and the various extract and insert operations.
1507 (define_insn "ashldi3"
1508 [(set (match_operand:DI 0 "register_operand" "=r,r")
1509 (ashift:DI (match_operand:DI 1 "reg_or_0_operand" "rJ,rJ")
1510 (match_operand:DI 2 "reg_or_6bit_operand" "P,rS")))]
1513 switch (which_alternative)
1516 if (operands[2] == const1_rtx)
1517 return "addq %r1,%r1,%0";
1519 return "s%P2addq %r1,0,%0";
1521 return "sll %r1,%2,%0";
1526 [(set_attr "type" "iadd,shift")])
1528 (define_insn "*ashldi_se"
1529 [(set (match_operand:DI 0 "register_operand" "=r")
1531 (subreg:SI (ashift:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
1532 (match_operand:DI 2 "const_int_operand" "P"))
1534 "INTVAL (operands[2]) >= 1 && INTVAL (operands[2]) <= 3"
1536 if (operands[2] == const1_rtx)
1537 return "addl %r1,%r1,%0";
1539 return "s%P2addl %r1,0,%0";
1541 [(set_attr "type" "iadd")])
1543 (define_insn "lshrdi3"
1544 [(set (match_operand:DI 0 "register_operand" "=r")
1545 (lshiftrt:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
1546 (match_operand:DI 2 "reg_or_6bit_operand" "rS")))]
1549 [(set_attr "type" "shift")])
1551 (define_insn "ashrdi3"
1552 [(set (match_operand:DI 0 "register_operand" "=r")
1553 (ashiftrt:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
1554 (match_operand:DI 2 "reg_or_6bit_operand" "rS")))]
1557 [(set_attr "type" "shift")])
1559 (define_expand "extendqihi2"
1561 (ashift:DI (match_operand:QI 1 "some_operand" "")
1563 (set (match_operand:HI 0 "register_operand" "")
1564 (ashiftrt:DI (match_dup 2)
1570 emit_insn (gen_extendqihi2x (operands[0],
1571 force_reg (QImode, operands[1])));
1575 /* If we have an unaligned MEM, extend to DImode (which we do
1576 specially) and then copy to the result. */
1577 if (unaligned_memory_operand (operands[1], HImode))
1579 rtx temp = gen_reg_rtx (DImode);
1581 emit_insn (gen_extendqidi2 (temp, operands[1]));
1582 emit_move_insn (operands[0], gen_lowpart (HImode, temp));
1586 operands[0] = gen_lowpart (DImode, operands[0]);
1587 operands[1] = gen_lowpart (DImode, force_reg (QImode, operands[1]));
1588 operands[2] = gen_reg_rtx (DImode);
1591 (define_insn "extendqidi2x"
1592 [(set (match_operand:DI 0 "register_operand" "=r")
1593 (sign_extend:DI (match_operand:QI 1 "register_operand" "r")))]
1596 [(set_attr "type" "shift")])
1598 (define_insn "extendhidi2x"
1599 [(set (match_operand:DI 0 "register_operand" "=r")
1600 (sign_extend:DI (match_operand:HI 1 "register_operand" "r")))]
1603 [(set_attr "type" "shift")])
1605 (define_insn "extendqisi2x"
1606 [(set (match_operand:SI 0 "register_operand" "=r")
1607 (sign_extend:SI (match_operand:QI 1 "register_operand" "r")))]
1610 [(set_attr "type" "shift")])
1612 (define_insn "extendhisi2x"
1613 [(set (match_operand:SI 0 "register_operand" "=r")
1614 (sign_extend:SI (match_operand:HI 1 "register_operand" "r")))]
1617 [(set_attr "type" "shift")])
1619 (define_insn "extendqihi2x"
1620 [(set (match_operand:HI 0 "register_operand" "=r")
1621 (sign_extend:HI (match_operand:QI 1 "register_operand" "r")))]
1624 [(set_attr "type" "shift")])
1626 (define_expand "extendqisi2"
1628 (ashift:DI (match_operand:QI 1 "some_operand" "")
1630 (set (match_operand:SI 0 "register_operand" "")
1631 (ashiftrt:DI (match_dup 2)
1637 emit_insn (gen_extendqisi2x (operands[0],
1638 force_reg (QImode, operands[1])));
1642 /* If we have an unaligned MEM, extend to a DImode form of
1643 the result (which we do specially). */
1644 if (unaligned_memory_operand (operands[1], QImode))
1646 rtx temp = gen_reg_rtx (DImode);
1648 emit_insn (gen_extendqidi2 (temp, operands[1]));
1649 emit_move_insn (operands[0], gen_lowpart (SImode, temp));
1653 operands[0] = gen_lowpart (DImode, operands[0]);
1654 operands[1] = gen_lowpart (DImode, force_reg (QImode, operands[1]));
1655 operands[2] = gen_reg_rtx (DImode);
1658 (define_expand "extendqidi2"
1660 (ashift:DI (match_operand:QI 1 "some_operand" "")
1662 (set (match_operand:DI 0 "register_operand" "")
1663 (ashiftrt:DI (match_dup 2)
1669 emit_insn (gen_extendqidi2x (operands[0],
1670 force_reg (QImode, operands[1])));
1674 if (unaligned_memory_operand (operands[1], QImode))
1676 rtx seq = gen_unaligned_extendqidi (operands[0], XEXP (operands[1], 0));
1677 alpha_set_memflags (seq, operands[1]);
1682 operands[1] = gen_lowpart (DImode, force_reg (QImode, operands[1]));
1683 operands[2] = gen_reg_rtx (DImode);
1686 (define_expand "extendhisi2"
1688 (ashift:DI (match_operand:HI 1 "some_operand" "")
1690 (set (match_operand:SI 0 "register_operand" "")
1691 (ashiftrt:DI (match_dup 2)
1697 emit_insn (gen_extendhisi2x (operands[0],
1698 force_reg (HImode, operands[1])));
1702 /* If we have an unaligned MEM, extend to a DImode form of
1703 the result (which we do specially). */
1704 if (unaligned_memory_operand (operands[1], HImode))
1706 rtx temp = gen_reg_rtx (DImode);
1708 emit_insn (gen_extendhidi2 (temp, operands[1]));
1709 emit_move_insn (operands[0], gen_lowpart (SImode, temp));
1713 operands[0] = gen_lowpart (DImode, operands[0]);
1714 operands[1] = gen_lowpart (DImode, force_reg (HImode, operands[1]));
1715 operands[2] = gen_reg_rtx (DImode);
1718 (define_expand "extendhidi2"
1720 (ashift:DI (match_operand:HI 1 "some_operand" "")
1722 (set (match_operand:DI 0 "register_operand" "")
1723 (ashiftrt:DI (match_dup 2)
1729 emit_insn (gen_extendhidi2x (operands[0],
1730 force_reg (HImode, operands[1])));
1734 if (unaligned_memory_operand (operands[1], HImode))
1736 rtx seq = gen_unaligned_extendhidi (operands[0], XEXP (operands[1], 0));
1738 alpha_set_memflags (seq, operands[1]);
1743 operands[1] = gen_lowpart (DImode, force_reg (HImode, operands[1]));
1744 operands[2] = gen_reg_rtx (DImode);
1747 ;; Here's how we sign extend an unaligned byte and halfword. Doing this
1748 ;; as a pattern saves one instruction. The code is similar to that for
1749 ;; the unaligned loads (see below).
1751 ;; Operand 1 is the address, operand 0 is the result.
1752 (define_expand "unaligned_extendqidi"
1753 [(use (match_operand:QI 0 "register_operand" ""))
1754 (use (match_operand:DI 1 "address_operand" ""))]
1757 operands[0] = gen_lowpart (DImode, operands[0]);
1758 if (WORDS_BIG_ENDIAN)
1759 emit_insn (gen_unaligned_extendqidi_be (operands[0], operands[1]));
1761 emit_insn (gen_unaligned_extendqidi_le (operands[0], operands[1]));
1765 (define_expand "unaligned_extendqidi_le"
1767 (mem:DI (and:DI (match_operand:DI 1 "" "") (const_int -8))))
1769 (ashift:DI (match_dup 3)
1770 (minus:DI (const_int 64)
1772 (and:DI (match_dup 2) (const_int 7))
1774 (set (match_operand:DI 0 "register_operand" "")
1775 (ashiftrt:DI (match_dup 4) (const_int 56)))]
1776 "! WORDS_BIG_ENDIAN"
1778 operands[2] = get_unaligned_offset (operands[1], 1);
1779 operands[3] = gen_reg_rtx (DImode);
1780 operands[4] = gen_reg_rtx (DImode);
1783 (define_expand "unaligned_extendqidi_be"
1785 (mem:DI (and:DI (match_operand:DI 1 "" "") (const_int -8))))
1787 (ashift:DI (match_dup 3)
1790 (plus:DI (match_dup 2) (const_int 1))
1793 (set (match_operand:DI 0 "register_operand" "")
1794 (ashiftrt:DI (match_dup 4) (const_int 56)))]
1797 operands[2] = get_unaligned_offset (operands[1], -1);
1798 operands[3] = gen_reg_rtx (DImode);
1799 operands[4] = gen_reg_rtx (DImode);
1802 (define_expand "unaligned_extendhidi"
1803 [(use (match_operand:QI 0 "register_operand" ""))
1804 (use (match_operand:DI 1 "address_operand" ""))]
1807 operands[0] = gen_lowpart (DImode, operands[0]);
1808 if (WORDS_BIG_ENDIAN)
1809 emit_insn (gen_unaligned_extendhidi_be (operands[0], operands[1]));
1811 emit_insn (gen_unaligned_extendhidi_le (operands[0], operands[1]));
1815 (define_expand "unaligned_extendhidi_le"
1817 (mem:DI (and:DI (match_operand:DI 1 "" "") (const_int -8))))
1819 (ashift:DI (match_dup 3)
1820 (minus:DI (const_int 64)
1822 (and:DI (match_dup 2) (const_int 7))
1824 (set (match_operand:DI 0 "register_operand" "")
1825 (ashiftrt:DI (match_dup 4) (const_int 48)))]
1826 "! WORDS_BIG_ENDIAN"
1828 operands[2] = get_unaligned_offset (operands[1], 2);
1829 operands[3] = gen_reg_rtx (DImode);
1830 operands[4] = gen_reg_rtx (DImode);
1833 (define_expand "unaligned_extendhidi_be"
1835 (mem:DI (and:DI (match_operand:DI 1 "" "") (const_int -8))))
1837 (ashift:DI (match_dup 3)
1840 (plus:DI (match_dup 2) (const_int 1))
1843 (set (match_operand:DI 0 "register_operand" "")
1844 (ashiftrt:DI (match_dup 4) (const_int 48)))]
1847 operands[2] = get_unaligned_offset (operands[1], -1);
1848 operands[3] = gen_reg_rtx (DImode);
1849 operands[4] = gen_reg_rtx (DImode);
1852 (define_insn "*extxl_const"
1853 [(set (match_operand:DI 0 "register_operand" "=r")
1854 (zero_extract:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
1855 (match_operand:DI 2 "mode_width_operand" "n")
1856 (match_operand:DI 3 "mul8_operand" "I")))]
1858 "ext%M2l %r1,%s3,%0"
1859 [(set_attr "type" "shift")])
1861 (define_insn "extxl_le"
1862 [(set (match_operand:DI 0 "register_operand" "=r")
1863 (zero_extract:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
1864 (match_operand:DI 2 "mode_width_operand" "n")
1865 (ashift:DI (match_operand:DI 3 "reg_or_8bit_operand" "rI")
1867 "! WORDS_BIG_ENDIAN"
1869 [(set_attr "type" "shift")])
1871 (define_insn "extxl_be"
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")
1878 (match_operand:DI 3 "reg_or_8bit_operand" "rI")
1882 [(set_attr "type" "shift")])
1884 ;; Combine has some strange notion of preserving existing undefined behavior
1885 ;; in shifts larger than a word size. So capture these patterns that it
1886 ;; should have turned into zero_extracts.
1888 (define_insn "*extxl_1_le"
1889 [(set (match_operand:DI 0 "register_operand" "=r")
1890 (and:DI (lshiftrt:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
1891 (ashift:DI (match_operand:DI 2 "reg_or_8bit_operand" "rI")
1893 (match_operand:DI 3 "mode_mask_operand" "n")))]
1894 "! WORDS_BIG_ENDIAN"
1896 [(set_attr "type" "shift")])
1898 (define_insn "*extxl_1_be"
1899 [(set (match_operand:DI 0 "register_operand" "=r")
1900 (and:DI (lshiftrt:DI
1901 (match_operand:DI 1 "reg_or_0_operand" "rJ")
1902 (minus:DI (const_int 56)
1903 (ashift:DI (match_operand:DI 2 "reg_or_8bit_operand" "rI")
1905 (match_operand:DI 3 "mode_mask_operand" "n")))]
1908 [(set_attr "type" "shift")])
1910 (define_insn "*extql_2_le"
1911 [(set (match_operand:DI 0 "register_operand" "=r")
1912 (lshiftrt:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
1913 (ashift:DI (match_operand:DI 2 "reg_or_8bit_operand" "rI")
1915 "! WORDS_BIG_ENDIAN"
1917 [(set_attr "type" "shift")])
1919 (define_insn "*extql_2_be"
1920 [(set (match_operand:DI 0 "register_operand" "=r")
1922 (match_operand:DI 1 "reg_or_0_operand" "rJ")
1923 (minus:DI (const_int 56)
1925 (match_operand:DI 2 "reg_or_8bit_operand" "rI")
1929 [(set_attr "type" "shift")])
1931 (define_insn "extqh_le"
1932 [(set (match_operand:DI 0 "register_operand" "=r")
1934 (match_operand:DI 1 "reg_or_0_operand" "rJ")
1935 (minus:DI (const_int 64)
1938 (match_operand:DI 2 "reg_or_8bit_operand" "rI")
1941 "! WORDS_BIG_ENDIAN"
1943 [(set_attr "type" "shift")])
1945 (define_insn "extqh_be"
1946 [(set (match_operand:DI 0 "register_operand" "=r")
1948 (match_operand:DI 1 "reg_or_0_operand" "rJ")
1951 (plus:DI (match_operand:DI 2 "reg_or_8bit_operand" "rI")
1957 [(set_attr "type" "shift")])
1959 (define_insn "extlh_le"
1960 [(set (match_operand:DI 0 "register_operand" "=r")
1962 (and:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
1963 (const_int 2147483647))
1964 (minus:DI (const_int 64)
1967 (match_operand:DI 2 "reg_or_8bit_operand" "rI")
1970 "! WORDS_BIG_ENDIAN"
1972 [(set_attr "type" "shift")])
1974 (define_insn "extlh_be"
1975 [(set (match_operand:DI 0 "register_operand" "=r")
1978 (match_operand:DI 1 "reg_or_0_operand" "rJ")
1982 (match_operand:DI 2 "reg_or_8bit_operand" "rI")
1986 (const_int 2147483647)))]
1989 [(set_attr "type" "shift")])
1991 (define_insn "extwh_le"
1992 [(set (match_operand:DI 0 "register_operand" "=r")
1994 (and:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
1996 (minus:DI (const_int 64)
1999 (match_operand:DI 2 "reg_or_8bit_operand" "rI")
2002 "! WORDS_BIG_ENDIAN"
2004 [(set_attr "type" "shift")])
2006 (define_insn "extwh_be"
2007 [(set (match_operand:DI 0 "register_operand" "=r")
2009 (ashift:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
2013 (match_operand:DI 2 "reg_or_8bit_operand" "rI")
2017 (const_int 65535)))]
2020 [(set_attr "type" "shift")])
2022 ;; This converts an extXl into an extXh with an appropriate adjustment
2023 ;; to the address calculation.
2026 ;; [(set (match_operand:DI 0 "register_operand" "")
2027 ;; (ashift:DI (zero_extract:DI (match_operand:DI 1 "register_operand" "")
2028 ;; (match_operand:DI 2 "mode_width_operand" "")
2029 ;; (ashift:DI (match_operand:DI 3 "" "")
2031 ;; (match_operand:DI 4 "const_int_operand" "")))
2032 ;; (clobber (match_operand:DI 5 "register_operand" ""))]
2033 ;; "INTVAL (operands[4]) == 64 - INTVAL (operands[2])"
2034 ;; [(set (match_dup 5) (match_dup 6))
2035 ;; (set (match_dup 0)
2036 ;; (ashift:DI (zero_extract:DI (match_dup 1) (match_dup 2)
2037 ;; (ashift:DI (plus:DI (match_dup 5)
2043 ;; operands[6] = plus_constant (operands[3],
2044 ;; INTVAL (operands[2]) / BITS_PER_UNIT);
2045 ;; operands[7] = GEN_INT (- INTVAL (operands[2]) / BITS_PER_UNIT);
2048 (define_insn "*insbl_const"
2049 [(set (match_operand:DI 0 "register_operand" "=r")
2050 (ashift:DI (zero_extend:DI (match_operand:QI 1 "register_operand" "r"))
2051 (match_operand:DI 2 "mul8_operand" "I")))]
2054 [(set_attr "type" "shift")])
2056 (define_insn "inswl_const"
2057 [(set (match_operand:DI 0 "register_operand" "=r")
2058 (ashift:DI (zero_extend:DI (match_operand:HI 1 "register_operand" "r"))
2059 (match_operand:DI 2 "mul8_operand" "I")))]
2062 [(set_attr "type" "shift")])
2064 (define_insn "*insll_const"
2065 [(set (match_operand:DI 0 "register_operand" "=r")
2066 (ashift:DI (zero_extend:DI (match_operand:SI 1 "register_operand" "r"))
2067 (match_operand:DI 2 "mul8_operand" "I")))]
2070 [(set_attr "type" "shift")])
2072 (define_insn "insbl_le"
2073 [(set (match_operand:DI 0 "register_operand" "=r")
2074 (ashift:DI (zero_extend:DI (match_operand:QI 1 "register_operand" "r"))
2075 (ashift:DI (match_operand:DI 2 "reg_or_8bit_operand" "rI")
2077 "! WORDS_BIG_ENDIAN"
2079 [(set_attr "type" "shift")])
2081 (define_insn "insbl_be"
2082 [(set (match_operand:DI 0 "register_operand" "=r")
2083 (ashift:DI (zero_extend:DI (match_operand:QI 1 "register_operand" "r"))
2084 (minus:DI (const_int 56)
2085 (ashift:DI (match_operand:DI 2 "reg_or_8bit_operand" "rI")
2089 [(set_attr "type" "shift")])
2091 (define_insn "inswl_le"
2092 [(set (match_operand:DI 0 "register_operand" "=r")
2093 (ashift:DI (zero_extend:DI (match_operand:HI 1 "register_operand" "r"))
2094 (ashift:DI (match_operand:DI 2 "reg_or_8bit_operand" "rI")
2096 "! WORDS_BIG_ENDIAN"
2098 [(set_attr "type" "shift")])
2100 (define_insn "inswl_be"
2101 [(set (match_operand:DI 0 "register_operand" "=r")
2102 (ashift:DI (zero_extend:DI (match_operand:HI 1 "register_operand" "r"))
2103 (minus:DI (const_int 56)
2104 (ashift:DI (match_operand:DI 2 "reg_or_8bit_operand" "rI")
2108 [(set_attr "type" "shift")])
2110 (define_insn "insll_le"
2111 [(set (match_operand:DI 0 "register_operand" "=r")
2112 (ashift:DI (zero_extend:DI (match_operand:SI 1 "register_operand" "r"))
2113 (ashift:DI (match_operand:DI 2 "reg_or_8bit_operand" "rI")
2115 "! WORDS_BIG_ENDIAN"
2117 [(set_attr "type" "shift")])
2119 (define_insn "insll_be"
2120 [(set (match_operand:DI 0 "register_operand" "=r")
2121 (ashift:DI (zero_extend:DI (match_operand:SI 1 "register_operand" "r"))
2122 (minus:DI (const_int 56)
2123 (ashift:DI (match_operand:DI 2 "reg_or_8bit_operand" "rI")
2127 [(set_attr "type" "shift")])
2129 (define_insn "insql_le"
2130 [(set (match_operand:DI 0 "register_operand" "=r")
2131 (ashift:DI (match_operand:DI 1 "register_operand" "r")
2132 (ashift:DI (match_operand:DI 2 "reg_or_8bit_operand" "rI")
2134 "! WORDS_BIG_ENDIAN"
2136 [(set_attr "type" "shift")])
2138 (define_insn "insql_be"
2139 [(set (match_operand:DI 0 "register_operand" "=r")
2140 (ashift:DI (match_operand:DI 1 "register_operand" "r")
2141 (minus:DI (const_int 56)
2142 (ashift:DI (match_operand:DI 2 "reg_or_8bit_operand" "rI")
2146 [(set_attr "type" "shift")])
2148 ;; Combine has this sometimes habit of moving the and outside of the
2149 ;; shift, making life more interesting.
2151 (define_insn "*insxl"
2152 [(set (match_operand:DI 0 "register_operand" "=r")
2153 (and:DI (ashift:DI (match_operand:DI 1 "register_operand" "r")
2154 (match_operand:DI 2 "mul8_operand" "I"))
2155 (match_operand:DI 3 "immediate_operand" "i")))]
2156 "HOST_BITS_PER_WIDE_INT == 64
2157 && GET_CODE (operands[3]) == CONST_INT
2158 && (((unsigned HOST_WIDE_INT) 0xff << INTVAL (operands[2])
2159 == (unsigned HOST_WIDE_INT) INTVAL (operands[3]))
2160 || ((unsigned HOST_WIDE_INT) 0xffff << INTVAL (operands[2])
2161 == (unsigned HOST_WIDE_INT) INTVAL (operands[3]))
2162 || ((unsigned HOST_WIDE_INT) 0xffffffff << INTVAL (operands[2])
2163 == (unsigned HOST_WIDE_INT) INTVAL (operands[3])))"
2165 #if HOST_BITS_PER_WIDE_INT == 64
2166 if ((unsigned HOST_WIDE_INT) 0xff << INTVAL (operands[2])
2167 == (unsigned HOST_WIDE_INT) INTVAL (operands[3]))
2168 return "insbl %1,%s2,%0";
2169 if ((unsigned HOST_WIDE_INT) 0xffff << INTVAL (operands[2])
2170 == (unsigned HOST_WIDE_INT) INTVAL (operands[3]))
2171 return "inswl %1,%s2,%0";
2172 if ((unsigned HOST_WIDE_INT) 0xffffffff << INTVAL (operands[2])
2173 == (unsigned HOST_WIDE_INT) INTVAL (operands[3]))
2174 return "insll %1,%s2,%0";
2178 [(set_attr "type" "shift")])
2180 ;; We do not include the insXh insns because they are complex to express
2181 ;; and it does not appear that we would ever want to generate them.
2183 ;; Since we need them for block moves, though, cop out and use unspec.
2185 (define_insn "insxh"
2186 [(set (match_operand:DI 0 "register_operand" "=r")
2187 (unspec:DI [(match_operand:DI 1 "register_operand" "r")
2188 (match_operand:DI 2 "mode_width_operand" "n")
2189 (match_operand:DI 3 "reg_or_8bit_operand" "rI")]
2193 [(set_attr "type" "shift")])
2195 (define_insn "mskxl_le"
2196 [(set (match_operand:DI 0 "register_operand" "=r")
2197 (and:DI (not:DI (ashift:DI
2198 (match_operand:DI 2 "mode_mask_operand" "n")
2200 (match_operand:DI 3 "reg_or_8bit_operand" "rI")
2202 (match_operand:DI 1 "reg_or_0_operand" "rJ")))]
2203 "! WORDS_BIG_ENDIAN"
2205 [(set_attr "type" "shift")])
2207 (define_insn "mskxl_be"
2208 [(set (match_operand:DI 0 "register_operand" "=r")
2209 (and:DI (not:DI (ashift:DI
2210 (match_operand:DI 2 "mode_mask_operand" "n")
2211 (minus:DI (const_int 56)
2213 (match_operand:DI 3 "reg_or_8bit_operand" "rI")
2215 (match_operand:DI 1 "reg_or_0_operand" "rJ")))]
2218 [(set_attr "type" "shift")])
2220 ;; We do not include the mskXh insns because it does not appear we would
2221 ;; ever generate one.
2223 ;; Again, we do for block moves and we use unspec again.
2225 (define_insn "mskxh"
2226 [(set (match_operand:DI 0 "register_operand" "=r")
2227 (unspec:DI [(match_operand:DI 1 "register_operand" "r")
2228 (match_operand:DI 2 "mode_width_operand" "n")
2229 (match_operand:DI 3 "reg_or_8bit_operand" "rI")]
2233 [(set_attr "type" "shift")])
2235 ;; Prefer AND + NE over LSHIFTRT + AND.
2237 (define_insn_and_split "*ze_and_ne"
2238 [(set (match_operand:DI 0 "register_operand" "=r")
2239 (zero_extract:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
2241 (match_operand 2 "const_int_operand" "I")))]
2242 "(unsigned HOST_WIDE_INT) INTVAL (operands[2]) < 8"
2244 "(unsigned HOST_WIDE_INT) INTVAL (operands[2]) < 8"
2246 (and:DI (match_dup 1) (match_dup 3)))
2248 (ne:DI (match_dup 0) (const_int 0)))]
2249 "operands[3] = GEN_INT (1 << INTVAL (operands[2]));")
2251 ;; Floating-point operations. All the double-precision insns can extend
2252 ;; from single, so indicate that. The exception are the ones that simply
2253 ;; play with the sign bits; it's not clear what to do there.
2255 (define_insn "abssf2"
2256 [(set (match_operand:SF 0 "register_operand" "=f")
2257 (abs:SF (match_operand:SF 1 "reg_or_0_operand" "fG")))]
2260 [(set_attr "type" "fcpys")])
2262 (define_insn "*nabssf2"
2263 [(set (match_operand:SF 0 "register_operand" "=f")
2264 (neg:SF (abs:SF (match_operand:SF 1 "reg_or_0_operand" "fG"))))]
2267 [(set_attr "type" "fadd")])
2269 (define_insn "absdf2"
2270 [(set (match_operand:DF 0 "register_operand" "=f")
2271 (abs:DF (match_operand:DF 1 "reg_or_0_operand" "fG")))]
2274 [(set_attr "type" "fcpys")])
2276 (define_insn "*nabsdf2"
2277 [(set (match_operand:DF 0 "register_operand" "=f")
2278 (neg:DF (abs:DF (match_operand:DF 1 "reg_or_0_operand" "fG"))))]
2281 [(set_attr "type" "fadd")])
2283 (define_expand "abstf2"
2284 [(parallel [(set (match_operand:TF 0 "register_operand" "")
2285 (abs:TF (match_operand:TF 1 "reg_or_0_operand" "")))
2286 (use (match_dup 2))])]
2287 "TARGET_HAS_XFLOATING_LIBS"
2289 #if HOST_BITS_PER_WIDE_INT >= 64
2290 operands[2] = force_reg (DImode, GEN_INT ((HOST_WIDE_INT) 1 << 63));
2292 operands[2] = force_reg (DImode, immed_double_const (0, 0x80000000, DImode));
2296 (define_insn_and_split "*abstf_internal"
2297 [(set (match_operand:TF 0 "register_operand" "=r")
2298 (abs:TF (match_operand:TF 1 "reg_or_0_operand" "rG")))
2299 (use (match_operand:DI 2 "register_operand" "r"))]
2300 "TARGET_HAS_XFLOATING_LIBS"
2302 "&& reload_completed"
2304 "alpha_split_tfmode_frobsign (operands, gen_andnotdi3); DONE;")
2306 (define_insn "negsf2"
2307 [(set (match_operand:SF 0 "register_operand" "=f")
2308 (neg:SF (match_operand:SF 1 "reg_or_0_operand" "fG")))]
2311 [(set_attr "type" "fadd")])
2313 (define_insn "negdf2"
2314 [(set (match_operand:DF 0 "register_operand" "=f")
2315 (neg:DF (match_operand:DF 1 "reg_or_0_operand" "fG")))]
2318 [(set_attr "type" "fadd")])
2320 (define_expand "negtf2"
2321 [(parallel [(set (match_operand:TF 0 "register_operand" "")
2322 (neg:TF (match_operand:TF 1 "reg_or_0_operand" "")))
2323 (use (match_dup 2))])]
2324 "TARGET_HAS_XFLOATING_LIBS"
2326 #if HOST_BITS_PER_WIDE_INT >= 64
2327 operands[2] = force_reg (DImode, GEN_INT ((HOST_WIDE_INT) 1 << 63));
2329 operands[2] = force_reg (DImode, immed_double_const (0, 0x80000000, DImode));
2333 (define_insn_and_split "*negtf_internal"
2334 [(set (match_operand:TF 0 "register_operand" "=r")
2335 (neg:TF (match_operand:TF 1 "reg_or_0_operand" "rG")))
2336 (use (match_operand:DI 2 "register_operand" "r"))]
2337 "TARGET_HAS_XFLOATING_LIBS"
2339 "&& reload_completed"
2341 "alpha_split_tfmode_frobsign (operands, gen_xordi3); DONE;")
2343 (define_insn "copysignsf3"
2344 [(set (match_operand:SF 0 "register_operand" "=f")
2345 (unspec:SF [(match_operand:SF 1 "reg_or_0_operand" "fG")
2346 (match_operand:SF 2 "reg_or_0_operand" "fG")]
2350 [(set_attr "type" "fadd")])
2352 (define_insn "*ncopysignsf3"
2353 [(set (match_operand:SF 0 "register_operand" "=f")
2354 (neg:SF (unspec:SF [(match_operand:SF 1 "reg_or_0_operand" "fG")
2355 (match_operand:SF 2 "reg_or_0_operand" "fG")]
2359 [(set_attr "type" "fadd")])
2361 (define_insn "copysigndf3"
2362 [(set (match_operand:DF 0 "register_operand" "=f")
2363 (unspec:DF [(match_operand:DF 1 "reg_or_0_operand" "fG")
2364 (match_operand:DF 2 "reg_or_0_operand" "fG")]
2368 [(set_attr "type" "fadd")])
2370 (define_insn "*ncopysigndf3"
2371 [(set (match_operand:DF 0 "register_operand" "=f")
2372 (neg:DF (unspec:DF [(match_operand:DF 1 "reg_or_0_operand" "fG")
2373 (match_operand:DF 2 "reg_or_0_operand" "fG")]
2377 [(set_attr "type" "fadd")])
2379 (define_insn "*addsf_ieee"
2380 [(set (match_operand:SF 0 "register_operand" "=&f")
2381 (plus:SF (match_operand:SF 1 "reg_or_0_operand" "%fG")
2382 (match_operand:SF 2 "reg_or_0_operand" "fG")))]
2383 "TARGET_FP && alpha_fptm >= ALPHA_FPTM_SU"
2384 "add%,%/ %R1,%R2,%0"
2385 [(set_attr "type" "fadd")
2386 (set_attr "trap" "yes")
2387 (set_attr "round_suffix" "normal")
2388 (set_attr "trap_suffix" "u_su_sui")])
2390 (define_insn "addsf3"
2391 [(set (match_operand:SF 0 "register_operand" "=f")
2392 (plus:SF (match_operand:SF 1 "reg_or_0_operand" "%fG")
2393 (match_operand:SF 2 "reg_or_0_operand" "fG")))]
2395 "add%,%/ %R1,%R2,%0"
2396 [(set_attr "type" "fadd")
2397 (set_attr "trap" "yes")
2398 (set_attr "round_suffix" "normal")
2399 (set_attr "trap_suffix" "u_su_sui")])
2401 (define_insn "*adddf_ieee"
2402 [(set (match_operand:DF 0 "register_operand" "=&f")
2403 (plus:DF (match_operand:DF 1 "reg_or_0_operand" "%fG")
2404 (match_operand:DF 2 "reg_or_0_operand" "fG")))]
2405 "TARGET_FP && alpha_fptm >= ALPHA_FPTM_SU"
2406 "add%-%/ %R1,%R2,%0"
2407 [(set_attr "type" "fadd")
2408 (set_attr "trap" "yes")
2409 (set_attr "round_suffix" "normal")
2410 (set_attr "trap_suffix" "u_su_sui")])
2412 (define_insn "adddf3"
2413 [(set (match_operand:DF 0 "register_operand" "=f")
2414 (plus:DF (match_operand:DF 1 "reg_or_0_operand" "%fG")
2415 (match_operand:DF 2 "reg_or_0_operand" "fG")))]
2417 "add%-%/ %R1,%R2,%0"
2418 [(set_attr "type" "fadd")
2419 (set_attr "trap" "yes")
2420 (set_attr "round_suffix" "normal")
2421 (set_attr "trap_suffix" "u_su_sui")])
2423 (define_insn "*adddf_ext1"
2424 [(set (match_operand:DF 0 "register_operand" "=f")
2425 (plus:DF (float_extend:DF
2426 (match_operand:SF 1 "reg_or_0_operand" "fG"))
2427 (match_operand:DF 2 "reg_or_0_operand" "fG")))]
2428 "TARGET_FP && alpha_fptm < ALPHA_FPTM_SU"
2429 "add%-%/ %R1,%R2,%0"
2430 [(set_attr "type" "fadd")
2431 (set_attr "trap" "yes")
2432 (set_attr "round_suffix" "normal")
2433 (set_attr "trap_suffix" "u_su_sui")])
2435 (define_insn "*adddf_ext2"
2436 [(set (match_operand:DF 0 "register_operand" "=f")
2437 (plus:DF (float_extend:DF
2438 (match_operand:SF 1 "reg_or_0_operand" "%fG"))
2440 (match_operand:SF 2 "reg_or_0_operand" "fG"))))]
2441 "TARGET_FP && alpha_fptm < ALPHA_FPTM_SU"
2442 "add%-%/ %R1,%R2,%0"
2443 [(set_attr "type" "fadd")
2444 (set_attr "trap" "yes")
2445 (set_attr "round_suffix" "normal")
2446 (set_attr "trap_suffix" "u_su_sui")])
2448 (define_expand "addtf3"
2449 [(use (match_operand 0 "register_operand" ""))
2450 (use (match_operand 1 "general_operand" ""))
2451 (use (match_operand 2 "general_operand" ""))]
2452 "TARGET_HAS_XFLOATING_LIBS"
2453 "alpha_emit_xfloating_arith (PLUS, operands); DONE;")
2455 ;; Define conversion operators between DFmode and SImode, using the cvtql
2456 ;; instruction. To allow combine et al to do useful things, we keep the
2457 ;; operation as a unit until after reload, at which point we split the
2460 ;; Note that we (attempt to) only consider this optimization when the
2461 ;; ultimate destination is memory. If we will be doing further integer
2462 ;; processing, it is cheaper to do the truncation in the int regs.
2464 (define_insn "*cvtql"
2465 [(set (match_operand:SF 0 "register_operand" "=f")
2466 (unspec:SF [(match_operand:DI 1 "reg_or_0_operand" "fG")]
2470 [(set_attr "type" "fadd")
2471 (set_attr "trap" "yes")
2472 (set_attr "trap_suffix" "v_sv")])
2474 (define_insn_and_split "*fix_truncdfsi_ieee"
2475 [(set (match_operand:SI 0 "memory_operand" "=m")
2477 (match_operator:DI 4 "fix_operator"
2478 [(match_operand:DF 1 "reg_or_0_operand" "fG")]) 0))
2479 (clobber (match_scratch:DI 2 "=&f"))
2480 (clobber (match_scratch:SF 3 "=&f"))]
2481 "TARGET_FP && alpha_fptm >= ALPHA_FPTM_SU"
2483 "&& reload_completed"
2484 [(set (match_dup 2) (match_op_dup 4 [(match_dup 1)]))
2485 (set (match_dup 3) (unspec:SF [(match_dup 2)] UNSPEC_CVTQL))
2486 (set (match_dup 5) (match_dup 3))]
2488 operands[5] = adjust_address (operands[0], SFmode, 0);
2490 [(set_attr "type" "fadd")
2491 (set_attr "trap" "yes")])
2493 (define_insn_and_split "*fix_truncdfsi_internal"
2494 [(set (match_operand:SI 0 "memory_operand" "=m")
2496 (match_operator:DI 3 "fix_operator"
2497 [(match_operand:DF 1 "reg_or_0_operand" "fG")]) 0))
2498 (clobber (match_scratch:DI 2 "=f"))]
2499 "TARGET_FP && alpha_fptm < ALPHA_FPTM_SU"
2501 "&& reload_completed"
2502 [(set (match_dup 2) (match_op_dup 3 [(match_dup 1)]))
2503 (set (match_dup 4) (unspec:SF [(match_dup 2)] UNSPEC_CVTQL))
2504 (set (match_dup 5) (match_dup 4))]
2506 operands[4] = gen_rtx_REG (SFmode, REGNO (operands[2]));
2507 operands[5] = adjust_address (operands[0], SFmode, 0);
2509 [(set_attr "type" "fadd")
2510 (set_attr "trap" "yes")])
2512 (define_insn "*fix_truncdfdi_ieee"
2513 [(set (match_operand:DI 0 "reg_no_subreg_operand" "=&f")
2514 (match_operator:DI 2 "fix_operator"
2515 [(match_operand:DF 1 "reg_or_0_operand" "fG")]))]
2516 "TARGET_FP && alpha_fptm >= ALPHA_FPTM_SU"
2518 [(set_attr "type" "fadd")
2519 (set_attr "trap" "yes")
2520 (set_attr "round_suffix" "c")
2521 (set_attr "trap_suffix" "v_sv_svi")])
2523 (define_insn "*fix_truncdfdi2"
2524 [(set (match_operand:DI 0 "reg_no_subreg_operand" "=f")
2525 (match_operator:DI 2 "fix_operator"
2526 [(match_operand:DF 1 "reg_or_0_operand" "fG")]))]
2529 [(set_attr "type" "fadd")
2530 (set_attr "trap" "yes")
2531 (set_attr "round_suffix" "c")
2532 (set_attr "trap_suffix" "v_sv_svi")])
2534 (define_expand "fix_truncdfdi2"
2535 [(set (match_operand:DI 0 "reg_no_subreg_operand" "")
2536 (fix:DI (match_operand:DF 1 "reg_or_0_operand" "")))]
2540 (define_expand "fixuns_truncdfdi2"
2541 [(set (match_operand:DI 0 "reg_no_subreg_operand" "")
2542 (unsigned_fix:DI (match_operand:DF 1 "reg_or_0_operand" "")))]
2546 ;; Likewise between SFmode and SImode.
2548 (define_insn_and_split "*fix_truncsfsi_ieee"
2549 [(set (match_operand:SI 0 "memory_operand" "=m")
2551 (match_operator:DI 4 "fix_operator"
2553 (match_operand:SF 1 "reg_or_0_operand" "fG"))]) 0))
2554 (clobber (match_scratch:DI 2 "=&f"))
2555 (clobber (match_scratch:SF 3 "=&f"))]
2556 "TARGET_FP && alpha_fptm >= ALPHA_FPTM_SU"
2558 "&& reload_completed"
2559 [(set (match_dup 2) (match_op_dup 4 [(float_extend:DF (match_dup 1))]))
2560 (set (match_dup 3) (unspec:SF [(match_dup 2)] UNSPEC_CVTQL))
2561 (set (match_dup 5) (match_dup 3))]
2563 operands[5] = adjust_address (operands[0], SFmode, 0);
2565 [(set_attr "type" "fadd")
2566 (set_attr "trap" "yes")])
2568 (define_insn_and_split "*fix_truncsfsi_internal"
2569 [(set (match_operand:SI 0 "memory_operand" "=m")
2571 (match_operator:DI 3 "fix_operator"
2573 (match_operand:SF 1 "reg_or_0_operand" "fG"))]) 0))
2574 (clobber (match_scratch:DI 2 "=f"))]
2575 "TARGET_FP && alpha_fptm < ALPHA_FPTM_SU"
2577 "&& reload_completed"
2578 [(set (match_dup 2) (match_op_dup 3 [(float_extend:DF (match_dup 1))]))
2579 (set (match_dup 4) (unspec:SF [(match_dup 2)] UNSPEC_CVTQL))
2580 (set (match_dup 5) (match_dup 4))]
2582 operands[4] = gen_rtx_REG (SFmode, REGNO (operands[2]));
2583 operands[5] = adjust_address (operands[0], SFmode, 0);
2585 [(set_attr "type" "fadd")
2586 (set_attr "trap" "yes")])
2588 (define_insn "*fix_truncsfdi_ieee"
2589 [(set (match_operand:DI 0 "reg_no_subreg_operand" "=&f")
2590 (match_operator:DI 2 "fix_operator"
2591 [(float_extend:DF (match_operand:SF 1 "reg_or_0_operand" "fG"))]))]
2592 "TARGET_FP && alpha_fptm >= ALPHA_FPTM_SU"
2594 [(set_attr "type" "fadd")
2595 (set_attr "trap" "yes")
2596 (set_attr "round_suffix" "c")
2597 (set_attr "trap_suffix" "v_sv_svi")])
2599 (define_insn "*fix_truncsfdi2"
2600 [(set (match_operand:DI 0 "reg_no_subreg_operand" "=f")
2601 (match_operator:DI 2 "fix_operator"
2602 [(float_extend:DF (match_operand:SF 1 "reg_or_0_operand" "fG"))]))]
2605 [(set_attr "type" "fadd")
2606 (set_attr "trap" "yes")
2607 (set_attr "round_suffix" "c")
2608 (set_attr "trap_suffix" "v_sv_svi")])
2610 (define_expand "fix_truncsfdi2"
2611 [(set (match_operand:DI 0 "reg_no_subreg_operand" "")
2612 (fix:DI (float_extend:DF (match_operand:SF 1 "reg_or_0_operand" ""))))]
2616 (define_expand "fixuns_truncsfdi2"
2617 [(set (match_operand:DI 0 "reg_no_subreg_operand" "")
2619 (float_extend:DF (match_operand:SF 1 "reg_or_0_operand" ""))))]
2623 (define_expand "fix_trunctfdi2"
2624 [(use (match_operand:DI 0 "register_operand" ""))
2625 (use (match_operand:TF 1 "general_operand" ""))]
2626 "TARGET_HAS_XFLOATING_LIBS"
2627 "alpha_emit_xfloating_cvt (FIX, operands); DONE;")
2629 (define_expand "fixuns_trunctfdi2"
2630 [(use (match_operand:DI 0 "register_operand" ""))
2631 (use (match_operand:TF 1 "general_operand" ""))]
2632 "TARGET_HAS_XFLOATING_LIBS"
2633 "alpha_emit_xfloating_cvt (UNSIGNED_FIX, operands); DONE;")
2635 (define_insn "*floatdisf_ieee"
2636 [(set (match_operand:SF 0 "register_operand" "=&f")
2637 (float:SF (match_operand:DI 1 "reg_no_subreg_operand" "f")))]
2638 "TARGET_FP && alpha_fptm >= ALPHA_FPTM_SU"
2640 [(set_attr "type" "fadd")
2641 (set_attr "trap" "yes")
2642 (set_attr "round_suffix" "normal")
2643 (set_attr "trap_suffix" "sui")])
2645 (define_insn "floatdisf2"
2646 [(set (match_operand:SF 0 "register_operand" "=f")
2647 (float:SF (match_operand:DI 1 "reg_no_subreg_operand" "f")))]
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_and_split "*floatsisf2_ieee"
2656 [(set (match_operand:SF 0 "register_operand" "=&f")
2657 (float:SF (match_operand:SI 1 "memory_operand" "m")))
2658 (clobber (match_scratch:DI 2 "=&f"))
2659 (clobber (match_scratch:SF 3 "=&f"))]
2660 "TARGET_FP && alpha_fptm >= ALPHA_FPTM_SU"
2662 "&& reload_completed"
2663 [(set (match_dup 3) (match_dup 1))
2664 (set (match_dup 2) (unspec:DI [(match_dup 3)] UNSPEC_CVTLQ))
2665 (set (match_dup 0) (float:SF (match_dup 2)))]
2667 operands[1] = adjust_address (operands[1], SFmode, 0);
2670 (define_insn_and_split "*floatsisf2"
2671 [(set (match_operand:SF 0 "register_operand" "=f")
2672 (float:SF (match_operand:SI 1 "memory_operand" "m")))]
2675 "&& reload_completed"
2676 [(set (match_dup 0) (match_dup 1))
2677 (set (match_dup 2) (unspec:DI [(match_dup 0)] UNSPEC_CVTLQ))
2678 (set (match_dup 0) (float:SF (match_dup 2)))]
2680 operands[1] = adjust_address (operands[1], SFmode, 0);
2681 operands[2] = gen_rtx_REG (DImode, REGNO (operands[0]));
2684 (define_insn "*floatdidf_ieee"
2685 [(set (match_operand:DF 0 "register_operand" "=&f")
2686 (float:DF (match_operand:DI 1 "reg_no_subreg_operand" "f")))]
2687 "TARGET_FP && alpha_fptm >= ALPHA_FPTM_SU"
2689 [(set_attr "type" "fadd")
2690 (set_attr "trap" "yes")
2691 (set_attr "round_suffix" "normal")
2692 (set_attr "trap_suffix" "sui")])
2694 (define_insn "floatdidf2"
2695 [(set (match_operand:DF 0 "register_operand" "=f")
2696 (float:DF (match_operand:DI 1 "reg_no_subreg_operand" "f")))]
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_and_split "*floatsidf2_ieee"
2705 [(set (match_operand:DF 0 "register_operand" "=&f")
2706 (float:DF (match_operand:SI 1 "memory_operand" "m")))
2707 (clobber (match_scratch:DI 2 "=&f"))
2708 (clobber (match_scratch:SF 3 "=&f"))]
2709 "TARGET_FP && alpha_fptm >= ALPHA_FPTM_SU"
2711 "&& reload_completed"
2712 [(set (match_dup 3) (match_dup 1))
2713 (set (match_dup 2) (unspec:DI [(match_dup 3)] UNSPEC_CVTLQ))
2714 (set (match_dup 0) (float:DF (match_dup 2)))]
2716 operands[1] = adjust_address (operands[1], SFmode, 0);
2719 (define_insn_and_split "*floatsidf2"
2720 [(set (match_operand:DF 0 "register_operand" "=f")
2721 (float:DF (match_operand:SI 1 "memory_operand" "m")))]
2724 "&& reload_completed"
2725 [(set (match_dup 3) (match_dup 1))
2726 (set (match_dup 2) (unspec:DI [(match_dup 3)] UNSPEC_CVTLQ))
2727 (set (match_dup 0) (float:DF (match_dup 2)))]
2729 operands[1] = adjust_address (operands[1], SFmode, 0);
2730 operands[2] = gen_rtx_REG (DImode, REGNO (operands[0]));
2731 operands[3] = gen_rtx_REG (SFmode, REGNO (operands[0]));
2734 (define_expand "floatditf2"
2735 [(use (match_operand:TF 0 "register_operand" ""))
2736 (use (match_operand:DI 1 "general_operand" ""))]
2737 "TARGET_HAS_XFLOATING_LIBS"
2738 "alpha_emit_xfloating_cvt (FLOAT, operands); DONE;")
2740 (define_expand "floatunsdisf2"
2741 [(use (match_operand:SF 0 "register_operand" ""))
2742 (use (match_operand:DI 1 "register_operand" ""))]
2744 "alpha_emit_floatuns (operands); DONE;")
2746 (define_expand "floatunsdidf2"
2747 [(use (match_operand:DF 0 "register_operand" ""))
2748 (use (match_operand:DI 1 "register_operand" ""))]
2750 "alpha_emit_floatuns (operands); DONE;")
2752 (define_expand "floatunsditf2"
2753 [(use (match_operand:TF 0 "register_operand" ""))
2754 (use (match_operand:DI 1 "general_operand" ""))]
2755 "TARGET_HAS_XFLOATING_LIBS"
2756 "alpha_emit_xfloating_cvt (UNSIGNED_FLOAT, operands); DONE;")
2758 (define_expand "extendsfdf2"
2759 [(set (match_operand:DF 0 "register_operand" "")
2760 (float_extend:DF (match_operand:SF 1 "nonimmediate_operand" "")))]
2763 if (alpha_fptm >= ALPHA_FPTM_SU)
2764 operands[1] = force_reg (SFmode, operands[1]);
2767 ;; The Unicos/Mk assembler doesn't support cvtst, but we've already
2768 ;; asserted that alpha_fptm == ALPHA_FPTM_N.
2770 (define_insn "*extendsfdf2_ieee"
2771 [(set (match_operand:DF 0 "register_operand" "=&f")
2772 (float_extend:DF (match_operand:SF 1 "register_operand" "f")))]
2773 "TARGET_FP && alpha_fptm >= ALPHA_FPTM_SU"
2775 [(set_attr "type" "fadd")
2776 (set_attr "trap" "yes")])
2778 (define_insn "*extendsfdf2_internal"
2779 [(set (match_operand:DF 0 "register_operand" "=f,f,m")
2780 (float_extend:DF (match_operand:SF 1 "nonimmediate_operand" "f,m,f")))]
2781 "TARGET_FP && alpha_fptm < ALPHA_FPTM_SU"
2786 [(set_attr "type" "fcpys,fld,fst")])
2788 ;; Use register_operand for operand 1 to prevent compress_float_constant
2789 ;; from doing something silly. When optimizing we'll put things back
2791 (define_expand "extendsftf2"
2792 [(use (match_operand:TF 0 "register_operand" ""))
2793 (use (match_operand:SF 1 "register_operand" ""))]
2794 "TARGET_HAS_XFLOATING_LIBS"
2796 rtx tmp = gen_reg_rtx (DFmode);
2797 emit_insn (gen_extendsfdf2 (tmp, operands[1]));
2798 emit_insn (gen_extenddftf2 (operands[0], tmp));
2802 (define_expand "extenddftf2"
2803 [(use (match_operand:TF 0 "register_operand" ""))
2804 (use (match_operand:DF 1 "register_operand" ""))]
2805 "TARGET_HAS_XFLOATING_LIBS"
2806 "alpha_emit_xfloating_cvt (FLOAT_EXTEND, operands); DONE;")
2808 (define_insn "*truncdfsf2_ieee"
2809 [(set (match_operand:SF 0 "register_operand" "=&f")
2810 (float_truncate:SF (match_operand:DF 1 "reg_or_0_operand" "fG")))]
2811 "TARGET_FP && alpha_fptm >= ALPHA_FPTM_SU"
2813 [(set_attr "type" "fadd")
2814 (set_attr "trap" "yes")
2815 (set_attr "round_suffix" "normal")
2816 (set_attr "trap_suffix" "u_su_sui")])
2818 (define_insn "truncdfsf2"
2819 [(set (match_operand:SF 0 "register_operand" "=f")
2820 (float_truncate:SF (match_operand:DF 1 "reg_or_0_operand" "fG")))]
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_expand "trunctfdf2"
2829 [(use (match_operand:DF 0 "register_operand" ""))
2830 (use (match_operand:TF 1 "general_operand" ""))]
2831 "TARGET_HAS_XFLOATING_LIBS"
2832 "alpha_emit_xfloating_cvt (FLOAT_TRUNCATE, operands); DONE;")
2834 (define_expand "trunctfsf2"
2835 [(use (match_operand:SF 0 "register_operand" ""))
2836 (use (match_operand:TF 1 "general_operand" ""))]
2837 "TARGET_FP && TARGET_HAS_XFLOATING_LIBS"
2839 rtx tmpf, sticky, arg, lo, hi;
2841 tmpf = gen_reg_rtx (DFmode);
2842 sticky = gen_reg_rtx (DImode);
2843 arg = copy_to_mode_reg (TFmode, operands[1]);
2844 lo = gen_lowpart (DImode, arg);
2845 hi = gen_highpart (DImode, arg);
2847 /* Convert the low word of the TFmode value into a sticky rounding bit,
2848 then or it into the low bit of the high word. This leaves the sticky
2849 bit at bit 48 of the fraction, which is representable in DFmode,
2850 which prevents rounding error in the final conversion to SFmode. */
2852 emit_insn (gen_rtx_SET (VOIDmode, sticky,
2853 gen_rtx_NE (DImode, lo, const0_rtx)));
2854 emit_insn (gen_iordi3 (hi, hi, sticky));
2855 emit_insn (gen_trunctfdf2 (tmpf, arg));
2856 emit_insn (gen_truncdfsf2 (operands[0], tmpf));
2860 (define_insn "*divsf3_ieee"
2861 [(set (match_operand:SF 0 "register_operand" "=&f")
2862 (div:SF (match_operand:SF 1 "reg_or_0_operand" "fG")
2863 (match_operand:SF 2 "reg_or_0_operand" "fG")))]
2864 "TARGET_FP && alpha_fptm >= ALPHA_FPTM_SU"
2865 "div%,%/ %R1,%R2,%0"
2866 [(set_attr "type" "fdiv")
2867 (set_attr "opsize" "si")
2868 (set_attr "trap" "yes")
2869 (set_attr "round_suffix" "normal")
2870 (set_attr "trap_suffix" "u_su_sui")])
2872 (define_insn "divsf3"
2873 [(set (match_operand:SF 0 "register_operand" "=f")
2874 (div:SF (match_operand:SF 1 "reg_or_0_operand" "fG")
2875 (match_operand:SF 2 "reg_or_0_operand" "fG")))]
2877 "div%,%/ %R1,%R2,%0"
2878 [(set_attr "type" "fdiv")
2879 (set_attr "opsize" "si")
2880 (set_attr "trap" "yes")
2881 (set_attr "round_suffix" "normal")
2882 (set_attr "trap_suffix" "u_su_sui")])
2884 (define_insn "*divdf3_ieee"
2885 [(set (match_operand:DF 0 "register_operand" "=&f")
2886 (div:DF (match_operand:DF 1 "reg_or_0_operand" "fG")
2887 (match_operand:DF 2 "reg_or_0_operand" "fG")))]
2888 "TARGET_FP && alpha_fptm >= ALPHA_FPTM_SU"
2889 "div%-%/ %R1,%R2,%0"
2890 [(set_attr "type" "fdiv")
2891 (set_attr "trap" "yes")
2892 (set_attr "round_suffix" "normal")
2893 (set_attr "trap_suffix" "u_su_sui")])
2895 (define_insn "divdf3"
2896 [(set (match_operand:DF 0 "register_operand" "=f")
2897 (div:DF (match_operand:DF 1 "reg_or_0_operand" "fG")
2898 (match_operand:DF 2 "reg_or_0_operand" "fG")))]
2900 "div%-%/ %R1,%R2,%0"
2901 [(set_attr "type" "fdiv")
2902 (set_attr "trap" "yes")
2903 (set_attr "round_suffix" "normal")
2904 (set_attr "trap_suffix" "u_su_sui")])
2906 (define_insn "*divdf_ext1"
2907 [(set (match_operand:DF 0 "register_operand" "=f")
2908 (div:DF (float_extend:DF (match_operand:SF 1 "reg_or_0_operand" "fG"))
2909 (match_operand:DF 2 "reg_or_0_operand" "fG")))]
2910 "TARGET_FP && alpha_fptm < ALPHA_FPTM_SU"
2911 "div%-%/ %R1,%R2,%0"
2912 [(set_attr "type" "fdiv")
2913 (set_attr "trap" "yes")
2914 (set_attr "round_suffix" "normal")
2915 (set_attr "trap_suffix" "u_su_sui")])
2917 (define_insn "*divdf_ext2"
2918 [(set (match_operand:DF 0 "register_operand" "=f")
2919 (div:DF (match_operand:DF 1 "reg_or_0_operand" "fG")
2921 (match_operand:SF 2 "reg_or_0_operand" "fG"))))]
2922 "TARGET_FP && alpha_fptm < ALPHA_FPTM_SU"
2923 "div%-%/ %R1,%R2,%0"
2924 [(set_attr "type" "fdiv")
2925 (set_attr "trap" "yes")
2926 (set_attr "round_suffix" "normal")
2927 (set_attr "trap_suffix" "u_su_sui")])
2929 (define_insn "*divdf_ext3"
2930 [(set (match_operand:DF 0 "register_operand" "=f")
2931 (div:DF (float_extend:DF (match_operand:SF 1 "reg_or_0_operand" "fG"))
2932 (float_extend:DF (match_operand:SF 2 "reg_or_0_operand" "fG"))))]
2933 "TARGET_FP && alpha_fptm < ALPHA_FPTM_SU"
2934 "div%-%/ %R1,%R2,%0"
2935 [(set_attr "type" "fdiv")
2936 (set_attr "trap" "yes")
2937 (set_attr "round_suffix" "normal")
2938 (set_attr "trap_suffix" "u_su_sui")])
2940 (define_expand "divtf3"
2941 [(use (match_operand 0 "register_operand" ""))
2942 (use (match_operand 1 "general_operand" ""))
2943 (use (match_operand 2 "general_operand" ""))]
2944 "TARGET_HAS_XFLOATING_LIBS"
2945 "alpha_emit_xfloating_arith (DIV, operands); DONE;")
2947 (define_insn "*mulsf3_ieee"
2948 [(set (match_operand:SF 0 "register_operand" "=&f")
2949 (mult:SF (match_operand:SF 1 "reg_or_0_operand" "%fG")
2950 (match_operand:SF 2 "reg_or_0_operand" "fG")))]
2951 "TARGET_FP && alpha_fptm >= ALPHA_FPTM_SU"
2952 "mul%,%/ %R1,%R2,%0"
2953 [(set_attr "type" "fmul")
2954 (set_attr "trap" "yes")
2955 (set_attr "round_suffix" "normal")
2956 (set_attr "trap_suffix" "u_su_sui")])
2958 (define_insn "mulsf3"
2959 [(set (match_operand:SF 0 "register_operand" "=f")
2960 (mult:SF (match_operand:SF 1 "reg_or_0_operand" "%fG")
2961 (match_operand:SF 2 "reg_or_0_operand" "fG")))]
2963 "mul%,%/ %R1,%R2,%0"
2964 [(set_attr "type" "fmul")
2965 (set_attr "trap" "yes")
2966 (set_attr "round_suffix" "normal")
2967 (set_attr "trap_suffix" "u_su_sui")])
2969 (define_insn "*muldf3_ieee"
2970 [(set (match_operand:DF 0 "register_operand" "=&f")
2971 (mult:DF (match_operand:DF 1 "reg_or_0_operand" "%fG")
2972 (match_operand:DF 2 "reg_or_0_operand" "fG")))]
2973 "TARGET_FP && alpha_fptm >= ALPHA_FPTM_SU"
2974 "mul%-%/ %R1,%R2,%0"
2975 [(set_attr "type" "fmul")
2976 (set_attr "trap" "yes")
2977 (set_attr "round_suffix" "normal")
2978 (set_attr "trap_suffix" "u_su_sui")])
2980 (define_insn "muldf3"
2981 [(set (match_operand:DF 0 "register_operand" "=f")
2982 (mult:DF (match_operand:DF 1 "reg_or_0_operand" "%fG")
2983 (match_operand:DF 2 "reg_or_0_operand" "fG")))]
2985 "mul%-%/ %R1,%R2,%0"
2986 [(set_attr "type" "fmul")
2987 (set_attr "trap" "yes")
2988 (set_attr "round_suffix" "normal")
2989 (set_attr "trap_suffix" "u_su_sui")])
2991 (define_insn "*muldf_ext1"
2992 [(set (match_operand:DF 0 "register_operand" "=f")
2993 (mult:DF (float_extend:DF
2994 (match_operand:SF 1 "reg_or_0_operand" "fG"))
2995 (match_operand:DF 2 "reg_or_0_operand" "fG")))]
2996 "TARGET_FP && alpha_fptm < ALPHA_FPTM_SU"
2997 "mul%-%/ %R1,%R2,%0"
2998 [(set_attr "type" "fmul")
2999 (set_attr "trap" "yes")
3000 (set_attr "round_suffix" "normal")
3001 (set_attr "trap_suffix" "u_su_sui")])
3003 (define_insn "*muldf_ext2"
3004 [(set (match_operand:DF 0 "register_operand" "=f")
3005 (mult:DF (float_extend:DF
3006 (match_operand:SF 1 "reg_or_0_operand" "%fG"))
3008 (match_operand:SF 2 "reg_or_0_operand" "fG"))))]
3009 "TARGET_FP && alpha_fptm < ALPHA_FPTM_SU"
3010 "mul%-%/ %R1,%R2,%0"
3011 [(set_attr "type" "fmul")
3012 (set_attr "trap" "yes")
3013 (set_attr "round_suffix" "normal")
3014 (set_attr "trap_suffix" "u_su_sui")])
3016 (define_expand "multf3"
3017 [(use (match_operand 0 "register_operand" ""))
3018 (use (match_operand 1 "general_operand" ""))
3019 (use (match_operand 2 "general_operand" ""))]
3020 "TARGET_HAS_XFLOATING_LIBS"
3021 "alpha_emit_xfloating_arith (MULT, operands); DONE;")
3023 (define_insn "*subsf3_ieee"
3024 [(set (match_operand:SF 0 "register_operand" "=&f")
3025 (minus:SF (match_operand:SF 1 "reg_or_0_operand" "fG")
3026 (match_operand:SF 2 "reg_or_0_operand" "fG")))]
3027 "TARGET_FP && alpha_fptm >= ALPHA_FPTM_SU"
3028 "sub%,%/ %R1,%R2,%0"
3029 [(set_attr "type" "fadd")
3030 (set_attr "trap" "yes")
3031 (set_attr "round_suffix" "normal")
3032 (set_attr "trap_suffix" "u_su_sui")])
3034 (define_insn "subsf3"
3035 [(set (match_operand:SF 0 "register_operand" "=f")
3036 (minus:SF (match_operand:SF 1 "reg_or_0_operand" "fG")
3037 (match_operand:SF 2 "reg_or_0_operand" "fG")))]
3039 "sub%,%/ %R1,%R2,%0"
3040 [(set_attr "type" "fadd")
3041 (set_attr "trap" "yes")
3042 (set_attr "round_suffix" "normal")
3043 (set_attr "trap_suffix" "u_su_sui")])
3045 (define_insn "*subdf3_ieee"
3046 [(set (match_operand:DF 0 "register_operand" "=&f")
3047 (minus:DF (match_operand:DF 1 "reg_or_0_operand" "fG")
3048 (match_operand:DF 2 "reg_or_0_operand" "fG")))]
3049 "TARGET_FP && alpha_fptm >= ALPHA_FPTM_SU"
3050 "sub%-%/ %R1,%R2,%0"
3051 [(set_attr "type" "fadd")
3052 (set_attr "trap" "yes")
3053 (set_attr "round_suffix" "normal")
3054 (set_attr "trap_suffix" "u_su_sui")])
3056 (define_insn "subdf3"
3057 [(set (match_operand:DF 0 "register_operand" "=f")
3058 (minus:DF (match_operand:DF 1 "reg_or_0_operand" "fG")
3059 (match_operand:DF 2 "reg_or_0_operand" "fG")))]
3061 "sub%-%/ %R1,%R2,%0"
3062 [(set_attr "type" "fadd")
3063 (set_attr "trap" "yes")
3064 (set_attr "round_suffix" "normal")
3065 (set_attr "trap_suffix" "u_su_sui")])
3067 (define_insn "*subdf_ext1"
3068 [(set (match_operand:DF 0 "register_operand" "=f")
3069 (minus:DF (float_extend:DF
3070 (match_operand:SF 1 "reg_or_0_operand" "fG"))
3071 (match_operand:DF 2 "reg_or_0_operand" "fG")))]
3072 "TARGET_FP && alpha_fptm < ALPHA_FPTM_SU"
3073 "sub%-%/ %R1,%R2,%0"
3074 [(set_attr "type" "fadd")
3075 (set_attr "trap" "yes")
3076 (set_attr "round_suffix" "normal")
3077 (set_attr "trap_suffix" "u_su_sui")])
3079 (define_insn "*subdf_ext2"
3080 [(set (match_operand:DF 0 "register_operand" "=f")
3081 (minus:DF (match_operand:DF 1 "reg_or_0_operand" "fG")
3083 (match_operand:SF 2 "reg_or_0_operand" "fG"))))]
3084 "TARGET_FP && alpha_fptm < ALPHA_FPTM_SU"
3085 "sub%-%/ %R1,%R2,%0"
3086 [(set_attr "type" "fadd")
3087 (set_attr "trap" "yes")
3088 (set_attr "round_suffix" "normal")
3089 (set_attr "trap_suffix" "u_su_sui")])
3091 (define_insn "*subdf_ext3"
3092 [(set (match_operand:DF 0 "register_operand" "=f")
3093 (minus:DF (float_extend:DF
3094 (match_operand:SF 1 "reg_or_0_operand" "fG"))
3096 (match_operand:SF 2 "reg_or_0_operand" "fG"))))]
3097 "TARGET_FP && alpha_fptm < ALPHA_FPTM_SU"
3098 "sub%-%/ %R1,%R2,%0"
3099 [(set_attr "type" "fadd")
3100 (set_attr "trap" "yes")
3101 (set_attr "round_suffix" "normal")
3102 (set_attr "trap_suffix" "u_su_sui")])
3104 (define_expand "subtf3"
3105 [(use (match_operand 0 "register_operand" ""))
3106 (use (match_operand 1 "general_operand" ""))
3107 (use (match_operand 2 "general_operand" ""))]
3108 "TARGET_HAS_XFLOATING_LIBS"
3109 "alpha_emit_xfloating_arith (MINUS, operands); DONE;")
3111 (define_insn "*sqrtsf2_ieee"
3112 [(set (match_operand:SF 0 "register_operand" "=&f")
3113 (sqrt:SF (match_operand:SF 1 "reg_or_0_operand" "fG")))]
3114 "TARGET_FP && TARGET_FIX && alpha_fptm >= ALPHA_FPTM_SU"
3116 [(set_attr "type" "fsqrt")
3117 (set_attr "opsize" "si")
3118 (set_attr "trap" "yes")
3119 (set_attr "round_suffix" "normal")
3120 (set_attr "trap_suffix" "u_su_sui")])
3122 (define_insn "sqrtsf2"
3123 [(set (match_operand:SF 0 "register_operand" "=f")
3124 (sqrt:SF (match_operand:SF 1 "reg_or_0_operand" "fG")))]
3125 "TARGET_FP && TARGET_FIX"
3127 [(set_attr "type" "fsqrt")
3128 (set_attr "opsize" "si")
3129 (set_attr "trap" "yes")
3130 (set_attr "round_suffix" "normal")
3131 (set_attr "trap_suffix" "u_su_sui")])
3133 (define_insn "*sqrtdf2_ieee"
3134 [(set (match_operand:DF 0 "register_operand" "=&f")
3135 (sqrt:DF (match_operand:DF 1 "reg_or_0_operand" "fG")))]
3136 "TARGET_FP && TARGET_FIX && alpha_fptm >= ALPHA_FPTM_SU"
3138 [(set_attr "type" "fsqrt")
3139 (set_attr "trap" "yes")
3140 (set_attr "round_suffix" "normal")
3141 (set_attr "trap_suffix" "u_su_sui")])
3143 (define_insn "sqrtdf2"
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"
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 ;; Next are all the integer comparisons, and conditional moves and branches
3154 ;; and some of the related define_expand's and define_split's.
3156 (define_insn "*setcc_internal"
3157 [(set (match_operand 0 "register_operand" "=r")
3158 (match_operator 1 "alpha_comparison_operator"
3159 [(match_operand:DI 2 "register_operand" "r")
3160 (match_operand:DI 3 "reg_or_8bit_operand" "rI")]))]
3161 "GET_MODE_CLASS (GET_MODE (operands[0])) == MODE_INT
3162 && GET_MODE_SIZE (GET_MODE (operands[0])) <= 8
3163 && GET_MODE (operands[0]) == GET_MODE (operands[1])"
3165 [(set_attr "type" "icmp")])
3167 ;; Yes, we can technically support reg_or_8bit_operand in operand 2,
3168 ;; but that's non-canonical rtl and allowing that causes inefficiencies
3170 (define_insn "*setcc_swapped_internal"
3171 [(set (match_operand 0 "register_operand" "=r")
3172 (match_operator 1 "alpha_swapped_comparison_operator"
3173 [(match_operand:DI 2 "register_operand" "r")
3174 (match_operand:DI 3 "reg_or_0_operand" "rJ")]))]
3175 "GET_MODE_CLASS (GET_MODE (operands[0])) == MODE_INT
3176 && GET_MODE_SIZE (GET_MODE (operands[0])) <= 8
3177 && GET_MODE (operands[0]) == GET_MODE (operands[1])"
3179 [(set_attr "type" "icmp")])
3181 ;; Use match_operator rather than ne directly so that we can match
3182 ;; multiple integer modes.
3183 (define_insn "*setne_internal"
3184 [(set (match_operand 0 "register_operand" "=r")
3185 (match_operator 1 "signed_comparison_operator"
3186 [(match_operand:DI 2 "register_operand" "r")
3188 "GET_MODE_CLASS (GET_MODE (operands[0])) == MODE_INT
3189 && GET_MODE_SIZE (GET_MODE (operands[0])) <= 8
3190 && GET_CODE (operands[1]) == NE
3191 && GET_MODE (operands[0]) == GET_MODE (operands[1])"
3193 [(set_attr "type" "icmp")])
3195 ;; The mode folding trick can't be used with const_int operands, since
3196 ;; reload needs to know the proper mode.
3198 ;; Use add_operand instead of the more seemingly natural reg_or_8bit_operand
3199 ;; in order to create more pairs of constants. As long as we're allowing
3200 ;; two constants at the same time, and will have to reload one of them...
3202 (define_insn "*movqicc_internal"
3203 [(set (match_operand:QI 0 "register_operand" "=r,r,r,r")
3205 (match_operator 2 "signed_comparison_operator"
3206 [(match_operand:DI 3 "reg_or_0_operand" "rJ,rJ,J,J")
3207 (match_operand:DI 4 "reg_or_0_operand" "J,J,rJ,rJ")])
3208 (match_operand:QI 1 "add_operand" "rI,0,rI,0")
3209 (match_operand:QI 5 "add_operand" "0,rI,0,rI")))]
3210 "(operands[3] == const0_rtx) ^ (operands[4] == const0_rtx)"
3216 [(set_attr "type" "icmov")])
3218 (define_insn "*movhicc_internal"
3219 [(set (match_operand:HI 0 "register_operand" "=r,r,r,r")
3221 (match_operator 2 "signed_comparison_operator"
3222 [(match_operand:DI 3 "reg_or_0_operand" "rJ,rJ,J,J")
3223 (match_operand:DI 4 "reg_or_0_operand" "J,J,rJ,rJ")])
3224 (match_operand:HI 1 "add_operand" "rI,0,rI,0")
3225 (match_operand:HI 5 "add_operand" "0,rI,0,rI")))]
3226 "(operands[3] == const0_rtx) ^ (operands[4] == const0_rtx)"
3232 [(set_attr "type" "icmov")])
3234 (define_insn "*movsicc_internal"
3235 [(set (match_operand:SI 0 "register_operand" "=r,r,r,r")
3237 (match_operator 2 "signed_comparison_operator"
3238 [(match_operand:DI 3 "reg_or_0_operand" "rJ,rJ,J,J")
3239 (match_operand:DI 4 "reg_or_0_operand" "J,J,rJ,rJ")])
3240 (match_operand:SI 1 "add_operand" "rI,0,rI,0")
3241 (match_operand:SI 5 "add_operand" "0,rI,0,rI")))]
3242 "(operands[3] == const0_rtx) ^ (operands[4] == const0_rtx)"
3248 [(set_attr "type" "icmov")])
3250 (define_insn "*movdicc_internal"
3251 [(set (match_operand:DI 0 "register_operand" "=r,r,r,r")
3253 (match_operator 2 "signed_comparison_operator"
3254 [(match_operand:DI 3 "reg_or_0_operand" "rJ,rJ,J,J")
3255 (match_operand:DI 4 "reg_or_0_operand" "J,J,rJ,rJ")])
3256 (match_operand:DI 1 "add_operand" "rI,0,rI,0")
3257 (match_operand:DI 5 "add_operand" "0,rI,0,rI")))]
3258 "(operands[3] == const0_rtx) ^ (operands[4] == const0_rtx)"
3264 [(set_attr "type" "icmov")])
3266 (define_insn "*movqicc_lbc"
3267 [(set (match_operand:QI 0 "register_operand" "=r,r")
3269 (eq (zero_extract:DI (match_operand:DI 2 "reg_or_0_operand" "rJ,rJ")
3273 (match_operand:QI 1 "reg_or_8bit_operand" "rI,0")
3274 (match_operand:QI 3 "reg_or_8bit_operand" "0,rI")))]
3279 [(set_attr "type" "icmov")])
3281 (define_insn "*movhicc_lbc"
3282 [(set (match_operand:HI 0 "register_operand" "=r,r")
3284 (eq (zero_extract:DI (match_operand:DI 2 "reg_or_0_operand" "rJ,rJ")
3288 (match_operand:HI 1 "reg_or_8bit_operand" "rI,0")
3289 (match_operand:HI 3 "reg_or_8bit_operand" "0,rI")))]
3294 [(set_attr "type" "icmov")])
3296 (define_insn "*movsicc_lbc"
3297 [(set (match_operand:SI 0 "register_operand" "=r,r")
3299 (eq (zero_extract:DI (match_operand:DI 2 "reg_or_0_operand" "rJ,rJ")
3303 (match_operand:SI 1 "reg_or_8bit_operand" "rI,0")
3304 (match_operand:SI 3 "reg_or_8bit_operand" "0,rI")))]
3309 [(set_attr "type" "icmov")])
3311 (define_insn "*movdicc_lbc"
3312 [(set (match_operand:DI 0 "register_operand" "=r,r")
3314 (eq (zero_extract:DI (match_operand:DI 2 "reg_or_0_operand" "rJ,rJ")
3318 (match_operand:DI 1 "reg_or_8bit_operand" "rI,0")
3319 (match_operand:DI 3 "reg_or_8bit_operand" "0,rI")))]
3324 [(set_attr "type" "icmov")])
3326 (define_insn "*movqicc_lbs"
3327 [(set (match_operand:QI 0 "register_operand" "=r,r")
3329 (ne (zero_extract:DI (match_operand:DI 2 "reg_or_0_operand" "rJ,rJ")
3333 (match_operand:QI 1 "reg_or_8bit_operand" "rI,0")
3334 (match_operand:QI 3 "reg_or_8bit_operand" "0,rI")))]
3339 [(set_attr "type" "icmov")])
3341 (define_insn "*movhicc_lbs"
3342 [(set (match_operand:HI 0 "register_operand" "=r,r")
3344 (ne (zero_extract:DI (match_operand:DI 2 "reg_or_0_operand" "rJ,rJ")
3348 (match_operand:HI 1 "reg_or_8bit_operand" "rI,0")
3349 (match_operand:HI 3 "reg_or_8bit_operand" "0,rI")))]
3354 [(set_attr "type" "icmov")])
3356 (define_insn "*movsicc_lbs"
3357 [(set (match_operand:SI 0 "register_operand" "=r,r")
3359 (ne (zero_extract:DI (match_operand:DI 2 "reg_or_0_operand" "rJ,rJ")
3363 (match_operand:SI 1 "reg_or_8bit_operand" "rI,0")
3364 (match_operand:SI 3 "reg_or_8bit_operand" "0,rI")))]
3369 [(set_attr "type" "icmov")])
3371 (define_insn "*movdicc_lbs"
3372 [(set (match_operand:DI 0 "register_operand" "=r,r")
3374 (ne (zero_extract:DI (match_operand:DI 2 "reg_or_0_operand" "rJ,rJ")
3378 (match_operand:DI 1 "reg_or_8bit_operand" "rI,0")
3379 (match_operand:DI 3 "reg_or_8bit_operand" "0,rI")))]
3384 [(set_attr "type" "icmov")])
3386 ;; For ABS, we have two choices, depending on whether the input and output
3387 ;; registers are the same or not.
3388 (define_expand "absdi2"
3389 [(set (match_operand:DI 0 "register_operand" "")
3390 (abs:DI (match_operand:DI 1 "register_operand" "")))]
3393 if (rtx_equal_p (operands[0], operands[1]))
3394 emit_insn (gen_absdi2_same (operands[0], gen_reg_rtx (DImode)));
3396 emit_insn (gen_absdi2_diff (operands[0], operands[1]));
3400 (define_expand "absdi2_same"
3401 [(set (match_operand:DI 1 "register_operand" "")
3402 (neg:DI (match_operand:DI 0 "register_operand" "")))
3404 (if_then_else:DI (ge (match_dup 0) (const_int 0))
3410 (define_expand "absdi2_diff"
3411 [(set (match_operand:DI 0 "register_operand" "")
3412 (neg:DI (match_operand:DI 1 "register_operand" "")))
3414 (if_then_else:DI (lt (match_dup 1) (const_int 0))
3421 [(set (match_operand:DI 0 "register_operand" "")
3422 (abs:DI (match_dup 0)))
3423 (clobber (match_operand:DI 1 "register_operand" ""))]
3425 [(set (match_dup 1) (neg:DI (match_dup 0)))
3426 (set (match_dup 0) (if_then_else:DI (ge (match_dup 0) (const_int 0))
3427 (match_dup 0) (match_dup 1)))]
3431 [(set (match_operand:DI 0 "register_operand" "")
3432 (abs:DI (match_operand:DI 1 "register_operand" "")))]
3433 "! rtx_equal_p (operands[0], operands[1])"
3434 [(set (match_dup 0) (neg:DI (match_dup 1)))
3435 (set (match_dup 0) (if_then_else:DI (lt (match_dup 1) (const_int 0))
3436 (match_dup 0) (match_dup 1)))]
3440 [(set (match_operand:DI 0 "register_operand" "")
3441 (neg:DI (abs:DI (match_dup 0))))
3442 (clobber (match_operand:DI 1 "register_operand" ""))]
3444 [(set (match_dup 1) (neg:DI (match_dup 0)))
3445 (set (match_dup 0) (if_then_else:DI (le (match_dup 0) (const_int 0))
3446 (match_dup 0) (match_dup 1)))]
3450 [(set (match_operand:DI 0 "register_operand" "")
3451 (neg:DI (abs:DI (match_operand:DI 1 "register_operand" ""))))]
3452 "! rtx_equal_p (operands[0], operands[1])"
3453 [(set (match_dup 0) (neg:DI (match_dup 1)))
3454 (set (match_dup 0) (if_then_else:DI (gt (match_dup 1) (const_int 0))
3455 (match_dup 0) (match_dup 1)))]
3458 (define_insn "sminqi3"
3459 [(set (match_operand:QI 0 "register_operand" "=r")
3460 (smin:QI (match_operand:QI 1 "reg_or_0_operand" "%rJ")
3461 (match_operand:QI 2 "reg_or_8bit_operand" "rI")))]
3464 [(set_attr "type" "mvi")])
3466 (define_insn "uminqi3"
3467 [(set (match_operand:QI 0 "register_operand" "=r")
3468 (umin:QI (match_operand:QI 1 "reg_or_0_operand" "%rJ")
3469 (match_operand:QI 2 "reg_or_8bit_operand" "rI")))]
3472 [(set_attr "type" "mvi")])
3474 (define_insn "smaxqi3"
3475 [(set (match_operand:QI 0 "register_operand" "=r")
3476 (smax:QI (match_operand:QI 1 "reg_or_0_operand" "%rJ")
3477 (match_operand:QI 2 "reg_or_8bit_operand" "rI")))]
3480 [(set_attr "type" "mvi")])
3482 (define_insn "umaxqi3"
3483 [(set (match_operand:QI 0 "register_operand" "=r")
3484 (umax:QI (match_operand:QI 1 "reg_or_0_operand" "%rJ")
3485 (match_operand:QI 2 "reg_or_8bit_operand" "rI")))]
3488 [(set_attr "type" "mvi")])
3490 (define_insn "sminhi3"
3491 [(set (match_operand:HI 0 "register_operand" "=r")
3492 (smin:HI (match_operand:HI 1 "reg_or_0_operand" "%rJ")
3493 (match_operand:HI 2 "reg_or_8bit_operand" "rI")))]
3496 [(set_attr "type" "mvi")])
3498 (define_insn "uminhi3"
3499 [(set (match_operand:HI 0 "register_operand" "=r")
3500 (umin:HI (match_operand:HI 1 "reg_or_0_operand" "%rJ")
3501 (match_operand:HI 2 "reg_or_8bit_operand" "rI")))]
3504 [(set_attr "type" "mvi")])
3506 (define_insn "smaxhi3"
3507 [(set (match_operand:HI 0 "register_operand" "=r")
3508 (smax:HI (match_operand:HI 1 "reg_or_0_operand" "%rJ")
3509 (match_operand:HI 2 "reg_or_8bit_operand" "rI")))]
3512 [(set_attr "type" "mvi")])
3514 (define_insn "umaxhi3"
3515 [(set (match_operand:HI 0 "register_operand" "=r")
3516 (umax:HI (match_operand:HI 1 "reg_or_0_operand" "%rJ")
3517 (match_operand:HI 2 "reg_or_8bit_operand" "rI")))]
3520 [(set_attr "type" "mvi")])
3522 (define_expand "smaxdi3"
3524 (le:DI (match_operand:DI 1 "reg_or_0_operand" "")
3525 (match_operand:DI 2 "reg_or_8bit_operand" "")))
3526 (set (match_operand:DI 0 "register_operand" "")
3527 (if_then_else:DI (eq (match_dup 3) (const_int 0))
3528 (match_dup 1) (match_dup 2)))]
3530 { operands[3] = gen_reg_rtx (DImode); })
3533 [(set (match_operand:DI 0 "register_operand" "")
3534 (smax:DI (match_operand:DI 1 "reg_or_0_operand" "")
3535 (match_operand:DI 2 "reg_or_8bit_operand" "")))
3536 (clobber (match_operand:DI 3 "register_operand" ""))]
3537 "operands[2] != const0_rtx"
3538 [(set (match_dup 3) (le:DI (match_dup 1) (match_dup 2)))
3539 (set (match_dup 0) (if_then_else:DI (eq (match_dup 3) (const_int 0))
3540 (match_dup 1) (match_dup 2)))]
3543 (define_insn "*smax_const0"
3544 [(set (match_operand:DI 0 "register_operand" "=r")
3545 (smax:DI (match_operand:DI 1 "register_operand" "0")
3549 [(set_attr "type" "icmov")])
3551 (define_expand "smindi3"
3553 (lt:DI (match_operand:DI 1 "reg_or_0_operand" "")
3554 (match_operand:DI 2 "reg_or_8bit_operand" "")))
3555 (set (match_operand:DI 0 "register_operand" "")
3556 (if_then_else:DI (ne (match_dup 3) (const_int 0))
3557 (match_dup 1) (match_dup 2)))]
3559 { operands[3] = gen_reg_rtx (DImode); })
3562 [(set (match_operand:DI 0 "register_operand" "")
3563 (smin:DI (match_operand:DI 1 "reg_or_0_operand" "")
3564 (match_operand:DI 2 "reg_or_8bit_operand" "")))
3565 (clobber (match_operand:DI 3 "register_operand" ""))]
3566 "operands[2] != const0_rtx"
3567 [(set (match_dup 3) (lt:DI (match_dup 1) (match_dup 2)))
3568 (set (match_dup 0) (if_then_else:DI (ne (match_dup 3) (const_int 0))
3569 (match_dup 1) (match_dup 2)))]
3572 (define_insn "*smin_const0"
3573 [(set (match_operand:DI 0 "register_operand" "=r")
3574 (smin:DI (match_operand:DI 1 "register_operand" "0")
3578 [(set_attr "type" "icmov")])
3580 (define_expand "umaxdi3"
3582 (leu:DI (match_operand:DI 1 "reg_or_0_operand" "")
3583 (match_operand:DI 2 "reg_or_8bit_operand" "")))
3584 (set (match_operand:DI 0 "register_operand" "")
3585 (if_then_else:DI (eq (match_dup 3) (const_int 0))
3586 (match_dup 1) (match_dup 2)))]
3588 "operands[3] = gen_reg_rtx (DImode);")
3591 [(set (match_operand:DI 0 "register_operand" "")
3592 (umax:DI (match_operand:DI 1 "reg_or_0_operand" "")
3593 (match_operand:DI 2 "reg_or_8bit_operand" "")))
3594 (clobber (match_operand:DI 3 "register_operand" ""))]
3595 "operands[2] != const0_rtx"
3596 [(set (match_dup 3) (leu:DI (match_dup 1) (match_dup 2)))
3597 (set (match_dup 0) (if_then_else:DI (eq (match_dup 3) (const_int 0))
3598 (match_dup 1) (match_dup 2)))]
3601 (define_expand "umindi3"
3603 (ltu:DI (match_operand:DI 1 "reg_or_0_operand" "")
3604 (match_operand:DI 2 "reg_or_8bit_operand" "")))
3605 (set (match_operand:DI 0 "register_operand" "")
3606 (if_then_else:DI (ne (match_dup 3) (const_int 0))
3607 (match_dup 1) (match_dup 2)))]
3609 "operands[3] = gen_reg_rtx (DImode);")
3612 [(set (match_operand:DI 0 "register_operand" "")
3613 (umin:DI (match_operand:DI 1 "reg_or_0_operand" "")
3614 (match_operand:DI 2 "reg_or_8bit_operand" "")))
3615 (clobber (match_operand:DI 3 "register_operand" ""))]
3616 "operands[2] != const0_rtx"
3617 [(set (match_dup 3) (ltu:DI (match_dup 1) (match_dup 2)))
3618 (set (match_dup 0) (if_then_else:DI (ne (match_dup 3) (const_int 0))
3619 (match_dup 1) (match_dup 2)))]
3622 (define_insn "*bcc_normal"
3625 (match_operator 1 "signed_comparison_operator"
3626 [(match_operand:DI 2 "reg_or_0_operand" "rJ")
3628 (label_ref (match_operand 0 "" ""))
3632 [(set_attr "type" "ibr")])
3634 (define_insn "*bcc_reverse"
3637 (match_operator 1 "signed_comparison_operator"
3638 [(match_operand:DI 2 "register_operand" "r")
3642 (label_ref (match_operand 0 "" ""))))]
3645 [(set_attr "type" "ibr")])
3647 (define_insn "*blbs_normal"
3650 (ne (zero_extract:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
3654 (label_ref (match_operand 0 "" ""))
3658 [(set_attr "type" "ibr")])
3660 (define_insn "*blbc_normal"
3663 (eq (zero_extract:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
3667 (label_ref (match_operand 0 "" ""))
3671 [(set_attr "type" "ibr")])
3677 (match_operator 1 "comparison_operator"
3678 [(zero_extract:DI (match_operand:DI 2 "register_operand" "")
3680 (match_operand:DI 3 "const_int_operand" ""))
3682 (label_ref (match_operand 0 "" ""))
3684 (clobber (match_operand:DI 4 "register_operand" ""))])]
3685 "INTVAL (operands[3]) != 0"
3687 (lshiftrt:DI (match_dup 2) (match_dup 3)))
3689 (if_then_else (match_op_dup 1
3690 [(zero_extract:DI (match_dup 4)
3694 (label_ref (match_dup 0))
3698 ;; The following are the corresponding floating-point insns. Recall
3699 ;; we need to have variants that expand the arguments from SFmode
3702 (define_insn "*cmpdf_ieee"
3703 [(set (match_operand:DF 0 "register_operand" "=&f")
3704 (match_operator:DF 1 "alpha_fp_comparison_operator"
3705 [(match_operand:DF 2 "reg_or_0_operand" "fG")
3706 (match_operand:DF 3 "reg_or_0_operand" "fG")]))]
3707 "TARGET_FP && alpha_fptm >= ALPHA_FPTM_SU"
3708 "cmp%-%C1%/ %R2,%R3,%0"
3709 [(set_attr "type" "fadd")
3710 (set_attr "trap" "yes")
3711 (set_attr "trap_suffix" "su")])
3713 (define_insn "*cmpdf_internal"
3714 [(set (match_operand:DF 0 "register_operand" "=f")
3715 (match_operator:DF 1 "alpha_fp_comparison_operator"
3716 [(match_operand:DF 2 "reg_or_0_operand" "fG")
3717 (match_operand:DF 3 "reg_or_0_operand" "fG")]))]
3718 "TARGET_FP && alpha_fptm < ALPHA_FPTM_SU"
3719 "cmp%-%C1%/ %R2,%R3,%0"
3720 [(set_attr "type" "fadd")
3721 (set_attr "trap" "yes")
3722 (set_attr "trap_suffix" "su")])
3724 (define_insn "*cmpdf_ieee_ext1"
3725 [(set (match_operand:DF 0 "register_operand" "=&f")
3726 (match_operator:DF 1 "alpha_fp_comparison_operator"
3728 (match_operand:SF 2 "reg_or_0_operand" "fG"))
3729 (match_operand:DF 3 "reg_or_0_operand" "fG")]))]
3730 "TARGET_FP && alpha_fptm >= ALPHA_FPTM_SU"
3731 "cmp%-%C1%/ %R2,%R3,%0"
3732 [(set_attr "type" "fadd")
3733 (set_attr "trap" "yes")
3734 (set_attr "trap_suffix" "su")])
3736 (define_insn "*cmpdf_ext1"
3737 [(set (match_operand:DF 0 "register_operand" "=f")
3738 (match_operator:DF 1 "alpha_fp_comparison_operator"
3740 (match_operand:SF 2 "reg_or_0_operand" "fG"))
3741 (match_operand:DF 3 "reg_or_0_operand" "fG")]))]
3742 "TARGET_FP && alpha_fptm < ALPHA_FPTM_SU"
3743 "cmp%-%C1%/ %R2,%R3,%0"
3744 [(set_attr "type" "fadd")
3745 (set_attr "trap" "yes")
3746 (set_attr "trap_suffix" "su")])
3748 (define_insn "*cmpdf_ieee_ext2"
3749 [(set (match_operand:DF 0 "register_operand" "=&f")
3750 (match_operator:DF 1 "alpha_fp_comparison_operator"
3751 [(match_operand:DF 2 "reg_or_0_operand" "fG")
3753 (match_operand:SF 3 "reg_or_0_operand" "fG"))]))]
3754 "TARGET_FP && alpha_fptm >= ALPHA_FPTM_SU"
3755 "cmp%-%C1%/ %R2,%R3,%0"
3756 [(set_attr "type" "fadd")
3757 (set_attr "trap" "yes")
3758 (set_attr "trap_suffix" "su")])
3760 (define_insn "*cmpdf_ext2"
3761 [(set (match_operand:DF 0 "register_operand" "=f")
3762 (match_operator:DF 1 "alpha_fp_comparison_operator"
3763 [(match_operand:DF 2 "reg_or_0_operand" "fG")
3765 (match_operand:SF 3 "reg_or_0_operand" "fG"))]))]
3766 "TARGET_FP && alpha_fptm < ALPHA_FPTM_SU"
3767 "cmp%-%C1%/ %R2,%R3,%0"
3768 [(set_attr "type" "fadd")
3769 (set_attr "trap" "yes")
3770 (set_attr "trap_suffix" "su")])
3772 (define_insn "*cmpdf_ieee_ext3"
3773 [(set (match_operand:DF 0 "register_operand" "=&f")
3774 (match_operator:DF 1 "alpha_fp_comparison_operator"
3776 (match_operand:SF 2 "reg_or_0_operand" "fG"))
3778 (match_operand:SF 3 "reg_or_0_operand" "fG"))]))]
3779 "TARGET_FP && alpha_fptm >= ALPHA_FPTM_SU"
3780 "cmp%-%C1%/ %R2,%R3,%0"
3781 [(set_attr "type" "fadd")
3782 (set_attr "trap" "yes")
3783 (set_attr "trap_suffix" "su")])
3785 (define_insn "*cmpdf_ext3"
3786 [(set (match_operand:DF 0 "register_operand" "=f")
3787 (match_operator:DF 1 "alpha_fp_comparison_operator"
3789 (match_operand:SF 2 "reg_or_0_operand" "fG"))
3791 (match_operand:SF 3 "reg_or_0_operand" "fG"))]))]
3792 "TARGET_FP && alpha_fptm < ALPHA_FPTM_SU"
3793 "cmp%-%C1%/ %R2,%R3,%0"
3794 [(set_attr "type" "fadd")
3795 (set_attr "trap" "yes")
3796 (set_attr "trap_suffix" "su")])
3798 (define_insn "*movdfcc_internal"
3799 [(set (match_operand:DF 0 "register_operand" "=f,f")
3801 (match_operator 3 "signed_comparison_operator"
3802 [(match_operand:DF 4 "reg_or_0_operand" "fG,fG")
3803 (match_operand:DF 2 "const0_operand" "G,G")])
3804 (match_operand:DF 1 "reg_or_0_operand" "fG,0")
3805 (match_operand:DF 5 "reg_or_0_operand" "0,fG")))]
3809 fcmov%D3 %R4,%R5,%0"
3810 [(set_attr "type" "fcmov")])
3812 (define_insn "*movsfcc_internal"
3813 [(set (match_operand:SF 0 "register_operand" "=f,f")
3815 (match_operator 3 "signed_comparison_operator"
3816 [(match_operand:DF 4 "reg_or_0_operand" "fG,fG")
3817 (match_operand:DF 2 "const0_operand" "G,G")])
3818 (match_operand:SF 1 "reg_or_0_operand" "fG,0")
3819 (match_operand:SF 5 "reg_or_0_operand" "0,fG")))]
3823 fcmov%D3 %R4,%R5,%0"
3824 [(set_attr "type" "fcmov")])
3826 (define_insn "*movdfcc_ext1"
3827 [(set (match_operand:DF 0 "register_operand" "=f,f")
3829 (match_operator 3 "signed_comparison_operator"
3830 [(match_operand:DF 4 "reg_or_0_operand" "fG,fG")
3831 (match_operand:DF 2 "const0_operand" "G,G")])
3832 (float_extend:DF (match_operand:SF 1 "reg_or_0_operand" "fG,0"))
3833 (match_operand:DF 5 "reg_or_0_operand" "0,fG")))]
3837 fcmov%D3 %R4,%R5,%0"
3838 [(set_attr "type" "fcmov")])
3840 (define_insn "*movdfcc_ext2"
3841 [(set (match_operand:DF 0 "register_operand" "=f,f")
3843 (match_operator 3 "signed_comparison_operator"
3845 (match_operand:SF 4 "reg_or_0_operand" "fG,fG"))
3846 (match_operand:DF 2 "const0_operand" "G,G")])
3847 (match_operand:DF 1 "reg_or_0_operand" "fG,0")
3848 (match_operand:DF 5 "reg_or_0_operand" "0,fG")))]
3852 fcmov%D3 %R4,%R5,%0"
3853 [(set_attr "type" "fcmov")])
3855 (define_insn "*movdfcc_ext3"
3856 [(set (match_operand:SF 0 "register_operand" "=f,f")
3858 (match_operator 3 "signed_comparison_operator"
3860 (match_operand:SF 4 "reg_or_0_operand" "fG,fG"))
3861 (match_operand:DF 2 "const0_operand" "G,G")])
3862 (match_operand:SF 1 "reg_or_0_operand" "fG,0")
3863 (match_operand:SF 5 "reg_or_0_operand" "0,fG")))]
3867 fcmov%D3 %R4,%R5,%0"
3868 [(set_attr "type" "fcmov")])
3870 (define_insn "*movdfcc_ext4"
3871 [(set (match_operand:DF 0 "register_operand" "=f,f")
3873 (match_operator 3 "signed_comparison_operator"
3875 (match_operand:SF 4 "reg_or_0_operand" "fG,fG"))
3876 (match_operand:DF 2 "const0_operand" "G,G")])
3877 (float_extend:DF (match_operand:SF 1 "reg_or_0_operand" "fG,0"))
3878 (match_operand:DF 5 "reg_or_0_operand" "0,fG")))]
3882 fcmov%D3 %R4,%R5,%0"
3883 [(set_attr "type" "fcmov")])
3885 (define_expand "smaxdf3"
3887 (le:DF (match_operand:DF 1 "reg_or_0_operand" "")
3888 (match_operand:DF 2 "reg_or_0_operand" "")))
3889 (set (match_operand:DF 0 "register_operand" "")
3890 (if_then_else:DF (eq (match_dup 3) (match_dup 4))
3891 (match_dup 1) (match_dup 2)))]
3894 operands[3] = gen_reg_rtx (DFmode);
3895 operands[4] = CONST0_RTX (DFmode);
3898 (define_expand "smindf3"
3900 (lt:DF (match_operand:DF 1 "reg_or_0_operand" "")
3901 (match_operand:DF 2 "reg_or_0_operand" "")))
3902 (set (match_operand:DF 0 "register_operand" "")
3903 (if_then_else:DF (ne (match_dup 3) (match_dup 4))
3904 (match_dup 1) (match_dup 2)))]
3907 operands[3] = gen_reg_rtx (DFmode);
3908 operands[4] = CONST0_RTX (DFmode);
3911 (define_expand "smaxsf3"
3913 (le:DF (float_extend:DF (match_operand:SF 1 "reg_or_0_operand" ""))
3914 (float_extend:DF (match_operand:SF 2 "reg_or_0_operand" ""))))
3915 (set (match_operand:SF 0 "register_operand" "")
3916 (if_then_else:SF (eq (match_dup 3) (match_dup 4))
3917 (match_dup 1) (match_dup 2)))]
3920 operands[3] = gen_reg_rtx (DFmode);
3921 operands[4] = CONST0_RTX (DFmode);
3924 (define_expand "sminsf3"
3926 (lt:DF (float_extend:DF (match_operand:SF 1 "reg_or_0_operand" ""))
3927 (float_extend:DF (match_operand:SF 2 "reg_or_0_operand" ""))))
3928 (set (match_operand:SF 0 "register_operand" "")
3929 (if_then_else:SF (ne (match_dup 3) (match_dup 4))
3930 (match_dup 1) (match_dup 2)))]
3933 operands[3] = gen_reg_rtx (DFmode);
3934 operands[4] = CONST0_RTX (DFmode);
3937 (define_insn "*fbcc_normal"
3940 (match_operator 1 "signed_comparison_operator"
3941 [(match_operand:DF 2 "reg_or_0_operand" "fG")
3942 (match_operand:DF 3 "const0_operand" "G")])
3943 (label_ref (match_operand 0 "" ""))
3947 [(set_attr "type" "fbr")])
3949 (define_insn "*fbcc_ext_normal"
3952 (match_operator 1 "signed_comparison_operator"
3954 (match_operand:SF 2 "reg_or_0_operand" "fG"))
3955 (match_operand:DF 3 "const0_operand" "G")])
3956 (label_ref (match_operand 0 "" ""))
3960 [(set_attr "type" "fbr")])
3962 ;; These are the main define_expand's used to make conditional branches
3965 (define_expand "cmpdf"
3966 [(set (cc0) (compare (match_operand:DF 0 "reg_or_0_operand" "")
3967 (match_operand:DF 1 "reg_or_0_operand" "")))]
3970 alpha_compare.op0 = operands[0];
3971 alpha_compare.op1 = operands[1];
3972 alpha_compare.fp_p = 1;
3976 (define_expand "cmptf"
3977 [(set (cc0) (compare (match_operand:TF 0 "general_operand" "")
3978 (match_operand:TF 1 "general_operand" "")))]
3979 "TARGET_HAS_XFLOATING_LIBS"
3981 alpha_compare.op0 = operands[0];
3982 alpha_compare.op1 = operands[1];
3983 alpha_compare.fp_p = 1;
3987 (define_expand "cmpdi"
3988 [(set (cc0) (compare (match_operand:DI 0 "some_operand" "")
3989 (match_operand:DI 1 "some_operand" "")))]
3992 alpha_compare.op0 = operands[0];
3993 alpha_compare.op1 = operands[1];
3994 alpha_compare.fp_p = 0;
3998 (define_expand "beq"
4000 (if_then_else (match_dup 1)
4001 (label_ref (match_operand 0 "" ""))
4004 "{ operands[1] = alpha_emit_conditional_branch (EQ); }")
4006 (define_expand "bne"
4008 (if_then_else (match_dup 1)
4009 (label_ref (match_operand 0 "" ""))
4012 "{ operands[1] = alpha_emit_conditional_branch (NE); }")
4014 (define_expand "blt"
4016 (if_then_else (match_dup 1)
4017 (label_ref (match_operand 0 "" ""))
4020 "{ operands[1] = alpha_emit_conditional_branch (LT); }")
4022 (define_expand "ble"
4024 (if_then_else (match_dup 1)
4025 (label_ref (match_operand 0 "" ""))
4028 "{ operands[1] = alpha_emit_conditional_branch (LE); }")
4030 (define_expand "bgt"
4032 (if_then_else (match_dup 1)
4033 (label_ref (match_operand 0 "" ""))
4036 "{ operands[1] = alpha_emit_conditional_branch (GT); }")
4038 (define_expand "bge"
4040 (if_then_else (match_dup 1)
4041 (label_ref (match_operand 0 "" ""))
4044 "{ operands[1] = alpha_emit_conditional_branch (GE); }")
4046 (define_expand "bltu"
4048 (if_then_else (match_dup 1)
4049 (label_ref (match_operand 0 "" ""))
4052 "{ operands[1] = alpha_emit_conditional_branch (LTU); }")
4054 (define_expand "bleu"
4056 (if_then_else (match_dup 1)
4057 (label_ref (match_operand 0 "" ""))
4060 "{ operands[1] = alpha_emit_conditional_branch (LEU); }")
4062 (define_expand "bgtu"
4064 (if_then_else (match_dup 1)
4065 (label_ref (match_operand 0 "" ""))
4068 "{ operands[1] = alpha_emit_conditional_branch (GTU); }")
4070 (define_expand "bgeu"
4072 (if_then_else (match_dup 1)
4073 (label_ref (match_operand 0 "" ""))
4076 "{ operands[1] = alpha_emit_conditional_branch (GEU); }")
4078 (define_expand "bunordered"
4080 (if_then_else (match_dup 1)
4081 (label_ref (match_operand 0 "" ""))
4084 "{ operands[1] = alpha_emit_conditional_branch (UNORDERED); }")
4086 (define_expand "bordered"
4088 (if_then_else (match_dup 1)
4089 (label_ref (match_operand 0 "" ""))
4092 "{ operands[1] = alpha_emit_conditional_branch (ORDERED); }")
4094 (define_expand "seq"
4095 [(set (match_operand:DI 0 "register_operand" "")
4098 "{ if ((operands[1] = alpha_emit_setcc (EQ)) == NULL_RTX) FAIL; }")
4100 (define_expand "sne"
4101 [(set (match_operand:DI 0 "register_operand" "")
4104 "{ if ((operands[1] = alpha_emit_setcc (NE)) == NULL_RTX) FAIL; }")
4106 (define_expand "slt"
4107 [(set (match_operand:DI 0 "register_operand" "")
4110 "{ if ((operands[1] = alpha_emit_setcc (LT)) == NULL_RTX) FAIL; }")
4112 (define_expand "sle"
4113 [(set (match_operand:DI 0 "register_operand" "")
4116 "{ if ((operands[1] = alpha_emit_setcc (LE)) == NULL_RTX) FAIL; }")
4118 (define_expand "sgt"
4119 [(set (match_operand:DI 0 "register_operand" "")
4122 "{ if ((operands[1] = alpha_emit_setcc (GT)) == NULL_RTX) FAIL; }")
4124 (define_expand "sge"
4125 [(set (match_operand:DI 0 "register_operand" "")
4128 "{ if ((operands[1] = alpha_emit_setcc (GE)) == NULL_RTX) FAIL; }")
4130 (define_expand "sltu"
4131 [(set (match_operand:DI 0 "register_operand" "")
4134 "{ if ((operands[1] = alpha_emit_setcc (LTU)) == NULL_RTX) FAIL; }")
4136 (define_expand "sleu"
4137 [(set (match_operand:DI 0 "register_operand" "")
4140 "{ if ((operands[1] = alpha_emit_setcc (LEU)) == NULL_RTX) FAIL; }")
4142 (define_expand "sgtu"
4143 [(set (match_operand:DI 0 "register_operand" "")
4146 "{ if ((operands[1] = alpha_emit_setcc (GTU)) == NULL_RTX) FAIL; }")
4148 (define_expand "sgeu"
4149 [(set (match_operand:DI 0 "register_operand" "")
4152 "{ if ((operands[1] = alpha_emit_setcc (GEU)) == NULL_RTX) FAIL; }")
4154 (define_expand "sunordered"
4155 [(set (match_operand:DI 0 "register_operand" "")
4158 "{ if ((operands[1] = alpha_emit_setcc (UNORDERED)) == NULL_RTX) FAIL; }")
4160 (define_expand "sordered"
4161 [(set (match_operand:DI 0 "register_operand" "")
4164 "{ if ((operands[1] = alpha_emit_setcc (ORDERED)) == NULL_RTX) FAIL; }")
4166 ;; These are the main define_expand's used to make conditional moves.
4168 (define_expand "movsicc"
4169 [(set (match_operand:SI 0 "register_operand" "")
4170 (if_then_else:SI (match_operand 1 "comparison_operator" "")
4171 (match_operand:SI 2 "reg_or_8bit_operand" "")
4172 (match_operand:SI 3 "reg_or_8bit_operand" "")))]
4175 if ((operands[1] = alpha_emit_conditional_move (operands[1], SImode)) == 0)
4179 (define_expand "movdicc"
4180 [(set (match_operand:DI 0 "register_operand" "")
4181 (if_then_else:DI (match_operand 1 "comparison_operator" "")
4182 (match_operand:DI 2 "reg_or_8bit_operand" "")
4183 (match_operand:DI 3 "reg_or_8bit_operand" "")))]
4186 if ((operands[1] = alpha_emit_conditional_move (operands[1], DImode)) == 0)
4190 (define_expand "movsfcc"
4191 [(set (match_operand:SF 0 "register_operand" "")
4192 (if_then_else:SF (match_operand 1 "comparison_operator" "")
4193 (match_operand:SF 2 "reg_or_8bit_operand" "")
4194 (match_operand:SF 3 "reg_or_8bit_operand" "")))]
4197 if ((operands[1] = alpha_emit_conditional_move (operands[1], SFmode)) == 0)
4201 (define_expand "movdfcc"
4202 [(set (match_operand:DF 0 "register_operand" "")
4203 (if_then_else:DF (match_operand 1 "comparison_operator" "")
4204 (match_operand:DF 2 "reg_or_8bit_operand" "")
4205 (match_operand:DF 3 "reg_or_8bit_operand" "")))]
4208 if ((operands[1] = alpha_emit_conditional_move (operands[1], DFmode)) == 0)
4212 ;; These define_split definitions are used in cases when comparisons have
4213 ;; not be stated in the correct way and we need to reverse the second
4214 ;; comparison. For example, x >= 7 has to be done as x < 6 with the
4215 ;; comparison that tests the result being reversed. We have one define_split
4216 ;; for each use of a comparison. They do not match valid insns and need
4217 ;; not generate valid insns.
4219 ;; We can also handle equality comparisons (and inequality comparisons in
4220 ;; cases where the resulting add cannot overflow) by doing an add followed by
4221 ;; a comparison with zero. This is faster since the addition takes one
4222 ;; less cycle than a compare when feeding into a conditional move.
4223 ;; For this case, we also have an SImode pattern since we can merge the add
4224 ;; and sign extend and the order doesn't matter.
4226 ;; We do not do this for floating-point, since it isn't clear how the "wrong"
4227 ;; operation could have been generated.
4230 [(set (match_operand:DI 0 "register_operand" "")
4232 (match_operator 1 "comparison_operator"
4233 [(match_operand:DI 2 "reg_or_0_operand" "")
4234 (match_operand:DI 3 "reg_or_cint_operand" "")])
4235 (match_operand:DI 4 "reg_or_cint_operand" "")
4236 (match_operand:DI 5 "reg_or_cint_operand" "")))
4237 (clobber (match_operand:DI 6 "register_operand" ""))]
4238 "operands[3] != const0_rtx"
4239 [(set (match_dup 6) (match_dup 7))
4241 (if_then_else:DI (match_dup 8) (match_dup 4) (match_dup 5)))]
4243 enum rtx_code code = GET_CODE (operands[1]);
4244 int unsignedp = (code == GEU || code == LEU || code == GTU || code == LTU);
4246 /* If we are comparing for equality with a constant and that constant
4247 appears in the arm when the register equals the constant, use the
4248 register since that is more likely to match (and to produce better code
4251 if (code == EQ && GET_CODE (operands[3]) == CONST_INT
4252 && rtx_equal_p (operands[4], operands[3]))
4253 operands[4] = operands[2];
4255 else if (code == NE && GET_CODE (operands[3]) == CONST_INT
4256 && rtx_equal_p (operands[5], operands[3]))
4257 operands[5] = operands[2];
4259 if (code == NE || code == EQ
4260 || (extended_count (operands[2], DImode, unsignedp) >= 1
4261 && extended_count (operands[3], DImode, unsignedp) >= 1))
4263 if (GET_CODE (operands[3]) == CONST_INT)
4264 operands[7] = gen_rtx_PLUS (DImode, operands[2],
4265 GEN_INT (- INTVAL (operands[3])));
4267 operands[7] = gen_rtx_MINUS (DImode, operands[2], operands[3]);
4269 operands[8] = gen_rtx_fmt_ee (code, VOIDmode, operands[6], const0_rtx);
4272 else if (code == EQ || code == LE || code == LT
4273 || code == LEU || code == LTU)
4275 operands[7] = gen_rtx_fmt_ee (code, DImode, operands[2], operands[3]);
4276 operands[8] = gen_rtx_NE (VOIDmode, operands[6], const0_rtx);
4280 operands[7] = gen_rtx_fmt_ee (reverse_condition (code), DImode,
4281 operands[2], operands[3]);
4282 operands[8] = gen_rtx_EQ (VOIDmode, operands[6], const0_rtx);
4287 [(set (match_operand:DI 0 "register_operand" "")
4289 (match_operator 1 "comparison_operator"
4290 [(match_operand:SI 2 "reg_or_0_operand" "")
4291 (match_operand:SI 3 "reg_or_cint_operand" "")])
4292 (match_operand:DI 4 "reg_or_8bit_operand" "")
4293 (match_operand:DI 5 "reg_or_8bit_operand" "")))
4294 (clobber (match_operand:DI 6 "register_operand" ""))]
4295 "operands[3] != const0_rtx
4296 && (GET_CODE (operands[1]) == EQ || GET_CODE (operands[1]) == NE)"
4297 [(set (match_dup 6) (match_dup 7))
4299 (if_then_else:DI (match_dup 8) (match_dup 4) (match_dup 5)))]
4301 enum rtx_code code = GET_CODE (operands[1]);
4302 int unsignedp = (code == GEU || code == LEU || code == GTU || code == LTU);
4305 if ((code != NE && code != EQ
4306 && ! (extended_count (operands[2], DImode, unsignedp) >= 1
4307 && extended_count (operands[3], DImode, unsignedp) >= 1)))
4310 if (GET_CODE (operands[3]) == CONST_INT)
4311 tem = gen_rtx_PLUS (SImode, operands[2],
4312 GEN_INT (- INTVAL (operands[3])));
4314 tem = gen_rtx_MINUS (SImode, operands[2], operands[3]);
4316 operands[7] = gen_rtx_SIGN_EXTEND (DImode, tem);
4317 operands[8] = gen_rtx_fmt_ee (GET_CODE (operands[1]), VOIDmode,
4318 operands[6], const0_rtx);
4321 ;; Prefer to use cmp and arithmetic when possible instead of a cmove.
4324 [(set (match_operand 0 "register_operand" "")
4325 (if_then_else (match_operator 1 "signed_comparison_operator"
4326 [(match_operand:DI 2 "reg_or_0_operand" "")
4328 (match_operand 3 "const_int_operand" "")
4329 (match_operand 4 "const_int_operand" "")))]
4333 if (alpha_split_conditional_move (GET_CODE (operands[1]), operands[0],
4334 operands[2], operands[3], operands[4]))
4340 ;; ??? Why combine is allowed to create such non-canonical rtl, I don't know.
4341 ;; Oh well, we match it in movcc, so it must be partially our fault.
4343 [(set (match_operand 0 "register_operand" "")
4344 (if_then_else (match_operator 1 "signed_comparison_operator"
4346 (match_operand:DI 2 "reg_or_0_operand" "")])
4347 (match_operand 3 "const_int_operand" "")
4348 (match_operand 4 "const_int_operand" "")))]
4352 if (alpha_split_conditional_move (swap_condition (GET_CODE (operands[1])),
4353 operands[0], operands[2], operands[3],
4360 (define_insn_and_split "*cmp_sadd_di"
4361 [(set (match_operand:DI 0 "register_operand" "=r")
4362 (plus:DI (if_then_else:DI
4363 (match_operator 1 "alpha_zero_comparison_operator"
4364 [(match_operand:DI 2 "reg_or_0_operand" "rJ")
4366 (match_operand:DI 3 "const48_operand" "I")
4368 (match_operand:DI 4 "sext_add_operand" "rIO")))
4369 (clobber (match_scratch:DI 5 "=r"))]
4374 (match_op_dup:DI 1 [(match_dup 2) (const_int 0)]))
4376 (plus:DI (mult:DI (match_dup 5) (match_dup 3))
4379 if (can_create_pseudo_p ())
4380 operands[5] = gen_reg_rtx (DImode);
4381 else if (reg_overlap_mentioned_p (operands[5], operands[4]))
4382 operands[5] = operands[0];
4385 (define_insn_and_split "*cmp_sadd_si"
4386 [(set (match_operand:SI 0 "register_operand" "=r")
4387 (plus:SI (if_then_else:SI
4388 (match_operator 1 "alpha_zero_comparison_operator"
4389 [(match_operand:DI 2 "reg_or_0_operand" "rJ")
4391 (match_operand:SI 3 "const48_operand" "I")
4393 (match_operand:SI 4 "sext_add_operand" "rIO")))
4394 (clobber (match_scratch:SI 5 "=r"))]
4399 (match_op_dup:SI 1 [(match_dup 2) (const_int 0)]))
4401 (plus:SI (mult:SI (match_dup 5) (match_dup 3))
4404 if (can_create_pseudo_p ())
4405 operands[5] = gen_reg_rtx (DImode);
4406 else if (reg_overlap_mentioned_p (operands[5], operands[4]))
4407 operands[5] = operands[0];
4410 (define_insn_and_split "*cmp_sadd_sidi"
4411 [(set (match_operand:DI 0 "register_operand" "=r")
4413 (plus:SI (if_then_else:SI
4414 (match_operator 1 "alpha_zero_comparison_operator"
4415 [(match_operand:DI 2 "reg_or_0_operand" "rJ")
4417 (match_operand:SI 3 "const48_operand" "I")
4419 (match_operand:SI 4 "sext_add_operand" "rIO"))))
4420 (clobber (match_scratch:SI 5 "=r"))]
4425 (match_op_dup:SI 1 [(match_dup 2) (const_int 0)]))
4427 (sign_extend:DI (plus:SI (mult:SI (match_dup 5) (match_dup 3))
4430 if (can_create_pseudo_p ())
4431 operands[5] = gen_reg_rtx (DImode);
4432 else if (reg_overlap_mentioned_p (operands[5], operands[4]))
4433 operands[5] = operands[0];
4436 (define_insn_and_split "*cmp_ssub_di"
4437 [(set (match_operand:DI 0 "register_operand" "=r")
4438 (minus:DI (if_then_else:DI
4439 (match_operator 1 "alpha_zero_comparison_operator"
4440 [(match_operand:DI 2 "reg_or_0_operand" "rJ")
4442 (match_operand:DI 3 "const48_operand" "I")
4444 (match_operand:DI 4 "reg_or_8bit_operand" "rI")))
4445 (clobber (match_scratch:DI 5 "=r"))]
4450 (match_op_dup:DI 1 [(match_dup 2) (const_int 0)]))
4452 (minus:DI (mult:DI (match_dup 5) (match_dup 3))
4455 if (can_create_pseudo_p ())
4456 operands[5] = gen_reg_rtx (DImode);
4457 else if (reg_overlap_mentioned_p (operands[5], operands[4]))
4458 operands[5] = operands[0];
4461 (define_insn_and_split "*cmp_ssub_si"
4462 [(set (match_operand:SI 0 "register_operand" "=r")
4463 (minus:SI (if_then_else:SI
4464 (match_operator 1 "alpha_zero_comparison_operator"
4465 [(match_operand:DI 2 "reg_or_0_operand" "rJ")
4467 (match_operand:SI 3 "const48_operand" "I")
4469 (match_operand:SI 4 "reg_or_8bit_operand" "rI")))
4470 (clobber (match_scratch:SI 5 "=r"))]
4475 (match_op_dup:SI 1 [(match_dup 2) (const_int 0)]))
4477 (minus:SI (mult:SI (match_dup 5) (match_dup 3))
4480 if (can_create_pseudo_p ())
4481 operands[5] = gen_reg_rtx (DImode);
4482 else if (reg_overlap_mentioned_p (operands[5], operands[4]))
4483 operands[5] = operands[0];
4486 (define_insn_and_split "*cmp_ssub_sidi"
4487 [(set (match_operand:DI 0 "register_operand" "=r")
4489 (minus:SI (if_then_else:SI
4490 (match_operator 1 "alpha_zero_comparison_operator"
4491 [(match_operand:DI 2 "reg_or_0_operand" "rJ")
4493 (match_operand:SI 3 "const48_operand" "I")
4495 (match_operand:SI 4 "reg_or_8bit_operand" "rI"))))
4496 (clobber (match_scratch:SI 5 "=r"))]
4501 (match_op_dup:SI 1 [(match_dup 2) (const_int 0)]))
4503 (sign_extend:DI (minus:SI (mult:SI (match_dup 5) (match_dup 3))
4506 if (can_create_pseudo_p ())
4507 operands[5] = gen_reg_rtx (DImode);
4508 else if (reg_overlap_mentioned_p (operands[5], operands[4]))
4509 operands[5] = operands[0];
4512 ;; Here are the CALL and unconditional branch insns. Calls on NT and OSF
4513 ;; work differently, so we have different patterns for each.
4515 ;; On Unicos/Mk a call information word (CIW) must be generated for each
4516 ;; call. The CIW contains information about arguments passed in registers
4517 ;; and is stored in the caller's SSIB. Its offset relative to the beginning
4518 ;; of the SSIB is passed in $25. Handling this properly is quite complicated
4519 ;; in the presence of inlining since the CIWs for calls performed by the
4520 ;; inlined function must be stored in the SSIB of the function it is inlined
4521 ;; into as well. We encode the CIW in an unspec and append it to the list
4522 ;; of the CIWs for the current function only when the instruction for loading
4523 ;; $25 is generated.
4525 (define_expand "call"
4526 [(use (match_operand:DI 0 "" ""))
4527 (use (match_operand 1 "" ""))
4528 (use (match_operand 2 "" ""))
4529 (use (match_operand 3 "" ""))]
4532 if (TARGET_ABI_WINDOWS_NT)
4533 emit_call_insn (gen_call_nt (operands[0], operands[1]));
4534 else if (TARGET_ABI_OPEN_VMS)
4535 emit_call_insn (gen_call_vms (operands[0], operands[2]));
4536 else if (TARGET_ABI_UNICOSMK)
4537 emit_call_insn (gen_call_umk (operands[0], operands[2]));
4539 emit_call_insn (gen_call_osf (operands[0], operands[1]));
4543 (define_expand "sibcall"
4544 [(parallel [(call (mem:DI (match_operand 0 "" ""))
4545 (match_operand 1 "" ""))
4546 (unspec [(reg:DI 29)] UNSPEC_SIBCALL)])]
4549 gcc_assert (GET_CODE (operands[0]) == MEM);
4550 operands[0] = XEXP (operands[0], 0);
4553 (define_expand "call_osf"
4554 [(parallel [(call (mem:DI (match_operand 0 "" ""))
4555 (match_operand 1 "" ""))
4557 (clobber (reg:DI 26))])]
4560 gcc_assert (GET_CODE (operands[0]) == MEM);
4562 operands[0] = XEXP (operands[0], 0);
4563 if (! call_operand (operands[0], Pmode))
4564 operands[0] = copy_to_mode_reg (Pmode, operands[0]);
4567 (define_expand "call_nt"
4568 [(parallel [(call (mem:DI (match_operand 0 "" ""))
4569 (match_operand 1 "" ""))
4570 (clobber (reg:DI 26))])]
4573 gcc_assert (GET_CODE (operands[0]) == MEM);
4575 operands[0] = XEXP (operands[0], 0);
4576 if (GET_CODE (operands[0]) != SYMBOL_REF && GET_CODE (operands[0]) != REG)
4577 operands[0] = force_reg (DImode, operands[0]);
4580 ;; Calls on Unicos/Mk are always indirect.
4581 ;; op 0: symbol ref for called function
4582 ;; op 1: CIW for $25 represented by an unspec
4584 (define_expand "call_umk"
4585 [(parallel [(call (mem:DI (match_operand 0 "" ""))
4586 (match_operand 1 "" ""))
4588 (clobber (reg:DI 26))])]
4591 gcc_assert (GET_CODE (operands[0]) == MEM);
4593 /* Always load the address of the called function into a register;
4594 load the CIW in $25. */
4596 operands[0] = XEXP (operands[0], 0);
4597 if (GET_CODE (operands[0]) != REG)
4598 operands[0] = force_reg (DImode, operands[0]);
4600 emit_move_insn (gen_rtx_REG (DImode, 25), operands[1]);
4604 ;; call openvms/alpha
4605 ;; op 0: symbol ref for called function
4606 ;; op 1: next_arg_reg (argument information value for R25)
4608 (define_expand "call_vms"
4609 [(parallel [(call (mem:DI (match_operand 0 "" ""))
4610 (match_operand 1 "" ""))
4614 (clobber (reg:DI 27))])]
4617 gcc_assert (GET_CODE (operands[0]) == MEM);
4619 operands[0] = XEXP (operands[0], 0);
4621 /* Always load AI with argument information, then handle symbolic and
4622 indirect call differently. Load RA and set operands[2] to PV in
4625 emit_move_insn (gen_rtx_REG (DImode, 25), operands[1]);
4626 if (GET_CODE (operands[0]) == SYMBOL_REF)
4628 alpha_need_linkage (XSTR (operands[0], 0), 0);
4630 operands[2] = const0_rtx;
4634 emit_move_insn (gen_rtx_REG (Pmode, 26),
4635 gen_rtx_MEM (Pmode, plus_constant (operands[0], 8)));
4636 operands[2] = operands[0];
4641 (define_expand "call_value"
4642 [(use (match_operand 0 "" ""))
4643 (use (match_operand:DI 1 "" ""))
4644 (use (match_operand 2 "" ""))
4645 (use (match_operand 3 "" ""))
4646 (use (match_operand 4 "" ""))]
4649 if (TARGET_ABI_WINDOWS_NT)
4650 emit_call_insn (gen_call_value_nt (operands[0], operands[1], operands[2]));
4651 else if (TARGET_ABI_OPEN_VMS)
4652 emit_call_insn (gen_call_value_vms (operands[0], operands[1],
4654 else if (TARGET_ABI_UNICOSMK)
4655 emit_call_insn (gen_call_value_umk (operands[0], operands[1],
4658 emit_call_insn (gen_call_value_osf (operands[0], operands[1],
4663 (define_expand "sibcall_value"
4664 [(parallel [(set (match_operand 0 "" "")
4665 (call (mem:DI (match_operand 1 "" ""))
4666 (match_operand 2 "" "")))
4667 (unspec [(reg:DI 29)] UNSPEC_SIBCALL)])]
4670 gcc_assert (GET_CODE (operands[1]) == MEM);
4671 operands[1] = XEXP (operands[1], 0);
4674 (define_expand "call_value_osf"
4675 [(parallel [(set (match_operand 0 "" "")
4676 (call (mem:DI (match_operand 1 "" ""))
4677 (match_operand 2 "" "")))
4679 (clobber (reg:DI 26))])]
4682 gcc_assert (GET_CODE (operands[1]) == MEM);
4684 operands[1] = XEXP (operands[1], 0);
4685 if (! call_operand (operands[1], Pmode))
4686 operands[1] = copy_to_mode_reg (Pmode, operands[1]);
4689 (define_expand "call_value_nt"
4690 [(parallel [(set (match_operand 0 "" "")
4691 (call (mem:DI (match_operand 1 "" ""))
4692 (match_operand 2 "" "")))
4693 (clobber (reg:DI 26))])]
4696 gcc_assert (GET_CODE (operands[1]) == MEM);
4698 operands[1] = XEXP (operands[1], 0);
4699 if (GET_CODE (operands[1]) != SYMBOL_REF && GET_CODE (operands[1]) != REG)
4700 operands[1] = force_reg (DImode, operands[1]);
4703 (define_expand "call_value_vms"
4704 [(parallel [(set (match_operand 0 "" "")
4705 (call (mem:DI (match_operand:DI 1 "" ""))
4706 (match_operand 2 "" "")))
4710 (clobber (reg:DI 27))])]
4713 gcc_assert (GET_CODE (operands[1]) == MEM);
4715 operands[1] = XEXP (operands[1], 0);
4717 /* Always load AI with argument information, then handle symbolic and
4718 indirect call differently. Load RA and set operands[3] to PV in
4721 emit_move_insn (gen_rtx_REG (DImode, 25), operands[2]);
4722 if (GET_CODE (operands[1]) == SYMBOL_REF)
4724 alpha_need_linkage (XSTR (operands[1], 0), 0);
4726 operands[3] = const0_rtx;
4730 emit_move_insn (gen_rtx_REG (Pmode, 26),
4731 gen_rtx_MEM (Pmode, plus_constant (operands[1], 8)));
4732 operands[3] = operands[1];
4736 (define_expand "call_value_umk"
4737 [(parallel [(set (match_operand 0 "" "")
4738 (call (mem:DI (match_operand 1 "" ""))
4739 (match_operand 2 "" "")))
4741 (clobber (reg:DI 26))])]
4744 gcc_assert (GET_CODE (operands[1]) == MEM);
4746 operands[1] = XEXP (operands[1], 0);
4747 if (GET_CODE (operands[1]) != REG)
4748 operands[1] = force_reg (DImode, operands[1]);
4750 emit_move_insn (gen_rtx_REG (DImode, 25), operands[2]);
4753 (define_insn "*call_osf_1_er_noreturn"
4754 [(call (mem:DI (match_operand:DI 0 "call_operand" "c,R,s"))
4755 (match_operand 1 "" ""))
4757 (clobber (reg:DI 26))]
4758 "TARGET_EXPLICIT_RELOCS && TARGET_ABI_OSF
4759 && find_reg_note (insn, REG_NORETURN, NULL_RTX)"
4762 bsr $26,%0\t\t!samegp
4763 ldq $27,%0($29)\t\t!literal!%#\;jsr $26,($27),%0\t\t!lituse_jsr!%#"
4764 [(set_attr "type" "jsr")
4765 (set_attr "length" "*,*,8")])
4767 (define_insn "*call_osf_1_er"
4768 [(call (mem:DI (match_operand:DI 0 "call_operand" "c,R,s"))
4769 (match_operand 1 "" ""))
4771 (clobber (reg:DI 26))]
4772 "TARGET_EXPLICIT_RELOCS && TARGET_ABI_OSF"
4774 jsr $26,(%0),0\;ldah $29,0($26)\t\t!gpdisp!%*\;lda $29,0($29)\t\t!gpdisp!%*
4775 bsr $26,%0\t\t!samegp
4776 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!%*"
4777 [(set_attr "type" "jsr")
4778 (set_attr "length" "12,*,16")])
4780 ;; We must use peep2 instead of a split because we need accurate life
4781 ;; information for $gp. Consider the case of { bar(); while (1); }.
4783 [(parallel [(call (mem:DI (match_operand:DI 0 "call_operand" ""))
4784 (match_operand 1 "" ""))
4786 (clobber (reg:DI 26))])]
4787 "TARGET_EXPLICIT_RELOCS && TARGET_ABI_OSF && reload_completed
4788 && ! samegp_function_operand (operands[0], Pmode)
4789 && (peep2_regno_dead_p (1, 29)
4790 || find_reg_note (insn, REG_NORETURN, NULL_RTX))"
4791 [(parallel [(call (mem:DI (match_dup 2))
4796 (clobber (reg:DI 26))])]
4798 if (CONSTANT_P (operands[0]))
4800 operands[2] = gen_rtx_REG (Pmode, 27);
4801 operands[3] = GEN_INT (alpha_next_sequence_number++);
4802 emit_insn (gen_movdi_er_high_g (operands[2], pic_offset_table_rtx,
4803 operands[0], operands[3]));
4807 operands[2] = operands[0];
4808 operands[0] = const0_rtx;
4809 operands[3] = const0_rtx;
4814 [(parallel [(call (mem:DI (match_operand:DI 0 "call_operand" ""))
4815 (match_operand 1 "" ""))
4817 (clobber (reg:DI 26))])]
4818 "TARGET_EXPLICIT_RELOCS && TARGET_ABI_OSF && reload_completed
4819 && ! samegp_function_operand (operands[0], Pmode)
4820 && ! (peep2_regno_dead_p (1, 29)
4821 || find_reg_note (insn, REG_NORETURN, NULL_RTX))"
4822 [(parallel [(call (mem:DI (match_dup 2))
4825 (unspec:DI [(match_dup 5) (match_dup 3)] UNSPEC_LDGP1))
4828 (clobber (reg:DI 26))])
4830 (unspec:DI [(match_dup 5) (match_dup 3)] UNSPEC_LDGP2))]
4832 if (CONSTANT_P (operands[0]))
4834 operands[2] = gen_rtx_REG (Pmode, 27);
4835 operands[4] = GEN_INT (alpha_next_sequence_number++);
4836 emit_insn (gen_movdi_er_high_g (operands[2], pic_offset_table_rtx,
4837 operands[0], operands[4]));
4841 operands[2] = operands[0];
4842 operands[0] = const0_rtx;
4843 operands[4] = const0_rtx;
4845 operands[3] = GEN_INT (alpha_next_sequence_number++);
4846 operands[5] = pic_offset_table_rtx;
4849 (define_insn "*call_osf_2_er_nogp"
4850 [(call (mem:DI (match_operand:DI 0 "register_operand" "c"))
4851 (match_operand 1 "" ""))
4853 (use (match_operand 2 "" ""))
4854 (use (match_operand 3 "const_int_operand" ""))
4855 (clobber (reg:DI 26))]
4856 "TARGET_EXPLICIT_RELOCS && TARGET_ABI_OSF"
4857 "jsr $26,(%0),%2%J3"
4858 [(set_attr "type" "jsr")])
4860 (define_insn "*call_osf_2_er"
4861 [(call (mem:DI (match_operand:DI 0 "register_operand" "c"))
4862 (match_operand 1 "" ""))
4864 (unspec:DI [(reg:DI 29) (match_operand 4 "const_int_operand" "")]
4866 (use (match_operand 2 "" ""))
4867 (use (match_operand 3 "const_int_operand" ""))
4868 (clobber (reg:DI 26))]
4869 "TARGET_EXPLICIT_RELOCS && TARGET_ABI_OSF"
4870 "jsr $26,(%0),%2%J3\;ldah $29,0($26)\t\t!gpdisp!%4"
4871 [(set_attr "type" "jsr")
4872 (set_attr "cannot_copy" "true")
4873 (set_attr "length" "8")])
4875 (define_insn "*call_osf_1_noreturn"
4876 [(call (mem:DI (match_operand:DI 0 "call_operand" "c,R,s"))
4877 (match_operand 1 "" ""))
4879 (clobber (reg:DI 26))]
4880 "! TARGET_EXPLICIT_RELOCS && TARGET_ABI_OSF
4881 && find_reg_note (insn, REG_NORETURN, NULL_RTX)"
4886 [(set_attr "type" "jsr")
4887 (set_attr "length" "*,*,8")])
4889 (define_insn "*call_osf_1"
4890 [(call (mem:DI (match_operand:DI 0 "call_operand" "c,R,s"))
4891 (match_operand 1 "" ""))
4893 (clobber (reg:DI 26))]
4894 "! TARGET_EXPLICIT_RELOCS && TARGET_ABI_OSF"
4896 jsr $26,($27),0\;ldgp $29,0($26)
4898 jsr $26,%0\;ldgp $29,0($26)"
4899 [(set_attr "type" "jsr")
4900 (set_attr "length" "12,*,16")])
4902 (define_insn "*sibcall_osf_1_er"
4903 [(call (mem:DI (match_operand:DI 0 "symbolic_operand" "R,s"))
4904 (match_operand 1 "" ""))
4905 (unspec [(reg:DI 29)] UNSPEC_SIBCALL)]
4906 "TARGET_EXPLICIT_RELOCS && TARGET_ABI_OSF"
4908 br $31,%0\t\t!samegp
4909 ldq $27,%0($29)\t\t!literal!%#\;jmp $31,($27),%0\t\t!lituse_jsr!%#"
4910 [(set_attr "type" "jsr")
4911 (set_attr "length" "*,8")])
4913 ;; Note that the DEC assembler expands "jmp foo" with $at, which
4914 ;; doesn't do what we want.
4915 (define_insn "*sibcall_osf_1"
4916 [(call (mem:DI (match_operand:DI 0 "symbolic_operand" "R,s"))
4917 (match_operand 1 "" ""))
4918 (unspec [(reg:DI 29)] UNSPEC_SIBCALL)]
4919 "! TARGET_EXPLICIT_RELOCS && TARGET_ABI_OSF"
4922 lda $27,%0\;jmp $31,($27),%0"
4923 [(set_attr "type" "jsr")
4924 (set_attr "length" "*,8")])
4926 (define_insn "*call_nt_1"
4927 [(call (mem:DI (match_operand:DI 0 "call_operand" "r,R,s"))
4928 (match_operand 1 "" ""))
4929 (clobber (reg:DI 26))]
4930 "TARGET_ABI_WINDOWS_NT"
4935 [(set_attr "type" "jsr")
4936 (set_attr "length" "*,*,12")])
4938 ; GAS relies on the order and position of instructions output below in order
4939 ; to generate relocs for VMS link to potentially optimize the call.
4940 ; Please do not molest.
4941 (define_insn "*call_vms_1"
4942 [(call (mem:DI (match_operand:DI 0 "call_operand" "r,s"))
4943 (match_operand 1 "" ""))
4944 (use (match_operand:DI 2 "nonmemory_operand" "r,n"))
4947 (clobber (reg:DI 27))]
4948 "TARGET_ABI_OPEN_VMS"
4950 switch (which_alternative)
4953 return "mov %2,$27\;jsr $26,0\;ldq $27,0($29)";
4955 operands [2] = alpha_use_linkage (operands [0], cfun->decl, 1, 0);
4956 operands [3] = alpha_use_linkage (operands [0], cfun->decl, 0, 0);
4957 return "ldq $26,%3\;ldq $27,%2\;jsr $26,%0\;ldq $27,0($29)";
4962 [(set_attr "type" "jsr")
4963 (set_attr "length" "12,16")])
4965 (define_insn "*call_umk_1"
4966 [(call (mem:DI (match_operand:DI 0 "call_operand" "r"))
4967 (match_operand 1 "" ""))
4969 (clobber (reg:DI 26))]
4970 "TARGET_ABI_UNICOSMK"
4972 [(set_attr "type" "jsr")])
4974 ;; Call subroutine returning any type.
4976 (define_expand "untyped_call"
4977 [(parallel [(call (match_operand 0 "" "")
4979 (match_operand 1 "" "")
4980 (match_operand 2 "" "")])]
4985 emit_call_insn (GEN_CALL (operands[0], const0_rtx, NULL, const0_rtx));
4987 for (i = 0; i < XVECLEN (operands[2], 0); i++)
4989 rtx set = XVECEXP (operands[2], 0, i);
4990 emit_move_insn (SET_DEST (set), SET_SRC (set));
4993 /* The optimizer does not know that the call sets the function value
4994 registers we stored in the result block. We avoid problems by
4995 claiming that all hard registers are used and clobbered at this
4997 emit_insn (gen_blockage ());
5002 ;; UNSPEC_VOLATILE is considered to use and clobber all hard registers and
5003 ;; all of memory. This blocks insns from being moved across this point.
5005 (define_insn "blockage"
5006 [(unspec_volatile [(const_int 0)] UNSPECV_BLOCKAGE)]
5009 [(set_attr "length" "0")
5010 (set_attr "type" "none")])
5014 (label_ref (match_operand 0 "" "")))]
5017 [(set_attr "type" "ibr")])
5019 (define_expand "return"
5024 (define_insn "*return_internal"
5028 [(set_attr "type" "ibr")])
5030 (define_insn "indirect_jump"
5031 [(set (pc) (match_operand:DI 0 "register_operand" "r"))]
5034 [(set_attr "type" "ibr")])
5036 (define_expand "tablejump"
5037 [(parallel [(set (pc)
5038 (match_operand 0 "register_operand" ""))
5039 (use (label_ref:DI (match_operand 1 "" "")))])]
5042 if (TARGET_ABI_WINDOWS_NT)
5044 rtx dest = gen_reg_rtx (DImode);
5045 emit_insn (gen_extendsidi2 (dest, operands[0]));
5048 else if (TARGET_ABI_OSF)
5050 rtx dest = gen_reg_rtx (DImode);
5051 emit_insn (gen_extendsidi2 (dest, operands[0]));
5052 emit_insn (gen_adddi3 (dest, pic_offset_table_rtx, dest));
5057 (define_insn "*tablejump_osf_nt_internal"
5059 (match_operand:DI 0 "register_operand" "r"))
5060 (use (label_ref:DI (match_operand 1 "" "")))]
5061 "(TARGET_ABI_OSF || TARGET_ABI_WINDOWS_NT)
5062 && alpha_tablejump_addr_vec (insn)"
5064 operands[2] = alpha_tablejump_best_label (insn);
5065 return "jmp $31,(%0),%2";
5067 [(set_attr "type" "ibr")])
5069 (define_insn "*tablejump_internal"
5071 (match_operand:DI 0 "register_operand" "r"))
5072 (use (label_ref (match_operand 1 "" "")))]
5075 [(set_attr "type" "ibr")])
5077 ;; Cache flush. Used by INITIALIZE_TRAMPOLINE. 0x86 is PAL_imb, but we don't
5078 ;; want to have to include pal.h in our .s file.
5080 [(unspec_volatile [(const_int 0)] UNSPECV_IMB)]
5083 [(set_attr "type" "callpal")])
5085 ;; BUGCHK is documented common to OSF/1 and VMS PALcode.
5086 ;; NT does not document anything at 0x81 -- presumably it would generate
5087 ;; the equivalent of SIGILL, but this isn't that important.
5088 ;; ??? Presuming unicosmk uses either OSF/1 or VMS PALcode.
5090 [(trap_if (const_int 1) (const_int 0))]
5091 "!TARGET_ABI_WINDOWS_NT"
5093 [(set_attr "type" "callpal")])
5095 ;; For userland, we load the thread pointer from the TCB.
5096 ;; For the kernel, we load the per-cpu private value.
5098 (define_insn "load_tp"
5099 [(set (match_operand:DI 0 "register_operand" "=v")
5100 (unspec:DI [(const_int 0)] UNSPEC_TP))]
5103 if (TARGET_TLS_KERNEL)
5104 return "call_pal 0x32";
5106 return "call_pal 0x9e";
5108 [(set_attr "type" "callpal")])
5110 ;; For completeness, and possibly a __builtin function, here's how to
5111 ;; set the thread pointer. Since we don't describe enough of this
5112 ;; quantity for CSE, we have to use a volatile unspec, and then there's
5113 ;; not much point in creating an R16_REG register class.
5115 (define_expand "set_tp"
5116 [(set (reg:DI 16) (match_operand:DI 0 "input_operand" ""))
5117 (unspec_volatile [(reg:DI 16)] UNSPECV_SET_TP)]
5121 (define_insn "*set_tp"
5122 [(unspec_volatile [(reg:DI 16)] UNSPECV_SET_TP)]
5125 if (TARGET_TLS_KERNEL)
5126 return "call_pal 0x31";
5128 return "call_pal 0x9f";
5130 [(set_attr "type" "callpal")])
5132 ;; Finally, we have the basic data motion insns. The byte and word insns
5133 ;; are done via define_expand. Start with the floating-point insns, since
5134 ;; they are simpler.
5136 (define_insn "*movsf_nofix"
5137 [(set (match_operand:SF 0 "nonimmediate_operand" "=f,f,*r,*r,m,m")
5138 (match_operand:SF 1 "input_operand" "fG,m,*rG,m,fG,*r"))]
5139 "TARGET_FPREGS && ! TARGET_FIX
5140 && (register_operand (operands[0], SFmode)
5141 || reg_or_0_operand (operands[1], SFmode))"
5149 [(set_attr "type" "fcpys,fld,ilog,ild,fst,ist")])
5151 (define_insn "*movsf_fix"
5152 [(set (match_operand:SF 0 "nonimmediate_operand" "=f,f,*r,*r,m,m,f,*r")
5153 (match_operand:SF 1 "input_operand" "fG,m,*rG,m,fG,*r,*r,f"))]
5154 "TARGET_FPREGS && TARGET_FIX
5155 && (register_operand (operands[0], SFmode)
5156 || reg_or_0_operand (operands[1], SFmode))"
5166 [(set_attr "type" "fcpys,fld,ilog,ild,fst,ist,itof,ftoi")])
5168 (define_insn "*movsf_nofp"
5169 [(set (match_operand:SF 0 "nonimmediate_operand" "=r,r,m")
5170 (match_operand:SF 1 "input_operand" "rG,m,r"))]
5172 && (register_operand (operands[0], SFmode)
5173 || reg_or_0_operand (operands[1], SFmode))"
5178 [(set_attr "type" "ilog,ild,ist")])
5180 (define_insn "*movdf_nofix"
5181 [(set (match_operand:DF 0 "nonimmediate_operand" "=f,f,*r,*r,m,m")
5182 (match_operand:DF 1 "input_operand" "fG,m,*rG,m,fG,*r"))]
5183 "TARGET_FPREGS && ! TARGET_FIX
5184 && (register_operand (operands[0], DFmode)
5185 || reg_or_0_operand (operands[1], DFmode))"
5193 [(set_attr "type" "fcpys,fld,ilog,ild,fst,ist")])
5195 (define_insn "*movdf_fix"
5196 [(set (match_operand:DF 0 "nonimmediate_operand" "=f,f,*r,*r,m,m,f,*r")
5197 (match_operand:DF 1 "input_operand" "fG,m,*rG,m,fG,*r,*r,f"))]
5198 "TARGET_FPREGS && TARGET_FIX
5199 && (register_operand (operands[0], DFmode)
5200 || reg_or_0_operand (operands[1], DFmode))"
5210 [(set_attr "type" "fcpys,fld,ilog,ild,fst,ist,itof,ftoi")])
5212 (define_insn "*movdf_nofp"
5213 [(set (match_operand:DF 0 "nonimmediate_operand" "=r,r,m")
5214 (match_operand:DF 1 "input_operand" "rG,m,r"))]
5216 && (register_operand (operands[0], DFmode)
5217 || reg_or_0_operand (operands[1], DFmode))"
5222 [(set_attr "type" "ilog,ild,ist")])
5224 ;; Subregs suck for register allocation. Pretend we can move TFmode
5225 ;; data between general registers until after reload.
5227 (define_insn_and_split "*movtf_internal"
5228 [(set (match_operand:TF 0 "nonimmediate_operand" "=r,o")
5229 (match_operand:TF 1 "input_operand" "roG,rG"))]
5230 "register_operand (operands[0], TFmode)
5231 || reg_or_0_operand (operands[1], TFmode)"
5234 [(set (match_dup 0) (match_dup 2))
5235 (set (match_dup 1) (match_dup 3))]
5237 alpha_split_tmode_pair (operands, TFmode, true);
5240 (define_expand "movsf"
5241 [(set (match_operand:SF 0 "nonimmediate_operand" "")
5242 (match_operand:SF 1 "general_operand" ""))]
5245 if (GET_CODE (operands[0]) == MEM
5246 && ! reg_or_0_operand (operands[1], SFmode))
5247 operands[1] = force_reg (SFmode, operands[1]);
5250 (define_expand "movdf"
5251 [(set (match_operand:DF 0 "nonimmediate_operand" "")
5252 (match_operand:DF 1 "general_operand" ""))]
5255 if (GET_CODE (operands[0]) == MEM
5256 && ! reg_or_0_operand (operands[1], DFmode))
5257 operands[1] = force_reg (DFmode, operands[1]);
5260 (define_expand "movtf"
5261 [(set (match_operand:TF 0 "nonimmediate_operand" "")
5262 (match_operand:TF 1 "general_operand" ""))]
5265 if (GET_CODE (operands[0]) == MEM
5266 && ! reg_or_0_operand (operands[1], TFmode))
5267 operands[1] = force_reg (TFmode, operands[1]);
5270 (define_insn "*movsi"
5271 [(set (match_operand:SI 0 "nonimmediate_operand" "=r,r,r,r,r,m")
5272 (match_operand:SI 1 "input_operand" "rJ,K,L,n,m,rJ"))]
5273 "(TARGET_ABI_OSF || TARGET_ABI_UNICOSMK)
5274 && (register_operand (operands[0], SImode)
5275 || reg_or_0_operand (operands[1], SImode))"
5283 [(set_attr "type" "ilog,iadd,iadd,multi,ild,ist")])
5285 (define_insn "*movsi_nt_vms"
5286 [(set (match_operand:SI 0 "nonimmediate_operand" "=r,r,r,r,r,r,m")
5287 (match_operand:SI 1 "input_operand" "rJ,K,L,s,n,m,rJ"))]
5288 "(TARGET_ABI_WINDOWS_NT || TARGET_ABI_OPEN_VMS)
5289 && (register_operand (operands[0], SImode)
5290 || reg_or_0_operand (operands[1], SImode))"
5299 [(set_attr "type" "ilog,iadd,iadd,ldsym,multi,ild,ist")])
5301 (define_insn "*movhi_nobwx"
5302 [(set (match_operand:HI 0 "register_operand" "=r,r")
5303 (match_operand:HI 1 "input_operand" "rJ,n"))]
5305 && (register_operand (operands[0], HImode)
5306 || register_operand (operands[1], HImode))"
5310 [(set_attr "type" "ilog,iadd")])
5312 (define_insn "*movhi_bwx"
5313 [(set (match_operand:HI 0 "nonimmediate_operand" "=r,r,r,m")
5314 (match_operand:HI 1 "input_operand" "rJ,n,m,rJ"))]
5316 && (register_operand (operands[0], HImode)
5317 || reg_or_0_operand (operands[1], HImode))"
5323 [(set_attr "type" "ilog,iadd,ild,ist")])
5325 (define_insn "*movqi_nobwx"
5326 [(set (match_operand:QI 0 "register_operand" "=r,r")
5327 (match_operand:QI 1 "input_operand" "rJ,n"))]
5329 && (register_operand (operands[0], QImode)
5330 || register_operand (operands[1], QImode))"
5334 [(set_attr "type" "ilog,iadd")])
5336 (define_insn "*movqi_bwx"
5337 [(set (match_operand:QI 0 "nonimmediate_operand" "=r,r,r,m")
5338 (match_operand:QI 1 "input_operand" "rJ,n,m,rJ"))]
5340 && (register_operand (operands[0], QImode)
5341 || reg_or_0_operand (operands[1], QImode))"
5347 [(set_attr "type" "ilog,iadd,ild,ist")])
5349 ;; We do two major things here: handle mem->mem and construct long
5352 (define_expand "movsi"
5353 [(set (match_operand:SI 0 "nonimmediate_operand" "")
5354 (match_operand:SI 1 "general_operand" ""))]
5357 if (alpha_expand_mov (SImode, operands))
5361 ;; Split a load of a large constant into the appropriate two-insn
5365 [(set (match_operand:SI 0 "register_operand" "")
5366 (match_operand:SI 1 "non_add_const_operand" ""))]
5370 if (alpha_split_const_mov (SImode, operands))
5376 ;; Split the load of an address into a four-insn sequence on Unicos/Mk.
5377 ;; Always generate a REG_EQUAL note for the last instruction to facilitate
5378 ;; optimizations. If the symbolic operand is a label_ref, generate
5379 ;; REG_LABEL_OPERAND notes and update LABEL_NUSES because this is not done
5380 ;; automatically. Labels may be incorrectly deleted if we don't do this.
5382 ;; Describing what the individual instructions do correctly is too complicated
5383 ;; so use UNSPECs for each of the three parts of an address.
5386 [(set (match_operand:DI 0 "register_operand" "")
5387 (match_operand:DI 1 "symbolic_operand" ""))]
5388 "TARGET_ABI_UNICOSMK && reload_completed"
5391 rtx insn1, insn2, insn3;
5393 insn1 = emit_insn (gen_umk_laum (operands[0], operands[1]));
5394 emit_insn (gen_ashldi3 (operands[0], operands[0], GEN_INT (32)));
5395 insn2 = emit_insn (gen_umk_lalm (operands[0], operands[0], operands[1]));
5396 insn3 = emit_insn (gen_umk_lal (operands[0], operands[0], operands[1]));
5397 set_unique_reg_note (insn3, REG_EQUAL, operands[1]);
5399 if (GET_CODE (operands[1]) == LABEL_REF)
5403 label = XEXP (operands[1], 0);
5404 REG_NOTES (insn1) = gen_rtx_EXPR_LIST (REG_LABEL_OPERAND, label,
5406 REG_NOTES (insn2) = gen_rtx_EXPR_LIST (REG_LABEL_OPERAND, label,
5408 REG_NOTES (insn3) = gen_rtx_EXPR_LIST (REG_LABEL_OPERAND, label,
5410 LABEL_NUSES (label) += 3;
5415 ;; Instructions for loading the three parts of an address on Unicos/Mk.
5417 (define_insn "umk_laum"
5418 [(set (match_operand:DI 0 "register_operand" "=r")
5419 (unspec:DI [(match_operand:DI 1 "symbolic_operand" "")]
5421 "TARGET_ABI_UNICOSMK"
5423 [(set_attr "type" "iadd")])
5425 (define_insn "umk_lalm"
5426 [(set (match_operand:DI 0 "register_operand" "=r")
5427 (plus:DI (match_operand:DI 1 "register_operand" "r")
5428 (unspec:DI [(match_operand:DI 2 "symbolic_operand" "")]
5430 "TARGET_ABI_UNICOSMK"
5432 [(set_attr "type" "iadd")])
5434 (define_insn "umk_lal"
5435 [(set (match_operand:DI 0 "register_operand" "=r")
5436 (plus:DI (match_operand:DI 1 "register_operand" "r")
5437 (unspec:DI [(match_operand:DI 2 "symbolic_operand" "")]
5439 "TARGET_ABI_UNICOSMK"
5441 [(set_attr "type" "iadd")])
5443 ;; Add a new call information word to the current function's list of CIWs
5444 ;; and load its index into $25. Doing it here ensures that the CIW will be
5445 ;; associated with the correct function even in the presence of inlining.
5447 (define_insn "*umk_load_ciw"
5449 (unspec:DI [(match_operand 0 "" "")] UNSPEC_UMK_LOAD_CIW))]
5450 "TARGET_ABI_UNICOSMK"
5452 operands[0] = unicosmk_add_call_info_word (operands[0]);
5453 return "lda $25,%0";
5455 [(set_attr "type" "iadd")])
5457 (define_insn "*movdi_er_low_l"
5458 [(set (match_operand:DI 0 "register_operand" "=r")
5459 (lo_sum:DI (match_operand:DI 1 "register_operand" "r")
5460 (match_operand:DI 2 "local_symbolic_operand" "")))]
5461 "TARGET_EXPLICIT_RELOCS"
5463 if (true_regnum (operands[1]) == 29)
5464 return "lda %0,%2(%1)\t\t!gprel";
5466 return "lda %0,%2(%1)\t\t!gprellow";
5468 [(set_attr "usegp" "yes")])
5471 [(set (match_operand:DI 0 "register_operand" "")
5472 (match_operand:DI 1 "small_symbolic_operand" ""))]
5473 "TARGET_EXPLICIT_RELOCS && reload_completed"
5475 (lo_sum:DI (match_dup 2) (match_dup 1)))]
5476 "operands[2] = pic_offset_table_rtx;")
5479 [(set (match_operand:DI 0 "register_operand" "")
5480 (match_operand:DI 1 "local_symbolic_operand" ""))]
5481 "TARGET_EXPLICIT_RELOCS && reload_completed"
5483 (plus:DI (match_dup 2) (high:DI (match_dup 1))))
5485 (lo_sum:DI (match_dup 0) (match_dup 1)))]
5486 "operands[2] = pic_offset_table_rtx;")
5489 [(match_operand 0 "some_small_symbolic_operand" "")]
5492 "operands[0] = split_small_symbolic_operand (operands[0]);")
5494 ;; Accepts any symbolic, not just global, since function calls that
5495 ;; don't go via bsr still use !literal in hopes of linker relaxation.
5496 (define_insn "movdi_er_high_g"
5497 [(set (match_operand:DI 0 "register_operand" "=r")
5498 (unspec:DI [(match_operand:DI 1 "register_operand" "r")
5499 (match_operand:DI 2 "symbolic_operand" "")
5500 (match_operand 3 "const_int_operand" "")]
5502 "TARGET_EXPLICIT_RELOCS"
5504 if (INTVAL (operands[3]) == 0)
5505 return "ldq %0,%2(%1)\t\t!literal";
5507 return "ldq %0,%2(%1)\t\t!literal!%3";
5509 [(set_attr "type" "ldsym")])
5512 [(set (match_operand:DI 0 "register_operand" "")
5513 (match_operand:DI 1 "global_symbolic_operand" ""))]
5514 "TARGET_EXPLICIT_RELOCS && reload_completed"
5516 (unspec:DI [(match_dup 2)
5518 (const_int 0)] UNSPEC_LITERAL))]
5519 "operands[2] = pic_offset_table_rtx;")
5521 (define_insn "movdi_er_tlsgd"
5522 [(set (match_operand:DI 0 "register_operand" "=r")
5523 (unspec:DI [(match_operand:DI 1 "register_operand" "r")
5524 (match_operand:DI 2 "symbolic_operand" "")
5525 (match_operand 3 "const_int_operand" "")]
5529 if (INTVAL (operands[3]) == 0)
5530 return "lda %0,%2(%1)\t\t!tlsgd";
5532 return "lda %0,%2(%1)\t\t!tlsgd!%3";
5535 (define_insn "movdi_er_tlsldm"
5536 [(set (match_operand:DI 0 "register_operand" "=r")
5537 (unspec:DI [(match_operand:DI 1 "register_operand" "r")
5538 (match_operand 2 "const_int_operand" "")]
5542 if (INTVAL (operands[2]) == 0)
5543 return "lda %0,%&(%1)\t\t!tlsldm";
5545 return "lda %0,%&(%1)\t\t!tlsldm!%2";
5548 (define_insn "*movdi_er_gotdtp"
5549 [(set (match_operand:DI 0 "register_operand" "=r")
5550 (unspec:DI [(match_operand:DI 1 "register_operand" "r")
5551 (match_operand:DI 2 "symbolic_operand" "")]
5554 "ldq %0,%2(%1)\t\t!gotdtprel"
5555 [(set_attr "type" "ild")
5556 (set_attr "usegp" "yes")])
5559 [(set (match_operand:DI 0 "register_operand" "")
5560 (match_operand:DI 1 "gotdtp_symbolic_operand" ""))]
5561 "HAVE_AS_TLS && reload_completed"
5563 (unspec:DI [(match_dup 2)
5564 (match_dup 1)] UNSPEC_DTPREL))]
5566 operands[1] = XVECEXP (XEXP (operands[1], 0), 0, 0);
5567 operands[2] = pic_offset_table_rtx;
5570 (define_insn "*movdi_er_gottp"
5571 [(set (match_operand:DI 0 "register_operand" "=r")
5572 (unspec:DI [(match_operand:DI 1 "register_operand" "r")
5573 (match_operand:DI 2 "symbolic_operand" "")]
5576 "ldq %0,%2(%1)\t\t!gottprel"
5577 [(set_attr "type" "ild")
5578 (set_attr "usegp" "yes")])
5581 [(set (match_operand:DI 0 "register_operand" "")
5582 (match_operand:DI 1 "gottp_symbolic_operand" ""))]
5583 "HAVE_AS_TLS && reload_completed"
5585 (unspec:DI [(match_dup 2)
5586 (match_dup 1)] UNSPEC_TPREL))]
5588 operands[1] = XVECEXP (XEXP (operands[1], 0), 0, 0);
5589 operands[2] = pic_offset_table_rtx;
5592 (define_insn "*movdi_er_nofix"
5593 [(set (match_operand:DI 0 "nonimmediate_operand" "=r,r,r,r,r,r,r,m,*f,*f,Q")
5594 (match_operand:DI 1 "input_operand" "rJ,K,L,T,s,n,m,rJ,*fJ,Q,*f"))]
5595 "TARGET_EXPLICIT_RELOCS && ! TARGET_FIX
5596 && (register_operand (operands[0], DImode)
5597 || reg_or_0_operand (operands[1], DImode))"
5610 [(set_attr "type" "ilog,iadd,iadd,iadd,ldsym,multi,ild,ist,fcpys,fld,fst")
5611 (set_attr "usegp" "*,*,*,yes,*,*,*,*,*,*,*")])
5613 ;; The 'U' constraint matches symbolic operands on Unicos/Mk. Those should
5614 ;; have been split up by the rules above but we shouldn't reject the
5615 ;; possibility of them getting through.
5617 (define_insn "*movdi_nofix"
5618 [(set (match_operand:DI 0 "nonimmediate_operand" "=r,r,r,r,r,r,r,m,*f,*f,Q")
5619 (match_operand:DI 1 "input_operand" "rJ,K,L,U,s,n,m,rJ,*fJ,Q,*f"))]
5621 && (register_operand (operands[0], DImode)
5622 || reg_or_0_operand (operands[1], DImode))"
5627 laum %0,%t1($31)\;sll %0,32,%0\;lalm %0,%t1(%0)\;lal %0,%t1(%0)
5635 [(set_attr "type" "ilog,iadd,iadd,ldsym,ldsym,multi,ild,ist,fcpys,fld,fst")
5636 (set_attr "length" "*,*,*,16,*,*,*,*,*,*,*")])
5638 (define_insn "*movdi_er_fix"
5639 [(set (match_operand:DI 0 "nonimmediate_operand"
5640 "=r,r,r,r,r,r,r, m, *f,*f, Q, r,*f")
5641 (match_operand:DI 1 "input_operand"
5642 "rJ,K,L,T,s,n,m,rJ,*fJ, Q,*f,*f, r"))]
5643 "TARGET_EXPLICIT_RELOCS && TARGET_FIX
5644 && (register_operand (operands[0], DImode)
5645 || reg_or_0_operand (operands[1], DImode))"
5660 [(set_attr "type" "ilog,iadd,iadd,iadd,ldsym,multi,ild,ist,fcpys,fld,fst,ftoi,itof")
5661 (set_attr "usegp" "*,*,*,yes,*,*,*,*,*,*,*,*,*")])
5663 (define_insn "*movdi_fix"
5664 [(set (match_operand:DI 0 "nonimmediate_operand" "=r,r,r,r,r,r,m,*f,*f,Q,r,*f")
5665 (match_operand:DI 1 "input_operand" "rJ,K,L,s,n,m,rJ,*fJ,Q,*f,*f,r"))]
5666 "! TARGET_EXPLICIT_RELOCS && TARGET_FIX
5667 && (register_operand (operands[0], DImode)
5668 || reg_or_0_operand (operands[1], DImode))"
5682 [(set_attr "type" "ilog,iadd,iadd,ldsym,multi,ild,ist,fcpys,fld,fst,ftoi,itof")])
5684 ;; VMS needs to set up "vms_base_regno" for unwinding. This move
5685 ;; often appears dead to the life analysis code, at which point we
5686 ;; die for emitting dead prologue instructions. Force this live.
5688 (define_insn "force_movdi"
5689 [(set (match_operand:DI 0 "register_operand" "=r")
5690 (unspec_volatile:DI [(match_operand:DI 1 "register_operand" "r")]
5691 UNSPECV_FORCE_MOV))]
5694 [(set_attr "type" "ilog")])
5696 ;; We do three major things here: handle mem->mem, put 64-bit constants in
5697 ;; memory, and construct long 32-bit constants.
5699 (define_expand "movdi"
5700 [(set (match_operand:DI 0 "nonimmediate_operand" "")
5701 (match_operand:DI 1 "general_operand" ""))]
5704 if (alpha_expand_mov (DImode, operands))
5708 ;; Split a load of a large constant into the appropriate two-insn
5712 [(set (match_operand:DI 0 "register_operand" "")
5713 (match_operand:DI 1 "non_add_const_operand" ""))]
5717 if (alpha_split_const_mov (DImode, operands))
5723 ;; We need to prevent reload from splitting TImode moves, because it
5724 ;; might decide to overwrite a pointer with the value it points to.
5725 ;; In that case we have to do the loads in the appropriate order so
5726 ;; that the pointer is not destroyed too early.
5728 (define_insn_and_split "*movti_internal"
5729 [(set (match_operand:TI 0 "nonimmediate_operand" "=r,o")
5730 (match_operand:TI 1 "input_operand" "roJ,rJ"))]
5731 "(register_operand (operands[0], TImode)
5732 /* Prevent rematerialization of constants. */
5733 && ! CONSTANT_P (operands[1]))
5734 || reg_or_0_operand (operands[1], TImode)"
5737 [(set (match_dup 0) (match_dup 2))
5738 (set (match_dup 1) (match_dup 3))]
5740 alpha_split_tmode_pair (operands, TImode, true);
5743 (define_expand "movti"
5744 [(set (match_operand:TI 0 "nonimmediate_operand" "")
5745 (match_operand:TI 1 "general_operand" ""))]
5748 if (GET_CODE (operands[0]) == MEM
5749 && ! reg_or_0_operand (operands[1], TImode))
5750 operands[1] = force_reg (TImode, operands[1]);
5752 if (operands[1] == const0_rtx)
5754 /* We must put 64-bit constants in memory. We could keep the
5755 32-bit constants in TImode and rely on the splitter, but
5756 this doesn't seem to be worth the pain. */
5757 else if (GET_CODE (operands[1]) == CONST_INT
5758 || GET_CODE (operands[1]) == CONST_DOUBLE)
5760 rtx in[2], out[2], target;
5762 gcc_assert (can_create_pseudo_p ());
5764 split_double (operands[1], &in[0], &in[1]);
5766 if (in[0] == const0_rtx)
5767 out[0] = const0_rtx;
5770 out[0] = gen_reg_rtx (DImode);
5771 emit_insn (gen_movdi (out[0], in[0]));
5774 if (in[1] == const0_rtx)
5775 out[1] = const0_rtx;
5778 out[1] = gen_reg_rtx (DImode);
5779 emit_insn (gen_movdi (out[1], in[1]));
5782 if (GET_CODE (operands[0]) != REG)
5783 target = gen_reg_rtx (TImode);
5785 target = operands[0];
5787 emit_insn (gen_movdi (operand_subword (target, 0, 0, TImode), out[0]));
5788 emit_insn (gen_movdi (operand_subword (target, 1, 0, TImode), out[1]));
5790 if (target != operands[0])
5791 emit_insn (gen_rtx_SET (VOIDmode, operands[0], target));
5797 ;; These are the partial-word cases.
5799 ;; First we have the code to load an aligned word. Operand 0 is the register
5800 ;; in which to place the result. It's mode is QImode or HImode. Operand 1
5801 ;; is an SImode MEM at the low-order byte of the proper word. Operand 2 is the
5802 ;; number of bits within the word that the value is. Operand 3 is an SImode
5803 ;; scratch register. If operand 0 is a hard register, operand 3 may be the
5804 ;; same register. It is allowed to conflict with operand 1 as well.
5806 (define_expand "aligned_loadqi"
5807 [(set (match_operand:SI 3 "register_operand" "")
5808 (match_operand:SI 1 "memory_operand" ""))
5809 (set (match_operand:DI 0 "register_operand" "")
5810 (zero_extract:DI (subreg:DI (match_dup 3) 0)
5812 (match_operand:DI 2 "const_int_operand" "")))]
5817 (define_expand "aligned_loadhi"
5818 [(set (match_operand:SI 3 "register_operand" "")
5819 (match_operand:SI 1 "memory_operand" ""))
5820 (set (match_operand:DI 0 "register_operand" "")
5821 (zero_extract:DI (subreg:DI (match_dup 3) 0)
5823 (match_operand:DI 2 "const_int_operand" "")))]
5828 ;; Similar for unaligned loads, where we use the sequence from the
5829 ;; Alpha Architecture manual. We have to distinguish between little-endian
5830 ;; and big-endian systems as the sequences are different.
5832 ;; Operand 1 is the address. Operands 2 and 3 are temporaries, where
5833 ;; operand 3 can overlap the input and output registers.
5835 (define_expand "unaligned_loadqi"
5836 [(use (match_operand:DI 0 "register_operand" ""))
5837 (use (match_operand:DI 1 "address_operand" ""))
5838 (use (match_operand:DI 2 "register_operand" ""))
5839 (use (match_operand:DI 3 "register_operand" ""))]
5842 if (WORDS_BIG_ENDIAN)
5843 emit_insn (gen_unaligned_loadqi_be (operands[0], operands[1],
5844 operands[2], operands[3]));
5846 emit_insn (gen_unaligned_loadqi_le (operands[0], operands[1],
5847 operands[2], operands[3]));
5851 (define_expand "unaligned_loadqi_le"
5852 [(set (match_operand:DI 2 "register_operand" "")
5853 (mem:DI (and:DI (match_operand:DI 1 "address_operand" "")
5855 (set (match_operand:DI 3 "register_operand" "")
5857 (set (match_operand:DI 0 "register_operand" "")
5858 (zero_extract:DI (match_dup 2)
5860 (ashift:DI (match_dup 3) (const_int 3))))]
5861 "! WORDS_BIG_ENDIAN"
5864 (define_expand "unaligned_loadqi_be"
5865 [(set (match_operand:DI 2 "register_operand" "")
5866 (mem:DI (and:DI (match_operand:DI 1 "address_operand" "")
5868 (set (match_operand:DI 3 "register_operand" "")
5870 (set (match_operand:DI 0 "register_operand" "")
5871 (zero_extract:DI (match_dup 2)
5875 (ashift:DI (match_dup 3) (const_int 3)))))]
5879 (define_expand "unaligned_loadhi"
5880 [(use (match_operand:DI 0 "register_operand" ""))
5881 (use (match_operand:DI 1 "address_operand" ""))
5882 (use (match_operand:DI 2 "register_operand" ""))
5883 (use (match_operand:DI 3 "register_operand" ""))]
5886 if (WORDS_BIG_ENDIAN)
5887 emit_insn (gen_unaligned_loadhi_be (operands[0], operands[1],
5888 operands[2], operands[3]));
5890 emit_insn (gen_unaligned_loadhi_le (operands[0], operands[1],
5891 operands[2], operands[3]));
5895 (define_expand "unaligned_loadhi_le"
5896 [(set (match_operand:DI 2 "register_operand" "")
5897 (mem:DI (and:DI (match_operand:DI 1 "address_operand" "")
5899 (set (match_operand:DI 3 "register_operand" "")
5901 (set (match_operand:DI 0 "register_operand" "")
5902 (zero_extract:DI (match_dup 2)
5904 (ashift:DI (match_dup 3) (const_int 3))))]
5905 "! WORDS_BIG_ENDIAN"
5908 (define_expand "unaligned_loadhi_be"
5909 [(set (match_operand:DI 2 "register_operand" "")
5910 (mem:DI (and:DI (match_operand:DI 1 "address_operand" "")
5912 (set (match_operand:DI 3 "register_operand" "")
5913 (plus:DI (match_dup 1) (const_int 1)))
5914 (set (match_operand:DI 0 "register_operand" "")
5915 (zero_extract:DI (match_dup 2)
5919 (ashift:DI (match_dup 3) (const_int 3)))))]
5923 ;; Storing an aligned byte or word requires two temporaries. Operand 0 is the
5924 ;; aligned SImode MEM. Operand 1 is the register containing the
5925 ;; byte or word to store. Operand 2 is the number of bits within the word that
5926 ;; the value should be placed. Operands 3 and 4 are SImode temporaries.
5928 (define_expand "aligned_store"
5929 [(set (match_operand:SI 3 "register_operand" "")
5930 (match_operand:SI 0 "memory_operand" ""))
5931 (set (subreg:DI (match_dup 3) 0)
5932 (and:DI (subreg:DI (match_dup 3) 0) (match_dup 5)))
5933 (set (subreg:DI (match_operand:SI 4 "register_operand" "") 0)
5934 (ashift:DI (zero_extend:DI (match_operand 1 "register_operand" ""))
5935 (match_operand:DI 2 "const_int_operand" "")))
5936 (set (subreg:DI (match_dup 4) 0)
5937 (ior:DI (subreg:DI (match_dup 4) 0) (subreg:DI (match_dup 3) 0)))
5938 (set (match_dup 0) (match_dup 4))]
5941 operands[5] = GEN_INT (~ (GET_MODE_MASK (GET_MODE (operands[1]))
5942 << INTVAL (operands[2])));
5945 ;; For the unaligned byte and halfword cases, we use code similar to that
5946 ;; in the ;; Architecture book, but reordered to lower the number of registers
5947 ;; required. Operand 0 is the address. Operand 1 is the data to store.
5948 ;; Operands 2, 3, and 4 are DImode temporaries, where operands 2 and 4 may
5949 ;; be the same temporary, if desired. If the address is in a register,
5950 ;; operand 2 can be that register.
5952 (define_expand "unaligned_storeqi"
5953 [(use (match_operand:DI 0 "address_operand" ""))
5954 (use (match_operand:QI 1 "register_operand" ""))
5955 (use (match_operand:DI 2 "register_operand" ""))
5956 (use (match_operand:DI 3 "register_operand" ""))
5957 (use (match_operand:DI 4 "register_operand" ""))]
5960 if (WORDS_BIG_ENDIAN)
5961 emit_insn (gen_unaligned_storeqi_be (operands[0], operands[1],
5962 operands[2], operands[3],
5965 emit_insn (gen_unaligned_storeqi_le (operands[0], operands[1],
5966 operands[2], operands[3],
5971 (define_expand "unaligned_storeqi_le"
5972 [(set (match_operand:DI 3 "register_operand" "")
5973 (mem:DI (and:DI (match_operand:DI 0 "address_operand" "")
5975 (set (match_operand:DI 2 "register_operand" "")
5978 (and:DI (not:DI (ashift:DI (const_int 255)
5979 (ashift:DI (match_dup 2) (const_int 3))))
5981 (set (match_operand:DI 4 "register_operand" "")
5982 (ashift:DI (zero_extend:DI (match_operand:QI 1 "register_operand" ""))
5983 (ashift:DI (match_dup 2) (const_int 3))))
5984 (set (match_dup 4) (ior:DI (match_dup 4) (match_dup 3)))
5985 (set (mem:DI (and:DI (match_dup 0) (const_int -8)))
5987 "! WORDS_BIG_ENDIAN"
5990 (define_expand "unaligned_storeqi_be"
5991 [(set (match_operand:DI 3 "register_operand" "")
5992 (mem:DI (and:DI (match_operand:DI 0 "address_operand" "")
5994 (set (match_operand:DI 2 "register_operand" "")
5997 (and:DI (not:DI (ashift:DI (const_int 255)
5998 (minus:DI (const_int 56)
5999 (ashift:DI (match_dup 2) (const_int 3)))))
6001 (set (match_operand:DI 4 "register_operand" "")
6002 (ashift:DI (zero_extend:DI (match_operand:QI 1 "register_operand" ""))
6003 (minus:DI (const_int 56)
6004 (ashift:DI (match_dup 2) (const_int 3)))))
6005 (set (match_dup 4) (ior:DI (match_dup 4) (match_dup 3)))
6006 (set (mem:DI (and:DI (match_dup 0) (const_int -8)))
6011 (define_expand "unaligned_storehi"
6012 [(use (match_operand:DI 0 "address_operand" ""))
6013 (use (match_operand:HI 1 "register_operand" ""))
6014 (use (match_operand:DI 2 "register_operand" ""))
6015 (use (match_operand:DI 3 "register_operand" ""))
6016 (use (match_operand:DI 4 "register_operand" ""))]
6019 if (WORDS_BIG_ENDIAN)
6020 emit_insn (gen_unaligned_storehi_be (operands[0], operands[1],
6021 operands[2], operands[3],
6024 emit_insn (gen_unaligned_storehi_le (operands[0], operands[1],
6025 operands[2], operands[3],
6030 (define_expand "unaligned_storehi_le"
6031 [(set (match_operand:DI 3 "register_operand" "")
6032 (mem:DI (and:DI (match_operand:DI 0 "address_operand" "")
6034 (set (match_operand:DI 2 "register_operand" "")
6037 (and:DI (not:DI (ashift:DI (const_int 65535)
6038 (ashift:DI (match_dup 2) (const_int 3))))
6040 (set (match_operand:DI 4 "register_operand" "")
6041 (ashift:DI (zero_extend:DI (match_operand:HI 1 "register_operand" ""))
6042 (ashift:DI (match_dup 2) (const_int 3))))
6043 (set (match_dup 4) (ior:DI (match_dup 4) (match_dup 3)))
6044 (set (mem:DI (and:DI (match_dup 0) (const_int -8)))
6046 "! WORDS_BIG_ENDIAN"
6049 (define_expand "unaligned_storehi_be"
6050 [(set (match_operand:DI 3 "register_operand" "")
6051 (mem:DI (and:DI (match_operand:DI 0 "address_operand" "")
6053 (set (match_operand:DI 2 "register_operand" "")
6054 (plus:DI (match_dup 0) (const_int 1)))
6056 (and:DI (not:DI (ashift:DI
6058 (minus:DI (const_int 56)
6059 (ashift:DI (match_dup 2) (const_int 3)))))
6061 (set (match_operand:DI 4 "register_operand" "")
6062 (ashift:DI (zero_extend:DI (match_operand:HI 1 "register_operand" ""))
6063 (minus:DI (const_int 56)
6064 (ashift:DI (match_dup 2) (const_int 3)))))
6065 (set (match_dup 4) (ior:DI (match_dup 4) (match_dup 3)))
6066 (set (mem:DI (and:DI (match_dup 0) (const_int -8)))
6071 ;; Here are the define_expand's for QI and HI moves that use the above
6072 ;; patterns. We have the normal sets, plus the ones that need scratch
6073 ;; registers for reload.
6075 (define_expand "movqi"
6076 [(set (match_operand:QI 0 "nonimmediate_operand" "")
6077 (match_operand:QI 1 "general_operand" ""))]
6081 ? alpha_expand_mov (QImode, operands)
6082 : alpha_expand_mov_nobwx (QImode, operands))
6086 (define_expand "movhi"
6087 [(set (match_operand:HI 0 "nonimmediate_operand" "")
6088 (match_operand:HI 1 "general_operand" ""))]
6092 ? alpha_expand_mov (HImode, operands)
6093 : alpha_expand_mov_nobwx (HImode, operands))
6097 ;; We need to hook into the extra support that we have for HImode
6098 ;; reloads when BWX insns are not available.
6099 (define_expand "movcqi"
6100 [(set (match_operand:CQI 0 "nonimmediate_operand" "")
6101 (match_operand:CQI 1 "general_operand" ""))]
6104 if (GET_CODE (operands[0]) == CONCAT || GET_CODE (operands[1]) == CONCAT)
6106 else if (!any_memory_operand (operands[0], CQImode))
6108 if (!any_memory_operand (operands[1], CQImode))
6110 emit_move_insn (gen_lowpart (HImode, operands[0]),
6111 gen_lowpart (HImode, operands[1]));
6114 if (aligned_memory_operand (operands[1], CQImode))
6118 operands[1] = gen_lowpart (HImode, operands[1]);
6120 operands[0] = gen_lowpart (HImode, operands[0]);
6121 done = alpha_expand_mov_nobwx (HImode, operands);
6126 else if (aligned_memory_operand (operands[0], CQImode))
6128 if (MEM_P (operands[1]))
6130 rtx x = gen_reg_rtx (HImode);
6131 emit_move_insn (gen_lowpart (CQImode, x), operands[1]);
6138 gcc_assert (!reload_in_progress);
6139 emit_move_complex_parts (operands[0], operands[1]);
6143 ;; Here are the versions for reload.
6145 ;; The aligned input case is recognized early in alpha_secondary_reload
6146 ;; in order to avoid allocating an unnecessary scratch register.
6148 ;; Note that in the unaligned cases we know that the operand must not be
6149 ;; a pseudo-register because stack slots are always aligned references.
6151 (define_expand "reload_in<mode>"
6152 [(parallel [(match_operand:RELOAD12 0 "register_operand" "=r")
6153 (match_operand:RELOAD12 1 "any_memory_operand" "m")
6154 (match_operand:TI 2 "register_operand" "=&r")])]
6157 rtx scratch, seq, addr;
6158 unsigned regno = REGNO (operands[2]);
6160 /* It is possible that one of the registers we got for operands[2]
6161 might coincide with that of operands[0] (which is why we made
6162 it TImode). Pick the other one to use as our scratch. */
6163 if (regno == REGNO (operands[0]))
6165 scratch = gen_rtx_REG (DImode, regno);
6167 addr = get_unaligned_address (operands[1]);
6168 operands[0] = gen_rtx_REG (DImode, REGNO (operands[0]));
6169 seq = gen_unaligned_load<reloadmode> (operands[0], addr,
6170 scratch, operands[0]);
6171 alpha_set_memflags (seq, operands[1]);
6177 (define_expand "reload_out<mode>"
6178 [(parallel [(match_operand:RELOAD12 0 "any_memory_operand" "=m")
6179 (match_operand:RELOAD12 1 "register_operand" "r")
6180 (match_operand:TI 2 "register_operand" "=&r")])]
6183 unsigned regno = REGNO (operands[2]);
6185 if (<MODE>mode == CQImode)
6187 operands[0] = gen_lowpart (HImode, operands[0]);
6188 operands[1] = gen_lowpart (HImode, operands[1]);
6191 if (aligned_memory_operand (operands[0], <MODE>mode))
6193 emit_insn (gen_reload_out<reloadmode>_aligned
6194 (operands[0], operands[1],
6195 gen_rtx_REG (SImode, regno),
6196 gen_rtx_REG (SImode, regno + 1)));
6200 rtx addr = get_unaligned_address (operands[0]);
6201 rtx scratch1 = gen_rtx_REG (DImode, regno);
6202 rtx scratch2 = gen_rtx_REG (DImode, regno + 1);
6203 rtx scratch3 = scratch1;
6206 if (GET_CODE (addr) == REG)
6209 seq = gen_unaligned_store<reloadmode> (addr, operands[1], scratch1,
6210 scratch2, scratch3);
6211 alpha_set_memflags (seq, operands[0]);
6217 ;; Helpers for the above. The way reload is structured, we can't
6218 ;; always get a proper address for a stack slot during reload_foo
6219 ;; expansion, so we must delay our address manipulations until after.
6221 (define_insn_and_split "reload_in<mode>_aligned"
6222 [(set (match_operand:I12MODE 0 "register_operand" "=r")
6223 (match_operand:I12MODE 1 "memory_operand" "m"))]
6224 "!TARGET_BWX && (reload_in_progress || reload_completed)"
6226 "!TARGET_BWX && reload_completed"
6229 rtx aligned_mem, bitnum;
6230 get_aligned_mem (operands[1], &aligned_mem, &bitnum);
6231 emit_insn (gen_aligned_load<reloadmode>
6232 (gen_lowpart (DImode, operands[0]), aligned_mem, bitnum,
6233 gen_rtx_REG (SImode, REGNO (operands[0]))));
6237 (define_insn_and_split "reload_out<mode>_aligned"
6238 [(set (match_operand:I12MODE 0 "memory_operand" "=m")
6239 (match_operand:I12MODE 1 "register_operand" "r"))
6240 (clobber (match_operand:SI 2 "register_operand" "=r"))
6241 (clobber (match_operand:SI 3 "register_operand" "=r"))]
6242 "!TARGET_BWX && (reload_in_progress || reload_completed)"
6244 "!TARGET_BWX && reload_completed"
6247 rtx aligned_mem, bitnum;
6248 get_aligned_mem (operands[0], &aligned_mem, &bitnum);
6249 emit_insn (gen_aligned_store (aligned_mem, operands[1], bitnum,
6250 operands[2], operands[3]));
6254 ;; Vector operations
6256 (define_mode_iterator VEC [V8QI V4HI V2SI])
6258 (define_expand "mov<mode>"
6259 [(set (match_operand:VEC 0 "nonimmediate_operand" "")
6260 (match_operand:VEC 1 "general_operand" ""))]
6263 if (alpha_expand_mov (<MODE>mode, operands))
6268 [(set (match_operand:VEC 0 "register_operand" "")
6269 (match_operand:VEC 1 "non_zero_const_operand" ""))]
6273 if (alpha_split_const_mov (<MODE>mode, operands))
6280 (define_expand "movmisalign<mode>"
6281 [(set (match_operand:VEC 0 "nonimmediate_operand" "")
6282 (match_operand:VEC 1 "general_operand" ""))]
6285 alpha_expand_movmisalign (<MODE>mode, operands);
6289 (define_insn "*mov<mode>_fix"
6290 [(set (match_operand:VEC 0 "nonimmediate_operand" "=r,r,r,m,*f,*f,m,r,*f")
6291 (match_operand:VEC 1 "input_operand" "rW,i,m,rW,*fW,m,*f,*f,r"))]
6293 && (register_operand (operands[0], <MODE>mode)
6294 || reg_or_0_operand (operands[1], <MODE>mode))"
6305 [(set_attr "type" "ilog,multi,ild,ist,fcpys,fld,fst,ftoi,itof")])
6307 (define_insn "*mov<mode>_nofix"
6308 [(set (match_operand:VEC 0 "nonimmediate_operand" "=r,r,r,m,*f,*f,m")
6309 (match_operand:VEC 1 "input_operand" "rW,i,m,rW,*fW,m,*f"))]
6311 && (register_operand (operands[0], <MODE>mode)
6312 || reg_or_0_operand (operands[1], <MODE>mode))"
6321 [(set_attr "type" "ilog,multi,ild,ist,fcpys,fld,fst")])
6323 (define_insn "uminv8qi3"
6324 [(set (match_operand:V8QI 0 "register_operand" "=r")
6325 (umin:V8QI (match_operand:V8QI 1 "reg_or_0_operand" "rW")
6326 (match_operand:V8QI 2 "reg_or_0_operand" "rW")))]
6329 [(set_attr "type" "mvi")])
6331 (define_insn "sminv8qi3"
6332 [(set (match_operand:V8QI 0 "register_operand" "=r")
6333 (smin:V8QI (match_operand:V8QI 1 "reg_or_0_operand" "rW")
6334 (match_operand:V8QI 2 "reg_or_0_operand" "rW")))]
6337 [(set_attr "type" "mvi")])
6339 (define_insn "uminv4hi3"
6340 [(set (match_operand:V4HI 0 "register_operand" "=r")
6341 (umin:V4HI (match_operand:V4HI 1 "reg_or_0_operand" "rW")
6342 (match_operand:V4HI 2 "reg_or_0_operand" "rW")))]
6345 [(set_attr "type" "mvi")])
6347 (define_insn "sminv4hi3"
6348 [(set (match_operand:V4HI 0 "register_operand" "=r")
6349 (smin:V4HI (match_operand:V4HI 1 "reg_or_0_operand" "rW")
6350 (match_operand:V4HI 2 "reg_or_0_operand" "rW")))]
6353 [(set_attr "type" "mvi")])
6355 (define_insn "umaxv8qi3"
6356 [(set (match_operand:V8QI 0 "register_operand" "=r")
6357 (umax:V8QI (match_operand:V8QI 1 "reg_or_0_operand" "rW")
6358 (match_operand:V8QI 2 "reg_or_0_operand" "rW")))]
6361 [(set_attr "type" "mvi")])
6363 (define_insn "smaxv8qi3"
6364 [(set (match_operand:V8QI 0 "register_operand" "=r")
6365 (smax:V8QI (match_operand:V8QI 1 "reg_or_0_operand" "rW")
6366 (match_operand:V8QI 2 "reg_or_0_operand" "rW")))]
6369 [(set_attr "type" "mvi")])
6371 (define_insn "umaxv4hi3"
6372 [(set (match_operand:V4HI 0 "register_operand" "=r")
6373 (umax:V4HI (match_operand:V4HI 1 "reg_or_0_operand" "rW")
6374 (match_operand:V4HI 2 "reg_or_0_operand" "rW")))]
6377 [(set_attr "type" "mvi")])
6379 (define_insn "smaxv4hi3"
6380 [(set (match_operand:V4HI 0 "register_operand" "=r")
6381 (smax:V4HI (match_operand:V4HI 1 "reg_or_0_operand" "rW")
6382 (match_operand:V4HI 2 "reg_or_0_operand" "rW")))]
6385 [(set_attr "type" "mvi")])
6387 (define_insn "one_cmpl<mode>2"
6388 [(set (match_operand:VEC 0 "register_operand" "=r")
6389 (not:VEC (match_operand:VEC 1 "register_operand" "r")))]
6392 [(set_attr "type" "ilog")])
6394 (define_insn "and<mode>3"
6395 [(set (match_operand:VEC 0 "register_operand" "=r")
6396 (and:VEC (match_operand:VEC 1 "register_operand" "r")
6397 (match_operand:VEC 2 "register_operand" "r")))]
6400 [(set_attr "type" "ilog")])
6402 (define_insn "*andnot<mode>3"
6403 [(set (match_operand:VEC 0 "register_operand" "=r")
6404 (and:VEC (not:VEC (match_operand:VEC 1 "register_operand" "r"))
6405 (match_operand:VEC 2 "register_operand" "r")))]
6408 [(set_attr "type" "ilog")])
6410 (define_insn "ior<mode>3"
6411 [(set (match_operand:VEC 0 "register_operand" "=r")
6412 (ior:VEC (match_operand:VEC 1 "register_operand" "r")
6413 (match_operand:VEC 2 "register_operand" "r")))]
6416 [(set_attr "type" "ilog")])
6418 (define_insn "*iornot<mode>3"
6419 [(set (match_operand:VEC 0 "register_operand" "=r")
6420 (ior:VEC (not:DI (match_operand:VEC 1 "register_operand" "r"))
6421 (match_operand:VEC 2 "register_operand" "r")))]
6424 [(set_attr "type" "ilog")])
6426 (define_insn "xor<mode>3"
6427 [(set (match_operand:VEC 0 "register_operand" "=r")
6428 (xor:VEC (match_operand:VEC 1 "register_operand" "r")
6429 (match_operand:VEC 2 "register_operand" "r")))]
6432 [(set_attr "type" "ilog")])
6434 (define_insn "*xornot<mode>3"
6435 [(set (match_operand:VEC 0 "register_operand" "=r")
6436 (not:VEC (xor:VEC (match_operand:VEC 1 "register_operand" "r")
6437 (match_operand:VEC 2 "register_operand" "r"))))]
6440 [(set_attr "type" "ilog")])
6442 (define_expand "vec_shl_<mode>"
6443 [(set (match_operand:VEC 0 "register_operand" "")
6444 (ashift:DI (match_operand:VEC 1 "register_operand" "")
6445 (match_operand:DI 2 "reg_or_6bit_operand" "")))]
6448 operands[0] = gen_lowpart (DImode, operands[0]);
6449 operands[1] = gen_lowpart (DImode, operands[1]);
6452 (define_expand "vec_shr_<mode>"
6453 [(set (match_operand:VEC 0 "register_operand" "")
6454 (lshiftrt:DI (match_operand:VEC 1 "register_operand" "")
6455 (match_operand:DI 2 "reg_or_6bit_operand" "")))]
6458 operands[0] = gen_lowpart (DImode, operands[0]);
6459 operands[1] = gen_lowpart (DImode, operands[1]);
6462 ;; Bit field extract patterns which use ext[wlq][lh]
6464 (define_expand "extv"
6465 [(set (match_operand:DI 0 "register_operand" "")
6466 (sign_extract:DI (match_operand:QI 1 "memory_operand" "")
6467 (match_operand:DI 2 "immediate_operand" "")
6468 (match_operand:DI 3 "immediate_operand" "")))]
6473 /* We can do 16, 32 and 64 bit fields, if aligned on byte boundaries. */
6474 if (INTVAL (operands[3]) % 8 != 0
6475 || (INTVAL (operands[2]) != 16
6476 && INTVAL (operands[2]) != 32
6477 && INTVAL (operands[2]) != 64))
6480 /* From mips.md: extract_bit_field doesn't verify that our source
6481 matches the predicate, so we force it to be a MEM here. */
6482 if (GET_CODE (operands[1]) != MEM)
6485 /* The bit number is relative to the mode of operand 1 which is
6486 usually QImode (this might actually be a bug in expmed.c). Note
6487 that the bit number is negative in big-endian mode in this case.
6488 We have to convert that to the offset. */
6489 if (WORDS_BIG_ENDIAN)
6490 ofs = GET_MODE_BITSIZE (GET_MODE (operands[1]))
6491 - INTVAL (operands[2]) - INTVAL (operands[3]);
6493 ofs = INTVAL (operands[3]);
6497 alpha_expand_unaligned_load (operands[0], operands[1],
6498 INTVAL (operands[2]) / 8,
6503 (define_expand "extzv"
6504 [(set (match_operand:DI 0 "register_operand" "")
6505 (zero_extract:DI (match_operand:DI 1 "nonimmediate_operand" "")
6506 (match_operand:DI 2 "immediate_operand" "")
6507 (match_operand:DI 3 "immediate_operand" "")))]
6510 /* We can do 8, 16, 32 and 64 bit fields, if aligned on byte boundaries. */
6511 if (INTVAL (operands[3]) % 8 != 0
6512 || (INTVAL (operands[2]) != 8
6513 && INTVAL (operands[2]) != 16
6514 && INTVAL (operands[2]) != 32
6515 && INTVAL (operands[2]) != 64))
6518 if (GET_CODE (operands[1]) == MEM)
6522 /* Fail 8-bit fields, falling back on a simple byte load. */
6523 if (INTVAL (operands[2]) == 8)
6526 /* The bit number is relative to the mode of operand 1 which is
6527 usually QImode (this might actually be a bug in expmed.c). Note
6528 that the bit number is negative in big-endian mode in this case.
6529 We have to convert that to the offset. */
6530 if (WORDS_BIG_ENDIAN)
6531 ofs = GET_MODE_BITSIZE (GET_MODE (operands[1]))
6532 - INTVAL (operands[2]) - INTVAL (operands[3]);
6534 ofs = INTVAL (operands[3]);
6538 alpha_expand_unaligned_load (operands[0], operands[1],
6539 INTVAL (operands[2]) / 8,
6545 (define_expand "insv"
6546 [(set (zero_extract:DI (match_operand:QI 0 "memory_operand" "")
6547 (match_operand:DI 1 "immediate_operand" "")
6548 (match_operand:DI 2 "immediate_operand" ""))
6549 (match_operand:DI 3 "register_operand" ""))]
6554 /* We can do 16, 32 and 64 bit fields, if aligned on byte boundaries. */
6555 if (INTVAL (operands[2]) % 8 != 0
6556 || (INTVAL (operands[1]) != 16
6557 && INTVAL (operands[1]) != 32
6558 && INTVAL (operands[1]) != 64))
6561 /* From mips.md: store_bit_field doesn't verify that our source
6562 matches the predicate, so we force it to be a MEM here. */
6563 if (GET_CODE (operands[0]) != MEM)
6566 /* The bit number is relative to the mode of operand 1 which is
6567 usually QImode (this might actually be a bug in expmed.c). Note
6568 that the bit number is negative in big-endian mode in this case.
6569 We have to convert that to the offset. */
6570 if (WORDS_BIG_ENDIAN)
6571 ofs = GET_MODE_BITSIZE (GET_MODE (operands[0]))
6572 - INTVAL (operands[1]) - INTVAL (operands[2]);
6574 ofs = INTVAL (operands[2]);
6578 alpha_expand_unaligned_store (operands[0], operands[3],
6579 INTVAL (operands[1]) / 8, ofs);
6583 ;; Block move/clear, see alpha.c for more details.
6584 ;; Argument 0 is the destination
6585 ;; Argument 1 is the source
6586 ;; Argument 2 is the length
6587 ;; Argument 3 is the alignment
6589 (define_expand "movmemqi"
6590 [(parallel [(set (match_operand:BLK 0 "memory_operand" "")
6591 (match_operand:BLK 1 "memory_operand" ""))
6592 (use (match_operand:DI 2 "immediate_operand" ""))
6593 (use (match_operand:DI 3 "immediate_operand" ""))])]
6596 if (alpha_expand_block_move (operands))
6602 (define_expand "movmemdi"
6603 [(parallel [(set (match_operand:BLK 0 "memory_operand" "")
6604 (match_operand:BLK 1 "memory_operand" ""))
6605 (use (match_operand:DI 2 "immediate_operand" ""))
6606 (use (match_operand:DI 3 "immediate_operand" ""))
6608 (clobber (reg:DI 25))
6609 (clobber (reg:DI 16))
6610 (clobber (reg:DI 17))
6611 (clobber (reg:DI 18))
6612 (clobber (reg:DI 19))
6613 (clobber (reg:DI 20))
6614 (clobber (reg:DI 26))
6615 (clobber (reg:DI 27))])]
6616 "TARGET_ABI_OPEN_VMS"
6618 operands[4] = gen_rtx_SYMBOL_REF (Pmode, "OTS$MOVE");
6619 alpha_need_linkage (XSTR (operands[4], 0), 0);
6622 (define_insn "*movmemdi_1"
6623 [(set (match_operand:BLK 0 "memory_operand" "=m,=m")
6624 (match_operand:BLK 1 "memory_operand" "m,m"))
6625 (use (match_operand:DI 2 "nonmemory_operand" "r,i"))
6626 (use (match_operand:DI 3 "immediate_operand" ""))
6627 (use (match_operand:DI 4 "call_operand" "i,i"))
6628 (clobber (reg:DI 25))
6629 (clobber (reg:DI 16))
6630 (clobber (reg:DI 17))
6631 (clobber (reg:DI 18))
6632 (clobber (reg:DI 19))
6633 (clobber (reg:DI 20))
6634 (clobber (reg:DI 26))
6635 (clobber (reg:DI 27))]
6636 "TARGET_ABI_OPEN_VMS"
6638 operands [5] = alpha_use_linkage (operands [4], cfun->decl, 0, 1);
6639 switch (which_alternative)
6642 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)";
6644 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)";
6649 [(set_attr "type" "multi")
6650 (set_attr "length" "28")])
6652 (define_expand "setmemqi"
6653 [(parallel [(set (match_operand:BLK 0 "memory_operand" "")
6654 (match_operand 2 "const_int_operand" ""))
6655 (use (match_operand:DI 1 "immediate_operand" ""))
6656 (use (match_operand:DI 3 "immediate_operand" ""))])]
6659 /* If value to set is not zero, use the library routine. */
6660 if (operands[2] != const0_rtx)
6663 if (alpha_expand_block_clear (operands))
6669 (define_expand "setmemdi"
6670 [(parallel [(set (match_operand:BLK 0 "memory_operand" "")
6671 (match_operand 2 "const_int_operand" ""))
6672 (use (match_operand:DI 1 "immediate_operand" ""))
6673 (use (match_operand:DI 3 "immediate_operand" ""))
6675 (clobber (reg:DI 25))
6676 (clobber (reg:DI 16))
6677 (clobber (reg:DI 17))
6678 (clobber (reg:DI 26))
6679 (clobber (reg:DI 27))])]
6680 "TARGET_ABI_OPEN_VMS"
6682 /* If value to set is not zero, use the library routine. */
6683 if (operands[2] != const0_rtx)
6686 operands[4] = gen_rtx_SYMBOL_REF (Pmode, "OTS$ZERO");
6687 alpha_need_linkage (XSTR (operands[4], 0), 0);
6690 (define_insn "*clrmemdi_1"
6691 [(set (match_operand:BLK 0 "memory_operand" "=m,=m")
6693 (use (match_operand:DI 1 "nonmemory_operand" "r,i"))
6694 (use (match_operand:DI 2 "immediate_operand" ""))
6695 (use (match_operand:DI 3 "call_operand" "i,i"))
6696 (clobber (reg:DI 25))
6697 (clobber (reg:DI 16))
6698 (clobber (reg:DI 17))
6699 (clobber (reg:DI 26))
6700 (clobber (reg:DI 27))]
6701 "TARGET_ABI_OPEN_VMS"
6703 operands [4] = alpha_use_linkage (operands [3], cfun->decl, 0, 1);
6704 switch (which_alternative)
6707 return "lda $16,%0\;bis $31,%1,$17\;ldq $26,%4\;lda $25,2($31)\;jsr $26,%3\;ldq $27,0($29)";
6709 return "lda $16,%0\;lda $17,%1($31)\;ldq $26,%4\;lda $25,2($31)\;jsr $26,%3\;ldq $27,0($29)";
6714 [(set_attr "type" "multi")
6715 (set_attr "length" "24")])
6718 ;; Subroutine of stack space allocation. Perform a stack probe.
6719 (define_expand "probe_stack"
6720 [(set (match_dup 1) (match_operand:DI 0 "const_int_operand" ""))]
6723 operands[1] = gen_rtx_MEM (DImode, plus_constant (stack_pointer_rtx,
6724 INTVAL (operands[0])));
6725 MEM_VOLATILE_P (operands[1]) = 1;
6727 operands[0] = const0_rtx;
6730 ;; This is how we allocate stack space. If we are allocating a
6731 ;; constant amount of space and we know it is less than 4096
6732 ;; bytes, we need do nothing.
6734 ;; If it is more than 4096 bytes, we need to probe the stack
6736 (define_expand "allocate_stack"
6738 (plus:DI (reg:DI 30)
6739 (match_operand:DI 1 "reg_or_cint_operand" "")))
6740 (set (match_operand:DI 0 "register_operand" "=r")
6744 if (GET_CODE (operands[1]) == CONST_INT
6745 && INTVAL (operands[1]) < 32768)
6747 if (INTVAL (operands[1]) >= 4096)
6749 /* We do this the same way as in the prologue and generate explicit
6750 probes. Then we update the stack by the constant. */
6754 emit_insn (gen_probe_stack (GEN_INT (- probed)));
6755 while (probed + 8192 < INTVAL (operands[1]))
6756 emit_insn (gen_probe_stack (GEN_INT (- (probed += 8192))));
6758 if (probed + 4096 < INTVAL (operands[1]))
6759 emit_insn (gen_probe_stack (GEN_INT (- INTVAL(operands[1]))));
6762 operands[1] = GEN_INT (- INTVAL (operands[1]));
6763 operands[2] = virtual_stack_dynamic_rtx;
6768 rtx loop_label = gen_label_rtx ();
6769 rtx want = gen_reg_rtx (Pmode);
6770 rtx tmp = gen_reg_rtx (Pmode);
6773 emit_insn (gen_subdi3 (want, stack_pointer_rtx,
6774 force_reg (Pmode, operands[1])));
6775 emit_insn (gen_adddi3 (tmp, stack_pointer_rtx, GEN_INT (-4096)));
6777 if (GET_CODE (operands[1]) != CONST_INT)
6779 out_label = gen_label_rtx ();
6780 emit_insn (gen_cmpdi (want, tmp));
6781 emit_jump_insn (gen_bgeu (out_label));
6784 emit_label (loop_label);
6785 memref = gen_rtx_MEM (DImode, tmp);
6786 MEM_VOLATILE_P (memref) = 1;
6787 emit_move_insn (memref, const0_rtx);
6788 emit_insn (gen_adddi3 (tmp, tmp, GEN_INT(-8192)));
6789 emit_insn (gen_cmpdi (tmp, want));
6790 emit_jump_insn (gen_bgtu (loop_label));
6792 memref = gen_rtx_MEM (DImode, want);
6793 MEM_VOLATILE_P (memref) = 1;
6794 emit_move_insn (memref, const0_rtx);
6797 emit_label (out_label);
6799 emit_move_insn (stack_pointer_rtx, want);
6800 emit_move_insn (operands[0], virtual_stack_dynamic_rtx);
6805 ;; This is used by alpha_expand_prolog to do the same thing as above,
6806 ;; except we cannot at that time generate new basic blocks, so we hide
6807 ;; the loop in this one insn.
6809 (define_insn "prologue_stack_probe_loop"
6810 [(unspec_volatile [(match_operand:DI 0 "register_operand" "r")
6811 (match_operand:DI 1 "register_operand" "r")]
6815 operands[2] = gen_label_rtx ();
6816 (*targetm.asm_out.internal_label) (asm_out_file, "L",
6817 CODE_LABEL_NUMBER (operands[2]));
6819 return "stq $31,-8192(%1)\;subq %0,1,%0\;lda %1,-8192(%1)\;bne %0,%l2";
6821 [(set_attr "length" "16")
6822 (set_attr "type" "multi")])
6824 (define_expand "prologue"
6825 [(clobber (const_int 0))]
6828 alpha_expand_prologue ();
6832 ;; These take care of emitting the ldgp insn in the prologue. This will be
6833 ;; an lda/ldah pair and we want to align them properly. So we have two
6834 ;; unspec_volatile insns, the first of which emits the ldgp assembler macro
6835 ;; and the second of which emits nothing. However, both are marked as type
6836 ;; IADD (the default) so the alignment code in alpha.c does the right thing
6839 (define_expand "prologue_ldgp"
6841 (unspec_volatile:DI [(match_dup 1) (match_dup 2)] UNSPECV_LDGP1))
6843 (unspec_volatile:DI [(match_dup 0) (match_dup 2)] UNSPECV_PLDGP2))]
6846 operands[0] = pic_offset_table_rtx;
6847 operands[1] = gen_rtx_REG (Pmode, 27);
6848 operands[2] = (TARGET_EXPLICIT_RELOCS
6849 ? GEN_INT (alpha_next_sequence_number++)
6853 (define_insn "*ldgp_er_1"
6854 [(set (match_operand:DI 0 "register_operand" "=r")
6855 (unspec_volatile:DI [(match_operand:DI 1 "register_operand" "r")
6856 (match_operand 2 "const_int_operand" "")]
6858 "TARGET_EXPLICIT_RELOCS && TARGET_ABI_OSF"
6859 "ldah %0,0(%1)\t\t!gpdisp!%2"
6860 [(set_attr "cannot_copy" "true")])
6862 (define_insn "*ldgp_er_2"
6863 [(set (match_operand:DI 0 "register_operand" "=r")
6864 (unspec:DI [(match_operand:DI 1 "register_operand" "r")
6865 (match_operand 2 "const_int_operand" "")]
6867 "TARGET_EXPLICIT_RELOCS && TARGET_ABI_OSF"
6868 "lda %0,0(%1)\t\t!gpdisp!%2"
6869 [(set_attr "cannot_copy" "true")])
6871 (define_insn "*prologue_ldgp_er_2"
6872 [(set (match_operand:DI 0 "register_operand" "=r")
6873 (unspec_volatile:DI [(match_operand:DI 1 "register_operand" "r")
6874 (match_operand 2 "const_int_operand" "")]
6876 "TARGET_EXPLICIT_RELOCS && TARGET_ABI_OSF"
6877 "lda %0,0(%1)\t\t!gpdisp!%2\n$%~..ng:"
6878 [(set_attr "cannot_copy" "true")])
6880 (define_insn "*prologue_ldgp_1"
6881 [(set (match_operand:DI 0 "register_operand" "=r")
6882 (unspec_volatile:DI [(match_operand:DI 1 "register_operand" "r")
6883 (match_operand 2 "const_int_operand" "")]
6886 "ldgp %0,0(%1)\n$%~..ng:"
6887 [(set_attr "cannot_copy" "true")])
6889 (define_insn "*prologue_ldgp_2"
6890 [(set (match_operand:DI 0 "register_operand" "=r")
6891 (unspec_volatile:DI [(match_operand:DI 1 "register_operand" "r")
6892 (match_operand 2 "const_int_operand" "")]
6897 ;; The _mcount profiling hook has special calling conventions, and
6898 ;; does not clobber all the registers that a normal call would. So
6899 ;; hide the fact this is a call at all.
6901 (define_insn "prologue_mcount"
6902 [(unspec_volatile [(const_int 0)] UNSPECV_MCOUNT)]
6905 if (TARGET_EXPLICIT_RELOCS)
6906 /* Note that we cannot use a lituse_jsr reloc, since _mcount
6907 cannot be called via the PLT. */
6908 return "ldq $28,_mcount($29)\t\t!literal\;jsr $28,($28),_mcount";
6910 return "lda $28,_mcount\;jsr $28,($28),_mcount";
6912 [(set_attr "type" "multi")
6913 (set_attr "length" "8")])
6915 (define_insn "init_fp"
6916 [(set (match_operand:DI 0 "register_operand" "=r")
6917 (match_operand:DI 1 "register_operand" "r"))
6918 (clobber (mem:BLK (match_operand:DI 2 "register_operand" "=r")))]
6922 (define_expand "epilogue"
6926 alpha_expand_epilogue ();
6929 (define_expand "sibcall_epilogue"
6933 alpha_expand_epilogue ();
6937 (define_expand "builtin_longjmp"
6938 [(use (match_operand:DI 0 "register_operand" "r"))]
6941 /* The elements of the buffer are, in order: */
6942 rtx fp = gen_rtx_MEM (Pmode, operands[0]);
6943 rtx lab = gen_rtx_MEM (Pmode, plus_constant (operands[0], 8));
6944 rtx stack = gen_rtx_MEM (Pmode, plus_constant (operands[0], 16));
6945 rtx pv = gen_rtx_REG (Pmode, 27);
6947 /* This bit is the same as expand_builtin_longjmp. */
6948 emit_move_insn (hard_frame_pointer_rtx, fp);
6949 emit_move_insn (pv, lab);
6950 emit_stack_restore (SAVE_NONLOCAL, stack, NULL_RTX);
6951 emit_use (hard_frame_pointer_rtx);
6952 emit_use (stack_pointer_rtx);
6954 /* Load the label we are jumping through into $27 so that we know
6955 where to look for it when we get back to setjmp's function for
6956 restoring the gp. */
6957 emit_jump_insn (gen_builtin_longjmp_internal (pv));
6962 ;; This is effectively a copy of indirect_jump, but constrained such
6963 ;; that register renaming cannot foil our cunning plan with $27.
6964 (define_insn "builtin_longjmp_internal"
6966 (unspec_volatile [(match_operand:DI 0 "register_operand" "c")]
6970 [(set_attr "type" "ibr")])
6972 (define_expand "builtin_setjmp_receiver"
6973 [(unspec_volatile [(label_ref (match_operand 0 "" ""))] UNSPECV_SETJMPR)]
6977 (define_insn_and_split "*builtin_setjmp_receiver_1"
6978 [(unspec_volatile [(match_operand 0 "" "")] UNSPECV_SETJMPR)]
6981 if (TARGET_EXPLICIT_RELOCS)
6984 return "br $27,$LSJ%=\n$LSJ%=:\;ldgp $29,0($27)";
6986 "&& TARGET_EXPLICIT_RELOCS && reload_completed"
6988 (unspec_volatile:DI [(match_dup 2) (match_dup 3)] UNSPECV_LDGP1))
6990 (unspec:DI [(match_dup 1) (match_dup 3)] UNSPEC_LDGP2))]
6992 if (prev_nonnote_insn (curr_insn) != XEXP (operands[0], 0))
6993 emit_insn (gen_rtx_UNSPEC_VOLATILE (VOIDmode, gen_rtvec (1, operands[0]),
6994 UNSPECV_SETJMPR_ER));
6995 operands[1] = pic_offset_table_rtx;
6996 operands[2] = gen_rtx_REG (Pmode, 27);
6997 operands[3] = GEN_INT (alpha_next_sequence_number++);
6999 [(set_attr "length" "12")
7000 (set_attr "type" "multi")])
7002 (define_insn "*builtin_setjmp_receiver_er_sl_1"
7003 [(unspec_volatile [(match_operand 0 "" "")] UNSPECV_SETJMPR_ER)]
7004 "TARGET_ABI_OSF && TARGET_EXPLICIT_RELOCS && TARGET_AS_CAN_SUBTRACT_LABELS"
7005 "lda $27,$LSJ%=-%l0($27)\n$LSJ%=:")
7007 (define_insn "*builtin_setjmp_receiver_er_1"
7008 [(unspec_volatile [(match_operand 0 "" "")] UNSPECV_SETJMPR_ER)]
7009 "TARGET_ABI_OSF && TARGET_EXPLICIT_RELOCS"
7010 "br $27,$LSJ%=\n$LSJ%=:"
7011 [(set_attr "type" "ibr")])
7013 (define_expand "exception_receiver"
7014 [(unspec_volatile [(match_dup 0)] UNSPECV_EHR)]
7017 if (TARGET_LD_BUGGY_LDGP)
7018 operands[0] = alpha_gp_save_rtx ();
7020 operands[0] = const0_rtx;
7023 (define_insn "*exception_receiver_2"
7024 [(unspec_volatile [(match_operand:DI 0 "memory_operand" "m")] UNSPECV_EHR)]
7025 "TARGET_ABI_OSF && TARGET_LD_BUGGY_LDGP"
7027 [(set_attr "type" "ild")])
7029 (define_insn_and_split "*exception_receiver_1"
7030 [(unspec_volatile [(const_int 0)] UNSPECV_EHR)]
7033 if (TARGET_EXPLICIT_RELOCS)
7034 return "ldah $29,0($26)\t\t!gpdisp!%*\;lda $29,0($29)\t\t!gpdisp!%*";
7036 return "ldgp $29,0($26)";
7038 "&& TARGET_EXPLICIT_RELOCS && reload_completed"
7040 (unspec_volatile:DI [(match_dup 1) (match_dup 2)] UNSPECV_LDGP1))
7042 (unspec:DI [(match_dup 0) (match_dup 2)] UNSPEC_LDGP2))]
7044 operands[0] = pic_offset_table_rtx;
7045 operands[1] = gen_rtx_REG (Pmode, 26);
7046 operands[2] = GEN_INT (alpha_next_sequence_number++);
7048 [(set_attr "length" "8")
7049 (set_attr "type" "multi")])
7051 (define_expand "nonlocal_goto_receiver"
7052 [(unspec_volatile [(const_int 0)] UNSPECV_BLOCKAGE)
7053 (set (reg:DI 27) (mem:DI (reg:DI 29)))
7054 (unspec_volatile [(const_int 0)] UNSPECV_BLOCKAGE)
7056 "TARGET_ABI_OPEN_VMS"
7059 (define_insn "arg_home"
7060 [(unspec [(const_int 0)] UNSPEC_ARG_HOME)
7075 (clobber (mem:BLK (const_int 0)))
7076 (clobber (reg:DI 24))
7077 (clobber (reg:DI 25))
7078 (clobber (reg:DI 0))]
7079 "TARGET_ABI_OPEN_VMS"
7080 "lda $0,OTS$HOME_ARGS\;ldq $0,8($0)\;jsr $0,OTS$HOME_ARGS"
7081 [(set_attr "length" "16")
7082 (set_attr "type" "multi")])
7084 ;; Load the CIW into r2 for calling __T3E_MISMATCH
7086 (define_expand "umk_mismatch_args"
7087 [(set:DI (match_dup 1) (mem:DI (plus:DI (reg:DI 15) (const_int -16))))
7088 (set:DI (match_dup 2) (mem:DI (plus:DI (match_dup 1) (const_int -32))))
7089 (set:DI (reg:DI 1) (match_operand:DI 0 "const_int_operand" ""))
7090 (set:DI (match_dup 3) (plus:DI (mult:DI (reg:DI 25)
7093 (set:DI (reg:DI 2) (mem:DI (match_dup 3)))]
7094 "TARGET_ABI_UNICOSMK"
7096 operands[1] = gen_reg_rtx (DImode);
7097 operands[2] = gen_reg_rtx (DImode);
7098 operands[3] = gen_reg_rtx (DImode);
7101 (define_insn "arg_home_umk"
7102 [(unspec [(const_int 0)] UNSPEC_ARG_HOME)
7117 (clobber (mem:BLK (const_int 0)))
7119 (clobber (reg:DI 22))
7120 (clobber (reg:DI 23))
7121 (clobber (reg:DI 24))
7122 (clobber (reg:DI 0))
7123 (clobber (reg:DI 1))
7124 (clobber (reg:DI 2))
7125 (clobber (reg:DI 3))
7126 (clobber (reg:DI 4))
7127 (clobber (reg:DI 5))
7128 (clobber (reg:DI 6))
7129 (clobber (reg:DI 7))
7130 (clobber (reg:DI 8))])]
7131 "TARGET_ABI_UNICOSMK"
7132 "laum $4,__T3E_MISMATCH($31)\;sll $4,32,$4\;lalm $4,__T3E_MISMATCH($4)\;lal $4,__T3E_MISMATCH($4)\;jsr $3,($4)"
7133 [(set_attr "length" "16")
7134 (set_attr "type" "multi")])
7138 ;; On EV4, these instructions are nops -- no load occurs.
7140 ;; On EV5, these instructions act as a normal load, and thus can trap
7141 ;; if the address is invalid. The OS may (or may not) handle this in
7142 ;; the entMM fault handler and suppress the fault. If so, then this
7143 ;; has the effect of a read prefetch instruction.
7145 ;; On EV6, these become official prefetch instructions.
7147 (define_insn "prefetch"
7148 [(prefetch (match_operand:DI 0 "address_operand" "p")
7149 (match_operand:DI 1 "const_int_operand" "n")
7150 (match_operand:DI 2 "const_int_operand" "n"))]
7151 "TARGET_FIXUP_EV5_PREFETCH || alpha_cpu == PROCESSOR_EV6"
7153 /* Interpret "no temporal locality" as this data should be evicted once
7154 it is used. The "evict next" alternatives load the data into the cache
7155 and leave the LRU eviction counter pointing to that block. */
7156 static const char * const alt[2][2] = {
7158 "ldq $31,%a0", /* read, evict next */
7159 "ldl $31,%a0", /* read, evict last */
7162 "ldt $f31,%a0", /* write, evict next */
7163 "lds $f31,%a0", /* write, evict last */
7167 bool write = INTVAL (operands[1]) != 0;
7168 bool lru = INTVAL (operands[2]) != 0;
7170 return alt[write][lru];
7172 [(set_attr "type" "ild")])
7174 ;; Close the trap shadow of preceding instructions. This is generated
7177 (define_insn "trapb"
7178 [(unspec_volatile [(const_int 0)] UNSPECV_TRAPB)]
7181 [(set_attr "type" "misc")])
7183 ;; No-op instructions used by machine-dependent reorg to preserve
7184 ;; alignment for instruction issue.
7185 ;; The Unicos/Mk assembler does not support these opcodes.
7191 [(set_attr "type" "ilog")])
7196 "cpys $f31,$f31,$f31"
7197 [(set_attr "type" "fcpys")])
7204 ;; On Unicos/Mk we use a macro for aligning code.
7206 (define_insn "realign"
7207 [(unspec_volatile [(match_operand 0 "immediate_operand" "i")]
7211 if (TARGET_ABI_UNICOSMK)
7212 return "gcc@code@align %0";
7214 return ".align %0 #realign";
7217 ;; Instructions to be emitted from __builtins.
7219 (define_insn "builtin_cmpbge"
7220 [(set (match_operand:DI 0 "register_operand" "=r")
7221 (unspec:DI [(match_operand:DI 1 "reg_or_0_operand" "rJ")
7222 (match_operand:DI 2 "reg_or_8bit_operand" "rI")]
7226 ;; The EV6 data sheets list this as ILOG. OTOH, EV6 doesn't
7227 ;; actually differentiate between ILOG and ICMP in the schedule.
7228 [(set_attr "type" "icmp")])
7230 (define_expand "builtin_extbl"
7231 [(match_operand:DI 0 "register_operand" "")
7232 (match_operand:DI 1 "reg_or_0_operand" "")
7233 (match_operand:DI 2 "reg_or_8bit_operand" "")]
7236 rtx (*gen) (rtx, rtx, rtx, rtx);
7237 if (WORDS_BIG_ENDIAN)
7241 emit_insn ((*gen) (operands[0], operands[1], GEN_INT (8), operands[2]));
7245 (define_expand "builtin_extwl"
7246 [(match_operand:DI 0 "register_operand" "")
7247 (match_operand:DI 1 "reg_or_0_operand" "")
7248 (match_operand:DI 2 "reg_or_8bit_operand" "")]
7251 rtx (*gen) (rtx, rtx, rtx, rtx);
7252 if (WORDS_BIG_ENDIAN)
7256 emit_insn ((*gen) (operands[0], operands[1], GEN_INT (16), operands[2]));
7260 (define_expand "builtin_extll"
7261 [(match_operand:DI 0 "register_operand" "")
7262 (match_operand:DI 1 "reg_or_0_operand" "")
7263 (match_operand:DI 2 "reg_or_8bit_operand" "")]
7266 rtx (*gen) (rtx, rtx, rtx, rtx);
7267 if (WORDS_BIG_ENDIAN)
7271 emit_insn ((*gen) (operands[0], operands[1], GEN_INT (32), operands[2]));
7275 (define_expand "builtin_extql"
7276 [(match_operand:DI 0 "register_operand" "")
7277 (match_operand:DI 1 "reg_or_0_operand" "")
7278 (match_operand:DI 2 "reg_or_8bit_operand" "")]
7281 rtx (*gen) (rtx, rtx, rtx, rtx);
7282 if (WORDS_BIG_ENDIAN)
7286 emit_insn ((*gen) (operands[0], operands[1], GEN_INT (64), operands[2]));
7290 (define_expand "builtin_extwh"
7291 [(match_operand:DI 0 "register_operand" "")
7292 (match_operand:DI 1 "reg_or_0_operand" "")
7293 (match_operand:DI 2 "reg_or_8bit_operand" "")]
7296 rtx (*gen) (rtx, rtx, rtx);
7297 if (WORDS_BIG_ENDIAN)
7301 emit_insn ((*gen) (operands[0], operands[1], operands[2]));
7305 (define_expand "builtin_extlh"
7306 [(match_operand:DI 0 "register_operand" "")
7307 (match_operand:DI 1 "reg_or_0_operand" "")
7308 (match_operand:DI 2 "reg_or_8bit_operand" "")]
7311 rtx (*gen) (rtx, rtx, rtx);
7312 if (WORDS_BIG_ENDIAN)
7316 emit_insn ((*gen) (operands[0], operands[1], operands[2]));
7320 (define_expand "builtin_extqh"
7321 [(match_operand:DI 0 "register_operand" "")
7322 (match_operand:DI 1 "reg_or_0_operand" "")
7323 (match_operand:DI 2 "reg_or_8bit_operand" "")]
7326 rtx (*gen) (rtx, rtx, rtx);
7327 if (WORDS_BIG_ENDIAN)
7331 emit_insn ((*gen) (operands[0], operands[1], operands[2]));
7335 (define_expand "builtin_insbl"
7336 [(match_operand:DI 0 "register_operand" "")
7337 (match_operand:DI 1 "register_operand" "")
7338 (match_operand:DI 2 "reg_or_8bit_operand" "")]
7341 rtx (*gen) (rtx, rtx, rtx);
7342 if (WORDS_BIG_ENDIAN)
7346 operands[1] = gen_lowpart (QImode, operands[1]);
7347 emit_insn ((*gen) (operands[0], operands[1], operands[2]));
7351 (define_expand "builtin_inswl"
7352 [(match_operand:DI 0 "register_operand" "")
7353 (match_operand:DI 1 "register_operand" "")
7354 (match_operand:DI 2 "reg_or_8bit_operand" "")]
7357 rtx (*gen) (rtx, rtx, rtx);
7358 if (WORDS_BIG_ENDIAN)
7362 operands[1] = gen_lowpart (HImode, operands[1]);
7363 emit_insn ((*gen) (operands[0], operands[1], operands[2]));
7367 (define_expand "builtin_insll"
7368 [(match_operand:DI 0 "register_operand" "")
7369 (match_operand:DI 1 "register_operand" "")
7370 (match_operand:DI 2 "reg_or_8bit_operand" "")]
7373 rtx (*gen) (rtx, rtx, rtx);
7374 if (WORDS_BIG_ENDIAN)
7378 operands[1] = gen_lowpart (SImode, operands[1]);
7379 emit_insn ((*gen) (operands[0], operands[1], operands[2]));
7380 emit_insn ((*gen) (operands[0], operands[1], operands[2]));
7384 (define_expand "builtin_insql"
7385 [(match_operand:DI 0 "register_operand" "")
7386 (match_operand:DI 1 "reg_or_0_operand" "")
7387 (match_operand:DI 2 "reg_or_8bit_operand" "")]
7390 rtx (*gen) (rtx, rtx, rtx);
7391 if (WORDS_BIG_ENDIAN)
7395 emit_insn ((*gen) (operands[0], operands[1], operands[2]));
7399 (define_expand "builtin_inswh"
7400 [(match_operand:DI 0 "register_operand" "")
7401 (match_operand:DI 1 "register_operand" "")
7402 (match_operand:DI 2 "reg_or_8bit_operand" "")]
7405 emit_insn (gen_insxh (operands[0], operands[1], GEN_INT (16), operands[2]));
7409 (define_expand "builtin_inslh"
7410 [(match_operand:DI 0 "register_operand" "")
7411 (match_operand:DI 1 "register_operand" "")
7412 (match_operand:DI 2 "reg_or_8bit_operand" "")]
7415 emit_insn (gen_insxh (operands[0], operands[1], GEN_INT (32), operands[2]));
7419 (define_expand "builtin_insqh"
7420 [(match_operand:DI 0 "register_operand" "")
7421 (match_operand:DI 1 "register_operand" "")
7422 (match_operand:DI 2 "reg_or_8bit_operand" "")]
7425 emit_insn (gen_insxh (operands[0], operands[1], GEN_INT (64), operands[2]));
7429 (define_expand "builtin_mskbl"
7430 [(match_operand:DI 0 "register_operand" "")
7431 (match_operand:DI 1 "reg_or_0_operand" "")
7432 (match_operand:DI 2 "reg_or_8bit_operand" "")]
7435 rtx (*gen) (rtx, rtx, rtx, rtx);
7437 if (WORDS_BIG_ENDIAN)
7441 mask = GEN_INT (0xff);
7442 emit_insn ((*gen) (operands[0], operands[1], mask, operands[2]));
7446 (define_expand "builtin_mskwl"
7447 [(match_operand:DI 0 "register_operand" "")
7448 (match_operand:DI 1 "reg_or_0_operand" "")
7449 (match_operand:DI 2 "reg_or_8bit_operand" "")]
7452 rtx (*gen) (rtx, rtx, rtx, rtx);
7454 if (WORDS_BIG_ENDIAN)
7458 mask = GEN_INT (0xffff);
7459 emit_insn ((*gen) (operands[0], operands[1], mask, operands[2]));
7463 (define_expand "builtin_mskll"
7464 [(match_operand:DI 0 "register_operand" "")
7465 (match_operand:DI 1 "reg_or_0_operand" "")
7466 (match_operand:DI 2 "reg_or_8bit_operand" "")]
7469 rtx (*gen) (rtx, rtx, rtx, rtx);
7471 if (WORDS_BIG_ENDIAN)
7475 mask = immed_double_const (0xffffffff, 0, DImode);
7476 emit_insn ((*gen) (operands[0], operands[1], mask, operands[2]));
7480 (define_expand "builtin_mskql"
7481 [(match_operand:DI 0 "register_operand" "")
7482 (match_operand:DI 1 "reg_or_0_operand" "")
7483 (match_operand:DI 2 "reg_or_8bit_operand" "")]
7486 rtx (*gen) (rtx, rtx, rtx, rtx);
7488 if (WORDS_BIG_ENDIAN)
7493 emit_insn ((*gen) (operands[0], operands[1], mask, operands[2]));
7497 (define_expand "builtin_mskwh"
7498 [(match_operand:DI 0 "register_operand" "")
7499 (match_operand:DI 1 "register_operand" "")
7500 (match_operand:DI 2 "reg_or_8bit_operand" "")]
7503 emit_insn (gen_mskxh (operands[0], operands[1], GEN_INT (16), operands[2]));
7507 (define_expand "builtin_msklh"
7508 [(match_operand:DI 0 "register_operand" "")
7509 (match_operand:DI 1 "register_operand" "")
7510 (match_operand:DI 2 "reg_or_8bit_operand" "")]
7513 emit_insn (gen_mskxh (operands[0], operands[1], GEN_INT (32), operands[2]));
7517 (define_expand "builtin_mskqh"
7518 [(match_operand:DI 0 "register_operand" "")
7519 (match_operand:DI 1 "register_operand" "")
7520 (match_operand:DI 2 "reg_or_8bit_operand" "")]
7523 emit_insn (gen_mskxh (operands[0], operands[1], GEN_INT (64), operands[2]));
7527 (define_expand "builtin_zap"
7528 [(set (match_operand:DI 0 "register_operand" "")
7530 [(match_operand:DI 2 "reg_or_cint_operand" "")]
7532 (match_operand:DI 1 "reg_or_cint_operand" "")))]
7535 if (GET_CODE (operands[2]) == CONST_INT)
7537 rtx mask = alpha_expand_zap_mask (INTVAL (operands[2]));
7539 if (mask == const0_rtx)
7541 emit_move_insn (operands[0], const0_rtx);
7544 if (mask == constm1_rtx)
7546 emit_move_insn (operands[0], operands[1]);
7550 operands[1] = force_reg (DImode, operands[1]);
7551 emit_insn (gen_anddi3 (operands[0], operands[1], mask));
7555 operands[1] = force_reg (DImode, operands[1]);
7556 operands[2] = gen_lowpart (QImode, operands[2]);
7559 (define_insn "*builtin_zap_1"
7560 [(set (match_operand:DI 0 "register_operand" "=r,r,r,r")
7562 [(match_operand:QI 2 "reg_or_cint_operand" "n,n,r,r")]
7564 (match_operand:DI 1 "reg_or_cint_operand" "n,r,J,r")))]
7571 [(set_attr "type" "shift,shift,ilog,shift")])
7574 [(set (match_operand:DI 0 "register_operand" "")
7576 [(match_operand:QI 2 "const_int_operand" "")]
7578 (match_operand:DI 1 "const_int_operand" "")))]
7582 rtx mask = alpha_expand_zap_mask (INTVAL (operands[2]));
7583 if (HOST_BITS_PER_WIDE_INT >= 64 || GET_CODE (mask) == CONST_INT)
7584 operands[1] = gen_int_mode (INTVAL (operands[1]) & INTVAL (mask), DImode);
7587 HOST_WIDE_INT c_lo = INTVAL (operands[1]);
7588 HOST_WIDE_INT c_hi = (c_lo < 0 ? -1 : 0);
7589 operands[1] = immed_double_const (c_lo & CONST_DOUBLE_LOW (mask),
7590 c_hi & CONST_DOUBLE_HIGH (mask),
7593 emit_move_insn (operands[0], operands[1]);
7598 [(set (match_operand:DI 0 "register_operand" "")
7600 [(match_operand:QI 2 "const_int_operand" "")]
7602 (match_operand:DI 1 "register_operand" "")))]
7605 (and:DI (match_dup 1) (match_dup 2)))]
7607 operands[2] = alpha_expand_zap_mask (INTVAL (operands[2]));
7608 if (operands[2] == const0_rtx)
7610 emit_move_insn (operands[0], const0_rtx);
7613 if (operands[2] == constm1_rtx)
7615 emit_move_insn (operands[0], operands[1]);
7620 (define_expand "builtin_zapnot"
7621 [(set (match_operand:DI 0 "register_operand" "")
7623 [(not:QI (match_operand:DI 2 "reg_or_cint_operand" ""))]
7625 (match_operand:DI 1 "reg_or_cint_operand" "")))]
7628 if (GET_CODE (operands[2]) == CONST_INT)
7630 rtx mask = alpha_expand_zap_mask (~ INTVAL (operands[2]));
7632 if (mask == const0_rtx)
7634 emit_move_insn (operands[0], const0_rtx);
7637 if (mask == constm1_rtx)
7639 emit_move_insn (operands[0], operands[1]);
7643 operands[1] = force_reg (DImode, operands[1]);
7644 emit_insn (gen_anddi3 (operands[0], operands[1], mask));
7648 operands[1] = force_reg (DImode, operands[1]);
7649 operands[2] = gen_lowpart (QImode, operands[2]);
7652 (define_insn "*builtin_zapnot_1"
7653 [(set (match_operand:DI 0 "register_operand" "=r")
7655 [(not:QI (match_operand:QI 2 "register_operand" "r"))]
7657 (match_operand:DI 1 "reg_or_0_operand" "rJ")))]
7660 [(set_attr "type" "shift")])
7662 (define_insn "builtin_amask"
7663 [(set (match_operand:DI 0 "register_operand" "=r")
7664 (unspec:DI [(match_operand:DI 1 "reg_or_8bit_operand" "rI")]
7668 [(set_attr "type" "ilog")])
7670 (define_insn "builtin_implver"
7671 [(set (match_operand:DI 0 "register_operand" "=r")
7672 (unspec:DI [(const_int 0)] UNSPEC_IMPLVER))]
7675 [(set_attr "type" "ilog")])
7677 (define_insn "builtin_rpcc"
7678 [(set (match_operand:DI 0 "register_operand" "=r")
7679 (unspec_volatile:DI [(const_int 0)] UNSPECV_RPCC))]
7682 [(set_attr "type" "ilog")])
7684 (define_expand "builtin_minub8"
7685 [(match_operand:DI 0 "register_operand" "")
7686 (match_operand:DI 1 "reg_or_0_operand" "")
7687 (match_operand:DI 2 "reg_or_0_operand" "")]
7690 alpha_expand_builtin_vector_binop (gen_uminv8qi3, V8QImode, operands[0],
7691 operands[1], operands[2]);
7695 (define_expand "builtin_minsb8"
7696 [(match_operand:DI 0 "register_operand" "")
7697 (match_operand:DI 1 "reg_or_0_operand" "")
7698 (match_operand:DI 2 "reg_or_0_operand" "")]
7701 alpha_expand_builtin_vector_binop (gen_sminv8qi3, V8QImode, operands[0],
7702 operands[1], operands[2]);
7706 (define_expand "builtin_minuw4"
7707 [(match_operand:DI 0 "register_operand" "")
7708 (match_operand:DI 1 "reg_or_0_operand" "")
7709 (match_operand:DI 2 "reg_or_0_operand" "")]
7712 alpha_expand_builtin_vector_binop (gen_uminv4hi3, V4HImode, operands[0],
7713 operands[1], operands[2]);
7717 (define_expand "builtin_minsw4"
7718 [(match_operand:DI 0 "register_operand" "")
7719 (match_operand:DI 1 "reg_or_0_operand" "")
7720 (match_operand:DI 2 "reg_or_0_operand" "")]
7723 alpha_expand_builtin_vector_binop (gen_sminv4hi3, V4HImode, operands[0],
7724 operands[1], operands[2]);
7728 (define_expand "builtin_maxub8"
7729 [(match_operand:DI 0 "register_operand" "")
7730 (match_operand:DI 1 "reg_or_0_operand" "")
7731 (match_operand:DI 2 "reg_or_0_operand" "")]
7734 alpha_expand_builtin_vector_binop (gen_umaxv8qi3, V8QImode, operands[0],
7735 operands[1], operands[2]);
7739 (define_expand "builtin_maxsb8"
7740 [(match_operand:DI 0 "register_operand" "")
7741 (match_operand:DI 1 "reg_or_0_operand" "")
7742 (match_operand:DI 2 "reg_or_0_operand" "")]
7745 alpha_expand_builtin_vector_binop (gen_smaxv8qi3, V8QImode, operands[0],
7746 operands[1], operands[2]);
7750 (define_expand "builtin_maxuw4"
7751 [(match_operand:DI 0 "register_operand" "")
7752 (match_operand:DI 1 "reg_or_0_operand" "")
7753 (match_operand:DI 2 "reg_or_0_operand" "")]
7756 alpha_expand_builtin_vector_binop (gen_umaxv4hi3, V4HImode, operands[0],
7757 operands[1], operands[2]);
7761 (define_expand "builtin_maxsw4"
7762 [(match_operand:DI 0 "register_operand" "")
7763 (match_operand:DI 1 "reg_or_0_operand" "")
7764 (match_operand:DI 2 "reg_or_0_operand" "")]
7767 alpha_expand_builtin_vector_binop (gen_smaxv4hi3, V4HImode, operands[0],
7768 operands[1], operands[2]);
7772 (define_insn "builtin_perr"
7773 [(set (match_operand:DI 0 "register_operand" "=r")
7774 (unspec:DI [(match_operand:DI 1 "reg_or_0_operand" "%rJ")
7775 (match_operand:DI 2 "reg_or_8bit_operand" "rJ")]
7779 [(set_attr "type" "mvi")])
7781 (define_expand "builtin_pklb"
7782 [(set (match_operand:DI 0 "register_operand" "")
7785 (truncate:V2QI (match_operand:DI 1 "register_operand" ""))
7790 operands[0] = gen_lowpart (V8QImode, operands[0]);
7791 operands[1] = gen_lowpart (V2SImode, operands[1]);
7792 operands[2] = CONST0_RTX (V2QImode);
7793 operands[3] = CONST0_RTX (V4QImode);
7796 (define_insn "*pklb"
7797 [(set (match_operand:V8QI 0 "register_operand" "=r")
7800 (truncate:V2QI (match_operand:V2SI 1 "register_operand" "r"))
7801 (match_operand:V2QI 2 "const0_operand" ""))
7802 (match_operand:V4QI 3 "const0_operand" "")))]
7805 [(set_attr "type" "mvi")])
7807 (define_expand "builtin_pkwb"
7808 [(set (match_operand:DI 0 "register_operand" "")
7810 (truncate:V4QI (match_operand:DI 1 "register_operand" ""))
7814 operands[0] = gen_lowpart (V8QImode, operands[0]);
7815 operands[1] = gen_lowpart (V4HImode, operands[1]);
7816 operands[2] = CONST0_RTX (V4QImode);
7819 (define_insn "*pkwb"
7820 [(set (match_operand:V8QI 0 "register_operand" "=r")
7822 (truncate:V4QI (match_operand:V4HI 1 "register_operand" "r"))
7823 (match_operand:V4QI 2 "const0_operand" "")))]
7826 [(set_attr "type" "mvi")])
7828 (define_expand "builtin_unpkbl"
7829 [(set (match_operand:DI 0 "register_operand" "")
7831 (vec_select:V2QI (match_operand:DI 1 "register_operand" "")
7832 (parallel [(const_int 0) (const_int 1)]))))]
7835 operands[0] = gen_lowpart (V2SImode, operands[0]);
7836 operands[1] = gen_lowpart (V8QImode, operands[1]);
7839 (define_insn "*unpkbl"
7840 [(set (match_operand:V2SI 0 "register_operand" "=r")
7842 (vec_select:V2QI (match_operand:V8QI 1 "reg_or_0_operand" "rW")
7843 (parallel [(const_int 0) (const_int 1)]))))]
7846 [(set_attr "type" "mvi")])
7848 (define_expand "builtin_unpkbw"
7849 [(set (match_operand:DI 0 "register_operand" "")
7851 (vec_select:V4QI (match_operand:DI 1 "register_operand" "")
7852 (parallel [(const_int 0)
7858 operands[0] = gen_lowpart (V4HImode, operands[0]);
7859 operands[1] = gen_lowpart (V8QImode, operands[1]);
7862 (define_insn "*unpkbw"
7863 [(set (match_operand:V4HI 0 "register_operand" "=r")
7865 (vec_select:V4QI (match_operand:V8QI 1 "reg_or_0_operand" "rW")
7866 (parallel [(const_int 0)
7872 [(set_attr "type" "mvi")])
7876 ;; The call patterns are at the end of the file because their
7877 ;; wildcard operand0 interferes with nice recognition.
7879 (define_insn "*call_value_osf_1_er_noreturn"
7880 [(set (match_operand 0 "" "")
7881 (call (mem:DI (match_operand:DI 1 "call_operand" "c,R,s"))
7882 (match_operand 2 "" "")))
7884 (clobber (reg:DI 26))]
7885 "TARGET_EXPLICIT_RELOCS && TARGET_ABI_OSF
7886 && find_reg_note (insn, REG_NORETURN, NULL_RTX)"
7889 bsr $26,%1\t\t!samegp
7890 ldq $27,%1($29)\t\t!literal!%#\;jsr $26,($27),%1\t\t!lituse_jsr!%#"
7891 [(set_attr "type" "jsr")
7892 (set_attr "length" "*,*,8")])
7894 (define_insn "*call_value_osf_1_er"
7895 [(set (match_operand 0 "" "")
7896 (call (mem:DI (match_operand:DI 1 "call_operand" "c,R,s"))
7897 (match_operand 2 "" "")))
7899 (clobber (reg:DI 26))]
7900 "TARGET_EXPLICIT_RELOCS && TARGET_ABI_OSF"
7902 jsr $26,(%1),0\;ldah $29,0($26)\t\t!gpdisp!%*\;lda $29,0($29)\t\t!gpdisp!%*
7903 bsr $26,%1\t\t!samegp
7904 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!%*"
7905 [(set_attr "type" "jsr")
7906 (set_attr "length" "12,*,16")])
7908 ;; We must use peep2 instead of a split because we need accurate life
7909 ;; information for $gp. Consider the case of { bar(); while (1); }.
7911 [(parallel [(set (match_operand 0 "" "")
7912 (call (mem:DI (match_operand:DI 1 "call_operand" ""))
7913 (match_operand 2 "" "")))
7915 (clobber (reg:DI 26))])]
7916 "TARGET_EXPLICIT_RELOCS && TARGET_ABI_OSF && reload_completed
7917 && ! samegp_function_operand (operands[1], Pmode)
7918 && (peep2_regno_dead_p (1, 29)
7919 || find_reg_note (insn, REG_NORETURN, NULL_RTX))"
7920 [(parallel [(set (match_dup 0)
7921 (call (mem:DI (match_dup 3))
7926 (clobber (reg:DI 26))])]
7928 if (CONSTANT_P (operands[1]))
7930 operands[3] = gen_rtx_REG (Pmode, 27);
7931 operands[4] = GEN_INT (alpha_next_sequence_number++);
7932 emit_insn (gen_movdi_er_high_g (operands[3], pic_offset_table_rtx,
7933 operands[1], operands[4]));
7937 operands[3] = operands[1];
7938 operands[1] = const0_rtx;
7939 operands[4] = const0_rtx;
7944 [(parallel [(set (match_operand 0 "" "")
7945 (call (mem:DI (match_operand:DI 1 "call_operand" ""))
7946 (match_operand 2 "" "")))
7948 (clobber (reg:DI 26))])]
7949 "TARGET_EXPLICIT_RELOCS && TARGET_ABI_OSF && reload_completed
7950 && ! samegp_function_operand (operands[1], Pmode)
7951 && ! (peep2_regno_dead_p (1, 29)
7952 || find_reg_note (insn, REG_NORETURN, NULL_RTX))"
7953 [(parallel [(set (match_dup 0)
7954 (call (mem:DI (match_dup 3))
7957 (unspec:DI [(match_dup 6) (match_dup 4)] UNSPEC_LDGP1))
7960 (clobber (reg:DI 26))])
7962 (unspec:DI [(match_dup 6) (match_dup 4)] UNSPEC_LDGP2))]
7964 if (CONSTANT_P (operands[1]))
7966 operands[3] = gen_rtx_REG (Pmode, 27);
7967 operands[5] = GEN_INT (alpha_next_sequence_number++);
7968 emit_insn (gen_movdi_er_high_g (operands[3], pic_offset_table_rtx,
7969 operands[1], operands[5]));
7973 operands[3] = operands[1];
7974 operands[1] = const0_rtx;
7975 operands[5] = const0_rtx;
7977 operands[4] = GEN_INT (alpha_next_sequence_number++);
7978 operands[6] = pic_offset_table_rtx;
7981 (define_insn "*call_value_osf_2_er_nogp"
7982 [(set (match_operand 0 "" "")
7983 (call (mem:DI (match_operand:DI 1 "register_operand" "c"))
7984 (match_operand 2 "" "")))
7986 (use (match_operand 3 "" ""))
7987 (use (match_operand 4 "" ""))
7988 (clobber (reg:DI 26))]
7989 "TARGET_EXPLICIT_RELOCS && TARGET_ABI_OSF"
7990 "jsr $26,(%1),%3%J4"
7991 [(set_attr "type" "jsr")])
7993 (define_insn "*call_value_osf_2_er"
7994 [(set (match_operand 0 "" "")
7995 (call (mem:DI (match_operand:DI 1 "register_operand" "c"))
7996 (match_operand 2 "" "")))
7998 (unspec:DI [(reg:DI 29) (match_operand 5 "const_int_operand" "")]
8000 (use (match_operand 3 "" ""))
8001 (use (match_operand 4 "" ""))
8002 (clobber (reg:DI 26))]
8003 "TARGET_EXPLICIT_RELOCS && TARGET_ABI_OSF"
8004 "jsr $26,(%1),%3%J4\;ldah $29,0($26)\t\t!gpdisp!%5"
8005 [(set_attr "type" "jsr")
8006 (set_attr "cannot_copy" "true")
8007 (set_attr "length" "8")])
8009 (define_insn "*call_value_osf_1_noreturn"
8010 [(set (match_operand 0 "" "")
8011 (call (mem:DI (match_operand:DI 1 "call_operand" "c,R,s"))
8012 (match_operand 2 "" "")))
8014 (clobber (reg:DI 26))]
8015 "! TARGET_EXPLICIT_RELOCS && TARGET_ABI_OSF
8016 && find_reg_note (insn, REG_NORETURN, NULL_RTX)"
8021 [(set_attr "type" "jsr")
8022 (set_attr "length" "*,*,8")])
8024 (define_insn_and_split "call_value_osf_tlsgd"
8025 [(set (match_operand 0 "" "")
8026 (call (mem:DI (match_operand:DI 1 "symbolic_operand" ""))
8028 (unspec [(match_operand:DI 2 "const_int_operand" "")] UNSPEC_TLSGD_CALL)
8030 (clobber (reg:DI 26))]
8033 "&& reload_completed"
8035 (unspec:DI [(match_dup 5)
8037 (match_dup 2)] UNSPEC_LITERAL))
8038 (parallel [(set (match_dup 0)
8039 (call (mem:DI (match_dup 3))
8042 (unspec:DI [(match_dup 5) (match_dup 4)] UNSPEC_LDGP1))
8044 (use (unspec [(match_dup 2)] UNSPEC_TLSGD_CALL))
8045 (clobber (reg:DI 26))])
8047 (unspec:DI [(match_dup 5) (match_dup 4)] UNSPEC_LDGP2))]
8049 operands[3] = gen_rtx_REG (Pmode, 27);
8050 operands[4] = GEN_INT (alpha_next_sequence_number++);
8051 operands[5] = pic_offset_table_rtx;
8053 [(set_attr "type" "multi")])
8055 (define_insn_and_split "call_value_osf_tlsldm"
8056 [(set (match_operand 0 "" "")
8057 (call (mem:DI (match_operand:DI 1 "symbolic_operand" ""))
8059 (unspec [(match_operand:DI 2 "const_int_operand" "")] UNSPEC_TLSLDM_CALL)
8061 (clobber (reg:DI 26))]
8064 "&& reload_completed"
8066 (unspec:DI [(match_dup 5)
8068 (match_dup 2)] UNSPEC_LITERAL))
8069 (parallel [(set (match_dup 0)
8070 (call (mem:DI (match_dup 3))
8073 (unspec:DI [(match_dup 5) (match_dup 4)] UNSPEC_LDGP1))
8075 (use (unspec [(match_dup 2)] UNSPEC_TLSLDM_CALL))
8076 (clobber (reg:DI 26))])
8078 (unspec:DI [(match_dup 5) (match_dup 4)] UNSPEC_LDGP2))]
8080 operands[3] = gen_rtx_REG (Pmode, 27);
8081 operands[4] = GEN_INT (alpha_next_sequence_number++);
8082 operands[5] = pic_offset_table_rtx;
8084 [(set_attr "type" "multi")])
8086 (define_insn "*call_value_osf_1"
8087 [(set (match_operand 0 "" "")
8088 (call (mem:DI (match_operand:DI 1 "call_operand" "c,R,s"))
8089 (match_operand 2 "" "")))
8091 (clobber (reg:DI 26))]
8092 "! TARGET_EXPLICIT_RELOCS && TARGET_ABI_OSF"
8094 jsr $26,($27),0\;ldgp $29,0($26)
8096 jsr $26,%1\;ldgp $29,0($26)"
8097 [(set_attr "type" "jsr")
8098 (set_attr "length" "12,*,16")])
8100 (define_insn "*sibcall_value_osf_1_er"
8101 [(set (match_operand 0 "" "")
8102 (call (mem:DI (match_operand:DI 1 "symbolic_operand" "R,s"))
8103 (match_operand 2 "" "")))
8104 (unspec [(reg:DI 29)] UNSPEC_SIBCALL)]
8105 "TARGET_EXPLICIT_RELOCS && TARGET_ABI_OSF"
8107 br $31,%1\t\t!samegp
8108 ldq $27,%1($29)\t\t!literal!%#\;jmp $31,($27),%1\t\t!lituse_jsr!%#"
8109 [(set_attr "type" "jsr")
8110 (set_attr "length" "*,8")])
8112 (define_insn "*sibcall_value_osf_1"
8113 [(set (match_operand 0 "" "")
8114 (call (mem:DI (match_operand:DI 1 "symbolic_operand" "R,s"))
8115 (match_operand 2 "" "")))
8116 (unspec [(reg:DI 29)] UNSPEC_SIBCALL)]
8117 "! TARGET_EXPLICIT_RELOCS && TARGET_ABI_OSF"
8120 lda $27,%1\;jmp $31,($27),%1"
8121 [(set_attr "type" "jsr")
8122 (set_attr "length" "*,8")])
8124 (define_insn "*call_value_nt_1"
8125 [(set (match_operand 0 "" "")
8126 (call (mem:DI (match_operand:DI 1 "call_operand" "r,R,s"))
8127 (match_operand 2 "" "")))
8128 (clobber (reg:DI 26))]
8129 "TARGET_ABI_WINDOWS_NT"
8134 [(set_attr "type" "jsr")
8135 (set_attr "length" "*,*,12")])
8137 ; GAS relies on the order and position of instructions output below in order
8138 ; to generate relocs for VMS link to potentially optimize the call.
8139 ; Please do not molest.
8140 (define_insn "*call_value_vms_1"
8141 [(set (match_operand 0 "" "")
8142 (call (mem:DI (match_operand:DI 1 "call_operand" "r,s"))
8143 (match_operand 2 "" "")))
8144 (use (match_operand:DI 3 "nonmemory_operand" "r,n"))
8147 (clobber (reg:DI 27))]
8148 "TARGET_ABI_OPEN_VMS"
8150 switch (which_alternative)
8153 return "mov %3,$27\;jsr $26,0\;ldq $27,0($29)";
8155 operands [3] = alpha_use_linkage (operands [1], cfun->decl, 1, 0);
8156 operands [4] = alpha_use_linkage (operands [1], cfun->decl, 0, 0);
8157 return "ldq $26,%4\;ldq $27,%3\;jsr $26,%1\;ldq $27,0($29)";
8162 [(set_attr "type" "jsr")
8163 (set_attr "length" "12,16")])
8165 (define_insn "*call_value_umk"
8166 [(set (match_operand 0 "" "")
8167 (call (mem:DI (match_operand:DI 1 "call_operand" "r"))
8168 (match_operand 2 "" "")))
8170 (clobber (reg:DI 26))]
8171 "TARGET_ABI_UNICOSMK"
8173 [(set_attr "type" "jsr")])