1 ;; Machine description for DEC Alpha for GNU C compiler
2 ;; Copyright (C) 1992, 93, 94, 95, 96, 97, 1998 Free Software Foundation, Inc.
3 ;; Contributed by Richard Kenner (kenner@vlsi1.ultra.nyu.edu)
5 ;; This file is part of GNU CC.
7 ;; GNU CC is free software; you can redistribute it and/or modify
8 ;; it under the terms of the GNU General Public License as published by
9 ;; the Free Software Foundation; either version 2, or (at your option)
12 ;; GNU CC is distributed in the hope that it will be useful,
13 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
14 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 ;; GNU General Public License for more details.
17 ;; You should have received a copy of the GNU General Public License
18 ;; along with GNU CC; see the file COPYING. If not, write to
19 ;; the Free Software Foundation, 59 Temple Place - Suite 330,
20 ;; Boston, MA 02111-1307, USA.
22 ;;- See file "rtl.def" for documentation on define_insn, match_*, et. al.
24 ;; Uses of UNSPEC in this file:
37 ;; 2 builtin_setjmp_receiver
40 ;; 5 prologue_stack_probe_loop
43 ;; Processor type -- this attribute must exactly match the processor_type
44 ;; enumeration in alpha.h.
46 (define_attr "cpu" "ev4,ev5,ev6"
47 (const (symbol_ref "alpha_cpu")))
49 ;; Define an insn type attribute. This is used in function unit delay
50 ;; computations, among other purposes. For the most part, we use the names
51 ;; defined in the EV4 documentation, but add a few that we have to know about
55 "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"
56 (const_string "iadd"))
58 ;; Describe a user's asm statement.
59 (define_asm_attributes
60 [(set_attr "type" "multi")])
62 ;; Define the operand size an insn operates on. Used primarily by mul
63 ;; and div operations that have size dependant timings.
65 (define_attr "opsize" "si,di,udi" (const_string "di"))
67 ;; The TRAP_TYPE attribute marks instructions that may generate traps
68 ;; (which are imprecise and may need a trapb if software completion
71 (define_attr "trap" "no,yes" (const_string "no"))
73 ;; The length of an instruction sequence in bytes.
75 (define_attr "length" "" (const_int 4))
77 ;; On EV4 there are two classes of resources to consider: resources needed
78 ;; to issue, and resources needed to execute. IBUS[01] are in the first
79 ;; category. ABOX, BBOX, EBOX, FBOX, IMUL & FDIV make up the second.
80 ;; (There are a few other register-like resources, but ...)
82 ; First, describe all of the issue constraints with single cycle delays.
83 ; All insns need a bus, but all except loads require one or the other.
84 (define_function_unit "ev4_ibus0" 1 0
85 (and (eq_attr "cpu" "ev4")
86 (eq_attr "type" "fst,fbr,iadd,imul,ilog,shift,icmov,icmp"))
89 (define_function_unit "ev4_ibus1" 1 0
90 (and (eq_attr "cpu" "ev4")
91 (eq_attr "type" "ist,ibr,jsr,fadd,fcmov,fcpys,fmul,fdiv,misc"))
94 ; Memory delivers its result in three cycles. Actually return one and
95 ; take care of this in adjust_cost, since we want to handle user-defined
97 (define_function_unit "ev4_abox" 1 0
98 (and (eq_attr "cpu" "ev4")
99 (eq_attr "type" "ild,fld,ldsym,ist,fst"))
102 ; Branches have no delay cost, but do tie up the unit for two cycles.
103 (define_function_unit "ev4_bbox" 1 1
104 (and (eq_attr "cpu" "ev4")
105 (eq_attr "type" "ibr,fbr,jsr"))
108 ; Arithmetic insns are normally have their results available after
109 ; two cycles. There are a number of exceptions. They are encoded in
110 ; ADJUST_COST. Some of the other insns have similar exceptions.
111 (define_function_unit "ev4_ebox" 1 0
112 (and (eq_attr "cpu" "ev4")
113 (eq_attr "type" "iadd,ilog,shift,icmov,icmp,misc"))
116 (define_function_unit "imul" 1 0
117 (and (eq_attr "cpu" "ev4")
118 (and (eq_attr "type" "imul")
119 (eq_attr "opsize" "si")))
122 (define_function_unit "imul" 1 0
123 (and (eq_attr "cpu" "ev4")
124 (and (eq_attr "type" "imul")
125 (eq_attr "opsize" "!si")))
128 (define_function_unit "ev4_fbox" 1 0
129 (and (eq_attr "cpu" "ev4")
130 (eq_attr "type" "fadd,fmul,fcpys,fcmov"))
133 (define_function_unit "fdiv" 1 0
134 (and (eq_attr "cpu" "ev4")
135 (and (eq_attr "type" "fdiv")
136 (eq_attr "opsize" "si")))
139 (define_function_unit "fdiv" 1 0
140 (and (eq_attr "cpu" "ev4")
141 (and (eq_attr "type" "fdiv")
142 (eq_attr "opsize" "di")))
145 ;; EV5 scheduling. EV5 can issue 4 insns per clock.
147 ;; EV5 has two asymetric integer units. Model this with E0 & E1 along
148 ;; with the combined resource EBOX.
150 (define_function_unit "ev5_ebox" 2 0
151 (and (eq_attr "cpu" "ev5")
152 (eq_attr "type" "!fbr,fcmov,fadd,fmul,fcpys,fdiv"))
155 ; Memory takes at least 2 clocks. Return one from here and fix up with
156 ; user-defined latencies in adjust_cost.
157 ; ??? How to: "An instruction of class LD cannot be issued in the _second_
158 ; cycle after an instruction of class ST is issued."
159 (define_function_unit "ev5_ebox" 2 0
160 (and (eq_attr "cpu" "ev5")
161 (eq_attr "type" "ild,fld,ldsym"))
164 ; Stores, shifts, multiplies can only issue to E0
165 (define_function_unit "ev5_e0" 1 0
166 (and (eq_attr "cpu" "ev5")
167 (eq_attr "type" "ist,fst,shift,imul"))
170 ; Motion video insns also issue only to E0, and take two ticks.
171 (define_function_unit "ev5_e0" 1 0
172 (and (eq_attr "cpu" "ev5")
173 (eq_attr "type" "mvi"))
176 ; Conditional moves always take 2 ticks.
177 (define_function_unit "ev5_ebox" 2 0
178 (and (eq_attr "cpu" "ev5")
179 (eq_attr "type" "icmov"))
182 ; Branches can only issue to E1
183 (define_function_unit "ev5_e1" 1 0
184 (and (eq_attr "cpu" "ev5")
185 (eq_attr "type" "ibr,jsr"))
188 ; Multiplies also use the integer multiplier.
189 ; ??? How to: "No instruction can be issued to pipe E0 exactly two
190 ; cycles before an integer multiplication completes."
191 (define_function_unit "imul" 1 0
192 (and (eq_attr "cpu" "ev5")
193 (and (eq_attr "type" "imul")
194 (eq_attr "opsize" "si")))
197 (define_function_unit "imul" 1 0
198 (and (eq_attr "cpu" "ev5")
199 (and (eq_attr "type" "imul")
200 (eq_attr "opsize" "di")))
203 (define_function_unit "imul" 1 0
204 (and (eq_attr "cpu" "ev5")
205 (and (eq_attr "type" "imul")
206 (eq_attr "opsize" "udi")))
209 ;; Similarly for the FPU we have two asymetric units. But fcpys can issue
210 ;; on either so we have to play the game again.
212 (define_function_unit "ev5_fbox" 2 0
213 (and (eq_attr "cpu" "ev5")
214 (eq_attr "type" "fadd,fcmov,fmul,fcpys,fbr,fdiv"))
217 (define_function_unit "ev5_fm" 1 0
218 (and (eq_attr "cpu" "ev5")
219 (eq_attr "type" "fmul"))
222 ; Add and cmov as you would expect; fbr never produces a result;
223 ; fdiv issues through fa to the divider,
224 (define_function_unit "ev5_fa" 1 0
225 (and (eq_attr "cpu" "ev5")
226 (eq_attr "type" "fadd,fcmov,fbr,fdiv"))
229 ; ??? How to: "No instruction can be issued to pipe FA exactly five
230 ; cycles before a floating point divide completes."
231 (define_function_unit "fdiv" 1 0
232 (and (eq_attr "cpu" "ev5")
233 (and (eq_attr "type" "fdiv")
234 (eq_attr "opsize" "si")))
235 15 15) ; 15 to 31 data dependant
237 (define_function_unit "fdiv" 1 0
238 (and (eq_attr "cpu" "ev5")
239 (and (eq_attr "type" "fdiv")
240 (eq_attr "opsize" "di")))
241 22 22) ; 22 to 60 data dependant
243 ;; EV6 scheduling. EV6 can issue 4 insns per clock.
245 ;; EV6 has two symmetric pairs ("clusters") of two asymetric integer units
246 ;; ("upper" and "lower"), yielding pipe names U0, U1, L0, L1.
248 ;; Conditional moves decompose into two independant primitives, each
249 ;; taking one cycle. Since ev6 is out-of-order, we can't see anything
251 (define_function_unit "ev6_ebox" 4 0
252 (and (eq_attr "cpu" "ev6")
253 (eq_attr "type" "icmov"))
256 (define_function_unit "ev6_ebox" 4 0
257 (and (eq_attr "cpu" "ev6")
258 (eq_attr "type" "!fbr,fcmov,fadd,fmul,fcpys,fdiv,fsqrt"))
261 ;; Integer loads take at least 3 clocks, and only issue to lower units.
262 ;; Return one from here and fix up with user-defined latencies in adjust_cost.
263 (define_function_unit "ev6_l" 2 0
264 (and (eq_attr "cpu" "ev6")
265 (eq_attr "type" "ild,ldsym,ist,fst"))
268 ;; FP loads take at least 4 clocks. Return two from here...
269 (define_function_unit "ev6_l" 2 0
270 (and (eq_attr "cpu" "ev6")
271 (eq_attr "type" "fld"))
274 ;; Motion video insns also issue only to U0, and take three ticks.
275 (define_function_unit "ev6_u0" 1 0
276 (and (eq_attr "cpu" "ev6")
277 (eq_attr "type" "mvi"))
280 (define_function_unit "ev6_u" 2 0
281 (and (eq_attr "cpu" "ev6")
282 (eq_attr "type" "mvi"))
285 ;; Shifts issue to either upper pipe.
286 (define_function_unit "ev6_u" 2 0
287 (and (eq_attr "cpu" "ev6")
288 (eq_attr "type" "shift"))
291 ;; Multiplies issue only to U1, and all take 7 ticks.
292 ;; Rather than create a new function unit just for U1, reuse IMUL
293 (define_function_unit "imul" 1 0
294 (and (eq_attr "cpu" "ev6")
295 (eq_attr "type" "imul"))
298 (define_function_unit "ev6_u" 2 0
299 (and (eq_attr "cpu" "ev6")
300 (eq_attr "type" "imul"))
303 ;; Branches issue to either upper pipe
304 (define_function_unit "ev6_u" 2 0
305 (and (eq_attr "cpu" "ev6")
306 (eq_attr "type" "ibr"))
309 ;; Calls only issue to L0.
310 (define_function_unit "ev6_l0" 1 0
311 (and (eq_attr "cpu" "ev6")
312 (eq_attr "type" "jsr"))
315 (define_function_unit "ev6_l" 2 0
316 (and (eq_attr "cpu" "ev6")
317 (eq_attr "type" "jsr"))
320 ;; Ftoi/itof only issue to lower pipes
321 (define_function_unit "ev6_l" 2 0
322 (and (eq_attr "cpu" "ev6")
323 (eq_attr "type" "ftoi"))
326 (define_function_unit "ev6_l" 2 0
327 (and (eq_attr "cpu" "ev6")
328 (eq_attr "type" "itof"))
331 ;; For the FPU we are very similar to EV5, except there's no insn that
332 ;; can issue to fm & fa, so we get to leave that out.
334 (define_function_unit "ev6_fm" 1 0
335 (and (eq_attr "cpu" "ev6")
336 (eq_attr "type" "fmul"))
339 (define_function_unit "ev6_fa" 1 0
340 (and (eq_attr "cpu" "ev6")
341 (eq_attr "type" "fadd,fcpys,fbr,fdiv,fsqrt"))
344 (define_function_unit "ev6_fa" 1 0
345 (and (eq_attr "cpu" "ev6")
346 (eq_attr "type" "fcmov"))
349 (define_function_unit "fdiv" 1 0
350 (and (eq_attr "cpu" "ev6")
351 (and (eq_attr "type" "fdiv")
352 (eq_attr "opsize" "si")))
355 (define_function_unit "fdiv" 1 0
356 (and (eq_attr "cpu" "ev6")
357 (and (eq_attr "type" "fdiv")
358 (eq_attr "opsize" "di")))
361 (define_function_unit "fsqrt" 1 0
362 (and (eq_attr "cpu" "ev6")
363 (and (eq_attr "type" "fsqrt")
364 (eq_attr "opsize" "si")))
367 (define_function_unit "fsqrt" 1 0
368 (and (eq_attr "cpu" "ev6")
369 (and (eq_attr "type" "fsqrt")
370 (eq_attr "opsize" "di")))
373 ; ??? The FPU communicates with memory and the integer register file
374 ; via two fp store units. We need a slot in the fst immediately, and
375 ; a slot in LOW after the operand data is ready. At which point the
376 ; data may be moved either to the store queue or the integer register
377 ; file and the insn retired.
380 ;; First define the arithmetic insns. Note that the 32-bit forms also
383 ;; Handle 32-64 bit extension from memory to a floating point register
384 ;; specially, since this ocurrs frequently in int->double conversions.
385 ;; This is done with a define_split after reload converting the plain
386 ;; sign-extension into a load+unspec, which of course results in lds+cvtlq.
388 ;; Note that while we must retain the =f case in the insn for reload's
389 ;; benefit, it should be eliminated after reload, so we should never emit
390 ;; code for that case. But we don't reject the possibility.
392 (define_insn "extendsidi2"
393 [(set (match_operand:DI 0 "register_operand" "=r,r,?f")
394 (sign_extend:DI (match_operand:SI 1 "nonimmediate_operand" "r,m,m")))]
399 lds %0,%1\;cvtlq %0,%0"
400 [(set_attr "type" "iadd,ild,fld")
401 (set_attr "length" "*,*,8")])
403 ;; Due to issues with CLASS_CANNOT_CHANGE_SIZE, we cannot use a subreg here.
405 [(set (match_operand:DI 0 "hard_fp_register_operand" "")
406 (sign_extend:DI (match_operand:SI 1 "memory_operand" "")))]
408 [(set (match_dup 2) (match_dup 1))
409 (set (match_dup 0) (unspec:DI [(match_dup 2)] 4))]
410 "operands[2] = gen_rtx_REG (SImode, REGNO (operands[0]));")
413 [(set (match_operand:DI 0 "register_operand" "=f")
414 (unspec:DI [(match_operand:SI 1 "register_operand" "f")] 4))]
417 [(set_attr "type" "fadd")])
419 ;; Do addsi3 the way expand_binop would do if we didn't have one. This
420 ;; generates better code. We have the anonymous addsi3 pattern below in
421 ;; case combine wants to make it.
422 (define_expand "addsi3"
423 [(set (match_operand:SI 0 "register_operand" "")
424 (plus:SI (match_operand:SI 1 "reg_or_0_operand" "")
425 (match_operand:SI 2 "add_operand" "")))]
428 { emit_insn (gen_rtx_SET (VOIDmode, gen_lowpart (DImode, operands[0]),
429 gen_rtx_PLUS (DImode,
430 gen_lowpart (DImode, operands[1]),
431 gen_lowpart (DImode, operands[2]))));
436 [(set (match_operand:SI 0 "register_operand" "=r,r,r,r")
437 (plus:SI (match_operand:SI 1 "reg_or_0_operand" "%rJ,rJ,rJ,rJ")
438 (match_operand:SI 2 "add_operand" "rI,O,K,L")))]
447 [(set (match_operand:SI 0 "register_operand" "")
448 (plus:SI (match_operand:SI 1 "register_operand" "")
449 (match_operand:SI 2 "const_int_operand" "")))]
450 "! add_operand (operands[2], SImode)"
451 [(set (match_dup 0) (plus:SI (match_dup 1) (match_dup 3)))
452 (set (match_dup 0) (plus:SI (match_dup 0) (match_dup 4)))]
455 HOST_WIDE_INT val = INTVAL (operands[2]);
456 HOST_WIDE_INT low = (val & 0xffff) - 2 * (val & 0x8000);
457 HOST_WIDE_INT rest = val - low;
459 operands[3] = GEN_INT (rest);
460 operands[4] = GEN_INT (low);
464 [(set (match_operand:DI 0 "register_operand" "=r,r")
466 (plus:SI (match_operand:SI 1 "reg_or_0_operand" "%rJ,rJ")
467 (match_operand:SI 2 "sext_add_operand" "rI,O"))))]
474 [(set (match_operand:DI 0 "register_operand" "")
476 (plus:SI (match_operand:SI 1 "register_operand" "")
477 (match_operand:SI 2 "const_int_operand" ""))))
478 (clobber (match_operand:SI 3 "register_operand" ""))]
479 "! sext_add_operand (operands[2], SImode) && INTVAL (operands[2]) > 0
480 && INTVAL (operands[2]) % 4 == 0"
481 [(set (match_dup 3) (match_dup 4))
482 (set (match_dup 0) (sign_extend:DI (plus:SI (mult:SI (match_dup 3)
487 HOST_WIDE_INT val = INTVAL (operands[2]) / 4;
493 operands[4] = GEN_INT (val);
494 operands[5] = GEN_INT (mult);
498 [(set (match_operand:DI 0 "register_operand" "")
500 (plus:SI (match_operator:SI 1 "comparison_operator"
501 [(match_operand 2 "" "")
502 (match_operand 3 "" "")])
503 (match_operand:SI 4 "add_operand" ""))))
504 (clobber (match_operand:DI 5 "register_operand" ""))]
506 [(set (match_dup 5) (match_dup 6))
507 (set (match_dup 0) (sign_extend:DI (plus:SI (match_dup 7) (match_dup 4))))]
510 operands[6] = gen_rtx_fmt_ee (GET_CODE (operands[1]), DImode,
511 operands[2], operands[3]);
512 operands[7] = gen_lowpart (SImode, operands[5]);
515 (define_insn "adddi3"
516 [(set (match_operand:DI 0 "register_operand" "=r,r,r,r")
517 (plus:DI (match_operand:DI 1 "reg_or_0_operand" "%rJ,rJ,rJ,rJ")
518 (match_operand:DI 2 "add_operand" "rI,O,K,L")))]
526 ;; Don't do this if we are adjusting SP since we don't want to do
529 [(set (match_operand:DI 0 "register_operand" "")
530 (plus:DI (match_operand:DI 1 "register_operand" "")
531 (match_operand:DI 2 "const_int_operand" "")))]
532 "! add_operand (operands[2], DImode)
533 && REGNO (operands[0]) != STACK_POINTER_REGNUM"
534 [(set (match_dup 0) (plus:DI (match_dup 1) (match_dup 3)))
535 (set (match_dup 0) (plus:DI (match_dup 0) (match_dup 4)))]
538 HOST_WIDE_INT val = INTVAL (operands[2]);
539 HOST_WIDE_INT low = (val & 0xffff) - 2 * (val & 0x8000);
540 HOST_WIDE_INT rest = val - low;
542 operands[3] = GEN_INT (rest);
543 operands[4] = GEN_INT (low);
547 [(set (match_operand:SI 0 "register_operand" "=r,r")
548 (plus:SI (mult:SI (match_operand:SI 1 "reg_or_0_operand" "rJ,rJ")
549 (match_operand:SI 2 "const48_operand" "I,I"))
550 (match_operand:SI 3 "sext_add_operand" "rI,O")))]
557 [(set (match_operand:DI 0 "register_operand" "=r,r")
559 (plus:SI (mult:SI (match_operand:SI 1 "reg_or_0_operand" "rJ,rJ")
560 (match_operand:SI 2 "const48_operand" "I,I"))
561 (match_operand:SI 3 "sext_add_operand" "rI,O"))))]
568 [(set (match_operand:DI 0 "register_operand" "")
570 (plus:SI (mult:SI (match_operator:SI 1 "comparison_operator"
571 [(match_operand 2 "" "")
572 (match_operand 3 "" "")])
573 (match_operand:SI 4 "const48_operand" ""))
574 (match_operand:SI 5 "add_operand" ""))))
575 (clobber (match_operand:DI 6 "register_operand" ""))]
577 [(set (match_dup 6) (match_dup 7))
579 (sign_extend:DI (plus:SI (mult:SI (match_dup 8) (match_dup 4))
583 operands[7] = gen_rtx_fmt_ee (GET_CODE (operands[1]), DImode,
584 operands[2], operands[3]);
585 operands[8] = gen_lowpart (SImode, operands[6]);
589 [(set (match_operand:DI 0 "register_operand" "=r,r")
590 (plus:DI (mult:DI (match_operand:DI 1 "reg_or_0_operand" "rJ,rJ")
591 (match_operand:DI 2 "const48_operand" "I,I"))
592 (match_operand:DI 3 "reg_or_8bit_operand" "rI,O")))]
598 ;; These variants of the above insns can occur if the third operand
599 ;; is the frame pointer. This is a kludge, but there doesn't
600 ;; seem to be a way around it. Only recognize them while reloading.
603 [(set (match_operand:DI 0 "some_operand" "=&r")
604 (plus:DI (plus:DI (match_operand:DI 1 "some_operand" "r")
605 (match_operand:DI 2 "some_operand" "r"))
606 (match_operand:DI 3 "some_operand" "rIOKL")))]
611 [(set (match_operand:DI 0 "register_operand" "")
612 (plus:DI (plus:DI (match_operand:DI 1 "register_operand" "")
613 (match_operand:DI 2 "register_operand" ""))
614 (match_operand:DI 3 "add_operand" "")))]
616 [(set (match_dup 0) (plus:DI (match_dup 1) (match_dup 2)))
617 (set (match_dup 0) (plus:DI (match_dup 0) (match_dup 3)))]
621 [(set (match_operand:SI 0 "some_operand" "=&r")
622 (plus:SI (plus:SI (mult:SI (match_operand:SI 1 "some_operand" "rJ")
623 (match_operand:SI 2 "const48_operand" "I"))
624 (match_operand:SI 3 "some_operand" "r"))
625 (match_operand:SI 4 "some_operand" "rIOKL")))]
630 [(set (match_operand:SI 0 "register_operand" "r")
631 (plus:SI (plus:SI (mult:SI (match_operand:SI 1 "reg_or_0_operand" "")
632 (match_operand:SI 2 "const48_operand" ""))
633 (match_operand:SI 3 "register_operand" ""))
634 (match_operand:SI 4 "add_operand" "rIOKL")))]
637 (plus:SI (mult:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
638 (set (match_dup 0) (plus:SI (match_dup 0) (match_dup 4)))]
642 [(set (match_operand:DI 0 "some_operand" "=&r")
645 (mult:SI (match_operand:SI 1 "some_operand" "rJ")
646 (match_operand:SI 2 "const48_operand" "I"))
647 (match_operand:SI 3 "some_operand" "r"))
648 (match_operand:SI 4 "some_operand" "rIOKL"))))]
653 [(set (match_operand:DI 0 "register_operand" "")
656 (mult:SI (match_operand:SI 1 "reg_or_0_operand" "")
657 (match_operand:SI 2 "const48_operand" ""))
658 (match_operand:SI 3 "register_operand" ""))
659 (match_operand:SI 4 "add_operand" ""))))]
662 (plus:SI (mult:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
663 (set (match_dup 0) (sign_extend:DI (plus:SI (match_dup 5) (match_dup 4))))]
665 { operands[5] = gen_lowpart (SImode, operands[0]);
669 [(set (match_operand:DI 0 "some_operand" "=&r")
670 (plus:DI (plus:DI (mult:DI (match_operand:DI 1 "some_operand" "rJ")
671 (match_operand:DI 2 "const48_operand" "I"))
672 (match_operand:DI 3 "some_operand" "r"))
673 (match_operand:DI 4 "some_operand" "rIOKL")))]
678 [(set (match_operand:DI 0 "register_operand" "=")
679 (plus:DI (plus:DI (mult:DI (match_operand:DI 1 "reg_or_0_operand" "")
680 (match_operand:DI 2 "const48_operand" ""))
681 (match_operand:DI 3 "register_operand" ""))
682 (match_operand:DI 4 "add_operand" "")))]
685 (plus:DI (mult:DI (match_dup 1) (match_dup 2)) (match_dup 3)))
686 (set (match_dup 0) (plus:DI (match_dup 0) (match_dup 4)))]
689 (define_insn "negsi2"
690 [(set (match_operand:SI 0 "register_operand" "=r")
691 (neg:SI (match_operand:SI 1 "reg_or_8bit_operand" "rI")))]
696 [(set (match_operand:DI 0 "register_operand" "=r")
697 (sign_extend:DI (neg:SI
698 (match_operand:SI 1 "reg_or_8bit_operand" "rI"))))]
702 (define_insn "negdi2"
703 [(set (match_operand:DI 0 "register_operand" "=r")
704 (neg:DI (match_operand:DI 1 "reg_or_8bit_operand" "rI")))]
708 (define_expand "subsi3"
709 [(set (match_operand:SI 0 "register_operand" "")
710 (minus:SI (match_operand:SI 1 "reg_or_0_operand" "")
711 (match_operand:SI 2 "reg_or_8bit_operand" "")))]
714 { emit_insn (gen_rtx_SET (VOIDmode, gen_lowpart (DImode, operands[0]),
715 gen_rtx_MINUS (DImode,
716 gen_lowpart (DImode, operands[1]),
717 gen_lowpart (DImode, operands[2]))));
722 [(set (match_operand:SI 0 "register_operand" "=r")
723 (minus:SI (match_operand:SI 1 "reg_or_0_operand" "rJ")
724 (match_operand:SI 2 "reg_or_8bit_operand" "rI")))]
729 [(set (match_operand:DI 0 "register_operand" "=r")
730 (sign_extend:DI (minus:SI (match_operand:SI 1 "reg_or_0_operand" "rJ")
731 (match_operand:SI 2 "reg_or_8bit_operand" "rI"))))]
735 (define_insn "subdi3"
736 [(set (match_operand:DI 0 "register_operand" "=r")
737 (minus:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
738 (match_operand:DI 2 "reg_or_8bit_operand" "rI")))]
743 [(set (match_operand:SI 0 "register_operand" "=r")
744 (minus:SI (mult:SI (match_operand:SI 1 "reg_or_0_operand" "rJ")
745 (match_operand:SI 2 "const48_operand" "I"))
746 (match_operand:SI 3 "reg_or_8bit_operand" "rI")))]
751 [(set (match_operand:DI 0 "register_operand" "=r")
753 (minus:SI (mult:SI (match_operand:SI 1 "reg_or_0_operand" "rJ")
754 (match_operand:SI 2 "const48_operand" "I"))
755 (match_operand:SI 3 "reg_or_8bit_operand" "rI"))))]
760 [(set (match_operand:DI 0 "register_operand" "=r")
761 (minus:DI (mult:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
762 (match_operand:DI 2 "const48_operand" "I"))
763 (match_operand:DI 3 "reg_or_8bit_operand" "rI")))]
767 (define_insn "mulsi3"
768 [(set (match_operand:SI 0 "register_operand" "=r")
769 (mult:SI (match_operand:SI 1 "reg_or_0_operand" "%rJ")
770 (match_operand:SI 2 "reg_or_0_operand" "rJ")))]
773 [(set_attr "type" "imul")
774 (set_attr "opsize" "si")])
777 [(set (match_operand:DI 0 "register_operand" "=r")
778 (sign_extend:DI (mult:SI (match_operand:SI 1 "reg_or_0_operand" "%rJ")
779 (match_operand:SI 2 "reg_or_0_operand" "rJ"))))]
782 [(set_attr "type" "imul")
783 (set_attr "opsize" "si")])
785 (define_insn "muldi3"
786 [(set (match_operand:DI 0 "register_operand" "=r")
787 (mult:DI (match_operand:DI 1 "reg_or_0_operand" "%rJ")
788 (match_operand:DI 2 "reg_or_0_operand" "rJ")))]
791 [(set_attr "type" "imul")])
793 (define_insn "umuldi3_highpart"
794 [(set (match_operand:DI 0 "register_operand" "=r")
797 (mult:TI (zero_extend:TI (match_operand:DI 1 "register_operand" "r"))
798 (zero_extend:TI (match_operand:DI 2 "register_operand" "r")))
802 [(set_attr "type" "imul")
803 (set_attr "opsize" "udi")])
806 [(set (match_operand:DI 0 "register_operand" "=r")
809 (mult:TI (zero_extend:TI (match_operand:DI 1 "register_operand" "r"))
810 (match_operand:TI 2 "cint8_operand" "I"))
814 [(set_attr "type" "imul")
815 (set_attr "opsize" "udi")])
817 ;; The divide and remainder operations always take their inputs from
818 ;; r24 and r25, put their output in r27, and clobber r23 and r28.
820 ;; ??? Force sign-extension here because some versions of OSF/1 don't
821 ;; do the right thing if the inputs are not properly sign-extended.
822 ;; But Linux, for instance, does not have this problem. Is it worth
823 ;; the complication here to eliminate the sign extension?
825 (define_expand "divsi3"
827 (sign_extend:DI (match_operand:SI 1 "nonimmediate_operand" "")))
829 (sign_extend:DI (match_operand:SI 2 "nonimmediate_operand" "")))
830 (parallel [(set (reg:DI 27)
831 (sign_extend:DI (div:SI (reg:DI 24) (reg:DI 25))))
832 (clobber (reg:DI 23))
833 (clobber (reg:DI 28))])
834 (set (match_operand:SI 0 "general_operand" "")
835 (subreg:SI (reg:DI 27) 0))]
839 (define_expand "udivsi3"
841 (sign_extend:DI (match_operand:SI 1 "nonimmediate_operand" "")))
843 (sign_extend:DI (match_operand:SI 2 "nonimmediate_operand" "")))
844 (parallel [(set (reg:DI 27)
845 (sign_extend:DI (udiv:SI (reg:DI 24) (reg:DI 25))))
846 (clobber (reg:DI 23))
847 (clobber (reg:DI 28))])
848 (set (match_operand:SI 0 "general_operand" "")
849 (subreg:SI (reg:DI 27) 0))]
853 (define_expand "modsi3"
855 (sign_extend:DI (match_operand:SI 1 "nonimmediate_operand" "")))
857 (sign_extend:DI (match_operand:SI 2 "nonimmediate_operand" "")))
858 (parallel [(set (reg:DI 27)
859 (sign_extend:DI (mod:SI (reg:DI 24) (reg:DI 25))))
860 (clobber (reg:DI 23))
861 (clobber (reg:DI 28))])
862 (set (match_operand:SI 0 "general_operand" "")
863 (subreg:SI (reg:DI 27) 0))]
867 (define_expand "umodsi3"
869 (sign_extend:DI (match_operand:SI 1 "nonimmediate_operand" "")))
871 (sign_extend:DI (match_operand:SI 2 "nonimmediate_operand" "")))
872 (parallel [(set (reg:DI 27)
873 (sign_extend:DI (umod:SI (reg:DI 24) (reg:DI 25))))
874 (clobber (reg:DI 23))
875 (clobber (reg:DI 28))])
876 (set (match_operand:SI 0 "general_operand" "")
877 (subreg:SI (reg:DI 27) 0))]
881 (define_expand "divdi3"
882 [(set (reg:DI 24) (match_operand:DI 1 "input_operand" ""))
883 (set (reg:DI 25) (match_operand:DI 2 "input_operand" ""))
884 (parallel [(set (reg:DI 27)
887 (clobber (reg:DI 23))
888 (clobber (reg:DI 28))])
889 (set (match_operand:DI 0 "general_operand" "")
894 (define_expand "udivdi3"
895 [(set (reg:DI 24) (match_operand:DI 1 "input_operand" ""))
896 (set (reg:DI 25) (match_operand:DI 2 "input_operand" ""))
897 (parallel [(set (reg:DI 27)
900 (clobber (reg:DI 23))
901 (clobber (reg:DI 28))])
902 (set (match_operand:DI 0 "general_operand" "")
907 (define_expand "moddi3"
908 [(set (reg:DI 24) (match_operand:DI 1 "input_operand" ""))
909 (set (reg:DI 25) (match_operand:DI 2 "input_operand" ""))
910 (parallel [(set (reg:DI 27)
913 (clobber (reg:DI 23))
914 (clobber (reg:DI 28))])
915 (set (match_operand:DI 0 "general_operand" "")
920 (define_expand "umoddi3"
921 [(set (reg:DI 24) (match_operand:DI 1 "input_operand" ""))
922 (set (reg:DI 25) (match_operand:DI 2 "input_operand" ""))
923 (parallel [(set (reg:DI 27)
926 (clobber (reg:DI 23))
927 (clobber (reg:DI 28))])
928 (set (match_operand:DI 0 "general_operand" "")
933 ;; Lengths of 8 for ldq $t12,__divq($gp); jsr $t9,($t12),__divq as
934 ;; expanded by the assembler.
937 (sign_extend:DI (match_operator:SI 1 "divmod_operator"
938 [(reg:DI 24) (reg:DI 25)])))
939 (clobber (reg:DI 23))
940 (clobber (reg:DI 28))]
943 [(set_attr "type" "jsr")
944 (set_attr "length" "8")])
948 (match_operator:DI 1 "divmod_operator"
949 [(reg:DI 24) (reg:DI 25)]))
950 (clobber (reg:DI 23))
951 (clobber (reg:DI 28))]
954 [(set_attr "type" "jsr")
955 (set_attr "length" "8")])
957 ;; Next are the basic logical operations. These only exist in DImode.
959 (define_insn "anddi3"
960 [(set (match_operand:DI 0 "register_operand" "=r,r,r")
961 (and:DI (match_operand:DI 1 "reg_or_0_operand" "%rJ,rJ,rJ")
962 (match_operand:DI 2 "and_operand" "rI,N,MH")))]
968 [(set_attr "type" "ilog,ilog,shift")])
970 ;; There are times when we can split an AND into two AND insns. This occurs
971 ;; when we can first clear any bytes and then clear anything else. For
972 ;; example "I & 0xffff07" is "(I & 0xffffff) & 0xffffffffffffff07".
973 ;; Only do this when running on 64-bit host since the computations are
974 ;; too messy otherwise.
977 [(set (match_operand:DI 0 "register_operand" "")
978 (and:DI (match_operand:DI 1 "register_operand" "")
979 (match_operand:DI 2 "const_int_operand" "")))]
980 "HOST_BITS_PER_WIDE_INT == 64 && ! and_operand (operands[2], DImode)"
981 [(set (match_dup 0) (and:DI (match_dup 1) (match_dup 3)))
982 (set (match_dup 0) (and:DI (match_dup 0) (match_dup 4)))]
985 unsigned HOST_WIDE_INT mask1 = INTVAL (operands[2]);
986 unsigned HOST_WIDE_INT mask2 = mask1;
989 /* For each byte that isn't all zeros, make it all ones. */
990 for (i = 0; i < 64; i += 8)
991 if ((mask1 & ((HOST_WIDE_INT) 0xff << i)) != 0)
992 mask1 |= (HOST_WIDE_INT) 0xff << i;
994 /* Now turn on any bits we've just turned off. */
997 operands[3] = GEN_INT (mask1);
998 operands[4] = GEN_INT (mask2);
1001 (define_insn "zero_extendqihi2"
1002 [(set (match_operand:HI 0 "register_operand" "=r")
1003 (zero_extend:HI (match_operand:QI 1 "register_operand" "r")))]
1006 [(set_attr "type" "ilog")])
1009 [(set (match_operand:SI 0 "register_operand" "=r,r")
1010 (zero_extend:SI (match_operand:QI 1 "nonimmediate_operand" "r,m")))]
1015 [(set_attr "type" "ilog,ild")])
1018 [(set (match_operand:SI 0 "register_operand" "=r")
1019 (zero_extend:SI (match_operand:QI 1 "register_operand" "r")))]
1022 [(set_attr "type" "ilog")])
1024 (define_expand "zero_extendqisi2"
1025 [(set (match_operand:SI 0 "register_operand" "")
1026 (zero_extend:SI (match_operand:QI 1 "register_operand" "")))]
1031 [(set (match_operand:DI 0 "register_operand" "=r,r")
1032 (zero_extend:DI (match_operand:QI 1 "nonimmediate_operand" "r,m")))]
1037 [(set_attr "type" "ilog,ild")])
1040 [(set (match_operand:DI 0 "register_operand" "=r")
1041 (zero_extend:DI (match_operand:QI 1 "register_operand" "r")))]
1044 [(set_attr "type" "ilog")])
1046 (define_expand "zero_extendqidi2"
1047 [(set (match_operand:DI 0 "register_operand" "")
1048 (zero_extend:DI (match_operand:QI 1 "register_operand" "")))]
1053 [(set (match_operand:SI 0 "register_operand" "=r,r")
1054 (zero_extend:SI (match_operand:HI 1 "nonimmediate_operand" "r,m")))]
1059 [(set_attr "type" "shift,ild")])
1062 [(set (match_operand:SI 0 "register_operand" "=r")
1063 (zero_extend:SI (match_operand:HI 1 "register_operand" "r")))]
1066 [(set_attr "type" "shift")])
1068 (define_expand "zero_extendhisi2"
1069 [(set (match_operand:SI 0 "register_operand" "")
1070 (zero_extend:SI (match_operand:HI 1 "register_operand" "")))]
1075 [(set (match_operand:DI 0 "register_operand" "=r,r")
1076 (zero_extend:DI (match_operand:HI 1 "nonimmediate_operand" "r,m")))]
1081 [(set_attr "type" "shift,ild")])
1084 [(set (match_operand:DI 0 "register_operand" "=r")
1085 (zero_extend:DI (match_operand:HI 1 "register_operand" "r")))]
1088 [(set_attr "type" "shift")])
1090 (define_expand "zero_extendhidi2"
1091 [(set (match_operand:DI 0 "register_operand" "")
1092 (zero_extend:DI (match_operand:HI 1 "register_operand" "")))]
1096 (define_insn "zero_extendsidi2"
1097 [(set (match_operand:DI 0 "register_operand" "=r")
1098 (zero_extend:DI (match_operand:SI 1 "register_operand" "r")))]
1101 [(set_attr "type" "shift")])
1104 [(set (match_operand:DI 0 "register_operand" "=r")
1105 (and:DI (not:DI (match_operand:DI 1 "reg_or_8bit_operand" "rI"))
1106 (match_operand:DI 2 "reg_or_0_operand" "rJ")))]
1109 [(set_attr "type" "ilog")])
1111 (define_insn "iordi3"
1112 [(set (match_operand:DI 0 "register_operand" "=r,r")
1113 (ior:DI (match_operand:DI 1 "reg_or_0_operand" "%rJ,rJ")
1114 (match_operand:DI 2 "or_operand" "rI,N")))]
1119 [(set_attr "type" "ilog")])
1121 (define_insn "one_cmpldi2"
1122 [(set (match_operand:DI 0 "register_operand" "=r")
1123 (not:DI (match_operand:DI 1 "reg_or_8bit_operand" "rI")))]
1126 [(set_attr "type" "ilog")])
1129 [(set (match_operand:DI 0 "register_operand" "=r")
1130 (ior:DI (not:DI (match_operand:DI 1 "reg_or_8bit_operand" "rI"))
1131 (match_operand:DI 2 "reg_or_0_operand" "rJ")))]
1134 [(set_attr "type" "ilog")])
1136 (define_insn "xordi3"
1137 [(set (match_operand:DI 0 "register_operand" "=r,r")
1138 (xor:DI (match_operand:DI 1 "reg_or_0_operand" "%rJ,rJ")
1139 (match_operand:DI 2 "or_operand" "rI,N")))]
1144 [(set_attr "type" "ilog")])
1147 [(set (match_operand:DI 0 "register_operand" "=r")
1148 (not:DI (xor:DI (match_operand:DI 1 "register_operand" "%rJ")
1149 (match_operand:DI 2 "register_operand" "rI"))))]
1152 [(set_attr "type" "ilog")])
1154 ;; Handle the FFS insn if we support CIX.
1156 (define_expand "ffsdi2"
1158 (unspec [(match_operand:DI 1 "register_operand" "")] 1))
1160 (plus:DI (match_dup 2) (const_int 1)))
1161 (set (match_operand:DI 0 "register_operand" "")
1162 (if_then_else:DI (eq (match_dup 1) (const_int 0))
1163 (const_int 0) (match_dup 3)))]
1167 operands[2] = gen_reg_rtx (DImode);
1168 operands[3] = gen_reg_rtx (DImode);
1172 [(set (match_operand:DI 0 "register_operand" "=r")
1173 (unspec [(match_operand:DI 1 "register_operand" "r")] 1))]
1176 ; ev6 calls all mvi and cttz/ctlz/popc class imisc, so just
1177 ; reuse the existing type name.
1178 [(set_attr "type" "mvi")])
1180 ;; Next come the shifts and the various extract and insert operations.
1182 (define_insn "ashldi3"
1183 [(set (match_operand:DI 0 "register_operand" "=r,r")
1184 (ashift:DI (match_operand:DI 1 "reg_or_0_operand" "rJ,rJ")
1185 (match_operand:DI 2 "reg_or_6bit_operand" "P,rS")))]
1189 switch (which_alternative)
1192 if (operands[2] == const1_rtx)
1193 return \"addq %r1,%r1,%0\";
1195 return \"s%P2addq %r1,0,%0\";
1197 return \"sll %r1,%2,%0\";
1202 [(set_attr "type" "iadd,shift")])
1204 ;; ??? The following pattern is made by combine, but earlier phases
1205 ;; (specifically flow) can't handle it. This occurs in jump.c. Deal
1206 ;; with this in a better way at some point.
1208 ;; [(set (match_operand:DI 0 "register_operand" "=r")
1210 ;; (subreg:SI (ashift:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
1211 ;; (match_operand:DI 2 "const_int_operand" "P"))
1213 ;; "INTVAL (operands[2]) >= 1 && INTVAL (operands[2]) <= 3"
1216 ;; if (operands[2] == const1_rtx)
1217 ;; return \"addl %r1,%r1,%0\";
1219 ;; return \"s%P2addl %r1,0,%0\";
1221 ;; [(set_attr "type" "iadd")])
1223 (define_insn "lshrdi3"
1224 [(set (match_operand:DI 0 "register_operand" "=r")
1225 (lshiftrt:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
1226 (match_operand:DI 2 "reg_or_6bit_operand" "rS")))]
1229 [(set_attr "type" "shift")])
1231 (define_insn "ashrdi3"
1232 [(set (match_operand:DI 0 "register_operand" "=r")
1233 (ashiftrt:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
1234 (match_operand:DI 2 "reg_or_6bit_operand" "rS")))]
1237 [(set_attr "type" "shift")])
1239 (define_expand "extendqihi2"
1241 (ashift:DI (match_operand:QI 1 "some_operand" "")
1243 (set (match_operand:HI 0 "register_operand" "")
1244 (ashiftrt:DI (match_dup 2)
1251 emit_insn (gen_extendqihi2x (operands[0],
1252 force_reg (QImode, operands[1])));
1256 /* If we have an unaligned MEM, extend to DImode (which we do
1257 specially) and then copy to the result. */
1258 if (unaligned_memory_operand (operands[1], HImode))
1260 rtx temp = gen_reg_rtx (DImode);
1262 emit_insn (gen_extendqidi2 (temp, operands[1]));
1263 emit_move_insn (operands[0], gen_lowpart (HImode, temp));
1267 operands[0] = gen_lowpart (DImode, operands[0]);
1268 operands[1] = gen_lowpart (DImode, force_reg (QImode, operands[1]));
1269 operands[2] = gen_reg_rtx (DImode);
1272 (define_insn "extendqidi2x"
1273 [(set (match_operand:DI 0 "register_operand" "=r")
1274 (sign_extend:DI (match_operand:QI 1 "register_operand" "r")))]
1277 [(set_attr "type" "shift")])
1279 (define_insn "extendhidi2x"
1280 [(set (match_operand:DI 0 "register_operand" "=r")
1281 (sign_extend:DI (match_operand:HI 1 "register_operand" "r")))]
1284 [(set_attr "type" "shift")])
1286 (define_insn "extendqisi2x"
1287 [(set (match_operand:SI 0 "register_operand" "=r")
1288 (sign_extend:SI (match_operand:QI 1 "register_operand" "r")))]
1291 [(set_attr "type" "shift")])
1293 (define_insn "extendhisi2x"
1294 [(set (match_operand:SI 0 "register_operand" "=r")
1295 (sign_extend:SI (match_operand:HI 1 "register_operand" "r")))]
1298 [(set_attr "type" "shift")])
1300 (define_insn "extendqihi2x"
1301 [(set (match_operand:HI 0 "register_operand" "=r")
1302 (sign_extend:HI (match_operand:QI 1 "register_operand" "r")))]
1305 [(set_attr "type" "shift")])
1307 (define_expand "extendqisi2"
1309 (ashift:DI (match_operand:QI 1 "some_operand" "")
1311 (set (match_operand:SI 0 "register_operand" "")
1312 (ashiftrt:DI (match_dup 2)
1319 emit_insn (gen_extendqisi2x (operands[0],
1320 force_reg (QImode, operands[1])));
1324 /* If we have an unaligned MEM, extend to a DImode form of
1325 the result (which we do specially). */
1326 if (unaligned_memory_operand (operands[1], QImode))
1328 rtx temp = gen_reg_rtx (DImode);
1330 emit_insn (gen_extendqidi2 (temp, operands[1]));
1331 emit_move_insn (operands[0], gen_lowpart (SImode, temp));
1335 operands[0] = gen_lowpart (DImode, operands[0]);
1336 operands[1] = gen_lowpart (DImode, force_reg (QImode, operands[1]));
1337 operands[2] = gen_reg_rtx (DImode);
1340 (define_expand "extendqidi2"
1342 (ashift:DI (match_operand:QI 1 "some_operand" "")
1344 (set (match_operand:DI 0 "register_operand" "")
1345 (ashiftrt:DI (match_dup 2)
1352 emit_insn (gen_extendqidi2x (operands[0],
1353 force_reg (QImode, operands[1])));
1357 if (unaligned_memory_operand (operands[1], QImode))
1360 = gen_unaligned_extendqidi (operands[0],
1361 get_unaligned_address (operands[1], 1));
1363 alpha_set_memflags (seq, operands[1]);
1368 operands[1] = gen_lowpart (DImode, force_reg (QImode, operands[1]));
1369 operands[2] = gen_reg_rtx (DImode);
1372 (define_expand "extendhisi2"
1374 (ashift:DI (match_operand:HI 1 "some_operand" "")
1376 (set (match_operand:SI 0 "register_operand" "")
1377 (ashiftrt:DI (match_dup 2)
1384 emit_insn (gen_extendhisi2x (operands[0],
1385 force_reg (HImode, operands[1])));
1389 /* If we have an unaligned MEM, extend to a DImode form of
1390 the result (which we do specially). */
1391 if (unaligned_memory_operand (operands[1], HImode))
1393 rtx temp = gen_reg_rtx (DImode);
1395 emit_insn (gen_extendhidi2 (temp, operands[1]));
1396 emit_move_insn (operands[0], gen_lowpart (SImode, temp));
1400 operands[0] = gen_lowpart (DImode, operands[0]);
1401 operands[1] = gen_lowpart (DImode, force_reg (HImode, operands[1]));
1402 operands[2] = gen_reg_rtx (DImode);
1405 (define_expand "extendhidi2"
1407 (ashift:DI (match_operand:HI 1 "some_operand" "")
1409 (set (match_operand:DI 0 "register_operand" "")
1410 (ashiftrt:DI (match_dup 2)
1417 emit_insn (gen_extendhidi2x (operands[0],
1418 force_reg (HImode, operands[1])));
1422 if (unaligned_memory_operand (operands[1], HImode))
1425 = gen_unaligned_extendhidi (operands[0],
1426 get_unaligned_address (operands[1], 2));
1428 alpha_set_memflags (seq, operands[1]);
1433 operands[1] = gen_lowpart (DImode, force_reg (HImode, operands[1]));
1434 operands[2] = gen_reg_rtx (DImode);
1437 ;; Here's how we sign extend an unaligned byte and halfword. Doing this
1438 ;; as a pattern saves one instruction. The code is similar to that for
1439 ;; the unaligned loads (see below).
1441 ;; Operand 1 is the address + 1 (+2 for HI), operand 0 is the result.
1442 (define_expand "unaligned_extendqidi"
1443 [(set (match_dup 2) (match_operand:DI 1 "address_operand" ""))
1445 (mem:DI (and:DI (plus:DI (match_dup 2) (const_int -1))
1448 (ashift:DI (match_dup 3)
1449 (minus:DI (const_int 56)
1451 (and:DI (plus:DI (match_dup 2) (const_int -1))
1454 (set (subreg:DI (match_operand:QI 0 "register_operand" "") 0)
1455 (ashiftrt:DI (match_dup 4) (const_int 56)))]
1458 { operands[2] = gen_reg_rtx (DImode);
1459 operands[3] = gen_reg_rtx (DImode);
1460 operands[4] = gen_reg_rtx (DImode);
1463 (define_expand "unaligned_extendhidi"
1464 [(set (match_dup 2) (match_operand:DI 1 "address_operand" ""))
1466 (mem:DI (and:DI (plus:DI (match_dup 2) (const_int -2))
1469 (ashift:DI (match_dup 3)
1470 (minus:DI (const_int 56)
1472 (and:DI (plus:DI (match_dup 2) (const_int -1))
1475 (set (subreg:DI (match_operand:QI 0 "register_operand" "") 0)
1476 (ashiftrt:DI (match_dup 4) (const_int 48)))]
1479 { operands[2] = gen_reg_rtx (DImode);
1480 operands[3] = gen_reg_rtx (DImode);
1481 operands[4] = gen_reg_rtx (DImode);
1485 [(set (match_operand:DI 0 "register_operand" "=r")
1486 (zero_extract:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
1487 (match_operand:DI 2 "mode_width_operand" "n")
1488 (match_operand:DI 3 "mul8_operand" "I")))]
1490 "ext%M2l %r1,%s3,%0"
1491 [(set_attr "type" "shift")])
1493 (define_insn "extxl"
1494 [(set (match_operand:DI 0 "register_operand" "=r")
1495 (zero_extract:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
1496 (match_operand:DI 2 "mode_width_operand" "n")
1497 (ashift:DI (match_operand:DI 3 "reg_or_8bit_operand" "rI")
1501 [(set_attr "type" "shift")])
1503 ;; Combine has some strange notion of preserving existing undefined behaviour
1504 ;; in shifts larger than a word size. So capture these patterns that it
1505 ;; should have turned into zero_extracts.
1508 [(set (match_operand:DI 0 "register_operand" "=r")
1509 (and (lshiftrt:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
1510 (ashift:DI (match_operand:DI 2 "reg_or_8bit_operand" "rI")
1512 (match_operand:DI 3 "mode_mask_operand" "n")))]
1515 [(set_attr "type" "shift")])
1518 [(set (match_operand:DI 0 "register_operand" "=r")
1519 (lshiftrt:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
1520 (ashift:DI (match_operand:DI 2 "reg_or_8bit_operand" "rI")
1524 [(set_attr "type" "shift")])
1526 (define_insn "extqh"
1527 [(set (match_operand:DI 0 "register_operand" "=r")
1529 (match_operand:DI 1 "reg_or_0_operand" "rJ")
1530 (minus:DI (const_int 56)
1533 (plus:DI (match_operand:DI 2 "reg_or_8bit_operand" "rI")
1539 [(set_attr "type" "shift")])
1541 (define_insn "extlh"
1542 [(set (match_operand:DI 0 "register_operand" "=r")
1544 (and:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
1545 (const_int 2147483647))
1546 (minus:DI (const_int 56)
1549 (plus:DI (match_operand:DI 2 "reg_or_8bit_operand" "rI")
1555 [(set_attr "type" "shift")])
1557 (define_insn "extwh"
1558 [(set (match_operand:DI 0 "register_operand" "=r")
1560 (and:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
1562 (minus:DI (const_int 56)
1565 (plus:DI (match_operand:DI 2 "reg_or_8bit_operand" "rI")
1571 [(set_attr "type" "shift")])
1573 ;; This converts an extXl into an extXh with an appropriate adjustment
1574 ;; to the address calculation.
1577 ;; [(set (match_operand:DI 0 "register_operand" "")
1578 ;; (ashift:DI (zero_extract:DI (match_operand:DI 1 "register_operand" "")
1579 ;; (match_operand:DI 2 "mode_width_operand" "")
1580 ;; (ashift:DI (match_operand:DI 3 "" "")
1582 ;; (match_operand:DI 4 "const_int_operand" "")))
1583 ;; (clobber (match_operand:DI 5 "register_operand" ""))]
1584 ;; "INTVAL (operands[4]) == 64 - INTVAL (operands[2])"
1585 ;; [(set (match_dup 5) (match_dup 6))
1586 ;; (set (match_dup 0)
1587 ;; (ashift:DI (zero_extract:DI (match_dup 1) (match_dup 2)
1588 ;; (ashift:DI (plus:DI (match_dup 5)
1594 ;; operands[6] = plus_constant (operands[3],
1595 ;; INTVAL (operands[2]) / BITS_PER_UNIT);
1596 ;; operands[7] = GEN_INT (- INTVAL (operands[2]) / BITS_PER_UNIT);
1600 [(set (match_operand:DI 0 "register_operand" "=r")
1601 (ashift:DI (zero_extend:DI (match_operand:QI 1 "register_operand" "r"))
1602 (match_operand:DI 2 "mul8_operand" "I")))]
1605 [(set_attr "type" "shift")])
1608 [(set (match_operand:DI 0 "register_operand" "=r")
1609 (ashift:DI (zero_extend:DI (match_operand:HI 1 "register_operand" "r"))
1610 (match_operand:DI 2 "mul8_operand" "I")))]
1613 [(set_attr "type" "shift")])
1616 [(set (match_operand:DI 0 "register_operand" "=r")
1617 (ashift:DI (zero_extend:DI (match_operand:SI 1 "register_operand" "r"))
1618 (match_operand:DI 2 "mul8_operand" "I")))]
1621 [(set_attr "type" "shift")])
1623 (define_insn "insbl"
1624 [(set (match_operand:DI 0 "register_operand" "=r")
1625 (ashift:DI (zero_extend:DI (match_operand:QI 1 "register_operand" "r"))
1626 (ashift:DI (match_operand:DI 2 "reg_or_8bit_operand" "rI")
1630 [(set_attr "type" "shift")])
1632 (define_insn "inswl"
1633 [(set (match_operand:DI 0 "register_operand" "=r")
1634 (ashift:DI (zero_extend:DI (match_operand:HI 1 "register_operand" "r"))
1635 (ashift:DI (match_operand:DI 2 "reg_or_8bit_operand" "rI")
1639 [(set_attr "type" "shift")])
1641 (define_insn "insll"
1642 [(set (match_operand:DI 0 "register_operand" "=r")
1643 (ashift:DI (zero_extend:DI (match_operand:SI 1 "register_operand" "r"))
1644 (ashift:DI (match_operand:DI 2 "reg_or_8bit_operand" "rI")
1648 [(set_attr "type" "shift")])
1650 (define_insn "insql"
1651 [(set (match_operand:DI 0 "register_operand" "=r")
1652 (ashift:DI (match_operand:DI 1 "register_operand" "r")
1653 (ashift:DI (match_operand:DI 2 "reg_or_8bit_operand" "rI")
1657 [(set_attr "type" "shift")])
1659 ;; Combine has this sometimes habit of moving the and outside of the
1660 ;; shift, making life more interesting.
1663 [(set (match_operand:DI 0 "register_operand" "=r")
1664 (and:DI (ashift:DI (match_operand:DI 1 "register_operand" "r")
1665 (match_operand:DI 2 "mul8_operand" "I"))
1666 (match_operand:DI 3 "immediate_operand" "i")))]
1667 "HOST_BITS_PER_WIDE_INT == 64
1668 && GET_CODE (operands[3]) == CONST_INT
1669 && (((unsigned HOST_WIDE_INT) 0xff << INTVAL (operands[2])
1670 == INTVAL (operands[3]))
1671 || ((unsigned HOST_WIDE_INT) 0xffff << INTVAL (operands[2])
1672 == INTVAL (operands[3]))
1673 || ((unsigned HOST_WIDE_INT) 0xffffffff << INTVAL (operands[2])
1674 == INTVAL (operands[3])))"
1677 #if HOST_BITS_PER_WIDE_INT == 64
1678 if ((unsigned HOST_WIDE_INT) 0xff << INTVAL (operands[2])
1679 == INTVAL (operands[3]))
1680 return \"insbl %1,%s2,%0\";
1681 if ((unsigned HOST_WIDE_INT) 0xffff << INTVAL (operands[2])
1682 == INTVAL (operands[3]))
1683 return \"inswl %1,%s2,%0\";
1684 if ((unsigned HOST_WIDE_INT) 0xffffffff << INTVAL (operands[2])
1685 == INTVAL (operands[3]))
1686 return \"insll %1,%s2,%0\";
1690 [(set_attr "type" "shift")])
1692 ;; We do not include the insXh insns because they are complex to express
1693 ;; and it does not appear that we would ever want to generate them.
1695 ;; Since we need them for block moves, though, cop out and use unspec.
1697 (define_insn "insxh"
1698 [(set (match_operand:DI 0 "register_operand" "=r")
1699 (unspec [(match_operand:DI 1 "register_operand" "r")
1700 (match_operand:DI 2 "mode_width_operand" "n")
1701 (match_operand:DI 3 "reg_or_8bit_operand" "rI")] 2))]
1704 [(set_attr "type" "shift")])
1706 (define_insn "mskxl"
1707 [(set (match_operand:DI 0 "register_operand" "=r")
1708 (and:DI (not:DI (ashift:DI
1709 (match_operand:DI 2 "mode_mask_operand" "n")
1711 (match_operand:DI 3 "reg_or_8bit_operand" "rI")
1713 (match_operand:DI 1 "reg_or_0_operand" "rJ")))]
1716 [(set_attr "type" "shift")])
1718 ;; We do not include the mskXh insns because it does not appear we would
1719 ;; ever generate one.
1721 ;; Again, we do for block moves and we use unspec again.
1723 (define_insn "mskxh"
1724 [(set (match_operand:DI 0 "register_operand" "=r")
1725 (unspec [(match_operand:DI 1 "register_operand" "r")
1726 (match_operand:DI 2 "mode_width_operand" "n")
1727 (match_operand:DI 3 "reg_or_8bit_operand" "rI")] 3))]
1730 [(set_attr "type" "shift")])
1732 ;; Floating-point operations. All the double-precision insns can extend
1733 ;; from single, so indicate that. The exception are the ones that simply
1734 ;; play with the sign bits; it's not clear what to do there.
1736 (define_insn "abssf2"
1737 [(set (match_operand:SF 0 "register_operand" "=f")
1738 (abs:SF (match_operand:SF 1 "reg_or_fp0_operand" "fG")))]
1741 [(set_attr "type" "fcpys")])
1743 (define_insn "absdf2"
1744 [(set (match_operand:DF 0 "register_operand" "=f")
1745 (abs:DF (match_operand:DF 1 "reg_or_fp0_operand" "fG")))]
1748 [(set_attr "type" "fcpys")])
1750 (define_insn "negsf2"
1751 [(set (match_operand:SF 0 "register_operand" "=f")
1752 (neg:SF (match_operand:SF 1 "reg_or_fp0_operand" "fG")))]
1755 [(set_attr "type" "fadd")])
1757 (define_insn "negdf2"
1758 [(set (match_operand:DF 0 "register_operand" "=f")
1759 (neg:DF (match_operand:DF 1 "reg_or_fp0_operand" "fG")))]
1762 [(set_attr "type" "fadd")])
1765 [(set (match_operand:SF 0 "register_operand" "=&f")
1766 (plus:SF (match_operand:SF 1 "reg_or_fp0_operand" "%fG")
1767 (match_operand:SF 2 "reg_or_fp0_operand" "fG")))]
1768 "TARGET_FP && alpha_tp == ALPHA_TP_INSN"
1769 "add%,%)%& %R1,%R2,%0"
1770 [(set_attr "type" "fadd")
1771 (set_attr "trap" "yes")])
1773 (define_insn "addsf3"
1774 [(set (match_operand:SF 0 "register_operand" "=f")
1775 (plus:SF (match_operand:SF 1 "reg_or_fp0_operand" "%fG")
1776 (match_operand:SF 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 (match_operand:DF 1 "reg_or_fp0_operand" "%fG")
1785 (match_operand:DF 2 "reg_or_fp0_operand" "fG")))]
1786 "TARGET_FP && alpha_tp == ALPHA_TP_INSN"
1787 "add%-%)%& %R1,%R2,%0"
1788 [(set_attr "type" "fadd")
1789 (set_attr "trap" "yes")])
1791 (define_insn "adddf3"
1792 [(set (match_operand:DF 0 "register_operand" "=f")
1793 (plus:DF (match_operand:DF 1 "reg_or_fp0_operand" "%fG")
1794 (match_operand:DF 2 "reg_or_fp0_operand" "fG")))]
1796 "add%-%)%& %R1,%R2,%0"
1797 [(set_attr "type" "fadd")
1798 (set_attr "trap" "yes")])
1801 [(set (match_operand:DF 0 "register_operand" "=f")
1802 (plus:DF (float_extend:DF
1803 (match_operand:SF 1 "reg_or_fp0_operand" "fG"))
1804 (match_operand:DF 2 "reg_or_fp0_operand" "fG")))]
1805 "TARGET_FP && alpha_tp != ALPHA_TP_INSN"
1806 "add%-%)%& %R1,%R2,%0"
1807 [(set_attr "type" "fadd")
1808 (set_attr "trap" "yes")])
1811 [(set (match_operand:DF 0 "register_operand" "=f")
1812 (plus:DF (float_extend:DF
1813 (match_operand:SF 1 "reg_or_fp0_operand" "%fG"))
1815 (match_operand:SF 2 "reg_or_fp0_operand" "fG"))))]
1816 "TARGET_FP && alpha_tp != ALPHA_TP_INSN"
1817 "add%-%)%& %R1,%R2,%0"
1818 [(set_attr "type" "fadd")
1819 (set_attr "trap" "yes")])
1821 ;; Define conversion operators between DFmode and SImode, using the cvtql
1822 ;; instruction. To allow combine et al to do useful things, we keep the
1823 ;; operation as a unit until after reload, at which point we split the
1826 ;; Note that we (attempt to) only consider this optimization when the
1827 ;; ultimate destination is memory. If we will be doing further integer
1828 ;; processing, it is cheaper to do the truncation in the int regs.
1830 (define_insn "*cvtql"
1831 [(set (match_operand:SI 0 "register_operand" "=f")
1832 (unspec:SI [(match_operand:DI 1 "reg_or_fp0_operand" "fG")] 5))]
1835 [(set_attr "type" "fadd")
1836 (set_attr "trap" "yes")])
1839 [(set (match_operand:SI 0 "memory_operand" "")
1840 (subreg:SI (fix:DI (match_operand:DF 1 "reg_or_fp0_operand" "")) 0))
1841 (clobber (match_scratch:DI 2 ""))
1842 (clobber (match_scratch:SI 3 ""))]
1843 "TARGET_FP && reload_completed"
1844 [(set (match_dup 2) (fix:DI (match_dup 1)))
1845 (set (match_dup 3) (unspec:SI [(match_dup 2)] 5))
1846 (set (match_dup 0) (match_dup 3))]
1850 [(set (match_operand:SI 0 "memory_operand" "")
1851 (subreg:SI (fix:DI (match_operand:DF 1 "reg_or_fp0_operand" "")) 0))
1852 (clobber (match_scratch:DI 2 ""))]
1853 "TARGET_FP && reload_completed"
1854 [(set (match_dup 2) (fix:DI (match_dup 1)))
1855 (set (match_dup 3) (unspec:SI [(match_dup 2)] 5))
1856 (set (match_dup 0) (match_dup 3))]
1857 ;; Due to REG_CANNOT_CHANGE_SIZE issues, we cannot simply use SUBREG.
1858 "operands[3] = gen_rtx_REG (SImode, REGNO (operands[2]));")
1861 [(set (match_operand:SI 0 "memory_operand" "=m")
1862 (subreg:SI (fix:DI (match_operand:DF 1 "reg_or_fp0_operand" "fG")) 0))
1863 (clobber (match_scratch:DI 2 "=&f"))
1864 (clobber (match_scratch:SI 3 "=&f"))]
1865 "TARGET_FP && alpha_tp == ALPHA_TP_INSN"
1867 [(set_attr "type" "fadd")
1868 (set_attr "trap" "yes")])
1871 [(set (match_operand:SI 0 "memory_operand" "=m")
1872 (subreg:SI (fix:DI (match_operand:DF 1 "reg_or_fp0_operand" "fG")) 0))
1873 (clobber (match_scratch:DI 2 "=f"))]
1874 "TARGET_FP && alpha_tp != ALPHA_TP_INSN"
1876 [(set_attr "type" "fadd")
1877 (set_attr "trap" "yes")])
1880 [(set (match_operand:DI 0 "register_operand" "=&f")
1881 (fix:DI (match_operand:DF 1 "reg_or_fp0_operand" "fG")))]
1882 "TARGET_FP && alpha_tp == ALPHA_TP_INSN"
1884 [(set_attr "type" "fadd")
1885 (set_attr "trap" "yes")])
1887 (define_insn "fix_truncdfdi2"
1888 [(set (match_operand:DI 0 "register_operand" "=f")
1889 (fix:DI (match_operand:DF 1 "reg_or_fp0_operand" "fG")))]
1892 [(set_attr "type" "fadd")
1893 (set_attr "trap" "yes")])
1895 ;; Likewise between SFmode and SImode.
1898 [(set (match_operand:SI 0 "memory_operand" "")
1899 (subreg:SI (fix:DI (float_extend:DF
1900 (match_operand:SF 1 "reg_or_fp0_operand" ""))) 0))
1901 (clobber (match_scratch:DI 2 ""))
1902 (clobber (match_scratch:SI 3 ""))]
1903 "TARGET_FP && reload_completed"
1904 [(set (match_dup 2) (fix:DI (float_extend:DF (match_dup 1))))
1905 (set (match_dup 3) (unspec:SI [(match_dup 2)] 5))
1906 (set (match_dup 0) (match_dup 3))]
1910 [(set (match_operand:SI 0 "memory_operand" "")
1911 (subreg:SI (fix:DI (float_extend:DF
1912 (match_operand:SF 1 "reg_or_fp0_operand" ""))) 0))
1913 (clobber (match_scratch:DI 2 ""))]
1914 "TARGET_FP && reload_completed"
1915 [(set (match_dup 2) (fix:DI (float_extend:DF (match_dup 1))))
1916 (set (match_dup 3) (unspec:SI [(match_dup 2)] 5))
1917 (set (match_dup 0) (match_dup 3))]
1918 ;; Due to REG_CANNOT_CHANGE_SIZE issues, we cannot simply use SUBREG.
1919 "operands[3] = gen_rtx_REG (SImode, REGNO (operands[2]));")
1922 [(set (match_operand:SI 0 "memory_operand" "=m")
1923 (subreg:SI (fix:DI (float_extend:DF
1924 (match_operand:SF 1 "reg_or_fp0_operand" "fG"))) 0))
1925 (clobber (match_scratch:DI 2 "=&f"))
1926 (clobber (match_scratch:SI 3 "=&f"))]
1927 "TARGET_FP && alpha_tp == ALPHA_TP_INSN"
1929 [(set_attr "type" "fadd")
1930 (set_attr "trap" "yes")])
1933 [(set (match_operand:SI 0 "memory_operand" "=m")
1934 (subreg:SI (fix:DI (float_extend:DF
1935 (match_operand:SF 1 "reg_or_fp0_operand" "fG"))) 0))
1936 (clobber (match_scratch:DI 2 "=f"))]
1937 "TARGET_FP && alpha_tp != ALPHA_TP_INSN"
1939 [(set_attr "type" "fadd")
1940 (set_attr "trap" "yes")])
1943 [(set (match_operand:DI 0 "register_operand" "=&f")
1944 (fix:DI (float_extend:DF
1945 (match_operand:SF 1 "reg_or_fp0_operand" "fG"))))]
1946 "TARGET_FP && alpha_tp == ALPHA_TP_INSN"
1948 [(set_attr "type" "fadd")
1949 (set_attr "trap" "yes")])
1951 (define_insn "fix_truncsfdi2"
1952 [(set (match_operand:DI 0 "register_operand" "=f")
1953 (fix:DI (float_extend:DF
1954 (match_operand:SF 1 "reg_or_fp0_operand" "fG"))))]
1957 [(set_attr "type" "fadd")
1958 (set_attr "trap" "yes")])
1961 [(set (match_operand:SF 0 "register_operand" "=&f")
1962 (float:SF (match_operand:DI 1 "register_operand" "f")))]
1963 "TARGET_FP && alpha_tp == ALPHA_TP_INSN"
1965 [(set_attr "type" "fadd")
1966 (set_attr "trap" "yes")])
1968 (define_insn "floatdisf2"
1969 [(set (match_operand:SF 0 "register_operand" "=f")
1970 (float:SF (match_operand:DI 1 "register_operand" "f")))]
1973 [(set_attr "type" "fadd")
1974 (set_attr "trap" "yes")])
1977 [(set (match_operand:DF 0 "register_operand" "=&f")
1978 (float:DF (match_operand:DI 1 "register_operand" "f")))]
1979 "TARGET_FP && alpha_tp == ALPHA_TP_INSN"
1981 [(set_attr "type" "fadd")
1982 (set_attr "trap" "yes")])
1984 (define_insn "floatdidf2"
1985 [(set (match_operand:DF 0 "register_operand" "=f")
1986 (float:DF (match_operand:DI 1 "register_operand" "f")))]
1989 [(set_attr "type" "fadd")
1990 (set_attr "trap" "yes")])
1992 (define_expand "extendsfdf2"
1993 [(use (match_operand:DF 0 "register_operand" ""))
1994 (use (match_operand:SF 1 "nonimmediate_operand" ""))]
1998 if (alpha_tp == ALPHA_TP_INSN)
1999 emit_insn (gen_extendsfdf2_tp (operands[0],
2000 force_reg (SFmode, operands[1])));
2002 emit_insn (gen_extendsfdf2_no_tp (operands[0], operands[1]));
2007 (define_insn "extendsfdf2_tp"
2008 [(set (match_operand:DF 0 "register_operand" "=&f")
2009 (float_extend:DF (match_operand:SF 1 "register_operand" "f")))]
2010 "TARGET_FP && alpha_tp == ALPHA_TP_INSN"
2012 [(set_attr "type" "fadd")
2013 (set_attr "trap" "yes")])
2015 (define_insn "extendsfdf2_no_tp"
2016 [(set (match_operand:DF 0 "register_operand" "=f,f,m")
2017 (float_extend:DF (match_operand:SF 1 "nonimmediate_operand" "f,m,f")))]
2018 "TARGET_FP && alpha_tp != ALPHA_TP_INSN"
2023 [(set_attr "type" "fcpys,fld,fst")
2024 (set_attr "trap" "yes")])
2027 [(set (match_operand:SF 0 "register_operand" "=&f")
2028 (float_truncate:SF (match_operand:DF 1 "reg_or_fp0_operand" "fG")))]
2029 "TARGET_FP && alpha_tp == ALPHA_TP_INSN"
2030 "cvt%-%,%)%& %R1,%0"
2031 [(set_attr "type" "fadd")
2032 (set_attr "trap" "yes")])
2034 (define_insn "truncdfsf2"
2035 [(set (match_operand:SF 0 "register_operand" "=f")
2036 (float_truncate:SF (match_operand:DF 1 "reg_or_fp0_operand" "fG")))]
2038 "cvt%-%,%)%& %R1,%0"
2039 [(set_attr "type" "fadd")
2040 (set_attr "trap" "yes")])
2043 [(set (match_operand:SF 0 "register_operand" "=&f")
2044 (div:SF (match_operand:SF 1 "reg_or_fp0_operand" "fG")
2045 (match_operand:SF 2 "reg_or_fp0_operand" "fG")))]
2046 "TARGET_FP && alpha_tp == ALPHA_TP_INSN"
2047 "div%,%)%& %R1,%R2,%0"
2048 [(set_attr "type" "fdiv")
2049 (set_attr "opsize" "si")
2050 (set_attr "trap" "yes")])
2052 (define_insn "divsf3"
2053 [(set (match_operand:SF 0 "register_operand" "=f")
2054 (div:SF (match_operand:SF 1 "reg_or_fp0_operand" "fG")
2055 (match_operand:SF 2 "reg_or_fp0_operand" "fG")))]
2057 "div%,%)%& %R1,%R2,%0"
2058 [(set_attr "type" "fdiv")
2059 (set_attr "opsize" "si")
2060 (set_attr "trap" "yes")])
2063 [(set (match_operand:DF 0 "register_operand" "=&f")
2064 (div:DF (match_operand:DF 1 "reg_or_fp0_operand" "fG")
2065 (match_operand:DF 2 "reg_or_fp0_operand" "fG")))]
2066 "TARGET_FP && alpha_tp == ALPHA_TP_INSN"
2067 "div%-%)%& %R1,%R2,%0"
2068 [(set_attr "type" "fdiv")
2069 (set_attr "trap" "yes")])
2071 (define_insn "divdf3"
2072 [(set (match_operand:DF 0 "register_operand" "=f")
2073 (div:DF (match_operand:DF 1 "reg_or_fp0_operand" "fG")
2074 (match_operand:DF 2 "reg_or_fp0_operand" "fG")))]
2076 "div%-%)%& %R1,%R2,%0"
2077 [(set_attr "type" "fdiv")
2078 (set_attr "trap" "yes")])
2081 [(set (match_operand:DF 0 "register_operand" "=f")
2082 (div:DF (float_extend:DF (match_operand:SF 1 "reg_or_fp0_operand" "fG"))
2083 (match_operand:DF 2 "reg_or_fp0_operand" "fG")))]
2084 "TARGET_FP && alpha_tp != ALPHA_TP_INSN"
2085 "div%-%)%& %R1,%R2,%0"
2086 [(set_attr "type" "fdiv")
2087 (set_attr "trap" "yes")])
2090 [(set (match_operand:DF 0 "register_operand" "=f")
2091 (div:DF (match_operand:DF 1 "reg_or_fp0_operand" "fG")
2093 (match_operand:SF 2 "reg_or_fp0_operand" "fG"))))]
2094 "TARGET_FP && alpha_tp != ALPHA_TP_INSN"
2095 "div%-%)%& %R1,%R2,%0"
2096 [(set_attr "type" "fdiv")
2097 (set_attr "trap" "yes")])
2100 [(set (match_operand:DF 0 "register_operand" "=f")
2101 (div:DF (float_extend:DF (match_operand:SF 1 "reg_or_fp0_operand" "fG"))
2102 (float_extend:DF (match_operand:SF 2 "reg_or_fp0_operand" "fG"))))]
2103 "TARGET_FP && alpha_tp != ALPHA_TP_INSN"
2104 "div%-%)%& %R1,%R2,%0"
2105 [(set_attr "type" "fdiv")
2106 (set_attr "trap" "yes")])
2109 [(set (match_operand:SF 0 "register_operand" "=&f")
2110 (mult:SF (match_operand:SF 1 "reg_or_fp0_operand" "%fG")
2111 (match_operand:SF 2 "reg_or_fp0_operand" "fG")))]
2112 "TARGET_FP && alpha_tp == ALPHA_TP_INSN"
2113 "mul%,%)%& %R1,%R2,%0"
2114 [(set_attr "type" "fmul")
2115 (set_attr "trap" "yes")])
2117 (define_insn "mulsf3"
2118 [(set (match_operand:SF 0 "register_operand" "=f")
2119 (mult:SF (match_operand:SF 1 "reg_or_fp0_operand" "%fG")
2120 (match_operand:SF 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 (match_operand:DF 1 "reg_or_fp0_operand" "%fG")
2129 (match_operand:DF 2 "reg_or_fp0_operand" "fG")))]
2130 "TARGET_FP && alpha_tp == ALPHA_TP_INSN"
2131 "mul%-%)%& %R1,%R2,%0"
2132 [(set_attr "type" "fmul")
2133 (set_attr "trap" "yes")])
2135 (define_insn "muldf3"
2136 [(set (match_operand:DF 0 "register_operand" "=f")
2137 (mult:DF (match_operand:DF 1 "reg_or_fp0_operand" "%fG")
2138 (match_operand:DF 2 "reg_or_fp0_operand" "fG")))]
2140 "mul%-%)%& %R1,%R2,%0"
2141 [(set_attr "type" "fmul")
2142 (set_attr "trap" "yes")])
2145 [(set (match_operand:DF 0 "register_operand" "=f")
2146 (mult:DF (float_extend:DF
2147 (match_operand:SF 1 "reg_or_fp0_operand" "fG"))
2148 (match_operand:DF 2 "reg_or_fp0_operand" "fG")))]
2149 "TARGET_FP && alpha_tp != ALPHA_TP_INSN"
2150 "mul%-%)%& %R1,%R2,%0"
2151 [(set_attr "type" "fmul")
2152 (set_attr "trap" "yes")])
2155 [(set (match_operand:DF 0 "register_operand" "=f")
2156 (mult:DF (float_extend:DF
2157 (match_operand:SF 1 "reg_or_fp0_operand" "%fG"))
2159 (match_operand:SF 2 "reg_or_fp0_operand" "fG"))))]
2160 "TARGET_FP && alpha_tp != ALPHA_TP_INSN"
2161 "mul%-%)%& %R1,%R2,%0"
2162 [(set_attr "type" "fmul")
2163 (set_attr "trap" "yes")])
2166 [(set (match_operand:SF 0 "register_operand" "=&f")
2167 (minus:SF (match_operand:SF 1 "reg_or_fp0_operand" "fG")
2168 (match_operand:SF 2 "reg_or_fp0_operand" "fG")))]
2169 "TARGET_FP && alpha_tp == ALPHA_TP_INSN"
2170 "sub%,%)%& %R1,%R2,%0"
2171 [(set_attr "type" "fadd")
2172 (set_attr "trap" "yes")])
2174 (define_insn "subsf3"
2175 [(set (match_operand:SF 0 "register_operand" "=f")
2176 (minus:SF (match_operand:SF 1 "reg_or_fp0_operand" "fG")
2177 (match_operand:SF 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 (match_operand:DF 1 "reg_or_fp0_operand" "fG")
2186 (match_operand:DF 2 "reg_or_fp0_operand" "fG")))]
2187 "TARGET_FP && alpha_tp == ALPHA_TP_INSN"
2188 "sub%-%)%& %R1,%R2,%0"
2189 [(set_attr "type" "fadd")
2190 (set_attr "trap" "yes")])
2192 (define_insn "subdf3"
2193 [(set (match_operand:DF 0 "register_operand" "=f")
2194 (minus:DF (match_operand:DF 1 "reg_or_fp0_operand" "fG")
2195 (match_operand:DF 2 "reg_or_fp0_operand" "fG")))]
2197 "sub%-%)%& %R1,%R2,%0"
2198 [(set_attr "type" "fadd")
2199 (set_attr "trap" "yes")])
2202 [(set (match_operand:DF 0 "register_operand" "=f")
2203 (minus:DF (float_extend:DF
2204 (match_operand:SF 1 "reg_or_fp0_operand" "fG"))
2205 (match_operand:DF 2 "reg_or_fp0_operand" "fG")))]
2206 "TARGET_FP && alpha_tp != ALPHA_TP_INSN"
2207 "sub%-%)%& %R1,%R2,%0"
2208 [(set_attr "type" "fadd")
2209 (set_attr "trap" "yes")])
2212 [(set (match_operand:DF 0 "register_operand" "=f")
2213 (minus:DF (match_operand:DF 1 "reg_or_fp0_operand" "fG")
2215 (match_operand:SF 2 "reg_or_fp0_operand" "fG"))))]
2216 "TARGET_FP && alpha_tp != ALPHA_TP_INSN"
2217 "sub%-%)%& %R1,%R2,%0"
2218 [(set_attr "type" "fadd")
2219 (set_attr "trap" "yes")])
2222 [(set (match_operand:DF 0 "register_operand" "=f")
2223 (minus:DF (float_extend:DF
2224 (match_operand:SF 1 "reg_or_fp0_operand" "fG"))
2226 (match_operand:SF 2 "reg_or_fp0_operand" "fG"))))]
2227 "TARGET_FP && alpha_tp != ALPHA_TP_INSN"
2228 "sub%-%)%& %R1,%R2,%0"
2229 [(set_attr "type" "fadd")
2230 (set_attr "trap" "yes")])
2233 [(set (match_operand:SF 0 "register_operand" "=&f")
2234 (sqrt:SF (match_operand:SF 1 "reg_or_fp0_operand" "fG")))]
2235 "TARGET_FP && TARGET_CIX && alpha_tp == ALPHA_TP_INSN"
2237 [(set_attr "type" "fsqrt")
2238 (set_attr "opsize" "si")
2239 (set_attr "trap" "yes")])
2241 (define_insn "sqrtsf2"
2242 [(set (match_operand:SF 0 "register_operand" "=f")
2243 (sqrt:SF (match_operand:SF 1 "reg_or_fp0_operand" "fG")))]
2244 "TARGET_FP && TARGET_CIX"
2246 [(set_attr "type" "fsqrt")
2247 (set_attr "opsize" "si")
2248 (set_attr "trap" "yes")])
2251 [(set (match_operand:DF 0 "register_operand" "=&f")
2252 (sqrt:DF (match_operand:DF 1 "reg_or_fp0_operand" "fG")))]
2253 "TARGET_FP && TARGET_CIX && alpha_tp == ALPHA_TP_INSN"
2255 [(set_attr "type" "fsqrt")
2256 (set_attr "trap" "yes")])
2258 (define_insn "sqrtdf2"
2259 [(set (match_operand:DF 0 "register_operand" "=f")
2260 (sqrt:DF (match_operand:DF 1 "reg_or_fp0_operand" "fG")))]
2261 "TARGET_FP && TARGET_CIX"
2263 [(set_attr "type" "fsqrt")
2264 (set_attr "trap" "yes")])
2266 ;; Next are all the integer comparisons, and conditional moves and branches
2267 ;; and some of the related define_expand's and define_split's.
2270 [(set (match_operand:DI 0 "register_operand" "=r")
2271 (match_operator:DI 1 "alpha_comparison_operator"
2272 [(match_operand:DI 2 "reg_or_0_operand" "rJ")
2273 (match_operand:DI 3 "reg_or_8bit_operand" "rI")]))]
2276 [(set_attr "type" "icmp")])
2279 [(set (match_operand:DI 0 "register_operand" "=r")
2280 (match_operator:DI 1 "alpha_swapped_comparison_operator"
2281 [(match_operand:DI 2 "reg_or_8bit_operand" "rI")
2282 (match_operand:DI 3 "reg_or_0_operand" "rJ")]))]
2285 [(set_attr "type" "icmp")])
2287 ;; This pattern exists so conditional moves of SImode values are handled.
2288 ;; Comparisons are still done in DImode though.
2291 [(set (match_operand:SI 0 "register_operand" "=r,r,r,r")
2293 (match_operator 2 "signed_comparison_operator"
2294 [(match_operand:DI 3 "reg_or_0_operand" "rJ,rJ,J,J")
2295 (match_operand:DI 4 "reg_or_0_operand" "J,J,rJ,rJ")])
2296 (match_operand:SI 1 "reg_or_8bit_operand" "rI,0,rI,0")
2297 (match_operand:SI 5 "reg_or_8bit_operand" "0,rI,0,rI")))]
2298 "operands[3] == const0_rtx || operands[4] == const0_rtx"
2304 [(set_attr "type" "icmov")])
2307 [(set (match_operand:DI 0 "register_operand" "=r,r,r,r")
2309 (match_operator 2 "signed_comparison_operator"
2310 [(match_operand:DI 3 "reg_or_0_operand" "rJ,rJ,J,J")
2311 (match_operand:DI 4 "reg_or_0_operand" "J,J,rJ,rJ")])
2312 (match_operand:DI 1 "reg_or_8bit_operand" "rI,0,rI,0")
2313 (match_operand:DI 5 "reg_or_8bit_operand" "0,rI,0,rI")))]
2314 "operands[3] == const0_rtx || operands[4] == const0_rtx"
2320 [(set_attr "type" "icmov")])
2323 [(set (match_operand:DI 0 "register_operand" "=r,r")
2325 (eq (zero_extract:DI (match_operand:DI 2 "reg_or_0_operand" "rJ,rJ")
2329 (match_operand:DI 1 "reg_or_8bit_operand" "rI,0")
2330 (match_operand:DI 3 "reg_or_8bit_operand" "0,rI")))]
2335 [(set_attr "type" "icmov")])
2338 [(set (match_operand:DI 0 "register_operand" "=r,r")
2340 (ne (zero_extract:DI (match_operand:DI 2 "reg_or_0_operand" "rJ,rJ")
2344 (match_operand:DI 1 "reg_or_8bit_operand" "rI,0")
2345 (match_operand:DI 3 "reg_or_8bit_operand" "0,rI")))]
2350 [(set_attr "type" "icmov")])
2352 ;; This form is added since combine thinks that an IF_THEN_ELSE with both
2353 ;; arms constant is a single insn, so it won't try to form it if combine
2354 ;; knows they are really two insns. This occurs in divides by powers
2358 [(set (match_operand:DI 0 "register_operand" "=r")
2360 (match_operator 2 "signed_comparison_operator"
2361 [(match_operand:DI 3 "reg_or_0_operand" "rJ")
2363 (plus:DI (match_dup 0)
2364 (match_operand:DI 1 "reg_or_8bit_operand" "rI"))
2366 (clobber (match_scratch:DI 4 "=&r"))]
2368 "addq %0,%1,%4\;cmov%C2 %r3,%4,%0"
2369 [(set_attr "type" "icmov")
2370 (set_attr "length" "8")])
2373 [(set (match_operand:DI 0 "register_operand" "")
2375 (match_operator 2 "signed_comparison_operator"
2376 [(match_operand:DI 3 "reg_or_0_operand" "")
2378 (plus:DI (match_dup 0)
2379 (match_operand:DI 1 "reg_or_8bit_operand" ""))
2381 (clobber (match_operand:DI 4 "register_operand" ""))]
2383 [(set (match_dup 4) (plus:DI (match_dup 0) (match_dup 1)))
2384 (set (match_dup 0) (if_then_else:DI (match_op_dup 2
2387 (match_dup 4) (match_dup 0)))]
2392 [(set (match_operand:DI 0 "register_operand" "")
2394 (match_operator 1 "comparison_operator"
2395 [(zero_extract:DI (match_operand:DI 2 "register_operand" "")
2397 (match_operand:DI 3 "const_int_operand" ""))
2399 (match_operand:DI 4 "reg_or_8bit_operand" "")
2400 (match_operand:DI 5 "reg_or_8bit_operand" "")))
2401 (clobber (match_operand:DI 6 "register_operand" ""))])]
2402 "INTVAL (operands[3]) != 0"
2404 (lshiftrt:DI (match_dup 2) (match_dup 3)))
2406 (if_then_else:DI (match_op_dup 1
2407 [(zero_extract:DI (match_dup 6)
2415 ;; For ABS, we have two choices, depending on whether the input and output
2416 ;; registers are the same or not.
2417 (define_expand "absdi2"
2418 [(set (match_operand:DI 0 "register_operand" "")
2419 (abs:DI (match_operand:DI 1 "register_operand" "")))]
2422 { if (rtx_equal_p (operands[0], operands[1]))
2423 emit_insn (gen_absdi2_same (operands[0], gen_reg_rtx (DImode)));
2425 emit_insn (gen_absdi2_diff (operands[0], operands[1]));
2430 (define_expand "absdi2_same"
2431 [(set (match_operand:DI 1 "register_operand" "")
2432 (neg:DI (match_operand:DI 0 "register_operand" "")))
2434 (if_then_else:DI (ge (match_dup 0) (const_int 0))
2440 (define_expand "absdi2_diff"
2441 [(set (match_operand:DI 0 "register_operand" "")
2442 (neg:DI (match_operand:DI 1 "register_operand" "")))
2444 (if_then_else:DI (lt (match_dup 1) (const_int 0))
2451 [(set (match_operand:DI 0 "register_operand" "")
2452 (abs:DI (match_dup 0)))
2453 (clobber (match_operand:DI 2 "register_operand" ""))]
2455 [(set (match_dup 1) (neg:DI (match_dup 0)))
2456 (set (match_dup 0) (if_then_else:DI (ge (match_dup 0) (const_int 0))
2457 (match_dup 0) (match_dup 1)))]
2461 [(set (match_operand:DI 0 "register_operand" "")
2462 (abs:DI (match_operand:DI 1 "register_operand" "")))]
2463 "! rtx_equal_p (operands[0], operands[1])"
2464 [(set (match_dup 0) (neg:DI (match_dup 1)))
2465 (set (match_dup 0) (if_then_else:DI (lt (match_dup 1) (const_int 0))
2466 (match_dup 0) (match_dup 1)))]
2470 [(set (match_operand:DI 0 "register_operand" "")
2471 (neg:DI (abs:DI (match_dup 0))))
2472 (clobber (match_operand:DI 2 "register_operand" ""))]
2474 [(set (match_dup 1) (neg:DI (match_dup 0)))
2475 (set (match_dup 0) (if_then_else:DI (le (match_dup 0) (const_int 0))
2476 (match_dup 0) (match_dup 1)))]
2480 [(set (match_operand:DI 0 "register_operand" "")
2481 (neg:DI (abs:DI (match_operand:DI 1 "register_operand" ""))))]
2482 "! rtx_equal_p (operands[0], operands[1])"
2483 [(set (match_dup 0) (neg:DI (match_dup 1)))
2484 (set (match_dup 0) (if_then_else:DI (gt (match_dup 1) (const_int 0))
2485 (match_dup 0) (match_dup 1)))]
2488 (define_insn "sminqi3"
2489 [(set (match_operand:QI 0 "register_operand" "=r")
2490 (smin:QI (match_operand:QI 1 "reg_or_0_operand" "%rJ")
2491 (match_operand:QI 2 "reg_or_8bit_operand" "rI")))]
2494 [(set_attr "type" "mvi")])
2496 (define_insn "uminqi3"
2497 [(set (match_operand:QI 0 "register_operand" "=r")
2498 (umin:QI (match_operand:QI 1 "reg_or_0_operand" "%rJ")
2499 (match_operand:QI 2 "reg_or_8bit_operand" "rI")))]
2502 [(set_attr "type" "mvi")])
2504 (define_insn "smaxqi3"
2505 [(set (match_operand:QI 0 "register_operand" "=r")
2506 (smax:QI (match_operand:QI 1 "reg_or_0_operand" "%rJ")
2507 (match_operand:QI 2 "reg_or_8bit_operand" "rI")))]
2510 [(set_attr "type" "mvi")])
2512 (define_insn "umaxqi3"
2513 [(set (match_operand:QI 0 "register_operand" "=r")
2514 (umax:QI (match_operand:QI 1 "reg_or_0_operand" "%rJ")
2515 (match_operand:QI 2 "reg_or_8bit_operand" "rI")))]
2518 [(set_attr "type" "mvi")])
2520 (define_insn "sminhi3"
2521 [(set (match_operand:HI 0 "register_operand" "=r")
2522 (smin:HI (match_operand:HI 1 "reg_or_0_operand" "%rJ")
2523 (match_operand:HI 2 "reg_or_8bit_operand" "rI")))]
2526 [(set_attr "type" "mvi")])
2528 (define_insn "uminhi3"
2529 [(set (match_operand:HI 0 "register_operand" "=r")
2530 (umin:HI (match_operand:HI 1 "reg_or_0_operand" "%rJ")
2531 (match_operand:HI 2 "reg_or_8bit_operand" "rI")))]
2534 [(set_attr "type" "mvi")])
2536 (define_insn "smaxhi3"
2537 [(set (match_operand:HI 0 "register_operand" "=r")
2538 (smax:HI (match_operand:HI 1 "reg_or_0_operand" "%rJ")
2539 (match_operand:HI 2 "reg_or_8bit_operand" "rI")))]
2542 [(set_attr "type" "mvi")])
2544 (define_insn "umaxhi3"
2545 [(set (match_operand:HI 0 "register_operand" "=r")
2546 (umax:HI (match_operand:HI 1 "reg_or_0_operand" "%rJ")
2547 (match_operand:HI 2 "reg_or_8bit_operand" "rI")))]
2550 [(set_attr "type" "shift")])
2552 (define_expand "smaxdi3"
2554 (le:DI (match_operand:DI 1 "reg_or_0_operand" "")
2555 (match_operand:DI 2 "reg_or_8bit_operand" "")))
2556 (set (match_operand:DI 0 "register_operand" "")
2557 (if_then_else:DI (eq (match_dup 3) (const_int 0))
2558 (match_dup 1) (match_dup 2)))]
2561 { operands[3] = gen_reg_rtx (DImode);
2565 [(set (match_operand:DI 0 "register_operand" "")
2566 (smax:DI (match_operand:DI 1 "reg_or_0_operand" "")
2567 (match_operand:DI 2 "reg_or_8bit_operand" "")))
2568 (clobber (match_operand:DI 3 "register_operand" ""))]
2569 "operands[2] != const0_rtx"
2570 [(set (match_dup 3) (le:DI (match_dup 1) (match_dup 2)))
2571 (set (match_dup 0) (if_then_else:DI (eq (match_dup 3) (const_int 0))
2572 (match_dup 1) (match_dup 2)))]
2576 [(set (match_operand:DI 0 "register_operand" "=r")
2577 (smax:DI (match_operand:DI 1 "register_operand" "0")
2581 [(set_attr "type" "icmov")])
2583 (define_expand "smindi3"
2585 (lt:DI (match_operand:DI 1 "reg_or_0_operand" "")
2586 (match_operand:DI 2 "reg_or_8bit_operand" "")))
2587 (set (match_operand:DI 0 "register_operand" "")
2588 (if_then_else:DI (ne (match_dup 3) (const_int 0))
2589 (match_dup 1) (match_dup 2)))]
2592 { operands[3] = gen_reg_rtx (DImode);
2596 [(set (match_operand:DI 0 "register_operand" "")
2597 (smin:DI (match_operand:DI 1 "reg_or_0_operand" "")
2598 (match_operand:DI 2 "reg_or_8bit_operand" "")))
2599 (clobber (match_operand:DI 3 "register_operand" ""))]
2600 "operands[2] != const0_rtx"
2601 [(set (match_dup 3) (lt:DI (match_dup 1) (match_dup 2)))
2602 (set (match_dup 0) (if_then_else:DI (ne (match_dup 3) (const_int 0))
2603 (match_dup 1) (match_dup 2)))]
2607 [(set (match_operand:DI 0 "register_operand" "=r")
2608 (smin:DI (match_operand:DI 1 "register_operand" "0")
2612 [(set_attr "type" "icmov")])
2614 (define_expand "umaxdi3"
2616 (leu:DI (match_operand:DI 1 "reg_or_0_operand" "")
2617 (match_operand:DI 2 "reg_or_8bit_operand" "")))
2618 (set (match_operand:DI 0 "register_operand" "")
2619 (if_then_else:DI (eq (match_dup 3) (const_int 0))
2620 (match_dup 1) (match_dup 2)))]
2623 { operands[3] = gen_reg_rtx (DImode);
2627 [(set (match_operand:DI 0 "register_operand" "")
2628 (umax:DI (match_operand:DI 1 "reg_or_0_operand" "")
2629 (match_operand:DI 2 "reg_or_8bit_operand" "")))
2630 (clobber (match_operand:DI 3 "register_operand" ""))]
2631 "operands[2] != const0_rtx"
2632 [(set (match_dup 3) (leu:DI (match_dup 1) (match_dup 2)))
2633 (set (match_dup 0) (if_then_else:DI (eq (match_dup 3) (const_int 0))
2634 (match_dup 1) (match_dup 2)))]
2637 (define_expand "umindi3"
2639 (ltu:DI (match_operand:DI 1 "reg_or_0_operand" "")
2640 (match_operand:DI 2 "reg_or_8bit_operand" "")))
2641 (set (match_operand:DI 0 "register_operand" "")
2642 (if_then_else:DI (ne (match_dup 3) (const_int 0))
2643 (match_dup 1) (match_dup 2)))]
2646 { operands[3] = gen_reg_rtx (DImode);
2650 [(set (match_operand:DI 0 "register_operand" "")
2651 (umin:DI (match_operand:DI 1 "reg_or_0_operand" "")
2652 (match_operand:DI 2 "reg_or_8bit_operand" "")))
2653 (clobber (match_operand:DI 3 "register_operand" ""))]
2654 "operands[2] != const0_rtx"
2655 [(set (match_dup 3) (ltu:DI (match_dup 1) (match_dup 2)))
2656 (set (match_dup 0) (if_then_else:DI (ne (match_dup 3) (const_int 0))
2657 (match_dup 1) (match_dup 2)))]
2663 (match_operator 1 "signed_comparison_operator"
2664 [(match_operand:DI 2 "reg_or_0_operand" "rJ")
2666 (label_ref (match_operand 0 "" ""))
2670 [(set_attr "type" "ibr")])
2675 (match_operator 1 "signed_comparison_operator"
2677 (match_operand:DI 2 "register_operand" "r")])
2678 (label_ref (match_operand 0 "" ""))
2682 [(set_attr "type" "ibr")])
2687 (ne (zero_extract:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
2691 (label_ref (match_operand 0 "" ""))
2695 [(set_attr "type" "ibr")])
2700 (eq (zero_extract:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
2704 (label_ref (match_operand 0 "" ""))
2708 [(set_attr "type" "ibr")])
2714 (match_operator 1 "comparison_operator"
2715 [(zero_extract:DI (match_operand:DI 2 "register_operand" "")
2717 (match_operand:DI 3 "const_int_operand" ""))
2719 (label_ref (match_operand 0 "" ""))
2721 (clobber (match_operand:DI 4 "register_operand" ""))])]
2722 "INTVAL (operands[3]) != 0"
2724 (lshiftrt:DI (match_dup 2) (match_dup 3)))
2726 (if_then_else (match_op_dup 1
2727 [(zero_extract:DI (match_dup 4)
2731 (label_ref (match_dup 0))
2735 ;; The following are the corresponding floating-point insns. Recall
2736 ;; we need to have variants that expand the arguments from SF mode
2740 [(set (match_operand:DF 0 "register_operand" "=&f")
2741 (match_operator:DF 1 "alpha_comparison_operator"
2742 [(match_operand:DF 2 "reg_or_fp0_operand" "fG")
2743 (match_operand:DF 3 "reg_or_fp0_operand" "fG")]))]
2744 "TARGET_FP && alpha_tp == ALPHA_TP_INSN"
2745 "cmp%-%C1%' %R2,%R3,%0"
2746 [(set_attr "type" "fadd")
2747 (set_attr "trap" "yes")])
2750 [(set (match_operand:DF 0 "register_operand" "=f")
2751 (match_operator:DF 1 "alpha_comparison_operator"
2752 [(match_operand:DF 2 "reg_or_fp0_operand" "fG")
2753 (match_operand:DF 3 "reg_or_fp0_operand" "fG")]))]
2754 "TARGET_FP && alpha_tp != ALPHA_TP_INSN"
2755 "cmp%-%C1%' %R2,%R3,%0"
2756 [(set_attr "type" "fadd")
2757 (set_attr "trap" "yes")])
2760 [(set (match_operand:DF 0 "register_operand" "=&f")
2761 (match_operator:DF 1 "alpha_comparison_operator"
2763 (match_operand:SF 2 "reg_or_fp0_operand" "fG"))
2764 (match_operand:DF 3 "reg_or_fp0_operand" "fG")]))]
2765 "TARGET_FP && alpha_tp == ALPHA_TP_INSN"
2766 "cmp%-%C1%' %R2,%R3,%0"
2767 [(set_attr "type" "fadd")
2768 (set_attr "trap" "yes")])
2771 [(set (match_operand:DF 0 "register_operand" "=f")
2772 (match_operator:DF 1 "alpha_comparison_operator"
2774 (match_operand:SF 2 "reg_or_fp0_operand" "fG"))
2775 (match_operand:DF 3 "reg_or_fp0_operand" "fG")]))]
2776 "TARGET_FP && alpha_tp != ALPHA_TP_INSN"
2777 "cmp%-%C1%' %R2,%R3,%0"
2778 [(set_attr "type" "fadd")
2779 (set_attr "trap" "yes")])
2782 [(set (match_operand:DF 0 "register_operand" "=&f")
2783 (match_operator:DF 1 "alpha_comparison_operator"
2784 [(match_operand:DF 2 "reg_or_fp0_operand" "fG")
2786 (match_operand:SF 3 "reg_or_fp0_operand" "fG"))]))]
2787 "TARGET_FP && alpha_tp == ALPHA_TP_INSN"
2788 "cmp%-%C1%' %R2,%R3,%0"
2789 [(set_attr "type" "fadd")
2790 (set_attr "trap" "yes")])
2793 [(set (match_operand:DF 0 "register_operand" "=f")
2794 (match_operator:DF 1 "alpha_comparison_operator"
2795 [(match_operand:DF 2 "reg_or_fp0_operand" "fG")
2797 (match_operand:SF 3 "reg_or_fp0_operand" "fG"))]))]
2798 "TARGET_FP && alpha_tp != ALPHA_TP_INSN"
2799 "cmp%-%C1%' %R2,%R3,%0"
2800 [(set_attr "type" "fadd")
2801 (set_attr "trap" "yes")])
2804 [(set (match_operand:DF 0 "register_operand" "=&f")
2805 (match_operator:DF 1 "alpha_comparison_operator"
2807 (match_operand:SF 2 "reg_or_fp0_operand" "fG"))
2809 (match_operand:SF 3 "reg_or_fp0_operand" "fG"))]))]
2810 "TARGET_FP && alpha_tp == ALPHA_TP_INSN"
2811 "cmp%-%C1%' %R2,%R3,%0"
2812 [(set_attr "type" "fadd")
2813 (set_attr "trap" "yes")])
2816 [(set (match_operand:DF 0 "register_operand" "=f")
2817 (match_operator:DF 1 "alpha_comparison_operator"
2819 (match_operand:SF 2 "reg_or_fp0_operand" "fG"))
2821 (match_operand:SF 3 "reg_or_fp0_operand" "fG"))]))]
2822 "TARGET_FP && alpha_tp != ALPHA_TP_INSN"
2823 "cmp%-%C1%' %R2,%R3,%0"
2824 [(set_attr "type" "fadd")
2825 (set_attr "trap" "yes")])
2828 [(set (match_operand:DF 0 "register_operand" "=f,f")
2830 (match_operator 3 "signed_comparison_operator"
2831 [(match_operand:DF 4 "reg_or_fp0_operand" "fG,fG")
2832 (match_operand:DF 2 "fp0_operand" "G,G")])
2833 (match_operand:DF 1 "reg_or_fp0_operand" "fG,0")
2834 (match_operand:DF 5 "reg_or_fp0_operand" "0,fG")))]
2838 fcmov%D3 %R4,%R5,%0"
2839 [(set_attr "type" "fcmov")])
2842 [(set (match_operand:SF 0 "register_operand" "=f,f")
2844 (match_operator 3 "signed_comparison_operator"
2845 [(match_operand:DF 4 "reg_or_fp0_operand" "fG,fG")
2846 (match_operand:DF 2 "fp0_operand" "G,G")])
2847 (match_operand:SF 1 "reg_or_fp0_operand" "fG,0")
2848 (match_operand:SF 5 "reg_or_fp0_operand" "0,fG")))]
2852 fcmov%D3 %R4,%R5,%0"
2853 [(set_attr "type" "fcmov")])
2856 [(set (match_operand:DF 0 "register_operand" "=f,f")
2858 (match_operator 3 "signed_comparison_operator"
2859 [(match_operand:DF 4 "reg_or_fp0_operand" "fG,fG")
2860 (match_operand:DF 2 "fp0_operand" "G,G")])
2861 (float_extend:DF (match_operand:SF 1 "reg_or_fp0_operand" "fG,0"))
2862 (match_operand:DF 5 "reg_or_fp0_operand" "0,fG")))]
2866 fcmov%D3 %R4,%R5,%0"
2867 [(set_attr "type" "fcmov")])
2870 [(set (match_operand:DF 0 "register_operand" "=f,f")
2872 (match_operator 3 "signed_comparison_operator"
2874 (match_operand:SF 4 "reg_or_fp0_operand" "fG,fG"))
2875 (match_operand:DF 2 "fp0_operand" "G,G")])
2876 (match_operand:DF 1 "reg_or_fp0_operand" "fG,0")
2877 (match_operand:DF 5 "reg_or_fp0_operand" "0,fG")))]
2881 fcmov%D3 %R4,%R5,%0"
2882 [(set_attr "type" "fcmov")])
2885 [(set (match_operand:SF 0 "register_operand" "=f,f")
2887 (match_operator 3 "signed_comparison_operator"
2889 (match_operand:SF 4 "reg_or_fp0_operand" "fG,fG"))
2890 (match_operand:DF 2 "fp0_operand" "G,G")])
2891 (match_operand:SF 1 "reg_or_fp0_operand" "fG,0")
2892 (match_operand:SF 5 "reg_or_fp0_operand" "0,fG")))]
2896 fcmov%D3 %R4,%R5,%0"
2897 [(set_attr "type" "fcmov")])
2900 [(set (match_operand:DF 0 "register_operand" "=f,f")
2902 (match_operator 3 "signed_comparison_operator"
2904 (match_operand:SF 4 "reg_or_fp0_operand" "fG,fG"))
2905 (match_operand:DF 2 "fp0_operand" "G,G")])
2906 (float_extend:DF (match_operand:SF 1 "reg_or_fp0_operand" "fG,0"))
2907 (match_operand:DF 5 "reg_or_fp0_operand" "0,fG")))]
2911 fcmov%D3 %R4,%R5,%0"
2912 [(set_attr "type" "fcmov")])
2914 (define_expand "maxdf3"
2916 (le:DF (match_operand:DF 1 "reg_or_fp0_operand" "")
2917 (match_operand:DF 2 "reg_or_fp0_operand" "")))
2918 (set (match_operand:DF 0 "register_operand" "")
2919 (if_then_else:DF (eq (match_dup 3) (match_dup 4))
2920 (match_dup 1) (match_dup 2)))]
2923 { operands[3] = gen_reg_rtx (DFmode);
2924 operands[4] = CONST0_RTX (DFmode);
2927 (define_expand "mindf3"
2929 (lt:DF (match_operand:DF 1 "reg_or_fp0_operand" "")
2930 (match_operand:DF 2 "reg_or_fp0_operand" "")))
2931 (set (match_operand:DF 0 "register_operand" "")
2932 (if_then_else:DF (ne (match_dup 3) (match_dup 4))
2933 (match_dup 1) (match_dup 2)))]
2936 { operands[3] = gen_reg_rtx (DFmode);
2937 operands[4] = CONST0_RTX (DFmode);
2940 (define_expand "maxsf3"
2942 (le:DF (float_extend:DF (match_operand:SF 1 "reg_or_fp0_operand" ""))
2943 (float_extend:DF (match_operand:SF 2 "reg_or_fp0_operand" ""))))
2944 (set (match_operand:SF 0 "register_operand" "")
2945 (if_then_else:SF (eq (match_dup 3) (match_dup 4))
2946 (match_dup 1) (match_dup 2)))]
2949 { operands[3] = gen_reg_rtx (DFmode);
2950 operands[4] = CONST0_RTX (DFmode);
2953 (define_expand "minsf3"
2955 (lt:DF (float_extend:DF (match_operand:SF 1 "reg_or_fp0_operand" ""))
2956 (float_extend:DF (match_operand:SF 2 "reg_or_fp0_operand" ""))))
2957 (set (match_operand:SF 0 "register_operand" "")
2958 (if_then_else:SF (ne (match_dup 3) (match_dup 4))
2959 (match_dup 1) (match_dup 2)))]
2962 { operands[3] = gen_reg_rtx (DFmode);
2963 operands[4] = CONST0_RTX (DFmode);
2969 (match_operator 1 "signed_comparison_operator"
2970 [(match_operand:DF 2 "reg_or_fp0_operand" "fG")
2971 (match_operand:DF 3 "fp0_operand" "G")])
2972 (label_ref (match_operand 0 "" ""))
2976 [(set_attr "type" "fbr")])
2981 (match_operator 1 "signed_comparison_operator"
2983 (match_operand:SF 2 "reg_or_fp0_operand" "fG"))
2984 (match_operand:DF 3 "fp0_operand" "G")])
2985 (label_ref (match_operand 0 "" ""))
2989 [(set_attr "type" "fbr")])
2991 ;; These are the main define_expand's used to make conditional branches
2994 (define_expand "cmpdf"
2995 [(set (cc0) (compare (match_operand:DF 0 "reg_or_fp0_operand" "")
2996 (match_operand:DF 1 "reg_or_fp0_operand" "")))]
3000 alpha_compare_op0 = operands[0];
3001 alpha_compare_op1 = operands[1];
3002 alpha_compare_fp_p = 1;
3006 (define_expand "cmpdi"
3007 [(set (cc0) (compare (match_operand:DI 0 "reg_or_0_operand" "")
3008 (match_operand:DI 1 "reg_or_8bit_operand" "")))]
3012 alpha_compare_op0 = operands[0];
3013 alpha_compare_op1 = operands[1];
3014 alpha_compare_fp_p = 0;
3018 (define_expand "beq"
3020 (if_then_else (match_dup 1)
3021 (label_ref (match_operand 0 "" ""))
3024 "{ operands[1] = alpha_emit_conditional_branch (EQ); }")
3026 (define_expand "bne"
3028 (if_then_else (match_dup 1)
3029 (label_ref (match_operand 0 "" ""))
3032 "{ operands[1] = alpha_emit_conditional_branch (NE); }")
3034 (define_expand "blt"
3036 (if_then_else (match_dup 1)
3037 (label_ref (match_operand 0 "" ""))
3040 "{ operands[1] = alpha_emit_conditional_branch (LT); }")
3042 (define_expand "ble"
3044 (if_then_else (match_dup 1)
3045 (label_ref (match_operand 0 "" ""))
3048 "{ operands[1] = alpha_emit_conditional_branch (LE); }")
3050 (define_expand "bgt"
3052 (if_then_else (match_dup 1)
3053 (label_ref (match_operand 0 "" ""))
3056 "{ operands[1] = alpha_emit_conditional_branch (GT); }")
3058 (define_expand "bge"
3060 (if_then_else (match_dup 1)
3061 (label_ref (match_operand 0 "" ""))
3064 "{ operands[1] = alpha_emit_conditional_branch (GE); }")
3066 (define_expand "bltu"
3068 (if_then_else (match_dup 1)
3069 (label_ref (match_operand 0 "" ""))
3072 "{ operands[1] = alpha_emit_conditional_branch (LTU); }")
3074 (define_expand "bleu"
3076 (if_then_else (match_dup 1)
3077 (label_ref (match_operand 0 "" ""))
3080 "{ operands[1] = alpha_emit_conditional_branch (LEU); }")
3082 (define_expand "bgtu"
3084 (if_then_else (match_dup 1)
3085 (label_ref (match_operand 0 "" ""))
3088 "{ operands[1] = alpha_emit_conditional_branch (GTU); }")
3090 (define_expand "bgeu"
3092 (if_then_else (match_dup 1)
3093 (label_ref (match_operand 0 "" ""))
3096 "{ operands[1] = alpha_emit_conditional_branch (GEU); }")
3098 (define_expand "seq"
3099 [(set (match_operand:DI 0 "register_operand" "")
3104 if (alpha_compare_fp_p)
3107 operands[1] = gen_rtx_EQ (DImode, alpha_compare_op0, alpha_compare_op1);
3110 (define_expand "sne"
3111 [(set (match_operand:DI 0 "register_operand" "")
3113 (set (match_dup 0) (xor:DI (match_dup 0) (const_int 1)))]
3117 if (alpha_compare_fp_p)
3120 operands[1] = gen_rtx_EQ (DImode, alpha_compare_op0, alpha_compare_op1);
3123 (define_expand "slt"
3124 [(set (match_operand:DI 0 "register_operand" "")
3129 if (alpha_compare_fp_p)
3132 operands[1] = gen_rtx_LT (DImode, alpha_compare_op0, alpha_compare_op1);
3135 (define_expand "sle"
3136 [(set (match_operand:DI 0 "register_operand" "")
3141 if (alpha_compare_fp_p)
3144 operands[1] = gen_rtx_LE (DImode, alpha_compare_op0, alpha_compare_op1);
3147 (define_expand "sgt"
3148 [(set (match_operand:DI 0 "register_operand" "")
3153 if (alpha_compare_fp_p)
3156 operands[1] = gen_rtx_LT (DImode, force_reg (DImode, alpha_compare_op1),
3160 (define_expand "sge"
3161 [(set (match_operand:DI 0 "register_operand" "")
3166 if (alpha_compare_fp_p)
3169 operands[1] = gen_rtx_LE (DImode, force_reg (DImode, alpha_compare_op1),
3173 (define_expand "sltu"
3174 [(set (match_operand:DI 0 "register_operand" "")
3179 if (alpha_compare_fp_p)
3182 operands[1] = gen_rtx_LTU (DImode, alpha_compare_op0, alpha_compare_op1);
3185 (define_expand "sleu"
3186 [(set (match_operand:DI 0 "register_operand" "")
3191 if (alpha_compare_fp_p)
3194 operands[1] = gen_rtx_LEU (DImode, alpha_compare_op0, alpha_compare_op1);
3197 (define_expand "sgtu"
3198 [(set (match_operand:DI 0 "register_operand" "")
3203 if (alpha_compare_fp_p)
3206 operands[1] = gen_rtx_LTU (DImode, force_reg (DImode, alpha_compare_op1),
3210 (define_expand "sgeu"
3211 [(set (match_operand:DI 0 "register_operand" "")
3216 if (alpha_compare_fp_p)
3219 operands[1] = gen_rtx_LEU (DImode, force_reg (DImode, alpha_compare_op1),
3223 ;; These are the main define_expand's used to make conditional moves.
3225 (define_expand "movsicc"
3226 [(set (match_operand:SI 0 "register_operand" "")
3227 (if_then_else:SI (match_operand 1 "comparison_operator" "")
3228 (match_operand:SI 2 "reg_or_8bit_operand" "")
3229 (match_operand:SI 3 "reg_or_8bit_operand" "")))]
3233 if ((operands[1] = alpha_emit_conditional_move (operands[1], SImode)) == 0)
3237 (define_expand "movdicc"
3238 [(set (match_operand:DI 0 "register_operand" "")
3239 (if_then_else:DI (match_operand 1 "comparison_operator" "")
3240 (match_operand:DI 2 "reg_or_8bit_operand" "")
3241 (match_operand:DI 3 "reg_or_8bit_operand" "")))]
3245 if ((operands[1] = alpha_emit_conditional_move (operands[1], DImode)) == 0)
3249 (define_expand "movsfcc"
3250 [(set (match_operand:SF 0 "register_operand" "")
3251 (if_then_else:SF (match_operand 1 "comparison_operator" "")
3252 (match_operand:SF 2 "reg_or_8bit_operand" "")
3253 (match_operand:SF 3 "reg_or_8bit_operand" "")))]
3257 if ((operands[1] = alpha_emit_conditional_move (operands[1], SFmode)) == 0)
3261 (define_expand "movdfcc"
3262 [(set (match_operand:DF 0 "register_operand" "")
3263 (if_then_else:DF (match_operand 1 "comparison_operator" "")
3264 (match_operand:DF 2 "reg_or_8bit_operand" "")
3265 (match_operand:DF 3 "reg_or_8bit_operand" "")))]
3269 if ((operands[1] = alpha_emit_conditional_move (operands[1], DFmode)) == 0)
3273 ;; These define_split definitions are used in cases when comparisons have
3274 ;; not be stated in the correct way and we need to reverse the second
3275 ;; comparison. For example, x >= 7 has to be done as x < 6 with the
3276 ;; comparison that tests the result being reversed. We have one define_split
3277 ;; for each use of a comparison. They do not match valid insns and need
3278 ;; not generate valid insns.
3280 ;; We can also handle equality comparisons (and inequality comparisons in
3281 ;; cases where the resulting add cannot overflow) by doing an add followed by
3282 ;; a comparison with zero. This is faster since the addition takes one
3283 ;; less cycle than a compare when feeding into a conditional move.
3284 ;; For this case, we also have an SImode pattern since we can merge the add
3285 ;; and sign extend and the order doesn't matter.
3287 ;; We do not do this for floating-point, since it isn't clear how the "wrong"
3288 ;; operation could have been generated.
3291 [(set (match_operand:DI 0 "register_operand" "")
3293 (match_operator 1 "comparison_operator"
3294 [(match_operand:DI 2 "reg_or_0_operand" "")
3295 (match_operand:DI 3 "reg_or_cint_operand" "")])
3296 (match_operand:DI 4 "reg_or_cint_operand" "")
3297 (match_operand:DI 5 "reg_or_cint_operand" "")))
3298 (clobber (match_operand:DI 6 "register_operand" ""))]
3299 "operands[3] != const0_rtx"
3300 [(set (match_dup 6) (match_dup 7))
3302 (if_then_else:DI (match_dup 8) (match_dup 4) (match_dup 5)))]
3304 { enum rtx_code code = GET_CODE (operands[1]);
3305 int unsignedp = (code == GEU || code == LEU || code == GTU || code == LTU);
3307 /* If we are comparing for equality with a constant and that constant
3308 appears in the arm when the register equals the constant, use the
3309 register since that is more likely to match (and to produce better code
3312 if (code == EQ && GET_CODE (operands[3]) == CONST_INT
3313 && rtx_equal_p (operands[4], operands[3]))
3314 operands[4] = operands[2];
3316 else if (code == NE && GET_CODE (operands[3]) == CONST_INT
3317 && rtx_equal_p (operands[5], operands[3]))
3318 operands[5] = operands[2];
3320 if (code == NE || code == EQ
3321 || (extended_count (operands[2], DImode, unsignedp) >= 1
3322 && extended_count (operands[3], DImode, unsignedp) >= 1))
3324 if (GET_CODE (operands[3]) == CONST_INT)
3325 operands[7] = gen_rtx_PLUS (DImode, operands[2],
3326 GEN_INT (- INTVAL (operands[3])));
3328 operands[7] = gen_rtx_MINUS (DImode, operands[2], operands[3]);
3330 operands[8] = gen_rtx_fmt_ee (code, VOIDmode, operands[6], const0_rtx);
3333 else if (code == EQ || code == LE || code == LT
3334 || code == LEU || code == LTU)
3336 operands[7] = gen_rtx_fmt_ee (code, DImode, operands[2], operands[3]);
3337 operands[8] = gen_rtx_NE (VOIDmode, operands[6], const0_rtx);
3341 operands[7] = gen_rtx_fmt_ee (reverse_condition (code), DImode,
3342 operands[2], operands[3]);
3343 operands[8] = gen_rtx_EQ (VOIDmode, operands[6], const0_rtx);
3348 [(set (match_operand:DI 0 "register_operand" "")
3350 (match_operator 1 "comparison_operator"
3351 [(match_operand:SI 2 "reg_or_0_operand" "")
3352 (match_operand:SI 3 "reg_or_cint_operand" "")])
3353 (match_operand:DI 4 "reg_or_8bit_operand" "")
3354 (match_operand:DI 5 "reg_or_8bit_operand" "")))
3355 (clobber (match_operand:DI 6 "register_operand" ""))]
3356 "operands[3] != const0_rtx
3357 && (GET_CODE (operands[1]) == EQ || GET_CODE (operands[1]) == NE)"
3358 [(set (match_dup 6) (match_dup 7))
3360 (if_then_else:DI (match_dup 8) (match_dup 4) (match_dup 5)))]
3362 { enum rtx_code code = GET_CODE (operands[1]);
3363 int unsignedp = (code == GEU || code == LEU || code == GTU || code == LTU);
3366 if ((code != NE && code != EQ
3367 && ! (extended_count (operands[2], DImode, unsignedp) >= 1
3368 && extended_count (operands[3], DImode, unsignedp) >= 1)))
3371 if (GET_CODE (operands[3]) == CONST_INT)
3372 tem = gen_rtx_PLUS (SImode, operands[2],
3373 GEN_INT (- INTVAL (operands[3])));
3375 tem = gen_rtx_MINUS (SImode, operands[2], operands[3]);
3377 operands[7] = gen_rtx_SIGN_EXTEND (DImode, tem);
3378 operands[8] = gen_rtx_fmt_ee (GET_CODE (operands[1]), VOIDmode,
3379 operands[6], const0_rtx);
3385 (match_operator 1 "comparison_operator"
3386 [(match_operand:DI 2 "reg_or_0_operand" "")
3387 (match_operand:DI 3 "reg_or_cint_operand" "")])
3388 (label_ref (match_operand 0 "" ""))
3390 (clobber (match_operand:DI 4 "register_operand" ""))]
3391 "operands[3] != const0_rtx"
3392 [(set (match_dup 4) (match_dup 5))
3393 (set (pc) (if_then_else (match_dup 6) (label_ref (match_dup 0)) (pc)))]
3395 { enum rtx_code code = GET_CODE (operands[1]);
3396 int unsignedp = (code == GEU || code == LEU || code == GTU || code == LTU);
3398 if (code == NE || code == EQ
3399 || (extended_count (operands[2], DImode, unsignedp) >= 1
3400 && extended_count (operands[3], DImode, unsignedp) >= 1))
3402 if (GET_CODE (operands[3]) == CONST_INT)
3403 operands[5] = gen_rtx_PLUS (DImode, operands[2],
3404 GEN_INT (- INTVAL (operands[3])));
3406 operands[5] = gen_rtx_MINUS (DImode, operands[2], operands[3]);
3408 operands[6] = gen_rtx_fmt_ee (code, VOIDmode, operands[4], const0_rtx);
3411 else if (code == EQ || code == LE || code == LT
3412 || code == LEU || code == LTU)
3414 operands[5] = gen_rtx_fmt_ee (code, DImode, operands[2], operands[3]);
3415 operands[6] = gen_rtx_NE (VOIDmode, operands[4], const0_rtx);
3419 operands[5] = gen_rtx_fmt_ee (reverse_condition (code), DImode,
3420 operands[2], operands[3]);
3421 operands[6] = gen_rtx_EQ (VOIDmode, operands[4], const0_rtx);
3428 (match_operator 1 "comparison_operator"
3429 [(match_operand:SI 2 "reg_or_0_operand" "")
3430 (match_operand:SI 3 "const_int_operand" "")])
3431 (label_ref (match_operand 0 "" ""))
3433 (clobber (match_operand:DI 4 "register_operand" ""))]
3434 "operands[3] != const0_rtx
3435 && (GET_CODE (operands[1]) == EQ || GET_CODE (operands[1]) == NE)"
3436 [(set (match_dup 4) (match_dup 5))
3437 (set (pc) (if_then_else (match_dup 6) (label_ref (match_dup 0)) (pc)))]
3441 if (GET_CODE (operands[3]) == CONST_INT)
3442 tem = gen_rtx_PLUS (SImode, operands[2],
3443 GEN_INT (- INTVAL (operands[3])));
3445 tem = gen_rtx_MINUS (SImode, operands[2], operands[3]);
3447 operands[5] = gen_rtx_SIGN_EXTEND (DImode, tem);
3448 operands[6] = gen_rtx_fmt_ee (GET_CODE (operands[1]), VOIDmode,
3449 operands[4], const0_rtx);
3452 ;; We can convert such things as "a > 0xffff" to "t = a & ~ 0xffff; t != 0".
3453 ;; This eliminates one, and sometimes two, insns when the AND can be done
3456 [(set (match_operand:DI 0 "register_operand" "")
3457 (match_operator 1 "comparison_operator"
3458 [(match_operand:DI 2 "register_operand" "")
3459 (match_operand:DI 3 "const_int_operand" "")]))
3460 (clobber (match_operand:DI 4 "register_operand" ""))]
3461 "exact_log2 (INTVAL (operands[3]) + 1) >= 0
3462 && (GET_CODE (operands[1]) == GTU
3463 || GET_CODE (operands[1]) == LEU
3464 || ((GET_CODE (operands[1]) == GT || GET_CODE (operands[1]) == LE)
3465 && extended_count (operands[2], DImode, 1) > 0))"
3466 [(set (match_dup 4) (and:DI (match_dup 2) (match_dup 5)))
3467 (set (match_dup 0) (match_dup 6))]
3470 operands[5] = GEN_INT (~ INTVAL (operands[3]));
3471 operands[6] = gen_rtx_fmt_ee (((GET_CODE (operands[1]) == GTU
3472 || GET_CODE (operands[1]) == GT)
3474 DImode, operands[4], const0_rtx);
3477 ;; Here are the CALL and unconditional branch insns. Calls on NT and OSF
3478 ;; work differently, so we have different patterns for each.
3480 (define_expand "call"
3481 [(use (match_operand:DI 0 "" ""))
3482 (use (match_operand 1 "" ""))
3483 (use (match_operand 2 "" ""))
3484 (use (match_operand 3 "" ""))]
3487 { if (TARGET_WINDOWS_NT)
3488 emit_call_insn (gen_call_nt (operands[0], operands[1]));
3489 else if (TARGET_OPEN_VMS)
3490 emit_call_insn (gen_call_vms (operands[0], operands[2]));
3492 emit_call_insn (gen_call_osf (operands[0], operands[1]));
3497 (define_expand "call_osf"
3498 [(parallel [(call (mem:DI (match_operand 0 "" ""))
3499 (match_operand 1 "" ""))
3500 (clobber (reg:DI 27))
3501 (clobber (reg:DI 26))])]
3504 { if (GET_CODE (operands[0]) != MEM)
3507 operands[0] = XEXP (operands[0], 0);
3509 if (GET_CODE (operands[0]) != SYMBOL_REF
3510 && ! (GET_CODE (operands[0]) == REG && REGNO (operands[0]) == 27))
3512 rtx tem = gen_rtx_REG (DImode, 27);
3513 emit_move_insn (tem, operands[0]);
3518 (define_expand "call_nt"
3519 [(parallel [(call (mem:DI (match_operand 0 "" ""))
3520 (match_operand 1 "" ""))
3521 (clobber (reg:DI 26))])]
3524 { if (GET_CODE (operands[0]) != MEM)
3527 operands[0] = XEXP (operands[0], 0);
3528 if (GET_CODE (operands[0]) != SYMBOL_REF && GET_CODE (operands[0]) != REG)
3529 operands[0] = force_reg (DImode, operands[0]);
3533 ;; call openvms/alpha
3534 ;; op 0: symbol ref for called function
3535 ;; op 1: next_arg_reg (argument information value for R25)
3537 (define_expand "call_vms"
3538 [(parallel [(call (mem:DI (match_operand 0 "" ""))
3539 (match_operand 1 "" ""))
3543 (clobber (reg:DI 27))])]
3546 { if (GET_CODE (operands[0]) != MEM)
3549 operands[0] = XEXP (operands[0], 0);
3551 /* Always load AI with argument information, then handle symbolic and
3552 indirect call differently. Load RA and set operands[2] to PV in
3555 emit_move_insn (gen_rtx_REG (DImode, 25), operands[1]);
3556 if (GET_CODE (operands[0]) == SYMBOL_REF)
3558 extern char *savealloc ();
3559 char *linksym, *symbol = XSTR (operands[0], 0);
3564 linksym = savealloc (strlen (symbol) + 6);
3566 alpha_need_linkage (symbol, 0);
3569 strcpy (linksym+1, symbol);
3570 strcat (linksym, \"..lk\");
3571 linkage = gen_rtx_SYMBOL_REF (Pmode, linksym);
3573 emit_move_insn (gen_rtx_REG (Pmode, 26), gen_rtx_MEM (Pmode, linkage));
3576 = validize_mem (gen_rtx_MEM (Pmode, plus_constant (linkage, 8)));
3580 emit_move_insn (gen_rtx_REG (Pmode, 26),
3581 gen_rtx_MEM (Pmode, plus_constant (operands[0], 8)));
3583 operands[2] = operands[0];
3588 (define_expand "call_value"
3589 [(use (match_operand 0 "" ""))
3590 (use (match_operand:DI 1 "" ""))
3591 (use (match_operand 2 "" ""))
3592 (use (match_operand 3 "" ""))
3593 (use (match_operand 4 "" ""))]
3596 { if (TARGET_WINDOWS_NT)
3597 emit_call_insn (gen_call_value_nt (operands[0], operands[1], operands[2]));
3598 else if (TARGET_OPEN_VMS)
3599 emit_call_insn (gen_call_value_vms (operands[0], operands[1],
3602 emit_call_insn (gen_call_value_osf (operands[0], operands[1],
3607 (define_expand "call_value_osf"
3608 [(parallel [(set (match_operand 0 "" "")
3609 (call (mem:DI (match_operand 1 "" ""))
3610 (match_operand 2 "" "")))
3611 (clobber (reg:DI 27))
3612 (clobber (reg:DI 26))])]
3615 { if (GET_CODE (operands[1]) != MEM)
3618 operands[1] = XEXP (operands[1], 0);
3620 if (GET_CODE (operands[1]) != SYMBOL_REF
3621 && ! (GET_CODE (operands[1]) == REG && REGNO (operands[1]) == 27))
3623 rtx tem = gen_rtx_REG (DImode, 27);
3624 emit_move_insn (tem, operands[1]);
3629 (define_expand "call_value_nt"
3630 [(parallel [(set (match_operand 0 "" "")
3631 (call (mem:DI (match_operand 1 "" ""))
3632 (match_operand 2 "" "")))
3633 (clobber (reg:DI 26))])]
3636 { if (GET_CODE (operands[1]) != MEM)
3639 operands[1] = XEXP (operands[1], 0);
3640 if (GET_CODE (operands[0]) != SYMBOL_REF && GET_CODE (operands[0]) != REG)
3641 operands[1] = force_reg (DImode, operands[1]);
3644 (define_expand "call_value_vms"
3645 [(parallel [(set (match_operand 0 "" "")
3646 (call (mem:DI (match_operand:DI 1 "" ""))
3647 (match_operand 2 "" "")))
3651 (clobber (reg:DI 27))])]
3654 { if (GET_CODE (operands[1]) != MEM)
3657 operands[1] = XEXP (operands[1], 0);
3659 /* Always load AI with argument information, then handle symbolic and
3660 indirect call differently. Load RA and set operands[3] to PV in
3663 emit_move_insn (gen_rtx_REG (DImode, 25), operands[2]);
3664 if (GET_CODE (operands[1]) == SYMBOL_REF)
3666 extern char *savealloc ();
3667 char *linksym, *symbol = XSTR (operands[1], 0);
3672 linksym = savealloc (strlen (symbol) + 6);
3674 alpha_need_linkage (symbol, 0);
3676 strcpy (linksym+1, symbol);
3677 strcat (linksym, \"..lk\");
3678 linkage = gen_rtx_SYMBOL_REF (Pmode, linksym);
3680 emit_move_insn (gen_rtx_REG (Pmode, 26), gen_rtx_MEM (Pmode, linkage));
3683 = validize_mem (gen_rtx_MEM (Pmode, plus_constant (linkage, 8)));
3687 emit_move_insn (gen_rtx_REG (Pmode, 26),
3688 gen_rtx_MEM (Pmode, plus_constant (operands[1], 8)));
3690 operands[3] = operands[1];
3695 [(call (mem:DI (match_operand:DI 0 "call_operand" "r,R,i"))
3696 (match_operand 1 "" ""))
3697 (clobber (reg:DI 27))
3698 (clobber (reg:DI 26))]
3699 "! TARGET_WINDOWS_NT && ! TARGET_OPEN_VMS"
3701 jsr $26,($27),0\;ldgp $29,0($26)
3703 jsr $26,%0\;ldgp $29,0($26)"
3704 [(set_attr "type" "jsr")
3705 (set_attr "length" "12,*,12")])
3708 [(call (mem:DI (match_operand:DI 0 "call_operand" "r,R,i"))
3709 (match_operand 1 "" ""))
3710 (clobber (reg:DI 26))]
3716 [(set_attr "type" "jsr")
3717 (set_attr "length" "*,*,12")])
3720 [(call (mem:DI (match_operand:DI 0 "call_operand" "r,i"))
3721 (match_operand 1 "" ""))
3722 (use (match_operand:DI 2 "general_operand" "r,m"))
3725 (clobber (reg:DI 27))]
3728 bis %2,%2,$27\;jsr $26,0\;ldq $27,0($29)
3729 ldq $27,%2\;jsr $26,%0\;ldq $27,0($29)"
3730 [(set_attr "type" "jsr")
3731 (set_attr "length" "12,16")])
3734 [(set (match_operand 0 "register_operand" "=rf,rf,rf")
3735 (call (mem:DI (match_operand:DI 1 "call_operand" "r,R,i"))
3736 (match_operand 2 "" "")))
3737 (clobber (reg:DI 27))
3738 (clobber (reg:DI 26))]
3739 "! TARGET_WINDOWS_NT && ! TARGET_OPEN_VMS"
3741 jsr $26,($27),0\;ldgp $29,0($26)
3743 jsr $26,%1\;ldgp $29,0($26)"
3744 [(set_attr "type" "jsr")
3745 (set_attr "length" "12,*,12")])
3748 [(set (match_operand 0 "register_operand" "=rf,rf,rf")
3749 (call (mem:DI (match_operand:DI 1 "call_operand" "r,R,i"))
3750 (match_operand 2 "" "")))
3751 (clobber (reg:DI 26))]
3757 [(set_attr "type" "jsr")
3758 (set_attr "length" "*,*,12")])
3761 [(set (match_operand 0 "register_operand" "")
3762 (call (mem:DI (match_operand:DI 1 "call_operand" "r,i"))
3763 (match_operand 2 "" "")))
3764 (use (match_operand:DI 3 "general_operand" "r,m"))
3767 (clobber (reg:DI 27))]
3770 bis %3,%3,$27\;jsr $26,0\;ldq $27,0($29)
3771 ldq $27,%3\;jsr $26,%1\;ldq $27,0($29)"
3772 [(set_attr "type" "jsr")
3773 (set_attr "length" "12,16")])
3775 ;; Call subroutine returning any type.
3777 (define_expand "untyped_call"
3778 [(parallel [(call (match_operand 0 "" "")
3780 (match_operand 1 "" "")
3781 (match_operand 2 "" "")])]
3787 emit_call_insn (gen_call (operands[0], const0_rtx, NULL, const0_rtx));
3789 for (i = 0; i < XVECLEN (operands[2], 0); i++)
3791 rtx set = XVECEXP (operands[2], 0, i);
3792 emit_move_insn (SET_DEST (set), SET_SRC (set));
3795 /* The optimizer does not know that the call sets the function value
3796 registers we stored in the result block. We avoid problems by
3797 claiming that all hard registers are used and clobbered at this
3799 emit_insn (gen_blockage ());
3804 ;; UNSPEC_VOLATILE is considered to use and clobber all hard registers and
3805 ;; all of memory. This blocks insns from being moved across this point.
3807 (define_insn "blockage"
3808 [(unspec_volatile [(const_int 0)] 1)]
3811 [(set_attr "length" "0")])
3815 (label_ref (match_operand 0 "" "")))]
3818 [(set_attr "type" "ibr")])
3820 (define_insn "return"
3824 [(set_attr "type" "ibr")])
3826 ;; Use a different pattern for functions which have non-trivial
3827 ;; epilogues so as not to confuse jump and reorg.
3828 (define_insn "return_internal"
3833 [(set_attr "type" "ibr")])
3835 (define_insn "indirect_jump"
3836 [(set (pc) (match_operand:DI 0 "register_operand" "r"))]
3839 [(set_attr "type" "ibr")])
3841 (define_expand "tablejump"
3842 [(use (match_operand:SI 0 "register_operand" ""))
3843 (use (match_operand:SI 1 "" ""))]
3847 if (TARGET_WINDOWS_NT)
3848 emit_jump_insn (gen_tablejump_nt (operands[0], operands[1]));
3849 else if (TARGET_OPEN_VMS)
3850 emit_jump_insn (gen_tablejump_vms (operands[0], operands[1]));
3852 emit_jump_insn (gen_tablejump_osf (operands[0], operands[1]));
3857 (define_expand "tablejump_osf"
3859 (sign_extend:DI (match_operand:SI 0 "register_operand" "")))
3860 (parallel [(set (pc)
3861 (plus:DI (match_dup 3)
3862 (label_ref:DI (match_operand 1 "" ""))))
3863 (clobber (match_scratch:DI 2 "=r"))])]
3866 { operands[3] = gen_reg_rtx (DImode); }")
3868 (define_expand "tablejump_nt"
3870 (sign_extend:DI (match_operand:SI 0 "register_operand" "")))
3871 (parallel [(set (pc)
3873 (use (label_ref (match_operand 1 "" "")))])]
3876 { operands[3] = gen_reg_rtx (DImode); }")
3879 ;; tablejump, openVMS way
3881 ;; op 1: label preceding jump-table
3883 (define_expand "tablejump_vms"
3885 (match_operand:DI 0 "register_operand" ""))
3887 (plus:DI (match_dup 2)
3888 (label_ref:DI (match_operand 1 "" ""))))]
3891 { operands[2] = gen_reg_rtx (DImode); }")
3895 (plus:DI (match_operand:DI 0 "register_operand" "r")
3896 (label_ref:DI (match_operand 1 "" ""))))
3897 (clobber (match_scratch:DI 2 "=r"))]
3898 "! TARGET_WINDOWS_NT && ! TARGET_OPEN_VMS && next_active_insn (insn) != 0
3899 && GET_CODE (PATTERN (next_active_insn (insn))) == ADDR_DIFF_VEC
3900 && PREV_INSN (next_active_insn (insn)) == operands[1]"
3902 { rtx best_label = 0;
3903 rtx jump_table_insn = next_active_insn (operands[1]);
3905 if (GET_CODE (jump_table_insn) == JUMP_INSN
3906 && GET_CODE (PATTERN (jump_table_insn)) == ADDR_DIFF_VEC)
3908 rtx jump_table = PATTERN (jump_table_insn);
3909 int n_labels = XVECLEN (jump_table, 1);
3910 int best_count = -1;
3913 for (i = 0; i < n_labels; i++)
3917 for (j = i + 1; j < n_labels; j++)
3918 if (XEXP (XVECEXP (jump_table, 1, i), 0)
3919 == XEXP (XVECEXP (jump_table, 1, j), 0))
3922 if (count > best_count)
3923 best_count = count, best_label = XVECEXP (jump_table, 1, i);
3929 operands[3] = best_label;
3930 return \"addq %0,$29,%2\;jmp $31,(%2),%3\";
3933 return \"addq %0,$29,%2\;jmp $31,(%2),0\";
3935 [(set_attr "type" "ibr")
3936 (set_attr "length" "8")])
3940 (match_operand:DI 0 "register_operand" "r"))
3941 (use (label_ref (match_operand 1 "" "")))]
3942 "TARGET_WINDOWS_NT && next_active_insn (insn) != 0
3943 && GET_CODE (PATTERN (next_active_insn (insn))) == ADDR_DIFF_VEC
3944 && PREV_INSN (next_active_insn (insn)) == operands[1]"
3946 { rtx best_label = 0;
3947 rtx jump_table_insn = next_active_insn (operands[1]);
3949 if (GET_CODE (jump_table_insn) == JUMP_INSN
3950 && GET_CODE (PATTERN (jump_table_insn)) == ADDR_DIFF_VEC)
3952 rtx jump_table = PATTERN (jump_table_insn);
3953 int n_labels = XVECLEN (jump_table, 1);
3954 int best_count = -1;
3957 for (i = 0; i < n_labels; i++)
3961 for (j = i + 1; j < n_labels; j++)
3962 if (XEXP (XVECEXP (jump_table, 1, i), 0)
3963 == XEXP (XVECEXP (jump_table, 1, j), 0))
3966 if (count > best_count)
3967 best_count = count, best_label = XVECEXP (jump_table, 1, i);
3973 operands[2] = best_label;
3974 return \"jmp $31,(%0),%2\";
3977 return \"jmp $31,(%0),0\";
3979 [(set_attr "type" "ibr")])
3982 ;; op 0 is table offset
3983 ;; op 1 is table label
3988 (plus:DI (match_operand 0 "register_operand" "r")
3989 (label_ref (match_operand 1 "" ""))))]
3992 [(set_attr "type" "ibr")])
3994 ;; Cache flush. Used by INITIALIZE_TRAMPOLINE. 0x86 is PAL_imb, but we don't
3995 ;; want to have to include pal.h in our .s file.
3997 ;; Technically the type for call_pal is jsr, but we use that for determining
3998 ;; if we need a GP. Use ibr instead since it has the same EV5 scheduling
4001 [(unspec_volatile [(const_int 0)] 0)]
4004 [(set_attr "type" "ibr")])
4006 ;; Finally, we have the basic data motion insns. The byte and word insns
4007 ;; are done via define_expand. Start with the floating-point insns, since
4008 ;; they are simpler.
4011 [(set (match_operand:SF 0 "nonimmediate_operand" "=r,r,m,f,f,f,m")
4012 (match_operand:SF 1 "input_operand" "rG,m,rG,f,G,m,fG"))]
4014 && (register_operand (operands[0], SFmode)
4015 || reg_or_fp0_operand (operands[1], SFmode))"
4024 [(set_attr "type" "ilog,ild,ist,fcpys,fcpys,fld,fst")])
4027 [(set (match_operand:SF 0 "nonimmediate_operand" "=r,r,m,f,f,f,m,f,*r")
4028 (match_operand:SF 1 "input_operand" "rG,m,rG,f,G,m,fG,r,*f"))]
4030 && (register_operand (operands[0], SFmode)
4031 || reg_or_fp0_operand (operands[1], SFmode))"
4042 [(set_attr "type" "ilog,ild,ist,fcpys,fcpys,fld,fst,itof,ftoi")])
4045 [(set (match_operand:DF 0 "nonimmediate_operand" "=r,r,m,f,f,f,m")
4046 (match_operand:DF 1 "input_operand" "rG,m,rG,f,G,m,fG"))]
4048 && (register_operand (operands[0], DFmode)
4049 || reg_or_fp0_operand (operands[1], DFmode))"
4058 [(set_attr "type" "ilog,ild,ist,fcpys,fcpys,fld,fst")])
4061 [(set (match_operand:DF 0 "nonimmediate_operand" "=r,r,m,f,f,f,m,f,*r")
4062 (match_operand:DF 1 "input_operand" "rG,m,rG,f,G,m,fG,r,*f"))]
4064 && (register_operand (operands[0], DFmode)
4065 || reg_or_fp0_operand (operands[1], DFmode))"
4076 [(set_attr "type" "ilog,ild,ist,fcpys,fcpys,fld,fst,itof,ftoi")])
4078 (define_expand "movsf"
4079 [(set (match_operand:SF 0 "nonimmediate_operand" "")
4080 (match_operand:SF 1 "general_operand" ""))]
4084 if (GET_CODE (operands[0]) == MEM
4085 && ! reg_or_fp0_operand (operands[1], SFmode))
4086 operands[1] = force_reg (SFmode, operands[1]);
4089 (define_expand "movdf"
4090 [(set (match_operand:DF 0 "nonimmediate_operand" "")
4091 (match_operand:DF 1 "general_operand" ""))]
4095 if (GET_CODE (operands[0]) == MEM
4096 && ! reg_or_fp0_operand (operands[1], DFmode))
4097 operands[1] = force_reg (DFmode, operands[1]);
4101 [(set (match_operand:SI 0 "nonimmediate_operand" "=r,r,r,r,r,r,m,f,f,f,m")
4102 (match_operand:SI 1 "input_operand" "r,J,I,K,L,m,rJ,f,J,m,fG"))]
4103 "! TARGET_WINDOWS_NT && ! TARGET_OPEN_VMS && ! TARGET_CIX
4104 && (register_operand (operands[0], SImode)
4105 || reg_or_0_operand (operands[1], SImode))"
4118 [(set_attr "type" "ilog,ilog,ilog,iadd,iadd,ild,ist,fcpys,fcpys,fld,fst")])
4121 [(set (match_operand:SI 0 "nonimmediate_operand" "=r,r,r,r,r,r,m,f,f,f,m,r,*f")
4122 (match_operand:SI 1 "input_operand" "r,J,I,K,L,m,rJ,f,J,m,fG,f,*r"))]
4123 "! TARGET_WINDOWS_NT && ! TARGET_OPEN_VMS && TARGET_CIX
4124 && (register_operand (operands[0], SImode)
4125 || reg_or_0_operand (operands[1], SImode))"
4140 [(set_attr "type" "ilog,ilog,ilog,iadd,iadd,ild,ist,fcpys,fcpys,fld,fst,ftoi,itof")])
4143 [(set (match_operand:SI 0 "nonimmediate_operand" "=r,r,r,r,r,r,r,m,f,f,f,m")
4144 (match_operand:SI 1 "input_operand" "r,J,I,K,L,s,m,rJ,f,J,m,fG"))]
4145 "(TARGET_WINDOWS_NT || TARGET_OPEN_VMS)
4146 && (register_operand (operands[0], SImode)
4147 || reg_or_0_operand (operands[1], SImode))"
4161 [(set_attr "type" "ilog,ilog,ilog,iadd,iadd,ldsym,ild,ist,fcpys,fcpys,fld,fst")])
4164 [(set (match_operand:HI 0 "nonimmediate_operand" "=r,r,r,r,f,f")
4165 (match_operand:HI 1 "input_operand" "r,J,I,n,f,J"))]
4167 && (register_operand (operands[0], HImode)
4168 || register_operand (operands[1], HImode))"
4176 [(set_attr "type" "ilog,ilog,ilog,iadd,fcpys,fcpys")])
4179 [(set (match_operand:HI 0 "nonimmediate_operand" "=r,r,r,r,r,m,f,f")
4180 (match_operand:HI 1 "input_operand" "r,J,I,n,m,rJ,f,J"))]
4182 && (register_operand (operands[0], HImode)
4183 || reg_or_0_operand (operands[1], HImode))"
4193 [(set_attr "type" "ilog,ilog,ilog,iadd,ild,ist,fcpys,fcpys")])
4196 [(set (match_operand:QI 0 "nonimmediate_operand" "=r,r,r,r,f,f")
4197 (match_operand:QI 1 "input_operand" "r,J,I,n,f,J"))]
4199 && (register_operand (operands[0], QImode)
4200 || register_operand (operands[1], QImode))"
4208 [(set_attr "type" "ilog,ilog,ilog,iadd,fcpys,fcpys")])
4211 [(set (match_operand:QI 0 "nonimmediate_operand" "=r,r,r,r,r,m,f,f")
4212 (match_operand:QI 1 "input_operand" "r,J,I,n,m,rJ,f,J"))]
4214 && (register_operand (operands[0], QImode)
4215 || reg_or_0_operand (operands[1], QImode))"
4225 [(set_attr "type" "ilog,ilog,ilog,iadd,ild,ist,fcpys,fcpys")])
4227 ;; We do two major things here: handle mem->mem and construct long
4230 (define_expand "movsi"
4231 [(set (match_operand:SI 0 "general_operand" "")
4232 (match_operand:SI 1 "general_operand" ""))]
4236 if (GET_CODE (operands[0]) == MEM
4237 && ! reg_or_0_operand (operands[1], SImode))
4238 operands[1] = force_reg (SImode, operands[1]);
4240 if (! CONSTANT_P (operands[1]) || input_operand (operands[1], SImode))
4242 else if (GET_CODE (operands[1]) == CONST_INT)
4245 = alpha_emit_set_const (operands[0], SImode, INTVAL (operands[1]), 3);
4246 if (rtx_equal_p (operands[0], operands[1]))
4251 ;; Split a load of a large constant into the appropriate two-insn
4255 [(set (match_operand:SI 0 "register_operand" "")
4256 (match_operand:SI 1 "const_int_operand" ""))]
4257 "! add_operand (operands[1], SImode)"
4258 [(set (match_dup 0) (match_dup 2))
4259 (set (match_dup 0) (plus:SI (match_dup 0) (match_dup 3)))]
4262 = alpha_emit_set_const (operands[0], SImode, INTVAL (operands[1]), 2);
4264 if (tem == operands[0])
4271 [(set (match_operand:DI 0 "general_operand" "=r,r,r,r,r,r,r,m,f,f,f,Q")
4272 (match_operand:DI 1 "input_operand" "r,J,I,K,L,s,m,rJ,f,J,Q,fG"))]
4274 && (register_operand (operands[0], DImode)
4275 || reg_or_0_operand (operands[1], DImode))"
4289 [(set_attr "type" "ilog,ilog,ilog,iadd,iadd,ldsym,ild,ist,fcpys,fcpys,fld,fst")])
4292 [(set (match_operand:DI 0 "general_operand" "=r,r,r,r,r,r,r,m,f,f,f,Q,r,*f")
4293 (match_operand:DI 1 "input_operand" "r,J,I,K,L,s,m,rJ,f,J,Q,fG,f,*r"))]
4295 && (register_operand (operands[0], DImode)
4296 || reg_or_0_operand (operands[1], DImode))"
4312 [(set_attr "type" "ilog,ilog,ilog,iadd,iadd,ldsym,ild,ist,fcpys,fcpys,fld,fst,ftoi,itof")])
4314 ;; We do three major things here: handle mem->mem, put 64-bit constants in
4315 ;; memory, and construct long 32-bit constants.
4317 (define_expand "movdi"
4318 [(set (match_operand:DI 0 "general_operand" "")
4319 (match_operand:DI 1 "general_operand" ""))]
4325 if (GET_CODE (operands[0]) == MEM
4326 && ! reg_or_0_operand (operands[1], DImode))
4327 operands[1] = force_reg (DImode, operands[1]);
4329 if (! CONSTANT_P (operands[1]) || input_operand (operands[1], DImode))
4331 else if (GET_CODE (operands[1]) == CONST_INT
4332 && (tem = alpha_emit_set_const (operands[0], DImode,
4333 INTVAL (operands[1]), 3)) != 0)
4335 if (rtx_equal_p (tem, operands[0]))
4340 else if (CONSTANT_P (operands[1]))
4342 if (TARGET_BUILD_CONSTANTS)
4344 #if HOST_BITS_PER_WIDE_INT == 64
4347 if (GET_CODE (operands[1]) == CONST_INT)
4348 i = INTVAL (operands[1]);
4349 else if (GET_CODE (operands[1]) == CONST_DOUBLE)
4350 i = CONST_DOUBLE_LOW (operands[1]);
4354 tem = alpha_emit_set_long_const (operands[0], i);
4355 if (rtx_equal_p (tem, operands[0]))
4365 operands[1] = force_const_mem (DImode, operands[1]);
4366 if (reload_in_progress)
4368 emit_move_insn (operands[0], XEXP (operands[1], 0));
4369 operands[1] = copy_rtx (operands[1]);
4370 XEXP (operands[1], 0) = operands[0];
4373 operands[1] = validize_mem (operands[1]);
4380 ;; Split a load of a large constant into the appropriate two-insn
4384 [(set (match_operand:DI 0 "register_operand" "")
4385 (match_operand:DI 1 "const_int_operand" ""))]
4386 "! add_operand (operands[1], DImode)"
4387 [(set (match_dup 0) (match_dup 2))
4388 (set (match_dup 0) (plus:DI (match_dup 0) (match_dup 3)))]
4391 = alpha_emit_set_const (operands[0], DImode, INTVAL (operands[1]), 2);
4393 if (tem == operands[0])
4399 ;; These are the partial-word cases.
4401 ;; First we have the code to load an aligned word. Operand 0 is the register
4402 ;; in which to place the result. It's mode is QImode or HImode. Operand 1
4403 ;; is an SImode MEM at the low-order byte of the proper word. Operand 2 is the
4404 ;; number of bits within the word that the value is. Operand 3 is an SImode
4405 ;; scratch register. If operand 0 is a hard register, operand 3 may be the
4406 ;; same register. It is allowed to conflict with operand 1 as well.
4408 (define_expand "aligned_loadqi"
4409 [(set (match_operand:SI 3 "register_operand" "")
4410 (match_operand:SI 1 "memory_operand" ""))
4411 (set (subreg:DI (match_operand:QI 0 "register_operand" "") 0)
4412 (zero_extract:DI (subreg:DI (match_dup 3) 0)
4414 (match_operand:DI 2 "const_int_operand" "")))]
4419 (define_expand "aligned_loadhi"
4420 [(set (match_operand:SI 3 "register_operand" "")
4421 (match_operand:SI 1 "memory_operand" ""))
4422 (set (subreg:DI (match_operand:HI 0 "register_operand" "") 0)
4423 (zero_extract:DI (subreg:DI (match_dup 3) 0)
4425 (match_operand:DI 2 "const_int_operand" "")))]
4430 ;; Similar for unaligned loads, where we use the sequence from the
4431 ;; Alpha Architecture manual.
4433 ;; Operand 1 is the address. Operands 2 and 3 are temporaries, where
4434 ;; operand 3 can overlap the input and output registers.
4436 (define_expand "unaligned_loadqi"
4437 [(set (match_operand:DI 2 "register_operand" "")
4438 (mem:DI (and:DI (match_operand:DI 1 "address_operand" "")
4440 (set (match_operand:DI 3 "register_operand" "")
4442 (set (subreg:DI (match_operand:QI 0 "register_operand" "") 0)
4443 (zero_extract:DI (match_dup 2)
4445 (ashift:DI (match_dup 3) (const_int 3))))]
4449 (define_expand "unaligned_loadhi"
4450 [(set (match_operand:DI 2 "register_operand" "")
4451 (mem:DI (and:DI (match_operand:DI 1 "address_operand" "")
4453 (set (match_operand:DI 3 "register_operand" "")
4455 (set (subreg:DI (match_operand:QI 0 "register_operand" "") 0)
4456 (zero_extract:DI (match_dup 2)
4458 (ashift:DI (match_dup 3) (const_int 3))))]
4462 ;; Storing an aligned byte or word requires two temporaries. Operand 0 is the
4463 ;; aligned SImode MEM. Operand 1 is the register containing the
4464 ;; byte or word to store. Operand 2 is the number of bits within the word that
4465 ;; the value should be placed. Operands 3 and 4 are SImode temporaries.
4467 (define_expand "aligned_store"
4468 [(set (match_operand:SI 3 "register_operand" "")
4469 (match_operand:SI 0 "memory_operand" ""))
4470 (set (subreg:DI (match_dup 3) 0)
4471 (and:DI (subreg:DI (match_dup 3) 0) (match_dup 5)))
4472 (set (subreg:DI (match_operand:SI 4 "register_operand" "") 0)
4473 (ashift:DI (zero_extend:DI (match_operand 1 "register_operand" ""))
4474 (match_operand:DI 2 "const_int_operand" "")))
4475 (set (subreg:DI (match_dup 4) 0)
4476 (ior:DI (subreg:DI (match_dup 4) 0) (subreg:DI (match_dup 3) 0)))
4477 (set (match_dup 0) (match_dup 4))]
4480 { operands[5] = GEN_INT (~ (GET_MODE_MASK (GET_MODE (operands[1]))
4481 << INTVAL (operands[2])));
4484 ;; For the unaligned byte and halfword cases, we use code similar to that
4485 ;; in the ;; Architecture book, but reordered to lower the number of registers
4486 ;; required. Operand 0 is the address. Operand 1 is the data to store.
4487 ;; Operands 2, 3, and 4 are DImode temporaries, where operands 2 and 4 may
4488 ;; be the same temporary, if desired. If the address is in a register,
4489 ;; operand 2 can be that register.
4491 (define_expand "unaligned_storeqi"
4492 [(set (match_operand:DI 3 "register_operand" "")
4493 (mem:DI (and:DI (match_operand:DI 0 "address_operand" "")
4495 (set (match_operand:DI 2 "register_operand" "")
4498 (and:DI (not:DI (ashift:DI (const_int 255)
4499 (ashift:DI (match_dup 2) (const_int 3))))
4501 (set (match_operand:DI 4 "register_operand" "")
4502 (ashift:DI (zero_extend:DI (match_operand:QI 1 "register_operand" ""))
4503 (ashift:DI (match_dup 2) (const_int 3))))
4504 (set (match_dup 4) (ior:DI (match_dup 4) (match_dup 3)))
4505 (set (mem:DI (and:DI (match_dup 0) (const_int -8)))
4510 (define_expand "unaligned_storehi"
4511 [(set (match_operand:DI 3 "register_operand" "")
4512 (mem:DI (and:DI (match_operand:DI 0 "address_operand" "")
4514 (set (match_operand:DI 2 "register_operand" "")
4517 (and:DI (not:DI (ashift:DI (const_int 65535)
4518 (ashift:DI (match_dup 2) (const_int 3))))
4520 (set (match_operand:DI 4 "register_operand" "")
4521 (ashift:DI (zero_extend:DI (match_operand:HI 1 "register_operand" ""))
4522 (ashift:DI (match_dup 2) (const_int 3))))
4523 (set (match_dup 4) (ior:DI (match_dup 4) (match_dup 3)))
4524 (set (mem:DI (and:DI (match_dup 0) (const_int -8)))
4529 ;; Here are the define_expand's for QI and HI moves that use the above
4530 ;; patterns. We have the normal sets, plus the ones that need scratch
4531 ;; registers for reload.
4533 (define_expand "movqi"
4534 [(set (match_operand:QI 0 "general_operand" "")
4535 (match_operand:QI 1 "general_operand" ""))]
4541 if (GET_CODE (operands[0]) == MEM
4542 && ! reg_or_0_operand (operands[1], QImode))
4543 operands[1] = force_reg (QImode, operands[1]);
4545 if (GET_CODE (operands[1]) == CONST_INT
4546 && ! input_operand (operands[1], QImode))
4548 operands[1] = alpha_emit_set_const (operands[0], QImode,
4549 INTVAL (operands[1]), 3);
4551 if (rtx_equal_p (operands[0], operands[1]))
4558 /* If the output is not a register, the input must be. */
4559 if (GET_CODE (operands[0]) == MEM)
4560 operands[1] = force_reg (QImode, operands[1]);
4562 /* Handle four memory cases, unaligned and aligned for either the input
4563 or the output. The only case where we can be called during reload is
4564 for aligned loads; all other cases require temporaries. */
4566 if (GET_CODE (operands[1]) == MEM
4567 || (GET_CODE (operands[1]) == SUBREG
4568 && GET_CODE (SUBREG_REG (operands[1])) == MEM)
4569 || (reload_in_progress && GET_CODE (operands[1]) == REG
4570 && REGNO (operands[1]) >= FIRST_PSEUDO_REGISTER)
4571 || (reload_in_progress && GET_CODE (operands[1]) == SUBREG
4572 && GET_CODE (SUBREG_REG (operands[1])) == REG
4573 && REGNO (SUBREG_REG (operands[1])) >= FIRST_PSEUDO_REGISTER))
4575 if (aligned_memory_operand (operands[1], QImode))
4577 rtx aligned_mem, bitnum;
4578 rtx scratch = (reload_in_progress
4579 ? gen_rtx_REG (SImode, REGNO (operands[0]))
4580 : gen_reg_rtx (SImode));
4582 get_aligned_mem (operands[1], &aligned_mem, &bitnum);
4584 emit_insn (gen_aligned_loadqi (operands[0], aligned_mem, bitnum,
4589 /* Don't pass these as parameters since that makes the generated
4590 code depend on parameter evaluation order which will cause
4591 bootstrap failures. */
4593 rtx temp1 = gen_reg_rtx (DImode);
4594 rtx temp2 = gen_reg_rtx (DImode);
4596 = gen_unaligned_loadqi (operands[0],
4597 get_unaligned_address (operands[1], 0),
4600 alpha_set_memflags (seq, operands[1]);
4607 else if (GET_CODE (operands[0]) == MEM
4608 || (GET_CODE (operands[0]) == SUBREG
4609 && GET_CODE (SUBREG_REG (operands[0])) == MEM)
4610 || (reload_in_progress && GET_CODE (operands[0]) == REG
4611 && REGNO (operands[0]) >= FIRST_PSEUDO_REGISTER)
4612 || (reload_in_progress && GET_CODE (operands[0]) == SUBREG
4613 && GET_CODE (SUBREG_REG (operands[0])) == REG
4614 && REGNO (operands[0]) >= FIRST_PSEUDO_REGISTER))
4616 if (aligned_memory_operand (operands[0], QImode))
4618 rtx aligned_mem, bitnum;
4619 rtx temp1 = gen_reg_rtx (SImode);
4620 rtx temp2 = gen_reg_rtx (SImode);
4622 get_aligned_mem (operands[0], &aligned_mem, &bitnum);
4624 emit_insn (gen_aligned_store (aligned_mem, operands[1], bitnum,
4629 rtx temp1 = gen_reg_rtx (DImode);
4630 rtx temp2 = gen_reg_rtx (DImode);
4631 rtx temp3 = gen_reg_rtx (DImode);
4633 = gen_unaligned_storeqi (get_unaligned_address (operands[0], 0),
4634 operands[1], temp1, temp2, temp3);
4636 alpha_set_memflags (seq, operands[0]);
4644 (define_expand "movhi"
4645 [(set (match_operand:HI 0 "general_operand" "")
4646 (match_operand:HI 1 "general_operand" ""))]
4652 if (GET_CODE (operands[0]) == MEM
4653 && ! reg_or_0_operand (operands[1], HImode))
4654 operands[1] = force_reg (HImode, operands[1]);
4656 if (GET_CODE (operands[1]) == CONST_INT
4657 && ! input_operand (operands[1], HImode))
4659 operands[1] = alpha_emit_set_const (operands[0], HImode,
4660 INTVAL (operands[1]), 3);
4662 if (rtx_equal_p (operands[0], operands[1]))
4669 /* If the output is not a register, the input must be. */
4670 if (GET_CODE (operands[0]) == MEM)
4671 operands[1] = force_reg (HImode, operands[1]);
4673 /* Handle four memory cases, unaligned and aligned for either the input
4674 or the output. The only case where we can be called during reload is
4675 for aligned loads; all other cases require temporaries. */
4677 if (GET_CODE (operands[1]) == MEM
4678 || (GET_CODE (operands[1]) == SUBREG
4679 && GET_CODE (SUBREG_REG (operands[1])) == MEM)
4680 || (reload_in_progress && GET_CODE (operands[1]) == REG
4681 && REGNO (operands[1]) >= FIRST_PSEUDO_REGISTER)
4682 || (reload_in_progress && GET_CODE (operands[1]) == SUBREG
4683 && GET_CODE (SUBREG_REG (operands[1])) == REG
4684 && REGNO (SUBREG_REG (operands[1])) >= FIRST_PSEUDO_REGISTER))
4686 if (aligned_memory_operand (operands[1], HImode))
4688 rtx aligned_mem, bitnum;
4689 rtx scratch = (reload_in_progress
4690 ? gen_rtx_REG (SImode, REGNO (operands[0]))
4691 : gen_reg_rtx (SImode));
4693 get_aligned_mem (operands[1], &aligned_mem, &bitnum);
4695 emit_insn (gen_aligned_loadhi (operands[0], aligned_mem, bitnum,
4700 /* Don't pass these as parameters since that makes the generated
4701 code depend on parameter evaluation order which will cause
4702 bootstrap failures. */
4704 rtx temp1 = gen_reg_rtx (DImode);
4705 rtx temp2 = gen_reg_rtx (DImode);
4707 = gen_unaligned_loadhi (operands[0],
4708 get_unaligned_address (operands[1], 0),
4711 alpha_set_memflags (seq, operands[1]);
4718 else if (GET_CODE (operands[0]) == MEM
4719 || (GET_CODE (operands[0]) == SUBREG
4720 && GET_CODE (SUBREG_REG (operands[0])) == MEM)
4721 || (reload_in_progress && GET_CODE (operands[0]) == REG
4722 && REGNO (operands[0]) >= FIRST_PSEUDO_REGISTER)
4723 || (reload_in_progress && GET_CODE (operands[0]) == SUBREG
4724 && GET_CODE (SUBREG_REG (operands[0])) == REG
4725 && REGNO (operands[0]) >= FIRST_PSEUDO_REGISTER))
4727 if (aligned_memory_operand (operands[0], HImode))
4729 rtx aligned_mem, bitnum;
4730 rtx temp1 = gen_reg_rtx (SImode);
4731 rtx temp2 = gen_reg_rtx (SImode);
4733 get_aligned_mem (operands[0], &aligned_mem, &bitnum);
4735 emit_insn (gen_aligned_store (aligned_mem, operands[1], bitnum,
4740 rtx temp1 = gen_reg_rtx (DImode);
4741 rtx temp2 = gen_reg_rtx (DImode);
4742 rtx temp3 = gen_reg_rtx (DImode);
4744 = gen_unaligned_storehi (get_unaligned_address (operands[0], 0),
4745 operands[1], temp1, temp2, temp3);
4747 alpha_set_memflags (seq, operands[0]);
4756 ;; Here are the versions for reload. Note that in the unaligned cases
4757 ;; we know that the operand must not be a pseudo-register because stack
4758 ;; slots are always aligned references.
4760 (define_expand "reload_inqi"
4761 [(parallel [(match_operand:QI 0 "register_operand" "=r")
4762 (match_operand:QI 1 "unaligned_memory_operand" "m")
4763 (match_operand:TI 2 "register_operand" "=&r")])]
4767 rtx addr = get_unaligned_address (operands[1], 0);
4769 /* It is possible that one of the registers we got for operands[2]
4770 might coincide with that of operands[0] (which is why we made
4771 it TImode). Pick the other one to use as our scratch. */
4772 rtx scratch = gen_rtx_REG (DImode,
4773 REGNO (operands[0]) == REGNO (operands[2])
4774 ? REGNO (operands[2]) + 1 : REGNO (operands[2]));
4776 rtx seq = gen_unaligned_loadqi (operands[0], addr, scratch,
4777 gen_rtx_REG (DImode, REGNO (operands[0])));
4779 alpha_set_memflags (seq, operands[1]);
4784 (define_expand "reload_inhi"
4785 [(parallel [(match_operand:HI 0 "register_operand" "=r")
4786 (match_operand:HI 1 "unaligned_memory_operand" "m")
4787 (match_operand:TI 2 "register_operand" "=&r")])]
4791 rtx addr = get_unaligned_address (operands[1], 0);
4793 /* It is possible that one of the registers we got for operands[2]
4794 might coincide with that of operands[0] (which is why we made
4795 it TImode). Pick the other one to use as our scratch. */
4796 rtx scratch = gen_rtx_REG (DImode,
4797 REGNO (operands[0]) == REGNO (operands[2])
4798 ? REGNO (operands[2]) + 1 : REGNO (operands[2]));
4800 rtx seq = gen_unaligned_loadhi (operands[0], addr, scratch,
4801 gen_rtx_REG (DImode, REGNO (operands[0])));
4803 alpha_set_memflags (seq, operands[1]);
4808 (define_expand "reload_outqi"
4809 [(parallel [(match_operand:QI 0 "any_memory_operand" "=m")
4810 (match_operand:QI 1 "register_operand" "r")
4811 (match_operand:TI 2 "register_operand" "=&r")])]
4815 if (aligned_memory_operand (operands[0], QImode))
4817 rtx aligned_mem, bitnum;
4819 get_aligned_mem (operands[0], &aligned_mem, &bitnum);
4821 emit_insn (gen_aligned_store (aligned_mem, operands[1], bitnum,
4822 gen_rtx_REG (SImode, REGNO (operands[2])),
4823 gen_rtx_REG (SImode,
4824 REGNO (operands[2]) + 1)));
4828 rtx addr = get_unaligned_address (operands[0], 0);
4829 rtx scratch1 = gen_rtx_REG (DImode, REGNO (operands[2]));
4830 rtx scratch2 = gen_rtx_REG (DImode, REGNO (operands[2]) + 1);
4831 rtx scratch3 = scratch1;
4834 if (GET_CODE (addr) == REG)
4837 seq = gen_unaligned_storeqi (addr, operands[1], scratch1,
4838 scratch2, scratch3);
4839 alpha_set_memflags (seq, operands[0]);
4846 (define_expand "reload_outhi"
4847 [(parallel [(match_operand:HI 0 "any_memory_operand" "=m")
4848 (match_operand:HI 1 "register_operand" "r")
4849 (match_operand:TI 2 "register_operand" "=&r")])]
4853 if (aligned_memory_operand (operands[0], HImode))
4855 rtx aligned_mem, bitnum;
4857 get_aligned_mem (operands[0], &aligned_mem, &bitnum);
4859 emit_insn (gen_aligned_store (aligned_mem, operands[1], bitnum,
4860 gen_rtx_REG (SImode, REGNO (operands[2])),
4861 gen_rtx_REG (SImode,
4862 REGNO (operands[2]) + 1)));
4866 rtx addr = get_unaligned_address (operands[0], 0);
4867 rtx scratch1 = gen_rtx_REG (DImode, REGNO (operands[2]));
4868 rtx scratch2 = gen_rtx_REG (DImode, REGNO (operands[2]) + 1);
4869 rtx scratch3 = scratch1;
4872 if (GET_CODE (addr) == REG)
4875 seq = gen_unaligned_storehi (addr, operands[1], scratch1,
4876 scratch2, scratch3);
4877 alpha_set_memflags (seq, operands[0]);
4884 ;; Bit field extract patterns which use ext[wlq][lh]
4886 (define_expand "extv"
4887 [(set (match_operand:DI 0 "register_operand" "")
4888 (sign_extract:DI (match_operand:QI 1 "memory_operand" "")
4889 (match_operand:DI 2 "immediate_operand" "")
4890 (match_operand:DI 3 "immediate_operand" "")))]
4894 /* We can do 16, 32 and 64 bit fields, if aligned on byte boundaries. */
4895 if (INTVAL (operands[3]) % 8 != 0
4896 || (INTVAL (operands[2]) != 16
4897 && INTVAL (operands[2]) != 32
4898 && INTVAL (operands[2]) != 64))
4901 /* From mips.md: extract_bit_field doesn't verify that our source
4902 matches the predicate, so we force it to be a MEM here. */
4903 if (GET_CODE (operands[1]) != MEM)
4906 alpha_expand_unaligned_load (operands[0], operands[1],
4907 INTVAL (operands[2]) / 8,
4908 INTVAL (operands[3]) / 8, 1);
4912 (define_expand "extzv"
4913 [(set (match_operand:DI 0 "register_operand" "")
4914 (zero_extract:DI (match_operand:DI 1 "general_operand" "")
4915 (match_operand:DI 2 "immediate_operand" "")
4916 (match_operand:DI 3 "immediate_operand" "")))]
4920 /* We can do 8, 16, 32 and 64 bit fields, if aligned on byte boundaries. */
4921 if (INTVAL (operands[3]) % 8 != 0
4922 || (INTVAL (operands[2]) != 8
4923 && INTVAL (operands[2]) != 16
4924 && INTVAL (operands[2]) != 32
4925 && INTVAL (operands[2]) != 64))
4928 if (GET_CODE (operands[1]) == MEM)
4930 /* Fail 8 bit fields, falling back on a simple byte load. */
4931 if (INTVAL (operands[2]) == 8)
4934 alpha_expand_unaligned_load (operands[0], operands[1],
4935 INTVAL (operands[2]) / 8,
4936 INTVAL (operands[3]) / 8, 0);
4941 (define_expand "insv"
4942 [(set (zero_extract:DI (match_operand:QI 0 "memory_operand" "")
4943 (match_operand:DI 1 "immediate_operand" "")
4944 (match_operand:DI 2 "immediate_operand" ""))
4945 (match_operand:DI 3 "register_operand" ""))]
4949 /* We can do 16, 32 and 64 bit fields, if aligned on byte boundaries. */
4950 if (INTVAL (operands[2]) % 8 != 0
4951 || (INTVAL (operands[1]) != 16
4952 && INTVAL (operands[1]) != 32
4953 && INTVAL (operands[1]) != 64))
4956 /* From mips.md: store_bit_field doesn't verify that our source
4957 matches the predicate, so we force it to be a MEM here. */
4958 if (GET_CODE (operands[0]) != MEM)
4961 alpha_expand_unaligned_store (operands[0], operands[3],
4962 INTVAL (operands[1]) / 8,
4963 INTVAL (operands[2]) / 8);
4969 ;; Block move/clear, see alpha.c for more details.
4970 ;; Argument 0 is the destination
4971 ;; Argument 1 is the source
4972 ;; Argument 2 is the length
4973 ;; Argument 3 is the alignment
4975 (define_expand "movstrqi"
4976 [(parallel [(set (match_operand:BLK 0 "general_operand" "")
4977 (match_operand:BLK 1 "general_operand" ""))
4978 (use (match_operand:DI 2 "immediate_operand" ""))
4979 (use (match_operand:DI 3 "immediate_operand" ""))])]
4983 if (alpha_expand_block_move (operands))
4989 (define_expand "clrstrqi"
4990 [(parallel [(set (match_operand:BLK 0 "general_operand" "")
4992 (use (match_operand:DI 1 "immediate_operand" ""))
4993 (use (match_operand:DI 2 "immediate_operand" ""))])]
4997 if (alpha_expand_block_clear (operands))
5003 ;; Subroutine of stack space allocation. Perform a stack probe.
5004 (define_expand "probe_stack"
5005 [(set (match_dup 1) (match_operand:DI 0 "const_int_operand" ""))]
5009 operands[1] = gen_rtx_MEM (DImode, plus_constant (stack_pointer_rtx,
5010 INTVAL (operands[0])));
5011 MEM_VOLATILE_P (operands[1]) = 1;
5013 operands[0] = const0_rtx;
5016 ;; This is how we allocate stack space. If we are allocating a
5017 ;; constant amount of space and we know it is less than 4096
5018 ;; bytes, we need do nothing.
5020 ;; If it is more than 4096 bytes, we need to probe the stack
5022 (define_expand "allocate_stack"
5024 (plus:DI (reg:DI 30)
5025 (match_operand:DI 1 "reg_or_cint_operand" "")))
5026 (set (match_operand:DI 0 "register_operand" "=r")
5031 if (GET_CODE (operands[1]) == CONST_INT
5032 && INTVAL (operands[1]) < 32768)
5034 if (INTVAL (operands[1]) >= 4096)
5036 /* We do this the same way as in the prologue and generate explicit
5037 probes. Then we update the stack by the constant. */
5041 emit_insn (gen_probe_stack (GEN_INT (- probed)));
5042 while (probed + 8192 < INTVAL (operands[1]))
5043 emit_insn (gen_probe_stack (GEN_INT (- (probed += 8192))));
5045 if (probed + 4096 < INTVAL (operands[1]))
5046 emit_insn (gen_probe_stack (GEN_INT (- INTVAL(operands[1]))));
5049 operands[1] = GEN_INT (- INTVAL (operands[1]));
5050 operands[2] = virtual_stack_dynamic_rtx;
5055 rtx loop_label = gen_label_rtx ();
5056 rtx want = gen_reg_rtx (Pmode);
5057 rtx tmp = gen_reg_rtx (Pmode);
5060 emit_insn (gen_subdi3 (want, stack_pointer_rtx,
5061 force_reg (Pmode, operands[1])));
5062 emit_insn (gen_adddi3 (tmp, stack_pointer_rtx, GEN_INT (-4096)));
5064 if (GET_CODE (operands[1]) != CONST_INT)
5066 out_label = gen_label_rtx ();
5067 emit_insn (gen_cmpdi (want, tmp));
5068 emit_jump_insn (gen_bgeu (out_label));
5071 emit_label (loop_label);
5072 memref = gen_rtx_MEM (DImode, tmp);
5073 MEM_VOLATILE_P (memref) = 1;
5074 emit_move_insn (memref, const0_rtx);
5075 emit_insn (gen_adddi3 (tmp, tmp, GEN_INT(-8192)));
5076 emit_insn (gen_cmpdi (tmp, want));
5077 emit_jump_insn (gen_bgtu (loop_label));
5079 gen_rtx_USE (VOIDmode, tmp);
5081 memref = gen_rtx_MEM (DImode, want);
5082 MEM_VOLATILE_P (memref) = 1;
5083 emit_move_insn (memref, const0_rtx);
5086 emit_label (out_label);
5088 emit_move_insn (stack_pointer_rtx, want);
5089 emit_move_insn (operands[0], virtual_stack_dynamic_rtx);
5094 ;; This is used by alpha_expand_prolog to do the same thing as above,
5095 ;; except we cannot at that time generate new basic blocks, so we hide
5096 ;; the loop in this one insn.
5098 (define_insn "prologue_stack_probe_loop"
5099 [(unspec_volatile [(match_operand 0 "register_operand" "r")
5100 (match_operand 1 "register_operand" "r")] 5)]
5104 static int label_no;
5105 int count_regno = REGNO (operands[0]);
5106 int ptr_regno = REGNO (operands[1]);
5109 /* Ho hum, output the hard way to get the label at the beginning of
5110 the line. Wish there were a magic char you could get
5111 asm_output_printf to do that. Then we could use %= as well and
5112 get rid of the label_no bits here too. */
5114 ASM_GENERATE_INTERNAL_LABEL (label, \"LSC\", label_no);
5115 ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, \"LSC\", label_no++);
5117 fprintf (asm_out_file, \"\\tstq $31,-8192($%d)\\n\", ptr_regno);
5118 fprintf (asm_out_file, \"\\tsubq $%d,1,$%d\\n\", count_regno, count_regno);
5119 fprintf (asm_out_file, \"\\tlda $%d,-8192($%d)\\n\", ptr_regno, ptr_regno);
5120 fprintf (asm_out_file, \"\\tbne $%d,\", count_regno);
5121 assemble_name (asm_out_file, label);
5122 putc ('\\n', asm_out_file);
5126 [(set_attr "length" "16")
5127 (set_attr "type" "multi")])
5129 (define_expand "prologue"
5130 [(clobber (const_int 0))]
5132 "alpha_expand_prologue (); DONE;")
5134 (define_insn "init_fp"
5135 [(set (match_operand:DI 0 "register_operand" "r")
5136 (match_operand:DI 1 "register_operand" "r"))
5137 (clobber (mem:BLK (match_operand:DI 2 "register_operand" "r")))]
5141 (define_expand "epilogue"
5142 [(clobber (const_int 0))]
5144 "alpha_expand_epilogue (); DONE;")
5146 (define_expand "builtin_longjmp"
5147 [(unspec_volatile [(match_operand 0 "register_operand" "r")] 3)]
5148 "! TARGET_OPEN_VMS && ! TARGET_WINDOWS_NT"
5151 /* The elements of the buffer are, in order: */
5152 rtx fp = gen_rtx_MEM (Pmode, operands[0]);
5153 rtx lab = gen_rtx_MEM (Pmode, plus_constant (operands[0], 8));
5154 rtx stack = gen_rtx_MEM (Pmode, plus_constant (operands[0], 16));
5155 rtx pv = gen_rtx_REG (Pmode, 27);
5157 /* This bit is the same as expand_builtin_longjmp. */
5158 emit_move_insn (hard_frame_pointer_rtx, fp);
5159 emit_move_insn (pv, lab);
5160 emit_stack_restore (SAVE_NONLOCAL, stack, NULL_RTX);
5161 emit_insn (gen_rtx_USE (VOIDmode, hard_frame_pointer_rtx));
5162 emit_insn (gen_rtx_USE (VOIDmode, stack_pointer_rtx));
5164 /* Load the label we are jumping through into $27 so that we know
5165 where to look for it when we get back to setjmp's function for
5166 restoring the gp. */
5167 emit_indirect_jump (pv);
5170 (define_insn "builtin_setjmp_receiver"
5171 [(unspec_volatile [(match_operand 0 "" "")] 2)]
5172 "! TARGET_OPEN_VMS && ! TARGET_WINDOWS_NT && TARGET_AS_CAN_SUBTRACT_LABELS"
5173 "\\n$LSJ%=:\;ldgp $29,$LSJ%=-%l0($27)"
5174 [(set_attr "length" "8")
5175 (set_attr "type" "multi")])
5178 [(unspec_volatile [(match_operand 0 "" "")] 2)]
5179 "! TARGET_OPEN_VMS && ! TARGET_WINDOWS_NT"
5180 "br $27,$LSJ%=\\n$LSJ%=:\;ldgp $29,0($27)"
5181 [(set_attr "length" "12")
5182 (set_attr "type" "multi")])
5184 (define_expand "nonlocal_goto_receiver"
5185 [(unspec_volatile [(const_int 0)] 1)
5186 (set (reg:DI 27) (mem:DI (reg:DI 29)))
5187 (unspec_volatile [(const_int 0)] 1)
5192 (define_insn "arg_home"
5193 [(unspec [(const_int 0)] 0)
5208 (clobber (mem:BLK (const_int 0)))
5209 (clobber (reg:DI 24))
5210 (clobber (reg:DI 25))
5211 (clobber (reg:DI 0))]
5213 "lda $0,OTS$HOME_ARGS\;ldq $0,8($0)\;jsr $0,OTS$HOME_ARGS"
5214 [(set_attr "length" "16")
5215 (set_attr "type" "multi")])
5217 ;; Close the trap shadow of preceeding instructions. This is generated
5220 (define_insn "trapb"
5221 [(unspec_volatile [(const_int 0)] 4)]
5224 [(set_attr "type" "misc")])
5226 ;; No-op instructions used by machine-dependant reorg to preserve
5227 ;; alignment for instruction issue.
5233 [(set_attr "type" "ilog")])
5239 [(set_attr "type" "fcpys")])
5246 (define_insn "realign"
5247 [(unspec_volatile [(match_operand 0 "immediate_operand" "i")] 6)]
5249 ".align %0 #realign")
5251 ;; Peepholes go at the end.
5253 ;; Optimize sign-extension of SImode loads. This shows up in the wake of
5254 ;; reload when converting fp->int.
5256 ;; ??? What to do now that we actually care about the packing and
5257 ;; alignment of instructions? Perhaps reload can be enlightened, or
5258 ;; the peephole pass moved up after reload but before sched2?
5261 ; [(set (match_operand:SI 0 "register_operand" "=r")
5262 ; (match_operand:SI 1 "memory_operand" "m"))
5263 ; (set (match_operand:DI 2 "register_operand" "=r")
5264 ; (sign_extend:DI (match_dup 0)))]
5265 ; "dead_or_set_p (insn, operands[0])"
5269 ; [(set (match_operand:SI 0 "register_operand" "=r")
5270 ; (match_operand:SI 1 "hard_fp_register_operand" "f"))
5271 ; (set (match_operand:DI 2 "register_operand" "=r")
5272 ; (sign_extend:DI (match_dup 0)))]
5273 ; "TARGET_CIX && dead_or_set_p (insn, operands[0])"