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,imulh,fadd,fmul,fcpys,fdivs,fdivt,ldsym,isubr,misc"
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
45 ;; the address, BBOX, used for branches, EBOX, used for integer
46 ;; operations, and FBOX, used for FP operations.
48 ;; Memory delivers its result in three cycles.
49 (define_function_unit "ev4_abox" 1 0
50 (and (eq_attr "cpu" "ev4")
51 (eq_attr "type" "ld,ldsym,st"))
54 ;; Branches have no delay cost, but do tie up the unit for two cycles.
55 (define_function_unit "ev4_bbox" 1 1
56 (and (eq_attr "cpu" "ev4")
57 (eq_attr "type" "ibr,fbr,jsr"))
60 ;; Arithmetic insns are normally have their results available after
61 ;; two cycles. There are a number of exceptions. They are encoded in
62 ;; ADJUST_COST. Some of the other insns have similar exceptions.
64 (define_function_unit "ev4_ebox" 1 0
65 (and (eq_attr "cpu" "ev4")
66 (eq_attr "type" "iadd,ilog,shift,cmov,icmp"))
69 ;; These really don't take up the integer pipeline, but they do occupy
70 ;; IBOX1; we approximate here.
72 (define_function_unit "ev4_ebox" 1 0
73 (and (eq_attr "cpu" "ev4")
74 (eq_attr "type" "imull"))
77 (define_function_unit "ev4_ebox" 1 0
78 (and (eq_attr "cpu" "ev4")
79 (eq_attr "type" "imulq,imulh"))
82 (define_function_unit "ev4_imult" 1 0
83 (and (eq_attr "cpu" "ev4")
84 (eq_attr "type" "imull"))
87 (define_function_unit "ev4_imult" 1 0
88 (and (eq_attr "cpu" "ev4")
89 (eq_attr "type" "imulq,imulh"))
92 (define_function_unit "ev4_fbox" 1 0
93 (and (eq_attr "cpu" "ev4")
94 (eq_attr "type" "fadd,fmul,fcpys"))
97 (define_function_unit "ev4_fbox" 1 0
98 (and (eq_attr "cpu" "ev4")
99 (eq_attr "type" "fdivs"))
102 (define_function_unit "ev4_fbox" 1 0
103 (and (eq_attr "cpu" "ev4")
104 (eq_attr "type" "fdivt"))
107 (define_function_unit "ev4_divider" 1 0
108 (and (eq_attr "cpu" "ev4")
109 (eq_attr "type" "fdivs"))
112 (define_function_unit "ev4_divider" 1 0
113 (and (eq_attr "cpu" "ev4")
114 (eq_attr "type" "fdivt"))
117 ;; EV5 scheduling. EV5 can issue 4 insns per clock.
119 ;; EV5 has two asymetric integer units. Model this with ebox,e0,e1.
120 ;; Everything uses ebox, and those that require particular pipes grab
123 (define_function_unit "ev5_ebox" 2 0
124 (and (eq_attr "cpu" "ev5")
125 (eq_attr "type" "iadd,ilog,icmp,st,shift,imull,imulq,imulh"))
128 ;; Memory takes at least 2 clocks, and load cannot dual issue with stores.
129 (define_function_unit "ev5_ebox" 2 0
130 (and (eq_attr "cpu" "ev5")
131 (eq_attr "type" "ld,ldsym"))
134 (define_function_unit "ev5_e0" 1 0
135 (and (eq_attr "cpu" "ev5")
136 (eq_attr "type" "ld,ldsym"))
138 [(eq_attr "type" "st")])
140 ;; Conditional moves always take 2 ticks.
141 (define_function_unit "ev5_ebox" 2 0
142 (and (eq_attr "cpu" "ev5")
143 (eq_attr "type" "cmov"))
146 ;; Stores, shifts, and multiplies can only issue to E0
147 (define_function_unit "ev5_e0" 1 0
148 (and (eq_attr "cpu" "ev5")
149 (eq_attr "type" "st"))
152 ;; But shifts and multiplies don't conflict with loads.
153 (define_function_unit "ev5_e0" 1 0
154 (and (eq_attr "cpu" "ev5")
155 (eq_attr "type" "shift,imull,imulq,imulh"))
157 [(eq_attr "type" "st,shift,imull,imulq,imulh")])
159 ;; Branches can only issue to E1
160 (define_function_unit "ev5_e1" 1 0
161 (and (eq_attr "cpu" "ev5")
162 (eq_attr "type" "ibr,jsr"))
165 ;; Multiplies also use the integer multiplier.
166 (define_function_unit "ev5_imult" 1 0
167 (and (eq_attr "cpu" "ev5")
168 (eq_attr "type" "imull"))
171 (define_function_unit "ev5_imult" 1 0
172 (and (eq_attr "cpu" "ev5")
173 (eq_attr "type" "imulq"))
176 (define_function_unit "ev5_imult" 1 0
177 (and (eq_attr "cpu" "ev5")
178 (eq_attr "type" "imulh"))
181 ;; Similarly for the FPU we have two asymetric units. But fcpys can issue
182 ;; on either so we have to play the game again.
184 (define_function_unit "ev5_fpu" 2 0
185 (and (eq_attr "cpu" "ev5")
186 (eq_attr "type" "fadd,fmul,fcpys,fbr,fdivs,fdivt"))
189 ;; Multiplies (resp. adds) also use the fmul (resp. fadd) units.
190 (define_function_unit "ev5_fm" 1 0
191 (and (eq_attr "cpu" "ev5")
192 (eq_attr "type" "fmul"))
195 (define_function_unit "ev5_fa" 1 0
196 (and (eq_attr "cpu" "ev5")
197 (eq_attr "type" "fadd"))
200 (define_function_unit "ev5_fa" 1 0
201 (and (eq_attr "cpu" "ev5")
202 (eq_attr "type" "fbr"))
205 (define_function_unit "ev5_fa" 1 0
206 (and (eq_attr "cpu" "ev5")
207 (eq_attr "type" "fdivs"))
210 (define_function_unit "ev5_fa" 1 0
211 (and (eq_attr "cpu" "ev5")
212 (eq_attr "type" "fdivt"))
215 ;; First define the arithmetic insns. Note that the 32-bit forms also
218 ;; Note that we can do sign extensions in both FP and integer registers.
219 ;; However, the result must be in the same type of register as the input.
220 ;; The register preferencing code can't handle this case very well, so, for
221 ;; now, don't let the FP case show up here for preferencing. Also,
222 ;; sign-extends in FP registers take two instructions.
223 (define_insn "extendsidi2"
224 [(set (match_operand:DI 0 "register_operand" "=r,r,*f")
225 (sign_extend:DI (match_operand:SI 1 "nonimmediate_operand" "r,m,*f")))]
230 cvtql %1,%0\;cvtlq %0,%0"
231 [(set_attr "type" "iadd,ld,fadd")])
233 ;; Do addsi3 the way expand_binop would do if we didn't have one. This
234 ;; generates better code. We have the anonymous addsi3 pattern below in
235 ;; case combine wants to make it.
236 (define_expand "addsi3"
237 [(set (match_operand:SI 0 "register_operand" "")
238 (plus:SI (match_operand:SI 1 "reg_or_0_operand" "")
239 (match_operand:SI 2 "add_operand" "")))]
242 { emit_insn (gen_rtx (SET, VOIDmode, gen_lowpart (DImode, operands[0]),
243 gen_rtx (PLUS, DImode,
244 gen_lowpart (DImode, operands[1]),
245 gen_lowpart (DImode, operands[2]))));
250 [(set (match_operand:SI 0 "register_operand" "=r,r,r,r")
251 (plus:SI (match_operand:SI 1 "reg_or_0_operand" "%rJ,rJ,rJ,rJ")
252 (match_operand:SI 2 "add_operand" "rI,O,K,L")))]
261 [(set (match_operand:SI 0 "register_operand" "")
262 (plus:SI (match_operand:SI 1 "register_operand" "")
263 (match_operand:SI 2 "const_int_operand" "")))]
264 "! add_operand (operands[2], SImode)"
265 [(set (match_dup 0) (plus:SI (match_dup 1) (match_dup 3)))
266 (set (match_dup 0) (plus:SI (match_dup 0) (match_dup 4)))]
269 HOST_WIDE_INT val = INTVAL (operands[2]);
270 HOST_WIDE_INT low = (val & 0xffff) - 2 * (val & 0x8000);
271 HOST_WIDE_INT rest = val - low;
273 operands[3] = GEN_INT (rest);
274 operands[4] = GEN_INT (low);
278 [(set (match_operand:DI 0 "register_operand" "=r,r")
280 (plus:SI (match_operand:SI 1 "reg_or_0_operand" "%rJ,rJ")
281 (match_operand:SI 2 "sext_add_operand" "rI,O"))))]
288 [(set (match_operand:DI 0 "register_operand" "")
290 (plus:SI (match_operand:SI 1 "register_operand" "")
291 (match_operand:SI 2 "const_int_operand" ""))))
292 (clobber (match_operand:SI 3 "register_operand" ""))]
293 "! sext_add_operand (operands[2], SImode) && INTVAL (operands[2]) > 0
294 && INTVAL (operands[2]) % 4 == 0"
295 [(set (match_dup 3) (match_dup 4))
296 (set (match_dup 0) (sign_extend:DI (plus:SI (mult:SI (match_dup 3)
301 HOST_WIDE_INT val = INTVAL (operands[2]) / 4;
307 operands[4] = GEN_INT (val);
308 operands[5] = GEN_INT (mult);
312 [(set (match_operand:DI 0 "register_operand" "")
314 (plus:SI (match_operator:SI 1 "comparison_operator"
315 [(match_operand 2 "" "")
316 (match_operand 3 "" "")])
317 (match_operand:SI 4 "add_operand" ""))))
318 (clobber (match_operand:DI 5 "register_operand" ""))]
320 [(set (match_dup 5) (match_dup 6))
321 (set (match_dup 0) (sign_extend:DI (plus:SI (match_dup 7) (match_dup 4))))]
324 operands[6] = gen_rtx (GET_CODE (operands[1]), DImode,
325 operands[2], operands[3]);
326 operands[7] = gen_lowpart (SImode, operands[5]);
329 (define_insn "adddi3"
330 [(set (match_operand:DI 0 "register_operand" "=r,r,r,r")
331 (plus:DI (match_operand:DI 1 "reg_or_0_operand" "%rJ,rJ,rJ,rJ")
332 (match_operand:DI 2 "add_operand" "rI,O,K,L")))]
340 ;; Don't do this if we are adjusting SP since we don't want to do
343 [(set (match_operand:DI 0 "register_operand" "")
344 (plus:DI (match_operand:DI 1 "register_operand" "")
345 (match_operand:DI 2 "const_int_operand" "")))]
346 "! add_operand (operands[2], DImode)
347 && REGNO (operands[0]) != STACK_POINTER_REGNUM"
348 [(set (match_dup 0) (plus:DI (match_dup 1) (match_dup 3)))
349 (set (match_dup 0) (plus:DI (match_dup 0) (match_dup 4)))]
352 HOST_WIDE_INT val = INTVAL (operands[2]);
353 HOST_WIDE_INT low = (val & 0xffff) - 2 * (val & 0x8000);
354 HOST_WIDE_INT rest = val - low;
356 operands[3] = GEN_INT (rest);
357 operands[4] = GEN_INT (low);
361 [(set (match_operand:SI 0 "register_operand" "=r,r")
362 (plus:SI (mult:SI (match_operand:SI 1 "reg_or_0_operand" "rJ,rJ")
363 (match_operand:SI 2 "const48_operand" "I,I"))
364 (match_operand:SI 3 "sext_add_operand" "rI,O")))]
371 [(set (match_operand:DI 0 "register_operand" "=r,r")
373 (plus:SI (mult:SI (match_operand:SI 1 "reg_or_0_operand" "rJ,rJ")
374 (match_operand:SI 2 "const48_operand" "I,I"))
375 (match_operand:SI 3 "sext_add_operand" "rI,O"))))]
382 [(set (match_operand:DI 0 "register_operand" "")
384 (plus:SI (mult:SI (match_operator:SI 1 "comparison_operator"
385 [(match_operand 2 "" "")
386 (match_operand 3 "" "")])
387 (match_operand:SI 4 "const48_operand" ""))
388 (match_operand:SI 5 "add_operand" ""))))
389 (clobber (match_operand:DI 6 "register_operand" ""))]
391 [(set (match_dup 6) (match_dup 7))
393 (sign_extend:DI (plus:SI (mult:SI (match_dup 8) (match_dup 4))
397 operands[7] = gen_rtx (GET_CODE (operands[1]), DImode,
398 operands[2], operands[3]);
399 operands[8] = gen_lowpart (SImode, operands[6]);
403 [(set (match_operand:DI 0 "register_operand" "=r,r")
404 (plus:DI (mult:DI (match_operand:DI 1 "reg_or_0_operand" "rJ,rJ")
405 (match_operand:DI 2 "const48_operand" "I,I"))
406 (match_operand:DI 3 "reg_or_8bit_operand" "rI,O")))]
412 ;; These variants of the above insns can occur if the third operand
413 ;; is the frame pointer. This is a kludge, but there doesn't
414 ;; seem to be a way around it. Only recognize them while reloading.
417 [(set (match_operand:DI 0 "some_operand" "=&r")
418 (plus:DI (plus:DI (match_operand:DI 1 "some_operand" "r")
419 (match_operand:DI 2 "some_operand" "r"))
420 (match_operand:DI 3 "some_operand" "rIOKL")))]
425 [(set (match_operand:DI 0 "register_operand" "")
426 (plus:DI (plus:DI (match_operand:DI 1 "register_operand" "")
427 (match_operand:DI 2 "register_operand" ""))
428 (match_operand:DI 3 "add_operand" "")))]
430 [(set (match_dup 0) (plus:DI (match_dup 1) (match_dup 2)))
431 (set (match_dup 0) (plus:DI (match_dup 0) (match_dup 3)))]
435 [(set (match_operand:SI 0 "some_operand" "=&r")
436 (plus:SI (plus:SI (mult:SI (match_operand:SI 1 "some_operand" "rJ")
437 (match_operand:SI 2 "const48_operand" "I"))
438 (match_operand:SI 3 "some_operand" "r"))
439 (match_operand:SI 4 "some_operand" "rIOKL")))]
444 [(set (match_operand:SI 0 "register_operand" "r")
445 (plus:SI (plus:SI (mult:SI (match_operand:SI 1 "reg_or_0_operand" "")
446 (match_operand:SI 2 "const48_operand" ""))
447 (match_operand:SI 3 "register_operand" ""))
448 (match_operand:SI 4 "add_operand" "rIOKL")))]
451 (plus:SI (mult:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
452 (set (match_dup 0) (plus:SI (match_dup 0) (match_dup 4)))]
456 [(set (match_operand:DI 0 "some_operand" "=&r")
459 (mult:SI (match_operand:SI 1 "some_operand" "rJ")
460 (match_operand:SI 2 "const48_operand" "I"))
461 (match_operand:SI 3 "some_operand" "r"))
462 (match_operand:SI 4 "some_operand" "rIOKL"))))]
467 [(set (match_operand:DI 0 "register_operand" "")
470 (mult:SI (match_operand:SI 1 "reg_or_0_operand" "")
471 (match_operand:SI 2 "const48_operand" ""))
472 (match_operand:SI 3 "register_operand" ""))
473 (match_operand:SI 4 "add_operand" ""))))]
476 (plus:SI (mult:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
477 (set (match_dup 0) (sign_extend:DI (plus:SI (match_dup 5) (match_dup 4))))]
479 { operands[5] = gen_lowpart (SImode, operands[0]);
483 [(set (match_operand:DI 0 "some_operand" "=&r")
484 (plus:DI (plus:DI (mult:DI (match_operand:DI 1 "some_operand" "rJ")
485 (match_operand:DI 2 "const48_operand" "I"))
486 (match_operand:DI 3 "some_operand" "r"))
487 (match_operand:DI 4 "some_operand" "rIOKL")))]
492 [(set (match_operand:DI 0 "register_operand" "=")
493 (plus:DI (plus:DI (mult:DI (match_operand:DI 1 "reg_or_0_operand" "")
494 (match_operand:DI 2 "const48_operand" ""))
495 (match_operand:DI 3 "register_operand" ""))
496 (match_operand:DI 4 "add_operand" "")))]
499 (plus:DI (mult:DI (match_dup 1) (match_dup 2)) (match_dup 3)))
500 (set (match_dup 0) (plus:DI (match_dup 0) (match_dup 4)))]
503 (define_insn "negsi2"
504 [(set (match_operand:SI 0 "register_operand" "=r")
505 (neg:SI (match_operand:SI 1 "reg_or_8bit_operand" "rI")))]
510 [(set (match_operand:DI 0 "register_operand" "=r")
511 (sign_extend:DI (neg:SI
512 (match_operand:SI 1 "reg_or_8bit_operand" "rI"))))]
516 (define_insn "negdi2"
517 [(set (match_operand:DI 0 "register_operand" "=r")
518 (neg:DI (match_operand:DI 1 "reg_or_8bit_operand" "rI")))]
522 (define_expand "subsi3"
523 [(set (match_operand:SI 0 "register_operand" "")
524 (minus:SI (match_operand:SI 1 "reg_or_0_operand" "")
525 (match_operand:SI 2 "reg_or_8bit_operand" "")))]
528 { emit_insn (gen_rtx (SET, VOIDmode, gen_lowpart (DImode, operands[0]),
529 gen_rtx (MINUS, DImode,
530 gen_lowpart (DImode, operands[1]),
531 gen_lowpart (DImode, operands[2]))));
537 [(set (match_operand:SI 0 "register_operand" "=r")
538 (minus:SI (match_operand:SI 1 "reg_or_0_operand" "rJ")
539 (match_operand:SI 2 "reg_or_8bit_operand" "rI")))]
544 [(set (match_operand:DI 0 "register_operand" "=r")
545 (sign_extend:DI (minus:SI (match_operand:SI 1 "reg_or_0_operand" "rJ")
546 (match_operand:SI 2 "reg_or_8bit_operand" "rI"))))]
550 (define_insn "subdi3"
551 [(set (match_operand:DI 0 "register_operand" "=r")
552 (minus:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
553 (match_operand:DI 2 "reg_or_8bit_operand" "rI")))]
558 [(set (match_operand:SI 0 "register_operand" "=r")
559 (minus:SI (mult:SI (match_operand:SI 1 "reg_or_0_operand" "rJ")
560 (match_operand:SI 2 "const48_operand" "I"))
561 (match_operand:SI 3 "reg_or_8bit_operand" "rI")))]
566 [(set (match_operand:DI 0 "register_operand" "=r")
568 (minus:SI (mult:SI (match_operand:SI 1 "reg_or_0_operand" "rJ")
569 (match_operand:SI 2 "const48_operand" "I"))
570 (match_operand:SI 3 "reg_or_8bit_operand" "rI"))))]
575 [(set (match_operand:DI 0 "register_operand" "=r")
576 (minus:DI (mult:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
577 (match_operand:DI 2 "const48_operand" "I"))
578 (match_operand:DI 3 "reg_or_8bit_operand" "rI")))]
582 (define_insn "mulsi3"
583 [(set (match_operand:SI 0 "register_operand" "=r")
584 (mult:SI (match_operand:SI 1 "reg_or_0_operand" "%rJ")
585 (match_operand:SI 2 "reg_or_0_operand" "rJ")))]
588 [(set_attr "type" "imull")])
591 [(set (match_operand:DI 0 "register_operand" "=r")
592 (sign_extend:DI (mult:SI (match_operand:SI 1 "reg_or_0_operand" "%rJ")
593 (match_operand:SI 2 "reg_or_0_operand" "rJ"))))]
596 [(set_attr "type" "imull")])
598 (define_insn "muldi3"
599 [(set (match_operand:DI 0 "register_operand" "=r")
600 (mult:DI (match_operand:DI 1 "reg_or_0_operand" "%rJ")
601 (match_operand:DI 2 "reg_or_0_operand" "rJ")))]
604 [(set_attr "type" "imulq")])
606 (define_insn "umuldi3_highpart"
607 [(set (match_operand:DI 0 "register_operand" "=r")
610 (mult:TI (zero_extend:TI (match_operand:DI 1 "register_operand" "r"))
611 (zero_extend:TI (match_operand:DI 2 "register_operand" "r")))
615 [(set_attr "type" "imulh")])
618 [(set (match_operand:DI 0 "register_operand" "=r")
621 (mult:TI (zero_extend:TI (match_operand:DI 1 "register_operand" "r"))
622 (match_operand:TI 2 "cint8_operand" "I"))
626 [(set_attr "type" "imulh")])
628 ;; The divide and remainder operations always take their inputs from
629 ;; r24 and r25, put their output in r27, and clobber r23 and r28.
631 ;; ??? comment out the divsi routines since the library functions
632 ;; don't seem to do the right thing with the high 32-bits of a
635 ;(define_expand "divsi3"
636 ; [(set (reg:SI 24) (match_operand:SI 1 "input_operand" ""))
637 ; (set (reg:SI 25) (match_operand:SI 2 "input_operand" ""))
638 ; (parallel [(set (reg:SI 27)
639 ; (div:SI (reg:SI 24)
641 ; (clobber (reg:DI 23))
642 ; (clobber (reg:DI 28))])
643 ; (set (match_operand:SI 0 "general_operand" "")
648 ;(define_expand "udivsi3"
649 ; [(set (reg:SI 24) (match_operand:SI 1 "input_operand" ""))
650 ; (set (reg:SI 25) (match_operand:SI 2 "input_operand" ""))
651 ; (parallel [(set (reg:SI 27)
652 ; (udiv:SI (reg:SI 24)
654 ; (clobber (reg:DI 23))
655 ; (clobber (reg:DI 28))])
656 ; (set (match_operand:SI 0 "general_operand" "")
661 ;(define_expand "modsi3"
662 ; [(set (reg:SI 24) (match_operand:SI 1 "input_operand" ""))
663 ; (set (reg:SI 25) (match_operand:SI 2 "input_operand" ""))
664 ; (parallel [(set (reg:SI 27)
665 ; (mod:SI (reg:SI 24)
667 ; (clobber (reg:DI 23))
668 ; (clobber (reg:DI 28))])
669 ; (set (match_operand:SI 0 "general_operand" "")
674 ;(define_expand "umodsi3"
675 ; [(set (reg:SI 24) (match_operand:SI 1 "input_operand" ""))
676 ; (set (reg:SI 25) (match_operand:SI 2 "input_operand" ""))
677 ; (parallel [(set (reg:SI 27)
678 ; (umod:SI (reg:SI 24)
680 ; (clobber (reg:DI 23))
681 ; (clobber (reg:DI 28))])
682 ; (set (match_operand:SI 0 "general_operand" "")
687 (define_expand "divdi3"
688 [(set (reg:DI 24) (match_operand:DI 1 "input_operand" ""))
689 (set (reg:DI 25) (match_operand:DI 2 "input_operand" ""))
690 (parallel [(set (reg:DI 27)
693 (clobber (reg:DI 23))
694 (clobber (reg:DI 28))])
695 (set (match_operand:DI 0 "general_operand" "")
700 (define_expand "udivdi3"
701 [(set (reg:DI 24) (match_operand:DI 1 "input_operand" ""))
702 (set (reg:DI 25) (match_operand:DI 2 "input_operand" ""))
703 (parallel [(set (reg:DI 27)
706 (clobber (reg:DI 23))
707 (clobber (reg:DI 28))])
708 (set (match_operand:DI 0 "general_operand" "")
713 (define_expand "moddi3"
714 [(set (reg:DI 24) (match_operand:DI 1 "input_operand" ""))
715 (set (reg:DI 25) (match_operand:DI 2 "input_operand" ""))
716 (parallel [(set (reg:DI 27)
719 (clobber (reg:DI 23))
720 (clobber (reg:DI 28))])
721 (set (match_operand:DI 0 "general_operand" "")
726 (define_expand "umoddi3"
727 [(set (reg:DI 24) (match_operand:DI 1 "input_operand" ""))
728 (set (reg:DI 25) (match_operand:DI 2 "input_operand" ""))
729 (parallel [(set (reg:DI 27)
732 (clobber (reg:DI 23))
733 (clobber (reg:DI 28))])
734 (set (match_operand:DI 0 "general_operand" "")
741 ; (match_operator:SI 1 "divmod_operator"
742 ; [(reg:SI 24) (reg:SI 25)]))
743 ; (clobber (reg:DI 23))
744 ; (clobber (reg:DI 28))]
747 ; [(set_attr "type" "isubr")])
751 (match_operator:DI 1 "divmod_operator"
752 [(reg:DI 24) (reg:DI 25)]))
753 (clobber (reg:DI 23))
754 (clobber (reg:DI 28))]
757 [(set_attr "type" "isubr")])
759 ;; Next are the basic logical operations. These only exist in DImode.
761 (define_insn "anddi3"
762 [(set (match_operand:DI 0 "register_operand" "=r,r,r")
763 (and:DI (match_operand:DI 1 "reg_or_0_operand" "%rJ,rJ,rJ")
764 (match_operand:DI 2 "and_operand" "rI,N,MH")))]
770 [(set_attr "type" "ilog,ilog,shift")])
772 ;; There are times when we can split an AND into two AND insns. This occurs
773 ;; when we can first clear any bytes and then clear anything else. For
774 ;; example "I & 0xffff07" is "(I & 0xffffff) & 0xffffffffffffff07".
775 ;; Only do this when running on 64-bit host since the computations are
776 ;; too messy otherwise.
779 [(set (match_operand:DI 0 "register_operand" "")
780 (and:DI (match_operand:DI 1 "register_operand" "")
781 (match_operand:DI 2 "const_int_operand" "")))]
782 "HOST_BITS_PER_WIDE_INT == 64 && ! and_operand (operands[2], DImode)"
783 [(set (match_dup 0) (and:DI (match_dup 1) (match_dup 3)))
784 (set (match_dup 0) (and:DI (match_dup 0) (match_dup 4)))]
787 unsigned HOST_WIDE_INT mask1 = INTVAL (operands[2]);
788 unsigned HOST_WIDE_INT mask2 = mask1;
791 /* For each byte that isn't all zeros, make it all ones. */
792 for (i = 0; i < 64; i += 8)
793 if ((mask1 & ((HOST_WIDE_INT) 0xff << i)) != 0)
794 mask1 |= (HOST_WIDE_INT) 0xff << i;
796 /* Now turn on any bits we've just turned off. */
799 operands[3] = GEN_INT (mask1);
800 operands[4] = GEN_INT (mask2);
803 (define_insn "zero_extendqihi2"
804 [(set (match_operand:HI 0 "register_operand" "=r")
805 (zero_extend:HI (match_operand:QI 1 "register_operand" "r")))]
808 [(set_attr "type" "shift")])
811 [(set (match_operand:SI 0 "register_operand" "=r,r")
812 (zero_extend:SI (match_operand:QI 1 "nonimmediate_operand" "r,m")))]
817 [(set_attr "type" "shift,ld")])
820 [(set (match_operand:SI 0 "register_operand" "=r")
821 (zero_extend:SI (match_operand:QI 1 "register_operand" "r")))]
824 [(set_attr "type" "shift")])
826 (define_expand "zero_extendqisi2"
827 [(set (match_operand:SI 0 "register_operand" "")
828 (zero_extend:SI (match_operand:QI 1 "register_operand" "")))]
833 [(set (match_operand:DI 0 "register_operand" "=r,r")
834 (zero_extend:DI (match_operand:QI 1 "nonimmediate_operand" "r,m")))]
839 [(set_attr "type" "shift,ld")])
842 [(set (match_operand:DI 0 "register_operand" "=r")
843 (zero_extend:DI (match_operand:QI 1 "register_operand" "r")))]
846 [(set_attr "type" "shift")])
848 (define_expand "zero_extendqidi2"
849 [(set (match_operand:DI 0 "register_operand" "")
850 (zero_extend:DI (match_operand:QI 1 "register_operand" "")))]
855 [(set (match_operand:SI 0 "register_operand" "=r,r")
856 (zero_extend:SI (match_operand:HI 1 "nonimmediate_operand" "r,m")))]
861 [(set_attr "type" "shift,ld")])
864 [(set (match_operand:SI 0 "register_operand" "=r")
865 (zero_extend:SI (match_operand:HI 1 "register_operand" "r")))]
868 [(set_attr "type" "shift")])
870 (define_expand "zero_extendhisi2"
871 [(set (match_operand:SI 0 "register_operand" "")
872 (zero_extend:SI (match_operand:HI 1 "register_operand" "")))]
877 [(set (match_operand:DI 0 "register_operand" "=r,r")
878 (zero_extend:DI (match_operand:HI 1 "nonimmediate_operand" "r,m")))]
883 [(set_attr "type" "shift,ld")])
886 [(set (match_operand:DI 0 "register_operand" "=r")
887 (zero_extend:DI (match_operand:HI 1 "register_operand" "r")))]
890 [(set_attr "type" "shift")])
892 (define_expand "zero_extendhidi2"
893 [(set (match_operand:DI 0 "register_operand" "")
894 (zero_extend:DI (match_operand:HI 1 "register_operand" "")))]
898 (define_insn "zero_extendsidi2"
899 [(set (match_operand:DI 0 "register_operand" "=r")
900 (zero_extend:DI (match_operand:SI 1 "register_operand" "r")))]
903 [(set_attr "type" "shift")])
906 [(set (match_operand:DI 0 "register_operand" "=r")
907 (and:DI (not:DI (match_operand:DI 1 "reg_or_8bit_operand" "rI"))
908 (match_operand:DI 2 "reg_or_0_operand" "rJ")))]
911 [(set_attr "type" "ilog")])
913 (define_insn "iordi3"
914 [(set (match_operand:DI 0 "register_operand" "=r,r")
915 (ior:DI (match_operand:DI 1 "reg_or_0_operand" "%rJ,rJ")
916 (match_operand:DI 2 "or_operand" "rI,N")))]
921 [(set_attr "type" "ilog")])
923 (define_insn "one_cmpldi2"
924 [(set (match_operand:DI 0 "register_operand" "=r")
925 (not:DI (match_operand:DI 1 "reg_or_8bit_operand" "rI")))]
928 [(set_attr "type" "ilog")])
931 [(set (match_operand:DI 0 "register_operand" "=r")
932 (ior:DI (not:DI (match_operand:DI 1 "reg_or_8bit_operand" "rI"))
933 (match_operand:DI 2 "reg_or_0_operand" "rJ")))]
936 [(set_attr "type" "ilog")])
938 (define_insn "xordi3"
939 [(set (match_operand:DI 0 "register_operand" "=r,r")
940 (xor:DI (match_operand:DI 1 "reg_or_0_operand" "%rJ,rJ")
941 (match_operand:DI 2 "or_operand" "rI,N")))]
946 [(set_attr "type" "ilog")])
949 [(set (match_operand:DI 0 "register_operand" "=r")
950 (not:DI (xor:DI (match_operand:DI 1 "register_operand" "%rJ")
951 (match_operand:DI 2 "register_operand" "rI"))))]
954 [(set_attr "type" "ilog")])
956 ;; Next come the shifts and the various extract and insert operations.
958 (define_insn "ashldi3"
959 [(set (match_operand:DI 0 "register_operand" "=r,r")
960 (ashift:DI (match_operand:DI 1 "reg_or_0_operand" "rJ,rJ")
961 (match_operand:DI 2 "reg_or_6bit_operand" "P,rI")))]
965 switch (which_alternative)
968 if (operands[2] == const1_rtx)
969 return \"addq %r1,%r1,%0\";
971 return \"s%P2addq %r1,0,%0\";
973 return \"sll %r1,%2,%0\";
976 [(set_attr "type" "iadd,shift")])
978 ;; ??? The following pattern is made by combine, but earlier phases
979 ;; (specifically flow) can't handle it. This occurs in jump.c. Deal
980 ;; with this in a better way at some point.
982 ;; [(set (match_operand:DI 0 "register_operand" "=r")
984 ;; (subreg:SI (ashift:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
985 ;; (match_operand:DI 2 "const_int_operand" "P"))
987 ;; "INTVAL (operands[2]) >= 1 && INTVAL (operands[2]) <= 3"
990 ;; if (operands[2] == const1_rtx)
991 ;; return \"addl %r1,%r1,%0\";
993 ;; return \"s%P2addl %r1,0,%0\";
995 ;; [(set_attr "type" "iadd")])
997 (define_insn "lshrdi3"
998 [(set (match_operand:DI 0 "register_operand" "=r")
999 (lshiftrt:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
1000 (match_operand:DI 2 "reg_or_6bit_operand" "rI")))]
1003 [(set_attr "type" "shift")])
1005 (define_insn "ashrdi3"
1006 [(set (match_operand:DI 0 "register_operand" "=r")
1007 (ashiftrt:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
1008 (match_operand:DI 2 "reg_or_6bit_operand" "rI")))]
1011 [(set_attr "type" "shift")])
1013 (define_expand "extendqihi2"
1015 (ashift:DI (match_operand:QI 1 "some_operand" "")
1017 (set (match_operand:HI 0 "register_operand" "")
1018 (ashiftrt:DI (match_dup 2)
1023 if (TARGET_BYTE_OPS)
1025 emit_insn (gen_extendqihi2x (operands[0],
1026 force_reg (QImode, operands[1])));
1030 /* If we have an unaligned MEM, extend to DImode (which we do
1031 specially) and then copy to the result. */
1032 if (unaligned_memory_operand (operands[1], HImode))
1034 rtx temp = gen_reg_rtx (DImode);
1036 emit_insn (gen_extendqidi2 (temp, operands[1]));
1037 emit_move_insn (operands[0], gen_lowpart (HImode, temp));
1041 operands[0] = gen_lowpart (DImode, operands[0]);
1042 operands[1] = gen_lowpart (DImode, force_reg (QImode, operands[1]));
1043 operands[2] = gen_reg_rtx (DImode);
1046 (define_insn "extendqidi2x"
1047 [(set (match_operand:DI 0 "register_operand" "=r")
1048 (sign_extend:DI (match_operand:QI 1 "register_operand" "r")))]
1051 [(set_attr "type" "shift")])
1053 (define_insn "extendhidi2x"
1054 [(set (match_operand:DI 0 "register_operand" "=r")
1055 (sign_extend:DI (match_operand:HI 1 "register_operand" "r")))]
1058 [(set_attr "type" "shift")])
1060 (define_insn "extendqisi2x"
1061 [(set (match_operand:SI 0 "register_operand" "=r")
1062 (sign_extend:SI (match_operand:QI 1 "register_operand" "r")))]
1065 [(set_attr "type" "shift")])
1067 (define_insn "extendhisi2x"
1068 [(set (match_operand:SI 0 "register_operand" "=r")
1069 (sign_extend:SI (match_operand:HI 1 "register_operand" "r")))]
1072 [(set_attr "type" "shift")])
1074 (define_insn "extendqihi2x"
1075 [(set (match_operand:HI 0 "register_operand" "=r")
1076 (sign_extend:HI (match_operand:QI 1 "register_operand" "r")))]
1079 [(set_attr "type" "shift")])
1081 (define_expand "extendqisi2"
1083 (ashift:DI (match_operand:QI 1 "some_operand" "")
1085 (set (match_operand:SI 0 "register_operand" "")
1086 (ashiftrt:DI (match_dup 2)
1091 if (TARGET_BYTE_OPS)
1093 emit_insn (gen_extendqisi2x (operands[0],
1094 force_reg (QImode, operands[1])));
1098 /* If we have an unaligned MEM, extend to a DImode form of
1099 the result (which we do specially). */
1100 if (unaligned_memory_operand (operands[1], QImode))
1102 rtx temp = gen_reg_rtx (DImode);
1104 emit_insn (gen_extendqidi2 (temp, operands[1]));
1105 emit_move_insn (operands[0], gen_lowpart (SImode, temp));
1109 operands[0] = gen_lowpart (DImode, operands[0]);
1110 operands[1] = gen_lowpart (DImode, force_reg (QImode, operands[1]));
1111 operands[2] = gen_reg_rtx (DImode);
1114 (define_expand "extendqidi2"
1116 (ashift:DI (match_operand:QI 1 "some_operand" "")
1118 (set (match_operand:DI 0 "register_operand" "")
1119 (ashiftrt:DI (match_dup 2)
1123 { extern rtx get_unaligned_address ();
1125 if (TARGET_BYTE_OPS)
1127 emit_insn (gen_extendqidi2x (operands[0],
1128 force_reg (QImode, operands[1])));
1132 if (unaligned_memory_operand (operands[1], QImode))
1135 = gen_unaligned_extendqidi (operands[0],
1136 get_unaligned_address (operands[1], 1));
1138 alpha_set_memflags (seq, operands[1]);
1143 operands[1] = gen_lowpart (DImode, force_reg (QImode, operands[1]));
1144 operands[2] = gen_reg_rtx (DImode);
1147 (define_expand "extendhisi2"
1149 (ashift:DI (match_operand:HI 1 "some_operand" "")
1151 (set (match_operand:SI 0 "register_operand" "")
1152 (ashiftrt:DI (match_dup 2)
1157 if (TARGET_BYTE_OPS)
1159 emit_insn (gen_extendhisi2x (operands[0],
1160 force_reg (HImode, operands[1])));
1164 /* If we have an unaligned MEM, extend to a DImode form of
1165 the result (which we do specially). */
1166 if (unaligned_memory_operand (operands[1], HImode))
1168 rtx temp = gen_reg_rtx (DImode);
1170 emit_insn (gen_extendhidi2 (temp, operands[1]));
1171 emit_move_insn (operands[0], gen_lowpart (SImode, temp));
1175 operands[0] = gen_lowpart (DImode, operands[0]);
1176 operands[1] = gen_lowpart (DImode, force_reg (HImode, operands[1]));
1177 operands[2] = gen_reg_rtx (DImode);
1180 (define_expand "extendhidi2"
1182 (ashift:DI (match_operand:HI 1 "some_operand" "")
1184 (set (match_operand:DI 0 "register_operand" "")
1185 (ashiftrt:DI (match_dup 2)
1189 { extern rtx get_unaligned_address ();
1191 if (TARGET_BYTE_OPS)
1193 emit_insn (gen_extendhidi2x (operands[0],
1194 force_reg (HImode, operands[1])));
1198 if (unaligned_memory_operand (operands[1], HImode))
1201 = gen_unaligned_extendhidi (operands[0],
1202 get_unaligned_address (operands[1], 2));
1204 alpha_set_memflags (seq, operands[1]);
1209 operands[1] = gen_lowpart (DImode, force_reg (HImode, operands[1]));
1210 operands[2] = gen_reg_rtx (DImode);
1213 ;; Here's how we sign extend an unaligned byte and halfword. Doing this
1214 ;; as a pattern saves one instruction. The code is similar to that for
1215 ;; the unaligned loads (see below).
1217 ;; Operand 1 is the address + 1 (+2 for HI), operand 0 is the result.
1218 (define_expand "unaligned_extendqidi"
1219 [(set (match_dup 2) (match_operand:DI 1 "address_operand" ""))
1221 (mem:DI (and:DI (plus:DI (match_dup 2) (const_int -1))
1224 (ashift:DI (match_dup 3)
1225 (minus:DI (const_int 56)
1227 (and:DI (plus:DI (match_dup 2) (const_int -1))
1230 (set (subreg:DI (match_operand:QI 0 "register_operand" "") 0)
1231 (ashiftrt:DI (match_dup 4) (const_int 56)))]
1234 { operands[2] = gen_reg_rtx (DImode);
1235 operands[3] = gen_reg_rtx (DImode);
1236 operands[4] = gen_reg_rtx (DImode);
1239 (define_expand "unaligned_extendhidi"
1240 [(set (match_dup 2) (match_operand:DI 1 "address_operand" ""))
1242 (mem:DI (and:DI (plus:DI (match_dup 2) (const_int -2))
1245 (ashift:DI (match_dup 3)
1246 (minus:DI (const_int 56)
1248 (and:DI (plus:DI (match_dup 2) (const_int -1))
1251 (set (subreg:DI (match_operand:QI 0 "register_operand" "") 0)
1252 (ashiftrt:DI (match_dup 4) (const_int 48)))]
1255 { operands[2] = gen_reg_rtx (DImode);
1256 operands[3] = gen_reg_rtx (DImode);
1257 operands[4] = gen_reg_rtx (DImode);
1261 [(set (match_operand:DI 0 "register_operand" "=r")
1262 (zero_extract:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
1263 (match_operand:DI 2 "mode_width_operand" "n")
1264 (match_operand:DI 3 "mul8_operand" "I")))]
1266 "ext%M2l %r1,%s3,%0"
1267 [(set_attr "type" "shift")])
1270 [(set (match_operand:DI 0 "register_operand" "=r")
1271 (zero_extract:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
1272 (match_operand:DI 2 "mode_width_operand" "n")
1273 (ashift:DI (match_operand:DI 3 "reg_or_8bit_operand" "rI")
1277 [(set_attr "type" "shift")])
1280 [(set (match_operand:DI 0 "register_operand" "=r")
1282 (match_operand:DI 1 "reg_or_0_operand" "rJ")
1283 (minus:DI (const_int 56)
1286 (plus:DI (match_operand:DI 2 "reg_or_8bit_operand" "rI")
1292 [(set_attr "type" "shift")])
1295 [(set (match_operand:DI 0 "register_operand" "=r")
1297 (and:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
1298 (const_int 2147483647))
1299 (minus:DI (const_int 56)
1302 (plus:DI (match_operand:DI 2 "reg_or_8bit_operand" "rI")
1308 [(set_attr "type" "shift")])
1311 [(set (match_operand:DI 0 "register_operand" "=r")
1313 (and:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
1315 (minus:DI (const_int 56)
1318 (plus:DI (match_operand:DI 2 "reg_or_8bit_operand" "rI")
1324 [(set_attr "type" "shift")])
1326 ;; This converts an extXl into an extXh with an appropriate adjustment
1327 ;; to the address calculation.
1330 ;; [(set (match_operand:DI 0 "register_operand" "")
1331 ;; (ashift:DI (zero_extract:DI (match_operand:DI 1 "register_operand" "")
1332 ;; (match_operand:DI 2 "mode_width_operand" "")
1333 ;; (ashift:DI (match_operand:DI 3 "" "")
1335 ;; (match_operand:DI 4 "const_int_operand" "")))
1336 ;; (clobber (match_operand:DI 5 "register_operand" ""))]
1337 ;; "INTVAL (operands[4]) == 64 - INTVAL (operands[2])"
1338 ;; [(set (match_dup 5) (match_dup 6))
1339 ;; (set (match_dup 0)
1340 ;; (ashift:DI (zero_extract:DI (match_dup 1) (match_dup 2)
1341 ;; (ashift:DI (plus:DI (match_dup 5)
1347 ;; operands[6] = plus_constant (operands[3],
1348 ;; INTVAL (operands[2]) / BITS_PER_UNIT);
1349 ;; operands[7] = GEN_INT (- INTVAL (operands[2]) / BITS_PER_UNIT);
1353 [(set (match_operand:DI 0 "register_operand" "=r")
1354 (ashift:DI (zero_extend:DI (match_operand:QI 1 "register_operand" "r"))
1355 (match_operand:DI 2 "mul8_operand" "I")))]
1358 [(set_attr "type" "shift")])
1361 [(set (match_operand:DI 0 "register_operand" "=r")
1362 (ashift:DI (zero_extend:DI (match_operand:HI 1 "register_operand" "r"))
1363 (match_operand:DI 2 "mul8_operand" "I")))]
1366 [(set_attr "type" "shift")])
1369 [(set (match_operand:DI 0 "register_operand" "=r")
1370 (ashift:DI (zero_extend:DI (match_operand:SI 1 "register_operand" "r"))
1371 (match_operand:DI 2 "mul8_operand" "I")))]
1374 [(set_attr "type" "shift")])
1377 [(set (match_operand:DI 0 "register_operand" "=r")
1378 (ashift:DI (zero_extend:DI (match_operand:QI 1 "register_operand" "r"))
1379 (ashift:DI (match_operand:DI 2 "reg_or_8bit_operand" "rI")
1383 [(set_attr "type" "shift")])
1386 [(set (match_operand:DI 0 "register_operand" "=r")
1387 (ashift:DI (zero_extend:DI (match_operand:HI 1 "register_operand" "r"))
1388 (ashift:DI (match_operand:DI 2 "reg_or_8bit_operand" "rI")
1392 [(set_attr "type" "shift")])
1395 [(set (match_operand:DI 0 "register_operand" "=r")
1396 (ashift:DI (zero_extend:DI (match_operand:SI 1 "register_operand" "r"))
1397 (ashift:DI (match_operand:DI 2 "reg_or_8bit_operand" "rI")
1401 [(set_attr "type" "shift")])
1403 ;; We do not include the insXh insns because they are complex to express
1404 ;; and it does not appear that we would ever want to generate them.
1407 [(set (match_operand:DI 0 "register_operand" "=r")
1408 (and:DI (not:DI (ashift:DI
1409 (match_operand:DI 2 "mode_mask_operand" "n")
1411 (match_operand:DI 3 "reg_or_8bit_operand" "rI")
1413 (match_operand:DI 1 "reg_or_0_operand" "rJ")))]
1416 [(set_attr "type" "shift")])
1418 ;; We do not include the mskXh insns because it does not appear we would ever
1421 ;; Floating-point operations. All the double-precision insns can extend
1422 ;; from single, so indicate that. The exception are the ones that simply
1423 ;; play with the sign bits; it's not clear what to do there.
1425 (define_insn "abssf2"
1426 [(set (match_operand:SF 0 "register_operand" "=f")
1427 (abs:SF (match_operand:SF 1 "reg_or_fp0_operand" "fG")))]
1430 [(set_attr "type" "fcpys")])
1432 (define_insn "absdf2"
1433 [(set (match_operand:DF 0 "register_operand" "=f")
1434 (abs:DF (match_operand:DF 1 "reg_or_fp0_operand" "fG")))]
1437 [(set_attr "type" "fcpys")])
1439 (define_insn "negsf2"
1440 [(set (match_operand:SF 0 "register_operand" "=f")
1441 (neg:SF (match_operand:SF 1 "reg_or_fp0_operand" "fG")))]
1444 [(set_attr "type" "fadd")])
1446 (define_insn "negdf2"
1447 [(set (match_operand:DF 0 "register_operand" "=f")
1448 (neg:DF (match_operand:DF 1 "reg_or_fp0_operand" "fG")))]
1451 [(set_attr "type" "fadd")])
1454 [(set (match_operand:SF 0 "register_operand" "=&f")
1455 (plus:SF (match_operand:SF 1 "reg_or_fp0_operand" "%fG")
1456 (match_operand:SF 2 "reg_or_fp0_operand" "fG")))]
1457 "TARGET_FP && alpha_tp == ALPHA_TP_INSN"
1458 "add%,%)%& %R1,%R2,%0"
1459 [(set_attr "type" "fadd")
1460 (set_attr "trap" "yes")])
1462 (define_insn "addsf3"
1463 [(set (match_operand:SF 0 "register_operand" "=f")
1464 (plus:SF (match_operand:SF 1 "reg_or_fp0_operand" "%fG")
1465 (match_operand:SF 2 "reg_or_fp0_operand" "fG")))]
1467 "add%,%)%& %R1,%R2,%0"
1468 [(set_attr "type" "fadd")
1469 (set_attr "trap" "yes")])
1472 [(set (match_operand:DF 0 "register_operand" "=&f")
1473 (plus:DF (match_operand:DF 1 "reg_or_fp0_operand" "%fG")
1474 (match_operand:DF 2 "reg_or_fp0_operand" "fG")))]
1475 "TARGET_FP && alpha_tp == ALPHA_TP_INSN"
1476 "add%-%)%& %R1,%R2,%0"
1477 [(set_attr "type" "fadd")
1478 (set_attr "trap" "yes")])
1480 (define_insn "adddf3"
1481 [(set (match_operand:DF 0 "register_operand" "=f")
1482 (plus:DF (match_operand:DF 1 "reg_or_fp0_operand" "%fG")
1483 (match_operand:DF 2 "reg_or_fp0_operand" "fG")))]
1485 "add%-%)%& %R1,%R2,%0"
1486 [(set_attr "type" "fadd")
1487 (set_attr "trap" "yes")])
1490 [(set (match_operand:DF 0 "register_operand" "=f")
1491 (plus:DF (float_extend:DF
1492 (match_operand:SF 1 "reg_or_fp0_operand" "fG"))
1493 (match_operand:DF 2 "reg_or_fp0_operand" "fG")))]
1494 "TARGET_FP && alpha_tp != ALPHA_TP_INSN"
1495 "add%-%)%& %R1,%R2,%0"
1496 [(set_attr "type" "fadd")
1497 (set_attr "trap" "yes")])
1500 [(set (match_operand:DF 0 "register_operand" "=f")
1501 (plus:DF (float_extend:DF
1502 (match_operand:SF 1 "reg_or_fp0_operand" "%fG"))
1504 (match_operand:SF 2 "reg_or_fp0_operand" "fG"))))]
1505 "TARGET_FP && alpha_tp != ALPHA_TP_INSN"
1506 "add%-%)%& %R1,%R2,%0"
1507 [(set_attr "type" "fadd")
1508 (set_attr "trap" "yes")])
1510 (define_insn "fix_truncdfdi2"
1511 [(set (match_operand:DI 0 "register_operand" "=f")
1512 (fix:DI (match_operand:DF 1 "reg_or_fp0_operand" "fG")))]
1515 [(set_attr "type" "fadd")])
1517 (define_insn "fix_truncsfdi2"
1518 [(set (match_operand:DI 0 "register_operand" "=f")
1519 (fix:DI (float_extend:DF
1520 (match_operand:SF 1 "reg_or_fp0_operand" "fG"))))]
1523 [(set_attr "type" "fadd")])
1526 [(set (match_operand:SF 0 "register_operand" "=&f")
1527 (float:SF (match_operand:DI 1 "register_operand" "f")))]
1528 "TARGET_FP && alpha_tp == ALPHA_TP_INSN"
1530 [(set_attr "type" "fadd")
1531 (set_attr "trap" "yes")])
1533 (define_insn "floatdisf2"
1534 [(set (match_operand:SF 0 "register_operand" "=f")
1535 (float:SF (match_operand:DI 1 "register_operand" "f")))]
1538 [(set_attr "type" "fadd")
1539 (set_attr "trap" "yes")])
1542 [(set (match_operand:DF 0 "register_operand" "=&f")
1543 (float:DF (match_operand:DI 1 "register_operand" "f")))]
1544 "TARGET_FP && alpha_tp == ALPHA_TP_INSN"
1546 [(set_attr "type" "fadd")
1547 (set_attr "trap" "yes")])
1549 (define_insn "floatdidf2"
1550 [(set (match_operand:DF 0 "register_operand" "=f")
1551 (float:DF (match_operand:DI 1 "register_operand" "f")))]
1554 [(set_attr "type" "fadd")
1555 (set_attr "trap" "yes")])
1557 (define_expand "extendsfdf2"
1558 [(use (match_operand:DF 0 "register_operand" ""))
1559 (use (match_operand:SF 1 "nonimmediate_operand" ""))]
1563 if (alpha_tp == ALPHA_TP_INSN)
1564 emit_insn (gen_extendsfdf2_tp (operands[0],
1565 force_reg (SFmode, operands[1])));
1567 emit_insn (gen_extendsfdf2_no_tp (operands[0], operands[1]));
1572 (define_insn "extendsfdf2_tp"
1573 [(set (match_operand:DF 0 "register_operand" "=&f")
1574 (float_extend:DF (match_operand:SF 1 "register_operand" "f")))]
1575 "TARGET_FP && alpha_tp == ALPHA_TP_INSN"
1577 [(set_attr "type" "fadd")
1578 (set_attr "trap" "yes")])
1580 (define_insn "extendsfdf2_no_tp"
1581 [(set (match_operand:DF 0 "register_operand" "=f,f,m")
1582 (float_extend:DF (match_operand:SF 1 "nonimmediate_operand" "f,m,f")))]
1583 "TARGET_FP && alpha_tp != ALPHA_TP_INSN"
1588 [(set_attr "type" "fcpys,ld,st")
1589 (set_attr "trap" "yes")])
1592 [(set (match_operand:SF 0 "register_operand" "=&f")
1593 (float_truncate:SF (match_operand:DF 1 "reg_or_fp0_operand" "fG")))]
1594 "TARGET_FP && alpha_tp == ALPHA_TP_INSN"
1595 "cvt%-%,%)%& %R1,%0"
1596 [(set_attr "type" "fadd")
1597 (set_attr "trap" "yes")])
1599 (define_insn "truncdfsf2"
1600 [(set (match_operand:SF 0 "register_operand" "=f")
1601 (float_truncate:SF (match_operand:DF 1 "reg_or_fp0_operand" "fG")))]
1603 "cvt%-%,%)%& %R1,%0"
1604 [(set_attr "type" "fadd")
1605 (set_attr "trap" "yes")])
1608 [(set (match_operand:SF 0 "register_operand" "=&f")
1609 (div:SF (match_operand:SF 1 "reg_or_fp0_operand" "fG")
1610 (match_operand:SF 2 "reg_or_fp0_operand" "fG")))]
1611 "TARGET_FP && alpha_tp == ALPHA_TP_INSN"
1612 "div%,%)%& %R1,%R2,%0"
1613 [(set_attr "type" "fdivs")
1614 (set_attr "trap" "yes")])
1616 (define_insn "divsf3"
1617 [(set (match_operand:SF 0 "register_operand" "=f")
1618 (div:SF (match_operand:SF 1 "reg_or_fp0_operand" "fG")
1619 (match_operand:SF 2 "reg_or_fp0_operand" "fG")))]
1621 "div%,%)%& %R1,%R2,%0"
1622 [(set_attr "type" "fdivs")
1623 (set_attr "trap" "yes")])
1626 [(set (match_operand:DF 0 "register_operand" "=&f")
1627 (div:DF (match_operand:DF 1 "reg_or_fp0_operand" "fG")
1628 (match_operand:DF 2 "reg_or_fp0_operand" "fG")))]
1629 "TARGET_FP && alpha_tp == ALPHA_TP_INSN"
1630 "div%-%)%& %R1,%R2,%0"
1631 [(set_attr "type" "fdivt")
1632 (set_attr "trap" "yes")])
1634 (define_insn "divdf3"
1635 [(set (match_operand:DF 0 "register_operand" "=f")
1636 (div:DF (match_operand:DF 1 "reg_or_fp0_operand" "fG")
1637 (match_operand:DF 2 "reg_or_fp0_operand" "fG")))]
1639 "div%-%)%& %R1,%R2,%0"
1640 [(set_attr "type" "fdivt")
1641 (set_attr "trap" "yes")])
1644 [(set (match_operand:DF 0 "register_operand" "=f")
1645 (div:DF (float_extend:DF (match_operand:SF 1 "reg_or_fp0_operand" "fG"))
1646 (match_operand:DF 2 "reg_or_fp0_operand" "fG")))]
1647 "TARGET_FP && alpha_tp != ALPHA_TP_INSN"
1648 "div%-%)%& %R1,%R2,%0"
1649 [(set_attr "type" "fdivt")
1650 (set_attr "trap" "yes")])
1653 [(set (match_operand:DF 0 "register_operand" "=f")
1654 (div:DF (match_operand:DF 1 "reg_or_fp0_operand" "fG")
1656 (match_operand:SF 2 "reg_or_fp0_operand" "fG"))))]
1657 "TARGET_FP && alpha_tp != ALPHA_TP_INSN"
1658 "div%-%)%& %R1,%R2,%0"
1659 [(set_attr "type" "fdivt")
1660 (set_attr "trap" "yes")])
1663 [(set (match_operand:DF 0 "register_operand" "=f")
1664 (div:DF (float_extend:DF (match_operand:SF 1 "reg_or_fp0_operand" "fG"))
1665 (float_extend:DF (match_operand:SF 2 "reg_or_fp0_operand" "fG"))))]
1666 "TARGET_FP && alpha_tp != ALPHA_TP_INSN"
1667 "div%-%)%& %R1,%R2,%0"
1668 [(set_attr "type" "fdivt")
1669 (set_attr "trap" "yes")])
1672 [(set (match_operand:SF 0 "register_operand" "=&f")
1673 (mult:SF (match_operand:SF 1 "reg_or_fp0_operand" "%fG")
1674 (match_operand:SF 2 "reg_or_fp0_operand" "fG")))]
1675 "TARGET_FP && alpha_tp == ALPHA_TP_INSN"
1676 "mul%,%)%& %R1,%R2,%0"
1677 [(set_attr "type" "fmul")
1678 (set_attr "trap" "yes")])
1680 (define_insn "mulsf3"
1681 [(set (match_operand:SF 0 "register_operand" "=f")
1682 (mult:SF (match_operand:SF 1 "reg_or_fp0_operand" "%fG")
1683 (match_operand:SF 2 "reg_or_fp0_operand" "fG")))]
1685 "mul%,%)%& %R1,%R2,%0"
1686 [(set_attr "type" "fmul")
1687 (set_attr "trap" "yes")])
1690 [(set (match_operand:DF 0 "register_operand" "=&f")
1691 (mult:DF (match_operand:DF 1 "reg_or_fp0_operand" "%fG")
1692 (match_operand:DF 2 "reg_or_fp0_operand" "fG")))]
1693 "TARGET_FP && alpha_tp == ALPHA_TP_INSN"
1694 "mul%-%)%& %R1,%R2,%0"
1695 [(set_attr "type" "fmul")
1696 (set_attr "trap" "yes")])
1698 (define_insn "muldf3"
1699 [(set (match_operand:DF 0 "register_operand" "=f")
1700 (mult:DF (match_operand:DF 1 "reg_or_fp0_operand" "%fG")
1701 (match_operand:DF 2 "reg_or_fp0_operand" "fG")))]
1703 "mul%-%)%& %R1,%R2,%0"
1704 [(set_attr "type" "fmul")
1705 (set_attr "trap" "yes")])
1708 [(set (match_operand:DF 0 "register_operand" "=f")
1709 (mult:DF (float_extend:DF
1710 (match_operand:SF 1 "reg_or_fp0_operand" "fG"))
1711 (match_operand:DF 2 "reg_or_fp0_operand" "fG")))]
1712 "TARGET_FP && alpha_tp != ALPHA_TP_INSN"
1713 "mul%-%)%& %R1,%R2,%0"
1714 [(set_attr "type" "fmul")
1715 (set_attr "trap" "yes")])
1718 [(set (match_operand:DF 0 "register_operand" "=f")
1719 (mult:DF (float_extend:DF
1720 (match_operand:SF 1 "reg_or_fp0_operand" "%fG"))
1722 (match_operand:SF 2 "reg_or_fp0_operand" "fG"))))]
1723 "TARGET_FP && alpha_tp != ALPHA_TP_INSN"
1724 "mul%-%)%& %R1,%R2,%0"
1725 [(set_attr "type" "fmul")
1726 (set_attr "trap" "yes")])
1729 [(set (match_operand:SF 0 "register_operand" "=&f")
1730 (minus:SF (match_operand:SF 1 "reg_or_fp0_operand" "fG")
1731 (match_operand:SF 2 "reg_or_fp0_operand" "fG")))]
1732 "TARGET_FP && alpha_tp == ALPHA_TP_INSN"
1733 "sub%,%)%& %R1,%R2,%0"
1734 [(set_attr "type" "fadd")
1735 (set_attr "trap" "yes")])
1737 (define_insn "subsf3"
1738 [(set (match_operand:SF 0 "register_operand" "=f")
1739 (minus:SF (match_operand:SF 1 "reg_or_fp0_operand" "fG")
1740 (match_operand:SF 2 "reg_or_fp0_operand" "fG")))]
1742 "sub%,%)%& %R1,%R2,%0"
1743 [(set_attr "type" "fadd")
1744 (set_attr "trap" "yes")])
1747 [(set (match_operand:DF 0 "register_operand" "=&f")
1748 (minus:DF (match_operand:DF 1 "reg_or_fp0_operand" "fG")
1749 (match_operand:DF 2 "reg_or_fp0_operand" "fG")))]
1750 "TARGET_FP && alpha_tp == ALPHA_TP_INSN"
1751 "sub%-%)%& %R1,%R2,%0"
1752 [(set_attr "type" "fadd")
1753 (set_attr "trap" "yes")])
1755 (define_insn "subdf3"
1756 [(set (match_operand:DF 0 "register_operand" "=f")
1757 (minus:DF (match_operand:DF 1 "reg_or_fp0_operand" "fG")
1758 (match_operand:DF 2 "reg_or_fp0_operand" "fG")))]
1760 "sub%-%)%& %R1,%R2,%0"
1761 [(set_attr "type" "fadd")
1762 (set_attr "trap" "yes")])
1765 [(set (match_operand:DF 0 "register_operand" "=f")
1766 (minus:DF (float_extend:DF
1767 (match_operand:SF 1 "reg_or_fp0_operand" "fG"))
1768 (match_operand:DF 2 "reg_or_fp0_operand" "fG")))]
1769 "TARGET_FP && alpha_tp != ALPHA_TP_INSN"
1770 "sub%-%)%& %R1,%R2,%0"
1771 [(set_attr "type" "fadd")
1772 (set_attr "trap" "yes")])
1775 [(set (match_operand:DF 0 "register_operand" "=f")
1776 (minus:DF (match_operand:DF 1 "reg_or_fp0_operand" "fG")
1778 (match_operand:SF 2 "reg_or_fp0_operand" "fG"))))]
1779 "TARGET_FP && alpha_tp != ALPHA_TP_INSN"
1780 "sub%-%)%& %R1,%R2,%0"
1781 [(set_attr "type" "fadd")
1782 (set_attr "trap" "yes")])
1785 [(set (match_operand:DF 0 "register_operand" "=f")
1786 (minus:DF (float_extend:DF
1787 (match_operand:SF 1 "reg_or_fp0_operand" "fG"))
1789 (match_operand:SF 2 "reg_or_fp0_operand" "fG"))))]
1790 "TARGET_FP && alpha_tp != ALPHA_TP_INSN"
1791 "sub%-%)%& %R1,%R2,%0"
1792 [(set_attr "type" "fadd")
1793 (set_attr "trap" "yes")])
1795 ;; Next are all the integer comparisons, and conditional moves and branches
1796 ;; and some of the related define_expand's and define_split's.
1799 [(set (match_operand:DI 0 "register_operand" "=r")
1800 (match_operator:DI 1 "alpha_comparison_operator"
1801 [(match_operand:DI 2 "reg_or_0_operand" "rJ")
1802 (match_operand:DI 3 "reg_or_8bit_operand" "rI")]))]
1805 [(set_attr "type" "icmp")])
1808 [(set (match_operand:DI 0 "register_operand" "=r")
1809 (match_operator:DI 1 "alpha_swapped_comparison_operator"
1810 [(match_operand:DI 2 "reg_or_8bit_operand" "rI")
1811 (match_operand:DI 3 "reg_or_0_operand" "rJ")]))]
1814 [(set_attr "type" "icmp")])
1816 ;; This pattern exists so conditional moves of SImode values are handled.
1817 ;; Comparisons are still done in DImode though.
1820 [(set (match_operand:SI 0 "register_operand" "=r,r,r,r")
1822 (match_operator 2 "signed_comparison_operator"
1823 [(match_operand:DI 3 "reg_or_0_operand" "rJ,rJ,J,J")
1824 (match_operand:DI 4 "reg_or_0_operand" "J,J,rJ,rJ")])
1825 (match_operand:SI 1 "reg_or_8bit_operand" "rI,0,rI,0")
1826 (match_operand:SI 5 "reg_or_8bit_operand" "0,rI,0,rI")))]
1827 "operands[3] == const0_rtx || operands[4] == const0_rtx"
1833 [(set_attr "type" "cmov")])
1836 [(set (match_operand:DI 0 "register_operand" "=r,r,r,r")
1838 (match_operator 2 "signed_comparison_operator"
1839 [(match_operand:DI 3 "reg_or_0_operand" "rJ,rJ,J,J")
1840 (match_operand:DI 4 "reg_or_0_operand" "J,J,rJ,rJ")])
1841 (match_operand:DI 1 "reg_or_8bit_operand" "rI,0,rI,0")
1842 (match_operand:DI 5 "reg_or_8bit_operand" "0,rI,0,rI")))]
1843 "operands[3] == const0_rtx || operands[4] == const0_rtx"
1849 [(set_attr "type" "cmov")])
1852 [(set (match_operand:DI 0 "register_operand" "=r,r")
1854 (eq (zero_extract:DI (match_operand:DI 2 "reg_or_0_operand" "rJ,rJ")
1858 (match_operand:DI 1 "reg_or_8bit_operand" "rI,0")
1859 (match_operand:DI 3 "reg_or_8bit_operand" "0,rI")))]
1864 [(set_attr "type" "cmov")])
1867 [(set (match_operand:DI 0 "register_operand" "=r,r")
1869 (ne (zero_extract:DI (match_operand:DI 2 "reg_or_0_operand" "rJ,rJ")
1873 (match_operand:DI 1 "reg_or_8bit_operand" "rI,0")
1874 (match_operand:DI 3 "reg_or_8bit_operand" "0,rI")))]
1879 [(set_attr "type" "cmov")])
1881 ;; This form is added since combine thinks that an IF_THEN_ELSE with both
1882 ;; arms constant is a single insn, so it won't try to form it if combine
1883 ;; knows they are really two insns. This occurs in divides by powers
1887 [(set (match_operand:DI 0 "register_operand" "=r")
1889 (match_operator 2 "signed_comparison_operator"
1890 [(match_operand:DI 3 "reg_or_0_operand" "rJ")
1892 (plus:DI (match_dup 0)
1893 (match_operand:DI 1 "reg_or_8bit_operand" "rI"))
1895 (clobber (match_scratch:DI 4 "=&r"))]
1897 "addq %0,%1,%4\;cmov%C2 %r3,%4,%0"
1898 [(set_attr "type" "cmov")])
1901 [(set (match_operand:DI 0 "register_operand" "")
1903 (match_operator 2 "signed_comparison_operator"
1904 [(match_operand:DI 3 "reg_or_0_operand" "")
1906 (plus:DI (match_dup 0)
1907 (match_operand:DI 1 "reg_or_8bit_operand" ""))
1909 (clobber (match_operand:DI 4 "register_operand" ""))]
1911 [(set (match_dup 4) (plus:DI (match_dup 0) (match_dup 1)))
1912 (set (match_dup 0) (if_then_else:DI (match_op_dup 2
1915 (match_dup 4) (match_dup 0)))]
1920 [(set (match_operand:DI 0 "register_operand" "")
1922 (match_operator 1 "comparison_operator"
1923 [(zero_extract:DI (match_operand:DI 2 "register_operand" "")
1925 (match_operand:DI 3 "const_int_operand" ""))
1927 (match_operand:DI 4 "reg_or_8bit_operand" "")
1928 (match_operand:DI 5 "reg_or_8bit_operand" "")))
1929 (clobber (match_operand:DI 6 "register_operand" ""))])]
1930 "INTVAL (operands[3]) != 0"
1932 (lshiftrt:DI (match_dup 2) (match_dup 3)))
1934 (if_then_else:DI (match_op_dup 1
1935 [(zero_extract:DI (match_dup 6)
1943 ;; For ABS, we have two choices, depending on whether the input and output
1944 ;; registers are the same or not.
1945 (define_expand "absdi2"
1946 [(set (match_operand:DI 0 "register_operand" "")
1947 (abs:DI (match_operand:DI 1 "register_operand" "")))]
1950 { if (rtx_equal_p (operands[0], operands[1]))
1951 emit_insn (gen_absdi2_same (operands[0], gen_reg_rtx (DImode)));
1953 emit_insn (gen_absdi2_diff (operands[0], operands[1]));
1958 (define_expand "absdi2_same"
1959 [(set (match_operand:DI 1 "register_operand" "")
1960 (neg:DI (match_operand:DI 0 "register_operand" "")))
1962 (if_then_else:DI (ge (match_dup 0) (const_int 0))
1968 (define_expand "absdi2_diff"
1969 [(set (match_operand:DI 0 "register_operand" "")
1970 (neg:DI (match_operand:DI 1 "register_operand" "")))
1972 (if_then_else:DI (lt (match_dup 1) (const_int 0))
1979 [(set (match_operand:DI 0 "register_operand" "")
1980 (abs:DI (match_dup 0)))
1981 (clobber (match_operand:DI 2 "register_operand" ""))]
1983 [(set (match_dup 1) (neg:DI (match_dup 0)))
1984 (set (match_dup 0) (if_then_else:DI (ge (match_dup 0) (const_int 0))
1985 (match_dup 0) (match_dup 1)))]
1989 [(set (match_operand:DI 0 "register_operand" "")
1990 (abs:DI (match_operand:DI 1 "register_operand" "")))]
1991 "! rtx_equal_p (operands[0], operands[1])"
1992 [(set (match_dup 0) (neg:DI (match_dup 1)))
1993 (set (match_dup 0) (if_then_else:DI (lt (match_dup 1) (const_int 0))
1994 (match_dup 0) (match_dup 1)))]
1998 [(set (match_operand:DI 0 "register_operand" "")
1999 (neg:DI (abs:DI (match_dup 0))))
2000 (clobber (match_operand:DI 2 "register_operand" ""))]
2002 [(set (match_dup 1) (neg:DI (match_dup 0)))
2003 (set (match_dup 0) (if_then_else:DI (le (match_dup 0) (const_int 0))
2004 (match_dup 0) (match_dup 1)))]
2008 [(set (match_operand:DI 0 "register_operand" "")
2009 (neg:DI (abs:DI (match_operand:DI 1 "register_operand" ""))))]
2010 "! rtx_equal_p (operands[0], operands[1])"
2011 [(set (match_dup 0) (neg:DI (match_dup 1)))
2012 (set (match_dup 0) (if_then_else:DI (gt (match_dup 1) (const_int 0))
2013 (match_dup 0) (match_dup 1)))]
2016 (define_expand "smaxdi3"
2018 (le:DI (match_operand:DI 1 "reg_or_0_operand" "")
2019 (match_operand:DI 2 "reg_or_8bit_operand" "")))
2020 (set (match_operand:DI 0 "register_operand" "")
2021 (if_then_else:DI (eq (match_dup 3) (const_int 0))
2022 (match_dup 1) (match_dup 2)))]
2025 { operands[3] = gen_reg_rtx (DImode);
2029 [(set (match_operand:DI 0 "register_operand" "")
2030 (smax:DI (match_operand:DI 1 "reg_or_0_operand" "")
2031 (match_operand:DI 2 "reg_or_8bit_operand" "")))
2032 (clobber (match_operand:DI 3 "register_operand" ""))]
2033 "operands[2] != const0_rtx"
2034 [(set (match_dup 3) (le:DI (match_dup 1) (match_dup 2)))
2035 (set (match_dup 0) (if_then_else:DI (eq (match_dup 3) (const_int 0))
2036 (match_dup 1) (match_dup 2)))]
2040 [(set (match_operand:DI 0 "register_operand" "=r")
2041 (smax:DI (match_operand:DI 1 "register_operand" "0")
2045 [(set_attr "type" "cmov")])
2047 (define_expand "smindi3"
2049 (lt:DI (match_operand:DI 1 "reg_or_0_operand" "")
2050 (match_operand:DI 2 "reg_or_8bit_operand" "")))
2051 (set (match_operand:DI 0 "register_operand" "")
2052 (if_then_else:DI (ne (match_dup 3) (const_int 0))
2053 (match_dup 1) (match_dup 2)))]
2056 { operands[3] = gen_reg_rtx (DImode);
2060 [(set (match_operand:DI 0 "register_operand" "")
2061 (smin:DI (match_operand:DI 1 "reg_or_0_operand" "")
2062 (match_operand:DI 2 "reg_or_8bit_operand" "")))
2063 (clobber (match_operand:DI 3 "register_operand" ""))]
2064 "operands[2] != const0_rtx"
2065 [(set (match_dup 3) (lt:DI (match_dup 1) (match_dup 2)))
2066 (set (match_dup 0) (if_then_else:DI (ne (match_dup 3) (const_int 0))
2067 (match_dup 1) (match_dup 2)))]
2071 [(set (match_operand:DI 0 "register_operand" "=r")
2072 (smin:DI (match_operand:DI 1 "register_operand" "0")
2076 [(set_attr "type" "cmov")])
2078 (define_expand "umaxdi3"
2080 (leu:DI (match_operand:DI 1 "reg_or_0_operand" "")
2081 (match_operand:DI 2 "reg_or_8bit_operand" "")))
2082 (set (match_operand:DI 0 "register_operand" "")
2083 (if_then_else:DI (eq (match_dup 3) (const_int 0))
2084 (match_dup 1) (match_dup 2)))]
2087 { operands[3] = gen_reg_rtx (DImode);
2091 [(set (match_operand:DI 0 "register_operand" "")
2092 (umax:DI (match_operand:DI 1 "reg_or_0_operand" "")
2093 (match_operand:DI 2 "reg_or_8bit_operand" "")))
2094 (clobber (match_operand:DI 3 "register_operand" ""))]
2095 "operands[2] != const0_rtx"
2096 [(set (match_dup 3) (leu:DI (match_dup 1) (match_dup 2)))
2097 (set (match_dup 0) (if_then_else:DI (eq (match_dup 3) (const_int 0))
2098 (match_dup 1) (match_dup 2)))]
2101 (define_expand "umindi3"
2103 (ltu:DI (match_operand:DI 1 "reg_or_0_operand" "")
2104 (match_operand:DI 2 "reg_or_8bit_operand" "")))
2105 (set (match_operand:DI 0 "register_operand" "")
2106 (if_then_else:DI (ne (match_dup 3) (const_int 0))
2107 (match_dup 1) (match_dup 2)))]
2110 { operands[3] = gen_reg_rtx (DImode);
2114 [(set (match_operand:DI 0 "register_operand" "")
2115 (umin:DI (match_operand:DI 1 "reg_or_0_operand" "")
2116 (match_operand:DI 2 "reg_or_8bit_operand" "")))
2117 (clobber (match_operand:DI 3 "register_operand" ""))]
2118 "operands[2] != const0_rtx"
2119 [(set (match_dup 3) (ltu:DI (match_dup 1) (match_dup 2)))
2120 (set (match_dup 0) (if_then_else:DI (ne (match_dup 3) (const_int 0))
2121 (match_dup 1) (match_dup 2)))]
2127 (match_operator 1 "signed_comparison_operator"
2128 [(match_operand:DI 2 "reg_or_0_operand" "rJ")
2130 (label_ref (match_operand 0 "" ""))
2134 [(set_attr "type" "ibr")])
2139 (match_operator 1 "signed_comparison_operator"
2141 (match_operand:DI 2 "register_operand" "r")])
2142 (label_ref (match_operand 0 "" ""))
2146 [(set_attr "type" "ibr")])
2151 (ne (zero_extract:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
2155 (label_ref (match_operand 0 "" ""))
2159 [(set_attr "type" "ibr")])
2164 (eq (zero_extract:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
2168 (label_ref (match_operand 0 "" ""))
2172 [(set_attr "type" "ibr")])
2178 (match_operator 1 "comparison_operator"
2179 [(zero_extract:DI (match_operand:DI 2 "register_operand" "")
2181 (match_operand:DI 3 "const_int_operand" ""))
2183 (label_ref (match_operand 0 "" ""))
2185 (clobber (match_operand:DI 4 "register_operand" ""))])]
2186 "INTVAL (operands[3]) != 0"
2188 (lshiftrt:DI (match_dup 2) (match_dup 3)))
2190 (if_then_else (match_op_dup 1
2191 [(zero_extract:DI (match_dup 4)
2195 (label_ref (match_dup 0))
2199 ;; The following are the corresponding floating-point insns. Recall
2200 ;; we need to have variants that expand the arguments from SF mode
2204 [(set (match_operand:DF 0 "register_operand" "=&f")
2205 (match_operator:DF 1 "alpha_comparison_operator"
2206 [(match_operand:DF 2 "reg_or_fp0_operand" "fG")
2207 (match_operand:DF 3 "reg_or_fp0_operand" "fG")]))]
2208 "TARGET_FP && alpha_tp == ALPHA_TP_INSN"
2209 "cmp%-%C1%' %R2,%R3,%0"
2210 [(set_attr "type" "fadd")
2211 (set_attr "trap" "yes")])
2214 [(set (match_operand:DF 0 "register_operand" "=f")
2215 (match_operator:DF 1 "alpha_comparison_operator"
2216 [(match_operand:DF 2 "reg_or_fp0_operand" "fG")
2217 (match_operand:DF 3 "reg_or_fp0_operand" "fG")]))]
2218 "TARGET_FP && alpha_tp != ALPHA_TP_INSN"
2219 "cmp%-%C1%' %R2,%R3,%0"
2220 [(set_attr "type" "fadd")
2221 (set_attr "trap" "yes")])
2224 [(set (match_operand:DF 0 "register_operand" "=f")
2225 (match_operator:DF 1 "alpha_comparison_operator"
2227 (match_operand:SF 2 "reg_or_fp0_operand" "fG"))
2228 (match_operand:DF 3 "reg_or_fp0_operand" "fG")]))]
2229 "TARGET_FP && alpha_tp != ALPHA_TP_INSN"
2230 "cmp%-%C1%' %R2,%R3,%0"
2231 [(set_attr "type" "fadd")
2232 (set_attr "trap" "yes")])
2235 [(set (match_operand:DF 0 "register_operand" "=f")
2236 (match_operator:DF 1 "alpha_comparison_operator"
2237 [(match_operand:DF 2 "reg_or_fp0_operand" "fG")
2239 (match_operand:SF 3 "reg_or_fp0_operand" "fG"))]))]
2240 "TARGET_FP && alpha_tp != ALPHA_TP_INSN"
2241 "cmp%-%C1%' %R2,%R3,%0"
2242 [(set_attr "type" "fadd")
2243 (set_attr "trap" "yes")])
2246 [(set (match_operand:DF 0 "register_operand" "=f")
2247 (match_operator:DF 1 "alpha_comparison_operator"
2249 (match_operand:SF 2 "reg_or_fp0_operand" "fG"))
2251 (match_operand:SF 3 "reg_or_fp0_operand" "fG"))]))]
2252 "TARGET_FP && alpha_tp != ALPHA_TP_INSN"
2253 "cmp%-%C1%' %R2,%R3,%0"
2254 [(set_attr "type" "fadd")
2255 (set_attr "trap" "yes")])
2258 [(set (match_operand:DF 0 "register_operand" "=&f,f")
2260 (match_operator 3 "signed_comparison_operator"
2261 [(match_operand:DF 4 "reg_or_fp0_operand" "fG,fG")
2262 (match_operand:DF 2 "fp0_operand" "G,G")])
2263 (match_operand:DF 1 "reg_or_fp0_operand" "fG,0")
2264 (match_operand:DF 5 "reg_or_fp0_operand" "0,fG")))]
2265 "TARGET_FP && alpha_tp == ALPHA_TP_INSN"
2268 fcmov%D3 %R4,%R5,%0"
2269 [(set_attr "type" "fadd")])
2272 [(set (match_operand:DF 0 "register_operand" "=f,f")
2274 (match_operator 3 "signed_comparison_operator"
2275 [(match_operand:DF 4 "reg_or_fp0_operand" "fG,fG")
2276 (match_operand:DF 2 "fp0_operand" "G,G")])
2277 (match_operand:DF 1 "reg_or_fp0_operand" "fG,0")
2278 (match_operand:DF 5 "reg_or_fp0_operand" "0,fG")))]
2279 "TARGET_FP && alpha_tp != ALPHA_TP_INSN"
2282 fcmov%D3 %R4,%R5,%0"
2283 [(set_attr "type" "fadd")])
2286 [(set (match_operand:SF 0 "register_operand" "=&f,f")
2288 (match_operator 3 "signed_comparison_operator"
2289 [(match_operand:DF 4 "reg_or_fp0_operand" "fG,fG")
2290 (match_operand:DF 2 "fp0_operand" "G,G")])
2291 (match_operand:SF 1 "reg_or_fp0_operand" "fG,0")
2292 (match_operand:SF 5 "reg_or_fp0_operand" "0,fG")))]
2293 "TARGET_FP && alpha_tp == ALPHA_TP_INSN"
2296 fcmov%D3 %R4,%R5,%0"
2297 [(set_attr "type" "fadd")])
2300 [(set (match_operand:SF 0 "register_operand" "=f,f")
2302 (match_operator 3 "signed_comparison_operator"
2303 [(match_operand:DF 4 "reg_or_fp0_operand" "fG,fG")
2304 (match_operand:DF 2 "fp0_operand" "G,G")])
2305 (match_operand:SF 1 "reg_or_fp0_operand" "fG,0")
2306 (match_operand:SF 5 "reg_or_fp0_operand" "0,fG")))]
2307 "TARGET_FP && alpha_tp != ALPHA_TP_INSN"
2310 fcmov%D3 %R4,%R5,%0"
2311 [(set_attr "type" "fadd")])
2314 [(set (match_operand:DF 0 "register_operand" "=f,f")
2316 (match_operator 3 "signed_comparison_operator"
2317 [(match_operand:DF 4 "reg_or_fp0_operand" "fG,fG")
2318 (match_operand:DF 2 "fp0_operand" "G,G")])
2319 (float_extend:DF (match_operand:SF 1 "reg_or_fp0_operand" "fG,0"))
2320 (match_operand:DF 5 "reg_or_fp0_operand" "0,fG")))]
2321 "TARGET_FP && alpha_tp != ALPHA_TP_INSN"
2324 fcmov%D3 %R4,%R5,%0"
2325 [(set_attr "type" "fadd")])
2328 [(set (match_operand:DF 0 "register_operand" "=f,f")
2330 (match_operator 3 "signed_comparison_operator"
2332 (match_operand:SF 4 "reg_or_fp0_operand" "fG,fG"))
2333 (match_operand:DF 2 "fp0_operand" "G,G")])
2334 (match_operand:DF 1 "reg_or_fp0_operand" "fG,0")
2335 (match_operand:DF 5 "reg_or_fp0_operand" "0,fG")))]
2336 "TARGET_FP && alpha_tp != ALPHA_TP_INSN"
2339 fcmov%D3 %R4,%R5,%0"
2340 [(set_attr "type" "fadd")])
2343 [(set (match_operand:SF 0 "register_operand" "=f,f")
2345 (match_operator 3 "signed_comparison_operator"
2347 (match_operand:SF 4 "reg_or_fp0_operand" "fG,fG"))
2348 (match_operand:DF 2 "fp0_operand" "G,G")])
2349 (match_operand:SF 1 "reg_or_fp0_operand" "fG,0")
2350 (match_operand:SF 5 "reg_or_fp0_operand" "0,fG")))]
2351 "TARGET_FP && alpha_tp != ALPHA_TP_INSN"
2354 fcmov%D3 %R4,%R5,%0"
2355 [(set_attr "type" "fadd")])
2358 [(set (match_operand:DF 0 "register_operand" "=f,f")
2360 (match_operator 3 "signed_comparison_operator"
2362 (match_operand:SF 4 "reg_or_fp0_operand" "fG,fG"))
2363 (match_operand:DF 2 "fp0_operand" "G,G")])
2364 (float_extend:DF (match_operand:SF 1 "reg_or_fp0_operand" "fG,0"))
2365 (match_operand:DF 5 "reg_or_fp0_operand" "0,fG")))]
2366 "TARGET_FP && alpha_tp != ALPHA_TP_INSN"
2369 fcmov%D3 %R4,%R5,%0"
2370 [(set_attr "type" "fadd")])
2372 (define_expand "maxdf3"
2374 (le:DF (match_operand:DF 1 "reg_or_fp0_operand" "")
2375 (match_operand:DF 2 "reg_or_fp0_operand" "")))
2376 (set (match_operand:DF 0 "register_operand" "")
2377 (if_then_else:DF (eq (match_dup 3) (match_dup 4))
2378 (match_dup 1) (match_dup 2)))]
2381 { operands[3] = gen_reg_rtx (DFmode);
2382 operands[4] = CONST0_RTX (DFmode);
2385 (define_expand "mindf3"
2387 (lt:DF (match_operand:DF 1 "reg_or_fp0_operand" "")
2388 (match_operand:DF 2 "reg_or_fp0_operand" "")))
2389 (set (match_operand:DF 0 "register_operand" "")
2390 (if_then_else:DF (ne (match_dup 3) (match_dup 4))
2391 (match_dup 1) (match_dup 2)))]
2394 { operands[3] = gen_reg_rtx (DFmode);
2395 operands[4] = CONST0_RTX (DFmode);
2398 (define_expand "maxsf3"
2400 (le:DF (float_extend:DF (match_operand:SF 1 "reg_or_fp0_operand" ""))
2401 (float_extend:DF (match_operand:SF 2 "reg_or_fp0_operand" ""))))
2402 (set (match_operand:SF 0 "register_operand" "")
2403 (if_then_else:SF (eq (match_dup 3) (match_dup 4))
2404 (match_dup 1) (match_dup 2)))]
2407 { operands[3] = gen_reg_rtx (DFmode);
2408 operands[4] = CONST0_RTX (DFmode);
2411 (define_expand "minsf3"
2413 (lt:DF (float_extend:DF (match_operand:SF 1 "reg_or_fp0_operand" ""))
2414 (float_extend:DF (match_operand:SF 2 "reg_or_fp0_operand" ""))))
2415 (set (match_operand:SF 0 "register_operand" "")
2416 (if_then_else:SF (ne (match_dup 3) (match_dup 4))
2417 (match_dup 1) (match_dup 2)))]
2420 { operands[3] = gen_reg_rtx (DFmode);
2421 operands[4] = CONST0_RTX (DFmode);
2427 (match_operator 1 "signed_comparison_operator"
2428 [(match_operand:DF 2 "reg_or_fp0_operand" "fG")
2429 (match_operand:DF 3 "fp0_operand" "G")])
2430 (label_ref (match_operand 0 "" ""))
2434 [(set_attr "type" "fbr")])
2439 (match_operator 1 "signed_comparison_operator"
2441 (match_operand:SF 2 "reg_or_fp0_operand" "fG"))
2442 (match_operand:DF 3 "fp0_operand" "G")])
2443 (label_ref (match_operand 0 "" ""))
2447 [(set_attr "type" "fbr")])
2449 ;; These are the main define_expand's used to make conditional branches
2452 (define_expand "cmpdf"
2453 [(set (cc0) (compare (match_operand:DF 0 "reg_or_fp0_operand" "")
2454 (match_operand:DF 1 "reg_or_fp0_operand" "")))]
2458 alpha_compare_op0 = operands[0];
2459 alpha_compare_op1 = operands[1];
2460 alpha_compare_fp_p = 1;
2464 (define_expand "cmpdi"
2465 [(set (cc0) (compare (match_operand:DI 0 "reg_or_0_operand" "")
2466 (match_operand:DI 1 "reg_or_8bit_operand" "")))]
2470 alpha_compare_op0 = operands[0];
2471 alpha_compare_op1 = operands[1];
2472 alpha_compare_fp_p = 0;
2476 (define_expand "beq"
2477 [(set (match_dup 1) (match_dup 2))
2479 (if_then_else (match_dup 3)
2480 (label_ref (match_operand 0 "" ""))
2485 enum machine_mode mode;
2486 enum rtx_code compare_code = EQ, branch_code = NE;
2488 if (alpha_compare_fp_p)
2493 /* We want to use cmpeq/bne when we can, since there is a zero-delay
2494 bypass between logicals and br/cmov on the 21164. But we don't
2495 want to force valid immediate constants into registers needlessly. */
2496 if (GET_CODE (alpha_compare_op1) == CONST_INT
2497 && ((INTVAL (alpha_compare_op1) >= -0x8000
2498 && INTVAL (alpha_compare_op1) < 0)
2499 || (INTVAL (alpha_compare_op1) > 0xff
2500 && INTVAL (alpha_compare_op1) < 0x8000)))
2502 compare_code = PLUS, branch_code = EQ;
2503 alpha_compare_op1 = GEN_INT (- INTVAL (alpha_compare_op1));
2507 operands[1] = gen_reg_rtx (mode);
2508 operands[2] = gen_rtx (compare_code, mode,
2509 alpha_compare_op0, alpha_compare_op1);
2510 operands[3] = gen_rtx (branch_code, VOIDmode,
2511 operands[1], CONST0_RTX (mode));
2514 (define_expand "bne"
2515 [(set (match_dup 1) (match_dup 2))
2517 (if_then_else (match_dup 3)
2518 (label_ref (match_operand 0 "" ""))
2523 enum machine_mode mode;
2524 enum rtx_code compare_code = EQ, branch_code = EQ;
2526 if (alpha_compare_fp_p)
2531 /* We want to use cmpeq/bne when we can, since there is a zero-delay
2532 bypass between logicals and br/cmov on the 21164. But we don't
2533 want to force valid immediate constants into registers needlessly. */
2534 if (GET_CODE (alpha_compare_op1) == CONST_INT
2535 && ((INTVAL (alpha_compare_op1) >= -0x8000
2536 && INTVAL (alpha_compare_op1) < 0)
2537 || (INTVAL (alpha_compare_op1) > 0xff
2538 && INTVAL (alpha_compare_op1) < 0x8000)))
2540 compare_code = PLUS, branch_code = NE;
2541 alpha_compare_op1 = GEN_INT (- INTVAL (alpha_compare_op1));
2545 operands[1] = gen_reg_rtx (mode);
2546 operands[2] = gen_rtx (compare_code, mode,
2547 alpha_compare_op0, alpha_compare_op1);
2548 operands[3] = gen_rtx (branch_code, VOIDmode,
2549 operands[1], CONST0_RTX (mode));
2552 (define_expand "blt"
2553 [(set (match_dup 1) (match_dup 2))
2555 (if_then_else (match_dup 3)
2556 (label_ref (match_operand 0 "" ""))
2561 enum machine_mode mode = alpha_compare_fp_p ? DFmode : DImode;
2562 operands[1] = gen_reg_rtx (mode);
2563 operands[2] = gen_rtx (LT, mode, alpha_compare_op0, alpha_compare_op1);
2564 operands[3] = gen_rtx (NE, VOIDmode, operands[1], CONST0_RTX (mode));
2567 (define_expand "ble"
2568 [(set (match_dup 1) (match_dup 2))
2570 (if_then_else (match_dup 3)
2571 (label_ref (match_operand 0 "" ""))
2576 enum machine_mode mode = alpha_compare_fp_p ? DFmode : DImode;
2577 operands[1] = gen_reg_rtx (mode);
2578 operands[2] = gen_rtx (LE, mode, alpha_compare_op0, alpha_compare_op1);
2579 operands[3] = gen_rtx (NE, VOIDmode, operands[1], CONST0_RTX (mode));
2582 (define_expand "bgt"
2583 [(set (match_dup 1) (match_dup 2))
2585 (if_then_else (match_dup 3)
2586 (label_ref (match_operand 0 "" ""))
2591 if (alpha_compare_fp_p)
2593 operands[1] = gen_reg_rtx (DFmode);
2594 operands[2] = gen_rtx (LT, DFmode, alpha_compare_op1, alpha_compare_op0);
2595 operands[3] = gen_rtx (NE, VOIDmode, operands[1], CONST0_RTX (DFmode));
2599 operands[1] = gen_reg_rtx (DImode);
2600 operands[2] = gen_rtx (LE, DImode, alpha_compare_op0, alpha_compare_op1);
2601 operands[3] = gen_rtx (EQ, VOIDmode, operands[1], const0_rtx);
2605 (define_expand "bge"
2606 [(set (match_dup 1) (match_dup 2))
2608 (if_then_else (match_dup 3)
2609 (label_ref (match_operand 0 "" ""))
2614 if (alpha_compare_fp_p)
2616 operands[1] = gen_reg_rtx (DFmode);
2617 operands[2] = gen_rtx (LE, DFmode, alpha_compare_op1, alpha_compare_op0);
2618 operands[3] = gen_rtx (NE, VOIDmode, operands[1], CONST0_RTX (DFmode));
2622 operands[1] = gen_reg_rtx (DImode);
2623 operands[2] = gen_rtx (LT, DImode, alpha_compare_op0, alpha_compare_op1);
2624 operands[3] = gen_rtx (EQ, VOIDmode, operands[1], const0_rtx);
2628 (define_expand "bltu"
2629 [(set (match_dup 1) (match_dup 2))
2631 (if_then_else (match_dup 3)
2632 (label_ref (match_operand 0 "" ""))
2637 operands[1] = gen_reg_rtx (DImode);
2638 operands[2] = gen_rtx (LTU, DImode, alpha_compare_op0, alpha_compare_op1);
2639 operands[3] = gen_rtx (NE, VOIDmode, operands[1], const0_rtx);
2642 (define_expand "bleu"
2643 [(set (match_dup 1) (match_dup 2))
2645 (if_then_else (match_dup 3)
2646 (label_ref (match_operand 0 "" ""))
2651 operands[1] = gen_reg_rtx (DImode);
2652 operands[2] = gen_rtx (LEU, DImode, alpha_compare_op0, alpha_compare_op1);
2653 operands[3] = gen_rtx (NE, VOIDmode, operands[1], const0_rtx);
2656 (define_expand "bgtu"
2657 [(set (match_dup 1) (match_dup 2))
2659 (if_then_else (match_dup 3)
2660 (label_ref (match_operand 0 "" ""))
2665 operands[1] = gen_reg_rtx (DImode);
2666 operands[2] = gen_rtx (LEU, DImode, alpha_compare_op0, alpha_compare_op1);
2667 operands[3] = gen_rtx (EQ, VOIDmode, operands[1], const0_rtx);
2670 (define_expand "bgeu"
2671 [(set (match_dup 1) (match_dup 2))
2673 (if_then_else (match_dup 3)
2674 (label_ref (match_operand 0 "" ""))
2679 operands[1] = gen_reg_rtx (DImode);
2680 operands[2] = gen_rtx (LTU, DImode, alpha_compare_op0, alpha_compare_op1);
2681 operands[3] = gen_rtx (EQ, VOIDmode, operands[1], const0_rtx);
2684 (define_expand "seq"
2685 [(set (match_operand:DI 0 "register_operand" "")
2690 if (alpha_compare_fp_p)
2693 operands[1] = gen_rtx (EQ, DImode, alpha_compare_op0, alpha_compare_op1);
2696 (define_expand "sne"
2697 [(set (match_operand:DI 0 "register_operand" "")
2699 (set (match_dup 0) (xor:DI (match_dup 0) (const_int 1)))]
2703 if (alpha_compare_fp_p)
2706 operands[1] = gen_rtx (EQ, DImode, alpha_compare_op0, alpha_compare_op1);
2709 (define_expand "slt"
2710 [(set (match_operand:DI 0 "register_operand" "")
2715 if (alpha_compare_fp_p)
2718 operands[1] = gen_rtx (LT, DImode, alpha_compare_op0, alpha_compare_op1);
2721 (define_expand "sle"
2722 [(set (match_operand:DI 0 "register_operand" "")
2727 if (alpha_compare_fp_p)
2730 operands[1] = gen_rtx (LE, DImode, alpha_compare_op0, alpha_compare_op1);
2733 (define_expand "sgt"
2734 [(set (match_operand:DI 0 "register_operand" "")
2739 if (alpha_compare_fp_p)
2742 operands[1] = gen_rtx (LT, DImode, force_reg (DImode, alpha_compare_op1),
2746 (define_expand "sge"
2747 [(set (match_operand:DI 0 "register_operand" "")
2752 if (alpha_compare_fp_p)
2755 operands[1] = gen_rtx (LE, DImode, force_reg (DImode, alpha_compare_op1),
2759 (define_expand "sltu"
2760 [(set (match_operand:DI 0 "register_operand" "")
2765 if (alpha_compare_fp_p)
2768 operands[1] = gen_rtx (LTU, DImode, alpha_compare_op0, alpha_compare_op1);
2771 (define_expand "sleu"
2772 [(set (match_operand:DI 0 "register_operand" "")
2777 if (alpha_compare_fp_p)
2780 operands[1] = gen_rtx (LEU, DImode, alpha_compare_op0, alpha_compare_op1);
2783 (define_expand "sgtu"
2784 [(set (match_operand:DI 0 "register_operand" "")
2789 if (alpha_compare_fp_p)
2792 operands[1] = gen_rtx (LTU, DImode, force_reg (DImode, alpha_compare_op1),
2796 (define_expand "sgeu"
2797 [(set (match_operand:DI 0 "register_operand" "")
2802 if (alpha_compare_fp_p)
2805 operands[1] = gen_rtx (LEU, DImode, force_reg (DImode, alpha_compare_op1),
2809 ;; These are the main define_expand's used to make conditional moves.
2811 (define_expand "movsicc"
2812 [(set (match_operand:SI 0 "register_operand" "")
2813 (if_then_else:DI (match_operand 1 "comparison_operator" "")
2814 (match_operand:SI 2 "reg_or_8bit_operand" "")
2815 (match_operand:SI 3 "reg_or_8bit_operand" "")))]
2819 if ((operands[1] = alpha_emit_conditional_move (operands[1], SImode)) == 0)
2823 (define_expand "movdicc"
2824 [(set (match_operand:DI 0 "register_operand" "")
2825 (if_then_else:DI (match_operand 1 "comparison_operator" "")
2826 (match_operand:DI 2 "reg_or_8bit_operand" "")
2827 (match_operand:DI 3 "reg_or_8bit_operand" "")))]
2831 if ((operands[1] = alpha_emit_conditional_move (operands[1], DImode)) == 0)
2835 (define_expand "movsfcc"
2836 [(set (match_operand:SF 0 "register_operand" "")
2837 (if_then_else:SF (match_operand 1 "comparison_operator" "")
2838 (match_operand:SF 2 "reg_or_8bit_operand" "")
2839 (match_operand:SF 3 "reg_or_8bit_operand" "")))]
2843 if ((operands[1] = alpha_emit_conditional_move (operands[1], SFmode)) == 0)
2847 (define_expand "movdfcc"
2848 [(set (match_operand:DF 0 "register_operand" "")
2849 (if_then_else:DF (match_operand 1 "comparison_operator" "")
2850 (match_operand:DF 2 "reg_or_8bit_operand" "")
2851 (match_operand:DF 3 "reg_or_8bit_operand" "")))]
2855 if ((operands[1] = alpha_emit_conditional_move (operands[1], DFmode)) == 0)
2859 ;; These define_split definitions are used in cases when comparisons have
2860 ;; not be stated in the correct way and we need to reverse the second
2861 ;; comparison. For example, x >= 7 has to be done as x < 6 with the
2862 ;; comparison that tests the result being reversed. We have one define_split
2863 ;; for each use of a comparison. They do not match valid insns and need
2864 ;; not generate valid insns.
2866 ;; We can also handle equality comparisons (and inequality comparisons in
2867 ;; cases where the resulting add cannot overflow) by doing an add followed by
2868 ;; a comparison with zero. This is faster since the addition takes one
2869 ;; less cycle than a compare when feeding into a conditional move.
2870 ;; For this case, we also have an SImode pattern since we can merge the add
2871 ;; and sign extend and the order doesn't matter.
2873 ;; We do not do this for floating-point, since it isn't clear how the "wrong"
2874 ;; operation could have been generated.
2877 [(set (match_operand:DI 0 "register_operand" "")
2879 (match_operator 1 "comparison_operator"
2880 [(match_operand:DI 2 "reg_or_0_operand" "")
2881 (match_operand:DI 3 "reg_or_cint_operand" "")])
2882 (match_operand:DI 4 "reg_or_cint_operand" "")
2883 (match_operand:DI 5 "reg_or_cint_operand" "")))
2884 (clobber (match_operand:DI 6 "register_operand" ""))]
2885 "operands[3] != const0_rtx"
2886 [(set (match_dup 6) (match_dup 7))
2888 (if_then_else:DI (match_dup 8) (match_dup 4) (match_dup 5)))]
2890 { enum rtx_code code = GET_CODE (operands[1]);
2891 int unsignedp = (code == GEU || code == LEU || code == GTU || code == LTU);
2893 /* If we are comparing for equality with a constant and that constant
2894 appears in the arm when the register equals the constant, use the
2895 register since that is more likely to match (and to produce better code
2898 if (code == EQ && GET_CODE (operands[3]) == CONST_INT
2899 && rtx_equal_p (operands[4], operands[3]))
2900 operands[4] = operands[2];
2902 else if (code == NE && GET_CODE (operands[3]) == CONST_INT
2903 && rtx_equal_p (operands[5], operands[3]))
2904 operands[5] = operands[2];
2906 if (code == NE || code == EQ
2907 || (extended_count (operands[2], DImode, unsignedp) >= 1
2908 && extended_count (operands[3], DImode, unsignedp) >= 1))
2910 if (GET_CODE (operands[3]) == CONST_INT)
2911 operands[7] = gen_rtx (PLUS, DImode, operands[2],
2912 GEN_INT (- INTVAL (operands[3])));
2914 operands[7] = gen_rtx (MINUS, DImode, operands[2], operands[3]);
2916 operands[8] = gen_rtx (code, VOIDmode, operands[6], const0_rtx);
2919 else if (code == EQ || code == LE || code == LT
2920 || code == LEU || code == LTU)
2922 operands[7] = gen_rtx (code, DImode, operands[2], operands[3]);
2923 operands[8] = gen_rtx (NE, VOIDmode, operands[6], const0_rtx);
2927 operands[7] = gen_rtx (reverse_condition (code), DImode, operands[2],
2929 operands[8] = gen_rtx (EQ, VOIDmode, operands[6], const0_rtx);
2934 [(set (match_operand:DI 0 "register_operand" "")
2936 (match_operator 1 "comparison_operator"
2937 [(match_operand:SI 2 "reg_or_0_operand" "")
2938 (match_operand:SI 3 "reg_or_cint_operand" "")])
2939 (match_operand:DI 4 "reg_or_8bit_operand" "")
2940 (match_operand:DI 5 "reg_or_8bit_operand" "")))
2941 (clobber (match_operand:DI 6 "register_operand" ""))]
2942 "operands[3] != const0_rtx
2943 && (GET_CODE (operands[1]) == EQ || GET_CODE (operands[1]) == NE)"
2944 [(set (match_dup 6) (match_dup 7))
2946 (if_then_else:DI (match_dup 8) (match_dup 4) (match_dup 5)))]
2948 { enum rtx_code code = GET_CODE (operands[1]);
2949 int unsignedp = (code == GEU || code == LEU || code == GTU || code == LTU);
2952 if ((code != NE && code != EQ
2953 && ! (extended_count (operands[2], DImode, unsignedp) >= 1
2954 && extended_count (operands[3], DImode, unsignedp) >= 1)))
2957 if (GET_CODE (operands[3]) == CONST_INT)
2958 tem = gen_rtx (PLUS, SImode, operands[2],
2959 GEN_INT (- INTVAL (operands[3])));
2961 tem = gen_rtx (MINUS, SImode, operands[2], operands[3]);
2963 operands[7] = gen_rtx (SIGN_EXTEND, DImode, tem);
2964 operands[8] = gen_rtx (GET_CODE (operands[1]), VOIDmode, operands[6],
2971 (match_operator 1 "comparison_operator"
2972 [(match_operand:DI 2 "reg_or_0_operand" "")
2973 (match_operand:DI 3 "reg_or_cint_operand" "")])
2974 (label_ref (match_operand 0 "" ""))
2976 (clobber (match_operand:DI 4 "register_operand" ""))]
2977 "operands[3] != const0_rtx"
2978 [(set (match_dup 4) (match_dup 5))
2979 (set (pc) (if_then_else (match_dup 6) (label_ref (match_dup 0)) (pc)))]
2981 { enum rtx_code code = GET_CODE (operands[1]);
2982 int unsignedp = (code == GEU || code == LEU || code == GTU || code == LTU);
2984 if (code == NE || code == EQ
2985 || (extended_count (operands[2], DImode, unsignedp) >= 1
2986 && extended_count (operands[3], DImode, unsignedp) >= 1))
2988 if (GET_CODE (operands[3]) == CONST_INT)
2989 operands[5] = gen_rtx (PLUS, DImode, operands[2],
2990 GEN_INT (- INTVAL (operands[3])));
2992 operands[5] = gen_rtx (MINUS, DImode, operands[2], operands[3]);
2994 operands[6] = gen_rtx (code, VOIDmode, operands[4], const0_rtx);
2997 else if (code == EQ || code == LE || code == LT
2998 || code == LEU || code == LTU)
3000 operands[5] = gen_rtx (code, DImode, operands[2], operands[3]);
3001 operands[6] = gen_rtx (NE, VOIDmode, operands[4], const0_rtx);
3005 operands[5] = gen_rtx (reverse_condition (code), DImode, operands[2],
3007 operands[6] = gen_rtx (EQ, VOIDmode, operands[4], const0_rtx);
3014 (match_operator 1 "comparison_operator"
3015 [(match_operand:SI 2 "reg_or_0_operand" "")
3016 (match_operand:SI 3 "const_int_operand" "")])
3017 (label_ref (match_operand 0 "" ""))
3019 (clobber (match_operand:DI 4 "register_operand" ""))]
3020 "operands[3] != const0_rtx
3021 && (GET_CODE (operands[1]) == EQ || GET_CODE (operands[1]) == NE)"
3022 [(set (match_dup 4) (match_dup 5))
3023 (set (pc) (if_then_else (match_dup 6) (label_ref (match_dup 0)) (pc)))]
3027 if (GET_CODE (operands[3]) == CONST_INT)
3028 tem = gen_rtx (PLUS, SImode, operands[2],
3029 GEN_INT (- INTVAL (operands[3])));
3031 tem = gen_rtx (MINUS, SImode, operands[2], operands[3]);
3033 operands[5] = gen_rtx (SIGN_EXTEND, DImode, tem);
3034 operands[6] = gen_rtx (GET_CODE (operands[1]), VOIDmode,
3035 operands[4], const0_rtx);
3038 ;; We can convert such things as "a > 0xffff" to "t = a & ~ 0xffff; t != 0".
3039 ;; This eliminates one, and sometimes two, insns when the AND can be done
3042 [(set (match_operand:DI 0 "register_operand" "")
3043 (match_operator 1 "comparison_operator"
3044 [(match_operand:DI 2 "register_operand" "")
3045 (match_operand:DI 3 "const_int_operand" "")]))
3046 (clobber (match_operand:DI 4 "register_operand" ""))]
3047 "exact_log2 (INTVAL (operands[3]) + 1) >= 0
3048 && (GET_CODE (operands[1]) == GTU
3049 || GET_CODE (operands[1]) == LEU
3050 || ((GET_CODE (operands[1]) == GT || GET_CODE (operands[1]) == LE)
3051 && extended_count (operands[2], DImode, 1) > 0))"
3052 [(set (match_dup 4) (and:DI (match_dup 2) (match_dup 5)))
3053 (set (match_dup 0) (match_dup 6))]
3056 operands[5] = GEN_INT (~ INTVAL (operands[3]));
3057 operands[6] = gen_rtx (((GET_CODE (operands[1]) == GTU
3058 || GET_CODE (operands[1]) == GT)
3060 DImode, operands[4], const0_rtx);
3063 ;; Here are the CALL and unconditional branch insns. Calls on NT and OSF
3064 ;; work differently, so we have different patterns for each.
3066 (define_expand "call"
3067 [(use (match_operand:DI 0 "" ""))
3068 (use (match_operand 1 "" ""))
3069 (use (match_operand 2 "" ""))
3070 (use (match_operand 3 "" ""))]
3073 { if (TARGET_WINDOWS_NT)
3074 emit_call_insn (gen_call_nt (operands[0], operands[1]));
3075 else if (TARGET_OPEN_VMS)
3076 emit_call_insn (gen_call_vms (operands[0], operands[2]));
3078 emit_call_insn (gen_call_osf (operands[0], operands[1]));
3083 (define_expand "call_osf"
3084 [(parallel [(call (mem:DI (match_operand 0 "" ""))
3085 (match_operand 1 "" ""))
3086 (clobber (reg:DI 27))
3087 (clobber (reg:DI 26))])]
3090 { if (GET_CODE (operands[0]) != MEM)
3093 operands[0] = XEXP (operands[0], 0);
3095 if (GET_CODE (operands[0]) != SYMBOL_REF
3096 && ! (GET_CODE (operands[0]) == REG && REGNO (operands[0]) == 27))
3098 rtx tem = gen_rtx (REG, DImode, 27);
3099 emit_move_insn (tem, operands[0]);
3104 (define_expand "call_nt"
3105 [(parallel [(call (mem:DI (match_operand:DI 0 "" ""))
3106 (match_operand 1 "" ""))
3107 (clobber (reg:DI 26))])]
3110 { if (GET_CODE (operands[0]) != MEM)
3112 operands[0] = XEXP (operands[0], 0);
3114 if (GET_CODE (operands[1]) != SYMBOL_REF
3115 && ! (GET_CODE (operands[1]) == REG && REGNO (operands[1]) == 27))
3117 rtx tem = gen_rtx (REG, DImode, 27);
3118 emit_move_insn (tem, operands[1]);
3124 ;; call openvms/alpha
3125 ;; op 0: symbol ref for called function
3126 ;; op 1: next_arg_reg (argument information value for R25)
3128 (define_expand "call_vms"
3129 [(parallel [(call (mem:DI (match_operand 0 "" ""))
3130 (match_operand 1 "" ""))
3134 (clobber (reg:DI 27))])]
3137 { if (GET_CODE (operands[0]) != MEM)
3140 operands[0] = XEXP (operands[0], 0);
3142 /* Always load AI with argument information, then handle symbolic and
3143 indirect call differently. Load RA and set operands[2] to PV in
3146 emit_move_insn (gen_rtx (REG, DImode, 25), operands[1]);
3147 if (GET_CODE (operands[0]) == SYMBOL_REF)
3149 extern char *savealloc ();
3150 char *symbol = XSTR (operands[0], 0);
3151 char *linksym = savealloc (strlen (symbol) + 5);
3154 alpha_need_linkage (symbol, 0);
3156 strcpy (linksym, symbol);
3157 strcat (linksym, \"..lk\");
3158 linkage = gen_rtx (SYMBOL_REF, Pmode, linksym);
3160 emit_move_insn (gen_rtx (REG, Pmode, 26), gen_rtx (MEM, Pmode, linkage));
3163 = validize_mem (gen_rtx (MEM, Pmode, plus_constant (linkage, 8)));
3167 emit_move_insn (gen_rtx (REG, Pmode, 26),
3168 gen_rtx (MEM, Pmode, plus_constant (operands[0], 8)));
3170 operands[2] = operands[0];
3175 (define_expand "call_value"
3176 [(use (match_operand 0 "" ""))
3177 (use (match_operand:DI 1 "" ""))
3178 (use (match_operand 2 "" ""))
3179 (use (match_operand 3 "" ""))
3180 (use (match_operand 4 "" ""))]
3183 { if (TARGET_WINDOWS_NT)
3184 emit_call_insn (gen_call_value_nt (operands[0], operands[1], operands[2]));
3185 else if (TARGET_OPEN_VMS)
3186 emit_call_insn (gen_call_value_vms (operands[0], operands[1],
3189 emit_call_insn (gen_call_value_osf (operands[0], operands[1],
3194 (define_expand "call_value_osf"
3195 [(parallel [(set (match_operand 0 "" "")
3196 (call (mem:DI (match_operand 1 "" ""))
3197 (match_operand 2 "" "")))
3198 (clobber (reg:DI 27))
3199 (clobber (reg:DI 26))])]
3202 { if (GET_CODE (operands[1]) != MEM)
3205 operands[1] = XEXP (operands[1], 0);
3207 if (GET_CODE (operands[1]) != SYMBOL_REF
3208 && ! (GET_CODE (operands[1]) == REG && REGNO (operands[1]) == 27))
3210 rtx tem = gen_rtx (REG, DImode, 27);
3211 emit_move_insn (tem, operands[1]);
3216 (define_expand "call_value_nt"
3217 [(parallel [(set (match_operand 0 "" "")
3218 (call (mem:DI (match_operand:DI 1 "" ""))
3219 (match_operand 2 "" "")))
3220 (clobber (reg:DI 26))])]
3223 { if (GET_CODE (operands[1]) != MEM)
3226 operands[1] = XEXP (operands[1], 0);
3227 if (GET_CODE (operands[1]) != SYMBOL_REF
3228 && ! (GET_CODE (operands[1]) == REG && REGNO (operands[1]) == 27))
3230 rtx tem = gen_rtx (REG, DImode, 27);
3231 emit_move_insn (tem, operands[1]);
3236 (define_expand "call_value_vms"
3237 [(parallel [(set (match_operand 0 "" "")
3238 (call (mem:DI (match_operand:DI 1 "" ""))
3239 (match_operand 2 "" "")))
3243 (clobber (reg:DI 27))])]
3246 { if (GET_CODE (operands[1]) != MEM)
3249 operands[1] = XEXP (operands[1], 0);
3251 /* Always load AI with argument information, then handle symbolic and
3252 indirect call differently. Load RA and set operands[3] to PV in
3255 emit_move_insn (gen_rtx (REG, DImode, 25), operands[2]);
3256 if (GET_CODE (operands[1]) == SYMBOL_REF)
3258 extern char *savealloc ();
3259 char *symbol = XSTR (operands[1], 0);
3260 char *linksym = savealloc (strlen (symbol) + 5);
3263 alpha_need_linkage (symbol, 0);
3264 strcpy (linksym, symbol);
3265 strcat (linksym, \"..lk\");
3266 linkage = gen_rtx (SYMBOL_REF, Pmode, linksym);
3268 emit_move_insn (gen_rtx (REG, Pmode, 26), gen_rtx (MEM, Pmode, linkage));
3271 = validize_mem (gen_rtx (MEM, Pmode, plus_constant (linkage, 8)));
3275 emit_move_insn (gen_rtx (REG, Pmode, 26),
3276 gen_rtx (MEM, Pmode, plus_constant (operands[1], 8)));
3278 operands[3] = operands[1];
3283 [(call (mem:DI (match_operand:DI 0 "call_operand" "r,R,i"))
3284 (match_operand 1 "" ""))
3285 (clobber (reg:DI 27))
3286 (clobber (reg:DI 26))]
3287 "! TARGET_WINDOWS_NT && ! TARGET_OPEN_VMS"
3289 jsr $26,($27),0\;ldgp $29,0($26)
3291 jsr $26,%0\;ldgp $29,0($26)"
3292 [(set_attr "type" "jsr,jsr,ibr")])
3295 [(call (mem:DI (match_operand:DI 0 "call_operand" "r,i"))
3296 (match_operand 1 "" ""))
3297 (clobber (reg:DI 26))]
3302 [(set_attr "type" "jsr")])
3305 [(call (mem:DI (match_operand:DI 0 "call_operand" "r,i"))
3306 (match_operand 1 "" ""))
3307 (use (match_operand:DI 2 "general_operand" "r,m"))
3310 (clobber (reg:DI 27))]
3313 bis %2,%2,$27\;jsr $26,0\;ldq $27,0($29)
3314 ldq $27,%2\;jsr $26,%0\;ldq $27,0($29)"
3315 [(set_attr "type" "jsr")])
3318 [(set (match_operand 0 "register_operand" "=rf,rf,rf")
3319 (call (mem:DI (match_operand:DI 1 "call_operand" "r,R,i"))
3320 (match_operand 2 "" "")))
3321 (clobber (reg:DI 27))
3322 (clobber (reg:DI 26))]
3323 "! TARGET_WINDOWS_NT && ! TARGET_OPEN_VMS"
3325 jsr $26,($27),0\;ldgp $29,0($26)
3327 jsr $26,%1\;ldgp $29,0($26)"
3328 [(set_attr "type" "jsr,jsr,ibr")])
3331 [(set (match_operand 0 "register_operand" "=rf,rf")
3332 (call (mem:DI (match_operand:DI 1 "call_operand" "r,i"))
3333 (match_operand 2 "" "")))
3334 (clobber (reg:DI 26))]
3339 [(set_attr "type" "jsr")])
3342 [(set (match_operand 0 "register_operand" "")
3343 (call (mem:DI (match_operand:DI 1 "call_operand" "r,i"))
3344 (match_operand 2 "" "")))
3345 (use (match_operand:DI 3 "general_operand" "r,m"))
3348 (clobber (reg:DI 27))]
3351 bis %3,%3,$27\;jsr $26,0\;ldq $27,0($29)
3352 ldq $27,%3\;jsr $26,%1\;ldq $27,0($29)"
3353 [(set_attr "type" "jsr")])
3355 ;; Call subroutine returning any type.
3357 (define_expand "untyped_call"
3358 [(parallel [(call (match_operand 0 "" "")
3360 (match_operand 1 "" "")
3361 (match_operand 2 "" "")])]
3367 emit_call_insn (gen_call (operands[0], const0_rtx, NULL, const0_rtx));
3369 for (i = 0; i < XVECLEN (operands[2], 0); i++)
3371 rtx set = XVECEXP (operands[2], 0, i);
3372 emit_move_insn (SET_DEST (set), SET_SRC (set));
3375 /* The optimizer does not know that the call sets the function value
3376 registers we stored in the result block. We avoid problems by
3377 claiming that all hard registers are used and clobbered at this
3379 emit_insn (gen_blockage ());
3384 ;; UNSPEC_VOLATILE is considered to use and clobber all hard registers and
3385 ;; all of memory. This blocks insns from being moved across this point.
3387 (define_insn "blockage"
3388 [(unspec_volatile [(const_int 0)] 1)]
3394 (label_ref (match_operand 0 "" "")))]
3397 [(set_attr "type" "ibr")])
3399 (define_insn "return"
3403 [(set_attr "type" "ibr")])
3405 (define_insn "indirect_jump"
3406 [(set (pc) (match_operand:DI 0 "register_operand" "r"))]
3409 [(set_attr "type" "ibr")])
3415 [(set_attr "type" "ilog")])
3417 (define_expand "tablejump"
3418 [(use (match_operand:SI 0 "register_operand" ""))
3419 (use (match_operand:SI 1 "" ""))]
3423 if (TARGET_WINDOWS_NT)
3424 emit_jump_insn (gen_tablejump_nt (operands[0], operands[1]));
3425 else if (TARGET_OPEN_VMS)
3426 emit_jump_insn (gen_tablejump_vms (operands[0], operands[1]));
3428 emit_jump_insn (gen_tablejump_osf (operands[0], operands[1]));
3433 (define_expand "tablejump_osf"
3435 (sign_extend:DI (match_operand:SI 0 "register_operand" "")))
3436 (parallel [(set (pc)
3437 (plus:DI (match_dup 3)
3438 (label_ref:DI (match_operand 1 "" ""))))
3439 (clobber (match_scratch:DI 2 "=r"))])]
3442 { operands[3] = gen_reg_rtx (DImode); }")
3444 (define_expand "tablejump_nt"
3446 (sign_extend:DI (match_operand:SI 0 "register_operand" "")))
3447 (parallel [(set (pc)
3449 (use (label_ref (match_operand 1 "" "")))])]
3452 { operands[3] = gen_reg_rtx (DImode); }")
3455 ;; tablejump, openVMS way
3457 ;; op 1: label preceding jump-table
3459 (define_expand "tablejump_vms"
3461 (match_operand:DI 0 "register_operand" ""))
3463 (plus:DI (match_dup 2)
3464 (label_ref:DI (match_operand 1 "" ""))))]
3467 { operands[2] = gen_reg_rtx (DImode); }")
3471 (plus:DI (match_operand:DI 0 "register_operand" "r")
3472 (label_ref:DI (match_operand 1 "" ""))))
3473 (clobber (match_scratch:DI 2 "=r"))]
3474 "! TARGET_WINDOWS_NT && ! TARGET_OPEN_VMS && next_active_insn (insn) != 0
3475 && GET_CODE (PATTERN (next_active_insn (insn))) == ADDR_DIFF_VEC
3476 && PREV_INSN (next_active_insn (insn)) == operands[1]"
3478 { rtx best_label = 0;
3479 rtx jump_table_insn = next_active_insn (operands[1]);
3481 if (GET_CODE (jump_table_insn) == JUMP_INSN
3482 && GET_CODE (PATTERN (jump_table_insn)) == ADDR_DIFF_VEC)
3484 rtx jump_table = PATTERN (jump_table_insn);
3485 int n_labels = XVECLEN (jump_table, 1);
3486 int best_count = -1;
3489 for (i = 0; i < n_labels; i++)
3493 for (j = i + 1; j < n_labels; j++)
3494 if (XEXP (XVECEXP (jump_table, 1, i), 0)
3495 == XEXP (XVECEXP (jump_table, 1, j), 0))
3498 if (count > best_count)
3499 best_count = count, best_label = XVECEXP (jump_table, 1, i);
3505 operands[3] = best_label;
3506 return \"addq %0,$29,%2\;jmp $31,(%2),%3\";
3509 return \"addq %0,$29,%2\;jmp $31,(%2),0\";
3511 [(set_attr "type" "ibr")])
3515 (match_operand:DI 0 "register_operand" "r"))
3516 (use (label_ref (match_operand 1 "" "")))]
3517 "TARGET_WINDOWS_NT && next_active_insn (insn) != 0
3518 && GET_CODE (PATTERN (next_active_insn (insn))) == ADDR_DIFF_VEC
3519 && PREV_INSN (next_active_insn (insn)) == operands[1]"
3521 { rtx best_label = 0;
3522 rtx jump_table_insn = next_active_insn (operands[1]);
3524 if (GET_CODE (jump_table_insn) == JUMP_INSN
3525 && GET_CODE (PATTERN (jump_table_insn)) == ADDR_DIFF_VEC)
3527 rtx jump_table = PATTERN (jump_table_insn);
3528 int n_labels = XVECLEN (jump_table, 1);
3529 int best_count = -1;
3532 for (i = 0; i < n_labels; i++)
3536 for (j = i + 1; j < n_labels; j++)
3537 if (XEXP (XVECEXP (jump_table, 1, i), 0)
3538 == XEXP (XVECEXP (jump_table, 1, j), 0))
3541 if (count > best_count)
3542 best_count = count, best_label = XVECEXP (jump_table, 1, i);
3548 operands[2] = best_label;
3549 return \"jmp $31,(%0),%2\";
3552 return \"jmp $31,(%0),0\";
3554 [(set_attr "type" "ibr")])
3557 ;; op 0 is table offset
3558 ;; op 1 is table label
3563 (plus:DI (match_operand 0 "register_operand" "r")
3564 (label_ref (match_operand 1 "" ""))))]
3567 [(set_attr "type" "ibr")])
3569 ;; Cache flush. Used by INITIALIZE_TRAMPOLINE. 0x86 is PAL_imb, but we don't
3570 ;; want to have to include pal.h in our .s file.
3572 [(unspec_volatile [(const_int 0)] 0)]
3575 [(set_attr "type" "isubr")])
3577 ;; Finally, we have the basic data motion insns. The byte and word insns
3578 ;; are done via define_expand. Start with the floating-point insns, since
3579 ;; they are simpler.
3582 [(set (match_operand:SF 0 "nonimmediate_operand" "=r,r,m,f,f,f,m")
3583 (match_operand:SF 1 "input_operand" "rG,m,rG,f,G,m,fG"))]
3584 "register_operand (operands[0], SFmode)
3585 || reg_or_fp0_operand (operands[1], SFmode)"
3594 [(set_attr "type" "ilog,ld,st,fcpys,fcpys,ld,st")])
3597 [(set (match_operand:DF 0 "nonimmediate_operand" "=r,r,m,f,f,f,m")
3598 (match_operand:DF 1 "input_operand" "rG,m,rG,f,G,m,fG"))]
3599 "register_operand (operands[0], DFmode)
3600 || reg_or_fp0_operand (operands[1], DFmode)"
3609 [(set_attr "type" "ilog,ld,st,fcpys,fcpys,ld,st")])
3611 (define_expand "movsf"
3612 [(set (match_operand:SF 0 "nonimmediate_operand" "")
3613 (match_operand:SF 1 "general_operand" ""))]
3617 if (GET_CODE (operands[0]) == MEM
3618 && ! reg_or_fp0_operand (operands[1], SFmode))
3619 operands[1] = force_reg (SFmode, operands[1]);
3622 (define_expand "movdf"
3623 [(set (match_operand:DF 0 "nonimmediate_operand" "")
3624 (match_operand:DF 1 "general_operand" ""))]
3628 if (GET_CODE (operands[0]) == MEM
3629 && ! reg_or_fp0_operand (operands[1], DFmode))
3630 operands[1] = force_reg (DFmode, operands[1]);
3634 [(set (match_operand:SI 0 "nonimmediate_operand" "=r,r,r,r,r,r,m,f,f,f,m")
3635 (match_operand:SI 1 "input_operand" "r,J,I,K,L,m,rJ,f,J,m,fG"))]
3636 "! TARGET_WINDOWS_NT && ! TARGET_OPEN_VMS
3637 && (register_operand (operands[0], SImode)
3638 || reg_or_0_operand (operands[1], SImode))"
3651 [(set_attr "type" "ilog,ilog,ilog,iadd,iadd,ld,st,fcpys,fcpys,ld,st")])
3654 [(set (match_operand:SI 0 "nonimmediate_operand" "=r,r,r,r,r,r,r,m,f,f,f,m")
3655 (match_operand:SI 1 "input_operand" "r,J,I,K,L,s,m,rJ,f,J,m,fG"))]
3656 "(TARGET_WINDOWS_NT || TARGET_OPEN_VMS)
3657 && (register_operand (operands[0], SImode)
3658 || reg_or_0_operand (operands[1], SImode))"
3672 [(set_attr "type" "ilog,ilog,ilog,iadd,iadd,ldsym,ld,st,fcpys,fcpys,ld,st")])
3675 [(set (match_operand:HI 0 "nonimmediate_operand" "=r,r,r,r,f,f")
3676 (match_operand:HI 1 "input_operand" "r,J,I,n,f,J"))]
3678 && (register_operand (operands[0], HImode)
3679 || register_operand (operands[1], HImode))"
3687 [(set_attr "type" "ilog,ilog,ilog,iadd,fcpys,fcpys")])
3690 [(set (match_operand:HI 0 "nonimmediate_operand" "=r,r,r,r,r,m,f,f")
3691 (match_operand:HI 1 "input_operand" "r,J,I,n,m,rJ,f,J"))]
3693 && (register_operand (operands[0], HImode)
3694 || reg_or_0_operand (operands[1], HImode))"
3704 [(set_attr "type" "ilog,ilog,ilog,iadd,ld,st,fcpys,fcpys")])
3707 [(set (match_operand:QI 0 "nonimmediate_operand" "=r,r,r,r,f,f")
3708 (match_operand:QI 1 "input_operand" "r,J,I,n,f,J"))]
3710 && (register_operand (operands[0], QImode)
3711 || register_operand (operands[1], QImode))"
3719 [(set_attr "type" "ilog,ilog,ilog,iadd,fcpys,fcpys")])
3722 [(set (match_operand:QI 0 "nonimmediate_operand" "=r,r,r,r,r,m,f,f")
3723 (match_operand:QI 1 "input_operand" "r,J,I,n,m,rJ,f,J"))]
3725 && (register_operand (operands[0], QImode)
3726 || reg_or_0_operand (operands[1], QImode))"
3736 [(set_attr "type" "ilog,ilog,ilog,iadd,ld,st,fcpys,fcpys")])
3738 ;; We do two major things here: handle mem->mem and construct long
3741 (define_expand "movsi"
3742 [(set (match_operand:SI 0 "general_operand" "")
3743 (match_operand:SI 1 "general_operand" ""))]
3747 if (GET_CODE (operands[0]) == MEM
3748 && ! reg_or_0_operand (operands[1], SImode))
3749 operands[1] = force_reg (SImode, operands[1]);
3751 if (! CONSTANT_P (operands[1]) || input_operand (operands[1], SImode))
3753 else if (GET_CODE (operands[1]) == CONST_INT)
3756 = alpha_emit_set_const (operands[0], SImode, INTVAL (operands[1]), 3);
3757 if (rtx_equal_p (operands[0], operands[1]))
3762 ;; Split a load of a large constant into the appropriate two-insn
3766 [(set (match_operand:SI 0 "register_operand" "")
3767 (match_operand:SI 1 "const_int_operand" ""))]
3768 "! add_operand (operands[1], SImode)"
3769 [(set (match_dup 0) (match_dup 2))
3770 (set (match_dup 0) (plus:SI (match_dup 0) (match_dup 3)))]
3773 = alpha_emit_set_const (operands[0], SImode, INTVAL (operands[1]), 2);
3775 if (tem == operands[0])
3782 [(set (match_operand:DI 0 "general_operand" "=r,r,r,r,r,r,r,m,f,f,f,Q")
3783 (match_operand:DI 1 "input_operand" "r,J,I,K,L,s,m,rJ,f,J,Q,fG"))]
3784 "register_operand (operands[0], DImode)
3785 || reg_or_0_operand (operands[1], DImode)"
3799 [(set_attr "type" "ilog,ilog,ilog,iadd,iadd,ldsym,ld,st,fcpys,fcpys,ld,st")])
3801 ;; We do three major things here: handle mem->mem, put 64-bit constants in
3802 ;; memory, and construct long 32-bit constants.
3804 (define_expand "movdi"
3805 [(set (match_operand:DI 0 "general_operand" "")
3806 (match_operand:DI 1 "general_operand" ""))]
3812 if (GET_CODE (operands[0]) == MEM
3813 && ! reg_or_0_operand (operands[1], DImode))
3814 operands[1] = force_reg (DImode, operands[1]);
3816 if (! CONSTANT_P (operands[1]) || input_operand (operands[1], DImode))
3818 else if (GET_CODE (operands[1]) == CONST_INT
3819 && (tem = alpha_emit_set_const (operands[0], DImode,
3820 INTVAL (operands[1]), 3)) != 0)
3822 if (rtx_equal_p (tem, operands[0]))
3827 else if (CONSTANT_P (operands[1]))
3829 if (TARGET_BUILD_CONSTANTS)
3831 #if HOST_BITS_PER_WIDE_INT == 64
3834 if (GET_CODE (operands[1]) == CONST_INT)
3835 i = INTVAL (operands[1]);
3836 else if (GET_CODE (operands[1]) == CONST_DOUBLE)
3837 i = CONST_DOUBLE_LOW (operands[1]);
3841 tem = alpha_emit_set_long_const (operands[0], i);
3842 if (rtx_equal_p (tem, operands[0]))
3852 operands[1] = force_const_mem (DImode, operands[1]);
3853 if (reload_in_progress)
3855 emit_move_insn (operands[0], XEXP (operands[1], 0));
3856 operands[1] = copy_rtx (operands[1]);
3857 XEXP (operands[1], 0) = operands[0];
3860 operands[1] = validize_mem (operands[1]);
3867 ;; Split a load of a large constant into the appropriate two-insn
3871 [(set (match_operand:DI 0 "register_operand" "")
3872 (match_operand:DI 1 "const_int_operand" ""))]
3873 "! add_operand (operands[1], DImode)"
3874 [(set (match_dup 0) (match_dup 2))
3875 (set (match_dup 0) (plus:DI (match_dup 0) (match_dup 3)))]
3878 = alpha_emit_set_const (operands[0], DImode, INTVAL (operands[1]), 2);
3880 if (tem == operands[0])
3886 ;; These are the partial-word cases.
3888 ;; First we have the code to load an aligned word. Operand 0 is the register
3889 ;; in which to place the result. It's mode is QImode or HImode. Operand 1
3890 ;; is an SImode MEM at the low-order byte of the proper word. Operand 2 is the
3891 ;; number of bits within the word that the value is. Operand 3 is an SImode
3892 ;; scratch register. If operand 0 is a hard register, operand 3 may be the
3893 ;; same register. It is allowed to conflict with operand 1 as well.
3895 (define_expand "aligned_loadqi"
3896 [(set (match_operand:SI 3 "register_operand" "")
3897 (match_operand:SI 1 "memory_operand" ""))
3898 (set (subreg:DI (match_operand:QI 0 "register_operand" "") 0)
3899 (zero_extract:DI (subreg:DI (match_dup 3) 0)
3901 (match_operand:DI 2 "const_int_operand" "")))]
3906 (define_expand "aligned_loadhi"
3907 [(set (match_operand:SI 3 "register_operand" "")
3908 (match_operand:SI 1 "memory_operand" ""))
3909 (set (subreg:DI (match_operand:HI 0 "register_operand" "") 0)
3910 (zero_extract:DI (subreg:DI (match_dup 3) 0)
3912 (match_operand:DI 2 "const_int_operand" "")))]
3917 ;; Similar for unaligned loads, where we use the sequence from the
3918 ;; Alpha Architecture manual.
3920 ;; Operand 1 is the address. Operands 2 and 3 are temporaries, where
3921 ;; operand 3 can overlap the input and output registers.
3923 (define_expand "unaligned_loadqi"
3924 [(set (match_operand:DI 2 "register_operand" "")
3925 (mem:DI (and:DI (match_operand:DI 1 "address_operand" "")
3927 (set (match_operand:DI 3 "register_operand" "")
3929 (set (subreg:DI (match_operand:QI 0 "register_operand" "") 0)
3930 (zero_extract:DI (match_dup 2)
3932 (ashift:DI (match_dup 3) (const_int 3))))]
3936 (define_expand "unaligned_loadhi"
3937 [(set (match_operand:DI 2 "register_operand" "")
3938 (mem:DI (and:DI (match_operand:DI 1 "address_operand" "")
3940 (set (match_operand:DI 3 "register_operand" "")
3942 (set (subreg:DI (match_operand:QI 0 "register_operand" "") 0)
3943 (zero_extract:DI (match_dup 2)
3945 (ashift:DI (match_dup 3) (const_int 3))))]
3949 ;; Storing an aligned byte or word requires two temporaries. Operand 0 is the
3950 ;; aligned SImode MEM. Operand 1 is the register containing the
3951 ;; byte or word to store. Operand 2 is the number of bits within the word that
3952 ;; the value should be placed. Operands 3 and 4 are SImode temporaries.
3954 (define_expand "aligned_store"
3955 [(set (match_operand:SI 3 "register_operand" "")
3956 (match_operand:SI 0 "memory_operand" ""))
3957 (set (subreg:DI (match_dup 3) 0)
3958 (and:DI (subreg:DI (match_dup 3) 0) (match_dup 5)))
3959 (set (subreg:DI (match_operand:SI 4 "register_operand" "") 0)
3960 (ashift:DI (zero_extend:DI (match_operand 1 "register_operand" ""))
3961 (match_operand:DI 2 "const_int_operand" "")))
3962 (set (subreg:DI (match_dup 4) 0)
3963 (ior:DI (subreg:DI (match_dup 4) 0) (subreg:DI (match_dup 3) 0)))
3964 (set (match_dup 0) (match_dup 4))]
3967 { operands[5] = GEN_INT (~ (GET_MODE_MASK (GET_MODE (operands[1]))
3968 << INTVAL (operands[2])));
3971 ;; For the unaligned byte and halfword cases, we use code similar to that
3972 ;; in the ;; Architecture book, but reordered to lower the number of registers
3973 ;; required. Operand 0 is the address. Operand 1 is the data to store.
3974 ;; Operands 2, 3, and 4 are DImode temporaries, where operands 2 and 4 may
3975 ;; be the same temporary, if desired. If the address is in a register,
3976 ;; operand 2 can be that register.
3978 (define_expand "unaligned_storeqi"
3979 [(set (match_operand:DI 3 "register_operand" "")
3980 (mem:DI (and:DI (match_operand:DI 0 "address_operand" "")
3982 (set (match_operand:DI 2 "register_operand" "")
3985 (and:DI (not:DI (ashift:DI (const_int 255)
3986 (ashift:DI (match_dup 2) (const_int 3))))
3988 (set (match_operand:DI 4 "register_operand" "")
3989 (ashift:DI (zero_extend:DI (match_operand:QI 1 "register_operand" ""))
3990 (ashift:DI (match_dup 2) (const_int 3))))
3991 (set (match_dup 4) (ior:DI (match_dup 4) (match_dup 3)))
3992 (set (mem:DI (and:DI (match_dup 0) (const_int -8)))
3997 (define_expand "unaligned_storehi"
3998 [(set (match_operand:DI 3 "register_operand" "")
3999 (mem:DI (and:DI (match_operand:DI 0 "address_operand" "")
4001 (set (match_operand:DI 2 "register_operand" "")
4004 (and:DI (not:DI (ashift:DI (const_int 65535)
4005 (ashift:DI (match_dup 2) (const_int 3))))
4007 (set (match_operand:DI 4 "register_operand" "")
4008 (ashift:DI (zero_extend:DI (match_operand:HI 1 "register_operand" ""))
4009 (ashift:DI (match_dup 2) (const_int 3))))
4010 (set (match_dup 4) (ior:DI (match_dup 4) (match_dup 3)))
4011 (set (mem:DI (and:DI (match_dup 0) (const_int -8)))
4016 ;; Here are the define_expand's for QI and HI moves that use the above
4017 ;; patterns. We have the normal sets, plus the ones that need scratch
4018 ;; registers for reload.
4020 (define_expand "movqi"
4021 [(set (match_operand:QI 0 "general_operand" "")
4022 (match_operand:QI 1 "general_operand" ""))]
4025 { extern rtx get_unaligned_address ();
4027 if (TARGET_BYTE_OPS)
4029 if (GET_CODE (operands[0]) == MEM
4030 && ! reg_or_0_operand (operands[1], QImode))
4031 operands[1] = force_reg (QImode, operands[1]);
4033 if (GET_CODE (operands[1]) == CONST_INT
4034 && ! input_operand (operands[1], QImode))
4036 operands[1] = alpha_emit_set_const (operands[0], QImode,
4037 INTVAL (operands[1]), 3);
4039 if (rtx_equal_p (operands[0], operands[1]))
4046 /* If the output is not a register, the input must be. */
4047 if (GET_CODE (operands[0]) == MEM)
4048 operands[1] = force_reg (QImode, operands[1]);
4050 /* Handle four memory cases, unaligned and aligned for either the input
4051 or the output. The only case where we can be called during reload is
4052 for aligned loads; all other cases require temporaries. */
4054 if (GET_CODE (operands[1]) == MEM
4055 || (GET_CODE (operands[1]) == SUBREG
4056 && GET_CODE (SUBREG_REG (operands[1])) == MEM)
4057 || (reload_in_progress && GET_CODE (operands[1]) == REG
4058 && REGNO (operands[1]) >= FIRST_PSEUDO_REGISTER)
4059 || (reload_in_progress && GET_CODE (operands[1]) == SUBREG
4060 && GET_CODE (SUBREG_REG (operands[1])) == REG
4061 && REGNO (SUBREG_REG (operands[1])) >= FIRST_PSEUDO_REGISTER))
4063 if (aligned_memory_operand (operands[1], QImode))
4065 rtx aligned_mem, bitnum;
4066 rtx scratch = (reload_in_progress
4067 ? gen_rtx (REG, SImode, REGNO (operands[0]))
4068 : gen_reg_rtx (SImode));
4070 get_aligned_mem (operands[1], &aligned_mem, &bitnum);
4072 emit_insn (gen_aligned_loadqi (operands[0], aligned_mem, bitnum,
4077 /* Don't pass these as parameters since that makes the generated
4078 code depend on parameter evaluation order which will cause
4079 bootstrap failures. */
4081 rtx temp1 = gen_reg_rtx (DImode);
4082 rtx temp2 = gen_reg_rtx (DImode);
4084 = gen_unaligned_loadqi (operands[0],
4085 get_unaligned_address (operands[1], 0),
4088 alpha_set_memflags (seq, operands[1]);
4095 else if (GET_CODE (operands[0]) == MEM
4096 || (GET_CODE (operands[0]) == SUBREG
4097 && GET_CODE (SUBREG_REG (operands[0])) == MEM)
4098 || (reload_in_progress && GET_CODE (operands[0]) == REG
4099 && REGNO (operands[0]) >= FIRST_PSEUDO_REGISTER)
4100 || (reload_in_progress && GET_CODE (operands[0]) == SUBREG
4101 && GET_CODE (SUBREG_REG (operands[0])) == REG
4102 && REGNO (operands[0]) >= FIRST_PSEUDO_REGISTER))
4104 if (aligned_memory_operand (operands[0], QImode))
4106 rtx aligned_mem, bitnum;
4107 rtx temp1 = gen_reg_rtx (SImode);
4108 rtx temp2 = gen_reg_rtx (SImode);
4110 get_aligned_mem (operands[0], &aligned_mem, &bitnum);
4112 emit_insn (gen_aligned_store (aligned_mem, operands[1], bitnum,
4117 rtx temp1 = gen_reg_rtx (DImode);
4118 rtx temp2 = gen_reg_rtx (DImode);
4119 rtx temp3 = gen_reg_rtx (DImode);
4121 = gen_unaligned_storeqi (get_unaligned_address (operands[0], 0),
4122 operands[1], temp1, temp2, temp3);
4124 alpha_set_memflags (seq, operands[0]);
4132 (define_expand "movhi"
4133 [(set (match_operand:HI 0 "general_operand" "")
4134 (match_operand:HI 1 "general_operand" ""))]
4137 { extern rtx get_unaligned_address ();
4139 if (TARGET_BYTE_OPS)
4141 if (GET_CODE (operands[0]) == MEM
4142 && ! reg_or_0_operand (operands[1], HImode))
4143 operands[1] = force_reg (HImode, operands[1]);
4145 if (GET_CODE (operands[1]) == CONST_INT
4146 && ! input_operand (operands[1], HImode))
4148 operands[1] = alpha_emit_set_const (operands[0], HImode,
4149 INTVAL (operands[1]), 3);
4151 if (rtx_equal_p (operands[0], operands[1]))
4158 /* If the output is not a register, the input must be. */
4159 if (GET_CODE (operands[0]) == MEM)
4160 operands[1] = force_reg (HImode, operands[1]);
4162 /* Handle four memory cases, unaligned and aligned for either the input
4163 or the output. The only case where we can be called during reload is
4164 for aligned loads; all other cases require temporaries. */
4166 if (GET_CODE (operands[1]) == MEM
4167 || (GET_CODE (operands[1]) == SUBREG
4168 && GET_CODE (SUBREG_REG (operands[1])) == MEM)
4169 || (reload_in_progress && GET_CODE (operands[1]) == REG
4170 && REGNO (operands[1]) >= FIRST_PSEUDO_REGISTER)
4171 || (reload_in_progress && GET_CODE (operands[1]) == SUBREG
4172 && GET_CODE (SUBREG_REG (operands[1])) == REG
4173 && REGNO (SUBREG_REG (operands[1])) >= FIRST_PSEUDO_REGISTER))
4175 if (aligned_memory_operand (operands[1], HImode))
4177 rtx aligned_mem, bitnum;
4178 rtx scratch = (reload_in_progress
4179 ? gen_rtx (REG, SImode, REGNO (operands[0]))
4180 : gen_reg_rtx (SImode));
4182 get_aligned_mem (operands[1], &aligned_mem, &bitnum);
4184 emit_insn (gen_aligned_loadhi (operands[0], aligned_mem, bitnum,
4189 /* Don't pass these as parameters since that makes the generated
4190 code depend on parameter evaluation order which will cause
4191 bootstrap failures. */
4193 rtx temp1 = gen_reg_rtx (DImode);
4194 rtx temp2 = gen_reg_rtx (DImode);
4196 = gen_unaligned_loadhi (operands[0],
4197 get_unaligned_address (operands[1], 0),
4200 alpha_set_memflags (seq, operands[1]);
4207 else if (GET_CODE (operands[0]) == MEM
4208 || (GET_CODE (operands[0]) == SUBREG
4209 && GET_CODE (SUBREG_REG (operands[0])) == MEM)
4210 || (reload_in_progress && GET_CODE (operands[0]) == REG
4211 && REGNO (operands[0]) >= FIRST_PSEUDO_REGISTER)
4212 || (reload_in_progress && GET_CODE (operands[0]) == SUBREG
4213 && GET_CODE (SUBREG_REG (operands[0])) == REG
4214 && REGNO (operands[0]) >= FIRST_PSEUDO_REGISTER))
4216 if (aligned_memory_operand (operands[0], HImode))
4218 rtx aligned_mem, bitnum;
4219 rtx temp1 = gen_reg_rtx (SImode);
4220 rtx temp2 = gen_reg_rtx (SImode);
4222 get_aligned_mem (operands[0], &aligned_mem, &bitnum);
4224 emit_insn (gen_aligned_store (aligned_mem, operands[1], bitnum,
4229 rtx temp1 = gen_reg_rtx (DImode);
4230 rtx temp2 = gen_reg_rtx (DImode);
4231 rtx temp3 = gen_reg_rtx (DImode);
4233 = gen_unaligned_storehi (get_unaligned_address (operands[0], 0),
4234 operands[1], temp1, temp2, temp3);
4236 alpha_set_memflags (seq, operands[0]);
4245 ;; Here are the versions for reload. Note that in the unaligned cases
4246 ;; we know that the operand must not be a pseudo-register because stack
4247 ;; slots are always aligned references.
4249 (define_expand "reload_inqi"
4250 [(parallel [(match_operand:QI 0 "register_operand" "=r")
4251 (match_operand:QI 1 "unaligned_memory_operand" "m")
4252 (match_operand:TI 2 "register_operand" "=&r")])]
4255 { extern rtx get_unaligned_address ();
4256 rtx addr = get_unaligned_address (operands[1], 0);
4257 /* It is possible that one of the registers we got for operands[2]
4258 might coincide with that of operands[0] (which is why we made
4259 it TImode). Pick the other one to use as our scratch. */
4260 rtx scratch = gen_rtx (REG, DImode,
4261 REGNO (operands[0]) == REGNO (operands[2])
4262 ? REGNO (operands[2]) + 1 : REGNO (operands[2]));
4263 rtx seq = gen_unaligned_loadqi (operands[0], addr, scratch,
4264 gen_rtx (REG, DImode, REGNO (operands[0])));
4266 alpha_set_memflags (seq, operands[1]);
4271 (define_expand "reload_inhi"
4272 [(parallel [(match_operand:HI 0 "register_operand" "=r")
4273 (match_operand:HI 1 "unaligned_memory_operand" "m")
4274 (match_operand:TI 2 "register_operand" "=&r")])]
4277 { extern rtx get_unaligned_address ();
4278 rtx addr = get_unaligned_address (operands[1], 0);
4279 /* It is possible that one of the registers we got for operands[2]
4280 might coincide with that of operands[0] (which is why we made
4281 it TImode). Pick the other one to use as our scratch. */
4282 rtx scratch = gen_rtx (REG, DImode,
4283 REGNO (operands[0]) == REGNO (operands[2])
4284 ? REGNO (operands[2]) + 1 : REGNO (operands[2]));
4285 rtx seq = gen_unaligned_loadhi (operands[0], addr, scratch,
4286 gen_rtx (REG, DImode, REGNO (operands[0])));
4288 alpha_set_memflags (seq, operands[1]);
4293 (define_expand "reload_outqi"
4294 [(parallel [(match_operand:QI 0 "any_memory_operand" "=m")
4295 (match_operand:QI 1 "register_operand" "r")
4296 (match_operand:TI 2 "register_operand" "=&r")])]
4299 { extern rtx get_unaligned_address ();
4301 if (aligned_memory_operand (operands[0], QImode))
4303 rtx aligned_mem, bitnum;
4305 get_aligned_mem (operands[0], &aligned_mem, &bitnum);
4307 emit_insn (gen_aligned_store (aligned_mem, operands[1], bitnum,
4308 gen_rtx (REG, SImode, REGNO (operands[2])),
4309 gen_rtx (REG, SImode,
4310 REGNO (operands[2]) + 1)));
4314 rtx addr = get_unaligned_address (operands[0], 0);
4315 rtx scratch1 = gen_rtx (REG, DImode, REGNO (operands[2]));
4316 rtx scratch2 = gen_rtx (REG, DImode, REGNO (operands[2]) + 1);
4317 rtx scratch3 = scratch1;
4320 if (GET_CODE (addr) == REG)
4323 seq = gen_unaligned_storeqi (addr, operands[1], scratch1,
4324 scratch2, scratch3);
4325 alpha_set_memflags (seq, operands[0]);
4332 (define_expand "reload_outhi"
4333 [(parallel [(match_operand:HI 0 "any_memory_operand" "=m")
4334 (match_operand:HI 1 "register_operand" "r")
4335 (match_operand:TI 2 "register_operand" "=&r")])]
4338 { extern rtx get_unaligned_address ();
4340 if (aligned_memory_operand (operands[0], HImode))
4342 rtx aligned_mem, bitnum;
4344 get_aligned_mem (operands[0], &aligned_mem, &bitnum);
4346 emit_insn (gen_aligned_store (aligned_mem, operands[1], bitnum,
4347 gen_rtx (REG, SImode, REGNO (operands[2])),
4348 gen_rtx (REG, SImode,
4349 REGNO (operands[2]) + 1)));
4353 rtx addr = get_unaligned_address (operands[0], 0);
4354 rtx scratch1 = gen_rtx (REG, DImode, REGNO (operands[2]));
4355 rtx scratch2 = gen_rtx (REG, DImode, REGNO (operands[2]) + 1);
4356 rtx scratch3 = scratch1;
4359 if (GET_CODE (addr) == REG)
4362 seq = gen_unaligned_storehi (addr, operands[1], scratch1,
4363 scratch2, scratch3);
4364 alpha_set_memflags (seq, operands[0]);
4371 ;; Subroutine of stack space allocation. Perform a stack probe.
4372 (define_expand "probe_stack"
4373 [(set (match_dup 1) (match_operand:DI 0 "const_int_operand" ""))]
4377 operands[1] = gen_rtx (MEM, DImode, plus_constant (stack_pointer_rtx,
4378 INTVAL (operands[0])));
4379 MEM_VOLATILE_P (operands[1]) = 1;
4381 operands[0] = const0_rtx;
4384 ;; This is how we allocate stack space. If we are allocating a
4385 ;; constant amount of space and we know it is less than 4096
4386 ;; bytes, we need do nothing.
4388 ;; If it is more than 4096 bytes, we need to probe the stack
4390 (define_expand "allocate_stack"
4392 (plus:DI (reg:DI 30)
4393 (match_operand:DI 0 "reg_or_cint_operand" "")))]
4397 if (GET_CODE (operands[0]) == CONST_INT
4398 && INTVAL (operands[0]) < 32768)
4400 if (INTVAL (operands[0]) >= 4096)
4402 /* We do this the same way as in the prologue and generate explicit
4403 probes. Then we update the stack by the constant. */
4407 emit_insn (gen_probe_stack (GEN_INT (- probed)));
4408 while (probed + 8192 < INTVAL (operands[0]))
4409 emit_insn (gen_probe_stack (GEN_INT (- (probed += 8192))));
4411 if (probed + 4096 < INTVAL (operands[0]))
4412 emit_insn (gen_probe_stack (GEN_INT (- INTVAL(operands[0]))));
4415 operands[0] = GEN_INT (- INTVAL (operands[0]));
4420 rtx loop_label = gen_label_rtx ();
4421 rtx want = gen_reg_rtx (Pmode);
4422 rtx tmp = gen_reg_rtx (Pmode);
4425 emit_insn (gen_subdi3 (want, stack_pointer_rtx,
4426 force_reg (Pmode, operands[0])));
4427 emit_insn (gen_adddi3 (tmp, stack_pointer_rtx, GEN_INT (-4096)));
4429 if (GET_CODE (operands[0]) != CONST_INT)
4431 out_label = gen_label_rtx ();
4432 emit_insn (gen_cmpdi (want, tmp));
4433 emit_jump_insn (gen_bgeu (out_label));
4436 emit_label (loop_label);
4437 memref = gen_rtx (MEM, DImode, tmp);
4438 MEM_VOLATILE_P (memref) = 1;
4439 emit_move_insn (memref, const0_rtx);
4440 emit_insn (gen_adddi3 (tmp, tmp, GEN_INT(-8192)));
4441 emit_insn (gen_cmpdi (tmp, want));
4442 emit_jump_insn (gen_bgtu (loop_label));
4443 memref = gen_rtx (MEM, DImode, want);
4444 MEM_VOLATILE_P (memref) = 1;
4445 emit_move_insn (memref, const0_rtx);
4448 emit_label (out_label);
4450 emit_move_insn (stack_pointer_rtx, want);
4456 (define_insn "exception_receiver"
4457 [(unspec_volatile [(const_int 0)] 2)]
4458 "! TARGET_OPEN_VMS && ! TARGET_WINDOWS_NT"
4459 ".long 0xc3a00000\;ldgp $29,0($29)")
4461 (define_expand "nonlocal_goto_receiver"
4462 [(unspec_volatile [(const_int 0)] 1)
4463 (set (reg:DI 27) (mem:DI (reg:DI 29)))
4464 (unspec_volatile [(const_int 0)] 1)
4469 (define_insn "arg_home"
4470 [(unspec [(const_int 0)] 0)
4485 (clobber (mem:BLK (const_int 0)))
4486 (clobber (reg:DI 24))
4487 (clobber (reg:DI 25))
4488 (clobber (reg:DI 0))]
4490 "lda $0,ots$home_args\;ldq $0,8($0)\;jsr $0,ots$home_args")
4492 ;; Close the trap shadow of preceeding instructions. This is generated
4495 (define_insn "trapb"
4496 [(unspec_volatile [(const_int 0)] 3)]
4499 [(set_attr "type" "misc")])