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,ev6"
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,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.
118 ;; We consider the EV6 and EV5 for now.
120 ;; EV5 has two asymetric integer units. Model this with ebox,e0,e1.
121 ;; Everything uses ebox, and those that require particular pipes grab
124 (define_function_unit "ev5_ebox" 2 0
125 (and (eq_attr "cpu" "ev5,ev6")
126 (eq_attr "type" "iadd,ilog,icmp,st,shift,imull,imulq,imulh"))
129 ;; Memory takes at least 2 clocks, and load cannot dual issue with stores.
130 (define_function_unit "ev5_ebox" 2 0
131 (and (eq_attr "cpu" "ev5,ev6")
132 (eq_attr "type" "ld,ldsym"))
135 (define_function_unit "ev5_e0" 1 0
136 (and (eq_attr "cpu" "ev5,ev6")
137 (eq_attr "type" "ld,ldsym"))
139 [(eq_attr "type" "st")])
141 ;; Conditional moves always take 2 ticks.
142 (define_function_unit "ev5_ebox" 2 0
143 (and (eq_attr "cpu" "ev5,ev6")
144 (eq_attr "type" "cmov"))
147 ;; Stores, shifts, and multiplies can only issue to E0
148 (define_function_unit "ev5_e0" 1 0
149 (and (eq_attr "cpu" "ev5,ev6")
150 (eq_attr "type" "st"))
153 ;; But shifts and multiplies don't conflict with loads.
154 (define_function_unit "ev5_e0" 1 0
155 (and (eq_attr "cpu" "ev5,ev6")
156 (eq_attr "type" "shift,imull,imulq,imulh"))
158 [(eq_attr "type" "st,shift,imull,imulq,imulh")])
160 ;; Branches can only issue to E1
161 (define_function_unit "ev5_e1" 1 0
162 (and (eq_attr "cpu" "ev5,ev6")
163 (eq_attr "type" "ibr,jsr"))
166 ;; Multiplies also use the integer multiplier.
167 (define_function_unit "ev5_imult" 1 0
168 (and (eq_attr "cpu" "ev5,ev6")
169 (eq_attr "type" "imull"))
172 (define_function_unit "ev5_imult" 1 0
173 (and (eq_attr "cpu" "ev5,ev6")
174 (eq_attr "type" "imulq"))
177 (define_function_unit "ev5_imult" 1 0
178 (and (eq_attr "cpu" "ev5,ev6")
179 (eq_attr "type" "imulh"))
182 ;; Similarly for the FPU we have two asymetric units. But fcpys can issue
183 ;; on either so we have to play the game again.
185 (define_function_unit "ev5_fpu" 2 0
186 (and (eq_attr "cpu" "ev5,ev6")
187 (eq_attr "type" "fadd,fmul,fcpys,fbr,fdivs,fdivt"))
190 ;; Multiplies (resp. adds) also use the fmul (resp. fadd) units.
191 (define_function_unit "ev5_fm" 1 0
192 (and (eq_attr "cpu" "ev5,ev6")
193 (eq_attr "type" "fmul"))
196 (define_function_unit "ev5_fa" 1 0
197 (and (eq_attr "cpu" "ev5,ev6")
198 (eq_attr "type" "fadd"))
201 (define_function_unit "ev5_fa" 1 0
202 (and (eq_attr "cpu" "ev5,ev6")
203 (eq_attr "type" "fbr"))
206 (define_function_unit "ev5_fa" 1 0
207 (and (eq_attr "cpu" "ev5,ev6")
208 (eq_attr "type" "fdivs"))
211 (define_function_unit "ev5_fa" 1 0
212 (and (eq_attr "cpu" "ev5,ev6")
213 (eq_attr "type" "fdivt"))
216 ;; First define the arithmetic insns. Note that the 32-bit forms also
219 ;; Note that we can do sign extensions in both FP and integer registers.
220 ;; However, the result must be in the same type of register as the input.
221 ;; The register preferencing code can't handle this case very well, so, for
222 ;; now, don't let the FP case show up here for preferencing. Also,
223 ;; sign-extends in FP registers take two instructions.
224 (define_insn "extendsidi2"
225 [(set (match_operand:DI 0 "register_operand" "=r,r,*f")
226 (sign_extend:DI (match_operand:SI 1 "nonimmediate_operand" "r,m,*f")))]
231 cvtql %1,%0\;cvtlq %0,%0"
232 [(set_attr "type" "iadd,ld,fadd")])
234 ;; Do addsi3 the way expand_binop would do if we didn't have one. This
235 ;; generates better code. We have the anonymous addsi3 pattern below in
236 ;; case combine wants to make it.
237 (define_expand "addsi3"
238 [(set (match_operand:SI 0 "register_operand" "")
239 (plus:SI (match_operand:SI 1 "reg_or_0_operand" "")
240 (match_operand:SI 2 "add_operand" "")))]
243 { emit_insn (gen_rtx (SET, VOIDmode, gen_lowpart (DImode, operands[0]),
244 gen_rtx (PLUS, DImode,
245 gen_lowpart (DImode, operands[1]),
246 gen_lowpart (DImode, operands[2]))));
251 [(set (match_operand:SI 0 "register_operand" "=r,r,r,r")
252 (plus:SI (match_operand:SI 1 "reg_or_0_operand" "%rJ,rJ,rJ,rJ")
253 (match_operand:SI 2 "add_operand" "rI,O,K,L")))]
262 [(set (match_operand:SI 0 "register_operand" "")
263 (plus:SI (match_operand:SI 1 "register_operand" "")
264 (match_operand:SI 2 "const_int_operand" "")))]
265 "! add_operand (operands[2], SImode)"
266 [(set (match_dup 0) (plus:SI (match_dup 1) (match_dup 3)))
267 (set (match_dup 0) (plus:SI (match_dup 0) (match_dup 4)))]
270 HOST_WIDE_INT val = INTVAL (operands[2]);
271 HOST_WIDE_INT low = (val & 0xffff) - 2 * (val & 0x8000);
272 HOST_WIDE_INT rest = val - low;
274 operands[3] = GEN_INT (rest);
275 operands[4] = GEN_INT (low);
279 [(set (match_operand:DI 0 "register_operand" "=r,r")
281 (plus:SI (match_operand:SI 1 "reg_or_0_operand" "%rJ,rJ")
282 (match_operand:SI 2 "sext_add_operand" "rI,O"))))]
289 [(set (match_operand:DI 0 "register_operand" "")
291 (plus:SI (match_operand:SI 1 "register_operand" "")
292 (match_operand:SI 2 "const_int_operand" ""))))
293 (clobber (match_operand:SI 3 "register_operand" ""))]
294 "! sext_add_operand (operands[2], SImode) && INTVAL (operands[2]) > 0
295 && INTVAL (operands[2]) % 4 == 0"
296 [(set (match_dup 3) (match_dup 4))
297 (set (match_dup 0) (sign_extend:DI (plus:SI (mult:SI (match_dup 3)
302 HOST_WIDE_INT val = INTVAL (operands[2]) / 4;
308 operands[4] = GEN_INT (val);
309 operands[5] = GEN_INT (mult);
313 [(set (match_operand:DI 0 "register_operand" "")
315 (plus:SI (match_operator:SI 1 "comparison_operator"
316 [(match_operand 2 "" "")
317 (match_operand 3 "" "")])
318 (match_operand:SI 4 "add_operand" ""))))
319 (clobber (match_operand:DI 5 "register_operand" ""))]
321 [(set (match_dup 5) (match_dup 6))
322 (set (match_dup 0) (sign_extend:DI (plus:SI (match_dup 7) (match_dup 4))))]
325 operands[6] = gen_rtx (GET_CODE (operands[1]), DImode,
326 operands[2], operands[3]);
327 operands[7] = gen_lowpart (SImode, operands[5]);
330 (define_insn "adddi3"
331 [(set (match_operand:DI 0 "register_operand" "=r,r,r,r")
332 (plus:DI (match_operand:DI 1 "reg_or_0_operand" "%rJ,rJ,rJ,rJ")
333 (match_operand:DI 2 "add_operand" "rI,O,K,L")))]
341 ;; Don't do this if we are adjusting SP since we don't want to do
344 [(set (match_operand:DI 0 "register_operand" "")
345 (plus:DI (match_operand:DI 1 "register_operand" "")
346 (match_operand:DI 2 "const_int_operand" "")))]
347 "! add_operand (operands[2], DImode)
348 && REGNO (operands[0]) != STACK_POINTER_REGNUM"
349 [(set (match_dup 0) (plus:DI (match_dup 1) (match_dup 3)))
350 (set (match_dup 0) (plus:DI (match_dup 0) (match_dup 4)))]
353 HOST_WIDE_INT val = INTVAL (operands[2]);
354 HOST_WIDE_INT low = (val & 0xffff) - 2 * (val & 0x8000);
355 HOST_WIDE_INT rest = val - low;
357 operands[3] = GEN_INT (rest);
358 operands[4] = GEN_INT (low);
362 [(set (match_operand:SI 0 "register_operand" "=r,r")
363 (plus:SI (mult:SI (match_operand:SI 1 "reg_or_0_operand" "rJ,rJ")
364 (match_operand:SI 2 "const48_operand" "I,I"))
365 (match_operand:SI 3 "sext_add_operand" "rI,O")))]
372 [(set (match_operand:DI 0 "register_operand" "=r,r")
374 (plus:SI (mult:SI (match_operand:SI 1 "reg_or_0_operand" "rJ,rJ")
375 (match_operand:SI 2 "const48_operand" "I,I"))
376 (match_operand:SI 3 "sext_add_operand" "rI,O"))))]
383 [(set (match_operand:DI 0 "register_operand" "")
385 (plus:SI (mult:SI (match_operator:SI 1 "comparison_operator"
386 [(match_operand 2 "" "")
387 (match_operand 3 "" "")])
388 (match_operand:SI 4 "const48_operand" ""))
389 (match_operand:SI 5 "add_operand" ""))))
390 (clobber (match_operand:DI 6 "register_operand" ""))]
392 [(set (match_dup 6) (match_dup 7))
394 (sign_extend:DI (plus:SI (mult:SI (match_dup 8) (match_dup 4))
398 operands[7] = gen_rtx (GET_CODE (operands[1]), DImode,
399 operands[2], operands[3]);
400 operands[8] = gen_lowpart (SImode, operands[6]);
404 [(set (match_operand:DI 0 "register_operand" "=r,r")
405 (plus:DI (mult:DI (match_operand:DI 1 "reg_or_0_operand" "rJ,rJ")
406 (match_operand:DI 2 "const48_operand" "I,I"))
407 (match_operand:DI 3 "reg_or_8bit_operand" "rI,O")))]
413 ;; These variants of the above insns can occur if the third operand
414 ;; is the frame pointer. This is a kludge, but there doesn't
415 ;; seem to be a way around it. Only recognize them while reloading.
418 [(set (match_operand:DI 0 "some_operand" "=&r")
419 (plus:DI (plus:DI (match_operand:DI 1 "some_operand" "r")
420 (match_operand:DI 2 "some_operand" "r"))
421 (match_operand:DI 3 "some_operand" "rIOKL")))]
426 [(set (match_operand:DI 0 "register_operand" "")
427 (plus:DI (plus:DI (match_operand:DI 1 "register_operand" "")
428 (match_operand:DI 2 "register_operand" ""))
429 (match_operand:DI 3 "add_operand" "")))]
431 [(set (match_dup 0) (plus:DI (match_dup 1) (match_dup 2)))
432 (set (match_dup 0) (plus:DI (match_dup 0) (match_dup 3)))]
436 [(set (match_operand:SI 0 "some_operand" "=&r")
437 (plus:SI (plus:SI (mult:SI (match_operand:SI 1 "some_operand" "rJ")
438 (match_operand:SI 2 "const48_operand" "I"))
439 (match_operand:SI 3 "some_operand" "r"))
440 (match_operand:SI 4 "some_operand" "rIOKL")))]
445 [(set (match_operand:SI 0 "register_operand" "r")
446 (plus:SI (plus:SI (mult:SI (match_operand:SI 1 "reg_or_0_operand" "")
447 (match_operand:SI 2 "const48_operand" ""))
448 (match_operand:SI 3 "register_operand" ""))
449 (match_operand:SI 4 "add_operand" "rIOKL")))]
452 (plus:SI (mult:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
453 (set (match_dup 0) (plus:SI (match_dup 0) (match_dup 4)))]
457 [(set (match_operand:DI 0 "some_operand" "=&r")
460 (mult:SI (match_operand:SI 1 "some_operand" "rJ")
461 (match_operand:SI 2 "const48_operand" "I"))
462 (match_operand:SI 3 "some_operand" "r"))
463 (match_operand:SI 4 "some_operand" "rIOKL"))))]
468 [(set (match_operand:DI 0 "register_operand" "")
471 (mult:SI (match_operand:SI 1 "reg_or_0_operand" "")
472 (match_operand:SI 2 "const48_operand" ""))
473 (match_operand:SI 3 "register_operand" ""))
474 (match_operand:SI 4 "add_operand" ""))))]
477 (plus:SI (mult:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
478 (set (match_dup 0) (sign_extend:DI (plus:SI (match_dup 5) (match_dup 4))))]
480 { operands[5] = gen_lowpart (SImode, operands[0]);
484 [(set (match_operand:DI 0 "some_operand" "=&r")
485 (plus:DI (plus:DI (mult:DI (match_operand:DI 1 "some_operand" "rJ")
486 (match_operand:DI 2 "const48_operand" "I"))
487 (match_operand:DI 3 "some_operand" "r"))
488 (match_operand:DI 4 "some_operand" "rIOKL")))]
493 [(set (match_operand:DI 0 "register_operand" "=")
494 (plus:DI (plus:DI (mult:DI (match_operand:DI 1 "reg_or_0_operand" "")
495 (match_operand:DI 2 "const48_operand" ""))
496 (match_operand:DI 3 "register_operand" ""))
497 (match_operand:DI 4 "add_operand" "")))]
500 (plus:DI (mult:DI (match_dup 1) (match_dup 2)) (match_dup 3)))
501 (set (match_dup 0) (plus:DI (match_dup 0) (match_dup 4)))]
504 (define_insn "negsi2"
505 [(set (match_operand:SI 0 "register_operand" "=r")
506 (neg:SI (match_operand:SI 1 "reg_or_8bit_operand" "rI")))]
511 [(set (match_operand:DI 0 "register_operand" "=r")
512 (sign_extend:DI (neg:SI
513 (match_operand:SI 1 "reg_or_8bit_operand" "rI"))))]
517 (define_insn "negdi2"
518 [(set (match_operand:DI 0 "register_operand" "=r")
519 (neg:DI (match_operand:DI 1 "reg_or_8bit_operand" "rI")))]
523 (define_expand "subsi3"
524 [(set (match_operand:SI 0 "register_operand" "")
525 (minus:SI (match_operand:SI 1 "reg_or_0_operand" "")
526 (match_operand:SI 2 "reg_or_8bit_operand" "")))]
529 { emit_insn (gen_rtx (SET, VOIDmode, gen_lowpart (DImode, operands[0]),
530 gen_rtx (MINUS, DImode,
531 gen_lowpart (DImode, operands[1]),
532 gen_lowpart (DImode, operands[2]))));
538 [(set (match_operand:SI 0 "register_operand" "=r")
539 (minus:SI (match_operand:SI 1 "reg_or_0_operand" "rJ")
540 (match_operand:SI 2 "reg_or_8bit_operand" "rI")))]
545 [(set (match_operand:DI 0 "register_operand" "=r")
546 (sign_extend:DI (minus:SI (match_operand:SI 1 "reg_or_0_operand" "rJ")
547 (match_operand:SI 2 "reg_or_8bit_operand" "rI"))))]
551 (define_insn "subdi3"
552 [(set (match_operand:DI 0 "register_operand" "=r")
553 (minus:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
554 (match_operand:DI 2 "reg_or_8bit_operand" "rI")))]
559 [(set (match_operand:SI 0 "register_operand" "=r")
560 (minus:SI (mult:SI (match_operand:SI 1 "reg_or_0_operand" "rJ")
561 (match_operand:SI 2 "const48_operand" "I"))
562 (match_operand:SI 3 "reg_or_8bit_operand" "rI")))]
567 [(set (match_operand:DI 0 "register_operand" "=r")
569 (minus:SI (mult:SI (match_operand:SI 1 "reg_or_0_operand" "rJ")
570 (match_operand:SI 2 "const48_operand" "I"))
571 (match_operand:SI 3 "reg_or_8bit_operand" "rI"))))]
576 [(set (match_operand:DI 0 "register_operand" "=r")
577 (minus:DI (mult:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
578 (match_operand:DI 2 "const48_operand" "I"))
579 (match_operand:DI 3 "reg_or_8bit_operand" "rI")))]
583 (define_insn "mulsi3"
584 [(set (match_operand:SI 0 "register_operand" "=r")
585 (mult:SI (match_operand:SI 1 "reg_or_0_operand" "%rJ")
586 (match_operand:SI 2 "reg_or_0_operand" "rJ")))]
589 [(set_attr "type" "imull")])
592 [(set (match_operand:DI 0 "register_operand" "=r")
593 (sign_extend:DI (mult:SI (match_operand:SI 1 "reg_or_0_operand" "%rJ")
594 (match_operand:SI 2 "reg_or_0_operand" "rJ"))))]
597 [(set_attr "type" "imull")])
599 (define_insn "muldi3"
600 [(set (match_operand:DI 0 "register_operand" "=r")
601 (mult:DI (match_operand:DI 1 "reg_or_0_operand" "%rJ")
602 (match_operand:DI 2 "reg_or_0_operand" "rJ")))]
605 [(set_attr "type" "imulq")])
607 (define_insn "umuldi3_highpart"
608 [(set (match_operand:DI 0 "register_operand" "=r")
611 (mult:TI (zero_extend:TI (match_operand:DI 1 "register_operand" "r"))
612 (zero_extend:TI (match_operand:DI 2 "register_operand" "r")))
616 [(set_attr "type" "imulh")])
619 [(set (match_operand:DI 0 "register_operand" "=r")
622 (mult:TI (zero_extend:TI (match_operand:DI 1 "register_operand" "r"))
623 (match_operand:TI 2 "cint8_operand" "I"))
627 [(set_attr "type" "imulh")])
629 ;; The divide and remainder operations always take their inputs from
630 ;; r24 and r25, put their output in r27, and clobber r23 and r28.
632 ;; ??? comment out the divsi routines since the library functions
633 ;; don't seem to do the right thing with the high 32-bits of a
636 ;(define_expand "divsi3"
637 ; [(set (reg:SI 24) (match_operand:SI 1 "input_operand" ""))
638 ; (set (reg:SI 25) (match_operand:SI 2 "input_operand" ""))
639 ; (parallel [(set (reg:SI 27)
640 ; (div:SI (reg:SI 24)
642 ; (clobber (reg:DI 23))
643 ; (clobber (reg:DI 28))])
644 ; (set (match_operand:SI 0 "general_operand" "")
649 ;(define_expand "udivsi3"
650 ; [(set (reg:SI 24) (match_operand:SI 1 "input_operand" ""))
651 ; (set (reg:SI 25) (match_operand:SI 2 "input_operand" ""))
652 ; (parallel [(set (reg:SI 27)
653 ; (udiv:SI (reg:SI 24)
655 ; (clobber (reg:DI 23))
656 ; (clobber (reg:DI 28))])
657 ; (set (match_operand:SI 0 "general_operand" "")
662 ;(define_expand "modsi3"
663 ; [(set (reg:SI 24) (match_operand:SI 1 "input_operand" ""))
664 ; (set (reg:SI 25) (match_operand:SI 2 "input_operand" ""))
665 ; (parallel [(set (reg:SI 27)
666 ; (mod:SI (reg:SI 24)
668 ; (clobber (reg:DI 23))
669 ; (clobber (reg:DI 28))])
670 ; (set (match_operand:SI 0 "general_operand" "")
675 ;(define_expand "umodsi3"
676 ; [(set (reg:SI 24) (match_operand:SI 1 "input_operand" ""))
677 ; (set (reg:SI 25) (match_operand:SI 2 "input_operand" ""))
678 ; (parallel [(set (reg:SI 27)
679 ; (umod:SI (reg:SI 24)
681 ; (clobber (reg:DI 23))
682 ; (clobber (reg:DI 28))])
683 ; (set (match_operand:SI 0 "general_operand" "")
688 (define_expand "divdi3"
689 [(set (reg:DI 24) (match_operand:DI 1 "input_operand" ""))
690 (set (reg:DI 25) (match_operand:DI 2 "input_operand" ""))
691 (parallel [(set (reg:DI 27)
694 (clobber (reg:DI 23))
695 (clobber (reg:DI 28))])
696 (set (match_operand:DI 0 "general_operand" "")
701 (define_expand "udivdi3"
702 [(set (reg:DI 24) (match_operand:DI 1 "input_operand" ""))
703 (set (reg:DI 25) (match_operand:DI 2 "input_operand" ""))
704 (parallel [(set (reg:DI 27)
707 (clobber (reg:DI 23))
708 (clobber (reg:DI 28))])
709 (set (match_operand:DI 0 "general_operand" "")
714 (define_expand "moddi3"
715 [(set (reg:DI 24) (match_operand:DI 1 "input_operand" ""))
716 (set (reg:DI 25) (match_operand:DI 2 "input_operand" ""))
717 (parallel [(set (reg:DI 27)
720 (clobber (reg:DI 23))
721 (clobber (reg:DI 28))])
722 (set (match_operand:DI 0 "general_operand" "")
727 (define_expand "umoddi3"
728 [(set (reg:DI 24) (match_operand:DI 1 "input_operand" ""))
729 (set (reg:DI 25) (match_operand:DI 2 "input_operand" ""))
730 (parallel [(set (reg:DI 27)
733 (clobber (reg:DI 23))
734 (clobber (reg:DI 28))])
735 (set (match_operand:DI 0 "general_operand" "")
742 ; (match_operator:SI 1 "divmod_operator"
743 ; [(reg:SI 24) (reg:SI 25)]))
744 ; (clobber (reg:DI 23))
745 ; (clobber (reg:DI 28))]
748 ; [(set_attr "type" "jsr")])
752 (match_operator:DI 1 "divmod_operator"
753 [(reg:DI 24) (reg:DI 25)]))
754 (clobber (reg:DI 23))
755 (clobber (reg:DI 28))]
758 [(set_attr "type" "jsr")])
760 ;; Next are the basic logical operations. These only exist in DImode.
762 (define_insn "anddi3"
763 [(set (match_operand:DI 0 "register_operand" "=r,r,r")
764 (and:DI (match_operand:DI 1 "reg_or_0_operand" "%rJ,rJ,rJ")
765 (match_operand:DI 2 "and_operand" "rI,N,MH")))]
771 [(set_attr "type" "ilog,ilog,shift")])
773 ;; There are times when we can split an AND into two AND insns. This occurs
774 ;; when we can first clear any bytes and then clear anything else. For
775 ;; example "I & 0xffff07" is "(I & 0xffffff) & 0xffffffffffffff07".
776 ;; Only do this when running on 64-bit host since the computations are
777 ;; too messy otherwise.
780 [(set (match_operand:DI 0 "register_operand" "")
781 (and:DI (match_operand:DI 1 "register_operand" "")
782 (match_operand:DI 2 "const_int_operand" "")))]
783 "HOST_BITS_PER_WIDE_INT == 64 && ! and_operand (operands[2], DImode)"
784 [(set (match_dup 0) (and:DI (match_dup 1) (match_dup 3)))
785 (set (match_dup 0) (and:DI (match_dup 0) (match_dup 4)))]
788 unsigned HOST_WIDE_INT mask1 = INTVAL (operands[2]);
789 unsigned HOST_WIDE_INT mask2 = mask1;
792 /* For each byte that isn't all zeros, make it all ones. */
793 for (i = 0; i < 64; i += 8)
794 if ((mask1 & ((HOST_WIDE_INT) 0xff << i)) != 0)
795 mask1 |= (HOST_WIDE_INT) 0xff << i;
797 /* Now turn on any bits we've just turned off. */
800 operands[3] = GEN_INT (mask1);
801 operands[4] = GEN_INT (mask2);
804 (define_insn "zero_extendqihi2"
805 [(set (match_operand:HI 0 "register_operand" "=r")
806 (zero_extend:HI (match_operand:QI 1 "register_operand" "r")))]
809 [(set_attr "type" "shift")])
812 [(set (match_operand:SI 0 "register_operand" "=r,r")
813 (zero_extend:SI (match_operand:QI 1 "nonimmediate_operand" "r,m")))]
818 [(set_attr "type" "shift,ld")])
821 [(set (match_operand:SI 0 "register_operand" "=r")
822 (zero_extend:SI (match_operand:QI 1 "register_operand" "r")))]
825 [(set_attr "type" "shift")])
827 (define_expand "zero_extendqisi2"
828 [(set (match_operand:SI 0 "register_operand" "")
829 (zero_extend:SI (match_operand:QI 1 "register_operand" "")))]
834 [(set (match_operand:DI 0 "register_operand" "=r,r")
835 (zero_extend:DI (match_operand:QI 1 "nonimmediate_operand" "r,m")))]
840 [(set_attr "type" "shift,ld")])
843 [(set (match_operand:DI 0 "register_operand" "=r")
844 (zero_extend:DI (match_operand:QI 1 "register_operand" "r")))]
847 [(set_attr "type" "shift")])
849 (define_expand "zero_extendqidi2"
850 [(set (match_operand:DI 0 "register_operand" "")
851 (zero_extend:DI (match_operand:QI 1 "register_operand" "")))]
856 [(set (match_operand:SI 0 "register_operand" "=r,r")
857 (zero_extend:SI (match_operand:HI 1 "nonimmediate_operand" "r,m")))]
862 [(set_attr "type" "shift,ld")])
865 [(set (match_operand:SI 0 "register_operand" "=r")
866 (zero_extend:SI (match_operand:HI 1 "register_operand" "r")))]
869 [(set_attr "type" "shift")])
871 (define_expand "zero_extendhisi2"
872 [(set (match_operand:SI 0 "register_operand" "")
873 (zero_extend:SI (match_operand:HI 1 "register_operand" "")))]
878 [(set (match_operand:DI 0 "register_operand" "=r,r")
879 (zero_extend:DI (match_operand:HI 1 "nonimmediate_operand" "r,m")))]
884 [(set_attr "type" "shift,ld")])
887 [(set (match_operand:DI 0 "register_operand" "=r")
888 (zero_extend:DI (match_operand:HI 1 "register_operand" "r")))]
891 [(set_attr "type" "shift")])
893 (define_expand "zero_extendhidi2"
894 [(set (match_operand:DI 0 "register_operand" "")
895 (zero_extend:DI (match_operand:HI 1 "register_operand" "")))]
899 (define_insn "zero_extendsidi2"
900 [(set (match_operand:DI 0 "register_operand" "=r")
901 (zero_extend:DI (match_operand:SI 1 "register_operand" "r")))]
904 [(set_attr "type" "shift")])
907 [(set (match_operand:DI 0 "register_operand" "=r")
908 (and:DI (not:DI (match_operand:DI 1 "reg_or_8bit_operand" "rI"))
909 (match_operand:DI 2 "reg_or_0_operand" "rJ")))]
912 [(set_attr "type" "ilog")])
914 (define_insn "iordi3"
915 [(set (match_operand:DI 0 "register_operand" "=r,r")
916 (ior:DI (match_operand:DI 1 "reg_or_0_operand" "%rJ,rJ")
917 (match_operand:DI 2 "or_operand" "rI,N")))]
922 [(set_attr "type" "ilog")])
924 (define_insn "one_cmpldi2"
925 [(set (match_operand:DI 0 "register_operand" "=r")
926 (not:DI (match_operand:DI 1 "reg_or_8bit_operand" "rI")))]
929 [(set_attr "type" "ilog")])
932 [(set (match_operand:DI 0 "register_operand" "=r")
933 (ior:DI (not:DI (match_operand:DI 1 "reg_or_8bit_operand" "rI"))
934 (match_operand:DI 2 "reg_or_0_operand" "rJ")))]
937 [(set_attr "type" "ilog")])
939 (define_insn "xordi3"
940 [(set (match_operand:DI 0 "register_operand" "=r,r")
941 (xor:DI (match_operand:DI 1 "reg_or_0_operand" "%rJ,rJ")
942 (match_operand:DI 2 "or_operand" "rI,N")))]
947 [(set_attr "type" "ilog")])
950 [(set (match_operand:DI 0 "register_operand" "=r")
951 (not:DI (xor:DI (match_operand:DI 1 "register_operand" "%rJ")
952 (match_operand:DI 2 "register_operand" "rI"))))]
955 [(set_attr "type" "ilog")])
957 ;; Handle the FFS insn if we support CIX.
959 (define_expand "ffsdi2"
961 (unspec [(match_operand:DI 1 "register_operand" "")] 1))
963 (plus:DI (match_dup 2) (const_int 1)))
964 (set (match_operand:DI 0 "register_operand" "")
965 (if_then_else:DI (eq (match_dup 1) (const_int 0))
966 (const_int 0) (match_dup 3)))]
970 operands[2] = gen_reg_rtx (DImode);
971 operands[3] = gen_reg_rtx (DImode);
975 [(set (match_operand:DI 0 "register_operand" "=r")
976 (unspec [(match_operand:DI 1 "register_operand" "r")] 1))]
979 [(set_attr "type" "shift")])
981 ;; Next come the shifts and the various extract and insert operations.
983 (define_insn "ashldi3"
984 [(set (match_operand:DI 0 "register_operand" "=r,r")
985 (ashift:DI (match_operand:DI 1 "reg_or_0_operand" "rJ,rJ")
986 (match_operand:DI 2 "reg_or_6bit_operand" "P,rI")))]
990 switch (which_alternative)
993 if (operands[2] == const1_rtx)
994 return \"addq %r1,%r1,%0\";
996 return \"s%P2addq %r1,0,%0\";
998 return \"sll %r1,%2,%0\";
1001 [(set_attr "type" "iadd,shift")])
1003 ;; ??? The following pattern is made by combine, but earlier phases
1004 ;; (specifically flow) can't handle it. This occurs in jump.c. Deal
1005 ;; with this in a better way at some point.
1007 ;; [(set (match_operand:DI 0 "register_operand" "=r")
1009 ;; (subreg:SI (ashift:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
1010 ;; (match_operand:DI 2 "const_int_operand" "P"))
1012 ;; "INTVAL (operands[2]) >= 1 && INTVAL (operands[2]) <= 3"
1015 ;; if (operands[2] == const1_rtx)
1016 ;; return \"addl %r1,%r1,%0\";
1018 ;; return \"s%P2addl %r1,0,%0\";
1020 ;; [(set_attr "type" "iadd")])
1022 (define_insn "lshrdi3"
1023 [(set (match_operand:DI 0 "register_operand" "=r")
1024 (lshiftrt:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
1025 (match_operand:DI 2 "reg_or_6bit_operand" "rI")))]
1028 [(set_attr "type" "shift")])
1030 (define_insn "ashrdi3"
1031 [(set (match_operand:DI 0 "register_operand" "=r")
1032 (ashiftrt:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
1033 (match_operand:DI 2 "reg_or_6bit_operand" "rI")))]
1036 [(set_attr "type" "shift")])
1038 (define_expand "extendqihi2"
1040 (ashift:DI (match_operand:QI 1 "some_operand" "")
1042 (set (match_operand:HI 0 "register_operand" "")
1043 (ashiftrt:DI (match_dup 2)
1050 emit_insn (gen_extendqihi2x (operands[0],
1051 force_reg (QImode, operands[1])));
1055 /* If we have an unaligned MEM, extend to DImode (which we do
1056 specially) and then copy to the result. */
1057 if (unaligned_memory_operand (operands[1], HImode))
1059 rtx temp = gen_reg_rtx (DImode);
1061 emit_insn (gen_extendqidi2 (temp, operands[1]));
1062 emit_move_insn (operands[0], gen_lowpart (HImode, temp));
1066 operands[0] = gen_lowpart (DImode, operands[0]);
1067 operands[1] = gen_lowpart (DImode, force_reg (QImode, operands[1]));
1068 operands[2] = gen_reg_rtx (DImode);
1071 (define_insn "extendqidi2x"
1072 [(set (match_operand:DI 0 "register_operand" "=r")
1073 (sign_extend:DI (match_operand:QI 1 "register_operand" "r")))]
1076 [(set_attr "type" "shift")])
1078 (define_insn "extendhidi2x"
1079 [(set (match_operand:DI 0 "register_operand" "=r")
1080 (sign_extend:DI (match_operand:HI 1 "register_operand" "r")))]
1083 [(set_attr "type" "shift")])
1085 (define_insn "extendqisi2x"
1086 [(set (match_operand:SI 0 "register_operand" "=r")
1087 (sign_extend:SI (match_operand:QI 1 "register_operand" "r")))]
1090 [(set_attr "type" "shift")])
1092 (define_insn "extendhisi2x"
1093 [(set (match_operand:SI 0 "register_operand" "=r")
1094 (sign_extend:SI (match_operand:HI 1 "register_operand" "r")))]
1097 [(set_attr "type" "shift")])
1099 (define_insn "extendqihi2x"
1100 [(set (match_operand:HI 0 "register_operand" "=r")
1101 (sign_extend:HI (match_operand:QI 1 "register_operand" "r")))]
1104 [(set_attr "type" "shift")])
1106 (define_expand "extendqisi2"
1108 (ashift:DI (match_operand:QI 1 "some_operand" "")
1110 (set (match_operand:SI 0 "register_operand" "")
1111 (ashiftrt:DI (match_dup 2)
1118 emit_insn (gen_extendqisi2x (operands[0],
1119 force_reg (QImode, operands[1])));
1123 /* If we have an unaligned MEM, extend to a DImode form of
1124 the result (which we do specially). */
1125 if (unaligned_memory_operand (operands[1], QImode))
1127 rtx temp = gen_reg_rtx (DImode);
1129 emit_insn (gen_extendqidi2 (temp, operands[1]));
1130 emit_move_insn (operands[0], gen_lowpart (SImode, temp));
1134 operands[0] = gen_lowpart (DImode, operands[0]);
1135 operands[1] = gen_lowpart (DImode, force_reg (QImode, operands[1]));
1136 operands[2] = gen_reg_rtx (DImode);
1139 (define_expand "extendqidi2"
1141 (ashift:DI (match_operand:QI 1 "some_operand" "")
1143 (set (match_operand:DI 0 "register_operand" "")
1144 (ashiftrt:DI (match_dup 2)
1148 { extern rtx get_unaligned_address ();
1152 emit_insn (gen_extendqidi2x (operands[0],
1153 force_reg (QImode, operands[1])));
1157 if (unaligned_memory_operand (operands[1], QImode))
1160 = gen_unaligned_extendqidi (operands[0],
1161 get_unaligned_address (operands[1], 1));
1163 alpha_set_memflags (seq, operands[1]);
1168 operands[1] = gen_lowpart (DImode, force_reg (QImode, operands[1]));
1169 operands[2] = gen_reg_rtx (DImode);
1172 (define_expand "extendhisi2"
1174 (ashift:DI (match_operand:HI 1 "some_operand" "")
1176 (set (match_operand:SI 0 "register_operand" "")
1177 (ashiftrt:DI (match_dup 2)
1184 emit_insn (gen_extendhisi2x (operands[0],
1185 force_reg (HImode, operands[1])));
1189 /* If we have an unaligned MEM, extend to a DImode form of
1190 the result (which we do specially). */
1191 if (unaligned_memory_operand (operands[1], HImode))
1193 rtx temp = gen_reg_rtx (DImode);
1195 emit_insn (gen_extendhidi2 (temp, operands[1]));
1196 emit_move_insn (operands[0], gen_lowpart (SImode, temp));
1200 operands[0] = gen_lowpart (DImode, operands[0]);
1201 operands[1] = gen_lowpart (DImode, force_reg (HImode, operands[1]));
1202 operands[2] = gen_reg_rtx (DImode);
1205 (define_expand "extendhidi2"
1207 (ashift:DI (match_operand:HI 1 "some_operand" "")
1209 (set (match_operand:DI 0 "register_operand" "")
1210 (ashiftrt:DI (match_dup 2)
1214 { extern rtx get_unaligned_address ();
1218 emit_insn (gen_extendhidi2x (operands[0],
1219 force_reg (HImode, operands[1])));
1223 if (unaligned_memory_operand (operands[1], HImode))
1226 = gen_unaligned_extendhidi (operands[0],
1227 get_unaligned_address (operands[1], 2));
1229 alpha_set_memflags (seq, operands[1]);
1234 operands[1] = gen_lowpart (DImode, force_reg (HImode, operands[1]));
1235 operands[2] = gen_reg_rtx (DImode);
1238 ;; Here's how we sign extend an unaligned byte and halfword. Doing this
1239 ;; as a pattern saves one instruction. The code is similar to that for
1240 ;; the unaligned loads (see below).
1242 ;; Operand 1 is the address + 1 (+2 for HI), operand 0 is the result.
1243 (define_expand "unaligned_extendqidi"
1244 [(set (match_dup 2) (match_operand:DI 1 "address_operand" ""))
1246 (mem:DI (and:DI (plus:DI (match_dup 2) (const_int -1))
1249 (ashift:DI (match_dup 3)
1250 (minus:DI (const_int 56)
1252 (and:DI (plus:DI (match_dup 2) (const_int -1))
1255 (set (subreg:DI (match_operand:QI 0 "register_operand" "") 0)
1256 (ashiftrt:DI (match_dup 4) (const_int 56)))]
1259 { operands[2] = gen_reg_rtx (DImode);
1260 operands[3] = gen_reg_rtx (DImode);
1261 operands[4] = gen_reg_rtx (DImode);
1264 (define_expand "unaligned_extendhidi"
1265 [(set (match_dup 2) (match_operand:DI 1 "address_operand" ""))
1267 (mem:DI (and:DI (plus:DI (match_dup 2) (const_int -2))
1270 (ashift:DI (match_dup 3)
1271 (minus:DI (const_int 56)
1273 (and:DI (plus:DI (match_dup 2) (const_int -1))
1276 (set (subreg:DI (match_operand:QI 0 "register_operand" "") 0)
1277 (ashiftrt:DI (match_dup 4) (const_int 48)))]
1280 { operands[2] = gen_reg_rtx (DImode);
1281 operands[3] = gen_reg_rtx (DImode);
1282 operands[4] = gen_reg_rtx (DImode);
1286 [(set (match_operand:DI 0 "register_operand" "=r")
1287 (zero_extract:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
1288 (match_operand:DI 2 "mode_width_operand" "n")
1289 (match_operand:DI 3 "mul8_operand" "I")))]
1291 "ext%M2l %r1,%s3,%0"
1292 [(set_attr "type" "shift")])
1295 [(set (match_operand:DI 0 "register_operand" "=r")
1296 (zero_extract:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
1297 (match_operand:DI 2 "mode_width_operand" "n")
1298 (ashift:DI (match_operand:DI 3 "reg_or_8bit_operand" "rI")
1302 [(set_attr "type" "shift")])
1305 [(set (match_operand:DI 0 "register_operand" "=r")
1307 (match_operand:DI 1 "reg_or_0_operand" "rJ")
1308 (minus:DI (const_int 56)
1311 (plus:DI (match_operand:DI 2 "reg_or_8bit_operand" "rI")
1317 [(set_attr "type" "shift")])
1320 [(set (match_operand:DI 0 "register_operand" "=r")
1322 (and:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
1323 (const_int 2147483647))
1324 (minus:DI (const_int 56)
1327 (plus:DI (match_operand:DI 2 "reg_or_8bit_operand" "rI")
1333 [(set_attr "type" "shift")])
1336 [(set (match_operand:DI 0 "register_operand" "=r")
1338 (and:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
1340 (minus:DI (const_int 56)
1343 (plus:DI (match_operand:DI 2 "reg_or_8bit_operand" "rI")
1349 [(set_attr "type" "shift")])
1351 ;; This converts an extXl into an extXh with an appropriate adjustment
1352 ;; to the address calculation.
1355 ;; [(set (match_operand:DI 0 "register_operand" "")
1356 ;; (ashift:DI (zero_extract:DI (match_operand:DI 1 "register_operand" "")
1357 ;; (match_operand:DI 2 "mode_width_operand" "")
1358 ;; (ashift:DI (match_operand:DI 3 "" "")
1360 ;; (match_operand:DI 4 "const_int_operand" "")))
1361 ;; (clobber (match_operand:DI 5 "register_operand" ""))]
1362 ;; "INTVAL (operands[4]) == 64 - INTVAL (operands[2])"
1363 ;; [(set (match_dup 5) (match_dup 6))
1364 ;; (set (match_dup 0)
1365 ;; (ashift:DI (zero_extract:DI (match_dup 1) (match_dup 2)
1366 ;; (ashift:DI (plus:DI (match_dup 5)
1372 ;; operands[6] = plus_constant (operands[3],
1373 ;; INTVAL (operands[2]) / BITS_PER_UNIT);
1374 ;; operands[7] = GEN_INT (- INTVAL (operands[2]) / BITS_PER_UNIT);
1378 [(set (match_operand:DI 0 "register_operand" "=r")
1379 (ashift:DI (zero_extend:DI (match_operand:QI 1 "register_operand" "r"))
1380 (match_operand:DI 2 "mul8_operand" "I")))]
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 (match_operand:DI 2 "mul8_operand" "I")))]
1391 [(set_attr "type" "shift")])
1394 [(set (match_operand:DI 0 "register_operand" "=r")
1395 (ashift:DI (zero_extend:DI (match_operand:SI 1 "register_operand" "r"))
1396 (match_operand:DI 2 "mul8_operand" "I")))]
1399 [(set_attr "type" "shift")])
1402 [(set (match_operand:DI 0 "register_operand" "=r")
1403 (ashift:DI (zero_extend:DI (match_operand:QI 1 "register_operand" "r"))
1404 (ashift:DI (match_operand:DI 2 "reg_or_8bit_operand" "rI")
1408 [(set_attr "type" "shift")])
1411 [(set (match_operand:DI 0 "register_operand" "=r")
1412 (ashift:DI (zero_extend:DI (match_operand:HI 1 "register_operand" "r"))
1413 (ashift:DI (match_operand:DI 2 "reg_or_8bit_operand" "rI")
1417 [(set_attr "type" "shift")])
1420 [(set (match_operand:DI 0 "register_operand" "=r")
1421 (ashift:DI (zero_extend:DI (match_operand:SI 1 "register_operand" "r"))
1422 (ashift:DI (match_operand:DI 2 "reg_or_8bit_operand" "rI")
1426 [(set_attr "type" "shift")])
1428 ;; We do not include the insXh insns because they are complex to express
1429 ;; and it does not appear that we would ever want to generate them.
1432 [(set (match_operand:DI 0 "register_operand" "=r")
1433 (and:DI (not:DI (ashift:DI
1434 (match_operand:DI 2 "mode_mask_operand" "n")
1436 (match_operand:DI 3 "reg_or_8bit_operand" "rI")
1438 (match_operand:DI 1 "reg_or_0_operand" "rJ")))]
1441 [(set_attr "type" "shift")])
1443 ;; We do not include the mskXh insns because it does not appear we would ever
1446 ;; Floating-point operations. All the double-precision insns can extend
1447 ;; from single, so indicate that. The exception are the ones that simply
1448 ;; play with the sign bits; it's not clear what to do there.
1450 (define_insn "abssf2"
1451 [(set (match_operand:SF 0 "register_operand" "=f")
1452 (abs:SF (match_operand:SF 1 "reg_or_fp0_operand" "fG")))]
1455 [(set_attr "type" "fcpys")])
1457 (define_insn "absdf2"
1458 [(set (match_operand:DF 0 "register_operand" "=f")
1459 (abs:DF (match_operand:DF 1 "reg_or_fp0_operand" "fG")))]
1462 [(set_attr "type" "fcpys")])
1464 (define_insn "negsf2"
1465 [(set (match_operand:SF 0 "register_operand" "=f")
1466 (neg:SF (match_operand:SF 1 "reg_or_fp0_operand" "fG")))]
1469 [(set_attr "type" "fadd")])
1471 (define_insn "negdf2"
1472 [(set (match_operand:DF 0 "register_operand" "=f")
1473 (neg:DF (match_operand:DF 1 "reg_or_fp0_operand" "fG")))]
1476 [(set_attr "type" "fadd")])
1479 [(set (match_operand:SF 0 "register_operand" "=&f")
1480 (plus:SF (match_operand:SF 1 "reg_or_fp0_operand" "%fG")
1481 (match_operand:SF 2 "reg_or_fp0_operand" "fG")))]
1482 "TARGET_FP && alpha_tp == ALPHA_TP_INSN"
1483 "add%,%)%& %R1,%R2,%0"
1484 [(set_attr "type" "fadd")
1485 (set_attr "trap" "yes")])
1487 (define_insn "addsf3"
1488 [(set (match_operand:SF 0 "register_operand" "=f")
1489 (plus:SF (match_operand:SF 1 "reg_or_fp0_operand" "%fG")
1490 (match_operand:SF 2 "reg_or_fp0_operand" "fG")))]
1492 "add%,%)%& %R1,%R2,%0"
1493 [(set_attr "type" "fadd")
1494 (set_attr "trap" "yes")])
1497 [(set (match_operand:DF 0 "register_operand" "=&f")
1498 (plus:DF (match_operand:DF 1 "reg_or_fp0_operand" "%fG")
1499 (match_operand:DF 2 "reg_or_fp0_operand" "fG")))]
1500 "TARGET_FP && alpha_tp == ALPHA_TP_INSN"
1501 "add%-%)%& %R1,%R2,%0"
1502 [(set_attr "type" "fadd")
1503 (set_attr "trap" "yes")])
1505 (define_insn "adddf3"
1506 [(set (match_operand:DF 0 "register_operand" "=f")
1507 (plus:DF (match_operand:DF 1 "reg_or_fp0_operand" "%fG")
1508 (match_operand:DF 2 "reg_or_fp0_operand" "fG")))]
1510 "add%-%)%& %R1,%R2,%0"
1511 [(set_attr "type" "fadd")
1512 (set_attr "trap" "yes")])
1515 [(set (match_operand:DF 0 "register_operand" "=f")
1516 (plus:DF (float_extend:DF
1517 (match_operand:SF 1 "reg_or_fp0_operand" "fG"))
1518 (match_operand:DF 2 "reg_or_fp0_operand" "fG")))]
1519 "TARGET_FP && alpha_tp != ALPHA_TP_INSN"
1520 "add%-%)%& %R1,%R2,%0"
1521 [(set_attr "type" "fadd")
1522 (set_attr "trap" "yes")])
1525 [(set (match_operand:DF 0 "register_operand" "=f")
1526 (plus:DF (float_extend:DF
1527 (match_operand:SF 1 "reg_or_fp0_operand" "%fG"))
1529 (match_operand:SF 2 "reg_or_fp0_operand" "fG"))))]
1530 "TARGET_FP && alpha_tp != ALPHA_TP_INSN"
1531 "add%-%)%& %R1,%R2,%0"
1532 [(set_attr "type" "fadd")
1533 (set_attr "trap" "yes")])
1535 (define_insn "fix_truncdfdi2"
1536 [(set (match_operand:DI 0 "register_operand" "=f")
1537 (fix:DI (match_operand:DF 1 "reg_or_fp0_operand" "fG")))]
1540 [(set_attr "type" "fadd")])
1542 (define_insn "fix_truncsfdi2"
1543 [(set (match_operand:DI 0 "register_operand" "=f")
1544 (fix:DI (float_extend:DF
1545 (match_operand:SF 1 "reg_or_fp0_operand" "fG"))))]
1548 [(set_attr "type" "fadd")])
1551 [(set (match_operand:SF 0 "register_operand" "=&f")
1552 (float:SF (match_operand:DI 1 "register_operand" "f")))]
1553 "TARGET_FP && alpha_tp == ALPHA_TP_INSN"
1555 [(set_attr "type" "fadd")
1556 (set_attr "trap" "yes")])
1558 (define_insn "floatdisf2"
1559 [(set (match_operand:SF 0 "register_operand" "=f")
1560 (float:SF (match_operand:DI 1 "register_operand" "f")))]
1563 [(set_attr "type" "fadd")
1564 (set_attr "trap" "yes")])
1567 [(set (match_operand:DF 0 "register_operand" "=&f")
1568 (float:DF (match_operand:DI 1 "register_operand" "f")))]
1569 "TARGET_FP && alpha_tp == ALPHA_TP_INSN"
1571 [(set_attr "type" "fadd")
1572 (set_attr "trap" "yes")])
1574 (define_insn "floatdidf2"
1575 [(set (match_operand:DF 0 "register_operand" "=f")
1576 (float:DF (match_operand:DI 1 "register_operand" "f")))]
1579 [(set_attr "type" "fadd")
1580 (set_attr "trap" "yes")])
1582 (define_expand "extendsfdf2"
1583 [(use (match_operand:DF 0 "register_operand" ""))
1584 (use (match_operand:SF 1 "nonimmediate_operand" ""))]
1588 if (alpha_tp == ALPHA_TP_INSN)
1589 emit_insn (gen_extendsfdf2_tp (operands[0],
1590 force_reg (SFmode, operands[1])));
1592 emit_insn (gen_extendsfdf2_no_tp (operands[0], operands[1]));
1597 (define_insn "extendsfdf2_tp"
1598 [(set (match_operand:DF 0 "register_operand" "=&f")
1599 (float_extend:DF (match_operand:SF 1 "register_operand" "f")))]
1600 "TARGET_FP && alpha_tp == ALPHA_TP_INSN"
1602 [(set_attr "type" "fadd")
1603 (set_attr "trap" "yes")])
1605 (define_insn "extendsfdf2_no_tp"
1606 [(set (match_operand:DF 0 "register_operand" "=f,f,m")
1607 (float_extend:DF (match_operand:SF 1 "nonimmediate_operand" "f,m,f")))]
1608 "TARGET_FP && alpha_tp != ALPHA_TP_INSN"
1613 [(set_attr "type" "fcpys,ld,st")
1614 (set_attr "trap" "yes")])
1617 [(set (match_operand:SF 0 "register_operand" "=&f")
1618 (float_truncate:SF (match_operand:DF 1 "reg_or_fp0_operand" "fG")))]
1619 "TARGET_FP && alpha_tp == ALPHA_TP_INSN"
1620 "cvt%-%,%)%& %R1,%0"
1621 [(set_attr "type" "fadd")
1622 (set_attr "trap" "yes")])
1624 (define_insn "truncdfsf2"
1625 [(set (match_operand:SF 0 "register_operand" "=f")
1626 (float_truncate:SF (match_operand:DF 1 "reg_or_fp0_operand" "fG")))]
1628 "cvt%-%,%)%& %R1,%0"
1629 [(set_attr "type" "fadd")
1630 (set_attr "trap" "yes")])
1633 [(set (match_operand:SF 0 "register_operand" "=&f")
1634 (div:SF (match_operand:SF 1 "reg_or_fp0_operand" "fG")
1635 (match_operand:SF 2 "reg_or_fp0_operand" "fG")))]
1636 "TARGET_FP && alpha_tp == ALPHA_TP_INSN"
1637 "div%,%)%& %R1,%R2,%0"
1638 [(set_attr "type" "fdivs")
1639 (set_attr "trap" "yes")])
1641 (define_insn "divsf3"
1642 [(set (match_operand:SF 0 "register_operand" "=f")
1643 (div:SF (match_operand:SF 1 "reg_or_fp0_operand" "fG")
1644 (match_operand:SF 2 "reg_or_fp0_operand" "fG")))]
1646 "div%,%)%& %R1,%R2,%0"
1647 [(set_attr "type" "fdivs")
1648 (set_attr "trap" "yes")])
1651 [(set (match_operand:DF 0 "register_operand" "=&f")
1652 (div:DF (match_operand:DF 1 "reg_or_fp0_operand" "fG")
1653 (match_operand:DF 2 "reg_or_fp0_operand" "fG")))]
1654 "TARGET_FP && alpha_tp == ALPHA_TP_INSN"
1655 "div%-%)%& %R1,%R2,%0"
1656 [(set_attr "type" "fdivt")
1657 (set_attr "trap" "yes")])
1659 (define_insn "divdf3"
1660 [(set (match_operand:DF 0 "register_operand" "=f")
1661 (div:DF (match_operand:DF 1 "reg_or_fp0_operand" "fG")
1662 (match_operand:DF 2 "reg_or_fp0_operand" "fG")))]
1664 "div%-%)%& %R1,%R2,%0"
1665 [(set_attr "type" "fdivt")
1666 (set_attr "trap" "yes")])
1669 [(set (match_operand:DF 0 "register_operand" "=f")
1670 (div:DF (float_extend:DF (match_operand:SF 1 "reg_or_fp0_operand" "fG"))
1671 (match_operand:DF 2 "reg_or_fp0_operand" "fG")))]
1672 "TARGET_FP && alpha_tp != ALPHA_TP_INSN"
1673 "div%-%)%& %R1,%R2,%0"
1674 [(set_attr "type" "fdivt")
1675 (set_attr "trap" "yes")])
1678 [(set (match_operand:DF 0 "register_operand" "=f")
1679 (div:DF (match_operand:DF 1 "reg_or_fp0_operand" "fG")
1681 (match_operand:SF 2 "reg_or_fp0_operand" "fG"))))]
1682 "TARGET_FP && alpha_tp != ALPHA_TP_INSN"
1683 "div%-%)%& %R1,%R2,%0"
1684 [(set_attr "type" "fdivt")
1685 (set_attr "trap" "yes")])
1688 [(set (match_operand:DF 0 "register_operand" "=f")
1689 (div:DF (float_extend:DF (match_operand:SF 1 "reg_or_fp0_operand" "fG"))
1690 (float_extend:DF (match_operand:SF 2 "reg_or_fp0_operand" "fG"))))]
1691 "TARGET_FP && alpha_tp != ALPHA_TP_INSN"
1692 "div%-%)%& %R1,%R2,%0"
1693 [(set_attr "type" "fdivt")
1694 (set_attr "trap" "yes")])
1697 [(set (match_operand:SF 0 "register_operand" "=&f")
1698 (mult:SF (match_operand:SF 1 "reg_or_fp0_operand" "%fG")
1699 (match_operand:SF 2 "reg_or_fp0_operand" "fG")))]
1700 "TARGET_FP && alpha_tp == ALPHA_TP_INSN"
1701 "mul%,%)%& %R1,%R2,%0"
1702 [(set_attr "type" "fmul")
1703 (set_attr "trap" "yes")])
1705 (define_insn "mulsf3"
1706 [(set (match_operand:SF 0 "register_operand" "=f")
1707 (mult:SF (match_operand:SF 1 "reg_or_fp0_operand" "%fG")
1708 (match_operand:SF 2 "reg_or_fp0_operand" "fG")))]
1710 "mul%,%)%& %R1,%R2,%0"
1711 [(set_attr "type" "fmul")
1712 (set_attr "trap" "yes")])
1715 [(set (match_operand:DF 0 "register_operand" "=&f")
1716 (mult:DF (match_operand:DF 1 "reg_or_fp0_operand" "%fG")
1717 (match_operand:DF 2 "reg_or_fp0_operand" "fG")))]
1718 "TARGET_FP && alpha_tp == ALPHA_TP_INSN"
1719 "mul%-%)%& %R1,%R2,%0"
1720 [(set_attr "type" "fmul")
1721 (set_attr "trap" "yes")])
1723 (define_insn "muldf3"
1724 [(set (match_operand:DF 0 "register_operand" "=f")
1725 (mult:DF (match_operand:DF 1 "reg_or_fp0_operand" "%fG")
1726 (match_operand:DF 2 "reg_or_fp0_operand" "fG")))]
1728 "mul%-%)%& %R1,%R2,%0"
1729 [(set_attr "type" "fmul")
1730 (set_attr "trap" "yes")])
1733 [(set (match_operand:DF 0 "register_operand" "=f")
1734 (mult:DF (float_extend:DF
1735 (match_operand:SF 1 "reg_or_fp0_operand" "fG"))
1736 (match_operand:DF 2 "reg_or_fp0_operand" "fG")))]
1737 "TARGET_FP && alpha_tp != ALPHA_TP_INSN"
1738 "mul%-%)%& %R1,%R2,%0"
1739 [(set_attr "type" "fmul")
1740 (set_attr "trap" "yes")])
1743 [(set (match_operand:DF 0 "register_operand" "=f")
1744 (mult:DF (float_extend:DF
1745 (match_operand:SF 1 "reg_or_fp0_operand" "%fG"))
1747 (match_operand:SF 2 "reg_or_fp0_operand" "fG"))))]
1748 "TARGET_FP && alpha_tp != ALPHA_TP_INSN"
1749 "mul%-%)%& %R1,%R2,%0"
1750 [(set_attr "type" "fmul")
1751 (set_attr "trap" "yes")])
1754 [(set (match_operand:SF 0 "register_operand" "=&f")
1755 (minus:SF (match_operand:SF 1 "reg_or_fp0_operand" "fG")
1756 (match_operand:SF 2 "reg_or_fp0_operand" "fG")))]
1757 "TARGET_FP && alpha_tp == ALPHA_TP_INSN"
1758 "sub%,%)%& %R1,%R2,%0"
1759 [(set_attr "type" "fadd")
1760 (set_attr "trap" "yes")])
1762 (define_insn "subsf3"
1763 [(set (match_operand:SF 0 "register_operand" "=f")
1764 (minus:SF (match_operand:SF 1 "reg_or_fp0_operand" "fG")
1765 (match_operand:SF 2 "reg_or_fp0_operand" "fG")))]
1767 "sub%,%)%& %R1,%R2,%0"
1768 [(set_attr "type" "fadd")
1769 (set_attr "trap" "yes")])
1772 [(set (match_operand:DF 0 "register_operand" "=&f")
1773 (minus:DF (match_operand:DF 1 "reg_or_fp0_operand" "fG")
1774 (match_operand:DF 2 "reg_or_fp0_operand" "fG")))]
1775 "TARGET_FP && alpha_tp == ALPHA_TP_INSN"
1776 "sub%-%)%& %R1,%R2,%0"
1777 [(set_attr "type" "fadd")
1778 (set_attr "trap" "yes")])
1780 (define_insn "subdf3"
1781 [(set (match_operand:DF 0 "register_operand" "=f")
1782 (minus:DF (match_operand:DF 1 "reg_or_fp0_operand" "fG")
1783 (match_operand:DF 2 "reg_or_fp0_operand" "fG")))]
1785 "sub%-%)%& %R1,%R2,%0"
1786 [(set_attr "type" "fadd")
1787 (set_attr "trap" "yes")])
1790 [(set (match_operand:DF 0 "register_operand" "=f")
1791 (minus:DF (float_extend:DF
1792 (match_operand:SF 1 "reg_or_fp0_operand" "fG"))
1793 (match_operand:DF 2 "reg_or_fp0_operand" "fG")))]
1794 "TARGET_FP && alpha_tp != ALPHA_TP_INSN"
1795 "sub%-%)%& %R1,%R2,%0"
1796 [(set_attr "type" "fadd")
1797 (set_attr "trap" "yes")])
1800 [(set (match_operand:DF 0 "register_operand" "=f")
1801 (minus:DF (match_operand:DF 1 "reg_or_fp0_operand" "fG")
1803 (match_operand:SF 2 "reg_or_fp0_operand" "fG"))))]
1804 "TARGET_FP && alpha_tp != ALPHA_TP_INSN"
1805 "sub%-%)%& %R1,%R2,%0"
1806 [(set_attr "type" "fadd")
1807 (set_attr "trap" "yes")])
1810 [(set (match_operand:DF 0 "register_operand" "=f")
1811 (minus:DF (float_extend:DF
1812 (match_operand:SF 1 "reg_or_fp0_operand" "fG"))
1814 (match_operand:SF 2 "reg_or_fp0_operand" "fG"))))]
1815 "TARGET_FP && alpha_tp != ALPHA_TP_INSN"
1816 "sub%-%)%& %R1,%R2,%0"
1817 [(set_attr "type" "fadd")
1818 (set_attr "trap" "yes")])
1820 (define_insn "sqrtsf2"
1821 [(set (match_operand:SF 0 "register_operand" "=f")
1822 (sqrt:SF (match_operand:SF 1 "reg_or_fp0_operand" "fG")))]
1823 "TARGET_FP && TARGET_CIX"
1825 [(set_attr "type" "fdivs")
1826 (set_attr "trap" "yes")])
1828 (define_insn "sqrtdf2"
1829 [(set (match_operand:DF 0 "register_operand" "=f")
1830 (sqrt:DF (match_operand:DF 1 "reg_or_fp0_operand" "fG")))]
1831 "TARGET_FP && TARGET_CIX"
1833 [(set_attr "type" "fdivt")
1834 (set_attr "trap" "yes")])
1837 [(set (match_operand:DF 0 "register_operand" "=f")
1838 (sqrt:DF (float_extend:DF
1839 (match_operand:SF 1 "reg_or_fp0_operand" "fG"))))]
1840 "TARGET_FP && TARGET_CIX&& alpha_tp != ALPHA_TP_INSN"
1842 [(set_attr "type" "fdivt")
1843 (set_attr "trap" "yes")])
1845 ;; Next are all the integer comparisons, and conditional moves and branches
1846 ;; and some of the related define_expand's and define_split's.
1849 [(set (match_operand:DI 0 "register_operand" "=r")
1850 (match_operator:DI 1 "alpha_comparison_operator"
1851 [(match_operand:DI 2 "reg_or_0_operand" "rJ")
1852 (match_operand:DI 3 "reg_or_8bit_operand" "rI")]))]
1855 [(set_attr "type" "icmp")])
1858 [(set (match_operand:DI 0 "register_operand" "=r")
1859 (match_operator:DI 1 "alpha_swapped_comparison_operator"
1860 [(match_operand:DI 2 "reg_or_8bit_operand" "rI")
1861 (match_operand:DI 3 "reg_or_0_operand" "rJ")]))]
1864 [(set_attr "type" "icmp")])
1866 ;; This pattern exists so conditional moves of SImode values are handled.
1867 ;; Comparisons are still done in DImode though.
1870 [(set (match_operand:SI 0 "register_operand" "=r,r,r,r")
1872 (match_operator 2 "signed_comparison_operator"
1873 [(match_operand:DI 3 "reg_or_0_operand" "rJ,rJ,J,J")
1874 (match_operand:DI 4 "reg_or_0_operand" "J,J,rJ,rJ")])
1875 (match_operand:SI 1 "reg_or_8bit_operand" "rI,0,rI,0")
1876 (match_operand:SI 5 "reg_or_8bit_operand" "0,rI,0,rI")))]
1877 "operands[3] == const0_rtx || operands[4] == const0_rtx"
1883 [(set_attr "type" "cmov")])
1886 [(set (match_operand:DI 0 "register_operand" "=r,r,r,r")
1888 (match_operator 2 "signed_comparison_operator"
1889 [(match_operand:DI 3 "reg_or_0_operand" "rJ,rJ,J,J")
1890 (match_operand:DI 4 "reg_or_0_operand" "J,J,rJ,rJ")])
1891 (match_operand:DI 1 "reg_or_8bit_operand" "rI,0,rI,0")
1892 (match_operand:DI 5 "reg_or_8bit_operand" "0,rI,0,rI")))]
1893 "operands[3] == const0_rtx || operands[4] == const0_rtx"
1899 [(set_attr "type" "cmov")])
1902 [(set (match_operand:DI 0 "register_operand" "=r,r")
1904 (eq (zero_extract:DI (match_operand:DI 2 "reg_or_0_operand" "rJ,rJ")
1908 (match_operand:DI 1 "reg_or_8bit_operand" "rI,0")
1909 (match_operand:DI 3 "reg_or_8bit_operand" "0,rI")))]
1914 [(set_attr "type" "cmov")])
1917 [(set (match_operand:DI 0 "register_operand" "=r,r")
1919 (ne (zero_extract:DI (match_operand:DI 2 "reg_or_0_operand" "rJ,rJ")
1923 (match_operand:DI 1 "reg_or_8bit_operand" "rI,0")
1924 (match_operand:DI 3 "reg_or_8bit_operand" "0,rI")))]
1929 [(set_attr "type" "cmov")])
1931 ;; This form is added since combine thinks that an IF_THEN_ELSE with both
1932 ;; arms constant is a single insn, so it won't try to form it if combine
1933 ;; knows they are really two insns. This occurs in divides by powers
1937 [(set (match_operand:DI 0 "register_operand" "=r")
1939 (match_operator 2 "signed_comparison_operator"
1940 [(match_operand:DI 3 "reg_or_0_operand" "rJ")
1942 (plus:DI (match_dup 0)
1943 (match_operand:DI 1 "reg_or_8bit_operand" "rI"))
1945 (clobber (match_scratch:DI 4 "=&r"))]
1947 "addq %0,%1,%4\;cmov%C2 %r3,%4,%0"
1948 [(set_attr "type" "cmov")])
1951 [(set (match_operand:DI 0 "register_operand" "")
1953 (match_operator 2 "signed_comparison_operator"
1954 [(match_operand:DI 3 "reg_or_0_operand" "")
1956 (plus:DI (match_dup 0)
1957 (match_operand:DI 1 "reg_or_8bit_operand" ""))
1959 (clobber (match_operand:DI 4 "register_operand" ""))]
1961 [(set (match_dup 4) (plus:DI (match_dup 0) (match_dup 1)))
1962 (set (match_dup 0) (if_then_else:DI (match_op_dup 2
1965 (match_dup 4) (match_dup 0)))]
1970 [(set (match_operand:DI 0 "register_operand" "")
1972 (match_operator 1 "comparison_operator"
1973 [(zero_extract:DI (match_operand:DI 2 "register_operand" "")
1975 (match_operand:DI 3 "const_int_operand" ""))
1977 (match_operand:DI 4 "reg_or_8bit_operand" "")
1978 (match_operand:DI 5 "reg_or_8bit_operand" "")))
1979 (clobber (match_operand:DI 6 "register_operand" ""))])]
1980 "INTVAL (operands[3]) != 0"
1982 (lshiftrt:DI (match_dup 2) (match_dup 3)))
1984 (if_then_else:DI (match_op_dup 1
1985 [(zero_extract:DI (match_dup 6)
1993 ;; For ABS, we have two choices, depending on whether the input and output
1994 ;; registers are the same or not.
1995 (define_expand "absdi2"
1996 [(set (match_operand:DI 0 "register_operand" "")
1997 (abs:DI (match_operand:DI 1 "register_operand" "")))]
2000 { if (rtx_equal_p (operands[0], operands[1]))
2001 emit_insn (gen_absdi2_same (operands[0], gen_reg_rtx (DImode)));
2003 emit_insn (gen_absdi2_diff (operands[0], operands[1]));
2008 (define_expand "absdi2_same"
2009 [(set (match_operand:DI 1 "register_operand" "")
2010 (neg:DI (match_operand:DI 0 "register_operand" "")))
2012 (if_then_else:DI (ge (match_dup 0) (const_int 0))
2018 (define_expand "absdi2_diff"
2019 [(set (match_operand:DI 0 "register_operand" "")
2020 (neg:DI (match_operand:DI 1 "register_operand" "")))
2022 (if_then_else:DI (lt (match_dup 1) (const_int 0))
2029 [(set (match_operand:DI 0 "register_operand" "")
2030 (abs:DI (match_dup 0)))
2031 (clobber (match_operand:DI 2 "register_operand" ""))]
2033 [(set (match_dup 1) (neg:DI (match_dup 0)))
2034 (set (match_dup 0) (if_then_else:DI (ge (match_dup 0) (const_int 0))
2035 (match_dup 0) (match_dup 1)))]
2039 [(set (match_operand:DI 0 "register_operand" "")
2040 (abs:DI (match_operand:DI 1 "register_operand" "")))]
2041 "! rtx_equal_p (operands[0], operands[1])"
2042 [(set (match_dup 0) (neg:DI (match_dup 1)))
2043 (set (match_dup 0) (if_then_else:DI (lt (match_dup 1) (const_int 0))
2044 (match_dup 0) (match_dup 1)))]
2048 [(set (match_operand:DI 0 "register_operand" "")
2049 (neg:DI (abs:DI (match_dup 0))))
2050 (clobber (match_operand:DI 2 "register_operand" ""))]
2052 [(set (match_dup 1) (neg:DI (match_dup 0)))
2053 (set (match_dup 0) (if_then_else:DI (le (match_dup 0) (const_int 0))
2054 (match_dup 0) (match_dup 1)))]
2058 [(set (match_operand:DI 0 "register_operand" "")
2059 (neg:DI (abs:DI (match_operand:DI 1 "register_operand" ""))))]
2060 "! rtx_equal_p (operands[0], operands[1])"
2061 [(set (match_dup 0) (neg:DI (match_dup 1)))
2062 (set (match_dup 0) (if_then_else:DI (gt (match_dup 1) (const_int 0))
2063 (match_dup 0) (match_dup 1)))]
2066 (define_insn "sminqi3"
2067 [(set (match_operand:QI 0 "register_operand" "=r")
2068 (smin:SI (match_operand:QI 1 "reg_or_0_operand" "%rJ")
2069 (match_operand:QI 2 "reg_or_8bit_operand" "rI")))]
2072 [(set_attr "type" "shift")])
2074 (define_insn "uminqi3"
2075 [(set (match_operand:QI 0 "register_operand" "=r")
2076 (umin:SI (match_operand:QI 1 "reg_or_0_operand" "%rJ")
2077 (match_operand:QI 2 "reg_or_8bit_operand" "rI")))]
2080 [(set_attr "type" "shift")])
2082 (define_insn "smaxqi3"
2083 [(set (match_operand:QI 0 "register_operand" "=r")
2084 (smax:SI (match_operand:QI 1 "reg_or_0_operand" "%rJ")
2085 (match_operand:QI 2 "reg_or_8bit_operand" "rI")))]
2088 [(set_attr "type" "shift")])
2090 (define_insn "umaxqi3"
2091 [(set (match_operand:QI 0 "register_operand" "=r")
2092 (umax:SI (match_operand:QI 1 "reg_or_0_operand" "%rJ")
2093 (match_operand:QI 2 "reg_or_8bit_operand" "rI")))]
2096 [(set_attr "type" "shift")])
2098 (define_insn "sminhi3"
2099 [(set (match_operand:HI 0 "register_operand" "=r")
2100 (smin:SI (match_operand:HI 1 "reg_or_0_operand" "%rJ")
2101 (match_operand:HI 2 "reg_or_8bit_operand" "rI")))]
2104 [(set_attr "type" "shift")])
2106 (define_insn "uminhi3"
2107 [(set (match_operand:HI 0 "register_operand" "=r")
2108 (umin:SI (match_operand:HI 1 "reg_or_0_operand" "%rJ")
2109 (match_operand:HI 2 "reg_or_8bit_operand" "rI")))]
2112 [(set_attr "type" "shift")])
2114 (define_insn "smaxhi3"
2115 [(set (match_operand:HI 0 "register_operand" "=r")
2116 (smax:SI (match_operand:HI 1 "reg_or_0_operand" "%rJ")
2117 (match_operand:HI 2 "reg_or_8bit_operand" "rI")))]
2120 [(set_attr "type" "shift")])
2122 (define_insn "umaxhi3"
2123 [(set (match_operand:HI 0 "register_operand" "=r")
2124 (umax:SI (match_operand:HI 1 "reg_or_0_operand" "%rJ")
2125 (match_operand:HI 2 "reg_or_8bit_operand" "rI")))]
2128 [(set_attr "type" "shift")])
2130 (define_expand "smaxdi3"
2132 (le:DI (match_operand:DI 1 "reg_or_0_operand" "")
2133 (match_operand:DI 2 "reg_or_8bit_operand" "")))
2134 (set (match_operand:DI 0 "register_operand" "")
2135 (if_then_else:DI (eq (match_dup 3) (const_int 0))
2136 (match_dup 1) (match_dup 2)))]
2139 { operands[3] = gen_reg_rtx (DImode);
2143 [(set (match_operand:DI 0 "register_operand" "")
2144 (smax:DI (match_operand:DI 1 "reg_or_0_operand" "")
2145 (match_operand:DI 2 "reg_or_8bit_operand" "")))
2146 (clobber (match_operand:DI 3 "register_operand" ""))]
2147 "operands[2] != const0_rtx"
2148 [(set (match_dup 3) (le:DI (match_dup 1) (match_dup 2)))
2149 (set (match_dup 0) (if_then_else:DI (eq (match_dup 3) (const_int 0))
2150 (match_dup 1) (match_dup 2)))]
2154 [(set (match_operand:DI 0 "register_operand" "=r")
2155 (smax:DI (match_operand:DI 1 "register_operand" "0")
2159 [(set_attr "type" "cmov")])
2161 (define_expand "smindi3"
2163 (lt:DI (match_operand:DI 1 "reg_or_0_operand" "")
2164 (match_operand:DI 2 "reg_or_8bit_operand" "")))
2165 (set (match_operand:DI 0 "register_operand" "")
2166 (if_then_else:DI (ne (match_dup 3) (const_int 0))
2167 (match_dup 1) (match_dup 2)))]
2170 { operands[3] = gen_reg_rtx (DImode);
2174 [(set (match_operand:DI 0 "register_operand" "")
2175 (smin:DI (match_operand:DI 1 "reg_or_0_operand" "")
2176 (match_operand:DI 2 "reg_or_8bit_operand" "")))
2177 (clobber (match_operand:DI 3 "register_operand" ""))]
2178 "operands[2] != const0_rtx"
2179 [(set (match_dup 3) (lt:DI (match_dup 1) (match_dup 2)))
2180 (set (match_dup 0) (if_then_else:DI (ne (match_dup 3) (const_int 0))
2181 (match_dup 1) (match_dup 2)))]
2185 [(set (match_operand:DI 0 "register_operand" "=r")
2186 (smin:DI (match_operand:DI 1 "register_operand" "0")
2190 [(set_attr "type" "cmov")])
2192 (define_expand "umaxdi3"
2194 (leu:DI (match_operand:DI 1 "reg_or_0_operand" "")
2195 (match_operand:DI 2 "reg_or_8bit_operand" "")))
2196 (set (match_operand:DI 0 "register_operand" "")
2197 (if_then_else:DI (eq (match_dup 3) (const_int 0))
2198 (match_dup 1) (match_dup 2)))]
2201 { operands[3] = gen_reg_rtx (DImode);
2205 [(set (match_operand:DI 0 "register_operand" "")
2206 (umax:DI (match_operand:DI 1 "reg_or_0_operand" "")
2207 (match_operand:DI 2 "reg_or_8bit_operand" "")))
2208 (clobber (match_operand:DI 3 "register_operand" ""))]
2209 "operands[2] != const0_rtx"
2210 [(set (match_dup 3) (leu:DI (match_dup 1) (match_dup 2)))
2211 (set (match_dup 0) (if_then_else:DI (eq (match_dup 3) (const_int 0))
2212 (match_dup 1) (match_dup 2)))]
2215 (define_expand "umindi3"
2217 (ltu:DI (match_operand:DI 1 "reg_or_0_operand" "")
2218 (match_operand:DI 2 "reg_or_8bit_operand" "")))
2219 (set (match_operand:DI 0 "register_operand" "")
2220 (if_then_else:DI (ne (match_dup 3) (const_int 0))
2221 (match_dup 1) (match_dup 2)))]
2224 { operands[3] = gen_reg_rtx (DImode);
2228 [(set (match_operand:DI 0 "register_operand" "")
2229 (umin:DI (match_operand:DI 1 "reg_or_0_operand" "")
2230 (match_operand:DI 2 "reg_or_8bit_operand" "")))
2231 (clobber (match_operand:DI 3 "register_operand" ""))]
2232 "operands[2] != const0_rtx"
2233 [(set (match_dup 3) (ltu:DI (match_dup 1) (match_dup 2)))
2234 (set (match_dup 0) (if_then_else:DI (ne (match_dup 3) (const_int 0))
2235 (match_dup 1) (match_dup 2)))]
2241 (match_operator 1 "signed_comparison_operator"
2242 [(match_operand:DI 2 "reg_or_0_operand" "rJ")
2244 (label_ref (match_operand 0 "" ""))
2248 [(set_attr "type" "ibr")])
2253 (match_operator 1 "signed_comparison_operator"
2255 (match_operand:DI 2 "register_operand" "r")])
2256 (label_ref (match_operand 0 "" ""))
2260 [(set_attr "type" "ibr")])
2265 (ne (zero_extract:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
2269 (label_ref (match_operand 0 "" ""))
2273 [(set_attr "type" "ibr")])
2278 (eq (zero_extract:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
2282 (label_ref (match_operand 0 "" ""))
2286 [(set_attr "type" "ibr")])
2292 (match_operator 1 "comparison_operator"
2293 [(zero_extract:DI (match_operand:DI 2 "register_operand" "")
2295 (match_operand:DI 3 "const_int_operand" ""))
2297 (label_ref (match_operand 0 "" ""))
2299 (clobber (match_operand:DI 4 "register_operand" ""))])]
2300 "INTVAL (operands[3]) != 0"
2302 (lshiftrt:DI (match_dup 2) (match_dup 3)))
2304 (if_then_else (match_op_dup 1
2305 [(zero_extract:DI (match_dup 4)
2309 (label_ref (match_dup 0))
2313 ;; The following are the corresponding floating-point insns. Recall
2314 ;; we need to have variants that expand the arguments from SF mode
2318 [(set (match_operand:DF 0 "register_operand" "=&f")
2319 (match_operator:DF 1 "alpha_comparison_operator"
2320 [(match_operand:DF 2 "reg_or_fp0_operand" "fG")
2321 (match_operand:DF 3 "reg_or_fp0_operand" "fG")]))]
2322 "TARGET_FP && alpha_tp == ALPHA_TP_INSN"
2323 "cmp%-%C1%' %R2,%R3,%0"
2324 [(set_attr "type" "fadd")
2325 (set_attr "trap" "yes")])
2328 [(set (match_operand:DF 0 "register_operand" "=f")
2329 (match_operator:DF 1 "alpha_comparison_operator"
2330 [(match_operand:DF 2 "reg_or_fp0_operand" "fG")
2331 (match_operand:DF 3 "reg_or_fp0_operand" "fG")]))]
2332 "TARGET_FP && alpha_tp != ALPHA_TP_INSN"
2333 "cmp%-%C1%' %R2,%R3,%0"
2334 [(set_attr "type" "fadd")
2335 (set_attr "trap" "yes")])
2338 [(set (match_operand:DF 0 "register_operand" "=f")
2339 (match_operator:DF 1 "alpha_comparison_operator"
2341 (match_operand:SF 2 "reg_or_fp0_operand" "fG"))
2342 (match_operand:DF 3 "reg_or_fp0_operand" "fG")]))]
2343 "TARGET_FP && alpha_tp != ALPHA_TP_INSN"
2344 "cmp%-%C1%' %R2,%R3,%0"
2345 [(set_attr "type" "fadd")
2346 (set_attr "trap" "yes")])
2349 [(set (match_operand:DF 0 "register_operand" "=f")
2350 (match_operator:DF 1 "alpha_comparison_operator"
2351 [(match_operand:DF 2 "reg_or_fp0_operand" "fG")
2353 (match_operand:SF 3 "reg_or_fp0_operand" "fG"))]))]
2354 "TARGET_FP && alpha_tp != ALPHA_TP_INSN"
2355 "cmp%-%C1%' %R2,%R3,%0"
2356 [(set_attr "type" "fadd")
2357 (set_attr "trap" "yes")])
2360 [(set (match_operand:DF 0 "register_operand" "=f")
2361 (match_operator:DF 1 "alpha_comparison_operator"
2363 (match_operand:SF 2 "reg_or_fp0_operand" "fG"))
2365 (match_operand:SF 3 "reg_or_fp0_operand" "fG"))]))]
2366 "TARGET_FP && alpha_tp != ALPHA_TP_INSN"
2367 "cmp%-%C1%' %R2,%R3,%0"
2368 [(set_attr "type" "fadd")
2369 (set_attr "trap" "yes")])
2372 [(set (match_operand:DF 0 "register_operand" "=&f,f")
2374 (match_operator 3 "signed_comparison_operator"
2375 [(match_operand:DF 4 "reg_or_fp0_operand" "fG,fG")
2376 (match_operand:DF 2 "fp0_operand" "G,G")])
2377 (match_operand:DF 1 "reg_or_fp0_operand" "fG,0")
2378 (match_operand:DF 5 "reg_or_fp0_operand" "0,fG")))]
2379 "TARGET_FP && alpha_tp == ALPHA_TP_INSN"
2382 fcmov%D3 %R4,%R5,%0"
2383 [(set_attr "type" "fadd")])
2386 [(set (match_operand:DF 0 "register_operand" "=f,f")
2388 (match_operator 3 "signed_comparison_operator"
2389 [(match_operand:DF 4 "reg_or_fp0_operand" "fG,fG")
2390 (match_operand:DF 2 "fp0_operand" "G,G")])
2391 (match_operand:DF 1 "reg_or_fp0_operand" "fG,0")
2392 (match_operand:DF 5 "reg_or_fp0_operand" "0,fG")))]
2393 "TARGET_FP && alpha_tp != ALPHA_TP_INSN"
2396 fcmov%D3 %R4,%R5,%0"
2397 [(set_attr "type" "fadd")])
2400 [(set (match_operand:SF 0 "register_operand" "=&f,f")
2402 (match_operator 3 "signed_comparison_operator"
2403 [(match_operand:DF 4 "reg_or_fp0_operand" "fG,fG")
2404 (match_operand:DF 2 "fp0_operand" "G,G")])
2405 (match_operand:SF 1 "reg_or_fp0_operand" "fG,0")
2406 (match_operand:SF 5 "reg_or_fp0_operand" "0,fG")))]
2407 "TARGET_FP && alpha_tp == ALPHA_TP_INSN"
2410 fcmov%D3 %R4,%R5,%0"
2411 [(set_attr "type" "fadd")])
2414 [(set (match_operand:SF 0 "register_operand" "=f,f")
2416 (match_operator 3 "signed_comparison_operator"
2417 [(match_operand:DF 4 "reg_or_fp0_operand" "fG,fG")
2418 (match_operand:DF 2 "fp0_operand" "G,G")])
2419 (match_operand:SF 1 "reg_or_fp0_operand" "fG,0")
2420 (match_operand:SF 5 "reg_or_fp0_operand" "0,fG")))]
2421 "TARGET_FP && alpha_tp != ALPHA_TP_INSN"
2424 fcmov%D3 %R4,%R5,%0"
2425 [(set_attr "type" "fadd")])
2428 [(set (match_operand:DF 0 "register_operand" "=f,f")
2430 (match_operator 3 "signed_comparison_operator"
2431 [(match_operand:DF 4 "reg_or_fp0_operand" "fG,fG")
2432 (match_operand:DF 2 "fp0_operand" "G,G")])
2433 (float_extend:DF (match_operand:SF 1 "reg_or_fp0_operand" "fG,0"))
2434 (match_operand:DF 5 "reg_or_fp0_operand" "0,fG")))]
2435 "TARGET_FP && alpha_tp != ALPHA_TP_INSN"
2438 fcmov%D3 %R4,%R5,%0"
2439 [(set_attr "type" "fadd")])
2442 [(set (match_operand:DF 0 "register_operand" "=f,f")
2444 (match_operator 3 "signed_comparison_operator"
2446 (match_operand:SF 4 "reg_or_fp0_operand" "fG,fG"))
2447 (match_operand:DF 2 "fp0_operand" "G,G")])
2448 (match_operand:DF 1 "reg_or_fp0_operand" "fG,0")
2449 (match_operand:DF 5 "reg_or_fp0_operand" "0,fG")))]
2450 "TARGET_FP && alpha_tp != ALPHA_TP_INSN"
2453 fcmov%D3 %R4,%R5,%0"
2454 [(set_attr "type" "fadd")])
2457 [(set (match_operand:SF 0 "register_operand" "=f,f")
2459 (match_operator 3 "signed_comparison_operator"
2461 (match_operand:SF 4 "reg_or_fp0_operand" "fG,fG"))
2462 (match_operand:DF 2 "fp0_operand" "G,G")])
2463 (match_operand:SF 1 "reg_or_fp0_operand" "fG,0")
2464 (match_operand:SF 5 "reg_or_fp0_operand" "0,fG")))]
2465 "TARGET_FP && alpha_tp != ALPHA_TP_INSN"
2468 fcmov%D3 %R4,%R5,%0"
2469 [(set_attr "type" "fadd")])
2472 [(set (match_operand:DF 0 "register_operand" "=f,f")
2474 (match_operator 3 "signed_comparison_operator"
2476 (match_operand:SF 4 "reg_or_fp0_operand" "fG,fG"))
2477 (match_operand:DF 2 "fp0_operand" "G,G")])
2478 (float_extend:DF (match_operand:SF 1 "reg_or_fp0_operand" "fG,0"))
2479 (match_operand:DF 5 "reg_or_fp0_operand" "0,fG")))]
2480 "TARGET_FP && alpha_tp != ALPHA_TP_INSN"
2483 fcmov%D3 %R4,%R5,%0"
2484 [(set_attr "type" "fadd")])
2486 (define_expand "maxdf3"
2488 (le:DF (match_operand:DF 1 "reg_or_fp0_operand" "")
2489 (match_operand:DF 2 "reg_or_fp0_operand" "")))
2490 (set (match_operand:DF 0 "register_operand" "")
2491 (if_then_else:DF (eq (match_dup 3) (match_dup 4))
2492 (match_dup 1) (match_dup 2)))]
2495 { operands[3] = gen_reg_rtx (DFmode);
2496 operands[4] = CONST0_RTX (DFmode);
2499 (define_expand "mindf3"
2501 (lt:DF (match_operand:DF 1 "reg_or_fp0_operand" "")
2502 (match_operand:DF 2 "reg_or_fp0_operand" "")))
2503 (set (match_operand:DF 0 "register_operand" "")
2504 (if_then_else:DF (ne (match_dup 3) (match_dup 4))
2505 (match_dup 1) (match_dup 2)))]
2508 { operands[3] = gen_reg_rtx (DFmode);
2509 operands[4] = CONST0_RTX (DFmode);
2512 (define_expand "maxsf3"
2514 (le:DF (float_extend:DF (match_operand:SF 1 "reg_or_fp0_operand" ""))
2515 (float_extend:DF (match_operand:SF 2 "reg_or_fp0_operand" ""))))
2516 (set (match_operand:SF 0 "register_operand" "")
2517 (if_then_else:SF (eq (match_dup 3) (match_dup 4))
2518 (match_dup 1) (match_dup 2)))]
2521 { operands[3] = gen_reg_rtx (DFmode);
2522 operands[4] = CONST0_RTX (DFmode);
2525 (define_expand "minsf3"
2527 (lt:DF (float_extend:DF (match_operand:SF 1 "reg_or_fp0_operand" ""))
2528 (float_extend:DF (match_operand:SF 2 "reg_or_fp0_operand" ""))))
2529 (set (match_operand:SF 0 "register_operand" "")
2530 (if_then_else:SF (ne (match_dup 3) (match_dup 4))
2531 (match_dup 1) (match_dup 2)))]
2534 { operands[3] = gen_reg_rtx (DFmode);
2535 operands[4] = CONST0_RTX (DFmode);
2541 (match_operator 1 "signed_comparison_operator"
2542 [(match_operand:DF 2 "reg_or_fp0_operand" "fG")
2543 (match_operand:DF 3 "fp0_operand" "G")])
2544 (label_ref (match_operand 0 "" ""))
2548 [(set_attr "type" "fbr")])
2553 (match_operator 1 "signed_comparison_operator"
2555 (match_operand:SF 2 "reg_or_fp0_operand" "fG"))
2556 (match_operand:DF 3 "fp0_operand" "G")])
2557 (label_ref (match_operand 0 "" ""))
2561 [(set_attr "type" "fbr")])
2563 ;; These are the main define_expand's used to make conditional branches
2566 (define_expand "cmpdf"
2567 [(set (cc0) (compare (match_operand:DF 0 "reg_or_fp0_operand" "")
2568 (match_operand:DF 1 "reg_or_fp0_operand" "")))]
2572 alpha_compare_op0 = operands[0];
2573 alpha_compare_op1 = operands[1];
2574 alpha_compare_fp_p = 1;
2578 (define_expand "cmpdi"
2579 [(set (cc0) (compare (match_operand:DI 0 "reg_or_0_operand" "")
2580 (match_operand:DI 1 "reg_or_8bit_operand" "")))]
2584 alpha_compare_op0 = operands[0];
2585 alpha_compare_op1 = operands[1];
2586 alpha_compare_fp_p = 0;
2590 (define_expand "beq"
2591 [(set (match_dup 1) (match_dup 2))
2593 (if_then_else (match_dup 3)
2594 (label_ref (match_operand 0 "" ""))
2599 enum machine_mode mode;
2600 enum rtx_code compare_code = EQ, branch_code = NE;
2602 if (alpha_compare_fp_p)
2607 /* We want to use cmpeq/bne when we can, since there is a zero-delay
2608 bypass between logicals and br/cmov on the 21164. But we don't
2609 want to force valid immediate constants into registers needlessly. */
2610 if (GET_CODE (alpha_compare_op1) == CONST_INT
2611 && ((INTVAL (alpha_compare_op1) >= -0x8000
2612 && INTVAL (alpha_compare_op1) < 0)
2613 || (INTVAL (alpha_compare_op1) > 0xff
2614 && INTVAL (alpha_compare_op1) < 0x8000)))
2616 compare_code = PLUS, branch_code = EQ;
2617 alpha_compare_op1 = GEN_INT (- INTVAL (alpha_compare_op1));
2621 operands[1] = gen_reg_rtx (mode);
2622 operands[2] = gen_rtx (compare_code, mode,
2623 alpha_compare_op0, alpha_compare_op1);
2624 operands[3] = gen_rtx (branch_code, VOIDmode,
2625 operands[1], CONST0_RTX (mode));
2628 (define_expand "bne"
2629 [(set (match_dup 1) (match_dup 2))
2631 (if_then_else (match_dup 3)
2632 (label_ref (match_operand 0 "" ""))
2637 enum machine_mode mode;
2638 enum rtx_code compare_code = EQ, branch_code = EQ;
2640 if (alpha_compare_fp_p)
2645 /* We want to use cmpeq/bne when we can, since there is a zero-delay
2646 bypass between logicals and br/cmov on the 21164. But we don't
2647 want to force valid immediate constants into registers needlessly. */
2648 if (GET_CODE (alpha_compare_op1) == CONST_INT
2649 && ((INTVAL (alpha_compare_op1) >= -0x8000
2650 && INTVAL (alpha_compare_op1) < 0)
2651 || (INTVAL (alpha_compare_op1) > 0xff
2652 && INTVAL (alpha_compare_op1) < 0x8000)))
2654 compare_code = PLUS, branch_code = NE;
2655 alpha_compare_op1 = GEN_INT (- INTVAL (alpha_compare_op1));
2659 operands[1] = gen_reg_rtx (mode);
2660 operands[2] = gen_rtx (compare_code, mode,
2661 alpha_compare_op0, alpha_compare_op1);
2662 operands[3] = gen_rtx (branch_code, VOIDmode,
2663 operands[1], CONST0_RTX (mode));
2666 (define_expand "blt"
2667 [(set (match_dup 1) (match_dup 2))
2669 (if_then_else (match_dup 3)
2670 (label_ref (match_operand 0 "" ""))
2675 enum machine_mode mode = alpha_compare_fp_p ? DFmode : DImode;
2676 operands[1] = gen_reg_rtx (mode);
2677 operands[2] = gen_rtx (LT, mode, alpha_compare_op0, alpha_compare_op1);
2678 operands[3] = gen_rtx (NE, VOIDmode, operands[1], CONST0_RTX (mode));
2681 (define_expand "ble"
2682 [(set (match_dup 1) (match_dup 2))
2684 (if_then_else (match_dup 3)
2685 (label_ref (match_operand 0 "" ""))
2690 enum machine_mode mode = alpha_compare_fp_p ? DFmode : DImode;
2691 operands[1] = gen_reg_rtx (mode);
2692 operands[2] = gen_rtx (LE, mode, alpha_compare_op0, alpha_compare_op1);
2693 operands[3] = gen_rtx (NE, VOIDmode, operands[1], CONST0_RTX (mode));
2696 (define_expand "bgt"
2697 [(set (match_dup 1) (match_dup 2))
2699 (if_then_else (match_dup 3)
2700 (label_ref (match_operand 0 "" ""))
2705 if (alpha_compare_fp_p)
2707 operands[1] = gen_reg_rtx (DFmode);
2708 operands[2] = gen_rtx (LT, DFmode, alpha_compare_op1, alpha_compare_op0);
2709 operands[3] = gen_rtx (NE, VOIDmode, operands[1], CONST0_RTX (DFmode));
2713 operands[1] = gen_reg_rtx (DImode);
2714 operands[2] = gen_rtx (LE, DImode, alpha_compare_op0, alpha_compare_op1);
2715 operands[3] = gen_rtx (EQ, VOIDmode, operands[1], const0_rtx);
2719 (define_expand "bge"
2720 [(set (match_dup 1) (match_dup 2))
2722 (if_then_else (match_dup 3)
2723 (label_ref (match_operand 0 "" ""))
2728 if (alpha_compare_fp_p)
2730 operands[1] = gen_reg_rtx (DFmode);
2731 operands[2] = gen_rtx (LE, DFmode, alpha_compare_op1, alpha_compare_op0);
2732 operands[3] = gen_rtx (NE, VOIDmode, operands[1], CONST0_RTX (DFmode));
2736 operands[1] = gen_reg_rtx (DImode);
2737 operands[2] = gen_rtx (LT, DImode, alpha_compare_op0, alpha_compare_op1);
2738 operands[3] = gen_rtx (EQ, VOIDmode, operands[1], const0_rtx);
2742 (define_expand "bltu"
2743 [(set (match_dup 1) (match_dup 2))
2745 (if_then_else (match_dup 3)
2746 (label_ref (match_operand 0 "" ""))
2751 operands[1] = gen_reg_rtx (DImode);
2752 operands[2] = gen_rtx (LTU, DImode, alpha_compare_op0, alpha_compare_op1);
2753 operands[3] = gen_rtx (NE, VOIDmode, operands[1], const0_rtx);
2756 (define_expand "bleu"
2757 [(set (match_dup 1) (match_dup 2))
2759 (if_then_else (match_dup 3)
2760 (label_ref (match_operand 0 "" ""))
2765 operands[1] = gen_reg_rtx (DImode);
2766 operands[2] = gen_rtx (LEU, DImode, alpha_compare_op0, alpha_compare_op1);
2767 operands[3] = gen_rtx (NE, VOIDmode, operands[1], const0_rtx);
2770 (define_expand "bgtu"
2771 [(set (match_dup 1) (match_dup 2))
2773 (if_then_else (match_dup 3)
2774 (label_ref (match_operand 0 "" ""))
2779 operands[1] = gen_reg_rtx (DImode);
2780 operands[2] = gen_rtx (LEU, DImode, alpha_compare_op0, alpha_compare_op1);
2781 operands[3] = gen_rtx (EQ, VOIDmode, operands[1], const0_rtx);
2784 (define_expand "bgeu"
2785 [(set (match_dup 1) (match_dup 2))
2787 (if_then_else (match_dup 3)
2788 (label_ref (match_operand 0 "" ""))
2793 operands[1] = gen_reg_rtx (DImode);
2794 operands[2] = gen_rtx (LTU, DImode, alpha_compare_op0, alpha_compare_op1);
2795 operands[3] = gen_rtx (EQ, VOIDmode, operands[1], const0_rtx);
2798 (define_expand "seq"
2799 [(set (match_operand:DI 0 "register_operand" "")
2804 if (alpha_compare_fp_p)
2807 operands[1] = gen_rtx (EQ, DImode, alpha_compare_op0, alpha_compare_op1);
2810 (define_expand "sne"
2811 [(set (match_operand:DI 0 "register_operand" "")
2813 (set (match_dup 0) (xor:DI (match_dup 0) (const_int 1)))]
2817 if (alpha_compare_fp_p)
2820 operands[1] = gen_rtx (EQ, DImode, alpha_compare_op0, alpha_compare_op1);
2823 (define_expand "slt"
2824 [(set (match_operand:DI 0 "register_operand" "")
2829 if (alpha_compare_fp_p)
2832 operands[1] = gen_rtx (LT, DImode, alpha_compare_op0, alpha_compare_op1);
2835 (define_expand "sle"
2836 [(set (match_operand:DI 0 "register_operand" "")
2841 if (alpha_compare_fp_p)
2844 operands[1] = gen_rtx (LE, DImode, alpha_compare_op0, alpha_compare_op1);
2847 (define_expand "sgt"
2848 [(set (match_operand:DI 0 "register_operand" "")
2853 if (alpha_compare_fp_p)
2856 operands[1] = gen_rtx (LT, DImode, force_reg (DImode, alpha_compare_op1),
2860 (define_expand "sge"
2861 [(set (match_operand:DI 0 "register_operand" "")
2866 if (alpha_compare_fp_p)
2869 operands[1] = gen_rtx (LE, DImode, force_reg (DImode, alpha_compare_op1),
2873 (define_expand "sltu"
2874 [(set (match_operand:DI 0 "register_operand" "")
2879 if (alpha_compare_fp_p)
2882 operands[1] = gen_rtx (LTU, DImode, alpha_compare_op0, alpha_compare_op1);
2885 (define_expand "sleu"
2886 [(set (match_operand:DI 0 "register_operand" "")
2891 if (alpha_compare_fp_p)
2894 operands[1] = gen_rtx (LEU, DImode, alpha_compare_op0, alpha_compare_op1);
2897 (define_expand "sgtu"
2898 [(set (match_operand:DI 0 "register_operand" "")
2903 if (alpha_compare_fp_p)
2906 operands[1] = gen_rtx (LTU, DImode, force_reg (DImode, alpha_compare_op1),
2910 (define_expand "sgeu"
2911 [(set (match_operand:DI 0 "register_operand" "")
2916 if (alpha_compare_fp_p)
2919 operands[1] = gen_rtx (LEU, DImode, force_reg (DImode, alpha_compare_op1),
2923 ;; These are the main define_expand's used to make conditional moves.
2925 (define_expand "movsicc"
2926 [(set (match_operand:SI 0 "register_operand" "")
2927 (if_then_else:DI (match_operand 1 "comparison_operator" "")
2928 (match_operand:SI 2 "reg_or_8bit_operand" "")
2929 (match_operand:SI 3 "reg_or_8bit_operand" "")))]
2933 if ((operands[1] = alpha_emit_conditional_move (operands[1], SImode)) == 0)
2937 (define_expand "movdicc"
2938 [(set (match_operand:DI 0 "register_operand" "")
2939 (if_then_else:DI (match_operand 1 "comparison_operator" "")
2940 (match_operand:DI 2 "reg_or_8bit_operand" "")
2941 (match_operand:DI 3 "reg_or_8bit_operand" "")))]
2945 if ((operands[1] = alpha_emit_conditional_move (operands[1], DImode)) == 0)
2949 (define_expand "movsfcc"
2950 [(set (match_operand:SF 0 "register_operand" "")
2951 (if_then_else:SF (match_operand 1 "comparison_operator" "")
2952 (match_operand:SF 2 "reg_or_8bit_operand" "")
2953 (match_operand:SF 3 "reg_or_8bit_operand" "")))]
2957 if ((operands[1] = alpha_emit_conditional_move (operands[1], SFmode)) == 0)
2961 (define_expand "movdfcc"
2962 [(set (match_operand:DF 0 "register_operand" "")
2963 (if_then_else:DF (match_operand 1 "comparison_operator" "")
2964 (match_operand:DF 2 "reg_or_8bit_operand" "")
2965 (match_operand:DF 3 "reg_or_8bit_operand" "")))]
2969 if ((operands[1] = alpha_emit_conditional_move (operands[1], DFmode)) == 0)
2973 ;; These define_split definitions are used in cases when comparisons have
2974 ;; not be stated in the correct way and we need to reverse the second
2975 ;; comparison. For example, x >= 7 has to be done as x < 6 with the
2976 ;; comparison that tests the result being reversed. We have one define_split
2977 ;; for each use of a comparison. They do not match valid insns and need
2978 ;; not generate valid insns.
2980 ;; We can also handle equality comparisons (and inequality comparisons in
2981 ;; cases where the resulting add cannot overflow) by doing an add followed by
2982 ;; a comparison with zero. This is faster since the addition takes one
2983 ;; less cycle than a compare when feeding into a conditional move.
2984 ;; For this case, we also have an SImode pattern since we can merge the add
2985 ;; and sign extend and the order doesn't matter.
2987 ;; We do not do this for floating-point, since it isn't clear how the "wrong"
2988 ;; operation could have been generated.
2991 [(set (match_operand:DI 0 "register_operand" "")
2993 (match_operator 1 "comparison_operator"
2994 [(match_operand:DI 2 "reg_or_0_operand" "")
2995 (match_operand:DI 3 "reg_or_cint_operand" "")])
2996 (match_operand:DI 4 "reg_or_cint_operand" "")
2997 (match_operand:DI 5 "reg_or_cint_operand" "")))
2998 (clobber (match_operand:DI 6 "register_operand" ""))]
2999 "operands[3] != const0_rtx"
3000 [(set (match_dup 6) (match_dup 7))
3002 (if_then_else:DI (match_dup 8) (match_dup 4) (match_dup 5)))]
3004 { enum rtx_code code = GET_CODE (operands[1]);
3005 int unsignedp = (code == GEU || code == LEU || code == GTU || code == LTU);
3007 /* If we are comparing for equality with a constant and that constant
3008 appears in the arm when the register equals the constant, use the
3009 register since that is more likely to match (and to produce better code
3012 if (code == EQ && GET_CODE (operands[3]) == CONST_INT
3013 && rtx_equal_p (operands[4], operands[3]))
3014 operands[4] = operands[2];
3016 else if (code == NE && GET_CODE (operands[3]) == CONST_INT
3017 && rtx_equal_p (operands[5], operands[3]))
3018 operands[5] = operands[2];
3020 if (code == NE || code == EQ
3021 || (extended_count (operands[2], DImode, unsignedp) >= 1
3022 && extended_count (operands[3], DImode, unsignedp) >= 1))
3024 if (GET_CODE (operands[3]) == CONST_INT)
3025 operands[7] = gen_rtx (PLUS, DImode, operands[2],
3026 GEN_INT (- INTVAL (operands[3])));
3028 operands[7] = gen_rtx (MINUS, DImode, operands[2], operands[3]);
3030 operands[8] = gen_rtx (code, VOIDmode, operands[6], const0_rtx);
3033 else if (code == EQ || code == LE || code == LT
3034 || code == LEU || code == LTU)
3036 operands[7] = gen_rtx (code, DImode, operands[2], operands[3]);
3037 operands[8] = gen_rtx (NE, VOIDmode, operands[6], const0_rtx);
3041 operands[7] = gen_rtx (reverse_condition (code), DImode, operands[2],
3043 operands[8] = gen_rtx (EQ, VOIDmode, operands[6], const0_rtx);
3048 [(set (match_operand:DI 0 "register_operand" "")
3050 (match_operator 1 "comparison_operator"
3051 [(match_operand:SI 2 "reg_or_0_operand" "")
3052 (match_operand:SI 3 "reg_or_cint_operand" "")])
3053 (match_operand:DI 4 "reg_or_8bit_operand" "")
3054 (match_operand:DI 5 "reg_or_8bit_operand" "")))
3055 (clobber (match_operand:DI 6 "register_operand" ""))]
3056 "operands[3] != const0_rtx
3057 && (GET_CODE (operands[1]) == EQ || GET_CODE (operands[1]) == NE)"
3058 [(set (match_dup 6) (match_dup 7))
3060 (if_then_else:DI (match_dup 8) (match_dup 4) (match_dup 5)))]
3062 { enum rtx_code code = GET_CODE (operands[1]);
3063 int unsignedp = (code == GEU || code == LEU || code == GTU || code == LTU);
3066 if ((code != NE && code != EQ
3067 && ! (extended_count (operands[2], DImode, unsignedp) >= 1
3068 && extended_count (operands[3], DImode, unsignedp) >= 1)))
3071 if (GET_CODE (operands[3]) == CONST_INT)
3072 tem = gen_rtx (PLUS, SImode, operands[2],
3073 GEN_INT (- INTVAL (operands[3])));
3075 tem = gen_rtx (MINUS, SImode, operands[2], operands[3]);
3077 operands[7] = gen_rtx (SIGN_EXTEND, DImode, tem);
3078 operands[8] = gen_rtx (GET_CODE (operands[1]), VOIDmode, operands[6],
3085 (match_operator 1 "comparison_operator"
3086 [(match_operand:DI 2 "reg_or_0_operand" "")
3087 (match_operand:DI 3 "reg_or_cint_operand" "")])
3088 (label_ref (match_operand 0 "" ""))
3090 (clobber (match_operand:DI 4 "register_operand" ""))]
3091 "operands[3] != const0_rtx"
3092 [(set (match_dup 4) (match_dup 5))
3093 (set (pc) (if_then_else (match_dup 6) (label_ref (match_dup 0)) (pc)))]
3095 { enum rtx_code code = GET_CODE (operands[1]);
3096 int unsignedp = (code == GEU || code == LEU || code == GTU || code == LTU);
3098 if (code == NE || code == EQ
3099 || (extended_count (operands[2], DImode, unsignedp) >= 1
3100 && extended_count (operands[3], DImode, unsignedp) >= 1))
3102 if (GET_CODE (operands[3]) == CONST_INT)
3103 operands[5] = gen_rtx (PLUS, DImode, operands[2],
3104 GEN_INT (- INTVAL (operands[3])));
3106 operands[5] = gen_rtx (MINUS, DImode, operands[2], operands[3]);
3108 operands[6] = gen_rtx (code, VOIDmode, operands[4], const0_rtx);
3111 else if (code == EQ || code == LE || code == LT
3112 || code == LEU || code == LTU)
3114 operands[5] = gen_rtx (code, DImode, operands[2], operands[3]);
3115 operands[6] = gen_rtx (NE, VOIDmode, operands[4], const0_rtx);
3119 operands[5] = gen_rtx (reverse_condition (code), DImode, operands[2],
3121 operands[6] = gen_rtx (EQ, VOIDmode, operands[4], const0_rtx);
3128 (match_operator 1 "comparison_operator"
3129 [(match_operand:SI 2 "reg_or_0_operand" "")
3130 (match_operand:SI 3 "const_int_operand" "")])
3131 (label_ref (match_operand 0 "" ""))
3133 (clobber (match_operand:DI 4 "register_operand" ""))]
3134 "operands[3] != const0_rtx
3135 && (GET_CODE (operands[1]) == EQ || GET_CODE (operands[1]) == NE)"
3136 [(set (match_dup 4) (match_dup 5))
3137 (set (pc) (if_then_else (match_dup 6) (label_ref (match_dup 0)) (pc)))]
3141 if (GET_CODE (operands[3]) == CONST_INT)
3142 tem = gen_rtx (PLUS, SImode, operands[2],
3143 GEN_INT (- INTVAL (operands[3])));
3145 tem = gen_rtx (MINUS, SImode, operands[2], operands[3]);
3147 operands[5] = gen_rtx (SIGN_EXTEND, DImode, tem);
3148 operands[6] = gen_rtx (GET_CODE (operands[1]), VOIDmode,
3149 operands[4], const0_rtx);
3152 ;; We can convert such things as "a > 0xffff" to "t = a & ~ 0xffff; t != 0".
3153 ;; This eliminates one, and sometimes two, insns when the AND can be done
3156 [(set (match_operand:DI 0 "register_operand" "")
3157 (match_operator 1 "comparison_operator"
3158 [(match_operand:DI 2 "register_operand" "")
3159 (match_operand:DI 3 "const_int_operand" "")]))
3160 (clobber (match_operand:DI 4 "register_operand" ""))]
3161 "exact_log2 (INTVAL (operands[3]) + 1) >= 0
3162 && (GET_CODE (operands[1]) == GTU
3163 || GET_CODE (operands[1]) == LEU
3164 || ((GET_CODE (operands[1]) == GT || GET_CODE (operands[1]) == LE)
3165 && extended_count (operands[2], DImode, 1) > 0))"
3166 [(set (match_dup 4) (and:DI (match_dup 2) (match_dup 5)))
3167 (set (match_dup 0) (match_dup 6))]
3170 operands[5] = GEN_INT (~ INTVAL (operands[3]));
3171 operands[6] = gen_rtx (((GET_CODE (operands[1]) == GTU
3172 || GET_CODE (operands[1]) == GT)
3174 DImode, operands[4], const0_rtx);
3177 ;; Here are the CALL and unconditional branch insns. Calls on NT and OSF
3178 ;; work differently, so we have different patterns for each.
3180 (define_expand "call"
3181 [(use (match_operand:DI 0 "" ""))
3182 (use (match_operand 1 "" ""))
3183 (use (match_operand 2 "" ""))
3184 (use (match_operand 3 "" ""))]
3187 { if (TARGET_WINDOWS_NT)
3188 emit_call_insn (gen_call_nt (operands[0], operands[1]));
3189 else if (TARGET_OPEN_VMS)
3190 emit_call_insn (gen_call_vms (operands[0], operands[2]));
3192 emit_call_insn (gen_call_osf (operands[0], operands[1]));
3197 (define_expand "call_osf"
3198 [(parallel [(call (mem:DI (match_operand 0 "" ""))
3199 (match_operand 1 "" ""))
3200 (clobber (reg:DI 27))
3201 (clobber (reg:DI 26))])]
3204 { if (GET_CODE (operands[0]) != MEM)
3207 operands[0] = XEXP (operands[0], 0);
3209 if (GET_CODE (operands[0]) != SYMBOL_REF
3210 && ! (GET_CODE (operands[0]) == REG && REGNO (operands[0]) == 27))
3212 rtx tem = gen_rtx (REG, DImode, 27);
3213 emit_move_insn (tem, operands[0]);
3218 (define_expand "call_nt"
3219 [(parallel [(call (mem:DI (match_operand:DI 0 "" ""))
3220 (match_operand 1 "" ""))
3221 (clobber (reg:DI 26))])]
3224 { if (GET_CODE (operands[0]) != MEM)
3226 operands[0] = XEXP (operands[0], 0);
3228 if (GET_CODE (operands[1]) != SYMBOL_REF
3229 && ! (GET_CODE (operands[1]) == REG && REGNO (operands[1]) == 27))
3231 rtx tem = gen_rtx (REG, DImode, 27);
3232 emit_move_insn (tem, operands[1]);
3238 ;; call openvms/alpha
3239 ;; op 0: symbol ref for called function
3240 ;; op 1: next_arg_reg (argument information value for R25)
3242 (define_expand "call_vms"
3243 [(parallel [(call (mem:DI (match_operand 0 "" ""))
3244 (match_operand 1 "" ""))
3248 (clobber (reg:DI 27))])]
3251 { if (GET_CODE (operands[0]) != MEM)
3254 operands[0] = XEXP (operands[0], 0);
3256 /* Always load AI with argument information, then handle symbolic and
3257 indirect call differently. Load RA and set operands[2] to PV in
3260 emit_move_insn (gen_rtx (REG, DImode, 25), operands[1]);
3261 if (GET_CODE (operands[0]) == SYMBOL_REF)
3263 extern char *savealloc ();
3264 char *symbol = XSTR (operands[0], 0);
3265 char *linksym = savealloc (strlen (symbol) + 5);
3268 alpha_need_linkage (symbol, 0);
3270 strcpy (linksym, symbol);
3271 strcat (linksym, \"..lk\");
3272 linkage = gen_rtx (SYMBOL_REF, Pmode, linksym);
3274 emit_move_insn (gen_rtx (REG, Pmode, 26), gen_rtx (MEM, Pmode, linkage));
3277 = validize_mem (gen_rtx (MEM, Pmode, plus_constant (linkage, 8)));
3281 emit_move_insn (gen_rtx (REG, Pmode, 26),
3282 gen_rtx (MEM, Pmode, plus_constant (operands[0], 8)));
3284 operands[2] = operands[0];
3289 (define_expand "call_value"
3290 [(use (match_operand 0 "" ""))
3291 (use (match_operand:DI 1 "" ""))
3292 (use (match_operand 2 "" ""))
3293 (use (match_operand 3 "" ""))
3294 (use (match_operand 4 "" ""))]
3297 { if (TARGET_WINDOWS_NT)
3298 emit_call_insn (gen_call_value_nt (operands[0], operands[1], operands[2]));
3299 else if (TARGET_OPEN_VMS)
3300 emit_call_insn (gen_call_value_vms (operands[0], operands[1],
3303 emit_call_insn (gen_call_value_osf (operands[0], operands[1],
3308 (define_expand "call_value_osf"
3309 [(parallel [(set (match_operand 0 "" "")
3310 (call (mem:DI (match_operand 1 "" ""))
3311 (match_operand 2 "" "")))
3312 (clobber (reg:DI 27))
3313 (clobber (reg:DI 26))])]
3316 { if (GET_CODE (operands[1]) != MEM)
3319 operands[1] = XEXP (operands[1], 0);
3321 if (GET_CODE (operands[1]) != SYMBOL_REF
3322 && ! (GET_CODE (operands[1]) == REG && REGNO (operands[1]) == 27))
3324 rtx tem = gen_rtx (REG, DImode, 27);
3325 emit_move_insn (tem, operands[1]);
3330 (define_expand "call_value_nt"
3331 [(parallel [(set (match_operand 0 "" "")
3332 (call (mem:DI (match_operand:DI 1 "" ""))
3333 (match_operand 2 "" "")))
3334 (clobber (reg:DI 26))])]
3337 { if (GET_CODE (operands[1]) != MEM)
3340 operands[1] = XEXP (operands[1], 0);
3341 if (GET_CODE (operands[1]) != SYMBOL_REF
3342 && ! (GET_CODE (operands[1]) == REG && REGNO (operands[1]) == 27))
3344 rtx tem = gen_rtx (REG, DImode, 27);
3345 emit_move_insn (tem, operands[1]);
3350 (define_expand "call_value_vms"
3351 [(parallel [(set (match_operand 0 "" "")
3352 (call (mem:DI (match_operand:DI 1 "" ""))
3353 (match_operand 2 "" "")))
3357 (clobber (reg:DI 27))])]
3360 { if (GET_CODE (operands[1]) != MEM)
3363 operands[1] = XEXP (operands[1], 0);