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:
38 ;; 2 builtin_setjmp_receiver
41 ;; 5 prologue_stack_probe_loop
43 ;; 7 exception_receiver
45 ;; Processor type -- this attribute must exactly match the processor_type
46 ;; enumeration in alpha.h.
48 (define_attr "cpu" "ev4,ev5,ev6"
49 (const (symbol_ref "alpha_cpu")))
51 ;; Define an insn type attribute. This is used in function unit delay
52 ;; computations, among other purposes. For the most part, we use the names
53 ;; defined in the EV4 documentation, but add a few that we have to know about
57 "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"
58 (const_string "iadd"))
60 ;; Describe a user's asm statement.
61 (define_asm_attributes
62 [(set_attr "type" "multi")])
64 ;; Define the operand size an insn operates on. Used primarily by mul
65 ;; and div operations that have size dependant timings.
67 (define_attr "opsize" "si,di,udi" (const_string "di"))
69 ;; The TRAP_TYPE attribute marks instructions that may generate traps
70 ;; (which are imprecise and may need a trapb if software completion
73 (define_attr "trap" "no,yes" (const_string "no"))
75 ;; The length of an instruction sequence in bytes.
77 (define_attr "length" "" (const_int 4))
79 ;; On EV4 there are two classes of resources to consider: resources needed
80 ;; to issue, and resources needed to execute. IBUS[01] are in the first
81 ;; category. ABOX, BBOX, EBOX, FBOX, IMUL & FDIV make up the second.
82 ;; (There are a few other register-like resources, but ...)
84 ; First, describe all of the issue constraints with single cycle delays.
85 ; All insns need a bus, but all except loads require one or the other.
86 (define_function_unit "ev4_ibus0" 1 0
87 (and (eq_attr "cpu" "ev4")
88 (eq_attr "type" "fst,fbr,iadd,imul,ilog,shift,icmov,icmp"))
91 (define_function_unit "ev4_ibus1" 1 0
92 (and (eq_attr "cpu" "ev4")
93 (eq_attr "type" "ist,ibr,jsr,fadd,fcmov,fcpys,fmul,fdiv,misc"))
96 ; Memory delivers its result in three cycles. Actually return one and
97 ; take care of this in adjust_cost, since we want to handle user-defined
99 (define_function_unit "ev4_abox" 1 0
100 (and (eq_attr "cpu" "ev4")
101 (eq_attr "type" "ild,fld,ldsym,ist,fst"))
104 ; Branches have no delay cost, but do tie up the unit for two cycles.
105 (define_function_unit "ev4_bbox" 1 1
106 (and (eq_attr "cpu" "ev4")
107 (eq_attr "type" "ibr,fbr,jsr"))
110 ; Arithmetic insns are normally have their results available after
111 ; two cycles. There are a number of exceptions. They are encoded in
112 ; ADJUST_COST. Some of the other insns have similar exceptions.
113 (define_function_unit "ev4_ebox" 1 0
114 (and (eq_attr "cpu" "ev4")
115 (eq_attr "type" "iadd,ilog,shift,icmov,icmp,misc"))
118 (define_function_unit "imul" 1 0
119 (and (eq_attr "cpu" "ev4")
120 (and (eq_attr "type" "imul")
121 (eq_attr "opsize" "si")))
124 (define_function_unit "imul" 1 0
125 (and (eq_attr "cpu" "ev4")
126 (and (eq_attr "type" "imul")
127 (eq_attr "opsize" "!si")))
130 (define_function_unit "ev4_fbox" 1 0
131 (and (eq_attr "cpu" "ev4")
132 (eq_attr "type" "fadd,fmul,fcpys,fcmov"))
135 (define_function_unit "fdiv" 1 0
136 (and (eq_attr "cpu" "ev4")
137 (and (eq_attr "type" "fdiv")
138 (eq_attr "opsize" "si")))
141 (define_function_unit "fdiv" 1 0
142 (and (eq_attr "cpu" "ev4")
143 (and (eq_attr "type" "fdiv")
144 (eq_attr "opsize" "di")))
147 ;; EV5 scheduling. EV5 can issue 4 insns per clock.
149 ;; EV5 has two asymetric integer units. Model this with E0 & E1 along
150 ;; with the combined resource EBOX.
152 (define_function_unit "ev5_ebox" 2 0
153 (and (eq_attr "cpu" "ev5")
154 (eq_attr "type" "!fbr,fcmov,fadd,fmul,fcpys,fdiv"))
157 ; Memory takes at least 2 clocks. Return one from here and fix up with
158 ; user-defined latencies in adjust_cost.
159 (define_function_unit "ev5_ebox" 2 0
160 (and (eq_attr "cpu" "ev5")
161 (eq_attr "type" "ild,fld,ldsym"))
164 ; Loads can dual issue with one another, but loads and stores do not mix.
165 (define_function_unit "ev5_e0" 1 0
166 (and (eq_attr "cpu" "ev5")
167 (eq_attr "type" "ild,fld,ldsym"))
169 [(eq_attr "type" "ist,fst")])
171 ; Stores, shifts, multiplies can only issue to E0
172 (define_function_unit "ev5_e0" 1 0
173 (and (eq_attr "cpu" "ev5")
174 (eq_attr "type" "ist,fst,shift,imul"))
177 ; Motion video insns also issue only to E0, and take two ticks.
178 (define_function_unit "ev5_e0" 1 0
179 (and (eq_attr "cpu" "ev5")
180 (eq_attr "type" "mvi"))
183 ; Conditional moves always take 2 ticks.
184 (define_function_unit "ev5_ebox" 2 0
185 (and (eq_attr "cpu" "ev5")
186 (eq_attr "type" "icmov"))
189 ; Branches can only issue to E1
190 (define_function_unit "ev5_e1" 1 0
191 (and (eq_attr "cpu" "ev5")
192 (eq_attr "type" "ibr,jsr"))
195 ; Multiplies also use the integer multiplier.
196 ; ??? How to: "No instruction can be issued to pipe E0 exactly two
197 ; cycles before an integer multiplication completes."
198 (define_function_unit "imul" 1 0
199 (and (eq_attr "cpu" "ev5")
200 (and (eq_attr "type" "imul")
201 (eq_attr "opsize" "si")))
204 (define_function_unit "imul" 1 0
205 (and (eq_attr "cpu" "ev5")
206 (and (eq_attr "type" "imul")
207 (eq_attr "opsize" "di")))
210 (define_function_unit "imul" 1 0
211 (and (eq_attr "cpu" "ev5")
212 (and (eq_attr "type" "imul")
213 (eq_attr "opsize" "udi")))
216 ;; Similarly for the FPU we have two asymetric units. But fcpys can issue
217 ;; on either so we have to play the game again.
219 (define_function_unit "ev5_fbox" 2 0
220 (and (eq_attr "cpu" "ev5")
221 (eq_attr "type" "fadd,fcmov,fmul,fcpys,fbr,fdiv"))
224 (define_function_unit "ev5_fm" 1 0
225 (and (eq_attr "cpu" "ev5")
226 (eq_attr "type" "fmul"))
229 ; Add and cmov as you would expect; fbr never produces a result;
230 ; fdiv issues through fa to the divider,
231 (define_function_unit "ev5_fa" 1 0
232 (and (eq_attr "cpu" "ev5")
233 (eq_attr "type" "fadd,fcmov,fbr,fdiv"))
236 ; ??? How to: "No instruction can be issued to pipe FA exactly five
237 ; cycles before a floating point divide completes."
238 (define_function_unit "fdiv" 1 0
239 (and (eq_attr "cpu" "ev5")
240 (and (eq_attr "type" "fdiv")
241 (eq_attr "opsize" "si")))
242 15 15) ; 15 to 31 data dependant
244 (define_function_unit "fdiv" 1 0
245 (and (eq_attr "cpu" "ev5")
246 (and (eq_attr "type" "fdiv")
247 (eq_attr "opsize" "di")))
248 22 22) ; 22 to 60 data dependant
250 ;; EV6 scheduling. EV6 can issue 4 insns per clock.
252 ;; EV6 has two symmetric pairs ("clusters") of two asymetric integer units
253 ;; ("upper" and "lower"), yielding pipe names U0, U1, L0, L1.
255 ;; Conditional moves decompose into two independant primitives, each
256 ;; taking one cycle. Since ev6 is out-of-order, we can't see anything
258 (define_function_unit "ev6_ebox" 4 0
259 (and (eq_attr "cpu" "ev6")
260 (eq_attr "type" "icmov"))
263 (define_function_unit "ev6_ebox" 4 0
264 (and (eq_attr "cpu" "ev6")
265 (eq_attr "type" "!fbr,fcmov,fadd,fmul,fcpys,fdiv,fsqrt"))
268 ;; Integer loads take at least 3 clocks, and only issue to lower units.
269 ;; Return one from here and fix up with user-defined latencies in adjust_cost.
270 (define_function_unit "ev6_l" 2 0
271 (and (eq_attr "cpu" "ev6")
272 (eq_attr "type" "ild,ldsym,ist,fst"))
275 ;; FP loads take at least 4 clocks. Return two from here...
276 (define_function_unit "ev6_l" 2 0
277 (and (eq_attr "cpu" "ev6")
278 (eq_attr "type" "fld"))
281 ;; Motion video insns also issue only to U0, and take three ticks.
282 (define_function_unit "ev6_u0" 1 0
283 (and (eq_attr "cpu" "ev6")
284 (eq_attr "type" "mvi"))
287 (define_function_unit "ev6_u" 2 0
288 (and (eq_attr "cpu" "ev6")
289 (eq_attr "type" "mvi"))
292 ;; Shifts issue to either upper pipe.
293 (define_function_unit "ev6_u" 2 0
294 (and (eq_attr "cpu" "ev6")
295 (eq_attr "type" "shift"))
298 ;; Multiplies issue only to U1, and all take 7 ticks.
299 ;; Rather than create a new function unit just for U1, reuse IMUL
300 (define_function_unit "imul" 1 0
301 (and (eq_attr "cpu" "ev6")
302 (eq_attr "type" "imul"))
305 (define_function_unit "ev6_u" 2 0
306 (and (eq_attr "cpu" "ev6")
307 (eq_attr "type" "imul"))
310 ;; Branches issue to either upper pipe
311 (define_function_unit "ev6_u" 2 0
312 (and (eq_attr "cpu" "ev6")
313 (eq_attr "type" "ibr"))
316 ;; Calls only issue to L0.
317 (define_function_unit "ev6_l0" 1 0
318 (and (eq_attr "cpu" "ev6")
319 (eq_attr "type" "jsr"))
322 (define_function_unit "ev6_l" 2 0
323 (and (eq_attr "cpu" "ev6")
324 (eq_attr "type" "jsr"))
327 ;; Ftoi/itof only issue to lower pipes
328 (define_function_unit "ev6_l" 2 0
329 (and (eq_attr "cpu" "ev6")
330 (eq_attr "type" "ftoi"))
333 (define_function_unit "ev6_l" 2 0
334 (and (eq_attr "cpu" "ev6")
335 (eq_attr "type" "itof"))
338 ;; For the FPU we are very similar to EV5, except there's no insn that
339 ;; can issue to fm & fa, so we get to leave that out.
341 (define_function_unit "ev6_fm" 1 0
342 (and (eq_attr "cpu" "ev6")
343 (eq_attr "type" "fmul"))
346 (define_function_unit "ev6_fa" 1 0
347 (and (eq_attr "cpu" "ev6")
348 (eq_attr "type" "fadd,fcpys,fbr,fdiv,fsqrt"))
351 (define_function_unit "ev6_fa" 1 0
352 (and (eq_attr "cpu" "ev6")
353 (eq_attr "type" "fcmov"))
356 (define_function_unit "fdiv" 1 0
357 (and (eq_attr "cpu" "ev6")
358 (and (eq_attr "type" "fdiv")
359 (eq_attr "opsize" "si")))
362 (define_function_unit "fdiv" 1 0
363 (and (eq_attr "cpu" "ev6")
364 (and (eq_attr "type" "fdiv")
365 (eq_attr "opsize" "di")))
368 (define_function_unit "fsqrt" 1 0
369 (and (eq_attr "cpu" "ev6")
370 (and (eq_attr "type" "fsqrt")
371 (eq_attr "opsize" "si")))
374 (define_function_unit "fsqrt" 1 0
375 (and (eq_attr "cpu" "ev6")
376 (and (eq_attr "type" "fsqrt")
377 (eq_attr "opsize" "di")))
380 ; ??? The FPU communicates with memory and the integer register file
381 ; via two fp store units. We need a slot in the fst immediately, and
382 ; a slot in LOW after the operand data is ready. At which point the
383 ; data may be moved either to the store queue or the integer register
384 ; file and the insn retired.
387 ;; First define the arithmetic insns. Note that the 32-bit forms also
390 ;; Handle 32-64 bit extension from memory to a floating point register
391 ;; specially, since this ocurrs frequently in int->double conversions.
392 ;; This is done with a define_split after reload converting the plain
393 ;; sign-extension into a load+unspec, which of course results in lds+cvtlq.
395 ;; Note that while we must retain the =f case in the insn for reload's
396 ;; benefit, it should be eliminated after reload, so we should never emit
397 ;; code for that case. But we don't reject the possibility.
399 (define_insn "extendsidi2"
400 [(set (match_operand:DI 0 "register_operand" "=r,r,?f")
401 (sign_extend:DI (match_operand:SI 1 "nonimmediate_operand" "r,m,m")))]
406 lds %0,%1\;cvtlq %0,%0"
407 [(set_attr "type" "iadd,ild,fld")
408 (set_attr "length" "*,*,8")])
410 ;; Due to issues with CLASS_CANNOT_CHANGE_SIZE, we cannot use a subreg here.
412 [(set (match_operand:DI 0 "hard_fp_register_operand" "")
413 (sign_extend:DI (match_operand:SI 1 "memory_operand" "")))]
415 [(set (match_dup 2) (match_dup 1))
416 (set (match_dup 0) (unspec:DI [(match_dup 2)] 4))]
417 "operands[2] = gen_rtx_REG (SImode, REGNO (operands[0]));")
420 [(set (match_operand:DI 0 "register_operand" "=f")
421 (unspec:DI [(match_operand:SI 1 "register_operand" "f")] 4))]
424 [(set_attr "type" "fadd")])
426 ;; Do addsi3 the way expand_binop would do if we didn't have one. This
427 ;; generates better code. We have the anonymous addsi3 pattern below in
428 ;; case combine wants to make it.
429 (define_expand "addsi3"
430 [(set (match_operand:SI 0 "register_operand" "")
431 (plus:SI (match_operand:SI 1 "reg_or_0_operand" "")
432 (match_operand:SI 2 "add_operand" "")))]
438 rtx op1 = gen_lowpart (DImode, operands[1]);
439 rtx op2 = gen_lowpart (DImode, operands[2]);
441 if (! cse_not_expected)
443 rtx tmp = gen_reg_rtx (DImode);
444 emit_insn (gen_adddi3 (tmp, op1, op2));
445 emit_move_insn (gen_lowpart (DImode, operands[0]), tmp);
448 emit_insn (gen_adddi3 (gen_lowpart (DImode, operands[0]), op1, op2));
454 [(set (match_operand:SI 0 "register_operand" "=r,r,r,r")
455 (plus:SI (match_operand:SI 1 "reg_or_0_operand" "%rJ,rJ,rJ,rJ")
456 (match_operand:SI 2 "add_operand" "rI,O,K,L")))]
465 [(set (match_operand:SI 0 "register_operand" "")
466 (plus:SI (match_operand:SI 1 "register_operand" "")
467 (match_operand:SI 2 "const_int_operand" "")))]
468 "! add_operand (operands[2], SImode)"
469 [(set (match_dup 0) (plus:SI (match_dup 1) (match_dup 3)))
470 (set (match_dup 0) (plus:SI (match_dup 0) (match_dup 4)))]
473 HOST_WIDE_INT val = INTVAL (operands[2]);
474 HOST_WIDE_INT low = (val & 0xffff) - 2 * (val & 0x8000);
475 HOST_WIDE_INT rest = val - low;
477 operands[3] = GEN_INT (rest);
478 operands[4] = GEN_INT (low);
482 [(set (match_operand:DI 0 "register_operand" "=r,r")
484 (plus:SI (match_operand:SI 1 "reg_or_0_operand" "%rJ,rJ")
485 (match_operand:SI 2 "sext_add_operand" "rI,O"))))]
492 [(set (match_operand:DI 0 "register_operand" "")
494 (plus:SI (match_operand:SI 1 "reg_not_elim_operand" "")
495 (match_operand:SI 2 "const_int_operand" ""))))
496 (clobber (match_operand:SI 3 "reg_not_elim_operand" ""))]
497 "! sext_add_operand (operands[2], SImode) && INTVAL (operands[2]) > 0
498 && INTVAL (operands[2]) % 4 == 0"
499 [(set (match_dup 3) (match_dup 4))
500 (set (match_dup 0) (sign_extend:DI (plus:SI (mult:SI (match_dup 3)
505 HOST_WIDE_INT val = INTVAL (operands[2]) / 4;
511 operands[4] = GEN_INT (val);
512 operands[5] = GEN_INT (mult);
516 [(set (match_operand:DI 0 "register_operand" "")
518 (plus:SI (match_operator:SI 1 "comparison_operator"
519 [(match_operand 2 "" "")
520 (match_operand 3 "" "")])
521 (match_operand:SI 4 "add_operand" ""))))
522 (clobber (match_operand:DI 5 "register_operand" ""))]
524 [(set (match_dup 5) (match_dup 6))
525 (set (match_dup 0) (sign_extend:DI (plus:SI (match_dup 7) (match_dup 4))))]
528 operands[6] = gen_rtx_fmt_ee (GET_CODE (operands[1]), DImode,
529 operands[2], operands[3]);
530 operands[7] = gen_lowpart (SImode, operands[5]);
533 (define_insn "adddi3"
534 [(set (match_operand:DI 0 "register_operand" "=r,r,r,r")
535 (plus:DI (match_operand:DI 1 "reg_or_0_operand" "%rJ,rJ,rJ,rJ")
536 (match_operand:DI 2 "add_operand" "rI,O,K,L")))]
540 const char * const pattern[4] = {
547 /* The NT stack unwind code can't handle a subq to adjust the stack
548 (that's a bug, but not one we can do anything about). As of NT4.0 SP3,
549 the exception handling code will loop if a subq is used and an
552 The 19980616 change to emit prologues as RTL also confused some
553 versions of GDB, which also interprets prologues. This has been
554 fixed as of GDB 4.18, but it does not harm to unconditionally
557 int which = which_alternative;
559 if (operands[0] == stack_pointer_rtx
560 && GET_CODE (operands[2]) == CONST_INT
561 && CONST_OK_FOR_LETTER_P (INTVAL (operands[2]), 'K'))
564 return pattern[which];
567 ;; ??? Allow large constants when basing off the frame pointer or some
568 ;; virtual register that may eliminate to the frame pointer. This is
569 ;; done because register elimination offsets will change the hi/lo split,
570 ;; and if we split before reload, we will require additional instructions.
573 [(set (match_operand:DI 0 "register_operand" "=r")
574 (plus:DI (match_operand:DI 1 "reg_no_subreg_operand" "r")
575 (match_operand:DI 2 "const_int_operand" "n")))]
576 "REG_OK_FP_BASE_P (operands[1])"
579 ;; Don't do this if we are adjusting SP since we don't want to do it
580 ;; in two steps. Don't split FP sources for the reason listed above.
582 [(set (match_operand:DI 0 "register_operand" "")
583 (plus:DI (match_operand:DI 1 "register_operand" "")
584 (match_operand:DI 2 "const_int_operand" "")))]
585 "! add_operand (operands[2], DImode)
586 && operands[0] != stack_pointer_rtx
587 && operands[1] != frame_pointer_rtx
588 && operands[1] != arg_pointer_rtx"
589 [(set (match_dup 0) (plus:DI (match_dup 1) (match_dup 3)))
590 (set (match_dup 0) (plus:DI (match_dup 0) (match_dup 4)))]
593 HOST_WIDE_INT val = INTVAL (operands[2]);
594 HOST_WIDE_INT low = (val & 0xffff) - 2 * (val & 0x8000);
595 HOST_WIDE_INT rest = val - low;
597 operands[3] = GEN_INT (rest);
598 operands[4] = GEN_INT (low);
602 [(set (match_operand:SI 0 "register_operand" "=r,r")
603 (plus:SI (mult:SI (match_operand:SI 1 "reg_not_elim_operand" "r,r")
604 (match_operand:SI 2 "const48_operand" "I,I"))
605 (match_operand:SI 3 "sext_add_operand" "rI,O")))]
612 [(set (match_operand:DI 0 "register_operand" "=r,r")
614 (plus:SI (mult:SI (match_operand:SI 1 "reg_not_elim_operand" "r,r")
615 (match_operand:SI 2 "const48_operand" "I,I"))
616 (match_operand:SI 3 "sext_add_operand" "rI,O"))))]
623 [(set (match_operand:DI 0 "register_operand" "")
625 (plus:SI (mult:SI (match_operator:SI 1 "comparison_operator"
626 [(match_operand 2 "" "")
627 (match_operand 3 "" "")])
628 (match_operand:SI 4 "const48_operand" ""))
629 (match_operand:SI 5 "sext_add_operand" ""))))
630 (clobber (match_operand:DI 6 "reg_not_elim_operand" ""))]
632 [(set (match_dup 6) (match_dup 7))
634 (sign_extend:DI (plus:SI (mult:SI (match_dup 8) (match_dup 4))
638 operands[7] = gen_rtx_fmt_ee (GET_CODE (operands[1]), DImode,
639 operands[2], operands[3]);
640 operands[8] = gen_lowpart (SImode, operands[6]);
644 [(set (match_operand:DI 0 "register_operand" "=r,r")
645 (plus:DI (mult:DI (match_operand:DI 1 "reg_not_elim_operand" "r,r")
646 (match_operand:DI 2 "const48_operand" "I,I"))
647 (match_operand:DI 3 "sext_add_operand" "rI,O")))]
653 (define_insn "negsi2"
654 [(set (match_operand:SI 0 "register_operand" "=r")
655 (neg:SI (match_operand:SI 1 "reg_or_8bit_operand" "rI")))]
660 [(set (match_operand:DI 0 "register_operand" "=r")
661 (sign_extend:DI (neg:SI
662 (match_operand:SI 1 "reg_or_8bit_operand" "rI"))))]
666 (define_insn "negdi2"
667 [(set (match_operand:DI 0 "register_operand" "=r")
668 (neg:DI (match_operand:DI 1 "reg_or_8bit_operand" "rI")))]
672 (define_expand "subsi3"
673 [(set (match_operand:SI 0 "register_operand" "")
674 (minus:SI (match_operand:SI 1 "reg_or_0_operand" "")
675 (match_operand:SI 2 "reg_or_8bit_operand" "")))]
681 rtx op1 = gen_lowpart (DImode, operands[1]);
682 rtx op2 = gen_lowpart (DImode, operands[2]);
684 if (! cse_not_expected)
686 rtx tmp = gen_reg_rtx (DImode);
687 emit_insn (gen_subdi3 (tmp, op1, op2));
688 emit_move_insn (gen_lowpart (DImode, operands[0]), tmp);
691 emit_insn (gen_subdi3 (gen_lowpart (DImode, operands[0]), op1, op2));
697 [(set (match_operand:SI 0 "register_operand" "=r")
698 (minus:SI (match_operand:SI 1 "reg_or_0_operand" "rJ")
699 (match_operand:SI 2 "reg_or_8bit_operand" "rI")))]
704 [(set (match_operand:DI 0 "register_operand" "=r")
705 (sign_extend:DI (minus:SI (match_operand:SI 1 "reg_or_0_operand" "rJ")
706 (match_operand:SI 2 "reg_or_8bit_operand" "rI"))))]
710 (define_insn "subdi3"
711 [(set (match_operand:DI 0 "register_operand" "=r")
712 (minus:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
713 (match_operand:DI 2 "reg_or_8bit_operand" "rI")))]
718 [(set (match_operand:SI 0 "register_operand" "=r")
719 (minus:SI (mult:SI (match_operand:SI 1 "reg_not_elim_operand" "r")
720 (match_operand:SI 2 "const48_operand" "I"))
721 (match_operand:SI 3 "reg_or_8bit_operand" "rI")))]
726 [(set (match_operand:DI 0 "register_operand" "=r")
728 (minus:SI (mult:SI (match_operand:SI 1 "reg_not_elim_operand" "r")
729 (match_operand:SI 2 "const48_operand" "I"))
730 (match_operand:SI 3 "reg_or_8bit_operand" "rI"))))]
735 [(set (match_operand:DI 0 "register_operand" "=r")
736 (minus:DI (mult:DI (match_operand:DI 1 "reg_not_elim_operand" "r")
737 (match_operand:DI 2 "const48_operand" "I"))
738 (match_operand:DI 3 "reg_or_8bit_operand" "rI")))]
742 (define_insn "mulsi3"
743 [(set (match_operand:SI 0 "register_operand" "=r")
744 (mult:SI (match_operand:SI 1 "reg_or_0_operand" "%rJ")
745 (match_operand:SI 2 "reg_or_8bit_operand" "rI")))]
748 [(set_attr "type" "imul")
749 (set_attr "opsize" "si")])
752 [(set (match_operand:DI 0 "register_operand" "=r")
754 (mult:SI (match_operand:SI 1 "reg_or_0_operand" "%rJ")
755 (match_operand:SI 2 "reg_or_8bit_operand" "rI"))))]
758 [(set_attr "type" "imul")
759 (set_attr "opsize" "si")])
761 (define_insn "muldi3"
762 [(set (match_operand:DI 0 "register_operand" "=r")
763 (mult:DI (match_operand:DI 1 "reg_or_0_operand" "%rJ")
764 (match_operand:DI 2 "reg_or_8bit_operand" "rI")))]
767 [(set_attr "type" "imul")])
769 (define_insn "umuldi3_highpart"
770 [(set (match_operand:DI 0 "register_operand" "=r")
773 (mult:TI (zero_extend:TI
774 (match_operand:DI 1 "reg_or_0_operand" "%rJ"))
776 (match_operand:DI 2 "reg_or_8bit_operand" "rI")))
780 [(set_attr "type" "imul")
781 (set_attr "opsize" "udi")])
784 [(set (match_operand:DI 0 "register_operand" "=r")
787 (mult:TI (zero_extend:TI (match_operand:DI 1 "register_operand" "r"))
788 (match_operand:TI 2 "cint8_operand" "I"))
792 [(set_attr "type" "imul")
793 (set_attr "opsize" "udi")])
795 ;; The divide and remainder operations always take their inputs from
796 ;; r24 and r25, put their output in r27, and clobber r23 and r28.
798 ;; ??? Force sign-extension here because some versions of OSF/1 don't
799 ;; do the right thing if the inputs are not properly sign-extended.
800 ;; But Linux, for instance, does not have this problem. Is it worth
801 ;; the complication here to eliminate the sign extension?
802 ;; Interix/NT has the same sign-extension problem.
804 (define_expand "divsi3"
806 (sign_extend:DI (match_operand:SI 1 "nonimmediate_operand" "")))
808 (sign_extend:DI (match_operand:SI 2 "nonimmediate_operand" "")))
809 (parallel [(set (reg:DI 27)
810 (sign_extend:DI (div:SI (reg:DI 24) (reg:DI 25))))
811 (clobber (reg:DI 23))
812 (clobber (reg:DI 28))])
813 (set (match_operand:SI 0 "general_operand" "")
814 (subreg:SI (reg:DI 27) 0))]
818 (define_expand "udivsi3"
820 (sign_extend:DI (match_operand:SI 1 "nonimmediate_operand" "")))
822 (sign_extend:DI (match_operand:SI 2 "nonimmediate_operand" "")))
823 (parallel [(set (reg:DI 27)
824 (sign_extend:DI (udiv:SI (reg:DI 24) (reg:DI 25))))
825 (clobber (reg:DI 23))
826 (clobber (reg:DI 28))])
827 (set (match_operand:SI 0 "general_operand" "")
828 (subreg:SI (reg:DI 27) 0))]
832 (define_expand "modsi3"
834 (sign_extend:DI (match_operand:SI 1 "nonimmediate_operand" "")))
836 (sign_extend:DI (match_operand:SI 2 "nonimmediate_operand" "")))
837 (parallel [(set (reg:DI 27)
838 (sign_extend:DI (mod:SI (reg:DI 24) (reg:DI 25))))
839 (clobber (reg:DI 23))
840 (clobber (reg:DI 28))])
841 (set (match_operand:SI 0 "general_operand" "")
842 (subreg:SI (reg:DI 27) 0))]
846 (define_expand "umodsi3"
848 (sign_extend:DI (match_operand:SI 1 "nonimmediate_operand" "")))
850 (sign_extend:DI (match_operand:SI 2 "nonimmediate_operand" "")))
851 (parallel [(set (reg:DI 27)
852 (sign_extend:DI (umod:SI (reg:DI 24) (reg:DI 25))))
853 (clobber (reg:DI 23))
854 (clobber (reg:DI 28))])
855 (set (match_operand:SI 0 "general_operand" "")
856 (subreg:SI (reg:DI 27) 0))]
860 (define_expand "divdi3"
861 [(set (reg:DI 24) (match_operand:DI 1 "input_operand" ""))
862 (set (reg:DI 25) (match_operand:DI 2 "input_operand" ""))
863 (parallel [(set (reg:DI 27)
866 (clobber (reg:DI 23))
867 (clobber (reg:DI 28))])
868 (set (match_operand:DI 0 "general_operand" "")
873 (define_expand "udivdi3"
874 [(set (reg:DI 24) (match_operand:DI 1 "input_operand" ""))
875 (set (reg:DI 25) (match_operand:DI 2 "input_operand" ""))
876 (parallel [(set (reg:DI 27)
879 (clobber (reg:DI 23))
880 (clobber (reg:DI 28))])
881 (set (match_operand:DI 0 "general_operand" "")
886 (define_expand "moddi3"
887 [(set (reg:DI 24) (match_operand:DI 1 "input_operand" ""))
888 (set (reg:DI 25) (match_operand:DI 2 "input_operand" ""))
889 (parallel [(set (reg:DI 27)
892 (clobber (reg:DI 23))
893 (clobber (reg:DI 28))])
894 (set (match_operand:DI 0 "general_operand" "")
899 (define_expand "umoddi3"
900 [(set (reg:DI 24) (match_operand:DI 1 "input_operand" ""))
901 (set (reg:DI 25) (match_operand:DI 2 "input_operand" ""))
902 (parallel [(set (reg:DI 27)
905 (clobber (reg:DI 23))
906 (clobber (reg:DI 28))])
907 (set (match_operand:DI 0 "general_operand" "")
912 ;; Lengths of 8 for ldq $t12,__divq($gp); jsr $t9,($t12),__divq as
913 ;; expanded by the assembler.
916 (sign_extend:DI (match_operator:SI 1 "divmod_operator"
917 [(reg:DI 24) (reg:DI 25)])))
918 (clobber (reg:DI 23))
919 (clobber (reg:DI 28))]
922 [(set_attr "type" "jsr")
923 (set_attr "length" "8")])
927 (match_operator:DI 1 "divmod_operator"
928 [(reg:DI 24) (reg:DI 25)]))
929 (clobber (reg:DI 23))
930 (clobber (reg:DI 28))]
933 [(set_attr "type" "jsr")
934 (set_attr "length" "8")])
936 ;; Next are the basic logical operations. These only exist in DImode.
938 (define_insn "anddi3"
939 [(set (match_operand:DI 0 "register_operand" "=r,r,r")
940 (and:DI (match_operand:DI 1 "reg_or_0_operand" "%rJ,rJ,rJ")
941 (match_operand:DI 2 "and_operand" "rI,N,MH")))]
947 [(set_attr "type" "ilog,ilog,shift")])
949 ;; There are times when we can split an AND into two AND insns. This occurs
950 ;; when we can first clear any bytes and then clear anything else. For
951 ;; example "I & 0xffff07" is "(I & 0xffffff) & 0xffffffffffffff07".
952 ;; Only do this when running on 64-bit host since the computations are
953 ;; too messy otherwise.
956 [(set (match_operand:DI 0 "register_operand" "")
957 (and:DI (match_operand:DI 1 "register_operand" "")
958 (match_operand:DI 2 "const_int_operand" "")))]
959 "HOST_BITS_PER_WIDE_INT == 64 && ! and_operand (operands[2], DImode)"
960 [(set (match_dup 0) (and:DI (match_dup 1) (match_dup 3)))
961 (set (match_dup 0) (and:DI (match_dup 0) (match_dup 4)))]
964 unsigned HOST_WIDE_INT mask1 = INTVAL (operands[2]);
965 unsigned HOST_WIDE_INT mask2 = mask1;
968 /* For each byte that isn't all zeros, make it all ones. */
969 for (i = 0; i < 64; i += 8)
970 if ((mask1 & ((HOST_WIDE_INT) 0xff << i)) != 0)
971 mask1 |= (HOST_WIDE_INT) 0xff << i;
973 /* Now turn on any bits we've just turned off. */
976 operands[3] = GEN_INT (mask1);
977 operands[4] = GEN_INT (mask2);
980 (define_insn "zero_extendqihi2"
981 [(set (match_operand:HI 0 "register_operand" "=r")
982 (zero_extend:HI (match_operand:QI 1 "register_operand" "r")))]
985 [(set_attr "type" "ilog")])
988 [(set (match_operand:SI 0 "register_operand" "=r,r")
989 (zero_extend:SI (match_operand:QI 1 "nonimmediate_operand" "r,m")))]
994 [(set_attr "type" "ilog,ild")])
997 [(set (match_operand:SI 0 "register_operand" "=r")
998 (zero_extend:SI (match_operand:QI 1 "register_operand" "r")))]
1001 [(set_attr "type" "ilog")])
1003 (define_expand "zero_extendqisi2"
1004 [(set (match_operand:SI 0 "register_operand" "")
1005 (zero_extend:SI (match_operand:QI 1 "register_operand" "")))]
1010 [(set (match_operand:DI 0 "register_operand" "=r,r")
1011 (zero_extend:DI (match_operand:QI 1 "nonimmediate_operand" "r,m")))]
1016 [(set_attr "type" "ilog,ild")])
1019 [(set (match_operand:DI 0 "register_operand" "=r")
1020 (zero_extend:DI (match_operand:QI 1 "register_operand" "r")))]
1023 [(set_attr "type" "ilog")])
1025 (define_expand "zero_extendqidi2"
1026 [(set (match_operand:DI 0 "register_operand" "")
1027 (zero_extend:DI (match_operand:QI 1 "register_operand" "")))]
1032 [(set (match_operand:SI 0 "register_operand" "=r,r")
1033 (zero_extend:SI (match_operand:HI 1 "nonimmediate_operand" "r,m")))]
1038 [(set_attr "type" "shift,ild")])
1041 [(set (match_operand:SI 0 "register_operand" "=r")
1042 (zero_extend:SI (match_operand:HI 1 "register_operand" "r")))]
1045 [(set_attr "type" "shift")])
1047 (define_expand "zero_extendhisi2"
1048 [(set (match_operand:SI 0 "register_operand" "")
1049 (zero_extend:SI (match_operand:HI 1 "register_operand" "")))]
1054 [(set (match_operand:DI 0 "register_operand" "=r,r")
1055 (zero_extend:DI (match_operand:HI 1 "nonimmediate_operand" "r,m")))]
1060 [(set_attr "type" "shift,ild")])
1063 [(set (match_operand:DI 0 "register_operand" "=r")
1064 (zero_extend:DI (match_operand:HI 1 "register_operand" "r")))]
1067 [(set_attr "type" "shift")])
1069 (define_expand "zero_extendhidi2"
1070 [(set (match_operand:DI 0 "register_operand" "")
1071 (zero_extend:DI (match_operand:HI 1 "register_operand" "")))]
1075 (define_insn "zero_extendsidi2"
1076 [(set (match_operand:DI 0 "register_operand" "=r")
1077 (zero_extend:DI (match_operand:SI 1 "register_operand" "r")))]
1080 [(set_attr "type" "shift")])
1083 [(set (match_operand:DI 0 "register_operand" "=r")
1084 (and:DI (not:DI (match_operand:DI 1 "reg_or_8bit_operand" "rI"))
1085 (match_operand:DI 2 "reg_or_0_operand" "rJ")))]
1088 [(set_attr "type" "ilog")])
1090 (define_insn "iordi3"
1091 [(set (match_operand:DI 0 "register_operand" "=r,r")
1092 (ior:DI (match_operand:DI 1 "reg_or_0_operand" "%rJ,rJ")
1093 (match_operand:DI 2 "or_operand" "rI,N")))]
1098 [(set_attr "type" "ilog")])
1100 (define_insn "one_cmpldi2"
1101 [(set (match_operand:DI 0 "register_operand" "=r")
1102 (not:DI (match_operand:DI 1 "reg_or_8bit_operand" "rI")))]
1105 [(set_attr "type" "ilog")])
1108 [(set (match_operand:DI 0 "register_operand" "=r")
1109 (ior:DI (not:DI (match_operand:DI 1 "reg_or_8bit_operand" "rI"))
1110 (match_operand:DI 2 "reg_or_0_operand" "rJ")))]
1113 [(set_attr "type" "ilog")])
1115 (define_insn "xordi3"
1116 [(set (match_operand:DI 0 "register_operand" "=r,r")
1117 (xor:DI (match_operand:DI 1 "reg_or_0_operand" "%rJ,rJ")
1118 (match_operand:DI 2 "or_operand" "rI,N")))]
1123 [(set_attr "type" "ilog")])
1126 [(set (match_operand:DI 0 "register_operand" "=r")
1127 (not:DI (xor:DI (match_operand:DI 1 "register_operand" "%rJ")
1128 (match_operand:DI 2 "register_operand" "rI"))))]
1131 [(set_attr "type" "ilog")])
1133 ;; Handle the FFS insn iff we support CIX.
1135 ;; These didn't make it into EV6 pass 2 as planned. Instead they
1136 ;; cropped cttz/ctlz/ctpop from the old CIX and renamed it FIX for
1137 ;; "Square Root and Floating Point Convert Extension".
1139 ;; I'm assured that these insns will make it into EV67 (first pass
1140 ;; due Summer 1999), presumably with a new AMASK bit, and presumably
1141 ;; will still be named CIX.
1143 (define_expand "ffsdi2"
1145 (unspec [(match_operand:DI 1 "register_operand" "")] 1))
1147 (plus:DI (match_dup 2) (const_int 1)))
1148 (set (match_operand:DI 0 "register_operand" "")
1149 (if_then_else:DI (eq (match_dup 1) (const_int 0))
1150 (const_int 0) (match_dup 3)))]
1154 operands[2] = gen_reg_rtx (DImode);
1155 operands[3] = gen_reg_rtx (DImode);
1159 [(set (match_operand:DI 0 "register_operand" "=r")
1160 (unspec [(match_operand:DI 1 "register_operand" "r")] 1))]
1163 ; EV6 calls all mvi and cttz/ctlz/popc class imisc, so just
1164 ; reuse the existing type name.
1165 [(set_attr "type" "mvi")])
1167 ;; Next come the shifts and the various extract and insert operations.
1169 (define_insn "ashldi3"
1170 [(set (match_operand:DI 0 "register_operand" "=r,r")
1171 (ashift:DI (match_operand:DI 1 "reg_or_0_operand" "rJ,rJ")
1172 (match_operand:DI 2 "reg_or_6bit_operand" "P,rS")))]
1176 switch (which_alternative)
1179 if (operands[2] == const1_rtx)
1180 return \"addq %r1,%r1,%0\";
1182 return \"s%P2addq %r1,0,%0\";
1184 return \"sll %r1,%2,%0\";
1189 [(set_attr "type" "iadd,shift")])
1191 ;; ??? The following pattern is made by combine, but earlier phases
1192 ;; (specifically flow) can't handle it. This occurs in jump.c. Deal
1193 ;; with this in a better way at some point.
1195 ;; [(set (match_operand:DI 0 "register_operand" "=r")
1197 ;; (subreg:SI (ashift:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
1198 ;; (match_operand:DI 2 "const_int_operand" "P"))
1200 ;; "INTVAL (operands[2]) >= 1 && INTVAL (operands[2]) <= 3"
1203 ;; if (operands[2] == const1_rtx)
1204 ;; return \"addl %r1,%r1,%0\";
1206 ;; return \"s%P2addl %r1,0,%0\";
1208 ;; [(set_attr "type" "iadd")])
1210 (define_insn "lshrdi3"
1211 [(set (match_operand:DI 0 "register_operand" "=r")
1212 (lshiftrt:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
1213 (match_operand:DI 2 "reg_or_6bit_operand" "rS")))]
1216 [(set_attr "type" "shift")])
1218 (define_insn "ashrdi3"
1219 [(set (match_operand:DI 0 "register_operand" "=r")
1220 (ashiftrt:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
1221 (match_operand:DI 2 "reg_or_6bit_operand" "rS")))]
1224 [(set_attr "type" "shift")])
1226 (define_expand "extendqihi2"
1228 (ashift:DI (match_operand:QI 1 "some_operand" "")
1230 (set (match_operand:HI 0 "register_operand" "")
1231 (ashiftrt:DI (match_dup 2)
1238 emit_insn (gen_extendqihi2x (operands[0],
1239 force_reg (QImode, operands[1])));
1243 /* If we have an unaligned MEM, extend to DImode (which we do
1244 specially) and then copy to the result. */
1245 if (unaligned_memory_operand (operands[1], HImode))
1247 rtx temp = gen_reg_rtx (DImode);
1249 emit_insn (gen_extendqidi2 (temp, operands[1]));
1250 emit_move_insn (operands[0], gen_lowpart (HImode, temp));
1254 operands[0] = gen_lowpart (DImode, operands[0]);
1255 operands[1] = gen_lowpart (DImode, force_reg (QImode, operands[1]));
1256 operands[2] = gen_reg_rtx (DImode);
1259 (define_insn "extendqidi2x"
1260 [(set (match_operand:DI 0 "register_operand" "=r")
1261 (sign_extend:DI (match_operand:QI 1 "register_operand" "r")))]
1264 [(set_attr "type" "shift")])
1266 (define_insn "extendhidi2x"
1267 [(set (match_operand:DI 0 "register_operand" "=r")
1268 (sign_extend:DI (match_operand:HI 1 "register_operand" "r")))]
1271 [(set_attr "type" "shift")])
1273 (define_insn "extendqisi2x"
1274 [(set (match_operand:SI 0 "register_operand" "=r")
1275 (sign_extend:SI (match_operand:QI 1 "register_operand" "r")))]
1278 [(set_attr "type" "shift")])
1280 (define_insn "extendhisi2x"
1281 [(set (match_operand:SI 0 "register_operand" "=r")
1282 (sign_extend:SI (match_operand:HI 1 "register_operand" "r")))]
1285 [(set_attr "type" "shift")])
1287 (define_insn "extendqihi2x"
1288 [(set (match_operand:HI 0 "register_operand" "=r")
1289 (sign_extend:HI (match_operand:QI 1 "register_operand" "r")))]
1292 [(set_attr "type" "shift")])
1294 (define_expand "extendqisi2"
1296 (ashift:DI (match_operand:QI 1 "some_operand" "")
1298 (set (match_operand:SI 0 "register_operand" "")
1299 (ashiftrt:DI (match_dup 2)
1306 emit_insn (gen_extendqisi2x (operands[0],
1307 force_reg (QImode, operands[1])));
1311 /* If we have an unaligned MEM, extend to a DImode form of
1312 the result (which we do specially). */
1313 if (unaligned_memory_operand (operands[1], QImode))
1315 rtx temp = gen_reg_rtx (DImode);
1317 emit_insn (gen_extendqidi2 (temp, operands[1]));
1318 emit_move_insn (operands[0], gen_lowpart (SImode, temp));
1322 operands[0] = gen_lowpart (DImode, operands[0]);
1323 operands[1] = gen_lowpart (DImode, force_reg (QImode, operands[1]));
1324 operands[2] = gen_reg_rtx (DImode);
1327 (define_expand "extendqidi2"
1329 (ashift:DI (match_operand:QI 1 "some_operand" "")
1331 (set (match_operand:DI 0 "register_operand" "")
1332 (ashiftrt:DI (match_dup 2)
1339 emit_insn (gen_extendqidi2x (operands[0],
1340 force_reg (QImode, operands[1])));
1344 if (unaligned_memory_operand (operands[1], QImode))
1347 = gen_unaligned_extendqidi (operands[0],
1348 get_unaligned_address (operands[1], 1));
1350 alpha_set_memflags (seq, operands[1]);
1355 operands[1] = gen_lowpart (DImode, force_reg (QImode, operands[1]));
1356 operands[2] = gen_reg_rtx (DImode);
1359 (define_expand "extendhisi2"
1361 (ashift:DI (match_operand:HI 1 "some_operand" "")
1363 (set (match_operand:SI 0 "register_operand" "")
1364 (ashiftrt:DI (match_dup 2)
1371 emit_insn (gen_extendhisi2x (operands[0],
1372 force_reg (HImode, operands[1])));
1376 /* If we have an unaligned MEM, extend to a DImode form of
1377 the result (which we do specially). */
1378 if (unaligned_memory_operand (operands[1], HImode))
1380 rtx temp = gen_reg_rtx (DImode);
1382 emit_insn (gen_extendhidi2 (temp, operands[1]));
1383 emit_move_insn (operands[0], gen_lowpart (SImode, temp));
1387 operands[0] = gen_lowpart (DImode, operands[0]);
1388 operands[1] = gen_lowpart (DImode, force_reg (HImode, operands[1]));
1389 operands[2] = gen_reg_rtx (DImode);
1392 (define_expand "extendhidi2"
1394 (ashift:DI (match_operand:HI 1 "some_operand" "")
1396 (set (match_operand:DI 0 "register_operand" "")
1397 (ashiftrt:DI (match_dup 2)
1404 emit_insn (gen_extendhidi2x (operands[0],
1405 force_reg (HImode, operands[1])));
1409 if (unaligned_memory_operand (operands[1], HImode))
1412 = gen_unaligned_extendhidi (operands[0],
1413 get_unaligned_address (operands[1], 2));
1415 alpha_set_memflags (seq, operands[1]);
1420 operands[1] = gen_lowpart (DImode, force_reg (HImode, operands[1]));
1421 operands[2] = gen_reg_rtx (DImode);
1424 ;; Here's how we sign extend an unaligned byte and halfword. Doing this
1425 ;; as a pattern saves one instruction. The code is similar to that for
1426 ;; the unaligned loads (see below).
1428 ;; Operand 1 is the address + 1 (+2 for HI), operand 0 is the result.
1429 (define_expand "unaligned_extendqidi"
1430 [(set (match_dup 2) (match_operand:DI 1 "address_operand" ""))
1432 (mem:DI (and:DI (plus:DI (match_dup 2) (const_int -1))
1435 (ashift:DI (match_dup 3)
1436 (minus:DI (const_int 64)
1438 (and:DI (match_dup 2) (const_int 7))
1440 (set (subreg:DI (match_operand:QI 0 "register_operand" "") 0)
1441 (ashiftrt:DI (match_dup 4) (const_int 56)))]
1444 { operands[2] = gen_reg_rtx (DImode);
1445 operands[3] = gen_reg_rtx (DImode);
1446 operands[4] = gen_reg_rtx (DImode);
1449 (define_expand "unaligned_extendhidi"
1450 [(set (match_dup 2) (match_operand:DI 1 "address_operand" ""))
1452 (mem:DI (and:DI (plus:DI (match_dup 2) (const_int -2))
1455 (ashift:DI (match_dup 3)
1456 (minus:DI (const_int 64)
1458 (and:DI (match_dup 2) (const_int 7))
1460 (set (subreg:DI (match_operand:QI 0 "register_operand" "") 0)
1461 (ashiftrt:DI (match_dup 4) (const_int 48)))]
1464 { operands[2] = gen_reg_rtx (DImode);
1465 operands[3] = gen_reg_rtx (DImode);
1466 operands[4] = gen_reg_rtx (DImode);
1470 [(set (match_operand:DI 0 "register_operand" "=r")
1471 (zero_extract:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
1472 (match_operand:DI 2 "mode_width_operand" "n")
1473 (match_operand:DI 3 "mul8_operand" "I")))]
1475 "ext%M2l %r1,%s3,%0"
1476 [(set_attr "type" "shift")])
1478 (define_insn "extxl"
1479 [(set (match_operand:DI 0 "register_operand" "=r")
1480 (zero_extract:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
1481 (match_operand:DI 2 "mode_width_operand" "n")
1482 (ashift:DI (match_operand:DI 3 "reg_or_8bit_operand" "rI")
1486 [(set_attr "type" "shift")])
1488 ;; Combine has some strange notion of preserving existing undefined behaviour
1489 ;; in shifts larger than a word size. So capture these patterns that it
1490 ;; should have turned into zero_extracts.
1493 [(set (match_operand:DI 0 "register_operand" "=r")
1494 (and (lshiftrt:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
1495 (ashift:DI (match_operand:DI 2 "reg_or_8bit_operand" "rI")
1497 (match_operand:DI 3 "mode_mask_operand" "n")))]
1500 [(set_attr "type" "shift")])
1503 [(set (match_operand:DI 0 "register_operand" "=r")
1504 (lshiftrt:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
1505 (ashift:DI (match_operand:DI 2 "reg_or_8bit_operand" "rI")
1509 [(set_attr "type" "shift")])
1511 (define_insn "extqh"
1512 [(set (match_operand:DI 0 "register_operand" "=r")
1514 (match_operand:DI 1 "reg_or_0_operand" "rJ")
1515 (minus:DI (const_int 64)
1518 (match_operand:DI 2 "reg_or_8bit_operand" "rI")
1523 [(set_attr "type" "shift")])
1525 (define_insn "extlh"
1526 [(set (match_operand:DI 0 "register_operand" "=r")
1528 (and:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
1529 (const_int 2147483647))
1530 (minus:DI (const_int 64)
1533 (match_operand:DI 2 "reg_or_8bit_operand" "rI")
1538 [(set_attr "type" "shift")])
1540 (define_insn "extwh"
1541 [(set (match_operand:DI 0 "register_operand" "=r")
1543 (and:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
1545 (minus:DI (const_int 64)
1548 (match_operand:DI 2 "reg_or_8bit_operand" "rI")
1553 [(set_attr "type" "shift")])
1555 ;; This converts an extXl into an extXh with an appropriate adjustment
1556 ;; to the address calculation.
1559 ;; [(set (match_operand:DI 0 "register_operand" "")
1560 ;; (ashift:DI (zero_extract:DI (match_operand:DI 1 "register_operand" "")
1561 ;; (match_operand:DI 2 "mode_width_operand" "")
1562 ;; (ashift:DI (match_operand:DI 3 "" "")
1564 ;; (match_operand:DI 4 "const_int_operand" "")))
1565 ;; (clobber (match_operand:DI 5 "register_operand" ""))]
1566 ;; "INTVAL (operands[4]) == 64 - INTVAL (operands[2])"
1567 ;; [(set (match_dup 5) (match_dup 6))
1568 ;; (set (match_dup 0)
1569 ;; (ashift:DI (zero_extract:DI (match_dup 1) (match_dup 2)
1570 ;; (ashift:DI (plus:DI (match_dup 5)
1576 ;; operands[6] = plus_constant (operands[3],
1577 ;; INTVAL (operands[2]) / BITS_PER_UNIT);
1578 ;; operands[7] = GEN_INT (- INTVAL (operands[2]) / BITS_PER_UNIT);
1582 [(set (match_operand:DI 0 "register_operand" "=r")
1583 (ashift:DI (zero_extend:DI (match_operand:QI 1 "register_operand" "r"))
1584 (match_operand:DI 2 "mul8_operand" "I")))]
1587 [(set_attr "type" "shift")])
1590 [(set (match_operand:DI 0 "register_operand" "=r")
1591 (ashift:DI (zero_extend:DI (match_operand:HI 1 "register_operand" "r"))
1592 (match_operand:DI 2 "mul8_operand" "I")))]
1595 [(set_attr "type" "shift")])
1598 [(set (match_operand:DI 0 "register_operand" "=r")
1599 (ashift:DI (zero_extend:DI (match_operand:SI 1 "register_operand" "r"))
1600 (match_operand:DI 2 "mul8_operand" "I")))]
1603 [(set_attr "type" "shift")])
1605 (define_insn "insbl"
1606 [(set (match_operand:DI 0 "register_operand" "=r")
1607 (ashift:DI (zero_extend:DI (match_operand:QI 1 "register_operand" "r"))
1608 (ashift:DI (match_operand:DI 2 "reg_or_8bit_operand" "rI")
1612 [(set_attr "type" "shift")])
1614 (define_insn "inswl"
1615 [(set (match_operand:DI 0 "register_operand" "=r")
1616 (ashift:DI (zero_extend:DI (match_operand:HI 1 "register_operand" "r"))
1617 (ashift:DI (match_operand:DI 2 "reg_or_8bit_operand" "rI")
1621 [(set_attr "type" "shift")])
1623 (define_insn "insll"
1624 [(set (match_operand:DI 0 "register_operand" "=r")
1625 (ashift:DI (zero_extend:DI (match_operand:SI 1 "register_operand" "r"))
1626 (ashift:DI (match_operand:DI 2 "reg_or_8bit_operand" "rI")
1630 [(set_attr "type" "shift")])
1632 (define_insn "insql"
1633 [(set (match_operand:DI 0 "register_operand" "=r")
1634 (ashift:DI (match_operand:DI 1 "register_operand" "r")
1635 (ashift:DI (match_operand:DI 2 "reg_or_8bit_operand" "rI")
1639 [(set_attr "type" "shift")])
1641 ;; Combine has this sometimes habit of moving the and outside of the
1642 ;; shift, making life more interesting.
1645 [(set (match_operand:DI 0 "register_operand" "=r")
1646 (and:DI (ashift:DI (match_operand:DI 1 "register_operand" "r")
1647 (match_operand:DI 2 "mul8_operand" "I"))
1648 (match_operand:DI 3 "immediate_operand" "i")))]
1649 "HOST_BITS_PER_WIDE_INT == 64
1650 && GET_CODE (operands[3]) == CONST_INT
1651 && (((unsigned HOST_WIDE_INT) 0xff << INTVAL (operands[2])
1652 == (unsigned HOST_WIDE_INT) INTVAL (operands[3]))
1653 || ((unsigned HOST_WIDE_INT) 0xffff << INTVAL (operands[2])
1654 == (unsigned HOST_WIDE_INT) INTVAL (operands[3]))
1655 || ((unsigned HOST_WIDE_INT) 0xffffffff << INTVAL (operands[2])
1656 == (unsigned HOST_WIDE_INT) INTVAL (operands[3])))"
1659 #if HOST_BITS_PER_WIDE_INT == 64
1660 if ((unsigned HOST_WIDE_INT) 0xff << INTVAL (operands[2])
1661 == (unsigned HOST_WIDE_INT) INTVAL (operands[3]))
1662 return \"insbl %1,%s2,%0\";
1663 if ((unsigned HOST_WIDE_INT) 0xffff << INTVAL (operands[2])
1664 == (unsigned HOST_WIDE_INT) INTVAL (operands[3]))
1665 return \"inswl %1,%s2,%0\";
1666 if ((unsigned HOST_WIDE_INT) 0xffffffff << INTVAL (operands[2])
1667 == (unsigned HOST_WIDE_INT) INTVAL (operands[3]))
1668 return \"insll %1,%s2,%0\";
1672 [(set_attr "type" "shift")])
1674 ;; We do not include the insXh insns because they are complex to express
1675 ;; and it does not appear that we would ever want to generate them.
1677 ;; Since we need them for block moves, though, cop out and use unspec.
1679 (define_insn "insxh"
1680 [(set (match_operand:DI 0 "register_operand" "=r")
1681 (unspec [(match_operand:DI 1 "register_operand" "r")
1682 (match_operand:DI 2 "mode_width_operand" "n")
1683 (match_operand:DI 3 "reg_or_8bit_operand" "rI")] 2))]
1686 [(set_attr "type" "shift")])
1688 (define_insn "mskxl"
1689 [(set (match_operand:DI 0 "register_operand" "=r")
1690 (and:DI (not:DI (ashift:DI
1691 (match_operand:DI 2 "mode_mask_operand" "n")
1693 (match_operand:DI 3 "reg_or_8bit_operand" "rI")
1695 (match_operand:DI 1 "reg_or_0_operand" "rJ")))]
1698 [(set_attr "type" "shift")])
1700 ;; We do not include the mskXh insns because it does not appear we would
1701 ;; ever generate one.
1703 ;; Again, we do for block moves and we use unspec again.
1705 (define_insn "mskxh"
1706 [(set (match_operand:DI 0 "register_operand" "=r")
1707 (unspec [(match_operand:DI 1 "register_operand" "r")
1708 (match_operand:DI 2 "mode_width_operand" "n")
1709 (match_operand:DI 3 "reg_or_8bit_operand" "rI")] 3))]
1712 [(set_attr "type" "shift")])
1714 ;; Floating-point operations. All the double-precision insns can extend
1715 ;; from single, so indicate that. The exception are the ones that simply
1716 ;; play with the sign bits; it's not clear what to do there.
1718 (define_insn "abssf2"
1719 [(set (match_operand:SF 0 "register_operand" "=f")
1720 (abs:SF (match_operand:SF 1 "reg_or_fp0_operand" "fG")))]
1723 [(set_attr "type" "fcpys")])
1725 (define_insn "absdf2"
1726 [(set (match_operand:DF 0 "register_operand" "=f")
1727 (abs:DF (match_operand:DF 1 "reg_or_fp0_operand" "fG")))]
1730 [(set_attr "type" "fcpys")])
1732 (define_insn "negsf2"
1733 [(set (match_operand:SF 0 "register_operand" "=f")
1734 (neg:SF (match_operand:SF 1 "reg_or_fp0_operand" "fG")))]
1737 [(set_attr "type" "fadd")])
1739 (define_insn "negdf2"
1740 [(set (match_operand:DF 0 "register_operand" "=f")
1741 (neg:DF (match_operand:DF 1 "reg_or_fp0_operand" "fG")))]
1744 [(set_attr "type" "fadd")])
1747 [(set (match_operand:SF 0 "register_operand" "=&f")
1748 (plus:SF (match_operand:SF 1 "reg_or_fp0_operand" "%fG")
1749 (match_operand:SF 2 "reg_or_fp0_operand" "fG")))]
1750 "TARGET_FP && alpha_fptm >= ALPHA_FPTM_SU"
1751 "add%,%)%& %R1,%R2,%0"
1752 [(set_attr "type" "fadd")
1753 (set_attr "trap" "yes")])
1755 (define_insn "addsf3"
1756 [(set (match_operand:SF 0 "register_operand" "=f")
1757 (plus:SF (match_operand:SF 1 "reg_or_fp0_operand" "%fG")
1758 (match_operand:SF 2 "reg_or_fp0_operand" "fG")))]
1760 "add%,%)%& %R1,%R2,%0"
1761 [(set_attr "type" "fadd")
1762 (set_attr "trap" "yes")])
1765 [(set (match_operand:DF 0 "register_operand" "=&f")
1766 (plus:DF (match_operand:DF 1 "reg_or_fp0_operand" "%fG")
1767 (match_operand:DF 2 "reg_or_fp0_operand" "fG")))]
1768 "TARGET_FP && alpha_fptm >= ALPHA_FPTM_SU"
1769 "add%-%)%& %R1,%R2,%0"
1770 [(set_attr "type" "fadd")
1771 (set_attr "trap" "yes")])
1773 (define_insn "adddf3"
1774 [(set (match_operand:DF 0 "register_operand" "=f")
1775 (plus:DF (match_operand:DF 1 "reg_or_fp0_operand" "%fG")
1776 (match_operand:DF 2 "reg_or_fp0_operand" "fG")))]
1778 "add%-%)%& %R1,%R2,%0"
1779 [(set_attr "type" "fadd")
1780 (set_attr "trap" "yes")])
1783 [(set (match_operand:DF 0 "register_operand" "=f")
1784 (plus:DF (float_extend:DF
1785 (match_operand:SF 1 "reg_or_fp0_operand" "fG"))
1786 (match_operand:DF 2 "reg_or_fp0_operand" "fG")))]
1787 "TARGET_FP && alpha_fptm < ALPHA_FPTM_SU"
1788 "add%-%)%& %R1,%R2,%0"
1789 [(set_attr "type" "fadd")
1790 (set_attr "trap" "yes")])
1793 [(set (match_operand:DF 0 "register_operand" "=f")
1794 (plus:DF (float_extend:DF
1795 (match_operand:SF 1 "reg_or_fp0_operand" "%fG"))
1797 (match_operand:SF 2 "reg_or_fp0_operand" "fG"))))]
1798 "TARGET_FP && alpha_fptm < ALPHA_FPTM_SU"
1799 "add%-%)%& %R1,%R2,%0"
1800 [(set_attr "type" "fadd")
1801 (set_attr "trap" "yes")])
1803 ;; Define conversion operators between DFmode and SImode, using the cvtql
1804 ;; instruction. To allow combine et al to do useful things, we keep the
1805 ;; operation as a unit until after reload, at which point we split the
1808 ;; Note that we (attempt to) only consider this optimization when the
1809 ;; ultimate destination is memory. If we will be doing further integer
1810 ;; processing, it is cheaper to do the truncation in the int regs.
1812 (define_insn "*cvtql"
1813 [(set (match_operand:SI 0 "register_operand" "=f")
1814 (unspec:SI [(match_operand:DI 1 "reg_or_fp0_operand" "fG")] 5))]
1817 [(set_attr "type" "fadd")
1818 (set_attr "trap" "yes")])
1821 [(set (match_operand:SI 0 "memory_operand" "")
1822 (subreg:SI (fix:DI (match_operand:DF 1 "reg_or_fp0_operand" "")) 0))
1823 (clobber (match_scratch:DI 2 ""))
1824 (clobber (match_scratch:SI 3 ""))]
1825 "TARGET_FP && reload_completed"
1826 [(set (match_dup 2) (fix:DI (match_dup 1)))
1827 (set (match_dup 3) (unspec:SI [(match_dup 2)] 5))
1828 (set (match_dup 0) (match_dup 3))]
1832 [(set (match_operand:SI 0 "memory_operand" "")
1833 (subreg:SI (fix:DI (match_operand:DF 1 "reg_or_fp0_operand" "")) 0))
1834 (clobber (match_scratch:DI 2 ""))]
1835 "TARGET_FP && reload_completed"
1836 [(set (match_dup 2) (fix:DI (match_dup 1)))
1837 (set (match_dup 3) (unspec:SI [(match_dup 2)] 5))
1838 (set (match_dup 0) (match_dup 3))]
1839 ;; Due to REG_CANNOT_CHANGE_SIZE issues, we cannot simply use SUBREG.
1840 "operands[3] = gen_rtx_REG (SImode, REGNO (operands[2]));")
1843 [(set (match_operand:SI 0 "memory_operand" "=m")
1844 (subreg:SI (fix:DI (match_operand:DF 1 "reg_or_fp0_operand" "fG")) 0))
1845 (clobber (match_scratch:DI 2 "=&f"))
1846 (clobber (match_scratch:SI 3 "=&f"))]
1847 "TARGET_FP && alpha_fptm >= ALPHA_FPTM_SU"
1849 [(set_attr "type" "fadd")
1850 (set_attr "trap" "yes")])
1853 [(set (match_operand:SI 0 "memory_operand" "=m")
1854 (subreg:SI (fix:DI (match_operand:DF 1 "reg_or_fp0_operand" "fG")) 0))
1855 (clobber (match_scratch:DI 2 "=f"))]
1856 "TARGET_FP && alpha_fptm < ALPHA_FPTM_SU"
1858 [(set_attr "type" "fadd")
1859 (set_attr "trap" "yes")])
1862 [(set (match_operand:DI 0 "reg_no_subreg_operand" "=&f")
1863 (fix:DI (match_operand:DF 1 "reg_or_fp0_operand" "fG")))]
1864 "TARGET_FP && alpha_fptm >= ALPHA_FPTM_SU"
1866 [(set_attr "type" "fadd")
1867 (set_attr "trap" "yes")])
1869 (define_insn "fix_truncdfdi2"
1870 [(set (match_operand:DI 0 "reg_no_subreg_operand" "=f")
1871 (fix:DI (match_operand:DF 1 "reg_or_fp0_operand" "fG")))]
1874 [(set_attr "type" "fadd")
1875 (set_attr "trap" "yes")])
1877 ;; Likewise between SFmode and SImode.
1880 [(set (match_operand:SI 0 "memory_operand" "")
1881 (subreg:SI (fix:DI (float_extend:DF
1882 (match_operand:SF 1 "reg_or_fp0_operand" ""))) 0))
1883 (clobber (match_scratch:DI 2 ""))
1884 (clobber (match_scratch:SI 3 ""))]
1885 "TARGET_FP && reload_completed"
1886 [(set (match_dup 2) (fix:DI (float_extend:DF (match_dup 1))))
1887 (set (match_dup 3) (unspec:SI [(match_dup 2)] 5))
1888 (set (match_dup 0) (match_dup 3))]
1892 [(set (match_operand:SI 0 "memory_operand" "")
1893 (subreg:SI (fix:DI (float_extend:DF
1894 (match_operand:SF 1 "reg_or_fp0_operand" ""))) 0))
1895 (clobber (match_scratch:DI 2 ""))]
1896 "TARGET_FP && reload_completed"
1897 [(set (match_dup 2) (fix:DI (float_extend:DF (match_dup 1))))
1898 (set (match_dup 3) (unspec:SI [(match_dup 2)] 5))
1899 (set (match_dup 0) (match_dup 3))]
1900 ;; Due to REG_CANNOT_CHANGE_SIZE issues, we cannot simply use SUBREG.
1901 "operands[3] = gen_rtx_REG (SImode, REGNO (operands[2]));")
1904 [(set (match_operand:SI 0 "memory_operand" "=m")
1905 (subreg:SI (fix:DI (float_extend:DF
1906 (match_operand:SF 1 "reg_or_fp0_operand" "fG"))) 0))
1907 (clobber (match_scratch:DI 2 "=&f"))
1908 (clobber (match_scratch:SI 3 "=&f"))]
1909 "TARGET_FP && alpha_fptm >= ALPHA_FPTM_SU"
1911 [(set_attr "type" "fadd")
1912 (set_attr "trap" "yes")])
1915 [(set (match_operand:SI 0 "memory_operand" "=m")
1916 (subreg:SI (fix:DI (float_extend:DF
1917 (match_operand:SF 1 "reg_or_fp0_operand" "fG"))) 0))
1918 (clobber (match_scratch:DI 2 "=f"))]
1919 "TARGET_FP && alpha_fptm < ALPHA_FPTM_SU"
1921 [(set_attr "type" "fadd")
1922 (set_attr "trap" "yes")])
1925 [(set (match_operand:DI 0 "reg_no_subreg_operand" "=&f")
1926 (fix:DI (float_extend:DF
1927 (match_operand:SF 1 "reg_or_fp0_operand" "fG"))))]
1928 "TARGET_FP && alpha_fptm >= ALPHA_FPTM_SU"
1930 [(set_attr "type" "fadd")
1931 (set_attr "trap" "yes")])
1933 (define_insn "fix_truncsfdi2"
1934 [(set (match_operand:DI 0 "reg_no_subreg_operand" "=f")
1935 (fix:DI (float_extend:DF
1936 (match_operand:SF 1 "reg_or_fp0_operand" "fG"))))]
1939 [(set_attr "type" "fadd")
1940 (set_attr "trap" "yes")])
1943 [(set (match_operand:SF 0 "register_operand" "=&f")
1944 (float:SF (match_operand:DI 1 "reg_no_subreg_operand" "f")))]
1945 "TARGET_FP && alpha_fptm >= ALPHA_FPTM_SU"
1947 [(set_attr "type" "fadd")
1948 (set_attr "trap" "yes")])
1950 (define_insn "floatdisf2"
1951 [(set (match_operand:SF 0 "register_operand" "=f")
1952 (float:SF (match_operand:DI 1 "reg_no_subreg_operand" "f")))]
1955 [(set_attr "type" "fadd")
1956 (set_attr "trap" "yes")])
1959 [(set (match_operand:DF 0 "register_operand" "=&f")
1960 (float:DF (match_operand:DI 1 "reg_no_subreg_operand" "f")))]
1961 "TARGET_FP && alpha_fptm >= ALPHA_FPTM_SU"
1963 [(set_attr "type" "fadd")
1964 (set_attr "trap" "yes")])
1966 (define_insn "floatdidf2"
1967 [(set (match_operand:DF 0 "register_operand" "=f")
1968 (float:DF (match_operand:DI 1 "reg_no_subreg_operand" "f")))]
1971 [(set_attr "type" "fadd")
1972 (set_attr "trap" "yes")])
1974 (define_expand "extendsfdf2"
1975 [(use (match_operand:DF 0 "register_operand" ""))
1976 (use (match_operand:SF 1 "nonimmediate_operand" ""))]
1980 if (alpha_fptm >= ALPHA_FPTM_SU)
1981 emit_insn (gen_extendsfdf2_tp (operands[0],
1982 force_reg (SFmode, operands[1])));
1984 emit_insn (gen_extendsfdf2_no_tp (operands[0], operands[1]));
1989 (define_insn "extendsfdf2_tp"
1990 [(set (match_operand:DF 0 "register_operand" "=&f")
1991 (float_extend:DF (match_operand:SF 1 "register_operand" "f")))]
1992 "TARGET_FP && alpha_fptm >= ALPHA_FPTM_SU"
1994 [(set_attr "type" "fadd")
1995 (set_attr "trap" "yes")])
1997 (define_insn "extendsfdf2_no_tp"
1998 [(set (match_operand:DF 0 "register_operand" "=f,f,m")
1999 (float_extend:DF (match_operand:SF 1 "nonimmediate_operand" "f,m,f")))]
2000 "TARGET_FP && alpha_fptm < ALPHA_FPTM_SU"
2005 [(set_attr "type" "fcpys,fld,fst")
2006 (set_attr "trap" "yes")])
2009 [(set (match_operand:SF 0 "register_operand" "=&f")
2010 (float_truncate:SF (match_operand:DF 1 "reg_or_fp0_operand" "fG")))]
2011 "TARGET_FP && alpha_fptm >= ALPHA_FPTM_SU"
2012 "cvt%-%,%)%& %R1,%0"
2013 [(set_attr "type" "fadd")
2014 (set_attr "trap" "yes")])
2016 (define_insn "truncdfsf2"
2017 [(set (match_operand:SF 0 "register_operand" "=f")
2018 (float_truncate:SF (match_operand:DF 1 "reg_or_fp0_operand" "fG")))]
2020 "cvt%-%,%)%& %R1,%0"
2021 [(set_attr "type" "fadd")
2022 (set_attr "trap" "yes")])
2025 [(set (match_operand:SF 0 "register_operand" "=&f")
2026 (div:SF (match_operand:SF 1 "reg_or_fp0_operand" "fG")
2027 (match_operand:SF 2 "reg_or_fp0_operand" "fG")))]
2028 "TARGET_FP && alpha_fptm >= ALPHA_FPTM_SU"
2029 "div%,%)%& %R1,%R2,%0"
2030 [(set_attr "type" "fdiv")
2031 (set_attr "opsize" "si")
2032 (set_attr "trap" "yes")])
2034 (define_insn "divsf3"
2035 [(set (match_operand:SF 0 "register_operand" "=f")
2036 (div:SF (match_operand:SF 1 "reg_or_fp0_operand" "fG")
2037 (match_operand:SF 2 "reg_or_fp0_operand" "fG")))]
2039 "div%,%)%& %R1,%R2,%0"
2040 [(set_attr "type" "fdiv")
2041 (set_attr "opsize" "si")
2042 (set_attr "trap" "yes")])
2045 [(set (match_operand:DF 0 "register_operand" "=&f")
2046 (div:DF (match_operand:DF 1 "reg_or_fp0_operand" "fG")
2047 (match_operand:DF 2 "reg_or_fp0_operand" "fG")))]
2048 "TARGET_FP && alpha_fptm >= ALPHA_FPTM_SU"
2049 "div%-%)%& %R1,%R2,%0"
2050 [(set_attr "type" "fdiv")
2051 (set_attr "trap" "yes")])
2053 (define_insn "divdf3"
2054 [(set (match_operand:DF 0 "register_operand" "=f")
2055 (div:DF (match_operand:DF 1 "reg_or_fp0_operand" "fG")
2056 (match_operand:DF 2 "reg_or_fp0_operand" "fG")))]
2058 "div%-%)%& %R1,%R2,%0"
2059 [(set_attr "type" "fdiv")
2060 (set_attr "trap" "yes")])
2063 [(set (match_operand:DF 0 "register_operand" "=f")
2064 (div:DF (float_extend:DF (match_operand:SF 1 "reg_or_fp0_operand" "fG"))
2065 (match_operand:DF 2 "reg_or_fp0_operand" "fG")))]
2066 "TARGET_FP && alpha_fptm < ALPHA_FPTM_SU"
2067 "div%-%)%& %R1,%R2,%0"
2068 [(set_attr "type" "fdiv")
2069 (set_attr "trap" "yes")])
2072 [(set (match_operand:DF 0 "register_operand" "=f")
2073 (div:DF (match_operand:DF 1 "reg_or_fp0_operand" "fG")
2075 (match_operand:SF 2 "reg_or_fp0_operand" "fG"))))]
2076 "TARGET_FP && alpha_fptm < ALPHA_FPTM_SU"
2077 "div%-%)%& %R1,%R2,%0"
2078 [(set_attr "type" "fdiv")
2079 (set_attr "trap" "yes")])
2082 [(set (match_operand:DF 0 "register_operand" "=f")
2083 (div:DF (float_extend:DF (match_operand:SF 1 "reg_or_fp0_operand" "fG"))
2084 (float_extend:DF (match_operand:SF 2 "reg_or_fp0_operand" "fG"))))]
2085 "TARGET_FP && alpha_fptm < ALPHA_FPTM_SU"
2086 "div%-%)%& %R1,%R2,%0"
2087 [(set_attr "type" "fdiv")
2088 (set_attr "trap" "yes")])
2091 [(set (match_operand:SF 0 "register_operand" "=&f")
2092 (mult:SF (match_operand:SF 1 "reg_or_fp0_operand" "%fG")
2093 (match_operand:SF 2 "reg_or_fp0_operand" "fG")))]
2094 "TARGET_FP && alpha_fptm >= ALPHA_FPTM_SU"
2095 "mul%,%)%& %R1,%R2,%0"
2096 [(set_attr "type" "fmul")
2097 (set_attr "trap" "yes")])
2099 (define_insn "mulsf3"
2100 [(set (match_operand:SF 0 "register_operand" "=f")
2101 (mult:SF (match_operand:SF 1 "reg_or_fp0_operand" "%fG")
2102 (match_operand:SF 2 "reg_or_fp0_operand" "fG")))]
2104 "mul%,%)%& %R1,%R2,%0"
2105 [(set_attr "type" "fmul")
2106 (set_attr "trap" "yes")])
2109 [(set (match_operand:DF 0 "register_operand" "=&f")
2110 (mult:DF (match_operand:DF 1 "reg_or_fp0_operand" "%fG")
2111 (match_operand:DF 2 "reg_or_fp0_operand" "fG")))]
2112 "TARGET_FP && alpha_fptm >= ALPHA_FPTM_SU"
2113 "mul%-%)%& %R1,%R2,%0"
2114 [(set_attr "type" "fmul")
2115 (set_attr "trap" "yes")])
2117 (define_insn "muldf3"
2118 [(set (match_operand:DF 0 "register_operand" "=f")
2119 (mult:DF (match_operand:DF 1 "reg_or_fp0_operand" "%fG")
2120 (match_operand:DF 2 "reg_or_fp0_operand" "fG")))]
2122 "mul%-%)%& %R1,%R2,%0"
2123 [(set_attr "type" "fmul")
2124 (set_attr "trap" "yes")])
2127 [(set (match_operand:DF 0 "register_operand" "=f")
2128 (mult:DF (float_extend:DF
2129 (match_operand:SF 1 "reg_or_fp0_operand" "fG"))
2130 (match_operand:DF 2 "reg_or_fp0_operand" "fG")))]
2131 "TARGET_FP && alpha_fptm < ALPHA_FPTM_SU"
2132 "mul%-%)%& %R1,%R2,%0"
2133 [(set_attr "type" "fmul")
2134 (set_attr "trap" "yes")])
2137 [(set (match_operand:DF 0 "register_operand" "=f")
2138 (mult:DF (float_extend:DF
2139 (match_operand:SF 1 "reg_or_fp0_operand" "%fG"))
2141 (match_operand:SF 2 "reg_or_fp0_operand" "fG"))))]
2142 "TARGET_FP && alpha_fptm < ALPHA_FPTM_SU"
2143 "mul%-%)%& %R1,%R2,%0"
2144 [(set_attr "type" "fmul")
2145 (set_attr "trap" "yes")])
2148 [(set (match_operand:SF 0 "register_operand" "=&f")
2149 (minus:SF (match_operand:SF 1 "reg_or_fp0_operand" "fG")
2150 (match_operand:SF 2 "reg_or_fp0_operand" "fG")))]
2151 "TARGET_FP && alpha_fptm >= ALPHA_FPTM_SU"
2152 "sub%,%)%& %R1,%R2,%0"
2153 [(set_attr "type" "fadd")
2154 (set_attr "trap" "yes")])
2156 (define_insn "subsf3"
2157 [(set (match_operand:SF 0 "register_operand" "=f")
2158 (minus:SF (match_operand:SF 1 "reg_or_fp0_operand" "fG")
2159 (match_operand:SF 2 "reg_or_fp0_operand" "fG")))]
2161 "sub%,%)%& %R1,%R2,%0"
2162 [(set_attr "type" "fadd")
2163 (set_attr "trap" "yes")])
2166 [(set (match_operand:DF 0 "register_operand" "=&f")
2167 (minus:DF (match_operand:DF 1 "reg_or_fp0_operand" "fG")
2168 (match_operand:DF 2 "reg_or_fp0_operand" "fG")))]
2169 "TARGET_FP && alpha_fptm >= ALPHA_FPTM_SU"
2170 "sub%-%)%& %R1,%R2,%0"
2171 [(set_attr "type" "fadd")
2172 (set_attr "trap" "yes")])
2174 (define_insn "subdf3"
2175 [(set (match_operand:DF 0 "register_operand" "=f")
2176 (minus:DF (match_operand:DF 1 "reg_or_fp0_operand" "fG")
2177 (match_operand:DF 2 "reg_or_fp0_operand" "fG")))]
2179 "sub%-%)%& %R1,%R2,%0"
2180 [(set_attr "type" "fadd")
2181 (set_attr "trap" "yes")])
2184 [(set (match_operand:DF 0 "register_operand" "=f")
2185 (minus:DF (float_extend:DF
2186 (match_operand:SF 1 "reg_or_fp0_operand" "fG"))
2187 (match_operand:DF 2 "reg_or_fp0_operand" "fG")))]
2188 "TARGET_FP && alpha_fptm < ALPHA_FPTM_SU"
2189 "sub%-%)%& %R1,%R2,%0"
2190 [(set_attr "type" "fadd")
2191 (set_attr "trap" "yes")])
2194 [(set (match_operand:DF 0 "register_operand" "=f")
2195 (minus:DF (match_operand:DF 1 "reg_or_fp0_operand" "fG")
2197 (match_operand:SF 2 "reg_or_fp0_operand" "fG"))))]
2198 "TARGET_FP && alpha_fptm < ALPHA_FPTM_SU"
2199 "sub%-%)%& %R1,%R2,%0"
2200 [(set_attr "type" "fadd")
2201 (set_attr "trap" "yes")])
2204 [(set (match_operand:DF 0 "register_operand" "=f")
2205 (minus:DF (float_extend:DF
2206 (match_operand:SF 1 "reg_or_fp0_operand" "fG"))
2208 (match_operand:SF 2 "reg_or_fp0_operand" "fG"))))]
2209 "TARGET_FP && alpha_fptm < ALPHA_FPTM_SU"
2210 "sub%-%)%& %R1,%R2,%0"
2211 [(set_attr "type" "fadd")
2212 (set_attr "trap" "yes")])
2215 [(set (match_operand:SF 0 "register_operand" "=&f")
2216 (sqrt:SF (match_operand:SF 1 "reg_or_fp0_operand" "fG")))]
2217 "TARGET_FP && TARGET_FIX && alpha_fptm >= ALPHA_FPTM_SU"
2219 [(set_attr "type" "fsqrt")
2220 (set_attr "opsize" "si")
2221 (set_attr "trap" "yes")])
2223 (define_insn "sqrtsf2"
2224 [(set (match_operand:SF 0 "register_operand" "=f")
2225 (sqrt:SF (match_operand:SF 1 "reg_or_fp0_operand" "fG")))]
2226 "TARGET_FP && TARGET_FIX"
2228 [(set_attr "type" "fsqrt")
2229 (set_attr "opsize" "si")
2230 (set_attr "trap" "yes")])
2233 [(set (match_operand:DF 0 "register_operand" "=&f")
2234 (sqrt:DF (match_operand:DF 1 "reg_or_fp0_operand" "fG")))]
2235 "TARGET_FP && TARGET_FIX && alpha_fptm >= ALPHA_FPTM_SU"
2237 [(set_attr "type" "fsqrt")
2238 (set_attr "trap" "yes")])
2240 (define_insn "sqrtdf2"
2241 [(set (match_operand:DF 0 "register_operand" "=f")
2242 (sqrt:DF (match_operand:DF 1 "reg_or_fp0_operand" "fG")))]
2243 "TARGET_FP && TARGET_FIX"
2245 [(set_attr "type" "fsqrt")
2246 (set_attr "trap" "yes")])
2248 ;; Next are all the integer comparisons, and conditional moves and branches
2249 ;; and some of the related define_expand's and define_split's.
2252 [(set (match_operand:DI 0 "register_operand" "=r")
2253 (match_operator:DI 1 "alpha_comparison_operator"
2254 [(match_operand:DI 2 "reg_or_0_operand" "rJ")
2255 (match_operand:DI 3 "reg_or_8bit_operand" "rI")]))]
2258 [(set_attr "type" "icmp")])
2261 [(set (match_operand:DI 0 "register_operand" "=r")
2262 (match_operator:DI 1 "alpha_swapped_comparison_operator"
2263 [(match_operand:DI 2 "reg_or_8bit_operand" "rI")
2264 (match_operand:DI 3 "reg_or_0_operand" "rJ")]))]
2267 [(set_attr "type" "icmp")])
2269 ;; This pattern exists so conditional moves of SImode values are handled.
2270 ;; Comparisons are still done in DImode though.
2273 [(set (match_operand:SI 0 "register_operand" "=r,r,r,r")
2275 (match_operator 2 "signed_comparison_operator"
2276 [(match_operand:DI 3 "reg_or_0_operand" "rJ,rJ,J,J")
2277 (match_operand:DI 4 "reg_or_0_operand" "J,J,rJ,rJ")])
2278 (match_operand:SI 1 "reg_or_8bit_operand" "rI,0,rI,0")
2279 (match_operand:SI 5 "reg_or_8bit_operand" "0,rI,0,rI")))]
2280 "operands[3] == const0_rtx || operands[4] == const0_rtx"
2286 [(set_attr "type" "icmov")])
2289 [(set (match_operand:DI 0 "register_operand" "=r,r,r,r")
2291 (match_operator 2 "signed_comparison_operator"
2292 [(match_operand:DI 3 "reg_or_0_operand" "rJ,rJ,J,J")
2293 (match_operand:DI 4 "reg_or_0_operand" "J,J,rJ,rJ")])
2294 (match_operand:DI 1 "reg_or_8bit_operand" "rI,0,rI,0")
2295 (match_operand:DI 5 "reg_or_8bit_operand" "0,rI,0,rI")))]
2296 "operands[3] == const0_rtx || operands[4] == const0_rtx"
2302 [(set_attr "type" "icmov")])
2305 [(set (match_operand:DI 0 "register_operand" "=r,r")
2307 (eq (zero_extract:DI (match_operand:DI 2 "reg_or_0_operand" "rJ,rJ")
2311 (match_operand:DI 1 "reg_or_8bit_operand" "rI,0")
2312 (match_operand:DI 3 "reg_or_8bit_operand" "0,rI")))]
2317 [(set_attr "type" "icmov")])
2320 [(set (match_operand:DI 0 "register_operand" "=r,r")
2322 (ne (zero_extract:DI (match_operand:DI 2 "reg_or_0_operand" "rJ,rJ")
2326 (match_operand:DI 1 "reg_or_8bit_operand" "rI,0")
2327 (match_operand:DI 3 "reg_or_8bit_operand" "0,rI")))]
2332 [(set_attr "type" "icmov")])
2334 ;; For ABS, we have two choices, depending on whether the input and output
2335 ;; registers are the same or not.
2336 (define_expand "absdi2"
2337 [(set (match_operand:DI 0 "register_operand" "")
2338 (abs:DI (match_operand:DI 1 "register_operand" "")))]
2341 { if (rtx_equal_p (operands[0], operands[1]))
2342 emit_insn (gen_absdi2_same (operands[0], gen_reg_rtx (DImode)));
2344 emit_insn (gen_absdi2_diff (operands[0], operands[1]));
2349 (define_expand "absdi2_same"
2350 [(set (match_operand:DI 1 "register_operand" "")
2351 (neg:DI (match_operand:DI 0 "register_operand" "")))
2353 (if_then_else:DI (ge (match_dup 0) (const_int 0))
2359 (define_expand "absdi2_diff"
2360 [(set (match_operand:DI 0 "register_operand" "")
2361 (neg:DI (match_operand:DI 1 "register_operand" "")))
2363 (if_then_else:DI (lt (match_dup 1) (const_int 0))
2370 [(set (match_operand:DI 0 "register_operand" "")
2371 (abs:DI (match_dup 0)))
2372 (clobber (match_operand:DI 2 "register_operand" ""))]
2374 [(set (match_dup 1) (neg:DI (match_dup 0)))
2375 (set (match_dup 0) (if_then_else:DI (ge (match_dup 0) (const_int 0))
2376 (match_dup 0) (match_dup 1)))]
2380 [(set (match_operand:DI 0 "register_operand" "")
2381 (abs:DI (match_operand:DI 1 "register_operand" "")))]
2382 "! rtx_equal_p (operands[0], operands[1])"
2383 [(set (match_dup 0) (neg:DI (match_dup 1)))
2384 (set (match_dup 0) (if_then_else:DI (lt (match_dup 1) (const_int 0))
2385 (match_dup 0) (match_dup 1)))]
2389 [(set (match_operand:DI 0 "register_operand" "")
2390 (neg:DI (abs:DI (match_dup 0))))
2391 (clobber (match_operand:DI 2 "register_operand" ""))]
2393 [(set (match_dup 1) (neg:DI (match_dup 0)))
2394 (set (match_dup 0) (if_then_else:DI (le (match_dup 0) (const_int 0))
2395 (match_dup 0) (match_dup 1)))]
2399 [(set (match_operand:DI 0 "register_operand" "")
2400 (neg:DI (abs:DI (match_operand:DI 1 "register_operand" ""))))]
2401 "! rtx_equal_p (operands[0], operands[1])"
2402 [(set (match_dup 0) (neg:DI (match_dup 1)))
2403 (set (match_dup 0) (if_then_else:DI (gt (match_dup 1) (const_int 0))
2404 (match_dup 0) (match_dup 1)))]
2407 (define_insn "sminqi3"
2408 [(set (match_operand:QI 0 "register_operand" "=r")
2409 (smin:QI (match_operand:QI 1 "reg_or_0_operand" "%rJ")
2410 (match_operand:QI 2 "reg_or_8bit_operand" "rI")))]
2413 [(set_attr "type" "mvi")])
2415 (define_insn "uminqi3"
2416 [(set (match_operand:QI 0 "register_operand" "=r")
2417 (umin:QI (match_operand:QI 1 "reg_or_0_operand" "%rJ")
2418 (match_operand:QI 2 "reg_or_8bit_operand" "rI")))]
2421 [(set_attr "type" "mvi")])
2423 (define_insn "smaxqi3"
2424 [(set (match_operand:QI 0 "register_operand" "=r")
2425 (smax:QI (match_operand:QI 1 "reg_or_0_operand" "%rJ")
2426 (match_operand:QI 2 "reg_or_8bit_operand" "rI")))]
2429 [(set_attr "type" "mvi")])
2431 (define_insn "umaxqi3"
2432 [(set (match_operand:QI 0 "register_operand" "=r")
2433 (umax:QI (match_operand:QI 1 "reg_or_0_operand" "%rJ")
2434 (match_operand:QI 2 "reg_or_8bit_operand" "rI")))]
2437 [(set_attr "type" "mvi")])
2439 (define_insn "sminhi3"
2440 [(set (match_operand:HI 0 "register_operand" "=r")
2441 (smin:HI (match_operand:HI 1 "reg_or_0_operand" "%rJ")
2442 (match_operand:HI 2 "reg_or_8bit_operand" "rI")))]
2445 [(set_attr "type" "mvi")])
2447 (define_insn "uminhi3"
2448 [(set (match_operand:HI 0 "register_operand" "=r")
2449 (umin:HI (match_operand:HI 1 "reg_or_0_operand" "%rJ")
2450 (match_operand:HI 2 "reg_or_8bit_operand" "rI")))]
2453 [(set_attr "type" "mvi")])
2455 (define_insn "smaxhi3"
2456 [(set (match_operand:HI 0 "register_operand" "=r")
2457 (smax:HI (match_operand:HI 1 "reg_or_0_operand" "%rJ")
2458 (match_operand:HI 2 "reg_or_8bit_operand" "rI")))]
2461 [(set_attr "type" "mvi")])
2463 (define_insn "umaxhi3"
2464 [(set (match_operand:HI 0 "register_operand" "=r")
2465 (umax:HI (match_operand:HI 1 "reg_or_0_operand" "%rJ")
2466 (match_operand:HI 2 "reg_or_8bit_operand" "rI")))]
2469 [(set_attr "type" "shift")])
2471 (define_expand "smaxdi3"
2473 (le:DI (match_operand:DI 1 "reg_or_0_operand" "")
2474 (match_operand:DI 2 "reg_or_8bit_operand" "")))
2475 (set (match_operand:DI 0 "register_operand" "")
2476 (if_then_else:DI (eq (match_dup 3) (const_int 0))
2477 (match_dup 1) (match_dup 2)))]
2480 { operands[3] = gen_reg_rtx (DImode);
2484 [(set (match_operand:DI 0 "register_operand" "")
2485 (smax:DI (match_operand:DI 1 "reg_or_0_operand" "")
2486 (match_operand:DI 2 "reg_or_8bit_operand" "")))
2487 (clobber (match_operand:DI 3 "register_operand" ""))]
2488 "operands[2] != const0_rtx"
2489 [(set (match_dup 3) (le:DI (match_dup 1) (match_dup 2)))
2490 (set (match_dup 0) (if_then_else:DI (eq (match_dup 3) (const_int 0))
2491 (match_dup 1) (match_dup 2)))]
2495 [(set (match_operand:DI 0 "register_operand" "=r")
2496 (smax:DI (match_operand:DI 1 "register_operand" "0")
2500 [(set_attr "type" "icmov")])
2502 (define_expand "smindi3"
2504 (lt:DI (match_operand:DI 1 "reg_or_0_operand" "")
2505 (match_operand:DI 2 "reg_or_8bit_operand" "")))
2506 (set (match_operand:DI 0 "register_operand" "")
2507 (if_then_else:DI (ne (match_dup 3) (const_int 0))
2508 (match_dup 1) (match_dup 2)))]
2511 { operands[3] = gen_reg_rtx (DImode);
2515 [(set (match_operand:DI 0 "register_operand" "")
2516 (smin:DI (match_operand:DI 1 "reg_or_0_operand" "")
2517 (match_operand:DI 2 "reg_or_8bit_operand" "")))
2518 (clobber (match_operand:DI 3 "register_operand" ""))]
2519 "operands[2] != const0_rtx"
2520 [(set (match_dup 3) (lt:DI (match_dup 1) (match_dup 2)))
2521 (set (match_dup 0) (if_then_else:DI (ne (match_dup 3) (const_int 0))
2522 (match_dup 1) (match_dup 2)))]
2526 [(set (match_operand:DI 0 "register_operand" "=r")
2527 (smin:DI (match_operand:DI 1 "register_operand" "0")
2531 [(set_attr "type" "icmov")])
2533 (define_expand "umaxdi3"
2535 (leu:DI (match_operand:DI 1 "reg_or_0_operand" "")
2536 (match_operand:DI 2 "reg_or_8bit_operand" "")))
2537 (set (match_operand:DI 0 "register_operand" "")
2538 (if_then_else:DI (eq (match_dup 3) (const_int 0))
2539 (match_dup 1) (match_dup 2)))]
2542 { operands[3] = gen_reg_rtx (DImode);
2546 [(set (match_operand:DI 0 "register_operand" "")
2547 (umax:DI (match_operand:DI 1 "reg_or_0_operand" "")
2548 (match_operand:DI 2 "reg_or_8bit_operand" "")))
2549 (clobber (match_operand:DI 3 "register_operand" ""))]
2550 "operands[2] != const0_rtx"
2551 [(set (match_dup 3) (leu:DI (match_dup 1) (match_dup 2)))
2552 (set (match_dup 0) (if_then_else:DI (eq (match_dup 3) (const_int 0))
2553 (match_dup 1) (match_dup 2)))]
2556 (define_expand "umindi3"
2558 (ltu:DI (match_operand:DI 1 "reg_or_0_operand" "")
2559 (match_operand:DI 2 "reg_or_8bit_operand" "")))
2560 (set (match_operand:DI 0 "register_operand" "")
2561 (if_then_else:DI (ne (match_dup 3) (const_int 0))
2562 (match_dup 1) (match_dup 2)))]
2565 { operands[3] = gen_reg_rtx (DImode);
2569 [(set (match_operand:DI 0 "register_operand" "")
2570 (umin:DI (match_operand:DI 1 "reg_or_0_operand" "")
2571 (match_operand:DI 2 "reg_or_8bit_operand" "")))
2572 (clobber (match_operand:DI 3 "register_operand" ""))]
2573 "operands[2] != const0_rtx"
2574 [(set (match_dup 3) (ltu:DI (match_dup 1) (match_dup 2)))
2575 (set (match_dup 0) (if_then_else:DI (ne (match_dup 3) (const_int 0))
2576 (match_dup 1) (match_dup 2)))]
2582 (match_operator 1 "signed_comparison_operator"
2583 [(match_operand:DI 2 "reg_or_0_operand" "rJ")
2585 (label_ref (match_operand 0 "" ""))
2589 [(set_attr "type" "ibr")])
2594 (match_operator 1 "signed_comparison_operator"
2596 (match_operand:DI 2 "register_operand" "r")])
2597 (label_ref (match_operand 0 "" ""))
2601 [(set_attr "type" "ibr")])
2606 (ne (zero_extract:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
2610 (label_ref (match_operand 0 "" ""))
2614 [(set_attr "type" "ibr")])
2619 (eq (zero_extract:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
2623 (label_ref (match_operand 0 "" ""))
2627 [(set_attr "type" "ibr")])
2633 (match_operator 1 "comparison_operator"
2634 [(zero_extract:DI (match_operand:DI 2 "register_operand" "")
2636 (match_operand:DI 3 "const_int_operand" ""))
2638 (label_ref (match_operand 0 "" ""))
2640 (clobber (match_operand:DI 4 "register_operand" ""))])]
2641 "INTVAL (operands[3]) != 0"
2643 (lshiftrt:DI (match_dup 2) (match_dup 3)))
2645 (if_then_else (match_op_dup 1
2646 [(zero_extract:DI (match_dup 4)
2650 (label_ref (match_dup 0))
2654 ;; The following are the corresponding floating-point insns. Recall
2655 ;; we need to have variants that expand the arguments from SF mode
2659 [(set (match_operand:DF 0 "register_operand" "=&f")
2660 (match_operator:DF 1 "alpha_comparison_operator"
2661 [(match_operand:DF 2 "reg_or_fp0_operand" "fG")
2662 (match_operand:DF 3 "reg_or_fp0_operand" "fG")]))]
2663 "TARGET_FP && alpha_fptm >= ALPHA_FPTM_SU"
2664 "cmp%-%C1%' %R2,%R3,%0"
2665 [(set_attr "type" "fadd")
2666 (set_attr "trap" "yes")])
2669 [(set (match_operand:DF 0 "register_operand" "=f")
2670 (match_operator:DF 1 "alpha_comparison_operator"
2671 [(match_operand:DF 2 "reg_or_fp0_operand" "fG")
2672 (match_operand:DF 3 "reg_or_fp0_operand" "fG")]))]
2673 "TARGET_FP && alpha_fptm < ALPHA_FPTM_SU"
2674 "cmp%-%C1%' %R2,%R3,%0"
2675 [(set_attr "type" "fadd")
2676 (set_attr "trap" "yes")])
2679 [(set (match_operand:DF 0 "register_operand" "=&f")
2680 (match_operator:DF 1 "alpha_comparison_operator"
2682 (match_operand:SF 2 "reg_or_fp0_operand" "fG"))
2683 (match_operand:DF 3 "reg_or_fp0_operand" "fG")]))]
2684 "TARGET_FP && alpha_fptm >= ALPHA_FPTM_SU"
2685 "cmp%-%C1%' %R2,%R3,%0"
2686 [(set_attr "type" "fadd")
2687 (set_attr "trap" "yes")])
2690 [(set (match_operand:DF 0 "register_operand" "=f")
2691 (match_operator:DF 1 "alpha_comparison_operator"
2693 (match_operand:SF 2 "reg_or_fp0_operand" "fG"))
2694 (match_operand:DF 3 "reg_or_fp0_operand" "fG")]))]
2695 "TARGET_FP && alpha_fptm < ALPHA_FPTM_SU"
2696 "cmp%-%C1%' %R2,%R3,%0"
2697 [(set_attr "type" "fadd")
2698 (set_attr "trap" "yes")])
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")
2705 (match_operand:SF 3 "reg_or_fp0_operand" "fG"))]))]
2706 "TARGET_FP && alpha_fptm >= ALPHA_FPTM_SU"
2707 "cmp%-%C1%' %R2,%R3,%0"
2708 [(set_attr "type" "fadd")
2709 (set_attr "trap" "yes")])
2712 [(set (match_operand:DF 0 "register_operand" "=f")
2713 (match_operator:DF 1 "alpha_comparison_operator"
2714 [(match_operand:DF 2 "reg_or_fp0_operand" "fG")
2716 (match_operand:SF 3 "reg_or_fp0_operand" "fG"))]))]
2717 "TARGET_FP && alpha_fptm < ALPHA_FPTM_SU"
2718 "cmp%-%C1%' %R2,%R3,%0"
2719 [(set_attr "type" "fadd")
2720 (set_attr "trap" "yes")])
2723 [(set (match_operand:DF 0 "register_operand" "=&f")
2724 (match_operator:DF 1 "alpha_comparison_operator"
2726 (match_operand:SF 2 "reg_or_fp0_operand" "fG"))
2728 (match_operand:SF 3 "reg_or_fp0_operand" "fG"))]))]
2729 "TARGET_FP && alpha_fptm >= ALPHA_FPTM_SU"
2730 "cmp%-%C1%' %R2,%R3,%0"
2731 [(set_attr "type" "fadd")
2732 (set_attr "trap" "yes")])
2735 [(set (match_operand:DF 0 "register_operand" "=f")
2736 (match_operator:DF 1 "alpha_comparison_operator"
2738 (match_operand:SF 2 "reg_or_fp0_operand" "fG"))
2740 (match_operand:SF 3 "reg_or_fp0_operand" "fG"))]))]
2741 "TARGET_FP && alpha_fptm < ALPHA_FPTM_SU"
2742 "cmp%-%C1%' %R2,%R3,%0"
2743 [(set_attr "type" "fadd")
2744 (set_attr "trap" "yes")])
2747 [(set (match_operand:DF 0 "register_operand" "=f,f")
2749 (match_operator 3 "signed_comparison_operator"
2750 [(match_operand:DF 4 "reg_or_fp0_operand" "fG,fG")
2751 (match_operand:DF 2 "fp0_operand" "G,G")])
2752 (match_operand:DF 1 "reg_or_fp0_operand" "fG,0")
2753 (match_operand:DF 5 "reg_or_fp0_operand" "0,fG")))]
2757 fcmov%D3 %R4,%R5,%0"
2758 [(set_attr "type" "fcmov")])
2761 [(set (match_operand:SF 0 "register_operand" "=f,f")
2763 (match_operator 3 "signed_comparison_operator"
2764 [(match_operand:DF 4 "reg_or_fp0_operand" "fG,fG")
2765 (match_operand:DF 2 "fp0_operand" "G,G")])
2766 (match_operand:SF 1 "reg_or_fp0_operand" "fG,0")
2767 (match_operand:SF 5 "reg_or_fp0_operand" "0,fG")))]
2771 fcmov%D3 %R4,%R5,%0"
2772 [(set_attr "type" "fcmov")])
2775 [(set (match_operand:DF 0 "register_operand" "=f,f")
2777 (match_operator 3 "signed_comparison_operator"
2778 [(match_operand:DF 4 "reg_or_fp0_operand" "fG,fG")
2779 (match_operand:DF 2 "fp0_operand" "G,G")])
2780 (float_extend:DF (match_operand:SF 1 "reg_or_fp0_operand" "fG,0"))
2781 (match_operand:DF 5 "reg_or_fp0_operand" "0,fG")))]
2785 fcmov%D3 %R4,%R5,%0"
2786 [(set_attr "type" "fcmov")])
2789 [(set (match_operand:DF 0 "register_operand" "=f,f")
2791 (match_operator 3 "signed_comparison_operator"
2793 (match_operand:SF 4 "reg_or_fp0_operand" "fG,fG"))
2794 (match_operand:DF 2 "fp0_operand" "G,G")])
2795 (match_operand:DF 1 "reg_or_fp0_operand" "fG,0")
2796 (match_operand:DF 5 "reg_or_fp0_operand" "0,fG")))]
2800 fcmov%D3 %R4,%R5,%0"
2801 [(set_attr "type" "fcmov")])
2804 [(set (match_operand:SF 0 "register_operand" "=f,f")
2806 (match_operator 3 "signed_comparison_operator"
2808 (match_operand:SF 4 "reg_or_fp0_operand" "fG,fG"))
2809 (match_operand:DF 2 "fp0_operand" "G,G")])
2810 (match_operand:SF 1 "reg_or_fp0_operand" "fG,0")
2811 (match_operand:SF 5 "reg_or_fp0_operand" "0,fG")))]
2815 fcmov%D3 %R4,%R5,%0"
2816 [(set_attr "type" "fcmov")])
2819 [(set (match_operand:DF 0 "register_operand" "=f,f")
2821 (match_operator 3 "signed_comparison_operator"
2823 (match_operand:SF 4 "reg_or_fp0_operand" "fG,fG"))
2824 (match_operand:DF 2 "fp0_operand" "G,G")])
2825 (float_extend:DF (match_operand:SF 1 "reg_or_fp0_operand" "fG,0"))
2826 (match_operand:DF 5 "reg_or_fp0_operand" "0,fG")))]
2830 fcmov%D3 %R4,%R5,%0"
2831 [(set_attr "type" "fcmov")])
2833 (define_expand "maxdf3"
2835 (le:DF (match_operand:DF 1 "reg_or_fp0_operand" "")
2836 (match_operand:DF 2 "reg_or_fp0_operand" "")))
2837 (set (match_operand:DF 0 "register_operand" "")
2838 (if_then_else:DF (eq (match_dup 3) (match_dup 4))
2839 (match_dup 1) (match_dup 2)))]
2842 { operands[3] = gen_reg_rtx (DFmode);
2843 operands[4] = CONST0_RTX (DFmode);
2846 (define_expand "mindf3"
2848 (lt:DF (match_operand:DF 1 "reg_or_fp0_operand" "")
2849 (match_operand:DF 2 "reg_or_fp0_operand" "")))
2850 (set (match_operand:DF 0 "register_operand" "")
2851 (if_then_else:DF (ne (match_dup 3) (match_dup 4))
2852 (match_dup 1) (match_dup 2)))]
2855 { operands[3] = gen_reg_rtx (DFmode);
2856 operands[4] = CONST0_RTX (DFmode);
2859 (define_expand "maxsf3"
2861 (le:DF (float_extend:DF (match_operand:SF 1 "reg_or_fp0_operand" ""))
2862 (float_extend:DF (match_operand:SF 2 "reg_or_fp0_operand" ""))))
2863 (set (match_operand:SF 0 "register_operand" "")
2864 (if_then_else:SF (eq (match_dup 3) (match_dup 4))
2865 (match_dup 1) (match_dup 2)))]
2868 { operands[3] = gen_reg_rtx (DFmode);
2869 operands[4] = CONST0_RTX (DFmode);
2872 (define_expand "minsf3"
2874 (lt:DF (float_extend:DF (match_operand:SF 1 "reg_or_fp0_operand" ""))
2875 (float_extend:DF (match_operand:SF 2 "reg_or_fp0_operand" ""))))
2876 (set (match_operand:SF 0 "register_operand" "")
2877 (if_then_else:SF (ne (match_dup 3) (match_dup 4))
2878 (match_dup 1) (match_dup 2)))]
2881 { operands[3] = gen_reg_rtx (DFmode);
2882 operands[4] = CONST0_RTX (DFmode);
2888 (match_operator 1 "signed_comparison_operator"
2889 [(match_operand:DF 2 "reg_or_fp0_operand" "fG")
2890 (match_operand:DF 3 "fp0_operand" "G")])
2891 (label_ref (match_operand 0 "" ""))
2895 [(set_attr "type" "fbr")])
2900 (match_operator 1 "signed_comparison_operator"
2902 (match_operand:SF 2 "reg_or_fp0_operand" "fG"))
2903 (match_operand:DF 3 "fp0_operand" "G")])
2904 (label_ref (match_operand 0 "" ""))
2908 [(set_attr "type" "fbr")])
2910 ;; These are the main define_expand's used to make conditional branches
2913 (define_expand "cmpdf"
2914 [(set (cc0) (compare (match_operand:DF 0 "reg_or_fp0_operand" "")
2915 (match_operand:DF 1 "reg_or_fp0_operand" "")))]
2919 alpha_compare.op0 = operands[0];
2920 alpha_compare.op1 = operands[1];
2921 alpha_compare.fp_p = 1;
2925 (define_expand "cmpdi"
2926 [(set (cc0) (compare (match_operand:DI 0 "reg_or_0_operand" "")
2927 (match_operand:DI 1 "reg_or_8bit_operand" "")))]
2931 alpha_compare.op0 = operands[0];
2932 alpha_compare.op1 = operands[1];
2933 alpha_compare.fp_p = 0;
2937 (define_expand "beq"
2939 (if_then_else (match_dup 1)
2940 (label_ref (match_operand 0 "" ""))
2943 "{ operands[1] = alpha_emit_conditional_branch (EQ); }")
2945 (define_expand "bne"
2947 (if_then_else (match_dup 1)
2948 (label_ref (match_operand 0 "" ""))
2951 "{ operands[1] = alpha_emit_conditional_branch (NE); }")
2953 (define_expand "blt"
2955 (if_then_else (match_dup 1)
2956 (label_ref (match_operand 0 "" ""))
2959 "{ operands[1] = alpha_emit_conditional_branch (LT); }")
2961 (define_expand "ble"
2963 (if_then_else (match_dup 1)
2964 (label_ref (match_operand 0 "" ""))
2967 "{ operands[1] = alpha_emit_conditional_branch (LE); }")
2969 (define_expand "bgt"
2971 (if_then_else (match_dup 1)
2972 (label_ref (match_operand 0 "" ""))
2975 "{ operands[1] = alpha_emit_conditional_branch (GT); }")
2977 (define_expand "bge"
2979 (if_then_else (match_dup 1)
2980 (label_ref (match_operand 0 "" ""))
2983 "{ operands[1] = alpha_emit_conditional_branch (GE); }")
2985 (define_expand "bltu"
2987 (if_then_else (match_dup 1)
2988 (label_ref (match_operand 0 "" ""))
2991 "{ operands[1] = alpha_emit_conditional_branch (LTU); }")
2993 (define_expand "bleu"
2995 (if_then_else (match_dup 1)
2996 (label_ref (match_operand 0 "" ""))
2999 "{ operands[1] = alpha_emit_conditional_branch (LEU); }")
3001 (define_expand "bgtu"
3003 (if_then_else (match_dup 1)
3004 (label_ref (match_operand 0 "" ""))
3007 "{ operands[1] = alpha_emit_conditional_branch (GTU); }")
3009 (define_expand "bgeu"
3011 (if_then_else (match_dup 1)
3012 (label_ref (match_operand 0 "" ""))
3015 "{ operands[1] = alpha_emit_conditional_branch (GEU); }")
3017 (define_expand "seq"
3018 [(set (match_operand:DI 0 "register_operand" "")
3023 if (alpha_compare.fp_p)
3026 operands[1] = gen_rtx_EQ (DImode, alpha_compare.op0, alpha_compare.op1);
3027 alpha_compare.op0 = alpha_compare.op1 = NULL_RTX;
3030 (define_expand "sne"
3031 [(set (match_operand:DI 0 "register_operand" "")
3033 (set (match_dup 0) (xor:DI (match_dup 0) (const_int 1)))]
3037 if (alpha_compare.fp_p)
3040 if (alpha_compare.op1 == const0_rtx)
3042 emit_insn (gen_sgtu (operands[0]));
3046 operands[1] = gen_rtx_EQ (DImode, alpha_compare.op0, alpha_compare.op1);
3047 alpha_compare.op0 = alpha_compare.op1 = NULL_RTX;
3050 (define_expand "slt"
3051 [(set (match_operand:DI 0 "register_operand" "")
3056 if (alpha_compare.fp_p)
3059 operands[1] = gen_rtx_LT (DImode, alpha_compare.op0, alpha_compare.op1);
3060 alpha_compare.op0 = alpha_compare.op1 = NULL_RTX;
3063 (define_expand "sle"
3064 [(set (match_operand:DI 0 "register_operand" "")
3069 if (alpha_compare.fp_p)
3072 operands[1] = gen_rtx_LE (DImode, alpha_compare.op0, alpha_compare.op1);
3073 alpha_compare.op0 = alpha_compare.op1 = NULL_RTX;
3076 (define_expand "sgt"
3077 [(set (match_operand:DI 0 "register_operand" "")
3082 if (alpha_compare.fp_p)
3085 operands[1] = gen_rtx_LT (DImode, force_reg (DImode, alpha_compare.op1),
3087 alpha_compare.op0 = alpha_compare.op1 = NULL_RTX;
3090 (define_expand "sge"
3091 [(set (match_operand:DI 0 "register_operand" "")
3096 if (alpha_compare.fp_p)
3099 operands[1] = gen_rtx_LE (DImode, force_reg (DImode, alpha_compare.op1),
3101 alpha_compare.op0 = alpha_compare.op1 = NULL_RTX;
3104 (define_expand "sltu"
3105 [(set (match_operand:DI 0 "register_operand" "")
3110 if (alpha_compare.fp_p)
3113 operands[1] = gen_rtx_LTU (DImode, alpha_compare.op0, alpha_compare.op1);
3114 alpha_compare.op0 = alpha_compare.op1 = NULL_RTX;
3117 (define_expand "sleu"
3118 [(set (match_operand:DI 0 "register_operand" "")
3123 if (alpha_compare.fp_p)
3126 operands[1] = gen_rtx_LEU (DImode, alpha_compare.op0, alpha_compare.op1);
3127 alpha_compare.op0 = alpha_compare.op1 = NULL_RTX;
3130 (define_expand "sgtu"
3131 [(set (match_operand:DI 0 "register_operand" "")
3136 if (alpha_compare.fp_p)
3139 operands[1] = gen_rtx_LTU (DImode, force_reg (DImode, alpha_compare.op1),
3141 alpha_compare.op0 = alpha_compare.op1 = NULL_RTX;
3144 (define_expand "sgeu"
3145 [(set (match_operand:DI 0 "register_operand" "")
3150 if (alpha_compare.fp_p)
3153 operands[1] = gen_rtx_LEU (DImode, force_reg (DImode, alpha_compare.op1),
3155 alpha_compare.op0 = alpha_compare.op1 = NULL_RTX;
3158 ;; These are the main define_expand's used to make conditional moves.
3160 (define_expand "movsicc"
3161 [(set (match_operand:SI 0 "register_operand" "")
3162 (if_then_else:SI (match_operand 1 "comparison_operator" "")
3163 (match_operand:SI 2 "reg_or_8bit_operand" "")
3164 (match_operand:SI 3 "reg_or_8bit_operand" "")))]
3168 if ((operands[1] = alpha_emit_conditional_move (operands[1], SImode)) == 0)
3172 (define_expand "movdicc"
3173 [(set (match_operand:DI 0 "register_operand" "")
3174 (if_then_else:DI (match_operand 1 "comparison_operator" "")
3175 (match_operand:DI 2 "reg_or_8bit_operand" "")
3176 (match_operand:DI 3 "reg_or_8bit_operand" "")))]
3180 if ((operands[1] = alpha_emit_conditional_move (operands[1], DImode)) == 0)
3184 (define_expand "movsfcc"
3185 [(set (match_operand:SF 0 "register_operand" "")
3186 (if_then_else:SF (match_operand 1 "comparison_operator" "")
3187 (match_operand:SF 2 "reg_or_8bit_operand" "")
3188 (match_operand:SF 3 "reg_or_8bit_operand" "")))]
3192 if ((operands[1] = alpha_emit_conditional_move (operands[1], SFmode)) == 0)
3196 (define_expand "movdfcc"
3197 [(set (match_operand:DF 0 "register_operand" "")
3198 (if_then_else:DF (match_operand 1 "comparison_operator" "")
3199 (match_operand:DF 2 "reg_or_8bit_operand" "")
3200 (match_operand:DF 3 "reg_or_8bit_operand" "")))]
3204 if ((operands[1] = alpha_emit_conditional_move (operands[1], DFmode)) == 0)
3208 ;; These define_split definitions are used in cases when comparisons have
3209 ;; not be stated in the correct way and we need to reverse the second
3210 ;; comparison. For example, x >= 7 has to be done as x < 6 with the
3211 ;; comparison that tests the result being reversed. We have one define_split
3212 ;; for each use of a comparison. They do not match valid insns and need
3213 ;; not generate valid insns.
3215 ;; We can also handle equality comparisons (and inequality comparisons in
3216 ;; cases where the resulting add cannot overflow) by doing an add followed by
3217 ;; a comparison with zero. This is faster since the addition takes one
3218 ;; less cycle than a compare when feeding into a conditional move.
3219 ;; For this case, we also have an SImode pattern since we can merge the add
3220 ;; and sign extend and the order doesn't matter.
3222 ;; We do not do this for floating-point, since it isn't clear how the "wrong"
3223 ;; operation could have been generated.
3226 [(set (match_operand:DI 0 "register_operand" "")
3228 (match_operator 1 "comparison_operator"
3229 [(match_operand:DI 2 "reg_or_0_operand" "")
3230 (match_operand:DI 3 "reg_or_cint_operand" "")])
3231 (match_operand:DI 4 "reg_or_cint_operand" "")
3232 (match_operand:DI 5 "reg_or_cint_operand" "")))
3233 (clobber (match_operand:DI 6 "register_operand" ""))]
3234 "operands[3] != const0_rtx"
3235 [(set (match_dup 6) (match_dup 7))
3237 (if_then_else:DI (match_dup 8) (match_dup 4) (match_dup 5)))]
3239 { enum rtx_code code = GET_CODE (operands[1]);
3240 int unsignedp = (code == GEU || code == LEU || code == GTU || code == LTU);
3242 /* If we are comparing for equality with a constant and that constant
3243 appears in the arm when the register equals the constant, use the
3244 register since that is more likely to match (and to produce better code
3247 if (code == EQ && GET_CODE (operands[3]) == CONST_INT
3248 && rtx_equal_p (operands[4], operands[3]))
3249 operands[4] = operands[2];
3251 else if (code == NE && GET_CODE (operands[3]) == CONST_INT
3252 && rtx_equal_p (operands[5], operands[3]))
3253 operands[5] = operands[2];
3255 if (code == NE || code == EQ
3256 || (extended_count (operands[2], DImode, unsignedp) >= 1
3257 && extended_count (operands[3], DImode, unsignedp) >= 1))
3259 if (GET_CODE (operands[3]) == CONST_INT)
3260 operands[7] = gen_rtx_PLUS (DImode, operands[2],
3261 GEN_INT (- INTVAL (operands[3])));
3263 operands[7] = gen_rtx_MINUS (DImode, operands[2], operands[3]);
3265 operands[8] = gen_rtx_fmt_ee (code, VOIDmode, operands[6], const0_rtx);
3268 else if (code == EQ || code == LE || code == LT
3269 || code == LEU || code == LTU)
3271 operands[7] = gen_rtx_fmt_ee (code, DImode, operands[2], operands[3]);
3272 operands[8] = gen_rtx_NE (VOIDmode, operands[6], const0_rtx);
3276 operands[7] = gen_rtx_fmt_ee (reverse_condition (code), DImode,
3277 operands[2], operands[3]);
3278 operands[8] = gen_rtx_EQ (VOIDmode, operands[6], const0_rtx);
3283 [(set (match_operand:DI 0 "register_operand" "")
3285 (match_operator 1 "comparison_operator"
3286 [(match_operand:SI 2 "reg_or_0_operand" "")
3287 (match_operand:SI 3 "reg_or_cint_operand" "")])
3288 (match_operand:DI 4 "reg_or_8bit_operand" "")
3289 (match_operand:DI 5 "reg_or_8bit_operand" "")))
3290 (clobber (match_operand:DI 6 "register_operand" ""))]
3291 "operands[3] != const0_rtx
3292 && (GET_CODE (operands[1]) == EQ || GET_CODE (operands[1]) == NE)"
3293 [(set (match_dup 6) (match_dup 7))
3295 (if_then_else:DI (match_dup 8) (match_dup 4) (match_dup 5)))]
3297 { enum rtx_code code = GET_CODE (operands[1]);
3298 int unsignedp = (code == GEU || code == LEU || code == GTU || code == LTU);
3301 if ((code != NE && code != EQ
3302 && ! (extended_count (operands[2], DImode, unsignedp) >= 1
3303 && extended_count (operands[3], DImode, unsignedp) >= 1)))
3306 if (GET_CODE (operands[3]) == CONST_INT)
3307 tem = gen_rtx_PLUS (SImode, operands[2],
3308 GEN_INT (- INTVAL (operands[3])));
3310 tem = gen_rtx_MINUS (SImode, operands[2], operands[3]);
3312 operands[7] = gen_rtx_SIGN_EXTEND (DImode, tem);
3313 operands[8] = gen_rtx_fmt_ee (GET_CODE (operands[1]), VOIDmode,
3314 operands[6], const0_rtx);
3320 (match_operator 1 "comparison_operator"
3321 [(match_operand:DI 2 "reg_or_0_operand" "")
3322 (match_operand:DI 3 "reg_or_cint_operand" "")])
3323 (label_ref (match_operand 0 "" ""))
3325 (clobber (match_operand:DI 4 "register_operand" ""))]
3326 "operands[3] != const0_rtx"
3327 [(set (match_dup 4) (match_dup 5))
3328 (set (pc) (if_then_else (match_dup 6) (label_ref (match_dup 0)) (pc)))]
3330 { enum rtx_code code = GET_CODE (operands[1]);
3331 int unsignedp = (code == GEU || code == LEU || code == GTU || code == LTU);
3333 if (code == NE || code == EQ
3334 || (extended_count (operands[2], DImode, unsignedp) >= 1
3335 && extended_count (operands[3], DImode, unsignedp) >= 1))
3337 if (GET_CODE (operands[3]) == CONST_INT)
3338 operands[5] = gen_rtx_PLUS (DImode, operands[2],
3339 GEN_INT (- INTVAL (operands[3])));
3341 operands[5] = gen_rtx_MINUS (DImode, operands[2], operands[3]);
3343 operands[6] = gen_rtx_fmt_ee (code, VOIDmode, operands[4], const0_rtx);
3346 else if (code == EQ || code == LE || code == LT
3347 || code == LEU || code == LTU)
3349 operands[5] = gen_rtx_fmt_ee (code, DImode, operands[2], operands[3]);
3350 operands[6] = gen_rtx_NE (VOIDmode, operands[4], const0_rtx);
3354 operands[5] = gen_rtx_fmt_ee (reverse_condition (code), DImode,
3355 operands[2], operands[3]);
3356 operands[6] = gen_rtx_EQ (VOIDmode, operands[4], const0_rtx);
3363 (match_operator 1 "comparison_operator"
3364 [(match_operand:SI 2 "reg_or_0_operand" "")
3365 (match_operand:SI 3 "const_int_operand" "")])
3366 (label_ref (match_operand 0 "" ""))
3368 (clobber (match_operand:DI 4 "register_operand" ""))]
3369 "operands[3] != const0_rtx
3370 && (GET_CODE (operands[1]) == EQ || GET_CODE (operands[1]) == NE)"
3371 [(set (match_dup 4) (match_dup 5))
3372 (set (pc) (if_then_else (match_dup 6) (label_ref (match_dup 0)) (pc)))]
3376 if (GET_CODE (operands[3]) == CONST_INT)
3377 tem = gen_rtx_PLUS (SImode, operands[2],
3378 GEN_INT (- INTVAL (operands[3])));
3380 tem = gen_rtx_MINUS (SImode, operands[2], operands[3]);
3382 operands[5] = gen_rtx_SIGN_EXTEND (DImode, tem);
3383 operands[6] = gen_rtx_fmt_ee (GET_CODE (operands[1]), VOIDmode,
3384 operands[4], const0_rtx);
3387 ;; We can convert such things as "a > 0xffff" to "t = a & ~ 0xffff; t != 0".
3388 ;; This eliminates one, and sometimes two, insns when the AND can be done
3391 [(set (match_operand:DI 0 "register_operand" "")
3392 (match_operator 1 "comparison_operator"
3393 [(match_operand:DI 2 "register_operand" "")
3394 (match_operand:DI 3 "const_int_operand" "")]))
3395 (clobber (match_operand:DI 4 "register_operand" ""))]
3396 "exact_log2 (INTVAL (operands[3]) + 1) >= 0
3397 && (GET_CODE (operands[1]) == GTU
3398 || GET_CODE (operands[1]) == LEU
3399 || ((GET_CODE (operands[1]) == GT || GET_CODE (operands[1]) == LE)
3400 && extended_count (operands[2], DImode, 1) > 0))"
3401 [(set (match_dup 4) (and:DI (match_dup 2) (match_dup 5)))
3402 (set (match_dup 0) (match_dup 6))]
3405 operands[5] = GEN_INT (~ INTVAL (operands[3]));
3406 operands[6] = gen_rtx_fmt_ee (((GET_CODE (operands[1]) == GTU
3407 || GET_CODE (operands[1]) == GT)
3409 DImode, operands[4], const0_rtx);
3412 ;; Here are the CALL and unconditional branch insns. Calls on NT and OSF
3413 ;; work differently, so we have different patterns for each.
3415 (define_expand "call"
3416 [(use (match_operand:DI 0 "" ""))
3417 (use (match_operand 1 "" ""))
3418 (use (match_operand 2 "" ""))
3419 (use (match_operand 3 "" ""))]
3422 { if (TARGET_WINDOWS_NT)
3423 emit_call_insn (gen_call_nt (operands[0], operands[1]));
3424 else if (TARGET_OPEN_VMS)
3425 emit_call_insn (gen_call_vms (operands[0], operands[2]));
3427 emit_call_insn (gen_call_osf (operands[0], operands[1]));
3432 (define_expand "call_osf"
3433 [(parallel [(call (mem:DI (match_operand 0 "" ""))
3434 (match_operand 1 "" ""))
3435 (clobber (reg:DI 27))
3436 (clobber (reg:DI 26))])]
3439 { if (GET_CODE (operands[0]) != MEM)
3442 operands[0] = XEXP (operands[0], 0);
3444 if (GET_CODE (operands[0]) != SYMBOL_REF
3445 && ! (GET_CODE (operands[0]) == REG && REGNO (operands[0]) == 27))
3447 rtx tem = gen_rtx_REG (DImode, 27);
3448 emit_move_insn (tem, operands[0]);
3453 (define_expand "call_nt"
3454 [(parallel [(call (mem:DI (match_operand 0 "" ""))
3455 (match_operand 1 "" ""))
3456 (clobber (reg:DI 26))])]
3459 { if (GET_CODE (operands[0]) != MEM)
3462 operands[0] = XEXP (operands[0], 0);
3463 if (GET_CODE (operands[0]) != SYMBOL_REF && GET_CODE (operands[0]) != REG)
3464 operands[0] = force_reg (DImode, operands[0]);
3468 ;; call openvms/alpha
3469 ;; op 0: symbol ref for called function
3470 ;; op 1: next_arg_reg (argument information value for R25)
3472 (define_expand "call_vms"
3473 [(parallel [(call (mem:DI (match_operand 0 "" ""))
3474 (match_operand 1 "" ""))
3478 (clobber (reg:DI 27))])]
3481 { if (GET_CODE (operands[0]) != MEM)
3484 operands[0] = XEXP (operands[0], 0);
3486 /* Always load AI with argument information, then handle symbolic and
3487 indirect call differently. Load RA and set operands[2] to PV in
3490 emit_move_insn (gen_rtx_REG (DImode, 25), operands[1]);
3491 if (GET_CODE (operands[0]) == SYMBOL_REF)
3493 extern char *savealloc ();
3494 char *linksym, *symbol = XSTR (operands[0], 0);
3499 linksym = savealloc (strlen (symbol) + 6);
3501 alpha_need_linkage (symbol, 0);
3504 strcpy (linksym+1, symbol);
3505 strcat (linksym, \"..lk\");
3506 linkage = gen_rtx_SYMBOL_REF (Pmode, linksym);
3508 emit_move_insn (gen_rtx_REG (Pmode, 26), gen_rtx_MEM (Pmode, linkage));
3511 = validize_mem (gen_rtx_MEM (Pmode, plus_constant (linkage, 8)));
3515 emit_move_insn (gen_rtx_REG (Pmode, 26),
3516 gen_rtx_MEM (Pmode, plus_constant (operands[0], 8)));
3518 operands[2] = operands[0];
3523 (define_expand "call_value"
3524 [(use (match_operand 0 "" ""))
3525 (use (match_operand:DI 1 "" ""))
3526 (use (match_operand 2 "" ""))
3527 (use (match_operand 3 "" ""))
3528 (use (match_operand 4 "" ""))]
3531 { if (TARGET_WINDOWS_NT)
3532 emit_call_insn (gen_call_value_nt (operands[0], operands[1], operands[2]));
3533 else if (TARGET_OPEN_VMS)
3534 emit_call_insn (gen_call_value_vms (operands[0], operands[1],
3537 emit_call_insn (gen_call_value_osf (operands[0], operands[1],
3542 (define_expand "call_value_osf"
3543 [(parallel [(set (match_operand 0 "" "")
3544 (call (mem:DI (match_operand 1 "" ""))
3545 (match_operand 2 "" "")))
3546 (clobber (reg:DI 27))
3547 (clobber (reg:DI 26))])]
3550 { if (GET_CODE (operands[1]) != MEM)
3553 operands[1] = XEXP (operands[1], 0);
3555 if (GET_CODE (operands[1]) != SYMBOL_REF
3556 && ! (GET_CODE (operands[1]) == REG && REGNO (operands[1]) == 27))
3558 rtx tem = gen_rtx_REG (DImode, 27);
3559 emit_move_insn (tem, operands[1]);
3564 (define_expand "call_value_nt"
3565 [(parallel [(set (match_operand 0 "" "")
3566 (call (mem:DI (match_operand 1 "" ""))
3567 (match_operand 2 "" "")))
3568 (clobber (reg:DI 26))])]
3571 { if (GET_CODE (operands[1]) != MEM)
3574 operands[1] = XEXP (operands[1], 0);
3575 if (GET_CODE (operands[1]) != SYMBOL_REF && GET_CODE (operands[1]) != REG)
3576 operands[1] = force_reg (DImode, operands[1]);
3579 (define_expand "call_value_vms"
3580 [(parallel [(set (match_operand 0 "" "")
3581 (call (mem:DI (match_operand:DI 1 "" ""))
3582 (match_operand 2 "" "")))
3586 (clobber (reg:DI 27))])]
3589 { if (GET_CODE (operands[1]) != MEM)
3592 operands[1] = XEXP (operands[1], 0);
3594 /* Always load AI with argument information, then handle symbolic and
3595 indirect call differently. Load RA and set operands[3] to PV in
3598 emit_move_insn (gen_rtx_REG (DImode, 25), operands[2]);
3599 if (GET_CODE (operands[1]) == SYMBOL_REF)
3601 extern char *savealloc ();
3602 char *linksym, *symbol = XSTR (operands[1], 0);
3607 linksym = savealloc (strlen (symbol) + 6);
3609 alpha_need_linkage (symbol, 0);
3611 strcpy (linksym+1, symbol);
3612 strcat (linksym, \"..lk\");
3613 linkage = gen_rtx_SYMBOL_REF (Pmode, linksym);
3615 emit_move_insn (gen_rtx_REG (Pmode, 26), gen_rtx_MEM (Pmode, linkage));
3618 = validize_mem (gen_rtx_MEM (Pmode, plus_constant (linkage, 8)));
3622 emit_move_insn (gen_rtx_REG (Pmode, 26),
3623 gen_rtx_MEM (Pmode, plus_constant (operands[1], 8)));
3625 operands[3] = operands[1];
3630 [(call (mem:DI (match_operand:DI 0 "call_operand" "r,R,i"))
3631 (match_operand 1 "" ""))
3632 (clobber (reg:DI 27))
3633 (clobber (reg:DI 26))]
3634 "! TARGET_WINDOWS_NT && ! TARGET_OPEN_VMS"
3636 jsr $26,($27),0\;ldgp $29,0($26)
3638 jsr $26,%0\;ldgp $29,0($26)"
3639 [(set_attr "type" "jsr")
3640 (set_attr "length" "12,*,16")])
3643 [(call (mem:DI (match_operand:DI 0 "call_operand" "r,R,i"))
3644 (match_operand 1 "" ""))
3645 (clobber (reg:DI 26))]
3651 [(set_attr "type" "jsr")
3652 (set_attr "length" "*,*,12")])
3655 [(call (mem:DI (match_operand:DI 0 "call_operand" "r,i"))
3656 (match_operand 1 "" ""))
3657 (use (match_operand:DI 2 "general_operand" "r,m"))
3660 (clobber (reg:DI 27))]
3663 mov %2,$27\;jsr $26,0\;ldq $27,0($29)
3664 ldq $27,%2\;jsr $26,%0\;ldq $27,0($29)"
3665 [(set_attr "type" "jsr")
3666 (set_attr "length" "12,16")])
3669 [(set (match_operand 0 "register_operand" "=rf,rf,rf")
3670 (call (mem:DI (match_operand:DI 1 "call_operand" "r,R,i"))
3671 (match_operand 2 "" "")))
3672 (clobber (reg:DI 27))
3673 (clobber (reg:DI 26))]
3674 "! TARGET_WINDOWS_NT && ! TARGET_OPEN_VMS"
3676 jsr $26,($27),0\;ldgp $29,0($26)
3678 jsr $26,%1\;ldgp $29,0($26)"
3679 [(set_attr "type" "jsr")
3680 (set_attr "length" "12,*,16")])
3683 [(set (match_operand 0 "register_operand" "=rf,rf,rf")
3684 (call (mem:DI (match_operand:DI 1 "call_operand" "r,R,i"))
3685 (match_operand 2 "" "")))
3686 (clobber (reg:DI 26))]
3692 [(set_attr "type" "jsr")
3693 (set_attr "length" "*,*,12")])
3696 [(set (match_operand 0 "register_operand" "")
3697 (call (mem:DI (match_operand:DI 1 "call_operand" "r,i"))
3698 (match_operand 2 "" "")))
3699 (use (match_operand:DI 3 "general_operand" "r,m"))
3702 (clobber (reg:DI 27))]
3705 mov %3,$27\;jsr $26,0\;ldq $27,0($29)
3706 ldq $27,%3\;jsr $26,%1\;ldq $27,0($29)"
3707 [(set_attr "type" "jsr")
3708 (set_attr "length" "12,16")])
3710 ;; Call subroutine returning any type.
3712 (define_expand "untyped_call"
3713 [(parallel [(call (match_operand 0 "" "")
3715 (match_operand 1 "" "")
3716 (match_operand 2 "" "")])]
3722 emit_call_insn (gen_call (operands[0], const0_rtx, NULL, const0_rtx));
3724 for (i = 0; i < XVECLEN (operands[2], 0); i++)
3726 rtx set = XVECEXP (operands[2], 0, i);
3727 emit_move_insn (SET_DEST (set), SET_SRC (set));
3730 /* The optimizer does not know that the call sets the function value
3731 registers we stored in the result block. We avoid problems by
3732 claiming that all hard registers are used and clobbered at this
3734 emit_insn (gen_blockage ());
3739 ;; UNSPEC_VOLATILE is considered to use and clobber all hard registers and
3740 ;; all of memory. This blocks insns from being moved across this point.
3742 (define_insn "blockage"
3743 [(unspec_volatile [(const_int 0)] 1)]
3746 [(set_attr "length" "0")])
3750 (label_ref (match_operand 0 "" "")))]
3753 [(set_attr "type" "ibr")])
3755 (define_insn "return"
3759 [(set_attr "type" "ibr")])
3761 ;; Use a different pattern for functions which have non-trivial
3762 ;; epilogues so as not to confuse jump and reorg.
3763 (define_insn "return_internal"
3768 [(set_attr "type" "ibr")])
3770 (define_insn "indirect_jump"
3771 [(set (pc) (match_operand:DI 0 "register_operand" "r"))]
3774 [(set_attr "type" "ibr")])
3776 (define_expand "tablejump"
3777 [(use (match_operand:SI 0 "register_operand" ""))
3778 (use (match_operand:SI 1 "" ""))]
3782 if (TARGET_WINDOWS_NT)
3783 emit_jump_insn (gen_tablejump_nt (operands[0], operands[1]));
3784 else if (TARGET_OPEN_VMS)
3785 emit_jump_insn (gen_tablejump_vms (operands[0], operands[1]));
3787 emit_jump_insn (gen_tablejump_osf (operands[0], operands[1]));
3792 (define_expand "tablejump_osf"
3794 (sign_extend:DI (match_operand:SI 0 "register_operand" "")))
3795 (parallel [(set (pc)
3796 (plus:DI (match_dup 3)
3797 (label_ref:DI (match_operand 1 "" ""))))
3798 (clobber (match_scratch:DI 2 "=r"))])]
3801 { operands[3] = gen_reg_rtx (DImode); }")
3803 (define_expand "tablejump_nt"
3805 (sign_extend:DI (match_operand:SI 0 "register_operand" "")))
3806 (parallel [(set (pc)
3808 (use (label_ref (match_operand 1 "" "")))])]
3811 { operands[3] = gen_reg_rtx (DImode); }")
3814 ;; tablejump, openVMS way
3816 ;; op 1: label preceding jump-table
3818 (define_expand "tablejump_vms"
3820 (match_operand:DI 0 "register_operand" ""))
3822 (plus:DI (match_dup 2)
3823 (label_ref:DI (match_operand 1 "" ""))))]
3826 { operands[2] = gen_reg_rtx (DImode); }")
3830 (plus:DI (match_operand:DI 0 "register_operand" "r")
3831 (label_ref:DI (match_operand 1 "" ""))))
3832 (clobber (match_scratch:DI 2 "=r"))]
3833 "! TARGET_WINDOWS_NT && ! TARGET_OPEN_VMS && next_active_insn (insn) != 0
3834 && GET_CODE (PATTERN (next_active_insn (insn))) == ADDR_DIFF_VEC
3835 && PREV_INSN (next_active_insn (insn)) == operands[1]"
3837 { rtx best_label = 0;
3838 rtx jump_table_insn = next_active_insn (operands[1]);
3840 if (GET_CODE (jump_table_insn) == JUMP_INSN
3841 && GET_CODE (PATTERN (jump_table_insn)) == ADDR_DIFF_VEC)
3843 rtx jump_table = PATTERN (jump_table_insn);
3844 int n_labels = XVECLEN (jump_table, 1);
3845 int best_count = -1;
3848 for (i = 0; i < n_labels; i++)
3852 for (j = i + 1; j < n_labels; j++)
3853 if (XEXP (XVECEXP (jump_table, 1, i), 0)
3854 == XEXP (XVECEXP (jump_table, 1, j), 0))
3857 if (count > best_count)
3858 best_count = count, best_label = XVECEXP (jump_table, 1, i);
3864 operands[3] = best_label;
3865 return \"addq %0,$29,%2\;jmp $31,(%2),%3\";
3868 return \"addq %0,$29,%2\;jmp $31,(%2),0\";
3870 [(set_attr "type" "ibr")
3871 (set_attr "length" "8")])
3875 (match_operand:DI 0 "register_operand" "r"))
3876 (use (label_ref (match_operand 1 "" "")))]
3877 "TARGET_WINDOWS_NT && next_active_insn (insn) != 0
3878 && GET_CODE (PATTERN (next_active_insn (insn))) == ADDR_DIFF_VEC
3879 && PREV_INSN (next_active_insn (insn)) == operands[1]"
3881 { rtx best_label = 0;
3882 rtx jump_table_insn = next_active_insn (operands[1]);
3884 if (GET_CODE (jump_table_insn) == JUMP_INSN
3885 && GET_CODE (PATTERN (jump_table_insn)) == ADDR_DIFF_VEC)
3887 rtx jump_table = PATTERN (jump_table_insn);
3888 int n_labels = XVECLEN (jump_table, 1);
3889 int best_count = -1;
3892 for (i = 0; i < n_labels; i++)
3896 for (j = i + 1; j < n_labels; j++)
3897 if (XEXP (XVECEXP (jump_table, 1, i), 0)
3898 == XEXP (XVECEXP (jump_table, 1, j), 0))
3901 if (count > best_count)
3902 best_count = count, best_label = XVECEXP (jump_table, 1, i);
3908 operands[2] = best_label;
3909 return \"jmp $31,(%0),%2\";
3912 return \"jmp $31,(%0),0\";
3914 [(set_attr "type" "ibr")])
3917 ;; op 0 is table offset
3918 ;; op 1 is table label
3923 (plus:DI (match_operand 0 "register_operand" "r")
3924 (label_ref (match_operand 1 "" ""))))]
3927 [(set_attr "type" "ibr")])
3929 ;; Cache flush. Used by INITIALIZE_TRAMPOLINE. 0x86 is PAL_imb, but we don't
3930 ;; want to have to include pal.h in our .s file.
3932 ;; Technically the type for call_pal is jsr, but we use that for determining
3933 ;; if we need a GP. Use ibr instead since it has the same EV5 scheduling
3936 [(unspec_volatile [(const_int 0)] 0)]
3939 [(set_attr "type" "ibr")])
3941 ;; Finally, we have the basic data motion insns. The byte and word insns
3942 ;; are done via define_expand. Start with the floating-point insns, since
3943 ;; they are simpler.
3946 [(set (match_operand:SF 0 "nonimmediate_operand" "=f,f,r,r,m,m")
3947 (match_operand:SF 1 "input_operand" "fG,m,rG,m,fG,r"))]
3949 && (register_operand (operands[0], SFmode)
3950 || reg_or_fp0_operand (operands[1], SFmode))"
3958 [(set_attr "type" "fcpys,fld,ilog,ild,fst,ist")])
3961 [(set (match_operand:SF 0 "nonimmediate_operand" "=f,f,r,r,m,m,f,*r")
3962 (match_operand:SF 1 "input_operand" "fG,m,rG,m,fG,r,r,*f"))]
3964 && (register_operand (operands[0], SFmode)
3965 || reg_or_fp0_operand (operands[1], SFmode))"
3975 [(set_attr "type" "fcpys,fld,ilog,ild,fst,ist,itof,ftoi")])
3978 [(set (match_operand:DF 0 "nonimmediate_operand" "=f,f,r,r,m,m")
3979 (match_operand:DF 1 "input_operand" "fG,m,rG,m,fG,r"))]
3981 && (register_operand (operands[0], DFmode)
3982 || reg_or_fp0_operand (operands[1], DFmode))"
3990 [(set_attr "type" "fcpys,fld,ilog,ild,fst,ist")])
3993 [(set (match_operand:DF 0 "nonimmediate_operand" "=f,f,r,r,m,m,f,*r")
3994 (match_operand:DF 1 "input_operand" "fG,m,rG,m,fG,r,r,*f"))]
3996 && (register_operand (operands[0], DFmode)
3997 || reg_or_fp0_operand (operands[1], DFmode))"
4007 [(set_attr "type" "fcpys,fld,ilog,ild,fst,ist,itof,ftoi")])
4009 (define_expand "movsf"
4010 [(set (match_operand:SF 0 "nonimmediate_operand" "")
4011 (match_operand:SF 1 "general_operand" ""))]
4015 if (GET_CODE (operands[0]) == MEM
4016 && ! reg_or_fp0_operand (operands[1], SFmode))
4017 operands[1] = force_reg (SFmode, operands[1]);
4020 (define_expand "movdf"
4021 [(set (match_operand:DF 0 "nonimmediate_operand" "")
4022 (match_operand:DF 1 "general_operand" ""))]
4026 if (GET_CODE (operands[0]) == MEM
4027 && ! reg_or_fp0_operand (operands[1], DFmode))
4028 operands[1] = force_reg (DFmode, operands[1]);
4032 [(set (match_operand:SI 0 "nonimmediate_operand" "=r,r,r,r,m,f,f,m")
4033 (match_operand:SI 1 "input_operand" "rJ,K,L,m,rJ,fJ,m,f"))]
4034 "! TARGET_WINDOWS_NT && ! TARGET_OPEN_VMS && ! TARGET_FIX
4035 && (register_operand (operands[0], SImode)
4036 || reg_or_0_operand (operands[1], SImode))"
4046 [(set_attr "type" "ilog,iadd,iadd,ild,ist,fcpys,fld,fst")])
4049 [(set (match_operand:SI 0 "nonimmediate_operand" "=r,r,r,r,m,f,f,m,r,*f")
4050 (match_operand:SI 1 "input_operand" "rJ,K,L,m,rJ,fJ,m,f,f,*r"))]
4051 "! TARGET_WINDOWS_NT && ! TARGET_OPEN_VMS && TARGET_FIX
4052 && (register_operand (operands[0], SImode)
4053 || reg_or_0_operand (operands[1], SImode))"
4065 [(set_attr "type" "ilog,iadd,iadd,ild,ist,fcpys,fld,fst,ftoi,itof")])
4068 [(set (match_operand:SI 0 "nonimmediate_operand" "=r,r,r,r,r,m,f,f,m")
4069 (match_operand:SI 1 "input_operand" "rJ,K,L,s,m,rJ,fJ,m,f"))]
4070 "(TARGET_WINDOWS_NT || TARGET_OPEN_VMS)
4071 && (register_operand (operands[0], SImode)
4072 || reg_or_0_operand (operands[1], SImode))"
4083 [(set_attr "type" "ilog,iadd,iadd,ldsym,ild,ist,fcpys,fld,fst")])
4086 [(set (match_operand:HI 0 "register_operand" "=r,r")
4087 (match_operand:HI 1 "input_operand" "rJ,n"))]
4089 && (register_operand (operands[0], HImode)
4090 || register_operand (operands[1], HImode))"
4094 [(set_attr "type" "ilog,iadd")])
4097 [(set (match_operand:HI 0 "nonimmediate_operand" "=r,r,r,m")
4098 (match_operand:HI 1 "input_operand" "rJ,n,m,rJ"))]
4100 && (register_operand (operands[0], HImode)
4101 || reg_or_0_operand (operands[1], HImode))"
4107 [(set_attr "type" "ilog,iadd,ild,ist")])
4110 [(set (match_operand:QI 0 "register_operand" "=r,r")
4111 (match_operand:QI 1 "input_operand" "rJ,n"))]
4113 && (register_operand (operands[0], QImode)
4114 || register_operand (operands[1], QImode))"
4118 [(set_attr "type" "ilog,iadd")])
4121 [(set (match_operand:QI 0 "nonimmediate_operand" "=r,r,r,m")
4122 (match_operand:QI 1 "input_operand" "rJ,n,m,rJ"))]
4124 && (register_operand (operands[0], QImode)
4125 || reg_or_0_operand (operands[1], QImode))"
4131 [(set_attr "type" "ilog,iadd,ild,ist")])
4133 ;; We do two major things here: handle mem->mem and construct long
4136 (define_expand "movsi"
4137 [(set (match_operand:SI 0 "general_operand" "")
4138 (match_operand:SI 1 "general_operand" ""))]
4142 if (GET_CODE (operands[0]) == MEM
4143 && ! reg_or_0_operand (operands[1], SImode))
4144 operands[1] = force_reg (SImode, operands[1]);
4146 if (! CONSTANT_P (operands[1]) || input_operand (operands[1], SImode))
4148 else if (GET_CODE (operands[1]) == CONST_INT)
4151 = alpha_emit_set_const (operands[0], SImode, INTVAL (operands[1]), 3);
4152 if (rtx_equal_p (operands[0], operands[1]))
4157 ;; Split a load of a large constant into the appropriate two-insn
4161 [(set (match_operand:SI 0 "register_operand" "")
4162 (match_operand:SI 1 "const_int_operand" ""))]
4163 "! add_operand (operands[1], SImode)"
4164 [(set (match_dup 0) (match_dup 2))
4165 (set (match_dup 0) (plus:SI (match_dup 0) (match_dup 3)))]
4168 = alpha_emit_set_const (operands[0], SImode, INTVAL (operands[1]), 2);
4170 if (tem == operands[0])
4177 [(set (match_operand:DI 0 "general_operand" "=r,r,r,r,r,m,f,f,Q")
4178 (match_operand:DI 1 "input_operand" "rJ,K,L,s,m,rJ,fJ,Q,f"))]
4180 && (register_operand (operands[0], DImode)
4181 || reg_or_0_operand (operands[1], DImode))"
4192 [(set_attr "type" "ilog,iadd,iadd,ldsym,ild,ist,fcpys,fld,fst")])
4195 [(set (match_operand:DI 0 "general_operand" "=r,r,r,r,r,m,f,f,Q,r,*f")
4196 (match_operand:DI 1 "input_operand" "rJ,K,L,s,m,rJ,fJ,Q,f,f,*r"))]
4198 && (register_operand (operands[0], DImode)
4199 || reg_or_0_operand (operands[1], DImode))"
4212 [(set_attr "type" "ilog,iadd,iadd,ldsym,ild,ist,fcpys,fld,fst,ftoi,itof")])
4214 ;; We do three major things here: handle mem->mem, put 64-bit constants in
4215 ;; memory, and construct long 32-bit constants.
4217 (define_expand "movdi"
4218 [(set (match_operand:DI 0 "general_operand" "")
4219 (match_operand:DI 1 "general_operand" ""))]
4225 if (GET_CODE (operands[0]) == MEM
4226 && ! reg_or_0_operand (operands[1], DImode))
4227 operands[1] = force_reg (DImode, operands[1]);
4229 if (! CONSTANT_P (operands[1]) || input_operand (operands[1], DImode))
4231 else if (GET_CODE (operands[1]) == CONST_INT
4232 && (tem = alpha_emit_set_const (operands[0], DImode,
4233 INTVAL (operands[1]), 3)) != 0)
4235 if (rtx_equal_p (tem, operands[0]))
4240 else if (CONSTANT_P (operands[1]))
4242 if (TARGET_BUILD_CONSTANTS)
4244 HOST_WIDE_INT i0, i1;
4246 if (GET_CODE (operands[1]) == CONST_INT)
4248 i0 = INTVAL (operands[1]);
4251 else if (GET_CODE (operands[1]) == CONST_DOUBLE)
4253 #if HOST_BITS_PER_WIDE_INT >= 64
4254 i0 = CONST_DOUBLE_LOW (operands[1]);
4257 i0 = CONST_DOUBLE_LOW (operands[1]);
4258 i1 = CONST_DOUBLE_HIGH (operands[1]);
4264 tem = alpha_emit_set_long_const (operands[0], i0, i1);
4265 if (rtx_equal_p (tem, operands[0]))
4272 operands[1] = force_const_mem (DImode, operands[1]);
4273 if (reload_in_progress)
4275 emit_move_insn (operands[0], XEXP (operands[1], 0));
4276 operands[1] = copy_rtx (operands[1]);
4277 XEXP (operands[1], 0) = operands[0];
4280 operands[1] = validize_mem (operands[1]);
4287 ;; Split a load of a large constant into the appropriate two-insn
4291 [(set (match_operand:DI 0 "register_operand" "")
4292 (match_operand:DI 1 "const_int_operand" ""))]
4293 "! add_operand (operands[1], DImode)"
4294 [(set (match_dup 0) (match_dup 2))
4295 (set (match_dup 0) (plus:DI (match_dup 0) (match_dup 3)))]
4298 = alpha_emit_set_const (operands[0], DImode, INTVAL (operands[1]), 2);
4300 if (tem == operands[0])
4306 ;; These are the partial-word cases.
4308 ;; First we have the code to load an aligned word. Operand 0 is the register
4309 ;; in which to place the result. It's mode is QImode or HImode. Operand 1
4310 ;; is an SImode MEM at the low-order byte of the proper word. Operand 2 is the
4311 ;; number of bits within the word that the value is. Operand 3 is an SImode
4312 ;; scratch register. If operand 0 is a hard register, operand 3 may be the
4313 ;; same register. It is allowed to conflict with operand 1 as well.
4315 (define_expand "aligned_loadqi"
4316 [(set (match_operand:SI 3 "register_operand" "")
4317 (match_operand:SI 1 "memory_operand" ""))
4318 (set (subreg:DI (match_operand:QI 0 "register_operand" "") 0)
4319 (zero_extract:DI (subreg:DI (match_dup 3) 0)
4321 (match_operand:DI 2 "const_int_operand" "")))]
4326 (define_expand "aligned_loadhi"
4327 [(set (match_operand:SI 3 "register_operand" "")
4328 (match_operand:SI 1 "memory_operand" ""))
4329 (set (subreg:DI (match_operand:HI 0 "register_operand" "") 0)
4330 (zero_extract:DI (subreg:DI (match_dup 3) 0)
4332 (match_operand:DI 2 "const_int_operand" "")))]
4337 ;; Similar for unaligned loads, where we use the sequence from the
4338 ;; Alpha Architecture manual.
4340 ;; Operand 1 is the address. Operands 2 and 3 are temporaries, where
4341 ;; operand 3 can overlap the input and output registers.
4343 (define_expand "unaligned_loadqi"
4344 [(set (match_operand:DI 2 "register_operand" "")
4345 (mem:DI (and:DI (match_operand:DI 1 "address_operand" "")
4347 (set (match_operand:DI 3 "register_operand" "")
4349 (set (subreg:DI (match_operand:QI 0 "register_operand" "") 0)
4350 (zero_extract:DI (match_dup 2)
4352 (ashift:DI (match_dup 3) (const_int 3))))]
4356 (define_expand "unaligned_loadhi"
4357 [(set (match_operand:DI 2 "register_operand" "")
4358 (mem:DI (and:DI (match_operand:DI 1 "address_operand" "")
4360 (set (match_operand:DI 3 "register_operand" "")
4362 (set (subreg:DI (match_operand:QI 0 "register_operand" "") 0)
4363 (zero_extract:DI (match_dup 2)
4365 (ashift:DI (match_dup 3) (const_int 3))))]
4369 ;; Storing an aligned byte or word requires two temporaries. Operand 0 is the
4370 ;; aligned SImode MEM. Operand 1 is the register containing the
4371 ;; byte or word to store. Operand 2 is the number of bits within the word that
4372 ;; the value should be placed. Operands 3 and 4 are SImode temporaries.
4374 (define_expand "aligned_store"
4375 [(set (match_operand:SI 3 "register_operand" "")
4376 (match_operand:SI 0 "memory_operand" ""))
4377 (set (subreg:DI (match_dup 3) 0)
4378 (and:DI (subreg:DI (match_dup 3) 0) (match_dup 5)))
4379 (set (subreg:DI (match_operand:SI 4 "register_operand" "") 0)
4380 (ashift:DI (zero_extend:DI (match_operand 1 "register_operand" ""))
4381 (match_operand:DI 2 "const_int_operand" "")))
4382 (set (subreg:DI (match_dup 4) 0)
4383 (ior:DI (subreg:DI (match_dup 4) 0) (subreg:DI (match_dup 3) 0)))
4384 (set (match_dup 0) (match_dup 4))]
4387 { operands[5] = GEN_INT (~ (GET_MODE_MASK (GET_MODE (operands[1]))
4388 << INTVAL (operands[2])));
4391 ;; For the unaligned byte and halfword cases, we use code similar to that
4392 ;; in the ;; Architecture book, but reordered to lower the number of registers
4393 ;; required. Operand 0 is the address. Operand 1 is the data to store.
4394 ;; Operands 2, 3, and 4 are DImode temporaries, where operands 2 and 4 may
4395 ;; be the same temporary, if desired. If the address is in a register,
4396 ;; operand 2 can be that register.
4398 (define_expand "unaligned_storeqi"
4399 [(set (match_operand:DI 3 "register_operand" "")
4400 (mem:DI (and:DI (match_operand:DI 0 "address_operand" "")
4402 (set (match_operand:DI 2 "register_operand" "")
4405 (and:DI (not:DI (ashift:DI (const_int 255)
4406 (ashift:DI (match_dup 2) (const_int 3))))
4408 (set (match_operand:DI 4 "register_operand" "")
4409 (ashift:DI (zero_extend:DI (match_operand:QI 1 "register_operand" ""))
4410 (ashift:DI (match_dup 2) (const_int 3))))
4411 (set (match_dup 4) (ior:DI (match_dup 4) (match_dup 3)))
4412 (set (mem:DI (and:DI (match_dup 0) (const_int -8)))
4417 (define_expand "unaligned_storehi"
4418 [(set (match_operand:DI 3 "register_operand" "")
4419 (mem:DI (and:DI (match_operand:DI 0 "address_operand" "")
4421 (set (match_operand:DI 2 "register_operand" "")
4424 (and:DI (not:DI (ashift:DI (const_int 65535)
4425 (ashift:DI (match_dup 2) (const_int 3))))
4427 (set (match_operand:DI 4 "register_operand" "")
4428 (ashift:DI (zero_extend:DI (match_operand:HI 1 "register_operand" ""))
4429 (ashift:DI (match_dup 2) (const_int 3))))
4430 (set (match_dup 4) (ior:DI (match_dup 4) (match_dup 3)))
4431 (set (mem:DI (and:DI (match_dup 0) (const_int -8)))
4436 ;; Here are the define_expand's for QI and HI moves that use the above
4437 ;; patterns. We have the normal sets, plus the ones that need scratch
4438 ;; registers for reload.
4440 (define_expand "movqi"
4441 [(set (match_operand:QI 0 "general_operand" "")
4442 (match_operand:QI 1 "general_operand" ""))]
4448 if (GET_CODE (operands[0]) == MEM
4449 && ! reg_or_0_operand (operands[1], QImode))
4450 operands[1] = force_reg (QImode, operands[1]);
4452 if (GET_CODE (operands[1]) == CONST_INT
4453 && ! input_operand (operands[1], QImode))
4455 operands[1] = alpha_emit_set_const (operands[0], QImode,
4456 INTVAL (operands[1]), 3);
4458 if (rtx_equal_p (operands[0], operands[1]))
4465 /* If the output is not a register, the input must be. */
4466 if (GET_CODE (operands[0]) == MEM)
4467 operands[1] = force_reg (QImode, operands[1]);
4469 /* Handle four memory cases, unaligned and aligned for either the input
4470 or the output. The only case where we can be called during reload is
4471 for aligned loads; all other cases require temporaries. */
4473 if (GET_CODE (operands[1]) == MEM
4474 || (GET_CODE (operands[1]) == SUBREG
4475 && GET_CODE (SUBREG_REG (operands[1])) == MEM)
4476 || (reload_in_progress && GET_CODE (operands[1]) == REG
4477 && REGNO (operands[1]) >= FIRST_PSEUDO_REGISTER)
4478 || (reload_in_progress && GET_CODE (operands[1]) == SUBREG
4479 && GET_CODE (SUBREG_REG (operands[1])) == REG
4480 && REGNO (SUBREG_REG (operands[1])) >= FIRST_PSEUDO_REGISTER))
4482 if (aligned_memory_operand (operands[1], QImode))
4484 if (reload_in_progress)
4486 emit_insn (gen_reload_inqi_help
4487 (operands[0], operands[1],
4488 gen_rtx_REG (SImode, REGNO (operands[0]))));
4492 rtx aligned_mem, bitnum;
4493 rtx scratch = gen_reg_rtx (SImode);
4495 get_aligned_mem (operands[1], &aligned_mem, &bitnum);
4497 emit_insn (gen_aligned_loadqi (operands[0], aligned_mem, bitnum,
4503 /* Don't pass these as parameters since that makes the generated
4504 code depend on parameter evaluation order which will cause
4505 bootstrap failures. */
4507 rtx temp1 = gen_reg_rtx (DImode);
4508 rtx temp2 = gen_reg_rtx (DImode);
4510 = gen_unaligned_loadqi (operands[0],
4511 get_unaligned_address (operands[1], 0),
4514 alpha_set_memflags (seq, operands[1]);
4521 else if (GET_CODE (operands[0]) == MEM
4522 || (GET_CODE (operands[0]) == SUBREG
4523 && GET_CODE (SUBREG_REG (operands[0])) == MEM)
4524 || (reload_in_progress && GET_CODE (operands[0]) == REG
4525 && REGNO (operands[0]) >= FIRST_PSEUDO_REGISTER)
4526 || (reload_in_progress && GET_CODE (operands[0]) == SUBREG
4527 && GET_CODE (SUBREG_REG (operands[0])) == REG
4528 && REGNO (operands[0]) >= FIRST_PSEUDO_REGISTER))
4530 if (aligned_memory_operand (operands[0], QImode))
4532 rtx aligned_mem, bitnum;
4533 rtx temp1 = gen_reg_rtx (SImode);
4534 rtx temp2 = gen_reg_rtx (SImode);
4536 get_aligned_mem (operands[0], &aligned_mem, &bitnum);
4538 emit_insn (gen_aligned_store (aligned_mem, operands[1], bitnum,
4543 rtx temp1 = gen_reg_rtx (DImode);
4544 rtx temp2 = gen_reg_rtx (DImode);
4545 rtx temp3 = gen_reg_rtx (DImode);
4547 = gen_unaligned_storeqi (get_unaligned_address (operands[0], 0),
4548 operands[1], temp1, temp2, temp3);
4550 alpha_set_memflags (seq, operands[0]);
4558 (define_expand "movhi"
4559 [(set (match_operand:HI 0 "general_operand" "")
4560 (match_operand:HI 1 "general_operand" ""))]
4566 if (GET_CODE (operands[0]) == MEM
4567 && ! reg_or_0_operand (operands[1], HImode))
4568 operands[1] = force_reg (HImode, operands[1]);
4570 if (GET_CODE (operands[1]) == CONST_INT
4571 && ! input_operand (operands[1], HImode))
4573 operands[1] = alpha_emit_set_const (operands[0], HImode,
4574 INTVAL (operands[1]), 3);
4576 if (rtx_equal_p (operands[0], operands[1]))
4583 /* If the output is not a register, the input must be. */
4584 if (GET_CODE (operands[0]) == MEM)
4585 operands[1] = force_reg (HImode, operands[1]);
4587 /* Handle four memory cases, unaligned and aligned for either the input
4588 or the output. The only case where we can be called during reload is
4589 for aligned loads; all other cases require temporaries. */
4591 if (GET_CODE (operands[1]) == MEM
4592 || (GET_CODE (operands[1]) == SUBREG
4593 && GET_CODE (SUBREG_REG (operands[1])) == MEM)
4594 || (reload_in_progress && GET_CODE (operands[1]) == REG
4595 && REGNO (operands[1]) >= FIRST_PSEUDO_REGISTER)
4596 || (reload_in_progress && GET_CODE (operands[1]) == SUBREG
4597 && GET_CODE (SUBREG_REG (operands[1])) == REG
4598 && REGNO (SUBREG_REG (operands[1])) >= FIRST_PSEUDO_REGISTER))
4600 if (aligned_memory_operand (operands[1], HImode))
4602 if (reload_in_progress)
4604 emit_insn (gen_reload_inhi_help
4605 (operands[0], operands[1],
4606 gen_rtx_REG (SImode, REGNO (operands[0]))));
4610 rtx aligned_mem, bitnum;
4611 rtx scratch = gen_reg_rtx (SImode);
4613 get_aligned_mem (operands[1], &aligned_mem, &bitnum);
4615 emit_insn (gen_aligned_loadhi (operands[0], aligned_mem, bitnum,
4621 /* Don't pass these as parameters since that makes the generated
4622 code depend on parameter evaluation order which will cause
4623 bootstrap failures. */
4625 rtx temp1 = gen_reg_rtx (DImode);
4626 rtx temp2 = gen_reg_rtx (DImode);
4628 = gen_unaligned_loadhi (operands[0],
4629 get_unaligned_address (operands[1], 0),
4632 alpha_set_memflags (seq, operands[1]);
4639 else if (GET_CODE (operands[0]) == MEM
4640 || (GET_CODE (operands[0]) == SUBREG
4641 && GET_CODE (SUBREG_REG (operands[0])) == MEM)
4642 || (reload_in_progress && GET_CODE (operands[0]) == REG
4643 && REGNO (operands[0]) >= FIRST_PSEUDO_REGISTER)
4644 || (reload_in_progress && GET_CODE (operands[0]) == SUBREG
4645 && GET_CODE (SUBREG_REG (operands[0])) == REG
4646 && REGNO (operands[0]) >= FIRST_PSEUDO_REGISTER))
4648 if (aligned_memory_operand (operands[0], HImode))
4650 rtx aligned_mem, bitnum;
4651 rtx temp1 = gen_reg_rtx (SImode);
4652 rtx temp2 = gen_reg_rtx (SImode);
4654 get_aligned_mem (operands[0], &aligned_mem, &bitnum);
4656 emit_insn (gen_aligned_store (aligned_mem, operands[1], bitnum,
4661 rtx temp1 = gen_reg_rtx (DImode);
4662 rtx temp2 = gen_reg_rtx (DImode);
4663 rtx temp3 = gen_reg_rtx (DImode);
4665 = gen_unaligned_storehi (get_unaligned_address (operands[0], 0),
4666 operands[1], temp1, temp2, temp3);
4668 alpha_set_memflags (seq, operands[0]);
4677 ;; Here are the versions for reload. Note that in the unaligned cases
4678 ;; we know that the operand must not be a pseudo-register because stack
4679 ;; slots are always aligned references.
4681 (define_expand "reload_inqi"
4682 [(parallel [(match_operand:QI 0 "register_operand" "=r")
4683 (match_operand:QI 1 "any_memory_operand" "m")
4684 (match_operand:TI 2 "register_operand" "=&r")])]
4690 if (GET_CODE (operands[1]) != MEM)
4693 if (aligned_memory_operand (operands[1], QImode))
4695 seq = gen_reload_inqi_help (operands[0], operands[1],
4696 gen_rtx_REG (SImode, REGNO (operands[2])));
4702 /* It is possible that one of the registers we got for operands[2]
4703 might coincide with that of operands[0] (which is why we made
4704 it TImode). Pick the other one to use as our scratch. */
4705 if (REGNO (operands[0]) == REGNO (operands[2]))
4706 scratch = gen_rtx_REG (DImode, REGNO (operands[2]) + 1);
4708 scratch = gen_rtx_REG (DImode, REGNO (operands[2]));
4710 addr = get_unaligned_address (operands[1], 0);
4711 seq = gen_unaligned_loadqi (operands[0], addr, scratch,
4712 gen_rtx_REG (DImode, REGNO (operands[0])));
4713 alpha_set_memflags (seq, operands[1]);
4719 (define_expand "reload_inhi"
4720 [(parallel [(match_operand:HI 0 "register_operand" "=r")
4721 (match_operand:HI 1 "any_memory_operand" "m")
4722 (match_operand:TI 2 "register_operand" "=&r")])]
4728 if (GET_CODE (operands[1]) != MEM)
4731 if (aligned_memory_operand (operands[1], HImode))
4733 seq = gen_reload_inhi_help (operands[0], operands[1],
4734 gen_rtx_REG (SImode, REGNO (operands[2])));
4740 /* It is possible that one of the registers we got for operands[2]
4741 might coincide with that of operands[0] (which is why we made
4742 it TImode). Pick the other one to use as our scratch. */
4743 if (REGNO (operands[0]) == REGNO (operands[2]))
4744 scratch = gen_rtx_REG (DImode, REGNO (operands[2]) + 1);
4746 scratch = gen_rtx_REG (DImode, REGNO (operands[2]));
4748 addr = get_unaligned_address (operands[1], 0);
4749 seq = gen_unaligned_loadhi (operands[0], addr, scratch,
4750 gen_rtx_REG (DImode, REGNO (operands[0])));
4751 alpha_set_memflags (seq, operands[1]);
4757 (define_expand "reload_outqi"
4758 [(parallel [(match_operand:QI 0 "any_memory_operand" "=m")
4759 (match_operand:QI 1 "register_operand" "r")
4760 (match_operand:TI 2 "register_operand" "=&r")])]
4764 if (GET_CODE (operands[0]) != MEM)
4767 if (aligned_memory_operand (operands[0], QImode))
4769 emit_insn (gen_reload_outqi_help
4770 (operands[0], operands[1],
4771 gen_rtx_REG (SImode, REGNO (operands[2])),
4772 gen_rtx_REG (SImode, REGNO (operands[2]) + 1)));
4776 rtx addr = get_unaligned_address (operands[0], 0);
4777 rtx scratch1 = gen_rtx_REG (DImode, REGNO (operands[2]));
4778 rtx scratch2 = gen_rtx_REG (DImode, REGNO (operands[2]) + 1);
4779 rtx scratch3 = scratch1;
4782 if (GET_CODE (addr) == REG)
4785 seq = gen_unaligned_storeqi (addr, operands[1], scratch1,
4786 scratch2, scratch3);
4787 alpha_set_memflags (seq, operands[0]);
4793 (define_expand "reload_outhi"
4794 [(parallel [(match_operand:HI 0 "any_memory_operand" "=m")
4795 (match_operand:HI 1 "register_operand" "r")
4796 (match_operand:TI 2 "register_operand" "=&r")])]
4800 if (GET_CODE (operands[0]) != MEM)
4803 if (aligned_memory_operand (operands[0], HImode))
4805 emit_insn (gen_reload_outhi_help
4806 (operands[0], operands[1],
4807 gen_rtx_REG (SImode, REGNO (operands[2])),
4808 gen_rtx_REG (SImode, REGNO (operands[2]) + 1)));
4812 rtx addr = get_unaligned_address (operands[0], 0);
4813 rtx scratch1 = gen_rtx_REG (DImode, REGNO (operands[2]));
4814 rtx scratch2 = gen_rtx_REG (DImode, REGNO (operands[2]) + 1);
4815 rtx scratch3 = scratch1;
4818 if (GET_CODE (addr) == REG)
4821 seq = gen_unaligned_storehi (addr, operands[1], scratch1,
4822 scratch2, scratch3);
4823 alpha_set_memflags (seq, operands[0]);
4829 ;; Helpers for the above. The way reload is structured, we can't
4830 ;; always get a proper address for a stack slot during reload_foo
4831 ;; expansion, so we must delay our address manipulations until after.
4833 (define_insn "reload_inqi_help"
4834 [(set (match_operand:QI 0 "register_operand" "r")
4835 (match_operand:QI 1 "memory_operand" "m"))
4836 (clobber (match_operand:SI 2 "register_operand" "r"))]
4837 "! TARGET_BWX && (reload_in_progress || reload_completed)"
4840 (define_insn "reload_inhi_help"
4841 [(set (match_operand:HI 0 "register_operand" "r")
4842 (match_operand:HI 1 "memory_operand" "m"))
4843 (clobber (match_operand:SI 2 "register_operand" "r"))]
4844 "! TARGET_BWX && (reload_in_progress || reload_completed)"
4847 (define_insn "reload_outqi_help"
4848 [(set (match_operand:QI 0 "memory_operand" "m")
4849 (match_operand:QI 1 "register_operand" "r"))
4850 (clobber (match_operand:SI 2 "register_operand" "r"))
4851 (clobber (match_operand:SI 3 "register_operand" "r"))]
4852 "! TARGET_BWX && (reload_in_progress || reload_completed)"
4855 (define_insn "reload_outhi_help"
4856 [(set (match_operand:HI 0 "memory_operand" "m")
4857 (match_operand:HI 1 "register_operand" "r"))
4858 (clobber (match_operand:SI 2 "register_operand" "r"))
4859 (clobber (match_operand:SI 3 "register_operand" "r"))]
4860 "! TARGET_BWX && (reload_in_progress || reload_completed)"
4864 [(set (match_operand:QI 0 "register_operand" "r")
4865 (match_operand:QI 1 "memory_operand" "m"))
4866 (clobber (match_operand:SI 2 "register_operand" "r"))]
4867 "! TARGET_BWX && reload_completed"
4871 rtx aligned_mem, bitnum;
4872 get_aligned_mem (operands[1], &aligned_mem, &bitnum);
4873 emit_insn (gen_aligned_loadqi (operands[0], aligned_mem, bitnum,
4879 [(set (match_operand:HI 0 "register_operand" "r")
4880 (match_operand:HI 1 "memory_operand" "m"))
4881 (clobber (match_operand:SI 2 "register_operand" "r"))]
4882 "! TARGET_BWX && reload_completed"
4886 rtx aligned_mem, bitnum;
4887 get_aligned_mem (operands[1], &aligned_mem, &bitnum);
4888 emit_insn (gen_aligned_loadhi (operands[0], aligned_mem, bitnum,
4894 [(set (match_operand:QI 0 "memory_operand" "m")
4895 (match_operand:QI 1 "register_operand" "r"))
4896 (clobber (match_operand:SI 2 "register_operand" "r"))
4897 (clobber (match_operand:SI 3 "register_operand" "r"))]
4898 "! TARGET_BWX && reload_completed"
4902 rtx aligned_mem, bitnum;
4903 get_aligned_mem (operands[0], &aligned_mem, &bitnum);
4904 emit_insn (gen_aligned_store (aligned_mem, operands[1], bitnum,
4905 operands[2], operands[3]));
4910 [(set (match_operand:HI 0 "memory_operand" "m")
4911 (match_operand:HI 1 "register_operand" "r"))
4912 (clobber (match_operand:SI 2 "register_operand" "r"))
4913 (clobber (match_operand:SI 3 "register_operand" "r"))]
4914 "! TARGET_BWX && reload_completed"
4918 rtx aligned_mem, bitnum;
4919 get_aligned_mem (operands[0], &aligned_mem, &bitnum);
4920 emit_insn (gen_aligned_store (aligned_mem, operands[1], bitnum,
4921 operands[2], operands[3]));
4925 ;; Bit field extract patterns which use ext[wlq][lh]
4927 (define_expand "extv"
4928 [(set (match_operand:DI 0 "register_operand" "")
4929 (sign_extract:DI (match_operand:QI 1 "memory_operand" "")
4930 (match_operand:DI 2 "immediate_operand" "")
4931 (match_operand:DI 3 "immediate_operand" "")))]
4935 /* We can do 16, 32 and 64 bit fields, if aligned on byte boundaries. */
4936 if (INTVAL (operands[3]) % 8 != 0
4937 || (INTVAL (operands[2]) != 16
4938 && INTVAL (operands[2]) != 32
4939 && INTVAL (operands[2]) != 64))
4942 /* From mips.md: extract_bit_field doesn't verify that our source
4943 matches the predicate, so we force it to be a MEM here. */
4944 if (GET_CODE (operands[1]) != MEM)
4947 alpha_expand_unaligned_load (operands[0], operands[1],
4948 INTVAL (operands[2]) / 8,
4949 INTVAL (operands[3]) / 8, 1);
4953 (define_expand "extzv"
4954 [(set (match_operand:DI 0 "register_operand" "")
4955 (zero_extract:DI (match_operand:DI 1 "general_operand" "")
4956 (match_operand:DI 2 "immediate_operand" "")
4957 (match_operand:DI 3 "immediate_operand" "")))]
4961 /* We can do 8, 16, 32 and 64 bit fields, if aligned on byte boundaries. */
4962 if (INTVAL (operands[3]) % 8 != 0
4963 || (INTVAL (operands[2]) != 8
4964 && INTVAL (operands[2]) != 16
4965 && INTVAL (operands[2]) != 32
4966 && INTVAL (operands[2]) != 64))
4969 if (GET_CODE (operands[1]) == MEM)
4971 /* Fail 8 bit fields, falling back on a simple byte load. */
4972 if (INTVAL (operands[2]) == 8)
4975 alpha_expand_unaligned_load (operands[0], operands[1],
4976 INTVAL (operands[2]) / 8,
4977 INTVAL (operands[3]) / 8, 0);
4982 (define_expand "insv"
4983 [(set (zero_extract:DI (match_operand:QI 0 "memory_operand" "")
4984 (match_operand:DI 1 "immediate_operand" "")
4985 (match_operand:DI 2 "immediate_operand" ""))
4986 (match_operand:DI 3 "register_operand" ""))]
4990 /* We can do 16, 32 and 64 bit fields, if aligned on byte boundaries. */
4991 if (INTVAL (operands[2]) % 8 != 0
4992 || (INTVAL (operands[1]) != 16
4993 && INTVAL (operands[1]) != 32
4994 && INTVAL (operands[1]) != 64))
4997 /* From mips.md: store_bit_field doesn't verify that our source
4998 matches the predicate, so we force it to be a MEM here. */
4999 if (GET_CODE (operands[0]) != MEM)
5002 alpha_expand_unaligned_store (operands[0], operands[3],
5003 INTVAL (operands[1]) / 8,
5004 INTVAL (operands[2]) / 8);
5010 ;; Block move/clear, see alpha.c for more details.
5011 ;; Argument 0 is the destination
5012 ;; Argument 1 is the source
5013 ;; Argument 2 is the length
5014 ;; Argument 3 is the alignment
5016 (define_expand "movstrqi"
5017 [(parallel [(set (match_operand:BLK 0 "general_operand" "")
5018 (match_operand:BLK 1 "general_operand" ""))
5019 (use (match_operand:DI 2 "immediate_operand" ""))
5020 (use (match_operand:DI 3 "immediate_operand" ""))])]
5024 if (alpha_expand_block_move (operands))
5030 (define_expand "clrstrqi"
5031 [(parallel [(set (match_operand:BLK 0 "general_operand" "")
5033 (use (match_operand:DI 1 "immediate_operand" ""))
5034 (use (match_operand:DI 2 "immediate_operand" ""))])]
5038 if (alpha_expand_block_clear (operands))
5044 ;; Subroutine of stack space allocation. Perform a stack probe.
5045 (define_expand "probe_stack"
5046 [(set (match_dup 1) (match_operand:DI 0 "const_int_operand" ""))]
5050 operands[1] = gen_rtx_MEM (DImode, plus_constant (stack_pointer_rtx,
5051 INTVAL (operands[0])));
5052 MEM_VOLATILE_P (operands[1]) = 1;
5054 operands[0] = const0_rtx;
5057 ;; This is how we allocate stack space. If we are allocating a
5058 ;; constant amount of space and we know it is less than 4096
5059 ;; bytes, we need do nothing.
5061 ;; If it is more than 4096 bytes, we need to probe the stack
5063 (define_expand "allocate_stack"
5065 (plus:DI (reg:DI 30)
5066 (match_operand:DI 1 "reg_or_cint_operand" "")))
5067 (set (match_operand:DI 0 "register_operand" "=r")
5072 if (GET_CODE (operands[1]) == CONST_INT
5073 && INTVAL (operands[1]) < 32768)
5075 if (INTVAL (operands[1]) >= 4096)
5077 /* We do this the same way as in the prologue and generate explicit
5078 probes. Then we update the stack by the constant. */
5082 emit_insn (gen_probe_stack (GEN_INT (- probed)));
5083 while (probed + 8192 < INTVAL (operands[1]))
5084 emit_insn (gen_probe_stack (GEN_INT (- (probed += 8192))));
5086 if (probed + 4096 < INTVAL (operands[1]))
5087 emit_insn (gen_probe_stack (GEN_INT (- INTVAL(operands[1]))));
5090 operands[1] = GEN_INT (- INTVAL (operands[1]));
5091 operands[2] = virtual_stack_dynamic_rtx;
5096 rtx loop_label = gen_label_rtx ();
5097 rtx want = gen_reg_rtx (Pmode);
5098 rtx tmp = gen_reg_rtx (Pmode);
5101 emit_insn (gen_subdi3 (want, stack_pointer_rtx,
5102 force_reg (Pmode, operands[1])));
5103 emit_insn (gen_adddi3 (tmp, stack_pointer_rtx, GEN_INT (-4096)));
5105 if (GET_CODE (operands[1]) != CONST_INT)
5107 out_label = gen_label_rtx ();
5108 emit_insn (gen_cmpdi (want, tmp));
5109 emit_jump_insn (gen_bgeu (out_label));
5112 emit_label (loop_label);
5113 memref = gen_rtx_MEM (DImode, tmp);
5114 MEM_VOLATILE_P (memref) = 1;
5115 emit_move_insn (memref, const0_rtx);
5116 emit_insn (gen_adddi3 (tmp, tmp, GEN_INT(-8192)));
5117 emit_insn (gen_cmpdi (tmp, want));
5118 emit_jump_insn (gen_bgtu (loop_label));
5120 gen_rtx_USE (VOIDmode, tmp);
5122 memref = gen_rtx_MEM (DImode, want);
5123 MEM_VOLATILE_P (memref) = 1;
5124 emit_move_insn (memref, const0_rtx);
5127 emit_label (out_label);
5129 emit_move_insn (stack_pointer_rtx, want);
5130 emit_move_insn (operands[0], virtual_stack_dynamic_rtx);
5135 ;; This is used by alpha_expand_prolog to do the same thing as above,
5136 ;; except we cannot at that time generate new basic blocks, so we hide
5137 ;; the loop in this one insn.
5139 (define_insn "prologue_stack_probe_loop"
5140 [(unspec_volatile [(match_operand 0 "register_operand" "r")
5141 (match_operand 1 "register_operand" "r")] 5)]
5145 operands[2] = gen_label_rtx ();
5146 ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, \"L\",
5147 CODE_LABEL_NUMBER (operands[2]));
5149 return \"stq $31,-8192(%1)\;subq %0,1,%0\;lda %1,-8192(%1)\;bne %0,%l2\";
5151 [(set_attr "length" "16")
5152 (set_attr "type" "multi")])
5154 (define_expand "prologue"
5155 [(clobber (const_int 0))]
5157 "alpha_expand_prologue (); DONE;")
5159 (define_insn "init_fp"
5160 [(set (match_operand:DI 0 "register_operand" "r")
5161 (match_operand:DI 1 "register_operand" "r"))
5162 (clobber (mem:BLK (match_operand:DI 2 "register_operand" "r")))]
5166 (define_expand "epilogue"
5167 [(clobber (const_int 0))]
5169 "alpha_expand_epilogue (); DONE;")
5171 (define_expand "eh_epilogue"
5172 [(use (match_operand:DI 0 "register_operand" "r"))
5173 (use (match_operand:DI 1 "register_operand" "r"))
5174 (use (match_operand:DI 2 "register_operand" "r"))]
5178 current_function->machine->eh_epilogue_sp_ofs = operands[1];
5179 if (GET_CODE (operands[2]) != REG || REGNO (operands[2]) != 26)
5181 rtx ra = gen_rtx_REG (Pmode, 26);
5182 emit_move_insn (ra, operands[2]);
5187 ;; In creating a large stack frame, NT _must_ use ldah+lda to load
5188 ;; the frame size into a register. We use this pattern to ensure
5189 ;; we get lda instead of addq.
5190 (define_insn "nt_lda"
5191 [(set (match_operand:DI 0 "register_operand" "r")
5192 (unspec:DI [(match_dup 0)
5193 (match_operand:DI 1 "const_int_operand" "n")] 6))]
5197 (define_expand "builtin_longjmp"
5198 [(unspec_volatile [(match_operand 0 "register_operand" "r")] 3)]
5199 "! TARGET_OPEN_VMS && ! TARGET_WINDOWS_NT"
5202 /* The elements of the buffer are, in order: */
5203 rtx fp = gen_rtx_MEM (Pmode, operands[0]);
5204 rtx lab = gen_rtx_MEM (Pmode, plus_constant (operands[0], 8));
5205 rtx stack = gen_rtx_MEM (Pmode, plus_constant (operands[0], 16));
5206 rtx pv = gen_rtx_REG (Pmode, 27);
5208 /* This bit is the same as expand_builtin_longjmp. */
5209 emit_move_insn (hard_frame_pointer_rtx, fp);
5210 emit_move_insn (pv, lab);
5211 emit_stack_restore (SAVE_NONLOCAL, stack, NULL_RTX);
5212 emit_insn (gen_rtx_USE (VOIDmode, hard_frame_pointer_rtx));
5213 emit_insn (gen_rtx_USE (VOIDmode, stack_pointer_rtx));
5215 /* Load the label we are jumping through into $27 so that we know
5216 where to look for it when we get back to setjmp's function for
5217 restoring the gp. */
5218 emit_indirect_jump (pv);
5222 (define_insn "builtin_setjmp_receiver"
5223 [(unspec_volatile [(label_ref (match_operand 0 "" ""))] 2)]
5224 "! TARGET_OPEN_VMS && ! TARGET_WINDOWS_NT && TARGET_AS_CAN_SUBTRACT_LABELS"
5225 "\\n$LSJ%=:\;ldgp $29,$LSJ%=-%l0($27)"
5226 [(set_attr "length" "8")
5227 (set_attr "type" "multi")])
5230 [(unspec_volatile [(label_ref (match_operand 0 "" ""))] 2)]
5231 "! TARGET_OPEN_VMS && ! TARGET_WINDOWS_NT"
5232 "br $29,$LSJ%=\\n$LSJ%=:\;ldgp $29,0($29)"
5233 [(set_attr "length" "12")
5234 (set_attr "type" "multi")])
5236 (define_insn "exception_receiver"
5237 [(unspec_volatile [(const_int 0)] 7)]
5238 "! TARGET_OPEN_VMS && ! TARGET_WINDOWS_NT"
5239 "br $29,$LSJ%=\\n$LSJ%=:\;ldgp $29,0($29)"
5240 [(set_attr "length" "12")
5241 (set_attr "type" "multi")])
5243 (define_expand "nonlocal_goto_receiver"
5244 [(unspec_volatile [(const_int 0)] 1)
5245 (set (reg:DI 27) (mem:DI (reg:DI 29)))
5246 (unspec_volatile [(const_int 0)] 1)
5251 (define_insn "arg_home"
5252 [(unspec [(const_int 0)] 0)
5267 (clobber (mem:BLK (const_int 0)))
5268 (clobber (reg:DI 24))
5269 (clobber (reg:DI 25))
5270 (clobber (reg:DI 0))]
5272 "lda $0,OTS$HOME_ARGS\;ldq $0,8($0)\;jsr $0,OTS$HOME_ARGS"
5273 [(set_attr "length" "16")
5274 (set_attr "type" "multi")])
5276 ;; Close the trap shadow of preceeding instructions. This is generated
5279 (define_insn "trapb"
5280 [(unspec_volatile [(const_int 0)] 4)]
5283 [(set_attr "type" "misc")])
5285 ;; No-op instructions used by machine-dependant reorg to preserve
5286 ;; alignment for instruction issue.
5292 [(set_attr "type" "ilog")])
5298 [(set_attr "type" "fcpys")])
5305 (define_insn "realign"
5306 [(unspec_volatile [(match_operand 0 "immediate_operand" "i")] 6)]
5308 ".align %0 #realign")
5310 ;; Peepholes go at the end.
5312 ;; Optimize sign-extension of SImode loads. This shows up in the wake of
5313 ;; reload when converting fp->int.
5315 ;; ??? What to do now that we actually care about the packing and
5316 ;; alignment of instructions? Perhaps reload can be enlightened, or
5317 ;; the peephole pass moved up after reload but before sched2?
5320 ; [(set (match_operand:SI 0 "register_operand" "=r")
5321 ; (match_operand:SI 1 "memory_operand" "m"))
5322 ; (set (match_operand:DI 2 "register_operand" "=r")
5323 ; (sign_extend:DI (match_dup 0)))]
5324 ; "dead_or_set_p (insn, operands[0])"
5328 ; [(set (match_operand:SI 0 "register_operand" "=r")
5329 ; (match_operand:SI 1 "hard_fp_register_operand" "f"))
5330 ; (set (match_operand:DI 2 "register_operand" "=r")
5331 ; (sign_extend:DI (match_dup 0)))]
5332 ; "TARGET_FIX && dead_or_set_p (insn, operands[0])"