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
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 ;; Don't say we have addsi3 if optimizing. This generates better code. We
260 ;; have the anonymous addsi3 pattern below in case combine wants to make it.
261 (define_expand "addsi3"
262 [(set (match_operand:SI 0 "register_operand" "")
263 (plus:SI (match_operand:SI 1 "reg_or_0_operand" "")
264 (match_operand:SI 2 "add_operand" "")))]
268 (define_insn "*addsi_internal"
269 [(set (match_operand:SI 0 "register_operand" "=r,r,r,r")
270 (plus:SI (match_operand:SI 1 "reg_or_0_operand" "%rJ,rJ,rJ,rJ")
271 (match_operand:SI 2 "add_operand" "rI,O,K,L")))]
280 [(set (match_operand:SI 0 "register_operand" "")
281 (plus:SI (match_operand:SI 1 "register_operand" "")
282 (match_operand:SI 2 "const_int_operand" "")))]
283 "! add_operand (operands[2], SImode)"
284 [(set (match_dup 0) (plus:SI (match_dup 1) (match_dup 3)))
285 (set (match_dup 0) (plus:SI (match_dup 0) (match_dup 4)))]
287 HOST_WIDE_INT val = INTVAL (operands[2]);
288 HOST_WIDE_INT low = (val & 0xffff) - 2 * (val & 0x8000);
289 HOST_WIDE_INT rest = val - low;
291 operands[3] = GEN_INT (rest);
292 operands[4] = GEN_INT (low);
295 (define_insn "*addsi_se"
296 [(set (match_operand:DI 0 "register_operand" "=r,r")
298 (plus:SI (match_operand:SI 1 "reg_or_0_operand" "%rJ,rJ")
299 (match_operand:SI 2 "sext_add_operand" "rI,O"))))]
305 (define_insn "*addsi_se2"
306 [(set (match_operand:DI 0 "register_operand" "=r,r")
308 (subreg:SI (plus:DI (match_operand:DI 1 "reg_or_0_operand" "%rJ,rJ")
309 (match_operand:DI 2 "sext_add_operand" "rI,O"))
317 [(set (match_operand:DI 0 "register_operand" "")
319 (plus:SI (match_operand:SI 1 "reg_not_elim_operand" "")
320 (match_operand:SI 2 "const_int_operand" ""))))
321 (clobber (match_operand:SI 3 "reg_not_elim_operand" ""))]
322 "! sext_add_operand (operands[2], SImode) && INTVAL (operands[2]) > 0
323 && INTVAL (operands[2]) % 4 == 0"
324 [(set (match_dup 3) (match_dup 4))
325 (set (match_dup 0) (sign_extend:DI (plus:SI (mult:SI (match_dup 3)
329 HOST_WIDE_INT val = INTVAL (operands[2]) / 4;
335 operands[4] = GEN_INT (val);
336 operands[5] = GEN_INT (mult);
340 [(set (match_operand:DI 0 "register_operand" "")
342 (plus:SI (match_operator:SI 1 "comparison_operator"
343 [(match_operand 2 "" "")
344 (match_operand 3 "" "")])
345 (match_operand:SI 4 "add_operand" ""))))
346 (clobber (match_operand:DI 5 "register_operand" ""))]
348 [(set (match_dup 5) (match_dup 6))
349 (set (match_dup 0) (sign_extend:DI (plus:SI (match_dup 7) (match_dup 4))))]
351 operands[6] = gen_rtx_fmt_ee (GET_CODE (operands[1]), DImode,
352 operands[2], operands[3]);
353 operands[7] = gen_lowpart (SImode, operands[5]);
356 (define_insn "addvsi3"
357 [(set (match_operand:SI 0 "register_operand" "=r,r")
358 (plus:SI (match_operand:SI 1 "reg_or_0_operand" "%rJ,rJ")
359 (match_operand:SI 2 "sext_add_operand" "rI,O")))
360 (trap_if (ne (plus:DI (sign_extend:DI (match_dup 1))
361 (sign_extend:DI (match_dup 2)))
362 (sign_extend:DI (plus:SI (match_dup 1)
370 (define_expand "adddi3"
371 [(set (match_operand:DI 0 "register_operand" "")
372 (plus:DI (match_operand:DI 1 "register_operand" "")
373 (match_operand:DI 2 "add_operand" "")))]
377 (define_insn "*adddi_er_lo16_dtp"
378 [(set (match_operand:DI 0 "register_operand" "=r")
379 (lo_sum:DI (match_operand:DI 1 "register_operand" "r")
380 (match_operand:DI 2 "dtp16_symbolic_operand" "")))]
382 "lda %0,%2(%1)\t\t!dtprel")
384 (define_insn "*adddi_er_hi32_dtp"
385 [(set (match_operand:DI 0 "register_operand" "=r")
386 (plus:DI (match_operand:DI 1 "register_operand" "r")
387 (high:DI (match_operand:DI 2 "dtp32_symbolic_operand" ""))))]
389 "ldah %0,%2(%1)\t\t!dtprelhi")
391 (define_insn "*adddi_er_lo32_dtp"
392 [(set (match_operand:DI 0 "register_operand" "=r")
393 (lo_sum:DI (match_operand:DI 1 "register_operand" "r")
394 (match_operand:DI 2 "dtp32_symbolic_operand" "")))]
396 "lda %0,%2(%1)\t\t!dtprello")
398 (define_insn "*adddi_er_lo16_tp"
399 [(set (match_operand:DI 0 "register_operand" "=r")
400 (lo_sum:DI (match_operand:DI 1 "register_operand" "r")
401 (match_operand:DI 2 "tp16_symbolic_operand" "")))]
403 "lda %0,%2(%1)\t\t!tprel")
405 (define_insn "*adddi_er_hi32_tp"
406 [(set (match_operand:DI 0 "register_operand" "=r")
407 (plus:DI (match_operand:DI 1 "register_operand" "r")
408 (high:DI (match_operand:DI 2 "tp32_symbolic_operand" ""))))]
410 "ldah %0,%2(%1)\t\t!tprelhi")
412 (define_insn "*adddi_er_lo32_tp"
413 [(set (match_operand:DI 0 "register_operand" "=r")
414 (lo_sum:DI (match_operand:DI 1 "register_operand" "r")
415 (match_operand:DI 2 "tp32_symbolic_operand" "")))]
417 "lda %0,%2(%1)\t\t!tprello")
419 (define_insn "*adddi_er_high_l"
420 [(set (match_operand:DI 0 "register_operand" "=r")
421 (plus:DI (match_operand:DI 1 "register_operand" "r")
422 (high:DI (match_operand:DI 2 "local_symbolic_operand" ""))))]
423 "TARGET_EXPLICIT_RELOCS && reload_completed"
424 "ldah %0,%2(%1)\t\t!gprelhigh"
425 [(set_attr "usegp" "yes")])
428 [(set (match_operand:DI 0 "register_operand" "")
429 (high:DI (match_operand:DI 1 "local_symbolic_operand" "")))]
430 "TARGET_EXPLICIT_RELOCS && reload_completed"
432 (plus:DI (match_dup 2) (high:DI (match_dup 1))))]
433 "operands[2] = pic_offset_table_rtx;")
435 ;; We used to expend quite a lot of effort choosing addq/subq/lda.
436 ;; With complications like
438 ;; The NT stack unwind code can't handle a subq to adjust the stack
439 ;; (that's a bug, but not one we can do anything about). As of NT4.0 SP3,
440 ;; the exception handling code will loop if a subq is used and an
443 ;; The 19980616 change to emit prologues as RTL also confused some
444 ;; versions of GDB, which also interprets prologues. This has been
445 ;; fixed as of GDB 4.18, but it does not harm to unconditionally
448 ;; and the fact that the three insns schedule exactly the same, it's
449 ;; just not worth the effort.
451 (define_insn "*adddi_internal"
452 [(set (match_operand:DI 0 "register_operand" "=r,r,r")
453 (plus:DI (match_operand:DI 1 "register_operand" "%r,r,r")
454 (match_operand:DI 2 "add_operand" "r,K,L")))]
461 ;; ??? Allow large constants when basing off the frame pointer or some
462 ;; virtual register that may eliminate to the frame pointer. This is
463 ;; done because register elimination offsets will change the hi/lo split,
464 ;; and if we split before reload, we will require additional instructions.
466 (define_insn "*adddi_fp_hack"
467 [(set (match_operand:DI 0 "register_operand" "=r,r,r")
468 (plus:DI (match_operand:DI 1 "reg_no_subreg_operand" "r,r,r")
469 (match_operand:DI 2 "const_int_operand" "K,L,n")))]
470 "NONSTRICT_REG_OK_FP_BASE_P (operands[1])
471 && INTVAL (operands[2]) >= 0
472 /* This is the largest constant an lda+ldah pair can add, minus
473 an upper bound on the displacement between SP and AP during
474 register elimination. See INITIAL_ELIMINATION_OFFSET. */
475 && INTVAL (operands[2])
477 - FIRST_PSEUDO_REGISTER * UNITS_PER_WORD
478 - ALPHA_ROUND(crtl->outgoing_args_size)
479 - (ALPHA_ROUND (get_frame_size ()
480 + max_reg_num () * UNITS_PER_WORD
481 + crtl->args.pretend_args_size)
482 - crtl->args.pretend_args_size))"
488 ;; Don't do this if we are adjusting SP since we don't want to do it
489 ;; in two steps. Don't split FP sources for the reason listed above.
491 [(set (match_operand:DI 0 "register_operand" "")
492 (plus:DI (match_operand:DI 1 "register_operand" "")
493 (match_operand:DI 2 "const_int_operand" "")))]
494 "! add_operand (operands[2], DImode)
495 && operands[0] != stack_pointer_rtx
496 && operands[1] != frame_pointer_rtx
497 && operands[1] != arg_pointer_rtx"
498 [(set (match_dup 0) (plus:DI (match_dup 1) (match_dup 3)))
499 (set (match_dup 0) (plus:DI (match_dup 0) (match_dup 4)))]
501 HOST_WIDE_INT val = INTVAL (operands[2]);
502 HOST_WIDE_INT low = (val & 0xffff) - 2 * (val & 0x8000);
503 HOST_WIDE_INT rest = val - low;
504 rtx rest_rtx = GEN_INT (rest);
506 operands[4] = GEN_INT (low);
507 if (satisfies_constraint_L (rest_rtx))
508 operands[3] = rest_rtx;
509 else if (can_create_pseudo_p ())
511 operands[3] = gen_reg_rtx (DImode);
512 emit_move_insn (operands[3], operands[2]);
513 emit_insn (gen_adddi3 (operands[0], operands[1], operands[3]));
520 (define_insn "*saddl"
521 [(set (match_operand:SI 0 "register_operand" "=r,r")
522 (plus:SI (mult:SI (match_operand:SI 1 "reg_not_elim_operand" "r,r")
523 (match_operand:SI 2 "const48_operand" "I,I"))
524 (match_operand:SI 3 "sext_add_operand" "rI,O")))]
530 (define_insn "*saddl_se"
531 [(set (match_operand:DI 0 "register_operand" "=r,r")
533 (plus:SI (mult:SI (match_operand:SI 1 "reg_not_elim_operand" "r,r")
534 (match_operand:SI 2 "const48_operand" "I,I"))
535 (match_operand:SI 3 "sext_add_operand" "rI,O"))))]
542 [(set (match_operand:DI 0 "register_operand" "")
544 (plus:SI (mult:SI (match_operator:SI 1 "comparison_operator"
545 [(match_operand 2 "" "")
546 (match_operand 3 "" "")])
547 (match_operand:SI 4 "const48_operand" ""))
548 (match_operand:SI 5 "sext_add_operand" ""))))
549 (clobber (match_operand:DI 6 "reg_not_elim_operand" ""))]
551 [(set (match_dup 6) (match_dup 7))
553 (sign_extend:DI (plus:SI (mult:SI (match_dup 8) (match_dup 4))
556 operands[7] = gen_rtx_fmt_ee (GET_CODE (operands[1]), DImode,
557 operands[2], operands[3]);
558 operands[8] = gen_lowpart (SImode, operands[6]);
561 (define_insn "*saddq"
562 [(set (match_operand:DI 0 "register_operand" "=r,r")
563 (plus:DI (mult:DI (match_operand:DI 1 "reg_not_elim_operand" "r,r")
564 (match_operand:DI 2 "const48_operand" "I,I"))
565 (match_operand:DI 3 "sext_add_operand" "rI,O")))]
571 (define_insn "addvdi3"
572 [(set (match_operand:DI 0 "register_operand" "=r,r")
573 (plus:DI (match_operand:DI 1 "reg_or_0_operand" "%rJ,rJ")
574 (match_operand:DI 2 "sext_add_operand" "rI,O")))
575 (trap_if (ne (plus:TI (sign_extend:TI (match_dup 1))
576 (sign_extend:TI (match_dup 2)))
577 (sign_extend:TI (plus:DI (match_dup 1)
585 (define_insn "negsi2"
586 [(set (match_operand:SI 0 "register_operand" "=r")
587 (neg:SI (match_operand:SI 1 "reg_or_8bit_operand" "rI")))]
591 (define_insn "*negsi_se"
592 [(set (match_operand:DI 0 "register_operand" "=r")
593 (sign_extend:DI (neg:SI
594 (match_operand:SI 1 "reg_or_8bit_operand" "rI"))))]
598 (define_insn "negvsi2"
599 [(set (match_operand:SI 0 "register_operand" "=r")
600 (neg:SI (match_operand:SI 1 "register_operand" "r")))
601 (trap_if (ne (neg:DI (sign_extend:DI (match_dup 1)))
602 (sign_extend:DI (neg:SI (match_dup 1))))
607 (define_insn "negdi2"
608 [(set (match_operand:DI 0 "register_operand" "=r")
609 (neg:DI (match_operand:DI 1 "reg_or_8bit_operand" "rI")))]
613 (define_insn "negvdi2"
614 [(set (match_operand:DI 0 "register_operand" "=r")
615 (neg:DI (match_operand:DI 1 "register_operand" "r")))
616 (trap_if (ne (neg:TI (sign_extend:TI (match_dup 1)))
617 (sign_extend:TI (neg:DI (match_dup 1))))
622 (define_expand "subsi3"
623 [(set (match_operand:SI 0 "register_operand" "")
624 (minus:SI (match_operand:SI 1 "reg_or_0_operand" "")
625 (match_operand:SI 2 "reg_or_8bit_operand" "")))]
629 (define_insn "*subsi_internal"
630 [(set (match_operand:SI 0 "register_operand" "=r")
631 (minus:SI (match_operand:SI 1 "reg_or_0_operand" "rJ")
632 (match_operand:SI 2 "reg_or_8bit_operand" "rI")))]
636 (define_insn "*subsi_se"
637 [(set (match_operand:DI 0 "register_operand" "=r")
638 (sign_extend:DI (minus:SI (match_operand:SI 1 "reg_or_0_operand" "rJ")
639 (match_operand:SI 2 "reg_or_8bit_operand" "rI"))))]
643 (define_insn "*subsi_se2"
644 [(set (match_operand:DI 0 "register_operand" "=r")
646 (subreg:SI (minus:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
647 (match_operand:DI 2 "reg_or_8bit_operand" "rI"))
652 (define_insn "subvsi3"
653 [(set (match_operand:SI 0 "register_operand" "=r")
654 (minus:SI (match_operand:SI 1 "reg_or_0_operand" "rJ")
655 (match_operand:SI 2 "reg_or_8bit_operand" "rI")))
656 (trap_if (ne (minus:DI (sign_extend:DI (match_dup 1))
657 (sign_extend:DI (match_dup 2)))
658 (sign_extend:DI (minus:SI (match_dup 1)
664 (define_insn "subdi3"
665 [(set (match_operand:DI 0 "register_operand" "=r")
666 (minus:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
667 (match_operand:DI 2 "reg_or_8bit_operand" "rI")))]
671 (define_insn "*ssubl"
672 [(set (match_operand:SI 0 "register_operand" "=r")
673 (minus:SI (mult:SI (match_operand:SI 1 "reg_not_elim_operand" "r")
674 (match_operand:SI 2 "const48_operand" "I"))
675 (match_operand:SI 3 "reg_or_8bit_operand" "rI")))]
679 (define_insn "*ssubl_se"
680 [(set (match_operand:DI 0 "register_operand" "=r")
682 (minus:SI (mult:SI (match_operand:SI 1 "reg_not_elim_operand" "r")
683 (match_operand:SI 2 "const48_operand" "I"))
684 (match_operand:SI 3 "reg_or_8bit_operand" "rI"))))]
688 (define_insn "*ssubq"
689 [(set (match_operand:DI 0 "register_operand" "=r")
690 (minus:DI (mult:DI (match_operand:DI 1 "reg_not_elim_operand" "r")
691 (match_operand:DI 2 "const48_operand" "I"))
692 (match_operand:DI 3 "reg_or_8bit_operand" "rI")))]
696 (define_insn "subvdi3"
697 [(set (match_operand:DI 0 "register_operand" "=r")
698 (minus:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
699 (match_operand:DI 2 "reg_or_8bit_operand" "rI")))
700 (trap_if (ne (minus:TI (sign_extend:TI (match_dup 1))
701 (sign_extend:TI (match_dup 2)))
702 (sign_extend:TI (minus:DI (match_dup 1)
708 ;; The Unicos/Mk assembler doesn't support mull.
710 (define_insn "mulsi3"
711 [(set (match_operand:SI 0 "register_operand" "=r")
712 (mult:SI (match_operand:SI 1 "reg_or_0_operand" "%rJ")
713 (match_operand:SI 2 "reg_or_8bit_operand" "rI")))]
714 "!TARGET_ABI_UNICOSMK"
716 [(set_attr "type" "imul")
717 (set_attr "opsize" "si")])
719 (define_insn "*mulsi_se"
720 [(set (match_operand:DI 0 "register_operand" "=r")
722 (mult:SI (match_operand:SI 1 "reg_or_0_operand" "%rJ")
723 (match_operand:SI 2 "reg_or_8bit_operand" "rI"))))]
724 "!TARGET_ABI_UNICOSMK"
726 [(set_attr "type" "imul")
727 (set_attr "opsize" "si")])
729 (define_insn "mulvsi3"
730 [(set (match_operand:SI 0 "register_operand" "=r")
731 (mult:SI (match_operand:SI 1 "reg_or_0_operand" "%rJ")
732 (match_operand:SI 2 "reg_or_8bit_operand" "rI")))
733 (trap_if (ne (mult:DI (sign_extend:DI (match_dup 1))
734 (sign_extend:DI (match_dup 2)))
735 (sign_extend:DI (mult:SI (match_dup 1)
738 "!TARGET_ABI_UNICOSMK"
740 [(set_attr "type" "imul")
741 (set_attr "opsize" "si")])
743 (define_insn "muldi3"
744 [(set (match_operand:DI 0 "register_operand" "=r")
745 (mult:DI (match_operand:DI 1 "reg_or_0_operand" "%rJ")
746 (match_operand:DI 2 "reg_or_8bit_operand" "rI")))]
749 [(set_attr "type" "imul")])
751 (define_insn "mulvdi3"
752 [(set (match_operand:DI 0 "register_operand" "=r")
753 (mult:DI (match_operand:DI 1 "reg_or_0_operand" "%rJ")
754 (match_operand:DI 2 "reg_or_8bit_operand" "rI")))
755 (trap_if (ne (mult:TI (sign_extend:TI (match_dup 1))
756 (sign_extend:TI (match_dup 2)))
757 (sign_extend:TI (mult:DI (match_dup 1)
762 [(set_attr "type" "imul")])
764 (define_expand "umuldi3_highpart"
765 [(set (match_operand:DI 0 "register_operand" "")
768 (mult:TI (zero_extend:TI
769 (match_operand:DI 1 "register_operand" ""))
770 (match_operand:DI 2 "reg_or_8bit_operand" ""))
774 if (REG_P (operands[2]))
775 operands[2] = gen_rtx_ZERO_EXTEND (TImode, operands[2]);
778 (define_insn "*umuldi3_highpart_reg"
779 [(set (match_operand:DI 0 "register_operand" "=r")
782 (mult:TI (zero_extend:TI
783 (match_operand:DI 1 "register_operand" "r"))
785 (match_operand:DI 2 "register_operand" "r")))
789 [(set_attr "type" "imul")
790 (set_attr "opsize" "udi")])
792 (define_insn "*umuldi3_highpart_const"
793 [(set (match_operand:DI 0 "register_operand" "=r")
796 (mult:TI (zero_extend:TI (match_operand:DI 1 "register_operand" "r"))
797 (match_operand:TI 2 "cint8_operand" "I"))
801 [(set_attr "type" "imul")
802 (set_attr "opsize" "udi")])
804 ;; The divide and remainder operations take their inputs from r24 and
805 ;; r25, put their output in r27, and clobber r23 and r28 on all
806 ;; systems except Unicos/Mk. On Unicos, the standard library provides
807 ;; subroutines which use the standard calling convention and work on
810 ;; ??? Force sign-extension here because some versions of OSF/1 and
811 ;; Interix/NT don't do the right thing if the inputs are not properly
812 ;; sign-extended. But Linux, for instance, does not have this
813 ;; problem. Is it worth the complication here to eliminate the sign
816 (define_expand "divsi3"
818 (sign_extend:DI (match_operand:SI 1 "nonimmediate_operand" "")))
820 (sign_extend:DI (match_operand:SI 2 "nonimmediate_operand" "")))
821 (parallel [(set (match_dup 5)
822 (sign_extend:DI (div:SI (match_dup 3) (match_dup 4))))
823 (clobber (reg:DI 23))
824 (clobber (reg:DI 28))])
825 (set (match_operand:SI 0 "nonimmediate_operand" "")
826 (subreg:SI (match_dup 5) 0))]
827 "! TARGET_ABI_OPEN_VMS && ! TARGET_ABI_UNICOSMK"
829 operands[3] = gen_reg_rtx (DImode);
830 operands[4] = gen_reg_rtx (DImode);
831 operands[5] = gen_reg_rtx (DImode);
834 (define_expand "udivsi3"
836 (sign_extend:DI (match_operand:SI 1 "nonimmediate_operand" "")))
838 (sign_extend:DI (match_operand:SI 2 "nonimmediate_operand" "")))
839 (parallel [(set (match_dup 5)
840 (sign_extend:DI (udiv:SI (match_dup 3) (match_dup 4))))
841 (clobber (reg:DI 23))
842 (clobber (reg:DI 28))])
843 (set (match_operand:SI 0 "nonimmediate_operand" "")
844 (subreg:SI (match_dup 5) 0))]
845 "! TARGET_ABI_OPEN_VMS && ! TARGET_ABI_UNICOSMK"
847 operands[3] = gen_reg_rtx (DImode);
848 operands[4] = gen_reg_rtx (DImode);
849 operands[5] = gen_reg_rtx (DImode);
852 (define_expand "modsi3"
854 (sign_extend:DI (match_operand:SI 1 "nonimmediate_operand" "")))
856 (sign_extend:DI (match_operand:SI 2 "nonimmediate_operand" "")))
857 (parallel [(set (match_dup 5)
858 (sign_extend:DI (mod:SI (match_dup 3) (match_dup 4))))
859 (clobber (reg:DI 23))
860 (clobber (reg:DI 28))])
861 (set (match_operand:SI 0 "nonimmediate_operand" "")
862 (subreg:SI (match_dup 5) 0))]
863 "! TARGET_ABI_OPEN_VMS && ! TARGET_ABI_UNICOSMK"
865 operands[3] = gen_reg_rtx (DImode);
866 operands[4] = gen_reg_rtx (DImode);
867 operands[5] = gen_reg_rtx (DImode);
870 (define_expand "umodsi3"
872 (sign_extend:DI (match_operand:SI 1 "nonimmediate_operand" "")))
874 (sign_extend:DI (match_operand:SI 2 "nonimmediate_operand" "")))
875 (parallel [(set (match_dup 5)
876 (sign_extend:DI (umod:SI (match_dup 3) (match_dup 4))))
877 (clobber (reg:DI 23))
878 (clobber (reg:DI 28))])
879 (set (match_operand:SI 0 "nonimmediate_operand" "")
880 (subreg:SI (match_dup 5) 0))]
881 "! TARGET_ABI_OPEN_VMS && ! TARGET_ABI_UNICOSMK"
883 operands[3] = gen_reg_rtx (DImode);
884 operands[4] = gen_reg_rtx (DImode);
885 operands[5] = gen_reg_rtx (DImode);
888 (define_expand "divdi3"
889 [(parallel [(set (match_operand:DI 0 "register_operand" "")
890 (div:DI (match_operand:DI 1 "register_operand" "")
891 (match_operand:DI 2 "register_operand" "")))
892 (clobber (reg:DI 23))
893 (clobber (reg:DI 28))])]
894 "! TARGET_ABI_OPEN_VMS && ! TARGET_ABI_UNICOSMK"
897 (define_expand "udivdi3"
898 [(parallel [(set (match_operand:DI 0 "register_operand" "")
899 (udiv:DI (match_operand:DI 1 "register_operand" "")
900 (match_operand:DI 2 "register_operand" "")))
901 (clobber (reg:DI 23))
902 (clobber (reg:DI 28))])]
903 "! TARGET_ABI_OPEN_VMS && ! TARGET_ABI_UNICOSMK"
906 (define_expand "moddi3"
907 [(use (match_operand:DI 0 "register_operand" ""))
908 (use (match_operand:DI 1 "register_operand" ""))
909 (use (match_operand:DI 2 "register_operand" ""))]
910 "!TARGET_ABI_OPEN_VMS"
912 if (TARGET_ABI_UNICOSMK)
913 emit_insn (gen_moddi3_umk (operands[0], operands[1], operands[2]));
915 emit_insn (gen_moddi3_dft (operands[0], operands[1], operands[2]));
919 (define_expand "moddi3_dft"
920 [(parallel [(set (match_operand:DI 0 "register_operand" "")
921 (mod:DI (match_operand:DI 1 "register_operand" "")
922 (match_operand:DI 2 "register_operand" "")))
923 (clobber (reg:DI 23))
924 (clobber (reg:DI 28))])]
925 "! TARGET_ABI_OPEN_VMS && ! TARGET_ABI_UNICOSMK"
928 ;; On Unicos/Mk, we do as the system's C compiler does:
929 ;; compute the quotient, multiply and subtract.
931 (define_expand "moddi3_umk"
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_UNICOSMK"
937 rtx div, mul = gen_reg_rtx (DImode);
939 div = expand_binop (DImode, sdiv_optab, operands[1], operands[2],
940 NULL_RTX, 0, OPTAB_LIB);
941 div = force_reg (DImode, div);
942 emit_insn (gen_muldi3 (mul, operands[2], div));
943 emit_insn (gen_subdi3 (operands[0], operands[1], mul));
947 (define_expand "umoddi3"
948 [(use (match_operand:DI 0 "register_operand" ""))
949 (use (match_operand:DI 1 "register_operand" ""))
950 (use (match_operand:DI 2 "register_operand" ""))]
951 "! TARGET_ABI_OPEN_VMS"
953 if (TARGET_ABI_UNICOSMK)
954 emit_insn (gen_umoddi3_umk (operands[0], operands[1], operands[2]));
956 emit_insn (gen_umoddi3_dft (operands[0], operands[1], operands[2]));
960 (define_expand "umoddi3_dft"
961 [(parallel [(set (match_operand:DI 0 "register_operand" "")
962 (umod:DI (match_operand:DI 1 "register_operand" "")
963 (match_operand:DI 2 "register_operand" "")))
964 (clobber (reg:DI 23))
965 (clobber (reg:DI 28))])]
966 "! TARGET_ABI_OPEN_VMS && ! TARGET_ABI_UNICOSMK"
969 (define_expand "umoddi3_umk"
970 [(use (match_operand:DI 0 "register_operand" ""))
971 (use (match_operand:DI 1 "register_operand" ""))
972 (use (match_operand:DI 2 "register_operand" ""))]
973 "TARGET_ABI_UNICOSMK"
975 rtx div, mul = gen_reg_rtx (DImode);
977 div = expand_binop (DImode, udiv_optab, operands[1], operands[2],
978 NULL_RTX, 1, OPTAB_LIB);
979 div = force_reg (DImode, div);
980 emit_insn (gen_muldi3 (mul, operands[2], div));
981 emit_insn (gen_subdi3 (operands[0], operands[1], mul));
985 ;; Lengths of 8 for ldq $t12,__divq($gp); jsr $t9,($t12),__divq as
986 ;; expanded by the assembler.
988 (define_insn_and_split "*divmodsi_internal_er"
989 [(set (match_operand:DI 0 "register_operand" "=c")
990 (sign_extend:DI (match_operator:SI 3 "divmod_operator"
991 [(match_operand:DI 1 "register_operand" "a")
992 (match_operand:DI 2 "register_operand" "b")])))
993 (clobber (reg:DI 23))
994 (clobber (reg:DI 28))]
995 "TARGET_EXPLICIT_RELOCS && ! TARGET_ABI_OPEN_VMS"
997 "&& reload_completed"
998 [(parallel [(set (match_dup 0)
999 (sign_extend:DI (match_dup 3)))
1002 (clobber (reg:DI 23))
1003 (clobber (reg:DI 28))])]
1006 switch (GET_CODE (operands[3]))
1023 operands[4] = GEN_INT (alpha_next_sequence_number++);
1024 emit_insn (gen_movdi_er_high_g (operands[0], pic_offset_table_rtx,
1025 gen_rtx_SYMBOL_REF (DImode, str),
1028 [(set_attr "type" "jsr")
1029 (set_attr "length" "8")])
1031 (define_insn "*divmodsi_internal_er_1"
1032 [(set (match_operand:DI 0 "register_operand" "=c")
1033 (sign_extend:DI (match_operator:SI 3 "divmod_operator"
1034 [(match_operand:DI 1 "register_operand" "a")
1035 (match_operand:DI 2 "register_operand" "b")])))
1036 (use (match_operand:DI 4 "register_operand" "c"))
1037 (use (match_operand 5 "const_int_operand" ""))
1038 (clobber (reg:DI 23))
1039 (clobber (reg:DI 28))]
1040 "TARGET_EXPLICIT_RELOCS && ! TARGET_ABI_OPEN_VMS"
1041 "jsr $23,($27),__%E3%j5"
1042 [(set_attr "type" "jsr")
1043 (set_attr "length" "4")])
1045 (define_insn "*divmodsi_internal"
1046 [(set (match_operand:DI 0 "register_operand" "=c")
1047 (sign_extend:DI (match_operator:SI 3 "divmod_operator"
1048 [(match_operand:DI 1 "register_operand" "a")
1049 (match_operand:DI 2 "register_operand" "b")])))
1050 (clobber (reg:DI 23))
1051 (clobber (reg:DI 28))]
1052 "! TARGET_ABI_OPEN_VMS && ! TARGET_ABI_UNICOSMK"
1054 [(set_attr "type" "jsr")
1055 (set_attr "length" "8")])
1057 (define_insn_and_split "*divmoddi_internal_er"
1058 [(set (match_operand:DI 0 "register_operand" "=c")
1059 (match_operator:DI 3 "divmod_operator"
1060 [(match_operand:DI 1 "register_operand" "a")
1061 (match_operand:DI 2 "register_operand" "b")]))
1062 (clobber (reg:DI 23))
1063 (clobber (reg:DI 28))]
1064 "TARGET_EXPLICIT_RELOCS && ! TARGET_ABI_OPEN_VMS"
1066 "&& reload_completed"
1067 [(parallel [(set (match_dup 0) (match_dup 3))
1070 (clobber (reg:DI 23))
1071 (clobber (reg:DI 28))])]
1074 switch (GET_CODE (operands[3]))
1091 operands[4] = GEN_INT (alpha_next_sequence_number++);
1092 emit_insn (gen_movdi_er_high_g (operands[0], pic_offset_table_rtx,
1093 gen_rtx_SYMBOL_REF (DImode, str),
1096 [(set_attr "type" "jsr")
1097 (set_attr "length" "8")])
1099 (define_insn "*divmoddi_internal_er_1"
1100 [(set (match_operand:DI 0 "register_operand" "=c")
1101 (match_operator:DI 3 "divmod_operator"
1102 [(match_operand:DI 1 "register_operand" "a")
1103 (match_operand:DI 2 "register_operand" "b")]))
1104 (use (match_operand:DI 4 "register_operand" "c"))
1105 (use (match_operand 5 "const_int_operand" ""))
1106 (clobber (reg:DI 23))
1107 (clobber (reg:DI 28))]
1108 "TARGET_EXPLICIT_RELOCS && ! TARGET_ABI_OPEN_VMS"
1109 "jsr $23,($27),__%E3%j5"
1110 [(set_attr "type" "jsr")
1111 (set_attr "length" "4")])
1113 (define_insn "*divmoddi_internal"
1114 [(set (match_operand:DI 0 "register_operand" "=c")
1115 (match_operator:DI 3 "divmod_operator"
1116 [(match_operand:DI 1 "register_operand" "a")
1117 (match_operand:DI 2 "register_operand" "b")]))
1118 (clobber (reg:DI 23))
1119 (clobber (reg:DI 28))]
1120 "! TARGET_ABI_OPEN_VMS && ! TARGET_ABI_UNICOSMK"
1122 [(set_attr "type" "jsr")
1123 (set_attr "length" "8")])
1125 ;; Next are the basic logical operations. We only expose the DImode operations
1126 ;; to the rtl expanders, but SImode versions exist for combine as well as for
1127 ;; the atomic operation splitters.
1129 (define_insn "*andsi_internal"
1130 [(set (match_operand:SI 0 "register_operand" "=r,r,r")
1131 (and:SI (match_operand:SI 1 "reg_or_0_operand" "%rJ,rJ,rJ")
1132 (match_operand:SI 2 "and_operand" "rI,N,MH")))]
1138 [(set_attr "type" "ilog,ilog,shift")])
1140 (define_insn "anddi3"
1141 [(set (match_operand:DI 0 "register_operand" "=r,r,r")
1142 (and:DI (match_operand:DI 1 "reg_or_0_operand" "%rJ,rJ,rJ")
1143 (match_operand:DI 2 "and_operand" "rI,N,MH")))]
1149 [(set_attr "type" "ilog,ilog,shift")])
1151 ;; There are times when we can split an AND into two AND insns. This occurs
1152 ;; when we can first clear any bytes and then clear anything else. For
1153 ;; example "I & 0xffff07" is "(I & 0xffffff) & 0xffffffffffffff07".
1154 ;; Only do this when running on 64-bit host since the computations are
1155 ;; too messy otherwise.
1158 [(set (match_operand:DI 0 "register_operand" "")
1159 (and:DI (match_operand:DI 1 "register_operand" "")
1160 (match_operand:DI 2 "const_int_operand" "")))]
1161 "HOST_BITS_PER_WIDE_INT == 64 && ! and_operand (operands[2], DImode)"
1162 [(set (match_dup 0) (and:DI (match_dup 1) (match_dup 3)))
1163 (set (match_dup 0) (and:DI (match_dup 0) (match_dup 4)))]
1165 unsigned HOST_WIDE_INT mask1 = INTVAL (operands[2]);
1166 unsigned HOST_WIDE_INT mask2 = mask1;
1169 /* For each byte that isn't all zeros, make it all ones. */
1170 for (i = 0; i < 64; i += 8)
1171 if ((mask1 & ((HOST_WIDE_INT) 0xff << i)) != 0)
1172 mask1 |= (HOST_WIDE_INT) 0xff << i;
1174 /* Now turn on any bits we've just turned off. */
1177 operands[3] = GEN_INT (mask1);
1178 operands[4] = GEN_INT (mask2);
1181 (define_expand "zero_extendqihi2"
1182 [(set (match_operand:HI 0 "register_operand" "")
1183 (zero_extend:HI (match_operand:QI 1 "nonimmediate_operand" "")))]
1187 operands[1] = force_reg (QImode, operands[1]);
1190 (define_insn "*zero_extendqihi2_bwx"
1191 [(set (match_operand:HI 0 "register_operand" "=r,r")
1192 (zero_extend:HI (match_operand:QI 1 "nonimmediate_operand" "r,m")))]
1197 [(set_attr "type" "ilog,ild")])
1199 (define_insn "*zero_extendqihi2_nobwx"
1200 [(set (match_operand:HI 0 "register_operand" "=r")
1201 (zero_extend:HI (match_operand:QI 1 "register_operand" "r")))]
1204 [(set_attr "type" "ilog")])
1206 (define_expand "zero_extendqisi2"
1207 [(set (match_operand:SI 0 "register_operand" "")
1208 (zero_extend:SI (match_operand:QI 1 "nonimmediate_operand" "")))]
1212 operands[1] = force_reg (QImode, operands[1]);
1215 (define_insn "*zero_extendqisi2_bwx"
1216 [(set (match_operand:SI 0 "register_operand" "=r,r")
1217 (zero_extend:SI (match_operand:QI 1 "nonimmediate_operand" "r,m")))]
1222 [(set_attr "type" "ilog,ild")])
1224 (define_insn "*zero_extendqisi2_nobwx"
1225 [(set (match_operand:SI 0 "register_operand" "=r")
1226 (zero_extend:SI (match_operand:QI 1 "register_operand" "r")))]
1229 [(set_attr "type" "ilog")])
1231 (define_expand "zero_extendqidi2"
1232 [(set (match_operand:DI 0 "register_operand" "")
1233 (zero_extend:DI (match_operand:QI 1 "nonimmediate_operand" "")))]
1237 operands[1] = force_reg (QImode, operands[1]);
1240 (define_insn "*zero_extendqidi2_bwx"
1241 [(set (match_operand:DI 0 "register_operand" "=r,r")
1242 (zero_extend:DI (match_operand:QI 1 "nonimmediate_operand" "r,m")))]
1247 [(set_attr "type" "ilog,ild")])
1249 (define_insn "*zero_extendqidi2_nobwx"
1250 [(set (match_operand:DI 0 "register_operand" "=r")
1251 (zero_extend:DI (match_operand:QI 1 "register_operand" "r")))]
1254 [(set_attr "type" "ilog")])
1256 (define_expand "zero_extendhisi2"
1257 [(set (match_operand:SI 0 "register_operand" "")
1258 (zero_extend:SI (match_operand:HI 1 "nonimmediate_operand" "")))]
1262 operands[1] = force_reg (HImode, operands[1]);
1265 (define_insn "*zero_extendhisi2_bwx"
1266 [(set (match_operand:SI 0 "register_operand" "=r,r")
1267 (zero_extend:SI (match_operand:HI 1 "nonimmediate_operand" "r,m")))]
1272 [(set_attr "type" "shift,ild")])
1274 (define_insn "*zero_extendhisi2_nobwx"
1275 [(set (match_operand:SI 0 "register_operand" "=r")
1276 (zero_extend:SI (match_operand:HI 1 "register_operand" "r")))]
1279 [(set_attr "type" "shift")])
1281 (define_expand "zero_extendhidi2"
1282 [(set (match_operand:DI 0 "register_operand" "")
1283 (zero_extend:DI (match_operand:HI 1 "nonimmediate_operand" "")))]
1287 operands[1] = force_reg (HImode, operands[1]);
1290 (define_insn "*zero_extendhidi2_bwx"
1291 [(set (match_operand:DI 0 "register_operand" "=r,r")
1292 (zero_extend:DI (match_operand:HI 1 "nonimmediate_operand" "r,m")))]
1297 [(set_attr "type" "shift,ild")])
1299 (define_insn "*zero_extendhidi2_nobwx"
1300 [(set (match_operand:DI 0 "register_operand" "=r")
1301 (zero_extend:DI (match_operand:HI 1 "register_operand" "r")))]
1304 [(set_attr "type" "shift")])
1306 (define_insn "zero_extendsidi2"
1307 [(set (match_operand:DI 0 "register_operand" "=r")
1308 (zero_extend:DI (match_operand:SI 1 "register_operand" "r")))]
1311 [(set_attr "type" "shift")])
1313 (define_insn "*andnotsi3"
1314 [(set (match_operand:SI 0 "register_operand" "=r")
1315 (and:SI (not:SI (match_operand:SI 1 "reg_or_8bit_operand" "rI"))
1316 (match_operand:SI 2 "reg_or_0_operand" "rJ")))]
1319 [(set_attr "type" "ilog")])
1321 (define_insn "andnotdi3"
1322 [(set (match_operand:DI 0 "register_operand" "=r")
1323 (and:DI (not:DI (match_operand:DI 1 "reg_or_8bit_operand" "rI"))
1324 (match_operand:DI 2 "reg_or_0_operand" "rJ")))]
1327 [(set_attr "type" "ilog")])
1329 (define_insn "*iorsi_internal"
1330 [(set (match_operand:SI 0 "register_operand" "=r,r")
1331 (ior:SI (match_operand:SI 1 "reg_or_0_operand" "%rJ,rJ")
1332 (match_operand:SI 2 "or_operand" "rI,N")))]
1337 [(set_attr "type" "ilog")])
1339 (define_insn "iordi3"
1340 [(set (match_operand:DI 0 "register_operand" "=r,r")
1341 (ior:DI (match_operand:DI 1 "reg_or_0_operand" "%rJ,rJ")
1342 (match_operand:DI 2 "or_operand" "rI,N")))]
1347 [(set_attr "type" "ilog")])
1349 (define_insn "*one_cmplsi_internal"
1350 [(set (match_operand:SI 0 "register_operand" "=r")
1351 (not:SI (match_operand:SI 1 "reg_or_8bit_operand" "rI")))]
1354 [(set_attr "type" "ilog")])
1356 (define_insn "one_cmpldi2"
1357 [(set (match_operand:DI 0 "register_operand" "=r")
1358 (not:DI (match_operand:DI 1 "reg_or_8bit_operand" "rI")))]
1361 [(set_attr "type" "ilog")])
1363 (define_insn "*iornotsi3"
1364 [(set (match_operand:SI 0 "register_operand" "=r")
1365 (ior:SI (not:SI (match_operand:SI 1 "reg_or_8bit_operand" "rI"))
1366 (match_operand:SI 2 "reg_or_0_operand" "rJ")))]
1369 [(set_attr "type" "ilog")])
1371 (define_insn "*iornotdi3"
1372 [(set (match_operand:DI 0 "register_operand" "=r")
1373 (ior:DI (not:DI (match_operand:DI 1 "reg_or_8bit_operand" "rI"))
1374 (match_operand:DI 2 "reg_or_0_operand" "rJ")))]
1377 [(set_attr "type" "ilog")])
1379 (define_insn "*xorsi_internal"
1380 [(set (match_operand:SI 0 "register_operand" "=r,r")
1381 (xor:SI (match_operand:SI 1 "reg_or_0_operand" "%rJ,rJ")
1382 (match_operand:SI 2 "or_operand" "rI,N")))]
1387 [(set_attr "type" "ilog")])
1389 (define_insn "xordi3"
1390 [(set (match_operand:DI 0 "register_operand" "=r,r")
1391 (xor:DI (match_operand:DI 1 "reg_or_0_operand" "%rJ,rJ")
1392 (match_operand:DI 2 "or_operand" "rI,N")))]
1397 [(set_attr "type" "ilog")])
1399 (define_insn "*xornotsi3"
1400 [(set (match_operand:SI 0 "register_operand" "=r")
1401 (not:SI (xor:SI (match_operand:SI 1 "register_operand" "%rJ")
1402 (match_operand:SI 2 "register_operand" "rI"))))]
1405 [(set_attr "type" "ilog")])
1407 (define_insn "*xornotdi3"
1408 [(set (match_operand:DI 0 "register_operand" "=r")
1409 (not:DI (xor:DI (match_operand:DI 1 "register_operand" "%rJ")
1410 (match_operand:DI 2 "register_operand" "rI"))))]
1413 [(set_attr "type" "ilog")])
1415 ;; Handle FFS and related insns iff we support CIX.
1417 (define_expand "ffsdi2"
1419 (ctz:DI (match_operand:DI 1 "register_operand" "")))
1421 (plus:DI (match_dup 2) (const_int 1)))
1422 (set (match_operand:DI 0 "register_operand" "")
1423 (if_then_else:DI (eq (match_dup 1) (const_int 0))
1424 (const_int 0) (match_dup 3)))]
1427 operands[2] = gen_reg_rtx (DImode);
1428 operands[3] = gen_reg_rtx (DImode);
1431 (define_insn "clzdi2"
1432 [(set (match_operand:DI 0 "register_operand" "=r")
1433 (clz:DI (match_operand:DI 1 "register_operand" "r")))]
1436 [(set_attr "type" "mvi")])
1438 (define_insn "ctzdi2"
1439 [(set (match_operand:DI 0 "register_operand" "=r")
1440 (ctz:DI (match_operand:DI 1 "register_operand" "r")))]
1443 [(set_attr "type" "mvi")])
1445 (define_insn "popcountdi2"
1446 [(set (match_operand:DI 0 "register_operand" "=r")
1447 (popcount:DI (match_operand:DI 1 "register_operand" "r")))]
1450 [(set_attr "type" "mvi")])
1452 (define_expand "bswapsi2"
1453 [(set (match_operand:SI 0 "register_operand" "")
1454 (bswap:SI (match_operand:SI 1 "register_operand" "")))]
1459 t0 = gen_reg_rtx (DImode);
1460 t1 = gen_reg_rtx (DImode);
1462 emit_insn (gen_insxh (t0, gen_lowpart (DImode, operands[1]),
1463 GEN_INT (32), GEN_INT (WORDS_BIG_ENDIAN ? 0 : 7)));
1464 emit_insn (gen_inswl_const (t1, gen_lowpart (HImode, operands[1]),
1466 emit_insn (gen_iordi3 (t1, t0, t1));
1467 emit_insn (gen_lshrdi3 (t0, t1, GEN_INT (16)));
1468 emit_insn (gen_anddi3 (t1, t1, alpha_expand_zap_mask (0x5)));
1469 emit_insn (gen_anddi3 (t0, t0, alpha_expand_zap_mask (0xa)));
1470 emit_insn (gen_addsi3 (operands[0], gen_lowpart (SImode, t0),
1471 gen_lowpart (SImode, t1)));
1475 (define_expand "bswapdi2"
1476 [(set (match_operand:DI 0 "register_operand" "")
1477 (bswap:DI (match_operand:DI 1 "register_operand" "")))]
1482 t0 = gen_reg_rtx (DImode);
1483 t1 = gen_reg_rtx (DImode);
1485 /* This method of shifting and masking is not specific to Alpha, but
1486 is only profitable on Alpha because of our handy byte zap insn. */
1488 emit_insn (gen_lshrdi3 (t0, operands[1], GEN_INT (32)));
1489 emit_insn (gen_ashldi3 (t1, operands[1], GEN_INT (32)));
1490 emit_insn (gen_iordi3 (t1, t0, t1));
1492 emit_insn (gen_lshrdi3 (t0, t1, GEN_INT (16)));
1493 emit_insn (gen_ashldi3 (t1, t1, GEN_INT (16)));
1494 emit_insn (gen_anddi3 (t0, t0, alpha_expand_zap_mask (0xcc)));
1495 emit_insn (gen_anddi3 (t1, t1, alpha_expand_zap_mask (0x33)));
1496 emit_insn (gen_iordi3 (t1, t0, t1));
1498 emit_insn (gen_lshrdi3 (t0, t1, GEN_INT (8)));
1499 emit_insn (gen_ashldi3 (t1, t1, GEN_INT (8)));
1500 emit_insn (gen_anddi3 (t0, t0, alpha_expand_zap_mask (0xaa)));
1501 emit_insn (gen_anddi3 (t1, t1, alpha_expand_zap_mask (0x55)));
1502 emit_insn (gen_iordi3 (operands[0], t0, t1));
1506 ;; Next come the shifts and the various extract and insert operations.
1508 (define_insn "ashldi3"
1509 [(set (match_operand:DI 0 "register_operand" "=r,r")
1510 (ashift:DI (match_operand:DI 1 "reg_or_0_operand" "rJ,rJ")
1511 (match_operand:DI 2 "reg_or_6bit_operand" "P,rS")))]
1514 switch (which_alternative)
1517 if (operands[2] == const1_rtx)
1518 return "addq %r1,%r1,%0";
1520 return "s%P2addq %r1,0,%0";
1522 return "sll %r1,%2,%0";
1527 [(set_attr "type" "iadd,shift")])
1529 (define_insn "*ashldi_se"
1530 [(set (match_operand:DI 0 "register_operand" "=r")
1532 (subreg:SI (ashift:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
1533 (match_operand:DI 2 "const_int_operand" "P"))
1535 "INTVAL (operands[2]) >= 1 && INTVAL (operands[2]) <= 3"
1537 if (operands[2] == const1_rtx)
1538 return "addl %r1,%r1,%0";
1540 return "s%P2addl %r1,0,%0";
1542 [(set_attr "type" "iadd")])
1544 (define_insn "lshrdi3"
1545 [(set (match_operand:DI 0 "register_operand" "=r")
1546 (lshiftrt:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
1547 (match_operand:DI 2 "reg_or_6bit_operand" "rS")))]
1550 [(set_attr "type" "shift")])
1552 (define_insn "ashrdi3"
1553 [(set (match_operand:DI 0 "register_operand" "=r")
1554 (ashiftrt:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
1555 (match_operand:DI 2 "reg_or_6bit_operand" "rS")))]
1558 [(set_attr "type" "shift")])
1560 (define_expand "extendqihi2"
1562 (ashift:DI (match_operand:QI 1 "some_operand" "")
1564 (set (match_operand:HI 0 "register_operand" "")
1565 (ashiftrt:DI (match_dup 2)
1571 emit_insn (gen_extendqihi2x (operands[0],
1572 force_reg (QImode, operands[1])));
1576 /* If we have an unaligned MEM, extend to DImode (which we do
1577 specially) and then copy to the result. */
1578 if (unaligned_memory_operand (operands[1], HImode))
1580 rtx temp = gen_reg_rtx (DImode);
1582 emit_insn (gen_extendqidi2 (temp, operands[1]));
1583 emit_move_insn (operands[0], gen_lowpart (HImode, temp));
1587 operands[0] = gen_lowpart (DImode, operands[0]);
1588 operands[1] = gen_lowpart (DImode, force_reg (QImode, operands[1]));
1589 operands[2] = gen_reg_rtx (DImode);
1592 (define_insn "extendqidi2x"
1593 [(set (match_operand:DI 0 "register_operand" "=r")
1594 (sign_extend:DI (match_operand:QI 1 "register_operand" "r")))]
1597 [(set_attr "type" "shift")])
1599 (define_insn "extendhidi2x"
1600 [(set (match_operand:DI 0 "register_operand" "=r")
1601 (sign_extend:DI (match_operand:HI 1 "register_operand" "r")))]
1604 [(set_attr "type" "shift")])
1606 (define_insn "extendqisi2x"
1607 [(set (match_operand:SI 0 "register_operand" "=r")
1608 (sign_extend:SI (match_operand:QI 1 "register_operand" "r")))]
1611 [(set_attr "type" "shift")])
1613 (define_insn "extendhisi2x"
1614 [(set (match_operand:SI 0 "register_operand" "=r")
1615 (sign_extend:SI (match_operand:HI 1 "register_operand" "r")))]
1618 [(set_attr "type" "shift")])
1620 (define_insn "extendqihi2x"
1621 [(set (match_operand:HI 0 "register_operand" "=r")
1622 (sign_extend:HI (match_operand:QI 1 "register_operand" "r")))]
1625 [(set_attr "type" "shift")])
1627 (define_expand "extendqisi2"
1629 (ashift:DI (match_operand:QI 1 "some_operand" "")
1631 (set (match_operand:SI 0 "register_operand" "")
1632 (ashiftrt:DI (match_dup 2)
1638 emit_insn (gen_extendqisi2x (operands[0],
1639 force_reg (QImode, operands[1])));
1643 /* If we have an unaligned MEM, extend to a DImode form of
1644 the result (which we do specially). */
1645 if (unaligned_memory_operand (operands[1], QImode))
1647 rtx temp = gen_reg_rtx (DImode);
1649 emit_insn (gen_extendqidi2 (temp, operands[1]));
1650 emit_move_insn (operands[0], gen_lowpart (SImode, temp));
1654 operands[0] = gen_lowpart (DImode, operands[0]);
1655 operands[1] = gen_lowpart (DImode, force_reg (QImode, operands[1]));
1656 operands[2] = gen_reg_rtx (DImode);
1659 (define_expand "extendqidi2"
1661 (ashift:DI (match_operand:QI 1 "some_operand" "")
1663 (set (match_operand:DI 0 "register_operand" "")
1664 (ashiftrt:DI (match_dup 2)
1670 emit_insn (gen_extendqidi2x (operands[0],
1671 force_reg (QImode, operands[1])));
1675 if (unaligned_memory_operand (operands[1], QImode))
1677 rtx seq = gen_unaligned_extendqidi (operands[0], XEXP (operands[1], 0));
1678 alpha_set_memflags (seq, operands[1]);
1683 operands[1] = gen_lowpart (DImode, force_reg (QImode, operands[1]));
1684 operands[2] = gen_reg_rtx (DImode);
1687 (define_expand "extendhisi2"
1689 (ashift:DI (match_operand:HI 1 "some_operand" "")
1691 (set (match_operand:SI 0 "register_operand" "")
1692 (ashiftrt:DI (match_dup 2)
1698 emit_insn (gen_extendhisi2x (operands[0],
1699 force_reg (HImode, operands[1])));
1703 /* If we have an unaligned MEM, extend to a DImode form of
1704 the result (which we do specially). */
1705 if (unaligned_memory_operand (operands[1], HImode))
1707 rtx temp = gen_reg_rtx (DImode);
1709 emit_insn (gen_extendhidi2 (temp, operands[1]));
1710 emit_move_insn (operands[0], gen_lowpart (SImode, temp));
1714 operands[0] = gen_lowpart (DImode, operands[0]);
1715 operands[1] = gen_lowpart (DImode, force_reg (HImode, operands[1]));
1716 operands[2] = gen_reg_rtx (DImode);
1719 (define_expand "extendhidi2"
1721 (ashift:DI (match_operand:HI 1 "some_operand" "")
1723 (set (match_operand:DI 0 "register_operand" "")
1724 (ashiftrt:DI (match_dup 2)
1730 emit_insn (gen_extendhidi2x (operands[0],
1731 force_reg (HImode, operands[1])));
1735 if (unaligned_memory_operand (operands[1], HImode))
1737 rtx seq = gen_unaligned_extendhidi (operands[0], XEXP (operands[1], 0));
1739 alpha_set_memflags (seq, operands[1]);
1744 operands[1] = gen_lowpart (DImode, force_reg (HImode, operands[1]));
1745 operands[2] = gen_reg_rtx (DImode);
1748 ;; Here's how we sign extend an unaligned byte and halfword. Doing this
1749 ;; as a pattern saves one instruction. The code is similar to that for
1750 ;; the unaligned loads (see below).
1752 ;; Operand 1 is the address, operand 0 is the result.
1753 (define_expand "unaligned_extendqidi"
1754 [(use (match_operand:QI 0 "register_operand" ""))
1755 (use (match_operand:DI 1 "address_operand" ""))]
1758 operands[0] = gen_lowpart (DImode, operands[0]);
1759 if (WORDS_BIG_ENDIAN)
1760 emit_insn (gen_unaligned_extendqidi_be (operands[0], operands[1]));
1762 emit_insn (gen_unaligned_extendqidi_le (operands[0], operands[1]));
1766 (define_expand "unaligned_extendqidi_le"
1768 (mem:DI (and:DI (match_operand:DI 1 "" "") (const_int -8))))
1770 (ashift:DI (match_dup 3)
1771 (minus:DI (const_int 64)
1773 (and:DI (match_dup 2) (const_int 7))
1775 (set (match_operand:DI 0 "register_operand" "")
1776 (ashiftrt:DI (match_dup 4) (const_int 56)))]
1777 "! WORDS_BIG_ENDIAN"
1779 operands[2] = get_unaligned_offset (operands[1], 1);
1780 operands[3] = gen_reg_rtx (DImode);
1781 operands[4] = gen_reg_rtx (DImode);
1784 (define_expand "unaligned_extendqidi_be"
1786 (mem:DI (and:DI (match_operand:DI 1 "" "") (const_int -8))))
1788 (ashift:DI (match_dup 3)
1791 (plus:DI (match_dup 2) (const_int 1))
1794 (set (match_operand:DI 0 "register_operand" "")
1795 (ashiftrt:DI (match_dup 4) (const_int 56)))]
1798 operands[2] = get_unaligned_offset (operands[1], -1);
1799 operands[3] = gen_reg_rtx (DImode);
1800 operands[4] = gen_reg_rtx (DImode);
1803 (define_expand "unaligned_extendhidi"
1804 [(use (match_operand:QI 0 "register_operand" ""))
1805 (use (match_operand:DI 1 "address_operand" ""))]
1808 operands[0] = gen_lowpart (DImode, operands[0]);
1809 if (WORDS_BIG_ENDIAN)
1810 emit_insn (gen_unaligned_extendhidi_be (operands[0], operands[1]));
1812 emit_insn (gen_unaligned_extendhidi_le (operands[0], operands[1]));
1816 (define_expand "unaligned_extendhidi_le"
1818 (mem:DI (and:DI (match_operand:DI 1 "" "") (const_int -8))))
1820 (ashift:DI (match_dup 3)
1821 (minus:DI (const_int 64)
1823 (and:DI (match_dup 2) (const_int 7))
1825 (set (match_operand:DI 0 "register_operand" "")
1826 (ashiftrt:DI (match_dup 4) (const_int 48)))]
1827 "! WORDS_BIG_ENDIAN"
1829 operands[2] = get_unaligned_offset (operands[1], 2);
1830 operands[3] = gen_reg_rtx (DImode);
1831 operands[4] = gen_reg_rtx (DImode);
1834 (define_expand "unaligned_extendhidi_be"
1836 (mem:DI (and:DI (match_operand:DI 1 "" "") (const_int -8))))
1838 (ashift:DI (match_dup 3)
1841 (plus:DI (match_dup 2) (const_int 1))
1844 (set (match_operand:DI 0 "register_operand" "")
1845 (ashiftrt:DI (match_dup 4) (const_int 48)))]
1848 operands[2] = get_unaligned_offset (operands[1], -1);
1849 operands[3] = gen_reg_rtx (DImode);
1850 operands[4] = gen_reg_rtx (DImode);
1853 (define_insn "*extxl_const"
1854 [(set (match_operand:DI 0 "register_operand" "=r")
1855 (zero_extract:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
1856 (match_operand:DI 2 "mode_width_operand" "n")
1857 (match_operand:DI 3 "mul8_operand" "I")))]
1859 "ext%M2l %r1,%s3,%0"
1860 [(set_attr "type" "shift")])
1862 (define_insn "extxl_le"
1863 [(set (match_operand:DI 0 "register_operand" "=r")
1864 (zero_extract:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
1865 (match_operand:DI 2 "mode_width_operand" "n")
1866 (ashift:DI (match_operand:DI 3 "reg_or_8bit_operand" "rI")
1868 "! WORDS_BIG_ENDIAN"
1870 [(set_attr "type" "shift")])
1872 (define_insn "extxl_be"
1873 [(set (match_operand:DI 0 "register_operand" "=r")
1874 (zero_extract:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
1875 (match_operand:DI 2 "mode_width_operand" "n")
1879 (match_operand:DI 3 "reg_or_8bit_operand" "rI")
1883 [(set_attr "type" "shift")])
1885 ;; Combine has some strange notion of preserving existing undefined behavior
1886 ;; in shifts larger than a word size. So capture these patterns that it
1887 ;; should have turned into zero_extracts.
1889 (define_insn "*extxl_1_le"
1890 [(set (match_operand:DI 0 "register_operand" "=r")
1891 (and:DI (lshiftrt:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
1892 (ashift:DI (match_operand:DI 2 "reg_or_8bit_operand" "rI")
1894 (match_operand:DI 3 "mode_mask_operand" "n")))]
1895 "! WORDS_BIG_ENDIAN"
1897 [(set_attr "type" "shift")])
1899 (define_insn "*extxl_1_be"
1900 [(set (match_operand:DI 0 "register_operand" "=r")
1901 (and:DI (lshiftrt:DI
1902 (match_operand:DI 1 "reg_or_0_operand" "rJ")
1903 (minus:DI (const_int 56)
1904 (ashift:DI (match_operand:DI 2 "reg_or_8bit_operand" "rI")
1906 (match_operand:DI 3 "mode_mask_operand" "n")))]
1909 [(set_attr "type" "shift")])
1911 (define_insn "*extql_2_le"
1912 [(set (match_operand:DI 0 "register_operand" "=r")
1913 (lshiftrt:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
1914 (ashift:DI (match_operand:DI 2 "reg_or_8bit_operand" "rI")
1916 "! WORDS_BIG_ENDIAN"
1918 [(set_attr "type" "shift")])
1920 (define_insn "*extql_2_be"
1921 [(set (match_operand:DI 0 "register_operand" "=r")
1923 (match_operand:DI 1 "reg_or_0_operand" "rJ")
1924 (minus:DI (const_int 56)
1926 (match_operand:DI 2 "reg_or_8bit_operand" "rI")
1930 [(set_attr "type" "shift")])
1932 (define_insn "extqh_le"
1933 [(set (match_operand:DI 0 "register_operand" "=r")
1935 (match_operand:DI 1 "reg_or_0_operand" "rJ")
1936 (minus:DI (const_int 64)
1939 (match_operand:DI 2 "reg_or_8bit_operand" "rI")
1942 "! WORDS_BIG_ENDIAN"
1944 [(set_attr "type" "shift")])
1946 (define_insn "extqh_be"
1947 [(set (match_operand:DI 0 "register_operand" "=r")
1949 (match_operand:DI 1 "reg_or_0_operand" "rJ")
1952 (plus:DI (match_operand:DI 2 "reg_or_8bit_operand" "rI")
1958 [(set_attr "type" "shift")])
1960 (define_insn "extlh_le"
1961 [(set (match_operand:DI 0 "register_operand" "=r")
1963 (and:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
1964 (const_int 2147483647))
1965 (minus:DI (const_int 64)
1968 (match_operand:DI 2 "reg_or_8bit_operand" "rI")
1971 "! WORDS_BIG_ENDIAN"
1973 [(set_attr "type" "shift")])
1975 (define_insn "extlh_be"
1976 [(set (match_operand:DI 0 "register_operand" "=r")
1979 (match_operand:DI 1 "reg_or_0_operand" "rJ")
1983 (match_operand:DI 2 "reg_or_8bit_operand" "rI")
1987 (const_int 2147483647)))]
1990 [(set_attr "type" "shift")])
1992 (define_insn "extwh_le"
1993 [(set (match_operand:DI 0 "register_operand" "=r")
1995 (and:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
1997 (minus:DI (const_int 64)
2000 (match_operand:DI 2 "reg_or_8bit_operand" "rI")
2003 "! WORDS_BIG_ENDIAN"
2005 [(set_attr "type" "shift")])
2007 (define_insn "extwh_be"
2008 [(set (match_operand:DI 0 "register_operand" "=r")
2010 (ashift:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
2014 (match_operand:DI 2 "reg_or_8bit_operand" "rI")
2018 (const_int 65535)))]
2021 [(set_attr "type" "shift")])
2023 ;; This converts an extXl into an extXh with an appropriate adjustment
2024 ;; to the address calculation.
2027 ;; [(set (match_operand:DI 0 "register_operand" "")
2028 ;; (ashift:DI (zero_extract:DI (match_operand:DI 1 "register_operand" "")
2029 ;; (match_operand:DI 2 "mode_width_operand" "")
2030 ;; (ashift:DI (match_operand:DI 3 "" "")
2032 ;; (match_operand:DI 4 "const_int_operand" "")))
2033 ;; (clobber (match_operand:DI 5 "register_operand" ""))]
2034 ;; "INTVAL (operands[4]) == 64 - INTVAL (operands[2])"
2035 ;; [(set (match_dup 5) (match_dup 6))
2036 ;; (set (match_dup 0)
2037 ;; (ashift:DI (zero_extract:DI (match_dup 1) (match_dup 2)
2038 ;; (ashift:DI (plus:DI (match_dup 5)
2044 ;; operands[6] = plus_constant (operands[3],
2045 ;; INTVAL (operands[2]) / BITS_PER_UNIT);
2046 ;; operands[7] = GEN_INT (- INTVAL (operands[2]) / BITS_PER_UNIT);
2049 (define_insn "*insbl_const"
2050 [(set (match_operand:DI 0 "register_operand" "=r")
2051 (ashift:DI (zero_extend:DI (match_operand:QI 1 "register_operand" "r"))
2052 (match_operand:DI 2 "mul8_operand" "I")))]
2055 [(set_attr "type" "shift")])
2057 (define_insn "inswl_const"
2058 [(set (match_operand:DI 0 "register_operand" "=r")
2059 (ashift:DI (zero_extend:DI (match_operand:HI 1 "register_operand" "r"))
2060 (match_operand:DI 2 "mul8_operand" "I")))]
2063 [(set_attr "type" "shift")])
2065 (define_insn "*insll_const"
2066 [(set (match_operand:DI 0 "register_operand" "=r")
2067 (ashift:DI (zero_extend:DI (match_operand:SI 1 "register_operand" "r"))
2068 (match_operand:DI 2 "mul8_operand" "I")))]
2071 [(set_attr "type" "shift")])
2073 (define_insn "insbl_le"
2074 [(set (match_operand:DI 0 "register_operand" "=r")
2075 (ashift:DI (zero_extend:DI (match_operand:QI 1 "register_operand" "r"))
2076 (ashift:DI (match_operand:DI 2 "reg_or_8bit_operand" "rI")
2078 "! WORDS_BIG_ENDIAN"
2080 [(set_attr "type" "shift")])
2082 (define_insn "insbl_be"
2083 [(set (match_operand:DI 0 "register_operand" "=r")
2084 (ashift:DI (zero_extend:DI (match_operand:QI 1 "register_operand" "r"))
2085 (minus:DI (const_int 56)
2086 (ashift:DI (match_operand:DI 2 "reg_or_8bit_operand" "rI")
2090 [(set_attr "type" "shift")])
2092 (define_insn "inswl_le"
2093 [(set (match_operand:DI 0 "register_operand" "=r")
2094 (ashift:DI (zero_extend:DI (match_operand:HI 1 "register_operand" "r"))
2095 (ashift:DI (match_operand:DI 2 "reg_or_8bit_operand" "rI")
2097 "! WORDS_BIG_ENDIAN"
2099 [(set_attr "type" "shift")])
2101 (define_insn "inswl_be"
2102 [(set (match_operand:DI 0 "register_operand" "=r")
2103 (ashift:DI (zero_extend:DI (match_operand:HI 1 "register_operand" "r"))
2104 (minus:DI (const_int 56)
2105 (ashift:DI (match_operand:DI 2 "reg_or_8bit_operand" "rI")
2109 [(set_attr "type" "shift")])
2111 (define_insn "insll_le"
2112 [(set (match_operand:DI 0 "register_operand" "=r")
2113 (ashift:DI (zero_extend:DI (match_operand:SI 1 "register_operand" "r"))
2114 (ashift:DI (match_operand:DI 2 "reg_or_8bit_operand" "rI")
2116 "! WORDS_BIG_ENDIAN"
2118 [(set_attr "type" "shift")])
2120 (define_insn "insll_be"
2121 [(set (match_operand:DI 0 "register_operand" "=r")
2122 (ashift:DI (zero_extend:DI (match_operand:SI 1 "register_operand" "r"))
2123 (minus:DI (const_int 56)
2124 (ashift:DI (match_operand:DI 2 "reg_or_8bit_operand" "rI")
2128 [(set_attr "type" "shift")])
2130 (define_insn "insql_le"
2131 [(set (match_operand:DI 0 "register_operand" "=r")
2132 (ashift:DI (match_operand:DI 1 "register_operand" "r")
2133 (ashift:DI (match_operand:DI 2 "reg_or_8bit_operand" "rI")
2135 "! WORDS_BIG_ENDIAN"
2137 [(set_attr "type" "shift")])
2139 (define_insn "insql_be"
2140 [(set (match_operand:DI 0 "register_operand" "=r")
2141 (ashift:DI (match_operand:DI 1 "register_operand" "r")
2142 (minus:DI (const_int 56)
2143 (ashift:DI (match_operand:DI 2 "reg_or_8bit_operand" "rI")
2147 [(set_attr "type" "shift")])
2149 ;; Combine has this sometimes habit of moving the and outside of the
2150 ;; shift, making life more interesting.
2152 (define_insn "*insxl"
2153 [(set (match_operand:DI 0 "register_operand" "=r")
2154 (and:DI (ashift:DI (match_operand:DI 1 "register_operand" "r")
2155 (match_operand:DI 2 "mul8_operand" "I"))
2156 (match_operand:DI 3 "immediate_operand" "i")))]
2157 "HOST_BITS_PER_WIDE_INT == 64
2158 && CONST_INT_P (operands[3])
2159 && (((unsigned HOST_WIDE_INT) 0xff << INTVAL (operands[2])
2160 == (unsigned HOST_WIDE_INT) INTVAL (operands[3]))
2161 || ((unsigned HOST_WIDE_INT) 0xffff << INTVAL (operands[2])
2162 == (unsigned HOST_WIDE_INT) INTVAL (operands[3]))
2163 || ((unsigned HOST_WIDE_INT) 0xffffffff << INTVAL (operands[2])
2164 == (unsigned HOST_WIDE_INT) INTVAL (operands[3])))"
2166 #if HOST_BITS_PER_WIDE_INT == 64
2167 if ((unsigned HOST_WIDE_INT) 0xff << INTVAL (operands[2])
2168 == (unsigned HOST_WIDE_INT) INTVAL (operands[3]))
2169 return "insbl %1,%s2,%0";
2170 if ((unsigned HOST_WIDE_INT) 0xffff << INTVAL (operands[2])
2171 == (unsigned HOST_WIDE_INT) INTVAL (operands[3]))
2172 return "inswl %1,%s2,%0";
2173 if ((unsigned HOST_WIDE_INT) 0xffffffff << INTVAL (operands[2])
2174 == (unsigned HOST_WIDE_INT) INTVAL (operands[3]))
2175 return "insll %1,%s2,%0";
2179 [(set_attr "type" "shift")])
2181 ;; We do not include the insXh insns because they are complex to express
2182 ;; and it does not appear that we would ever want to generate them.
2184 ;; Since we need them for block moves, though, cop out and use unspec.
2186 (define_insn "insxh"
2187 [(set (match_operand:DI 0 "register_operand" "=r")
2188 (unspec:DI [(match_operand:DI 1 "register_operand" "r")
2189 (match_operand:DI 2 "mode_width_operand" "n")
2190 (match_operand:DI 3 "reg_or_8bit_operand" "rI")]
2194 [(set_attr "type" "shift")])
2196 (define_insn "mskxl_le"
2197 [(set (match_operand:DI 0 "register_operand" "=r")
2198 (and:DI (not:DI (ashift:DI
2199 (match_operand:DI 2 "mode_mask_operand" "n")
2201 (match_operand:DI 3 "reg_or_8bit_operand" "rI")
2203 (match_operand:DI 1 "reg_or_0_operand" "rJ")))]
2204 "! WORDS_BIG_ENDIAN"
2206 [(set_attr "type" "shift")])
2208 (define_insn "mskxl_be"
2209 [(set (match_operand:DI 0 "register_operand" "=r")
2210 (and:DI (not:DI (ashift:DI
2211 (match_operand:DI 2 "mode_mask_operand" "n")
2212 (minus:DI (const_int 56)
2214 (match_operand:DI 3 "reg_or_8bit_operand" "rI")
2216 (match_operand:DI 1 "reg_or_0_operand" "rJ")))]
2219 [(set_attr "type" "shift")])
2221 ;; We do not include the mskXh insns because it does not appear we would
2222 ;; ever generate one.
2224 ;; Again, we do for block moves and we use unspec again.
2226 (define_insn "mskxh"
2227 [(set (match_operand:DI 0 "register_operand" "=r")
2228 (unspec:DI [(match_operand:DI 1 "register_operand" "r")
2229 (match_operand:DI 2 "mode_width_operand" "n")
2230 (match_operand:DI 3 "reg_or_8bit_operand" "rI")]
2234 [(set_attr "type" "shift")])
2236 ;; Prefer AND + NE over LSHIFTRT + AND.
2238 (define_insn_and_split "*ze_and_ne"
2239 [(set (match_operand:DI 0 "register_operand" "=r")
2240 (zero_extract:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
2242 (match_operand 2 "const_int_operand" "I")))]
2243 "(unsigned HOST_WIDE_INT) INTVAL (operands[2]) < 8"
2245 "(unsigned HOST_WIDE_INT) INTVAL (operands[2]) < 8"
2247 (and:DI (match_dup 1) (match_dup 3)))
2249 (ne:DI (match_dup 0) (const_int 0)))]
2250 "operands[3] = GEN_INT (1 << INTVAL (operands[2]));")
2252 ;; Floating-point operations. All the double-precision insns can extend
2253 ;; from single, so indicate that. The exception are the ones that simply
2254 ;; play with the sign bits; it's not clear what to do there.
2256 (define_insn "abssf2"
2257 [(set (match_operand:SF 0 "register_operand" "=f")
2258 (abs:SF (match_operand:SF 1 "reg_or_0_operand" "fG")))]
2261 [(set_attr "type" "fcpys")])
2263 (define_insn "*nabssf2"
2264 [(set (match_operand:SF 0 "register_operand" "=f")
2265 (neg:SF (abs:SF (match_operand:SF 1 "reg_or_0_operand" "fG"))))]
2268 [(set_attr "type" "fadd")])
2270 (define_insn "absdf2"
2271 [(set (match_operand:DF 0 "register_operand" "=f")
2272 (abs:DF (match_operand:DF 1 "reg_or_0_operand" "fG")))]
2275 [(set_attr "type" "fcpys")])
2277 (define_insn "*nabsdf2"
2278 [(set (match_operand:DF 0 "register_operand" "=f")
2279 (neg:DF (abs:DF (match_operand:DF 1 "reg_or_0_operand" "fG"))))]
2282 [(set_attr "type" "fadd")])
2284 (define_expand "abstf2"
2285 [(parallel [(set (match_operand:TF 0 "register_operand" "")
2286 (abs:TF (match_operand:TF 1 "reg_or_0_operand" "")))
2287 (use (match_dup 2))])]
2288 "TARGET_HAS_XFLOATING_LIBS"
2290 #if HOST_BITS_PER_WIDE_INT >= 64
2291 operands[2] = force_reg (DImode, GEN_INT ((HOST_WIDE_INT) 1 << 63));
2293 operands[2] = force_reg (DImode, immed_double_const (0, 0x80000000, DImode));
2297 (define_insn_and_split "*abstf_internal"
2298 [(set (match_operand:TF 0 "register_operand" "=r")
2299 (abs:TF (match_operand:TF 1 "reg_or_0_operand" "rG")))
2300 (use (match_operand:DI 2 "register_operand" "r"))]
2301 "TARGET_HAS_XFLOATING_LIBS"
2303 "&& reload_completed"
2305 "alpha_split_tfmode_frobsign (operands, gen_andnotdi3); DONE;")
2307 (define_insn "negsf2"
2308 [(set (match_operand:SF 0 "register_operand" "=f")
2309 (neg:SF (match_operand:SF 1 "reg_or_0_operand" "fG")))]
2312 [(set_attr "type" "fadd")])
2314 (define_insn "negdf2"
2315 [(set (match_operand:DF 0 "register_operand" "=f")
2316 (neg:DF (match_operand:DF 1 "reg_or_0_operand" "fG")))]
2319 [(set_attr "type" "fadd")])
2321 (define_expand "negtf2"
2322 [(parallel [(set (match_operand:TF 0 "register_operand" "")
2323 (neg:TF (match_operand:TF 1 "reg_or_0_operand" "")))
2324 (use (match_dup 2))])]
2325 "TARGET_HAS_XFLOATING_LIBS"
2327 #if HOST_BITS_PER_WIDE_INT >= 64
2328 operands[2] = force_reg (DImode, GEN_INT ((HOST_WIDE_INT) 1 << 63));
2330 operands[2] = force_reg (DImode, immed_double_const (0, 0x80000000, DImode));
2334 (define_insn_and_split "*negtf_internal"
2335 [(set (match_operand:TF 0 "register_operand" "=r")
2336 (neg:TF (match_operand:TF 1 "reg_or_0_operand" "rG")))
2337 (use (match_operand:DI 2 "register_operand" "r"))]
2338 "TARGET_HAS_XFLOATING_LIBS"
2340 "&& reload_completed"
2342 "alpha_split_tfmode_frobsign (operands, gen_xordi3); DONE;")
2344 (define_insn "copysignsf3"
2345 [(set (match_operand:SF 0 "register_operand" "=f")
2346 (unspec:SF [(match_operand:SF 1 "reg_or_0_operand" "fG")
2347 (match_operand:SF 2 "reg_or_0_operand" "fG")]
2351 [(set_attr "type" "fadd")])
2353 (define_insn "*ncopysignsf3"
2354 [(set (match_operand:SF 0 "register_operand" "=f")
2355 (neg:SF (unspec:SF [(match_operand:SF 1 "reg_or_0_operand" "fG")
2356 (match_operand:SF 2 "reg_or_0_operand" "fG")]
2360 [(set_attr "type" "fadd")])
2362 (define_insn "copysigndf3"
2363 [(set (match_operand:DF 0 "register_operand" "=f")
2364 (unspec:DF [(match_operand:DF 1 "reg_or_0_operand" "fG")
2365 (match_operand:DF 2 "reg_or_0_operand" "fG")]
2369 [(set_attr "type" "fadd")])
2371 (define_insn "*ncopysigndf3"
2372 [(set (match_operand:DF 0 "register_operand" "=f")
2373 (neg:DF (unspec:DF [(match_operand:DF 1 "reg_or_0_operand" "fG")
2374 (match_operand:DF 2 "reg_or_0_operand" "fG")]
2378 [(set_attr "type" "fadd")])
2380 (define_insn "*addsf_ieee"
2381 [(set (match_operand:SF 0 "register_operand" "=&f")
2382 (plus:SF (match_operand:SF 1 "reg_or_0_operand" "%fG")
2383 (match_operand:SF 2 "reg_or_0_operand" "fG")))]
2384 "TARGET_FP && alpha_fptm >= ALPHA_FPTM_SU"
2385 "add%,%/ %R1,%R2,%0"
2386 [(set_attr "type" "fadd")
2387 (set_attr "trap" "yes")
2388 (set_attr "round_suffix" "normal")
2389 (set_attr "trap_suffix" "u_su_sui")])
2391 (define_insn "addsf3"
2392 [(set (match_operand:SF 0 "register_operand" "=f")
2393 (plus:SF (match_operand:SF 1 "reg_or_0_operand" "%fG")
2394 (match_operand:SF 2 "reg_or_0_operand" "fG")))]
2396 "add%,%/ %R1,%R2,%0"
2397 [(set_attr "type" "fadd")
2398 (set_attr "trap" "yes")
2399 (set_attr "round_suffix" "normal")
2400 (set_attr "trap_suffix" "u_su_sui")])
2402 (define_insn "*adddf_ieee"
2403 [(set (match_operand:DF 0 "register_operand" "=&f")
2404 (plus:DF (match_operand:DF 1 "reg_or_0_operand" "%fG")
2405 (match_operand:DF 2 "reg_or_0_operand" "fG")))]
2406 "TARGET_FP && alpha_fptm >= ALPHA_FPTM_SU"
2407 "add%-%/ %R1,%R2,%0"
2408 [(set_attr "type" "fadd")
2409 (set_attr "trap" "yes")
2410 (set_attr "round_suffix" "normal")
2411 (set_attr "trap_suffix" "u_su_sui")])
2413 (define_insn "adddf3"
2414 [(set (match_operand:DF 0 "register_operand" "=f")
2415 (plus:DF (match_operand:DF 1 "reg_or_0_operand" "%fG")
2416 (match_operand:DF 2 "reg_or_0_operand" "fG")))]
2418 "add%-%/ %R1,%R2,%0"
2419 [(set_attr "type" "fadd")
2420 (set_attr "trap" "yes")
2421 (set_attr "round_suffix" "normal")
2422 (set_attr "trap_suffix" "u_su_sui")])
2424 (define_insn "*adddf_ext1"
2425 [(set (match_operand:DF 0 "register_operand" "=f")
2426 (plus:DF (float_extend:DF
2427 (match_operand:SF 1 "reg_or_0_operand" "fG"))
2428 (match_operand:DF 2 "reg_or_0_operand" "fG")))]
2429 "TARGET_FP && alpha_fptm < ALPHA_FPTM_SU"
2430 "add%-%/ %R1,%R2,%0"
2431 [(set_attr "type" "fadd")
2432 (set_attr "trap" "yes")
2433 (set_attr "round_suffix" "normal")
2434 (set_attr "trap_suffix" "u_su_sui")])
2436 (define_insn "*adddf_ext2"
2437 [(set (match_operand:DF 0 "register_operand" "=f")
2438 (plus:DF (float_extend:DF
2439 (match_operand:SF 1 "reg_or_0_operand" "%fG"))
2441 (match_operand:SF 2 "reg_or_0_operand" "fG"))))]
2442 "TARGET_FP && alpha_fptm < ALPHA_FPTM_SU"
2443 "add%-%/ %R1,%R2,%0"
2444 [(set_attr "type" "fadd")
2445 (set_attr "trap" "yes")
2446 (set_attr "round_suffix" "normal")
2447 (set_attr "trap_suffix" "u_su_sui")])
2449 (define_expand "addtf3"
2450 [(use (match_operand 0 "register_operand" ""))
2451 (use (match_operand 1 "general_operand" ""))
2452 (use (match_operand 2 "general_operand" ""))]
2453 "TARGET_HAS_XFLOATING_LIBS"
2454 "alpha_emit_xfloating_arith (PLUS, operands); DONE;")
2456 ;; Define conversion operators between DFmode and SImode, using the cvtql
2457 ;; instruction. To allow combine et al to do useful things, we keep the
2458 ;; operation as a unit until after reload, at which point we split the
2461 ;; Note that we (attempt to) only consider this optimization when the
2462 ;; ultimate destination is memory. If we will be doing further integer
2463 ;; processing, it is cheaper to do the truncation in the int regs.
2465 (define_insn "*cvtql"
2466 [(set (match_operand:SF 0 "register_operand" "=f")
2467 (unspec:SF [(match_operand:DI 1 "reg_or_0_operand" "fG")]
2471 [(set_attr "type" "fadd")
2472 (set_attr "trap" "yes")
2473 (set_attr "trap_suffix" "v_sv")])
2475 (define_insn_and_split "*fix_truncdfsi_ieee"
2476 [(set (match_operand:SI 0 "memory_operand" "=m")
2478 (match_operator:DI 4 "fix_operator"
2479 [(match_operand:DF 1 "reg_or_0_operand" "fG")]) 0))
2480 (clobber (match_scratch:DI 2 "=&f"))
2481 (clobber (match_scratch:SF 3 "=&f"))]
2482 "TARGET_FP && alpha_fptm >= ALPHA_FPTM_SU"
2484 "&& reload_completed"
2485 [(set (match_dup 2) (match_op_dup 4 [(match_dup 1)]))
2486 (set (match_dup 3) (unspec:SF [(match_dup 2)] UNSPEC_CVTQL))
2487 (set (match_dup 5) (match_dup 3))]
2489 operands[5] = adjust_address (operands[0], SFmode, 0);
2491 [(set_attr "type" "fadd")
2492 (set_attr "trap" "yes")])
2494 (define_insn_and_split "*fix_truncdfsi_internal"
2495 [(set (match_operand:SI 0 "memory_operand" "=m")
2497 (match_operator:DI 3 "fix_operator"
2498 [(match_operand:DF 1 "reg_or_0_operand" "fG")]) 0))
2499 (clobber (match_scratch:DI 2 "=f"))]
2500 "TARGET_FP && alpha_fptm < ALPHA_FPTM_SU"
2502 "&& reload_completed"
2503 [(set (match_dup 2) (match_op_dup 3 [(match_dup 1)]))
2504 (set (match_dup 4) (unspec:SF [(match_dup 2)] UNSPEC_CVTQL))
2505 (set (match_dup 5) (match_dup 4))]
2507 operands[4] = gen_rtx_REG (SFmode, REGNO (operands[2]));
2508 operands[5] = adjust_address (operands[0], SFmode, 0);
2510 [(set_attr "type" "fadd")
2511 (set_attr "trap" "yes")])
2513 (define_insn "*fix_truncdfdi_ieee"
2514 [(set (match_operand:DI 0 "reg_no_subreg_operand" "=&f")
2515 (match_operator:DI 2 "fix_operator"
2516 [(match_operand:DF 1 "reg_or_0_operand" "fG")]))]
2517 "TARGET_FP && alpha_fptm >= ALPHA_FPTM_SU"
2519 [(set_attr "type" "fadd")
2520 (set_attr "trap" "yes")
2521 (set_attr "round_suffix" "c")
2522 (set_attr "trap_suffix" "v_sv_svi")])
2524 (define_insn "*fix_truncdfdi2"
2525 [(set (match_operand:DI 0 "reg_no_subreg_operand" "=f")
2526 (match_operator:DI 2 "fix_operator"
2527 [(match_operand:DF 1 "reg_or_0_operand" "fG")]))]
2530 [(set_attr "type" "fadd")
2531 (set_attr "trap" "yes")
2532 (set_attr "round_suffix" "c")
2533 (set_attr "trap_suffix" "v_sv_svi")])
2535 (define_expand "fix_truncdfdi2"
2536 [(set (match_operand:DI 0 "reg_no_subreg_operand" "")
2537 (fix:DI (match_operand:DF 1 "reg_or_0_operand" "")))]
2541 (define_expand "fixuns_truncdfdi2"
2542 [(set (match_operand:DI 0 "reg_no_subreg_operand" "")
2543 (unsigned_fix:DI (match_operand:DF 1 "reg_or_0_operand" "")))]
2547 ;; Likewise between SFmode and SImode.
2549 (define_insn_and_split "*fix_truncsfsi_ieee"
2550 [(set (match_operand:SI 0 "memory_operand" "=m")
2552 (match_operator:DI 4 "fix_operator"
2554 (match_operand:SF 1 "reg_or_0_operand" "fG"))]) 0))
2555 (clobber (match_scratch:DI 2 "=&f"))
2556 (clobber (match_scratch:SF 3 "=&f"))]
2557 "TARGET_FP && alpha_fptm >= ALPHA_FPTM_SU"
2559 "&& reload_completed"
2560 [(set (match_dup 2) (match_op_dup 4 [(float_extend:DF (match_dup 1))]))
2561 (set (match_dup 3) (unspec:SF [(match_dup 2)] UNSPEC_CVTQL))
2562 (set (match_dup 5) (match_dup 3))]
2564 operands[5] = adjust_address (operands[0], SFmode, 0);
2566 [(set_attr "type" "fadd")
2567 (set_attr "trap" "yes")])
2569 (define_insn_and_split "*fix_truncsfsi_internal"
2570 [(set (match_operand:SI 0 "memory_operand" "=m")
2572 (match_operator:DI 3 "fix_operator"
2574 (match_operand:SF 1 "reg_or_0_operand" "fG"))]) 0))
2575 (clobber (match_scratch:DI 2 "=f"))]
2576 "TARGET_FP && alpha_fptm < ALPHA_FPTM_SU"
2578 "&& reload_completed"
2579 [(set (match_dup 2) (match_op_dup 3 [(float_extend:DF (match_dup 1))]))
2580 (set (match_dup 4) (unspec:SF [(match_dup 2)] UNSPEC_CVTQL))
2581 (set (match_dup 5) (match_dup 4))]
2583 operands[4] = gen_rtx_REG (SFmode, REGNO (operands[2]));
2584 operands[5] = adjust_address (operands[0], SFmode, 0);
2586 [(set_attr "type" "fadd")
2587 (set_attr "trap" "yes")])
2589 (define_insn "*fix_truncsfdi_ieee"
2590 [(set (match_operand:DI 0 "reg_no_subreg_operand" "=&f")
2591 (match_operator:DI 2 "fix_operator"
2592 [(float_extend:DF (match_operand:SF 1 "reg_or_0_operand" "fG"))]))]
2593 "TARGET_FP && alpha_fptm >= ALPHA_FPTM_SU"
2595 [(set_attr "type" "fadd")
2596 (set_attr "trap" "yes")
2597 (set_attr "round_suffix" "c")
2598 (set_attr "trap_suffix" "v_sv_svi")])
2600 (define_insn "*fix_truncsfdi2"
2601 [(set (match_operand:DI 0 "reg_no_subreg_operand" "=f")
2602 (match_operator:DI 2 "fix_operator"
2603 [(float_extend:DF (match_operand:SF 1 "reg_or_0_operand" "fG"))]))]
2606 [(set_attr "type" "fadd")
2607 (set_attr "trap" "yes")
2608 (set_attr "round_suffix" "c")
2609 (set_attr "trap_suffix" "v_sv_svi")])
2611 (define_expand "fix_truncsfdi2"
2612 [(set (match_operand:DI 0 "reg_no_subreg_operand" "")
2613 (fix:DI (float_extend:DF (match_operand:SF 1 "reg_or_0_operand" ""))))]
2617 (define_expand "fixuns_truncsfdi2"
2618 [(set (match_operand:DI 0 "reg_no_subreg_operand" "")
2620 (float_extend:DF (match_operand:SF 1 "reg_or_0_operand" ""))))]
2624 (define_expand "fix_trunctfdi2"
2625 [(use (match_operand:DI 0 "register_operand" ""))
2626 (use (match_operand:TF 1 "general_operand" ""))]
2627 "TARGET_HAS_XFLOATING_LIBS"
2628 "alpha_emit_xfloating_cvt (FIX, operands); DONE;")
2630 (define_expand "fixuns_trunctfdi2"
2631 [(use (match_operand:DI 0 "register_operand" ""))
2632 (use (match_operand:TF 1 "general_operand" ""))]
2633 "TARGET_HAS_XFLOATING_LIBS"
2634 "alpha_emit_xfloating_cvt (UNSIGNED_FIX, operands); DONE;")
2636 (define_insn "*floatdisf_ieee"
2637 [(set (match_operand:SF 0 "register_operand" "=&f")
2638 (float:SF (match_operand:DI 1 "reg_no_subreg_operand" "f")))]
2639 "TARGET_FP && alpha_fptm >= ALPHA_FPTM_SU"
2641 [(set_attr "type" "fadd")
2642 (set_attr "trap" "yes")
2643 (set_attr "round_suffix" "normal")
2644 (set_attr "trap_suffix" "sui")])
2646 (define_insn "floatdisf2"
2647 [(set (match_operand:SF 0 "register_operand" "=f")
2648 (float:SF (match_operand:DI 1 "reg_no_subreg_operand" "f")))]
2651 [(set_attr "type" "fadd")
2652 (set_attr "trap" "yes")
2653 (set_attr "round_suffix" "normal")
2654 (set_attr "trap_suffix" "sui")])
2656 (define_insn_and_split "*floatsisf2_ieee"
2657 [(set (match_operand:SF 0 "register_operand" "=&f")
2658 (float:SF (match_operand:SI 1 "memory_operand" "m")))
2659 (clobber (match_scratch:DI 2 "=&f"))
2660 (clobber (match_scratch:SF 3 "=&f"))]
2661 "TARGET_FP && alpha_fptm >= ALPHA_FPTM_SU"
2663 "&& reload_completed"
2664 [(set (match_dup 3) (match_dup 1))
2665 (set (match_dup 2) (unspec:DI [(match_dup 3)] UNSPEC_CVTLQ))
2666 (set (match_dup 0) (float:SF (match_dup 2)))]
2668 operands[1] = adjust_address (operands[1], SFmode, 0);
2671 (define_insn_and_split "*floatsisf2"
2672 [(set (match_operand:SF 0 "register_operand" "=f")
2673 (float:SF (match_operand:SI 1 "memory_operand" "m")))]
2676 "&& reload_completed"
2677 [(set (match_dup 0) (match_dup 1))
2678 (set (match_dup 2) (unspec:DI [(match_dup 0)] UNSPEC_CVTLQ))
2679 (set (match_dup 0) (float:SF (match_dup 2)))]
2681 operands[1] = adjust_address (operands[1], SFmode, 0);
2682 operands[2] = gen_rtx_REG (DImode, REGNO (operands[0]));
2685 (define_insn "*floatdidf_ieee"
2686 [(set (match_operand:DF 0 "register_operand" "=&f")
2687 (float:DF (match_operand:DI 1 "reg_no_subreg_operand" "f")))]
2688 "TARGET_FP && alpha_fptm >= ALPHA_FPTM_SU"
2690 [(set_attr "type" "fadd")
2691 (set_attr "trap" "yes")
2692 (set_attr "round_suffix" "normal")
2693 (set_attr "trap_suffix" "sui")])
2695 (define_insn "floatdidf2"
2696 [(set (match_operand:DF 0 "register_operand" "=f")
2697 (float:DF (match_operand:DI 1 "reg_no_subreg_operand" "f")))]
2700 [(set_attr "type" "fadd")
2701 (set_attr "trap" "yes")
2702 (set_attr "round_suffix" "normal")
2703 (set_attr "trap_suffix" "sui")])
2705 (define_insn_and_split "*floatsidf2_ieee"
2706 [(set (match_operand:DF 0 "register_operand" "=&f")
2707 (float:DF (match_operand:SI 1 "memory_operand" "m")))
2708 (clobber (match_scratch:DI 2 "=&f"))
2709 (clobber (match_scratch:SF 3 "=&f"))]
2710 "TARGET_FP && alpha_fptm >= ALPHA_FPTM_SU"
2712 "&& reload_completed"
2713 [(set (match_dup 3) (match_dup 1))
2714 (set (match_dup 2) (unspec:DI [(match_dup 3)] UNSPEC_CVTLQ))
2715 (set (match_dup 0) (float:DF (match_dup 2)))]
2717 operands[1] = adjust_address (operands[1], SFmode, 0);
2720 (define_insn_and_split "*floatsidf2"
2721 [(set (match_operand:DF 0 "register_operand" "=f")
2722 (float:DF (match_operand:SI 1 "memory_operand" "m")))]
2725 "&& reload_completed"
2726 [(set (match_dup 3) (match_dup 1))
2727 (set (match_dup 2) (unspec:DI [(match_dup 3)] UNSPEC_CVTLQ))
2728 (set (match_dup 0) (float:DF (match_dup 2)))]
2730 operands[1] = adjust_address (operands[1], SFmode, 0);
2731 operands[2] = gen_rtx_REG (DImode, REGNO (operands[0]));
2732 operands[3] = gen_rtx_REG (SFmode, REGNO (operands[0]));
2735 (define_expand "floatditf2"
2736 [(use (match_operand:TF 0 "register_operand" ""))
2737 (use (match_operand:DI 1 "general_operand" ""))]
2738 "TARGET_HAS_XFLOATING_LIBS"
2739 "alpha_emit_xfloating_cvt (FLOAT, operands); DONE;")
2741 (define_expand "floatunsdisf2"
2742 [(use (match_operand:SF 0 "register_operand" ""))
2743 (use (match_operand:DI 1 "register_operand" ""))]
2745 "alpha_emit_floatuns (operands); DONE;")
2747 (define_expand "floatunsdidf2"
2748 [(use (match_operand:DF 0 "register_operand" ""))
2749 (use (match_operand:DI 1 "register_operand" ""))]
2751 "alpha_emit_floatuns (operands); DONE;")
2753 (define_expand "floatunsditf2"
2754 [(use (match_operand:TF 0 "register_operand" ""))
2755 (use (match_operand:DI 1 "general_operand" ""))]
2756 "TARGET_HAS_XFLOATING_LIBS"
2757 "alpha_emit_xfloating_cvt (UNSIGNED_FLOAT, operands); DONE;")
2759 (define_expand "extendsfdf2"
2760 [(set (match_operand:DF 0 "register_operand" "")
2761 (float_extend:DF (match_operand:SF 1 "nonimmediate_operand" "")))]
2764 if (alpha_fptm >= ALPHA_FPTM_SU)
2765 operands[1] = force_reg (SFmode, operands[1]);
2768 ;; The Unicos/Mk assembler doesn't support cvtst, but we've already
2769 ;; asserted that alpha_fptm == ALPHA_FPTM_N.
2771 (define_insn "*extendsfdf2_ieee"
2772 [(set (match_operand:DF 0 "register_operand" "=&f")
2773 (float_extend:DF (match_operand:SF 1 "register_operand" "f")))]
2774 "TARGET_FP && alpha_fptm >= ALPHA_FPTM_SU"
2776 [(set_attr "type" "fadd")
2777 (set_attr "trap" "yes")])
2779 (define_insn "*extendsfdf2_internal"
2780 [(set (match_operand:DF 0 "register_operand" "=f,f,m")
2781 (float_extend:DF (match_operand:SF 1 "nonimmediate_operand" "f,m,f")))]
2782 "TARGET_FP && alpha_fptm < ALPHA_FPTM_SU"
2787 [(set_attr "type" "fcpys,fld,fst")])
2789 ;; Use register_operand for operand 1 to prevent compress_float_constant
2790 ;; from doing something silly. When optimizing we'll put things back
2792 (define_expand "extendsftf2"
2793 [(use (match_operand:TF 0 "register_operand" ""))
2794 (use (match_operand:SF 1 "register_operand" ""))]
2795 "TARGET_HAS_XFLOATING_LIBS"
2797 rtx tmp = gen_reg_rtx (DFmode);
2798 emit_insn (gen_extendsfdf2 (tmp, operands[1]));
2799 emit_insn (gen_extenddftf2 (operands[0], tmp));
2803 (define_expand "extenddftf2"
2804 [(use (match_operand:TF 0 "register_operand" ""))
2805 (use (match_operand:DF 1 "register_operand" ""))]
2806 "TARGET_HAS_XFLOATING_LIBS"
2807 "alpha_emit_xfloating_cvt (FLOAT_EXTEND, operands); DONE;")
2809 (define_insn "*truncdfsf2_ieee"
2810 [(set (match_operand:SF 0 "register_operand" "=&f")
2811 (float_truncate:SF (match_operand:DF 1 "reg_or_0_operand" "fG")))]
2812 "TARGET_FP && alpha_fptm >= ALPHA_FPTM_SU"
2814 [(set_attr "type" "fadd")
2815 (set_attr "trap" "yes")
2816 (set_attr "round_suffix" "normal")
2817 (set_attr "trap_suffix" "u_su_sui")])
2819 (define_insn "truncdfsf2"
2820 [(set (match_operand:SF 0 "register_operand" "=f")
2821 (float_truncate:SF (match_operand:DF 1 "reg_or_0_operand" "fG")))]
2824 [(set_attr "type" "fadd")
2825 (set_attr "trap" "yes")
2826 (set_attr "round_suffix" "normal")
2827 (set_attr "trap_suffix" "u_su_sui")])
2829 (define_expand "trunctfdf2"
2830 [(use (match_operand:DF 0 "register_operand" ""))
2831 (use (match_operand:TF 1 "general_operand" ""))]
2832 "TARGET_HAS_XFLOATING_LIBS"
2833 "alpha_emit_xfloating_cvt (FLOAT_TRUNCATE, operands); DONE;")
2835 (define_expand "trunctfsf2"
2836 [(use (match_operand:SF 0 "register_operand" ""))
2837 (use (match_operand:TF 1 "general_operand" ""))]
2838 "TARGET_FP && TARGET_HAS_XFLOATING_LIBS"
2840 rtx tmpf, sticky, arg, lo, hi;
2842 tmpf = gen_reg_rtx (DFmode);
2843 sticky = gen_reg_rtx (DImode);
2844 arg = copy_to_mode_reg (TFmode, operands[1]);
2845 lo = gen_lowpart (DImode, arg);
2846 hi = gen_highpart (DImode, arg);
2848 /* Convert the low word of the TFmode value into a sticky rounding bit,
2849 then or it into the low bit of the high word. This leaves the sticky
2850 bit at bit 48 of the fraction, which is representable in DFmode,
2851 which prevents rounding error in the final conversion to SFmode. */
2853 emit_insn (gen_rtx_SET (VOIDmode, sticky,
2854 gen_rtx_NE (DImode, lo, const0_rtx)));
2855 emit_insn (gen_iordi3 (hi, hi, sticky));
2856 emit_insn (gen_trunctfdf2 (tmpf, arg));
2857 emit_insn (gen_truncdfsf2 (operands[0], tmpf));
2861 (define_insn "*divsf3_ieee"
2862 [(set (match_operand:SF 0 "register_operand" "=&f")
2863 (div:SF (match_operand:SF 1 "reg_or_0_operand" "fG")
2864 (match_operand:SF 2 "reg_or_0_operand" "fG")))]
2865 "TARGET_FP && alpha_fptm >= ALPHA_FPTM_SU"
2866 "div%,%/ %R1,%R2,%0"
2867 [(set_attr "type" "fdiv")
2868 (set_attr "opsize" "si")
2869 (set_attr "trap" "yes")
2870 (set_attr "round_suffix" "normal")
2871 (set_attr "trap_suffix" "u_su_sui")])
2873 (define_insn "divsf3"
2874 [(set (match_operand:SF 0 "register_operand" "=f")
2875 (div:SF (match_operand:SF 1 "reg_or_0_operand" "fG")
2876 (match_operand:SF 2 "reg_or_0_operand" "fG")))]
2878 "div%,%/ %R1,%R2,%0"
2879 [(set_attr "type" "fdiv")
2880 (set_attr "opsize" "si")
2881 (set_attr "trap" "yes")
2882 (set_attr "round_suffix" "normal")
2883 (set_attr "trap_suffix" "u_su_sui")])
2885 (define_insn "*divdf3_ieee"
2886 [(set (match_operand:DF 0 "register_operand" "=&f")
2887 (div:DF (match_operand:DF 1 "reg_or_0_operand" "fG")
2888 (match_operand:DF 2 "reg_or_0_operand" "fG")))]
2889 "TARGET_FP && alpha_fptm >= ALPHA_FPTM_SU"
2890 "div%-%/ %R1,%R2,%0"
2891 [(set_attr "type" "fdiv")
2892 (set_attr "trap" "yes")
2893 (set_attr "round_suffix" "normal")
2894 (set_attr "trap_suffix" "u_su_sui")])
2896 (define_insn "divdf3"
2897 [(set (match_operand:DF 0 "register_operand" "=f")
2898 (div:DF (match_operand:DF 1 "reg_or_0_operand" "fG")
2899 (match_operand:DF 2 "reg_or_0_operand" "fG")))]
2901 "div%-%/ %R1,%R2,%0"
2902 [(set_attr "type" "fdiv")
2903 (set_attr "trap" "yes")
2904 (set_attr "round_suffix" "normal")
2905 (set_attr "trap_suffix" "u_su_sui")])
2907 (define_insn "*divdf_ext1"
2908 [(set (match_operand:DF 0 "register_operand" "=f")
2909 (div:DF (float_extend:DF (match_operand:SF 1 "reg_or_0_operand" "fG"))
2910 (match_operand:DF 2 "reg_or_0_operand" "fG")))]
2911 "TARGET_FP && alpha_fptm < ALPHA_FPTM_SU"
2912 "div%-%/ %R1,%R2,%0"
2913 [(set_attr "type" "fdiv")
2914 (set_attr "trap" "yes")
2915 (set_attr "round_suffix" "normal")
2916 (set_attr "trap_suffix" "u_su_sui")])
2918 (define_insn "*divdf_ext2"
2919 [(set (match_operand:DF 0 "register_operand" "=f")
2920 (div:DF (match_operand:DF 1 "reg_or_0_operand" "fG")
2922 (match_operand:SF 2 "reg_or_0_operand" "fG"))))]
2923 "TARGET_FP && alpha_fptm < ALPHA_FPTM_SU"
2924 "div%-%/ %R1,%R2,%0"
2925 [(set_attr "type" "fdiv")
2926 (set_attr "trap" "yes")
2927 (set_attr "round_suffix" "normal")
2928 (set_attr "trap_suffix" "u_su_sui")])
2930 (define_insn "*divdf_ext3"
2931 [(set (match_operand:DF 0 "register_operand" "=f")
2932 (div:DF (float_extend:DF (match_operand:SF 1 "reg_or_0_operand" "fG"))
2933 (float_extend:DF (match_operand:SF 2 "reg_or_0_operand" "fG"))))]
2934 "TARGET_FP && alpha_fptm < ALPHA_FPTM_SU"
2935 "div%-%/ %R1,%R2,%0"
2936 [(set_attr "type" "fdiv")
2937 (set_attr "trap" "yes")
2938 (set_attr "round_suffix" "normal")
2939 (set_attr "trap_suffix" "u_su_sui")])
2941 (define_expand "divtf3"
2942 [(use (match_operand 0 "register_operand" ""))
2943 (use (match_operand 1 "general_operand" ""))
2944 (use (match_operand 2 "general_operand" ""))]
2945 "TARGET_HAS_XFLOATING_LIBS"
2946 "alpha_emit_xfloating_arith (DIV, operands); DONE;")
2948 (define_insn "*mulsf3_ieee"
2949 [(set (match_operand:SF 0 "register_operand" "=&f")
2950 (mult:SF (match_operand:SF 1 "reg_or_0_operand" "%fG")
2951 (match_operand:SF 2 "reg_or_0_operand" "fG")))]
2952 "TARGET_FP && alpha_fptm >= ALPHA_FPTM_SU"
2953 "mul%,%/ %R1,%R2,%0"
2954 [(set_attr "type" "fmul")
2955 (set_attr "trap" "yes")
2956 (set_attr "round_suffix" "normal")
2957 (set_attr "trap_suffix" "u_su_sui")])
2959 (define_insn "mulsf3"
2960 [(set (match_operand:SF 0 "register_operand" "=f")
2961 (mult:SF (match_operand:SF 1 "reg_or_0_operand" "%fG")
2962 (match_operand:SF 2 "reg_or_0_operand" "fG")))]
2964 "mul%,%/ %R1,%R2,%0"
2965 [(set_attr "type" "fmul")
2966 (set_attr "trap" "yes")
2967 (set_attr "round_suffix" "normal")
2968 (set_attr "trap_suffix" "u_su_sui")])
2970 (define_insn "*muldf3_ieee"
2971 [(set (match_operand:DF 0 "register_operand" "=&f")
2972 (mult:DF (match_operand:DF 1 "reg_or_0_operand" "%fG")
2973 (match_operand:DF 2 "reg_or_0_operand" "fG")))]
2974 "TARGET_FP && alpha_fptm >= ALPHA_FPTM_SU"
2975 "mul%-%/ %R1,%R2,%0"
2976 [(set_attr "type" "fmul")
2977 (set_attr "trap" "yes")
2978 (set_attr "round_suffix" "normal")
2979 (set_attr "trap_suffix" "u_su_sui")])
2981 (define_insn "muldf3"
2982 [(set (match_operand:DF 0 "register_operand" "=f")
2983 (mult:DF (match_operand:DF 1 "reg_or_0_operand" "%fG")
2984 (match_operand:DF 2 "reg_or_0_operand" "fG")))]
2986 "mul%-%/ %R1,%R2,%0"
2987 [(set_attr "type" "fmul")
2988 (set_attr "trap" "yes")
2989 (set_attr "round_suffix" "normal")
2990 (set_attr "trap_suffix" "u_su_sui")])
2992 (define_insn "*muldf_ext1"
2993 [(set (match_operand:DF 0 "register_operand" "=f")
2994 (mult:DF (float_extend:DF
2995 (match_operand:SF 1 "reg_or_0_operand" "fG"))
2996 (match_operand:DF 2 "reg_or_0_operand" "fG")))]
2997 "TARGET_FP && alpha_fptm < ALPHA_FPTM_SU"
2998 "mul%-%/ %R1,%R2,%0"
2999 [(set_attr "type" "fmul")
3000 (set_attr "trap" "yes")
3001 (set_attr "round_suffix" "normal")
3002 (set_attr "trap_suffix" "u_su_sui")])
3004 (define_insn "*muldf_ext2"
3005 [(set (match_operand:DF 0 "register_operand" "=f")
3006 (mult:DF (float_extend:DF
3007 (match_operand:SF 1 "reg_or_0_operand" "%fG"))
3009 (match_operand:SF 2 "reg_or_0_operand" "fG"))))]
3010 "TARGET_FP && alpha_fptm < ALPHA_FPTM_SU"
3011 "mul%-%/ %R1,%R2,%0"
3012 [(set_attr "type" "fmul")
3013 (set_attr "trap" "yes")
3014 (set_attr "round_suffix" "normal")
3015 (set_attr "trap_suffix" "u_su_sui")])
3017 (define_expand "multf3"
3018 [(use (match_operand 0 "register_operand" ""))
3019 (use (match_operand 1 "general_operand" ""))
3020 (use (match_operand 2 "general_operand" ""))]
3021 "TARGET_HAS_XFLOATING_LIBS"
3022 "alpha_emit_xfloating_arith (MULT, operands); DONE;")
3024 (define_insn "*subsf3_ieee"
3025 [(set (match_operand:SF 0 "register_operand" "=&f")
3026 (minus:SF (match_operand:SF 1 "reg_or_0_operand" "fG")
3027 (match_operand:SF 2 "reg_or_0_operand" "fG")))]
3028 "TARGET_FP && alpha_fptm >= ALPHA_FPTM_SU"
3029 "sub%,%/ %R1,%R2,%0"
3030 [(set_attr "type" "fadd")
3031 (set_attr "trap" "yes")
3032 (set_attr "round_suffix" "normal")
3033 (set_attr "trap_suffix" "u_su_sui")])
3035 (define_insn "subsf3"
3036 [(set (match_operand:SF 0 "register_operand" "=f")
3037 (minus:SF (match_operand:SF 1 "reg_or_0_operand" "fG")
3038 (match_operand:SF 2 "reg_or_0_operand" "fG")))]
3040 "sub%,%/ %R1,%R2,%0"
3041 [(set_attr "type" "fadd")
3042 (set_attr "trap" "yes")
3043 (set_attr "round_suffix" "normal")
3044 (set_attr "trap_suffix" "u_su_sui")])
3046 (define_insn "*subdf3_ieee"
3047 [(set (match_operand:DF 0 "register_operand" "=&f")
3048 (minus:DF (match_operand:DF 1 "reg_or_0_operand" "fG")
3049 (match_operand:DF 2 "reg_or_0_operand" "fG")))]
3050 "TARGET_FP && alpha_fptm >= ALPHA_FPTM_SU"
3051 "sub%-%/ %R1,%R2,%0"
3052 [(set_attr "type" "fadd")
3053 (set_attr "trap" "yes")
3054 (set_attr "round_suffix" "normal")
3055 (set_attr "trap_suffix" "u_su_sui")])
3057 (define_insn "subdf3"
3058 [(set (match_operand:DF 0 "register_operand" "=f")
3059 (minus:DF (match_operand:DF 1 "reg_or_0_operand" "fG")
3060 (match_operand:DF 2 "reg_or_0_operand" "fG")))]
3062 "sub%-%/ %R1,%R2,%0"
3063 [(set_attr "type" "fadd")
3064 (set_attr "trap" "yes")
3065 (set_attr "round_suffix" "normal")
3066 (set_attr "trap_suffix" "u_su_sui")])
3068 (define_insn "*subdf_ext1"
3069 [(set (match_operand:DF 0 "register_operand" "=f")
3070 (minus:DF (float_extend:DF
3071 (match_operand:SF 1 "reg_or_0_operand" "fG"))
3072 (match_operand:DF 2 "reg_or_0_operand" "fG")))]
3073 "TARGET_FP && alpha_fptm < ALPHA_FPTM_SU"
3074 "sub%-%/ %R1,%R2,%0"
3075 [(set_attr "type" "fadd")
3076 (set_attr "trap" "yes")
3077 (set_attr "round_suffix" "normal")
3078 (set_attr "trap_suffix" "u_su_sui")])
3080 (define_insn "*subdf_ext2"
3081 [(set (match_operand:DF 0 "register_operand" "=f")
3082 (minus:DF (match_operand:DF 1 "reg_or_0_operand" "fG")
3084 (match_operand:SF 2 "reg_or_0_operand" "fG"))))]
3085 "TARGET_FP && alpha_fptm < ALPHA_FPTM_SU"
3086 "sub%-%/ %R1,%R2,%0"
3087 [(set_attr "type" "fadd")
3088 (set_attr "trap" "yes")
3089 (set_attr "round_suffix" "normal")
3090 (set_attr "trap_suffix" "u_su_sui")])
3092 (define_insn "*subdf_ext3"
3093 [(set (match_operand:DF 0 "register_operand" "=f")
3094 (minus:DF (float_extend:DF
3095 (match_operand:SF 1 "reg_or_0_operand" "fG"))
3097 (match_operand:SF 2 "reg_or_0_operand" "fG"))))]
3098 "TARGET_FP && alpha_fptm < ALPHA_FPTM_SU"
3099 "sub%-%/ %R1,%R2,%0"
3100 [(set_attr "type" "fadd")
3101 (set_attr "trap" "yes")
3102 (set_attr "round_suffix" "normal")
3103 (set_attr "trap_suffix" "u_su_sui")])
3105 (define_expand "subtf3"
3106 [(use (match_operand 0 "register_operand" ""))
3107 (use (match_operand 1 "general_operand" ""))
3108 (use (match_operand 2 "general_operand" ""))]
3109 "TARGET_HAS_XFLOATING_LIBS"
3110 "alpha_emit_xfloating_arith (MINUS, operands); DONE;")
3112 (define_insn "*sqrtsf2_ieee"
3113 [(set (match_operand:SF 0 "register_operand" "=&f")
3114 (sqrt:SF (match_operand:SF 1 "reg_or_0_operand" "fG")))]
3115 "TARGET_FP && TARGET_FIX && alpha_fptm >= ALPHA_FPTM_SU"
3117 [(set_attr "type" "fsqrt")
3118 (set_attr "opsize" "si")
3119 (set_attr "trap" "yes")
3120 (set_attr "round_suffix" "normal")
3121 (set_attr "trap_suffix" "u_su_sui")])
3123 (define_insn "sqrtsf2"
3124 [(set (match_operand:SF 0 "register_operand" "=f")
3125 (sqrt:SF (match_operand:SF 1 "reg_or_0_operand" "fG")))]
3126 "TARGET_FP && TARGET_FIX"
3128 [(set_attr "type" "fsqrt")
3129 (set_attr "opsize" "si")
3130 (set_attr "trap" "yes")
3131 (set_attr "round_suffix" "normal")
3132 (set_attr "trap_suffix" "u_su_sui")])
3134 (define_insn "*sqrtdf2_ieee"
3135 [(set (match_operand:DF 0 "register_operand" "=&f")
3136 (sqrt:DF (match_operand:DF 1 "reg_or_0_operand" "fG")))]
3137 "TARGET_FP && TARGET_FIX && alpha_fptm >= ALPHA_FPTM_SU"
3139 [(set_attr "type" "fsqrt")
3140 (set_attr "trap" "yes")
3141 (set_attr "round_suffix" "normal")
3142 (set_attr "trap_suffix" "u_su_sui")])
3144 (define_insn "sqrtdf2"
3145 [(set (match_operand:DF 0 "register_operand" "=f")
3146 (sqrt:DF (match_operand:DF 1 "reg_or_0_operand" "fG")))]
3147 "TARGET_FP && TARGET_FIX"
3149 [(set_attr "type" "fsqrt")
3150 (set_attr "trap" "yes")
3151 (set_attr "round_suffix" "normal")
3152 (set_attr "trap_suffix" "u_su_sui")])
3154 ;; Next are all the integer comparisons, and conditional moves and branches
3155 ;; and some of the related define_expand's and define_split's.
3157 (define_insn "*setcc_internal"
3158 [(set (match_operand 0 "register_operand" "=r")
3159 (match_operator 1 "alpha_comparison_operator"
3160 [(match_operand:DI 2 "register_operand" "r")
3161 (match_operand:DI 3 "reg_or_8bit_operand" "rI")]))]
3162 "GET_MODE_CLASS (GET_MODE (operands[0])) == MODE_INT
3163 && GET_MODE_SIZE (GET_MODE (operands[0])) <= 8
3164 && GET_MODE (operands[0]) == GET_MODE (operands[1])"
3166 [(set_attr "type" "icmp")])
3168 ;; Yes, we can technically support reg_or_8bit_operand in operand 2,
3169 ;; but that's non-canonical rtl and allowing that causes inefficiencies
3171 (define_insn "*setcc_swapped_internal"
3172 [(set (match_operand 0 "register_operand" "=r")
3173 (match_operator 1 "alpha_swapped_comparison_operator"
3174 [(match_operand:DI 2 "register_operand" "r")
3175 (match_operand:DI 3 "reg_or_0_operand" "rJ")]))]
3176 "GET_MODE_CLASS (GET_MODE (operands[0])) == MODE_INT
3177 && GET_MODE_SIZE (GET_MODE (operands[0])) <= 8
3178 && GET_MODE (operands[0]) == GET_MODE (operands[1])"
3180 [(set_attr "type" "icmp")])
3182 ;; Use match_operator rather than ne directly so that we can match
3183 ;; multiple integer modes.
3184 (define_insn "*setne_internal"
3185 [(set (match_operand 0 "register_operand" "=r")
3186 (match_operator 1 "signed_comparison_operator"
3187 [(match_operand:DI 2 "register_operand" "r")
3189 "GET_MODE_CLASS (GET_MODE (operands[0])) == MODE_INT
3190 && GET_MODE_SIZE (GET_MODE (operands[0])) <= 8
3191 && GET_CODE (operands[1]) == NE
3192 && GET_MODE (operands[0]) == GET_MODE (operands[1])"
3194 [(set_attr "type" "icmp")])
3196 ;; The mode folding trick can't be used with const_int operands, since
3197 ;; reload needs to know the proper mode.
3199 ;; Use add_operand instead of the more seemingly natural reg_or_8bit_operand
3200 ;; in order to create more pairs of constants. As long as we're allowing
3201 ;; two constants at the same time, and will have to reload one of them...
3203 (define_insn "*movqicc_internal"
3204 [(set (match_operand:QI 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:QI 1 "add_operand" "rI,0,rI,0")
3210 (match_operand:QI 5 "add_operand" "0,rI,0,rI")))]
3211 "(operands[3] == const0_rtx) ^ (operands[4] == const0_rtx)"
3217 [(set_attr "type" "icmov")])
3219 (define_insn "*movhicc_internal"
3220 [(set (match_operand:HI 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:HI 1 "add_operand" "rI,0,rI,0")
3226 (match_operand:HI 5 "add_operand" "0,rI,0,rI")))]
3227 "(operands[3] == const0_rtx) ^ (operands[4] == const0_rtx)"
3233 [(set_attr "type" "icmov")])
3235 (define_insn "*movsicc_internal"
3236 [(set (match_operand:SI 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:SI 1 "add_operand" "rI,0,rI,0")
3242 (match_operand:SI 5 "add_operand" "0,rI,0,rI")))]
3243 "(operands[3] == const0_rtx) ^ (operands[4] == const0_rtx)"
3249 [(set_attr "type" "icmov")])
3251 (define_insn "*movdicc_internal"
3252 [(set (match_operand:DI 0 "register_operand" "=r,r,r,r")
3254 (match_operator 2 "signed_comparison_operator"
3255 [(match_operand:DI 3 "reg_or_0_operand" "rJ,rJ,J,J")
3256 (match_operand:DI 4 "reg_or_0_operand" "J,J,rJ,rJ")])
3257 (match_operand:DI 1 "add_operand" "rI,0,rI,0")
3258 (match_operand:DI 5 "add_operand" "0,rI,0,rI")))]
3259 "(operands[3] == const0_rtx) ^ (operands[4] == const0_rtx)"
3265 [(set_attr "type" "icmov")])
3267 (define_insn "*movqicc_lbc"
3268 [(set (match_operand:QI 0 "register_operand" "=r,r")
3270 (eq (zero_extract:DI (match_operand:DI 2 "reg_or_0_operand" "rJ,rJ")
3274 (match_operand:QI 1 "reg_or_8bit_operand" "rI,0")
3275 (match_operand:QI 3 "reg_or_8bit_operand" "0,rI")))]
3280 [(set_attr "type" "icmov")])
3282 (define_insn "*movhicc_lbc"
3283 [(set (match_operand:HI 0 "register_operand" "=r,r")
3285 (eq (zero_extract:DI (match_operand:DI 2 "reg_or_0_operand" "rJ,rJ")
3289 (match_operand:HI 1 "reg_or_8bit_operand" "rI,0")
3290 (match_operand:HI 3 "reg_or_8bit_operand" "0,rI")))]
3295 [(set_attr "type" "icmov")])
3297 (define_insn "*movsicc_lbc"
3298 [(set (match_operand:SI 0 "register_operand" "=r,r")
3300 (eq (zero_extract:DI (match_operand:DI 2 "reg_or_0_operand" "rJ,rJ")
3304 (match_operand:SI 1 "reg_or_8bit_operand" "rI,0")
3305 (match_operand:SI 3 "reg_or_8bit_operand" "0,rI")))]
3310 [(set_attr "type" "icmov")])
3312 (define_insn "*movdicc_lbc"
3313 [(set (match_operand:DI 0 "register_operand" "=r,r")
3315 (eq (zero_extract:DI (match_operand:DI 2 "reg_or_0_operand" "rJ,rJ")
3319 (match_operand:DI 1 "reg_or_8bit_operand" "rI,0")
3320 (match_operand:DI 3 "reg_or_8bit_operand" "0,rI")))]
3325 [(set_attr "type" "icmov")])
3327 (define_insn "*movqicc_lbs"
3328 [(set (match_operand:QI 0 "register_operand" "=r,r")
3330 (ne (zero_extract:DI (match_operand:DI 2 "reg_or_0_operand" "rJ,rJ")
3334 (match_operand:QI 1 "reg_or_8bit_operand" "rI,0")
3335 (match_operand:QI 3 "reg_or_8bit_operand" "0,rI")))]
3340 [(set_attr "type" "icmov")])
3342 (define_insn "*movhicc_lbs"
3343 [(set (match_operand:HI 0 "register_operand" "=r,r")
3345 (ne (zero_extract:DI (match_operand:DI 2 "reg_or_0_operand" "rJ,rJ")
3349 (match_operand:HI 1 "reg_or_8bit_operand" "rI,0")
3350 (match_operand:HI 3 "reg_or_8bit_operand" "0,rI")))]
3355 [(set_attr "type" "icmov")])
3357 (define_insn "*movsicc_lbs"
3358 [(set (match_operand:SI 0 "register_operand" "=r,r")
3360 (ne (zero_extract:DI (match_operand:DI 2 "reg_or_0_operand" "rJ,rJ")
3364 (match_operand:SI 1 "reg_or_8bit_operand" "rI,0")
3365 (match_operand:SI 3 "reg_or_8bit_operand" "0,rI")))]
3370 [(set_attr "type" "icmov")])
3372 (define_insn "*movdicc_lbs"
3373 [(set (match_operand:DI 0 "register_operand" "=r,r")
3375 (ne (zero_extract:DI (match_operand:DI 2 "reg_or_0_operand" "rJ,rJ")
3379 (match_operand:DI 1 "reg_or_8bit_operand" "rI,0")
3380 (match_operand:DI 3 "reg_or_8bit_operand" "0,rI")))]
3385 [(set_attr "type" "icmov")])
3387 ;; For ABS, we have two choices, depending on whether the input and output
3388 ;; registers are the same or not.
3389 (define_expand "absdi2"
3390 [(set (match_operand:DI 0 "register_operand" "")
3391 (abs:DI (match_operand:DI 1 "register_operand" "")))]
3394 if (rtx_equal_p (operands[0], operands[1]))
3395 emit_insn (gen_absdi2_same (operands[0], gen_reg_rtx (DImode)));
3397 emit_insn (gen_absdi2_diff (operands[0], operands[1]));
3401 (define_expand "absdi2_same"
3402 [(set (match_operand:DI 1 "register_operand" "")
3403 (neg:DI (match_operand:DI 0 "register_operand" "")))
3405 (if_then_else:DI (ge (match_dup 0) (const_int 0))
3411 (define_expand "absdi2_diff"
3412 [(set (match_operand:DI 0 "register_operand" "")
3413 (neg:DI (match_operand:DI 1 "register_operand" "")))
3415 (if_then_else:DI (lt (match_dup 1) (const_int 0))
3422 [(set (match_operand:DI 0 "register_operand" "")
3423 (abs:DI (match_dup 0)))
3424 (clobber (match_operand:DI 1 "register_operand" ""))]
3426 [(set (match_dup 1) (neg:DI (match_dup 0)))
3427 (set (match_dup 0) (if_then_else:DI (ge (match_dup 0) (const_int 0))
3428 (match_dup 0) (match_dup 1)))]
3432 [(set (match_operand:DI 0 "register_operand" "")
3433 (abs:DI (match_operand:DI 1 "register_operand" "")))]
3434 "! rtx_equal_p (operands[0], operands[1])"
3435 [(set (match_dup 0) (neg:DI (match_dup 1)))
3436 (set (match_dup 0) (if_then_else:DI (lt (match_dup 1) (const_int 0))
3437 (match_dup 0) (match_dup 1)))]
3441 [(set (match_operand:DI 0 "register_operand" "")
3442 (neg:DI (abs:DI (match_dup 0))))
3443 (clobber (match_operand:DI 1 "register_operand" ""))]
3445 [(set (match_dup 1) (neg:DI (match_dup 0)))
3446 (set (match_dup 0) (if_then_else:DI (le (match_dup 0) (const_int 0))
3447 (match_dup 0) (match_dup 1)))]
3451 [(set (match_operand:DI 0 "register_operand" "")
3452 (neg:DI (abs:DI (match_operand:DI 1 "register_operand" ""))))]
3453 "! rtx_equal_p (operands[0], operands[1])"
3454 [(set (match_dup 0) (neg:DI (match_dup 1)))
3455 (set (match_dup 0) (if_then_else:DI (gt (match_dup 1) (const_int 0))
3456 (match_dup 0) (match_dup 1)))]
3459 (define_insn "sminqi3"
3460 [(set (match_operand:QI 0 "register_operand" "=r")
3461 (smin: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 "uminqi3"
3468 [(set (match_operand:QI 0 "register_operand" "=r")
3469 (umin: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 "smaxqi3"
3476 [(set (match_operand:QI 0 "register_operand" "=r")
3477 (smax:QI (match_operand:QI 1 "reg_or_0_operand" "%rJ")
3478 (match_operand:QI 2 "reg_or_8bit_operand" "rI")))]
3481 [(set_attr "type" "mvi")])
3483 (define_insn "umaxqi3"
3484 [(set (match_operand:QI 0 "register_operand" "=r")
3485 (umax:QI (match_operand:QI 1 "reg_or_0_operand" "%rJ")
3486 (match_operand:QI 2 "reg_or_8bit_operand" "rI")))]
3489 [(set_attr "type" "mvi")])
3491 (define_insn "sminhi3"
3492 [(set (match_operand:HI 0 "register_operand" "=r")
3493 (smin: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 "uminhi3"
3500 [(set (match_operand:HI 0 "register_operand" "=r")
3501 (umin: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_insn "smaxhi3"
3508 [(set (match_operand:HI 0 "register_operand" "=r")
3509 (smax:HI (match_operand:HI 1 "reg_or_0_operand" "%rJ")
3510 (match_operand:HI 2 "reg_or_8bit_operand" "rI")))]
3513 [(set_attr "type" "mvi")])
3515 (define_insn "umaxhi3"
3516 [(set (match_operand:HI 0 "register_operand" "=r")
3517 (umax:HI (match_operand:HI 1 "reg_or_0_operand" "%rJ")
3518 (match_operand:HI 2 "reg_or_8bit_operand" "rI")))]
3521 [(set_attr "type" "mvi")])
3523 (define_expand "smaxdi3"
3525 (le:DI (match_operand:DI 1 "reg_or_0_operand" "")
3526 (match_operand:DI 2 "reg_or_8bit_operand" "")))
3527 (set (match_operand:DI 0 "register_operand" "")
3528 (if_then_else:DI (eq (match_dup 3) (const_int 0))
3529 (match_dup 1) (match_dup 2)))]
3531 { operands[3] = gen_reg_rtx (DImode); })
3534 [(set (match_operand:DI 0 "register_operand" "")
3535 (smax:DI (match_operand:DI 1 "reg_or_0_operand" "")
3536 (match_operand:DI 2 "reg_or_8bit_operand" "")))
3537 (clobber (match_operand:DI 3 "register_operand" ""))]
3538 "operands[2] != const0_rtx"
3539 [(set (match_dup 3) (le:DI (match_dup 1) (match_dup 2)))
3540 (set (match_dup 0) (if_then_else:DI (eq (match_dup 3) (const_int 0))
3541 (match_dup 1) (match_dup 2)))]
3544 (define_insn "*smax_const0"
3545 [(set (match_operand:DI 0 "register_operand" "=r")
3546 (smax:DI (match_operand:DI 1 "register_operand" "0")
3550 [(set_attr "type" "icmov")])
3552 (define_expand "smindi3"
3554 (lt:DI (match_operand:DI 1 "reg_or_0_operand" "")
3555 (match_operand:DI 2 "reg_or_8bit_operand" "")))
3556 (set (match_operand:DI 0 "register_operand" "")
3557 (if_then_else:DI (ne (match_dup 3) (const_int 0))
3558 (match_dup 1) (match_dup 2)))]
3560 { operands[3] = gen_reg_rtx (DImode); })
3563 [(set (match_operand:DI 0 "register_operand" "")
3564 (smin:DI (match_operand:DI 1 "reg_or_0_operand" "")
3565 (match_operand:DI 2 "reg_or_8bit_operand" "")))
3566 (clobber (match_operand:DI 3 "register_operand" ""))]
3567 "operands[2] != const0_rtx"
3568 [(set (match_dup 3) (lt:DI (match_dup 1) (match_dup 2)))
3569 (set (match_dup 0) (if_then_else:DI (ne (match_dup 3) (const_int 0))
3570 (match_dup 1) (match_dup 2)))]
3573 (define_insn "*smin_const0"
3574 [(set (match_operand:DI 0 "register_operand" "=r")
3575 (smin:DI (match_operand:DI 1 "register_operand" "0")
3579 [(set_attr "type" "icmov")])
3581 (define_expand "umaxdi3"
3583 (leu:DI (match_operand:DI 1 "reg_or_0_operand" "")
3584 (match_operand:DI 2 "reg_or_8bit_operand" "")))
3585 (set (match_operand:DI 0 "register_operand" "")
3586 (if_then_else:DI (eq (match_dup 3) (const_int 0))
3587 (match_dup 1) (match_dup 2)))]
3589 "operands[3] = gen_reg_rtx (DImode);")
3592 [(set (match_operand:DI 0 "register_operand" "")
3593 (umax:DI (match_operand:DI 1 "reg_or_0_operand" "")
3594 (match_operand:DI 2 "reg_or_8bit_operand" "")))
3595 (clobber (match_operand:DI 3 "register_operand" ""))]
3596 "operands[2] != const0_rtx"
3597 [(set (match_dup 3) (leu:DI (match_dup 1) (match_dup 2)))
3598 (set (match_dup 0) (if_then_else:DI (eq (match_dup 3) (const_int 0))
3599 (match_dup 1) (match_dup 2)))]
3602 (define_expand "umindi3"
3604 (ltu:DI (match_operand:DI 1 "reg_or_0_operand" "")
3605 (match_operand:DI 2 "reg_or_8bit_operand" "")))
3606 (set (match_operand:DI 0 "register_operand" "")
3607 (if_then_else:DI (ne (match_dup 3) (const_int 0))
3608 (match_dup 1) (match_dup 2)))]
3610 "operands[3] = gen_reg_rtx (DImode);")
3613 [(set (match_operand:DI 0 "register_operand" "")
3614 (umin:DI (match_operand:DI 1 "reg_or_0_operand" "")
3615 (match_operand:DI 2 "reg_or_8bit_operand" "")))
3616 (clobber (match_operand:DI 3 "register_operand" ""))]
3617 "operands[2] != const0_rtx"
3618 [(set (match_dup 3) (ltu:DI (match_dup 1) (match_dup 2)))
3619 (set (match_dup 0) (if_then_else:DI (ne (match_dup 3) (const_int 0))
3620 (match_dup 1) (match_dup 2)))]
3623 (define_insn "*bcc_normal"
3626 (match_operator 1 "signed_comparison_operator"
3627 [(match_operand:DI 2 "reg_or_0_operand" "rJ")
3629 (label_ref (match_operand 0 "" ""))
3633 [(set_attr "type" "ibr")])
3635 (define_insn "*bcc_reverse"
3638 (match_operator 1 "signed_comparison_operator"
3639 [(match_operand:DI 2 "register_operand" "r")
3643 (label_ref (match_operand 0 "" ""))))]
3646 [(set_attr "type" "ibr")])
3648 (define_insn "*blbs_normal"
3651 (ne (zero_extract:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
3655 (label_ref (match_operand 0 "" ""))
3659 [(set_attr "type" "ibr")])
3661 (define_insn "*blbc_normal"
3664 (eq (zero_extract:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
3668 (label_ref (match_operand 0 "" ""))
3672 [(set_attr "type" "ibr")])
3678 (match_operator 1 "comparison_operator"
3679 [(zero_extract:DI (match_operand:DI 2 "register_operand" "")
3681 (match_operand:DI 3 "const_int_operand" ""))
3683 (label_ref (match_operand 0 "" ""))
3685 (clobber (match_operand:DI 4 "register_operand" ""))])]
3686 "INTVAL (operands[3]) != 0"
3688 (lshiftrt:DI (match_dup 2) (match_dup 3)))
3690 (if_then_else (match_op_dup 1
3691 [(zero_extract:DI (match_dup 4)
3695 (label_ref (match_dup 0))
3699 ;; The following are the corresponding floating-point insns. Recall
3700 ;; we need to have variants that expand the arguments from SFmode
3703 (define_insn "*cmpdf_ieee"
3704 [(set (match_operand:DF 0 "register_operand" "=&f")
3705 (match_operator:DF 1 "alpha_fp_comparison_operator"
3706 [(match_operand:DF 2 "reg_or_0_operand" "fG")
3707 (match_operand:DF 3 "reg_or_0_operand" "fG")]))]
3708 "TARGET_FP && alpha_fptm >= ALPHA_FPTM_SU"
3709 "cmp%-%C1%/ %R2,%R3,%0"
3710 [(set_attr "type" "fadd")
3711 (set_attr "trap" "yes")
3712 (set_attr "trap_suffix" "su")])
3714 (define_insn "*cmpdf_internal"
3715 [(set (match_operand:DF 0 "register_operand" "=f")
3716 (match_operator:DF 1 "alpha_fp_comparison_operator"
3717 [(match_operand:DF 2 "reg_or_0_operand" "fG")
3718 (match_operand:DF 3 "reg_or_0_operand" "fG")]))]
3719 "TARGET_FP && alpha_fptm < ALPHA_FPTM_SU"
3720 "cmp%-%C1%/ %R2,%R3,%0"
3721 [(set_attr "type" "fadd")
3722 (set_attr "trap" "yes")
3723 (set_attr "trap_suffix" "su")])
3725 (define_insn "*cmpdf_ieee_ext1"
3726 [(set (match_operand:DF 0 "register_operand" "=&f")
3727 (match_operator:DF 1 "alpha_fp_comparison_operator"
3729 (match_operand:SF 2 "reg_or_0_operand" "fG"))
3730 (match_operand:DF 3 "reg_or_0_operand" "fG")]))]
3731 "TARGET_FP && alpha_fptm >= ALPHA_FPTM_SU"
3732 "cmp%-%C1%/ %R2,%R3,%0"
3733 [(set_attr "type" "fadd")
3734 (set_attr "trap" "yes")
3735 (set_attr "trap_suffix" "su")])
3737 (define_insn "*cmpdf_ext1"
3738 [(set (match_operand:DF 0 "register_operand" "=f")
3739 (match_operator:DF 1 "alpha_fp_comparison_operator"
3741 (match_operand:SF 2 "reg_or_0_operand" "fG"))
3742 (match_operand:DF 3 "reg_or_0_operand" "fG")]))]
3743 "TARGET_FP && alpha_fptm < ALPHA_FPTM_SU"
3744 "cmp%-%C1%/ %R2,%R3,%0"
3745 [(set_attr "type" "fadd")
3746 (set_attr "trap" "yes")
3747 (set_attr "trap_suffix" "su")])
3749 (define_insn "*cmpdf_ieee_ext2"
3750 [(set (match_operand:DF 0 "register_operand" "=&f")
3751 (match_operator:DF 1 "alpha_fp_comparison_operator"
3752 [(match_operand:DF 2 "reg_or_0_operand" "fG")
3754 (match_operand:SF 3 "reg_or_0_operand" "fG"))]))]
3755 "TARGET_FP && alpha_fptm >= ALPHA_FPTM_SU"
3756 "cmp%-%C1%/ %R2,%R3,%0"
3757 [(set_attr "type" "fadd")
3758 (set_attr "trap" "yes")
3759 (set_attr "trap_suffix" "su")])
3761 (define_insn "*cmpdf_ext2"
3762 [(set (match_operand:DF 0 "register_operand" "=f")
3763 (match_operator:DF 1 "alpha_fp_comparison_operator"
3764 [(match_operand:DF 2 "reg_or_0_operand" "fG")
3766 (match_operand:SF 3 "reg_or_0_operand" "fG"))]))]
3767 "TARGET_FP && alpha_fptm < ALPHA_FPTM_SU"
3768 "cmp%-%C1%/ %R2,%R3,%0"
3769 [(set_attr "type" "fadd")
3770 (set_attr "trap" "yes")
3771 (set_attr "trap_suffix" "su")])
3773 (define_insn "*cmpdf_ieee_ext3"
3774 [(set (match_operand:DF 0 "register_operand" "=&f")
3775 (match_operator:DF 1 "alpha_fp_comparison_operator"
3777 (match_operand:SF 2 "reg_or_0_operand" "fG"))
3779 (match_operand:SF 3 "reg_or_0_operand" "fG"))]))]
3780 "TARGET_FP && alpha_fptm >= ALPHA_FPTM_SU"
3781 "cmp%-%C1%/ %R2,%R3,%0"
3782 [(set_attr "type" "fadd")
3783 (set_attr "trap" "yes")
3784 (set_attr "trap_suffix" "su")])
3786 (define_insn "*cmpdf_ext3"
3787 [(set (match_operand:DF 0 "register_operand" "=f")
3788 (match_operator:DF 1 "alpha_fp_comparison_operator"
3790 (match_operand:SF 2 "reg_or_0_operand" "fG"))
3792 (match_operand:SF 3 "reg_or_0_operand" "fG"))]))]
3793 "TARGET_FP && alpha_fptm < ALPHA_FPTM_SU"
3794 "cmp%-%C1%/ %R2,%R3,%0"
3795 [(set_attr "type" "fadd")
3796 (set_attr "trap" "yes")
3797 (set_attr "trap_suffix" "su")])
3799 (define_insn "*movdfcc_internal"
3800 [(set (match_operand:DF 0 "register_operand" "=f,f")
3802 (match_operator 3 "signed_comparison_operator"
3803 [(match_operand:DF 4 "reg_or_0_operand" "fG,fG")
3804 (match_operand:DF 2 "const0_operand" "G,G")])
3805 (match_operand:DF 1 "reg_or_0_operand" "fG,0")
3806 (match_operand:DF 5 "reg_or_0_operand" "0,fG")))]
3810 fcmov%D3 %R4,%R5,%0"
3811 [(set_attr "type" "fcmov")])
3813 (define_insn "*movsfcc_internal"
3814 [(set (match_operand:SF 0 "register_operand" "=f,f")
3816 (match_operator 3 "signed_comparison_operator"
3817 [(match_operand:DF 4 "reg_or_0_operand" "fG,fG")
3818 (match_operand:DF 2 "const0_operand" "G,G")])
3819 (match_operand:SF 1 "reg_or_0_operand" "fG,0")
3820 (match_operand:SF 5 "reg_or_0_operand" "0,fG")))]
3824 fcmov%D3 %R4,%R5,%0"
3825 [(set_attr "type" "fcmov")])
3827 (define_insn "*movdfcc_ext1"
3828 [(set (match_operand:DF 0 "register_operand" "=f,f")
3830 (match_operator 3 "signed_comparison_operator"
3831 [(match_operand:DF 4 "reg_or_0_operand" "fG,fG")
3832 (match_operand:DF 2 "const0_operand" "G,G")])
3833 (float_extend:DF (match_operand:SF 1 "reg_or_0_operand" "fG,0"))
3834 (match_operand:DF 5 "reg_or_0_operand" "0,fG")))]
3838 fcmov%D3 %R4,%R5,%0"
3839 [(set_attr "type" "fcmov")])
3841 (define_insn "*movdfcc_ext2"
3842 [(set (match_operand:DF 0 "register_operand" "=f,f")
3844 (match_operator 3 "signed_comparison_operator"
3846 (match_operand:SF 4 "reg_or_0_operand" "fG,fG"))
3847 (match_operand:DF 2 "const0_operand" "G,G")])
3848 (match_operand:DF 1 "reg_or_0_operand" "fG,0")
3849 (match_operand:DF 5 "reg_or_0_operand" "0,fG")))]
3853 fcmov%D3 %R4,%R5,%0"
3854 [(set_attr "type" "fcmov")])
3856 (define_insn "*movdfcc_ext3"
3857 [(set (match_operand:SF 0 "register_operand" "=f,f")
3859 (match_operator 3 "signed_comparison_operator"
3861 (match_operand:SF 4 "reg_or_0_operand" "fG,fG"))
3862 (match_operand:DF 2 "const0_operand" "G,G")])
3863 (match_operand:SF 1 "reg_or_0_operand" "fG,0")
3864 (match_operand:SF 5 "reg_or_0_operand" "0,fG")))]
3868 fcmov%D3 %R4,%R5,%0"
3869 [(set_attr "type" "fcmov")])
3871 (define_insn "*movdfcc_ext4"
3872 [(set (match_operand:DF 0 "register_operand" "=f,f")
3874 (match_operator 3 "signed_comparison_operator"
3876 (match_operand:SF 4 "reg_or_0_operand" "fG,fG"))
3877 (match_operand:DF 2 "const0_operand" "G,G")])
3878 (float_extend:DF (match_operand:SF 1 "reg_or_0_operand" "fG,0"))
3879 (match_operand:DF 5 "reg_or_0_operand" "0,fG")))]
3883 fcmov%D3 %R4,%R5,%0"
3884 [(set_attr "type" "fcmov")])
3886 (define_expand "smaxdf3"
3888 (le:DF (match_operand:DF 1 "reg_or_0_operand" "")
3889 (match_operand:DF 2 "reg_or_0_operand" "")))
3890 (set (match_operand:DF 0 "register_operand" "")
3891 (if_then_else:DF (eq (match_dup 3) (match_dup 4))
3892 (match_dup 1) (match_dup 2)))]
3895 operands[3] = gen_reg_rtx (DFmode);
3896 operands[4] = CONST0_RTX (DFmode);
3899 (define_expand "smindf3"
3901 (lt:DF (match_operand:DF 1 "reg_or_0_operand" "")
3902 (match_operand:DF 2 "reg_or_0_operand" "")))
3903 (set (match_operand:DF 0 "register_operand" "")
3904 (if_then_else:DF (ne (match_dup 3) (match_dup 4))
3905 (match_dup 1) (match_dup 2)))]
3908 operands[3] = gen_reg_rtx (DFmode);
3909 operands[4] = CONST0_RTX (DFmode);
3912 (define_expand "smaxsf3"
3914 (le:DF (float_extend:DF (match_operand:SF 1 "reg_or_0_operand" ""))
3915 (float_extend:DF (match_operand:SF 2 "reg_or_0_operand" ""))))
3916 (set (match_operand:SF 0 "register_operand" "")
3917 (if_then_else:SF (eq (match_dup 3) (match_dup 4))
3918 (match_dup 1) (match_dup 2)))]
3921 operands[3] = gen_reg_rtx (DFmode);
3922 operands[4] = CONST0_RTX (DFmode);
3925 (define_expand "sminsf3"
3927 (lt:DF (float_extend:DF (match_operand:SF 1 "reg_or_0_operand" ""))
3928 (float_extend:DF (match_operand:SF 2 "reg_or_0_operand" ""))))
3929 (set (match_operand:SF 0 "register_operand" "")
3930 (if_then_else:SF (ne (match_dup 3) (match_dup 4))
3931 (match_dup 1) (match_dup 2)))]
3934 operands[3] = gen_reg_rtx (DFmode);
3935 operands[4] = CONST0_RTX (DFmode);
3938 (define_insn "*fbcc_normal"
3941 (match_operator 1 "signed_comparison_operator"
3942 [(match_operand:DF 2 "reg_or_0_operand" "fG")
3943 (match_operand:DF 3 "const0_operand" "G")])
3944 (label_ref (match_operand 0 "" ""))
3948 [(set_attr "type" "fbr")])
3950 (define_insn "*fbcc_ext_normal"
3953 (match_operator 1 "signed_comparison_operator"
3955 (match_operand:SF 2 "reg_or_0_operand" "fG"))
3956 (match_operand:DF 3 "const0_operand" "G")])
3957 (label_ref (match_operand 0 "" ""))
3961 [(set_attr "type" "fbr")])
3963 ;; These are the main define_expand's used to make conditional branches
3966 (define_expand "cmpdf"
3967 [(set (cc0) (compare (match_operand:DF 0 "reg_or_0_operand" "")
3968 (match_operand:DF 1 "reg_or_0_operand" "")))]
3971 alpha_compare.op0 = operands[0];
3972 alpha_compare.op1 = operands[1];
3973 alpha_compare.fp_p = 1;
3977 (define_expand "cmptf"
3978 [(set (cc0) (compare (match_operand:TF 0 "general_operand" "")
3979 (match_operand:TF 1 "general_operand" "")))]
3980 "TARGET_HAS_XFLOATING_LIBS"
3982 alpha_compare.op0 = operands[0];
3983 alpha_compare.op1 = operands[1];
3984 alpha_compare.fp_p = 1;
3988 (define_expand "cmpdi"
3989 [(set (cc0) (compare (match_operand:DI 0 "some_operand" "")
3990 (match_operand:DI 1 "some_operand" "")))]
3993 alpha_compare.op0 = operands[0];
3994 alpha_compare.op1 = operands[1];
3995 alpha_compare.fp_p = 0;
3999 (define_expand "beq"
4001 (if_then_else (match_dup 1)
4002 (label_ref (match_operand 0 "" ""))
4005 "{ operands[1] = alpha_emit_conditional_branch (EQ); }")
4007 (define_expand "bne"
4009 (if_then_else (match_dup 1)
4010 (label_ref (match_operand 0 "" ""))
4013 "{ operands[1] = alpha_emit_conditional_branch (NE); }")
4015 (define_expand "blt"
4017 (if_then_else (match_dup 1)
4018 (label_ref (match_operand 0 "" ""))
4021 "{ operands[1] = alpha_emit_conditional_branch (LT); }")
4023 (define_expand "ble"
4025 (if_then_else (match_dup 1)
4026 (label_ref (match_operand 0 "" ""))
4029 "{ operands[1] = alpha_emit_conditional_branch (LE); }")
4031 (define_expand "bgt"
4033 (if_then_else (match_dup 1)
4034 (label_ref (match_operand 0 "" ""))
4037 "{ operands[1] = alpha_emit_conditional_branch (GT); }")
4039 (define_expand "bge"
4041 (if_then_else (match_dup 1)
4042 (label_ref (match_operand 0 "" ""))
4045 "{ operands[1] = alpha_emit_conditional_branch (GE); }")
4047 (define_expand "bltu"
4049 (if_then_else (match_dup 1)
4050 (label_ref (match_operand 0 "" ""))
4053 "{ operands[1] = alpha_emit_conditional_branch (LTU); }")
4055 (define_expand "bleu"
4057 (if_then_else (match_dup 1)
4058 (label_ref (match_operand 0 "" ""))
4061 "{ operands[1] = alpha_emit_conditional_branch (LEU); }")
4063 (define_expand "bgtu"
4065 (if_then_else (match_dup 1)
4066 (label_ref (match_operand 0 "" ""))
4069 "{ operands[1] = alpha_emit_conditional_branch (GTU); }")
4071 (define_expand "bgeu"
4073 (if_then_else (match_dup 1)
4074 (label_ref (match_operand 0 "" ""))
4077 "{ operands[1] = alpha_emit_conditional_branch (GEU); }")
4079 (define_expand "bunordered"
4081 (if_then_else (match_dup 1)
4082 (label_ref (match_operand 0 "" ""))
4085 "{ operands[1] = alpha_emit_conditional_branch (UNORDERED); }")
4087 (define_expand "bordered"
4089 (if_then_else (match_dup 1)
4090 (label_ref (match_operand 0 "" ""))
4093 "{ operands[1] = alpha_emit_conditional_branch (ORDERED); }")
4095 (define_expand "seq"
4096 [(set (match_operand:DI 0 "register_operand" "")
4099 "{ if ((operands[1] = alpha_emit_setcc (EQ)) == NULL_RTX) FAIL; }")
4101 (define_expand "sne"
4102 [(set (match_operand:DI 0 "register_operand" "")
4105 "{ if ((operands[1] = alpha_emit_setcc (NE)) == NULL_RTX) FAIL; }")
4107 (define_expand "slt"
4108 [(set (match_operand:DI 0 "register_operand" "")
4111 "{ if ((operands[1] = alpha_emit_setcc (LT)) == NULL_RTX) FAIL; }")
4113 (define_expand "sle"
4114 [(set (match_operand:DI 0 "register_operand" "")
4117 "{ if ((operands[1] = alpha_emit_setcc (LE)) == NULL_RTX) FAIL; }")
4119 (define_expand "sgt"
4120 [(set (match_operand:DI 0 "register_operand" "")
4123 "{ if ((operands[1] = alpha_emit_setcc (GT)) == NULL_RTX) FAIL; }")
4125 (define_expand "sge"
4126 [(set (match_operand:DI 0 "register_operand" "")
4129 "{ if ((operands[1] = alpha_emit_setcc (GE)) == NULL_RTX) FAIL; }")
4131 (define_expand "sltu"
4132 [(set (match_operand:DI 0 "register_operand" "")
4135 "{ if ((operands[1] = alpha_emit_setcc (LTU)) == NULL_RTX) FAIL; }")
4137 (define_expand "sleu"
4138 [(set (match_operand:DI 0 "register_operand" "")
4141 "{ if ((operands[1] = alpha_emit_setcc (LEU)) == NULL_RTX) FAIL; }")
4143 (define_expand "sgtu"
4144 [(set (match_operand:DI 0 "register_operand" "")
4147 "{ if ((operands[1] = alpha_emit_setcc (GTU)) == NULL_RTX) FAIL; }")
4149 (define_expand "sgeu"
4150 [(set (match_operand:DI 0 "register_operand" "")
4153 "{ if ((operands[1] = alpha_emit_setcc (GEU)) == NULL_RTX) FAIL; }")
4155 (define_expand "sunordered"
4156 [(set (match_operand:DI 0 "register_operand" "")
4159 "{ if ((operands[1] = alpha_emit_setcc (UNORDERED)) == NULL_RTX) FAIL; }")
4161 (define_expand "sordered"
4162 [(set (match_operand:DI 0 "register_operand" "")
4165 "{ if ((operands[1] = alpha_emit_setcc (ORDERED)) == NULL_RTX) FAIL; }")
4167 ;; These are the main define_expand's used to make conditional moves.
4169 (define_expand "movsicc"
4170 [(set (match_operand:SI 0 "register_operand" "")
4171 (if_then_else:SI (match_operand 1 "comparison_operator" "")
4172 (match_operand:SI 2 "reg_or_8bit_operand" "")
4173 (match_operand:SI 3 "reg_or_8bit_operand" "")))]
4176 if ((operands[1] = alpha_emit_conditional_move (operands[1], SImode)) == 0)
4180 (define_expand "movdicc"
4181 [(set (match_operand:DI 0 "register_operand" "")
4182 (if_then_else:DI (match_operand 1 "comparison_operator" "")
4183 (match_operand:DI 2 "reg_or_8bit_operand" "")
4184 (match_operand:DI 3 "reg_or_8bit_operand" "")))]
4187 if ((operands[1] = alpha_emit_conditional_move (operands[1], DImode)) == 0)
4191 (define_expand "movsfcc"
4192 [(set (match_operand:SF 0 "register_operand" "")
4193 (if_then_else:SF (match_operand 1 "comparison_operator" "")
4194 (match_operand:SF 2 "reg_or_8bit_operand" "")
4195 (match_operand:SF 3 "reg_or_8bit_operand" "")))]
4198 if ((operands[1] = alpha_emit_conditional_move (operands[1], SFmode)) == 0)
4202 (define_expand "movdfcc"
4203 [(set (match_operand:DF 0 "register_operand" "")
4204 (if_then_else:DF (match_operand 1 "comparison_operator" "")
4205 (match_operand:DF 2 "reg_or_8bit_operand" "")
4206 (match_operand:DF 3 "reg_or_8bit_operand" "")))]
4209 if ((operands[1] = alpha_emit_conditional_move (operands[1], DFmode)) == 0)
4213 ;; These define_split definitions are used in cases when comparisons have
4214 ;; not be stated in the correct way and we need to reverse the second
4215 ;; comparison. For example, x >= 7 has to be done as x < 6 with the
4216 ;; comparison that tests the result being reversed. We have one define_split
4217 ;; for each use of a comparison. They do not match valid insns and need
4218 ;; not generate valid insns.
4220 ;; We can also handle equality comparisons (and inequality comparisons in
4221 ;; cases where the resulting add cannot overflow) by doing an add followed by
4222 ;; a comparison with zero. This is faster since the addition takes one
4223 ;; less cycle than a compare when feeding into a conditional move.
4224 ;; For this case, we also have an SImode pattern since we can merge the add
4225 ;; and sign extend and the order doesn't matter.
4227 ;; We do not do this for floating-point, since it isn't clear how the "wrong"
4228 ;; operation could have been generated.
4231 [(set (match_operand:DI 0 "register_operand" "")
4233 (match_operator 1 "comparison_operator"
4234 [(match_operand:DI 2 "reg_or_0_operand" "")
4235 (match_operand:DI 3 "reg_or_cint_operand" "")])
4236 (match_operand:DI 4 "reg_or_cint_operand" "")
4237 (match_operand:DI 5 "reg_or_cint_operand" "")))
4238 (clobber (match_operand:DI 6 "register_operand" ""))]
4239 "operands[3] != const0_rtx"
4240 [(set (match_dup 6) (match_dup 7))
4242 (if_then_else:DI (match_dup 8) (match_dup 4) (match_dup 5)))]
4244 enum rtx_code code = GET_CODE (operands[1]);
4245 int unsignedp = (code == GEU || code == LEU || code == GTU || code == LTU);
4247 /* If we are comparing for equality with a constant and that constant
4248 appears in the arm when the register equals the constant, use the
4249 register since that is more likely to match (and to produce better code
4252 if (code == EQ && CONST_INT_P (operands[3])
4253 && rtx_equal_p (operands[4], operands[3]))
4254 operands[4] = operands[2];
4256 else if (code == NE && CONST_INT_P (operands[3])
4257 && rtx_equal_p (operands[5], operands[3]))
4258 operands[5] = operands[2];
4260 if (code == NE || code == EQ
4261 || (extended_count (operands[2], DImode, unsignedp) >= 1
4262 && extended_count (operands[3], DImode, unsignedp) >= 1))
4264 if (CONST_INT_P (operands[3]))
4265 operands[7] = gen_rtx_PLUS (DImode, operands[2],
4266 GEN_INT (- INTVAL (operands[3])));
4268 operands[7] = gen_rtx_MINUS (DImode, operands[2], operands[3]);
4270 operands[8] = gen_rtx_fmt_ee (code, VOIDmode, operands[6], const0_rtx);
4273 else if (code == EQ || code == LE || code == LT
4274 || code == LEU || code == LTU)
4276 operands[7] = gen_rtx_fmt_ee (code, DImode, operands[2], operands[3]);
4277 operands[8] = gen_rtx_NE (VOIDmode, operands[6], const0_rtx);
4281 operands[7] = gen_rtx_fmt_ee (reverse_condition (code), DImode,
4282 operands[2], operands[3]);
4283 operands[8] = gen_rtx_EQ (VOIDmode, operands[6], const0_rtx);
4288 [(set (match_operand:DI 0 "register_operand" "")
4290 (match_operator 1 "comparison_operator"
4291 [(match_operand:SI 2 "reg_or_0_operand" "")
4292 (match_operand:SI 3 "reg_or_cint_operand" "")])
4293 (match_operand:DI 4 "reg_or_8bit_operand" "")
4294 (match_operand:DI 5 "reg_or_8bit_operand" "")))
4295 (clobber (match_operand:DI 6 "register_operand" ""))]
4296 "operands[3] != const0_rtx
4297 && (GET_CODE (operands[1]) == EQ || GET_CODE (operands[1]) == NE)"
4298 [(set (match_dup 6) (match_dup 7))
4300 (if_then_else:DI (match_dup 8) (match_dup 4) (match_dup 5)))]
4302 enum rtx_code code = GET_CODE (operands[1]);
4303 int unsignedp = (code == GEU || code == LEU || code == GTU || code == LTU);
4306 if ((code != NE && code != EQ
4307 && ! (extended_count (operands[2], DImode, unsignedp) >= 1
4308 && extended_count (operands[3], DImode, unsignedp) >= 1)))
4311 if (CONST_INT_P (operands[3]))
4312 tem = gen_rtx_PLUS (SImode, operands[2],
4313 GEN_INT (- INTVAL (operands[3])));
4315 tem = gen_rtx_MINUS (SImode, operands[2], operands[3]);
4317 operands[7] = gen_rtx_SIGN_EXTEND (DImode, tem);
4318 operands[8] = gen_rtx_fmt_ee (GET_CODE (operands[1]), VOIDmode,
4319 operands[6], const0_rtx);
4322 ;; Prefer to use cmp and arithmetic when possible instead of a cmove.
4325 [(set (match_operand 0 "register_operand" "")
4326 (if_then_else (match_operator 1 "signed_comparison_operator"
4327 [(match_operand:DI 2 "reg_or_0_operand" "")
4329 (match_operand 3 "const_int_operand" "")
4330 (match_operand 4 "const_int_operand" "")))]
4334 if (alpha_split_conditional_move (GET_CODE (operands[1]), operands[0],
4335 operands[2], operands[3], operands[4]))
4341 ;; ??? Why combine is allowed to create such non-canonical rtl, I don't know.
4342 ;; Oh well, we match it in movcc, so it must be partially our fault.
4344 [(set (match_operand 0 "register_operand" "")
4345 (if_then_else (match_operator 1 "signed_comparison_operator"
4347 (match_operand:DI 2 "reg_or_0_operand" "")])
4348 (match_operand 3 "const_int_operand" "")
4349 (match_operand 4 "const_int_operand" "")))]
4353 if (alpha_split_conditional_move (swap_condition (GET_CODE (operands[1])),
4354 operands[0], operands[2], operands[3],
4361 (define_insn_and_split "*cmp_sadd_di"
4362 [(set (match_operand:DI 0 "register_operand" "=r")
4363 (plus:DI (if_then_else:DI
4364 (match_operator 1 "alpha_zero_comparison_operator"
4365 [(match_operand:DI 2 "reg_or_0_operand" "rJ")
4367 (match_operand:DI 3 "const48_operand" "I")
4369 (match_operand:DI 4 "sext_add_operand" "rIO")))
4370 (clobber (match_scratch:DI 5 "=r"))]
4375 (match_op_dup:DI 1 [(match_dup 2) (const_int 0)]))
4377 (plus:DI (mult:DI (match_dup 5) (match_dup 3))
4380 if (can_create_pseudo_p ())
4381 operands[5] = gen_reg_rtx (DImode);
4382 else if (reg_overlap_mentioned_p (operands[5], operands[4]))
4383 operands[5] = operands[0];
4386 (define_insn_and_split "*cmp_sadd_si"
4387 [(set (match_operand:SI 0 "register_operand" "=r")
4388 (plus:SI (if_then_else:SI
4389 (match_operator 1 "alpha_zero_comparison_operator"
4390 [(match_operand:DI 2 "reg_or_0_operand" "rJ")
4392 (match_operand:SI 3 "const48_operand" "I")
4394 (match_operand:SI 4 "sext_add_operand" "rIO")))
4395 (clobber (match_scratch:SI 5 "=r"))]
4400 (match_op_dup:SI 1 [(match_dup 2) (const_int 0)]))
4402 (plus:SI (mult:SI (match_dup 5) (match_dup 3))
4405 if (can_create_pseudo_p ())
4406 operands[5] = gen_reg_rtx (DImode);
4407 else if (reg_overlap_mentioned_p (operands[5], operands[4]))
4408 operands[5] = operands[0];
4411 (define_insn_and_split "*cmp_sadd_sidi"
4412 [(set (match_operand:DI 0 "register_operand" "=r")
4414 (plus:SI (if_then_else:SI
4415 (match_operator 1 "alpha_zero_comparison_operator"
4416 [(match_operand:DI 2 "reg_or_0_operand" "rJ")
4418 (match_operand:SI 3 "const48_operand" "I")
4420 (match_operand:SI 4 "sext_add_operand" "rIO"))))
4421 (clobber (match_scratch:SI 5 "=r"))]
4426 (match_op_dup:SI 1 [(match_dup 2) (const_int 0)]))
4428 (sign_extend:DI (plus:SI (mult:SI (match_dup 5) (match_dup 3))
4431 if (can_create_pseudo_p ())
4432 operands[5] = gen_reg_rtx (DImode);
4433 else if (reg_overlap_mentioned_p (operands[5], operands[4]))
4434 operands[5] = operands[0];
4437 (define_insn_and_split "*cmp_ssub_di"
4438 [(set (match_operand:DI 0 "register_operand" "=r")
4439 (minus:DI (if_then_else:DI
4440 (match_operator 1 "alpha_zero_comparison_operator"
4441 [(match_operand:DI 2 "reg_or_0_operand" "rJ")
4443 (match_operand:DI 3 "const48_operand" "I")
4445 (match_operand:DI 4 "reg_or_8bit_operand" "rI")))
4446 (clobber (match_scratch:DI 5 "=r"))]
4451 (match_op_dup:DI 1 [(match_dup 2) (const_int 0)]))
4453 (minus:DI (mult:DI (match_dup 5) (match_dup 3))
4456 if (can_create_pseudo_p ())
4457 operands[5] = gen_reg_rtx (DImode);
4458 else if (reg_overlap_mentioned_p (operands[5], operands[4]))
4459 operands[5] = operands[0];
4462 (define_insn_and_split "*cmp_ssub_si"
4463 [(set (match_operand:SI 0 "register_operand" "=r")
4464 (minus:SI (if_then_else:SI
4465 (match_operator 1 "alpha_zero_comparison_operator"
4466 [(match_operand:DI 2 "reg_or_0_operand" "rJ")
4468 (match_operand:SI 3 "const48_operand" "I")
4470 (match_operand:SI 4 "reg_or_8bit_operand" "rI")))
4471 (clobber (match_scratch:SI 5 "=r"))]
4476 (match_op_dup:SI 1 [(match_dup 2) (const_int 0)]))
4478 (minus:SI (mult:SI (match_dup 5) (match_dup 3))
4481 if (can_create_pseudo_p ())
4482 operands[5] = gen_reg_rtx (DImode);
4483 else if (reg_overlap_mentioned_p (operands[5], operands[4]))
4484 operands[5] = operands[0];
4487 (define_insn_and_split "*cmp_ssub_sidi"
4488 [(set (match_operand:DI 0 "register_operand" "=r")
4490 (minus:SI (if_then_else:SI
4491 (match_operator 1 "alpha_zero_comparison_operator"
4492 [(match_operand:DI 2 "reg_or_0_operand" "rJ")
4494 (match_operand:SI 3 "const48_operand" "I")
4496 (match_operand:SI 4 "reg_or_8bit_operand" "rI"))))
4497 (clobber (match_scratch:SI 5 "=r"))]
4502 (match_op_dup:SI 1 [(match_dup 2) (const_int 0)]))
4504 (sign_extend:DI (minus:SI (mult:SI (match_dup 5) (match_dup 3))
4507 if (can_create_pseudo_p ())
4508 operands[5] = gen_reg_rtx (DImode);
4509 else if (reg_overlap_mentioned_p (operands[5], operands[4]))
4510 operands[5] = operands[0];
4513 ;; Here are the CALL and unconditional branch insns. Calls on NT and OSF
4514 ;; work differently, so we have different patterns for each.
4516 ;; On Unicos/Mk a call information word (CIW) must be generated for each
4517 ;; call. The CIW contains information about arguments passed in registers
4518 ;; and is stored in the caller's SSIB. Its offset relative to the beginning
4519 ;; of the SSIB is passed in $25. Handling this properly is quite complicated
4520 ;; in the presence of inlining since the CIWs for calls performed by the
4521 ;; inlined function must be stored in the SSIB of the function it is inlined
4522 ;; into as well. We encode the CIW in an unspec and append it to the list
4523 ;; of the CIWs for the current function only when the instruction for loading
4524 ;; $25 is generated.
4526 (define_expand "call"
4527 [(use (match_operand:DI 0 "" ""))
4528 (use (match_operand 1 "" ""))
4529 (use (match_operand 2 "" ""))
4530 (use (match_operand 3 "" ""))]
4533 if (TARGET_ABI_WINDOWS_NT)
4534 emit_call_insn (gen_call_nt (operands[0], operands[1]));
4535 else if (TARGET_ABI_OPEN_VMS)
4536 emit_call_insn (gen_call_vms (operands[0], operands[2]));
4537 else if (TARGET_ABI_UNICOSMK)
4538 emit_call_insn (gen_call_umk (operands[0], operands[2]));
4540 emit_call_insn (gen_call_osf (operands[0], operands[1]));
4544 (define_expand "sibcall"
4545 [(parallel [(call (mem:DI (match_operand 0 "" ""))
4546 (match_operand 1 "" ""))
4547 (unspec [(reg:DI 29)] UNSPEC_SIBCALL)])]
4550 gcc_assert (MEM_P (operands[0]));
4551 operands[0] = XEXP (operands[0], 0);
4554 (define_expand "call_osf"
4555 [(parallel [(call (mem:DI (match_operand 0 "" ""))
4556 (match_operand 1 "" ""))
4558 (clobber (reg:DI 26))])]
4561 gcc_assert (MEM_P (operands[0]));
4563 operands[0] = XEXP (operands[0], 0);
4564 if (! call_operand (operands[0], Pmode))
4565 operands[0] = copy_to_mode_reg (Pmode, operands[0]);
4568 (define_expand "call_nt"
4569 [(parallel [(call (mem:DI (match_operand 0 "" ""))
4570 (match_operand 1 "" ""))
4571 (clobber (reg:DI 26))])]
4574 gcc_assert (MEM_P (operands[0]));
4576 operands[0] = XEXP (operands[0], 0);
4577 if (GET_CODE (operands[0]) != SYMBOL_REF && !REG_P (operands[0]))
4578 operands[0] = force_reg (DImode, operands[0]);
4581 ;; Calls on Unicos/Mk are always indirect.
4582 ;; op 0: symbol ref for called function
4583 ;; op 1: CIW for $25 represented by an unspec
4585 (define_expand "call_umk"
4586 [(parallel [(call (mem:DI (match_operand 0 "" ""))
4587 (match_operand 1 "" ""))
4589 (clobber (reg:DI 26))])]
4592 gcc_assert (MEM_P (operands[0]));
4594 /* Always load the address of the called function into a register;
4595 load the CIW in $25. */
4597 operands[0] = XEXP (operands[0], 0);
4598 if (!REG_P (operands[0]))
4599 operands[0] = force_reg (DImode, operands[0]);
4601 emit_move_insn (gen_rtx_REG (DImode, 25), operands[1]);
4605 ;; call openvms/alpha
4606 ;; op 0: symbol ref for called function
4607 ;; op 1: next_arg_reg (argument information value for R25)
4609 (define_expand "call_vms"
4610 [(parallel [(call (mem:DI (match_operand 0 "" ""))
4611 (match_operand 1 "" ""))
4615 (clobber (reg:DI 27))])]
4618 gcc_assert (MEM_P (operands[0]));
4620 operands[0] = XEXP (operands[0], 0);
4622 /* Always load AI with argument information, then handle symbolic and
4623 indirect call differently. Load RA and set operands[2] to PV in
4626 emit_move_insn (gen_rtx_REG (DImode, 25), operands[1]);
4627 if (GET_CODE (operands[0]) == SYMBOL_REF)
4629 alpha_need_linkage (XSTR (operands[0], 0), 0);
4631 operands[2] = const0_rtx;
4635 emit_move_insn (gen_rtx_REG (Pmode, 26),
4636 gen_rtx_MEM (Pmode, plus_constant (operands[0], 8)));
4637 operands[2] = operands[0];
4642 (define_expand "call_value"
4643 [(use (match_operand 0 "" ""))
4644 (use (match_operand:DI 1 "" ""))
4645 (use (match_operand 2 "" ""))
4646 (use (match_operand 3 "" ""))
4647 (use (match_operand 4 "" ""))]
4650 if (TARGET_ABI_WINDOWS_NT)
4651 emit_call_insn (gen_call_value_nt (operands[0], operands[1], operands[2]));
4652 else if (TARGET_ABI_OPEN_VMS)
4653 emit_call_insn (gen_call_value_vms (operands[0], operands[1],
4655 else if (TARGET_ABI_UNICOSMK)
4656 emit_call_insn (gen_call_value_umk (operands[0], operands[1],
4659 emit_call_insn (gen_call_value_osf (operands[0], operands[1],
4664 (define_expand "sibcall_value"
4665 [(parallel [(set (match_operand 0 "" "")
4666 (call (mem:DI (match_operand 1 "" ""))
4667 (match_operand 2 "" "")))
4668 (unspec [(reg:DI 29)] UNSPEC_SIBCALL)])]
4671 gcc_assert (MEM_P (operands[1]));
4672 operands[1] = XEXP (operands[1], 0);
4675 (define_expand "call_value_osf"
4676 [(parallel [(set (match_operand 0 "" "")
4677 (call (mem:DI (match_operand 1 "" ""))
4678 (match_operand 2 "" "")))
4680 (clobber (reg:DI 26))])]
4683 gcc_assert (MEM_P (operands[1]));
4685 operands[1] = XEXP (operands[1], 0);
4686 if (! call_operand (operands[1], Pmode))
4687 operands[1] = copy_to_mode_reg (Pmode, operands[1]);
4690 (define_expand "call_value_nt"
4691 [(parallel [(set (match_operand 0 "" "")
4692 (call (mem:DI (match_operand 1 "" ""))
4693 (match_operand 2 "" "")))
4694 (clobber (reg:DI 26))])]
4697 gcc_assert (MEM_P (operands[1]));
4699 operands[1] = XEXP (operands[1], 0);
4700 if (GET_CODE (operands[1]) != SYMBOL_REF && !REG_P (operands[1]))
4701 operands[1] = force_reg (DImode, operands[1]);
4704 (define_expand "call_value_vms"
4705 [(parallel [(set (match_operand 0 "" "")
4706 (call (mem:DI (match_operand:DI 1 "" ""))
4707 (match_operand 2 "" "")))
4711 (clobber (reg:DI 27))])]
4714 gcc_assert (MEM_P (operands[1]));
4716 operands[1] = XEXP (operands[1], 0);
4718 /* Always load AI with argument information, then handle symbolic and
4719 indirect call differently. Load RA and set operands[3] to PV in
4722 emit_move_insn (gen_rtx_REG (DImode, 25), operands[2]);
4723 if (GET_CODE (operands[1]) == SYMBOL_REF)
4725 alpha_need_linkage (XSTR (operands[1], 0), 0);
4727 operands[3] = const0_rtx;
4731 emit_move_insn (gen_rtx_REG (Pmode, 26),
4732 gen_rtx_MEM (Pmode, plus_constant (operands[1], 8)));
4733 operands[3] = operands[1];
4737 (define_expand "call_value_umk"
4738 [(parallel [(set (match_operand 0 "" "")
4739 (call (mem:DI (match_operand 1 "" ""))
4740 (match_operand 2 "" "")))
4742 (clobber (reg:DI 26))])]
4745 gcc_assert (MEM_P (operands[1]));
4747 operands[1] = XEXP (operands[1], 0);
4748 if (!REG_P (operands[1]))
4749 operands[1] = force_reg (DImode, operands[1]);
4751 emit_move_insn (gen_rtx_REG (DImode, 25), operands[2]);
4754 (define_insn "*call_osf_1_er_noreturn"
4755 [(call (mem:DI (match_operand:DI 0 "call_operand" "c,R,s"))
4756 (match_operand 1 "" ""))
4758 (clobber (reg:DI 26))]
4759 "TARGET_EXPLICIT_RELOCS && TARGET_ABI_OSF
4760 && find_reg_note (insn, REG_NORETURN, NULL_RTX)"
4763 bsr $26,%0\t\t!samegp
4764 ldq $27,%0($29)\t\t!literal!%#\;jsr $26,($27),%0\t\t!lituse_jsr!%#"
4765 [(set_attr "type" "jsr")
4766 (set_attr "length" "*,*,8")])
4768 (define_insn "*call_osf_1_er"
4769 [(call (mem:DI (match_operand:DI 0 "call_operand" "c,R,s"))
4770 (match_operand 1 "" ""))
4772 (clobber (reg:DI 26))]
4773 "TARGET_EXPLICIT_RELOCS && TARGET_ABI_OSF"
4775 jsr $26,(%0),0\;ldah $29,0($26)\t\t!gpdisp!%*\;lda $29,0($29)\t\t!gpdisp!%*
4776 bsr $26,%0\t\t!samegp
4777 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!%*"
4778 [(set_attr "type" "jsr")
4779 (set_attr "length" "12,*,16")])
4781 ;; We must use peep2 instead of a split because we need accurate life
4782 ;; information for $gp. Consider the case of { bar(); while (1); }.
4784 [(parallel [(call (mem:DI (match_operand:DI 0 "call_operand" ""))
4785 (match_operand 1 "" ""))
4787 (clobber (reg:DI 26))])]
4788 "TARGET_EXPLICIT_RELOCS && TARGET_ABI_OSF && reload_completed
4789 && ! samegp_function_operand (operands[0], Pmode)
4790 && (peep2_regno_dead_p (1, 29)
4791 || find_reg_note (insn, REG_NORETURN, NULL_RTX))"
4792 [(parallel [(call (mem:DI (match_dup 2))
4797 (clobber (reg:DI 26))])]
4799 if (CONSTANT_P (operands[0]))
4801 operands[2] = gen_rtx_REG (Pmode, 27);
4802 operands[3] = GEN_INT (alpha_next_sequence_number++);
4803 emit_insn (gen_movdi_er_high_g (operands[2], pic_offset_table_rtx,
4804 operands[0], operands[3]));
4808 operands[2] = operands[0];
4809 operands[0] = const0_rtx;
4810 operands[3] = const0_rtx;
4815 [(parallel [(call (mem:DI (match_operand:DI 0 "call_operand" ""))
4816 (match_operand 1 "" ""))
4818 (clobber (reg:DI 26))])]
4819 "TARGET_EXPLICIT_RELOCS && TARGET_ABI_OSF && reload_completed
4820 && ! samegp_function_operand (operands[0], Pmode)
4821 && ! (peep2_regno_dead_p (1, 29)
4822 || find_reg_note (insn, REG_NORETURN, NULL_RTX))"
4823 [(parallel [(call (mem:DI (match_dup 2))
4826 (unspec:DI [(match_dup 5) (match_dup 3)] UNSPEC_LDGP1))
4829 (clobber (reg:DI 26))])
4831 (unspec:DI [(match_dup 5) (match_dup 3)] UNSPEC_LDGP2))]
4833 if (CONSTANT_P (operands[0]))
4835 operands[2] = gen_rtx_REG (Pmode, 27);
4836 operands[4] = GEN_INT (alpha_next_sequence_number++);
4837 emit_insn (gen_movdi_er_high_g (operands[2], pic_offset_table_rtx,
4838 operands[0], operands[4]));
4842 operands[2] = operands[0];
4843 operands[0] = const0_rtx;
4844 operands[4] = const0_rtx;
4846 operands[3] = GEN_INT (alpha_next_sequence_number++);
4847 operands[5] = pic_offset_table_rtx;
4850 (define_insn "*call_osf_2_er_nogp"
4851 [(call (mem:DI (match_operand:DI 0 "register_operand" "c"))
4852 (match_operand 1 "" ""))
4854 (use (match_operand 2 "" ""))
4855 (use (match_operand 3 "const_int_operand" ""))
4856 (clobber (reg:DI 26))]
4857 "TARGET_EXPLICIT_RELOCS && TARGET_ABI_OSF"
4858 "jsr $26,(%0),%2%J3"
4859 [(set_attr "type" "jsr")])
4861 (define_insn "*call_osf_2_er"
4862 [(call (mem:DI (match_operand:DI 0 "register_operand" "c"))
4863 (match_operand 1 "" ""))
4865 (unspec:DI [(reg:DI 29) (match_operand 4 "const_int_operand" "")]
4867 (use (match_operand 2 "" ""))
4868 (use (match_operand 3 "const_int_operand" ""))
4869 (clobber (reg:DI 26))]
4870 "TARGET_EXPLICIT_RELOCS && TARGET_ABI_OSF"
4871 "jsr $26,(%0),%2%J3\;ldah $29,0($26)\t\t!gpdisp!%4"
4872 [(set_attr "type" "jsr")
4873 (set_attr "cannot_copy" "true")
4874 (set_attr "length" "8")])
4876 (define_insn "*call_osf_1_noreturn"
4877 [(call (mem:DI (match_operand:DI 0 "call_operand" "c,R,s"))
4878 (match_operand 1 "" ""))
4880 (clobber (reg:DI 26))]
4881 "! TARGET_EXPLICIT_RELOCS && TARGET_ABI_OSF
4882 && find_reg_note (insn, REG_NORETURN, NULL_RTX)"
4887 [(set_attr "type" "jsr")
4888 (set_attr "length" "*,*,8")])
4890 (define_insn "*call_osf_1"
4891 [(call (mem:DI (match_operand:DI 0 "call_operand" "c,R,s"))
4892 (match_operand 1 "" ""))
4894 (clobber (reg:DI 26))]
4895 "! TARGET_EXPLICIT_RELOCS && TARGET_ABI_OSF"
4897 jsr $26,($27),0\;ldgp $29,0($26)
4899 jsr $26,%0\;ldgp $29,0($26)"
4900 [(set_attr "type" "jsr")
4901 (set_attr "length" "12,*,16")])
4903 (define_insn "*sibcall_osf_1_er"
4904 [(call (mem:DI (match_operand:DI 0 "symbolic_operand" "R,s"))
4905 (match_operand 1 "" ""))
4906 (unspec [(reg:DI 29)] UNSPEC_SIBCALL)]
4907 "TARGET_EXPLICIT_RELOCS && TARGET_ABI_OSF"
4909 br $31,%0\t\t!samegp
4910 ldq $27,%0($29)\t\t!literal!%#\;jmp $31,($27),%0\t\t!lituse_jsr!%#"
4911 [(set_attr "type" "jsr")
4912 (set_attr "length" "*,8")])
4914 ;; Note that the DEC assembler expands "jmp foo" with $at, which
4915 ;; doesn't do what we want.
4916 (define_insn "*sibcall_osf_1"
4917 [(call (mem:DI (match_operand:DI 0 "symbolic_operand" "R,s"))
4918 (match_operand 1 "" ""))
4919 (unspec [(reg:DI 29)] UNSPEC_SIBCALL)]
4920 "! TARGET_EXPLICIT_RELOCS && TARGET_ABI_OSF"
4923 lda $27,%0\;jmp $31,($27),%0"
4924 [(set_attr "type" "jsr")
4925 (set_attr "length" "*,8")])
4927 (define_insn "*call_nt_1"
4928 [(call (mem:DI (match_operand:DI 0 "call_operand" "r,R,s"))
4929 (match_operand 1 "" ""))
4930 (clobber (reg:DI 26))]
4931 "TARGET_ABI_WINDOWS_NT"
4936 [(set_attr "type" "jsr")
4937 (set_attr "length" "*,*,12")])
4939 ; GAS relies on the order and position of instructions output below in order
4940 ; to generate relocs for VMS link to potentially optimize the call.
4941 ; Please do not molest.
4942 (define_insn "*call_vms_1"
4943 [(call (mem:DI (match_operand:DI 0 "call_operand" "r,s"))
4944 (match_operand 1 "" ""))
4945 (use (match_operand:DI 2 "nonmemory_operand" "r,n"))
4948 (clobber (reg:DI 27))]
4949 "TARGET_ABI_OPEN_VMS"
4951 switch (which_alternative)
4954 return "mov %2,$27\;jsr $26,0\;ldq $27,0($29)";
4956 operands [2] = alpha_use_linkage (operands [0], cfun->decl, 1, 0);
4957 operands [3] = alpha_use_linkage (operands [0], cfun->decl, 0, 0);
4958 return "ldq $26,%3\;ldq $27,%2\;jsr $26,%0\;ldq $27,0($29)";
4963 [(set_attr "type" "jsr")
4964 (set_attr "length" "12,16")])
4966 (define_insn "*call_umk_1"
4967 [(call (mem:DI (match_operand:DI 0 "call_operand" "r"))
4968 (match_operand 1 "" ""))
4970 (clobber (reg:DI 26))]
4971 "TARGET_ABI_UNICOSMK"
4973 [(set_attr "type" "jsr")])
4975 ;; Call subroutine returning any type.
4977 (define_expand "untyped_call"
4978 [(parallel [(call (match_operand 0 "" "")
4980 (match_operand 1 "" "")
4981 (match_operand 2 "" "")])]
4986 emit_call_insn (GEN_CALL (operands[0], const0_rtx, NULL, const0_rtx));
4988 for (i = 0; i < XVECLEN (operands[2], 0); i++)
4990 rtx set = XVECEXP (operands[2], 0, i);
4991 emit_move_insn (SET_DEST (set), SET_SRC (set));
4994 /* The optimizer does not know that the call sets the function value
4995 registers we stored in the result block. We avoid problems by
4996 claiming that all hard registers are used and clobbered at this
4998 emit_insn (gen_blockage ());
5003 ;; UNSPEC_VOLATILE is considered to use and clobber all hard registers and
5004 ;; all of memory. This blocks insns from being moved across this point.
5006 (define_insn "blockage"
5007 [(unspec_volatile [(const_int 0)] UNSPECV_BLOCKAGE)]
5010 [(set_attr "length" "0")
5011 (set_attr "type" "none")])
5015 (label_ref (match_operand 0 "" "")))]
5018 [(set_attr "type" "ibr")])
5020 (define_expand "return"
5025 (define_insn "*return_internal"
5029 [(set_attr "type" "ibr")])
5031 (define_insn "indirect_jump"
5032 [(set (pc) (match_operand:DI 0 "register_operand" "r"))]
5035 [(set_attr "type" "ibr")])
5037 (define_expand "tablejump"
5038 [(parallel [(set (pc)
5039 (match_operand 0 "register_operand" ""))
5040 (use (label_ref:DI (match_operand 1 "" "")))])]
5043 if (TARGET_ABI_WINDOWS_NT)
5045 rtx dest = gen_reg_rtx (DImode);
5046 emit_insn (gen_extendsidi2 (dest, operands[0]));
5049 else if (TARGET_ABI_OSF)
5051 rtx dest = gen_reg_rtx (DImode);
5052 emit_insn (gen_extendsidi2 (dest, operands[0]));
5053 emit_insn (gen_adddi3 (dest, pic_offset_table_rtx, dest));
5058 (define_insn "*tablejump_osf_nt_internal"
5060 (match_operand:DI 0 "register_operand" "r"))
5061 (use (label_ref:DI (match_operand 1 "" "")))]
5062 "(TARGET_ABI_OSF || TARGET_ABI_WINDOWS_NT)
5063 && alpha_tablejump_addr_vec (insn)"
5065 operands[2] = alpha_tablejump_best_label (insn);
5066 return "jmp $31,(%0),%2";
5068 [(set_attr "type" "ibr")])
5070 (define_insn "*tablejump_internal"
5072 (match_operand:DI 0 "register_operand" "r"))
5073 (use (label_ref (match_operand 1 "" "")))]
5076 [(set_attr "type" "ibr")])
5078 ;; Cache flush. Used by INITIALIZE_TRAMPOLINE. 0x86 is PAL_imb, but we don't
5079 ;; want to have to include pal.h in our .s file.
5081 [(unspec_volatile [(const_int 0)] UNSPECV_IMB)]
5084 [(set_attr "type" "callpal")])
5086 ;; BUGCHK is documented common to OSF/1 and VMS PALcode.
5087 ;; NT does not document anything at 0x81 -- presumably it would generate
5088 ;; the equivalent of SIGILL, but this isn't that important.
5089 ;; ??? Presuming unicosmk uses either OSF/1 or VMS PALcode.
5091 [(trap_if (const_int 1) (const_int 0))]
5092 "!TARGET_ABI_WINDOWS_NT"
5094 [(set_attr "type" "callpal")])
5096 ;; For userland, we load the thread pointer from the TCB.
5097 ;; For the kernel, we load the per-cpu private value.
5099 (define_insn "load_tp"
5100 [(set (match_operand:DI 0 "register_operand" "=v")
5101 (unspec:DI [(const_int 0)] UNSPEC_TP))]
5104 if (TARGET_TLS_KERNEL)
5105 return "call_pal 0x32";
5107 return "call_pal 0x9e";
5109 [(set_attr "type" "callpal")])
5111 ;; For completeness, and possibly a __builtin function, here's how to
5112 ;; set the thread pointer. Since we don't describe enough of this
5113 ;; quantity for CSE, we have to use a volatile unspec, and then there's
5114 ;; not much point in creating an R16_REG register class.
5116 (define_expand "set_tp"
5117 [(set (reg:DI 16) (match_operand:DI 0 "input_operand" ""))
5118 (unspec_volatile [(reg:DI 16)] UNSPECV_SET_TP)]
5122 (define_insn "*set_tp"
5123 [(unspec_volatile [(reg:DI 16)] UNSPECV_SET_TP)]
5126 if (TARGET_TLS_KERNEL)
5127 return "call_pal 0x31";
5129 return "call_pal 0x9f";
5131 [(set_attr "type" "callpal")])
5133 ;; Finally, we have the basic data motion insns. The byte and word insns
5134 ;; are done via define_expand. Start with the floating-point insns, since
5135 ;; they are simpler.
5137 (define_insn "*movsf_nofix"
5138 [(set (match_operand:SF 0 "nonimmediate_operand" "=f,f,*r,*r,m,m")
5139 (match_operand:SF 1 "input_operand" "fG,m,*rG,m,fG,*r"))]
5140 "TARGET_FPREGS && ! TARGET_FIX
5141 && (register_operand (operands[0], SFmode)
5142 || reg_or_0_operand (operands[1], SFmode))"
5150 [(set_attr "type" "fcpys,fld,ilog,ild,fst,ist")])
5152 (define_insn "*movsf_fix"
5153 [(set (match_operand:SF 0 "nonimmediate_operand" "=f,f,*r,*r,m,m,f,*r")
5154 (match_operand:SF 1 "input_operand" "fG,m,*rG,m,fG,*r,*r,f"))]
5155 "TARGET_FPREGS && TARGET_FIX
5156 && (register_operand (operands[0], SFmode)
5157 || reg_or_0_operand (operands[1], SFmode))"
5167 [(set_attr "type" "fcpys,fld,ilog,ild,fst,ist,itof,ftoi")])
5169 (define_insn "*movsf_nofp"
5170 [(set (match_operand:SF 0 "nonimmediate_operand" "=r,r,m")
5171 (match_operand:SF 1 "input_operand" "rG,m,r"))]
5173 && (register_operand (operands[0], SFmode)
5174 || reg_or_0_operand (operands[1], SFmode))"
5179 [(set_attr "type" "ilog,ild,ist")])
5181 (define_insn "*movdf_nofix"
5182 [(set (match_operand:DF 0 "nonimmediate_operand" "=f,f,*r,*r,m,m")
5183 (match_operand:DF 1 "input_operand" "fG,m,*rG,m,fG,*r"))]
5184 "TARGET_FPREGS && ! TARGET_FIX
5185 && (register_operand (operands[0], DFmode)
5186 || reg_or_0_operand (operands[1], DFmode))"
5194 [(set_attr "type" "fcpys,fld,ilog,ild,fst,ist")])
5196 (define_insn "*movdf_fix"
5197 [(set (match_operand:DF 0 "nonimmediate_operand" "=f,f,*r,*r,m,m,f,*r")
5198 (match_operand:DF 1 "input_operand" "fG,m,*rG,m,fG,*r,*r,f"))]
5199 "TARGET_FPREGS && TARGET_FIX
5200 && (register_operand (operands[0], DFmode)
5201 || reg_or_0_operand (operands[1], DFmode))"
5211 [(set_attr "type" "fcpys,fld,ilog,ild,fst,ist,itof,ftoi")])
5213 (define_insn "*movdf_nofp"
5214 [(set (match_operand:DF 0 "nonimmediate_operand" "=r,r,m")
5215 (match_operand:DF 1 "input_operand" "rG,m,r"))]
5217 && (register_operand (operands[0], DFmode)
5218 || reg_or_0_operand (operands[1], DFmode))"
5223 [(set_attr "type" "ilog,ild,ist")])
5225 ;; Subregs suck for register allocation. Pretend we can move TFmode
5226 ;; data between general registers until after reload.
5228 (define_insn_and_split "*movtf_internal"
5229 [(set (match_operand:TF 0 "nonimmediate_operand" "=r,o")
5230 (match_operand:TF 1 "input_operand" "roG,rG"))]
5231 "register_operand (operands[0], TFmode)
5232 || reg_or_0_operand (operands[1], TFmode)"
5235 [(set (match_dup 0) (match_dup 2))
5236 (set (match_dup 1) (match_dup 3))]
5238 alpha_split_tmode_pair (operands, TFmode, true);
5241 (define_expand "movsf"
5242 [(set (match_operand:SF 0 "nonimmediate_operand" "")
5243 (match_operand:SF 1 "general_operand" ""))]
5246 if (MEM_P (operands[0])
5247 && ! reg_or_0_operand (operands[1], SFmode))
5248 operands[1] = force_reg (SFmode, operands[1]);
5251 (define_expand "movdf"
5252 [(set (match_operand:DF 0 "nonimmediate_operand" "")
5253 (match_operand:DF 1 "general_operand" ""))]
5256 if (MEM_P (operands[0])
5257 && ! reg_or_0_operand (operands[1], DFmode))
5258 operands[1] = force_reg (DFmode, operands[1]);
5261 (define_expand "movtf"
5262 [(set (match_operand:TF 0 "nonimmediate_operand" "")
5263 (match_operand:TF 1 "general_operand" ""))]
5266 if (MEM_P (operands[0])
5267 && ! reg_or_0_operand (operands[1], TFmode))
5268 operands[1] = force_reg (TFmode, operands[1]);
5271 (define_insn "*movsi"
5272 [(set (match_operand:SI 0 "nonimmediate_operand" "=r,r,r,r,r,m")
5273 (match_operand:SI 1 "input_operand" "rJ,K,L,n,m,rJ"))]
5274 "(TARGET_ABI_OSF || TARGET_ABI_UNICOSMK)
5275 && (register_operand (operands[0], SImode)
5276 || reg_or_0_operand (operands[1], SImode))"
5284 [(set_attr "type" "ilog,iadd,iadd,multi,ild,ist")])
5286 (define_insn "*movsi_nt_vms"
5287 [(set (match_operand:SI 0 "nonimmediate_operand" "=r,r,r,r,r,r,m")
5288 (match_operand:SI 1 "input_operand" "rJ,K,L,s,n,m,rJ"))]
5289 "(TARGET_ABI_WINDOWS_NT || TARGET_ABI_OPEN_VMS)
5290 && (register_operand (operands[0], SImode)
5291 || reg_or_0_operand (operands[1], SImode))"
5300 [(set_attr "type" "ilog,iadd,iadd,ldsym,multi,ild,ist")])
5302 (define_insn "*movhi_nobwx"
5303 [(set (match_operand:HI 0 "register_operand" "=r,r")
5304 (match_operand:HI 1 "input_operand" "rJ,n"))]
5306 && (register_operand (operands[0], HImode)
5307 || register_operand (operands[1], HImode))"
5311 [(set_attr "type" "ilog,iadd")])
5313 (define_insn "*movhi_bwx"
5314 [(set (match_operand:HI 0 "nonimmediate_operand" "=r,r,r,m")
5315 (match_operand:HI 1 "input_operand" "rJ,n,m,rJ"))]
5317 && (register_operand (operands[0], HImode)
5318 || reg_or_0_operand (operands[1], HImode))"
5324 [(set_attr "type" "ilog,iadd,ild,ist")])
5326 (define_insn "*movqi_nobwx"
5327 [(set (match_operand:QI 0 "register_operand" "=r,r")
5328 (match_operand:QI 1 "input_operand" "rJ,n"))]
5330 && (register_operand (operands[0], QImode)
5331 || register_operand (operands[1], QImode))"
5335 [(set_attr "type" "ilog,iadd")])
5337 (define_insn "*movqi_bwx"
5338 [(set (match_operand:QI 0 "nonimmediate_operand" "=r,r,r,m")
5339 (match_operand:QI 1 "input_operand" "rJ,n,m,rJ"))]
5341 && (register_operand (operands[0], QImode)
5342 || reg_or_0_operand (operands[1], QImode))"
5348 [(set_attr "type" "ilog,iadd,ild,ist")])
5350 ;; We do two major things here: handle mem->mem and construct long
5353 (define_expand "movsi"
5354 [(set (match_operand:SI 0 "nonimmediate_operand" "")
5355 (match_operand:SI 1 "general_operand" ""))]
5358 if (alpha_expand_mov (SImode, operands))
5362 ;; Split a load of a large constant into the appropriate two-insn
5366 [(set (match_operand:SI 0 "register_operand" "")
5367 (match_operand:SI 1 "non_add_const_operand" ""))]
5371 if (alpha_split_const_mov (SImode, operands))
5377 ;; Split the load of an address into a four-insn sequence on Unicos/Mk.
5378 ;; Always generate a REG_EQUAL note for the last instruction to facilitate
5379 ;; optimizations. If the symbolic operand is a label_ref, generate
5380 ;; REG_LABEL_OPERAND notes and update LABEL_NUSES because this is not done
5381 ;; automatically. Labels may be incorrectly deleted if we don't do this.
5383 ;; Describing what the individual instructions do correctly is too complicated
5384 ;; so use UNSPECs for each of the three parts of an address.
5387 [(set (match_operand:DI 0 "register_operand" "")
5388 (match_operand:DI 1 "symbolic_operand" ""))]
5389 "TARGET_ABI_UNICOSMK && reload_completed"
5392 rtx insn1, insn2, insn3;
5394 insn1 = emit_insn (gen_umk_laum (operands[0], operands[1]));
5395 emit_insn (gen_ashldi3 (operands[0], operands[0], GEN_INT (32)));
5396 insn2 = emit_insn (gen_umk_lalm (operands[0], operands[0], operands[1]));
5397 insn3 = emit_insn (gen_umk_lal (operands[0], operands[0], operands[1]));
5398 set_unique_reg_note (insn3, REG_EQUAL, operands[1]);
5400 if (GET_CODE (operands[1]) == LABEL_REF)
5404 label = XEXP (operands[1], 0);
5405 add_reg_note (insn1, REG_LABEL_OPERAND, label);
5406 add_reg_note (insn2, REG_LABEL_OPERAND, label);
5407 add_reg_note (insn3, REG_LABEL_OPERAND, label);
5408 LABEL_NUSES (label) += 3;
5413 ;; Instructions for loading the three parts of an address on Unicos/Mk.
5415 (define_insn "umk_laum"
5416 [(set (match_operand:DI 0 "register_operand" "=r")
5417 (unspec:DI [(match_operand:DI 1 "symbolic_operand" "")]
5419 "TARGET_ABI_UNICOSMK"
5421 [(set_attr "type" "iadd")])
5423 (define_insn "umk_lalm"
5424 [(set (match_operand:DI 0 "register_operand" "=r")
5425 (plus:DI (match_operand:DI 1 "register_operand" "r")
5426 (unspec:DI [(match_operand:DI 2 "symbolic_operand" "")]
5428 "TARGET_ABI_UNICOSMK"
5430 [(set_attr "type" "iadd")])
5432 (define_insn "umk_lal"
5433 [(set (match_operand:DI 0 "register_operand" "=r")
5434 (plus:DI (match_operand:DI 1 "register_operand" "r")
5435 (unspec:DI [(match_operand:DI 2 "symbolic_operand" "")]
5437 "TARGET_ABI_UNICOSMK"
5439 [(set_attr "type" "iadd")])
5441 ;; Add a new call information word to the current function's list of CIWs
5442 ;; and load its index into $25. Doing it here ensures that the CIW will be
5443 ;; associated with the correct function even in the presence of inlining.
5445 (define_insn "*umk_load_ciw"
5447 (unspec:DI [(match_operand 0 "" "")] UNSPEC_UMK_LOAD_CIW))]
5448 "TARGET_ABI_UNICOSMK"
5450 operands[0] = unicosmk_add_call_info_word (operands[0]);
5451 return "lda $25,%0";
5453 [(set_attr "type" "iadd")])
5455 (define_insn "*movdi_er_low_l"
5456 [(set (match_operand:DI 0 "register_operand" "=r")
5457 (lo_sum:DI (match_operand:DI 1 "register_operand" "r")
5458 (match_operand:DI 2 "local_symbolic_operand" "")))]
5459 "TARGET_EXPLICIT_RELOCS"
5461 if (true_regnum (operands[1]) == 29)
5462 return "lda %0,%2(%1)\t\t!gprel";
5464 return "lda %0,%2(%1)\t\t!gprellow";
5466 [(set_attr "usegp" "yes")])
5469 [(set (match_operand:DI 0 "register_operand" "")
5470 (match_operand:DI 1 "small_symbolic_operand" ""))]
5471 "TARGET_EXPLICIT_RELOCS && reload_completed"
5473 (lo_sum:DI (match_dup 2) (match_dup 1)))]
5474 "operands[2] = pic_offset_table_rtx;")
5477 [(set (match_operand:DI 0 "register_operand" "")
5478 (match_operand:DI 1 "local_symbolic_operand" ""))]
5479 "TARGET_EXPLICIT_RELOCS && reload_completed"
5481 (plus:DI (match_dup 2) (high:DI (match_dup 1))))
5483 (lo_sum:DI (match_dup 0) (match_dup 1)))]
5484 "operands[2] = pic_offset_table_rtx;")
5487 [(match_operand 0 "some_small_symbolic_operand" "")]
5490 "operands[0] = split_small_symbolic_operand (operands[0]);")
5492 ;; Accepts any symbolic, not just global, since function calls that
5493 ;; don't go via bsr still use !literal in hopes of linker relaxation.
5494 (define_insn "movdi_er_high_g"
5495 [(set (match_operand:DI 0 "register_operand" "=r")
5496 (unspec:DI [(match_operand:DI 1 "register_operand" "r")
5497 (match_operand:DI 2 "symbolic_operand" "")
5498 (match_operand 3 "const_int_operand" "")]
5500 "TARGET_EXPLICIT_RELOCS"
5502 if (INTVAL (operands[3]) == 0)
5503 return "ldq %0,%2(%1)\t\t!literal";
5505 return "ldq %0,%2(%1)\t\t!literal!%3";
5507 [(set_attr "type" "ldsym")])
5510 [(set (match_operand:DI 0 "register_operand" "")
5511 (match_operand:DI 1 "global_symbolic_operand" ""))]
5512 "TARGET_EXPLICIT_RELOCS && reload_completed"
5514 (unspec:DI [(match_dup 2)
5516 (const_int 0)] UNSPEC_LITERAL))]
5517 "operands[2] = pic_offset_table_rtx;")
5519 (define_insn "movdi_er_tlsgd"
5520 [(set (match_operand:DI 0 "register_operand" "=r")
5521 (unspec:DI [(match_operand:DI 1 "register_operand" "r")
5522 (match_operand:DI 2 "symbolic_operand" "")
5523 (match_operand 3 "const_int_operand" "")]
5527 if (INTVAL (operands[3]) == 0)
5528 return "lda %0,%2(%1)\t\t!tlsgd";
5530 return "lda %0,%2(%1)\t\t!tlsgd!%3";
5533 (define_insn "movdi_er_tlsldm"
5534 [(set (match_operand:DI 0 "register_operand" "=r")
5535 (unspec:DI [(match_operand:DI 1 "register_operand" "r")
5536 (match_operand 2 "const_int_operand" "")]
5540 if (INTVAL (operands[2]) == 0)
5541 return "lda %0,%&(%1)\t\t!tlsldm";
5543 return "lda %0,%&(%1)\t\t!tlsldm!%2";
5546 (define_insn "*movdi_er_gotdtp"
5547 [(set (match_operand:DI 0 "register_operand" "=r")
5548 (unspec:DI [(match_operand:DI 1 "register_operand" "r")
5549 (match_operand:DI 2 "symbolic_operand" "")]
5552 "ldq %0,%2(%1)\t\t!gotdtprel"
5553 [(set_attr "type" "ild")
5554 (set_attr "usegp" "yes")])
5557 [(set (match_operand:DI 0 "register_operand" "")
5558 (match_operand:DI 1 "gotdtp_symbolic_operand" ""))]
5559 "HAVE_AS_TLS && reload_completed"
5561 (unspec:DI [(match_dup 2)
5562 (match_dup 1)] UNSPEC_DTPREL))]
5564 operands[1] = XVECEXP (XEXP (operands[1], 0), 0, 0);
5565 operands[2] = pic_offset_table_rtx;
5568 (define_insn "*movdi_er_gottp"
5569 [(set (match_operand:DI 0 "register_operand" "=r")
5570 (unspec:DI [(match_operand:DI 1 "register_operand" "r")
5571 (match_operand:DI 2 "symbolic_operand" "")]
5574 "ldq %0,%2(%1)\t\t!gottprel"
5575 [(set_attr "type" "ild")
5576 (set_attr "usegp" "yes")])
5579 [(set (match_operand:DI 0 "register_operand" "")
5580 (match_operand:DI 1 "gottp_symbolic_operand" ""))]
5581 "HAVE_AS_TLS && reload_completed"
5583 (unspec:DI [(match_dup 2)
5584 (match_dup 1)] UNSPEC_TPREL))]
5586 operands[1] = XVECEXP (XEXP (operands[1], 0), 0, 0);
5587 operands[2] = pic_offset_table_rtx;
5590 (define_insn "*movdi_er_nofix"
5591 [(set (match_operand:DI 0 "nonimmediate_operand" "=r,r,r,r,r,r,r,m,*f,*f,Q")
5592 (match_operand:DI 1 "input_operand" "rJ,K,L,T,s,n,m,rJ,*fJ,Q,*f"))]
5593 "TARGET_EXPLICIT_RELOCS && ! TARGET_FIX
5594 && (register_operand (operands[0], DImode)
5595 || reg_or_0_operand (operands[1], DImode))"
5608 [(set_attr "type" "ilog,iadd,iadd,iadd,ldsym,multi,ild,ist,fcpys,fld,fst")
5609 (set_attr "usegp" "*,*,*,yes,*,*,*,*,*,*,*")])
5611 ;; The 'U' constraint matches symbolic operands on Unicos/Mk. Those should
5612 ;; have been split up by the rules above but we shouldn't reject the
5613 ;; possibility of them getting through.
5615 (define_insn "*movdi_nofix"
5616 [(set (match_operand:DI 0 "nonimmediate_operand" "=r,r,r,r,r,r,r,m,*f,*f,Q")
5617 (match_operand:DI 1 "input_operand" "rJ,K,L,U,s,n,m,rJ,*fJ,Q,*f"))]
5619 && (register_operand (operands[0], DImode)
5620 || reg_or_0_operand (operands[1], DImode))"
5625 laum %0,%t1($31)\;sll %0,32,%0\;lalm %0,%t1(%0)\;lal %0,%t1(%0)
5633 [(set_attr "type" "ilog,iadd,iadd,ldsym,ldsym,multi,ild,ist,fcpys,fld,fst")
5634 (set_attr "length" "*,*,*,16,*,*,*,*,*,*,*")])
5636 (define_insn "*movdi_er_fix"
5637 [(set (match_operand:DI 0 "nonimmediate_operand"
5638 "=r,r,r,r,r,r,r, m, *f,*f, Q, r,*f")
5639 (match_operand:DI 1 "input_operand"
5640 "rJ,K,L,T,s,n,m,rJ,*fJ, Q,*f,*f, r"))]
5641 "TARGET_EXPLICIT_RELOCS && TARGET_FIX
5642 && (register_operand (operands[0], DImode)
5643 || reg_or_0_operand (operands[1], DImode))"
5658 [(set_attr "type" "ilog,iadd,iadd,iadd,ldsym,multi,ild,ist,fcpys,fld,fst,ftoi,itof")
5659 (set_attr "usegp" "*,*,*,yes,*,*,*,*,*,*,*,*,*")])
5661 (define_insn "*movdi_fix"
5662 [(set (match_operand:DI 0 "nonimmediate_operand" "=r,r,r,r,r,r,m,*f,*f,Q,r,*f")
5663 (match_operand:DI 1 "input_operand" "rJ,K,L,s,n,m,rJ,*fJ,Q,*f,*f,r"))]
5664 "! TARGET_EXPLICIT_RELOCS && TARGET_FIX
5665 && (register_operand (operands[0], DImode)
5666 || reg_or_0_operand (operands[1], DImode))"
5680 [(set_attr "type" "ilog,iadd,iadd,ldsym,multi,ild,ist,fcpys,fld,fst,ftoi,itof")])
5682 ;; VMS needs to set up "vms_base_regno" for unwinding. This move
5683 ;; often appears dead to the life analysis code, at which point we
5684 ;; die for emitting dead prologue instructions. Force this live.
5686 (define_insn "force_movdi"
5687 [(set (match_operand:DI 0 "register_operand" "=r")
5688 (unspec_volatile:DI [(match_operand:DI 1 "register_operand" "r")]
5689 UNSPECV_FORCE_MOV))]
5692 [(set_attr "type" "ilog")])
5694 ;; We do three major things here: handle mem->mem, put 64-bit constants in
5695 ;; memory, and construct long 32-bit constants.
5697 (define_expand "movdi"
5698 [(set (match_operand:DI 0 "nonimmediate_operand" "")
5699 (match_operand:DI 1 "general_operand" ""))]
5702 if (alpha_expand_mov (DImode, operands))
5706 ;; Split a load of a large constant into the appropriate two-insn
5710 [(set (match_operand:DI 0 "register_operand" "")
5711 (match_operand:DI 1 "non_add_const_operand" ""))]
5715 if (alpha_split_const_mov (DImode, operands))
5721 ;; We need to prevent reload from splitting TImode moves, because it
5722 ;; might decide to overwrite a pointer with the value it points to.
5723 ;; In that case we have to do the loads in the appropriate order so
5724 ;; that the pointer is not destroyed too early.
5726 (define_insn_and_split "*movti_internal"
5727 [(set (match_operand:TI 0 "nonimmediate_operand" "=r,o")
5728 (match_operand:TI 1 "input_operand" "roJ,rJ"))]
5729 "(register_operand (operands[0], TImode)
5730 /* Prevent rematerialization of constants. */
5731 && ! CONSTANT_P (operands[1]))
5732 || reg_or_0_operand (operands[1], TImode)"
5735 [(set (match_dup 0) (match_dup 2))
5736 (set (match_dup 1) (match_dup 3))]
5738 alpha_split_tmode_pair (operands, TImode, true);
5741 (define_expand "movti"
5742 [(set (match_operand:TI 0 "nonimmediate_operand" "")
5743 (match_operand:TI 1 "general_operand" ""))]
5746 if (MEM_P (operands[0])
5747 && ! reg_or_0_operand (operands[1], TImode))
5748 operands[1] = force_reg (TImode, operands[1]);
5750 if (operands[1] == const0_rtx)
5752 /* We must put 64-bit constants in memory. We could keep the
5753 32-bit constants in TImode and rely on the splitter, but
5754 this doesn't seem to be worth the pain. */
5755 else if (CONST_INT_P (operands[1])
5756 || GET_CODE (operands[1]) == CONST_DOUBLE)
5758 rtx in[2], out[2], target;
5760 gcc_assert (can_create_pseudo_p ());
5762 split_double (operands[1], &in[0], &in[1]);
5764 if (in[0] == const0_rtx)
5765 out[0] = const0_rtx;
5768 out[0] = gen_reg_rtx (DImode);
5769 emit_insn (gen_movdi (out[0], in[0]));
5772 if (in[1] == const0_rtx)
5773 out[1] = const0_rtx;
5776 out[1] = gen_reg_rtx (DImode);
5777 emit_insn (gen_movdi (out[1], in[1]));
5780 if (!REG_P (operands[0]))
5781 target = gen_reg_rtx (TImode);
5783 target = operands[0];
5785 emit_insn (gen_movdi (operand_subword (target, 0, 0, TImode), out[0]));
5786 emit_insn (gen_movdi (operand_subword (target, 1, 0, TImode), out[1]));
5788 if (target != operands[0])
5789 emit_insn (gen_rtx_SET (VOIDmode, operands[0], target));
5795 ;; These are the partial-word cases.
5797 ;; First we have the code to load an aligned word. Operand 0 is the register
5798 ;; in which to place the result. It's mode is QImode or HImode. Operand 1
5799 ;; is an SImode MEM at the low-order byte of the proper word. Operand 2 is the
5800 ;; number of bits within the word that the value is. Operand 3 is an SImode
5801 ;; scratch register. If operand 0 is a hard register, operand 3 may be the
5802 ;; same register. It is allowed to conflict with operand 1 as well.
5804 (define_expand "aligned_loadqi"
5805 [(set (match_operand:SI 3 "register_operand" "")
5806 (match_operand:SI 1 "memory_operand" ""))
5807 (set (match_operand:DI 0 "register_operand" "")
5808 (zero_extract:DI (subreg:DI (match_dup 3) 0)
5810 (match_operand:DI 2 "const_int_operand" "")))]
5815 (define_expand "aligned_loadhi"
5816 [(set (match_operand:SI 3 "register_operand" "")
5817 (match_operand:SI 1 "memory_operand" ""))
5818 (set (match_operand:DI 0 "register_operand" "")
5819 (zero_extract:DI (subreg:DI (match_dup 3) 0)
5821 (match_operand:DI 2 "const_int_operand" "")))]
5826 ;; Similar for unaligned loads, where we use the sequence from the
5827 ;; Alpha Architecture manual. We have to distinguish between little-endian
5828 ;; and big-endian systems as the sequences are different.
5830 ;; Operand 1 is the address. Operands 2 and 3 are temporaries, where
5831 ;; operand 3 can overlap the input and output registers.
5833 (define_expand "unaligned_loadqi"
5834 [(use (match_operand:DI 0 "register_operand" ""))
5835 (use (match_operand:DI 1 "address_operand" ""))
5836 (use (match_operand:DI 2 "register_operand" ""))
5837 (use (match_operand:DI 3 "register_operand" ""))]
5840 if (WORDS_BIG_ENDIAN)
5841 emit_insn (gen_unaligned_loadqi_be (operands[0], operands[1],
5842 operands[2], operands[3]));
5844 emit_insn (gen_unaligned_loadqi_le (operands[0], operands[1],
5845 operands[2], operands[3]));
5849 (define_expand "unaligned_loadqi_le"
5850 [(set (match_operand:DI 2 "register_operand" "")
5851 (mem:DI (and:DI (match_operand:DI 1 "address_operand" "")
5853 (set (match_operand:DI 3 "register_operand" "")
5855 (set (match_operand:DI 0 "register_operand" "")
5856 (zero_extract:DI (match_dup 2)
5858 (ashift:DI (match_dup 3) (const_int 3))))]
5859 "! WORDS_BIG_ENDIAN"
5862 (define_expand "unaligned_loadqi_be"
5863 [(set (match_operand:DI 2 "register_operand" "")
5864 (mem:DI (and:DI (match_operand:DI 1 "address_operand" "")
5866 (set (match_operand:DI 3 "register_operand" "")
5868 (set (match_operand:DI 0 "register_operand" "")
5869 (zero_extract:DI (match_dup 2)
5873 (ashift:DI (match_dup 3) (const_int 3)))))]
5877 (define_expand "unaligned_loadhi"
5878 [(use (match_operand:DI 0 "register_operand" ""))
5879 (use (match_operand:DI 1 "address_operand" ""))
5880 (use (match_operand:DI 2 "register_operand" ""))
5881 (use (match_operand:DI 3 "register_operand" ""))]
5884 if (WORDS_BIG_ENDIAN)
5885 emit_insn (gen_unaligned_loadhi_be (operands[0], operands[1],
5886 operands[2], operands[3]));
5888 emit_insn (gen_unaligned_loadhi_le (operands[0], operands[1],
5889 operands[2], operands[3]));
5893 (define_expand "unaligned_loadhi_le"
5894 [(set (match_operand:DI 2 "register_operand" "")
5895 (mem:DI (and:DI (match_operand:DI 1 "address_operand" "")
5897 (set (match_operand:DI 3 "register_operand" "")
5899 (set (match_operand:DI 0 "register_operand" "")
5900 (zero_extract:DI (match_dup 2)
5902 (ashift:DI (match_dup 3) (const_int 3))))]
5903 "! WORDS_BIG_ENDIAN"
5906 (define_expand "unaligned_loadhi_be"
5907 [(set (match_operand:DI 2 "register_operand" "")
5908 (mem:DI (and:DI (match_operand:DI 1 "address_operand" "")
5910 (set (match_operand:DI 3 "register_operand" "")
5911 (plus:DI (match_dup 1) (const_int 1)))
5912 (set (match_operand:DI 0 "register_operand" "")
5913 (zero_extract:DI (match_dup 2)
5917 (ashift:DI (match_dup 3) (const_int 3)))))]
5921 ;; Storing an aligned byte or word requires two temporaries. Operand 0 is the
5922 ;; aligned SImode MEM. Operand 1 is the register containing the
5923 ;; byte or word to store. Operand 2 is the number of bits within the word that
5924 ;; the value should be placed. Operands 3 and 4 are SImode temporaries.
5926 (define_expand "aligned_store"
5927 [(set (match_operand:SI 3 "register_operand" "")
5928 (match_operand:SI 0 "memory_operand" ""))
5929 (set (subreg:DI (match_dup 3) 0)
5930 (and:DI (subreg:DI (match_dup 3) 0) (match_dup 5)))
5931 (set (subreg:DI (match_operand:SI 4 "register_operand" "") 0)
5932 (ashift:DI (zero_extend:DI (match_operand 1 "register_operand" ""))
5933 (match_operand:DI 2 "const_int_operand" "")))
5934 (set (subreg:DI (match_dup 4) 0)
5935 (ior:DI (subreg:DI (match_dup 4) 0) (subreg:DI (match_dup 3) 0)))
5936 (set (match_dup 0) (match_dup 4))]
5939 operands[5] = GEN_INT (~ (GET_MODE_MASK (GET_MODE (operands[1]))
5940 << INTVAL (operands[2])));
5943 ;; For the unaligned byte and halfword cases, we use code similar to that
5944 ;; in the ;; Architecture book, but reordered to lower the number of registers
5945 ;; required. Operand 0 is the address. Operand 1 is the data to store.
5946 ;; Operands 2, 3, and 4 are DImode temporaries, where operands 2 and 4 may
5947 ;; be the same temporary, if desired. If the address is in a register,
5948 ;; operand 2 can be that register.
5950 (define_expand "unaligned_storeqi"
5951 [(use (match_operand:DI 0 "address_operand" ""))
5952 (use (match_operand:QI 1 "register_operand" ""))
5953 (use (match_operand:DI 2 "register_operand" ""))
5954 (use (match_operand:DI 3 "register_operand" ""))
5955 (use (match_operand:DI 4 "register_operand" ""))]
5958 if (WORDS_BIG_ENDIAN)
5959 emit_insn (gen_unaligned_storeqi_be (operands[0], operands[1],
5960 operands[2], operands[3],
5963 emit_insn (gen_unaligned_storeqi_le (operands[0], operands[1],
5964 operands[2], operands[3],
5969 (define_expand "unaligned_storeqi_le"
5970 [(set (match_operand:DI 3 "register_operand" "")
5971 (mem:DI (and:DI (match_operand:DI 0 "address_operand" "")
5973 (set (match_operand:DI 2 "register_operand" "")
5976 (and:DI (not:DI (ashift:DI (const_int 255)
5977 (ashift:DI (match_dup 2) (const_int 3))))
5979 (set (match_operand:DI 4 "register_operand" "")
5980 (ashift:DI (zero_extend:DI (match_operand:QI 1 "register_operand" ""))
5981 (ashift:DI (match_dup 2) (const_int 3))))
5982 (set (match_dup 4) (ior:DI (match_dup 4) (match_dup 3)))
5983 (set (mem:DI (and:DI (match_dup 0) (const_int -8)))
5985 "! WORDS_BIG_ENDIAN"
5988 (define_expand "unaligned_storeqi_be"
5989 [(set (match_operand:DI 3 "register_operand" "")
5990 (mem:DI (and:DI (match_operand:DI 0 "address_operand" "")
5992 (set (match_operand:DI 2 "register_operand" "")
5995 (and:DI (not:DI (ashift:DI (const_int 255)
5996 (minus:DI (const_int 56)
5997 (ashift:DI (match_dup 2) (const_int 3)))))
5999 (set (match_operand:DI 4 "register_operand" "")
6000 (ashift:DI (zero_extend:DI (match_operand:QI 1 "register_operand" ""))
6001 (minus:DI (const_int 56)
6002 (ashift:DI (match_dup 2) (const_int 3)))))
6003 (set (match_dup 4) (ior:DI (match_dup 4) (match_dup 3)))
6004 (set (mem:DI (and:DI (match_dup 0) (const_int -8)))
6009 (define_expand "unaligned_storehi"
6010 [(use (match_operand:DI 0 "address_operand" ""))
6011 (use (match_operand:HI 1 "register_operand" ""))
6012 (use (match_operand:DI 2 "register_operand" ""))
6013 (use (match_operand:DI 3 "register_operand" ""))
6014 (use (match_operand:DI 4 "register_operand" ""))]
6017 if (WORDS_BIG_ENDIAN)
6018 emit_insn (gen_unaligned_storehi_be (operands[0], operands[1],
6019 operands[2], operands[3],
6022 emit_insn (gen_unaligned_storehi_le (operands[0], operands[1],
6023 operands[2], operands[3],
6028 (define_expand "unaligned_storehi_le"
6029 [(set (match_operand:DI 3 "register_operand" "")
6030 (mem:DI (and:DI (match_operand:DI 0 "address_operand" "")
6032 (set (match_operand:DI 2 "register_operand" "")
6035 (and:DI (not:DI (ashift:DI (const_int 65535)
6036 (ashift:DI (match_dup 2) (const_int 3))))
6038 (set (match_operand:DI 4 "register_operand" "")
6039 (ashift:DI (zero_extend:DI (match_operand:HI 1 "register_operand" ""))
6040 (ashift:DI (match_dup 2) (const_int 3))))
6041 (set (match_dup 4) (ior:DI (match_dup 4) (match_dup 3)))
6042 (set (mem:DI (and:DI (match_dup 0) (const_int -8)))
6044 "! WORDS_BIG_ENDIAN"
6047 (define_expand "unaligned_storehi_be"
6048 [(set (match_operand:DI 3 "register_operand" "")
6049 (mem:DI (and:DI (match_operand:DI 0 "address_operand" "")
6051 (set (match_operand:DI 2 "register_operand" "")
6052 (plus:DI (match_dup 0) (const_int 1)))
6054 (and:DI (not:DI (ashift:DI
6056 (minus:DI (const_int 56)
6057 (ashift:DI (match_dup 2) (const_int 3)))))
6059 (set (match_operand:DI 4 "register_operand" "")
6060 (ashift:DI (zero_extend:DI (match_operand:HI 1 "register_operand" ""))
6061 (minus:DI (const_int 56)
6062 (ashift:DI (match_dup 2) (const_int 3)))))
6063 (set (match_dup 4) (ior:DI (match_dup 4) (match_dup 3)))
6064 (set (mem:DI (and:DI (match_dup 0) (const_int -8)))
6069 ;; Here are the define_expand's for QI and HI moves that use the above
6070 ;; patterns. We have the normal sets, plus the ones that need scratch
6071 ;; registers for reload.
6073 (define_expand "movqi"
6074 [(set (match_operand:QI 0 "nonimmediate_operand" "")
6075 (match_operand:QI 1 "general_operand" ""))]
6079 ? alpha_expand_mov (QImode, operands)
6080 : alpha_expand_mov_nobwx (QImode, operands))
6084 (define_expand "movhi"
6085 [(set (match_operand:HI 0 "nonimmediate_operand" "")
6086 (match_operand:HI 1 "general_operand" ""))]
6090 ? alpha_expand_mov (HImode, operands)
6091 : alpha_expand_mov_nobwx (HImode, operands))
6095 ;; We need to hook into the extra support that we have for HImode
6096 ;; reloads when BWX insns are not available.
6097 (define_expand "movcqi"
6098 [(set (match_operand:CQI 0 "nonimmediate_operand" "")
6099 (match_operand:CQI 1 "general_operand" ""))]
6102 if (GET_CODE (operands[0]) == CONCAT || GET_CODE (operands[1]) == CONCAT)
6104 else if (!any_memory_operand (operands[0], CQImode))
6106 if (!any_memory_operand (operands[1], CQImode))
6108 emit_move_insn (gen_lowpart (HImode, operands[0]),
6109 gen_lowpart (HImode, operands[1]));
6112 if (aligned_memory_operand (operands[1], CQImode))
6116 operands[1] = gen_lowpart (HImode, operands[1]);
6118 operands[0] = gen_lowpart (HImode, operands[0]);
6119 done = alpha_expand_mov_nobwx (HImode, operands);
6124 else if (aligned_memory_operand (operands[0], CQImode))
6126 if (MEM_P (operands[1]))
6128 rtx x = gen_reg_rtx (HImode);
6129 emit_move_insn (gen_lowpart (CQImode, x), operands[1]);
6136 gcc_assert (!reload_in_progress);
6137 emit_move_complex_parts (operands[0], operands[1]);
6141 ;; Here are the versions for reload.
6143 ;; The aligned input case is recognized early in alpha_secondary_reload
6144 ;; in order to avoid allocating an unnecessary scratch register.
6146 ;; Note that in the unaligned cases we know that the operand must not be
6147 ;; a pseudo-register because stack slots are always aligned references.
6149 (define_expand "reload_in<mode>"
6150 [(parallel [(match_operand:RELOAD12 0 "register_operand" "=r")
6151 (match_operand:RELOAD12 1 "any_memory_operand" "m")
6152 (match_operand:TI 2 "register_operand" "=&r")])]
6155 rtx scratch, seq, addr;
6156 unsigned regno = REGNO (operands[2]);
6158 /* It is possible that one of the registers we got for operands[2]
6159 might coincide with that of operands[0] (which is why we made
6160 it TImode). Pick the other one to use as our scratch. */
6161 if (regno == REGNO (operands[0]))
6163 scratch = gen_rtx_REG (DImode, regno);
6165 addr = get_unaligned_address (operands[1]);
6166 operands[0] = gen_rtx_REG (DImode, REGNO (operands[0]));
6167 seq = gen_unaligned_load<reloadmode> (operands[0], addr,
6168 scratch, operands[0]);
6169 alpha_set_memflags (seq, operands[1]);
6175 (define_expand "reload_out<mode>"
6176 [(parallel [(match_operand:RELOAD12 0 "any_memory_operand" "=m")
6177 (match_operand:RELOAD12 1 "register_operand" "r")
6178 (match_operand:TI 2 "register_operand" "=&r")])]
6181 unsigned regno = REGNO (operands[2]);
6183 if (<MODE>mode == CQImode)
6185 operands[0] = gen_lowpart (HImode, operands[0]);
6186 operands[1] = gen_lowpart (HImode, operands[1]);
6189 if (aligned_memory_operand (operands[0], <MODE>mode))
6191 emit_insn (gen_reload_out<reloadmode>_aligned
6192 (operands[0], operands[1],
6193 gen_rtx_REG (SImode, regno),
6194 gen_rtx_REG (SImode, regno + 1)));
6198 rtx addr = get_unaligned_address (operands[0]);
6199 rtx scratch1 = gen_rtx_REG (DImode, regno);
6200 rtx scratch2 = gen_rtx_REG (DImode, regno + 1);
6201 rtx scratch3 = scratch1;
6207 seq = gen_unaligned_store<reloadmode> (addr, operands[1], scratch1,
6208 scratch2, scratch3);
6209 alpha_set_memflags (seq, operands[0]);
6215 ;; Helpers for the above. The way reload is structured, we can't
6216 ;; always get a proper address for a stack slot during reload_foo
6217 ;; expansion, so we must delay our address manipulations until after.
6219 (define_insn_and_split "reload_in<mode>_aligned"
6220 [(set (match_operand:I12MODE 0 "register_operand" "=r")
6221 (match_operand:I12MODE 1 "memory_operand" "m"))]
6222 "!TARGET_BWX && (reload_in_progress || reload_completed)"
6224 "!TARGET_BWX && reload_completed"
6227 rtx aligned_mem, bitnum;
6228 get_aligned_mem (operands[1], &aligned_mem, &bitnum);
6229 emit_insn (gen_aligned_load<reloadmode>
6230 (gen_lowpart (DImode, operands[0]), aligned_mem, bitnum,
6231 gen_rtx_REG (SImode, REGNO (operands[0]))));
6235 (define_insn_and_split "reload_out<mode>_aligned"
6236 [(set (match_operand:I12MODE 0 "memory_operand" "=m")
6237 (match_operand:I12MODE 1 "register_operand" "r"))
6238 (clobber (match_operand:SI 2 "register_operand" "=r"))
6239 (clobber (match_operand:SI 3 "register_operand" "=r"))]
6240 "!TARGET_BWX && (reload_in_progress || reload_completed)"
6242 "!TARGET_BWX && reload_completed"
6245 rtx aligned_mem, bitnum;
6246 get_aligned_mem (operands[0], &aligned_mem, &bitnum);
6247 emit_insn (gen_aligned_store (aligned_mem, operands[1], bitnum,
6248 operands[2], operands[3]));
6252 ;; Vector operations
6254 (define_mode_iterator VEC [V8QI V4HI V2SI])
6256 (define_expand "mov<mode>"
6257 [(set (match_operand:VEC 0 "nonimmediate_operand" "")
6258 (match_operand:VEC 1 "general_operand" ""))]
6261 if (alpha_expand_mov (<MODE>mode, operands))
6266 [(set (match_operand:VEC 0 "register_operand" "")
6267 (match_operand:VEC 1 "non_zero_const_operand" ""))]
6271 if (alpha_split_const_mov (<MODE>mode, operands))
6278 (define_expand "movmisalign<mode>"
6279 [(set (match_operand:VEC 0 "nonimmediate_operand" "")
6280 (match_operand:VEC 1 "general_operand" ""))]
6283 alpha_expand_movmisalign (<MODE>mode, operands);
6287 (define_insn "*mov<mode>_fix"
6288 [(set (match_operand:VEC 0 "nonimmediate_operand" "=r,r,r,m,*f,*f,m,r,*f")
6289 (match_operand:VEC 1 "input_operand" "rW,i,m,rW,*fW,m,*f,*f,r"))]
6291 && (register_operand (operands[0], <MODE>mode)
6292 || reg_or_0_operand (operands[1], <MODE>mode))"
6303 [(set_attr "type" "ilog,multi,ild,ist,fcpys,fld,fst,ftoi,itof")])
6305 (define_insn "*mov<mode>_nofix"
6306 [(set (match_operand:VEC 0 "nonimmediate_operand" "=r,r,r,m,*f,*f,m")
6307 (match_operand:VEC 1 "input_operand" "rW,i,m,rW,*fW,m,*f"))]
6309 && (register_operand (operands[0], <MODE>mode)
6310 || reg_or_0_operand (operands[1], <MODE>mode))"
6319 [(set_attr "type" "ilog,multi,ild,ist,fcpys,fld,fst")])
6321 (define_insn "uminv8qi3"
6322 [(set (match_operand:V8QI 0 "register_operand" "=r")
6323 (umin:V8QI (match_operand:V8QI 1 "reg_or_0_operand" "rW")
6324 (match_operand:V8QI 2 "reg_or_0_operand" "rW")))]
6327 [(set_attr "type" "mvi")])
6329 (define_insn "sminv8qi3"
6330 [(set (match_operand:V8QI 0 "register_operand" "=r")
6331 (smin:V8QI (match_operand:V8QI 1 "reg_or_0_operand" "rW")
6332 (match_operand:V8QI 2 "reg_or_0_operand" "rW")))]
6335 [(set_attr "type" "mvi")])
6337 (define_insn "uminv4hi3"
6338 [(set (match_operand:V4HI 0 "register_operand" "=r")
6339 (umin:V4HI (match_operand:V4HI 1 "reg_or_0_operand" "rW")
6340 (match_operand:V4HI 2 "reg_or_0_operand" "rW")))]
6343 [(set_attr "type" "mvi")])
6345 (define_insn "sminv4hi3"
6346 [(set (match_operand:V4HI 0 "register_operand" "=r")
6347 (smin:V4HI (match_operand:V4HI 1 "reg_or_0_operand" "rW")
6348 (match_operand:V4HI 2 "reg_or_0_operand" "rW")))]
6351 [(set_attr "type" "mvi")])
6353 (define_insn "umaxv8qi3"
6354 [(set (match_operand:V8QI 0 "register_operand" "=r")
6355 (umax:V8QI (match_operand:V8QI 1 "reg_or_0_operand" "rW")
6356 (match_operand:V8QI 2 "reg_or_0_operand" "rW")))]
6359 [(set_attr "type" "mvi")])
6361 (define_insn "smaxv8qi3"
6362 [(set (match_operand:V8QI 0 "register_operand" "=r")
6363 (smax:V8QI (match_operand:V8QI 1 "reg_or_0_operand" "rW")
6364 (match_operand:V8QI 2 "reg_or_0_operand" "rW")))]
6367 [(set_attr "type" "mvi")])
6369 (define_insn "umaxv4hi3"
6370 [(set (match_operand:V4HI 0 "register_operand" "=r")
6371 (umax:V4HI (match_operand:V4HI 1 "reg_or_0_operand" "rW")
6372 (match_operand:V4HI 2 "reg_or_0_operand" "rW")))]
6375 [(set_attr "type" "mvi")])
6377 (define_insn "smaxv4hi3"
6378 [(set (match_operand:V4HI 0 "register_operand" "=r")
6379 (smax:V4HI (match_operand:V4HI 1 "reg_or_0_operand" "rW")
6380 (match_operand:V4HI 2 "reg_or_0_operand" "rW")))]
6383 [(set_attr "type" "mvi")])
6385 (define_insn "one_cmpl<mode>2"
6386 [(set (match_operand:VEC 0 "register_operand" "=r")
6387 (not:VEC (match_operand:VEC 1 "register_operand" "r")))]
6390 [(set_attr "type" "ilog")])
6392 (define_insn "and<mode>3"
6393 [(set (match_operand:VEC 0 "register_operand" "=r")
6394 (and:VEC (match_operand:VEC 1 "register_operand" "r")
6395 (match_operand:VEC 2 "register_operand" "r")))]
6398 [(set_attr "type" "ilog")])
6400 (define_insn "*andnot<mode>3"
6401 [(set (match_operand:VEC 0 "register_operand" "=r")
6402 (and:VEC (not:VEC (match_operand:VEC 1 "register_operand" "r"))
6403 (match_operand:VEC 2 "register_operand" "r")))]
6406 [(set_attr "type" "ilog")])
6408 (define_insn "ior<mode>3"
6409 [(set (match_operand:VEC 0 "register_operand" "=r")
6410 (ior:VEC (match_operand:VEC 1 "register_operand" "r")
6411 (match_operand:VEC 2 "register_operand" "r")))]
6414 [(set_attr "type" "ilog")])
6416 (define_insn "*iornot<mode>3"
6417 [(set (match_operand:VEC 0 "register_operand" "=r")
6418 (ior:VEC (not:DI (match_operand:VEC 1 "register_operand" "r"))
6419 (match_operand:VEC 2 "register_operand" "r")))]
6422 [(set_attr "type" "ilog")])
6424 (define_insn "xor<mode>3"
6425 [(set (match_operand:VEC 0 "register_operand" "=r")
6426 (xor:VEC (match_operand:VEC 1 "register_operand" "r")
6427 (match_operand:VEC 2 "register_operand" "r")))]
6430 [(set_attr "type" "ilog")])
6432 (define_insn "*xornot<mode>3"
6433 [(set (match_operand:VEC 0 "register_operand" "=r")
6434 (not:VEC (xor:VEC (match_operand:VEC 1 "register_operand" "r")
6435 (match_operand:VEC 2 "register_operand" "r"))))]
6438 [(set_attr "type" "ilog")])
6440 (define_expand "vec_shl_<mode>"
6441 [(set (match_operand:VEC 0 "register_operand" "")
6442 (ashift:DI (match_operand:VEC 1 "register_operand" "")
6443 (match_operand:DI 2 "reg_or_6bit_operand" "")))]
6446 operands[0] = gen_lowpart (DImode, operands[0]);
6447 operands[1] = gen_lowpart (DImode, operands[1]);
6450 (define_expand "vec_shr_<mode>"
6451 [(set (match_operand:VEC 0 "register_operand" "")
6452 (lshiftrt:DI (match_operand:VEC 1 "register_operand" "")
6453 (match_operand:DI 2 "reg_or_6bit_operand" "")))]
6456 operands[0] = gen_lowpart (DImode, operands[0]);
6457 operands[1] = gen_lowpart (DImode, operands[1]);
6460 ;; Bit field extract patterns which use ext[wlq][lh]
6462 (define_expand "extv"
6463 [(set (match_operand:DI 0 "register_operand" "")
6464 (sign_extract:DI (match_operand:QI 1 "memory_operand" "")
6465 (match_operand:DI 2 "immediate_operand" "")
6466 (match_operand:DI 3 "immediate_operand" "")))]
6471 /* We can do 16, 32 and 64 bit fields, if aligned on byte boundaries. */
6472 if (INTVAL (operands[3]) % 8 != 0
6473 || (INTVAL (operands[2]) != 16
6474 && INTVAL (operands[2]) != 32
6475 && INTVAL (operands[2]) != 64))
6478 /* From mips.md: extract_bit_field doesn't verify that our source
6479 matches the predicate, so we force it to be a MEM here. */
6480 if (!MEM_P (operands[1]))
6483 /* The bit number is relative to the mode of operand 1 which is
6484 usually QImode (this might actually be a bug in expmed.c). Note
6485 that the bit number is negative in big-endian mode in this case.
6486 We have to convert that to the offset. */
6487 if (WORDS_BIG_ENDIAN)
6488 ofs = GET_MODE_BITSIZE (GET_MODE (operands[1]))
6489 - INTVAL (operands[2]) - INTVAL (operands[3]);
6491 ofs = INTVAL (operands[3]);
6495 alpha_expand_unaligned_load (operands[0], operands[1],
6496 INTVAL (operands[2]) / 8,
6501 (define_expand "extzv"
6502 [(set (match_operand:DI 0 "register_operand" "")
6503 (zero_extract:DI (match_operand:DI 1 "nonimmediate_operand" "")
6504 (match_operand:DI 2 "immediate_operand" "")
6505 (match_operand:DI 3 "immediate_operand" "")))]
6508 /* We can do 8, 16, 32 and 64 bit fields, if aligned on byte boundaries. */
6509 if (INTVAL (operands[3]) % 8 != 0
6510 || (INTVAL (operands[2]) != 8
6511 && INTVAL (operands[2]) != 16
6512 && INTVAL (operands[2]) != 32
6513 && INTVAL (operands[2]) != 64))
6516 if (MEM_P (operands[1]))
6520 /* Fail 8-bit fields, falling back on a simple byte load. */
6521 if (INTVAL (operands[2]) == 8)
6524 /* The bit number is relative to the mode of operand 1 which is
6525 usually QImode (this might actually be a bug in expmed.c). Note
6526 that the bit number is negative in big-endian mode in this case.
6527 We have to convert that to the offset. */
6528 if (WORDS_BIG_ENDIAN)
6529 ofs = GET_MODE_BITSIZE (GET_MODE (operands[1]))
6530 - INTVAL (operands[2]) - INTVAL (operands[3]);
6532 ofs = INTVAL (operands[3]);
6536 alpha_expand_unaligned_load (operands[0], operands[1],
6537 INTVAL (operands[2]) / 8,
6543 (define_expand "insv"
6544 [(set (zero_extract:DI (match_operand:QI 0 "memory_operand" "")
6545 (match_operand:DI 1 "immediate_operand" "")
6546 (match_operand:DI 2 "immediate_operand" ""))
6547 (match_operand:DI 3 "register_operand" ""))]
6552 /* We can do 16, 32 and 64 bit fields, if aligned on byte boundaries. */
6553 if (INTVAL (operands[2]) % 8 != 0
6554 || (INTVAL (operands[1]) != 16
6555 && INTVAL (operands[1]) != 32
6556 && INTVAL (operands[1]) != 64))
6559 /* From mips.md: store_bit_field doesn't verify that our source
6560 matches the predicate, so we force it to be a MEM here. */
6561 if (!MEM_P (operands[0]))
6564 /* The bit number is relative to the mode of operand 1 which is
6565 usually QImode (this might actually be a bug in expmed.c). Note
6566 that the bit number is negative in big-endian mode in this case.
6567 We have to convert that to the offset. */
6568 if (WORDS_BIG_ENDIAN)
6569 ofs = GET_MODE_BITSIZE (GET_MODE (operands[0]))
6570 - INTVAL (operands[1]) - INTVAL (operands[2]);
6572 ofs = INTVAL (operands[2]);
6576 alpha_expand_unaligned_store (operands[0], operands[3],
6577 INTVAL (operands[1]) / 8, ofs);
6581 ;; Block move/clear, see alpha.c for more details.
6582 ;; Argument 0 is the destination
6583 ;; Argument 1 is the source
6584 ;; Argument 2 is the length
6585 ;; Argument 3 is the alignment
6587 (define_expand "movmemqi"
6588 [(parallel [(set (match_operand:BLK 0 "memory_operand" "")
6589 (match_operand:BLK 1 "memory_operand" ""))
6590 (use (match_operand:DI 2 "immediate_operand" ""))
6591 (use (match_operand:DI 3 "immediate_operand" ""))])]
6594 if (alpha_expand_block_move (operands))
6600 (define_expand "movmemdi"
6601 [(parallel [(set (match_operand:BLK 0 "memory_operand" "")
6602 (match_operand:BLK 1 "memory_operand" ""))
6603 (use (match_operand:DI 2 "immediate_operand" ""))
6604 (use (match_operand:DI 3 "immediate_operand" ""))
6606 (clobber (reg:DI 25))
6607 (clobber (reg:DI 16))
6608 (clobber (reg:DI 17))
6609 (clobber (reg:DI 18))
6610 (clobber (reg:DI 19))
6611 (clobber (reg:DI 20))
6612 (clobber (reg:DI 26))
6613 (clobber (reg:DI 27))])]
6614 "TARGET_ABI_OPEN_VMS"
6616 operands[4] = gen_rtx_SYMBOL_REF (Pmode, "OTS$MOVE");
6617 alpha_need_linkage (XSTR (operands[4], 0), 0);
6620 (define_insn "*movmemdi_1"
6621 [(set (match_operand:BLK 0 "memory_operand" "=m,=m")
6622 (match_operand:BLK 1 "memory_operand" "m,m"))
6623 (use (match_operand:DI 2 "nonmemory_operand" "r,i"))
6624 (use (match_operand:DI 3 "immediate_operand" ""))
6625 (use (match_operand:DI 4 "call_operand" "i,i"))
6626 (clobber (reg:DI 25))
6627 (clobber (reg:DI 16))
6628 (clobber (reg:DI 17))
6629 (clobber (reg:DI 18))
6630 (clobber (reg:DI 19))
6631 (clobber (reg:DI 20))
6632 (clobber (reg:DI 26))
6633 (clobber (reg:DI 27))]
6634 "TARGET_ABI_OPEN_VMS"
6636 operands [5] = alpha_use_linkage (operands [4], cfun->decl, 0, 1);
6637 switch (which_alternative)
6640 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)";
6642 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)";
6647 [(set_attr "type" "multi")
6648 (set_attr "length" "28")])
6650 (define_expand "setmemqi"
6651 [(parallel [(set (match_operand:BLK 0 "memory_operand" "")
6652 (match_operand 2 "const_int_operand" ""))
6653 (use (match_operand:DI 1 "immediate_operand" ""))
6654 (use (match_operand:DI 3 "immediate_operand" ""))])]
6657 /* If value to set is not zero, use the library routine. */
6658 if (operands[2] != const0_rtx)
6661 if (alpha_expand_block_clear (operands))
6667 (define_expand "setmemdi"
6668 [(parallel [(set (match_operand:BLK 0 "memory_operand" "")
6669 (match_operand 2 "const_int_operand" ""))
6670 (use (match_operand:DI 1 "immediate_operand" ""))
6671 (use (match_operand:DI 3 "immediate_operand" ""))
6673 (clobber (reg:DI 25))
6674 (clobber (reg:DI 16))
6675 (clobber (reg:DI 17))
6676 (clobber (reg:DI 26))
6677 (clobber (reg:DI 27))])]
6678 "TARGET_ABI_OPEN_VMS"
6680 /* If value to set is not zero, use the library routine. */
6681 if (operands[2] != const0_rtx)
6684 operands[4] = gen_rtx_SYMBOL_REF (Pmode, "OTS$ZERO");
6685 alpha_need_linkage (XSTR (operands[4], 0), 0);
6688 (define_insn "*clrmemdi_1"
6689 [(set (match_operand:BLK 0 "memory_operand" "=m,=m")
6691 (use (match_operand:DI 1 "nonmemory_operand" "r,i"))
6692 (use (match_operand:DI 2 "immediate_operand" ""))
6693 (use (match_operand:DI 3 "call_operand" "i,i"))
6694 (clobber (reg:DI 25))
6695 (clobber (reg:DI 16))
6696 (clobber (reg:DI 17))
6697 (clobber (reg:DI 26))
6698 (clobber (reg:DI 27))]
6699 "TARGET_ABI_OPEN_VMS"
6701 operands [4] = alpha_use_linkage (operands [3], cfun->decl, 0, 1);
6702 switch (which_alternative)
6705 return "lda $16,%0\;bis $31,%1,$17\;ldq $26,%4\;lda $25,2($31)\;jsr $26,%3\;ldq $27,0($29)";
6707 return "lda $16,%0\;lda $17,%1($31)\;ldq $26,%4\;lda $25,2($31)\;jsr $26,%3\;ldq $27,0($29)";
6712 [(set_attr "type" "multi")
6713 (set_attr "length" "24")])
6716 ;; Subroutine of stack space allocation. Perform a stack probe.
6717 (define_expand "probe_stack"
6718 [(set (match_dup 1) (match_operand:DI 0 "const_int_operand" ""))]
6721 operands[1] = gen_rtx_MEM (DImode, plus_constant (stack_pointer_rtx,
6722 INTVAL (operands[0])));
6723 MEM_VOLATILE_P (operands[1]) = 1;
6725 operands[0] = const0_rtx;
6728 ;; This is how we allocate stack space. If we are allocating a
6729 ;; constant amount of space and we know it is less than 4096
6730 ;; bytes, we need do nothing.
6732 ;; If it is more than 4096 bytes, we need to probe the stack
6734 (define_expand "allocate_stack"
6736 (plus:DI (reg:DI 30)
6737 (match_operand:DI 1 "reg_or_cint_operand" "")))
6738 (set (match_operand:DI 0 "register_operand" "=r")
6742 if (CONST_INT_P (operands[1])
6743 && INTVAL (operands[1]) < 32768)
6745 if (INTVAL (operands[1]) >= 4096)
6747 /* We do this the same way as in the prologue and generate explicit
6748 probes. Then we update the stack by the constant. */
6752 emit_insn (gen_probe_stack (GEN_INT (- probed)));
6753 while (probed + 8192 < INTVAL (operands[1]))
6754 emit_insn (gen_probe_stack (GEN_INT (- (probed += 8192))));
6756 if (probed + 4096 < INTVAL (operands[1]))
6757 emit_insn (gen_probe_stack (GEN_INT (- INTVAL(operands[1]))));
6760 operands[1] = GEN_INT (- INTVAL (operands[1]));
6761 operands[2] = virtual_stack_dynamic_rtx;
6766 rtx loop_label = gen_label_rtx ();
6767 rtx want = gen_reg_rtx (Pmode);
6768 rtx tmp = gen_reg_rtx (Pmode);
6771 emit_insn (gen_subdi3 (want, stack_pointer_rtx,
6772 force_reg (Pmode, operands[1])));
6773 emit_insn (gen_adddi3 (tmp, stack_pointer_rtx, GEN_INT (-4096)));
6775 if (!CONST_INT_P (operands[1]))
6777 out_label = gen_label_rtx ();
6778 emit_insn (gen_cmpdi (want, tmp));
6779 emit_jump_insn (gen_bgeu (out_label));
6782 emit_label (loop_label);
6783 memref = gen_rtx_MEM (DImode, tmp);
6784 MEM_VOLATILE_P (memref) = 1;
6785 emit_move_insn (memref, const0_rtx);
6786 emit_insn (gen_adddi3 (tmp, tmp, GEN_INT(-8192)));
6787 emit_insn (gen_cmpdi (tmp, want));
6788 emit_jump_insn (gen_bgtu (loop_label));
6790 memref = gen_rtx_MEM (DImode, want);
6791 MEM_VOLATILE_P (memref) = 1;
6792 emit_move_insn (memref, const0_rtx);
6795 emit_label (out_label);
6797 emit_move_insn (stack_pointer_rtx, want);
6798 emit_move_insn (operands[0], virtual_stack_dynamic_rtx);
6803 ;; This is used by alpha_expand_prolog to do the same thing as above,
6804 ;; except we cannot at that time generate new basic blocks, so we hide
6805 ;; the loop in this one insn.
6807 (define_insn "prologue_stack_probe_loop"
6808 [(unspec_volatile [(match_operand:DI 0 "register_operand" "r")
6809 (match_operand:DI 1 "register_operand" "r")]
6813 operands[2] = gen_label_rtx ();
6814 (*targetm.asm_out.internal_label) (asm_out_file, "L",
6815 CODE_LABEL_NUMBER (operands[2]));
6817 return "stq $31,-8192(%1)\;subq %0,1,%0\;lda %1,-8192(%1)\;bne %0,%l2";
6819 [(set_attr "length" "16")
6820 (set_attr "type" "multi")])
6822 (define_expand "prologue"
6823 [(clobber (const_int 0))]
6826 alpha_expand_prologue ();
6830 ;; These take care of emitting the ldgp insn in the prologue. This will be
6831 ;; an lda/ldah pair and we want to align them properly. So we have two
6832 ;; unspec_volatile insns, the first of which emits the ldgp assembler macro
6833 ;; and the second of which emits nothing. However, both are marked as type
6834 ;; IADD (the default) so the alignment code in alpha.c does the right thing
6837 (define_expand "prologue_ldgp"
6839 (unspec_volatile:DI [(match_dup 1) (match_dup 2)] UNSPECV_LDGP1))
6841 (unspec_volatile:DI [(match_dup 0) (match_dup 2)] UNSPECV_PLDGP2))]
6844 operands[0] = pic_offset_table_rtx;
6845 operands[1] = gen_rtx_REG (Pmode, 27);
6846 operands[2] = (TARGET_EXPLICIT_RELOCS
6847 ? GEN_INT (alpha_next_sequence_number++)
6851 (define_insn "*ldgp_er_1"
6852 [(set (match_operand:DI 0 "register_operand" "=r")
6853 (unspec_volatile:DI [(match_operand:DI 1 "register_operand" "r")
6854 (match_operand 2 "const_int_operand" "")]
6856 "TARGET_EXPLICIT_RELOCS && TARGET_ABI_OSF"
6857 "ldah %0,0(%1)\t\t!gpdisp!%2"
6858 [(set_attr "cannot_copy" "true")])
6860 (define_insn "*ldgp_er_2"
6861 [(set (match_operand:DI 0 "register_operand" "=r")
6862 (unspec:DI [(match_operand:DI 1 "register_operand" "r")
6863 (match_operand 2 "const_int_operand" "")]
6865 "TARGET_EXPLICIT_RELOCS && TARGET_ABI_OSF"
6866 "lda %0,0(%1)\t\t!gpdisp!%2"
6867 [(set_attr "cannot_copy" "true")])
6869 (define_insn "*prologue_ldgp_er_2"
6870 [(set (match_operand:DI 0 "register_operand" "=r")
6871 (unspec_volatile:DI [(match_operand:DI 1 "register_operand" "r")
6872 (match_operand 2 "const_int_operand" "")]
6874 "TARGET_EXPLICIT_RELOCS && TARGET_ABI_OSF"
6875 "lda %0,0(%1)\t\t!gpdisp!%2\n$%~..ng:"
6876 [(set_attr "cannot_copy" "true")])
6878 (define_insn "*prologue_ldgp_1"
6879 [(set (match_operand:DI 0 "register_operand" "=r")
6880 (unspec_volatile:DI [(match_operand:DI 1 "register_operand" "r")
6881 (match_operand 2 "const_int_operand" "")]
6884 "ldgp %0,0(%1)\n$%~..ng:"
6885 [(set_attr "cannot_copy" "true")])
6887 (define_insn "*prologue_ldgp_2"
6888 [(set (match_operand:DI 0 "register_operand" "=r")
6889 (unspec_volatile:DI [(match_operand:DI 1 "register_operand" "r")
6890 (match_operand 2 "const_int_operand" "")]
6895 ;; The _mcount profiling hook has special calling conventions, and
6896 ;; does not clobber all the registers that a normal call would. So
6897 ;; hide the fact this is a call at all.
6899 (define_insn "prologue_mcount"
6900 [(unspec_volatile [(const_int 0)] UNSPECV_MCOUNT)]
6903 if (TARGET_EXPLICIT_RELOCS)
6904 /* Note that we cannot use a lituse_jsr reloc, since _mcount
6905 cannot be called via the PLT. */
6906 return "ldq $28,_mcount($29)\t\t!literal\;jsr $28,($28),_mcount";
6908 return "lda $28,_mcount\;jsr $28,($28),_mcount";
6910 [(set_attr "type" "multi")
6911 (set_attr "length" "8")])
6913 (define_insn "init_fp"
6914 [(set (match_operand:DI 0 "register_operand" "=r")
6915 (match_operand:DI 1 "register_operand" "r"))
6916 (clobber (mem:BLK (match_operand:DI 2 "register_operand" "=r")))]
6920 (define_expand "epilogue"
6924 alpha_expand_epilogue ();
6927 (define_expand "sibcall_epilogue"
6931 alpha_expand_epilogue ();
6935 (define_expand "builtin_longjmp"
6936 [(use (match_operand:DI 0 "register_operand" "r"))]
6939 /* The elements of the buffer are, in order: */
6940 rtx fp = gen_rtx_MEM (Pmode, operands[0]);
6941 rtx lab = gen_rtx_MEM (Pmode, plus_constant (operands[0], 8));
6942 rtx stack = gen_rtx_MEM (Pmode, plus_constant (operands[0], 16));
6943 rtx pv = gen_rtx_REG (Pmode, 27);
6945 /* This bit is the same as expand_builtin_longjmp. */
6946 emit_move_insn (hard_frame_pointer_rtx, fp);
6947 emit_move_insn (pv, lab);
6948 emit_stack_restore (SAVE_NONLOCAL, stack, NULL_RTX);
6949 emit_use (hard_frame_pointer_rtx);
6950 emit_use (stack_pointer_rtx);
6952 /* Load the label we are jumping through into $27 so that we know
6953 where to look for it when we get back to setjmp's function for
6954 restoring the gp. */
6955 emit_jump_insn (gen_builtin_longjmp_internal (pv));
6960 ;; This is effectively a copy of indirect_jump, but constrained such
6961 ;; that register renaming cannot foil our cunning plan with $27.
6962 (define_insn "builtin_longjmp_internal"
6964 (unspec_volatile [(match_operand:DI 0 "register_operand" "c")]
6968 [(set_attr "type" "ibr")])
6970 (define_expand "builtin_setjmp_receiver"
6971 [(unspec_volatile [(label_ref (match_operand 0 "" ""))] UNSPECV_SETJMPR)]
6975 (define_insn_and_split "*builtin_setjmp_receiver_1"
6976 [(unspec_volatile [(match_operand 0 "" "")] UNSPECV_SETJMPR)]
6979 if (TARGET_EXPLICIT_RELOCS)
6982 return "br $27,$LSJ%=\n$LSJ%=:\;ldgp $29,0($27)";
6984 "&& TARGET_EXPLICIT_RELOCS && reload_completed"
6986 (unspec_volatile:DI [(match_dup 2) (match_dup 3)] UNSPECV_LDGP1))
6988 (unspec:DI [(match_dup 1) (match_dup 3)] UNSPEC_LDGP2))]
6990 if (prev_nonnote_insn (curr_insn) != XEXP (operands[0], 0))
6991 emit_insn (gen_rtx_UNSPEC_VOLATILE (VOIDmode, gen_rtvec (1, operands[0]),
6992 UNSPECV_SETJMPR_ER));
6993 operands[1] = pic_offset_table_rtx;
6994 operands[2] = gen_rtx_REG (Pmode, 27);
6995 operands[3] = GEN_INT (alpha_next_sequence_number++);
6997 [(set_attr "length" "12")
6998 (set_attr "type" "multi")])
7000 (define_insn "*builtin_setjmp_receiver_er_sl_1"
7001 [(unspec_volatile [(match_operand 0 "" "")] UNSPECV_SETJMPR_ER)]
7002 "TARGET_ABI_OSF && TARGET_EXPLICIT_RELOCS && TARGET_AS_CAN_SUBTRACT_LABELS"
7003 "lda $27,$LSJ%=-%l0($27)\n$LSJ%=:")
7005 (define_insn "*builtin_setjmp_receiver_er_1"
7006 [(unspec_volatile [(match_operand 0 "" "")] UNSPECV_SETJMPR_ER)]
7007 "TARGET_ABI_OSF && TARGET_EXPLICIT_RELOCS"
7008 "br $27,$LSJ%=\n$LSJ%=:"
7009 [(set_attr "type" "ibr")])
7011 (define_expand "exception_receiver"
7012 [(unspec_volatile [(match_dup 0)] UNSPECV_EHR)]
7015 if (TARGET_LD_BUGGY_LDGP)
7016 operands[0] = alpha_gp_save_rtx ();
7018 operands[0] = const0_rtx;
7021 (define_insn "*exception_receiver_2"
7022 [(unspec_volatile [(match_operand:DI 0 "memory_operand" "m")] UNSPECV_EHR)]
7023 "TARGET_ABI_OSF && TARGET_LD_BUGGY_LDGP"
7025 [(set_attr "type" "ild")])
7027 (define_insn_and_split "*exception_receiver_1"
7028 [(unspec_volatile [(const_int 0)] UNSPECV_EHR)]
7031 if (TARGET_EXPLICIT_RELOCS)
7032 return "ldah $29,0($26)\t\t!gpdisp!%*\;lda $29,0($29)\t\t!gpdisp!%*";
7034 return "ldgp $29,0($26)";
7036 "&& TARGET_EXPLICIT_RELOCS && reload_completed"
7038 (unspec_volatile:DI [(match_dup 1) (match_dup 2)] UNSPECV_LDGP1))
7040 (unspec:DI [(match_dup 0) (match_dup 2)] UNSPEC_LDGP2))]
7042 operands[0] = pic_offset_table_rtx;
7043 operands[1] = gen_rtx_REG (Pmode, 26);
7044 operands[2] = GEN_INT (alpha_next_sequence_number++);
7046 [(set_attr "length" "8")
7047 (set_attr "type" "multi")])
7049 (define_expand "nonlocal_goto_receiver"
7050 [(unspec_volatile [(const_int 0)] UNSPECV_BLOCKAGE)
7051 (set (reg:DI 27) (mem:DI (reg:DI 29)))
7052 (unspec_volatile [(const_int 0)] UNSPECV_BLOCKAGE)
7054 "TARGET_ABI_OPEN_VMS"
7057 (define_insn "arg_home"
7058 [(unspec [(const_int 0)] UNSPEC_ARG_HOME)
7073 (clobber (mem:BLK (const_int 0)))
7074 (clobber (reg:DI 24))
7075 (clobber (reg:DI 25))
7076 (clobber (reg:DI 0))]
7077 "TARGET_ABI_OPEN_VMS"
7078 "lda $0,OTS$HOME_ARGS\;ldq $0,8($0)\;jsr $0,OTS$HOME_ARGS"
7079 [(set_attr "length" "16")
7080 (set_attr "type" "multi")])
7082 ;; Load the CIW into r2 for calling __T3E_MISMATCH
7084 (define_expand "umk_mismatch_args"
7085 [(set:DI (match_dup 1) (mem:DI (plus:DI (reg:DI 15) (const_int -16))))
7086 (set:DI (match_dup 2) (mem:DI (plus:DI (match_dup 1) (const_int -32))))
7087 (set:DI (reg:DI 1) (match_operand:DI 0 "const_int_operand" ""))
7088 (set:DI (match_dup 3) (plus:DI (mult:DI (reg:DI 25)
7091 (set:DI (reg:DI 2) (mem:DI (match_dup 3)))]
7092 "TARGET_ABI_UNICOSMK"
7094 operands[1] = gen_reg_rtx (DImode);
7095 operands[2] = gen_reg_rtx (DImode);
7096 operands[3] = gen_reg_rtx (DImode);
7099 (define_insn "arg_home_umk"
7100 [(unspec [(const_int 0)] UNSPEC_ARG_HOME)
7115 (clobber (mem:BLK (const_int 0)))
7117 (clobber (reg:DI 22))
7118 (clobber (reg:DI 23))
7119 (clobber (reg:DI 24))
7120 (clobber (reg:DI 0))
7121 (clobber (reg:DI 1))
7122 (clobber (reg:DI 2))
7123 (clobber (reg:DI 3))
7124 (clobber (reg:DI 4))
7125 (clobber (reg:DI 5))
7126 (clobber (reg:DI 6))
7127 (clobber (reg:DI 7))
7128 (clobber (reg:DI 8))])]
7129 "TARGET_ABI_UNICOSMK"
7130 "laum $4,__T3E_MISMATCH($31)\;sll $4,32,$4\;lalm $4,__T3E_MISMATCH($4)\;lal $4,__T3E_MISMATCH($4)\;jsr $3,($4)"
7131 [(set_attr "length" "16")
7132 (set_attr "type" "multi")])
7136 ;; On EV4, these instructions are nops -- no load occurs.
7138 ;; On EV5, these instructions act as a normal load, and thus can trap
7139 ;; if the address is invalid. The OS may (or may not) handle this in
7140 ;; the entMM fault handler and suppress the fault. If so, then this
7141 ;; has the effect of a read prefetch instruction.
7143 ;; On EV6, these become official prefetch instructions.
7145 (define_insn "prefetch"
7146 [(prefetch (match_operand:DI 0 "address_operand" "p")
7147 (match_operand:DI 1 "const_int_operand" "n")
7148 (match_operand:DI 2 "const_int_operand" "n"))]
7149 "TARGET_FIXUP_EV5_PREFETCH || alpha_cpu == PROCESSOR_EV6"
7151 /* Interpret "no temporal locality" as this data should be evicted once
7152 it is used. The "evict next" alternatives load the data into the cache
7153 and leave the LRU eviction counter pointing to that block. */
7154 static const char * const alt[2][2] = {
7156 "ldq $31,%a0", /* read, evict next */
7157 "ldl $31,%a0", /* read, evict last */
7160 "ldt $f31,%a0", /* write, evict next */
7161 "lds $f31,%a0", /* write, evict last */
7165 bool write = INTVAL (operands[1]) != 0;
7166 bool lru = INTVAL (operands[2]) != 0;
7168 return alt[write][lru];
7170 [(set_attr "type" "ild")])
7172 ;; Close the trap shadow of preceding instructions. This is generated
7175 (define_insn "trapb"
7176 [(unspec_volatile [(const_int 0)] UNSPECV_TRAPB)]
7179 [(set_attr "type" "misc")])
7181 ;; No-op instructions used by machine-dependent reorg to preserve
7182 ;; alignment for instruction issue.
7183 ;; The Unicos/Mk assembler does not support these opcodes.
7189 [(set_attr "type" "ilog")])
7194 "cpys $f31,$f31,$f31"
7195 [(set_attr "type" "fcpys")])
7202 ;; On Unicos/Mk we use a macro for aligning code.
7204 (define_insn "realign"
7205 [(unspec_volatile [(match_operand 0 "immediate_operand" "i")]
7209 if (TARGET_ABI_UNICOSMK)
7210 return "gcc@code@align %0";
7212 return ".align %0 #realign";
7215 ;; Instructions to be emitted from __builtins.
7217 (define_insn "builtin_cmpbge"
7218 [(set (match_operand:DI 0 "register_operand" "=r")
7219 (unspec:DI [(match_operand:DI 1 "reg_or_0_operand" "rJ")
7220 (match_operand:DI 2 "reg_or_8bit_operand" "rI")]
7224 ;; The EV6 data sheets list this as ILOG. OTOH, EV6 doesn't
7225 ;; actually differentiate between ILOG and ICMP in the schedule.
7226 [(set_attr "type" "icmp")])
7228 (define_expand "builtin_extbl"
7229 [(match_operand:DI 0 "register_operand" "")
7230 (match_operand:DI 1 "reg_or_0_operand" "")
7231 (match_operand:DI 2 "reg_or_8bit_operand" "")]
7234 rtx (*gen) (rtx, rtx, rtx, rtx);
7235 if (WORDS_BIG_ENDIAN)
7239 emit_insn ((*gen) (operands[0], operands[1], GEN_INT (8), operands[2]));
7243 (define_expand "builtin_extwl"
7244 [(match_operand:DI 0 "register_operand" "")
7245 (match_operand:DI 1 "reg_or_0_operand" "")
7246 (match_operand:DI 2 "reg_or_8bit_operand" "")]
7249 rtx (*gen) (rtx, rtx, rtx, rtx);
7250 if (WORDS_BIG_ENDIAN)
7254 emit_insn ((*gen) (operands[0], operands[1], GEN_INT (16), operands[2]));
7258 (define_expand "builtin_extll"
7259 [(match_operand:DI 0 "register_operand" "")
7260 (match_operand:DI 1 "reg_or_0_operand" "")
7261 (match_operand:DI 2 "reg_or_8bit_operand" "")]
7264 rtx (*gen) (rtx, rtx, rtx, rtx);
7265 if (WORDS_BIG_ENDIAN)
7269 emit_insn ((*gen) (operands[0], operands[1], GEN_INT (32), operands[2]));
7273 (define_expand "builtin_extql"
7274 [(match_operand:DI 0 "register_operand" "")
7275 (match_operand:DI 1 "reg_or_0_operand" "")
7276 (match_operand:DI 2 "reg_or_8bit_operand" "")]
7279 rtx (*gen) (rtx, rtx, rtx, rtx);
7280 if (WORDS_BIG_ENDIAN)
7284 emit_insn ((*gen) (operands[0], operands[1], GEN_INT (64), operands[2]));
7288 (define_expand "builtin_extwh"
7289 [(match_operand:DI 0 "register_operand" "")
7290 (match_operand:DI 1 "reg_or_0_operand" "")
7291 (match_operand:DI 2 "reg_or_8bit_operand" "")]
7294 rtx (*gen) (rtx, rtx, rtx);
7295 if (WORDS_BIG_ENDIAN)
7299 emit_insn ((*gen) (operands[0], operands[1], operands[2]));
7303 (define_expand "builtin_extlh"
7304 [(match_operand:DI 0 "register_operand" "")
7305 (match_operand:DI 1 "reg_or_0_operand" "")
7306 (match_operand:DI 2 "reg_or_8bit_operand" "")]
7309 rtx (*gen) (rtx, rtx, rtx);
7310 if (WORDS_BIG_ENDIAN)
7314 emit_insn ((*gen) (operands[0], operands[1], operands[2]));
7318 (define_expand "builtin_extqh"
7319 [(match_operand:DI 0 "register_operand" "")
7320 (match_operand:DI 1 "reg_or_0_operand" "")
7321 (match_operand:DI 2 "reg_or_8bit_operand" "")]
7324 rtx (*gen) (rtx, rtx, rtx);
7325 if (WORDS_BIG_ENDIAN)
7329 emit_insn ((*gen) (operands[0], operands[1], operands[2]));
7333 (define_expand "builtin_insbl"
7334 [(match_operand:DI 0 "register_operand" "")
7335 (match_operand:DI 1 "register_operand" "")
7336 (match_operand:DI 2 "reg_or_8bit_operand" "")]
7339 rtx (*gen) (rtx, rtx, rtx);
7340 if (WORDS_BIG_ENDIAN)
7344 operands[1] = gen_lowpart (QImode, operands[1]);
7345 emit_insn ((*gen) (operands[0], operands[1], operands[2]));
7349 (define_expand "builtin_inswl"
7350 [(match_operand:DI 0 "register_operand" "")
7351 (match_operand:DI 1 "register_operand" "")
7352 (match_operand:DI 2 "reg_or_8bit_operand" "")]
7355 rtx (*gen) (rtx, rtx, rtx);
7356 if (WORDS_BIG_ENDIAN)
7360 operands[1] = gen_lowpart (HImode, operands[1]);
7361 emit_insn ((*gen) (operands[0], operands[1], operands[2]));
7365 (define_expand "builtin_insll"
7366 [(match_operand:DI 0 "register_operand" "")
7367 (match_operand:DI 1 "register_operand" "")
7368 (match_operand:DI 2 "reg_or_8bit_operand" "")]
7371 rtx (*gen) (rtx, rtx, rtx);
7372 if (WORDS_BIG_ENDIAN)
7376 operands[1] = gen_lowpart (SImode, operands[1]);
7377 emit_insn ((*gen) (operands[0], operands[1], operands[2]));
7378 emit_insn ((*gen) (operands[0], operands[1], operands[2]));
7382 (define_expand "builtin_insql"
7383 [(match_operand:DI 0 "register_operand" "")
7384 (match_operand:DI 1 "reg_or_0_operand" "")
7385 (match_operand:DI 2 "reg_or_8bit_operand" "")]
7388 rtx (*gen) (rtx, rtx, rtx);
7389 if (WORDS_BIG_ENDIAN)
7393 emit_insn ((*gen) (operands[0], operands[1], operands[2]));
7397 (define_expand "builtin_inswh"
7398 [(match_operand:DI 0 "register_operand" "")
7399 (match_operand:DI 1 "register_operand" "")
7400 (match_operand:DI 2 "reg_or_8bit_operand" "")]
7403 emit_insn (gen_insxh (operands[0], operands[1], GEN_INT (16), operands[2]));
7407 (define_expand "builtin_inslh"
7408 [(match_operand:DI 0 "register_operand" "")
7409 (match_operand:DI 1 "register_operand" "")
7410 (match_operand:DI 2 "reg_or_8bit_operand" "")]
7413 emit_insn (gen_insxh (operands[0], operands[1], GEN_INT (32), operands[2]));
7417 (define_expand "builtin_insqh"
7418 [(match_operand:DI 0 "register_operand" "")
7419 (match_operand:DI 1 "register_operand" "")
7420 (match_operand:DI 2 "reg_or_8bit_operand" "")]
7423 emit_insn (gen_insxh (operands[0], operands[1], GEN_INT (64), operands[2]));
7427 (define_expand "builtin_mskbl"
7428 [(match_operand:DI 0 "register_operand" "")
7429 (match_operand:DI 1 "reg_or_0_operand" "")
7430 (match_operand:DI 2 "reg_or_8bit_operand" "")]
7433 rtx (*gen) (rtx, rtx, rtx, rtx);
7435 if (WORDS_BIG_ENDIAN)
7439 mask = GEN_INT (0xff);
7440 emit_insn ((*gen) (operands[0], operands[1], mask, operands[2]));
7444 (define_expand "builtin_mskwl"
7445 [(match_operand:DI 0 "register_operand" "")
7446 (match_operand:DI 1 "reg_or_0_operand" "")
7447 (match_operand:DI 2 "reg_or_8bit_operand" "")]
7450 rtx (*gen) (rtx, rtx, rtx, rtx);
7452 if (WORDS_BIG_ENDIAN)
7456 mask = GEN_INT (0xffff);
7457 emit_insn ((*gen) (operands[0], operands[1], mask, operands[2]));
7461 (define_expand "builtin_mskll"
7462 [(match_operand:DI 0 "register_operand" "")
7463 (match_operand:DI 1 "reg_or_0_operand" "")
7464 (match_operand:DI 2 "reg_or_8bit_operand" "")]
7467 rtx (*gen) (rtx, rtx, rtx, rtx);
7469 if (WORDS_BIG_ENDIAN)
7473 mask = immed_double_const (0xffffffff, 0, DImode);
7474 emit_insn ((*gen) (operands[0], operands[1], mask, operands[2]));
7478 (define_expand "builtin_mskql"
7479 [(match_operand:DI 0 "register_operand" "")
7480 (match_operand:DI 1 "reg_or_0_operand" "")
7481 (match_operand:DI 2 "reg_or_8bit_operand" "")]
7484 rtx (*gen) (rtx, rtx, rtx, rtx);
7486 if (WORDS_BIG_ENDIAN)
7491 emit_insn ((*gen) (operands[0], operands[1], mask, operands[2]));
7495 (define_expand "builtin_mskwh"
7496 [(match_operand:DI 0 "register_operand" "")
7497 (match_operand:DI 1 "register_operand" "")
7498 (match_operand:DI 2 "reg_or_8bit_operand" "")]
7501 emit_insn (gen_mskxh (operands[0], operands[1], GEN_INT (16), operands[2]));
7505 (define_expand "builtin_msklh"
7506 [(match_operand:DI 0 "register_operand" "")
7507 (match_operand:DI 1 "register_operand" "")
7508 (match_operand:DI 2 "reg_or_8bit_operand" "")]
7511 emit_insn (gen_mskxh (operands[0], operands[1], GEN_INT (32), operands[2]));
7515 (define_expand "builtin_mskqh"
7516 [(match_operand:DI 0 "register_operand" "")
7517 (match_operand:DI 1 "register_operand" "")
7518 (match_operand:DI 2 "reg_or_8bit_operand" "")]
7521 emit_insn (gen_mskxh (operands[0], operands[1], GEN_INT (64), operands[2]));
7525 (define_expand "builtin_zap"
7526 [(set (match_operand:DI 0 "register_operand" "")
7528 [(match_operand:DI 2 "reg_or_cint_operand" "")]
7530 (match_operand:DI 1 "reg_or_cint_operand" "")))]
7533 if (CONST_INT_P (operands[2]))
7535 rtx mask = alpha_expand_zap_mask (INTVAL (operands[2]));
7537 if (mask == const0_rtx)
7539 emit_move_insn (operands[0], const0_rtx);
7542 if (mask == constm1_rtx)
7544 emit_move_insn (operands[0], operands[1]);
7548 operands[1] = force_reg (DImode, operands[1]);
7549 emit_insn (gen_anddi3 (operands[0], operands[1], mask));
7553 operands[1] = force_reg (DImode, operands[1]);
7554 operands[2] = gen_lowpart (QImode, operands[2]);
7557 (define_insn "*builtin_zap_1"
7558 [(set (match_operand:DI 0 "register_operand" "=r,r,r,r")
7560 [(match_operand:QI 2 "reg_or_cint_operand" "n,n,r,r")]
7562 (match_operand:DI 1 "reg_or_cint_operand" "n,r,J,r")))]
7569 [(set_attr "type" "shift,shift,ilog,shift")])
7572 [(set (match_operand:DI 0 "register_operand" "")
7574 [(match_operand:QI 2 "const_int_operand" "")]
7576 (match_operand:DI 1 "const_int_operand" "")))]
7580 rtx mask = alpha_expand_zap_mask (INTVAL (operands[2]));
7581 if (HOST_BITS_PER_WIDE_INT >= 64 || CONST_INT_P (mask))
7582 operands[1] = gen_int_mode (INTVAL (operands[1]) & INTVAL (mask), DImode);
7585 HOST_WIDE_INT c_lo = INTVAL (operands[1]);
7586 HOST_WIDE_INT c_hi = (c_lo < 0 ? -1 : 0);
7587 operands[1] = immed_double_const (c_lo & CONST_DOUBLE_LOW (mask),
7588 c_hi & CONST_DOUBLE_HIGH (mask),
7591 emit_move_insn (operands[0], operands[1]);
7596 [(set (match_operand:DI 0 "register_operand" "")
7598 [(match_operand:QI 2 "const_int_operand" "")]
7600 (match_operand:DI 1 "register_operand" "")))]
7603 (and:DI (match_dup 1) (match_dup 2)))]
7605 operands[2] = alpha_expand_zap_mask (INTVAL (operands[2]));
7606 if (operands[2] == const0_rtx)
7608 emit_move_insn (operands[0], const0_rtx);
7611 if (operands[2] == constm1_rtx)
7613 emit_move_insn (operands[0], operands[1]);
7618 (define_expand "builtin_zapnot"
7619 [(set (match_operand:DI 0 "register_operand" "")
7621 [(not:QI (match_operand:DI 2 "reg_or_cint_operand" ""))]
7623 (match_operand:DI 1 "reg_or_cint_operand" "")))]
7626 if (CONST_INT_P (operands[2]))
7628 rtx mask = alpha_expand_zap_mask (~ INTVAL (operands[2]));
7630 if (mask == const0_rtx)
7632 emit_move_insn (operands[0], const0_rtx);
7635 if (mask == constm1_rtx)
7637 emit_move_insn (operands[0], operands[1]);
7641 operands[1] = force_reg (DImode, operands[1]);
7642 emit_insn (gen_anddi3 (operands[0], operands[1], mask));
7646 operands[1] = force_reg (DImode, operands[1]);
7647 operands[2] = gen_lowpart (QImode, operands[2]);
7650 (define_insn "*builtin_zapnot_1"
7651 [(set (match_operand:DI 0 "register_operand" "=r")
7653 [(not:QI (match_operand:QI 2 "register_operand" "r"))]
7655 (match_operand:DI 1 "reg_or_0_operand" "rJ")))]
7658 [(set_attr "type" "shift")])
7660 (define_insn "builtin_amask"
7661 [(set (match_operand:DI 0 "register_operand" "=r")
7662 (unspec:DI [(match_operand:DI 1 "reg_or_8bit_operand" "rI")]
7666 [(set_attr "type" "ilog")])
7668 (define_insn "builtin_implver"
7669 [(set (match_operand:DI 0 "register_operand" "=r")
7670 (unspec:DI [(const_int 0)] UNSPEC_IMPLVER))]
7673 [(set_attr "type" "ilog")])
7675 (define_insn "builtin_rpcc"
7676 [(set (match_operand:DI 0 "register_operand" "=r")
7677 (unspec_volatile:DI [(const_int 0)] UNSPECV_RPCC))]
7680 [(set_attr "type" "ilog")])
7682 (define_expand "builtin_minub8"
7683 [(match_operand:DI 0 "register_operand" "")
7684 (match_operand:DI 1 "reg_or_0_operand" "")
7685 (match_operand:DI 2 "reg_or_0_operand" "")]
7688 alpha_expand_builtin_vector_binop (gen_uminv8qi3, V8QImode, operands[0],
7689 operands[1], operands[2]);
7693 (define_expand "builtin_minsb8"
7694 [(match_operand:DI 0 "register_operand" "")
7695 (match_operand:DI 1 "reg_or_0_operand" "")
7696 (match_operand:DI 2 "reg_or_0_operand" "")]
7699 alpha_expand_builtin_vector_binop (gen_sminv8qi3, V8QImode, operands[0],
7700 operands[1], operands[2]);
7704 (define_expand "builtin_minuw4"
7705 [(match_operand:DI 0 "register_operand" "")
7706 (match_operand:DI 1 "reg_or_0_operand" "")
7707 (match_operand:DI 2 "reg_or_0_operand" "")]
7710 alpha_expand_builtin_vector_binop (gen_uminv4hi3, V4HImode, operands[0],
7711 operands[1], operands[2]);
7715 (define_expand "builtin_minsw4"
7716 [(match_operand:DI 0 "register_operand" "")
7717 (match_operand:DI 1 "reg_or_0_operand" "")
7718 (match_operand:DI 2 "reg_or_0_operand" "")]
7721 alpha_expand_builtin_vector_binop (gen_sminv4hi3, V4HImode, operands[0],
7722 operands[1], operands[2]);
7726 (define_expand "builtin_maxub8"
7727 [(match_operand:DI 0 "register_operand" "")
7728 (match_operand:DI 1 "reg_or_0_operand" "")
7729 (match_operand:DI 2 "reg_or_0_operand" "")]
7732 alpha_expand_builtin_vector_binop (gen_umaxv8qi3, V8QImode, operands[0],
7733 operands[1], operands[2]);
7737 (define_expand "builtin_maxsb8"
7738 [(match_operand:DI 0 "register_operand" "")
7739 (match_operand:DI 1 "reg_or_0_operand" "")
7740 (match_operand:DI 2 "reg_or_0_operand" "")]
7743 alpha_expand_builtin_vector_binop (gen_smaxv8qi3, V8QImode, operands[0],
7744 operands[1], operands[2]);
7748 (define_expand "builtin_maxuw4"
7749 [(match_operand:DI 0 "register_operand" "")
7750 (match_operand:DI 1 "reg_or_0_operand" "")
7751 (match_operand:DI 2 "reg_or_0_operand" "")]
7754 alpha_expand_builtin_vector_binop (gen_umaxv4hi3, V4HImode, operands[0],
7755 operands[1], operands[2]);
7759 (define_expand "builtin_maxsw4"
7760 [(match_operand:DI 0 "register_operand" "")
7761 (match_operand:DI 1 "reg_or_0_operand" "")
7762 (match_operand:DI 2 "reg_or_0_operand" "")]
7765 alpha_expand_builtin_vector_binop (gen_smaxv4hi3, V4HImode, operands[0],
7766 operands[1], operands[2]);
7770 (define_insn "builtin_perr"
7771 [(set (match_operand:DI 0 "register_operand" "=r")
7772 (unspec:DI [(match_operand:DI 1 "reg_or_0_operand" "%rJ")
7773 (match_operand:DI 2 "reg_or_8bit_operand" "rJ")]
7777 [(set_attr "type" "mvi")])
7779 (define_expand "builtin_pklb"
7780 [(set (match_operand:DI 0 "register_operand" "")
7783 (truncate:V2QI (match_operand:DI 1 "register_operand" ""))
7788 operands[0] = gen_lowpart (V8QImode, operands[0]);
7789 operands[1] = gen_lowpart (V2SImode, operands[1]);
7790 operands[2] = CONST0_RTX (V2QImode);
7791 operands[3] = CONST0_RTX (V4QImode);
7794 (define_insn "*pklb"
7795 [(set (match_operand:V8QI 0 "register_operand" "=r")
7798 (truncate:V2QI (match_operand:V2SI 1 "register_operand" "r"))
7799 (match_operand:V2QI 2 "const0_operand" ""))
7800 (match_operand:V4QI 3 "const0_operand" "")))]
7803 [(set_attr "type" "mvi")])
7805 (define_expand "builtin_pkwb"
7806 [(set (match_operand:DI 0 "register_operand" "")
7808 (truncate:V4QI (match_operand:DI 1 "register_operand" ""))
7812 operands[0] = gen_lowpart (V8QImode, operands[0]);
7813 operands[1] = gen_lowpart (V4HImode, operands[1]);
7814 operands[2] = CONST0_RTX (V4QImode);
7817 (define_insn "*pkwb"
7818 [(set (match_operand:V8QI 0 "register_operand" "=r")
7820 (truncate:V4QI (match_operand:V4HI 1 "register_operand" "r"))
7821 (match_operand:V4QI 2 "const0_operand" "")))]
7824 [(set_attr "type" "mvi")])
7826 (define_expand "builtin_unpkbl"
7827 [(set (match_operand:DI 0 "register_operand" "")
7829 (vec_select:V2QI (match_operand:DI 1 "register_operand" "")
7830 (parallel [(const_int 0) (const_int 1)]))))]
7833 operands[0] = gen_lowpart (V2SImode, operands[0]);
7834 operands[1] = gen_lowpart (V8QImode, operands[1]);
7837 (define_insn "*unpkbl"
7838 [(set (match_operand:V2SI 0 "register_operand" "=r")
7840 (vec_select:V2QI (match_operand:V8QI 1 "reg_or_0_operand" "rW")
7841 (parallel [(const_int 0) (const_int 1)]))))]
7844 [(set_attr "type" "mvi")])
7846 (define_expand "builtin_unpkbw"
7847 [(set (match_operand:DI 0 "register_operand" "")
7849 (vec_select:V4QI (match_operand:DI 1 "register_operand" "")
7850 (parallel [(const_int 0)
7856 operands[0] = gen_lowpart (V4HImode, operands[0]);
7857 operands[1] = gen_lowpart (V8QImode, operands[1]);
7860 (define_insn "*unpkbw"
7861 [(set (match_operand:V4HI 0 "register_operand" "=r")
7863 (vec_select:V4QI (match_operand:V8QI 1 "reg_or_0_operand" "rW")
7864 (parallel [(const_int 0)
7870 [(set_attr "type" "mvi")])
7874 ;; The call patterns are at the end of the file because their
7875 ;; wildcard operand0 interferes with nice recognition.
7877 (define_insn "*call_value_osf_1_er_noreturn"
7878 [(set (match_operand 0 "" "")
7879 (call (mem:DI (match_operand:DI 1 "call_operand" "c,R,s"))
7880 (match_operand 2 "" "")))
7882 (clobber (reg:DI 26))]
7883 "TARGET_EXPLICIT_RELOCS && TARGET_ABI_OSF
7884 && find_reg_note (insn, REG_NORETURN, NULL_RTX)"
7887 bsr $26,%1\t\t!samegp
7888 ldq $27,%1($29)\t\t!literal!%#\;jsr $26,($27),%1\t\t!lituse_jsr!%#"
7889 [(set_attr "type" "jsr")
7890 (set_attr "length" "*,*,8")])
7892 (define_insn "*call_value_osf_1_er"
7893 [(set (match_operand 0 "" "")
7894 (call (mem:DI (match_operand:DI 1 "call_operand" "c,R,s"))
7895 (match_operand 2 "" "")))
7897 (clobber (reg:DI 26))]
7898 "TARGET_EXPLICIT_RELOCS && TARGET_ABI_OSF"
7900 jsr $26,(%1),0\;ldah $29,0($26)\t\t!gpdisp!%*\;lda $29,0($29)\t\t!gpdisp!%*
7901 bsr $26,%1\t\t!samegp
7902 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!%*"
7903 [(set_attr "type" "jsr")
7904 (set_attr "length" "12,*,16")])
7906 ;; We must use peep2 instead of a split because we need accurate life
7907 ;; information for $gp. Consider the case of { bar(); while (1); }.
7909 [(parallel [(set (match_operand 0 "" "")
7910 (call (mem:DI (match_operand:DI 1 "call_operand" ""))
7911 (match_operand 2 "" "")))
7913 (clobber (reg:DI 26))])]
7914 "TARGET_EXPLICIT_RELOCS && TARGET_ABI_OSF && reload_completed
7915 && ! samegp_function_operand (operands[1], Pmode)
7916 && (peep2_regno_dead_p (1, 29)
7917 || find_reg_note (insn, REG_NORETURN, NULL_RTX))"
7918 [(parallel [(set (match_dup 0)
7919 (call (mem:DI (match_dup 3))
7924 (clobber (reg:DI 26))])]
7926 if (CONSTANT_P (operands[1]))
7928 operands[3] = gen_rtx_REG (Pmode, 27);
7929 operands[4] = GEN_INT (alpha_next_sequence_number++);
7930 emit_insn (gen_movdi_er_high_g (operands[3], pic_offset_table_rtx,
7931 operands[1], operands[4]));
7935 operands[3] = operands[1];
7936 operands[1] = const0_rtx;
7937 operands[4] = const0_rtx;
7942 [(parallel [(set (match_operand 0 "" "")
7943 (call (mem:DI (match_operand:DI 1 "call_operand" ""))
7944 (match_operand 2 "" "")))
7946 (clobber (reg:DI 26))])]
7947 "TARGET_EXPLICIT_RELOCS && TARGET_ABI_OSF && reload_completed
7948 && ! samegp_function_operand (operands[1], Pmode)
7949 && ! (peep2_regno_dead_p (1, 29)
7950 || find_reg_note (insn, REG_NORETURN, NULL_RTX))"
7951 [(parallel [(set (match_dup 0)
7952 (call (mem:DI (match_dup 3))
7955 (unspec:DI [(match_dup 6) (match_dup 4)] UNSPEC_LDGP1))
7958 (clobber (reg:DI 26))])
7960 (unspec:DI [(match_dup 6) (match_dup 4)] UNSPEC_LDGP2))]
7962 if (CONSTANT_P (operands[1]))
7964 operands[3] = gen_rtx_REG (Pmode, 27);
7965 operands[5] = GEN_INT (alpha_next_sequence_number++);
7966 emit_insn (gen_movdi_er_high_g (operands[3], pic_offset_table_rtx,
7967 operands[1], operands[5]));
7971 operands[3] = operands[1];
7972 operands[1] = const0_rtx;
7973 operands[5] = const0_rtx;
7975 operands[4] = GEN_INT (alpha_next_sequence_number++);
7976 operands[6] = pic_offset_table_rtx;
7979 (define_insn "*call_value_osf_2_er_nogp"
7980 [(set (match_operand 0 "" "")
7981 (call (mem:DI (match_operand:DI 1 "register_operand" "c"))
7982 (match_operand 2 "" "")))
7984 (use (match_operand 3 "" ""))
7985 (use (match_operand 4 "" ""))
7986 (clobber (reg:DI 26))]
7987 "TARGET_EXPLICIT_RELOCS && TARGET_ABI_OSF"
7988 "jsr $26,(%1),%3%J4"
7989 [(set_attr "type" "jsr")])
7991 (define_insn "*call_value_osf_2_er"
7992 [(set (match_operand 0 "" "")
7993 (call (mem:DI (match_operand:DI 1 "register_operand" "c"))
7994 (match_operand 2 "" "")))
7996 (unspec:DI [(reg:DI 29) (match_operand 5 "const_int_operand" "")]
7998 (use (match_operand 3 "" ""))
7999 (use (match_operand 4 "" ""))
8000 (clobber (reg:DI 26))]
8001 "TARGET_EXPLICIT_RELOCS && TARGET_ABI_OSF"
8002 "jsr $26,(%1),%3%J4\;ldah $29,0($26)\t\t!gpdisp!%5"
8003 [(set_attr "type" "jsr")
8004 (set_attr "cannot_copy" "true")
8005 (set_attr "length" "8")])
8007 (define_insn "*call_value_osf_1_noreturn"
8008 [(set (match_operand 0 "" "")
8009 (call (mem:DI (match_operand:DI 1 "call_operand" "c,R,s"))
8010 (match_operand 2 "" "")))
8012 (clobber (reg:DI 26))]
8013 "! TARGET_EXPLICIT_RELOCS && TARGET_ABI_OSF
8014 && find_reg_note (insn, REG_NORETURN, NULL_RTX)"
8019 [(set_attr "type" "jsr")
8020 (set_attr "length" "*,*,8")])
8022 (define_insn_and_split "call_value_osf_tlsgd"
8023 [(set (match_operand 0 "" "")
8024 (call (mem:DI (match_operand:DI 1 "symbolic_operand" ""))
8026 (unspec [(match_operand:DI 2 "const_int_operand" "")] UNSPEC_TLSGD_CALL)
8028 (clobber (reg:DI 26))]
8031 "&& reload_completed"
8033 (unspec:DI [(match_dup 5)
8035 (match_dup 2)] UNSPEC_LITERAL))
8036 (parallel [(set (match_dup 0)
8037 (call (mem:DI (match_dup 3))
8040 (unspec:DI [(match_dup 5) (match_dup 4)] UNSPEC_LDGP1))
8042 (use (unspec [(match_dup 2)] UNSPEC_TLSGD_CALL))
8043 (clobber (reg:DI 26))])
8045 (unspec:DI [(match_dup 5) (match_dup 4)] UNSPEC_LDGP2))]
8047 operands[3] = gen_rtx_REG (Pmode, 27);
8048 operands[4] = GEN_INT (alpha_next_sequence_number++);
8049 operands[5] = pic_offset_table_rtx;
8051 [(set_attr "type" "multi")])
8053 (define_insn_and_split "call_value_osf_tlsldm"
8054 [(set (match_operand 0 "" "")
8055 (call (mem:DI (match_operand:DI 1 "symbolic_operand" ""))
8057 (unspec [(match_operand:DI 2 "const_int_operand" "")] UNSPEC_TLSLDM_CALL)
8059 (clobber (reg:DI 26))]
8062 "&& reload_completed"
8064 (unspec:DI [(match_dup 5)
8066 (match_dup 2)] UNSPEC_LITERAL))
8067 (parallel [(set (match_dup 0)
8068 (call (mem:DI (match_dup 3))
8071 (unspec:DI [(match_dup 5) (match_dup 4)] UNSPEC_LDGP1))
8073 (use (unspec [(match_dup 2)] UNSPEC_TLSLDM_CALL))
8074 (clobber (reg:DI 26))])
8076 (unspec:DI [(match_dup 5) (match_dup 4)] UNSPEC_LDGP2))]
8078 operands[3] = gen_rtx_REG (Pmode, 27);
8079 operands[4] = GEN_INT (alpha_next_sequence_number++);
8080 operands[5] = pic_offset_table_rtx;
8082 [(set_attr "type" "multi")])
8084 (define_insn "*call_value_osf_1"
8085 [(set (match_operand 0 "" "")
8086 (call (mem:DI (match_operand:DI 1 "call_operand" "c,R,s"))
8087 (match_operand 2 "" "")))
8089 (clobber (reg:DI 26))]
8090 "! TARGET_EXPLICIT_RELOCS && TARGET_ABI_OSF"
8092 jsr $26,($27),0\;ldgp $29,0($26)
8094 jsr $26,%1\;ldgp $29,0($26)"
8095 [(set_attr "type" "jsr")
8096 (set_attr "length" "12,*,16")])
8098 (define_insn "*sibcall_value_osf_1_er"
8099 [(set (match_operand 0 "" "")
8100 (call (mem:DI (match_operand:DI 1 "symbolic_operand" "R,s"))
8101 (match_operand 2 "" "")))
8102 (unspec [(reg:DI 29)] UNSPEC_SIBCALL)]
8103 "TARGET_EXPLICIT_RELOCS && TARGET_ABI_OSF"
8105 br $31,%1\t\t!samegp
8106 ldq $27,%1($29)\t\t!literal!%#\;jmp $31,($27),%1\t\t!lituse_jsr!%#"
8107 [(set_attr "type" "jsr")
8108 (set_attr "length" "*,8")])
8110 (define_insn "*sibcall_value_osf_1"
8111 [(set (match_operand 0 "" "")
8112 (call (mem:DI (match_operand:DI 1 "symbolic_operand" "R,s"))
8113 (match_operand 2 "" "")))
8114 (unspec [(reg:DI 29)] UNSPEC_SIBCALL)]
8115 "! TARGET_EXPLICIT_RELOCS && TARGET_ABI_OSF"
8118 lda $27,%1\;jmp $31,($27),%1"
8119 [(set_attr "type" "jsr")
8120 (set_attr "length" "*,8")])
8122 (define_insn "*call_value_nt_1"
8123 [(set (match_operand 0 "" "")
8124 (call (mem:DI (match_operand:DI 1 "call_operand" "r,R,s"))
8125 (match_operand 2 "" "")))
8126 (clobber (reg:DI 26))]
8127 "TARGET_ABI_WINDOWS_NT"
8132 [(set_attr "type" "jsr")
8133 (set_attr "length" "*,*,12")])
8135 ; GAS relies on the order and position of instructions output below in order
8136 ; to generate relocs for VMS link to potentially optimize the call.
8137 ; Please do not molest.
8138 (define_insn "*call_value_vms_1"
8139 [(set (match_operand 0 "" "")
8140 (call (mem:DI (match_operand:DI 1 "call_operand" "r,s"))
8141 (match_operand 2 "" "")))
8142 (use (match_operand:DI 3 "nonmemory_operand" "r,n"))
8145 (clobber (reg:DI 27))]
8146 "TARGET_ABI_OPEN_VMS"
8148 switch (which_alternative)
8151 return "mov %3,$27\;jsr $26,0\;ldq $27,0($29)";
8153 operands [3] = alpha_use_linkage (operands [1], cfun->decl, 1, 0);
8154 operands [4] = alpha_use_linkage (operands [1], cfun->decl, 0, 0);
8155 return "ldq $26,%4\;ldq $27,%3\;jsr $26,%1\;ldq $27,0($29)";
8160 [(set_attr "type" "jsr")
8161 (set_attr "length" "12,16")])
8163 (define_insn "*call_value_umk"
8164 [(set (match_operand 0 "" "")
8165 (call (mem:DI (match_operand:DI 1 "call_operand" "r"))
8166 (match_operand 2 "" "")))
8168 (clobber (reg:DI 26))]
8169 "TARGET_ABI_UNICOSMK"
8171 [(set_attr "type" "jsr")])