1 ;; Machine description for DEC Alpha for GNU C compiler
2 ;; Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
3 ;; 2000, 2001 Free Software Foundation, Inc.
4 ;; Contributed by Richard Kenner (kenner@vlsi1.ultra.nyu.edu)
6 ;; This file is part of GNU CC.
8 ;; GNU CC 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 ;; GNU CC 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 GNU CC; 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)
49 (UNSPECV_SETJMPR 2) ; builtin_setjmp_receiver
50 (UNSPECV_LONGJMP 3) ; builtin_longjmp
52 (UNSPECV_PSPL 5) ; prologue_stack_probe_loop
54 (UNSPECV_EHR 7) ; exception_receiver
58 (UNSPECV_PLDGP2 11) ; prologue ldgp
61 ;; Where necessary, the suffixes _le and _be are used to distinguish between
62 ;; little-endian and big-endian patterns.
64 ;; Note that the Unicos/Mk assembler does not support the following
65 ;; opcodes: mov, fmov, nop, fnop, unop.
67 ;; Processor type -- this attribute must exactly match the processor_type
68 ;; enumeration in alpha.h.
70 (define_attr "cpu" "ev4,ev5,ev6"
71 (const (symbol_ref "alpha_cpu")))
73 ;; Define an insn type attribute. This is used in function unit delay
74 ;; computations, among other purposes. For the most part, we use the names
75 ;; defined in the EV4 documentation, but add a few that we have to know about
79 "ild,fld,ldsym,ist,fst,ibr,fbr,jsr,iadd,ilog,shift,icmov,fcmov,icmp,imul,\
80 fadd,fmul,fcpys,fdiv,fsqrt,misc,mvi,ftoi,itof,multi"
81 (const_string "iadd"))
83 ;; Describe a user's asm statement.
84 (define_asm_attributes
85 [(set_attr "type" "multi")])
87 ;; Define the operand size an insn operates on. Used primarily by mul
88 ;; and div operations that have size dependent timings.
90 (define_attr "opsize" "si,di,udi"
93 ;; The TRAP attribute marks instructions that may generate traps
94 ;; (which are imprecise and may need a trapb if software completion
97 (define_attr "trap" "no,yes"
100 ;; The ROUND_SUFFIX attribute marks which instructions require a
101 ;; rounding-mode suffix. The value NONE indicates no suffix,
102 ;; the value NORMAL indicates a suffix controled by alpha_fprm.
104 (define_attr "round_suffix" "none,normal,c"
105 (const_string "none"))
107 ;; The TRAP_SUFFIX attribute marks instructions requiring a trap-mode suffix:
109 ;; SU accepts only /su (cmpt et al)
110 ;; SUI accepts only /sui (cvtqt and cvtqs)
111 ;; V_SV accepts /v and /sv (cvtql only)
112 ;; V_SV_SVI accepts /v, /sv and /svi (cvttq only)
113 ;; U_SU_SUI accepts /u, /su and /sui (most fp instructions)
115 ;; The actual suffix emitted is controled by alpha_fptm.
117 (define_attr "trap_suffix" "none,su,sui,v_sv,v_sv_svi,u_su_sui"
118 (const_string "none"))
120 ;; The length of an instruction sequence in bytes.
122 (define_attr "length" ""
125 ;; On EV4 there are two classes of resources to consider: resources needed
126 ;; to issue, and resources needed to execute. IBUS[01] are in the first
127 ;; category. ABOX, BBOX, EBOX, FBOX, IMUL & FDIV make up the second.
128 ;; (There are a few other register-like resources, but ...)
130 ; First, describe all of the issue constraints with single cycle delays.
131 ; All insns need a bus, but all except loads require one or the other.
132 (define_function_unit "ev4_ibus0" 1 0
133 (and (eq_attr "cpu" "ev4")
134 (eq_attr "type" "fst,fbr,iadd,imul,ilog,shift,icmov,icmp"))
137 (define_function_unit "ev4_ibus1" 1 0
138 (and (eq_attr "cpu" "ev4")
139 (eq_attr "type" "ist,ibr,jsr,fadd,fcmov,fcpys,fmul,fdiv,misc"))
142 ; Memory delivers its result in three cycles. Actually return one and
143 ; take care of this in adjust_cost, since we want to handle user-defined
145 (define_function_unit "ev4_abox" 1 0
146 (and (eq_attr "cpu" "ev4")
147 (eq_attr "type" "ild,fld,ldsym,ist,fst"))
150 ; Branches have no delay cost, but do tie up the unit for two cycles.
151 (define_function_unit "ev4_bbox" 1 1
152 (and (eq_attr "cpu" "ev4")
153 (eq_attr "type" "ibr,fbr,jsr"))
156 ; Arithmetic insns are normally have their results available after
157 ; two cycles. There are a number of exceptions. They are encoded in
158 ; ADJUST_COST. Some of the other insns have similar exceptions.
159 (define_function_unit "ev4_ebox" 1 0
160 (and (eq_attr "cpu" "ev4")
161 (eq_attr "type" "iadd,ilog,shift,icmov,icmp,misc"))
164 (define_function_unit "imul" 1 0
165 (and (eq_attr "cpu" "ev4")
166 (and (eq_attr "type" "imul")
167 (eq_attr "opsize" "si")))
170 (define_function_unit "imul" 1 0
171 (and (eq_attr "cpu" "ev4")
172 (and (eq_attr "type" "imul")
173 (eq_attr "opsize" "!si")))
176 (define_function_unit "ev4_fbox" 1 0
177 (and (eq_attr "cpu" "ev4")
178 (eq_attr "type" "fadd,fmul,fcpys,fcmov"))
181 (define_function_unit "fdiv" 1 0
182 (and (eq_attr "cpu" "ev4")
183 (and (eq_attr "type" "fdiv")
184 (eq_attr "opsize" "si")))
187 (define_function_unit "fdiv" 1 0
188 (and (eq_attr "cpu" "ev4")
189 (and (eq_attr "type" "fdiv")
190 (eq_attr "opsize" "di")))
193 ;; EV5 scheduling. EV5 can issue 4 insns per clock.
195 ;; EV5 has two asymetric integer units. Model this with E0 & E1 along
196 ;; with the combined resource EBOX.
198 (define_function_unit "ev5_ebox" 2 0
199 (and (eq_attr "cpu" "ev5")
200 (eq_attr "type" "!fbr,fcmov,fadd,fmul,fcpys,fdiv"))
203 ; Memory takes at least 2 clocks. Return one from here and fix up with
204 ; user-defined latencies in adjust_cost.
205 (define_function_unit "ev5_ebox" 2 0
206 (and (eq_attr "cpu" "ev5")
207 (eq_attr "type" "ild,fld,ldsym"))
210 ; Loads can dual issue with one another, but loads and stores do not mix.
211 (define_function_unit "ev5_e0" 1 0
212 (and (eq_attr "cpu" "ev5")
213 (eq_attr "type" "ild,fld,ldsym"))
215 [(eq_attr "type" "ist,fst")])
217 ; Stores, shifts, multiplies can only issue to E0
218 (define_function_unit "ev5_e0" 1 0
219 (and (eq_attr "cpu" "ev5")
220 (eq_attr "type" "ist,fst,shift,imul"))
223 ; Motion video insns also issue only to E0, and take two ticks.
224 (define_function_unit "ev5_e0" 1 0
225 (and (eq_attr "cpu" "ev5")
226 (eq_attr "type" "mvi"))
229 ; Conditional moves always take 2 ticks.
230 (define_function_unit "ev5_ebox" 2 0
231 (and (eq_attr "cpu" "ev5")
232 (eq_attr "type" "icmov"))
235 ; Branches can only issue to E1
236 (define_function_unit "ev5_e1" 1 0
237 (and (eq_attr "cpu" "ev5")
238 (eq_attr "type" "ibr,jsr"))
241 ; Multiplies also use the integer multiplier.
242 ; ??? How to: "No instruction can be issued to pipe E0 exactly two
243 ; cycles before an integer multiplication completes."
244 (define_function_unit "imul" 1 0
245 (and (eq_attr "cpu" "ev5")
246 (and (eq_attr "type" "imul")
247 (eq_attr "opsize" "si")))
250 (define_function_unit "imul" 1 0
251 (and (eq_attr "cpu" "ev5")
252 (and (eq_attr "type" "imul")
253 (eq_attr "opsize" "di")))
256 (define_function_unit "imul" 1 0
257 (and (eq_attr "cpu" "ev5")
258 (and (eq_attr "type" "imul")
259 (eq_attr "opsize" "udi")))
262 ;; Similarly for the FPU we have two asymetric units. But fcpys can issue
263 ;; on either so we have to play the game again.
265 (define_function_unit "ev5_fbox" 2 0
266 (and (eq_attr "cpu" "ev5")
267 (eq_attr "type" "fadd,fcmov,fmul,fcpys,fbr,fdiv"))
270 (define_function_unit "ev5_fm" 1 0
271 (and (eq_attr "cpu" "ev5")
272 (eq_attr "type" "fmul"))
275 ; Add and cmov as you would expect; fbr never produces a result;
276 ; fdiv issues through fa to the divider,
277 (define_function_unit "ev5_fa" 1 0
278 (and (eq_attr "cpu" "ev5")
279 (eq_attr "type" "fadd,fcmov,fbr,fdiv"))
282 ; ??? How to: "No instruction can be issued to pipe FA exactly five
283 ; cycles before a floating point divide completes."
284 (define_function_unit "fdiv" 1 0
285 (and (eq_attr "cpu" "ev5")
286 (and (eq_attr "type" "fdiv")
287 (eq_attr "opsize" "si")))
288 15 15) ; 15 to 31 data dependent
290 (define_function_unit "fdiv" 1 0
291 (and (eq_attr "cpu" "ev5")
292 (and (eq_attr "type" "fdiv")
293 (eq_attr "opsize" "di")))
294 22 22) ; 22 to 60 data dependent
296 ;; EV6 scheduling. EV6 can issue 4 insns per clock.
298 ;; EV6 has two symmetric pairs ("clusters") of two asymetric integer units
299 ;; ("upper" and "lower"), yielding pipe names U0, U1, L0, L1.
301 ;; Conditional moves decompose into two independent primitives, each
302 ;; taking one cycle. Since ev6 is out-of-order, we can't see anything
304 (define_function_unit "ev6_ebox" 4 0
305 (and (eq_attr "cpu" "ev6")
306 (eq_attr "type" "icmov"))
309 (define_function_unit "ev6_ebox" 4 0
310 (and (eq_attr "cpu" "ev6")
311 (eq_attr "type" "!fbr,fcmov,fadd,fmul,fcpys,fdiv,fsqrt"))
314 ;; Integer loads take at least 3 clocks, and only issue to lower units.
315 ;; Return one from here and fix up with user-defined latencies in adjust_cost.
316 (define_function_unit "ev6_l" 2 0
317 (and (eq_attr "cpu" "ev6")
318 (eq_attr "type" "ild,ldsym,ist,fst"))
321 ;; FP loads take at least 4 clocks. Return two from here...
322 (define_function_unit "ev6_l" 2 0
323 (and (eq_attr "cpu" "ev6")
324 (eq_attr "type" "fld"))
327 ;; Motion video insns also issue only to U0, and take three ticks.
328 (define_function_unit "ev6_u0" 1 0
329 (and (eq_attr "cpu" "ev6")
330 (eq_attr "type" "mvi"))
333 (define_function_unit "ev6_u" 2 0
334 (and (eq_attr "cpu" "ev6")
335 (eq_attr "type" "mvi"))
338 ;; Shifts issue to either upper pipe.
339 (define_function_unit "ev6_u" 2 0
340 (and (eq_attr "cpu" "ev6")
341 (eq_attr "type" "shift"))
344 ;; Multiplies issue only to U1, and all take 7 ticks.
345 ;; Rather than create a new function unit just for U1, reuse IMUL
346 (define_function_unit "imul" 1 0
347 (and (eq_attr "cpu" "ev6")
348 (eq_attr "type" "imul"))
351 (define_function_unit "ev6_u" 2 0
352 (and (eq_attr "cpu" "ev6")
353 (eq_attr "type" "imul"))
356 ;; Branches issue to either upper pipe
357 (define_function_unit "ev6_u" 2 0
358 (and (eq_attr "cpu" "ev6")
359 (eq_attr "type" "ibr"))
362 ;; Calls only issue to L0.
363 (define_function_unit "ev6_l0" 1 0
364 (and (eq_attr "cpu" "ev6")
365 (eq_attr "type" "jsr"))
368 (define_function_unit "ev6_l" 2 0
369 (and (eq_attr "cpu" "ev6")
370 (eq_attr "type" "jsr"))
373 ;; Ftoi/itof only issue to lower pipes
374 (define_function_unit "ev6_l" 2 0
375 (and (eq_attr "cpu" "ev6")
376 (eq_attr "type" "ftoi"))
379 (define_function_unit "ev6_l" 2 0
380 (and (eq_attr "cpu" "ev6")
381 (eq_attr "type" "itof"))
384 ;; For the FPU we are very similar to EV5, except there's no insn that
385 ;; can issue to fm & fa, so we get to leave that out.
387 (define_function_unit "ev6_fm" 1 0
388 (and (eq_attr "cpu" "ev6")
389 (eq_attr "type" "fmul"))
392 (define_function_unit "ev6_fa" 1 0
393 (and (eq_attr "cpu" "ev6")
394 (eq_attr "type" "fadd,fcpys,fbr,fdiv,fsqrt"))
397 (define_function_unit "ev6_fa" 1 0
398 (and (eq_attr "cpu" "ev6")
399 (eq_attr "type" "fcmov"))
402 (define_function_unit "fdiv" 1 0
403 (and (eq_attr "cpu" "ev6")
404 (and (eq_attr "type" "fdiv")
405 (eq_attr "opsize" "si")))
408 (define_function_unit "fdiv" 1 0
409 (and (eq_attr "cpu" "ev6")
410 (and (eq_attr "type" "fdiv")
411 (eq_attr "opsize" "di")))
414 (define_function_unit "fsqrt" 1 0
415 (and (eq_attr "cpu" "ev6")
416 (and (eq_attr "type" "fsqrt")
417 (eq_attr "opsize" "si")))
420 (define_function_unit "fsqrt" 1 0
421 (and (eq_attr "cpu" "ev6")
422 (and (eq_attr "type" "fsqrt")
423 (eq_attr "opsize" "di")))
426 ; ??? The FPU communicates with memory and the integer register file
427 ; via two fp store units. We need a slot in the fst immediately, and
428 ; a slot in LOW after the operand data is ready. At which point the
429 ; data may be moved either to the store queue or the integer register
430 ; file and the insn retired.
433 ;; First define the arithmetic insns. Note that the 32-bit forms also
436 ;; Handle 32-64 bit extension from memory to a floating point register
437 ;; specially, since this occurs frequently in int->double conversions.
439 ;; Note that while we must retain the =f case in the insn for reload's
440 ;; benefit, it should be eliminated after reload, so we should never emit
441 ;; code for that case. But we don't reject the possibility.
443 (define_expand "extendsidi2"
444 [(set (match_operand:DI 0 "register_operand" "")
445 (sign_extend:DI (match_operand:SI 1 "nonimmediate_operand" "")))]
449 (define_insn "*extendsidi2_nofix"
450 [(set (match_operand:DI 0 "register_operand" "=r,r,*f,?*f")
452 (match_operand:SI 1 "nonimmediate_operand" "r,m,*f,m")))]
458 lds %0,%1\;cvtlq %0,%0"
459 [(set_attr "type" "iadd,ild,fadd,fld")
460 (set_attr "length" "*,*,*,8")])
462 (define_insn "*extendsidi2_fix"
463 [(set (match_operand:DI 0 "register_operand" "=r,r,r,*f,?*f")
465 (match_operand:SI 1 "nonimmediate_operand" "r,m,*f,*f,m")))]
472 lds %0,%1\;cvtlq %0,%0"
473 [(set_attr "type" "iadd,ild,ftoi,fadd,fld")
474 (set_attr "length" "*,*,*,*,8")])
476 ;; Due to issues with CLASS_CANNOT_CHANGE_SIZE, we cannot use a subreg here.
478 [(set (match_operand:DI 0 "hard_fp_register_operand" "")
479 (sign_extend:DI (match_operand:SI 1 "memory_operand" "")))]
481 [(set (match_dup 2) (match_dup 1))
482 (set (match_dup 0) (sign_extend:DI (match_dup 2)))]
483 "operands[2] = gen_rtx_REG (SImode, REGNO (operands[0]));")
485 ;; Optimize sign-extension of SImode loads. This shows up in the wake of
486 ;; reload when converting fp->int.
489 [(set (match_operand:SI 0 "hard_int_register_operand" "")
490 (match_operand:SI 1 "memory_operand" ""))
491 (set (match_operand:DI 2 "hard_int_register_operand" "")
492 (sign_extend:DI (match_dup 0)))]
493 "true_regnum (operands[0]) == true_regnum (operands[2])
494 || peep2_reg_dead_p (2, operands[0])"
496 (sign_extend:DI (match_dup 1)))]
500 [(set (match_operand:SI 0 "hard_int_register_operand" "")
501 (match_operand:SI 1 "hard_fp_register_operand" ""))
502 (set (match_operand:DI 2 "hard_int_register_operand" "")
503 (sign_extend:DI (match_dup 0)))]
505 && (true_regnum (operands[0]) == true_regnum (operands[2])
506 || peep2_reg_dead_p (2, operands[0]))"
508 (sign_extend:DI (match_dup 1)))]
512 [(set (match_operand:DI 0 "hard_fp_register_operand" "")
513 (sign_extend:DI (match_operand:SI 1 "hard_fp_register_operand" "")))
514 (set (match_operand:DI 2 "hard_int_register_operand" "")
516 "TARGET_FIX && peep2_reg_dead_p (2, operands[0])"
518 (sign_extend:DI (match_dup 1)))]
521 ;; Do addsi3 the way expand_binop would do if we didn't have one. This
522 ;; generates better code. We have the anonymous addsi3 pattern below in
523 ;; case combine wants to make it.
524 (define_expand "addsi3"
525 [(set (match_operand:SI 0 "register_operand" "")
526 (plus:SI (match_operand:SI 1 "reg_or_0_operand" "")
527 (match_operand:SI 2 "add_operand" "")))]
532 rtx op1 = gen_lowpart (DImode, operands[1]);
533 rtx op2 = gen_lowpart (DImode, operands[2]);
535 if (! cse_not_expected)
537 rtx tmp = gen_reg_rtx (DImode);
538 emit_insn (gen_adddi3 (tmp, op1, op2));
539 emit_move_insn (gen_lowpart (DImode, operands[0]), tmp);
542 emit_insn (gen_adddi3 (gen_lowpart (DImode, operands[0]), op1, op2));
547 (define_insn "*addsi_internal"
548 [(set (match_operand:SI 0 "register_operand" "=r,r,r,r")
549 (plus:SI (match_operand:SI 1 "reg_or_0_operand" "%rJ,rJ,rJ,rJ")
550 (match_operand:SI 2 "add_operand" "rI,O,K,L")))]
559 [(set (match_operand:SI 0 "register_operand" "")
560 (plus:SI (match_operand:SI 1 "register_operand" "")
561 (match_operand:SI 2 "const_int_operand" "")))]
562 "! add_operand (operands[2], SImode)"
563 [(set (match_dup 0) (plus:SI (match_dup 1) (match_dup 3)))
564 (set (match_dup 0) (plus:SI (match_dup 0) (match_dup 4)))]
566 HOST_WIDE_INT val = INTVAL (operands[2]);
567 HOST_WIDE_INT low = (val & 0xffff) - 2 * (val & 0x8000);
568 HOST_WIDE_INT rest = val - low;
570 operands[3] = GEN_INT (rest);
571 operands[4] = GEN_INT (low);
574 (define_insn "*addsi_se"
575 [(set (match_operand:DI 0 "register_operand" "=r,r")
577 (plus:SI (match_operand:SI 1 "reg_or_0_operand" "%rJ,rJ")
578 (match_operand:SI 2 "sext_add_operand" "rI,O"))))]
585 [(set (match_operand:DI 0 "register_operand" "")
587 (plus:SI (match_operand:SI 1 "reg_not_elim_operand" "")
588 (match_operand:SI 2 "const_int_operand" ""))))
589 (clobber (match_operand:SI 3 "reg_not_elim_operand" ""))]
590 "! sext_add_operand (operands[2], SImode) && INTVAL (operands[2]) > 0
591 && INTVAL (operands[2]) % 4 == 0"
592 [(set (match_dup 3) (match_dup 4))
593 (set (match_dup 0) (sign_extend:DI (plus:SI (mult:SI (match_dup 3)
597 HOST_WIDE_INT val = INTVAL (operands[2]) / 4;
603 operands[4] = GEN_INT (val);
604 operands[5] = GEN_INT (mult);
608 [(set (match_operand:DI 0 "register_operand" "")
610 (plus:SI (match_operator:SI 1 "comparison_operator"
611 [(match_operand 2 "" "")
612 (match_operand 3 "" "")])
613 (match_operand:SI 4 "add_operand" ""))))
614 (clobber (match_operand:DI 5 "register_operand" ""))]
616 [(set (match_dup 5) (match_dup 6))
617 (set (match_dup 0) (sign_extend:DI (plus:SI (match_dup 7) (match_dup 4))))]
619 operands[6] = gen_rtx_fmt_ee (GET_CODE (operands[1]), DImode,
620 operands[2], operands[3]);
621 operands[7] = gen_lowpart (SImode, operands[5]);
624 (define_insn "addvsi3"
625 [(set (match_operand:SI 0 "register_operand" "=r,r")
626 (plus:SI (match_operand:SI 1 "reg_or_0_operand" "%rJ,rJ")
627 (match_operand:SI 2 "sext_add_operand" "rI,O")))
628 (trap_if (ne (plus:DI (sign_extend:DI (match_dup 1))
629 (sign_extend:DI (match_dup 2)))
630 (sign_extend:DI (plus:SI (match_dup 1)
638 (define_expand "adddi3"
639 [(set (match_operand:DI 0 "register_operand" "")
640 (plus:DI (match_operand:DI 1 "register_operand" "")
641 (match_operand:DI 2 "add_operand" "")))]
645 (define_insn "*adddi_er_high_l"
646 [(set (match_operand:DI 0 "register_operand" "=r")
647 (plus:DI (match_operand:DI 1 "register_operand" "r")
648 (high:DI (match_operand:DI 2 "local_symbolic_operand" ""))))]
649 "TARGET_EXPLICIT_RELOCS"
650 "ldah %0,%2(%1)\t\t!gprelhigh")
652 ;; We used to expend quite a lot of effort choosing addq/subq/lda.
653 ;; With complications like
655 ;; The NT stack unwind code can't handle a subq to adjust the stack
656 ;; (that's a bug, but not one we can do anything about). As of NT4.0 SP3,
657 ;; the exception handling code will loop if a subq is used and an
660 ;; The 19980616 change to emit prologues as RTL also confused some
661 ;; versions of GDB, which also interprets prologues. This has been
662 ;; fixed as of GDB 4.18, but it does not harm to unconditionally
665 ;; and the fact that the three insns schedule exactly the same, it's
666 ;; just not worth the effort.
668 (define_insn "*adddi_internal"
669 [(set (match_operand:DI 0 "register_operand" "=r,r,r")
670 (plus:DI (match_operand:DI 1 "register_operand" "%r,r,r")
671 (match_operand:DI 2 "add_operand" "r,K,L")))]
678 ;; ??? Allow large constants when basing off the frame pointer or some
679 ;; virtual register that may eliminate to the frame pointer. This is
680 ;; done because register elimination offsets will change the hi/lo split,
681 ;; and if we split before reload, we will require additional instructions.
683 (define_insn "*adddi_fp_hack"
684 [(set (match_operand:DI 0 "register_operand" "=r")
685 (plus:DI (match_operand:DI 1 "reg_no_subreg_operand" "r")
686 (match_operand:DI 2 "const_int_operand" "n")))]
687 "NONSTRICT_REG_OK_FP_BASE_P (operands[1])
688 && INTVAL (operands[2]) >= 0
689 /* This is the largest constant an lda+ldah pair can add, minus
690 an upper bound on the displacement between SP and AP during
691 register elimination. See INITIAL_ELIMINATION_OFFSET. */
692 && INTVAL (operands[2])
694 - FIRST_PSEUDO_REGISTER * UNITS_PER_WORD
695 - ALPHA_ROUND(current_function_outgoing_args_size)
696 - (ALPHA_ROUND (get_frame_size ()
697 + max_reg_num () * UNITS_PER_WORD
698 + current_function_pretend_args_size)
699 - current_function_pretend_args_size))"
702 ;; Don't do this if we are adjusting SP since we don't want to do it
703 ;; in two steps. Don't split FP sources for the reason listed above.
705 [(set (match_operand:DI 0 "register_operand" "")
706 (plus:DI (match_operand:DI 1 "register_operand" "")
707 (match_operand:DI 2 "const_int_operand" "")))]
708 "! add_operand (operands[2], DImode)
709 && operands[0] != stack_pointer_rtx
710 && operands[1] != frame_pointer_rtx
711 && operands[1] != arg_pointer_rtx"
712 [(set (match_dup 0) (plus:DI (match_dup 1) (match_dup 3)))
713 (set (match_dup 0) (plus:DI (match_dup 0) (match_dup 4)))]
715 HOST_WIDE_INT val = INTVAL (operands[2]);
716 HOST_WIDE_INT low = (val & 0xffff) - 2 * (val & 0x8000);
717 HOST_WIDE_INT rest = val - low;
719 operands[4] = GEN_INT (low);
720 if (CONST_OK_FOR_LETTER_P (rest, 'L'))
721 operands[3] = GEN_INT (rest);
722 else if (! no_new_pseudos)
724 operands[3] = gen_reg_rtx (DImode);
725 emit_move_insn (operands[3], operands[2]);
726 emit_insn (gen_adddi3 (operands[0], operands[1], operands[3]));
733 (define_insn "*saddl"
734 [(set (match_operand:SI 0 "register_operand" "=r,r")
735 (plus:SI (mult:SI (match_operand:SI 1 "reg_not_elim_operand" "r,r")
736 (match_operand:SI 2 "const48_operand" "I,I"))
737 (match_operand:SI 3 "sext_add_operand" "rI,O")))]
743 (define_insn "*saddl_se"
744 [(set (match_operand:DI 0 "register_operand" "=r,r")
746 (plus:SI (mult:SI (match_operand:SI 1 "reg_not_elim_operand" "r,r")
747 (match_operand:SI 2 "const48_operand" "I,I"))
748 (match_operand:SI 3 "sext_add_operand" "rI,O"))))]
755 [(set (match_operand:DI 0 "register_operand" "")
757 (plus:SI (mult:SI (match_operator:SI 1 "comparison_operator"
758 [(match_operand 2 "" "")
759 (match_operand 3 "" "")])
760 (match_operand:SI 4 "const48_operand" ""))
761 (match_operand:SI 5 "sext_add_operand" ""))))
762 (clobber (match_operand:DI 6 "reg_not_elim_operand" ""))]
764 [(set (match_dup 6) (match_dup 7))
766 (sign_extend:DI (plus:SI (mult:SI (match_dup 8) (match_dup 4))
769 operands[7] = gen_rtx_fmt_ee (GET_CODE (operands[1]), DImode,
770 operands[2], operands[3]);
771 operands[8] = gen_lowpart (SImode, operands[6]);
774 (define_insn "*saddq"
775 [(set (match_operand:DI 0 "register_operand" "=r,r")
776 (plus:DI (mult:DI (match_operand:DI 1 "reg_not_elim_operand" "r,r")
777 (match_operand:DI 2 "const48_operand" "I,I"))
778 (match_operand:DI 3 "sext_add_operand" "rI,O")))]
784 (define_insn "addvdi3"
785 [(set (match_operand:DI 0 "register_operand" "=r,r")
786 (plus:DI (match_operand:DI 1 "reg_or_0_operand" "%rJ,rJ")
787 (match_operand:DI 2 "sext_add_operand" "rI,O")))
788 (trap_if (ne (plus:TI (sign_extend:TI (match_dup 1))
789 (sign_extend:TI (match_dup 2)))
790 (sign_extend:TI (plus:DI (match_dup 1)
798 (define_insn "negsi2"
799 [(set (match_operand:SI 0 "register_operand" "=r")
800 (neg:SI (match_operand:SI 1 "reg_or_8bit_operand" "rI")))]
804 (define_insn "*negsi_se"
805 [(set (match_operand:DI 0 "register_operand" "=r")
806 (sign_extend:DI (neg:SI
807 (match_operand:SI 1 "reg_or_8bit_operand" "rI"))))]
811 (define_insn "negvsi2"
812 [(set (match_operand:SI 0 "register_operand" "=r")
813 (neg:SI (match_operand:SI 1 "register_operand" "r")))
814 (trap_if (ne (neg:DI (sign_extend:DI (match_dup 1)))
815 (sign_extend:DI (neg:SI (match_dup 1))))
820 (define_insn "negdi2"
821 [(set (match_operand:DI 0 "register_operand" "=r")
822 (neg:DI (match_operand:DI 1 "reg_or_8bit_operand" "rI")))]
826 (define_insn "negvdi2"
827 [(set (match_operand:DI 0 "register_operand" "=r")
828 (neg:DI (match_operand:DI 1 "register_operand" "r")))
829 (trap_if (ne (neg:TI (sign_extend:TI (match_dup 1)))
830 (sign_extend:TI (neg:DI (match_dup 1))))
835 (define_expand "subsi3"
836 [(set (match_operand:SI 0 "register_operand" "")
837 (minus:SI (match_operand:SI 1 "reg_or_0_operand" "")
838 (match_operand:SI 2 "reg_or_8bit_operand" "")))]
843 rtx op1 = gen_lowpart (DImode, operands[1]);
844 rtx op2 = gen_lowpart (DImode, operands[2]);
846 if (! cse_not_expected)
848 rtx tmp = gen_reg_rtx (DImode);
849 emit_insn (gen_subdi3 (tmp, op1, op2));
850 emit_move_insn (gen_lowpart (DImode, operands[0]), tmp);
853 emit_insn (gen_subdi3 (gen_lowpart (DImode, operands[0]), op1, op2));
858 (define_insn "*subsi_internal"
859 [(set (match_operand:SI 0 "register_operand" "=r")
860 (minus:SI (match_operand:SI 1 "reg_or_0_operand" "rJ")
861 (match_operand:SI 2 "reg_or_8bit_operand" "rI")))]
865 (define_insn "*subsi_se"
866 [(set (match_operand:DI 0 "register_operand" "=r")
867 (sign_extend:DI (minus:SI (match_operand:SI 1 "reg_or_0_operand" "rJ")
868 (match_operand:SI 2 "reg_or_8bit_operand" "rI"))))]
872 (define_insn "subvsi3"
873 [(set (match_operand:SI 0 "register_operand" "=r")
874 (minus:SI (match_operand:SI 1 "reg_or_0_operand" "rJ")
875 (match_operand:SI 2 "reg_or_8bit_operand" "rI")))
876 (trap_if (ne (minus:DI (sign_extend:DI (match_dup 1))
877 (sign_extend:DI (match_dup 2)))
878 (sign_extend:DI (minus:SI (match_dup 1)
884 (define_insn "subdi3"
885 [(set (match_operand:DI 0 "register_operand" "=r")
886 (minus:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
887 (match_operand:DI 2 "reg_or_8bit_operand" "rI")))]
891 (define_insn "*ssubl"
892 [(set (match_operand:SI 0 "register_operand" "=r")
893 (minus:SI (mult:SI (match_operand:SI 1 "reg_not_elim_operand" "r")
894 (match_operand:SI 2 "const48_operand" "I"))
895 (match_operand:SI 3 "reg_or_8bit_operand" "rI")))]
899 (define_insn "*ssubl_se"
900 [(set (match_operand:DI 0 "register_operand" "=r")
902 (minus:SI (mult:SI (match_operand:SI 1 "reg_not_elim_operand" "r")
903 (match_operand:SI 2 "const48_operand" "I"))
904 (match_operand:SI 3 "reg_or_8bit_operand" "rI"))))]
908 (define_insn "*ssubq"
909 [(set (match_operand:DI 0 "register_operand" "=r")
910 (minus:DI (mult:DI (match_operand:DI 1 "reg_not_elim_operand" "r")
911 (match_operand:DI 2 "const48_operand" "I"))
912 (match_operand:DI 3 "reg_or_8bit_operand" "rI")))]
916 (define_insn "subvdi3"
917 [(set (match_operand:DI 0 "register_operand" "=r")
918 (minus:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
919 (match_operand:DI 2 "reg_or_8bit_operand" "rI")))
920 (trap_if (ne (minus:TI (sign_extend:TI (match_dup 1))
921 (sign_extend:TI (match_dup 2)))
922 (sign_extend:TI (minus:DI (match_dup 1)
928 ;; The Unicos/Mk assembler doesn't support mull.
930 (define_insn "mulsi3"
931 [(set (match_operand:SI 0 "register_operand" "=r")
932 (mult:SI (match_operand:SI 1 "reg_or_0_operand" "%rJ")
933 (match_operand:SI 2 "reg_or_8bit_operand" "rI")))]
934 "!TARGET_ABI_UNICOSMK"
936 [(set_attr "type" "imul")
937 (set_attr "opsize" "si")])
939 (define_insn "*mulsi_se"
940 [(set (match_operand:DI 0 "register_operand" "=r")
942 (mult:SI (match_operand:SI 1 "reg_or_0_operand" "%rJ")
943 (match_operand:SI 2 "reg_or_8bit_operand" "rI"))))]
944 "!TARGET_ABI_UNICOSMK"
946 [(set_attr "type" "imul")
947 (set_attr "opsize" "si")])
949 (define_insn "mulvsi3"
950 [(set (match_operand:SI 0 "register_operand" "=r")
951 (mult:SI (match_operand:SI 1 "reg_or_0_operand" "%rJ")
952 (match_operand:SI 2 "reg_or_8bit_operand" "rI")))
953 (trap_if (ne (mult:DI (sign_extend:DI (match_dup 1))
954 (sign_extend:DI (match_dup 2)))
955 (sign_extend:DI (mult:SI (match_dup 1)
958 "!TARGET_ABI_UNICOSMK"
960 [(set_attr "type" "imul")
961 (set_attr "opsize" "si")])
963 (define_insn "muldi3"
964 [(set (match_operand:DI 0 "register_operand" "=r")
965 (mult:DI (match_operand:DI 1 "reg_or_0_operand" "%rJ")
966 (match_operand:DI 2 "reg_or_8bit_operand" "rI")))]
969 [(set_attr "type" "imul")])
971 (define_insn "mulvdi3"
972 [(set (match_operand:DI 0 "register_operand" "=r")
973 (mult:DI (match_operand:DI 1 "reg_or_0_operand" "%rJ")
974 (match_operand:DI 2 "reg_or_8bit_operand" "rI")))
975 (trap_if (ne (mult:TI (sign_extend:TI (match_dup 1))
976 (sign_extend:TI (match_dup 2)))
977 (sign_extend:TI (mult:DI (match_dup 1)
982 [(set_attr "type" "imul")])
984 (define_insn "umuldi3_highpart"
985 [(set (match_operand:DI 0 "register_operand" "=r")
988 (mult:TI (zero_extend:TI
989 (match_operand:DI 1 "reg_or_0_operand" "%rJ"))
991 (match_operand:DI 2 "reg_or_8bit_operand" "rI")))
995 [(set_attr "type" "imul")
996 (set_attr "opsize" "udi")])
998 (define_insn "*umuldi3_highpart_const"
999 [(set (match_operand:DI 0 "register_operand" "=r")
1002 (mult:TI (zero_extend:TI (match_operand:DI 1 "register_operand" "r"))
1003 (match_operand:TI 2 "cint8_operand" "I"))
1007 [(set_attr "type" "imul")
1008 (set_attr "opsize" "udi")])
1010 ;; The divide and remainder operations take their inputs from r24 and
1011 ;; r25, put their output in r27, and clobber r23 and r28 on all
1012 ;; systems except Unicos/Mk. On Unicos, the standard library provides
1013 ;; subroutines which use the standard calling convention and work on
1016 ;; ??? Force sign-extension here because some versions of OSF/1 and
1017 ;; Interix/NT don't do the right thing if the inputs are not properly
1018 ;; sign-extended. But Linux, for instance, does not have this
1019 ;; problem. Is it worth the complication here to eliminate the sign
1022 (define_expand "divsi3"
1024 (sign_extend:DI (match_operand:SI 1 "nonimmediate_operand" "")))
1026 (sign_extend:DI (match_operand:SI 2 "nonimmediate_operand" "")))
1027 (parallel [(set (match_dup 5)
1028 (sign_extend:DI (div:SI (match_dup 3) (match_dup 4))))
1029 (clobber (reg:DI 23))
1030 (clobber (reg:DI 28))])
1031 (set (match_operand:SI 0 "nonimmediate_operand" "")
1032 (subreg:SI (match_dup 5) 0))]
1033 "! TARGET_ABI_OPEN_VMS && ! TARGET_ABI_UNICOSMK"
1035 operands[3] = gen_reg_rtx (DImode);
1036 operands[4] = gen_reg_rtx (DImode);
1037 operands[5] = gen_reg_rtx (DImode);
1040 (define_expand "udivsi3"
1042 (sign_extend:DI (match_operand:SI 1 "nonimmediate_operand" "")))
1044 (sign_extend:DI (match_operand:SI 2 "nonimmediate_operand" "")))
1045 (parallel [(set (match_dup 5)
1046 (sign_extend:DI (udiv:SI (match_dup 3) (match_dup 4))))
1047 (clobber (reg:DI 23))
1048 (clobber (reg:DI 28))])
1049 (set (match_operand:SI 0 "nonimmediate_operand" "")
1050 (subreg:SI (match_dup 5) 0))]
1051 "! TARGET_ABI_OPEN_VMS && ! TARGET_ABI_UNICOSMK"
1053 operands[3] = gen_reg_rtx (DImode);
1054 operands[4] = gen_reg_rtx (DImode);
1055 operands[5] = gen_reg_rtx (DImode);
1058 (define_expand "modsi3"
1060 (sign_extend:DI (match_operand:SI 1 "nonimmediate_operand" "")))
1062 (sign_extend:DI (match_operand:SI 2 "nonimmediate_operand" "")))
1063 (parallel [(set (match_dup 5)
1064 (sign_extend:DI (mod:SI (match_dup 3) (match_dup 4))))
1065 (clobber (reg:DI 23))
1066 (clobber (reg:DI 28))])
1067 (set (match_operand:SI 0 "nonimmediate_operand" "")
1068 (subreg:SI (match_dup 5) 0))]
1069 "! TARGET_ABI_OPEN_VMS && ! TARGET_ABI_UNICOSMK"
1071 operands[3] = gen_reg_rtx (DImode);
1072 operands[4] = gen_reg_rtx (DImode);
1073 operands[5] = gen_reg_rtx (DImode);
1076 (define_expand "umodsi3"
1078 (sign_extend:DI (match_operand:SI 1 "nonimmediate_operand" "")))
1080 (sign_extend:DI (match_operand:SI 2 "nonimmediate_operand" "")))
1081 (parallel [(set (match_dup 5)
1082 (sign_extend:DI (umod:SI (match_dup 3) (match_dup 4))))
1083 (clobber (reg:DI 23))
1084 (clobber (reg:DI 28))])
1085 (set (match_operand:SI 0 "nonimmediate_operand" "")
1086 (subreg:SI (match_dup 5) 0))]
1087 "! TARGET_ABI_OPEN_VMS && ! TARGET_ABI_UNICOSMK"
1089 operands[3] = gen_reg_rtx (DImode);
1090 operands[4] = gen_reg_rtx (DImode);
1091 operands[5] = gen_reg_rtx (DImode);
1094 (define_expand "divdi3"
1095 [(parallel [(set (match_operand:DI 0 "register_operand" "")
1096 (div:DI (match_operand:DI 1 "register_operand" "")
1097 (match_operand:DI 2 "register_operand" "")))
1098 (clobber (reg:DI 23))
1099 (clobber (reg:DI 28))])]
1100 "! TARGET_ABI_OPEN_VMS && ! TARGET_ABI_UNICOSMK"
1103 (define_expand "udivdi3"
1104 [(parallel [(set (match_operand:DI 0 "register_operand" "")
1105 (udiv:DI (match_operand:DI 1 "register_operand" "")
1106 (match_operand:DI 2 "register_operand" "")))
1107 (clobber (reg:DI 23))
1108 (clobber (reg:DI 28))])]
1109 "! TARGET_ABI_OPEN_VMS && ! TARGET_ABI_UNICOSMK"
1112 (define_expand "moddi3"
1113 [(use (match_operand:DI 0 "register_operand" ""))
1114 (use (match_operand:DI 1 "register_operand" ""))
1115 (use (match_operand:DI 2 "register_operand" ""))]
1116 "!TARGET_ABI_OPEN_VMS"
1118 if (TARGET_ABI_UNICOSMK)
1119 emit_insn (gen_moddi3_umk (operands[0], operands[1], operands[2]));
1121 emit_insn (gen_moddi3_dft (operands[0], operands[1], operands[2]));
1125 (define_expand "moddi3_dft"
1126 [(parallel [(set (match_operand:DI 0 "register_operand" "")
1127 (mod:DI (match_operand:DI 1 "register_operand" "")
1128 (match_operand:DI 2 "register_operand" "")))
1129 (clobber (reg:DI 23))
1130 (clobber (reg:DI 28))])]
1131 "! TARGET_ABI_OPEN_VMS && ! TARGET_ABI_UNICOSMK"
1134 ;; On Unicos/Mk, we do as the system's C compiler does:
1135 ;; compute the quotient, multiply and subtract.
1137 (define_expand "moddi3_umk"
1138 [(use (match_operand:DI 0 "register_operand" ""))
1139 (use (match_operand:DI 1 "register_operand" ""))
1140 (use (match_operand:DI 2 "register_operand" ""))]
1141 "TARGET_ABI_UNICOSMK"
1143 rtx div, mul = gen_reg_rtx (DImode);
1145 div = expand_binop (DImode, sdiv_optab, operands[1], operands[2],
1146 NULL_RTX, 0, OPTAB_LIB);
1147 div = force_reg (DImode, div);
1148 emit_insn (gen_muldi3 (mul, operands[2], div));
1149 emit_insn (gen_subdi3 (operands[0], operands[1], mul));
1153 (define_expand "umoddi3"
1154 [(use (match_operand:DI 0 "register_operand" ""))
1155 (use (match_operand:DI 1 "register_operand" ""))
1156 (use (match_operand:DI 2 "register_operand" ""))]
1157 "! TARGET_ABI_OPEN_VMS"
1159 if (TARGET_ABI_UNICOSMK)
1160 emit_insn (gen_umoddi3_umk (operands[0], operands[1], operands[2]));
1162 emit_insn (gen_umoddi3_dft (operands[0], operands[1], operands[2]));
1166 (define_expand "umoddi3_dft"
1167 [(parallel [(set (match_operand:DI 0 "register_operand" "")
1168 (umod:DI (match_operand:DI 1 "register_operand" "")
1169 (match_operand:DI 2 "register_operand" "")))
1170 (clobber (reg:DI 23))
1171 (clobber (reg:DI 28))])]
1172 "! TARGET_ABI_OPEN_VMS && ! TARGET_ABI_UNICOSMK"
1175 (define_expand "umoddi3_umk"
1176 [(use (match_operand:DI 0 "register_operand" ""))
1177 (use (match_operand:DI 1 "register_operand" ""))
1178 (use (match_operand:DI 2 "register_operand" ""))]
1179 "TARGET_ABI_UNICOSMK"
1181 rtx div, mul = gen_reg_rtx (DImode);
1183 div = expand_binop (DImode, udiv_optab, operands[1], operands[2],
1184 NULL_RTX, 1, OPTAB_LIB);
1185 div = force_reg (DImode, div);
1186 emit_insn (gen_muldi3 (mul, operands[2], div));
1187 emit_insn (gen_subdi3 (operands[0], operands[1], mul));
1191 ;; Lengths of 8 for ldq $t12,__divq($gp); jsr $t9,($t12),__divq as
1192 ;; expanded by the assembler.
1194 (define_insn_and_split "*divmodsi_internal_er"
1195 [(set (match_operand:DI 0 "register_operand" "=c")
1196 (sign_extend:DI (match_operator:SI 3 "divmod_operator"
1197 [(match_operand:DI 1 "register_operand" "a")
1198 (match_operand:DI 2 "register_operand" "b")])))
1199 (clobber (reg:DI 23))
1200 (clobber (reg:DI 28))]
1201 "TARGET_EXPLICIT_RELOCS && ! TARGET_ABI_OPEN_VMS"
1202 "ldq $27,__%E3($29)\t\t!literal!%#\;jsr $23,($27),__%E3\t\t!lituse_jsr!%#"
1203 "&& reload_completed"
1204 [(parallel [(set (match_dup 0)
1205 (sign_extend:DI (match_dup 3)))
1207 (clobber (reg:DI 23))
1208 (clobber (reg:DI 28))])]
1211 switch (GET_CODE (operands[3]))
1228 emit_insn (gen_movdi_er_high_g (operands[0], pic_offset_table_rtx,
1229 gen_rtx_SYMBOL_REF (DImode, str),
1232 [(set_attr "type" "jsr")
1233 (set_attr "length" "8")])
1235 (define_insn "*divmodsi_internal_er_1"
1236 [(set (match_operand:DI 0 "register_operand" "=c")
1237 (sign_extend:DI (match_operator:SI 3 "divmod_operator"
1238 [(match_operand:DI 1 "register_operand" "a")
1239 (match_operand:DI 2 "register_operand" "b")])))
1240 (use (match_operand:DI 4 "register_operand" "c"))
1241 (clobber (reg:DI 23))
1242 (clobber (reg:DI 28))]
1243 "TARGET_EXPLICIT_RELOCS && ! TARGET_ABI_OPEN_VMS"
1244 "jsr $23,($27),__%E3"
1245 [(set_attr "type" "jsr")
1246 (set_attr "length" "4")])
1248 (define_insn "*divmodsi_internal"
1249 [(set (match_operand:DI 0 "register_operand" "=c")
1250 (sign_extend:DI (match_operator:SI 3 "divmod_operator"
1251 [(match_operand:DI 1 "register_operand" "a")
1252 (match_operand:DI 2 "register_operand" "b")])))
1253 (clobber (reg:DI 23))
1254 (clobber (reg:DI 28))]
1255 "! TARGET_ABI_OPEN_VMS && ! TARGET_ABI_UNICOSMK"
1257 [(set_attr "type" "jsr")
1258 (set_attr "length" "8")])
1260 (define_insn_and_split "*divmoddi_internal_er"
1261 [(set (match_operand:DI 0 "register_operand" "=c")
1262 (match_operator:DI 3 "divmod_operator"
1263 [(match_operand:DI 1 "register_operand" "a")
1264 (match_operand:DI 2 "register_operand" "b")]))
1265 (clobber (reg:DI 23))
1266 (clobber (reg:DI 28))]
1267 "TARGET_EXPLICIT_RELOCS && ! TARGET_ABI_OPEN_VMS"
1268 "ldq $27,__%E3($29)\t\t!literal!%#\;jsr $23,($27),__%E3\t\t!lituse_jsr!%#"
1269 "&& reload_completed"
1270 [(parallel [(set (match_dup 0) (match_dup 3))
1272 (clobber (reg:DI 23))
1273 (clobber (reg:DI 28))])]
1276 switch (GET_CODE (operands[3]))
1293 emit_insn (gen_movdi_er_high_g (operands[0], pic_offset_table_rtx,
1294 gen_rtx_SYMBOL_REF (DImode, str),
1297 [(set_attr "type" "jsr")
1298 (set_attr "length" "8")])
1300 (define_insn "*divmoddi_internal_er_1"
1301 [(set (match_operand:DI 0 "register_operand" "=c")
1302 (match_operator:DI 3 "divmod_operator"
1303 [(match_operand:DI 1 "register_operand" "a")
1304 (match_operand:DI 2 "register_operand" "b")]))
1305 (use (match_operand:DI 4 "register_operand" "c"))
1306 (clobber (reg:DI 23))
1307 (clobber (reg:DI 28))]
1308 "TARGET_EXPLICIT_RELOCS && ! TARGET_ABI_OPEN_VMS"
1309 "jsr $23,($27),__%E3"
1310 [(set_attr "type" "jsr")
1311 (set_attr "length" "4")])
1313 (define_insn "*divmoddi_internal"
1314 [(set (match_operand:DI 0 "register_operand" "=c")
1315 (match_operator:DI 3 "divmod_operator"
1316 [(match_operand:DI 1 "register_operand" "a")
1317 (match_operand:DI 2 "register_operand" "b")]))
1318 (clobber (reg:DI 23))
1319 (clobber (reg:DI 28))]
1320 "! TARGET_ABI_OPEN_VMS && ! TARGET_ABI_UNICOSMK"
1322 [(set_attr "type" "jsr")
1323 (set_attr "length" "8")])
1325 ;; Next are the basic logical operations. These only exist in DImode.
1327 (define_insn "anddi3"
1328 [(set (match_operand:DI 0 "register_operand" "=r,r,r")
1329 (and:DI (match_operand:DI 1 "reg_or_0_operand" "%rJ,rJ,rJ")
1330 (match_operand:DI 2 "and_operand" "rI,N,MH")))]
1336 [(set_attr "type" "ilog,ilog,shift")])
1338 ;; There are times when we can split an AND into two AND insns. This occurs
1339 ;; when we can first clear any bytes and then clear anything else. For
1340 ;; example "I & 0xffff07" is "(I & 0xffffff) & 0xffffffffffffff07".
1341 ;; Only do this when running on 64-bit host since the computations are
1342 ;; too messy otherwise.
1345 [(set (match_operand:DI 0 "register_operand" "")
1346 (and:DI (match_operand:DI 1 "register_operand" "")
1347 (match_operand:DI 2 "const_int_operand" "")))]
1348 "HOST_BITS_PER_WIDE_INT == 64 && ! and_operand (operands[2], DImode)"
1349 [(set (match_dup 0) (and:DI (match_dup 1) (match_dup 3)))
1350 (set (match_dup 0) (and:DI (match_dup 0) (match_dup 4)))]
1352 unsigned HOST_WIDE_INT mask1 = INTVAL (operands[2]);
1353 unsigned HOST_WIDE_INT mask2 = mask1;
1356 /* For each byte that isn't all zeros, make it all ones. */
1357 for (i = 0; i < 64; i += 8)
1358 if ((mask1 & ((HOST_WIDE_INT) 0xff << i)) != 0)
1359 mask1 |= (HOST_WIDE_INT) 0xff << i;
1361 /* Now turn on any bits we've just turned off. */
1364 operands[3] = GEN_INT (mask1);
1365 operands[4] = GEN_INT (mask2);
1368 (define_expand "zero_extendqihi2"
1369 [(set (match_operand:HI 0 "register_operand" "")
1370 (zero_extend:HI (match_operand:QI 1 "nonimmediate_operand" "")))]
1374 operands[1] = force_reg (QImode, operands[1]);
1377 (define_insn "*zero_extendqihi2_bwx"
1378 [(set (match_operand:HI 0 "register_operand" "=r,r")
1379 (zero_extend:HI (match_operand:QI 1 "nonimmediate_operand" "r,m")))]
1384 [(set_attr "type" "ilog,ild")])
1386 (define_insn "*zero_extendqihi2_nobwx"
1387 [(set (match_operand:HI 0 "register_operand" "=r")
1388 (zero_extend:HI (match_operand:QI 1 "register_operand" "r")))]
1391 [(set_attr "type" "ilog")])
1393 (define_expand "zero_extendqisi2"
1394 [(set (match_operand:SI 0 "register_operand" "")
1395 (zero_extend:SI (match_operand:QI 1 "nonimmediate_operand" "")))]
1399 operands[1] = force_reg (QImode, operands[1]);
1402 (define_insn "*zero_extendqisi2_bwx"
1403 [(set (match_operand:SI 0 "register_operand" "=r,r")
1404 (zero_extend:SI (match_operand:QI 1 "nonimmediate_operand" "r,m")))]
1409 [(set_attr "type" "ilog,ild")])
1411 (define_insn "*zero_extendqisi2_nobwx"
1412 [(set (match_operand:SI 0 "register_operand" "=r")
1413 (zero_extend:SI (match_operand:QI 1 "register_operand" "r")))]
1416 [(set_attr "type" "ilog")])
1418 (define_expand "zero_extendqidi2"
1419 [(set (match_operand:DI 0 "register_operand" "")
1420 (zero_extend:DI (match_operand:QI 1 "nonimmediate_operand" "")))]
1424 operands[1] = force_reg (QImode, operands[1]);
1427 (define_insn "*zero_extendqidi2_bwx"
1428 [(set (match_operand:DI 0 "register_operand" "=r,r")
1429 (zero_extend:DI (match_operand:QI 1 "nonimmediate_operand" "r,m")))]
1434 [(set_attr "type" "ilog,ild")])
1436 (define_insn "*zero_extendqidi2_nobwx"
1437 [(set (match_operand:DI 0 "register_operand" "=r")
1438 (zero_extend:DI (match_operand:QI 1 "register_operand" "r")))]
1441 [(set_attr "type" "ilog")])
1443 (define_expand "zero_extendhisi2"
1444 [(set (match_operand:SI 0 "register_operand" "")
1445 (zero_extend:SI (match_operand:HI 1 "nonimmediate_operand" "")))]
1449 operands[1] = force_reg (HImode, operands[1]);
1452 (define_insn "*zero_extendhisi2_bwx"
1453 [(set (match_operand:SI 0 "register_operand" "=r,r")
1454 (zero_extend:SI (match_operand:HI 1 "nonimmediate_operand" "r,m")))]
1459 [(set_attr "type" "shift,ild")])
1461 (define_insn "*zero_extendhisi2_nobwx"
1462 [(set (match_operand:SI 0 "register_operand" "=r")
1463 (zero_extend:SI (match_operand:HI 1 "register_operand" "r")))]
1466 [(set_attr "type" "shift")])
1468 (define_expand "zero_extendhidi2"
1469 [(set (match_operand:DI 0 "register_operand" "")
1470 (zero_extend:DI (match_operand:HI 1 "nonimmediate_operand" "")))]
1474 operands[1] = force_reg (HImode, operands[1]);
1477 (define_insn "*zero_extendhidi2_bwx"
1478 [(set (match_operand:DI 0 "register_operand" "=r,r")
1479 (zero_extend:DI (match_operand:HI 1 "nonimmediate_operand" "r,m")))]
1484 [(set_attr "type" "shift,ild")])
1486 (define_insn "*zero_extendhidi2_nobwx"
1487 [(set (match_operand:DI 0 "register_operand" "=r")
1488 (zero_extend:DI (match_operand:HI 1 "register_operand" "r")))]
1491 [(set_attr "type" "shift")])
1493 (define_insn "zero_extendsidi2"
1494 [(set (match_operand:DI 0 "register_operand" "=r")
1495 (zero_extend:DI (match_operand:SI 1 "register_operand" "r")))]
1498 [(set_attr "type" "shift")])
1500 (define_insn "andnotdi3"
1501 [(set (match_operand:DI 0 "register_operand" "=r")
1502 (and:DI (not:DI (match_operand:DI 1 "reg_or_8bit_operand" "rI"))
1503 (match_operand:DI 2 "reg_or_0_operand" "rJ")))]
1506 [(set_attr "type" "ilog")])
1508 (define_insn "iordi3"
1509 [(set (match_operand:DI 0 "register_operand" "=r,r")
1510 (ior:DI (match_operand:DI 1 "reg_or_0_operand" "%rJ,rJ")
1511 (match_operand:DI 2 "or_operand" "rI,N")))]
1516 [(set_attr "type" "ilog")])
1518 (define_insn "one_cmpldi2"
1519 [(set (match_operand:DI 0 "register_operand" "=r")
1520 (not:DI (match_operand:DI 1 "reg_or_8bit_operand" "rI")))]
1523 [(set_attr "type" "ilog")])
1525 (define_insn "*iornot"
1526 [(set (match_operand:DI 0 "register_operand" "=r")
1527 (ior:DI (not:DI (match_operand:DI 1 "reg_or_8bit_operand" "rI"))
1528 (match_operand:DI 2 "reg_or_0_operand" "rJ")))]
1531 [(set_attr "type" "ilog")])
1533 (define_insn "xordi3"
1534 [(set (match_operand:DI 0 "register_operand" "=r,r")
1535 (xor:DI (match_operand:DI 1 "reg_or_0_operand" "%rJ,rJ")
1536 (match_operand:DI 2 "or_operand" "rI,N")))]
1541 [(set_attr "type" "ilog")])
1543 (define_insn "*xornot"
1544 [(set (match_operand:DI 0 "register_operand" "=r")
1545 (not:DI (xor:DI (match_operand:DI 1 "register_operand" "%rJ")
1546 (match_operand:DI 2 "register_operand" "rI"))))]
1549 [(set_attr "type" "ilog")])
1551 ;; Handle the FFS insn iff we support CIX.
1553 (define_expand "ffsdi2"
1555 (unspec:DI [(match_operand:DI 1 "register_operand" "")] UNSPEC_CTTZ))
1557 (plus:DI (match_dup 2) (const_int 1)))
1558 (set (match_operand:DI 0 "register_operand" "")
1559 (if_then_else:DI (eq (match_dup 1) (const_int 0))
1560 (const_int 0) (match_dup 3)))]
1563 operands[2] = gen_reg_rtx (DImode);
1564 operands[3] = gen_reg_rtx (DImode);
1567 (define_insn "*cttz"
1568 [(set (match_operand:DI 0 "register_operand" "=r")
1569 (unspec:DI [(match_operand:DI 1 "register_operand" "r")] UNSPEC_CTTZ))]
1572 ; EV6 calls all mvi and cttz/ctlz/popc class imisc, so just
1573 ; reuse the existing type name.
1574 [(set_attr "type" "mvi")])
1576 ;; Next come the shifts and the various extract and insert operations.
1578 (define_insn "ashldi3"
1579 [(set (match_operand:DI 0 "register_operand" "=r,r")
1580 (ashift:DI (match_operand:DI 1 "reg_or_0_operand" "rJ,rJ")
1581 (match_operand:DI 2 "reg_or_6bit_operand" "P,rS")))]
1584 switch (which_alternative)
1587 if (operands[2] == const1_rtx)
1588 return "addq %r1,%r1,%0";
1590 return "s%P2addq %r1,0,%0";
1592 return "sll %r1,%2,%0";
1597 [(set_attr "type" "iadd,shift")])
1599 ;; ??? The following pattern is made by combine, but earlier phases
1600 ;; (specifically flow) can't handle it. This occurs in jump.c. Deal
1601 ;; with this in a better way at some point.
1603 ;; [(set (match_operand:DI 0 "register_operand" "=r")
1605 ;; (subreg:SI (ashift:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
1606 ;; (match_operand:DI 2 "const_int_operand" "P"))
1608 ;; "INTVAL (operands[2]) >= 1 && INTVAL (operands[2]) <= 3"
1610 ;; if (operands[2] == const1_rtx)
1611 ;; return "addl %r1,%r1,%0";
1613 ;; return "s%P2addl %r1,0,%0";
1615 ;; [(set_attr "type" "iadd")])
1617 (define_insn "lshrdi3"
1618 [(set (match_operand:DI 0 "register_operand" "=r")
1619 (lshiftrt:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
1620 (match_operand:DI 2 "reg_or_6bit_operand" "rS")))]
1623 [(set_attr "type" "shift")])
1625 (define_insn "ashrdi3"
1626 [(set (match_operand:DI 0 "register_operand" "=r")
1627 (ashiftrt:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
1628 (match_operand:DI 2 "reg_or_6bit_operand" "rS")))]
1631 [(set_attr "type" "shift")])
1633 (define_expand "extendqihi2"
1635 (ashift:DI (match_operand:QI 1 "some_operand" "")
1637 (set (match_operand:HI 0 "register_operand" "")
1638 (ashiftrt:DI (match_dup 2)
1644 emit_insn (gen_extendqihi2x (operands[0],
1645 force_reg (QImode, operands[1])));
1649 /* If we have an unaligned MEM, extend to DImode (which we do
1650 specially) and then copy to the result. */
1651 if (unaligned_memory_operand (operands[1], HImode))
1653 rtx temp = gen_reg_rtx (DImode);
1655 emit_insn (gen_extendqidi2 (temp, operands[1]));
1656 emit_move_insn (operands[0], gen_lowpart (HImode, temp));
1660 operands[0] = gen_lowpart (DImode, operands[0]);
1661 operands[1] = gen_lowpart (DImode, force_reg (QImode, operands[1]));
1662 operands[2] = gen_reg_rtx (DImode);
1665 (define_insn "extendqidi2x"
1666 [(set (match_operand:DI 0 "register_operand" "=r")
1667 (sign_extend:DI (match_operand:QI 1 "register_operand" "r")))]
1670 [(set_attr "type" "shift")])
1672 (define_insn "extendhidi2x"
1673 [(set (match_operand:DI 0 "register_operand" "=r")
1674 (sign_extend:DI (match_operand:HI 1 "register_operand" "r")))]
1677 [(set_attr "type" "shift")])
1679 (define_insn "extendqisi2x"
1680 [(set (match_operand:SI 0 "register_operand" "=r")
1681 (sign_extend:SI (match_operand:QI 1 "register_operand" "r")))]
1684 [(set_attr "type" "shift")])
1686 (define_insn "extendhisi2x"
1687 [(set (match_operand:SI 0 "register_operand" "=r")
1688 (sign_extend:SI (match_operand:HI 1 "register_operand" "r")))]
1691 [(set_attr "type" "shift")])
1693 (define_insn "extendqihi2x"
1694 [(set (match_operand:HI 0 "register_operand" "=r")
1695 (sign_extend:HI (match_operand:QI 1 "register_operand" "r")))]
1698 [(set_attr "type" "shift")])
1700 (define_expand "extendqisi2"
1702 (ashift:DI (match_operand:QI 1 "some_operand" "")
1704 (set (match_operand:SI 0 "register_operand" "")
1705 (ashiftrt:DI (match_dup 2)
1711 emit_insn (gen_extendqisi2x (operands[0],
1712 force_reg (QImode, operands[1])));
1716 /* If we have an unaligned MEM, extend to a DImode form of
1717 the result (which we do specially). */
1718 if (unaligned_memory_operand (operands[1], QImode))
1720 rtx temp = gen_reg_rtx (DImode);
1722 emit_insn (gen_extendqidi2 (temp, operands[1]));
1723 emit_move_insn (operands[0], gen_lowpart (SImode, temp));
1727 operands[0] = gen_lowpart (DImode, operands[0]);
1728 operands[1] = gen_lowpart (DImode, force_reg (QImode, operands[1]));
1729 operands[2] = gen_reg_rtx (DImode);
1732 (define_expand "extendqidi2"
1734 (ashift:DI (match_operand:QI 1 "some_operand" "")
1736 (set (match_operand:DI 0 "register_operand" "")
1737 (ashiftrt:DI (match_dup 2)
1743 emit_insn (gen_extendqidi2x (operands[0],
1744 force_reg (QImode, operands[1])));
1748 if (unaligned_memory_operand (operands[1], QImode))
1751 = gen_unaligned_extendqidi (operands[0],
1752 get_unaligned_address (operands[1], 1));
1754 alpha_set_memflags (seq, operands[1]);
1759 operands[1] = gen_lowpart (DImode, force_reg (QImode, operands[1]));
1760 operands[2] = gen_reg_rtx (DImode);
1763 (define_expand "extendhisi2"
1765 (ashift:DI (match_operand:HI 1 "some_operand" "")
1767 (set (match_operand:SI 0 "register_operand" "")
1768 (ashiftrt:DI (match_dup 2)
1774 emit_insn (gen_extendhisi2x (operands[0],
1775 force_reg (HImode, operands[1])));
1779 /* If we have an unaligned MEM, extend to a DImode form of
1780 the result (which we do specially). */
1781 if (unaligned_memory_operand (operands[1], HImode))
1783 rtx temp = gen_reg_rtx (DImode);
1785 emit_insn (gen_extendhidi2 (temp, operands[1]));
1786 emit_move_insn (operands[0], gen_lowpart (SImode, temp));
1790 operands[0] = gen_lowpart (DImode, operands[0]);
1791 operands[1] = gen_lowpart (DImode, force_reg (HImode, operands[1]));
1792 operands[2] = gen_reg_rtx (DImode);
1795 (define_expand "extendhidi2"
1797 (ashift:DI (match_operand:HI 1 "some_operand" "")
1799 (set (match_operand:DI 0 "register_operand" "")
1800 (ashiftrt:DI (match_dup 2)
1806 emit_insn (gen_extendhidi2x (operands[0],
1807 force_reg (HImode, operands[1])));
1811 if (unaligned_memory_operand (operands[1], HImode))
1814 = gen_unaligned_extendhidi (operands[0],
1815 get_unaligned_address (operands[1], 2));
1817 alpha_set_memflags (seq, operands[1]);
1822 operands[1] = gen_lowpart (DImode, force_reg (HImode, operands[1]));
1823 operands[2] = gen_reg_rtx (DImode);
1826 ;; Here's how we sign extend an unaligned byte and halfword. Doing this
1827 ;; as a pattern saves one instruction. The code is similar to that for
1828 ;; the unaligned loads (see below).
1830 ;; Operand 1 is the address + 1 (+2 for HI), operand 0 is the result.
1831 (define_expand "unaligned_extendqidi"
1832 [(use (match_operand:QI 0 "register_operand" ""))
1833 (use (match_operand:DI 1 "address_operand" ""))]
1836 if (WORDS_BIG_ENDIAN)
1837 emit_insn (gen_unaligned_extendqidi_be (operands[0], operands[1]));
1839 emit_insn (gen_unaligned_extendqidi_le (operands[0], operands[1]));
1843 (define_expand "unaligned_extendqidi_le"
1844 [(set (match_dup 2) (match_operand:DI 1 "address_operand" ""))
1846 (mem:DI (and:DI (plus:DI (match_dup 2) (const_int -1))
1849 (ashift:DI (match_dup 3)
1850 (minus:DI (const_int 64)
1852 (and:DI (match_dup 2) (const_int 7))
1854 (set (subreg:DI (match_operand:QI 0 "register_operand" "") 0)
1855 (ashiftrt:DI (match_dup 4) (const_int 56)))]
1856 "! WORDS_BIG_ENDIAN"
1858 operands[2] = gen_reg_rtx (DImode);
1859 operands[3] = gen_reg_rtx (DImode);
1860 operands[4] = gen_reg_rtx (DImode);
1863 (define_expand "unaligned_extendqidi_be"
1864 [(set (match_dup 2) (match_operand:DI 1 "address_operand" ""))
1865 (set (match_dup 3) (plus:DI (match_dup 2) (const_int -1)))
1867 (mem:DI (and:DI (match_dup 3)
1869 (set (match_dup 5) (plus:DI (match_dup 2) (const_int -2)))
1871 (ashift:DI (match_dup 4)
1874 (plus:DI (match_dup 5) (const_int 1))
1877 (set (subreg:DI (match_operand:QI 0 "register_operand" "") 0)
1878 (ashiftrt:DI (match_dup 6) (const_int 56)))]
1881 operands[2] = gen_reg_rtx (DImode);
1882 operands[3] = gen_reg_rtx (DImode);
1883 operands[4] = gen_reg_rtx (DImode);
1884 operands[5] = gen_reg_rtx (DImode);
1885 operands[6] = gen_reg_rtx (DImode);
1888 (define_expand "unaligned_extendhidi"
1889 [(use (match_operand:QI 0 "register_operand" ""))
1890 (use (match_operand:DI 1 "address_operand" ""))]
1893 operands[0] = gen_lowpart (DImode, operands[0]);
1894 emit_insn ((WORDS_BIG_ENDIAN
1895 ? gen_unaligned_extendhidi_be
1896 : gen_unaligned_extendhidi_le) (operands[0], operands[1]));
1900 (define_expand "unaligned_extendhidi_le"
1901 [(set (match_dup 2) (match_operand:DI 1 "address_operand" ""))
1903 (mem:DI (and:DI (plus:DI (match_dup 2) (const_int -2))
1906 (ashift:DI (match_dup 3)
1907 (minus:DI (const_int 64)
1909 (and:DI (match_dup 2) (const_int 7))
1911 (set (match_operand:DI 0 "register_operand" "")
1912 (ashiftrt:DI (match_dup 4) (const_int 48)))]
1913 "! WORDS_BIG_ENDIAN"
1915 operands[2] = gen_reg_rtx (DImode);
1916 operands[3] = gen_reg_rtx (DImode);
1917 operands[4] = gen_reg_rtx (DImode);
1920 (define_expand "unaligned_extendhidi_be"
1921 [(set (match_dup 2) (match_operand:DI 1 "address_operand" ""))
1922 (set (match_dup 3) (plus:DI (match_dup 2) (const_int -2)))
1924 (mem:DI (and:DI (match_dup 3)
1926 (set (match_dup 5) (plus:DI (match_dup 2) (const_int -3)))
1928 (ashift:DI (match_dup 4)
1931 (plus:DI (match_dup 5) (const_int 1))
1934 (set (match_operand:DI 0 "register_operand" "")
1935 (ashiftrt:DI (match_dup 6) (const_int 48)))]
1938 operands[2] = gen_reg_rtx (DImode);
1939 operands[3] = gen_reg_rtx (DImode);
1940 operands[4] = gen_reg_rtx (DImode);
1941 operands[5] = gen_reg_rtx (DImode);
1942 operands[6] = gen_reg_rtx (DImode);
1945 (define_insn "*extxl_const"
1946 [(set (match_operand:DI 0 "register_operand" "=r")
1947 (zero_extract:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
1948 (match_operand:DI 2 "mode_width_operand" "n")
1949 (match_operand:DI 3 "mul8_operand" "I")))]
1951 "ext%M2l %r1,%s3,%0"
1952 [(set_attr "type" "shift")])
1954 (define_insn "extxl_le"
1955 [(set (match_operand:DI 0 "register_operand" "=r")
1956 (zero_extract:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
1957 (match_operand:DI 2 "mode_width_operand" "n")
1958 (ashift:DI (match_operand:DI 3 "reg_or_8bit_operand" "rI")
1960 "! WORDS_BIG_ENDIAN"
1962 [(set_attr "type" "shift")])
1964 (define_insn "extxl_be"
1965 [(set (match_operand:DI 0 "register_operand" "=r")
1966 (zero_extract:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
1967 (match_operand:DI 2 "mode_width_operand" "n")
1971 (match_operand:DI 3 "reg_or_8bit_operand" "rI")
1975 [(set_attr "type" "shift")])
1977 ;; Combine has some strange notion of preserving existing undefined behaviour
1978 ;; in shifts larger than a word size. So capture these patterns that it
1979 ;; should have turned into zero_extracts.
1981 (define_insn "*extxl_1_le"
1982 [(set (match_operand:DI 0 "register_operand" "=r")
1983 (and:DI (lshiftrt:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
1984 (ashift:DI (match_operand:DI 2 "reg_or_8bit_operand" "rI")
1986 (match_operand:DI 3 "mode_mask_operand" "n")))]
1987 "! WORDS_BIG_ENDIAN"
1989 [(set_attr "type" "shift")])
1991 (define_insn "*extxl_1_be"
1992 [(set (match_operand:DI 0 "register_operand" "=r")
1993 (and:DI (lshiftrt:DI
1994 (match_operand:DI 1 "reg_or_0_operand" "rJ")
1995 (minus:DI (const_int 56)
1996 (ashift:DI (match_operand:DI 2 "reg_or_8bit_operand" "rI")
1998 (match_operand:DI 3 "mode_mask_operand" "n")))]
2001 [(set_attr "type" "shift")])
2003 (define_insn "*extql_2_le"
2004 [(set (match_operand:DI 0 "register_operand" "=r")
2005 (lshiftrt:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
2006 (ashift:DI (match_operand:DI 2 "reg_or_8bit_operand" "rI")
2008 "! WORDS_BIG_ENDIAN"
2010 [(set_attr "type" "shift")])
2012 (define_insn "*extql_2_be"
2013 [(set (match_operand:DI 0 "register_operand" "=r")
2015 (match_operand:DI 1 "reg_or_0_operand" "rJ")
2016 (minus:DI (const_int 56)
2018 (match_operand:DI 2 "reg_or_8bit_operand" "rI")
2022 [(set_attr "type" "shift")])
2024 (define_insn "extqh_le"
2025 [(set (match_operand:DI 0 "register_operand" "=r")
2027 (match_operand:DI 1 "reg_or_0_operand" "rJ")
2028 (minus:DI (const_int 64)
2031 (match_operand:DI 2 "reg_or_8bit_operand" "rI")
2034 "! WORDS_BIG_ENDIAN"
2036 [(set_attr "type" "shift")])
2038 (define_insn "extqh_be"
2039 [(set (match_operand:DI 0 "register_operand" "=r")
2041 (match_operand:DI 1 "reg_or_0_operand" "rJ")
2044 (plus:DI (match_operand:DI 2 "reg_or_8bit_operand" "rI")
2050 [(set_attr "type" "shift")])
2052 (define_insn "extlh_le"
2053 [(set (match_operand:DI 0 "register_operand" "=r")
2055 (and:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
2056 (const_int 2147483647))
2057 (minus:DI (const_int 64)
2060 (match_operand:DI 2 "reg_or_8bit_operand" "rI")
2063 "! WORDS_BIG_ENDIAN"
2065 [(set_attr "type" "shift")])
2067 (define_insn "extlh_be"
2068 [(set (match_operand:DI 0 "register_operand" "=r")
2071 (match_operand:DI 1 "reg_or_0_operand" "rJ")
2075 (match_operand:DI 2 "reg_or_8bit_operand" "rI")
2079 (const_int 2147483647)))]
2082 [(set_attr "type" "shift")])
2084 (define_insn "extwh_le"
2085 [(set (match_operand:DI 0 "register_operand" "=r")
2087 (and:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
2089 (minus:DI (const_int 64)
2092 (match_operand:DI 2 "reg_or_8bit_operand" "rI")
2095 "! WORDS_BIG_ENDIAN"
2097 [(set_attr "type" "shift")])
2099 (define_insn "extwh_be"
2100 [(set (match_operand:DI 0 "register_operand" "=r")
2102 (ashift:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
2106 (match_operand:DI 2 "reg_or_8bit_operand" "rI")
2110 (const_int 65535)))]
2113 [(set_attr "type" "shift")])
2115 ;; This converts an extXl into an extXh with an appropriate adjustment
2116 ;; to the address calculation.
2119 ;; [(set (match_operand:DI 0 "register_operand" "")
2120 ;; (ashift:DI (zero_extract:DI (match_operand:DI 1 "register_operand" "")
2121 ;; (match_operand:DI 2 "mode_width_operand" "")
2122 ;; (ashift:DI (match_operand:DI 3 "" "")
2124 ;; (match_operand:DI 4 "const_int_operand" "")))
2125 ;; (clobber (match_operand:DI 5 "register_operand" ""))]
2126 ;; "INTVAL (operands[4]) == 64 - INTVAL (operands[2])"
2127 ;; [(set (match_dup 5) (match_dup 6))
2128 ;; (set (match_dup 0)
2129 ;; (ashift:DI (zero_extract:DI (match_dup 1) (match_dup 2)
2130 ;; (ashift:DI (plus:DI (match_dup 5)
2136 ;; operands[6] = plus_constant (operands[3],
2137 ;; INTVAL (operands[2]) / BITS_PER_UNIT);
2138 ;; operands[7] = GEN_INT (- INTVAL (operands[2]) / BITS_PER_UNIT);
2141 (define_insn "*insbl_const"
2142 [(set (match_operand:DI 0 "register_operand" "=r")
2143 (ashift:DI (zero_extend:DI (match_operand:QI 1 "register_operand" "r"))
2144 (match_operand:DI 2 "mul8_operand" "I")))]
2147 [(set_attr "type" "shift")])
2149 (define_insn "*inswl_const"
2150 [(set (match_operand:DI 0 "register_operand" "=r")
2151 (ashift:DI (zero_extend:DI (match_operand:HI 1 "register_operand" "r"))
2152 (match_operand:DI 2 "mul8_operand" "I")))]
2155 [(set_attr "type" "shift")])
2157 (define_insn "*insll_const"
2158 [(set (match_operand:DI 0 "register_operand" "=r")
2159 (ashift:DI (zero_extend:DI (match_operand:SI 1 "register_operand" "r"))
2160 (match_operand:DI 2 "mul8_operand" "I")))]
2163 [(set_attr "type" "shift")])
2165 (define_insn "insbl_le"
2166 [(set (match_operand:DI 0 "register_operand" "=r")
2167 (ashift:DI (zero_extend:DI (match_operand:QI 1 "register_operand" "r"))
2168 (ashift:DI (match_operand:DI 2 "reg_or_8bit_operand" "rI")
2170 "! WORDS_BIG_ENDIAN"
2172 [(set_attr "type" "shift")])
2174 (define_insn "insbl_be"
2175 [(set (match_operand:DI 0 "register_operand" "=r")
2176 (ashift:DI (zero_extend:DI (match_operand:QI 1 "register_operand" "r"))
2177 (minus:DI (const_int 56)
2178 (ashift:DI (match_operand:DI 2 "reg_or_8bit_operand" "rI")
2182 [(set_attr "type" "shift")])
2184 (define_insn "inswl_le"
2185 [(set (match_operand:DI 0 "register_operand" "=r")
2186 (ashift:DI (zero_extend:DI (match_operand:HI 1 "register_operand" "r"))
2187 (ashift:DI (match_operand:DI 2 "reg_or_8bit_operand" "rI")
2189 "! WORDS_BIG_ENDIAN"
2191 [(set_attr "type" "shift")])
2193 (define_insn "inswl_be"
2194 [(set (match_operand:DI 0 "register_operand" "=r")
2195 (ashift:DI (zero_extend:DI (match_operand:HI 1 "register_operand" "r"))
2196 (minus:DI (const_int 56)
2197 (ashift:DI (match_operand:DI 2 "reg_or_8bit_operand" "rI")
2201 [(set_attr "type" "shift")])
2203 (define_insn "insll_le"
2204 [(set (match_operand:DI 0 "register_operand" "=r")
2205 (ashift:DI (zero_extend:DI (match_operand:SI 1 "register_operand" "r"))
2206 (ashift:DI (match_operand:DI 2 "reg_or_8bit_operand" "rI")
2208 "! WORDS_BIG_ENDIAN"
2210 [(set_attr "type" "shift")])
2212 (define_insn "insll_be"
2213 [(set (match_operand:DI 0 "register_operand" "=r")
2214 (ashift:DI (zero_extend:DI (match_operand:SI 1 "register_operand" "r"))
2215 (minus:DI (const_int 56)
2216 (ashift:DI (match_operand:DI 2 "reg_or_8bit_operand" "rI")
2220 [(set_attr "type" "shift")])
2222 (define_insn "insql_le"
2223 [(set (match_operand:DI 0 "register_operand" "=r")
2224 (ashift:DI (match_operand:DI 1 "register_operand" "r")
2225 (ashift:DI (match_operand:DI 2 "reg_or_8bit_operand" "rI")
2227 "! WORDS_BIG_ENDIAN"
2229 [(set_attr "type" "shift")])
2231 (define_insn "insql_be"
2232 [(set (match_operand:DI 0 "register_operand" "=r")
2233 (ashift:DI (match_operand:DI 1 "register_operand" "r")
2234 (minus:DI (const_int 56)
2235 (ashift:DI (match_operand:DI 2 "reg_or_8bit_operand" "rI")
2239 [(set_attr "type" "shift")])
2241 ;; Combine has this sometimes habit of moving the and outside of the
2242 ;; shift, making life more interesting.
2244 (define_insn "*insxl"
2245 [(set (match_operand:DI 0 "register_operand" "=r")
2246 (and:DI (ashift:DI (match_operand:DI 1 "register_operand" "r")
2247 (match_operand:DI 2 "mul8_operand" "I"))
2248 (match_operand:DI 3 "immediate_operand" "i")))]
2249 "HOST_BITS_PER_WIDE_INT == 64
2250 && GET_CODE (operands[3]) == CONST_INT
2251 && (((unsigned HOST_WIDE_INT) 0xff << INTVAL (operands[2])
2252 == (unsigned HOST_WIDE_INT) INTVAL (operands[3]))
2253 || ((unsigned HOST_WIDE_INT) 0xffff << INTVAL (operands[2])
2254 == (unsigned HOST_WIDE_INT) INTVAL (operands[3]))
2255 || ((unsigned HOST_WIDE_INT) 0xffffffff << INTVAL (operands[2])
2256 == (unsigned HOST_WIDE_INT) INTVAL (operands[3])))"
2258 #if HOST_BITS_PER_WIDE_INT == 64
2259 if ((unsigned HOST_WIDE_INT) 0xff << INTVAL (operands[2])
2260 == (unsigned HOST_WIDE_INT) INTVAL (operands[3]))
2261 return "insbl %1,%s2,%0";
2262 if ((unsigned HOST_WIDE_INT) 0xffff << INTVAL (operands[2])
2263 == (unsigned HOST_WIDE_INT) INTVAL (operands[3]))
2264 return "inswl %1,%s2,%0";
2265 if ((unsigned HOST_WIDE_INT) 0xffffffff << INTVAL (operands[2])
2266 == (unsigned HOST_WIDE_INT) INTVAL (operands[3]))
2267 return "insll %1,%s2,%0";
2271 [(set_attr "type" "shift")])
2273 ;; We do not include the insXh insns because they are complex to express
2274 ;; and it does not appear that we would ever want to generate them.
2276 ;; Since we need them for block moves, though, cop out and use unspec.
2278 (define_insn "insxh"
2279 [(set (match_operand:DI 0 "register_operand" "=r")
2280 (unspec:DI [(match_operand:DI 1 "register_operand" "r")
2281 (match_operand:DI 2 "mode_width_operand" "n")
2282 (match_operand:DI 3 "reg_or_8bit_operand" "rI")]
2286 [(set_attr "type" "shift")])
2288 (define_insn "mskxl_le"
2289 [(set (match_operand:DI 0 "register_operand" "=r")
2290 (and:DI (not:DI (ashift:DI
2291 (match_operand:DI 2 "mode_mask_operand" "n")
2293 (match_operand:DI 3 "reg_or_8bit_operand" "rI")
2295 (match_operand:DI 1 "reg_or_0_operand" "rJ")))]
2296 "! WORDS_BIG_ENDIAN"
2298 [(set_attr "type" "shift")])
2300 (define_insn "mskxl_be"
2301 [(set (match_operand:DI 0 "register_operand" "=r")
2302 (and:DI (not:DI (ashift:DI
2303 (match_operand:DI 2 "mode_mask_operand" "n")
2304 (minus:DI (const_int 56)
2306 (match_operand:DI 3 "reg_or_8bit_operand" "rI")
2308 (match_operand:DI 1 "reg_or_0_operand" "rJ")))]
2311 [(set_attr "type" "shift")])
2313 ;; We do not include the mskXh insns because it does not appear we would
2314 ;; ever generate one.
2316 ;; Again, we do for block moves and we use unspec again.
2318 (define_insn "mskxh"
2319 [(set (match_operand:DI 0 "register_operand" "=r")
2320 (unspec:DI [(match_operand:DI 1 "register_operand" "r")
2321 (match_operand:DI 2 "mode_width_operand" "n")
2322 (match_operand:DI 3 "reg_or_8bit_operand" "rI")]
2326 [(set_attr "type" "shift")])
2328 ;; Prefer AND + NE over LSHIFTRT + AND.
2330 (define_insn_and_split "*ze_and_ne"
2331 [(set (match_operand:DI 0 "register_operand" "=r")
2332 (zero_extract:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
2334 (match_operand 2 "const_int_operand" "I")))]
2335 "(unsigned HOST_WIDE_INT) INTVAL (operands[2]) < 8"
2337 "(unsigned HOST_WIDE_INT) INTVAL (operands[2]) < 8"
2339 (and:DI (match_dup 1) (match_dup 3)))
2341 (ne:DI (match_dup 0) (const_int 0)))]
2342 "operands[3] = GEN_INT (1 << INTVAL (operands[2]));")
2344 ;; Floating-point operations. All the double-precision insns can extend
2345 ;; from single, so indicate that. The exception are the ones that simply
2346 ;; play with the sign bits; it's not clear what to do there.
2348 (define_insn "abssf2"
2349 [(set (match_operand:SF 0 "register_operand" "=f")
2350 (abs:SF (match_operand:SF 1 "reg_or_fp0_operand" "fG")))]
2353 [(set_attr "type" "fcpys")])
2355 (define_insn "*nabssf2"
2356 [(set (match_operand:SF 0 "register_operand" "=f")
2357 (neg:SF (abs:SF (match_operand:SF 1 "reg_or_fp0_operand" "fG"))))]
2360 [(set_attr "type" "fadd")])
2362 (define_insn "absdf2"
2363 [(set (match_operand:DF 0 "register_operand" "=f")
2364 (abs:DF (match_operand:DF 1 "reg_or_fp0_operand" "fG")))]
2367 [(set_attr "type" "fcpys")])
2369 (define_insn "*nabsdf2"
2370 [(set (match_operand:DF 0 "register_operand" "=f")
2371 (neg:DF (abs:DF (match_operand:DF 1 "reg_or_fp0_operand" "fG"))))]
2374 [(set_attr "type" "fadd")])
2376 (define_expand "abstf2"
2377 [(parallel [(set (match_operand:TF 0 "register_operand" "")
2378 (neg:TF (match_operand:TF 1 "reg_or_fp0_operand" "")))
2379 (use (match_dup 2))])]
2380 "TARGET_HAS_XFLOATING_LIBS"
2382 #if HOST_BITS_PER_WIDE_INT >= 64
2383 operands[2] = force_reg (DImode, GEN_INT ((HOST_WIDE_INT) 1 << 63));
2385 operands[2] = force_reg (DImode, immed_double_const (0, 0x80000000, DImode));
2389 (define_insn_and_split "*abstf_internal"
2390 [(set (match_operand:TF 0 "register_operand" "=r")
2391 (abs:TF (match_operand:TF 1 "reg_or_fp0_operand" "rG")))
2392 (use (match_operand:DI 2 "register_operand" "r"))]
2393 "TARGET_HAS_XFLOATING_LIBS"
2395 "&& reload_completed"
2397 "alpha_split_tfmode_frobsign (operands, gen_andnotdi3); DONE;")
2399 (define_insn "negsf2"
2400 [(set (match_operand:SF 0 "register_operand" "=f")
2401 (neg:SF (match_operand:SF 1 "reg_or_fp0_operand" "fG")))]
2404 [(set_attr "type" "fadd")])
2406 (define_insn "negdf2"
2407 [(set (match_operand:DF 0 "register_operand" "=f")
2408 (neg:DF (match_operand:DF 1 "reg_or_fp0_operand" "fG")))]
2411 [(set_attr "type" "fadd")])
2413 (define_expand "negtf2"
2414 [(parallel [(set (match_operand:TF 0 "register_operand" "")
2415 (neg:TF (match_operand:TF 1 "reg_or_fp0_operand" "")))
2416 (use (match_dup 2))])]
2417 "TARGET_HAS_XFLOATING_LIBS"
2419 #if HOST_BITS_PER_WIDE_INT >= 64
2420 operands[2] = force_reg (DImode, GEN_INT ((HOST_WIDE_INT) 1 << 63));
2422 operands[2] = force_reg (DImode, immed_double_const (0, 0x80000000, DImode));
2426 (define_insn_and_split "*negtf_internal"
2427 [(set (match_operand:TF 0 "register_operand" "=r")
2428 (neg:TF (match_operand:TF 1 "reg_or_fp0_operand" "rG")))
2429 (use (match_operand:DI 2 "register_operand" "r"))]
2430 "TARGET_HAS_XFLOATING_LIBS"
2432 "&& reload_completed"
2434 "alpha_split_tfmode_frobsign (operands, gen_xordi3); DONE;")
2436 (define_insn "*addsf_ieee"
2437 [(set (match_operand:SF 0 "register_operand" "=&f")
2438 (plus:SF (match_operand:SF 1 "reg_or_fp0_operand" "%fG")
2439 (match_operand:SF 2 "reg_or_fp0_operand" "fG")))]
2440 "TARGET_FP && alpha_fptm >= ALPHA_FPTM_SU"
2441 "add%,%/ %R1,%R2,%0"
2442 [(set_attr "type" "fadd")
2443 (set_attr "trap" "yes")
2444 (set_attr "round_suffix" "normal")
2445 (set_attr "trap_suffix" "u_su_sui")])
2447 (define_insn "addsf3"
2448 [(set (match_operand:SF 0 "register_operand" "=f")
2449 (plus:SF (match_operand:SF 1 "reg_or_fp0_operand" "%fG")
2450 (match_operand:SF 2 "reg_or_fp0_operand" "fG")))]
2452 "add%,%/ %R1,%R2,%0"
2453 [(set_attr "type" "fadd")
2454 (set_attr "trap" "yes")
2455 (set_attr "round_suffix" "normal")
2456 (set_attr "trap_suffix" "u_su_sui")])
2458 (define_insn "*adddf_ieee"
2459 [(set (match_operand:DF 0 "register_operand" "=&f")
2460 (plus:DF (match_operand:DF 1 "reg_or_fp0_operand" "%fG")
2461 (match_operand:DF 2 "reg_or_fp0_operand" "fG")))]
2462 "TARGET_FP && alpha_fptm >= ALPHA_FPTM_SU"
2463 "add%-%/ %R1,%R2,%0"
2464 [(set_attr "type" "fadd")
2465 (set_attr "trap" "yes")
2466 (set_attr "round_suffix" "normal")
2467 (set_attr "trap_suffix" "u_su_sui")])
2469 (define_insn "adddf3"
2470 [(set (match_operand:DF 0 "register_operand" "=f")
2471 (plus:DF (match_operand:DF 1 "reg_or_fp0_operand" "%fG")
2472 (match_operand:DF 2 "reg_or_fp0_operand" "fG")))]
2474 "add%-%/ %R1,%R2,%0"
2475 [(set_attr "type" "fadd")
2476 (set_attr "trap" "yes")
2477 (set_attr "round_suffix" "normal")
2478 (set_attr "trap_suffix" "u_su_sui")])
2480 (define_insn "*adddf_ext1"
2481 [(set (match_operand:DF 0 "register_operand" "=f")
2482 (plus:DF (float_extend:DF
2483 (match_operand:SF 1 "reg_or_fp0_operand" "fG"))
2484 (match_operand:DF 2 "reg_or_fp0_operand" "fG")))]
2485 "TARGET_FP && alpha_fptm < ALPHA_FPTM_SU"
2486 "add%-%/ %R1,%R2,%0"
2487 [(set_attr "type" "fadd")
2488 (set_attr "trap" "yes")
2489 (set_attr "round_suffix" "normal")
2490 (set_attr "trap_suffix" "u_su_sui")])
2492 (define_insn "*adddf_ext2"
2493 [(set (match_operand:DF 0 "register_operand" "=f")
2494 (plus:DF (float_extend:DF
2495 (match_operand:SF 1 "reg_or_fp0_operand" "%fG"))
2497 (match_operand:SF 2 "reg_or_fp0_operand" "fG"))))]
2498 "TARGET_FP && alpha_fptm < ALPHA_FPTM_SU"
2499 "add%-%/ %R1,%R2,%0"
2500 [(set_attr "type" "fadd")
2501 (set_attr "trap" "yes")
2502 (set_attr "round_suffix" "normal")
2503 (set_attr "trap_suffix" "u_su_sui")])
2505 (define_expand "addtf3"
2506 [(use (match_operand 0 "register_operand" ""))
2507 (use (match_operand 1 "general_operand" ""))
2508 (use (match_operand 2 "general_operand" ""))]
2509 "TARGET_HAS_XFLOATING_LIBS"
2510 "alpha_emit_xfloating_arith (PLUS, operands); DONE;")
2512 ;; Define conversion operators between DFmode and SImode, using the cvtql
2513 ;; instruction. To allow combine et al to do useful things, we keep the
2514 ;; operation as a unit until after reload, at which point we split the
2517 ;; Note that we (attempt to) only consider this optimization when the
2518 ;; ultimate destination is memory. If we will be doing further integer
2519 ;; processing, it is cheaper to do the truncation in the int regs.
2521 (define_insn "*cvtql"
2522 [(set (match_operand:SI 0 "register_operand" "=f")
2523 (unspec:SI [(match_operand:DI 1 "reg_or_fp0_operand" "fG")]
2527 [(set_attr "type" "fadd")
2528 (set_attr "trap" "yes")
2529 (set_attr "trap_suffix" "v_sv")])
2531 (define_insn_and_split "*fix_truncdfsi_ieee"
2532 [(set (match_operand:SI 0 "memory_operand" "=m")
2533 (subreg:SI (fix:DI (match_operand:DF 1 "reg_or_fp0_operand" "fG")) 0))
2534 (clobber (match_scratch:DI 2 "=&f"))
2535 (clobber (match_scratch:SI 3 "=&f"))]
2536 "TARGET_FP && alpha_fptm >= ALPHA_FPTM_SU"
2538 "&& reload_completed"
2539 [(set (match_dup 2) (fix:DI (match_dup 1)))
2540 (set (match_dup 3) (unspec:SI [(match_dup 2)] UNSPEC_CVTQL))
2541 (set (match_dup 0) (match_dup 3))]
2543 [(set_attr "type" "fadd")
2544 (set_attr "trap" "yes")])
2546 (define_insn_and_split "*fix_truncdfsi_internal"
2547 [(set (match_operand:SI 0 "memory_operand" "=m")
2548 (subreg:SI (fix:DI (match_operand:DF 1 "reg_or_fp0_operand" "fG")) 0))
2549 (clobber (match_scratch:DI 2 "=f"))]
2550 "TARGET_FP && alpha_fptm < ALPHA_FPTM_SU"
2552 "&& reload_completed"
2553 [(set (match_dup 2) (fix:DI (match_dup 1)))
2554 (set (match_dup 3) (unspec:SI [(match_dup 2)] UNSPEC_CVTQL))
2555 (set (match_dup 0) (match_dup 3))]
2556 ;; Due to REG_CANNOT_CHANGE_SIZE issues, we cannot simply use SUBREG.
2557 "operands[3] = gen_rtx_REG (SImode, REGNO (operands[2]));"
2558 [(set_attr "type" "fadd")
2559 (set_attr "trap" "yes")])
2561 (define_insn "*fix_truncdfdi_ieee"
2562 [(set (match_operand:DI 0 "reg_no_subreg_operand" "=&f")
2563 (fix:DI (match_operand:DF 1 "reg_or_fp0_operand" "fG")))]
2564 "TARGET_FP && alpha_fptm >= ALPHA_FPTM_SU"
2566 [(set_attr "type" "fadd")
2567 (set_attr "trap" "yes")
2568 (set_attr "round_suffix" "c")
2569 (set_attr "trap_suffix" "v_sv_svi")])
2571 (define_insn "fix_truncdfdi2"
2572 [(set (match_operand:DI 0 "reg_no_subreg_operand" "=f")
2573 (fix:DI (match_operand:DF 1 "reg_or_fp0_operand" "fG")))]
2576 [(set_attr "type" "fadd")
2577 (set_attr "trap" "yes")
2578 (set_attr "round_suffix" "c")
2579 (set_attr "trap_suffix" "v_sv_svi")])
2581 ;; Likewise between SFmode and SImode.
2583 (define_insn_and_split "*fix_truncsfsi_ieee"
2584 [(set (match_operand:SI 0 "memory_operand" "=m")
2585 (subreg:SI (fix:DI (float_extend:DF
2586 (match_operand:SF 1 "reg_or_fp0_operand" "fG"))) 0))
2587 (clobber (match_scratch:DI 2 "=&f"))
2588 (clobber (match_scratch:SI 3 "=&f"))]
2589 "TARGET_FP && alpha_fptm >= ALPHA_FPTM_SU"
2591 "&& reload_completed"
2592 [(set (match_dup 2) (fix:DI (float_extend:DF (match_dup 1))))
2593 (set (match_dup 3) (unspec:SI [(match_dup 2)] UNSPEC_CVTQL))
2594 (set (match_dup 0) (match_dup 3))]
2596 [(set_attr "type" "fadd")
2597 (set_attr "trap" "yes")])
2599 (define_insn_and_split "*fix_truncsfsi_internal"
2600 [(set (match_operand:SI 0 "memory_operand" "=m")
2601 (subreg:SI (fix:DI (float_extend:DF
2602 (match_operand:SF 1 "reg_or_fp0_operand" "fG"))) 0))
2603 (clobber (match_scratch:DI 2 "=f"))]
2604 "TARGET_FP && alpha_fptm < ALPHA_FPTM_SU"
2606 "&& reload_completed"
2607 [(set (match_dup 2) (fix:DI (float_extend:DF (match_dup 1))))
2608 (set (match_dup 3) (unspec:SI [(match_dup 2)] UNSPEC_CVTQL))
2609 (set (match_dup 0) (match_dup 3))]
2610 ;; Due to REG_CANNOT_CHANGE_SIZE issues, we cannot simply use SUBREG.
2611 "operands[3] = gen_rtx_REG (SImode, REGNO (operands[2]));"
2612 [(set_attr "type" "fadd")
2613 (set_attr "trap" "yes")])
2615 (define_insn "*fix_truncsfdi_ieee"
2616 [(set (match_operand:DI 0 "reg_no_subreg_operand" "=&f")
2617 (fix:DI (float_extend:DF
2618 (match_operand:SF 1 "reg_or_fp0_operand" "fG"))))]
2619 "TARGET_FP && alpha_fptm >= ALPHA_FPTM_SU"
2621 [(set_attr "type" "fadd")
2622 (set_attr "trap" "yes")
2623 (set_attr "round_suffix" "c")
2624 (set_attr "trap_suffix" "v_sv_svi")])
2626 (define_insn "fix_truncsfdi2"
2627 [(set (match_operand:DI 0 "reg_no_subreg_operand" "=f")
2628 (fix:DI (float_extend:DF
2629 (match_operand:SF 1 "reg_or_fp0_operand" "fG"))))]
2632 [(set_attr "type" "fadd")
2633 (set_attr "trap" "yes")
2634 (set_attr "round_suffix" "c")
2635 (set_attr "trap_suffix" "v_sv_svi")])
2637 (define_expand "fix_trunctfdi2"
2638 [(use (match_operand:DI 0 "register_operand" ""))
2639 (use (match_operand:TF 1 "general_operand" ""))]
2640 "TARGET_HAS_XFLOATING_LIBS"
2641 "alpha_emit_xfloating_cvt (FIX, operands); DONE;")
2643 (define_insn "*floatdisf_ieee"
2644 [(set (match_operand:SF 0 "register_operand" "=&f")
2645 (float:SF (match_operand:DI 1 "reg_no_subreg_operand" "f")))]
2646 "TARGET_FP && alpha_fptm >= ALPHA_FPTM_SU"
2648 [(set_attr "type" "fadd")
2649 (set_attr "trap" "yes")
2650 (set_attr "round_suffix" "normal")
2651 (set_attr "trap_suffix" "sui")])
2653 (define_insn "floatdisf2"
2654 [(set (match_operand:SF 0 "register_operand" "=f")
2655 (float:SF (match_operand:DI 1 "reg_no_subreg_operand" "f")))]
2658 [(set_attr "type" "fadd")
2659 (set_attr "trap" "yes")
2660 (set_attr "round_suffix" "normal")
2661 (set_attr "trap_suffix" "sui")])
2663 (define_insn "*floatdidf_ieee"
2664 [(set (match_operand:DF 0 "register_operand" "=&f")
2665 (float:DF (match_operand:DI 1 "reg_no_subreg_operand" "f")))]
2666 "TARGET_FP && alpha_fptm >= ALPHA_FPTM_SU"
2668 [(set_attr "type" "fadd")
2669 (set_attr "trap" "yes")
2670 (set_attr "round_suffix" "normal")
2671 (set_attr "trap_suffix" "sui")])
2673 (define_insn "floatdidf2"
2674 [(set (match_operand:DF 0 "register_operand" "=f")
2675 (float:DF (match_operand:DI 1 "reg_no_subreg_operand" "f")))]
2678 [(set_attr "type" "fadd")
2679 (set_attr "trap" "yes")
2680 (set_attr "round_suffix" "normal")
2681 (set_attr "trap_suffix" "sui")])
2683 (define_expand "floatditf2"
2684 [(use (match_operand:TF 0 "register_operand" ""))
2685 (use (match_operand:DI 1 "general_operand" ""))]
2686 "TARGET_HAS_XFLOATING_LIBS"
2687 "alpha_emit_xfloating_cvt (FLOAT, operands); DONE;")
2689 (define_expand "floatunsdisf2"
2690 [(use (match_operand:SF 0 "register_operand" ""))
2691 (use (match_operand:DI 1 "register_operand" ""))]
2693 "alpha_emit_floatuns (operands); DONE;")
2695 (define_expand "floatunsdidf2"
2696 [(use (match_operand:DF 0 "register_operand" ""))
2697 (use (match_operand:DI 1 "register_operand" ""))]
2699 "alpha_emit_floatuns (operands); DONE;")
2701 (define_expand "floatunsditf2"
2702 [(use (match_operand:TF 0 "register_operand" ""))
2703 (use (match_operand:DI 1 "general_operand" ""))]
2704 "TARGET_HAS_XFLOATING_LIBS"
2705 "alpha_emit_xfloating_cvt (UNSIGNED_FLOAT, operands); DONE;")
2707 (define_expand "extendsfdf2"
2708 [(set (match_operand:DF 0 "register_operand" "")
2709 (float_extend:DF (match_operand:SF 1 "nonimmediate_operand" "")))]
2712 if (alpha_fptm >= ALPHA_FPTM_SU)
2713 operands[1] = force_reg (SFmode, operands[1]);
2716 ;; The Unicos/Mk assembler doesn't support cvtst, but we've already
2717 ;; asserted that alpha_fptm == ALPHA_FPTM_N.
2719 (define_insn "*extendsfdf2_ieee"
2720 [(set (match_operand:DF 0 "register_operand" "=&f")
2721 (float_extend:DF (match_operand:SF 1 "register_operand" "f")))]
2722 "TARGET_FP && alpha_fptm >= ALPHA_FPTM_SU"
2724 [(set_attr "type" "fadd")
2725 (set_attr "trap" "yes")])
2727 (define_insn "*extendsfdf2_internal"
2728 [(set (match_operand:DF 0 "register_operand" "=f,f,m")
2729 (float_extend:DF (match_operand:SF 1 "nonimmediate_operand" "f,m,f")))]
2730 "TARGET_FP && alpha_fptm < ALPHA_FPTM_SU"
2735 [(set_attr "type" "fcpys,fld,fst")])
2737 (define_expand "extendsftf2"
2738 [(use (match_operand:TF 0 "register_operand" ""))
2739 (use (match_operand:SF 1 "general_operand" ""))]
2740 "TARGET_HAS_XFLOATING_LIBS"
2742 rtx tmp = gen_reg_rtx (DFmode);
2743 emit_insn (gen_extendsfdf2 (tmp, operands[1]));
2744 emit_insn (gen_extenddftf2 (operands[0], tmp));
2748 (define_expand "extenddftf2"
2749 [(use (match_operand:TF 0 "register_operand" ""))
2750 (use (match_operand:DF 1 "general_operand" ""))]
2751 "TARGET_HAS_XFLOATING_LIBS"
2752 "alpha_emit_xfloating_cvt (FLOAT_EXTEND, operands); DONE;")
2754 (define_insn "*truncdfsf2_ieee"
2755 [(set (match_operand:SF 0 "register_operand" "=&f")
2756 (float_truncate:SF (match_operand:DF 1 "reg_or_fp0_operand" "fG")))]
2757 "TARGET_FP && alpha_fptm >= ALPHA_FPTM_SU"
2759 [(set_attr "type" "fadd")
2760 (set_attr "trap" "yes")
2761 (set_attr "round_suffix" "normal")
2762 (set_attr "trap_suffix" "u_su_sui")])
2764 (define_insn "truncdfsf2"
2765 [(set (match_operand:SF 0 "register_operand" "=f")
2766 (float_truncate:SF (match_operand:DF 1 "reg_or_fp0_operand" "fG")))]
2769 [(set_attr "type" "fadd")
2770 (set_attr "trap" "yes")
2771 (set_attr "round_suffix" "normal")
2772 (set_attr "trap_suffix" "u_su_sui")])
2774 (define_expand "trunctfdf2"
2775 [(use (match_operand:DF 0 "register_operand" ""))
2776 (use (match_operand:TF 1 "general_operand" ""))]
2777 "TARGET_HAS_XFLOATING_LIBS"
2778 "alpha_emit_xfloating_cvt (FLOAT_TRUNCATE, operands); DONE;")
2780 (define_expand "trunctfsf2"
2781 [(use (match_operand:SF 0 "register_operand" ""))
2782 (use (match_operand:TF 1 "general_operand" ""))]
2783 "TARGET_FP && TARGET_HAS_XFLOATING_LIBS"
2785 rtx tmpf, sticky, arg, lo, hi;
2787 tmpf = gen_reg_rtx (DFmode);
2788 sticky = gen_reg_rtx (DImode);
2789 arg = copy_to_mode_reg (TFmode, operands[1]);
2790 lo = gen_lowpart (DImode, arg);
2791 hi = gen_highpart (DImode, arg);
2793 /* Convert the low word of the TFmode value into a sticky rounding bit,
2794 then or it into the low bit of the high word. This leaves the sticky
2795 bit at bit 48 of the fraction, which is representable in DFmode,
2796 which prevents rounding error in the final conversion to SFmode. */
2798 emit_insn (gen_rtx_SET (VOIDmode, sticky,
2799 gen_rtx_NE (DImode, lo, const0_rtx)));
2800 emit_insn (gen_iordi3 (hi, hi, sticky));
2801 emit_insn (gen_trunctfdf2 (tmpf, arg));
2802 emit_insn (gen_truncdfsf2 (operands[0], tmpf));
2806 (define_insn "*divsf3_ieee"
2807 [(set (match_operand:SF 0 "register_operand" "=&f")
2808 (div:SF (match_operand:SF 1 "reg_or_fp0_operand" "fG")
2809 (match_operand:SF 2 "reg_or_fp0_operand" "fG")))]
2810 "TARGET_FP && alpha_fptm >= ALPHA_FPTM_SU"
2811 "div%,%/ %R1,%R2,%0"
2812 [(set_attr "type" "fdiv")
2813 (set_attr "opsize" "si")
2814 (set_attr "trap" "yes")
2815 (set_attr "round_suffix" "normal")
2816 (set_attr "trap_suffix" "u_su_sui")])
2818 (define_insn "divsf3"
2819 [(set (match_operand:SF 0 "register_operand" "=f")
2820 (div:SF (match_operand:SF 1 "reg_or_fp0_operand" "fG")
2821 (match_operand:SF 2 "reg_or_fp0_operand" "fG")))]
2823 "div%,%/ %R1,%R2,%0"
2824 [(set_attr "type" "fdiv")
2825 (set_attr "opsize" "si")
2826 (set_attr "trap" "yes")
2827 (set_attr "round_suffix" "normal")
2828 (set_attr "trap_suffix" "u_su_sui")])
2830 (define_insn "*divdf3_ieee"
2831 [(set (match_operand:DF 0 "register_operand" "=&f")
2832 (div:DF (match_operand:DF 1 "reg_or_fp0_operand" "fG")
2833 (match_operand:DF 2 "reg_or_fp0_operand" "fG")))]
2834 "TARGET_FP && alpha_fptm >= ALPHA_FPTM_SU"
2835 "div%-%/ %R1,%R2,%0"
2836 [(set_attr "type" "fdiv")
2837 (set_attr "trap" "yes")
2838 (set_attr "round_suffix" "normal")
2839 (set_attr "trap_suffix" "u_su_sui")])
2841 (define_insn "divdf3"
2842 [(set (match_operand:DF 0 "register_operand" "=f")
2843 (div:DF (match_operand:DF 1 "reg_or_fp0_operand" "fG")
2844 (match_operand:DF 2 "reg_or_fp0_operand" "fG")))]
2846 "div%-%/ %R1,%R2,%0"
2847 [(set_attr "type" "fdiv")
2848 (set_attr "trap" "yes")
2849 (set_attr "round_suffix" "normal")
2850 (set_attr "trap_suffix" "u_su_sui")])
2852 (define_insn "*divdf_ext1"
2853 [(set (match_operand:DF 0 "register_operand" "=f")
2854 (div:DF (float_extend:DF (match_operand:SF 1 "reg_or_fp0_operand" "fG"))
2855 (match_operand:DF 2 "reg_or_fp0_operand" "fG")))]
2856 "TARGET_FP && alpha_fptm < ALPHA_FPTM_SU"
2857 "div%-%/ %R1,%R2,%0"
2858 [(set_attr "type" "fdiv")
2859 (set_attr "trap" "yes")
2860 (set_attr "round_suffix" "normal")
2861 (set_attr "trap_suffix" "u_su_sui")])
2863 (define_insn "*divdf_ext2"
2864 [(set (match_operand:DF 0 "register_operand" "=f")
2865 (div:DF (match_operand:DF 1 "reg_or_fp0_operand" "fG")
2867 (match_operand:SF 2 "reg_or_fp0_operand" "fG"))))]
2868 "TARGET_FP && alpha_fptm < ALPHA_FPTM_SU"
2869 "div%-%/ %R1,%R2,%0"
2870 [(set_attr "type" "fdiv")
2871 (set_attr "trap" "yes")
2872 (set_attr "round_suffix" "normal")
2873 (set_attr "trap_suffix" "u_su_sui")])
2875 (define_insn "*divdf_ext3"
2876 [(set (match_operand:DF 0 "register_operand" "=f")
2877 (div:DF (float_extend:DF (match_operand:SF 1 "reg_or_fp0_operand" "fG"))
2878 (float_extend:DF (match_operand:SF 2 "reg_or_fp0_operand" "fG"))))]
2879 "TARGET_FP && alpha_fptm < ALPHA_FPTM_SU"
2880 "div%-%/ %R1,%R2,%0"
2881 [(set_attr "type" "fdiv")
2882 (set_attr "trap" "yes")
2883 (set_attr "round_suffix" "normal")
2884 (set_attr "trap_suffix" "u_su_sui")])
2886 (define_expand "divtf3"
2887 [(use (match_operand 0 "register_operand" ""))
2888 (use (match_operand 1 "general_operand" ""))
2889 (use (match_operand 2 "general_operand" ""))]
2890 "TARGET_HAS_XFLOATING_LIBS"
2891 "alpha_emit_xfloating_arith (DIV, operands); DONE;")
2893 (define_insn "*mulsf3_ieee"
2894 [(set (match_operand:SF 0 "register_operand" "=&f")
2895 (mult:SF (match_operand:SF 1 "reg_or_fp0_operand" "%fG")
2896 (match_operand:SF 2 "reg_or_fp0_operand" "fG")))]
2897 "TARGET_FP && alpha_fptm >= ALPHA_FPTM_SU"
2898 "mul%,%/ %R1,%R2,%0"
2899 [(set_attr "type" "fmul")
2900 (set_attr "trap" "yes")
2901 (set_attr "round_suffix" "normal")
2902 (set_attr "trap_suffix" "u_su_sui")])
2904 (define_insn "mulsf3"
2905 [(set (match_operand:SF 0 "register_operand" "=f")
2906 (mult:SF (match_operand:SF 1 "reg_or_fp0_operand" "%fG")
2907 (match_operand:SF 2 "reg_or_fp0_operand" "fG")))]
2909 "mul%,%/ %R1,%R2,%0"
2910 [(set_attr "type" "fmul")
2911 (set_attr "trap" "yes")
2912 (set_attr "round_suffix" "normal")
2913 (set_attr "trap_suffix" "u_su_sui")])
2915 (define_insn "*muldf3_ieee"
2916 [(set (match_operand:DF 0 "register_operand" "=&f")
2917 (mult:DF (match_operand:DF 1 "reg_or_fp0_operand" "%fG")
2918 (match_operand:DF 2 "reg_or_fp0_operand" "fG")))]
2919 "TARGET_FP && alpha_fptm >= ALPHA_FPTM_SU"
2920 "mul%-%/ %R1,%R2,%0"
2921 [(set_attr "type" "fmul")
2922 (set_attr "trap" "yes")
2923 (set_attr "round_suffix" "normal")
2924 (set_attr "trap_suffix" "u_su_sui")])
2926 (define_insn "muldf3"
2927 [(set (match_operand:DF 0 "register_operand" "=f")
2928 (mult:DF (match_operand:DF 1 "reg_or_fp0_operand" "%fG")
2929 (match_operand:DF 2 "reg_or_fp0_operand" "fG")))]
2931 "mul%-%/ %R1,%R2,%0"
2932 [(set_attr "type" "fmul")
2933 (set_attr "trap" "yes")
2934 (set_attr "round_suffix" "normal")
2935 (set_attr "trap_suffix" "u_su_sui")])
2937 (define_insn "*muldf_ext1"
2938 [(set (match_operand:DF 0 "register_operand" "=f")
2939 (mult:DF (float_extend:DF
2940 (match_operand:SF 1 "reg_or_fp0_operand" "fG"))
2941 (match_operand:DF 2 "reg_or_fp0_operand" "fG")))]
2942 "TARGET_FP && alpha_fptm < ALPHA_FPTM_SU"
2943 "mul%-%/ %R1,%R2,%0"
2944 [(set_attr "type" "fmul")
2945 (set_attr "trap" "yes")
2946 (set_attr "round_suffix" "normal")
2947 (set_attr "trap_suffix" "u_su_sui")])
2949 (define_insn "*muldf_ext2"
2950 [(set (match_operand:DF 0 "register_operand" "=f")
2951 (mult:DF (float_extend:DF
2952 (match_operand:SF 1 "reg_or_fp0_operand" "%fG"))
2954 (match_operand:SF 2 "reg_or_fp0_operand" "fG"))))]
2955 "TARGET_FP && alpha_fptm < ALPHA_FPTM_SU"
2956 "mul%-%/ %R1,%R2,%0"
2957 [(set_attr "type" "fmul")
2958 (set_attr "trap" "yes")
2959 (set_attr "round_suffix" "normal")
2960 (set_attr "trap_suffix" "u_su_sui")])
2962 (define_expand "multf3"
2963 [(use (match_operand 0 "register_operand" ""))
2964 (use (match_operand 1 "general_operand" ""))
2965 (use (match_operand 2 "general_operand" ""))]
2966 "TARGET_HAS_XFLOATING_LIBS"
2967 "alpha_emit_xfloating_arith (MULT, operands); DONE;")
2969 (define_insn "*subsf3_ieee"
2970 [(set (match_operand:SF 0 "register_operand" "=&f")
2971 (minus:SF (match_operand:SF 1 "reg_or_fp0_operand" "fG")
2972 (match_operand:SF 2 "reg_or_fp0_operand" "fG")))]
2973 "TARGET_FP && alpha_fptm >= ALPHA_FPTM_SU"
2974 "sub%,%/ %R1,%R2,%0"
2975 [(set_attr "type" "fadd")
2976 (set_attr "trap" "yes")
2977 (set_attr "round_suffix" "normal")
2978 (set_attr "trap_suffix" "u_su_sui")])
2980 (define_insn "subsf3"
2981 [(set (match_operand:SF 0 "register_operand" "=f")
2982 (minus:SF (match_operand:SF 1 "reg_or_fp0_operand" "fG")
2983 (match_operand:SF 2 "reg_or_fp0_operand" "fG")))]
2985 "sub%,%/ %R1,%R2,%0"
2986 [(set_attr "type" "fadd")
2987 (set_attr "trap" "yes")
2988 (set_attr "round_suffix" "normal")
2989 (set_attr "trap_suffix" "u_su_sui")])
2991 (define_insn "*subdf3_ieee"
2992 [(set (match_operand:DF 0 "register_operand" "=&f")
2993 (minus:DF (match_operand:DF 1 "reg_or_fp0_operand" "fG")
2994 (match_operand:DF 2 "reg_or_fp0_operand" "fG")))]
2995 "TARGET_FP && alpha_fptm >= ALPHA_FPTM_SU"
2996 "sub%-%/ %R1,%R2,%0"
2997 [(set_attr "type" "fadd")
2998 (set_attr "trap" "yes")
2999 (set_attr "round_suffix" "normal")
3000 (set_attr "trap_suffix" "u_su_sui")])
3002 (define_insn "subdf3"
3003 [(set (match_operand:DF 0 "register_operand" "=f")
3004 (minus:DF (match_operand:DF 1 "reg_or_fp0_operand" "fG")
3005 (match_operand:DF 2 "reg_or_fp0_operand" "fG")))]
3007 "sub%-%/ %R1,%R2,%0"
3008 [(set_attr "type" "fadd")
3009 (set_attr "trap" "yes")
3010 (set_attr "round_suffix" "normal")
3011 (set_attr "trap_suffix" "u_su_sui")])
3013 (define_insn "*subdf_ext1"
3014 [(set (match_operand:DF 0 "register_operand" "=f")
3015 (minus:DF (float_extend:DF
3016 (match_operand:SF 1 "reg_or_fp0_operand" "fG"))
3017 (match_operand:DF 2 "reg_or_fp0_operand" "fG")))]
3018 "TARGET_FP && alpha_fptm < ALPHA_FPTM_SU"
3019 "sub%-%/ %R1,%R2,%0"
3020 [(set_attr "type" "fadd")
3021 (set_attr "trap" "yes")
3022 (set_attr "round_suffix" "normal")
3023 (set_attr "trap_suffix" "u_su_sui")])
3025 (define_insn "*subdf_ext2"
3026 [(set (match_operand:DF 0 "register_operand" "=f")
3027 (minus:DF (match_operand:DF 1 "reg_or_fp0_operand" "fG")
3029 (match_operand:SF 2 "reg_or_fp0_operand" "fG"))))]
3030 "TARGET_FP && alpha_fptm < ALPHA_FPTM_SU"
3031 "sub%-%/ %R1,%R2,%0"
3032 [(set_attr "type" "fadd")
3033 (set_attr "trap" "yes")
3034 (set_attr "round_suffix" "normal")
3035 (set_attr "trap_suffix" "u_su_sui")])
3037 (define_insn "*subdf_ext3"
3038 [(set (match_operand:DF 0 "register_operand" "=f")
3039 (minus:DF (float_extend:DF
3040 (match_operand:SF 1 "reg_or_fp0_operand" "fG"))
3042 (match_operand:SF 2 "reg_or_fp0_operand" "fG"))))]
3043 "TARGET_FP && alpha_fptm < ALPHA_FPTM_SU"
3044 "sub%-%/ %R1,%R2,%0"
3045 [(set_attr "type" "fadd")
3046 (set_attr "trap" "yes")
3047 (set_attr "round_suffix" "normal")
3048 (set_attr "trap_suffix" "u_su_sui")])
3050 (define_expand "subtf3"
3051 [(use (match_operand 0 "register_operand" ""))
3052 (use (match_operand 1 "general_operand" ""))
3053 (use (match_operand 2 "general_operand" ""))]
3054 "TARGET_HAS_XFLOATING_LIBS"
3055 "alpha_emit_xfloating_arith (MINUS, operands); DONE;")
3057 (define_insn "*sqrtsf2_ieee"
3058 [(set (match_operand:SF 0 "register_operand" "=&f")
3059 (sqrt:SF (match_operand:SF 1 "reg_or_fp0_operand" "fG")))]
3060 "TARGET_FP && TARGET_FIX && alpha_fptm >= ALPHA_FPTM_SU"
3062 [(set_attr "type" "fsqrt")
3063 (set_attr "opsize" "si")
3064 (set_attr "trap" "yes")
3065 (set_attr "round_suffix" "normal")
3066 (set_attr "trap_suffix" "u_su_sui")])
3068 (define_insn "sqrtsf2"
3069 [(set (match_operand:SF 0 "register_operand" "=f")
3070 (sqrt:SF (match_operand:SF 1 "reg_or_fp0_operand" "fG")))]
3071 "TARGET_FP && TARGET_FIX"
3073 [(set_attr "type" "fsqrt")
3074 (set_attr "opsize" "si")
3075 (set_attr "trap" "yes")
3076 (set_attr "round_suffix" "normal")
3077 (set_attr "trap_suffix" "u_su_sui")])
3079 (define_insn "*sqrtdf2_ieee"
3080 [(set (match_operand:DF 0 "register_operand" "=&f")
3081 (sqrt:DF (match_operand:DF 1 "reg_or_fp0_operand" "fG")))]
3082 "TARGET_FP && TARGET_FIX && alpha_fptm >= ALPHA_FPTM_SU"
3084 [(set_attr "type" "fsqrt")
3085 (set_attr "trap" "yes")
3086 (set_attr "round_suffix" "normal")
3087 (set_attr "trap_suffix" "u_su_sui")])
3089 (define_insn "sqrtdf2"
3090 [(set (match_operand:DF 0 "register_operand" "=f")
3091 (sqrt:DF (match_operand:DF 1 "reg_or_fp0_operand" "fG")))]
3092 "TARGET_FP && TARGET_FIX"
3094 [(set_attr "type" "fsqrt")
3095 (set_attr "trap" "yes")
3096 (set_attr "round_suffix" "normal")
3097 (set_attr "trap_suffix" "u_su_sui")])
3099 ;; Next are all the integer comparisons, and conditional moves and branches
3100 ;; and some of the related define_expand's and define_split's.
3102 (define_insn "*setcc_internal"
3103 [(set (match_operand 0 "register_operand" "=r")
3104 (match_operator 1 "alpha_comparison_operator"
3105 [(match_operand:DI 2 "register_operand" "r")
3106 (match_operand:DI 3 "reg_or_8bit_operand" "rI")]))]
3107 "GET_MODE_CLASS (GET_MODE (operands[0])) == MODE_INT
3108 && GET_MODE_SIZE (GET_MODE (operands[0])) <= 8
3109 && GET_MODE (operands[0]) == GET_MODE (operands[1])"
3111 [(set_attr "type" "icmp")])
3113 ;; Yes, we can technically support reg_or_8bit_operand in operand 2,
3114 ;; but that's non-canonical rtl and allowing that causes inefficiencies
3116 (define_insn "*setcc_swapped_internal"
3117 [(set (match_operand 0 "register_operand" "=r")
3118 (match_operator 1 "alpha_swapped_comparison_operator"
3119 [(match_operand:DI 2 "register_operand" "r")
3120 (match_operand:DI 3 "reg_or_0_operand" "rJ")]))]
3121 "GET_MODE_CLASS (GET_MODE (operands[0])) == MODE_INT
3122 && GET_MODE_SIZE (GET_MODE (operands[0])) <= 8
3123 && GET_MODE (operands[0]) == GET_MODE (operands[1])"
3125 [(set_attr "type" "icmp")])
3127 ;; Use match_operator rather than ne directly so that we can match
3128 ;; multiple integer modes.
3129 (define_insn "*setne_internal"
3130 [(set (match_operand 0 "register_operand" "=r")
3131 (match_operator 1 "signed_comparison_operator"
3132 [(match_operand:DI 2 "register_operand" "r")
3134 "GET_MODE_CLASS (GET_MODE (operands[0])) == MODE_INT
3135 && GET_MODE_SIZE (GET_MODE (operands[0])) <= 8
3136 && GET_CODE (operands[1]) == NE
3137 && GET_MODE (operands[0]) == GET_MODE (operands[1])"
3139 [(set_attr "type" "icmp")])
3141 ;; The mode folding trick can't be used with const_int operands, since
3142 ;; reload needs to know the proper mode.
3144 ;; Use add_operand instead of the more seemingly natural reg_or_8bit_operand
3145 ;; in order to create more pairs of constants. As long as we're allowing
3146 ;; two constants at the same time, and will have to reload one of them...
3148 (define_insn "*movqicc_internal"
3149 [(set (match_operand:QI 0 "register_operand" "=r,r,r,r")
3151 (match_operator 2 "signed_comparison_operator"
3152 [(match_operand:DI 3 "reg_or_0_operand" "rJ,rJ,J,J")
3153 (match_operand:DI 4 "reg_or_0_operand" "J,J,rJ,rJ")])
3154 (match_operand:QI 1 "add_operand" "rI,0,rI,0")
3155 (match_operand:QI 5 "add_operand" "0,rI,0,rI")))]
3156 "(operands[3] == const0_rtx || operands[4] == const0_rtx)"
3162 [(set_attr "type" "icmov")])
3164 (define_insn "*movhicc_internal"
3165 [(set (match_operand:HI 0 "register_operand" "=r,r,r,r")
3167 (match_operator 2 "signed_comparison_operator"
3168 [(match_operand:DI 3 "reg_or_0_operand" "rJ,rJ,J,J")
3169 (match_operand:DI 4 "reg_or_0_operand" "J,J,rJ,rJ")])
3170 (match_operand:HI 1 "add_operand" "rI,0,rI,0")
3171 (match_operand:HI 5 "add_operand" "0,rI,0,rI")))]
3172 "(operands[3] == const0_rtx || operands[4] == const0_rtx)"
3178 [(set_attr "type" "icmov")])
3180 (define_insn "*movsicc_internal"
3181 [(set (match_operand:SI 0 "register_operand" "=r,r,r,r")
3183 (match_operator 2 "signed_comparison_operator"
3184 [(match_operand:DI 3 "reg_or_0_operand" "rJ,rJ,J,J")
3185 (match_operand:DI 4 "reg_or_0_operand" "J,J,rJ,rJ")])
3186 (match_operand:SI 1 "add_operand" "rI,0,rI,0")
3187 (match_operand:SI 5 "add_operand" "0,rI,0,rI")))]
3188 "(operands[3] == const0_rtx || operands[4] == const0_rtx)"
3194 [(set_attr "type" "icmov")])
3196 (define_insn "*movdicc_internal"
3197 [(set (match_operand:DI 0 "register_operand" "=r,r,r,r")
3199 (match_operator 2 "signed_comparison_operator"
3200 [(match_operand:DI 3 "reg_or_0_operand" "rJ,rJ,J,J")
3201 (match_operand:DI 4 "reg_or_0_operand" "J,J,rJ,rJ")])
3202 (match_operand:DI 1 "add_operand" "rI,0,rI,0")
3203 (match_operand:DI 5 "add_operand" "0,rI,0,rI")))]
3204 "(operands[3] == const0_rtx || operands[4] == const0_rtx)"
3210 [(set_attr "type" "icmov")])
3212 (define_insn "*movqicc_lbc"
3213 [(set (match_operand:QI 0 "register_operand" "=r,r")
3215 (eq (zero_extract:DI (match_operand:DI 2 "reg_or_0_operand" "rJ,rJ")
3219 (match_operand:QI 1 "reg_or_8bit_operand" "rI,0")
3220 (match_operand:QI 3 "reg_or_8bit_operand" "0,rI")))]
3225 [(set_attr "type" "icmov")])
3227 (define_insn "*movhicc_lbc"
3228 [(set (match_operand:HI 0 "register_operand" "=r,r")
3230 (eq (zero_extract:DI (match_operand:DI 2 "reg_or_0_operand" "rJ,rJ")
3234 (match_operand:HI 1 "reg_or_8bit_operand" "rI,0")
3235 (match_operand:HI 3 "reg_or_8bit_operand" "0,rI")))]
3240 [(set_attr "type" "icmov")])
3242 (define_insn "*movsicc_lbc"
3243 [(set (match_operand:SI 0 "register_operand" "=r,r")
3245 (eq (zero_extract:DI (match_operand:DI 2 "reg_or_0_operand" "rJ,rJ")
3249 (match_operand:SI 1 "reg_or_8bit_operand" "rI,0")
3250 (match_operand:SI 3 "reg_or_8bit_operand" "0,rI")))]
3255 [(set_attr "type" "icmov")])
3257 (define_insn "*movdicc_lbc"
3258 [(set (match_operand:DI 0 "register_operand" "=r,r")
3260 (eq (zero_extract:DI (match_operand:DI 2 "reg_or_0_operand" "rJ,rJ")
3264 (match_operand:DI 1 "reg_or_8bit_operand" "rI,0")
3265 (match_operand:DI 3 "reg_or_8bit_operand" "0,rI")))]
3270 [(set_attr "type" "icmov")])
3272 (define_insn "*movqicc_lbs"
3273 [(set (match_operand:QI 0 "register_operand" "=r,r")
3275 (ne (zero_extract:DI (match_operand:DI 2 "reg_or_0_operand" "rJ,rJ")
3279 (match_operand:QI 1 "reg_or_8bit_operand" "rI,0")
3280 (match_operand:QI 3 "reg_or_8bit_operand" "0,rI")))]
3285 [(set_attr "type" "icmov")])
3287 (define_insn "*movhicc_lbs"
3288 [(set (match_operand:HI 0 "register_operand" "=r,r")
3290 (ne (zero_extract:DI (match_operand:DI 2 "reg_or_0_operand" "rJ,rJ")
3294 (match_operand:HI 1 "reg_or_8bit_operand" "rI,0")
3295 (match_operand:HI 3 "reg_or_8bit_operand" "0,rI")))]
3300 [(set_attr "type" "icmov")])
3302 (define_insn "*movsicc_lbs"
3303 [(set (match_operand:SI 0 "register_operand" "=r,r")
3305 (ne (zero_extract:DI (match_operand:DI 2 "reg_or_0_operand" "rJ,rJ")
3309 (match_operand:SI 1 "reg_or_8bit_operand" "rI,0")
3310 (match_operand:SI 3 "reg_or_8bit_operand" "0,rI")))]
3315 [(set_attr "type" "icmov")])
3317 (define_insn "*movdicc_lbs"
3318 [(set (match_operand:DI 0 "register_operand" "=r,r")
3320 (ne (zero_extract:DI (match_operand:DI 2 "reg_or_0_operand" "rJ,rJ")
3324 (match_operand:DI 1 "reg_or_8bit_operand" "rI,0")
3325 (match_operand:DI 3 "reg_or_8bit_operand" "0,rI")))]
3330 [(set_attr "type" "icmov")])
3332 ;; For ABS, we have two choices, depending on whether the input and output
3333 ;; registers are the same or not.
3334 (define_expand "absdi2"
3335 [(set (match_operand:DI 0 "register_operand" "")
3336 (abs:DI (match_operand:DI 1 "register_operand" "")))]
3339 if (rtx_equal_p (operands[0], operands[1]))
3340 emit_insn (gen_absdi2_same (operands[0], gen_reg_rtx (DImode)));
3342 emit_insn (gen_absdi2_diff (operands[0], operands[1]));
3346 (define_expand "absdi2_same"
3347 [(set (match_operand:DI 1 "register_operand" "")
3348 (neg:DI (match_operand:DI 0 "register_operand" "")))
3350 (if_then_else:DI (ge (match_dup 0) (const_int 0))
3356 (define_expand "absdi2_diff"
3357 [(set (match_operand:DI 0 "register_operand" "")
3358 (neg:DI (match_operand:DI 1 "register_operand" "")))
3360 (if_then_else:DI (lt (match_dup 1) (const_int 0))
3367 [(set (match_operand:DI 0 "register_operand" "")
3368 (abs:DI (match_dup 0)))
3369 (clobber (match_operand:DI 1 "register_operand" ""))]
3371 [(set (match_dup 1) (neg:DI (match_dup 0)))
3372 (set (match_dup 0) (if_then_else:DI (ge (match_dup 0) (const_int 0))
3373 (match_dup 0) (match_dup 1)))]
3377 [(set (match_operand:DI 0 "register_operand" "")
3378 (abs:DI (match_operand:DI 1 "register_operand" "")))]
3379 "! rtx_equal_p (operands[0], operands[1])"
3380 [(set (match_dup 0) (neg:DI (match_dup 1)))
3381 (set (match_dup 0) (if_then_else:DI (lt (match_dup 1) (const_int 0))
3382 (match_dup 0) (match_dup 1)))]
3386 [(set (match_operand:DI 0 "register_operand" "")
3387 (neg:DI (abs:DI (match_dup 0))))
3388 (clobber (match_operand:DI 1 "register_operand" ""))]
3390 [(set (match_dup 1) (neg:DI (match_dup 0)))
3391 (set (match_dup 0) (if_then_else:DI (le (match_dup 0) (const_int 0))
3392 (match_dup 0) (match_dup 1)))]
3396 [(set (match_operand:DI 0 "register_operand" "")
3397 (neg:DI (abs:DI (match_operand:DI 1 "register_operand" ""))))]
3398 "! rtx_equal_p (operands[0], operands[1])"
3399 [(set (match_dup 0) (neg:DI (match_dup 1)))
3400 (set (match_dup 0) (if_then_else:DI (gt (match_dup 1) (const_int 0))
3401 (match_dup 0) (match_dup 1)))]
3404 (define_insn "sminqi3"
3405 [(set (match_operand:QI 0 "register_operand" "=r")
3406 (smin:QI (match_operand:QI 1 "reg_or_0_operand" "%rJ")
3407 (match_operand:QI 2 "reg_or_8bit_operand" "rI")))]
3410 [(set_attr "type" "mvi")])
3412 (define_insn "uminqi3"
3413 [(set (match_operand:QI 0 "register_operand" "=r")
3414 (umin:QI (match_operand:QI 1 "reg_or_0_operand" "%rJ")
3415 (match_operand:QI 2 "reg_or_8bit_operand" "rI")))]
3418 [(set_attr "type" "mvi")])
3420 (define_insn "smaxqi3"
3421 [(set (match_operand:QI 0 "register_operand" "=r")
3422 (smax:QI (match_operand:QI 1 "reg_or_0_operand" "%rJ")
3423 (match_operand:QI 2 "reg_or_8bit_operand" "rI")))]
3426 [(set_attr "type" "mvi")])
3428 (define_insn "umaxqi3"
3429 [(set (match_operand:QI 0 "register_operand" "=r")
3430 (umax:QI (match_operand:QI 1 "reg_or_0_operand" "%rJ")
3431 (match_operand:QI 2 "reg_or_8bit_operand" "rI")))]
3434 [(set_attr "type" "mvi")])
3436 (define_insn "sminhi3"
3437 [(set (match_operand:HI 0 "register_operand" "=r")
3438 (smin:HI (match_operand:HI 1 "reg_or_0_operand" "%rJ")
3439 (match_operand:HI 2 "reg_or_8bit_operand" "rI")))]
3442 [(set_attr "type" "mvi")])
3444 (define_insn "uminhi3"
3445 [(set (match_operand:HI 0 "register_operand" "=r")
3446 (umin:HI (match_operand:HI 1 "reg_or_0_operand" "%rJ")
3447 (match_operand:HI 2 "reg_or_8bit_operand" "rI")))]
3450 [(set_attr "type" "mvi")])
3452 (define_insn "smaxhi3"
3453 [(set (match_operand:HI 0 "register_operand" "=r")
3454 (smax:HI (match_operand:HI 1 "reg_or_0_operand" "%rJ")
3455 (match_operand:HI 2 "reg_or_8bit_operand" "rI")))]
3458 [(set_attr "type" "mvi")])
3460 (define_insn "umaxhi3"
3461 [(set (match_operand:HI 0 "register_operand" "=r")
3462 (umax:HI (match_operand:HI 1 "reg_or_0_operand" "%rJ")
3463 (match_operand:HI 2 "reg_or_8bit_operand" "rI")))]
3466 [(set_attr "type" "shift")])
3468 (define_expand "smaxdi3"
3470 (le:DI (match_operand:DI 1 "reg_or_0_operand" "")
3471 (match_operand:DI 2 "reg_or_8bit_operand" "")))
3472 (set (match_operand:DI 0 "register_operand" "")
3473 (if_then_else:DI (eq (match_dup 3) (const_int 0))
3474 (match_dup 1) (match_dup 2)))]
3476 { operands[3] = gen_reg_rtx (DImode); })
3479 [(set (match_operand:DI 0 "register_operand" "")
3480 (smax:DI (match_operand:DI 1 "reg_or_0_operand" "")
3481 (match_operand:DI 2 "reg_or_8bit_operand" "")))
3482 (clobber (match_operand:DI 3 "register_operand" ""))]
3483 "operands[2] != const0_rtx"
3484 [(set (match_dup 3) (le:DI (match_dup 1) (match_dup 2)))
3485 (set (match_dup 0) (if_then_else:DI (eq (match_dup 3) (const_int 0))
3486 (match_dup 1) (match_dup 2)))]
3489 (define_insn "*smax_const0"
3490 [(set (match_operand:DI 0 "register_operand" "=r")
3491 (smax:DI (match_operand:DI 1 "register_operand" "0")
3495 [(set_attr "type" "icmov")])
3497 (define_expand "smindi3"
3499 (lt:DI (match_operand:DI 1 "reg_or_0_operand" "")
3500 (match_operand:DI 2 "reg_or_8bit_operand" "")))
3501 (set (match_operand:DI 0 "register_operand" "")
3502 (if_then_else:DI (ne (match_dup 3) (const_int 0))
3503 (match_dup 1) (match_dup 2)))]
3505 { operands[3] = gen_reg_rtx (DImode); })
3508 [(set (match_operand:DI 0 "register_operand" "")
3509 (smin:DI (match_operand:DI 1 "reg_or_0_operand" "")
3510 (match_operand:DI 2 "reg_or_8bit_operand" "")))
3511 (clobber (match_operand:DI 3 "register_operand" ""))]
3512 "operands[2] != const0_rtx"
3513 [(set (match_dup 3) (lt:DI (match_dup 1) (match_dup 2)))
3514 (set (match_dup 0) (if_then_else:DI (ne (match_dup 3) (const_int 0))
3515 (match_dup 1) (match_dup 2)))]
3518 (define_insn "*smin_const0"
3519 [(set (match_operand:DI 0 "register_operand" "=r")
3520 (smin:DI (match_operand:DI 1 "register_operand" "0")
3524 [(set_attr "type" "icmov")])
3526 (define_expand "umaxdi3"
3528 (leu:DI (match_operand:DI 1 "reg_or_0_operand" "")
3529 (match_operand:DI 2 "reg_or_8bit_operand" "")))
3530 (set (match_operand:DI 0 "register_operand" "")
3531 (if_then_else:DI (eq (match_dup 3) (const_int 0))
3532 (match_dup 1) (match_dup 2)))]
3534 "operands[3] = gen_reg_rtx (DImode);")
3537 [(set (match_operand:DI 0 "register_operand" "")
3538 (umax:DI (match_operand:DI 1 "reg_or_0_operand" "")
3539 (match_operand:DI 2 "reg_or_8bit_operand" "")))
3540 (clobber (match_operand:DI 3 "register_operand" ""))]
3541 "operands[2] != const0_rtx"
3542 [(set (match_dup 3) (leu:DI (match_dup 1) (match_dup 2)))
3543 (set (match_dup 0) (if_then_else:DI (eq (match_dup 3) (const_int 0))
3544 (match_dup 1) (match_dup 2)))]
3547 (define_expand "umindi3"
3549 (ltu:DI (match_operand:DI 1 "reg_or_0_operand" "")
3550 (match_operand:DI 2 "reg_or_8bit_operand" "")))
3551 (set (match_operand:DI 0 "register_operand" "")
3552 (if_then_else:DI (ne (match_dup 3) (const_int 0))
3553 (match_dup 1) (match_dup 2)))]
3555 "operands[3] = gen_reg_rtx (DImode);")
3558 [(set (match_operand:DI 0 "register_operand" "")
3559 (umin:DI (match_operand:DI 1 "reg_or_0_operand" "")
3560 (match_operand:DI 2 "reg_or_8bit_operand" "")))
3561 (clobber (match_operand:DI 3 "register_operand" ""))]
3562 "operands[2] != const0_rtx"
3563 [(set (match_dup 3) (ltu:DI (match_dup 1) (match_dup 2)))
3564 (set (match_dup 0) (if_then_else:DI (ne (match_dup 3) (const_int 0))
3565 (match_dup 1) (match_dup 2)))]
3568 (define_insn "*bcc_normal"
3571 (match_operator 1 "signed_comparison_operator"
3572 [(match_operand:DI 2 "reg_or_0_operand" "rJ")
3574 (label_ref (match_operand 0 "" ""))
3578 [(set_attr "type" "ibr")])
3580 (define_insn "*bcc_reverse"
3583 (match_operator 1 "signed_comparison_operator"
3584 [(match_operand:DI 2 "register_operand" "r")
3588 (label_ref (match_operand 0 "" ""))))]
3591 [(set_attr "type" "ibr")])
3593 (define_insn "*blbs_normal"
3596 (ne (zero_extract:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
3600 (label_ref (match_operand 0 "" ""))
3604 [(set_attr "type" "ibr")])
3606 (define_insn "*blbc_normal"
3609 (eq (zero_extract:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
3613 (label_ref (match_operand 0 "" ""))
3617 [(set_attr "type" "ibr")])
3623 (match_operator 1 "comparison_operator"
3624 [(zero_extract:DI (match_operand:DI 2 "register_operand" "")
3626 (match_operand:DI 3 "const_int_operand" ""))
3628 (label_ref (match_operand 0 "" ""))
3630 (clobber (match_operand:DI 4 "register_operand" ""))])]
3631 "INTVAL (operands[3]) != 0"
3633 (lshiftrt:DI (match_dup 2) (match_dup 3)))
3635 (if_then_else (match_op_dup 1
3636 [(zero_extract:DI (match_dup 4)
3640 (label_ref (match_dup 0))
3644 ;; The following are the corresponding floating-point insns. Recall
3645 ;; we need to have variants that expand the arguments from SFmode
3648 (define_insn "*cmpdf_ieee"
3649 [(set (match_operand:DF 0 "register_operand" "=&f")
3650 (match_operator:DF 1 "alpha_fp_comparison_operator"
3651 [(match_operand:DF 2 "reg_or_fp0_operand" "fG")
3652 (match_operand:DF 3 "reg_or_fp0_operand" "fG")]))]
3653 "TARGET_FP && alpha_fptm >= ALPHA_FPTM_SU"
3654 "cmp%-%C1%/ %R2,%R3,%0"
3655 [(set_attr "type" "fadd")
3656 (set_attr "trap" "yes")
3657 (set_attr "trap_suffix" "su")])
3659 (define_insn "*cmpdf_internal"
3660 [(set (match_operand:DF 0 "register_operand" "=f")
3661 (match_operator:DF 1 "alpha_fp_comparison_operator"
3662 [(match_operand:DF 2 "reg_or_fp0_operand" "fG")
3663 (match_operand:DF 3 "reg_or_fp0_operand" "fG")]))]
3664 "TARGET_FP && alpha_fptm < ALPHA_FPTM_SU"
3665 "cmp%-%C1%/ %R2,%R3,%0"
3666 [(set_attr "type" "fadd")
3667 (set_attr "trap" "yes")
3668 (set_attr "trap_suffix" "su")])
3670 (define_insn "*cmpdf_ieee_ext1"
3671 [(set (match_operand:DF 0 "register_operand" "=&f")
3672 (match_operator:DF 1 "alpha_fp_comparison_operator"
3674 (match_operand:SF 2 "reg_or_fp0_operand" "fG"))
3675 (match_operand:DF 3 "reg_or_fp0_operand" "fG")]))]
3676 "TARGET_FP && alpha_fptm >= ALPHA_FPTM_SU"
3677 "cmp%-%C1%/ %R2,%R3,%0"
3678 [(set_attr "type" "fadd")
3679 (set_attr "trap" "yes")
3680 (set_attr "trap_suffix" "su")])
3682 (define_insn "*cmpdf_ext1"
3683 [(set (match_operand:DF 0 "register_operand" "=f")
3684 (match_operator:DF 1 "alpha_fp_comparison_operator"
3686 (match_operand:SF 2 "reg_or_fp0_operand" "fG"))
3687 (match_operand:DF 3 "reg_or_fp0_operand" "fG")]))]
3688 "TARGET_FP && alpha_fptm < ALPHA_FPTM_SU"
3689 "cmp%-%C1%/ %R2,%R3,%0"
3690 [(set_attr "type" "fadd")
3691 (set_attr "trap" "yes")
3692 (set_attr "trap_suffix" "su")])
3694 (define_insn "*cmpdf_ieee_ext2"
3695 [(set (match_operand:DF 0 "register_operand" "=&f")
3696 (match_operator:DF 1 "alpha_fp_comparison_operator"
3697 [(match_operand:DF 2 "reg_or_fp0_operand" "fG")
3699 (match_operand:SF 3 "reg_or_fp0_operand" "fG"))]))]
3700 "TARGET_FP && alpha_fptm >= ALPHA_FPTM_SU"
3701 "cmp%-%C1%/ %R2,%R3,%0"
3702 [(set_attr "type" "fadd")
3703 (set_attr "trap" "yes")
3704 (set_attr "trap_suffix" "su")])
3706 (define_insn "*cmpdf_ext2"
3707 [(set (match_operand:DF 0 "register_operand" "=f")
3708 (match_operator:DF 1 "alpha_fp_comparison_operator"
3709 [(match_operand:DF 2 "reg_or_fp0_operand" "fG")
3711 (match_operand:SF 3 "reg_or_fp0_operand" "fG"))]))]
3712 "TARGET_FP && alpha_fptm < ALPHA_FPTM_SU"
3713 "cmp%-%C1%/ %R2,%R3,%0"
3714 [(set_attr "type" "fadd")
3715 (set_attr "trap" "yes")
3716 (set_attr "trap_suffix" "su")])
3718 (define_insn "*cmpdf_ieee_ext3"
3719 [(set (match_operand:DF 0 "register_operand" "=&f")
3720 (match_operator:DF 1 "alpha_fp_comparison_operator"
3722 (match_operand:SF 2 "reg_or_fp0_operand" "fG"))
3724 (match_operand:SF 3 "reg_or_fp0_operand" "fG"))]))]
3725 "TARGET_FP && alpha_fptm >= ALPHA_FPTM_SU"
3726 "cmp%-%C1%/ %R2,%R3,%0"
3727 [(set_attr "type" "fadd")
3728 (set_attr "trap" "yes")
3729 (set_attr "trap_suffix" "su")])
3731 (define_insn "*cmpdf_ext3"
3732 [(set (match_operand:DF 0 "register_operand" "=f")
3733 (match_operator:DF 1 "alpha_fp_comparison_operator"
3735 (match_operand:SF 2 "reg_or_fp0_operand" "fG"))
3737 (match_operand:SF 3 "reg_or_fp0_operand" "fG"))]))]
3738 "TARGET_FP && alpha_fptm < ALPHA_FPTM_SU"
3739 "cmp%-%C1%/ %R2,%R3,%0"
3740 [(set_attr "type" "fadd")
3741 (set_attr "trap" "yes")
3742 (set_attr "trap_suffix" "su")])
3744 (define_insn "*movdfcc_internal"
3745 [(set (match_operand:DF 0 "register_operand" "=f,f")
3747 (match_operator 3 "signed_comparison_operator"
3748 [(match_operand:DF 4 "reg_or_fp0_operand" "fG,fG")
3749 (match_operand:DF 2 "fp0_operand" "G,G")])
3750 (match_operand:DF 1 "reg_or_fp0_operand" "fG,0")
3751 (match_operand:DF 5 "reg_or_fp0_operand" "0,fG")))]
3755 fcmov%D3 %R4,%R5,%0"
3756 [(set_attr "type" "fcmov")])
3758 (define_insn "*movsfcc_internal"
3759 [(set (match_operand:SF 0 "register_operand" "=f,f")
3761 (match_operator 3 "signed_comparison_operator"
3762 [(match_operand:DF 4 "reg_or_fp0_operand" "fG,fG")
3763 (match_operand:DF 2 "fp0_operand" "G,G")])
3764 (match_operand:SF 1 "reg_or_fp0_operand" "fG,0")
3765 (match_operand:SF 5 "reg_or_fp0_operand" "0,fG")))]
3769 fcmov%D3 %R4,%R5,%0"
3770 [(set_attr "type" "fcmov")])
3772 (define_insn "*movdfcc_ext1"
3773 [(set (match_operand:DF 0 "register_operand" "=f,f")
3775 (match_operator 3 "signed_comparison_operator"
3776 [(match_operand:DF 4 "reg_or_fp0_operand" "fG,fG")
3777 (match_operand:DF 2 "fp0_operand" "G,G")])
3778 (float_extend:DF (match_operand:SF 1 "reg_or_fp0_operand" "fG,0"))
3779 (match_operand:DF 5 "reg_or_fp0_operand" "0,fG")))]
3783 fcmov%D3 %R4,%R5,%0"
3784 [(set_attr "type" "fcmov")])
3786 (define_insn "*movdfcc_ext2"
3787 [(set (match_operand:DF 0 "register_operand" "=f,f")
3789 (match_operator 3 "signed_comparison_operator"
3791 (match_operand:SF 4 "reg_or_fp0_operand" "fG,fG"))
3792 (match_operand:DF 2 "fp0_operand" "G,G")])
3793 (match_operand:DF 1 "reg_or_fp0_operand" "fG,0")
3794 (match_operand:DF 5 "reg_or_fp0_operand" "0,fG")))]
3798 fcmov%D3 %R4,%R5,%0"
3799 [(set_attr "type" "fcmov")])
3801 (define_insn "*movdfcc_ext3"
3802 [(set (match_operand:SF 0 "register_operand" "=f,f")
3804 (match_operator 3 "signed_comparison_operator"
3806 (match_operand:SF 4 "reg_or_fp0_operand" "fG,fG"))
3807 (match_operand:DF 2 "fp0_operand" "G,G")])
3808 (match_operand:SF 1 "reg_or_fp0_operand" "fG,0")
3809 (match_operand:SF 5 "reg_or_fp0_operand" "0,fG")))]
3813 fcmov%D3 %R4,%R5,%0"
3814 [(set_attr "type" "fcmov")])
3816 (define_insn "*movdfcc_ext4"
3817 [(set (match_operand:DF 0 "register_operand" "=f,f")
3819 (match_operator 3 "signed_comparison_operator"
3821 (match_operand:SF 4 "reg_or_fp0_operand" "fG,fG"))
3822 (match_operand:DF 2 "fp0_operand" "G,G")])
3823 (float_extend:DF (match_operand:SF 1 "reg_or_fp0_operand" "fG,0"))
3824 (match_operand:DF 5 "reg_or_fp0_operand" "0,fG")))]
3828 fcmov%D3 %R4,%R5,%0"
3829 [(set_attr "type" "fcmov")])
3831 (define_expand "maxdf3"
3833 (le:DF (match_operand:DF 1 "reg_or_fp0_operand" "")
3834 (match_operand:DF 2 "reg_or_fp0_operand" "")))
3835 (set (match_operand:DF 0 "register_operand" "")
3836 (if_then_else:DF (eq (match_dup 3) (match_dup 4))
3837 (match_dup 1) (match_dup 2)))]
3840 operands[3] = gen_reg_rtx (DFmode);
3841 operands[4] = CONST0_RTX (DFmode);
3844 (define_expand "mindf3"
3846 (lt:DF (match_operand:DF 1 "reg_or_fp0_operand" "")
3847 (match_operand:DF 2 "reg_or_fp0_operand" "")))
3848 (set (match_operand:DF 0 "register_operand" "")
3849 (if_then_else:DF (ne (match_dup 3) (match_dup 4))
3850 (match_dup 1) (match_dup 2)))]
3853 operands[3] = gen_reg_rtx (DFmode);
3854 operands[4] = CONST0_RTX (DFmode);
3857 (define_expand "maxsf3"
3859 (le:DF (float_extend:DF (match_operand:SF 1 "reg_or_fp0_operand" ""))
3860 (float_extend:DF (match_operand:SF 2 "reg_or_fp0_operand" ""))))
3861 (set (match_operand:SF 0 "register_operand" "")
3862 (if_then_else:SF (eq (match_dup 3) (match_dup 4))
3863 (match_dup 1) (match_dup 2)))]
3866 operands[3] = gen_reg_rtx (DFmode);
3867 operands[4] = CONST0_RTX (DFmode);
3870 (define_expand "minsf3"
3872 (lt:DF (float_extend:DF (match_operand:SF 1 "reg_or_fp0_operand" ""))
3873 (float_extend:DF (match_operand:SF 2 "reg_or_fp0_operand" ""))))
3874 (set (match_operand:SF 0 "register_operand" "")
3875 (if_then_else:SF (ne (match_dup 3) (match_dup 4))
3876 (match_dup 1) (match_dup 2)))]
3879 operands[3] = gen_reg_rtx (DFmode);
3880 operands[4] = CONST0_RTX (DFmode);
3883 (define_insn "*fbcc_normal"
3886 (match_operator 1 "signed_comparison_operator"
3887 [(match_operand:DF 2 "reg_or_fp0_operand" "fG")
3888 (match_operand:DF 3 "fp0_operand" "G")])
3889 (label_ref (match_operand 0 "" ""))
3893 [(set_attr "type" "fbr")])
3895 (define_insn "*fbcc_ext_normal"
3898 (match_operator 1 "signed_comparison_operator"
3900 (match_operand:SF 2 "reg_or_fp0_operand" "fG"))
3901 (match_operand:DF 3 "fp0_operand" "G")])
3902 (label_ref (match_operand 0 "" ""))
3906 [(set_attr "type" "fbr")])
3908 ;; These are the main define_expand's used to make conditional branches
3911 (define_expand "cmpdf"
3912 [(set (cc0) (compare (match_operand:DF 0 "reg_or_fp0_operand" "")
3913 (match_operand:DF 1 "reg_or_fp0_operand" "")))]
3916 alpha_compare.op0 = operands[0];
3917 alpha_compare.op1 = operands[1];
3918 alpha_compare.fp_p = 1;
3922 (define_expand "cmptf"
3923 [(set (cc0) (compare (match_operand:TF 0 "general_operand" "")
3924 (match_operand:TF 1 "general_operand" "")))]
3925 "TARGET_HAS_XFLOATING_LIBS"
3927 alpha_compare.op0 = operands[0];
3928 alpha_compare.op1 = operands[1];
3929 alpha_compare.fp_p = 1;
3933 (define_expand "cmpdi"
3934 [(set (cc0) (compare (match_operand:DI 0 "general_operand" "")
3935 (match_operand:DI 1 "general_operand" "")))]
3938 alpha_compare.op0 = operands[0];
3939 alpha_compare.op1 = operands[1];
3940 alpha_compare.fp_p = 0;
3944 (define_expand "beq"
3946 (if_then_else (match_dup 1)
3947 (label_ref (match_operand 0 "" ""))
3950 "{ operands[1] = alpha_emit_conditional_branch (EQ); }")
3952 (define_expand "bne"
3954 (if_then_else (match_dup 1)
3955 (label_ref (match_operand 0 "" ""))
3958 "{ operands[1] = alpha_emit_conditional_branch (NE); }")
3960 (define_expand "blt"
3962 (if_then_else (match_dup 1)
3963 (label_ref (match_operand 0 "" ""))
3966 "{ operands[1] = alpha_emit_conditional_branch (LT); }")
3968 (define_expand "ble"
3970 (if_then_else (match_dup 1)
3971 (label_ref (match_operand 0 "" ""))
3974 "{ operands[1] = alpha_emit_conditional_branch (LE); }")
3976 (define_expand "bgt"
3978 (if_then_else (match_dup 1)
3979 (label_ref (match_operand 0 "" ""))
3982 "{ operands[1] = alpha_emit_conditional_branch (GT); }")
3984 (define_expand "bge"
3986 (if_then_else (match_dup 1)
3987 (label_ref (match_operand 0 "" ""))
3990 "{ operands[1] = alpha_emit_conditional_branch (GE); }")
3992 (define_expand "bltu"
3994 (if_then_else (match_dup 1)
3995 (label_ref (match_operand 0 "" ""))
3998 "{ operands[1] = alpha_emit_conditional_branch (LTU); }")
4000 (define_expand "bleu"
4002 (if_then_else (match_dup 1)
4003 (label_ref (match_operand 0 "" ""))
4006 "{ operands[1] = alpha_emit_conditional_branch (LEU); }")
4008 (define_expand "bgtu"
4010 (if_then_else (match_dup 1)
4011 (label_ref (match_operand 0 "" ""))
4014 "{ operands[1] = alpha_emit_conditional_branch (GTU); }")
4016 (define_expand "bgeu"
4018 (if_then_else (match_dup 1)
4019 (label_ref (match_operand 0 "" ""))
4022 "{ operands[1] = alpha_emit_conditional_branch (GEU); }")
4024 (define_expand "bunordered"
4026 (if_then_else (match_dup 1)
4027 (label_ref (match_operand 0 "" ""))
4030 "{ operands[1] = alpha_emit_conditional_branch (UNORDERED); }")
4032 (define_expand "bordered"
4034 (if_then_else (match_dup 1)
4035 (label_ref (match_operand 0 "" ""))
4038 "{ operands[1] = alpha_emit_conditional_branch (ORDERED); }")
4040 (define_expand "seq"
4041 [(set (match_operand:DI 0 "register_operand" "")
4044 "{ if ((operands[1] = alpha_emit_setcc (EQ)) == NULL_RTX) FAIL; }")
4046 (define_expand "sne"
4047 [(set (match_operand:DI 0 "register_operand" "")
4050 "{ if ((operands[1] = alpha_emit_setcc (NE)) == NULL_RTX) FAIL; }")
4052 (define_expand "slt"
4053 [(set (match_operand:DI 0 "register_operand" "")
4056 "{ if ((operands[1] = alpha_emit_setcc (LT)) == NULL_RTX) FAIL; }")
4058 (define_expand "sle"
4059 [(set (match_operand:DI 0 "register_operand" "")
4062 "{ if ((operands[1] = alpha_emit_setcc (LE)) == NULL_RTX) FAIL; }")
4064 (define_expand "sgt"
4065 [(set (match_operand:DI 0 "register_operand" "")
4068 "{ if ((operands[1] = alpha_emit_setcc (GT)) == NULL_RTX) FAIL; }")
4070 (define_expand "sge"
4071 [(set (match_operand:DI 0 "register_operand" "")
4074 "{ if ((operands[1] = alpha_emit_setcc (GE)) == NULL_RTX) FAIL; }")
4076 (define_expand "sltu"
4077 [(set (match_operand:DI 0 "register_operand" "")
4080 "{ if ((operands[1] = alpha_emit_setcc (LTU)) == NULL_RTX) FAIL; }")
4082 (define_expand "sleu"
4083 [(set (match_operand:DI 0 "register_operand" "")
4086 "{ if ((operands[1] = alpha_emit_setcc (LEU)) == NULL_RTX) FAIL; }")
4088 (define_expand "sgtu"
4089 [(set (match_operand:DI 0 "register_operand" "")
4092 "{ if ((operands[1] = alpha_emit_setcc (GTU)) == NULL_RTX) FAIL; }")
4094 (define_expand "sgeu"
4095 [(set (match_operand:DI 0 "register_operand" "")
4098 "{ if ((operands[1] = alpha_emit_setcc (GEU)) == NULL_RTX) FAIL; }")
4100 (define_expand "sunordered"
4101 [(set (match_operand:DI 0 "register_operand" "")
4104 "{ if ((operands[1] = alpha_emit_setcc (UNORDERED)) == NULL_RTX) FAIL; }")
4106 (define_expand "sordered"
4107 [(set (match_operand:DI 0 "register_operand" "")
4110 "{ if ((operands[1] = alpha_emit_setcc (ORDERED)) == NULL_RTX) FAIL; }")
4112 ;; These are the main define_expand's used to make conditional moves.
4114 (define_expand "movsicc"
4115 [(set (match_operand:SI 0 "register_operand" "")
4116 (if_then_else:SI (match_operand 1 "comparison_operator" "")
4117 (match_operand:SI 2 "reg_or_8bit_operand" "")
4118 (match_operand:SI 3 "reg_or_8bit_operand" "")))]
4121 if ((operands[1] = alpha_emit_conditional_move (operands[1], SImode)) == 0)
4125 (define_expand "movdicc"
4126 [(set (match_operand:DI 0 "register_operand" "")
4127 (if_then_else:DI (match_operand 1 "comparison_operator" "")
4128 (match_operand:DI 2 "reg_or_8bit_operand" "")
4129 (match_operand:DI 3 "reg_or_8bit_operand" "")))]
4132 if ((operands[1] = alpha_emit_conditional_move (operands[1], DImode)) == 0)
4136 (define_expand "movsfcc"
4137 [(set (match_operand:SF 0 "register_operand" "")
4138 (if_then_else:SF (match_operand 1 "comparison_operator" "")
4139 (match_operand:SF 2 "reg_or_8bit_operand" "")
4140 (match_operand:SF 3 "reg_or_8bit_operand" "")))]
4143 if ((operands[1] = alpha_emit_conditional_move (operands[1], SFmode)) == 0)
4147 (define_expand "movdfcc"
4148 [(set (match_operand:DF 0 "register_operand" "")
4149 (if_then_else:DF (match_operand 1 "comparison_operator" "")
4150 (match_operand:DF 2 "reg_or_8bit_operand" "")
4151 (match_operand:DF 3 "reg_or_8bit_operand" "")))]
4154 if ((operands[1] = alpha_emit_conditional_move (operands[1], DFmode)) == 0)
4158 ;; These define_split definitions are used in cases when comparisons have
4159 ;; not be stated in the correct way and we need to reverse the second
4160 ;; comparison. For example, x >= 7 has to be done as x < 6 with the
4161 ;; comparison that tests the result being reversed. We have one define_split
4162 ;; for each use of a comparison. They do not match valid insns and need
4163 ;; not generate valid insns.
4165 ;; We can also handle equality comparisons (and inequality comparisons in
4166 ;; cases where the resulting add cannot overflow) by doing an add followed by
4167 ;; a comparison with zero. This is faster since the addition takes one
4168 ;; less cycle than a compare when feeding into a conditional move.
4169 ;; For this case, we also have an SImode pattern since we can merge the add
4170 ;; and sign extend and the order doesn't matter.
4172 ;; We do not do this for floating-point, since it isn't clear how the "wrong"
4173 ;; operation could have been generated.
4176 [(set (match_operand:DI 0 "register_operand" "")
4178 (match_operator 1 "comparison_operator"
4179 [(match_operand:DI 2 "reg_or_0_operand" "")
4180 (match_operand:DI 3 "reg_or_cint_operand" "")])
4181 (match_operand:DI 4 "reg_or_cint_operand" "")
4182 (match_operand:DI 5 "reg_or_cint_operand" "")))
4183 (clobber (match_operand:DI 6 "register_operand" ""))]
4184 "operands[3] != const0_rtx"
4185 [(set (match_dup 6) (match_dup 7))
4187 (if_then_else:DI (match_dup 8) (match_dup 4) (match_dup 5)))]
4189 enum rtx_code code = GET_CODE (operands[1]);
4190 int unsignedp = (code == GEU || code == LEU || code == GTU || code == LTU);
4192 /* If we are comparing for equality with a constant and that constant
4193 appears in the arm when the register equals the constant, use the
4194 register since that is more likely to match (and to produce better code
4197 if (code == EQ && GET_CODE (operands[3]) == CONST_INT
4198 && rtx_equal_p (operands[4], operands[3]))
4199 operands[4] = operands[2];
4201 else if (code == NE && GET_CODE (operands[3]) == CONST_INT
4202 && rtx_equal_p (operands[5], operands[3]))
4203 operands[5] = operands[2];
4205 if (code == NE || code == EQ
4206 || (extended_count (operands[2], DImode, unsignedp) >= 1
4207 && extended_count (operands[3], DImode, unsignedp) >= 1))
4209 if (GET_CODE (operands[3]) == CONST_INT)
4210 operands[7] = gen_rtx_PLUS (DImode, operands[2],
4211 GEN_INT (- INTVAL (operands[3])));
4213 operands[7] = gen_rtx_MINUS (DImode, operands[2], operands[3]);
4215 operands[8] = gen_rtx_fmt_ee (code, VOIDmode, operands[6], const0_rtx);
4218 else if (code == EQ || code == LE || code == LT
4219 || code == LEU || code == LTU)
4221 operands[7] = gen_rtx_fmt_ee (code, DImode, operands[2], operands[3]);
4222 operands[8] = gen_rtx_NE (VOIDmode, operands[6], const0_rtx);
4226 operands[7] = gen_rtx_fmt_ee (reverse_condition (code), DImode,
4227 operands[2], operands[3]);
4228 operands[8] = gen_rtx_EQ (VOIDmode, operands[6], const0_rtx);
4233 [(set (match_operand:DI 0 "register_operand" "")
4235 (match_operator 1 "comparison_operator"
4236 [(match_operand:SI 2 "reg_or_0_operand" "")
4237 (match_operand:SI 3 "reg_or_cint_operand" "")])
4238 (match_operand:DI 4 "reg_or_8bit_operand" "")
4239 (match_operand:DI 5 "reg_or_8bit_operand" "")))
4240 (clobber (match_operand:DI 6 "register_operand" ""))]
4241 "operands[3] != const0_rtx
4242 && (GET_CODE (operands[1]) == EQ || GET_CODE (operands[1]) == NE)"
4243 [(set (match_dup 6) (match_dup 7))
4245 (if_then_else:DI (match_dup 8) (match_dup 4) (match_dup 5)))]
4247 enum rtx_code code = GET_CODE (operands[1]);
4248 int unsignedp = (code == GEU || code == LEU || code == GTU || code == LTU);
4251 if ((code != NE && code != EQ
4252 && ! (extended_count (operands[2], DImode, unsignedp) >= 1
4253 && extended_count (operands[3], DImode, unsignedp) >= 1)))
4256 if (GET_CODE (operands[3]) == CONST_INT)
4257 tem = gen_rtx_PLUS (SImode, operands[2],
4258 GEN_INT (- INTVAL (operands[3])));
4260 tem = gen_rtx_MINUS (SImode, operands[2], operands[3]);
4262 operands[7] = gen_rtx_SIGN_EXTEND (DImode, tem);
4263 operands[8] = gen_rtx_fmt_ee (GET_CODE (operands[1]), VOIDmode,
4264 operands[6], const0_rtx);
4270 (match_operator 1 "comparison_operator"
4271 [(match_operand:DI 2 "reg_or_0_operand" "")
4272 (match_operand:DI 3 "reg_or_cint_operand" "")])
4273 (label_ref (match_operand 0 "" ""))
4275 (clobber (match_operand:DI 4 "register_operand" ""))]
4276 "operands[3] != const0_rtx"
4277 [(set (match_dup 4) (match_dup 5))
4278 (set (pc) (if_then_else (match_dup 6) (label_ref (match_dup 0)) (pc)))]
4280 enum rtx_code code = GET_CODE (operands[1]);
4281 int unsignedp = (code == GEU || code == LEU || code == GTU || code == LTU);
4283 if (code == NE || code == EQ
4284 || (extended_count (operands[2], DImode, unsignedp) >= 1
4285 && extended_count (operands[3], DImode, unsignedp) >= 1))
4287 if (GET_CODE (operands[3]) == CONST_INT)
4288 operands[5] = gen_rtx_PLUS (DImode, operands[2],
4289 GEN_INT (- INTVAL (operands[3])));
4291 operands[5] = gen_rtx_MINUS (DImode, operands[2], operands[3]);
4293 operands[6] = gen_rtx_fmt_ee (code, VOIDmode, operands[4], const0_rtx);
4296 else if (code == EQ || code == LE || code == LT
4297 || code == LEU || code == LTU)
4299 operands[5] = gen_rtx_fmt_ee (code, DImode, operands[2], operands[3]);
4300 operands[6] = gen_rtx_NE (VOIDmode, operands[4], const0_rtx);
4304 operands[5] = gen_rtx_fmt_ee (reverse_condition (code), DImode,
4305 operands[2], operands[3]);
4306 operands[6] = gen_rtx_EQ (VOIDmode, operands[4], const0_rtx);
4313 (match_operator 1 "comparison_operator"
4314 [(match_operand:SI 2 "reg_or_0_operand" "")
4315 (match_operand:SI 3 "const_int_operand" "")])
4316 (label_ref (match_operand 0 "" ""))
4318 (clobber (match_operand:DI 4 "register_operand" ""))]
4319 "operands[3] != const0_rtx
4320 && (GET_CODE (operands[1]) == EQ || GET_CODE (operands[1]) == NE)"
4321 [(set (match_dup 4) (match_dup 5))
4322 (set (pc) (if_then_else (match_dup 6) (label_ref (match_dup 0)) (pc)))]
4326 if (GET_CODE (operands[3]) == CONST_INT)
4327 tem = gen_rtx_PLUS (SImode, operands[2],
4328 GEN_INT (- INTVAL (operands[3])));
4330 tem = gen_rtx_MINUS (SImode, operands[2], operands[3]);
4332 operands[5] = gen_rtx_SIGN_EXTEND (DImode, tem);
4333 operands[6] = gen_rtx_fmt_ee (GET_CODE (operands[1]), VOIDmode,
4334 operands[4], const0_rtx);
4337 ;; We can convert such things as "a > 0xffff" to "t = a & ~ 0xffff; t != 0".
4338 ;; This eliminates one, and sometimes two, insns when the AND can be done
4341 [(set (match_operand:DI 0 "register_operand" "")
4342 (match_operator:DI 1 "comparison_operator"
4343 [(match_operand:DI 2 "register_operand" "")
4344 (match_operand:DI 3 "const_int_operand" "")]))
4345 (clobber (match_operand:DI 4 "register_operand" ""))]
4346 "exact_log2 (INTVAL (operands[3]) + 1) >= 0
4347 && (GET_CODE (operands[1]) == GTU
4348 || GET_CODE (operands[1]) == LEU
4349 || ((GET_CODE (operands[1]) == GT || GET_CODE (operands[1]) == LE)
4350 && extended_count (operands[2], DImode, 1) > 0))"
4351 [(set (match_dup 4) (and:DI (match_dup 2) (match_dup 5)))
4352 (set (match_dup 0) (match_dup 6))]
4354 operands[5] = GEN_INT (~ INTVAL (operands[3]));
4355 operands[6] = gen_rtx_fmt_ee (((GET_CODE (operands[1]) == GTU
4356 || GET_CODE (operands[1]) == GT)
4358 DImode, operands[4], const0_rtx);
4361 ;; Prefer to use cmp and arithmetic when possible instead of a cmove.
4364 [(set (match_operand 0 "register_operand" "")
4365 (if_then_else (match_operator 1 "signed_comparison_operator"
4366 [(match_operand:DI 2 "reg_or_0_operand" "")
4368 (match_operand 3 "const_int_operand" "")
4369 (match_operand 4 "const_int_operand" "")))]
4373 if (alpha_split_conditional_move (GET_CODE (operands[1]), operands[0],
4374 operands[2], operands[3], operands[4]))
4380 ;; ??? Why combine is allowed to create such non-canonical rtl, I don't know.
4381 ;; Oh well, we match it in movcc, so it must be partially our fault.
4383 [(set (match_operand 0 "register_operand" "")
4384 (if_then_else (match_operator 1 "signed_comparison_operator"
4386 (match_operand:DI 2 "reg_or_0_operand" "")])
4387 (match_operand 3 "const_int_operand" "")
4388 (match_operand 4 "const_int_operand" "")))]
4392 if (alpha_split_conditional_move (swap_condition (GET_CODE (operands[1])),
4393 operands[0], operands[2], operands[3],
4400 (define_insn_and_split "*cmp_sadd_di"
4401 [(set (match_operand:DI 0 "register_operand" "=r")
4402 (plus:DI (if_then_else:DI
4403 (match_operator 1 "alpha_zero_comparison_operator"
4404 [(match_operand:DI 2 "reg_or_0_operand" "rJ")
4406 (match_operand:DI 3 "const48_operand" "I")
4408 (match_operand:DI 4 "sext_add_operand" "rIO")))
4409 (clobber (match_scratch:DI 5 "=r"))]
4412 "! no_new_pseudos || reload_completed"
4414 (match_op_dup:DI 1 [(match_dup 2) (const_int 0)]))
4416 (plus:DI (mult:DI (match_dup 5) (match_dup 3))
4419 if (! no_new_pseudos)
4420 operands[5] = gen_reg_rtx (DImode);
4421 else if (reg_overlap_mentioned_p (operands[5], operands[4]))
4422 operands[5] = operands[0];
4425 (define_insn_and_split "*cmp_sadd_si"
4426 [(set (match_operand:SI 0 "register_operand" "=r")
4427 (plus:SI (if_then_else:SI
4428 (match_operator 1 "alpha_zero_comparison_operator"
4429 [(match_operand:DI 2 "reg_or_0_operand" "rJ")
4431 (match_operand:SI 3 "const48_operand" "I")
4433 (match_operand:SI 4 "sext_add_operand" "rIO")))
4434 (clobber (match_scratch:SI 5 "=r"))]
4437 "! no_new_pseudos || reload_completed"
4439 (match_op_dup:SI 1 [(match_dup 2) (const_int 0)]))
4441 (plus:SI (mult:SI (match_dup 5) (match_dup 3))
4444 if (! no_new_pseudos)
4445 operands[5] = gen_reg_rtx (DImode);
4446 else if (reg_overlap_mentioned_p (operands[5], operands[4]))
4447 operands[5] = operands[0];
4450 (define_insn_and_split "*cmp_sadd_sidi"
4451 [(set (match_operand:DI 0 "register_operand" "=r")
4453 (plus:SI (if_then_else:SI
4454 (match_operator 1 "alpha_zero_comparison_operator"
4455 [(match_operand:DI 2 "reg_or_0_operand" "rJ")
4457 (match_operand:SI 3 "const48_operand" "I")
4459 (match_operand:SI 4 "sext_add_operand" "rIO"))))
4460 (clobber (match_scratch:SI 5 "=r"))]
4463 "! no_new_pseudos || reload_completed"
4465 (match_op_dup:SI 1 [(match_dup 2) (const_int 0)]))
4467 (sign_extend:DI (plus:SI (mult:SI (match_dup 5) (match_dup 3))
4470 if (! no_new_pseudos)
4471 operands[5] = gen_reg_rtx (DImode);
4472 else if (reg_overlap_mentioned_p (operands[5], operands[4]))
4473 operands[5] = operands[0];
4476 (define_insn_and_split "*cmp_ssub_di"
4477 [(set (match_operand:DI 0 "register_operand" "=r")
4478 (minus:DI (if_then_else:DI
4479 (match_operator 1 "alpha_zero_comparison_operator"
4480 [(match_operand:DI 2 "reg_or_0_operand" "rJ")
4482 (match_operand:DI 3 "const48_operand" "I")
4484 (match_operand:DI 4 "reg_or_8bit_operand" "rI")))
4485 (clobber (match_scratch:DI 5 "=r"))]
4488 "! no_new_pseudos || reload_completed"
4490 (match_op_dup:DI 1 [(match_dup 2) (const_int 0)]))
4492 (minus:DI (mult:DI (match_dup 5) (match_dup 3))
4495 if (! no_new_pseudos)
4496 operands[5] = gen_reg_rtx (DImode);
4497 else if (reg_overlap_mentioned_p (operands[5], operands[4]))
4498 operands[5] = operands[0];
4501 (define_insn_and_split "*cmp_ssub_si"
4502 [(set (match_operand:SI 0 "register_operand" "=r")
4503 (minus:SI (if_then_else:SI
4504 (match_operator 1 "alpha_zero_comparison_operator"
4505 [(match_operand:DI 2 "reg_or_0_operand" "rJ")
4507 (match_operand:SI 3 "const48_operand" "I")
4509 (match_operand:SI 4 "reg_or_8bit_operand" "rI")))
4510 (clobber (match_scratch:SI 5 "=r"))]
4513 "! no_new_pseudos || reload_completed"
4515 (match_op_dup:SI 1 [(match_dup 2) (const_int 0)]))
4517 (minus:SI (mult:SI (match_dup 5) (match_dup 3))
4520 if (! no_new_pseudos)
4521 operands[5] = gen_reg_rtx (DImode);
4522 else if (reg_overlap_mentioned_p (operands[5], operands[4]))
4523 operands[5] = operands[0];
4526 (define_insn_and_split "*cmp_ssub_sidi"
4527 [(set (match_operand:DI 0 "register_operand" "=r")
4529 (minus:SI (if_then_else:SI
4530 (match_operator 1 "alpha_zero_comparison_operator"
4531 [(match_operand:DI 2 "reg_or_0_operand" "rJ")
4533 (match_operand:SI 3 "const48_operand" "I")
4535 (match_operand:SI 4 "reg_or_8bit_operand" "rI"))))
4536 (clobber (match_scratch:SI 5 "=r"))]
4539 "! no_new_pseudos || reload_completed"
4541 (match_op_dup:SI 1 [(match_dup 2) (const_int 0)]))
4543 (sign_extend:DI (minus:SI (mult:SI (match_dup 5) (match_dup 3))
4546 if (! no_new_pseudos)
4547 operands[5] = gen_reg_rtx (DImode);
4548 else if (reg_overlap_mentioned_p (operands[5], operands[4]))
4549 operands[5] = operands[0];
4552 ;; Here are the CALL and unconditional branch insns. Calls on NT and OSF
4553 ;; work differently, so we have different patterns for each.
4555 ;; On Unicos/Mk a call information word (CIW) must be generated for each
4556 ;; call. The CIW contains information about arguments passed in registers
4557 ;; and is stored in the caller's SSIB. Its offset relative to the beginning
4558 ;; of the SSIB is passed in $25. Handling this properly is quite complicated
4559 ;; in the presence of inlining since the CIWs for calls performed by the
4560 ;; inlined function must be stored in the SSIB of the function it is inlined
4561 ;; into as well. We encode the CIW in an unspec and append it to the list
4562 ;; of the CIWs for the current function only when the instruction for loading
4563 ;; $25 is generated.
4565 (define_expand "call"
4566 [(use (match_operand:DI 0 "" ""))
4567 (use (match_operand 1 "" ""))
4568 (use (match_operand 2 "" ""))
4569 (use (match_operand 3 "" ""))]
4572 if (TARGET_ABI_WINDOWS_NT)
4573 emit_call_insn (gen_call_nt (operands[0], operands[1]));
4574 else if (TARGET_ABI_OPEN_VMS)
4575 emit_call_insn (gen_call_vms (operands[0], operands[2]));
4576 else if (TARGET_ABI_UNICOSMK)
4577 emit_call_insn (gen_call_umk (operands[0], operands[2]));
4579 emit_call_insn (gen_call_osf (operands[0], operands[1]));
4583 (define_expand "sibcall"
4584 [(parallel [(call (mem:DI (match_operand 0 "" ""))
4585 (match_operand 1 "" ""))
4586 (unspec [(reg:DI 29)] UNSPEC_SIBCALL)])]
4589 if (GET_CODE (operands[0]) != MEM)
4591 operands[0] = XEXP (operands[0], 0);
4594 (define_expand "call_osf"
4595 [(parallel [(call (mem:DI (match_operand 0 "" ""))
4596 (match_operand 1 "" ""))
4598 (clobber (reg:DI 26))])]
4601 if (GET_CODE (operands[0]) != MEM)
4604 operands[0] = XEXP (operands[0], 0);
4605 if (! call_operand (operands[0], Pmode))
4606 operands[0] = copy_to_mode_reg (Pmode, operands[0]);
4609 (define_expand "call_nt"
4610 [(parallel [(call (mem:DI (match_operand 0 "" ""))
4611 (match_operand 1 "" ""))
4612 (clobber (reg:DI 26))])]
4615 if (GET_CODE (operands[0]) != MEM)
4618 operands[0] = XEXP (operands[0], 0);
4619 if (GET_CODE (operands[0]) != SYMBOL_REF && GET_CODE (operands[0]) != REG)
4620 operands[0] = force_reg (DImode, operands[0]);
4623 ;; Calls on Unicos/Mk are always indirect.
4624 ;; op 0: symbol ref for called function
4625 ;; op 1: CIW for $25 represented by an unspec
4627 (define_expand "call_umk"
4628 [(parallel [(call (mem:DI (match_operand 0 "" ""))
4629 (match_operand 1 "" ""))
4631 (clobber (reg:DI 26))])]
4634 if (GET_CODE (operands[0]) != MEM)
4637 /* Always load the address of the called function into a register;
4638 load the CIW in $25. */
4640 operands[0] = XEXP (operands[0], 0);
4641 if (GET_CODE (operands[0]) != REG)
4642 operands[0] = force_reg (DImode, operands[0]);
4644 emit_move_insn (gen_rtx_REG (DImode, 25), operands[1]);
4648 ;; call openvms/alpha
4649 ;; op 0: symbol ref for called function
4650 ;; op 1: next_arg_reg (argument information value for R25)
4652 (define_expand "call_vms"
4653 [(parallel [(call (mem:DI (match_operand 0 "" ""))
4654 (match_operand 1 "" ""))
4658 (clobber (reg:DI 27))])]
4661 if (GET_CODE (operands[0]) != MEM)
4664 operands[0] = XEXP (operands[0], 0);
4666 /* Always load AI with argument information, then handle symbolic and
4667 indirect call differently. Load RA and set operands[2] to PV in
4670 emit_move_insn (gen_rtx_REG (DImode, 25), operands[1]);
4671 if (GET_CODE (operands[0]) == SYMBOL_REF)
4673 rtx linkage = alpha_need_linkage (XSTR (operands[0], 0), 0);
4675 emit_move_insn (gen_rtx_REG (Pmode, 26), gen_rtx_MEM (Pmode, linkage));
4677 = validize_mem (gen_rtx_MEM (Pmode, plus_constant (linkage, 8)));
4681 emit_move_insn (gen_rtx_REG (Pmode, 26),
4682 gen_rtx_MEM (Pmode, plus_constant (operands[0], 8)));
4683 operands[2] = operands[0];
4688 (define_expand "call_value"
4689 [(use (match_operand 0 "" ""))
4690 (use (match_operand:DI 1 "" ""))
4691 (use (match_operand 2 "" ""))
4692 (use (match_operand 3 "" ""))
4693 (use (match_operand 4 "" ""))]
4696 if (TARGET_ABI_WINDOWS_NT)
4697 emit_call_insn (gen_call_value_nt (operands[0], operands[1], operands[2]));
4698 else if (TARGET_ABI_OPEN_VMS)
4699 emit_call_insn (gen_call_value_vms (operands[0], operands[1],
4701 else if (TARGET_ABI_UNICOSMK)
4702 emit_call_insn (gen_call_value_umk (operands[0], operands[1],
4705 emit_call_insn (gen_call_value_osf (operands[0], operands[1],
4710 (define_expand "sibcall_value"
4711 [(parallel [(set (match_operand 0 "" "")
4712 (call (mem:DI (match_operand 1 "" ""))
4713 (match_operand 2 "" "")))
4714 (unspec [(reg:DI 29)] UNSPEC_SIBCALL)])]
4717 if (GET_CODE (operands[1]) != MEM)
4719 operands[1] = XEXP (operands[1], 0);
4722 (define_expand "call_value_osf"
4723 [(parallel [(set (match_operand 0 "" "")
4724 (call (mem:DI (match_operand 1 "" ""))
4725 (match_operand 2 "" "")))
4727 (clobber (reg:DI 26))])]
4730 if (GET_CODE (operands[1]) != MEM)
4733 operands[1] = XEXP (operands[1], 0);
4734 if (! call_operand (operands[1], Pmode))
4735 operands[1] = copy_to_mode_reg (Pmode, operands[1]);
4738 (define_expand "call_value_nt"
4739 [(parallel [(set (match_operand 0 "" "")
4740 (call (mem:DI (match_operand 1 "" ""))
4741 (match_operand 2 "" "")))
4742 (clobber (reg:DI 26))])]
4745 if (GET_CODE (operands[1]) != MEM)
4748 operands[1] = XEXP (operands[1], 0);
4749 if (GET_CODE (operands[1]) != SYMBOL_REF && GET_CODE (operands[1]) != REG)
4750 operands[1] = force_reg (DImode, operands[1]);
4753 (define_expand "call_value_vms"
4754 [(parallel [(set (match_operand 0 "" "")
4755 (call (mem:DI (match_operand:DI 1 "" ""))
4756 (match_operand 2 "" "")))
4760 (clobber (reg:DI 27))])]
4763 if (GET_CODE (operands[1]) != MEM)
4766 operands[1] = XEXP (operands[1], 0);
4768 /* Always load AI with argument information, then handle symbolic and
4769 indirect call differently. Load RA and set operands[3] to PV in
4772 emit_move_insn (gen_rtx_REG (DImode, 25), operands[2]);
4773 if (GET_CODE (operands[1]) == SYMBOL_REF)
4775 rtx linkage = alpha_need_linkage (XSTR (operands[1], 0), 0);
4777 emit_move_insn (gen_rtx_REG (Pmode, 26), gen_rtx_MEM (Pmode, linkage));
4779 = validize_mem (gen_rtx_MEM (Pmode, plus_constant (linkage, 8)));
4783 emit_move_insn (gen_rtx_REG (Pmode, 26),
4784 gen_rtx_MEM (Pmode, plus_constant (operands[1], 8)));
4785 operands[3] = operands[1];
4789 (define_expand "call_value_umk"
4790 [(parallel [(set (match_operand 0 "" "")
4791 (call (mem:DI (match_operand 1 "" ""))
4792 (match_operand 2 "" "")))
4794 (clobber (reg:DI 26))])]
4797 if (GET_CODE (operands[1]) != MEM)
4800 operands[1] = XEXP (operands[1], 0);
4801 if (GET_CODE (operands[1]) != REG)
4802 operands[1] = force_reg (DImode, operands[1]);
4804 emit_move_insn (gen_rtx_REG (DImode, 25), operands[2]);
4807 (define_insn "*call_osf_1_er"
4808 [(call (mem:DI (match_operand:DI 0 "call_operand" "c,R,s"))
4809 (match_operand 1 "" ""))
4811 (clobber (reg:DI 26))]
4812 "TARGET_EXPLICIT_RELOCS && TARGET_ABI_OSF"
4814 jsr $26,(%0),0\;ldah $29,0($26)\t\t!gpdisp!%*\;lda $29,0($29)\t\t!gpdisp!%*
4816 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!%*"
4817 [(set_attr "type" "jsr")
4818 (set_attr "length" "12,*,16")])
4820 ;; We must use peep2 instead of a split because we need accurate life
4821 ;; information for $gp. Consider the case of { bar(); while (1); }.
4823 [(parallel [(call (mem:DI (match_operand:DI 0 "call_operand" ""))
4824 (match_operand 1 "" ""))
4826 (clobber (reg:DI 26))])]
4827 "TARGET_EXPLICIT_RELOCS && TARGET_ABI_OSF && reload_completed
4828 && ! current_file_function_operand (operands[0], Pmode)
4829 && peep2_regno_dead_p (1, 29)"
4830 [(parallel [(call (mem:DI (match_dup 2))
4832 (set (reg:DI 26) (plus:DI (pc) (const_int 4)))
4833 (unspec_volatile [(reg:DI 29)] UNSPECV_BLOCKAGE)
4834 (use (match_dup 0))])]
4836 if (CONSTANT_P (operands[0]))
4838 operands[2] = gen_rtx_REG (Pmode, 27);
4839 emit_move_insn (operands[2], operands[0]);
4843 operands[2] = operands[0];
4844 operands[0] = const0_rtx;
4849 [(parallel [(call (mem:DI (match_operand:DI 0 "call_operand" ""))
4850 (match_operand 1 "" ""))
4852 (clobber (reg:DI 26))])]
4853 "TARGET_EXPLICIT_RELOCS && TARGET_ABI_OSF && reload_completed
4854 && ! current_file_function_operand (operands[0], Pmode)
4855 && ! peep2_regno_dead_p (1, 29)"
4856 [(parallel [(call (mem:DI (match_dup 2))
4858 (set (reg:DI 26) (plus:DI (pc) (const_int 4)))
4859 (unspec_volatile [(reg:DI 29)] UNSPECV_BLOCKAGE)
4860 (use (match_dup 0))])
4862 (unspec_volatile:DI [(reg:DI 26) (match_dup 3)] UNSPECV_LDGP1))
4864 (unspec:DI [(reg:DI 29) (match_dup 3)] UNSPEC_LDGP2))]
4866 if (CONSTANT_P (operands[0]))
4868 operands[2] = gen_rtx_REG (Pmode, 27);
4869 emit_move_insn (operands[2], operands[0]);
4873 operands[2] = operands[0];
4874 operands[0] = const0_rtx;
4876 operands[3] = GEN_INT (alpha_next_sequence_number++);
4879 ;; We add a blockage unspec_volatile to prevent insns from moving down
4880 ;; from above the call to in between the call and the ldah gpdisp.
4882 (define_insn "*call_osf_2_er"
4883 [(call (mem:DI (match_operand:DI 0 "register_operand" "c"))
4884 (match_operand 1 "" ""))
4885 (set (reg:DI 26) (plus:DI (pc) (const_int 4)))
4886 (unspec_volatile [(reg:DI 29)] UNSPECV_BLOCKAGE)
4887 (use (match_operand 2 "" ""))]
4888 "TARGET_EXPLICIT_RELOCS && TARGET_ABI_OSF"
4890 [(set_attr "type" "jsr")])
4892 (define_insn "*call_osf_1_noreturn"
4893 [(call (mem:DI (match_operand:DI 0 "call_operand" "c,R,s"))
4894 (match_operand 1 "" ""))
4896 (clobber (reg:DI 26))]
4897 "! TARGET_EXPLICIT_RELOCS && TARGET_ABI_OSF
4898 && find_reg_note (insn, REG_NORETURN, NULL_RTX)"
4903 [(set_attr "type" "jsr")
4904 (set_attr "length" "*,*,8")])
4906 (define_insn "*call_osf_1"
4907 [(call (mem:DI (match_operand:DI 0 "call_operand" "c,R,s"))
4908 (match_operand 1 "" ""))
4910 (clobber (reg:DI 26))]
4911 "! TARGET_EXPLICIT_RELOCS && TARGET_ABI_OSF"
4913 jsr $26,($27),0\;ldgp $29,0($26)
4915 jsr $26,%0\;ldgp $29,0($26)"
4916 [(set_attr "type" "jsr")
4917 (set_attr "length" "12,*,16")])
4919 ;; Note that the DEC assembler expands "jmp foo" with $at, which
4920 ;; doesn't do what we want.
4921 (define_insn "*sibcall_osf_1_er"
4922 [(call (mem:DI (match_operand:DI 0 "symbolic_operand" "R,s"))
4923 (match_operand 1 "" ""))
4924 (unspec [(reg:DI 29)] UNSPEC_SIBCALL)]
4925 "TARGET_EXPLICIT_RELOCS && TARGET_ABI_OSF"
4928 ldq $27,%0($29)\t\t!literal!%#\;jmp $31,($27),%0\t\t!lituse_jsr!%#"
4929 [(set_attr "type" "jsr")
4930 (set_attr "length" "*,8")])
4932 (define_insn "*sibcall_osf_1"
4933 [(call (mem:DI (match_operand:DI 0 "symbolic_operand" "R,s"))
4934 (match_operand 1 "" ""))
4935 (unspec [(reg:DI 29)] UNSPEC_SIBCALL)]
4936 "! TARGET_EXPLICIT_RELOCS && TARGET_ABI_OSF"
4939 lda $27,%0\;jmp $31,($27),%0"
4940 [(set_attr "type" "jsr")
4941 (set_attr "length" "*,8")])
4943 (define_insn "*call_nt_1"
4944 [(call (mem:DI (match_operand:DI 0 "call_operand" "r,R,s"))
4945 (match_operand 1 "" ""))
4946 (clobber (reg:DI 26))]
4947 "TARGET_ABI_WINDOWS_NT"
4952 [(set_attr "type" "jsr")
4953 (set_attr "length" "*,*,12")])
4955 (define_insn "*call_vms_1"
4956 [(call (mem:DI (match_operand:DI 0 "call_operand" "r,s"))
4957 (match_operand 1 "" ""))
4958 (use (match_operand:DI 2 "nonimmediate_operand" "r,m"))
4961 (clobber (reg:DI 27))]
4962 "TARGET_ABI_OPEN_VMS"
4964 mov %2,$27\;jsr $26,0\;ldq $27,0($29)
4965 ldq $27,%2\;jsr $26,%0\;ldq $27,0($29)"
4966 [(set_attr "type" "jsr")
4967 (set_attr "length" "12,16")])
4969 (define_insn "*call_umk_1"
4970 [(call (mem:DI (match_operand:DI 0 "call_operand" "r"))
4971 (match_operand 1 "" ""))
4973 (clobber (reg:DI 26))]
4974 "TARGET_ABI_UNICOSMK"
4976 [(set_attr "type" "jsr")])
4978 ;; Call subroutine returning any type.
4980 (define_expand "untyped_call"
4981 [(parallel [(call (match_operand 0 "" "")
4983 (match_operand 1 "" "")
4984 (match_operand 2 "" "")])]
4989 emit_call_insn (GEN_CALL (operands[0], const0_rtx, NULL, const0_rtx));
4991 for (i = 0; i < XVECLEN (operands[2], 0); i++)
4993 rtx set = XVECEXP (operands[2], 0, i);
4994 emit_move_insn (SET_DEST (set), SET_SRC (set));
4997 /* The optimizer does not know that the call sets the function value
4998 registers we stored in the result block. We avoid problems by
4999 claiming that all hard registers are used and clobbered at this
5001 emit_insn (gen_blockage ());
5006 ;; UNSPEC_VOLATILE is considered to use and clobber all hard registers and
5007 ;; all of memory. This blocks insns from being moved across this point.
5009 (define_insn "blockage"
5010 [(unspec_volatile [(const_int 0)] UNSPECV_BLOCKAGE)]
5013 [(set_attr "length" "0")])
5017 (label_ref (match_operand 0 "" "")))]
5020 [(set_attr "type" "ibr")])
5022 (define_expand "return"
5027 (define_insn "*return_internal"
5031 [(set_attr "type" "ibr")])
5033 (define_insn "indirect_jump"
5034 [(set (pc) (match_operand:DI 0 "register_operand" "r"))]
5037 [(set_attr "type" "ibr")])
5039 (define_expand "tablejump"
5040 [(parallel [(set (pc)
5041 (match_operand 0 "register_operand" ""))
5042 (use (label_ref:DI (match_operand 1 "" "")))])]
5045 if (TARGET_ABI_WINDOWS_NT)
5047 rtx dest = gen_reg_rtx (DImode);
5048 emit_insn (gen_extendsidi2 (dest, operands[0]));
5051 else if (TARGET_ABI_OSF)
5053 rtx dest = gen_reg_rtx (DImode);
5054 emit_insn (gen_extendsidi2 (dest, operands[0]));
5055 emit_insn (gen_adddi3 (dest, pic_offset_table_rtx, dest));
5060 (define_insn "*tablejump_osf_nt_internal"
5062 (match_operand:DI 0 "register_operand" "r"))
5063 (use (label_ref:DI (match_operand 1 "" "")))]
5064 "(TARGET_ABI_OSF || TARGET_ABI_WINDOWS_NT)
5065 && alpha_tablejump_addr_vec (insn)"
5067 operands[2] = alpha_tablejump_best_label (insn);
5068 return "jmp $31,(%0),%2";
5070 [(set_attr "type" "ibr")])
5072 (define_insn "*tablejump_internal"
5074 (match_operand:DI 0 "register_operand" "r"))
5075 (use (label_ref (match_operand 1 "" "")))]
5078 [(set_attr "type" "ibr")])
5080 ;; Cache flush. Used by INITIALIZE_TRAMPOLINE. 0x86 is PAL_imb, but we don't
5081 ;; want to have to include pal.h in our .s file.
5083 ;; Technically the type for call_pal is jsr, but we use that for determining
5084 ;; if we need a GP. Use ibr instead since it has the same EV5 scheduling
5087 [(unspec_volatile [(const_int 0)] UNSPECV_IMB)]
5090 [(set_attr "type" "ibr")])
5092 ;; Finally, we have the basic data motion insns. The byte and word insns
5093 ;; are done via define_expand. Start with the floating-point insns, since
5094 ;; they are simpler.
5096 (define_insn "*movsf_nofix"
5097 [(set (match_operand:SF 0 "nonimmediate_operand" "=f,f,*r,*r,m,m")
5098 (match_operand:SF 1 "input_operand" "fG,m,*rG,m,fG,*r"))]
5099 "TARGET_FPREGS && ! TARGET_FIX
5100 && (register_operand (operands[0], SFmode)
5101 || reg_or_fp0_operand (operands[1], SFmode))"
5109 [(set_attr "type" "fcpys,fld,ilog,ild,fst,ist")])
5111 (define_insn "*movsf_fix"
5112 [(set (match_operand:SF 0 "nonimmediate_operand" "=f,f,*r,*r,m,m,f,*r")
5113 (match_operand:SF 1 "input_operand" "fG,m,*rG,m,fG,*r,*r,f"))]
5114 "TARGET_FPREGS && TARGET_FIX
5115 && (register_operand (operands[0], SFmode)
5116 || reg_or_fp0_operand (operands[1], SFmode))"
5126 [(set_attr "type" "fcpys,fld,ilog,ild,fst,ist,itof,ftoi")])
5128 (define_insn "*movsf_nofp"
5129 [(set (match_operand:SF 0 "nonimmediate_operand" "=r,r,m")
5130 (match_operand:SF 1 "input_operand" "rG,m,r"))]
5132 && (register_operand (operands[0], SFmode)
5133 || reg_or_fp0_operand (operands[1], SFmode))"
5138 [(set_attr "type" "ilog,ild,ist")])
5140 (define_insn "*movdf_nofix"
5141 [(set (match_operand:DF 0 "nonimmediate_operand" "=f,f,*r,*r,m,m")
5142 (match_operand:DF 1 "input_operand" "fG,m,*rG,m,fG,*r"))]
5143 "TARGET_FPREGS && ! TARGET_FIX
5144 && (register_operand (operands[0], DFmode)
5145 || reg_or_fp0_operand (operands[1], DFmode))"
5153 [(set_attr "type" "fcpys,fld,ilog,ild,fst,ist")])
5155 (define_insn "*movdf_fix"
5156 [(set (match_operand:DF 0 "nonimmediate_operand" "=f,f,*r,*r,m,m,f,*r")
5157 (match_operand:DF 1 "input_operand" "fG,m,*rG,m,fG,*r,*r,f"))]
5158 "TARGET_FPREGS && TARGET_FIX
5159 && (register_operand (operands[0], DFmode)
5160 || reg_or_fp0_operand (operands[1], DFmode))"
5170 [(set_attr "type" "fcpys,fld,ilog,ild,fst,ist,itof,ftoi")])
5172 (define_insn "*movdf_nofp"
5173 [(set (match_operand:DF 0 "nonimmediate_operand" "=r,r,m")
5174 (match_operand:DF 1 "input_operand" "rG,m,r"))]
5176 && (register_operand (operands[0], DFmode)
5177 || reg_or_fp0_operand (operands[1], DFmode))"
5182 [(set_attr "type" "ilog,ild,ist")])
5184 ;; Subregs suck for register allocation. Pretend we can move TFmode
5185 ;; data between general registers until after reload.
5187 (define_insn_and_split "*movtf_internal"
5188 [(set (match_operand:TF 0 "nonimmediate_operand" "=r,o")
5189 (match_operand:TF 1 "input_operand" "roG,rG"))]
5190 "register_operand (operands[0], TFmode)
5191 || reg_or_fp0_operand (operands[1], TFmode)"
5194 [(set (match_dup 0) (match_dup 2))
5195 (set (match_dup 1) (match_dup 3))]
5197 alpha_split_tfmode_pair (operands);
5198 if (reg_overlap_mentioned_p (operands[0], operands[3]))
5201 tmp = operands[0], operands[0] = operands[1], operands[1] = tmp;
5202 tmp = operands[2], operands[2] = operands[3], operands[3] = tmp;
5206 (define_expand "movsf"
5207 [(set (match_operand:SF 0 "nonimmediate_operand" "")
5208 (match_operand:SF 1 "general_operand" ""))]
5211 if (GET_CODE (operands[0]) == MEM
5212 && ! reg_or_fp0_operand (operands[1], SFmode))
5213 operands[1] = force_reg (SFmode, operands[1]);
5216 (define_expand "movdf"
5217 [(set (match_operand:DF 0 "nonimmediate_operand" "")
5218 (match_operand:DF 1 "general_operand" ""))]
5221 if (GET_CODE (operands[0]) == MEM
5222 && ! reg_or_fp0_operand (operands[1], DFmode))
5223 operands[1] = force_reg (DFmode, operands[1]);
5226 (define_expand "movtf"
5227 [(set (match_operand:TF 0 "nonimmediate_operand" "")
5228 (match_operand:TF 1 "general_operand" ""))]
5231 if (GET_CODE (operands[0]) == MEM
5232 && ! reg_or_fp0_operand (operands[1], TFmode))
5233 operands[1] = force_reg (TFmode, operands[1]);
5236 (define_insn "*movsi_nofix"
5237 [(set (match_operand:SI 0 "nonimmediate_operand" "=r,r,r,r,m,*f,*f,m")
5238 (match_operand:SI 1 "input_operand" "rJ,K,L,m,rJ,*fJ,m,*f"))]
5239 "(TARGET_ABI_OSF || TARGET_ABI_UNICOSMK) && ! TARGET_FIX
5240 && (register_operand (operands[0], SImode)
5241 || reg_or_0_operand (operands[1], SImode))"
5251 [(set_attr "type" "ilog,iadd,iadd,ild,ist,fcpys,fld,fst")])
5253 (define_insn "*movsi_fix"
5254 [(set (match_operand:SI 0 "nonimmediate_operand" "=r,r,r,r,m,*f,*f,m,r,*f")
5255 (match_operand:SI 1 "input_operand" "rJ,K,L,m,rJ,*fJ,m,*f,*f,r"))]
5256 "TARGET_ABI_OSF && TARGET_FIX
5257 && (register_operand (operands[0], SImode)
5258 || reg_or_0_operand (operands[1], SImode))"
5270 [(set_attr "type" "ilog,iadd,iadd,ild,ist,fcpys,fld,fst,ftoi,itof")])
5272 (define_insn "*movsi_nt_vms"
5273 [(set (match_operand:SI 0 "nonimmediate_operand" "=r,r,r,r,r,m,*f,*f,m")
5274 (match_operand:SI 1 "input_operand" "rJ,K,L,s,m,rJ,*fJ,m,*f"))]
5275 "(TARGET_ABI_WINDOWS_NT || TARGET_ABI_OPEN_VMS)
5276 && (register_operand (operands[0], SImode)
5277 || reg_or_0_operand (operands[1], SImode))"
5288 [(set_attr "type" "ilog,iadd,iadd,ldsym,ild,ist,fcpys,fld,fst")])
5290 (define_insn "*movhi_nobwx"
5291 [(set (match_operand:HI 0 "register_operand" "=r,r")
5292 (match_operand:HI 1 "input_operand" "rJ,n"))]
5294 && (register_operand (operands[0], HImode)
5295 || register_operand (operands[1], HImode))"
5299 [(set_attr "type" "ilog,iadd")])
5301 (define_insn "*movhi_bwx"
5302 [(set (match_operand:HI 0 "nonimmediate_operand" "=r,r,r,m")
5303 (match_operand:HI 1 "input_operand" "rJ,n,m,rJ"))]
5305 && (register_operand (operands[0], HImode)
5306 || reg_or_0_operand (operands[1], HImode))"
5312 [(set_attr "type" "ilog,iadd,ild,ist")])
5314 (define_insn "*movqi_nobwx"
5315 [(set (match_operand:QI 0 "register_operand" "=r,r")
5316 (match_operand:QI 1 "input_operand" "rJ,n"))]
5318 && (register_operand (operands[0], QImode)
5319 || register_operand (operands[1], QImode))"
5323 [(set_attr "type" "ilog,iadd")])
5325 (define_insn "*movqi_bwx"
5326 [(set (match_operand:QI 0 "nonimmediate_operand" "=r,r,r,m")
5327 (match_operand:QI 1 "input_operand" "rJ,n,m,rJ"))]
5329 && (register_operand (operands[0], QImode)
5330 || reg_or_0_operand (operands[1], QImode))"
5336 [(set_attr "type" "ilog,iadd,ild,ist")])
5338 ;; We do two major things here: handle mem->mem and construct long
5341 (define_expand "movsi"
5342 [(set (match_operand:SI 0 "nonimmediate_operand" "")
5343 (match_operand:SI 1 "general_operand" ""))]
5346 if (alpha_expand_mov (SImode, operands))
5350 ;; Split a load of a large constant into the appropriate two-insn
5354 [(set (match_operand:SI 0 "register_operand" "")
5355 (match_operand:SI 1 "const_int_operand" ""))]
5356 "! add_operand (operands[1], SImode)"
5357 [(set (match_dup 0) (match_dup 2))
5358 (set (match_dup 0) (plus:SI (match_dup 0) (match_dup 3)))]
5361 = alpha_emit_set_const (operands[0], SImode, INTVAL (operands[1]), 2);
5363 if (tem == operands[0])
5369 ;; Split the load of an address into a four-insn sequence on Unicos/Mk.
5370 ;; Always generate a REG_EQUAL note for the last instruction to facilitate
5371 ;; optimisations. If the symbolic operand is a label_ref, generate REG_LABEL
5372 ;; notes and update LABEL_NUSES because this is not done automatically.
5373 ;; Labels may be incorrectly deleted if we don't do this.
5375 ;; Describing what the individual instructions do correctly is too complicated
5376 ;; so use UNSPECs for each of the three parts of an address.
5379 [(set (match_operand:DI 0 "register_operand" "")
5380 (match_operand:DI 1 "symbolic_operand" ""))]
5381 "TARGET_ABI_UNICOSMK && reload_completed"
5384 rtx insn1, insn2, insn3;
5386 insn1 = emit_insn (gen_umk_laum (operands[0], operands[1]));
5387 emit_insn (gen_ashldi3 (operands[0], operands[0], GEN_INT (32)));
5388 insn2 = emit_insn (gen_umk_lalm (operands[0], operands[0], operands[1]));
5389 insn3 = emit_insn (gen_umk_lal (operands[0], operands[0], operands[1]));
5390 REG_NOTES (insn3) = gen_rtx_EXPR_LIST (REG_EQUAL, operands[1],
5392 if (GET_CODE (operands[1]) == LABEL_REF)
5396 label = XEXP (operands[1], 0);
5397 REG_NOTES (insn1) = gen_rtx_EXPR_LIST (REG_LABEL, label,
5399 REG_NOTES (insn2) = gen_rtx_EXPR_LIST (REG_LABEL, label,
5401 REG_NOTES (insn3) = gen_rtx_EXPR_LIST (REG_LABEL, label,
5403 LABEL_NUSES (label) += 3;
5408 ;; Instructions for loading the three parts of an address on Unicos/Mk.
5410 (define_insn "umk_laum"
5411 [(set (match_operand:DI 0 "register_operand" "=r")
5412 (unspec:DI [(match_operand:DI 1 "symbolic_operand" "")]
5414 "TARGET_ABI_UNICOSMK"
5416 [(set_attr "type" "iadd")])
5418 (define_insn "umk_lalm"
5419 [(set (match_operand:DI 0 "register_operand" "=r")
5420 (plus:DI (match_operand:DI 1 "register_operand" "r")
5421 (unspec:DI [(match_operand:DI 2 "symbolic_operand" "")]
5423 "TARGET_ABI_UNICOSMK"
5425 [(set_attr "type" "iadd")])
5427 (define_insn "umk_lal"
5428 [(set (match_operand:DI 0 "register_operand" "=r")
5429 (plus:DI (match_operand:DI 1 "register_operand" "r")
5430 (unspec:DI [(match_operand:DI 2 "symbolic_operand" "")]
5432 "TARGET_ABI_UNICOSMK"
5434 [(set_attr "type" "iadd")])
5436 ;; Add a new call information word to the current function's list of CIWs
5437 ;; and load its index into $25. Doing it here ensures that the CIW will be
5438 ;; associated with the correct function even in the presence of inlining.
5440 (define_insn "*umk_load_ciw"
5442 (unspec:DI [(match_operand 0 "" "")] UNSPEC_UMK_LOAD_CIW))]
5443 "TARGET_ABI_UNICOSMK"
5445 operands[0] = unicosmk_add_call_info_word (operands[0]);
5446 return "lda $25,%0";
5448 [(set_attr "type" "iadd")])
5450 (define_insn "*movdi_er_low_l"
5451 [(set (match_operand:DI 0 "register_operand" "=r")
5452 (lo_sum:DI (match_operand:DI 1 "register_operand" "r")
5453 (match_operand:DI 2 "local_symbolic_operand" "")))]
5454 "TARGET_EXPLICIT_RELOCS"
5456 if (true_regnum (operands[1]) == 29)
5457 return "lda %0,%2(%1)\t\t!gprel";
5459 return "lda %0,%2(%1)\t\t!gprellow";
5462 (define_insn "movdi_er_high_g"
5463 [(set (match_operand:DI 0 "register_operand" "=r")
5464 (unspec:DI [(match_operand:DI 1 "register_operand" "r")
5465 (match_operand:DI 2 "global_symbolic_operand" "")
5466 (match_operand 3 "const_int_operand" "")]
5468 "TARGET_EXPLICIT_RELOCS"
5469 "ldq %0,%2(%1)\t\t!literal"
5470 [(set_attr "type" "ldsym")])
5472 (define_insn "*movdi_er_nofix"
5473 [(set (match_operand:DI 0 "nonimmediate_operand" "=r,r,r,r,r,m,*f,*f,Q")
5474 (match_operand:DI 1 "input_operand" "rJ,K,L,T,m,rJ,*fJ,Q,*f"))]
5475 "TARGET_EXPLICIT_RELOCS && ! TARGET_FIX
5476 && (register_operand (operands[0], DImode)
5477 || reg_or_0_operand (operands[1], DImode))"
5488 [(set_attr "type" "ilog,iadd,iadd,iadd,ild,ist,fcpys,fld,fst")])
5490 ;; The 'U' constraint matches symbolic operands on Unicos/Mk. Those should
5491 ;; have been split up by the rules above but we shouldn't reject the
5492 ;; possibility of them getting through.
5494 (define_insn "*movdi_nofix"
5495 [(set (match_operand:DI 0 "nonimmediate_operand" "=r,r,r,r,r,r,m,*f,*f,Q")
5496 (match_operand:DI 1 "input_operand" "rJ,K,L,U,s,m,rJ,*fJ,Q,*f"))]
5498 && (register_operand (operands[0], DImode)
5499 || reg_or_0_operand (operands[1], DImode))"
5504 laum %0,%t1($31)\;sll %0,32,%0\;lalm %0,%t1(%0)\;lal %0,%t1(%0)
5511 [(set_attr "type" "ilog,iadd,iadd,ldsym,ldsym,ild,ist,fcpys,fld,fst")
5512 (set_attr "length" "*,*,*,16,*,*,*,*,*,*")])
5514 (define_insn "*movdi_er_fix"
5515 [(set (match_operand:DI 0 "nonimmediate_operand" "=r,r,r,r,r,m,*f,*f,Q,r,*f")
5516 (match_operand:DI 1 "input_operand" "rJ,K,L,T,m,rJ,*fJ,Q,*f,*f,r"))]
5517 "TARGET_EXPLICIT_RELOCS && TARGET_FIX
5518 && (register_operand (operands[0], DImode)
5519 || reg_or_0_operand (operands[1], DImode))"
5532 [(set_attr "type" "ilog,iadd,iadd,iadd,ild,ist,fcpys,fld,fst,ftoi,itof")])
5534 (define_insn "*movdi_fix"
5535 [(set (match_operand:DI 0 "nonimmediate_operand" "=r,r,r,r,r,m,*f,*f,Q,r,*f")
5536 (match_operand:DI 1 "input_operand" "rJ,K,L,s,m,rJ,*fJ,Q,*f,*f,r"))]
5537 "! TARGET_EXPLICIT_RELOCS && TARGET_FIX
5538 && (register_operand (operands[0], DImode)
5539 || reg_or_0_operand (operands[1], DImode))"
5552 [(set_attr "type" "ilog,iadd,iadd,ldsym,ild,ist,fcpys,fld,fst,ftoi,itof")])
5554 ;; VMS needs to set up "vms_base_regno" for unwinding. This move
5555 ;; often appears dead to the life analysis code, at which point we
5556 ;; abort for emitting dead prologue instructions. Force this live.
5558 (define_insn "force_movdi"
5559 [(set (match_operand:DI 0 "register_operand" "=r")
5560 (unspec_volatile:DI [(match_operand:DI 1 "register_operand" "r")]
5561 UNSPECV_FORCE_MOV))]
5564 [(set_attr "type" "ilog")])
5566 ;; We do three major things here: handle mem->mem, put 64-bit constants in
5567 ;; memory, and construct long 32-bit constants.
5569 (define_expand "movdi"
5570 [(set (match_operand:DI 0 "nonimmediate_operand" "")
5571 (match_operand:DI 1 "general_operand" ""))]
5574 if (alpha_expand_mov (DImode, operands))
5578 ;; Split a load of a large constant into the appropriate two-insn
5582 [(set (match_operand:DI 0 "register_operand" "")
5583 (match_operand:DI 1 "const_int_operand" ""))]
5584 "! add_operand (operands[1], DImode)"
5585 [(set (match_dup 0) (match_dup 2))
5586 (set (match_dup 0) (plus:DI (match_dup 0) (match_dup 3)))]
5589 = alpha_emit_set_const (operands[0], DImode, INTVAL (operands[1]), 2);
5591 if (tem == operands[0])
5597 ;; These are the partial-word cases.
5599 ;; First we have the code to load an aligned word. Operand 0 is the register
5600 ;; in which to place the result. It's mode is QImode or HImode. Operand 1
5601 ;; is an SImode MEM at the low-order byte of the proper word. Operand 2 is the
5602 ;; number of bits within the word that the value is. Operand 3 is an SImode
5603 ;; scratch register. If operand 0 is a hard register, operand 3 may be the
5604 ;; same register. It is allowed to conflict with operand 1 as well.
5606 (define_expand "aligned_loadqi"
5607 [(set (match_operand:SI 3 "register_operand" "")
5608 (match_operand:SI 1 "memory_operand" ""))
5609 (set (subreg:DI (match_operand:QI 0 "register_operand" "") 0)
5610 (zero_extract:DI (subreg:DI (match_dup 3) 0)
5612 (match_operand:DI 2 "const_int_operand" "")))]
5617 (define_expand "aligned_loadhi"
5618 [(set (match_operand:SI 3 "register_operand" "")
5619 (match_operand:SI 1 "memory_operand" ""))
5620 (set (subreg:DI (match_operand:HI 0 "register_operand" "") 0)
5621 (zero_extract:DI (subreg:DI (match_dup 3) 0)
5623 (match_operand:DI 2 "const_int_operand" "")))]
5628 ;; Similar for unaligned loads, where we use the sequence from the
5629 ;; Alpha Architecture manual. We have to distinguish between little-endian
5630 ;; and big-endian systems as the sequences are different.
5632 ;; Operand 1 is the address. Operands 2 and 3 are temporaries, where
5633 ;; operand 3 can overlap the input and output registers.
5635 (define_expand "unaligned_loadqi"
5636 [(use (match_operand:QI 0 "register_operand" ""))
5637 (use (match_operand:DI 1 "address_operand" ""))
5638 (use (match_operand:DI 2 "register_operand" ""))
5639 (use (match_operand:DI 3 "register_operand" ""))]
5642 if (WORDS_BIG_ENDIAN)
5643 emit_insn (gen_unaligned_loadqi_be (operands[0], operands[1],
5644 operands[2], operands[3]));
5646 emit_insn (gen_unaligned_loadqi_le (operands[0], operands[1],
5647 operands[2], operands[3]));
5651 (define_expand "unaligned_loadqi_le"
5652 [(set (match_operand:DI 2 "register_operand" "")
5653 (mem:DI (and:DI (match_operand:DI 1 "address_operand" "")
5655 (set (match_operand:DI 3 "register_operand" "")
5657 (set (subreg:DI (match_operand:QI 0 "register_operand" "") 0)
5658 (zero_extract:DI (match_dup 2)
5660 (ashift:DI (match_dup 3) (const_int 3))))]
5661 "! WORDS_BIG_ENDIAN"
5664 (define_expand "unaligned_loadqi_be"
5665 [(set (match_operand:DI 2 "register_operand" "")
5666 (mem:DI (and:DI (match_operand:DI 1 "address_operand" "")
5668 (set (match_operand:DI 3 "register_operand" "")
5670 (set (subreg:DI (match_operand:QI 0 "register_operand" "") 0)
5671 (zero_extract:DI (match_dup 2)
5675 (ashift:DI (match_dup 3) (const_int 3)))))]
5679 (define_expand "unaligned_loadhi"
5680 [(use (match_operand:QI 0 "register_operand" ""))
5681 (use (match_operand:DI 1 "address_operand" ""))
5682 (use (match_operand:DI 2 "register_operand" ""))
5683 (use (match_operand:DI 3 "register_operand" ""))]
5686 if (WORDS_BIG_ENDIAN)
5687 emit_insn (gen_unaligned_loadhi_be (operands[0], operands[1],
5688 operands[2], operands[3]));
5690 emit_insn (gen_unaligned_loadhi_le (operands[0], operands[1],
5691 operands[2], operands[3]));
5695 (define_expand "unaligned_loadhi_le"
5696 [(set (match_operand:DI 2 "register_operand" "")
5697 (mem:DI (and:DI (match_operand:DI 1 "address_operand" "")
5699 (set (match_operand:DI 3 "register_operand" "")
5701 (set (subreg:DI (match_operand:QI 0 "register_operand" "") 0)
5702 (zero_extract:DI (match_dup 2)
5704 (ashift:DI (match_dup 3) (const_int 3))))]
5705 "! WORDS_BIG_ENDIAN"
5708 (define_expand "unaligned_loadhi_be"
5709 [(set (match_operand:DI 2 "register_operand" "")
5710 (mem:DI (and:DI (match_operand:DI 1 "address_operand" "")
5712 (set (match_operand:DI 3 "register_operand" "")
5713 (plus:DI (match_dup 1) (const_int 1)))
5714 (set (subreg:DI (match_operand:QI 0 "register_operand" "") 0)
5715 (zero_extract:DI (match_dup 2)
5719 (ashift:DI (match_dup 3) (const_int 3)))))]
5723 ;; Storing an aligned byte or word requires two temporaries. Operand 0 is the
5724 ;; aligned SImode MEM. Operand 1 is the register containing the
5725 ;; byte or word to store. Operand 2 is the number of bits within the word that
5726 ;; the value should be placed. Operands 3 and 4 are SImode temporaries.
5728 (define_expand "aligned_store"
5729 [(set (match_operand:SI 3 "register_operand" "")
5730 (match_operand:SI 0 "memory_operand" ""))
5731 (set (subreg:DI (match_dup 3) 0)
5732 (and:DI (subreg:DI (match_dup 3) 0) (match_dup 5)))
5733 (set (subreg:DI (match_operand:SI 4 "register_operand" "") 0)
5734 (ashift:DI (zero_extend:DI (match_operand 1 "register_operand" ""))
5735 (match_operand:DI 2 "const_int_operand" "")))
5736 (set (subreg:DI (match_dup 4) 0)
5737 (ior:DI (subreg:DI (match_dup 4) 0) (subreg:DI (match_dup 3) 0)))
5738 (set (match_dup 0) (match_dup 4))]
5741 operands[5] = GEN_INT (~ (GET_MODE_MASK (GET_MODE (operands[1]))
5742 << INTVAL (operands[2])));
5745 ;; For the unaligned byte and halfword cases, we use code similar to that
5746 ;; in the ;; Architecture book, but reordered to lower the number of registers
5747 ;; required. Operand 0 is the address. Operand 1 is the data to store.
5748 ;; Operands 2, 3, and 4 are DImode temporaries, where operands 2 and 4 may
5749 ;; be the same temporary, if desired. If the address is in a register,
5750 ;; operand 2 can be that register.
5752 (define_expand "unaligned_storeqi"
5753 [(use (match_operand:DI 0 "address_operand" ""))
5754 (use (match_operand:QI 1 "register_operand" ""))
5755 (use (match_operand:DI 2 "register_operand" ""))
5756 (use (match_operand:DI 3 "register_operand" ""))
5757 (use (match_operand:DI 4 "register_operand" ""))]
5760 if (WORDS_BIG_ENDIAN)
5761 emit_insn (gen_unaligned_storeqi_be (operands[0], operands[1],
5762 operands[2], operands[3],
5765 emit_insn (gen_unaligned_storeqi_le (operands[0], operands[1],
5766 operands[2], operands[3],
5771 (define_expand "unaligned_storeqi_le"
5772 [(set (match_operand:DI 3 "register_operand" "")
5773 (mem:DI (and:DI (match_operand:DI 0 "address_operand" "")
5775 (set (match_operand:DI 2 "register_operand" "")
5778 (and:DI (not:DI (ashift:DI (const_int 255)
5779 (ashift:DI (match_dup 2) (const_int 3))))
5781 (set (match_operand:DI 4 "register_operand" "")
5782 (ashift:DI (zero_extend:DI (match_operand:QI 1 "register_operand" ""))
5783 (ashift:DI (match_dup 2) (const_int 3))))
5784 (set (match_dup 4) (ior:DI (match_dup 4) (match_dup 3)))
5785 (set (mem:DI (and:DI (match_dup 0) (const_int -8)))
5787 "! WORDS_BIG_ENDIAN"
5790 (define_expand "unaligned_storeqi_be"
5791 [(set (match_operand:DI 3 "register_operand" "")
5792 (mem:DI (and:DI (match_operand:DI 0 "address_operand" "")
5794 (set (match_operand:DI 2 "register_operand" "")
5797 (and:DI (not:DI (ashift:DI (const_int 255)
5798 (minus:DI (const_int 56)
5799 (ashift:DI (match_dup 2) (const_int 3)))))
5801 (set (match_operand:DI 4 "register_operand" "")
5802 (ashift:DI (zero_extend:DI (match_operand:QI 1 "register_operand" ""))
5803 (minus:DI (const_int 56)
5804 (ashift:DI (match_dup 2) (const_int 3)))))
5805 (set (match_dup 4) (ior:DI (match_dup 4) (match_dup 3)))
5806 (set (mem:DI (and:DI (match_dup 0) (const_int -8)))
5811 (define_expand "unaligned_storehi"
5812 [(use (match_operand:DI 0 "address_operand" ""))
5813 (use (match_operand:HI 1 "register_operand" ""))
5814 (use (match_operand:DI 2 "register_operand" ""))
5815 (use (match_operand:DI 3 "register_operand" ""))
5816 (use (match_operand:DI 4 "register_operand" ""))]
5819 if (WORDS_BIG_ENDIAN)
5820 emit_insn (gen_unaligned_storehi_be (operands[0], operands[1],
5821 operands[2], operands[3],
5824 emit_insn (gen_unaligned_storehi_le (operands[0], operands[1],
5825 operands[2], operands[3],
5830 (define_expand "unaligned_storehi_le"
5831 [(set (match_operand:DI 3 "register_operand" "")
5832 (mem:DI (and:DI (match_operand:DI 0 "address_operand" "")
5834 (set (match_operand:DI 2 "register_operand" "")
5837 (and:DI (not:DI (ashift:DI (const_int 65535)
5838 (ashift:DI (match_dup 2) (const_int 3))))
5840 (set (match_operand:DI 4 "register_operand" "")
5841 (ashift:DI (zero_extend:DI (match_operand:HI 1 "register_operand" ""))
5842 (ashift:DI (match_dup 2) (const_int 3))))
5843 (set (match_dup 4) (ior:DI (match_dup 4) (match_dup 3)))
5844 (set (mem:DI (and:DI (match_dup 0) (const_int -8)))
5846 "! WORDS_BIG_ENDIAN"
5849 (define_expand "unaligned_storehi_be"
5850 [(set (match_operand:DI 3 "register_operand" "")
5851 (mem:DI (and:DI (match_operand:DI 0 "address_operand" "")
5853 (set (match_operand:DI 2 "register_operand" "")
5854 (plus:DI (match_dup 0) (const_int 1)))
5856 (and:DI (not:DI (ashift:DI
5858 (minus:DI (const_int 56)
5859 (ashift:DI (match_dup 2) (const_int 3)))))
5861 (set (match_operand:DI 4 "register_operand" "")
5862 (ashift:DI (zero_extend:DI (match_operand:HI 1 "register_operand" ""))
5863 (minus:DI (const_int 56)
5864 (ashift:DI (match_dup 2) (const_int 3)))))
5865 (set (match_dup 4) (ior:DI (match_dup 4) (match_dup 3)))
5866 (set (mem:DI (and:DI (match_dup 0) (const_int -8)))
5871 ;; Here are the define_expand's for QI and HI moves that use the above
5872 ;; patterns. We have the normal sets, plus the ones that need scratch
5873 ;; registers for reload.
5875 (define_expand "movqi"
5876 [(set (match_operand:QI 0 "nonimmediate_operand" "")
5877 (match_operand:QI 1 "general_operand" ""))]
5881 ? alpha_expand_mov (QImode, operands)
5882 : alpha_expand_mov_nobwx (QImode, operands))
5886 (define_expand "movhi"
5887 [(set (match_operand:HI 0 "nonimmediate_operand" "")
5888 (match_operand:HI 1 "general_operand" ""))]
5892 ? alpha_expand_mov (HImode, operands)
5893 : alpha_expand_mov_nobwx (HImode, operands))
5897 ;; Here are the versions for reload. Note that in the unaligned cases
5898 ;; we know that the operand must not be a pseudo-register because stack
5899 ;; slots are always aligned references.
5901 (define_expand "reload_inqi"
5902 [(parallel [(match_operand:QI 0 "register_operand" "=r")
5903 (match_operand:QI 1 "any_memory_operand" "m")
5904 (match_operand:TI 2 "register_operand" "=&r")])]
5909 if (GET_CODE (operands[1]) != MEM)
5912 if (aligned_memory_operand (operands[1], QImode))
5914 seq = gen_reload_inqi_help (operands[0], operands[1],
5915 gen_rtx_REG (SImode, REGNO (operands[2])));
5921 /* It is possible that one of the registers we got for operands[2]
5922 might coincide with that of operands[0] (which is why we made
5923 it TImode). Pick the other one to use as our scratch. */
5924 if (REGNO (operands[0]) == REGNO (operands[2]))
5925 scratch = gen_rtx_REG (DImode, REGNO (operands[2]) + 1);
5927 scratch = gen_rtx_REG (DImode, REGNO (operands[2]));
5929 addr = get_unaligned_address (operands[1], 0);
5930 seq = gen_unaligned_loadqi (operands[0], addr, scratch,
5931 gen_rtx_REG (DImode, REGNO (operands[0])));
5932 alpha_set_memflags (seq, operands[1]);
5938 (define_expand "reload_inhi"
5939 [(parallel [(match_operand:HI 0 "register_operand" "=r")
5940 (match_operand:HI 1 "any_memory_operand" "m")
5941 (match_operand:TI 2 "register_operand" "=&r")])]
5946 if (GET_CODE (operands[1]) != MEM)
5949 if (aligned_memory_operand (operands[1], HImode))
5951 seq = gen_reload_inhi_help (operands[0], operands[1],
5952 gen_rtx_REG (SImode, REGNO (operands[2])));
5958 /* It is possible that one of the registers we got for operands[2]
5959 might coincide with that of operands[0] (which is why we made
5960 it TImode). Pick the other one to use as our scratch. */
5961 if (REGNO (operands[0]) == REGNO (operands[2]))
5962 scratch = gen_rtx_REG (DImode, REGNO (operands[2]) + 1);
5964 scratch = gen_rtx_REG (DImode, REGNO (operands[2]));
5966 addr = get_unaligned_address (operands[1], 0);
5967 seq = gen_unaligned_loadhi (operands[0], addr, scratch,
5968 gen_rtx_REG (DImode, REGNO (operands[0])));
5969 alpha_set_memflags (seq, operands[1]);
5975 (define_expand "reload_outqi"
5976 [(parallel [(match_operand:QI 0 "any_memory_operand" "=m")
5977 (match_operand:QI 1 "register_operand" "r")
5978 (match_operand:TI 2 "register_operand" "=&r")])]
5981 if (GET_CODE (operands[0]) != MEM)
5984 if (aligned_memory_operand (operands[0], QImode))
5986 emit_insn (gen_reload_outqi_help
5987 (operands[0], operands[1],
5988 gen_rtx_REG (SImode, REGNO (operands[2])),
5989 gen_rtx_REG (SImode, REGNO (operands[2]) + 1)));
5993 rtx addr = get_unaligned_address (operands[0], 0);
5994 rtx scratch1 = gen_rtx_REG (DImode, REGNO (operands[2]));
5995 rtx scratch2 = gen_rtx_REG (DImode, REGNO (operands[2]) + 1);
5996 rtx scratch3 = scratch1;
5999 if (GET_CODE (addr) == REG)
6002 seq = gen_unaligned_storeqi (addr, operands[1], scratch1,
6003 scratch2, scratch3);
6004 alpha_set_memflags (seq, operands[0]);
6010 (define_expand "reload_outhi"
6011 [(parallel [(match_operand:HI 0 "any_memory_operand" "=m")
6012 (match_operand:HI 1 "register_operand" "r")
6013 (match_operand:TI 2 "register_operand" "=&r")])]
6016 if (GET_CODE (operands[0]) != MEM)
6019 if (aligned_memory_operand (operands[0], HImode))
6021 emit_insn (gen_reload_outhi_help
6022 (operands[0], operands[1],
6023 gen_rtx_REG (SImode, REGNO (operands[2])),
6024 gen_rtx_REG (SImode, REGNO (operands[2]) + 1)));
6028 rtx addr = get_unaligned_address (operands[0], 0);
6029 rtx scratch1 = gen_rtx_REG (DImode, REGNO (operands[2]));
6030 rtx scratch2 = gen_rtx_REG (DImode, REGNO (operands[2]) + 1);
6031 rtx scratch3 = scratch1;
6034 if (GET_CODE (addr) == REG)
6037 seq = gen_unaligned_storehi (addr, operands[1], scratch1,
6038 scratch2, scratch3);
6039 alpha_set_memflags (seq, operands[0]);
6045 ;; Helpers for the above. The way reload is structured, we can't
6046 ;; always get a proper address for a stack slot during reload_foo
6047 ;; expansion, so we must delay our address manipulations until after.
6049 (define_insn "reload_inqi_help"
6050 [(set (match_operand:QI 0 "register_operand" "=r")
6051 (match_operand:QI 1 "memory_operand" "m"))
6052 (clobber (match_operand:SI 2 "register_operand" "=r"))]
6053 "! TARGET_BWX && (reload_in_progress || reload_completed)"
6056 (define_insn "reload_inhi_help"
6057 [(set (match_operand:HI 0 "register_operand" "=r")
6058 (match_operand:HI 1 "memory_operand" "m"))
6059 (clobber (match_operand:SI 2 "register_operand" "=r"))]
6060 "! TARGET_BWX && (reload_in_progress || reload_completed)"
6063 (define_insn "reload_outqi_help"
6064 [(set (match_operand:QI 0 "memory_operand" "=m")
6065 (match_operand:QI 1 "register_operand" "r"))
6066 (clobber (match_operand:SI 2 "register_operand" "=r"))
6067 (clobber (match_operand:SI 3 "register_operand" "=r"))]
6068 "! TARGET_BWX && (reload_in_progress || reload_completed)"
6071 (define_insn "reload_outhi_help"
6072 [(set (match_operand:HI 0 "memory_operand" "=m")
6073 (match_operand:HI 1 "register_operand" "r"))
6074 (clobber (match_operand:SI 2 "register_operand" "=r"))
6075 (clobber (match_operand:SI 3 "register_operand" "=r"))]
6076 "! TARGET_BWX && (reload_in_progress || reload_completed)"
6080 [(set (match_operand:QI 0 "register_operand" "")
6081 (match_operand:QI 1 "memory_operand" ""))
6082 (clobber (match_operand:SI 2 "register_operand" ""))]
6083 "! TARGET_BWX && reload_completed"
6086 rtx aligned_mem, bitnum;
6087 get_aligned_mem (operands[1], &aligned_mem, &bitnum);
6089 emit_insn (gen_aligned_loadqi (operands[0], aligned_mem, bitnum,
6095 [(set (match_operand:HI 0 "register_operand" "")
6096 (match_operand:HI 1 "memory_operand" ""))
6097 (clobber (match_operand:SI 2 "register_operand" ""))]
6098 "! TARGET_BWX && reload_completed"
6101 rtx aligned_mem, bitnum;
6102 get_aligned_mem (operands[1], &aligned_mem, &bitnum);
6104 emit_insn (gen_aligned_loadhi (operands[0], aligned_mem, bitnum,
6110 [(set (match_operand:QI 0 "memory_operand" "")
6111 (match_operand:QI 1 "register_operand" ""))
6112 (clobber (match_operand:SI 2 "register_operand" ""))
6113 (clobber (match_operand:SI 3 "register_operand" ""))]
6114 "! TARGET_BWX && reload_completed"
6117 rtx aligned_mem, bitnum;
6118 get_aligned_mem (operands[0], &aligned_mem, &bitnum);
6119 emit_insn (gen_aligned_store (aligned_mem, operands[1], bitnum,
6120 operands[2], operands[3]));
6125 [(set (match_operand:HI 0 "memory_operand" "")
6126 (match_operand:HI 1 "register_operand" ""))
6127 (clobber (match_operand:SI 2 "register_operand" ""))
6128 (clobber (match_operand:SI 3 "register_operand" ""))]
6129 "! TARGET_BWX && reload_completed"
6132 rtx aligned_mem, bitnum;
6133 get_aligned_mem (operands[0], &aligned_mem, &bitnum);
6134 emit_insn (gen_aligned_store (aligned_mem, operands[1], bitnum,
6135 operands[2], operands[3]));
6139 ;; Bit field extract patterns which use ext[wlq][lh]
6141 (define_expand "extv"
6142 [(set (match_operand:DI 0 "register_operand" "")
6143 (sign_extract:DI (match_operand:QI 1 "memory_operand" "")
6144 (match_operand:DI 2 "immediate_operand" "")
6145 (match_operand:DI 3 "immediate_operand" "")))]
6150 /* We can do 16, 32 and 64 bit fields, if aligned on byte boundaries. */
6151 if (INTVAL (operands[3]) % 8 != 0
6152 || (INTVAL (operands[2]) != 16
6153 && INTVAL (operands[2]) != 32
6154 && INTVAL (operands[2]) != 64))
6157 /* From mips.md: extract_bit_field doesn't verify that our source
6158 matches the predicate, so we force it to be a MEM here. */
6159 if (GET_CODE (operands[1]) != MEM)
6162 /* The bit number is relative to the mode of operand 1 which is
6163 usually QImode (this might actually be a bug in expmed.c). Note
6164 that the bit number is negative in big-endian mode in this case.
6165 We have to convert that to the offset. */
6166 if (WORDS_BIG_ENDIAN)
6167 ofs = GET_MODE_BITSIZE (GET_MODE (operands[1]))
6168 - INTVAL (operands[2]) - INTVAL (operands[3]);
6170 ofs = INTVAL (operands[3]);
6174 alpha_expand_unaligned_load (operands[0], operands[1],
6175 INTVAL (operands[2]) / 8,
6180 (define_expand "extzv"
6181 [(set (match_operand:DI 0 "register_operand" "")
6182 (zero_extract:DI (match_operand:DI 1 "nonimmediate_operand" "")
6183 (match_operand:DI 2 "immediate_operand" "")
6184 (match_operand:DI 3 "immediate_operand" "")))]
6187 /* We can do 8, 16, 32 and 64 bit fields, if aligned on byte boundaries. */
6188 if (INTVAL (operands[3]) % 8 != 0
6189 || (INTVAL (operands[2]) != 8
6190 && INTVAL (operands[2]) != 16
6191 && INTVAL (operands[2]) != 32
6192 && INTVAL (operands[2]) != 64))
6195 if (GET_CODE (operands[1]) == MEM)
6199 /* Fail 8 bit fields, falling back on a simple byte load. */
6200 if (INTVAL (operands[2]) == 8)
6203 /* The bit number is relative to the mode of operand 1 which is
6204 usually QImode (this might actually be a bug in expmed.c). Note
6205 that the bit number is negative in big-endian mode in this case.
6206 We have to convert that to the offset. */
6207 if (WORDS_BIG_ENDIAN)
6208 ofs = GET_MODE_BITSIZE (GET_MODE (operands[1]))
6209 - INTVAL (operands[2]) - INTVAL (operands[3]);
6211 ofs = INTVAL (operands[3]);
6215 alpha_expand_unaligned_load (operands[0], operands[1],
6216 INTVAL (operands[2]) / 8,
6222 (define_expand "insv"
6223 [(set (zero_extract:DI (match_operand:QI 0 "memory_operand" "")
6224 (match_operand:DI 1 "immediate_operand" "")
6225 (match_operand:DI 2 "immediate_operand" ""))
6226 (match_operand:DI 3 "register_operand" ""))]
6231 /* We can do 16, 32 and 64 bit fields, if aligned on byte boundaries. */
6232 if (INTVAL (operands[2]) % 8 != 0
6233 || (INTVAL (operands[1]) != 16
6234 && INTVAL (operands[1]) != 32
6235 && INTVAL (operands[1]) != 64))
6238 /* From mips.md: store_bit_field doesn't verify that our source
6239 matches the predicate, so we force it to be a MEM here. */
6240 if (GET_CODE (operands[0]) != MEM)
6243 /* The bit number is relative to the mode of operand 1 which is
6244 usually QImode (this might actually be a bug in expmed.c). Note
6245 that the bit number is negative in big-endian mode in this case.
6246 We have to convert that to the offset. */
6247 if (WORDS_BIG_ENDIAN)
6248 ofs = GET_MODE_BITSIZE (GET_MODE (operands[0]))
6249 - INTVAL (operands[1]) - INTVAL (operands[2]);
6251 ofs = INTVAL (operands[2]);
6255 alpha_expand_unaligned_store (operands[0], operands[3],
6256 INTVAL (operands[1]) / 8, ofs);
6260 ;; Block move/clear, see alpha.c for more details.
6261 ;; Argument 0 is the destination
6262 ;; Argument 1 is the source
6263 ;; Argument 2 is the length
6264 ;; Argument 3 is the alignment
6266 (define_expand "movstrqi"
6267 [(parallel [(set (match_operand:BLK 0 "memory_operand" "")
6268 (match_operand:BLK 1 "memory_operand" ""))
6269 (use (match_operand:DI 2 "immediate_operand" ""))
6270 (use (match_operand:DI 3 "immediate_operand" ""))])]
6273 if (alpha_expand_block_move (operands))
6279 (define_expand "clrstrqi"
6280 [(parallel [(set (match_operand:BLK 0 "memory_operand" "")
6282 (use (match_operand:DI 1 "immediate_operand" ""))
6283 (use (match_operand:DI 2 "immediate_operand" ""))])]
6286 if (alpha_expand_block_clear (operands))
6292 ;; Subroutine of stack space allocation. Perform a stack probe.
6293 (define_expand "probe_stack"
6294 [(set (match_dup 1) (match_operand:DI 0 "const_int_operand" ""))]
6297 operands[1] = gen_rtx_MEM (DImode, plus_constant (stack_pointer_rtx,
6298 INTVAL (operands[0])));
6299 MEM_VOLATILE_P (operands[1]) = 1;
6301 operands[0] = const0_rtx;
6304 ;; This is how we allocate stack space. If we are allocating a
6305 ;; constant amount of space and we know it is less than 4096
6306 ;; bytes, we need do nothing.
6308 ;; If it is more than 4096 bytes, we need to probe the stack
6310 (define_expand "allocate_stack"
6312 (plus:DI (reg:DI 30)
6313 (match_operand:DI 1 "reg_or_cint_operand" "")))
6314 (set (match_operand:DI 0 "register_operand" "=r")
6318 if (GET_CODE (operands[1]) == CONST_INT
6319 && INTVAL (operands[1]) < 32768)
6321 if (INTVAL (operands[1]) >= 4096)
6323 /* We do this the same way as in the prologue and generate explicit
6324 probes. Then we update the stack by the constant. */
6328 emit_insn (gen_probe_stack (GEN_INT (- probed)));
6329 while (probed + 8192 < INTVAL (operands[1]))
6330 emit_insn (gen_probe_stack (GEN_INT (- (probed += 8192))));
6332 if (probed + 4096 < INTVAL (operands[1]))
6333 emit_insn (gen_probe_stack (GEN_INT (- INTVAL(operands[1]))));
6336 operands[1] = GEN_INT (- INTVAL (operands[1]));
6337 operands[2] = virtual_stack_dynamic_rtx;
6342 rtx loop_label = gen_label_rtx ();
6343 rtx want = gen_reg_rtx (Pmode);
6344 rtx tmp = gen_reg_rtx (Pmode);
6347 emit_insn (gen_subdi3 (want, stack_pointer_rtx,
6348 force_reg (Pmode, operands[1])));
6349 emit_insn (gen_adddi3 (tmp, stack_pointer_rtx, GEN_INT (-4096)));
6351 if (GET_CODE (operands[1]) != CONST_INT)
6353 out_label = gen_label_rtx ();
6354 emit_insn (gen_cmpdi (want, tmp));
6355 emit_jump_insn (gen_bgeu (out_label));
6358 emit_label (loop_label);
6359 memref = gen_rtx_MEM (DImode, tmp);
6360 MEM_VOLATILE_P (memref) = 1;
6361 emit_move_insn (memref, const0_rtx);
6362 emit_insn (gen_adddi3 (tmp, tmp, GEN_INT(-8192)));
6363 emit_insn (gen_cmpdi (tmp, want));
6364 emit_jump_insn (gen_bgtu (loop_label));
6366 memref = gen_rtx_MEM (DImode, want);
6367 MEM_VOLATILE_P (memref) = 1;
6368 emit_move_insn (memref, const0_rtx);
6371 emit_label (out_label);
6373 emit_move_insn (stack_pointer_rtx, want);
6374 emit_move_insn (operands[0], virtual_stack_dynamic_rtx);
6379 ;; This is used by alpha_expand_prolog to do the same thing as above,
6380 ;; except we cannot at that time generate new basic blocks, so we hide
6381 ;; the loop in this one insn.
6383 (define_insn "prologue_stack_probe_loop"
6384 [(unspec_volatile [(match_operand:DI 0 "register_operand" "r")
6385 (match_operand:DI 1 "register_operand" "r")]
6389 operands[2] = gen_label_rtx ();
6390 ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, "L",
6391 CODE_LABEL_NUMBER (operands[2]));
6393 return "stq $31,-8192(%1)\;subq %0,1,%0\;lda %1,-8192(%1)\;bne %0,%l2";
6395 [(set_attr "length" "16")
6396 (set_attr "type" "multi")])
6398 (define_expand "prologue"
6399 [(clobber (const_int 0))]
6402 alpha_expand_prologue ();
6406 ;; These take care of emitting the ldgp insn in the prologue. This will be
6407 ;; an lda/ldah pair and we want to align them properly. So we have two
6408 ;; unspec_volatile insns, the first of which emits the ldgp assembler macro
6409 ;; and the second of which emits nothing. However, both are marked as type
6410 ;; IADD (the default) so the alignment code in alpha.c does the right thing
6413 (define_expand "prologue_ldgp"
6415 (unspec_volatile:DI [(match_dup 1) (match_dup 2)] UNSPECV_LDGP1))
6417 (unspec_volatile:DI [(match_dup 0) (match_dup 2)] UNSPECV_PLDGP2))]
6420 operands[0] = pic_offset_table_rtx;
6421 operands[1] = gen_rtx_REG (Pmode, 27);
6422 operands[2] = (TARGET_EXPLICIT_RELOCS
6423 ? GEN_INT (alpha_next_sequence_number++)
6427 (define_insn "*ldgp_er_1"
6428 [(set (match_operand:DI 0 "register_operand" "=r")
6429 (unspec_volatile:DI [(match_operand:DI 1 "register_operand" "r")
6430 (match_operand 2 "const_int_operand" "")]
6432 "TARGET_EXPLICIT_RELOCS && TARGET_ABI_OSF"
6433 "ldah %0,0(%1)\t\t!gpdisp!%2")
6435 (define_insn "*ldgp_er_2"
6436 [(set (match_operand:DI 0 "register_operand" "=r")
6437 (unspec:DI [(match_operand:DI 1 "register_operand" "r")
6438 (match_operand 2 "const_int_operand" "")]
6440 "TARGET_EXPLICIT_RELOCS && TARGET_ABI_OSF"
6441 "lda %0,0(%1)\t\t!gpdisp!%2")
6443 (define_insn "*prologue_ldgp_er_2"
6444 [(set (match_operand:DI 0 "register_operand" "=r")
6445 (unspec_volatile:DI [(match_operand:DI 1 "register_operand" "r")
6446 (match_operand 2 "const_int_operand" "")]
6448 "TARGET_EXPLICIT_RELOCS && TARGET_ABI_OSF"
6449 "lda %0,0(%1)\t\t!gpdisp!%2\n$%~..ng:")
6451 (define_insn "*prologue_ldgp_1"
6452 [(set (match_operand:DI 0 "register_operand" "=r")
6453 (unspec_volatile:DI [(match_operand:DI 1 "register_operand" "r")
6454 (match_operand 2 "const_int_operand" "")]
6457 "ldgp %0,0(%1)\n$%~..ng:")
6459 (define_insn "*prologue_ldgp_2"
6460 [(set (match_operand:DI 0 "register_operand" "=r")
6461 (unspec_volatile:DI [(match_operand:DI 1 "register_operand" "r")
6462 (match_operand 2 "const_int_operand" "")]
6467 ;; The _mcount profiling hook has special calling conventions, and
6468 ;; does not clobber all the registers that a normal call would. So
6469 ;; hide the fact this is a call at all.
6471 (define_insn "prologue_mcount"
6472 [(unspec_volatile [(const_int 0)] UNSPECV_MCOUNT)]
6475 if (TARGET_EXPLICIT_RELOCS)
6476 return "ldq $28,_mcount($29)\t\t!literal!%#\;jsr $28,($28),_mcount\t\t!lituse_jsr!%#";
6478 return "lda $28,_mcount\;jsr $28,($28),_mcount";
6480 [(set_attr "type" "multi")
6481 (set_attr "length" "8")])
6483 (define_insn "init_fp"
6484 [(set (match_operand:DI 0 "register_operand" "=r")
6485 (match_operand:DI 1 "register_operand" "r"))
6486 (clobber (mem:BLK (match_operand:DI 2 "register_operand" "=r")))]
6490 (define_expand "epilogue"
6494 alpha_expand_epilogue ();
6497 (define_expand "sibcall_epilogue"
6501 alpha_expand_epilogue ();
6505 ;; In creating a large stack frame, NT _must_ use ldah+lda to load
6506 ;; the frame size into a register. We use this pattern to ensure
6507 ;; we get lda instead of addq.
6508 (define_insn "nt_lda"
6509 [(set (match_operand:DI 0 "register_operand" "=r")
6510 (unspec:DI [(match_dup 0)
6511 (match_operand:DI 1 "const_int_operand" "n")]
6516 (define_expand "builtin_longjmp"
6517 [(use (match_operand:DI 0 "register_operand" "r"))]
6520 /* The elements of the buffer are, in order: */
6521 rtx fp = gen_rtx_MEM (Pmode, operands[0]);
6522 rtx lab = gen_rtx_MEM (Pmode, plus_constant (operands[0], 8));
6523 rtx stack = gen_rtx_MEM (Pmode, plus_constant (operands[0], 16));
6524 rtx pv = gen_rtx_REG (Pmode, 27);
6526 /* This bit is the same as expand_builtin_longjmp. */
6527 emit_move_insn (hard_frame_pointer_rtx, fp);
6528 emit_move_insn (pv, lab);
6529 emit_stack_restore (SAVE_NONLOCAL, stack, NULL_RTX);
6530 emit_insn (gen_rtx_USE (VOIDmode, hard_frame_pointer_rtx));
6531 emit_insn (gen_rtx_USE (VOIDmode, stack_pointer_rtx));
6533 /* Load the label we are jumping through into $27 so that we know
6534 where to look for it when we get back to setjmp's function for
6535 restoring the gp. */
6536 emit_jump_insn (gen_builtin_longjmp_internal (pv));
6541 ;; This is effectively a copy of indirect_jump, but constrained such
6542 ;; that register renaming cannot foil our cunning plan with $27.
6543 (define_insn "builtin_longjmp_internal"
6545 (unspec_volatile [(match_operand:DI 0 "register_operand" "c")]
6549 [(set_attr "type" "ibr")])
6551 (define_insn "*builtin_setjmp_receiver_er_sl_1"
6552 [(unspec_volatile [(label_ref (match_operand 0 "" ""))] UNSPECV_SETJMPR)]
6553 "TARGET_EXPLICIT_RELOCS && TARGET_ABI_OSF && TARGET_AS_CAN_SUBTRACT_LABELS"
6554 "lda $27,$LSJ%=-%l0($27)\n$LSJ%=:")
6556 (define_insn "*builtin_setjmp_receiver_er_1"
6557 [(unspec_volatile [(label_ref (match_operand 0 "" ""))] UNSPECV_SETJMPR)]
6558 "TARGET_EXPLICIT_RELOCS && TARGET_ABI_OSF"
6559 "br $27,$LSJ%=\n$LSJ%=:"
6560 [(set_attr "type" "ibr")])
6563 [(unspec_volatile [(label_ref (match_operand 0 "" ""))] UNSPECV_SETJMPR)]
6564 "TARGET_EXPLICIT_RELOCS && TARGET_ABI_OSF
6565 && prev_nonnote_insn (insn) == operands[0]"
6569 (define_insn "*builtin_setjmp_receiver_1"
6570 [(unspec_volatile [(label_ref (match_operand 0 "" ""))] UNSPECV_SETJMPR)]
6572 "br $27,$LSJ%=\n$LSJ%=:\;ldgp $29,0($27)"
6573 [(set_attr "length" "12")
6574 (set_attr "type" "multi")])
6576 (define_expand "builtin_setjmp_receiver_er"
6577 [(unspec_volatile [(label_ref (match_operand 0 "" ""))] UNSPECV_SETJMPR)
6579 (unspec_volatile:DI [(match_dup 2) (match_dup 3)] UNSPECV_LDGP1))
6581 (unspec:DI [(match_dup 1) (match_dup 3)] UNSPEC_LDGP2))]
6584 operands[1] = pic_offset_table_rtx;
6585 operands[2] = gen_rtx_REG (Pmode, 27);
6586 operands[3] = GEN_INT (alpha_next_sequence_number++);
6589 (define_expand "builtin_setjmp_receiver"
6590 [(unspec_volatile [(label_ref (match_operand 0 "" ""))] UNSPECV_SETJMPR)]
6593 if (TARGET_EXPLICIT_RELOCS)
6595 emit_insn (gen_builtin_setjmp_receiver_er (operands[0]));
6600 (define_expand "exception_receiver_er"
6602 (unspec_volatile:DI [(match_dup 1) (match_dup 2)] UNSPECV_LDGP1))
6604 (unspec:DI [(match_dup 0) (match_dup 2)] UNSPEC_LDGP2))]
6607 operands[0] = pic_offset_table_rtx;
6608 operands[1] = gen_rtx_REG (Pmode, 26);
6609 operands[2] = GEN_INT (alpha_next_sequence_number++);
6612 (define_expand "exception_receiver"
6613 [(unspec_volatile [(match_dup 0)] UNSPECV_EHR)]
6616 if (TARGET_LD_BUGGY_LDGP)
6617 operands[0] = alpha_gp_save_rtx ();
6618 else if (TARGET_EXPLICIT_RELOCS)
6620 emit_insn (gen_exception_receiver_er ());
6624 operands[0] = const0_rtx;
6627 (define_insn "*exception_receiver_1"
6628 [(unspec_volatile [(const_int 0)] UNSPECV_EHR)]
6629 "! TARGET_LD_BUGGY_LDGP"
6631 [(set_attr "length" "8")
6632 (set_attr "type" "multi")])
6634 (define_insn "*exception_receiver_2"
6635 [(unspec_volatile [(match_operand:DI 0 "nonimmediate_operand" "r,m")]
6637 "TARGET_LD_BUGGY_LDGP"
6641 [(set_attr "type" "ilog,ild")])
6643 (define_expand "nonlocal_goto_receiver"
6644 [(unspec_volatile [(const_int 0)] UNSPECV_BLOCKAGE)
6645 (set (reg:DI 27) (mem:DI (reg:DI 29)))
6646 (unspec_volatile [(const_int 0)] UNSPECV_BLOCKAGE)
6648 "TARGET_ABI_OPEN_VMS"
6651 (define_insn "arg_home"
6652 [(unspec [(const_int 0)] UNSPEC_ARG_HOME)
6667 (clobber (mem:BLK (const_int 0)))
6668 (clobber (reg:DI 24))
6669 (clobber (reg:DI 25))
6670 (clobber (reg:DI 0))]
6671 "TARGET_ABI_OPEN_VMS"
6672 "lda $0,OTS$HOME_ARGS\;ldq $0,8($0)\;jsr $0,OTS$HOME_ARGS"
6673 [(set_attr "length" "16")
6674 (set_attr "type" "multi")])
6676 ;; Load the CIW into r2 for calling __T3E_MISMATCH
6678 (define_expand "umk_mismatch_args"
6679 [(set:DI (match_dup 1) (mem:DI (plus:DI (reg:DI 15) (const_int -16))))
6680 (set:DI (match_dup 2) (mem:DI (plus:DI (match_dup 1) (const_int -32))))
6681 (set:DI (reg:DI 1) (match_operand:DI 0 "const_int_operand" ""))
6682 (set:DI (match_dup 3) (plus:DI (mult:DI (reg:DI 25)
6685 (set:DI (reg:DI 2) (mem:DI (match_dup 3)))]
6686 "TARGET_ABI_UNICOSMK"
6688 operands[1] = gen_reg_rtx (DImode);
6689 operands[2] = gen_reg_rtx (DImode);
6690 operands[3] = gen_reg_rtx (DImode);
6693 (define_insn "arg_home_umk"
6694 [(unspec [(const_int 0)] UNSPEC_ARG_HOME)
6709 (clobber (mem:BLK (const_int 0)))
6711 (clobber (reg:DI 22))
6712 (clobber (reg:DI 23))
6713 (clobber (reg:DI 24))
6714 (clobber (reg:DI 0))
6715 (clobber (reg:DI 1))
6716 (clobber (reg:DI 2))
6717 (clobber (reg:DI 3))
6718 (clobber (reg:DI 4))
6719 (clobber (reg:DI 5))
6720 (clobber (reg:DI 6))
6721 (clobber (reg:DI 7))
6722 (clobber (reg:DI 8))])]
6723 "TARGET_ABI_UNICOSMK"
6724 "laum $4,__T3E_MISMATCH($31)\;sll $4,32,$4\;lalm $4,__T3E_MISMATCH($4)\;lal $4,__T3E_MISMATCH($4)\;jsr $3,($4)"
6725 [(set_attr "length" "16")
6726 (set_attr "type" "multi")])
6730 ;; On EV4, these instructions are nops -- no load occurs.
6732 ;; On EV5, these instructions act as a normal load, and thus can trap
6733 ;; if the address is invalid. The OS may (or may not) handle this in
6734 ;; the entMM fault handler and suppress the fault. If so, then this
6735 ;; has the effect of a read prefetch instruction.
6737 ;; On EV6, these become official prefetch instructions.
6739 (define_insn "prefetch"
6740 [(prefetch (match_operand:DI 0 "address_operand" "p")
6741 (match_operand:DI 1 "const_int_operand" "n")
6742 (match_operand:DI 2 "const_int_operand" "n"))]
6743 "TARGET_FIXUP_EV5_PREFETCH || TARGET_CPU_EV6"
6745 /* Interpret "no temporal locality" as this data should be evicted once
6746 it is used. The "evict next" alternatives load the data into the cache
6747 and leave the LRU eviction counter pointing to that block. */
6748 static const char * const alt[2][2] = {
6750 "lds $f31,%a0", /* read, evict next */
6751 "ldl $31,%a0", /* read, evict last */
6754 "ldt $f31,%a0", /* write, evict next */
6755 "ldq $31,%a0", /* write, evict last */
6759 bool write = INTVAL (operands[1]) != 0;
6760 bool lru = INTVAL (operands[2]) != 0;
6762 return alt[write][lru];
6764 [(set_attr "type" "ild")])
6766 ;; Close the trap shadow of preceding instructions. This is generated
6769 (define_insn "trapb"
6770 [(unspec_volatile [(const_int 0)] UNSPECV_TRAPB)]
6773 [(set_attr "type" "misc")])
6775 ;; No-op instructions used by machine-dependent reorg to preserve
6776 ;; alignment for instruction issue.
6777 ;; The Unicos/Mk assembler does not support these opcodes.
6783 [(set_attr "type" "ilog")])
6788 "cpys $f31,$f31,$f31"
6789 [(set_attr "type" "fcpys")])
6796 ;; On Unicos/Mk we use a macro for aligning code.
6798 (define_insn "realign"
6799 [(unspec_volatile [(match_operand 0 "immediate_operand" "i")]
6803 if (TARGET_ABI_UNICOSMK)
6804 return "gcc@code@align %0";
6806 return ".align %0 #realign";
6809 ;; The call patterns are at the end of the file because their
6810 ;; wildcard operand0 interferes with nice recognition.
6812 (define_insn "*call_value_osf_1_er"
6813 [(set (match_operand 0 "" "")
6814 (call (mem:DI (match_operand:DI 1 "call_operand" "c,R,s"))
6815 (match_operand 2 "" "")))
6817 (clobber (reg:DI 26))]
6818 "TARGET_EXPLICIT_RELOCS && TARGET_ABI_OSF"
6820 jsr $26,(%1),0\;ldah $29,0($26)\t\t!gpdisp!%*\;lda $29,0($29)\t\t!gpdisp!%*
6822 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!%*"
6823 [(set_attr "type" "jsr")
6824 (set_attr "length" "12,*,16")])
6826 ;; We must use peep2 instead of a split because we need accurate life
6827 ;; information for $gp. Consider the case of { bar(); while (1); }.
6829 [(parallel [(set (match_operand 0 "" "")
6830 (call (mem:DI (match_operand:DI 1 "call_operand" ""))
6831 (match_operand 2 "" "")))
6833 (clobber (reg:DI 26))])]
6834 "TARGET_EXPLICIT_RELOCS && TARGET_ABI_OSF && reload_completed
6835 && ! current_file_function_operand (operands[0], Pmode)
6836 && peep2_regno_dead_p (1, 29)"
6837 [(parallel [(set (match_dup 0)
6838 (call (mem:DI (match_dup 3))
6840 (set (reg:DI 26) (plus:DI (pc) (const_int 4)))
6841 (unspec_volatile [(reg:DI 29)] UNSPECV_BLOCKAGE)
6842 (use (match_dup 1))])]
6844 if (CONSTANT_P (operands[1]))
6846 operands[3] = gen_rtx_REG (Pmode, 27);
6847 emit_move_insn (operands[3], operands[1]);
6851 operands[3] = operands[1];
6852 operands[1] = const0_rtx;
6857 [(parallel [(set (match_operand 0 "" "")
6858 (call (mem:DI (match_operand:DI 1 "call_operand" ""))
6859 (match_operand 2 "" "")))
6861 (clobber (reg:DI 26))])]
6862 "TARGET_EXPLICIT_RELOCS && TARGET_ABI_OSF && reload_completed
6863 && ! current_file_function_operand (operands[0], Pmode)
6864 && ! peep2_regno_dead_p (1, 29)"
6865 [(parallel [(set (match_dup 0)
6866 (call (mem:DI (match_dup 3))
6868 (set (reg:DI 26) (plus:DI (pc) (const_int 4)))
6869 (unspec_volatile [(reg:DI 29)] UNSPECV_BLOCKAGE)
6870 (use (match_dup 1))])
6872 (unspec_volatile:DI [(reg:DI 26) (match_dup 4)] UNSPECV_LDGP1))
6874 (unspec:DI [(reg:DI 29) (match_dup 4)] UNSPEC_LDGP2))]
6876 if (CONSTANT_P (operands[1]))
6878 operands[3] = gen_rtx_REG (Pmode, 27);
6879 emit_move_insn (operands[3], operands[1]);
6883 operands[3] = operands[1];
6884 operands[1] = const0_rtx;
6886 operands[4] = GEN_INT (alpha_next_sequence_number++);
6889 ;; We add a blockage unspec_volatile to prevent insns from moving down
6890 ;; from above the call to in between the call and the ldah gpdisp.
6891 (define_insn "*call_value_osf_2_er"
6892 [(set (match_operand 0 "" "")
6893 (call (mem:DI (match_operand:DI 1 "register_operand" "c"))
6894 (match_operand 2 "" "")))
6896 (plus:DI (pc) (const_int 4)))
6897 (unspec_volatile [(reg:DI 29)] UNSPECV_BLOCKAGE)
6898 (use (match_operand 3 "" ""))]
6899 "TARGET_EXPLICIT_RELOCS && TARGET_ABI_OSF"
6901 [(set_attr "type" "jsr")])
6903 (define_insn "*call_value_osf_1_noreturn"
6904 [(set (match_operand 0 "" "")
6905 (call (mem:DI (match_operand:DI 1 "call_operand" "c,R,s"))
6906 (match_operand 2 "" "")))
6908 (clobber (reg:DI 26))]
6909 "! TARGET_EXPLICIT_RELOCS && TARGET_ABI_OSF
6910 && find_reg_note (insn, REG_NORETURN, NULL_RTX)"
6915 [(set_attr "type" "jsr")
6916 (set_attr "length" "*,*,8")])
6918 (define_insn "*call_value_osf_1"
6919 [(set (match_operand 0 "" "")
6920 (call (mem:DI (match_operand:DI 1 "call_operand" "c,R,s"))
6921 (match_operand 2 "" "")))
6923 (clobber (reg:DI 26))]
6924 "! TARGET_EXPLICIT_RELOCS && TARGET_ABI_OSF"
6926 jsr $26,($27),0\;ldgp $29,0($26)
6928 jsr $26,%1\;ldgp $29,0($26)"
6929 [(set_attr "type" "jsr")
6930 (set_attr "length" "12,*,16")])
6932 (define_insn "*sibcall_value_osf_1_er"
6933 [(set (match_operand 0 "" "")
6934 (call (mem:DI (match_operand:DI 1 "symbolic_operand" "R,s"))
6935 (match_operand 2 "" "")))
6936 (unspec [(reg:DI 29)] UNSPEC_SIBCALL)]
6937 "TARGET_EXPLICIT_RELOCS && TARGET_ABI_OSF"
6940 ldq $27,%1($29)\t\t!literal!%#\;jmp $31,($27),%1\t\t!lituse_jsr!%#"
6941 [(set_attr "type" "jsr")
6942 (set_attr "length" "*,8")])
6944 (define_insn "*sibcall_value_osf_1"
6945 [(set (match_operand 0 "" "")
6946 (call (mem:DI (match_operand:DI 1 "symbolic_operand" "R,s"))
6947 (match_operand 2 "" "")))
6948 (unspec [(reg:DI 29)] UNSPEC_SIBCALL)]
6949 "! TARGET_EXPLICIT_RELOCS && TARGET_ABI_OSF"
6952 lda $27,%1\;jmp $31,($27),%1"
6953 [(set_attr "type" "jsr")
6954 (set_attr "length" "*,8")])
6956 (define_insn "*call_value_nt_1"
6957 [(set (match_operand 0 "" "")
6958 (call (mem:DI (match_operand:DI 1 "call_operand" "r,R,s"))
6959 (match_operand 2 "" "")))
6960 (clobber (reg:DI 26))]
6961 "TARGET_ABI_WINDOWS_NT"
6966 [(set_attr "type" "jsr")
6967 (set_attr "length" "*,*,12")])
6969 (define_insn "*call_value_vms_1"
6970 [(set (match_operand 0 "" "")
6971 (call (mem:DI (match_operand:DI 1 "call_operand" "r,s"))
6972 (match_operand 2 "" "")))
6973 (use (match_operand:DI 3 "nonimmediate_operand" "r,m"))
6976 (clobber (reg:DI 27))]
6977 "TARGET_ABI_OPEN_VMS"
6979 mov %3,$27\;jsr $26,0\;ldq $27,0($29)
6980 ldq $27,%3\;jsr $26,%1\;ldq $27,0($29)"
6981 [(set_attr "type" "jsr")
6982 (set_attr "length" "12,16")])
6984 (define_insn "*call_value_umk"
6985 [(set (match_operand 0 "" "")
6986 (call (mem:DI (match_operand:DI 1 "call_operand" "r"))
6987 (match_operand 2 "" "")))
6989 (clobber (reg:DI 26))]
6990 "TARGET_ABI_UNICOSMK"
6992 [(set_attr "type" "jsr")])