1 ;; Machine description for DEC Alpha for GNU C compiler
2 ;; Copyright (C) 1992, 1993, 1994, 1995 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, 675 Mass Ave, Cambridge, MA 02139, USA.
21 ;;- See file "rtl.def" for documentation on define_insn, match_*, et. al.
23 ;; Define an insn type attribute. This is used in function unit delay
24 ;; computations, among other purposes. For the most part, we use the names
25 ;; defined in the EV4 documentation, but add a few that we have to know about
29 "ld,st,ibr,fbr,jsr,iaddlog,shiftcm,icmp,imull,imulq,fpop,fdivs,fdivt,ldsym,isubr"
30 (const_string "shiftcm"))
32 ;; We include four function units: ABOX, which computes the address,
33 ;; BBOX, used for branches, EBOX, used for integer operations, and FBOX,
34 ;; used for FP operations.
36 ;; We assume that we have been successful in getting double issues and
37 ;; hence multiply all costs by two insns per cycle. The minimum time in
38 ;; a function unit is 2 cycle, which will tend to produce the double
41 ;; Memory delivers its result in three cycles.
42 (define_function_unit "abox" 1 0 (eq_attr "type" "ld,ldsym,st") 6 2)
44 ;; Branches have no delay cost, but do tie up the unit for two cycles.
45 (define_function_unit "bbox" 1 1 (eq_attr "type" "ibr,fbr,jsr") 4 4)
47 ;; Arithmetic insns are normally have their results available after two
48 ;; cycles. There are a number of exceptions. They are encoded in
49 ;; ADJUST_COST. Some of the other insns have similar exceptions.
51 (define_function_unit "ebox" 1 0 (eq_attr "type" "iaddlog,shiftcm,icmp") 4 2)
53 ;; These really don't take up the integer pipeline, but they do occupy
54 ;; IBOX1; we approximate here.
56 (define_function_unit "ebox" 1 0 (eq_attr "type" "imull") 42 2)
57 (define_function_unit "ebox" 1 0 (eq_attr "type" "imulq") 46 2)
59 (define_function_unit "imult" 1 0 (eq_attr "type" "imull") 42 38)
60 (define_function_unit "imult" 1 0 (eq_attr "type" "imulq") 46 42)
62 (define_function_unit "fbox" 1 0 (eq_attr "type" "fpop") 12 2)
64 (define_function_unit "fbox" 1 0 (eq_attr "type" "fdivs") 68 0)
65 (define_function_unit "fbox" 1 0 (eq_attr "type" "fdivt") 126 0)
67 (define_function_unit "divider" 1 0 (eq_attr "type" "fdivs") 68 60)
68 (define_function_unit "divider" 1 0 (eq_attr "type" "fdivt") 126 118)
70 ;; First define the arithmetic insns. Note that the 32-bit forms also
73 ;; Note that we can do sign extensions in both FP and integer registers.
74 ;; However, the result must be in the same type of register as the input.
75 ;; The register preferencing code can't handle this case very well, so, for
76 ;; now, don't let the FP case show up here for preferencing. Also,
77 ;; sign-extends in FP registers take two instructions.
78 (define_insn "extendsidi2"
79 [(set (match_operand:DI 0 "register_operand" "=r,r,*f")
80 (sign_extend:DI (match_operand:SI 1 "nonimmediate_operand" "r,m,*f")))]
85 cvtql %1,%0\;cvtlq %0,%0"
86 [(set_attr "type" "iaddlog,ld,fpop")])
88 ;; Do addsi3 the way expand_binop would do if we didn't have one. This
89 ;; generates better code. We have the anonymous addsi3 pattern below in
90 ;; case combine wants to make it.
91 (define_expand "addsi3"
92 [(set (match_operand:SI 0 "register_operand" "")
93 (plus:SI (match_operand:SI 1 "reg_or_0_operand" "")
94 (match_operand:SI 2 "add_operand" "")))]
97 { emit_insn (gen_rtx (SET, VOIDmode, gen_lowpart (DImode, operands[0]),
98 gen_rtx (PLUS, DImode,
99 gen_lowpart (DImode, operands[1]),
100 gen_lowpart (DImode, operands[2]))));
105 [(set (match_operand:SI 0 "register_operand" "=r,r,r,r")
106 (plus:SI (match_operand:SI 1 "reg_or_0_operand" "%rJ,rJ,rJ,rJ")
107 (match_operand:SI 2 "add_operand" "rI,O,K,L")))]
114 [(set_attr "type" "iaddlog")])
117 [(set (match_operand:SI 0 "register_operand" "")
118 (plus:SI (match_operand:SI 1 "register_operand" "")
119 (match_operand:SI 2 "const_int_operand" "")))]
120 "! add_operand (operands[2], SImode)"
121 [(set (match_dup 0) (plus:SI (match_dup 1) (match_dup 3)))
122 (set (match_dup 0) (plus:SI (match_dup 0) (match_dup 4)))]
125 HOST_WIDE_INT val = INTVAL (operands[2]);
126 HOST_WIDE_INT low = (val & 0xffff) - 2 * (val & 0x8000);
127 HOST_WIDE_INT rest = val - low;
129 operands[3] = GEN_INT (rest);
130 operands[4] = GEN_INT (low);
134 [(set (match_operand:DI 0 "register_operand" "=r,r")
136 (plus:SI (match_operand:SI 1 "reg_or_0_operand" "%rJ,rJ")
137 (match_operand:SI 2 "sext_add_operand" "rI,O"))))]
142 [(set_attr "type" "iaddlog")])
145 [(set (match_operand:DI 0 "register_operand" "")
147 (plus:SI (match_operand:SI 1 "register_operand" "")
148 (match_operand:SI 2 "const_int_operand" ""))))
149 (clobber (match_operand:SI 3 "register_operand" ""))]
150 "! sext_add_operand (operands[2], SImode) && INTVAL (operands[2]) > 0
151 && INTVAL (operands[2]) % 4 == 0"
152 [(set (match_dup 3) (match_dup 4))
153 (set (match_dup 0) (sign_extend:DI (plus:SI (mult:SI (match_dup 3)
158 HOST_WIDE_INT val = INTVAL (operands[2]) / 4;
164 operands[4] = GEN_INT (val);
165 operands[5] = GEN_INT (mult);
169 [(set (match_operand:DI 0 "register_operand" "")
171 (plus:SI (match_operator:SI 1 "comparison_operator"
172 [(match_operand 2 "" "")
173 (match_operand 3 "" "")])
174 (match_operand:SI 4 "add_operand" ""))))
175 (clobber (match_operand:DI 5 "register_operand" ""))]
177 [(set (match_dup 5) (match_dup 6))
178 (set (match_dup 0) (sign_extend:DI (plus:SI (match_dup 7) (match_dup 4))))]
181 operands[6] = gen_rtx (GET_CODE (operands[1]), DImode,
182 operands[2], operands[3]);
183 operands[7] = gen_lowpart (SImode, operands[5]);
186 (define_insn "adddi3"
187 [(set (match_operand:DI 0 "register_operand" "=r,r,r,r")
188 (plus:DI (match_operand:DI 1 "reg_or_0_operand" "%rJ,rJ,rJ,rJ")
189 (match_operand:DI 2 "add_operand" "rI,O,K,L")))]
196 [(set_attr "type" "iaddlog")])
198 ;; Don't do this if we are adjusting SP since we don't want to do
201 [(set (match_operand:DI 0 "register_operand" "")
202 (plus:DI (match_operand:DI 1 "register_operand" "")
203 (match_operand:DI 2 "const_int_operand" "")))]
204 "! add_operand (operands[2], DImode)
205 && REGNO (operands[0]) != STACK_POINTER_REGNUM"
206 [(set (match_dup 0) (plus:DI (match_dup 1) (match_dup 3)))
207 (set (match_dup 0) (plus:DI (match_dup 0) (match_dup 4)))]
210 HOST_WIDE_INT val = INTVAL (operands[2]);
211 HOST_WIDE_INT low = (val & 0xffff) - 2 * (val & 0x8000);
212 HOST_WIDE_INT rest = val - low;
214 operands[3] = GEN_INT (rest);
215 operands[4] = GEN_INT (low);
219 [(set (match_operand:SI 0 "register_operand" "=r,r")
220 (plus:SI (mult:SI (match_operand:SI 1 "reg_or_0_operand" "rJ,rJ")
221 (match_operand:SI 2 "const48_operand" "I,I"))
222 (match_operand:SI 3 "sext_add_operand" "rI,O")))]
227 [(set_attr "type" "iaddlog")])
230 [(set (match_operand:DI 0 "register_operand" "=r,r")
232 (plus:SI (mult:SI (match_operand:SI 1 "reg_or_0_operand" "rJ,rJ")
233 (match_operand:SI 2 "const48_operand" "I,I"))
234 (match_operand:SI 3 "sext_add_operand" "rI,O"))))]
239 [(set_attr "type" "iaddlog")])
242 [(set (match_operand:DI 0 "register_operand" "")
244 (plus:SI (mult:SI (match_operator:SI 1 "comparison_operator"
245 [(match_operand 2 "" "")
246 (match_operand 3 "" "")])
247 (match_operand:SI 4 "const48_operand" ""))
248 (match_operand:SI 5 "add_operand" ""))))
249 (clobber (match_operand:DI 6 "register_operand" ""))]
251 [(set (match_dup 6) (match_dup 7))
253 (sign_extend:DI (plus:SI (mult:SI (match_dup 8) (match_dup 4))
257 operands[7] = gen_rtx (GET_CODE (operands[1]), DImode,
258 operands[2], operands[3]);
259 operands[8] = gen_lowpart (SImode, operands[6]);
263 [(set (match_operand:DI 0 "register_operand" "=r,r")
264 (plus:DI (mult:DI (match_operand:DI 1 "reg_or_0_operand" "rJ,rJ")
265 (match_operand:DI 2 "const48_operand" "I,I"))
266 (match_operand:DI 3 "reg_or_8bit_operand" "rI,O")))]
271 [(set_attr "type" "iaddlog")])
273 ;; These variants of the above insns can occur if the third operand
274 ;; is the frame pointer. This is a kludge, but there doesn't
275 ;; seem to be a way around it. Only recognize them while reloading.
278 [(set (match_operand:DI 0 "register_operand" "=&r")
279 (plus:DI (plus:DI (match_operand:DI 1 "register_operand" "r")
280 (match_operand:DI 2 "register_operand" "r"))
281 (match_operand:DI 3 "add_operand" "rIOKL")))]
284 [(set_attr "type" "iaddlog")])
287 [(set (match_operand:DI 0 "register_operand" "")
288 (plus:DI (plus:DI (match_operand:DI 1 "register_operand" "")
289 (match_operand:DI 2 "register_operand" ""))
290 (match_operand:DI 3 "add_operand" "")))]
292 [(set (match_dup 0) (plus:DI (match_dup 1) (match_dup 2)))
293 (set (match_dup 0) (plus:DI (match_dup 0) (match_dup 3)))]
297 [(set (match_operand:SI 0 "register_operand" "=&r")
298 (plus:SI (plus:SI (mult:SI (match_operand:SI 1 "some_operand" "rJ")
299 (match_operand:SI 2 "const48_operand" "I"))
300 (match_operand:SI 3 "register_operand" "r"))
301 (match_operand:SI 4 "add_operand" "rIOKL")))]
304 [(set_attr "type" "iaddlog")])
307 [(set (match_operand:SI 0 "register_operand" "r")
308 (plus:SI (plus:SI (mult:SI (match_operand:SI 1 "reg_or_0_operand" "")
309 (match_operand:SI 2 "const48_operand" ""))
310 (match_operand:SI 3 "register_operand" ""))
311 (match_operand:SI 4 "add_operand" "rIOKL")))]
314 (plus:SI (mult:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
315 (set (match_dup 0) (plus:SI (match_dup 0) (match_dup 4)))]
319 [(set (match_operand:DI 0 "register_operand" "=&r")
322 (mult:SI (match_operand:SI 1 "some_operand" "rJ")
323 (match_operand:SI 2 "const48_operand" "I"))
324 (match_operand:SI 3 "register_operand" "r"))
325 (match_operand:SI 4 "add_operand" "rIOKL"))))]
328 [(set_attr "type" "iaddlog")])
331 [(set (match_operand:DI 0 "register_operand" "")
334 (mult:SI (match_operand:SI 1 "reg_or_0_operand" "")
335 (match_operand:SI 2 "const48_operand" ""))
336 (match_operand:SI 3 "register_operand" ""))
337 (match_operand:SI 4 "add_operand" ""))))]
340 (plus:SI (mult:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
341 (set (match_dup 0) (sign_extend:DI (plus:SI (match_dup 5) (match_dup 4))))]
343 { operands[5] = gen_lowpart (SImode, operands[0]);
347 [(set (match_operand:DI 0 "register_operand" "=&r")
348 (plus:DI (plus:DI (mult:DI (match_operand:DI 1 "some_operand" "rJ")
349 (match_operand:DI 2 "const48_operand" "I"))
350 (match_operand:DI 3 "register_operand" "r"))
351 (match_operand:DI 4 "add_operand" "rIOKL")))]
353 "s%2addq %r1,%3,%0\;addq %0,%4,%0"
354 [(set_attr "type" "iaddlog")])
357 [(set (match_operand:DI 0 "register_operand" "=")
358 (plus:DI (plus:DI (mult:DI (match_operand:DI 1 "reg_or_0_operand" "")
359 (match_operand:DI 2 "const48_operand" ""))
360 (match_operand:DI 3 "register_operand" ""))
361 (match_operand:DI 4 "add_operand" "")))]
364 (plus:DI (mult:DI (match_dup 1) (match_dup 2)) (match_dup 3)))
365 (set (match_dup 0) (plus:DI (match_dup 0) (match_dup 4)))]
368 (define_insn "negsi2"
369 [(set (match_operand:SI 0 "register_operand" "=r")
370 (neg:SI (match_operand:SI 1 "reg_or_8bit_operand" "rI")))]
373 [(set_attr "type" "iaddlog")])
376 [(set (match_operand:DI 0 "register_operand" "=r")
377 (sign_extend:DI (neg:SI
378 (match_operand:SI 1 "reg_or_8bit_operand" "rI"))))]
381 [(set_attr "type" "iaddlog")])
383 (define_insn "negdi2"
384 [(set (match_operand:DI 0 "register_operand" "=r")
385 (neg:DI (match_operand:DI 1 "reg_or_8bit_operand" "rI")))]
388 [(set_attr "type" "iaddlog")])
390 (define_expand "subsi3"
391 [(set (match_operand:SI 0 "register_operand" "")
392 (minus:SI (match_operand:SI 1 "reg_or_0_operand" "")
393 (match_operand:SI 2 "reg_or_8bit_operand" "")))]
396 { emit_insn (gen_rtx (SET, VOIDmode, gen_lowpart (DImode, operands[0]),
397 gen_rtx (MINUS, DImode,
398 gen_lowpart (DImode, operands[1]),
399 gen_lowpart (DImode, operands[2]))));
405 [(set (match_operand:SI 0 "register_operand" "=r")
406 (minus:SI (match_operand:SI 1 "reg_or_0_operand" "rJ")
407 (match_operand:SI 2 "reg_or_8bit_operand" "rI")))]
410 [(set_attr "type" "iaddlog")])
413 [(set (match_operand:DI 0 "register_operand" "=r")
414 (sign_extend:DI (minus:SI (match_operand:SI 1 "reg_or_0_operand" "rJ")
415 (match_operand:SI 2 "reg_or_8bit_operand" "rI"))))]
418 [(set_attr "type" "iaddlog")])
420 (define_insn "subdi3"
421 [(set (match_operand:DI 0 "register_operand" "=r")
422 (minus:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
423 (match_operand:DI 2 "reg_or_8bit_operand" "rI")))]
426 [(set_attr "type" "iaddlog")])
429 [(set (match_operand:SI 0 "register_operand" "=r")
430 (minus:SI (mult:SI (match_operand:SI 1 "reg_or_0_operand" "rJ")
431 (match_operand:SI 2 "const48_operand" "I"))
432 (match_operand:SI 3 "reg_or_8bit_operand" "rI")))]
435 [(set_attr "type" "iaddlog")])
438 [(set (match_operand:DI 0 "register_operand" "=r")
440 (minus:SI (mult:SI (match_operand:SI 1 "reg_or_0_operand" "rJ")
441 (match_operand:SI 2 "const48_operand" "I"))
442 (match_operand:SI 3 "reg_or_8bit_operand" "rI"))))]
445 [(set_attr "type" "iaddlog")])
448 [(set (match_operand:DI 0 "register_operand" "=r")
449 (minus:DI (mult:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
450 (match_operand:DI 2 "const48_operand" "I"))
451 (match_operand:DI 3 "reg_or_8bit_operand" "rI")))]
454 [(set_attr "type" "iaddlog")])
456 (define_insn "mulsi3"
457 [(set (match_operand:SI 0 "register_operand" "=r")
458 (mult:SI (match_operand:SI 1 "reg_or_0_operand" "%rJ")
459 (match_operand:SI 2 "reg_or_0_operand" "rJ")))]
462 [(set_attr "type" "imull")])
465 [(set (match_operand:DI 0 "register_operand" "=r")
466 (sign_extend:DI (mult:SI (match_operand:SI 1 "reg_or_0_operand" "%rJ")
467 (match_operand:SI 2 "reg_or_0_operand" "rJ"))))]
470 [(set_attr "type" "imull")])
472 (define_insn "muldi3"
473 [(set (match_operand:DI 0 "register_operand" "=r")
474 (mult:DI (match_operand:DI 1 "reg_or_0_operand" "%rJ")
475 (match_operand:DI 2 "reg_or_0_operand" "rJ")))]
478 [(set_attr "type" "imulq")])
480 (define_insn "umuldi3_highpart"
481 [(set (match_operand:DI 0 "register_operand" "=r")
484 (mult:TI (zero_extend:TI (match_operand:DI 1 "register_operand" "r"))
485 (zero_extend:TI (match_operand:DI 2 "register_operand" "r")))
489 [(set_attr "type" "imulq")])
492 [(set (match_operand:DI 0 "register_operand" "=r")
495 (mult:TI (zero_extend:TI (match_operand:DI 1 "register_operand" "r"))
496 (match_operand:TI 2 "cint8_operand" "I"))
500 [(set_attr "type" "imulq")])
502 ;; The divide and remainder operations always take their inputs from
503 ;; r24 and r25, put their output in r27, and clobber r23 and r28.
505 (define_expand "divsi3"
506 [(set (reg:SI 24) (match_operand:SI 1 "input_operand" ""))
507 (set (reg:SI 25) (match_operand:SI 2 "input_operand" ""))
508 (parallel [(set (reg:SI 27)
511 (clobber (reg:DI 23))
512 (clobber (reg:DI 28))])
513 (set (match_operand:SI 0 "general_operand" "")
518 (define_expand "udivsi3"
519 [(set (reg:SI 24) (match_operand:SI 1 "input_operand" ""))
520 (set (reg:SI 25) (match_operand:SI 2 "input_operand" ""))
521 (parallel [(set (reg:SI 27)
524 (clobber (reg:DI 23))
525 (clobber (reg:DI 28))])
526 (set (match_operand:SI 0 "general_operand" "")
531 (define_expand "modsi3"
532 [(set (reg:SI 24) (match_operand:SI 1 "input_operand" ""))
533 (set (reg:SI 25) (match_operand:SI 2 "input_operand" ""))
534 (parallel [(set (reg:SI 27)
537 (clobber (reg:DI 23))
538 (clobber (reg:DI 28))])
539 (set (match_operand:SI 0 "general_operand" "")
544 (define_expand "umodsi3"
545 [(set (reg:SI 24) (match_operand:SI 1 "input_operand" ""))
546 (set (reg:SI 25) (match_operand:SI 2 "input_operand" ""))
547 (parallel [(set (reg:SI 27)
550 (clobber (reg:DI 23))
551 (clobber (reg:DI 28))])
552 (set (match_operand:SI 0 "general_operand" "")
557 (define_expand "divdi3"
558 [(set (reg:DI 24) (match_operand:DI 1 "input_operand" ""))
559 (set (reg:DI 25) (match_operand:DI 2 "input_operand" ""))
560 (parallel [(set (reg:DI 27)
563 (clobber (reg:DI 23))
564 (clobber (reg:DI 28))])
565 (set (match_operand:DI 0 "general_operand" "")
570 (define_expand "udivdi3"
571 [(set (reg:DI 24) (match_operand:DI 1 "input_operand" ""))
572 (set (reg:DI 25) (match_operand:DI 2 "input_operand" ""))
573 (parallel [(set (reg:DI 27)
576 (clobber (reg:DI 23))
577 (clobber (reg:DI 28))])
578 (set (match_operand:DI 0 "general_operand" "")
583 (define_expand "moddi3"
584 [(set (reg:DI 24) (match_operand:DI 1 "input_operand" ""))
585 (set (reg:DI 25) (match_operand:DI 2 "input_operand" ""))
586 (parallel [(set (reg:DI 27)
589 (clobber (reg:DI 23))
590 (clobber (reg:DI 28))])
591 (set (match_operand:DI 0 "general_operand" "")
596 (define_expand "umoddi3"
597 [(set (reg:DI 24) (match_operand:DI 1 "input_operand" ""))
598 (set (reg:DI 25) (match_operand:DI 2 "input_operand" ""))
599 (parallel [(set (reg:DI 27)
602 (clobber (reg:DI 23))
603 (clobber (reg:DI 28))])
604 (set (match_operand:DI 0 "general_operand" "")
611 (match_operator:SI 1 "divmod_operator"
612 [(reg:SI 24) (reg:SI 25)]))
613 (clobber (reg:DI 23))
614 (clobber (reg:DI 28))]
617 [(set_attr "type" "isubr")])
621 (match_operator:DI 1 "divmod_operator"
622 [(reg:DI 24) (reg:DI 25)]))
623 (clobber (reg:DI 23))
624 (clobber (reg:DI 28))]
627 [(set_attr "type" "isubr")])
629 ;; Next are the basic logical operations. These only exist in DImode.
631 (define_insn "anddi3"
632 [(set (match_operand:DI 0 "register_operand" "=r,r,r")
633 (and:DI (match_operand:DI 1 "reg_or_0_operand" "%rJ,rJ,rJ")
634 (match_operand:DI 2 "and_operand" "rI,N,MH")))]
640 [(set_attr "type" "iaddlog,iaddlog,shiftcm")])
642 ;; There are times when we can split and AND into two AND insns. This occurs
643 ;; when we can first clear any bytes and then clear anything else. For
644 ;; example "I & 0xffff07" is "(I & 0xffffff) & 0xffffffffffffff07".
645 ;; Only to this when running on 64-bit host since the computations are
646 ;; too messy otherwise.
649 [(set (match_operand:DI 0 "register_operand" "")
650 (and:DI (match_operand:DI 1 "register_operand" "")
651 (match_operand:DI 2 "const_int_operand" "")))]
652 "HOST_BITS_PER_WIDE_INT == 64 && ! and_operand (operands[2], DImode)"
653 [(set (match_dup 0) (and:DI (match_dup 1) (match_dup 3)))
654 (set (match_dup 0) (and:DI (match_dup 0) (match_dup 4)))]
657 unsigned HOST_WIDE_INT mask1 = INTVAL (operands[2]);
658 unsigned HOST_WIDE_INT mask2 = mask1;
661 /* For each byte that isn't all zeros, make it all ones. */
662 for (i = 0; i < 64; i += 8)
663 if ((mask1 & ((HOST_WIDE_INT) 0xff << i)) != 0)
664 mask1 |= (HOST_WIDE_INT) 0xff << i;
666 /* Now turn on any bits we've just turned off. */
669 operands[3] = GEN_INT (mask1);
670 operands[4] = GEN_INT (mask2);
673 (define_insn "zero_extendqihi2"
674 [(set (match_operand:HI 0 "register_operand" "=r")
675 (zero_extend:HI (match_operand:QI 1 "register_operand" "r")))]
678 [(set_attr "type" "iaddlog")])
680 (define_insn "zero_extendqisi2"
681 [(set (match_operand:SI 0 "register_operand" "=r")
682 (zero_extend:SI (match_operand:QI 1 "register_operand" "r")))]
685 [(set_attr "type" "iaddlog")])
687 (define_insn "zero_extendqidi2"
688 [(set (match_operand:DI 0 "register_operand" "=r")
689 (zero_extend:DI (match_operand:QI 1 "register_operand" "r")))]
692 [(set_attr "type" "iaddlog")])
694 (define_insn "zero_extendhisi2"
695 [(set (match_operand:SI 0 "register_operand" "=r")
696 (zero_extend:SI (match_operand:HI 1 "register_operand" "r")))]
699 [(set_attr "type" "iaddlog")])
701 (define_insn "zero_extendhidi2"
702 [(set (match_operand:DI 0 "register_operand" "=r")
703 (zero_extend:DI (match_operand:HI 1 "register_operand" "r")))]
706 [(set_attr "type" "iaddlog")])
708 (define_insn "zero_extendsidi2"
709 [(set (match_operand:DI 0 "register_operand" "=r")
710 (zero_extend:DI (match_operand:SI 1 "register_operand" "r")))]
713 [(set_attr "type" "iaddlog")])
716 [(set (match_operand:DI 0 "register_operand" "=r")
717 (and:DI (not:DI (match_operand:DI 1 "reg_or_8bit_operand" "rI"))
718 (match_operand:DI 2 "reg_or_0_operand" "rJ")))]
721 [(set_attr "type" "iaddlog")])
723 (define_insn "iordi3"
724 [(set (match_operand:DI 0 "register_operand" "=r,r")
725 (ior:DI (match_operand:DI 1 "reg_or_0_operand" "%rJ,rJ")
726 (match_operand:DI 2 "or_operand" "rI,N")))]
731 [(set_attr "type" "iaddlog")])
733 (define_insn "one_cmpldi2"
734 [(set (match_operand:DI 0 "register_operand" "=r")
735 (not:DI (match_operand:DI 1 "reg_or_8bit_operand" "rI")))]
738 [(set_attr "type" "iaddlog")])
741 [(set (match_operand:DI 0 "register_operand" "=r")
742 (ior:DI (not:DI (match_operand:DI 1 "reg_or_8bit_operand" "rI"))
743 (match_operand:DI 2 "reg_or_0_operand" "rJ")))]
746 [(set_attr "type" "iaddlog")])
748 (define_insn "xordi3"
749 [(set (match_operand:DI 0 "register_operand" "=r,r")
750 (xor:DI (match_operand:DI 1 "reg_or_0_operand" "%rJ,rJ")
751 (match_operand:DI 2 "or_operand" "rI,N")))]
756 [(set_attr "type" "iaddlog")])
759 [(set (match_operand:DI 0 "register_operand" "=r")
760 (not:DI (xor:DI (match_operand:DI 1 "register_operand" "%rJ")
761 (match_operand:DI 2 "register_operand" "rI"))))]
764 [(set_attr "type" "iaddlog")])
766 ;; Next come the shifts and the various extract and insert operations.
768 (define_insn "ashldi3"
769 [(set (match_operand:DI 0 "register_operand" "=r,r")
770 (ashift:DI (match_operand:DI 1 "reg_or_0_operand" "rJ,rJ")
771 (match_operand:DI 2 "reg_or_6bit_operand" "P,rI")))]
775 switch (which_alternative)
778 if (operands[2] == const1_rtx)
779 return \"addq %r1,%r1,%0\";
781 return \"s%P2addq %r1,0,%0\";
783 return \"sll %r1,%2,%0\";
786 [(set_attr "type" "iaddlog,shiftcm")])
788 ;; ??? The following pattern is made by combine, but earlier phases
789 ;; (specifically flow) can't handle it. This occurs in jump.c. Deal
790 ;; with this in a better way at some point.
792 ;; [(set (match_operand:DI 0 "register_operand" "=r")
794 ;; (subreg:SI (ashift:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
795 ;; (match_operand:DI 2 "const_int_operand" "P"))
797 ;; "INTVAL (operands[2]) >= 1 && INTVAL (operands[2]) <= 3"
800 ;; if (operands[2] == const1_rtx)
801 ;; return \"addl %r1,%r1,%0\";
803 ;; return \"s%P2addl %r1,0,%0\";
805 ;; [(set_attr "type" "iaddlog")])
807 (define_insn "lshrdi3"
808 [(set (match_operand:DI 0 "register_operand" "=r")
809 (lshiftrt:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
810 (match_operand:DI 2 "reg_or_6bit_operand" "rI")))]
814 (define_insn "ashrdi3"
815 [(set (match_operand:DI 0 "register_operand" "=r")
816 (ashiftrt:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
817 (match_operand:DI 2 "reg_or_6bit_operand" "rI")))]
821 (define_expand "extendqihi2"
823 (ashift:DI (match_operand:QI 1 "register_operand" "")
825 (set (match_operand:HI 0 "register_operand" "")
826 (ashiftrt:DI (match_dup 2)
830 { operands[0] = gen_lowpart (DImode, operands[0]);
831 operands[1] = gen_lowpart (DImode, operands[1]);
832 operands[2] = gen_reg_rtx (DImode);
835 (define_expand "extendqisi2"
837 (ashift:DI (match_operand:QI 1 "register_operand" "")
839 (set (match_operand:SI 0 "register_operand" "")
840 (ashiftrt:DI (match_dup 2)
844 { operands[0] = gen_lowpart (DImode, operands[0]);
845 operands[1] = gen_lowpart (DImode, operands[1]);
846 operands[2] = gen_reg_rtx (DImode);
849 (define_expand "extendqidi2"
851 (ashift:DI (match_operand:QI 1 "register_operand" "")
853 (set (match_operand:DI 0 "register_operand" "")
854 (ashiftrt:DI (match_dup 2)
858 { operands[1] = gen_lowpart (DImode, operands[1]);
859 operands[2] = gen_reg_rtx (DImode);
862 (define_expand "extendhisi2"
864 (ashift:DI (match_operand:HI 1 "register_operand" "")
866 (set (match_operand:SI 0 "register_operand" "")
867 (ashiftrt:DI (match_dup 2)
871 { operands[0] = gen_lowpart (DImode, operands[0]);
872 operands[1] = gen_lowpart (DImode, operands[1]);
873 operands[2] = gen_reg_rtx (DImode);
876 (define_expand "extendhidi2"
878 (ashift:DI (match_operand:HI 1 "register_operand" "")
880 (set (match_operand:DI 0 "register_operand" "")
881 (ashiftrt:DI (match_dup 2)
885 { operands[1] = gen_lowpart (DImode, operands[1]);
886 operands[2] = gen_reg_rtx (DImode);
890 [(set (match_operand:DI 0 "register_operand" "=r")
891 (zero_extract:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
892 (match_operand:DI 2 "mode_width_operand" "n")
893 (match_operand:DI 3 "mul8_operand" "I")))]
895 "ext%M2l %r1,%s3,%0")
898 [(set (match_operand:DI 0 "register_operand" "=r")
899 (zero_extract:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
900 (match_operand:DI 2 "mode_width_operand" "n")
901 (ashift:DI (match_operand:DI 3 "reg_or_8bit_operand" "rI")
907 [(set (match_operand:DI 0 "register_operand" "=r")
909 (zero_extract:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
913 (match_operand:DI 2 "reg_or_8bit_operand" "rI")
921 [(set (match_operand:DI 0 "register_operand" "=r")
923 (zero_extract:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
927 (match_operand:DI 2 "reg_or_8bit_operand" "rI")
935 [(set (match_operand:DI 0 "register_operand" "=r")
937 (zero_extract:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
941 (match_operand:DI 2 "reg_or_8bit_operand" "rI")
948 ;; This converts an extXl into an extXh with an appropriate adjustment
949 ;; to the address calculation.
952 [(set (match_operand:DI 0 "register_operand" "")
953 (ashift:DI (zero_extract:DI (match_operand:DI 1 "register_operand" "")
954 (match_operand:DI 2 "mode_width_operand" "")
955 (ashift:DI (match_operand:DI 3 "" "")
957 (match_operand:DI 4 "const_int_operand" "")))
958 (clobber (match_operand:DI 5 "register_operand" ""))]
959 "INTVAL (operands[4]) == 64 - INTVAL (operands[2])"
960 [(set (match_dup 5) (match_dup 6))
962 (ashift:DI (zero_extract:DI (match_dup 1) (match_dup 2)
963 (ashift:DI (plus:DI (match_dup 5)
969 operands[6] = plus_constant (operands[3],
970 INTVAL (operands[2]) / BITS_PER_UNIT);
971 operands[7] = GEN_INT (- INTVAL (operands[2]) / BITS_PER_UNIT);
975 [(set (match_operand:DI 0 "register_operand" "=r")
976 (ashift:DI (zero_extend:DI (match_operand:QI 1 "register_operand" "r"))
977 (match_operand:DI 2 "mul8_operand" "I")))]
982 [(set (match_operand:DI 0 "register_operand" "=r")
983 (ashift:DI (zero_extend:DI (match_operand:HI 1 "register_operand" "r"))
984 (match_operand:DI 2 "mul8_operand" "I")))]
989 [(set (match_operand:DI 0 "register_operand" "=r")
990 (ashift:DI (zero_extend:DI (match_operand:SI 1 "register_operand" "r"))
991 (match_operand:DI 2 "mul8_operand" "I")))]
996 [(set (match_operand:DI 0 "register_operand" "=r")
997 (ashift:DI (zero_extend:DI (match_operand:QI 1 "register_operand" "r"))
998 (ashift:DI (match_operand:DI 2 "reg_or_8bit_operand" "rI")
1004 [(set (match_operand:DI 0 "register_operand" "=r")
1005 (ashift:DI (zero_extend:DI (match_operand:HI 1 "register_operand" "r"))
1006 (ashift:DI (match_operand:DI 2 "reg_or_8bit_operand" "rI")
1012 [(set (match_operand:DI 0 "register_operand" "=r")
1013 (ashift:DI (zero_extend:DI (match_operand:SI 1 "register_operand" "r"))
1014 (ashift:DI (match_operand:DI 2 "reg_or_8bit_operand" "rI")
1019 ;; We do not include the insXh insns because they are complex to express
1020 ;; and it does not appear that we would ever want to generate them.
1023 [(set (match_operand:DI 0 "register_operand" "=r")
1024 (and:DI (not:DI (ashift:DI
1025 (match_operand:DI 2 "mode_mask_operand" "n")
1027 (match_operand:DI 3 "reg_or_8bit_operand" "rI")
1029 (match_operand:DI 1 "reg_or_0_operand" "rJ")))]
1031 "msk%U2l %r1,%3,%0")
1033 ;; We do not include the mskXh insns because it does not appear we would ever
1036 ;; Floating-point operations. All the double-precision insns can extend
1037 ;; from single, so indicate that. The exception are the ones that simply
1038 ;; play with the sign bits; it's not clear what to do there.
1040 (define_insn "abssf2"
1041 [(set (match_operand:SF 0 "register_operand" "=f")
1042 (abs:SF (match_operand:SF 1 "reg_or_fp0_operand" "fG")))]
1045 [(set_attr "type" "fpop")])
1047 (define_insn "absdf2"
1048 [(set (match_operand:DF 0 "register_operand" "=f")
1049 (abs:DF (match_operand:DF 1 "reg_or_fp0_operand" "fG")))]
1052 [(set_attr "type" "fpop")])
1054 (define_insn "negsf2"
1055 [(set (match_operand:SF 0 "register_operand" "=f")
1056 (neg:SF (match_operand:SF 1 "reg_or_fp0_operand" "fG")))]
1059 [(set_attr "type" "fpop")])
1061 (define_insn "negdf2"
1062 [(set (match_operand:DF 0 "register_operand" "=f")
1063 (neg:DF (match_operand:DF 1 "reg_or_fp0_operand" "fG")))]
1066 [(set_attr "type" "fpop")])
1068 (define_insn "addsf3"
1069 [(set (match_operand:SF 0 "register_operand" "=f")
1070 (plus:SF (match_operand:SF 1 "reg_or_fp0_operand" "%fG")
1071 (match_operand:SF 2 "reg_or_fp0_operand" "fG")))]
1074 [(set_attr "type" "fpop")])
1076 (define_insn "adddf3"
1077 [(set (match_operand:DF 0 "register_operand" "=f")
1078 (plus:DF (match_operand:DF 1 "reg_or_fp0_operand" "%fG")
1079 (match_operand:DF 2 "reg_or_fp0_operand" "fG")))]
1082 [(set_attr "type" "fpop")])
1085 [(set (match_operand:DF 0 "register_operand" "=f")
1086 (plus:DF (float_extend:DF
1087 (match_operand:SF 1 "reg_or_fp0_operand" "fG"))
1088 (match_operand:DF 2 "reg_or_fp0_operand" "fG")))]
1091 [(set_attr "type" "fpop")])
1094 [(set (match_operand:DF 0 "register_operand" "=f")
1095 (plus:DF (float_extend:DF
1096 (match_operand:SF 1 "reg_or_fp0_operand" "%fG"))
1098 (match_operand:SF 2 "reg_or_fp0_operand" "fG"))))]
1101 [(set_attr "type" "fpop")])
1103 (define_insn "fix_truncdfdi2"
1104 [(set (match_operand:DI 0 "register_operand" "=f")
1105 (fix:DI (match_operand:DF 1 "reg_or_fp0_operand" "fG")))]
1108 [(set_attr "type" "fpop")])
1110 (define_insn "fix_truncsfdi2"
1111 [(set (match_operand:DI 0 "register_operand" "=f")
1112 (fix:DI (float_extend:DF
1113 (match_operand:SF 1 "reg_or_fp0_operand" "fG"))))]
1116 [(set_attr "type" "fpop")])
1118 (define_insn "floatdisf2"
1119 [(set (match_operand:SF 0 "register_operand" "=f")
1120 (float:SF (match_operand:DI 1 "register_operand" "f")))]
1123 [(set_attr "type" "fpop")])
1125 (define_insn "floatdidf2"
1126 [(set (match_operand:DF 0 "register_operand" "=f")
1127 (float:DF (match_operand:DI 1 "register_operand" "f")))]
1130 [(set_attr "type" "fpop")])
1132 (define_insn "extendsfdf2"
1133 [(set (match_operand:DF 0 "register_operand" "=f,f")
1134 (float_extend:DF (match_operand:SF 1 "nonimmediate_operand" "f,m")))]
1139 [(set_attr "type" "fpop,ld")])
1141 (define_insn "truncdfsf2"
1142 [(set (match_operand:SF 0 "register_operand" "=f")
1143 (float_truncate:SF (match_operand:DF 1 "reg_or_fp0_operand" "fG")))]
1146 [(set_attr "type" "fpop")])
1148 (define_insn "divsf3"
1149 [(set (match_operand:SF 0 "register_operand" "=f")
1150 (div:SF (match_operand:SF 1 "reg_or_fp0_operand" "fG")
1151 (match_operand:SF 2 "reg_or_fp0_operand" "fG")))]
1154 [(set_attr "type" "fdivs")])
1156 (define_insn "divdf3"
1157 [(set (match_operand:DF 0 "register_operand" "=f")
1158 (div:DF (match_operand:DF 1 "reg_or_fp0_operand" "fG")
1159 (match_operand:DF 2 "reg_or_fp0_operand" "fG")))]
1162 [(set_attr "type" "fdivt")])
1165 [(set (match_operand:DF 0 "register_operand" "=f")
1166 (div:DF (float_extend:DF (match_operand:SF 1 "reg_or_fp0_operand" "fG"))
1167 (match_operand:DF 2 "reg_or_fp0_operand" "fG")))]
1170 [(set_attr "type" "fdivt")])
1173 [(set (match_operand:DF 0 "register_operand" "=f")
1174 (div:DF (match_operand:DF 1 "reg_or_fp0_operand" "fG")
1176 (match_operand:SF 2 "reg_or_fp0_operand" "fG"))))]
1179 [(set_attr "type" "fdivt")])
1182 [(set (match_operand:DF 0 "register_operand" "=f")
1183 (div:DF (float_extend:DF (match_operand:SF 1 "reg_or_fp0_operand" "fG"))
1184 (float_extend:DF (match_operand:SF 2 "reg_or_fp0_operand" "fG"))))]
1187 [(set_attr "type" "fdivt")])
1189 (define_insn "mulsf3"
1190 [(set (match_operand:SF 0 "register_operand" "=f")
1191 (mult:SF (match_operand:SF 1 "reg_or_fp0_operand" "%fG")
1192 (match_operand:SF 2 "reg_or_fp0_operand" "fG")))]
1195 [(set_attr "type" "fpop")])
1197 (define_insn "muldf3"
1198 [(set (match_operand:DF 0 "register_operand" "=f")
1199 (mult:DF (match_operand:DF 1 "reg_or_fp0_operand" "%fG")
1200 (match_operand:DF 2 "reg_or_fp0_operand" "fG")))]
1203 [(set_attr "type" "fpop")])
1206 [(set (match_operand:DF 0 "register_operand" "=f")
1207 (mult:DF (float_extend:DF
1208 (match_operand:SF 1 "reg_or_fp0_operand" "fG"))
1209 (match_operand:DF 2 "reg_or_fp0_operand" "fG")))]
1212 [(set_attr "type" "fpop")])
1215 [(set (match_operand:DF 0 "register_operand" "=f")
1216 (mult:DF (float_extend:DF
1217 (match_operand:SF 1 "reg_or_fp0_operand" "%fG"))
1219 (match_operand:SF 2 "reg_or_fp0_operand" "fG"))))]
1222 [(set_attr "type" "fpop")])
1224 (define_insn "subsf3"
1225 [(set (match_operand:SF 0 "register_operand" "=f")
1226 (minus:SF (match_operand:SF 1 "reg_or_fp0_operand" "fG")
1227 (match_operand:SF 2 "reg_or_fp0_operand" "fG")))]
1230 [(set_attr "type" "fpop")])
1232 (define_insn "subdf3"
1233 [(set (match_operand:DF 0 "register_operand" "=f")
1234 (minus:DF (match_operand:DF 1 "reg_or_fp0_operand" "fG")
1235 (match_operand:DF 2 "reg_or_fp0_operand" "fG")))]
1238 [(set_attr "type" "fpop")])
1241 [(set (match_operand:DF 0 "register_operand" "=f")
1242 (minus:DF (float_extend:DF
1243 (match_operand:SF 1 "reg_or_fp0_operand" "fG"))
1244 (match_operand:DF 2 "reg_or_fp0_operand" "fG")))]
1247 [(set_attr "type" "fpop")])
1250 [(set (match_operand:DF 0 "register_operand" "=f")
1251 (minus:DF (match_operand:DF 1 "reg_or_fp0_operand" "fG")
1253 (match_operand:SF 2 "reg_or_fp0_operand" "fG"))))]
1256 [(set_attr "type" "fpop")])
1259 [(set (match_operand:DF 0 "register_operand" "=f")
1260 (minus:DF (float_extend:DF
1261 (match_operand:SF 1 "reg_or_fp0_operand" "fG"))
1263 (match_operand:SF 2 "reg_or_fp0_operand" "fG"))))]
1266 [(set_attr "type" "fpop")])
1268 ;; Next are all the integer comparisons, and conditional moves and branches
1269 ;; and some of the related define_expand's and define_split's.
1272 [(set (match_operand:DI 0 "register_operand" "=r")
1273 (match_operator:DI 1 "alpha_comparison_operator"
1274 [(match_operand:DI 2 "reg_or_0_operand" "rJ")
1275 (match_operand:DI 3 "reg_or_8bit_operand" "rI")]))]
1278 [(set_attr "type" "icmp")])
1280 ;; There are three important special-case that don't fit the above pattern
1281 ;; but which we want to handle here.
1284 [(set (match_operand:DI 0 "register_operand" "=r")
1285 (ne:DI (match_operand:DI 1 "register_operand" "r")
1289 [(set_attr "type" "icmp")])
1292 [(set (match_operand:DI 0 "register_operand" "=r")
1293 (gt:DI (match_operand:DI 1 "register_operand" "r")
1297 [(set_attr "type" "icmp")])
1300 [(set (match_operand:DI 0 "register_operand" "=r")
1301 (ge:DI (match_operand:DI 1 "register_operand" "r")
1305 [(set_attr "type" "icmp")])
1307 ;; This pattern exists so conditional moves of SImode values are handled.
1308 ;; Comparisons are still done in DImode though.
1311 [(set (match_operand:SI 0 "register_operand" "=r,r,r,r")
1313 (match_operator 2 "signed_comparison_operator"
1314 [(match_operand:DI 3 "reg_or_0_operand" "rJ,rJ,J,J")
1315 (match_operand:DI 4 "reg_or_0_operand" "J,J,rJ,rJ")])
1316 (match_operand:SI 1 "reg_or_8bit_operand" "rI,0,rI,0")
1317 (match_operand:SI 5 "reg_or_8bit_operand" "0,rI,0,rI")))]
1318 "operands[3] == const0_rtx || operands[4] == const0_rtx"
1326 [(set (match_operand:DI 0 "register_operand" "=r,r,r,r")
1328 (match_operator 2 "signed_comparison_operator"
1329 [(match_operand:DI 3 "reg_or_0_operand" "rJ,rJ,J,J")
1330 (match_operand:DI 4 "reg_or_0_operand" "J,J,rJ,rJ")])
1331 (match_operand:DI 1 "reg_or_8bit_operand" "rI,0,rI,0")
1332 (match_operand:DI 5 "reg_or_8bit_operand" "0,rI,0,rI")))]
1333 "operands[3] == const0_rtx || operands[4] == const0_rtx"
1341 [(set (match_operand:DI 0 "register_operand" "=r,r")
1343 (eq (zero_extract:DI (match_operand:DI 2 "reg_or_0_operand" "rJ,rJ")
1347 (match_operand:DI 1 "reg_or_8bit_operand" "rI,0")
1348 (match_operand:DI 3 "reg_or_8bit_operand" "0,rI")))]
1355 [(set (match_operand:DI 0 "register_operand" "=r,r")
1357 (ne (zero_extract:DI (match_operand:DI 2 "reg_or_0_operand" "rJ,rJ")
1361 (match_operand:DI 1 "reg_or_8bit_operand" "rI,0")
1362 (match_operand:DI 3 "reg_or_8bit_operand" "0,rI")))]
1368 ;; This form is added since combine thinks that an IF_THEN_ELSE with both
1369 ;; arms constant is a single insn, so it won't try to form it if combine
1370 ;; knows they are really two insns. This occurs in divides by powers
1374 [(set (match_operand:DI 0 "register_operand" "=r")
1376 (match_operator 2 "signed_comparison_operator"
1377 [(match_operand:DI 3 "reg_or_0_operand" "rJ")
1379 (plus:DI (match_dup 0)
1380 (match_operand:DI 1 "reg_or_8bit_operand" "rI"))
1382 (clobber (match_scratch:DI 4 "=&r"))]
1384 "addq %0,%1,%4\;cmov%C2 %r3,%4,%0")
1387 [(set (match_operand:DI 0 "register_operand" "")
1389 (match_operator 2 "signed_comparison_operator"
1390 [(match_operand:DI 3 "reg_or_0_operand" "")
1392 (plus:DI (match_dup 0)
1393 (match_operand:DI 1 "reg_or_8bit_operand" ""))
1395 (clobber (match_operand:DI 4 "register_operand" ""))]
1397 [(set (match_dup 4) (plus:DI (match_dup 0) (match_dup 1)))
1398 (set (match_dup 0) (if_then_else:DI (match_op_dup 2
1401 (match_dup 4) (match_dup 0)))]
1406 [(set (match_operand:DI 0 "register_operand" "")
1408 (match_operator 1 "comparison_operator"
1409 [(zero_extract:DI (match_operand:DI 2 "register_operand" "")
1411 (match_operand:DI 3 "const_int_operand" ""))
1413 (match_operand:DI 4 "reg_or_8bit_operand" "")
1414 (match_operand:DI 5 "reg_or_8bit_operand" "")))
1415 (clobber (match_operand:DI 6 "register_operand" ""))])]
1416 "INTVAL (operands[3]) != 0"
1418 (lshiftrt:DI (match_dup 2) (match_dup 3)))
1420 (if_then_else:DI (match_op_dup 1
1421 [(zero_extract:DI (match_dup 6)
1429 ;; For ABS, we have two choices, depending on whether the input and output
1430 ;; registers are the same or not.
1431 (define_expand "absdi2"
1432 [(set (match_operand:DI 0 "register_operand" "")
1433 (abs:DI (match_operand:DI 1 "register_operand" "")))]
1436 { if (rtx_equal_p (operands[0], operands[1]))
1437 emit_insn (gen_absdi2_same (operands[0], gen_reg_rtx (DImode)));
1439 emit_insn (gen_absdi2_diff (operands[0], operands[1]));
1444 (define_expand "absdi2_same"
1445 [(set (match_operand:DI 1 "register_operand" "")
1446 (neg:DI (match_operand:DI 0 "register_operand" "")))
1448 (if_then_else:DI (ge (match_dup 0) (const_int 0))
1454 (define_expand "absdi2_diff"
1455 [(set (match_operand:DI 0 "register_operand" "")
1456 (neg:DI (match_operand:DI 1 "register_operand" "")))
1458 (if_then_else:DI (lt (match_dup 1) (const_int 0))
1465 [(set (match_operand:DI 0 "register_operand" "")
1466 (abs:DI (match_dup 0)))
1467 (clobber (match_operand:DI 2 "register_operand" ""))]
1469 [(set (match_dup 1) (neg:DI (match_dup 0)))
1470 (set (match_dup 0) (if_then_else:DI (ge (match_dup 0) (const_int 0))
1471 (match_dup 0) (match_dup 1)))]
1475 [(set (match_operand:DI 0 "register_operand" "")
1476 (abs:DI (match_operand:DI 1 "register_operand" "")))]
1477 "! rtx_equal_p (operands[0], operands[1])"
1478 [(set (match_dup 0) (neg:DI (match_dup 1)))
1479 (set (match_dup 0) (if_then_else:DI (lt (match_dup 1) (const_int 0))
1480 (match_dup 0) (match_dup 1)))]
1484 [(set (match_operand:DI 0 "register_operand" "")
1485 (neg:DI (abs:DI (match_dup 0))))
1486 (clobber (match_operand:DI 2 "register_operand" ""))]
1488 [(set (match_dup 1) (neg:DI (match_dup 0)))
1489 (set (match_dup 0) (if_then_else:DI (le (match_dup 0) (const_int 0))
1490 (match_dup 0) (match_dup 1)))]
1494 [(set (match_operand:DI 0 "register_operand" "")
1495 (neg:DI (abs:DI (match_operand:DI 1 "register_operand" ""))))]
1496 "! rtx_equal_p (operands[0], operands[1])"
1497 [(set (match_dup 0) (neg:DI (match_dup 1)))
1498 (set (match_dup 0) (if_then_else:DI (gt (match_dup 1) (const_int 0))
1499 (match_dup 0) (match_dup 1)))]
1502 (define_expand "smaxdi3"
1504 (le:DI (match_operand:DI 1 "reg_or_0_operand" "")
1505 (match_operand:DI 2 "reg_or_8bit_operand" "")))
1506 (set (match_operand:DI 0 "register_operand" "")
1507 (if_then_else:DI (eq (match_dup 3) (const_int 0))
1508 (match_dup 1) (match_dup 2)))]
1511 { operands[3] = gen_reg_rtx (DImode);
1515 [(set (match_operand:DI 0 "register_operand" "")
1516 (smax:DI (match_operand:DI 1 "reg_or_0_operand" "")
1517 (match_operand:DI 2 "reg_or_8bit_operand" "")))
1518 (clobber (match_operand:DI 3 "register_operand" ""))]
1519 "operands[2] != const0_rtx"
1520 [(set (match_dup 3) (le:DI (match_dup 1) (match_dup 2)))
1521 (set (match_dup 0) (if_then_else:DI (eq (match_dup 3) (const_int 0))
1522 (match_dup 1) (match_dup 2)))]
1526 [(set (match_operand:DI 0 "register_operand" "=r")
1527 (smax:DI (match_operand:DI 1 "register_operand" "0")
1532 (define_expand "smindi3"
1534 (lt:DI (match_operand:DI 1 "reg_or_0_operand" "")
1535 (match_operand:DI 2 "reg_or_8bit_operand" "")))
1536 (set (match_operand:DI 0 "register_operand" "")
1537 (if_then_else:DI (ne (match_dup 3) (const_int 0))
1538 (match_dup 1) (match_dup 2)))]
1541 { operands[3] = gen_reg_rtx (DImode);
1545 [(set (match_operand:DI 0 "register_operand" "")
1546 (smin:DI (match_operand:DI 1 "reg_or_0_operand" "")
1547 (match_operand:DI 2 "reg_or_8bit_operand" "")))
1548 (clobber (match_operand:DI 3 "register_operand" ""))]
1549 "operands[2] != const0_rtx"
1550 [(set (match_dup 3) (lt:DI (match_dup 1) (match_dup 2)))
1551 (set (match_dup 0) (if_then_else:DI (ne (match_dup 3) (const_int 0))
1552 (match_dup 1) (match_dup 2)))]
1556 [(set (match_operand:DI 0 "register_operand" "=r")
1557 (smin:DI (match_operand:DI 1 "register_operand" "0")
1562 (define_expand "umaxdi3"
1564 (leu:DI (match_operand:DI 1 "reg_or_0_operand" "")
1565 (match_operand:DI 2 "reg_or_8bit_operand" "")))
1566 (set (match_operand:DI 0 "register_operand" "")
1567 (if_then_else:DI (eq (match_dup 3) (const_int 0))
1568 (match_dup 1) (match_dup 2)))]
1571 { operands[3] = gen_reg_rtx (DImode);
1575 [(set (match_operand:DI 0 "register_operand" "")
1576 (umax:DI (match_operand:DI 1 "reg_or_0_operand" "")
1577 (match_operand:DI 2 "reg_or_8bit_operand" "")))
1578 (clobber (match_operand:DI 3 "register_operand" ""))]
1579 "operands[2] != const0_rtx"
1580 [(set (match_dup 3) (leu:DI (match_dup 1) (match_dup 2)))
1581 (set (match_dup 0) (if_then_else:DI (eq (match_dup 3) (const_int 0))
1582 (match_dup 1) (match_dup 2)))]
1585 (define_expand "umindi3"
1587 (ltu:DI (match_operand:DI 1 "reg_or_0_operand" "")
1588 (match_operand:DI 2 "reg_or_8bit_operand" "")))
1589 (set (match_operand:DI 0 "register_operand" "")
1590 (if_then_else:DI (ne (match_dup 3) (const_int 0))
1591 (match_dup 1) (match_dup 2)))]
1594 { operands[3] = gen_reg_rtx (DImode);
1598 [(set (match_operand:DI 0 "register_operand" "")
1599 (umin:DI (match_operand:DI 1 "reg_or_0_operand" "")
1600 (match_operand:DI 2 "reg_or_8bit_operand" "")))
1601 (clobber (match_operand:DI 3 "register_operand" ""))]
1602 "operands[2] != const0_rtx"
1603 [(set (match_dup 3) (ltu:DI (match_dup 1) (match_dup 2)))
1604 (set (match_dup 0) (if_then_else:DI (ne (match_dup 3) (const_int 0))
1605 (match_dup 1) (match_dup 2)))]
1611 (match_operator 1 "signed_comparison_operator"
1612 [(match_operand:DI 2 "reg_or_0_operand" "rJ")
1614 (label_ref (match_operand 0 "" ""))
1618 [(set_attr "type" "ibr")])
1623 (ne (zero_extract:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
1627 (label_ref (match_operand 0 "" ""))
1631 [(set_attr "type" "ibr")])
1636 (eq (zero_extract:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
1640 (label_ref (match_operand 0 "" ""))
1644 [(set_attr "type" "ibr")])
1650 (match_operator 1 "comparison_operator"
1651 [(zero_extract:DI (match_operand:DI 2 "register_operand" "")
1653 (match_operand:DI 3 "const_int_operand" ""))
1655 (label_ref (match_operand 0 "" ""))
1657 (clobber (match_operand:DI 4 "register_operand" ""))])]
1658 "INTVAL (operands[3]) != 0"
1660 (lshiftrt:DI (match_dup 2) (match_dup 3)))
1662 (if_then_else (match_op_dup 1
1663 [(zero_extract:DI (match_dup 4)
1667 (label_ref (match_dup 0))
1671 ;; The following are the corresponding floating-point insns. Recall
1672 ;; we need to have variants that expand the arguments from SF mode
1676 [(set (match_operand:DF 0 "register_operand" "=f")
1677 (match_operator:DF 1 "alpha_comparison_operator"
1678 [(match_operand:DF 2 "reg_or_fp0_operand" "fG")
1679 (match_operand:DF 3 "reg_or_fp0_operand" "fG")]))]
1681 "cmpt%C1 %R2,%R3,%0"
1682 [(set_attr "type" "fpop")])
1685 [(set (match_operand:DF 0 "register_operand" "=f")
1686 (match_operator:DF 1 "alpha_comparison_operator"
1688 (match_operand:SF 2 "reg_or_fp0_operand" "fG"))
1689 (match_operand:DF 3 "reg_or_fp0_operand" "fG")]))]
1691 "cmpt%C1 %R2,%R3,%0"
1692 [(set_attr "type" "fpop")])
1695 [(set (match_operand:DF 0 "register_operand" "=f")
1696 (match_operator:DF 1 "alpha_comparison_operator"
1697 [(match_operand:DF 2 "reg_or_fp0_operand" "fG")
1699 (match_operand:SF 3 "reg_or_fp0_operand" "fG"))]))]
1701 "cmpt%C1 %R2,%R3,%0"
1702 [(set_attr "type" "fpop")])
1705 [(set (match_operand:DF 0 "register_operand" "=f")
1706 (match_operator:DF 1 "alpha_comparison_operator"
1708 (match_operand:SF 2 "reg_or_fp0_operand" "fG"))
1710 (match_operand:SF 3 "reg_or_fp0_operand" "fG"))]))]
1712 "cmpt%C1 %R2,%R3,%0"
1713 [(set_attr "type" "fpop")])
1716 [(set (match_operand:DF 0 "register_operand" "=f,f")
1718 (match_operator 3 "signed_comparison_operator"
1719 [(match_operand:DF 4 "reg_or_fp0_operand" "fG,fG")
1720 (match_operand:DF 2 "fp0_operand" "G,G")])
1721 (match_operand:DF 1 "reg_or_fp0_operand" "fG,0")
1722 (match_operand:DF 5 "reg_or_fp0_operand" "0,fG")))]
1726 fcmov%D3 %R4,%R5,%0"
1727 [(set_attr "type" "fpop")])
1730 [(set (match_operand:SF 0 "register_operand" "=f,f")
1732 (match_operator 3 "signed_comparison_operator"
1733 [(match_operand:DF 4 "reg_or_fp0_operand" "fG,fG")
1734 (match_operand:DF 2 "fp0_operand" "G,G")])
1735 (match_operand:SF 1 "reg_or_fp0_operand" "fG,0")
1736 (match_operand:SF 5 "reg_or_fp0_operand" "0,fG")))]
1740 fcmov%D3 %R4,%R5,%0"
1741 [(set_attr "type" "fpop")])
1744 [(set (match_operand:DF 0 "register_operand" "=f,f")
1746 (match_operator 3 "signed_comparison_operator"
1747 [(match_operand:DF 1 "reg_or_fp0_operand" "fG,fG")
1748 (match_operand:DF 2 "fp0_operand" "G,G")])
1749 (float_extend:DF (match_operand:SF 4 "reg_or_fp0_operand" "fG,0"))
1750 (match_operand:DF 5 "reg_or_fp0_operand" "0,fG")))]
1754 fcmov%D3 %R4,%R5,%0"
1755 [(set_attr "type" "fpop")])
1758 [(set (match_operand:DF 0 "register_operand" "=f,f")
1760 (match_operator 3 "signed_comparison_operator"
1762 (match_operand:SF 4 "reg_or_fp0_operand" "fG,fG"))
1763 (match_operand:DF 2 "fp0_operand" "G,G")])
1764 (match_operand:DF 1 "reg_or_fp0_operand" "fG,0")
1765 (match_operand:DF 5 "reg_or_fp0_operand" "0,fG")))]
1769 fcmov%D3 %R4,%R5,%0"
1770 [(set_attr "type" "fpop")])
1773 [(set (match_operand:SF 0 "register_operand" "=f,f")
1775 (match_operator 3 "signed_comparison_operator"
1777 (match_operand:SF 4 "reg_or_fp0_operand" "fG,fG"))
1778 (match_operand:DF 2 "fp0_operand" "G,G")])
1779 (match_operand:SF 1 "reg_or_fp0_operand" "fG,0")
1780 (match_operand:SF 5 "reg_or_fp0_operand" "0,fG")))]
1784 fcmov%D3 %R4,%R5,%0"
1785 [(set_attr "type" "fpop")])
1788 [(set (match_operand:DF 0 "register_operand" "=f,f")
1790 (match_operator 3 "signed_comparison_operator"
1792 (match_operand:SF 4 "reg_or_fp0_operand" "fG,fG"))
1793 (match_operand:DF 2 "fp0_operand" "G,G")])
1794 (float_extend:DF (match_operand:SF 1 "reg_or_fp0_operand" "fG,0"))
1795 (match_operand:DF 5 "reg_or_fp0_operand" "0,fG")))]
1799 fcmov%D3 %R4,%R5,%0"
1800 [(set_attr "type" "fpop")])
1802 (define_expand "maxdf3"
1804 (le:DF (match_operand:DF 1 "reg_or_fp0_operand" "")
1805 (match_operand:DF 2 "reg_or_fp0_operand" "")))
1806 (set (match_operand:DF 0 "register_operand" "")
1807 (if_then_else:DF (eq (match_dup 3) (match_dup 4))
1808 (match_dup 1) (match_dup 2)))]
1811 { operands[3] = gen_reg_rtx (DFmode);
1812 operands[4] = CONST0_RTX (DFmode);
1815 (define_expand "mindf3"
1817 (lt:DF (match_operand:DF 1 "reg_or_fp0_operand" "")
1818 (match_operand:DF 2 "reg_or_fp0_operand" "")))
1819 (set (match_operand:DF 0 "register_operand" "")
1820 (if_then_else:DF (ne (match_dup 3) (match_dup 4))
1821 (match_dup 1) (match_dup 2)))]
1824 { operands[3] = gen_reg_rtx (DFmode);
1825 operands[4] = CONST0_RTX (DFmode);
1828 (define_expand "maxsf3"
1830 (le:DF (float_extend:DF (match_operand:SF 1 "reg_or_fp0_operand" ""))
1831 (float_extend:DF (match_operand:SF 2 "reg_or_fp0_operand" ""))))
1832 (set (match_operand:SF 0 "register_operand" "")
1833 (if_then_else:SF (eq (match_dup 3) (match_dup 4))
1834 (match_dup 1) (match_dup 2)))]
1837 { operands[3] = gen_reg_rtx (DFmode);
1838 operands[4] = CONST0_RTX (DFmode);
1841 (define_expand "minsf3"
1843 (lt:DF (float_extend:DF (match_operand:SF 1 "reg_or_fp0_operand" ""))
1844 (float_extend:DF (match_operand:SF 2 "reg_or_fp0_operand" ""))))
1845 (set (match_operand:SF 0 "register_operand" "")
1846 (if_then_else:SF (ne (match_dup 3) (match_dup 4))
1847 (match_dup 1) (match_dup 2)))]
1850 { operands[3] = gen_reg_rtx (DFmode);
1851 operands[4] = CONST0_RTX (DFmode);
1857 (match_operator 1 "signed_comparison_operator"
1858 [(match_operand:DF 2 "reg_or_fp0_operand" "fG")
1859 (match_operand:DF 3 "fp0_operand" "G")])
1860 (label_ref (match_operand 0 "" ""))
1864 [(set_attr "type" "fbr")])
1869 (match_operator 1 "signed_comparison_operator"
1871 (match_operand:SF 2 "reg_or_fp0_operand" "fG"))
1872 (match_operand:DF 3 "fp0_operand" "G")])
1873 (label_ref (match_operand 0 "" ""))
1877 [(set_attr "type" "fbr")])
1879 ;; These are the main define_expand's used to make conditional branches
1882 (define_expand "cmpdf"
1883 [(set (cc0) (compare (match_operand:DF 0 "reg_or_fp0_operand" "")
1884 (match_operand:DF 1 "reg_or_fp0_operand" "")))]
1888 alpha_compare_op0 = operands[0];
1889 alpha_compare_op1 = operands[1];
1890 alpha_compare_fp_p = 1;
1894 (define_expand "cmpdi"
1895 [(set (cc0) (compare (match_operand:DI 0 "reg_or_0_operand" "")
1896 (match_operand:DI 1 "reg_or_8bit_operand" "")))]
1900 alpha_compare_op0 = operands[0];
1901 alpha_compare_op1 = operands[1];
1902 alpha_compare_fp_p = 0;
1906 (define_expand "beq"
1907 [(set (match_dup 1) (match_dup 2))
1909 (if_then_else (match_dup 3)
1910 (label_ref (match_operand 0 "" ""))
1915 enum machine_mode mode;
1916 enum rtx_code compare_code, branch_code;
1918 if (alpha_compare_fp_p)
1919 mode = DFmode, compare_code = EQ, branch_code = NE;
1922 mode = DImode, compare_code = MINUS, branch_code = EQ;
1923 if (GET_CODE (alpha_compare_op1) == CONST_INT)
1925 compare_code = PLUS;
1926 alpha_compare_op1 = GEN_INT (- INTVAL (alpha_compare_op1));
1930 operands[1] = gen_reg_rtx (mode);
1931 operands[2] = gen_rtx (compare_code, mode,
1932 alpha_compare_op0, alpha_compare_op1);
1933 operands[3] = gen_rtx (branch_code, VOIDmode,
1934 operands[1], CONST0_RTX (mode));
1937 (define_expand "bne"
1938 [(set (match_dup 1) (match_dup 2))
1940 (if_then_else (match_dup 3)
1941 (label_ref (match_operand 0 "" ""))
1946 enum machine_mode mode;
1947 enum rtx_code compare_code, branch_code;
1949 if (alpha_compare_fp_p)
1950 mode = DFmode, compare_code = EQ, branch_code = EQ;
1953 mode = DImode, compare_code = MINUS, branch_code = NE;
1954 if (GET_CODE (alpha_compare_op1) == CONST_INT)
1956 compare_code = PLUS;
1957 alpha_compare_op1 = GEN_INT (- INTVAL (alpha_compare_op1));
1961 operands[1] = gen_reg_rtx (mode);
1962 operands[2] = gen_rtx (compare_code, mode,
1963 alpha_compare_op0, alpha_compare_op1);
1964 operands[3] = gen_rtx (branch_code, VOIDmode,
1965 operands[1], CONST0_RTX (mode));
1968 (define_expand "blt"
1969 [(set (match_dup 1) (match_dup 2))
1971 (if_then_else (match_dup 3)
1972 (label_ref (match_operand 0 "" ""))
1977 enum machine_mode mode = alpha_compare_fp_p ? DFmode : DImode;
1978 operands[1] = gen_reg_rtx (mode);
1979 operands[2] = gen_rtx (LT, mode, alpha_compare_op0, alpha_compare_op1);
1980 operands[3] = gen_rtx (NE, VOIDmode, operands[1], CONST0_RTX (mode));
1983 (define_expand "ble"
1984 [(set (match_dup 1) (match_dup 2))
1986 (if_then_else (match_dup 3)
1987 (label_ref (match_operand 0 "" ""))
1992 enum machine_mode mode = alpha_compare_fp_p ? DFmode : DImode;
1993 operands[1] = gen_reg_rtx (mode);
1994 operands[2] = gen_rtx (LE, mode, alpha_compare_op0, alpha_compare_op1);
1995 operands[3] = gen_rtx (NE, VOIDmode, operands[1], CONST0_RTX (mode));
1998 (define_expand "bgt"
1999 [(set (match_dup 1) (match_dup 2))
2001 (if_then_else (match_dup 3)
2002 (label_ref (match_operand 0 "" ""))
2007 if (alpha_compare_fp_p)
2009 operands[1] = gen_reg_rtx (DFmode);
2010 operands[2] = gen_rtx (LT, DFmode, alpha_compare_op1, alpha_compare_op0);
2011 operands[3] = gen_rtx (NE, VOIDmode, operands[1], CONST0_RTX (DFmode));
2015 operands[1] = gen_reg_rtx (DImode);
2016 operands[2] = gen_rtx (LE, DImode, alpha_compare_op0, alpha_compare_op1);
2017 operands[3] = gen_rtx (EQ, VOIDmode, operands[1], const0_rtx);
2021 (define_expand "bge"
2022 [(set (match_dup 1) (match_dup 2))
2024 (if_then_else (match_dup 3)
2025 (label_ref (match_operand 0 "" ""))
2030 if (alpha_compare_fp_p)
2032 operands[1] = gen_reg_rtx (DFmode);
2033 operands[2] = gen_rtx (LE, DFmode, alpha_compare_op1, alpha_compare_op0);
2034 operands[3] = gen_rtx (NE, VOIDmode, operands[1], CONST0_RTX (DFmode));
2038 operands[1] = gen_reg_rtx (DImode);
2039 operands[2] = gen_rtx (LT, DImode, alpha_compare_op0, alpha_compare_op1);
2040 operands[3] = gen_rtx (EQ, VOIDmode, operands[1], const0_rtx);
2044 (define_expand "bltu"
2045 [(set (match_dup 1) (match_dup 2))
2047 (if_then_else (match_dup 3)
2048 (label_ref (match_operand 0 "" ""))
2053 operands[1] = gen_reg_rtx (DImode);
2054 operands[2] = gen_rtx (LTU, DImode, alpha_compare_op0, alpha_compare_op1);
2055 operands[3] = gen_rtx (NE, VOIDmode, operands[1], const0_rtx);
2058 (define_expand "bleu"
2059 [(set (match_dup 1) (match_dup 2))
2061 (if_then_else (match_dup 3)
2062 (label_ref (match_operand 0 "" ""))
2067 operands[1] = gen_reg_rtx (DImode);
2068 operands[2] = gen_rtx (LEU, DImode, alpha_compare_op0, alpha_compare_op1);
2069 operands[3] = gen_rtx (NE, VOIDmode, operands[1], const0_rtx);
2072 (define_expand "bgtu"
2073 [(set (match_dup 1) (match_dup 2))
2075 (if_then_else (match_dup 3)
2076 (label_ref (match_operand 0 "" ""))
2081 operands[1] = gen_reg_rtx (DImode);
2082 operands[2] = gen_rtx (LEU, DImode, alpha_compare_op0, alpha_compare_op1);
2083 operands[3] = gen_rtx (EQ, VOIDmode, operands[1], const0_rtx);
2086 (define_expand "bgeu"
2087 [(set (match_dup 1) (match_dup 2))
2089 (if_then_else (match_dup 3)
2090 (label_ref (match_operand 0 "" ""))
2095 operands[1] = gen_reg_rtx (DImode);
2096 operands[2] = gen_rtx (LTU, DImode, alpha_compare_op0, alpha_compare_op1);
2097 operands[3] = gen_rtx (EQ, VOIDmode, operands[1], const0_rtx);
2100 (define_expand "seq"
2101 [(set (match_operand:DI 0 "register_operand" "")
2106 if (alpha_compare_fp_p)
2109 operands[1] = gen_rtx (EQ, DImode, alpha_compare_op0, alpha_compare_op1);
2112 (define_expand "sne"
2113 [(set (match_operand:DI 0 "register_operand" "")
2115 (set (match_dup 0) (xor:DI (match_dup 0) (const_int 1)))]
2119 if (alpha_compare_fp_p)
2122 operands[1] = gen_rtx (EQ, DImode, alpha_compare_op0, alpha_compare_op1);
2125 (define_expand "slt"
2126 [(set (match_operand:DI 0 "register_operand" "")
2131 if (alpha_compare_fp_p)
2134 operands[1] = gen_rtx (LT, DImode, alpha_compare_op0, alpha_compare_op1);
2137 (define_expand "sle"
2138 [(set (match_operand:DI 0 "register_operand" "")
2143 if (alpha_compare_fp_p)
2146 operands[1] = gen_rtx (LE, DImode, alpha_compare_op0, alpha_compare_op1);
2149 (define_expand "sgt"
2150 [(set (match_operand:DI 0 "register_operand" "")
2155 if (alpha_compare_fp_p)
2158 operands[1] = gen_rtx (LT, DImode, force_reg (DImode, alpha_compare_op1),
2162 (define_expand "sge"
2163 [(set (match_operand:DI 0 "register_operand" "")
2168 if (alpha_compare_fp_p)
2171 operands[1] = gen_rtx (LE, DImode, force_reg (DImode, alpha_compare_op1),
2175 (define_expand "sltu"
2176 [(set (match_operand:DI 0 "register_operand" "")
2181 if (alpha_compare_fp_p)
2184 operands[1] = gen_rtx (LTU, DImode, alpha_compare_op0, alpha_compare_op1);
2187 (define_expand "sleu"
2188 [(set (match_operand:DI 0 "register_operand" "")
2193 if (alpha_compare_fp_p)
2196 operands[1] = gen_rtx (LEU, DImode, alpha_compare_op0, alpha_compare_op1);
2199 (define_expand "sgtu"
2200 [(set (match_operand:DI 0 "register_operand" "")
2205 if (alpha_compare_fp_p)
2208 operands[1] = gen_rtx (LTU, DImode, force_reg (DImode, alpha_compare_op1),
2212 (define_expand "sgeu"
2213 [(set (match_operand:DI 0 "register_operand" "")
2218 if (alpha_compare_fp_p)
2221 operands[1] = gen_rtx (LEU, DImode, force_reg (DImode, alpha_compare_op1),
2225 ;; These are the main define_expand's used to make conditional moves.
2227 (define_expand "movsicc"
2228 [(set (match_dup 4) (match_operand 1 "comparison_operator" ""))
2229 (set (match_operand:SI 0 "register_operand" "")
2230 (if_then_else:DI (match_dup 5)
2231 (match_operand:SI 2 "reg_or_8bit_operand" "")
2232 (match_operand:SI 3 "reg_or_8bit_operand" "")))]
2237 enum rtx_code code = GET_CODE (operands[1]);
2239 if (alpha_compare_fp_p)
2243 case EQ: case NE: case LE: case LT:
2244 op0 = alpha_compare_op0;
2245 op1 = alpha_compare_op1;
2249 op0 = force_reg (DImode, alpha_compare_op1);
2250 op1 = alpha_compare_op0;
2254 op0 = force_reg (DImode, alpha_compare_op1);
2255 op1 = alpha_compare_op0;
2260 operands[1] = gen_rtx (code, DImode, op0, op1);
2261 operands[4] = gen_reg_rtx (DImode);
2262 operands[5] = gen_rtx (NE, VOIDmode, operands[4], CONST0_RTX (DImode));
2265 (define_expand "movdicc"
2266 [(set (match_dup 4) (match_operand 1 "comparison_operator" ""))
2267 (set (match_operand:DI 0 "register_operand" "")
2268 (if_then_else:DI (match_dup 5)
2269 (match_operand:DI 2 "reg_or_8bit_operand" "")
2270 (match_operand:DI 3 "reg_or_8bit_operand" "")))]
2275 enum rtx_code code = GET_CODE (operands[1]);
2277 if (alpha_compare_fp_p)
2281 case EQ: case NE: case LE: case LT:
2282 op0 = alpha_compare_op0;
2283 op1 = alpha_compare_op1;
2287 op0 = force_reg (DImode, alpha_compare_op1);
2288 op1 = alpha_compare_op0;
2292 op0 = force_reg (DImode, alpha_compare_op1);
2293 op1 = alpha_compare_op0;
2298 operands[1] = gen_rtx (code, DImode, op0, op1);
2299 operands[4] = gen_reg_rtx (DImode);
2300 operands[5] = gen_rtx (NE, VOIDmode, operands[4], CONST0_RTX (DImode));
2303 (define_expand "movsfcc"
2304 [(set (match_dup 4) (match_operand 1 "comparison_operator" ""))
2305 (set (match_operand:SF 0 "register_operand" "")
2306 (if_then_else:SF (match_dup 5)
2307 (match_operand:SF 2 "reg_or_fp0_operand" "")
2308 (match_operand:SF 3 "reg_or_fp0_operand" "")))]
2313 enum rtx_code code = GET_CODE (operands[1]), code2 = NE;
2315 if (!alpha_compare_fp_p)
2319 case EQ: case LE: case LT:
2320 op0 = alpha_compare_op0;
2321 op1 = alpha_compare_op1;
2324 /* There isn't a cmptne insn. */
2326 op0 = alpha_compare_op0;
2327 op1 = alpha_compare_op1;
2331 op0 = force_reg (DFmode, alpha_compare_op1);
2332 op1 = alpha_compare_op0;
2336 op0 = force_reg (DFmode, alpha_compare_op1);
2337 op1 = alpha_compare_op0;
2342 operands[1] = gen_rtx (code, DFmode, op0, op1);
2343 operands[4] = gen_reg_rtx (DFmode);
2344 operands[5] = gen_rtx (code2, VOIDmode, operands[4], CONST0_RTX (DFmode));
2347 (define_expand "movdfcc"
2348 [(set (match_dup 4) (match_operand 1 "comparison_operator" ""))
2349 (set (match_operand:DF 0 "register_operand" "")
2350 (if_then_else:DF (match_dup 5)
2351 (match_operand:DF 2 "reg_or_fp0_operand" "")
2352 (match_operand:DF 3 "reg_or_fp0_operand" "")))]
2357 enum rtx_code code = GET_CODE (operands[1]), code2 = NE;
2359 if (!alpha_compare_fp_p)
2363 case EQ: case LE: case LT:
2364 op0 = alpha_compare_op0;
2365 op1 = alpha_compare_op1;
2368 /* There isn't a cmptne insn. */
2370 op0 = alpha_compare_op0;
2371 op1 = alpha_compare_op1;
2375 op0 = force_reg (DFmode, alpha_compare_op1);
2376 op1 = alpha_compare_op0;
2380 op0 = force_reg (DFmode, alpha_compare_op1);
2381 op1 = alpha_compare_op0;
2386 operands[1] = gen_rtx (code, DFmode, op0, op1);
2387 operands[4] = gen_reg_rtx (DFmode);
2388 operands[5] = gen_rtx (code2, VOIDmode, operands[4], CONST0_RTX (DFmode));
2391 ;; These define_split definitions are used in cases when comparisons have
2392 ;; not be stated in the correct way and we need to reverse the second
2393 ;; comparison. For example, x >= 7 has to be done as x < 6 with the
2394 ;; comparison that tests the result being reversed. We have one define_split
2395 ;; for each use of a comparison. They do not match valid insns and need
2396 ;; not generate valid insns.
2398 ;; We can also handle equality comparisons (and inequality comparisons in
2399 ;; cases where the resulting add cannot overflow) by doing an add followed by
2400 ;; a comparison with zero. This is faster since the addition takes one
2401 ;; less cycle than a compare when feeding into a conditional move.
2402 ;; For this case, we also have an SImode pattern since we can merge the add
2403 ;; and sign extend and the order doesn't matter.
2405 ;; We do not do this for floating-point, since it isn't clear how the "wrong"
2406 ;; operation could have been generated.
2409 [(set (match_operand:DI 0 "register_operand" "")
2411 (match_operator 1 "comparison_operator"
2412 [(match_operand:DI 2 "reg_or_0_operand" "")
2413 (match_operand:DI 3 "reg_or_cint_operand" "")])
2414 (match_operand:DI 4 "reg_or_cint_operand" "")
2415 (match_operand:DI 5 "reg_or_cint_operand" "")))
2416 (clobber (match_operand:DI 6 "register_operand" ""))]
2417 "operands[3] != const0_rtx"
2418 [(set (match_dup 6) (match_dup 7))
2420 (if_then_else:DI (match_dup 8) (match_dup 4) (match_dup 5)))]
2422 { enum rtx_code code = GET_CODE (operands[1]);
2423 int unsignedp = (code == GEU || code == LEU || code == GTU || code == LTU);
2425 /* If we are comparing for equality with a constant and that constant
2426 appears in the arm when the register equals the constant, use the
2427 register since that is more likely to match (and to produce better code
2430 if (code == EQ && GET_CODE (operands[3]) == CONST_INT
2431 && rtx_equal_p (operands[4], operands[3]))
2432 operands[4] = operands[2];
2434 else if (code == NE && GET_CODE (operands[3]) == CONST_INT
2435 && rtx_equal_p (operands[5], operands[3]))
2436 operands[5] = operands[2];
2438 if (code == NE || code == EQ
2439 || (extended_count (operands[2], DImode, unsignedp) >= 1
2440 && extended_count (operands[3], DImode, unsignedp) >= 1))
2442 if (GET_CODE (operands[3]) == CONST_INT)
2443 operands[7] = gen_rtx (PLUS, DImode, operands[2],
2444 GEN_INT (- INTVAL (operands[3])));
2446 operands[7] = gen_rtx (MINUS, DImode, operands[2], operands[3]);
2448 operands[8] = gen_rtx (code, VOIDmode, operands[6], const0_rtx);
2451 else if (code == EQ || code == LE || code == LT
2452 || code == LEU || code == LTU)
2454 operands[7] = gen_rtx (code, DImode, operands[2], operands[3]);
2455 operands[8] = gen_rtx (NE, VOIDmode, operands[6], const0_rtx);
2459 operands[7] = gen_rtx (reverse_condition (code), DImode, operands[2],
2461 operands[8] = gen_rtx (EQ, VOIDmode, operands[6], const0_rtx);
2466 [(set (match_operand:DI 0 "register_operand" "")
2468 (match_operator 1 "comparison_operator"
2469 [(match_operand:SI 2 "reg_or_0_operand" "")
2470 (match_operand:SI 3 "reg_or_cint_operand" "")])
2471 (match_operand:DI 4 "reg_or_8bit_operand" "")
2472 (match_operand:DI 5 "reg_or_8bit_operand" "")))
2473 (clobber (match_operand:DI 6 "register_operand" ""))]
2474 "operands[3] != const0_rtx
2475 && (GET_CODE (operands[1]) == EQ || GET_CODE (operands[1]) == NE)"
2476 [(set (match_dup 6) (match_dup 7))
2478 (if_then_else:DI (match_dup 8) (match_dup 4) (match_dup 5)))]
2480 { enum rtx_code code = GET_CODE (operands[1]);
2481 int unsignedp = (code == GEU || code == LEU || code == GTU || code == LTU);
2484 if ((code != NE && code != EQ
2485 && ! (extended_count (operands[2], DImode, unsignedp) >= 1
2486 && extended_count (operands[3], DImode, unsignedp) >= 1)))
2489 if (GET_CODE (operands[3]) == CONST_INT)
2490 tem = gen_rtx (PLUS, SImode, operands[2],
2491 GEN_INT (- INTVAL (operands[3])));
2493 tem = gen_rtx (MINUS, SImode, operands[2], operands[3]);
2495 operands[7] = gen_rtx (SIGN_EXTEND, DImode, tem);
2496 operands[8] = gen_rtx (GET_CODE (operands[1]), VOIDmode, operands[6],
2503 (match_operator 1 "comparison_operator"
2504 [(match_operand:DI 2 "reg_or_0_operand" "")
2505 (match_operand:DI 3 "reg_or_cint_operand" "")])
2506 (label_ref (match_operand 0 "" ""))
2508 (clobber (match_operand:DI 4 "register_operand" ""))]
2509 "operands[3] != const0_rtx"
2510 [(set (match_dup 4) (match_dup 5))
2511 (set (pc) (if_then_else (match_dup 6) (label_ref (match_dup 0)) (pc)))]
2513 { enum rtx_code code = GET_CODE (operands[1]);
2514 int unsignedp = (code == GEU || code == LEU || code == GTU || code == LTU);
2516 if (code == NE || code == EQ
2517 || (extended_count (operands[2], DImode, unsignedp) >= 1
2518 && extended_count (operands[3], DImode, unsignedp) >= 1))
2520 if (GET_CODE (operands[3]) == CONST_INT)
2521 operands[5] = gen_rtx (PLUS, DImode, operands[2],
2522 GEN_INT (- INTVAL (operands[3])));
2524 operands[5] = gen_rtx (MINUS, DImode, operands[2], operands[3]);
2526 operands[6] = gen_rtx (code, VOIDmode, operands[4], const0_rtx);
2529 else if (code == EQ || code == LE || code == LT
2530 || code == LEU || code == LTU)
2532 operands[5] = gen_rtx (code, DImode, operands[2], operands[3]);
2533 operands[6] = gen_rtx (NE, VOIDmode, operands[4], const0_rtx);
2537 operands[5] = gen_rtx (reverse_condition (code), DImode, operands[2],
2539 operands[6] = gen_rtx (EQ, VOIDmode, operands[4], const0_rtx);
2546 (match_operator 1 "comparison_operator"
2547 [(match_operand:SI 2 "reg_or_0_operand" "")
2548 (match_operand:SI 3 "const_int_operand" "")])
2549 (label_ref (match_operand 0 "" ""))
2551 (clobber (match_operand:DI 4 "register_operand" ""))]
2552 "operands[3] != const0_rtx
2553 && (GET_CODE (operands[1]) == EQ || GET_CODE (operands[1]) == NE)"
2554 [(set (match_dup 4) (match_dup 5))
2555 (set (pc) (if_then_else (match_dup 6) (label_ref (match_dup 0)) (pc)))]
2559 if (GET_CODE (operands[3]) == CONST_INT)
2560 tem = gen_rtx (PLUS, SImode, operands[2],
2561 GEN_INT (- INTVAL (operands[3])));
2563 tem = gen_rtx (MINUS, SImode, operands[2], operands[3]);
2565 operands[5] = gen_rtx (SIGN_EXTEND, DImode, tem);
2566 operands[6] = gen_rtx (GET_CODE (operands[1]), VOIDmode,
2567 operands[4], const0_rtx);
2570 ;; We can convert such things as "a > 0xffff" to "t = a & ~ 0xffff; t != 0".
2571 ;; This eliminates one, and sometimes two, insns when the AND can be done
2574 [(set (match_operand:DI 0 "register_operand" "")
2575 (match_operator 1 "comparison_operator"
2576 [(match_operand:DI 2 "register_operand" "")
2577 (match_operand:DI 3 "const_int_operand" "")]))
2578 (clobber (match_operand:DI 4 "register_operand" ""))]
2579 "exact_log2 (INTVAL (operands[3]) + 1) >= 0
2580 && (GET_CODE (operands[1]) == GTU
2581 || GET_CODE (operands[1]) == LEU
2582 || ((GET_CODE (operands[1]) == GT || GET_CODE (operands[1]) == LE)
2583 && extended_count (operands[2], DImode, 1) > 0))"
2584 [(set (match_dup 4) (and:DI (match_dup 2) (match_dup 5)))
2585 (set (match_dup 0) (match_dup 6))]
2588 operands[5] = GEN_INT (~ INTVAL (operands[3]));
2589 operands[6] = gen_rtx (((GET_CODE (operands[1]) == GTU
2590 || GET_CODE (operands[1]) == GT)
2592 DImode, operands[4], const0_rtx);
2595 ;; Here are the CALL and unconditional branch insns. Calls on NT and OSF
2596 ;; work differently, so we have different patterns for each.
2598 (define_expand "call"
2599 [(use (match_operand:DI 0 "" ""))
2600 (use (match_operand 1 "" ""))]
2604 emit_call_insn (gen_call_nt (operands[0], operands[1]));
2606 emit_call_insn (gen_call_osf (operands[0], operands[1]));
2611 (define_expand "call_osf"
2612 [(parallel [(call (mem:DI (match_operand 0 "" ""))
2613 (match_operand 1 "" ""))
2614 (clobber (reg:DI 27))
2615 (clobber (reg:DI 26))])]
2618 { if (GET_CODE (operands[0]) != MEM)
2621 operands[0] = XEXP (operands[0], 0);
2623 if (GET_CODE (operands[0]) != SYMBOL_REF
2624 && ! (GET_CODE (operands[0]) == REG && REGNO (operands[0]) == 27))
2626 rtx tem = gen_rtx (REG, DImode, 27);
2627 emit_move_insn (tem, operands[0]);
2632 (define_expand "call_nt"
2633 [(parallel [(call (mem:DI (match_operand:DI 0 "" ""))
2634 (match_operand 1 "" ""))
2635 (clobber (reg:DI 26))])]
2638 { if (GET_CODE (operands[0]) != MEM)
2640 operands[0] = XEXP (operands[0], 0);
2642 if (GET_CODE (operands[0]) != SYMBOL_REF)
2643 operands[0] = force_reg (Pmode, operands[0]);
2646 (define_expand "call_value"
2647 [(use (match_operand 0 "" ""))
2648 (use (match_operand:DI 1 "" ""))
2649 (use (match_operand 2 "" ""))]
2653 emit_call_insn (gen_call_value_nt (operands[0], operands[1], operands[2]));
2655 emit_call_insn (gen_call_value_osf (operands[0], operands[1],
2660 (define_expand "call_value_osf"
2661 [(parallel [(set (match_operand 0 "" "")
2662 (call (mem:DI (match_operand 1 "" ""))
2663 (match_operand 2 "" "")))
2664 (clobber (reg:DI 27))
2665 (clobber (reg:DI 26))])]
2668 { if (GET_CODE (operands[1]) != MEM)
2671 operands[1] = XEXP (operands[1], 0);
2673 if (GET_CODE (operands[1]) != SYMBOL_REF
2674 && ! (GET_CODE (operands[1]) == REG && REGNO (operands[1]) == 27))
2676 rtx tem = gen_rtx (REG, DImode, 27);
2677 emit_move_insn (tem, operands[1]);
2682 (define_expand "call_value_nt"
2683 [(parallel [(set (match_operand 0 "" "")
2684 (call (mem:DI (match_operand:DI 1 "" ""))
2685 (match_operand 2 "" "")))
2686 (clobber (reg:DI 26))])]
2689 { if (GET_CODE (operands[1]) != MEM)
2692 operands[1] = XEXP (operands[1], 0);
2693 if (GET_CODE (operands[1]) != SYMBOL_REF)
2694 operands[1] = force_reg (Pmode, operands[1]);
2698 [(call (mem:DI (match_operand:DI 0 "call_operand" "r,R,i"))
2699 (match_operand 1 "" ""))
2700 (clobber (reg:DI 27))
2701 (clobber (reg:DI 26))]
2704 jsr $26,($27),0\;ldgp $29,0($26)
2706 jsr $26,%0\;ldgp $29,0($26)"
2707 [(set_attr "type" "jsr,jsr,ibr")])
2710 [(call (mem:DI (match_operand:DI 0 "call_operand" "r,i"))
2711 (match_operand 1 "" ""))
2712 (clobber (reg:DI 26))]
2717 [(set_attr "type" "jsr")])
2720 [(set (match_operand 0 "register_operand" "=rf,rf,rf")
2721 (call (mem:DI (match_operand:DI 1 "call_operand" "r,R,i"))
2722 (match_operand 2 "" "")))
2723 (clobber (reg:DI 27))
2724 (clobber (reg:DI 26))]
2727 jsr $26,($27),0\;ldgp $29,0($26)
2729 jsr $26,%1\;ldgp $29,0($26)"
2730 [(set_attr "type" "jsr,jsr,ibr")])
2733 [(set (match_operand 0 "register_operand" "=rf,rf")
2734 (call (mem:DI (match_operand:DI 1 "call_operand" "r,i"))
2735 (match_operand 2 "" "")))
2736 (clobber (reg:DI 26))]
2741 [(set_attr "type" "jsr")])
2743 ;; Call subroutine returning any type.
2745 (define_expand "untyped_call"
2746 [(parallel [(call (match_operand 0 "" "")
2748 (match_operand 1 "" "")
2749 (match_operand 2 "" "")])]
2755 emit_call_insn (gen_call (operands[0], const0_rtx, NULL, const0_rtx));
2757 for (i = 0; i < XVECLEN (operands[2], 0); i++)
2759 rtx set = XVECEXP (operands[2], 0, i);
2760 emit_move_insn (SET_DEST (set), SET_SRC (set));
2763 /* The optimizer does not know that the call sets the function value
2764 registers we stored in the result block. We avoid problems by
2765 claiming that all hard registers are used and clobbered at this
2767 emit_insn (gen_blockage ());
2772 ;; UNSPEC_VOLATILE is considered to use and clobber all hard registers and
2773 ;; all of memory. This blocks insns from being moved across this point.
2775 (define_insn "blockage"
2776 [(unspec_volatile [(const_int 0)] 1)]
2782 (label_ref (match_operand 0 "" "")))]
2785 [(set_attr "type" "ibr")])
2787 (define_insn "return"
2791 [(set_attr "type" "ibr")])
2793 (define_insn "indirect_jump"
2794 [(set (pc) (match_operand:DI 0 "register_operand" "r"))]
2797 [(set_attr "type" "ibr")])
2803 [(set_attr "type" "iaddlog")])
2805 (define_expand "tablejump"
2806 [(use (match_operand:SI 0 "register_operand" ""))
2807 (use (match_operand:SI 1 "" ""))]
2812 emit_jump_insn (gen_tablejump_nt (operands[0], operands[1]));
2814 emit_jump_insn (gen_tablejump_osf (operands[0], operands[1]));
2819 (define_expand "tablejump_osf"
2821 (sign_extend:DI (match_operand:SI 0 "register_operand" "")))
2822 (parallel [(set (pc)
2823 (plus:DI (match_dup 3)
2824 (label_ref:DI (match_operand 1 "" ""))))
2825 (clobber (match_scratch:DI 2 "=r"))])]
2828 { operands[3] = gen_reg_rtx (DImode); }")
2830 (define_expand "tablejump_nt"
2832 (sign_extend:DI (match_operand:SI 0 "register_operand" "")))
2833 (parallel [(set (pc)
2835 (use (label_ref (match_operand 1 "" "")))])]
2838 { operands[3] = gen_reg_rtx (DImode); }")
2842 (plus:DI (match_operand:DI 0 "register_operand" "r")
2843 (label_ref:DI (match_operand 1 "" ""))))
2844 (clobber (match_scratch:DI 2 "=r"))]
2845 "! WINDOWS_NT && next_active_insn (insn) != 0
2846 && GET_CODE (PATTERN (next_active_insn (insn))) == ADDR_DIFF_VEC
2847 && PREV_INSN (next_active_insn (insn)) == operands[1]"
2849 { rtx best_label = 0;
2850 rtx jump_table_insn = next_active_insn (operands[1]);
2852 if (GET_CODE (jump_table_insn) == JUMP_INSN
2853 && GET_CODE (PATTERN (jump_table_insn)) == ADDR_DIFF_VEC)
2855 rtx jump_table = PATTERN (jump_table_insn);
2856 int n_labels = XVECLEN (jump_table, 1);
2857 int best_count = -1;
2860 for (i = 0; i < n_labels; i++)
2864 for (j = i + 1; j < n_labels; j++)
2865 if (XEXP (XVECEXP (jump_table, 1, i), 0)
2866 == XEXP (XVECEXP (jump_table, 1, j), 0))
2869 if (count > best_count)
2870 best_count = count, best_label = XVECEXP (jump_table, 1, i);
2876 operands[3] = best_label;
2877 return \"addq %0,$29,%2\;jmp $31,(%2),%3\";
2880 return \"addq %0,$29,%2\;jmp $31,(%2),0\";
2882 [(set_attr "type" "ibr")])
2886 (match_operand:DI 0 "register_operand" "r"))
2887 (use (label_ref (match_operand 1 "" "")))]
2888 "WINDOWS_NT && next_active_insn (insn) != 0
2889 && GET_CODE (PATTERN (next_active_insn (insn))) == ADDR_DIFF_VEC
2890 && PREV_INSN (next_active_insn (insn)) == operands[1]"
2892 { rtx best_label = 0;
2893 rtx jump_table_insn = next_active_insn (operands[1]);
2895 if (GET_CODE (jump_table_insn) == JUMP_INSN
2896 && GET_CODE (PATTERN (jump_table_insn)) == ADDR_DIFF_VEC)
2898 rtx jump_table = PATTERN (jump_table_insn);
2899 int n_labels = XVECLEN (jump_table, 1);
2900 int best_count = -1;
2903 for (i = 0; i < n_labels; i++)
2907 for (j = i + 1; j < n_labels; j++)
2908 if (XEXP (XVECEXP (jump_table, 1, i), 0)
2909 == XEXP (XVECEXP (jump_table, 1, j), 0))
2912 if (count > best_count)
2913 best_count = count, best_label = XVECEXP (jump_table, 1, i);
2919 operands[2] = best_label;
2920 return \"jmp $31,(%0),%2\";
2923 return \"jmp $31,(%0),0\";
2925 [(set_attr "type" "ibr")])
2927 ;; Cache flush. Used by INITIALIZE_TRAMPOLINE. 0x86 is PAL_imb, but we don't
2928 ;; want to have to include pal.h in our .s file.
2930 [(unspec_volatile [(const_int 0)] 0)]
2934 ;; Finally, we have the basic data motion insns. The byte and word insns
2935 ;; are done via define_expand. Start with the floating-point insns, since
2936 ;; they are simpler.
2939 [(set (match_operand:SF 0 "nonimmediate_operand" "=r,r,m,f,f,f,m")
2940 (match_operand:SF 1 "input_operand" "rG,m,rG,f,G,m,fG"))]
2941 "register_operand (operands[0], SFmode)
2942 || reg_or_fp0_operand (operands[1], SFmode)"
2951 [(set_attr "type" "iaddlog,ld,st,fpop,fpop,ld,st")])
2954 [(set (match_operand:DF 0 "nonimmediate_operand" "=r,r,m,f,f,f,m")
2955 (match_operand:DF 1 "input_operand" "rG,m,rG,f,G,m,fG"))]
2956 "register_operand (operands[0], DFmode)
2957 || reg_or_fp0_operand (operands[1], DFmode)"
2966 [(set_attr "type" "iaddlog,ld,st,fpop,fpop,ld,st")])
2968 (define_expand "movsf"
2969 [(set (match_operand:SF 0 "nonimmediate_operand" "")
2970 (match_operand:SF 1 "general_operand" ""))]
2974 if (GET_CODE (operands[0]) == MEM
2975 && ! reg_or_fp0_operand (operands[1], SFmode))
2976 operands[1] = force_reg (SFmode, operands[1]);
2979 (define_expand "movdf"
2980 [(set (match_operand:DF 0 "nonimmediate_operand" "")
2981 (match_operand:DF 1 "general_operand" ""))]
2985 if (GET_CODE (operands[0]) == MEM
2986 && ! reg_or_fp0_operand (operands[1], DFmode))
2987 operands[1] = force_reg (DFmode, operands[1]);
2991 [(set (match_operand:SI 0 "nonimmediate_operand" "=r,r,r,r,r,r,m,f,f,f,m")
2992 (match_operand:SI 1 "input_operand" "r,J,I,K,L,m,rJ,f,J,m,fG"))]
2993 "! WINDOWS_NT && (register_operand (operands[0], SImode)
2994 || reg_or_0_operand (operands[1], SImode))"
3007 [(set_attr "type" "iaddlog,iaddlog,iaddlog,iaddlog,iaddlog,ld,st,fpop,fpop,ld,st")])
3010 [(set (match_operand:SI 0 "nonimmediate_operand" "=r,r,r,r,r,r,r,m,f,f,f,m")
3011 (match_operand:SI 1 "input_operand" "r,J,I,K,L,s,m,rJ,f,J,m,fG"))]
3012 "WINDOWS_NT && (register_operand (operands[0], SImode)
3013 || reg_or_0_operand (operands[1], SImode))"
3027 [(set_attr "type" "iaddlog,iaddlog,iaddlog,iaddlog,iaddlog,ldsym,ld,st,fpop,fpop,ld,st")])
3030 [(set (match_operand:HI 0 "nonimmediate_operand" "=r,r,r,r,f,f")
3031 (match_operand:HI 1 "input_operand" "r,J,I,n,f,J"))]
3032 "register_operand (operands[0], HImode)
3033 || register_operand (operands[1], HImode)"
3041 [(set_attr "type" "iaddlog,iaddlog,iaddlog,iaddlog,fpop,fpop")])
3044 [(set (match_operand:QI 0 "nonimmediate_operand" "=r,r,r,r,f,f")
3045 (match_operand:QI 1 "input_operand" "r,J,I,n,f,J"))]
3046 "register_operand (operands[0], QImode)
3047 || register_operand (operands[1], QImode)"
3055 [(set_attr "type" "iaddlog,iaddlog,iaddlog,iaddlog,fpop,fpop")])
3057 ;; We do two major things here: handle mem->mem and construct long
3060 (define_expand "movsi"
3061 [(set (match_operand:SI 0 "general_operand" "")
3062 (match_operand:SI 1 "general_operand" ""))]
3066 if (GET_CODE (operands[0]) == MEM
3067 && ! reg_or_0_operand (operands[1], SImode))
3068 operands[1] = force_reg (SImode, operands[1]);
3070 if (! CONSTANT_P (operands[1]) || input_operand (operands[1], SImode))
3072 else if (GET_CODE (operands[1]) == CONST_INT)
3075 = alpha_emit_set_const (operands[0], SImode, INTVAL (operands[1]), 3);
3076 if (rtx_equal_p (operands[0], operands[1]))
3081 ;; Split a load of a large constant into the appropriate two-insn
3085 [(set (match_operand:SI 0 "register_operand" "")
3086 (match_operand:SI 1 "const_int_operand" ""))]
3087 "! add_operand (operands[1], SImode)"
3088 [(set (match_dup 0) (match_dup 2))
3089 (set (match_dup 0) (plus:SI (match_dup 0) (match_dup 3)))]
3092 = alpha_emit_set_const (operands[0], SImode, INTVAL (operands[1]), 2);
3094 if (tem == operands[0])
3101 [(set (match_operand:DI 0 "general_operand" "=r,r,r,r,r,r,r,m,f,f,f,Q")
3102 (match_operand:DI 1 "input_operand" "r,J,I,K,L,s,m,rJ,f,J,Q,fG"))]
3103 "register_operand (operands[0], DImode)
3104 || reg_or_0_operand (operands[1], DImode)"
3118 [(set_attr "type" "iaddlog,iaddlog,iaddlog,iaddlog,iaddlog,ldsym,ld,st,fpop,fpop,ld,st")])
3120 ;; We do three major things here: handle mem->mem, put 64-bit constants in
3121 ;; memory, and construct long 32-bit constants.
3123 (define_expand "movdi"
3124 [(set (match_operand:DI 0 "general_operand" "")
3125 (match_operand:DI 1 "general_operand" ""))]
3131 if (GET_CODE (operands[0]) == MEM
3132 && ! reg_or_0_operand (operands[1], DImode))
3133 operands[1] = force_reg (DImode, operands[1]);
3135 if (! CONSTANT_P (operands[1]) || input_operand (operands[1], DImode))
3137 else if (GET_CODE (operands[1]) == CONST_INT
3138 && (tem = alpha_emit_set_const (operands[0], DImode,
3139 INTVAL (operands[1]), 3)) != 0)
3141 if (rtx_equal_p (tem, operands[0]))
3146 else if (CONSTANT_P (operands[1]))
3148 operands[1] = force_const_mem (DImode, operands[1]);
3149 if (reload_in_progress)
3151 emit_move_insn (operands[0], XEXP (operands[1], 0));
3152 XEXP (operands[1], 0) = operands[0];
3155 operands[1] = validize_mem (operands[1]);
3161 ;; Split a load of a large constant into the appropriate two-insn
3165 [(set (match_operand:DI 0 "register_operand" "")
3166 (match_operand:DI 1 "const_int_operand" ""))]
3167 "! add_operand (operands[1], DImode)"
3168 [(set (match_dup 0) (match_dup 2))
3169 (set (match_dup 0) (plus:DI (match_dup 0) (match_dup 3)))]
3172 = alpha_emit_set_const (operands[0], DImode, INTVAL (operands[1]), 2);
3174 if (tem == operands[0])
3180 ;; These are the partial-word cases.
3182 ;; First we have the code to load an aligned word. Operand 0 is the register
3183 ;; in which to place the result. It's mode is QImode or HImode. Operand 1
3184 ;; is an SImode MEM at the low-order byte of the proper word. Operand 2 is the
3185 ;; number of bits within the word that the value is. Operand 3 is an SImode
3186 ;; scratch register. If operand 0 is a hard register, operand 3 may be the
3187 ;; same register. It is allowed to conflict with operand 1 as well.
3189 (define_expand "aligned_loadqi"
3190 [(set (match_operand:SI 3 "register_operand" "")
3191 (match_operand:SI 1 "memory_operand" ""))
3192 (set (subreg:DI (match_operand:QI 0 "register_operand" "") 0)
3193 (zero_extract:DI (subreg:DI (match_dup 3) 0)
3195 (match_operand:DI 2 "const_int_operand" "")))]
3200 (define_expand "aligned_loadhi"
3201 [(set (match_operand:SI 3 "register_operand" "")
3202 (match_operand:SI 1 "memory_operand" ""))
3203 (set (subreg:DI (match_operand:HI 0 "register_operand" "") 0)
3204 (zero_extract:DI (subreg:DI (match_dup 3) 0)
3206 (match_operand:DI 2 "const_int_operand" "")))]
3211 ;; Similar for unaligned loads. For QImode, we use the sequence from the
3212 ;; Alpha Architecture manual. However, for HImode, we do not. HImode pointers
3213 ;; are normally aligned to the byte boundary, so an HImode object cannot
3214 ;; cross a longword boundary. We could use a sequence similar to that for
3215 ;; QImode, but that would fail if the pointer, was, in fact, not aligned.
3216 ;; Instead, we clear bit 1 in the address and do an ldl. If the low-order
3217 ;; bit was not aligned, this will trap and the trap handler will do what is
3220 ;; Here operand 1 is the address. Operands 2 and 3 are temporaries, where
3221 ;; operand 3 can overlap the input and output registers.
3223 (define_expand "unaligned_loadqi"
3224 [(set (match_operand:DI 2 "register_operand" "")
3225 (mem:DI (and:DI (match_operand:DI 1 "address_operand" "")
3227 (set (match_operand:DI 3 "register_operand" "")
3229 (set (subreg:DI (match_operand:QI 0 "register_operand" "") 0)
3230 (zero_extract:DI (match_dup 2)
3232 (ashift:DI (match_dup 3) (const_int 3))))]
3236 ;; For this, the address must already be in a register. We also need two
3237 ;; DImode temporaries, neither of which may overlap the input (and hence the
3238 ;; output, since they might be the same register), but both of which may
3241 (define_expand "unaligned_loadhi"
3242 [(set (match_operand:DI 2 "register_operand" "")
3243 (and:DI (match_operand:DI 1 "register_operand" "")
3245 (set (match_operand:DI 3 "register_operand" "")
3246 (mem:DI (match_dup 2)))
3247 (set (match_operand:DI 4 "register_operand" "")
3248 (and:DI (match_dup 1) (const_int -2)))
3249 (set (subreg:DI (match_operand:HI 0 "register_operand" "") 0)
3250 (zero_extract:DI (match_dup 3)
3252 (ashift:DI (match_dup 4) (const_int 3))))]
3256 ;; Storing an aligned byte or word requires two temporaries. Operand 0 is the
3257 ;; aligned SImode MEM. Operand 1 is the register containing the
3258 ;; byte or word to store. Operand 2 is the number of bits within the word that
3259 ;; the value should be placed. Operands 3 and 4 are SImode temporaries.
3261 (define_expand "aligned_store"
3262 [(set (match_operand:SI 3 "register_operand" "")
3263 (match_operand:SI 0 "memory_operand" ""))
3264 (set (subreg:DI (match_dup 3) 0)
3265 (and:DI (subreg:DI (match_dup 3) 0) (match_dup 5)))
3266 (set (subreg:DI (match_operand:SI 4 "register_operand" "") 0)
3267 (ashift:DI (zero_extend:DI (match_operand 1 "register_operand" ""))
3268 (match_operand:DI 2 "const_int_operand" "")))
3269 (set (subreg:DI (match_dup 4) 0)
3270 (ior:DI (subreg:DI (match_dup 4) 0) (subreg:DI (match_dup 3) 0)))
3271 (set (match_dup 0) (match_dup 4))]
3274 { operands[5] = GEN_INT (~ (GET_MODE_MASK (GET_MODE (operands[1]))
3275 << INTVAL (operands[2])));
3278 ;; For the unaligned byte case, we use code similar to that in the
3279 ;; Architecture book, but reordered to lower the number of registers
3280 ;; required. Operand 0 is the address. Operand 1 is the data to store.
3281 ;; Operands 2, 3, and 4 are DImode temporaries, where operands 2 and 4 may
3282 ;; be the same temporary, if desired. If the address is in a register,
3283 ;; operand 2 can be that register.
3285 (define_expand "unaligned_storeqi"
3286 [(set (match_operand:DI 3 "register_operand" "")
3287 (mem:DI (and:DI (match_operand:DI 0 "address_operand" "")
3289 (set (match_operand:DI 2 "register_operand" "")
3292 (and:DI (not:DI (ashift:DI (const_int 255)
3293 (ashift:DI (match_dup 2) (const_int 3))))
3295 (set (match_operand:DI 4 "register_operand" "")
3296 (ashift:DI (zero_extend:DI (match_operand:QI 1 "register_operand" ""))
3297 (ashift:DI (match_dup 2) (const_int 3))))
3298 (set (match_dup 4) (ior:DI (match_dup 4) (match_dup 3)))
3299 (set (mem:DI (and:DI (match_dup 0) (const_int -8)))
3304 ;; This is the code for storing into an unaligned short. It uses the same
3305 ;; trick as loading from an unaligned short. It needs lots of temporaries.
3306 ;; However, during reload, we only have two registers available. So we
3307 ;; repeat code so that only two temporaries are available. During RTL
3308 ;; generation, we can use different pseudos for each temporary and CSE
3309 ;; will remove the redundancies. During reload, we have to settle with
3310 ;; what we get. Luckily, unaligned accesses of this kind produced during
3311 ;; reload are quite rare.
3313 ;; Operand 0 is the address of the memory location. Operand 1 contains the
3314 ;; data to store. The rest of the operands are all temporaries, with
3315 ;; various overlap possibilities during reload. See reload_outhi for
3316 ;; details of this use.
3318 (define_expand "unaligned_storehi"
3319 [(set (match_operand:DI 2 "register_operand" "")
3320 (match_operand:DI 0 "address_operand" ""))
3321 (set (match_operand:DI 3 "register_operand" "")
3322 (and:DI (match_dup 2) (const_int -7)))
3323 (set (match_operand:DI 4 "register_operand" "")
3324 (mem:DI (match_dup 3)))
3325 (set (match_operand:DI 10 "register_operand" "")
3326 (and:DI (match_dup 2) (const_int -2)))
3327 (set (match_operand:DI 5 "register_operand" "")
3328 (and:DI (not:DI (ashift:DI (const_int 65535)
3329 (ashift:DI (match_dup 10) (const_int 3))))
3331 (set (match_operand:DI 6 "register_operand" "")
3332 (ashift:DI (zero_extend:DI (match_operand:HI 1 "register_operand" ""))
3333 (ashift:DI (match_dup 10) (const_int 3))))
3334 (set (match_operand:DI 7 "register_operand" "")
3335 (ior:DI (match_dup 5) (match_dup 6)))
3336 (set (match_operand:DI 8 "register_operand" "") (match_dup 0))
3337 (set (match_operand:DI 9 "register_operand" "")
3338 (and:DI (match_dup 8) (const_int -7)))
3339 (set (mem:DI (match_dup 9)) (match_dup 7))]
3343 ;; Here are the define_expand's for QI and HI moves that use the above
3344 ;; patterns. We have the normal sets, plus the ones that need scratch
3345 ;; registers for reload.
3347 (define_expand "movqi"
3348 [(set (match_operand:QI 0 "general_operand" "")
3349 (match_operand:QI 1 "general_operand" ""))]
3352 { extern rtx get_unaligned_address ();
3354 /* If the output is not a register, the input must be. */
3355 if (GET_CODE (operands[0]) == MEM)
3356 operands[1] = force_reg (QImode, operands[1]);
3358 /* Handle four memory cases, unaligned and aligned for either the input
3359 or the output. The only case where we can be called during reload is
3360 for aligned loads; all other cases require temporaries. */
3362 if (GET_CODE (operands[1]) == MEM
3363 || (GET_CODE (operands[1]) == SUBREG
3364 && GET_CODE (SUBREG_REG (operands[1])) == MEM)
3365 || (reload_in_progress && GET_CODE (operands[1]) == REG
3366 && REGNO (operands[1]) >= FIRST_PSEUDO_REGISTER)
3367 || (reload_in_progress && GET_CODE (operands[1]) == SUBREG
3368 && GET_CODE (SUBREG_REG (operands[1])) == REG
3369 && REGNO (SUBREG_REG (operands[1])) >= FIRST_PSEUDO_REGISTER))
3371 if (aligned_memory_operand (operands[1], QImode))
3373 rtx aligned_mem, bitnum;
3374 rtx scratch = (reload_in_progress
3375 ? gen_rtx (REG, SImode, REGNO (operands[0]))
3376 : gen_reg_rtx (SImode));
3378 get_aligned_mem (operands[1], &aligned_mem, &bitnum);
3380 emit_insn (gen_aligned_loadqi (operands[0], aligned_mem, bitnum,
3385 /* Don't pass these as parameters since that makes the generated
3386 code depend on parameter evaluation order which will cause
3387 bootstrap failures. */
3389 rtx temp1 = gen_reg_rtx (DImode);
3390 rtx temp2 = gen_reg_rtx (DImode);
3391 rtx seq = gen_unaligned_loadqi (operands[0],
3392 get_unaligned_address (operands[1]),
3395 alpha_set_memflags (seq, operands[1]);
3402 else if (GET_CODE (operands[0]) == MEM
3403 || (GET_CODE (operands[0]) == SUBREG
3404 && GET_CODE (SUBREG_REG (operands[0])) == MEM)
3405 || (reload_in_progress && GET_CODE (operands[0]) == REG
3406 && REGNO (operands[0]) >= FIRST_PSEUDO_REGISTER)
3407 || (reload_in_progress && GET_CODE (operands[0]) == SUBREG
3408 && GET_CODE (SUBREG_REG (operands[0])) == REG
3409 && REGNO (operands[0]) >= FIRST_PSEUDO_REGISTER))
3411 if (aligned_memory_operand (operands[0], QImode))
3413 rtx aligned_mem, bitnum;
3414 rtx temp1 = gen_reg_rtx (SImode);
3415 rtx temp2 = gen_reg_rtx (SImode);
3417 get_aligned_mem (operands[0], &aligned_mem, &bitnum);
3419 emit_insn (gen_aligned_store (aligned_mem, operands[1], bitnum,
3424 rtx temp1 = gen_reg_rtx (DImode);
3425 rtx temp2 = gen_reg_rtx (DImode);
3426 rtx temp3 = gen_reg_rtx (DImode);
3427 rtx seq = gen_unaligned_storeqi (get_unaligned_address (operands[0]),
3428 operands[1], temp1, temp2, temp3);
3430 alpha_set_memflags (seq, operands[0]);
3437 (define_expand "movhi"
3438 [(set (match_operand:HI 0 "general_operand" "")
3439 (match_operand:HI 1 "general_operand" ""))]
3442 { extern rtx get_unaligned_address ();
3444 /* If the output is not a register, the input must be. */
3445 if (GET_CODE (operands[0]) == MEM)
3446 operands[1] = force_reg (HImode, operands[1]);
3448 /* Handle four memory cases, unaligned and aligned for either the input
3449 or the output. The only case where we can be called during reload is
3450 for aligned loads; all other cases require temporaries. */
3452 if (GET_CODE (operands[1]) == MEM
3453 || (GET_CODE (operands[1]) == SUBREG
3454 && GET_CODE (SUBREG_REG (operands[1])) == MEM)
3455 || (reload_in_progress && GET_CODE (operands[1]) == REG
3456 && REGNO (operands[1]) >= FIRST_PSEUDO_REGISTER)
3457 || (reload_in_progress && GET_CODE (operands[1]) == SUBREG
3458 && GET_CODE (SUBREG_REG (operands[1])) == REG
3459 && REGNO (SUBREG_REG (operands[1])) >= FIRST_PSEUDO_REGISTER))
3461 if (aligned_memory_operand (operands[1], HImode))
3463 rtx aligned_mem, bitnum;
3464 rtx scratch = (reload_in_progress
3465 ? gen_rtx (REG, SImode, REGNO (operands[0]))
3466 : gen_reg_rtx (SImode));
3468 get_aligned_mem (operands[1], &aligned_mem, &bitnum);
3470 emit_insn (gen_aligned_loadhi (operands[0], aligned_mem, bitnum,
3476 = force_reg (DImode,
3477 force_operand (get_unaligned_address (operands[1]),
3479 rtx scratch1 = gen_reg_rtx (DImode);
3480 rtx scratch2 = gen_reg_rtx (DImode);
3481 rtx scratch3 = gen_reg_rtx (DImode);
3483 rtx seq = gen_unaligned_loadhi (operands[0], addr, scratch1,
3484 scratch2, scratch3);
3486 alpha_set_memflags (seq, operands[1]);
3493 else if (GET_CODE (operands[0]) == MEM
3494 || (GET_CODE (operands[0]) == SUBREG
3495 && GET_CODE (SUBREG_REG (operands[0])) == MEM)
3496 || (reload_in_progress && GET_CODE (operands[0]) == REG
3497 && REGNO (operands[0]) >= FIRST_PSEUDO_REGISTER)
3498 || (reload_in_progress && GET_CODE (operands[0]) == SUBREG
3499 && GET_CODE (SUBREG_REG (operands[0])) == REG
3500 && REGNO (operands[0]) >= FIRST_PSEUDO_REGISTER))
3502 if (aligned_memory_operand (operands[0], HImode))
3504 rtx aligned_mem, bitnum;
3505 rtx temp1 = gen_reg_rtx (SImode);
3506 rtx temp2 = gen_reg_rtx (SImode);
3508 get_aligned_mem (operands[0], &aligned_mem, &bitnum);
3510 emit_insn (gen_aligned_store (aligned_mem, operands[1], bitnum,
3515 rtx temp1 = gen_reg_rtx (DImode);
3516 rtx temp2 = gen_reg_rtx (DImode);
3517 rtx temp3 = gen_reg_rtx (DImode);
3518 rtx temp4 = gen_reg_rtx (DImode);
3519 rtx temp5 = gen_reg_rtx (DImode);
3520 rtx temp6 = gen_reg_rtx (DImode);
3521 rtx temp7 = gen_reg_rtx (DImode);
3522 rtx temp8 = gen_reg_rtx (DImode);
3523 rtx temp9 = gen_reg_rtx (DImode);
3525 rtx seq = gen_unaligned_storehi (get_unaligned_address (operands[0]),
3526 operands[1], temp1, temp2,temp3,
3527 temp4, temp5, temp6,temp7,
3530 alpha_set_memflags (seq, operands[0]);
3538 ;; Here are the versions for reload. Note that in the unaligned cases
3539 ;; we know that the operand must not be a pseudo-register because stack
3540 ;; slots are always aligned references.
3542 (define_expand "reload_inqi"
3543 [(parallel [(match_operand:QI 0 "register_operand" "=r")
3544 (match_operand:QI 1 "unaligned_memory_operand" "m")
3545 (match_operand:TI 2 "register_operand" "=&r")])]
3548 { extern rtx get_unaligned_address ();
3549 rtx addr = get_unaligned_address (operands[1]);
3550 /* It is possible that one of the registers we got for operands[2]
3551 might co-incide with that of operands[0] (which is why we made
3552 it TImode). Pick the other one to use as our scratch. */
3553 rtx scratch = gen_rtx (REG, DImode,
3554 REGNO (operands[0]) == REGNO (operands[2])
3555 ? REGNO (operands[2]) + 1 : REGNO (operands[2]));
3556 rtx seq = gen_unaligned_loadqi (operands[0], addr, scratch,
3557 gen_rtx (REG, DImode, REGNO (operands[0])));
3559 alpha_set_memflags (seq, operands[1]);
3564 (define_expand "reload_inhi"
3565 [(parallel [(match_operand:HI 0 "register_operand" "=r")
3566 (match_operand:HI 1 "unaligned_memory_operand" "m")
3567 (match_operand:TI 2 "register_operand" "=&r")])]
3570 { extern rtx get_unaligned_address ();
3571 rtx addr = get_unaligned_address (operands[1]);
3572 rtx scratch1 = gen_rtx (REG, DImode, REGNO (operands[2]));
3573 rtx scratch2 = gen_rtx (REG, DImode, REGNO (operands[2]) + 1);
3576 if (GET_CODE (addr) != REG)
3578 emit_insn (gen_rtx (SET, VOIDmode, scratch2, addr));
3582 seq = gen_unaligned_loadhi (operands[0], addr, scratch1, scratch1, scratch2);
3583 alpha_set_memflags (seq, operands[1]);
3588 (define_expand "reload_outqi"
3589 [(parallel [(match_operand:QI 0 "any_memory_operand" "=m")
3590 (match_operand:QI 1 "register_operand" "r")
3591 (match_operand:TI 2 "register_operand" "=&r")])]
3594 { extern rtx get_unaligned_address ();
3596 if (aligned_memory_operand (operands[0], QImode))
3598 rtx aligned_mem, bitnum;
3600 get_aligned_mem (operands[0], &aligned_mem, &bitnum);
3602 emit_insn (gen_aligned_store (aligned_mem, operands[1], bitnum,
3603 gen_rtx (REG, SImode, REGNO (operands[2])),
3604 gen_rtx (REG, SImode,
3605 REGNO (operands[2]) + 1)));
3609 rtx addr = get_unaligned_address (operands[0]);
3610 rtx scratch1 = gen_rtx (REG, DImode, REGNO (operands[2]));
3611 rtx scratch2 = gen_rtx (REG, DImode, REGNO (operands[2]) + 1);
3612 rtx scratch3 = scratch1;
3615 if (GET_CODE (addr) == REG)
3618 seq = gen_unaligned_storeqi (addr, operands[1], scratch1,
3619 scratch2, scratch3);
3620 alpha_set_memflags (seq, operands[0]);
3627 (define_expand "reload_outhi"
3628 [(parallel [(match_operand:HI 0 "any_memory_operand" "=m")
3629 (match_operand:HI 1 "register_operand" "r")
3630 (match_operand:TI 2 "register_operand" "=&r")])]
3633 { extern rtx get_unaligned_address ();
3635 if (aligned_memory_operand (operands[0], HImode))
3637 rtx aligned_mem, bitnum;
3639 get_aligned_mem (operands[0], &aligned_mem, &bitnum);
3641 emit_insn (gen_aligned_store (aligned_mem, operands[1], bitnum,
3642 gen_rtx (REG, SImode, REGNO (operands[2])),
3643 gen_rtx (REG, SImode,
3644 REGNO (operands[2]) + 1)));
3648 rtx addr = get_unaligned_address (operands[0]);
3649 rtx scratch1 = gen_rtx (REG, DImode, REGNO (operands[2]));
3650 rtx scratch2 = gen_rtx (REG, DImode, REGNO (operands[2]) + 1);
3651 rtx scratch_a = GET_CODE (addr) == REG ? addr : scratch1;
3654 seq = gen_unaligned_storehi (addr, operands[1], scratch_a,
3655 scratch2, scratch2, scratch2,
3656 scratch1, scratch2, scratch_a,
3657 scratch1, scratch_a);
3658 alpha_set_memflags (seq, operands[0]);
3665 ;; Subroutine of stack space allocation. Perform a stack probe.
3666 (define_expand "probe_stack"
3667 [(set (match_dup 1) (match_operand:DI 0 "const_int_operand" ""))]
3671 operands[1] = gen_rtx (MEM, DImode, plus_constant (stack_pointer_rtx,
3672 INTVAL (operands[0])));
3673 MEM_VOLATILE_P (operands[1]) = 1;
3675 operands[0] = const0_rtx;
3678 ;; This is how we allocate stack space. If we are allocating a
3679 ;; constant amount of space and we know it is less than 4096
3680 ;; bytes, we need do nothing.
3682 ;; If it is more than 4096 bytes, we need to probe the stack
3684 (define_expand "allocate_stack"
3686 (plus:DI (reg:DI 30)
3687 (match_operand:DI 0 "reg_or_cint_operand" "")))]
3691 if (GET_CODE (operands[0]) == CONST_INT
3692 && INTVAL (operands[0]) < 32768)
3694 if (INTVAL (operands[0]) >= 4096)
3696 /* We do this the same way as in the prologue and generate explicit
3697 probes. Then we update the stack by the constant. */
3701 emit_insn (gen_probe_stack (GEN_INT (- probed)));
3702 while (probed + 8192 < INTVAL (operands[0]))
3703 emit_insn (gen_probe_stack (GEN_INT (- (probed += 8192))));
3705 if (probed + 4096 < INTVAL (operands[0]))
3706 emit_insn (gen_probe_stack (GEN_INT (- INTVAL(operands[0]))));
3709 operands[0] = GEN_INT (- INTVAL (operands[0]));
3714 rtx loop_label = gen_label_rtx ();
3715 rtx want = gen_reg_rtx (Pmode);
3716 rtx tmp = gen_reg_rtx (Pmode);
3719 emit_insn (gen_subdi3 (want, stack_pointer_rtx,
3720 force_reg (Pmode, operands[0])));
3721 emit_insn (gen_adddi3 (tmp, stack_pointer_rtx, GEN_INT (-4096)));
3723 if (GET_CODE (operands[0]) != CONST_INT)
3725 out_label = gen_label_rtx ();
3726 emit_insn (gen_cmpdi (want, tmp));
3727 emit_jump_insn (gen_bgeu (out_label));
3730 emit_label (loop_label);
3731 memref = gen_rtx (MEM, DImode, tmp);
3732 MEM_VOLATILE_P (memref) = 1;
3733 emit_move_insn (memref, const0_rtx);
3734 emit_insn (gen_adddi3 (tmp, tmp, GEN_INT(-8192)));
3735 emit_insn (gen_cmpdi (tmp, want));
3736 emit_jump_insn (gen_bgtu (loop_label));
3737 memref = gen_rtx (MEM, DImode, want);
3738 MEM_VOLATILE_P (memref) = 1;
3739 emit_move_insn (memref, const0_rtx);
3742 emit_label (out_label);
3744 emit_move_insn (stack_pointer_rtx, want);