1 ;; Machine description for DEC Alpha for GNU C compiler
2 ;; Copyright (C) 1992, 93, 94, 95, 96, 1997 Free Software Foundation, Inc.
3 ;; Contributed by Richard Kenner (kenner@vlsi1.ultra.nyu.edu)
5 ;; This file is part of GNU CC.
7 ;; GNU CC is free software; you can redistribute it and/or modify
8 ;; it under the terms of the GNU General Public License as published by
9 ;; the Free Software Foundation; either version 2, or (at your option)
12 ;; GNU CC is distributed in the hope that it will be useful,
13 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
14 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 ;; GNU General Public License for more details.
17 ;; You should have received a copy of the GNU General Public License
18 ;; along with GNU CC; see the file COPYING. If not, write to
19 ;; the Free Software Foundation, 59 Temple Place - Suite 330,
20 ;; Boston, MA 02111-1307, USA.
22 ;;- See file "rtl.def" for documentation on define_insn, match_*, et. al.
24 ;; Processor type -- this attribute must exactly match the processor_type
25 ;; enumeration in alpha.h.
27 (define_attr "cpu" "ev4,ev5"
28 (const (symbol_ref "alpha_cpu")))
30 ;; Define an insn type attribute. This is used in function unit delay
31 ;; computations, among other purposes. For the most part, we use the names
32 ;; defined in the EV4 documentation, but add a few that we have to know about
36 "ld,st,ibr,fbr,jsr,iadd,ilog,shift,cmov,icmp,imull,imulq,fadd,fmul,fcpys,fdivs,fdivt,ldsym,isubr"
37 (const_string "iadd"))
39 ;; The TRAP_TYPE attribute marks instructions that may generate traps
40 ;; (which are imprecise and may need a trapb if software complention
42 (define_attr "trap" "yes,no" (const_string "no"))
44 ;; For the EV4 we include four function units: ABOX, which computes the address,
45 ;; BBOX, used for branches, EBOX, used for integer operations, and FBOX,
46 ;; used for FP operations.
48 ;; We assume that we have been successful in getting double issues and
49 ;; hence multiply all costs by two insns per cycle. The minimum time in
50 ;; a function unit is 2 cycle, which will tend to produce the double
53 ;; Memory delivers its result in three cycles.
54 (define_function_unit "ev4_abox" 1 0
55 (and (eq_attr "cpu" "ev4")
56 (eq_attr "type" "ld,st"))
59 ;; Branches have no delay cost, but do tie up the unit for two cycles.
60 (define_function_unit "ev4_bbox" 1 1
61 (and (eq_attr "cpu" "ev4")
62 (eq_attr "type" "ibr,fbr,jsr"))
65 ;; Arithmetic insns are normally have their results available after two
66 ;; cycles. There are a number of exceptions. They are encoded in
67 ;; ADJUST_COST. Some of the other insns have similar exceptions.
69 (define_function_unit "ev4_ebox" 1 0
70 (and (eq_attr "cpu" "ev4")
71 (eq_attr "type" "iadd,ilog,ldsym,shift,cmov,icmp"))
74 ;; These really don't take up the integer pipeline, but they do occupy
75 ;; IBOX1; we approximate here.
77 (define_function_unit "ev4_ebox" 1 0
78 (and (eq_attr "cpu" "ev4")
79 (eq_attr "type" "imull"))
82 (define_function_unit "ev4_ebox" 1 0
83 (and (eq_attr "cpu" "ev4")
84 (eq_attr "type" "imulq"))
87 (define_function_unit "ev4_imult" 1 0
88 (and (eq_attr "cpu" "ev4")
89 (eq_attr "type" "imull"))
92 (define_function_unit "ev4_imult" 1 0
93 (and (eq_attr "cpu" "ev4")
94 (eq_attr "type" "imulq"))
97 (define_function_unit "ev4_fbox" 1 0
98 (and (eq_attr "cpu" "ev4")
99 (eq_attr "type" "fadd,fmul,fcpys"))
102 (define_function_unit "ev4_fbox" 1 0
103 (and (eq_attr "cpu" "ev4")
104 (eq_attr "type" "fdivs"))
107 (define_function_unit "ev4_fbox" 1 0
108 (and (eq_attr "cpu" "ev4")
109 (eq_attr "type" "fdivt"))
112 (define_function_unit "ev4_divider" 1 0
113 (and (eq_attr "cpu" "ev4")
114 (eq_attr "type" "fdivs"))
117 (define_function_unit "ev4_divider" 1 0
118 (and (eq_attr "cpu" "ev4")
119 (eq_attr "type" "fdivt"))
122 ;; EV5 scheduling. EV5 can issue 4 insns per clock.
123 ;; Multiply all costs by 4.
125 ;; EV5 has two integer units.
126 (define_function_unit "ev5_ebox" 2 0
127 (and (eq_attr "cpu" "ev5")
128 (eq_attr "type" "iadd,ilog,icmp,ldsym"))
131 ;; Memory takes at least 2 clocks.
132 ;; Conditional moves always take 2 ticks.
133 (define_function_unit "ev5_ebox" 2 0
134 (and (eq_attr "cpu" "ev5")
135 (eq_attr "type" "ld,cmov"))
138 ;; Loads can dual issue. Store cannot; nor can loads + stores.
139 ;; Model this with a mythical load/store unit.
140 (define_function_unit "ev5_ldst" 1 0
141 (and (eq_attr "cpu" "ev5")
142 (eq_attr "type" "ld"))
143 8 4 [(eq_attr "type" "st")])
145 (define_function_unit "ev5_ldst" 1 0
146 (and (eq_attr "cpu" "ev5")
147 (eq_attr "type" "st"))
150 (define_function_unit "ev5_ebox" 2 0
151 (and (eq_attr "cpu" "ev5")
152 (eq_attr "type" "imull"))
155 (define_function_unit "ev5_ebox" 2 0
156 (and (eq_attr "cpu" "ev5")
157 (eq_attr "type" "imulq"))
160 ;; Multiplies also use the integer multiplier.
161 (define_function_unit "ev5_imult" 1 0
162 (and (eq_attr "cpu" "ev5")
163 (eq_attr "type" "imull"))
166 (define_function_unit "ev5_imult" 1 0
167 (and (eq_attr "cpu" "ev5")
168 (eq_attr "type" "imulq"))
171 ;; There is only 1 shifter/zapper.
172 (define_function_unit "ev5_shift" 1 0
173 (and (eq_attr "cpu" "ev5")
174 (eq_attr "type" "shift"))
177 ;; We pretend EV5 has symmetrical 2 fpus,
178 ;; even though cpys is the only insn that can issue on either unit.
179 (define_function_unit "ev5_fpu" 2 0
180 (and (eq_attr "cpu" "ev5")
181 (eq_attr "type" "fadd,fmul,fcpys"))
184 ;; Multiplies (resp. adds) also use the fmul (resp. fadd) units.
185 (define_function_unit "ev5_fpmul" 1 0
186 (and (eq_attr "cpu" "ev5")
187 (eq_attr "type" "fmul"))
190 (define_function_unit "ev5_fpadd" 1 0
191 (and (eq_attr "cpu" "ev5")
192 (eq_attr "type" "fadd"))
195 (define_function_unit "ev5_fpadd" 1 0
196 (and (eq_attr "cpu" "ev5")
197 (eq_attr "type" "fbr"))
200 (define_function_unit "ev5_fpadd" 1 0
201 (and (eq_attr "cpu" "ev5")
202 (eq_attr "type" "fdivs"))
205 (define_function_unit "ev5_fpadd" 1 0
206 (and (eq_attr "cpu" "ev5")
207 (eq_attr "type" "fdivt"))
210 ;; First define the arithmetic insns. Note that the 32-bit forms also
213 ;; Note that we can do sign extensions in both FP and integer registers.
214 ;; However, the result must be in the same type of register as the input.
215 ;; The register preferencing code can't handle this case very well, so, for
216 ;; now, don't let the FP case show up here for preferencing. Also,
217 ;; sign-extends in FP registers take two instructions.
218 (define_insn "extendsidi2"
219 [(set (match_operand:DI 0 "register_operand" "=r,r,*f")
220 (sign_extend:DI (match_operand:SI 1 "nonimmediate_operand" "r,m,*f")))]
225 cvtql %1,%0\;cvtlq %0,%0"
226 [(set_attr "type" "iadd,ld,fadd")])
228 ;; Do addsi3 the way expand_binop would do if we didn't have one. This
229 ;; generates better code. We have the anonymous addsi3 pattern below in
230 ;; case combine wants to make it.
231 (define_expand "addsi3"
232 [(set (match_operand:SI 0 "register_operand" "")
233 (plus:SI (match_operand:SI 1 "reg_or_0_operand" "")
234 (match_operand:SI 2 "add_operand" "")))]
237 { emit_insn (gen_rtx (SET, VOIDmode, gen_lowpart (DImode, operands[0]),
238 gen_rtx (PLUS, DImode,
239 gen_lowpart (DImode, operands[1]),
240 gen_lowpart (DImode, operands[2]))));
245 [(set (match_operand:SI 0 "register_operand" "=r,r,r,r")
246 (plus:SI (match_operand:SI 1 "reg_or_0_operand" "%rJ,rJ,rJ,rJ")
247 (match_operand:SI 2 "add_operand" "rI,O,K,L")))]
256 [(set (match_operand:SI 0 "register_operand" "")
257 (plus:SI (match_operand:SI 1 "register_operand" "")
258 (match_operand:SI 2 "const_int_operand" "")))]
259 "! add_operand (operands[2], SImode)"
260 [(set (match_dup 0) (plus:SI (match_dup 1) (match_dup 3)))
261 (set (match_dup 0) (plus:SI (match_dup 0) (match_dup 4)))]
264 HOST_WIDE_INT val = INTVAL (operands[2]);
265 HOST_WIDE_INT low = (val & 0xffff) - 2 * (val & 0x8000);
266 HOST_WIDE_INT rest = val - low;
268 operands[3] = GEN_INT (rest);
269 operands[4] = GEN_INT (low);
273 [(set (match_operand:DI 0 "register_operand" "=r,r")
275 (plus:SI (match_operand:SI 1 "reg_or_0_operand" "%rJ,rJ")
276 (match_operand:SI 2 "sext_add_operand" "rI,O"))))]
283 [(set (match_operand:DI 0 "register_operand" "")
285 (plus:SI (match_operand:SI 1 "register_operand" "")
286 (match_operand:SI 2 "const_int_operand" ""))))
287 (clobber (match_operand:SI 3 "register_operand" ""))]
288 "! sext_add_operand (operands[2], SImode) && INTVAL (operands[2]) > 0
289 && INTVAL (operands[2]) % 4 == 0"
290 [(set (match_dup 3) (match_dup 4))
291 (set (match_dup 0) (sign_extend:DI (plus:SI (mult:SI (match_dup 3)
296 HOST_WIDE_INT val = INTVAL (operands[2]) / 4;
302 operands[4] = GEN_INT (val);
303 operands[5] = GEN_INT (mult);
307 [(set (match_operand:DI 0 "register_operand" "")
309 (plus:SI (match_operator:SI 1 "comparison_operator"
310 [(match_operand 2 "" "")
311 (match_operand 3 "" "")])
312 (match_operand:SI 4 "add_operand" ""))))
313 (clobber (match_operand:DI 5 "register_operand" ""))]
315 [(set (match_dup 5) (match_dup 6))
316 (set (match_dup 0) (sign_extend:DI (plus:SI (match_dup 7) (match_dup 4))))]
319 operands[6] = gen_rtx (GET_CODE (operands[1]), DImode,
320 operands[2], operands[3]);
321 operands[7] = gen_lowpart (SImode, operands[5]);
324 (define_insn "adddi3"
325 [(set (match_operand:DI 0 "register_operand" "=r,r,r,r")
326 (plus:DI (match_operand:DI 1 "reg_or_0_operand" "%rJ,rJ,rJ,rJ")
327 (match_operand:DI 2 "add_operand" "rI,O,K,L")))]
335 ;; Don't do this if we are adjusting SP since we don't want to do
338 [(set (match_operand:DI 0 "register_operand" "")
339 (plus:DI (match_operand:DI 1 "register_operand" "")
340 (match_operand:DI 2 "const_int_operand" "")))]
341 "! add_operand (operands[2], DImode)
342 && REGNO (operands[0]) != STACK_POINTER_REGNUM"
343 [(set (match_dup 0) (plus:DI (match_dup 1) (match_dup 3)))
344 (set (match_dup 0) (plus:DI (match_dup 0) (match_dup 4)))]
347 HOST_WIDE_INT val = INTVAL (operands[2]);
348 HOST_WIDE_INT low = (val & 0xffff) - 2 * (val & 0x8000);
349 HOST_WIDE_INT rest = val - low;
351 operands[3] = GEN_INT (rest);
352 operands[4] = GEN_INT (low);
356 [(set (match_operand:SI 0 "register_operand" "=r,r")
357 (plus:SI (mult:SI (match_operand:SI 1 "reg_or_0_operand" "rJ,rJ")
358 (match_operand:SI 2 "const48_operand" "I,I"))
359 (match_operand:SI 3 "sext_add_operand" "rI,O")))]
366 [(set (match_operand:DI 0 "register_operand" "=r,r")
368 (plus:SI (mult:SI (match_operand:SI 1 "reg_or_0_operand" "rJ,rJ")
369 (match_operand:SI 2 "const48_operand" "I,I"))
370 (match_operand:SI 3 "sext_add_operand" "rI,O"))))]
377 [(set (match_operand:DI 0 "register_operand" "")
379 (plus:SI (mult:SI (match_operator:SI 1 "comparison_operator"
380 [(match_operand 2 "" "")
381 (match_operand 3 "" "")])
382 (match_operand:SI 4 "const48_operand" ""))
383 (match_operand:SI 5 "add_operand" ""))))
384 (clobber (match_operand:DI 6 "register_operand" ""))]
386 [(set (match_dup 6) (match_dup 7))
388 (sign_extend:DI (plus:SI (mult:SI (match_dup 8) (match_dup 4))
392 operands[7] = gen_rtx (GET_CODE (operands[1]), DImode,
393 operands[2], operands[3]);
394 operands[8] = gen_lowpart (SImode, operands[6]);
398 [(set (match_operand:DI 0 "register_operand" "=r,r")
399 (plus:DI (mult:DI (match_operand:DI 1 "reg_or_0_operand" "rJ,rJ")
400 (match_operand:DI 2 "const48_operand" "I,I"))
401 (match_operand:DI 3 "reg_or_8bit_operand" "rI,O")))]
407 ;; These variants of the above insns can occur if the third operand
408 ;; is the frame pointer. This is a kludge, but there doesn't
409 ;; seem to be a way around it. Only recognize them while reloading.
412 [(set (match_operand:DI 0 "some_operand" "=&r")
413 (plus:DI (plus:DI (match_operand:DI 1 "some_operand" "r")
414 (match_operand:DI 2 "some_operand" "r"))
415 (match_operand:DI 3 "some_operand" "rIOKL")))]
420 [(set (match_operand:DI 0 "register_operand" "")
421 (plus:DI (plus:DI (match_operand:DI 1 "register_operand" "")
422 (match_operand:DI 2 "register_operand" ""))
423 (match_operand:DI 3 "add_operand" "")))]
425 [(set (match_dup 0) (plus:DI (match_dup 1) (match_dup 2)))
426 (set (match_dup 0) (plus:DI (match_dup 0) (match_dup 3)))]
430 [(set (match_operand:SI 0 "some_operand" "=&r")
431 (plus:SI (plus:SI (mult:SI (match_operand:SI 1 "some_operand" "rJ")
432 (match_operand:SI 2 "const48_operand" "I"))
433 (match_operand:SI 3 "some_operand" "r"))
434 (match_operand:SI 4 "some_operand" "rIOKL")))]
439 [(set (match_operand:SI 0 "register_operand" "r")
440 (plus:SI (plus:SI (mult:SI (match_operand:SI 1 "reg_or_0_operand" "")
441 (match_operand:SI 2 "const48_operand" ""))
442 (match_operand:SI 3 "register_operand" ""))
443 (match_operand:SI 4 "add_operand" "rIOKL")))]
446 (plus:SI (mult:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
447 (set (match_dup 0) (plus:SI (match_dup 0) (match_dup 4)))]
451 [(set (match_operand:DI 0 "some_operand" "=&r")
454 (mult:SI (match_operand:SI 1 "some_operand" "rJ")
455 (match_operand:SI 2 "const48_operand" "I"))
456 (match_operand:SI 3 "some_operand" "r"))
457 (match_operand:SI 4 "some_operand" "rIOKL"))))]
462 [(set (match_operand:DI 0 "register_operand" "")
465 (mult:SI (match_operand:SI 1 "reg_or_0_operand" "")
466 (match_operand:SI 2 "const48_operand" ""))
467 (match_operand:SI 3 "register_operand" ""))
468 (match_operand:SI 4 "add_operand" ""))))]
471 (plus:SI (mult:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
472 (set (match_dup 0) (sign_extend:DI (plus:SI (match_dup 5) (match_dup 4))))]
474 { operands[5] = gen_lowpart (SImode, operands[0]);
478 [(set (match_operand:DI 0 "some_operand" "=&r")
479 (plus:DI (plus:DI (mult:DI (match_operand:DI 1 "some_operand" "rJ")
480 (match_operand:DI 2 "const48_operand" "I"))
481 (match_operand:DI 3 "some_operand" "r"))
482 (match_operand:DI 4 "some_operand" "rIOKL")))]
487 [(set (match_operand:DI 0 "register_operand" "=")
488 (plus:DI (plus:DI (mult:DI (match_operand:DI 1 "reg_or_0_operand" "")
489 (match_operand:DI 2 "const48_operand" ""))
490 (match_operand:DI 3 "register_operand" ""))
491 (match_operand:DI 4 "add_operand" "")))]
494 (plus:DI (mult:DI (match_dup 1) (match_dup 2)) (match_dup 3)))
495 (set (match_dup 0) (plus:DI (match_dup 0) (match_dup 4)))]
498 (define_insn "negsi2"
499 [(set (match_operand:SI 0 "register_operand" "=r")
500 (neg:SI (match_operand:SI 1 "reg_or_8bit_operand" "rI")))]
505 [(set (match_operand:DI 0 "register_operand" "=r")
506 (sign_extend:DI (neg:SI
507 (match_operand:SI 1 "reg_or_8bit_operand" "rI"))))]
511 (define_insn "negdi2"
512 [(set (match_operand:DI 0 "register_operand" "=r")
513 (neg:DI (match_operand:DI 1 "reg_or_8bit_operand" "rI")))]
517 (define_expand "subsi3"
518 [(set (match_operand:SI 0 "register_operand" "")
519 (minus:SI (match_operand:SI 1 "reg_or_0_operand" "")
520 (match_operand:SI 2 "reg_or_8bit_operand" "")))]
523 { emit_insn (gen_rtx (SET, VOIDmode, gen_lowpart (DImode, operands[0]),
524 gen_rtx (MINUS, DImode,
525 gen_lowpart (DImode, operands[1]),
526 gen_lowpart (DImode, operands[2]))));
532 [(set (match_operand:SI 0 "register_operand" "=r")
533 (minus:SI (match_operand:SI 1 "reg_or_0_operand" "rJ")
534 (match_operand:SI 2 "reg_or_8bit_operand" "rI")))]
539 [(set (match_operand:DI 0 "register_operand" "=r")
540 (sign_extend:DI (minus:SI (match_operand:SI 1 "reg_or_0_operand" "rJ")
541 (match_operand:SI 2 "reg_or_8bit_operand" "rI"))))]
545 (define_insn "subdi3"
546 [(set (match_operand:DI 0 "register_operand" "=r")
547 (minus:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
548 (match_operand:DI 2 "reg_or_8bit_operand" "rI")))]
553 [(set (match_operand:SI 0 "register_operand" "=r")
554 (minus:SI (mult:SI (match_operand:SI 1 "reg_or_0_operand" "rJ")
555 (match_operand:SI 2 "const48_operand" "I"))
556 (match_operand:SI 3 "reg_or_8bit_operand" "rI")))]
561 [(set (match_operand:DI 0 "register_operand" "=r")
563 (minus:SI (mult:SI (match_operand:SI 1 "reg_or_0_operand" "rJ")
564 (match_operand:SI 2 "const48_operand" "I"))
565 (match_operand:SI 3 "reg_or_8bit_operand" "rI"))))]
570 [(set (match_operand:DI 0 "register_operand" "=r")
571 (minus:DI (mult:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
572 (match_operand:DI 2 "const48_operand" "I"))
573 (match_operand:DI 3 "reg_or_8bit_operand" "rI")))]
577 (define_insn "mulsi3"
578 [(set (match_operand:SI 0 "register_operand" "=r")
579 (mult:SI (match_operand:SI 1 "reg_or_0_operand" "%rJ")
580 (match_operand:SI 2 "reg_or_0_operand" "rJ")))]
583 [(set_attr "type" "imull")])
586 [(set (match_operand:DI 0 "register_operand" "=r")
587 (sign_extend:DI (mult:SI (match_operand:SI 1 "reg_or_0_operand" "%rJ")
588 (match_operand:SI 2 "reg_or_0_operand" "rJ"))))]
591 [(set_attr "type" "imull")])
593 (define_insn "muldi3"
594 [(set (match_operand:DI 0 "register_operand" "=r")
595 (mult:DI (match_operand:DI 1 "reg_or_0_operand" "%rJ")
596 (match_operand:DI 2 "reg_or_0_operand" "rJ")))]
599 [(set_attr "type" "imulq")])
601 (define_insn "umuldi3_highpart"
602 [(set (match_operand:DI 0 "register_operand" "=r")
605 (mult:TI (zero_extend:TI (match_operand:DI 1 "register_operand" "r"))
606 (zero_extend:TI (match_operand:DI 2 "register_operand" "r")))
610 [(set_attr "type" "imulq")])
613 [(set (match_operand:DI 0 "register_operand" "=r")
616 (mult:TI (zero_extend:TI (match_operand:DI 1 "register_operand" "r"))
617 (match_operand:TI 2 "cint8_operand" "I"))
621 [(set_attr "type" "imulq")])
623 ;; The divide and remainder operations always take their inputs from
624 ;; r24 and r25, put their output in r27, and clobber r23 and r28.
626 ;; ??? comment out the divsi routines since the library functions
627 ;; don't seem to do the right thing with the high 32-bits of a
630 ;(define_expand "divsi3"
631 ; [(set (reg:SI 24) (match_operand:SI 1 "input_operand" ""))
632 ; (set (reg:SI 25) (match_operand:SI 2 "input_operand" ""))
633 ; (parallel [(set (reg:SI 27)
634 ; (div:SI (reg:SI 24)
636 ; (clobber (reg:DI 23))
637 ; (clobber (reg:DI 28))])
638 ; (set (match_operand:SI 0 "general_operand" "")
643 ;(define_expand "udivsi3"
644 ; [(set (reg:SI 24) (match_operand:SI 1 "input_operand" ""))
645 ; (set (reg:SI 25) (match_operand:SI 2 "input_operand" ""))
646 ; (parallel [(set (reg:SI 27)
647 ; (udiv:SI (reg:SI 24)
649 ; (clobber (reg:DI 23))
650 ; (clobber (reg:DI 28))])
651 ; (set (match_operand:SI 0 "general_operand" "")
656 ;(define_expand "modsi3"
657 ; [(set (reg:SI 24) (match_operand:SI 1 "input_operand" ""))
658 ; (set (reg:SI 25) (match_operand:SI 2 "input_operand" ""))
659 ; (parallel [(set (reg:SI 27)
660 ; (mod:SI (reg:SI 24)
662 ; (clobber (reg:DI 23))
663 ; (clobber (reg:DI 28))])
664 ; (set (match_operand:SI 0 "general_operand" "")
669 ;(define_expand "umodsi3"
670 ; [(set (reg:SI 24) (match_operand:SI 1 "input_operand" ""))
671 ; (set (reg:SI 25) (match_operand:SI 2 "input_operand" ""))
672 ; (parallel [(set (reg:SI 27)
673 ; (umod:SI (reg:SI 24)
675 ; (clobber (reg:DI 23))
676 ; (clobber (reg:DI 28))])
677 ; (set (match_operand:SI 0 "general_operand" "")
682 (define_expand "divdi3"
683 [(set (reg:DI 24) (match_operand:DI 1 "input_operand" ""))
684 (set (reg:DI 25) (match_operand:DI 2 "input_operand" ""))
685 (parallel [(set (reg:DI 27)
688 (clobber (reg:DI 23))
689 (clobber (reg:DI 28))])
690 (set (match_operand:DI 0 "general_operand" "")
695 (define_expand "udivdi3"
696 [(set (reg:DI 24) (match_operand:DI 1 "input_operand" ""))
697 (set (reg:DI 25) (match_operand:DI 2 "input_operand" ""))
698 (parallel [(set (reg:DI 27)
701 (clobber (reg:DI 23))
702 (clobber (reg:DI 28))])
703 (set (match_operand:DI 0 "general_operand" "")
708 (define_expand "moddi3"
709 [(set (reg:DI 24) (match_operand:DI 1 "input_operand" ""))
710 (set (reg:DI 25) (match_operand:DI 2 "input_operand" ""))
711 (parallel [(set (reg:DI 27)
714 (clobber (reg:DI 23))
715 (clobber (reg:DI 28))])
716 (set (match_operand:DI 0 "general_operand" "")
721 (define_expand "umoddi3"
722 [(set (reg:DI 24) (match_operand:DI 1 "input_operand" ""))
723 (set (reg:DI 25) (match_operand:DI 2 "input_operand" ""))
724 (parallel [(set (reg:DI 27)
727 (clobber (reg:DI 23))
728 (clobber (reg:DI 28))])
729 (set (match_operand:DI 0 "general_operand" "")
736 ; (match_operator:SI 1 "divmod_operator"
737 ; [(reg:SI 24) (reg:SI 25)]))
738 ; (clobber (reg:DI 23))
739 ; (clobber (reg:DI 28))]
742 ; [(set_attr "type" "isubr")])
746 (match_operator:DI 1 "divmod_operator"
747 [(reg:DI 24) (reg:DI 25)]))
748 (clobber (reg:DI 23))
749 (clobber (reg:DI 28))]
752 [(set_attr "type" "isubr")])
754 ;; Next are the basic logical operations. These only exist in DImode.
756 (define_insn "anddi3"
757 [(set (match_operand:DI 0 "register_operand" "=r,r,r")
758 (and:DI (match_operand:DI 1 "reg_or_0_operand" "%rJ,rJ,rJ")
759 (match_operand:DI 2 "and_operand" "rI,N,MH")))]
765 [(set_attr "type" "ilog,ilog,shift")])
767 ;; There are times when we can split an AND into two AND insns. This occurs
768 ;; when we can first clear any bytes and then clear anything else. For
769 ;; example "I & 0xffff07" is "(I & 0xffffff) & 0xffffffffffffff07".
770 ;; Only do this when running on 64-bit host since the computations are
771 ;; too messy otherwise.
774 [(set (match_operand:DI 0 "register_operand" "")
775 (and:DI (match_operand:DI 1 "register_operand" "")
776 (match_operand:DI 2 "const_int_operand" "")))]
777 "HOST_BITS_PER_WIDE_INT == 64 && ! and_operand (operands[2], DImode)"
778 [(set (match_dup 0) (and:DI (match_dup 1) (match_dup 3)))
779 (set (match_dup 0) (and:DI (match_dup 0) (match_dup 4)))]
782 unsigned HOST_WIDE_INT mask1 = INTVAL (operands[2]);
783 unsigned HOST_WIDE_INT mask2 = mask1;
786 /* For each byte that isn't all zeros, make it all ones. */
787 for (i = 0; i < 64; i += 8)
788 if ((mask1 & ((HOST_WIDE_INT) 0xff << i)) != 0)
789 mask1 |= (HOST_WIDE_INT) 0xff << i;
791 /* Now turn on any bits we've just turned off. */
794 operands[3] = GEN_INT (mask1);
795 operands[4] = GEN_INT (mask2);
798 (define_insn "zero_extendqihi2"
799 [(set (match_operand:HI 0 "register_operand" "=r")
800 (zero_extend:HI (match_operand:QI 1 "register_operand" "r")))]
803 [(set_attr "type" "shift")])
806 [(set (match_operand:SI 0 "register_operand" "=r,r")
807 (zero_extend:SI (match_operand:QI 1 "nonimmediate_operand" "r,m")))]
812 [(set_attr "type" "shift,ld")])
815 [(set (match_operand:SI 0 "register_operand" "=r")
816 (zero_extend:SI (match_operand:QI 1 "register_operand" "r")))]
819 [(set_attr "type" "shift")])
821 (define_expand "zero_extendqisi2"
822 [(set (match_operand:SI 0 "register_operand" "")
823 (zero_extend:SI (match_operand:QI 1 "register_operand" "")))]
828 [(set (match_operand:DI 0 "register_operand" "=r,r")
829 (zero_extend:DI (match_operand:QI 1 "nonimmediate_operand" "r,m")))]
834 [(set_attr "type" "shift,ld")])
837 [(set (match_operand:DI 0 "register_operand" "=r")
838 (zero_extend:DI (match_operand:QI 1 "register_operand" "r")))]
841 [(set_attr "type" "shift")])
843 (define_expand "zero_extendqidi2"
844 [(set (match_operand:DI 0 "register_operand" "")
845 (zero_extend:DI (match_operand:QI 1 "register_operand" "")))]
850 [(set (match_operand:SI 0 "register_operand" "=r,r")
851 (zero_extend:SI (match_operand:HI 1 "nonimmediate_operand" "r,m")))]
856 [(set_attr "type" "shift,ld")])
859 [(set (match_operand:SI 0 "register_operand" "=r")
860 (zero_extend:SI (match_operand:HI 1 "register_operand" "r")))]
863 [(set_attr "type" "shift")])
865 (define_expand "zero_extendhisi2"
866 [(set (match_operand:SI 0 "register_operand" "")
867 (zero_extend:SI (match_operand:HI 1 "register_operand" "")))]
872 [(set (match_operand:DI 0 "register_operand" "=r,r")
873 (zero_extend:DI (match_operand:HI 1 "nonimmediate_operand" "r,m")))]
878 [(set_attr "type" "shift,ld")])
881 [(set (match_operand:DI 0 "register_operand" "=r")
882 (zero_extend:DI (match_operand:HI 1 "register_operand" "r")))]
885 [(set_attr "type" "shift")])
887 (define_expand "zero_extendhidi2"
888 [(set (match_operand:DI 0 "register_operand" "")
889 (zero_extend:DI (match_operand:HI 1 "register_operand" "")))]
893 (define_insn "zero_extendsidi2"
894 [(set (match_operand:DI 0 "register_operand" "=r")
895 (zero_extend:DI (match_operand:SI 1 "register_operand" "r")))]
898 [(set_attr "type" "shift")])
901 [(set (match_operand:DI 0 "register_operand" "=r")
902 (and:DI (not:DI (match_operand:DI 1 "reg_or_8bit_operand" "rI"))
903 (match_operand:DI 2 "reg_or_0_operand" "rJ")))]
906 [(set_attr "type" "ilog")])
908 (define_insn "iordi3"
909 [(set (match_operand:DI 0 "register_operand" "=r,r")
910 (ior:DI (match_operand:DI 1 "reg_or_0_operand" "%rJ,rJ")
911 (match_operand:DI 2 "or_operand" "rI,N")))]
916 [(set_attr "type" "ilog")])
918 (define_insn "one_cmpldi2"
919 [(set (match_operand:DI 0 "register_operand" "=r")
920 (not:DI (match_operand:DI 1 "reg_or_8bit_operand" "rI")))]
923 [(set_attr "type" "ilog")])
926 [(set (match_operand:DI 0 "register_operand" "=r")
927 (ior:DI (not:DI (match_operand:DI 1 "reg_or_8bit_operand" "rI"))
928 (match_operand:DI 2 "reg_or_0_operand" "rJ")))]
931 [(set_attr "type" "ilog")])
933 (define_insn "xordi3"
934 [(set (match_operand:DI 0 "register_operand" "=r,r")
935 (xor:DI (match_operand:DI 1 "reg_or_0_operand" "%rJ,rJ")
936 (match_operand:DI 2 "or_operand" "rI,N")))]
941 [(set_attr "type" "ilog")])
944 [(set (match_operand:DI 0 "register_operand" "=r")
945 (not:DI (xor:DI (match_operand:DI 1 "register_operand" "%rJ")
946 (match_operand:DI 2 "register_operand" "rI"))))]
949 [(set_attr "type" "ilog")])
951 ;; Next come the shifts and the various extract and insert operations.
953 (define_insn "ashldi3"
954 [(set (match_operand:DI 0 "register_operand" "=r,r")
955 (ashift:DI (match_operand:DI 1 "reg_or_0_operand" "rJ,rJ")
956 (match_operand:DI 2 "reg_or_6bit_operand" "P,rI")))]
960 switch (which_alternative)
963 if (operands[2] == const1_rtx)
964 return \"addq %r1,%r1,%0\";
966 return \"s%P2addq %r1,0,%0\";
968 return \"sll %r1,%2,%0\";
971 [(set_attr "type" "iadd,shift")])
973 ;; ??? The following pattern is made by combine, but earlier phases
974 ;; (specifically flow) can't handle it. This occurs in jump.c. Deal
975 ;; with this in a better way at some point.
977 ;; [(set (match_operand:DI 0 "register_operand" "=r")
979 ;; (subreg:SI (ashift:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
980 ;; (match_operand:DI 2 "const_int_operand" "P"))
982 ;; "INTVAL (operands[2]) >= 1 && INTVAL (operands[2]) <= 3"
985 ;; if (operands[2] == const1_rtx)
986 ;; return \"addl %r1,%r1,%0\";
988 ;; return \"s%P2addl %r1,0,%0\";
990 ;; [(set_attr "type" "iadd")])
992 (define_insn "lshrdi3"
993 [(set (match_operand:DI 0 "register_operand" "=r")
994 (lshiftrt:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
995 (match_operand:DI 2 "reg_or_6bit_operand" "rI")))]
998 [(set_attr "type" "shift")])
1000 (define_insn "ashrdi3"
1001 [(set (match_operand:DI 0 "register_operand" "=r")
1002 (ashiftrt:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
1003 (match_operand:DI 2 "reg_or_6bit_operand" "rI")))]
1006 [(set_attr "type" "shift")])
1008 (define_expand "extendqihi2"
1010 (ashift:DI (match_operand:QI 1 "some_operand" "")
1012 (set (match_operand:HI 0 "register_operand" "")
1013 (ashiftrt:DI (match_dup 2)
1018 if (TARGET_BYTE_OPS)
1020 emit_insn (gen_extendqihi2x (operands[0],
1021 force_reg (QImode, operands[1])));
1025 /* If we have an unaligned MEM, extend to DImode (which we do
1026 specially) and then copy to the result. */
1027 if (unaligned_memory_operand (operands[1], HImode))
1029 rtx temp = gen_reg_rtx (DImode);
1031 emit_insn (gen_extendqidi2 (temp, operands[1]));
1032 emit_move_insn (operands[0], gen_lowpart (HImode, temp));
1036 operands[0] = gen_lowpart (DImode, operands[0]);
1037 operands[1] = gen_lowpart (DImode, force_reg (QImode, operands[1]));
1038 operands[2] = gen_reg_rtx (DImode);
1041 (define_insn "extendqidi2x"
1042 [(set (match_operand:DI 0 "register_operand" "=r")
1043 (sign_extend:DI (match_operand:QI 1 "register_operand" "r")))]
1046 [(set_attr "type" "shift")])
1048 (define_insn "extendhidi2x"
1049 [(set (match_operand:DI 0 "register_operand" "=r")
1050 (sign_extend:DI (match_operand:HI 1 "register_operand" "r")))]
1053 [(set_attr "type" "shift")])
1055 (define_insn "extendqisi2x"
1056 [(set (match_operand:SI 0 "register_operand" "=r")
1057 (sign_extend:SI (match_operand:QI 1 "register_operand" "r")))]
1060 [(set_attr "type" "shift")])
1062 (define_insn "extendhisi2x"
1063 [(set (match_operand:SI 0 "register_operand" "=r")
1064 (sign_extend:SI (match_operand:HI 1 "register_operand" "r")))]
1067 [(set_attr "type" "shift")])
1069 (define_insn "extendqihi2x"
1070 [(set (match_operand:HI 0 "register_operand" "=r")
1071 (sign_extend:HI (match_operand:QI 1 "register_operand" "r")))]
1074 [(set_attr "type" "shift")])
1076 (define_expand "extendqisi2"
1078 (ashift:DI (match_operand:QI 1 "some_operand" "")
1080 (set (match_operand:SI 0 "register_operand" "")
1081 (ashiftrt:DI (match_dup 2)
1086 if (TARGET_BYTE_OPS)
1088 emit_insn (gen_extendqisi2x (operands[0],
1089 force_reg (QImode, operands[1])));
1093 /* If we have an unaligned MEM, extend to a DImode form of
1094 the result (which we do specially). */
1095 if (unaligned_memory_operand (operands[1], QImode))
1097 rtx temp = gen_reg_rtx (DImode);
1099 emit_insn (gen_extendqidi2 (temp, operands[1]));
1100 emit_move_insn (operands[0], gen_lowpart (SImode, temp));
1104 operands[0] = gen_lowpart (DImode, operands[0]);
1105 operands[1] = gen_lowpart (DImode, force_reg (QImode, operands[1]));
1106 operands[2] = gen_reg_rtx (DImode);
1109 (define_expand "extendqidi2"
1111 (ashift:DI (match_operand:QI 1 "some_operand" "")
1113 (set (match_operand:DI 0 "register_operand" "")
1114 (ashiftrt:DI (match_dup 2)
1118 { extern rtx get_unaligned_address ();
1120 if (TARGET_BYTE_OPS)
1122 emit_insn (gen_extendqidi2x (operands[0],
1123 force_reg (QImode, operands[1])));
1127 if (unaligned_memory_operand (operands[1], QImode))
1130 = gen_unaligned_extendqidi (operands[0],
1131 get_unaligned_address (operands[1], 1));
1133 alpha_set_memflags (seq, operands[1]);
1138 operands[1] = gen_lowpart (DImode, force_reg (QImode, operands[1]));
1139 operands[2] = gen_reg_rtx (DImode);
1142 (define_expand "extendhisi2"
1144 (ashift:DI (match_operand:HI 1 "some_operand" "")
1146 (set (match_operand:SI 0 "register_operand" "")
1147 (ashiftrt:DI (match_dup 2)
1152 if (TARGET_BYTE_OPS)
1154 emit_insn (gen_extendhisi2x (operands[0],
1155 force_reg (HImode, operands[1])));
1159 /* If we have an unaligned MEM, extend to a DImode form of
1160 the result (which we do specially). */
1161 if (unaligned_memory_operand (operands[1], HImode))
1163 rtx temp = gen_reg_rtx (DImode);
1165 emit_insn (gen_extendhidi2 (temp, operands[1]));
1166 emit_move_insn (operands[0], gen_lowpart (SImode, temp));
1170 operands[0] = gen_lowpart (DImode, operands[0]);
1171 operands[1] = gen_lowpart (DImode, force_reg (HImode, operands[1]));
1172 operands[2] = gen_reg_rtx (DImode);
1175 (define_expand "extendhidi2"
1177 (ashift:DI (match_operand:HI 1 "some_operand" "")
1179 (set (match_operand:DI 0 "register_operand" "")
1180 (ashiftrt:DI (match_dup 2)
1184 { extern rtx get_unaligned_address ();
1186 if (TARGET_BYTE_OPS)
1188 emit_insn (gen_extendhidi2x (operands[0],
1189 force_reg (HImode, operands[1])));
1193 if (unaligned_memory_operand (operands[1], HImode))
1196 = gen_unaligned_extendhidi (operands[0],
1197 get_unaligned_address (operands[1], 2));
1199 alpha_set_memflags (seq, operands[1]);
1204 operands[1] = gen_lowpart (DImode, force_reg (HImode, operands[1]));
1205 operands[2] = gen_reg_rtx (DImode);
1208 ;; Here's how we sign extend an unaligned byte and halfword. Doing this
1209 ;; as a pattern saves one instruction. The code is similar to that for
1210 ;; the unaligned loads (see below).
1212 ;; Operand 1 is the address + 1 (+2 for HI), operand 0 is the result.
1213 (define_expand "unaligned_extendqidi"
1214 [(set (match_dup 2) (match_operand:DI 1 "address_operand" ""))
1216 (mem:DI (and:DI (plus:DI (match_dup 2) (const_int -1))
1219 (ashift:DI (match_dup 3)
1220 (minus:DI (const_int 56)
1222 (and:DI (plus:DI (match_dup 2) (const_int -1))
1225 (set (subreg:DI (match_operand:QI 0 "register_operand" "") 0)
1226 (ashiftrt:DI (match_dup 4) (const_int 56)))]
1229 { operands[2] = gen_reg_rtx (DImode);
1230 operands[3] = gen_reg_rtx (DImode);
1231 operands[4] = gen_reg_rtx (DImode);
1234 (define_expand "unaligned_extendhidi"
1235 [(set (match_dup 2) (match_operand:DI 1 "address_operand" ""))
1237 (mem:DI (and:DI (plus:DI (match_dup 2) (const_int -2))
1240 (ashift:DI (match_dup 3)
1241 (minus:DI (const_int 56)
1243 (and:DI (plus:DI (match_dup 2) (const_int -1))
1246 (set (subreg:DI (match_operand:QI 0 "register_operand" "") 0)
1247 (ashiftrt:DI (match_dup 4) (const_int 48)))]
1250 { operands[2] = gen_reg_rtx (DImode);
1251 operands[3] = gen_reg_rtx (DImode);
1252 operands[4] = gen_reg_rtx (DImode);
1256 [(set (match_operand:DI 0 "register_operand" "=r")
1257 (zero_extract:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
1258 (match_operand:DI 2 "mode_width_operand" "n")
1259 (match_operand:DI 3 "mul8_operand" "I")))]
1261 "ext%M2l %r1,%s3,%0"
1262 [(set_attr "type" "shift")])
1265 [(set (match_operand:DI 0 "register_operand" "=r")
1266 (zero_extract:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
1267 (match_operand:DI 2 "mode_width_operand" "n")
1268 (ashift:DI (match_operand:DI 3 "reg_or_8bit_operand" "rI")
1272 [(set_attr "type" "shift")])
1275 [(set (match_operand:DI 0 "register_operand" "=r")
1277 (match_operand:DI 1 "reg_or_0_operand" "rJ")
1278 (minus:DI (const_int 56)
1281 (plus:DI (match_operand:DI 2 "reg_or_8bit_operand" "rI")
1287 [(set_attr "type" "shift")])
1290 [(set (match_operand:DI 0 "register_operand" "=r")
1292 (and:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
1293 (const_int 2147483647))
1294 (minus:DI (const_int 56)
1297 (plus:DI (match_operand:DI 2 "reg_or_8bit_operand" "rI")
1303 [(set_attr "type" "shift")])
1306 [(set (match_operand:DI 0 "register_operand" "=r")
1308 (and:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
1310 (minus:DI (const_int 56)
1313 (plus:DI (match_operand:DI 2 "reg_or_8bit_operand" "rI")
1319 [(set_attr "type" "shift")])
1321 ;; This converts an extXl into an extXh with an appropriate adjustment
1322 ;; to the address calculation.
1325 ;; [(set (match_operand:DI 0 "register_operand" "")
1326 ;; (ashift:DI (zero_extract:DI (match_operand:DI 1 "register_operand" "")
1327 ;; (match_operand:DI 2 "mode_width_operand" "")
1328 ;; (ashift:DI (match_operand:DI 3 "" "")
1330 ;; (match_operand:DI 4 "const_int_operand" "")))
1331 ;; (clobber (match_operand:DI 5 "register_operand" ""))]
1332 ;; "INTVAL (operands[4]) == 64 - INTVAL (operands[2])"
1333 ;; [(set (match_dup 5) (match_dup 6))
1334 ;; (set (match_dup 0)
1335 ;; (ashift:DI (zero_extract:DI (match_dup 1) (match_dup 2)
1336 ;; (ashift:DI (plus:DI (match_dup 5)
1342 ;; operands[6] = plus_constant (operands[3],
1343 ;; INTVAL (operands[2]) / BITS_PER_UNIT);
1344 ;; operands[7] = GEN_INT (- INTVAL (operands[2]) / BITS_PER_UNIT);
1348 [(set (match_operand:DI 0 "register_operand" "=r")
1349 (ashift:DI (zero_extend:DI (match_operand:QI 1 "register_operand" "r"))
1350 (match_operand:DI 2 "mul8_operand" "I")))]
1353 [(set_attr "type" "shift")])
1356 [(set (match_operand:DI 0 "register_operand" "=r")
1357 (ashift:DI (zero_extend:DI (match_operand:HI 1 "register_operand" "r"))
1358 (match_operand:DI 2 "mul8_operand" "I")))]
1361 [(set_attr "type" "shift")])
1364 [(set (match_operand:DI 0 "register_operand" "=r")
1365 (ashift:DI (zero_extend:DI (match_operand:SI 1 "register_operand" "r"))
1366 (match_operand:DI 2 "mul8_operand" "I")))]
1369 [(set_attr "type" "shift")])
1372 [(set (match_operand:DI 0 "register_operand" "=r")
1373 (ashift:DI (zero_extend:DI (match_operand:QI 1 "register_operand" "r"))
1374 (ashift:DI (match_operand:DI 2 "reg_or_8bit_operand" "rI")
1378 [(set_attr "type" "shift")])
1381 [(set (match_operand:DI 0 "register_operand" "=r")
1382 (ashift:DI (zero_extend:DI (match_operand:HI 1 "register_operand" "r"))
1383 (ashift:DI (match_operand:DI 2 "reg_or_8bit_operand" "rI")
1387 [(set_attr "type" "shift")])
1390 [(set (match_operand:DI 0 "register_operand" "=r")
1391 (ashift:DI (zero_extend:DI (match_operand:SI 1 "register_operand" "r"))
1392 (ashift:DI (match_operand:DI 2 "reg_or_8bit_operand" "rI")
1396 [(set_attr "type" "shift")])
1398 ;; We do not include the insXh insns because they are complex to express
1399 ;; and it does not appear that we would ever want to generate them.
1402 [(set (match_operand:DI 0 "register_operand" "=r")
1403 (and:DI (not:DI (ashift:DI
1404 (match_operand:DI 2 "mode_mask_operand" "n")
1406 (match_operand:DI 3 "reg_or_8bit_operand" "rI")
1408 (match_operand:DI 1 "reg_or_0_operand" "rJ")))]
1411 [(set_attr "type" "shift")])
1413 ;; We do not include the mskXh insns because it does not appear we would ever
1416 ;; Floating-point operations. All the double-precision insns can extend
1417 ;; from single, so indicate that. The exception are the ones that simply
1418 ;; play with the sign bits; it's not clear what to do there.
1420 (define_insn "abssf2"
1421 [(set (match_operand:SF 0 "register_operand" "=f")
1422 (abs:SF (match_operand:SF 1 "reg_or_fp0_operand" "fG")))]
1425 [(set_attr "type" "fcpys")])
1427 (define_insn "absdf2"
1428 [(set (match_operand:DF 0 "register_operand" "=f")
1429 (abs:DF (match_operand:DF 1 "reg_or_fp0_operand" "fG")))]
1432 [(set_attr "type" "fcpys")])
1434 (define_insn "negsf2"
1435 [(set (match_operand:SF 0 "register_operand" "=f")
1436 (neg:SF (match_operand:SF 1 "reg_or_fp0_operand" "fG")))]
1439 [(set_attr "type" "fadd")])
1441 (define_insn "negdf2"
1442 [(set (match_operand:DF 0 "register_operand" "=f")
1443 (neg:DF (match_operand:DF 1 "reg_or_fp0_operand" "fG")))]
1446 [(set_attr "type" "fadd")])
1449 [(set (match_operand:SF 0 "register_operand" "=&f")
1450 (plus:SF (match_operand:SF 1 "reg_or_fp0_operand" "%fG")
1451 (match_operand:SF 2 "reg_or_fp0_operand" "fG")))]
1452 "TARGET_FP && alpha_tp == ALPHA_TP_INSN"
1453 "add%,%)%& %R1,%R2,%0"
1454 [(set_attr "type" "fadd")
1455 (set_attr "trap" "yes")])
1457 (define_insn "addsf3"
1458 [(set (match_operand:SF 0 "register_operand" "=f")
1459 (plus:SF (match_operand:SF 1 "reg_or_fp0_operand" "%fG")
1460 (match_operand:SF 2 "reg_or_fp0_operand" "fG")))]
1462 "add%,%)%& %R1,%R2,%0"
1463 [(set_attr "type" "fadd")
1464 (set_attr "trap" "yes")])
1467 [(set (match_operand:DF 0 "register_operand" "=&f")
1468 (plus:DF (match_operand:DF 1 "reg_or_fp0_operand" "%fG")
1469 (match_operand:DF 2 "reg_or_fp0_operand" "fG")))]
1470 "TARGET_FP && alpha_tp == ALPHA_TP_INSN"
1471 "add%-%)%& %R1,%R2,%0"
1472 [(set_attr "type" "fadd")
1473 (set_attr "trap" "yes")])
1475 (define_insn "adddf3"
1476 [(set (match_operand:DF 0 "register_operand" "=f")
1477 (plus:DF (match_operand:DF 1 "reg_or_fp0_operand" "%fG")
1478 (match_operand:DF 2 "reg_or_fp0_operand" "fG")))]
1480 "add%-%)%& %R1,%R2,%0"
1481 [(set_attr "type" "fadd")
1482 (set_attr "trap" "yes")])
1485 [(set (match_operand:DF 0 "register_operand" "=f")
1486 (plus:DF (float_extend:DF
1487 (match_operand:SF 1 "reg_or_fp0_operand" "fG"))
1488 (match_operand:DF 2 "reg_or_fp0_operand" "fG")))]
1489 "TARGET_FP && alpha_tp != ALPHA_TP_INSN"
1490 "add%-%)%& %R1,%R2,%0"
1491 [(set_attr "type" "fadd")
1492 (set_attr "trap" "yes")])
1495 [(set (match_operand:DF 0 "register_operand" "=f")
1496 (plus:DF (float_extend:DF
1497 (match_operand:SF 1 "reg_or_fp0_operand" "%fG"))
1499 (match_operand:SF 2 "reg_or_fp0_operand" "fG"))))]
1500 "TARGET_FP && alpha_tp != ALPHA_TP_INSN"
1501 "add%-%)%& %R1,%R2,%0"
1502 [(set_attr "type" "fadd")
1503 (set_attr "trap" "yes")])
1505 (define_insn "fix_truncdfdi2"
1506 [(set (match_operand:DI 0 "register_operand" "=f")
1507 (fix:DI (match_operand:DF 1 "reg_or_fp0_operand" "fG")))]
1510 [(set_attr "type" "fadd")])
1512 (define_insn "fix_truncsfdi2"
1513 [(set (match_operand:DI 0 "register_operand" "=f")
1514 (fix:DI (float_extend:DF
1515 (match_operand:SF 1 "reg_or_fp0_operand" "fG"))))]
1518 [(set_attr "type" "fadd")])
1521 [(set (match_operand:SF 0 "register_operand" "=&f")
1522 (float:SF (match_operand:DI 1 "register_operand" "f")))]
1523 "TARGET_FP && alpha_tp == ALPHA_TP_INSN"
1525 [(set_attr "type" "fadd")
1526 (set_attr "trap" "yes")])
1528 (define_insn "floatdisf2"
1529 [(set (match_operand:SF 0 "register_operand" "=f")
1530 (float:SF (match_operand:DI 1 "register_operand" "f")))]
1533 [(set_attr "type" "fadd")
1534 (set_attr "trap" "yes")])
1537 [(set (match_operand:DF 0 "register_operand" "=&f")
1538 (float:DF (match_operand:DI 1 "register_operand" "f")))]
1539 "TARGET_FP && alpha_tp == ALPHA_TP_INSN"
1541 [(set_attr "type" "fadd")
1542 (set_attr "trap" "yes")])
1544 (define_insn "floatdidf2"
1545 [(set (match_operand:DF 0 "register_operand" "=f")
1546 (float:DF (match_operand:DI 1 "register_operand" "f")))]
1549 [(set_attr "type" "fadd")
1550 (set_attr "trap" "yes")])
1552 (define_expand "extendsfdf2"
1553 [(use (match_operand:DF 0 "register_operand" ""))
1554 (use (match_operand:SF 1 "nonimmediate_operand" ""))]
1558 if (alpha_tp == ALPHA_TP_INSN)
1559 emit_insn (gen_extendsfdf2_tp (operands[0],
1560 force_reg (SFmode, operands[1])));
1562 emit_insn (gen_extendsfdf2_no_tp (operands[0], operands[1]));
1567 (define_insn "extendsfdf2_tp"
1568 [(set (match_operand:DF 0 "register_operand" "=&f")
1569 (float_extend:DF (match_operand:SF 1 "register_operand" "f")))]
1570 "TARGET_FP && alpha_tp == ALPHA_TP_INSN"
1572 [(set_attr "type" "fadd")
1573 (set_attr "trap" "yes")])
1575 (define_insn "extendsfdf2_no_tp"
1576 [(set (match_operand:DF 0 "register_operand" "=f,f,m")
1577 (float_extend:DF (match_operand:SF 1 "nonimmediate_operand" "f,m,f")))]
1578 "TARGET_FP && alpha_tp != ALPHA_TP_INSN"
1583 [(set_attr "type" "fcpys,ld,st")
1584 (set_attr "trap" "yes")])
1587 [(set (match_operand:SF 0 "register_operand" "=&f")
1588 (float_truncate:SF (match_operand:DF 1 "reg_or_fp0_operand" "fG")))]
1589 "TARGET_FP && alpha_tp == ALPHA_TP_INSN"
1590 "cvt%-%,%)%& %R1,%0"
1591 [(set_attr "type" "fadd")
1592 (set_attr "trap" "yes")])
1594 (define_insn "truncdfsf2"
1595 [(set (match_operand:SF 0 "register_operand" "=f")
1596 (float_truncate:SF (match_operand:DF 1 "reg_or_fp0_operand" "fG")))]
1598 "cvt%-%,%)%& %R1,%0"
1599 [(set_attr "type" "fadd")
1600 (set_attr "trap" "yes")])
1603 [(set (match_operand:SF 0 "register_operand" "=&f")
1604 (div:SF (match_operand:SF 1 "reg_or_fp0_operand" "fG")
1605 (match_operand:SF 2 "reg_or_fp0_operand" "fG")))]
1606 "TARGET_FP && alpha_tp == ALPHA_TP_INSN"
1607 "div%,%)%& %R1,%R2,%0"
1608 [(set_attr "type" "fdivs")
1609 (set_attr "trap" "yes")])
1611 (define_insn "divsf3"
1612 [(set (match_operand:SF 0 "register_operand" "=f")
1613 (div:SF (match_operand:SF 1 "reg_or_fp0_operand" "fG")
1614 (match_operand:SF 2 "reg_or_fp0_operand" "fG")))]
1616 "div%,%)%& %R1,%R2,%0"
1617 [(set_attr "type" "fdivs")
1618 (set_attr "trap" "yes")])
1621 [(set (match_operand:DF 0 "register_operand" "=&f")
1622 (div:DF (match_operand:DF 1 "reg_or_fp0_operand" "fG")
1623 (match_operand:DF 2 "reg_or_fp0_operand" "fG")))]
1624 "TARGET_FP && alpha_tp == ALPHA_TP_INSN"
1625 "div%-%)%& %R1,%R2,%0"
1626 [(set_attr "type" "fdivt")
1627 (set_attr "trap" "yes")])
1629 (define_insn "divdf3"
1630 [(set (match_operand:DF 0 "register_operand" "=f")
1631 (div:DF (match_operand:DF 1 "reg_or_fp0_operand" "fG")
1632 (match_operand:DF 2 "reg_or_fp0_operand" "fG")))]
1634 "div%-%)%& %R1,%R2,%0"
1635 [(set_attr "type" "fdivt")
1636 (set_attr "trap" "yes")])
1639 [(set (match_operand:DF 0 "register_operand" "=f")
1640 (div:DF (float_extend:DF (match_operand:SF 1 "reg_or_fp0_operand" "fG"))
1641 (match_operand:DF 2 "reg_or_fp0_operand" "fG")))]
1642 "TARGET_FP && alpha_tp != ALPHA_TP_INSN"
1643 "div%-%)%& %R1,%R2,%0"
1644 [(set_attr "type" "fdivt")
1645 (set_attr "trap" "yes")])
1648 [(set (match_operand:DF 0 "register_operand" "=f")
1649 (div:DF (match_operand:DF 1 "reg_or_fp0_operand" "fG")
1651 (match_operand:SF 2 "reg_or_fp0_operand" "fG"))))]
1652 "TARGET_FP && alpha_tp != ALPHA_TP_INSN"
1653 "div%-%)%& %R1,%R2,%0"
1654 [(set_attr "type" "fdivt")
1655 (set_attr "trap" "yes")])
1658 [(set (match_operand:DF 0 "register_operand" "=f")
1659 (div:DF (float_extend:DF (match_operand:SF 1 "reg_or_fp0_operand" "fG"))
1660 (float_extend:DF (match_operand:SF 2 "reg_or_fp0_operand" "fG"))))]
1661 "TARGET_FP && alpha_tp != ALPHA_TP_INSN"
1662 "div%-%)%& %R1,%R2,%0"
1663 [(set_attr "type" "fdivt")
1664 (set_attr "trap" "yes")])
1667 [(set (match_operand:SF 0 "register_operand" "=&f")
1668 (mult:SF (match_operand:SF 1 "reg_or_fp0_operand" "%fG")
1669 (match_operand:SF 2 "reg_or_fp0_operand" "fG")))]
1670 "TARGET_FP && alpha_tp == ALPHA_TP_INSN"
1671 "mul%,%)%& %R1,%R2,%0"
1672 [(set_attr "type" "fmul")
1673 (set_attr "trap" "yes")])
1675 (define_insn "mulsf3"
1676 [(set (match_operand:SF 0 "register_operand" "=f")
1677 (mult:SF (match_operand:SF 1 "reg_or_fp0_operand" "%fG")
1678 (match_operand:SF 2 "reg_or_fp0_operand" "fG")))]
1680 "mul%,%)%& %R1,%R2,%0"
1681 [(set_attr "type" "fmul")
1682 (set_attr "trap" "yes")])
1685 [(set (match_operand:DF 0 "register_operand" "=&f")
1686 (mult:DF (match_operand:DF 1 "reg_or_fp0_operand" "%fG")
1687 (match_operand:DF 2 "reg_or_fp0_operand" "fG")))]
1688 "TARGET_FP && alpha_tp == ALPHA_TP_INSN"
1689 "mul%-%)%& %R1,%R2,%0"
1690 [(set_attr "type" "fmul")
1691 (set_attr "trap" "yes")])
1693 (define_insn "muldf3"
1694 [(set (match_operand:DF 0 "register_operand" "=f")
1695 (mult:DF (match_operand:DF 1 "reg_or_fp0_operand" "%fG")
1696 (match_operand:DF 2 "reg_or_fp0_operand" "fG")))]
1698 "mul%-%)%& %R1,%R2,%0"
1699 [(set_attr "type" "fmul")
1700 (set_attr "trap" "yes")])
1703 [(set (match_operand:DF 0 "register_operand" "=f")
1704 (mult:DF (float_extend:DF
1705 (match_operand:SF 1 "reg_or_fp0_operand" "fG"))
1706 (match_operand:DF 2 "reg_or_fp0_operand" "fG")))]
1707 "TARGET_FP && alpha_tp != ALPHA_TP_INSN"
1708 "mul%-%)%& %R1,%R2,%0"
1709 [(set_attr "type" "fmul")
1710 (set_attr "trap" "yes")])
1713 [(set (match_operand:DF 0 "register_operand" "=f")
1714 (mult:DF (float_extend:DF
1715 (match_operand:SF 1 "reg_or_fp0_operand" "%fG"))
1717 (match_operand:SF 2 "reg_or_fp0_operand" "fG"))))]
1718 "TARGET_FP && alpha_tp != ALPHA_TP_INSN"
1719 "mul%-%)%& %R1,%R2,%0"
1720 [(set_attr "type" "fmul")
1721 (set_attr "trap" "yes")])
1724 [(set (match_operand:SF 0 "register_operand" "=&f")
1725 (minus:SF (match_operand:SF 1 "reg_or_fp0_operand" "fG")
1726 (match_operand:SF 2 "reg_or_fp0_operand" "fG")))]
1727 "TARGET_FP && alpha_tp == ALPHA_TP_INSN"
1728 "sub%,%)%& %R1,%R2,%0"
1729 [(set_attr "type" "fadd")
1730 (set_attr "trap" "yes")])
1732 (define_insn "subsf3"
1733 [(set (match_operand:SF 0 "register_operand" "=f")
1734 (minus:SF (match_operand:SF 1 "reg_or_fp0_operand" "fG")
1735 (match_operand:SF 2 "reg_or_fp0_operand" "fG")))]
1737 "sub%,%)%& %R1,%R2,%0"
1738 [(set_attr "type" "fadd")
1739 (set_attr "trap" "yes")])
1742 [(set (match_operand:DF 0 "register_operand" "=&f")
1743 (minus:DF (match_operand:DF 1 "reg_or_fp0_operand" "fG")
1744 (match_operand:DF 2 "reg_or_fp0_operand" "fG")))]
1745 "TARGET_FP && alpha_tp == ALPHA_TP_INSN"
1746 "sub%-%)%& %R1,%R2,%0"
1747 [(set_attr "type" "fadd")
1748 (set_attr "trap" "yes")])
1750 (define_insn "subdf3"
1751 [(set (match_operand:DF 0 "register_operand" "=f")
1752 (minus:DF (match_operand:DF 1 "reg_or_fp0_operand" "fG")
1753 (match_operand:DF 2 "reg_or_fp0_operand" "fG")))]
1755 "sub%-%)%& %R1,%R2,%0"
1756 [(set_attr "type" "fadd")
1757 (set_attr "trap" "yes")])
1760 [(set (match_operand:DF 0 "register_operand" "=f")
1761 (minus:DF (float_extend:DF
1762 (match_operand:SF 1 "reg_or_fp0_operand" "fG"))
1763 (match_operand:DF 2 "reg_or_fp0_operand" "fG")))]
1764 "TARGET_FP && alpha_tp != ALPHA_TP_INSN"
1765 "sub%-%)%& %R1,%R2,%0"
1766 [(set_attr "type" "fadd")
1767 (set_attr "trap" "yes")])
1770 [(set (match_operand:DF 0 "register_operand" "=f")
1771 (minus:DF (match_operand:DF 1 "reg_or_fp0_operand" "fG")
1773 (match_operand:SF 2 "reg_or_fp0_operand" "fG"))))]
1774 "TARGET_FP && alpha_tp != ALPHA_TP_INSN"
1775 "sub%-%)%& %R1,%R2,%0"
1776 [(set_attr "type" "fadd")
1777 (set_attr "trap" "yes")])
1780 [(set (match_operand:DF 0 "register_operand" "=f")
1781 (minus:DF (float_extend:DF
1782 (match_operand:SF 1 "reg_or_fp0_operand" "fG"))
1784 (match_operand:SF 2 "reg_or_fp0_operand" "fG"))))]
1785 "TARGET_FP && alpha_tp != ALPHA_TP_INSN"
1786 "sub%-%)%& %R1,%R2,%0"
1787 [(set_attr "type" "fadd")
1788 (set_attr "trap" "yes")])
1790 ;; Next are all the integer comparisons, and conditional moves and branches
1791 ;; and some of the related define_expand's and define_split's.
1794 [(set (match_operand:DI 0 "register_operand" "=r")
1795 (match_operator:DI 1 "alpha_comparison_operator"
1796 [(match_operand:DI 2 "reg_or_0_operand" "rJ")
1797 (match_operand:DI 3 "reg_or_8bit_operand" "rI")]))]
1800 [(set_attr "type" "icmp")])
1803 [(set (match_operand:DI 0 "register_operand" "=r")
1804 (match_operator:DI 1 "alpha_swapped_comparison_operator"
1805 [(match_operand:DI 2 "reg_or_8bit_operand" "rI")
1806 (match_operand:DI 3 "reg_or_0_operand" "rJ")]))]
1809 [(set_attr "type" "icmp")])
1811 ;; This pattern exists so conditional moves of SImode values are handled.
1812 ;; Comparisons are still done in DImode though.
1815 [(set (match_operand:SI 0 "register_operand" "=r,r,r,r")
1817 (match_operator 2 "signed_comparison_operator"
1818 [(match_operand:DI 3 "reg_or_0_operand" "rJ,rJ,J,J")
1819 (match_operand:DI 4 "reg_or_0_operand" "J,J,rJ,rJ")])
1820 (match_operand:SI 1 "reg_or_8bit_operand" "rI,0,rI,0")
1821 (match_operand:SI 5 "reg_or_8bit_operand" "0,rI,0,rI")))]
1822 "operands[3] == const0_rtx || operands[4] == const0_rtx"
1828 [(set_attr "type" "cmov")])
1831 [(set (match_operand:DI 0 "register_operand" "=r,r,r,r")
1833 (match_operator 2 "signed_comparison_operator"
1834 [(match_operand:DI 3 "reg_or_0_operand" "rJ,rJ,J,J")
1835 (match_operand:DI 4 "reg_or_0_operand" "J,J,rJ,rJ")])
1836 (match_operand:DI 1 "reg_or_8bit_operand" "rI,0,rI,0")
1837 (match_operand:DI 5 "reg_or_8bit_operand" "0,rI,0,rI")))]
1838 "operands[3] == const0_rtx || operands[4] == const0_rtx"
1844 [(set_attr "type" "cmov")])
1847 [(set (match_operand:DI 0 "register_operand" "=r,r")
1849 (eq (zero_extract:DI (match_operand:DI 2 "reg_or_0_operand" "rJ,rJ")
1853 (match_operand:DI 1 "reg_or_8bit_operand" "rI,0")
1854 (match_operand:DI 3 "reg_or_8bit_operand" "0,rI")))]
1859 [(set_attr "type" "cmov")])
1862 [(set (match_operand:DI 0 "register_operand" "=r,r")
1864 (ne (zero_extract:DI (match_operand:DI 2 "reg_or_0_operand" "rJ,rJ")
1868 (match_operand:DI 1 "reg_or_8bit_operand" "rI,0")
1869 (match_operand:DI 3 "reg_or_8bit_operand" "0,rI")))]
1874 [(set_attr "type" "cmov")])
1876 ;; This form is added since combine thinks that an IF_THEN_ELSE with both
1877 ;; arms constant is a single insn, so it won't try to form it if combine
1878 ;; knows they are really two insns. This occurs in divides by powers
1882 [(set (match_operand:DI 0 "register_operand" "=r")
1884 (match_operator 2 "signed_comparison_operator"
1885 [(match_operand:DI 3 "reg_or_0_operand" "rJ")
1887 (plus:DI (match_dup 0)
1888 (match_operand:DI 1 "reg_or_8bit_operand" "rI"))
1890 (clobber (match_scratch:DI 4 "=&r"))]
1892 "addq %0,%1,%4\;cmov%C2 %r3,%4,%0"
1893 [(set_attr "type" "cmov")])
1896 [(set (match_operand:DI 0 "register_operand" "")
1898 (match_operator 2 "signed_comparison_operator"
1899 [(match_operand:DI 3 "reg_or_0_operand" "")
1901 (plus:DI (match_dup 0)
1902 (match_operand:DI 1 "reg_or_8bit_operand" ""))
1904 (clobber (match_operand:DI 4 "register_operand" ""))]
1906 [(set (match_dup 4) (plus:DI (match_dup 0) (match_dup 1)))
1907 (set (match_dup 0) (if_then_else:DI (match_op_dup 2
1910 (match_dup 4) (match_dup 0)))]
1915 [(set (match_operand:DI 0 "register_operand" "")
1917 (match_operator 1 "comparison_operator"
1918 [(zero_extract:DI (match_operand:DI 2 "register_operand" "")
1920 (match_operand:DI 3 "const_int_operand" ""))
1922 (match_operand:DI 4 "reg_or_8bit_operand" "")
1923 (match_operand:DI 5 "reg_or_8bit_operand" "")))
1924 (clobber (match_operand:DI 6 "register_operand" ""))])]
1925 "INTVAL (operands[3]) != 0"
1927 (lshiftrt:DI (match_dup 2) (match_dup 3)))
1929 (if_then_else:DI (match_op_dup 1
1930 [(zero_extract:DI (match_dup 6)
1938 ;; For ABS, we have two choices, depending on whether the input and output
1939 ;; registers are the same or not.
1940 (define_expand "absdi2"
1941 [(set (match_operand:DI 0 "register_operand" "")
1942 (abs:DI (match_operand:DI 1 "register_operand" "")))]
1945 { if (rtx_equal_p (operands[0], operands[1]))
1946 emit_insn (gen_absdi2_same (operands[0], gen_reg_rtx (DImode)));
1948 emit_insn (gen_absdi2_diff (operands[0], operands[1]));
1953 (define_expand "absdi2_same"
1954 [(set (match_operand:DI 1 "register_operand" "")
1955 (neg:DI (match_operand:DI 0 "register_operand" "")))
1957 (if_then_else:DI (ge (match_dup 0) (const_int 0))
1963 (define_expand "absdi2_diff"
1964 [(set (match_operand:DI 0 "register_operand" "")
1965 (neg:DI (match_operand:DI 1 "register_operand" "")))
1967 (if_then_else:DI (lt (match_dup 1) (const_int 0))
1974 [(set (match_operand:DI 0 "register_operand" "")
1975 (abs:DI (match_dup 0)))
1976 (clobber (match_operand:DI 2 "register_operand" ""))]
1978 [(set (match_dup 1) (neg:DI (match_dup 0)))
1979 (set (match_dup 0) (if_then_else:DI (ge (match_dup 0) (const_int 0))
1980 (match_dup 0) (match_dup 1)))]
1984 [(set (match_operand:DI 0 "register_operand" "")
1985 (abs:DI (match_operand:DI 1 "register_operand" "")))]
1986 "! rtx_equal_p (operands[0], operands[1])"
1987 [(set (match_dup 0) (neg:DI (match_dup 1)))
1988 (set (match_dup 0) (if_then_else:DI (lt (match_dup 1) (const_int 0))
1989 (match_dup 0) (match_dup 1)))]
1993 [(set (match_operand:DI 0 "register_operand" "")
1994 (neg:DI (abs:DI (match_dup 0))))
1995 (clobber (match_operand:DI 2 "register_operand" ""))]
1997 [(set (match_dup 1) (neg:DI (match_dup 0)))
1998 (set (match_dup 0) (if_then_else:DI (le (match_dup 0) (const_int 0))
1999 (match_dup 0) (match_dup 1)))]
2003 [(set (match_operand:DI 0 "register_operand" "")
2004 (neg:DI (abs:DI (match_operand:DI 1 "register_operand" ""))))]
2005 "! rtx_equal_p (operands[0], operands[1])"
2006 [(set (match_dup 0) (neg:DI (match_dup 1)))
2007 (set (match_dup 0) (if_then_else:DI (gt (match_dup 1) (const_int 0))
2008 (match_dup 0) (match_dup 1)))]
2011 (define_expand "smaxdi3"
2013 (le:DI (match_operand:DI 1 "reg_or_0_operand" "")
2014 (match_operand:DI 2 "reg_or_8bit_operand" "")))
2015 (set (match_operand:DI 0 "register_operand" "")
2016 (if_then_else:DI (eq (match_dup 3) (const_int 0))
2017 (match_dup 1) (match_dup 2)))]
2020 { operands[3] = gen_reg_rtx (DImode);
2024 [(set (match_operand:DI 0 "register_operand" "")
2025 (smax:DI (match_operand:DI 1 "reg_or_0_operand" "")
2026 (match_operand:DI 2 "reg_or_8bit_operand" "")))
2027 (clobber (match_operand:DI 3 "register_operand" ""))]
2028 "operands[2] != const0_rtx"
2029 [(set (match_dup 3) (le:DI (match_dup 1) (match_dup 2)))
2030 (set (match_dup 0) (if_then_else:DI (eq (match_dup 3) (const_int 0))
2031 (match_dup 1) (match_dup 2)))]
2035 [(set (match_operand:DI 0 "register_operand" "=r")
2036 (smax:DI (match_operand:DI 1 "register_operand" "0")
2040 [(set_attr "type" "cmov")])
2042 (define_expand "smindi3"
2044 (lt:DI (match_operand:DI 1 "reg_or_0_operand" "")
2045 (match_operand:DI 2 "reg_or_8bit_operand" "")))
2046 (set (match_operand:DI 0 "register_operand" "")
2047 (if_then_else:DI (ne (match_dup 3) (const_int 0))
2048 (match_dup 1) (match_dup 2)))]
2051 { operands[3] = gen_reg_rtx (DImode);
2055 [(set (match_operand:DI 0 "register_operand" "")
2056 (smin:DI (match_operand:DI 1 "reg_or_0_operand" "")
2057 (match_operand:DI 2 "reg_or_8bit_operand" "")))
2058 (clobber (match_operand:DI 3 "register_operand" ""))]
2059 "operands[2] != const0_rtx"
2060 [(set (match_dup 3) (lt:DI (match_dup 1) (match_dup 2)))
2061 (set (match_dup 0) (if_then_else:DI (ne (match_dup 3) (const_int 0))
2062 (match_dup 1) (match_dup 2)))]
2066 [(set (match_operand:DI 0 "register_operand" "=r")
2067 (smin:DI (match_operand:DI 1 "register_operand" "0")
2071 [(set_attr "type" "cmov")])
2073 (define_expand "umaxdi3"
2075 (leu:DI (match_operand:DI 1 "reg_or_0_operand" "")
2076 (match_operand:DI 2 "reg_or_8bit_operand" "")))
2077 (set (match_operand:DI 0 "register_operand" "")
2078 (if_then_else:DI (eq (match_dup 3) (const_int 0))
2079 (match_dup 1) (match_dup 2)))]
2082 { operands[3] = gen_reg_rtx (DImode);
2086 [(set (match_operand:DI 0 "register_operand" "")
2087 (umax:DI (match_operand:DI 1 "reg_or_0_operand" "")
2088 (match_operand:DI 2 "reg_or_8bit_operand" "")))
2089 (clobber (match_operand:DI 3 "register_operand" ""))]
2090 "operands[2] != const0_rtx"
2091 [(set (match_dup 3) (leu:DI (match_dup 1) (match_dup 2)))
2092 (set (match_dup 0) (if_then_else:DI (eq (match_dup 3) (const_int 0))
2093 (match_dup 1) (match_dup 2)))]
2096 (define_expand "umindi3"
2098 (ltu:DI (match_operand:DI 1 "reg_or_0_operand" "")
2099 (match_operand:DI 2 "reg_or_8bit_operand" "")))
2100 (set (match_operand:DI 0 "register_operand" "")
2101 (if_then_else:DI (ne (match_dup 3) (const_int 0))
2102 (match_dup 1) (match_dup 2)))]
2105 { operands[3] = gen_reg_rtx (DImode);
2109 [(set (match_operand:DI 0 "register_operand" "")
2110 (umin:DI (match_operand:DI 1 "reg_or_0_operand" "")
2111 (match_operand:DI 2 "reg_or_8bit_operand" "")))
2112 (clobber (match_operand:DI 3 "register_operand" ""))]
2113 "operands[2] != const0_rtx"
2114 [(set (match_dup 3) (ltu:DI (match_dup 1) (match_dup 2)))
2115 (set (match_dup 0) (if_then_else:DI (ne (match_dup 3) (const_int 0))
2116 (match_dup 1) (match_dup 2)))]
2122 (match_operator 1 "signed_comparison_operator"
2123 [(match_operand:DI 2 "reg_or_0_operand" "rJ")
2125 (label_ref (match_operand 0 "" ""))
2129 [(set_attr "type" "ibr")])
2134 (match_operator 1 "signed_comparison_operator"
2136 (match_operand:DI 2 "register_operand" "r")])
2137 (label_ref (match_operand 0 "" ""))
2141 [(set_attr "type" "ibr")])
2146 (ne (zero_extract:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
2150 (label_ref (match_operand 0 "" ""))
2154 [(set_attr "type" "ibr")])
2159 (eq (zero_extract:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
2163 (label_ref (match_operand 0 "" ""))
2167 [(set_attr "type" "ibr")])
2173 (match_operator 1 "comparison_operator"
2174 [(zero_extract:DI (match_operand:DI 2 "register_operand" "")
2176 (match_operand:DI 3 "const_int_operand" ""))
2178 (label_ref (match_operand 0 "" ""))
2180 (clobber (match_operand:DI 4 "register_operand" ""))])]
2181 "INTVAL (operands[3]) != 0"
2183 (lshiftrt:DI (match_dup 2) (match_dup 3)))
2185 (if_then_else (match_op_dup 1
2186 [(zero_extract:DI (match_dup 4)
2190 (label_ref (match_dup 0))
2194 ;; The following are the corresponding floating-point insns. Recall
2195 ;; we need to have variants that expand the arguments from SF mode
2199 [(set (match_operand:DF 0 "register_operand" "=&f")
2200 (match_operator:DF 1 "alpha_comparison_operator"
2201 [(match_operand:DF 2 "reg_or_fp0_operand" "fG")
2202 (match_operand:DF 3 "reg_or_fp0_operand" "fG")]))]
2203 "TARGET_FP && alpha_tp == ALPHA_TP_INSN"
2204 "cmp%-%C1%' %R2,%R3,%0"
2205 [(set_attr "type" "fadd")
2206 (set_attr "trap" "yes")])
2209 [(set (match_operand:DF 0 "register_operand" "=f")
2210 (match_operator:DF 1 "alpha_comparison_operator"
2211 [(match_operand:DF 2 "reg_or_fp0_operand" "fG")
2212 (match_operand:DF 3 "reg_or_fp0_operand" "fG")]))]
2213 "TARGET_FP && alpha_tp != ALPHA_TP_INSN"
2214 "cmp%-%C1%' %R2,%R3,%0"
2215 [(set_attr "type" "fadd")
2216 (set_attr "trap" "yes")])
2219 [(set (match_operand:DF 0 "register_operand" "=f")
2220 (match_operator:DF 1 "alpha_comparison_operator"
2222 (match_operand:SF 2 "reg_or_fp0_operand" "fG"))
2223 (match_operand:DF 3 "reg_or_fp0_operand" "fG")]))]
2224 "TARGET_FP && alpha_tp != ALPHA_TP_INSN"
2225 "cmp%-%C1%' %R2,%R3,%0"
2226 [(set_attr "type" "fadd")
2227 (set_attr "trap" "yes")])
2230 [(set (match_operand:DF 0 "register_operand" "=f")
2231 (match_operator:DF 1 "alpha_comparison_operator"
2232 [(match_operand:DF 2 "reg_or_fp0_operand" "fG")
2234 (match_operand:SF 3 "reg_or_fp0_operand" "fG"))]))]
2235 "TARGET_FP && alpha_tp != ALPHA_TP_INSN"
2236 "cmp%-%C1%' %R2,%R3,%0"
2237 [(set_attr "type" "fadd")
2238 (set_attr "trap" "yes")])
2241 [(set (match_operand:DF 0 "register_operand" "=f")
2242 (match_operator:DF 1 "alpha_comparison_operator"
2244 (match_operand:SF 2 "reg_or_fp0_operand" "fG"))
2246 (match_operand:SF 3 "reg_or_fp0_operand" "fG"))]))]
2247 "TARGET_FP && alpha_tp != ALPHA_TP_INSN"
2248 "cmp%-%C1%' %R2,%R3,%0"
2249 [(set_attr "type" "fadd")
2250 (set_attr "trap" "yes")])
2253 [(set (match_operand:DF 0 "register_operand" "=&f,f")
2255 (match_operator 3 "signed_comparison_operator"
2256 [(match_operand:DF 4 "reg_or_fp0_operand" "fG,fG")
2257 (match_operand:DF 2 "fp0_operand" "G,G")])
2258 (match_operand:DF 1 "reg_or_fp0_operand" "fG,0")
2259 (match_operand:DF 5 "reg_or_fp0_operand" "0,fG")))]
2260 "TARGET_FP && alpha_tp == ALPHA_TP_INSN"
2263 fcmov%D3 %R4,%R5,%0"
2264 [(set_attr "type" "fadd")])
2267 [(set (match_operand:DF 0 "register_operand" "=f,f")
2269 (match_operator 3 "signed_comparison_operator"
2270 [(match_operand:DF 4 "reg_or_fp0_operand" "fG,fG")
2271 (match_operand:DF 2 "fp0_operand" "G,G")])
2272 (match_operand:DF 1 "reg_or_fp0_operand" "fG,0")
2273 (match_operand:DF 5 "reg_or_fp0_operand" "0,fG")))]
2274 "TARGET_FP && alpha_tp != ALPHA_TP_INSN"
2277 fcmov%D3 %R4,%R5,%0"
2278 [(set_attr "type" "fadd")])
2281 [(set (match_operand:SF 0 "register_operand" "=&f,f")
2283 (match_operator 3 "signed_comparison_operator"
2284 [(match_operand:DF 4 "reg_or_fp0_operand" "fG,fG")
2285 (match_operand:DF 2 "fp0_operand" "G,G")])
2286 (match_operand:SF 1 "reg_or_fp0_operand" "fG,0")
2287 (match_operand:SF 5 "reg_or_fp0_operand" "0,fG")))]
2288 "TARGET_FP && alpha_tp == ALPHA_TP_INSN"
2291 fcmov%D3 %R4,%R5,%0"
2292 [(set_attr "type" "fadd")])
2295 [(set (match_operand:SF 0 "register_operand" "=f,f")
2297 (match_operator 3 "signed_comparison_operator"
2298 [(match_operand:DF 4 "reg_or_fp0_operand" "fG,fG")
2299 (match_operand:DF 2 "fp0_operand" "G,G")])
2300 (match_operand:SF 1 "reg_or_fp0_operand" "fG,0")
2301 (match_operand:SF 5 "reg_or_fp0_operand" "0,fG")))]
2302 "TARGET_FP && alpha_tp != ALPHA_TP_INSN"
2305 fcmov%D3 %R4,%R5,%0"
2306 [(set_attr "type" "fadd")])
2309 [(set (match_operand:DF 0 "register_operand" "=f,f")
2311 (match_operator 3 "signed_comparison_operator"
2312 [(match_operand:DF 4 "reg_or_fp0_operand" "fG,fG")
2313 (match_operand:DF 2 "fp0_operand" "G,G")])
2314 (float_extend:DF (match_operand:SF 1 "reg_or_fp0_operand" "fG,0"))
2315 (match_operand:DF 5 "reg_or_fp0_operand" "0,fG")))]
2316 "TARGET_FP && alpha_tp != ALPHA_TP_INSN"
2319 fcmov%D3 %R4,%R5,%0"
2320 [(set_attr "type" "fadd")])
2323 [(set (match_operand:DF 0 "register_operand" "=f,f")
2325 (match_operator 3 "signed_comparison_operator"
2327 (match_operand:SF 4 "reg_or_fp0_operand" "fG,fG"))
2328 (match_operand:DF 2 "fp0_operand" "G,G")])
2329 (match_operand:DF 1 "reg_or_fp0_operand" "fG,0")
2330 (match_operand:DF 5 "reg_or_fp0_operand" "0,fG")))]
2331 "TARGET_FP && alpha_tp != ALPHA_TP_INSN"
2334 fcmov%D3 %R4,%R5,%0"
2335 [(set_attr "type" "fadd")])
2338 [(set (match_operand:SF 0 "register_operand" "=f,f")
2340 (match_operator 3 "signed_comparison_operator"
2342 (match_operand:SF 4 "reg_or_fp0_operand" "fG,fG"))
2343 (match_operand:DF 2 "fp0_operand" "G,G")])
2344 (match_operand:SF 1 "reg_or_fp0_operand" "fG,0")
2345 (match_operand:SF 5 "reg_or_fp0_operand" "0,fG")))]
2346 "TARGET_FP && alpha_tp != ALPHA_TP_INSN"
2349 fcmov%D3 %R4,%R5,%0"
2350 [(set_attr "type" "fadd")])
2353 [(set (match_operand:DF 0 "register_operand" "=f,f")
2355 (match_operator 3 "signed_comparison_operator"
2357 (match_operand:SF 4 "reg_or_fp0_operand" "fG,fG"))
2358 (match_operand:DF 2 "fp0_operand" "G,G")])
2359 (float_extend:DF (match_operand:SF 1 "reg_or_fp0_operand" "fG,0"))
2360 (match_operand:DF 5 "reg_or_fp0_operand" "0,fG")))]
2361 "TARGET_FP && alpha_tp != ALPHA_TP_INSN"
2364 fcmov%D3 %R4,%R5,%0"
2365 [(set_attr "type" "fadd")])
2367 (define_expand "maxdf3"
2369 (le:DF (match_operand:DF 1 "reg_or_fp0_operand" "")
2370 (match_operand:DF 2 "reg_or_fp0_operand" "")))
2371 (set (match_operand:DF 0 "register_operand" "")
2372 (if_then_else:DF (eq (match_dup 3) (match_dup 4))
2373 (match_dup 1) (match_dup 2)))]
2376 { operands[3] = gen_reg_rtx (DFmode);
2377 operands[4] = CONST0_RTX (DFmode);
2380 (define_expand "mindf3"
2382 (lt:DF (match_operand:DF 1 "reg_or_fp0_operand" "")
2383 (match_operand:DF 2 "reg_or_fp0_operand" "")))
2384 (set (match_operand:DF 0 "register_operand" "")
2385 (if_then_else:DF (ne (match_dup 3) (match_dup 4))
2386 (match_dup 1) (match_dup 2)))]
2389 { operands[3] = gen_reg_rtx (DFmode);
2390 operands[4] = CONST0_RTX (DFmode);
2393 (define_expand "maxsf3"
2395 (le:DF (float_extend:DF (match_operand:SF 1 "reg_or_fp0_operand" ""))
2396 (float_extend:DF (match_operand:SF 2 "reg_or_fp0_operand" ""))))
2397 (set (match_operand:SF 0 "register_operand" "")
2398 (if_then_else:SF (eq (match_dup 3) (match_dup 4))
2399 (match_dup 1) (match_dup 2)))]
2402 { operands[3] = gen_reg_rtx (DFmode);
2403 operands[4] = CONST0_RTX (DFmode);
2406 (define_expand "minsf3"
2408 (lt:DF (float_extend:DF (match_operand:SF 1 "reg_or_fp0_operand" ""))
2409 (float_extend:DF (match_operand:SF 2 "reg_or_fp0_operand" ""))))
2410 (set (match_operand:SF 0 "register_operand" "")
2411 (if_then_else:SF (ne (match_dup 3) (match_dup 4))
2412 (match_dup 1) (match_dup 2)))]
2415 { operands[3] = gen_reg_rtx (DFmode);
2416 operands[4] = CONST0_RTX (DFmode);
2422 (match_operator 1 "signed_comparison_operator"
2423 [(match_operand:DF 2 "reg_or_fp0_operand" "fG")
2424 (match_operand:DF 3 "fp0_operand" "G")])
2425 (label_ref (match_operand 0 "" ""))
2429 [(set_attr "type" "fbr")])
2434 (match_operator 1 "signed_comparison_operator"
2436 (match_operand:SF 2 "reg_or_fp0_operand" "fG"))
2437 (match_operand:DF 3 "fp0_operand" "G")])
2438 (label_ref (match_operand 0 "" ""))
2442 [(set_attr "type" "fbr")])
2444 ;; These are the main define_expand's used to make conditional branches
2447 (define_expand "cmpdf"
2448 [(set (cc0) (compare (match_operand:DF 0 "reg_or_fp0_operand" "")
2449 (match_operand:DF 1 "reg_or_fp0_operand" "")))]
2453 alpha_compare_op0 = operands[0];
2454 alpha_compare_op1 = operands[1];
2455 alpha_compare_fp_p = 1;
2459 (define_expand "cmpdi"
2460 [(set (cc0) (compare (match_operand:DI 0 "reg_or_0_operand" "")
2461 (match_operand:DI 1 "reg_or_8bit_operand" "")))]
2465 alpha_compare_op0 = operands[0];
2466 alpha_compare_op1 = operands[1];
2467 alpha_compare_fp_p = 0;
2471 (define_expand "beq"
2472 [(set (match_dup 1) (match_dup 2))
2474 (if_then_else (match_dup 3)
2475 (label_ref (match_operand 0 "" ""))
2480 enum machine_mode mode;
2481 enum rtx_code compare_code, branch_code;
2483 if (alpha_compare_fp_p)
2484 mode = DFmode, compare_code = EQ, branch_code = NE;
2487 mode = DImode, compare_code = MINUS, branch_code = EQ;
2488 if (GET_CODE (alpha_compare_op1) == CONST_INT)
2490 compare_code = PLUS;
2491 alpha_compare_op1 = GEN_INT (- INTVAL (alpha_compare_op1));
2495 operands[1] = gen_reg_rtx (mode);
2496 operands[2] = gen_rtx (compare_code, mode,
2497 alpha_compare_op0, alpha_compare_op1);
2498 operands[3] = gen_rtx (branch_code, VOIDmode,
2499 operands[1], CONST0_RTX (mode));
2502 (define_expand "bne"
2503 [(set (match_dup 1) (match_dup 2))
2505 (if_then_else (match_dup 3)
2506 (label_ref (match_operand 0 "" ""))
2511 enum machine_mode mode;
2512 enum rtx_code compare_code, branch_code;
2514 if (alpha_compare_fp_p)
2515 mode = DFmode, compare_code = EQ, branch_code = EQ;
2518 mode = DImode, compare_code = MINUS, branch_code = NE;
2519 if (GET_CODE (alpha_compare_op1) == CONST_INT)
2521 compare_code = PLUS;
2522 alpha_compare_op1 = GEN_INT (- INTVAL (alpha_compare_op1));
2526 operands[1] = gen_reg_rtx (mode);
2527 operands[2] = gen_rtx (compare_code, mode,
2528 alpha_compare_op0, alpha_compare_op1);
2529 operands[3] = gen_rtx (branch_code, VOIDmode,
2530 operands[1], CONST0_RTX (mode));
2533 (define_expand "blt"
2534 [(set (match_dup 1) (match_dup 2))
2536 (if_then_else (match_dup 3)
2537 (label_ref (match_operand 0 "" ""))
2542 enum machine_mode mode = alpha_compare_fp_p ? DFmode : DImode;
2543 operands[1] = gen_reg_rtx (mode);
2544 operands[2] = gen_rtx (LT, mode, alpha_compare_op0, alpha_compare_op1);
2545 operands[3] = gen_rtx (NE, VOIDmode, operands[1], CONST0_RTX (mode));
2548 (define_expand "ble"
2549 [(set (match_dup 1) (match_dup 2))
2551 (if_then_else (match_dup 3)
2552 (label_ref (match_operand 0 "" ""))
2557 enum machine_mode mode = alpha_compare_fp_p ? DFmode : DImode;
2558 operands[1] = gen_reg_rtx (mode);
2559 operands[2] = gen_rtx (LE, mode, alpha_compare_op0, alpha_compare_op1);
2560 operands[3] = gen_rtx (NE, VOIDmode, operands[1], CONST0_RTX (mode));
2563 (define_expand "bgt"
2564 [(set (match_dup 1) (match_dup 2))
2566 (if_then_else (match_dup 3)
2567 (label_ref (match_operand 0 "" ""))
2572 if (alpha_compare_fp_p)
2574 operands[1] = gen_reg_rtx (DFmode);
2575 operands[2] = gen_rtx (LT, DFmode, alpha_compare_op1, alpha_compare_op0);
2576 operands[3] = gen_rtx (NE, VOIDmode, operands[1], CONST0_RTX (DFmode));
2580 operands[1] = gen_reg_rtx (DImode);
2581 operands[2] = gen_rtx (LE, DImode, alpha_compare_op0, alpha_compare_op1);
2582 operands[3] = gen_rtx (EQ, VOIDmode, operands[1], const0_rtx);
2586 (define_expand "bge"
2587 [(set (match_dup 1) (match_dup 2))
2589 (if_then_else (match_dup 3)
2590 (label_ref (match_operand 0 "" ""))
2595 if (alpha_compare_fp_p)
2597 operands[1] = gen_reg_rtx (DFmode);
2598 operands[2] = gen_rtx (LE, DFmode, alpha_compare_op1, alpha_compare_op0);
2599 operands[3] = gen_rtx (NE, VOIDmode, operands[1], CONST0_RTX (DFmode));
2603 operands[1] = gen_reg_rtx (DImode);
2604 operands[2] = gen_rtx (LT, DImode, alpha_compare_op0, alpha_compare_op1);
2605 operands[3] = gen_rtx (EQ, VOIDmode, operands[1], const0_rtx);
2609 (define_expand "bltu"
2610 [(set (match_dup 1) (match_dup 2))
2612 (if_then_else (match_dup 3)
2613 (label_ref (match_operand 0 "" ""))
2618 operands[1] = gen_reg_rtx (DImode);
2619 operands[2] = gen_rtx (LTU, DImode, alpha_compare_op0, alpha_compare_op1);
2620 operands[3] = gen_rtx (NE, VOIDmode, operands[1], const0_rtx);
2623 (define_expand "bleu"
2624 [(set (match_dup 1) (match_dup 2))
2626 (if_then_else (match_dup 3)
2627 (label_ref (match_operand 0 "" ""))
2632 operands[1] = gen_reg_rtx (DImode);
2633 operands[2] = gen_rtx (LEU, DImode, alpha_compare_op0, alpha_compare_op1);
2634 operands[3] = gen_rtx (NE, VOIDmode, operands[1], const0_rtx);
2637 (define_expand "bgtu"
2638 [(set (match_dup 1) (match_dup 2))
2640 (if_then_else (match_dup 3)
2641 (label_ref (match_operand 0 "" ""))
2646 operands[1] = gen_reg_rtx (DImode);
2647 operands[2] = gen_rtx (LEU, DImode, alpha_compare_op0, alpha_compare_op1);
2648 operands[3] = gen_rtx (EQ, VOIDmode, operands[1], const0_rtx);
2651 (define_expand "bgeu"
2652 [(set (match_dup 1) (match_dup 2))
2654 (if_then_else (match_dup 3)
2655 (label_ref (match_operand 0 "" ""))
2660 operands[1] = gen_reg_rtx (DImode);
2661 operands[2] = gen_rtx (LTU, DImode, alpha_compare_op0, alpha_compare_op1);
2662 operands[3] = gen_rtx (EQ, VOIDmode, operands[1], const0_rtx);
2665 (define_expand "seq"
2666 [(set (match_operand:DI 0 "register_operand" "")
2671 if (alpha_compare_fp_p)
2674 operands[1] = gen_rtx (EQ, DImode, alpha_compare_op0, alpha_compare_op1);
2677 (define_expand "sne"
2678 [(set (match_operand:DI 0 "register_operand" "")
2680 (set (match_dup 0) (xor:DI (match_dup 0) (const_int 1)))]
2684 if (alpha_compare_fp_p)
2687 operands[1] = gen_rtx (EQ, DImode, alpha_compare_op0, alpha_compare_op1);
2690 (define_expand "slt"
2691 [(set (match_operand:DI 0 "register_operand" "")
2696 if (alpha_compare_fp_p)
2699 operands[1] = gen_rtx (LT, DImode, alpha_compare_op0, alpha_compare_op1);
2702 (define_expand "sle"
2703 [(set (match_operand:DI 0 "register_operand" "")
2708 if (alpha_compare_fp_p)
2711 operands[1] = gen_rtx (LE, DImode, alpha_compare_op0, alpha_compare_op1);
2714 (define_expand "sgt"
2715 [(set (match_operand:DI 0 "register_operand" "")
2720 if (alpha_compare_fp_p)
2723 operands[1] = gen_rtx (LT, DImode, force_reg (DImode, alpha_compare_op1),
2727 (define_expand "sge"
2728 [(set (match_operand:DI 0 "register_operand" "")
2733 if (alpha_compare_fp_p)
2736 operands[1] = gen_rtx (LE, DImode, force_reg (DImode, alpha_compare_op1),
2740 (define_expand "sltu"
2741 [(set (match_operand:DI 0 "register_operand" "")
2746 if (alpha_compare_fp_p)
2749 operands[1] = gen_rtx (LTU, DImode, alpha_compare_op0, alpha_compare_op1);
2752 (define_expand "sleu"
2753 [(set (match_operand:DI 0 "register_operand" "")
2758 if (alpha_compare_fp_p)
2761 operands[1] = gen_rtx (LEU, DImode, alpha_compare_op0, alpha_compare_op1);
2764 (define_expand "sgtu"
2765 [(set (match_operand:DI 0 "register_operand" "")
2770 if (alpha_compare_fp_p)
2773 operands[1] = gen_rtx (LTU, DImode, force_reg (DImode, alpha_compare_op1),
2777 (define_expand "sgeu"
2778 [(set (match_operand:DI 0 "register_operand" "")
2783 if (alpha_compare_fp_p)
2786 operands[1] = gen_rtx (LEU, DImode, force_reg (DImode, alpha_compare_op1),
2790 ;; These are the main define_expand's used to make conditional moves.
2792 (define_expand "movsicc"
2793 [(set (match_operand:SI 0 "register_operand" "")
2794 (if_then_else:DI (match_operand 1 "comparison_operator" "")
2795 (match_operand:SI 2 "reg_or_8bit_operand" "")
2796 (match_operand:SI 3 "reg_or_8bit_operand" "")))]
2800 if ((operands[1] = alpha_emit_conditional_move (operands[1], SImode)) == 0)
2804 (define_expand "movdicc"
2805 [(set (match_operand:DI 0 "register_operand" "")
2806 (if_then_else:DI (match_operand 1 "comparison_operator" "")
2807 (match_operand:DI 2 "reg_or_8bit_operand" "")
2808 (match_operand:DI 3 "reg_or_8bit_operand" "")))]
2812 if ((operands[1] = alpha_emit_conditional_move (operands[1], DImode)) == 0)
2816 (define_expand "movsfcc"
2817 [(set (match_operand:SF 0 "register_operand" "")
2818 (if_then_else:SF (match_operand 1 "comparison_operator" "")
2819 (match_operand:SF 2 "reg_or_8bit_operand" "")
2820 (match_operand:SF 3 "reg_or_8bit_operand" "")))]
2824 if ((operands[1] = alpha_emit_conditional_move (operands[1], SFmode)) == 0)
2828 (define_expand "movdfcc"
2829 [(set (match_operand:DF 0 "register_operand" "")
2830 (if_then_else:DF (match_operand 1 "comparison_operator" "")
2831 (match_operand:DF 2 "reg_or_8bit_operand" "")
2832 (match_operand:DF 3 "reg_or_8bit_operand" "")))]
2836 if ((operands[1] = alpha_emit_conditional_move (operands[1], DFmode)) == 0)
2840 ;; These define_split definitions are used in cases when comparisons have
2841 ;; not be stated in the correct way and we need to reverse the second
2842 ;; comparison. For example, x >= 7 has to be done as x < 6 with the
2843 ;; comparison that tests the result being reversed. We have one define_split
2844 ;; for each use of a comparison. They do not match valid insns and need
2845 ;; not generate valid insns.
2847 ;; We can also handle equality comparisons (and inequality comparisons in
2848 ;; cases where the resulting add cannot overflow) by doing an add followed by
2849 ;; a comparison with zero. This is faster since the addition takes one
2850 ;; less cycle than a compare when feeding into a conditional move.
2851 ;; For this case, we also have an SImode pattern since we can merge the add
2852 ;; and sign extend and the order doesn't matter.
2854 ;; We do not do this for floating-point, since it isn't clear how the "wrong"
2855 ;; operation could have been generated.
2858 [(set (match_operand:DI 0 "register_operand" "")
2860 (match_operator 1 "comparison_operator"
2861 [(match_operand:DI 2 "reg_or_0_operand" "")
2862 (match_operand:DI 3 "reg_or_cint_operand" "")])
2863 (match_operand:DI 4 "reg_or_cint_operand" "")
2864 (match_operand:DI 5 "reg_or_cint_operand" "")))
2865 (clobber (match_operand:DI 6 "register_operand" ""))]
2866 "operands[3] != const0_rtx"
2867 [(set (match_dup 6) (match_dup 7))
2869 (if_then_else:DI (match_dup 8) (match_dup 4) (match_dup 5)))]
2871 { enum rtx_code code = GET_CODE (operands[1]);
2872 int unsignedp = (code == GEU || code == LEU || code == GTU || code == LTU);
2874 /* If we are comparing for equality with a constant and that constant
2875 appears in the arm when the register equals the constant, use the
2876 register since that is more likely to match (and to produce better code
2879 if (code == EQ && GET_CODE (operands[3]) == CONST_INT
2880 && rtx_equal_p (operands[4], operands[3]))
2881 operands[4] = operands[2];
2883 else if (code == NE && GET_CODE (operands[3]) == CONST_INT
2884 && rtx_equal_p (operands[5], operands[3]))
2885 operands[5] = operands[2];
2887 if (code == NE || code == EQ
2888 || (extended_count (operands[2], DImode, unsignedp) >= 1
2889 && extended_count (operands[3], DImode, unsignedp) >= 1))
2891 if (GET_CODE (operands[3]) == CONST_INT)
2892 operands[7] = gen_rtx (PLUS, DImode, operands[2],
2893 GEN_INT (- INTVAL (operands[3])));
2895 operands[7] = gen_rtx (MINUS, DImode, operands[2], operands[3]);
2897 operands[8] = gen_rtx (code, VOIDmode, operands[6], const0_rtx);
2900 else if (code == EQ || code == LE || code == LT
2901 || code == LEU || code == LTU)
2903 operands[7] = gen_rtx (code, DImode, operands[2], operands[3]);
2904 operands[8] = gen_rtx (NE, VOIDmode, operands[6], const0_rtx);
2908 operands[7] = gen_rtx (reverse_condition (code), DImode, operands[2],
2910 operands[8] = gen_rtx (EQ, VOIDmode, operands[6], const0_rtx);
2915 [(set (match_operand:DI 0 "register_operand" "")
2917 (match_operator 1 "comparison_operator"
2918 [(match_operand:SI 2 "reg_or_0_operand" "")
2919 (match_operand:SI 3 "reg_or_cint_operand" "")])
2920 (match_operand:DI 4 "reg_or_8bit_operand" "")
2921 (match_operand:DI 5 "reg_or_8bit_operand" "")))
2922 (clobber (match_operand:DI 6 "register_operand" ""))]
2923 "operands[3] != const0_rtx
2924 && (GET_CODE (operands[1]) == EQ || GET_CODE (operands[1]) == NE)"
2925 [(set (match_dup 6) (match_dup 7))
2927 (if_then_else:DI (match_dup 8) (match_dup 4) (match_dup 5)))]
2929 { enum rtx_code code = GET_CODE (operands[1]);
2930 int unsignedp = (code == GEU || code == LEU || code == GTU || code == LTU);
2933 if ((code != NE && code != EQ
2934 && ! (extended_count (operands[2], DImode, unsignedp) >= 1
2935 && extended_count (operands[3], DImode, unsignedp) >= 1)))
2938 if (GET_CODE (operands[3]) == CONST_INT)
2939 tem = gen_rtx (PLUS, SImode, operands[2],
2940 GEN_INT (- INTVAL (operands[3])));
2942 tem = gen_rtx (MINUS, SImode, operands[2], operands[3]);
2944 operands[7] = gen_rtx (SIGN_EXTEND, DImode, tem);
2945 operands[8] = gen_rtx (GET_CODE (operands[1]), VOIDmode, operands[6],
2952 (match_operator 1 "comparison_operator"
2953 [(match_operand:DI 2 "reg_or_0_operand" "")
2954 (match_operand:DI 3 "reg_or_cint_operand" "")])
2955 (label_ref (match_operand 0 "" ""))
2957 (clobber (match_operand:DI 4 "register_operand" ""))]
2958 "operands[3] != const0_rtx"
2959 [(set (match_dup 4) (match_dup 5))
2960 (set (pc) (if_then_else (match_dup 6) (label_ref (match_dup 0)) (pc)))]
2962 { enum rtx_code code = GET_CODE (operands[1]);
2963 int unsignedp = (code == GEU || code == LEU || code == GTU || code == LTU);
2965 if (code == NE || code == EQ
2966 || (extended_count (operands[2], DImode, unsignedp) >= 1
2967 && extended_count (operands[3], DImode, unsignedp) >= 1))
2969 if (GET_CODE (operands[3]) == CONST_INT)
2970 operands[5] = gen_rtx (PLUS, DImode, operands[2],
2971 GEN_INT (- INTVAL (operands[3])));
2973 operands[5] = gen_rtx (MINUS, DImode, operands[2], operands[3]);
2975 operands[6] = gen_rtx (code, VOIDmode, operands[4], const0_rtx);
2978 else if (code == EQ || code == LE || code == LT
2979 || code == LEU || code == LTU)
2981 operands[5] = gen_rtx (code, DImode, operands[2], operands[3]);
2982 operands[6] = gen_rtx (NE, VOIDmode, operands[4], const0_rtx);
2986 operands[5] = gen_rtx (reverse_condition (code), DImode, operands[2],
2988 operands[6] = gen_rtx (EQ, VOIDmode, operands[4], const0_rtx);
2995 (match_operator 1 "comparison_operator"
2996 [(match_operand:SI 2 "reg_or_0_operand" "")
2997 (match_operand:SI 3 "const_int_operand" "")])
2998 (label_ref (match_operand 0 "" ""))
3000 (clobber (match_operand:DI 4 "register_operand" ""))]
3001 "operands[3] != const0_rtx
3002 && (GET_CODE (operands[1]) == EQ || GET_CODE (operands[1]) == NE)"
3003 [(set (match_dup 4) (match_dup 5))
3004 (set (pc) (if_then_else (match_dup 6) (label_ref (match_dup 0)) (pc)))]
3008 if (GET_CODE (operands[3]) == CONST_INT)
3009 tem = gen_rtx (PLUS, SImode, operands[2],
3010 GEN_INT (- INTVAL (operands[3])));
3012 tem = gen_rtx (MINUS, SImode, operands[2], operands[3]);
3014 operands[5] = gen_rtx (SIGN_EXTEND, DImode, tem);
3015 operands[6] = gen_rtx (GET_CODE (operands[1]), VOIDmode,
3016 operands[4], const0_rtx);
3019 ;; We can convert such things as "a > 0xffff" to "t = a & ~ 0xffff; t != 0".
3020 ;; This eliminates one, and sometimes two, insns when the AND can be done
3023 [(set (match_operand:DI 0 "register_operand" "")
3024 (match_operator 1 "comparison_operator"
3025 [(match_operand:DI 2 "register_operand" "")
3026 (match_operand:DI 3 "const_int_operand" "")]))
3027 (clobber (match_operand:DI 4 "register_operand" ""))]
3028 "exact_log2 (INTVAL (operands[3]) + 1) >= 0
3029 && (GET_CODE (operands[1]) == GTU
3030 || GET_CODE (operands[1]) == LEU
3031 || ((GET_CODE (operands[1]) == GT || GET_CODE (operands[1]) == LE)
3032 && extended_count (operands[2], DImode, 1) > 0))"
3033 [(set (match_dup 4) (and:DI (match_dup 2) (match_dup 5)))
3034 (set (match_dup 0) (match_dup 6))]
3037 operands[5] = GEN_INT (~ INTVAL (operands[3]));
3038 operands[6] = gen_rtx (((GET_CODE (operands[1]) == GTU
3039 || GET_CODE (operands[1]) == GT)
3041 DImode, operands[4], const0_rtx);
3044 ;; Here are the CALL and unconditional branch insns. Calls on NT and OSF
3045 ;; work differently, so we have different patterns for each.
3047 (define_expand "call"
3048 [(use (match_operand:DI 0 "" ""))
3049 (use (match_operand 1 "" ""))
3050 (use (match_operand 2 "" ""))
3051 (use (match_operand 3 "" ""))]
3054 { if (TARGET_WINDOWS_NT)
3055 emit_call_insn (gen_call_nt (operands[0], operands[1]));
3056 else if (TARGET_OPEN_VMS)
3057 emit_call_insn (gen_call_vms (operands[0], operands[2]));
3059 emit_call_insn (gen_call_osf (operands[0], operands[1]));
3064 (define_expand "call_osf"
3065 [(parallel [(call (mem:DI (match_operand 0 "" ""))
3066 (match_operand 1 "" ""))
3067 (clobber (reg:DI 27))
3068 (clobber (reg:DI 26))])]
3071 { if (GET_CODE (operands[0]) != MEM)
3074 operands[0] = XEXP (operands[0], 0);
3076 if (GET_CODE (operands[0]) != SYMBOL_REF
3077 && ! (GET_CODE (operands[0]) == REG && REGNO (operands[0]) == 27))
3079 rtx tem = gen_rtx (REG, DImode, 27);
3080 emit_move_insn (tem, operands[0]);
3085 (define_expand "call_nt"
3086 [(parallel [(call (mem:DI (match_operand:DI 0 "" ""))
3087 (match_operand 1 "" ""))
3088 (clobber (reg:DI 26))])]
3091 { if (GET_CODE (operands[0]) != MEM)
3093 operands[0] = XEXP (operands[0], 0);
3095 if (GET_CODE (operands[1]) != SYMBOL_REF
3096 && ! (GET_CODE (operands[1]) == REG && REGNO (operands[1]) == 27))
3098 rtx tem = gen_rtx (REG, DImode, 27);
3099 emit_move_insn (tem, operands[1]);
3105 ;; call openvms/alpha
3106 ;; op 0: symbol ref for called function
3107 ;; op 1: next_arg_reg (argument information value for R25)
3109 (define_expand "call_vms"
3110 [(parallel [(call (mem:DI (match_operand 0 "" ""))
3111 (match_operand 1 "" ""))
3115 (clobber (reg:DI 27))])]
3118 { if (GET_CODE (operands[0]) != MEM)
3121 operands[0] = XEXP (operands[0], 0);
3123 /* Always load AI with argument information, then handle symbolic and
3124 indirect call differently. Load RA and set operands[2] to PV in
3127 emit_move_insn (gen_rtx (REG, DImode, 25), operands[1]);
3128 if (GET_CODE (operands[0]) == SYMBOL_REF)
3130 extern char *savealloc ();
3131 char *symbol = XSTR (operands[0], 0);
3132 char *linksym = savealloc (strlen (symbol) + 5);
3135 alpha_need_linkage (symbol, 0);
3137 strcpy (linksym, symbol);
3138 strcat (linksym, \"..lk\");
3139 linkage = gen_rtx (SYMBOL_REF, Pmode, linksym);
3141 emit_move_insn (gen_rtx (REG, Pmode, 26), gen_rtx (MEM, Pmode, linkage));
3144 = validize_mem (gen_rtx (MEM, Pmode, plus_constant (linkage, 8)));
3148 emit_move_insn (gen_rtx (REG, Pmode, 26),
3149 gen_rtx (MEM, Pmode, plus_constant (operands[0], 8)));
3151 operands[2] = operands[0];
3156 (define_expand "call_value"
3157 [(use (match_operand 0 "" ""))
3158 (use (match_operand:DI 1 "" ""))
3159 (use (match_operand 2 "" ""))
3160 (use (match_operand 3 "" ""))
3161 (use (match_operand 4 "" ""))]
3164 { if (TARGET_WINDOWS_NT)
3165 emit_call_insn (gen_call_value_nt (operands[0], operands[1], operands[2]));
3166 else if (TARGET_OPEN_VMS)
3167 emit_call_insn (gen_call_value_vms (operands[0], operands[1],
3170 emit_call_insn (gen_call_value_osf (operands[0], operands[1],
3175 (define_expand "call_value_osf"
3176 [(parallel [(set (match_operand 0 "" "")
3177 (call (mem:DI (match_operand 1 "" ""))
3178 (match_operand 2 "" "")))
3179 (clobber (reg:DI 27))
3180 (clobber (reg:DI 26))])]
3183 { if (GET_CODE (operands[1]) != MEM)
3186 operands[1] = XEXP (operands[1], 0);
3188 if (GET_CODE (operands[1]) != SYMBOL_REF
3189 && ! (GET_CODE (operands[1]) == REG && REGNO (operands[1]) == 27))
3191 rtx tem = gen_rtx (REG, DImode, 27);
3192 emit_move_insn (tem, operands[1]);
3197 (define_expand "call_value_nt"
3198 [(parallel [(set (match_operand 0 "" "")
3199 (call (mem:DI (match_operand:DI 1 "" ""))
3200 (match_operand 2 "" "")))
3201 (clobber (reg:DI 26))])]
3204 { if (GET_CODE (operands[1]) != MEM)
3207 operands[1] = XEXP (operands[1], 0);
3208 if (GET_CODE (operands[1]) != SYMBOL_REF
3209 && ! (GET_CODE (operands[1]) == REG && REGNO (operands[1]) == 27))
3211 rtx tem = gen_rtx (REG, DImode, 27);
3212 emit_move_insn (tem, operands[1]);
3217 (define_expand "call_value_vms"
3218 [(parallel [(set (match_operand 0 "" "")
3219 (call (mem:DI (match_operand:DI 1 "" ""))
3220 (match_operand 2 "" "")))
3224 (clobber (reg:DI 27))])]
3227 { if (GET_CODE (operands[1]) != MEM)
3230 operands[1] = XEXP (operands[1], 0);
3232 /* Always load AI with argument information, then handle symbolic and
3233 indirect call differently. Load RA and set operands[3] to PV in
3236 emit_move_insn (gen_rtx (REG, DImode, 25), operands[2]);
3237 if (GET_CODE (operands[1]) == SYMBOL_REF)
3239 extern char *savealloc ();
3240 char *symbol = XSTR (operands[1], 0);
3241 char *linksym = savealloc (strlen (symbol) + 5);
3244 alpha_need_linkage (symbol, 0);
3245 strcpy (linksym, symbol);
3246 strcat (linksym, \"..lk\");
3247 linkage = gen_rtx (SYMBOL_REF, Pmode, linksym);
3249 emit_move_insn (gen_rtx (REG, Pmode, 26), gen_rtx (MEM, Pmode, linkage));
3252 = validize_mem (gen_rtx (MEM, Pmode, plus_constant (linkage, 8)));
3256 emit_move_insn (gen_rtx (REG, Pmode, 26),
3257 gen_rtx (MEM, Pmode, plus_constant (operands[1], 8)));
3259 operands[3] = operands[1];
3264 [(call (mem:DI (match_operand:DI 0 "call_operand" "r,R,i"))
3265 (match_operand 1 "" ""))
3266 (clobber (reg:DI 27))
3267 (clobber (reg:DI 26))]
3268 "! TARGET_WINDOWS_NT && ! TARGET_OPEN_VMS && alpha_tp == ALPHA_TP_INSN"
3270 jsr $26,($27),0\;trapb\;ldgp $29,4($26)
3271 bsr $26,%0..ng\;trapb
3272 jsr $26,%0\;trapb\;ldgp $29,4($26)"
3273 [(set_attr "type" "jsr,jsr,ibr")])
3276 [(call (mem:DI (match_operand:DI 0 "call_operand" "r,R,i"))
3277 (match_operand 1 "" ""))
3278 (clobber (reg:DI 27))
3279 (clobber (reg:DI 26))]
3280 "! TARGET_WINDOWS_NT && ! TARGET_OPEN_VMS"
3282 jsr $26,($27),0\;ldgp $29,0($26)
3284 jsr $26,%0\;ldgp $29,0($26)"
3285 [(set_attr "type" "jsr,jsr,ibr")])
3288 [(call (mem:DI (match_operand:DI 0 "call_operand" "r,i"))
3289 (match_operand 1 "" ""))
3290 (clobber (reg:DI 26))]
3295 [(set_attr "type" "jsr")])
3298 [(call (mem:DI (match_operand:DI 0 "call_operand" "r,i"))
3299 (match_operand 1 "" ""))
3300 (use (match_operand:DI 2 "general_operand" "r,m"))
3303 (clobber (reg:DI 27))]
3306 bis %2,%2,$27\;jsr $26,0\;ldq $27,0($29)
3307 ldq $27,%2\;jsr $26,%0\;ldq $27,0($29)"
3308 [(set_attr "type" "jsr")])
3311 [(set (match_operand 0 "register_operand" "=rf,rf,rf")
3312 (call (mem:DI (match_operand:DI 1 "call_operand" "r,R,i"))
3313 (match_operand 2 "" "")))
3314 (clobber (reg:DI 27))
3315 (clobber (reg:DI 26))]
3316 "! TARGET_WINDOWS_NT && ! TARGET_OPEN_VMS && alpha_tp == ALPHA_TP_INSN"
3318 jsr $26,($27),0\;trapb\;ldgp $29,4($26)
3319 bsr $26,%1..ng\;trapb
3320 jsr $26,%1\;trapb\;ldgp $29,4($26)"
3321 [(set_attr "type" "jsr,jsr,ibr")])
3324 [(set (match_operand 0 "register_operand" "=rf,rf,rf")
3325 (call (mem:DI (match_operand:DI 1 "call_operand" "r,R,i"))
3326 (match_operand 2 "" "")))
3327 (clobber (reg:DI 27))
3328 (clobber (reg:DI 26))]
3329 "! TARGET_WINDOWS_NT && ! TARGET_OPEN_VMS"
3331 jsr $26,($27),0\;ldgp $29,0($26)
3333 jsr $26,%1\;ldgp $29,0($26)"
3334 [(set_attr "type" "jsr,jsr,ibr")])
3337 [(set (match_operand 0 "register_operand" "=rf,rf")
3338 (call (mem:DI (match_operand:DI 1 "call_operand" "r,i"))
3339 (match_operand 2 "" "")))
3340 (clobber (reg:DI 26))]
3345 [(set_attr "type" "jsr")])
3348 [(set (match_operand 0 "register_operand" "")
3349 (call (mem:DI (match_operand:DI 1 "call_operand" "r,i"))
3350 (match_operand 2 "" "")))
3351 (use (match_operand:DI 3 "general_operand" "r,m"))
3354 (clobber (reg:DI 27))]
3357 bis %3,%3,$27\;jsr $26,0\;ldq $27,0($29)
3358 ldq $27,%3\;jsr $26,%1\;ldq $27,0($29)"
3359 [(set_attr "type" "jsr")])
3361 ;; Call subroutine returning any type.
3363 (define_expand "untyped_call"
3364 [(parallel [(call (match_operand 0 "" "")
3366 (match_operand 1 "" "")
3367 (match_operand 2 "" "")])]
3373 emit_call_insn (gen_call (operands[0], const0_rtx, NULL, const0_rtx));
3375 for (i = 0; i < XVECLEN (operands[2], 0); i++)
3377 rtx set = XVECEXP (operands[2], 0, i);
3378 emit_move_insn (SET_DEST (set), SET_SRC (set));
3381 /* The optimizer does not know that the call sets the function value
3382 registers we stored in the result block. We avoid problems by
3383 claiming that all hard registers are used and clobbered at this
3385 emit_insn (gen_blockage ());
3390 ;; UNSPEC_VOLATILE is considered to use and clobber all hard registers and
3391 ;; all of memory. This blocks insns from being moved across this point.
3393 (define_insn "blockage"
3394 [(unspec_volatile [(const_int 0)] 1)]
3400 (label_ref (match_operand 0 "" "")))]
3403 [(set_attr "type" "ibr")])
3405 (define_insn "return"
3409 [(set_attr "type" "ibr")])
3411 (define_insn "indirect_jump"
3412 [(set (pc) (match_operand:DI 0 "register_operand" "r"))]
3415 [(set_attr "type" "ibr")])
3421 [(set_attr "type" "ilog")])
3423 (define_expand "tablejump"
3424 [(use (match_operand:SI 0 "register_operand" ""))
3425 (use (match_operand:SI 1 "" ""))]
3429 if (TARGET_WINDOWS_NT)
3430 emit_jump_insn (gen_tablejump_nt (operands[0], operands[1]));
3431 else if (TARGET_OPEN_VMS)
3432 emit_jump_insn (gen_tablejump_vms (operands[0], operands[1]));
3434 emit_jump_insn (gen_tablejump_osf (operands[0], operands[1]));
3439 (define_expand "tablejump_osf"
3441 (sign_extend:DI (match_operand:SI 0 "register_operand" "")))
3442 (parallel [(set (pc)
3443 (plus:DI (match_dup 3)
3444 (label_ref:DI (match_operand 1 "" ""))))
3445 (clobber (match_scratch:DI 2 "=r"))])]
3448 { operands[3] = gen_reg_rtx (DImode); }")
3450 (define_expand "tablejump_nt"
3452 (sign_extend:DI (match_operand:SI 0 "register_operand" "")))
3453 (parallel [(set (pc)
3455 (use (label_ref (match_operand 1 "" "")))])]
3458 { operands[3] = gen_reg_rtx (DImode); }")
3461 ;; tablejump, openVMS way
3463 ;; op 1: label preceding jump-table
3465 (define_expand "tablejump_vms"
3467 (match_operand:DI 0 "register_operand" ""))
3469 (plus:DI (match_dup 2)
3470 (label_ref:DI (match_operand 1 "" ""))))]
3473 { operands[2] = gen_reg_rtx (DImode); }")
3477 (plus:DI (match_operand:DI 0 "register_operand" "r")
3478 (label_ref:DI (match_operand 1 "" ""))))
3479 (clobber (match_scratch:DI 2 "=r"))]
3480 "! TARGET_WINDOWS_NT && ! TARGET_OPEN_VMS && next_active_insn (insn) != 0
3481 && GET_CODE (PATTERN (next_active_insn (insn))) == ADDR_DIFF_VEC
3482 && PREV_INSN (next_active_insn (insn)) == operands[1]"
3484 { rtx best_label = 0;
3485 rtx jump_table_insn = next_active_insn (operands[1]);
3487 if (GET_CODE (jump_table_insn) == JUMP_INSN
3488 && GET_CODE (PATTERN (jump_table_insn)) == ADDR_DIFF_VEC)
3490 rtx jump_table = PATTERN (jump_table_insn);
3491 int n_labels = XVECLEN (jump_table, 1);
3492 int best_count = -1;
3495 for (i = 0; i < n_labels; i++)
3499 for (j = i + 1; j < n_labels; j++)
3500 if (XEXP (XVECEXP (jump_table, 1, i), 0)
3501 == XEXP (XVECEXP (jump_table, 1, j), 0))
3504 if (count > best_count)
3505 best_count = count, best_label = XVECEXP (jump_table, 1, i);
3511 operands[3] = best_label;
3512 return \"addq %0,$29,%2\;jmp $31,(%2),%3\";
3515 return \"addq %0,$29,%2\;jmp $31,(%2),0\";
3517 [(set_attr "type" "ibr")])
3521 (match_operand:DI 0 "register_operand" "r"))
3522 (use (label_ref (match_operand 1 "" "")))]
3523 "TARGET_WINDOWS_NT && next_active_insn (insn) != 0
3524 && GET_CODE (PATTERN (next_active_insn (insn))) == ADDR_DIFF_VEC
3525 && PREV_INSN (next_active_insn (insn)) == operands[1]"
3527 { rtx best_label = 0;
3528 rtx jump_table_insn = next_active_insn (operands[1]);
3530 if (GET_CODE (jump_table_insn) == JUMP_INSN
3531 && GET_CODE (PATTERN (jump_table_insn)) == ADDR_DIFF_VEC)
3533 rtx jump_table = PATTERN (jump_table_insn);
3534 int n_labels = XVECLEN (jump_table, 1);
3535 int best_count = -1;
3538 for (i = 0; i < n_labels; i++)
3542 for (j = i + 1; j < n_labels; j++)
3543 if (XEXP (XVECEXP (jump_table, 1, i), 0)
3544 == XEXP (XVECEXP (jump_table, 1, j), 0))
3547 if (count > best_count)
3548 best_count = count, best_label = XVECEXP (jump_table, 1, i);
3554 operands[2] = best_label;
3555 return \"jmp $31,(%0),%2\";
3558 return \"jmp $31,(%0),0\";
3560 [(set_attr "type" "ibr")])
3563 ;; op 0 is table offset
3564 ;; op 1 is table label
3569 (plus:DI (match_operand 0 "register_operand" "r")
3570 (label_ref (match_operand 1 "" ""))))]
3573 [(set_attr "type" "ibr")])
3575 ;; Cache flush. Used by INITIALIZE_TRAMPOLINE. 0x86 is PAL_imb, but we don't
3576 ;; want to have to include pal.h in our .s file.
3578 [(unspec_volatile [(const_int 0)] 0)]
3581 [(set_attr "type" "isubr")])
3583 ;; Finally, we have the basic data motion insns. The byte and word insns
3584 ;; are done via define_expand. Start with the floating-point insns, since
3585 ;; they are simpler.
3588 [(set (match_operand:SF 0 "nonimmediate_operand" "=r,r,m,f,f,f,m")
3589 (match_operand:SF 1 "input_operand" "rG,m,rG,f,G,m,fG"))]
3590 "register_operand (operands[0], SFmode)
3591 || reg_or_fp0_operand (operands[1], SFmode)"
3600 [(set_attr "type" "ilog,ld,st,fcpys,fcpys,ld,st")])
3603 [(set (match_operand:DF 0 "nonimmediate_operand" "=r,r,m,f,f,f,m")
3604 (match_operand:DF 1 "input_operand" "rG,m,rG,f,G,m,fG"))]
3605 "register_operand (operands[0], DFmode)
3606 || reg_or_fp0_operand (operands[1], DFmode)"
3615 [(set_attr "type" "ilog,ld,st,fcpys,fcpys,ld,st")])
3617 (define_expand "movsf"
3618 [(set (match_operand:SF 0 "nonimmediate_operand" "")
3619 (match_operand:SF 1 "general_operand" ""))]
3623 if (GET_CODE (operands[0]) == MEM
3624 && ! reg_or_fp0_operand (operands[1], SFmode))
3625 operands[1] = force_reg (SFmode, operands[1]);
3628 (define_expand "movdf"
3629 [(set (match_operand:DF 0 "nonimmediate_operand" "")
3630 (match_operand:DF 1 "general_operand" ""))]
3634 if (GET_CODE (operands[0]) == MEM
3635 && ! reg_or_fp0_operand (operands[1], DFmode))
3636 operands[1] = force_reg (DFmode, operands[1]);
3640 [(set (match_operand:SI 0 "nonimmediate_operand" "=r,r,r,r,r,r,m,f,f,f,m")
3641 (match_operand:SI 1 "input_operand" "r,J,I,K,L,m,rJ,f,J,m,fG"))]
3642 "! TARGET_WINDOWS_NT && ! TARGET_OPEN_VMS
3643 && (register_operand (operands[0], SImode)
3644 || reg_or_0_operand (operands[1], SImode))"
3657 [(set_attr "type" "ilog,ilog,ilog,iadd,iadd,ld,st,fcpys,fcpys,ld,st")])
3660 [(set (match_operand:SI 0 "nonimmediate_operand" "=r,r,r,r,r,r,r,m,f,f,f,m")
3661 (match_operand:SI 1 "input_operand" "r,J,I,K,L,s,m,rJ,f,J,m,fG"))]
3662 "(TARGET_WINDOWS_NT || TARGET_OPEN_VMS)
3663 && (register_operand (operands[0], SImode)
3664 || reg_or_0_operand (operands[1], SImode))"
3678 [(set_attr "type" "ilog,ilog,ilog,iadd,iadd,ldsym,ld,st,fcpys,fcpys,ld,st")])
3681 [(set (match_operand:HI 0 "nonimmediate_operand" "=r,r,r,r,f,f")
3682 (match_operand:HI 1 "input_operand" "r,J,I,n,f,J"))]
3684 && (register_operand (operands[0], HImode)
3685 || register_operand (operands[1], HImode))"
3693 [(set_attr "type" "ilog,ilog,ilog,iadd,fcpys,fcpys")])
3696 [(set (match_operand:HI 0 "nonimmediate_operand" "=r,r,r,r,r,m,f,f")
3697 (match_operand:HI 1 "input_operand" "r,J,I,n,m,rJ,f,J"))]
3699 && (register_operand (operands[0], HImode)
3700 || reg_or_0_operand (operands[1], HImode))"
3710 [(set_attr "type" "ilog,ilog,ilog,iadd,ld,st,fcpys,fcpys")])
3713 [(set (match_operand:QI 0 "nonimmediate_operand" "=r,r,r,r,f,f")
3714 (match_operand:QI 1 "input_operand" "r,J,I,n,f,J"))]
3716 && (register_operand (operands[0], QImode)
3717 || register_operand (operands[1], QImode))"
3725 [(set_attr "type" "ilog,ilog,ilog,iadd,fcpys,fcpys")])
3728 [(set (match_operand:QI 0 "nonimmediate_operand" "=r,r,r,r,r,m,f,f")
3729 (match_operand:QI 1 "input_operand" "r,J,I,n,m,rJ,f,J"))]
3731 && (register_operand (operands[0], QImode)
3732 || reg_or_0_operand (operands[1], QImode))"
3742 [(set_attr "type" "ilog,ilog,ilog,iadd,ld,st,fcpys,fcpys")])
3744 ;; We do two major things here: handle mem->mem and construct long
3747 (define_expand "movsi"
3748 [(set (match_operand:SI 0 "general_operand" "")
3749 (match_operand:SI 1 "general_operand" ""))]
3753 if (GET_CODE (operands[0]) == MEM
3754 && ! reg_or_0_operand (operands[1], SImode))
3755 operands[1] = force_reg (SImode, operands[1]);
3757 if (! CONSTANT_P (operands[1]) || input_operand (operands[1], SImode))
3759 else if (GET_CODE (operands[1]) == CONST_INT)
3762 = alpha_emit_set_const (operands[0], SImode, INTVAL (operands[1]), 3);
3763 if (rtx_equal_p (operands[0], operands[1]))
3768 ;; Split a load of a large constant into the appropriate two-insn
3772 [(set (match_operand:SI 0 "register_operand" "")
3773 (match_operand:SI 1 "const_int_operand" ""))]
3774 "! add_operand (operands[1], SImode)"
3775 [(set (match_dup 0) (match_dup 2))
3776 (set (match_dup 0) (plus:SI (match_dup 0) (match_dup 3)))]
3779 = alpha_emit_set_const (operands[0], SImode, INTVAL (operands[1]), 2);
3781 if (tem == operands[0])
3788 [(set (match_operand:DI 0 "general_operand" "=r,r,r,r,r,r,r,m,f,f,f,Q")
3789 (match_operand:DI 1 "input_operand" "r,J,I,K,L,s,m,rJ,f,J,Q,fG"))]
3790 "register_operand (operands[0], DImode)
3791 || reg_or_0_operand (operands[1], DImode)"
3805 [(set_attr "type" "ilog,ilog,ilog,iadd,iadd,ldsym,ld,st,fcpys,fcpys,ld,st")])
3807 ;; We do three major things here: handle mem->mem, put 64-bit constants in
3808 ;; memory, and construct long 32-bit constants.
3810 (define_expand "movdi"
3811 [(set (match_operand:DI 0 "general_operand" "")
3812 (match_operand:DI 1 "general_operand" ""))]
3818 if (GET_CODE (operands[0]) == MEM
3819 && ! reg_or_0_operand (operands[1], DImode))
3820 operands[1] = force_reg (DImode, operands[1]);
3822 if (! CONSTANT_P (operands[1]) || input_operand (operands[1], DImode))
3824 else if (GET_CODE (operands[1]) == CONST_INT
3825 && (tem = alpha_emit_set_const (operands[0], DImode,
3826 INTVAL (operands[1]), 3)) != 0)
3828 if (rtx_equal_p (tem, operands[0]))
3833 else if (TARGET_BUILD_CONSTANTS
3834 && GET_CODE (operands[1]) == CONST_INT)
3836 #if HOST_BITS_PER_WIDE_INT == 64
3837 tem = alpha_emit_set_long_const (operands[0], INTVAL (operands[1]));
3838 if (rtx_equal_p (tem, operands[0]))
3846 else if (CONSTANT_P (operands[1]))
3848 operands[1] = force_const_mem (DImode, operands[1]);
3849 if (reload_in_progress)
3851 emit_move_insn (operands[0], XEXP (operands[1], 0));
3852 operands[1] = copy_rtx (operands[1]);
3853 XEXP (operands[1], 0) = operands[0];
3856 operands[1] = validize_mem (operands[1]);
3862 ;; Split a load of a large constant into the appropriate two-insn
3866 [(set (match_operand:DI 0 "register_operand" "")
3867 (match_operand:DI 1 "const_int_operand" ""))]
3868 "! add_operand (operands[1], DImode)"
3869 [(set (match_dup 0) (match_dup 2))
3870 (set (match_dup 0) (plus:DI (match_dup 0) (match_dup 3)))]
3873 = alpha_emit_set_const (operands[0], DImode, INTVAL (operands[1]), 2);
3875 if (tem == operands[0])
3881 ;; These are the partial-word cases.
3883 ;; First we have the code to load an aligned word. Operand 0 is the register
3884 ;; in which to place the result. It's mode is QImode or HImode. Operand 1
3885 ;; is an SImode MEM at the low-order byte of the proper word. Operand 2 is the
3886 ;; number of bits within the word that the value is. Operand 3 is an SImode
3887 ;; scratch register. If operand 0 is a hard register, operand 3 may be the
3888 ;; same register. It is allowed to conflict with operand 1 as well.
3890 (define_expand "aligned_loadqi"
3891 [(set (match_operand:SI 3 "register_operand" "")
3892 (match_operand:SI 1 "memory_operand" ""))
3893 (set (subreg:DI (match_operand:QI 0 "register_operand" "") 0)
3894 (zero_extract:DI (subreg:DI (match_dup 3) 0)
3896 (match_operand:DI 2 "const_int_operand" "")))]
3901 (define_expand "aligned_loadhi"
3902 [(set (match_operand:SI 3 "register_operand" "")
3903 (match_operand:SI 1 "memory_operand" ""))
3904 (set (subreg:DI (match_operand:HI 0 "register_operand" "") 0)
3905 (zero_extract:DI (subreg:DI (match_dup 3) 0)
3907 (match_operand:DI 2 "const_int_operand" "")))]
3912 ;; Similar for unaligned loads, where we use the sequence from the
3913 ;; Alpha Architecture manual.
3915 ;; Operand 1 is the address. Operands 2 and 3 are temporaries, where
3916 ;; operand 3 can overlap the input and output registers.
3918 (define_expand "unaligned_loadqi"
3919 [(set (match_operand:DI 2 "register_operand" "")
3920 (mem:DI (and:DI (match_operand:DI 1 "address_operand" "")
3922 (set (match_operand:DI 3 "register_operand" "")
3924 (set (subreg:DI (match_operand:QI 0 "register_operand" "") 0)
3925 (zero_extract:DI (match_dup 2)
3927 (ashift:DI (match_dup 3) (const_int 3))))]
3931 (define_expand "unaligned_loadhi"
3932 [(set (match_operand:DI 2 "register_operand" "")
3933 (mem:DI (and:DI (match_operand:DI 1 "address_operand" "")
3935 (set (match_operand:DI 3 "register_operand" "")
3937 (set (subreg:DI (match_operand:QI 0 "register_operand" "") 0)
3938 (zero_extract:DI (match_dup 2)
3940 (ashift:DI (match_dup 3) (const_int 3))))]
3944 ;; Storing an aligned byte or word requires two temporaries. Operand 0 is the
3945 ;; aligned SImode MEM. Operand 1 is the register containing the
3946 ;; byte or word to store. Operand 2 is the number of bits within the word that
3947 ;; the value should be placed. Operands 3 and 4 are SImode temporaries.
3949 (define_expand "aligned_store"
3950 [(set (match_operand:SI 3 "register_operand" "")
3951 (match_operand:SI 0 "memory_operand" ""))
3952 (set (subreg:DI (match_dup 3) 0)
3953 (and:DI (subreg:DI (match_dup 3) 0) (match_dup 5)))
3954 (set (subreg:DI (match_operand:SI 4 "register_operand" "") 0)
3955 (ashift:DI (zero_extend:DI (match_operand 1 "register_operand" ""))
3956 (match_operand:DI 2 "const_int_operand" "")))
3957 (set (subreg:DI (match_dup 4) 0)
3958 (ior:DI (subreg:DI (match_dup 4) 0) (subreg:DI (match_dup 3) 0)))
3959 (set (match_dup 0) (match_dup 4))]
3962 { operands[5] = GEN_INT (~ (GET_MODE_MASK (GET_MODE (operands[1]))
3963 << INTVAL (operands[2])));
3966 ;; For the unaligned byte and halfword cases, we use code similar to that
3967 ;; in the ;; Architecture book, but reordered to lower the number of registers
3968 ;; required. Operand 0 is the address. Operand 1 is the data to store.
3969 ;; Operands 2, 3, and 4 are DImode temporaries, where operands 2 and 4 may
3970 ;; be the same temporary, if desired. If the address is in a register,
3971 ;; operand 2 can be that register.
3973 (define_expand "unaligned_storeqi"
3974 [(set (match_operand:DI 3 "register_operand" "")
3975 (mem:DI (and:DI (match_operand:DI 0 "address_operand" "")
3977 (set (match_operand:DI 2 "register_operand" "")
3980 (and:DI (not:DI (ashift:DI (const_int 255)
3981 (ashift:DI (match_dup 2) (const_int 3))))
3983 (set (match_operand:DI 4 "register_operand" "")
3984 (ashift:DI (zero_extend:DI (match_operand:QI 1 "register_operand" ""))
3985 (ashift:DI (match_dup 2) (const_int 3))))
3986 (set (match_dup 4) (ior:DI (match_dup 4) (match_dup 3)))
3987 (set (mem:DI (and:DI (match_dup 0) (const_int -8)))
3992 (define_expand "unaligned_storehi"
3993 [(set (match_operand:DI 3 "register_operand" "")
3994 (mem:DI (and:DI (match_operand:DI 0 "address_operand" "")
3996 (set (match_operand:DI 2 "register_operand" "")
3999 (and:DI (not:DI (ashift:DI (const_int 65535)
4000 (ashift:DI (match_dup 2) (const_int 3))))
4002 (set (match_operand:DI 4 "register_operand" "")
4003 (ashift:DI (zero_extend:DI (match_operand:HI 1 "register_operand" ""))
4004 (ashift:DI (match_dup 2) (const_int 3))))
4005 (set (match_dup 4) (ior:DI (match_dup 4) (match_dup 3)))
4006 (set (mem:DI (and:DI (match_dup 0) (const_int -8)))
4011 ;; Here are the define_expand's for QI and HI moves that use the above
4012 ;; patterns. We have the normal sets, plus the ones that need scratch
4013 ;; registers for reload.
4015 (define_expand "movqi"
4016 [(set (match_operand:QI 0 "general_operand" "")
4017 (match_operand:QI 1 "general_operand" ""))]
4020 { extern rtx get_unaligned_address ();
4022 if (TARGET_BYTE_OPS)
4024 if (GET_CODE (operands[0]) == MEM
4025 && ! reg_or_0_operand (operands[1], QImode))
4026 operands[1] = force_reg (QImode, operands[1]);
4028 if (GET_CODE (operands[1]) == CONST_INT
4029 && ! input_operand (operands[1], QImode))
4031 operands[1] = alpha_emit_set_const (operands[0], QImode,
4032 INTVAL (operands[1]), 3);
4034 if (rtx_equal_p (operands[0], operands[1]))
4041 /* If the output is not a register, the input must be. */
4042 if (GET_CODE (operands[0]) == MEM)
4043 operands[1] = force_reg (QImode, operands[1]);
4045 /* Handle four memory cases, unaligned and aligned for either the input
4046 or the output. The only case where we can be called during reload is
4047 for aligned loads; all other cases require temporaries. */
4049 if (GET_CODE (operands[1]) == MEM
4050 || (GET_CODE (operands[1]) == SUBREG
4051 && GET_CODE (SUBREG_REG (operands[1])) == MEM)
4052 || (reload_in_progress && GET_CODE (operands[1]) == REG
4053 && REGNO (operands[1]) >= FIRST_PSEUDO_REGISTER)
4054 || (reload_in_progress && GET_CODE (operands[1]) == SUBREG
4055 && GET_CODE (SUBREG_REG (operands[1])) == REG
4056 && REGNO (SUBREG_REG (operands[1])) >= FIRST_PSEUDO_REGISTER))
4058 if (aligned_memory_operand (operands[1], QImode))
4060 rtx aligned_mem, bitnum;
4061 rtx scratch = (reload_in_progress
4062 ? gen_rtx (REG, SImode, REGNO (operands[0]))
4063 : gen_reg_rtx (SImode));
4065 get_aligned_mem (operands[1], &aligned_mem, &bitnum);
4067 emit_insn (gen_aligned_loadqi (operands[0], aligned_mem, bitnum,
4072 /* Don't pass these as parameters since that makes the generated
4073 code depend on parameter evaluation order which will cause
4074 bootstrap failures. */
4076 rtx temp1 = gen_reg_rtx (DImode);
4077 rtx temp2 = gen_reg_rtx (DImode);
4079 = gen_unaligned_loadqi (operands[0],
4080 get_unaligned_address (operands[1], 0),
4083 alpha_set_memflags (seq, operands[1]);
4090 else if (GET_CODE (operands[0]) == MEM
4091 || (GET_CODE (operands[0]) == SUBREG
4092 && GET_CODE (SUBREG_REG (operands[0])) == MEM)
4093 || (reload_in_progress && GET_CODE (operands[0]) == REG
4094 && REGNO (operands[0]) >= FIRST_PSEUDO_REGISTER)
4095 || (reload_in_progress && GET_CODE (operands[0]) == SUBREG
4096 && GET_CODE (SUBREG_REG (operands[0])) == REG
4097 && REGNO (operands[0]) >= FIRST_PSEUDO_REGISTER))
4099 if (aligned_memory_operand (operands[0], QImode))
4101 rtx aligned_mem, bitnum;
4102 rtx temp1 = gen_reg_rtx (SImode);
4103 rtx temp2 = gen_reg_rtx (SImode);
4105 get_aligned_mem (operands[0], &aligned_mem, &bitnum);
4107 emit_insn (gen_aligned_store (aligned_mem, operands[1], bitnum,
4112 rtx temp1 = gen_reg_rtx (DImode);
4113 rtx temp2 = gen_reg_rtx (DImode);
4114 rtx temp3 = gen_reg_rtx (DImode);
4116 = gen_unaligned_storeqi (get_unaligned_address (operands[0], 0),
4117 operands[1], temp1, temp2, temp3);
4119 alpha_set_memflags (seq, operands[0]);
4127 (define_expand "movhi"
4128 [(set (match_operand:HI 0 "general_operand" "")
4129 (match_operand:HI 1 "general_operand" ""))]
4132 { extern rtx get_unaligned_address ();
4134 if (TARGET_BYTE_OPS)
4136 if (GET_CODE (operands[0]) == MEM
4137 && ! reg_or_0_operand (operands[1], HImode))
4138 operands[1] = force_reg (HImode, operands[1]);
4140 if (GET_CODE (operands[1]) == CONST_INT
4141 && ! input_operand (operands[1], HImode))
4143 operands[1] = alpha_emit_set_const (operands[0], HImode,
4144 INTVAL (operands[1]), 3);
4146 if (rtx_equal_p (operands[0], operands[1]))
4153 /* If the output is not a register, the input must be. */
4154 if (GET_CODE (operands[0]) == MEM)
4155 operands[1] = force_reg (HImode, operands[1]);
4157 /* Handle four memory cases, unaligned and aligned for either the input
4158 or the output. The only case where we can be called during reload is
4159 for aligned loads; all other cases require temporaries. */
4161 if (GET_CODE (operands[1]) == MEM
4162 || (GET_CODE (operands[1]) == SUBREG
4163 && GET_CODE (SUBREG_REG (operands[1])) == MEM)
4164 || (reload_in_progress && GET_CODE (operands[1]) == REG
4165 && REGNO (operands[1]) >= FIRST_PSEUDO_REGISTER)
4166 || (reload_in_progress && GET_CODE (operands[1]) == SUBREG
4167 && GET_CODE (SUBREG_REG (operands[1])) == REG
4168 && REGNO (SUBREG_REG (operands[1])) >= FIRST_PSEUDO_REGISTER))
4170 if (aligned_memory_operand (operands[1], HImode))
4172 rtx aligned_mem, bitnum;
4173 rtx scratch = (reload_in_progress
4174 ? gen_rtx (REG, SImode, REGNO (operands[0]))
4175 : gen_reg_rtx (SImode));
4177 get_aligned_mem (operands[1], &aligned_mem, &bitnum);
4179 emit_insn (gen_aligned_loadhi (operands[0], aligned_mem, bitnum,
4184 /* Don't pass these as parameters since that makes the generated
4185 code depend on parameter evaluation order which will cause
4186 bootstrap failures. */
4188 rtx temp1 = gen_reg_rtx (DImode);
4189 rtx temp2 = gen_reg_rtx (DImode);
4191 = gen_unaligned_loadhi (operands[0],
4192 get_unaligned_address (operands[1], 0),
4195 alpha_set_memflags (seq, operands[1]);
4202 else if (GET_CODE (operands[0]) == MEM
4203 || (GET_CODE (operands[0]) == SUBREG
4204 && GET_CODE (SUBREG_REG (operands[0])) == MEM)
4205 || (reload_in_progress && GET_CODE (operands[0]) == REG
4206 && REGNO (operands[0]) >= FIRST_PSEUDO_REGISTER)
4207 || (reload_in_progress && GET_CODE (operands[0]) == SUBREG
4208 && GET_CODE (SUBREG_REG (operands[0])) == REG
4209 && REGNO (operands[0]) >= FIRST_PSEUDO_REGISTER))
4211 if (aligned_memory_operand (operands[0], HImode))
4213 rtx aligned_mem, bitnum;
4214 rtx temp1 = gen_reg_rtx (SImode);
4215 rtx temp2 = gen_reg_rtx (SImode);
4217 get_aligned_mem (operands[0], &aligned_mem, &bitnum);
4219 emit_insn (gen_aligned_store (aligned_mem, operands[1], bitnum,
4224 rtx temp1 = gen_reg_rtx (DImode);
4225 rtx temp2 = gen_reg_rtx (DImode);
4226 rtx temp3 = gen_reg_rtx (DImode);
4228 = gen_unaligned_storehi (get_unaligned_address (operands[0], 0),
4229 operands[1], temp1, temp2, temp3);
4231 alpha_set_memflags (seq, operands[0]);
4240 ;; Here are the versions for reload. Note that in the unaligned cases
4241 ;; we know that the operand must not be a pseudo-register because stack
4242 ;; slots are always aligned references.
4244 (define_expand "reload_inqi"
4245 [(parallel [(match_operand:QI 0 "register_operand" "=r")
4246 (match_operand:QI 1 "unaligned_memory_operand" "m")
4247 (match_operand:TI 2 "register_operand" "=&r")])]
4250 { extern rtx get_unaligned_address ();
4251 rtx addr = get_unaligned_address (operands[1], 0);
4252 /* It is possible that one of the registers we got for operands[2]
4253 might coincide with that of operands[0] (which is why we made
4254 it TImode). Pick the other one to use as our scratch. */
4255 rtx scratch = gen_rtx (REG, DImode,
4256 REGNO (operands[0]) == REGNO (operands[2])
4257 ? REGNO (operands[2]) + 1 : REGNO (operands[2]));
4258 rtx seq = gen_unaligned_loadqi (operands[0], addr, scratch,
4259 gen_rtx (REG, DImode, REGNO (operands[0])));
4261 alpha_set_memflags (seq, operands[1]);
4266 (define_expand "reload_inhi"
4267 [(parallel [(match_operand:HI 0 "register_operand" "=r")
4268 (match_operand:HI 1 "unaligned_memory_operand" "m")
4269 (match_operand:TI 2 "register_operand" "=&r")])]
4272 { extern rtx get_unaligned_address ();
4273 rtx addr = get_unaligned_address (operands[1], 0);
4274 /* It is possible that one of the registers we got for operands[2]
4275 might coincide with that of operands[0] (which is why we made
4276 it TImode). Pick the other one to use as our scratch. */
4277 rtx scratch = gen_rtx (REG, DImode,
4278 REGNO (operands[0]) == REGNO (operands[2])
4279 ? REGNO (operands[2]) + 1 : REGNO (operands[2]));
4280 rtx seq = gen_unaligned_loadhi (operands[0], addr, scratch,
4281 gen_rtx (REG, DImode, REGNO (operands[0])));
4283 alpha_set_memflags (seq, operands[1]);
4288 (define_expand "reload_outqi"
4289 [(parallel [(match_operand:QI 0 "any_memory_operand" "=m")
4290 (match_operand:QI 1 "register_operand" "r")
4291 (match_operand:TI 2 "register_operand" "=&r")])]
4294 { extern rtx get_unaligned_address ();
4296 if (aligned_memory_operand (operands[0], QImode))
4298 rtx aligned_mem, bitnum;
4300 get_aligned_mem (operands[0], &aligned_mem, &bitnum);
4302 emit_insn (gen_aligned_store (aligned_mem, operands[1], bitnum,
4303 gen_rtx (REG, SImode, REGNO (operands[2])),
4304 gen_rtx (REG, SImode,
4305 REGNO (operands[2]) + 1)));
4309 rtx addr = get_unaligned_address (operands[0], 0);
4310 rtx scratch1 = gen_rtx (REG, DImode, REGNO (operands[2]));
4311 rtx scratch2 = gen_rtx (REG, DImode, REGNO (operands[2]) + 1);
4312 rtx scratch3 = scratch1;
4315 if (GET_CODE (addr) == REG)
4318 seq = gen_unaligned_storeqi (addr, operands[1], scratch1,
4319 scratch2, scratch3);
4320 alpha_set_memflags (seq, operands[0]);
4327 (define_expand "reload_outhi"
4328 [(parallel [(match_operand:HI 0 "any_memory_operand" "=m")
4329 (match_operand:HI 1 "register_operand" "r")
4330 (match_operand:TI 2 "register_operand" "=&r")])]
4333 { extern rtx get_unaligned_address ();
4335 if (aligned_memory_operand (operands[0], HImode))
4337 rtx aligned_mem, bitnum;
4339 get_aligned_mem (operands[0], &aligned_mem, &bitnum);
4341 emit_insn (gen_aligned_store (aligned_mem, operands[1], bitnum,
4342 gen_rtx (REG, SImode, REGNO (operands[2])),
4343 gen_rtx (REG, SImode,
4344 REGNO (operands[2]) + 1)));
4348 rtx addr = get_unaligned_address (operands[0], 0);
4349 rtx scratch1 = gen_rtx (REG, DImode, REGNO (operands[2]));
4350 rtx scratch2 = gen_rtx (REG, DImode, REGNO (operands[2]) + 1);
4351 rtx scratch3 = scratch1;
4354 if (GET_CODE (addr) == REG)
4357 seq = gen_unaligned_storehi (addr, operands[1], scratch1,
4358 scratch2, scratch3);
4359 alpha_set_memflags (seq, operands[0]);
4366 ;; Subroutine of stack space allocation. Perform a stack probe.
4367 (define_expand "probe_stack"
4368 [(set (match_dup 1) (match_operand:DI 0 "const_int_operand" ""))]
4372 operands[1] = gen_rtx (MEM, DImode, plus_constant (stack_pointer_rtx,
4373 INTVAL (operands[0])));
4374 MEM_VOLATILE_P (operands[1]) = 1;
4376 operands[0] = const0_rtx;
4379 ;; This is how we allocate stack space. If we are allocating a
4380 ;; constant amount of space and we know it is less than 4096
4381 ;; bytes, we need do nothing.
4383 ;; If it is more than 4096 bytes, we need to probe the stack
4385 (define_expand "allocate_stack"
4387 (plus:DI (reg:DI 30)
4388 (match_operand:DI 0 "reg_or_cint_operand" "")))]
4392 if (GET_CODE (operands[0]) == CONST_INT
4393 && INTVAL (operands[0]) < 32768)
4395 if (INTVAL (operands[0]) >= 4096)
4397 /* We do this the same way as in the prologue and generate explicit
4398 probes. Then we update the stack by the constant. */
4402 emit_insn (gen_probe_stack (GEN_INT (- probed)));
4403 while (probed + 8192 < INTVAL (operands[0]))
4404 emit_insn (gen_probe_stack (GEN_INT (- (probed += 8192))));
4406 if (probed + 4096 < INTVAL (operands[0]))
4407 emit_insn (gen_probe_stack (GEN_INT (- INTVAL(operands[0]))));
4410 operands[0] = GEN_INT (- INTVAL (operands[0]));
4415 rtx loop_label = gen_label_rtx ();
4416 rtx want = gen_reg_rtx (Pmode);
4417 rtx tmp = gen_reg_rtx (Pmode);
4420 emit_insn (gen_subdi3 (want, stack_pointer_rtx,
4421 force_reg (Pmode, operands[0])));
4422 emit_insn (gen_adddi3 (tmp, stack_pointer_rtx, GEN_INT (-4096)));
4424 if (GET_CODE (operands[0]) != CONST_INT)
4426 out_label = gen_label_rtx ();
4427 emit_insn (gen_cmpdi (want, tmp));
4428 emit_jump_insn (gen_bgeu (out_label));
4431 emit_label (loop_label);
4432 memref = gen_rtx (MEM, DImode, tmp);
4433 MEM_VOLATILE_P (memref) = 1;
4434 emit_move_insn (memref, const0_rtx);
4435 emit_insn (gen_adddi3 (tmp, tmp, GEN_INT(-8192)));
4436 emit_insn (gen_cmpdi (tmp, want));
4437 emit_jump_insn (gen_bgtu (loop_label));
4438 memref = gen_rtx (MEM, DImode, want);
4439 MEM_VOLATILE_P (memref) = 1;
4440 emit_move_insn (memref, const0_rtx);
4443 emit_label (out_label);
4445 emit_move_insn (stack_pointer_rtx, want);
4451 (define_insn "exception_receiver"
4452 [(unspec_volatile [(const_int 0)] 2)]
4453 "! TARGET_OPEN_VMS && ! TARGET_WINDOWS_NT"
4454 ".long 0xc3a00000\;ldgp $29,0($29)")
4456 (define_expand "nonlocal_goto_receiver"
4457 [(unspec_volatile [(const_int 0)] 1)
4458 (set (reg:DI 27) (mem:DI (reg:DI 29)))
4459 (unspec_volatile [(const_int 0)] 1)
4464 (define_insn "arg_home"
4465 [(unspec [(const_int 0)] 0)
4480 (clobber (mem:BLK (const_int 0)))
4481 (clobber (reg:DI 24))
4482 (clobber (reg:DI 25))
4483 (clobber (reg:DI 0))]
4485 "lda $0,ots$home_args\;ldq $0,8($0)\;jsr $0,ots$home_args")