1 ;; Machine description for DEC Alpha for GNU C compiler
2 ;; Copyright (C) 1992, 93-98, 1999 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 ;; 7 exception_receiver
44 ;; Processor type -- this attribute must exactly match the processor_type
45 ;; enumeration in alpha.h.
47 (define_attr "cpu" "ev4,ev5,ev6"
48 (const (symbol_ref "alpha_cpu")))
50 ;; Define an insn type attribute. This is used in function unit delay
51 ;; computations, among other purposes. For the most part, we use the names
52 ;; defined in the EV4 documentation, but add a few that we have to know about
56 "ild,fld,ldsym,ist,fst,ibr,fbr,jsr,iadd,ilog,shift,icmov,fcmov,icmp,imul,fadd,fmul,fcpys,fdiv,fsqrt,misc,mvi,ftoi,itof,multi"
57 (const_string "iadd"))
59 ;; Describe a user's asm statement.
60 (define_asm_attributes
61 [(set_attr "type" "multi")])
63 ;; Define the operand size an insn operates on. Used primarily by mul
64 ;; and div operations that have size dependant timings.
66 (define_attr "opsize" "si,di,udi" (const_string "di"))
68 ;; The TRAP_TYPE attribute marks instructions that may generate traps
69 ;; (which are imprecise and may need a trapb if software completion
72 (define_attr "trap" "no,yes" (const_string "no"))
74 ;; The length of an instruction sequence in bytes.
76 (define_attr "length" "" (const_int 4))
78 ;; On EV4 there are two classes of resources to consider: resources needed
79 ;; to issue, and resources needed to execute. IBUS[01] are in the first
80 ;; category. ABOX, BBOX, EBOX, FBOX, IMUL & FDIV make up the second.
81 ;; (There are a few other register-like resources, but ...)
83 ; First, describe all of the issue constraints with single cycle delays.
84 ; All insns need a bus, but all except loads require one or the other.
85 (define_function_unit "ev4_ibus0" 1 0
86 (and (eq_attr "cpu" "ev4")
87 (eq_attr "type" "fst,fbr,iadd,imul,ilog,shift,icmov,icmp"))
90 (define_function_unit "ev4_ibus1" 1 0
91 (and (eq_attr "cpu" "ev4")
92 (eq_attr "type" "ist,ibr,jsr,fadd,fcmov,fcpys,fmul,fdiv,misc"))
95 ; Memory delivers its result in three cycles. Actually return one and
96 ; take care of this in adjust_cost, since we want to handle user-defined
98 (define_function_unit "ev4_abox" 1 0
99 (and (eq_attr "cpu" "ev4")
100 (eq_attr "type" "ild,fld,ldsym,ist,fst"))
103 ; Branches have no delay cost, but do tie up the unit for two cycles.
104 (define_function_unit "ev4_bbox" 1 1
105 (and (eq_attr "cpu" "ev4")
106 (eq_attr "type" "ibr,fbr,jsr"))
109 ; Arithmetic insns are normally have their results available after
110 ; two cycles. There are a number of exceptions. They are encoded in
111 ; ADJUST_COST. Some of the other insns have similar exceptions.
112 (define_function_unit "ev4_ebox" 1 0
113 (and (eq_attr "cpu" "ev4")
114 (eq_attr "type" "iadd,ilog,shift,icmov,icmp,misc"))
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 "imul" 1 0
124 (and (eq_attr "cpu" "ev4")
125 (and (eq_attr "type" "imul")
126 (eq_attr "opsize" "!si")))
129 (define_function_unit "ev4_fbox" 1 0
130 (and (eq_attr "cpu" "ev4")
131 (eq_attr "type" "fadd,fmul,fcpys,fcmov"))
134 (define_function_unit "fdiv" 1 0
135 (and (eq_attr "cpu" "ev4")
136 (and (eq_attr "type" "fdiv")
137 (eq_attr "opsize" "si")))
140 (define_function_unit "fdiv" 1 0
141 (and (eq_attr "cpu" "ev4")
142 (and (eq_attr "type" "fdiv")
143 (eq_attr "opsize" "di")))
146 ;; EV5 scheduling. EV5 can issue 4 insns per clock.
148 ;; EV5 has two asymetric integer units. Model this with E0 & E1 along
149 ;; with the combined resource EBOX.
151 (define_function_unit "ev5_ebox" 2 0
152 (and (eq_attr "cpu" "ev5")
153 (eq_attr "type" "!fbr,fcmov,fadd,fmul,fcpys,fdiv"))
156 ; Memory takes at least 2 clocks. Return one from here and fix up with
157 ; user-defined latencies in adjust_cost.
158 ; ??? How to: "An instruction of class LD cannot be issued in the _second_
159 ; cycle after an instruction of class ST is issued."
160 (define_function_unit "ev5_ebox" 2 0
161 (and (eq_attr "cpu" "ev5")
162 (eq_attr "type" "ild,fld,ldsym"))
165 ; Stores, shifts, multiplies can only issue to E0
166 (define_function_unit "ev5_e0" 1 0
167 (and (eq_attr "cpu" "ev5")
168 (eq_attr "type" "ist,fst,shift,imul"))
171 ; Motion video insns also issue only to E0, and take two ticks.
172 (define_function_unit "ev5_e0" 1 0
173 (and (eq_attr "cpu" "ev5")
174 (eq_attr "type" "mvi"))
177 ; Conditional moves always take 2 ticks.
178 (define_function_unit "ev5_ebox" 2 0
179 (and (eq_attr "cpu" "ev5")
180 (eq_attr "type" "icmov"))
183 ; Branches can only issue to E1
184 (define_function_unit "ev5_e1" 1 0
185 (and (eq_attr "cpu" "ev5")
186 (eq_attr "type" "ibr,jsr"))
189 ; Multiplies also use the integer multiplier.
190 ; ??? How to: "No instruction can be issued to pipe E0 exactly two
191 ; cycles before an integer multiplication completes."
192 (define_function_unit "imul" 1 0
193 (and (eq_attr "cpu" "ev5")
194 (and (eq_attr "type" "imul")
195 (eq_attr "opsize" "si")))
198 (define_function_unit "imul" 1 0
199 (and (eq_attr "cpu" "ev5")
200 (and (eq_attr "type" "imul")
201 (eq_attr "opsize" "di")))
204 (define_function_unit "imul" 1 0
205 (and (eq_attr "cpu" "ev5")
206 (and (eq_attr "type" "imul")
207 (eq_attr "opsize" "udi")))
210 ;; Similarly for the FPU we have two asymetric units. But fcpys can issue
211 ;; on either so we have to play the game again.
213 (define_function_unit "ev5_fbox" 2 0
214 (and (eq_attr "cpu" "ev5")
215 (eq_attr "type" "fadd,fcmov,fmul,fcpys,fbr,fdiv"))
218 (define_function_unit "ev5_fm" 1 0
219 (and (eq_attr "cpu" "ev5")
220 (eq_attr "type" "fmul"))
223 ; Add and cmov as you would expect; fbr never produces a result;
224 ; fdiv issues through fa to the divider,
225 (define_function_unit "ev5_fa" 1 0
226 (and (eq_attr "cpu" "ev5")
227 (eq_attr "type" "fadd,fcmov,fbr,fdiv"))
230 ; ??? How to: "No instruction can be issued to pipe FA exactly five
231 ; cycles before a floating point divide completes."
232 (define_function_unit "fdiv" 1 0
233 (and (eq_attr "cpu" "ev5")
234 (and (eq_attr "type" "fdiv")
235 (eq_attr "opsize" "si")))
236 15 15) ; 15 to 31 data dependant
238 (define_function_unit "fdiv" 1 0
239 (and (eq_attr "cpu" "ev5")
240 (and (eq_attr "type" "fdiv")
241 (eq_attr "opsize" "di")))
242 22 22) ; 22 to 60 data dependant
244 ;; EV6 scheduling. EV6 can issue 4 insns per clock.
246 ;; EV6 has two symmetric pairs ("clusters") of two asymetric integer units
247 ;; ("upper" and "lower"), yielding pipe names U0, U1, L0, L1.
249 ;; Conditional moves decompose into two independant primitives, each
250 ;; taking one cycle. Since ev6 is out-of-order, we can't see anything
252 (define_function_unit "ev6_ebox" 4 0
253 (and (eq_attr "cpu" "ev6")
254 (eq_attr "type" "icmov"))
257 (define_function_unit "ev6_ebox" 4 0
258 (and (eq_attr "cpu" "ev6")
259 (eq_attr "type" "!fbr,fcmov,fadd,fmul,fcpys,fdiv,fsqrt"))
262 ;; Integer loads take at least 3 clocks, and only issue to lower units.
263 ;; Return one from here and fix up with user-defined latencies in adjust_cost.
264 (define_function_unit "ev6_l" 2 0
265 (and (eq_attr "cpu" "ev6")
266 (eq_attr "type" "ild,ldsym,ist,fst"))
269 ;; FP loads take at least 4 clocks. Return two from here...
270 (define_function_unit "ev6_l" 2 0
271 (and (eq_attr "cpu" "ev6")
272 (eq_attr "type" "fld"))
275 ;; Motion video insns also issue only to U0, and take three ticks.
276 (define_function_unit "ev6_u0" 1 0
277 (and (eq_attr "cpu" "ev6")
278 (eq_attr "type" "mvi"))
281 (define_function_unit "ev6_u" 2 0
282 (and (eq_attr "cpu" "ev6")
283 (eq_attr "type" "mvi"))
286 ;; Shifts issue to either upper pipe.
287 (define_function_unit "ev6_u" 2 0
288 (and (eq_attr "cpu" "ev6")
289 (eq_attr "type" "shift"))
292 ;; Multiplies issue only to U1, and all take 7 ticks.
293 ;; Rather than create a new function unit just for U1, reuse IMUL
294 (define_function_unit "imul" 1 0
295 (and (eq_attr "cpu" "ev6")
296 (eq_attr "type" "imul"))
299 (define_function_unit "ev6_u" 2 0
300 (and (eq_attr "cpu" "ev6")
301 (eq_attr "type" "imul"))
304 ;; Branches issue to either upper pipe
305 (define_function_unit "ev6_u" 2 0
306 (and (eq_attr "cpu" "ev6")
307 (eq_attr "type" "ibr"))
310 ;; Calls only issue to L0.
311 (define_function_unit "ev6_l0" 1 0
312 (and (eq_attr "cpu" "ev6")
313 (eq_attr "type" "jsr"))
316 (define_function_unit "ev6_l" 2 0
317 (and (eq_attr "cpu" "ev6")
318 (eq_attr "type" "jsr"))
321 ;; Ftoi/itof only issue to lower pipes
322 (define_function_unit "ev6_l" 2 0
323 (and (eq_attr "cpu" "ev6")
324 (eq_attr "type" "ftoi"))
327 (define_function_unit "ev6_l" 2 0
328 (and (eq_attr "cpu" "ev6")
329 (eq_attr "type" "itof"))
332 ;; For the FPU we are very similar to EV5, except there's no insn that
333 ;; can issue to fm & fa, so we get to leave that out.
335 (define_function_unit "ev6_fm" 1 0
336 (and (eq_attr "cpu" "ev6")
337 (eq_attr "type" "fmul"))
340 (define_function_unit "ev6_fa" 1 0
341 (and (eq_attr "cpu" "ev6")
342 (eq_attr "type" "fadd,fcpys,fbr,fdiv,fsqrt"))
345 (define_function_unit "ev6_fa" 1 0
346 (and (eq_attr "cpu" "ev6")
347 (eq_attr "type" "fcmov"))
350 (define_function_unit "fdiv" 1 0
351 (and (eq_attr "cpu" "ev6")
352 (and (eq_attr "type" "fdiv")
353 (eq_attr "opsize" "si")))
356 (define_function_unit "fdiv" 1 0
357 (and (eq_attr "cpu" "ev6")
358 (and (eq_attr "type" "fdiv")
359 (eq_attr "opsize" "di")))
362 (define_function_unit "fsqrt" 1 0
363 (and (eq_attr "cpu" "ev6")
364 (and (eq_attr "type" "fsqrt")
365 (eq_attr "opsize" "si")))
368 (define_function_unit "fsqrt" 1 0
369 (and (eq_attr "cpu" "ev6")
370 (and (eq_attr "type" "fsqrt")
371 (eq_attr "opsize" "di")))
374 ; ??? The FPU communicates with memory and the integer register file
375 ; via two fp store units. We need a slot in the fst immediately, and
376 ; a slot in LOW after the operand data is ready. At which point the
377 ; data may be moved either to the store queue or the integer register
378 ; file and the insn retired.
381 ;; First define the arithmetic insns. Note that the 32-bit forms also
384 ;; Handle 32-64 bit extension from memory to a floating point register
385 ;; specially, since this ocurrs frequently in int->double conversions.
386 ;; This is done with a define_split after reload converting the plain
387 ;; sign-extension into a load+unspec, which of course results in lds+cvtlq.
389 ;; Note that while we must retain the =f case in the insn for reload's
390 ;; benefit, it should be eliminated after reload, so we should never emit
391 ;; code for that case. But we don't reject the possibility.
393 (define_insn "extendsidi2"
394 [(set (match_operand:DI 0 "register_operand" "=r,r,?f")
395 (sign_extend:DI (match_operand:SI 1 "nonimmediate_operand" "r,m,m")))]
400 lds %0,%1\;cvtlq %0,%0"
401 [(set_attr "type" "iadd,ild,fld")
402 (set_attr "length" "*,*,8")])
404 ;; Due to issues with CLASS_CANNOT_CHANGE_SIZE, we cannot use a subreg here.
406 [(set (match_operand:DI 0 "hard_fp_register_operand" "")
407 (sign_extend:DI (match_operand:SI 1 "memory_operand" "")))]
409 [(set (match_dup 2) (match_dup 1))
410 (set (match_dup 0) (unspec:DI [(match_dup 2)] 4))]
411 "operands[2] = gen_rtx_REG (SImode, REGNO (operands[0]));")
414 [(set (match_operand:DI 0 "register_operand" "=f")
415 (unspec:DI [(match_operand:SI 1 "register_operand" "f")] 4))]
418 [(set_attr "type" "fadd")])
420 ;; Do addsi3 the way expand_binop would do if we didn't have one. This
421 ;; generates better code. We have the anonymous addsi3 pattern below in
422 ;; case combine wants to make it.
423 (define_expand "addsi3"
424 [(set (match_operand:SI 0 "register_operand" "")
425 (plus:SI (match_operand:SI 1 "reg_or_0_operand" "")
426 (match_operand:SI 2 "add_operand" "")))]
432 rtx op1 = gen_lowpart (DImode, operands[1]);
433 rtx op2 = gen_lowpart (DImode, operands[2]);
435 if (! cse_not_expected)
437 rtx tmp = gen_reg_rtx (DImode);
438 emit_insn (gen_adddi3 (tmp, op1, op2));
439 emit_move_insn (gen_lowpart (DImode, operands[0]), tmp);
442 emit_insn (gen_adddi3 (gen_lowpart (DImode, operands[0]), op1, op2));
448 [(set (match_operand:SI 0 "register_operand" "=r,r,r,r")
449 (plus:SI (match_operand:SI 1 "reg_or_0_operand" "%rJ,rJ,rJ,rJ")
450 (match_operand:SI 2 "add_operand" "rI,O,K,L")))]
459 [(set (match_operand:SI 0 "register_operand" "")
460 (plus:SI (match_operand:SI 1 "register_operand" "")
461 (match_operand:SI 2 "const_int_operand" "")))]
462 "! add_operand (operands[2], SImode)"
463 [(set (match_dup 0) (plus:SI (match_dup 1) (match_dup 3)))
464 (set (match_dup 0) (plus:SI (match_dup 0) (match_dup 4)))]
467 HOST_WIDE_INT val = INTVAL (operands[2]);
468 HOST_WIDE_INT low = (val & 0xffff) - 2 * (val & 0x8000);
469 HOST_WIDE_INT rest = val - low;
471 operands[3] = GEN_INT (rest);
472 operands[4] = GEN_INT (low);
476 [(set (match_operand:DI 0 "register_operand" "=r,r")
478 (plus:SI (match_operand:SI 1 "reg_or_0_operand" "%rJ,rJ")
479 (match_operand:SI 2 "sext_add_operand" "rI,O"))))]
486 [(set (match_operand:DI 0 "register_operand" "")
488 (plus:SI (match_operand:SI 1 "register_operand" "")
489 (match_operand:SI 2 "const_int_operand" ""))))
490 (clobber (match_operand:SI 3 "reg_not_elim_operand" ""))]
491 "! sext_add_operand (operands[2], SImode) && INTVAL (operands[2]) > 0
492 && INTVAL (operands[2]) % 4 == 0"
493 [(set (match_dup 3) (match_dup 4))
494 (set (match_dup 0) (sign_extend:DI (plus:SI (mult:SI (match_dup 3)
499 HOST_WIDE_INT val = INTVAL (operands[2]) / 4;
505 operands[4] = GEN_INT (val);
506 operands[5] = GEN_INT (mult);
510 [(set (match_operand:DI 0 "register_operand" "")
512 (plus:SI (match_operator:SI 1 "comparison_operator"
513 [(match_operand 2 "" "")
514 (match_operand 3 "" "")])
515 (match_operand:SI 4 "add_operand" ""))))
516 (clobber (match_operand:DI 5 "register_operand" ""))]
518 [(set (match_dup 5) (match_dup 6))
519 (set (match_dup 0) (sign_extend:DI (plus:SI (match_dup 7) (match_dup 4))))]
522 operands[6] = gen_rtx_fmt_ee (GET_CODE (operands[1]), DImode,
523 operands[2], operands[3]);
524 operands[7] = gen_lowpart (SImode, operands[5]);
527 (define_insn "adddi3"
528 [(set (match_operand:DI 0 "register_operand" "=r,r,r,r")
529 (plus:DI (match_operand:DI 1 "reg_or_0_operand" "%rJ,rJ,rJ,rJ")
530 (match_operand:DI 2 "add_operand" "rI,O,K,L")))]
538 ;; Don't do this if we are adjusting SP since we don't want to do
541 [(set (match_operand:DI 0 "register_operand" "")
542 (plus:DI (match_operand:DI 1 "register_operand" "")
543 (match_operand:DI 2 "const_int_operand" "")))]
544 "! add_operand (operands[2], DImode)
545 && REGNO (operands[0]) != STACK_POINTER_REGNUM"
546 [(set (match_dup 0) (plus:DI (match_dup 1) (match_dup 3)))
547 (set (match_dup 0) (plus:DI (match_dup 0) (match_dup 4)))]
550 HOST_WIDE_INT val = INTVAL (operands[2]);
551 HOST_WIDE_INT low = (val & 0xffff) - 2 * (val & 0x8000);
552 HOST_WIDE_INT rest = val - low;
554 operands[3] = GEN_INT (rest);
555 operands[4] = GEN_INT (low);
559 [(set (match_operand:SI 0 "register_operand" "=r,r")
560 (plus:SI (mult:SI (match_operand:SI 1 "reg_not_elim_operand" "r,r")
561 (match_operand:SI 2 "const48_operand" "I,I"))
562 (match_operand:SI 3 "sext_add_operand" "rI,O")))]
569 [(set (match_operand:DI 0 "register_operand" "=r,r")
571 (plus:SI (mult:SI (match_operand:SI 1 "reg_not_elim_operand" "r,r")
572 (match_operand:SI 2 "const48_operand" "I,I"))
573 (match_operand:SI 3 "sext_add_operand" "rI,O"))))]
580 [(set (match_operand:DI 0 "register_operand" "")
582 (plus:SI (mult:SI (match_operator:SI 1 "comparison_operator"
583 [(match_operand 2 "" "")
584 (match_operand 3 "" "")])
585 (match_operand:SI 4 "const48_operand" ""))
586 (match_operand:SI 5 "add_operand" ""))))
587 (clobber (match_operand:DI 6 "reg_not_elim_operand" ""))]
589 [(set (match_dup 6) (match_dup 7))
591 (sign_extend:DI (plus:SI (mult:SI (match_dup 8) (match_dup 4))
595 operands[7] = gen_rtx_fmt_ee (GET_CODE (operands[1]), DImode,
596 operands[2], operands[3]);
597 operands[8] = gen_lowpart (SImode, operands[6]);
601 [(set (match_operand:DI 0 "register_operand" "=r,r")
602 (plus:DI (mult:DI (match_operand:DI 1 "reg_not_elim_operand" "r,r")
603 (match_operand:DI 2 "const48_operand" "I,I"))
604 (match_operand:DI 3 "sext_add_operand" "rI,O")))]
610 ;; These variants of the above insns can occur if the third operand
611 ;; is the frame pointer. This is a kludge, but there doesn't
612 ;; seem to be a way around it. Only recognize them while reloading.
615 [(set (match_operand:DI 0 "some_operand" "=&r")
616 (plus:DI (plus:DI (match_operand:DI 1 "some_operand" "r")
617 (match_operand:DI 2 "some_operand" "r"))
618 (match_operand:DI 3 "some_operand" "rIOKL")))]
623 [(set (match_operand:DI 0 "register_operand" "")
624 (plus:DI (plus:DI (match_operand:DI 1 "register_operand" "")
625 (match_operand:DI 2 "register_operand" ""))
626 (match_operand:DI 3 "add_operand" "")))]
628 [(set (match_dup 0) (plus:DI (match_dup 1) (match_dup 2)))
629 (set (match_dup 0) (plus:DI (match_dup 0) (match_dup 3)))]
633 [(set (match_operand:SI 0 "some_operand" "=&r")
634 (plus:SI (plus:SI (mult:SI (match_operand:SI 1 "some_operand" "rJ")
635 (match_operand:SI 2 "const48_operand" "I"))
636 (match_operand:SI 3 "some_operand" "r"))
637 (match_operand:SI 4 "some_operand" "rIOKL")))]
642 [(set (match_operand:SI 0 "register_operand" "r")
643 (plus:SI (plus:SI (mult:SI (match_operand:SI 1 "reg_or_0_operand" "")
644 (match_operand:SI 2 "const48_operand" ""))
645 (match_operand:SI 3 "register_operand" ""))
646 (match_operand:SI 4 "add_operand" "rIOKL")))]
649 (plus:SI (mult:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
650 (set (match_dup 0) (plus:SI (match_dup 0) (match_dup 4)))]
654 [(set (match_operand:DI 0 "some_operand" "=&r")
657 (mult:SI (match_operand:SI 1 "some_operand" "rJ")
658 (match_operand:SI 2 "const48_operand" "I"))
659 (match_operand:SI 3 "some_operand" "r"))
660 (match_operand:SI 4 "some_operand" "rIOKL"))))]
665 [(set (match_operand:DI 0 "register_operand" "")
668 (mult:SI (match_operand:SI 1 "reg_or_0_operand" "")
669 (match_operand:SI 2 "const48_operand" ""))
670 (match_operand:SI 3 "register_operand" ""))
671 (match_operand:SI 4 "add_operand" ""))))]
674 (plus:SI (mult:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
675 (set (match_dup 0) (sign_extend:DI (plus:SI (match_dup 5) (match_dup 4))))]
676 "operands[5] = gen_lowpart (SImode, operands[0]);")
679 [(set (match_operand:DI 0 "some_operand" "=&r")
680 (plus:DI (plus:DI (mult:DI (match_operand:DI 1 "some_operand" "rJ")
681 (match_operand:DI 2 "const48_operand" "I"))
682 (match_operand:DI 3 "some_operand" "r"))
683 (match_operand:DI 4 "some_operand" "rIOKL")))]
688 [(set (match_operand:DI 0 "register_operand" "=")
689 (plus:DI (plus:DI (mult:DI (match_operand:DI 1 "reg_or_0_operand" "")
690 (match_operand:DI 2 "const48_operand" ""))
691 (match_operand:DI 3 "register_operand" ""))
692 (match_operand:DI 4 "add_operand" "")))]
695 (plus:DI (mult:DI (match_dup 1) (match_dup 2)) (match_dup 3)))
696 (set (match_dup 0) (plus:DI (match_dup 0) (match_dup 4)))]
699 (define_insn "negsi2"
700 [(set (match_operand:SI 0 "register_operand" "=r")
701 (neg:SI (match_operand:SI 1 "reg_or_8bit_operand" "rI")))]
706 [(set (match_operand:DI 0 "register_operand" "=r")
707 (sign_extend:DI (neg:SI
708 (match_operand:SI 1 "reg_or_8bit_operand" "rI"))))]
712 (define_insn "negdi2"
713 [(set (match_operand:DI 0 "register_operand" "=r")
714 (neg:DI (match_operand:DI 1 "reg_or_8bit_operand" "rI")))]
718 (define_expand "subsi3"
719 [(set (match_operand:SI 0 "register_operand" "")
720 (minus:SI (match_operand:SI 1 "reg_or_0_operand" "")
721 (match_operand:SI 2 "reg_or_8bit_operand" "")))]
727 rtx op1 = gen_lowpart (DImode, operands[1]);
728 rtx op2 = gen_lowpart (DImode, operands[2]);
730 if (! cse_not_expected)
732 rtx tmp = gen_reg_rtx (DImode);
733 emit_insn (gen_subdi3 (tmp, op1, op2));
734 emit_move_insn (gen_lowpart (DImode, operands[0]), tmp);
737 emit_insn (gen_subdi3 (gen_lowpart (DImode, operands[0]), op1, op2));
743 [(set (match_operand:SI 0 "register_operand" "=r")
744 (minus:SI (match_operand:SI 1 "reg_or_0_operand" "rJ")
745 (match_operand:SI 2 "reg_or_8bit_operand" "rI")))]
750 [(set (match_operand:DI 0 "register_operand" "=r")
751 (sign_extend:DI (minus:SI (match_operand:SI 1 "reg_or_0_operand" "rJ")
752 (match_operand:SI 2 "reg_or_8bit_operand" "rI"))))]
756 (define_insn "subdi3"
757 [(set (match_operand:DI 0 "register_operand" "=r")
758 (minus:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
759 (match_operand:DI 2 "reg_or_8bit_operand" "rI")))]
764 [(set (match_operand:SI 0 "register_operand" "=r")
765 (minus:SI (mult:SI (match_operand:SI 1 "reg_not_elim_operand" "r")
766 (match_operand:SI 2 "const48_operand" "I"))
767 (match_operand:SI 3 "reg_or_8bit_operand" "rI")))]
772 [(set (match_operand:DI 0 "register_operand" "=r")
774 (minus:SI (mult:SI (match_operand:SI 1 "reg_not_elim_operand" "r")
775 (match_operand:SI 2 "const48_operand" "I"))
776 (match_operand:SI 3 "reg_or_8bit_operand" "rI"))))]
781 [(set (match_operand:DI 0 "register_operand" "=r")
782 (minus:DI (mult:DI (match_operand:DI 1 "reg_not_elim_operand" "r")
783 (match_operand:DI 2 "const48_operand" "I"))
784 (match_operand:DI 3 "reg_or_8bit_operand" "rI")))]
788 (define_insn "mulsi3"
789 [(set (match_operand:SI 0 "register_operand" "=r")
790 (mult:SI (match_operand:SI 1 "reg_or_0_operand" "%rJ")
791 (match_operand:SI 2 "reg_or_8bit_operand" "rI")))]
794 [(set_attr "type" "imul")
795 (set_attr "opsize" "si")])
798 [(set (match_operand:DI 0 "register_operand" "=r")
800 (mult:SI (match_operand:SI 1 "reg_or_0_operand" "%rJ")
801 (match_operand:SI 2 "reg_or_8bit_operand" "rI"))))]
804 [(set_attr "type" "imul")
805 (set_attr "opsize" "si")])
807 (define_insn "muldi3"
808 [(set (match_operand:DI 0 "register_operand" "=r")
809 (mult:DI (match_operand:DI 1 "reg_or_0_operand" "%rJ")
810 (match_operand:DI 2 "reg_or_8bit_operand" "rI")))]
813 [(set_attr "type" "imul")])
815 (define_insn "umuldi3_highpart"
816 [(set (match_operand:DI 0 "register_operand" "=r")
819 (mult:TI (zero_extend:TI
820 (match_operand:DI 1 "reg_or_0_operand" "%rJ"))
822 (match_operand:DI 2 "reg_or_8bit_operand" "rI")))
826 [(set_attr "type" "imul")
827 (set_attr "opsize" "udi")])
830 [(set (match_operand:DI 0 "register_operand" "=r")
833 (mult:TI (zero_extend:TI (match_operand:DI 1 "register_operand" "r"))
834 (match_operand:TI 2 "cint8_operand" "I"))
838 [(set_attr "type" "imul")
839 (set_attr "opsize" "udi")])
841 ;; The divide and remainder operations always take their inputs from
842 ;; r24 and r25, put their output in r27, and clobber r23 and r28.
844 ;; ??? Force sign-extension here because some versions of OSF/1 don't
845 ;; do the right thing if the inputs are not properly sign-extended.
846 ;; But Linux, for instance, does not have this problem. Is it worth
847 ;; the complication here to eliminate the sign extension?
849 (define_expand "divsi3"
851 (sign_extend:DI (match_operand:SI 1 "nonimmediate_operand" "")))
853 (sign_extend:DI (match_operand:SI 2 "nonimmediate_operand" "")))
854 (parallel [(set (reg:DI 27)
855 (sign_extend:DI (div:SI (reg:DI 24) (reg:DI 25))))
856 (clobber (reg:DI 23))
857 (clobber (reg:DI 28))])
858 (set (match_operand:SI 0 "general_operand" "")
859 (subreg:SI (reg:DI 27) 0))]
863 (define_expand "udivsi3"
865 (sign_extend:DI (match_operand:SI 1 "nonimmediate_operand" "")))
867 (sign_extend:DI (match_operand:SI 2 "nonimmediate_operand" "")))
868 (parallel [(set (reg:DI 27)
869 (sign_extend:DI (udiv:SI (reg:DI 24) (reg:DI 25))))
870 (clobber (reg:DI 23))
871 (clobber (reg:DI 28))])
872 (set (match_operand:SI 0 "general_operand" "")
873 (subreg:SI (reg:DI 27) 0))]
877 (define_expand "modsi3"
879 (sign_extend:DI (match_operand:SI 1 "nonimmediate_operand" "")))
881 (sign_extend:DI (match_operand:SI 2 "nonimmediate_operand" "")))
882 (parallel [(set (reg:DI 27)
883 (sign_extend:DI (mod:SI (reg:DI 24) (reg:DI 25))))
884 (clobber (reg:DI 23))
885 (clobber (reg:DI 28))])
886 (set (match_operand:SI 0 "general_operand" "")
887 (subreg:SI (reg:DI 27) 0))]
891 (define_expand "umodsi3"
893 (sign_extend:DI (match_operand:SI 1 "nonimmediate_operand" "")))
895 (sign_extend:DI (match_operand:SI 2 "nonimmediate_operand" "")))
896 (parallel [(set (reg:DI 27)
897 (sign_extend:DI (umod:SI (reg:DI 24) (reg:DI 25))))
898 (clobber (reg:DI 23))
899 (clobber (reg:DI 28))])
900 (set (match_operand:SI 0 "general_operand" "")
901 (subreg:SI (reg:DI 27) 0))]
905 (define_expand "divdi3"
906 [(set (reg:DI 24) (match_operand:DI 1 "input_operand" ""))
907 (set (reg:DI 25) (match_operand:DI 2 "input_operand" ""))
908 (parallel [(set (reg:DI 27)
911 (clobber (reg:DI 23))
912 (clobber (reg:DI 28))])
913 (set (match_operand:DI 0 "general_operand" "")
918 (define_expand "udivdi3"
919 [(set (reg:DI 24) (match_operand:DI 1 "input_operand" ""))
920 (set (reg:DI 25) (match_operand:DI 2 "input_operand" ""))
921 (parallel [(set (reg:DI 27)
924 (clobber (reg:DI 23))
925 (clobber (reg:DI 28))])
926 (set (match_operand:DI 0 "general_operand" "")
931 (define_expand "moddi3"
932 [(set (reg:DI 24) (match_operand:DI 1 "input_operand" ""))
933 (set (reg:DI 25) (match_operand:DI 2 "input_operand" ""))
934 (parallel [(set (reg:DI 27)
937 (clobber (reg:DI 23))
938 (clobber (reg:DI 28))])
939 (set (match_operand:DI 0 "general_operand" "")
944 (define_expand "umoddi3"
945 [(set (reg:DI 24) (match_operand:DI 1 "input_operand" ""))
946 (set (reg:DI 25) (match_operand:DI 2 "input_operand" ""))
947 (parallel [(set (reg:DI 27)
950 (clobber (reg:DI 23))
951 (clobber (reg:DI 28))])
952 (set (match_operand:DI 0 "general_operand" "")
957 ;; Lengths of 8 for ldq $t12,__divq($gp); jsr $t9,($t12),__divq as
958 ;; expanded by the assembler.
961 (sign_extend:DI (match_operator:SI 1 "divmod_operator"
962 [(reg:DI 24) (reg:DI 25)])))
963 (clobber (reg:DI 23))
964 (clobber (reg:DI 28))]
967 [(set_attr "type" "jsr")
968 (set_attr "length" "8")])
972 (match_operator:DI 1 "divmod_operator"
973 [(reg:DI 24) (reg:DI 25)]))
974 (clobber (reg:DI 23))
975 (clobber (reg:DI 28))]
978 [(set_attr "type" "jsr")
979 (set_attr "length" "8")])
981 ;; Next are the basic logical operations. These only exist in DImode.
983 (define_insn "anddi3"
984 [(set (match_operand:DI 0 "register_operand" "=r,r,r")
985 (and:DI (match_operand:DI 1 "reg_or_0_operand" "%rJ,rJ,rJ")
986 (match_operand:DI 2 "and_operand" "rI,N,MH")))]
992 [(set_attr "type" "ilog,ilog,shift")])
994 ;; There are times when we can split an AND into two AND insns. This occurs
995 ;; when we can first clear any bytes and then clear anything else. For
996 ;; example "I & 0xffff07" is "(I & 0xffffff) & 0xffffffffffffff07".
997 ;; Only do this when running on 64-bit host since the computations are
998 ;; too messy otherwise.
1001 [(set (match_operand:DI 0 "register_operand" "")
1002 (and:DI (match_operand:DI 1 "register_operand" "")
1003 (match_operand:DI 2 "const_int_operand" "")))]
1004 "HOST_BITS_PER_WIDE_INT == 64 && ! and_operand (operands[2], DImode)"
1005 [(set (match_dup 0) (and:DI (match_dup 1) (match_dup 3)))
1006 (set (match_dup 0) (and:DI (match_dup 0) (match_dup 4)))]
1009 unsigned HOST_WIDE_INT mask1 = INTVAL (operands[2]);
1010 unsigned HOST_WIDE_INT mask2 = mask1;
1013 /* For each byte that isn't all zeros, make it all ones. */
1014 for (i = 0; i < 64; i += 8)
1015 if ((mask1 & ((HOST_WIDE_INT) 0xff << i)) != 0)
1016 mask1 |= (HOST_WIDE_INT) 0xff << i;
1018 /* Now turn on any bits we've just turned off. */
1021 operands[3] = GEN_INT (mask1);
1022 operands[4] = GEN_INT (mask2);
1025 (define_insn "zero_extendqihi2"
1026 [(set (match_operand:HI 0 "register_operand" "=r")
1027 (zero_extend:HI (match_operand:QI 1 "register_operand" "r")))]
1030 [(set_attr "type" "ilog")])
1033 [(set (match_operand:SI 0 "register_operand" "=r,r")
1034 (zero_extend:SI (match_operand:QI 1 "nonimmediate_operand" "r,m")))]
1039 [(set_attr "type" "ilog,ild")])
1042 [(set (match_operand:SI 0 "register_operand" "=r")
1043 (zero_extend:SI (match_operand:QI 1 "register_operand" "r")))]
1046 [(set_attr "type" "ilog")])
1048 (define_expand "zero_extendqisi2"
1049 [(set (match_operand:SI 0 "register_operand" "")
1050 (zero_extend:SI (match_operand:QI 1 "register_operand" "")))]
1055 [(set (match_operand:DI 0 "register_operand" "=r,r")
1056 (zero_extend:DI (match_operand:QI 1 "nonimmediate_operand" "r,m")))]
1061 [(set_attr "type" "ilog,ild")])
1064 [(set (match_operand:DI 0 "register_operand" "=r")
1065 (zero_extend:DI (match_operand:QI 1 "register_operand" "r")))]
1068 [(set_attr "type" "ilog")])
1070 (define_expand "zero_extendqidi2"
1071 [(set (match_operand:DI 0 "register_operand" "")
1072 (zero_extend:DI (match_operand:QI 1 "register_operand" "")))]
1077 [(set (match_operand:SI 0 "register_operand" "=r,r")
1078 (zero_extend:SI (match_operand:HI 1 "nonimmediate_operand" "r,m")))]
1083 [(set_attr "type" "shift,ild")])
1086 [(set (match_operand:SI 0 "register_operand" "=r")
1087 (zero_extend:SI (match_operand:HI 1 "register_operand" "r")))]
1090 [(set_attr "type" "shift")])
1092 (define_expand "zero_extendhisi2"
1093 [(set (match_operand:SI 0 "register_operand" "")
1094 (zero_extend:SI (match_operand:HI 1 "register_operand" "")))]
1099 [(set (match_operand:DI 0 "register_operand" "=r,r")
1100 (zero_extend:DI (match_operand:HI 1 "nonimmediate_operand" "r,m")))]
1105 [(set_attr "type" "shift,ild")])
1108 [(set (match_operand:DI 0 "register_operand" "=r")
1109 (zero_extend:DI (match_operand:HI 1 "register_operand" "r")))]
1112 [(set_attr "type" "shift")])
1114 (define_expand "zero_extendhidi2"
1115 [(set (match_operand:DI 0 "register_operand" "")
1116 (zero_extend:DI (match_operand:HI 1 "register_operand" "")))]
1120 (define_insn "zero_extendsidi2"
1121 [(set (match_operand:DI 0 "register_operand" "=r")
1122 (zero_extend:DI (match_operand:SI 1 "register_operand" "r")))]
1125 [(set_attr "type" "shift")])
1128 [(set (match_operand:DI 0 "register_operand" "=r")
1129 (and:DI (not:DI (match_operand:DI 1 "reg_or_8bit_operand" "rI"))
1130 (match_operand:DI 2 "reg_or_0_operand" "rJ")))]
1133 [(set_attr "type" "ilog")])
1135 (define_insn "iordi3"
1136 [(set (match_operand:DI 0 "register_operand" "=r,r")
1137 (ior:DI (match_operand:DI 1 "reg_or_0_operand" "%rJ,rJ")
1138 (match_operand:DI 2 "or_operand" "rI,N")))]
1143 [(set_attr "type" "ilog")])
1145 (define_insn "one_cmpldi2"
1146 [(set (match_operand:DI 0 "register_operand" "=r")
1147 (not:DI (match_operand:DI 1 "reg_or_8bit_operand" "rI")))]
1150 [(set_attr "type" "ilog")])
1153 [(set (match_operand:DI 0 "register_operand" "=r")
1154 (ior:DI (not:DI (match_operand:DI 1 "reg_or_8bit_operand" "rI"))
1155 (match_operand:DI 2 "reg_or_0_operand" "rJ")))]
1158 [(set_attr "type" "ilog")])
1160 (define_insn "xordi3"
1161 [(set (match_operand:DI 0 "register_operand" "=r,r")
1162 (xor:DI (match_operand:DI 1 "reg_or_0_operand" "%rJ,rJ")
1163 (match_operand:DI 2 "or_operand" "rI,N")))]
1168 [(set_attr "type" "ilog")])
1171 [(set (match_operand:DI 0 "register_operand" "=r")
1172 (not:DI (xor:DI (match_operand:DI 1 "register_operand" "%rJ")
1173 (match_operand:DI 2 "register_operand" "rI"))))]
1176 [(set_attr "type" "ilog")])
1178 ;; Handle the FFS insn if we support CIX.
1180 (define_expand "ffsdi2"
1182 (unspec [(match_operand:DI 1 "register_operand" "")] 1))
1184 (plus:DI (match_dup 2) (const_int 1)))
1185 (set (match_operand:DI 0 "register_operand" "")
1186 (if_then_else:DI (eq (match_dup 1) (const_int 0))
1187 (const_int 0) (match_dup 3)))]
1191 operands[2] = gen_reg_rtx (DImode);
1192 operands[3] = gen_reg_rtx (DImode);
1196 [(set (match_operand:DI 0 "register_operand" "=r")
1197 (unspec [(match_operand:DI 1 "register_operand" "r")] 1))]
1200 ; ev6 calls all mvi and cttz/ctlz/popc class imisc, so just
1201 ; reuse the existing type name.
1202 [(set_attr "type" "mvi")])
1204 ;; Next come the shifts and the various extract and insert operations.
1206 (define_insn "ashldi3"
1207 [(set (match_operand:DI 0 "register_operand" "=r,r")
1208 (ashift:DI (match_operand:DI 1 "reg_or_0_operand" "rJ,rJ")
1209 (match_operand:DI 2 "reg_or_6bit_operand" "P,rS")))]
1213 switch (which_alternative)
1216 if (operands[2] == const1_rtx)
1217 return \"addq %r1,%r1,%0\";
1219 return \"s%P2addq %r1,0,%0\";
1221 return \"sll %r1,%2,%0\";
1226 [(set_attr "type" "iadd,shift")])
1228 ;; ??? The following pattern is made by combine, but earlier phases
1229 ;; (specifically flow) can't handle it. This occurs in jump.c. Deal
1230 ;; with this in a better way at some point.
1232 ;; [(set (match_operand:DI 0 "register_operand" "=r")
1234 ;; (subreg:SI (ashift:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
1235 ;; (match_operand:DI 2 "const_int_operand" "P"))
1237 ;; "INTVAL (operands[2]) >= 1 && INTVAL (operands[2]) <= 3"
1240 ;; if (operands[2] == const1_rtx)
1241 ;; return \"addl %r1,%r1,%0\";
1243 ;; return \"s%P2addl %r1,0,%0\";
1245 ;; [(set_attr "type" "iadd")])
1247 (define_insn "lshrdi3"
1248 [(set (match_operand:DI 0 "register_operand" "=r")
1249 (lshiftrt:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
1250 (match_operand:DI 2 "reg_or_6bit_operand" "rS")))]
1253 [(set_attr "type" "shift")])
1255 (define_insn "ashrdi3"
1256 [(set (match_operand:DI 0 "register_operand" "=r")
1257 (ashiftrt:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
1258 (match_operand:DI 2 "reg_or_6bit_operand" "rS")))]
1261 [(set_attr "type" "shift")])
1263 (define_expand "extendqihi2"
1265 (ashift:DI (match_operand:QI 1 "some_operand" "")
1267 (set (match_operand:HI 0 "register_operand" "")
1268 (ashiftrt:DI (match_dup 2)
1275 emit_insn (gen_extendqihi2x (operands[0],
1276 force_reg (QImode, operands[1])));
1280 /* If we have an unaligned MEM, extend to DImode (which we do
1281 specially) and then copy to the result. */
1282 if (unaligned_memory_operand (operands[1], HImode))
1284 rtx temp = gen_reg_rtx (DImode);
1286 emit_insn (gen_extendqidi2 (temp, operands[1]));
1287 emit_move_insn (operands[0], gen_lowpart (HImode, temp));
1291 operands[0] = gen_lowpart (DImode, operands[0]);
1292 operands[1] = gen_lowpart (DImode, force_reg (QImode, operands[1]));
1293 operands[2] = gen_reg_rtx (DImode);
1296 (define_insn "extendqidi2x"
1297 [(set (match_operand:DI 0 "register_operand" "=r")
1298 (sign_extend:DI (match_operand:QI 1 "register_operand" "r")))]
1301 [(set_attr "type" "shift")])
1303 (define_insn "extendhidi2x"
1304 [(set (match_operand:DI 0 "register_operand" "=r")
1305 (sign_extend:DI (match_operand:HI 1 "register_operand" "r")))]
1308 [(set_attr "type" "shift")])
1310 (define_insn "extendqisi2x"
1311 [(set (match_operand:SI 0 "register_operand" "=r")
1312 (sign_extend:SI (match_operand:QI 1 "register_operand" "r")))]
1315 [(set_attr "type" "shift")])
1317 (define_insn "extendhisi2x"
1318 [(set (match_operand:SI 0 "register_operand" "=r")
1319 (sign_extend:SI (match_operand:HI 1 "register_operand" "r")))]
1322 [(set_attr "type" "shift")])
1324 (define_insn "extendqihi2x"
1325 [(set (match_operand:HI 0 "register_operand" "=r")
1326 (sign_extend:HI (match_operand:QI 1 "register_operand" "r")))]
1329 [(set_attr "type" "shift")])
1331 (define_expand "extendqisi2"
1333 (ashift:DI (match_operand:QI 1 "some_operand" "")
1335 (set (match_operand:SI 0 "register_operand" "")
1336 (ashiftrt:DI (match_dup 2)
1343 emit_insn (gen_extendqisi2x (operands[0],
1344 force_reg (QImode, operands[1])));
1348 /* If we have an unaligned MEM, extend to a DImode form of
1349 the result (which we do specially). */
1350 if (unaligned_memory_operand (operands[1], QImode))
1352 rtx temp = gen_reg_rtx (DImode);
1354 emit_insn (gen_extendqidi2 (temp, operands[1]));
1355 emit_move_insn (operands[0], gen_lowpart (SImode, temp));
1359 operands[0] = gen_lowpart (DImode, operands[0]);
1360 operands[1] = gen_lowpart (DImode, force_reg (QImode, operands[1]));
1361 operands[2] = gen_reg_rtx (DImode);
1364 (define_expand "extendqidi2"
1366 (ashift:DI (match_operand:QI 1 "some_operand" "")
1368 (set (match_operand:DI 0 "register_operand" "")
1369 (ashiftrt:DI (match_dup 2)
1376 emit_insn (gen_extendqidi2x (operands[0],
1377 force_reg (QImode, operands[1])));
1381 if (unaligned_memory_operand (operands[1], QImode))
1384 = gen_unaligned_extendqidi (operands[0],
1385 get_unaligned_address (operands[1], 1));
1387 alpha_set_memflags (seq, operands[1]);
1392 operands[1] = gen_lowpart (DImode, force_reg (QImode, operands[1]));
1393 operands[2] = gen_reg_rtx (DImode);
1396 (define_expand "extendhisi2"
1398 (ashift:DI (match_operand:HI 1 "some_operand" "")
1400 (set (match_operand:SI 0 "register_operand" "")
1401 (ashiftrt:DI (match_dup 2)
1408 emit_insn (gen_extendhisi2x (operands[0],
1409 force_reg (HImode, operands[1])));
1413 /* If we have an unaligned MEM, extend to a DImode form of
1414 the result (which we do specially). */
1415 if (unaligned_memory_operand (operands[1], HImode))
1417 rtx temp = gen_reg_rtx (DImode);
1419 emit_insn (gen_extendhidi2 (temp, operands[1]));
1420 emit_move_insn (operands[0], gen_lowpart (SImode, temp));
1424 operands[0] = gen_lowpart (DImode, operands[0]);
1425 operands[1] = gen_lowpart (DImode, force_reg (HImode, operands[1]));
1426 operands[2] = gen_reg_rtx (DImode);
1429 (define_expand "extendhidi2"
1431 (ashift:DI (match_operand:HI 1 "some_operand" "")
1433 (set (match_operand:DI 0 "register_operand" "")
1434 (ashiftrt:DI (match_dup 2)
1441 emit_insn (gen_extendhidi2x (operands[0],
1442 force_reg (HImode, operands[1])));
1446 if (unaligned_memory_operand (operands[1], HImode))
1449 = gen_unaligned_extendhidi (operands[0],
1450 get_unaligned_address (operands[1], 2));
1452 alpha_set_memflags (seq, operands[1]);
1457 operands[1] = gen_lowpart (DImode, force_reg (HImode, operands[1]));
1458 operands[2] = gen_reg_rtx (DImode);
1461 ;; Here's how we sign extend an unaligned byte and halfword. Doing this
1462 ;; as a pattern saves one instruction. The code is similar to that for
1463 ;; the unaligned loads (see below).
1465 ;; Operand 1 is the address + 1 (+2 for HI), operand 0 is the result.
1466 (define_expand "unaligned_extendqidi"
1467 [(set (match_dup 2) (match_operand:DI 1 "address_operand" ""))
1469 (mem:DI (and:DI (plus:DI (match_dup 2) (const_int -1))
1472 (ashift:DI (match_dup 3)
1473 (minus:DI (const_int 56)
1475 (and:DI (plus:DI (match_dup 2) (const_int -1))
1478 (set (subreg:DI (match_operand:QI 0 "register_operand" "") 0)
1479 (ashiftrt:DI (match_dup 4) (const_int 56)))]
1482 { operands[2] = gen_reg_rtx (DImode);
1483 operands[3] = gen_reg_rtx (DImode);
1484 operands[4] = gen_reg_rtx (DImode);
1487 (define_expand "unaligned_extendhidi"
1488 [(set (match_dup 2) (match_operand:DI 1 "address_operand" ""))
1490 (mem:DI (and:DI (plus:DI (match_dup 2) (const_int -2))
1493 (ashift:DI (match_dup 3)
1494 (minus:DI (const_int 56)
1496 (and:DI (plus:DI (match_dup 2) (const_int -1))
1499 (set (subreg:DI (match_operand:QI 0 "register_operand" "") 0)
1500 (ashiftrt:DI (match_dup 4) (const_int 48)))]
1503 { operands[2] = gen_reg_rtx (DImode);
1504 operands[3] = gen_reg_rtx (DImode);
1505 operands[4] = gen_reg_rtx (DImode);
1509 [(set (match_operand:DI 0 "register_operand" "=r")
1510 (zero_extract:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
1511 (match_operand:DI 2 "mode_width_operand" "n")
1512 (match_operand:DI 3 "mul8_operand" "I")))]
1514 "ext%M2l %r1,%s3,%0"
1515 [(set_attr "type" "shift")])
1517 (define_insn "extxl"
1518 [(set (match_operand:DI 0 "register_operand" "=r")
1519 (zero_extract:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
1520 (match_operand:DI 2 "mode_width_operand" "n")
1521 (ashift:DI (match_operand:DI 3 "reg_or_8bit_operand" "rI")
1525 [(set_attr "type" "shift")])
1527 ;; Combine has some strange notion of preserving existing undefined behaviour
1528 ;; in shifts larger than a word size. So capture these patterns that it
1529 ;; should have turned into zero_extracts.
1532 [(set (match_operand:DI 0 "register_operand" "=r")
1533 (and (lshiftrt:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
1534 (ashift:DI (match_operand:DI 2 "reg_or_8bit_operand" "rI")
1536 (match_operand:DI 3 "mode_mask_operand" "n")))]
1539 [(set_attr "type" "shift")])
1542 [(set (match_operand:DI 0 "register_operand" "=r")
1543 (lshiftrt:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
1544 (ashift:DI (match_operand:DI 2 "reg_or_8bit_operand" "rI")
1548 [(set_attr "type" "shift")])
1550 (define_insn "extqh"
1551 [(set (match_operand:DI 0 "register_operand" "=r")
1553 (match_operand:DI 1 "reg_or_0_operand" "rJ")
1554 (minus:DI (const_int 56)
1557 (plus:DI (match_operand:DI 2 "reg_or_8bit_operand" "rI")
1563 [(set_attr "type" "shift")])
1565 (define_insn "extlh"
1566 [(set (match_operand:DI 0 "register_operand" "=r")
1568 (and:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
1569 (const_int 2147483647))
1570 (minus:DI (const_int 56)
1573 (plus:DI (match_operand:DI 2 "reg_or_8bit_operand" "rI")
1579 [(set_attr "type" "shift")])
1581 (define_insn "extwh"
1582 [(set (match_operand:DI 0 "register_operand" "=r")
1584 (and:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
1586 (minus:DI (const_int 56)
1589 (plus:DI (match_operand:DI 2 "reg_or_8bit_operand" "rI")
1595 [(set_attr "type" "shift")])
1597 ;; This converts an extXl into an extXh with an appropriate adjustment
1598 ;; to the address calculation.
1601 ;; [(set (match_operand:DI 0 "register_operand" "")
1602 ;; (ashift:DI (zero_extract:DI (match_operand:DI 1 "register_operand" "")
1603 ;; (match_operand:DI 2 "mode_width_operand" "")
1604 ;; (ashift:DI (match_operand:DI 3 "" "")
1606 ;; (match_operand:DI 4 "const_int_operand" "")))
1607 ;; (clobber (match_operand:DI 5 "register_operand" ""))]
1608 ;; "INTVAL (operands[4]) == 64 - INTVAL (operands[2])"
1609 ;; [(set (match_dup 5) (match_dup 6))
1610 ;; (set (match_dup 0)
1611 ;; (ashift:DI (zero_extract:DI (match_dup 1) (match_dup 2)
1612 ;; (ashift:DI (plus:DI (match_dup 5)
1618 ;; operands[6] = plus_constant (operands[3],
1619 ;; INTVAL (operands[2]) / BITS_PER_UNIT);
1620 ;; operands[7] = GEN_INT (- INTVAL (operands[2]) / BITS_PER_UNIT);
1624 [(set (match_operand:DI 0 "register_operand" "=r")
1625 (ashift:DI (zero_extend:DI (match_operand:QI 1 "register_operand" "r"))
1626 (match_operand:DI 2 "mul8_operand" "I")))]
1629 [(set_attr "type" "shift")])
1632 [(set (match_operand:DI 0 "register_operand" "=r")
1633 (ashift:DI (zero_extend:DI (match_operand:HI 1 "register_operand" "r"))
1634 (match_operand:DI 2 "mul8_operand" "I")))]
1637 [(set_attr "type" "shift")])
1640 [(set (match_operand:DI 0 "register_operand" "=r")
1641 (ashift:DI (zero_extend:DI (match_operand:SI 1 "register_operand" "r"))
1642 (match_operand:DI 2 "mul8_operand" "I")))]
1645 [(set_attr "type" "shift")])
1647 (define_insn "insbl"
1648 [(set (match_operand:DI 0 "register_operand" "=r")
1649 (ashift:DI (zero_extend:DI (match_operand:QI 1 "register_operand" "r"))
1650 (ashift:DI (match_operand:DI 2 "reg_or_8bit_operand" "rI")
1654 [(set_attr "type" "shift")])
1656 (define_insn "inswl"
1657 [(set (match_operand:DI 0 "register_operand" "=r")
1658 (ashift:DI (zero_extend:DI (match_operand:HI 1 "register_operand" "r"))
1659 (ashift:DI (match_operand:DI 2 "reg_or_8bit_operand" "rI")
1663 [(set_attr "type" "shift")])
1665 (define_insn "insll"
1666 [(set (match_operand:DI 0 "register_operand" "=r")
1667 (ashift:DI (zero_extend:DI (match_operand:SI 1 "register_operand" "r"))
1668 (ashift:DI (match_operand:DI 2 "reg_or_8bit_operand" "rI")
1672 [(set_attr "type" "shift")])
1674 (define_insn "insql"
1675 [(set (match_operand:DI 0 "register_operand" "=r")
1676 (ashift:DI (match_operand:DI 1 "register_operand" "r")
1677 (ashift:DI (match_operand:DI 2 "reg_or_8bit_operand" "rI")
1681 [(set_attr "type" "shift")])
1683 ;; Combine has this sometimes habit of moving the and outside of the
1684 ;; shift, making life more interesting.
1687 [(set (match_operand:DI 0 "register_operand" "=r")
1688 (and:DI (ashift:DI (match_operand:DI 1 "register_operand" "r")
1689 (match_operand:DI 2 "mul8_operand" "I"))
1690 (match_operand:DI 3 "immediate_operand" "i")))]
1691 "HOST_BITS_PER_WIDE_INT == 64
1692 && GET_CODE (operands[3]) == CONST_INT
1693 && (((unsigned HOST_WIDE_INT) 0xff << INTVAL (operands[2])
1694 == (unsigned HOST_WIDE_INT) INTVAL (operands[3]))
1695 || ((unsigned HOST_WIDE_INT) 0xffff << INTVAL (operands[2])
1696 == (unsigned HOST_WIDE_INT) INTVAL (operands[3]))
1697 || ((unsigned HOST_WIDE_INT) 0xffffffff << INTVAL (operands[2])
1698 == (unsigned HOST_WIDE_INT) INTVAL (operands[3])))"
1701 #if HOST_BITS_PER_WIDE_INT == 64
1702 if ((unsigned HOST_WIDE_INT) 0xff << INTVAL (operands[2])
1703 == (unsigned HOST_WIDE_INT) INTVAL (operands[3]))
1704 return \"insbl %1,%s2,%0\";
1705 if ((unsigned HOST_WIDE_INT) 0xffff << INTVAL (operands[2])
1706 == (unsigned HOST_WIDE_INT) INTVAL (operands[3]))
1707 return \"inswl %1,%s2,%0\";
1708 if ((unsigned HOST_WIDE_INT) 0xffffffff << INTVAL (operands[2])
1709 == (unsigned HOST_WIDE_INT) INTVAL (operands[3]))
1710 return \"insll %1,%s2,%0\";
1714 [(set_attr "type" "shift")])
1716 ;; We do not include the insXh insns because they are complex to express
1717 ;; and it does not appear that we would ever want to generate them.
1719 ;; Since we need them for block moves, though, cop out and use unspec.
1721 (define_insn "insxh"
1722 [(set (match_operand:DI 0 "register_operand" "=r")
1723 (unspec [(match_operand:DI 1 "register_operand" "r")
1724 (match_operand:DI 2 "mode_width_operand" "n")
1725 (match_operand:DI 3 "reg_or_8bit_operand" "rI")] 2))]
1728 [(set_attr "type" "shift")])
1730 (define_insn "mskxl"
1731 [(set (match_operand:DI 0 "register_operand" "=r")
1732 (and:DI (not:DI (ashift:DI
1733 (match_operand:DI 2 "mode_mask_operand" "n")
1735 (match_operand:DI 3 "reg_or_8bit_operand" "rI")
1737 (match_operand:DI 1 "reg_or_0_operand" "rJ")))]
1740 [(set_attr "type" "shift")])
1742 ;; We do not include the mskXh insns because it does not appear we would
1743 ;; ever generate one.
1745 ;; Again, we do for block moves and we use unspec again.
1747 (define_insn "mskxh"
1748 [(set (match_operand:DI 0 "register_operand" "=r")
1749 (unspec [(match_operand:DI 1 "register_operand" "r")
1750 (match_operand:DI 2 "mode_width_operand" "n")
1751 (match_operand:DI 3 "reg_or_8bit_operand" "rI")] 3))]
1754 [(set_attr "type" "shift")])
1756 ;; Floating-point operations. All the double-precision insns can extend
1757 ;; from single, so indicate that. The exception are the ones that simply
1758 ;; play with the sign bits; it's not clear what to do there.
1760 (define_insn "abssf2"
1761 [(set (match_operand:SF 0 "register_operand" "=f")
1762 (abs:SF (match_operand:SF 1 "reg_or_fp0_operand" "fG")))]
1765 [(set_attr "type" "fcpys")])
1767 (define_insn "absdf2"
1768 [(set (match_operand:DF 0 "register_operand" "=f")
1769 (abs:DF (match_operand:DF 1 "reg_or_fp0_operand" "fG")))]
1772 [(set_attr "type" "fcpys")])
1774 (define_insn "negsf2"
1775 [(set (match_operand:SF 0 "register_operand" "=f")
1776 (neg:SF (match_operand:SF 1 "reg_or_fp0_operand" "fG")))]
1779 [(set_attr "type" "fadd")])
1781 (define_insn "negdf2"
1782 [(set (match_operand:DF 0 "register_operand" "=f")
1783 (neg:DF (match_operand:DF 1 "reg_or_fp0_operand" "fG")))]
1786 [(set_attr "type" "fadd")])
1789 [(set (match_operand:SF 0 "register_operand" "=&f")
1790 (plus:SF (match_operand:SF 1 "reg_or_fp0_operand" "%fG")
1791 (match_operand:SF 2 "reg_or_fp0_operand" "fG")))]
1792 "TARGET_FP && alpha_tp == ALPHA_TP_INSN"
1793 "add%,%)%& %R1,%R2,%0"
1794 [(set_attr "type" "fadd")
1795 (set_attr "trap" "yes")])
1797 (define_insn "addsf3"
1798 [(set (match_operand:SF 0 "register_operand" "=f")
1799 (plus:SF (match_operand:SF 1 "reg_or_fp0_operand" "%fG")
1800 (match_operand:SF 2 "reg_or_fp0_operand" "fG")))]
1802 "add%,%)%& %R1,%R2,%0"
1803 [(set_attr "type" "fadd")
1804 (set_attr "trap" "yes")])
1807 [(set (match_operand:DF 0 "register_operand" "=&f")
1808 (plus:DF (match_operand:DF 1 "reg_or_fp0_operand" "%fG")
1809 (match_operand:DF 2 "reg_or_fp0_operand" "fG")))]
1810 "TARGET_FP && alpha_tp == ALPHA_TP_INSN"
1811 "add%-%)%& %R1,%R2,%0"
1812 [(set_attr "type" "fadd")
1813 (set_attr "trap" "yes")])
1815 (define_insn "adddf3"
1816 [(set (match_operand:DF 0 "register_operand" "=f")
1817 (plus:DF (match_operand:DF 1 "reg_or_fp0_operand" "%fG")
1818 (match_operand:DF 2 "reg_or_fp0_operand" "fG")))]
1820 "add%-%)%& %R1,%R2,%0"
1821 [(set_attr "type" "fadd")
1822 (set_attr "trap" "yes")])
1825 [(set (match_operand:DF 0 "register_operand" "=f")
1826 (plus:DF (float_extend:DF
1827 (match_operand:SF 1 "reg_or_fp0_operand" "fG"))
1828 (match_operand:DF 2 "reg_or_fp0_operand" "fG")))]
1829 "TARGET_FP && alpha_tp != ALPHA_TP_INSN"
1830 "add%-%)%& %R1,%R2,%0"
1831 [(set_attr "type" "fadd")
1832 (set_attr "trap" "yes")])
1835 [(set (match_operand:DF 0 "register_operand" "=f")
1836 (plus:DF (float_extend:DF
1837 (match_operand:SF 1 "reg_or_fp0_operand" "%fG"))
1839 (match_operand:SF 2 "reg_or_fp0_operand" "fG"))))]
1840 "TARGET_FP && alpha_tp != ALPHA_TP_INSN"
1841 "add%-%)%& %R1,%R2,%0"
1842 [(set_attr "type" "fadd")
1843 (set_attr "trap" "yes")])
1845 ;; Define conversion operators between DFmode and SImode, using the cvtql
1846 ;; instruction. To allow combine et al to do useful things, we keep the
1847 ;; operation as a unit until after reload, at which point we split the
1850 ;; Note that we (attempt to) only consider this optimization when the
1851 ;; ultimate destination is memory. If we will be doing further integer
1852 ;; processing, it is cheaper to do the truncation in the int regs.
1854 (define_insn "*cvtql"
1855 [(set (match_operand:SI 0 "register_operand" "=f")
1856 (unspec:SI [(match_operand:DI 1 "reg_or_fp0_operand" "fG")] 5))]
1859 [(set_attr "type" "fadd")
1860 (set_attr "trap" "yes")])
1863 [(set (match_operand:SI 0 "memory_operand" "")
1864 (subreg:SI (fix:DI (match_operand:DF 1 "reg_or_fp0_operand" "")) 0))
1865 (clobber (match_scratch:DI 2 ""))
1866 (clobber (match_scratch:SI 3 ""))]
1867 "TARGET_FP && reload_completed"
1868 [(set (match_dup 2) (fix:DI (match_dup 1)))
1869 (set (match_dup 3) (unspec:SI [(match_dup 2)] 5))
1870 (set (match_dup 0) (match_dup 3))]
1874 [(set (match_operand:SI 0 "memory_operand" "")
1875 (subreg:SI (fix:DI (match_operand:DF 1 "reg_or_fp0_operand" "")) 0))
1876 (clobber (match_scratch:DI 2 ""))]
1877 "TARGET_FP && reload_completed"
1878 [(set (match_dup 2) (fix:DI (match_dup 1)))
1879 (set (match_dup 3) (unspec:SI [(match_dup 2)] 5))
1880 (set (match_dup 0) (match_dup 3))]
1881 ;; Due to REG_CANNOT_CHANGE_SIZE issues, we cannot simply use SUBREG.
1882 "operands[3] = gen_rtx_REG (SImode, REGNO (operands[2]));")
1885 [(set (match_operand:SI 0 "memory_operand" "=m")
1886 (subreg:SI (fix:DI (match_operand:DF 1 "reg_or_fp0_operand" "fG")) 0))
1887 (clobber (match_scratch:DI 2 "=&f"))
1888 (clobber (match_scratch:SI 3 "=&f"))]
1889 "TARGET_FP && alpha_tp == ALPHA_TP_INSN"
1891 [(set_attr "type" "fadd")
1892 (set_attr "trap" "yes")])
1895 [(set (match_operand:SI 0 "memory_operand" "=m")
1896 (subreg:SI (fix:DI (match_operand:DF 1 "reg_or_fp0_operand" "fG")) 0))
1897 (clobber (match_scratch:DI 2 "=f"))]
1898 "TARGET_FP && alpha_tp != ALPHA_TP_INSN"
1900 [(set_attr "type" "fadd")
1901 (set_attr "trap" "yes")])
1904 [(set (match_operand:DI 0 "register_operand" "=&f")
1905 (fix:DI (match_operand:DF 1 "reg_or_fp0_operand" "fG")))]
1906 "TARGET_FP && alpha_tp == ALPHA_TP_INSN"
1908 [(set_attr "type" "fadd")
1909 (set_attr "trap" "yes")])
1911 (define_insn "fix_truncdfdi2"
1912 [(set (match_operand:DI 0 "register_operand" "=f")
1913 (fix:DI (match_operand:DF 1 "reg_or_fp0_operand" "fG")))]
1916 [(set_attr "type" "fadd")
1917 (set_attr "trap" "yes")])
1919 ;; Likewise between SFmode and SImode.
1922 [(set (match_operand:SI 0 "memory_operand" "")
1923 (subreg:SI (fix:DI (float_extend:DF
1924 (match_operand:SF 1 "reg_or_fp0_operand" ""))) 0))
1925 (clobber (match_scratch:DI 2 ""))
1926 (clobber (match_scratch:SI 3 ""))]
1927 "TARGET_FP && reload_completed"
1928 [(set (match_dup 2) (fix:DI (float_extend:DF (match_dup 1))))
1929 (set (match_dup 3) (unspec:SI [(match_dup 2)] 5))
1930 (set (match_dup 0) (match_dup 3))]
1934 [(set (match_operand:SI 0 "memory_operand" "")
1935 (subreg:SI (fix:DI (float_extend:DF
1936 (match_operand:SF 1 "reg_or_fp0_operand" ""))) 0))
1937 (clobber (match_scratch:DI 2 ""))]
1938 "TARGET_FP && reload_completed"
1939 [(set (match_dup 2) (fix:DI (float_extend:DF (match_dup 1))))
1940 (set (match_dup 3) (unspec:SI [(match_dup 2)] 5))
1941 (set (match_dup 0) (match_dup 3))]
1942 ;; Due to REG_CANNOT_CHANGE_SIZE issues, we cannot simply use SUBREG.
1943 "operands[3] = gen_rtx_REG (SImode, REGNO (operands[2]));")
1946 [(set (match_operand:SI 0 "memory_operand" "=m")
1947 (subreg:SI (fix:DI (float_extend:DF
1948 (match_operand:SF 1 "reg_or_fp0_operand" "fG"))) 0))
1949 (clobber (match_scratch:DI 2 "=&f"))
1950 (clobber (match_scratch:SI 3 "=&f"))]
1951 "TARGET_FP && alpha_tp == ALPHA_TP_INSN"
1953 [(set_attr "type" "fadd")
1954 (set_attr "trap" "yes")])
1957 [(set (match_operand:SI 0 "memory_operand" "=m")
1958 (subreg:SI (fix:DI (float_extend:DF
1959 (match_operand:SF 1 "reg_or_fp0_operand" "fG"))) 0))
1960 (clobber (match_scratch:DI 2 "=f"))]
1961 "TARGET_FP && alpha_tp != ALPHA_TP_INSN"
1963 [(set_attr "type" "fadd")
1964 (set_attr "trap" "yes")])
1967 [(set (match_operand:DI 0 "register_operand" "=&f")
1968 (fix:DI (float_extend:DF
1969 (match_operand:SF 1 "reg_or_fp0_operand" "fG"))))]
1970 "TARGET_FP && alpha_tp == ALPHA_TP_INSN"
1972 [(set_attr "type" "fadd")
1973 (set_attr "trap" "yes")])
1975 (define_insn "fix_truncsfdi2"
1976 [(set (match_operand:DI 0 "register_operand" "=f")
1977 (fix:DI (float_extend:DF
1978 (match_operand:SF 1 "reg_or_fp0_operand" "fG"))))]
1981 [(set_attr "type" "fadd")
1982 (set_attr "trap" "yes")])
1985 [(set (match_operand:SF 0 "register_operand" "=&f")
1986 (float:SF (match_operand:DI 1 "register_operand" "f")))]
1987 "TARGET_FP && alpha_tp == ALPHA_TP_INSN"
1989 [(set_attr "type" "fadd")
1990 (set_attr "trap" "yes")])
1992 (define_insn "floatdisf2"
1993 [(set (match_operand:SF 0 "register_operand" "=f")
1994 (float:SF (match_operand:DI 1 "register_operand" "f")))]
1997 [(set_attr "type" "fadd")
1998 (set_attr "trap" "yes")])
2001 [(set (match_operand:DF 0 "register_operand" "=&f")
2002 (float:DF (match_operand:DI 1 "register_operand" "f")))]
2003 "TARGET_FP && alpha_tp == ALPHA_TP_INSN"
2005 [(set_attr "type" "fadd")
2006 (set_attr "trap" "yes")])
2008 (define_insn "floatdidf2"
2009 [(set (match_operand:DF 0 "register_operand" "=f")
2010 (float:DF (match_operand:DI 1 "register_operand" "f")))]
2013 [(set_attr "type" "fadd")
2014 (set_attr "trap" "yes")])
2016 (define_expand "extendsfdf2"
2017 [(use (match_operand:DF 0 "register_operand" ""))
2018 (use (match_operand:SF 1 "nonimmediate_operand" ""))]
2022 if (alpha_tp == ALPHA_TP_INSN)
2023 emit_insn (gen_extendsfdf2_tp (operands[0],
2024 force_reg (SFmode, operands[1])));
2026 emit_insn (gen_extendsfdf2_no_tp (operands[0], operands[1]));
2031 (define_insn "extendsfdf2_tp"
2032 [(set (match_operand:DF 0 "register_operand" "=&f")
2033 (float_extend:DF (match_operand:SF 1 "register_operand" "f")))]
2034 "TARGET_FP && alpha_tp == ALPHA_TP_INSN"
2036 [(set_attr "type" "fadd")
2037 (set_attr "trap" "yes")])
2039 (define_insn "extendsfdf2_no_tp"
2040 [(set (match_operand:DF 0 "register_operand" "=f,f,m")
2041 (float_extend:DF (match_operand:SF 1 "nonimmediate_operand" "f,m,f")))]
2042 "TARGET_FP && alpha_tp != ALPHA_TP_INSN"
2047 [(set_attr "type" "fcpys,fld,fst")
2048 (set_attr "trap" "yes")])
2051 [(set (match_operand:SF 0 "register_operand" "=&f")
2052 (float_truncate:SF (match_operand:DF 1 "reg_or_fp0_operand" "fG")))]
2053 "TARGET_FP && alpha_tp == ALPHA_TP_INSN"
2054 "cvt%-%,%)%& %R1,%0"
2055 [(set_attr "type" "fadd")
2056 (set_attr "trap" "yes")])
2058 (define_insn "truncdfsf2"
2059 [(set (match_operand:SF 0 "register_operand" "=f")
2060 (float_truncate:SF (match_operand:DF 1 "reg_or_fp0_operand" "fG")))]
2062 "cvt%-%,%)%& %R1,%0"
2063 [(set_attr "type" "fadd")
2064 (set_attr "trap" "yes")])
2067 [(set (match_operand:SF 0 "register_operand" "=&f")
2068 (div:SF (match_operand:SF 1 "reg_or_fp0_operand" "fG")
2069 (match_operand:SF 2 "reg_or_fp0_operand" "fG")))]
2070 "TARGET_FP && alpha_tp == ALPHA_TP_INSN"
2071 "div%,%)%& %R1,%R2,%0"
2072 [(set_attr "type" "fdiv")
2073 (set_attr "opsize" "si")
2074 (set_attr "trap" "yes")])
2076 (define_insn "divsf3"
2077 [(set (match_operand:SF 0 "register_operand" "=f")
2078 (div:SF (match_operand:SF 1 "reg_or_fp0_operand" "fG")
2079 (match_operand:SF 2 "reg_or_fp0_operand" "fG")))]
2081 "div%,%)%& %R1,%R2,%0"
2082 [(set_attr "type" "fdiv")
2083 (set_attr "opsize" "si")
2084 (set_attr "trap" "yes")])
2087 [(set (match_operand:DF 0 "register_operand" "=&f")
2088 (div:DF (match_operand:DF 1 "reg_or_fp0_operand" "fG")
2089 (match_operand:DF 2 "reg_or_fp0_operand" "fG")))]
2090 "TARGET_FP && alpha_tp == ALPHA_TP_INSN"
2091 "div%-%)%& %R1,%R2,%0"
2092 [(set_attr "type" "fdiv")
2093 (set_attr "trap" "yes")])
2095 (define_insn "divdf3"
2096 [(set (match_operand:DF 0 "register_operand" "=f")
2097 (div:DF (match_operand:DF 1 "reg_or_fp0_operand" "fG")
2098 (match_operand:DF 2 "reg_or_fp0_operand" "fG")))]
2100 "div%-%)%& %R1,%R2,%0"
2101 [(set_attr "type" "fdiv")
2102 (set_attr "trap" "yes")])
2105 [(set (match_operand:DF 0 "register_operand" "=f")
2106 (div:DF (float_extend:DF (match_operand:SF 1 "reg_or_fp0_operand" "fG"))
2107 (match_operand:DF 2 "reg_or_fp0_operand" "fG")))]
2108 "TARGET_FP && alpha_tp != ALPHA_TP_INSN"
2109 "div%-%)%& %R1,%R2,%0"
2110 [(set_attr "type" "fdiv")
2111 (set_attr "trap" "yes")])
2114 [(set (match_operand:DF 0 "register_operand" "=f")
2115 (div:DF (match_operand:DF 1 "reg_or_fp0_operand" "fG")
2117 (match_operand:SF 2 "reg_or_fp0_operand" "fG"))))]
2118 "TARGET_FP && alpha_tp != ALPHA_TP_INSN"
2119 "div%-%)%& %R1,%R2,%0"
2120 [(set_attr "type" "fdiv")
2121 (set_attr "trap" "yes")])
2124 [(set (match_operand:DF 0 "register_operand" "=f")
2125 (div:DF (float_extend:DF (match_operand:SF 1 "reg_or_fp0_operand" "fG"))
2126 (float_extend:DF (match_operand:SF 2 "reg_or_fp0_operand" "fG"))))]
2127 "TARGET_FP && alpha_tp != ALPHA_TP_INSN"
2128 "div%-%)%& %R1,%R2,%0"
2129 [(set_attr "type" "fdiv")
2130 (set_attr "trap" "yes")])
2133 [(set (match_operand:SF 0 "register_operand" "=&f")
2134 (mult:SF (match_operand:SF 1 "reg_or_fp0_operand" "%fG")
2135 (match_operand:SF 2 "reg_or_fp0_operand" "fG")))]
2136 "TARGET_FP && alpha_tp == ALPHA_TP_INSN"
2137 "mul%,%)%& %R1,%R2,%0"
2138 [(set_attr "type" "fmul")
2139 (set_attr "trap" "yes")])
2141 (define_insn "mulsf3"
2142 [(set (match_operand:SF 0 "register_operand" "=f")
2143 (mult:SF (match_operand:SF 1 "reg_or_fp0_operand" "%fG")
2144 (match_operand:SF 2 "reg_or_fp0_operand" "fG")))]
2146 "mul%,%)%& %R1,%R2,%0"
2147 [(set_attr "type" "fmul")
2148 (set_attr "trap" "yes")])
2151 [(set (match_operand:DF 0 "register_operand" "=&f")
2152 (mult:DF (match_operand:DF 1 "reg_or_fp0_operand" "%fG")
2153 (match_operand:DF 2 "reg_or_fp0_operand" "fG")))]
2154 "TARGET_FP && alpha_tp == ALPHA_TP_INSN"
2155 "mul%-%)%& %R1,%R2,%0"
2156 [(set_attr "type" "fmul")
2157 (set_attr "trap" "yes")])
2159 (define_insn "muldf3"
2160 [(set (match_operand:DF 0 "register_operand" "=f")
2161 (mult:DF (match_operand:DF 1 "reg_or_fp0_operand" "%fG")
2162 (match_operand:DF 2 "reg_or_fp0_operand" "fG")))]
2164 "mul%-%)%& %R1,%R2,%0"
2165 [(set_attr "type" "fmul")
2166 (set_attr "trap" "yes")])
2169 [(set (match_operand:DF 0 "register_operand" "=f")
2170 (mult:DF (float_extend:DF
2171 (match_operand:SF 1 "reg_or_fp0_operand" "fG"))
2172 (match_operand:DF 2 "reg_or_fp0_operand" "fG")))]
2173 "TARGET_FP && alpha_tp != ALPHA_TP_INSN"
2174 "mul%-%)%& %R1,%R2,%0"
2175 [(set_attr "type" "fmul")
2176 (set_attr "trap" "yes")])
2179 [(set (match_operand:DF 0 "register_operand" "=f")
2180 (mult:DF (float_extend:DF
2181 (match_operand:SF 1 "reg_or_fp0_operand" "%fG"))
2183 (match_operand:SF 2 "reg_or_fp0_operand" "fG"))))]
2184 "TARGET_FP && alpha_tp != ALPHA_TP_INSN"
2185 "mul%-%)%& %R1,%R2,%0"
2186 [(set_attr "type" "fmul")
2187 (set_attr "trap" "yes")])
2190 [(set (match_operand:SF 0 "register_operand" "=&f")
2191 (minus:SF (match_operand:SF 1 "reg_or_fp0_operand" "fG")
2192 (match_operand:SF 2 "reg_or_fp0_operand" "fG")))]
2193 "TARGET_FP && alpha_tp == ALPHA_TP_INSN"
2194 "sub%,%)%& %R1,%R2,%0"
2195 [(set_attr "type" "fadd")
2196 (set_attr "trap" "yes")])
2198 (define_insn "subsf3"
2199 [(set (match_operand:SF 0 "register_operand" "=f")
2200 (minus:SF (match_operand:SF 1 "reg_or_fp0_operand" "fG")
2201 (match_operand:SF 2 "reg_or_fp0_operand" "fG")))]
2203 "sub%,%)%& %R1,%R2,%0"
2204 [(set_attr "type" "fadd")
2205 (set_attr "trap" "yes")])
2208 [(set (match_operand:DF 0 "register_operand" "=&f")
2209 (minus:DF (match_operand:DF 1 "reg_or_fp0_operand" "fG")
2210 (match_operand:DF 2 "reg_or_fp0_operand" "fG")))]
2211 "TARGET_FP && alpha_tp == ALPHA_TP_INSN"
2212 "sub%-%)%& %R1,%R2,%0"
2213 [(set_attr "type" "fadd")
2214 (set_attr "trap" "yes")])
2216 (define_insn "subdf3"
2217 [(set (match_operand:DF 0 "register_operand" "=f")
2218 (minus:DF (match_operand:DF 1 "reg_or_fp0_operand" "fG")
2219 (match_operand:DF 2 "reg_or_fp0_operand" "fG")))]
2221 "sub%-%)%& %R1,%R2,%0"
2222 [(set_attr "type" "fadd")
2223 (set_attr "trap" "yes")])
2226 [(set (match_operand:DF 0 "register_operand" "=f")
2227 (minus:DF (float_extend:DF
2228 (match_operand:SF 1 "reg_or_fp0_operand" "fG"))
2229 (match_operand:DF 2 "reg_or_fp0_operand" "fG")))]
2230 "TARGET_FP && alpha_tp != ALPHA_TP_INSN"
2231 "sub%-%)%& %R1,%R2,%0"
2232 [(set_attr "type" "fadd")
2233 (set_attr "trap" "yes")])
2236 [(set (match_operand:DF 0 "register_operand" "=f")
2237 (minus:DF (match_operand:DF 1 "reg_or_fp0_operand" "fG")
2239 (match_operand:SF 2 "reg_or_fp0_operand" "fG"))))]
2240 "TARGET_FP && alpha_tp != ALPHA_TP_INSN"
2241 "sub%-%)%& %R1,%R2,%0"
2242 [(set_attr "type" "fadd")
2243 (set_attr "trap" "yes")])
2246 [(set (match_operand:DF 0 "register_operand" "=f")
2247 (minus:DF (float_extend:DF
2248 (match_operand:SF 1 "reg_or_fp0_operand" "fG"))
2250 (match_operand:SF 2 "reg_or_fp0_operand" "fG"))))]
2251 "TARGET_FP && alpha_tp != ALPHA_TP_INSN"
2252 "sub%-%)%& %R1,%R2,%0"
2253 [(set_attr "type" "fadd")
2254 (set_attr "trap" "yes")])
2257 [(set (match_operand:SF 0 "register_operand" "=&f")
2258 (sqrt:SF (match_operand:SF 1 "reg_or_fp0_operand" "fG")))]
2259 "TARGET_FP && TARGET_CIX && alpha_tp == ALPHA_TP_INSN"
2261 [(set_attr "type" "fsqrt")
2262 (set_attr "opsize" "si")
2263 (set_attr "trap" "yes")])
2265 (define_insn "sqrtsf2"
2266 [(set (match_operand:SF 0 "register_operand" "=f")
2267 (sqrt:SF (match_operand:SF 1 "reg_or_fp0_operand" "fG")))]
2268 "TARGET_FP && TARGET_CIX"
2270 [(set_attr "type" "fsqrt")
2271 (set_attr "opsize" "si")
2272 (set_attr "trap" "yes")])
2275 [(set (match_operand:DF 0 "register_operand" "=&f")
2276 (sqrt:DF (match_operand:DF 1 "reg_or_fp0_operand" "fG")))]
2277 "TARGET_FP && TARGET_CIX && alpha_tp == ALPHA_TP_INSN"
2279 [(set_attr "type" "fsqrt")
2280 (set_attr "trap" "yes")])
2282 (define_insn "sqrtdf2"
2283 [(set (match_operand:DF 0 "register_operand" "=f")
2284 (sqrt:DF (match_operand:DF 1 "reg_or_fp0_operand" "fG")))]
2285 "TARGET_FP && TARGET_CIX"
2287 [(set_attr "type" "fsqrt")
2288 (set_attr "trap" "yes")])
2290 ;; Next are all the integer comparisons, and conditional moves and branches
2291 ;; and some of the related define_expand's and define_split's.
2294 [(set (match_operand:DI 0 "register_operand" "=r")
2295 (match_operator:DI 1 "alpha_comparison_operator"
2296 [(match_operand:DI 2 "reg_or_0_operand" "rJ")
2297 (match_operand:DI 3 "reg_or_8bit_operand" "rI")]))]
2300 [(set_attr "type" "icmp")])
2303 [(set (match_operand:DI 0 "register_operand" "=r")
2304 (match_operator:DI 1 "alpha_swapped_comparison_operator"
2305 [(match_operand:DI 2 "reg_or_8bit_operand" "rI")
2306 (match_operand:DI 3 "reg_or_0_operand" "rJ")]))]
2309 [(set_attr "type" "icmp")])
2311 ;; This pattern exists so conditional moves of SImode values are handled.
2312 ;; Comparisons are still done in DImode though.
2315 [(set (match_operand:SI 0 "register_operand" "=r,r,r,r")
2317 (match_operator 2 "signed_comparison_operator"
2318 [(match_operand:DI 3 "reg_or_0_operand" "rJ,rJ,J,J")
2319 (match_operand:DI 4 "reg_or_0_operand" "J,J,rJ,rJ")])
2320 (match_operand:SI 1 "reg_or_8bit_operand" "rI,0,rI,0")
2321 (match_operand:SI 5 "reg_or_8bit_operand" "0,rI,0,rI")))]
2322 "operands[3] == const0_rtx || operands[4] == const0_rtx"
2328 [(set_attr "type" "icmov")])
2331 [(set (match_operand:DI 0 "register_operand" "=r,r,r,r")
2333 (match_operator 2 "signed_comparison_operator"
2334 [(match_operand:DI 3 "reg_or_0_operand" "rJ,rJ,J,J")
2335 (match_operand:DI 4 "reg_or_0_operand" "J,J,rJ,rJ")])
2336 (match_operand:DI 1 "reg_or_8bit_operand" "rI,0,rI,0")
2337 (match_operand:DI 5 "reg_or_8bit_operand" "0,rI,0,rI")))]
2338 "operands[3] == const0_rtx || operands[4] == const0_rtx"
2344 [(set_attr "type" "icmov")])
2347 [(set (match_operand:DI 0 "register_operand" "=r,r")
2349 (eq (zero_extract:DI (match_operand:DI 2 "reg_or_0_operand" "rJ,rJ")
2353 (match_operand:DI 1 "reg_or_8bit_operand" "rI,0")
2354 (match_operand:DI 3 "reg_or_8bit_operand" "0,rI")))]
2359 [(set_attr "type" "icmov")])
2362 [(set (match_operand:DI 0 "register_operand" "=r,r")
2364 (ne (zero_extract:DI (match_operand:DI 2 "reg_or_0_operand" "rJ,rJ")
2368 (match_operand:DI 1 "reg_or_8bit_operand" "rI,0")
2369 (match_operand:DI 3 "reg_or_8bit_operand" "0,rI")))]
2374 [(set_attr "type" "icmov")])
2376 ;; For ABS, we have two choices, depending on whether the input and output
2377 ;; registers are the same or not.
2378 (define_expand "absdi2"
2379 [(set (match_operand:DI 0 "register_operand" "")
2380 (abs:DI (match_operand:DI 1 "register_operand" "")))]
2383 { if (rtx_equal_p (operands[0], operands[1]))
2384 emit_insn (gen_absdi2_same (operands[0], gen_reg_rtx (DImode)));
2386 emit_insn (gen_absdi2_diff (operands[0], operands[1]));
2391 (define_expand "absdi2_same"
2392 [(set (match_operand:DI 1 "register_operand" "")
2393 (neg:DI (match_operand:DI 0 "register_operand" "")))
2395 (if_then_else:DI (ge (match_dup 0) (const_int 0))
2401 (define_expand "absdi2_diff"
2402 [(set (match_operand:DI 0 "register_operand" "")
2403 (neg:DI (match_operand:DI 1 "register_operand" "")))
2405 (if_then_else:DI (lt (match_dup 1) (const_int 0))
2412 [(set (match_operand:DI 0 "register_operand" "")
2413 (abs:DI (match_dup 0)))
2414 (clobber (match_operand:DI 2 "register_operand" ""))]
2416 [(set (match_dup 1) (neg:DI (match_dup 0)))
2417 (set (match_dup 0) (if_then_else:DI (ge (match_dup 0) (const_int 0))
2418 (match_dup 0) (match_dup 1)))]
2422 [(set (match_operand:DI 0 "register_operand" "")
2423 (abs:DI (match_operand:DI 1 "register_operand" "")))]
2424 "! rtx_equal_p (operands[0], operands[1])"
2425 [(set (match_dup 0) (neg:DI (match_dup 1)))
2426 (set (match_dup 0) (if_then_else:DI (lt (match_dup 1) (const_int 0))
2427 (match_dup 0) (match_dup 1)))]
2431 [(set (match_operand:DI 0 "register_operand" "")
2432 (neg:DI (abs:DI (match_dup 0))))
2433 (clobber (match_operand:DI 2 "register_operand" ""))]
2435 [(set (match_dup 1) (neg:DI (match_dup 0)))
2436 (set (match_dup 0) (if_then_else:DI (le (match_dup 0) (const_int 0))
2437 (match_dup 0) (match_dup 1)))]
2441 [(set (match_operand:DI 0 "register_operand" "")
2442 (neg:DI (abs:DI (match_operand:DI 1 "register_operand" ""))))]
2443 "! rtx_equal_p (operands[0], operands[1])"
2444 [(set (match_dup 0) (neg:DI (match_dup 1)))
2445 (set (match_dup 0) (if_then_else:DI (gt (match_dup 1) (const_int 0))
2446 (match_dup 0) (match_dup 1)))]
2449 (define_insn "sminqi3"
2450 [(set (match_operand:QI 0 "register_operand" "=r")
2451 (smin:QI (match_operand:QI 1 "reg_or_0_operand" "%rJ")
2452 (match_operand:QI 2 "reg_or_8bit_operand" "rI")))]
2455 [(set_attr "type" "mvi")])
2457 (define_insn "uminqi3"
2458 [(set (match_operand:QI 0 "register_operand" "=r")
2459 (umin:QI (match_operand:QI 1 "reg_or_0_operand" "%rJ")
2460 (match_operand:QI 2 "reg_or_8bit_operand" "rI")))]
2463 [(set_attr "type" "mvi")])
2465 (define_insn "smaxqi3"
2466 [(set (match_operand:QI 0 "register_operand" "=r")
2467 (smax:QI (match_operand:QI 1 "reg_or_0_operand" "%rJ")
2468 (match_operand:QI 2 "reg_or_8bit_operand" "rI")))]
2471 [(set_attr "type" "mvi")])
2473 (define_insn "umaxqi3"
2474 [(set (match_operand:QI 0 "register_operand" "=r")
2475 (umax:QI (match_operand:QI 1 "reg_or_0_operand" "%rJ")
2476 (match_operand:QI 2 "reg_or_8bit_operand" "rI")))]
2479 [(set_attr "type" "mvi")])
2481 (define_insn "sminhi3"
2482 [(set (match_operand:HI 0 "register_operand" "=r")
2483 (smin:HI (match_operand:HI 1 "reg_or_0_operand" "%rJ")
2484 (match_operand:HI 2 "reg_or_8bit_operand" "rI")))]
2487 [(set_attr "type" "mvi")])
2489 (define_insn "uminhi3"
2490 [(set (match_operand:HI 0 "register_operand" "=r")
2491 (umin:HI (match_operand:HI 1 "reg_or_0_operand" "%rJ")
2492 (match_operand:HI 2 "reg_or_8bit_operand" "rI")))]
2495 [(set_attr "type" "mvi")])
2497 (define_insn "smaxhi3"
2498 [(set (match_operand:HI 0 "register_operand" "=r")
2499 (smax:HI (match_operand:HI 1 "reg_or_0_operand" "%rJ")
2500 (match_operand:HI 2 "reg_or_8bit_operand" "rI")))]
2503 [(set_attr "type" "mvi")])
2505 (define_insn "umaxhi3"
2506 [(set (match_operand:HI 0 "register_operand" "=r")
2507 (umax:HI (match_operand:HI 1 "reg_or_0_operand" "%rJ")
2508 (match_operand:HI 2 "reg_or_8bit_operand" "rI")))]
2511 [(set_attr "type" "shift")])
2513 (define_expand "smaxdi3"
2515 (le:DI (match_operand:DI 1 "reg_or_0_operand" "")
2516 (match_operand:DI 2 "reg_or_8bit_operand" "")))
2517 (set (match_operand:DI 0 "register_operand" "")
2518 (if_then_else:DI (eq (match_dup 3) (const_int 0))
2519 (match_dup 1) (match_dup 2)))]
2522 { operands[3] = gen_reg_rtx (DImode);
2526 [(set (match_operand:DI 0 "register_operand" "")
2527 (smax:DI (match_operand:DI 1 "reg_or_0_operand" "")
2528 (match_operand:DI 2 "reg_or_8bit_operand" "")))
2529 (clobber (match_operand:DI 3 "register_operand" ""))]
2530 "operands[2] != const0_rtx"
2531 [(set (match_dup 3) (le:DI (match_dup 1) (match_dup 2)))
2532 (set (match_dup 0) (if_then_else:DI (eq (match_dup 3) (const_int 0))
2533 (match_dup 1) (match_dup 2)))]
2537 [(set (match_operand:DI 0 "register_operand" "=r")
2538 (smax:DI (match_operand:DI 1 "register_operand" "0")
2542 [(set_attr "type" "icmov")])
2544 (define_expand "smindi3"
2546 (lt:DI (match_operand:DI 1 "reg_or_0_operand" "")
2547 (match_operand:DI 2 "reg_or_8bit_operand" "")))
2548 (set (match_operand:DI 0 "register_operand" "")
2549 (if_then_else:DI (ne (match_dup 3) (const_int 0))
2550 (match_dup 1) (match_dup 2)))]
2553 { operands[3] = gen_reg_rtx (DImode);
2557 [(set (match_operand:DI 0 "register_operand" "")
2558 (smin:DI (match_operand:DI 1 "reg_or_0_operand" "")
2559 (match_operand:DI 2 "reg_or_8bit_operand" "")))
2560 (clobber (match_operand:DI 3 "register_operand" ""))]
2561 "operands[2] != const0_rtx"
2562 [(set (match_dup 3) (lt:DI (match_dup 1) (match_dup 2)))
2563 (set (match_dup 0) (if_then_else:DI (ne (match_dup 3) (const_int 0))
2564 (match_dup 1) (match_dup 2)))]
2568 [(set (match_operand:DI 0 "register_operand" "=r")
2569 (smin:DI (match_operand:DI 1 "register_operand" "0")
2573 [(set_attr "type" "icmov")])
2575 (define_expand "umaxdi3"
2577 (leu:DI (match_operand:DI 1 "reg_or_0_operand" "")
2578 (match_operand:DI 2 "reg_or_8bit_operand" "")))
2579 (set (match_operand:DI 0 "register_operand" "")
2580 (if_then_else:DI (eq (match_dup 3) (const_int 0))
2581 (match_dup 1) (match_dup 2)))]
2584 { operands[3] = gen_reg_rtx (DImode);
2588 [(set (match_operand:DI 0 "register_operand" "")
2589 (umax:DI (match_operand:DI 1 "reg_or_0_operand" "")
2590 (match_operand:DI 2 "reg_or_8bit_operand" "")))
2591 (clobber (match_operand:DI 3 "register_operand" ""))]
2592 "operands[2] != const0_rtx"
2593 [(set (match_dup 3) (leu:DI (match_dup 1) (match_dup 2)))
2594 (set (match_dup 0) (if_then_else:DI (eq (match_dup 3) (const_int 0))
2595 (match_dup 1) (match_dup 2)))]
2598 (define_expand "umindi3"
2600 (ltu:DI (match_operand:DI 1 "reg_or_0_operand" "")
2601 (match_operand:DI 2 "reg_or_8bit_operand" "")))
2602 (set (match_operand:DI 0 "register_operand" "")
2603 (if_then_else:DI (ne (match_dup 3) (const_int 0))
2604 (match_dup 1) (match_dup 2)))]
2607 { operands[3] = gen_reg_rtx (DImode);
2611 [(set (match_operand:DI 0 "register_operand" "")
2612 (umin:DI (match_operand:DI 1 "reg_or_0_operand" "")
2613 (match_operand:DI 2 "reg_or_8bit_operand" "")))
2614 (clobber (match_operand:DI 3 "register_operand" ""))]
2615 "operands[2] != const0_rtx"
2616 [(set (match_dup 3) (ltu:DI (match_dup 1) (match_dup 2)))
2617 (set (match_dup 0) (if_then_else:DI (ne (match_dup 3) (const_int 0))
2618 (match_dup 1) (match_dup 2)))]
2624 (match_operator 1 "signed_comparison_operator"
2625 [(match_operand:DI 2 "reg_or_0_operand" "rJ")
2627 (label_ref (match_operand 0 "" ""))
2631 [(set_attr "type" "ibr")])
2636 (match_operator 1 "signed_comparison_operator"
2638 (match_operand:DI 2 "register_operand" "r")])
2639 (label_ref (match_operand 0 "" ""))
2643 [(set_attr "type" "ibr")])
2648 (ne (zero_extract:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
2652 (label_ref (match_operand 0 "" ""))
2656 [(set_attr "type" "ibr")])
2661 (eq (zero_extract:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
2665 (label_ref (match_operand 0 "" ""))
2669 [(set_attr "type" "ibr")])
2675 (match_operator 1 "comparison_operator"
2676 [(zero_extract:DI (match_operand:DI 2 "register_operand" "")
2678 (match_operand:DI 3 "const_int_operand" ""))
2680 (label_ref (match_operand 0 "" ""))
2682 (clobber (match_operand:DI 4 "register_operand" ""))])]
2683 "INTVAL (operands[3]) != 0"
2685 (lshiftrt:DI (match_dup 2) (match_dup 3)))
2687 (if_then_else (match_op_dup 1
2688 [(zero_extract:DI (match_dup 4)
2692 (label_ref (match_dup 0))
2696 ;; The following are the corresponding floating-point insns. Recall
2697 ;; we need to have variants that expand the arguments from SF mode
2701 [(set (match_operand:DF 0 "register_operand" "=&f")
2702 (match_operator:DF 1 "alpha_comparison_operator"
2703 [(match_operand:DF 2 "reg_or_fp0_operand" "fG")
2704 (match_operand:DF 3 "reg_or_fp0_operand" "fG")]))]
2705 "TARGET_FP && alpha_tp == ALPHA_TP_INSN"
2706 "cmp%-%C1%' %R2,%R3,%0"
2707 [(set_attr "type" "fadd")
2708 (set_attr "trap" "yes")])
2711 [(set (match_operand:DF 0 "register_operand" "=f")
2712 (match_operator:DF 1 "alpha_comparison_operator"
2713 [(match_operand:DF 2 "reg_or_fp0_operand" "fG")
2714 (match_operand:DF 3 "reg_or_fp0_operand" "fG")]))]
2715 "TARGET_FP && alpha_tp != ALPHA_TP_INSN"
2716 "cmp%-%C1%' %R2,%R3,%0"
2717 [(set_attr "type" "fadd")
2718 (set_attr "trap" "yes")])
2721 [(set (match_operand:DF 0 "register_operand" "=&f")
2722 (match_operator:DF 1 "alpha_comparison_operator"
2724 (match_operand:SF 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"
2745 [(match_operand:DF 2 "reg_or_fp0_operand" "fG")
2747 (match_operand:SF 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"
2768 (match_operand:SF 2 "reg_or_fp0_operand" "fG"))
2770 (match_operand:SF 3 "reg_or_fp0_operand" "fG"))]))]
2771 "TARGET_FP && alpha_tp == ALPHA_TP_INSN"
2772 "cmp%-%C1%' %R2,%R3,%0"
2773 [(set_attr "type" "fadd")
2774 (set_attr "trap" "yes")])
2777 [(set (match_operand:DF 0 "register_operand" "=f")
2778 (match_operator:DF 1 "alpha_comparison_operator"
2780 (match_operand:SF 2 "reg_or_fp0_operand" "fG"))
2782 (match_operand:SF 3 "reg_or_fp0_operand" "fG"))]))]
2783 "TARGET_FP && alpha_tp != ALPHA_TP_INSN"
2784 "cmp%-%C1%' %R2,%R3,%0"
2785 [(set_attr "type" "fadd")
2786 (set_attr "trap" "yes")])
2789 [(set (match_operand:DF 0 "register_operand" "=f,f")
2791 (match_operator 3 "signed_comparison_operator"
2792 [(match_operand:DF 4 "reg_or_fp0_operand" "fG,fG")
2793 (match_operand:DF 2 "fp0_operand" "G,G")])
2794 (match_operand:DF 1 "reg_or_fp0_operand" "fG,0")
2795 (match_operand:DF 5 "reg_or_fp0_operand" "0,fG")))]
2799 fcmov%D3 %R4,%R5,%0"
2800 [(set_attr "type" "fcmov")])
2803 [(set (match_operand:SF 0 "register_operand" "=f,f")
2805 (match_operator 3 "signed_comparison_operator"
2806 [(match_operand:DF 4 "reg_or_fp0_operand" "fG,fG")
2807 (match_operand:DF 2 "fp0_operand" "G,G")])
2808 (match_operand:SF 1 "reg_or_fp0_operand" "fG,0")
2809 (match_operand:SF 5 "reg_or_fp0_operand" "0,fG")))]
2813 fcmov%D3 %R4,%R5,%0"
2814 [(set_attr "type" "fcmov")])
2817 [(set (match_operand:DF 0 "register_operand" "=f,f")
2819 (match_operator 3 "signed_comparison_operator"
2820 [(match_operand:DF 4 "reg_or_fp0_operand" "fG,fG")
2821 (match_operand:DF 2 "fp0_operand" "G,G")])
2822 (float_extend:DF (match_operand:SF 1 "reg_or_fp0_operand" "fG,0"))
2823 (match_operand:DF 5 "reg_or_fp0_operand" "0,fG")))]
2827 fcmov%D3 %R4,%R5,%0"
2828 [(set_attr "type" "fcmov")])
2831 [(set (match_operand:DF 0 "register_operand" "=f,f")
2833 (match_operator 3 "signed_comparison_operator"
2835 (match_operand:SF 4 "reg_or_fp0_operand" "fG,fG"))
2836 (match_operand:DF 2 "fp0_operand" "G,G")])
2837 (match_operand:DF 1 "reg_or_fp0_operand" "fG,0")
2838 (match_operand:DF 5 "reg_or_fp0_operand" "0,fG")))]
2842 fcmov%D3 %R4,%R5,%0"
2843 [(set_attr "type" "fcmov")])
2846 [(set (match_operand:SF 0 "register_operand" "=f,f")
2848 (match_operator 3 "signed_comparison_operator"
2850 (match_operand:SF 4 "reg_or_fp0_operand" "fG,fG"))
2851 (match_operand:DF 2 "fp0_operand" "G,G")])
2852 (match_operand:SF 1 "reg_or_fp0_operand" "fG,0")
2853 (match_operand:SF 5 "reg_or_fp0_operand" "0,fG")))]
2857 fcmov%D3 %R4,%R5,%0"
2858 [(set_attr "type" "fcmov")])
2861 [(set (match_operand:DF 0 "register_operand" "=f,f")
2863 (match_operator 3 "signed_comparison_operator"
2865 (match_operand:SF 4 "reg_or_fp0_operand" "fG,fG"))
2866 (match_operand:DF 2 "fp0_operand" "G,G")])
2867 (float_extend:DF (match_operand:SF 1 "reg_or_fp0_operand" "fG,0"))
2868 (match_operand:DF 5 "reg_or_fp0_operand" "0,fG")))]
2872 fcmov%D3 %R4,%R5,%0"
2873 [(set_attr "type" "fcmov")])
2875 (define_expand "maxdf3"
2877 (le:DF (match_operand:DF 1 "reg_or_fp0_operand" "")
2878 (match_operand:DF 2 "reg_or_fp0_operand" "")))
2879 (set (match_operand:DF 0 "register_operand" "")
2880 (if_then_else:DF (eq (match_dup 3) (match_dup 4))
2881 (match_dup 1) (match_dup 2)))]
2884 { operands[3] = gen_reg_rtx (DFmode);
2885 operands[4] = CONST0_RTX (DFmode);
2888 (define_expand "mindf3"
2890 (lt:DF (match_operand:DF 1 "reg_or_fp0_operand" "")
2891 (match_operand:DF 2 "reg_or_fp0_operand" "")))
2892 (set (match_operand:DF 0 "register_operand" "")
2893 (if_then_else:DF (ne (match_dup 3) (match_dup 4))
2894 (match_dup 1) (match_dup 2)))]
2897 { operands[3] = gen_reg_rtx (DFmode);
2898 operands[4] = CONST0_RTX (DFmode);
2901 (define_expand "maxsf3"
2903 (le:DF (float_extend:DF (match_operand:SF 1 "reg_or_fp0_operand" ""))
2904 (float_extend:DF (match_operand:SF 2 "reg_or_fp0_operand" ""))))
2905 (set (match_operand:SF 0 "register_operand" "")
2906 (if_then_else:SF (eq (match_dup 3) (match_dup 4))
2907 (match_dup 1) (match_dup 2)))]
2910 { operands[3] = gen_reg_rtx (DFmode);
2911 operands[4] = CONST0_RTX (DFmode);
2914 (define_expand "minsf3"
2916 (lt:DF (float_extend:DF (match_operand:SF 1 "reg_or_fp0_operand" ""))
2917 (float_extend:DF (match_operand:SF 2 "reg_or_fp0_operand" ""))))
2918 (set (match_operand:SF 0 "register_operand" "")
2919 (if_then_else:SF (ne (match_dup 3) (match_dup 4))
2920 (match_dup 1) (match_dup 2)))]
2923 { operands[3] = gen_reg_rtx (DFmode);
2924 operands[4] = CONST0_RTX (DFmode);
2930 (match_operator 1 "signed_comparison_operator"
2931 [(match_operand:DF 2 "reg_or_fp0_operand" "fG")
2932 (match_operand:DF 3 "fp0_operand" "G")])
2933 (label_ref (match_operand 0 "" ""))
2937 [(set_attr "type" "fbr")])
2942 (match_operator 1 "signed_comparison_operator"
2944 (match_operand:SF 2 "reg_or_fp0_operand" "fG"))
2945 (match_operand:DF 3 "fp0_operand" "G")])
2946 (label_ref (match_operand 0 "" ""))
2950 [(set_attr "type" "fbr")])
2952 ;; These are the main define_expand's used to make conditional branches
2955 (define_expand "cmpdf"
2956 [(set (cc0) (compare (match_operand:DF 0 "reg_or_fp0_operand" "")
2957 (match_operand:DF 1 "reg_or_fp0_operand" "")))]
2961 alpha_compare_op0 = operands[0];
2962 alpha_compare_op1 = operands[1];
2963 alpha_compare_fp_p = 1;
2967 (define_expand "cmpdi"
2968 [(set (cc0) (compare (match_operand:DI 0 "reg_or_0_operand" "")
2969 (match_operand:DI 1 "reg_or_8bit_operand" "")))]
2973 alpha_compare_op0 = operands[0];
2974 alpha_compare_op1 = operands[1];
2975 alpha_compare_fp_p = 0;
2979 (define_expand "beq"
2981 (if_then_else (match_dup 1)
2982 (label_ref (match_operand 0 "" ""))
2985 "{ operands[1] = alpha_emit_conditional_branch (EQ); }")
2987 (define_expand "bne"
2989 (if_then_else (match_dup 1)
2990 (label_ref (match_operand 0 "" ""))
2993 "{ operands[1] = alpha_emit_conditional_branch (NE); }")
2995 (define_expand "blt"
2997 (if_then_else (match_dup 1)
2998 (label_ref (match_operand 0 "" ""))
3001 "{ operands[1] = alpha_emit_conditional_branch (LT); }")
3003 (define_expand "ble"
3005 (if_then_else (match_dup 1)
3006 (label_ref (match_operand 0 "" ""))
3009 "{ operands[1] = alpha_emit_conditional_branch (LE); }")
3011 (define_expand "bgt"
3013 (if_then_else (match_dup 1)
3014 (label_ref (match_operand 0 "" ""))
3017 "{ operands[1] = alpha_emit_conditional_branch (GT); }")
3019 (define_expand "bge"
3021 (if_then_else (match_dup 1)
3022 (label_ref (match_operand 0 "" ""))
3025 "{ operands[1] = alpha_emit_conditional_branch (GE); }")
3027 (define_expand "bltu"
3029 (if_then_else (match_dup 1)
3030 (label_ref (match_operand 0 "" ""))
3033 "{ operands[1] = alpha_emit_conditional_branch (LTU); }")
3035 (define_expand "bleu"
3037 (if_then_else (match_dup 1)
3038 (label_ref (match_operand 0 "" ""))
3041 "{ operands[1] = alpha_emit_conditional_branch (LEU); }")
3043 (define_expand "bgtu"
3045 (if_then_else (match_dup 1)
3046 (label_ref (match_operand 0 "" ""))
3049 "{ operands[1] = alpha_emit_conditional_branch (GTU); }")
3051 (define_expand "bgeu"
3053 (if_then_else (match_dup 1)
3054 (label_ref (match_operand 0 "" ""))
3057 "{ operands[1] = alpha_emit_conditional_branch (GEU); }")
3059 (define_expand "seq"
3060 [(set (match_operand:DI 0 "register_operand" "")
3065 if (alpha_compare_fp_p)
3068 operands[1] = gen_rtx_EQ (DImode, alpha_compare_op0, alpha_compare_op1);
3071 (define_expand "sne"
3072 [(set (match_operand:DI 0 "register_operand" "")
3074 (set (match_dup 0) (xor:DI (match_dup 0) (const_int 1)))]
3078 if (alpha_compare_fp_p)
3081 operands[1] = gen_rtx_EQ (DImode, alpha_compare_op0, alpha_compare_op1);
3084 (define_expand "slt"
3085 [(set (match_operand:DI 0 "register_operand" "")
3090 if (alpha_compare_fp_p)
3093 operands[1] = gen_rtx_LT (DImode, alpha_compare_op0, alpha_compare_op1);
3096 (define_expand "sle"
3097 [(set (match_operand:DI 0 "register_operand" "")
3102 if (alpha_compare_fp_p)
3105 operands[1] = gen_rtx_LE (DImode, alpha_compare_op0, alpha_compare_op1);
3108 (define_expand "sgt"
3109 [(set (match_operand:DI 0 "register_operand" "")
3114 if (alpha_compare_fp_p)
3117 operands[1] = gen_rtx_LT (DImode, force_reg (DImode, alpha_compare_op1),
3121 (define_expand "sge"
3122 [(set (match_operand:DI 0 "register_operand" "")
3127 if (alpha_compare_fp_p)
3130 operands[1] = gen_rtx_LE (DImode, force_reg (DImode, alpha_compare_op1),
3134 (define_expand "sltu"
3135 [(set (match_operand:DI 0 "register_operand" "")
3140 if (alpha_compare_fp_p)
3143 operands[1] = gen_rtx_LTU (DImode, alpha_compare_op0, alpha_compare_op1);
3146 (define_expand "sleu"
3147 [(set (match_operand:DI 0 "register_operand" "")
3152 if (alpha_compare_fp_p)
3155 operands[1] = gen_rtx_LEU (DImode, alpha_compare_op0, alpha_compare_op1);
3158 (define_expand "sgtu"
3159 [(set (match_operand:DI 0 "register_operand" "")
3164 if (alpha_compare_fp_p)
3167 operands[1] = gen_rtx_LTU (DImode, force_reg (DImode, alpha_compare_op1),
3171 (define_expand "sgeu"
3172 [(set (match_operand:DI 0 "register_operand" "")
3177 if (alpha_compare_fp_p)
3180 operands[1] = gen_rtx_LEU (DImode, force_reg (DImode, alpha_compare_op1),
3184 ;; These are the main define_expand's used to make conditional moves.
3186 (define_expand "movsicc"
3187 [(set (match_operand:SI 0 "register_operand" "")
3188 (if_then_else:SI (match_operand 1 "comparison_operator" "")
3189 (match_operand:SI 2 "reg_or_8bit_operand" "")
3190 (match_operand:SI 3 "reg_or_8bit_operand" "")))]
3194 if ((operands[1] = alpha_emit_conditional_move (operands[1], SImode)) == 0)
3198 (define_expand "movdicc"
3199 [(set (match_operand:DI 0 "register_operand" "")
3200 (if_then_else:DI (match_operand 1 "comparison_operator" "")
3201 (match_operand:DI 2 "reg_or_8bit_operand" "")
3202 (match_operand:DI 3 "reg_or_8bit_operand" "")))]
3206 if ((operands[1] = alpha_emit_conditional_move (operands[1], DImode)) == 0)
3210 (define_expand "movsfcc"
3211 [(set (match_operand:SF 0 "register_operand" "")
3212 (if_then_else:SF (match_operand 1 "comparison_operator" "")
3213 (match_operand:SF 2 "reg_or_8bit_operand" "")
3214 (match_operand:SF 3 "reg_or_8bit_operand" "")))]
3218 if ((operands[1] = alpha_emit_conditional_move (operands[1], SFmode)) == 0)
3222 (define_expand "movdfcc"
3223 [(set (match_operand:DF 0 "register_operand" "")
3224 (if_then_else:DF (match_operand 1 "comparison_operator" "")
3225 (match_operand:DF 2 "reg_or_8bit_operand" "")
3226 (match_operand:DF 3 "reg_or_8bit_operand" "")))]
3230 if ((operands[1] = alpha_emit_conditional_move (operands[1], DFmode)) == 0)
3234 ;; These define_split definitions are used in cases when comparisons have
3235 ;; not be stated in the correct way and we need to reverse the second
3236 ;; comparison. For example, x >= 7 has to be done as x < 6 with the
3237 ;; comparison that tests the result being reversed. We have one define_split
3238 ;; for each use of a comparison. They do not match valid insns and need
3239 ;; not generate valid insns.
3241 ;; We can also handle equality comparisons (and inequality comparisons in
3242 ;; cases where the resulting add cannot overflow) by doing an add followed by
3243 ;; a comparison with zero. This is faster since the addition takes one
3244 ;; less cycle than a compare when feeding into a conditional move.
3245 ;; For this case, we also have an SImode pattern since we can merge the add
3246 ;; and sign extend and the order doesn't matter.
3248 ;; We do not do this for floating-point, since it isn't clear how the "wrong"
3249 ;; operation could have been generated.
3252 [(set (match_operand:DI 0 "register_operand" "")
3254 (match_operator 1 "comparison_operator"
3255 [(match_operand:DI 2 "reg_or_0_operand" "")
3256 (match_operand:DI 3 "reg_or_cint_operand" "")])
3257 (match_operand:DI 4 "reg_or_cint_operand" "")
3258 (match_operand:DI 5 "reg_or_cint_operand" "")))
3259 (clobber (match_operand:DI 6 "register_operand" ""))]
3260 "operands[3] != const0_rtx"
3261 [(set (match_dup 6) (match_dup 7))
3263 (if_then_else:DI (match_dup 8) (match_dup 4) (match_dup 5)))]
3265 { enum rtx_code code = GET_CODE (operands[1]);
3266 int unsignedp = (code == GEU || code == LEU || code == GTU || code == LTU);
3268 /* If we are comparing for equality with a constant and that constant
3269 appears in the arm when the register equals the constant, use the
3270 register since that is more likely to match (and to produce better code
3273 if (code == EQ && GET_CODE (operands[3]) == CONST_INT
3274 && rtx_equal_p (operands[4], operands[3]))
3275 operands[4] = operands[2];
3277 else if (code == NE && GET_CODE (operands[3]) == CONST_INT
3278 && rtx_equal_p (operands[5], operands[3]))
3279 operands[5] = operands[2];
3281 if (code == NE || code == EQ
3282 || (extended_count (operands[2], DImode, unsignedp) >= 1
3283 && extended_count (operands[3], DImode, unsignedp) >= 1))
3285 if (GET_CODE (operands[3]) == CONST_INT)
3286 operands[7] = gen_rtx_PLUS (DImode, operands[2],
3287 GEN_INT (- INTVAL (operands[3])));
3289 operands[7] = gen_rtx_MINUS (DImode, operands[2], operands[3]);
3291 operands[8] = gen_rtx_fmt_ee (code, VOIDmode, operands[6], const0_rtx);
3294 else if (code == EQ || code == LE || code == LT
3295 || code == LEU || code == LTU)
3297 operands[7] = gen_rtx_fmt_ee (code, DImode, operands[2], operands[3]);
3298 operands[8] = gen_rtx_NE (VOIDmode, operands[6], const0_rtx);
3302 operands[7] = gen_rtx_fmt_ee (reverse_condition (code), DImode,
3303 operands[2], operands[3]);
3304 operands[8] = gen_rtx_EQ (VOIDmode, operands[6], const0_rtx);
3309 [(set (match_operand:DI 0 "register_operand" "")
3311 (match_operator 1 "comparison_operator"
3312 [(match_operand:SI 2 "reg_or_0_operand" "")
3313 (match_operand:SI 3 "reg_or_cint_operand" "")])
3314 (match_operand:DI 4 "reg_or_8bit_operand" "")
3315 (match_operand:DI 5 "reg_or_8bit_operand" "")))
3316 (clobber (match_operand:DI 6 "register_operand" ""))]
3317 "operands[3] != const0_rtx
3318 && (GET_CODE (operands[1]) == EQ || GET_CODE (operands[1]) == NE)"
3319 [(set (match_dup 6) (match_dup 7))
3321 (if_then_else:DI (match_dup 8) (match_dup 4) (match_dup 5)))]
3323 { enum rtx_code code = GET_CODE (operands[1]);
3324 int unsignedp = (code == GEU || code == LEU || code == GTU || code == LTU);
3327 if ((code != NE && code != EQ
3328 && ! (extended_count (operands[2], DImode, unsignedp) >= 1
3329 && extended_count (operands[3], DImode, unsignedp) >= 1)))
3332 if (GET_CODE (operands[3]) == CONST_INT)
3333 tem = gen_rtx_PLUS (SImode, operands[2],
3334 GEN_INT (- INTVAL (operands[3])));
3336 tem = gen_rtx_MINUS (SImode, operands[2], operands[3]);
3338 operands[7] = gen_rtx_SIGN_EXTEND (DImode, tem);
3339 operands[8] = gen_rtx_fmt_ee (GET_CODE (operands[1]), VOIDmode,
3340 operands[6], const0_rtx);
3346 (match_operator 1 "comparison_operator"
3347 [(match_operand:DI 2 "reg_or_0_operand" "")
3348 (match_operand:DI 3 "reg_or_cint_operand" "")])
3349 (label_ref (match_operand 0 "" ""))
3351 (clobber (match_operand:DI 4 "register_operand" ""))]
3352 "operands[3] != const0_rtx"
3353 [(set (match_dup 4) (match_dup 5))
3354 (set (pc) (if_then_else (match_dup 6) (label_ref (match_dup 0)) (pc)))]
3356 { enum rtx_code code = GET_CODE (operands[1]);
3357 int unsignedp = (code == GEU || code == LEU || code == GTU || code == LTU);
3359 if (code == NE || code == EQ
3360 || (extended_count (operands[2], DImode, unsignedp) >= 1
3361 && extended_count (operands[3], DImode, unsignedp) >= 1))
3363 if (GET_CODE (operands[3]) == CONST_INT)
3364 operands[5] = gen_rtx_PLUS (DImode, operands[2],
3365 GEN_INT (- INTVAL (operands[3])));
3367 operands[5] = gen_rtx_MINUS (DImode, operands[2], operands[3]);
3369 operands[6] = gen_rtx_fmt_ee (code, VOIDmode, operands[4], const0_rtx);
3372 else if (code == EQ || code == LE || code == LT
3373 || code == LEU || code == LTU)
3375 operands[5] = gen_rtx_fmt_ee (code, DImode, operands[2], operands[3]);
3376 operands[6] = gen_rtx_NE (VOIDmode, operands[4], const0_rtx);
3380 operands[5] = gen_rtx_fmt_ee (reverse_condition (code), DImode,
3381 operands[2], operands[3]);
3382 operands[6] = gen_rtx_EQ (VOIDmode, operands[4], const0_rtx);
3389 (match_operator 1 "comparison_operator"
3390 [(match_operand:SI 2 "reg_or_0_operand" "")
3391 (match_operand:SI 3 "const_int_operand" "")])
3392 (label_ref (match_operand 0 "" ""))
3394 (clobber (match_operand:DI 4 "register_operand" ""))]
3395 "operands[3] != const0_rtx
3396 && (GET_CODE (operands[1]) == EQ || GET_CODE (operands[1]) == NE)"
3397 [(set (match_dup 4) (match_dup 5))
3398 (set (pc) (if_then_else (match_dup 6) (label_ref (match_dup 0)) (pc)))]
3402 if (GET_CODE (operands[3]) == CONST_INT)
3403 tem = gen_rtx_PLUS (SImode, operands[2],
3404 GEN_INT (- INTVAL (operands[3])));
3406 tem = gen_rtx_MINUS (SImode, operands[2], operands[3]);
3408 operands[5] = gen_rtx_SIGN_EXTEND (DImode, tem);
3409 operands[6] = gen_rtx_fmt_ee (GET_CODE (operands[1]), VOIDmode,
3410 operands[4], const0_rtx);
3413 ;; We can convert such things as "a > 0xffff" to "t = a & ~ 0xffff; t != 0".
3414 ;; This eliminates one, and sometimes two, insns when the AND can be done
3417 [(set (match_operand:DI 0 "register_operand" "")
3418 (match_operator 1 "comparison_operator"
3419 [(match_operand:DI 2 "register_operand" "")
3420 (match_operand:DI 3 "const_int_operand" "")]))
3421 (clobber (match_operand:DI 4 "register_operand" ""))]
3422 "exact_log2 (INTVAL (operands[3]) + 1) >= 0
3423 && (GET_CODE (operands[1]) == GTU
3424 || GET_CODE (operands[1]) == LEU
3425 || ((GET_CODE (operands[1]) == GT || GET_CODE (operands[1]) == LE)
3426 && extended_count (operands[2], DImode, 1) > 0))"
3427 [(set (match_dup 4) (and:DI (match_dup 2) (match_dup 5)))
3428 (set (match_dup 0) (match_dup 6))]
3431 operands[5] = GEN_INT (~ INTVAL (operands[3]));
3432 operands[6] = gen_rtx_fmt_ee (((GET_CODE (operands[1]) == GTU
3433 || GET_CODE (operands[1]) == GT)
3435 DImode, operands[4], const0_rtx);
3438 ;; Here are the CALL and unconditional branch insns. Calls on NT and OSF
3439 ;; work differently, so we have different patterns for each.
3441 (define_expand "call"
3442 [(use (match_operand:DI 0 "" ""))
3443 (use (match_operand 1 "" ""))
3444 (use (match_operand 2 "" ""))
3445 (use (match_operand 3 "" ""))]
3448 { if (TARGET_WINDOWS_NT)
3449 emit_call_insn (gen_call_nt (operands[0], operands[1]));
3450 else if (TARGET_OPEN_VMS)
3451 emit_call_insn (gen_call_vms (operands[0], operands[2]));
3453 emit_call_insn (gen_call_osf (operands[0], operands[1]));
3458 (define_expand "call_osf"
3459 [(parallel [(call (mem:DI (match_operand 0 "" ""))
3460 (match_operand 1 "" ""))
3461 (clobber (reg:DI 27))
3462 (clobber (reg:DI 26))])]
3465 { if (GET_CODE (operands[0]) != MEM)
3468 operands[0] = XEXP (operands[0], 0);
3470 if (GET_CODE (operands[0]) != SYMBOL_REF
3471 && ! (GET_CODE (operands[0]) == REG && REGNO (operands[0]) == 27))
3473 rtx tem = gen_rtx_REG (DImode, 27);
3474 emit_move_insn (tem, operands[0]);
3479 (define_expand "call_nt"
3480 [(parallel [(call (mem:DI (match_operand 0 "" ""))
3481 (match_operand 1 "" ""))
3482 (clobber (reg:DI 26))])]
3485 { if (GET_CODE (operands[0]) != MEM)
3488 operands[0] = XEXP (operands[0], 0);
3489 if (GET_CODE (operands[0]) != SYMBOL_REF && GET_CODE (operands[0]) != REG)
3490 operands[0] = force_reg (DImode, operands[0]);
3494 ;; call openvms/alpha
3495 ;; op 0: symbol ref for called function
3496 ;; op 1: next_arg_reg (argument information value for R25)
3498 (define_expand "call_vms"
3499 [(parallel [(call (mem:DI (match_operand 0 "" ""))
3500 (match_operand 1 "" ""))
3504 (clobber (reg:DI 27))])]
3507 { if (GET_CODE (operands[0]) != MEM)
3510 operands[0] = XEXP (operands[0], 0);
3512 /* Always load AI with argument information, then handle symbolic and
3513 indirect call differently. Load RA and set operands[2] to PV in
3516 emit_move_insn (gen_rtx_REG (DImode, 25), operands[1]);
3517 if (GET_CODE (operands[0]) == SYMBOL_REF)
3519 extern char *savealloc ();
3520 char *linksym, *symbol = XSTR (operands[0], 0);
3525 linksym = savealloc (strlen (symbol) + 6);
3527 alpha_need_linkage (symbol, 0);
3530 strcpy (linksym+1, symbol);
3531 strcat (linksym, \"..lk\");
3532 linkage = gen_rtx_SYMBOL_REF (Pmode, linksym);
3534 emit_move_insn (gen_rtx_REG (Pmode, 26), gen_rtx_MEM (Pmode, linkage));
3537 = validize_mem (gen_rtx_MEM (Pmode, plus_constant (linkage, 8)));
3541 emit_move_insn (gen_rtx_REG (Pmode, 26),
3542 gen_rtx_MEM (Pmode, plus_constant (operands[0], 8)));
3544 operands[2] = operands[0];
3549 (define_expand "call_value"
3550 [(use (match_operand 0 "" ""))
3551 (use (match_operand:DI 1 "" ""))
3552 (use (match_operand 2 "" ""))
3553 (use (match_operand 3 "" ""))
3554 (use (match_operand 4 "" ""))]
3557 { if (TARGET_WINDOWS_NT)
3558 emit_call_insn (gen_call_value_nt (operands[0], operands[1], operands[2]));
3559 else if (TARGET_OPEN_VMS)
3560 emit_call_insn (gen_call_value_vms (operands[0], operands[1],
3563 emit_call_insn (gen_call_value_osf (operands[0], operands[1],
3568 (define_expand "call_value_osf"
3569 [(parallel [(set (match_operand 0 "" "")
3570 (call (mem:DI (match_operand 1 "" ""))
3571 (match_operand 2 "" "")))
3572 (clobber (reg:DI 27))
3573 (clobber (reg:DI 26))])]
3576 { if (GET_CODE (operands[1]) != MEM)
3579 operands[1] = XEXP (operands[1], 0);
3581 if (GET_CODE (operands[1]) != SYMBOL_REF
3582 && ! (GET_CODE (operands[1]) == REG && REGNO (operands[1]) == 27))
3584 rtx tem = gen_rtx_REG (DImode, 27);
3585 emit_move_insn (tem, operands[1]);
3590 (define_expand "call_value_nt"
3591 [(parallel [(set (match_operand 0 "" "")
3592 (call (mem:DI (match_operand 1 "" ""))
3593 (match_operand 2 "" "")))
3594 (clobber (reg:DI 26))])]
3597 { if (GET_CODE (operands[1]) != MEM)
3600 operands[1] = XEXP (operands[1], 0);
3601 if (GET_CODE (operands[0]) != SYMBOL_REF && GET_CODE (operands[0]) != REG)
3602 operands[1] = force_reg (DImode, operands[1]);
3605 (define_expand "call_value_vms"
3606 [(parallel [(set (match_operand 0 "" "")
3607 (call (mem:DI (match_operand:DI 1 "" ""))
3608 (match_operand 2 "" "")))
3612 (clobber (reg:DI 27))])]
3615 { if (GET_CODE (operands[1]) != MEM)
3618 operands[1] = XEXP (operands[1], 0);
3620 /* Always load AI with argument information, then handle symbolic and
3621 indirect call differently. Load RA and set operands[3] to PV in
3624 emit_move_insn (gen_rtx_REG (DImode, 25), operands[2]);
3625 if (GET_CODE (operands[1]) == SYMBOL_REF)
3627 extern char *savealloc ();
3628 char *linksym, *symbol = XSTR (operands[1], 0);
3633 linksym = savealloc (strlen (symbol) + 6);
3635 alpha_need_linkage (symbol, 0);
3637 strcpy (linksym+1, symbol);
3638 strcat (linksym, \"..lk\");
3639 linkage = gen_rtx_SYMBOL_REF (Pmode, linksym);
3641 emit_move_insn (gen_rtx_REG (Pmode, 26), gen_rtx_MEM (Pmode, linkage));
3644 = validize_mem (gen_rtx_MEM (Pmode, plus_constant (linkage, 8)));
3648 emit_move_insn (gen_rtx_REG (Pmode, 26),
3649 gen_rtx_MEM (Pmode, plus_constant (operands[1], 8)));
3651 operands[3] = operands[1];
3656 [(call (mem:DI (match_operand:DI 0 "call_operand" "r,R,i"))
3657 (match_operand 1 "" ""))
3658 (clobber (reg:DI 27))
3659 (clobber (reg:DI 26))]
3660 "! TARGET_WINDOWS_NT && ! TARGET_OPEN_VMS"
3662 jsr $26,($27),0\;ldgp $29,0($26)
3664 jsr $26,%0\;ldgp $29,0($26)"
3665 [(set_attr "type" "jsr")
3666 (set_attr "length" "12,*,16")])
3669 [(call (mem:DI (match_operand:DI 0 "call_operand" "r,R,i"))
3670 (match_operand 1 "" ""))
3671 (clobber (reg:DI 26))]
3677 [(set_attr "type" "jsr")
3678 (set_attr "length" "*,*,12")])
3681 [(call (mem:DI (match_operand:DI 0 "call_operand" "r,i"))
3682 (match_operand 1 "" ""))
3683 (use (match_operand:DI 2 "general_operand" "r,m"))
3686 (clobber (reg:DI 27))]
3689 mov %2,$27\;jsr $26,0\;ldq $27,0($29)
3690 ldq $27,%2\;jsr $26,%0\;ldq $27,0($29)"
3691 [(set_attr "type" "jsr")
3692 (set_attr "length" "12,16")])
3695 [(set (match_operand 0 "register_operand" "=rf,rf,rf")
3696 (call (mem:DI (match_operand:DI 1 "call_operand" "r,R,i"))
3697 (match_operand 2 "" "")))
3698 (clobber (reg:DI 27))
3699 (clobber (reg:DI 26))]
3700 "! TARGET_WINDOWS_NT && ! TARGET_OPEN_VMS"
3702 jsr $26,($27),0\;ldgp $29,0($26)
3704 jsr $26,%1\;ldgp $29,0($26)"
3705 [(set_attr "type" "jsr")
3706 (set_attr "length" "12,*,16")])
3709 [(set (match_operand 0 "register_operand" "=rf,rf,rf")
3710 (call (mem:DI (match_operand:DI 1 "call_operand" "r,R,i"))
3711 (match_operand 2 "" "")))
3712 (clobber (reg:DI 26))]
3718 [(set_attr "type" "jsr")
3719 (set_attr "length" "*,*,12")])
3722 [(set (match_operand 0 "register_operand" "")
3723 (call (mem:DI (match_operand:DI 1 "call_operand" "r,i"))
3724 (match_operand 2 "" "")))
3725 (use (match_operand:DI 3 "general_operand" "r,m"))
3728 (clobber (reg:DI 27))]
3731 mov %3,$27\;jsr $26,0\;ldq $27,0($29)
3732 ldq $27,%3\;jsr $26,%1\;ldq $27,0($29)"
3733 [(set_attr "type" "jsr")
3734 (set_attr "length" "12,16")])
3736 ;; Call subroutine returning any type.
3738 (define_expand "untyped_call"
3739 [(parallel [(call (match_operand 0 "" "")
3741 (match_operand 1 "" "")
3742 (match_operand 2 "" "")])]
3748 emit_call_insn (gen_call (operands[0], const0_rtx, NULL, const0_rtx));
3750 for (i = 0; i < XVECLEN (operands[2], 0); i++)
3752 rtx set = XVECEXP (operands[2], 0, i);
3753 emit_move_insn (SET_DEST (set), SET_SRC (set));
3756 /* The optimizer does not know that the call sets the function value
3757 registers we stored in the result block. We avoid problems by
3758 claiming that all hard registers are used and clobbered at this
3760 emit_insn (gen_blockage ());
3765 ;; UNSPEC_VOLATILE is considered to use and clobber all hard registers and
3766 ;; all of memory. This blocks insns from being moved across this point.
3768 (define_insn "blockage"
3769 [(unspec_volatile [(const_int 0)] 1)]
3772 [(set_attr "length" "0")])
3776 (label_ref (match_operand 0 "" "")))]
3779 [(set_attr "type" "ibr")])
3781 (define_insn "return"
3785 [(set_attr "type" "ibr")])
3787 ;; Use a different pattern for functions which have non-trivial
3788 ;; epilogues so as not to confuse jump and reorg.
3789 (define_insn "return_internal"
3794 [(set_attr "type" "ibr")])
3796 (define_insn "indirect_jump"
3797 [(set (pc) (match_operand:DI 0 "register_operand" "r"))]
3800 [(set_attr "type" "ibr")])
3802 (define_expand "tablejump"
3803 [(use (match_operand:SI 0 "register_operand" ""))
3804 (use (match_operand:SI 1 "" ""))]
3808 if (TARGET_WINDOWS_NT)
3809 emit_jump_insn (gen_tablejump_nt (operands[0], operands[1]));
3810 else if (TARGET_OPEN_VMS)
3811 emit_jump_insn (gen_tablejump_vms (operands[0], operands[1]));
3813 emit_jump_insn (gen_tablejump_osf (operands[0], operands[1]));
3818 (define_expand "tablejump_osf"
3820 (sign_extend:DI (match_operand:SI 0 "register_operand" "")))
3821 (parallel [(set (pc)
3822 (plus:DI (match_dup 3)
3823 (label_ref:DI (match_operand 1 "" ""))))
3824 (clobber (match_scratch:DI 2 "=r"))])]
3827 { operands[3] = gen_reg_rtx (DImode); }")
3829 (define_expand "tablejump_nt"
3831 (sign_extend:DI (match_operand:SI 0 "register_operand" "")))
3832 (parallel [(set (pc)
3834 (use (label_ref (match_operand 1 "" "")))])]
3837 { operands[3] = gen_reg_rtx (DImode); }")
3840 ;; tablejump, openVMS way
3842 ;; op 1: label preceding jump-table
3844 (define_expand "tablejump_vms"
3846 (match_operand:DI 0 "register_operand" ""))
3848 (plus:DI (match_dup 2)
3849 (label_ref:DI (match_operand 1 "" ""))))]
3852 { operands[2] = gen_reg_rtx (DImode); }")
3856 (plus:DI (match_operand:DI 0 "register_operand" "r")
3857 (label_ref:DI (match_operand 1 "" ""))))
3858 (clobber (match_scratch:DI 2 "=r"))]
3859 "! TARGET_WINDOWS_NT && ! TARGET_OPEN_VMS && next_active_insn (insn) != 0
3860 && GET_CODE (PATTERN (next_active_insn (insn))) == ADDR_DIFF_VEC
3861 && PREV_INSN (next_active_insn (insn)) == operands[1]"
3863 { rtx best_label = 0;
3864 rtx jump_table_insn = next_active_insn (operands[1]);
3866 if (GET_CODE (jump_table_insn) == JUMP_INSN
3867 && GET_CODE (PATTERN (jump_table_insn)) == ADDR_DIFF_VEC)
3869 rtx jump_table = PATTERN (jump_table_insn);
3870 int n_labels = XVECLEN (jump_table, 1);
3871 int best_count = -1;
3874 for (i = 0; i < n_labels; i++)
3878 for (j = i + 1; j < n_labels; j++)
3879 if (XEXP (XVECEXP (jump_table, 1, i), 0)
3880 == XEXP (XVECEXP (jump_table, 1, j), 0))
3883 if (count > best_count)
3884 best_count = count, best_label = XVECEXP (jump_table, 1, i);
3890 operands[3] = best_label;
3891 return \"addq %0,$29,%2\;jmp $31,(%2),%3\";
3894 return \"addq %0,$29,%2\;jmp $31,(%2),0\";
3896 [(set_attr "type" "ibr")
3897 (set_attr "length" "8")])
3901 (match_operand:DI 0 "register_operand" "r"))
3902 (use (label_ref (match_operand 1 "" "")))]
3903 "TARGET_WINDOWS_NT && next_active_insn (insn) != 0
3904 && GET_CODE (PATTERN (next_active_insn (insn))) == ADDR_DIFF_VEC
3905 && PREV_INSN (next_active_insn (insn)) == operands[1]"
3907 { rtx best_label = 0;
3908 rtx jump_table_insn = next_active_insn (operands[1]);
3910 if (GET_CODE (jump_table_insn) == JUMP_INSN
3911 && GET_CODE (PATTERN (jump_table_insn)) == ADDR_DIFF_VEC)
3913 rtx jump_table = PATTERN (jump_table_insn);
3914 int n_labels = XVECLEN (jump_table, 1);
3915 int best_count = -1;
3918 for (i = 0; i < n_labels; i++)
3922 for (j = i + 1; j < n_labels; j++)
3923 if (XEXP (XVECEXP (jump_table, 1, i), 0)
3924 == XEXP (XVECEXP (jump_table, 1, j), 0))
3927 if (count > best_count)
3928 best_count = count, best_label = XVECEXP (jump_table, 1, i);
3934 operands[2] = best_label;
3935 return \"jmp $31,(%0),%2\";
3938 return \"jmp $31,(%0),0\";
3940 [(set_attr "type" "ibr")])
3943 ;; op 0 is table offset
3944 ;; op 1 is table label
3949 (plus:DI (match_operand 0 "register_operand" "r")
3950 (label_ref (match_operand 1 "" ""))))]
3953 [(set_attr "type" "ibr")])
3955 ;; Cache flush. Used by INITIALIZE_TRAMPOLINE. 0x86 is PAL_imb, but we don't
3956 ;; want to have to include pal.h in our .s file.
3958 ;; Technically the type for call_pal is jsr, but we use that for determining
3959 ;; if we need a GP. Use ibr instead since it has the same EV5 scheduling
3962 [(unspec_volatile [(const_int 0)] 0)]
3965 [(set_attr "type" "ibr")])
3967 ;; Finally, we have the basic data motion insns. The byte and word insns
3968 ;; are done via define_expand. Start with the floating-point insns, since
3969 ;; they are simpler.
3972 [(set (match_operand:SF 0 "nonimmediate_operand" "=r,r,m,f,f,m")
3973 (match_operand:SF 1 "input_operand" "rG,m,r,fG,m,fG"))]
3975 && (register_operand (operands[0], SFmode)
3976 || reg_or_fp0_operand (operands[1], SFmode))"
3984 [(set_attr "type" "ilog,ild,ist,fcpys,fld,fst")])
3987 [(set (match_operand:SF 0 "nonimmediate_operand" "=r,r,m,f,f,m,f,*r")
3988 (match_operand:SF 1 "input_operand" "rG,m,r,fG,m,fG,r,*f"))]
3990 && (register_operand (operands[0], SFmode)
3991 || reg_or_fp0_operand (operands[1], SFmode))"
4001 [(set_attr "type" "ilog,ild,ist,fcpys,fld,fst,itof,ftoi")])
4004 [(set (match_operand:DF 0 "nonimmediate_operand" "=r,r,m,f,f,m")
4005 (match_operand:DF 1 "input_operand" "rG,m,r,fG,m,fG"))]
4007 && (register_operand (operands[0], DFmode)
4008 || reg_or_fp0_operand (operands[1], DFmode))"
4016 [(set_attr "type" "ilog,ild,ist,fcpys,fld,fst")])
4019 [(set (match_operand:DF 0 "nonimmediate_operand" "=r,r,m,f,f,m,f,*r")
4020 (match_operand:DF 1 "input_operand" "rG,m,r,fG,m,fG,r,*f"))]
4022 && (register_operand (operands[0], DFmode)
4023 || reg_or_fp0_operand (operands[1], DFmode))"
4033 [(set_attr "type" "ilog,ild,ist,fcpys,fld,fst,itof,ftoi")])
4035 (define_expand "movsf"
4036 [(set (match_operand:SF 0 "nonimmediate_operand" "")
4037 (match_operand:SF 1 "general_operand" ""))]
4041 if (GET_CODE (operands[0]) == MEM
4042 && ! reg_or_fp0_operand (operands[1], SFmode))
4043 operands[1] = force_reg (SFmode, operands[1]);
4046 (define_expand "movdf"
4047 [(set (match_operand:DF 0 "nonimmediate_operand" "")
4048 (match_operand:DF 1 "general_operand" ""))]
4052 if (GET_CODE (operands[0]) == MEM
4053 && ! reg_or_fp0_operand (operands[1], DFmode))
4054 operands[1] = force_reg (DFmode, operands[1]);
4058 [(set (match_operand:SI 0 "nonimmediate_operand" "=r,r,r,r,m,f,f,m")
4059 (match_operand:SI 1 "input_operand" "rJ,K,L,m,rJ,fJ,m,f"))]
4060 "! TARGET_WINDOWS_NT && ! TARGET_OPEN_VMS && ! TARGET_CIX
4061 && (register_operand (operands[0], SImode)
4062 || reg_or_0_operand (operands[1], SImode))"
4072 [(set_attr "type" "ilog,iadd,iadd,ild,ist,fcpys,fld,fst")])
4075 [(set (match_operand:SI 0 "nonimmediate_operand" "=r,r,r,r,m,f,f,m,r,*f")
4076 (match_operand:SI 1 "input_operand" "rJ,K,L,m,rJ,fJ,m,f,f,*r"))]
4077 "! TARGET_WINDOWS_NT && ! TARGET_OPEN_VMS && TARGET_CIX
4078 && (register_operand (operands[0], SImode)
4079 || reg_or_0_operand (operands[1], SImode))"
4091 [(set_attr "type" "ilog,iadd,iadd,ild,ist,fcpys,fld,fst,ftoi,itof")])
4094 [(set (match_operand:SI 0 "nonimmediate_operand" "=r,r,r,r,r,m,f,f,m")
4095 (match_operand:SI 1 "input_operand" "rJ,K,L,s,m,rJ,fJ,m,f"))]
4096 "(TARGET_WINDOWS_NT || TARGET_OPEN_VMS)
4097 && (register_operand (operands[0], SImode)
4098 || reg_or_0_operand (operands[1], SImode))"
4109 [(set_attr "type" "ilog,iadd,iadd,ldsym,ild,ist,fcpys,fld,fst")])
4112 [(set (match_operand:HI 0 "nonimmediate_operand" "=r,r,f")
4113 (match_operand:HI 1 "input_operand" "rJ,n,fJ"))]
4115 && (register_operand (operands[0], HImode)
4116 || register_operand (operands[1], HImode))"
4121 [(set_attr "type" "ilog,iadd,fcpys")])
4124 [(set (match_operand:HI 0 "nonimmediate_operand" "=r,r,r,m,f")
4125 (match_operand:HI 1 "input_operand" "rJ,n,m,rJ,fJ"))]
4127 && (register_operand (operands[0], HImode)
4128 || reg_or_0_operand (operands[1], HImode))"
4135 [(set_attr "type" "ilog,iadd,ild,ist,fcpys")])
4138 [(set (match_operand:QI 0 "nonimmediate_operand" "=r,r,f")
4139 (match_operand:QI 1 "input_operand" "rJ,n,fJ"))]
4141 && (register_operand (operands[0], QImode)
4142 || register_operand (operands[1], QImode))"
4147 [(set_attr "type" "ilog,iadd,fcpys")])
4150 [(set (match_operand:QI 0 "nonimmediate_operand" "=r,r,r,m,f")
4151 (match_operand:QI 1 "input_operand" "rJ,n,m,rJ,fJ"))]
4153 && (register_operand (operands[0], QImode)
4154 || reg_or_0_operand (operands[1], QImode))"
4161 [(set_attr "type" "ilog,iadd,ild,ist,fcpys")])
4163 ;; We do two major things here: handle mem->mem and construct long
4166 (define_expand "movsi"
4167 [(set (match_operand:SI 0 "general_operand" "")
4168 (match_operand:SI 1 "general_operand" ""))]
4172 if (GET_CODE (operands[0]) == MEM
4173 && ! reg_or_0_operand (operands[1], SImode))
4174 operands[1] = force_reg (SImode, operands[1]);
4176 if (! CONSTANT_P (operands[1]) || input_operand (operands[1], SImode))
4178 else if (GET_CODE (operands[1]) == CONST_INT)
4181 = alpha_emit_set_const (operands[0], SImode, INTVAL (operands[1]), 3);
4182 if (rtx_equal_p (operands[0], operands[1]))
4187 ;; Split a load of a large constant into the appropriate two-insn
4191 [(set (match_operand:SI 0 "register_operand" "")
4192 (match_operand:SI 1 "const_int_operand" ""))]
4193 "! add_operand (operands[1], SImode)"
4194 [(set (match_dup 0) (match_dup 2))
4195 (set (match_dup 0) (plus:SI (match_dup 0) (match_dup 3)))]
4198 = alpha_emit_set_const (operands[0], SImode, INTVAL (operands[1]), 2);
4200 if (tem == operands[0])
4207 [(set (match_operand:DI 0 "general_operand" "=r,r,r,r,r,m,f,f,Q")
4208 (match_operand:DI 1 "input_operand" "rJ,K,L,s,m,rJ,fJ,Q,f"))]
4210 && (register_operand (operands[0], DImode)
4211 || reg_or_0_operand (operands[1], DImode))"
4222 [(set_attr "type" "ilog,iadd,iadd,ldsym,ild,ist,fcpys,fld,fst")])
4225 [(set (match_operand:DI 0 "general_operand" "=r,r,r,r,r,m,f,f,Q,r,*f")
4226 (match_operand:DI 1 "input_operand" "rJ,K,L,s,m,rJ,fJ,Q,f,f,*r"))]
4228 && (register_operand (operands[0], DImode)
4229 || reg_or_0_operand (operands[1], DImode))"
4242 [(set_attr "type" "ilog,iadd,iadd,ldsym,ild,ist,fcpys,fld,fst,ftoi,itof")])
4244 ;; We do three major things here: handle mem->mem, put 64-bit constants in
4245 ;; memory, and construct long 32-bit constants.
4247 (define_expand "movdi"
4248 [(set (match_operand:DI 0 "general_operand" "")
4249 (match_operand:DI 1 "general_operand" ""))]
4255 if (GET_CODE (operands[0]) == MEM
4256 && ! reg_or_0_operand (operands[1], DImode))
4257 operands[1] = force_reg (DImode, operands[1]);
4259 if (! CONSTANT_P (operands[1]) || input_operand (operands[1], DImode))
4261 else if (GET_CODE (operands[1]) == CONST_INT
4262 && (tem = alpha_emit_set_const (operands[0], DImode,
4263 INTVAL (operands[1]), 3)) != 0)
4265 if (rtx_equal_p (tem, operands[0]))
4270 else if (CONSTANT_P (operands[1]))
4272 if (TARGET_BUILD_CONSTANTS)
4274 HOST_WIDE_INT i0, i1;
4276 if (GET_CODE (operands[1]) == CONST_INT)
4278 i0 = INTVAL (operands[1]);
4281 else if (GET_CODE (operands[1]) == CONST_DOUBLE)
4283 #if HOST_BITS_PER_WIDE_INT >= 64
4284 i0 = CONST_DOUBLE_LOW (operands[1]);
4287 i0 = CONST_DOUBLE_LOW (operands[1]);
4288 i1 = CONST_DOUBLE_HIGH (operands[1]);
4294 tem = alpha_emit_set_long_const (operands[0], i0, i1);
4295 if (rtx_equal_p (tem, operands[0]))
4302 operands[1] = force_const_mem (DImode, operands[1]);
4303 if (reload_in_progress)
4305 emit_move_insn (operands[0], XEXP (operands[1], 0));
4306 operands[1] = copy_rtx (operands[1]);
4307 XEXP (operands[1], 0) = operands[0];
4310 operands[1] = validize_mem (operands[1]);
4317 ;; Split a load of a large constant into the appropriate two-insn
4321 [(set (match_operand:DI 0 "register_operand" "")
4322 (match_operand:DI 1 "const_int_operand" ""))]
4323 "! add_operand (operands[1], DImode)"
4324 [(set (match_dup 0) (match_dup 2))
4325 (set (match_dup 0) (plus:DI (match_dup 0) (match_dup 3)))]
4328 = alpha_emit_set_const (operands[0], DImode, INTVAL (operands[1]), 2);
4330 if (tem == operands[0])
4336 ;; These are the partial-word cases.
4338 ;; First we have the code to load an aligned word. Operand 0 is the register
4339 ;; in which to place the result. It's mode is QImode or HImode. Operand 1
4340 ;; is an SImode MEM at the low-order byte of the proper word. Operand 2 is the
4341 ;; number of bits within the word that the value is. Operand 3 is an SImode
4342 ;; scratch register. If operand 0 is a hard register, operand 3 may be the
4343 ;; same register. It is allowed to conflict with operand 1 as well.
4345 (define_expand "aligned_loadqi"
4346 [(set (match_operand:SI 3 "register_operand" "")
4347 (match_operand:SI 1 "memory_operand" ""))
4348 (set (subreg:DI (match_operand:QI 0 "register_operand" "") 0)
4349 (zero_extract:DI (subreg:DI (match_dup 3) 0)
4351 (match_operand:DI 2 "const_int_operand" "")))]
4356 (define_expand "aligned_loadhi"
4357 [(set (match_operand:SI 3 "register_operand" "")
4358 (match_operand:SI 1 "memory_operand" ""))
4359 (set (subreg:DI (match_operand:HI 0 "register_operand" "") 0)
4360 (zero_extract:DI (subreg:DI (match_dup 3) 0)
4362 (match_operand:DI 2 "const_int_operand" "")))]
4367 ;; Similar for unaligned loads, where we use the sequence from the
4368 ;; Alpha Architecture manual.
4370 ;; Operand 1 is the address. Operands 2 and 3 are temporaries, where
4371 ;; operand 3 can overlap the input and output registers.
4373 (define_expand "unaligned_loadqi"
4374 [(set (match_operand:DI 2 "register_operand" "")
4375 (mem:DI (and:DI (match_operand:DI 1 "address_operand" "")
4377 (set (match_operand:DI 3 "register_operand" "")
4379 (set (subreg:DI (match_operand:QI 0 "register_operand" "") 0)
4380 (zero_extract:DI (match_dup 2)
4382 (ashift:DI (match_dup 3) (const_int 3))))]
4386 (define_expand "unaligned_loadhi"
4387 [(set (match_operand:DI 2 "register_operand" "")
4388 (mem:DI (and:DI (match_operand:DI 1 "address_operand" "")
4390 (set (match_operand:DI 3 "register_operand" "")
4392 (set (subreg:DI (match_operand:QI 0 "register_operand" "") 0)
4393 (zero_extract:DI (match_dup 2)
4395 (ashift:DI (match_dup 3) (const_int 3))))]
4399 ;; Storing an aligned byte or word requires two temporaries. Operand 0 is the
4400 ;; aligned SImode MEM. Operand 1 is the register containing the
4401 ;; byte or word to store. Operand 2 is the number of bits within the word that
4402 ;; the value should be placed. Operands 3 and 4 are SImode temporaries.
4404 (define_expand "aligned_store"
4405 [(set (match_operand:SI 3 "register_operand" "")
4406 (match_operand:SI 0 "memory_operand" ""))
4407 (set (subreg:DI (match_dup 3) 0)
4408 (and:DI (subreg:DI (match_dup 3) 0) (match_dup 5)))
4409 (set (subreg:DI (match_operand:SI 4 "register_operand" "") 0)
4410 (ashift:DI (zero_extend:DI (match_operand 1 "register_operand" ""))
4411 (match_operand:DI 2 "const_int_operand" "")))
4412 (set (subreg:DI (match_dup 4) 0)
4413 (ior:DI (subreg:DI (match_dup 4) 0) (subreg:DI (match_dup 3) 0)))
4414 (set (match_dup 0) (match_dup 4))]
4417 { operands[5] = GEN_INT (~ (GET_MODE_MASK (GET_MODE (operands[1]))
4418 << INTVAL (operands[2])));
4421 ;; For the unaligned byte and halfword cases, we use code similar to that
4422 ;; in the ;; Architecture book, but reordered to lower the number of registers
4423 ;; required. Operand 0 is the address. Operand 1 is the data to store.
4424 ;; Operands 2, 3, and 4 are DImode temporaries, where operands 2 and 4 may
4425 ;; be the same temporary, if desired. If the address is in a register,
4426 ;; operand 2 can be that register.
4428 (define_expand "unaligned_storeqi"
4429 [(set (match_operand:DI 3 "register_operand" "")
4430 (mem:DI (and:DI (match_operand:DI 0 "address_operand" "")
4432 (set (match_operand:DI 2 "register_operand" "")
4435 (and:DI (not:DI (ashift:DI (const_int 255)
4436 (ashift:DI (match_dup 2) (const_int 3))))
4438 (set (match_operand:DI 4 "register_operand" "")
4439 (ashift:DI (zero_extend:DI (match_operand:QI 1 "register_operand" ""))
4440 (ashift:DI (match_dup 2) (const_int 3))))
4441 (set (match_dup 4) (ior:DI (match_dup 4) (match_dup 3)))
4442 (set (mem:DI (and:DI (match_dup 0) (const_int -8)))
4447 (define_expand "unaligned_storehi"
4448 [(set (match_operand:DI 3 "register_operand" "")
4449 (mem:DI (and:DI (match_operand:DI 0 "address_operand" "")
4451 (set (match_operand:DI 2 "register_operand" "")
4454 (and:DI (not:DI (ashift:DI (const_int 65535)
4455 (ashift:DI (match_dup 2) (const_int 3))))
4457 (set (match_operand:DI 4 "register_operand" "")
4458 (ashift:DI (zero_extend:DI (match_operand:HI 1 "register_operand" ""))
4459 (ashift:DI (match_dup 2) (const_int 3))))
4460 (set (match_dup 4) (ior:DI (match_dup 4) (match_dup 3)))
4461 (set (mem:DI (and:DI (match_dup 0) (const_int -8)))
4466 ;; Here are the define_expand's for QI and HI moves that use the above
4467 ;; patterns. We have the normal sets, plus the ones that need scratch
4468 ;; registers for reload.
4470 (define_expand "movqi"
4471 [(set (match_operand:QI 0 "general_operand" "")
4472 (match_operand:QI 1 "general_operand" ""))]
4478 if (GET_CODE (operands[0]) == MEM
4479 && ! reg_or_0_operand (operands[1], QImode))
4480 operands[1] = force_reg (QImode, operands[1]);
4482 if (GET_CODE (operands[1]) == CONST_INT
4483 && ! input_operand (operands[1], QImode))
4485 operands[1] = alpha_emit_set_const (operands[0], QImode,
4486 INTVAL (operands[1]), 3);
4488 if (rtx_equal_p (operands[0], operands[1]))
4495 /* If the output is not a register, the input must be. */
4496 if (GET_CODE (operands[0]) == MEM)
4497 operands[1] = force_reg (QImode, operands[1]);
4499 /* Handle four memory cases, unaligned and aligned for either the input
4500 or the output. The only case where we can be called during reload is
4501 for aligned loads; all other cases require temporaries. */
4503 if (GET_CODE (operands[1]) == MEM
4504 || (GET_CODE (operands[1]) == SUBREG
4505 && GET_CODE (SUBREG_REG (operands[1])) == MEM)
4506 || (reload_in_progress && GET_CODE (operands[1]) == REG
4507 && REGNO (operands[1]) >= FIRST_PSEUDO_REGISTER)
4508 || (reload_in_progress && GET_CODE (operands[1]) == SUBREG
4509 && GET_CODE (SUBREG_REG (operands[1])) == REG
4510 && REGNO (SUBREG_REG (operands[1])) >= FIRST_PSEUDO_REGISTER))
4512 if (aligned_memory_operand (operands[1], QImode))
4514 rtx aligned_mem, bitnum;
4515 rtx scratch = (reload_in_progress
4516 ? gen_rtx_REG (SImode, REGNO (operands[0]))
4517 : gen_reg_rtx (SImode));
4519 get_aligned_mem (operands[1], &aligned_mem, &bitnum);
4521 emit_insn (gen_aligned_loadqi (operands[0], aligned_mem, bitnum,
4526 /* Don't pass these as parameters since that makes the generated
4527 code depend on parameter evaluation order which will cause
4528 bootstrap failures. */
4530 rtx temp1 = gen_reg_rtx (DImode);
4531 rtx temp2 = gen_reg_rtx (DImode);
4533 = gen_unaligned_loadqi (operands[0],
4534 get_unaligned_address (operands[1], 0),
4537 alpha_set_memflags (seq, operands[1]);
4544 else if (GET_CODE (operands[0]) == MEM
4545 || (GET_CODE (operands[0]) == SUBREG
4546 && GET_CODE (SUBREG_REG (operands[0])) == MEM)
4547 || (reload_in_progress && GET_CODE (operands[0]) == REG
4548 && REGNO (operands[0]) >= FIRST_PSEUDO_REGISTER)
4549 || (reload_in_progress && GET_CODE (operands[0]) == SUBREG
4550 && GET_CODE (SUBREG_REG (operands[0])) == REG
4551 && REGNO (operands[0]) >= FIRST_PSEUDO_REGISTER))
4553 if (aligned_memory_operand (operands[0], QImode))
4555 rtx aligned_mem, bitnum;
4556 rtx temp1 = gen_reg_rtx (SImode);
4557 rtx temp2 = gen_reg_rtx (SImode);
4559 get_aligned_mem (operands[0], &aligned_mem, &bitnum);
4561 emit_insn (gen_aligned_store (aligned_mem, operands[1], bitnum,
4566 rtx temp1 = gen_reg_rtx (DImode);
4567 rtx temp2 = gen_reg_rtx (DImode);
4568 rtx temp3 = gen_reg_rtx (DImode);
4570 = gen_unaligned_storeqi (get_unaligned_address (operands[0], 0),
4571 operands[1], temp1, temp2, temp3);
4573 alpha_set_memflags (seq, operands[0]);
4581 (define_expand "movhi"
4582 [(set (match_operand:HI 0 "general_operand" "")
4583 (match_operand:HI 1 "general_operand" ""))]
4589 if (GET_CODE (operands[0]) == MEM
4590 && ! reg_or_0_operand (operands[1], HImode))
4591 operands[1] = force_reg (HImode, operands[1]);
4593 if (GET_CODE (operands[1]) == CONST_INT
4594 && ! input_operand (operands[1], HImode))
4596 operands[1] = alpha_emit_set_const (operands[0], HImode,
4597 INTVAL (operands[1]), 3);
4599 if (rtx_equal_p (operands[0], operands[1]))
4606 /* If the output is not a register, the input must be. */
4607 if (GET_CODE (operands[0]) == MEM)
4608 operands[1] = force_reg (HImode, operands[1]);
4610 /* Handle four memory cases, unaligned and aligned for either the input
4611 or the output. The only case where we can be called during reload is
4612 for aligned loads; all other cases require temporaries. */
4614 if (GET_CODE (operands[1]) == MEM
4615 || (GET_CODE (operands[1]) == SUBREG
4616 && GET_CODE (SUBREG_REG (operands[1])) == MEM)
4617 || (reload_in_progress && GET_CODE (operands[1]) == REG
4618 && REGNO (operands[1]) >= FIRST_PSEUDO_REGISTER)
4619 || (reload_in_progress && GET_CODE (operands[1]) == SUBREG
4620 && GET_CODE (SUBREG_REG (operands[1])) == REG
4621 && REGNO (SUBREG_REG (operands[1])) >= FIRST_PSEUDO_REGISTER))
4623 if (aligned_memory_operand (operands[1], HImode))
4625 rtx aligned_mem, bitnum;
4626 rtx scratch = (reload_in_progress
4627 ? gen_rtx_REG (SImode, REGNO (operands[0]))
4628 : gen_reg_rtx (SImode));
4630 get_aligned_mem (operands[1], &aligned_mem, &bitnum);
4632 emit_insn (gen_aligned_loadhi (operands[0], aligned_mem, bitnum,
4637 /* Don't pass these as parameters since that makes the generated
4638 code depend on parameter evaluation order which will cause
4639 bootstrap failures. */
4641 rtx temp1 = gen_reg_rtx (DImode);
4642 rtx temp2 = gen_reg_rtx (DImode);
4644 = gen_unaligned_loadhi (operands[0],
4645 get_unaligned_address (operands[1], 0),
4648 alpha_set_memflags (seq, operands[1]);
4655 else if (GET_CODE (operands[0]) == MEM
4656 || (GET_CODE (operands[0]) == SUBREG
4657 && GET_CODE (SUBREG_REG (operands[0])) == MEM)
4658 || (reload_in_progress && GET_CODE (operands[0]) == REG
4659 && REGNO (operands[0]) >= FIRST_PSEUDO_REGISTER)
4660 || (reload_in_progress && GET_CODE (operands[0]) == SUBREG
4661 && GET_CODE (SUBREG_REG (operands[0])) == REG
4662 && REGNO (operands[0]) >= FIRST_PSEUDO_REGISTER))
4664 if (aligned_memory_operand (operands[0], HImode))
4666 rtx aligned_mem, bitnum;
4667 rtx temp1 = gen_reg_rtx (SImode);
4668 rtx temp2 = gen_reg_rtx (SImode);
4670 get_aligned_mem (operands[0], &aligned_mem, &bitnum);
4672 emit_insn (gen_aligned_store (aligned_mem, operands[1], bitnum,
4677 rtx temp1 = gen_reg_rtx (DImode);
4678 rtx temp2 = gen_reg_rtx (DImode);
4679 rtx temp3 = gen_reg_rtx (DImode);
4681 = gen_unaligned_storehi (get_unaligned_address (operands[0], 0),
4682 operands[1], temp1, temp2, temp3);
4684 alpha_set_memflags (seq, operands[0]);
4693 ;; Here are the versions for reload. Note that in the unaligned cases
4694 ;; we know that the operand must not be a pseudo-register because stack
4695 ;; slots are always aligned references.
4697 (define_expand "reload_inqi"
4698 [(parallel [(match_operand:QI 0 "register_operand" "=r")
4699 (match_operand:QI 1 "unaligned_memory_operand" "m")
4700 (match_operand:TI 2 "register_operand" "=&r")])]
4704 rtx addr = get_unaligned_address (operands[1], 0);
4706 /* It is possible that one of the registers we got for operands[2]
4707 might coincide with that of operands[0] (which is why we made
4708 it TImode). Pick the other one to use as our scratch. */
4709 rtx scratch = gen_rtx_REG (DImode,
4710 REGNO (operands[0]) == REGNO (operands[2])
4711 ? REGNO (operands[2]) + 1 : REGNO (operands[2]));
4713 rtx seq = gen_unaligned_loadqi (operands[0], addr, scratch,
4714 gen_rtx_REG (DImode, REGNO (operands[0])));
4716 alpha_set_memflags (seq, operands[1]);
4721 (define_expand "reload_inhi"
4722 [(parallel [(match_operand:HI 0 "register_operand" "=r")
4723 (match_operand:HI 1 "unaligned_memory_operand" "m")
4724 (match_operand:TI 2 "register_operand" "=&r")])]
4728 rtx addr = get_unaligned_address (operands[1], 0);
4730 /* It is possible that one of the registers we got for operands[2]
4731 might coincide with that of operands[0] (which is why we made
4732 it TImode). Pick the other one to use as our scratch. */
4733 rtx scratch = gen_rtx_REG (DImode,
4734 REGNO (operands[0]) == REGNO (operands[2])
4735 ? REGNO (operands[2]) + 1 : REGNO (operands[2]));
4737 rtx seq = gen_unaligned_loadhi (operands[0], addr, scratch,
4738 gen_rtx_REG (DImode, REGNO (operands[0])));
4740 alpha_set_memflags (seq, operands[1]);
4745 (define_expand "reload_outqi"
4746 [(parallel [(match_operand:QI 0 "any_memory_operand" "=m")
4747 (match_operand:QI 1 "register_operand" "r")
4748 (match_operand:TI 2 "register_operand" "=&r")])]
4752 if (aligned_memory_operand (operands[0], QImode))
4754 rtx aligned_mem, bitnum;
4756 get_aligned_mem (operands[0], &aligned_mem, &bitnum);
4758 emit_insn (gen_aligned_store (aligned_mem, operands[1], bitnum,
4759 gen_rtx_REG (SImode, REGNO (operands[2])),
4760 gen_rtx_REG (SImode,
4761 REGNO (operands[2]) + 1)));
4765 rtx addr = get_unaligned_address (operands[0], 0);
4766 rtx scratch1 = gen_rtx_REG (DImode, REGNO (operands[2]));
4767 rtx scratch2 = gen_rtx_REG (DImode, REGNO (operands[2]) + 1);
4768 rtx scratch3 = scratch1;
4771 if (GET_CODE (addr) == REG)
4774 seq = gen_unaligned_storeqi (addr, operands[1], scratch1,
4775 scratch2, scratch3);
4776 alpha_set_memflags (seq, operands[0]);
4783 (define_expand "reload_outhi"
4784 [(parallel [(match_operand:HI 0 "any_memory_operand" "=m")
4785 (match_operand:HI 1 "register_operand" "r")
4786 (match_operand:TI 2 "register_operand" "=&r")])]
4790 if (aligned_memory_operand (operands[0], HImode))
4792 rtx aligned_mem, bitnum;
4794 get_aligned_mem (operands[0], &aligned_mem, &bitnum);
4796 emit_insn (gen_aligned_store (aligned_mem, operands[1], bitnum,
4797 gen_rtx_REG (SImode, REGNO (operands[2])),
4798 gen_rtx_REG (SImode,
4799 REGNO (operands[2]) + 1)));
4803 rtx addr = get_unaligned_address (operands[0], 0);
4804 rtx scratch1 = gen_rtx_REG (DImode, REGNO (operands[2]));
4805 rtx scratch2 = gen_rtx_REG (DImode, REGNO (operands[2]) + 1);
4806 rtx scratch3 = scratch1;
4809 if (GET_CODE (addr) == REG)
4812 seq = gen_unaligned_storehi (addr, operands[1], scratch1,
4813 scratch2, scratch3);
4814 alpha_set_memflags (seq, operands[0]);
4821 ;; Bit field extract patterns which use ext[wlq][lh]
4823 (define_expand "extv"
4824 [(set (match_operand:DI 0 "register_operand" "")
4825 (sign_extract:DI (match_operand:QI 1 "memory_operand" "")
4826 (match_operand:DI 2 "immediate_operand" "")
4827 (match_operand:DI 3 "immediate_operand" "")))]
4831 /* We can do 16, 32 and 64 bit fields, if aligned on byte boundaries. */
4832 if (INTVAL (operands[3]) % 8 != 0
4833 || (INTVAL (operands[2]) != 16
4834 && INTVAL (operands[2]) != 32
4835 && INTVAL (operands[2]) != 64))
4838 /* From mips.md: extract_bit_field doesn't verify that our source
4839 matches the predicate, so we force it to be a MEM here. */
4840 if (GET_CODE (operands[1]) != MEM)
4843 alpha_expand_unaligned_load (operands[0], operands[1],
4844 INTVAL (operands[2]) / 8,
4845 INTVAL (operands[3]) / 8, 1);
4849 (define_expand "extzv"
4850 [(set (match_operand:DI 0 "register_operand" "")
4851 (zero_extract:DI (match_operand:DI 1 "general_operand" "")
4852 (match_operand:DI 2 "immediate_operand" "")
4853 (match_operand:DI 3 "immediate_operand" "")))]
4857 /* We can do 8, 16, 32 and 64 bit fields, if aligned on byte boundaries. */
4858 if (INTVAL (operands[3]) % 8 != 0
4859 || (INTVAL (operands[2]) != 8
4860 && INTVAL (operands[2]) != 16
4861 && INTVAL (operands[2]) != 32
4862 && INTVAL (operands[2]) != 64))
4865 if (GET_CODE (operands[1]) == MEM)
4867 /* Fail 8 bit fields, falling back on a simple byte load. */
4868 if (INTVAL (operands[2]) == 8)
4871 alpha_expand_unaligned_load (operands[0], operands[1],
4872 INTVAL (operands[2]) / 8,
4873 INTVAL (operands[3]) / 8, 0);
4878 (define_expand "insv"
4879 [(set (zero_extract:DI (match_operand:QI 0 "memory_operand" "")
4880 (match_operand:DI 1 "immediate_operand" "")
4881 (match_operand:DI 2 "immediate_operand" ""))
4882 (match_operand:DI 3 "register_operand" ""))]
4886 /* We can do 16, 32 and 64 bit fields, if aligned on byte boundaries. */
4887 if (INTVAL (operands[2]) % 8 != 0
4888 || (INTVAL (operands[1]) != 16
4889 && INTVAL (operands[1]) != 32
4890 && INTVAL (operands[1]) != 64))
4893 /* From mips.md: store_bit_field doesn't verify that our source
4894 matches the predicate, so we force it to be a MEM here. */
4895 if (GET_CODE (operands[0]) != MEM)
4898 alpha_expand_unaligned_store (operands[0], operands[3],
4899 INTVAL (operands[1]) / 8,
4900 INTVAL (operands[2]) / 8);
4906 ;; Block move/clear, see alpha.c for more details.
4907 ;; Argument 0 is the destination
4908 ;; Argument 1 is the source
4909 ;; Argument 2 is the length
4910 ;; Argument 3 is the alignment
4912 (define_expand "movstrqi"
4913 [(parallel [(set (match_operand:BLK 0 "general_operand" "")
4914 (match_operand:BLK 1 "general_operand" ""))
4915 (use (match_operand:DI 2 "immediate_operand" ""))
4916 (use (match_operand:DI 3 "immediate_operand" ""))])]
4920 if (alpha_expand_block_move (operands))
4926 (define_expand "clrstrqi"
4927 [(parallel [(set (match_operand:BLK 0 "general_operand" "")
4929 (use (match_operand:DI 1 "immediate_operand" ""))
4930 (use (match_operand:DI 2 "immediate_operand" ""))])]
4934 if (alpha_expand_block_clear (operands))
4940 ;; Subroutine of stack space allocation. Perform a stack probe.
4941 (define_expand "probe_stack"
4942 [(set (match_dup 1) (match_operand:DI 0 "const_int_operand" ""))]
4946 operands[1] = gen_rtx_MEM (DImode, plus_constant (stack_pointer_rtx,
4947 INTVAL (operands[0])));
4948 MEM_VOLATILE_P (operands[1]) = 1;
4950 operands[0] = const0_rtx;
4953 ;; This is how we allocate stack space. If we are allocating a
4954 ;; constant amount of space and we know it is less than 4096
4955 ;; bytes, we need do nothing.
4957 ;; If it is more than 4096 bytes, we need to probe the stack
4959 (define_expand "allocate_stack"
4961 (plus:DI (reg:DI 30)
4962 (match_operand:DI 1 "reg_or_cint_operand" "")))
4963 (set (match_operand:DI 0 "register_operand" "=r")
4968 if (GET_CODE (operands[1]) == CONST_INT
4969 && INTVAL (operands[1]) < 32768)
4971 if (INTVAL (operands[1]) >= 4096)
4973 /* We do this the same way as in the prologue and generate explicit
4974 probes. Then we update the stack by the constant. */
4978 emit_insn (gen_probe_stack (GEN_INT (- probed)));
4979 while (probed + 8192 < INTVAL (operands[1]))
4980 emit_insn (gen_probe_stack (GEN_INT (- (probed += 8192))));
4982 if (probed + 4096 < INTVAL (operands[1]))
4983 emit_insn (gen_probe_stack (GEN_INT (- INTVAL(operands[1]))));
4986 operands[1] = GEN_INT (- INTVAL (operands[1]));
4987 operands[2] = virtual_stack_dynamic_rtx;
4992 rtx loop_label = gen_label_rtx ();
4993 rtx want = gen_reg_rtx (Pmode);
4994 rtx tmp = gen_reg_rtx (Pmode);
4997 emit_insn (gen_subdi3 (want, stack_pointer_rtx,
4998 force_reg (Pmode, operands[1])));
4999 emit_insn (gen_adddi3 (tmp, stack_pointer_rtx, GEN_INT (-4096)));
5001 if (GET_CODE (operands[1]) != CONST_INT)
5003 out_label = gen_label_rtx ();
5004 emit_insn (gen_cmpdi (want, tmp));
5005 emit_jump_insn (gen_bgeu (out_label));
5008 emit_label (loop_label);
5009 memref = gen_rtx_MEM (DImode, tmp);
5010 MEM_VOLATILE_P (memref) = 1;
5011 emit_move_insn (memref, const0_rtx);
5012 emit_insn (gen_adddi3 (tmp, tmp, GEN_INT(-8192)));
5013 emit_insn (gen_cmpdi (tmp, want));
5014 emit_jump_insn (gen_bgtu (loop_label));
5016 gen_rtx_USE (VOIDmode, tmp);
5018 memref = gen_rtx_MEM (DImode, want);
5019 MEM_VOLATILE_P (memref) = 1;
5020 emit_move_insn (memref, const0_rtx);
5023 emit_label (out_label);
5025 emit_move_insn (stack_pointer_rtx, want);
5026 emit_move_insn (operands[0], virtual_stack_dynamic_rtx);
5031 ;; This is used by alpha_expand_prolog to do the same thing as above,
5032 ;; except we cannot at that time generate new basic blocks, so we hide
5033 ;; the loop in this one insn.
5035 (define_insn "prologue_stack_probe_loop"
5036 [(unspec_volatile [(match_operand 0 "register_operand" "r")
5037 (match_operand 1 "register_operand" "r")] 5)]
5041 operands[2] = gen_label_rtx ();
5042 ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, \"L\",
5043 CODE_LABEL_NUMBER (operands[2]));
5045 return \"stq $31,-8192(%1)\;subq %0,1,%0\;lda %1,-8192(%1)\;bne %0,%l2\";
5047 [(set_attr "length" "16")
5048 (set_attr "type" "multi")])
5050 (define_expand "prologue"
5051 [(clobber (const_int 0))]
5053 "alpha_expand_prologue (); DONE;")
5055 (define_insn "init_fp"
5056 [(set (match_operand:DI 0 "register_operand" "r")
5057 (match_operand:DI 1 "register_operand" "r"))
5058 (clobber (mem:BLK (match_operand:DI 2 "register_operand" "r")))]
5062 (define_expand "epilogue"
5063 [(clobber (const_int 0))]
5065 "alpha_expand_epilogue (); DONE;")
5067 (define_expand "eh_epilogue"
5068 [(use (match_operand:DI 0 "register_operand" "r"))
5069 (use (match_operand:DI 1 "register_operand" "r"))
5070 (use (match_operand:DI 2 "register_operand" "r"))]
5074 alpha_eh_epilogue_sp_ofs = operands[1];
5075 if (GET_CODE (operands[2]) != REG || REGNO (operands[2]) != 26)
5077 rtx ra = gen_rtx_REG (Pmode, 26);
5078 emit_move_insn (ra, operands[2]);
5083 (define_expand "builtin_longjmp"
5084 [(unspec_volatile [(match_operand 0 "register_operand" "r")] 3)]
5085 "! TARGET_OPEN_VMS && ! TARGET_WINDOWS_NT"
5088 /* The elements of the buffer are, in order: */
5089 rtx fp = gen_rtx_MEM (Pmode, operands[0]);
5090 rtx lab = gen_rtx_MEM (Pmode, plus_constant (operands[0], 8));
5091 rtx stack = gen_rtx_MEM (Pmode, plus_constant (operands[0], 16));
5092 rtx pv = gen_rtx_REG (Pmode, 27);
5094 /* This bit is the same as expand_builtin_longjmp. */
5095 emit_move_insn (hard_frame_pointer_rtx, fp);
5096 emit_move_insn (pv, lab);
5097 emit_stack_restore (SAVE_NONLOCAL, stack, NULL_RTX);
5098 emit_insn (gen_rtx_USE (VOIDmode, hard_frame_pointer_rtx));
5099 emit_insn (gen_rtx_USE (VOIDmode, stack_pointer_rtx));
5101 /* Load the label we are jumping through into $27 so that we know
5102 where to look for it when we get back to setjmp's function for
5103 restoring the gp. */
5104 emit_indirect_jump (pv);
5108 (define_insn "builtin_setjmp_receiver"
5109 [(unspec_volatile [(match_operand 0 "" "")] 2)]
5110 "! TARGET_OPEN_VMS && ! TARGET_WINDOWS_NT && TARGET_AS_CAN_SUBTRACT_LABELS"
5111 "\\n$LSJ%=:\;ldgp $29,$LSJ%=-%l0($27)"
5112 [(set_attr "length" "8")
5113 (set_attr "type" "multi")])
5116 [(unspec_volatile [(match_operand 0 "" "")] 2)]
5117 "! TARGET_OPEN_VMS && ! TARGET_WINDOWS_NT"
5118 "br $29,$LSJ%=\\n$LSJ%=:\;ldgp $29,0($29)"
5119 [(set_attr "length" "12")
5120 (set_attr "type" "multi")])
5122 (define_insn "exception_receiver"
5123 [(unspec_volatile [(const_int 0)] 7)]
5124 "! TARGET_OPEN_VMS && ! TARGET_WINDOWS_NT"
5125 "br $29,$LSJ%=\\n$LSJ%=:\;ldgp $29,0($29)"
5126 [(set_attr "length" "12")
5127 (set_attr "type" "multi")])
5129 (define_expand "nonlocal_goto_receiver"
5130 [(unspec_volatile [(const_int 0)] 1)
5131 (set (reg:DI 27) (mem:DI (reg:DI 29)))
5132 (unspec_volatile [(const_int 0)] 1)
5137 (define_insn "arg_home"
5138 [(unspec [(const_int 0)] 0)
5153 (clobber (mem:BLK (const_int 0)))
5154 (clobber (reg:DI 24))
5155 (clobber (reg:DI 25))
5156 (clobber (reg:DI 0))]
5158 "lda $0,OTS$HOME_ARGS\;ldq $0,8($0)\;jsr $0,OTS$HOME_ARGS"
5159 [(set_attr "length" "16")
5160 (set_attr "type" "multi")])
5162 ;; Close the trap shadow of preceeding instructions. This is generated
5165 (define_insn "trapb"
5166 [(unspec_volatile [(const_int 0)] 4)]
5169 [(set_attr "type" "misc")])
5171 ;; No-op instructions used by machine-dependant reorg to preserve
5172 ;; alignment for instruction issue.
5178 [(set_attr "type" "ilog")])
5184 [(set_attr "type" "fcpys")])
5191 (define_insn "realign"
5192 [(unspec_volatile [(match_operand 0 "immediate_operand" "i")] 6)]
5194 ".align %0 #realign")
5196 ;; Peepholes go at the end.
5198 ;; Optimize sign-extension of SImode loads. This shows up in the wake of
5199 ;; reload when converting fp->int.
5201 ;; ??? What to do now that we actually care about the packing and
5202 ;; alignment of instructions? Perhaps reload can be enlightened, or
5203 ;; the peephole pass moved up after reload but before sched2?
5206 ; [(set (match_operand:SI 0 "register_operand" "=r")
5207 ; (match_operand:SI 1 "memory_operand" "m"))
5208 ; (set (match_operand:DI 2 "register_operand" "=r")
5209 ; (sign_extend:DI (match_dup 0)))]
5210 ; "dead_or_set_p (insn, operands[0])"
5214 ; [(set (match_operand:SI 0 "register_operand" "=r")
5215 ; (match_operand:SI 1 "hard_fp_register_operand" "f"))
5216 ; (set (match_operand:DI 2 "register_operand" "=r")
5217 ; (sign_extend:DI (match_dup 0)))]
5218 ; "TARGET_CIX && dead_or_set_p (insn, operands[0])"