1 ;; Machine description for DEC Alpha for GNU C compiler
2 ;; Copyright (C) 1992, 93, 94, 95, 96, 97, 1998 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 ;; Uses of UNSPEC in this file:
37 ;; 2 builtin_setjmp_receiver
40 ;; 5 prologue_stack_probe_loop
42 ;; Processor type -- this attribute must exactly match the processor_type
43 ;; enumeration in alpha.h.
45 (define_attr "cpu" "ev4,ev5,ev6"
46 (const (symbol_ref "alpha_cpu")))
48 ;; Define an insn type attribute. This is used in function unit delay
49 ;; computations, among other purposes. For the most part, we use the names
50 ;; defined in the EV4 documentation, but add a few that we have to know about
54 "ild,fld,ldsym,ist,fst,ibr,fbr,jsr,iadd,ilog,shift,icmov,fcmov,icmp,imul,fadd,fmul,fcpys,fdiv,fsqrt,misc,mvi,ftoi,itof"
55 (const_string "iadd"))
57 ;; Define the operand size an insn operates on. Used primarily by mul
58 ;; and div operations that have size dependant timings.
60 (define_attr "opsize" "si,di,udi" (const_string "di"))
62 ;; The TRAP_TYPE attribute marks instructions that may generate traps
63 ;; (which are imprecise and may need a trapb if software completion
66 (define_attr "trap" "no,yes" (const_string "no"))
68 ;; The length of an instruction sequence in bytes.
70 (define_attr "length" "" (const_int 4))
72 ;; On EV4 there are two classes of resources to consider: resources needed
73 ;; to issue, and resources needed to execute. IBUS[01] are in the first
74 ;; category. ABOX, BBOX, EBOX, FBOX, IMUL & FDIV make up the second.
75 ;; (There are a few other register-like resources, but ...)
77 ; First, describe all of the issue constraints with single cycle delays.
78 ; All insns need a bus, but all except loads require one or the other.
79 (define_function_unit "ev4_ibus0" 1 0
80 (and (eq_attr "cpu" "ev4")
81 (eq_attr "type" "fst,fbr,iadd,imul,ilog,shift,icmov,icmp"))
84 (define_function_unit "ev4_ibus1" 1 0
85 (and (eq_attr "cpu" "ev4")
86 (eq_attr "type" "ist,ibr,jsr,fadd,fcmov,fcpys,fmul,fdiv,misc"))
89 ; Memory delivers its result in three cycles. Actually return one and
90 ; take care of this in adjust_cost, since we want to handle user-defined
92 (define_function_unit "ev4_abox" 1 0
93 (and (eq_attr "cpu" "ev4")
94 (eq_attr "type" "ild,fld,ldsym,ist,fst"))
97 ; Branches have no delay cost, but do tie up the unit for two cycles.
98 (define_function_unit "ev4_bbox" 1 1
99 (and (eq_attr "cpu" "ev4")
100 (eq_attr "type" "ibr,fbr,jsr"))
103 ; Arithmetic insns are normally have their results available after
104 ; two cycles. There are a number of exceptions. They are encoded in
105 ; ADJUST_COST. Some of the other insns have similar exceptions.
106 (define_function_unit "ev4_ebox" 1 0
107 (and (eq_attr "cpu" "ev4")
108 (eq_attr "type" "iadd,ilog,shift,icmov,icmp,misc"))
111 (define_function_unit "imul" 1 0
112 (and (eq_attr "cpu" "ev4")
113 (and (eq_attr "type" "imul")
114 (eq_attr "opsize" "si")))
117 (define_function_unit "imul" 1 0
118 (and (eq_attr "cpu" "ev4")
119 (and (eq_attr "type" "imul")
120 (eq_attr "opsize" "!si")))
123 (define_function_unit "ev4_fbox" 1 0
124 (and (eq_attr "cpu" "ev4")
125 (eq_attr "type" "fadd,fmul,fcpys,fcmov"))
128 (define_function_unit "fdiv" 1 0
129 (and (eq_attr "cpu" "ev4")
130 (and (eq_attr "type" "fdiv")
131 (eq_attr "opsize" "si")))
134 (define_function_unit "fdiv" 1 0
135 (and (eq_attr "cpu" "ev4")
136 (and (eq_attr "type" "fdiv")
137 (eq_attr "opsize" "di")))
140 ;; EV5 scheduling. EV5 can issue 4 insns per clock.
142 ;; EV5 has two asymetric integer units. Model this with E0 & E1 along
143 ;; with the combined resource EBOX.
145 (define_function_unit "ev5_ebox" 2 0
146 (and (eq_attr "cpu" "ev5")
147 (eq_attr "type" "!fbr,fcmov,fadd,fmul,fcpys,fdiv"))
150 ; Memory takes at least 2 clocks. Return one from here and fix up with
151 ; user-defined latencies in adjust_cost.
152 ; ??? How to: "An instruction of class LD cannot be issued in the _second_
153 ; cycle after an instruction of class ST is issued."
154 (define_function_unit "ev5_ebox" 2 0
155 (and (eq_attr "cpu" "ev5")
156 (eq_attr "type" "ild,fld,ldsym"))
159 ; Stores, shifts, multiplies can only issue to E0
160 (define_function_unit "ev5_e0" 1 0
161 (and (eq_attr "cpu" "ev5")
162 (eq_attr "type" "ist,fst,shift,imul"))
165 ; Motion video insns also issue only to E0, and take two ticks.
166 (define_function_unit "ev5_e0" 1 0
167 (and (eq_attr "cpu" "ev5")
168 (eq_attr "type" "mvi"))
171 ; Conditional moves always take 2 ticks.
172 (define_function_unit "ev5_ebox" 2 0
173 (and (eq_attr "cpu" "ev5")
174 (eq_attr "type" "icmov"))
177 ; Branches can only issue to E1
178 (define_function_unit "ev5_e1" 1 0
179 (and (eq_attr "cpu" "ev5")
180 (eq_attr "type" "ibr,jsr"))
183 ; Multiplies also use the integer multiplier.
184 ; ??? How to: "No instruction can be issued to pipe E0 exactly two
185 ; cycles before an integer multiplication completes."
186 (define_function_unit "imul" 1 0
187 (and (eq_attr "cpu" "ev5")
188 (and (eq_attr "type" "imul")
189 (eq_attr "opsize" "si")))
192 (define_function_unit "imul" 1 0
193 (and (eq_attr "cpu" "ev5")
194 (and (eq_attr "type" "imul")
195 (eq_attr "opsize" "di")))
198 (define_function_unit "imul" 1 0
199 (and (eq_attr "cpu" "ev5")
200 (and (eq_attr "type" "imul")
201 (eq_attr "opsize" "udi")))
204 ;; Similarly for the FPU we have two asymetric units. But fcpys can issue
205 ;; on either so we have to play the game again.
207 (define_function_unit "ev5_fbox" 2 0
208 (and (eq_attr "cpu" "ev5")
209 (eq_attr "type" "fadd,fcmov,fmul,fcpys,fbr,fdiv"))
212 (define_function_unit "ev5_fm" 1 0
213 (and (eq_attr "cpu" "ev5")
214 (eq_attr "type" "fmul"))
217 ; Add and cmov as you would expect; fbr never produces a result;
218 ; fdiv issues through fa to the divider,
219 (define_function_unit "ev5_fa" 1 0
220 (and (eq_attr "cpu" "ev5")
221 (eq_attr "type" "fadd,fcmov,fbr,fdiv"))
224 ; ??? How to: "No instruction can be issued to pipe FA exactly five
225 ; cycles before a floating point divide completes."
226 (define_function_unit "fdiv" 1 0
227 (and (eq_attr "cpu" "ev5")
228 (and (eq_attr "type" "fdiv")
229 (eq_attr "opsize" "si")))
230 15 15) ; 15 to 31 data dependant
232 (define_function_unit "fdiv" 1 0
233 (and (eq_attr "cpu" "ev5")
234 (and (eq_attr "type" "fdiv")
235 (eq_attr "opsize" "di")))
236 22 22) ; 22 to 60 data dependant
238 ;; EV6 scheduling. EV6 can issue 4 insns per clock.
240 ;; EV6 has two symmetric pairs ("clusters") of two asymetric integer units
241 ;; ("upper" and "lower"), yielding pipe names U0, U1, L0, L1.
243 ;; Conditional moves decompose into two independant primitives, each
244 ;; taking one cycle. Since ev6 is out-of-order, we can't see anything
246 (define_function_unit "ev6_ebox" 4 0
247 (and (eq_attr "cpu" "ev6")
248 (eq_attr "type" "icmov"))
251 (define_function_unit "ev6_ebox" 4 0
252 (and (eq_attr "cpu" "ev6")
253 (eq_attr "type" "!fbr,fcmov,fadd,fmul,fcpys,fdiv,fsqrt"))
256 ;; Integer loads take at least 3 clocks, and only issue to lower units.
257 ;; Return one from here and fix up with user-defined latencies in adjust_cost.
258 (define_function_unit "ev6_l" 2 0
259 (and (eq_attr "cpu" "ev6")
260 (eq_attr "type" "ild,ldsym,ist,fst"))
263 ;; FP loads take at least 4 clocks. Return two from here...
264 (define_function_unit "ev6_l" 2 0
265 (and (eq_attr "cpu" "ev6")
266 (eq_attr "type" "fld"))
269 ;; Motion video insns also issue only to U0, and take three ticks.
270 (define_function_unit "ev6_u0" 1 0
271 (and (eq_attr "cpu" "ev6")
272 (eq_attr "type" "mvi"))
275 (define_function_unit "ev6_u" 2 0
276 (and (eq_attr "cpu" "ev6")
277 (eq_attr "type" "mvi"))
280 ;; Shifts issue to either upper pipe.
281 (define_function_unit "ev6_u" 2 0
282 (and (eq_attr "cpu" "ev6")
283 (eq_attr "type" "shift"))
286 ;; Multiplies issue only to U1, and all take 7 ticks.
287 ;; Rather than create a new function unit just for U1, reuse IMUL
288 (define_function_unit "imul" 1 0
289 (and (eq_attr "cpu" "ev6")
290 (eq_attr "type" "imul"))
293 (define_function_unit "ev6_u" 2 0
294 (and (eq_attr "cpu" "ev6")
295 (eq_attr "type" "imul"))
298 ;; Branches issue to either upper pipe
299 (define_function_unit "ev6_u" 2 0
300 (and (eq_attr "cpu" "ev6")
301 (eq_attr "type" "ibr"))
304 ;; Calls only issue to L0.
305 (define_function_unit "ev6_l0" 1 0
306 (and (eq_attr "cpu" "ev6")
307 (eq_attr "type" "jsr"))
310 (define_function_unit "ev6_l" 2 0
311 (and (eq_attr "cpu" "ev6")
312 (eq_attr "type" "jsr"))
315 ;; Ftoi/itof only issue to lower pipes
316 (define_function_unit "ev6_l" 2 0
317 (and (eq_attr "cpu" "ev6")
318 (eq_attr "type" "ftoi"))
321 (define_function_unit "ev6_l" 2 0
322 (and (eq_attr "cpu" "ev6")
323 (eq_attr "type" "itof"))
326 ;; For the FPU we are very similar to EV5, except there's no insn that
327 ;; can issue to fm & fa, so we get to leave that out.
329 (define_function_unit "ev6_fm" 1 0
330 (and (eq_attr "cpu" "ev6")
331 (eq_attr "type" "fmul"))
334 (define_function_unit "ev6_fa" 1 0
335 (and (eq_attr "cpu" "ev6")
336 (eq_attr "type" "fadd,fcpys,fbr,fdiv,fsqrt"))
339 (define_function_unit "ev6_fa" 1 0
340 (and (eq_attr "cpu" "ev6")
341 (eq_attr "type" "fcmov"))
344 (define_function_unit "fdiv" 1 0
345 (and (eq_attr "cpu" "ev6")
346 (and (eq_attr "type" "fdiv")
347 (eq_attr "opsize" "si")))
350 (define_function_unit "fdiv" 1 0
351 (and (eq_attr "cpu" "ev6")
352 (and (eq_attr "type" "fdiv")
353 (eq_attr "opsize" "di")))
356 (define_function_unit "fsqrt" 1 0
357 (and (eq_attr "cpu" "ev6")
358 (and (eq_attr "type" "fsqrt")
359 (eq_attr "opsize" "si")))
362 (define_function_unit "fsqrt" 1 0
363 (and (eq_attr "cpu" "ev6")
364 (and (eq_attr "type" "fsqrt")
365 (eq_attr "opsize" "di")))
368 ; ??? The FPU communicates with memory and the integer register file
369 ; via two fp store units. We need a slot in the fst immediately, and
370 ; a slot in LOW after the operand data is ready. At which point the
371 ; data may be moved either to the store queue or the integer register
372 ; file and the insn retired.
375 ;; First define the arithmetic insns. Note that the 32-bit forms also
378 ;; Handle 32-64 bit extension from memory to a floating point register
379 ;; specially, since this ocurrs frequently in int->double conversions.
380 ;; This is done with a define_split after reload converting the plain
381 ;; sign-extension into a load+unspec, which of course results in lds+cvtlq.
383 ;; Note that while we must retain the =f case in the insn for reload's
384 ;; benefit, it should be eliminated after reload, so we should never emit
385 ;; code for that case. But we don't reject the possibility.
387 (define_insn "extendsidi2"
388 [(set (match_operand:DI 0 "register_operand" "=r,r,?f")
389 (sign_extend:DI (match_operand:SI 1 "nonimmediate_operand" "r,m,m")))]
394 lds %0,%1\;cvtlq %0,%0"
395 [(set_attr "type" "iadd,ild,fld")
396 (set_attr "length" "*,*,8")])
398 ;; Due to issues with CLASS_CANNOT_CHANGE_SIZE, we cannot use a subreg here.
400 [(set (match_operand:DI 0 "hard_fp_register_operand" "")
401 (sign_extend:DI (match_operand:SI 1 "memory_operand" "")))]
403 [(set (match_dup 2) (match_dup 1))
404 (set (match_dup 0) (unspec:DI [(match_dup 2)] 4))]
405 "operands[2] = gen_rtx_REG (SImode, REGNO (operands[0]));")
408 [(set (match_operand:DI 0 "register_operand" "=f")
409 (unspec:DI [(match_operand:SI 1 "register_operand" "f")] 4))]
412 [(set_attr "type" "fadd")])
414 ;; Do addsi3 the way expand_binop would do if we didn't have one. This
415 ;; generates better code. We have the anonymous addsi3 pattern below in
416 ;; case combine wants to make it.
417 (define_expand "addsi3"
418 [(set (match_operand:SI 0 "register_operand" "")
419 (plus:SI (match_operand:SI 1 "reg_or_0_operand" "")
420 (match_operand:SI 2 "add_operand" "")))]
423 { emit_insn (gen_rtx_SET (VOIDmode, gen_lowpart (DImode, operands[0]),
424 gen_rtx_PLUS (DImode,
425 gen_lowpart (DImode, operands[1]),
426 gen_lowpart (DImode, operands[2]))));
431 [(set (match_operand:SI 0 "register_operand" "=r,r,r,r")
432 (plus:SI (match_operand:SI 1 "reg_or_0_operand" "%rJ,rJ,rJ,rJ")
433 (match_operand:SI 2 "add_operand" "rI,O,K,L")))]
442 [(set (match_operand:SI 0 "register_operand" "")
443 (plus:SI (match_operand:SI 1 "register_operand" "")
444 (match_operand:SI 2 "const_int_operand" "")))]
445 "! add_operand (operands[2], SImode)"
446 [(set (match_dup 0) (plus:SI (match_dup 1) (match_dup 3)))
447 (set (match_dup 0) (plus:SI (match_dup 0) (match_dup 4)))]
450 HOST_WIDE_INT val = INTVAL (operands[2]);
451 HOST_WIDE_INT low = (val & 0xffff) - 2 * (val & 0x8000);
452 HOST_WIDE_INT rest = val - low;
454 operands[3] = GEN_INT (rest);
455 operands[4] = GEN_INT (low);
459 [(set (match_operand:DI 0 "register_operand" "=r,r")
461 (plus:SI (match_operand:SI 1 "reg_or_0_operand" "%rJ,rJ")
462 (match_operand:SI 2 "sext_add_operand" "rI,O"))))]
469 [(set (match_operand:DI 0 "register_operand" "")
471 (plus:SI (match_operand:SI 1 "register_operand" "")
472 (match_operand:SI 2 "const_int_operand" ""))))
473 (clobber (match_operand:SI 3 "register_operand" ""))]
474 "! sext_add_operand (operands[2], SImode) && INTVAL (operands[2]) > 0
475 && INTVAL (operands[2]) % 4 == 0"
476 [(set (match_dup 3) (match_dup 4))
477 (set (match_dup 0) (sign_extend:DI (plus:SI (mult:SI (match_dup 3)
482 HOST_WIDE_INT val = INTVAL (operands[2]) / 4;
488 operands[4] = GEN_INT (val);
489 operands[5] = GEN_INT (mult);
493 [(set (match_operand:DI 0 "register_operand" "")
495 (plus:SI (match_operator:SI 1 "comparison_operator"
496 [(match_operand 2 "" "")
497 (match_operand 3 "" "")])
498 (match_operand:SI 4 "add_operand" ""))))
499 (clobber (match_operand:DI 5 "register_operand" ""))]
501 [(set (match_dup 5) (match_dup 6))
502 (set (match_dup 0) (sign_extend:DI (plus:SI (match_dup 7) (match_dup 4))))]
505 operands[6] = gen_rtx_fmt_ee (GET_CODE (operands[1]), DImode,
506 operands[2], operands[3]);
507 operands[7] = gen_lowpart (SImode, operands[5]);
510 (define_insn "adddi3"
511 [(set (match_operand:DI 0 "register_operand" "=r,r,r,r")
512 (plus:DI (match_operand:DI 1 "reg_or_0_operand" "%rJ,rJ,rJ,rJ")
513 (match_operand:DI 2 "add_operand" "rI,O,K,L")))]
521 ;; Don't do this if we are adjusting SP since we don't want to do
524 [(set (match_operand:DI 0 "register_operand" "")
525 (plus:DI (match_operand:DI 1 "register_operand" "")
526 (match_operand:DI 2 "const_int_operand" "")))]
527 "! add_operand (operands[2], DImode)
528 && REGNO (operands[0]) != STACK_POINTER_REGNUM"
529 [(set (match_dup 0) (plus:DI (match_dup 1) (match_dup 3)))
530 (set (match_dup 0) (plus:DI (match_dup 0) (match_dup 4)))]
533 HOST_WIDE_INT val = INTVAL (operands[2]);
534 HOST_WIDE_INT low = (val & 0xffff) - 2 * (val & 0x8000);
535 HOST_WIDE_INT rest = val - low;
537 operands[3] = GEN_INT (rest);
538 operands[4] = GEN_INT (low);
542 [(set (match_operand:SI 0 "register_operand" "=r,r")
543 (plus:SI (mult:SI (match_operand:SI 1 "reg_or_0_operand" "rJ,rJ")
544 (match_operand:SI 2 "const48_operand" "I,I"))
545 (match_operand:SI 3 "sext_add_operand" "rI,O")))]
552 [(set (match_operand:DI 0 "register_operand" "=r,r")
554 (plus:SI (mult:SI (match_operand:SI 1 "reg_or_0_operand" "rJ,rJ")
555 (match_operand:SI 2 "const48_operand" "I,I"))
556 (match_operand:SI 3 "sext_add_operand" "rI,O"))))]
563 [(set (match_operand:DI 0 "register_operand" "")
565 (plus:SI (mult:SI (match_operator:SI 1 "comparison_operator"
566 [(match_operand 2 "" "")
567 (match_operand 3 "" "")])
568 (match_operand:SI 4 "const48_operand" ""))
569 (match_operand:SI 5 "add_operand" ""))))
570 (clobber (match_operand:DI 6 "register_operand" ""))]
572 [(set (match_dup 6) (match_dup 7))
574 (sign_extend:DI (plus:SI (mult:SI (match_dup 8) (match_dup 4))
578 operands[7] = gen_rtx_fmt_ee (GET_CODE (operands[1]), DImode,
579 operands[2], operands[3]);
580 operands[8] = gen_lowpart (SImode, operands[6]);
584 [(set (match_operand:DI 0 "register_operand" "=r,r")
585 (plus:DI (mult:DI (match_operand:DI 1 "reg_or_0_operand" "rJ,rJ")
586 (match_operand:DI 2 "const48_operand" "I,I"))
587 (match_operand:DI 3 "reg_or_8bit_operand" "rI,O")))]
593 ;; These variants of the above insns can occur if the third operand
594 ;; is the frame pointer. This is a kludge, but there doesn't
595 ;; seem to be a way around it. Only recognize them while reloading.
598 [(set (match_operand:DI 0 "some_operand" "=&r")
599 (plus:DI (plus:DI (match_operand:DI 1 "some_operand" "r")
600 (match_operand:DI 2 "some_operand" "r"))
601 (match_operand:DI 3 "some_operand" "rIOKL")))]
606 [(set (match_operand:DI 0 "register_operand" "")
607 (plus:DI (plus:DI (match_operand:DI 1 "register_operand" "")
608 (match_operand:DI 2 "register_operand" ""))
609 (match_operand:DI 3 "add_operand" "")))]
611 [(set (match_dup 0) (plus:DI (match_dup 1) (match_dup 2)))
612 (set (match_dup 0) (plus:DI (match_dup 0) (match_dup 3)))]
616 [(set (match_operand:SI 0 "some_operand" "=&r")
617 (plus:SI (plus:SI (mult:SI (match_operand:SI 1 "some_operand" "rJ")
618 (match_operand:SI 2 "const48_operand" "I"))
619 (match_operand:SI 3 "some_operand" "r"))
620 (match_operand:SI 4 "some_operand" "rIOKL")))]
625 [(set (match_operand:SI 0 "register_operand" "r")
626 (plus:SI (plus:SI (mult:SI (match_operand:SI 1 "reg_or_0_operand" "")
627 (match_operand:SI 2 "const48_operand" ""))
628 (match_operand:SI 3 "register_operand" ""))
629 (match_operand:SI 4 "add_operand" "rIOKL")))]
632 (plus:SI (mult:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
633 (set (match_dup 0) (plus:SI (match_dup 0) (match_dup 4)))]
637 [(set (match_operand:DI 0 "some_operand" "=&r")
640 (mult:SI (match_operand:SI 1 "some_operand" "rJ")
641 (match_operand:SI 2 "const48_operand" "I"))
642 (match_operand:SI 3 "some_operand" "r"))
643 (match_operand:SI 4 "some_operand" "rIOKL"))))]
648 [(set (match_operand:DI 0 "register_operand" "")
651 (mult:SI (match_operand:SI 1 "reg_or_0_operand" "")
652 (match_operand:SI 2 "const48_operand" ""))
653 (match_operand:SI 3 "register_operand" ""))
654 (match_operand:SI 4 "add_operand" ""))))]
657 (plus:SI (mult:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
658 (set (match_dup 0) (sign_extend:DI (plus:SI (match_dup 5) (match_dup 4))))]
660 { operands[5] = gen_lowpart (SImode, operands[0]);
664 [(set (match_operand:DI 0 "some_operand" "=&r")
665 (plus:DI (plus:DI (mult:DI (match_operand:DI 1 "some_operand" "rJ")
666 (match_operand:DI 2 "const48_operand" "I"))
667 (match_operand:DI 3 "some_operand" "r"))
668 (match_operand:DI 4 "some_operand" "rIOKL")))]
673 [(set (match_operand:DI 0 "register_operand" "=")
674 (plus:DI (plus:DI (mult:DI (match_operand:DI 1 "reg_or_0_operand" "")
675 (match_operand:DI 2 "const48_operand" ""))
676 (match_operand:DI 3 "register_operand" ""))
677 (match_operand:DI 4 "add_operand" "")))]
680 (plus:DI (mult:DI (match_dup 1) (match_dup 2)) (match_dup 3)))
681 (set (match_dup 0) (plus:DI (match_dup 0) (match_dup 4)))]
684 (define_insn "negsi2"
685 [(set (match_operand:SI 0 "register_operand" "=r")
686 (neg:SI (match_operand:SI 1 "reg_or_8bit_operand" "rI")))]
691 [(set (match_operand:DI 0 "register_operand" "=r")
692 (sign_extend:DI (neg:SI
693 (match_operand:SI 1 "reg_or_8bit_operand" "rI"))))]
697 (define_insn "negdi2"
698 [(set (match_operand:DI 0 "register_operand" "=r")
699 (neg:DI (match_operand:DI 1 "reg_or_8bit_operand" "rI")))]
703 (define_expand "subsi3"
704 [(set (match_operand:SI 0 "register_operand" "")
705 (minus:SI (match_operand:SI 1 "reg_or_0_operand" "")
706 (match_operand:SI 2 "reg_or_8bit_operand" "")))]
709 { emit_insn (gen_rtx_SET (VOIDmode, gen_lowpart (DImode, operands[0]),
710 gen_rtx_MINUS (DImode,
711 gen_lowpart (DImode, operands[1]),
712 gen_lowpart (DImode, operands[2]))));
717 [(set (match_operand:SI 0 "register_operand" "=r")
718 (minus:SI (match_operand:SI 1 "reg_or_0_operand" "rJ")
719 (match_operand:SI 2 "reg_or_8bit_operand" "rI")))]
724 [(set (match_operand:DI 0 "register_operand" "=r")
725 (sign_extend:DI (minus:SI (match_operand:SI 1 "reg_or_0_operand" "rJ")
726 (match_operand:SI 2 "reg_or_8bit_operand" "rI"))))]
730 (define_insn "subdi3"
731 [(set (match_operand:DI 0 "register_operand" "=r")
732 (minus:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
733 (match_operand:DI 2 "reg_or_8bit_operand" "rI")))]
738 [(set (match_operand:SI 0 "register_operand" "=r")
739 (minus:SI (mult:SI (match_operand:SI 1 "reg_or_0_operand" "rJ")
740 (match_operand:SI 2 "const48_operand" "I"))
741 (match_operand:SI 3 "reg_or_8bit_operand" "rI")))]
746 [(set (match_operand:DI 0 "register_operand" "=r")
748 (minus:SI (mult:SI (match_operand:SI 1 "reg_or_0_operand" "rJ")
749 (match_operand:SI 2 "const48_operand" "I"))
750 (match_operand:SI 3 "reg_or_8bit_operand" "rI"))))]
755 [(set (match_operand:DI 0 "register_operand" "=r")
756 (minus:DI (mult:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
757 (match_operand:DI 2 "const48_operand" "I"))
758 (match_operand:DI 3 "reg_or_8bit_operand" "rI")))]
762 (define_insn "mulsi3"
763 [(set (match_operand:SI 0 "register_operand" "=r")
764 (mult:SI (match_operand:SI 1 "reg_or_0_operand" "%rJ")
765 (match_operand:SI 2 "reg_or_0_operand" "rJ")))]
768 [(set_attr "type" "imul")
769 (set_attr "opsize" "si")])
772 [(set (match_operand:DI 0 "register_operand" "=r")
773 (sign_extend:DI (mult:SI (match_operand:SI 1 "reg_or_0_operand" "%rJ")
774 (match_operand:SI 2 "reg_or_0_operand" "rJ"))))]
777 [(set_attr "type" "imul")
778 (set_attr "opsize" "si")])
780 (define_insn "muldi3"
781 [(set (match_operand:DI 0 "register_operand" "=r")
782 (mult:DI (match_operand:DI 1 "reg_or_0_operand" "%rJ")
783 (match_operand:DI 2 "reg_or_0_operand" "rJ")))]
786 [(set_attr "type" "imul")])
788 (define_insn "umuldi3_highpart"
789 [(set (match_operand:DI 0 "register_operand" "=r")
792 (mult:TI (zero_extend:TI (match_operand:DI 1 "register_operand" "r"))
793 (zero_extend:TI (match_operand:DI 2 "register_operand" "r")))
797 [(set_attr "type" "imul")
798 (set_attr "opsize" "udi")])
801 [(set (match_operand:DI 0 "register_operand" "=r")
804 (mult:TI (zero_extend:TI (match_operand:DI 1 "register_operand" "r"))
805 (match_operand:TI 2 "cint8_operand" "I"))
809 [(set_attr "type" "imul")
810 (set_attr "opsize" "udi")])
812 ;; The divide and remainder operations always take their inputs from
813 ;; r24 and r25, put their output in r27, and clobber r23 and r28.
815 ;; ??? Force sign-extension here because some versions of OSF/1 don't
816 ;; do the right thing if the inputs are not properly sign-extended.
817 ;; But Linux, for instance, does not have this problem. Is it worth
818 ;; the complication here to eliminate the sign extension?
820 (define_expand "divsi3"
822 (sign_extend:DI (match_operand:SI 1 "nonimmediate_operand" "")))
824 (sign_extend:DI (match_operand:SI 2 "nonimmediate_operand" "")))
825 (parallel [(set (reg:DI 27)
826 (sign_extend:DI (div:SI (reg:DI 24) (reg:DI 25))))
827 (clobber (reg:DI 23))
828 (clobber (reg:DI 28))])
829 (set (match_operand:SI 0 "general_operand" "")
830 (subreg:SI (reg:DI 27) 0))]
834 (define_expand "udivsi3"
836 (sign_extend:DI (match_operand:SI 1 "nonimmediate_operand" "")))
838 (sign_extend:DI (match_operand:SI 2 "nonimmediate_operand" "")))
839 (parallel [(set (reg:DI 27)
840 (sign_extend:DI (udiv:SI (reg:DI 24) (reg:DI 25))))
841 (clobber (reg:DI 23))
842 (clobber (reg:DI 28))])
843 (set (match_operand:SI 0 "general_operand" "")
844 (subreg:SI (reg:DI 27) 0))]
848 (define_expand "modsi3"
850 (sign_extend:DI (match_operand:SI 1 "nonimmediate_operand" "")))
852 (sign_extend:DI (match_operand:SI 2 "nonimmediate_operand" "")))
853 (parallel [(set (reg:DI 27)
854 (sign_extend:DI (mod:SI (reg:DI 24) (reg:DI 25))))
855 (clobber (reg:DI 23))
856 (clobber (reg:DI 28))])
857 (set (match_operand:SI 0 "general_operand" "")
858 (subreg:SI (reg:DI 27) 0))]
862 (define_expand "umodsi3"
864 (sign_extend:DI (match_operand:SI 1 "nonimmediate_operand" "")))
866 (sign_extend:DI (match_operand:SI 2 "nonimmediate_operand" "")))
867 (parallel [(set (reg:DI 27)
868 (sign_extend:DI (umod:SI (reg:DI 24) (reg:DI 25))))
869 (clobber (reg:DI 23))
870 (clobber (reg:DI 28))])
871 (set (match_operand:SI 0 "general_operand" "")
872 (subreg:SI (reg:DI 27) 0))]
876 (define_expand "divdi3"
877 [(set (reg:DI 24) (match_operand:DI 1 "input_operand" ""))
878 (set (reg:DI 25) (match_operand:DI 2 "input_operand" ""))
879 (parallel [(set (reg:DI 27)
882 (clobber (reg:DI 23))
883 (clobber (reg:DI 28))])
884 (set (match_operand:DI 0 "general_operand" "")
889 (define_expand "udivdi3"
890 [(set (reg:DI 24) (match_operand:DI 1 "input_operand" ""))
891 (set (reg:DI 25) (match_operand:DI 2 "input_operand" ""))
892 (parallel [(set (reg:DI 27)
895 (clobber (reg:DI 23))
896 (clobber (reg:DI 28))])
897 (set (match_operand:DI 0 "general_operand" "")
902 (define_expand "moddi3"
903 [(set (reg:DI 24) (match_operand:DI 1 "input_operand" ""))
904 (set (reg:DI 25) (match_operand:DI 2 "input_operand" ""))
905 (parallel [(set (reg:DI 27)
908 (clobber (reg:DI 23))
909 (clobber (reg:DI 28))])
910 (set (match_operand:DI 0 "general_operand" "")
915 (define_expand "umoddi3"
916 [(set (reg:DI 24) (match_operand:DI 1 "input_operand" ""))
917 (set (reg:DI 25) (match_operand:DI 2 "input_operand" ""))
918 (parallel [(set (reg:DI 27)
921 (clobber (reg:DI 23))
922 (clobber (reg:DI 28))])
923 (set (match_operand:DI 0 "general_operand" "")
928 ;; Lengths of 8 for ldq $t12,__divq($gp); jsr $t9,($t12),__divq as
929 ;; expanded by the assembler.
932 (sign_extend:DI (match_operator:SI 1 "divmod_operator"
933 [(reg:DI 24) (reg:DI 25)])))
934 (clobber (reg:DI 23))
935 (clobber (reg:DI 28))]
938 [(set_attr "type" "jsr")
939 (set_attr "length" "8")])
943 (match_operator:DI 1 "divmod_operator"
944 [(reg:DI 24) (reg:DI 25)]))
945 (clobber (reg:DI 23))
946 (clobber (reg:DI 28))]
949 [(set_attr "type" "jsr")
950 (set_attr "length" "8")])
952 ;; Next are the basic logical operations. These only exist in DImode.
954 (define_insn "anddi3"
955 [(set (match_operand:DI 0 "register_operand" "=r,r,r")
956 (and:DI (match_operand:DI 1 "reg_or_0_operand" "%rJ,rJ,rJ")
957 (match_operand:DI 2 "and_operand" "rI,N,MH")))]
963 [(set_attr "type" "ilog,ilog,shift")])
965 ;; There are times when we can split an AND into two AND insns. This occurs
966 ;; when we can first clear any bytes and then clear anything else. For
967 ;; example "I & 0xffff07" is "(I & 0xffffff) & 0xffffffffffffff07".
968 ;; Only do this when running on 64-bit host since the computations are
969 ;; too messy otherwise.
972 [(set (match_operand:DI 0 "register_operand" "")
973 (and:DI (match_operand:DI 1 "register_operand" "")
974 (match_operand:DI 2 "const_int_operand" "")))]
975 "HOST_BITS_PER_WIDE_INT == 64 && ! and_operand (operands[2], DImode)"
976 [(set (match_dup 0) (and:DI (match_dup 1) (match_dup 3)))
977 (set (match_dup 0) (and:DI (match_dup 0) (match_dup 4)))]
980 unsigned HOST_WIDE_INT mask1 = INTVAL (operands[2]);
981 unsigned HOST_WIDE_INT mask2 = mask1;
984 /* For each byte that isn't all zeros, make it all ones. */
985 for (i = 0; i < 64; i += 8)
986 if ((mask1 & ((HOST_WIDE_INT) 0xff << i)) != 0)
987 mask1 |= (HOST_WIDE_INT) 0xff << i;
989 /* Now turn on any bits we've just turned off. */
992 operands[3] = GEN_INT (mask1);
993 operands[4] = GEN_INT (mask2);
996 (define_insn "zero_extendqihi2"
997 [(set (match_operand:HI 0 "register_operand" "=r")
998 (zero_extend:HI (match_operand:QI 1 "register_operand" "r")))]
1001 [(set_attr "type" "ilog")])
1004 [(set (match_operand:SI 0 "register_operand" "=r,r")
1005 (zero_extend:SI (match_operand:QI 1 "nonimmediate_operand" "r,m")))]
1010 [(set_attr "type" "ilog,ild")])
1013 [(set (match_operand:SI 0 "register_operand" "=r")
1014 (zero_extend:SI (match_operand:QI 1 "register_operand" "r")))]
1017 [(set_attr "type" "ilog")])
1019 (define_expand "zero_extendqisi2"
1020 [(set (match_operand:SI 0 "register_operand" "")
1021 (zero_extend:SI (match_operand:QI 1 "register_operand" "")))]
1026 [(set (match_operand:DI 0 "register_operand" "=r,r")
1027 (zero_extend:DI (match_operand:QI 1 "nonimmediate_operand" "r,m")))]
1032 [(set_attr "type" "ilog,ild")])
1035 [(set (match_operand:DI 0 "register_operand" "=r")
1036 (zero_extend:DI (match_operand:QI 1 "register_operand" "r")))]
1039 [(set_attr "type" "ilog")])
1041 (define_expand "zero_extendqidi2"
1042 [(set (match_operand:DI 0 "register_operand" "")
1043 (zero_extend:DI (match_operand:QI 1 "register_operand" "")))]
1048 [(set (match_operand:SI 0 "register_operand" "=r,r")
1049 (zero_extend:SI (match_operand:HI 1 "nonimmediate_operand" "r,m")))]
1054 [(set_attr "type" "shift,ild")])
1057 [(set (match_operand:SI 0 "register_operand" "=r")
1058 (zero_extend:SI (match_operand:HI 1 "register_operand" "r")))]
1061 [(set_attr "type" "shift")])
1063 (define_expand "zero_extendhisi2"
1064 [(set (match_operand:SI 0 "register_operand" "")
1065 (zero_extend:SI (match_operand:HI 1 "register_operand" "")))]
1070 [(set (match_operand:DI 0 "register_operand" "=r,r")
1071 (zero_extend:DI (match_operand:HI 1 "nonimmediate_operand" "r,m")))]
1076 [(set_attr "type" "shift,ild")])
1079 [(set (match_operand:DI 0 "register_operand" "=r")
1080 (zero_extend:DI (match_operand:HI 1 "register_operand" "r")))]
1083 [(set_attr "type" "shift")])
1085 (define_expand "zero_extendhidi2"
1086 [(set (match_operand:DI 0 "register_operand" "")
1087 (zero_extend:DI (match_operand:HI 1 "register_operand" "")))]
1091 (define_insn "zero_extendsidi2"
1092 [(set (match_operand:DI 0 "register_operand" "=r")
1093 (zero_extend:DI (match_operand:SI 1 "register_operand" "r")))]
1096 [(set_attr "type" "shift")])
1099 [(set (match_operand:DI 0 "register_operand" "=r")
1100 (and:DI (not:DI (match_operand:DI 1 "reg_or_8bit_operand" "rI"))
1101 (match_operand:DI 2 "reg_or_0_operand" "rJ")))]
1104 [(set_attr "type" "ilog")])
1106 (define_insn "iordi3"
1107 [(set (match_operand:DI 0 "register_operand" "=r,r")
1108 (ior:DI (match_operand:DI 1 "reg_or_0_operand" "%rJ,rJ")
1109 (match_operand:DI 2 "or_operand" "rI,N")))]
1114 [(set_attr "type" "ilog")])
1116 (define_insn "one_cmpldi2"
1117 [(set (match_operand:DI 0 "register_operand" "=r")
1118 (not:DI (match_operand:DI 1 "reg_or_8bit_operand" "rI")))]
1121 [(set_attr "type" "ilog")])
1124 [(set (match_operand:DI 0 "register_operand" "=r")
1125 (ior:DI (not:DI (match_operand:DI 1 "reg_or_8bit_operand" "rI"))
1126 (match_operand:DI 2 "reg_or_0_operand" "rJ")))]
1129 [(set_attr "type" "ilog")])
1131 (define_insn "xordi3"
1132 [(set (match_operand:DI 0 "register_operand" "=r,r")
1133 (xor:DI (match_operand:DI 1 "reg_or_0_operand" "%rJ,rJ")
1134 (match_operand:DI 2 "or_operand" "rI,N")))]
1139 [(set_attr "type" "ilog")])
1142 [(set (match_operand:DI 0 "register_operand" "=r")
1143 (not:DI (xor:DI (match_operand:DI 1 "register_operand" "%rJ")
1144 (match_operand:DI 2 "register_operand" "rI"))))]
1147 [(set_attr "type" "ilog")])
1149 ;; Handle the FFS insn if we support CIX.
1151 (define_expand "ffsdi2"
1153 (unspec [(match_operand:DI 1 "register_operand" "")] 1))
1155 (plus:DI (match_dup 2) (const_int 1)))
1156 (set (match_operand:DI 0 "register_operand" "")
1157 (if_then_else:DI (eq (match_dup 1) (const_int 0))
1158 (const_int 0) (match_dup 3)))]
1162 operands[2] = gen_reg_rtx (DImode);
1163 operands[3] = gen_reg_rtx (DImode);
1167 [(set (match_operand:DI 0 "register_operand" "=r")
1168 (unspec [(match_operand:DI 1 "register_operand" "r")] 1))]
1171 ; ev6 calls all mvi and cttz/ctlz/popc class imisc, so just
1172 ; reuse the existing type name.
1173 [(set_attr "type" "mvi")])
1175 ;; Next come the shifts and the various extract and insert operations.
1177 (define_insn "ashldi3"
1178 [(set (match_operand:DI 0 "register_operand" "=r,r")
1179 (ashift:DI (match_operand:DI 1 "reg_or_0_operand" "rJ,rJ")
1180 (match_operand:DI 2 "reg_or_6bit_operand" "P,rS")))]
1184 switch (which_alternative)
1187 if (operands[2] == const1_rtx)
1188 return \"addq %r1,%r1,%0\";
1190 return \"s%P2addq %r1,0,%0\";
1192 return \"sll %r1,%2,%0\";
1197 [(set_attr "type" "iadd,shift")])
1199 ;; ??? The following pattern is made by combine, but earlier phases
1200 ;; (specifically flow) can't handle it. This occurs in jump.c. Deal
1201 ;; with this in a better way at some point.
1203 ;; [(set (match_operand:DI 0 "register_operand" "=r")
1205 ;; (subreg:SI (ashift:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
1206 ;; (match_operand:DI 2 "const_int_operand" "P"))
1208 ;; "INTVAL (operands[2]) >= 1 && INTVAL (operands[2]) <= 3"
1211 ;; if (operands[2] == const1_rtx)
1212 ;; return \"addl %r1,%r1,%0\";
1214 ;; return \"s%P2addl %r1,0,%0\";
1216 ;; [(set_attr "type" "iadd")])
1218 (define_insn "lshrdi3"
1219 [(set (match_operand:DI 0 "register_operand" "=r")
1220 (lshiftrt:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
1221 (match_operand:DI 2 "reg_or_6bit_operand" "rS")))]
1224 [(set_attr "type" "shift")])
1226 (define_insn "ashrdi3"
1227 [(set (match_operand:DI 0 "register_operand" "=r")
1228 (ashiftrt:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
1229 (match_operand:DI 2 "reg_or_6bit_operand" "rS")))]
1232 [(set_attr "type" "shift")])
1234 (define_expand "extendqihi2"
1236 (ashift:DI (match_operand:QI 1 "some_operand" "")
1238 (set (match_operand:HI 0 "register_operand" "")
1239 (ashiftrt:DI (match_dup 2)
1246 emit_insn (gen_extendqihi2x (operands[0],
1247 force_reg (QImode, operands[1])));
1251 /* If we have an unaligned MEM, extend to DImode (which we do
1252 specially) and then copy to the result. */
1253 if (unaligned_memory_operand (operands[1], HImode))
1255 rtx temp = gen_reg_rtx (DImode);
1257 emit_insn (gen_extendqidi2 (temp, operands[1]));
1258 emit_move_insn (operands[0], gen_lowpart (HImode, temp));
1262 operands[0] = gen_lowpart (DImode, operands[0]);
1263 operands[1] = gen_lowpart (DImode, force_reg (QImode, operands[1]));
1264 operands[2] = gen_reg_rtx (DImode);
1267 (define_insn "extendqidi2x"
1268 [(set (match_operand:DI 0 "register_operand" "=r")
1269 (sign_extend:DI (match_operand:QI 1 "register_operand" "r")))]
1272 [(set_attr "type" "shift")])
1274 (define_insn "extendhidi2x"
1275 [(set (match_operand:DI 0 "register_operand" "=r")
1276 (sign_extend:DI (match_operand:HI 1 "register_operand" "r")))]
1279 [(set_attr "type" "shift")])
1281 (define_insn "extendqisi2x"
1282 [(set (match_operand:SI 0 "register_operand" "=r")
1283 (sign_extend:SI (match_operand:QI 1 "register_operand" "r")))]
1286 [(set_attr "type" "shift")])
1288 (define_insn "extendhisi2x"
1289 [(set (match_operand:SI 0 "register_operand" "=r")
1290 (sign_extend:SI (match_operand:HI 1 "register_operand" "r")))]
1293 [(set_attr "type" "shift")])
1295 (define_insn "extendqihi2x"
1296 [(set (match_operand:HI 0 "register_operand" "=r")
1297 (sign_extend:HI (match_operand:QI 1 "register_operand" "r")))]
1300 [(set_attr "type" "shift")])
1302 (define_expand "extendqisi2"
1304 (ashift:DI (match_operand:QI 1 "some_operand" "")
1306 (set (match_operand:SI 0 "register_operand" "")
1307 (ashiftrt:DI (match_dup 2)
1314 emit_insn (gen_extendqisi2x (operands[0],
1315 force_reg (QImode, operands[1])));
1319 /* If we have an unaligned MEM, extend to a DImode form of
1320 the result (which we do specially). */
1321 if (unaligned_memory_operand (operands[1], QImode))
1323 rtx temp = gen_reg_rtx (DImode);
1325 emit_insn (gen_extendqidi2 (temp, operands[1]));
1326 emit_move_insn (operands[0], gen_lowpart (SImode, temp));
1330 operands[0] = gen_lowpart (DImode, operands[0]);
1331 operands[1] = gen_lowpart (DImode, force_reg (QImode, operands[1]));
1332 operands[2] = gen_reg_rtx (DImode);
1335 (define_expand "extendqidi2"
1337 (ashift:DI (match_operand:QI 1 "some_operand" "")
1339 (set (match_operand:DI 0 "register_operand" "")
1340 (ashiftrt:DI (match_dup 2)
1347 emit_insn (gen_extendqidi2x (operands[0],
1348 force_reg (QImode, operands[1])));
1352 if (unaligned_memory_operand (operands[1], QImode))
1355 = gen_unaligned_extendqidi (operands[0],
1356 get_unaligned_address (operands[1], 1));
1358 alpha_set_memflags (seq, operands[1]);
1363 operands[1] = gen_lowpart (DImode, force_reg (QImode, operands[1]));
1364 operands[2] = gen_reg_rtx (DImode);
1367 (define_expand "extendhisi2"
1369 (ashift:DI (match_operand:HI 1 "some_operand" "")
1371 (set (match_operand:SI 0 "register_operand" "")
1372 (ashiftrt:DI (match_dup 2)
1379 emit_insn (gen_extendhisi2x (operands[0],
1380 force_reg (HImode, operands[1])));
1384 /* If we have an unaligned MEM, extend to a DImode form of
1385 the result (which we do specially). */
1386 if (unaligned_memory_operand (operands[1], HImode))
1388 rtx temp = gen_reg_rtx (DImode);
1390 emit_insn (gen_extendhidi2 (temp, operands[1]));
1391 emit_move_insn (operands[0], gen_lowpart (SImode, temp));
1395 operands[0] = gen_lowpart (DImode, operands[0]);
1396 operands[1] = gen_lowpart (DImode, force_reg (HImode, operands[1]));
1397 operands[2] = gen_reg_rtx (DImode);
1400 (define_expand "extendhidi2"
1402 (ashift:DI (match_operand:HI 1 "some_operand" "")
1404 (set (match_operand:DI 0 "register_operand" "")
1405 (ashiftrt:DI (match_dup 2)
1412 emit_insn (gen_extendhidi2x (operands[0],
1413 force_reg (HImode, operands[1])));
1417 if (unaligned_memory_operand (operands[1], HImode))
1420 = gen_unaligned_extendhidi (operands[0],
1421 get_unaligned_address (operands[1], 2));
1423 alpha_set_memflags (seq, operands[1]);
1428 operands[1] = gen_lowpart (DImode, force_reg (HImode, operands[1]));
1429 operands[2] = gen_reg_rtx (DImode);
1432 ;; Here's how we sign extend an unaligned byte and halfword. Doing this
1433 ;; as a pattern saves one instruction. The code is similar to that for
1434 ;; the unaligned loads (see below).
1436 ;; Operand 1 is the address + 1 (+2 for HI), operand 0 is the result.
1437 (define_expand "unaligned_extendqidi"
1438 [(set (match_dup 2) (match_operand:DI 1 "address_operand" ""))
1440 (mem:DI (and:DI (plus:DI (match_dup 2) (const_int -1))
1443 (ashift:DI (match_dup 3)
1444 (minus:DI (const_int 56)
1446 (and:DI (plus:DI (match_dup 2) (const_int -1))
1449 (set (subreg:DI (match_operand:QI 0 "register_operand" "") 0)
1450 (ashiftrt:DI (match_dup 4) (const_int 56)))]
1453 { operands[2] = gen_reg_rtx (DImode);
1454 operands[3] = gen_reg_rtx (DImode);
1455 operands[4] = gen_reg_rtx (DImode);
1458 (define_expand "unaligned_extendhidi"
1459 [(set (match_dup 2) (match_operand:DI 1 "address_operand" ""))
1461 (mem:DI (and:DI (plus:DI (match_dup 2) (const_int -2))
1464 (ashift:DI (match_dup 3)
1465 (minus:DI (const_int 56)
1467 (and:DI (plus:DI (match_dup 2) (const_int -1))
1470 (set (subreg:DI (match_operand:QI 0 "register_operand" "") 0)
1471 (ashiftrt:DI (match_dup 4) (const_int 48)))]
1474 { operands[2] = gen_reg_rtx (DImode);
1475 operands[3] = gen_reg_rtx (DImode);
1476 operands[4] = gen_reg_rtx (DImode);
1480 [(set (match_operand:DI 0 "register_operand" "=r")
1481 (zero_extract:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
1482 (match_operand:DI 2 "mode_width_operand" "n")
1483 (match_operand:DI 3 "mul8_operand" "I")))]
1485 "ext%M2l %r1,%s3,%0"
1486 [(set_attr "type" "shift")])
1488 (define_insn "extxl"
1489 [(set (match_operand:DI 0 "register_operand" "=r")
1490 (zero_extract:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
1491 (match_operand:DI 2 "mode_width_operand" "n")
1492 (ashift:DI (match_operand:DI 3 "reg_or_8bit_operand" "rI")
1496 [(set_attr "type" "shift")])
1498 (define_insn "extqh"
1499 [(set (match_operand:DI 0 "register_operand" "=r")
1501 (match_operand:DI 1 "reg_or_0_operand" "rJ")
1502 (minus:DI (const_int 56)
1505 (plus:DI (match_operand:DI 2 "reg_or_8bit_operand" "rI")
1511 [(set_attr "type" "shift")])
1513 (define_insn "extlh"
1514 [(set (match_operand:DI 0 "register_operand" "=r")
1516 (and:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
1517 (const_int 2147483647))
1518 (minus:DI (const_int 56)
1521 (plus:DI (match_operand:DI 2 "reg_or_8bit_operand" "rI")
1527 [(set_attr "type" "shift")])
1529 (define_insn "extwh"
1530 [(set (match_operand:DI 0 "register_operand" "=r")
1532 (and:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
1534 (minus:DI (const_int 56)
1537 (plus:DI (match_operand:DI 2 "reg_or_8bit_operand" "rI")
1543 [(set_attr "type" "shift")])
1545 ;; This converts an extXl into an extXh with an appropriate adjustment
1546 ;; to the address calculation.
1549 ;; [(set (match_operand:DI 0 "register_operand" "")
1550 ;; (ashift:DI (zero_extract:DI (match_operand:DI 1 "register_operand" "")
1551 ;; (match_operand:DI 2 "mode_width_operand" "")
1552 ;; (ashift:DI (match_operand:DI 3 "" "")
1554 ;; (match_operand:DI 4 "const_int_operand" "")))
1555 ;; (clobber (match_operand:DI 5 "register_operand" ""))]
1556 ;; "INTVAL (operands[4]) == 64 - INTVAL (operands[2])"
1557 ;; [(set (match_dup 5) (match_dup 6))
1558 ;; (set (match_dup 0)
1559 ;; (ashift:DI (zero_extract:DI (match_dup 1) (match_dup 2)
1560 ;; (ashift:DI (plus:DI (match_dup 5)
1566 ;; operands[6] = plus_constant (operands[3],
1567 ;; INTVAL (operands[2]) / BITS_PER_UNIT);
1568 ;; operands[7] = GEN_INT (- INTVAL (operands[2]) / BITS_PER_UNIT);
1572 [(set (match_operand:DI 0 "register_operand" "=r")
1573 (ashift:DI (zero_extend:DI (match_operand:QI 1 "register_operand" "r"))
1574 (match_operand:DI 2 "mul8_operand" "I")))]
1577 [(set_attr "type" "shift")])
1580 [(set (match_operand:DI 0 "register_operand" "=r")
1581 (ashift:DI (zero_extend:DI (match_operand:HI 1 "register_operand" "r"))
1582 (match_operand:DI 2 "mul8_operand" "I")))]
1585 [(set_attr "type" "shift")])
1588 [(set (match_operand:DI 0 "register_operand" "=r")
1589 (ashift:DI (zero_extend:DI (match_operand:SI 1 "register_operand" "r"))
1590 (match_operand:DI 2 "mul8_operand" "I")))]
1593 [(set_attr "type" "shift")])
1595 (define_insn "insbl"
1596 [(set (match_operand:DI 0 "register_operand" "=r")
1597 (ashift:DI (zero_extend:DI (match_operand:QI 1 "register_operand" "r"))
1598 (ashift:DI (match_operand:DI 2 "reg_or_8bit_operand" "rI")
1602 [(set_attr "type" "shift")])
1604 (define_insn "inswl"
1605 [(set (match_operand:DI 0 "register_operand" "=r")
1606 (ashift:DI (zero_extend:DI (match_operand:HI 1 "register_operand" "r"))
1607 (ashift:DI (match_operand:DI 2 "reg_or_8bit_operand" "rI")
1611 [(set_attr "type" "shift")])
1613 (define_insn "insll"
1614 [(set (match_operand:DI 0 "register_operand" "=r")
1615 (ashift:DI (zero_extend:DI (match_operand:SI 1 "register_operand" "r"))
1616 (ashift:DI (match_operand:DI 2 "reg_or_8bit_operand" "rI")
1620 [(set_attr "type" "shift")])
1622 (define_insn "insql"
1623 [(set (match_operand:DI 0 "register_operand" "=r")
1624 (ashift:DI (match_operand:DI 1 "register_operand" "r")
1625 (ashift:DI (match_operand:DI 2 "reg_or_8bit_operand" "rI")
1629 [(set_attr "type" "shift")])
1631 ;; Combine has this sometimes habit of moving the and outside of the
1632 ;; shift, making life more interesting.
1635 [(set (match_operand:DI 0 "register_operand" "=r")
1636 (and:DI (ashift:DI (match_operand:DI 1 "register_operand" "r")
1637 (match_operand:DI 2 "mul8_operand" "I"))
1638 (match_operand:DI 3 "immediate_operand" "i")))]
1639 "HOST_BITS_PER_WIDE_INT == 64
1640 && GET_CODE (operands[3]) == CONST_INT
1641 && (((unsigned HOST_WIDE_INT) 0xff << INTVAL (operands[2])
1642 == INTVAL (operands[3]))
1643 || ((unsigned HOST_WIDE_INT) 0xffff << INTVAL (operands[2])
1644 == INTVAL (operands[3]))
1645 || ((unsigned HOST_WIDE_INT) 0xffffffff << INTVAL (operands[2])
1646 == INTVAL (operands[3])))"
1649 #if HOST_BITS_PER_WIDE_INT == 64
1650 if ((unsigned HOST_WIDE_INT) 0xff << INTVAL (operands[2])
1651 == INTVAL (operands[3]))
1652 return \"insbl %1,%s2,%0\";
1653 if ((unsigned HOST_WIDE_INT) 0xffff << INTVAL (operands[2])
1654 == INTVAL (operands[3]))
1655 return \"inswl %1,%s2,%0\";
1656 if ((unsigned HOST_WIDE_INT) 0xffffffff << INTVAL (operands[2])
1657 == INTVAL (operands[3]))
1658 return \"insll %1,%s2,%0\";
1662 [(set_attr "type" "shift")])
1664 ;; We do not include the insXh insns because they are complex to express
1665 ;; and it does not appear that we would ever want to generate them.
1667 ;; Since we need them for block moves, though, cop out and use unspec.
1669 (define_insn "insxh"
1670 [(set (match_operand:DI 0 "register_operand" "=r")
1671 (unspec [(match_operand:DI 1 "register_operand" "r")
1672 (match_operand:DI 2 "mode_width_operand" "n")
1673 (match_operand:DI 3 "reg_or_8bit_operand" "rI")] 2))]
1676 [(set_attr "type" "shift")])
1678 (define_insn "mskxl"
1679 [(set (match_operand:DI 0 "register_operand" "=r")
1680 (and:DI (not:DI (ashift:DI
1681 (match_operand:DI 2 "mode_mask_operand" "n")
1683 (match_operand:DI 3 "reg_or_8bit_operand" "rI")
1685 (match_operand:DI 1 "reg_or_0_operand" "rJ")))]
1688 [(set_attr "type" "shift")])
1690 ;; We do not include the mskXh insns because it does not appear we would
1691 ;; ever generate one.
1693 ;; Again, we do for block moves and we use unspec again.
1695 (define_insn "mskxh"
1696 [(set (match_operand:DI 0 "register_operand" "=r")
1697 (unspec [(match_operand:DI 1 "register_operand" "r")
1698 (match_operand:DI 2 "mode_width_operand" "n")
1699 (match_operand:DI 3 "reg_or_8bit_operand" "rI")] 3))]
1702 [(set_attr "type" "shift")])
1704 ;; Floating-point operations. All the double-precision insns can extend
1705 ;; from single, so indicate that. The exception are the ones that simply
1706 ;; play with the sign bits; it's not clear what to do there.
1708 (define_insn "abssf2"
1709 [(set (match_operand:SF 0 "register_operand" "=f")
1710 (abs:SF (match_operand:SF 1 "reg_or_fp0_operand" "fG")))]
1713 [(set_attr "type" "fcpys")])
1715 (define_insn "absdf2"
1716 [(set (match_operand:DF 0 "register_operand" "=f")
1717 (abs:DF (match_operand:DF 1 "reg_or_fp0_operand" "fG")))]
1720 [(set_attr "type" "fcpys")])
1722 (define_insn "negsf2"
1723 [(set (match_operand:SF 0 "register_operand" "=f")
1724 (neg:SF (match_operand:SF 1 "reg_or_fp0_operand" "fG")))]
1727 [(set_attr "type" "fadd")])
1729 (define_insn "negdf2"
1730 [(set (match_operand:DF 0 "register_operand" "=f")
1731 (neg:DF (match_operand:DF 1 "reg_or_fp0_operand" "fG")))]
1734 [(set_attr "type" "fadd")])
1737 [(set (match_operand:SF 0 "register_operand" "=&f")
1738 (plus:SF (match_operand:SF 1 "reg_or_fp0_operand" "%fG")
1739 (match_operand:SF 2 "reg_or_fp0_operand" "fG")))]
1740 "TARGET_FP && alpha_tp == ALPHA_TP_INSN"
1741 "add%,%)%& %R1,%R2,%0"
1742 [(set_attr "type" "fadd")
1743 (set_attr "trap" "yes")])
1745 (define_insn "addsf3"
1746 [(set (match_operand:SF 0 "register_operand" "=f")
1747 (plus:SF (match_operand:SF 1 "reg_or_fp0_operand" "%fG")
1748 (match_operand:SF 2 "reg_or_fp0_operand" "fG")))]
1750 "add%,%)%& %R1,%R2,%0"
1751 [(set_attr "type" "fadd")
1752 (set_attr "trap" "yes")])
1755 [(set (match_operand:DF 0 "register_operand" "=&f")
1756 (plus:DF (match_operand:DF 1 "reg_or_fp0_operand" "%fG")
1757 (match_operand:DF 2 "reg_or_fp0_operand" "fG")))]
1758 "TARGET_FP && alpha_tp == ALPHA_TP_INSN"
1759 "add%-%)%& %R1,%R2,%0"
1760 [(set_attr "type" "fadd")
1761 (set_attr "trap" "yes")])
1763 (define_insn "adddf3"
1764 [(set (match_operand:DF 0 "register_operand" "=f")
1765 (plus:DF (match_operand:DF 1 "reg_or_fp0_operand" "%fG")
1766 (match_operand:DF 2 "reg_or_fp0_operand" "fG")))]
1768 "add%-%)%& %R1,%R2,%0"
1769 [(set_attr "type" "fadd")
1770 (set_attr "trap" "yes")])
1773 [(set (match_operand:DF 0 "register_operand" "=f")
1774 (plus:DF (float_extend:DF
1775 (match_operand:SF 1 "reg_or_fp0_operand" "fG"))
1776 (match_operand:DF 2 "reg_or_fp0_operand" "fG")))]
1777 "TARGET_FP && alpha_tp != ALPHA_TP_INSN"
1778 "add%-%)%& %R1,%R2,%0"
1779 [(set_attr "type" "fadd")
1780 (set_attr "trap" "yes")])
1783 [(set (match_operand:DF 0 "register_operand" "=f")
1784 (plus:DF (float_extend:DF
1785 (match_operand:SF 1 "reg_or_fp0_operand" "%fG"))
1787 (match_operand:SF 2 "reg_or_fp0_operand" "fG"))))]
1788 "TARGET_FP && alpha_tp != ALPHA_TP_INSN"
1789 "add%-%)%& %R1,%R2,%0"
1790 [(set_attr "type" "fadd")
1791 (set_attr "trap" "yes")])
1793 ;; Define conversion operators between DFmode and SImode, using the cvtql
1794 ;; instruction. To allow combine et al to do useful things, we keep the
1795 ;; operation as a unit until after reload, at which point we split the
1798 ;; Note that we (attempt to) only consider this optimization when the
1799 ;; ultimate destination is memory. If we will be doing further integer
1800 ;; processing, it is cheaper to do the truncation in the int regs.
1802 (define_insn "*cvtql"
1803 [(set (match_operand:SI 0 "register_operand" "=f")
1804 (unspec:SI [(match_operand:DI 1 "reg_or_fp0_operand" "fG")] 5))]
1807 [(set_attr "type" "fadd")
1808 (set_attr "trap" "yes")])
1811 [(set (match_operand:SI 0 "memory_operand" "")
1812 (subreg:SI (fix:DI (match_operand:DF 1 "reg_or_fp0_operand" "")) 0))
1813 (clobber (match_scratch:DI 2 ""))
1814 (clobber (match_scratch:SI 3 ""))]
1815 "TARGET_FP && reload_completed"
1816 [(set (match_dup 2) (fix:DI (match_dup 1)))
1817 (set (match_dup 3) (unspec:SI [(match_dup 2)] 5))
1818 (set (match_dup 0) (match_dup 3))]
1822 [(set (match_operand:SI 0 "memory_operand" "")
1823 (subreg:SI (fix:DI (match_operand:DF 1 "reg_or_fp0_operand" "")) 0))
1824 (clobber (match_scratch:DI 2 ""))]
1825 "TARGET_FP && reload_completed"
1826 [(set (match_dup 2) (fix:DI (match_dup 1)))
1827 (set (match_dup 3) (unspec:SI [(match_dup 2)] 5))
1828 (set (match_dup 0) (match_dup 3))]
1829 ;; Due to REG_CANNOT_CHANGE_SIZE issues, we cannot simply use SUBREG.
1830 "operands[3] = gen_rtx_REG (SImode, REGNO (operands[2]));")
1833 [(set (match_operand:SI 0 "memory_operand" "=m")
1834 (subreg:SI (fix:DI (match_operand:DF 1 "reg_or_fp0_operand" "fG")) 0))
1835 (clobber (match_scratch:DI 2 "=&f"))
1836 (clobber (match_scratch:SI 3 "=&f"))]
1837 "TARGET_FP && alpha_tp == ALPHA_TP_INSN"
1839 [(set_attr "type" "fadd")
1840 (set_attr "trap" "yes")])
1843 [(set (match_operand:SI 0 "memory_operand" "=m")
1844 (subreg:SI (fix:DI (match_operand:DF 1 "reg_or_fp0_operand" "fG")) 0))
1845 (clobber (match_scratch:DI 2 "=f"))]
1846 "TARGET_FP && alpha_tp != ALPHA_TP_INSN"
1848 [(set_attr "type" "fadd")
1849 (set_attr "trap" "yes")])
1852 [(set (match_operand:DI 0 "register_operand" "=&f")
1853 (fix:DI (match_operand:DF 1 "reg_or_fp0_operand" "fG")))]
1854 "TARGET_FP && alpha_tp == ALPHA_TP_INSN"
1856 [(set_attr "type" "fadd")
1857 (set_attr "trap" "yes")])
1859 (define_insn "fix_truncdfdi2"
1860 [(set (match_operand:DI 0 "register_operand" "=f")
1861 (fix:DI (match_operand:DF 1 "reg_or_fp0_operand" "fG")))]
1864 [(set_attr "type" "fadd")
1865 (set_attr "trap" "yes")])
1867 ;; Likewise between SFmode and SImode.
1870 [(set (match_operand:SI 0 "memory_operand" "")
1871 (subreg:SI (fix:DI (float_extend:DF
1872 (match_operand:SF 1 "reg_or_fp0_operand" ""))) 0))
1873 (clobber (match_scratch:DI 2 ""))
1874 (clobber (match_scratch:SI 3 ""))]
1875 "TARGET_FP && reload_completed"
1876 [(set (match_dup 2) (fix:DI (float_extend:DF (match_dup 1))))
1877 (set (match_dup 3) (unspec:SI [(match_dup 2)] 5))
1878 (set (match_dup 0) (match_dup 3))]
1882 [(set (match_operand:SI 0 "memory_operand" "")
1883 (subreg:SI (fix:DI (float_extend:DF
1884 (match_operand:SF 1 "reg_or_fp0_operand" ""))) 0))
1885 (clobber (match_scratch:DI 2 ""))]
1886 "TARGET_FP && reload_completed"
1887 [(set (match_dup 2) (fix:DI (float_extend:DF (match_dup 1))))
1888 (set (match_dup 3) (unspec:SI [(match_dup 2)] 5))
1889 (set (match_dup 0) (match_dup 3))]
1890 ;; Due to REG_CANNOT_CHANGE_SIZE issues, we cannot simply use SUBREG.
1891 "operands[3] = gen_rtx_REG (SImode, REGNO (operands[2]));")
1894 [(set (match_operand:SI 0 "memory_operand" "=m")
1895 (subreg:SI (fix:DI (float_extend:DF
1896 (match_operand:SF 1 "reg_or_fp0_operand" "fG"))) 0))
1897 (clobber (match_scratch:DI 2 "=&f"))
1898 (clobber (match_scratch:SI 3 "=&f"))]
1899 "TARGET_FP && alpha_tp == ALPHA_TP_INSN"
1901 [(set_attr "type" "fadd")
1902 (set_attr "trap" "yes")])
1905 [(set (match_operand:SI 0 "memory_operand" "=m")
1906 (subreg:SI (fix:DI (float_extend:DF
1907 (match_operand:SF 1 "reg_or_fp0_operand" "fG"))) 0))
1908 (clobber (match_scratch:DI 2 "=f"))]
1909 "TARGET_FP && alpha_tp != ALPHA_TP_INSN"
1911 [(set_attr "type" "fadd")
1912 (set_attr "trap" "yes")])
1915 [(set (match_operand:DI 0 "register_operand" "=&f")
1916 (fix:DI (float_extend:DF
1917 (match_operand:SF 1 "reg_or_fp0_operand" "fG"))))]
1918 "TARGET_FP && alpha_tp == ALPHA_TP_INSN"
1920 [(set_attr "type" "fadd")
1921 (set_attr "trap" "yes")])
1923 (define_insn "fix_truncsfdi2"
1924 [(set (match_operand:DI 0 "register_operand" "=f")
1925 (fix:DI (float_extend:DF
1926 (match_operand:SF 1 "reg_or_fp0_operand" "fG"))))]
1929 [(set_attr "type" "fadd")
1930 (set_attr "trap" "yes")])
1933 [(set (match_operand:SF 0 "register_operand" "=&f")
1934 (float:SF (match_operand:DI 1 "register_operand" "f")))]
1935 "TARGET_FP && alpha_tp == ALPHA_TP_INSN"
1937 [(set_attr "type" "fadd")
1938 (set_attr "trap" "yes")])
1940 (define_insn "floatdisf2"
1941 [(set (match_operand:SF 0 "register_operand" "=f")
1942 (float:SF (match_operand:DI 1 "register_operand" "f")))]
1945 [(set_attr "type" "fadd")
1946 (set_attr "trap" "yes")])
1949 [(set (match_operand:DF 0 "register_operand" "=&f")
1950 (float:DF (match_operand:DI 1 "register_operand" "f")))]
1951 "TARGET_FP && alpha_tp == ALPHA_TP_INSN"
1953 [(set_attr "type" "fadd")
1954 (set_attr "trap" "yes")])
1956 (define_insn "floatdidf2"
1957 [(set (match_operand:DF 0 "register_operand" "=f")
1958 (float:DF (match_operand:DI 1 "register_operand" "f")))]
1961 [(set_attr "type" "fadd")
1962 (set_attr "trap" "yes")])
1964 (define_expand "extendsfdf2"
1965 [(use (match_operand:DF 0 "register_operand" ""))
1966 (use (match_operand:SF 1 "nonimmediate_operand" ""))]
1970 if (alpha_tp == ALPHA_TP_INSN)
1971 emit_insn (gen_extendsfdf2_tp (operands[0],
1972 force_reg (SFmode, operands[1])));
1974 emit_insn (gen_extendsfdf2_no_tp (operands[0], operands[1]));
1979 (define_insn "extendsfdf2_tp"
1980 [(set (match_operand:DF 0 "register_operand" "=&f")
1981 (float_extend:DF (match_operand:SF 1 "register_operand" "f")))]
1982 "TARGET_FP && alpha_tp == ALPHA_TP_INSN"
1984 [(set_attr "type" "fadd")
1985 (set_attr "trap" "yes")])
1987 (define_insn "extendsfdf2_no_tp"
1988 [(set (match_operand:DF 0 "register_operand" "=f,f,m")
1989 (float_extend:DF (match_operand:SF 1 "nonimmediate_operand" "f,m,f")))]
1990 "TARGET_FP && alpha_tp != ALPHA_TP_INSN"
1995 [(set_attr "type" "fcpys,fld,fst")
1996 (set_attr "trap" "yes")])
1999 [(set (match_operand:SF 0 "register_operand" "=&f")
2000 (float_truncate:SF (match_operand:DF 1 "reg_or_fp0_operand" "fG")))]
2001 "TARGET_FP && alpha_tp == ALPHA_TP_INSN"
2002 "cvt%-%,%)%& %R1,%0"
2003 [(set_attr "type" "fadd")
2004 (set_attr "trap" "yes")])
2006 (define_insn "truncdfsf2"
2007 [(set (match_operand:SF 0 "register_operand" "=f")
2008 (float_truncate:SF (match_operand:DF 1 "reg_or_fp0_operand" "fG")))]
2010 "cvt%-%,%)%& %R1,%0"
2011 [(set_attr "type" "fadd")
2012 (set_attr "trap" "yes")])
2015 [(set (match_operand:SF 0 "register_operand" "=&f")
2016 (div:SF (match_operand:SF 1 "reg_or_fp0_operand" "fG")
2017 (match_operand:SF 2 "reg_or_fp0_operand" "fG")))]
2018 "TARGET_FP && alpha_tp == ALPHA_TP_INSN"
2019 "div%,%)%& %R1,%R2,%0"
2020 [(set_attr "type" "fdiv")
2021 (set_attr "opsize" "si")
2022 (set_attr "trap" "yes")])
2024 (define_insn "divsf3"
2025 [(set (match_operand:SF 0 "register_operand" "=f")
2026 (div:SF (match_operand:SF 1 "reg_or_fp0_operand" "fG")
2027 (match_operand:SF 2 "reg_or_fp0_operand" "fG")))]
2029 "div%,%)%& %R1,%R2,%0"
2030 [(set_attr "type" "fdiv")
2031 (set_attr "opsize" "si")
2032 (set_attr "trap" "yes")])
2035 [(set (match_operand:DF 0 "register_operand" "=&f")
2036 (div:DF (match_operand:DF 1 "reg_or_fp0_operand" "fG")
2037 (match_operand:DF 2 "reg_or_fp0_operand" "fG")))]
2038 "TARGET_FP && alpha_tp == ALPHA_TP_INSN"
2039 "div%-%)%& %R1,%R2,%0"
2040 [(set_attr "type" "fdiv")
2041 (set_attr "trap" "yes")])
2043 (define_insn "divdf3"
2044 [(set (match_operand:DF 0 "register_operand" "=f")
2045 (div:DF (match_operand:DF 1 "reg_or_fp0_operand" "fG")
2046 (match_operand:DF 2 "reg_or_fp0_operand" "fG")))]
2048 "div%-%)%& %R1,%R2,%0"
2049 [(set_attr "type" "fdiv")
2050 (set_attr "trap" "yes")])
2053 [(set (match_operand:DF 0 "register_operand" "=f")
2054 (div:DF (float_extend:DF (match_operand:SF 1 "reg_or_fp0_operand" "fG"))
2055 (match_operand:DF 2 "reg_or_fp0_operand" "fG")))]
2056 "TARGET_FP && alpha_tp != ALPHA_TP_INSN"
2057 "div%-%)%& %R1,%R2,%0"
2058 [(set_attr "type" "fdiv")
2059 (set_attr "trap" "yes")])
2062 [(set (match_operand:DF 0 "register_operand" "=f")
2063 (div:DF (match_operand:DF 1 "reg_or_fp0_operand" "fG")
2065 (match_operand:SF 2 "reg_or_fp0_operand" "fG"))))]
2066 "TARGET_FP && alpha_tp != ALPHA_TP_INSN"
2067 "div%-%)%& %R1,%R2,%0"
2068 [(set_attr "type" "fdiv")
2069 (set_attr "trap" "yes")])
2072 [(set (match_operand:DF 0 "register_operand" "=f")
2073 (div:DF (float_extend:DF (match_operand:SF 1 "reg_or_fp0_operand" "fG"))
2074 (float_extend:DF (match_operand:SF 2 "reg_or_fp0_operand" "fG"))))]
2075 "TARGET_FP && alpha_tp != ALPHA_TP_INSN"
2076 "div%-%)%& %R1,%R2,%0"
2077 [(set_attr "type" "fdiv")
2078 (set_attr "trap" "yes")])
2081 [(set (match_operand:SF 0 "register_operand" "=&f")
2082 (mult:SF (match_operand:SF 1 "reg_or_fp0_operand" "%fG")
2083 (match_operand:SF 2 "reg_or_fp0_operand" "fG")))]
2084 "TARGET_FP && alpha_tp == ALPHA_TP_INSN"
2085 "mul%,%)%& %R1,%R2,%0"
2086 [(set_attr "type" "fmul")
2087 (set_attr "trap" "yes")])
2089 (define_insn "mulsf3"
2090 [(set (match_operand:SF 0 "register_operand" "=f")
2091 (mult:SF (match_operand:SF 1 "reg_or_fp0_operand" "%fG")
2092 (match_operand:SF 2 "reg_or_fp0_operand" "fG")))]
2094 "mul%,%)%& %R1,%R2,%0"
2095 [(set_attr "type" "fmul")
2096 (set_attr "trap" "yes")])
2099 [(set (match_operand:DF 0 "register_operand" "=&f")
2100 (mult:DF (match_operand:DF 1 "reg_or_fp0_operand" "%fG")
2101 (match_operand:DF 2 "reg_or_fp0_operand" "fG")))]
2102 "TARGET_FP && alpha_tp == ALPHA_TP_INSN"
2103 "mul%-%)%& %R1,%R2,%0"
2104 [(set_attr "type" "fmul")
2105 (set_attr "trap" "yes")])
2107 (define_insn "muldf3"
2108 [(set (match_operand:DF 0 "register_operand" "=f")
2109 (mult:DF (match_operand:DF 1 "reg_or_fp0_operand" "%fG")
2110 (match_operand:DF 2 "reg_or_fp0_operand" "fG")))]
2112 "mul%-%)%& %R1,%R2,%0"
2113 [(set_attr "type" "fmul")
2114 (set_attr "trap" "yes")])
2117 [(set (match_operand:DF 0 "register_operand" "=f")
2118 (mult:DF (float_extend:DF
2119 (match_operand:SF 1 "reg_or_fp0_operand" "fG"))
2120 (match_operand:DF 2 "reg_or_fp0_operand" "fG")))]
2121 "TARGET_FP && alpha_tp != ALPHA_TP_INSN"
2122 "mul%-%)%& %R1,%R2,%0"
2123 [(set_attr "type" "fmul")
2124 (set_attr "trap" "yes")])
2127 [(set (match_operand:DF 0 "register_operand" "=f")
2128 (mult:DF (float_extend:DF
2129 (match_operand:SF 1 "reg_or_fp0_operand" "%fG"))
2131 (match_operand:SF 2 "reg_or_fp0_operand" "fG"))))]
2132 "TARGET_FP && alpha_tp != ALPHA_TP_INSN"
2133 "mul%-%)%& %R1,%R2,%0"
2134 [(set_attr "type" "fmul")
2135 (set_attr "trap" "yes")])
2138 [(set (match_operand:SF 0 "register_operand" "=&f")
2139 (minus:SF (match_operand:SF 1 "reg_or_fp0_operand" "fG")
2140 (match_operand:SF 2 "reg_or_fp0_operand" "fG")))]
2141 "TARGET_FP && alpha_tp == ALPHA_TP_INSN"
2142 "sub%,%)%& %R1,%R2,%0"
2143 [(set_attr "type" "fadd")
2144 (set_attr "trap" "yes")])
2146 (define_insn "subsf3"
2147 [(set (match_operand:SF 0 "register_operand" "=f")
2148 (minus:SF (match_operand:SF 1 "reg_or_fp0_operand" "fG")
2149 (match_operand:SF 2 "reg_or_fp0_operand" "fG")))]
2151 "sub%,%)%& %R1,%R2,%0"
2152 [(set_attr "type" "fadd")
2153 (set_attr "trap" "yes")])
2156 [(set (match_operand:DF 0 "register_operand" "=&f")
2157 (minus:DF (match_operand:DF 1 "reg_or_fp0_operand" "fG")
2158 (match_operand:DF 2 "reg_or_fp0_operand" "fG")))]
2159 "TARGET_FP && alpha_tp == ALPHA_TP_INSN"
2160 "sub%-%)%& %R1,%R2,%0"
2161 [(set_attr "type" "fadd")
2162 (set_attr "trap" "yes")])
2164 (define_insn "subdf3"
2165 [(set (match_operand:DF 0 "register_operand" "=f")
2166 (minus:DF (match_operand:DF 1 "reg_or_fp0_operand" "fG")
2167 (match_operand:DF 2 "reg_or_fp0_operand" "fG")))]
2169 "sub%-%)%& %R1,%R2,%0"
2170 [(set_attr "type" "fadd")
2171 (set_attr "trap" "yes")])
2174 [(set (match_operand:DF 0 "register_operand" "=f")
2175 (minus:DF (float_extend:DF
2176 (match_operand:SF 1 "reg_or_fp0_operand" "fG"))
2177 (match_operand:DF 2 "reg_or_fp0_operand" "fG")))]
2178 "TARGET_FP && alpha_tp != ALPHA_TP_INSN"
2179 "sub%-%)%& %R1,%R2,%0"
2180 [(set_attr "type" "fadd")
2181 (set_attr "trap" "yes")])
2184 [(set (match_operand:DF 0 "register_operand" "=f")
2185 (minus:DF (match_operand:DF 1 "reg_or_fp0_operand" "fG")
2187 (match_operand:SF 2 "reg_or_fp0_operand" "fG"))))]
2188 "TARGET_FP && alpha_tp != ALPHA_TP_INSN"
2189 "sub%-%)%& %R1,%R2,%0"
2190 [(set_attr "type" "fadd")
2191 (set_attr "trap" "yes")])
2194 [(set (match_operand:DF 0 "register_operand" "=f")
2195 (minus:DF (float_extend:DF
2196 (match_operand:SF 1 "reg_or_fp0_operand" "fG"))
2198 (match_operand:SF 2 "reg_or_fp0_operand" "fG"))))]
2199 "TARGET_FP && alpha_tp != ALPHA_TP_INSN"
2200 "sub%-%)%& %R1,%R2,%0"
2201 [(set_attr "type" "fadd")
2202 (set_attr "trap" "yes")])
2205 [(set (match_operand:SF 0 "register_operand" "=&f")
2206 (sqrt:SF (match_operand:SF 1 "reg_or_fp0_operand" "fG")))]
2207 "TARGET_FP && TARGET_CIX && alpha_tp == ALPHA_TP_INSN"
2209 [(set_attr "type" "fsqrt")
2210 (set_attr "opsize" "si")
2211 (set_attr "trap" "yes")])
2213 (define_insn "sqrtsf2"
2214 [(set (match_operand:SF 0 "register_operand" "=f")
2215 (sqrt:SF (match_operand:SF 1 "reg_or_fp0_operand" "fG")))]
2216 "TARGET_FP && TARGET_CIX"
2218 [(set_attr "type" "fsqrt")
2219 (set_attr "opsize" "si")
2220 (set_attr "trap" "yes")])
2223 [(set (match_operand:DF 0 "register_operand" "=&f")
2224 (sqrt:DF (match_operand:DF 1 "reg_or_fp0_operand" "fG")))]
2225 "TARGET_FP && TARGET_CIX && alpha_tp == ALPHA_TP_INSN"
2227 [(set_attr "type" "fsqrt")
2228 (set_attr "trap" "yes")])
2230 (define_insn "sqrtdf2"
2231 [(set (match_operand:DF 0 "register_operand" "=f")
2232 (sqrt:DF (match_operand:DF 1 "reg_or_fp0_operand" "fG")))]
2233 "TARGET_FP && TARGET_CIX"
2235 [(set_attr "type" "fsqrt")
2236 (set_attr "trap" "yes")])
2238 ;; Next are all the integer comparisons, and conditional moves and branches
2239 ;; and some of the related define_expand's and define_split's.
2242 [(set (match_operand:DI 0 "register_operand" "=r")
2243 (match_operator:DI 1 "alpha_comparison_operator"
2244 [(match_operand:DI 2 "reg_or_0_operand" "rJ")
2245 (match_operand:DI 3 "reg_or_8bit_operand" "rI")]))]
2248 [(set_attr "type" "icmp")])
2251 [(set (match_operand:DI 0 "register_operand" "=r")
2252 (match_operator:DI 1 "alpha_swapped_comparison_operator"
2253 [(match_operand:DI 2 "reg_or_8bit_operand" "rI")
2254 (match_operand:DI 3 "reg_or_0_operand" "rJ")]))]
2257 [(set_attr "type" "icmp")])
2259 ;; This pattern exists so conditional moves of SImode values are handled.
2260 ;; Comparisons are still done in DImode though.
2263 [(set (match_operand:SI 0 "register_operand" "=r,r,r,r")
2265 (match_operator 2 "signed_comparison_operator"
2266 [(match_operand:DI 3 "reg_or_0_operand" "rJ,rJ,J,J")
2267 (match_operand:DI 4 "reg_or_0_operand" "J,J,rJ,rJ")])
2268 (match_operand:SI 1 "reg_or_8bit_operand" "rI,0,rI,0")
2269 (match_operand:SI 5 "reg_or_8bit_operand" "0,rI,0,rI")))]
2270 "operands[3] == const0_rtx || operands[4] == const0_rtx"
2276 [(set_attr "type" "icmov")])
2279 [(set (match_operand:DI 0 "register_operand" "=r,r,r,r")
2281 (match_operator 2 "signed_comparison_operator"
2282 [(match_operand:DI 3 "reg_or_0_operand" "rJ,rJ,J,J")
2283 (match_operand:DI 4 "reg_or_0_operand" "J,J,rJ,rJ")])
2284 (match_operand:DI 1 "reg_or_8bit_operand" "rI,0,rI,0")
2285 (match_operand:DI 5 "reg_or_8bit_operand" "0,rI,0,rI")))]
2286 "operands[3] == const0_rtx || operands[4] == const0_rtx"
2292 [(set_attr "type" "icmov")])
2295 [(set (match_operand:DI 0 "register_operand" "=r,r")
2297 (eq (zero_extract:DI (match_operand:DI 2 "reg_or_0_operand" "rJ,rJ")
2301 (match_operand:DI 1 "reg_or_8bit_operand" "rI,0")
2302 (match_operand:DI 3 "reg_or_8bit_operand" "0,rI")))]
2307 [(set_attr "type" "icmov")])
2310 [(set (match_operand:DI 0 "register_operand" "=r,r")
2312 (ne (zero_extract:DI (match_operand:DI 2 "reg_or_0_operand" "rJ,rJ")
2316 (match_operand:DI 1 "reg_or_8bit_operand" "rI,0")
2317 (match_operand:DI 3 "reg_or_8bit_operand" "0,rI")))]
2322 [(set_attr "type" "icmov")])
2324 ;; This form is added since combine thinks that an IF_THEN_ELSE with both
2325 ;; arms constant is a single insn, so it won't try to form it if combine
2326 ;; knows they are really two insns. This occurs in divides by powers
2330 [(set (match_operand:DI 0 "register_operand" "=r")
2332 (match_operator 2 "signed_comparison_operator"
2333 [(match_operand:DI 3 "reg_or_0_operand" "rJ")
2335 (plus:DI (match_dup 0)
2336 (match_operand:DI 1 "reg_or_8bit_operand" "rI"))
2338 (clobber (match_scratch:DI 4 "=&r"))]
2340 "addq %0,%1,%4\;cmov%C2 %r3,%4,%0"
2341 [(set_attr "type" "icmov")
2342 (set_attr "length" "8")])
2345 [(set (match_operand:DI 0 "register_operand" "")
2347 (match_operator 2 "signed_comparison_operator"
2348 [(match_operand:DI 3 "reg_or_0_operand" "")
2350 (plus:DI (match_dup 0)
2351 (match_operand:DI 1 "reg_or_8bit_operand" ""))
2353 (clobber (match_operand:DI 4 "register_operand" ""))]
2355 [(set (match_dup 4) (plus:DI (match_dup 0) (match_dup 1)))
2356 (set (match_dup 0) (if_then_else:DI (match_op_dup 2
2359 (match_dup 4) (match_dup 0)))]
2364 [(set (match_operand:DI 0 "register_operand" "")
2366 (match_operator 1 "comparison_operator"
2367 [(zero_extract:DI (match_operand:DI 2 "register_operand" "")
2369 (match_operand:DI 3 "const_int_operand" ""))
2371 (match_operand:DI 4 "reg_or_8bit_operand" "")
2372 (match_operand:DI 5 "reg_or_8bit_operand" "")))
2373 (clobber (match_operand:DI 6 "register_operand" ""))])]
2374 "INTVAL (operands[3]) != 0"
2376 (lshiftrt:DI (match_dup 2) (match_dup 3)))
2378 (if_then_else:DI (match_op_dup 1
2379 [(zero_extract:DI (match_dup 6)
2387 ;; For ABS, we have two choices, depending on whether the input and output
2388 ;; registers are the same or not.
2389 (define_expand "absdi2"
2390 [(set (match_operand:DI 0 "register_operand" "")
2391 (abs:DI (match_operand:DI 1 "register_operand" "")))]
2394 { if (rtx_equal_p (operands[0], operands[1]))
2395 emit_insn (gen_absdi2_same (operands[0], gen_reg_rtx (DImode)));
2397 emit_insn (gen_absdi2_diff (operands[0], operands[1]));
2402 (define_expand "absdi2_same"
2403 [(set (match_operand:DI 1 "register_operand" "")
2404 (neg:DI (match_operand:DI 0 "register_operand" "")))
2406 (if_then_else:DI (ge (match_dup 0) (const_int 0))
2412 (define_expand "absdi2_diff"
2413 [(set (match_operand:DI 0 "register_operand" "")
2414 (neg:DI (match_operand:DI 1 "register_operand" "")))
2416 (if_then_else:DI (lt (match_dup 1) (const_int 0))
2423 [(set (match_operand:DI 0 "register_operand" "")
2424 (abs:DI (match_dup 0)))
2425 (clobber (match_operand:DI 2 "register_operand" ""))]
2427 [(set (match_dup 1) (neg:DI (match_dup 0)))
2428 (set (match_dup 0) (if_then_else:DI (ge (match_dup 0) (const_int 0))
2429 (match_dup 0) (match_dup 1)))]
2433 [(set (match_operand:DI 0 "register_operand" "")
2434 (abs:DI (match_operand:DI 1 "register_operand" "")))]
2435 "! rtx_equal_p (operands[0], operands[1])"
2436 [(set (match_dup 0) (neg:DI (match_dup 1)))
2437 (set (match_dup 0) (if_then_else:DI (lt (match_dup 1) (const_int 0))
2438 (match_dup 0) (match_dup 1)))]
2442 [(set (match_operand:DI 0 "register_operand" "")
2443 (neg:DI (abs:DI (match_dup 0))))
2444 (clobber (match_operand:DI 2 "register_operand" ""))]
2446 [(set (match_dup 1) (neg:DI (match_dup 0)))
2447 (set (match_dup 0) (if_then_else:DI (le (match_dup 0) (const_int 0))
2448 (match_dup 0) (match_dup 1)))]
2452 [(set (match_operand:DI 0 "register_operand" "")
2453 (neg:DI (abs:DI (match_operand:DI 1 "register_operand" ""))))]
2454 "! rtx_equal_p (operands[0], operands[1])"
2455 [(set (match_dup 0) (neg:DI (match_dup 1)))
2456 (set (match_dup 0) (if_then_else:DI (gt (match_dup 1) (const_int 0))
2457 (match_dup 0) (match_dup 1)))]
2460 (define_insn "sminqi3"
2461 [(set (match_operand:QI 0 "register_operand" "=r")
2462 (smin:SI (match_operand:QI 1 "reg_or_0_operand" "%rJ")
2463 (match_operand:QI 2 "reg_or_8bit_operand" "rI")))]
2466 [(set_attr "type" "mvi")])
2468 (define_insn "uminqi3"
2469 [(set (match_operand:QI 0 "register_operand" "=r")
2470 (umin:SI (match_operand:QI 1 "reg_or_0_operand" "%rJ")
2471 (match_operand:QI 2 "reg_or_8bit_operand" "rI")))]
2474 [(set_attr "type" "mvi")])
2476 (define_insn "smaxqi3"
2477 [(set (match_operand:QI 0 "register_operand" "=r")
2478 (smax:SI (match_operand:QI 1 "reg_or_0_operand" "%rJ")
2479 (match_operand:QI 2 "reg_or_8bit_operand" "rI")))]
2482 [(set_attr "type" "mvi")])
2484 (define_insn "umaxqi3"
2485 [(set (match_operand:QI 0 "register_operand" "=r")
2486 (umax:SI (match_operand:QI 1 "reg_or_0_operand" "%rJ")
2487 (match_operand:QI 2 "reg_or_8bit_operand" "rI")))]
2490 [(set_attr "type" "mvi")])
2492 (define_insn "sminhi3"
2493 [(set (match_operand:HI 0 "register_operand" "=r")
2494 (smin:SI (match_operand:HI 1 "reg_or_0_operand" "%rJ")
2495 (match_operand:HI 2 "reg_or_8bit_operand" "rI")))]
2498 [(set_attr "type" "mvi")])
2500 (define_insn "uminhi3"
2501 [(set (match_operand:HI 0 "register_operand" "=r")
2502 (umin:SI (match_operand:HI 1 "reg_or_0_operand" "%rJ")
2503 (match_operand:HI 2 "reg_or_8bit_operand" "rI")))]
2506 [(set_attr "type" "mvi")])
2508 (define_insn "smaxhi3"
2509 [(set (match_operand:HI 0 "register_operand" "=r")
2510 (smax:SI (match_operand:HI 1 "reg_or_0_operand" "%rJ")
2511 (match_operand:HI 2 "reg_or_8bit_operand" "rI")))]
2514 [(set_attr "type" "mvi")])
2516 (define_insn "umaxhi3"
2517 [(set (match_operand:HI 0 "register_operand" "=r")
2518 (umax:SI (match_operand:HI 1 "reg_or_0_operand" "%rJ")
2519 (match_operand:HI 2 "reg_or_8bit_operand" "rI")))]
2522 [(set_attr "type" "shift")])
2524 (define_expand "smaxdi3"
2526 (le:DI (match_operand:DI 1 "reg_or_0_operand" "")
2527 (match_operand:DI 2 "reg_or_8bit_operand" "")))
2528 (set (match_operand:DI 0 "register_operand" "")
2529 (if_then_else:DI (eq (match_dup 3) (const_int 0))
2530 (match_dup 1) (match_dup 2)))]
2533 { operands[3] = gen_reg_rtx (DImode);
2537 [(set (match_operand:DI 0 "register_operand" "")
2538 (smax:DI (match_operand:DI 1 "reg_or_0_operand" "")
2539 (match_operand:DI 2 "reg_or_8bit_operand" "")))
2540 (clobber (match_operand:DI 3 "register_operand" ""))]
2541 "operands[2] != const0_rtx"
2542 [(set (match_dup 3) (le:DI (match_dup 1) (match_dup 2)))
2543 (set (match_dup 0) (if_then_else:DI (eq (match_dup 3) (const_int 0))
2544 (match_dup 1) (match_dup 2)))]
2548 [(set (match_operand:DI 0 "register_operand" "=r")
2549 (smax:DI (match_operand:DI 1 "register_operand" "0")
2553 [(set_attr "type" "icmov")])
2555 (define_expand "smindi3"
2557 (lt:DI (match_operand:DI 1 "reg_or_0_operand" "")
2558 (match_operand:DI 2 "reg_or_8bit_operand" "")))
2559 (set (match_operand:DI 0 "register_operand" "")
2560 (if_then_else:DI (ne (match_dup 3) (const_int 0))
2561 (match_dup 1) (match_dup 2)))]
2564 { operands[3] = gen_reg_rtx (DImode);
2568 [(set (match_operand:DI 0 "register_operand" "")
2569 (smin:DI (match_operand:DI 1 "reg_or_0_operand" "")
2570 (match_operand:DI 2 "reg_or_8bit_operand" "")))
2571 (clobber (match_operand:DI 3 "register_operand" ""))]
2572 "operands[2] != const0_rtx"
2573 [(set (match_dup 3) (lt:DI (match_dup 1) (match_dup 2)))
2574 (set (match_dup 0) (if_then_else:DI (ne (match_dup 3) (const_int 0))
2575 (match_dup 1) (match_dup 2)))]
2579 [(set (match_operand:DI 0 "register_operand" "=r")
2580 (smin:DI (match_operand:DI 1 "register_operand" "0")
2584 [(set_attr "type" "icmov")])
2586 (define_expand "umaxdi3"
2588 (leu:DI (match_operand:DI 1 "reg_or_0_operand" "")
2589 (match_operand:DI 2 "reg_or_8bit_operand" "")))
2590 (set (match_operand:DI 0 "register_operand" "")
2591 (if_then_else:DI (eq (match_dup 3) (const_int 0))
2592 (match_dup 1) (match_dup 2)))]
2595 { operands[3] = gen_reg_rtx (DImode);
2599 [(set (match_operand:DI 0 "register_operand" "")
2600 (umax:DI (match_operand:DI 1 "reg_or_0_operand" "")
2601 (match_operand:DI 2 "reg_or_8bit_operand" "")))
2602 (clobber (match_operand:DI 3 "register_operand" ""))]
2603 "operands[2] != const0_rtx"
2604 [(set (match_dup 3) (leu:DI (match_dup 1) (match_dup 2)))
2605 (set (match_dup 0) (if_then_else:DI (eq (match_dup 3) (const_int 0))
2606 (match_dup 1) (match_dup 2)))]
2609 (define_expand "umindi3"
2611 (ltu:DI (match_operand:DI 1 "reg_or_0_operand" "")
2612 (match_operand:DI 2 "reg_or_8bit_operand" "")))
2613 (set (match_operand:DI 0 "register_operand" "")
2614 (if_then_else:DI (ne (match_dup 3) (const_int 0))
2615 (match_dup 1) (match_dup 2)))]
2618 { operands[3] = gen_reg_rtx (DImode);
2622 [(set (match_operand:DI 0 "register_operand" "")
2623 (umin:DI (match_operand:DI 1 "reg_or_0_operand" "")
2624 (match_operand:DI 2 "reg_or_8bit_operand" "")))
2625 (clobber (match_operand:DI 3 "register_operand" ""))]
2626 "operands[2] != const0_rtx"
2627 [(set (match_dup 3) (ltu:DI (match_dup 1) (match_dup 2)))
2628 (set (match_dup 0) (if_then_else:DI (ne (match_dup 3) (const_int 0))
2629 (match_dup 1) (match_dup 2)))]
2635 (match_operator 1 "signed_comparison_operator"
2636 [(match_operand:DI 2 "reg_or_0_operand" "rJ")
2638 (label_ref (match_operand 0 "" ""))
2642 [(set_attr "type" "ibr")])
2647 (match_operator 1 "signed_comparison_operator"
2649 (match_operand:DI 2 "register_operand" "r")])
2650 (label_ref (match_operand 0 "" ""))
2654 [(set_attr "type" "ibr")])
2659 (ne (zero_extract:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
2663 (label_ref (match_operand 0 "" ""))
2667 [(set_attr "type" "ibr")])
2672 (eq (zero_extract:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
2676 (label_ref (match_operand 0 "" ""))
2680 [(set_attr "type" "ibr")])
2686 (match_operator 1 "comparison_operator"
2687 [(zero_extract:DI (match_operand:DI 2 "register_operand" "")
2689 (match_operand:DI 3 "const_int_operand" ""))
2691 (label_ref (match_operand 0 "" ""))
2693 (clobber (match_operand:DI 4 "register_operand" ""))])]
2694 "INTVAL (operands[3]) != 0"
2696 (lshiftrt:DI (match_dup 2) (match_dup 3)))
2698 (if_then_else (match_op_dup 1
2699 [(zero_extract:DI (match_dup 4)
2703 (label_ref (match_dup 0))
2707 ;; The following are the corresponding floating-point insns. Recall
2708 ;; we need to have variants that expand the arguments from SF mode
2712 [(set (match_operand:DF 0 "register_operand" "=&f")
2713 (match_operator:DF 1 "alpha_comparison_operator"
2714 [(match_operand:DF 2 "reg_or_fp0_operand" "fG")
2715 (match_operand:DF 3 "reg_or_fp0_operand" "fG")]))]
2716 "TARGET_FP && alpha_tp == ALPHA_TP_INSN"
2717 "cmp%-%C1%' %R2,%R3,%0"
2718 [(set_attr "type" "fadd")
2719 (set_attr "trap" "yes")])
2722 [(set (match_operand:DF 0 "register_operand" "=f")
2723 (match_operator:DF 1 "alpha_comparison_operator"
2724 [(match_operand:DF 2 "reg_or_fp0_operand" "fG")
2725 (match_operand:DF 3 "reg_or_fp0_operand" "fG")]))]
2726 "TARGET_FP && alpha_tp != ALPHA_TP_INSN"
2727 "cmp%-%C1%' %R2,%R3,%0"
2728 [(set_attr "type" "fadd")
2729 (set_attr "trap" "yes")])
2732 [(set (match_operand:DF 0 "register_operand" "=&f")
2733 (match_operator:DF 1 "alpha_comparison_operator"
2735 (match_operand:SF 2 "reg_or_fp0_operand" "fG"))
2736 (match_operand:DF 3 "reg_or_fp0_operand" "fG")]))]
2737 "TARGET_FP && alpha_tp == ALPHA_TP_INSN"
2738 "cmp%-%C1%' %R2,%R3,%0"
2739 [(set_attr "type" "fadd")
2740 (set_attr "trap" "yes")])
2743 [(set (match_operand:DF 0 "register_operand" "=f")
2744 (match_operator:DF 1 "alpha_comparison_operator"
2746 (match_operand:SF 2 "reg_or_fp0_operand" "fG"))
2747 (match_operand:DF 3 "reg_or_fp0_operand" "fG")]))]
2748 "TARGET_FP && alpha_tp != ALPHA_TP_INSN"
2749 "cmp%-%C1%' %R2,%R3,%0"
2750 [(set_attr "type" "fadd")
2751 (set_attr "trap" "yes")])
2754 [(set (match_operand:DF 0 "register_operand" "=&f")
2755 (match_operator:DF 1 "alpha_comparison_operator"
2756 [(match_operand:DF 2 "reg_or_fp0_operand" "fG")
2758 (match_operand:SF 3 "reg_or_fp0_operand" "fG"))]))]
2759 "TARGET_FP && alpha_tp == ALPHA_TP_INSN"
2760 "cmp%-%C1%' %R2,%R3,%0"
2761 [(set_attr "type" "fadd")
2762 (set_attr "trap" "yes")])
2765 [(set (match_operand:DF 0 "register_operand" "=f")
2766 (match_operator:DF 1 "alpha_comparison_operator"
2767 [(match_operand:DF 2 "reg_or_fp0_operand" "fG")
2769 (match_operand:SF 3 "reg_or_fp0_operand" "fG"))]))]
2770 "TARGET_FP && alpha_tp != ALPHA_TP_INSN"
2771 "cmp%-%C1%' %R2,%R3,%0"
2772 [(set_attr "type" "fadd")
2773 (set_attr "trap" "yes")])
2776 [(set (match_operand:DF 0 "register_operand" "=&f")
2777 (match_operator:DF 1 "alpha_comparison_operator"
2779 (match_operand:SF 2 "reg_or_fp0_operand" "fG"))
2781 (match_operand:SF 3 "reg_or_fp0_operand" "fG"))]))]
2782 "TARGET_FP && alpha_tp == ALPHA_TP_INSN"
2783 "cmp%-%C1%' %R2,%R3,%0"
2784 [(set_attr "type" "fadd")
2785 (set_attr "trap" "yes")])
2788 [(set (match_operand:DF 0 "register_operand" "=f")
2789 (match_operator:DF 1 "alpha_comparison_operator"
2791 (match_operand:SF 2 "reg_or_fp0_operand" "fG"))
2793 (match_operand:SF 3 "reg_or_fp0_operand" "fG"))]))]
2794 "TARGET_FP && alpha_tp != ALPHA_TP_INSN"
2795 "cmp%-%C1%' %R2,%R3,%0"
2796 [(set_attr "type" "fadd")
2797 (set_attr "trap" "yes")])
2800 [(set (match_operand:DF 0 "register_operand" "=f,f")
2802 (match_operator 3 "signed_comparison_operator"
2803 [(match_operand:DF 4 "reg_or_fp0_operand" "fG,fG")
2804 (match_operand:DF 2 "fp0_operand" "G,G")])
2805 (match_operand:DF 1 "reg_or_fp0_operand" "fG,0")
2806 (match_operand:DF 5 "reg_or_fp0_operand" "0,fG")))]
2810 fcmov%D3 %R4,%R5,%0"
2811 [(set_attr "type" "fcmov")])
2814 [(set (match_operand:SF 0 "register_operand" "=f,f")
2816 (match_operator 3 "signed_comparison_operator"
2817 [(match_operand:DF 4 "reg_or_fp0_operand" "fG,fG")
2818 (match_operand:DF 2 "fp0_operand" "G,G")])
2819 (match_operand:SF 1 "reg_or_fp0_operand" "fG,0")
2820 (match_operand:SF 5 "reg_or_fp0_operand" "0,fG")))]
2824 fcmov%D3 %R4,%R5,%0"
2825 [(set_attr "type" "fcmov")])
2828 [(set (match_operand:DF 0 "register_operand" "=f,f")
2830 (match_operator 3 "signed_comparison_operator"
2831 [(match_operand:DF 4 "reg_or_fp0_operand" "fG,fG")
2832 (match_operand:DF 2 "fp0_operand" "G,G")])
2833 (float_extend:DF (match_operand:SF 1 "reg_or_fp0_operand" "fG,0"))
2834 (match_operand:DF 5 "reg_or_fp0_operand" "0,fG")))]
2838 fcmov%D3 %R4,%R5,%0"
2839 [(set_attr "type" "fcmov")])
2842 [(set (match_operand:DF 0 "register_operand" "=f,f")
2844 (match_operator 3 "signed_comparison_operator"
2846 (match_operand:SF 4 "reg_or_fp0_operand" "fG,fG"))
2847 (match_operand:DF 2 "fp0_operand" "G,G")])
2848 (match_operand:DF 1 "reg_or_fp0_operand" "fG,0")
2849 (match_operand:DF 5 "reg_or_fp0_operand" "0,fG")))]
2853 fcmov%D3 %R4,%R5,%0"
2854 [(set_attr "type" "fcmov")])
2857 [(set (match_operand:SF 0 "register_operand" "=f,f")
2859 (match_operator 3 "signed_comparison_operator"
2861 (match_operand:SF 4 "reg_or_fp0_operand" "fG,fG"))
2862 (match_operand:DF 2 "fp0_operand" "G,G")])
2863 (match_operand:SF 1 "reg_or_fp0_operand" "fG,0")
2864 (match_operand:SF 5 "reg_or_fp0_operand" "0,fG")))]
2868 fcmov%D3 %R4,%R5,%0"
2869 [(set_attr "type" "fcmov")])
2872 [(set (match_operand:DF 0 "register_operand" "=f,f")
2874 (match_operator 3 "signed_comparison_operator"
2876 (match_operand:SF 4 "reg_or_fp0_operand" "fG,fG"))
2877 (match_operand:DF 2 "fp0_operand" "G,G")])
2878 (float_extend:DF (match_operand:SF 1 "reg_or_fp0_operand" "fG,0"))
2879 (match_operand:DF 5 "reg_or_fp0_operand" "0,fG")))]
2883 fcmov%D3 %R4,%R5,%0"
2884 [(set_attr "type" "fcmov")])
2886 (define_expand "maxdf3"
2888 (le:DF (match_operand:DF 1 "reg_or_fp0_operand" "")
2889 (match_operand:DF 2 "reg_or_fp0_operand" "")))
2890 (set (match_operand:DF 0 "register_operand" "")
2891 (if_then_else:DF (eq (match_dup 3) (match_dup 4))
2892 (match_dup 1) (match_dup 2)))]
2895 { operands[3] = gen_reg_rtx (DFmode);
2896 operands[4] = CONST0_RTX (DFmode);
2899 (define_expand "mindf3"
2901 (lt:DF (match_operand:DF 1 "reg_or_fp0_operand" "")
2902 (match_operand:DF 2 "reg_or_fp0_operand" "")))
2903 (set (match_operand:DF 0 "register_operand" "")
2904 (if_then_else:DF (ne (match_dup 3) (match_dup 4))
2905 (match_dup 1) (match_dup 2)))]
2908 { operands[3] = gen_reg_rtx (DFmode);
2909 operands[4] = CONST0_RTX (DFmode);
2912 (define_expand "maxsf3"
2914 (le:DF (float_extend:DF (match_operand:SF 1 "reg_or_fp0_operand" ""))
2915 (float_extend:DF (match_operand:SF 2 "reg_or_fp0_operand" ""))))
2916 (set (match_operand:SF 0 "register_operand" "")
2917 (if_then_else:SF (eq (match_dup 3) (match_dup 4))
2918 (match_dup 1) (match_dup 2)))]
2921 { operands[3] = gen_reg_rtx (DFmode);
2922 operands[4] = CONST0_RTX (DFmode);
2925 (define_expand "minsf3"
2927 (lt:DF (float_extend:DF (match_operand:SF 1 "reg_or_fp0_operand" ""))
2928 (float_extend:DF (match_operand:SF 2 "reg_or_fp0_operand" ""))))
2929 (set (match_operand:SF 0 "register_operand" "")
2930 (if_then_else:SF (ne (match_dup 3) (match_dup 4))
2931 (match_dup 1) (match_dup 2)))]
2934 { operands[3] = gen_reg_rtx (DFmode);
2935 operands[4] = CONST0_RTX (DFmode);
2941 (match_operator 1 "signed_comparison_operator"
2942 [(match_operand:DF 2 "reg_or_fp0_operand" "fG")
2943 (match_operand:DF 3 "fp0_operand" "G")])
2944 (label_ref (match_operand 0 "" ""))
2948 [(set_attr "type" "fbr")])
2953 (match_operator 1 "signed_comparison_operator"
2955 (match_operand:SF 2 "reg_or_fp0_operand" "fG"))
2956 (match_operand:DF 3 "fp0_operand" "G")])
2957 (label_ref (match_operand 0 "" ""))
2961 [(set_attr "type" "fbr")])
2963 ;; These are the main define_expand's used to make conditional branches
2966 (define_expand "cmpdf"
2967 [(set (cc0) (compare (match_operand:DF 0 "reg_or_fp0_operand" "")
2968 (match_operand:DF 1 "reg_or_fp0_operand" "")))]
2972 alpha_compare_op0 = operands[0];
2973 alpha_compare_op1 = operands[1];
2974 alpha_compare_fp_p = 1;
2978 (define_expand "cmpdi"
2979 [(set (cc0) (compare (match_operand:DI 0 "reg_or_0_operand" "")
2980 (match_operand:DI 1 "reg_or_8bit_operand" "")))]
2984 alpha_compare_op0 = operands[0];
2985 alpha_compare_op1 = operands[1];
2986 alpha_compare_fp_p = 0;
2990 (define_expand "beq"
2992 (if_then_else (match_dup 1)
2993 (label_ref (match_operand 0 "" ""))
2996 "{ operands[1] = alpha_emit_conditional_branch (EQ); }")
2998 (define_expand "bne"
3000 (if_then_else (match_dup 1)
3001 (label_ref (match_operand 0 "" ""))
3004 "{ operands[1] = alpha_emit_conditional_branch (NE); }")
3006 (define_expand "blt"
3008 (if_then_else (match_dup 1)
3009 (label_ref (match_operand 0 "" ""))
3012 "{ operands[1] = alpha_emit_conditional_branch (LT); }")
3014 (define_expand "ble"
3016 (if_then_else (match_dup 1)
3017 (label_ref (match_operand 0 "" ""))
3020 "{ operands[1] = alpha_emit_conditional_branch (LE); }")
3022 (define_expand "bgt"
3024 (if_then_else (match_dup 1)
3025 (label_ref (match_operand 0 "" ""))
3028 "{ operands[1] = alpha_emit_conditional_branch (GT); }")
3030 (define_expand "bge"
3032 (if_then_else (match_dup 1)
3033 (label_ref (match_operand 0 "" ""))
3036 "{ operands[1] = alpha_emit_conditional_branch (GE); }")
3038 (define_expand "bltu"
3040 (if_then_else (match_dup 1)
3041 (label_ref (match_operand 0 "" ""))
3044 "{ operands[1] = alpha_emit_conditional_branch (LTU); }")
3046 (define_expand "bleu"
3048 (if_then_else (match_dup 1)
3049 (label_ref (match_operand 0 "" ""))
3052 "{ operands[1] = alpha_emit_conditional_branch (LEU); }")
3054 (define_expand "bgtu"
3056 (if_then_else (match_dup 1)
3057 (label_ref (match_operand 0 "" ""))
3060 "{ operands[1] = alpha_emit_conditional_branch (GTU); }")
3062 (define_expand "bgeu"
3064 (if_then_else (match_dup 1)
3065 (label_ref (match_operand 0 "" ""))
3068 "{ operands[1] = alpha_emit_conditional_branch (GEU); }")
3070 (define_expand "seq"
3071 [(set (match_operand:DI 0 "register_operand" "")
3076 if (alpha_compare_fp_p)
3079 operands[1] = gen_rtx_EQ (DImode, alpha_compare_op0, alpha_compare_op1);
3082 (define_expand "sne"
3083 [(set (match_operand:DI 0 "register_operand" "")
3085 (set (match_dup 0) (xor:DI (match_dup 0) (const_int 1)))]
3089 if (alpha_compare_fp_p)
3092 operands[1] = gen_rtx_EQ (DImode, alpha_compare_op0, alpha_compare_op1);
3095 (define_expand "slt"
3096 [(set (match_operand:DI 0 "register_operand" "")
3101 if (alpha_compare_fp_p)
3104 operands[1] = gen_rtx_LT (DImode, alpha_compare_op0, alpha_compare_op1);
3107 (define_expand "sle"
3108 [(set (match_operand:DI 0 "register_operand" "")
3113 if (alpha_compare_fp_p)
3116 operands[1] = gen_rtx_LE (DImode, alpha_compare_op0, alpha_compare_op1);
3119 (define_expand "sgt"
3120 [(set (match_operand:DI 0 "register_operand" "")
3125 if (alpha_compare_fp_p)
3128 operands[1] = gen_rtx_LT (DImode, force_reg (DImode, alpha_compare_op1),
3132 (define_expand "sge"
3133 [(set (match_operand:DI 0 "register_operand" "")
3138 if (alpha_compare_fp_p)
3141 operands[1] = gen_rtx_LE (DImode, force_reg (DImode, alpha_compare_op1),
3145 (define_expand "sltu"
3146 [(set (match_operand:DI 0 "register_operand" "")
3151 if (alpha_compare_fp_p)
3154 operands[1] = gen_rtx_LTU (DImode, alpha_compare_op0, alpha_compare_op1);
3157 (define_expand "sleu"
3158 [(set (match_operand:DI 0 "register_operand" "")
3163 if (alpha_compare_fp_p)
3166 operands[1] = gen_rtx_LEU (DImode, alpha_compare_op0, alpha_compare_op1);
3169 (define_expand "sgtu"
3170 [(set (match_operand:DI 0 "register_operand" "")
3175 if (alpha_compare_fp_p)
3178 operands[1] = gen_rtx_LTU (DImode, force_reg (DImode, alpha_compare_op1),
3182 (define_expand "sgeu"
3183 [(set (match_operand:DI 0 "register_operand" "")
3188 if (alpha_compare_fp_p)
3191 operands[1] = gen_rtx_LEU (DImode, force_reg (DImode, alpha_compare_op1),
3195 ;; These are the main define_expand's used to make conditional moves.
3197 (define_expand "movsicc"
3198 [(set (match_operand:SI 0 "register_operand" "")
3199 (if_then_else:DI (match_operand 1 "comparison_operator" "")
3200 (match_operand:SI 2 "reg_or_8bit_operand" "")
3201 (match_operand:SI 3 "reg_or_8bit_operand" "")))]
3205 if ((operands[1] = alpha_emit_conditional_move (operands[1], SImode)) == 0)
3209 (define_expand "movdicc"
3210 [(set (match_operand:DI 0 "register_operand" "")
3211 (if_then_else:DI (match_operand 1 "comparison_operator" "")
3212 (match_operand:DI 2 "reg_or_8bit_operand" "")
3213 (match_operand:DI 3 "reg_or_8bit_operand" "")))]
3217 if ((operands[1] = alpha_emit_conditional_move (operands[1], DImode)) == 0)
3221 (define_expand "movsfcc"
3222 [(set (match_operand:SF 0 "register_operand" "")
3223 (if_then_else:SF (match_operand 1 "comparison_operator" "")
3224 (match_operand:SF 2 "reg_or_8bit_operand" "")
3225 (match_operand:SF 3 "reg_or_8bit_operand" "")))]
3229 if ((operands[1] = alpha_emit_conditional_move (operands[1], SFmode)) == 0)
3233 (define_expand "movdfcc"
3234 [(set (match_operand:DF 0 "register_operand" "")
3235 (if_then_else:DF (match_operand 1 "comparison_operator" "")
3236 (match_operand:DF 2 "reg_or_8bit_operand" "")
3237 (match_operand:DF 3 "reg_or_8bit_operand" "")))]
3241 if ((operands[1] = alpha_emit_conditional_move (operands[1], DFmode)) == 0)
3245 ;; These define_split definitions are used in cases when comparisons have
3246 ;; not be stated in the correct way and we need to reverse the second
3247 ;; comparison. For example, x >= 7 has to be done as x < 6 with the
3248 ;; comparison that tests the result being reversed. We have one define_split
3249 ;; for each use of a comparison. They do not match valid insns and need
3250 ;; not generate valid insns.
3252 ;; We can also handle equality comparisons (and inequality comparisons in
3253 ;; cases where the resulting add cannot overflow) by doing an add followed by
3254 ;; a comparison with zero. This is faster since the addition takes one
3255 ;; less cycle than a compare when feeding into a conditional move.
3256 ;; For this case, we also have an SImode pattern since we can merge the add
3257 ;; and sign extend and the order doesn't matter.
3259 ;; We do not do this for floating-point, since it isn't clear how the "wrong"
3260 ;; operation could have been generated.
3263 [(set (match_operand:DI 0 "register_operand" "")
3265 (match_operator 1 "comparison_operator"
3266 [(match_operand:DI 2 "reg_or_0_operand" "")
3267 (match_operand:DI 3 "reg_or_cint_operand" "")])
3268 (match_operand:DI 4 "reg_or_cint_operand" "")
3269 (match_operand:DI 5 "reg_or_cint_operand" "")))
3270 (clobber (match_operand:DI 6 "register_operand" ""))]
3271 "operands[3] != const0_rtx"
3272 [(set (match_dup 6) (match_dup 7))
3274 (if_then_else:DI (match_dup 8) (match_dup 4) (match_dup 5)))]
3276 { enum rtx_code code = GET_CODE (operands[1]);
3277 int unsignedp = (code == GEU || code == LEU || code == GTU || code == LTU);
3279 /* If we are comparing for equality with a constant and that constant
3280 appears in the arm when the register equals the constant, use the
3281 register since that is more likely to match (and to produce better code
3284 if (code == EQ && GET_CODE (operands[3]) == CONST_INT
3285 && rtx_equal_p (operands[4], operands[3]))
3286 operands[4] = operands[2];
3288 else if (code == NE && GET_CODE (operands[3]) == CONST_INT
3289 && rtx_equal_p (operands[5], operands[3]))
3290 operands[5] = operands[2];
3292 if (code == NE || code == EQ
3293 || (extended_count (operands[2], DImode, unsignedp) >= 1
3294 && extended_count (operands[3], DImode, unsignedp) >= 1))
3296 if (GET_CODE (operands[3]) == CONST_INT)
3297 operands[7] = gen_rtx_PLUS (DImode, operands[2],
3298 GEN_INT (- INTVAL (operands[3])));
3300 operands[7] = gen_rtx_MINUS (DImode, operands[2], operands[3]);
3302 operands[8] = gen_rtx_fmt_ee (code, VOIDmode, operands[6], const0_rtx);
3305 else if (code == EQ || code == LE || code == LT
3306 || code == LEU || code == LTU)
3308 operands[7] = gen_rtx_fmt_ee (code, DImode, operands[2], operands[3]);
3309 operands[8] = gen_rtx_NE (VOIDmode, operands[6], const0_rtx);
3313 operands[7] = gen_rtx_fmt_ee (reverse_condition (code), DImode,
3314 operands[2], operands[3]);
3315 operands[8] = gen_rtx_EQ (VOIDmode, operands[6], const0_rtx);
3320 [(set (match_operand:DI 0 "register_operand" "")
3322 (match_operator 1 "comparison_operator"
3323 [(match_operand:SI 2 "reg_or_0_operand" "")
3324 (match_operand:SI 3 "reg_or_cint_operand" "")])
3325 (match_operand:DI 4 "reg_or_8bit_operand" "")
3326 (match_operand:DI 5 "reg_or_8bit_operand" "")))
3327 (clobber (match_operand:DI 6 "register_operand" ""))]
3328 "operands[3] != const0_rtx
3329 && (GET_CODE (operands[1]) == EQ || GET_CODE (operands[1]) == NE)"
3330 [(set (match_dup 6) (match_dup 7))
3332 (if_then_else:DI (match_dup 8) (match_dup 4) (match_dup 5)))]
3334 { enum rtx_code code = GET_CODE (operands[1]);
3335 int unsignedp = (code == GEU || code == LEU || code == GTU || code == LTU);
3338 if ((code != NE && code != EQ
3339 && ! (extended_count (operands[2], DImode, unsignedp) >= 1
3340 && extended_count (operands[3], DImode, unsignedp) >= 1)))
3343 if (GET_CODE (operands[3]) == CONST_INT)
3344 tem = gen_rtx_PLUS (SImode, operands[2],
3345 GEN_INT (- INTVAL (operands[3])));
3347 tem = gen_rtx_MINUS (SImode, operands[2], operands[3]);
3349 operands[7] = gen_rtx_SIGN_EXTEND (DImode, tem);
3350 operands[8] = gen_rtx_fmt_ee (GET_CODE (operands[1]), VOIDmode,
3351 operands[6], const0_rtx);
3357 (match_operator 1 "comparison_operator"
3358 [(match_operand:DI 2 "reg_or_0_operand" "")
3359 (match_operand:DI 3 "reg_or_cint_operand" "")])
3360 (label_ref (match_operand 0 "" ""))
3362 (clobber (match_operand:DI 4 "register_operand" ""))]
3363 "operands[3] != const0_rtx"
3364 [(set (match_dup 4) (match_dup 5))
3365 (set (pc) (if_then_else (match_dup 6) (label_ref (match_dup 0)) (pc)))]
3367 { enum rtx_code code = GET_CODE (operands[1]);
3368 int unsignedp = (code == GEU || code == LEU || code == GTU || code == LTU);
3370 if (code == NE || code == EQ
3371 || (extended_count (operands[2], DImode, unsignedp) >= 1
3372 && extended_count (operands[3], DImode, unsignedp) >= 1))
3374 if (GET_CODE (operands[3]) == CONST_INT)
3375 operands[5] = gen_rtx_PLUS (DImode, operands[2],
3376 GEN_INT (- INTVAL (operands[3])));
3378 operands[5] = gen_rtx_MINUS (DImode, operands[2], operands[3]);
3380 operands[6] = gen_rtx_fmt_ee (code, VOIDmode, operands[4], const0_rtx);
3383 else if (code == EQ || code == LE || code == LT
3384 || code == LEU || code == LTU)
3386 operands[5] = gen_rtx_fmt_ee (code, DImode, operands[2], operands[3]);
3387 operands[6] = gen_rtx_NE (VOIDmode, operands[4], const0_rtx);
3391 operands[5] = gen_rtx_fmt_ee (reverse_condition (code), DImode,
3392 operands[2], operands[3]);
3393 operands[6] = gen_rtx_EQ (VOIDmode, operands[4], const0_rtx);
3400 (match_operator 1 "comparison_operator"
3401 [(match_operand:SI 2 "reg_or_0_operand" "")
3402 (match_operand:SI 3 "const_int_operand" "")])
3403 (label_ref (match_operand 0 "" ""))
3405 (clobber (match_operand:DI 4 "register_operand" ""))]
3406 "operands[3] != const0_rtx
3407 && (GET_CODE (operands[1]) == EQ || GET_CODE (operands[1]) == NE)"
3408 [(set (match_dup 4) (match_dup 5))
3409 (set (pc) (if_then_else (match_dup 6) (label_ref (match_dup 0)) (pc)))]
3413 if (GET_CODE (operands[3]) == CONST_INT)
3414 tem = gen_rtx_PLUS (SImode, operands[2],
3415 GEN_INT (- INTVAL (operands[3])));
3417 tem = gen_rtx_MINUS (SImode, operands[2], operands[3]);
3419 operands[5] = gen_rtx_SIGN_EXTEND (DImode, tem);
3420 operands[6] = gen_rtx_fmt_ee (GET_CODE (operands[1]), VOIDmode,
3421 operands[4], const0_rtx);
3424 ;; We can convert such things as "a > 0xffff" to "t = a & ~ 0xffff; t != 0".
3425 ;; This eliminates one, and sometimes two, insns when the AND can be done
3428 [(set (match_operand:DI 0 "register_operand" "")
3429 (match_operator 1 "comparison_operator"
3430 [(match_operand:DI 2 "register_operand" "")
3431 (match_operand:DI 3 "const_int_operand" "")]))
3432 (clobber (match_operand:DI 4 "register_operand" ""))]
3433 "exact_log2 (INTVAL (operands[3]) + 1) >= 0
3434 && (GET_CODE (operands[1]) == GTU
3435 || GET_CODE (operands[1]) == LEU
3436 || ((GET_CODE (operands[1]) == GT || GET_CODE (operands[1]) == LE)
3437 && extended_count (operands[2], DImode, 1) > 0))"
3438 [(set (match_dup 4) (and:DI (match_dup 2) (match_dup 5)))
3439 (set (match_dup 0) (match_dup 6))]
3442 operands[5] = GEN_INT (~ INTVAL (operands[3]));
3443 operands[6] = gen_rtx_fmt_ee (((GET_CODE (operands[1]) == GTU
3444 || GET_CODE (operands[1]) == GT)
3446 DImode, operands[4], const0_rtx);
3449 ;; Here are the CALL and unconditional branch insns. Calls on NT and OSF
3450 ;; work differently, so we have different patterns for each.
3452 (define_expand "call"
3453 [(use (match_operand:DI 0 "" ""))
3454 (use (match_operand 1 "" ""))
3455 (use (match_operand 2 "" ""))
3456 (use (match_operand 3 "" ""))]
3459 { if (TARGET_WINDOWS_NT)
3460 emit_call_insn (gen_call_nt (operands[0], operands[1]));
3461 else if (TARGET_OPEN_VMS)
3462 emit_call_insn (gen_call_vms (operands[0], operands[2]));
3464 emit_call_insn (gen_call_osf (operands[0], operands[1]));
3469 (define_expand "call_osf"
3470 [(parallel [(call (mem:DI (match_operand 0 "" ""))
3471 (match_operand 1 "" ""))
3472 (clobber (reg:DI 27))
3473 (clobber (reg:DI 26))])]
3476 { if (GET_CODE (operands[0]) != MEM)
3479 operands[0] = XEXP (operands[0], 0);
3481 if (GET_CODE (operands[0]) != SYMBOL_REF
3482 && ! (GET_CODE (operands[0]) == REG && REGNO (operands[0]) == 27))
3484 rtx tem = gen_rtx_REG (DImode, 27);
3485 emit_move_insn (tem, operands[0]);
3490 (define_expand "call_nt"
3491 [(parallel [(call (mem:DI (match_operand 0 "" ""))
3492 (match_operand 1 "" ""))
3493 (clobber (reg:DI 26))])]
3496 { if (GET_CODE (operands[0]) != MEM)
3499 operands[0] = XEXP (operands[0], 0);
3500 if (GET_CODE (operands[0]) != SYMBOL_REF && GET_CODE (operands[0]) != REG)
3501 operands[0] = force_reg (DImode, operands[0]);
3505 ;; call openvms/alpha
3506 ;; op 0: symbol ref for called function
3507 ;; op 1: next_arg_reg (argument information value for R25)
3509 (define_expand "call_vms"
3510 [(parallel [(call (mem:DI (match_operand 0 "" ""))
3511 (match_operand 1 "" ""))
3515 (clobber (reg:DI 27))])]
3518 { if (GET_CODE (operands[0]) != MEM)
3521 operands[0] = XEXP (operands[0], 0);
3523 /* Always load AI with argument information, then handle symbolic and
3524 indirect call differently. Load RA and set operands[2] to PV in
3527 emit_move_insn (gen_rtx_REG (DImode, 25), operands[1]);
3528 if (GET_CODE (operands[0]) == SYMBOL_REF)
3530 extern char *savealloc ();
3531 char *linksym, *symbol = XSTR (operands[0], 0);
3536 linksym = savealloc (strlen (symbol) + 6);
3538 alpha_need_linkage (symbol, 0);
3541 strcpy (linksym+1, symbol);
3542 strcat (linksym, \"..lk\");
3543 linkage = gen_rtx_SYMBOL_REF (Pmode, linksym);
3545 emit_move_insn (gen_rtx_REG (Pmode, 26), gen_rtx_MEM (Pmode, linkage));
3548 = validize_mem (gen_rtx_MEM (Pmode, plus_constant (linkage, 8)));
3552 emit_move_insn (gen_rtx_REG (Pmode, 26),
3553 gen_rtx_MEM (Pmode, plus_constant (operands[0], 8)));
3555 operands[2] = operands[0];
3560 (define_expand "call_value"
3561 [(use (match_operand 0 "" ""))
3562 (use (match_operand:DI 1 "" ""))
3563 (use (match_operand 2 "" ""))
3564 (use (match_operand 3 "" ""))
3565 (use (match_operand 4 "" ""))]
3568 { if (TARGET_WINDOWS_NT)
3569 emit_call_insn (gen_call_value_nt (operands[0], operands[1], operands[2]));
3570 else if (TARGET_OPEN_VMS)
3571 emit_call_insn (gen_call_value_vms (operands[0], operands[1],
3574 emit_call_insn (gen_call_value_osf (operands[0], operands[1],
3579 (define_expand "call_value_osf"
3580 [(parallel [(set (match_operand 0 "" "")
3581 (call (mem:DI (match_operand 1 "" ""))
3582 (match_operand 2 "" "")))
3583 (clobber (reg:DI 27))
3584 (clobber (reg:DI 26))])]
3587 { if (GET_CODE (operands[1]) != MEM)
3590 operands[1] = XEXP (operands[1], 0);
3592 if (GET_CODE (operands[1]) != SYMBOL_REF
3593 && ! (GET_CODE (operands[1]) == REG && REGNO (operands[1]) == 27))
3595 rtx tem = gen_rtx_REG (DImode, 27);
3596 emit_move_insn (tem, operands[1]);
3601 (define_expand "call_value_nt"
3602 [(parallel [(set (match_operand 0 "" "")
3603 (call (mem:DI (match_operand 1 "" ""))
3604 (match_operand 2 "" "")))
3605 (clobber (reg:DI 26))])]
3608 { if (GET_CODE (operands[1]) != MEM)
3611 operands[1] = XEXP (operands[1], 0);
3612 if (GET_CODE (operands[0]) != SYMBOL_REF && GET_CODE (operands[0]) != REG)
3613 operands[1] = force_reg (DImode, operands[1]);
3616 (define_expand "call_value_vms"
3617 [(parallel [(set (match_operand 0 "" "")
3618 (call (mem:DI (match_operand:DI 1 "" ""))
3619 (match_operand 2 "" "")))
3623 (clobber (reg:DI 27))])]
3626 { if (GET_CODE (operands[1]) != MEM)
3629 operands[1] = XEXP (operands[1], 0);
3631 /* Always load AI with argument information, then handle symbolic and
3632 indirect call differently. Load RA and set operands[3] to PV in
3635 emit_move_insn (gen_rtx_REG (DImode, 25), operands[2]);
3636 if (GET_CODE (operands[1]) == SYMBOL_REF)
3638 extern char *savealloc ();
3639 char *linksym, *symbol = XSTR (operands[1], 0);
3644 linksym = savealloc (strlen (symbol) + 6);
3646 alpha_need_linkage (symbol, 0);
3648 strcpy (linksym+1, symbol);
3649 strcat (linksym, \"..lk\");
3650 linkage = gen_rtx_SYMBOL_REF (Pmode, linksym);
3652 emit_move_insn (gen_rtx_REG (Pmode, 26), gen_rtx_MEM (Pmode, linkage));
3655 = validize_mem (gen_rtx_MEM (Pmode, plus_constant (linkage, 8)));
3659 emit_move_insn (gen_rtx_REG (Pmode, 26),
3660 gen_rtx_MEM (Pmode, plus_constant (operands[1], 8)));
3662 operands[3] = operands[1];
3667 [(call (mem:DI (match_operand:DI 0 "call_operand" "r,R,i"))
3668 (match_operand 1 "" ""))
3669 (clobber (reg:DI 27))
3670 (clobber (reg:DI 26))]
3671 "! TARGET_WINDOWS_NT && ! TARGET_OPEN_VMS"
3673 jsr $26,($27),0\;ldgp $29,0($26)
3675 jsr $26,%0\;ldgp $29,0($26)"
3676 [(set_attr "type" "jsr")
3677 (set_attr "length" "12,*,12")])
3680 [(call (mem:DI (match_operand:DI 0 "call_operand" "r,R,i"))
3681 (match_operand 1 "" ""))
3682 (clobber (reg:DI 26))]
3688 [(set_attr "type" "jsr")
3689 (set_attr "length" "*,*,12")])
3692 [(call (mem:DI (match_operand:DI 0 "call_operand" "r,i"))
3693 (match_operand 1 "" ""))
3694 (use (match_operand:DI 2 "general_operand" "r,m"))
3697 (clobber (reg:DI 27))]
3700 bis %2,%2,$27\;jsr $26,0\;ldq $27,0($29)
3701 ldq $27,%2\;jsr $26,%0\;ldq $27,0($29)"
3702 [(set_attr "type" "jsr")
3703 (set_attr "length" "12,16")])
3706 [(set (match_operand 0 "register_operand" "=rf,rf,rf")
3707 (call (mem:DI (match_operand:DI 1 "call_operand" "r,R,i"))
3708 (match_operand 2 "" "")))
3709 (clobber (reg:DI 27))
3710 (clobber (reg:DI 26))]
3711 "! TARGET_WINDOWS_NT && ! TARGET_OPEN_VMS"
3713 jsr $26,($27),0\;ldgp $29,0($26)
3715 jsr $26,%1\;ldgp $29,0($26)"
3716 [(set_attr "type" "jsr")
3717 (set_attr "length" "12,*,12")])
3720 [(set (match_operand 0 "register_operand" "=rf,rf,rf")
3721 (call (mem:DI (match_operand:DI 1 "call_operand" "r,R,i"))
3722 (match_operand 2 "" "")))
3723 (clobber (reg:DI 26))]
3729 [(set_attr "type" "jsr")
3730 (set_attr "length" "*,*,12")])
3733 [(set (match_operand 0 "register_operand" "")
3734 (call (mem:DI (match_operand:DI 1 "call_operand" "r,i"))
3735 (match_operand 2 "" "")))
3736 (use (match_operand:DI 3 "general_operand" "r,m"))
3739 (clobber (reg:DI 27))]
3742 bis %3,%3,$27\;jsr $26,0\;ldq $27,0($29)
3743 ldq $27,%3\;jsr $26,%1\;ldq $27,0($29)"
3744 [(set_attr "type" "jsr")
3745 (set_attr "length" "12,16")])
3747 ;; Call subroutine returning any type.
3749 (define_expand "untyped_call"
3750 [(parallel [(call (match_operand 0 "" "")
3752 (match_operand 1 "" "")
3753 (match_operand 2 "" "")])]
3759 emit_call_insn (gen_call (operands[0], const0_rtx, NULL, const0_rtx));
3761 for (i = 0; i < XVECLEN (operands[2], 0); i++)
3763 rtx set = XVECEXP (operands[2], 0, i);
3764 emit_move_insn (SET_DEST (set), SET_SRC (set));
3767 /* The optimizer does not know that the call sets the function value
3768 registers we stored in the result block. We avoid problems by
3769 claiming that all hard registers are used and clobbered at this
3771 emit_insn (gen_blockage ());
3776 ;; UNSPEC_VOLATILE is considered to use and clobber all hard registers and
3777 ;; all of memory. This blocks insns from being moved across this point.
3779 (define_insn "blockage"
3780 [(unspec_volatile [(const_int 0)] 1)]
3783 [(set_attr "length" "0")])
3787 (label_ref (match_operand 0 "" "")))]
3790 [(set_attr "type" "ibr")])
3792 (define_insn "return"
3796 [(set_attr "type" "ibr")])
3798 ;; Use a different pattern for functions which have non-trivial
3799 ;; epilogues so as not to confuse jump and reorg.
3800 (define_insn "return_internal"
3805 [(set_attr "type" "ibr")])
3807 (define_insn "indirect_jump"
3808 [(set (pc) (match_operand:DI 0 "register_operand" "r"))]
3811 [(set_attr "type" "ibr")])
3817 [(set_attr "type" "ilog")])
3819 (define_expand "tablejump"
3820 [(use (match_operand:SI 0 "register_operand" ""))
3821 (use (match_operand:SI 1 "" ""))]
3825 if (TARGET_WINDOWS_NT)
3826 emit_jump_insn (gen_tablejump_nt (operands[0], operands[1]));
3827 else if (TARGET_OPEN_VMS)
3828 emit_jump_insn (gen_tablejump_vms (operands[0], operands[1]));
3830 emit_jump_insn (gen_tablejump_osf (operands[0], operands[1]));
3835 (define_expand "tablejump_osf"
3837 (sign_extend:DI (match_operand:SI 0 "register_operand" "")))
3838 (parallel [(set (pc)
3839 (plus:DI (match_dup 3)
3840 (label_ref:DI (match_operand 1 "" ""))))
3841 (clobber (match_scratch:DI 2 "=r"))])]
3844 { operands[3] = gen_reg_rtx (DImode); }")
3846 (define_expand "tablejump_nt"
3848 (sign_extend:DI (match_operand:SI 0 "register_operand" "")))
3849 (parallel [(set (pc)
3851 (use (label_ref (match_operand 1 "" "")))])]
3854 { operands[3] = gen_reg_rtx (DImode); }")
3857 ;; tablejump, openVMS way
3859 ;; op 1: label preceding jump-table
3861 (define_expand "tablejump_vms"
3863 (match_operand:DI 0 "register_operand" ""))
3865 (plus:DI (match_dup 2)
3866 (label_ref:DI (match_operand 1 "" ""))))]
3869 { operands[2] = gen_reg_rtx (DImode); }")
3873 (plus:DI (match_operand:DI 0 "register_operand" "r")
3874 (label_ref:DI (match_operand 1 "" ""))))
3875 (clobber (match_scratch:DI 2 "=r"))]
3876 "! TARGET_WINDOWS_NT && ! TARGET_OPEN_VMS && next_active_insn (insn) != 0
3877 && GET_CODE (PATTERN (next_active_insn (insn))) == ADDR_DIFF_VEC
3878 && PREV_INSN (next_active_insn (insn)) == operands[1]"
3880 { rtx best_label = 0;
3881 rtx jump_table_insn = next_active_insn (operands[1]);
3883 if (GET_CODE (jump_table_insn) == JUMP_INSN
3884 && GET_CODE (PATTERN (jump_table_insn)) == ADDR_DIFF_VEC)
3886 rtx jump_table = PATTERN (jump_table_insn);
3887 int n_labels = XVECLEN (jump_table, 1);
3888 int best_count = -1;
3891 for (i = 0; i < n_labels; i++)
3895 for (j = i + 1; j < n_labels; j++)
3896 if (XEXP (XVECEXP (jump_table, 1, i), 0)
3897 == XEXP (XVECEXP (jump_table, 1, j), 0))
3900 if (count > best_count)
3901 best_count = count, best_label = XVECEXP (jump_table, 1, i);
3907 operands[3] = best_label;
3908 return \"addq %0,$29,%2\;jmp $31,(%2),%3\";
3911 return \"addq %0,$29,%2\;jmp $31,(%2),0\";
3913 [(set_attr "type" "ibr")
3914 (set_attr "length" "8")])
3918 (match_operand:DI 0 "register_operand" "r"))
3919 (use (label_ref (match_operand 1 "" "")))]
3920 "TARGET_WINDOWS_NT && next_active_insn (insn) != 0
3921 && GET_CODE (PATTERN (next_active_insn (insn))) == ADDR_DIFF_VEC
3922 && PREV_INSN (next_active_insn (insn)) == operands[1]"
3924 { rtx best_label = 0;
3925 rtx jump_table_insn = next_active_insn (operands[1]);
3927 if (GET_CODE (jump_table_insn) == JUMP_INSN
3928 && GET_CODE (PATTERN (jump_table_insn)) == ADDR_DIFF_VEC)
3930 rtx jump_table = PATTERN (jump_table_insn);
3931 int n_labels = XVECLEN (jump_table, 1);
3932 int best_count = -1;
3935 for (i = 0; i < n_labels; i++)
3939 for (j = i + 1; j < n_labels; j++)
3940 if (XEXP (XVECEXP (jump_table, 1, i), 0)
3941 == XEXP (XVECEXP (jump_table, 1, j), 0))
3944 if (count > best_count)
3945 best_count = count, best_label = XVECEXP (jump_table, 1, i);
3951 operands[2] = best_label;
3952 return \"jmp $31,(%0),%2\";
3955 return \"jmp $31,(%0),0\";
3957 [(set_attr "type" "ibr")])
3960 ;; op 0 is table offset
3961 ;; op 1 is table label
3966 (plus:DI (match_operand 0 "register_operand" "r")
3967 (label_ref (match_operand 1 "" ""))))]
3970 [(set_attr "type" "ibr")])
3972 ;; Cache flush. Used by INITIALIZE_TRAMPOLINE. 0x86 is PAL_imb, but we don't
3973 ;; want to have to include pal.h in our .s file.
3975 ;; Technically the type for call_pal is jsr, but we use that for determining
3976 ;; if we need a GP. Use ibr instead since it has the same EV5 scheduling
3979 [(unspec_volatile [(const_int 0)] 0)]
3982 [(set_attr "type" "ibr")])
3984 ;; Finally, we have the basic data motion insns. The byte and word insns
3985 ;; are done via define_expand. Start with the floating-point insns, since
3986 ;; they are simpler.
3989 [(set (match_operand:SF 0 "nonimmediate_operand" "=r,r,m,f,f,f,m")
3990 (match_operand:SF 1 "input_operand" "rG,m,rG,f,G,m,fG"))]
3992 && (register_operand (operands[0], SFmode)
3993 || reg_or_fp0_operand (operands[1], SFmode))"
4002 [(set_attr "type" "ilog,ild,ist,fcpys,fcpys,fld,fst")])
4005 [(set (match_operand:SF 0 "nonimmediate_operand" "=r,r,m,f,f,f,m,f,*r")
4006 (match_operand:SF 1 "input_operand" "rG,m,rG,f,G,m,fG,r,*f"))]
4008 && (register_operand (operands[0], SFmode)
4009 || reg_or_fp0_operand (operands[1], SFmode))"
4020 [(set_attr "type" "ilog,ild,ist,fcpys,fcpys,fld,fst,itof,ftoi")])
4023 [(set (match_operand:DF 0 "nonimmediate_operand" "=r,r,m,f,f,f,m")
4024 (match_operand:DF 1 "input_operand" "rG,m,rG,f,G,m,fG"))]
4026 && (register_operand (operands[0], DFmode)
4027 || reg_or_fp0_operand (operands[1], DFmode))"
4036 [(set_attr "type" "ilog,ild,ist,fcpys,fcpys,fld,fst")])
4039 [(set (match_operand:DF 0 "nonimmediate_operand" "=r,r,m,f,f,f,m,f,*r")
4040 (match_operand:DF 1 "input_operand" "rG,m,rG,f,G,m,fG,r,*f"))]
4042 && (register_operand (operands[0], DFmode)
4043 || reg_or_fp0_operand (operands[1], DFmode))"
4054 [(set_attr "type" "ilog,ild,ist,fcpys,fcpys,fld,fst,itof,ftoi")])
4056 (define_expand "movsf"
4057 [(set (match_operand:SF 0 "nonimmediate_operand" "")
4058 (match_operand:SF 1 "general_operand" ""))]
4062 if (GET_CODE (operands[0]) == MEM
4063 && ! reg_or_fp0_operand (operands[1], SFmode))
4064 operands[1] = force_reg (SFmode, operands[1]);
4067 (define_expand "movdf"
4068 [(set (match_operand:DF 0 "nonimmediate_operand" "")
4069 (match_operand:DF 1 "general_operand" ""))]
4073 if (GET_CODE (operands[0]) == MEM
4074 && ! reg_or_fp0_operand (operands[1], DFmode))
4075 operands[1] = force_reg (DFmode, operands[1]);
4079 [(set (match_operand:SI 0 "nonimmediate_operand" "=r,r,r,r,r,r,m,f,f,f,m")
4080 (match_operand:SI 1 "input_operand" "r,J,I,K,L,m,rJ,f,J,m,fG"))]
4081 "! TARGET_WINDOWS_NT && ! TARGET_OPEN_VMS && ! TARGET_CIX
4082 && (register_operand (operands[0], SImode)
4083 || reg_or_0_operand (operands[1], SImode))"
4096 [(set_attr "type" "ilog,ilog,ilog,iadd,iadd,ild,ist,fcpys,fcpys,fld,fst")])
4099 [(set (match_operand:SI 0 "nonimmediate_operand" "=r,r,r,r,r,r,m,f,f,f,m,r,*f")
4100 (match_operand:SI 1 "input_operand" "r,J,I,K,L,m,rJ,f,J,m,fG,f,*r"))]
4101 "! TARGET_WINDOWS_NT && ! TARGET_OPEN_VMS && TARGET_CIX
4102 && (register_operand (operands[0], SImode)
4103 || reg_or_0_operand (operands[1], SImode))"
4118 [(set_attr "type" "ilog,ilog,ilog,iadd,iadd,ild,ist,fcpys,fcpys,fld,fst,ftoi,itof")])
4121 [(set (match_operand:SI 0 "nonimmediate_operand" "=r,r,r,r,r,r,r,m,f,f,f,m")
4122 (match_operand:SI 1 "input_operand" "r,J,I,K,L,s,m,rJ,f,J,m,fG"))]
4123 "(TARGET_WINDOWS_NT || TARGET_OPEN_VMS)
4124 && (register_operand (operands[0], SImode)
4125 || reg_or_0_operand (operands[1], SImode))"
4139 [(set_attr "type" "ilog,ilog,ilog,iadd,iadd,ldsym,ild,ist,fcpys,fcpys,fld,fst")])
4142 [(set (match_operand:HI 0 "nonimmediate_operand" "=r,r,r,r,f,f")
4143 (match_operand:HI 1 "input_operand" "r,J,I,n,f,J"))]
4145 && (register_operand (operands[0], HImode)
4146 || register_operand (operands[1], HImode))"
4154 [(set_attr "type" "ilog,ilog,ilog,iadd,fcpys,fcpys")])
4157 [(set (match_operand:HI 0 "nonimmediate_operand" "=r,r,r,r,r,m,f,f")
4158 (match_operand:HI 1 "input_operand" "r,J,I,n,m,rJ,f,J"))]
4160 && (register_operand (operands[0], HImode)
4161 || reg_or_0_operand (operands[1], HImode))"
4171 [(set_attr "type" "ilog,ilog,ilog,iadd,ild,ist,fcpys,fcpys")])
4174 [(set (match_operand:QI 0 "nonimmediate_operand" "=r,r,r,r,f,f")
4175 (match_operand:QI 1 "input_operand" "r,J,I,n,f,J"))]
4177 && (register_operand (operands[0], QImode)
4178 || register_operand (operands[1], QImode))"
4186 [(set_attr "type" "ilog,ilog,ilog,iadd,fcpys,fcpys")])
4189 [(set (match_operand:QI 0 "nonimmediate_operand" "=r,r,r,r,r,m,f,f")
4190 (match_operand:QI 1 "input_operand" "r,J,I,n,m,rJ,f,J"))]
4192 && (register_operand (operands[0], QImode)
4193 || reg_or_0_operand (operands[1], QImode))"
4203 [(set_attr "type" "ilog,ilog,ilog,iadd,ild,ist,fcpys,fcpys")])
4205 ;; We do two major things here: handle mem->mem and construct long
4208 (define_expand "movsi"
4209 [(set (match_operand:SI 0 "general_operand" "")
4210 (match_operand:SI 1 "general_operand" ""))]
4214 if (GET_CODE (operands[0]) == MEM
4215 && ! reg_or_0_operand (operands[1], SImode))
4216 operands[1] = force_reg (SImode, operands[1]);
4218 if (! CONSTANT_P (operands[1]) || input_operand (operands[1], SImode))
4220 else if (GET_CODE (operands[1]) == CONST_INT)
4223 = alpha_emit_set_const (operands[0], SImode, INTVAL (operands[1]), 3);
4224 if (rtx_equal_p (operands[0], operands[1]))
4229 ;; Split a load of a large constant into the appropriate two-insn
4233 [(set (match_operand:SI 0 "register_operand" "")
4234 (match_operand:SI 1 "const_int_operand" ""))]
4235 "! add_operand (operands[1], SImode)"
4236 [(set (match_dup 0) (match_dup 2))
4237 (set (match_dup 0) (plus:SI (match_dup 0) (match_dup 3)))]
4240 = alpha_emit_set_const (operands[0], SImode, INTVAL (operands[1]), 2);
4242 if (tem == operands[0])
4249 [(set (match_operand:DI 0 "general_operand" "=r,r,r,r,r,r,r,m,f,f,f,Q")
4250 (match_operand:DI 1 "input_operand" "r,J,I,K,L,s,m,rJ,f,J,Q,fG"))]
4252 && (register_operand (operands[0], DImode)
4253 || reg_or_0_operand (operands[1], DImode))"
4267 [(set_attr "type" "ilog,ilog,ilog,iadd,iadd,ldsym,ild,ist,fcpys,fcpys,fld,fst")])
4270 [(set (match_operand:DI 0 "general_operand" "=r,r,r,r,r,r,r,m,f,f,f,Q,r,*f")
4271 (match_operand:DI 1 "input_operand" "r,J,I,K,L,s,m,rJ,f,J,Q,fG,f,*r"))]
4273 && (register_operand (operands[0], DImode)
4274 || reg_or_0_operand (operands[1], DImode))"
4290 [(set_attr "type" "ilog,ilog,ilog,iadd,iadd,ldsym,ild,ist,fcpys,fcpys,fld,fst,ftoi,itof")])
4292 ;; We do three major things here: handle mem->mem, put 64-bit constants in
4293 ;; memory, and construct long 32-bit constants.
4295 (define_expand "movdi"
4296 [(set (match_operand:DI 0 "general_operand" "")
4297 (match_operand:DI 1 "general_operand" ""))]
4303 if (GET_CODE (operands[0]) == MEM
4304 && ! reg_or_0_operand (operands[1], DImode))
4305 operands[1] = force_reg (DImode, operands[1]);
4307 if (! CONSTANT_P (operands[1]) || input_operand (operands[1], DImode))
4309 else if (GET_CODE (operands[1]) == CONST_INT
4310 && (tem = alpha_emit_set_const (operands[0], DImode,
4311 INTVAL (operands[1]), 3)) != 0)
4313 if (rtx_equal_p (tem, operands[0]))
4318 else if (CONSTANT_P (operands[1]))
4320 if (TARGET_BUILD_CONSTANTS)
4322 #if HOST_BITS_PER_WIDE_INT == 64
4325 if (GET_CODE (operands[1]) == CONST_INT)
4326 i = INTVAL (operands[1]);
4327 else if (GET_CODE (operands[1]) == CONST_DOUBLE)
4328 i = CONST_DOUBLE_LOW (operands[1]);
4332 tem = alpha_emit_set_long_const (operands[0], i);
4333 if (rtx_equal_p (tem, operands[0]))
4343 operands[1] = force_const_mem (DImode, operands[1]);
4344 if (reload_in_progress)
4346 emit_move_insn (operands[0], XEXP (operands[1], 0));
4347 operands[1] = copy_rtx (operands[1]);
4348 XEXP (operands[1], 0) = operands[0];
4351 operands[1] = validize_mem (operands[1]);
4358 ;; Split a load of a large constant into the appropriate two-insn
4362 [(set (match_operand:DI 0 "register_operand" "")
4363 (match_operand:DI 1 "const_int_operand" ""))]
4364 "! add_operand (operands[1], DImode)"
4365 [(set (match_dup 0) (match_dup 2))
4366 (set (match_dup 0) (plus:DI (match_dup 0) (match_dup 3)))]
4369 = alpha_emit_set_const (operands[0], DImode, INTVAL (operands[1]), 2);
4371 if (tem == operands[0])
4377 ;; These are the partial-word cases.
4379 ;; First we have the code to load an aligned word. Operand 0 is the register
4380 ;; in which to place the result. It's mode is QImode or HImode. Operand 1
4381 ;; is an SImode MEM at the low-order byte of the proper word. Operand 2 is the
4382 ;; number of bits within the word that the value is. Operand 3 is an SImode
4383 ;; scratch register. If operand 0 is a hard register, operand 3 may be the
4384 ;; same register. It is allowed to conflict with operand 1 as well.
4386 (define_expand "aligned_loadqi"
4387 [(set (match_operand:SI 3 "register_operand" "")
4388 (match_operand:SI 1 "memory_operand" ""))
4389 (set (subreg:DI (match_operand:QI 0 "register_operand" "") 0)
4390 (zero_extract:DI (subreg:DI (match_dup 3) 0)
4392 (match_operand:DI 2 "const_int_operand" "")))]
4397 (define_expand "aligned_loadhi"
4398 [(set (match_operand:SI 3 "register_operand" "")
4399 (match_operand:SI 1 "memory_operand" ""))
4400 (set (subreg:DI (match_operand:HI 0 "register_operand" "") 0)
4401 (zero_extract:DI (subreg:DI (match_dup 3) 0)
4403 (match_operand:DI 2 "const_int_operand" "")))]
4408 ;; Similar for unaligned loads, where we use the sequence from the
4409 ;; Alpha Architecture manual.
4411 ;; Operand 1 is the address. Operands 2 and 3 are temporaries, where
4412 ;; operand 3 can overlap the input and output registers.
4414 (define_expand "unaligned_loadqi"
4415 [(set (match_operand:DI 2 "register_operand" "")
4416 (mem:DI (and:DI (match_operand:DI 1 "address_operand" "")
4418 (set (match_operand:DI 3 "register_operand" "")
4420 (set (subreg:DI (match_operand:QI 0 "register_operand" "") 0)
4421 (zero_extract:DI (match_dup 2)
4423 (ashift:DI (match_dup 3) (const_int 3))))]
4427 (define_expand "unaligned_loadhi"
4428 [(set (match_operand:DI 2 "register_operand" "")
4429 (mem:DI (and:DI (match_operand:DI 1 "address_operand" "")
4431 (set (match_operand:DI 3 "register_operand" "")
4433 (set (subreg:DI (match_operand:QI 0 "register_operand" "") 0)
4434 (zero_extract:DI (match_dup 2)
4436 (ashift:DI (match_dup 3) (const_int 3))))]
4440 ;; Storing an aligned byte or word requires two temporaries. Operand 0 is the
4441 ;; aligned SImode MEM. Operand 1 is the register containing the
4442 ;; byte or word to store. Operand 2 is the number of bits within the word that
4443 ;; the value should be placed. Operands 3 and 4 are SImode temporaries.
4445 (define_expand "aligned_store"
4446 [(set (match_operand:SI 3 "register_operand" "")
4447 (match_operand:SI 0 "memory_operand" ""))
4448 (set (subreg:DI (match_dup 3) 0)
4449 (and:DI (subreg:DI (match_dup 3) 0) (match_dup 5)))
4450 (set (subreg:DI (match_operand:SI 4 "register_operand" "") 0)
4451 (ashift:DI (zero_extend:DI (match_operand 1 "register_operand" ""))
4452 (match_operand:DI 2 "const_int_operand" "")))
4453 (set (subreg:DI (match_dup 4) 0)
4454 (ior:DI (subreg:DI (match_dup 4) 0) (subreg:DI (match_dup 3) 0)))
4455 (set (match_dup 0) (match_dup 4))]
4458 { operands[5] = GEN_INT (~ (GET_MODE_MASK (GET_MODE (operands[1]))
4459 << INTVAL (operands[2])));
4462 ;; For the unaligned byte and halfword cases, we use code similar to that
4463 ;; in the ;; Architecture book, but reordered to lower the number of registers
4464 ;; required. Operand 0 is the address. Operand 1 is the data to store.
4465 ;; Operands 2, 3, and 4 are DImode temporaries, where operands 2 and 4 may
4466 ;; be the same temporary, if desired. If the address is in a register,
4467 ;; operand 2 can be that register.
4469 (define_expand "unaligned_storeqi"
4470 [(set (match_operand:DI 3 "register_operand" "")
4471 (mem:DI (and:DI (match_operand:DI 0 "address_operand" "")
4473 (set (match_operand:DI 2 "register_operand" "")
4476 (and:DI (not:DI (ashift:DI (const_int 255)
4477 (ashift:DI (match_dup 2) (const_int 3))))
4479 (set (match_operand:DI 4 "register_operand" "")
4480 (ashift:DI (zero_extend:DI (match_operand:QI 1 "register_operand" ""))
4481 (ashift:DI (match_dup 2) (const_int 3))))
4482 (set (match_dup 4) (ior:DI (match_dup 4) (match_dup 3)))
4483 (set (mem:DI (and:DI (match_dup 0) (const_int -8)))
4488 (define_expand "unaligned_storehi"
4489 [(set (match_operand:DI 3 "register_operand" "")
4490 (mem:DI (and:DI (match_operand:DI 0 "address_operand" "")
4492 (set (match_operand:DI 2 "register_operand" "")
4495 (and:DI (not:DI (ashift:DI (const_int 65535)
4496 (ashift:DI (match_dup 2) (const_int 3))))
4498 (set (match_operand:DI 4 "register_operand" "")
4499 (ashift:DI (zero_extend:DI (match_operand:HI 1 "register_operand" ""))
4500 (ashift:DI (match_dup 2) (const_int 3))))
4501 (set (match_dup 4) (ior:DI (match_dup 4) (match_dup 3)))
4502 (set (mem:DI (and:DI (match_dup 0) (const_int -8)))
4507 ;; Here are the define_expand's for QI and HI moves that use the above
4508 ;; patterns. We have the normal sets, plus the ones that need scratch
4509 ;; registers for reload.
4511 (define_expand "movqi"
4512 [(set (match_operand:QI 0 "general_operand" "")
4513 (match_operand:QI 1 "general_operand" ""))]
4519 if (GET_CODE (operands[0]) == MEM
4520 && ! reg_or_0_operand (operands[1], QImode))
4521 operands[1] = force_reg (QImode, operands[1]);
4523 if (GET_CODE (operands[1]) == CONST_INT
4524 && ! input_operand (operands[1], QImode))
4526 operands[1] = alpha_emit_set_const (operands[0], QImode,
4527 INTVAL (operands[1]), 3);
4529 if (rtx_equal_p (operands[0], operands[1]))
4536 /* If the output is not a register, the input must be. */
4537 if (GET_CODE (operands[0]) == MEM)
4538 operands[1] = force_reg (QImode, operands[1]);
4540 /* Handle four memory cases, unaligned and aligned for either the input
4541 or the output. The only case where we can be called during reload is
4542 for aligned loads; all other cases require temporaries. */
4544 if (GET_CODE (operands[1]) == MEM
4545 || (GET_CODE (operands[1]) == SUBREG
4546 && GET_CODE (SUBREG_REG (operands[1])) == MEM)
4547 || (reload_in_progress && GET_CODE (operands[1]) == REG
4548 && REGNO (operands[1]) >= FIRST_PSEUDO_REGISTER)
4549 || (reload_in_progress && GET_CODE (operands[1]) == SUBREG
4550 && GET_CODE (SUBREG_REG (operands[1])) == REG
4551 && REGNO (SUBREG_REG (operands[1])) >= FIRST_PSEUDO_REGISTER))
4553 if (aligned_memory_operand (operands[1], QImode))
4555 rtx aligned_mem, bitnum;
4556 rtx scratch = (reload_in_progress
4557 ? gen_rtx_REG (SImode, REGNO (operands[0]))
4558 : gen_reg_rtx (SImode));
4560 get_aligned_mem (operands[1], &aligned_mem, &bitnum);
4562 emit_insn (gen_aligned_loadqi (operands[0], aligned_mem, bitnum,
4567 /* Don't pass these as parameters since that makes the generated
4568 code depend on parameter evaluation order which will cause
4569 bootstrap failures. */
4571 rtx temp1 = gen_reg_rtx (DImode);
4572 rtx temp2 = gen_reg_rtx (DImode);
4574 = gen_unaligned_loadqi (operands[0],
4575 get_unaligned_address (operands[1], 0),
4578 alpha_set_memflags (seq, operands[1]);
4585 else if (GET_CODE (operands[0]) == MEM
4586 || (GET_CODE (operands[0]) == SUBREG
4587 && GET_CODE (SUBREG_REG (operands[0])) == MEM)
4588 || (reload_in_progress && GET_CODE (operands[0]) == REG
4589 && REGNO (operands[0]) >= FIRST_PSEUDO_REGISTER)
4590 || (reload_in_progress && GET_CODE (operands[0]) == SUBREG
4591 && GET_CODE (SUBREG_REG (operands[0])) == REG
4592 && REGNO (operands[0]) >= FIRST_PSEUDO_REGISTER))
4594 if (aligned_memory_operand (operands[0], QImode))
4596 rtx aligned_mem, bitnum;
4597 rtx temp1 = gen_reg_rtx (SImode);
4598 rtx temp2 = gen_reg_rtx (SImode);
4600 get_aligned_mem (operands[0], &aligned_mem, &bitnum);
4602 emit_insn (gen_aligned_store (aligned_mem, operands[1], bitnum,
4607 rtx temp1 = gen_reg_rtx (DImode);
4608 rtx temp2 = gen_reg_rtx (DImode);
4609 rtx temp3 = gen_reg_rtx (DImode);
4611 = gen_unaligned_storeqi (get_unaligned_address (operands[0], 0),
4612 operands[1], temp1, temp2, temp3);
4614 alpha_set_memflags (seq, operands[0]);
4622 (define_expand "movhi"
4623 [(set (match_operand:HI 0 "general_operand" "")
4624 (match_operand:HI 1 "general_operand" ""))]
4630 if (GET_CODE (operands[0]) == MEM
4631 && ! reg_or_0_operand (operands[1], HImode))
4632 operands[1] = force_reg (HImode, operands[1]);
4634 if (GET_CODE (operands[1]) == CONST_INT
4635 && ! input_operand (operands[1], HImode))
4637 operands[1] = alpha_emit_set_const (operands[0], HImode,
4638 INTVAL (operands[1]), 3);
4640 if (rtx_equal_p (operands[0], operands[1]))
4647 /* If the output is not a register, the input must be. */
4648 if (GET_CODE (operands[0]) == MEM)
4649 operands[1] = force_reg (HImode, operands[1]);
4651 /* Handle four memory cases, unaligned and aligned for either the input
4652 or the output. The only case where we can be called during reload is
4653 for aligned loads; all other cases require temporaries. */
4655 if (GET_CODE (operands[1]) == MEM
4656 || (GET_CODE (operands[1]) == SUBREG
4657 && GET_CODE (SUBREG_REG (operands[1])) == MEM)
4658 || (reload_in_progress && GET_CODE (operands[1]) == REG
4659 && REGNO (operands[1]) >= FIRST_PSEUDO_REGISTER)
4660 || (reload_in_progress && GET_CODE (operands[1]) == SUBREG
4661 && GET_CODE (SUBREG_REG (operands[1])) == REG
4662 && REGNO (SUBREG_REG (operands[1])) >= FIRST_PSEUDO_REGISTER))
4664 if (aligned_memory_operand (operands[1], HImode))
4666 rtx aligned_mem, bitnum;
4667 rtx scratch = (reload_in_progress
4668 ? gen_rtx_REG (SImode, REGNO (operands[0]))
4669 : gen_reg_rtx (SImode));
4671 get_aligned_mem (operands[1], &aligned_mem, &bitnum);
4673 emit_insn (gen_aligned_loadhi (operands[0], aligned_mem, bitnum,
4678 /* Don't pass these as parameters since that makes the generated
4679 code depend on parameter evaluation order which will cause
4680 bootstrap failures. */
4682 rtx temp1 = gen_reg_rtx (DImode);
4683 rtx temp2 = gen_reg_rtx (DImode);
4685 = gen_unaligned_loadhi (operands[0],
4686 get_unaligned_address (operands[1], 0),
4689 alpha_set_memflags (seq, operands[1]);
4696 else if (GET_CODE (operands[0]) == MEM
4697 || (GET_CODE (operands[0]) == SUBREG
4698 && GET_CODE (SUBREG_REG (operands[0])) == MEM)
4699 || (reload_in_progress && GET_CODE (operands[0]) == REG
4700 && REGNO (operands[0]) >= FIRST_PSEUDO_REGISTER)
4701 || (reload_in_progress && GET_CODE (operands[0]) == SUBREG
4702 && GET_CODE (SUBREG_REG (operands[0])) == REG
4703 && REGNO (operands[0]) >= FIRST_PSEUDO_REGISTER))
4705 if (aligned_memory_operand (operands[0], HImode))
4707 rtx aligned_mem, bitnum;
4708 rtx temp1 = gen_reg_rtx (SImode);
4709 rtx temp2 = gen_reg_rtx (SImode);
4711 get_aligned_mem (operands[0], &aligned_mem, &bitnum);
4713 emit_insn (gen_aligned_store (aligned_mem, operands[1], bitnum,
4718 rtx temp1 = gen_reg_rtx (DImode);
4719 rtx temp2 = gen_reg_rtx (DImode);
4720 rtx temp3 = gen_reg_rtx (DImode);
4722 = gen_unaligned_storehi (get_unaligned_address (operands[0], 0),
4723 operands[1], temp1, temp2, temp3);
4725 alpha_set_memflags (seq, operands[0]);
4734 ;; Here are the versions for reload. Note that in the unaligned cases
4735 ;; we know that the operand must not be a pseudo-register because stack
4736 ;; slots are always aligned references.
4738 (define_expand "reload_inqi"
4739 [(parallel [(match_operand:QI 0 "register_operand" "=r")
4740 (match_operand:QI 1 "unaligned_memory_operand" "m")
4741 (match_operand:TI 2 "register_operand" "=&r")])]
4745 rtx addr = get_unaligned_address (operands[1], 0);
4747 /* It is possible that one of the registers we got for operands[2]
4748 might coincide with that of operands[0] (which is why we made
4749 it TImode). Pick the other one to use as our scratch. */
4750 rtx scratch = gen_rtx_REG (DImode,
4751 REGNO (operands[0]) == REGNO (operands[2])
4752 ? REGNO (operands[2]) + 1 : REGNO (operands[2]));
4754 rtx seq = gen_unaligned_loadqi (operands[0], addr, scratch,
4755 gen_rtx_REG (DImode, REGNO (operands[0])));
4757 alpha_set_memflags (seq, operands[1]);
4762 (define_expand "reload_inhi"
4763 [(parallel [(match_operand:HI 0 "register_operand" "=r")
4764 (match_operand:HI 1 "unaligned_memory_operand" "m")
4765 (match_operand:TI 2 "register_operand" "=&r")])]
4769 rtx addr = get_unaligned_address (operands[1], 0);
4771 /* It is possible that one of the registers we got for operands[2]
4772 might coincide with that of operands[0] (which is why we made
4773 it TImode). Pick the other one to use as our scratch. */
4774 rtx scratch = gen_rtx_REG (DImode,
4775 REGNO (operands[0]) == REGNO (operands[2])
4776 ? REGNO (operands[2]) + 1 : REGNO (operands[2]));
4778 rtx seq = gen_unaligned_loadhi (operands[0], addr, scratch,
4779 gen_rtx_REG (DImode, REGNO (operands[0])));
4781 alpha_set_memflags (seq, operands[1]);
4786 (define_expand "reload_outqi"
4787 [(parallel [(match_operand:QI 0 "any_memory_operand" "=m")
4788 (match_operand:QI 1 "register_operand" "r")
4789 (match_operand:TI 2 "register_operand" "=&r")])]
4793 if (aligned_memory_operand (operands[0], QImode))
4795 rtx aligned_mem, bitnum;
4797 get_aligned_mem (operands[0], &aligned_mem, &bitnum);
4799 emit_insn (gen_aligned_store (aligned_mem, operands[1], bitnum,
4800 gen_rtx_REG (SImode, REGNO (operands[2])),
4801 gen_rtx_REG (SImode,
4802 REGNO (operands[2]) + 1)));
4806 rtx addr = get_unaligned_address (operands[0], 0);
4807 rtx scratch1 = gen_rtx_REG (DImode, REGNO (operands[2]));
4808 rtx scratch2 = gen_rtx_REG (DImode, REGNO (operands[2]) + 1);
4809 rtx scratch3 = scratch1;
4812 if (GET_CODE (addr) == REG)
4815 seq = gen_unaligned_storeqi (addr, operands[1], scratch1,
4816 scratch2, scratch3);
4817 alpha_set_memflags (seq, operands[0]);
4824 (define_expand "reload_outhi"
4825 [(parallel [(match_operand:HI 0 "any_memory_operand" "=m")
4826 (match_operand:HI 1 "register_operand" "r")
4827 (match_operand:TI 2 "register_operand" "=&r")])]
4831 if (aligned_memory_operand (operands[0], HImode))
4833 rtx aligned_mem, bitnum;
4835 get_aligned_mem (operands[0], &aligned_mem, &bitnum);
4837 emit_insn (gen_aligned_store (aligned_mem, operands[1], bitnum,
4838 gen_rtx_REG (SImode, REGNO (operands[2])),
4839 gen_rtx_REG (SImode,
4840 REGNO (operands[2]) + 1)));
4844 rtx addr = get_unaligned_address (operands[0], 0);
4845 rtx scratch1 = gen_rtx_REG (DImode, REGNO (operands[2]));
4846 rtx scratch2 = gen_rtx_REG (DImode, REGNO (operands[2]) + 1);
4847 rtx scratch3 = scratch1;
4850 if (GET_CODE (addr) == REG)
4853 seq = gen_unaligned_storehi (addr, operands[1], scratch1,
4854 scratch2, scratch3);
4855 alpha_set_memflags (seq, operands[0]);
4862 ;; Bit field extract patterns which use ext[wlq][lh]
4864 (define_expand "extv"
4865 [(set (match_operand:DI 0 "register_operand" "")
4866 (sign_extract:DI (match_operand:QI 1 "memory_operand" "")
4867 (match_operand:DI 2 "immediate_operand" "")
4868 (match_operand:DI 3 "immediate_operand" "")))]
4872 /* We can do 16, 32 and 64 bit fields, if aligned on byte boundaries. */
4873 if (INTVAL (operands[3]) % 8 != 0
4874 || (INTVAL (operands[2]) != 16
4875 && INTVAL (operands[2]) != 32
4876 && INTVAL (operands[2]) != 64))
4879 /* From mips.md: extract_bit_field doesn't verify that our source
4880 matches the predicate, so we force it to be a MEM here. */
4881 if (GET_CODE (operands[1]) != MEM)
4884 alpha_expand_unaligned_load (operands[0], operands[1],
4885 INTVAL (operands[2]) / 8,
4886 INTVAL (operands[3]) / 8, 1);
4890 (define_expand "extzv"
4891 [(set (match_operand:DI 0 "register_operand" "")
4892 (zero_extract:DI (match_operand:DI 1 "general_operand" "")
4893 (match_operand:DI 2 "immediate_operand" "")
4894 (match_operand:DI 3 "immediate_operand" "")))]
4898 /* We can do 8, 16, 32 and 64 bit fields, if aligned on byte boundaries. */
4899 if (INTVAL (operands[3]) % 8 != 0
4900 || (INTVAL (operands[2]) != 8
4901 && INTVAL (operands[2]) != 16
4902 && INTVAL (operands[2]) != 32
4903 && INTVAL (operands[2]) != 64))
4906 if (GET_CODE (operands[1]) == MEM)
4908 /* Fail 8 bit fields, falling back on a simple byte load. */
4909 if (INTVAL (operands[2]) == 8)
4912 alpha_expand_unaligned_load (operands[0], operands[1],
4913 INTVAL (operands[2]) / 8,
4914 INTVAL (operands[3]) / 8, 0);
4919 (define_expand "insv"
4920 [(set (zero_extract:DI (match_operand:QI 0 "memory_operand" "")
4921 (match_operand:DI 1 "immediate_operand" "")
4922 (match_operand:DI 2 "immediate_operand" ""))
4923 (match_operand:DI 3 "register_operand" ""))]
4927 /* We can do 16, 32 and 64 bit fields, if aligned on byte boundaries. */
4928 if (INTVAL (operands[2]) % 8 != 0
4929 || (INTVAL (operands[1]) != 16
4930 && INTVAL (operands[1]) != 32
4931 && INTVAL (operands[1]) != 64))
4934 /* From mips.md: store_bit_field doesn't verify that our source
4935 matches the predicate, so we force it to be a MEM here. */
4936 if (GET_CODE (operands[0]) != MEM)
4939 alpha_expand_unaligned_store (operands[0], operands[3],
4940 INTVAL (operands[1]) / 8,
4941 INTVAL (operands[2]) / 8);
4947 ;; Block move/clear, see alpha.c for more details.
4948 ;; Argument 0 is the destination
4949 ;; Argument 1 is the source
4950 ;; Argument 2 is the length
4951 ;; Argument 3 is the alignment
4953 (define_expand "movstrqi"
4954 [(parallel [(set (match_operand:BLK 0 "general_operand" "")
4955 (match_operand:BLK 1 "general_operand" ""))
4956 (use (match_operand:DI 2 "immediate_operand" ""))
4957 (use (match_operand:DI 3 "immediate_operand" ""))])]
4961 if (alpha_expand_block_move (operands))
4967 (define_expand "clrstrqi"
4968 [(parallel [(set (match_operand:BLK 0 "general_operand" "")
4970 (use (match_operand:DI 1 "immediate_operand" ""))
4971 (use (match_operand:DI 2 "immediate_operand" ""))])]
4975 if (alpha_expand_block_clear (operands))
4981 ;; Subroutine of stack space allocation. Perform a stack probe.
4982 (define_expand "probe_stack"
4983 [(set (match_dup 1) (match_operand:DI 0 "const_int_operand" ""))]
4987 operands[1] = gen_rtx_MEM (DImode, plus_constant (stack_pointer_rtx,
4988 INTVAL (operands[0])));
4989 MEM_VOLATILE_P (operands[1]) = 1;
4991 operands[0] = const0_rtx;
4994 ;; This is how we allocate stack space. If we are allocating a
4995 ;; constant amount of space and we know it is less than 4096
4996 ;; bytes, we need do nothing.
4998 ;; If it is more than 4096 bytes, we need to probe the stack
5000 (define_expand "allocate_stack"
5002 (plus:DI (reg:DI 30)
5003 (match_operand:DI 1 "reg_or_cint_operand" "")))
5004 (set (match_operand:DI 0 "register_operand" "=r")
5009 if (GET_CODE (operands[1]) == CONST_INT
5010 && INTVAL (operands[1]) < 32768)
5012 if (INTVAL (operands[1]) >= 4096)
5014 /* We do this the same way as in the prologue and generate explicit
5015 probes. Then we update the stack by the constant. */
5019 emit_insn (gen_probe_stack (GEN_INT (- probed)));
5020 while (probed + 8192 < INTVAL (operands[1]))
5021 emit_insn (gen_probe_stack (GEN_INT (- (probed += 8192))));
5023 if (probed + 4096 < INTVAL (operands[1]))
5024 emit_insn (gen_probe_stack (GEN_INT (- INTVAL(operands[1]))));
5027 operands[1] = GEN_INT (- INTVAL (operands[1]));
5028 operands[2] = virtual_stack_dynamic_rtx;
5033 rtx loop_label = gen_label_rtx ();
5034 rtx want = gen_reg_rtx (Pmode);
5035 rtx tmp = gen_reg_rtx (Pmode);
5038 emit_insn (gen_subdi3 (want, stack_pointer_rtx,
5039 force_reg (Pmode, operands[1])));
5040 emit_insn (gen_adddi3 (tmp, stack_pointer_rtx, GEN_INT (-4096)));
5042 if (GET_CODE (operands[1]) != CONST_INT)
5044 out_label = gen_label_rtx ();
5045 emit_insn (gen_cmpdi (want, tmp));
5046 emit_jump_insn (gen_bgeu (out_label));
5049 emit_label (loop_label);
5050 memref = gen_rtx_MEM (DImode, tmp);
5051 MEM_VOLATILE_P (memref) = 1;
5052 emit_move_insn (memref, const0_rtx);
5053 emit_insn (gen_adddi3 (tmp, tmp, GEN_INT(-8192)));
5054 emit_insn (gen_cmpdi (tmp, want));
5055 emit_jump_insn (gen_bgtu (loop_label));
5057 gen_rtx_USE (VOIDmode, tmp);
5059 memref = gen_rtx_MEM (DImode, want);
5060 MEM_VOLATILE_P (memref) = 1;
5061 emit_move_insn (memref, const0_rtx);
5064 emit_label (out_label);
5066 emit_move_insn (stack_pointer_rtx, want);
5067 emit_move_insn (operands[0], virtual_stack_dynamic_rtx);
5072 ;; This is used by alpha_expand_prolog to do the same thing as above,
5073 ;; except we cannot at that time generate new basic blocks, so we hide
5074 ;; the loop in this one insn.
5076 (define_insn "prologue_stack_probe_loop"
5077 [(unspec_volatile [(match_operand 0 "register_operand" "r")
5078 (match_operand 1 "register_operand" "r")] 5)]
5082 static int label_no;
5083 int count_regno = REGNO (operands[0]);
5084 int ptr_regno = REGNO (operands[1]);
5087 /* Ho hum, output the hard way to get the label at the beginning of
5088 the line. Wish there were a magic char you could get
5089 asm_output_printf to do that. Then we could use %= as well and
5090 get rid of the label_no bits here too. */
5092 ASM_GENERATE_INTERNAL_LABEL (label, \"LSC\", label_no);
5093 ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, \"LSC\", label_no++);
5095 fprintf (asm_out_file, \"\\tstq $31,-8192($%d)\\n\", ptr_regno);
5096 fprintf (asm_out_file, \"\\tsubq $%d,1,$%d\\n\", count_regno, count_regno);
5097 fprintf (asm_out_file, \"\\tlda $%d,-8192($%d)\\n\", ptr_regno, ptr_regno);
5098 fprintf (asm_out_file, \"\\tbne $%d,\", count_regno);
5099 assemble_name (asm_out_file, label);
5100 putc ('\\n', asm_out_file);
5104 [(set_attr "length" "16")])
5106 (define_expand "prologue"
5107 [(clobber (const_int 0))]
5109 "alpha_expand_prologue (); DONE;")
5111 (define_insn "init_fp"
5112 [(set (match_operand:DI 0 "register_operand" "r")
5113 (match_operand:DI 1 "register_operand" "r"))
5114 (clobber (mem:BLK (match_operand:DI 2 "register_operand" "r")))]
5118 (define_expand "epilogue"
5119 [(clobber (const_int 0))]
5121 "alpha_expand_epilogue (); DONE;")
5123 (define_expand "builtin_longjmp"
5124 [(unspec_volatile [(match_operand 0 "register_operand" "r")] 3)]
5125 "! TARGET_OPEN_VMS && ! TARGET_WINDOWS_NT"
5128 /* The elements of the buffer are, in order: */
5129 rtx fp = gen_rtx_MEM (Pmode, operands[0]);
5130 rtx lab = gen_rtx_MEM (Pmode, plus_constant (operands[0], 8));
5131 rtx stack = gen_rtx_MEM (Pmode, plus_constant (operands[0], 16));
5132 rtx pv = gen_rtx_REG (Pmode, 27);
5134 /* This bit is the same as expand_builtin_longjmp. */
5135 emit_move_insn (hard_frame_pointer_rtx, fp);
5136 emit_move_insn (pv, lab);
5137 emit_stack_restore (SAVE_NONLOCAL, stack, NULL_RTX);
5138 emit_insn (gen_rtx_USE (VOIDmode, hard_frame_pointer_rtx));
5139 emit_insn (gen_rtx_USE (VOIDmode, stack_pointer_rtx));
5141 /* Load the label we are jumping through into $27 so that we know
5142 where to look for it when we get back to setjmp's function for
5143 restoring the gp. */
5144 emit_indirect_jump (pv);
5147 (define_insn "builtin_setjmp_receiver"
5148 [(unspec_volatile [(match_operand 0 "" "")] 2)]
5149 "! TARGET_OPEN_VMS && ! TARGET_WINDOWS_NT && TARGET_AS_CAN_SUBTRACT_LABELS"
5150 "\\n$LSJ%=:\;ldgp $29,$LSJ%=-%l0($27)"
5151 [(set_attr "length" "8")])
5154 [(unspec_volatile [(match_operand 0 "" "")] 2)]
5155 "! TARGET_OPEN_VMS && ! TARGET_WINDOWS_NT"
5156 "br $27,$LSJ%=\\n$LSJ%=:\;ldgp $29,0($27)"
5157 [(set_attr "length" "12")])
5159 (define_expand "nonlocal_goto_receiver"
5160 [(unspec_volatile [(const_int 0)] 1)
5161 (set (reg:DI 27) (mem:DI (reg:DI 29)))
5162 (unspec_volatile [(const_int 0)] 1)
5167 (define_insn "arg_home"
5168 [(unspec [(const_int 0)] 0)
5183 (clobber (mem:BLK (const_int 0)))
5184 (clobber (reg:DI 24))
5185 (clobber (reg:DI 25))
5186 (clobber (reg:DI 0))]
5188 "lda $0,OTS$HOME_ARGS\;ldq $0,8($0)\;jsr $0,OTS$HOME_ARGS"
5189 [(set_attr "length" "16")])
5191 ;; Close the trap shadow of preceeding instructions. This is generated
5194 (define_insn "trapb"
5195 [(unspec_volatile [(const_int 0)] 4)]
5198 [(set_attr "type" "misc")])
5200 ;; Peepholes go at the end.
5202 ;; Optimize sign-extension of SImode loads. This shows up in the wake of
5203 ;; reload when converting fp->int.
5205 ;; ??? What to do now that we actually care about the packing and
5206 ;; alignment of instructions? Perhaps reload can be enlightened, or
5207 ;; the peephole pass moved up after reload but before sched2?
5210 ; [(set (match_operand:SI 0 "register_operand" "=r")
5211 ; (match_operand:SI 1 "memory_operand" "m"))
5212 ; (set (match_operand:DI 2 "register_operand" "=r")
5213 ; (sign_extend:DI (match_dup 0)))]
5214 ; "dead_or_set_p (insn, operands[0])"
5218 ; [(set (match_operand:SI 0 "register_operand" "=r")
5219 ; (match_operand:SI 1 "hard_fp_register_operand" "f"))
5220 ; (set (match_operand:DI 2 "register_operand" "=r")
5221 ; (sign_extend:DI (match_dup 0)))]
5222 ; "TARGET_CIX && dead_or_set_p (insn, operands[0])"