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 Free Software Foundation, Inc.
4 ;; Contributed by Richard Kenner (kenner@vlsi1.ultra.nyu.edu)
6 ;; This file is part of GCC.
8 ;; GCC is free software; you can redistribute it and/or modify
9 ;; it under the terms of the GNU General Public License as published by
10 ;; the Free Software Foundation; either version 2, or (at your option)
13 ;; GCC is distributed in the hope that it will be useful,
14 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
15 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 ;; GNU General Public License for more details.
18 ;; You should have received a copy of the GNU General Public License
19 ;; along with GCC; see the file COPYING. If not, write to
20 ;; the Free Software Foundation, 59 Temple Place - Suite 330,
21 ;; Boston, MA 02111-1307, USA.
23 ;;- See file "rtl.def" for documentation on define_insn, match_*, et. al.
25 ;; Uses of UNSPEC in this file:
37 (UNSPEC_UMK_LOAD_CIW 9)
45 (UNSPEC_TLSGD_CALL 15)
46 (UNSPEC_TLSLDM_CALL 16)
68 (UNSPECV_SETJMPR 2) ; builtin_setjmp_receiver
69 (UNSPECV_LONGJMP 3) ; builtin_longjmp
71 (UNSPECV_PSPL 5) ; prologue_stack_probe_loop
73 (UNSPECV_EHR 7) ; exception_receiver
77 (UNSPECV_PLDGP2 11) ; prologue ldgp
82 ;; Where necessary, the suffixes _le and _be are used to distinguish between
83 ;; little-endian and big-endian patterns.
85 ;; Note that the Unicos/Mk assembler does not support the following
86 ;; opcodes: mov, fmov, nop, fnop, unop.
88 ;; Processor type -- this attribute must exactly match the processor_type
89 ;; enumeration in alpha.h.
91 (define_attr "cpu" "ev4,ev5,ev6"
92 (const (symbol_ref "alpha_cpu")))
94 ;; Define an insn type attribute. This is used in function unit delay
95 ;; computations, among other purposes. For the most part, we use the names
96 ;; defined in the EV4 documentation, but add a few that we have to know about
100 "ild,fld,ldsym,ist,fst,ibr,callpal,fbr,jsr,iadd,ilog,shift,icmov,fcmov,
101 icmp,imul,fadd,fmul,fcpys,fdiv,fsqrt,misc,mvi,ftoi,itof,multi,none"
102 (const_string "iadd"))
104 ;; Describe a user's asm statement.
105 (define_asm_attributes
106 [(set_attr "type" "multi")])
108 ;; Define the operand size an insn operates on. Used primarily by mul
109 ;; and div operations that have size dependent timings.
111 (define_attr "opsize" "si,di,udi"
114 ;; The TRAP attribute marks instructions that may generate traps
115 ;; (which are imprecise and may need a trapb if software completion
118 (define_attr "trap" "no,yes"
121 ;; The ROUND_SUFFIX attribute marks which instructions require a
122 ;; rounding-mode suffix. The value NONE indicates no suffix,
123 ;; the value NORMAL indicates a suffix controlled by alpha_fprm.
125 (define_attr "round_suffix" "none,normal,c"
126 (const_string "none"))
128 ;; The TRAP_SUFFIX attribute marks instructions requiring a trap-mode suffix:
130 ;; SU accepts only /su (cmpt et al)
131 ;; SUI accepts only /sui (cvtqt and cvtqs)
132 ;; V_SV accepts /v and /sv (cvtql only)
133 ;; V_SV_SVI accepts /v, /sv and /svi (cvttq only)
134 ;; U_SU_SUI accepts /u, /su and /sui (most fp instructions)
136 ;; The actual suffix emitted is controlled by alpha_fptm.
138 (define_attr "trap_suffix" "none,su,sui,v_sv,v_sv_svi,u_su_sui"
139 (const_string "none"))
141 ;; The length of an instruction sequence in bytes.
143 (define_attr "length" ""
146 ;; The USEGP attribute marks instructions that have relocations that use
149 (define_attr "usegp" "no,yes"
150 (cond [(eq_attr "type" "ldsym,jsr")
152 (eq_attr "type" "ild,fld,ist,fst")
153 (symbol_ref "alpha_find_lo_sum_using_gp(insn)")
155 (const_string "no")))
157 ;; The CANNOT_COPY attribute marks instructions with relocations that
158 ;; cannot easily be duplicated. This includes insns with gpdisp relocs
159 ;; since they have to stay in 1-1 correspondence with one another. This
160 ;; also includes jsr insns, since they must stay in correspondence with
161 ;; the immediately following gpdisp instructions.
163 (define_attr "cannot_copy" "false,true"
164 (const_string "false"))
166 ;; Include scheduling descriptions.
172 ;; First define the arithmetic insns. Note that the 32-bit forms also
175 ;; Handle 32-64 bit extension from memory to a floating point register
176 ;; specially, since this occurs frequently in int->double conversions.
178 ;; Note that while we must retain the =f case in the insn for reload's
179 ;; benefit, it should be eliminated after reload, so we should never emit
180 ;; code for that case. But we don't reject the possibility.
182 (define_expand "extendsidi2"
183 [(set (match_operand:DI 0 "register_operand" "")
184 (sign_extend:DI (match_operand:SI 1 "nonimmediate_operand" "")))]
188 (define_insn "*cvtlq"
189 [(set (match_operand:DI 0 "register_operand" "=f")
190 (unspec:DI [(match_operand:SF 1 "reg_or_0_operand" "fG")]
194 [(set_attr "type" "fadd")])
196 (define_insn "*extendsidi2_1"
197 [(set (match_operand:DI 0 "register_operand" "=r,r,!*f")
199 (match_operand:SI 1 "nonimmediate_operand" "r,m,m")))]
204 lds %0,%1\;cvtlq %0,%0"
205 [(set_attr "type" "iadd,ild,fld")
206 (set_attr "length" "*,*,8")])
209 [(set (match_operand:DI 0 "hard_fp_register_operand" "")
210 (sign_extend:DI (match_operand:SI 1 "memory_operand" "")))]
212 [(set (match_dup 2) (match_dup 1))
213 (set (match_dup 0) (unspec:DI [(match_dup 2)] UNSPEC_CVTLQ))]
215 operands[1] = adjust_address (operands[1], SFmode, 0);
216 operands[2] = gen_rtx_REG (SFmode, REGNO (operands[0]));
219 ;; Optimize sign-extension of SImode loads. This shows up in the wake of
220 ;; reload when converting fp->int.
223 [(set (match_operand:SI 0 "hard_int_register_operand" "")
224 (match_operand:SI 1 "memory_operand" ""))
225 (set (match_operand:DI 2 "hard_int_register_operand" "")
226 (sign_extend:DI (match_dup 0)))]
227 "true_regnum (operands[0]) == true_regnum (operands[2])
228 || peep2_reg_dead_p (2, operands[0])"
230 (sign_extend:DI (match_dup 1)))]
233 ;; Don't say we have addsi3 if optimizing. This generates better code. We
234 ;; have the anonymous addsi3 pattern below in case combine wants to make it.
235 (define_expand "addsi3"
236 [(set (match_operand:SI 0 "register_operand" "")
237 (plus:SI (match_operand:SI 1 "reg_or_0_operand" "")
238 (match_operand:SI 2 "add_operand" "")))]
242 (define_insn "*addsi_internal"
243 [(set (match_operand:SI 0 "register_operand" "=r,r,r,r")
244 (plus:SI (match_operand:SI 1 "reg_or_0_operand" "%rJ,rJ,rJ,rJ")
245 (match_operand:SI 2 "add_operand" "rI,O,K,L")))]
254 [(set (match_operand:SI 0 "register_operand" "")
255 (plus:SI (match_operand:SI 1 "register_operand" "")
256 (match_operand:SI 2 "const_int_operand" "")))]
257 "! add_operand (operands[2], SImode)"
258 [(set (match_dup 0) (plus:SI (match_dup 1) (match_dup 3)))
259 (set (match_dup 0) (plus:SI (match_dup 0) (match_dup 4)))]
261 HOST_WIDE_INT val = INTVAL (operands[2]);
262 HOST_WIDE_INT low = (val & 0xffff) - 2 * (val & 0x8000);
263 HOST_WIDE_INT rest = val - low;
265 operands[3] = GEN_INT (rest);
266 operands[4] = GEN_INT (low);
269 (define_insn "*addsi_se"
270 [(set (match_operand:DI 0 "register_operand" "=r,r")
272 (plus:SI (match_operand:SI 1 "reg_or_0_operand" "%rJ,rJ")
273 (match_operand:SI 2 "sext_add_operand" "rI,O"))))]
279 (define_insn "*addsi_se2"
280 [(set (match_operand:DI 0 "register_operand" "=r,r")
282 (subreg:SI (plus:DI (match_operand:DI 1 "reg_or_0_operand" "%rJ,rJ")
283 (match_operand:DI 2 "sext_add_operand" "rI,O"))
291 [(set (match_operand:DI 0 "register_operand" "")
293 (plus:SI (match_operand:SI 1 "reg_not_elim_operand" "")
294 (match_operand:SI 2 "const_int_operand" ""))))
295 (clobber (match_operand:SI 3 "reg_not_elim_operand" ""))]
296 "! sext_add_operand (operands[2], SImode) && INTVAL (operands[2]) > 0
297 && INTVAL (operands[2]) % 4 == 0"
298 [(set (match_dup 3) (match_dup 4))
299 (set (match_dup 0) (sign_extend:DI (plus:SI (mult:SI (match_dup 3)
303 HOST_WIDE_INT val = INTVAL (operands[2]) / 4;
309 operands[4] = GEN_INT (val);
310 operands[5] = GEN_INT (mult);
314 [(set (match_operand:DI 0 "register_operand" "")
316 (plus:SI (match_operator:SI 1 "comparison_operator"
317 [(match_operand 2 "" "")
318 (match_operand 3 "" "")])
319 (match_operand:SI 4 "add_operand" ""))))
320 (clobber (match_operand:DI 5 "register_operand" ""))]
322 [(set (match_dup 5) (match_dup 6))
323 (set (match_dup 0) (sign_extend:DI (plus:SI (match_dup 7) (match_dup 4))))]
325 operands[6] = gen_rtx_fmt_ee (GET_CODE (operands[1]), DImode,
326 operands[2], operands[3]);
327 operands[7] = gen_lowpart (SImode, operands[5]);
330 (define_insn "addvsi3"
331 [(set (match_operand:SI 0 "register_operand" "=r,r")
332 (plus:SI (match_operand:SI 1 "reg_or_0_operand" "%rJ,rJ")
333 (match_operand:SI 2 "sext_add_operand" "rI,O")))
334 (trap_if (ne (plus:DI (sign_extend:DI (match_dup 1))
335 (sign_extend:DI (match_dup 2)))
336 (sign_extend:DI (plus:SI (match_dup 1)
344 (define_expand "adddi3"
345 [(set (match_operand:DI 0 "register_operand" "")
346 (plus:DI (match_operand:DI 1 "register_operand" "")
347 (match_operand:DI 2 "add_operand" "")))]
351 (define_insn "*adddi_er_lo16_dtp"
352 [(set (match_operand:DI 0 "register_operand" "=r")
353 (lo_sum:DI (match_operand:DI 1 "register_operand" "r")
354 (match_operand:DI 2 "dtp16_symbolic_operand" "")))]
356 "lda %0,%2(%1)\t\t!dtprel")
358 (define_insn "*adddi_er_hi32_dtp"
359 [(set (match_operand:DI 0 "register_operand" "=r")
360 (plus:DI (match_operand:DI 1 "register_operand" "r")
361 (high:DI (match_operand:DI 2 "dtp32_symbolic_operand" ""))))]
363 "ldah %0,%2(%1)\t\t!dtprelhi")
365 (define_insn "*adddi_er_lo32_dtp"
366 [(set (match_operand:DI 0 "register_operand" "=r")
367 (lo_sum:DI (match_operand:DI 1 "register_operand" "r")
368 (match_operand:DI 2 "dtp32_symbolic_operand" "")))]
370 "lda %0,%2(%1)\t\t!dtprello")
372 (define_insn "*adddi_er_lo16_tp"
373 [(set (match_operand:DI 0 "register_operand" "=r")
374 (lo_sum:DI (match_operand:DI 1 "register_operand" "r")
375 (match_operand:DI 2 "tp16_symbolic_operand" "")))]
377 "lda %0,%2(%1)\t\t!tprel")
379 (define_insn "*adddi_er_hi32_tp"
380 [(set (match_operand:DI 0 "register_operand" "=r")
381 (plus:DI (match_operand:DI 1 "register_operand" "r")
382 (high:DI (match_operand:DI 2 "tp32_symbolic_operand" ""))))]
384 "ldah %0,%2(%1)\t\t!tprelhi")
386 (define_insn "*adddi_er_lo32_tp"
387 [(set (match_operand:DI 0 "register_operand" "=r")
388 (lo_sum:DI (match_operand:DI 1 "register_operand" "r")
389 (match_operand:DI 2 "tp32_symbolic_operand" "")))]
391 "lda %0,%2(%1)\t\t!tprello")
393 (define_insn "*adddi_er_high_l"
394 [(set (match_operand:DI 0 "register_operand" "=r")
395 (plus:DI (match_operand:DI 1 "register_operand" "r")
396 (high:DI (match_operand:DI 2 "local_symbolic_operand" ""))))]
397 "TARGET_EXPLICIT_RELOCS && reload_completed"
398 "ldah %0,%2(%1)\t\t!gprelhigh"
399 [(set_attr "usegp" "yes")])
402 [(set (match_operand:DI 0 "register_operand" "")
403 (high:DI (match_operand:DI 1 "local_symbolic_operand" "")))]
404 "TARGET_EXPLICIT_RELOCS && reload_completed"
406 (plus:DI (match_dup 2) (high:DI (match_dup 1))))]
407 "operands[2] = pic_offset_table_rtx;")
409 ;; We used to expend quite a lot of effort choosing addq/subq/lda.
410 ;; With complications like
412 ;; The NT stack unwind code can't handle a subq to adjust the stack
413 ;; (that's a bug, but not one we can do anything about). As of NT4.0 SP3,
414 ;; the exception handling code will loop if a subq is used and an
417 ;; The 19980616 change to emit prologues as RTL also confused some
418 ;; versions of GDB, which also interprets prologues. This has been
419 ;; fixed as of GDB 4.18, but it does not harm to unconditionally
422 ;; and the fact that the three insns schedule exactly the same, it's
423 ;; just not worth the effort.
425 (define_insn "*adddi_internal"
426 [(set (match_operand:DI 0 "register_operand" "=r,r,r")
427 (plus:DI (match_operand:DI 1 "register_operand" "%r,r,r")
428 (match_operand:DI 2 "add_operand" "r,K,L")))]
435 ;; ??? Allow large constants when basing off the frame pointer or some
436 ;; virtual register that may eliminate to the frame pointer. This is
437 ;; done because register elimination offsets will change the hi/lo split,
438 ;; and if we split before reload, we will require additional instructions.
440 (define_insn "*adddi_fp_hack"
441 [(set (match_operand:DI 0 "register_operand" "=r")
442 (plus:DI (match_operand:DI 1 "reg_no_subreg_operand" "r")
443 (match_operand:DI 2 "const_int_operand" "n")))]
444 "NONSTRICT_REG_OK_FP_BASE_P (operands[1])
445 && INTVAL (operands[2]) >= 0
446 /* This is the largest constant an lda+ldah pair can add, minus
447 an upper bound on the displacement between SP and AP during
448 register elimination. See INITIAL_ELIMINATION_OFFSET. */
449 && INTVAL (operands[2])
451 - FIRST_PSEUDO_REGISTER * UNITS_PER_WORD
452 - ALPHA_ROUND(current_function_outgoing_args_size)
453 - (ALPHA_ROUND (get_frame_size ()
454 + max_reg_num () * UNITS_PER_WORD
455 + current_function_pretend_args_size)
456 - current_function_pretend_args_size))"
459 ;; Don't do this if we are adjusting SP since we don't want to do it
460 ;; in two steps. Don't split FP sources for the reason listed above.
462 [(set (match_operand:DI 0 "register_operand" "")
463 (plus:DI (match_operand:DI 1 "register_operand" "")
464 (match_operand:DI 2 "const_int_operand" "")))]
465 "! add_operand (operands[2], DImode)
466 && operands[0] != stack_pointer_rtx
467 && operands[1] != frame_pointer_rtx
468 && operands[1] != arg_pointer_rtx"
469 [(set (match_dup 0) (plus:DI (match_dup 1) (match_dup 3)))
470 (set (match_dup 0) (plus:DI (match_dup 0) (match_dup 4)))]
472 HOST_WIDE_INT val = INTVAL (operands[2]);
473 HOST_WIDE_INT low = (val & 0xffff) - 2 * (val & 0x8000);
474 HOST_WIDE_INT rest = val - low;
476 operands[4] = GEN_INT (low);
477 if (CONST_OK_FOR_LETTER_P (rest, 'L'))
478 operands[3] = GEN_INT (rest);
479 else if (! no_new_pseudos)
481 operands[3] = gen_reg_rtx (DImode);
482 emit_move_insn (operands[3], operands[2]);
483 emit_insn (gen_adddi3 (operands[0], operands[1], operands[3]));
490 (define_insn "*saddl"
491 [(set (match_operand:SI 0 "register_operand" "=r,r")
492 (plus:SI (mult:SI (match_operand:SI 1 "reg_not_elim_operand" "r,r")
493 (match_operand:SI 2 "const48_operand" "I,I"))
494 (match_operand:SI 3 "sext_add_operand" "rI,O")))]
500 (define_insn "*saddl_se"
501 [(set (match_operand:DI 0 "register_operand" "=r,r")
503 (plus:SI (mult:SI (match_operand:SI 1 "reg_not_elim_operand" "r,r")
504 (match_operand:SI 2 "const48_operand" "I,I"))
505 (match_operand:SI 3 "sext_add_operand" "rI,O"))))]
512 [(set (match_operand:DI 0 "register_operand" "")
514 (plus:SI (mult:SI (match_operator:SI 1 "comparison_operator"
515 [(match_operand 2 "" "")
516 (match_operand 3 "" "")])
517 (match_operand:SI 4 "const48_operand" ""))
518 (match_operand:SI 5 "sext_add_operand" ""))))
519 (clobber (match_operand:DI 6 "reg_not_elim_operand" ""))]
521 [(set (match_dup 6) (match_dup 7))
523 (sign_extend:DI (plus:SI (mult:SI (match_dup 8) (match_dup 4))
526 operands[7] = gen_rtx_fmt_ee (GET_CODE (operands[1]), DImode,
527 operands[2], operands[3]);
528 operands[8] = gen_lowpart (SImode, operands[6]);
531 (define_insn "*saddq"
532 [(set (match_operand:DI 0 "register_operand" "=r,r")
533 (plus:DI (mult:DI (match_operand:DI 1 "reg_not_elim_operand" "r,r")
534 (match_operand:DI 2 "const48_operand" "I,I"))
535 (match_operand:DI 3 "sext_add_operand" "rI,O")))]
541 (define_insn "addvdi3"
542 [(set (match_operand:DI 0 "register_operand" "=r,r")
543 (plus:DI (match_operand:DI 1 "reg_or_0_operand" "%rJ,rJ")
544 (match_operand:DI 2 "sext_add_operand" "rI,O")))
545 (trap_if (ne (plus:TI (sign_extend:TI (match_dup 1))
546 (sign_extend:TI (match_dup 2)))
547 (sign_extend:TI (plus:DI (match_dup 1)
555 (define_insn "negsi2"
556 [(set (match_operand:SI 0 "register_operand" "=r")
557 (neg:SI (match_operand:SI 1 "reg_or_8bit_operand" "rI")))]
561 (define_insn "*negsi_se"
562 [(set (match_operand:DI 0 "register_operand" "=r")
563 (sign_extend:DI (neg:SI
564 (match_operand:SI 1 "reg_or_8bit_operand" "rI"))))]
568 (define_insn "negvsi2"
569 [(set (match_operand:SI 0 "register_operand" "=r")
570 (neg:SI (match_operand:SI 1 "register_operand" "r")))
571 (trap_if (ne (neg:DI (sign_extend:DI (match_dup 1)))
572 (sign_extend:DI (neg:SI (match_dup 1))))
577 (define_insn "negdi2"
578 [(set (match_operand:DI 0 "register_operand" "=r")
579 (neg:DI (match_operand:DI 1 "reg_or_8bit_operand" "rI")))]
583 (define_insn "negvdi2"
584 [(set (match_operand:DI 0 "register_operand" "=r")
585 (neg:DI (match_operand:DI 1 "register_operand" "r")))
586 (trap_if (ne (neg:TI (sign_extend:TI (match_dup 1)))
587 (sign_extend:TI (neg:DI (match_dup 1))))
592 (define_expand "subsi3"
593 [(set (match_operand:SI 0 "register_operand" "")
594 (minus:SI (match_operand:SI 1 "reg_or_0_operand" "")
595 (match_operand:SI 2 "reg_or_8bit_operand" "")))]
599 (define_insn "*subsi_internal"
600 [(set (match_operand:SI 0 "register_operand" "=r")
601 (minus:SI (match_operand:SI 1 "reg_or_0_operand" "rJ")
602 (match_operand:SI 2 "reg_or_8bit_operand" "rI")))]
606 (define_insn "*subsi_se"
607 [(set (match_operand:DI 0 "register_operand" "=r")
608 (sign_extend:DI (minus:SI (match_operand:SI 1 "reg_or_0_operand" "rJ")
609 (match_operand:SI 2 "reg_or_8bit_operand" "rI"))))]
613 (define_insn "*subsi_se2"
614 [(set (match_operand:DI 0 "register_operand" "=r")
616 (subreg:SI (minus:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
617 (match_operand:DI 2 "reg_or_8bit_operand" "rI"))
622 (define_insn "subvsi3"
623 [(set (match_operand:SI 0 "register_operand" "=r")
624 (minus:SI (match_operand:SI 1 "reg_or_0_operand" "rJ")
625 (match_operand:SI 2 "reg_or_8bit_operand" "rI")))
626 (trap_if (ne (minus:DI (sign_extend:DI (match_dup 1))
627 (sign_extend:DI (match_dup 2)))
628 (sign_extend:DI (minus:SI (match_dup 1)
634 (define_insn "subdi3"
635 [(set (match_operand:DI 0 "register_operand" "=r")
636 (minus:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
637 (match_operand:DI 2 "reg_or_8bit_operand" "rI")))]
641 (define_insn "*ssubl"
642 [(set (match_operand:SI 0 "register_operand" "=r")
643 (minus:SI (mult:SI (match_operand:SI 1 "reg_not_elim_operand" "r")
644 (match_operand:SI 2 "const48_operand" "I"))
645 (match_operand:SI 3 "reg_or_8bit_operand" "rI")))]
649 (define_insn "*ssubl_se"
650 [(set (match_operand:DI 0 "register_operand" "=r")
652 (minus:SI (mult:SI (match_operand:SI 1 "reg_not_elim_operand" "r")
653 (match_operand:SI 2 "const48_operand" "I"))
654 (match_operand:SI 3 "reg_or_8bit_operand" "rI"))))]
658 (define_insn "*ssubq"
659 [(set (match_operand:DI 0 "register_operand" "=r")
660 (minus:DI (mult:DI (match_operand:DI 1 "reg_not_elim_operand" "r")
661 (match_operand:DI 2 "const48_operand" "I"))
662 (match_operand:DI 3 "reg_or_8bit_operand" "rI")))]
666 (define_insn "subvdi3"
667 [(set (match_operand:DI 0 "register_operand" "=r")
668 (minus:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
669 (match_operand:DI 2 "reg_or_8bit_operand" "rI")))
670 (trap_if (ne (minus:TI (sign_extend:TI (match_dup 1))
671 (sign_extend:TI (match_dup 2)))
672 (sign_extend:TI (minus:DI (match_dup 1)
678 ;; The Unicos/Mk assembler doesn't support mull.
680 (define_insn "mulsi3"
681 [(set (match_operand:SI 0 "register_operand" "=r")
682 (mult:SI (match_operand:SI 1 "reg_or_0_operand" "%rJ")
683 (match_operand:SI 2 "reg_or_8bit_operand" "rI")))]
684 "!TARGET_ABI_UNICOSMK"
686 [(set_attr "type" "imul")
687 (set_attr "opsize" "si")])
689 (define_insn "*mulsi_se"
690 [(set (match_operand:DI 0 "register_operand" "=r")
692 (mult:SI (match_operand:SI 1 "reg_or_0_operand" "%rJ")
693 (match_operand:SI 2 "reg_or_8bit_operand" "rI"))))]
694 "!TARGET_ABI_UNICOSMK"
696 [(set_attr "type" "imul")
697 (set_attr "opsize" "si")])
699 (define_insn "mulvsi3"
700 [(set (match_operand:SI 0 "register_operand" "=r")
701 (mult:SI (match_operand:SI 1 "reg_or_0_operand" "%rJ")
702 (match_operand:SI 2 "reg_or_8bit_operand" "rI")))
703 (trap_if (ne (mult:DI (sign_extend:DI (match_dup 1))
704 (sign_extend:DI (match_dup 2)))
705 (sign_extend:DI (mult:SI (match_dup 1)
708 "!TARGET_ABI_UNICOSMK"
710 [(set_attr "type" "imul")
711 (set_attr "opsize" "si")])
713 (define_insn "muldi3"
714 [(set (match_operand:DI 0 "register_operand" "=r")
715 (mult:DI (match_operand:DI 1 "reg_or_0_operand" "%rJ")
716 (match_operand:DI 2 "reg_or_8bit_operand" "rI")))]
719 [(set_attr "type" "imul")])
721 (define_insn "mulvdi3"
722 [(set (match_operand:DI 0 "register_operand" "=r")
723 (mult:DI (match_operand:DI 1 "reg_or_0_operand" "%rJ")
724 (match_operand:DI 2 "reg_or_8bit_operand" "rI")))
725 (trap_if (ne (mult:TI (sign_extend:TI (match_dup 1))
726 (sign_extend:TI (match_dup 2)))
727 (sign_extend:TI (mult:DI (match_dup 1)
732 [(set_attr "type" "imul")])
734 (define_expand "umuldi3_highpart"
735 [(set (match_operand:DI 0 "register_operand" "")
738 (mult:TI (zero_extend:TI
739 (match_operand:DI 1 "register_operand" ""))
740 (match_operand:DI 2 "reg_or_8bit_operand" ""))
744 if (REG_P (operands[2]))
745 operands[2] = gen_rtx_ZERO_EXTEND (TImode, operands[2]);
748 (define_insn "*umuldi3_highpart_reg"
749 [(set (match_operand:DI 0 "register_operand" "=r")
752 (mult:TI (zero_extend:TI
753 (match_operand:DI 1 "register_operand" "r"))
755 (match_operand:DI 2 "register_operand" "r")))
759 [(set_attr "type" "imul")
760 (set_attr "opsize" "udi")])
762 (define_insn "*umuldi3_highpart_const"
763 [(set (match_operand:DI 0 "register_operand" "=r")
766 (mult:TI (zero_extend:TI (match_operand:DI 1 "register_operand" "r"))
767 (match_operand:TI 2 "cint8_operand" "I"))
771 [(set_attr "type" "imul")
772 (set_attr "opsize" "udi")])
774 ;; The divide and remainder operations take their inputs from r24 and
775 ;; r25, put their output in r27, and clobber r23 and r28 on all
776 ;; systems except Unicos/Mk. On Unicos, the standard library provides
777 ;; subroutines which use the standard calling convention and work on
780 ;; ??? Force sign-extension here because some versions of OSF/1 and
781 ;; Interix/NT don't do the right thing if the inputs are not properly
782 ;; sign-extended. But Linux, for instance, does not have this
783 ;; problem. Is it worth the complication here to eliminate the sign
786 (define_expand "divsi3"
788 (sign_extend:DI (match_operand:SI 1 "nonimmediate_operand" "")))
790 (sign_extend:DI (match_operand:SI 2 "nonimmediate_operand" "")))
791 (parallel [(set (match_dup 5)
792 (sign_extend:DI (div:SI (match_dup 3) (match_dup 4))))
793 (clobber (reg:DI 23))
794 (clobber (reg:DI 28))])
795 (set (match_operand:SI 0 "nonimmediate_operand" "")
796 (subreg:SI (match_dup 5) 0))]
797 "! TARGET_ABI_OPEN_VMS && ! TARGET_ABI_UNICOSMK"
799 operands[3] = gen_reg_rtx (DImode);
800 operands[4] = gen_reg_rtx (DImode);
801 operands[5] = gen_reg_rtx (DImode);
804 (define_expand "udivsi3"
806 (sign_extend:DI (match_operand:SI 1 "nonimmediate_operand" "")))
808 (sign_extend:DI (match_operand:SI 2 "nonimmediate_operand" "")))
809 (parallel [(set (match_dup 5)
810 (sign_extend:DI (udiv:SI (match_dup 3) (match_dup 4))))
811 (clobber (reg:DI 23))
812 (clobber (reg:DI 28))])
813 (set (match_operand:SI 0 "nonimmediate_operand" "")
814 (subreg:SI (match_dup 5) 0))]
815 "! TARGET_ABI_OPEN_VMS && ! TARGET_ABI_UNICOSMK"
817 operands[3] = gen_reg_rtx (DImode);
818 operands[4] = gen_reg_rtx (DImode);
819 operands[5] = gen_reg_rtx (DImode);
822 (define_expand "modsi3"
824 (sign_extend:DI (match_operand:SI 1 "nonimmediate_operand" "")))
826 (sign_extend:DI (match_operand:SI 2 "nonimmediate_operand" "")))
827 (parallel [(set (match_dup 5)
828 (sign_extend:DI (mod:SI (match_dup 3) (match_dup 4))))
829 (clobber (reg:DI 23))
830 (clobber (reg:DI 28))])
831 (set (match_operand:SI 0 "nonimmediate_operand" "")
832 (subreg:SI (match_dup 5) 0))]
833 "! TARGET_ABI_OPEN_VMS && ! TARGET_ABI_UNICOSMK"
835 operands[3] = gen_reg_rtx (DImode);
836 operands[4] = gen_reg_rtx (DImode);
837 operands[5] = gen_reg_rtx (DImode);
840 (define_expand "umodsi3"
842 (sign_extend:DI (match_operand:SI 1 "nonimmediate_operand" "")))
844 (sign_extend:DI (match_operand:SI 2 "nonimmediate_operand" "")))
845 (parallel [(set (match_dup 5)
846 (sign_extend:DI (umod:SI (match_dup 3) (match_dup 4))))
847 (clobber (reg:DI 23))
848 (clobber (reg:DI 28))])
849 (set (match_operand:SI 0 "nonimmediate_operand" "")
850 (subreg:SI (match_dup 5) 0))]
851 "! TARGET_ABI_OPEN_VMS && ! TARGET_ABI_UNICOSMK"
853 operands[3] = gen_reg_rtx (DImode);
854 operands[4] = gen_reg_rtx (DImode);
855 operands[5] = gen_reg_rtx (DImode);
858 (define_expand "divdi3"
859 [(parallel [(set (match_operand:DI 0 "register_operand" "")
860 (div:DI (match_operand:DI 1 "register_operand" "")
861 (match_operand:DI 2 "register_operand" "")))
862 (clobber (reg:DI 23))
863 (clobber (reg:DI 28))])]
864 "! TARGET_ABI_OPEN_VMS && ! TARGET_ABI_UNICOSMK"
867 (define_expand "udivdi3"
868 [(parallel [(set (match_operand:DI 0 "register_operand" "")
869 (udiv:DI (match_operand:DI 1 "register_operand" "")
870 (match_operand:DI 2 "register_operand" "")))
871 (clobber (reg:DI 23))
872 (clobber (reg:DI 28))])]
873 "! TARGET_ABI_OPEN_VMS && ! TARGET_ABI_UNICOSMK"
876 (define_expand "moddi3"
877 [(use (match_operand:DI 0 "register_operand" ""))
878 (use (match_operand:DI 1 "register_operand" ""))
879 (use (match_operand:DI 2 "register_operand" ""))]
880 "!TARGET_ABI_OPEN_VMS"
882 if (TARGET_ABI_UNICOSMK)
883 emit_insn (gen_moddi3_umk (operands[0], operands[1], operands[2]));
885 emit_insn (gen_moddi3_dft (operands[0], operands[1], operands[2]));
889 (define_expand "moddi3_dft"
890 [(parallel [(set (match_operand:DI 0 "register_operand" "")
891 (mod:DI (match_operand:DI 1 "register_operand" "")
892 (match_operand:DI 2 "register_operand" "")))
893 (clobber (reg:DI 23))
894 (clobber (reg:DI 28))])]
895 "! TARGET_ABI_OPEN_VMS && ! TARGET_ABI_UNICOSMK"
898 ;; On Unicos/Mk, we do as the system's C compiler does:
899 ;; compute the quotient, multiply and subtract.
901 (define_expand "moddi3_umk"
902 [(use (match_operand:DI 0 "register_operand" ""))
903 (use (match_operand:DI 1 "register_operand" ""))
904 (use (match_operand:DI 2 "register_operand" ""))]
905 "TARGET_ABI_UNICOSMK"
907 rtx div, mul = gen_reg_rtx (DImode);
909 div = expand_binop (DImode, sdiv_optab, operands[1], operands[2],
910 NULL_RTX, 0, OPTAB_LIB);
911 div = force_reg (DImode, div);
912 emit_insn (gen_muldi3 (mul, operands[2], div));
913 emit_insn (gen_subdi3 (operands[0], operands[1], mul));
917 (define_expand "umoddi3"
918 [(use (match_operand:DI 0 "register_operand" ""))
919 (use (match_operand:DI 1 "register_operand" ""))
920 (use (match_operand:DI 2 "register_operand" ""))]
921 "! TARGET_ABI_OPEN_VMS"
923 if (TARGET_ABI_UNICOSMK)
924 emit_insn (gen_umoddi3_umk (operands[0], operands[1], operands[2]));
926 emit_insn (gen_umoddi3_dft (operands[0], operands[1], operands[2]));
930 (define_expand "umoddi3_dft"
931 [(parallel [(set (match_operand:DI 0 "register_operand" "")
932 (umod:DI (match_operand:DI 1 "register_operand" "")
933 (match_operand:DI 2 "register_operand" "")))
934 (clobber (reg:DI 23))
935 (clobber (reg:DI 28))])]
936 "! TARGET_ABI_OPEN_VMS && ! TARGET_ABI_UNICOSMK"
939 (define_expand "umoddi3_umk"
940 [(use (match_operand:DI 0 "register_operand" ""))
941 (use (match_operand:DI 1 "register_operand" ""))
942 (use (match_operand:DI 2 "register_operand" ""))]
943 "TARGET_ABI_UNICOSMK"
945 rtx div, mul = gen_reg_rtx (DImode);
947 div = expand_binop (DImode, udiv_optab, operands[1], operands[2],
948 NULL_RTX, 1, OPTAB_LIB);
949 div = force_reg (DImode, div);
950 emit_insn (gen_muldi3 (mul, operands[2], div));
951 emit_insn (gen_subdi3 (operands[0], operands[1], mul));
955 ;; Lengths of 8 for ldq $t12,__divq($gp); jsr $t9,($t12),__divq as
956 ;; expanded by the assembler.
958 (define_insn_and_split "*divmodsi_internal_er"
959 [(set (match_operand:DI 0 "register_operand" "=c")
960 (sign_extend:DI (match_operator:SI 3 "divmod_operator"
961 [(match_operand:DI 1 "register_operand" "a")
962 (match_operand:DI 2 "register_operand" "b")])))
963 (clobber (reg:DI 23))
964 (clobber (reg:DI 28))]
965 "TARGET_EXPLICIT_RELOCS && ! TARGET_ABI_OPEN_VMS"
966 "ldq $27,__%E3($29)\t\t!literal!%#\;jsr $23,($27),__%E3\t\t!lituse_jsr!%#"
967 "&& reload_completed"
968 [(parallel [(set (match_dup 0)
969 (sign_extend:DI (match_dup 3)))
972 (clobber (reg:DI 23))
973 (clobber (reg:DI 28))])]
976 switch (GET_CODE (operands[3]))
993 operands[4] = GEN_INT (alpha_next_sequence_number++);
994 emit_insn (gen_movdi_er_high_g (operands[0], pic_offset_table_rtx,
995 gen_rtx_SYMBOL_REF (DImode, str),
998 [(set_attr "type" "jsr")
999 (set_attr "length" "8")])
1001 (define_insn "*divmodsi_internal_er_1"
1002 [(set (match_operand:DI 0 "register_operand" "=c")
1003 (sign_extend:DI (match_operator:SI 3 "divmod_operator"
1004 [(match_operand:DI 1 "register_operand" "a")
1005 (match_operand:DI 2 "register_operand" "b")])))
1006 (use (match_operand:DI 4 "register_operand" "c"))
1007 (use (match_operand 5 "const_int_operand" ""))
1008 (clobber (reg:DI 23))
1009 (clobber (reg:DI 28))]
1010 "TARGET_EXPLICIT_RELOCS && ! TARGET_ABI_OPEN_VMS"
1011 "jsr $23,($27),__%E3%J5"
1012 [(set_attr "type" "jsr")
1013 (set_attr "length" "4")])
1015 (define_insn "*divmodsi_internal"
1016 [(set (match_operand:DI 0 "register_operand" "=c")
1017 (sign_extend:DI (match_operator:SI 3 "divmod_operator"
1018 [(match_operand:DI 1 "register_operand" "a")
1019 (match_operand:DI 2 "register_operand" "b")])))
1020 (clobber (reg:DI 23))
1021 (clobber (reg:DI 28))]
1022 "! TARGET_ABI_OPEN_VMS && ! TARGET_ABI_UNICOSMK"
1024 [(set_attr "type" "jsr")
1025 (set_attr "length" "8")])
1027 (define_insn_and_split "*divmoddi_internal_er"
1028 [(set (match_operand:DI 0 "register_operand" "=c")
1029 (match_operator:DI 3 "divmod_operator"
1030 [(match_operand:DI 1 "register_operand" "a")
1031 (match_operand:DI 2 "register_operand" "b")]))
1032 (clobber (reg:DI 23))
1033 (clobber (reg:DI 28))]
1034 "TARGET_EXPLICIT_RELOCS && ! TARGET_ABI_OPEN_VMS"
1035 "ldq $27,__%E3($29)\t\t!literal!%#\;jsr $23,($27),__%E3\t\t!lituse_jsr!%#"
1036 "&& reload_completed"
1037 [(parallel [(set (match_dup 0) (match_dup 3))
1040 (clobber (reg:DI 23))
1041 (clobber (reg:DI 28))])]
1044 switch (GET_CODE (operands[3]))
1061 operands[4] = GEN_INT (alpha_next_sequence_number++);
1062 emit_insn (gen_movdi_er_high_g (operands[0], pic_offset_table_rtx,
1063 gen_rtx_SYMBOL_REF (DImode, str),
1066 [(set_attr "type" "jsr")
1067 (set_attr "length" "8")])
1069 (define_insn "*divmoddi_internal_er_1"
1070 [(set (match_operand:DI 0 "register_operand" "=c")
1071 (match_operator:DI 3 "divmod_operator"
1072 [(match_operand:DI 1 "register_operand" "a")
1073 (match_operand:DI 2 "register_operand" "b")]))
1074 (use (match_operand:DI 4 "register_operand" "c"))
1075 (use (match_operand 5 "const_int_operand" ""))
1076 (clobber (reg:DI 23))
1077 (clobber (reg:DI 28))]
1078 "TARGET_EXPLICIT_RELOCS && ! TARGET_ABI_OPEN_VMS"
1079 "jsr $23,($27),__%E3%J5"
1080 [(set_attr "type" "jsr")
1081 (set_attr "length" "4")])
1083 (define_insn "*divmoddi_internal"
1084 [(set (match_operand:DI 0 "register_operand" "=c")
1085 (match_operator:DI 3 "divmod_operator"
1086 [(match_operand:DI 1 "register_operand" "a")
1087 (match_operand:DI 2 "register_operand" "b")]))
1088 (clobber (reg:DI 23))
1089 (clobber (reg:DI 28))]
1090 "! TARGET_ABI_OPEN_VMS && ! TARGET_ABI_UNICOSMK"
1092 [(set_attr "type" "jsr")
1093 (set_attr "length" "8")])
1095 ;; Next are the basic logical operations. These only exist in DImode.
1097 (define_insn "anddi3"
1098 [(set (match_operand:DI 0 "register_operand" "=r,r,r")
1099 (and:DI (match_operand:DI 1 "reg_or_0_operand" "%rJ,rJ,rJ")
1100 (match_operand:DI 2 "and_operand" "rI,N,MH")))]
1106 [(set_attr "type" "ilog,ilog,shift")])
1108 ;; There are times when we can split an AND into two AND insns. This occurs
1109 ;; when we can first clear any bytes and then clear anything else. For
1110 ;; example "I & 0xffff07" is "(I & 0xffffff) & 0xffffffffffffff07".
1111 ;; Only do this when running on 64-bit host since the computations are
1112 ;; too messy otherwise.
1115 [(set (match_operand:DI 0 "register_operand" "")
1116 (and:DI (match_operand:DI 1 "register_operand" "")
1117 (match_operand:DI 2 "const_int_operand" "")))]
1118 "HOST_BITS_PER_WIDE_INT == 64 && ! and_operand (operands[2], DImode)"
1119 [(set (match_dup 0) (and:DI (match_dup 1) (match_dup 3)))
1120 (set (match_dup 0) (and:DI (match_dup 0) (match_dup 4)))]
1122 unsigned HOST_WIDE_INT mask1 = INTVAL (operands[2]);
1123 unsigned HOST_WIDE_INT mask2 = mask1;
1126 /* For each byte that isn't all zeros, make it all ones. */
1127 for (i = 0; i < 64; i += 8)
1128 if ((mask1 & ((HOST_WIDE_INT) 0xff << i)) != 0)
1129 mask1 |= (HOST_WIDE_INT) 0xff << i;
1131 /* Now turn on any bits we've just turned off. */
1134 operands[3] = GEN_INT (mask1);
1135 operands[4] = GEN_INT (mask2);
1138 (define_expand "zero_extendqihi2"
1139 [(set (match_operand:HI 0 "register_operand" "")
1140 (zero_extend:HI (match_operand:QI 1 "nonimmediate_operand" "")))]
1144 operands[1] = force_reg (QImode, operands[1]);
1147 (define_insn "*zero_extendqihi2_bwx"
1148 [(set (match_operand:HI 0 "register_operand" "=r,r")
1149 (zero_extend:HI (match_operand:QI 1 "nonimmediate_operand" "r,m")))]
1154 [(set_attr "type" "ilog,ild")])
1156 (define_insn "*zero_extendqihi2_nobwx"
1157 [(set (match_operand:HI 0 "register_operand" "=r")
1158 (zero_extend:HI (match_operand:QI 1 "register_operand" "r")))]
1161 [(set_attr "type" "ilog")])
1163 (define_expand "zero_extendqisi2"
1164 [(set (match_operand:SI 0 "register_operand" "")
1165 (zero_extend:SI (match_operand:QI 1 "nonimmediate_operand" "")))]
1169 operands[1] = force_reg (QImode, operands[1]);
1172 (define_insn "*zero_extendqisi2_bwx"
1173 [(set (match_operand:SI 0 "register_operand" "=r,r")
1174 (zero_extend:SI (match_operand:QI 1 "nonimmediate_operand" "r,m")))]
1179 [(set_attr "type" "ilog,ild")])
1181 (define_insn "*zero_extendqisi2_nobwx"
1182 [(set (match_operand:SI 0 "register_operand" "=r")
1183 (zero_extend:SI (match_operand:QI 1 "register_operand" "r")))]
1186 [(set_attr "type" "ilog")])
1188 (define_expand "zero_extendqidi2"
1189 [(set (match_operand:DI 0 "register_operand" "")
1190 (zero_extend:DI (match_operand:QI 1 "nonimmediate_operand" "")))]
1194 operands[1] = force_reg (QImode, operands[1]);
1197 (define_insn "*zero_extendqidi2_bwx"
1198 [(set (match_operand:DI 0 "register_operand" "=r,r")
1199 (zero_extend:DI (match_operand:QI 1 "nonimmediate_operand" "r,m")))]
1204 [(set_attr "type" "ilog,ild")])
1206 (define_insn "*zero_extendqidi2_nobwx"
1207 [(set (match_operand:DI 0 "register_operand" "=r")
1208 (zero_extend:DI (match_operand:QI 1 "register_operand" "r")))]
1211 [(set_attr "type" "ilog")])
1213 (define_expand "zero_extendhisi2"
1214 [(set (match_operand:SI 0 "register_operand" "")
1215 (zero_extend:SI (match_operand:HI 1 "nonimmediate_operand" "")))]
1219 operands[1] = force_reg (HImode, operands[1]);
1222 (define_insn "*zero_extendhisi2_bwx"
1223 [(set (match_operand:SI 0 "register_operand" "=r,r")
1224 (zero_extend:SI (match_operand:HI 1 "nonimmediate_operand" "r,m")))]
1229 [(set_attr "type" "shift,ild")])
1231 (define_insn "*zero_extendhisi2_nobwx"
1232 [(set (match_operand:SI 0 "register_operand" "=r")
1233 (zero_extend:SI (match_operand:HI 1 "register_operand" "r")))]
1236 [(set_attr "type" "shift")])
1238 (define_expand "zero_extendhidi2"
1239 [(set (match_operand:DI 0 "register_operand" "")
1240 (zero_extend:DI (match_operand:HI 1 "nonimmediate_operand" "")))]
1244 operands[1] = force_reg (HImode, operands[1]);
1247 (define_insn "*zero_extendhidi2_bwx"
1248 [(set (match_operand:DI 0 "register_operand" "=r,r")
1249 (zero_extend:DI (match_operand:HI 1 "nonimmediate_operand" "r,m")))]
1254 [(set_attr "type" "shift,ild")])
1256 (define_insn "*zero_extendhidi2_nobwx"
1257 [(set (match_operand:DI 0 "register_operand" "=r")
1258 (zero_extend:DI (match_operand:HI 1 "register_operand" "r")))]
1261 [(set_attr "type" "shift")])
1263 (define_insn "zero_extendsidi2"
1264 [(set (match_operand:DI 0 "register_operand" "=r")
1265 (zero_extend:DI (match_operand:SI 1 "register_operand" "r")))]
1268 [(set_attr "type" "shift")])
1270 (define_insn "andnotdi3"
1271 [(set (match_operand:DI 0 "register_operand" "=r")
1272 (and:DI (not:DI (match_operand:DI 1 "reg_or_8bit_operand" "rI"))
1273 (match_operand:DI 2 "reg_or_0_operand" "rJ")))]
1276 [(set_attr "type" "ilog")])
1278 (define_insn "iordi3"
1279 [(set (match_operand:DI 0 "register_operand" "=r,r")
1280 (ior:DI (match_operand:DI 1 "reg_or_0_operand" "%rJ,rJ")
1281 (match_operand:DI 2 "or_operand" "rI,N")))]
1286 [(set_attr "type" "ilog")])
1288 (define_insn "one_cmpldi2"
1289 [(set (match_operand:DI 0 "register_operand" "=r")
1290 (not:DI (match_operand:DI 1 "reg_or_8bit_operand" "rI")))]
1293 [(set_attr "type" "ilog")])
1295 (define_insn "*iornot"
1296 [(set (match_operand:DI 0 "register_operand" "=r")
1297 (ior:DI (not:DI (match_operand:DI 1 "reg_or_8bit_operand" "rI"))
1298 (match_operand:DI 2 "reg_or_0_operand" "rJ")))]
1301 [(set_attr "type" "ilog")])
1303 (define_insn "xordi3"
1304 [(set (match_operand:DI 0 "register_operand" "=r,r")
1305 (xor:DI (match_operand:DI 1 "reg_or_0_operand" "%rJ,rJ")
1306 (match_operand:DI 2 "or_operand" "rI,N")))]
1311 [(set_attr "type" "ilog")])
1313 (define_insn "*xornot"
1314 [(set (match_operand:DI 0 "register_operand" "=r")
1315 (not:DI (xor:DI (match_operand:DI 1 "register_operand" "%rJ")
1316 (match_operand:DI 2 "register_operand" "rI"))))]
1319 [(set_attr "type" "ilog")])
1321 ;; Handle FFS and related insns iff we support CIX.
1323 (define_expand "ffsdi2"
1325 (unspec:DI [(match_operand:DI 1 "register_operand" "")] UNSPEC_CTTZ))
1327 (plus:DI (match_dup 2) (const_int 1)))
1328 (set (match_operand:DI 0 "register_operand" "")
1329 (if_then_else:DI (eq (match_dup 1) (const_int 0))
1330 (const_int 0) (match_dup 3)))]
1333 operands[2] = gen_reg_rtx (DImode);
1334 operands[3] = gen_reg_rtx (DImode);
1337 (define_insn "*cttz"
1338 [(set (match_operand:DI 0 "register_operand" "=r")
1339 (unspec:DI [(match_operand:DI 1 "register_operand" "r")] UNSPEC_CTTZ))]
1342 ; EV6 calls all mvi and cttz/ctlz/popc class imisc, so just
1343 ; reuse the existing type name.
1344 [(set_attr "type" "mvi")])
1346 (define_insn "clzdi2"
1347 [(set (match_operand:DI 0 "register_operand" "=r")
1348 (clz:DI (match_operand:DI 1 "register_operand" "r")))]
1351 [(set_attr "type" "mvi")])
1353 (define_insn "ctzdi2"
1354 [(set (match_operand:DI 0 "register_operand" "=r")
1355 (ctz:DI (match_operand:DI 1 "register_operand" "r")))]
1358 [(set_attr "type" "mvi")])
1360 (define_insn "popcountdi2"
1361 [(set (match_operand:DI 0 "register_operand" "=r")
1362 (popcount:DI (match_operand:DI 1 "register_operand" "r")))]
1365 [(set_attr "type" "mvi")])
1367 ;; Next come the shifts and the various extract and insert operations.
1369 (define_insn "ashldi3"
1370 [(set (match_operand:DI 0 "register_operand" "=r,r")
1371 (ashift:DI (match_operand:DI 1 "reg_or_0_operand" "rJ,rJ")
1372 (match_operand:DI 2 "reg_or_6bit_operand" "P,rS")))]
1375 switch (which_alternative)
1378 if (operands[2] == const1_rtx)
1379 return "addq %r1,%r1,%0";
1381 return "s%P2addq %r1,0,%0";
1383 return "sll %r1,%2,%0";
1388 [(set_attr "type" "iadd,shift")])
1390 (define_insn "*ashldi_se"
1391 [(set (match_operand:DI 0 "register_operand" "=r")
1393 (subreg:SI (ashift:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
1394 (match_operand:DI 2 "const_int_operand" "P"))
1396 "INTVAL (operands[2]) >= 1 && INTVAL (operands[2]) <= 3"
1398 if (operands[2] == const1_rtx)
1399 return "addl %r1,%r1,%0";
1401 return "s%P2addl %r1,0,%0";
1403 [(set_attr "type" "iadd")])
1405 (define_insn "lshrdi3"
1406 [(set (match_operand:DI 0 "register_operand" "=r")
1407 (lshiftrt:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
1408 (match_operand:DI 2 "reg_or_6bit_operand" "rS")))]
1411 [(set_attr "type" "shift")])
1413 (define_insn "ashrdi3"
1414 [(set (match_operand:DI 0 "register_operand" "=r")
1415 (ashiftrt:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
1416 (match_operand:DI 2 "reg_or_6bit_operand" "rS")))]
1419 [(set_attr "type" "shift")])
1421 (define_expand "extendqihi2"
1423 (ashift:DI (match_operand:QI 1 "some_operand" "")
1425 (set (match_operand:HI 0 "register_operand" "")
1426 (ashiftrt:DI (match_dup 2)
1432 emit_insn (gen_extendqihi2x (operands[0],
1433 force_reg (QImode, operands[1])));
1437 /* If we have an unaligned MEM, extend to DImode (which we do
1438 specially) and then copy to the result. */
1439 if (unaligned_memory_operand (operands[1], HImode))
1441 rtx temp = gen_reg_rtx (DImode);
1443 emit_insn (gen_extendqidi2 (temp, operands[1]));
1444 emit_move_insn (operands[0], gen_lowpart (HImode, temp));
1448 operands[0] = gen_lowpart (DImode, operands[0]);
1449 operands[1] = gen_lowpart (DImode, force_reg (QImode, operands[1]));
1450 operands[2] = gen_reg_rtx (DImode);
1453 (define_insn "extendqidi2x"
1454 [(set (match_operand:DI 0 "register_operand" "=r")
1455 (sign_extend:DI (match_operand:QI 1 "register_operand" "r")))]
1458 [(set_attr "type" "shift")])
1460 (define_insn "extendhidi2x"
1461 [(set (match_operand:DI 0 "register_operand" "=r")
1462 (sign_extend:DI (match_operand:HI 1 "register_operand" "r")))]
1465 [(set_attr "type" "shift")])
1467 (define_insn "extendqisi2x"
1468 [(set (match_operand:SI 0 "register_operand" "=r")
1469 (sign_extend:SI (match_operand:QI 1 "register_operand" "r")))]
1472 [(set_attr "type" "shift")])
1474 (define_insn "extendhisi2x"
1475 [(set (match_operand:SI 0 "register_operand" "=r")
1476 (sign_extend:SI (match_operand:HI 1 "register_operand" "r")))]
1479 [(set_attr "type" "shift")])
1481 (define_insn "extendqihi2x"
1482 [(set (match_operand:HI 0 "register_operand" "=r")
1483 (sign_extend:HI (match_operand:QI 1 "register_operand" "r")))]
1486 [(set_attr "type" "shift")])
1488 (define_expand "extendqisi2"
1490 (ashift:DI (match_operand:QI 1 "some_operand" "")
1492 (set (match_operand:SI 0 "register_operand" "")
1493 (ashiftrt:DI (match_dup 2)
1499 emit_insn (gen_extendqisi2x (operands[0],
1500 force_reg (QImode, operands[1])));
1504 /* If we have an unaligned MEM, extend to a DImode form of
1505 the result (which we do specially). */
1506 if (unaligned_memory_operand (operands[1], QImode))
1508 rtx temp = gen_reg_rtx (DImode);
1510 emit_insn (gen_extendqidi2 (temp, operands[1]));
1511 emit_move_insn (operands[0], gen_lowpart (SImode, temp));
1515 operands[0] = gen_lowpart (DImode, operands[0]);
1516 operands[1] = gen_lowpart (DImode, force_reg (QImode, operands[1]));
1517 operands[2] = gen_reg_rtx (DImode);
1520 (define_expand "extendqidi2"
1522 (ashift:DI (match_operand:QI 1 "some_operand" "")
1524 (set (match_operand:DI 0 "register_operand" "")
1525 (ashiftrt:DI (match_dup 2)
1531 emit_insn (gen_extendqidi2x (operands[0],
1532 force_reg (QImode, operands[1])));
1536 if (unaligned_memory_operand (operands[1], QImode))
1539 = gen_unaligned_extendqidi (operands[0],
1540 get_unaligned_address (operands[1], 1));
1542 alpha_set_memflags (seq, operands[1]);
1547 operands[1] = gen_lowpart (DImode, force_reg (QImode, operands[1]));
1548 operands[2] = gen_reg_rtx (DImode);
1551 (define_expand "extendhisi2"
1553 (ashift:DI (match_operand:HI 1 "some_operand" "")
1555 (set (match_operand:SI 0 "register_operand" "")
1556 (ashiftrt:DI (match_dup 2)
1562 emit_insn (gen_extendhisi2x (operands[0],
1563 force_reg (HImode, operands[1])));
1567 /* If we have an unaligned MEM, extend to a DImode form of
1568 the result (which we do specially). */
1569 if (unaligned_memory_operand (operands[1], HImode))
1571 rtx temp = gen_reg_rtx (DImode);
1573 emit_insn (gen_extendhidi2 (temp, operands[1]));
1574 emit_move_insn (operands[0], gen_lowpart (SImode, temp));
1578 operands[0] = gen_lowpart (DImode, operands[0]);
1579 operands[1] = gen_lowpart (DImode, force_reg (HImode, operands[1]));
1580 operands[2] = gen_reg_rtx (DImode);
1583 (define_expand "extendhidi2"
1585 (ashift:DI (match_operand:HI 1 "some_operand" "")
1587 (set (match_operand:DI 0 "register_operand" "")
1588 (ashiftrt:DI (match_dup 2)
1594 emit_insn (gen_extendhidi2x (operands[0],
1595 force_reg (HImode, operands[1])));
1599 if (unaligned_memory_operand (operands[1], HImode))
1602 = gen_unaligned_extendhidi (operands[0],
1603 get_unaligned_address (operands[1], 2));
1605 alpha_set_memflags (seq, operands[1]);
1610 operands[1] = gen_lowpart (DImode, force_reg (HImode, operands[1]));
1611 operands[2] = gen_reg_rtx (DImode);
1614 ;; Here's how we sign extend an unaligned byte and halfword. Doing this
1615 ;; as a pattern saves one instruction. The code is similar to that for
1616 ;; the unaligned loads (see below).
1618 ;; Operand 1 is the address + 1 (+2 for HI), operand 0 is the result.
1619 (define_expand "unaligned_extendqidi"
1620 [(use (match_operand:QI 0 "register_operand" ""))
1621 (use (match_operand:DI 1 "address_operand" ""))]
1624 if (WORDS_BIG_ENDIAN)
1625 emit_insn (gen_unaligned_extendqidi_be (operands[0], operands[1]));
1627 emit_insn (gen_unaligned_extendqidi_le (operands[0], operands[1]));
1631 (define_expand "unaligned_extendqidi_le"
1632 [(set (match_dup 2) (match_operand:DI 1 "address_operand" ""))
1634 (mem:DI (and:DI (plus:DI (match_dup 2) (const_int -1))
1637 (ashift:DI (match_dup 3)
1638 (minus:DI (const_int 64)
1640 (and:DI (match_dup 2) (const_int 7))
1642 (set (subreg:DI (match_operand:QI 0 "register_operand" "") 0)
1643 (ashiftrt:DI (match_dup 4) (const_int 56)))]
1644 "! WORDS_BIG_ENDIAN"
1646 operands[2] = gen_reg_rtx (DImode);
1647 operands[3] = gen_reg_rtx (DImode);
1648 operands[4] = gen_reg_rtx (DImode);
1651 (define_expand "unaligned_extendqidi_be"
1652 [(set (match_dup 2) (match_operand:DI 1 "address_operand" ""))
1653 (set (match_dup 3) (plus:DI (match_dup 2) (const_int -1)))
1655 (mem:DI (and:DI (match_dup 3)
1657 (set (match_dup 5) (plus:DI (match_dup 2) (const_int -2)))
1659 (ashift:DI (match_dup 4)
1662 (plus:DI (match_dup 5) (const_int 1))
1665 (set (subreg:DI (match_operand:QI 0 "register_operand" "") 0)
1666 (ashiftrt:DI (match_dup 6) (const_int 56)))]
1669 operands[2] = gen_reg_rtx (DImode);
1670 operands[3] = gen_reg_rtx (DImode);
1671 operands[4] = gen_reg_rtx (DImode);
1672 operands[5] = gen_reg_rtx (DImode);
1673 operands[6] = gen_reg_rtx (DImode);
1676 (define_expand "unaligned_extendhidi"
1677 [(use (match_operand:QI 0 "register_operand" ""))
1678 (use (match_operand:DI 1 "address_operand" ""))]
1681 operands[0] = gen_lowpart (DImode, operands[0]);
1682 emit_insn ((WORDS_BIG_ENDIAN
1683 ? gen_unaligned_extendhidi_be
1684 : gen_unaligned_extendhidi_le) (operands[0], operands[1]));
1688 (define_expand "unaligned_extendhidi_le"
1689 [(set (match_dup 2) (match_operand:DI 1 "address_operand" ""))
1691 (mem:DI (and:DI (plus:DI (match_dup 2) (const_int -2))
1694 (ashift:DI (match_dup 3)
1695 (minus:DI (const_int 64)
1697 (and:DI (match_dup 2) (const_int 7))
1699 (set (match_operand:DI 0 "register_operand" "")
1700 (ashiftrt:DI (match_dup 4) (const_int 48)))]
1701 "! WORDS_BIG_ENDIAN"
1703 operands[2] = gen_reg_rtx (DImode);
1704 operands[3] = gen_reg_rtx (DImode);
1705 operands[4] = gen_reg_rtx (DImode);
1708 (define_expand "unaligned_extendhidi_be"
1709 [(set (match_dup 2) (match_operand:DI 1 "address_operand" ""))
1710 (set (match_dup 3) (plus:DI (match_dup 2) (const_int -2)))
1712 (mem:DI (and:DI (match_dup 3)
1714 (set (match_dup 5) (plus:DI (match_dup 2) (const_int -3)))
1716 (ashift:DI (match_dup 4)
1719 (plus:DI (match_dup 5) (const_int 1))
1722 (set (match_operand:DI 0 "register_operand" "")
1723 (ashiftrt:DI (match_dup 6) (const_int 48)))]
1726 operands[2] = gen_reg_rtx (DImode);
1727 operands[3] = gen_reg_rtx (DImode);
1728 operands[4] = gen_reg_rtx (DImode);
1729 operands[5] = gen_reg_rtx (DImode);
1730 operands[6] = gen_reg_rtx (DImode);
1733 (define_insn "*extxl_const"
1734 [(set (match_operand:DI 0 "register_operand" "=r")
1735 (zero_extract:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
1736 (match_operand:DI 2 "mode_width_operand" "n")
1737 (match_operand:DI 3 "mul8_operand" "I")))]
1739 "ext%M2l %r1,%s3,%0"
1740 [(set_attr "type" "shift")])
1742 (define_insn "extxl_le"
1743 [(set (match_operand:DI 0 "register_operand" "=r")
1744 (zero_extract:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
1745 (match_operand:DI 2 "mode_width_operand" "n")
1746 (ashift:DI (match_operand:DI 3 "reg_or_8bit_operand" "rI")
1748 "! WORDS_BIG_ENDIAN"
1750 [(set_attr "type" "shift")])
1752 (define_insn "extxl_be"
1753 [(set (match_operand:DI 0 "register_operand" "=r")
1754 (zero_extract:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
1755 (match_operand:DI 2 "mode_width_operand" "n")
1759 (match_operand:DI 3 "reg_or_8bit_operand" "rI")
1763 [(set_attr "type" "shift")])
1765 ;; Combine has some strange notion of preserving existing undefined behavior
1766 ;; in shifts larger than a word size. So capture these patterns that it
1767 ;; should have turned into zero_extracts.
1769 (define_insn "*extxl_1_le"
1770 [(set (match_operand:DI 0 "register_operand" "=r")
1771 (and:DI (lshiftrt:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
1772 (ashift:DI (match_operand:DI 2 "reg_or_8bit_operand" "rI")
1774 (match_operand:DI 3 "mode_mask_operand" "n")))]
1775 "! WORDS_BIG_ENDIAN"
1777 [(set_attr "type" "shift")])
1779 (define_insn "*extxl_1_be"
1780 [(set (match_operand:DI 0 "register_operand" "=r")
1781 (and:DI (lshiftrt:DI
1782 (match_operand:DI 1 "reg_or_0_operand" "rJ")
1783 (minus:DI (const_int 56)
1784 (ashift:DI (match_operand:DI 2 "reg_or_8bit_operand" "rI")
1786 (match_operand:DI 3 "mode_mask_operand" "n")))]
1789 [(set_attr "type" "shift")])
1791 (define_insn "*extql_2_le"
1792 [(set (match_operand:DI 0 "register_operand" "=r")
1793 (lshiftrt:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
1794 (ashift:DI (match_operand:DI 2 "reg_or_8bit_operand" "rI")
1796 "! WORDS_BIG_ENDIAN"
1798 [(set_attr "type" "shift")])
1800 (define_insn "*extql_2_be"
1801 [(set (match_operand:DI 0 "register_operand" "=r")
1803 (match_operand:DI 1 "reg_or_0_operand" "rJ")
1804 (minus:DI (const_int 56)
1806 (match_operand:DI 2 "reg_or_8bit_operand" "rI")
1810 [(set_attr "type" "shift")])
1812 (define_insn "extqh_le"
1813 [(set (match_operand:DI 0 "register_operand" "=r")
1815 (match_operand:DI 1 "reg_or_0_operand" "rJ")
1816 (minus:DI (const_int 64)
1819 (match_operand:DI 2 "reg_or_8bit_operand" "rI")
1822 "! WORDS_BIG_ENDIAN"
1824 [(set_attr "type" "shift")])
1826 (define_insn "extqh_be"
1827 [(set (match_operand:DI 0 "register_operand" "=r")
1829 (match_operand:DI 1 "reg_or_0_operand" "rJ")
1832 (plus:DI (match_operand:DI 2 "reg_or_8bit_operand" "rI")
1838 [(set_attr "type" "shift")])
1840 (define_insn "extlh_le"
1841 [(set (match_operand:DI 0 "register_operand" "=r")
1843 (and:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
1844 (const_int 2147483647))
1845 (minus:DI (const_int 64)
1848 (match_operand:DI 2 "reg_or_8bit_operand" "rI")
1851 "! WORDS_BIG_ENDIAN"
1853 [(set_attr "type" "shift")])
1855 (define_insn "extlh_be"
1856 [(set (match_operand:DI 0 "register_operand" "=r")
1859 (match_operand:DI 1 "reg_or_0_operand" "rJ")
1863 (match_operand:DI 2 "reg_or_8bit_operand" "rI")
1867 (const_int 2147483647)))]
1870 [(set_attr "type" "shift")])
1872 (define_insn "extwh_le"
1873 [(set (match_operand:DI 0 "register_operand" "=r")
1875 (and:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
1877 (minus:DI (const_int 64)
1880 (match_operand:DI 2 "reg_or_8bit_operand" "rI")
1883 "! WORDS_BIG_ENDIAN"
1885 [(set_attr "type" "shift")])
1887 (define_insn "extwh_be"
1888 [(set (match_operand:DI 0 "register_operand" "=r")
1890 (ashift:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
1894 (match_operand:DI 2 "reg_or_8bit_operand" "rI")
1898 (const_int 65535)))]
1901 [(set_attr "type" "shift")])
1903 ;; This converts an extXl into an extXh with an appropriate adjustment
1904 ;; to the address calculation.
1907 ;; [(set (match_operand:DI 0 "register_operand" "")
1908 ;; (ashift:DI (zero_extract:DI (match_operand:DI 1 "register_operand" "")
1909 ;; (match_operand:DI 2 "mode_width_operand" "")
1910 ;; (ashift:DI (match_operand:DI 3 "" "")
1912 ;; (match_operand:DI 4 "const_int_operand" "")))
1913 ;; (clobber (match_operand:DI 5 "register_operand" ""))]
1914 ;; "INTVAL (operands[4]) == 64 - INTVAL (operands[2])"
1915 ;; [(set (match_dup 5) (match_dup 6))
1916 ;; (set (match_dup 0)
1917 ;; (ashift:DI (zero_extract:DI (match_dup 1) (match_dup 2)
1918 ;; (ashift:DI (plus:DI (match_dup 5)
1924 ;; operands[6] = plus_constant (operands[3],
1925 ;; INTVAL (operands[2]) / BITS_PER_UNIT);
1926 ;; operands[7] = GEN_INT (- INTVAL (operands[2]) / BITS_PER_UNIT);
1929 (define_insn "*insbl_const"
1930 [(set (match_operand:DI 0 "register_operand" "=r")
1931 (ashift:DI (zero_extend:DI (match_operand:QI 1 "register_operand" "r"))
1932 (match_operand:DI 2 "mul8_operand" "I")))]
1935 [(set_attr "type" "shift")])
1937 (define_insn "*inswl_const"
1938 [(set (match_operand:DI 0 "register_operand" "=r")
1939 (ashift:DI (zero_extend:DI (match_operand:HI 1 "register_operand" "r"))
1940 (match_operand:DI 2 "mul8_operand" "I")))]
1943 [(set_attr "type" "shift")])
1945 (define_insn "*insll_const"
1946 [(set (match_operand:DI 0 "register_operand" "=r")
1947 (ashift:DI (zero_extend:DI (match_operand:SI 1 "register_operand" "r"))
1948 (match_operand:DI 2 "mul8_operand" "I")))]
1951 [(set_attr "type" "shift")])
1953 (define_insn "insbl_le"
1954 [(set (match_operand:DI 0 "register_operand" "=r")
1955 (ashift:DI (zero_extend:DI (match_operand:QI 1 "register_operand" "r"))
1956 (ashift:DI (match_operand:DI 2 "reg_or_8bit_operand" "rI")
1958 "! WORDS_BIG_ENDIAN"
1960 [(set_attr "type" "shift")])
1962 (define_insn "insbl_be"
1963 [(set (match_operand:DI 0 "register_operand" "=r")
1964 (ashift:DI (zero_extend:DI (match_operand:QI 1 "register_operand" "r"))
1965 (minus:DI (const_int 56)
1966 (ashift:DI (match_operand:DI 2 "reg_or_8bit_operand" "rI")
1970 [(set_attr "type" "shift")])
1972 (define_insn "inswl_le"
1973 [(set (match_operand:DI 0 "register_operand" "=r")
1974 (ashift:DI (zero_extend:DI (match_operand:HI 1 "register_operand" "r"))
1975 (ashift:DI (match_operand:DI 2 "reg_or_8bit_operand" "rI")
1977 "! WORDS_BIG_ENDIAN"
1979 [(set_attr "type" "shift")])
1981 (define_insn "inswl_be"
1982 [(set (match_operand:DI 0 "register_operand" "=r")
1983 (ashift:DI (zero_extend:DI (match_operand:HI 1 "register_operand" "r"))
1984 (minus:DI (const_int 56)
1985 (ashift:DI (match_operand:DI 2 "reg_or_8bit_operand" "rI")
1989 [(set_attr "type" "shift")])
1991 (define_insn "insll_le"
1992 [(set (match_operand:DI 0 "register_operand" "=r")
1993 (ashift:DI (zero_extend:DI (match_operand:SI 1 "register_operand" "r"))
1994 (ashift:DI (match_operand:DI 2 "reg_or_8bit_operand" "rI")
1996 "! WORDS_BIG_ENDIAN"
1998 [(set_attr "type" "shift")])
2000 (define_insn "insll_be"
2001 [(set (match_operand:DI 0 "register_operand" "=r")
2002 (ashift:DI (zero_extend:DI (match_operand:SI 1 "register_operand" "r"))
2003 (minus:DI (const_int 56)
2004 (ashift:DI (match_operand:DI 2 "reg_or_8bit_operand" "rI")
2008 [(set_attr "type" "shift")])
2010 (define_insn "insql_le"
2011 [(set (match_operand:DI 0 "register_operand" "=r")
2012 (ashift:DI (match_operand:DI 1 "register_operand" "r")
2013 (ashift:DI (match_operand:DI 2 "reg_or_8bit_operand" "rI")
2015 "! WORDS_BIG_ENDIAN"
2017 [(set_attr "type" "shift")])
2019 (define_insn "insql_be"
2020 [(set (match_operand:DI 0 "register_operand" "=r")
2021 (ashift:DI (match_operand:DI 1 "register_operand" "r")
2022 (minus:DI (const_int 56)
2023 (ashift:DI (match_operand:DI 2 "reg_or_8bit_operand" "rI")
2027 [(set_attr "type" "shift")])
2029 ;; Combine has this sometimes habit of moving the and outside of the
2030 ;; shift, making life more interesting.
2032 (define_insn "*insxl"
2033 [(set (match_operand:DI 0 "register_operand" "=r")
2034 (and:DI (ashift:DI (match_operand:DI 1 "register_operand" "r")
2035 (match_operand:DI 2 "mul8_operand" "I"))
2036 (match_operand:DI 3 "immediate_operand" "i")))]
2037 "HOST_BITS_PER_WIDE_INT == 64
2038 && GET_CODE (operands[3]) == CONST_INT
2039 && (((unsigned HOST_WIDE_INT) 0xff << INTVAL (operands[2])
2040 == (unsigned HOST_WIDE_INT) INTVAL (operands[3]))
2041 || ((unsigned HOST_WIDE_INT) 0xffff << INTVAL (operands[2])
2042 == (unsigned HOST_WIDE_INT) INTVAL (operands[3]))
2043 || ((unsigned HOST_WIDE_INT) 0xffffffff << INTVAL (operands[2])
2044 == (unsigned HOST_WIDE_INT) INTVAL (operands[3])))"
2046 #if HOST_BITS_PER_WIDE_INT == 64
2047 if ((unsigned HOST_WIDE_INT) 0xff << INTVAL (operands[2])
2048 == (unsigned HOST_WIDE_INT) INTVAL (operands[3]))
2049 return "insbl %1,%s2,%0";
2050 if ((unsigned HOST_WIDE_INT) 0xffff << INTVAL (operands[2])
2051 == (unsigned HOST_WIDE_INT) INTVAL (operands[3]))
2052 return "inswl %1,%s2,%0";
2053 if ((unsigned HOST_WIDE_INT) 0xffffffff << INTVAL (operands[2])
2054 == (unsigned HOST_WIDE_INT) INTVAL (operands[3]))
2055 return "insll %1,%s2,%0";
2059 [(set_attr "type" "shift")])
2061 ;; We do not include the insXh insns because they are complex to express
2062 ;; and it does not appear that we would ever want to generate them.
2064 ;; Since we need them for block moves, though, cop out and use unspec.
2066 (define_insn "insxh"
2067 [(set (match_operand:DI 0 "register_operand" "=r")
2068 (unspec:DI [(match_operand:DI 1 "register_operand" "r")
2069 (match_operand:DI 2 "mode_width_operand" "n")
2070 (match_operand:DI 3 "reg_or_8bit_operand" "rI")]
2074 [(set_attr "type" "shift")])
2076 (define_insn "mskxl_le"
2077 [(set (match_operand:DI 0 "register_operand" "=r")
2078 (and:DI (not:DI (ashift:DI
2079 (match_operand:DI 2 "mode_mask_operand" "n")
2081 (match_operand:DI 3 "reg_or_8bit_operand" "rI")
2083 (match_operand:DI 1 "reg_or_0_operand" "rJ")))]
2084 "! WORDS_BIG_ENDIAN"
2086 [(set_attr "type" "shift")])
2088 (define_insn "mskxl_be"
2089 [(set (match_operand:DI 0 "register_operand" "=r")
2090 (and:DI (not:DI (ashift:DI
2091 (match_operand:DI 2 "mode_mask_operand" "n")
2092 (minus:DI (const_int 56)
2094 (match_operand:DI 3 "reg_or_8bit_operand" "rI")
2096 (match_operand:DI 1 "reg_or_0_operand" "rJ")))]
2099 [(set_attr "type" "shift")])
2101 ;; We do not include the mskXh insns because it does not appear we would
2102 ;; ever generate one.
2104 ;; Again, we do for block moves and we use unspec again.
2106 (define_insn "mskxh"
2107 [(set (match_operand:DI 0 "register_operand" "=r")
2108 (unspec:DI [(match_operand:DI 1 "register_operand" "r")
2109 (match_operand:DI 2 "mode_width_operand" "n")
2110 (match_operand:DI 3 "reg_or_8bit_operand" "rI")]
2114 [(set_attr "type" "shift")])
2116 ;; Prefer AND + NE over LSHIFTRT + AND.
2118 (define_insn_and_split "*ze_and_ne"
2119 [(set (match_operand:DI 0 "register_operand" "=r")
2120 (zero_extract:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
2122 (match_operand 2 "const_int_operand" "I")))]
2123 "(unsigned HOST_WIDE_INT) INTVAL (operands[2]) < 8"
2125 "(unsigned HOST_WIDE_INT) INTVAL (operands[2]) < 8"
2127 (and:DI (match_dup 1) (match_dup 3)))
2129 (ne:DI (match_dup 0) (const_int 0)))]
2130 "operands[3] = GEN_INT (1 << INTVAL (operands[2]));")
2132 ;; Floating-point operations. All the double-precision insns can extend
2133 ;; from single, so indicate that. The exception are the ones that simply
2134 ;; play with the sign bits; it's not clear what to do there.
2136 (define_insn "abssf2"
2137 [(set (match_operand:SF 0 "register_operand" "=f")
2138 (abs:SF (match_operand:SF 1 "reg_or_0_operand" "fG")))]
2141 [(set_attr "type" "fcpys")])
2143 (define_insn "*nabssf2"
2144 [(set (match_operand:SF 0 "register_operand" "=f")
2145 (neg:SF (abs:SF (match_operand:SF 1 "reg_or_0_operand" "fG"))))]
2148 [(set_attr "type" "fadd")])
2150 (define_insn "absdf2"
2151 [(set (match_operand:DF 0 "register_operand" "=f")
2152 (abs:DF (match_operand:DF 1 "reg_or_0_operand" "fG")))]
2155 [(set_attr "type" "fcpys")])
2157 (define_insn "*nabsdf2"
2158 [(set (match_operand:DF 0 "register_operand" "=f")
2159 (neg:DF (abs:DF (match_operand:DF 1 "reg_or_0_operand" "fG"))))]
2162 [(set_attr "type" "fadd")])
2164 (define_expand "abstf2"
2165 [(parallel [(set (match_operand:TF 0 "register_operand" "")
2166 (abs:TF (match_operand:TF 1 "reg_or_0_operand" "")))
2167 (use (match_dup 2))])]
2168 "TARGET_HAS_XFLOATING_LIBS"
2170 #if HOST_BITS_PER_WIDE_INT >= 64
2171 operands[2] = force_reg (DImode, GEN_INT ((HOST_WIDE_INT) 1 << 63));
2173 operands[2] = force_reg (DImode, immed_double_const (0, 0x80000000, DImode));
2177 (define_insn_and_split "*abstf_internal"
2178 [(set (match_operand:TF 0 "register_operand" "=r")
2179 (abs:TF (match_operand:TF 1 "reg_or_0_operand" "rG")))
2180 (use (match_operand:DI 2 "register_operand" "r"))]
2181 "TARGET_HAS_XFLOATING_LIBS"
2183 "&& reload_completed"
2185 "alpha_split_tfmode_frobsign (operands, gen_andnotdi3); DONE;")
2187 (define_insn "negsf2"
2188 [(set (match_operand:SF 0 "register_operand" "=f")
2189 (neg:SF (match_operand:SF 1 "reg_or_0_operand" "fG")))]
2192 [(set_attr "type" "fadd")])
2194 (define_insn "negdf2"
2195 [(set (match_operand:DF 0 "register_operand" "=f")
2196 (neg:DF (match_operand:DF 1 "reg_or_0_operand" "fG")))]
2199 [(set_attr "type" "fadd")])
2201 (define_expand "negtf2"
2202 [(parallel [(set (match_operand:TF 0 "register_operand" "")
2203 (neg:TF (match_operand:TF 1 "reg_or_0_operand" "")))
2204 (use (match_dup 2))])]
2205 "TARGET_HAS_XFLOATING_LIBS"
2207 #if HOST_BITS_PER_WIDE_INT >= 64
2208 operands[2] = force_reg (DImode, GEN_INT ((HOST_WIDE_INT) 1 << 63));
2210 operands[2] = force_reg (DImode, immed_double_const (0, 0x80000000, DImode));
2214 (define_insn_and_split "*negtf_internal"
2215 [(set (match_operand:TF 0 "register_operand" "=r")
2216 (neg:TF (match_operand:TF 1 "reg_or_0_operand" "rG")))
2217 (use (match_operand:DI 2 "register_operand" "r"))]
2218 "TARGET_HAS_XFLOATING_LIBS"
2220 "&& reload_completed"
2222 "alpha_split_tfmode_frobsign (operands, gen_xordi3); DONE;")
2224 (define_insn "*addsf_ieee"
2225 [(set (match_operand:SF 0 "register_operand" "=&f")
2226 (plus:SF (match_operand:SF 1 "reg_or_0_operand" "%fG")
2227 (match_operand:SF 2 "reg_or_0_operand" "fG")))]
2228 "TARGET_FP && alpha_fptm >= ALPHA_FPTM_SU"
2229 "add%,%/ %R1,%R2,%0"
2230 [(set_attr "type" "fadd")
2231 (set_attr "trap" "yes")
2232 (set_attr "round_suffix" "normal")
2233 (set_attr "trap_suffix" "u_su_sui")])
2235 (define_insn "addsf3"
2236 [(set (match_operand:SF 0 "register_operand" "=f")
2237 (plus:SF (match_operand:SF 1 "reg_or_0_operand" "%fG")
2238 (match_operand:SF 2 "reg_or_0_operand" "fG")))]
2240 "add%,%/ %R1,%R2,%0"
2241 [(set_attr "type" "fadd")
2242 (set_attr "trap" "yes")
2243 (set_attr "round_suffix" "normal")
2244 (set_attr "trap_suffix" "u_su_sui")])
2246 (define_insn "*adddf_ieee"
2247 [(set (match_operand:DF 0 "register_operand" "=&f")
2248 (plus:DF (match_operand:DF 1 "reg_or_0_operand" "%fG")
2249 (match_operand:DF 2 "reg_or_0_operand" "fG")))]
2250 "TARGET_FP && alpha_fptm >= ALPHA_FPTM_SU"
2251 "add%-%/ %R1,%R2,%0"
2252 [(set_attr "type" "fadd")
2253 (set_attr "trap" "yes")
2254 (set_attr "round_suffix" "normal")
2255 (set_attr "trap_suffix" "u_su_sui")])
2257 (define_insn "adddf3"
2258 [(set (match_operand:DF 0 "register_operand" "=f")
2259 (plus:DF (match_operand:DF 1 "reg_or_0_operand" "%fG")
2260 (match_operand:DF 2 "reg_or_0_operand" "fG")))]
2262 "add%-%/ %R1,%R2,%0"
2263 [(set_attr "type" "fadd")
2264 (set_attr "trap" "yes")
2265 (set_attr "round_suffix" "normal")
2266 (set_attr "trap_suffix" "u_su_sui")])
2268 (define_insn "*adddf_ext1"
2269 [(set (match_operand:DF 0 "register_operand" "=f")
2270 (plus:DF (float_extend:DF
2271 (match_operand:SF 1 "reg_or_0_operand" "fG"))
2272 (match_operand:DF 2 "reg_or_0_operand" "fG")))]
2273 "TARGET_FP && alpha_fptm < ALPHA_FPTM_SU"
2274 "add%-%/ %R1,%R2,%0"
2275 [(set_attr "type" "fadd")
2276 (set_attr "trap" "yes")
2277 (set_attr "round_suffix" "normal")
2278 (set_attr "trap_suffix" "u_su_sui")])
2280 (define_insn "*adddf_ext2"
2281 [(set (match_operand:DF 0 "register_operand" "=f")
2282 (plus:DF (float_extend:DF
2283 (match_operand:SF 1 "reg_or_0_operand" "%fG"))
2285 (match_operand:SF 2 "reg_or_0_operand" "fG"))))]
2286 "TARGET_FP && alpha_fptm < ALPHA_FPTM_SU"
2287 "add%-%/ %R1,%R2,%0"
2288 [(set_attr "type" "fadd")
2289 (set_attr "trap" "yes")
2290 (set_attr "round_suffix" "normal")
2291 (set_attr "trap_suffix" "u_su_sui")])
2293 (define_expand "addtf3"
2294 [(use (match_operand 0 "register_operand" ""))
2295 (use (match_operand 1 "general_operand" ""))
2296 (use (match_operand 2 "general_operand" ""))]
2297 "TARGET_HAS_XFLOATING_LIBS"
2298 "alpha_emit_xfloating_arith (PLUS, operands); DONE;")
2300 ;; Define conversion operators between DFmode and SImode, using the cvtql
2301 ;; instruction. To allow combine et al to do useful things, we keep the
2302 ;; operation as a unit until after reload, at which point we split the
2305 ;; Note that we (attempt to) only consider this optimization when the
2306 ;; ultimate destination is memory. If we will be doing further integer
2307 ;; processing, it is cheaper to do the truncation in the int regs.
2309 (define_insn "*cvtql"
2310 [(set (match_operand:SF 0 "register_operand" "=f")
2311 (unspec:SF [(match_operand:DI 1 "reg_or_0_operand" "fG")]
2315 [(set_attr "type" "fadd")
2316 (set_attr "trap" "yes")
2317 (set_attr "trap_suffix" "v_sv")])
2319 (define_insn_and_split "*fix_truncdfsi_ieee"
2320 [(set (match_operand:SI 0 "memory_operand" "=m")
2322 (match_operator:DI 4 "fix_operator"
2323 [(match_operand:DF 1 "reg_or_0_operand" "fG")]) 0))
2324 (clobber (match_scratch:DI 2 "=&f"))
2325 (clobber (match_scratch:SF 3 "=&f"))]
2326 "TARGET_FP && alpha_fptm >= ALPHA_FPTM_SU"
2328 "&& reload_completed"
2329 [(set (match_dup 2) (match_op_dup 4 [(match_dup 1)]))
2330 (set (match_dup 3) (unspec:SF [(match_dup 2)] UNSPEC_CVTQL))
2331 (set (match_dup 5) (match_dup 3))]
2333 operands[5] = adjust_address (operands[0], SFmode, 0);
2335 [(set_attr "type" "fadd")
2336 (set_attr "trap" "yes")])
2338 (define_insn_and_split "*fix_truncdfsi_internal"
2339 [(set (match_operand:SI 0 "memory_operand" "=m")
2341 (match_operator:DI 3 "fix_operator"
2342 [(match_operand:DF 1 "reg_or_0_operand" "fG")]) 0))
2343 (clobber (match_scratch:DI 2 "=f"))]
2344 "TARGET_FP && alpha_fptm < ALPHA_FPTM_SU"
2346 "&& reload_completed"
2347 [(set (match_dup 2) (match_op_dup 3 [(match_dup 1)]))
2348 (set (match_dup 4) (unspec:SF [(match_dup 2)] UNSPEC_CVTQL))
2349 (set (match_dup 5) (match_dup 4))]
2351 operands[4] = gen_rtx_REG (SFmode, REGNO (operands[2]));
2352 operands[5] = adjust_address (operands[0], SFmode, 0);
2354 [(set_attr "type" "fadd")
2355 (set_attr "trap" "yes")])
2357 (define_insn "*fix_truncdfdi_ieee"
2358 [(set (match_operand:DI 0 "reg_no_subreg_operand" "=&f")
2359 (match_operator:DI 2 "fix_operator"
2360 [(match_operand:DF 1 "reg_or_0_operand" "fG")]))]
2361 "TARGET_FP && alpha_fptm >= ALPHA_FPTM_SU"
2363 [(set_attr "type" "fadd")
2364 (set_attr "trap" "yes")
2365 (set_attr "round_suffix" "c")
2366 (set_attr "trap_suffix" "v_sv_svi")])
2368 (define_insn "*fix_truncdfdi2"
2369 [(set (match_operand:DI 0 "reg_no_subreg_operand" "=f")
2370 (match_operator:DI 2 "fix_operator"
2371 [(match_operand:DF 1 "reg_or_0_operand" "fG")]))]
2374 [(set_attr "type" "fadd")
2375 (set_attr "trap" "yes")
2376 (set_attr "round_suffix" "c")
2377 (set_attr "trap_suffix" "v_sv_svi")])
2379 (define_expand "fix_truncdfdi2"
2380 [(set (match_operand:DI 0 "reg_no_subreg_operand" "")
2381 (fix:DI (match_operand:DF 1 "reg_or_0_operand" "")))]
2385 (define_expand "fixuns_truncdfdi2"
2386 [(set (match_operand:DI 0 "reg_no_subreg_operand" "")
2387 (unsigned_fix:DI (match_operand:DF 1 "reg_or_0_operand" "")))]
2391 ;; Likewise between SFmode and SImode.
2393 (define_insn_and_split "*fix_truncsfsi_ieee"
2394 [(set (match_operand:SI 0 "memory_operand" "=m")
2396 (match_operator:DI 4 "fix_operator"
2398 (match_operand:SF 1 "reg_or_0_operand" "fG"))]) 0))
2399 (clobber (match_scratch:DI 2 "=&f"))
2400 (clobber (match_scratch:SF 3 "=&f"))]
2401 "TARGET_FP && alpha_fptm >= ALPHA_FPTM_SU"
2403 "&& reload_completed"
2404 [(set (match_dup 2) (match_op_dup 4 [(float_extend:DF (match_dup 1))]))
2405 (set (match_dup 3) (unspec:SF [(match_dup 2)] UNSPEC_CVTQL))
2406 (set (match_dup 4) (match_dup 3))]
2408 operands[4] = adjust_address (operands[0], SFmode, 0);
2410 [(set_attr "type" "fadd")
2411 (set_attr "trap" "yes")])
2413 (define_insn_and_split "*fix_truncsfsi_internal"
2414 [(set (match_operand:SI 0 "memory_operand" "=m")
2416 (match_operator:DI 3 "fix_operator"
2418 (match_operand:SF 1 "reg_or_0_operand" "fG"))]) 0))
2419 (clobber (match_scratch:DI 2 "=f"))]
2420 "TARGET_FP && alpha_fptm < ALPHA_FPTM_SU"
2422 "&& reload_completed"
2423 [(set (match_dup 2) (match_op_dup 3 [(float_extend:DF (match_dup 1))]))
2424 (set (match_dup 4) (unspec:SF [(match_dup 2)] UNSPEC_CVTQL))
2425 (set (match_dup 5) (match_dup 4))]
2427 operands[4] = gen_rtx_REG (SFmode, REGNO (operands[2]));
2428 operands[5] = adjust_address (operands[0], SFmode, 0);
2430 [(set_attr "type" "fadd")
2431 (set_attr "trap" "yes")])
2433 (define_insn "*fix_truncsfdi_ieee"
2434 [(set (match_operand:DI 0 "reg_no_subreg_operand" "=&f")
2435 (match_operator:DI 2 "fix_operator"
2436 [(float_extend:DF (match_operand:SF 1 "reg_or_0_operand" "fG"))]))]
2437 "TARGET_FP && alpha_fptm >= ALPHA_FPTM_SU"
2439 [(set_attr "type" "fadd")
2440 (set_attr "trap" "yes")
2441 (set_attr "round_suffix" "c")
2442 (set_attr "trap_suffix" "v_sv_svi")])
2444 (define_insn "*fix_truncsfdi2"
2445 [(set (match_operand:DI 0 "reg_no_subreg_operand" "=f")
2446 (match_operator:DI 2 "fix_operator"
2447 [(float_extend:DF (match_operand:SF 1 "reg_or_0_operand" "fG"))]))]
2450 [(set_attr "type" "fadd")
2451 (set_attr "trap" "yes")
2452 (set_attr "round_suffix" "c")
2453 (set_attr "trap_suffix" "v_sv_svi")])
2455 (define_expand "fix_truncsfdi2"
2456 [(set (match_operand:DI 0 "reg_no_subreg_operand" "")
2457 (fix:DI (float_extend:DF (match_operand:SF 1 "reg_or_0_operand" ""))))]
2461 (define_expand "fixuns_truncsfdi2"
2462 [(set (match_operand:DI 0 "reg_no_subreg_operand" "")
2464 (float_extend:DF (match_operand:SF 1 "reg_or_0_operand" ""))))]
2468 (define_expand "fix_trunctfdi2"
2469 [(use (match_operand:DI 0 "register_operand" ""))
2470 (use (match_operand:TF 1 "general_operand" ""))]
2471 "TARGET_HAS_XFLOATING_LIBS"
2472 "alpha_emit_xfloating_cvt (FIX, operands); DONE;")
2474 (define_expand "fixuns_trunctfdi2"
2475 [(use (match_operand:DI 0 "register_operand" ""))
2476 (use (match_operand:TF 1 "general_operand" ""))]
2477 "TARGET_HAS_XFLOATING_LIBS"
2478 "alpha_emit_xfloating_cvt (UNSIGNED_FIX, operands); DONE;")
2480 (define_insn "*floatdisf_ieee"
2481 [(set (match_operand:SF 0 "register_operand" "=&f")
2482 (float:SF (match_operand:DI 1 "reg_no_subreg_operand" "f")))]
2483 "TARGET_FP && alpha_fptm >= ALPHA_FPTM_SU"
2485 [(set_attr "type" "fadd")
2486 (set_attr "trap" "yes")
2487 (set_attr "round_suffix" "normal")
2488 (set_attr "trap_suffix" "sui")])
2490 (define_insn "floatdisf2"
2491 [(set (match_operand:SF 0 "register_operand" "=f")
2492 (float:SF (match_operand:DI 1 "reg_no_subreg_operand" "f")))]
2495 [(set_attr "type" "fadd")
2496 (set_attr "trap" "yes")
2497 (set_attr "round_suffix" "normal")
2498 (set_attr "trap_suffix" "sui")])
2500 (define_insn_and_split "*floatsisf2_ieee"
2501 [(set (match_operand:SF 0 "register_operand" "=&f")
2502 (float:SF (match_operand:SI 1 "memory_operand" "m")))
2503 (clobber (match_scratch:DI 2 "=&f"))
2504 (clobber (match_scratch:SF 3 "=&f"))]
2505 "TARGET_FP && alpha_fptm >= ALPHA_FPTM_SU"
2507 "&& reload_completed"
2508 [(set (match_dup 3) (match_dup 1))
2509 (set (match_dup 2) (unspec:DI [(match_dup 3)] UNSPEC_CVTLQ))
2510 (set (match_dup 0) (float:SF (match_dup 2)))]
2512 operands[1] = adjust_address (operands[1], SFmode, 0);
2515 (define_insn_and_split "*floatsisf2"
2516 [(set (match_operand:SF 0 "register_operand" "=f")
2517 (float:SF (match_operand:SI 1 "memory_operand" "m")))]
2520 "&& reload_completed"
2521 [(set (match_dup 0) (match_dup 1))
2522 (set (match_dup 2) (unspec:DI [(match_dup 0)] UNSPEC_CVTLQ))
2523 (set (match_dup 0) (float:SF (match_dup 2)))]
2525 operands[1] = adjust_address (operands[1], SFmode, 0);
2526 operands[2] = gen_rtx_REG (DImode, REGNO (operands[0]));
2529 (define_insn "*floatdidf_ieee"
2530 [(set (match_operand:DF 0 "register_operand" "=&f")
2531 (float:DF (match_operand:DI 1 "reg_no_subreg_operand" "f")))]
2532 "TARGET_FP && alpha_fptm >= ALPHA_FPTM_SU"
2534 [(set_attr "type" "fadd")
2535 (set_attr "trap" "yes")
2536 (set_attr "round_suffix" "normal")
2537 (set_attr "trap_suffix" "sui")])
2539 (define_insn "floatdidf2"
2540 [(set (match_operand:DF 0 "register_operand" "=f")
2541 (float:DF (match_operand:DI 1 "reg_no_subreg_operand" "f")))]
2544 [(set_attr "type" "fadd")
2545 (set_attr "trap" "yes")
2546 (set_attr "round_suffix" "normal")
2547 (set_attr "trap_suffix" "sui")])
2549 (define_insn_and_split "*floatsidf2_ieee"
2550 [(set (match_operand:DF 0 "register_operand" "=&f")
2551 (float:DF (match_operand:SI 1 "memory_operand" "m")))
2552 (clobber (match_scratch:DI 2 "=&f"))
2553 (clobber (match_scratch:SF 3 "=&f"))]
2554 "TARGET_FP && alpha_fptm >= ALPHA_FPTM_SU"
2556 "&& reload_completed"
2557 [(set (match_dup 3) (match_dup 1))
2558 (set (match_dup 2) (unspec:DI [(match_dup 3)] UNSPEC_CVTLQ))
2559 (set (match_dup 0) (float:DF (match_dup 2)))]
2561 operands[1] = adjust_address (operands[1], SFmode, 0);
2564 (define_insn_and_split "*floatsidf2"
2565 [(set (match_operand:DF 0 "register_operand" "=f")
2566 (float:DF (match_operand:SI 1 "memory_operand" "m")))]
2569 "&& reload_completed"
2570 [(set (match_dup 3) (match_dup 1))
2571 (set (match_dup 2) (unspec:DI [(match_dup 3)] UNSPEC_CVTLQ))
2572 (set (match_dup 0) (float:DF (match_dup 2)))]
2574 operands[1] = adjust_address (operands[1], SFmode, 0);
2575 operands[2] = gen_rtx_REG (DImode, REGNO (operands[0]));
2576 operands[3] = gen_rtx_REG (SFmode, REGNO (operands[0]));
2579 (define_expand "floatditf2"
2580 [(use (match_operand:TF 0 "register_operand" ""))
2581 (use (match_operand:DI 1 "general_operand" ""))]
2582 "TARGET_HAS_XFLOATING_LIBS"
2583 "alpha_emit_xfloating_cvt (FLOAT, operands); DONE;")
2585 (define_expand "floatunsdisf2"
2586 [(use (match_operand:SF 0 "register_operand" ""))
2587 (use (match_operand:DI 1 "register_operand" ""))]
2589 "alpha_emit_floatuns (operands); DONE;")
2591 (define_expand "floatunsdidf2"
2592 [(use (match_operand:DF 0 "register_operand" ""))
2593 (use (match_operand:DI 1 "register_operand" ""))]
2595 "alpha_emit_floatuns (operands); DONE;")
2597 (define_expand "floatunsditf2"
2598 [(use (match_operand:TF 0 "register_operand" ""))
2599 (use (match_operand:DI 1 "general_operand" ""))]
2600 "TARGET_HAS_XFLOATING_LIBS"
2601 "alpha_emit_xfloating_cvt (UNSIGNED_FLOAT, operands); DONE;")
2603 (define_expand "extendsfdf2"
2604 [(set (match_operand:DF 0 "register_operand" "")
2605 (float_extend:DF (match_operand:SF 1 "nonimmediate_operand" "")))]
2608 if (alpha_fptm >= ALPHA_FPTM_SU)
2609 operands[1] = force_reg (SFmode, operands[1]);
2612 ;; The Unicos/Mk assembler doesn't support cvtst, but we've already
2613 ;; asserted that alpha_fptm == ALPHA_FPTM_N.
2615 (define_insn "*extendsfdf2_ieee"
2616 [(set (match_operand:DF 0 "register_operand" "=&f")
2617 (float_extend:DF (match_operand:SF 1 "register_operand" "f")))]
2618 "TARGET_FP && alpha_fptm >= ALPHA_FPTM_SU"
2620 [(set_attr "type" "fadd")
2621 (set_attr "trap" "yes")])
2623 (define_insn "*extendsfdf2_internal"
2624 [(set (match_operand:DF 0 "register_operand" "=f,f,m")
2625 (float_extend:DF (match_operand:SF 1 "nonimmediate_operand" "f,m,f")))]
2626 "TARGET_FP && alpha_fptm < ALPHA_FPTM_SU"
2631 [(set_attr "type" "fcpys,fld,fst")])
2633 (define_expand "extendsftf2"
2634 [(use (match_operand:TF 0 "register_operand" ""))
2635 (use (match_operand:SF 1 "general_operand" ""))]
2636 "TARGET_HAS_XFLOATING_LIBS"
2638 rtx tmp = gen_reg_rtx (DFmode);
2639 emit_insn (gen_extendsfdf2 (tmp, operands[1]));
2640 emit_insn (gen_extenddftf2 (operands[0], tmp));
2644 (define_expand "extenddftf2"
2645 [(use (match_operand:TF 0 "register_operand" ""))
2646 (use (match_operand:DF 1 "general_operand" ""))]
2647 "TARGET_HAS_XFLOATING_LIBS"
2648 "alpha_emit_xfloating_cvt (FLOAT_EXTEND, operands); DONE;")
2650 (define_insn "*truncdfsf2_ieee"
2651 [(set (match_operand:SF 0 "register_operand" "=&f")
2652 (float_truncate:SF (match_operand:DF 1 "reg_or_0_operand" "fG")))]
2653 "TARGET_FP && alpha_fptm >= ALPHA_FPTM_SU"
2655 [(set_attr "type" "fadd")
2656 (set_attr "trap" "yes")
2657 (set_attr "round_suffix" "normal")
2658 (set_attr "trap_suffix" "u_su_sui")])
2660 (define_insn "truncdfsf2"
2661 [(set (match_operand:SF 0 "register_operand" "=f")
2662 (float_truncate:SF (match_operand:DF 1 "reg_or_0_operand" "fG")))]
2665 [(set_attr "type" "fadd")
2666 (set_attr "trap" "yes")
2667 (set_attr "round_suffix" "normal")
2668 (set_attr "trap_suffix" "u_su_sui")])
2670 (define_expand "trunctfdf2"
2671 [(use (match_operand:DF 0 "register_operand" ""))
2672 (use (match_operand:TF 1 "general_operand" ""))]
2673 "TARGET_HAS_XFLOATING_LIBS"
2674 "alpha_emit_xfloating_cvt (FLOAT_TRUNCATE, operands); DONE;")
2676 (define_expand "trunctfsf2"
2677 [(use (match_operand:SF 0 "register_operand" ""))
2678 (use (match_operand:TF 1 "general_operand" ""))]
2679 "TARGET_FP && TARGET_HAS_XFLOATING_LIBS"
2681 rtx tmpf, sticky, arg, lo, hi;
2683 tmpf = gen_reg_rtx (DFmode);
2684 sticky = gen_reg_rtx (DImode);
2685 arg = copy_to_mode_reg (TFmode, operands[1]);
2686 lo = gen_lowpart (DImode, arg);
2687 hi = gen_highpart (DImode, arg);
2689 /* Convert the low word of the TFmode value into a sticky rounding bit,
2690 then or it into the low bit of the high word. This leaves the sticky
2691 bit at bit 48 of the fraction, which is representable in DFmode,
2692 which prevents rounding error in the final conversion to SFmode. */
2694 emit_insn (gen_rtx_SET (VOIDmode, sticky,
2695 gen_rtx_NE (DImode, lo, const0_rtx)));
2696 emit_insn (gen_iordi3 (hi, hi, sticky));
2697 emit_insn (gen_trunctfdf2 (tmpf, arg));
2698 emit_insn (gen_truncdfsf2 (operands[0], tmpf));
2702 (define_insn "*divsf3_ieee"
2703 [(set (match_operand:SF 0 "register_operand" "=&f")
2704 (div:SF (match_operand:SF 1 "reg_or_0_operand" "fG")
2705 (match_operand:SF 2 "reg_or_0_operand" "fG")))]
2706 "TARGET_FP && alpha_fptm >= ALPHA_FPTM_SU"
2707 "div%,%/ %R1,%R2,%0"
2708 [(set_attr "type" "fdiv")
2709 (set_attr "opsize" "si")
2710 (set_attr "trap" "yes")
2711 (set_attr "round_suffix" "normal")
2712 (set_attr "trap_suffix" "u_su_sui")])
2714 (define_insn "divsf3"
2715 [(set (match_operand:SF 0 "register_operand" "=f")
2716 (div:SF (match_operand:SF 1 "reg_or_0_operand" "fG")
2717 (match_operand:SF 2 "reg_or_0_operand" "fG")))]
2719 "div%,%/ %R1,%R2,%0"
2720 [(set_attr "type" "fdiv")
2721 (set_attr "opsize" "si")
2722 (set_attr "trap" "yes")
2723 (set_attr "round_suffix" "normal")
2724 (set_attr "trap_suffix" "u_su_sui")])
2726 (define_insn "*divdf3_ieee"
2727 [(set (match_operand:DF 0 "register_operand" "=&f")
2728 (div:DF (match_operand:DF 1 "reg_or_0_operand" "fG")
2729 (match_operand:DF 2 "reg_or_0_operand" "fG")))]
2730 "TARGET_FP && alpha_fptm >= ALPHA_FPTM_SU"
2731 "div%-%/ %R1,%R2,%0"
2732 [(set_attr "type" "fdiv")
2733 (set_attr "trap" "yes")
2734 (set_attr "round_suffix" "normal")
2735 (set_attr "trap_suffix" "u_su_sui")])
2737 (define_insn "divdf3"
2738 [(set (match_operand:DF 0 "register_operand" "=f")
2739 (div:DF (match_operand:DF 1 "reg_or_0_operand" "fG")
2740 (match_operand:DF 2 "reg_or_0_operand" "fG")))]
2742 "div%-%/ %R1,%R2,%0"
2743 [(set_attr "type" "fdiv")
2744 (set_attr "trap" "yes")
2745 (set_attr "round_suffix" "normal")
2746 (set_attr "trap_suffix" "u_su_sui")])
2748 (define_insn "*divdf_ext1"
2749 [(set (match_operand:DF 0 "register_operand" "=f")
2750 (div:DF (float_extend:DF (match_operand:SF 1 "reg_or_0_operand" "fG"))
2751 (match_operand:DF 2 "reg_or_0_operand" "fG")))]
2752 "TARGET_FP && alpha_fptm < ALPHA_FPTM_SU"
2753 "div%-%/ %R1,%R2,%0"
2754 [(set_attr "type" "fdiv")
2755 (set_attr "trap" "yes")
2756 (set_attr "round_suffix" "normal")
2757 (set_attr "trap_suffix" "u_su_sui")])
2759 (define_insn "*divdf_ext2"
2760 [(set (match_operand:DF 0 "register_operand" "=f")
2761 (div:DF (match_operand:DF 1 "reg_or_0_operand" "fG")
2763 (match_operand:SF 2 "reg_or_0_operand" "fG"))))]
2764 "TARGET_FP && alpha_fptm < ALPHA_FPTM_SU"
2765 "div%-%/ %R1,%R2,%0"
2766 [(set_attr "type" "fdiv")
2767 (set_attr "trap" "yes")
2768 (set_attr "round_suffix" "normal")
2769 (set_attr "trap_suffix" "u_su_sui")])
2771 (define_insn "*divdf_ext3"
2772 [(set (match_operand:DF 0 "register_operand" "=f")
2773 (div:DF (float_extend:DF (match_operand:SF 1 "reg_or_0_operand" "fG"))
2774 (float_extend:DF (match_operand:SF 2 "reg_or_0_operand" "fG"))))]
2775 "TARGET_FP && alpha_fptm < ALPHA_FPTM_SU"
2776 "div%-%/ %R1,%R2,%0"
2777 [(set_attr "type" "fdiv")
2778 (set_attr "trap" "yes")
2779 (set_attr "round_suffix" "normal")
2780 (set_attr "trap_suffix" "u_su_sui")])
2782 (define_expand "divtf3"
2783 [(use (match_operand 0 "register_operand" ""))
2784 (use (match_operand 1 "general_operand" ""))
2785 (use (match_operand 2 "general_operand" ""))]
2786 "TARGET_HAS_XFLOATING_LIBS"
2787 "alpha_emit_xfloating_arith (DIV, operands); DONE;")
2789 (define_insn "*mulsf3_ieee"
2790 [(set (match_operand:SF 0 "register_operand" "=&f")
2791 (mult:SF (match_operand:SF 1 "reg_or_0_operand" "%fG")
2792 (match_operand:SF 2 "reg_or_0_operand" "fG")))]
2793 "TARGET_FP && alpha_fptm >= ALPHA_FPTM_SU"
2794 "mul%,%/ %R1,%R2,%0"
2795 [(set_attr "type" "fmul")
2796 (set_attr "trap" "yes")
2797 (set_attr "round_suffix" "normal")
2798 (set_attr "trap_suffix" "u_su_sui")])
2800 (define_insn "mulsf3"
2801 [(set (match_operand:SF 0 "register_operand" "=f")
2802 (mult:SF (match_operand:SF 1 "reg_or_0_operand" "%fG")
2803 (match_operand:SF 2 "reg_or_0_operand" "fG")))]
2805 "mul%,%/ %R1,%R2,%0"
2806 [(set_attr "type" "fmul")
2807 (set_attr "trap" "yes")
2808 (set_attr "round_suffix" "normal")
2809 (set_attr "trap_suffix" "u_su_sui")])
2811 (define_insn "*muldf3_ieee"
2812 [(set (match_operand:DF 0 "register_operand" "=&f")
2813 (mult:DF (match_operand:DF 1 "reg_or_0_operand" "%fG")
2814 (match_operand:DF 2 "reg_or_0_operand" "fG")))]
2815 "TARGET_FP && alpha_fptm >= ALPHA_FPTM_SU"
2816 "mul%-%/ %R1,%R2,%0"
2817 [(set_attr "type" "fmul")
2818 (set_attr "trap" "yes")
2819 (set_attr "round_suffix" "normal")
2820 (set_attr "trap_suffix" "u_su_sui")])
2822 (define_insn "muldf3"
2823 [(set (match_operand:DF 0 "register_operand" "=f")
2824 (mult:DF (match_operand:DF 1 "reg_or_0_operand" "%fG")
2825 (match_operand:DF 2 "reg_or_0_operand" "fG")))]
2827 "mul%-%/ %R1,%R2,%0"
2828 [(set_attr "type" "fmul")
2829 (set_attr "trap" "yes")
2830 (set_attr "round_suffix" "normal")
2831 (set_attr "trap_suffix" "u_su_sui")])
2833 (define_insn "*muldf_ext1"
2834 [(set (match_operand:DF 0 "register_operand" "=f")
2835 (mult:DF (float_extend:DF
2836 (match_operand:SF 1 "reg_or_0_operand" "fG"))
2837 (match_operand:DF 2 "reg_or_0_operand" "fG")))]
2838 "TARGET_FP && alpha_fptm < ALPHA_FPTM_SU"
2839 "mul%-%/ %R1,%R2,%0"
2840 [(set_attr "type" "fmul")
2841 (set_attr "trap" "yes")
2842 (set_attr "round_suffix" "normal")
2843 (set_attr "trap_suffix" "u_su_sui")])
2845 (define_insn "*muldf_ext2"
2846 [(set (match_operand:DF 0 "register_operand" "=f")
2847 (mult:DF (float_extend:DF
2848 (match_operand:SF 1 "reg_or_0_operand" "%fG"))
2850 (match_operand:SF 2 "reg_or_0_operand" "fG"))))]
2851 "TARGET_FP && alpha_fptm < ALPHA_FPTM_SU"
2852 "mul%-%/ %R1,%R2,%0"
2853 [(set_attr "type" "fmul")
2854 (set_attr "trap" "yes")
2855 (set_attr "round_suffix" "normal")
2856 (set_attr "trap_suffix" "u_su_sui")])
2858 (define_expand "multf3"
2859 [(use (match_operand 0 "register_operand" ""))
2860 (use (match_operand 1 "general_operand" ""))
2861 (use (match_operand 2 "general_operand" ""))]
2862 "TARGET_HAS_XFLOATING_LIBS"
2863 "alpha_emit_xfloating_arith (MULT, operands); DONE;")
2865 (define_insn "*subsf3_ieee"
2866 [(set (match_operand:SF 0 "register_operand" "=&f")
2867 (minus:SF (match_operand:SF 1 "reg_or_0_operand" "fG")
2868 (match_operand:SF 2 "reg_or_0_operand" "fG")))]
2869 "TARGET_FP && alpha_fptm >= ALPHA_FPTM_SU"
2870 "sub%,%/ %R1,%R2,%0"
2871 [(set_attr "type" "fadd")
2872 (set_attr "trap" "yes")
2873 (set_attr "round_suffix" "normal")
2874 (set_attr "trap_suffix" "u_su_sui")])
2876 (define_insn "subsf3"
2877 [(set (match_operand:SF 0 "register_operand" "=f")
2878 (minus:SF (match_operand:SF 1 "reg_or_0_operand" "fG")
2879 (match_operand:SF 2 "reg_or_0_operand" "fG")))]
2881 "sub%,%/ %R1,%R2,%0"
2882 [(set_attr "type" "fadd")
2883 (set_attr "trap" "yes")
2884 (set_attr "round_suffix" "normal")
2885 (set_attr "trap_suffix" "u_su_sui")])
2887 (define_insn "*subdf3_ieee"
2888 [(set (match_operand:DF 0 "register_operand" "=&f")
2889 (minus:DF (match_operand:DF 1 "reg_or_0_operand" "fG")
2890 (match_operand:DF 2 "reg_or_0_operand" "fG")))]
2891 "TARGET_FP && alpha_fptm >= ALPHA_FPTM_SU"
2892 "sub%-%/ %R1,%R2,%0"
2893 [(set_attr "type" "fadd")
2894 (set_attr "trap" "yes")
2895 (set_attr "round_suffix" "normal")
2896 (set_attr "trap_suffix" "u_su_sui")])
2898 (define_insn "subdf3"
2899 [(set (match_operand:DF 0 "register_operand" "=f")
2900 (minus:DF (match_operand:DF 1 "reg_or_0_operand" "fG")
2901 (match_operand:DF 2 "reg_or_0_operand" "fG")))]
2903 "sub%-%/ %R1,%R2,%0"
2904 [(set_attr "type" "fadd")
2905 (set_attr "trap" "yes")
2906 (set_attr "round_suffix" "normal")
2907 (set_attr "trap_suffix" "u_su_sui")])
2909 (define_insn "*subdf_ext1"
2910 [(set (match_operand:DF 0 "register_operand" "=f")
2911 (minus:DF (float_extend:DF
2912 (match_operand:SF 1 "reg_or_0_operand" "fG"))
2913 (match_operand:DF 2 "reg_or_0_operand" "fG")))]
2914 "TARGET_FP && alpha_fptm < ALPHA_FPTM_SU"
2915 "sub%-%/ %R1,%R2,%0"
2916 [(set_attr "type" "fadd")
2917 (set_attr "trap" "yes")
2918 (set_attr "round_suffix" "normal")
2919 (set_attr "trap_suffix" "u_su_sui")])
2921 (define_insn "*subdf_ext2"
2922 [(set (match_operand:DF 0 "register_operand" "=f")
2923 (minus:DF (match_operand:DF 1 "reg_or_0_operand" "fG")
2925 (match_operand:SF 2 "reg_or_0_operand" "fG"))))]
2926 "TARGET_FP && alpha_fptm < ALPHA_FPTM_SU"
2927 "sub%-%/ %R1,%R2,%0"
2928 [(set_attr "type" "fadd")
2929 (set_attr "trap" "yes")
2930 (set_attr "round_suffix" "normal")
2931 (set_attr "trap_suffix" "u_su_sui")])
2933 (define_insn "*subdf_ext3"
2934 [(set (match_operand:DF 0 "register_operand" "=f")
2935 (minus:DF (float_extend:DF
2936 (match_operand:SF 1 "reg_or_0_operand" "fG"))
2938 (match_operand:SF 2 "reg_or_0_operand" "fG"))))]
2939 "TARGET_FP && alpha_fptm < ALPHA_FPTM_SU"
2940 "sub%-%/ %R1,%R2,%0"
2941 [(set_attr "type" "fadd")
2942 (set_attr "trap" "yes")
2943 (set_attr "round_suffix" "normal")
2944 (set_attr "trap_suffix" "u_su_sui")])
2946 (define_expand "subtf3"
2947 [(use (match_operand 0 "register_operand" ""))
2948 (use (match_operand 1 "general_operand" ""))
2949 (use (match_operand 2 "general_operand" ""))]
2950 "TARGET_HAS_XFLOATING_LIBS"
2951 "alpha_emit_xfloating_arith (MINUS, operands); DONE;")
2953 (define_insn "*sqrtsf2_ieee"
2954 [(set (match_operand:SF 0 "register_operand" "=&f")
2955 (sqrt:SF (match_operand:SF 1 "reg_or_0_operand" "fG")))]
2956 "TARGET_FP && TARGET_FIX && alpha_fptm >= ALPHA_FPTM_SU"
2958 [(set_attr "type" "fsqrt")
2959 (set_attr "opsize" "si")
2960 (set_attr "trap" "yes")
2961 (set_attr "round_suffix" "normal")
2962 (set_attr "trap_suffix" "u_su_sui")])
2964 (define_insn "sqrtsf2"
2965 [(set (match_operand:SF 0 "register_operand" "=f")
2966 (sqrt:SF (match_operand:SF 1 "reg_or_0_operand" "fG")))]
2967 "TARGET_FP && TARGET_FIX"
2969 [(set_attr "type" "fsqrt")
2970 (set_attr "opsize" "si")
2971 (set_attr "trap" "yes")
2972 (set_attr "round_suffix" "normal")
2973 (set_attr "trap_suffix" "u_su_sui")])
2975 (define_insn "*sqrtdf2_ieee"
2976 [(set (match_operand:DF 0 "register_operand" "=&f")
2977 (sqrt:DF (match_operand:DF 1 "reg_or_0_operand" "fG")))]
2978 "TARGET_FP && TARGET_FIX && alpha_fptm >= ALPHA_FPTM_SU"
2980 [(set_attr "type" "fsqrt")
2981 (set_attr "trap" "yes")
2982 (set_attr "round_suffix" "normal")
2983 (set_attr "trap_suffix" "u_su_sui")])
2985 (define_insn "sqrtdf2"
2986 [(set (match_operand:DF 0 "register_operand" "=f")
2987 (sqrt:DF (match_operand:DF 1 "reg_or_0_operand" "fG")))]
2988 "TARGET_FP && TARGET_FIX"
2990 [(set_attr "type" "fsqrt")
2991 (set_attr "trap" "yes")
2992 (set_attr "round_suffix" "normal")
2993 (set_attr "trap_suffix" "u_su_sui")])
2995 ;; Next are all the integer comparisons, and conditional moves and branches
2996 ;; and some of the related define_expand's and define_split's.
2998 (define_insn "*setcc_internal"
2999 [(set (match_operand 0 "register_operand" "=r")
3000 (match_operator 1 "alpha_comparison_operator"
3001 [(match_operand:DI 2 "register_operand" "r")
3002 (match_operand:DI 3 "reg_or_8bit_operand" "rI")]))]
3003 "GET_MODE_CLASS (GET_MODE (operands[0])) == MODE_INT
3004 && GET_MODE_SIZE (GET_MODE (operands[0])) <= 8
3005 && GET_MODE (operands[0]) == GET_MODE (operands[1])"
3007 [(set_attr "type" "icmp")])
3009 ;; Yes, we can technically support reg_or_8bit_operand in operand 2,
3010 ;; but that's non-canonical rtl and allowing that causes inefficiencies
3012 (define_insn "*setcc_swapped_internal"
3013 [(set (match_operand 0 "register_operand" "=r")
3014 (match_operator 1 "alpha_swapped_comparison_operator"
3015 [(match_operand:DI 2 "register_operand" "r")
3016 (match_operand:DI 3 "reg_or_0_operand" "rJ")]))]
3017 "GET_MODE_CLASS (GET_MODE (operands[0])) == MODE_INT
3018 && GET_MODE_SIZE (GET_MODE (operands[0])) <= 8
3019 && GET_MODE (operands[0]) == GET_MODE (operands[1])"
3021 [(set_attr "type" "icmp")])
3023 ;; Use match_operator rather than ne directly so that we can match
3024 ;; multiple integer modes.
3025 (define_insn "*setne_internal"
3026 [(set (match_operand 0 "register_operand" "=r")
3027 (match_operator 1 "signed_comparison_operator"
3028 [(match_operand:DI 2 "register_operand" "r")
3030 "GET_MODE_CLASS (GET_MODE (operands[0])) == MODE_INT
3031 && GET_MODE_SIZE (GET_MODE (operands[0])) <= 8
3032 && GET_CODE (operands[1]) == NE
3033 && GET_MODE (operands[0]) == GET_MODE (operands[1])"
3035 [(set_attr "type" "icmp")])
3037 ;; The mode folding trick can't be used with const_int operands, since
3038 ;; reload needs to know the proper mode.
3040 ;; Use add_operand instead of the more seemingly natural reg_or_8bit_operand
3041 ;; in order to create more pairs of constants. As long as we're allowing
3042 ;; two constants at the same time, and will have to reload one of them...
3044 (define_insn "*movqicc_internal"
3045 [(set (match_operand:QI 0 "register_operand" "=r,r,r,r")
3047 (match_operator 2 "signed_comparison_operator"
3048 [(match_operand:DI 3 "reg_or_0_operand" "rJ,rJ,J,J")
3049 (match_operand:DI 4 "reg_or_0_operand" "J,J,rJ,rJ")])
3050 (match_operand:QI 1 "add_operand" "rI,0,rI,0")
3051 (match_operand:QI 5 "add_operand" "0,rI,0,rI")))]
3052 "(operands[3] == const0_rtx || operands[4] == const0_rtx)"
3058 [(set_attr "type" "icmov")])
3060 (define_insn "*movhicc_internal"
3061 [(set (match_operand:HI 0 "register_operand" "=r,r,r,r")
3063 (match_operator 2 "signed_comparison_operator"
3064 [(match_operand:DI 3 "reg_or_0_operand" "rJ,rJ,J,J")
3065 (match_operand:DI 4 "reg_or_0_operand" "J,J,rJ,rJ")])
3066 (match_operand:HI 1 "add_operand" "rI,0,rI,0")
3067 (match_operand:HI 5 "add_operand" "0,rI,0,rI")))]
3068 "(operands[3] == const0_rtx || operands[4] == const0_rtx)"
3074 [(set_attr "type" "icmov")])
3076 (define_insn "*movsicc_internal"
3077 [(set (match_operand:SI 0 "register_operand" "=r,r,r,r")
3079 (match_operator 2 "signed_comparison_operator"
3080 [(match_operand:DI 3 "reg_or_0_operand" "rJ,rJ,J,J")
3081 (match_operand:DI 4 "reg_or_0_operand" "J,J,rJ,rJ")])
3082 (match_operand:SI 1 "add_operand" "rI,0,rI,0")
3083 (match_operand:SI 5 "add_operand" "0,rI,0,rI")))]
3084 "(operands[3] == const0_rtx || operands[4] == const0_rtx)"
3090 [(set_attr "type" "icmov")])
3092 (define_insn "*movdicc_internal"
3093 [(set (match_operand:DI 0 "register_operand" "=r,r,r,r")
3095 (match_operator 2 "signed_comparison_operator"
3096 [(match_operand:DI 3 "reg_or_0_operand" "rJ,rJ,J,J")
3097 (match_operand:DI 4 "reg_or_0_operand" "J,J,rJ,rJ")])
3098 (match_operand:DI 1 "add_operand" "rI,0,rI,0")
3099 (match_operand:DI 5 "add_operand" "0,rI,0,rI")))]
3100 "(operands[3] == const0_rtx || operands[4] == const0_rtx)"
3106 [(set_attr "type" "icmov")])
3108 (define_insn "*movqicc_lbc"
3109 [(set (match_operand:QI 0 "register_operand" "=r,r")
3111 (eq (zero_extract:DI (match_operand:DI 2 "reg_or_0_operand" "rJ,rJ")
3115 (match_operand:QI 1 "reg_or_8bit_operand" "rI,0")
3116 (match_operand:QI 3 "reg_or_8bit_operand" "0,rI")))]
3121 [(set_attr "type" "icmov")])
3123 (define_insn "*movhicc_lbc"
3124 [(set (match_operand:HI 0 "register_operand" "=r,r")
3126 (eq (zero_extract:DI (match_operand:DI 2 "reg_or_0_operand" "rJ,rJ")
3130 (match_operand:HI 1 "reg_or_8bit_operand" "rI,0")
3131 (match_operand:HI 3 "reg_or_8bit_operand" "0,rI")))]
3136 [(set_attr "type" "icmov")])
3138 (define_insn "*movsicc_lbc"
3139 [(set (match_operand:SI 0 "register_operand" "=r,r")
3141 (eq (zero_extract:DI (match_operand:DI 2 "reg_or_0_operand" "rJ,rJ")
3145 (match_operand:SI 1 "reg_or_8bit_operand" "rI,0")
3146 (match_operand:SI 3 "reg_or_8bit_operand" "0,rI")))]
3151 [(set_attr "type" "icmov")])
3153 (define_insn "*movdicc_lbc"
3154 [(set (match_operand:DI 0 "register_operand" "=r,r")
3156 (eq (zero_extract:DI (match_operand:DI 2 "reg_or_0_operand" "rJ,rJ")
3160 (match_operand:DI 1 "reg_or_8bit_operand" "rI,0")
3161 (match_operand:DI 3 "reg_or_8bit_operand" "0,rI")))]
3166 [(set_attr "type" "icmov")])
3168 (define_insn "*movqicc_lbs"
3169 [(set (match_operand:QI 0 "register_operand" "=r,r")
3171 (ne (zero_extract:DI (match_operand:DI 2 "reg_or_0_operand" "rJ,rJ")
3175 (match_operand:QI 1 "reg_or_8bit_operand" "rI,0")
3176 (match_operand:QI 3 "reg_or_8bit_operand" "0,rI")))]
3181 [(set_attr "type" "icmov")])
3183 (define_insn "*movhicc_lbs"
3184 [(set (match_operand:HI 0 "register_operand" "=r,r")
3186 (ne (zero_extract:DI (match_operand:DI 2 "reg_or_0_operand" "rJ,rJ")
3190 (match_operand:HI 1 "reg_or_8bit_operand" "rI,0")
3191 (match_operand:HI 3 "reg_or_8bit_operand" "0,rI")))]
3196 [(set_attr "type" "icmov")])
3198 (define_insn "*movsicc_lbs"
3199 [(set (match_operand:SI 0 "register_operand" "=r,r")
3201 (ne (zero_extract:DI (match_operand:DI 2 "reg_or_0_operand" "rJ,rJ")
3205 (match_operand:SI 1 "reg_or_8bit_operand" "rI,0")
3206 (match_operand:SI 3 "reg_or_8bit_operand" "0,rI")))]
3211 [(set_attr "type" "icmov")])
3213 (define_insn "*movdicc_lbs"
3214 [(set (match_operand:DI 0 "register_operand" "=r,r")
3216 (ne (zero_extract:DI (match_operand:DI 2 "reg_or_0_operand" "rJ,rJ")
3220 (match_operand:DI 1 "reg_or_8bit_operand" "rI,0")
3221 (match_operand:DI 3 "reg_or_8bit_operand" "0,rI")))]
3226 [(set_attr "type" "icmov")])
3228 ;; For ABS, we have two choices, depending on whether the input and output
3229 ;; registers are the same or not.
3230 (define_expand "absdi2"
3231 [(set (match_operand:DI 0 "register_operand" "")
3232 (abs:DI (match_operand:DI 1 "register_operand" "")))]
3235 if (rtx_equal_p (operands[0], operands[1]))
3236 emit_insn (gen_absdi2_same (operands[0], gen_reg_rtx (DImode)));
3238 emit_insn (gen_absdi2_diff (operands[0], operands[1]));
3242 (define_expand "absdi2_same"
3243 [(set (match_operand:DI 1 "register_operand" "")
3244 (neg:DI (match_operand:DI 0 "register_operand" "")))
3246 (if_then_else:DI (ge (match_dup 0) (const_int 0))
3252 (define_expand "absdi2_diff"
3253 [(set (match_operand:DI 0 "register_operand" "")
3254 (neg:DI (match_operand:DI 1 "register_operand" "")))
3256 (if_then_else:DI (lt (match_dup 1) (const_int 0))
3263 [(set (match_operand:DI 0 "register_operand" "")
3264 (abs:DI (match_dup 0)))
3265 (clobber (match_operand:DI 1 "register_operand" ""))]
3267 [(set (match_dup 1) (neg:DI (match_dup 0)))
3268 (set (match_dup 0) (if_then_else:DI (ge (match_dup 0) (const_int 0))
3269 (match_dup 0) (match_dup 1)))]
3273 [(set (match_operand:DI 0 "register_operand" "")
3274 (abs:DI (match_operand:DI 1 "register_operand" "")))]
3275 "! rtx_equal_p (operands[0], operands[1])"
3276 [(set (match_dup 0) (neg:DI (match_dup 1)))
3277 (set (match_dup 0) (if_then_else:DI (lt (match_dup 1) (const_int 0))
3278 (match_dup 0) (match_dup 1)))]
3282 [(set (match_operand:DI 0 "register_operand" "")
3283 (neg:DI (abs:DI (match_dup 0))))
3284 (clobber (match_operand:DI 1 "register_operand" ""))]
3286 [(set (match_dup 1) (neg:DI (match_dup 0)))
3287 (set (match_dup 0) (if_then_else:DI (le (match_dup 0) (const_int 0))
3288 (match_dup 0) (match_dup 1)))]
3292 [(set (match_operand:DI 0 "register_operand" "")
3293 (neg:DI (abs:DI (match_operand:DI 1 "register_operand" ""))))]
3294 "! rtx_equal_p (operands[0], operands[1])"
3295 [(set (match_dup 0) (neg:DI (match_dup 1)))
3296 (set (match_dup 0) (if_then_else:DI (gt (match_dup 1) (const_int 0))
3297 (match_dup 0) (match_dup 1)))]
3300 (define_insn "sminqi3"
3301 [(set (match_operand:QI 0 "register_operand" "=r")
3302 (smin:QI (match_operand:QI 1 "reg_or_0_operand" "%rJ")
3303 (match_operand:QI 2 "reg_or_8bit_operand" "rI")))]
3306 [(set_attr "type" "mvi")])
3308 (define_insn "uminqi3"
3309 [(set (match_operand:QI 0 "register_operand" "=r")
3310 (umin:QI (match_operand:QI 1 "reg_or_0_operand" "%rJ")
3311 (match_operand:QI 2 "reg_or_8bit_operand" "rI")))]
3314 [(set_attr "type" "mvi")])
3316 (define_insn "smaxqi3"
3317 [(set (match_operand:QI 0 "register_operand" "=r")
3318 (smax:QI (match_operand:QI 1 "reg_or_0_operand" "%rJ")
3319 (match_operand:QI 2 "reg_or_8bit_operand" "rI")))]
3322 [(set_attr "type" "mvi")])
3324 (define_insn "umaxqi3"
3325 [(set (match_operand:QI 0 "register_operand" "=r")
3326 (umax:QI (match_operand:QI 1 "reg_or_0_operand" "%rJ")
3327 (match_operand:QI 2 "reg_or_8bit_operand" "rI")))]
3330 [(set_attr "type" "mvi")])
3332 (define_insn "sminhi3"
3333 [(set (match_operand:HI 0 "register_operand" "=r")
3334 (smin:HI (match_operand:HI 1 "reg_or_0_operand" "%rJ")
3335 (match_operand:HI 2 "reg_or_8bit_operand" "rI")))]
3338 [(set_attr "type" "mvi")])
3340 (define_insn "uminhi3"
3341 [(set (match_operand:HI 0 "register_operand" "=r")
3342 (umin:HI (match_operand:HI 1 "reg_or_0_operand" "%rJ")
3343 (match_operand:HI 2 "reg_or_8bit_operand" "rI")))]
3346 [(set_attr "type" "mvi")])
3348 (define_insn "smaxhi3"
3349 [(set (match_operand:HI 0 "register_operand" "=r")
3350 (smax:HI (match_operand:HI 1 "reg_or_0_operand" "%rJ")
3351 (match_operand:HI 2 "reg_or_8bit_operand" "rI")))]
3354 [(set_attr "type" "mvi")])
3356 (define_insn "umaxhi3"
3357 [(set (match_operand:HI 0 "register_operand" "=r")
3358 (umax:HI (match_operand:HI 1 "reg_or_0_operand" "%rJ")
3359 (match_operand:HI 2 "reg_or_8bit_operand" "rI")))]
3362 [(set_attr "type" "mvi")])
3364 (define_expand "smaxdi3"
3366 (le:DI (match_operand:DI 1 "reg_or_0_operand" "")
3367 (match_operand:DI 2 "reg_or_8bit_operand" "")))
3368 (set (match_operand:DI 0 "register_operand" "")
3369 (if_then_else:DI (eq (match_dup 3) (const_int 0))
3370 (match_dup 1) (match_dup 2)))]
3372 { operands[3] = gen_reg_rtx (DImode); })
3375 [(set (match_operand:DI 0 "register_operand" "")
3376 (smax:DI (match_operand:DI 1 "reg_or_0_operand" "")
3377 (match_operand:DI 2 "reg_or_8bit_operand" "")))
3378 (clobber (match_operand:DI 3 "register_operand" ""))]
3379 "operands[2] != const0_rtx"
3380 [(set (match_dup 3) (le:DI (match_dup 1) (match_dup 2)))
3381 (set (match_dup 0) (if_then_else:DI (eq (match_dup 3) (const_int 0))
3382 (match_dup 1) (match_dup 2)))]
3385 (define_insn "*smax_const0"
3386 [(set (match_operand:DI 0 "register_operand" "=r")
3387 (smax:DI (match_operand:DI 1 "register_operand" "0")
3391 [(set_attr "type" "icmov")])
3393 (define_expand "smindi3"
3395 (lt:DI (match_operand:DI 1 "reg_or_0_operand" "")
3396 (match_operand:DI 2 "reg_or_8bit_operand" "")))
3397 (set (match_operand:DI 0 "register_operand" "")
3398 (if_then_else:DI (ne (match_dup 3) (const_int 0))
3399 (match_dup 1) (match_dup 2)))]
3401 { operands[3] = gen_reg_rtx (DImode); })
3404 [(set (match_operand:DI 0 "register_operand" "")
3405 (smin:DI (match_operand:DI 1 "reg_or_0_operand" "")
3406 (match_operand:DI 2 "reg_or_8bit_operand" "")))
3407 (clobber (match_operand:DI 3 "register_operand" ""))]
3408 "operands[2] != const0_rtx"
3409 [(set (match_dup 3) (lt:DI (match_dup 1) (match_dup 2)))
3410 (set (match_dup 0) (if_then_else:DI (ne (match_dup 3) (const_int 0))
3411 (match_dup 1) (match_dup 2)))]
3414 (define_insn "*smin_const0"
3415 [(set (match_operand:DI 0 "register_operand" "=r")
3416 (smin:DI (match_operand:DI 1 "register_operand" "0")
3420 [(set_attr "type" "icmov")])
3422 (define_expand "umaxdi3"
3424 (leu:DI (match_operand:DI 1 "reg_or_0_operand" "")
3425 (match_operand:DI 2 "reg_or_8bit_operand" "")))
3426 (set (match_operand:DI 0 "register_operand" "")
3427 (if_then_else:DI (eq (match_dup 3) (const_int 0))
3428 (match_dup 1) (match_dup 2)))]
3430 "operands[3] = gen_reg_rtx (DImode);")
3433 [(set (match_operand:DI 0 "register_operand" "")
3434 (umax:DI (match_operand:DI 1 "reg_or_0_operand" "")
3435 (match_operand:DI 2 "reg_or_8bit_operand" "")))
3436 (clobber (match_operand:DI 3 "register_operand" ""))]
3437 "operands[2] != const0_rtx"
3438 [(set (match_dup 3) (leu:DI (match_dup 1) (match_dup 2)))
3439 (set (match_dup 0) (if_then_else:DI (eq (match_dup 3) (const_int 0))
3440 (match_dup 1) (match_dup 2)))]
3443 (define_expand "umindi3"
3445 (ltu:DI (match_operand:DI 1 "reg_or_0_operand" "")
3446 (match_operand:DI 2 "reg_or_8bit_operand" "")))
3447 (set (match_operand:DI 0 "register_operand" "")
3448 (if_then_else:DI (ne (match_dup 3) (const_int 0))
3449 (match_dup 1) (match_dup 2)))]
3451 "operands[3] = gen_reg_rtx (DImode);")
3454 [(set (match_operand:DI 0 "register_operand" "")
3455 (umin:DI (match_operand:DI 1 "reg_or_0_operand" "")
3456 (match_operand:DI 2 "reg_or_8bit_operand" "")))
3457 (clobber (match_operand:DI 3 "register_operand" ""))]
3458 "operands[2] != const0_rtx"
3459 [(set (match_dup 3) (ltu:DI (match_dup 1) (match_dup 2)))
3460 (set (match_dup 0) (if_then_else:DI (ne (match_dup 3) (const_int 0))
3461 (match_dup 1) (match_dup 2)))]
3464 (define_insn "*bcc_normal"
3467 (match_operator 1 "signed_comparison_operator"
3468 [(match_operand:DI 2 "reg_or_0_operand" "rJ")
3470 (label_ref (match_operand 0 "" ""))
3474 [(set_attr "type" "ibr")])
3476 (define_insn "*bcc_reverse"
3479 (match_operator 1 "signed_comparison_operator"
3480 [(match_operand:DI 2 "register_operand" "r")
3484 (label_ref (match_operand 0 "" ""))))]
3487 [(set_attr "type" "ibr")])
3489 (define_insn "*blbs_normal"
3492 (ne (zero_extract:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
3496 (label_ref (match_operand 0 "" ""))
3500 [(set_attr "type" "ibr")])
3502 (define_insn "*blbc_normal"
3505 (eq (zero_extract:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
3509 (label_ref (match_operand 0 "" ""))
3513 [(set_attr "type" "ibr")])
3519 (match_operator 1 "comparison_operator"
3520 [(zero_extract:DI (match_operand:DI 2 "register_operand" "")
3522 (match_operand:DI 3 "const_int_operand" ""))
3524 (label_ref (match_operand 0 "" ""))
3526 (clobber (match_operand:DI 4 "register_operand" ""))])]
3527 "INTVAL (operands[3]) != 0"
3529 (lshiftrt:DI (match_dup 2) (match_dup 3)))
3531 (if_then_else (match_op_dup 1
3532 [(zero_extract:DI (match_dup 4)
3536 (label_ref (match_dup 0))
3540 ;; The following are the corresponding floating-point insns. Recall
3541 ;; we need to have variants that expand the arguments from SFmode
3544 (define_insn "*cmpdf_ieee"
3545 [(set (match_operand:DF 0 "register_operand" "=&f")
3546 (match_operator:DF 1 "alpha_fp_comparison_operator"
3547 [(match_operand:DF 2 "reg_or_0_operand" "fG")
3548 (match_operand:DF 3 "reg_or_0_operand" "fG")]))]
3549 "TARGET_FP && alpha_fptm >= ALPHA_FPTM_SU"
3550 "cmp%-%C1%/ %R2,%R3,%0"
3551 [(set_attr "type" "fadd")
3552 (set_attr "trap" "yes")
3553 (set_attr "trap_suffix" "su")])
3555 (define_insn "*cmpdf_internal"
3556 [(set (match_operand:DF 0 "register_operand" "=f")
3557 (match_operator:DF 1 "alpha_fp_comparison_operator"
3558 [(match_operand:DF 2 "reg_or_0_operand" "fG")
3559 (match_operand:DF 3 "reg_or_0_operand" "fG")]))]
3560 "TARGET_FP && alpha_fptm < ALPHA_FPTM_SU"
3561 "cmp%-%C1%/ %R2,%R3,%0"
3562 [(set_attr "type" "fadd")
3563 (set_attr "trap" "yes")
3564 (set_attr "trap_suffix" "su")])
3566 (define_insn "*cmpdf_ieee_ext1"
3567 [(set (match_operand:DF 0 "register_operand" "=&f")
3568 (match_operator:DF 1 "alpha_fp_comparison_operator"
3570 (match_operand:SF 2 "reg_or_0_operand" "fG"))
3571 (match_operand:DF 3 "reg_or_0_operand" "fG")]))]
3572 "TARGET_FP && alpha_fptm >= ALPHA_FPTM_SU"
3573 "cmp%-%C1%/ %R2,%R3,%0"
3574 [(set_attr "type" "fadd")
3575 (set_attr "trap" "yes")
3576 (set_attr "trap_suffix" "su")])
3578 (define_insn "*cmpdf_ext1"
3579 [(set (match_operand:DF 0 "register_operand" "=f")
3580 (match_operator:DF 1 "alpha_fp_comparison_operator"
3582 (match_operand:SF 2 "reg_or_0_operand" "fG"))
3583 (match_operand:DF 3 "reg_or_0_operand" "fG")]))]
3584 "TARGET_FP && alpha_fptm < ALPHA_FPTM_SU"
3585 "cmp%-%C1%/ %R2,%R3,%0"
3586 [(set_attr "type" "fadd")
3587 (set_attr "trap" "yes")
3588 (set_attr "trap_suffix" "su")])
3590 (define_insn "*cmpdf_ieee_ext2"
3591 [(set (match_operand:DF 0 "register_operand" "=&f")
3592 (match_operator:DF 1 "alpha_fp_comparison_operator"
3593 [(match_operand:DF 2 "reg_or_0_operand" "fG")
3595 (match_operand:SF 3 "reg_or_0_operand" "fG"))]))]
3596 "TARGET_FP && alpha_fptm >= ALPHA_FPTM_SU"
3597 "cmp%-%C1%/ %R2,%R3,%0"
3598 [(set_attr "type" "fadd")
3599 (set_attr "trap" "yes")
3600 (set_attr "trap_suffix" "su")])
3602 (define_insn "*cmpdf_ext2"
3603 [(set (match_operand:DF 0 "register_operand" "=f")
3604 (match_operator:DF 1 "alpha_fp_comparison_operator"
3605 [(match_operand:DF 2 "reg_or_0_operand" "fG")
3607 (match_operand:SF 3 "reg_or_0_operand" "fG"))]))]
3608 "TARGET_FP && alpha_fptm < ALPHA_FPTM_SU"
3609 "cmp%-%C1%/ %R2,%R3,%0"
3610 [(set_attr "type" "fadd")
3611 (set_attr "trap" "yes")
3612 (set_attr "trap_suffix" "su")])
3614 (define_insn "*cmpdf_ieee_ext3"
3615 [(set (match_operand:DF 0 "register_operand" "=&f")
3616 (match_operator:DF 1 "alpha_fp_comparison_operator"
3618 (match_operand:SF 2 "reg_or_0_operand" "fG"))
3620 (match_operand:SF 3 "reg_or_0_operand" "fG"))]))]
3621 "TARGET_FP && alpha_fptm >= ALPHA_FPTM_SU"
3622 "cmp%-%C1%/ %R2,%R3,%0"
3623 [(set_attr "type" "fadd")
3624 (set_attr "trap" "yes")
3625 (set_attr "trap_suffix" "su")])
3627 (define_insn "*cmpdf_ext3"
3628 [(set (match_operand:DF 0 "register_operand" "=f")
3629 (match_operator:DF 1 "alpha_fp_comparison_operator"
3631 (match_operand:SF 2 "reg_or_0_operand" "fG"))
3633 (match_operand:SF 3 "reg_or_0_operand" "fG"))]))]
3634 "TARGET_FP && alpha_fptm < ALPHA_FPTM_SU"
3635 "cmp%-%C1%/ %R2,%R3,%0"
3636 [(set_attr "type" "fadd")
3637 (set_attr "trap" "yes")
3638 (set_attr "trap_suffix" "su")])
3640 (define_insn "*movdfcc_internal"
3641 [(set (match_operand:DF 0 "register_operand" "=f,f")
3643 (match_operator 3 "signed_comparison_operator"
3644 [(match_operand:DF 4 "reg_or_0_operand" "fG,fG")
3645 (match_operand:DF 2 "const0_operand" "G,G")])
3646 (match_operand:DF 1 "reg_or_0_operand" "fG,0")
3647 (match_operand:DF 5 "reg_or_0_operand" "0,fG")))]
3651 fcmov%D3 %R4,%R5,%0"
3652 [(set_attr "type" "fcmov")])
3654 (define_insn "*movsfcc_internal"
3655 [(set (match_operand:SF 0 "register_operand" "=f,f")
3657 (match_operator 3 "signed_comparison_operator"
3658 [(match_operand:DF 4 "reg_or_0_operand" "fG,fG")
3659 (match_operand:DF 2 "const0_operand" "G,G")])
3660 (match_operand:SF 1 "reg_or_0_operand" "fG,0")
3661 (match_operand:SF 5 "reg_or_0_operand" "0,fG")))]
3665 fcmov%D3 %R4,%R5,%0"
3666 [(set_attr "type" "fcmov")])
3668 (define_insn "*movdfcc_ext1"
3669 [(set (match_operand:DF 0 "register_operand" "=f,f")
3671 (match_operator 3 "signed_comparison_operator"
3672 [(match_operand:DF 4 "reg_or_0_operand" "fG,fG")
3673 (match_operand:DF 2 "const0_operand" "G,G")])
3674 (float_extend:DF (match_operand:SF 1 "reg_or_0_operand" "fG,0"))
3675 (match_operand:DF 5 "reg_or_0_operand" "0,fG")))]
3679 fcmov%D3 %R4,%R5,%0"
3680 [(set_attr "type" "fcmov")])
3682 (define_insn "*movdfcc_ext2"
3683 [(set (match_operand:DF 0 "register_operand" "=f,f")
3685 (match_operator 3 "signed_comparison_operator"
3687 (match_operand:SF 4 "reg_or_0_operand" "fG,fG"))
3688 (match_operand:DF 2 "const0_operand" "G,G")])
3689 (match_operand:DF 1 "reg_or_0_operand" "fG,0")
3690 (match_operand:DF 5 "reg_or_0_operand" "0,fG")))]
3694 fcmov%D3 %R4,%R5,%0"
3695 [(set_attr "type" "fcmov")])
3697 (define_insn "*movdfcc_ext3"
3698 [(set (match_operand:SF 0 "register_operand" "=f,f")
3700 (match_operator 3 "signed_comparison_operator"
3702 (match_operand:SF 4 "reg_or_0_operand" "fG,fG"))
3703 (match_operand:DF 2 "const0_operand" "G,G")])
3704 (match_operand:SF 1 "reg_or_0_operand" "fG,0")
3705 (match_operand:SF 5 "reg_or_0_operand" "0,fG")))]
3709 fcmov%D3 %R4,%R5,%0"
3710 [(set_attr "type" "fcmov")])
3712 (define_insn "*movdfcc_ext4"
3713 [(set (match_operand:DF 0 "register_operand" "=f,f")
3715 (match_operator 3 "signed_comparison_operator"
3717 (match_operand:SF 4 "reg_or_0_operand" "fG,fG"))
3718 (match_operand:DF 2 "const0_operand" "G,G")])
3719 (float_extend:DF (match_operand:SF 1 "reg_or_0_operand" "fG,0"))
3720 (match_operand:DF 5 "reg_or_0_operand" "0,fG")))]
3724 fcmov%D3 %R4,%R5,%0"
3725 [(set_attr "type" "fcmov")])
3727 (define_expand "maxdf3"
3729 (le:DF (match_operand:DF 1 "reg_or_0_operand" "")
3730 (match_operand:DF 2 "reg_or_0_operand" "")))
3731 (set (match_operand:DF 0 "register_operand" "")
3732 (if_then_else:DF (eq (match_dup 3) (match_dup 4))
3733 (match_dup 1) (match_dup 2)))]
3736 operands[3] = gen_reg_rtx (DFmode);
3737 operands[4] = CONST0_RTX (DFmode);
3740 (define_expand "mindf3"
3742 (lt:DF (match_operand:DF 1 "reg_or_0_operand" "")
3743 (match_operand:DF 2 "reg_or_0_operand" "")))
3744 (set (match_operand:DF 0 "register_operand" "")
3745 (if_then_else:DF (ne (match_dup 3) (match_dup 4))
3746 (match_dup 1) (match_dup 2)))]
3749 operands[3] = gen_reg_rtx (DFmode);
3750 operands[4] = CONST0_RTX (DFmode);
3753 (define_expand "maxsf3"
3755 (le:DF (float_extend:DF (match_operand:SF 1 "reg_or_0_operand" ""))
3756 (float_extend:DF (match_operand:SF 2 "reg_or_0_operand" ""))))
3757 (set (match_operand:SF 0 "register_operand" "")
3758 (if_then_else:SF (eq (match_dup 3) (match_dup 4))
3759 (match_dup 1) (match_dup 2)))]
3762 operands[3] = gen_reg_rtx (DFmode);
3763 operands[4] = CONST0_RTX (DFmode);
3766 (define_expand "minsf3"
3768 (lt:DF (float_extend:DF (match_operand:SF 1 "reg_or_0_operand" ""))
3769 (float_extend:DF (match_operand:SF 2 "reg_or_0_operand" ""))))
3770 (set (match_operand:SF 0 "register_operand" "")
3771 (if_then_else:SF (ne (match_dup 3) (match_dup 4))
3772 (match_dup 1) (match_dup 2)))]
3775 operands[3] = gen_reg_rtx (DFmode);
3776 operands[4] = CONST0_RTX (DFmode);
3779 (define_insn "*fbcc_normal"
3782 (match_operator 1 "signed_comparison_operator"
3783 [(match_operand:DF 2 "reg_or_0_operand" "fG")
3784 (match_operand:DF 3 "const0_operand" "G")])
3785 (label_ref (match_operand 0 "" ""))
3789 [(set_attr "type" "fbr")])
3791 (define_insn "*fbcc_ext_normal"
3794 (match_operator 1 "signed_comparison_operator"
3796 (match_operand:SF 2 "reg_or_0_operand" "fG"))
3797 (match_operand:DF 3 "const0_operand" "G")])
3798 (label_ref (match_operand 0 "" ""))
3802 [(set_attr "type" "fbr")])
3804 ;; These are the main define_expand's used to make conditional branches
3807 (define_expand "cmpdf"
3808 [(set (cc0) (compare (match_operand:DF 0 "reg_or_0_operand" "")
3809 (match_operand:DF 1 "reg_or_0_operand" "")))]
3812 alpha_compare.op0 = operands[0];
3813 alpha_compare.op1 = operands[1];
3814 alpha_compare.fp_p = 1;
3818 (define_expand "cmptf"
3819 [(set (cc0) (compare (match_operand:TF 0 "general_operand" "")
3820 (match_operand:TF 1 "general_operand" "")))]
3821 "TARGET_HAS_XFLOATING_LIBS"
3823 alpha_compare.op0 = operands[0];
3824 alpha_compare.op1 = operands[1];
3825 alpha_compare.fp_p = 1;
3829 (define_expand "cmpdi"
3830 [(set (cc0) (compare (match_operand:DI 0 "general_operand" "")
3831 (match_operand:DI 1 "general_operand" "")))]
3834 alpha_compare.op0 = operands[0];
3835 alpha_compare.op1 = operands[1];
3836 alpha_compare.fp_p = 0;
3840 (define_expand "beq"
3842 (if_then_else (match_dup 1)
3843 (label_ref (match_operand 0 "" ""))
3846 "{ operands[1] = alpha_emit_conditional_branch (EQ); }")
3848 (define_expand "bne"
3850 (if_then_else (match_dup 1)
3851 (label_ref (match_operand 0 "" ""))
3854 "{ operands[1] = alpha_emit_conditional_branch (NE); }")
3856 (define_expand "blt"
3858 (if_then_else (match_dup 1)
3859 (label_ref (match_operand 0 "" ""))
3862 "{ operands[1] = alpha_emit_conditional_branch (LT); }")
3864 (define_expand "ble"
3866 (if_then_else (match_dup 1)
3867 (label_ref (match_operand 0 "" ""))
3870 "{ operands[1] = alpha_emit_conditional_branch (LE); }")
3872 (define_expand "bgt"
3874 (if_then_else (match_dup 1)
3875 (label_ref (match_operand 0 "" ""))
3878 "{ operands[1] = alpha_emit_conditional_branch (GT); }")
3880 (define_expand "bge"
3882 (if_then_else (match_dup 1)
3883 (label_ref (match_operand 0 "" ""))
3886 "{ operands[1] = alpha_emit_conditional_branch (GE); }")
3888 (define_expand "bltu"
3890 (if_then_else (match_dup 1)
3891 (label_ref (match_operand 0 "" ""))
3894 "{ operands[1] = alpha_emit_conditional_branch (LTU); }")
3896 (define_expand "bleu"
3898 (if_then_else (match_dup 1)
3899 (label_ref (match_operand 0 "" ""))
3902 "{ operands[1] = alpha_emit_conditional_branch (LEU); }")
3904 (define_expand "bgtu"
3906 (if_then_else (match_dup 1)
3907 (label_ref (match_operand 0 "" ""))
3910 "{ operands[1] = alpha_emit_conditional_branch (GTU); }")
3912 (define_expand "bgeu"
3914 (if_then_else (match_dup 1)
3915 (label_ref (match_operand 0 "" ""))
3918 "{ operands[1] = alpha_emit_conditional_branch (GEU); }")
3920 (define_expand "bunordered"
3922 (if_then_else (match_dup 1)
3923 (label_ref (match_operand 0 "" ""))
3926 "{ operands[1] = alpha_emit_conditional_branch (UNORDERED); }")
3928 (define_expand "bordered"
3930 (if_then_else (match_dup 1)
3931 (label_ref (match_operand 0 "" ""))
3934 "{ operands[1] = alpha_emit_conditional_branch (ORDERED); }")
3936 (define_expand "seq"
3937 [(set (match_operand:DI 0 "register_operand" "")
3940 "{ if ((operands[1] = alpha_emit_setcc (EQ)) == NULL_RTX) FAIL; }")
3942 (define_expand "sne"
3943 [(set (match_operand:DI 0 "register_operand" "")
3946 "{ if ((operands[1] = alpha_emit_setcc (NE)) == NULL_RTX) FAIL; }")
3948 (define_expand "slt"
3949 [(set (match_operand:DI 0 "register_operand" "")
3952 "{ if ((operands[1] = alpha_emit_setcc (LT)) == NULL_RTX) FAIL; }")
3954 (define_expand "sle"
3955 [(set (match_operand:DI 0 "register_operand" "")
3958 "{ if ((operands[1] = alpha_emit_setcc (LE)) == NULL_RTX) FAIL; }")
3960 (define_expand "sgt"
3961 [(set (match_operand:DI 0 "register_operand" "")
3964 "{ if ((operands[1] = alpha_emit_setcc (GT)) == NULL_RTX) FAIL; }")
3966 (define_expand "sge"
3967 [(set (match_operand:DI 0 "register_operand" "")
3970 "{ if ((operands[1] = alpha_emit_setcc (GE)) == NULL_RTX) FAIL; }")
3972 (define_expand "sltu"
3973 [(set (match_operand:DI 0 "register_operand" "")
3976 "{ if ((operands[1] = alpha_emit_setcc (LTU)) == NULL_RTX) FAIL; }")
3978 (define_expand "sleu"
3979 [(set (match_operand:DI 0 "register_operand" "")
3982 "{ if ((operands[1] = alpha_emit_setcc (LEU)) == NULL_RTX) FAIL; }")
3984 (define_expand "sgtu"
3985 [(set (match_operand:DI 0 "register_operand" "")
3988 "{ if ((operands[1] = alpha_emit_setcc (GTU)) == NULL_RTX) FAIL; }")
3990 (define_expand "sgeu"
3991 [(set (match_operand:DI 0 "register_operand" "")
3994 "{ if ((operands[1] = alpha_emit_setcc (GEU)) == NULL_RTX) FAIL; }")
3996 (define_expand "sunordered"
3997 [(set (match_operand:DI 0 "register_operand" "")
4000 "{ if ((operands[1] = alpha_emit_setcc (UNORDERED)) == NULL_RTX) FAIL; }")
4002 (define_expand "sordered"
4003 [(set (match_operand:DI 0 "register_operand" "")
4006 "{ if ((operands[1] = alpha_emit_setcc (ORDERED)) == NULL_RTX) FAIL; }")
4008 ;; These are the main define_expand's used to make conditional moves.
4010 (define_expand "movsicc"
4011 [(set (match_operand:SI 0 "register_operand" "")
4012 (if_then_else:SI (match_operand 1 "comparison_operator" "")
4013 (match_operand:SI 2 "reg_or_8bit_operand" "")
4014 (match_operand:SI 3 "reg_or_8bit_operand" "")))]
4017 if ((operands[1] = alpha_emit_conditional_move (operands[1], SImode)) == 0)
4021 (define_expand "movdicc"
4022 [(set (match_operand:DI 0 "register_operand" "")
4023 (if_then_else:DI (match_operand 1 "comparison_operator" "")
4024 (match_operand:DI 2 "reg_or_8bit_operand" "")
4025 (match_operand:DI 3 "reg_or_8bit_operand" "")))]
4028 if ((operands[1] = alpha_emit_conditional_move (operands[1], DImode)) == 0)
4032 (define_expand "movsfcc"
4033 [(set (match_operand:SF 0 "register_operand" "")
4034 (if_then_else:SF (match_operand 1 "comparison_operator" "")
4035 (match_operand:SF 2 "reg_or_8bit_operand" "")
4036 (match_operand:SF 3 "reg_or_8bit_operand" "")))]
4039 if ((operands[1] = alpha_emit_conditional_move (operands[1], SFmode)) == 0)
4043 (define_expand "movdfcc"
4044 [(set (match_operand:DF 0 "register_operand" "")
4045 (if_then_else:DF (match_operand 1 "comparison_operator" "")
4046 (match_operand:DF 2 "reg_or_8bit_operand" "")
4047 (match_operand:DF 3 "reg_or_8bit_operand" "")))]
4050 if ((operands[1] = alpha_emit_conditional_move (operands[1], DFmode)) == 0)
4054 ;; These define_split definitions are used in cases when comparisons have
4055 ;; not be stated in the correct way and we need to reverse the second
4056 ;; comparison. For example, x >= 7 has to be done as x < 6 with the
4057 ;; comparison that tests the result being reversed. We have one define_split
4058 ;; for each use of a comparison. They do not match valid insns and need
4059 ;; not generate valid insns.
4061 ;; We can also handle equality comparisons (and inequality comparisons in
4062 ;; cases where the resulting add cannot overflow) by doing an add followed by
4063 ;; a comparison with zero. This is faster since the addition takes one
4064 ;; less cycle than a compare when feeding into a conditional move.
4065 ;; For this case, we also have an SImode pattern since we can merge the add
4066 ;; and sign extend and the order doesn't matter.
4068 ;; We do not do this for floating-point, since it isn't clear how the "wrong"
4069 ;; operation could have been generated.
4072 [(set (match_operand:DI 0 "register_operand" "")
4074 (match_operator 1 "comparison_operator"
4075 [(match_operand:DI 2 "reg_or_0_operand" "")
4076 (match_operand:DI 3 "reg_or_cint_operand" "")])
4077 (match_operand:DI 4 "reg_or_cint_operand" "")
4078 (match_operand:DI 5 "reg_or_cint_operand" "")))
4079 (clobber (match_operand:DI 6 "register_operand" ""))]
4080 "operands[3] != const0_rtx"
4081 [(set (match_dup 6) (match_dup 7))
4083 (if_then_else:DI (match_dup 8) (match_dup 4) (match_dup 5)))]
4085 enum rtx_code code = GET_CODE (operands[1]);
4086 int unsignedp = (code == GEU || code == LEU || code == GTU || code == LTU);
4088 /* If we are comparing for equality with a constant and that constant
4089 appears in the arm when the register equals the constant, use the
4090 register since that is more likely to match (and to produce better code
4093 if (code == EQ && GET_CODE (operands[3]) == CONST_INT
4094 && rtx_equal_p (operands[4], operands[3]))
4095 operands[4] = operands[2];
4097 else if (code == NE && GET_CODE (operands[3]) == CONST_INT
4098 && rtx_equal_p (operands[5], operands[3]))
4099 operands[5] = operands[2];
4101 if (code == NE || code == EQ
4102 || (extended_count (operands[2], DImode, unsignedp) >= 1
4103 && extended_count (operands[3], DImode, unsignedp) >= 1))
4105 if (GET_CODE (operands[3]) == CONST_INT)
4106 operands[7] = gen_rtx_PLUS (DImode, operands[2],
4107 GEN_INT (- INTVAL (operands[3])));
4109 operands[7] = gen_rtx_MINUS (DImode, operands[2], operands[3]);
4111 operands[8] = gen_rtx_fmt_ee (code, VOIDmode, operands[6], const0_rtx);
4114 else if (code == EQ || code == LE || code == LT
4115 || code == LEU || code == LTU)
4117 operands[7] = gen_rtx_fmt_ee (code, DImode, operands[2], operands[3]);
4118 operands[8] = gen_rtx_NE (VOIDmode, operands[6], const0_rtx);
4122 operands[7] = gen_rtx_fmt_ee (reverse_condition (code), DImode,
4123 operands[2], operands[3]);
4124 operands[8] = gen_rtx_EQ (VOIDmode, operands[6], const0_rtx);
4129 [(set (match_operand:DI 0 "register_operand" "")
4131 (match_operator 1 "comparison_operator"
4132 [(match_operand:SI 2 "reg_or_0_operand" "")
4133 (match_operand:SI 3 "reg_or_cint_operand" "")])
4134 (match_operand:DI 4 "reg_or_8bit_operand" "")
4135 (match_operand:DI 5 "reg_or_8bit_operand" "")))
4136 (clobber (match_operand:DI 6 "register_operand" ""))]
4137 "operands[3] != const0_rtx
4138 && (GET_CODE (operands[1]) == EQ || GET_CODE (operands[1]) == NE)"
4139 [(set (match_dup 6) (match_dup 7))
4141 (if_then_else:DI (match_dup 8) (match_dup 4) (match_dup 5)))]
4143 enum rtx_code code = GET_CODE (operands[1]);
4144 int unsignedp = (code == GEU || code == LEU || code == GTU || code == LTU);
4147 if ((code != NE && code != EQ
4148 && ! (extended_count (operands[2], DImode, unsignedp) >= 1
4149 && extended_count (operands[3], DImode, unsignedp) >= 1)))
4152 if (GET_CODE (operands[3]) == CONST_INT)
4153 tem = gen_rtx_PLUS (SImode, operands[2],
4154 GEN_INT (- INTVAL (operands[3])));
4156 tem = gen_rtx_MINUS (SImode, operands[2], operands[3]);
4158 operands[7] = gen_rtx_SIGN_EXTEND (DImode, tem);
4159 operands[8] = gen_rtx_fmt_ee (GET_CODE (operands[1]), VOIDmode,
4160 operands[6], const0_rtx);
4166 (match_operator 1 "comparison_operator"
4167 [(match_operand:DI 2 "reg_or_0_operand" "")
4168 (match_operand:DI 3 "reg_or_cint_operand" "")])
4169 (label_ref (match_operand 0 "" ""))
4171 (clobber (match_operand:DI 4 "register_operand" ""))]
4172 "operands[3] != const0_rtx"
4173 [(set (match_dup 4) (match_dup 5))
4174 (set (pc) (if_then_else (match_dup 6) (label_ref (match_dup 0)) (pc)))]
4176 enum rtx_code code = GET_CODE (operands[1]);
4177 int unsignedp = (code == GEU || code == LEU || code == GTU || code == LTU);
4179 if (code == NE || code == EQ
4180 || (extended_count (operands[2], DImode, unsignedp) >= 1
4181 && extended_count (operands[3], DImode, unsignedp) >= 1))
4183 if (GET_CODE (operands[3]) == CONST_INT)
4184 operands[5] = gen_rtx_PLUS (DImode, operands[2],
4185 GEN_INT (- INTVAL (operands[3])));
4187 operands[5] = gen_rtx_MINUS (DImode, operands[2], operands[3]);
4189 operands[6] = gen_rtx_fmt_ee (code, VOIDmode, operands[4], const0_rtx);
4192 else if (code == EQ || code == LE || code == LT
4193 || code == LEU || code == LTU)
4195 operands[5] = gen_rtx_fmt_ee (code, DImode, operands[2], operands[3]);
4196 operands[6] = gen_rtx_NE (VOIDmode, operands[4], const0_rtx);
4200 operands[5] = gen_rtx_fmt_ee (reverse_condition (code), DImode,
4201 operands[2], operands[3]);
4202 operands[6] = gen_rtx_EQ (VOIDmode, operands[4], const0_rtx);
4209 (match_operator 1 "comparison_operator"
4210 [(match_operand:SI 2 "reg_or_0_operand" "")
4211 (match_operand:SI 3 "const_int_operand" "")])
4212 (label_ref (match_operand 0 "" ""))
4214 (clobber (match_operand:DI 4 "register_operand" ""))]
4215 "operands[3] != const0_rtx
4216 && (GET_CODE (operands[1]) == EQ || GET_CODE (operands[1]) == NE)"
4217 [(set (match_dup 4) (match_dup 5))
4218 (set (pc) (if_then_else (match_dup 6) (label_ref (match_dup 0)) (pc)))]
4222 if (GET_CODE (operands[3]) == CONST_INT)
4223 tem = gen_rtx_PLUS (SImode, operands[2],
4224 GEN_INT (- INTVAL (operands[3])));
4226 tem = gen_rtx_MINUS (SImode, operands[2], operands[3]);
4228 operands[5] = gen_rtx_SIGN_EXTEND (DImode, tem);
4229 operands[6] = gen_rtx_fmt_ee (GET_CODE (operands[1]), VOIDmode,
4230 operands[4], const0_rtx);
4233 ;; We can convert such things as "a > 0xffff" to "t = a & ~ 0xffff; t != 0".
4234 ;; This eliminates one, and sometimes two, insns when the AND can be done
4237 [(set (match_operand:DI 0 "register_operand" "")
4238 (match_operator:DI 1 "comparison_operator"
4239 [(match_operand:DI 2 "register_operand" "")
4240 (match_operand:DI 3 "const_int_operand" "")]))
4241 (clobber (match_operand:DI 4 "register_operand" ""))]
4242 "exact_log2 (INTVAL (operands[3]) + 1) >= 0
4243 && (GET_CODE (operands[1]) == GTU
4244 || GET_CODE (operands[1]) == LEU
4245 || ((GET_CODE (operands[1]) == GT || GET_CODE (operands[1]) == LE)
4246 && extended_count (operands[2], DImode, 1) > 0))"
4247 [(set (match_dup 4) (and:DI (match_dup 2) (match_dup 5)))
4248 (set (match_dup 0) (match_dup 6))]
4250 operands[5] = GEN_INT (~ INTVAL (operands[3]));
4251 operands[6] = gen_rtx_fmt_ee (((GET_CODE (operands[1]) == GTU
4252 || GET_CODE (operands[1]) == GT)
4254 DImode, operands[4], const0_rtx);
4257 ;; Prefer to use cmp and arithmetic when possible instead of a cmove.
4260 [(set (match_operand 0 "register_operand" "")
4261 (if_then_else (match_operator 1 "signed_comparison_operator"
4262 [(match_operand:DI 2 "reg_or_0_operand" "")
4264 (match_operand 3 "const_int_operand" "")
4265 (match_operand 4 "const_int_operand" "")))]
4269 if (alpha_split_conditional_move (GET_CODE (operands[1]), operands[0],
4270 operands[2], operands[3], operands[4]))
4276 ;; ??? Why combine is allowed to create such non-canonical rtl, I don't know.
4277 ;; Oh well, we match it in movcc, so it must be partially our fault.
4279 [(set (match_operand 0 "register_operand" "")
4280 (if_then_else (match_operator 1 "signed_comparison_operator"
4282 (match_operand:DI 2 "reg_or_0_operand" "")])
4283 (match_operand 3 "const_int_operand" "")
4284 (match_operand 4 "const_int_operand" "")))]
4288 if (alpha_split_conditional_move (swap_condition (GET_CODE (operands[1])),
4289 operands[0], operands[2], operands[3],
4296 (define_insn_and_split "*cmp_sadd_di"
4297 [(set (match_operand:DI 0 "register_operand" "=r")
4298 (plus:DI (if_then_else:DI
4299 (match_operator 1 "alpha_zero_comparison_operator"
4300 [(match_operand:DI 2 "reg_or_0_operand" "rJ")
4302 (match_operand:DI 3 "const48_operand" "I")
4304 (match_operand:DI 4 "sext_add_operand" "rIO")))
4305 (clobber (match_scratch:DI 5 "=r"))]
4308 "! no_new_pseudos || reload_completed"
4310 (match_op_dup:DI 1 [(match_dup 2) (const_int 0)]))
4312 (plus:DI (mult:DI (match_dup 5) (match_dup 3))
4315 if (! no_new_pseudos)
4316 operands[5] = gen_reg_rtx (DImode);
4317 else if (reg_overlap_mentioned_p (operands[5], operands[4]))
4318 operands[5] = operands[0];
4321 (define_insn_and_split "*cmp_sadd_si"
4322 [(set (match_operand:SI 0 "register_operand" "=r")
4323 (plus:SI (if_then_else:SI
4324 (match_operator 1 "alpha_zero_comparison_operator"
4325 [(match_operand:DI 2 "reg_or_0_operand" "rJ")
4327 (match_operand:SI 3 "const48_operand" "I")
4329 (match_operand:SI 4 "sext_add_operand" "rIO")))
4330 (clobber (match_scratch:SI 5 "=r"))]
4333 "! no_new_pseudos || reload_completed"
4335 (match_op_dup:SI 1 [(match_dup 2) (const_int 0)]))
4337 (plus:SI (mult:SI (match_dup 5) (match_dup 3))
4340 if (! no_new_pseudos)
4341 operands[5] = gen_reg_rtx (DImode);
4342 else if (reg_overlap_mentioned_p (operands[5], operands[4]))
4343 operands[5] = operands[0];
4346 (define_insn_and_split "*cmp_sadd_sidi"
4347 [(set (match_operand:DI 0 "register_operand" "=r")
4349 (plus:SI (if_then_else:SI
4350 (match_operator 1 "alpha_zero_comparison_operator"
4351 [(match_operand:DI 2 "reg_or_0_operand" "rJ")
4353 (match_operand:SI 3 "const48_operand" "I")
4355 (match_operand:SI 4 "sext_add_operand" "rIO"))))
4356 (clobber (match_scratch:SI 5 "=r"))]
4359 "! no_new_pseudos || reload_completed"
4361 (match_op_dup:SI 1 [(match_dup 2) (const_int 0)]))
4363 (sign_extend:DI (plus:SI (mult:SI (match_dup 5) (match_dup 3))
4366 if (! no_new_pseudos)
4367 operands[5] = gen_reg_rtx (DImode);
4368 else if (reg_overlap_mentioned_p (operands[5], operands[4]))
4369 operands[5] = operands[0];
4372 (define_insn_and_split "*cmp_ssub_di"
4373 [(set (match_operand:DI 0 "register_operand" "=r")
4374 (minus:DI (if_then_else:DI
4375 (match_operator 1 "alpha_zero_comparison_operator"
4376 [(match_operand:DI 2 "reg_or_0_operand" "rJ")
4378 (match_operand:DI 3 "const48_operand" "I")
4380 (match_operand:DI 4 "reg_or_8bit_operand" "rI")))
4381 (clobber (match_scratch:DI 5 "=r"))]
4384 "! no_new_pseudos || reload_completed"
4386 (match_op_dup:DI 1 [(match_dup 2) (const_int 0)]))
4388 (minus:DI (mult:DI (match_dup 5) (match_dup 3))
4391 if (! no_new_pseudos)
4392 operands[5] = gen_reg_rtx (DImode);
4393 else if (reg_overlap_mentioned_p (operands[5], operands[4]))
4394 operands[5] = operands[0];
4397 (define_insn_and_split "*cmp_ssub_si"
4398 [(set (match_operand:SI 0 "register_operand" "=r")
4399 (minus:SI (if_then_else:SI
4400 (match_operator 1 "alpha_zero_comparison_operator"
4401 [(match_operand:DI 2 "reg_or_0_operand" "rJ")
4403 (match_operand:SI 3 "const48_operand" "I")
4405 (match_operand:SI 4 "reg_or_8bit_operand" "rI")))
4406 (clobber (match_scratch:SI 5 "=r"))]
4409 "! no_new_pseudos || reload_completed"
4411 (match_op_dup:SI 1 [(match_dup 2) (const_int 0)]))
4413 (minus:SI (mult:SI (match_dup 5) (match_dup 3))
4416 if (! no_new_pseudos)
4417 operands[5] = gen_reg_rtx (DImode);
4418 else if (reg_overlap_mentioned_p (operands[5], operands[4]))
4419 operands[5] = operands[0];
4422 (define_insn_and_split "*cmp_ssub_sidi"
4423 [(set (match_operand:DI 0 "register_operand" "=r")
4425 (minus:SI (if_then_else:SI
4426 (match_operator 1 "alpha_zero_comparison_operator"
4427 [(match_operand:DI 2 "reg_or_0_operand" "rJ")
4429 (match_operand:SI 3 "const48_operand" "I")
4431 (match_operand:SI 4 "reg_or_8bit_operand" "rI"))))
4432 (clobber (match_scratch:SI 5 "=r"))]
4435 "! no_new_pseudos || reload_completed"
4437 (match_op_dup:SI 1 [(match_dup 2) (const_int 0)]))
4439 (sign_extend:DI (minus:SI (mult:SI (match_dup 5) (match_dup 3))
4442 if (! no_new_pseudos)
4443 operands[5] = gen_reg_rtx (DImode);
4444 else if (reg_overlap_mentioned_p (operands[5], operands[4]))
4445 operands[5] = operands[0];
4448 ;; Here are the CALL and unconditional branch insns. Calls on NT and OSF
4449 ;; work differently, so we have different patterns for each.
4451 ;; On Unicos/Mk a call information word (CIW) must be generated for each
4452 ;; call. The CIW contains information about arguments passed in registers
4453 ;; and is stored in the caller's SSIB. Its offset relative to the beginning
4454 ;; of the SSIB is passed in $25. Handling this properly is quite complicated
4455 ;; in the presence of inlining since the CIWs for calls performed by the
4456 ;; inlined function must be stored in the SSIB of the function it is inlined
4457 ;; into as well. We encode the CIW in an unspec and append it to the list
4458 ;; of the CIWs for the current function only when the instruction for loading
4459 ;; $25 is generated.
4461 (define_expand "call"
4462 [(use (match_operand:DI 0 "" ""))
4463 (use (match_operand 1 "" ""))
4464 (use (match_operand 2 "" ""))
4465 (use (match_operand 3 "" ""))]
4468 if (TARGET_ABI_WINDOWS_NT)
4469 emit_call_insn (gen_call_nt (operands[0], operands[1]));
4470 else if (TARGET_ABI_OPEN_VMS)
4471 emit_call_insn (gen_call_vms (operands[0], operands[2]));
4472 else if (TARGET_ABI_UNICOSMK)
4473 emit_call_insn (gen_call_umk (operands[0], operands[2]));
4475 emit_call_insn (gen_call_osf (operands[0], operands[1]));
4479 (define_expand "sibcall"
4480 [(parallel [(call (mem:DI (match_operand 0 "" ""))
4481 (match_operand 1 "" ""))
4482 (unspec [(reg:DI 29)] UNSPEC_SIBCALL)])]
4485 if (GET_CODE (operands[0]) != MEM)
4487 operands[0] = XEXP (operands[0], 0);
4490 (define_expand "call_osf"
4491 [(parallel [(call (mem:DI (match_operand 0 "" ""))
4492 (match_operand 1 "" ""))
4494 (clobber (reg:DI 26))])]
4497 if (GET_CODE (operands[0]) != MEM)
4500 operands[0] = XEXP (operands[0], 0);
4501 if (! call_operand (operands[0], Pmode))
4502 operands[0] = copy_to_mode_reg (Pmode, operands[0]);
4505 (define_expand "call_nt"
4506 [(parallel [(call (mem:DI (match_operand 0 "" ""))
4507 (match_operand 1 "" ""))
4508 (clobber (reg:DI 26))])]
4511 if (GET_CODE (operands[0]) != MEM)
4514 operands[0] = XEXP (operands[0], 0);
4515 if (GET_CODE (operands[0]) != SYMBOL_REF && GET_CODE (operands[0]) != REG)
4516 operands[0] = force_reg (DImode, operands[0]);
4519 ;; Calls on Unicos/Mk are always indirect.
4520 ;; op 0: symbol ref for called function
4521 ;; op 1: CIW for $25 represented by an unspec
4523 (define_expand "call_umk"
4524 [(parallel [(call (mem:DI (match_operand 0 "" ""))
4525 (match_operand 1 "" ""))
4527 (clobber (reg:DI 26))])]
4530 if (GET_CODE (operands[0]) != MEM)
4533 /* Always load the address of the called function into a register;
4534 load the CIW in $25. */
4536 operands[0] = XEXP (operands[0], 0);
4537 if (GET_CODE (operands[0]) != REG)
4538 operands[0] = force_reg (DImode, operands[0]);
4540 emit_move_insn (gen_rtx_REG (DImode, 25), operands[1]);
4544 ;; call openvms/alpha
4545 ;; op 0: symbol ref for called function
4546 ;; op 1: next_arg_reg (argument information value for R25)
4548 (define_expand "call_vms"
4549 [(parallel [(call (mem:DI (match_operand 0 "" ""))
4550 (match_operand 1 "" ""))
4554 (clobber (reg:DI 27))])]
4557 if (GET_CODE (operands[0]) != MEM)
4560 operands[0] = XEXP (operands[0], 0);
4562 /* Always load AI with argument information, then handle symbolic and
4563 indirect call differently. Load RA and set operands[2] to PV in
4566 emit_move_insn (gen_rtx_REG (DImode, 25), operands[1]);
4567 if (GET_CODE (operands[0]) == SYMBOL_REF)
4569 alpha_need_linkage (XSTR (operands[0], 0), 0);
4571 operands[2] = const0_rtx;
4575 emit_move_insn (gen_rtx_REG (Pmode, 26),
4576 gen_rtx_MEM (Pmode, plus_constant (operands[0], 8)));
4577 operands[2] = operands[0];
4582 (define_expand "call_value"
4583 [(use (match_operand 0 "" ""))
4584 (use (match_operand:DI 1 "" ""))
4585 (use (match_operand 2 "" ""))
4586 (use (match_operand 3 "" ""))
4587 (use (match_operand 4 "" ""))]
4590 if (TARGET_ABI_WINDOWS_NT)
4591 emit_call_insn (gen_call_value_nt (operands[0], operands[1], operands[2]));
4592 else if (TARGET_ABI_OPEN_VMS)
4593 emit_call_insn (gen_call_value_vms (operands[0], operands[1],
4595 else if (TARGET_ABI_UNICOSMK)
4596 emit_call_insn (gen_call_value_umk (operands[0], operands[1],
4599 emit_call_insn (gen_call_value_osf (operands[0], operands[1],
4604 (define_expand "sibcall_value"
4605 [(parallel [(set (match_operand 0 "" "")
4606 (call (mem:DI (match_operand 1 "" ""))
4607 (match_operand 2 "" "")))
4608 (unspec [(reg:DI 29)] UNSPEC_SIBCALL)])]
4611 if (GET_CODE (operands[1]) != MEM)
4613 operands[1] = XEXP (operands[1], 0);
4616 (define_expand "call_value_osf"
4617 [(parallel [(set (match_operand 0 "" "")
4618 (call (mem:DI (match_operand 1 "" ""))
4619 (match_operand 2 "" "")))
4621 (clobber (reg:DI 26))])]
4624 if (GET_CODE (operands[1]) != MEM)
4627 operands[1] = XEXP (operands[1], 0);
4628 if (! call_operand (operands[1], Pmode))
4629 operands[1] = copy_to_mode_reg (Pmode, operands[1]);
4632 (define_expand "call_value_nt"
4633 [(parallel [(set (match_operand 0 "" "")
4634 (call (mem:DI (match_operand 1 "" ""))
4635 (match_operand 2 "" "")))
4636 (clobber (reg:DI 26))])]
4639 if (GET_CODE (operands[1]) != MEM)
4642 operands[1] = XEXP (operands[1], 0);
4643 if (GET_CODE (operands[1]) != SYMBOL_REF && GET_CODE (operands[1]) != REG)
4644 operands[1] = force_reg (DImode, operands[1]);
4647 (define_expand "call_value_vms"
4648 [(parallel [(set (match_operand 0 "" "")
4649 (call (mem:DI (match_operand:DI 1 "" ""))
4650 (match_operand 2 "" "")))
4654 (clobber (reg:DI 27))])]
4657 if (GET_CODE (operands[1]) != MEM)
4660 operands[1] = XEXP (operands[1], 0);
4662 /* Always load AI with argument information, then handle symbolic and
4663 indirect call differently. Load RA and set operands[3] to PV in
4666 emit_move_insn (gen_rtx_REG (DImode, 25), operands[2]);
4667 if (GET_CODE (operands[1]) == SYMBOL_REF)
4669 alpha_need_linkage (XSTR (operands[1], 0), 0);
4671 operands[3] = const0_rtx;
4675 emit_move_insn (gen_rtx_REG (Pmode, 26),
4676 gen_rtx_MEM (Pmode, plus_constant (operands[1], 8)));
4677 operands[3] = operands[1];
4681 (define_expand "call_value_umk"
4682 [(parallel [(set (match_operand 0 "" "")
4683 (call (mem:DI (match_operand 1 "" ""))
4684 (match_operand 2 "" "")))
4686 (clobber (reg:DI 26))])]
4689 if (GET_CODE (operands[1]) != MEM)
4692 operands[1] = XEXP (operands[1], 0);
4693 if (GET_CODE (operands[1]) != REG)
4694 operands[1] = force_reg (DImode, operands[1]);
4696 emit_move_insn (gen_rtx_REG (DImode, 25), operands[2]);
4699 (define_insn "*call_osf_1_er"
4700 [(call (mem:DI (match_operand:DI 0 "call_operand" "c,R,s"))
4701 (match_operand 1 "" ""))
4703 (clobber (reg:DI 26))]
4704 "TARGET_EXPLICIT_RELOCS && TARGET_ABI_OSF"
4706 jsr $26,(%0),0\;ldah $29,0($26)\t\t!gpdisp!%*\;lda $29,0($29)\t\t!gpdisp!%*
4707 bsr $26,%0\t\t!samegp
4708 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!%*"
4709 [(set_attr "type" "jsr")
4710 (set_attr "length" "12,*,16")])
4712 ;; We must use peep2 instead of a split because we need accurate life
4713 ;; information for $gp. Consider the case of { bar(); while (1); }.
4715 [(parallel [(call (mem:DI (match_operand:DI 0 "call_operand" ""))
4716 (match_operand 1 "" ""))
4718 (clobber (reg:DI 26))])]
4719 "TARGET_EXPLICIT_RELOCS && TARGET_ABI_OSF && reload_completed
4720 && ! samegp_function_operand (operands[0], Pmode)
4721 && (peep2_regno_dead_p (1, 29)
4722 || find_reg_note (insn, REG_NORETURN, NULL_RTX))"
4723 [(parallel [(call (mem:DI (match_dup 2))
4725 (set (reg:DI 26) (plus:DI (pc) (const_int 4)))
4726 (unspec_volatile [(reg:DI 29)] UNSPECV_BLOCKAGE)
4728 (use (match_dup 3))])]
4730 if (CONSTANT_P (operands[0]))
4732 operands[2] = gen_rtx_REG (Pmode, 27);
4733 operands[3] = GEN_INT (alpha_next_sequence_number++);
4734 emit_insn (gen_movdi_er_high_g (operands[2], pic_offset_table_rtx,
4735 operands[0], operands[3]));
4739 operands[2] = operands[0];
4740 operands[0] = const0_rtx;
4741 operands[3] = const0_rtx;
4746 [(parallel [(call (mem:DI (match_operand:DI 0 "call_operand" ""))
4747 (match_operand 1 "" ""))
4749 (clobber (reg:DI 26))])]
4750 "TARGET_EXPLICIT_RELOCS && TARGET_ABI_OSF && reload_completed
4751 && ! samegp_function_operand (operands[0], Pmode)
4752 && ! (peep2_regno_dead_p (1, 29)
4753 || find_reg_note (insn, REG_NORETURN, NULL_RTX))"
4754 [(parallel [(call (mem:DI (match_dup 2))
4756 (set (reg:DI 26) (plus:DI (pc) (const_int 4)))
4757 (unspec_volatile [(reg:DI 29)] UNSPECV_BLOCKAGE)
4759 (use (match_dup 4))])
4761 (unspec_volatile:DI [(reg:DI 26) (match_dup 3)] UNSPECV_LDGP1))
4763 (unspec:DI [(reg:DI 29) (match_dup 3)] UNSPEC_LDGP2))]
4765 if (CONSTANT_P (operands[0]))
4767 operands[2] = gen_rtx_REG (Pmode, 27);
4768 operands[4] = GEN_INT (alpha_next_sequence_number++);
4769 emit_insn (gen_movdi_er_high_g (operands[2], pic_offset_table_rtx,
4770 operands[0], operands[4]));
4774 operands[2] = operands[0];
4775 operands[0] = const0_rtx;
4776 operands[4] = const0_rtx;
4778 operands[3] = GEN_INT (alpha_next_sequence_number++);
4781 ;; We add a blockage unspec_volatile to prevent insns from moving down
4782 ;; from above the call to in between the call and the ldah gpdisp.
4784 (define_insn "*call_osf_2_er"
4785 [(call (mem:DI (match_operand:DI 0 "register_operand" "c"))
4786 (match_operand 1 "" ""))
4787 (set (reg:DI 26) (plus:DI (pc) (const_int 4)))
4788 (unspec_volatile [(reg:DI 29)] UNSPECV_BLOCKAGE)
4789 (use (match_operand 2 "" ""))
4790 (use (match_operand 3 "const_int_operand" ""))]
4791 "TARGET_EXPLICIT_RELOCS && TARGET_ABI_OSF"
4792 "jsr $26,(%0),%2%J3"
4793 [(set_attr "type" "jsr")
4794 (set_attr "cannot_copy" "true")])
4796 ;; We output a nop after noreturn calls at the very end of the function to
4797 ;; ensure that the return address always remains in the caller's code range,
4798 ;; as not doing so might confuse unwinding engines.
4800 ;; The potential change in insn length is not reflected in the length
4801 ;; attributes at this stage. Since the extra space is only actually added at
4802 ;; the very end of the compilation process (via final/print_operand), it
4803 ;; really seems harmless and not worth the trouble of some extra computation
4804 ;; cost and complexity.
4806 (define_insn "*call_osf_1_noreturn"
4807 [(call (mem:DI (match_operand:DI 0 "call_operand" "c,R,s"))
4808 (match_operand 1 "" ""))
4810 (clobber (reg:DI 26))]
4811 "! TARGET_EXPLICIT_RELOCS && TARGET_ABI_OSF
4812 && find_reg_note (insn, REG_NORETURN, NULL_RTX)"
4817 [(set_attr "type" "jsr")
4818 (set_attr "length" "*,*,8")])
4820 (define_insn "*call_osf_1"
4821 [(call (mem:DI (match_operand:DI 0 "call_operand" "c,R,s"))
4822 (match_operand 1 "" ""))
4824 (clobber (reg:DI 26))]
4825 "! TARGET_EXPLICIT_RELOCS && TARGET_ABI_OSF"
4827 jsr $26,($27),0\;ldgp $29,0($26)
4829 jsr $26,%0\;ldgp $29,0($26)"
4830 [(set_attr "type" "jsr")
4831 (set_attr "length" "12,*,16")])
4833 ;; Note that the DEC assembler expands "jmp foo" with $at, which
4834 ;; doesn't do what we want.
4835 (define_insn "*sibcall_osf_1_er"
4836 [(call (mem:DI (match_operand:DI 0 "symbolic_operand" "R,s"))
4837 (match_operand 1 "" ""))
4838 (unspec [(reg:DI 29)] UNSPEC_SIBCALL)]
4839 "TARGET_EXPLICIT_RELOCS && TARGET_ABI_OSF"
4841 br $31,%0\t\t!samegp
4842 ldq $27,%0($29)\t\t!literal!%#\;jmp $31,($27),%0\t\t!lituse_jsr!%#"
4843 [(set_attr "type" "jsr")
4844 (set_attr "length" "*,8")])
4846 (define_insn "*sibcall_osf_1"
4847 [(call (mem:DI (match_operand:DI 0 "symbolic_operand" "R,s"))
4848 (match_operand 1 "" ""))
4849 (unspec [(reg:DI 29)] UNSPEC_SIBCALL)]
4850 "! TARGET_EXPLICIT_RELOCS && TARGET_ABI_OSF"
4853 lda $27,%0\;jmp $31,($27),%0"
4854 [(set_attr "type" "jsr")
4855 (set_attr "length" "*,8")])
4857 (define_insn "*call_nt_1"
4858 [(call (mem:DI (match_operand:DI 0 "call_operand" "r,R,s"))
4859 (match_operand 1 "" ""))
4860 (clobber (reg:DI 26))]
4861 "TARGET_ABI_WINDOWS_NT"
4866 [(set_attr "type" "jsr")
4867 (set_attr "length" "*,*,12")])
4869 ; GAS relies on the order and position of instructions output below in order
4870 ; to generate relocs for VMS link to potentially optimize the call.
4871 ; Please do not molest.
4872 (define_insn "*call_vms_1"
4873 [(call (mem:DI (match_operand:DI 0 "call_operand" "r,s"))
4874 (match_operand 1 "" ""))
4875 (use (match_operand:DI 2 "nonmemory_operand" "r,n"))
4878 (clobber (reg:DI 27))]
4879 "TARGET_ABI_OPEN_VMS"
4881 switch (which_alternative)
4884 return "mov %2,$27\;jsr $26,0\;ldq $27,0($29)";
4886 operands [2] = alpha_use_linkage (operands [0], cfun->decl, 1, 0);
4887 operands [3] = alpha_use_linkage (operands [0], cfun->decl, 0, 0);
4888 return "ldq $26,%3\;ldq $27,%2\;jsr $26,%0\;ldq $27,0($29)";
4893 [(set_attr "type" "jsr")
4894 (set_attr "length" "12,16")])
4896 (define_insn "*call_umk_1"
4897 [(call (mem:DI (match_operand:DI 0 "call_operand" "r"))
4898 (match_operand 1 "" ""))
4900 (clobber (reg:DI 26))]
4901 "TARGET_ABI_UNICOSMK"
4903 [(set_attr "type" "jsr")])
4905 ;; Call subroutine returning any type.
4907 (define_expand "untyped_call"
4908 [(parallel [(call (match_operand 0 "" "")
4910 (match_operand 1 "" "")
4911 (match_operand 2 "" "")])]
4916 emit_call_insn (GEN_CALL (operands[0], const0_rtx, NULL, const0_rtx));
4918 for (i = 0; i < XVECLEN (operands[2], 0); i++)
4920 rtx set = XVECEXP (operands[2], 0, i);
4921 emit_move_insn (SET_DEST (set), SET_SRC (set));
4924 /* The optimizer does not know that the call sets the function value
4925 registers we stored in the result block. We avoid problems by
4926 claiming that all hard registers are used and clobbered at this
4928 emit_insn (gen_blockage ());
4933 ;; UNSPEC_VOLATILE is considered to use and clobber all hard registers and
4934 ;; all of memory. This blocks insns from being moved across this point.
4936 (define_insn "blockage"
4937 [(unspec_volatile [(const_int 0)] UNSPECV_BLOCKAGE)]
4940 [(set_attr "length" "0")
4941 (set_attr "type" "none")])
4945 (label_ref (match_operand 0 "" "")))]
4948 [(set_attr "type" "ibr")])
4950 (define_expand "return"
4955 (define_insn "*return_internal"
4959 [(set_attr "type" "ibr")])
4961 (define_insn "indirect_jump"
4962 [(set (pc) (match_operand:DI 0 "register_operand" "r"))]
4965 [(set_attr "type" "ibr")])
4967 (define_expand "tablejump"
4968 [(parallel [(set (pc)
4969 (match_operand 0 "register_operand" ""))
4970 (use (label_ref:DI (match_operand 1 "" "")))])]
4973 if (TARGET_ABI_WINDOWS_NT)
4975 rtx dest = gen_reg_rtx (DImode);
4976 emit_insn (gen_extendsidi2 (dest, operands[0]));
4979 else if (TARGET_ABI_OSF)
4981 rtx dest = gen_reg_rtx (DImode);
4982 emit_insn (gen_extendsidi2 (dest, operands[0]));
4983 emit_insn (gen_adddi3 (dest, pic_offset_table_rtx, dest));
4988 (define_insn "*tablejump_osf_nt_internal"
4990 (match_operand:DI 0 "register_operand" "r"))
4991 (use (label_ref:DI (match_operand 1 "" "")))]
4992 "(TARGET_ABI_OSF || TARGET_ABI_WINDOWS_NT)
4993 && alpha_tablejump_addr_vec (insn)"
4995 operands[2] = alpha_tablejump_best_label (insn);
4996 return "jmp $31,(%0),%2";
4998 [(set_attr "type" "ibr")])
5000 (define_insn "*tablejump_internal"
5002 (match_operand:DI 0 "register_operand" "r"))
5003 (use (label_ref (match_operand 1 "" "")))]
5006 [(set_attr "type" "ibr")])
5008 ;; Cache flush. Used by INITIALIZE_TRAMPOLINE. 0x86 is PAL_imb, but we don't
5009 ;; want to have to include pal.h in our .s file.
5011 ;; Technically the type for call_pal is jsr, but we use that for determining
5012 ;; if we need a GP. Use ibr instead since it has the same EV5 scheduling
5015 [(unspec_volatile [(const_int 0)] UNSPECV_IMB)]
5018 [(set_attr "type" "callpal")])
5020 ;; BUGCHK is documented common to OSF/1 and VMS PALcode.
5021 ;; NT does not document anything at 0x81 -- presumably it would generate
5022 ;; the equivalent of SIGILL, but this isn't that important.
5023 ;; ??? Presuming unicosmk uses either OSF/1 or VMS PALcode.
5025 [(trap_if (const_int 1) (const_int 0))]
5026 "!TARGET_ABI_WINDOWS_NT"
5028 [(set_attr "type" "callpal")])
5030 ;; For userland, we load the thread pointer from the TCB.
5031 ;; For the kernel, we load the per-cpu private value.
5033 (define_insn "load_tp"
5034 [(set (match_operand:DI 0 "register_operand" "=v")
5035 (unspec:DI [(const_int 0)] UNSPEC_TP))]
5038 if (TARGET_TLS_KERNEL)
5039 return "call_pal 0x32";
5041 return "call_pal 0x9e";
5043 [(set_attr "type" "callpal")])
5045 ;; For completeness, and possibly a __builtin function, here's how to
5046 ;; set the thread pointer. Since we don't describe enough of this
5047 ;; quantity for CSE, we have to use a volatile unspec, and then there's
5048 ;; not much point in creating an R16_REG register class.
5050 (define_expand "set_tp"
5051 [(set (reg:DI 16) (match_operand:DI 0 "input_operand" ""))
5052 (unspec_volatile [(reg:DI 16)] UNSPECV_SET_TP)]
5056 (define_insn "*set_tp"
5057 [(unspec_volatile [(reg:DI 16)] UNSPECV_SET_TP)]
5060 if (TARGET_TLS_KERNEL)
5061 return "call_pal 0x31";
5063 return "call_pal 0x9f";
5065 [(set_attr "type" "callpal")])
5067 ;; Finally, we have the basic data motion insns. The byte and word insns
5068 ;; are done via define_expand. Start with the floating-point insns, since
5069 ;; they are simpler.
5071 (define_insn "*movsf_nofix"
5072 [(set (match_operand:SF 0 "nonimmediate_operand" "=f,f,*r,*r,m,m")
5073 (match_operand:SF 1 "input_operand" "fG,m,*rG,m,fG,*r"))]
5074 "TARGET_FPREGS && ! TARGET_FIX
5075 && (register_operand (operands[0], SFmode)
5076 || reg_or_0_operand (operands[1], SFmode))"
5084 [(set_attr "type" "fcpys,fld,ilog,ild,fst,ist")])
5086 (define_insn "*movsf_fix"
5087 [(set (match_operand:SF 0 "nonimmediate_operand" "=f,f,*r,*r,m,m,f,*r")
5088 (match_operand:SF 1 "input_operand" "fG,m,*rG,m,fG,*r,*r,f"))]
5089 "TARGET_FPREGS && TARGET_FIX
5090 && (register_operand (operands[0], SFmode)
5091 || reg_or_0_operand (operands[1], SFmode))"
5101 [(set_attr "type" "fcpys,fld,ilog,ild,fst,ist,itof,ftoi")])
5103 (define_insn "*movsf_nofp"
5104 [(set (match_operand:SF 0 "nonimmediate_operand" "=r,r,m")
5105 (match_operand:SF 1 "input_operand" "rG,m,r"))]
5107 && (register_operand (operands[0], SFmode)
5108 || reg_or_0_operand (operands[1], SFmode))"
5113 [(set_attr "type" "ilog,ild,ist")])
5115 (define_insn "*movdf_nofix"
5116 [(set (match_operand:DF 0 "nonimmediate_operand" "=f,f,*r,*r,m,m")
5117 (match_operand:DF 1 "input_operand" "fG,m,*rG,m,fG,*r"))]
5118 "TARGET_FPREGS && ! TARGET_FIX
5119 && (register_operand (operands[0], DFmode)
5120 || reg_or_0_operand (operands[1], DFmode))"
5128 [(set_attr "type" "fcpys,fld,ilog,ild,fst,ist")])
5130 (define_insn "*movdf_fix"
5131 [(set (match_operand:DF 0 "nonimmediate_operand" "=f,f,*r,*r,m,m,f,*r")
5132 (match_operand:DF 1 "input_operand" "fG,m,*rG,m,fG,*r,*r,f"))]
5133 "TARGET_FPREGS && TARGET_FIX
5134 && (register_operand (operands[0], DFmode)
5135 || reg_or_0_operand (operands[1], DFmode))"
5145 [(set_attr "type" "fcpys,fld,ilog,ild,fst,ist,itof,ftoi")])
5147 (define_insn "*movdf_nofp"
5148 [(set (match_operand:DF 0 "nonimmediate_operand" "=r,r,m")
5149 (match_operand:DF 1 "input_operand" "rG,m,r"))]
5151 && (register_operand (operands[0], DFmode)
5152 || reg_or_0_operand (operands[1], DFmode))"
5157 [(set_attr "type" "ilog,ild,ist")])
5159 ;; Subregs suck for register allocation. Pretend we can move TFmode
5160 ;; data between general registers until after reload.
5162 (define_insn_and_split "*movtf_internal"
5163 [(set (match_operand:TF 0 "nonimmediate_operand" "=r,o")
5164 (match_operand:TF 1 "input_operand" "roG,rG"))]
5165 "register_operand (operands[0], TFmode)
5166 || reg_or_0_operand (operands[1], TFmode)"
5169 [(set (match_dup 0) (match_dup 2))
5170 (set (match_dup 1) (match_dup 3))]
5172 alpha_split_tfmode_pair (operands);
5173 if (reg_overlap_mentioned_p (operands[0], operands[3]))
5176 tmp = operands[0], operands[0] = operands[1], operands[1] = tmp;
5177 tmp = operands[2], operands[2] = operands[3], operands[3] = tmp;
5181 (define_expand "movsf"
5182 [(set (match_operand:SF 0 "nonimmediate_operand" "")
5183 (match_operand:SF 1 "general_operand" ""))]
5186 if (GET_CODE (operands[0]) == MEM
5187 && ! reg_or_0_operand (operands[1], SFmode))
5188 operands[1] = force_reg (SFmode, operands[1]);
5191 (define_expand "movdf"
5192 [(set (match_operand:DF 0 "nonimmediate_operand" "")
5193 (match_operand:DF 1 "general_operand" ""))]
5196 if (GET_CODE (operands[0]) == MEM
5197 && ! reg_or_0_operand (operands[1], DFmode))
5198 operands[1] = force_reg (DFmode, operands[1]);
5201 (define_expand "movtf"
5202 [(set (match_operand:TF 0 "nonimmediate_operand" "")
5203 (match_operand:TF 1 "general_operand" ""))]
5206 if (GET_CODE (operands[0]) == MEM
5207 && ! reg_or_0_operand (operands[1], TFmode))
5208 operands[1] = force_reg (TFmode, operands[1]);
5211 (define_insn "*movsi"
5212 [(set (match_operand:SI 0 "nonimmediate_operand" "=r,r,r,r,m")
5213 (match_operand:SI 1 "input_operand" "rJ,K,L,m,rJ"))]
5214 "(TARGET_ABI_OSF || TARGET_ABI_UNICOSMK)
5215 && (register_operand (operands[0], SImode)
5216 || reg_or_0_operand (operands[1], SImode))"
5223 [(set_attr "type" "ilog,iadd,iadd,ild,ist")])
5225 (define_insn "*movsi_nt_vms"
5226 [(set (match_operand:SI 0 "nonimmediate_operand" "=r,r,r,r,r,m")
5227 (match_operand:SI 1 "input_operand" "rJ,K,L,s,m,rJ"))]
5228 "(TARGET_ABI_WINDOWS_NT || TARGET_ABI_OPEN_VMS)
5229 && (register_operand (operands[0], SImode)
5230 || reg_or_0_operand (operands[1], SImode))"
5238 [(set_attr "type" "ilog,iadd,iadd,ldsym,ild,ist")])
5240 (define_insn "*movhi_nobwx"
5241 [(set (match_operand:HI 0 "register_operand" "=r,r")
5242 (match_operand:HI 1 "input_operand" "rJ,n"))]
5244 && (register_operand (operands[0], HImode)
5245 || register_operand (operands[1], HImode))"
5249 [(set_attr "type" "ilog,iadd")])
5251 (define_insn "*movhi_bwx"
5252 [(set (match_operand:HI 0 "nonimmediate_operand" "=r,r,r,m")
5253 (match_operand:HI 1 "input_operand" "rJ,n,m,rJ"))]
5255 && (register_operand (operands[0], HImode)
5256 || reg_or_0_operand (operands[1], HImode))"
5262 [(set_attr "type" "ilog,iadd,ild,ist")])
5264 (define_insn "*movqi_nobwx"
5265 [(set (match_operand:QI 0 "register_operand" "=r,r")
5266 (match_operand:QI 1 "input_operand" "rJ,n"))]
5268 && (register_operand (operands[0], QImode)
5269 || register_operand (operands[1], QImode))"
5273 [(set_attr "type" "ilog,iadd")])
5275 (define_insn "*movqi_bwx"
5276 [(set (match_operand:QI 0 "nonimmediate_operand" "=r,r,r,m")
5277 (match_operand:QI 1 "input_operand" "rJ,n,m,rJ"))]
5279 && (register_operand (operands[0], QImode)
5280 || reg_or_0_operand (operands[1], QImode))"
5286 [(set_attr "type" "ilog,iadd,ild,ist")])
5288 ;; We do two major things here: handle mem->mem and construct long
5291 (define_expand "movsi"
5292 [(set (match_operand:SI 0 "nonimmediate_operand" "")
5293 (match_operand:SI 1 "general_operand" ""))]
5296 if (alpha_expand_mov (SImode, operands))
5300 ;; Split a load of a large constant into the appropriate two-insn
5304 [(set (match_operand:SI 0 "register_operand" "")
5305 (match_operand:SI 1 "const_int_operand" ""))]
5306 "! add_operand (operands[1], SImode)"
5307 [(set (match_dup 0) (match_dup 2))
5308 (set (match_dup 0) (plus:SI (match_dup 0) (match_dup 3)))]
5311 = alpha_emit_set_const (operands[0], SImode, INTVAL (operands[1]), 2);
5313 if (tem == operands[0])
5319 ;; Split the load of an address into a four-insn sequence on Unicos/Mk.
5320 ;; Always generate a REG_EQUAL note for the last instruction to facilitate
5321 ;; optimizations. If the symbolic operand is a label_ref, generate REG_LABEL
5322 ;; notes and update LABEL_NUSES because this is not done automatically.
5323 ;; Labels may be incorrectly deleted if we don't do this.
5325 ;; Describing what the individual instructions do correctly is too complicated
5326 ;; so use UNSPECs for each of the three parts of an address.
5329 [(set (match_operand:DI 0 "register_operand" "")
5330 (match_operand:DI 1 "symbolic_operand" ""))]
5331 "TARGET_ABI_UNICOSMK && reload_completed"
5334 rtx insn1, insn2, insn3;
5336 insn1 = emit_insn (gen_umk_laum (operands[0], operands[1]));
5337 emit_insn (gen_ashldi3 (operands[0], operands[0], GEN_INT (32)));
5338 insn2 = emit_insn (gen_umk_lalm (operands[0], operands[0], operands[1]));
5339 insn3 = emit_insn (gen_umk_lal (operands[0], operands[0], operands[1]));
5340 REG_NOTES (insn3) = gen_rtx_EXPR_LIST (REG_EQUAL, operands[1],
5342 if (GET_CODE (operands[1]) == LABEL_REF)
5346 label = XEXP (operands[1], 0);
5347 REG_NOTES (insn1) = gen_rtx_EXPR_LIST (REG_LABEL, label,
5349 REG_NOTES (insn2) = gen_rtx_EXPR_LIST (REG_LABEL, label,
5351 REG_NOTES (insn3) = gen_rtx_EXPR_LIST (REG_LABEL, label,
5353 LABEL_NUSES (label) += 3;
5358 ;; Instructions for loading the three parts of an address on Unicos/Mk.
5360 (define_insn "umk_laum"
5361 [(set (match_operand:DI 0 "register_operand" "=r")
5362 (unspec:DI [(match_operand:DI 1 "symbolic_operand" "")]
5364 "TARGET_ABI_UNICOSMK"
5366 [(set_attr "type" "iadd")])
5368 (define_insn "umk_lalm"
5369 [(set (match_operand:DI 0 "register_operand" "=r")
5370 (plus:DI (match_operand:DI 1 "register_operand" "r")
5371 (unspec:DI [(match_operand:DI 2 "symbolic_operand" "")]
5373 "TARGET_ABI_UNICOSMK"
5375 [(set_attr "type" "iadd")])
5377 (define_insn "umk_lal"
5378 [(set (match_operand:DI 0 "register_operand" "=r")
5379 (plus:DI (match_operand:DI 1 "register_operand" "r")
5380 (unspec:DI [(match_operand:DI 2 "symbolic_operand" "")]
5382 "TARGET_ABI_UNICOSMK"
5384 [(set_attr "type" "iadd")])
5386 ;; Add a new call information word to the current function's list of CIWs
5387 ;; and load its index into $25. Doing it here ensures that the CIW will be
5388 ;; associated with the correct function even in the presence of inlining.
5390 (define_insn "*umk_load_ciw"
5392 (unspec:DI [(match_operand 0 "" "")] UNSPEC_UMK_LOAD_CIW))]
5393 "TARGET_ABI_UNICOSMK"
5395 operands[0] = unicosmk_add_call_info_word (operands[0]);
5396 return "lda $25,%0";
5398 [(set_attr "type" "iadd")])
5400 (define_insn "*movdi_er_low_l"
5401 [(set (match_operand:DI 0 "register_operand" "=r")
5402 (lo_sum:DI (match_operand:DI 1 "register_operand" "r")
5403 (match_operand:DI 2 "local_symbolic_operand" "")))]
5404 "TARGET_EXPLICIT_RELOCS"
5406 if (true_regnum (operands[1]) == 29)
5407 return "lda %0,%2(%1)\t\t!gprel";
5409 return "lda %0,%2(%1)\t\t!gprellow";
5411 [(set_attr "usegp" "yes")])
5414 [(set (match_operand:DI 0 "register_operand" "")
5415 (match_operand:DI 1 "small_symbolic_operand" ""))]
5416 "TARGET_EXPLICIT_RELOCS && reload_completed"
5418 (lo_sum:DI (match_dup 2) (match_dup 1)))]
5419 "operands[2] = pic_offset_table_rtx;")
5422 [(set (match_operand:DI 0 "register_operand" "")
5423 (match_operand:DI 1 "local_symbolic_operand" ""))]
5424 "TARGET_EXPLICIT_RELOCS && reload_completed"
5426 (plus:DI (match_dup 2) (high:DI (match_dup 1))))
5428 (lo_sum:DI (match_dup 0) (match_dup 1)))]
5429 "operands[2] = pic_offset_table_rtx;")
5432 [(match_operand 0 "some_small_symbolic_operand" "")]
5433 "TARGET_EXPLICIT_RELOCS && reload_completed"
5435 "operands[0] = split_small_symbolic_operand (operands[0]);")
5437 ;; Accepts any symbolic, not just global, since function calls that
5438 ;; don't go via bsr still use !literal in hopes of linker relaxation.
5439 (define_insn "movdi_er_high_g"
5440 [(set (match_operand:DI 0 "register_operand" "=r")
5441 (unspec:DI [(match_operand:DI 1 "register_operand" "r")
5442 (match_operand:DI 2 "symbolic_operand" "")
5443 (match_operand 3 "const_int_operand" "")]
5445 "TARGET_EXPLICIT_RELOCS"
5447 if (INTVAL (operands[3]) == 0)
5448 return "ldq %0,%2(%1)\t\t!literal";
5450 return "ldq %0,%2(%1)\t\t!literal!%3";
5452 [(set_attr "type" "ldsym")])
5455 [(set (match_operand:DI 0 "register_operand" "")
5456 (match_operand:DI 1 "global_symbolic_operand" ""))]
5457 "TARGET_EXPLICIT_RELOCS && reload_completed"
5459 (unspec:DI [(match_dup 2)
5461 (const_int 0)] UNSPEC_LITERAL))]
5462 "operands[2] = pic_offset_table_rtx;")
5464 ;; With RTL inlining, at -O3, rtl is generated, stored, then actually
5465 ;; compiled at the end of compilation. In the meantime, someone can
5466 ;; re-encode-section-info on some symbol changing it e.g. from global
5467 ;; to local-not-small. If this happens, we'd have emitted a plain
5468 ;; load rather than a high+losum load and not recognize the insn.
5470 ;; So if rtl inlining is in effect, we delay the global/not-global
5471 ;; decision until rest_of_compilation by wrapping it in an UNSPEC_SYMBOL.
5473 (define_insn_and_split "movdi_er_maybe_g"
5474 [(set (match_operand:DI 0 "register_operand" "=r")
5475 (unspec:DI [(match_operand:DI 1 "symbolic_operand" "")]
5477 "TARGET_EXPLICIT_RELOCS && flag_inline_functions"
5480 [(set (match_dup 0) (match_dup 1))]
5482 if (local_symbolic_operand (operands[1], Pmode)
5483 && !small_symbolic_operand (operands[1], Pmode))
5485 rtx subtarget = no_new_pseudos ? operands[0] : gen_reg_rtx (Pmode);
5488 tmp = gen_rtx_HIGH (Pmode, operands[1]);
5489 if (reload_completed)
5490 tmp = gen_rtx_PLUS (Pmode, pic_offset_table_rtx, tmp);
5491 emit_insn (gen_rtx_SET (VOIDmode, subtarget, tmp));
5493 tmp = gen_rtx_LO_SUM (Pmode, subtarget, operands[1]);
5494 emit_insn (gen_rtx_SET (VOIDmode, operands[0], tmp));
5499 (define_insn "movdi_er_tlsgd"
5500 [(set (match_operand:DI 0 "register_operand" "=r")
5501 (unspec:DI [(match_operand:DI 1 "register_operand" "r")
5502 (match_operand:DI 2 "symbolic_operand" "")
5503 (match_operand 3 "const_int_operand" "")]
5507 if (INTVAL (operands[3]) == 0)
5508 return "lda %0,%2(%1)\t\t!tlsgd";
5510 return "lda %0,%2(%1)\t\t!tlsgd!%3";
5513 (define_insn "movdi_er_tlsldm"
5514 [(set (match_operand:DI 0 "register_operand" "=r")
5515 (unspec:DI [(match_operand:DI 1 "register_operand" "r")
5516 (match_operand 2 "const_int_operand" "")]
5520 if (INTVAL (operands[2]) == 0)
5521 return "lda %0,%&(%1)\t\t!tlsldm";
5523 return "lda %0,%&(%1)\t\t!tlsldm!%2";
5526 (define_insn "*movdi_er_gotdtp"
5527 [(set (match_operand:DI 0 "register_operand" "=r")
5528 (unspec:DI [(match_operand:DI 1 "register_operand" "r")
5529 (match_operand:DI 2 "symbolic_operand" "")]
5532 "ldq %0,%2(%1)\t\t!gotdtprel"
5533 [(set_attr "type" "ild")
5534 (set_attr "usegp" "yes")])
5537 [(set (match_operand:DI 0 "register_operand" "")
5538 (match_operand:DI 1 "gotdtp_symbolic_operand" ""))]
5539 "HAVE_AS_TLS && reload_completed"
5541 (unspec:DI [(match_dup 2)
5542 (match_dup 1)] UNSPEC_DTPREL))]
5544 operands[1] = XVECEXP (XEXP (operands[1], 0), 0, 0);
5545 operands[2] = pic_offset_table_rtx;
5548 (define_insn "*movdi_er_gottp"
5549 [(set (match_operand:DI 0 "register_operand" "=r")
5550 (unspec:DI [(match_operand:DI 1 "register_operand" "r")
5551 (match_operand:DI 2 "symbolic_operand" "")]
5554 "ldq %0,%2(%1)\t\t!gottprel"
5555 [(set_attr "type" "ild")
5556 (set_attr "usegp" "yes")])
5559 [(set (match_operand:DI 0 "register_operand" "")
5560 (match_operand:DI 1 "gottp_symbolic_operand" ""))]
5561 "HAVE_AS_TLS && reload_completed"
5563 (unspec:DI [(match_dup 2)
5564 (match_dup 1)] UNSPEC_TPREL))]
5566 operands[1] = XVECEXP (XEXP (operands[1], 0), 0, 0);
5567 operands[2] = pic_offset_table_rtx;
5570 (define_insn "*movdi_er_nofix"
5571 [(set (match_operand:DI 0 "nonimmediate_operand" "=r,r,r,r,r,r,m,*f,*f,Q")
5572 (match_operand:DI 1 "input_operand" "rJ,K,L,T,s,m,rJ,*fJ,Q,*f"))]
5573 "TARGET_EXPLICIT_RELOCS && ! TARGET_FIX
5574 && (register_operand (operands[0], DImode)
5575 || reg_or_0_operand (operands[1], DImode))"
5587 [(set_attr "type" "ilog,iadd,iadd,iadd,ldsym,ild,ist,fcpys,fld,fst")
5588 (set_attr "usegp" "*,*,*,yes,*,*,*,*,*,*")])
5590 ;; The 'U' constraint matches symbolic operands on Unicos/Mk. Those should
5591 ;; have been split up by the rules above but we shouldn't reject the
5592 ;; possibility of them getting through.
5594 (define_insn "*movdi_nofix"
5595 [(set (match_operand:DI 0 "nonimmediate_operand" "=r,r,r,r,r,r,m,*f,*f,Q")
5596 (match_operand:DI 1 "input_operand" "rJ,K,L,U,s,m,rJ,*fJ,Q,*f"))]
5598 && (register_operand (operands[0], DImode)
5599 || reg_or_0_operand (operands[1], DImode))"
5604 laum %0,%t1($31)\;sll %0,32,%0\;lalm %0,%t1(%0)\;lal %0,%t1(%0)
5611 [(set_attr "type" "ilog,iadd,iadd,ldsym,ldsym,ild,ist,fcpys,fld,fst")
5612 (set_attr "length" "*,*,*,16,*,*,*,*,*,*")])
5614 (define_insn "*movdi_er_fix"
5615 [(set (match_operand:DI 0 "nonimmediate_operand"
5616 "=r,r,r,r,r,r, m, *f,*f, Q, r,*f")
5617 (match_operand:DI 1 "input_operand"
5618 "rJ,K,L,T,s,m,rJ,*fJ, Q,*f,*f, r"))]
5619 "TARGET_EXPLICIT_RELOCS && TARGET_FIX
5620 && (register_operand (operands[0], DImode)
5621 || reg_or_0_operand (operands[1], DImode))"
5635 [(set_attr "type" "ilog,iadd,iadd,iadd,ldsym,ild,ist,fcpys,fld,fst,ftoi,itof")
5636 (set_attr "usegp" "*,*,*,yes,*,*,*,*,*,*,*,*")])
5638 (define_insn "*movdi_fix"
5639 [(set (match_operand:DI 0 "nonimmediate_operand" "=r,r,r,r,r,m,*f,*f,Q,r,*f")
5640 (match_operand:DI 1 "input_operand" "rJ,K,L,s,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))"
5656 [(set_attr "type" "ilog,iadd,iadd,ldsym,ild,ist,fcpys,fld,fst,ftoi,itof")])
5658 ;; VMS needs to set up "vms_base_regno" for unwinding. This move
5659 ;; often appears dead to the life analysis code, at which point we
5660 ;; abort for emitting dead prologue instructions. Force this live.
5662 (define_insn "force_movdi"
5663 [(set (match_operand:DI 0 "register_operand" "=r")
5664 (unspec_volatile:DI [(match_operand:DI 1 "register_operand" "r")]
5665 UNSPECV_FORCE_MOV))]
5668 [(set_attr "type" "ilog")])
5670 ;; We do three major things here: handle mem->mem, put 64-bit constants in
5671 ;; memory, and construct long 32-bit constants.
5673 (define_expand "movdi"
5674 [(set (match_operand:DI 0 "nonimmediate_operand" "")
5675 (match_operand:DI 1 "general_operand" ""))]
5678 if (alpha_expand_mov (DImode, operands))
5682 ;; Split a load of a large constant into the appropriate two-insn
5686 [(set (match_operand:DI 0 "register_operand" "")
5687 (match_operand:DI 1 "const_int_operand" ""))]
5688 "! add_operand (operands[1], DImode)"
5689 [(set (match_dup 0) (match_dup 2))
5690 (set (match_dup 0) (plus:DI (match_dup 0) (match_dup 3)))]
5693 = alpha_emit_set_const (operands[0], DImode, INTVAL (operands[1]), 2);
5695 if (tem == operands[0])
5701 ;; These are the partial-word cases.
5703 ;; First we have the code to load an aligned word. Operand 0 is the register
5704 ;; in which to place the result. It's mode is QImode or HImode. Operand 1
5705 ;; is an SImode MEM at the low-order byte of the proper word. Operand 2 is the
5706 ;; number of bits within the word that the value is. Operand 3 is an SImode
5707 ;; scratch register. If operand 0 is a hard register, operand 3 may be the
5708 ;; same register. It is allowed to conflict with operand 1 as well.
5710 (define_expand "aligned_loadqi"
5711 [(set (match_operand:SI 3 "register_operand" "")
5712 (match_operand:SI 1 "memory_operand" ""))
5713 (set (match_operand:DI 0 "register_operand" "")
5714 (zero_extract:DI (subreg:DI (match_dup 3) 0)
5716 (match_operand:DI 2 "const_int_operand" "")))]
5721 (define_expand "aligned_loadhi"
5722 [(set (match_operand:SI 3 "register_operand" "")
5723 (match_operand:SI 1 "memory_operand" ""))
5724 (set (match_operand:DI 0 "register_operand" "")
5725 (zero_extract:DI (subreg:DI (match_dup 3) 0)
5727 (match_operand:DI 2 "const_int_operand" "")))]
5732 ;; Similar for unaligned loads, where we use the sequence from the
5733 ;; Alpha Architecture manual. We have to distinguish between little-endian
5734 ;; and big-endian systems as the sequences are different.
5736 ;; Operand 1 is the address. Operands 2 and 3 are temporaries, where
5737 ;; operand 3 can overlap the input and output registers.
5739 (define_expand "unaligned_loadqi"
5740 [(use (match_operand:DI 0 "register_operand" ""))
5741 (use (match_operand:DI 1 "address_operand" ""))
5742 (use (match_operand:DI 2 "register_operand" ""))
5743 (use (match_operand:DI 3 "register_operand" ""))]
5746 if (WORDS_BIG_ENDIAN)
5747 emit_insn (gen_unaligned_loadqi_be (operands[0], operands[1],
5748 operands[2], operands[3]));
5750 emit_insn (gen_unaligned_loadqi_le (operands[0], operands[1],
5751 operands[2], operands[3]));
5755 (define_expand "unaligned_loadqi_le"
5756 [(set (match_operand:DI 2 "register_operand" "")
5757 (mem:DI (and:DI (match_operand:DI 1 "address_operand" "")
5759 (set (match_operand:DI 3 "register_operand" "")
5761 (set (match_operand:DI 0 "register_operand" "")
5762 (zero_extract:DI (match_dup 2)
5764 (ashift:DI (match_dup 3) (const_int 3))))]
5765 "! WORDS_BIG_ENDIAN"
5768 (define_expand "unaligned_loadqi_be"
5769 [(set (match_operand:DI 2 "register_operand" "")
5770 (mem:DI (and:DI (match_operand:DI 1 "address_operand" "")
5772 (set (match_operand:DI 3 "register_operand" "")
5774 (set (match_operand:DI 0 "register_operand" "")
5775 (zero_extract:DI (match_dup 2)
5779 (ashift:DI (match_dup 3) (const_int 3)))))]
5783 (define_expand "unaligned_loadhi"
5784 [(use (match_operand:DI 0 "register_operand" ""))
5785 (use (match_operand:DI 1 "address_operand" ""))
5786 (use (match_operand:DI 2 "register_operand" ""))
5787 (use (match_operand:DI 3 "register_operand" ""))]
5790 if (WORDS_BIG_ENDIAN)
5791 emit_insn (gen_unaligned_loadhi_be (operands[0], operands[1],
5792 operands[2], operands[3]));
5794 emit_insn (gen_unaligned_loadhi_le (operands[0], operands[1],
5795 operands[2], operands[3]));
5799 (define_expand "unaligned_loadhi_le"
5800 [(set (match_operand:DI 2 "register_operand" "")
5801 (mem:DI (and:DI (match_operand:DI 1 "address_operand" "")
5803 (set (match_operand:DI 3 "register_operand" "")
5805 (set (match_operand:DI 0 "register_operand" "")
5806 (zero_extract:DI (match_dup 2)
5808 (ashift:DI (match_dup 3) (const_int 3))))]
5809 "! WORDS_BIG_ENDIAN"
5812 (define_expand "unaligned_loadhi_be"
5813 [(set (match_operand:DI 2 "register_operand" "")
5814 (mem:DI (and:DI (match_operand:DI 1 "address_operand" "")
5816 (set (match_operand:DI 3 "register_operand" "")
5817 (plus:DI (match_dup 1) (const_int 1)))
5818 (set (match_operand:DI 0 "register_operand" "")
5819 (zero_extract:DI (match_dup 2)
5823 (ashift:DI (match_dup 3) (const_int 3)))))]
5827 ;; Storing an aligned byte or word requires two temporaries. Operand 0 is the
5828 ;; aligned SImode MEM. Operand 1 is the register containing the
5829 ;; byte or word to store. Operand 2 is the number of bits within the word that
5830 ;; the value should be placed. Operands 3 and 4 are SImode temporaries.
5832 (define_expand "aligned_store"
5833 [(set (match_operand:SI 3 "register_operand" "")
5834 (match_operand:SI 0 "memory_operand" ""))
5835 (set (subreg:DI (match_dup 3) 0)
5836 (and:DI (subreg:DI (match_dup 3) 0) (match_dup 5)))
5837 (set (subreg:DI (match_operand:SI 4 "register_operand" "") 0)
5838 (ashift:DI (zero_extend:DI (match_operand 1 "register_operand" ""))
5839 (match_operand:DI 2 "const_int_operand" "")))
5840 (set (subreg:DI (match_dup 4) 0)
5841 (ior:DI (subreg:DI (match_dup 4) 0) (subreg:DI (match_dup 3) 0)))
5842 (set (match_dup 0) (match_dup 4))]
5845 operands[5] = GEN_INT (~ (GET_MODE_MASK (GET_MODE (operands[1]))
5846 << INTVAL (operands[2])));
5849 ;; For the unaligned byte and halfword cases, we use code similar to that
5850 ;; in the ;; Architecture book, but reordered to lower the number of registers
5851 ;; required. Operand 0 is the address. Operand 1 is the data to store.
5852 ;; Operands 2, 3, and 4 are DImode temporaries, where operands 2 and 4 may
5853 ;; be the same temporary, if desired. If the address is in a register,
5854 ;; operand 2 can be that register.
5856 (define_expand "unaligned_storeqi"
5857 [(use (match_operand:DI 0 "address_operand" ""))
5858 (use (match_operand:QI 1 "register_operand" ""))
5859 (use (match_operand:DI 2 "register_operand" ""))
5860 (use (match_operand:DI 3 "register_operand" ""))
5861 (use (match_operand:DI 4 "register_operand" ""))]
5864 if (WORDS_BIG_ENDIAN)
5865 emit_insn (gen_unaligned_storeqi_be (operands[0], operands[1],
5866 operands[2], operands[3],
5869 emit_insn (gen_unaligned_storeqi_le (operands[0], operands[1],
5870 operands[2], operands[3],
5875 (define_expand "unaligned_storeqi_le"
5876 [(set (match_operand:DI 3 "register_operand" "")
5877 (mem:DI (and:DI (match_operand:DI 0 "address_operand" "")
5879 (set (match_operand:DI 2 "register_operand" "")
5882 (and:DI (not:DI (ashift:DI (const_int 255)
5883 (ashift:DI (match_dup 2) (const_int 3))))
5885 (set (match_operand:DI 4 "register_operand" "")
5886 (ashift:DI (zero_extend:DI (match_operand:QI 1 "register_operand" ""))
5887 (ashift:DI (match_dup 2) (const_int 3))))
5888 (set (match_dup 4) (ior:DI (match_dup 4) (match_dup 3)))
5889 (set (mem:DI (and:DI (match_dup 0) (const_int -8)))
5891 "! WORDS_BIG_ENDIAN"
5894 (define_expand "unaligned_storeqi_be"
5895 [(set (match_operand:DI 3 "register_operand" "")
5896 (mem:DI (and:DI (match_operand:DI 0 "address_operand" "")
5898 (set (match_operand:DI 2 "register_operand" "")
5901 (and:DI (not:DI (ashift:DI (const_int 255)
5902 (minus:DI (const_int 56)
5903 (ashift:DI (match_dup 2) (const_int 3)))))
5905 (set (match_operand:DI 4 "register_operand" "")
5906 (ashift:DI (zero_extend:DI (match_operand:QI 1 "register_operand" ""))
5907 (minus:DI (const_int 56)
5908 (ashift:DI (match_dup 2) (const_int 3)))))
5909 (set (match_dup 4) (ior:DI (match_dup 4) (match_dup 3)))
5910 (set (mem:DI (and:DI (match_dup 0) (const_int -8)))
5915 (define_expand "unaligned_storehi"
5916 [(use (match_operand:DI 0 "address_operand" ""))
5917 (use (match_operand:HI 1 "register_operand" ""))
5918 (use (match_operand:DI 2 "register_operand" ""))
5919 (use (match_operand:DI 3 "register_operand" ""))
5920 (use (match_operand:DI 4 "register_operand" ""))]
5923 if (WORDS_BIG_ENDIAN)
5924 emit_insn (gen_unaligned_storehi_be (operands[0], operands[1],
5925 operands[2], operands[3],
5928 emit_insn (gen_unaligned_storehi_le (operands[0], operands[1],
5929 operands[2], operands[3],
5934 (define_expand "unaligned_storehi_le"
5935 [(set (match_operand:DI 3 "register_operand" "")
5936 (mem:DI (and:DI (match_operand:DI 0 "address_operand" "")
5938 (set (match_operand:DI 2 "register_operand" "")
5941 (and:DI (not:DI (ashift:DI (const_int 65535)
5942 (ashift:DI (match_dup 2) (const_int 3))))
5944 (set (match_operand:DI 4 "register_operand" "")
5945 (ashift:DI (zero_extend:DI (match_operand:HI 1 "register_operand" ""))
5946 (ashift:DI (match_dup 2) (const_int 3))))
5947 (set (match_dup 4) (ior:DI (match_dup 4) (match_dup 3)))
5948 (set (mem:DI (and:DI (match_dup 0) (const_int -8)))
5950 "! WORDS_BIG_ENDIAN"
5953 (define_expand "unaligned_storehi_be"
5954 [(set (match_operand:DI 3 "register_operand" "")
5955 (mem:DI (and:DI (match_operand:DI 0 "address_operand" "")
5957 (set (match_operand:DI 2 "register_operand" "")
5958 (plus:DI (match_dup 0) (const_int 1)))
5960 (and:DI (not:DI (ashift:DI
5962 (minus:DI (const_int 56)
5963 (ashift:DI (match_dup 2) (const_int 3)))))
5965 (set (match_operand:DI 4 "register_operand" "")
5966 (ashift:DI (zero_extend:DI (match_operand:HI 1 "register_operand" ""))
5967 (minus:DI (const_int 56)
5968 (ashift:DI (match_dup 2) (const_int 3)))))
5969 (set (match_dup 4) (ior:DI (match_dup 4) (match_dup 3)))
5970 (set (mem:DI (and:DI (match_dup 0) (const_int -8)))
5975 ;; Here are the define_expand's for QI and HI moves that use the above
5976 ;; patterns. We have the normal sets, plus the ones that need scratch
5977 ;; registers for reload.
5979 (define_expand "movqi"
5980 [(set (match_operand:QI 0 "nonimmediate_operand" "")
5981 (match_operand:QI 1 "general_operand" ""))]
5985 ? alpha_expand_mov (QImode, operands)
5986 : alpha_expand_mov_nobwx (QImode, operands))
5990 (define_expand "movhi"
5991 [(set (match_operand:HI 0 "nonimmediate_operand" "")
5992 (match_operand:HI 1 "general_operand" ""))]
5996 ? alpha_expand_mov (HImode, operands)
5997 : alpha_expand_mov_nobwx (HImode, operands))
6001 ;; Here are the versions for reload. Note that in the unaligned cases
6002 ;; we know that the operand must not be a pseudo-register because stack
6003 ;; slots are always aligned references.
6005 (define_expand "reload_inqi"
6006 [(parallel [(match_operand:QI 0 "register_operand" "=r")
6007 (match_operand:QI 1 "any_memory_operand" "m")
6008 (match_operand:TI 2 "register_operand" "=&r")])]
6013 if (aligned_memory_operand (operands[1], QImode))
6015 seq = gen_reload_inqi_help (operands[0], operands[1],
6016 gen_rtx_REG (SImode, REGNO (operands[2])));
6022 /* It is possible that one of the registers we got for operands[2]
6023 might coincide with that of operands[0] (which is why we made
6024 it TImode). Pick the other one to use as our scratch. */
6025 if (REGNO (operands[0]) == REGNO (operands[2]))
6026 scratch = gen_rtx_REG (DImode, REGNO (operands[2]) + 1);
6028 scratch = gen_rtx_REG (DImode, REGNO (operands[2]));
6030 addr = get_unaligned_address (operands[1], 0);
6031 operands[0] = gen_rtx_REG (DImode, REGNO (operands[0]));
6032 seq = gen_unaligned_loadqi (operands[0], addr, scratch, operands[0]);
6033 alpha_set_memflags (seq, operands[1]);
6039 (define_expand "reload_inhi"
6040 [(parallel [(match_operand:HI 0 "register_operand" "=r")
6041 (match_operand:HI 1 "any_memory_operand" "m")
6042 (match_operand:TI 2 "register_operand" "=&r")])]
6047 if (aligned_memory_operand (operands[1], HImode))
6049 seq = gen_reload_inhi_help (operands[0], operands[1],
6050 gen_rtx_REG (SImode, REGNO (operands[2])));
6056 /* It is possible that one of the registers we got for operands[2]
6057 might coincide with that of operands[0] (which is why we made
6058 it TImode). Pick the other one to use as our scratch. */
6059 if (REGNO (operands[0]) == REGNO (operands[2]))
6060 scratch = gen_rtx_REG (DImode, REGNO (operands[2]) + 1);
6062 scratch = gen_rtx_REG (DImode, REGNO (operands[2]));
6064 addr = get_unaligned_address (operands[1], 0);
6065 operands[0] = gen_rtx_REG (DImode, REGNO (operands[0]));
6066 seq = gen_unaligned_loadhi (operands[0], addr, scratch, operands[0]);
6067 alpha_set_memflags (seq, operands[1]);
6073 (define_expand "reload_outqi"
6074 [(parallel [(match_operand:QI 0 "any_memory_operand" "=m")
6075 (match_operand:QI 1 "register_operand" "r")
6076 (match_operand:TI 2 "register_operand" "=&r")])]
6079 if (aligned_memory_operand (operands[0], QImode))
6081 emit_insn (gen_reload_outqi_help
6082 (operands[0], operands[1],
6083 gen_rtx_REG (SImode, REGNO (operands[2])),
6084 gen_rtx_REG (SImode, REGNO (operands[2]) + 1)));
6088 rtx addr = get_unaligned_address (operands[0], 0);
6089 rtx scratch1 = gen_rtx_REG (DImode, REGNO (operands[2]));
6090 rtx scratch2 = gen_rtx_REG (DImode, REGNO (operands[2]) + 1);
6091 rtx scratch3 = scratch1;
6094 if (GET_CODE (addr) == REG)
6097 seq = gen_unaligned_storeqi (addr, operands[1], scratch1,
6098 scratch2, scratch3);
6099 alpha_set_memflags (seq, operands[0]);
6105 (define_expand "reload_outhi"
6106 [(parallel [(match_operand:HI 0 "any_memory_operand" "=m")
6107 (match_operand:HI 1 "register_operand" "r")
6108 (match_operand:TI 2 "register_operand" "=&r")])]
6111 if (aligned_memory_operand (operands[0], HImode))
6113 emit_insn (gen_reload_outhi_help
6114 (operands[0], operands[1],
6115 gen_rtx_REG (SImode, REGNO (operands[2])),
6116 gen_rtx_REG (SImode, REGNO (operands[2]) + 1)));
6120 rtx addr = get_unaligned_address (operands[0], 0);
6121 rtx scratch1 = gen_rtx_REG (DImode, REGNO (operands[2]));
6122 rtx scratch2 = gen_rtx_REG (DImode, REGNO (operands[2]) + 1);
6123 rtx scratch3 = scratch1;
6126 if (GET_CODE (addr) == REG)
6129 seq = gen_unaligned_storehi (addr, operands[1], scratch1,
6130 scratch2, scratch3);
6131 alpha_set_memflags (seq, operands[0]);
6137 ;; Helpers for the above. The way reload is structured, we can't
6138 ;; always get a proper address for a stack slot during reload_foo
6139 ;; expansion, so we must delay our address manipulations until after.
6141 (define_insn_and_split "reload_inqi_help"
6142 [(set (match_operand:QI 0 "register_operand" "=r")
6143 (match_operand:QI 1 "memory_operand" "m"))
6144 (clobber (match_operand:SI 2 "register_operand" "=r"))]
6145 "! TARGET_BWX && (reload_in_progress || reload_completed)"
6147 "! TARGET_BWX && reload_completed"
6150 rtx aligned_mem, bitnum;
6151 get_aligned_mem (operands[1], &aligned_mem, &bitnum);
6152 operands[0] = gen_lowpart (DImode, operands[0]);
6153 emit_insn (gen_aligned_loadqi (operands[0], aligned_mem, bitnum,
6158 (define_insn_and_split "reload_inhi_help"
6159 [(set (match_operand:HI 0 "register_operand" "=r")
6160 (match_operand:HI 1 "memory_operand" "m"))
6161 (clobber (match_operand:SI 2 "register_operand" "=r"))]
6162 "! TARGET_BWX && (reload_in_progress || reload_completed)"
6164 "! TARGET_BWX && reload_completed"
6167 rtx aligned_mem, bitnum;
6168 get_aligned_mem (operands[1], &aligned_mem, &bitnum);
6169 operands[0] = gen_lowpart (DImode, operands[0]);
6170 emit_insn (gen_aligned_loadhi (operands[0], aligned_mem, bitnum,
6175 (define_insn_and_split "reload_outqi_help"
6176 [(set (match_operand:QI 0 "memory_operand" "=m")
6177 (match_operand:QI 1 "register_operand" "r"))
6178 (clobber (match_operand:SI 2 "register_operand" "=r"))
6179 (clobber (match_operand:SI 3 "register_operand" "=r"))]
6180 "! TARGET_BWX && (reload_in_progress || reload_completed)"
6182 "! TARGET_BWX && reload_completed"
6185 rtx aligned_mem, bitnum;
6186 get_aligned_mem (operands[0], &aligned_mem, &bitnum);
6187 emit_insn (gen_aligned_store (aligned_mem, operands[1], bitnum,
6188 operands[2], operands[3]));
6192 (define_insn_and_split "reload_outhi_help"
6193 [(set (match_operand:HI 0 "memory_operand" "=m")
6194 (match_operand:HI 1 "register_operand" "r"))
6195 (clobber (match_operand:SI 2 "register_operand" "=r"))
6196 (clobber (match_operand:SI 3 "register_operand" "=r"))]
6197 "! TARGET_BWX && (reload_in_progress || reload_completed)"
6199 "! TARGET_BWX && reload_completed"
6202 rtx aligned_mem, bitnum;
6203 get_aligned_mem (operands[0], &aligned_mem, &bitnum);
6204 emit_insn (gen_aligned_store (aligned_mem, operands[1], bitnum,
6205 operands[2], operands[3]));
6209 ;; Vector operations
6211 (define_expand "movv8qi"
6212 [(set (match_operand:V8QI 0 "nonimmediate_operand" "")
6213 (match_operand:V8QI 1 "general_operand" ""))]
6216 if (alpha_expand_mov (V8QImode, operands))
6220 (define_insn "*movv8qi_fix"
6221 [(set (match_operand:V8QI 0 "nonimmediate_operand" "=r,r,m,*f,*f,m,r,*f")
6222 (match_operand:V8QI 1 "input_operand" "rW,m,rW,*fW,m,*f,*f,r"))]
6224 && (register_operand (operands[0], V8QImode)
6225 || reg_or_0_operand (operands[1], V8QImode))"
6235 [(set_attr "type" "ilog,ild,ist,fcpys,fld,fst,ftoi,itof")])
6237 (define_insn "*movv8qi_nofix"
6238 [(set (match_operand:V8QI 0 "nonimmediate_operand" "=r,r,m,*f,*f,m")
6239 (match_operand:V8QI 1 "input_operand" "rW,m,rW,*fW,m,*f"))]
6241 && (register_operand (operands[0], V8QImode)
6242 || reg_or_0_operand (operands[1], V8QImode))"
6250 [(set_attr "type" "ilog,ild,ist,fcpys,fld,fst")])
6252 (define_expand "movv4hi"
6253 [(set (match_operand:V4HI 0 "nonimmediate_operand" "")
6254 (match_operand:V4HI 1 "general_operand" ""))]
6257 if (alpha_expand_mov (V4HImode, operands))
6261 (define_insn "*movv4hi_fix"
6262 [(set (match_operand:V4HI 0 "nonimmediate_operand" "=r,r,m,*f,*f,m,r,*f")
6263 (match_operand:V4HI 1 "input_operand" "rW,m,rW,*fW,m,*f,*f,r"))]
6265 && (register_operand (operands[0], V4HImode)
6266 || reg_or_0_operand (operands[1], V4HImode))"
6276 [(set_attr "type" "ilog,ild,ist,fcpys,fld,fst,ftoi,itof")])
6278 (define_insn "*movv4hi_nofix"
6279 [(set (match_operand:V4HI 0 "nonimmediate_operand" "=r,r,m,*f,*f,m")
6280 (match_operand:V4HI 1 "input_operand" "rW,m,rW,*fW,m,*f"))]
6282 && (register_operand (operands[0], V4HImode)
6283 || reg_or_0_operand (operands[1], V4HImode))"
6291 [(set_attr "type" "ilog,ild,ist,fcpys,fld,fst")])
6293 (define_expand "movv2si"
6294 [(set (match_operand:V2SI 0 "nonimmediate_operand" "")
6295 (match_operand:V2SI 1 "general_operand" ""))]
6298 if (alpha_expand_mov (V2SImode, operands))
6302 (define_insn "*movv2si_fix"
6303 [(set (match_operand:V2SI 0 "nonimmediate_operand" "=r,r,m,*f,*f,m,r,*f")
6304 (match_operand:V2SI 1 "input_operand" "rW,m,rW,*fW,m,*f,*f,r"))]
6306 && (register_operand (operands[0], V2SImode)
6307 || reg_or_0_operand (operands[1], V2SImode))"
6317 [(set_attr "type" "ilog,ild,ist,fcpys,fld,fst,ftoi,itof")])
6319 (define_insn "*movv2si_nofix"
6320 [(set (match_operand:V2SI 0 "nonimmediate_operand" "=r,r,m,*f,*f,m")
6321 (match_operand:V2SI 1 "input_operand" "rW,m,rW,*fW,m,*f"))]
6323 && (register_operand (operands[0], V2SImode)
6324 || reg_or_0_operand (operands[1], V2SImode))"
6332 [(set_attr "type" "ilog,ild,ist,fcpys,fld,fst")])
6334 (define_insn "uminv8qi3"
6335 [(set (match_operand:V8QI 0 "register_operand" "=r")
6336 (umin:V8QI (match_operand:V8QI 1 "reg_or_0_operand" "rW")
6337 (match_operand:V8QI 2 "reg_or_0_operand" "rW")))]
6340 [(set_attr "type" "mvi")])
6342 (define_insn "sminv8qi3"
6343 [(set (match_operand:V8QI 0 "register_operand" "=r")
6344 (smin:V8QI (match_operand:V8QI 1 "reg_or_0_operand" "rW")
6345 (match_operand:V8QI 2 "reg_or_0_operand" "rW")))]
6348 [(set_attr "type" "mvi")])
6350 (define_insn "uminv4hi3"
6351 [(set (match_operand:V4HI 0 "register_operand" "=r")
6352 (umin:V4HI (match_operand:V4HI 1 "reg_or_0_operand" "rW")
6353 (match_operand:V4HI 2 "reg_or_0_operand" "rW")))]
6356 [(set_attr "type" "mvi")])
6358 (define_insn "sminv4hi3"
6359 [(set (match_operand:V4HI 0 "register_operand" "=r")
6360 (smin:V4HI (match_operand:V4HI 1 "reg_or_0_operand" "rW")
6361 (match_operand:V4HI 2 "reg_or_0_operand" "rW")))]
6364 [(set_attr "type" "mvi")])
6366 (define_insn "umaxv8qi3"
6367 [(set (match_operand:V8QI 0 "register_operand" "=r")
6368 (umax:V8QI (match_operand:V8QI 1 "reg_or_0_operand" "rW")
6369 (match_operand:V8QI 2 "reg_or_0_operand" "rW")))]
6372 [(set_attr "type" "mvi")])
6374 (define_insn "smaxv8qi3"
6375 [(set (match_operand:V8QI 0 "register_operand" "=r")
6376 (smax:V8QI (match_operand:V8QI 1 "reg_or_0_operand" "rW")
6377 (match_operand:V8QI 2 "reg_or_0_operand" "rW")))]
6380 [(set_attr "type" "mvi")])
6382 (define_insn "umaxv4hi3"
6383 [(set (match_operand:V4HI 0 "register_operand" "=r")
6384 (umax:V4HI (match_operand:V4HI 1 "reg_or_0_operand" "rW")
6385 (match_operand:V4HI 2 "reg_or_0_operand" "rW")))]
6388 [(set_attr "type" "mvi")])
6390 (define_insn "smaxv4hi3"
6391 [(set (match_operand:V4HI 0 "register_operand" "=r")
6392 (smax:V4HI (match_operand:V4HI 1 "reg_or_0_operand" "rW")
6393 (match_operand:V4HI 2 "reg_or_0_operand" "rW")))]
6396 [(set_attr "type" "mvi")])
6398 ;; Bit field extract patterns which use ext[wlq][lh]
6400 (define_expand "extv"
6401 [(set (match_operand:DI 0 "register_operand" "")
6402 (sign_extract:DI (match_operand:QI 1 "memory_operand" "")
6403 (match_operand:DI 2 "immediate_operand" "")
6404 (match_operand:DI 3 "immediate_operand" "")))]
6409 /* We can do 16, 32 and 64 bit fields, if aligned on byte boundaries. */
6410 if (INTVAL (operands[3]) % 8 != 0
6411 || (INTVAL (operands[2]) != 16
6412 && INTVAL (operands[2]) != 32
6413 && INTVAL (operands[2]) != 64))
6416 /* From mips.md: extract_bit_field doesn't verify that our source
6417 matches the predicate, so we force it to be a MEM here. */
6418 if (GET_CODE (operands[1]) != MEM)
6421 /* The bit number is relative to the mode of operand 1 which is
6422 usually QImode (this might actually be a bug in expmed.c). Note
6423 that the bit number is negative in big-endian mode in this case.
6424 We have to convert that to the offset. */
6425 if (WORDS_BIG_ENDIAN)
6426 ofs = GET_MODE_BITSIZE (GET_MODE (operands[1]))
6427 - INTVAL (operands[2]) - INTVAL (operands[3]);
6429 ofs = INTVAL (operands[3]);
6433 alpha_expand_unaligned_load (operands[0], operands[1],
6434 INTVAL (operands[2]) / 8,
6439 (define_expand "extzv"
6440 [(set (match_operand:DI 0 "register_operand" "")
6441 (zero_extract:DI (match_operand:DI 1 "nonimmediate_operand" "")
6442 (match_operand:DI 2 "immediate_operand" "")
6443 (match_operand:DI 3 "immediate_operand" "")))]
6446 /* We can do 8, 16, 32 and 64 bit fields, if aligned on byte boundaries. */
6447 if (INTVAL (operands[3]) % 8 != 0
6448 || (INTVAL (operands[2]) != 8
6449 && INTVAL (operands[2]) != 16
6450 && INTVAL (operands[2]) != 32
6451 && INTVAL (operands[2]) != 64))
6454 if (GET_CODE (operands[1]) == MEM)
6458 /* Fail 8 bit fields, falling back on a simple byte load. */
6459 if (INTVAL (operands[2]) == 8)
6462 /* The bit number is relative to the mode of operand 1 which is
6463 usually QImode (this might actually be a bug in expmed.c). Note
6464 that the bit number is negative in big-endian mode in this case.
6465 We have to convert that to the offset. */
6466 if (WORDS_BIG_ENDIAN)
6467 ofs = GET_MODE_BITSIZE (GET_MODE (operands[1]))
6468 - INTVAL (operands[2]) - INTVAL (operands[3]);
6470 ofs = INTVAL (operands[3]);
6474 alpha_expand_unaligned_load (operands[0], operands[1],
6475 INTVAL (operands[2]) / 8,
6481 (define_expand "insv"
6482 [(set (zero_extract:DI (match_operand:QI 0 "memory_operand" "")
6483 (match_operand:DI 1 "immediate_operand" "")
6484 (match_operand:DI 2 "immediate_operand" ""))
6485 (match_operand:DI 3 "register_operand" ""))]
6490 /* We can do 16, 32 and 64 bit fields, if aligned on byte boundaries. */
6491 if (INTVAL (operands[2]) % 8 != 0
6492 || (INTVAL (operands[1]) != 16
6493 && INTVAL (operands[1]) != 32
6494 && INTVAL (operands[1]) != 64))
6497 /* From mips.md: store_bit_field doesn't verify that our source
6498 matches the predicate, so we force it to be a MEM here. */
6499 if (GET_CODE (operands[0]) != MEM)
6502 /* The bit number is relative to the mode of operand 1 which is
6503 usually QImode (this might actually be a bug in expmed.c). Note
6504 that the bit number is negative in big-endian mode in this case.
6505 We have to convert that to the offset. */
6506 if (WORDS_BIG_ENDIAN)
6507 ofs = GET_MODE_BITSIZE (GET_MODE (operands[0]))
6508 - INTVAL (operands[1]) - INTVAL (operands[2]);
6510 ofs = INTVAL (operands[2]);
6514 alpha_expand_unaligned_store (operands[0], operands[3],
6515 INTVAL (operands[1]) / 8, ofs);
6519 ;; Block move/clear, see alpha.c for more details.
6520 ;; Argument 0 is the destination
6521 ;; Argument 1 is the source
6522 ;; Argument 2 is the length
6523 ;; Argument 3 is the alignment
6525 (define_expand "movstrqi"
6526 [(parallel [(set (match_operand:BLK 0 "memory_operand" "")
6527 (match_operand:BLK 1 "memory_operand" ""))
6528 (use (match_operand:DI 2 "immediate_operand" ""))
6529 (use (match_operand:DI 3 "immediate_operand" ""))])]
6532 if (alpha_expand_block_move (operands))
6538 (define_expand "movstrdi"
6539 [(parallel [(set (match_operand:BLK 0 "memory_operand" "")
6540 (match_operand:BLK 1 "memory_operand" ""))
6541 (use (match_operand:DI 2 "immediate_operand" ""))
6542 (use (match_operand:DI 3 "immediate_operand" ""))
6544 (clobber (reg:DI 25))
6545 (clobber (reg:DI 16))
6546 (clobber (reg:DI 17))
6547 (clobber (reg:DI 18))
6548 (clobber (reg:DI 19))
6549 (clobber (reg:DI 20))
6550 (clobber (reg:DI 26))
6551 (clobber (reg:DI 27))])]
6552 "TARGET_ABI_OPEN_VMS"
6554 operands[4] = gen_rtx_SYMBOL_REF (Pmode, "OTS$MOVE");
6555 alpha_need_linkage (XSTR (operands[4], 0), 0);
6558 (define_insn "*movstrdi_1"
6559 [(set (match_operand:BLK 0 "memory_operand" "=m,=m")
6560 (match_operand:BLK 1 "memory_operand" "m,m"))
6561 (use (match_operand:DI 2 "nonmemory_operand" "r,i"))
6562 (use (match_operand:DI 3 "immediate_operand" ""))
6563 (use (match_operand:DI 4 "call_operand" "i,i"))
6564 (clobber (reg:DI 25))
6565 (clobber (reg:DI 16))
6566 (clobber (reg:DI 17))
6567 (clobber (reg:DI 18))
6568 (clobber (reg:DI 19))
6569 (clobber (reg:DI 20))
6570 (clobber (reg:DI 26))
6571 (clobber (reg:DI 27))]
6572 "TARGET_ABI_OPEN_VMS"
6574 operands [5] = alpha_use_linkage (operands [4], cfun->decl, 0, 1);
6575 switch (which_alternative)
6578 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)";
6580 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)";
6585 [(set_attr "type" "multi")
6586 (set_attr "length" "28")])
6588 (define_expand "clrstrqi"
6589 [(parallel [(set (match_operand:BLK 0 "memory_operand" "")
6591 (use (match_operand:DI 1 "immediate_operand" ""))
6592 (use (match_operand:DI 2 "immediate_operand" ""))])]
6595 if (alpha_expand_block_clear (operands))
6601 (define_expand "clrstrdi"
6602 [(parallel [(set (match_operand:BLK 0 "memory_operand" "")
6604 (use (match_operand:DI 1 "immediate_operand" ""))
6605 (use (match_operand:DI 2 "immediate_operand" ""))
6607 (clobber (reg:DI 25))
6608 (clobber (reg:DI 16))
6609 (clobber (reg:DI 17))
6610 (clobber (reg:DI 26))
6611 (clobber (reg:DI 27))])]
6612 "TARGET_ABI_OPEN_VMS"
6614 operands[3] = gen_rtx_SYMBOL_REF (Pmode, "OTS$ZERO");
6615 alpha_need_linkage (XSTR (operands[3], 0), 0);
6618 (define_insn "*clrstrdi_1"
6619 [(set (match_operand:BLK 0 "memory_operand" "=m,=m")
6621 (use (match_operand:DI 1 "nonmemory_operand" "r,i"))
6622 (use (match_operand:DI 2 "immediate_operand" ""))
6623 (use (match_operand:DI 3 "call_operand" "i,i"))
6624 (clobber (reg:DI 25))
6625 (clobber (reg:DI 16))
6626 (clobber (reg:DI 17))
6627 (clobber (reg:DI 26))
6628 (clobber (reg:DI 27))]
6629 "TARGET_ABI_OPEN_VMS"
6631 operands [4] = alpha_use_linkage (operands [3], cfun->decl, 0, 1);
6632 switch (which_alternative)
6635 return "lda $16,%0\;bis $31,%1,$17\;ldq $26,%4\;lda $25,2($31)\;jsr $26,%3\;ldq $27,0($29)";
6637 return "lda $16,%0\;lda $17,%1($31)\;ldq $26,%4\;lda $25,2($31)\;jsr $26,%3\;ldq $27,0($29)";
6642 [(set_attr "type" "multi")
6643 (set_attr "length" "24")])
6646 ;; Subroutine of stack space allocation. Perform a stack probe.
6647 (define_expand "probe_stack"
6648 [(set (match_dup 1) (match_operand:DI 0 "const_int_operand" ""))]
6651 operands[1] = gen_rtx_MEM (DImode, plus_constant (stack_pointer_rtx,
6652 INTVAL (operands[0])));
6653 MEM_VOLATILE_P (operands[1]) = 1;
6655 operands[0] = const0_rtx;
6658 ;; This is how we allocate stack space. If we are allocating a
6659 ;; constant amount of space and we know it is less than 4096
6660 ;; bytes, we need do nothing.
6662 ;; If it is more than 4096 bytes, we need to probe the stack
6664 (define_expand "allocate_stack"
6666 (plus:DI (reg:DI 30)
6667 (match_operand:DI 1 "reg_or_cint_operand" "")))
6668 (set (match_operand:DI 0 "register_operand" "=r")
6672 if (GET_CODE (operands[1]) == CONST_INT
6673 && INTVAL (operands[1]) < 32768)
6675 if (INTVAL (operands[1]) >= 4096)
6677 /* We do this the same way as in the prologue and generate explicit
6678 probes. Then we update the stack by the constant. */
6682 emit_insn (gen_probe_stack (GEN_INT (- probed)));
6683 while (probed + 8192 < INTVAL (operands[1]))
6684 emit_insn (gen_probe_stack (GEN_INT (- (probed += 8192))));
6686 if (probed + 4096 < INTVAL (operands[1]))
6687 emit_insn (gen_probe_stack (GEN_INT (- INTVAL(operands[1]))));
6690 operands[1] = GEN_INT (- INTVAL (operands[1]));
6691 operands[2] = virtual_stack_dynamic_rtx;
6696 rtx loop_label = gen_label_rtx ();
6697 rtx want = gen_reg_rtx (Pmode);
6698 rtx tmp = gen_reg_rtx (Pmode);
6701 emit_insn (gen_subdi3 (want, stack_pointer_rtx,
6702 force_reg (Pmode, operands[1])));
6703 emit_insn (gen_adddi3 (tmp, stack_pointer_rtx, GEN_INT (-4096)));
6705 if (GET_CODE (operands[1]) != CONST_INT)
6707 out_label = gen_label_rtx ();
6708 emit_insn (gen_cmpdi (want, tmp));
6709 emit_jump_insn (gen_bgeu (out_label));
6712 emit_label (loop_label);
6713 memref = gen_rtx_MEM (DImode, tmp);
6714 MEM_VOLATILE_P (memref) = 1;
6715 emit_move_insn (memref, const0_rtx);
6716 emit_insn (gen_adddi3 (tmp, tmp, GEN_INT(-8192)));
6717 emit_insn (gen_cmpdi (tmp, want));
6718 emit_jump_insn (gen_bgtu (loop_label));
6720 memref = gen_rtx_MEM (DImode, want);
6721 MEM_VOLATILE_P (memref) = 1;
6722 emit_move_insn (memref, const0_rtx);
6725 emit_label (out_label);
6727 emit_move_insn (stack_pointer_rtx, want);
6728 emit_move_insn (operands[0], virtual_stack_dynamic_rtx);
6733 ;; This is used by alpha_expand_prolog to do the same thing as above,
6734 ;; except we cannot at that time generate new basic blocks, so we hide
6735 ;; the loop in this one insn.
6737 (define_insn "prologue_stack_probe_loop"
6738 [(unspec_volatile [(match_operand:DI 0 "register_operand" "r")
6739 (match_operand:DI 1 "register_operand" "r")]
6743 operands[2] = gen_label_rtx ();
6744 (*targetm.asm_out.internal_label) (asm_out_file, "L",
6745 CODE_LABEL_NUMBER (operands[2]));
6747 return "stq $31,-8192(%1)\;subq %0,1,%0\;lda %1,-8192(%1)\;bne %0,%l2";
6749 [(set_attr "length" "16")
6750 (set_attr "type" "multi")])
6752 (define_expand "prologue"
6753 [(clobber (const_int 0))]
6756 alpha_expand_prologue ();
6760 ;; These take care of emitting the ldgp insn in the prologue. This will be
6761 ;; an lda/ldah pair and we want to align them properly. So we have two
6762 ;; unspec_volatile insns, the first of which emits the ldgp assembler macro
6763 ;; and the second of which emits nothing. However, both are marked as type
6764 ;; IADD (the default) so the alignment code in alpha.c does the right thing
6767 (define_expand "prologue_ldgp"
6769 (unspec_volatile:DI [(match_dup 1) (match_dup 2)] UNSPECV_LDGP1))
6771 (unspec_volatile:DI [(match_dup 0) (match_dup 2)] UNSPECV_PLDGP2))]
6774 operands[0] = pic_offset_table_rtx;
6775 operands[1] = gen_rtx_REG (Pmode, 27);
6776 operands[2] = (TARGET_EXPLICIT_RELOCS
6777 ? GEN_INT (alpha_next_sequence_number++)
6781 (define_insn "*ldgp_er_1"
6782 [(set (match_operand:DI 0 "register_operand" "=r")
6783 (unspec_volatile:DI [(match_operand:DI 1 "register_operand" "r")
6784 (match_operand 2 "const_int_operand" "")]
6786 "TARGET_EXPLICIT_RELOCS && TARGET_ABI_OSF"
6787 "ldah %0,0(%1)\t\t!gpdisp!%2"
6788 [(set_attr "cannot_copy" "true")])
6790 (define_insn "*ldgp_er_2"
6791 [(set (match_operand:DI 0 "register_operand" "=r")
6792 (unspec:DI [(match_operand:DI 1 "register_operand" "r")
6793 (match_operand 2 "const_int_operand" "")]
6795 "TARGET_EXPLICIT_RELOCS && TARGET_ABI_OSF"
6796 "lda %0,0(%1)\t\t!gpdisp!%2"
6797 [(set_attr "cannot_copy" "true")])
6799 (define_insn "*prologue_ldgp_er_2"
6800 [(set (match_operand:DI 0 "register_operand" "=r")
6801 (unspec_volatile:DI [(match_operand:DI 1 "register_operand" "r")
6802 (match_operand 2 "const_int_operand" "")]
6804 "TARGET_EXPLICIT_RELOCS && TARGET_ABI_OSF"
6805 "lda %0,0(%1)\t\t!gpdisp!%2\n$%~..ng:"
6806 [(set_attr "cannot_copy" "true")])
6808 (define_insn "*prologue_ldgp_1"
6809 [(set (match_operand:DI 0 "register_operand" "=r")
6810 (unspec_volatile:DI [(match_operand:DI 1 "register_operand" "r")
6811 (match_operand 2 "const_int_operand" "")]
6814 "ldgp %0,0(%1)\n$%~..ng:"
6815 [(set_attr "cannot_copy" "true")])
6817 (define_insn "*prologue_ldgp_2"
6818 [(set (match_operand:DI 0 "register_operand" "=r")
6819 (unspec_volatile:DI [(match_operand:DI 1 "register_operand" "r")
6820 (match_operand 2 "const_int_operand" "")]
6825 ;; The _mcount profiling hook has special calling conventions, and
6826 ;; does not clobber all the registers that a normal call would. So
6827 ;; hide the fact this is a call at all.
6829 (define_insn "prologue_mcount"
6830 [(unspec_volatile [(const_int 0)] UNSPECV_MCOUNT)]
6833 if (TARGET_EXPLICIT_RELOCS)
6834 /* Note that we cannot use a lituse_jsr reloc, since _mcount
6835 cannot be called via the PLT. */
6836 return "ldq $28,_mcount($29)\t\t!literal\;jsr $28,($28),_mcount";
6838 return "lda $28,_mcount\;jsr $28,($28),_mcount";
6840 [(set_attr "type" "multi")
6841 (set_attr "length" "8")])
6843 (define_insn "init_fp"
6844 [(set (match_operand:DI 0 "register_operand" "=r")
6845 (match_operand:DI 1 "register_operand" "r"))
6846 (clobber (mem:BLK (match_operand:DI 2 "register_operand" "=r")))]
6850 (define_expand "epilogue"
6854 alpha_expand_epilogue ();
6857 (define_expand "sibcall_epilogue"
6861 alpha_expand_epilogue ();
6865 (define_expand "builtin_longjmp"
6866 [(use (match_operand:DI 0 "register_operand" "r"))]
6869 /* The elements of the buffer are, in order: */
6870 rtx fp = gen_rtx_MEM (Pmode, operands[0]);
6871 rtx lab = gen_rtx_MEM (Pmode, plus_constant (operands[0], 8));
6872 rtx stack = gen_rtx_MEM (Pmode, plus_constant (operands[0], 16));
6873 rtx pv = gen_rtx_REG (Pmode, 27);
6875 /* This bit is the same as expand_builtin_longjmp. */
6876 emit_move_insn (hard_frame_pointer_rtx, fp);
6877 emit_move_insn (pv, lab);
6878 emit_stack_restore (SAVE_NONLOCAL, stack, NULL_RTX);
6879 emit_insn (gen_rtx_USE (VOIDmode, hard_frame_pointer_rtx));
6880 emit_insn (gen_rtx_USE (VOIDmode, stack_pointer_rtx));
6882 /* Load the label we are jumping through into $27 so that we know
6883 where to look for it when we get back to setjmp's function for
6884 restoring the gp. */
6885 emit_jump_insn (gen_builtin_longjmp_internal (pv));
6890 ;; This is effectively a copy of indirect_jump, but constrained such
6891 ;; that register renaming cannot foil our cunning plan with $27.
6892 (define_insn "builtin_longjmp_internal"
6894 (unspec_volatile [(match_operand:DI 0 "register_operand" "c")]
6898 [(set_attr "type" "ibr")])
6900 (define_insn "*builtin_setjmp_receiver_er_sl_1"
6901 [(unspec_volatile [(label_ref (match_operand 0 "" ""))] UNSPECV_SETJMPR)]
6902 "TARGET_EXPLICIT_RELOCS && TARGET_ABI_OSF && TARGET_AS_CAN_SUBTRACT_LABELS"
6903 "lda $27,$LSJ%=-%l0($27)\n$LSJ%=:")
6905 (define_insn "*builtin_setjmp_receiver_er_1"
6906 [(unspec_volatile [(label_ref (match_operand 0 "" ""))] UNSPECV_SETJMPR)]
6907 "TARGET_EXPLICIT_RELOCS && TARGET_ABI_OSF"
6908 "br $27,$LSJ%=\n$LSJ%=:"
6909 [(set_attr "type" "ibr")])
6912 [(unspec_volatile [(label_ref (match_operand 0 "" ""))] UNSPECV_SETJMPR)]
6913 "TARGET_EXPLICIT_RELOCS && TARGET_ABI_OSF
6914 && prev_nonnote_insn (insn) == operands[0]"
6918 emit_note (NOTE_INSN_DELETED);
6922 (define_insn "*builtin_setjmp_receiver_1"
6923 [(unspec_volatile [(label_ref (match_operand 0 "" ""))] UNSPECV_SETJMPR)]
6925 "br $27,$LSJ%=\n$LSJ%=:\;ldgp $29,0($27)"
6926 [(set_attr "length" "12")
6927 (set_attr "type" "multi")])
6929 (define_expand "builtin_setjmp_receiver_er"
6930 [(unspec_volatile [(label_ref (match_operand 0 "" ""))] UNSPECV_SETJMPR)
6932 (unspec_volatile:DI [(match_dup 2) (match_dup 3)] UNSPECV_LDGP1))
6934 (unspec:DI [(match_dup 1) (match_dup 3)] UNSPEC_LDGP2))]
6937 operands[1] = pic_offset_table_rtx;
6938 operands[2] = gen_rtx_REG (Pmode, 27);
6939 operands[3] = GEN_INT (alpha_next_sequence_number++);
6942 (define_expand "builtin_setjmp_receiver"
6943 [(unspec_volatile [(label_ref (match_operand 0 "" ""))] UNSPECV_SETJMPR)]
6946 if (TARGET_EXPLICIT_RELOCS)
6948 emit_insn (gen_builtin_setjmp_receiver_er (operands[0]));
6953 (define_expand "exception_receiver_er"
6955 (unspec_volatile:DI [(match_dup 1) (match_dup 2)] UNSPECV_LDGP1))
6957 (unspec:DI [(match_dup 0) (match_dup 2)] UNSPEC_LDGP2))]
6960 operands[0] = pic_offset_table_rtx;
6961 operands[1] = gen_rtx_REG (Pmode, 26);
6962 operands[2] = GEN_INT (alpha_next_sequence_number++);
6965 (define_expand "exception_receiver"
6966 [(unspec_volatile [(match_dup 0)] UNSPECV_EHR)]
6969 if (TARGET_LD_BUGGY_LDGP)
6970 operands[0] = alpha_gp_save_rtx ();
6971 else if (TARGET_EXPLICIT_RELOCS)
6973 emit_insn (gen_exception_receiver_er ());
6977 operands[0] = const0_rtx;
6980 (define_insn "*exception_receiver_1"
6981 [(unspec_volatile [(const_int 0)] UNSPECV_EHR)]
6982 "! TARGET_LD_BUGGY_LDGP"
6984 [(set_attr "length" "8")
6985 (set_attr "type" "multi")])
6987 (define_insn "*exception_receiver_2"
6988 [(unspec_volatile [(match_operand:DI 0 "memory_operand" "m")] UNSPECV_EHR)]
6989 "TARGET_LD_BUGGY_LDGP"
6991 [(set_attr "type" "ild")])
6993 (define_expand "nonlocal_goto_receiver"
6994 [(unspec_volatile [(const_int 0)] UNSPECV_BLOCKAGE)
6995 (set (reg:DI 27) (mem:DI (reg:DI 29)))
6996 (unspec_volatile [(const_int 0)] UNSPECV_BLOCKAGE)
6998 "TARGET_ABI_OPEN_VMS"
7001 (define_insn "arg_home"
7002 [(unspec [(const_int 0)] UNSPEC_ARG_HOME)
7017 (clobber (mem:BLK (const_int 0)))
7018 (clobber (reg:DI 24))
7019 (clobber (reg:DI 25))
7020 (clobber (reg:DI 0))]
7021 "TARGET_ABI_OPEN_VMS"
7022 "lda $0,OTS$HOME_ARGS\;ldq $0,8($0)\;jsr $0,OTS$HOME_ARGS"
7023 [(set_attr "length" "16")
7024 (set_attr "type" "multi")])
7026 ;; Load the CIW into r2 for calling __T3E_MISMATCH
7028 (define_expand "umk_mismatch_args"
7029 [(set:DI (match_dup 1) (mem:DI (plus:DI (reg:DI 15) (const_int -16))))
7030 (set:DI (match_dup 2) (mem:DI (plus:DI (match_dup 1) (const_int -32))))
7031 (set:DI (reg:DI 1) (match_operand:DI 0 "const_int_operand" ""))
7032 (set:DI (match_dup 3) (plus:DI (mult:DI (reg:DI 25)
7035 (set:DI (reg:DI 2) (mem:DI (match_dup 3)))]
7036 "TARGET_ABI_UNICOSMK"
7038 operands[1] = gen_reg_rtx (DImode);
7039 operands[2] = gen_reg_rtx (DImode);
7040 operands[3] = gen_reg_rtx (DImode);
7043 (define_insn "arg_home_umk"
7044 [(unspec [(const_int 0)] UNSPEC_ARG_HOME)
7059 (clobber (mem:BLK (const_int 0)))
7061 (clobber (reg:DI 22))
7062 (clobber (reg:DI 23))
7063 (clobber (reg:DI 24))
7064 (clobber (reg:DI 0))
7065 (clobber (reg:DI 1))
7066 (clobber (reg:DI 2))
7067 (clobber (reg:DI 3))
7068 (clobber (reg:DI 4))
7069 (clobber (reg:DI 5))
7070 (clobber (reg:DI 6))
7071 (clobber (reg:DI 7))
7072 (clobber (reg:DI 8))])]
7073 "TARGET_ABI_UNICOSMK"
7074 "laum $4,__T3E_MISMATCH($31)\;sll $4,32,$4\;lalm $4,__T3E_MISMATCH($4)\;lal $4,__T3E_MISMATCH($4)\;jsr $3,($4)"
7075 [(set_attr "length" "16")
7076 (set_attr "type" "multi")])
7080 ;; On EV4, these instructions are nops -- no load occurs.
7082 ;; On EV5, these instructions act as a normal load, and thus can trap
7083 ;; if the address is invalid. The OS may (or may not) handle this in
7084 ;; the entMM fault handler and suppress the fault. If so, then this
7085 ;; has the effect of a read prefetch instruction.
7087 ;; On EV6, these become official prefetch instructions.
7089 (define_insn "prefetch"
7090 [(prefetch (match_operand:DI 0 "address_operand" "p")
7091 (match_operand:DI 1 "const_int_operand" "n")
7092 (match_operand:DI 2 "const_int_operand" "n"))]
7093 "TARGET_FIXUP_EV5_PREFETCH || TARGET_CPU_EV6"
7095 /* Interpret "no temporal locality" as this data should be evicted once
7096 it is used. The "evict next" alternatives load the data into the cache
7097 and leave the LRU eviction counter pointing to that block. */
7098 static const char * const alt[2][2] = {
7100 "ldq $31,%a0", /* read, evict next */
7101 "ldl $31,%a0", /* read, evict last */
7104 "ldt $f31,%a0", /* write, evict next */
7105 "lds $f31,%a0", /* write, evict last */
7109 bool write = INTVAL (operands[1]) != 0;
7110 bool lru = INTVAL (operands[2]) != 0;
7112 return alt[write][lru];
7114 [(set_attr "type" "ild")])
7116 ;; Close the trap shadow of preceding instructions. This is generated
7119 (define_insn "trapb"
7120 [(unspec_volatile [(const_int 0)] UNSPECV_TRAPB)]
7123 [(set_attr "type" "misc")])
7125 ;; No-op instructions used by machine-dependent reorg to preserve
7126 ;; alignment for instruction issue.
7127 ;; The Unicos/Mk assembler does not support these opcodes.
7133 [(set_attr "type" "ilog")])
7138 "cpys $f31,$f31,$f31"
7139 [(set_attr "type" "fcpys")])
7146 ;; On Unicos/Mk we use a macro for aligning code.
7148 (define_insn "realign"
7149 [(unspec_volatile [(match_operand 0 "immediate_operand" "i")]
7153 if (TARGET_ABI_UNICOSMK)
7154 return "gcc@code@align %0";
7156 return ".align %0 #realign";
7159 ;; Instructions to be emitted from __builtins.
7161 (define_insn "builtin_cmpbge"
7162 [(set (match_operand:DI 0 "register_operand" "=r")
7163 (unspec:DI [(match_operand:DI 1 "reg_or_0_operand" "rJ")
7164 (match_operand:DI 2 "reg_or_8bit_operand" "rI")]
7168 ;; The EV6 data sheets list this as ILOG. OTOH, EV6 doesn't
7169 ;; actually differentiate between ILOG and ICMP in the schedule.
7170 [(set_attr "type" "icmp")])
7172 (define_expand "builtin_extbl"
7173 [(match_operand:DI 0 "register_operand" "")
7174 (match_operand:DI 1 "reg_or_0_operand" "")
7175 (match_operand:DI 2 "reg_or_8bit_operand" "")]
7178 rtx (*gen) (rtx, rtx, rtx, rtx);
7179 if (WORDS_BIG_ENDIAN)
7183 emit_insn ((*gen) (operands[0], operands[1], GEN_INT (8), operands[2]));
7187 (define_expand "builtin_extwl"
7188 [(match_operand:DI 0 "register_operand" "")
7189 (match_operand:DI 1 "reg_or_0_operand" "")
7190 (match_operand:DI 2 "reg_or_8bit_operand" "")]
7193 rtx (*gen) (rtx, rtx, rtx, rtx);
7194 if (WORDS_BIG_ENDIAN)
7198 emit_insn ((*gen) (operands[0], operands[1], GEN_INT (16), operands[2]));
7202 (define_expand "builtin_extll"
7203 [(match_operand:DI 0 "register_operand" "")
7204 (match_operand:DI 1 "reg_or_0_operand" "")
7205 (match_operand:DI 2 "reg_or_8bit_operand" "")]
7208 rtx (*gen) (rtx, rtx, rtx, rtx);
7209 if (WORDS_BIG_ENDIAN)
7213 emit_insn ((*gen) (operands[0], operands[1], GEN_INT (32), operands[2]));
7217 (define_expand "builtin_extql"
7218 [(match_operand:DI 0 "register_operand" "")
7219 (match_operand:DI 1 "reg_or_0_operand" "")
7220 (match_operand:DI 2 "reg_or_8bit_operand" "")]
7223 rtx (*gen) (rtx, rtx, rtx, rtx);
7224 if (WORDS_BIG_ENDIAN)
7228 emit_insn ((*gen) (operands[0], operands[1], GEN_INT (64), operands[2]));
7232 (define_expand "builtin_extwh"
7233 [(match_operand:DI 0 "register_operand" "")
7234 (match_operand:DI 1 "reg_or_0_operand" "")
7235 (match_operand:DI 2 "reg_or_8bit_operand" "")]
7238 rtx (*gen) (rtx, rtx, rtx);
7239 if (WORDS_BIG_ENDIAN)
7243 emit_insn ((*gen) (operands[0], operands[1], operands[2]));
7247 (define_expand "builtin_extlh"
7248 [(match_operand:DI 0 "register_operand" "")
7249 (match_operand:DI 1 "reg_or_0_operand" "")
7250 (match_operand:DI 2 "reg_or_8bit_operand" "")]
7253 rtx (*gen) (rtx, rtx, rtx);
7254 if (WORDS_BIG_ENDIAN)
7258 emit_insn ((*gen) (operands[0], operands[1], operands[2]));
7262 (define_expand "builtin_extqh"
7263 [(match_operand:DI 0 "register_operand" "")
7264 (match_operand:DI 1 "reg_or_0_operand" "")
7265 (match_operand:DI 2 "reg_or_8bit_operand" "")]
7268 rtx (*gen) (rtx, rtx, rtx);
7269 if (WORDS_BIG_ENDIAN)
7273 emit_insn ((*gen) (operands[0], operands[1], operands[2]));
7277 (define_expand "builtin_insbl"
7278 [(match_operand:DI 0 "register_operand" "")
7279 (match_operand:DI 1 "reg_or_0_operand" "")
7280 (match_operand:DI 2 "reg_or_8bit_operand" "")]
7283 rtx (*gen) (rtx, rtx, rtx);
7284 if (WORDS_BIG_ENDIAN)
7288 operands[1] = gen_lowpart (QImode, operands[1]);
7289 emit_insn ((*gen) (operands[0], operands[1], operands[2]));
7293 (define_expand "builtin_inswl"
7294 [(match_operand:DI 0 "register_operand" "")
7295 (match_operand:DI 1 "reg_or_0_operand" "")
7296 (match_operand:DI 2 "reg_or_8bit_operand" "")]
7299 rtx (*gen) (rtx, rtx, rtx);
7300 if (WORDS_BIG_ENDIAN)
7304 operands[1] = gen_lowpart (HImode, operands[1]);
7305 emit_insn ((*gen) (operands[0], operands[1], operands[2]));
7309 (define_expand "builtin_insll"
7310 [(match_operand:DI 0 "register_operand" "")
7311 (match_operand:DI 1 "reg_or_0_operand" "")
7312 (match_operand:DI 2 "reg_or_8bit_operand" "")]
7315 rtx (*gen) (rtx, rtx, rtx);
7316 if (WORDS_BIG_ENDIAN)
7320 operands[1] = gen_lowpart (SImode, operands[1]);
7321 emit_insn ((*gen) (operands[0], operands[1], operands[2]));
7322 emit_insn ((*gen) (operands[0], operands[1], operands[2]));
7326 (define_expand "builtin_insql"
7327 [(match_operand:DI 0 "register_operand" "")
7328 (match_operand:DI 1 "reg_or_0_operand" "")
7329 (match_operand:DI 2 "reg_or_8bit_operand" "")]
7332 rtx (*gen) (rtx, rtx, rtx);
7333 if (WORDS_BIG_ENDIAN)
7337 emit_insn ((*gen) (operands[0], operands[1], operands[2]));
7341 (define_expand "builtin_inswh"
7342 [(match_operand:DI 0 "register_operand" "")
7343 (match_operand:DI 1 "register_operand" "")
7344 (match_operand:DI 2 "reg_or_8bit_operand" "")]
7347 emit_insn (gen_insxh (operands[0], operands[1], GEN_INT (16), operands[2]));
7351 (define_expand "builtin_inslh"
7352 [(match_operand:DI 0 "register_operand" "")
7353 (match_operand:DI 1 "register_operand" "")
7354 (match_operand:DI 2 "reg_or_8bit_operand" "")]
7357 emit_insn (gen_insxh (operands[0], operands[1], GEN_INT (32), operands[2]));
7361 (define_expand "builtin_insqh"
7362 [(match_operand:DI 0 "register_operand" "")
7363 (match_operand:DI 1 "register_operand" "")
7364 (match_operand:DI 2 "reg_or_8bit_operand" "")]
7367 emit_insn (gen_insxh (operands[0], operands[1], GEN_INT (64), operands[2]));
7371 (define_expand "builtin_mskbl"
7372 [(match_operand:DI 0 "register_operand" "")
7373 (match_operand:DI 1 "reg_or_0_operand" "")
7374 (match_operand:DI 2 "reg_or_8bit_operand" "")]
7377 rtx (*gen) (rtx, rtx, rtx, rtx);
7379 if (WORDS_BIG_ENDIAN)
7383 mask = GEN_INT (0xff);
7384 emit_insn ((*gen) (operands[0], operands[1], mask, operands[2]));
7388 (define_expand "builtin_mskwl"
7389 [(match_operand:DI 0 "register_operand" "")
7390 (match_operand:DI 1 "reg_or_0_operand" "")
7391 (match_operand:DI 2 "reg_or_8bit_operand" "")]
7394 rtx (*gen) (rtx, rtx, rtx, rtx);
7396 if (WORDS_BIG_ENDIAN)
7400 mask = GEN_INT (0xffff);
7401 emit_insn ((*gen) (operands[0], operands[1], mask, operands[2]));
7405 (define_expand "builtin_mskll"
7406 [(match_operand:DI 0 "register_operand" "")
7407 (match_operand:DI 1 "reg_or_0_operand" "")
7408 (match_operand:DI 2 "reg_or_8bit_operand" "")]
7411 rtx (*gen) (rtx, rtx, rtx, rtx);
7413 if (WORDS_BIG_ENDIAN)
7417 mask = immed_double_const (0xffffffff, 0, DImode);
7418 emit_insn ((*gen) (operands[0], operands[1], mask, operands[2]));
7422 (define_expand "builtin_mskql"
7423 [(match_operand:DI 0 "register_operand" "")
7424 (match_operand:DI 1 "reg_or_0_operand" "")
7425 (match_operand:DI 2 "reg_or_8bit_operand" "")]
7428 rtx (*gen) (rtx, rtx, rtx, rtx);
7430 if (WORDS_BIG_ENDIAN)
7435 emit_insn ((*gen) (operands[0], operands[1], mask, operands[2]));
7439 (define_expand "builtin_mskwh"
7440 [(match_operand:DI 0 "register_operand" "")
7441 (match_operand:DI 1 "register_operand" "")
7442 (match_operand:DI 2 "reg_or_8bit_operand" "")]
7445 emit_insn (gen_mskxh (operands[0], operands[1], GEN_INT (16), operands[2]));
7449 (define_expand "builtin_msklh"
7450 [(match_operand:DI 0 "register_operand" "")
7451 (match_operand:DI 1 "register_operand" "")
7452 (match_operand:DI 2 "reg_or_8bit_operand" "")]
7455 emit_insn (gen_mskxh (operands[0], operands[1], GEN_INT (32), operands[2]));
7459 (define_expand "builtin_mskqh"
7460 [(match_operand:DI 0 "register_operand" "")
7461 (match_operand:DI 1 "register_operand" "")
7462 (match_operand:DI 2 "reg_or_8bit_operand" "")]
7465 emit_insn (gen_mskxh (operands[0], operands[1], GEN_INT (64), operands[2]));
7469 (define_expand "builtin_zap"
7470 [(set (match_operand:DI 0 "register_operand" "")
7472 [(match_operand:DI 2 "reg_or_const_int_operand" "")]
7474 (match_operand:DI 1 "reg_or_const_int_operand" "")))]
7477 if (GET_CODE (operands[2]) == CONST_INT)
7479 rtx mask = alpha_expand_zap_mask (INTVAL (operands[2]));
7481 if (mask == const0_rtx)
7483 emit_move_insn (operands[0], const0_rtx);
7486 if (mask == constm1_rtx)
7488 emit_move_insn (operands[0], operands[1]);
7492 operands[1] = force_reg (DImode, operands[1]);
7493 emit_insn (gen_anddi3 (operands[0], operands[1], mask));
7497 operands[1] = force_reg (DImode, operands[1]);
7498 operands[2] = gen_lowpart (QImode, operands[2]);
7501 (define_insn "*builtin_zap_1"
7502 [(set (match_operand:DI 0 "register_operand" "=r,r,r,r")
7504 [(match_operand:QI 2 "reg_or_const_int_operand" "n,n,r,r")]
7506 (match_operand:DI 1 "reg_or_const_int_operand" "n,r,J,r")))]
7513 [(set_attr "type" "shift,shift,ilog,shift")])
7516 [(set (match_operand:DI 0 "register_operand" "")
7518 [(match_operand:QI 2 "const_int_operand" "")]
7520 (match_operand:DI 1 "const_int_operand" "")))]
7524 rtx mask = alpha_expand_zap_mask (INTVAL (operands[2]));
7525 if (HOST_BITS_PER_WIDE_INT >= 64 || GET_CODE (mask) == CONST_INT)
7526 operands[1] = gen_int_mode (INTVAL (operands[1]) & INTVAL (mask), DImode);
7529 HOST_WIDE_INT c_lo = INTVAL (operands[1]);
7530 HOST_WIDE_INT c_hi = (c_lo < 0 ? -1 : 0);
7531 operands[1] = immed_double_const (c_lo & CONST_DOUBLE_LOW (mask),
7532 c_hi & CONST_DOUBLE_HIGH (mask),
7535 emit_move_insn (operands[0], operands[1]);
7540 [(set (match_operand:DI 0 "register_operand" "")
7542 [(match_operand:QI 2 "const_int_operand" "")]
7544 (match_operand:DI 1 "register_operand" "")))]
7547 (and:DI (match_dup 1) (match_dup 2)))]
7549 operands[2] = alpha_expand_zap_mask (INTVAL (operands[2]));
7550 if (operands[2] == const0_rtx)
7552 emit_move_insn (operands[0], const0_rtx);
7555 if (operands[2] == constm1_rtx)
7557 emit_move_insn (operands[0], operands[1]);
7562 (define_expand "builtin_zapnot"
7563 [(set (match_operand:DI 0 "register_operand" "")
7565 [(not:QI (match_operand:DI 2 "reg_or_const_int_operand" ""))]
7567 (match_operand:DI 1 "reg_or_const_int_operand" "")))]
7570 if (GET_CODE (operands[2]) == CONST_INT)
7572 rtx mask = alpha_expand_zap_mask (~ INTVAL (operands[2]));
7574 if (mask == const0_rtx)
7576 emit_move_insn (operands[0], const0_rtx);
7579 if (mask == constm1_rtx)
7581 emit_move_insn (operands[0], operands[1]);
7585 operands[1] = force_reg (DImode, operands[1]);
7586 emit_insn (gen_anddi3 (operands[0], operands[1], mask));
7590 operands[1] = force_reg (DImode, operands[1]);
7591 operands[2] = gen_lowpart (QImode, operands[2]);
7594 (define_insn "*builtin_zapnot_1"
7595 [(set (match_operand:DI 0 "register_operand" "=r")
7597 [(not:QI (match_operand:QI 2 "register_operand" "r"))]
7599 (match_operand:DI 1 "reg_or_0_operand" "rJ")))]
7602 [(set_attr "type" "shift")])
7604 (define_insn "builtin_amask"
7605 [(set (match_operand:DI 0 "register_operand" "=r")
7606 (unspec:DI [(match_operand:DI 1 "reg_or_8bit_operand" "rI")]
7610 [(set_attr "type" "ilog")])
7612 (define_insn "builtin_implver"
7613 [(set (match_operand:DI 0 "register_operand" "=r")
7614 (unspec:DI [(const_int 0)] UNSPEC_IMPLVER))]
7617 [(set_attr "type" "ilog")])
7619 (define_insn "builtin_rpcc"
7620 [(set (match_operand:DI 0 "register_operand" "=r")
7621 (unspec_volatile:DI [(const_int 0)] UNSPECV_RPCC))]
7624 [(set_attr "type" "ilog")])
7626 (define_expand "builtin_minub8"
7627 [(match_operand:DI 0 "register_operand" "")
7628 (match_operand:DI 1 "reg_or_0_operand" "")
7629 (match_operand:DI 2 "reg_or_0_operand" "")]
7632 alpha_expand_builtin_vector_binop (gen_uminv8qi3, V8QImode, operands[0],
7633 operands[1], operands[2]);
7637 (define_expand "builtin_minsb8"
7638 [(match_operand:DI 0 "register_operand" "")
7639 (match_operand:DI 1 "reg_or_0_operand" "")
7640 (match_operand:DI 2 "reg_or_0_operand" "")]
7643 alpha_expand_builtin_vector_binop (gen_sminv8qi3, V8QImode, operands[0],
7644 operands[1], operands[2]);
7648 (define_expand "builtin_minuw4"
7649 [(match_operand:DI 0 "register_operand" "")
7650 (match_operand:DI 1 "reg_or_0_operand" "")
7651 (match_operand:DI 2 "reg_or_0_operand" "")]
7654 alpha_expand_builtin_vector_binop (gen_uminv4hi3, V4HImode, operands[0],
7655 operands[1], operands[2]);
7659 (define_expand "builtin_minsw4"
7660 [(match_operand:DI 0 "register_operand" "")
7661 (match_operand:DI 1 "reg_or_0_operand" "")
7662 (match_operand:DI 2 "reg_or_0_operand" "")]
7665 alpha_expand_builtin_vector_binop (gen_sminv4hi3, V4HImode, operands[0],
7666 operands[1], operands[2]);
7670 (define_expand "builtin_maxub8"
7671 [(match_operand:DI 0 "register_operand" "")
7672 (match_operand:DI 1 "reg_or_0_operand" "")
7673 (match_operand:DI 2 "reg_or_0_operand" "")]
7676 alpha_expand_builtin_vector_binop (gen_umaxv8qi3, V8QImode, operands[0],
7677 operands[1], operands[2]);
7681 (define_expand "builtin_maxsb8"
7682 [(match_operand:DI 0 "register_operand" "")
7683 (match_operand:DI 1 "reg_or_0_operand" "")
7684 (match_operand:DI 2 "reg_or_0_operand" "")]
7687 alpha_expand_builtin_vector_binop (gen_smaxv8qi3, V8QImode, operands[0],
7688 operands[1], operands[2]);
7692 (define_expand "builtin_maxuw4"
7693 [(match_operand:DI 0 "register_operand" "")
7694 (match_operand:DI 1 "reg_or_0_operand" "")
7695 (match_operand:DI 2 "reg_or_0_operand" "")]
7698 alpha_expand_builtin_vector_binop (gen_umaxv4hi3, V4HImode, operands[0],
7699 operands[1], operands[2]);
7703 (define_expand "builtin_maxsw4"
7704 [(match_operand:DI 0 "register_operand" "")
7705 (match_operand:DI 1 "reg_or_0_operand" "")
7706 (match_operand:DI 2 "reg_or_0_operand" "")]
7709 alpha_expand_builtin_vector_binop (gen_smaxv4hi3, V4HImode, operands[0],
7710 operands[1], operands[2]);
7714 (define_insn "builtin_perr"
7715 [(set (match_operand:DI 0 "register_operand" "=r")
7716 (unspec:DI [(match_operand:DI 1 "reg_or_0_operand" "%rJ")
7717 (match_operand:DI 2 "reg_or_8bit_operand" "rJ")]
7721 [(set_attr "type" "mvi")])
7723 (define_expand "builtin_pklb"
7724 [(set (match_operand:DI 0 "register_operand" "")
7727 (truncate:V2QI (match_operand:DI 1 "register_operand" ""))
7732 operands[0] = gen_lowpart (V8QImode, operands[0]);
7733 operands[1] = gen_lowpart (V2SImode, operands[1]);
7734 operands[2] = CONST0_RTX (V2QImode);
7735 operands[3] = CONST0_RTX (V4QImode);
7738 (define_insn "*pklb"
7739 [(set (match_operand:V8QI 0 "register_operand" "=r")
7742 (truncate:V2QI (match_operand:V2SI 1 "register_operand" "r"))
7743 (match_operand:V2QI 2 "const0_operand" ""))
7744 (match_operand:V4QI 3 "const0_operand" "")))]
7747 [(set_attr "type" "mvi")])
7749 (define_expand "builtin_pkwb"
7750 [(set (match_operand:DI 0 "register_operand" "")
7752 (truncate:V4QI (match_operand:DI 1 "register_operand" ""))
7756 operands[0] = gen_lowpart (V8QImode, operands[0]);
7757 operands[1] = gen_lowpart (V4HImode, operands[1]);
7758 operands[2] = CONST0_RTX (V4QImode);
7761 (define_insn "*pkwb"
7762 [(set (match_operand:V8QI 0 "register_operand" "=r")
7764 (truncate:V4QI (match_operand:V4HI 1 "register_operand" "r"))
7765 (match_operand:V4QI 2 "const0_operand" "")))]
7768 [(set_attr "type" "mvi")])
7770 (define_expand "builtin_unpkbl"
7771 [(set (match_operand:DI 0 "register_operand" "")
7773 (vec_select:V2QI (match_operand:DI 1 "register_operand" "")
7774 (parallel [(const_int 0) (const_int 1)]))))]
7777 operands[0] = gen_lowpart (V2SImode, operands[0]);
7778 operands[1] = gen_lowpart (V8QImode, operands[1]);
7781 (define_insn "*unpkbl"
7782 [(set (match_operand:V2SI 0 "register_operand" "=r")
7784 (vec_select:V2QI (match_operand:V8QI 1 "reg_or_0_operand" "rW")
7785 (parallel [(const_int 0) (const_int 1)]))))]
7788 [(set_attr "type" "mvi")])
7790 (define_expand "builtin_unpkbw"
7791 [(set (match_operand:DI 0 "register_operand" "")
7793 (vec_select:V4QI (match_operand:DI 1 "register_operand" "")
7794 (parallel [(const_int 0)
7800 operands[0] = gen_lowpart (V4HImode, operands[0]);
7801 operands[1] = gen_lowpart (V8QImode, operands[1]);
7804 (define_insn "*unpkbw"
7805 [(set (match_operand:V4HI 0 "register_operand" "=r")
7807 (vec_select:V4QI (match_operand:V8QI 1 "reg_or_0_operand" "rW")
7808 (parallel [(const_int 0)
7814 [(set_attr "type" "mvi")])
7816 (define_expand "builtin_cttz"
7817 [(set (match_operand:DI 0 "register_operand" "")
7818 (unspec:DI [(match_operand:DI 1 "register_operand" "")]
7823 (define_insn "builtin_ctlz"
7824 [(set (match_operand:DI 0 "register_operand" "=r")
7825 (unspec:DI [(match_operand:DI 1 "register_operand" "r")]
7829 [(set_attr "type" "mvi")])
7831 (define_insn "builtin_ctpop"
7832 [(set (match_operand:DI 0 "register_operand" "=r")
7833 (unspec:DI [(match_operand:DI 1 "register_operand" "r")]
7837 [(set_attr "type" "mvi")])
7839 ;; The call patterns are at the end of the file because their
7840 ;; wildcard operand0 interferes with nice recognition.
7842 (define_insn "*call_value_osf_1_er"
7843 [(set (match_operand 0 "" "")
7844 (call (mem:DI (match_operand:DI 1 "call_operand" "c,R,s"))
7845 (match_operand 2 "" "")))
7847 (clobber (reg:DI 26))]
7848 "TARGET_EXPLICIT_RELOCS && TARGET_ABI_OSF"
7850 jsr $26,(%1),0\;ldah $29,0($26)\t\t!gpdisp!%*\;lda $29,0($29)\t\t!gpdisp!%*
7851 bsr $26,%1\t\t!samegp
7852 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!%*"
7853 [(set_attr "type" "jsr")
7854 (set_attr "length" "12,*,16")])
7856 ;; We must use peep2 instead of a split because we need accurate life
7857 ;; information for $gp. Consider the case of { bar(); while (1); }.
7859 [(parallel [(set (match_operand 0 "" "")
7860 (call (mem:DI (match_operand:DI 1 "call_operand" ""))
7861 (match_operand 2 "" "")))
7863 (clobber (reg:DI 26))])]
7864 "TARGET_EXPLICIT_RELOCS && TARGET_ABI_OSF && reload_completed
7865 && ! samegp_function_operand (operands[1], Pmode)
7866 && (peep2_regno_dead_p (1, 29)
7867 || find_reg_note (insn, REG_NORETURN, NULL_RTX))"
7868 [(parallel [(set (match_dup 0)
7869 (call (mem:DI (match_dup 3))
7871 (set (reg:DI 26) (plus:DI (pc) (const_int 4)))
7872 (unspec_volatile [(reg:DI 29)] UNSPECV_BLOCKAGE)
7874 (use (match_dup 4))])]
7876 if (CONSTANT_P (operands[1]))
7878 operands[3] = gen_rtx_REG (Pmode, 27);
7879 operands[4] = GEN_INT (alpha_next_sequence_number++);
7880 emit_insn (gen_movdi_er_high_g (operands[3], pic_offset_table_rtx,
7881 operands[1], operands[4]));
7885 operands[3] = operands[1];
7886 operands[1] = const0_rtx;
7887 operands[4] = const0_rtx;
7892 [(parallel [(set (match_operand 0 "" "")
7893 (call (mem:DI (match_operand:DI 1 "call_operand" ""))
7894 (match_operand 2 "" "")))
7896 (clobber (reg:DI 26))])]
7897 "TARGET_EXPLICIT_RELOCS && TARGET_ABI_OSF && reload_completed
7898 && ! samegp_function_operand (operands[1], Pmode)
7899 && ! (peep2_regno_dead_p (1, 29)
7900 || find_reg_note (insn, REG_NORETURN, NULL_RTX))"
7901 [(parallel [(set (match_dup 0)
7902 (call (mem:DI (match_dup 3))
7904 (set (reg:DI 26) (plus:DI (pc) (const_int 4)))
7905 (unspec_volatile [(reg:DI 29)] UNSPECV_BLOCKAGE)
7907 (use (match_dup 5))])
7909 (unspec_volatile:DI [(reg:DI 26) (match_dup 4)] UNSPECV_LDGP1))
7911 (unspec:DI [(reg:DI 29) (match_dup 4)] UNSPEC_LDGP2))]
7913 if (CONSTANT_P (operands[1]))
7915 operands[3] = gen_rtx_REG (Pmode, 27);
7916 operands[5] = GEN_INT (alpha_next_sequence_number++);
7917 emit_insn (gen_movdi_er_high_g (operands[3], pic_offset_table_rtx,
7918 operands[1], operands[5]));
7922 operands[3] = operands[1];
7923 operands[1] = const0_rtx;
7924 operands[5] = const0_rtx;
7926 operands[4] = GEN_INT (alpha_next_sequence_number++);
7929 ;; We add a blockage unspec_volatile to prevent insns from moving down
7930 ;; from above the call to in between the call and the ldah gpdisp.
7931 (define_insn "*call_value_osf_2_er"
7932 [(set (match_operand 0 "" "")
7933 (call (mem:DI (match_operand:DI 1 "register_operand" "c"))
7934 (match_operand 2 "" "")))
7936 (plus:DI (pc) (const_int 4)))
7937 (unspec_volatile [(reg:DI 29)] UNSPECV_BLOCKAGE)
7938 (use (match_operand 3 "" ""))
7939 (use (match_operand 4 "" ""))]
7940 "TARGET_EXPLICIT_RELOCS && TARGET_ABI_OSF"
7941 "jsr $26,(%1),%3%J4"
7942 [(set_attr "type" "jsr")
7943 (set_attr "cannot_copy" "true")])
7945 (define_insn "*call_value_osf_1_noreturn"
7946 [(set (match_operand 0 "" "")
7947 (call (mem:DI (match_operand:DI 1 "call_operand" "c,R,s"))
7948 (match_operand 2 "" "")))
7950 (clobber (reg:DI 26))]
7951 "! TARGET_EXPLICIT_RELOCS && TARGET_ABI_OSF
7952 && find_reg_note (insn, REG_NORETURN, NULL_RTX)"
7957 [(set_attr "type" "jsr")
7958 (set_attr "length" "*,*,8")])
7960 (define_insn_and_split "call_value_osf_tlsgd"
7961 [(set (match_operand 0 "" "")
7962 (call (mem:DI (match_operand:DI 1 "symbolic_operand" ""))
7964 (unspec [(match_operand:DI 2 "const_int_operand" "")] UNSPEC_TLSGD_CALL)
7966 (clobber (reg:DI 26))]
7969 "&& reload_completed"
7971 (unspec:DI [(match_dup 5)
7973 (match_dup 2)] UNSPEC_LITERAL))
7974 (parallel [(set (match_dup 0)
7975 (call (mem:DI (match_dup 3))
7977 (set (reg:DI 26) (plus:DI (pc) (const_int 4)))
7978 (unspec_volatile [(match_dup 5)] UNSPECV_BLOCKAGE)
7980 (use (unspec [(match_dup 2)] UNSPEC_TLSGD_CALL))])
7982 (unspec_volatile:DI [(reg:DI 26) (match_dup 4)] UNSPECV_LDGP1))
7984 (unspec:DI [(match_dup 5) (match_dup 4)] UNSPEC_LDGP2))]
7986 operands[3] = gen_rtx_REG (Pmode, 27);
7987 operands[4] = GEN_INT (alpha_next_sequence_number++);
7988 operands[5] = pic_offset_table_rtx;
7990 [(set_attr "type" "multi")])
7992 (define_insn_and_split "call_value_osf_tlsldm"
7993 [(set (match_operand 0 "" "")
7994 (call (mem:DI (match_operand:DI 1 "symbolic_operand" ""))
7996 (unspec [(match_operand:DI 2 "const_int_operand" "")] UNSPEC_TLSLDM_CALL)
7998 (clobber (reg:DI 26))]
8001 "&& reload_completed"
8003 (unspec:DI [(match_dup 5)
8005 (match_dup 2)] UNSPEC_LITERAL))
8006 (parallel [(set (match_dup 0)
8007 (call (mem:DI (match_dup 3))
8009 (set (reg:DI 26) (plus:DI (pc) (const_int 4)))
8010 (unspec_volatile [(match_dup 5)] UNSPECV_BLOCKAGE)
8012 (use (unspec [(match_dup 2)] UNSPEC_TLSLDM_CALL))])
8014 (unspec_volatile:DI [(reg:DI 26) (match_dup 4)] UNSPECV_LDGP1))
8016 (unspec:DI [(reg:DI 29) (match_dup 4)] UNSPEC_LDGP2))]
8018 operands[3] = gen_rtx_REG (Pmode, 27);
8019 operands[4] = GEN_INT (alpha_next_sequence_number++);
8020 operands[5] = pic_offset_table_rtx;
8022 [(set_attr "type" "multi")])
8024 (define_insn "*call_value_osf_1"
8025 [(set (match_operand 0 "" "")
8026 (call (mem:DI (match_operand:DI 1 "call_operand" "c,R,s"))
8027 (match_operand 2 "" "")))
8029 (clobber (reg:DI 26))]
8030 "! TARGET_EXPLICIT_RELOCS && TARGET_ABI_OSF"
8032 jsr $26,($27),0\;ldgp $29,0($26)
8034 jsr $26,%1\;ldgp $29,0($26)"
8035 [(set_attr "type" "jsr")
8036 (set_attr "length" "12,*,16")])
8038 (define_insn "*sibcall_value_osf_1_er"
8039 [(set (match_operand 0 "" "")
8040 (call (mem:DI (match_operand:DI 1 "symbolic_operand" "R,s"))
8041 (match_operand 2 "" "")))
8042 (unspec [(reg:DI 29)] UNSPEC_SIBCALL)]
8043 "TARGET_EXPLICIT_RELOCS && TARGET_ABI_OSF"
8045 br $31,%1\t\t!samegp
8046 ldq $27,%1($29)\t\t!literal!%#\;jmp $31,($27),%1\t\t!lituse_jsr!%#"
8047 [(set_attr "type" "jsr")
8048 (set_attr "length" "*,8")])
8050 (define_insn "*sibcall_value_osf_1"
8051 [(set (match_operand 0 "" "")
8052 (call (mem:DI (match_operand:DI 1 "symbolic_operand" "R,s"))
8053 (match_operand 2 "" "")))
8054 (unspec [(reg:DI 29)] UNSPEC_SIBCALL)]
8055 "! TARGET_EXPLICIT_RELOCS && TARGET_ABI_OSF"
8058 lda $27,%1\;jmp $31,($27),%1"
8059 [(set_attr "type" "jsr")
8060 (set_attr "length" "*,8")])
8062 (define_insn "*call_value_nt_1"
8063 [(set (match_operand 0 "" "")
8064 (call (mem:DI (match_operand:DI 1 "call_operand" "r,R,s"))
8065 (match_operand 2 "" "")))
8066 (clobber (reg:DI 26))]
8067 "TARGET_ABI_WINDOWS_NT"
8072 [(set_attr "type" "jsr")
8073 (set_attr "length" "*,*,12")])
8075 ; GAS relies on the order and position of instructions output below in order
8076 ; to generate relocs for VMS link to potentially optimize the call.
8077 ; Please do not molest.
8078 (define_insn "*call_value_vms_1"
8079 [(set (match_operand 0 "" "")
8080 (call (mem:DI (match_operand:DI 1 "call_operand" "r,s"))
8081 (match_operand 2 "" "")))
8082 (use (match_operand:DI 3 "nonmemory_operand" "r,n"))
8085 (clobber (reg:DI 27))]
8086 "TARGET_ABI_OPEN_VMS"
8088 switch (which_alternative)
8091 return "mov %3,$27\;jsr $26,0\;ldq $27,0($29)";
8093 operands [3] = alpha_use_linkage (operands [1], cfun->decl, 1, 0);
8094 operands [4] = alpha_use_linkage (operands [1], cfun->decl, 0, 0);
8095 return "ldq $26,%4\;ldq $27,%3\;jsr $26,%1\;ldq $27,0($29)";
8100 [(set_attr "type" "jsr")
8101 (set_attr "length" "12,16")])
8103 (define_insn "*call_value_umk"
8104 [(set (match_operand 0 "" "")
8105 (call (mem:DI (match_operand:DI 1 "call_operand" "r"))
8106 (match_operand 2 "" "")))
8108 (clobber (reg:DI 26))]
8109 "TARGET_ABI_UNICOSMK"
8111 [(set_attr "type" "jsr")])