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 "some_operand" "=&r")
279 (plus:DI (plus:DI (match_operand:DI 1 "some_operand" "r")
280 (match_operand:DI 2 "some_operand" "r"))
281 (match_operand:DI 3 "some_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 "some_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 "some_operand" "r"))
301 (match_operand:SI 4 "some_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 "some_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 "some_operand" "r"))
325 (match_operand:SI 4 "some_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 "some_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 "some_operand" "r"))
351 (match_operand:DI 4 "some_operand" "rIOKL")))]
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]), code2 = NE;
2239 if (alpha_compare_fp_p)
2243 case EQ: case LE: case LT:
2244 op0 = alpha_compare_op0;
2245 op1 = alpha_compare_op1;
2249 op0 = alpha_compare_op0;
2250 op1 = alpha_compare_op1;
2254 op0 = force_reg (DImode, alpha_compare_op1);
2255 op1 = alpha_compare_op0;
2259 op0 = force_reg (DImode, alpha_compare_op1);
2260 op1 = alpha_compare_op0;
2265 operands[1] = gen_rtx (code, DImode, op0, op1);
2266 operands[4] = gen_reg_rtx (DImode);
2267 operands[5] = gen_rtx (code2, VOIDmode, operands[4], CONST0_RTX (DImode));
2270 (define_expand "movdicc"
2271 [(set (match_dup 4) (match_operand 1 "comparison_operator" ""))
2272 (set (match_operand:DI 0 "register_operand" "")
2273 (if_then_else:DI (match_dup 5)
2274 (match_operand:DI 2 "reg_or_8bit_operand" "")
2275 (match_operand:DI 3 "reg_or_8bit_operand" "")))]
2280 enum rtx_code code = GET_CODE (operands[1]), code2 = NE;
2282 if (alpha_compare_fp_p)
2286 case EQ: case LE: case LT:
2287 op0 = alpha_compare_op0;
2288 op1 = alpha_compare_op1;
2292 op0 = alpha_compare_op0;
2293 op1 = alpha_compare_op1;
2297 op0 = force_reg (DImode, alpha_compare_op1);
2298 op1 = alpha_compare_op0;
2302 op0 = force_reg (DImode, alpha_compare_op1);
2303 op1 = alpha_compare_op0;
2308 operands[1] = gen_rtx (code, DImode, op0, op1);
2309 operands[4] = gen_reg_rtx (DImode);
2310 operands[5] = gen_rtx (code2, VOIDmode, operands[4], CONST0_RTX (DImode));
2313 (define_expand "movsfcc"
2314 [(set (match_dup 4) (match_operand 1 "comparison_operator" ""))
2315 (set (match_operand:SF 0 "register_operand" "")
2316 (if_then_else:SF (match_dup 5)
2317 (match_operand:SF 2 "reg_or_fp0_operand" "")
2318 (match_operand:SF 3 "reg_or_fp0_operand" "")))]
2323 enum rtx_code code = GET_CODE (operands[1]), code2 = NE;
2325 if (!alpha_compare_fp_p)
2329 case EQ: case LE: case LT:
2330 op0 = alpha_compare_op0;
2331 op1 = alpha_compare_op1;
2334 /* There isn't a cmptne insn. */
2336 op0 = alpha_compare_op0;
2337 op1 = alpha_compare_op1;
2341 op0 = force_reg (DFmode, alpha_compare_op1);
2342 op1 = alpha_compare_op0;
2346 op0 = force_reg (DFmode, alpha_compare_op1);
2347 op1 = alpha_compare_op0;
2352 operands[1] = gen_rtx (code, DFmode, op0, op1);
2353 operands[4] = gen_reg_rtx (DFmode);
2354 operands[5] = gen_rtx (code2, VOIDmode, operands[4], CONST0_RTX (DFmode));
2357 (define_expand "movdfcc"
2358 [(set (match_dup 4) (match_operand 1 "comparison_operator" ""))
2359 (set (match_operand:DF 0 "register_operand" "")
2360 (if_then_else:DF (match_dup 5)
2361 (match_operand:DF 2 "reg_or_fp0_operand" "")
2362 (match_operand:DF 3 "reg_or_fp0_operand" "")))]
2367 enum rtx_code code = GET_CODE (operands[1]), code2 = NE;
2369 if (!alpha_compare_fp_p)
2373 case EQ: case LE: case LT:
2374 op0 = alpha_compare_op0;
2375 op1 = alpha_compare_op1;
2378 /* There isn't a cmptne insn. */
2380 op0 = alpha_compare_op0;
2381 op1 = alpha_compare_op1;
2385 op0 = force_reg (DFmode, alpha_compare_op1);
2386 op1 = alpha_compare_op0;
2390 op0 = force_reg (DFmode, alpha_compare_op1);
2391 op1 = alpha_compare_op0;
2396 operands[1] = gen_rtx (code, DFmode, op0, op1);
2397 operands[4] = gen_reg_rtx (DFmode);
2398 operands[5] = gen_rtx (code2, VOIDmode, operands[4], CONST0_RTX (DFmode));
2401 ;; These define_split definitions are used in cases when comparisons have
2402 ;; not be stated in the correct way and we need to reverse the second
2403 ;; comparison. For example, x >= 7 has to be done as x < 6 with the
2404 ;; comparison that tests the result being reversed. We have one define_split
2405 ;; for each use of a comparison. They do not match valid insns and need
2406 ;; not generate valid insns.
2408 ;; We can also handle equality comparisons (and inequality comparisons in
2409 ;; cases where the resulting add cannot overflow) by doing an add followed by
2410 ;; a comparison with zero. This is faster since the addition takes one
2411 ;; less cycle than a compare when feeding into a conditional move.
2412 ;; For this case, we also have an SImode pattern since we can merge the add
2413 ;; and sign extend and the order doesn't matter.
2415 ;; We do not do this for floating-point, since it isn't clear how the "wrong"
2416 ;; operation could have been generated.
2419 [(set (match_operand:DI 0 "register_operand" "")
2421 (match_operator 1 "comparison_operator"
2422 [(match_operand:DI 2 "reg_or_0_operand" "")
2423 (match_operand:DI 3 "reg_or_cint_operand" "")])
2424 (match_operand:DI 4 "reg_or_cint_operand" "")
2425 (match_operand:DI 5 "reg_or_cint_operand" "")))
2426 (clobber (match_operand:DI 6 "register_operand" ""))]
2427 "operands[3] != const0_rtx"
2428 [(set (match_dup 6) (match_dup 7))
2430 (if_then_else:DI (match_dup 8) (match_dup 4) (match_dup 5)))]
2432 { enum rtx_code code = GET_CODE (operands[1]);
2433 int unsignedp = (code == GEU || code == LEU || code == GTU || code == LTU);
2435 /* If we are comparing for equality with a constant and that constant
2436 appears in the arm when the register equals the constant, use the
2437 register since that is more likely to match (and to produce better code
2440 if (code == EQ && GET_CODE (operands[3]) == CONST_INT
2441 && rtx_equal_p (operands[4], operands[3]))
2442 operands[4] = operands[2];
2444 else if (code == NE && GET_CODE (operands[3]) == CONST_INT
2445 && rtx_equal_p (operands[5], operands[3]))
2446 operands[5] = operands[2];
2448 if (code == NE || code == EQ
2449 || (extended_count (operands[2], DImode, unsignedp) >= 1
2450 && extended_count (operands[3], DImode, unsignedp) >= 1))
2452 if (GET_CODE (operands[3]) == CONST_INT)
2453 operands[7] = gen_rtx (PLUS, DImode, operands[2],
2454 GEN_INT (- INTVAL (operands[3])));
2456 operands[7] = gen_rtx (MINUS, DImode, operands[2], operands[3]);
2458 operands[8] = gen_rtx (code, VOIDmode, operands[6], const0_rtx);
2461 else if (code == EQ || code == LE || code == LT
2462 || code == LEU || code == LTU)
2464 operands[7] = gen_rtx (code, DImode, operands[2], operands[3]);
2465 operands[8] = gen_rtx (NE, VOIDmode, operands[6], const0_rtx);
2469 operands[7] = gen_rtx (reverse_condition (code), DImode, operands[2],
2471 operands[8] = gen_rtx (EQ, VOIDmode, operands[6], const0_rtx);
2476 [(set (match_operand:DI 0 "register_operand" "")
2478 (match_operator 1 "comparison_operator"
2479 [(match_operand:SI 2 "reg_or_0_operand" "")
2480 (match_operand:SI 3 "reg_or_cint_operand" "")])
2481 (match_operand:DI 4 "reg_or_8bit_operand" "")
2482 (match_operand:DI 5 "reg_or_8bit_operand" "")))
2483 (clobber (match_operand:DI 6 "register_operand" ""))]
2484 "operands[3] != const0_rtx
2485 && (GET_CODE (operands[1]) == EQ || GET_CODE (operands[1]) == NE)"
2486 [(set (match_dup 6) (match_dup 7))
2488 (if_then_else:DI (match_dup 8) (match_dup 4) (match_dup 5)))]
2490 { enum rtx_code code = GET_CODE (operands[1]);
2491 int unsignedp = (code == GEU || code == LEU || code == GTU || code == LTU);
2494 if ((code != NE && code != EQ
2495 && ! (extended_count (operands[2], DImode, unsignedp) >= 1
2496 && extended_count (operands[3], DImode, unsignedp) >= 1)))
2499 if (GET_CODE (operands[3]) == CONST_INT)
2500 tem = gen_rtx (PLUS, SImode, operands[2],
2501 GEN_INT (- INTVAL (operands[3])));
2503 tem = gen_rtx (MINUS, SImode, operands[2], operands[3]);
2505 operands[7] = gen_rtx (SIGN_EXTEND, DImode, tem);
2506 operands[8] = gen_rtx (GET_CODE (operands[1]), VOIDmode, operands[6],
2513 (match_operator 1 "comparison_operator"
2514 [(match_operand:DI 2 "reg_or_0_operand" "")
2515 (match_operand:DI 3 "reg_or_cint_operand" "")])
2516 (label_ref (match_operand 0 "" ""))
2518 (clobber (match_operand:DI 4 "register_operand" ""))]
2519 "operands[3] != const0_rtx"
2520 [(set (match_dup 4) (match_dup 5))
2521 (set (pc) (if_then_else (match_dup 6) (label_ref (match_dup 0)) (pc)))]
2523 { enum rtx_code code = GET_CODE (operands[1]);
2524 int unsignedp = (code == GEU || code == LEU || code == GTU || code == LTU);
2526 if (code == NE || code == EQ
2527 || (extended_count (operands[2], DImode, unsignedp) >= 1
2528 && extended_count (operands[3], DImode, unsignedp) >= 1))
2530 if (GET_CODE (operands[3]) == CONST_INT)
2531 operands[5] = gen_rtx (PLUS, DImode, operands[2],
2532 GEN_INT (- INTVAL (operands[3])));
2534 operands[5] = gen_rtx (MINUS, DImode, operands[2], operands[3]);
2536 operands[6] = gen_rtx (code, VOIDmode, operands[4], const0_rtx);
2539 else if (code == EQ || code == LE || code == LT
2540 || code == LEU || code == LTU)
2542 operands[5] = gen_rtx (code, DImode, operands[2], operands[3]);
2543 operands[6] = gen_rtx (NE, VOIDmode, operands[4], const0_rtx);
2547 operands[5] = gen_rtx (reverse_condition (code), DImode, operands[2],
2549 operands[6] = gen_rtx (EQ, VOIDmode, operands[4], const0_rtx);
2556 (match_operator 1 "comparison_operator"
2557 [(match_operand:SI 2 "reg_or_0_operand" "")
2558 (match_operand:SI 3 "const_int_operand" "")])
2559 (label_ref (match_operand 0 "" ""))
2561 (clobber (match_operand:DI 4 "register_operand" ""))]
2562 "operands[3] != const0_rtx
2563 && (GET_CODE (operands[1]) == EQ || GET_CODE (operands[1]) == NE)"
2564 [(set (match_dup 4) (match_dup 5))
2565 (set (pc) (if_then_else (match_dup 6) (label_ref (match_dup 0)) (pc)))]
2569 if (GET_CODE (operands[3]) == CONST_INT)
2570 tem = gen_rtx (PLUS, SImode, operands[2],
2571 GEN_INT (- INTVAL (operands[3])));
2573 tem = gen_rtx (MINUS, SImode, operands[2], operands[3]);
2575 operands[5] = gen_rtx (SIGN_EXTEND, DImode, tem);
2576 operands[6] = gen_rtx (GET_CODE (operands[1]), VOIDmode,
2577 operands[4], const0_rtx);
2580 ;; We can convert such things as "a > 0xffff" to "t = a & ~ 0xffff; t != 0".
2581 ;; This eliminates one, and sometimes two, insns when the AND can be done
2584 [(set (match_operand:DI 0 "register_operand" "")
2585 (match_operator 1 "comparison_operator"
2586 [(match_operand:DI 2 "register_operand" "")
2587 (match_operand:DI 3 "const_int_operand" "")]))
2588 (clobber (match_operand:DI 4 "register_operand" ""))]
2589 "exact_log2 (INTVAL (operands[3]) + 1) >= 0
2590 && (GET_CODE (operands[1]) == GTU
2591 || GET_CODE (operands[1]) == LEU
2592 || ((GET_CODE (operands[1]) == GT || GET_CODE (operands[1]) == LE)
2593 && extended_count (operands[2], DImode, 1) > 0))"
2594 [(set (match_dup 4) (and:DI (match_dup 2) (match_dup 5)))
2595 (set (match_dup 0) (match_dup 6))]
2598 operands[5] = GEN_INT (~ INTVAL (operands[3]));
2599 operands[6] = gen_rtx (((GET_CODE (operands[1]) == GTU
2600 || GET_CODE (operands[1]) == GT)
2602 DImode, operands[4], const0_rtx);
2605 ;; Here are the CALL and unconditional branch insns. Calls on NT and OSF
2606 ;; work differently, so we have different patterns for each.
2608 (define_expand "call"
2609 [(use (match_operand:DI 0 "" ""))
2610 (use (match_operand 1 "" ""))]
2614 emit_call_insn (gen_call_nt (operands[0], operands[1]));
2616 emit_call_insn (gen_call_osf (operands[0], operands[1]));
2621 (define_expand "call_osf"
2622 [(parallel [(call (mem:DI (match_operand 0 "" ""))
2623 (match_operand 1 "" ""))
2624 (clobber (reg:DI 27))
2625 (clobber (reg:DI 26))])]
2628 { if (GET_CODE (operands[0]) != MEM)
2631 operands[0] = XEXP (operands[0], 0);
2633 if (GET_CODE (operands[0]) != SYMBOL_REF
2634 && ! (GET_CODE (operands[0]) == REG && REGNO (operands[0]) == 27))
2636 rtx tem = gen_rtx (REG, DImode, 27);
2637 emit_move_insn (tem, operands[0]);
2642 (define_expand "call_nt"
2643 [(parallel [(call (mem:DI (match_operand:DI 0 "" ""))
2644 (match_operand 1 "" ""))
2645 (clobber (reg:DI 26))])]
2648 { if (GET_CODE (operands[0]) != MEM)
2650 operands[0] = XEXP (operands[0], 0);
2652 if (GET_CODE (operands[0]) != SYMBOL_REF)
2653 operands[0] = force_reg (Pmode, operands[0]);
2656 (define_expand "call_value"
2657 [(use (match_operand 0 "" ""))
2658 (use (match_operand:DI 1 "" ""))
2659 (use (match_operand 2 "" ""))]
2663 emit_call_insn (gen_call_value_nt (operands[0], operands[1], operands[2]));
2665 emit_call_insn (gen_call_value_osf (operands[0], operands[1],
2670 (define_expand "call_value_osf"
2671 [(parallel [(set (match_operand 0 "" "")
2672 (call (mem:DI (match_operand 1 "" ""))
2673 (match_operand 2 "" "")))
2674 (clobber (reg:DI 27))
2675 (clobber (reg:DI 26))])]
2678 { if (GET_CODE (operands[1]) != MEM)
2681 operands[1] = XEXP (operands[1], 0);
2683 if (GET_CODE (operands[1]) != SYMBOL_REF
2684 && ! (GET_CODE (operands[1]) == REG && REGNO (operands[1]) == 27))
2686 rtx tem = gen_rtx (REG, DImode, 27);
2687 emit_move_insn (tem, operands[1]);
2692 (define_expand "call_value_nt"
2693 [(parallel [(set (match_operand 0 "" "")
2694 (call (mem:DI (match_operand:DI 1 "" ""))
2695 (match_operand 2 "" "")))
2696 (clobber (reg:DI 26))])]
2699 { if (GET_CODE (operands[1]) != MEM)
2702 operands[1] = XEXP (operands[1], 0);
2703 if (GET_CODE (operands[1]) != SYMBOL_REF)
2704 operands[1] = force_reg (Pmode, operands[1]);
2708 [(call (mem:DI (match_operand:DI 0 "call_operand" "r,R,i"))
2709 (match_operand 1 "" ""))
2710 (clobber (reg:DI 27))
2711 (clobber (reg:DI 26))]
2714 jsr $26,($27),0\;ldgp $29,0($26)
2716 jsr $26,%0\;ldgp $29,0($26)"
2717 [(set_attr "type" "jsr,jsr,ibr")])
2720 [(call (mem:DI (match_operand:DI 0 "call_operand" "r,i"))
2721 (match_operand 1 "" ""))
2722 (clobber (reg:DI 26))]
2727 [(set_attr "type" "jsr")])
2730 [(set (match_operand 0 "register_operand" "=rf,rf,rf")
2731 (call (mem:DI (match_operand:DI 1 "call_operand" "r,R,i"))
2732 (match_operand 2 "" "")))
2733 (clobber (reg:DI 27))
2734 (clobber (reg:DI 26))]
2737 jsr $26,($27),0\;ldgp $29,0($26)
2739 jsr $26,%1\;ldgp $29,0($26)"
2740 [(set_attr "type" "jsr,jsr,ibr")])
2743 [(set (match_operand 0 "register_operand" "=rf,rf")
2744 (call (mem:DI (match_operand:DI 1 "call_operand" "r,i"))
2745 (match_operand 2 "" "")))
2746 (clobber (reg:DI 26))]
2751 [(set_attr "type" "jsr")])
2753 ;; Call subroutine returning any type.
2755 (define_expand "untyped_call"
2756 [(parallel [(call (match_operand 0 "" "")
2758 (match_operand 1 "" "")
2759 (match_operand 2 "" "")])]
2765 emit_call_insn (gen_call (operands[0], const0_rtx, NULL, const0_rtx));
2767 for (i = 0; i < XVECLEN (operands[2], 0); i++)
2769 rtx set = XVECEXP (operands[2], 0, i);
2770 emit_move_insn (SET_DEST (set), SET_SRC (set));
2773 /* The optimizer does not know that the call sets the function value
2774 registers we stored in the result block. We avoid problems by
2775 claiming that all hard registers are used and clobbered at this
2777 emit_insn (gen_blockage ());
2782 ;; UNSPEC_VOLATILE is considered to use and clobber all hard registers and
2783 ;; all of memory. This blocks insns from being moved across this point.
2785 (define_insn "blockage"
2786 [(unspec_volatile [(const_int 0)] 1)]
2792 (label_ref (match_operand 0 "" "")))]
2795 [(set_attr "type" "ibr")])
2797 (define_insn "return"
2801 [(set_attr "type" "ibr")])
2803 (define_insn "indirect_jump"
2804 [(set (pc) (match_operand:DI 0 "register_operand" "r"))]
2807 [(set_attr "type" "ibr")])
2813 [(set_attr "type" "iaddlog")])
2815 (define_expand "tablejump"
2816 [(use (match_operand:SI 0 "register_operand" ""))
2817 (use (match_operand:SI 1 "" ""))]
2822 emit_jump_insn (gen_tablejump_nt (operands[0], operands[1]));
2824 emit_jump_insn (gen_tablejump_osf (operands[0], operands[1]));
2829 (define_expand "tablejump_osf"
2831 (sign_extend:DI (match_operand:SI 0 "register_operand" "")))
2832 (parallel [(set (pc)
2833 (plus:DI (match_dup 3)
2834 (label_ref:DI (match_operand 1 "" ""))))
2835 (clobber (match_scratch:DI 2 "=r"))])]
2838 { operands[3] = gen_reg_rtx (DImode); }")
2840 (define_expand "tablejump_nt"
2842 (sign_extend:DI (match_operand:SI 0 "register_operand" "")))
2843 (parallel [(set (pc)
2845 (use (label_ref (match_operand 1 "" "")))])]
2848 { operands[3] = gen_reg_rtx (DImode); }")
2852 (plus:DI (match_operand:DI 0 "register_operand" "r")
2853 (label_ref:DI (match_operand 1 "" ""))))
2854 (clobber (match_scratch:DI 2 "=r"))]
2855 "! WINDOWS_NT && next_active_insn (insn) != 0
2856 && GET_CODE (PATTERN (next_active_insn (insn))) == ADDR_DIFF_VEC
2857 && PREV_INSN (next_active_insn (insn)) == operands[1]"
2859 { rtx best_label = 0;
2860 rtx jump_table_insn = next_active_insn (operands[1]);
2862 if (GET_CODE (jump_table_insn) == JUMP_INSN
2863 && GET_CODE (PATTERN (jump_table_insn)) == ADDR_DIFF_VEC)
2865 rtx jump_table = PATTERN (jump_table_insn);
2866 int n_labels = XVECLEN (jump_table, 1);
2867 int best_count = -1;
2870 for (i = 0; i < n_labels; i++)
2874 for (j = i + 1; j < n_labels; j++)
2875 if (XEXP (XVECEXP (jump_table, 1, i), 0)
2876 == XEXP (XVECEXP (jump_table, 1, j), 0))
2879 if (count > best_count)
2880 best_count = count, best_label = XVECEXP (jump_table, 1, i);
2886 operands[3] = best_label;
2887 return \"addq %0,$29,%2\;jmp $31,(%2),%3\";
2890 return \"addq %0,$29,%2\;jmp $31,(%2),0\";
2892 [(set_attr "type" "ibr")])
2896 (match_operand:DI 0 "register_operand" "r"))
2897 (use (label_ref (match_operand 1 "" "")))]
2898 "WINDOWS_NT && next_active_insn (insn) != 0
2899 && GET_CODE (PATTERN (next_active_insn (insn))) == ADDR_DIFF_VEC
2900 && PREV_INSN (next_active_insn (insn)) == operands[1]"
2902 { rtx best_label = 0;
2903 rtx jump_table_insn = next_active_insn (operands[1]);
2905 if (GET_CODE (jump_table_insn) == JUMP_INSN
2906 && GET_CODE (PATTERN (jump_table_insn)) == ADDR_DIFF_VEC)
2908 rtx jump_table = PATTERN (jump_table_insn);
2909 int n_labels = XVECLEN (jump_table, 1);
2910 int best_count = -1;
2913 for (i = 0; i < n_labels; i++)
2917 for (j = i + 1; j < n_labels; j++)
2918 if (XEXP (XVECEXP (jump_table, 1, i), 0)
2919 == XEXP (XVECEXP (jump_table, 1, j), 0))
2922 if (count > best_count)
2923 best_count = count, best_label = XVECEXP (jump_table, 1, i);
2929 operands[2] = best_label;
2930 return \"jmp $31,(%0),%2\";
2933 return \"jmp $31,(%0),0\";
2935 [(set_attr "type" "ibr")])
2937 ;; Cache flush. Used by INITIALIZE_TRAMPOLINE. 0x86 is PAL_imb, but we don't
2938 ;; want to have to include pal.h in our .s file.
2940 [(unspec_volatile [(const_int 0)] 0)]
2944 ;; Finally, we have the basic data motion insns. The byte and word insns
2945 ;; are done via define_expand. Start with the floating-point insns, since
2946 ;; they are simpler.
2949 [(set (match_operand:SF 0 "nonimmediate_operand" "=r,r,m,f,f,f,m")
2950 (match_operand:SF 1 "input_operand" "rG,m,rG,f,G,m,fG"))]
2951 "register_operand (operands[0], SFmode)
2952 || reg_or_fp0_operand (operands[1], SFmode)"
2961 [(set_attr "type" "iaddlog,ld,st,fpop,fpop,ld,st")])
2964 [(set (match_operand:DF 0 "nonimmediate_operand" "=r,r,m,f,f,f,m")
2965 (match_operand:DF 1 "input_operand" "rG,m,rG,f,G,m,fG"))]
2966 "register_operand (operands[0], DFmode)
2967 || reg_or_fp0_operand (operands[1], DFmode)"
2976 [(set_attr "type" "iaddlog,ld,st,fpop,fpop,ld,st")])
2978 (define_expand "movsf"
2979 [(set (match_operand:SF 0 "nonimmediate_operand" "")
2980 (match_operand:SF 1 "general_operand" ""))]
2984 if (GET_CODE (operands[0]) == MEM
2985 && ! reg_or_fp0_operand (operands[1], SFmode))
2986 operands[1] = force_reg (SFmode, operands[1]);
2989 (define_expand "movdf"
2990 [(set (match_operand:DF 0 "nonimmediate_operand" "")
2991 (match_operand:DF 1 "general_operand" ""))]
2995 if (GET_CODE (operands[0]) == MEM
2996 && ! reg_or_fp0_operand (operands[1], DFmode))
2997 operands[1] = force_reg (DFmode, operands[1]);
3001 [(set (match_operand:SI 0 "nonimmediate_operand" "=r,r,r,r,r,r,m,f,f,f,m")
3002 (match_operand:SI 1 "input_operand" "r,J,I,K,L,m,rJ,f,J,m,fG"))]
3003 "! WINDOWS_NT && (register_operand (operands[0], SImode)
3004 || reg_or_0_operand (operands[1], SImode))"
3017 [(set_attr "type" "iaddlog,iaddlog,iaddlog,iaddlog,iaddlog,ld,st,fpop,fpop,ld,st")])
3020 [(set (match_operand:SI 0 "nonimmediate_operand" "=r,r,r,r,r,r,r,m,f,f,f,m")
3021 (match_operand:SI 1 "input_operand" "r,J,I,K,L,s,m,rJ,f,J,m,fG"))]
3022 "WINDOWS_NT && (register_operand (operands[0], SImode)
3023 || reg_or_0_operand (operands[1], SImode))"
3037 [(set_attr "type" "iaddlog,iaddlog,iaddlog,iaddlog,iaddlog,ldsym,ld,st,fpop,fpop,ld,st")])
3040 [(set (match_operand:HI 0 "nonimmediate_operand" "=r,r,r,r,f,f")
3041 (match_operand:HI 1 "input_operand" "r,J,I,n,f,J"))]
3042 "register_operand (operands[0], HImode)
3043 || register_operand (operands[1], HImode)"
3051 [(set_attr "type" "iaddlog,iaddlog,iaddlog,iaddlog,fpop,fpop")])
3054 [(set (match_operand:QI 0 "nonimmediate_operand" "=r,r,r,r,f,f")
3055 (match_operand:QI 1 "input_operand" "r,J,I,n,f,J"))]
3056 "register_operand (operands[0], QImode)
3057 || register_operand (operands[1], QImode)"
3065 [(set_attr "type" "iaddlog,iaddlog,iaddlog,iaddlog,fpop,fpop")])
3067 ;; We do two major things here: handle mem->mem and construct long
3070 (define_expand "movsi"
3071 [(set (match_operand:SI 0 "general_operand" "")
3072 (match_operand:SI 1 "general_operand" ""))]
3076 if (GET_CODE (operands[0]) == MEM
3077 && ! reg_or_0_operand (operands[1], SImode))
3078 operands[1] = force_reg (SImode, operands[1]);
3080 if (! CONSTANT_P (operands[1]) || input_operand (operands[1], SImode))
3082 else if (GET_CODE (operands[1]) == CONST_INT)
3085 = alpha_emit_set_const (operands[0], SImode, INTVAL (operands[1]), 3);
3086 if (rtx_equal_p (operands[0], operands[1]))
3091 ;; Split a load of a large constant into the appropriate two-insn
3095 [(set (match_operand:SI 0 "register_operand" "")
3096 (match_operand:SI 1 "const_int_operand" ""))]
3097 "! add_operand (operands[1], SImode)"
3098 [(set (match_dup 0) (match_dup 2))
3099 (set (match_dup 0) (plus:SI (match_dup 0) (match_dup 3)))]
3102 = alpha_emit_set_const (operands[0], SImode, INTVAL (operands[1]), 2);
3104 if (tem == operands[0])
3111 [(set (match_operand:DI 0 "general_operand" "=r,r,r,r,r,r,r,m,f,f,f,Q")
3112 (match_operand:DI 1 "input_operand" "r,J,I,K,L,s,m,rJ,f,J,Q,fG"))]
3113 "register_operand (operands[0], DImode)
3114 || reg_or_0_operand (operands[1], DImode)"
3128 [(set_attr "type" "iaddlog,iaddlog,iaddlog,iaddlog,iaddlog,ldsym,ld,st,fpop,fpop,ld,st")])
3130 ;; We do three major things here: handle mem->mem, put 64-bit constants in
3131 ;; memory, and construct long 32-bit constants.
3133 (define_expand "movdi"
3134 [(set (match_operand:DI 0 "general_operand" "")
3135 (match_operand:DI 1 "general_operand" ""))]
3141 if (GET_CODE (operands[0]) == MEM
3142 && ! reg_or_0_operand (operands[1], DImode))
3143 operands[1] = force_reg (DImode, operands[1]);
3145 if (! CONSTANT_P (operands[1]) || input_operand (operands[1], DImode))
3147 else if (GET_CODE (operands[1]) == CONST_INT
3148 && (tem = alpha_emit_set_const (operands[0], DImode,
3149 INTVAL (operands[1]), 3)) != 0)
3151 if (rtx_equal_p (tem, operands[0]))
3156 else if (CONSTANT_P (operands[1]))
3158 operands[1] = force_const_mem (DImode, operands[1]);
3159 if (reload_in_progress)
3161 emit_move_insn (operands[0], XEXP (operands[1], 0));
3162 XEXP (operands[1], 0) = operands[0];
3165 operands[1] = validize_mem (operands[1]);
3171 ;; Split a load of a large constant into the appropriate two-insn
3175 [(set (match_operand:DI 0 "register_operand" "")
3176 (match_operand:DI 1 "const_int_operand" ""))]
3177 "! add_operand (operands[1], DImode)"
3178 [(set (match_dup 0) (match_dup 2))
3179 (set (match_dup 0) (plus:DI (match_dup 0) (match_dup 3)))]
3182 = alpha_emit_set_const (operands[0], DImode, INTVAL (operands[1]), 2);
3184 if (tem == operands[0])
3190 ;; These are the partial-word cases.
3192 ;; First we have the code to load an aligned word. Operand 0 is the register
3193 ;; in which to place the result. It's mode is QImode or HImode. Operand 1
3194 ;; is an SImode MEM at the low-order byte of the proper word. Operand 2 is the
3195 ;; number of bits within the word that the value is. Operand 3 is an SImode
3196 ;; scratch register. If operand 0 is a hard register, operand 3 may be the
3197 ;; same register. It is allowed to conflict with operand 1 as well.
3199 (define_expand "aligned_loadqi"
3200 [(set (match_operand:SI 3 "register_operand" "")
3201 (match_operand:SI 1 "memory_operand" ""))
3202 (set (subreg:DI (match_operand:QI 0 "register_operand" "") 0)
3203 (zero_extract:DI (subreg:DI (match_dup 3) 0)
3205 (match_operand:DI 2 "const_int_operand" "")))]
3210 (define_expand "aligned_loadhi"
3211 [(set (match_operand:SI 3 "register_operand" "")
3212 (match_operand:SI 1 "memory_operand" ""))
3213 (set (subreg:DI (match_operand:HI 0 "register_operand" "") 0)
3214 (zero_extract:DI (subreg:DI (match_dup 3) 0)
3216 (match_operand:DI 2 "const_int_operand" "")))]
3221 ;; Similar for unaligned loads. For QImode, we use the sequence from the
3222 ;; Alpha Architecture manual. However, for HImode, we do not. HImode pointers
3223 ;; are normally aligned to the byte boundary, so an HImode object cannot
3224 ;; cross a longword boundary. We could use a sequence similar to that for
3225 ;; QImode, but that would fail if the pointer, was, in fact, not aligned.
3226 ;; Instead, we clear bit 1 in the address and do an ldl. If the low-order
3227 ;; bit was not aligned, this will trap and the trap handler will do what is
3230 ;; Here operand 1 is the address. Operands 2 and 3 are temporaries, where
3231 ;; operand 3 can overlap the input and output registers.
3233 (define_expand "unaligned_loadqi"
3234 [(set (match_operand:DI 2 "register_operand" "")
3235 (mem:DI (and:DI (match_operand:DI 1 "address_operand" "")
3237 (set (match_operand:DI 3 "register_operand" "")
3239 (set (subreg:DI (match_operand:QI 0 "register_operand" "") 0)
3240 (zero_extract:DI (match_dup 2)
3242 (ashift:DI (match_dup 3) (const_int 3))))]
3246 ;; For this, the address must already be in a register. We also need two
3247 ;; DImode temporaries, neither of which may overlap the input (and hence the
3248 ;; output, since they might be the same register), but both of which may
3251 (define_expand "unaligned_loadhi"
3252 [(set (match_operand:DI 2 "register_operand" "")
3253 (and:DI (match_operand:DI 1 "register_operand" "")
3255 (set (match_operand:DI 3 "register_operand" "")
3256 (mem:DI (match_dup 2)))
3257 (set (match_operand:DI 4 "register_operand" "")
3258 (and:DI (match_dup 1) (const_int -2)))
3259 (set (subreg:DI (match_operand:HI 0 "register_operand" "") 0)
3260 (zero_extract:DI (match_dup 3)
3262 (ashift:DI (match_dup 4) (const_int 3))))]
3266 ;; Storing an aligned byte or word requires two temporaries. Operand 0 is the
3267 ;; aligned SImode MEM. Operand 1 is the register containing the
3268 ;; byte or word to store. Operand 2 is the number of bits within the word that
3269 ;; the value should be placed. Operands 3 and 4 are SImode temporaries.
3271 (define_expand "aligned_store"
3272 [(set (match_operand:SI 3 "register_operand" "")
3273 (match_operand:SI 0 "memory_operand" ""))
3274 (set (subreg:DI (match_dup 3) 0)
3275 (and:DI (subreg:DI (match_dup 3) 0) (match_dup 5)))
3276 (set (subreg:DI (match_operand:SI 4 "register_operand" "") 0)
3277 (ashift:DI (zero_extend:DI (match_operand 1 "register_operand" ""))
3278 (match_operand:DI 2 "const_int_operand" "")))
3279 (set (subreg:DI (match_dup 4) 0)
3280 (ior:DI (subreg:DI (match_dup 4) 0) (subreg:DI (match_dup 3) 0)))
3281 (set (match_dup 0) (match_dup 4))]
3284 { operands[5] = GEN_INT (~ (GET_MODE_MASK (GET_MODE (operands[1]))
3285 << INTVAL (operands[2])));
3288 ;; For the unaligned byte case, we use code similar to that in the
3289 ;; Architecture book, but reordered to lower the number of registers
3290 ;; required. Operand 0 is the address. Operand 1 is the data to store.
3291 ;; Operands 2, 3, and 4 are DImode temporaries, where operands 2 and 4 may
3292 ;; be the same temporary, if desired. If the address is in a register,
3293 ;; operand 2 can be that register.
3295 (define_expand "unaligned_storeqi"
3296 [(set (match_operand:DI 3 "register_operand" "")
3297 (mem:DI (and:DI (match_operand:DI 0 "address_operand" "")
3299 (set (match_operand:DI 2 "register_operand" "")
3302 (and:DI (not:DI (ashift:DI (const_int 255)
3303 (ashift:DI (match_dup 2) (const_int 3))))
3305 (set (match_operand:DI 4 "register_operand" "")
3306 (ashift:DI (zero_extend:DI (match_operand:QI 1 "register_operand" ""))
3307 (ashift:DI (match_dup 2) (const_int 3))))
3308 (set (match_dup 4) (ior:DI (match_dup 4) (match_dup 3)))
3309 (set (mem:DI (and:DI (match_dup 0) (const_int -8)))
3314 ;; This is the code for storing into an unaligned short. It uses the same
3315 ;; trick as loading from an unaligned short. It needs lots of temporaries.
3316 ;; However, during reload, we only have two registers available. So we
3317 ;; repeat code so that only two temporaries are available. During RTL
3318 ;; generation, we can use different pseudos for each temporary and CSE
3319 ;; will remove the redundancies. During reload, we have to settle with
3320 ;; what we get. Luckily, unaligned accesses of this kind produced during
3321 ;; reload are quite rare.
3323 ;; Operand 0 is the address of the memory location. Operand 1 contains the
3324 ;; data to store. The rest of the operands are all temporaries, with
3325 ;; various overlap possibilities during reload. See reload_outhi for
3326 ;; details of this use.
3328 (define_expand "unaligned_storehi"
3329 [(set (match_operand:DI 2 "register_operand" "")
3330 (match_operand:DI 0 "address_operand" ""))
3331 (set (match_operand:DI 3 "register_operand" "")
3332 (and:DI (match_dup 2) (const_int -7)))
3333 (set (match_operand:DI 4 "register_operand" "")
3334 (mem:DI (match_dup 3)))
3335 (set (match_operand:DI 10 "register_operand" "")
3336 (and:DI (match_dup 2) (const_int -2)))
3337 (set (match_operand:DI 5 "register_operand" "")
3338 (and:DI (not:DI (ashift:DI (const_int 65535)
3339 (ashift:DI (match_dup 10) (const_int 3))))
3341 (set (match_operand:DI 6 "register_operand" "")
3342 (ashift:DI (zero_extend:DI (match_operand:HI 1 "register_operand" ""))
3343 (ashift:DI (match_dup 10) (const_int 3))))
3344 (set (match_operand:DI 7 "register_operand" "")
3345 (ior:DI (match_dup 5) (match_dup 6)))
3346 (set (match_operand:DI 8 "register_operand" "") (match_dup 0))
3347 (set (match_operand:DI 9 "register_operand" "")
3348 (and:DI (match_dup 8) (const_int -7)))
3349 (set (mem:DI (match_dup 9)) (match_dup 7))]
3353 ;; Here are the define_expand's for QI and HI moves that use the above
3354 ;; patterns. We have the normal sets, plus the ones that need scratch
3355 ;; registers for reload.
3357 (define_expand "movqi"
3358 [(set (match_operand:QI 0 "general_operand" "")
3359 (match_operand:QI 1 "general_operand" ""))]
3362 { extern rtx get_unaligned_address ();
3364 /* If the output is not a register, the input must be. */
3365 if (GET_CODE (operands[0]) == MEM)
3366 operands[1] = force_reg (QImode, operands[1]);
3368 /* Handle four memory cases, unaligned and aligned for either the input
3369 or the output. The only case where we can be called during reload is
3370 for aligned loads; all other cases require temporaries. */
3372 if (GET_CODE (operands[1]) == MEM
3373 || (GET_CODE (operands[1]) == SUBREG
3374 && GET_CODE (SUBREG_REG (operands[1])) == MEM)
3375 || (reload_in_progress && GET_CODE (operands[1]) == REG
3376 && REGNO (operands[1]) >= FIRST_PSEUDO_REGISTER)
3377 || (reload_in_progress && GET_CODE (operands[1]) == SUBREG
3378 && GET_CODE (SUBREG_REG (operands[1])) == REG
3379 && REGNO (SUBREG_REG (operands[1])) >= FIRST_PSEUDO_REGISTER))
3381 if (aligned_memory_operand (operands[1], QImode))
3383 rtx aligned_mem, bitnum;
3384 rtx scratch = (reload_in_progress
3385 ? gen_rtx (REG, SImode, REGNO (operands[0]))
3386 : gen_reg_rtx (SImode));
3388 get_aligned_mem (operands[1], &aligned_mem, &bitnum);
3390 emit_insn (gen_aligned_loadqi (operands[0], aligned_mem, bitnum,
3395 /* Don't pass these as parameters since that makes the generated
3396 code depend on parameter evaluation order which will cause
3397 bootstrap failures. */
3399 rtx temp1 = gen_reg_rtx (DImode);
3400 rtx temp2 = gen_reg_rtx (DImode);
3401 rtx seq = gen_unaligned_loadqi (operands[0],
3402 get_unaligned_address (operands[1]),
3405 alpha_set_memflags (seq, operands[1]);
3412 else if (GET_CODE (operands[0]) == MEM
3413 || (GET_CODE (operands[0]) == SUBREG
3414 && GET_CODE (SUBREG_REG (operands[0])) == MEM)
3415 || (reload_in_progress && GET_CODE (operands[0]) == REG
3416 && REGNO (operands[0]) >= FIRST_PSEUDO_REGISTER)
3417 || (reload_in_progress && GET_CODE (operands[0]) == SUBREG
3418 && GET_CODE (SUBREG_REG (operands[0])) == REG
3419 && REGNO (operands[0]) >= FIRST_PSEUDO_REGISTER))
3421 if (aligned_memory_operand (operands[0], QImode))
3423 rtx aligned_mem, bitnum;
3424 rtx temp1 = gen_reg_rtx (SImode);
3425 rtx temp2 = gen_reg_rtx (SImode);
3427 get_aligned_mem (operands[0], &aligned_mem, &bitnum);
3429 emit_insn (gen_aligned_store (aligned_mem, operands[1], bitnum,
3434 rtx temp1 = gen_reg_rtx (DImode);
3435 rtx temp2 = gen_reg_rtx (DImode);
3436 rtx temp3 = gen_reg_rtx (DImode);
3437 rtx seq = gen_unaligned_storeqi (get_unaligned_address (operands[0]),
3438 operands[1], temp1, temp2, temp3);
3440 alpha_set_memflags (seq, operands[0]);
3447 (define_expand "movhi"
3448 [(set (match_operand:HI 0 "general_operand" "")
3449 (match_operand:HI 1 "general_operand" ""))]
3452 { extern rtx get_unaligned_address ();
3454 /* If the output is not a register, the input must be. */
3455 if (GET_CODE (operands[0]) == MEM)
3456 operands[1] = force_reg (HImode, operands[1]);
3458 /* Handle four memory cases, unaligned and aligned for either the input
3459 or the output. The only case where we can be called during reload is
3460 for aligned loads; all other cases require temporaries. */
3462 if (GET_CODE (operands[1]) == MEM
3463 || (GET_CODE (operands[1]) == SUBREG
3464 && GET_CODE (SUBREG_REG (operands[1])) == MEM)
3465 || (reload_in_progress && GET_CODE (operands[1]) == REG
3466 && REGNO (operands[1]) >= FIRST_PSEUDO_REGISTER)
3467 || (reload_in_progress && GET_CODE (operands[1]) == SUBREG
3468 && GET_CODE (SUBREG_REG (operands[1])) == REG
3469 && REGNO (SUBREG_REG (operands[1])) >= FIRST_PSEUDO_REGISTER))
3471 if (aligned_memory_operand (operands[1], HImode))
3473 rtx aligned_mem, bitnum;
3474 rtx scratch = (reload_in_progress
3475 ? gen_rtx (REG, SImode, REGNO (operands[0]))
3476 : gen_reg_rtx (SImode));
3478 get_aligned_mem (operands[1], &aligned_mem, &bitnum);
3480 emit_insn (gen_aligned_loadhi (operands[0], aligned_mem, bitnum,
3486 = force_reg (DImode,
3487 force_operand (get_unaligned_address (operands[1]),
3489 rtx scratch1 = gen_reg_rtx (DImode);
3490 rtx scratch2 = gen_reg_rtx (DImode);
3491 rtx scratch3 = gen_reg_rtx (DImode);
3493 rtx seq = gen_unaligned_loadhi (operands[0], addr, scratch1,
3494 scratch2, scratch3);
3496 alpha_set_memflags (seq, operands[1]);
3503 else if (GET_CODE (operands[0]) == MEM
3504 || (GET_CODE (operands[0]) == SUBREG
3505 && GET_CODE (SUBREG_REG (operands[0])) == MEM)
3506 || (reload_in_progress && GET_CODE (operands[0]) == REG
3507 && REGNO (operands[0]) >= FIRST_PSEUDO_REGISTER)
3508 || (reload_in_progress && GET_CODE (operands[0]) == SUBREG
3509 && GET_CODE (SUBREG_REG (operands[0])) == REG
3510 && REGNO (operands[0]) >= FIRST_PSEUDO_REGISTER))
3512 if (aligned_memory_operand (operands[0], HImode))
3514 rtx aligned_mem, bitnum;
3515 rtx temp1 = gen_reg_rtx (SImode);
3516 rtx temp2 = gen_reg_rtx (SImode);
3518 get_aligned_mem (operands[0], &aligned_mem, &bitnum);
3520 emit_insn (gen_aligned_store (aligned_mem, operands[1], bitnum,
3525 rtx temp1 = gen_reg_rtx (DImode);
3526 rtx temp2 = gen_reg_rtx (DImode);
3527 rtx temp3 = gen_reg_rtx (DImode);
3528 rtx temp4 = gen_reg_rtx (DImode);
3529 rtx temp5 = gen_reg_rtx (DImode);
3530 rtx temp6 = gen_reg_rtx (DImode);
3531 rtx temp7 = gen_reg_rtx (DImode);
3532 rtx temp8 = gen_reg_rtx (DImode);
3533 rtx temp9 = gen_reg_rtx (DImode);
3535 rtx seq = gen_unaligned_storehi (get_unaligned_address (operands[0]),
3536 operands[1], temp1, temp2,temp3,
3537 temp4, temp5, temp6,temp7,
3540 alpha_set_memflags (seq, operands[0]);
3548 ;; Here are the versions for reload. Note that in the unaligned cases
3549 ;; we know that the operand must not be a pseudo-register because stack
3550 ;; slots are always aligned references.
3552 (define_expand "reload_inqi"
3553 [(parallel [(match_operand:QI 0 "register_operand" "=r")
3554 (match_operand:QI 1 "unaligned_memory_operand" "m")
3555 (match_operand:TI 2 "register_operand" "=&r")])]
3558 { extern rtx get_unaligned_address ();
3559 rtx addr = get_unaligned_address (operands[1]);
3560 /* It is possible that one of the registers we got for operands[2]
3561 might coincide with that of operands[0] (which is why we made
3562 it TImode). Pick the other one to use as our scratch. */
3563 rtx scratch = gen_rtx (REG, DImode,
3564 REGNO (operands[0]) == REGNO (operands[2])
3565 ? REGNO (operands[2]) + 1 : REGNO (operands[2]));
3566 rtx seq = gen_unaligned_loadqi (operands[0], addr, scratch,
3567 gen_rtx (REG, DImode, REGNO (operands[0])));
3569 alpha_set_memflags (seq, operands[1]);
3574 (define_expand "reload_inhi"
3575 [(parallel [(match_operand:HI 0 "register_operand" "=r")
3576 (match_operand:HI 1 "unaligned_memory_operand" "m")
3577 (match_operand:TI 2 "register_operand" "=&r")])]
3580 { extern rtx get_unaligned_address ();
3581 rtx addr = get_unaligned_address (operands[1]);
3582 rtx scratch1 = gen_rtx (REG, DImode, REGNO (operands[2]));
3583 rtx scratch2 = gen_rtx (REG, DImode, REGNO (operands[2]) + 1);
3586 if (GET_CODE (addr) != REG)
3588 emit_insn (gen_rtx (SET, VOIDmode, scratch2, addr));
3592 seq = gen_unaligned_loadhi (operands[0], addr, scratch1, scratch1, scratch2);
3593 alpha_set_memflags (seq, operands[1]);
3598 (define_expand "reload_outqi"
3599 [(parallel [(match_operand:QI 0 "any_memory_operand" "=m")
3600 (match_operand:QI 1 "register_operand" "r")
3601 (match_operand:TI 2 "register_operand" "=&r")])]
3604 { extern rtx get_unaligned_address ();
3606 if (aligned_memory_operand (operands[0], QImode))
3608 rtx aligned_mem, bitnum;
3610 get_aligned_mem (operands[0], &aligned_mem, &bitnum);
3612 emit_insn (gen_aligned_store (aligned_mem, operands[1], bitnum,
3613 gen_rtx (REG, SImode, REGNO (operands[2])),
3614 gen_rtx (REG, SImode,
3615 REGNO (operands[2]) + 1)));
3619 rtx addr = get_unaligned_address (operands[0]);
3620 rtx scratch1 = gen_rtx (REG, DImode, REGNO (operands[2]));
3621 rtx scratch2 = gen_rtx (REG, DImode, REGNO (operands[2]) + 1);
3622 rtx scratch3 = scratch1;
3625 if (GET_CODE (addr) == REG)
3628 seq = gen_unaligned_storeqi (addr, operands[1], scratch1,
3629 scratch2, scratch3);
3630 alpha_set_memflags (seq, operands[0]);
3637 (define_expand "reload_outhi"
3638 [(parallel [(match_operand:HI 0 "any_memory_operand" "=m")
3639 (match_operand:HI 1 "register_operand" "r")
3640 (match_operand:TI 2 "register_operand" "=&r")])]
3643 { extern rtx get_unaligned_address ();
3645 if (aligned_memory_operand (operands[0], HImode))
3647 rtx aligned_mem, bitnum;
3649 get_aligned_mem (operands[0], &aligned_mem, &bitnum);
3651 emit_insn (gen_aligned_store (aligned_mem, operands[1], bitnum,
3652 gen_rtx (REG, SImode, REGNO (operands[2])),
3653 gen_rtx (REG, SImode,
3654 REGNO (operands[2]) + 1)));
3658 rtx addr = get_unaligned_address (operands[0]);
3659 rtx scratch1 = gen_rtx (REG, DImode, REGNO (operands[2]));
3660 rtx scratch2 = gen_rtx (REG, DImode, REGNO (operands[2]) + 1);
3661 rtx scratch_a = GET_CODE (addr) == REG ? addr : scratch1;
3664 seq = gen_unaligned_storehi (addr, operands[1], scratch_a,
3665 scratch2, scratch2, scratch2,
3666 scratch1, scratch2, scratch_a,
3667 scratch1, scratch_a);
3668 alpha_set_memflags (seq, operands[0]);
3675 ;; Subroutine of stack space allocation. Perform a stack probe.
3676 (define_expand "probe_stack"
3677 [(set (match_dup 1) (match_operand:DI 0 "const_int_operand" ""))]
3681 operands[1] = gen_rtx (MEM, DImode, plus_constant (stack_pointer_rtx,
3682 INTVAL (operands[0])));
3683 MEM_VOLATILE_P (operands[1]) = 1;
3685 operands[0] = const0_rtx;
3688 ;; This is how we allocate stack space. If we are allocating a
3689 ;; constant amount of space and we know it is less than 4096
3690 ;; bytes, we need do nothing.
3692 ;; If it is more than 4096 bytes, we need to probe the stack
3694 (define_expand "allocate_stack"
3696 (plus:DI (reg:DI 30)
3697 (match_operand:DI 0 "reg_or_cint_operand" "")))]
3701 if (GET_CODE (operands[0]) == CONST_INT
3702 && INTVAL (operands[0]) < 32768)
3704 if (INTVAL (operands[0]) >= 4096)
3706 /* We do this the same way as in the prologue and generate explicit
3707 probes. Then we update the stack by the constant. */
3711 emit_insn (gen_probe_stack (GEN_INT (- probed)));
3712 while (probed + 8192 < INTVAL (operands[0]))
3713 emit_insn (gen_probe_stack (GEN_INT (- (probed += 8192))));
3715 if (probed + 4096 < INTVAL (operands[0]))
3716 emit_insn (gen_probe_stack (GEN_INT (- INTVAL(operands[0]))));
3719 operands[0] = GEN_INT (- INTVAL (operands[0]));
3724 rtx loop_label = gen_label_rtx ();
3725 rtx want = gen_reg_rtx (Pmode);
3726 rtx tmp = gen_reg_rtx (Pmode);
3729 emit_insn (gen_subdi3 (want, stack_pointer_rtx,
3730 force_reg (Pmode, operands[0])));
3731 emit_insn (gen_adddi3 (tmp, stack_pointer_rtx, GEN_INT (-4096)));
3733 if (GET_CODE (operands[0]) != CONST_INT)
3735 out_label = gen_label_rtx ();
3736 emit_insn (gen_cmpdi (want, tmp));
3737 emit_jump_insn (gen_bgeu (out_label));
3740 emit_label (loop_label);
3741 memref = gen_rtx (MEM, DImode, tmp);
3742 MEM_VOLATILE_P (memref) = 1;
3743 emit_move_insn (memref, const0_rtx);
3744 emit_insn (gen_adddi3 (tmp, tmp, GEN_INT(-8192)));
3745 emit_insn (gen_cmpdi (tmp, want));
3746 emit_jump_insn (gen_bgtu (loop_label));
3747 memref = gen_rtx (MEM, DImode, want);
3748 MEM_VOLATILE_P (memref) = 1;
3749 emit_move_insn (memref, const0_rtx);
3752 emit_label (out_label);
3754 emit_move_insn (stack_pointer_rtx, want);