1 ;; Machine description for DEC Alpha for GNU C compiler
2 ;; Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
3 ;; 2000, 2001, 2002, 2003, 2004, 2005, 2007, 2008, 2009
4 ;; Free Software Foundation, Inc.
5 ;; Contributed by Richard Kenner (kenner@vlsi1.ultra.nyu.edu)
7 ;; This file is part of GCC.
9 ;; GCC is free software; you can redistribute it and/or modify
10 ;; it under the terms of the GNU General Public License as published by
11 ;; the Free Software Foundation; either version 3, or (at your option)
14 ;; GCC is distributed in the hope that it will be useful,
15 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
16 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 ;; GNU General Public License for more details.
19 ;; You should have received a copy of the GNU General Public License
20 ;; along with GCC; see the file COPYING3. If not see
21 ;; <http://www.gnu.org/licenses/>.
23 ;;- See file "rtl.def" for documentation on define_insn, match_*, et. al.
25 ;; Uses of UNSPEC in this file:
37 (UNSPEC_UMK_LOAD_CIW 9)
45 (UNSPEC_TLSGD_CALL 15)
46 (UNSPEC_TLSLDM_CALL 16)
73 (UNSPECV_SETJMPR 2) ; builtin_setjmp_receiver
74 (UNSPECV_LONGJMP 3) ; builtin_longjmp
76 (UNSPECV_PSPL 5) ; prologue_stack_probe_loop
78 (UNSPECV_EHR 7) ; exception_receiver
82 (UNSPECV_PLDGP2 11) ; prologue ldgp
85 (UNSPECV_SETJMPR_ER 14) ; builtin_setjmp_receiver fragment
86 (UNSPECV_LL 15) ; load-locked
87 (UNSPECV_SC 16) ; store-conditional
90 ;; On non-BWX targets, CQImode must be handled the similarly to HImode
91 ;; when generating reloads.
92 (define_mode_iterator RELOAD12 [QI HI CQI])
93 (define_mode_attr reloadmode [(QI "qi") (HI "hi") (CQI "hi")])
95 ;; Other mode iterators
96 (define_mode_iterator I12MODE [QI HI])
97 (define_mode_iterator I48MODE [SI DI])
98 (define_mode_attr modesuffix [(SI "l") (DI "q")])
100 ;; Where necessary, the suffixes _le and _be are used to distinguish between
101 ;; little-endian and big-endian patterns.
103 ;; Note that the Unicos/Mk assembler does not support the following
104 ;; opcodes: mov, fmov, nop, fnop, unop.
106 ;; Processor type -- this attribute must exactly match the processor_type
107 ;; enumeration in alpha.h.
109 (define_attr "tune" "ev4,ev5,ev6"
110 (const (symbol_ref "((enum attr_tune) alpha_tune)")))
112 ;; Define an insn type attribute. This is used in function unit delay
113 ;; computations, among other purposes. For the most part, we use the names
114 ;; defined in the EV4 documentation, but add a few that we have to know about
118 "ild,fld,ldsym,ist,fst,ibr,callpal,fbr,jsr,iadd,ilog,shift,icmov,fcmov,
119 icmp,imul,fadd,fmul,fcpys,fdiv,fsqrt,misc,mvi,ftoi,itof,mb,ld_l,st_c,
121 (const_string "iadd"))
123 ;; Describe a user's asm statement.
124 (define_asm_attributes
125 [(set_attr "type" "multi")])
127 ;; Define the operand size an insn operates on. Used primarily by mul
128 ;; and div operations that have size dependent timings.
130 (define_attr "opsize" "si,di,udi"
133 ;; The TRAP attribute marks instructions that may generate traps
134 ;; (which are imprecise and may need a trapb if software completion
137 (define_attr "trap" "no,yes"
140 ;; The ROUND_SUFFIX attribute marks which instructions require a
141 ;; rounding-mode suffix. The value NONE indicates no suffix,
142 ;; the value NORMAL indicates a suffix controlled by alpha_fprm.
144 (define_attr "round_suffix" "none,normal,c"
145 (const_string "none"))
147 ;; The TRAP_SUFFIX attribute marks instructions requiring a trap-mode suffix:
149 ;; SU accepts only /su (cmpt et al)
150 ;; SUI accepts only /sui (cvtqt and cvtqs)
151 ;; V_SV accepts /v and /sv (cvtql only)
152 ;; V_SV_SVI accepts /v, /sv and /svi (cvttq only)
153 ;; U_SU_SUI accepts /u, /su and /sui (most fp instructions)
155 ;; The actual suffix emitted is controlled by alpha_fptm.
157 (define_attr "trap_suffix" "none,su,sui,v_sv,v_sv_svi,u_su_sui"
158 (const_string "none"))
160 ;; The length of an instruction sequence in bytes.
162 (define_attr "length" ""
165 ;; The USEGP attribute marks instructions that have relocations that use
168 (define_attr "usegp" "no,yes"
169 (cond [(eq_attr "type" "ldsym,jsr")
171 (eq_attr "type" "ild,fld,ist,fst")
172 (symbol_ref "((enum attr_usegp) alpha_find_lo_sum_using_gp (insn))")
174 (const_string "no")))
176 ;; The CANNOT_COPY attribute marks instructions with relocations that
177 ;; cannot easily be duplicated. This includes insns with gpdisp relocs
178 ;; since they have to stay in 1-1 correspondence with one another. This
179 ;; also includes jsr insns, since they must stay in correspondence with
180 ;; the immediately following gpdisp instructions.
182 (define_attr "cannot_copy" "false,true"
183 (const_string "false"))
185 ;; Include scheduling descriptions.
192 ;; Operand and operator predicates and constraints
194 (include "predicates.md")
195 (include "constraints.md")
198 ;; First define the arithmetic insns. Note that the 32-bit forms also
201 ;; Handle 32-64 bit extension from memory to a floating point register
202 ;; specially, since this occurs frequently in int->double conversions.
204 ;; Note that while we must retain the =f case in the insn for reload's
205 ;; benefit, it should be eliminated after reload, so we should never emit
206 ;; code for that case. But we don't reject the possibility.
208 (define_expand "extendsidi2"
209 [(set (match_operand:DI 0 "register_operand" "")
210 (sign_extend:DI (match_operand:SI 1 "nonimmediate_operand" "")))]
214 (define_insn "*cvtlq"
215 [(set (match_operand:DI 0 "register_operand" "=f")
216 (unspec:DI [(match_operand:SF 1 "reg_or_0_operand" "fG")]
220 [(set_attr "type" "fadd")])
222 (define_insn "*extendsidi2_1"
223 [(set (match_operand:DI 0 "register_operand" "=r,r,!*f")
225 (match_operand:SI 1 "nonimmediate_operand" "r,m,m")))]
230 lds %0,%1\;cvtlq %0,%0"
231 [(set_attr "type" "iadd,ild,fld")
232 (set_attr "length" "*,*,8")])
235 [(set (match_operand:DI 0 "hard_fp_register_operand" "")
236 (sign_extend:DI (match_operand:SI 1 "memory_operand" "")))]
238 [(set (match_dup 2) (match_dup 1))
239 (set (match_dup 0) (unspec:DI [(match_dup 2)] UNSPEC_CVTLQ))]
241 operands[1] = adjust_address (operands[1], SFmode, 0);
242 operands[2] = gen_rtx_REG (SFmode, REGNO (operands[0]));
245 ;; Optimize sign-extension of SImode loads. This shows up in the wake of
246 ;; reload when converting fp->int.
249 [(set (match_operand:SI 0 "hard_int_register_operand" "")
250 (match_operand:SI 1 "memory_operand" ""))
251 (set (match_operand:DI 2 "hard_int_register_operand" "")
252 (sign_extend:DI (match_dup 0)))]
253 "true_regnum (operands[0]) == true_regnum (operands[2])
254 || peep2_reg_dead_p (2, operands[0])"
256 (sign_extend:DI (match_dup 1)))]
259 (define_insn "addsi3"
260 [(set (match_operand:SI 0 "register_operand" "=r,r,r,r")
261 (plus:SI (match_operand:SI 1 "reg_or_0_operand" "%rJ,rJ,rJ,rJ")
262 (match_operand:SI 2 "add_operand" "rI,O,K,L")))]
271 [(set (match_operand:SI 0 "register_operand" "")
272 (plus:SI (match_operand:SI 1 "register_operand" "")
273 (match_operand:SI 2 "const_int_operand" "")))]
274 "! add_operand (operands[2], SImode)"
275 [(set (match_dup 0) (plus:SI (match_dup 1) (match_dup 3)))
276 (set (match_dup 0) (plus:SI (match_dup 0) (match_dup 4)))]
278 HOST_WIDE_INT val = INTVAL (operands[2]);
279 HOST_WIDE_INT low = (val & 0xffff) - 2 * (val & 0x8000);
280 HOST_WIDE_INT rest = val - low;
282 operands[3] = GEN_INT (rest);
283 operands[4] = GEN_INT (low);
286 (define_insn "*addsi_se"
287 [(set (match_operand:DI 0 "register_operand" "=r,r")
289 (plus:SI (match_operand:SI 1 "reg_or_0_operand" "%rJ,rJ")
290 (match_operand:SI 2 "sext_add_operand" "rI,O"))))]
296 (define_insn "*addsi_se2"
297 [(set (match_operand:DI 0 "register_operand" "=r,r")
299 (subreg:SI (plus:DI (match_operand:DI 1 "reg_or_0_operand" "%rJ,rJ")
300 (match_operand:DI 2 "sext_add_operand" "rI,O"))
308 [(set (match_operand:DI 0 "register_operand" "")
310 (plus:SI (match_operand:SI 1 "reg_not_elim_operand" "")
311 (match_operand:SI 2 "const_int_operand" ""))))
312 (clobber (match_operand:SI 3 "reg_not_elim_operand" ""))]
313 "! sext_add_operand (operands[2], SImode) && INTVAL (operands[2]) > 0
314 && INTVAL (operands[2]) % 4 == 0"
315 [(set (match_dup 3) (match_dup 4))
316 (set (match_dup 0) (sign_extend:DI (plus:SI (mult:SI (match_dup 3)
320 HOST_WIDE_INT val = INTVAL (operands[2]) / 4;
326 operands[4] = GEN_INT (val);
327 operands[5] = GEN_INT (mult);
331 [(set (match_operand:DI 0 "register_operand" "")
333 (plus:SI (match_operator:SI 1 "comparison_operator"
334 [(match_operand 2 "" "")
335 (match_operand 3 "" "")])
336 (match_operand:SI 4 "add_operand" ""))))
337 (clobber (match_operand:DI 5 "register_operand" ""))]
339 [(set (match_dup 5) (match_dup 6))
340 (set (match_dup 0) (sign_extend:DI (plus:SI (match_dup 7) (match_dup 4))))]
342 operands[6] = gen_rtx_fmt_ee (GET_CODE (operands[1]), DImode,
343 operands[2], operands[3]);
344 operands[7] = gen_lowpart (SImode, operands[5]);
347 (define_insn "addvsi3"
348 [(set (match_operand:SI 0 "register_operand" "=r,r")
349 (plus:SI (match_operand:SI 1 "reg_or_0_operand" "%rJ,rJ")
350 (match_operand:SI 2 "sext_add_operand" "rI,O")))
351 (trap_if (ne (plus:DI (sign_extend:DI (match_dup 1))
352 (sign_extend:DI (match_dup 2)))
353 (sign_extend:DI (plus:SI (match_dup 1)
361 (define_expand "adddi3"
362 [(set (match_operand:DI 0 "register_operand" "")
363 (plus:DI (match_operand:DI 1 "register_operand" "")
364 (match_operand:DI 2 "add_operand" "")))]
368 (define_insn "*adddi_er_lo16_dtp"
369 [(set (match_operand:DI 0 "register_operand" "=r")
370 (lo_sum:DI (match_operand:DI 1 "register_operand" "r")
371 (match_operand:DI 2 "dtp16_symbolic_operand" "")))]
373 "lda %0,%2(%1)\t\t!dtprel")
375 (define_insn "*adddi_er_hi32_dtp"
376 [(set (match_operand:DI 0 "register_operand" "=r")
377 (plus:DI (match_operand:DI 1 "register_operand" "r")
378 (high:DI (match_operand:DI 2 "dtp32_symbolic_operand" ""))))]
380 "ldah %0,%2(%1)\t\t!dtprelhi")
382 (define_insn "*adddi_er_lo32_dtp"
383 [(set (match_operand:DI 0 "register_operand" "=r")
384 (lo_sum:DI (match_operand:DI 1 "register_operand" "r")
385 (match_operand:DI 2 "dtp32_symbolic_operand" "")))]
387 "lda %0,%2(%1)\t\t!dtprello")
389 (define_insn "*adddi_er_lo16_tp"
390 [(set (match_operand:DI 0 "register_operand" "=r")
391 (lo_sum:DI (match_operand:DI 1 "register_operand" "r")
392 (match_operand:DI 2 "tp16_symbolic_operand" "")))]
394 "lda %0,%2(%1)\t\t!tprel")
396 (define_insn "*adddi_er_hi32_tp"
397 [(set (match_operand:DI 0 "register_operand" "=r")
398 (plus:DI (match_operand:DI 1 "register_operand" "r")
399 (high:DI (match_operand:DI 2 "tp32_symbolic_operand" ""))))]
401 "ldah %0,%2(%1)\t\t!tprelhi")
403 (define_insn "*adddi_er_lo32_tp"
404 [(set (match_operand:DI 0 "register_operand" "=r")
405 (lo_sum:DI (match_operand:DI 1 "register_operand" "r")
406 (match_operand:DI 2 "tp32_symbolic_operand" "")))]
408 "lda %0,%2(%1)\t\t!tprello")
410 (define_insn "*adddi_er_high_l"
411 [(set (match_operand:DI 0 "register_operand" "=r")
412 (plus:DI (match_operand:DI 1 "register_operand" "r")
413 (high:DI (match_operand:DI 2 "local_symbolic_operand" ""))))]
414 "TARGET_EXPLICIT_RELOCS && reload_completed"
415 "ldah %0,%2(%1)\t\t!gprelhigh"
416 [(set_attr "usegp" "yes")])
419 [(set (match_operand:DI 0 "register_operand" "")
420 (high:DI (match_operand:DI 1 "local_symbolic_operand" "")))]
421 "TARGET_EXPLICIT_RELOCS && reload_completed"
423 (plus:DI (match_dup 2) (high:DI (match_dup 1))))]
424 "operands[2] = pic_offset_table_rtx;")
426 ;; We used to expend quite a lot of effort choosing addq/subq/lda.
427 ;; With complications like
429 ;; The NT stack unwind code can't handle a subq to adjust the stack
430 ;; (that's a bug, but not one we can do anything about). As of NT4.0 SP3,
431 ;; the exception handling code will loop if a subq is used and an
434 ;; The 19980616 change to emit prologues as RTL also confused some
435 ;; versions of GDB, which also interprets prologues. This has been
436 ;; fixed as of GDB 4.18, but it does not harm to unconditionally
439 ;; and the fact that the three insns schedule exactly the same, it's
440 ;; just not worth the effort.
442 (define_insn "*adddi_internal"
443 [(set (match_operand:DI 0 "register_operand" "=r,r,r")
444 (plus:DI (match_operand:DI 1 "register_operand" "%r,r,r")
445 (match_operand:DI 2 "add_operand" "r,K,L")))]
452 ;; ??? Allow large constants when basing off the frame pointer or some
453 ;; virtual register that may eliminate to the frame pointer. This is
454 ;; done because register elimination offsets will change the hi/lo split,
455 ;; and if we split before reload, we will require additional instructions.
457 (define_insn "*adddi_fp_hack"
458 [(set (match_operand:DI 0 "register_operand" "=r,r,r")
459 (plus:DI (match_operand:DI 1 "reg_no_subreg_operand" "r,r,r")
460 (match_operand:DI 2 "const_int_operand" "K,L,n")))]
461 "NONSTRICT_REG_OK_FP_BASE_P (operands[1])
462 && INTVAL (operands[2]) >= 0
463 /* This is the largest constant an lda+ldah pair can add, minus
464 an upper bound on the displacement between SP and AP during
465 register elimination. See INITIAL_ELIMINATION_OFFSET. */
466 && INTVAL (operands[2])
468 - FIRST_PSEUDO_REGISTER * UNITS_PER_WORD
469 - ALPHA_ROUND(crtl->outgoing_args_size)
470 - (ALPHA_ROUND (get_frame_size ()
471 + max_reg_num () * UNITS_PER_WORD
472 + crtl->args.pretend_args_size)
473 - crtl->args.pretend_args_size))"
479 ;; Don't do this if we are adjusting SP since we don't want to do it
480 ;; in two steps. Don't split FP sources for the reason listed above.
482 [(set (match_operand:DI 0 "register_operand" "")
483 (plus:DI (match_operand:DI 1 "register_operand" "")
484 (match_operand:DI 2 "const_int_operand" "")))]
485 "! add_operand (operands[2], DImode)
486 && operands[0] != stack_pointer_rtx
487 && operands[1] != frame_pointer_rtx
488 && operands[1] != arg_pointer_rtx"
489 [(set (match_dup 0) (plus:DI (match_dup 1) (match_dup 3)))
490 (set (match_dup 0) (plus:DI (match_dup 0) (match_dup 4)))]
492 HOST_WIDE_INT val = INTVAL (operands[2]);
493 HOST_WIDE_INT low = (val & 0xffff) - 2 * (val & 0x8000);
494 HOST_WIDE_INT rest = val - low;
495 rtx rest_rtx = GEN_INT (rest);
497 operands[4] = GEN_INT (low);
498 if (satisfies_constraint_L (rest_rtx))
499 operands[3] = rest_rtx;
500 else if (can_create_pseudo_p ())
502 operands[3] = gen_reg_rtx (DImode);
503 emit_move_insn (operands[3], operands[2]);
504 emit_insn (gen_adddi3 (operands[0], operands[1], operands[3]));
511 (define_insn "*saddl"
512 [(set (match_operand:SI 0 "register_operand" "=r,r")
513 (plus:SI (mult:SI (match_operand:SI 1 "reg_not_elim_operand" "r,r")
514 (match_operand:SI 2 "const48_operand" "I,I"))
515 (match_operand:SI 3 "sext_add_operand" "rI,O")))]
521 (define_insn "*saddl_se"
522 [(set (match_operand:DI 0 "register_operand" "=r,r")
524 (plus:SI (mult:SI (match_operand:SI 1 "reg_not_elim_operand" "r,r")
525 (match_operand:SI 2 "const48_operand" "I,I"))
526 (match_operand:SI 3 "sext_add_operand" "rI,O"))))]
533 [(set (match_operand:DI 0 "register_operand" "")
535 (plus:SI (mult:SI (match_operator:SI 1 "comparison_operator"
536 [(match_operand 2 "" "")
537 (match_operand 3 "" "")])
538 (match_operand:SI 4 "const48_operand" ""))
539 (match_operand:SI 5 "sext_add_operand" ""))))
540 (clobber (match_operand:DI 6 "reg_not_elim_operand" ""))]
542 [(set (match_dup 6) (match_dup 7))
544 (sign_extend:DI (plus:SI (mult:SI (match_dup 8) (match_dup 4))
547 operands[7] = gen_rtx_fmt_ee (GET_CODE (operands[1]), DImode,
548 operands[2], operands[3]);
549 operands[8] = gen_lowpart (SImode, operands[6]);
552 (define_insn "*saddq"
553 [(set (match_operand:DI 0 "register_operand" "=r,r")
554 (plus:DI (mult:DI (match_operand:DI 1 "reg_not_elim_operand" "r,r")
555 (match_operand:DI 2 "const48_operand" "I,I"))
556 (match_operand:DI 3 "sext_add_operand" "rI,O")))]
562 (define_insn "addvdi3"
563 [(set (match_operand:DI 0 "register_operand" "=r,r")
564 (plus:DI (match_operand:DI 1 "reg_or_0_operand" "%rJ,rJ")
565 (match_operand:DI 2 "sext_add_operand" "rI,O")))
566 (trap_if (ne (plus:TI (sign_extend:TI (match_dup 1))
567 (sign_extend:TI (match_dup 2)))
568 (sign_extend:TI (plus:DI (match_dup 1)
576 (define_insn "negsi2"
577 [(set (match_operand:SI 0 "register_operand" "=r")
578 (neg:SI (match_operand:SI 1 "reg_or_8bit_operand" "rI")))]
582 (define_insn "*negsi_se"
583 [(set (match_operand:DI 0 "register_operand" "=r")
584 (sign_extend:DI (neg:SI
585 (match_operand:SI 1 "reg_or_8bit_operand" "rI"))))]
589 (define_insn "negvsi2"
590 [(set (match_operand:SI 0 "register_operand" "=r")
591 (neg:SI (match_operand:SI 1 "register_operand" "r")))
592 (trap_if (ne (neg:DI (sign_extend:DI (match_dup 1)))
593 (sign_extend:DI (neg:SI (match_dup 1))))
598 (define_insn "negdi2"
599 [(set (match_operand:DI 0 "register_operand" "=r")
600 (neg:DI (match_operand:DI 1 "reg_or_8bit_operand" "rI")))]
604 (define_insn "negvdi2"
605 [(set (match_operand:DI 0 "register_operand" "=r")
606 (neg:DI (match_operand:DI 1 "register_operand" "r")))
607 (trap_if (ne (neg:TI (sign_extend:TI (match_dup 1)))
608 (sign_extend:TI (neg:DI (match_dup 1))))
613 (define_insn "subsi3"
614 [(set (match_operand:SI 0 "register_operand" "=r")
615 (minus:SI (match_operand:SI 1 "reg_or_0_operand" "rJ")
616 (match_operand:SI 2 "reg_or_8bit_operand" "rI")))]
620 (define_insn "*subsi_se"
621 [(set (match_operand:DI 0 "register_operand" "=r")
622 (sign_extend:DI (minus:SI (match_operand:SI 1 "reg_or_0_operand" "rJ")
623 (match_operand:SI 2 "reg_or_8bit_operand" "rI"))))]
627 (define_insn "*subsi_se2"
628 [(set (match_operand:DI 0 "register_operand" "=r")
630 (subreg:SI (minus:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
631 (match_operand:DI 2 "reg_or_8bit_operand" "rI"))
636 (define_insn "subvsi3"
637 [(set (match_operand:SI 0 "register_operand" "=r")
638 (minus:SI (match_operand:SI 1 "reg_or_0_operand" "rJ")
639 (match_operand:SI 2 "reg_or_8bit_operand" "rI")))
640 (trap_if (ne (minus:DI (sign_extend:DI (match_dup 1))
641 (sign_extend:DI (match_dup 2)))
642 (sign_extend:DI (minus:SI (match_dup 1)
648 (define_insn "subdi3"
649 [(set (match_operand:DI 0 "register_operand" "=r")
650 (minus:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
651 (match_operand:DI 2 "reg_or_8bit_operand" "rI")))]
655 (define_insn "*ssubl"
656 [(set (match_operand:SI 0 "register_operand" "=r")
657 (minus:SI (mult:SI (match_operand:SI 1 "reg_not_elim_operand" "r")
658 (match_operand:SI 2 "const48_operand" "I"))
659 (match_operand:SI 3 "reg_or_8bit_operand" "rI")))]
663 (define_insn "*ssubl_se"
664 [(set (match_operand:DI 0 "register_operand" "=r")
666 (minus:SI (mult:SI (match_operand:SI 1 "reg_not_elim_operand" "r")
667 (match_operand:SI 2 "const48_operand" "I"))
668 (match_operand:SI 3 "reg_or_8bit_operand" "rI"))))]
672 (define_insn "*ssubq"
673 [(set (match_operand:DI 0 "register_operand" "=r")
674 (minus:DI (mult:DI (match_operand:DI 1 "reg_not_elim_operand" "r")
675 (match_operand:DI 2 "const48_operand" "I"))
676 (match_operand:DI 3 "reg_or_8bit_operand" "rI")))]
680 (define_insn "subvdi3"
681 [(set (match_operand:DI 0 "register_operand" "=r")
682 (minus:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
683 (match_operand:DI 2 "reg_or_8bit_operand" "rI")))
684 (trap_if (ne (minus:TI (sign_extend:TI (match_dup 1))
685 (sign_extend:TI (match_dup 2)))
686 (sign_extend:TI (minus:DI (match_dup 1)
692 ;; The Unicos/Mk assembler doesn't support mull.
694 (define_insn "mulsi3"
695 [(set (match_operand:SI 0 "register_operand" "=r")
696 (mult:SI (match_operand:SI 1 "reg_or_0_operand" "%rJ")
697 (match_operand:SI 2 "reg_or_8bit_operand" "rI")))]
698 "!TARGET_ABI_UNICOSMK"
700 [(set_attr "type" "imul")
701 (set_attr "opsize" "si")])
703 (define_insn "*mulsi_se"
704 [(set (match_operand:DI 0 "register_operand" "=r")
706 (mult:SI (match_operand:SI 1 "reg_or_0_operand" "%rJ")
707 (match_operand:SI 2 "reg_or_8bit_operand" "rI"))))]
708 "!TARGET_ABI_UNICOSMK"
710 [(set_attr "type" "imul")
711 (set_attr "opsize" "si")])
713 (define_insn "mulvsi3"
714 [(set (match_operand:SI 0 "register_operand" "=r")
715 (mult:SI (match_operand:SI 1 "reg_or_0_operand" "%rJ")
716 (match_operand:SI 2 "reg_or_8bit_operand" "rI")))
717 (trap_if (ne (mult:DI (sign_extend:DI (match_dup 1))
718 (sign_extend:DI (match_dup 2)))
719 (sign_extend:DI (mult:SI (match_dup 1)
722 "!TARGET_ABI_UNICOSMK"
724 [(set_attr "type" "imul")
725 (set_attr "opsize" "si")])
727 (define_insn "muldi3"
728 [(set (match_operand:DI 0 "register_operand" "=r")
729 (mult:DI (match_operand:DI 1 "reg_or_0_operand" "%rJ")
730 (match_operand:DI 2 "reg_or_8bit_operand" "rI")))]
733 [(set_attr "type" "imul")])
735 (define_insn "mulvdi3"
736 [(set (match_operand:DI 0 "register_operand" "=r")
737 (mult:DI (match_operand:DI 1 "reg_or_0_operand" "%rJ")
738 (match_operand:DI 2 "reg_or_8bit_operand" "rI")))
739 (trap_if (ne (mult:TI (sign_extend:TI (match_dup 1))
740 (sign_extend:TI (match_dup 2)))
741 (sign_extend:TI (mult:DI (match_dup 1)
746 [(set_attr "type" "imul")])
748 (define_expand "umuldi3_highpart"
749 [(set (match_operand:DI 0 "register_operand" "")
752 (mult:TI (zero_extend:TI
753 (match_operand:DI 1 "register_operand" ""))
754 (match_operand:DI 2 "reg_or_8bit_operand" ""))
758 if (REG_P (operands[2]))
759 operands[2] = gen_rtx_ZERO_EXTEND (TImode, operands[2]);
762 (define_insn "*umuldi3_highpart_reg"
763 [(set (match_operand:DI 0 "register_operand" "=r")
766 (mult:TI (zero_extend:TI
767 (match_operand:DI 1 "register_operand" "r"))
769 (match_operand:DI 2 "register_operand" "r")))
773 [(set_attr "type" "imul")
774 (set_attr "opsize" "udi")])
776 (define_insn "*umuldi3_highpart_const"
777 [(set (match_operand:DI 0 "register_operand" "=r")
780 (mult:TI (zero_extend:TI (match_operand:DI 1 "register_operand" "r"))
781 (match_operand:TI 2 "cint8_operand" "I"))
785 [(set_attr "type" "imul")
786 (set_attr "opsize" "udi")])
788 ;; The divide and remainder operations take their inputs from r24 and
789 ;; r25, put their output in r27, and clobber r23 and r28 on all
790 ;; systems except Unicos/Mk. On Unicos, the standard library provides
791 ;; subroutines which use the standard calling convention and work on
794 ;; ??? Force sign-extension here because some versions of OSF/1 and
795 ;; Interix/NT don't do the right thing if the inputs are not properly
796 ;; sign-extended. But Linux, for instance, does not have this
797 ;; problem. Is it worth the complication here to eliminate the sign
800 (define_expand "divsi3"
802 (sign_extend:DI (match_operand:SI 1 "nonimmediate_operand" "")))
804 (sign_extend:DI (match_operand:SI 2 "nonimmediate_operand" "")))
805 (parallel [(set (match_dup 5)
806 (sign_extend:DI (div:SI (match_dup 3) (match_dup 4))))
807 (clobber (reg:DI 23))
808 (clobber (reg:DI 28))])
809 (set (match_operand:SI 0 "nonimmediate_operand" "")
810 (subreg:SI (match_dup 5) 0))]
811 "! TARGET_ABI_OPEN_VMS && ! TARGET_ABI_UNICOSMK"
813 operands[3] = gen_reg_rtx (DImode);
814 operands[4] = gen_reg_rtx (DImode);
815 operands[5] = gen_reg_rtx (DImode);
818 (define_expand "udivsi3"
820 (sign_extend:DI (match_operand:SI 1 "nonimmediate_operand" "")))
822 (sign_extend:DI (match_operand:SI 2 "nonimmediate_operand" "")))
823 (parallel [(set (match_dup 5)
824 (sign_extend:DI (udiv:SI (match_dup 3) (match_dup 4))))
825 (clobber (reg:DI 23))
826 (clobber (reg:DI 28))])
827 (set (match_operand:SI 0 "nonimmediate_operand" "")
828 (subreg:SI (match_dup 5) 0))]
829 "! TARGET_ABI_OPEN_VMS && ! TARGET_ABI_UNICOSMK"
831 operands[3] = gen_reg_rtx (DImode);
832 operands[4] = gen_reg_rtx (DImode);
833 operands[5] = gen_reg_rtx (DImode);
836 (define_expand "modsi3"
838 (sign_extend:DI (match_operand:SI 1 "nonimmediate_operand" "")))
840 (sign_extend:DI (match_operand:SI 2 "nonimmediate_operand" "")))
841 (parallel [(set (match_dup 5)
842 (sign_extend:DI (mod:SI (match_dup 3) (match_dup 4))))
843 (clobber (reg:DI 23))
844 (clobber (reg:DI 28))])
845 (set (match_operand:SI 0 "nonimmediate_operand" "")
846 (subreg:SI (match_dup 5) 0))]
847 "! TARGET_ABI_OPEN_VMS && ! TARGET_ABI_UNICOSMK"
849 operands[3] = gen_reg_rtx (DImode);
850 operands[4] = gen_reg_rtx (DImode);
851 operands[5] = gen_reg_rtx (DImode);
854 (define_expand "umodsi3"
856 (sign_extend:DI (match_operand:SI 1 "nonimmediate_operand" "")))
858 (sign_extend:DI (match_operand:SI 2 "nonimmediate_operand" "")))
859 (parallel [(set (match_dup 5)
860 (sign_extend:DI (umod:SI (match_dup 3) (match_dup 4))))
861 (clobber (reg:DI 23))
862 (clobber (reg:DI 28))])
863 (set (match_operand:SI 0 "nonimmediate_operand" "")
864 (subreg:SI (match_dup 5) 0))]
865 "! TARGET_ABI_OPEN_VMS && ! TARGET_ABI_UNICOSMK"
867 operands[3] = gen_reg_rtx (DImode);
868 operands[4] = gen_reg_rtx (DImode);
869 operands[5] = gen_reg_rtx (DImode);
872 (define_expand "divdi3"
873 [(parallel [(set (match_operand:DI 0 "register_operand" "")
874 (div:DI (match_operand:DI 1 "register_operand" "")
875 (match_operand:DI 2 "register_operand" "")))
876 (clobber (reg:DI 23))
877 (clobber (reg:DI 28))])]
878 "! TARGET_ABI_OPEN_VMS && ! TARGET_ABI_UNICOSMK"
881 (define_expand "udivdi3"
882 [(parallel [(set (match_operand:DI 0 "register_operand" "")
883 (udiv:DI (match_operand:DI 1 "register_operand" "")
884 (match_operand:DI 2 "register_operand" "")))
885 (clobber (reg:DI 23))
886 (clobber (reg:DI 28))])]
887 "! TARGET_ABI_OPEN_VMS && ! TARGET_ABI_UNICOSMK"
890 (define_expand "moddi3"
891 [(use (match_operand:DI 0 "register_operand" ""))
892 (use (match_operand:DI 1 "register_operand" ""))
893 (use (match_operand:DI 2 "register_operand" ""))]
894 "!TARGET_ABI_OPEN_VMS"
896 if (TARGET_ABI_UNICOSMK)
897 emit_insn (gen_moddi3_umk (operands[0], operands[1], operands[2]));
899 emit_insn (gen_moddi3_dft (operands[0], operands[1], operands[2]));
903 (define_expand "moddi3_dft"
904 [(parallel [(set (match_operand:DI 0 "register_operand" "")
905 (mod:DI (match_operand:DI 1 "register_operand" "")
906 (match_operand:DI 2 "register_operand" "")))
907 (clobber (reg:DI 23))
908 (clobber (reg:DI 28))])]
909 "! TARGET_ABI_OPEN_VMS && ! TARGET_ABI_UNICOSMK"
912 ;; On Unicos/Mk, we do as the system's C compiler does:
913 ;; compute the quotient, multiply and subtract.
915 (define_expand "moddi3_umk"
916 [(use (match_operand:DI 0 "register_operand" ""))
917 (use (match_operand:DI 1 "register_operand" ""))
918 (use (match_operand:DI 2 "register_operand" ""))]
919 "TARGET_ABI_UNICOSMK"
921 rtx div, mul = gen_reg_rtx (DImode);
923 div = expand_binop (DImode, sdiv_optab, operands[1], operands[2],
924 NULL_RTX, 0, OPTAB_LIB);
925 div = force_reg (DImode, div);
926 emit_insn (gen_muldi3 (mul, operands[2], div));
927 emit_insn (gen_subdi3 (operands[0], operands[1], mul));
931 (define_expand "umoddi3"
932 [(use (match_operand:DI 0 "register_operand" ""))
933 (use (match_operand:DI 1 "register_operand" ""))
934 (use (match_operand:DI 2 "register_operand" ""))]
935 "! TARGET_ABI_OPEN_VMS"
937 if (TARGET_ABI_UNICOSMK)
938 emit_insn (gen_umoddi3_umk (operands[0], operands[1], operands[2]));
940 emit_insn (gen_umoddi3_dft (operands[0], operands[1], operands[2]));
944 (define_expand "umoddi3_dft"
945 [(parallel [(set (match_operand:DI 0 "register_operand" "")
946 (umod:DI (match_operand:DI 1 "register_operand" "")
947 (match_operand:DI 2 "register_operand" "")))
948 (clobber (reg:DI 23))
949 (clobber (reg:DI 28))])]
950 "! TARGET_ABI_OPEN_VMS && ! TARGET_ABI_UNICOSMK"
953 (define_expand "umoddi3_umk"
954 [(use (match_operand:DI 0 "register_operand" ""))
955 (use (match_operand:DI 1 "register_operand" ""))
956 (use (match_operand:DI 2 "register_operand" ""))]
957 "TARGET_ABI_UNICOSMK"
959 rtx div, mul = gen_reg_rtx (DImode);
961 div = expand_binop (DImode, udiv_optab, operands[1], operands[2],
962 NULL_RTX, 1, OPTAB_LIB);
963 div = force_reg (DImode, div);
964 emit_insn (gen_muldi3 (mul, operands[2], div));
965 emit_insn (gen_subdi3 (operands[0], operands[1], mul));
969 ;; Lengths of 8 for ldq $t12,__divq($gp); jsr $t9,($t12),__divq as
970 ;; expanded by the assembler.
972 (define_insn_and_split "*divmodsi_internal_er"
973 [(set (match_operand:DI 0 "register_operand" "=c")
974 (sign_extend:DI (match_operator:SI 3 "divmod_operator"
975 [(match_operand:DI 1 "register_operand" "a")
976 (match_operand:DI 2 "register_operand" "b")])))
977 (clobber (reg:DI 23))
978 (clobber (reg:DI 28))]
979 "TARGET_EXPLICIT_RELOCS && ! TARGET_ABI_OPEN_VMS"
981 "&& reload_completed"
982 [(parallel [(set (match_dup 0)
983 (sign_extend:DI (match_dup 3)))
986 (clobber (reg:DI 23))
987 (clobber (reg:DI 28))])]
990 switch (GET_CODE (operands[3]))
1007 operands[4] = GEN_INT (alpha_next_sequence_number++);
1008 emit_insn (gen_movdi_er_high_g (operands[0], pic_offset_table_rtx,
1009 gen_rtx_SYMBOL_REF (DImode, str),
1012 [(set_attr "type" "jsr")
1013 (set_attr "length" "8")])
1015 (define_insn "*divmodsi_internal_er_1"
1016 [(set (match_operand:DI 0 "register_operand" "=c")
1017 (sign_extend:DI (match_operator:SI 3 "divmod_operator"
1018 [(match_operand:DI 1 "register_operand" "a")
1019 (match_operand:DI 2 "register_operand" "b")])))
1020 (use (match_operand:DI 4 "register_operand" "c"))
1021 (use (match_operand 5 "const_int_operand" ""))
1022 (clobber (reg:DI 23))
1023 (clobber (reg:DI 28))]
1024 "TARGET_EXPLICIT_RELOCS && ! TARGET_ABI_OPEN_VMS"
1025 "jsr $23,($27),__%E3%j5"
1026 [(set_attr "type" "jsr")
1027 (set_attr "length" "4")])
1029 (define_insn "*divmodsi_internal"
1030 [(set (match_operand:DI 0 "register_operand" "=c")
1031 (sign_extend:DI (match_operator:SI 3 "divmod_operator"
1032 [(match_operand:DI 1 "register_operand" "a")
1033 (match_operand:DI 2 "register_operand" "b")])))
1034 (clobber (reg:DI 23))
1035 (clobber (reg:DI 28))]
1036 "! TARGET_ABI_OPEN_VMS && ! TARGET_ABI_UNICOSMK"
1038 [(set_attr "type" "jsr")
1039 (set_attr "length" "8")])
1041 (define_insn_and_split "*divmoddi_internal_er"
1042 [(set (match_operand:DI 0 "register_operand" "=c")
1043 (match_operator:DI 3 "divmod_operator"
1044 [(match_operand:DI 1 "register_operand" "a")
1045 (match_operand:DI 2 "register_operand" "b")]))
1046 (clobber (reg:DI 23))
1047 (clobber (reg:DI 28))]
1048 "TARGET_EXPLICIT_RELOCS && ! TARGET_ABI_OPEN_VMS"
1050 "&& reload_completed"
1051 [(parallel [(set (match_dup 0) (match_dup 3))
1054 (clobber (reg:DI 23))
1055 (clobber (reg:DI 28))])]
1058 switch (GET_CODE (operands[3]))
1075 operands[4] = GEN_INT (alpha_next_sequence_number++);
1076 emit_insn (gen_movdi_er_high_g (operands[0], pic_offset_table_rtx,
1077 gen_rtx_SYMBOL_REF (DImode, str),
1080 [(set_attr "type" "jsr")
1081 (set_attr "length" "8")])
1083 (define_insn "*divmoddi_internal_er_1"
1084 [(set (match_operand:DI 0 "register_operand" "=c")
1085 (match_operator:DI 3 "divmod_operator"
1086 [(match_operand:DI 1 "register_operand" "a")
1087 (match_operand:DI 2 "register_operand" "b")]))
1088 (use (match_operand:DI 4 "register_operand" "c"))
1089 (use (match_operand 5 "const_int_operand" ""))
1090 (clobber (reg:DI 23))
1091 (clobber (reg:DI 28))]
1092 "TARGET_EXPLICIT_RELOCS && ! TARGET_ABI_OPEN_VMS"
1093 "jsr $23,($27),__%E3%j5"
1094 [(set_attr "type" "jsr")
1095 (set_attr "length" "4")])
1097 (define_insn "*divmoddi_internal"
1098 [(set (match_operand:DI 0 "register_operand" "=c")
1099 (match_operator:DI 3 "divmod_operator"
1100 [(match_operand:DI 1 "register_operand" "a")
1101 (match_operand:DI 2 "register_operand" "b")]))
1102 (clobber (reg:DI 23))
1103 (clobber (reg:DI 28))]
1104 "! TARGET_ABI_OPEN_VMS && ! TARGET_ABI_UNICOSMK"
1106 [(set_attr "type" "jsr")
1107 (set_attr "length" "8")])
1109 ;; Next are the basic logical operations. We only expose the DImode operations
1110 ;; to the rtl expanders, but SImode versions exist for combine as well as for
1111 ;; the atomic operation splitters.
1113 (define_insn "*andsi_internal"
1114 [(set (match_operand:SI 0 "register_operand" "=r,r,r")
1115 (and:SI (match_operand:SI 1 "reg_or_0_operand" "%rJ,rJ,rJ")
1116 (match_operand:SI 2 "and_operand" "rI,N,MH")))]
1122 [(set_attr "type" "ilog,ilog,shift")])
1124 (define_insn "anddi3"
1125 [(set (match_operand:DI 0 "register_operand" "=r,r,r")
1126 (and:DI (match_operand:DI 1 "reg_or_0_operand" "%rJ,rJ,rJ")
1127 (match_operand:DI 2 "and_operand" "rI,N,MH")))]
1133 [(set_attr "type" "ilog,ilog,shift")])
1135 ;; There are times when we can split an AND into two AND insns. This occurs
1136 ;; when we can first clear any bytes and then clear anything else. For
1137 ;; example "I & 0xffff07" is "(I & 0xffffff) & 0xffffffffffffff07".
1138 ;; Only do this when running on 64-bit host since the computations are
1139 ;; too messy otherwise.
1142 [(set (match_operand:DI 0 "register_operand" "")
1143 (and:DI (match_operand:DI 1 "register_operand" "")
1144 (match_operand:DI 2 "const_int_operand" "")))]
1145 "HOST_BITS_PER_WIDE_INT == 64 && ! and_operand (operands[2], DImode)"
1146 [(set (match_dup 0) (and:DI (match_dup 1) (match_dup 3)))
1147 (set (match_dup 0) (and:DI (match_dup 0) (match_dup 4)))]
1149 unsigned HOST_WIDE_INT mask1 = INTVAL (operands[2]);
1150 unsigned HOST_WIDE_INT mask2 = mask1;
1153 /* For each byte that isn't all zeros, make it all ones. */
1154 for (i = 0; i < 64; i += 8)
1155 if ((mask1 & ((HOST_WIDE_INT) 0xff << i)) != 0)
1156 mask1 |= (HOST_WIDE_INT) 0xff << i;
1158 /* Now turn on any bits we've just turned off. */
1161 operands[3] = GEN_INT (mask1);
1162 operands[4] = GEN_INT (mask2);
1165 (define_expand "zero_extendqihi2"
1166 [(set (match_operand:HI 0 "register_operand" "")
1167 (zero_extend:HI (match_operand:QI 1 "nonimmediate_operand" "")))]
1171 operands[1] = force_reg (QImode, operands[1]);
1174 (define_insn "*zero_extendqihi2_bwx"
1175 [(set (match_operand:HI 0 "register_operand" "=r,r")
1176 (zero_extend:HI (match_operand:QI 1 "nonimmediate_operand" "r,m")))]
1181 [(set_attr "type" "ilog,ild")])
1183 (define_insn "*zero_extendqihi2_nobwx"
1184 [(set (match_operand:HI 0 "register_operand" "=r")
1185 (zero_extend:HI (match_operand:QI 1 "register_operand" "r")))]
1188 [(set_attr "type" "ilog")])
1190 (define_expand "zero_extendqisi2"
1191 [(set (match_operand:SI 0 "register_operand" "")
1192 (zero_extend:SI (match_operand:QI 1 "nonimmediate_operand" "")))]
1196 operands[1] = force_reg (QImode, operands[1]);
1199 (define_insn "*zero_extendqisi2_bwx"
1200 [(set (match_operand:SI 0 "register_operand" "=r,r")
1201 (zero_extend:SI (match_operand:QI 1 "nonimmediate_operand" "r,m")))]
1206 [(set_attr "type" "ilog,ild")])
1208 (define_insn "*zero_extendqisi2_nobwx"
1209 [(set (match_operand:SI 0 "register_operand" "=r")
1210 (zero_extend:SI (match_operand:QI 1 "register_operand" "r")))]
1213 [(set_attr "type" "ilog")])
1215 (define_expand "zero_extendqidi2"
1216 [(set (match_operand:DI 0 "register_operand" "")
1217 (zero_extend:DI (match_operand:QI 1 "nonimmediate_operand" "")))]
1221 operands[1] = force_reg (QImode, operands[1]);
1224 (define_insn "*zero_extendqidi2_bwx"
1225 [(set (match_operand:DI 0 "register_operand" "=r,r")
1226 (zero_extend:DI (match_operand:QI 1 "nonimmediate_operand" "r,m")))]
1231 [(set_attr "type" "ilog,ild")])
1233 (define_insn "*zero_extendqidi2_nobwx"
1234 [(set (match_operand:DI 0 "register_operand" "=r")
1235 (zero_extend:DI (match_operand:QI 1 "register_operand" "r")))]
1238 [(set_attr "type" "ilog")])
1240 (define_expand "zero_extendhisi2"
1241 [(set (match_operand:SI 0 "register_operand" "")
1242 (zero_extend:SI (match_operand:HI 1 "nonimmediate_operand" "")))]
1246 operands[1] = force_reg (HImode, operands[1]);
1249 (define_insn "*zero_extendhisi2_bwx"
1250 [(set (match_operand:SI 0 "register_operand" "=r,r")
1251 (zero_extend:SI (match_operand:HI 1 "nonimmediate_operand" "r,m")))]
1256 [(set_attr "type" "shift,ild")])
1258 (define_insn "*zero_extendhisi2_nobwx"
1259 [(set (match_operand:SI 0 "register_operand" "=r")
1260 (zero_extend:SI (match_operand:HI 1 "register_operand" "r")))]
1263 [(set_attr "type" "shift")])
1265 (define_expand "zero_extendhidi2"
1266 [(set (match_operand:DI 0 "register_operand" "")
1267 (zero_extend:DI (match_operand:HI 1 "nonimmediate_operand" "")))]
1271 operands[1] = force_reg (HImode, operands[1]);
1274 (define_insn "*zero_extendhidi2_bwx"
1275 [(set (match_operand:DI 0 "register_operand" "=r,r")
1276 (zero_extend:DI (match_operand:HI 1 "nonimmediate_operand" "r,m")))]
1281 [(set_attr "type" "shift,ild")])
1283 (define_insn "*zero_extendhidi2_nobwx"
1284 [(set (match_operand:DI 0 "register_operand" "=r")
1285 (zero_extend:DI (match_operand:HI 1 "register_operand" "r")))]
1288 [(set_attr "type" "shift")])
1290 (define_insn "zero_extendsidi2"
1291 [(set (match_operand:DI 0 "register_operand" "=r")
1292 (zero_extend:DI (match_operand:SI 1 "register_operand" "r")))]
1295 [(set_attr "type" "shift")])
1297 (define_insn "*andnotsi3"
1298 [(set (match_operand:SI 0 "register_operand" "=r")
1299 (and:SI (not:SI (match_operand:SI 1 "reg_or_8bit_operand" "rI"))
1300 (match_operand:SI 2 "reg_or_0_operand" "rJ")))]
1303 [(set_attr "type" "ilog")])
1305 (define_insn "andnotdi3"
1306 [(set (match_operand:DI 0 "register_operand" "=r")
1307 (and:DI (not:DI (match_operand:DI 1 "reg_or_8bit_operand" "rI"))
1308 (match_operand:DI 2 "reg_or_0_operand" "rJ")))]
1311 [(set_attr "type" "ilog")])
1313 (define_insn "*iorsi_internal"
1314 [(set (match_operand:SI 0 "register_operand" "=r,r")
1315 (ior:SI (match_operand:SI 1 "reg_or_0_operand" "%rJ,rJ")
1316 (match_operand:SI 2 "or_operand" "rI,N")))]
1321 [(set_attr "type" "ilog")])
1323 (define_insn "iordi3"
1324 [(set (match_operand:DI 0 "register_operand" "=r,r")
1325 (ior:DI (match_operand:DI 1 "reg_or_0_operand" "%rJ,rJ")
1326 (match_operand:DI 2 "or_operand" "rI,N")))]
1331 [(set_attr "type" "ilog")])
1333 (define_insn "*one_cmplsi_internal"
1334 [(set (match_operand:SI 0 "register_operand" "=r")
1335 (not:SI (match_operand:SI 1 "reg_or_8bit_operand" "rI")))]
1338 [(set_attr "type" "ilog")])
1340 (define_insn "one_cmpldi2"
1341 [(set (match_operand:DI 0 "register_operand" "=r")
1342 (not:DI (match_operand:DI 1 "reg_or_8bit_operand" "rI")))]
1345 [(set_attr "type" "ilog")])
1347 (define_insn "*iornotsi3"
1348 [(set (match_operand:SI 0 "register_operand" "=r")
1349 (ior:SI (not:SI (match_operand:SI 1 "reg_or_8bit_operand" "rI"))
1350 (match_operand:SI 2 "reg_or_0_operand" "rJ")))]
1353 [(set_attr "type" "ilog")])
1355 (define_insn "*iornotdi3"
1356 [(set (match_operand:DI 0 "register_operand" "=r")
1357 (ior:DI (not:DI (match_operand:DI 1 "reg_or_8bit_operand" "rI"))
1358 (match_operand:DI 2 "reg_or_0_operand" "rJ")))]
1361 [(set_attr "type" "ilog")])
1363 (define_insn "*xorsi_internal"
1364 [(set (match_operand:SI 0 "register_operand" "=r,r")
1365 (xor:SI (match_operand:SI 1 "reg_or_0_operand" "%rJ,rJ")
1366 (match_operand:SI 2 "or_operand" "rI,N")))]
1371 [(set_attr "type" "ilog")])
1373 (define_insn "xordi3"
1374 [(set (match_operand:DI 0 "register_operand" "=r,r")
1375 (xor:DI (match_operand:DI 1 "reg_or_0_operand" "%rJ,rJ")
1376 (match_operand:DI 2 "or_operand" "rI,N")))]
1381 [(set_attr "type" "ilog")])
1383 (define_insn "*xornotsi3"
1384 [(set (match_operand:SI 0 "register_operand" "=r")
1385 (not:SI (xor:SI (match_operand:SI 1 "register_operand" "%rJ")
1386 (match_operand:SI 2 "register_operand" "rI"))))]
1389 [(set_attr "type" "ilog")])
1391 (define_insn "*xornotdi3"
1392 [(set (match_operand:DI 0 "register_operand" "=r")
1393 (not:DI (xor:DI (match_operand:DI 1 "register_operand" "%rJ")
1394 (match_operand:DI 2 "register_operand" "rI"))))]
1397 [(set_attr "type" "ilog")])
1399 ;; Handle FFS and related insns iff we support CIX.
1401 (define_expand "ffsdi2"
1403 (ctz:DI (match_operand:DI 1 "register_operand" "")))
1405 (plus:DI (match_dup 2) (const_int 1)))
1406 (set (match_operand:DI 0 "register_operand" "")
1407 (if_then_else:DI (eq (match_dup 1) (const_int 0))
1408 (const_int 0) (match_dup 3)))]
1411 operands[2] = gen_reg_rtx (DImode);
1412 operands[3] = gen_reg_rtx (DImode);
1415 (define_insn "clzdi2"
1416 [(set (match_operand:DI 0 "register_operand" "=r")
1417 (clz:DI (match_operand:DI 1 "register_operand" "r")))]
1420 [(set_attr "type" "mvi")])
1422 (define_insn "ctzdi2"
1423 [(set (match_operand:DI 0 "register_operand" "=r")
1424 (ctz:DI (match_operand:DI 1 "register_operand" "r")))]
1427 [(set_attr "type" "mvi")])
1429 (define_insn "popcountdi2"
1430 [(set (match_operand:DI 0 "register_operand" "=r")
1431 (popcount:DI (match_operand:DI 1 "register_operand" "r")))]
1434 [(set_attr "type" "mvi")])
1436 (define_expand "bswapsi2"
1437 [(set (match_operand:SI 0 "register_operand" "")
1438 (bswap:SI (match_operand:SI 1 "register_operand" "")))]
1443 t0 = gen_reg_rtx (DImode);
1444 t1 = gen_reg_rtx (DImode);
1446 emit_insn (gen_insxh (t0, gen_lowpart (DImode, operands[1]),
1447 GEN_INT (32), GEN_INT (WORDS_BIG_ENDIAN ? 0 : 7)));
1448 emit_insn (gen_inswl_const (t1, gen_lowpart (HImode, operands[1]),
1450 emit_insn (gen_iordi3 (t1, t0, t1));
1451 emit_insn (gen_lshrdi3 (t0, t1, GEN_INT (16)));
1452 emit_insn (gen_anddi3 (t1, t1, alpha_expand_zap_mask (0x5)));
1453 emit_insn (gen_anddi3 (t0, t0, alpha_expand_zap_mask (0xa)));
1454 emit_insn (gen_addsi3 (operands[0], gen_lowpart (SImode, t0),
1455 gen_lowpart (SImode, t1)));
1459 (define_expand "bswapdi2"
1460 [(set (match_operand:DI 0 "register_operand" "")
1461 (bswap:DI (match_operand:DI 1 "register_operand" "")))]
1466 t0 = gen_reg_rtx (DImode);
1467 t1 = gen_reg_rtx (DImode);
1469 /* This method of shifting and masking is not specific to Alpha, but
1470 is only profitable on Alpha because of our handy byte zap insn. */
1472 emit_insn (gen_lshrdi3 (t0, operands[1], GEN_INT (32)));
1473 emit_insn (gen_ashldi3 (t1, operands[1], GEN_INT (32)));
1474 emit_insn (gen_iordi3 (t1, t0, t1));
1476 emit_insn (gen_lshrdi3 (t0, t1, GEN_INT (16)));
1477 emit_insn (gen_ashldi3 (t1, t1, GEN_INT (16)));
1478 emit_insn (gen_anddi3 (t0, t0, alpha_expand_zap_mask (0xcc)));
1479 emit_insn (gen_anddi3 (t1, t1, alpha_expand_zap_mask (0x33)));
1480 emit_insn (gen_iordi3 (t1, t0, t1));
1482 emit_insn (gen_lshrdi3 (t0, t1, GEN_INT (8)));
1483 emit_insn (gen_ashldi3 (t1, t1, GEN_INT (8)));
1484 emit_insn (gen_anddi3 (t0, t0, alpha_expand_zap_mask (0xaa)));
1485 emit_insn (gen_anddi3 (t1, t1, alpha_expand_zap_mask (0x55)));
1486 emit_insn (gen_iordi3 (operands[0], t0, t1));
1490 ;; Next come the shifts and the various extract and insert operations.
1492 (define_insn "ashldi3"
1493 [(set (match_operand:DI 0 "register_operand" "=r,r")
1494 (ashift:DI (match_operand:DI 1 "reg_or_0_operand" "rJ,rJ")
1495 (match_operand:DI 2 "reg_or_6bit_operand" "P,rS")))]
1498 switch (which_alternative)
1501 if (operands[2] == const1_rtx)
1502 return "addq %r1,%r1,%0";
1504 return "s%P2addq %r1,0,%0";
1506 return "sll %r1,%2,%0";
1511 [(set_attr "type" "iadd,shift")])
1513 (define_insn "*ashldi_se"
1514 [(set (match_operand:DI 0 "register_operand" "=r")
1516 (subreg:SI (ashift:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
1517 (match_operand:DI 2 "const_int_operand" "P"))
1519 "INTVAL (operands[2]) >= 1 && INTVAL (operands[2]) <= 3"
1521 if (operands[2] == const1_rtx)
1522 return "addl %r1,%r1,%0";
1524 return "s%P2addl %r1,0,%0";
1526 [(set_attr "type" "iadd")])
1528 (define_insn "lshrdi3"
1529 [(set (match_operand:DI 0 "register_operand" "=r")
1530 (lshiftrt:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
1531 (match_operand:DI 2 "reg_or_6bit_operand" "rS")))]
1534 [(set_attr "type" "shift")])
1536 (define_insn "ashrdi3"
1537 [(set (match_operand:DI 0 "register_operand" "=r")
1538 (ashiftrt:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
1539 (match_operand:DI 2 "reg_or_6bit_operand" "rS")))]
1542 [(set_attr "type" "shift")])
1544 (define_expand "extendqihi2"
1546 (ashift:DI (match_operand:QI 1 "some_operand" "")
1548 (set (match_operand:HI 0 "register_operand" "")
1549 (ashiftrt:DI (match_dup 2)
1555 emit_insn (gen_extendqihi2x (operands[0],
1556 force_reg (QImode, operands[1])));
1560 /* If we have an unaligned MEM, extend to DImode (which we do
1561 specially) and then copy to the result. */
1562 if (unaligned_memory_operand (operands[1], HImode))
1564 rtx temp = gen_reg_rtx (DImode);
1566 emit_insn (gen_extendqidi2 (temp, operands[1]));
1567 emit_move_insn (operands[0], gen_lowpart (HImode, temp));
1571 operands[0] = gen_lowpart (DImode, operands[0]);
1572 operands[1] = gen_lowpart (DImode, force_reg (QImode, operands[1]));
1573 operands[2] = gen_reg_rtx (DImode);
1576 (define_insn "extendqidi2x"
1577 [(set (match_operand:DI 0 "register_operand" "=r")
1578 (sign_extend:DI (match_operand:QI 1 "register_operand" "r")))]
1581 [(set_attr "type" "shift")])
1583 (define_insn "extendhidi2x"
1584 [(set (match_operand:DI 0 "register_operand" "=r")
1585 (sign_extend:DI (match_operand:HI 1 "register_operand" "r")))]
1588 [(set_attr "type" "shift")])
1590 (define_insn "extendqisi2x"
1591 [(set (match_operand:SI 0 "register_operand" "=r")
1592 (sign_extend:SI (match_operand:QI 1 "register_operand" "r")))]
1595 [(set_attr "type" "shift")])
1597 (define_insn "extendhisi2x"
1598 [(set (match_operand:SI 0 "register_operand" "=r")
1599 (sign_extend:SI (match_operand:HI 1 "register_operand" "r")))]
1602 [(set_attr "type" "shift")])
1604 (define_insn "extendqihi2x"
1605 [(set (match_operand:HI 0 "register_operand" "=r")
1606 (sign_extend:HI (match_operand:QI 1 "register_operand" "r")))]
1609 [(set_attr "type" "shift")])
1611 (define_expand "extendqisi2"
1613 (ashift:DI (match_operand:QI 1 "some_operand" "")
1615 (set (match_operand:SI 0 "register_operand" "")
1616 (ashiftrt:DI (match_dup 2)
1622 emit_insn (gen_extendqisi2x (operands[0],
1623 force_reg (QImode, operands[1])));
1627 /* If we have an unaligned MEM, extend to a DImode form of
1628 the result (which we do specially). */
1629 if (unaligned_memory_operand (operands[1], QImode))
1631 rtx temp = gen_reg_rtx (DImode);
1633 emit_insn (gen_extendqidi2 (temp, operands[1]));
1634 emit_move_insn (operands[0], gen_lowpart (SImode, temp));
1638 operands[0] = gen_lowpart (DImode, operands[0]);
1639 operands[1] = gen_lowpart (DImode, force_reg (QImode, operands[1]));
1640 operands[2] = gen_reg_rtx (DImode);
1643 (define_expand "extendqidi2"
1645 (ashift:DI (match_operand:QI 1 "some_operand" "")
1647 (set (match_operand:DI 0 "register_operand" "")
1648 (ashiftrt:DI (match_dup 2)
1654 emit_insn (gen_extendqidi2x (operands[0],
1655 force_reg (QImode, operands[1])));
1659 if (unaligned_memory_operand (operands[1], QImode))
1661 rtx seq = gen_unaligned_extendqidi (operands[0], XEXP (operands[1], 0));
1662 alpha_set_memflags (seq, operands[1]);
1667 operands[1] = gen_lowpart (DImode, force_reg (QImode, operands[1]));
1668 operands[2] = gen_reg_rtx (DImode);
1671 (define_expand "extendhisi2"
1673 (ashift:DI (match_operand:HI 1 "some_operand" "")
1675 (set (match_operand:SI 0 "register_operand" "")
1676 (ashiftrt:DI (match_dup 2)
1682 emit_insn (gen_extendhisi2x (operands[0],
1683 force_reg (HImode, operands[1])));
1687 /* If we have an unaligned MEM, extend to a DImode form of
1688 the result (which we do specially). */
1689 if (unaligned_memory_operand (operands[1], HImode))
1691 rtx temp = gen_reg_rtx (DImode);
1693 emit_insn (gen_extendhidi2 (temp, operands[1]));
1694 emit_move_insn (operands[0], gen_lowpart (SImode, temp));
1698 operands[0] = gen_lowpart (DImode, operands[0]);
1699 operands[1] = gen_lowpart (DImode, force_reg (HImode, operands[1]));
1700 operands[2] = gen_reg_rtx (DImode);
1703 (define_expand "extendhidi2"
1705 (ashift:DI (match_operand:HI 1 "some_operand" "")
1707 (set (match_operand:DI 0 "register_operand" "")
1708 (ashiftrt:DI (match_dup 2)
1714 emit_insn (gen_extendhidi2x (operands[0],
1715 force_reg (HImode, operands[1])));
1719 if (unaligned_memory_operand (operands[1], HImode))
1721 rtx seq = gen_unaligned_extendhidi (operands[0], XEXP (operands[1], 0));
1723 alpha_set_memflags (seq, operands[1]);
1728 operands[1] = gen_lowpart (DImode, force_reg (HImode, operands[1]));
1729 operands[2] = gen_reg_rtx (DImode);
1732 ;; Here's how we sign extend an unaligned byte and halfword. Doing this
1733 ;; as a pattern saves one instruction. The code is similar to that for
1734 ;; the unaligned loads (see below).
1736 ;; Operand 1 is the address, operand 0 is the result.
1737 (define_expand "unaligned_extendqidi"
1738 [(use (match_operand:QI 0 "register_operand" ""))
1739 (use (match_operand:DI 1 "address_operand" ""))]
1742 operands[0] = gen_lowpart (DImode, operands[0]);
1743 if (WORDS_BIG_ENDIAN)
1744 emit_insn (gen_unaligned_extendqidi_be (operands[0], operands[1]));
1746 emit_insn (gen_unaligned_extendqidi_le (operands[0], operands[1]));
1750 (define_expand "unaligned_extendqidi_le"
1752 (mem:DI (and:DI (match_operand:DI 1 "" "") (const_int -8))))
1754 (ashift:DI (match_dup 3)
1755 (minus:DI (const_int 64)
1757 (and:DI (match_dup 2) (const_int 7))
1759 (set (match_operand:DI 0 "register_operand" "")
1760 (ashiftrt:DI (match_dup 4) (const_int 56)))]
1761 "! WORDS_BIG_ENDIAN"
1763 operands[2] = get_unaligned_offset (operands[1], 1);
1764 operands[3] = gen_reg_rtx (DImode);
1765 operands[4] = gen_reg_rtx (DImode);
1768 (define_expand "unaligned_extendqidi_be"
1770 (mem:DI (and:DI (match_operand:DI 1 "" "") (const_int -8))))
1772 (ashift:DI (match_dup 3)
1775 (plus:DI (match_dup 2) (const_int 1))
1778 (set (match_operand:DI 0 "register_operand" "")
1779 (ashiftrt:DI (match_dup 4) (const_int 56)))]
1782 operands[2] = get_unaligned_offset (operands[1], -1);
1783 operands[3] = gen_reg_rtx (DImode);
1784 operands[4] = gen_reg_rtx (DImode);
1787 (define_expand "unaligned_extendhidi"
1788 [(use (match_operand:QI 0 "register_operand" ""))
1789 (use (match_operand:DI 1 "address_operand" ""))]
1792 operands[0] = gen_lowpart (DImode, operands[0]);
1793 if (WORDS_BIG_ENDIAN)
1794 emit_insn (gen_unaligned_extendhidi_be (operands[0], operands[1]));
1796 emit_insn (gen_unaligned_extendhidi_le (operands[0], operands[1]));
1800 (define_expand "unaligned_extendhidi_le"
1802 (mem:DI (and:DI (match_operand:DI 1 "" "") (const_int -8))))
1804 (ashift:DI (match_dup 3)
1805 (minus:DI (const_int 64)
1807 (and:DI (match_dup 2) (const_int 7))
1809 (set (match_operand:DI 0 "register_operand" "")
1810 (ashiftrt:DI (match_dup 4) (const_int 48)))]
1811 "! WORDS_BIG_ENDIAN"
1813 operands[2] = get_unaligned_offset (operands[1], 2);
1814 operands[3] = gen_reg_rtx (DImode);
1815 operands[4] = gen_reg_rtx (DImode);
1818 (define_expand "unaligned_extendhidi_be"
1820 (mem:DI (and:DI (match_operand:DI 1 "" "") (const_int -8))))
1822 (ashift:DI (match_dup 3)
1825 (plus:DI (match_dup 2) (const_int 1))
1828 (set (match_operand:DI 0 "register_operand" "")
1829 (ashiftrt:DI (match_dup 4) (const_int 48)))]
1832 operands[2] = get_unaligned_offset (operands[1], -1);
1833 operands[3] = gen_reg_rtx (DImode);
1834 operands[4] = gen_reg_rtx (DImode);
1837 (define_insn "*extxl_const"
1838 [(set (match_operand:DI 0 "register_operand" "=r")
1839 (zero_extract:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
1840 (match_operand:DI 2 "mode_width_operand" "n")
1841 (match_operand:DI 3 "mul8_operand" "I")))]
1843 "ext%M2l %r1,%s3,%0"
1844 [(set_attr "type" "shift")])
1846 (define_insn "extxl_le"
1847 [(set (match_operand:DI 0 "register_operand" "=r")
1848 (zero_extract:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
1849 (match_operand:DI 2 "mode_width_operand" "n")
1850 (ashift:DI (match_operand:DI 3 "reg_or_8bit_operand" "rI")
1852 "! WORDS_BIG_ENDIAN"
1854 [(set_attr "type" "shift")])
1856 (define_insn "extxl_be"
1857 [(set (match_operand:DI 0 "register_operand" "=r")
1858 (zero_extract:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
1859 (match_operand:DI 2 "mode_width_operand" "n")
1863 (match_operand:DI 3 "reg_or_8bit_operand" "rI")
1867 [(set_attr "type" "shift")])
1869 ;; Combine has some strange notion of preserving existing undefined behavior
1870 ;; in shifts larger than a word size. So capture these patterns that it
1871 ;; should have turned into zero_extracts.
1873 (define_insn "*extxl_1_le"
1874 [(set (match_operand:DI 0 "register_operand" "=r")
1875 (and:DI (lshiftrt:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
1876 (ashift:DI (match_operand:DI 2 "reg_or_8bit_operand" "rI")
1878 (match_operand:DI 3 "mode_mask_operand" "n")))]
1879 "! WORDS_BIG_ENDIAN"
1881 [(set_attr "type" "shift")])
1883 (define_insn "*extxl_1_be"
1884 [(set (match_operand:DI 0 "register_operand" "=r")
1885 (and:DI (lshiftrt:DI
1886 (match_operand:DI 1 "reg_or_0_operand" "rJ")
1887 (minus:DI (const_int 56)
1888 (ashift:DI (match_operand:DI 2 "reg_or_8bit_operand" "rI")
1890 (match_operand:DI 3 "mode_mask_operand" "n")))]
1893 [(set_attr "type" "shift")])
1895 (define_insn "*extql_2_le"
1896 [(set (match_operand:DI 0 "register_operand" "=r")
1897 (lshiftrt:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
1898 (ashift:DI (match_operand:DI 2 "reg_or_8bit_operand" "rI")
1900 "! WORDS_BIG_ENDIAN"
1902 [(set_attr "type" "shift")])
1904 (define_insn "*extql_2_be"
1905 [(set (match_operand:DI 0 "register_operand" "=r")
1907 (match_operand:DI 1 "reg_or_0_operand" "rJ")
1908 (minus:DI (const_int 56)
1910 (match_operand:DI 2 "reg_or_8bit_operand" "rI")
1914 [(set_attr "type" "shift")])
1916 (define_insn "extqh_le"
1917 [(set (match_operand:DI 0 "register_operand" "=r")
1919 (match_operand:DI 1 "reg_or_0_operand" "rJ")
1920 (minus:DI (const_int 64)
1923 (match_operand:DI 2 "reg_or_8bit_operand" "rI")
1926 "! WORDS_BIG_ENDIAN"
1928 [(set_attr "type" "shift")])
1930 (define_insn "extqh_be"
1931 [(set (match_operand:DI 0 "register_operand" "=r")
1933 (match_operand:DI 1 "reg_or_0_operand" "rJ")
1936 (plus:DI (match_operand:DI 2 "reg_or_8bit_operand" "rI")
1942 [(set_attr "type" "shift")])
1944 (define_insn "extlh_le"
1945 [(set (match_operand:DI 0 "register_operand" "=r")
1947 (and:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
1948 (const_int 2147483647))
1949 (minus:DI (const_int 64)
1952 (match_operand:DI 2 "reg_or_8bit_operand" "rI")
1955 "! WORDS_BIG_ENDIAN"
1957 [(set_attr "type" "shift")])
1959 (define_insn "extlh_be"
1960 [(set (match_operand:DI 0 "register_operand" "=r")
1963 (match_operand:DI 1 "reg_or_0_operand" "rJ")
1967 (match_operand:DI 2 "reg_or_8bit_operand" "rI")
1971 (const_int 2147483647)))]
1974 [(set_attr "type" "shift")])
1976 (define_insn "extwh_le"
1977 [(set (match_operand:DI 0 "register_operand" "=r")
1979 (and:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
1981 (minus:DI (const_int 64)
1984 (match_operand:DI 2 "reg_or_8bit_operand" "rI")
1987 "! WORDS_BIG_ENDIAN"
1989 [(set_attr "type" "shift")])
1991 (define_insn "extwh_be"
1992 [(set (match_operand:DI 0 "register_operand" "=r")
1994 (ashift:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
1998 (match_operand:DI 2 "reg_or_8bit_operand" "rI")
2002 (const_int 65535)))]
2005 [(set_attr "type" "shift")])
2007 ;; This converts an extXl into an extXh with an appropriate adjustment
2008 ;; to the address calculation.
2011 ;; [(set (match_operand:DI 0 "register_operand" "")
2012 ;; (ashift:DI (zero_extract:DI (match_operand:DI 1 "register_operand" "")
2013 ;; (match_operand:DI 2 "mode_width_operand" "")
2014 ;; (ashift:DI (match_operand:DI 3 "" "")
2016 ;; (match_operand:DI 4 "const_int_operand" "")))
2017 ;; (clobber (match_operand:DI 5 "register_operand" ""))]
2018 ;; "INTVAL (operands[4]) == 64 - INTVAL (operands[2])"
2019 ;; [(set (match_dup 5) (match_dup 6))
2020 ;; (set (match_dup 0)
2021 ;; (ashift:DI (zero_extract:DI (match_dup 1) (match_dup 2)
2022 ;; (ashift:DI (plus:DI (match_dup 5)
2028 ;; operands[6] = plus_constant (operands[3],
2029 ;; INTVAL (operands[2]) / BITS_PER_UNIT);
2030 ;; operands[7] = GEN_INT (- INTVAL (operands[2]) / BITS_PER_UNIT);
2033 (define_insn "*insbl_const"
2034 [(set (match_operand:DI 0 "register_operand" "=r")
2035 (ashift:DI (zero_extend:DI (match_operand:QI 1 "register_operand" "r"))
2036 (match_operand:DI 2 "mul8_operand" "I")))]
2039 [(set_attr "type" "shift")])
2041 (define_insn "inswl_const"
2042 [(set (match_operand:DI 0 "register_operand" "=r")
2043 (ashift:DI (zero_extend:DI (match_operand:HI 1 "register_operand" "r"))
2044 (match_operand:DI 2 "mul8_operand" "I")))]
2047 [(set_attr "type" "shift")])
2049 (define_insn "*insll_const"
2050 [(set (match_operand:DI 0 "register_operand" "=r")
2051 (ashift:DI (zero_extend:DI (match_operand:SI 1 "register_operand" "r"))
2052 (match_operand:DI 2 "mul8_operand" "I")))]
2055 [(set_attr "type" "shift")])
2057 (define_insn "insbl_le"
2058 [(set (match_operand:DI 0 "register_operand" "=r")
2059 (ashift:DI (zero_extend:DI (match_operand:QI 1 "register_operand" "r"))
2060 (ashift:DI (match_operand:DI 2 "reg_or_8bit_operand" "rI")
2062 "! WORDS_BIG_ENDIAN"
2064 [(set_attr "type" "shift")])
2066 (define_insn "insbl_be"
2067 [(set (match_operand:DI 0 "register_operand" "=r")
2068 (ashift:DI (zero_extend:DI (match_operand:QI 1 "register_operand" "r"))
2069 (minus:DI (const_int 56)
2070 (ashift:DI (match_operand:DI 2 "reg_or_8bit_operand" "rI")
2074 [(set_attr "type" "shift")])
2076 (define_insn "inswl_le"
2077 [(set (match_operand:DI 0 "register_operand" "=r")
2078 (ashift:DI (zero_extend:DI (match_operand:HI 1 "register_operand" "r"))
2079 (ashift:DI (match_operand:DI 2 "reg_or_8bit_operand" "rI")
2081 "! WORDS_BIG_ENDIAN"
2083 [(set_attr "type" "shift")])
2085 (define_insn "inswl_be"
2086 [(set (match_operand:DI 0 "register_operand" "=r")
2087 (ashift:DI (zero_extend:DI (match_operand:HI 1 "register_operand" "r"))
2088 (minus:DI (const_int 56)
2089 (ashift:DI (match_operand:DI 2 "reg_or_8bit_operand" "rI")
2093 [(set_attr "type" "shift")])
2095 (define_insn "insll_le"
2096 [(set (match_operand:DI 0 "register_operand" "=r")
2097 (ashift:DI (zero_extend:DI (match_operand:SI 1 "register_operand" "r"))
2098 (ashift:DI (match_operand:DI 2 "reg_or_8bit_operand" "rI")
2100 "! WORDS_BIG_ENDIAN"
2102 [(set_attr "type" "shift")])
2104 (define_insn "insll_be"
2105 [(set (match_operand:DI 0 "register_operand" "=r")
2106 (ashift:DI (zero_extend:DI (match_operand:SI 1 "register_operand" "r"))
2107 (minus:DI (const_int 56)
2108 (ashift:DI (match_operand:DI 2 "reg_or_8bit_operand" "rI")
2112 [(set_attr "type" "shift")])
2114 (define_insn "insql_le"
2115 [(set (match_operand:DI 0 "register_operand" "=r")
2116 (ashift:DI (match_operand:DI 1 "register_operand" "r")
2117 (ashift:DI (match_operand:DI 2 "reg_or_8bit_operand" "rI")
2119 "! WORDS_BIG_ENDIAN"
2121 [(set_attr "type" "shift")])
2123 (define_insn "insql_be"
2124 [(set (match_operand:DI 0 "register_operand" "=r")
2125 (ashift:DI (match_operand:DI 1 "register_operand" "r")
2126 (minus:DI (const_int 56)
2127 (ashift:DI (match_operand:DI 2 "reg_or_8bit_operand" "rI")
2131 [(set_attr "type" "shift")])
2133 ;; Combine has this sometimes habit of moving the and outside of the
2134 ;; shift, making life more interesting.
2136 (define_insn "*insxl"
2137 [(set (match_operand:DI 0 "register_operand" "=r")
2138 (and:DI (ashift:DI (match_operand:DI 1 "register_operand" "r")
2139 (match_operand:DI 2 "mul8_operand" "I"))
2140 (match_operand:DI 3 "immediate_operand" "i")))]
2141 "HOST_BITS_PER_WIDE_INT == 64
2142 && CONST_INT_P (operands[3])
2143 && (((unsigned HOST_WIDE_INT) 0xff << INTVAL (operands[2])
2144 == (unsigned HOST_WIDE_INT) INTVAL (operands[3]))
2145 || ((unsigned HOST_WIDE_INT) 0xffff << INTVAL (operands[2])
2146 == (unsigned HOST_WIDE_INT) INTVAL (operands[3]))
2147 || ((unsigned HOST_WIDE_INT) 0xffffffff << INTVAL (operands[2])
2148 == (unsigned HOST_WIDE_INT) INTVAL (operands[3])))"
2150 #if HOST_BITS_PER_WIDE_INT == 64
2151 if ((unsigned HOST_WIDE_INT) 0xff << INTVAL (operands[2])
2152 == (unsigned HOST_WIDE_INT) INTVAL (operands[3]))
2153 return "insbl %1,%s2,%0";
2154 if ((unsigned HOST_WIDE_INT) 0xffff << INTVAL (operands[2])
2155 == (unsigned HOST_WIDE_INT) INTVAL (operands[3]))
2156 return "inswl %1,%s2,%0";
2157 if ((unsigned HOST_WIDE_INT) 0xffffffff << INTVAL (operands[2])
2158 == (unsigned HOST_WIDE_INT) INTVAL (operands[3]))
2159 return "insll %1,%s2,%0";
2163 [(set_attr "type" "shift")])
2165 ;; We do not include the insXh insns because they are complex to express
2166 ;; and it does not appear that we would ever want to generate them.
2168 ;; Since we need them for block moves, though, cop out and use unspec.
2170 (define_insn "insxh"
2171 [(set (match_operand:DI 0 "register_operand" "=r")
2172 (unspec:DI [(match_operand:DI 1 "register_operand" "r")
2173 (match_operand:DI 2 "mode_width_operand" "n")
2174 (match_operand:DI 3 "reg_or_8bit_operand" "rI")]
2178 [(set_attr "type" "shift")])
2180 (define_insn "mskxl_le"
2181 [(set (match_operand:DI 0 "register_operand" "=r")
2182 (and:DI (not:DI (ashift:DI
2183 (match_operand:DI 2 "mode_mask_operand" "n")
2185 (match_operand:DI 3 "reg_or_8bit_operand" "rI")
2187 (match_operand:DI 1 "reg_or_0_operand" "rJ")))]
2188 "! WORDS_BIG_ENDIAN"
2190 [(set_attr "type" "shift")])
2192 (define_insn "mskxl_be"
2193 [(set (match_operand:DI 0 "register_operand" "=r")
2194 (and:DI (not:DI (ashift:DI
2195 (match_operand:DI 2 "mode_mask_operand" "n")
2196 (minus:DI (const_int 56)
2198 (match_operand:DI 3 "reg_or_8bit_operand" "rI")
2200 (match_operand:DI 1 "reg_or_0_operand" "rJ")))]
2203 [(set_attr "type" "shift")])
2205 ;; We do not include the mskXh insns because it does not appear we would
2206 ;; ever generate one.
2208 ;; Again, we do for block moves and we use unspec again.
2210 (define_insn "mskxh"
2211 [(set (match_operand:DI 0 "register_operand" "=r")
2212 (unspec:DI [(match_operand:DI 1 "register_operand" "r")
2213 (match_operand:DI 2 "mode_width_operand" "n")
2214 (match_operand:DI 3 "reg_or_8bit_operand" "rI")]
2218 [(set_attr "type" "shift")])
2220 ;; Prefer AND + NE over LSHIFTRT + AND.
2222 (define_insn_and_split "*ze_and_ne"
2223 [(set (match_operand:DI 0 "register_operand" "=r")
2224 (zero_extract:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
2226 (match_operand 2 "const_int_operand" "I")))]
2227 "(unsigned HOST_WIDE_INT) INTVAL (operands[2]) < 8"
2229 "(unsigned HOST_WIDE_INT) INTVAL (operands[2]) < 8"
2231 (and:DI (match_dup 1) (match_dup 3)))
2233 (ne:DI (match_dup 0) (const_int 0)))]
2234 "operands[3] = GEN_INT (1 << INTVAL (operands[2]));")
2236 ;; Floating-point operations. All the double-precision insns can extend
2237 ;; from single, so indicate that. The exception are the ones that simply
2238 ;; play with the sign bits; it's not clear what to do there.
2240 (define_insn "abssf2"
2241 [(set (match_operand:SF 0 "register_operand" "=f")
2242 (abs:SF (match_operand:SF 1 "reg_or_0_operand" "fG")))]
2245 [(set_attr "type" "fcpys")])
2247 (define_insn "*nabssf2"
2248 [(set (match_operand:SF 0 "register_operand" "=f")
2249 (neg:SF (abs:SF (match_operand:SF 1 "reg_or_0_operand" "fG"))))]
2252 [(set_attr "type" "fadd")])
2254 (define_insn "absdf2"
2255 [(set (match_operand:DF 0 "register_operand" "=f")
2256 (abs:DF (match_operand:DF 1 "reg_or_0_operand" "fG")))]
2259 [(set_attr "type" "fcpys")])
2261 (define_insn "*nabsdf2"
2262 [(set (match_operand:DF 0 "register_operand" "=f")
2263 (neg:DF (abs:DF (match_operand:DF 1 "reg_or_0_operand" "fG"))))]
2266 [(set_attr "type" "fadd")])
2268 (define_expand "abstf2"
2269 [(parallel [(set (match_operand:TF 0 "register_operand" "")
2270 (abs:TF (match_operand:TF 1 "reg_or_0_operand" "")))
2271 (use (match_dup 2))])]
2272 "TARGET_HAS_XFLOATING_LIBS"
2274 #if HOST_BITS_PER_WIDE_INT >= 64
2275 operands[2] = force_reg (DImode, GEN_INT ((HOST_WIDE_INT) 1 << 63));
2277 operands[2] = force_reg (DImode, immed_double_const (0, 0x80000000, DImode));
2281 (define_insn_and_split "*abstf_internal"
2282 [(set (match_operand:TF 0 "register_operand" "=r")
2283 (abs:TF (match_operand:TF 1 "reg_or_0_operand" "rG")))
2284 (use (match_operand:DI 2 "register_operand" "r"))]
2285 "TARGET_HAS_XFLOATING_LIBS"
2287 "&& reload_completed"
2289 "alpha_split_tfmode_frobsign (operands, gen_andnotdi3); DONE;")
2291 (define_insn "negsf2"
2292 [(set (match_operand:SF 0 "register_operand" "=f")
2293 (neg:SF (match_operand:SF 1 "reg_or_0_operand" "fG")))]
2296 [(set_attr "type" "fadd")])
2298 (define_insn "negdf2"
2299 [(set (match_operand:DF 0 "register_operand" "=f")
2300 (neg:DF (match_operand:DF 1 "reg_or_0_operand" "fG")))]
2303 [(set_attr "type" "fadd")])
2305 (define_expand "negtf2"
2306 [(parallel [(set (match_operand:TF 0 "register_operand" "")
2307 (neg:TF (match_operand:TF 1 "reg_or_0_operand" "")))
2308 (use (match_dup 2))])]
2309 "TARGET_HAS_XFLOATING_LIBS"
2311 #if HOST_BITS_PER_WIDE_INT >= 64
2312 operands[2] = force_reg (DImode, GEN_INT ((HOST_WIDE_INT) 1 << 63));
2314 operands[2] = force_reg (DImode, immed_double_const (0, 0x80000000, DImode));
2318 (define_insn_and_split "*negtf_internal"
2319 [(set (match_operand:TF 0 "register_operand" "=r")
2320 (neg:TF (match_operand:TF 1 "reg_or_0_operand" "rG")))
2321 (use (match_operand:DI 2 "register_operand" "r"))]
2322 "TARGET_HAS_XFLOATING_LIBS"
2324 "&& reload_completed"
2326 "alpha_split_tfmode_frobsign (operands, gen_xordi3); DONE;")
2328 (define_insn "copysignsf3"
2329 [(set (match_operand:SF 0 "register_operand" "=f")
2330 (unspec:SF [(match_operand:SF 1 "reg_or_0_operand" "fG")
2331 (match_operand:SF 2 "reg_or_0_operand" "fG")]
2335 [(set_attr "type" "fadd")])
2337 (define_insn "*ncopysignsf3"
2338 [(set (match_operand:SF 0 "register_operand" "=f")
2339 (neg:SF (unspec:SF [(match_operand:SF 1 "reg_or_0_operand" "fG")
2340 (match_operand:SF 2 "reg_or_0_operand" "fG")]
2344 [(set_attr "type" "fadd")])
2346 (define_insn "copysigndf3"
2347 [(set (match_operand:DF 0 "register_operand" "=f")
2348 (unspec:DF [(match_operand:DF 1 "reg_or_0_operand" "fG")
2349 (match_operand:DF 2 "reg_or_0_operand" "fG")]
2353 [(set_attr "type" "fadd")])
2355 (define_insn "*ncopysigndf3"
2356 [(set (match_operand:DF 0 "register_operand" "=f")
2357 (neg:DF (unspec:DF [(match_operand:DF 1 "reg_or_0_operand" "fG")
2358 (match_operand:DF 2 "reg_or_0_operand" "fG")]
2362 [(set_attr "type" "fadd")])
2364 (define_insn "*addsf_ieee"
2365 [(set (match_operand:SF 0 "register_operand" "=&f")
2366 (plus:SF (match_operand:SF 1 "reg_or_0_operand" "%fG")
2367 (match_operand:SF 2 "reg_or_0_operand" "fG")))]
2368 "TARGET_FP && alpha_fptm >= ALPHA_FPTM_SU"
2369 "add%,%/ %R1,%R2,%0"
2370 [(set_attr "type" "fadd")
2371 (set_attr "trap" "yes")
2372 (set_attr "round_suffix" "normal")
2373 (set_attr "trap_suffix" "u_su_sui")])
2375 (define_insn "addsf3"
2376 [(set (match_operand:SF 0 "register_operand" "=f")
2377 (plus:SF (match_operand:SF 1 "reg_or_0_operand" "%fG")
2378 (match_operand:SF 2 "reg_or_0_operand" "fG")))]
2380 "add%,%/ %R1,%R2,%0"
2381 [(set_attr "type" "fadd")
2382 (set_attr "trap" "yes")
2383 (set_attr "round_suffix" "normal")
2384 (set_attr "trap_suffix" "u_su_sui")])
2386 (define_insn "*adddf_ieee"
2387 [(set (match_operand:DF 0 "register_operand" "=&f")
2388 (plus:DF (match_operand:DF 1 "reg_or_0_operand" "%fG")
2389 (match_operand:DF 2 "reg_or_0_operand" "fG")))]
2390 "TARGET_FP && alpha_fptm >= ALPHA_FPTM_SU"
2391 "add%-%/ %R1,%R2,%0"
2392 [(set_attr "type" "fadd")
2393 (set_attr "trap" "yes")
2394 (set_attr "round_suffix" "normal")
2395 (set_attr "trap_suffix" "u_su_sui")])
2397 (define_insn "adddf3"
2398 [(set (match_operand:DF 0 "register_operand" "=f")
2399 (plus:DF (match_operand:DF 1 "reg_or_0_operand" "%fG")
2400 (match_operand:DF 2 "reg_or_0_operand" "fG")))]
2402 "add%-%/ %R1,%R2,%0"
2403 [(set_attr "type" "fadd")
2404 (set_attr "trap" "yes")
2405 (set_attr "round_suffix" "normal")
2406 (set_attr "trap_suffix" "u_su_sui")])
2408 (define_insn "*adddf_ext1"
2409 [(set (match_operand:DF 0 "register_operand" "=f")
2410 (plus:DF (float_extend:DF
2411 (match_operand:SF 1 "reg_or_0_operand" "fG"))
2412 (match_operand:DF 2 "reg_or_0_operand" "fG")))]
2413 "TARGET_FP && alpha_fptm < ALPHA_FPTM_SU"
2414 "add%-%/ %R1,%R2,%0"
2415 [(set_attr "type" "fadd")
2416 (set_attr "trap" "yes")
2417 (set_attr "round_suffix" "normal")
2418 (set_attr "trap_suffix" "u_su_sui")])
2420 (define_insn "*adddf_ext2"
2421 [(set (match_operand:DF 0 "register_operand" "=f")
2422 (plus:DF (float_extend:DF
2423 (match_operand:SF 1 "reg_or_0_operand" "%fG"))
2425 (match_operand:SF 2 "reg_or_0_operand" "fG"))))]
2426 "TARGET_FP && alpha_fptm < ALPHA_FPTM_SU"
2427 "add%-%/ %R1,%R2,%0"
2428 [(set_attr "type" "fadd")
2429 (set_attr "trap" "yes")
2430 (set_attr "round_suffix" "normal")
2431 (set_attr "trap_suffix" "u_su_sui")])
2433 (define_expand "addtf3"
2434 [(use (match_operand 0 "register_operand" ""))
2435 (use (match_operand 1 "general_operand" ""))
2436 (use (match_operand 2 "general_operand" ""))]
2437 "TARGET_HAS_XFLOATING_LIBS"
2438 "alpha_emit_xfloating_arith (PLUS, operands); DONE;")
2440 ;; Define conversion operators between DFmode and SImode, using the cvtql
2441 ;; instruction. To allow combine et al to do useful things, we keep the
2442 ;; operation as a unit until after reload, at which point we split the
2445 ;; Note that we (attempt to) only consider this optimization when the
2446 ;; ultimate destination is memory. If we will be doing further integer
2447 ;; processing, it is cheaper to do the truncation in the int regs.
2449 (define_insn "*cvtql"
2450 [(set (match_operand:SF 0 "register_operand" "=f")
2451 (unspec:SF [(match_operand:DI 1 "reg_or_0_operand" "fG")]
2455 [(set_attr "type" "fadd")
2456 (set_attr "trap" "yes")
2457 (set_attr "trap_suffix" "v_sv")])
2459 (define_insn_and_split "*fix_truncdfsi_ieee"
2460 [(set (match_operand:SI 0 "memory_operand" "=m")
2462 (match_operator:DI 4 "fix_operator"
2463 [(match_operand:DF 1 "reg_or_0_operand" "fG")]) 0))
2464 (clobber (match_scratch:DI 2 "=&f"))
2465 (clobber (match_scratch:SF 3 "=&f"))]
2466 "TARGET_FP && alpha_fptm >= ALPHA_FPTM_SU"
2468 "&& reload_completed"
2469 [(set (match_dup 2) (match_op_dup 4 [(match_dup 1)]))
2470 (set (match_dup 3) (unspec:SF [(match_dup 2)] UNSPEC_CVTQL))
2471 (set (match_dup 5) (match_dup 3))]
2473 operands[5] = adjust_address (operands[0], SFmode, 0);
2475 [(set_attr "type" "fadd")
2476 (set_attr "trap" "yes")])
2478 (define_insn_and_split "*fix_truncdfsi_internal"
2479 [(set (match_operand:SI 0 "memory_operand" "=m")
2481 (match_operator:DI 3 "fix_operator"
2482 [(match_operand:DF 1 "reg_or_0_operand" "fG")]) 0))
2483 (clobber (match_scratch:DI 2 "=f"))]
2484 "TARGET_FP && alpha_fptm < ALPHA_FPTM_SU"
2486 "&& reload_completed"
2487 [(set (match_dup 2) (match_op_dup 3 [(match_dup 1)]))
2488 (set (match_dup 4) (unspec:SF [(match_dup 2)] UNSPEC_CVTQL))
2489 (set (match_dup 5) (match_dup 4))]
2491 operands[4] = gen_rtx_REG (SFmode, REGNO (operands[2]));
2492 operands[5] = adjust_address (operands[0], SFmode, 0);
2494 [(set_attr "type" "fadd")
2495 (set_attr "trap" "yes")])
2497 (define_insn "*fix_truncdfdi_ieee"
2498 [(set (match_operand:DI 0 "reg_no_subreg_operand" "=&f")
2499 (match_operator:DI 2 "fix_operator"
2500 [(match_operand:DF 1 "reg_or_0_operand" "fG")]))]
2501 "TARGET_FP && alpha_fptm >= ALPHA_FPTM_SU"
2503 [(set_attr "type" "fadd")
2504 (set_attr "trap" "yes")
2505 (set_attr "round_suffix" "c")
2506 (set_attr "trap_suffix" "v_sv_svi")])
2508 (define_insn "*fix_truncdfdi2"
2509 [(set (match_operand:DI 0 "reg_no_subreg_operand" "=f")
2510 (match_operator:DI 2 "fix_operator"
2511 [(match_operand:DF 1 "reg_or_0_operand" "fG")]))]
2514 [(set_attr "type" "fadd")
2515 (set_attr "trap" "yes")
2516 (set_attr "round_suffix" "c")
2517 (set_attr "trap_suffix" "v_sv_svi")])
2519 (define_expand "fix_truncdfdi2"
2520 [(set (match_operand:DI 0 "reg_no_subreg_operand" "")
2521 (fix:DI (match_operand:DF 1 "reg_or_0_operand" "")))]
2525 (define_expand "fixuns_truncdfdi2"
2526 [(set (match_operand:DI 0 "reg_no_subreg_operand" "")
2527 (unsigned_fix:DI (match_operand:DF 1 "reg_or_0_operand" "")))]
2531 ;; Likewise between SFmode and SImode.
2533 (define_insn_and_split "*fix_truncsfsi_ieee"
2534 [(set (match_operand:SI 0 "memory_operand" "=m")
2536 (match_operator:DI 4 "fix_operator"
2538 (match_operand:SF 1 "reg_or_0_operand" "fG"))]) 0))
2539 (clobber (match_scratch:DI 2 "=&f"))
2540 (clobber (match_scratch:SF 3 "=&f"))]
2541 "TARGET_FP && alpha_fptm >= ALPHA_FPTM_SU"
2543 "&& reload_completed"
2544 [(set (match_dup 2) (match_op_dup 4 [(float_extend:DF (match_dup 1))]))
2545 (set (match_dup 3) (unspec:SF [(match_dup 2)] UNSPEC_CVTQL))
2546 (set (match_dup 5) (match_dup 3))]
2548 operands[5] = adjust_address (operands[0], SFmode, 0);
2550 [(set_attr "type" "fadd")
2551 (set_attr "trap" "yes")])
2553 (define_insn_and_split "*fix_truncsfsi_internal"
2554 [(set (match_operand:SI 0 "memory_operand" "=m")
2556 (match_operator:DI 3 "fix_operator"
2558 (match_operand:SF 1 "reg_or_0_operand" "fG"))]) 0))
2559 (clobber (match_scratch:DI 2 "=f"))]
2560 "TARGET_FP && alpha_fptm < ALPHA_FPTM_SU"
2562 "&& reload_completed"
2563 [(set (match_dup 2) (match_op_dup 3 [(float_extend:DF (match_dup 1))]))
2564 (set (match_dup 4) (unspec:SF [(match_dup 2)] UNSPEC_CVTQL))
2565 (set (match_dup 5) (match_dup 4))]
2567 operands[4] = gen_rtx_REG (SFmode, REGNO (operands[2]));
2568 operands[5] = adjust_address (operands[0], SFmode, 0);
2570 [(set_attr "type" "fadd")
2571 (set_attr "trap" "yes")])
2573 (define_insn "*fix_truncsfdi_ieee"
2574 [(set (match_operand:DI 0 "reg_no_subreg_operand" "=&f")
2575 (match_operator:DI 2 "fix_operator"
2576 [(float_extend:DF (match_operand:SF 1 "reg_or_0_operand" "fG"))]))]
2577 "TARGET_FP && alpha_fptm >= ALPHA_FPTM_SU"
2579 [(set_attr "type" "fadd")
2580 (set_attr "trap" "yes")
2581 (set_attr "round_suffix" "c")
2582 (set_attr "trap_suffix" "v_sv_svi")])
2584 (define_insn "*fix_truncsfdi2"
2585 [(set (match_operand:DI 0 "reg_no_subreg_operand" "=f")
2586 (match_operator:DI 2 "fix_operator"
2587 [(float_extend:DF (match_operand:SF 1 "reg_or_0_operand" "fG"))]))]
2590 [(set_attr "type" "fadd")
2591 (set_attr "trap" "yes")
2592 (set_attr "round_suffix" "c")
2593 (set_attr "trap_suffix" "v_sv_svi")])
2595 (define_expand "fix_truncsfdi2"
2596 [(set (match_operand:DI 0 "reg_no_subreg_operand" "")
2597 (fix:DI (float_extend:DF (match_operand:SF 1 "reg_or_0_operand" ""))))]
2601 (define_expand "fixuns_truncsfdi2"
2602 [(set (match_operand:DI 0 "reg_no_subreg_operand" "")
2604 (float_extend:DF (match_operand:SF 1 "reg_or_0_operand" ""))))]
2608 (define_expand "fix_trunctfdi2"
2609 [(use (match_operand:DI 0 "register_operand" ""))
2610 (use (match_operand:TF 1 "general_operand" ""))]
2611 "TARGET_HAS_XFLOATING_LIBS"
2612 "alpha_emit_xfloating_cvt (FIX, operands); DONE;")
2614 (define_expand "fixuns_trunctfdi2"
2615 [(use (match_operand:DI 0 "register_operand" ""))
2616 (use (match_operand:TF 1 "general_operand" ""))]
2617 "TARGET_HAS_XFLOATING_LIBS"
2618 "alpha_emit_xfloating_cvt (UNSIGNED_FIX, operands); DONE;")
2620 (define_insn "*floatdisf_ieee"
2621 [(set (match_operand:SF 0 "register_operand" "=&f")
2622 (float:SF (match_operand:DI 1 "reg_no_subreg_operand" "f")))]
2623 "TARGET_FP && alpha_fptm >= ALPHA_FPTM_SU"
2625 [(set_attr "type" "fadd")
2626 (set_attr "trap" "yes")
2627 (set_attr "round_suffix" "normal")
2628 (set_attr "trap_suffix" "sui")])
2630 (define_insn "floatdisf2"
2631 [(set (match_operand:SF 0 "register_operand" "=f")
2632 (float:SF (match_operand:DI 1 "reg_no_subreg_operand" "f")))]
2635 [(set_attr "type" "fadd")
2636 (set_attr "trap" "yes")
2637 (set_attr "round_suffix" "normal")
2638 (set_attr "trap_suffix" "sui")])
2640 (define_insn_and_split "*floatsisf2_ieee"
2641 [(set (match_operand:SF 0 "register_operand" "=&f")
2642 (float:SF (match_operand:SI 1 "memory_operand" "m")))
2643 (clobber (match_scratch:DI 2 "=&f"))
2644 (clobber (match_scratch:SF 3 "=&f"))]
2645 "TARGET_FP && alpha_fptm >= ALPHA_FPTM_SU"
2647 "&& reload_completed"
2648 [(set (match_dup 3) (match_dup 1))
2649 (set (match_dup 2) (unspec:DI [(match_dup 3)] UNSPEC_CVTLQ))
2650 (set (match_dup 0) (float:SF (match_dup 2)))]
2652 operands[1] = adjust_address (operands[1], SFmode, 0);
2655 (define_insn_and_split "*floatsisf2"
2656 [(set (match_operand:SF 0 "register_operand" "=f")
2657 (float:SF (match_operand:SI 1 "memory_operand" "m")))]
2660 "&& reload_completed"
2661 [(set (match_dup 0) (match_dup 1))
2662 (set (match_dup 2) (unspec:DI [(match_dup 0)] UNSPEC_CVTLQ))
2663 (set (match_dup 0) (float:SF (match_dup 2)))]
2665 operands[1] = adjust_address (operands[1], SFmode, 0);
2666 operands[2] = gen_rtx_REG (DImode, REGNO (operands[0]));
2669 (define_insn "*floatdidf_ieee"
2670 [(set (match_operand:DF 0 "register_operand" "=&f")
2671 (float:DF (match_operand:DI 1 "reg_no_subreg_operand" "f")))]
2672 "TARGET_FP && alpha_fptm >= ALPHA_FPTM_SU"
2674 [(set_attr "type" "fadd")
2675 (set_attr "trap" "yes")
2676 (set_attr "round_suffix" "normal")
2677 (set_attr "trap_suffix" "sui")])
2679 (define_insn "floatdidf2"
2680 [(set (match_operand:DF 0 "register_operand" "=f")
2681 (float:DF (match_operand:DI 1 "reg_no_subreg_operand" "f")))]
2684 [(set_attr "type" "fadd")
2685 (set_attr "trap" "yes")
2686 (set_attr "round_suffix" "normal")
2687 (set_attr "trap_suffix" "sui")])
2689 (define_insn_and_split "*floatsidf2_ieee"
2690 [(set (match_operand:DF 0 "register_operand" "=&f")
2691 (float:DF (match_operand:SI 1 "memory_operand" "m")))
2692 (clobber (match_scratch:DI 2 "=&f"))
2693 (clobber (match_scratch:SF 3 "=&f"))]
2694 "TARGET_FP && alpha_fptm >= ALPHA_FPTM_SU"
2696 "&& reload_completed"
2697 [(set (match_dup 3) (match_dup 1))
2698 (set (match_dup 2) (unspec:DI [(match_dup 3)] UNSPEC_CVTLQ))
2699 (set (match_dup 0) (float:DF (match_dup 2)))]
2701 operands[1] = adjust_address (operands[1], SFmode, 0);
2704 (define_insn_and_split "*floatsidf2"
2705 [(set (match_operand:DF 0 "register_operand" "=f")
2706 (float:DF (match_operand:SI 1 "memory_operand" "m")))]
2709 "&& reload_completed"
2710 [(set (match_dup 3) (match_dup 1))
2711 (set (match_dup 2) (unspec:DI [(match_dup 3)] UNSPEC_CVTLQ))
2712 (set (match_dup 0) (float:DF (match_dup 2)))]
2714 operands[1] = adjust_address (operands[1], SFmode, 0);
2715 operands[2] = gen_rtx_REG (DImode, REGNO (operands[0]));
2716 operands[3] = gen_rtx_REG (SFmode, REGNO (operands[0]));
2719 (define_expand "floatditf2"
2720 [(use (match_operand:TF 0 "register_operand" ""))
2721 (use (match_operand:DI 1 "general_operand" ""))]
2722 "TARGET_HAS_XFLOATING_LIBS"
2723 "alpha_emit_xfloating_cvt (FLOAT, operands); DONE;")
2725 (define_expand "floatunsdisf2"
2726 [(use (match_operand:SF 0 "register_operand" ""))
2727 (use (match_operand:DI 1 "register_operand" ""))]
2729 "alpha_emit_floatuns (operands); DONE;")
2731 (define_expand "floatunsdidf2"
2732 [(use (match_operand:DF 0 "register_operand" ""))
2733 (use (match_operand:DI 1 "register_operand" ""))]
2735 "alpha_emit_floatuns (operands); DONE;")
2737 (define_expand "floatunsditf2"
2738 [(use (match_operand:TF 0 "register_operand" ""))
2739 (use (match_operand:DI 1 "general_operand" ""))]
2740 "TARGET_HAS_XFLOATING_LIBS"
2741 "alpha_emit_xfloating_cvt (UNSIGNED_FLOAT, operands); DONE;")
2743 (define_expand "extendsfdf2"
2744 [(set (match_operand:DF 0 "register_operand" "")
2745 (float_extend:DF (match_operand:SF 1 "nonimmediate_operand" "")))]
2748 if (alpha_fptm >= ALPHA_FPTM_SU)
2749 operands[1] = force_reg (SFmode, operands[1]);
2752 ;; The Unicos/Mk assembler doesn't support cvtst, but we've already
2753 ;; asserted that alpha_fptm == ALPHA_FPTM_N.
2755 (define_insn "*extendsfdf2_ieee"
2756 [(set (match_operand:DF 0 "register_operand" "=&f")
2757 (float_extend:DF (match_operand:SF 1 "register_operand" "f")))]
2758 "TARGET_FP && alpha_fptm >= ALPHA_FPTM_SU"
2760 [(set_attr "type" "fadd")
2761 (set_attr "trap" "yes")])
2763 (define_insn "*extendsfdf2_internal"
2764 [(set (match_operand:DF 0 "register_operand" "=f,f,m")
2765 (float_extend:DF (match_operand:SF 1 "nonimmediate_operand" "f,m,f")))]
2766 "TARGET_FP && alpha_fptm < ALPHA_FPTM_SU"
2771 [(set_attr "type" "fcpys,fld,fst")])
2773 ;; Use register_operand for operand 1 to prevent compress_float_constant
2774 ;; from doing something silly. When optimizing we'll put things back
2776 (define_expand "extendsftf2"
2777 [(use (match_operand:TF 0 "register_operand" ""))
2778 (use (match_operand:SF 1 "register_operand" ""))]
2779 "TARGET_HAS_XFLOATING_LIBS"
2781 rtx tmp = gen_reg_rtx (DFmode);
2782 emit_insn (gen_extendsfdf2 (tmp, operands[1]));
2783 emit_insn (gen_extenddftf2 (operands[0], tmp));
2787 (define_expand "extenddftf2"
2788 [(use (match_operand:TF 0 "register_operand" ""))
2789 (use (match_operand:DF 1 "register_operand" ""))]
2790 "TARGET_HAS_XFLOATING_LIBS"
2791 "alpha_emit_xfloating_cvt (FLOAT_EXTEND, operands); DONE;")
2793 (define_insn "*truncdfsf2_ieee"
2794 [(set (match_operand:SF 0 "register_operand" "=&f")
2795 (float_truncate:SF (match_operand:DF 1 "reg_or_0_operand" "fG")))]
2796 "TARGET_FP && alpha_fptm >= ALPHA_FPTM_SU"
2798 [(set_attr "type" "fadd")
2799 (set_attr "trap" "yes")
2800 (set_attr "round_suffix" "normal")
2801 (set_attr "trap_suffix" "u_su_sui")])
2803 (define_insn "truncdfsf2"
2804 [(set (match_operand:SF 0 "register_operand" "=f")
2805 (float_truncate:SF (match_operand:DF 1 "reg_or_0_operand" "fG")))]
2808 [(set_attr "type" "fadd")
2809 (set_attr "trap" "yes")
2810 (set_attr "round_suffix" "normal")
2811 (set_attr "trap_suffix" "u_su_sui")])
2813 (define_expand "trunctfdf2"
2814 [(use (match_operand:DF 0 "register_operand" ""))
2815 (use (match_operand:TF 1 "general_operand" ""))]
2816 "TARGET_HAS_XFLOATING_LIBS"
2817 "alpha_emit_xfloating_cvt (FLOAT_TRUNCATE, operands); DONE;")
2819 (define_expand "trunctfsf2"
2820 [(use (match_operand:SF 0 "register_operand" ""))
2821 (use (match_operand:TF 1 "general_operand" ""))]
2822 "TARGET_FP && TARGET_HAS_XFLOATING_LIBS"
2824 rtx tmpf, sticky, arg, lo, hi;
2826 tmpf = gen_reg_rtx (DFmode);
2827 sticky = gen_reg_rtx (DImode);
2828 arg = copy_to_mode_reg (TFmode, operands[1]);
2829 lo = gen_lowpart (DImode, arg);
2830 hi = gen_highpart (DImode, arg);
2832 /* Convert the low word of the TFmode value into a sticky rounding bit,
2833 then or it into the low bit of the high word. This leaves the sticky
2834 bit at bit 48 of the fraction, which is representable in DFmode,
2835 which prevents rounding error in the final conversion to SFmode. */
2837 emit_insn (gen_rtx_SET (VOIDmode, sticky,
2838 gen_rtx_NE (DImode, lo, const0_rtx)));
2839 emit_insn (gen_iordi3 (hi, hi, sticky));
2840 emit_insn (gen_trunctfdf2 (tmpf, arg));
2841 emit_insn (gen_truncdfsf2 (operands[0], tmpf));
2845 (define_insn "*divsf3_ieee"
2846 [(set (match_operand:SF 0 "register_operand" "=&f")
2847 (div:SF (match_operand:SF 1 "reg_or_0_operand" "fG")
2848 (match_operand:SF 2 "reg_or_0_operand" "fG")))]
2849 "TARGET_FP && alpha_fptm >= ALPHA_FPTM_SU"
2850 "div%,%/ %R1,%R2,%0"
2851 [(set_attr "type" "fdiv")
2852 (set_attr "opsize" "si")
2853 (set_attr "trap" "yes")
2854 (set_attr "round_suffix" "normal")
2855 (set_attr "trap_suffix" "u_su_sui")])
2857 (define_insn "divsf3"
2858 [(set (match_operand:SF 0 "register_operand" "=f")
2859 (div:SF (match_operand:SF 1 "reg_or_0_operand" "fG")
2860 (match_operand:SF 2 "reg_or_0_operand" "fG")))]
2862 "div%,%/ %R1,%R2,%0"
2863 [(set_attr "type" "fdiv")
2864 (set_attr "opsize" "si")
2865 (set_attr "trap" "yes")
2866 (set_attr "round_suffix" "normal")
2867 (set_attr "trap_suffix" "u_su_sui")])
2869 (define_insn "*divdf3_ieee"
2870 [(set (match_operand:DF 0 "register_operand" "=&f")
2871 (div:DF (match_operand:DF 1 "reg_or_0_operand" "fG")
2872 (match_operand:DF 2 "reg_or_0_operand" "fG")))]
2873 "TARGET_FP && alpha_fptm >= ALPHA_FPTM_SU"
2874 "div%-%/ %R1,%R2,%0"
2875 [(set_attr "type" "fdiv")
2876 (set_attr "trap" "yes")
2877 (set_attr "round_suffix" "normal")
2878 (set_attr "trap_suffix" "u_su_sui")])
2880 (define_insn "divdf3"
2881 [(set (match_operand:DF 0 "register_operand" "=f")
2882 (div:DF (match_operand:DF 1 "reg_or_0_operand" "fG")
2883 (match_operand:DF 2 "reg_or_0_operand" "fG")))]
2885 "div%-%/ %R1,%R2,%0"
2886 [(set_attr "type" "fdiv")
2887 (set_attr "trap" "yes")
2888 (set_attr "round_suffix" "normal")
2889 (set_attr "trap_suffix" "u_su_sui")])
2891 (define_insn "*divdf_ext1"
2892 [(set (match_operand:DF 0 "register_operand" "=f")
2893 (div:DF (float_extend:DF (match_operand:SF 1 "reg_or_0_operand" "fG"))
2894 (match_operand:DF 2 "reg_or_0_operand" "fG")))]
2895 "TARGET_FP && alpha_fptm < ALPHA_FPTM_SU"
2896 "div%-%/ %R1,%R2,%0"
2897 [(set_attr "type" "fdiv")
2898 (set_attr "trap" "yes")
2899 (set_attr "round_suffix" "normal")
2900 (set_attr "trap_suffix" "u_su_sui")])
2902 (define_insn "*divdf_ext2"
2903 [(set (match_operand:DF 0 "register_operand" "=f")
2904 (div:DF (match_operand:DF 1 "reg_or_0_operand" "fG")
2906 (match_operand:SF 2 "reg_or_0_operand" "fG"))))]
2907 "TARGET_FP && alpha_fptm < ALPHA_FPTM_SU"
2908 "div%-%/ %R1,%R2,%0"
2909 [(set_attr "type" "fdiv")
2910 (set_attr "trap" "yes")
2911 (set_attr "round_suffix" "normal")
2912 (set_attr "trap_suffix" "u_su_sui")])
2914 (define_insn "*divdf_ext3"
2915 [(set (match_operand:DF 0 "register_operand" "=f")
2916 (div:DF (float_extend:DF (match_operand:SF 1 "reg_or_0_operand" "fG"))
2917 (float_extend:DF (match_operand:SF 2 "reg_or_0_operand" "fG"))))]
2918 "TARGET_FP && alpha_fptm < ALPHA_FPTM_SU"
2919 "div%-%/ %R1,%R2,%0"
2920 [(set_attr "type" "fdiv")
2921 (set_attr "trap" "yes")
2922 (set_attr "round_suffix" "normal")
2923 (set_attr "trap_suffix" "u_su_sui")])
2925 (define_expand "divtf3"
2926 [(use (match_operand 0 "register_operand" ""))
2927 (use (match_operand 1 "general_operand" ""))
2928 (use (match_operand 2 "general_operand" ""))]
2929 "TARGET_HAS_XFLOATING_LIBS"
2930 "alpha_emit_xfloating_arith (DIV, operands); DONE;")
2932 (define_insn "*mulsf3_ieee"
2933 [(set (match_operand:SF 0 "register_operand" "=&f")
2934 (mult:SF (match_operand:SF 1 "reg_or_0_operand" "%fG")
2935 (match_operand:SF 2 "reg_or_0_operand" "fG")))]
2936 "TARGET_FP && alpha_fptm >= ALPHA_FPTM_SU"
2937 "mul%,%/ %R1,%R2,%0"
2938 [(set_attr "type" "fmul")
2939 (set_attr "trap" "yes")
2940 (set_attr "round_suffix" "normal")
2941 (set_attr "trap_suffix" "u_su_sui")])
2943 (define_insn "mulsf3"
2944 [(set (match_operand:SF 0 "register_operand" "=f")
2945 (mult:SF (match_operand:SF 1 "reg_or_0_operand" "%fG")
2946 (match_operand:SF 2 "reg_or_0_operand" "fG")))]
2948 "mul%,%/ %R1,%R2,%0"
2949 [(set_attr "type" "fmul")
2950 (set_attr "trap" "yes")
2951 (set_attr "round_suffix" "normal")
2952 (set_attr "trap_suffix" "u_su_sui")])
2954 (define_insn "*muldf3_ieee"
2955 [(set (match_operand:DF 0 "register_operand" "=&f")
2956 (mult:DF (match_operand:DF 1 "reg_or_0_operand" "%fG")
2957 (match_operand:DF 2 "reg_or_0_operand" "fG")))]
2958 "TARGET_FP && alpha_fptm >= ALPHA_FPTM_SU"
2959 "mul%-%/ %R1,%R2,%0"
2960 [(set_attr "type" "fmul")
2961 (set_attr "trap" "yes")
2962 (set_attr "round_suffix" "normal")
2963 (set_attr "trap_suffix" "u_su_sui")])
2965 (define_insn "muldf3"
2966 [(set (match_operand:DF 0 "register_operand" "=f")
2967 (mult:DF (match_operand:DF 1 "reg_or_0_operand" "%fG")
2968 (match_operand:DF 2 "reg_or_0_operand" "fG")))]
2970 "mul%-%/ %R1,%R2,%0"
2971 [(set_attr "type" "fmul")
2972 (set_attr "trap" "yes")
2973 (set_attr "round_suffix" "normal")
2974 (set_attr "trap_suffix" "u_su_sui")])
2976 (define_insn "*muldf_ext1"
2977 [(set (match_operand:DF 0 "register_operand" "=f")
2978 (mult:DF (float_extend:DF
2979 (match_operand:SF 1 "reg_or_0_operand" "fG"))
2980 (match_operand:DF 2 "reg_or_0_operand" "fG")))]
2981 "TARGET_FP && alpha_fptm < ALPHA_FPTM_SU"
2982 "mul%-%/ %R1,%R2,%0"
2983 [(set_attr "type" "fmul")
2984 (set_attr "trap" "yes")
2985 (set_attr "round_suffix" "normal")
2986 (set_attr "trap_suffix" "u_su_sui")])
2988 (define_insn "*muldf_ext2"
2989 [(set (match_operand:DF 0 "register_operand" "=f")
2990 (mult:DF (float_extend:DF
2991 (match_operand:SF 1 "reg_or_0_operand" "%fG"))
2993 (match_operand:SF 2 "reg_or_0_operand" "fG"))))]
2994 "TARGET_FP && alpha_fptm < ALPHA_FPTM_SU"
2995 "mul%-%/ %R1,%R2,%0"
2996 [(set_attr "type" "fmul")
2997 (set_attr "trap" "yes")
2998 (set_attr "round_suffix" "normal")
2999 (set_attr "trap_suffix" "u_su_sui")])
3001 (define_expand "multf3"
3002 [(use (match_operand 0 "register_operand" ""))
3003 (use (match_operand 1 "general_operand" ""))
3004 (use (match_operand 2 "general_operand" ""))]
3005 "TARGET_HAS_XFLOATING_LIBS"
3006 "alpha_emit_xfloating_arith (MULT, operands); DONE;")
3008 (define_insn "*subsf3_ieee"
3009 [(set (match_operand:SF 0 "register_operand" "=&f")
3010 (minus:SF (match_operand:SF 1 "reg_or_0_operand" "fG")
3011 (match_operand:SF 2 "reg_or_0_operand" "fG")))]
3012 "TARGET_FP && alpha_fptm >= ALPHA_FPTM_SU"
3013 "sub%,%/ %R1,%R2,%0"
3014 [(set_attr "type" "fadd")
3015 (set_attr "trap" "yes")
3016 (set_attr "round_suffix" "normal")
3017 (set_attr "trap_suffix" "u_su_sui")])
3019 (define_insn "subsf3"
3020 [(set (match_operand:SF 0 "register_operand" "=f")
3021 (minus:SF (match_operand:SF 1 "reg_or_0_operand" "fG")
3022 (match_operand:SF 2 "reg_or_0_operand" "fG")))]
3024 "sub%,%/ %R1,%R2,%0"
3025 [(set_attr "type" "fadd")
3026 (set_attr "trap" "yes")
3027 (set_attr "round_suffix" "normal")
3028 (set_attr "trap_suffix" "u_su_sui")])
3030 (define_insn "*subdf3_ieee"
3031 [(set (match_operand:DF 0 "register_operand" "=&f")
3032 (minus:DF (match_operand:DF 1 "reg_or_0_operand" "fG")
3033 (match_operand:DF 2 "reg_or_0_operand" "fG")))]
3034 "TARGET_FP && alpha_fptm >= ALPHA_FPTM_SU"
3035 "sub%-%/ %R1,%R2,%0"
3036 [(set_attr "type" "fadd")
3037 (set_attr "trap" "yes")
3038 (set_attr "round_suffix" "normal")
3039 (set_attr "trap_suffix" "u_su_sui")])
3041 (define_insn "subdf3"
3042 [(set (match_operand:DF 0 "register_operand" "=f")
3043 (minus:DF (match_operand:DF 1 "reg_or_0_operand" "fG")
3044 (match_operand:DF 2 "reg_or_0_operand" "fG")))]
3046 "sub%-%/ %R1,%R2,%0"
3047 [(set_attr "type" "fadd")
3048 (set_attr "trap" "yes")
3049 (set_attr "round_suffix" "normal")
3050 (set_attr "trap_suffix" "u_su_sui")])
3052 (define_insn "*subdf_ext1"
3053 [(set (match_operand:DF 0 "register_operand" "=f")
3054 (minus:DF (float_extend:DF
3055 (match_operand:SF 1 "reg_or_0_operand" "fG"))
3056 (match_operand:DF 2 "reg_or_0_operand" "fG")))]
3057 "TARGET_FP && alpha_fptm < ALPHA_FPTM_SU"
3058 "sub%-%/ %R1,%R2,%0"
3059 [(set_attr "type" "fadd")
3060 (set_attr "trap" "yes")
3061 (set_attr "round_suffix" "normal")
3062 (set_attr "trap_suffix" "u_su_sui")])
3064 (define_insn "*subdf_ext2"
3065 [(set (match_operand:DF 0 "register_operand" "=f")
3066 (minus:DF (match_operand:DF 1 "reg_or_0_operand" "fG")
3068 (match_operand:SF 2 "reg_or_0_operand" "fG"))))]
3069 "TARGET_FP && alpha_fptm < ALPHA_FPTM_SU"
3070 "sub%-%/ %R1,%R2,%0"
3071 [(set_attr "type" "fadd")
3072 (set_attr "trap" "yes")
3073 (set_attr "round_suffix" "normal")
3074 (set_attr "trap_suffix" "u_su_sui")])
3076 (define_insn "*subdf_ext3"
3077 [(set (match_operand:DF 0 "register_operand" "=f")
3078 (minus:DF (float_extend:DF
3079 (match_operand:SF 1 "reg_or_0_operand" "fG"))
3081 (match_operand:SF 2 "reg_or_0_operand" "fG"))))]
3082 "TARGET_FP && alpha_fptm < ALPHA_FPTM_SU"
3083 "sub%-%/ %R1,%R2,%0"
3084 [(set_attr "type" "fadd")
3085 (set_attr "trap" "yes")
3086 (set_attr "round_suffix" "normal")
3087 (set_attr "trap_suffix" "u_su_sui")])
3089 (define_expand "subtf3"
3090 [(use (match_operand 0 "register_operand" ""))
3091 (use (match_operand 1 "general_operand" ""))
3092 (use (match_operand 2 "general_operand" ""))]
3093 "TARGET_HAS_XFLOATING_LIBS"
3094 "alpha_emit_xfloating_arith (MINUS, operands); DONE;")
3096 (define_insn "*sqrtsf2_ieee"
3097 [(set (match_operand:SF 0 "register_operand" "=&f")
3098 (sqrt:SF (match_operand:SF 1 "reg_or_0_operand" "fG")))]
3099 "TARGET_FP && TARGET_FIX && alpha_fptm >= ALPHA_FPTM_SU"
3101 [(set_attr "type" "fsqrt")
3102 (set_attr "opsize" "si")
3103 (set_attr "trap" "yes")
3104 (set_attr "round_suffix" "normal")
3105 (set_attr "trap_suffix" "u_su_sui")])
3107 (define_insn "sqrtsf2"
3108 [(set (match_operand:SF 0 "register_operand" "=f")
3109 (sqrt:SF (match_operand:SF 1 "reg_or_0_operand" "fG")))]
3110 "TARGET_FP && TARGET_FIX"
3112 [(set_attr "type" "fsqrt")
3113 (set_attr "opsize" "si")
3114 (set_attr "trap" "yes")
3115 (set_attr "round_suffix" "normal")
3116 (set_attr "trap_suffix" "u_su_sui")])
3118 (define_insn "*sqrtdf2_ieee"
3119 [(set (match_operand:DF 0 "register_operand" "=&f")
3120 (sqrt:DF (match_operand:DF 1 "reg_or_0_operand" "fG")))]
3121 "TARGET_FP && TARGET_FIX && alpha_fptm >= ALPHA_FPTM_SU"
3123 [(set_attr "type" "fsqrt")
3124 (set_attr "trap" "yes")
3125 (set_attr "round_suffix" "normal")
3126 (set_attr "trap_suffix" "u_su_sui")])
3128 (define_insn "sqrtdf2"
3129 [(set (match_operand:DF 0 "register_operand" "=f")
3130 (sqrt:DF (match_operand:DF 1 "reg_or_0_operand" "fG")))]
3131 "TARGET_FP && TARGET_FIX"
3133 [(set_attr "type" "fsqrt")
3134 (set_attr "trap" "yes")
3135 (set_attr "round_suffix" "normal")
3136 (set_attr "trap_suffix" "u_su_sui")])
3138 ;; Next are all the integer comparisons, and conditional moves and branches
3139 ;; and some of the related define_expand's and define_split's.
3141 (define_insn "*setcc_internal"
3142 [(set (match_operand 0 "register_operand" "=r")
3143 (match_operator 1 "alpha_comparison_operator"
3144 [(match_operand:DI 2 "register_operand" "r")
3145 (match_operand:DI 3 "reg_or_8bit_operand" "rI")]))]
3146 "GET_MODE_CLASS (GET_MODE (operands[0])) == MODE_INT
3147 && GET_MODE_SIZE (GET_MODE (operands[0])) <= 8
3148 && GET_MODE (operands[0]) == GET_MODE (operands[1])"
3150 [(set_attr "type" "icmp")])
3152 ;; Yes, we can technically support reg_or_8bit_operand in operand 2,
3153 ;; but that's non-canonical rtl and allowing that causes inefficiencies
3155 (define_insn "*setcc_swapped_internal"
3156 [(set (match_operand 0 "register_operand" "=r")
3157 (match_operator 1 "alpha_swapped_comparison_operator"
3158 [(match_operand:DI 2 "register_operand" "r")
3159 (match_operand:DI 3 "reg_or_0_operand" "rJ")]))]
3160 "GET_MODE_CLASS (GET_MODE (operands[0])) == MODE_INT
3161 && GET_MODE_SIZE (GET_MODE (operands[0])) <= 8
3162 && GET_MODE (operands[0]) == GET_MODE (operands[1])"
3164 [(set_attr "type" "icmp")])
3166 ;; Use match_operator rather than ne directly so that we can match
3167 ;; multiple integer modes.
3168 (define_insn "*setne_internal"
3169 [(set (match_operand 0 "register_operand" "=r")
3170 (match_operator 1 "signed_comparison_operator"
3171 [(match_operand:DI 2 "register_operand" "r")
3173 "GET_MODE_CLASS (GET_MODE (operands[0])) == MODE_INT
3174 && GET_MODE_SIZE (GET_MODE (operands[0])) <= 8
3175 && GET_CODE (operands[1]) == NE
3176 && GET_MODE (operands[0]) == GET_MODE (operands[1])"
3178 [(set_attr "type" "icmp")])
3180 ;; The mode folding trick can't be used with const_int operands, since
3181 ;; reload needs to know the proper mode.
3183 ;; Use add_operand instead of the more seemingly natural reg_or_8bit_operand
3184 ;; in order to create more pairs of constants. As long as we're allowing
3185 ;; two constants at the same time, and will have to reload one of them...
3187 (define_insn "*movqicc_internal"
3188 [(set (match_operand:QI 0 "register_operand" "=r,r,r,r")
3190 (match_operator 2 "signed_comparison_operator"
3191 [(match_operand:DI 3 "reg_or_0_operand" "rJ,rJ,J,J")
3192 (match_operand:DI 4 "reg_or_0_operand" "J,J,rJ,rJ")])
3193 (match_operand:QI 1 "add_operand" "rI,0,rI,0")
3194 (match_operand:QI 5 "add_operand" "0,rI,0,rI")))]
3195 "(operands[3] == const0_rtx) ^ (operands[4] == const0_rtx)"
3201 [(set_attr "type" "icmov")])
3203 (define_insn "*movhicc_internal"
3204 [(set (match_operand:HI 0 "register_operand" "=r,r,r,r")
3206 (match_operator 2 "signed_comparison_operator"
3207 [(match_operand:DI 3 "reg_or_0_operand" "rJ,rJ,J,J")
3208 (match_operand:DI 4 "reg_or_0_operand" "J,J,rJ,rJ")])
3209 (match_operand:HI 1 "add_operand" "rI,0,rI,0")
3210 (match_operand:HI 5 "add_operand" "0,rI,0,rI")))]
3211 "(operands[3] == const0_rtx) ^ (operands[4] == const0_rtx)"
3217 [(set_attr "type" "icmov")])
3219 (define_insn "*movsicc_internal"
3220 [(set (match_operand:SI 0 "register_operand" "=r,r,r,r")
3222 (match_operator 2 "signed_comparison_operator"
3223 [(match_operand:DI 3 "reg_or_0_operand" "rJ,rJ,J,J")
3224 (match_operand:DI 4 "reg_or_0_operand" "J,J,rJ,rJ")])
3225 (match_operand:SI 1 "add_operand" "rI,0,rI,0")
3226 (match_operand:SI 5 "add_operand" "0,rI,0,rI")))]
3227 "(operands[3] == const0_rtx) ^ (operands[4] == const0_rtx)"
3233 [(set_attr "type" "icmov")])
3235 (define_insn "*movdicc_internal"
3236 [(set (match_operand:DI 0 "register_operand" "=r,r,r,r")
3238 (match_operator 2 "signed_comparison_operator"
3239 [(match_operand:DI 3 "reg_or_0_operand" "rJ,rJ,J,J")
3240 (match_operand:DI 4 "reg_or_0_operand" "J,J,rJ,rJ")])
3241 (match_operand:DI 1 "add_operand" "rI,0,rI,0")
3242 (match_operand:DI 5 "add_operand" "0,rI,0,rI")))]
3243 "(operands[3] == const0_rtx) ^ (operands[4] == const0_rtx)"
3249 [(set_attr "type" "icmov")])
3251 (define_insn "*movqicc_lbc"
3252 [(set (match_operand:QI 0 "register_operand" "=r,r")
3254 (eq (zero_extract:DI (match_operand:DI 2 "reg_or_0_operand" "rJ,rJ")
3258 (match_operand:QI 1 "reg_or_8bit_operand" "rI,0")
3259 (match_operand:QI 3 "reg_or_8bit_operand" "0,rI")))]
3264 [(set_attr "type" "icmov")])
3266 (define_insn "*movhicc_lbc"
3267 [(set (match_operand:HI 0 "register_operand" "=r,r")
3269 (eq (zero_extract:DI (match_operand:DI 2 "reg_or_0_operand" "rJ,rJ")
3273 (match_operand:HI 1 "reg_or_8bit_operand" "rI,0")
3274 (match_operand:HI 3 "reg_or_8bit_operand" "0,rI")))]
3279 [(set_attr "type" "icmov")])
3281 (define_insn "*movsicc_lbc"
3282 [(set (match_operand:SI 0 "register_operand" "=r,r")
3284 (eq (zero_extract:DI (match_operand:DI 2 "reg_or_0_operand" "rJ,rJ")
3288 (match_operand:SI 1 "reg_or_8bit_operand" "rI,0")
3289 (match_operand:SI 3 "reg_or_8bit_operand" "0,rI")))]
3294 [(set_attr "type" "icmov")])
3296 (define_insn "*movdicc_lbc"
3297 [(set (match_operand:DI 0 "register_operand" "=r,r")
3299 (eq (zero_extract:DI (match_operand:DI 2 "reg_or_0_operand" "rJ,rJ")
3303 (match_operand:DI 1 "reg_or_8bit_operand" "rI,0")
3304 (match_operand:DI 3 "reg_or_8bit_operand" "0,rI")))]
3309 [(set_attr "type" "icmov")])
3311 (define_insn "*movqicc_lbs"
3312 [(set (match_operand:QI 0 "register_operand" "=r,r")
3314 (ne (zero_extract:DI (match_operand:DI 2 "reg_or_0_operand" "rJ,rJ")
3318 (match_operand:QI 1 "reg_or_8bit_operand" "rI,0")
3319 (match_operand:QI 3 "reg_or_8bit_operand" "0,rI")))]
3324 [(set_attr "type" "icmov")])
3326 (define_insn "*movhicc_lbs"
3327 [(set (match_operand:HI 0 "register_operand" "=r,r")
3329 (ne (zero_extract:DI (match_operand:DI 2 "reg_or_0_operand" "rJ,rJ")
3333 (match_operand:HI 1 "reg_or_8bit_operand" "rI,0")
3334 (match_operand:HI 3 "reg_or_8bit_operand" "0,rI")))]
3339 [(set_attr "type" "icmov")])
3341 (define_insn "*movsicc_lbs"
3342 [(set (match_operand:SI 0 "register_operand" "=r,r")
3344 (ne (zero_extract:DI (match_operand:DI 2 "reg_or_0_operand" "rJ,rJ")
3348 (match_operand:SI 1 "reg_or_8bit_operand" "rI,0")
3349 (match_operand:SI 3 "reg_or_8bit_operand" "0,rI")))]
3354 [(set_attr "type" "icmov")])
3356 (define_insn "*movdicc_lbs"
3357 [(set (match_operand:DI 0 "register_operand" "=r,r")
3359 (ne (zero_extract:DI (match_operand:DI 2 "reg_or_0_operand" "rJ,rJ")
3363 (match_operand:DI 1 "reg_or_8bit_operand" "rI,0")
3364 (match_operand:DI 3 "reg_or_8bit_operand" "0,rI")))]
3369 [(set_attr "type" "icmov")])
3371 ;; For ABS, we have two choices, depending on whether the input and output
3372 ;; registers are the same or not.
3373 (define_expand "absdi2"
3374 [(set (match_operand:DI 0 "register_operand" "")
3375 (abs:DI (match_operand:DI 1 "register_operand" "")))]
3378 if (rtx_equal_p (operands[0], operands[1]))
3379 emit_insn (gen_absdi2_same (operands[0], gen_reg_rtx (DImode)));
3381 emit_insn (gen_absdi2_diff (operands[0], operands[1]));
3385 (define_expand "absdi2_same"
3386 [(set (match_operand:DI 1 "register_operand" "")
3387 (neg:DI (match_operand:DI 0 "register_operand" "")))
3389 (if_then_else:DI (ge (match_dup 0) (const_int 0))
3395 (define_expand "absdi2_diff"
3396 [(set (match_operand:DI 0 "register_operand" "")
3397 (neg:DI (match_operand:DI 1 "register_operand" "")))
3399 (if_then_else:DI (lt (match_dup 1) (const_int 0))
3406 [(set (match_operand:DI 0 "register_operand" "")
3407 (abs:DI (match_dup 0)))
3408 (clobber (match_operand:DI 1 "register_operand" ""))]
3410 [(set (match_dup 1) (neg:DI (match_dup 0)))
3411 (set (match_dup 0) (if_then_else:DI (ge (match_dup 0) (const_int 0))
3412 (match_dup 0) (match_dup 1)))]
3416 [(set (match_operand:DI 0 "register_operand" "")
3417 (abs:DI (match_operand:DI 1 "register_operand" "")))]
3418 "! rtx_equal_p (operands[0], operands[1])"
3419 [(set (match_dup 0) (neg:DI (match_dup 1)))
3420 (set (match_dup 0) (if_then_else:DI (lt (match_dup 1) (const_int 0))
3421 (match_dup 0) (match_dup 1)))]
3425 [(set (match_operand:DI 0 "register_operand" "")
3426 (neg:DI (abs:DI (match_dup 0))))
3427 (clobber (match_operand:DI 1 "register_operand" ""))]
3429 [(set (match_dup 1) (neg:DI (match_dup 0)))
3430 (set (match_dup 0) (if_then_else:DI (le (match_dup 0) (const_int 0))
3431 (match_dup 0) (match_dup 1)))]
3435 [(set (match_operand:DI 0 "register_operand" "")
3436 (neg:DI (abs:DI (match_operand:DI 1 "register_operand" ""))))]
3437 "! rtx_equal_p (operands[0], operands[1])"
3438 [(set (match_dup 0) (neg:DI (match_dup 1)))
3439 (set (match_dup 0) (if_then_else:DI (gt (match_dup 1) (const_int 0))
3440 (match_dup 0) (match_dup 1)))]
3443 (define_insn "sminqi3"
3444 [(set (match_operand:QI 0 "register_operand" "=r")
3445 (smin:QI (match_operand:QI 1 "reg_or_0_operand" "%rJ")
3446 (match_operand:QI 2 "reg_or_8bit_operand" "rI")))]
3449 [(set_attr "type" "mvi")])
3451 (define_insn "uminqi3"
3452 [(set (match_operand:QI 0 "register_operand" "=r")
3453 (umin:QI (match_operand:QI 1 "reg_or_0_operand" "%rJ")
3454 (match_operand:QI 2 "reg_or_8bit_operand" "rI")))]
3457 [(set_attr "type" "mvi")])
3459 (define_insn "smaxqi3"
3460 [(set (match_operand:QI 0 "register_operand" "=r")
3461 (smax:QI (match_operand:QI 1 "reg_or_0_operand" "%rJ")
3462 (match_operand:QI 2 "reg_or_8bit_operand" "rI")))]
3465 [(set_attr "type" "mvi")])
3467 (define_insn "umaxqi3"
3468 [(set (match_operand:QI 0 "register_operand" "=r")
3469 (umax:QI (match_operand:QI 1 "reg_or_0_operand" "%rJ")
3470 (match_operand:QI 2 "reg_or_8bit_operand" "rI")))]
3473 [(set_attr "type" "mvi")])
3475 (define_insn "sminhi3"
3476 [(set (match_operand:HI 0 "register_operand" "=r")
3477 (smin:HI (match_operand:HI 1 "reg_or_0_operand" "%rJ")
3478 (match_operand:HI 2 "reg_or_8bit_operand" "rI")))]
3481 [(set_attr "type" "mvi")])
3483 (define_insn "uminhi3"
3484 [(set (match_operand:HI 0 "register_operand" "=r")
3485 (umin:HI (match_operand:HI 1 "reg_or_0_operand" "%rJ")
3486 (match_operand:HI 2 "reg_or_8bit_operand" "rI")))]
3489 [(set_attr "type" "mvi")])
3491 (define_insn "smaxhi3"
3492 [(set (match_operand:HI 0 "register_operand" "=r")
3493 (smax:HI (match_operand:HI 1 "reg_or_0_operand" "%rJ")
3494 (match_operand:HI 2 "reg_or_8bit_operand" "rI")))]
3497 [(set_attr "type" "mvi")])
3499 (define_insn "umaxhi3"
3500 [(set (match_operand:HI 0 "register_operand" "=r")
3501 (umax:HI (match_operand:HI 1 "reg_or_0_operand" "%rJ")
3502 (match_operand:HI 2 "reg_or_8bit_operand" "rI")))]
3505 [(set_attr "type" "mvi")])
3507 (define_expand "smaxdi3"
3509 (le:DI (match_operand:DI 1 "reg_or_0_operand" "")
3510 (match_operand:DI 2 "reg_or_8bit_operand" "")))
3511 (set (match_operand:DI 0 "register_operand" "")
3512 (if_then_else:DI (eq (match_dup 3) (const_int 0))
3513 (match_dup 1) (match_dup 2)))]
3515 { operands[3] = gen_reg_rtx (DImode); })
3518 [(set (match_operand:DI 0 "register_operand" "")
3519 (smax:DI (match_operand:DI 1 "reg_or_0_operand" "")
3520 (match_operand:DI 2 "reg_or_8bit_operand" "")))
3521 (clobber (match_operand:DI 3 "register_operand" ""))]
3522 "operands[2] != const0_rtx"
3523 [(set (match_dup 3) (le:DI (match_dup 1) (match_dup 2)))
3524 (set (match_dup 0) (if_then_else:DI (eq (match_dup 3) (const_int 0))
3525 (match_dup 1) (match_dup 2)))]
3528 (define_insn "*smax_const0"
3529 [(set (match_operand:DI 0 "register_operand" "=r")
3530 (smax:DI (match_operand:DI 1 "register_operand" "0")
3534 [(set_attr "type" "icmov")])
3536 (define_expand "smindi3"
3538 (lt:DI (match_operand:DI 1 "reg_or_0_operand" "")
3539 (match_operand:DI 2 "reg_or_8bit_operand" "")))
3540 (set (match_operand:DI 0 "register_operand" "")
3541 (if_then_else:DI (ne (match_dup 3) (const_int 0))
3542 (match_dup 1) (match_dup 2)))]
3544 { operands[3] = gen_reg_rtx (DImode); })
3547 [(set (match_operand:DI 0 "register_operand" "")
3548 (smin:DI (match_operand:DI 1 "reg_or_0_operand" "")
3549 (match_operand:DI 2 "reg_or_8bit_operand" "")))
3550 (clobber (match_operand:DI 3 "register_operand" ""))]
3551 "operands[2] != const0_rtx"
3552 [(set (match_dup 3) (lt:DI (match_dup 1) (match_dup 2)))
3553 (set (match_dup 0) (if_then_else:DI (ne (match_dup 3) (const_int 0))
3554 (match_dup 1) (match_dup 2)))]
3557 (define_insn "*smin_const0"
3558 [(set (match_operand:DI 0 "register_operand" "=r")
3559 (smin:DI (match_operand:DI 1 "register_operand" "0")
3563 [(set_attr "type" "icmov")])
3565 (define_expand "umaxdi3"
3567 (leu:DI (match_operand:DI 1 "reg_or_0_operand" "")
3568 (match_operand:DI 2 "reg_or_8bit_operand" "")))
3569 (set (match_operand:DI 0 "register_operand" "")
3570 (if_then_else:DI (eq (match_dup 3) (const_int 0))
3571 (match_dup 1) (match_dup 2)))]
3573 "operands[3] = gen_reg_rtx (DImode);")
3576 [(set (match_operand:DI 0 "register_operand" "")
3577 (umax:DI (match_operand:DI 1 "reg_or_0_operand" "")
3578 (match_operand:DI 2 "reg_or_8bit_operand" "")))
3579 (clobber (match_operand:DI 3 "register_operand" ""))]
3580 "operands[2] != const0_rtx"
3581 [(set (match_dup 3) (leu:DI (match_dup 1) (match_dup 2)))
3582 (set (match_dup 0) (if_then_else:DI (eq (match_dup 3) (const_int 0))
3583 (match_dup 1) (match_dup 2)))]
3586 (define_expand "umindi3"
3588 (ltu:DI (match_operand:DI 1 "reg_or_0_operand" "")
3589 (match_operand:DI 2 "reg_or_8bit_operand" "")))
3590 (set (match_operand:DI 0 "register_operand" "")
3591 (if_then_else:DI (ne (match_dup 3) (const_int 0))
3592 (match_dup 1) (match_dup 2)))]
3594 "operands[3] = gen_reg_rtx (DImode);")
3597 [(set (match_operand:DI 0 "register_operand" "")
3598 (umin:DI (match_operand:DI 1 "reg_or_0_operand" "")
3599 (match_operand:DI 2 "reg_or_8bit_operand" "")))
3600 (clobber (match_operand:DI 3 "register_operand" ""))]
3601 "operands[2] != const0_rtx"
3602 [(set (match_dup 3) (ltu:DI (match_dup 1) (match_dup 2)))
3603 (set (match_dup 0) (if_then_else:DI (ne (match_dup 3) (const_int 0))
3604 (match_dup 1) (match_dup 2)))]
3607 (define_insn "*bcc_normal"
3610 (match_operator 1 "signed_comparison_operator"
3611 [(match_operand:DI 2 "reg_or_0_operand" "rJ")
3613 (label_ref (match_operand 0 "" ""))
3617 [(set_attr "type" "ibr")])
3619 (define_insn "*bcc_reverse"
3622 (match_operator 1 "signed_comparison_operator"
3623 [(match_operand:DI 2 "register_operand" "r")
3627 (label_ref (match_operand 0 "" ""))))]
3630 [(set_attr "type" "ibr")])
3632 (define_insn "*blbs_normal"
3635 (ne (zero_extract:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
3639 (label_ref (match_operand 0 "" ""))
3643 [(set_attr "type" "ibr")])
3645 (define_insn "*blbc_normal"
3648 (eq (zero_extract:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
3652 (label_ref (match_operand 0 "" ""))
3656 [(set_attr "type" "ibr")])
3662 (match_operator 1 "comparison_operator"
3663 [(zero_extract:DI (match_operand:DI 2 "register_operand" "")
3665 (match_operand:DI 3 "const_int_operand" ""))
3667 (label_ref (match_operand 0 "" ""))
3669 (clobber (match_operand:DI 4 "register_operand" ""))])]
3670 "INTVAL (operands[3]) != 0"
3672 (lshiftrt:DI (match_dup 2) (match_dup 3)))
3674 (if_then_else (match_op_dup 1
3675 [(zero_extract:DI (match_dup 4)
3679 (label_ref (match_dup 0))
3683 ;; The following are the corresponding floating-point insns. Recall
3684 ;; we need to have variants that expand the arguments from SFmode
3687 (define_insn "*cmpdf_ieee"
3688 [(set (match_operand:DF 0 "register_operand" "=&f")
3689 (match_operator:DF 1 "alpha_fp_comparison_operator"
3690 [(match_operand:DF 2 "reg_or_0_operand" "fG")
3691 (match_operand:DF 3 "reg_or_0_operand" "fG")]))]
3692 "TARGET_FP && alpha_fptm >= ALPHA_FPTM_SU"
3693 "cmp%-%C1%/ %R2,%R3,%0"
3694 [(set_attr "type" "fadd")
3695 (set_attr "trap" "yes")
3696 (set_attr "trap_suffix" "su")])
3698 (define_insn "*cmpdf_internal"
3699 [(set (match_operand:DF 0 "register_operand" "=f")
3700 (match_operator:DF 1 "alpha_fp_comparison_operator"
3701 [(match_operand:DF 2 "reg_or_0_operand" "fG")
3702 (match_operand:DF 3 "reg_or_0_operand" "fG")]))]
3704 "cmp%-%C1%/ %R2,%R3,%0"
3705 [(set_attr "type" "fadd")
3706 (set_attr "trap" "yes")
3707 (set_attr "trap_suffix" "su")])
3709 (define_insn "*cmpdf_ext1"
3710 [(set (match_operand:DF 0 "register_operand" "=f")
3711 (match_operator:DF 1 "alpha_fp_comparison_operator"
3713 (match_operand:SF 2 "reg_or_0_operand" "fG"))
3714 (match_operand:DF 3 "reg_or_0_operand" "fG")]))]
3715 "TARGET_FP && alpha_fptm < ALPHA_FPTM_SU"
3716 "cmp%-%C1%/ %R2,%R3,%0"
3717 [(set_attr "type" "fadd")
3718 (set_attr "trap" "yes")
3719 (set_attr "trap_suffix" "su")])
3721 (define_insn "*cmpdf_ext2"
3722 [(set (match_operand:DF 0 "register_operand" "=f")
3723 (match_operator:DF 1 "alpha_fp_comparison_operator"
3724 [(match_operand:DF 2 "reg_or_0_operand" "fG")
3726 (match_operand:SF 3 "reg_or_0_operand" "fG"))]))]
3727 "TARGET_FP && alpha_fptm < ALPHA_FPTM_SU"
3728 "cmp%-%C1%/ %R2,%R3,%0"
3729 [(set_attr "type" "fadd")
3730 (set_attr "trap" "yes")
3731 (set_attr "trap_suffix" "su")])
3733 (define_insn "*cmpdf_ext3"
3734 [(set (match_operand:DF 0 "register_operand" "=f")
3735 (match_operator:DF 1 "alpha_fp_comparison_operator"
3737 (match_operand:SF 2 "reg_or_0_operand" "fG"))
3739 (match_operand:SF 3 "reg_or_0_operand" "fG"))]))]
3740 "TARGET_FP && alpha_fptm < ALPHA_FPTM_SU"
3741 "cmp%-%C1%/ %R2,%R3,%0"
3742 [(set_attr "type" "fadd")
3743 (set_attr "trap" "yes")
3744 (set_attr "trap_suffix" "su")])
3746 (define_insn "*movdfcc_internal"
3747 [(set (match_operand:DF 0 "register_operand" "=f,f")
3749 (match_operator 3 "signed_comparison_operator"
3750 [(match_operand:DF 4 "reg_or_0_operand" "fG,fG")
3751 (match_operand:DF 2 "const0_operand" "G,G")])
3752 (match_operand:DF 1 "reg_or_0_operand" "fG,0")
3753 (match_operand:DF 5 "reg_or_0_operand" "0,fG")))]
3757 fcmov%D3 %R4,%R5,%0"
3758 [(set_attr "type" "fcmov")])
3760 (define_insn "*movsfcc_internal"
3761 [(set (match_operand:SF 0 "register_operand" "=f,f")
3763 (match_operator 3 "signed_comparison_operator"
3764 [(match_operand:DF 4 "reg_or_0_operand" "fG,fG")
3765 (match_operand:DF 2 "const0_operand" "G,G")])
3766 (match_operand:SF 1 "reg_or_0_operand" "fG,0")
3767 (match_operand:SF 5 "reg_or_0_operand" "0,fG")))]
3771 fcmov%D3 %R4,%R5,%0"
3772 [(set_attr "type" "fcmov")])
3774 (define_insn "*movdfcc_ext1"
3775 [(set (match_operand:DF 0 "register_operand" "=f,f")
3777 (match_operator 3 "signed_comparison_operator"
3778 [(match_operand:DF 4 "reg_or_0_operand" "fG,fG")
3779 (match_operand:DF 2 "const0_operand" "G,G")])
3780 (float_extend:DF (match_operand:SF 1 "reg_or_0_operand" "fG,0"))
3781 (match_operand:DF 5 "reg_or_0_operand" "0,fG")))]
3782 "TARGET_FP && alpha_fptm < ALPHA_FPTM_SU"
3785 fcmov%D3 %R4,%R5,%0"
3786 [(set_attr "type" "fcmov")])
3788 (define_insn "*movdfcc_ext2"
3789 [(set (match_operand:DF 0 "register_operand" "=f,f")
3791 (match_operator 3 "signed_comparison_operator"
3793 (match_operand:SF 4 "reg_or_0_operand" "fG,fG"))
3794 (match_operand:DF 2 "const0_operand" "G,G")])
3795 (match_operand:DF 1 "reg_or_0_operand" "fG,0")
3796 (match_operand:DF 5 "reg_or_0_operand" "0,fG")))]
3797 "TARGET_FP && alpha_fptm < ALPHA_FPTM_SU"
3800 fcmov%D3 %R4,%R5,%0"
3801 [(set_attr "type" "fcmov")])
3803 (define_insn "*movdfcc_ext3"
3804 [(set (match_operand:SF 0 "register_operand" "=f,f")
3806 (match_operator 3 "signed_comparison_operator"
3808 (match_operand:SF 4 "reg_or_0_operand" "fG,fG"))
3809 (match_operand:DF 2 "const0_operand" "G,G")])
3810 (match_operand:SF 1 "reg_or_0_operand" "fG,0")
3811 (match_operand:SF 5 "reg_or_0_operand" "0,fG")))]
3812 "TARGET_FP && alpha_fptm < ALPHA_FPTM_SU"
3815 fcmov%D3 %R4,%R5,%0"
3816 [(set_attr "type" "fcmov")])
3818 (define_insn "*movdfcc_ext4"
3819 [(set (match_operand:DF 0 "register_operand" "=f,f")
3821 (match_operator 3 "signed_comparison_operator"
3823 (match_operand:SF 4 "reg_or_0_operand" "fG,fG"))
3824 (match_operand:DF 2 "const0_operand" "G,G")])
3825 (float_extend:DF (match_operand:SF 1 "reg_or_0_operand" "fG,0"))
3826 (match_operand:DF 5 "reg_or_0_operand" "0,fG")))]
3827 "TARGET_FP && alpha_fptm < ALPHA_FPTM_SU"
3830 fcmov%D3 %R4,%R5,%0"
3831 [(set_attr "type" "fcmov")])
3833 (define_expand "smaxdf3"
3835 (le:DF (match_operand:DF 1 "reg_or_0_operand" "")
3836 (match_operand:DF 2 "reg_or_0_operand" "")))
3837 (set (match_operand:DF 0 "register_operand" "")
3838 (if_then_else:DF (eq (match_dup 3) (match_dup 4))
3839 (match_dup 1) (match_dup 2)))]
3842 operands[3] = gen_reg_rtx (DFmode);
3843 operands[4] = CONST0_RTX (DFmode);
3846 (define_expand "smindf3"
3848 (lt:DF (match_operand:DF 1 "reg_or_0_operand" "")
3849 (match_operand:DF 2 "reg_or_0_operand" "")))
3850 (set (match_operand:DF 0 "register_operand" "")
3851 (if_then_else:DF (ne (match_dup 3) (match_dup 4))
3852 (match_dup 1) (match_dup 2)))]
3855 operands[3] = gen_reg_rtx (DFmode);
3856 operands[4] = CONST0_RTX (DFmode);
3859 (define_expand "smaxsf3"
3861 (le:DF (float_extend:DF (match_operand:SF 1 "reg_or_0_operand" ""))
3862 (float_extend:DF (match_operand:SF 2 "reg_or_0_operand" ""))))
3863 (set (match_operand:SF 0 "register_operand" "")
3864 (if_then_else:SF (eq (match_dup 3) (match_dup 4))
3865 (match_dup 1) (match_dup 2)))]
3868 operands[3] = gen_reg_rtx (DFmode);
3869 operands[4] = CONST0_RTX (DFmode);
3872 (define_expand "sminsf3"
3874 (lt:DF (float_extend:DF (match_operand:SF 1 "reg_or_0_operand" ""))
3875 (float_extend:DF (match_operand:SF 2 "reg_or_0_operand" ""))))
3876 (set (match_operand:SF 0 "register_operand" "")
3877 (if_then_else:SF (ne (match_dup 3) (match_dup 4))
3878 (match_dup 1) (match_dup 2)))]
3881 operands[3] = gen_reg_rtx (DFmode);
3882 operands[4] = CONST0_RTX (DFmode);
3885 (define_insn "*fbcc_normal"
3888 (match_operator 1 "signed_comparison_operator"
3889 [(match_operand:DF 2 "reg_or_0_operand" "fG")
3890 (match_operand:DF 3 "const0_operand" "G")])
3891 (label_ref (match_operand 0 "" ""))
3895 [(set_attr "type" "fbr")])
3897 (define_insn "*fbcc_ext_normal"
3900 (match_operator 1 "signed_comparison_operator"
3902 (match_operand:SF 2 "reg_or_0_operand" "fG"))
3903 (match_operand:DF 3 "const0_operand" "G")])
3904 (label_ref (match_operand 0 "" ""))
3908 [(set_attr "type" "fbr")])
3910 ;; These are the main define_expand's used to make conditional branches
3913 (define_expand "cbranchdf4"
3914 [(use (match_operator 0 "alpha_cbranch_operator"
3915 [(match_operand:DF 1 "reg_or_0_operand" "")
3916 (match_operand:DF 2 "reg_or_0_operand" "")]))
3917 (use (match_operand 3 ""))]
3919 { alpha_emit_conditional_branch (operands, DFmode); DONE; })
3921 (define_expand "cbranchtf4"
3922 [(use (match_operator 0 "alpha_cbranch_operator"
3923 [(match_operand:TF 1 "general_operand")
3924 (match_operand:TF 2 "general_operand")]))
3925 (use (match_operand 3 ""))]
3926 "TARGET_HAS_XFLOATING_LIBS"
3927 { alpha_emit_conditional_branch (operands, TFmode); DONE; })
3929 (define_expand "cbranchdi4"
3930 [(use (match_operator 0 "alpha_cbranch_operator"
3931 [(match_operand:DI 1 "some_operand")
3932 (match_operand:DI 2 "some_operand")]))
3933 (use (match_operand 3 ""))]
3935 { alpha_emit_conditional_branch (operands, DImode); DONE; })
3937 (define_expand "cstoredf4"
3938 [(use (match_operator:DI 1 "alpha_cbranch_operator"
3939 [(match_operand:DF 2 "reg_or_0_operand")
3940 (match_operand:DF 3 "reg_or_0_operand")]))
3941 (clobber (match_operand:DI 0 "register_operand"))]
3943 { if (!alpha_emit_setcc (operands, DFmode)) FAIL; else DONE; })
3945 (define_expand "cstoretf4"
3946 [(use (match_operator:DI 1 "alpha_cbranch_operator"
3947 [(match_operand:TF 2 "general_operand")
3948 (match_operand:TF 3 "general_operand")]))
3949 (clobber (match_operand:DI 0 "register_operand"))]
3950 "TARGET_HAS_XFLOATING_LIBS"
3951 { if (!alpha_emit_setcc (operands, TFmode)) FAIL; else DONE; })
3953 (define_expand "cstoredi4"
3954 [(use (match_operator:DI 1 "alpha_cbranch_operator"
3955 [(match_operand:DI 2 "some_operand")
3956 (match_operand:DI 3 "some_operand")]))
3957 (clobber (match_operand:DI 0 "register_operand"))]
3959 { if (!alpha_emit_setcc (operands, DImode)) FAIL; else DONE; })
3961 ;; These are the main define_expand's used to make conditional moves.
3963 (define_expand "movsicc"
3964 [(set (match_operand:SI 0 "register_operand" "")
3965 (if_then_else:SI (match_operand 1 "comparison_operator" "")
3966 (match_operand:SI 2 "reg_or_8bit_operand" "")
3967 (match_operand:SI 3 "reg_or_8bit_operand" "")))]
3970 if ((operands[1] = alpha_emit_conditional_move (operands[1], SImode)) == 0)
3974 (define_expand "movdicc"
3975 [(set (match_operand:DI 0 "register_operand" "")
3976 (if_then_else:DI (match_operand 1 "comparison_operator" "")
3977 (match_operand:DI 2 "reg_or_8bit_operand" "")
3978 (match_operand:DI 3 "reg_or_8bit_operand" "")))]
3981 if ((operands[1] = alpha_emit_conditional_move (operands[1], DImode)) == 0)
3985 (define_expand "movsfcc"
3986 [(set (match_operand:SF 0 "register_operand" "")
3987 (if_then_else:SF (match_operand 1 "comparison_operator" "")
3988 (match_operand:SF 2 "reg_or_8bit_operand" "")
3989 (match_operand:SF 3 "reg_or_8bit_operand" "")))]
3992 if ((operands[1] = alpha_emit_conditional_move (operands[1], SFmode)) == 0)
3996 (define_expand "movdfcc"
3997 [(set (match_operand:DF 0 "register_operand" "")
3998 (if_then_else:DF (match_operand 1 "comparison_operator" "")
3999 (match_operand:DF 2 "reg_or_8bit_operand" "")
4000 (match_operand:DF 3 "reg_or_8bit_operand" "")))]
4003 if ((operands[1] = alpha_emit_conditional_move (operands[1], DFmode)) == 0)
4007 ;; These define_split definitions are used in cases when comparisons have
4008 ;; not be stated in the correct way and we need to reverse the second
4009 ;; comparison. For example, x >= 7 has to be done as x < 6 with the
4010 ;; comparison that tests the result being reversed. We have one define_split
4011 ;; for each use of a comparison. They do not match valid insns and need
4012 ;; not generate valid insns.
4014 ;; We can also handle equality comparisons (and inequality comparisons in
4015 ;; cases where the resulting add cannot overflow) by doing an add followed by
4016 ;; a comparison with zero. This is faster since the addition takes one
4017 ;; less cycle than a compare when feeding into a conditional move.
4018 ;; For this case, we also have an SImode pattern since we can merge the add
4019 ;; and sign extend and the order doesn't matter.
4021 ;; We do not do this for floating-point, since it isn't clear how the "wrong"
4022 ;; operation could have been generated.
4025 [(set (match_operand:DI 0 "register_operand" "")
4027 (match_operator 1 "comparison_operator"
4028 [(match_operand:DI 2 "reg_or_0_operand" "")
4029 (match_operand:DI 3 "reg_or_cint_operand" "")])
4030 (match_operand:DI 4 "reg_or_cint_operand" "")
4031 (match_operand:DI 5 "reg_or_cint_operand" "")))
4032 (clobber (match_operand:DI 6 "register_operand" ""))]
4033 "operands[3] != const0_rtx"
4034 [(set (match_dup 6) (match_dup 7))
4036 (if_then_else:DI (match_dup 8) (match_dup 4) (match_dup 5)))]
4038 enum rtx_code code = GET_CODE (operands[1]);
4039 int unsignedp = (code == GEU || code == LEU || code == GTU || code == LTU);
4041 /* If we are comparing for equality with a constant and that constant
4042 appears in the arm when the register equals the constant, use the
4043 register since that is more likely to match (and to produce better code
4046 if (code == EQ && CONST_INT_P (operands[3])
4047 && rtx_equal_p (operands[4], operands[3]))
4048 operands[4] = operands[2];
4050 else if (code == NE && CONST_INT_P (operands[3])
4051 && rtx_equal_p (operands[5], operands[3]))
4052 operands[5] = operands[2];
4054 if (code == NE || code == EQ
4055 || (extended_count (operands[2], DImode, unsignedp) >= 1
4056 && extended_count (operands[3], DImode, unsignedp) >= 1))
4058 if (CONST_INT_P (operands[3]))
4059 operands[7] = gen_rtx_PLUS (DImode, operands[2],
4060 GEN_INT (- INTVAL (operands[3])));
4062 operands[7] = gen_rtx_MINUS (DImode, operands[2], operands[3]);
4064 operands[8] = gen_rtx_fmt_ee (code, VOIDmode, operands[6], const0_rtx);
4067 else if (code == EQ || code == LE || code == LT
4068 || code == LEU || code == LTU)
4070 operands[7] = gen_rtx_fmt_ee (code, DImode, operands[2], operands[3]);
4071 operands[8] = gen_rtx_NE (VOIDmode, operands[6], const0_rtx);
4075 operands[7] = gen_rtx_fmt_ee (reverse_condition (code), DImode,
4076 operands[2], operands[3]);
4077 operands[8] = gen_rtx_EQ (VOIDmode, operands[6], const0_rtx);
4082 [(set (match_operand:DI 0 "register_operand" "")
4084 (match_operator 1 "comparison_operator"
4085 [(match_operand:SI 2 "reg_or_0_operand" "")
4086 (match_operand:SI 3 "reg_or_cint_operand" "")])
4087 (match_operand:DI 4 "reg_or_8bit_operand" "")
4088 (match_operand:DI 5 "reg_or_8bit_operand" "")))
4089 (clobber (match_operand:DI 6 "register_operand" ""))]
4090 "operands[3] != const0_rtx
4091 && (GET_CODE (operands[1]) == EQ || GET_CODE (operands[1]) == NE)"
4092 [(set (match_dup 6) (match_dup 7))
4094 (if_then_else:DI (match_dup 8) (match_dup 4) (match_dup 5)))]
4096 enum rtx_code code = GET_CODE (operands[1]);
4097 int unsignedp = (code == GEU || code == LEU || code == GTU || code == LTU);
4100 if ((code != NE && code != EQ
4101 && ! (extended_count (operands[2], DImode, unsignedp) >= 1
4102 && extended_count (operands[3], DImode, unsignedp) >= 1)))
4105 if (CONST_INT_P (operands[3]))
4106 tem = gen_rtx_PLUS (SImode, operands[2],
4107 GEN_INT (- INTVAL (operands[3])));
4109 tem = gen_rtx_MINUS (SImode, operands[2], operands[3]);
4111 operands[7] = gen_rtx_SIGN_EXTEND (DImode, tem);
4112 operands[8] = gen_rtx_fmt_ee (GET_CODE (operands[1]), VOIDmode,
4113 operands[6], const0_rtx);
4116 ;; Prefer to use cmp and arithmetic when possible instead of a cmove.
4119 [(set (match_operand 0 "register_operand" "")
4120 (if_then_else (match_operator 1 "signed_comparison_operator"
4121 [(match_operand:DI 2 "reg_or_0_operand" "")
4123 (match_operand 3 "const_int_operand" "")
4124 (match_operand 4 "const_int_operand" "")))]
4128 if (alpha_split_conditional_move (GET_CODE (operands[1]), operands[0],
4129 operands[2], operands[3], operands[4]))
4135 ;; ??? Why combine is allowed to create such non-canonical rtl, I don't know.
4136 ;; Oh well, we match it in movcc, so it must be partially our fault.
4138 [(set (match_operand 0 "register_operand" "")
4139 (if_then_else (match_operator 1 "signed_comparison_operator"
4141 (match_operand:DI 2 "reg_or_0_operand" "")])
4142 (match_operand 3 "const_int_operand" "")
4143 (match_operand 4 "const_int_operand" "")))]
4147 if (alpha_split_conditional_move (swap_condition (GET_CODE (operands[1])),
4148 operands[0], operands[2], operands[3],
4155 (define_insn_and_split "*cmp_sadd_di"
4156 [(set (match_operand:DI 0 "register_operand" "=r")
4157 (plus:DI (if_then_else:DI
4158 (match_operator 1 "alpha_zero_comparison_operator"
4159 [(match_operand:DI 2 "reg_or_0_operand" "rJ")
4161 (match_operand:DI 3 "const48_operand" "I")
4163 (match_operand:DI 4 "sext_add_operand" "rIO")))
4164 (clobber (match_scratch:DI 5 "=r"))]
4169 (match_op_dup:DI 1 [(match_dup 2) (const_int 0)]))
4171 (plus:DI (mult:DI (match_dup 5) (match_dup 3))
4174 if (can_create_pseudo_p ())
4175 operands[5] = gen_reg_rtx (DImode);
4176 else if (reg_overlap_mentioned_p (operands[5], operands[4]))
4177 operands[5] = operands[0];
4180 (define_insn_and_split "*cmp_sadd_si"
4181 [(set (match_operand:SI 0 "register_operand" "=r")
4182 (plus:SI (if_then_else:SI
4183 (match_operator 1 "alpha_zero_comparison_operator"
4184 [(match_operand:DI 2 "reg_or_0_operand" "rJ")
4186 (match_operand:SI 3 "const48_operand" "I")
4188 (match_operand:SI 4 "sext_add_operand" "rIO")))
4189 (clobber (match_scratch:SI 5 "=r"))]
4194 (match_op_dup:SI 1 [(match_dup 2) (const_int 0)]))
4196 (plus:SI (mult:SI (match_dup 5) (match_dup 3))
4199 if (can_create_pseudo_p ())
4200 operands[5] = gen_reg_rtx (DImode);
4201 else if (reg_overlap_mentioned_p (operands[5], operands[4]))
4202 operands[5] = operands[0];
4205 (define_insn_and_split "*cmp_sadd_sidi"
4206 [(set (match_operand:DI 0 "register_operand" "=r")
4208 (plus:SI (if_then_else:SI
4209 (match_operator 1 "alpha_zero_comparison_operator"
4210 [(match_operand:DI 2 "reg_or_0_operand" "rJ")
4212 (match_operand:SI 3 "const48_operand" "I")
4214 (match_operand:SI 4 "sext_add_operand" "rIO"))))
4215 (clobber (match_scratch:SI 5 "=r"))]
4220 (match_op_dup:SI 1 [(match_dup 2) (const_int 0)]))
4222 (sign_extend:DI (plus:SI (mult:SI (match_dup 5) (match_dup 3))
4225 if (can_create_pseudo_p ())
4226 operands[5] = gen_reg_rtx (DImode);
4227 else if (reg_overlap_mentioned_p (operands[5], operands[4]))
4228 operands[5] = operands[0];
4231 (define_insn_and_split "*cmp_ssub_di"
4232 [(set (match_operand:DI 0 "register_operand" "=r")
4233 (minus:DI (if_then_else:DI
4234 (match_operator 1 "alpha_zero_comparison_operator"
4235 [(match_operand:DI 2 "reg_or_0_operand" "rJ")
4237 (match_operand:DI 3 "const48_operand" "I")
4239 (match_operand:DI 4 "reg_or_8bit_operand" "rI")))
4240 (clobber (match_scratch:DI 5 "=r"))]
4245 (match_op_dup:DI 1 [(match_dup 2) (const_int 0)]))
4247 (minus:DI (mult:DI (match_dup 5) (match_dup 3))
4250 if (can_create_pseudo_p ())
4251 operands[5] = gen_reg_rtx (DImode);
4252 else if (reg_overlap_mentioned_p (operands[5], operands[4]))
4253 operands[5] = operands[0];
4256 (define_insn_and_split "*cmp_ssub_si"
4257 [(set (match_operand:SI 0 "register_operand" "=r")
4258 (minus:SI (if_then_else:SI
4259 (match_operator 1 "alpha_zero_comparison_operator"
4260 [(match_operand:DI 2 "reg_or_0_operand" "rJ")
4262 (match_operand:SI 3 "const48_operand" "I")
4264 (match_operand:SI 4 "reg_or_8bit_operand" "rI")))
4265 (clobber (match_scratch:SI 5 "=r"))]
4270 (match_op_dup:SI 1 [(match_dup 2) (const_int 0)]))
4272 (minus:SI (mult:SI (match_dup 5) (match_dup 3))
4275 if (can_create_pseudo_p ())
4276 operands[5] = gen_reg_rtx (DImode);
4277 else if (reg_overlap_mentioned_p (operands[5], operands[4]))
4278 operands[5] = operands[0];
4281 (define_insn_and_split "*cmp_ssub_sidi"
4282 [(set (match_operand:DI 0 "register_operand" "=r")
4284 (minus:SI (if_then_else:SI
4285 (match_operator 1 "alpha_zero_comparison_operator"
4286 [(match_operand:DI 2 "reg_or_0_operand" "rJ")
4288 (match_operand:SI 3 "const48_operand" "I")
4290 (match_operand:SI 4 "reg_or_8bit_operand" "rI"))))
4291 (clobber (match_scratch:SI 5 "=r"))]
4296 (match_op_dup:SI 1 [(match_dup 2) (const_int 0)]))
4298 (sign_extend:DI (minus:SI (mult:SI (match_dup 5) (match_dup 3))
4301 if (can_create_pseudo_p ())
4302 operands[5] = gen_reg_rtx (DImode);
4303 else if (reg_overlap_mentioned_p (operands[5], operands[4]))
4304 operands[5] = operands[0];
4307 ;; Here are the CALL and unconditional branch insns. Calls on NT and OSF
4308 ;; work differently, so we have different patterns for each.
4310 ;; On Unicos/Mk a call information word (CIW) must be generated for each
4311 ;; call. The CIW contains information about arguments passed in registers
4312 ;; and is stored in the caller's SSIB. Its offset relative to the beginning
4313 ;; of the SSIB is passed in $25. Handling this properly is quite complicated
4314 ;; in the presence of inlining since the CIWs for calls performed by the
4315 ;; inlined function must be stored in the SSIB of the function it is inlined
4316 ;; into as well. We encode the CIW in an unspec and append it to the list
4317 ;; of the CIWs for the current function only when the instruction for loading
4318 ;; $25 is generated.
4320 (define_expand "call"
4321 [(use (match_operand:DI 0 "" ""))
4322 (use (match_operand 1 "" ""))
4323 (use (match_operand 2 "" ""))
4324 (use (match_operand 3 "" ""))]
4327 if (TARGET_ABI_WINDOWS_NT)
4328 emit_call_insn (gen_call_nt (operands[0], operands[1]));
4329 else if (TARGET_ABI_OPEN_VMS)
4330 emit_call_insn (gen_call_vms (operands[0], operands[2]));
4331 else if (TARGET_ABI_UNICOSMK)
4332 emit_call_insn (gen_call_umk (operands[0], operands[2]));
4334 emit_call_insn (gen_call_osf (operands[0], operands[1]));
4338 (define_expand "sibcall"
4339 [(parallel [(call (mem:DI (match_operand 0 "" ""))
4340 (match_operand 1 "" ""))
4341 (unspec [(reg:DI 29)] UNSPEC_SIBCALL)])]
4344 gcc_assert (MEM_P (operands[0]));
4345 operands[0] = XEXP (operands[0], 0);
4348 (define_expand "call_osf"
4349 [(parallel [(call (mem:DI (match_operand 0 "" ""))
4350 (match_operand 1 "" ""))
4352 (clobber (reg:DI 26))])]
4355 gcc_assert (MEM_P (operands[0]));
4357 operands[0] = XEXP (operands[0], 0);
4358 if (! call_operand (operands[0], Pmode))
4359 operands[0] = copy_to_mode_reg (Pmode, operands[0]);
4362 (define_expand "call_nt"
4363 [(parallel [(call (mem:DI (match_operand 0 "" ""))
4364 (match_operand 1 "" ""))
4365 (clobber (reg:DI 26))])]
4368 gcc_assert (MEM_P (operands[0]));
4370 operands[0] = XEXP (operands[0], 0);
4371 if (GET_CODE (operands[0]) != SYMBOL_REF && !REG_P (operands[0]))
4372 operands[0] = force_reg (DImode, operands[0]);
4375 ;; Calls on Unicos/Mk are always indirect.
4376 ;; op 0: symbol ref for called function
4377 ;; op 1: CIW for $25 represented by an unspec
4379 (define_expand "call_umk"
4380 [(parallel [(call (mem:DI (match_operand 0 "" ""))
4381 (match_operand 1 "" ""))
4383 (clobber (reg:DI 26))])]
4386 gcc_assert (MEM_P (operands[0]));
4388 /* Always load the address of the called function into a register;
4389 load the CIW in $25. */
4391 operands[0] = XEXP (operands[0], 0);
4392 if (!REG_P (operands[0]))
4393 operands[0] = force_reg (DImode, operands[0]);
4395 emit_move_insn (gen_rtx_REG (DImode, 25), operands[1]);
4399 ;; call openvms/alpha
4400 ;; op 0: symbol ref for called function
4401 ;; op 1: next_arg_reg (argument information value for R25)
4403 (define_expand "call_vms"
4404 [(parallel [(call (mem:DI (match_operand 0 "" ""))
4405 (match_operand 1 "" ""))
4409 (clobber (reg:DI 27))])]
4412 gcc_assert (MEM_P (operands[0]));
4414 operands[0] = XEXP (operands[0], 0);
4416 /* Always load AI with argument information, then handle symbolic and
4417 indirect call differently. Load RA and set operands[2] to PV in
4420 emit_move_insn (gen_rtx_REG (DImode, 25), operands[1]);
4421 if (GET_CODE (operands[0]) == SYMBOL_REF)
4423 alpha_need_linkage (XSTR (operands[0], 0), 0);
4425 operands[2] = const0_rtx;
4429 emit_move_insn (gen_rtx_REG (Pmode, 26),
4430 gen_rtx_MEM (Pmode, plus_constant (operands[0], 8)));
4431 operands[2] = operands[0];
4436 (define_expand "call_value"
4437 [(use (match_operand 0 "" ""))
4438 (use (match_operand:DI 1 "" ""))
4439 (use (match_operand 2 "" ""))
4440 (use (match_operand 3 "" ""))
4441 (use (match_operand 4 "" ""))]
4444 if (TARGET_ABI_WINDOWS_NT)
4445 emit_call_insn (gen_call_value_nt (operands[0], operands[1], operands[2]));
4446 else if (TARGET_ABI_OPEN_VMS)
4447 emit_call_insn (gen_call_value_vms (operands[0], operands[1],
4449 else if (TARGET_ABI_UNICOSMK)
4450 emit_call_insn (gen_call_value_umk (operands[0], operands[1],
4453 emit_call_insn (gen_call_value_osf (operands[0], operands[1],
4458 (define_expand "sibcall_value"
4459 [(parallel [(set (match_operand 0 "" "")
4460 (call (mem:DI (match_operand 1 "" ""))
4461 (match_operand 2 "" "")))
4462 (unspec [(reg:DI 29)] UNSPEC_SIBCALL)])]
4465 gcc_assert (MEM_P (operands[1]));
4466 operands[1] = XEXP (operands[1], 0);
4469 (define_expand "call_value_osf"
4470 [(parallel [(set (match_operand 0 "" "")
4471 (call (mem:DI (match_operand 1 "" ""))
4472 (match_operand 2 "" "")))
4474 (clobber (reg:DI 26))])]
4477 gcc_assert (MEM_P (operands[1]));
4479 operands[1] = XEXP (operands[1], 0);
4480 if (! call_operand (operands[1], Pmode))
4481 operands[1] = copy_to_mode_reg (Pmode, operands[1]);
4484 (define_expand "call_value_nt"
4485 [(parallel [(set (match_operand 0 "" "")
4486 (call (mem:DI (match_operand 1 "" ""))
4487 (match_operand 2 "" "")))
4488 (clobber (reg:DI 26))])]
4491 gcc_assert (MEM_P (operands[1]));
4493 operands[1] = XEXP (operands[1], 0);
4494 if (GET_CODE (operands[1]) != SYMBOL_REF && !REG_P (operands[1]))
4495 operands[1] = force_reg (DImode, operands[1]);
4498 (define_expand "call_value_vms"
4499 [(parallel [(set (match_operand 0 "" "")
4500 (call (mem:DI (match_operand:DI 1 "" ""))
4501 (match_operand 2 "" "")))
4505 (clobber (reg:DI 27))])]
4508 gcc_assert (MEM_P (operands[1]));
4510 operands[1] = XEXP (operands[1], 0);
4512 /* Always load AI with argument information, then handle symbolic and
4513 indirect call differently. Load RA and set operands[3] to PV in
4516 emit_move_insn (gen_rtx_REG (DImode, 25), operands[2]);
4517 if (GET_CODE (operands[1]) == SYMBOL_REF)
4519 alpha_need_linkage (XSTR (operands[1], 0), 0);
4521 operands[3] = const0_rtx;
4525 emit_move_insn (gen_rtx_REG (Pmode, 26),
4526 gen_rtx_MEM (Pmode, plus_constant (operands[1], 8)));
4527 operands[3] = operands[1];
4531 (define_expand "call_value_umk"
4532 [(parallel [(set (match_operand 0 "" "")
4533 (call (mem:DI (match_operand 1 "" ""))
4534 (match_operand 2 "" "")))
4536 (clobber (reg:DI 26))])]
4539 gcc_assert (MEM_P (operands[1]));
4541 operands[1] = XEXP (operands[1], 0);
4542 if (!REG_P (operands[1]))
4543 operands[1] = force_reg (DImode, operands[1]);
4545 emit_move_insn (gen_rtx_REG (DImode, 25), operands[2]);
4548 (define_insn "*call_osf_1_er_noreturn"
4549 [(call (mem:DI (match_operand:DI 0 "call_operand" "c,R,s"))
4550 (match_operand 1 "" ""))
4552 (clobber (reg:DI 26))]
4553 "TARGET_EXPLICIT_RELOCS && TARGET_ABI_OSF
4554 && find_reg_note (insn, REG_NORETURN, NULL_RTX)"
4557 bsr $26,%0\t\t!samegp
4558 ldq $27,%0($29)\t\t!literal!%#\;jsr $26,($27),%0\t\t!lituse_jsr!%#"
4559 [(set_attr "type" "jsr")
4560 (set_attr "length" "*,*,8")])
4562 (define_insn "*call_osf_1_er"
4563 [(call (mem:DI (match_operand:DI 0 "call_operand" "c,R,s"))
4564 (match_operand 1 "" ""))
4566 (clobber (reg:DI 26))]
4567 "TARGET_EXPLICIT_RELOCS && TARGET_ABI_OSF"
4569 jsr $26,(%0),0\;ldah $29,0($26)\t\t!gpdisp!%*\;lda $29,0($29)\t\t!gpdisp!%*
4570 bsr $26,%0\t\t!samegp
4571 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!%*"
4572 [(set_attr "type" "jsr")
4573 (set_attr "length" "12,*,16")])
4575 ;; We must use peep2 instead of a split because we need accurate life
4576 ;; information for $gp. Consider the case of { bar(); while (1); }.
4578 [(parallel [(call (mem:DI (match_operand:DI 0 "call_operand" ""))
4579 (match_operand 1 "" ""))
4581 (clobber (reg:DI 26))])]
4582 "TARGET_EXPLICIT_RELOCS && TARGET_ABI_OSF && reload_completed
4583 && ! samegp_function_operand (operands[0], Pmode)
4584 && (peep2_regno_dead_p (1, 29)
4585 || find_reg_note (insn, REG_NORETURN, NULL_RTX))"
4586 [(parallel [(call (mem:DI (match_dup 2))
4591 (clobber (reg:DI 26))])]
4593 if (CONSTANT_P (operands[0]))
4595 operands[2] = gen_rtx_REG (Pmode, 27);
4596 operands[3] = GEN_INT (alpha_next_sequence_number++);
4597 emit_insn (gen_movdi_er_high_g (operands[2], pic_offset_table_rtx,
4598 operands[0], operands[3]));
4602 operands[2] = operands[0];
4603 operands[0] = const0_rtx;
4604 operands[3] = const0_rtx;
4609 [(parallel [(call (mem:DI (match_operand:DI 0 "call_operand" ""))
4610 (match_operand 1 "" ""))
4612 (clobber (reg:DI 26))])]
4613 "TARGET_EXPLICIT_RELOCS && TARGET_ABI_OSF && reload_completed
4614 && ! samegp_function_operand (operands[0], Pmode)
4615 && ! (peep2_regno_dead_p (1, 29)
4616 || find_reg_note (insn, REG_NORETURN, NULL_RTX))"
4617 [(parallel [(call (mem:DI (match_dup 2))
4620 (unspec:DI [(match_dup 5) (match_dup 3)] UNSPEC_LDGP1))
4623 (clobber (reg:DI 26))])
4625 (unspec:DI [(match_dup 5) (match_dup 3)] UNSPEC_LDGP2))]
4627 if (CONSTANT_P (operands[0]))
4629 operands[2] = gen_rtx_REG (Pmode, 27);
4630 operands[4] = GEN_INT (alpha_next_sequence_number++);
4631 emit_insn (gen_movdi_er_high_g (operands[2], pic_offset_table_rtx,
4632 operands[0], operands[4]));
4636 operands[2] = operands[0];
4637 operands[0] = const0_rtx;
4638 operands[4] = const0_rtx;
4640 operands[3] = GEN_INT (alpha_next_sequence_number++);
4641 operands[5] = pic_offset_table_rtx;
4644 (define_insn "*call_osf_2_er_nogp"
4645 [(call (mem:DI (match_operand:DI 0 "register_operand" "c"))
4646 (match_operand 1 "" ""))
4648 (use (match_operand 2 "" ""))
4649 (use (match_operand 3 "const_int_operand" ""))
4650 (clobber (reg:DI 26))]
4651 "TARGET_EXPLICIT_RELOCS && TARGET_ABI_OSF"
4652 "jsr $26,(%0),%2%J3"
4653 [(set_attr "type" "jsr")])
4655 (define_insn "*call_osf_2_er"
4656 [(call (mem:DI (match_operand:DI 0 "register_operand" "c"))
4657 (match_operand 1 "" ""))
4659 (unspec:DI [(reg:DI 29) (match_operand 4 "const_int_operand" "")]
4661 (use (match_operand 2 "" ""))
4662 (use (match_operand 3 "const_int_operand" ""))
4663 (clobber (reg:DI 26))]
4664 "TARGET_EXPLICIT_RELOCS && TARGET_ABI_OSF"
4665 "jsr $26,(%0),%2%J3\;ldah $29,0($26)\t\t!gpdisp!%4"
4666 [(set_attr "type" "jsr")
4667 (set_attr "cannot_copy" "true")
4668 (set_attr "length" "8")])
4670 (define_insn "*call_osf_1_noreturn"
4671 [(call (mem:DI (match_operand:DI 0 "call_operand" "c,R,s"))
4672 (match_operand 1 "" ""))
4674 (clobber (reg:DI 26))]
4675 "! TARGET_EXPLICIT_RELOCS && TARGET_ABI_OSF
4676 && find_reg_note (insn, REG_NORETURN, NULL_RTX)"
4681 [(set_attr "type" "jsr")
4682 (set_attr "length" "*,*,8")])
4684 (define_insn "*call_osf_1"
4685 [(call (mem:DI (match_operand:DI 0 "call_operand" "c,R,s"))
4686 (match_operand 1 "" ""))
4688 (clobber (reg:DI 26))]
4689 "! TARGET_EXPLICIT_RELOCS && TARGET_ABI_OSF"
4691 jsr $26,($27),0\;ldgp $29,0($26)
4693 jsr $26,%0\;ldgp $29,0($26)"
4694 [(set_attr "type" "jsr")
4695 (set_attr "length" "12,*,16")])
4697 (define_insn "*sibcall_osf_1_er"
4698 [(call (mem:DI (match_operand:DI 0 "symbolic_operand" "R,s"))
4699 (match_operand 1 "" ""))
4700 (unspec [(reg:DI 29)] UNSPEC_SIBCALL)]
4701 "TARGET_EXPLICIT_RELOCS && TARGET_ABI_OSF"
4703 br $31,%0\t\t!samegp
4704 ldq $27,%0($29)\t\t!literal!%#\;jmp $31,($27),%0\t\t!lituse_jsr!%#"
4705 [(set_attr "type" "jsr")
4706 (set_attr "length" "*,8")])
4708 ;; Note that the DEC assembler expands "jmp foo" with $at, which
4709 ;; doesn't do what we want.
4710 (define_insn "*sibcall_osf_1"
4711 [(call (mem:DI (match_operand:DI 0 "symbolic_operand" "R,s"))
4712 (match_operand 1 "" ""))
4713 (unspec [(reg:DI 29)] UNSPEC_SIBCALL)]
4714 "! TARGET_EXPLICIT_RELOCS && TARGET_ABI_OSF"
4717 lda $27,%0\;jmp $31,($27),%0"
4718 [(set_attr "type" "jsr")
4719 (set_attr "length" "*,8")])
4721 (define_insn "*call_nt_1"
4722 [(call (mem:DI (match_operand:DI 0 "call_operand" "r,R,s"))
4723 (match_operand 1 "" ""))
4724 (clobber (reg:DI 26))]
4725 "TARGET_ABI_WINDOWS_NT"
4730 [(set_attr "type" "jsr")
4731 (set_attr "length" "*,*,12")])
4733 ; GAS relies on the order and position of instructions output below in order
4734 ; to generate relocs for VMS link to potentially optimize the call.
4735 ; Please do not molest.
4736 (define_insn "*call_vms_1"
4737 [(call (mem:DI (match_operand:DI 0 "call_operand" "r,s"))
4738 (match_operand 1 "" ""))
4739 (use (match_operand:DI 2 "nonmemory_operand" "r,n"))
4742 (clobber (reg:DI 27))]
4743 "TARGET_ABI_OPEN_VMS"
4745 switch (which_alternative)
4748 return "mov %2,$27\;jsr $26,0\;ldq $27,0($29)";
4750 operands [2] = alpha_use_linkage (operands [0], cfun->decl, 1, 0);
4751 operands [3] = alpha_use_linkage (operands [0], cfun->decl, 0, 0);
4752 return "ldq $26,%3\;ldq $27,%2\;jsr $26,%0\;ldq $27,0($29)";
4757 [(set_attr "type" "jsr")
4758 (set_attr "length" "12,16")])
4760 (define_insn "*call_umk_1"
4761 [(call (mem:DI (match_operand:DI 0 "call_operand" "r"))
4762 (match_operand 1 "" ""))
4764 (clobber (reg:DI 26))]
4765 "TARGET_ABI_UNICOSMK"
4767 [(set_attr "type" "jsr")])
4769 ;; Call subroutine returning any type.
4771 (define_expand "untyped_call"
4772 [(parallel [(call (match_operand 0 "" "")
4774 (match_operand 1 "" "")
4775 (match_operand 2 "" "")])]
4780 emit_call_insn (GEN_CALL (operands[0], const0_rtx, NULL, const0_rtx));
4782 for (i = 0; i < XVECLEN (operands[2], 0); i++)
4784 rtx set = XVECEXP (operands[2], 0, i);
4785 emit_move_insn (SET_DEST (set), SET_SRC (set));
4788 /* The optimizer does not know that the call sets the function value
4789 registers we stored in the result block. We avoid problems by
4790 claiming that all hard registers are used and clobbered at this
4792 emit_insn (gen_blockage ());
4797 ;; UNSPEC_VOLATILE is considered to use and clobber all hard registers and
4798 ;; all of memory. This blocks insns from being moved across this point.
4800 (define_insn "blockage"
4801 [(unspec_volatile [(const_int 0)] UNSPECV_BLOCKAGE)]
4804 [(set_attr "length" "0")
4805 (set_attr "type" "none")])
4809 (label_ref (match_operand 0 "" "")))]
4812 [(set_attr "type" "ibr")])
4814 (define_expand "return"
4819 (define_insn "*return_internal"
4823 [(set_attr "type" "ibr")])
4825 (define_insn "indirect_jump"
4826 [(set (pc) (match_operand:DI 0 "register_operand" "r"))]
4829 [(set_attr "type" "ibr")])
4831 (define_expand "tablejump"
4832 [(parallel [(set (pc)
4833 (match_operand 0 "register_operand" ""))
4834 (use (label_ref:DI (match_operand 1 "" "")))])]
4837 if (TARGET_ABI_WINDOWS_NT)
4839 rtx dest = gen_reg_rtx (DImode);
4840 emit_insn (gen_extendsidi2 (dest, operands[0]));
4843 else if (TARGET_ABI_OSF)
4845 rtx dest = gen_reg_rtx (DImode);
4846 emit_insn (gen_extendsidi2 (dest, operands[0]));
4847 emit_insn (gen_adddi3 (dest, pic_offset_table_rtx, dest));
4852 (define_insn "*tablejump_osf_nt_internal"
4854 (match_operand:DI 0 "register_operand" "r"))
4855 (use (label_ref:DI (match_operand 1 "" "")))]
4856 "(TARGET_ABI_OSF || TARGET_ABI_WINDOWS_NT)
4857 && alpha_tablejump_addr_vec (insn)"
4859 operands[2] = alpha_tablejump_best_label (insn);
4860 return "jmp $31,(%0),%2";
4862 [(set_attr "type" "ibr")])
4864 (define_insn "*tablejump_internal"
4866 (match_operand:DI 0 "register_operand" "r"))
4867 (use (label_ref (match_operand 1 "" "")))]
4870 [(set_attr "type" "ibr")])
4872 ;; Cache flush. Used by INITIALIZE_TRAMPOLINE. 0x86 is PAL_imb, but we don't
4873 ;; want to have to include pal.h in our .s file.
4875 [(unspec_volatile [(const_int 0)] UNSPECV_IMB)]
4878 [(set_attr "type" "callpal")])
4880 ;; BUGCHK is documented common to OSF/1 and VMS PALcode.
4881 ;; NT does not document anything at 0x81 -- presumably it would generate
4882 ;; the equivalent of SIGILL, but this isn't that important.
4883 ;; ??? Presuming unicosmk uses either OSF/1 or VMS PALcode.
4885 [(trap_if (const_int 1) (const_int 0))]
4886 "!TARGET_ABI_WINDOWS_NT"
4888 [(set_attr "type" "callpal")])
4890 ;; For userland, we load the thread pointer from the TCB.
4891 ;; For the kernel, we load the per-cpu private value.
4893 (define_insn "load_tp"
4894 [(set (match_operand:DI 0 "register_operand" "=v")
4895 (unspec:DI [(const_int 0)] UNSPEC_TP))]
4898 if (TARGET_TLS_KERNEL)
4899 return "call_pal 0x32";
4901 return "call_pal 0x9e";
4903 [(set_attr "type" "callpal")])
4905 ;; For completeness, and possibly a __builtin function, here's how to
4906 ;; set the thread pointer. Since we don't describe enough of this
4907 ;; quantity for CSE, we have to use a volatile unspec, and then there's
4908 ;; not much point in creating an R16_REG register class.
4910 (define_expand "set_tp"
4911 [(set (reg:DI 16) (match_operand:DI 0 "input_operand" ""))
4912 (unspec_volatile [(reg:DI 16)] UNSPECV_SET_TP)]
4916 (define_insn "*set_tp"
4917 [(unspec_volatile [(reg:DI 16)] UNSPECV_SET_TP)]
4920 if (TARGET_TLS_KERNEL)
4921 return "call_pal 0x31";
4923 return "call_pal 0x9f";
4925 [(set_attr "type" "callpal")])
4927 ;; Special builtins for establishing and reverting VMS condition handlers.
4929 (define_expand "builtin_establish_vms_condition_handler"
4930 [(set (reg:DI 0) (match_operand:DI 0 "register_operand" ""))
4931 (use (match_operand:DI 1 "address_operand" ""))]
4932 "TARGET_ABI_OPEN_VMS"
4934 alpha_expand_builtin_establish_vms_condition_handler (operands[0],
4938 (define_expand "builtin_revert_vms_condition_handler"
4939 [(set (reg:DI 0) (match_operand:DI 0 "register_operand" ""))]
4940 "TARGET_ABI_OPEN_VMS"
4942 alpha_expand_builtin_revert_vms_condition_handler (operands[0]);
4945 ;; Finally, we have the basic data motion insns. The byte and word insns
4946 ;; are done via define_expand. Start with the floating-point insns, since
4947 ;; they are simpler.
4949 (define_insn "*movsf_nofix"
4950 [(set (match_operand:SF 0 "nonimmediate_operand" "=f,f,*r,*r,m,m")
4951 (match_operand:SF 1 "input_operand" "fG,m,*rG,m,fG,*r"))]
4952 "TARGET_FPREGS && ! TARGET_FIX
4953 && (register_operand (operands[0], SFmode)
4954 || reg_or_0_operand (operands[1], SFmode))"
4962 [(set_attr "type" "fcpys,fld,ilog,ild,fst,ist")])
4964 (define_insn "*movsf_fix"
4965 [(set (match_operand:SF 0 "nonimmediate_operand" "=f,f,*r,*r,m,m,f,*r")
4966 (match_operand:SF 1 "input_operand" "fG,m,*rG,m,fG,*r,*r,f"))]
4967 "TARGET_FPREGS && TARGET_FIX
4968 && (register_operand (operands[0], SFmode)
4969 || reg_or_0_operand (operands[1], SFmode))"
4979 [(set_attr "type" "fcpys,fld,ilog,ild,fst,ist,itof,ftoi")])
4981 (define_insn "*movsf_nofp"
4982 [(set (match_operand:SF 0 "nonimmediate_operand" "=r,r,m")
4983 (match_operand:SF 1 "input_operand" "rG,m,r"))]
4985 && (register_operand (operands[0], SFmode)
4986 || reg_or_0_operand (operands[1], SFmode))"
4991 [(set_attr "type" "ilog,ild,ist")])
4993 (define_insn "*movdf_nofix"
4994 [(set (match_operand:DF 0 "nonimmediate_operand" "=f,f,*r,*r,m,m")
4995 (match_operand:DF 1 "input_operand" "fG,m,*rG,m,fG,*r"))]
4996 "TARGET_FPREGS && ! TARGET_FIX
4997 && (register_operand (operands[0], DFmode)
4998 || reg_or_0_operand (operands[1], DFmode))"
5006 [(set_attr "type" "fcpys,fld,ilog,ild,fst,ist")])
5008 (define_insn "*movdf_fix"
5009 [(set (match_operand:DF 0 "nonimmediate_operand" "=f,f,*r,*r,m,m,f,*r")
5010 (match_operand:DF 1 "input_operand" "fG,m,*rG,m,fG,*r,*r,f"))]
5011 "TARGET_FPREGS && TARGET_FIX
5012 && (register_operand (operands[0], DFmode)
5013 || reg_or_0_operand (operands[1], DFmode))"
5023 [(set_attr "type" "fcpys,fld,ilog,ild,fst,ist,itof,ftoi")])
5025 (define_insn "*movdf_nofp"
5026 [(set (match_operand:DF 0 "nonimmediate_operand" "=r,r,m")
5027 (match_operand:DF 1 "input_operand" "rG,m,r"))]
5029 && (register_operand (operands[0], DFmode)
5030 || reg_or_0_operand (operands[1], DFmode))"
5035 [(set_attr "type" "ilog,ild,ist")])
5037 ;; Subregs suck for register allocation. Pretend we can move TFmode
5038 ;; data between general registers until after reload.
5040 (define_insn_and_split "*movtf_internal"
5041 [(set (match_operand:TF 0 "nonimmediate_operand" "=r,o")
5042 (match_operand:TF 1 "input_operand" "roG,rG"))]
5043 "register_operand (operands[0], TFmode)
5044 || reg_or_0_operand (operands[1], TFmode)"
5047 [(set (match_dup 0) (match_dup 2))
5048 (set (match_dup 1) (match_dup 3))]
5050 alpha_split_tmode_pair (operands, TFmode, true);
5053 (define_expand "movsf"
5054 [(set (match_operand:SF 0 "nonimmediate_operand" "")
5055 (match_operand:SF 1 "general_operand" ""))]
5058 if (MEM_P (operands[0])
5059 && ! reg_or_0_operand (operands[1], SFmode))
5060 operands[1] = force_reg (SFmode, operands[1]);
5063 (define_expand "movdf"
5064 [(set (match_operand:DF 0 "nonimmediate_operand" "")
5065 (match_operand:DF 1 "general_operand" ""))]
5068 if (MEM_P (operands[0])
5069 && ! reg_or_0_operand (operands[1], DFmode))
5070 operands[1] = force_reg (DFmode, operands[1]);
5073 (define_expand "movtf"
5074 [(set (match_operand:TF 0 "nonimmediate_operand" "")
5075 (match_operand:TF 1 "general_operand" ""))]
5078 if (MEM_P (operands[0])
5079 && ! reg_or_0_operand (operands[1], TFmode))
5080 operands[1] = force_reg (TFmode, operands[1]);
5083 (define_insn "*movsi"
5084 [(set (match_operand:SI 0 "nonimmediate_operand" "=r,r,r,r,r,m")
5085 (match_operand:SI 1 "input_operand" "rJ,K,L,n,m,rJ"))]
5086 "(TARGET_ABI_OSF || TARGET_ABI_UNICOSMK)
5087 && (register_operand (operands[0], SImode)
5088 || reg_or_0_operand (operands[1], SImode))"
5096 [(set_attr "type" "ilog,iadd,iadd,multi,ild,ist")])
5098 (define_insn "*movsi_nt_vms"
5099 [(set (match_operand:SI 0 "nonimmediate_operand" "=r,r,r,r,r,r,m")
5100 (match_operand:SI 1 "input_operand" "rJ,K,L,s,n,m,rJ"))]
5101 "(TARGET_ABI_WINDOWS_NT || TARGET_ABI_OPEN_VMS)
5102 && (register_operand (operands[0], SImode)
5103 || reg_or_0_operand (operands[1], SImode))"
5112 [(set_attr "type" "ilog,iadd,iadd,ldsym,multi,ild,ist")])
5114 (define_insn "*movhi_nobwx"
5115 [(set (match_operand:HI 0 "register_operand" "=r,r")
5116 (match_operand:HI 1 "input_operand" "rJ,n"))]
5118 && (register_operand (operands[0], HImode)
5119 || register_operand (operands[1], HImode))"
5123 [(set_attr "type" "ilog,iadd")])
5125 (define_insn "*movhi_bwx"
5126 [(set (match_operand:HI 0 "nonimmediate_operand" "=r,r,r,m")
5127 (match_operand:HI 1 "input_operand" "rJ,n,m,rJ"))]
5129 && (register_operand (operands[0], HImode)
5130 || reg_or_0_operand (operands[1], HImode))"
5136 [(set_attr "type" "ilog,iadd,ild,ist")])
5138 (define_insn "*movqi_nobwx"
5139 [(set (match_operand:QI 0 "register_operand" "=r,r")
5140 (match_operand:QI 1 "input_operand" "rJ,n"))]
5142 && (register_operand (operands[0], QImode)
5143 || register_operand (operands[1], QImode))"
5147 [(set_attr "type" "ilog,iadd")])
5149 (define_insn "*movqi_bwx"
5150 [(set (match_operand:QI 0 "nonimmediate_operand" "=r,r,r,m")
5151 (match_operand:QI 1 "input_operand" "rJ,n,m,rJ"))]
5153 && (register_operand (operands[0], QImode)
5154 || reg_or_0_operand (operands[1], QImode))"
5160 [(set_attr "type" "ilog,iadd,ild,ist")])
5162 ;; We do two major things here: handle mem->mem and construct long
5165 (define_expand "movsi"
5166 [(set (match_operand:SI 0 "nonimmediate_operand" "")
5167 (match_operand:SI 1 "general_operand" ""))]
5170 if (alpha_expand_mov (SImode, operands))
5174 ;; Split a load of a large constant into the appropriate two-insn
5178 [(set (match_operand:SI 0 "register_operand" "")
5179 (match_operand:SI 1 "non_add_const_operand" ""))]
5183 if (alpha_split_const_mov (SImode, operands))
5189 ;; Split the load of an address into a four-insn sequence on Unicos/Mk.
5190 ;; Always generate a REG_EQUAL note for the last instruction to facilitate
5191 ;; optimizations. If the symbolic operand is a label_ref, generate
5192 ;; REG_LABEL_OPERAND notes and update LABEL_NUSES because this is not done
5193 ;; automatically. Labels may be incorrectly deleted if we don't do this.
5195 ;; Describing what the individual instructions do correctly is too complicated
5196 ;; so use UNSPECs for each of the three parts of an address.
5199 [(set (match_operand:DI 0 "register_operand" "")
5200 (match_operand:DI 1 "symbolic_operand" ""))]
5201 "TARGET_ABI_UNICOSMK && reload_completed"
5204 rtx insn1, insn2, insn3;
5206 insn1 = emit_insn (gen_umk_laum (operands[0], operands[1]));
5207 emit_insn (gen_ashldi3 (operands[0], operands[0], GEN_INT (32)));
5208 insn2 = emit_insn (gen_umk_lalm (operands[0], operands[0], operands[1]));
5209 insn3 = emit_insn (gen_umk_lal (operands[0], operands[0], operands[1]));
5210 set_unique_reg_note (insn3, REG_EQUAL, operands[1]);
5212 if (GET_CODE (operands[1]) == LABEL_REF)
5216 label = XEXP (operands[1], 0);
5217 add_reg_note (insn1, REG_LABEL_OPERAND, label);
5218 add_reg_note (insn2, REG_LABEL_OPERAND, label);
5219 add_reg_note (insn3, REG_LABEL_OPERAND, label);
5220 LABEL_NUSES (label) += 3;
5225 ;; Instructions for loading the three parts of an address on Unicos/Mk.
5227 (define_insn "umk_laum"
5228 [(set (match_operand:DI 0 "register_operand" "=r")
5229 (unspec:DI [(match_operand:DI 1 "symbolic_operand" "")]
5231 "TARGET_ABI_UNICOSMK"
5233 [(set_attr "type" "iadd")])
5235 (define_insn "umk_lalm"
5236 [(set (match_operand:DI 0 "register_operand" "=r")
5237 (plus:DI (match_operand:DI 1 "register_operand" "r")
5238 (unspec:DI [(match_operand:DI 2 "symbolic_operand" "")]
5240 "TARGET_ABI_UNICOSMK"
5242 [(set_attr "type" "iadd")])
5244 (define_insn "umk_lal"
5245 [(set (match_operand:DI 0 "register_operand" "=r")
5246 (plus:DI (match_operand:DI 1 "register_operand" "r")
5247 (unspec:DI [(match_operand:DI 2 "symbolic_operand" "")]
5249 "TARGET_ABI_UNICOSMK"
5251 [(set_attr "type" "iadd")])
5253 ;; Add a new call information word to the current function's list of CIWs
5254 ;; and load its index into $25. Doing it here ensures that the CIW will be
5255 ;; associated with the correct function even in the presence of inlining.
5257 (define_insn "*umk_load_ciw"
5259 (unspec:DI [(match_operand 0 "" "")] UNSPEC_UMK_LOAD_CIW))]
5260 "TARGET_ABI_UNICOSMK"
5262 operands[0] = unicosmk_add_call_info_word (operands[0]);
5263 return "lda $25,%0";
5265 [(set_attr "type" "iadd")])
5267 (define_insn "*movdi_er_low_l"
5268 [(set (match_operand:DI 0 "register_operand" "=r")
5269 (lo_sum:DI (match_operand:DI 1 "register_operand" "r")
5270 (match_operand:DI 2 "local_symbolic_operand" "")))]
5271 "TARGET_EXPLICIT_RELOCS"
5273 if (true_regnum (operands[1]) == 29)
5274 return "lda %0,%2(%1)\t\t!gprel";
5276 return "lda %0,%2(%1)\t\t!gprellow";
5278 [(set_attr "usegp" "yes")])
5281 [(set (match_operand:DI 0 "register_operand" "")
5282 (match_operand:DI 1 "small_symbolic_operand" ""))]
5283 "TARGET_EXPLICIT_RELOCS && reload_completed"
5285 (lo_sum:DI (match_dup 2) (match_dup 1)))]
5286 "operands[2] = pic_offset_table_rtx;")
5289 [(set (match_operand:DI 0 "register_operand" "")
5290 (match_operand:DI 1 "local_symbolic_operand" ""))]
5291 "TARGET_EXPLICIT_RELOCS && reload_completed"
5293 (plus:DI (match_dup 2) (high:DI (match_dup 1))))
5295 (lo_sum:DI (match_dup 0) (match_dup 1)))]
5296 "operands[2] = pic_offset_table_rtx;")
5299 [(match_operand 0 "some_small_symbolic_operand" "")]
5302 "operands[0] = split_small_symbolic_operand (operands[0]);")
5304 ;; Accepts any symbolic, not just global, since function calls that
5305 ;; don't go via bsr still use !literal in hopes of linker relaxation.
5306 (define_insn "movdi_er_high_g"
5307 [(set (match_operand:DI 0 "register_operand" "=r")
5308 (unspec:DI [(match_operand:DI 1 "register_operand" "r")
5309 (match_operand:DI 2 "symbolic_operand" "")
5310 (match_operand 3 "const_int_operand" "")]
5312 "TARGET_EXPLICIT_RELOCS"
5314 if (INTVAL (operands[3]) == 0)
5315 return "ldq %0,%2(%1)\t\t!literal";
5317 return "ldq %0,%2(%1)\t\t!literal!%3";
5319 [(set_attr "type" "ldsym")])
5322 [(set (match_operand:DI 0 "register_operand" "")
5323 (match_operand:DI 1 "global_symbolic_operand" ""))]
5324 "TARGET_EXPLICIT_RELOCS && reload_completed"
5326 (unspec:DI [(match_dup 2)
5328 (const_int 0)] UNSPEC_LITERAL))]
5329 "operands[2] = pic_offset_table_rtx;")
5331 (define_insn "movdi_er_tlsgd"
5332 [(set (match_operand:DI 0 "register_operand" "=r")
5333 (unspec:DI [(match_operand:DI 1 "register_operand" "r")
5334 (match_operand:DI 2 "symbolic_operand" "")
5335 (match_operand 3 "const_int_operand" "")]
5339 if (INTVAL (operands[3]) == 0)
5340 return "lda %0,%2(%1)\t\t!tlsgd";
5342 return "lda %0,%2(%1)\t\t!tlsgd!%3";
5345 (define_insn "movdi_er_tlsldm"
5346 [(set (match_operand:DI 0 "register_operand" "=r")
5347 (unspec:DI [(match_operand:DI 1 "register_operand" "r")
5348 (match_operand 2 "const_int_operand" "")]
5352 if (INTVAL (operands[2]) == 0)
5353 return "lda %0,%&(%1)\t\t!tlsldm";
5355 return "lda %0,%&(%1)\t\t!tlsldm!%2";
5358 (define_insn "*movdi_er_gotdtp"
5359 [(set (match_operand:DI 0 "register_operand" "=r")
5360 (unspec:DI [(match_operand:DI 1 "register_operand" "r")
5361 (match_operand:DI 2 "symbolic_operand" "")]
5364 "ldq %0,%2(%1)\t\t!gotdtprel"
5365 [(set_attr "type" "ild")
5366 (set_attr "usegp" "yes")])
5369 [(set (match_operand:DI 0 "register_operand" "")
5370 (match_operand:DI 1 "gotdtp_symbolic_operand" ""))]
5371 "HAVE_AS_TLS && reload_completed"
5373 (unspec:DI [(match_dup 2)
5374 (match_dup 1)] UNSPEC_DTPREL))]
5376 operands[1] = XVECEXP (XEXP (operands[1], 0), 0, 0);
5377 operands[2] = pic_offset_table_rtx;
5380 (define_insn "*movdi_er_gottp"
5381 [(set (match_operand:DI 0 "register_operand" "=r")
5382 (unspec:DI [(match_operand:DI 1 "register_operand" "r")
5383 (match_operand:DI 2 "symbolic_operand" "")]
5386 "ldq %0,%2(%1)\t\t!gottprel"
5387 [(set_attr "type" "ild")
5388 (set_attr "usegp" "yes")])
5391 [(set (match_operand:DI 0 "register_operand" "")
5392 (match_operand:DI 1 "gottp_symbolic_operand" ""))]
5393 "HAVE_AS_TLS && reload_completed"
5395 (unspec:DI [(match_dup 2)
5396 (match_dup 1)] UNSPEC_TPREL))]
5398 operands[1] = XVECEXP (XEXP (operands[1], 0), 0, 0);
5399 operands[2] = pic_offset_table_rtx;
5402 (define_insn "*movdi_er_nofix"
5403 [(set (match_operand:DI 0 "nonimmediate_operand" "=r,r,r,r,r,r,r,m,*f,*f,Q")
5404 (match_operand:DI 1 "input_operand" "rJ,K,L,T,s,n,m,rJ,*fJ,Q,*f"))]
5405 "TARGET_EXPLICIT_RELOCS && ! TARGET_FIX
5406 && (register_operand (operands[0], DImode)
5407 || reg_or_0_operand (operands[1], DImode))"
5420 [(set_attr "type" "ilog,iadd,iadd,iadd,ldsym,multi,ild,ist,fcpys,fld,fst")
5421 (set_attr "usegp" "*,*,*,yes,*,*,*,*,*,*,*")])
5423 ;; The 'U' constraint matches symbolic operands on Unicos/Mk. Those should
5424 ;; have been split up by the rules above but we shouldn't reject the
5425 ;; possibility of them getting through.
5427 (define_insn "*movdi_nofix"
5428 [(set (match_operand:DI 0 "nonimmediate_operand" "=r,r,r,r,r,r,r,m,*f,*f,Q")
5429 (match_operand:DI 1 "input_operand" "rJ,K,L,U,s,n,m,rJ,*fJ,Q,*f"))]
5431 && (register_operand (operands[0], DImode)
5432 || reg_or_0_operand (operands[1], DImode))"
5437 laum %0,%t1($31)\;sll %0,32,%0\;lalm %0,%t1(%0)\;lal %0,%t1(%0)
5445 [(set_attr "type" "ilog,iadd,iadd,ldsym,ldsym,multi,ild,ist,fcpys,fld,fst")
5446 (set_attr "length" "*,*,*,16,*,*,*,*,*,*,*")])
5448 (define_insn "*movdi_er_fix"
5449 [(set (match_operand:DI 0 "nonimmediate_operand"
5450 "=r,r,r,r,r,r,r, m, *f,*f, Q, r,*f")
5451 (match_operand:DI 1 "input_operand"
5452 "rJ,K,L,T,s,n,m,rJ,*fJ, Q,*f,*f, r"))]
5453 "TARGET_EXPLICIT_RELOCS && TARGET_FIX
5454 && (register_operand (operands[0], DImode)
5455 || reg_or_0_operand (operands[1], DImode))"
5470 [(set_attr "type" "ilog,iadd,iadd,iadd,ldsym,multi,ild,ist,fcpys,fld,fst,ftoi,itof")
5471 (set_attr "usegp" "*,*,*,yes,*,*,*,*,*,*,*,*,*")])
5473 (define_insn "*movdi_fix"
5474 [(set (match_operand:DI 0 "nonimmediate_operand" "=r,r,r,r,r,r,m,*f,*f,Q,r,*f")
5475 (match_operand:DI 1 "input_operand" "rJ,K,L,s,n,m,rJ,*fJ,Q,*f,*f,r"))]
5476 "! TARGET_EXPLICIT_RELOCS && TARGET_FIX
5477 && (register_operand (operands[0], DImode)
5478 || reg_or_0_operand (operands[1], DImode))"
5492 [(set_attr "type" "ilog,iadd,iadd,ldsym,multi,ild,ist,fcpys,fld,fst,ftoi,itof")])
5494 ;; VMS needs to set up "vms_base_regno" for unwinding. This move
5495 ;; often appears dead to the life analysis code, at which point we
5496 ;; die for emitting dead prologue instructions. Force this live.
5498 (define_insn "force_movdi"
5499 [(set (match_operand:DI 0 "register_operand" "=r")
5500 (unspec_volatile:DI [(match_operand:DI 1 "register_operand" "r")]
5501 UNSPECV_FORCE_MOV))]
5504 [(set_attr "type" "ilog")])
5506 ;; We do three major things here: handle mem->mem, put 64-bit constants in
5507 ;; memory, and construct long 32-bit constants.
5509 (define_expand "movdi"
5510 [(set (match_operand:DI 0 "nonimmediate_operand" "")
5511 (match_operand:DI 1 "general_operand" ""))]
5514 if (alpha_expand_mov (DImode, operands))
5518 ;; Split a load of a large constant into the appropriate two-insn
5522 [(set (match_operand:DI 0 "register_operand" "")
5523 (match_operand:DI 1 "non_add_const_operand" ""))]
5527 if (alpha_split_const_mov (DImode, operands))
5533 ;; We need to prevent reload from splitting TImode moves, because it
5534 ;; might decide to overwrite a pointer with the value it points to.
5535 ;; In that case we have to do the loads in the appropriate order so
5536 ;; that the pointer is not destroyed too early.
5538 (define_insn_and_split "*movti_internal"
5539 [(set (match_operand:TI 0 "nonimmediate_operand" "=r,o")
5540 (match_operand:TI 1 "input_operand" "roJ,rJ"))]
5541 "(register_operand (operands[0], TImode)
5542 /* Prevent rematerialization of constants. */
5543 && ! CONSTANT_P (operands[1]))
5544 || reg_or_0_operand (operands[1], TImode)"
5547 [(set (match_dup 0) (match_dup 2))
5548 (set (match_dup 1) (match_dup 3))]
5550 alpha_split_tmode_pair (operands, TImode, true);
5553 (define_expand "movti"
5554 [(set (match_operand:TI 0 "nonimmediate_operand" "")
5555 (match_operand:TI 1 "general_operand" ""))]
5558 if (MEM_P (operands[0])
5559 && ! reg_or_0_operand (operands[1], TImode))
5560 operands[1] = force_reg (TImode, operands[1]);
5562 if (operands[1] == const0_rtx)
5564 /* We must put 64-bit constants in memory. We could keep the
5565 32-bit constants in TImode and rely on the splitter, but
5566 this doesn't seem to be worth the pain. */
5567 else if (CONST_INT_P (operands[1])
5568 || GET_CODE (operands[1]) == CONST_DOUBLE)
5570 rtx in[2], out[2], target;
5572 gcc_assert (can_create_pseudo_p ());
5574 split_double (operands[1], &in[0], &in[1]);
5576 if (in[0] == const0_rtx)
5577 out[0] = const0_rtx;
5580 out[0] = gen_reg_rtx (DImode);
5581 emit_insn (gen_movdi (out[0], in[0]));
5584 if (in[1] == const0_rtx)
5585 out[1] = const0_rtx;
5588 out[1] = gen_reg_rtx (DImode);
5589 emit_insn (gen_movdi (out[1], in[1]));
5592 if (!REG_P (operands[0]))
5593 target = gen_reg_rtx (TImode);
5595 target = operands[0];
5597 emit_insn (gen_movdi (operand_subword (target, 0, 0, TImode), out[0]));
5598 emit_insn (gen_movdi (operand_subword (target, 1, 0, TImode), out[1]));
5600 if (target != operands[0])
5601 emit_insn (gen_rtx_SET (VOIDmode, operands[0], target));
5607 ;; These are the partial-word cases.
5609 ;; First we have the code to load an aligned word. Operand 0 is the register
5610 ;; in which to place the result. It's mode is QImode or HImode. Operand 1
5611 ;; is an SImode MEM at the low-order byte of the proper word. Operand 2 is the
5612 ;; number of bits within the word that the value is. Operand 3 is an SImode
5613 ;; scratch register. If operand 0 is a hard register, operand 3 may be the
5614 ;; same register. It is allowed to conflict with operand 1 as well.
5616 (define_expand "aligned_loadqi"
5617 [(set (match_operand:SI 3 "register_operand" "")
5618 (match_operand:SI 1 "memory_operand" ""))
5619 (set (match_operand:DI 0 "register_operand" "")
5620 (zero_extract:DI (subreg:DI (match_dup 3) 0)
5622 (match_operand:DI 2 "const_int_operand" "")))]
5627 (define_expand "aligned_loadhi"
5628 [(set (match_operand:SI 3 "register_operand" "")
5629 (match_operand:SI 1 "memory_operand" ""))
5630 (set (match_operand:DI 0 "register_operand" "")
5631 (zero_extract:DI (subreg:DI (match_dup 3) 0)
5633 (match_operand:DI 2 "const_int_operand" "")))]
5638 ;; Similar for unaligned loads, where we use the sequence from the
5639 ;; Alpha Architecture manual. We have to distinguish between little-endian
5640 ;; and big-endian systems as the sequences are different.
5642 ;; Operand 1 is the address. Operands 2 and 3 are temporaries, where
5643 ;; operand 3 can overlap the input and output registers.
5645 (define_expand "unaligned_loadqi"
5646 [(use (match_operand:DI 0 "register_operand" ""))
5647 (use (match_operand:DI 1 "address_operand" ""))
5648 (use (match_operand:DI 2 "register_operand" ""))
5649 (use (match_operand:DI 3 "register_operand" ""))]
5652 if (WORDS_BIG_ENDIAN)
5653 emit_insn (gen_unaligned_loadqi_be (operands[0], operands[1],
5654 operands[2], operands[3]));
5656 emit_insn (gen_unaligned_loadqi_le (operands[0], operands[1],
5657 operands[2], operands[3]));
5661 (define_expand "unaligned_loadqi_le"
5662 [(set (match_operand:DI 2 "register_operand" "")
5663 (mem:DI (and:DI (match_operand:DI 1 "address_operand" "")
5665 (set (match_operand:DI 3 "register_operand" "")
5667 (set (match_operand:DI 0 "register_operand" "")
5668 (zero_extract:DI (match_dup 2)
5670 (ashift:DI (match_dup 3) (const_int 3))))]
5671 "! WORDS_BIG_ENDIAN"
5674 (define_expand "unaligned_loadqi_be"
5675 [(set (match_operand:DI 2 "register_operand" "")
5676 (mem:DI (and:DI (match_operand:DI 1 "address_operand" "")
5678 (set (match_operand:DI 3 "register_operand" "")
5680 (set (match_operand:DI 0 "register_operand" "")
5681 (zero_extract:DI (match_dup 2)
5685 (ashift:DI (match_dup 3) (const_int 3)))))]
5689 (define_expand "unaligned_loadhi"
5690 [(use (match_operand:DI 0 "register_operand" ""))
5691 (use (match_operand:DI 1 "address_operand" ""))
5692 (use (match_operand:DI 2 "register_operand" ""))
5693 (use (match_operand:DI 3 "register_operand" ""))]
5696 if (WORDS_BIG_ENDIAN)
5697 emit_insn (gen_unaligned_loadhi_be (operands[0], operands[1],
5698 operands[2], operands[3]));
5700 emit_insn (gen_unaligned_loadhi_le (operands[0], operands[1],
5701 operands[2], operands[3]));
5705 (define_expand "unaligned_loadhi_le"
5706 [(set (match_operand:DI 2 "register_operand" "")
5707 (mem:DI (and:DI (match_operand:DI 1 "address_operand" "")
5709 (set (match_operand:DI 3 "register_operand" "")
5711 (set (match_operand:DI 0 "register_operand" "")
5712 (zero_extract:DI (match_dup 2)
5714 (ashift:DI (match_dup 3) (const_int 3))))]
5715 "! WORDS_BIG_ENDIAN"
5718 (define_expand "unaligned_loadhi_be"
5719 [(set (match_operand:DI 2 "register_operand" "")
5720 (mem:DI (and:DI (match_operand:DI 1 "address_operand" "")
5722 (set (match_operand:DI 3 "register_operand" "")
5723 (plus:DI (match_dup 1) (const_int 1)))
5724 (set (match_operand:DI 0 "register_operand" "")
5725 (zero_extract:DI (match_dup 2)
5729 (ashift:DI (match_dup 3) (const_int 3)))))]
5733 ;; Storing an aligned byte or word requires two temporaries. Operand 0 is the
5734 ;; aligned SImode MEM. Operand 1 is the register containing the
5735 ;; byte or word to store. Operand 2 is the number of bits within the word that
5736 ;; the value should be placed. Operands 3 and 4 are SImode temporaries.
5738 (define_expand "aligned_store"
5739 [(set (match_operand:SI 3 "register_operand" "")
5740 (match_operand:SI 0 "memory_operand" ""))
5741 (set (subreg:DI (match_dup 3) 0)
5742 (and:DI (subreg:DI (match_dup 3) 0) (match_dup 5)))
5743 (set (subreg:DI (match_operand:SI 4 "register_operand" "") 0)
5744 (ashift:DI (zero_extend:DI (match_operand 1 "register_operand" ""))
5745 (match_operand:DI 2 "const_int_operand" "")))
5746 (set (subreg:DI (match_dup 4) 0)
5747 (ior:DI (subreg:DI (match_dup 4) 0) (subreg:DI (match_dup 3) 0)))
5748 (set (match_dup 0) (match_dup 4))]
5751 operands[5] = GEN_INT (~ (GET_MODE_MASK (GET_MODE (operands[1]))
5752 << INTVAL (operands[2])));
5755 ;; For the unaligned byte and halfword cases, we use code similar to that
5756 ;; in the ;; Architecture book, but reordered to lower the number of registers
5757 ;; required. Operand 0 is the address. Operand 1 is the data to store.
5758 ;; Operands 2, 3, and 4 are DImode temporaries, where operands 2 and 4 may
5759 ;; be the same temporary, if desired. If the address is in a register,
5760 ;; operand 2 can be that register.
5762 (define_expand "unaligned_storeqi"
5763 [(use (match_operand:DI 0 "address_operand" ""))
5764 (use (match_operand:QI 1 "register_operand" ""))
5765 (use (match_operand:DI 2 "register_operand" ""))
5766 (use (match_operand:DI 3 "register_operand" ""))
5767 (use (match_operand:DI 4 "register_operand" ""))]
5770 if (WORDS_BIG_ENDIAN)
5771 emit_insn (gen_unaligned_storeqi_be (operands[0], operands[1],
5772 operands[2], operands[3],
5775 emit_insn (gen_unaligned_storeqi_le (operands[0], operands[1],
5776 operands[2], operands[3],
5781 (define_expand "unaligned_storeqi_le"
5782 [(set (match_operand:DI 3 "register_operand" "")
5783 (mem:DI (and:DI (match_operand:DI 0 "address_operand" "")
5785 (set (match_operand:DI 2 "register_operand" "")
5788 (and:DI (not:DI (ashift:DI (const_int 255)
5789 (ashift:DI (match_dup 2) (const_int 3))))
5791 (set (match_operand:DI 4 "register_operand" "")
5792 (ashift:DI (zero_extend:DI (match_operand:QI 1 "register_operand" ""))
5793 (ashift:DI (match_dup 2) (const_int 3))))
5794 (set (match_dup 4) (ior:DI (match_dup 4) (match_dup 3)))
5795 (set (mem:DI (and:DI (match_dup 0) (const_int -8)))
5797 "! WORDS_BIG_ENDIAN"
5800 (define_expand "unaligned_storeqi_be"
5801 [(set (match_operand:DI 3 "register_operand" "")
5802 (mem:DI (and:DI (match_operand:DI 0 "address_operand" "")
5804 (set (match_operand:DI 2 "register_operand" "")
5807 (and:DI (not:DI (ashift:DI (const_int 255)
5808 (minus:DI (const_int 56)
5809 (ashift:DI (match_dup 2) (const_int 3)))))
5811 (set (match_operand:DI 4 "register_operand" "")
5812 (ashift:DI (zero_extend:DI (match_operand:QI 1 "register_operand" ""))
5813 (minus:DI (const_int 56)
5814 (ashift:DI (match_dup 2) (const_int 3)))))
5815 (set (match_dup 4) (ior:DI (match_dup 4) (match_dup 3)))
5816 (set (mem:DI (and:DI (match_dup 0) (const_int -8)))
5821 (define_expand "unaligned_storehi"
5822 [(use (match_operand:DI 0 "address_operand" ""))
5823 (use (match_operand:HI 1 "register_operand" ""))
5824 (use (match_operand:DI 2 "register_operand" ""))
5825 (use (match_operand:DI 3 "register_operand" ""))
5826 (use (match_operand:DI 4 "register_operand" ""))]
5829 if (WORDS_BIG_ENDIAN)
5830 emit_insn (gen_unaligned_storehi_be (operands[0], operands[1],
5831 operands[2], operands[3],
5834 emit_insn (gen_unaligned_storehi_le (operands[0], operands[1],
5835 operands[2], operands[3],
5840 (define_expand "unaligned_storehi_le"
5841 [(set (match_operand:DI 3 "register_operand" "")
5842 (mem:DI (and:DI (match_operand:DI 0 "address_operand" "")
5844 (set (match_operand:DI 2 "register_operand" "")
5847 (and:DI (not:DI (ashift:DI (const_int 65535)
5848 (ashift:DI (match_dup 2) (const_int 3))))
5850 (set (match_operand:DI 4 "register_operand" "")
5851 (ashift:DI (zero_extend:DI (match_operand:HI 1 "register_operand" ""))
5852 (ashift:DI (match_dup 2) (const_int 3))))
5853 (set (match_dup 4) (ior:DI (match_dup 4) (match_dup 3)))
5854 (set (mem:DI (and:DI (match_dup 0) (const_int -8)))
5856 "! WORDS_BIG_ENDIAN"
5859 (define_expand "unaligned_storehi_be"
5860 [(set (match_operand:DI 3 "register_operand" "")
5861 (mem:DI (and:DI (match_operand:DI 0 "address_operand" "")
5863 (set (match_operand:DI 2 "register_operand" "")
5864 (plus:DI (match_dup 0) (const_int 1)))
5866 (and:DI (not:DI (ashift:DI
5868 (minus:DI (const_int 56)
5869 (ashift:DI (match_dup 2) (const_int 3)))))
5871 (set (match_operand:DI 4 "register_operand" "")
5872 (ashift:DI (zero_extend:DI (match_operand:HI 1 "register_operand" ""))
5873 (minus:DI (const_int 56)
5874 (ashift:DI (match_dup 2) (const_int 3)))))
5875 (set (match_dup 4) (ior:DI (match_dup 4) (match_dup 3)))
5876 (set (mem:DI (and:DI (match_dup 0) (const_int -8)))
5881 ;; Here are the define_expand's for QI and HI moves that use the above
5882 ;; patterns. We have the normal sets, plus the ones that need scratch
5883 ;; registers for reload.
5885 (define_expand "movqi"
5886 [(set (match_operand:QI 0 "nonimmediate_operand" "")
5887 (match_operand:QI 1 "general_operand" ""))]
5891 ? alpha_expand_mov (QImode, operands)
5892 : alpha_expand_mov_nobwx (QImode, operands))
5896 (define_expand "movhi"
5897 [(set (match_operand:HI 0 "nonimmediate_operand" "")
5898 (match_operand:HI 1 "general_operand" ""))]
5902 ? alpha_expand_mov (HImode, operands)
5903 : alpha_expand_mov_nobwx (HImode, operands))
5907 ;; We need to hook into the extra support that we have for HImode
5908 ;; reloads when BWX insns are not available.
5909 (define_expand "movcqi"
5910 [(set (match_operand:CQI 0 "nonimmediate_operand" "")
5911 (match_operand:CQI 1 "general_operand" ""))]
5914 if (GET_CODE (operands[0]) == CONCAT || GET_CODE (operands[1]) == CONCAT)
5916 else if (!any_memory_operand (operands[0], CQImode))
5918 if (!any_memory_operand (operands[1], CQImode))
5920 emit_move_insn (gen_lowpart (HImode, operands[0]),
5921 gen_lowpart (HImode, operands[1]));
5924 if (aligned_memory_operand (operands[1], CQImode))
5928 operands[1] = gen_lowpart (HImode, operands[1]);
5930 operands[0] = gen_lowpart (HImode, operands[0]);
5931 done = alpha_expand_mov_nobwx (HImode, operands);
5936 else if (aligned_memory_operand (operands[0], CQImode))
5938 if (MEM_P (operands[1]))
5940 rtx x = gen_reg_rtx (HImode);
5941 emit_move_insn (gen_lowpart (CQImode, x), operands[1]);
5948 gcc_assert (!reload_in_progress);
5949 emit_move_complex_parts (operands[0], operands[1]);
5953 ;; Here are the versions for reload.
5955 ;; The aligned input case is recognized early in alpha_secondary_reload
5956 ;; in order to avoid allocating an unnecessary scratch register.
5958 ;; Note that in the unaligned cases we know that the operand must not be
5959 ;; a pseudo-register because stack slots are always aligned references.
5961 (define_expand "reload_in<mode>"
5962 [(parallel [(match_operand:RELOAD12 0 "register_operand" "=r")
5963 (match_operand:RELOAD12 1 "any_memory_operand" "m")
5964 (match_operand:TI 2 "register_operand" "=&r")])]
5967 rtx scratch, seq, addr;
5968 unsigned regno = REGNO (operands[2]);
5970 /* It is possible that one of the registers we got for operands[2]
5971 might coincide with that of operands[0] (which is why we made
5972 it TImode). Pick the other one to use as our scratch. */
5973 if (regno == REGNO (operands[0]))
5975 scratch = gen_rtx_REG (DImode, regno);
5977 addr = get_unaligned_address (operands[1]);
5978 operands[0] = gen_rtx_REG (DImode, REGNO (operands[0]));
5979 seq = gen_unaligned_load<reloadmode> (operands[0], addr,
5980 scratch, operands[0]);
5981 alpha_set_memflags (seq, operands[1]);
5987 (define_expand "reload_out<mode>"
5988 [(parallel [(match_operand:RELOAD12 0 "any_memory_operand" "=m")
5989 (match_operand:RELOAD12 1 "register_operand" "r")
5990 (match_operand:TI 2 "register_operand" "=&r")])]
5993 unsigned regno = REGNO (operands[2]);
5995 if (<MODE>mode == CQImode)
5997 operands[0] = gen_lowpart (HImode, operands[0]);
5998 operands[1] = gen_lowpart (HImode, operands[1]);
6001 if (aligned_memory_operand (operands[0], <MODE>mode))
6003 emit_insn (gen_reload_out<reloadmode>_aligned
6004 (operands[0], operands[1],
6005 gen_rtx_REG (SImode, regno),
6006 gen_rtx_REG (SImode, regno + 1)));
6010 rtx addr = get_unaligned_address (operands[0]);
6011 rtx scratch1 = gen_rtx_REG (DImode, regno);
6012 rtx scratch2 = gen_rtx_REG (DImode, regno + 1);
6013 rtx scratch3 = scratch1;
6019 seq = gen_unaligned_store<reloadmode> (addr, operands[1], scratch1,
6020 scratch2, scratch3);
6021 alpha_set_memflags (seq, operands[0]);
6027 ;; Helpers for the above. The way reload is structured, we can't
6028 ;; always get a proper address for a stack slot during reload_foo
6029 ;; expansion, so we must delay our address manipulations until after.
6031 (define_insn_and_split "reload_in<mode>_aligned"
6032 [(set (match_operand:I12MODE 0 "register_operand" "=r")
6033 (match_operand:I12MODE 1 "memory_operand" "m"))]
6034 "!TARGET_BWX && (reload_in_progress || reload_completed)"
6036 "!TARGET_BWX && reload_completed"
6039 rtx aligned_mem, bitnum;
6040 get_aligned_mem (operands[1], &aligned_mem, &bitnum);
6041 emit_insn (gen_aligned_load<reloadmode>
6042 (gen_lowpart (DImode, operands[0]), aligned_mem, bitnum,
6043 gen_rtx_REG (SImode, REGNO (operands[0]))));
6047 (define_insn_and_split "reload_out<mode>_aligned"
6048 [(set (match_operand:I12MODE 0 "memory_operand" "=m")
6049 (match_operand:I12MODE 1 "register_operand" "r"))
6050 (clobber (match_operand:SI 2 "register_operand" "=r"))
6051 (clobber (match_operand:SI 3 "register_operand" "=r"))]
6052 "!TARGET_BWX && (reload_in_progress || reload_completed)"
6054 "!TARGET_BWX && reload_completed"
6057 rtx aligned_mem, bitnum;
6058 get_aligned_mem (operands[0], &aligned_mem, &bitnum);
6059 emit_insn (gen_aligned_store (aligned_mem, operands[1], bitnum,
6060 operands[2], operands[3]));
6064 ;; Vector operations
6066 (define_mode_iterator VEC [V8QI V4HI V2SI])
6068 (define_expand "mov<mode>"
6069 [(set (match_operand:VEC 0 "nonimmediate_operand" "")
6070 (match_operand:VEC 1 "general_operand" ""))]
6073 if (alpha_expand_mov (<MODE>mode, operands))
6078 [(set (match_operand:VEC 0 "register_operand" "")
6079 (match_operand:VEC 1 "non_zero_const_operand" ""))]
6083 if (alpha_split_const_mov (<MODE>mode, operands))
6090 (define_expand "movmisalign<mode>"
6091 [(set (match_operand:VEC 0 "nonimmediate_operand" "")
6092 (match_operand:VEC 1 "general_operand" ""))]
6095 alpha_expand_movmisalign (<MODE>mode, operands);
6099 (define_insn "*mov<mode>_fix"
6100 [(set (match_operand:VEC 0 "nonimmediate_operand" "=r,r,r,m,*f,*f,m,r,*f")
6101 (match_operand:VEC 1 "input_operand" "rW,i,m,rW,*fW,m,*f,*f,r"))]
6103 && (register_operand (operands[0], <MODE>mode)
6104 || reg_or_0_operand (operands[1], <MODE>mode))"
6115 [(set_attr "type" "ilog,multi,ild,ist,fcpys,fld,fst,ftoi,itof")])
6117 (define_insn "*mov<mode>_nofix"
6118 [(set (match_operand:VEC 0 "nonimmediate_operand" "=r,r,r,m,*f,*f,m")
6119 (match_operand:VEC 1 "input_operand" "rW,i,m,rW,*fW,m,*f"))]
6121 && (register_operand (operands[0], <MODE>mode)
6122 || reg_or_0_operand (operands[1], <MODE>mode))"
6131 [(set_attr "type" "ilog,multi,ild,ist,fcpys,fld,fst")])
6133 (define_insn "uminv8qi3"
6134 [(set (match_operand:V8QI 0 "register_operand" "=r")
6135 (umin:V8QI (match_operand:V8QI 1 "reg_or_0_operand" "rW")
6136 (match_operand:V8QI 2 "reg_or_0_operand" "rW")))]
6139 [(set_attr "type" "mvi")])
6141 (define_insn "sminv8qi3"
6142 [(set (match_operand:V8QI 0 "register_operand" "=r")
6143 (smin:V8QI (match_operand:V8QI 1 "reg_or_0_operand" "rW")
6144 (match_operand:V8QI 2 "reg_or_0_operand" "rW")))]
6147 [(set_attr "type" "mvi")])
6149 (define_insn "uminv4hi3"
6150 [(set (match_operand:V4HI 0 "register_operand" "=r")
6151 (umin:V4HI (match_operand:V4HI 1 "reg_or_0_operand" "rW")
6152 (match_operand:V4HI 2 "reg_or_0_operand" "rW")))]
6155 [(set_attr "type" "mvi")])
6157 (define_insn "sminv4hi3"
6158 [(set (match_operand:V4HI 0 "register_operand" "=r")
6159 (smin:V4HI (match_operand:V4HI 1 "reg_or_0_operand" "rW")
6160 (match_operand:V4HI 2 "reg_or_0_operand" "rW")))]
6163 [(set_attr "type" "mvi")])
6165 (define_insn "umaxv8qi3"
6166 [(set (match_operand:V8QI 0 "register_operand" "=r")
6167 (umax:V8QI (match_operand:V8QI 1 "reg_or_0_operand" "rW")
6168 (match_operand:V8QI 2 "reg_or_0_operand" "rW")))]
6171 [(set_attr "type" "mvi")])
6173 (define_insn "smaxv8qi3"
6174 [(set (match_operand:V8QI 0 "register_operand" "=r")
6175 (smax:V8QI (match_operand:V8QI 1 "reg_or_0_operand" "rW")
6176 (match_operand:V8QI 2 "reg_or_0_operand" "rW")))]
6179 [(set_attr "type" "mvi")])
6181 (define_insn "umaxv4hi3"
6182 [(set (match_operand:V4HI 0 "register_operand" "=r")
6183 (umax:V4HI (match_operand:V4HI 1 "reg_or_0_operand" "rW")
6184 (match_operand:V4HI 2 "reg_or_0_operand" "rW")))]
6187 [(set_attr "type" "mvi")])
6189 (define_insn "smaxv4hi3"
6190 [(set (match_operand:V4HI 0 "register_operand" "=r")
6191 (smax:V4HI (match_operand:V4HI 1 "reg_or_0_operand" "rW")
6192 (match_operand:V4HI 2 "reg_or_0_operand" "rW")))]
6195 [(set_attr "type" "mvi")])
6197 (define_insn "one_cmpl<mode>2"
6198 [(set (match_operand:VEC 0 "register_operand" "=r")
6199 (not:VEC (match_operand:VEC 1 "register_operand" "r")))]
6202 [(set_attr "type" "ilog")])
6204 (define_insn "and<mode>3"
6205 [(set (match_operand:VEC 0 "register_operand" "=r")
6206 (and:VEC (match_operand:VEC 1 "register_operand" "r")
6207 (match_operand:VEC 2 "register_operand" "r")))]
6210 [(set_attr "type" "ilog")])
6212 (define_insn "*andnot<mode>3"
6213 [(set (match_operand:VEC 0 "register_operand" "=r")
6214 (and:VEC (not:VEC (match_operand:VEC 1 "register_operand" "r"))
6215 (match_operand:VEC 2 "register_operand" "r")))]
6218 [(set_attr "type" "ilog")])
6220 (define_insn "ior<mode>3"
6221 [(set (match_operand:VEC 0 "register_operand" "=r")
6222 (ior:VEC (match_operand:VEC 1 "register_operand" "r")
6223 (match_operand:VEC 2 "register_operand" "r")))]
6226 [(set_attr "type" "ilog")])
6228 (define_insn "*iornot<mode>3"
6229 [(set (match_operand:VEC 0 "register_operand" "=r")
6230 (ior:VEC (not:DI (match_operand:VEC 1 "register_operand" "r"))
6231 (match_operand:VEC 2 "register_operand" "r")))]
6234 [(set_attr "type" "ilog")])
6236 (define_insn "xor<mode>3"
6237 [(set (match_operand:VEC 0 "register_operand" "=r")
6238 (xor:VEC (match_operand:VEC 1 "register_operand" "r")
6239 (match_operand:VEC 2 "register_operand" "r")))]
6242 [(set_attr "type" "ilog")])
6244 (define_insn "*xornot<mode>3"
6245 [(set (match_operand:VEC 0 "register_operand" "=r")
6246 (not:VEC (xor:VEC (match_operand:VEC 1 "register_operand" "r")
6247 (match_operand:VEC 2 "register_operand" "r"))))]
6250 [(set_attr "type" "ilog")])
6252 (define_expand "vec_shl_<mode>"
6253 [(set (match_operand:VEC 0 "register_operand" "")
6254 (ashift:DI (match_operand:VEC 1 "register_operand" "")
6255 (match_operand:DI 2 "reg_or_6bit_operand" "")))]
6258 operands[0] = gen_lowpart (DImode, operands[0]);
6259 operands[1] = gen_lowpart (DImode, operands[1]);
6262 (define_expand "vec_shr_<mode>"
6263 [(set (match_operand:VEC 0 "register_operand" "")
6264 (lshiftrt:DI (match_operand:VEC 1 "register_operand" "")
6265 (match_operand:DI 2 "reg_or_6bit_operand" "")))]
6268 operands[0] = gen_lowpart (DImode, operands[0]);
6269 operands[1] = gen_lowpart (DImode, operands[1]);
6272 ;; Bit field extract patterns which use ext[wlq][lh]
6274 (define_expand "extv"
6275 [(set (match_operand:DI 0 "register_operand" "")
6276 (sign_extract:DI (match_operand:QI 1 "memory_operand" "")
6277 (match_operand:DI 2 "immediate_operand" "")
6278 (match_operand:DI 3 "immediate_operand" "")))]
6283 /* We can do 16, 32 and 64 bit fields, if aligned on byte boundaries. */
6284 if (INTVAL (operands[3]) % 8 != 0
6285 || (INTVAL (operands[2]) != 16
6286 && INTVAL (operands[2]) != 32
6287 && INTVAL (operands[2]) != 64))
6290 /* From mips.md: extract_bit_field doesn't verify that our source
6291 matches the predicate, so we force it to be a MEM here. */
6292 if (!MEM_P (operands[1]))
6295 /* The bit number is relative to the mode of operand 1 which is
6296 usually QImode (this might actually be a bug in expmed.c). Note
6297 that the bit number is negative in big-endian mode in this case.
6298 We have to convert that to the offset. */
6299 if (WORDS_BIG_ENDIAN)
6300 ofs = GET_MODE_BITSIZE (GET_MODE (operands[1]))
6301 - INTVAL (operands[2]) - INTVAL (operands[3]);
6303 ofs = INTVAL (operands[3]);
6307 alpha_expand_unaligned_load (operands[0], operands[1],
6308 INTVAL (operands[2]) / 8,
6313 (define_expand "extzv"
6314 [(set (match_operand:DI 0 "register_operand" "")
6315 (zero_extract:DI (match_operand:DI 1 "nonimmediate_operand" "")
6316 (match_operand:DI 2 "immediate_operand" "")
6317 (match_operand:DI 3 "immediate_operand" "")))]
6320 /* We can do 8, 16, 32 and 64 bit fields, if aligned on byte boundaries. */
6321 if (INTVAL (operands[3]) % 8 != 0
6322 || (INTVAL (operands[2]) != 8
6323 && INTVAL (operands[2]) != 16
6324 && INTVAL (operands[2]) != 32
6325 && INTVAL (operands[2]) != 64))
6328 if (MEM_P (operands[1]))
6332 /* Fail 8-bit fields, falling back on a simple byte load. */
6333 if (INTVAL (operands[2]) == 8)
6336 /* The bit number is relative to the mode of operand 1 which is
6337 usually QImode (this might actually be a bug in expmed.c). Note
6338 that the bit number is negative in big-endian mode in this case.
6339 We have to convert that to the offset. */
6340 if (WORDS_BIG_ENDIAN)
6341 ofs = GET_MODE_BITSIZE (GET_MODE (operands[1]))
6342 - INTVAL (operands[2]) - INTVAL (operands[3]);
6344 ofs = INTVAL (operands[3]);
6348 alpha_expand_unaligned_load (operands[0], operands[1],
6349 INTVAL (operands[2]) / 8,
6355 (define_expand "insv"
6356 [(set (zero_extract:DI (match_operand:QI 0 "memory_operand" "")
6357 (match_operand:DI 1 "immediate_operand" "")
6358 (match_operand:DI 2 "immediate_operand" ""))
6359 (match_operand:DI 3 "register_operand" ""))]
6364 /* We can do 16, 32 and 64 bit fields, if aligned on byte boundaries. */
6365 if (INTVAL (operands[2]) % 8 != 0
6366 || (INTVAL (operands[1]) != 16
6367 && INTVAL (operands[1]) != 32
6368 && INTVAL (operands[1]) != 64))
6371 /* From mips.md: store_bit_field doesn't verify that our source
6372 matches the predicate, so we force it to be a MEM here. */
6373 if (!MEM_P (operands[0]))
6376 /* The bit number is relative to the mode of operand 1 which is
6377 usually QImode (this might actually be a bug in expmed.c). Note
6378 that the bit number is negative in big-endian mode in this case.
6379 We have to convert that to the offset. */
6380 if (WORDS_BIG_ENDIAN)
6381 ofs = GET_MODE_BITSIZE (GET_MODE (operands[0]))
6382 - INTVAL (operands[1]) - INTVAL (operands[2]);
6384 ofs = INTVAL (operands[2]);
6388 alpha_expand_unaligned_store (operands[0], operands[3],
6389 INTVAL (operands[1]) / 8, ofs);
6393 ;; Block move/clear, see alpha.c for more details.
6394 ;; Argument 0 is the destination
6395 ;; Argument 1 is the source
6396 ;; Argument 2 is the length
6397 ;; Argument 3 is the alignment
6399 (define_expand "movmemqi"
6400 [(parallel [(set (match_operand:BLK 0 "memory_operand" "")
6401 (match_operand:BLK 1 "memory_operand" ""))
6402 (use (match_operand:DI 2 "immediate_operand" ""))
6403 (use (match_operand:DI 3 "immediate_operand" ""))])]
6406 if (alpha_expand_block_move (operands))
6412 (define_expand "movmemdi"
6413 [(parallel [(set (match_operand:BLK 0 "memory_operand" "")
6414 (match_operand:BLK 1 "memory_operand" ""))
6415 (use (match_operand:DI 2 "immediate_operand" ""))
6416 (use (match_operand:DI 3 "immediate_operand" ""))
6418 (clobber (reg:DI 25))
6419 (clobber (reg:DI 16))
6420 (clobber (reg:DI 17))
6421 (clobber (reg:DI 18))
6422 (clobber (reg:DI 19))
6423 (clobber (reg:DI 20))
6424 (clobber (reg:DI 26))
6425 (clobber (reg:DI 27))])]
6426 "TARGET_ABI_OPEN_VMS"
6428 operands[4] = alpha_need_linkage ("OTS$MOVE", 0);
6431 (define_insn "*movmemdi_1"
6432 [(set (match_operand:BLK 0 "memory_operand" "=m,=m")
6433 (match_operand:BLK 1 "memory_operand" "m,m"))
6434 (use (match_operand:DI 2 "nonmemory_operand" "r,i"))
6435 (use (match_operand:DI 3 "immediate_operand" ""))
6436 (use (match_operand:DI 4 "call_operand" "i,i"))
6437 (clobber (reg:DI 25))
6438 (clobber (reg:DI 16))
6439 (clobber (reg:DI 17))
6440 (clobber (reg:DI 18))
6441 (clobber (reg:DI 19))
6442 (clobber (reg:DI 20))
6443 (clobber (reg:DI 26))
6444 (clobber (reg:DI 27))]
6445 "TARGET_ABI_OPEN_VMS"
6447 operands [5] = alpha_use_linkage (operands [4], cfun->decl, 0, 1);
6448 switch (which_alternative)
6451 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)";
6453 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)";
6458 [(set_attr "type" "multi")
6459 (set_attr "length" "28")])
6461 (define_expand "setmemqi"
6462 [(parallel [(set (match_operand:BLK 0 "memory_operand" "")
6463 (match_operand 2 "const_int_operand" ""))
6464 (use (match_operand:DI 1 "immediate_operand" ""))
6465 (use (match_operand:DI 3 "immediate_operand" ""))])]
6468 /* If value to set is not zero, use the library routine. */
6469 if (operands[2] != const0_rtx)
6472 if (alpha_expand_block_clear (operands))
6478 (define_expand "setmemdi"
6479 [(parallel [(set (match_operand:BLK 0 "memory_operand" "")
6480 (match_operand 2 "const_int_operand" ""))
6481 (use (match_operand:DI 1 "immediate_operand" ""))
6482 (use (match_operand:DI 3 "immediate_operand" ""))
6484 (clobber (reg:DI 25))
6485 (clobber (reg:DI 16))
6486 (clobber (reg:DI 17))
6487 (clobber (reg:DI 26))
6488 (clobber (reg:DI 27))])]
6489 "TARGET_ABI_OPEN_VMS"
6491 /* If value to set is not zero, use the library routine. */
6492 if (operands[2] != const0_rtx)
6495 operands[4] = alpha_need_linkage ("OTS$ZERO", 0);
6498 (define_insn "*clrmemdi_1"
6499 [(set (match_operand:BLK 0 "memory_operand" "=m,=m")
6501 (use (match_operand:DI 1 "nonmemory_operand" "r,i"))
6502 (use (match_operand:DI 2 "immediate_operand" ""))
6503 (use (match_operand:DI 3 "call_operand" "i,i"))
6504 (clobber (reg:DI 25))
6505 (clobber (reg:DI 16))
6506 (clobber (reg:DI 17))
6507 (clobber (reg:DI 26))
6508 (clobber (reg:DI 27))]
6509 "TARGET_ABI_OPEN_VMS"
6511 operands [4] = alpha_use_linkage (operands [3], cfun->decl, 0, 1);
6512 switch (which_alternative)
6515 return "lda $16,%0\;bis $31,%1,$17\;ldq $26,%4\;lda $25,2($31)\;jsr $26,%3\;ldq $27,0($29)";
6517 return "lda $16,%0\;lda $17,%1($31)\;ldq $26,%4\;lda $25,2($31)\;jsr $26,%3\;ldq $27,0($29)";
6522 [(set_attr "type" "multi")
6523 (set_attr "length" "24")])
6526 ;; Subroutine of stack space allocation. Perform a stack probe.
6527 (define_expand "probe_stack"
6528 [(set (match_dup 1) (match_operand:DI 0 "const_int_operand" ""))]
6531 operands[1] = gen_rtx_MEM (DImode, plus_constant (stack_pointer_rtx,
6532 INTVAL (operands[0])));
6533 MEM_VOLATILE_P (operands[1]) = 1;
6535 operands[0] = const0_rtx;
6538 ;; This is how we allocate stack space. If we are allocating a
6539 ;; constant amount of space and we know it is less than 4096
6540 ;; bytes, we need do nothing.
6542 ;; If it is more than 4096 bytes, we need to probe the stack
6544 (define_expand "allocate_stack"
6546 (plus:DI (reg:DI 30)
6547 (match_operand:DI 1 "reg_or_cint_operand" "")))
6548 (set (match_operand:DI 0 "register_operand" "=r")
6552 if (CONST_INT_P (operands[1])
6553 && INTVAL (operands[1]) < 32768)
6555 if (INTVAL (operands[1]) >= 4096)
6557 /* We do this the same way as in the prologue and generate explicit
6558 probes. Then we update the stack by the constant. */
6562 emit_insn (gen_probe_stack (GEN_INT (- probed)));
6563 while (probed + 8192 < INTVAL (operands[1]))
6564 emit_insn (gen_probe_stack (GEN_INT (- (probed += 8192))));
6566 if (probed + 4096 < INTVAL (operands[1]))
6567 emit_insn (gen_probe_stack (GEN_INT (- INTVAL(operands[1]))));
6570 operands[1] = GEN_INT (- INTVAL (operands[1]));
6571 operands[2] = virtual_stack_dynamic_rtx;
6576 rtx loop_label = gen_label_rtx ();
6577 rtx want = gen_reg_rtx (Pmode);
6578 rtx tmp = gen_reg_rtx (Pmode);
6581 emit_insn (gen_subdi3 (want, stack_pointer_rtx,
6582 force_reg (Pmode, operands[1])));
6583 emit_insn (gen_adddi3 (tmp, stack_pointer_rtx, GEN_INT (-4096)));
6585 if (!CONST_INT_P (operands[1]))
6587 out_label = gen_label_rtx ();
6588 test = gen_rtx_GEU (VOIDmode, want, tmp);
6589 emit_jump_insn (gen_cbranchdi4 (test, want, tmp, out_label));
6592 emit_label (loop_label);
6593 memref = gen_rtx_MEM (DImode, tmp);
6594 MEM_VOLATILE_P (memref) = 1;
6595 emit_move_insn (memref, const0_rtx);
6596 emit_insn (gen_adddi3 (tmp, tmp, GEN_INT(-8192)));
6597 test = gen_rtx_GTU (VOIDmode, tmp, want);
6598 emit_jump_insn (gen_cbranchdi4 (test, tmp, want, loop_label));
6600 memref = gen_rtx_MEM (DImode, want);
6601 MEM_VOLATILE_P (memref) = 1;
6602 emit_move_insn (memref, const0_rtx);
6605 emit_label (out_label);
6607 emit_move_insn (stack_pointer_rtx, want);
6608 emit_move_insn (operands[0], virtual_stack_dynamic_rtx);
6613 ;; This is used by alpha_expand_prolog to do the same thing as above,
6614 ;; except we cannot at that time generate new basic blocks, so we hide
6615 ;; the loop in this one insn.
6617 (define_insn "prologue_stack_probe_loop"
6618 [(unspec_volatile [(match_operand:DI 0 "register_operand" "r")
6619 (match_operand:DI 1 "register_operand" "r")]
6623 operands[2] = gen_label_rtx ();
6624 (*targetm.asm_out.internal_label) (asm_out_file, "L",
6625 CODE_LABEL_NUMBER (operands[2]));
6627 return "stq $31,-8192(%1)\;subq %0,1,%0\;lda %1,-8192(%1)\;bne %0,%l2";
6629 [(set_attr "length" "16")
6630 (set_attr "type" "multi")])
6632 (define_expand "prologue"
6633 [(clobber (const_int 0))]
6636 alpha_expand_prologue ();
6640 ;; These take care of emitting the ldgp insn in the prologue. This will be
6641 ;; an lda/ldah pair and we want to align them properly. So we have two
6642 ;; unspec_volatile insns, the first of which emits the ldgp assembler macro
6643 ;; and the second of which emits nothing. However, both are marked as type
6644 ;; IADD (the default) so the alignment code in alpha.c does the right thing
6647 (define_expand "prologue_ldgp"
6649 (unspec_volatile:DI [(match_dup 1) (match_dup 2)] UNSPECV_LDGP1))
6651 (unspec_volatile:DI [(match_dup 0) (match_dup 2)] UNSPECV_PLDGP2))]
6654 operands[0] = pic_offset_table_rtx;
6655 operands[1] = gen_rtx_REG (Pmode, 27);
6656 operands[2] = (TARGET_EXPLICIT_RELOCS
6657 ? GEN_INT (alpha_next_sequence_number++)
6661 (define_insn "*ldgp_er_1"
6662 [(set (match_operand:DI 0 "register_operand" "=r")
6663 (unspec_volatile:DI [(match_operand:DI 1 "register_operand" "r")
6664 (match_operand 2 "const_int_operand" "")]
6666 "TARGET_EXPLICIT_RELOCS && TARGET_ABI_OSF"
6667 "ldah %0,0(%1)\t\t!gpdisp!%2"
6668 [(set_attr "cannot_copy" "true")])
6670 (define_insn "*ldgp_er_2"
6671 [(set (match_operand:DI 0 "register_operand" "=r")
6672 (unspec:DI [(match_operand:DI 1 "register_operand" "r")
6673 (match_operand 2 "const_int_operand" "")]
6675 "TARGET_EXPLICIT_RELOCS && TARGET_ABI_OSF"
6676 "lda %0,0(%1)\t\t!gpdisp!%2"
6677 [(set_attr "cannot_copy" "true")])
6679 (define_insn "*prologue_ldgp_er_2"
6680 [(set (match_operand:DI 0 "register_operand" "=r")
6681 (unspec_volatile:DI [(match_operand:DI 1 "register_operand" "r")
6682 (match_operand 2 "const_int_operand" "")]
6684 "TARGET_EXPLICIT_RELOCS && TARGET_ABI_OSF"
6685 "lda %0,0(%1)\t\t!gpdisp!%2\n$%~..ng:"
6686 [(set_attr "cannot_copy" "true")])
6688 (define_insn "*prologue_ldgp_1"
6689 [(set (match_operand:DI 0 "register_operand" "=r")
6690 (unspec_volatile:DI [(match_operand:DI 1 "register_operand" "r")
6691 (match_operand 2 "const_int_operand" "")]
6694 "ldgp %0,0(%1)\n$%~..ng:"
6695 [(set_attr "cannot_copy" "true")])
6697 (define_insn "*prologue_ldgp_2"
6698 [(set (match_operand:DI 0 "register_operand" "=r")
6699 (unspec_volatile:DI [(match_operand:DI 1 "register_operand" "r")
6700 (match_operand 2 "const_int_operand" "")]
6705 ;; The _mcount profiling hook has special calling conventions, and
6706 ;; does not clobber all the registers that a normal call would. So
6707 ;; hide the fact this is a call at all.
6709 (define_insn "prologue_mcount"
6710 [(unspec_volatile [(const_int 0)] UNSPECV_MCOUNT)]
6713 if (TARGET_EXPLICIT_RELOCS)
6714 /* Note that we cannot use a lituse_jsr reloc, since _mcount
6715 cannot be called via the PLT. */
6716 return "ldq $28,_mcount($29)\t\t!literal\;jsr $28,($28),_mcount";
6718 return "lda $28,_mcount\;jsr $28,($28),_mcount";
6720 [(set_attr "type" "multi")
6721 (set_attr "length" "8")])
6723 (define_insn "init_fp"
6724 [(set (match_operand:DI 0 "register_operand" "=r")
6725 (match_operand:DI 1 "register_operand" "r"))
6726 (clobber (mem:BLK (match_operand:DI 2 "register_operand" "=r")))]
6730 (define_expand "epilogue"
6734 alpha_expand_epilogue ();
6737 (define_expand "sibcall_epilogue"
6741 alpha_expand_epilogue ();
6745 (define_expand "builtin_longjmp"
6746 [(use (match_operand:DI 0 "register_operand" "r"))]
6749 /* The elements of the buffer are, in order: */
6750 rtx fp = gen_rtx_MEM (Pmode, operands[0]);
6751 rtx lab = gen_rtx_MEM (Pmode, plus_constant (operands[0], 8));
6752 rtx stack = gen_rtx_MEM (Pmode, plus_constant (operands[0], 16));
6753 rtx pv = gen_rtx_REG (Pmode, 27);
6755 /* This bit is the same as expand_builtin_longjmp. */
6756 emit_move_insn (hard_frame_pointer_rtx, fp);
6757 emit_move_insn (pv, lab);
6758 emit_stack_restore (SAVE_NONLOCAL, stack, NULL_RTX);
6759 emit_use (hard_frame_pointer_rtx);
6760 emit_use (stack_pointer_rtx);
6762 /* Load the label we are jumping through into $27 so that we know
6763 where to look for it when we get back to setjmp's function for
6764 restoring the gp. */
6765 emit_jump_insn (gen_builtin_longjmp_internal (pv));
6770 ;; This is effectively a copy of indirect_jump, but constrained such
6771 ;; that register renaming cannot foil our cunning plan with $27.
6772 (define_insn "builtin_longjmp_internal"
6774 (unspec_volatile [(match_operand:DI 0 "register_operand" "c")]
6778 [(set_attr "type" "ibr")])
6780 (define_expand "builtin_setjmp_receiver"
6781 [(unspec_volatile [(label_ref (match_operand 0 "" ""))] UNSPECV_SETJMPR)]
6785 (define_insn_and_split "*builtin_setjmp_receiver_1"
6786 [(unspec_volatile [(match_operand 0 "" "")] UNSPECV_SETJMPR)]
6789 if (TARGET_EXPLICIT_RELOCS)
6792 return "br $27,$LSJ%=\n$LSJ%=:\;ldgp $29,0($27)";
6794 "&& TARGET_EXPLICIT_RELOCS && reload_completed"
6796 (unspec_volatile:DI [(match_dup 2) (match_dup 3)] UNSPECV_LDGP1))
6798 (unspec:DI [(match_dup 1) (match_dup 3)] UNSPEC_LDGP2))]
6800 if (prev_nonnote_insn (curr_insn) != XEXP (operands[0], 0))
6801 emit_insn (gen_rtx_UNSPEC_VOLATILE (VOIDmode, gen_rtvec (1, operands[0]),
6802 UNSPECV_SETJMPR_ER));
6803 operands[1] = pic_offset_table_rtx;
6804 operands[2] = gen_rtx_REG (Pmode, 27);
6805 operands[3] = GEN_INT (alpha_next_sequence_number++);
6807 [(set_attr "length" "12")
6808 (set_attr "type" "multi")])
6810 (define_insn "*builtin_setjmp_receiver_er_sl_1"
6811 [(unspec_volatile [(match_operand 0 "" "")] UNSPECV_SETJMPR_ER)]
6812 "TARGET_ABI_OSF && TARGET_EXPLICIT_RELOCS && TARGET_AS_CAN_SUBTRACT_LABELS"
6813 "lda $27,$LSJ%=-%l0($27)\n$LSJ%=:")
6815 (define_insn "*builtin_setjmp_receiver_er_1"
6816 [(unspec_volatile [(match_operand 0 "" "")] UNSPECV_SETJMPR_ER)]
6817 "TARGET_ABI_OSF && TARGET_EXPLICIT_RELOCS"
6818 "br $27,$LSJ%=\n$LSJ%=:"
6819 [(set_attr "type" "ibr")])
6821 ;; When flag_reorder_blocks_and_partition is in effect, compiler puts
6822 ;; exception landing pads in a cold section. To prevent inter-section offset
6823 ;; calculation, a jump to original landing pad is emitted in the place of the
6824 ;; original landing pad. Since landing pad is moved, RA-relative GP
6825 ;; calculation in the prologue of landing pad breaks. To solve this problem,
6826 ;; we use alternative GP load approach, as in the case of TARGET_LD_BUGGY_LDGP.
6828 (define_expand "exception_receiver"
6829 [(unspec_volatile [(match_dup 0)] UNSPECV_EHR)]
6832 if (TARGET_LD_BUGGY_LDGP || flag_reorder_blocks_and_partition)
6833 operands[0] = alpha_gp_save_rtx ();
6835 operands[0] = const0_rtx;
6838 (define_insn "*exception_receiver_2"
6839 [(unspec_volatile [(match_operand:DI 0 "memory_operand" "m")] UNSPECV_EHR)]
6841 && (TARGET_LD_BUGGY_LDGP || flag_reorder_blocks_and_partition)"
6843 [(set_attr "type" "ild")])
6845 (define_insn_and_split "*exception_receiver_1"
6846 [(unspec_volatile [(const_int 0)] UNSPECV_EHR)]
6849 if (TARGET_EXPLICIT_RELOCS)
6850 return "ldah $29,0($26)\t\t!gpdisp!%*\;lda $29,0($29)\t\t!gpdisp!%*";
6852 return "ldgp $29,0($26)";
6854 "&& TARGET_EXPLICIT_RELOCS && reload_completed"
6856 (unspec_volatile:DI [(match_dup 1) (match_dup 2)] UNSPECV_LDGP1))
6858 (unspec:DI [(match_dup 0) (match_dup 2)] UNSPEC_LDGP2))]
6860 operands[0] = pic_offset_table_rtx;
6861 operands[1] = gen_rtx_REG (Pmode, 26);
6862 operands[2] = GEN_INT (alpha_next_sequence_number++);
6864 [(set_attr "length" "8")
6865 (set_attr "type" "multi")])
6867 (define_expand "nonlocal_goto_receiver"
6868 [(unspec_volatile [(const_int 0)] UNSPECV_BLOCKAGE)
6869 (set (reg:DI 27) (mem:DI (reg:DI 29)))
6870 (unspec_volatile [(const_int 0)] UNSPECV_BLOCKAGE)
6872 "TARGET_ABI_OPEN_VMS"
6875 (define_insn "arg_home"
6876 [(unspec [(const_int 0)] UNSPEC_ARG_HOME)
6891 (clobber (mem:BLK (const_int 0)))
6892 (clobber (reg:DI 24))
6893 (clobber (reg:DI 25))
6894 (clobber (reg:DI 0))]
6895 "TARGET_ABI_OPEN_VMS"
6896 "lda $0,OTS$HOME_ARGS\;ldq $0,8($0)\;jsr $0,OTS$HOME_ARGS"
6897 [(set_attr "length" "16")
6898 (set_attr "type" "multi")])
6900 ;; Load the CIW into r2 for calling __T3E_MISMATCH
6902 (define_expand "umk_mismatch_args"
6903 [(set:DI (match_dup 1) (mem:DI (plus:DI (reg:DI 15) (const_int -16))))
6904 (set:DI (match_dup 2) (mem:DI (plus:DI (match_dup 1) (const_int -32))))
6905 (set:DI (reg:DI 1) (match_operand:DI 0 "const_int_operand" ""))
6906 (set:DI (match_dup 3) (plus:DI (mult:DI (reg:DI 25)
6909 (set:DI (reg:DI 2) (mem:DI (match_dup 3)))]
6910 "TARGET_ABI_UNICOSMK"
6912 operands[1] = gen_reg_rtx (DImode);
6913 operands[2] = gen_reg_rtx (DImode);
6914 operands[3] = gen_reg_rtx (DImode);
6917 (define_insn "arg_home_umk"
6918 [(unspec [(const_int 0)] UNSPEC_ARG_HOME)
6933 (clobber (mem:BLK (const_int 0)))
6935 (clobber (reg:DI 22))
6936 (clobber (reg:DI 23))
6937 (clobber (reg:DI 24))
6938 (clobber (reg:DI 0))
6939 (clobber (reg:DI 1))
6940 (clobber (reg:DI 2))
6941 (clobber (reg:DI 3))
6942 (clobber (reg:DI 4))
6943 (clobber (reg:DI 5))
6944 (clobber (reg:DI 6))
6945 (clobber (reg:DI 7))
6946 (clobber (reg:DI 8))])]
6947 "TARGET_ABI_UNICOSMK"
6948 "laum $4,__T3E_MISMATCH($31)\;sll $4,32,$4\;lalm $4,__T3E_MISMATCH($4)\;lal $4,__T3E_MISMATCH($4)\;jsr $3,($4)"
6949 [(set_attr "length" "16")
6950 (set_attr "type" "multi")])
6954 ;; On EV4, these instructions are nops -- no load occurs.
6956 ;; On EV5, these instructions act as a normal load, and thus can trap
6957 ;; if the address is invalid. The OS may (or may not) handle this in
6958 ;; the entMM fault handler and suppress the fault. If so, then this
6959 ;; has the effect of a read prefetch instruction.
6961 ;; On EV6, these become official prefetch instructions.
6963 (define_insn "prefetch"
6964 [(prefetch (match_operand:DI 0 "address_operand" "p")
6965 (match_operand:DI 1 "const_int_operand" "n")
6966 (match_operand:DI 2 "const_int_operand" "n"))]
6967 "TARGET_FIXUP_EV5_PREFETCH || alpha_cpu == PROCESSOR_EV6"
6969 /* Interpret "no temporal locality" as this data should be evicted once
6970 it is used. The "evict next" alternatives load the data into the cache
6971 and leave the LRU eviction counter pointing to that block. */
6972 static const char * const alt[2][2] = {
6974 "ldq $31,%a0", /* read, evict next */
6975 "ldl $31,%a0", /* read, evict last */
6978 "ldt $f31,%a0", /* write, evict next */
6979 "lds $f31,%a0", /* write, evict last */
6983 bool write = INTVAL (operands[1]) != 0;
6984 bool lru = INTVAL (operands[2]) != 0;
6986 return alt[write][lru];
6988 [(set_attr "type" "ild")])
6990 ;; Close the trap shadow of preceding instructions. This is generated
6993 (define_insn "trapb"
6994 [(unspec_volatile [(const_int 0)] UNSPECV_TRAPB)]
6997 [(set_attr "type" "misc")])
6999 ;; No-op instructions used by machine-dependent reorg to preserve
7000 ;; alignment for instruction issue.
7001 ;; The Unicos/Mk assembler does not support these opcodes.
7007 [(set_attr "type" "ilog")])
7012 "cpys $f31,$f31,$f31"
7013 [(set_attr "type" "fcpys")])
7020 ;; On Unicos/Mk we use a macro for aligning code.
7022 (define_insn "realign"
7023 [(unspec_volatile [(match_operand 0 "immediate_operand" "i")]
7027 if (TARGET_ABI_UNICOSMK)
7028 return "gcc@code@align %0";
7030 return ".align %0 #realign";
7033 ;; Instructions to be emitted from __builtins.
7035 (define_insn "builtin_cmpbge"
7036 [(set (match_operand:DI 0 "register_operand" "=r")
7037 (unspec:DI [(match_operand:DI 1 "reg_or_0_operand" "rJ")
7038 (match_operand:DI 2 "reg_or_8bit_operand" "rI")]
7042 ;; The EV6 data sheets list this as ILOG. OTOH, EV6 doesn't
7043 ;; actually differentiate between ILOG and ICMP in the schedule.
7044 [(set_attr "type" "icmp")])
7046 (define_expand "builtin_extbl"
7047 [(match_operand:DI 0 "register_operand" "")
7048 (match_operand:DI 1 "reg_or_0_operand" "")
7049 (match_operand:DI 2 "reg_or_8bit_operand" "")]
7052 rtx (*gen) (rtx, rtx, rtx, rtx);
7053 if (WORDS_BIG_ENDIAN)
7057 emit_insn ((*gen) (operands[0], operands[1], GEN_INT (8), operands[2]));
7061 (define_expand "builtin_extwl"
7062 [(match_operand:DI 0 "register_operand" "")
7063 (match_operand:DI 1 "reg_or_0_operand" "")
7064 (match_operand:DI 2 "reg_or_8bit_operand" "")]
7067 rtx (*gen) (rtx, rtx, rtx, rtx);
7068 if (WORDS_BIG_ENDIAN)
7072 emit_insn ((*gen) (operands[0], operands[1], GEN_INT (16), operands[2]));
7076 (define_expand "builtin_extll"
7077 [(match_operand:DI 0 "register_operand" "")
7078 (match_operand:DI 1 "reg_or_0_operand" "")
7079 (match_operand:DI 2 "reg_or_8bit_operand" "")]
7082 rtx (*gen) (rtx, rtx, rtx, rtx);
7083 if (WORDS_BIG_ENDIAN)
7087 emit_insn ((*gen) (operands[0], operands[1], GEN_INT (32), operands[2]));
7091 (define_expand "builtin_extql"
7092 [(match_operand:DI 0 "register_operand" "")
7093 (match_operand:DI 1 "reg_or_0_operand" "")
7094 (match_operand:DI 2 "reg_or_8bit_operand" "")]
7097 rtx (*gen) (rtx, rtx, rtx, rtx);
7098 if (WORDS_BIG_ENDIAN)
7102 emit_insn ((*gen) (operands[0], operands[1], GEN_INT (64), operands[2]));
7106 (define_expand "builtin_extwh"
7107 [(match_operand:DI 0 "register_operand" "")
7108 (match_operand:DI 1 "reg_or_0_operand" "")
7109 (match_operand:DI 2 "reg_or_8bit_operand" "")]
7112 rtx (*gen) (rtx, rtx, rtx);
7113 if (WORDS_BIG_ENDIAN)
7117 emit_insn ((*gen) (operands[0], operands[1], operands[2]));
7121 (define_expand "builtin_extlh"
7122 [(match_operand:DI 0 "register_operand" "")
7123 (match_operand:DI 1 "reg_or_0_operand" "")
7124 (match_operand:DI 2 "reg_or_8bit_operand" "")]
7127 rtx (*gen) (rtx, rtx, rtx);
7128 if (WORDS_BIG_ENDIAN)
7132 emit_insn ((*gen) (operands[0], operands[1], operands[2]));
7136 (define_expand "builtin_extqh"
7137 [(match_operand:DI 0 "register_operand" "")
7138 (match_operand:DI 1 "reg_or_0_operand" "")
7139 (match_operand:DI 2 "reg_or_8bit_operand" "")]
7142 rtx (*gen) (rtx, rtx, rtx);
7143 if (WORDS_BIG_ENDIAN)
7147 emit_insn ((*gen) (operands[0], operands[1], operands[2]));
7151 (define_expand "builtin_insbl"
7152 [(match_operand:DI 0 "register_operand" "")
7153 (match_operand:DI 1 "register_operand" "")
7154 (match_operand:DI 2 "reg_or_8bit_operand" "")]
7157 rtx (*gen) (rtx, rtx, rtx);
7158 if (WORDS_BIG_ENDIAN)
7162 operands[1] = gen_lowpart (QImode, operands[1]);
7163 emit_insn ((*gen) (operands[0], operands[1], operands[2]));
7167 (define_expand "builtin_inswl"
7168 [(match_operand:DI 0 "register_operand" "")
7169 (match_operand:DI 1 "register_operand" "")
7170 (match_operand:DI 2 "reg_or_8bit_operand" "")]
7173 rtx (*gen) (rtx, rtx, rtx);
7174 if (WORDS_BIG_ENDIAN)
7178 operands[1] = gen_lowpart (HImode, operands[1]);
7179 emit_insn ((*gen) (operands[0], operands[1], operands[2]));
7183 (define_expand "builtin_insll"
7184 [(match_operand:DI 0 "register_operand" "")
7185 (match_operand:DI 1 "register_operand" "")
7186 (match_operand:DI 2 "reg_or_8bit_operand" "")]
7189 rtx (*gen) (rtx, rtx, rtx);
7190 if (WORDS_BIG_ENDIAN)
7194 operands[1] = gen_lowpart (SImode, operands[1]);
7195 emit_insn ((*gen) (operands[0], operands[1], operands[2]));
7196 emit_insn ((*gen) (operands[0], operands[1], operands[2]));
7200 (define_expand "builtin_insql"
7201 [(match_operand:DI 0 "register_operand" "")
7202 (match_operand:DI 1 "reg_or_0_operand" "")
7203 (match_operand:DI 2 "reg_or_8bit_operand" "")]
7206 rtx (*gen) (rtx, rtx, rtx);
7207 if (WORDS_BIG_ENDIAN)
7211 emit_insn ((*gen) (operands[0], operands[1], operands[2]));
7215 (define_expand "builtin_inswh"
7216 [(match_operand:DI 0 "register_operand" "")
7217 (match_operand:DI 1 "register_operand" "")
7218 (match_operand:DI 2 "reg_or_8bit_operand" "")]
7221 emit_insn (gen_insxh (operands[0], operands[1], GEN_INT (16), operands[2]));
7225 (define_expand "builtin_inslh"
7226 [(match_operand:DI 0 "register_operand" "")
7227 (match_operand:DI 1 "register_operand" "")
7228 (match_operand:DI 2 "reg_or_8bit_operand" "")]
7231 emit_insn (gen_insxh (operands[0], operands[1], GEN_INT (32), operands[2]));
7235 (define_expand "builtin_insqh"
7236 [(match_operand:DI 0 "register_operand" "")
7237 (match_operand:DI 1 "register_operand" "")
7238 (match_operand:DI 2 "reg_or_8bit_operand" "")]
7241 emit_insn (gen_insxh (operands[0], operands[1], GEN_INT (64), operands[2]));
7245 (define_expand "builtin_mskbl"
7246 [(match_operand:DI 0 "register_operand" "")
7247 (match_operand:DI 1 "reg_or_0_operand" "")
7248 (match_operand:DI 2 "reg_or_8bit_operand" "")]
7251 rtx (*gen) (rtx, rtx, rtx, rtx);
7253 if (WORDS_BIG_ENDIAN)
7257 mask = GEN_INT (0xff);
7258 emit_insn ((*gen) (operands[0], operands[1], mask, operands[2]));
7262 (define_expand "builtin_mskwl"
7263 [(match_operand:DI 0 "register_operand" "")
7264 (match_operand:DI 1 "reg_or_0_operand" "")
7265 (match_operand:DI 2 "reg_or_8bit_operand" "")]
7268 rtx (*gen) (rtx, rtx, rtx, rtx);
7270 if (WORDS_BIG_ENDIAN)
7274 mask = GEN_INT (0xffff);
7275 emit_insn ((*gen) (operands[0], operands[1], mask, operands[2]));
7279 (define_expand "builtin_mskll"
7280 [(match_operand:DI 0 "register_operand" "")
7281 (match_operand:DI 1 "reg_or_0_operand" "")
7282 (match_operand:DI 2 "reg_or_8bit_operand" "")]
7285 rtx (*gen) (rtx, rtx, rtx, rtx);
7287 if (WORDS_BIG_ENDIAN)
7291 mask = immed_double_const (0xffffffff, 0, DImode);
7292 emit_insn ((*gen) (operands[0], operands[1], mask, operands[2]));
7296 (define_expand "builtin_mskql"
7297 [(match_operand:DI 0 "register_operand" "")
7298 (match_operand:DI 1 "reg_or_0_operand" "")
7299 (match_operand:DI 2 "reg_or_8bit_operand" "")]
7302 rtx (*gen) (rtx, rtx, rtx, rtx);
7304 if (WORDS_BIG_ENDIAN)
7309 emit_insn ((*gen) (operands[0], operands[1], mask, operands[2]));
7313 (define_expand "builtin_mskwh"
7314 [(match_operand:DI 0 "register_operand" "")
7315 (match_operand:DI 1 "register_operand" "")
7316 (match_operand:DI 2 "reg_or_8bit_operand" "")]
7319 emit_insn (gen_mskxh (operands[0], operands[1], GEN_INT (16), operands[2]));
7323 (define_expand "builtin_msklh"
7324 [(match_operand:DI 0 "register_operand" "")
7325 (match_operand:DI 1 "register_operand" "")
7326 (match_operand:DI 2 "reg_or_8bit_operand" "")]
7329 emit_insn (gen_mskxh (operands[0], operands[1], GEN_INT (32), operands[2]));
7333 (define_expand "builtin_mskqh"
7334 [(match_operand:DI 0 "register_operand" "")
7335 (match_operand:DI 1 "register_operand" "")
7336 (match_operand:DI 2 "reg_or_8bit_operand" "")]
7339 emit_insn (gen_mskxh (operands[0], operands[1], GEN_INT (64), operands[2]));
7343 (define_expand "builtin_zap"
7344 [(set (match_operand:DI 0 "register_operand" "")
7346 [(match_operand:DI 2 "reg_or_cint_operand" "")]
7348 (match_operand:DI 1 "reg_or_cint_operand" "")))]
7351 if (CONST_INT_P (operands[2]))
7353 rtx mask = alpha_expand_zap_mask (INTVAL (operands[2]));
7355 if (mask == const0_rtx)
7357 emit_move_insn (operands[0], const0_rtx);
7360 if (mask == constm1_rtx)
7362 emit_move_insn (operands[0], operands[1]);
7366 operands[1] = force_reg (DImode, operands[1]);
7367 emit_insn (gen_anddi3 (operands[0], operands[1], mask));
7371 operands[1] = force_reg (DImode, operands[1]);
7372 operands[2] = gen_lowpart (QImode, operands[2]);
7375 (define_insn "*builtin_zap_1"
7376 [(set (match_operand:DI 0 "register_operand" "=r,r,r,r")
7378 [(match_operand:QI 2 "reg_or_cint_operand" "n,n,r,r")]
7380 (match_operand:DI 1 "reg_or_cint_operand" "n,r,J,r")))]
7387 [(set_attr "type" "shift,shift,ilog,shift")])
7390 [(set (match_operand:DI 0 "register_operand" "")
7392 [(match_operand:QI 2 "const_int_operand" "")]
7394 (match_operand:DI 1 "const_int_operand" "")))]
7398 rtx mask = alpha_expand_zap_mask (INTVAL (operands[2]));
7399 if (HOST_BITS_PER_WIDE_INT >= 64 || CONST_INT_P (mask))
7400 operands[1] = gen_int_mode (INTVAL (operands[1]) & INTVAL (mask), DImode);
7403 HOST_WIDE_INT c_lo = INTVAL (operands[1]);
7404 HOST_WIDE_INT c_hi = (c_lo < 0 ? -1 : 0);
7405 operands[1] = immed_double_const (c_lo & CONST_DOUBLE_LOW (mask),
7406 c_hi & CONST_DOUBLE_HIGH (mask),
7409 emit_move_insn (operands[0], operands[1]);
7414 [(set (match_operand:DI 0 "register_operand" "")
7416 [(match_operand:QI 2 "const_int_operand" "")]
7418 (match_operand:DI 1 "register_operand" "")))]
7421 (and:DI (match_dup 1) (match_dup 2)))]
7423 operands[2] = alpha_expand_zap_mask (INTVAL (operands[2]));
7424 if (operands[2] == const0_rtx)
7426 emit_move_insn (operands[0], const0_rtx);
7429 if (operands[2] == constm1_rtx)
7431 emit_move_insn (operands[0], operands[1]);
7436 (define_expand "builtin_zapnot"
7437 [(set (match_operand:DI 0 "register_operand" "")
7439 [(not:QI (match_operand:DI 2 "reg_or_cint_operand" ""))]
7441 (match_operand:DI 1 "reg_or_cint_operand" "")))]
7444 if (CONST_INT_P (operands[2]))
7446 rtx mask = alpha_expand_zap_mask (~ INTVAL (operands[2]));
7448 if (mask == const0_rtx)
7450 emit_move_insn (operands[0], const0_rtx);
7453 if (mask == constm1_rtx)
7455 emit_move_insn (operands[0], operands[1]);
7459 operands[1] = force_reg (DImode, operands[1]);
7460 emit_insn (gen_anddi3 (operands[0], operands[1], mask));
7464 operands[1] = force_reg (DImode, operands[1]);
7465 operands[2] = gen_lowpart (QImode, operands[2]);
7468 (define_insn "*builtin_zapnot_1"
7469 [(set (match_operand:DI 0 "register_operand" "=r")
7471 [(not:QI (match_operand:QI 2 "register_operand" "r"))]
7473 (match_operand:DI 1 "reg_or_0_operand" "rJ")))]
7476 [(set_attr "type" "shift")])
7478 (define_insn "builtin_amask"
7479 [(set (match_operand:DI 0 "register_operand" "=r")
7480 (unspec:DI [(match_operand:DI 1 "reg_or_8bit_operand" "rI")]
7484 [(set_attr "type" "ilog")])
7486 (define_insn "builtin_implver"
7487 [(set (match_operand:DI 0 "register_operand" "=r")
7488 (unspec:DI [(const_int 0)] UNSPEC_IMPLVER))]
7491 [(set_attr "type" "ilog")])
7493 (define_insn "builtin_rpcc"
7494 [(set (match_operand:DI 0 "register_operand" "=r")
7495 (unspec_volatile:DI [(const_int 0)] UNSPECV_RPCC))]
7498 [(set_attr "type" "ilog")])
7500 (define_expand "builtin_minub8"
7501 [(match_operand:DI 0 "register_operand" "")
7502 (match_operand:DI 1 "reg_or_0_operand" "")
7503 (match_operand:DI 2 "reg_or_0_operand" "")]
7506 alpha_expand_builtin_vector_binop (gen_uminv8qi3, V8QImode, operands[0],
7507 operands[1], operands[2]);
7511 (define_expand "builtin_minsb8"
7512 [(match_operand:DI 0 "register_operand" "")
7513 (match_operand:DI 1 "reg_or_0_operand" "")
7514 (match_operand:DI 2 "reg_or_0_operand" "")]
7517 alpha_expand_builtin_vector_binop (gen_sminv8qi3, V8QImode, operands[0],
7518 operands[1], operands[2]);
7522 (define_expand "builtin_minuw4"
7523 [(match_operand:DI 0 "register_operand" "")
7524 (match_operand:DI 1 "reg_or_0_operand" "")
7525 (match_operand:DI 2 "reg_or_0_operand" "")]
7528 alpha_expand_builtin_vector_binop (gen_uminv4hi3, V4HImode, operands[0],
7529 operands[1], operands[2]);
7533 (define_expand "builtin_minsw4"
7534 [(match_operand:DI 0 "register_operand" "")
7535 (match_operand:DI 1 "reg_or_0_operand" "")
7536 (match_operand:DI 2 "reg_or_0_operand" "")]
7539 alpha_expand_builtin_vector_binop (gen_sminv4hi3, V4HImode, operands[0],
7540 operands[1], operands[2]);
7544 (define_expand "builtin_maxub8"
7545 [(match_operand:DI 0 "register_operand" "")
7546 (match_operand:DI 1 "reg_or_0_operand" "")
7547 (match_operand:DI 2 "reg_or_0_operand" "")]
7550 alpha_expand_builtin_vector_binop (gen_umaxv8qi3, V8QImode, operands[0],
7551 operands[1], operands[2]);
7555 (define_expand "builtin_maxsb8"
7556 [(match_operand:DI 0 "register_operand" "")
7557 (match_operand:DI 1 "reg_or_0_operand" "")
7558 (match_operand:DI 2 "reg_or_0_operand" "")]
7561 alpha_expand_builtin_vector_binop (gen_smaxv8qi3, V8QImode, operands[0],
7562 operands[1], operands[2]);
7566 (define_expand "builtin_maxuw4"
7567 [(match_operand:DI 0 "register_operand" "")
7568 (match_operand:DI 1 "reg_or_0_operand" "")
7569 (match_operand:DI 2 "reg_or_0_operand" "")]
7572 alpha_expand_builtin_vector_binop (gen_umaxv4hi3, V4HImode, operands[0],
7573 operands[1], operands[2]);
7577 (define_expand "builtin_maxsw4"
7578 [(match_operand:DI 0 "register_operand" "")
7579 (match_operand:DI 1 "reg_or_0_operand" "")
7580 (match_operand:DI 2 "reg_or_0_operand" "")]
7583 alpha_expand_builtin_vector_binop (gen_smaxv4hi3, V4HImode, operands[0],
7584 operands[1], operands[2]);
7588 (define_insn "builtin_perr"
7589 [(set (match_operand:DI 0 "register_operand" "=r")
7590 (unspec:DI [(match_operand:DI 1 "reg_or_0_operand" "%rJ")
7591 (match_operand:DI 2 "reg_or_8bit_operand" "rJ")]
7595 [(set_attr "type" "mvi")])
7597 (define_expand "builtin_pklb"
7598 [(set (match_operand:DI 0 "register_operand" "")
7601 (truncate:V2QI (match_operand:DI 1 "register_operand" ""))
7606 operands[0] = gen_lowpart (V8QImode, operands[0]);
7607 operands[1] = gen_lowpart (V2SImode, operands[1]);
7608 operands[2] = CONST0_RTX (V2QImode);
7609 operands[3] = CONST0_RTX (V4QImode);
7612 (define_insn "*pklb"
7613 [(set (match_operand:V8QI 0 "register_operand" "=r")
7616 (truncate:V2QI (match_operand:V2SI 1 "register_operand" "r"))
7617 (match_operand:V2QI 2 "const0_operand" ""))
7618 (match_operand:V4QI 3 "const0_operand" "")))]
7621 [(set_attr "type" "mvi")])
7623 (define_expand "builtin_pkwb"
7624 [(set (match_operand:DI 0 "register_operand" "")
7626 (truncate:V4QI (match_operand:DI 1 "register_operand" ""))
7630 operands[0] = gen_lowpart (V8QImode, operands[0]);
7631 operands[1] = gen_lowpart (V4HImode, operands[1]);
7632 operands[2] = CONST0_RTX (V4QImode);
7635 (define_insn "*pkwb"
7636 [(set (match_operand:V8QI 0 "register_operand" "=r")
7638 (truncate:V4QI (match_operand:V4HI 1 "register_operand" "r"))
7639 (match_operand:V4QI 2 "const0_operand" "")))]
7642 [(set_attr "type" "mvi")])
7644 (define_expand "builtin_unpkbl"
7645 [(set (match_operand:DI 0 "register_operand" "")
7647 (vec_select:V2QI (match_operand:DI 1 "register_operand" "")
7648 (parallel [(const_int 0) (const_int 1)]))))]
7651 operands[0] = gen_lowpart (V2SImode, operands[0]);
7652 operands[1] = gen_lowpart (V8QImode, operands[1]);
7655 (define_insn "*unpkbl"
7656 [(set (match_operand:V2SI 0 "register_operand" "=r")
7658 (vec_select:V2QI (match_operand:V8QI 1 "reg_or_0_operand" "rW")
7659 (parallel [(const_int 0) (const_int 1)]))))]
7662 [(set_attr "type" "mvi")])
7664 (define_expand "builtin_unpkbw"
7665 [(set (match_operand:DI 0 "register_operand" "")
7667 (vec_select:V4QI (match_operand:DI 1 "register_operand" "")
7668 (parallel [(const_int 0)
7674 operands[0] = gen_lowpart (V4HImode, operands[0]);
7675 operands[1] = gen_lowpart (V8QImode, operands[1]);
7678 (define_insn "*unpkbw"
7679 [(set (match_operand:V4HI 0 "register_operand" "=r")
7681 (vec_select:V4QI (match_operand:V8QI 1 "reg_or_0_operand" "rW")
7682 (parallel [(const_int 0)
7688 [(set_attr "type" "mvi")])
7692 ;; The call patterns are at the end of the file because their
7693 ;; wildcard operand0 interferes with nice recognition.
7695 (define_insn "*call_value_osf_1_er_noreturn"
7696 [(set (match_operand 0 "" "")
7697 (call (mem:DI (match_operand:DI 1 "call_operand" "c,R,s"))
7698 (match_operand 2 "" "")))
7700 (clobber (reg:DI 26))]
7701 "TARGET_EXPLICIT_RELOCS && TARGET_ABI_OSF
7702 && find_reg_note (insn, REG_NORETURN, NULL_RTX)"
7705 bsr $26,%1\t\t!samegp
7706 ldq $27,%1($29)\t\t!literal!%#\;jsr $26,($27),%1\t\t!lituse_jsr!%#"
7707 [(set_attr "type" "jsr")
7708 (set_attr "length" "*,*,8")])
7710 (define_insn "*call_value_osf_1_er"
7711 [(set (match_operand 0 "" "")
7712 (call (mem:DI (match_operand:DI 1 "call_operand" "c,R,s"))
7713 (match_operand 2 "" "")))
7715 (clobber (reg:DI 26))]
7716 "TARGET_EXPLICIT_RELOCS && TARGET_ABI_OSF"
7718 jsr $26,(%1),0\;ldah $29,0($26)\t\t!gpdisp!%*\;lda $29,0($29)\t\t!gpdisp!%*
7719 bsr $26,%1\t\t!samegp
7720 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!%*"
7721 [(set_attr "type" "jsr")
7722 (set_attr "length" "12,*,16")])
7724 ;; We must use peep2 instead of a split because we need accurate life
7725 ;; information for $gp. Consider the case of { bar(); while (1); }.
7727 [(parallel [(set (match_operand 0 "" "")
7728 (call (mem:DI (match_operand:DI 1 "call_operand" ""))
7729 (match_operand 2 "" "")))
7731 (clobber (reg:DI 26))])]
7732 "TARGET_EXPLICIT_RELOCS && TARGET_ABI_OSF && reload_completed
7733 && ! samegp_function_operand (operands[1], Pmode)
7734 && (peep2_regno_dead_p (1, 29)
7735 || find_reg_note (insn, REG_NORETURN, NULL_RTX))"
7736 [(parallel [(set (match_dup 0)
7737 (call (mem:DI (match_dup 3))
7742 (clobber (reg:DI 26))])]
7744 if (CONSTANT_P (operands[1]))
7746 operands[3] = gen_rtx_REG (Pmode, 27);
7747 operands[4] = GEN_INT (alpha_next_sequence_number++);
7748 emit_insn (gen_movdi_er_high_g (operands[3], pic_offset_table_rtx,
7749 operands[1], operands[4]));
7753 operands[3] = operands[1];
7754 operands[1] = const0_rtx;
7755 operands[4] = const0_rtx;
7760 [(parallel [(set (match_operand 0 "" "")
7761 (call (mem:DI (match_operand:DI 1 "call_operand" ""))
7762 (match_operand 2 "" "")))
7764 (clobber (reg:DI 26))])]
7765 "TARGET_EXPLICIT_RELOCS && TARGET_ABI_OSF && reload_completed
7766 && ! samegp_function_operand (operands[1], Pmode)
7767 && ! (peep2_regno_dead_p (1, 29)
7768 || find_reg_note (insn, REG_NORETURN, NULL_RTX))"
7769 [(parallel [(set (match_dup 0)
7770 (call (mem:DI (match_dup 3))
7773 (unspec:DI [(match_dup 6) (match_dup 4)] UNSPEC_LDGP1))
7776 (clobber (reg:DI 26))])
7778 (unspec:DI [(match_dup 6) (match_dup 4)] UNSPEC_LDGP2))]
7780 if (CONSTANT_P (operands[1]))
7782 operands[3] = gen_rtx_REG (Pmode, 27);
7783 operands[5] = GEN_INT (alpha_next_sequence_number++);
7784 emit_insn (gen_movdi_er_high_g (operands[3], pic_offset_table_rtx,
7785 operands[1], operands[5]));
7789 operands[3] = operands[1];
7790 operands[1] = const0_rtx;
7791 operands[5] = const0_rtx;
7793 operands[4] = GEN_INT (alpha_next_sequence_number++);
7794 operands[6] = pic_offset_table_rtx;
7797 (define_insn "*call_value_osf_2_er_nogp"
7798 [(set (match_operand 0 "" "")
7799 (call (mem:DI (match_operand:DI 1 "register_operand" "c"))
7800 (match_operand 2 "" "")))
7802 (use (match_operand 3 "" ""))
7803 (use (match_operand 4 "" ""))
7804 (clobber (reg:DI 26))]
7805 "TARGET_EXPLICIT_RELOCS && TARGET_ABI_OSF"
7806 "jsr $26,(%1),%3%J4"
7807 [(set_attr "type" "jsr")])
7809 (define_insn "*call_value_osf_2_er"
7810 [(set (match_operand 0 "" "")
7811 (call (mem:DI (match_operand:DI 1 "register_operand" "c"))
7812 (match_operand 2 "" "")))
7814 (unspec:DI [(reg:DI 29) (match_operand 5 "const_int_operand" "")]
7816 (use (match_operand 3 "" ""))
7817 (use (match_operand 4 "" ""))
7818 (clobber (reg:DI 26))]
7819 "TARGET_EXPLICIT_RELOCS && TARGET_ABI_OSF"
7820 "jsr $26,(%1),%3%J4\;ldah $29,0($26)\t\t!gpdisp!%5"
7821 [(set_attr "type" "jsr")
7822 (set_attr "cannot_copy" "true")
7823 (set_attr "length" "8")])
7825 (define_insn "*call_value_osf_1_noreturn"
7826 [(set (match_operand 0 "" "")
7827 (call (mem:DI (match_operand:DI 1 "call_operand" "c,R,s"))
7828 (match_operand 2 "" "")))
7830 (clobber (reg:DI 26))]
7831 "! TARGET_EXPLICIT_RELOCS && TARGET_ABI_OSF
7832 && find_reg_note (insn, REG_NORETURN, NULL_RTX)"
7837 [(set_attr "type" "jsr")
7838 (set_attr "length" "*,*,8")])
7840 (define_insn_and_split "call_value_osf_tlsgd"
7841 [(set (match_operand 0 "" "")
7842 (call (mem:DI (match_operand:DI 1 "symbolic_operand" ""))
7844 (unspec [(match_operand:DI 2 "const_int_operand" "")] UNSPEC_TLSGD_CALL)
7846 (clobber (reg:DI 26))]
7849 "&& reload_completed"
7851 (unspec:DI [(match_dup 5)
7853 (match_dup 2)] UNSPEC_LITERAL))
7854 (parallel [(set (match_dup 0)
7855 (call (mem:DI (match_dup 3))
7858 (unspec:DI [(match_dup 5) (match_dup 4)] UNSPEC_LDGP1))
7860 (use (unspec [(match_dup 2)] UNSPEC_TLSGD_CALL))
7861 (clobber (reg:DI 26))])
7863 (unspec:DI [(match_dup 5) (match_dup 4)] UNSPEC_LDGP2))]
7865 operands[3] = gen_rtx_REG (Pmode, 27);
7866 operands[4] = GEN_INT (alpha_next_sequence_number++);
7867 operands[5] = pic_offset_table_rtx;
7869 [(set_attr "type" "multi")])
7871 (define_insn_and_split "call_value_osf_tlsldm"
7872 [(set (match_operand 0 "" "")
7873 (call (mem:DI (match_operand:DI 1 "symbolic_operand" ""))
7875 (unspec [(match_operand:DI 2 "const_int_operand" "")] UNSPEC_TLSLDM_CALL)
7877 (clobber (reg:DI 26))]
7880 "&& reload_completed"
7882 (unspec:DI [(match_dup 5)
7884 (match_dup 2)] UNSPEC_LITERAL))
7885 (parallel [(set (match_dup 0)
7886 (call (mem:DI (match_dup 3))
7889 (unspec:DI [(match_dup 5) (match_dup 4)] UNSPEC_LDGP1))
7891 (use (unspec [(match_dup 2)] UNSPEC_TLSLDM_CALL))
7892 (clobber (reg:DI 26))])
7894 (unspec:DI [(match_dup 5) (match_dup 4)] UNSPEC_LDGP2))]
7896 operands[3] = gen_rtx_REG (Pmode, 27);
7897 operands[4] = GEN_INT (alpha_next_sequence_number++);
7898 operands[5] = pic_offset_table_rtx;
7900 [(set_attr "type" "multi")])
7902 (define_insn "*call_value_osf_1"
7903 [(set (match_operand 0 "" "")
7904 (call (mem:DI (match_operand:DI 1 "call_operand" "c,R,s"))
7905 (match_operand 2 "" "")))
7907 (clobber (reg:DI 26))]
7908 "! TARGET_EXPLICIT_RELOCS && TARGET_ABI_OSF"
7910 jsr $26,($27),0\;ldgp $29,0($26)
7912 jsr $26,%1\;ldgp $29,0($26)"
7913 [(set_attr "type" "jsr")
7914 (set_attr "length" "12,*,16")])
7916 (define_insn "*sibcall_value_osf_1_er"
7917 [(set (match_operand 0 "" "")
7918 (call (mem:DI (match_operand:DI 1 "symbolic_operand" "R,s"))
7919 (match_operand 2 "" "")))
7920 (unspec [(reg:DI 29)] UNSPEC_SIBCALL)]
7921 "TARGET_EXPLICIT_RELOCS && TARGET_ABI_OSF"
7923 br $31,%1\t\t!samegp
7924 ldq $27,%1($29)\t\t!literal!%#\;jmp $31,($27),%1\t\t!lituse_jsr!%#"
7925 [(set_attr "type" "jsr")
7926 (set_attr "length" "*,8")])
7928 (define_insn "*sibcall_value_osf_1"
7929 [(set (match_operand 0 "" "")
7930 (call (mem:DI (match_operand:DI 1 "symbolic_operand" "R,s"))
7931 (match_operand 2 "" "")))
7932 (unspec [(reg:DI 29)] UNSPEC_SIBCALL)]
7933 "! TARGET_EXPLICIT_RELOCS && TARGET_ABI_OSF"
7936 lda $27,%1\;jmp $31,($27),%1"
7937 [(set_attr "type" "jsr")
7938 (set_attr "length" "*,8")])
7940 (define_insn "*call_value_nt_1"
7941 [(set (match_operand 0 "" "")
7942 (call (mem:DI (match_operand:DI 1 "call_operand" "r,R,s"))
7943 (match_operand 2 "" "")))
7944 (clobber (reg:DI 26))]
7945 "TARGET_ABI_WINDOWS_NT"
7950 [(set_attr "type" "jsr")
7951 (set_attr "length" "*,*,12")])
7953 ; GAS relies on the order and position of instructions output below in order
7954 ; to generate relocs for VMS link to potentially optimize the call.
7955 ; Please do not molest.
7956 (define_insn "*call_value_vms_1"
7957 [(set (match_operand 0 "" "")
7958 (call (mem:DI (match_operand:DI 1 "call_operand" "r,s"))
7959 (match_operand 2 "" "")))
7960 (use (match_operand:DI 3 "nonmemory_operand" "r,n"))
7963 (clobber (reg:DI 27))]
7964 "TARGET_ABI_OPEN_VMS"
7966 switch (which_alternative)
7969 return "mov %3,$27\;jsr $26,0\;ldq $27,0($29)";
7971 operands [3] = alpha_use_linkage (operands [1], cfun->decl, 1, 0);
7972 operands [4] = alpha_use_linkage (operands [1], cfun->decl, 0, 0);
7973 return "ldq $26,%4\;ldq $27,%3\;jsr $26,%1\;ldq $27,0($29)";
7978 [(set_attr "type" "jsr")
7979 (set_attr "length" "12,16")])
7981 (define_insn "*call_value_umk"
7982 [(set (match_operand 0 "" "")
7983 (call (mem:DI (match_operand:DI 1 "call_operand" "r"))
7984 (match_operand 2 "" "")))
7986 (clobber (reg:DI 26))]
7987 "TARGET_ABI_UNICOSMK"
7989 [(set_attr "type" "jsr")])