1 ;; Machine description for DEC Alpha for GNU C compiler
2 ;; Copyright (C) 1992-2014 Free Software Foundation, Inc.
3 ;; Contributed by Richard Kenner (kenner@vlsi1.ultra.nyu.edu)
5 ;; This file is part of GCC.
7 ;; GCC is free software; you can redistribute it and/or modify
8 ;; it under the terms of the GNU General Public License as published by
9 ;; the Free Software Foundation; either version 3, or (at your option)
12 ;; GCC is distributed in the hope that it will be useful,
13 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
14 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 ;; GNU General Public License for more details.
17 ;; You should have received a copy of the GNU General Public License
18 ;; along with GCC; see the file COPYING3. If not see
19 ;; <http://www.gnu.org/licenses/>.
21 ;;- See file "rtl.def" for documentation on define_insn, match_*, et. al.
23 ;; Uses of UNSPEC in this file:
25 (define_c_enum "unspec" [
65 (define_c_enum "unspecv" [
68 UNSPECV_SETJMPR ; builtin_setjmp_receiver
69 UNSPECV_LONGJMP ; builtin_longjmp
71 UNSPECV_PSPL ; prologue_stack_probe_loop
73 UNSPECV_EHR ; exception_receiver
77 UNSPECV_PLDGP2 ; prologue ldgp
80 UNSPECV_SETJMPR_ER ; builtin_setjmp_receiver fragment
81 UNSPECV_LL ; load-locked
82 UNSPECV_SC ; store-conditional
86 ;; On non-BWX targets, CQImode must be handled the similarly to HImode
87 ;; when generating reloads.
88 (define_mode_iterator RELOAD12 [QI HI CQI])
89 (define_mode_attr reloadmode [(QI "qi") (HI "hi") (CQI "hi")])
91 ;; Other mode iterators
92 (define_mode_iterator IMODE [QI HI SI DI])
93 (define_mode_iterator I12MODE [QI HI])
94 (define_mode_iterator I124MODE [QI HI SI])
95 (define_mode_iterator I24MODE [HI SI])
96 (define_mode_iterator I248MODE [HI SI DI])
97 (define_mode_iterator I48MODE [SI DI])
99 (define_mode_attr DWI [(SI "DI") (DI "TI")])
100 (define_mode_attr modesuffix [(QI "b") (HI "w") (SI "l") (DI "q")
101 (V8QI "b8") (V4HI "w4")
102 (SF "%,") (DF "%-")])
103 (define_mode_attr vecmodesuffix [(QI "b8") (HI "w4")])
105 (define_code_iterator any_maxmin [smax smin umax umin])
107 (define_code_attr maxmin [(smax "maxs") (smin "mins")
108 (umax "maxu") (umin "minu")])
110 ;; Where necessary, the suffixes _le and _be are used to distinguish between
111 ;; little-endian and big-endian patterns.
113 ;; Note that the Unicos/Mk assembler does not support the following
114 ;; opcodes: mov, fmov, nop, fnop, unop.
116 ;; Processor type -- this attribute must exactly match the processor_type
117 ;; enumeration in alpha.h.
119 (define_attr "tune" "ev4,ev5,ev6"
120 (const (symbol_ref "((enum attr_tune) alpha_tune)")))
122 ;; Define an insn type attribute. This is used in function unit delay
123 ;; computations, among other purposes. For the most part, we use the names
124 ;; defined in the EV4 documentation, but add a few that we have to know about
128 "ild,fld,ldsym,ist,fst,ibr,callpal,fbr,jsr,iadd,ilog,shift,icmov,fcmov,
129 icmp,imul,fadd,fmul,fcpys,fdiv,fsqrt,misc,mvi,ftoi,itof,mb,ld_l,st_c,
131 (const_string "iadd"))
133 ;; Describe a user's asm statement.
134 (define_asm_attributes
135 [(set_attr "type" "multi")])
137 ;; Define the operand size an insn operates on. Used primarily by mul
138 ;; and div operations that have size dependent timings.
140 (define_attr "opsize" "si,di,udi"
143 ;; The TRAP attribute marks instructions that may generate traps
144 ;; (which are imprecise and may need a trapb if software completion
147 (define_attr "trap" "no,yes"
150 ;; The ROUND_SUFFIX attribute marks which instructions require a
151 ;; rounding-mode suffix. The value NONE indicates no suffix,
152 ;; the value NORMAL indicates a suffix controlled by alpha_fprm.
154 (define_attr "round_suffix" "none,normal,c"
155 (const_string "none"))
157 ;; The TRAP_SUFFIX attribute marks instructions requiring a trap-mode suffix:
159 ;; SU accepts only /su (cmpt et al)
160 ;; SUI accepts only /sui (cvtqt and cvtqs)
161 ;; V_SV accepts /v and /sv (cvtql only)
162 ;; V_SV_SVI accepts /v, /sv and /svi (cvttq only)
163 ;; U_SU_SUI accepts /u, /su and /sui (most fp instructions)
165 ;; The actual suffix emitted is controlled by alpha_fptm.
167 (define_attr "trap_suffix" "none,su,sui,v_sv,v_sv_svi,u_su_sui"
168 (const_string "none"))
170 ;; The length of an instruction sequence in bytes.
172 (define_attr "length" ""
175 ;; The USEGP attribute marks instructions that have relocations that use
178 (define_attr "usegp" "no,yes"
179 (cond [(eq_attr "type" "ldsym,jsr")
181 (eq_attr "type" "ild,fld,ist,fst")
182 (symbol_ref "((enum attr_usegp) alpha_find_lo_sum_using_gp (insn))")
184 (const_string "no")))
186 ;; The CANNOT_COPY attribute marks instructions with relocations that
187 ;; cannot easily be duplicated. This includes insns with gpdisp relocs
188 ;; since they have to stay in 1-1 correspondence with one another. This
189 ;; also includes jsr insns, since they must stay in correspondence with
190 ;; the immediately following gpdisp instructions.
192 (define_attr "cannot_copy" "false,true"
193 (const_string "false"))
195 ;; Used to control the "enabled" attribute on a per-instruction basis.
196 ;; For convenience, conflate ABI issues re loading of addresses with
198 (define_attr "isa" "base,bwx,max,fix,cix,vms,ner,er"
199 (const_string "base"))
201 (define_attr "enabled" ""
202 (cond [(eq_attr "isa" "bwx") (symbol_ref "TARGET_BWX")
203 (eq_attr "isa" "max") (symbol_ref "TARGET_MAX")
204 (eq_attr "isa" "fix") (symbol_ref "TARGET_FIX")
205 (eq_attr "isa" "cix") (symbol_ref "TARGET_CIX")
206 (eq_attr "isa" "vms") (symbol_ref "TARGET_ABI_OPEN_VMS")
207 (eq_attr "isa" "ner") (symbol_ref "!TARGET_EXPLICIT_RELOCS")
208 (eq_attr "isa" "er") (symbol_ref "TARGET_EXPLICIT_RELOCS")
212 ;; Include scheduling descriptions.
219 ;; Operand and operator predicates and constraints
221 (include "predicates.md")
222 (include "constraints.md")
225 ;; First define the arithmetic insns. Note that the 32-bit forms also
228 ;; Handle 32-64 bit extension from memory to a floating point register
229 ;; specially, since this occurs frequently in int->double conversions.
231 ;; Note that while we must retain the =f case in the insn for reload's
232 ;; benefit, it should be eliminated after reload, so we should never emit
233 ;; code for that case. But we don't reject the possibility.
235 (define_expand "extendsidi2"
236 [(set (match_operand:DI 0 "register_operand")
237 (sign_extend:DI (match_operand:SI 1 "nonimmediate_operand")))])
239 (define_insn "*cvtlq"
240 [(set (match_operand:DI 0 "register_operand" "=f")
241 (unspec:DI [(match_operand:SF 1 "reg_or_0_operand" "fG")]
245 [(set_attr "type" "fadd")])
247 (define_insn "*extendsidi2_1"
248 [(set (match_operand:DI 0 "register_operand" "=r,r,!*f")
250 (match_operand:SI 1 "nonimmediate_operand" "r,m,m")))]
255 lds %0,%1\;cvtlq %0,%0"
256 [(set_attr "type" "iadd,ild,fld")
257 (set_attr "length" "*,*,8")])
260 [(set (match_operand:DI 0 "hard_fp_register_operand")
261 (sign_extend:DI (match_operand:SI 1 "memory_operand")))]
263 [(set (match_dup 2) (match_dup 1))
264 (set (match_dup 0) (unspec:DI [(match_dup 2)] UNSPEC_CVTLQ))]
266 operands[1] = adjust_address (operands[1], SFmode, 0);
267 operands[2] = gen_rtx_REG (SFmode, REGNO (operands[0]));
270 ;; Optimize sign-extension of SImode loads. This shows up in the wake of
271 ;; reload when converting fp->int.
274 [(set (match_operand:SI 0 "hard_int_register_operand")
275 (match_operand:SI 1 "memory_operand"))
276 (set (match_operand:DI 2 "hard_int_register_operand")
277 (sign_extend:DI (match_dup 0)))]
278 "true_regnum (operands[0]) == true_regnum (operands[2])
279 || peep2_reg_dead_p (2, operands[0])"
281 (sign_extend:DI (match_dup 1)))])
283 (define_insn "addsi3"
284 [(set (match_operand:SI 0 "register_operand" "=r,r,r,r")
285 (plus:SI (match_operand:SI 1 "reg_or_0_operand" "%rJ,rJ,rJ,rJ")
286 (match_operand:SI 2 "add_operand" "rI,O,K,L")))]
295 [(set (match_operand:SI 0 "register_operand")
296 (plus:SI (match_operand:SI 1 "register_operand")
297 (match_operand:SI 2 "const_int_operand")))]
298 "! add_operand (operands[2], SImode)"
299 [(set (match_dup 0) (plus:SI (match_dup 1) (match_dup 3)))
300 (set (match_dup 0) (plus:SI (match_dup 0) (match_dup 4)))]
302 HOST_WIDE_INT val = INTVAL (operands[2]);
303 HOST_WIDE_INT low = (val & 0xffff) - 2 * (val & 0x8000);
304 HOST_WIDE_INT rest = val - low;
306 operands[3] = GEN_INT (rest);
307 operands[4] = GEN_INT (low);
310 (define_insn "*addsi_se"
311 [(set (match_operand:DI 0 "register_operand" "=r,r")
313 (plus:SI (match_operand:SI 1 "reg_or_0_operand" "%rJ,rJ")
314 (match_operand:SI 2 "sext_add_operand" "rI,O"))))]
320 (define_insn "*addsi_se2"
321 [(set (match_operand:DI 0 "register_operand" "=r,r")
323 (subreg:SI (plus:DI (match_operand:DI 1 "reg_or_0_operand" "%rJ,rJ")
324 (match_operand:DI 2 "sext_add_operand" "rI,O"))
332 [(set (match_operand:DI 0 "register_operand")
334 (plus:SI (match_operand:SI 1 "reg_not_elim_operand")
335 (match_operand:SI 2 "const_int_operand"))))
336 (clobber (match_operand:SI 3 "reg_not_elim_operand"))]
337 "! sext_add_operand (operands[2], SImode) && INTVAL (operands[2]) > 0
338 && INTVAL (operands[2]) % 4 == 0"
339 [(set (match_dup 3) (match_dup 4))
340 (set (match_dup 0) (sign_extend:DI (plus:SI (mult:SI (match_dup 3)
344 HOST_WIDE_INT val = INTVAL (operands[2]) / 4;
350 operands[4] = GEN_INT (val);
351 operands[5] = GEN_INT (mult);
355 [(set (match_operand:DI 0 "register_operand")
357 (plus:SI (match_operator:SI 1 "comparison_operator"
360 (match_operand:SI 4 "add_operand"))))
361 (clobber (match_operand:DI 5 "register_operand"))]
363 [(set (match_dup 5) (match_dup 6))
364 (set (match_dup 0) (sign_extend:DI (plus:SI (match_dup 7) (match_dup 4))))]
366 operands[6] = gen_rtx_fmt_ee (GET_CODE (operands[1]), DImode,
367 operands[2], operands[3]);
368 operands[7] = gen_lowpart (SImode, operands[5]);
371 (define_expand "adddi3"
372 [(set (match_operand:DI 0 "register_operand")
373 (plus:DI (match_operand:DI 1 "register_operand")
374 (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 "*sadd<modesuffix>"
520 [(set (match_operand:I48MODE 0 "register_operand" "=r,r")
522 (mult:I48MODE (match_operand:I48MODE 1 "reg_not_elim_operand" "r,r")
523 (match_operand:I48MODE 2 "const48_operand" "I,I"))
524 (match_operand:I48MODE 3 "sext_add_operand" "rI,O")))]
527 s%2add<modesuffix> %1,%3,%0
528 s%2sub<modesuffix> %1,%n3,%0")
530 (define_insn "*saddl_se"
531 [(set (match_operand:DI 0 "register_operand" "=r,r")
533 (plus:SI (mult:SI (match_operand:SI 1 "reg_not_elim_operand" "r,r")
534 (match_operand:SI 2 "const48_operand" "I,I"))
535 (match_operand:SI 3 "sext_add_operand" "rI,O"))))]
542 [(set (match_operand:DI 0 "register_operand")
544 (plus:SI (mult:SI (match_operator:SI 1 "comparison_operator"
547 (match_operand:SI 4 "const48_operand"))
548 (match_operand:SI 5 "sext_add_operand"))))
549 (clobber (match_operand:DI 6 "reg_not_elim_operand"))]
551 [(set (match_dup 6) (match_dup 7))
553 (sign_extend:DI (plus:SI (mult:SI (match_dup 8) (match_dup 4))
556 operands[7] = gen_rtx_fmt_ee (GET_CODE (operands[1]), DImode,
557 operands[2], operands[3]);
558 operands[8] = gen_lowpart (SImode, operands[6]);
561 (define_insn "addv<mode>3"
562 [(set (match_operand:I48MODE 0 "register_operand" "=r,r")
563 (plus:I48MODE (match_operand:I48MODE 1 "reg_or_0_operand" "%rJ,rJ")
564 (match_operand:I48MODE 2 "sext_add_operand" "rI,O")))
565 (trap_if (ne (plus:<DWI> (sign_extend:<DWI> (match_dup 1))
566 (sign_extend:<DWI> (match_dup 2)))
567 (sign_extend:<DWI> (plus:I48MODE (match_dup 1)
572 add<modesuffix>v %r1,%2,%0
573 sub<modesuffix>v %r1,%n2,%0")
575 (define_insn "neg<mode>2"
576 [(set (match_operand:I48MODE 0 "register_operand" "=r")
577 (neg:I48MODE (match_operand:I48MODE 1 "reg_or_8bit_operand" "rI")))]
579 "sub<modesuffix> $31,%1,%0")
581 (define_insn "*negsi_se"
582 [(set (match_operand:DI 0 "register_operand" "=r")
583 (sign_extend:DI (neg:SI
584 (match_operand:SI 1 "reg_or_8bit_operand" "rI"))))]
588 (define_insn "negv<mode>2"
589 [(set (match_operand:I48MODE 0 "register_operand" "=r")
590 (neg:I48MODE (match_operand:I48MODE 1 "register_operand" "r")))
591 (trap_if (ne (neg:<DWI> (sign_extend:<DWI> (match_dup 1)))
592 (sign_extend:<DWI> (neg:I48MODE (match_dup 1))))
595 "sub<modesuffix>v $31,%1,%0")
597 (define_insn "sub<mode>3"
598 [(set (match_operand:I48MODE 0 "register_operand" "=r")
599 (minus:I48MODE (match_operand:I48MODE 1 "reg_or_0_operand" "rJ")
600 (match_operand:I48MODE 2 "reg_or_8bit_operand" "rI")))]
602 "sub<modesuffix> %r1,%2,%0")
604 (define_insn "*subsi_se"
605 [(set (match_operand:DI 0 "register_operand" "=r")
607 (minus:SI (match_operand:SI 1 "reg_or_0_operand" "rJ")
608 (match_operand:SI 2 "reg_or_8bit_operand" "rI"))))]
612 (define_insn "*subsi_se2"
613 [(set (match_operand:DI 0 "register_operand" "=r")
615 (subreg:SI (minus:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
616 (match_operand:DI 2 "reg_or_8bit_operand" "rI"))
621 (define_insn "*ssub<modesuffix>"
622 [(set (match_operand:I48MODE 0 "register_operand" "=r")
624 (mult:I48MODE (match_operand:I48MODE 1 "reg_not_elim_operand" "r")
625 (match_operand:I48MODE 2 "const48_operand" "I"))
626 (match_operand:I48MODE 3 "reg_or_8bit_operand" "rI")))]
628 "s%2sub<modesuffix> %1,%3,%0")
630 (define_insn "*ssubl_se"
631 [(set (match_operand:DI 0 "register_operand" "=r")
633 (minus:SI (mult:SI (match_operand:SI 1 "reg_not_elim_operand" "r")
634 (match_operand:SI 2 "const48_operand" "I"))
635 (match_operand:SI 3 "reg_or_8bit_operand" "rI"))))]
639 (define_insn "subv<mode>3"
640 [(set (match_operand:I48MODE 0 "register_operand" "=r")
641 (minus:I48MODE (match_operand:I48MODE 1 "reg_or_0_operand" "rJ")
642 (match_operand:I48MODE 2 "reg_or_8bit_operand" "rI")))
643 (trap_if (ne (minus:<DWI> (sign_extend:<DWI> (match_dup 1))
644 (sign_extend:<DWI> (match_dup 2)))
645 (sign_extend:<DWI> (minus:I48MODE (match_dup 1)
649 "sub<modesuffix>v %r1,%2,%0")
651 (define_insn "mul<mode>3"
652 [(set (match_operand:I48MODE 0 "register_operand" "=r")
653 (mult:I48MODE (match_operand:I48MODE 1 "reg_or_0_operand" "%rJ")
654 (match_operand:I48MODE 2 "reg_or_8bit_operand" "rI")))]
656 "mul<modesuffix> %r1,%2,%0"
657 [(set_attr "type" "imul")
658 (set_attr "opsize" "<mode>")])
660 (define_insn "*mulsi_se"
661 [(set (match_operand:DI 0 "register_operand" "=r")
663 (mult:SI (match_operand:SI 1 "reg_or_0_operand" "%rJ")
664 (match_operand:SI 2 "reg_or_8bit_operand" "rI"))))]
667 [(set_attr "type" "imul")
668 (set_attr "opsize" "si")])
670 (define_insn "mulv<mode>3"
671 [(set (match_operand:I48MODE 0 "register_operand" "=r")
672 (mult:I48MODE (match_operand:I48MODE 1 "reg_or_0_operand" "%rJ")
673 (match_operand:I48MODE 2 "reg_or_8bit_operand" "rI")))
674 (trap_if (ne (mult:<DWI> (sign_extend:<DWI> (match_dup 1))
675 (sign_extend:<DWI> (match_dup 2)))
676 (sign_extend:<DWI> (mult:I48MODE (match_dup 1)
680 "mul<modesuffix>v %r1,%2,%0"
681 [(set_attr "type" "imul")
682 (set_attr "opsize" "<mode>")])
684 (define_expand "umuldi3_highpart"
685 [(set (match_operand:DI 0 "register_operand")
688 (mult:TI (zero_extend:TI
689 (match_operand:DI 1 "register_operand"))
690 (match_operand:DI 2 "reg_or_8bit_operand"))
694 if (REG_P (operands[2]))
695 operands[2] = gen_rtx_ZERO_EXTEND (TImode, operands[2]);
698 (define_insn "*umuldi3_highpart_reg"
699 [(set (match_operand:DI 0 "register_operand" "=r")
702 (mult:TI (zero_extend:TI
703 (match_operand:DI 1 "register_operand" "r"))
705 (match_operand:DI 2 "register_operand" "r")))
709 [(set_attr "type" "imul")
710 (set_attr "opsize" "udi")])
712 (define_insn "*umuldi3_highpart_const"
713 [(set (match_operand:DI 0 "register_operand" "=r")
716 (mult:TI (zero_extend:TI (match_operand:DI 1 "register_operand" "r"))
717 (match_operand:TI 2 "cint8_operand" "I"))
721 [(set_attr "type" "imul")
722 (set_attr "opsize" "udi")])
724 (define_expand "umulditi3"
725 [(set (match_operand:TI 0 "register_operand")
727 (zero_extend:TI (match_operand:DI 1 "reg_no_subreg_operand"))
728 (zero_extend:TI (match_operand:DI 2 "reg_no_subreg_operand"))))]
731 rtx l = gen_reg_rtx (DImode), h = gen_reg_rtx (DImode);
732 emit_insn (gen_muldi3 (l, operands[1], operands[2]));
733 emit_insn (gen_umuldi3_highpart (h, operands[1], operands[2]));
734 emit_move_insn (gen_lowpart (DImode, operands[0]), l);
735 emit_move_insn (gen_highpart (DImode, operands[0]), h);
739 ;; The divide and remainder operations take their inputs from r24 and
740 ;; r25, put their output in r27, and clobber r23 and r28 on all systems.
742 ;; ??? Force sign-extension here because some versions of OSF/1 and
743 ;; Interix/NT don't do the right thing if the inputs are not properly
744 ;; sign-extended. But Linux, for instance, does not have this
745 ;; problem. Is it worth the complication here to eliminate the sign
748 (define_code_iterator any_divmod [div mod udiv umod])
750 (define_expand "<code>si3"
752 (sign_extend:DI (match_operand:SI 1 "nonimmediate_operand")))
754 (sign_extend:DI (match_operand:SI 2 "nonimmediate_operand")))
755 (parallel [(set (match_dup 5)
757 (any_divmod:SI (match_dup 3) (match_dup 4))))
758 (clobber (reg:DI 23))
759 (clobber (reg:DI 28))])
760 (set (match_operand:SI 0 "nonimmediate_operand")
761 (subreg:SI (match_dup 5) 0))]
764 operands[3] = gen_reg_rtx (DImode);
765 operands[4] = gen_reg_rtx (DImode);
766 operands[5] = gen_reg_rtx (DImode);
769 (define_expand "<code>di3"
770 [(parallel [(set (match_operand:DI 0 "register_operand")
772 (match_operand:DI 1 "register_operand")
773 (match_operand:DI 2 "register_operand")))
774 (clobber (reg:DI 23))
775 (clobber (reg:DI 28))])]
778 ;; Lengths of 8 for ldq $t12,__divq($gp); jsr $t9,($t12),__divq as
779 ;; expanded by the assembler.
781 (define_insn_and_split "*divmodsi_internal_er"
782 [(set (match_operand:DI 0 "register_operand" "=c")
783 (sign_extend:DI (match_operator:SI 3 "divmod_operator"
784 [(match_operand:DI 1 "register_operand" "a")
785 (match_operand:DI 2 "register_operand" "b")])))
786 (clobber (reg:DI 23))
787 (clobber (reg:DI 28))]
788 "TARGET_EXPLICIT_RELOCS && TARGET_ABI_OSF"
790 "&& reload_completed"
791 [(parallel [(set (match_dup 0)
792 (sign_extend:DI (match_dup 3)))
795 (clobber (reg:DI 23))
796 (clobber (reg:DI 28))])]
799 switch (GET_CODE (operands[3]))
816 operands[4] = GEN_INT (alpha_next_sequence_number++);
817 emit_insn (gen_movdi_er_high_g (operands[0], pic_offset_table_rtx,
818 gen_rtx_SYMBOL_REF (DImode, str),
821 [(set_attr "type" "jsr")
822 (set_attr "length" "8")])
824 (define_insn "*divmodsi_internal_er_1"
825 [(set (match_operand:DI 0 "register_operand" "=c")
826 (sign_extend:DI (match_operator:SI 3 "divmod_operator"
827 [(match_operand:DI 1 "register_operand" "a")
828 (match_operand:DI 2 "register_operand" "b")])))
829 (use (match_operand:DI 4 "register_operand" "c"))
830 (use (match_operand 5 "const_int_operand"))
831 (clobber (reg:DI 23))
832 (clobber (reg:DI 28))]
833 "TARGET_EXPLICIT_RELOCS && TARGET_ABI_OSF"
834 "jsr $23,($27),__%E3%j5"
835 [(set_attr "type" "jsr")
836 (set_attr "length" "4")])
838 (define_insn "*divmodsi_internal"
839 [(set (match_operand:DI 0 "register_operand" "=c")
840 (sign_extend:DI (match_operator:SI 3 "divmod_operator"
841 [(match_operand:DI 1 "register_operand" "a")
842 (match_operand:DI 2 "register_operand" "b")])))
843 (clobber (reg:DI 23))
844 (clobber (reg:DI 28))]
847 [(set_attr "type" "jsr")
848 (set_attr "length" "8")])
850 (define_insn_and_split "*divmoddi_internal_er"
851 [(set (match_operand:DI 0 "register_operand" "=c")
852 (match_operator:DI 3 "divmod_operator"
853 [(match_operand:DI 1 "register_operand" "a")
854 (match_operand:DI 2 "register_operand" "b")]))
855 (clobber (reg:DI 23))
856 (clobber (reg:DI 28))]
857 "TARGET_EXPLICIT_RELOCS && TARGET_ABI_OSF"
859 "&& reload_completed"
860 [(parallel [(set (match_dup 0) (match_dup 3))
863 (clobber (reg:DI 23))
864 (clobber (reg:DI 28))])]
867 switch (GET_CODE (operands[3]))
884 operands[4] = GEN_INT (alpha_next_sequence_number++);
885 emit_insn (gen_movdi_er_high_g (operands[0], pic_offset_table_rtx,
886 gen_rtx_SYMBOL_REF (DImode, str),
889 [(set_attr "type" "jsr")
890 (set_attr "length" "8")])
892 (define_insn "*divmoddi_internal_er_1"
893 [(set (match_operand:DI 0 "register_operand" "=c")
894 (match_operator:DI 3 "divmod_operator"
895 [(match_operand:DI 1 "register_operand" "a")
896 (match_operand:DI 2 "register_operand" "b")]))
897 (use (match_operand:DI 4 "register_operand" "c"))
898 (use (match_operand 5 "const_int_operand"))
899 (clobber (reg:DI 23))
900 (clobber (reg:DI 28))]
901 "TARGET_EXPLICIT_RELOCS && TARGET_ABI_OSF"
902 "jsr $23,($27),__%E3%j5"
903 [(set_attr "type" "jsr")
904 (set_attr "length" "4")])
906 (define_insn "*divmoddi_internal"
907 [(set (match_operand:DI 0 "register_operand" "=c")
908 (match_operator:DI 3 "divmod_operator"
909 [(match_operand:DI 1 "register_operand" "a")
910 (match_operand:DI 2 "register_operand" "b")]))
911 (clobber (reg:DI 23))
912 (clobber (reg:DI 28))]
915 [(set_attr "type" "jsr")
916 (set_attr "length" "8")])
918 ;; Next are the basic logical operations. We only expose the DImode operations
919 ;; to the rtl expanders, but SImode versions exist for combine as well as for
920 ;; the atomic operation splitters.
922 (define_insn "*andsi_internal"
923 [(set (match_operand:SI 0 "register_operand" "=r,r,r")
924 (and:SI (match_operand:SI 1 "reg_or_0_operand" "%rJ,rJ,rJ")
925 (match_operand:SI 2 "and_operand" "rI,N,MH")))]
931 [(set_attr "type" "ilog,ilog,shift")])
933 (define_insn "anddi3"
934 [(set (match_operand:DI 0 "register_operand" "=r,r,r")
935 (and:DI (match_operand:DI 1 "reg_or_0_operand" "%rJ,rJ,rJ")
936 (match_operand:DI 2 "and_operand" "rI,N,MH")))]
942 [(set_attr "type" "ilog,ilog,shift")])
944 ;; There are times when we can split an AND into two AND insns. This occurs
945 ;; when we can first clear any bytes and then clear anything else. For
946 ;; example "I & 0xffff07" is "(I & 0xffffff) & 0xffffffffffffff07".
947 ;; Only do this when running on 64-bit host since the computations are
948 ;; too messy otherwise.
951 [(set (match_operand:DI 0 "register_operand")
952 (and:DI (match_operand:DI 1 "register_operand")
953 (match_operand:DI 2 "const_int_operand")))]
954 "HOST_BITS_PER_WIDE_INT == 64 && ! and_operand (operands[2], DImode)"
955 [(set (match_dup 0) (and:DI (match_dup 1) (match_dup 3)))
956 (set (match_dup 0) (and:DI (match_dup 0) (match_dup 4)))]
958 unsigned HOST_WIDE_INT mask1 = INTVAL (operands[2]);
959 unsigned HOST_WIDE_INT mask2 = mask1;
962 /* For each byte that isn't all zeros, make it all ones. */
963 for (i = 0; i < 64; i += 8)
964 if ((mask1 & ((HOST_WIDE_INT) 0xff << i)) != 0)
965 mask1 |= (HOST_WIDE_INT) 0xff << i;
967 /* Now turn on any bits we've just turned off. */
970 operands[3] = GEN_INT (mask1);
971 operands[4] = GEN_INT (mask2);
974 (define_insn "zero_extendqi<mode>2"
975 [(set (match_operand:I248MODE 0 "register_operand" "=r,r")
976 (zero_extend:I248MODE
977 (match_operand:QI 1 "reg_or_bwx_memory_operand" "r,m")))]
982 [(set_attr "type" "ilog,ild")
983 (set_attr "isa" "*,bwx")])
985 (define_insn "zero_extendhi<mode>2"
986 [(set (match_operand:I48MODE 0 "register_operand" "=r,r")
988 (match_operand:HI 1 "reg_or_bwx_memory_operand" "r,m")))]
993 [(set_attr "type" "shift,ild")
994 (set_attr "isa" "*,bwx")])
996 (define_insn "zero_extendsidi2"
997 [(set (match_operand:DI 0 "register_operand" "=r")
998 (zero_extend:DI (match_operand:SI 1 "register_operand" "r")))]
1001 [(set_attr "type" "shift")])
1003 (define_insn "andnot<mode>3"
1004 [(set (match_operand:I48MODE 0 "register_operand" "=r")
1006 (not:I48MODE (match_operand:I48MODE 1 "reg_or_8bit_operand" "rI"))
1007 (match_operand:I48MODE 2 "reg_or_0_operand" "rJ")))]
1010 [(set_attr "type" "ilog")])
1012 (define_insn "*iorsi_internal"
1013 [(set (match_operand:SI 0 "register_operand" "=r,r")
1014 (ior:SI (match_operand:SI 1 "reg_or_0_operand" "%rJ,rJ")
1015 (match_operand:SI 2 "or_operand" "rI,N")))]
1020 [(set_attr "type" "ilog")])
1022 (define_insn "iordi3"
1023 [(set (match_operand:DI 0 "register_operand" "=r,r")
1024 (ior:DI (match_operand:DI 1 "reg_or_0_operand" "%rJ,rJ")
1025 (match_operand:DI 2 "or_operand" "rI,N")))]
1030 [(set_attr "type" "ilog")])
1032 (define_insn "*one_cmplsi_internal"
1033 [(set (match_operand:SI 0 "register_operand" "=r")
1034 (not:SI (match_operand:SI 1 "reg_or_8bit_operand" "rI")))]
1037 [(set_attr "type" "ilog")])
1039 (define_insn "one_cmpldi2"
1040 [(set (match_operand:DI 0 "register_operand" "=r")
1041 (not:DI (match_operand:DI 1 "reg_or_8bit_operand" "rI")))]
1044 [(set_attr "type" "ilog")])
1046 (define_insn "*iornot<mode>3"
1047 [(set (match_operand:I48MODE 0 "register_operand" "=r")
1049 (not:I48MODE (match_operand:I48MODE 1 "reg_or_8bit_operand" "rI"))
1050 (match_operand:I48MODE 2 "reg_or_0_operand" "rJ")))]
1053 [(set_attr "type" "ilog")])
1055 (define_insn "*xorsi_internal"
1056 [(set (match_operand:SI 0 "register_operand" "=r,r")
1057 (xor:SI (match_operand:SI 1 "reg_or_0_operand" "%rJ,rJ")
1058 (match_operand:SI 2 "or_operand" "rI,N")))]
1063 [(set_attr "type" "ilog")])
1065 (define_insn "xordi3"
1066 [(set (match_operand:DI 0 "register_operand" "=r,r")
1067 (xor:DI (match_operand:DI 1 "reg_or_0_operand" "%rJ,rJ")
1068 (match_operand:DI 2 "or_operand" "rI,N")))]
1073 [(set_attr "type" "ilog")])
1075 (define_insn "*xornot<mode>3"
1076 [(set (match_operand:I48MODE 0 "register_operand" "=r")
1077 (not:I48MODE (xor:I48MODE
1078 (match_operand:I48MODE 1 "register_operand" "%rJ")
1079 (match_operand:I48MODE 2 "register_operand" "rI"))))]
1082 [(set_attr "type" "ilog")])
1084 ;; Handle FFS and related insns iff we support CIX.
1086 (define_expand "ffsdi2"
1088 (ctz:DI (match_operand:DI 1 "register_operand")))
1090 (plus:DI (match_dup 2) (const_int 1)))
1091 (set (match_operand:DI 0 "register_operand")
1092 (if_then_else:DI (eq (match_dup 1) (const_int 0))
1093 (const_int 0) (match_dup 3)))]
1096 operands[2] = gen_reg_rtx (DImode);
1097 operands[3] = gen_reg_rtx (DImode);
1100 (define_insn "clzdi2"
1101 [(set (match_operand:DI 0 "register_operand" "=r")
1102 (clz:DI (match_operand:DI 1 "register_operand" "r")))]
1105 [(set_attr "type" "mvi")])
1107 (define_insn "ctzdi2"
1108 [(set (match_operand:DI 0 "register_operand" "=r")
1109 (ctz:DI (match_operand:DI 1 "register_operand" "r")))]
1112 [(set_attr "type" "mvi")])
1114 (define_insn "popcountdi2"
1115 [(set (match_operand:DI 0 "register_operand" "=r")
1116 (popcount:DI (match_operand:DI 1 "register_operand" "r")))]
1119 [(set_attr "type" "mvi")])
1121 (define_expand "bswapsi2"
1122 [(set (match_operand:SI 0 "register_operand")
1123 (bswap:SI (match_operand:SI 1 "register_operand")))]
1128 t0 = gen_reg_rtx (DImode);
1129 t1 = gen_reg_rtx (DImode);
1131 emit_insn (gen_inslh (t0, gen_lowpart (DImode, operands[1]), GEN_INT (7)));
1132 emit_insn (gen_inswl_const (t1, gen_lowpart (HImode, operands[1]),
1134 emit_insn (gen_iordi3 (t1, t0, t1));
1135 emit_insn (gen_lshrdi3 (t0, t1, GEN_INT (16)));
1136 emit_insn (gen_anddi3 (t1, t1, alpha_expand_zap_mask (0x5)));
1137 emit_insn (gen_anddi3 (t0, t0, alpha_expand_zap_mask (0xa)));
1138 emit_insn (gen_addsi3 (operands[0], gen_lowpart (SImode, t0),
1139 gen_lowpart (SImode, t1)));
1143 (define_expand "bswapdi2"
1144 [(set (match_operand:DI 0 "register_operand")
1145 (bswap:DI (match_operand:DI 1 "register_operand")))]
1150 t0 = gen_reg_rtx (DImode);
1151 t1 = gen_reg_rtx (DImode);
1153 /* This method of shifting and masking is not specific to Alpha, but
1154 is only profitable on Alpha because of our handy byte zap insn. */
1156 emit_insn (gen_lshrdi3 (t0, operands[1], GEN_INT (32)));
1157 emit_insn (gen_ashldi3 (t1, operands[1], GEN_INT (32)));
1158 emit_insn (gen_iordi3 (t1, t0, t1));
1160 emit_insn (gen_lshrdi3 (t0, t1, GEN_INT (16)));
1161 emit_insn (gen_ashldi3 (t1, t1, GEN_INT (16)));
1162 emit_insn (gen_anddi3 (t0, t0, alpha_expand_zap_mask (0xcc)));
1163 emit_insn (gen_anddi3 (t1, t1, alpha_expand_zap_mask (0x33)));
1164 emit_insn (gen_iordi3 (t1, t0, t1));
1166 emit_insn (gen_lshrdi3 (t0, t1, GEN_INT (8)));
1167 emit_insn (gen_ashldi3 (t1, t1, GEN_INT (8)));
1168 emit_insn (gen_anddi3 (t0, t0, alpha_expand_zap_mask (0xaa)));
1169 emit_insn (gen_anddi3 (t1, t1, alpha_expand_zap_mask (0x55)));
1170 emit_insn (gen_iordi3 (operands[0], t0, t1));
1174 ;; Next come the shifts and the various extract and insert operations.
1176 (define_insn "ashldi3"
1177 [(set (match_operand:DI 0 "register_operand" "=r,r")
1178 (ashift:DI (match_operand:DI 1 "reg_or_0_operand" "rJ,rJ")
1179 (match_operand:DI 2 "reg_or_6bit_operand" "P,rS")))]
1182 switch (which_alternative)
1185 if (operands[2] == const1_rtx)
1186 return "addq %r1,%r1,%0";
1188 return "s%P2addq %r1,0,%0";
1190 return "sll %r1,%2,%0";
1195 [(set_attr "type" "iadd,shift")])
1197 (define_insn "*ashldi_se"
1198 [(set (match_operand:DI 0 "register_operand" "=r")
1200 (subreg:SI (ashift:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
1201 (match_operand:DI 2 "const_int_operand" "P"))
1203 "INTVAL (operands[2]) >= 1 && INTVAL (operands[2]) <= 3"
1205 if (operands[2] == const1_rtx)
1206 return "addl %r1,%r1,%0";
1208 return "s%P2addl %r1,0,%0";
1210 [(set_attr "type" "iadd")])
1212 (define_insn "lshrdi3"
1213 [(set (match_operand:DI 0 "register_operand" "=r")
1214 (lshiftrt:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
1215 (match_operand:DI 2 "reg_or_6bit_operand" "rS")))]
1218 [(set_attr "type" "shift")])
1220 (define_insn "ashrdi3"
1221 [(set (match_operand:DI 0 "register_operand" "=r")
1222 (ashiftrt:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
1223 (match_operand:DI 2 "reg_or_6bit_operand" "rS")))]
1226 [(set_attr "type" "shift")])
1228 (define_insn "extendqi<mode>2"
1229 [(set (match_operand:I24MODE 0 "register_operand" "=r")
1230 (sign_extend:I24MODE
1231 (match_operand:QI 1 "register_operand" "r")))]
1234 [(set_attr "type" "shift")])
1236 (define_expand "extendqidi2"
1237 [(set (match_operand:DI 0 "register_operand")
1238 (sign_extend:DI (match_operand:QI 1 "some_operand")))]
1242 operands[1] = force_reg (QImode, operands[1]);
1247 if (unaligned_memory_operand (operands[1], QImode))
1249 x = gen_unaligned_extendqidi (operands[0], XEXP (operands[1], 0));
1250 alpha_set_memflags (x, operands[1]);
1255 t1 = gen_reg_rtx (DImode);
1256 t2 = gen_reg_rtx (DImode);
1259 x = gen_lowpart (DImode, force_reg (QImode, operands[1]));
1260 emit_move_insn (t1, x);
1261 emit_insn (gen_ashldi3 (t2, t1, i56));
1262 emit_insn (gen_ashrdi3 (operands[0], t2, i56));
1267 (define_insn "*extendqidi2_bwx"
1268 [(set (match_operand:DI 0 "register_operand" "=r")
1269 (sign_extend:DI (match_operand:QI 1 "register_operand" "r")))]
1272 [(set_attr "type" "shift")])
1274 (define_insn "extendhisi2"
1275 [(set (match_operand:SI 0 "register_operand" "=r")
1276 (sign_extend:SI (match_operand:HI 1 "register_operand" "r")))]
1279 [(set_attr "type" "shift")])
1281 (define_expand "extendhidi2"
1282 [(set (match_operand:DI 0 "register_operand")
1283 (sign_extend:DI (match_operand:HI 1 "some_operand")))]
1287 operands[1] = force_reg (HImode, operands[1]);
1292 if (unaligned_memory_operand (operands[1], HImode))
1294 x = gen_unaligned_extendhidi (operands[0], XEXP (operands[1], 0));
1295 alpha_set_memflags (x, operands[1]);
1300 t1 = gen_reg_rtx (DImode);
1301 t2 = gen_reg_rtx (DImode);
1304 x = gen_lowpart (DImode, force_reg (HImode, operands[1]));
1305 emit_move_insn (t1, x);
1306 emit_insn (gen_ashldi3 (t2, t1, i48));
1307 emit_insn (gen_ashrdi3 (operands[0], t2, i48));
1312 (define_insn "*extendhidi2_bwx"
1313 [(set (match_operand:DI 0 "register_operand" "=r")
1314 (sign_extend:DI (match_operand:HI 1 "register_operand" "r")))]
1317 [(set_attr "type" "shift")])
1319 ;; Here's how we sign extend an unaligned byte and halfword. Doing this
1320 ;; as a pattern saves one instruction. The code is similar to that for
1321 ;; the unaligned loads (see below).
1323 ;; Operand 1 is the address, operand 0 is the result.
1325 (define_expand "unaligned_extendqidi"
1327 (mem:DI (and:DI (match_operand:DI 1 "address_operand") (const_int -8))))
1329 (ashift:DI (match_dup 3)
1330 (minus:DI (const_int 64)
1332 (and:DI (match_dup 2) (const_int 7))
1334 (set (match_operand:QI 0 "register_operand")
1335 (ashiftrt:DI (match_dup 4) (const_int 56)))]
1338 operands[0] = gen_lowpart (DImode, operands[0]);
1339 operands[2] = get_unaligned_offset (operands[1], 1);
1340 operands[3] = gen_reg_rtx (DImode);
1341 operands[4] = gen_reg_rtx (DImode);
1344 (define_expand "unaligned_extendhidi"
1346 (mem:DI (and:DI (match_operand:DI 1 "address_operand") (const_int -8))))
1348 (ashift:DI (match_dup 3)
1349 (minus:DI (const_int 64)
1351 (and:DI (match_dup 2) (const_int 7))
1353 (set (match_operand:HI 0 "register_operand")
1354 (ashiftrt:DI (match_dup 4) (const_int 48)))]
1357 operands[0] = gen_lowpart (DImode, operands[0]);
1358 operands[2] = get_unaligned_offset (operands[1], 2);
1359 operands[3] = gen_reg_rtx (DImode);
1360 operands[4] = gen_reg_rtx (DImode);
1363 (define_insn "*extxl_const"
1364 [(set (match_operand:DI 0 "register_operand" "=r")
1365 (zero_extract:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
1366 (match_operand:DI 2 "mode_width_operand" "n")
1367 (match_operand:DI 3 "mul8_operand" "I")))]
1369 "ext%M2l %r1,%s3,%0"
1370 [(set_attr "type" "shift")])
1372 (define_insn "extxl"
1373 [(set (match_operand:DI 0 "register_operand" "=r")
1375 (match_operand:DI 1 "reg_or_0_operand" "rJ")
1376 (match_operand:DI 2 "mode_width_operand" "n")
1377 (ashift:DI (match_operand:DI 3 "reg_or_8bit_operand" "rI")
1381 [(set_attr "type" "shift")])
1383 ;; Combine has some strange notion of preserving existing undefined behavior
1384 ;; in shifts larger than a word size. So capture these patterns that it
1385 ;; should have turned into zero_extracts.
1387 (define_insn "*extxl_1"
1388 [(set (match_operand:DI 0 "register_operand" "=r")
1389 (and:DI (lshiftrt:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
1390 (ashift:DI (match_operand:DI 2 "reg_or_8bit_operand" "rI")
1392 (match_operand:DI 3 "mode_mask_operand" "n")))]
1395 [(set_attr "type" "shift")])
1397 (define_insn "*extql_2"
1398 [(set (match_operand:DI 0 "register_operand" "=r")
1399 (lshiftrt:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
1400 (ashift:DI (match_operand:DI 2 "reg_or_8bit_operand" "rI")
1404 [(set_attr "type" "shift")])
1406 (define_insn "extqh"
1407 [(set (match_operand:DI 0 "register_operand" "=r")
1409 (match_operand:DI 1 "reg_or_0_operand" "rJ")
1410 (minus:DI (const_int 64)
1413 (match_operand:DI 2 "reg_or_8bit_operand" "rI")
1418 [(set_attr "type" "shift")])
1420 (define_insn "extwh"
1421 [(set (match_operand:DI 0 "register_operand" "=r")
1423 (and:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
1425 (minus:DI (const_int 64)
1428 (match_operand:DI 2 "reg_or_8bit_operand" "rI")
1433 [(set_attr "type" "shift")])
1435 (define_insn "extlh"
1436 [(set (match_operand:DI 0 "register_operand" "=r")
1438 (and:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
1439 (const_int 2147483647))
1440 (minus:DI (const_int 64)
1443 (match_operand:DI 2 "reg_or_8bit_operand" "rI")
1448 [(set_attr "type" "shift")])
1450 ;; This converts an extXl into an extXh with an appropriate adjustment
1451 ;; to the address calculation.
1454 ;; [(set (match_operand:DI 0 "register_operand")
1455 ;; (ashift:DI (zero_extract:DI (match_operand:DI 1 "register_operand")
1456 ;; (match_operand:DI 2 "mode_width_operand")
1457 ;; (ashift:DI (match_operand:DI 3)
1459 ;; (match_operand:DI 4 "const_int_operand")))
1460 ;; (clobber (match_operand:DI 5 "register_operand"))]
1461 ;; "INTVAL (operands[4]) == 64 - INTVAL (operands[2])"
1462 ;; [(set (match_dup 5) (match_dup 6))
1463 ;; (set (match_dup 0)
1464 ;; (ashift:DI (zero_extract:DI (match_dup 1) (match_dup 2)
1465 ;; (ashift:DI (plus:DI (match_dup 5)
1471 ;; operands[6] = plus_constant (DImode, operands[3],
1472 ;; INTVAL (operands[2]) / BITS_PER_UNIT);
1473 ;; operands[7] = GEN_INT (- INTVAL (operands[2]) / BITS_PER_UNIT);
1476 (define_insn "ins<modesuffix>l_const"
1477 [(set (match_operand:DI 0 "register_operand" "=r")
1478 (ashift:DI (zero_extend:DI
1479 (match_operand:I124MODE 1 "register_operand" "r"))
1480 (match_operand:DI 2 "mul8_operand" "I")))]
1482 "ins<modesuffix>l %1,%s2,%0"
1483 [(set_attr "type" "shift")])
1485 (define_insn "ins<modesuffix>l"
1486 [(set (match_operand:DI 0 "register_operand" "=r")
1487 (ashift:DI (zero_extend:DI
1488 (match_operand:I124MODE 1 "register_operand" "r"))
1489 (ashift:DI (match_operand:DI 2 "reg_or_8bit_operand" "rI")
1492 "ins<modesuffix>l %1,%2,%0"
1493 [(set_attr "type" "shift")])
1495 (define_insn "insql"
1496 [(set (match_operand:DI 0 "register_operand" "=r")
1497 (ashift:DI (match_operand:DI 1 "register_operand" "r")
1498 (ashift:DI (match_operand:DI 2 "reg_or_8bit_operand" "rI")
1502 [(set_attr "type" "shift")])
1504 ;; Combine has this sometimes habit of moving the and outside of the
1505 ;; shift, making life more interesting.
1507 (define_insn "*insxl"
1508 [(set (match_operand:DI 0 "register_operand" "=r")
1509 (and:DI (ashift:DI (match_operand:DI 1 "register_operand" "r")
1510 (match_operand:DI 2 "mul8_operand" "I"))
1511 (match_operand:DI 3 "immediate_operand" "i")))]
1512 "HOST_BITS_PER_WIDE_INT == 64
1513 && CONST_INT_P (operands[3])
1514 && (((unsigned HOST_WIDE_INT) 0xff << INTVAL (operands[2])
1515 == (unsigned HOST_WIDE_INT) INTVAL (operands[3]))
1516 || ((unsigned HOST_WIDE_INT) 0xffff << INTVAL (operands[2])
1517 == (unsigned HOST_WIDE_INT) INTVAL (operands[3]))
1518 || ((unsigned HOST_WIDE_INT) 0xffffffff << INTVAL (operands[2])
1519 == (unsigned HOST_WIDE_INT) INTVAL (operands[3])))"
1521 #if HOST_BITS_PER_WIDE_INT == 64
1522 if ((unsigned HOST_WIDE_INT) 0xff << INTVAL (operands[2])
1523 == (unsigned HOST_WIDE_INT) INTVAL (operands[3]))
1524 return "insbl %1,%s2,%0";
1525 if ((unsigned HOST_WIDE_INT) 0xffff << INTVAL (operands[2])
1526 == (unsigned HOST_WIDE_INT) INTVAL (operands[3]))
1527 return "inswl %1,%s2,%0";
1528 if ((unsigned HOST_WIDE_INT) 0xffffffff << INTVAL (operands[2])
1529 == (unsigned HOST_WIDE_INT) INTVAL (operands[3]))
1530 return "insll %1,%s2,%0";
1534 [(set_attr "type" "shift")])
1536 ;; We do not include the insXh insns because they are complex to express
1537 ;; and it does not appear that we would ever want to generate them.
1539 ;; Since we need them for block moves, though, cop out and use unspec.
1541 (define_insn "insxh"
1542 [(set (match_operand:DI 0 "register_operand" "=r")
1543 (unspec:DI [(match_operand:DI 1 "register_operand" "r")
1544 (match_operand:DI 2 "mode_width_operand" "n")
1545 (match_operand:DI 3 "reg_or_8bit_operand" "rI")]
1549 [(set_attr "type" "shift")])
1551 (define_insn "mskxl"
1552 [(set (match_operand:DI 0 "register_operand" "=r")
1553 (and:DI (not:DI (ashift:DI
1554 (match_operand:DI 2 "mode_mask_operand" "n")
1556 (match_operand:DI 3 "reg_or_8bit_operand" "rI")
1558 (match_operand:DI 1 "reg_or_0_operand" "rJ")))]
1561 [(set_attr "type" "shift")])
1563 ;; We do not include the mskXh insns because it does not appear we would
1564 ;; ever generate one.
1566 ;; Again, we do for block moves and we use unspec again.
1568 (define_insn "mskxh"
1569 [(set (match_operand:DI 0 "register_operand" "=r")
1570 (unspec:DI [(match_operand:DI 1 "register_operand" "r")
1571 (match_operand:DI 2 "mode_width_operand" "n")
1572 (match_operand:DI 3 "reg_or_8bit_operand" "rI")]
1576 [(set_attr "type" "shift")])
1578 ;; Prefer AND + NE over LSHIFTRT + AND.
1580 (define_insn_and_split "*ze_and_ne"
1581 [(set (match_operand:DI 0 "register_operand" "=r")
1582 (zero_extract:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
1584 (match_operand 2 "const_int_operand" "I")))]
1585 "(unsigned HOST_WIDE_INT) INTVAL (operands[2]) < 8"
1587 "(unsigned HOST_WIDE_INT) INTVAL (operands[2]) < 8"
1589 (and:DI (match_dup 1) (match_dup 3)))
1591 (ne:DI (match_dup 0) (const_int 0)))]
1592 "operands[3] = GEN_INT (1 << INTVAL (operands[2]));")
1594 ;; Floating-point operations. All the double-precision insns can extend
1595 ;; from single, so indicate that. The exception are the ones that simply
1596 ;; play with the sign bits; it's not clear what to do there.
1598 (define_mode_iterator FMODE [SF DF])
1600 (define_mode_attr opmode [(SF "si") (DF "di")])
1602 (define_insn "abs<mode>2"
1603 [(set (match_operand:FMODE 0 "register_operand" "=f")
1604 (abs:FMODE (match_operand:FMODE 1 "reg_or_0_operand" "fG")))]
1607 [(set_attr "type" "fcpys")])
1609 (define_insn "*nabs<mode>2"
1610 [(set (match_operand:FMODE 0 "register_operand" "=f")
1612 (abs:FMODE (match_operand:FMODE 1 "reg_or_0_operand" "fG"))))]
1615 [(set_attr "type" "fadd")])
1617 (define_expand "abstf2"
1618 [(parallel [(set (match_operand:TF 0 "register_operand")
1619 (abs:TF (match_operand:TF 1 "reg_or_0_operand")))
1620 (use (match_dup 2))])]
1621 "TARGET_HAS_XFLOATING_LIBS"
1623 #if HOST_BITS_PER_WIDE_INT >= 64
1624 operands[2] = force_reg (DImode, GEN_INT ((HOST_WIDE_INT) 1 << 63));
1626 operands[2] = force_reg (DImode, immed_double_const (0, 0x80000000, DImode));
1630 (define_insn_and_split "*abstf_internal"
1631 [(set (match_operand:TF 0 "register_operand" "=r")
1632 (abs:TF (match_operand:TF 1 "reg_or_0_operand" "rG")))
1633 (use (match_operand:DI 2 "register_operand" "r"))]
1634 "TARGET_HAS_XFLOATING_LIBS"
1636 "&& reload_completed"
1638 "alpha_split_tfmode_frobsign (operands, gen_andnotdi3); DONE;")
1640 (define_insn "neg<mode>2"
1641 [(set (match_operand:FMODE 0 "register_operand" "=f")
1642 (neg:FMODE (match_operand:FMODE 1 "reg_or_0_operand" "fG")))]
1645 [(set_attr "type" "fadd")])
1647 (define_expand "negtf2"
1648 [(parallel [(set (match_operand:TF 0 "register_operand")
1649 (neg:TF (match_operand:TF 1 "reg_or_0_operand")))
1650 (use (match_dup 2))])]
1651 "TARGET_HAS_XFLOATING_LIBS"
1653 #if HOST_BITS_PER_WIDE_INT >= 64
1654 operands[2] = force_reg (DImode, GEN_INT ((HOST_WIDE_INT) 1 << 63));
1656 operands[2] = force_reg (DImode, immed_double_const (0, 0x80000000, DImode));
1660 (define_insn_and_split "*negtf_internal"
1661 [(set (match_operand:TF 0 "register_operand" "=r")
1662 (neg:TF (match_operand:TF 1 "reg_or_0_operand" "rG")))
1663 (use (match_operand:DI 2 "register_operand" "r"))]
1664 "TARGET_HAS_XFLOATING_LIBS"
1666 "&& reload_completed"
1668 "alpha_split_tfmode_frobsign (operands, gen_xordi3); DONE;")
1670 (define_insn "copysign<mode>3"
1671 [(set (match_operand:FMODE 0 "register_operand" "=f")
1672 (unspec:FMODE [(match_operand:FMODE 1 "reg_or_0_operand" "fG")
1673 (match_operand:FMODE 2 "reg_or_0_operand" "fG")]
1677 [(set_attr "type" "fadd")])
1679 (define_insn "*ncopysign<mode>3"
1680 [(set (match_operand:FMODE 0 "register_operand" "=f")
1682 (unspec:FMODE [(match_operand:FMODE 1 "reg_or_0_operand" "fG")
1683 (match_operand:FMODE 2 "reg_or_0_operand" "fG")]
1687 [(set_attr "type" "fadd")])
1689 (define_insn "*add<mode>3_ieee"
1690 [(set (match_operand:FMODE 0 "register_operand" "=&f")
1691 (plus:FMODE (match_operand:FMODE 1 "reg_or_0_operand" "%fG")
1692 (match_operand:FMODE 2 "reg_or_0_operand" "fG")))]
1693 "TARGET_FP && alpha_fptm >= ALPHA_FPTM_SU"
1694 "add<modesuffix>%/ %R1,%R2,%0"
1695 [(set_attr "type" "fadd")
1696 (set_attr "trap" "yes")
1697 (set_attr "round_suffix" "normal")
1698 (set_attr "trap_suffix" "u_su_sui")])
1700 (define_insn "add<mode>3"
1701 [(set (match_operand:FMODE 0 "register_operand" "=f")
1702 (plus:FMODE (match_operand:FMODE 1 "reg_or_0_operand" "%fG")
1703 (match_operand:FMODE 2 "reg_or_0_operand" "fG")))]
1705 "add<modesuffix>%/ %R1,%R2,%0"
1706 [(set_attr "type" "fadd")
1707 (set_attr "trap" "yes")
1708 (set_attr "round_suffix" "normal")
1709 (set_attr "trap_suffix" "u_su_sui")])
1711 (define_insn "*adddf_ext1"
1712 [(set (match_operand:DF 0 "register_operand" "=f")
1713 (plus:DF (float_extend:DF
1714 (match_operand:SF 1 "reg_or_0_operand" "fG"))
1715 (match_operand:DF 2 "reg_or_0_operand" "fG")))]
1716 "TARGET_FP && alpha_fptm < ALPHA_FPTM_SU"
1717 "add%-%/ %R1,%R2,%0"
1718 [(set_attr "type" "fadd")
1719 (set_attr "trap" "yes")
1720 (set_attr "round_suffix" "normal")
1721 (set_attr "trap_suffix" "u_su_sui")])
1723 (define_insn "*adddf_ext2"
1724 [(set (match_operand:DF 0 "register_operand" "=f")
1725 (plus:DF (float_extend:DF
1726 (match_operand:SF 1 "reg_or_0_operand" "%fG"))
1728 (match_operand:SF 2 "reg_or_0_operand" "fG"))))]
1729 "TARGET_FP && alpha_fptm < ALPHA_FPTM_SU"
1730 "add%-%/ %R1,%R2,%0"
1731 [(set_attr "type" "fadd")
1732 (set_attr "trap" "yes")
1733 (set_attr "round_suffix" "normal")
1734 (set_attr "trap_suffix" "u_su_sui")])
1736 (define_expand "addtf3"
1737 [(use (match_operand:TF 0 "register_operand"))
1738 (use (match_operand:TF 1 "general_operand"))
1739 (use (match_operand:TF 2 "general_operand"))]
1740 "TARGET_HAS_XFLOATING_LIBS"
1741 "alpha_emit_xfloating_arith (PLUS, operands); DONE;")
1743 (define_insn "*sub<mode>3_ieee"
1744 [(set (match_operand:FMODE 0 "register_operand" "=&f")
1745 (minus:FMODE (match_operand:FMODE 1 "reg_or_0_operand" "fG")
1746 (match_operand:FMODE 2 "reg_or_0_operand" "fG")))]
1747 "TARGET_FP && alpha_fptm >= ALPHA_FPTM_SU"
1748 "sub<modesuffix>%/ %R1,%R2,%0"
1749 [(set_attr "type" "fadd")
1750 (set_attr "trap" "yes")
1751 (set_attr "round_suffix" "normal")
1752 (set_attr "trap_suffix" "u_su_sui")])
1754 (define_insn "sub<mode>3"
1755 [(set (match_operand:FMODE 0 "register_operand" "=f")
1756 (minus:FMODE (match_operand:FMODE 1 "reg_or_0_operand" "fG")
1757 (match_operand:FMODE 2 "reg_or_0_operand" "fG")))]
1759 "sub<modesuffix>%/ %R1,%R2,%0"
1760 [(set_attr "type" "fadd")
1761 (set_attr "trap" "yes")
1762 (set_attr "round_suffix" "normal")
1763 (set_attr "trap_suffix" "u_su_sui")])
1765 (define_insn "*subdf_ext1"
1766 [(set (match_operand:DF 0 "register_operand" "=f")
1767 (minus:DF (float_extend:DF
1768 (match_operand:SF 1 "reg_or_0_operand" "fG"))
1769 (match_operand:DF 2 "reg_or_0_operand" "fG")))]
1770 "TARGET_FP && alpha_fptm < ALPHA_FPTM_SU"
1771 "sub%-%/ %R1,%R2,%0"
1772 [(set_attr "type" "fadd")
1773 (set_attr "trap" "yes")
1774 (set_attr "round_suffix" "normal")
1775 (set_attr "trap_suffix" "u_su_sui")])
1777 (define_insn "*subdf_ext2"
1778 [(set (match_operand:DF 0 "register_operand" "=f")
1779 (minus:DF (match_operand:DF 1 "reg_or_0_operand" "fG")
1781 (match_operand:SF 2 "reg_or_0_operand" "fG"))))]
1782 "TARGET_FP && alpha_fptm < ALPHA_FPTM_SU"
1783 "sub%-%/ %R1,%R2,%0"
1784 [(set_attr "type" "fadd")
1785 (set_attr "trap" "yes")
1786 (set_attr "round_suffix" "normal")
1787 (set_attr "trap_suffix" "u_su_sui")])
1789 (define_insn "*subdf_ext3"
1790 [(set (match_operand:DF 0 "register_operand" "=f")
1791 (minus:DF (float_extend:DF
1792 (match_operand:SF 1 "reg_or_0_operand" "fG"))
1794 (match_operand:SF 2 "reg_or_0_operand" "fG"))))]
1795 "TARGET_FP && alpha_fptm < ALPHA_FPTM_SU"
1796 "sub%-%/ %R1,%R2,%0"
1797 [(set_attr "type" "fadd")
1798 (set_attr "trap" "yes")
1799 (set_attr "round_suffix" "normal")
1800 (set_attr "trap_suffix" "u_su_sui")])
1802 (define_expand "subtf3"
1803 [(use (match_operand:TF 0 "register_operand"))
1804 (use (match_operand:TF 1 "general_operand"))
1805 (use (match_operand:TF 2 "general_operand"))]
1806 "TARGET_HAS_XFLOATING_LIBS"
1807 "alpha_emit_xfloating_arith (MINUS, operands); DONE;")
1809 (define_insn "*mul<mode>3_ieee"
1810 [(set (match_operand:FMODE 0 "register_operand" "=&f")
1811 (mult:FMODE (match_operand:FMODE 1 "reg_or_0_operand" "%fG")
1812 (match_operand:FMODE 2 "reg_or_0_operand" "fG")))]
1813 "TARGET_FP && alpha_fptm >= ALPHA_FPTM_SU"
1814 "mul<modesuffix>%/ %R1,%R2,%0"
1815 [(set_attr "type" "fmul")
1816 (set_attr "trap" "yes")
1817 (set_attr "round_suffix" "normal")
1818 (set_attr "trap_suffix" "u_su_sui")])
1820 (define_insn "mul<mode>3"
1821 [(set (match_operand:FMODE 0 "register_operand" "=f")
1822 (mult:FMODE (match_operand:FMODE 1 "reg_or_0_operand" "%fG")
1823 (match_operand:FMODE 2 "reg_or_0_operand" "fG")))]
1825 "mul<modesuffix>%/ %R1,%R2,%0"
1826 [(set_attr "type" "fmul")
1827 (set_attr "trap" "yes")
1828 (set_attr "round_suffix" "normal")
1829 (set_attr "trap_suffix" "u_su_sui")])
1831 (define_insn "*muldf_ext1"
1832 [(set (match_operand:DF 0 "register_operand" "=f")
1833 (mult:DF (float_extend:DF
1834 (match_operand:SF 1 "reg_or_0_operand" "fG"))
1835 (match_operand:DF 2 "reg_or_0_operand" "fG")))]
1836 "TARGET_FP && alpha_fptm < ALPHA_FPTM_SU"
1837 "mul%-%/ %R1,%R2,%0"
1838 [(set_attr "type" "fmul")
1839 (set_attr "trap" "yes")
1840 (set_attr "round_suffix" "normal")
1841 (set_attr "trap_suffix" "u_su_sui")])
1843 (define_insn "*muldf_ext2"
1844 [(set (match_operand:DF 0 "register_operand" "=f")
1845 (mult:DF (float_extend:DF
1846 (match_operand:SF 1 "reg_or_0_operand" "%fG"))
1848 (match_operand:SF 2 "reg_or_0_operand" "fG"))))]
1849 "TARGET_FP && alpha_fptm < ALPHA_FPTM_SU"
1850 "mul%-%/ %R1,%R2,%0"
1851 [(set_attr "type" "fmul")
1852 (set_attr "trap" "yes")
1853 (set_attr "round_suffix" "normal")
1854 (set_attr "trap_suffix" "u_su_sui")])
1856 (define_expand "multf3"
1857 [(use (match_operand:TF 0 "register_operand"))
1858 (use (match_operand:TF 1 "general_operand"))
1859 (use (match_operand:TF 2 "general_operand"))]
1860 "TARGET_HAS_XFLOATING_LIBS"
1861 "alpha_emit_xfloating_arith (MULT, operands); DONE;")
1863 (define_insn "*div<mode>3_ieee"
1864 [(set (match_operand:FMODE 0 "register_operand" "=&f")
1865 (div:FMODE (match_operand:FMODE 1 "reg_or_0_operand" "fG")
1866 (match_operand:FMODE 2 "reg_or_0_operand" "fG")))]
1867 "TARGET_FP && alpha_fptm >= ALPHA_FPTM_SU"
1868 "div<modesuffix>%/ %R1,%R2,%0"
1869 [(set_attr "type" "fdiv")
1870 (set_attr "opsize" "<opmode>")
1871 (set_attr "trap" "yes")
1872 (set_attr "round_suffix" "normal")
1873 (set_attr "trap_suffix" "u_su_sui")])
1875 (define_insn "div<mode>3"
1876 [(set (match_operand:FMODE 0 "register_operand" "=f")
1877 (div:FMODE (match_operand:FMODE 1 "reg_or_0_operand" "fG")
1878 (match_operand:FMODE 2 "reg_or_0_operand" "fG")))]
1880 "div<modesuffix>%/ %R1,%R2,%0"
1881 [(set_attr "type" "fdiv")
1882 (set_attr "opsize" "<opmode>")
1883 (set_attr "trap" "yes")
1884 (set_attr "round_suffix" "normal")
1885 (set_attr "trap_suffix" "u_su_sui")])
1887 (define_insn "*divdf_ext1"
1888 [(set (match_operand:DF 0 "register_operand" "=f")
1889 (div:DF (float_extend:DF (match_operand:SF 1 "reg_or_0_operand" "fG"))
1890 (match_operand:DF 2 "reg_or_0_operand" "fG")))]
1891 "TARGET_FP && alpha_fptm < ALPHA_FPTM_SU"
1892 "div%-%/ %R1,%R2,%0"
1893 [(set_attr "type" "fdiv")
1894 (set_attr "trap" "yes")
1895 (set_attr "round_suffix" "normal")
1896 (set_attr "trap_suffix" "u_su_sui")])
1898 (define_insn "*divdf_ext2"
1899 [(set (match_operand:DF 0 "register_operand" "=f")
1900 (div:DF (match_operand:DF 1 "reg_or_0_operand" "fG")
1902 (match_operand:SF 2 "reg_or_0_operand" "fG"))))]
1903 "TARGET_FP && alpha_fptm < ALPHA_FPTM_SU"
1904 "div%-%/ %R1,%R2,%0"
1905 [(set_attr "type" "fdiv")
1906 (set_attr "trap" "yes")
1907 (set_attr "round_suffix" "normal")
1908 (set_attr "trap_suffix" "u_su_sui")])
1910 (define_insn "*divdf_ext3"
1911 [(set (match_operand:DF 0 "register_operand" "=f")
1912 (div:DF (float_extend:DF
1913 (match_operand:SF 1 "reg_or_0_operand" "fG"))
1915 (match_operand:SF 2 "reg_or_0_operand" "fG"))))]
1916 "TARGET_FP && alpha_fptm < ALPHA_FPTM_SU"
1917 "div%-%/ %R1,%R2,%0"
1918 [(set_attr "type" "fdiv")
1919 (set_attr "trap" "yes")
1920 (set_attr "round_suffix" "normal")
1921 (set_attr "trap_suffix" "u_su_sui")])
1923 (define_expand "divtf3"
1924 [(use (match_operand:TF 0 "register_operand"))
1925 (use (match_operand:TF 1 "general_operand"))
1926 (use (match_operand:TF 2 "general_operand"))]
1927 "TARGET_HAS_XFLOATING_LIBS"
1928 "alpha_emit_xfloating_arith (DIV, operands); DONE;")
1930 (define_insn "*sqrt<mode>2_ieee"
1931 [(set (match_operand:FMODE 0 "register_operand" "=&f")
1932 (sqrt:FMODE (match_operand:FMODE 1 "reg_or_0_operand" "fG")))]
1933 "TARGET_FP && TARGET_FIX && alpha_fptm >= ALPHA_FPTM_SU"
1934 "sqrt<modesuffix>%/ %R1,%0"
1935 [(set_attr "type" "fsqrt")
1936 (set_attr "opsize" "<opmode>")
1937 (set_attr "trap" "yes")
1938 (set_attr "round_suffix" "normal")
1939 (set_attr "trap_suffix" "u_su_sui")])
1941 (define_insn "sqrt<mode>2"
1942 [(set (match_operand:FMODE 0 "register_operand" "=f")
1943 (sqrt:FMODE (match_operand:FMODE 1 "reg_or_0_operand" "fG")))]
1944 "TARGET_FP && TARGET_FIX"
1945 "sqrt<modesuffix>%/ %R1,%0"
1946 [(set_attr "type" "fsqrt")
1947 (set_attr "opsize" "<opmode>")
1948 (set_attr "trap" "yes")
1949 (set_attr "round_suffix" "normal")
1950 (set_attr "trap_suffix" "u_su_sui")])
1952 ;; Define conversion operators between DFmode and SImode, using the cvtql
1953 ;; instruction. To allow combine et al to do useful things, we keep the
1954 ;; operation as a unit until after reload, at which point we split the
1957 ;; Note that we (attempt to) only consider this optimization when the
1958 ;; ultimate destination is memory. If we will be doing further integer
1959 ;; processing, it is cheaper to do the truncation in the int regs.
1961 (define_insn "*cvtql"
1962 [(set (match_operand:SF 0 "register_operand" "=f")
1963 (unspec:SF [(match_operand:DI 1 "reg_or_0_operand" "fG")]
1967 [(set_attr "type" "fadd")
1968 (set_attr "trap" "yes")
1969 (set_attr "trap_suffix" "v_sv")])
1971 (define_insn_and_split "*fix_truncdfsi_ieee"
1972 [(set (match_operand:SI 0 "memory_operand" "=m")
1974 (match_operator:DI 4 "fix_operator"
1975 [(match_operand:DF 1 "reg_or_0_operand" "fG")]) 0))
1976 (clobber (match_scratch:DI 2 "=&f"))
1977 (clobber (match_scratch:SF 3 "=&f"))]
1978 "TARGET_FP && alpha_fptm >= ALPHA_FPTM_SU"
1980 "&& reload_completed"
1981 [(set (match_dup 2) (match_op_dup 4 [(match_dup 1)]))
1982 (set (match_dup 3) (unspec:SF [(match_dup 2)] UNSPEC_CVTQL))
1983 (set (match_dup 5) (match_dup 3))]
1985 operands[5] = adjust_address (operands[0], SFmode, 0);
1987 [(set_attr "type" "fadd")
1988 (set_attr "trap" "yes")])
1990 (define_insn_and_split "*fix_truncdfsi_internal"
1991 [(set (match_operand:SI 0 "memory_operand" "=m")
1993 (match_operator:DI 3 "fix_operator"
1994 [(match_operand:DF 1 "reg_or_0_operand" "fG")]) 0))
1995 (clobber (match_scratch:DI 2 "=f"))]
1996 "TARGET_FP && alpha_fptm < ALPHA_FPTM_SU"
1998 "&& reload_completed"
1999 [(set (match_dup 2) (match_op_dup 3 [(match_dup 1)]))
2000 (set (match_dup 4) (unspec:SF [(match_dup 2)] UNSPEC_CVTQL))
2001 (set (match_dup 5) (match_dup 4))]
2003 operands[4] = gen_rtx_REG (SFmode, REGNO (operands[2]));
2004 operands[5] = adjust_address (operands[0], SFmode, 0);
2006 [(set_attr "type" "fadd")
2007 (set_attr "trap" "yes")])
2009 (define_insn "*fix_truncdfdi_ieee"
2010 [(set (match_operand:DI 0 "reg_no_subreg_operand" "=&f")
2011 (match_operator:DI 2 "fix_operator"
2012 [(match_operand:DF 1 "reg_or_0_operand" "fG")]))]
2013 "TARGET_FP && alpha_fptm >= ALPHA_FPTM_SU"
2015 [(set_attr "type" "fadd")
2016 (set_attr "trap" "yes")
2017 (set_attr "round_suffix" "c")
2018 (set_attr "trap_suffix" "v_sv_svi")])
2020 (define_insn "*fix_truncdfdi2"
2021 [(set (match_operand:DI 0 "reg_no_subreg_operand" "=f")
2022 (match_operator:DI 2 "fix_operator"
2023 [(match_operand:DF 1 "reg_or_0_operand" "fG")]))]
2026 [(set_attr "type" "fadd")
2027 (set_attr "trap" "yes")
2028 (set_attr "round_suffix" "c")
2029 (set_attr "trap_suffix" "v_sv_svi")])
2031 (define_expand "fix_truncdfdi2"
2032 [(set (match_operand:DI 0 "reg_no_subreg_operand")
2033 (fix:DI (match_operand:DF 1 "reg_or_0_operand")))]
2036 (define_expand "fixuns_truncdfdi2"
2037 [(set (match_operand:DI 0 "reg_no_subreg_operand")
2038 (unsigned_fix:DI (match_operand:DF 1 "reg_or_0_operand")))]
2041 ;; Likewise between SFmode and SImode.
2043 (define_insn_and_split "*fix_truncsfsi_ieee"
2044 [(set (match_operand:SI 0 "memory_operand" "=m")
2046 (match_operator:DI 4 "fix_operator"
2048 (match_operand:SF 1 "reg_or_0_operand" "fG"))]) 0))
2049 (clobber (match_scratch:DI 2 "=&f"))
2050 (clobber (match_scratch:SF 3 "=&f"))]
2051 "TARGET_FP && alpha_fptm >= ALPHA_FPTM_SU"
2053 "&& reload_completed"
2054 [(set (match_dup 2) (match_op_dup 4 [(float_extend:DF (match_dup 1))]))
2055 (set (match_dup 3) (unspec:SF [(match_dup 2)] UNSPEC_CVTQL))
2056 (set (match_dup 5) (match_dup 3))]
2057 "operands[5] = adjust_address (operands[0], SFmode, 0);"
2058 [(set_attr "type" "fadd")
2059 (set_attr "trap" "yes")])
2061 (define_insn_and_split "*fix_truncsfsi_internal"
2062 [(set (match_operand:SI 0 "memory_operand" "=m")
2064 (match_operator:DI 3 "fix_operator"
2066 (match_operand:SF 1 "reg_or_0_operand" "fG"))]) 0))
2067 (clobber (match_scratch:DI 2 "=f"))]
2068 "TARGET_FP && alpha_fptm < ALPHA_FPTM_SU"
2070 "&& reload_completed"
2071 [(set (match_dup 2) (match_op_dup 3 [(float_extend:DF (match_dup 1))]))
2072 (set (match_dup 4) (unspec:SF [(match_dup 2)] UNSPEC_CVTQL))
2073 (set (match_dup 5) (match_dup 4))]
2075 operands[4] = gen_rtx_REG (SFmode, REGNO (operands[2]));
2076 operands[5] = adjust_address (operands[0], SFmode, 0);
2078 [(set_attr "type" "fadd")
2079 (set_attr "trap" "yes")])
2081 (define_insn "*fix_truncsfdi_ieee"
2082 [(set (match_operand:DI 0 "reg_no_subreg_operand" "=&f")
2083 (match_operator:DI 2 "fix_operator"
2084 [(float_extend:DF (match_operand:SF 1 "reg_or_0_operand" "fG"))]))]
2085 "TARGET_FP && alpha_fptm >= ALPHA_FPTM_SU"
2087 [(set_attr "type" "fadd")
2088 (set_attr "trap" "yes")
2089 (set_attr "round_suffix" "c")
2090 (set_attr "trap_suffix" "v_sv_svi")])
2092 (define_insn "*fix_truncsfdi2"
2093 [(set (match_operand:DI 0 "reg_no_subreg_operand" "=f")
2094 (match_operator:DI 2 "fix_operator"
2095 [(float_extend:DF (match_operand:SF 1 "reg_or_0_operand" "fG"))]))]
2098 [(set_attr "type" "fadd")
2099 (set_attr "trap" "yes")
2100 (set_attr "round_suffix" "c")
2101 (set_attr "trap_suffix" "v_sv_svi")])
2103 (define_expand "fix_truncsfdi2"
2104 [(set (match_operand:DI 0 "reg_no_subreg_operand")
2105 (fix:DI (float_extend:DF (match_operand:SF 1 "reg_or_0_operand"))))]
2108 (define_expand "fixuns_truncsfdi2"
2109 [(set (match_operand:DI 0 "reg_no_subreg_operand")
2111 (float_extend:DF (match_operand:SF 1 "reg_or_0_operand"))))]
2114 (define_expand "fix_trunctfdi2"
2115 [(use (match_operand:DI 0 "register_operand"))
2116 (use (match_operand:TF 1 "general_operand"))]
2117 "TARGET_HAS_XFLOATING_LIBS"
2118 "alpha_emit_xfloating_cvt (FIX, operands); DONE;")
2120 (define_expand "fixuns_trunctfdi2"
2121 [(use (match_operand:DI 0 "register_operand"))
2122 (use (match_operand:TF 1 "general_operand"))]
2123 "TARGET_HAS_XFLOATING_LIBS"
2124 "alpha_emit_xfloating_cvt (UNSIGNED_FIX, operands); DONE;")
2126 (define_insn "*floatdisf_ieee"
2127 [(set (match_operand:SF 0 "register_operand" "=&f")
2128 (float:SF (match_operand:DI 1 "reg_no_subreg_operand" "f")))]
2129 "TARGET_FP && alpha_fptm >= ALPHA_FPTM_SU"
2131 [(set_attr "type" "fadd")
2132 (set_attr "trap" "yes")
2133 (set_attr "round_suffix" "normal")
2134 (set_attr "trap_suffix" "sui")])
2136 (define_insn "floatdisf2"
2137 [(set (match_operand:SF 0 "register_operand" "=f")
2138 (float:SF (match_operand:DI 1 "reg_no_subreg_operand" "f")))]
2141 [(set_attr "type" "fadd")
2142 (set_attr "trap" "yes")
2143 (set_attr "round_suffix" "normal")
2144 (set_attr "trap_suffix" "sui")])
2146 (define_insn_and_split "*floatsisf2_ieee"
2147 [(set (match_operand:SF 0 "register_operand" "=&f")
2148 (float:SF (match_operand:SI 1 "memory_operand" "m")))
2149 (clobber (match_scratch:DI 2 "=&f"))
2150 (clobber (match_scratch:SF 3 "=&f"))]
2151 "TARGET_FP && alpha_fptm >= ALPHA_FPTM_SU"
2153 "&& reload_completed"
2154 [(set (match_dup 3) (match_dup 1))
2155 (set (match_dup 2) (unspec:DI [(match_dup 3)] UNSPEC_CVTLQ))
2156 (set (match_dup 0) (float:SF (match_dup 2)))]
2157 "operands[1] = adjust_address (operands[1], SFmode, 0);")
2159 (define_insn_and_split "*floatsisf2"
2160 [(set (match_operand:SF 0 "register_operand" "=f")
2161 (float:SF (match_operand:SI 1 "memory_operand" "m")))]
2164 "&& reload_completed"
2165 [(set (match_dup 0) (match_dup 1))
2166 (set (match_dup 2) (unspec:DI [(match_dup 0)] UNSPEC_CVTLQ))
2167 (set (match_dup 0) (float:SF (match_dup 2)))]
2169 operands[1] = adjust_address (operands[1], SFmode, 0);
2170 operands[2] = gen_rtx_REG (DImode, REGNO (operands[0]));
2173 (define_insn "*floatdidf_ieee"
2174 [(set (match_operand:DF 0 "register_operand" "=&f")
2175 (float:DF (match_operand:DI 1 "reg_no_subreg_operand" "f")))]
2176 "TARGET_FP && alpha_fptm >= ALPHA_FPTM_SU"
2178 [(set_attr "type" "fadd")
2179 (set_attr "trap" "yes")
2180 (set_attr "round_suffix" "normal")
2181 (set_attr "trap_suffix" "sui")])
2183 (define_insn "floatdidf2"
2184 [(set (match_operand:DF 0 "register_operand" "=f")
2185 (float:DF (match_operand:DI 1 "reg_no_subreg_operand" "f")))]
2188 [(set_attr "type" "fadd")
2189 (set_attr "trap" "yes")
2190 (set_attr "round_suffix" "normal")
2191 (set_attr "trap_suffix" "sui")])
2193 (define_insn_and_split "*floatsidf2_ieee"
2194 [(set (match_operand:DF 0 "register_operand" "=&f")
2195 (float:DF (match_operand:SI 1 "memory_operand" "m")))
2196 (clobber (match_scratch:DI 2 "=&f"))
2197 (clobber (match_scratch:SF 3 "=&f"))]
2198 "TARGET_FP && alpha_fptm >= ALPHA_FPTM_SU"
2200 "&& reload_completed"
2201 [(set (match_dup 3) (match_dup 1))
2202 (set (match_dup 2) (unspec:DI [(match_dup 3)] UNSPEC_CVTLQ))
2203 (set (match_dup 0) (float:DF (match_dup 2)))]
2204 "operands[1] = adjust_address (operands[1], SFmode, 0);")
2206 (define_insn_and_split "*floatsidf2"
2207 [(set (match_operand:DF 0 "register_operand" "=f")
2208 (float:DF (match_operand:SI 1 "memory_operand" "m")))]
2211 "&& reload_completed"
2212 [(set (match_dup 3) (match_dup 1))
2213 (set (match_dup 2) (unspec:DI [(match_dup 3)] UNSPEC_CVTLQ))
2214 (set (match_dup 0) (float:DF (match_dup 2)))]
2216 operands[1] = adjust_address (operands[1], SFmode, 0);
2217 operands[2] = gen_rtx_REG (DImode, REGNO (operands[0]));
2218 operands[3] = gen_rtx_REG (SFmode, REGNO (operands[0]));
2221 (define_expand "floatditf2"
2222 [(use (match_operand:TF 0 "register_operand"))
2223 (use (match_operand:DI 1 "general_operand"))]
2224 "TARGET_HAS_XFLOATING_LIBS"
2225 "alpha_emit_xfloating_cvt (FLOAT, operands); DONE;")
2227 (define_expand "floatunsdisf2"
2228 [(use (match_operand:SF 0 "register_operand"))
2229 (use (match_operand:DI 1 "register_operand"))]
2231 "alpha_emit_floatuns (operands); DONE;")
2233 (define_expand "floatunsdidf2"
2234 [(use (match_operand:DF 0 "register_operand"))
2235 (use (match_operand:DI 1 "register_operand"))]
2237 "alpha_emit_floatuns (operands); DONE;")
2239 (define_expand "floatunsditf2"
2240 [(use (match_operand:TF 0 "register_operand"))
2241 (use (match_operand:DI 1 "general_operand"))]
2242 "TARGET_HAS_XFLOATING_LIBS"
2243 "alpha_emit_xfloating_cvt (UNSIGNED_FLOAT, operands); DONE;")
2245 (define_expand "extendsfdf2"
2246 [(set (match_operand:DF 0 "register_operand")
2247 (float_extend:DF (match_operand:SF 1 "nonimmediate_operand")))]
2250 if (alpha_fptm >= ALPHA_FPTM_SU)
2251 operands[1] = force_reg (SFmode, operands[1]);
2254 ;; The Unicos/Mk assembler doesn't support cvtst, but we've already
2255 ;; asserted that alpha_fptm == ALPHA_FPTM_N.
2257 (define_insn "*extendsfdf2_ieee"
2258 [(set (match_operand:DF 0 "register_operand" "=&f")
2259 (float_extend:DF (match_operand:SF 1 "register_operand" "f")))]
2260 "TARGET_FP && alpha_fptm >= ALPHA_FPTM_SU"
2262 [(set_attr "type" "fadd")
2263 (set_attr "trap" "yes")])
2265 (define_insn "*extendsfdf2_internal"
2266 [(set (match_operand:DF 0 "register_operand" "=f,f,m")
2267 (float_extend:DF (match_operand:SF 1 "nonimmediate_operand" "f,m,f")))]
2268 "TARGET_FP && alpha_fptm < ALPHA_FPTM_SU"
2273 [(set_attr "type" "fcpys,fld,fst")])
2275 ;; Use register_operand for operand 1 to prevent compress_float_constant
2276 ;; from doing something silly. When optimizing we'll put things back
2278 (define_expand "extendsftf2"
2279 [(use (match_operand:TF 0 "register_operand"))
2280 (use (match_operand:SF 1 "register_operand"))]
2281 "TARGET_HAS_XFLOATING_LIBS"
2283 rtx tmp = gen_reg_rtx (DFmode);
2284 emit_insn (gen_extendsfdf2 (tmp, operands[1]));
2285 emit_insn (gen_extenddftf2 (operands[0], tmp));
2289 (define_expand "extenddftf2"
2290 [(use (match_operand:TF 0 "register_operand"))
2291 (use (match_operand:DF 1 "register_operand"))]
2292 "TARGET_HAS_XFLOATING_LIBS"
2293 "alpha_emit_xfloating_cvt (FLOAT_EXTEND, operands); DONE;")
2295 (define_insn "*truncdfsf2_ieee"
2296 [(set (match_operand:SF 0 "register_operand" "=&f")
2297 (float_truncate:SF (match_operand:DF 1 "reg_or_0_operand" "fG")))]
2298 "TARGET_FP && alpha_fptm >= ALPHA_FPTM_SU"
2300 [(set_attr "type" "fadd")
2301 (set_attr "trap" "yes")
2302 (set_attr "round_suffix" "normal")
2303 (set_attr "trap_suffix" "u_su_sui")])
2305 (define_insn "truncdfsf2"
2306 [(set (match_operand:SF 0 "register_operand" "=f")
2307 (float_truncate:SF (match_operand:DF 1 "reg_or_0_operand" "fG")))]
2310 [(set_attr "type" "fadd")
2311 (set_attr "trap" "yes")
2312 (set_attr "round_suffix" "normal")
2313 (set_attr "trap_suffix" "u_su_sui")])
2315 (define_expand "trunctfdf2"
2316 [(use (match_operand:DF 0 "register_operand"))
2317 (use (match_operand:TF 1 "general_operand"))]
2318 "TARGET_HAS_XFLOATING_LIBS"
2319 "alpha_emit_xfloating_cvt (FLOAT_TRUNCATE, operands); DONE;")
2321 (define_expand "trunctfsf2"
2322 [(use (match_operand:SF 0 "register_operand"))
2323 (use (match_operand:TF 1 "general_operand"))]
2324 "TARGET_FP && TARGET_HAS_XFLOATING_LIBS"
2326 rtx tmpf, sticky, arg, lo, hi;
2328 tmpf = gen_reg_rtx (DFmode);
2329 sticky = gen_reg_rtx (DImode);
2330 arg = copy_to_mode_reg (TFmode, operands[1]);
2331 lo = gen_lowpart (DImode, arg);
2332 hi = gen_highpart (DImode, arg);
2334 /* Convert the low word of the TFmode value into a sticky rounding bit,
2335 then or it into the low bit of the high word. This leaves the sticky
2336 bit at bit 48 of the fraction, which is representable in DFmode,
2337 which prevents rounding error in the final conversion to SFmode. */
2339 emit_insn (gen_rtx_SET (VOIDmode, sticky,
2340 gen_rtx_NE (DImode, lo, const0_rtx)));
2341 emit_insn (gen_iordi3 (hi, hi, sticky));
2342 emit_insn (gen_trunctfdf2 (tmpf, arg));
2343 emit_insn (gen_truncdfsf2 (operands[0], tmpf));
2347 ;; Next are all the integer comparisons, and conditional moves and branches
2348 ;; and some of the related define_expand's and define_split's.
2350 (define_insn "*setcc_internal"
2351 [(set (match_operand 0 "register_operand" "=r")
2352 (match_operator 1 "alpha_comparison_operator"
2353 [(match_operand:DI 2 "register_operand" "r")
2354 (match_operand:DI 3 "reg_or_8bit_operand" "rI")]))]
2355 "GET_MODE_CLASS (GET_MODE (operands[0])) == MODE_INT
2356 && GET_MODE_SIZE (GET_MODE (operands[0])) <= 8
2357 && GET_MODE (operands[0]) == GET_MODE (operands[1])"
2359 [(set_attr "type" "icmp")])
2361 ;; Yes, we can technically support reg_or_8bit_operand in operand 2,
2362 ;; but that's non-canonical rtl and allowing that causes inefficiencies
2364 (define_insn "*setcc_swapped_internal"
2365 [(set (match_operand 0 "register_operand" "=r")
2366 (match_operator 1 "alpha_swapped_comparison_operator"
2367 [(match_operand:DI 2 "register_operand" "r")
2368 (match_operand:DI 3 "reg_or_0_operand" "rJ")]))]
2369 "GET_MODE_CLASS (GET_MODE (operands[0])) == MODE_INT
2370 && GET_MODE_SIZE (GET_MODE (operands[0])) <= 8
2371 && GET_MODE (operands[0]) == GET_MODE (operands[1])"
2373 [(set_attr "type" "icmp")])
2375 ;; Use match_operator rather than ne directly so that we can match
2376 ;; multiple integer modes.
2377 (define_insn "*setne_internal"
2378 [(set (match_operand 0 "register_operand" "=r")
2379 (match_operator 1 "signed_comparison_operator"
2380 [(match_operand:DI 2 "register_operand" "r")
2382 "GET_MODE_CLASS (GET_MODE (operands[0])) == MODE_INT
2383 && GET_MODE_SIZE (GET_MODE (operands[0])) <= 8
2384 && GET_CODE (operands[1]) == NE
2385 && GET_MODE (operands[0]) == GET_MODE (operands[1])"
2387 [(set_attr "type" "icmp")])
2389 ;; The mode folding trick can't be used with const_int operands, since
2390 ;; reload needs to know the proper mode.
2392 ;; Use add_operand instead of the more seemingly natural reg_or_8bit_operand
2393 ;; in order to create more pairs of constants. As long as we're allowing
2394 ;; two constants at the same time, and will have to reload one of them...
2396 (define_insn "*mov<mode>cc_internal"
2397 [(set (match_operand:IMODE 0 "register_operand" "=r,r,r,r")
2399 (match_operator 2 "signed_comparison_operator"
2400 [(match_operand:DI 3 "reg_or_0_operand" "rJ,rJ,J,J")
2401 (match_operand:DI 4 "reg_or_0_operand" "J,J,rJ,rJ")])
2402 (match_operand:IMODE 1 "add_operand" "rI,0,rI,0")
2403 (match_operand:IMODE 5 "add_operand" "0,rI,0,rI")))]
2404 "(operands[3] == const0_rtx) ^ (operands[4] == const0_rtx)"
2410 [(set_attr "type" "icmov")])
2412 (define_insn "*mov<mode>cc_lbc"
2413 [(set (match_operand:IMODE 0 "register_operand" "=r,r")
2415 (eq (zero_extract:DI (match_operand:DI 2 "reg_or_0_operand" "rJ,rJ")
2419 (match_operand:IMODE 1 "reg_or_8bit_operand" "rI,0")
2420 (match_operand:IMODE 3 "reg_or_8bit_operand" "0,rI")))]
2425 [(set_attr "type" "icmov")])
2427 (define_insn "*mov<mode>cc_lbs"
2428 [(set (match_operand:IMODE 0 "register_operand" "=r,r")
2430 (ne (zero_extract:DI (match_operand:DI 2 "reg_or_0_operand" "rJ,rJ")
2434 (match_operand:IMODE 1 "reg_or_8bit_operand" "rI,0")
2435 (match_operand:IMODE 3 "reg_or_8bit_operand" "0,rI")))]
2440 [(set_attr "type" "icmov")])
2442 ;; For ABS, we have two choices, depending on whether the input and output
2443 ;; registers are the same or not.
2444 (define_expand "absdi2"
2445 [(set (match_operand:DI 0 "register_operand")
2446 (abs:DI (match_operand:DI 1 "register_operand")))]
2449 if (rtx_equal_p (operands[0], operands[1]))
2450 emit_insn (gen_absdi2_same (operands[0], gen_reg_rtx (DImode)));
2452 emit_insn (gen_absdi2_diff (operands[0], operands[1]));
2456 (define_expand "absdi2_same"
2457 [(set (match_operand:DI 1 "register_operand")
2458 (neg:DI (match_operand:DI 0 "register_operand")))
2460 (if_then_else:DI (ge (match_dup 0) (const_int 0))
2464 (define_expand "absdi2_diff"
2465 [(set (match_operand:DI 0 "register_operand")
2466 (neg:DI (match_operand:DI 1 "register_operand")))
2468 (if_then_else:DI (lt (match_dup 1) (const_int 0))
2473 [(set (match_operand:DI 0 "register_operand")
2474 (abs:DI (match_dup 0)))
2475 (clobber (match_operand:DI 1 "register_operand"))]
2477 [(set (match_dup 1) (neg:DI (match_dup 0)))
2478 (set (match_dup 0) (if_then_else:DI (ge (match_dup 0) (const_int 0))
2479 (match_dup 0) (match_dup 1)))])
2482 [(set (match_operand:DI 0 "register_operand")
2483 (abs:DI (match_operand:DI 1 "register_operand")))]
2484 "! rtx_equal_p (operands[0], operands[1])"
2485 [(set (match_dup 0) (neg:DI (match_dup 1)))
2486 (set (match_dup 0) (if_then_else:DI (lt (match_dup 1) (const_int 0))
2487 (match_dup 0) (match_dup 1)))])
2490 [(set (match_operand:DI 0 "register_operand")
2491 (neg:DI (abs:DI (match_dup 0))))
2492 (clobber (match_operand:DI 1 "register_operand"))]
2494 [(set (match_dup 1) (neg:DI (match_dup 0)))
2495 (set (match_dup 0) (if_then_else:DI (le (match_dup 0) (const_int 0))
2496 (match_dup 0) (match_dup 1)))])
2499 [(set (match_operand:DI 0 "register_operand")
2500 (neg:DI (abs:DI (match_operand:DI 1 "register_operand"))))]
2501 "! rtx_equal_p (operands[0], operands[1])"
2502 [(set (match_dup 0) (neg:DI (match_dup 1)))
2503 (set (match_dup 0) (if_then_else:DI (gt (match_dup 1) (const_int 0))
2504 (match_dup 0) (match_dup 1)))])
2506 (define_insn "<code><mode>3"
2507 [(set (match_operand:I12MODE 0 "register_operand" "=r")
2509 (match_operand:I12MODE 1 "reg_or_0_operand" "%rJ")
2510 (match_operand:I12MODE 2 "reg_or_8bit_operand" "rI")))]
2512 "<maxmin><vecmodesuffix> %r1,%2,%0"
2513 [(set_attr "type" "mvi")])
2515 (define_expand "smaxdi3"
2517 (le:DI (match_operand:DI 1 "reg_or_0_operand")
2518 (match_operand:DI 2 "reg_or_8bit_operand")))
2519 (set (match_operand:DI 0 "register_operand")
2520 (if_then_else:DI (eq (match_dup 3) (const_int 0))
2521 (match_dup 1) (match_dup 2)))]
2523 "operands[3] = gen_reg_rtx (DImode);")
2526 [(set (match_operand:DI 0 "register_operand")
2527 (smax:DI (match_operand:DI 1 "reg_or_0_operand")
2528 (match_operand:DI 2 "reg_or_8bit_operand")))
2529 (clobber (match_operand:DI 3 "register_operand"))]
2530 "operands[2] != const0_rtx"
2531 [(set (match_dup 3) (le:DI (match_dup 1) (match_dup 2)))
2532 (set (match_dup 0) (if_then_else:DI (eq (match_dup 3) (const_int 0))
2533 (match_dup 1) (match_dup 2)))])
2535 (define_insn "*smax_const0"
2536 [(set (match_operand:DI 0 "register_operand" "=r")
2537 (smax:DI (match_operand:DI 1 "register_operand" "0")
2541 [(set_attr "type" "icmov")])
2543 (define_expand "smindi3"
2545 (lt:DI (match_operand:DI 1 "reg_or_0_operand")
2546 (match_operand:DI 2 "reg_or_8bit_operand")))
2547 (set (match_operand:DI 0 "register_operand")
2548 (if_then_else:DI (ne (match_dup 3) (const_int 0))
2549 (match_dup 1) (match_dup 2)))]
2551 "operands[3] = gen_reg_rtx (DImode);")
2554 [(set (match_operand:DI 0 "register_operand")
2555 (smin:DI (match_operand:DI 1 "reg_or_0_operand")
2556 (match_operand:DI 2 "reg_or_8bit_operand")))
2557 (clobber (match_operand:DI 3 "register_operand"))]
2558 "operands[2] != const0_rtx"
2559 [(set (match_dup 3) (lt:DI (match_dup 1) (match_dup 2)))
2560 (set (match_dup 0) (if_then_else:DI (ne (match_dup 3) (const_int 0))
2561 (match_dup 1) (match_dup 2)))])
2563 (define_insn "*smin_const0"
2564 [(set (match_operand:DI 0 "register_operand" "=r")
2565 (smin:DI (match_operand:DI 1 "register_operand" "0")
2569 [(set_attr "type" "icmov")])
2571 (define_expand "umaxdi3"
2573 (leu:DI (match_operand:DI 1 "reg_or_0_operand")
2574 (match_operand:DI 2 "reg_or_8bit_operand")))
2575 (set (match_operand:DI 0 "register_operand")
2576 (if_then_else:DI (eq (match_dup 3) (const_int 0))
2577 (match_dup 1) (match_dup 2)))]
2579 "operands[3] = gen_reg_rtx (DImode);")
2582 [(set (match_operand:DI 0 "register_operand")
2583 (umax:DI (match_operand:DI 1 "reg_or_0_operand")
2584 (match_operand:DI 2 "reg_or_8bit_operand")))
2585 (clobber (match_operand:DI 3 "register_operand"))]
2586 "operands[2] != const0_rtx"
2587 [(set (match_dup 3) (leu:DI (match_dup 1) (match_dup 2)))
2588 (set (match_dup 0) (if_then_else:DI (eq (match_dup 3) (const_int 0))
2589 (match_dup 1) (match_dup 2)))])
2591 (define_expand "umindi3"
2593 (ltu:DI (match_operand:DI 1 "reg_or_0_operand")
2594 (match_operand:DI 2 "reg_or_8bit_operand")))
2595 (set (match_operand:DI 0 "register_operand")
2596 (if_then_else:DI (ne (match_dup 3) (const_int 0))
2597 (match_dup 1) (match_dup 2)))]
2599 "operands[3] = gen_reg_rtx (DImode);")
2602 [(set (match_operand:DI 0 "register_operand")
2603 (umin:DI (match_operand:DI 1 "reg_or_0_operand")
2604 (match_operand:DI 2 "reg_or_8bit_operand")))
2605 (clobber (match_operand:DI 3 "register_operand"))]
2606 "operands[2] != const0_rtx"
2607 [(set (match_dup 3) (ltu:DI (match_dup 1) (match_dup 2)))
2608 (set (match_dup 0) (if_then_else:DI (ne (match_dup 3) (const_int 0))
2609 (match_dup 1) (match_dup 2)))])
2611 (define_insn "*bcc_normal"
2614 (match_operator 1 "signed_comparison_operator"
2615 [(match_operand:DI 2 "reg_or_0_operand" "rJ")
2617 (label_ref (match_operand 0))
2621 [(set_attr "type" "ibr")])
2623 (define_insn "*bcc_reverse"
2626 (match_operator 1 "signed_comparison_operator"
2627 [(match_operand:DI 2 "register_operand" "r")
2631 (label_ref (match_operand 0))))]
2634 [(set_attr "type" "ibr")])
2636 (define_insn "*blbs_normal"
2639 (ne (zero_extract:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
2643 (label_ref (match_operand 0))
2647 [(set_attr "type" "ibr")])
2649 (define_insn "*blbc_normal"
2652 (eq (zero_extract:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
2656 (label_ref (match_operand 0))
2660 [(set_attr "type" "ibr")])
2666 (match_operator 1 "comparison_operator"
2667 [(zero_extract:DI (match_operand:DI 2 "register_operand")
2669 (match_operand:DI 3 "const_int_operand"))
2671 (label_ref (match_operand 0))
2673 (clobber (match_operand:DI 4 "register_operand"))])]
2674 "INTVAL (operands[3]) != 0"
2676 (lshiftrt:DI (match_dup 2) (match_dup 3)))
2678 (if_then_else (match_op_dup 1
2679 [(zero_extract:DI (match_dup 4)
2683 (label_ref (match_dup 0))
2687 ;; The following are the corresponding floating-point insns. Recall
2688 ;; we need to have variants that expand the arguments from SFmode
2691 (define_insn "*cmpdf_ieee"
2692 [(set (match_operand:DF 0 "register_operand" "=&f")
2693 (match_operator:DF 1 "alpha_fp_comparison_operator"
2694 [(match_operand:DF 2 "reg_or_0_operand" "fG")
2695 (match_operand:DF 3 "reg_or_0_operand" "fG")]))]
2696 "TARGET_FP && alpha_fptm >= ALPHA_FPTM_SU"
2697 "cmp%-%C1%/ %R2,%R3,%0"
2698 [(set_attr "type" "fadd")
2699 (set_attr "trap" "yes")
2700 (set_attr "trap_suffix" "su")])
2702 (define_insn "*cmpdf_internal"
2703 [(set (match_operand:DF 0 "register_operand" "=f")
2704 (match_operator:DF 1 "alpha_fp_comparison_operator"
2705 [(match_operand:DF 2 "reg_or_0_operand" "fG")
2706 (match_operand:DF 3 "reg_or_0_operand" "fG")]))]
2708 "cmp%-%C1%/ %R2,%R3,%0"
2709 [(set_attr "type" "fadd")
2710 (set_attr "trap" "yes")
2711 (set_attr "trap_suffix" "su")])
2713 (define_insn "*cmpdf_ext1"
2714 [(set (match_operand:DF 0 "register_operand" "=f")
2715 (match_operator:DF 1 "alpha_fp_comparison_operator"
2717 (match_operand:SF 2 "reg_or_0_operand" "fG"))
2718 (match_operand:DF 3 "reg_or_0_operand" "fG")]))]
2719 "TARGET_FP && alpha_fptm < ALPHA_FPTM_SU"
2720 "cmp%-%C1%/ %R2,%R3,%0"
2721 [(set_attr "type" "fadd")
2722 (set_attr "trap" "yes")
2723 (set_attr "trap_suffix" "su")])
2725 (define_insn "*cmpdf_ext2"
2726 [(set (match_operand:DF 0 "register_operand" "=f")
2727 (match_operator:DF 1 "alpha_fp_comparison_operator"
2728 [(match_operand:DF 2 "reg_or_0_operand" "fG")
2730 (match_operand:SF 3 "reg_or_0_operand" "fG"))]))]
2731 "TARGET_FP && alpha_fptm < ALPHA_FPTM_SU"
2732 "cmp%-%C1%/ %R2,%R3,%0"
2733 [(set_attr "type" "fadd")
2734 (set_attr "trap" "yes")
2735 (set_attr "trap_suffix" "su")])
2737 (define_insn "*cmpdf_ext3"
2738 [(set (match_operand:DF 0 "register_operand" "=f")
2739 (match_operator:DF 1 "alpha_fp_comparison_operator"
2741 (match_operand:SF 2 "reg_or_0_operand" "fG"))
2743 (match_operand:SF 3 "reg_or_0_operand" "fG"))]))]
2744 "TARGET_FP && alpha_fptm < ALPHA_FPTM_SU"
2745 "cmp%-%C1%/ %R2,%R3,%0"
2746 [(set_attr "type" "fadd")
2747 (set_attr "trap" "yes")
2748 (set_attr "trap_suffix" "su")])
2750 (define_insn "*mov<mode>cc_internal"
2751 [(set (match_operand:FMODE 0 "register_operand" "=f,f")
2753 (match_operator 3 "signed_comparison_operator"
2754 [(match_operand:DF 4 "reg_or_0_operand" "fG,fG")
2755 (match_operand:DF 2 "const0_operand" "G,G")])
2756 (match_operand:FMODE 1 "reg_or_0_operand" "fG,0")
2757 (match_operand:FMODE 5 "reg_or_0_operand" "0,fG")))]
2761 fcmov%D3 %R4,%R5,%0"
2762 [(set_attr "type" "fcmov")])
2764 (define_insn "*movdfcc_ext1"
2765 [(set (match_operand:DF 0 "register_operand" "=f,f")
2767 (match_operator 3 "signed_comparison_operator"
2768 [(match_operand:DF 4 "reg_or_0_operand" "fG,fG")
2769 (match_operand:DF 2 "const0_operand" "G,G")])
2770 (float_extend:DF (match_operand:SF 1 "reg_or_0_operand" "fG,0"))
2771 (match_operand:DF 5 "reg_or_0_operand" "0,fG")))]
2772 "TARGET_FP && alpha_fptm < ALPHA_FPTM_SU"
2775 fcmov%D3 %R4,%R5,%0"
2776 [(set_attr "type" "fcmov")])
2778 (define_insn "*movdfcc_ext2"
2779 [(set (match_operand:DF 0 "register_operand" "=f,f")
2781 (match_operator 3 "signed_comparison_operator"
2783 (match_operand:SF 4 "reg_or_0_operand" "fG,fG"))
2784 (match_operand:DF 2 "const0_operand" "G,G")])
2785 (match_operand:DF 1 "reg_or_0_operand" "fG,0")
2786 (match_operand:DF 5 "reg_or_0_operand" "0,fG")))]
2787 "TARGET_FP && alpha_fptm < ALPHA_FPTM_SU"
2790 fcmov%D3 %R4,%R5,%0"
2791 [(set_attr "type" "fcmov")])
2793 (define_insn "*movdfcc_ext3"
2794 [(set (match_operand:SF 0 "register_operand" "=f,f")
2796 (match_operator 3 "signed_comparison_operator"
2798 (match_operand:SF 4 "reg_or_0_operand" "fG,fG"))
2799 (match_operand:DF 2 "const0_operand" "G,G")])
2800 (match_operand:SF 1 "reg_or_0_operand" "fG,0")
2801 (match_operand:SF 5 "reg_or_0_operand" "0,fG")))]
2802 "TARGET_FP && alpha_fptm < ALPHA_FPTM_SU"
2805 fcmov%D3 %R4,%R5,%0"
2806 [(set_attr "type" "fcmov")])
2808 (define_insn "*movdfcc_ext4"
2809 [(set (match_operand:DF 0 "register_operand" "=f,f")
2811 (match_operator 3 "signed_comparison_operator"
2813 (match_operand:SF 4 "reg_or_0_operand" "fG,fG"))
2814 (match_operand:DF 2 "const0_operand" "G,G")])
2815 (float_extend:DF (match_operand:SF 1 "reg_or_0_operand" "fG,0"))
2816 (match_operand:DF 5 "reg_or_0_operand" "0,fG")))]
2817 "TARGET_FP && alpha_fptm < ALPHA_FPTM_SU"
2820 fcmov%D3 %R4,%R5,%0"
2821 [(set_attr "type" "fcmov")])
2823 (define_expand "smaxdf3"
2825 (le:DF (match_operand:DF 1 "reg_or_0_operand")
2826 (match_operand:DF 2 "reg_or_0_operand")))
2827 (set (match_operand:DF 0 "register_operand")
2828 (if_then_else:DF (eq (match_dup 3) (match_dup 4))
2829 (match_dup 1) (match_dup 2)))]
2832 operands[3] = gen_reg_rtx (DFmode);
2833 operands[4] = CONST0_RTX (DFmode);
2836 (define_expand "smindf3"
2838 (lt:DF (match_operand:DF 1 "reg_or_0_operand")
2839 (match_operand:DF 2 "reg_or_0_operand")))
2840 (set (match_operand:DF 0 "register_operand")
2841 (if_then_else:DF (ne (match_dup 3) (match_dup 4))
2842 (match_dup 1) (match_dup 2)))]
2845 operands[3] = gen_reg_rtx (DFmode);
2846 operands[4] = CONST0_RTX (DFmode);
2849 (define_expand "smaxsf3"
2851 (le:DF (float_extend:DF (match_operand:SF 1 "reg_or_0_operand"))
2852 (float_extend:DF (match_operand:SF 2 "reg_or_0_operand"))))
2853 (set (match_operand:SF 0 "register_operand")
2854 (if_then_else:SF (eq (match_dup 3) (match_dup 4))
2855 (match_dup 1) (match_dup 2)))]
2856 "TARGET_FP && alpha_fptm < ALPHA_FPTM_SU"
2858 operands[3] = gen_reg_rtx (DFmode);
2859 operands[4] = CONST0_RTX (DFmode);
2862 (define_expand "sminsf3"
2864 (lt:DF (float_extend:DF (match_operand:SF 1 "reg_or_0_operand"))
2865 (float_extend:DF (match_operand:SF 2 "reg_or_0_operand"))))
2866 (set (match_operand:SF 0 "register_operand")
2867 (if_then_else:SF (ne (match_dup 3) (match_dup 4))
2868 (match_dup 1) (match_dup 2)))]
2869 "TARGET_FP && alpha_fptm < ALPHA_FPTM_SU"
2871 operands[3] = gen_reg_rtx (DFmode);
2872 operands[4] = CONST0_RTX (DFmode);
2875 (define_insn "*fbcc_normal"
2878 (match_operator 1 "signed_comparison_operator"
2879 [(match_operand:DF 2 "reg_or_0_operand" "fG")
2880 (match_operand:DF 3 "const0_operand" "G")])
2881 (label_ref (match_operand 0))
2885 [(set_attr "type" "fbr")])
2887 (define_insn "*fbcc_ext_normal"
2890 (match_operator 1 "signed_comparison_operator"
2892 (match_operand:SF 2 "reg_or_0_operand" "fG"))
2893 (match_operand:DF 3 "const0_operand" "G")])
2894 (label_ref (match_operand 0))
2898 [(set_attr "type" "fbr")])
2900 ;; These are the main define_expand's used to make conditional branches
2903 (define_expand "cbranchdf4"
2904 [(use (match_operator 0 "alpha_cbranch_operator"
2905 [(match_operand:DF 1 "reg_or_0_operand")
2906 (match_operand:DF 2 "reg_or_0_operand")]))
2907 (use (match_operand 3))]
2909 "alpha_emit_conditional_branch (operands, DFmode); DONE;")
2911 (define_expand "cbranchtf4"
2912 [(use (match_operator 0 "alpha_cbranch_operator"
2913 [(match_operand:TF 1 "general_operand")
2914 (match_operand:TF 2 "general_operand")]))
2915 (use (match_operand 3))]
2916 "TARGET_HAS_XFLOATING_LIBS"
2917 "alpha_emit_conditional_branch (operands, TFmode); DONE;")
2919 (define_expand "cbranchdi4"
2920 [(use (match_operator 0 "alpha_cbranch_operator"
2921 [(match_operand:DI 1 "some_operand")
2922 (match_operand:DI 2 "some_operand")]))
2923 (use (match_operand 3))]
2925 "alpha_emit_conditional_branch (operands, DImode); DONE;")
2927 (define_expand "cstoredf4"
2928 [(use (match_operator:DI 1 "alpha_cbranch_operator"
2929 [(match_operand:DF 2 "reg_or_0_operand")
2930 (match_operand:DF 3 "reg_or_0_operand")]))
2931 (clobber (match_operand:DI 0 "register_operand"))]
2934 if (alpha_emit_setcc (operands, DFmode))
2940 (define_expand "cstoretf4"
2941 [(use (match_operator:DI 1 "alpha_cbranch_operator"
2942 [(match_operand:TF 2 "general_operand")
2943 (match_operand:TF 3 "general_operand")]))
2944 (clobber (match_operand:DI 0 "register_operand"))]
2945 "TARGET_HAS_XFLOATING_LIBS"
2947 if (alpha_emit_setcc (operands, TFmode))
2953 (define_expand "cstoredi4"
2954 [(use (match_operator:DI 1 "alpha_cbranch_operator"
2955 [(match_operand:DI 2 "some_operand")
2956 (match_operand:DI 3 "some_operand")]))
2957 (clobber (match_operand:DI 0 "register_operand"))]
2960 if (alpha_emit_setcc (operands, DImode))
2966 ;; These are the main define_expand's used to make conditional moves.
2968 (define_expand "mov<mode>cc"
2969 [(set (match_operand:I48MODE 0 "register_operand")
2970 (if_then_else:I48MODE
2971 (match_operand 1 "comparison_operator")
2972 (match_operand:I48MODE 2 "reg_or_8bit_operand")
2973 (match_operand:I48MODE 3 "reg_or_8bit_operand")))]
2976 operands[1] = alpha_emit_conditional_move (operands[1], <MODE>mode);
2977 if (operands[1] == 0)
2981 (define_expand "mov<mode>cc"
2982 [(set (match_operand:FMODE 0 "register_operand")
2984 (match_operand 1 "comparison_operator")
2985 (match_operand:FMODE 2 "reg_or_8bit_operand")
2986 (match_operand:FMODE 3 "reg_or_8bit_operand")))]
2989 operands[1] = alpha_emit_conditional_move (operands[1], <MODE>mode);
2990 if (operands[1] == 0)
2994 ;; These define_split definitions are used in cases when comparisons have
2995 ;; not be stated in the correct way and we need to reverse the second
2996 ;; comparison. For example, x >= 7 has to be done as x < 6 with the
2997 ;; comparison that tests the result being reversed. We have one define_split
2998 ;; for each use of a comparison. They do not match valid insns and need
2999 ;; not generate valid insns.
3001 ;; We can also handle equality comparisons (and inequality comparisons in
3002 ;; cases where the resulting add cannot overflow) by doing an add followed by
3003 ;; a comparison with zero. This is faster since the addition takes one
3004 ;; less cycle than a compare when feeding into a conditional move.
3005 ;; For this case, we also have an SImode pattern since we can merge the add
3006 ;; and sign extend and the order doesn't matter.
3008 ;; We do not do this for floating-point, since it isn't clear how the "wrong"
3009 ;; operation could have been generated.
3012 [(set (match_operand:DI 0 "register_operand")
3014 (match_operator 1 "comparison_operator"
3015 [(match_operand:DI 2 "reg_or_0_operand")
3016 (match_operand:DI 3 "reg_or_cint_operand")])
3017 (match_operand:DI 4 "reg_or_cint_operand")
3018 (match_operand:DI 5 "reg_or_cint_operand")))
3019 (clobber (match_operand:DI 6 "register_operand"))]
3020 "operands[3] != const0_rtx"
3021 [(set (match_dup 6) (match_dup 7))
3023 (if_then_else:DI (match_dup 8) (match_dup 4) (match_dup 5)))]
3025 enum rtx_code code = GET_CODE (operands[1]);
3026 int unsignedp = (code == GEU || code == LEU || code == GTU || code == LTU);
3028 /* If we are comparing for equality with a constant and that constant
3029 appears in the arm when the register equals the constant, use the
3030 register since that is more likely to match (and to produce better code
3033 if (code == EQ && CONST_INT_P (operands[3])
3034 && rtx_equal_p (operands[4], operands[3]))
3035 operands[4] = operands[2];
3037 else if (code == NE && CONST_INT_P (operands[3])
3038 && rtx_equal_p (operands[5], operands[3]))
3039 operands[5] = operands[2];
3041 if (code == NE || code == EQ
3042 || (extended_count (operands[2], DImode, unsignedp) >= 1
3043 && extended_count (operands[3], DImode, unsignedp) >= 1))
3045 if (CONST_INT_P (operands[3]))
3046 operands[7] = gen_rtx_PLUS (DImode, operands[2],
3047 GEN_INT (- INTVAL (operands[3])));
3049 operands[7] = gen_rtx_MINUS (DImode, operands[2], operands[3]);
3051 operands[8] = gen_rtx_fmt_ee (code, VOIDmode, operands[6], const0_rtx);
3054 else if (code == EQ || code == LE || code == LT
3055 || code == LEU || code == LTU)
3057 operands[7] = gen_rtx_fmt_ee (code, DImode, operands[2], operands[3]);
3058 operands[8] = gen_rtx_NE (VOIDmode, operands[6], const0_rtx);
3062 operands[7] = gen_rtx_fmt_ee (reverse_condition (code), DImode,
3063 operands[2], operands[3]);
3064 operands[8] = gen_rtx_EQ (VOIDmode, operands[6], const0_rtx);
3069 [(set (match_operand:DI 0 "register_operand")
3071 (match_operator 1 "comparison_operator"
3072 [(match_operand:SI 2 "reg_or_0_operand")
3073 (match_operand:SI 3 "reg_or_cint_operand")])
3074 (match_operand:DI 4 "reg_or_8bit_operand")
3075 (match_operand:DI 5 "reg_or_8bit_operand")))
3076 (clobber (match_operand:DI 6 "register_operand"))]
3077 "operands[3] != const0_rtx
3078 && (GET_CODE (operands[1]) == EQ || GET_CODE (operands[1]) == NE)"
3079 [(set (match_dup 6) (match_dup 7))
3081 (if_then_else:DI (match_dup 8) (match_dup 4) (match_dup 5)))]
3083 enum rtx_code code = GET_CODE (operands[1]);
3084 int unsignedp = (code == GEU || code == LEU || code == GTU || code == LTU);
3087 if ((code != NE && code != EQ
3088 && ! (extended_count (operands[2], DImode, unsignedp) >= 1
3089 && extended_count (operands[3], DImode, unsignedp) >= 1)))
3092 if (CONST_INT_P (operands[3]))
3093 tem = gen_rtx_PLUS (SImode, operands[2],
3094 GEN_INT (- INTVAL (operands[3])));
3096 tem = gen_rtx_MINUS (SImode, operands[2], operands[3]);
3098 operands[7] = gen_rtx_SIGN_EXTEND (DImode, tem);
3099 operands[8] = gen_rtx_fmt_ee (GET_CODE (operands[1]), VOIDmode,
3100 operands[6], const0_rtx);
3103 ;; Prefer to use cmp and arithmetic when possible instead of a cmove.
3106 [(set (match_operand 0 "register_operand")
3107 (if_then_else (match_operator 1 "signed_comparison_operator"
3108 [(match_operand:DI 2 "reg_or_0_operand")
3110 (match_operand 3 "const_int_operand")
3111 (match_operand 4 "const_int_operand")))]
3115 if (alpha_split_conditional_move (GET_CODE (operands[1]), operands[0],
3116 operands[2], operands[3], operands[4]))
3122 ;; ??? Why combine is allowed to create such non-canonical rtl, I don't know.
3123 ;; Oh well, we match it in movcc, so it must be partially our fault.
3125 [(set (match_operand 0 "register_operand")
3126 (if_then_else (match_operator 1 "signed_comparison_operator"
3128 (match_operand:DI 2 "reg_or_0_operand")])
3129 (match_operand 3 "const_int_operand")
3130 (match_operand 4 "const_int_operand")))]
3134 if (alpha_split_conditional_move (swap_condition (GET_CODE (operands[1])),
3135 operands[0], operands[2], operands[3],
3142 (define_insn_and_split "*cmp_sadd_di"
3143 [(set (match_operand:DI 0 "register_operand" "=r")
3144 (plus:DI (if_then_else:DI
3145 (match_operator 1 "alpha_zero_comparison_operator"
3146 [(match_operand:DI 2 "reg_or_0_operand" "rJ")
3148 (match_operand:DI 3 "const48_operand" "I")
3150 (match_operand:DI 4 "sext_add_operand" "rIO")))
3151 (clobber (match_scratch:DI 5 "=r"))]
3156 (match_op_dup:DI 1 [(match_dup 2) (const_int 0)]))
3158 (plus:DI (mult:DI (match_dup 5) (match_dup 3))
3161 if (can_create_pseudo_p ())
3162 operands[5] = gen_reg_rtx (DImode);
3163 else if (reg_overlap_mentioned_p (operands[5], operands[4]))
3164 operands[5] = operands[0];
3167 (define_insn_and_split "*cmp_sadd_si"
3168 [(set (match_operand:SI 0 "register_operand" "=r")
3169 (plus:SI (if_then_else:SI
3170 (match_operator 1 "alpha_zero_comparison_operator"
3171 [(match_operand:DI 2 "reg_or_0_operand" "rJ")
3173 (match_operand:SI 3 "const48_operand" "I")
3175 (match_operand:SI 4 "sext_add_operand" "rIO")))
3176 (clobber (match_scratch:DI 5 "=r"))]
3181 (match_op_dup:DI 1 [(match_dup 2) (const_int 0)]))
3183 (plus:SI (mult:SI (match_dup 6) (match_dup 3))
3186 if (can_create_pseudo_p ())
3187 operands[5] = gen_reg_rtx (DImode);
3188 else if (reg_overlap_mentioned_p (operands[5], operands[4]))
3189 operands[5] = gen_lowpart (DImode, operands[0]);
3191 operands[6] = gen_lowpart (SImode, operands[5]);
3194 (define_insn_and_split "*cmp_sadd_sidi"
3195 [(set (match_operand:DI 0 "register_operand" "=r")
3197 (plus:SI (if_then_else:SI
3198 (match_operator 1 "alpha_zero_comparison_operator"
3199 [(match_operand:DI 2 "reg_or_0_operand" "rJ")
3201 (match_operand:SI 3 "const48_operand" "I")
3203 (match_operand:SI 4 "sext_add_operand" "rIO"))))
3204 (clobber (match_scratch:DI 5 "=r"))]
3209 (match_op_dup:DI 1 [(match_dup 2) (const_int 0)]))
3211 (sign_extend:DI (plus:SI (mult:SI (match_dup 6) (match_dup 3))
3214 if (can_create_pseudo_p ())
3215 operands[5] = gen_reg_rtx (DImode);
3216 else if (reg_overlap_mentioned_p (operands[5], operands[4]))
3217 operands[5] = operands[0];
3219 operands[6] = gen_lowpart (SImode, operands[5]);
3222 (define_insn_and_split "*cmp_ssub_di"
3223 [(set (match_operand:DI 0 "register_operand" "=r")
3224 (minus:DI (if_then_else:DI
3225 (match_operator 1 "alpha_zero_comparison_operator"
3226 [(match_operand:DI 2 "reg_or_0_operand" "rJ")
3228 (match_operand:DI 3 "const48_operand" "I")
3230 (match_operand:DI 4 "reg_or_8bit_operand" "rI")))
3231 (clobber (match_scratch:DI 5 "=r"))]
3236 (match_op_dup:DI 1 [(match_dup 2) (const_int 0)]))
3238 (minus:DI (mult:DI (match_dup 5) (match_dup 3))
3241 if (can_create_pseudo_p ())
3242 operands[5] = gen_reg_rtx (DImode);
3243 else if (reg_overlap_mentioned_p (operands[5], operands[4]))
3244 operands[5] = operands[0];
3247 (define_insn_and_split "*cmp_ssub_si"
3248 [(set (match_operand:SI 0 "register_operand" "=r")
3249 (minus:SI (if_then_else:SI
3250 (match_operator 1 "alpha_zero_comparison_operator"
3251 [(match_operand:DI 2 "reg_or_0_operand" "rJ")
3253 (match_operand:SI 3 "const48_operand" "I")
3255 (match_operand:SI 4 "reg_or_8bit_operand" "rI")))
3256 (clobber (match_scratch:DI 5 "=r"))]
3261 (match_op_dup:DI 1 [(match_dup 2) (const_int 0)]))
3263 (minus:SI (mult:SI (match_dup 6) (match_dup 3))
3266 if (can_create_pseudo_p ())
3267 operands[5] = gen_reg_rtx (DImode);
3268 else if (reg_overlap_mentioned_p (operands[5], operands[4]))
3269 operands[5] = gen_lowpart (DImode, operands[0]);
3271 operands[6] = gen_lowpart (SImode, operands[5]);
3274 (define_insn_and_split "*cmp_ssub_sidi"
3275 [(set (match_operand:DI 0 "register_operand" "=r")
3277 (minus:SI (if_then_else:SI
3278 (match_operator 1 "alpha_zero_comparison_operator"
3279 [(match_operand:DI 2 "reg_or_0_operand" "rJ")
3281 (match_operand:SI 3 "const48_operand" "I")
3283 (match_operand:SI 4 "reg_or_8bit_operand" "rI"))))
3284 (clobber (match_scratch:DI 5 "=r"))]
3289 (match_op_dup:DI 1 [(match_dup 2) (const_int 0)]))
3291 (sign_extend:DI (minus:SI (mult:SI (match_dup 6) (match_dup 3))
3294 if (can_create_pseudo_p ())
3295 operands[5] = gen_reg_rtx (DImode);
3296 else if (reg_overlap_mentioned_p (operands[5], operands[4]))
3297 operands[5] = operands[0];
3299 operands[6] = gen_lowpart (SImode, operands[5]);
3302 ;; Here are the CALL and unconditional branch insns. Calls on NT and OSF
3303 ;; work differently, so we have different patterns for each.
3305 (define_expand "call"
3306 [(use (match_operand:DI 0))
3307 (use (match_operand 1))
3308 (use (match_operand 2))
3309 (use (match_operand 3))]
3312 if (TARGET_ABI_OPEN_VMS)
3313 emit_call_insn (gen_call_vms (operands[0], operands[2]));
3315 emit_call_insn (gen_call_osf (operands[0], operands[1]));
3319 (define_expand "sibcall"
3320 [(parallel [(call (mem:DI (match_operand 0))
3322 (unspec [(reg:DI 29)] UNSPEC_SIBCALL)])]
3325 gcc_assert (MEM_P (operands[0]));
3326 operands[0] = XEXP (operands[0], 0);
3329 (define_expand "call_osf"
3330 [(parallel [(call (mem:DI (match_operand 0))
3333 (clobber (reg:DI 26))])]
3336 gcc_assert (MEM_P (operands[0]));
3338 operands[0] = XEXP (operands[0], 0);
3339 if (! call_operand (operands[0], Pmode))
3340 operands[0] = copy_to_mode_reg (Pmode, operands[0]);
3344 ;; call openvms/alpha
3345 ;; op 0: symbol ref for called function
3346 ;; op 1: next_arg_reg (argument information value for R25)
3348 (define_expand "call_vms"
3349 [(parallel [(call (mem:DI (match_operand 0))
3354 (clobber (reg:DI 27))])]
3357 gcc_assert (MEM_P (operands[0]));
3359 operands[0] = XEXP (operands[0], 0);
3361 /* Always load AI with argument information, then handle symbolic and
3362 indirect call differently. Load RA and set operands[2] to PV in
3365 emit_move_insn (gen_rtx_REG (DImode, 25), operands[1]);
3366 if (GET_CODE (operands[0]) == SYMBOL_REF)
3368 operands[2] = const0_rtx;
3372 emit_move_insn (gen_rtx_REG (Pmode, 26),
3373 gen_rtx_MEM (Pmode, plus_constant (Pmode,
3375 operands[2] = operands[0];
3379 (define_expand "call_value"
3380 [(use (match_operand 0))
3381 (use (match_operand:DI 1))
3382 (use (match_operand 2))
3383 (use (match_operand 3))
3384 (use (match_operand 4))]
3387 if (TARGET_ABI_OPEN_VMS)
3388 emit_call_insn (gen_call_value_vms (operands[0], operands[1],
3391 emit_call_insn (gen_call_value_osf (operands[0], operands[1],
3396 (define_expand "sibcall_value"
3397 [(parallel [(set (match_operand 0)
3398 (call (mem:DI (match_operand 1))
3400 (unspec [(reg:DI 29)] UNSPEC_SIBCALL)])]
3403 gcc_assert (MEM_P (operands[1]));
3404 operands[1] = XEXP (operands[1], 0);
3407 (define_expand "call_value_osf"
3408 [(parallel [(set (match_operand 0)
3409 (call (mem:DI (match_operand 1))
3412 (clobber (reg:DI 26))])]
3415 gcc_assert (MEM_P (operands[1]));
3417 operands[1] = XEXP (operands[1], 0);
3418 if (! call_operand (operands[1], Pmode))
3419 operands[1] = copy_to_mode_reg (Pmode, operands[1]);
3422 (define_expand "call_value_vms"
3423 [(parallel [(set (match_operand 0)
3424 (call (mem:DI (match_operand:DI 1))
3429 (clobber (reg:DI 27))])]
3432 gcc_assert (MEM_P (operands[1]));
3434 operands[1] = XEXP (operands[1], 0);
3436 /* Always load AI with argument information, then handle symbolic and
3437 indirect call differently. Load RA and set operands[3] to PV in
3440 emit_move_insn (gen_rtx_REG (DImode, 25), operands[2]);
3441 if (GET_CODE (operands[1]) == SYMBOL_REF)
3443 operands[3] = const0_rtx;
3447 emit_move_insn (gen_rtx_REG (Pmode, 26),
3448 gen_rtx_MEM (Pmode, plus_constant (Pmode,
3450 operands[3] = operands[1];
3454 (define_insn "*call_osf_1_er_noreturn"
3455 [(call (mem:DI (match_operand:DI 0 "call_operand" "c,R,s"))
3458 (clobber (reg:DI 26))]
3459 "TARGET_EXPLICIT_RELOCS && TARGET_ABI_OSF
3460 && find_reg_note (insn, REG_NORETURN, NULL_RTX)"
3463 bsr $26,%0\t\t!samegp
3464 ldq $27,%0($29)\t\t!literal!%#\;jsr $26,($27),%0\t\t!lituse_jsr!%#"
3465 [(set_attr "type" "jsr")
3466 (set_attr "length" "*,*,8")])
3468 (define_insn "*call_osf_1_er"
3469 [(call (mem:DI (match_operand:DI 0 "call_operand" "c,R,s"))
3472 (clobber (reg:DI 26))]
3473 "TARGET_EXPLICIT_RELOCS && TARGET_ABI_OSF"
3475 jsr $26,(%0),0\;ldah $29,0($26)\t\t!gpdisp!%*\;lda $29,0($29)\t\t!gpdisp!%*
3476 bsr $26,%0\t\t!samegp
3477 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!%*"
3478 [(set_attr "type" "jsr")
3479 (set_attr "length" "12,*,16")])
3481 ;; We must use peep2 instead of a split because we need accurate life
3482 ;; information for $gp. Consider the case of { bar(); while (1); }.
3484 [(parallel [(call (mem:DI (match_operand:DI 0 "call_operand"))
3487 (clobber (reg:DI 26))])]
3488 "TARGET_EXPLICIT_RELOCS && TARGET_ABI_OSF && reload_completed
3489 && ! samegp_function_operand (operands[0], Pmode)
3490 && (peep2_regno_dead_p (1, 29)
3491 || find_reg_note (insn, REG_NORETURN, NULL_RTX))"
3492 [(parallel [(call (mem:DI (match_dup 2))
3497 (clobber (reg:DI 26))])]
3499 if (CONSTANT_P (operands[0]))
3501 operands[2] = gen_rtx_REG (Pmode, 27);
3502 operands[3] = GEN_INT (alpha_next_sequence_number++);
3503 emit_insn (gen_movdi_er_high_g (operands[2], pic_offset_table_rtx,
3504 operands[0], operands[3]));
3508 operands[2] = operands[0];
3509 operands[0] = const0_rtx;
3510 operands[3] = const0_rtx;
3515 [(parallel [(call (mem:DI (match_operand:DI 0 "call_operand"))
3518 (clobber (reg:DI 26))])]
3519 "TARGET_EXPLICIT_RELOCS && TARGET_ABI_OSF && reload_completed
3520 && ! samegp_function_operand (operands[0], Pmode)
3521 && ! (peep2_regno_dead_p (1, 29)
3522 || find_reg_note (insn, REG_NORETURN, NULL_RTX))"
3523 [(parallel [(call (mem:DI (match_dup 2))
3526 (unspec:DI [(match_dup 5) (match_dup 3)] UNSPEC_LDGP1))
3529 (clobber (reg:DI 26))])
3531 (unspec:DI [(match_dup 5) (match_dup 3)] UNSPEC_LDGP2))]
3533 if (CONSTANT_P (operands[0]))
3535 operands[2] = gen_rtx_REG (Pmode, 27);
3536 operands[4] = GEN_INT (alpha_next_sequence_number++);
3537 emit_insn (gen_movdi_er_high_g (operands[2], pic_offset_table_rtx,
3538 operands[0], operands[4]));
3542 operands[2] = operands[0];
3543 operands[0] = const0_rtx;
3544 operands[4] = const0_rtx;
3546 operands[3] = GEN_INT (alpha_next_sequence_number++);
3547 operands[5] = pic_offset_table_rtx;
3550 (define_insn "*call_osf_2_er_nogp"
3551 [(call (mem:DI (match_operand:DI 0 "register_operand" "c"))
3554 (use (match_operand 2))
3555 (use (match_operand 3 "const_int_operand"))
3556 (clobber (reg:DI 26))]
3557 "TARGET_EXPLICIT_RELOCS && TARGET_ABI_OSF"
3558 "jsr $26,(%0),%2%J3"
3559 [(set_attr "type" "jsr")])
3561 (define_insn "*call_osf_2_er"
3562 [(call (mem:DI (match_operand:DI 0 "register_operand" "c"))
3565 (unspec:DI [(reg:DI 29) (match_operand 4 "const_int_operand")]
3567 (use (match_operand 2))
3568 (use (match_operand 3 "const_int_operand"))
3569 (clobber (reg:DI 26))]
3570 "TARGET_EXPLICIT_RELOCS && TARGET_ABI_OSF"
3571 "jsr $26,(%0),%2%J3\;ldah $29,0($26)\t\t!gpdisp!%4"
3572 [(set_attr "type" "jsr")
3573 (set_attr "cannot_copy" "true")
3574 (set_attr "length" "8")])
3576 (define_insn "*call_osf_1_noreturn"
3577 [(call (mem:DI (match_operand:DI 0 "call_operand" "c,R,s"))
3580 (clobber (reg:DI 26))]
3581 "! TARGET_EXPLICIT_RELOCS && TARGET_ABI_OSF
3582 && find_reg_note (insn, REG_NORETURN, NULL_RTX)"
3587 [(set_attr "type" "jsr")
3588 (set_attr "length" "*,*,8")])
3590 (define_insn "*call_osf_1"
3591 [(call (mem:DI (match_operand:DI 0 "call_operand" "c,R,s"))
3594 (clobber (reg:DI 26))]
3595 "! TARGET_EXPLICIT_RELOCS && TARGET_ABI_OSF"
3597 jsr $26,($27),0\;ldgp $29,0($26)
3599 jsr $26,%0\;ldgp $29,0($26)"
3600 [(set_attr "type" "jsr")
3601 (set_attr "length" "12,*,16")])
3603 (define_insn "*sibcall_osf_1_er"
3604 [(call (mem:DI (match_operand:DI 0 "symbolic_operand" "R,s"))
3606 (unspec [(reg:DI 29)] UNSPEC_SIBCALL)]
3607 "TARGET_EXPLICIT_RELOCS && TARGET_ABI_OSF"
3609 br $31,%0\t\t!samegp
3610 ldq $27,%0($29)\t\t!literal!%#\;jmp $31,($27),%0\t\t!lituse_jsr!%#"
3611 [(set_attr "type" "jsr")
3612 (set_attr "length" "*,8")])
3614 ;; Note that the DEC assembler expands "jmp foo" with $at, which
3615 ;; doesn't do what we want.
3616 (define_insn "*sibcall_osf_1"
3617 [(call (mem:DI (match_operand:DI 0 "symbolic_operand" "R,s"))
3619 (unspec [(reg:DI 29)] UNSPEC_SIBCALL)]
3620 "! TARGET_EXPLICIT_RELOCS && TARGET_ABI_OSF"
3623 lda $27,%0\;jmp $31,($27),%0"
3624 [(set_attr "type" "jsr")
3625 (set_attr "length" "*,8")])
3627 ; GAS relies on the order and position of instructions output below in order
3628 ; to generate relocs for VMS link to potentially optimize the call.
3629 ; Please do not molest.
3630 (define_insn "*call_vms_1"
3631 [(call (mem:DI (match_operand:DI 0 "call_operand" "r,s"))
3633 (use (match_operand:DI 2 "nonmemory_operand" "r,n"))
3636 (clobber (reg:DI 27))]
3637 "TARGET_ABI_OPEN_VMS"
3639 switch (which_alternative)
3642 return "mov %2,$27\;jsr $26,0\;ldq $27,0($29)";
3644 operands [2] = alpha_use_linkage (operands [0], true, false);
3645 operands [3] = alpha_use_linkage (operands [0], false, false);
3646 return "ldq $26,%3\;ldq $27,%2\;jsr $26,%0\;ldq $27,0($29)";
3651 [(set_attr "type" "jsr")
3652 (set_attr "length" "12,16")])
3654 ;; Call subroutine returning any type.
3656 (define_expand "untyped_call"
3657 [(parallel [(call (match_operand 0)
3660 (match_operand 2)])]
3665 emit_call_insn (GEN_CALL (operands[0], const0_rtx, NULL, const0_rtx));
3667 for (i = 0; i < XVECLEN (operands[2], 0); i++)
3669 rtx set = XVECEXP (operands[2], 0, i);
3670 emit_move_insn (SET_DEST (set), SET_SRC (set));
3673 /* The optimizer does not know that the call sets the function value
3674 registers we stored in the result block. We avoid problems by
3675 claiming that all hard registers are used and clobbered at this
3677 emit_insn (gen_blockage ());
3682 ;; UNSPEC_VOLATILE is considered to use and clobber all hard registers and
3683 ;; all of memory. This blocks insns from being moved across this point.
3685 (define_insn "blockage"
3686 [(unspec_volatile [(const_int 0)] UNSPECV_BLOCKAGE)]
3689 [(set_attr "length" "0")
3690 (set_attr "type" "none")])
3694 (label_ref (match_operand 0)))]
3697 [(set_attr "type" "ibr")])
3699 (define_expand "return"
3703 (define_insn "*return_internal"
3707 [(set_attr "type" "ibr")])
3709 (define_insn "indirect_jump"
3710 [(set (pc) (match_operand:DI 0 "register_operand" "r"))]
3713 [(set_attr "type" "ibr")])
3715 (define_expand "tablejump"
3716 [(parallel [(set (pc)
3717 (match_operand 0 "register_operand"))
3718 (use (label_ref:DI (match_operand 1)))])]
3723 rtx dest = gen_reg_rtx (DImode);
3724 emit_insn (gen_extendsidi2 (dest, operands[0]));
3725 emit_insn (gen_adddi3 (dest, pic_offset_table_rtx, dest));
3730 (define_insn "*tablejump_internal"
3732 (match_operand:DI 0 "register_operand" "r"))
3733 (use (label_ref (match_operand 1)))]
3736 [(set_attr "type" "ibr")])
3738 ;; Cache flush. Used by alpha_trampoline_init. 0x86 is PAL_imb, but we don't
3739 ;; want to have to include pal.h in our .s file.
3741 [(unspec_volatile [(const_int 0)] UNSPECV_IMB)]
3744 [(set_attr "type" "callpal")])
3746 (define_expand "clear_cache"
3747 [(match_operand:DI 0) ; region start
3748 (match_operand:DI 1)] ; region end
3751 emit_insn (gen_imb ());
3755 ;; BUGCHK is documented common to OSF/1 and VMS PALcode.
3757 [(trap_if (const_int 1) (const_int 0))]
3760 [(set_attr "type" "callpal")])
3762 ;; For userland, we load the thread pointer from the TCB.
3763 ;; For the kernel, we load the per-cpu private value.
3765 (define_insn "get_thread_pointerdi"
3766 [(set (match_operand:DI 0 "register_operand" "=v")
3767 (unspec:DI [(const_int 0)] UNSPEC_TP))]
3770 if (TARGET_TLS_KERNEL)
3771 return "call_pal 0x32";
3773 return "call_pal 0x9e";
3775 [(set_attr "type" "callpal")])
3777 ;; For completeness, and possibly a __builtin function, here's how to
3778 ;; set the thread pointer. Since we don't describe enough of this
3779 ;; quantity for CSE, we have to use a volatile unspec, and then there's
3780 ;; not much point in creating an R16_REG register class.
3782 (define_expand "set_thread_pointerdi"
3783 [(set (reg:DI 16) (match_operand:DI 0 "input_operand"))
3784 (unspec_volatile [(reg:DI 16)] UNSPECV_SET_TP)]
3787 (define_insn "*set_tp"
3788 [(unspec_volatile [(reg:DI 16)] UNSPECV_SET_TP)]
3791 if (TARGET_TLS_KERNEL)
3792 return "call_pal 0x31";
3794 return "call_pal 0x9f";
3796 [(set_attr "type" "callpal")])
3798 ;; Special builtins for establishing and reverting VMS condition handlers.
3800 (define_expand "builtin_establish_vms_condition_handler"
3801 [(set (reg:DI 0) (match_operand:DI 0 "register_operand"))
3802 (use (match_operand:DI 1 "address_operand"))]
3803 "TARGET_ABI_OPEN_VMS"
3805 alpha_expand_builtin_establish_vms_condition_handler (operands[0],
3809 (define_expand "builtin_revert_vms_condition_handler"
3810 [(set (reg:DI 0) (match_operand:DI 0 "register_operand"))]
3811 "TARGET_ABI_OPEN_VMS"
3812 "alpha_expand_builtin_revert_vms_condition_handler (operands[0]);")
3814 ;; Finally, we have the basic data motion insns. The byte and word insns
3815 ;; are done via define_expand. Start with the floating-point insns, since
3816 ;; they are simpler.
3818 (define_expand "movsf"
3819 [(set (match_operand:SF 0 "nonimmediate_operand")
3820 (match_operand:SF 1 "general_operand"))]
3823 if (MEM_P (operands[0])
3824 && ! reg_or_0_operand (operands[1], SFmode))
3825 operands[1] = force_reg (SFmode, operands[1]);
3828 (define_insn "*movsf"
3829 [(set (match_operand:SF 0 "nonimmediate_operand" "=f,f,*r,*r,m,m,f,*r")
3830 (match_operand:SF 1 "input_operand" "fG,m,*rG,m,fG,*r,*r,f"))]
3831 "register_operand (operands[0], SFmode)
3832 || reg_or_0_operand (operands[1], SFmode)"
3842 [(set_attr "type" "fcpys,fld,ilog,ild,fst,ist,itof,ftoi")
3843 (set_attr "isa" "*,*,*,*,*,*,fix,fix")])
3845 (define_expand "movdf"
3846 [(set (match_operand:DF 0 "nonimmediate_operand")
3847 (match_operand:DF 1 "general_operand"))]
3850 if (MEM_P (operands[0])
3851 && ! reg_or_0_operand (operands[1], DFmode))
3852 operands[1] = force_reg (DFmode, operands[1]);
3855 (define_insn "*movdf"
3856 [(set (match_operand:DF 0 "nonimmediate_operand" "=f,f,*r,*r,m,m,f,*r")
3857 (match_operand:DF 1 "input_operand" "fG,m,*rG,m,fG,*r,*r,f"))]
3858 "register_operand (operands[0], DFmode)
3859 || reg_or_0_operand (operands[1], DFmode)"
3869 [(set_attr "type" "fcpys,fld,ilog,ild,fst,ist,itof,ftoi")
3870 (set_attr "isa" "*,*,*,*,*,*,fix,fix")])
3872 ;; Subregs suck for register allocation. Pretend we can move TFmode
3873 ;; data between general registers until after reload.
3874 ;; ??? Is this still true now that we have the lower-subreg pass?
3876 (define_expand "movtf"
3877 [(set (match_operand:TF 0 "nonimmediate_operand")
3878 (match_operand:TF 1 "general_operand"))]
3881 if (MEM_P (operands[0])
3882 && ! reg_or_0_operand (operands[1], TFmode))
3883 operands[1] = force_reg (TFmode, operands[1]);
3886 (define_insn_and_split "*movtf"
3887 [(set (match_operand:TF 0 "nonimmediate_operand" "=r,o")
3888 (match_operand:TF 1 "input_operand" "roG,rG"))]
3889 "register_operand (operands[0], TFmode)
3890 || reg_or_0_operand (operands[1], TFmode)"
3893 [(set (match_dup 0) (match_dup 2))
3894 (set (match_dup 1) (match_dup 3))]
3895 "alpha_split_tmode_pair (operands, TFmode, true);")
3897 ;; We do two major things here: handle mem->mem and construct long
3900 (define_expand "movsi"
3901 [(set (match_operand:SI 0 "nonimmediate_operand")
3902 (match_operand:SI 1 "general_operand"))]
3905 if (alpha_expand_mov (SImode, operands))
3909 (define_insn "*movsi"
3910 [(set (match_operand:SI 0 "nonimmediate_operand" "=r,r,r,r,r,m,r")
3911 (match_operand:SI 1 "input_operand" "rJ,K,L,n,m,rJ,s"))]
3912 "register_operand (operands[0], SImode)
3913 || reg_or_0_operand (operands[1], SImode)"
3922 [(set_attr "type" "ilog,iadd,iadd,multi,ild,ist,ldsym")
3923 (set_attr "isa" "*,*,*,*,*,*,vms")])
3925 ;; Split a load of a large constant into the appropriate two-insn
3929 [(set (match_operand:SI 0 "register_operand")
3930 (match_operand:SI 1 "non_add_const_operand"))]
3934 if (alpha_split_const_mov (SImode, operands))
3940 (define_insn "*movdi_er_low_l"
3941 [(set (match_operand:DI 0 "register_operand" "=r")
3942 (lo_sum:DI (match_operand:DI 1 "register_operand" "r")
3943 (match_operand:DI 2 "local_symbolic_operand")))]
3944 "TARGET_EXPLICIT_RELOCS"
3946 if (true_regnum (operands[1]) == 29)
3947 return "lda %0,%2(%1)\t\t!gprel";
3949 return "lda %0,%2(%1)\t\t!gprellow";
3951 [(set_attr "usegp" "yes")])
3954 [(set (match_operand:DI 0 "register_operand")
3955 (match_operand:DI 1 "small_symbolic_operand"))]
3956 "TARGET_EXPLICIT_RELOCS && reload_completed"
3958 (lo_sum:DI (match_dup 2) (match_dup 1)))]
3959 "operands[2] = pic_offset_table_rtx;")
3962 [(set (match_operand:DI 0 "register_operand")
3963 (match_operand:DI 1 "local_symbolic_operand"))]
3964 "TARGET_EXPLICIT_RELOCS && reload_completed"
3966 (plus:DI (match_dup 2) (high:DI (match_dup 1))))
3968 (lo_sum:DI (match_dup 0) (match_dup 1)))]
3969 "operands[2] = pic_offset_table_rtx;")
3972 [(match_operand 0 "some_small_symbolic_operand")]
3975 "operands[0] = split_small_symbolic_operand (operands[0]);")
3977 ;; Accepts any symbolic, not just global, since function calls that
3978 ;; don't go via bsr still use !literal in hopes of linker relaxation.
3979 (define_insn "movdi_er_high_g"
3980 [(set (match_operand:DI 0 "register_operand" "=r")
3981 (unspec:DI [(match_operand:DI 1 "register_operand" "r")
3982 (match_operand:DI 2 "symbolic_operand")
3983 (match_operand 3 "const_int_operand")]
3985 "TARGET_EXPLICIT_RELOCS"
3987 if (INTVAL (operands[3]) == 0)
3988 return "ldq %0,%2(%1)\t\t!literal";
3990 return "ldq %0,%2(%1)\t\t!literal!%3";
3992 [(set_attr "type" "ldsym")])
3995 [(set (match_operand:DI 0 "register_operand")
3996 (match_operand:DI 1 "global_symbolic_operand"))]
3997 "TARGET_EXPLICIT_RELOCS && reload_completed"
3999 (unspec:DI [(match_dup 2)
4001 (const_int 0)] UNSPEC_LITERAL))]
4002 "operands[2] = pic_offset_table_rtx;")
4004 (define_insn "movdi_er_tlsgd"
4005 [(set (match_operand:DI 0 "register_operand" "=r")
4006 (unspec:DI [(match_operand:DI 1 "register_operand" "r")
4007 (match_operand:DI 2 "symbolic_operand")
4008 (match_operand 3 "const_int_operand")]
4012 if (INTVAL (operands[3]) == 0)
4013 return "lda %0,%2(%1)\t\t!tlsgd";
4015 return "lda %0,%2(%1)\t\t!tlsgd!%3";
4018 (define_insn "movdi_er_tlsldm"
4019 [(set (match_operand:DI 0 "register_operand" "=r")
4020 (unspec:DI [(match_operand:DI 1 "register_operand" "r")
4021 (match_operand 2 "const_int_operand")]
4025 if (INTVAL (operands[2]) == 0)
4026 return "lda %0,%&(%1)\t\t!tlsldm";
4028 return "lda %0,%&(%1)\t\t!tlsldm!%2";
4031 (define_insn "*movdi_er_gotdtp"
4032 [(set (match_operand:DI 0 "register_operand" "=r")
4033 (unspec:DI [(match_operand:DI 1 "register_operand" "r")
4034 (match_operand:DI 2 "symbolic_operand")]
4037 "ldq %0,%2(%1)\t\t!gotdtprel"
4038 [(set_attr "type" "ild")
4039 (set_attr "usegp" "yes")])
4042 [(set (match_operand:DI 0 "register_operand")
4043 (match_operand:DI 1 "gotdtp_symbolic_operand"))]
4044 "HAVE_AS_TLS && reload_completed"
4046 (unspec:DI [(match_dup 2)
4047 (match_dup 1)] UNSPEC_DTPREL))]
4049 operands[1] = XVECEXP (XEXP (operands[1], 0), 0, 0);
4050 operands[2] = pic_offset_table_rtx;
4053 (define_insn "*movdi_er_gottp"
4054 [(set (match_operand:DI 0 "register_operand" "=r")
4055 (unspec:DI [(match_operand:DI 1 "register_operand" "r")
4056 (match_operand:DI 2 "symbolic_operand")]
4059 "ldq %0,%2(%1)\t\t!gottprel"
4060 [(set_attr "type" "ild")
4061 (set_attr "usegp" "yes")])
4064 [(set (match_operand:DI 0 "register_operand")
4065 (match_operand:DI 1 "gottp_symbolic_operand"))]
4066 "HAVE_AS_TLS && reload_completed"
4068 (unspec:DI [(match_dup 2)
4069 (match_dup 1)] UNSPEC_TPREL))]
4071 operands[1] = XVECEXP (XEXP (operands[1], 0), 0, 0);
4072 operands[2] = pic_offset_table_rtx;
4075 (define_insn "*movdi"
4076 [(set (match_operand:DI 0 "nonimmediate_operand"
4077 "=r,r,r,r,r,r,r,r, m, *f,*f, Q, r,*f")
4078 (match_operand:DI 1 "input_operand"
4079 "rJ,K,L,T,s,n,s,m,rJ,*fJ, Q,*f,*f, r"))]
4080 "register_operand (operands[0], DImode)
4081 || reg_or_0_operand (operands[1], DImode)"
4097 [(set_attr "type" "ilog,iadd,iadd,iadd,ldsym,multi,ldsym,ild,ist,fcpys,fld,fst,ftoi,itof")
4098 (set_attr "isa" "*,*,*,er,er,*,ner,*,*,*,*,*,fix,fix")
4099 (set_attr "usegp" "*,*,*,yes,*,*,*,*,*,*,*,*,*,*")])
4101 ;; VMS needs to set up "vms_base_regno" for unwinding. This move
4102 ;; often appears dead to the life analysis code, at which point we
4103 ;; die for emitting dead prologue instructions. Force this live.
4105 (define_insn "force_movdi"
4106 [(set (match_operand:DI 0 "register_operand" "=r")
4107 (unspec_volatile:DI [(match_operand:DI 1 "register_operand" "r")]
4108 UNSPECV_FORCE_MOV))]
4111 [(set_attr "type" "ilog")])
4113 ;; We do three major things here: handle mem->mem, put 64-bit constants in
4114 ;; memory, and construct long 32-bit constants.
4116 (define_expand "movdi"
4117 [(set (match_operand:DI 0 "nonimmediate_operand")
4118 (match_operand:DI 1 "general_operand"))]
4121 if (alpha_expand_mov (DImode, operands))
4125 ;; Split a load of a large constant into the appropriate two-insn
4129 [(set (match_operand:DI 0 "register_operand")
4130 (match_operand:DI 1 "non_add_const_operand"))]
4134 if (alpha_split_const_mov (DImode, operands))
4140 ;; We need to prevent reload from splitting TImode moves, because it
4141 ;; might decide to overwrite a pointer with the value it points to.
4142 ;; In that case we have to do the loads in the appropriate order so
4143 ;; that the pointer is not destroyed too early.
4145 (define_insn_and_split "*movti_internal"
4146 [(set (match_operand:TI 0 "nonimmediate_operand" "=r,o")
4147 (match_operand:TI 1 "input_operand" "roJ,rJ"))]
4148 "(register_operand (operands[0], TImode)
4149 /* Prevent rematerialization of constants. */
4150 && ! CONSTANT_P (operands[1]))
4151 || reg_or_0_operand (operands[1], TImode)"
4154 [(set (match_dup 0) (match_dup 2))
4155 (set (match_dup 1) (match_dup 3))]
4156 "alpha_split_tmode_pair (operands, TImode, true);")
4158 (define_expand "movti"
4159 [(set (match_operand:TI 0 "nonimmediate_operand")
4160 (match_operand:TI 1 "general_operand"))]
4163 if (MEM_P (operands[0])
4164 && ! reg_or_0_operand (operands[1], TImode))
4165 operands[1] = force_reg (TImode, operands[1]);
4167 if (operands[1] == const0_rtx)
4169 /* We must put 64-bit constants in memory. We could keep the
4170 32-bit constants in TImode and rely on the splitter, but
4171 this doesn't seem to be worth the pain. */
4172 else if (CONST_INT_P (operands[1])
4173 || GET_CODE (operands[1]) == CONST_DOUBLE)
4175 rtx in[2], out[2], target;
4177 gcc_assert (can_create_pseudo_p ());
4179 split_double (operands[1], &in[0], &in[1]);
4181 if (in[0] == const0_rtx)
4182 out[0] = const0_rtx;
4185 out[0] = gen_reg_rtx (DImode);
4186 emit_insn (gen_movdi (out[0], in[0]));
4189 if (in[1] == const0_rtx)
4190 out[1] = const0_rtx;
4193 out[1] = gen_reg_rtx (DImode);
4194 emit_insn (gen_movdi (out[1], in[1]));
4197 if (!REG_P (operands[0]))
4198 target = gen_reg_rtx (TImode);
4200 target = operands[0];
4202 emit_insn (gen_movdi (operand_subword (target, 0, 0, TImode), out[0]));
4203 emit_insn (gen_movdi (operand_subword (target, 1, 0, TImode), out[1]));
4205 if (target != operands[0])
4206 emit_insn (gen_rtx_SET (VOIDmode, operands[0], target));
4212 ;; These are the partial-word cases.
4214 ;; First we have the code to load an aligned word. Operand 0 is the register
4215 ;; in which to place the result. It's mode is QImode or HImode. Operand 1
4216 ;; is an SImode MEM at the low-order byte of the proper word. Operand 2 is the
4217 ;; number of bits within the word that the value is. Operand 3 is an SImode
4218 ;; scratch register. If operand 0 is a hard register, operand 3 may be the
4219 ;; same register. It is allowed to conflict with operand 1 as well.
4221 (define_expand "aligned_loadqi"
4222 [(set (match_operand:SI 3 "register_operand")
4223 (match_operand:SI 1 "memory_operand"))
4224 (set (match_operand:DI 0 "register_operand")
4225 (zero_extract:DI (subreg:DI (match_dup 3) 0)
4227 (match_operand:DI 2 "const_int_operand")))])
4229 (define_expand "aligned_loadhi"
4230 [(set (match_operand:SI 3 "register_operand")
4231 (match_operand:SI 1 "memory_operand"))
4232 (set (match_operand:DI 0 "register_operand")
4233 (zero_extract:DI (subreg:DI (match_dup 3) 0)
4235 (match_operand:DI 2 "const_int_operand")))])
4237 ;; Similar for unaligned loads, where we use the sequence from the
4238 ;; Alpha Architecture manual. We have to distinguish between little-endian
4239 ;; and big-endian systems as the sequences are different.
4241 ;; Operand 1 is the address. Operands 2 and 3 are temporaries, where
4242 ;; operand 3 can overlap the input and output registers.
4244 (define_expand "unaligned_loadqi"
4245 [(set (match_operand:DI 2 "register_operand")
4246 (mem:DI (and:DI (match_operand:DI 1 "address_operand")
4248 (set (match_operand:DI 3 "register_operand")
4250 (set (match_operand:DI 0 "register_operand")
4251 (zero_extract:DI (match_dup 2)
4253 (ashift:DI (match_dup 3) (const_int 3))))])
4255 (define_expand "unaligned_loadhi"
4256 [(set (match_operand:DI 2 "register_operand")
4257 (mem:DI (and:DI (match_operand:DI 1 "address_operand")
4259 (set (match_operand:DI 3 "register_operand")
4261 (set (match_operand:DI 0 "register_operand")
4262 (zero_extract:DI (match_dup 2)
4264 (ashift:DI (match_dup 3) (const_int 3))))])
4266 ;; Storing an aligned byte or word requires two temporaries. Operand 0 is the
4267 ;; aligned SImode MEM. Operand 1 is the register containing the
4268 ;; byte or word to store. Operand 2 is the number of bits within the word that
4269 ;; the value should be placed. Operands 3 and 4 are SImode temporaries.
4271 (define_expand "aligned_store"
4272 [(set (match_operand:SI 3 "register_operand")
4273 (match_operand:SI 0 "memory_operand"))
4274 (set (subreg:DI (match_dup 3) 0)
4275 (and:DI (subreg:DI (match_dup 3) 0) (match_dup 5)))
4276 (set (subreg:DI (match_operand:SI 4 "register_operand") 0)
4277 (ashift:DI (zero_extend:DI (match_operand 1 "register_operand"))
4278 (match_operand:DI 2 "const_int_operand")))
4279 (set (subreg:DI (match_dup 4) 0)
4280 (ior:DI (subreg:DI (match_dup 4) 0) (subreg:DI (match_dup 3) 0)))
4281 (set (match_dup 0) (match_dup 4))]
4284 operands[5] = GEN_INT (~ (GET_MODE_MASK (GET_MODE (operands[1]))
4285 << INTVAL (operands[2])));
4288 ;; For the unaligned byte and halfword cases, we use code similar to that
4289 ;; in the ;; Architecture book, but reordered to lower the number of registers
4290 ;; required. Operand 0 is the address. Operand 1 is the data to store.
4291 ;; Operands 2, 3, and 4 are DImode temporaries, where operands 2 and 4 may
4292 ;; be the same temporary, if desired. If the address is in a register,
4293 ;; operand 2 can be that register.
4295 (define_expand "unaligned_store<mode>"
4296 [(set (match_operand:DI 3 "register_operand")
4297 (mem:DI (and:DI (match_operand:DI 0 "address_operand")
4299 (set (match_operand:DI 2 "register_operand")
4302 (and:DI (not:DI (ashift:DI (match_dup 5)
4303 (ashift:DI (match_dup 2) (const_int 3))))
4305 (set (match_operand:DI 4 "register_operand")
4306 (ashift:DI (zero_extend:DI
4307 (match_operand:I12MODE 1 "register_operand"))
4308 (ashift:DI (match_dup 2) (const_int 3))))
4309 (set (match_dup 4) (ior:DI (match_dup 4) (match_dup 3)))
4310 (set (mem:DI (and:DI (match_dup 0) (const_int -8)))
4313 "operands[5] = GEN_INT (GET_MODE_MASK (<MODE>mode));")
4315 ;; Here are the define_expand's for QI and HI moves that use the above
4316 ;; patterns. We have the normal sets, plus the ones that need scratch
4317 ;; registers for reload.
4319 (define_expand "mov<mode>"
4320 [(set (match_operand:I12MODE 0 "nonimmediate_operand")
4321 (match_operand:I12MODE 1 "general_operand"))]
4325 ? alpha_expand_mov (<MODE>mode, operands)
4326 : alpha_expand_mov_nobwx (<MODE>mode, operands))
4330 (define_insn "*movqi"
4331 [(set (match_operand:QI 0 "nonimmediate_operand" "=r,r,r,m")
4332 (match_operand:QI 1 "input_operand" "rJ,n,m,rJ"))]
4333 "register_operand (operands[0], QImode)
4334 || reg_or_0_operand (operands[1], QImode)"
4340 [(set_attr "type" "ilog,iadd,ild,ist")
4341 (set_attr "isa" "*,*,bwx,bwx")])
4343 (define_insn "*movhi"
4344 [(set (match_operand:HI 0 "nonimmediate_operand" "=r,r,r,m")
4345 (match_operand:HI 1 "input_operand" "rJ,n,m,rJ"))]
4346 "register_operand (operands[0], HImode)
4347 || reg_or_0_operand (operands[1], HImode)"
4353 [(set_attr "type" "ilog,iadd,ild,ist")
4354 (set_attr "isa" "*,*,bwx,bwx")])
4356 ;; We need to hook into the extra support that we have for HImode
4357 ;; reloads when BWX insns are not available.
4358 (define_expand "movcqi"
4359 [(set (match_operand:CQI 0 "nonimmediate_operand")
4360 (match_operand:CQI 1 "general_operand"))]
4363 if (GET_CODE (operands[0]) == CONCAT || GET_CODE (operands[1]) == CONCAT)
4365 else if (!any_memory_operand (operands[0], CQImode))
4367 if (!any_memory_operand (operands[1], CQImode))
4369 emit_move_insn (gen_lowpart (HImode, operands[0]),
4370 gen_lowpart (HImode, operands[1]));
4373 if (aligned_memory_operand (operands[1], CQImode))
4377 operands[1] = gen_lowpart (HImode, operands[1]);
4379 operands[0] = gen_lowpart (HImode, operands[0]);
4380 done = alpha_expand_mov_nobwx (HImode, operands);
4385 else if (aligned_memory_operand (operands[0], CQImode))
4387 if (MEM_P (operands[1]))
4389 rtx x = gen_reg_rtx (HImode);
4390 emit_move_insn (gen_lowpart (CQImode, x), operands[1]);
4397 gcc_assert (!reload_in_progress);
4398 emit_move_complex_parts (operands[0], operands[1]);
4402 ;; Here are the versions for reload.
4404 ;; The aligned input case is recognized early in alpha_secondary_reload
4405 ;; in order to avoid allocating an unnecessary scratch register.
4407 ;; Note that in the unaligned cases we know that the operand must not be
4408 ;; a pseudo-register because stack slots are always aligned references.
4410 (define_expand "reload_in<mode>"
4411 [(parallel [(match_operand:RELOAD12 0 "register_operand" "=r")
4412 (match_operand:RELOAD12 1 "any_memory_operand" "m")
4413 (match_operand:TI 2 "register_operand" "=&r")])]
4416 rtx scratch, seq, addr;
4417 unsigned regno = REGNO (operands[2]);
4419 /* It is possible that one of the registers we got for operands[2]
4420 might coincide with that of operands[0] (which is why we made
4421 it TImode). Pick the other one to use as our scratch. */
4422 if (regno == REGNO (operands[0]))
4424 scratch = gen_rtx_REG (DImode, regno);
4426 addr = get_unaligned_address (operands[1]);
4427 operands[0] = gen_rtx_REG (DImode, REGNO (operands[0]));
4428 seq = gen_unaligned_load<reloadmode> (operands[0], addr,
4429 scratch, operands[0]);
4430 alpha_set_memflags (seq, operands[1]);
4436 (define_expand "reload_out<mode>"
4437 [(parallel [(match_operand:RELOAD12 0 "any_memory_operand" "=m")
4438 (match_operand:RELOAD12 1 "register_operand" "r")
4439 (match_operand:TI 2 "register_operand" "=&r")])]
4442 unsigned regno = REGNO (operands[2]);
4444 if (<MODE>mode == CQImode)
4446 operands[0] = gen_lowpart (HImode, operands[0]);
4447 operands[1] = gen_lowpart (HImode, operands[1]);
4450 if (aligned_memory_operand (operands[0], <MODE>mode))
4452 emit_insn (gen_reload_out<reloadmode>_aligned
4453 (operands[0], operands[1],
4454 gen_rtx_REG (SImode, regno),
4455 gen_rtx_REG (SImode, regno + 1)));
4459 rtx addr = get_unaligned_address (operands[0]);
4460 rtx scratch1 = gen_rtx_REG (DImode, regno);
4461 rtx scratch2 = gen_rtx_REG (DImode, regno + 1);
4462 rtx scratch3 = scratch1;
4468 seq = gen_unaligned_store<reloadmode> (addr, operands[1], scratch1,
4469 scratch2, scratch3);
4470 alpha_set_memflags (seq, operands[0]);
4476 ;; Helpers for the above. The way reload is structured, we can't
4477 ;; always get a proper address for a stack slot during reload_foo
4478 ;; expansion, so we must delay our address manipulations until after.
4480 (define_insn_and_split "reload_in<mode>_aligned"
4481 [(set (match_operand:I12MODE 0 "register_operand" "=r")
4482 (match_operand:I12MODE 1 "memory_operand" "m"))]
4483 "!TARGET_BWX && (reload_in_progress || reload_completed)"
4485 "!TARGET_BWX && reload_completed"
4488 rtx aligned_mem, bitnum;
4489 get_aligned_mem (operands[1], &aligned_mem, &bitnum);
4490 emit_insn (gen_aligned_load<reloadmode>
4491 (gen_lowpart (DImode, operands[0]), aligned_mem, bitnum,
4492 gen_rtx_REG (SImode, REGNO (operands[0]))));
4496 (define_insn_and_split "reload_out<mode>_aligned"
4497 [(set (match_operand:I12MODE 0 "memory_operand" "=m")
4498 (match_operand:I12MODE 1 "register_operand" "r"))
4499 (clobber (match_operand:SI 2 "register_operand" "=r"))
4500 (clobber (match_operand:SI 3 "register_operand" "=r"))]
4501 "!TARGET_BWX && (reload_in_progress || reload_completed)"
4503 "!TARGET_BWX && reload_completed"
4506 rtx aligned_mem, bitnum;
4507 get_aligned_mem (operands[0], &aligned_mem, &bitnum);
4508 emit_insn (gen_aligned_store (aligned_mem, operands[1], bitnum,
4509 operands[2], operands[3]));
4513 ;; Vector operations
4515 (define_mode_iterator VEC [V8QI V4HI V2SI])
4516 (define_mode_iterator VEC12 [V8QI V4HI])
4518 (define_expand "mov<mode>"
4519 [(set (match_operand:VEC 0 "nonimmediate_operand")
4520 (match_operand:VEC 1 "general_operand"))]
4523 if (alpha_expand_mov (<MODE>mode, operands))
4528 [(set (match_operand:VEC 0 "register_operand")
4529 (match_operand:VEC 1 "non_zero_const_operand"))]
4533 if (alpha_split_const_mov (<MODE>mode, operands))
4540 (define_expand "movmisalign<mode>"
4541 [(set (match_operand:VEC 0 "nonimmediate_operand")
4542 (match_operand:VEC 1 "general_operand"))]
4545 alpha_expand_movmisalign (<MODE>mode, operands);
4549 (define_insn "*mov<mode>_fix"
4550 [(set (match_operand:VEC 0 "nonimmediate_operand" "=r,r,r,m,*f,*f,m,r,*f")
4551 (match_operand:VEC 1 "input_operand" "rW,i,m,rW,*fW,m,*f,*f,r"))]
4552 "register_operand (operands[0], <MODE>mode)
4553 || reg_or_0_operand (operands[1], <MODE>mode)"
4564 [(set_attr "type" "ilog,multi,ild,ist,fcpys,fld,fst,ftoi,itof")
4565 (set_attr "isa" "*,*,*,*,*,*,*,fix,fix")])
4567 (define_insn "<code><mode>3"
4568 [(set (match_operand:VEC12 0 "register_operand" "=r")
4570 (match_operand:VEC12 1 "reg_or_0_operand" "rW")
4571 (match_operand:VEC12 2 "reg_or_0_operand" "rW")))]
4573 "<maxmin><modesuffix> %r1,%r2,%0"
4574 [(set_attr "type" "mvi")])
4576 (define_insn "one_cmpl<mode>2"
4577 [(set (match_operand:VEC 0 "register_operand" "=r")
4578 (not:VEC (match_operand:VEC 1 "register_operand" "r")))]
4581 [(set_attr "type" "ilog")])
4583 (define_insn "and<mode>3"
4584 [(set (match_operand:VEC 0 "register_operand" "=r")
4585 (and:VEC (match_operand:VEC 1 "register_operand" "r")
4586 (match_operand:VEC 2 "register_operand" "r")))]
4589 [(set_attr "type" "ilog")])
4591 (define_insn "*andnot<mode>3"
4592 [(set (match_operand:VEC 0 "register_operand" "=r")
4593 (and:VEC (not:VEC (match_operand:VEC 1 "register_operand" "r"))
4594 (match_operand:VEC 2 "register_operand" "r")))]
4597 [(set_attr "type" "ilog")])
4599 (define_insn "ior<mode>3"
4600 [(set (match_operand:VEC 0 "register_operand" "=r")
4601 (ior:VEC (match_operand:VEC 1 "register_operand" "r")
4602 (match_operand:VEC 2 "register_operand" "r")))]
4605 [(set_attr "type" "ilog")])
4607 (define_insn "*iornot<mode>3"
4608 [(set (match_operand:VEC 0 "register_operand" "=r")
4609 (ior:VEC (not:DI (match_operand:VEC 1 "register_operand" "r"))
4610 (match_operand:VEC 2 "register_operand" "r")))]
4613 [(set_attr "type" "ilog")])
4615 (define_insn "xor<mode>3"
4616 [(set (match_operand:VEC 0 "register_operand" "=r")
4617 (xor:VEC (match_operand:VEC 1 "register_operand" "r")
4618 (match_operand:VEC 2 "register_operand" "r")))]
4621 [(set_attr "type" "ilog")])
4623 (define_insn "*xornot<mode>3"
4624 [(set (match_operand:VEC 0 "register_operand" "=r")
4625 (not:VEC (xor:VEC (match_operand:VEC 1 "register_operand" "r")
4626 (match_operand:VEC 2 "register_operand" "r"))))]
4629 [(set_attr "type" "ilog")])
4631 (define_expand "vec_shl_<mode>"
4632 [(set (match_operand:VEC 0 "register_operand")
4633 (ashift:DI (match_operand:VEC 1 "register_operand")
4634 (match_operand:DI 2 "reg_or_6bit_operand")))]
4637 operands[0] = gen_lowpart (DImode, operands[0]);
4638 operands[1] = gen_lowpart (DImode, operands[1]);
4641 (define_expand "vec_shr_<mode>"
4642 [(set (match_operand:VEC 0 "register_operand")
4643 (lshiftrt:DI (match_operand:VEC 1 "register_operand")
4644 (match_operand:DI 2 "reg_or_6bit_operand")))]
4647 operands[0] = gen_lowpart (DImode, operands[0]);
4648 operands[1] = gen_lowpart (DImode, operands[1]);
4651 ;; Bit field extract patterns which use ext[wlq][lh]
4653 (define_expand "extvmisaligndi"
4654 [(set (match_operand:DI 0 "register_operand")
4655 (sign_extract:DI (match_operand:BLK 1 "memory_operand")
4656 (match_operand:DI 2 "const_int_operand")
4657 (match_operand:DI 3 "const_int_operand")))]
4660 /* We can do 16, 32 and 64 bit fields, if aligned on byte boundaries. */
4661 if (INTVAL (operands[3]) % 8 != 0
4662 || (INTVAL (operands[2]) != 16
4663 && INTVAL (operands[2]) != 32
4664 && INTVAL (operands[2]) != 64))
4667 alpha_expand_unaligned_load (operands[0], operands[1],
4668 INTVAL (operands[2]) / 8,
4669 INTVAL (operands[3]) / 8, 1);
4673 (define_expand "extzvdi"
4674 [(set (match_operand:DI 0 "register_operand")
4675 (zero_extract:DI (match_operand:DI 1 "register_operand")
4676 (match_operand:DI 2 "const_int_operand")
4677 (match_operand:DI 3 "const_int_operand")))]
4680 /* We can do 8, 16, 32 and 64 bit fields, if aligned on byte boundaries. */
4681 if (INTVAL (operands[3]) % 8 != 0
4682 || (INTVAL (operands[2]) != 8
4683 && INTVAL (operands[2]) != 16
4684 && INTVAL (operands[2]) != 32
4685 && INTVAL (operands[2]) != 64))
4689 (define_expand "extzvmisaligndi"
4690 [(set (match_operand:DI 0 "register_operand")
4691 (zero_extract:DI (match_operand:BLK 1 "memory_operand")
4692 (match_operand:DI 2 "const_int_operand")
4693 (match_operand:DI 3 "const_int_operand")))]
4696 /* We can do 16, 32 and 64 bit fields, if aligned on byte boundaries.
4697 We fail 8-bit fields, falling back on a simple byte load. */
4698 if (INTVAL (operands[3]) % 8 != 0
4699 || (INTVAL (operands[2]) != 16
4700 && INTVAL (operands[2]) != 32
4701 && INTVAL (operands[2]) != 64))
4704 alpha_expand_unaligned_load (operands[0], operands[1],
4705 INTVAL (operands[2]) / 8,
4706 INTVAL (operands[3]) / 8, 0);
4710 (define_expand "insvmisaligndi"
4711 [(set (zero_extract:DI (match_operand:BLK 0 "memory_operand")
4712 (match_operand:DI 1 "const_int_operand")
4713 (match_operand:DI 2 "const_int_operand"))
4714 (match_operand:DI 3 "register_operand"))]
4717 /* We can do 16, 32 and 64 bit fields, if aligned on byte boundaries. */
4718 if (INTVAL (operands[2]) % 8 != 0
4719 || (INTVAL (operands[1]) != 16
4720 && INTVAL (operands[1]) != 32
4721 && INTVAL (operands[1]) != 64))
4724 alpha_expand_unaligned_store (operands[0], operands[3],
4725 INTVAL (operands[1]) / 8,
4726 INTVAL (operands[2]) / 8);
4730 ;; Block move/clear, see alpha.c for more details.
4731 ;; Argument 0 is the destination
4732 ;; Argument 1 is the source
4733 ;; Argument 2 is the length
4734 ;; Argument 3 is the alignment
4736 (define_expand "movmemqi"
4737 [(parallel [(set (match_operand:BLK 0 "memory_operand")
4738 (match_operand:BLK 1 "memory_operand"))
4739 (use (match_operand:DI 2 "immediate_operand"))
4740 (use (match_operand:DI 3 "immediate_operand"))])]
4743 if (alpha_expand_block_move (operands))
4749 (define_expand "movmemdi"
4750 [(parallel [(set (match_operand:BLK 0 "memory_operand")
4751 (match_operand:BLK 1 "memory_operand"))
4752 (use (match_operand:DI 2 "immediate_operand"))
4753 (use (match_operand:DI 3 "immediate_operand"))
4755 (clobber (reg:DI 25))
4756 (clobber (reg:DI 16))
4757 (clobber (reg:DI 17))
4758 (clobber (reg:DI 18))
4759 (clobber (reg:DI 19))
4760 (clobber (reg:DI 20))
4761 (clobber (reg:DI 26))
4762 (clobber (reg:DI 27))])]
4763 "TARGET_ABI_OPEN_VMS"
4764 "operands[4] = gen_rtx_SYMBOL_REF (Pmode, \"OTS$MOVE\");")
4766 (define_insn "*movmemdi_1"
4767 [(set (match_operand:BLK 0 "memory_operand" "=m,m")
4768 (match_operand:BLK 1 "memory_operand" "m,m"))
4769 (use (match_operand:DI 2 "nonmemory_operand" "r,i"))
4770 (use (match_operand:DI 3 "immediate_operand"))
4771 (use (match_operand:DI 4 "call_operand" "i,i"))
4772 (clobber (reg:DI 25))
4773 (clobber (reg:DI 16))
4774 (clobber (reg:DI 17))
4775 (clobber (reg:DI 18))
4776 (clobber (reg:DI 19))
4777 (clobber (reg:DI 20))
4778 (clobber (reg:DI 26))
4779 (clobber (reg:DI 27))]
4780 "TARGET_ABI_OPEN_VMS"
4782 operands [5] = alpha_use_linkage (operands [4], false, true);
4783 switch (which_alternative)
4786 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)";
4788 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)";
4793 [(set_attr "type" "multi")
4794 (set_attr "length" "28")])
4796 (define_expand "setmemqi"
4797 [(parallel [(set (match_operand:BLK 0 "memory_operand")
4798 (match_operand 2 "const_int_operand"))
4799 (use (match_operand:DI 1 "immediate_operand"))
4800 (use (match_operand:DI 3 "immediate_operand"))])]
4803 /* If value to set is not zero, use the library routine. */
4804 if (operands[2] != const0_rtx)
4807 if (alpha_expand_block_clear (operands))
4813 (define_expand "setmemdi"
4814 [(parallel [(set (match_operand:BLK 0 "memory_operand")
4815 (match_operand 2 "const_int_operand"))
4816 (use (match_operand:DI 1 "immediate_operand"))
4817 (use (match_operand:DI 3 "immediate_operand"))
4819 (clobber (reg:DI 25))
4820 (clobber (reg:DI 16))
4821 (clobber (reg:DI 17))
4822 (clobber (reg:DI 26))
4823 (clobber (reg:DI 27))])]
4824 "TARGET_ABI_OPEN_VMS"
4826 /* If value to set is not zero, use the library routine. */
4827 if (operands[2] != const0_rtx)
4830 operands[4] = gen_rtx_SYMBOL_REF (Pmode, "OTS$ZERO");
4833 (define_insn "*clrmemdi_1"
4834 [(set (match_operand:BLK 0 "memory_operand" "=m,m")
4836 (use (match_operand:DI 1 "nonmemory_operand" "r,i"))
4837 (use (match_operand:DI 2 "immediate_operand"))
4838 (use (match_operand:DI 3 "call_operand" "i,i"))
4839 (clobber (reg:DI 25))
4840 (clobber (reg:DI 16))
4841 (clobber (reg:DI 17))
4842 (clobber (reg:DI 26))
4843 (clobber (reg:DI 27))]
4844 "TARGET_ABI_OPEN_VMS"
4846 operands [4] = alpha_use_linkage (operands [3], false, true);
4847 switch (which_alternative)
4850 return "lda $16,%0\;bis $31,%1,$17\;ldq $26,%4\;lda $25,2($31)\;jsr $26,%3\;ldq $27,0($29)";
4852 return "lda $16,%0\;lda $17,%1($31)\;ldq $26,%4\;lda $25,2($31)\;jsr $26,%3\;ldq $27,0($29)";
4857 [(set_attr "type" "multi")
4858 (set_attr "length" "24")])
4861 ;; Subroutine of stack space allocation. Perform a stack probe.
4862 (define_expand "probe_stack"
4863 [(set (match_dup 1) (match_operand:DI 0 "const_int_operand"))]
4866 operands[1] = gen_rtx_MEM (DImode, plus_constant (Pmode, stack_pointer_rtx,
4867 INTVAL (operands[0])));
4868 MEM_VOLATILE_P (operands[1]) = 1;
4870 operands[0] = const0_rtx;
4873 ;; This is how we allocate stack space. If we are allocating a
4874 ;; constant amount of space and we know it is less than 4096
4875 ;; bytes, we need do nothing.
4877 ;; If it is more than 4096 bytes, we need to probe the stack
4879 (define_expand "allocate_stack"
4881 (plus:DI (reg:DI 30)
4882 (match_operand:DI 1 "reg_or_cint_operand")))
4883 (set (match_operand:DI 0 "register_operand" "=r")
4887 if (CONST_INT_P (operands[1])
4888 && INTVAL (operands[1]) < 32768)
4890 if (INTVAL (operands[1]) >= 4096)
4892 /* We do this the same way as in the prologue and generate explicit
4893 probes. Then we update the stack by the constant. */
4897 emit_insn (gen_probe_stack (GEN_INT (- probed)));
4898 while (probed + 8192 < INTVAL (operands[1]))
4899 emit_insn (gen_probe_stack (GEN_INT (- (probed += 8192))));
4901 if (probed + 4096 < INTVAL (operands[1]))
4902 emit_insn (gen_probe_stack (GEN_INT (- INTVAL(operands[1]))));
4905 operands[1] = GEN_INT (- INTVAL (operands[1]));
4906 operands[2] = virtual_stack_dynamic_rtx;
4910 rtx_code_label *out_label = 0;
4911 rtx_code_label *loop_label = gen_label_rtx ();
4912 rtx want = gen_reg_rtx (Pmode);
4913 rtx tmp = gen_reg_rtx (Pmode);
4916 emit_insn (gen_subdi3 (want, stack_pointer_rtx,
4917 force_reg (Pmode, operands[1])));
4919 if (!CONST_INT_P (operands[1]))
4921 rtx limit = GEN_INT (4096);
4922 out_label = gen_label_rtx ();
4923 test = gen_rtx_LTU (VOIDmode, operands[1], limit);
4925 (gen_cbranchdi4 (test, operands[1], limit, out_label));
4928 emit_insn (gen_adddi3 (tmp, stack_pointer_rtx, GEN_INT (-4096)));
4929 emit_label (loop_label);
4930 memref = gen_rtx_MEM (DImode, tmp);
4931 MEM_VOLATILE_P (memref) = 1;
4932 emit_move_insn (memref, const0_rtx);
4933 emit_insn (gen_adddi3 (tmp, tmp, GEN_INT(-8192)));
4934 test = gen_rtx_GTU (VOIDmode, tmp, want);
4935 emit_jump_insn (gen_cbranchdi4 (test, tmp, want, loop_label));
4937 memref = gen_rtx_MEM (DImode, want);
4938 MEM_VOLATILE_P (memref) = 1;
4939 emit_move_insn (memref, const0_rtx);
4942 emit_label (out_label);
4944 emit_move_insn (stack_pointer_rtx, want);
4945 emit_move_insn (operands[0], virtual_stack_dynamic_rtx);
4950 ;; This is used by alpha_expand_prolog to do the same thing as above,
4951 ;; except we cannot at that time generate new basic blocks, so we hide
4952 ;; the loop in this one insn.
4954 (define_insn "prologue_stack_probe_loop"
4955 [(unspec_volatile [(match_operand:DI 0 "register_operand" "r")
4956 (match_operand:DI 1 "register_operand" "r")]
4960 operands[2] = gen_label_rtx ();
4961 (*targetm.asm_out.internal_label) (asm_out_file, "L",
4962 CODE_LABEL_NUMBER (operands[2]));
4964 return "stq $31,-8192(%1)\;subq %0,1,%0\;lda %1,-8192(%1)\;bne %0,%l2";
4966 [(set_attr "length" "16")
4967 (set_attr "type" "multi")])
4969 (define_expand "prologue"
4973 alpha_expand_prologue ();
4977 ;; These take care of emitting the ldgp insn in the prologue. This will be
4978 ;; an lda/ldah pair and we want to align them properly. So we have two
4979 ;; unspec_volatile insns, the first of which emits the ldgp assembler macro
4980 ;; and the second of which emits nothing. However, both are marked as type
4981 ;; IADD (the default) so the alignment code in alpha.c does the right thing
4984 (define_expand "prologue_ldgp"
4986 (unspec_volatile:DI [(match_dup 1) (match_dup 2)] UNSPECV_LDGP1))
4988 (unspec_volatile:DI [(match_dup 0) (match_dup 2)] UNSPECV_PLDGP2))]
4991 operands[0] = pic_offset_table_rtx;
4992 operands[1] = gen_rtx_REG (Pmode, 27);
4993 operands[2] = (TARGET_EXPLICIT_RELOCS
4994 ? GEN_INT (alpha_next_sequence_number++)
4998 (define_insn "*ldgp_er_1"
4999 [(set (match_operand:DI 0 "register_operand" "=r")
5000 (unspec_volatile:DI [(match_operand:DI 1 "register_operand" "r")
5001 (match_operand 2 "const_int_operand")]
5003 "TARGET_EXPLICIT_RELOCS && TARGET_ABI_OSF"
5004 "ldah %0,0(%1)\t\t!gpdisp!%2"
5005 [(set_attr "cannot_copy" "true")])
5007 (define_insn "*ldgp_er_2"
5008 [(set (match_operand:DI 0 "register_operand" "=r")
5009 (unspec:DI [(match_operand:DI 1 "register_operand" "r")
5010 (match_operand 2 "const_int_operand")]
5012 "TARGET_EXPLICIT_RELOCS && TARGET_ABI_OSF"
5013 "lda %0,0(%1)\t\t!gpdisp!%2"
5014 [(set_attr "cannot_copy" "true")])
5016 (define_insn "*prologue_ldgp_er_2"
5017 [(set (match_operand:DI 0 "register_operand" "=r")
5018 (unspec_volatile:DI [(match_operand:DI 1 "register_operand" "r")
5019 (match_operand 2 "const_int_operand")]
5021 "TARGET_EXPLICIT_RELOCS && TARGET_ABI_OSF"
5022 "lda %0,0(%1)\t\t!gpdisp!%2\n$%~..ng:"
5023 [(set_attr "cannot_copy" "true")])
5025 (define_insn "*prologue_ldgp_1"
5026 [(set (match_operand:DI 0 "register_operand" "=r")
5027 (unspec_volatile:DI [(match_operand:DI 1 "register_operand" "r")
5028 (match_operand 2 "const_int_operand")]
5031 "ldgp %0,0(%1)\n$%~..ng:"
5032 [(set_attr "cannot_copy" "true")])
5034 (define_insn "*prologue_ldgp_2"
5035 [(set (match_operand:DI 0 "register_operand" "=r")
5036 (unspec_volatile:DI [(match_operand:DI 1 "register_operand" "r")
5037 (match_operand 2 "const_int_operand")]
5042 ;; The _mcount profiling hook has special calling conventions, and
5043 ;; does not clobber all the registers that a normal call would. So
5044 ;; hide the fact this is a call at all.
5046 (define_insn "prologue_mcount"
5047 [(unspec_volatile [(const_int 0)] UNSPECV_MCOUNT)]
5050 if (TARGET_EXPLICIT_RELOCS)
5051 /* Note that we cannot use a lituse_jsr reloc, since _mcount
5052 cannot be called via the PLT. */
5053 return "ldq $28,_mcount($29)\t\t!literal\;jsr $28,($28),_mcount";
5055 return "lda $28,_mcount\;jsr $28,($28),_mcount";
5057 [(set_attr "type" "multi")
5058 (set_attr "length" "8")])
5060 (define_insn "init_fp"
5061 [(set (match_operand:DI 0 "register_operand" "=r")
5062 (match_operand:DI 1 "register_operand" "r"))
5063 (clobber (mem:BLK (match_operand:DI 2 "register_operand" "=r")))]
5067 (define_expand "epilogue"
5070 "alpha_expand_epilogue ();")
5072 (define_expand "sibcall_epilogue"
5076 alpha_expand_epilogue ();
5080 (define_expand "builtin_longjmp"
5081 [(use (match_operand:DI 0 "register_operand" "r"))]
5084 /* The elements of the buffer are, in order: */
5085 rtx fp = gen_rtx_MEM (Pmode, operands[0]);
5086 rtx lab = gen_rtx_MEM (Pmode, plus_constant (Pmode, operands[0], 8));
5087 rtx stack = gen_rtx_MEM (Pmode, plus_constant (Pmode, operands[0], 16));
5088 rtx pv = gen_rtx_REG (Pmode, 27);
5090 /* This bit is the same as expand_builtin_longjmp. */
5091 emit_move_insn (hard_frame_pointer_rtx, fp);
5092 emit_move_insn (pv, lab);
5093 emit_stack_restore (SAVE_NONLOCAL, stack);
5094 emit_use (hard_frame_pointer_rtx);
5095 emit_use (stack_pointer_rtx);
5097 /* Load the label we are jumping through into $27 so that we know
5098 where to look for it when we get back to setjmp's function for
5099 restoring the gp. */
5100 emit_jump_insn (gen_builtin_longjmp_internal (pv));
5105 ;; This is effectively a copy of indirect_jump, but constrained such
5106 ;; that register renaming cannot foil our cunning plan with $27.
5107 (define_insn "builtin_longjmp_internal"
5109 (unspec_volatile [(match_operand:DI 0 "register_operand" "c")]
5113 [(set_attr "type" "ibr")])
5115 (define_expand "builtin_setjmp_receiver"
5116 [(unspec_volatile [(label_ref (match_operand 0))] UNSPECV_SETJMPR)]
5119 (define_insn_and_split "*builtin_setjmp_receiver_1"
5120 [(unspec_volatile [(match_operand 0)] UNSPECV_SETJMPR)]
5123 if (TARGET_EXPLICIT_RELOCS)
5126 return "br $27,$LSJ%=\n$LSJ%=:\;ldgp $29,0($27)";
5128 "&& TARGET_EXPLICIT_RELOCS && reload_completed"
5130 (unspec_volatile:DI [(match_dup 2) (match_dup 3)] UNSPECV_LDGP1))
5132 (unspec:DI [(match_dup 1) (match_dup 3)] UNSPEC_LDGP2))]
5134 if (prev_nonnote_insn (curr_insn) != XEXP (operands[0], 0))
5135 emit_insn (gen_rtx_UNSPEC_VOLATILE (VOIDmode, gen_rtvec (1, operands[0]),
5136 UNSPECV_SETJMPR_ER));
5137 operands[1] = pic_offset_table_rtx;
5138 operands[2] = gen_rtx_REG (Pmode, 27);
5139 operands[3] = GEN_INT (alpha_next_sequence_number++);
5141 [(set_attr "length" "12")
5142 (set_attr "type" "multi")])
5144 (define_insn "*builtin_setjmp_receiver_er_sl_1"
5145 [(unspec_volatile [(match_operand 0)] UNSPECV_SETJMPR_ER)]
5146 "TARGET_ABI_OSF && TARGET_EXPLICIT_RELOCS"
5147 "lda $27,$LSJ%=-%l0($27)\n$LSJ%=:")
5149 ;; When flag_reorder_blocks_and_partition is in effect, compiler puts
5150 ;; exception landing pads in a cold section. To prevent inter-section offset
5151 ;; calculation, a jump to original landing pad is emitted in the place of the
5152 ;; original landing pad. Since landing pad is moved, RA-relative GP
5153 ;; calculation in the prologue of landing pad breaks. To solve this problem,
5154 ;; we use alternative GP load approach.
5156 (define_expand "exception_receiver"
5157 [(unspec_volatile [(match_dup 0)] UNSPECV_EHR)]
5160 if (flag_reorder_blocks_and_partition)
5161 operands[0] = alpha_gp_save_rtx ();
5163 operands[0] = const0_rtx;
5166 (define_insn "*exception_receiver_2"
5167 [(unspec_volatile [(match_operand:DI 0 "memory_operand" "m")] UNSPECV_EHR)]
5168 "TARGET_ABI_OSF && flag_reorder_blocks_and_partition"
5170 [(set_attr "type" "ild")])
5172 (define_insn_and_split "*exception_receiver_1"
5173 [(unspec_volatile [(const_int 0)] UNSPECV_EHR)]
5176 if (TARGET_EXPLICIT_RELOCS)
5177 return "ldah $29,0($26)\t\t!gpdisp!%*\;lda $29,0($29)\t\t!gpdisp!%*";
5179 return "ldgp $29,0($26)";
5181 "&& TARGET_EXPLICIT_RELOCS && reload_completed"
5183 (unspec_volatile:DI [(match_dup 1) (match_dup 2)] UNSPECV_LDGP1))
5185 (unspec:DI [(match_dup 0) (match_dup 2)] UNSPEC_LDGP2))]
5187 operands[0] = pic_offset_table_rtx;
5188 operands[1] = gen_rtx_REG (Pmode, 26);
5189 operands[2] = GEN_INT (alpha_next_sequence_number++);
5191 [(set_attr "length" "8")
5192 (set_attr "type" "multi")])
5194 (define_expand "nonlocal_goto_receiver"
5195 [(unspec_volatile [(const_int 0)] UNSPECV_BLOCKAGE)
5196 (set (reg:DI 27) (mem:DI (reg:DI 29)))
5197 (unspec_volatile [(const_int 0)] UNSPECV_BLOCKAGE)
5199 "TARGET_ABI_OPEN_VMS")
5201 (define_insn "arg_home"
5202 [(unspec [(const_int 0)] UNSPEC_ARG_HOME)
5217 (clobber (mem:BLK (const_int 0)))
5218 (clobber (reg:DI 24))
5219 (clobber (reg:DI 25))
5220 (clobber (reg:DI 0))]
5221 "TARGET_ABI_OPEN_VMS"
5222 "lda $0,OTS$HOME_ARGS\;ldq $0,8($0)\;jsr $0,OTS$HOME_ARGS"
5223 [(set_attr "length" "16")
5224 (set_attr "type" "multi")])
5228 ;; On EV4, these instructions are nops -- no load occurs.
5230 ;; On EV5, these instructions act as a normal load, and thus can trap
5231 ;; if the address is invalid. The OS may (or may not) handle this in
5232 ;; the entMM fault handler and suppress the fault. If so, then this
5233 ;; has the effect of a read prefetch instruction.
5235 ;; On EV6, these become official prefetch instructions.
5237 (define_insn "prefetch"
5238 [(prefetch (match_operand:DI 0 "address_operand" "p")
5239 (match_operand:DI 1 "const_int_operand" "n")
5240 (match_operand:DI 2 "const_int_operand" "n"))]
5241 "TARGET_FIXUP_EV5_PREFETCH || alpha_cpu == PROCESSOR_EV6"
5243 /* Interpret "no temporal locality" as this data should be evicted once
5244 it is used. The "evict next" alternatives load the data into the cache
5245 and leave the LRU eviction counter pointing to that block. */
5246 static const char * const alt[2][2] = {
5248 "ldq $31,%a0", /* read, evict next */
5249 "ldl $31,%a0", /* read, evict last */
5252 "ldt $f31,%a0", /* write, evict next */
5253 "lds $f31,%a0", /* write, evict last */
5257 bool write = INTVAL (operands[1]) != 0;
5258 bool lru = INTVAL (operands[2]) != 0;
5260 return alt[write][lru];
5262 [(set_attr "type" "ild")])
5264 ;; Close the trap shadow of preceding instructions. This is generated
5267 (define_insn "trapb"
5268 [(unspec_volatile [(const_int 0)] UNSPECV_TRAPB)]
5271 [(set_attr "type" "misc")])
5273 ;; No-op instructions used by machine-dependent reorg to preserve
5274 ;; alignment for instruction issue.
5275 ;; The Unicos/Mk assembler does not support these opcodes.
5281 [(set_attr "type" "ilog")])
5286 "cpys $f31,$f31,$f31"
5287 [(set_attr "type" "fcpys")])
5294 (define_insn "realign"
5295 [(unspec_volatile [(match_operand 0 "immediate_operand" "i")]
5298 ".align %0 #realign")
5300 ;; Instructions to be emitted from __builtins.
5302 (define_insn "builtin_cmpbge"
5303 [(set (match_operand:DI 0 "register_operand" "=r")
5304 (unspec:DI [(match_operand:DI 1 "reg_or_0_operand" "rJ")
5305 (match_operand:DI 2 "reg_or_8bit_operand" "rI")]
5309 ;; The EV6 data sheets list this as ILOG. OTOH, EV6 doesn't
5310 ;; actually differentiate between ILOG and ICMP in the schedule.
5311 [(set_attr "type" "icmp")])
5313 (define_expand "extbl"
5314 [(match_operand:DI 0 "register_operand")
5315 (match_operand:DI 1 "reg_or_0_operand")
5316 (match_operand:DI 2 "reg_or_8bit_operand")]
5319 emit_insn (gen_extxl (operands[0], operands[1], GEN_INT (8), operands[2]));
5323 (define_expand "extwl"
5324 [(match_operand:DI 0 "register_operand")
5325 (match_operand:DI 1 "reg_or_0_operand")
5326 (match_operand:DI 2 "reg_or_8bit_operand")]
5329 emit_insn (gen_extxl (operands[0], operands[1], GEN_INT (16), operands[2]));
5333 (define_expand "extll"
5334 [(match_operand:DI 0 "register_operand")
5335 (match_operand:DI 1 "reg_or_0_operand")
5336 (match_operand:DI 2 "reg_or_8bit_operand")]
5339 emit_insn (gen_extxl (operands[0], operands[1], GEN_INT (32), operands[2]));
5343 (define_expand "extql"
5344 [(match_operand:DI 0 "register_operand")
5345 (match_operand:DI 1 "reg_or_0_operand")
5346 (match_operand:DI 2 "reg_or_8bit_operand")]
5349 emit_insn (gen_extxl (operands[0], operands[1], GEN_INT (64), operands[2]));
5353 (define_expand "builtin_insbl"
5354 [(match_operand:DI 0 "register_operand")
5355 (match_operand:DI 1 "register_operand")
5356 (match_operand:DI 2 "reg_or_8bit_operand")]
5359 operands[1] = gen_lowpart (QImode, operands[1]);
5360 emit_insn (gen_insbl (operands[0], operands[1], operands[2]));
5364 (define_expand "builtin_inswl"
5365 [(match_operand:DI 0 "register_operand")
5366 (match_operand:DI 1 "register_operand")
5367 (match_operand:DI 2 "reg_or_8bit_operand")]
5370 operands[1] = gen_lowpart (HImode, operands[1]);
5371 emit_insn (gen_inswl (operands[0], operands[1], operands[2]));
5375 (define_expand "builtin_insll"
5376 [(match_operand:DI 0 "register_operand")
5377 (match_operand:DI 1 "register_operand")
5378 (match_operand:DI 2 "reg_or_8bit_operand")]
5381 operands[1] = gen_lowpart (SImode, operands[1]);
5382 emit_insn (gen_insll (operands[0], operands[1], operands[2]));
5386 (define_expand "inswh"
5387 [(match_operand:DI 0 "register_operand")
5388 (match_operand:DI 1 "register_operand")
5389 (match_operand:DI 2 "reg_or_8bit_operand")]
5392 emit_insn (gen_insxh (operands[0], operands[1], GEN_INT (16), operands[2]));
5396 (define_expand "inslh"
5397 [(match_operand:DI 0 "register_operand")
5398 (match_operand:DI 1 "register_operand")
5399 (match_operand:DI 2 "reg_or_8bit_operand")]
5402 emit_insn (gen_insxh (operands[0], operands[1], GEN_INT (32), operands[2]));
5406 (define_expand "insqh"
5407 [(match_operand:DI 0 "register_operand")
5408 (match_operand:DI 1 "register_operand")
5409 (match_operand:DI 2 "reg_or_8bit_operand")]
5412 emit_insn (gen_insxh (operands[0], operands[1], GEN_INT (64), operands[2]));
5416 (define_expand "mskbl"
5417 [(match_operand:DI 0 "register_operand")
5418 (match_operand:DI 1 "reg_or_0_operand")
5419 (match_operand:DI 2 "reg_or_8bit_operand")]
5422 rtx mask = GEN_INT (0xff);
5423 emit_insn (gen_mskxl (operands[0], operands[1], mask, operands[2]));
5427 (define_expand "mskwl"
5428 [(match_operand:DI 0 "register_operand")
5429 (match_operand:DI 1 "reg_or_0_operand")
5430 (match_operand:DI 2 "reg_or_8bit_operand")]
5433 rtx mask = GEN_INT (0xffff);
5434 emit_insn (gen_mskxl (operands[0], operands[1], mask, operands[2]));
5438 (define_expand "mskll"
5439 [(match_operand:DI 0 "register_operand")
5440 (match_operand:DI 1 "reg_or_0_operand")
5441 (match_operand:DI 2 "reg_or_8bit_operand")]
5444 rtx mask = immed_double_const (0xffffffff, 0, DImode);
5445 emit_insn (gen_mskxl (operands[0], operands[1], mask, operands[2]));
5449 (define_expand "mskql"
5450 [(match_operand:DI 0 "register_operand")
5451 (match_operand:DI 1 "reg_or_0_operand")
5452 (match_operand:DI 2 "reg_or_8bit_operand")]
5455 rtx mask = constm1_rtx;
5456 emit_insn (gen_mskxl (operands[0], operands[1], mask, operands[2]));
5460 (define_expand "mskwh"
5461 [(match_operand:DI 0 "register_operand")
5462 (match_operand:DI 1 "register_operand")
5463 (match_operand:DI 2 "reg_or_8bit_operand")]
5466 emit_insn (gen_mskxh (operands[0], operands[1], GEN_INT (16), operands[2]));
5470 (define_expand "msklh"
5471 [(match_operand:DI 0 "register_operand")
5472 (match_operand:DI 1 "register_operand")
5473 (match_operand:DI 2 "reg_or_8bit_operand")]
5476 emit_insn (gen_mskxh (operands[0], operands[1], GEN_INT (32), operands[2]));
5480 (define_expand "mskqh"
5481 [(match_operand:DI 0 "register_operand")
5482 (match_operand:DI 1 "register_operand")
5483 (match_operand:DI 2 "reg_or_8bit_operand")]
5486 emit_insn (gen_mskxh (operands[0], operands[1], GEN_INT (64), operands[2]));
5490 (define_expand "builtin_zap"
5491 [(set (match_operand:DI 0 "register_operand")
5493 [(match_operand:DI 2 "reg_or_cint_operand")]
5495 (match_operand:DI 1 "reg_or_cint_operand")))]
5498 if (CONST_INT_P (operands[2]))
5500 rtx mask = alpha_expand_zap_mask (INTVAL (operands[2]));
5502 if (mask == const0_rtx)
5504 emit_move_insn (operands[0], const0_rtx);
5507 if (mask == constm1_rtx)
5509 emit_move_insn (operands[0], operands[1]);
5513 operands[1] = force_reg (DImode, operands[1]);
5514 emit_insn (gen_anddi3 (operands[0], operands[1], mask));
5518 operands[1] = force_reg (DImode, operands[1]);
5519 operands[2] = gen_lowpart (QImode, operands[2]);
5522 (define_insn "*builtin_zap_1"
5523 [(set (match_operand:DI 0 "register_operand" "=r,r,r,r")
5525 [(match_operand:QI 2 "reg_or_cint_operand" "n,n,r,r")]
5527 (match_operand:DI 1 "reg_or_cint_operand" "n,r,J,r")))]
5534 [(set_attr "type" "shift,shift,ilog,shift")])
5537 [(set (match_operand:DI 0 "register_operand")
5539 [(match_operand:QI 2 "const_int_operand")]
5541 (match_operand:DI 1 "const_int_operand")))]
5545 rtx mask = alpha_expand_zap_mask (INTVAL (operands[2]));
5546 if (HOST_BITS_PER_WIDE_INT >= 64 || CONST_INT_P (mask))
5547 operands[1] = gen_int_mode (INTVAL (operands[1]) & INTVAL (mask), DImode);
5550 HOST_WIDE_INT c_lo = INTVAL (operands[1]);
5551 HOST_WIDE_INT c_hi = (c_lo < 0 ? -1 : 0);
5552 operands[1] = immed_double_const (c_lo & CONST_DOUBLE_LOW (mask),
5553 c_hi & CONST_DOUBLE_HIGH (mask),
5556 emit_move_insn (operands[0], operands[1]);
5561 [(set (match_operand:DI 0 "register_operand")
5563 [(match_operand:QI 2 "const_int_operand")]
5565 (match_operand:DI 1 "register_operand")))]
5568 (and:DI (match_dup 1) (match_dup 2)))]
5570 operands[2] = alpha_expand_zap_mask (INTVAL (operands[2]));
5571 if (operands[2] == const0_rtx)
5573 emit_move_insn (operands[0], const0_rtx);
5576 if (operands[2] == constm1_rtx)
5578 emit_move_insn (operands[0], operands[1]);
5583 (define_expand "builtin_zapnot"
5584 [(set (match_operand:DI 0 "register_operand")
5586 [(not:QI (match_operand:DI 2 "reg_or_cint_operand"))]
5588 (match_operand:DI 1 "reg_or_cint_operand")))]
5591 if (CONST_INT_P (operands[2]))
5593 rtx mask = alpha_expand_zap_mask (~ INTVAL (operands[2]));
5595 if (mask == const0_rtx)
5597 emit_move_insn (operands[0], const0_rtx);
5600 if (mask == constm1_rtx)
5602 emit_move_insn (operands[0], operands[1]);
5606 operands[1] = force_reg (DImode, operands[1]);
5607 emit_insn (gen_anddi3 (operands[0], operands[1], mask));
5611 operands[1] = force_reg (DImode, operands[1]);
5612 operands[2] = gen_lowpart (QImode, operands[2]);
5615 (define_insn "*builtin_zapnot_1"
5616 [(set (match_operand:DI 0 "register_operand" "=r")
5618 [(not:QI (match_operand:QI 2 "register_operand" "r"))]
5620 (match_operand:DI 1 "reg_or_0_operand" "rJ")))]
5623 [(set_attr "type" "shift")])
5625 (define_insn "builtin_amask"
5626 [(set (match_operand:DI 0 "register_operand" "=r")
5627 (unspec:DI [(match_operand:DI 1 "reg_or_8bit_operand" "rI")]
5631 [(set_attr "type" "ilog")])
5633 (define_insn "builtin_implver"
5634 [(set (match_operand:DI 0 "register_operand" "=r")
5635 (unspec:DI [(const_int 0)] UNSPEC_IMPLVER))]
5638 [(set_attr "type" "ilog")])
5640 (define_insn "builtin_rpcc"
5641 [(set (match_operand:DI 0 "register_operand" "=r")
5642 (unspec_volatile:DI [(const_int 0)] UNSPECV_RPCC))]
5645 [(set_attr "type" "ilog")])
5647 (define_expand "builtin_minub8"
5648 [(match_operand:DI 0 "register_operand")
5649 (match_operand:DI 1 "reg_or_0_operand")
5650 (match_operand:DI 2 "reg_or_0_operand")]
5653 alpha_expand_builtin_vector_binop (gen_uminv8qi3, V8QImode, operands[0],
5654 operands[1], operands[2]);
5658 (define_expand "builtin_minsb8"
5659 [(match_operand:DI 0 "register_operand")
5660 (match_operand:DI 1 "reg_or_0_operand")
5661 (match_operand:DI 2 "reg_or_0_operand")]
5664 alpha_expand_builtin_vector_binop (gen_sminv8qi3, V8QImode, operands[0],
5665 operands[1], operands[2]);
5669 (define_expand "builtin_minuw4"
5670 [(match_operand:DI 0 "register_operand")
5671 (match_operand:DI 1 "reg_or_0_operand")
5672 (match_operand:DI 2 "reg_or_0_operand")]
5675 alpha_expand_builtin_vector_binop (gen_uminv4hi3, V4HImode, operands[0],
5676 operands[1], operands[2]);
5680 (define_expand "builtin_minsw4"
5681 [(match_operand:DI 0 "register_operand")
5682 (match_operand:DI 1 "reg_or_0_operand")
5683 (match_operand:DI 2 "reg_or_0_operand")]
5686 alpha_expand_builtin_vector_binop (gen_sminv4hi3, V4HImode, operands[0],
5687 operands[1], operands[2]);
5691 (define_expand "builtin_maxub8"
5692 [(match_operand:DI 0 "register_operand")
5693 (match_operand:DI 1 "reg_or_0_operand")
5694 (match_operand:DI 2 "reg_or_0_operand")]
5697 alpha_expand_builtin_vector_binop (gen_umaxv8qi3, V8QImode, operands[0],
5698 operands[1], operands[2]);
5702 (define_expand "builtin_maxsb8"
5703 [(match_operand:DI 0 "register_operand")
5704 (match_operand:DI 1 "reg_or_0_operand")
5705 (match_operand:DI 2 "reg_or_0_operand")]
5708 alpha_expand_builtin_vector_binop (gen_smaxv8qi3, V8QImode, operands[0],
5709 operands[1], operands[2]);
5713 (define_expand "builtin_maxuw4"
5714 [(match_operand:DI 0 "register_operand")
5715 (match_operand:DI 1 "reg_or_0_operand")
5716 (match_operand:DI 2 "reg_or_0_operand")]
5719 alpha_expand_builtin_vector_binop (gen_umaxv4hi3, V4HImode, operands[0],
5720 operands[1], operands[2]);
5724 (define_expand "builtin_maxsw4"
5725 [(match_operand:DI 0 "register_operand")
5726 (match_operand:DI 1 "reg_or_0_operand")
5727 (match_operand:DI 2 "reg_or_0_operand")]
5730 alpha_expand_builtin_vector_binop (gen_smaxv4hi3, V4HImode, operands[0],
5731 operands[1], operands[2]);
5735 (define_insn "builtin_perr"
5736 [(set (match_operand:DI 0 "register_operand" "=r")
5737 (unspec:DI [(match_operand:DI 1 "reg_or_0_operand" "%rJ")
5738 (match_operand:DI 2 "reg_or_8bit_operand" "rJ")]
5742 [(set_attr "type" "mvi")])
5744 (define_expand "builtin_pklb"
5745 [(set (match_operand:DI 0 "register_operand")
5748 (truncate:V2QI (match_operand:DI 1 "register_operand"))
5753 operands[0] = gen_lowpart (V8QImode, operands[0]);
5754 operands[1] = gen_lowpart (V2SImode, operands[1]);
5755 operands[2] = CONST0_RTX (V2QImode);
5756 operands[3] = CONST0_RTX (V4QImode);
5759 (define_insn "*pklb"
5760 [(set (match_operand:V8QI 0 "register_operand" "=r")
5763 (truncate:V2QI (match_operand:V2SI 1 "register_operand" "r"))
5764 (match_operand:V2QI 2 "const0_operand"))
5765 (match_operand:V4QI 3 "const0_operand")))]
5768 [(set_attr "type" "mvi")])
5770 (define_expand "builtin_pkwb"
5771 [(set (match_operand:DI 0 "register_operand")
5773 (truncate:V4QI (match_operand:DI 1 "register_operand"))
5777 operands[0] = gen_lowpart (V8QImode, operands[0]);
5778 operands[1] = gen_lowpart (V4HImode, operands[1]);
5779 operands[2] = CONST0_RTX (V4QImode);
5782 (define_insn "*pkwb"
5783 [(set (match_operand:V8QI 0 "register_operand" "=r")
5785 (truncate:V4QI (match_operand:V4HI 1 "register_operand" "r"))
5786 (match_operand:V4QI 2 "const0_operand")))]
5789 [(set_attr "type" "mvi")])
5791 (define_expand "builtin_unpkbl"
5792 [(set (match_operand:DI 0 "register_operand")
5794 (vec_select:V2QI (match_operand:DI 1 "register_operand")
5795 (parallel [(const_int 0) (const_int 1)]))))]
5798 operands[0] = gen_lowpart (V2SImode, operands[0]);
5799 operands[1] = gen_lowpart (V8QImode, operands[1]);
5802 (define_insn "*unpkbl"
5803 [(set (match_operand:V2SI 0 "register_operand" "=r")
5805 (vec_select:V2QI (match_operand:V8QI 1 "reg_or_0_operand" "rW")
5806 (parallel [(const_int 0) (const_int 1)]))))]
5809 [(set_attr "type" "mvi")])
5811 (define_expand "builtin_unpkbw"
5812 [(set (match_operand:DI 0 "register_operand")
5814 (vec_select:V4QI (match_operand:DI 1 "register_operand")
5815 (parallel [(const_int 0)
5821 operands[0] = gen_lowpart (V4HImode, operands[0]);
5822 operands[1] = gen_lowpart (V8QImode, operands[1]);
5825 (define_insn "*unpkbw"
5826 [(set (match_operand:V4HI 0 "register_operand" "=r")
5828 (vec_select:V4QI (match_operand:V8QI 1 "reg_or_0_operand" "rW")
5829 (parallel [(const_int 0)
5835 [(set_attr "type" "mvi")])
5839 ;; The call patterns are at the end of the file because their
5840 ;; wildcard operand0 interferes with nice recognition.
5842 (define_insn "*call_value_osf_1_er_noreturn"
5843 [(set (match_operand 0)
5844 (call (mem:DI (match_operand:DI 1 "call_operand" "c,R,s"))
5847 (clobber (reg:DI 26))]
5848 "TARGET_EXPLICIT_RELOCS && TARGET_ABI_OSF
5849 && find_reg_note (insn, REG_NORETURN, NULL_RTX)"
5852 bsr $26,%1\t\t!samegp
5853 ldq $27,%1($29)\t\t!literal!%#\;jsr $26,($27),%1\t\t!lituse_jsr!%#"
5854 [(set_attr "type" "jsr")
5855 (set_attr "length" "*,*,8")])
5857 (define_insn "*call_value_osf_1_er"
5858 [(set (match_operand 0)
5859 (call (mem:DI (match_operand:DI 1 "call_operand" "c,R,s"))
5862 (clobber (reg:DI 26))]
5863 "TARGET_EXPLICIT_RELOCS && TARGET_ABI_OSF"
5865 jsr $26,(%1),0\;ldah $29,0($26)\t\t!gpdisp!%*\;lda $29,0($29)\t\t!gpdisp!%*
5866 bsr $26,%1\t\t!samegp
5867 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!%*"
5868 [(set_attr "type" "jsr")
5869 (set_attr "length" "12,*,16")])
5871 ;; We must use peep2 instead of a split because we need accurate life
5872 ;; information for $gp. Consider the case of { bar(); while (1); }.
5874 [(parallel [(set (match_operand 0)
5875 (call (mem:DI (match_operand:DI 1 "call_operand"))
5878 (clobber (reg:DI 26))])]
5879 "TARGET_EXPLICIT_RELOCS && TARGET_ABI_OSF && reload_completed
5880 && ! samegp_function_operand (operands[1], Pmode)
5881 && (peep2_regno_dead_p (1, 29)
5882 || find_reg_note (insn, REG_NORETURN, NULL_RTX))"
5883 [(parallel [(set (match_dup 0)
5884 (call (mem:DI (match_dup 3))
5889 (clobber (reg:DI 26))])]
5891 if (CONSTANT_P (operands[1]))
5893 operands[3] = gen_rtx_REG (Pmode, 27);
5894 operands[4] = GEN_INT (alpha_next_sequence_number++);
5895 emit_insn (gen_movdi_er_high_g (operands[3], pic_offset_table_rtx,
5896 operands[1], operands[4]));
5900 operands[3] = operands[1];
5901 operands[1] = const0_rtx;
5902 operands[4] = const0_rtx;
5907 [(parallel [(set (match_operand 0)
5908 (call (mem:DI (match_operand:DI 1 "call_operand"))
5911 (clobber (reg:DI 26))])]
5912 "TARGET_EXPLICIT_RELOCS && TARGET_ABI_OSF && reload_completed
5913 && ! samegp_function_operand (operands[1], Pmode)
5914 && ! (peep2_regno_dead_p (1, 29)
5915 || find_reg_note (insn, REG_NORETURN, NULL_RTX))"
5916 [(parallel [(set (match_dup 0)
5917 (call (mem:DI (match_dup 3))
5920 (unspec:DI [(match_dup 6) (match_dup 4)] UNSPEC_LDGP1))
5923 (clobber (reg:DI 26))])
5925 (unspec:DI [(match_dup 6) (match_dup 4)] UNSPEC_LDGP2))]
5927 if (CONSTANT_P (operands[1]))
5929 operands[3] = gen_rtx_REG (Pmode, 27);
5930 operands[5] = GEN_INT (alpha_next_sequence_number++);
5931 emit_insn (gen_movdi_er_high_g (operands[3], pic_offset_table_rtx,
5932 operands[1], operands[5]));
5936 operands[3] = operands[1];
5937 operands[1] = const0_rtx;
5938 operands[5] = const0_rtx;
5940 operands[4] = GEN_INT (alpha_next_sequence_number++);
5941 operands[6] = pic_offset_table_rtx;
5944 (define_insn "*call_value_osf_2_er_nogp"
5945 [(set (match_operand 0)
5946 (call (mem:DI (match_operand:DI 1 "register_operand" "c"))
5949 (use (match_operand 3))
5950 (use (match_operand 4))
5951 (clobber (reg:DI 26))]
5952 "TARGET_EXPLICIT_RELOCS && TARGET_ABI_OSF"
5953 "jsr $26,(%1),%3%J4"
5954 [(set_attr "type" "jsr")])
5956 (define_insn "*call_value_osf_2_er"
5957 [(set (match_operand 0)
5958 (call (mem:DI (match_operand:DI 1 "register_operand" "c"))
5961 (unspec:DI [(reg:DI 29) (match_operand 5 "const_int_operand")]
5963 (use (match_operand 3))
5964 (use (match_operand 4))
5965 (clobber (reg:DI 26))]
5966 "TARGET_EXPLICIT_RELOCS && TARGET_ABI_OSF"
5967 "jsr $26,(%1),%3%J4\;ldah $29,0($26)\t\t!gpdisp!%5"
5968 [(set_attr "type" "jsr")
5969 (set_attr "cannot_copy" "true")
5970 (set_attr "length" "8")])
5972 (define_insn "*call_value_osf_1_noreturn"
5973 [(set (match_operand 0)
5974 (call (mem:DI (match_operand:DI 1 "call_operand" "c,R,s"))
5977 (clobber (reg:DI 26))]
5978 "! TARGET_EXPLICIT_RELOCS && TARGET_ABI_OSF
5979 && find_reg_note (insn, REG_NORETURN, NULL_RTX)"
5984 [(set_attr "type" "jsr")
5985 (set_attr "length" "*,*,8")])
5987 (define_int_iterator TLS_CALL
5989 UNSPEC_TLSLDM_CALL])
5991 (define_int_attr tls
5992 [(UNSPEC_TLSGD_CALL "tlsgd")
5993 (UNSPEC_TLSLDM_CALL "tlsldm")])
5995 (define_insn "call_value_osf_<tls>"
5996 [(set (match_operand 0)
5997 (call (mem:DI (match_operand:DI 1 "symbolic_operand"))
5999 (unspec [(match_operand:DI 2 "const_int_operand")] TLS_CALL)
6001 (clobber (reg:DI 26))]
6003 "ldq $27,%1($29)\t\t!literal!%2\;jsr $26,($27),%1\t\t!lituse_<tls>!%2\;ldah $29,0($26)\t\t!gpdisp!%*\;lda $29,0($29)\t\t!gpdisp!%*"
6004 [(set_attr "type" "jsr")
6005 (set_attr "length" "16")])
6007 ;; We must use peep2 instead of a split because we need accurate life
6008 ;; information for $gp.
6011 [(set (match_operand 0)
6012 (call (mem:DI (match_operand:DI 1 "symbolic_operand"))
6014 (unspec [(match_operand:DI 2 "const_int_operand")] TLS_CALL)
6016 (clobber (reg:DI 26))])]
6017 "HAVE_AS_TLS && reload_completed
6018 && peep2_regno_dead_p (1, 29)"
6020 (unspec:DI [(match_dup 5)
6022 (match_dup 2)] UNSPEC_LITERAL))
6023 (parallel [(set (match_dup 0)
6024 (call (mem:DI (match_dup 3))
6028 (use (unspec [(match_dup 2)] TLS_CALL))
6029 (clobber (reg:DI 26))])
6031 (unspec:DI [(match_dup 5) (match_dup 4)] UNSPEC_LDGP2))]
6033 operands[3] = gen_rtx_REG (Pmode, 27);
6034 operands[4] = GEN_INT (alpha_next_sequence_number++);
6035 operands[5] = pic_offset_table_rtx;
6040 [(set (match_operand 0)
6041 (call (mem:DI (match_operand:DI 1 "symbolic_operand"))
6043 (unspec [(match_operand:DI 2 "const_int_operand")] TLS_CALL)
6045 (clobber (reg:DI 26))])]
6046 "HAVE_AS_TLS && reload_completed
6047 && !peep2_regno_dead_p (1, 29)"
6049 (unspec:DI [(match_dup 5)
6051 (match_dup 2)] UNSPEC_LITERAL))
6052 (parallel [(set (match_dup 0)
6053 (call (mem:DI (match_dup 3))
6056 (unspec:DI [(match_dup 5) (match_dup 4)] UNSPEC_LDGP1))
6058 (use (unspec [(match_dup 2)] TLS_CALL))
6059 (clobber (reg:DI 26))])
6061 (unspec:DI [(match_dup 5) (match_dup 4)] UNSPEC_LDGP2))]
6063 operands[3] = gen_rtx_REG (Pmode, 27);
6064 operands[4] = GEN_INT (alpha_next_sequence_number++);
6065 operands[5] = pic_offset_table_rtx;
6068 (define_insn "*call_value_osf_1"
6069 [(set (match_operand 0)
6070 (call (mem:DI (match_operand:DI 1 "call_operand" "c,R,s"))
6073 (clobber (reg:DI 26))]
6074 "! TARGET_EXPLICIT_RELOCS && TARGET_ABI_OSF"
6076 jsr $26,($27),0\;ldgp $29,0($26)
6078 jsr $26,%1\;ldgp $29,0($26)"
6079 [(set_attr "type" "jsr")
6080 (set_attr "length" "12,*,16")])
6082 (define_insn "*sibcall_value_osf_1_er"
6083 [(set (match_operand 0)
6084 (call (mem:DI (match_operand:DI 1 "symbolic_operand" "R,s"))
6086 (unspec [(reg:DI 29)] UNSPEC_SIBCALL)]
6087 "TARGET_EXPLICIT_RELOCS && TARGET_ABI_OSF"
6089 br $31,%1\t\t!samegp
6090 ldq $27,%1($29)\t\t!literal!%#\;jmp $31,($27),%1\t\t!lituse_jsr!%#"
6091 [(set_attr "type" "jsr")
6092 (set_attr "length" "*,8")])
6094 (define_insn "*sibcall_value_osf_1"
6095 [(set (match_operand 0)
6096 (call (mem:DI (match_operand:DI 1 "symbolic_operand" "R,s"))
6098 (unspec [(reg:DI 29)] UNSPEC_SIBCALL)]
6099 "! TARGET_EXPLICIT_RELOCS && TARGET_ABI_OSF"
6102 lda $27,%1\;jmp $31,($27),%1"
6103 [(set_attr "type" "jsr")
6104 (set_attr "length" "*,8")])
6106 ; GAS relies on the order and position of instructions output below in order
6107 ; to generate relocs for VMS link to potentially optimize the call.
6108 ; Please do not molest.
6109 (define_insn "*call_value_vms_1"
6110 [(set (match_operand 0)
6111 (call (mem:DI (match_operand:DI 1 "call_operand" "r,s"))
6113 (use (match_operand:DI 3 "nonmemory_operand" "r,n"))
6116 (clobber (reg:DI 27))]
6117 "TARGET_ABI_OPEN_VMS"
6119 switch (which_alternative)
6122 return "mov %3,$27\;jsr $26,0\;ldq $27,0($29)";
6124 operands [3] = alpha_use_linkage (operands [1], true, false);
6125 operands [4] = alpha_use_linkage (operands [1], false, false);
6126 return "ldq $26,%4\;ldq $27,%3\;jsr $26,%1\;ldq $27,0($29)";
6131 [(set_attr "type" "jsr")
6132 (set_attr "length" "12,16")])