alpha.c (alpha_next_sequence_number): New.
[gcc.git] / gcc / config / alpha / alpha.md
1 ;; Machine description for DEC Alpha for GNU C compiler
2 ;; Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
3 ;; 2000, 2001 Free Software Foundation, Inc.
4 ;; Contributed by Richard Kenner (kenner@vlsi1.ultra.nyu.edu)
5 ;;
6 ;; This file is part of GNU CC.
7 ;;
8 ;; GNU CC is free software; you can redistribute it and/or modify
9 ;; it under the terms of the GNU General Public License as published by
10 ;; the Free Software Foundation; either version 2, or (at your option)
11 ;; any later version.
12 ;;
13 ;; GNU CC is distributed in the hope that it will be useful,
14 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
15 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 ;; GNU General Public License for more details.
17 ;;
18 ;; You should have received a copy of the GNU General Public License
19 ;; along with GNU CC; see the file COPYING. If not, write to
20 ;; the Free Software Foundation, 59 Temple Place - Suite 330,
21 ;; Boston, MA 02111-1307, USA.
22
23 ;;- See file "rtl.def" for documentation on define_insn, match_*, et. al.
24
25 ;; Uses of UNSPEC in this file:
26
27 (define_constants
28 [(UNSPEC_ARG_HOME 0)
29 (UNSPEC_CTTZ 1)
30 (UNSPEC_INSXH 2)
31 (UNSPEC_MSKXH 3)
32 (UNSPEC_CVTQL 4)
33 (UNSPEC_NT_LDA 5)
34 ])
35
36 ;; UNSPEC_VOLATILE:
37
38 (define_constants
39 [(UNSPECV_IMB 0)
40 (UNSPECV_BLOCKAGE 1)
41 (UNSPECV_SETJMPR 2) ; builtin_setjmp_receiver
42 (UNSPECV_LONGJMP 3) ; builtin_longjmp
43 (UNSPECV_TRAPB 4)
44 (UNSPECV_PSPL 5) ; prologue_stack_probe_loop
45 (UNSPECV_REALIGN 6)
46 (UNSPECV_EHR 7) ; exception_receiver
47 (UNSPECV_MCOUNT 8)
48 (UNSPECV_LDGP1 9)
49 (UNSPECV_LDGP2 10)
50 (UNSPECV_FORCE_MOV 11)
51 ])
52 \f
53 ;; Processor type -- this attribute must exactly match the processor_type
54 ;; enumeration in alpha.h.
55
56 (define_attr "cpu" "ev4,ev5,ev6"
57 (const (symbol_ref "alpha_cpu")))
58
59 ;; Define an insn type attribute. This is used in function unit delay
60 ;; computations, among other purposes. For the most part, we use the names
61 ;; defined in the EV4 documentation, but add a few that we have to know about
62 ;; separately.
63
64 (define_attr "type"
65 "ild,fld,ldsym,ist,fst,ibr,fbr,jsr,iadd,ilog,shift,icmov,fcmov,icmp,imul,\
66 fadd,fmul,fcpys,fdiv,fsqrt,misc,mvi,ftoi,itof,multi"
67 (const_string "iadd"))
68
69 ;; Describe a user's asm statement.
70 (define_asm_attributes
71 [(set_attr "type" "multi")])
72
73 ;; Define the operand size an insn operates on. Used primarily by mul
74 ;; and div operations that have size dependant timings.
75
76 (define_attr "opsize" "si,di,udi"
77 (const_string "di"))
78
79 ;; The TRAP attribute marks instructions that may generate traps
80 ;; (which are imprecise and may need a trapb if software completion
81 ;; is desired).
82
83 (define_attr "trap" "no,yes"
84 (const_string "no"))
85
86 ;; The ROUND_SUFFIX attribute marks which instructions require a
87 ;; rounding-mode suffix. The value NONE indicates no suffix,
88 ;; the value NORMAL indicates a suffix controled by alpha_fprm.
89
90 (define_attr "round_suffix" "none,normal,c"
91 (const_string "none"))
92
93 ;; The TRAP_SUFFIX attribute marks instructions requiring a trap-mode suffix:
94 ;; NONE no suffix
95 ;; SU accepts only /su (cmpt et al)
96 ;; SUI accepts only /sui (cvtqt and cvtqs)
97 ;; V_SV accepts /v and /sv (cvtql only)
98 ;; V_SV_SVI accepts /v, /sv and /svi (cvttq only)
99 ;; U_SU_SUI accepts /u, /su and /sui (most fp instructions)
100 ;;
101 ;; The actual suffix emitted is controled by alpha_fptm.
102
103 (define_attr "trap_suffix" "none,su,sui,v_sv,v_sv_svi,u_su_sui"
104 (const_string "none"))
105
106 ;; The length of an instruction sequence in bytes.
107
108 (define_attr "length" ""
109 (const_int 4))
110 \f
111 ;; On EV4 there are two classes of resources to consider: resources needed
112 ;; to issue, and resources needed to execute. IBUS[01] are in the first
113 ;; category. ABOX, BBOX, EBOX, FBOX, IMUL & FDIV make up the second.
114 ;; (There are a few other register-like resources, but ...)
115
116 ; First, describe all of the issue constraints with single cycle delays.
117 ; All insns need a bus, but all except loads require one or the other.
118 (define_function_unit "ev4_ibus0" 1 0
119 (and (eq_attr "cpu" "ev4")
120 (eq_attr "type" "fst,fbr,iadd,imul,ilog,shift,icmov,icmp"))
121 1 1)
122
123 (define_function_unit "ev4_ibus1" 1 0
124 (and (eq_attr "cpu" "ev4")
125 (eq_attr "type" "ist,ibr,jsr,fadd,fcmov,fcpys,fmul,fdiv,misc"))
126 1 1)
127
128 ; Memory delivers its result in three cycles. Actually return one and
129 ; take care of this in adjust_cost, since we want to handle user-defined
130 ; memory latencies.
131 (define_function_unit "ev4_abox" 1 0
132 (and (eq_attr "cpu" "ev4")
133 (eq_attr "type" "ild,fld,ldsym,ist,fst"))
134 1 1)
135
136 ; Branches have no delay cost, but do tie up the unit for two cycles.
137 (define_function_unit "ev4_bbox" 1 1
138 (and (eq_attr "cpu" "ev4")
139 (eq_attr "type" "ibr,fbr,jsr"))
140 2 2)
141
142 ; Arithmetic insns are normally have their results available after
143 ; two cycles. There are a number of exceptions. They are encoded in
144 ; ADJUST_COST. Some of the other insns have similar exceptions.
145 (define_function_unit "ev4_ebox" 1 0
146 (and (eq_attr "cpu" "ev4")
147 (eq_attr "type" "iadd,ilog,shift,icmov,icmp,misc"))
148 2 1)
149
150 (define_function_unit "imul" 1 0
151 (and (eq_attr "cpu" "ev4")
152 (and (eq_attr "type" "imul")
153 (eq_attr "opsize" "si")))
154 21 19)
155
156 (define_function_unit "imul" 1 0
157 (and (eq_attr "cpu" "ev4")
158 (and (eq_attr "type" "imul")
159 (eq_attr "opsize" "!si")))
160 23 21)
161
162 (define_function_unit "ev4_fbox" 1 0
163 (and (eq_attr "cpu" "ev4")
164 (eq_attr "type" "fadd,fmul,fcpys,fcmov"))
165 6 1)
166
167 (define_function_unit "fdiv" 1 0
168 (and (eq_attr "cpu" "ev4")
169 (and (eq_attr "type" "fdiv")
170 (eq_attr "opsize" "si")))
171 34 30)
172
173 (define_function_unit "fdiv" 1 0
174 (and (eq_attr "cpu" "ev4")
175 (and (eq_attr "type" "fdiv")
176 (eq_attr "opsize" "di")))
177 63 59)
178 \f
179 ;; EV5 scheduling. EV5 can issue 4 insns per clock.
180 ;;
181 ;; EV5 has two asymetric integer units. Model this with E0 & E1 along
182 ;; with the combined resource EBOX.
183
184 (define_function_unit "ev5_ebox" 2 0
185 (and (eq_attr "cpu" "ev5")
186 (eq_attr "type" "!fbr,fcmov,fadd,fmul,fcpys,fdiv"))
187 1 1)
188
189 ; Memory takes at least 2 clocks. Return one from here and fix up with
190 ; user-defined latencies in adjust_cost.
191 (define_function_unit "ev5_ebox" 2 0
192 (and (eq_attr "cpu" "ev5")
193 (eq_attr "type" "ild,fld,ldsym"))
194 1 1)
195
196 ; Loads can dual issue with one another, but loads and stores do not mix.
197 (define_function_unit "ev5_e0" 1 0
198 (and (eq_attr "cpu" "ev5")
199 (eq_attr "type" "ild,fld,ldsym"))
200 1 1
201 [(eq_attr "type" "ist,fst")])
202
203 ; Stores, shifts, multiplies can only issue to E0
204 (define_function_unit "ev5_e0" 1 0
205 (and (eq_attr "cpu" "ev5")
206 (eq_attr "type" "ist,fst,shift,imul"))
207 1 1)
208
209 ; Motion video insns also issue only to E0, and take two ticks.
210 (define_function_unit "ev5_e0" 1 0
211 (and (eq_attr "cpu" "ev5")
212 (eq_attr "type" "mvi"))
213 2 1)
214
215 ; Conditional moves always take 2 ticks.
216 (define_function_unit "ev5_ebox" 2 0
217 (and (eq_attr "cpu" "ev5")
218 (eq_attr "type" "icmov"))
219 2 1)
220
221 ; Branches can only issue to E1
222 (define_function_unit "ev5_e1" 1 0
223 (and (eq_attr "cpu" "ev5")
224 (eq_attr "type" "ibr,jsr"))
225 1 1)
226
227 ; Multiplies also use the integer multiplier.
228 ; ??? How to: "No instruction can be issued to pipe E0 exactly two
229 ; cycles before an integer multiplication completes."
230 (define_function_unit "imul" 1 0
231 (and (eq_attr "cpu" "ev5")
232 (and (eq_attr "type" "imul")
233 (eq_attr "opsize" "si")))
234 8 4)
235
236 (define_function_unit "imul" 1 0
237 (and (eq_attr "cpu" "ev5")
238 (and (eq_attr "type" "imul")
239 (eq_attr "opsize" "di")))
240 12 8)
241
242 (define_function_unit "imul" 1 0
243 (and (eq_attr "cpu" "ev5")
244 (and (eq_attr "type" "imul")
245 (eq_attr "opsize" "udi")))
246 14 8)
247
248 ;; Similarly for the FPU we have two asymetric units. But fcpys can issue
249 ;; on either so we have to play the game again.
250
251 (define_function_unit "ev5_fbox" 2 0
252 (and (eq_attr "cpu" "ev5")
253 (eq_attr "type" "fadd,fcmov,fmul,fcpys,fbr,fdiv"))
254 4 1)
255
256 (define_function_unit "ev5_fm" 1 0
257 (and (eq_attr "cpu" "ev5")
258 (eq_attr "type" "fmul"))
259 4 1)
260
261 ; Add and cmov as you would expect; fbr never produces a result;
262 ; fdiv issues through fa to the divider,
263 (define_function_unit "ev5_fa" 1 0
264 (and (eq_attr "cpu" "ev5")
265 (eq_attr "type" "fadd,fcmov,fbr,fdiv"))
266 4 1)
267
268 ; ??? How to: "No instruction can be issued to pipe FA exactly five
269 ; cycles before a floating point divide completes."
270 (define_function_unit "fdiv" 1 0
271 (and (eq_attr "cpu" "ev5")
272 (and (eq_attr "type" "fdiv")
273 (eq_attr "opsize" "si")))
274 15 15) ; 15 to 31 data dependant
275
276 (define_function_unit "fdiv" 1 0
277 (and (eq_attr "cpu" "ev5")
278 (and (eq_attr "type" "fdiv")
279 (eq_attr "opsize" "di")))
280 22 22) ; 22 to 60 data dependant
281 \f
282 ;; EV6 scheduling. EV6 can issue 4 insns per clock.
283 ;;
284 ;; EV6 has two symmetric pairs ("clusters") of two asymetric integer units
285 ;; ("upper" and "lower"), yielding pipe names U0, U1, L0, L1.
286
287 ;; Conditional moves decompose into two independant primitives, each
288 ;; taking one cycle. Since ev6 is out-of-order, we can't see anything
289 ;; but two cycles.
290 (define_function_unit "ev6_ebox" 4 0
291 (and (eq_attr "cpu" "ev6")
292 (eq_attr "type" "icmov"))
293 2 1)
294
295 (define_function_unit "ev6_ebox" 4 0
296 (and (eq_attr "cpu" "ev6")
297 (eq_attr "type" "!fbr,fcmov,fadd,fmul,fcpys,fdiv,fsqrt"))
298 1 1)
299
300 ;; Integer loads take at least 3 clocks, and only issue to lower units.
301 ;; Return one from here and fix up with user-defined latencies in adjust_cost.
302 (define_function_unit "ev6_l" 2 0
303 (and (eq_attr "cpu" "ev6")
304 (eq_attr "type" "ild,ldsym,ist,fst"))
305 1 1)
306
307 ;; FP loads take at least 4 clocks. Return two from here...
308 (define_function_unit "ev6_l" 2 0
309 (and (eq_attr "cpu" "ev6")
310 (eq_attr "type" "fld"))
311 2 1)
312
313 ;; Motion video insns also issue only to U0, and take three ticks.
314 (define_function_unit "ev6_u0" 1 0
315 (and (eq_attr "cpu" "ev6")
316 (eq_attr "type" "mvi"))
317 3 1)
318
319 (define_function_unit "ev6_u" 2 0
320 (and (eq_attr "cpu" "ev6")
321 (eq_attr "type" "mvi"))
322 3 1)
323
324 ;; Shifts issue to either upper pipe.
325 (define_function_unit "ev6_u" 2 0
326 (and (eq_attr "cpu" "ev6")
327 (eq_attr "type" "shift"))
328 1 1)
329
330 ;; Multiplies issue only to U1, and all take 7 ticks.
331 ;; Rather than create a new function unit just for U1, reuse IMUL
332 (define_function_unit "imul" 1 0
333 (and (eq_attr "cpu" "ev6")
334 (eq_attr "type" "imul"))
335 7 1)
336
337 (define_function_unit "ev6_u" 2 0
338 (and (eq_attr "cpu" "ev6")
339 (eq_attr "type" "imul"))
340 7 1)
341
342 ;; Branches issue to either upper pipe
343 (define_function_unit "ev6_u" 2 0
344 (and (eq_attr "cpu" "ev6")
345 (eq_attr "type" "ibr"))
346 3 1)
347
348 ;; Calls only issue to L0.
349 (define_function_unit "ev6_l0" 1 0
350 (and (eq_attr "cpu" "ev6")
351 (eq_attr "type" "jsr"))
352 1 1)
353
354 (define_function_unit "ev6_l" 2 0
355 (and (eq_attr "cpu" "ev6")
356 (eq_attr "type" "jsr"))
357 1 1)
358
359 ;; Ftoi/itof only issue to lower pipes
360 (define_function_unit "ev6_l" 2 0
361 (and (eq_attr "cpu" "ev6")
362 (eq_attr "type" "ftoi"))
363 3 1)
364
365 (define_function_unit "ev6_l" 2 0
366 (and (eq_attr "cpu" "ev6")
367 (eq_attr "type" "itof"))
368 4 1)
369
370 ;; For the FPU we are very similar to EV5, except there's no insn that
371 ;; can issue to fm & fa, so we get to leave that out.
372
373 (define_function_unit "ev6_fm" 1 0
374 (and (eq_attr "cpu" "ev6")
375 (eq_attr "type" "fmul"))
376 4 1)
377
378 (define_function_unit "ev6_fa" 1 0
379 (and (eq_attr "cpu" "ev6")
380 (eq_attr "type" "fadd,fcpys,fbr,fdiv,fsqrt"))
381 4 1)
382
383 (define_function_unit "ev6_fa" 1 0
384 (and (eq_attr "cpu" "ev6")
385 (eq_attr "type" "fcmov"))
386 8 1)
387
388 (define_function_unit "fdiv" 1 0
389 (and (eq_attr "cpu" "ev6")
390 (and (eq_attr "type" "fdiv")
391 (eq_attr "opsize" "si")))
392 12 10)
393
394 (define_function_unit "fdiv" 1 0
395 (and (eq_attr "cpu" "ev6")
396 (and (eq_attr "type" "fdiv")
397 (eq_attr "opsize" "di")))
398 15 13)
399
400 (define_function_unit "fsqrt" 1 0
401 (and (eq_attr "cpu" "ev6")
402 (and (eq_attr "type" "fsqrt")
403 (eq_attr "opsize" "si")))
404 16 14)
405
406 (define_function_unit "fsqrt" 1 0
407 (and (eq_attr "cpu" "ev6")
408 (and (eq_attr "type" "fsqrt")
409 (eq_attr "opsize" "di")))
410 32 30)
411
412 ; ??? The FPU communicates with memory and the integer register file
413 ; via two fp store units. We need a slot in the fst immediately, and
414 ; a slot in LOW after the operand data is ready. At which point the
415 ; data may be moved either to the store queue or the integer register
416 ; file and the insn retired.
417
418 \f
419 ;; First define the arithmetic insns. Note that the 32-bit forms also
420 ;; sign-extend.
421
422 ;; Handle 32-64 bit extension from memory to a floating point register
423 ;; specially, since this ocurrs frequently in int->double conversions.
424 ;;
425 ;; Note that while we must retain the =f case in the insn for reload's
426 ;; benefit, it should be eliminated after reload, so we should never emit
427 ;; code for that case. But we don't reject the possibility.
428
429 (define_expand "extendsidi2"
430 [(set (match_operand:DI 0 "register_operand" "")
431 (sign_extend:DI (match_operand:SI 1 "nonimmediate_operand" "")))]
432 ""
433 "")
434
435 (define_insn "*extendsidi2_nofix"
436 [(set (match_operand:DI 0 "register_operand" "=r,r,*f,?*f")
437 (sign_extend:DI
438 (match_operand:SI 1 "nonimmediate_operand" "r,m,*f,m")))]
439 "! TARGET_FIX"
440 "@
441 addl %1,$31,%0
442 ldl %0,%1
443 cvtlq %1,%0
444 lds %0,%1\;cvtlq %0,%0"
445 [(set_attr "type" "iadd,ild,fadd,fld")
446 (set_attr "length" "*,*,*,8")])
447
448 (define_insn "*extendsidi2_fix"
449 [(set (match_operand:DI 0 "register_operand" "=r,r,r,*f,?*f")
450 (sign_extend:DI
451 (match_operand:SI 1 "nonimmediate_operand" "r,m,*f,*f,m")))]
452 "TARGET_FIX"
453 "@
454 addl %1,$31,%0
455 ldl %0,%1
456 ftois %1,%0
457 cvtlq %1,%0
458 lds %0,%1\;cvtlq %0,%0"
459 [(set_attr "type" "iadd,ild,ftoi,fadd,fld")
460 (set_attr "length" "*,*,*,*,8")])
461
462 ;; Due to issues with CLASS_CANNOT_CHANGE_SIZE, we cannot use a subreg here.
463 (define_split
464 [(set (match_operand:DI 0 "hard_fp_register_operand" "")
465 (sign_extend:DI (match_operand:SI 1 "memory_operand" "")))]
466 "reload_completed"
467 [(set (match_dup 2) (match_dup 1))
468 (set (match_dup 0) (sign_extend:DI (match_dup 2)))]
469 "operands[2] = gen_rtx_REG (SImode, REGNO (operands[0]));")
470
471 ;; Optimize sign-extension of SImode loads. This shows up in the wake of
472 ;; reload when converting fp->int.
473
474 (define_peephole2
475 [(set (match_operand:SI 0 "hard_int_register_operand" "")
476 (match_operand:SI 1 "memory_operand" ""))
477 (set (match_operand:DI 2 "hard_int_register_operand" "")
478 (sign_extend:DI (match_dup 0)))]
479 "true_regnum (operands[0]) == true_regnum (operands[2])
480 || peep2_reg_dead_p (2, operands[0])"
481 [(set (match_dup 2)
482 (sign_extend:DI (match_dup 1)))]
483 "")
484
485 (define_peephole2
486 [(set (match_operand:SI 0 "hard_int_register_operand" "")
487 (match_operand:SI 1 "hard_fp_register_operand" ""))
488 (set (match_operand:DI 2 "hard_int_register_operand" "")
489 (sign_extend:DI (match_dup 0)))]
490 "TARGET_FIX
491 && (true_regnum (operands[0]) == true_regnum (operands[2])
492 || peep2_reg_dead_p (2, operands[0]))"
493 [(set (match_dup 2)
494 (sign_extend:DI (match_dup 1)))]
495 "")
496
497 (define_peephole2
498 [(set (match_operand:DI 0 "hard_fp_register_operand" "")
499 (sign_extend:DI (match_operand:SI 1 "hard_fp_register_operand" "")))
500 (set (match_operand:DI 2 "hard_int_register_operand" "")
501 (match_dup 0))]
502 "TARGET_FIX && peep2_reg_dead_p (2, operands[0])"
503 [(set (match_dup 2)
504 (sign_extend:DI (match_dup 1)))]
505 "")
506
507 ;; Do addsi3 the way expand_binop would do if we didn't have one. This
508 ;; generates better code. We have the anonymous addsi3 pattern below in
509 ;; case combine wants to make it.
510 (define_expand "addsi3"
511 [(set (match_operand:SI 0 "register_operand" "")
512 (plus:SI (match_operand:SI 1 "reg_or_0_operand" "")
513 (match_operand:SI 2 "add_operand" "")))]
514 ""
515 {
516 if (optimize)
517 {
518 rtx op1 = gen_lowpart (DImode, operands[1]);
519 rtx op2 = gen_lowpart (DImode, operands[2]);
520
521 if (! cse_not_expected)
522 {
523 rtx tmp = gen_reg_rtx (DImode);
524 emit_insn (gen_adddi3 (tmp, op1, op2));
525 emit_move_insn (gen_lowpart (DImode, operands[0]), tmp);
526 }
527 else
528 emit_insn (gen_adddi3 (gen_lowpart (DImode, operands[0]), op1, op2));
529 DONE;
530 }
531 })
532
533 (define_insn "*addsi_internal"
534 [(set (match_operand:SI 0 "register_operand" "=r,r,r,r")
535 (plus:SI (match_operand:SI 1 "reg_or_0_operand" "%rJ,rJ,rJ,rJ")
536 (match_operand:SI 2 "add_operand" "rI,O,K,L")))]
537 ""
538 "@
539 addl %r1,%2,%0
540 subl %r1,%n2,%0
541 lda %0,%2(%r1)
542 ldah %0,%h2(%r1)")
543
544 (define_split
545 [(set (match_operand:SI 0 "register_operand" "")
546 (plus:SI (match_operand:SI 1 "register_operand" "")
547 (match_operand:SI 2 "const_int_operand" "")))]
548 "! add_operand (operands[2], SImode)"
549 [(set (match_dup 0) (plus:SI (match_dup 1) (match_dup 3)))
550 (set (match_dup 0) (plus:SI (match_dup 0) (match_dup 4)))]
551 {
552 HOST_WIDE_INT val = INTVAL (operands[2]);
553 HOST_WIDE_INT low = (val & 0xffff) - 2 * (val & 0x8000);
554 HOST_WIDE_INT rest = val - low;
555
556 operands[3] = GEN_INT (rest);
557 operands[4] = GEN_INT (low);
558 })
559
560 (define_insn "*addsi_se"
561 [(set (match_operand:DI 0 "register_operand" "=r,r")
562 (sign_extend:DI
563 (plus:SI (match_operand:SI 1 "reg_or_0_operand" "%rJ,rJ")
564 (match_operand:SI 2 "sext_add_operand" "rI,O"))))]
565 ""
566 "@
567 addl %r1,%2,%0
568 subl %r1,%n2,%0")
569
570 (define_split
571 [(set (match_operand:DI 0 "register_operand" "")
572 (sign_extend:DI
573 (plus:SI (match_operand:SI 1 "reg_not_elim_operand" "")
574 (match_operand:SI 2 "const_int_operand" ""))))
575 (clobber (match_operand:SI 3 "reg_not_elim_operand" ""))]
576 "! sext_add_operand (operands[2], SImode) && INTVAL (operands[2]) > 0
577 && INTVAL (operands[2]) % 4 == 0"
578 [(set (match_dup 3) (match_dup 4))
579 (set (match_dup 0) (sign_extend:DI (plus:SI (mult:SI (match_dup 3)
580 (match_dup 5))
581 (match_dup 1))))]
582 {
583 HOST_WIDE_INT val = INTVAL (operands[2]) / 4;
584 int mult = 4;
585
586 if (val % 2 == 0)
587 val /= 2, mult = 8;
588
589 operands[4] = GEN_INT (val);
590 operands[5] = GEN_INT (mult);
591 })
592
593 (define_split
594 [(set (match_operand:DI 0 "register_operand" "")
595 (sign_extend:DI
596 (plus:SI (match_operator:SI 1 "comparison_operator"
597 [(match_operand 2 "" "")
598 (match_operand 3 "" "")])
599 (match_operand:SI 4 "add_operand" ""))))
600 (clobber (match_operand:DI 5 "register_operand" ""))]
601 ""
602 [(set (match_dup 5) (match_dup 6))
603 (set (match_dup 0) (sign_extend:DI (plus:SI (match_dup 7) (match_dup 4))))]
604 {
605 operands[6] = gen_rtx_fmt_ee (GET_CODE (operands[1]), DImode,
606 operands[2], operands[3]);
607 operands[7] = gen_lowpart (SImode, operands[5]);
608 })
609
610 (define_insn "addvsi3"
611 [(set (match_operand:SI 0 "register_operand" "=r,r")
612 (plus:SI (match_operand:SI 1 "reg_or_0_operand" "%rJ,rJ")
613 (match_operand:SI 2 "sext_add_operand" "rI,O")))
614 (trap_if (ne (plus:DI (sign_extend:DI (match_dup 1))
615 (sign_extend:DI (match_dup 2)))
616 (sign_extend:DI (plus:SI (match_dup 1)
617 (match_dup 2))))
618 (const_int 0))]
619 ""
620 "@
621 addlv %r1,%2,%0
622 sublv %r1,%n2,%0")
623
624 (define_expand "adddi3"
625 [(set (match_operand:DI 0 "register_operand" "")
626 (plus:DI (match_operand:DI 1 "register_operand" "")
627 (match_operand:DI 2 "add_operand" "")))]
628 ""
629 "")
630
631 ;; We used to expend quite a lot of effort choosing addq/subq/lda.
632 ;; With complications like
633 ;;
634 ;; The NT stack unwind code can't handle a subq to adjust the stack
635 ;; (that's a bug, but not one we can do anything about). As of NT4.0 SP3,
636 ;; the exception handling code will loop if a subq is used and an
637 ;; exception occurs.
638 ;;
639 ;; The 19980616 change to emit prologues as RTL also confused some
640 ;; versions of GDB, which also interprets prologues. This has been
641 ;; fixed as of GDB 4.18, but it does not harm to unconditionally
642 ;; use lda here.
643 ;;
644 ;; and the fact that the three insns schedule exactly the same, it's
645 ;; just not worth the effort.
646
647 (define_insn "*adddi_internal"
648 [(set (match_operand:DI 0 "register_operand" "=r,r,r")
649 (plus:DI (match_operand:DI 1 "register_operand" "%r,r,r")
650 (match_operand:DI 2 "add_operand" "r,K,L")))]
651 ""
652 "@
653 addq %1,%2,%0
654 lda %0,%2(%1)
655 ldah %0,%h2(%1)")
656
657 ;; ??? Allow large constants when basing off the frame pointer or some
658 ;; virtual register that may eliminate to the frame pointer. This is
659 ;; done because register elimination offsets will change the hi/lo split,
660 ;; and if we split before reload, we will require additional instructions.
661
662 (define_insn "*adddi_fp_hack"
663 [(set (match_operand:DI 0 "register_operand" "=r")
664 (plus:DI (match_operand:DI 1 "reg_no_subreg_operand" "r")
665 (match_operand:DI 2 "const_int_operand" "n")))]
666 "NONSTRICT_REG_OK_FP_BASE_P (operands[1])
667 && INTVAL (operands[2]) >= 0
668 /* This is the largest constant an lda+ldah pair can add, minus
669 an upper bound on the displacement between SP and AP during
670 register elimination. See INITIAL_ELIMINATION_OFFSET. */
671 && INTVAL (operands[2])
672 < (0x7fff8000
673 - FIRST_PSEUDO_REGISTER * UNITS_PER_WORD
674 - ALPHA_ROUND(current_function_outgoing_args_size)
675 - (ALPHA_ROUND (get_frame_size ()
676 + max_reg_num () * UNITS_PER_WORD
677 + current_function_pretend_args_size)
678 - current_function_pretend_args_size))"
679 "#")
680
681 ;; Don't do this if we are adjusting SP since we don't want to do it
682 ;; in two steps. Don't split FP sources for the reason listed above.
683 (define_split
684 [(set (match_operand:DI 0 "register_operand" "")
685 (plus:DI (match_operand:DI 1 "register_operand" "")
686 (match_operand:DI 2 "const_int_operand" "")))]
687 "! add_operand (operands[2], DImode)
688 && operands[0] != stack_pointer_rtx
689 && operands[1] != frame_pointer_rtx
690 && operands[1] != arg_pointer_rtx"
691 [(set (match_dup 0) (plus:DI (match_dup 1) (match_dup 3)))
692 (set (match_dup 0) (plus:DI (match_dup 0) (match_dup 4)))]
693 {
694 HOST_WIDE_INT val = INTVAL (operands[2]);
695 HOST_WIDE_INT low = (val & 0xffff) - 2 * (val & 0x8000);
696 HOST_WIDE_INT rest = val - low;
697
698 operands[4] = GEN_INT (low);
699 if (CONST_OK_FOR_LETTER_P (rest, 'L'))
700 operands[3] = GEN_INT (rest);
701 else if (! no_new_pseudos)
702 {
703 operands[3] = gen_reg_rtx (DImode);
704 emit_move_insn (operands[3], operands[2]);
705 emit_insn (gen_adddi3 (operands[0], operands[1], operands[3]));
706 DONE;
707 }
708 else
709 FAIL;
710 })
711
712 (define_insn "*saddl"
713 [(set (match_operand:SI 0 "register_operand" "=r,r")
714 (plus:SI (mult:SI (match_operand:SI 1 "reg_not_elim_operand" "r,r")
715 (match_operand:SI 2 "const48_operand" "I,I"))
716 (match_operand:SI 3 "sext_add_operand" "rI,O")))]
717 ""
718 "@
719 s%2addl %1,%3,%0
720 s%2subl %1,%n3,%0")
721
722 (define_insn "*saddl_se"
723 [(set (match_operand:DI 0 "register_operand" "=r,r")
724 (sign_extend:DI
725 (plus:SI (mult:SI (match_operand:SI 1 "reg_not_elim_operand" "r,r")
726 (match_operand:SI 2 "const48_operand" "I,I"))
727 (match_operand:SI 3 "sext_add_operand" "rI,O"))))]
728 ""
729 "@
730 s%2addl %1,%3,%0
731 s%2subl %1,%n3,%0")
732
733 (define_split
734 [(set (match_operand:DI 0 "register_operand" "")
735 (sign_extend:DI
736 (plus:SI (mult:SI (match_operator:SI 1 "comparison_operator"
737 [(match_operand 2 "" "")
738 (match_operand 3 "" "")])
739 (match_operand:SI 4 "const48_operand" ""))
740 (match_operand:SI 5 "sext_add_operand" ""))))
741 (clobber (match_operand:DI 6 "reg_not_elim_operand" ""))]
742 ""
743 [(set (match_dup 6) (match_dup 7))
744 (set (match_dup 0)
745 (sign_extend:DI (plus:SI (mult:SI (match_dup 8) (match_dup 4))
746 (match_dup 5))))]
747 {
748 operands[7] = gen_rtx_fmt_ee (GET_CODE (operands[1]), DImode,
749 operands[2], operands[3]);
750 operands[8] = gen_lowpart (SImode, operands[6]);
751 })
752
753 (define_insn "*saddq"
754 [(set (match_operand:DI 0 "register_operand" "=r,r")
755 (plus:DI (mult:DI (match_operand:DI 1 "reg_not_elim_operand" "r,r")
756 (match_operand:DI 2 "const48_operand" "I,I"))
757 (match_operand:DI 3 "sext_add_operand" "rI,O")))]
758 ""
759 "@
760 s%2addq %1,%3,%0
761 s%2subq %1,%n3,%0")
762
763 (define_insn "addvdi3"
764 [(set (match_operand:DI 0 "register_operand" "=r,r")
765 (plus:DI (match_operand:DI 1 "reg_or_0_operand" "%rJ,rJ")
766 (match_operand:DI 2 "sext_add_operand" "rI,O")))
767 (trap_if (ne (plus:TI (sign_extend:TI (match_dup 1))
768 (sign_extend:TI (match_dup 2)))
769 (sign_extend:TI (plus:DI (match_dup 1)
770 (match_dup 2))))
771 (const_int 0))]
772 ""
773 "@
774 addqv %r1,%2,%0
775 subqv %r1,%n2,%0")
776
777 (define_insn "negsi2"
778 [(set (match_operand:SI 0 "register_operand" "=r")
779 (neg:SI (match_operand:SI 1 "reg_or_8bit_operand" "rI")))]
780 ""
781 "subl $31,%1,%0")
782
783 (define_insn "*negsi_se"
784 [(set (match_operand:DI 0 "register_operand" "=r")
785 (sign_extend:DI (neg:SI
786 (match_operand:SI 1 "reg_or_8bit_operand" "rI"))))]
787 ""
788 "subl $31,%1,%0")
789
790 (define_insn "negvsi2"
791 [(set (match_operand:SI 0 "register_operand" "=r")
792 (neg:SI (match_operand:SI 1 "register_operand" "r")))
793 (trap_if (ne (neg:DI (sign_extend:DI (match_dup 1)))
794 (sign_extend:DI (neg:SI (match_dup 1))))
795 (const_int 0))]
796 ""
797 "sublv $31,%1,%0")
798
799 (define_insn "negdi2"
800 [(set (match_operand:DI 0 "register_operand" "=r")
801 (neg:DI (match_operand:DI 1 "reg_or_8bit_operand" "rI")))]
802 ""
803 "subq $31,%1,%0")
804
805 (define_insn "negvdi2"
806 [(set (match_operand:DI 0 "register_operand" "=r")
807 (neg:DI (match_operand:DI 1 "register_operand" "r")))
808 (trap_if (ne (neg:TI (sign_extend:TI (match_dup 1)))
809 (sign_extend:TI (neg:DI (match_dup 1))))
810 (const_int 0))]
811 ""
812 "subqv $31,%1,%0")
813
814 (define_expand "subsi3"
815 [(set (match_operand:SI 0 "register_operand" "")
816 (minus:SI (match_operand:SI 1 "reg_or_0_operand" "")
817 (match_operand:SI 2 "reg_or_8bit_operand" "")))]
818 ""
819 {
820 if (optimize)
821 {
822 rtx op1 = gen_lowpart (DImode, operands[1]);
823 rtx op2 = gen_lowpart (DImode, operands[2]);
824
825 if (! cse_not_expected)
826 {
827 rtx tmp = gen_reg_rtx (DImode);
828 emit_insn (gen_subdi3 (tmp, op1, op2));
829 emit_move_insn (gen_lowpart (DImode, operands[0]), tmp);
830 }
831 else
832 emit_insn (gen_subdi3 (gen_lowpart (DImode, operands[0]), op1, op2));
833 DONE;
834 }
835 })
836
837 (define_insn "*subsi_internal"
838 [(set (match_operand:SI 0 "register_operand" "=r")
839 (minus:SI (match_operand:SI 1 "reg_or_0_operand" "rJ")
840 (match_operand:SI 2 "reg_or_8bit_operand" "rI")))]
841 ""
842 "subl %r1,%2,%0")
843
844 (define_insn "*subsi_se"
845 [(set (match_operand:DI 0 "register_operand" "=r")
846 (sign_extend:DI (minus:SI (match_operand:SI 1 "reg_or_0_operand" "rJ")
847 (match_operand:SI 2 "reg_or_8bit_operand" "rI"))))]
848 ""
849 "subl %r1,%2,%0")
850
851 (define_insn "subvsi3"
852 [(set (match_operand:SI 0 "register_operand" "=r")
853 (minus:SI (match_operand:SI 1 "reg_or_0_operand" "rJ")
854 (match_operand:SI 2 "reg_or_8bit_operand" "rI")))
855 (trap_if (ne (minus:DI (sign_extend:DI (match_dup 1))
856 (sign_extend:DI (match_dup 2)))
857 (sign_extend:DI (minus:SI (match_dup 1)
858 (match_dup 2))))
859 (const_int 0))]
860 ""
861 "sublv %r1,%2,%0")
862
863 (define_insn "subdi3"
864 [(set (match_operand:DI 0 "register_operand" "=r")
865 (minus:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
866 (match_operand:DI 2 "reg_or_8bit_operand" "rI")))]
867 ""
868 "subq %r1,%2,%0")
869
870 (define_insn "*ssubl"
871 [(set (match_operand:SI 0 "register_operand" "=r")
872 (minus:SI (mult:SI (match_operand:SI 1 "reg_not_elim_operand" "r")
873 (match_operand:SI 2 "const48_operand" "I"))
874 (match_operand:SI 3 "reg_or_8bit_operand" "rI")))]
875 ""
876 "s%2subl %1,%3,%0")
877
878 (define_insn "*ssubl_se"
879 [(set (match_operand:DI 0 "register_operand" "=r")
880 (sign_extend:DI
881 (minus:SI (mult:SI (match_operand:SI 1 "reg_not_elim_operand" "r")
882 (match_operand:SI 2 "const48_operand" "I"))
883 (match_operand:SI 3 "reg_or_8bit_operand" "rI"))))]
884 ""
885 "s%2subl %1,%3,%0")
886
887 (define_insn "*ssubq"
888 [(set (match_operand:DI 0 "register_operand" "=r")
889 (minus:DI (mult:DI (match_operand:DI 1 "reg_not_elim_operand" "r")
890 (match_operand:DI 2 "const48_operand" "I"))
891 (match_operand:DI 3 "reg_or_8bit_operand" "rI")))]
892 ""
893 "s%2subq %1,%3,%0")
894
895 (define_insn "subvdi3"
896 [(set (match_operand:DI 0 "register_operand" "=r")
897 (minus:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
898 (match_operand:DI 2 "reg_or_8bit_operand" "rI")))
899 (trap_if (ne (minus:TI (sign_extend:TI (match_dup 1))
900 (sign_extend:TI (match_dup 2)))
901 (sign_extend:TI (minus:DI (match_dup 1)
902 (match_dup 2))))
903 (const_int 0))]
904 ""
905 "subqv %r1,%2,%0")
906
907 (define_insn "mulsi3"
908 [(set (match_operand:SI 0 "register_operand" "=r")
909 (mult:SI (match_operand:SI 1 "reg_or_0_operand" "%rJ")
910 (match_operand:SI 2 "reg_or_8bit_operand" "rI")))]
911 ""
912 "mull %r1,%2,%0"
913 [(set_attr "type" "imul")
914 (set_attr "opsize" "si")])
915
916 (define_insn "*mulsi_se"
917 [(set (match_operand:DI 0 "register_operand" "=r")
918 (sign_extend:DI
919 (mult:SI (match_operand:SI 1 "reg_or_0_operand" "%rJ")
920 (match_operand:SI 2 "reg_or_8bit_operand" "rI"))))]
921 ""
922 "mull %r1,%2,%0"
923 [(set_attr "type" "imul")
924 (set_attr "opsize" "si")])
925
926 (define_insn "mulvsi3"
927 [(set (match_operand:SI 0 "register_operand" "=r")
928 (mult:SI (match_operand:SI 1 "reg_or_0_operand" "%rJ")
929 (match_operand:SI 2 "reg_or_8bit_operand" "rI")))
930 (trap_if (ne (mult:DI (sign_extend:DI (match_dup 1))
931 (sign_extend:DI (match_dup 2)))
932 (sign_extend:DI (mult:SI (match_dup 1)
933 (match_dup 2))))
934 (const_int 0))]
935 ""
936 "mullv %r1,%2,%0"
937 [(set_attr "type" "imul")
938 (set_attr "opsize" "si")])
939
940 (define_insn "muldi3"
941 [(set (match_operand:DI 0 "register_operand" "=r")
942 (mult:DI (match_operand:DI 1 "reg_or_0_operand" "%rJ")
943 (match_operand:DI 2 "reg_or_8bit_operand" "rI")))]
944 ""
945 "mulq %r1,%2,%0"
946 [(set_attr "type" "imul")])
947
948 (define_insn "mulvdi3"
949 [(set (match_operand:DI 0 "register_operand" "=r")
950 (mult:DI (match_operand:DI 1 "reg_or_0_operand" "%rJ")
951 (match_operand:DI 2 "reg_or_8bit_operand" "rI")))
952 (trap_if (ne (mult:TI (sign_extend:TI (match_dup 1))
953 (sign_extend:TI (match_dup 2)))
954 (sign_extend:TI (mult:DI (match_dup 1)
955 (match_dup 2))))
956 (const_int 0))]
957 ""
958 "mulqv %r1,%2,%0"
959 [(set_attr "type" "imul")])
960
961 (define_insn "umuldi3_highpart"
962 [(set (match_operand:DI 0 "register_operand" "=r")
963 (truncate:DI
964 (lshiftrt:TI
965 (mult:TI (zero_extend:TI
966 (match_operand:DI 1 "reg_or_0_operand" "%rJ"))
967 (zero_extend:TI
968 (match_operand:DI 2 "reg_or_8bit_operand" "rI")))
969 (const_int 64))))]
970 ""
971 "umulh %r1,%2,%0"
972 [(set_attr "type" "imul")
973 (set_attr "opsize" "udi")])
974
975 (define_insn "*umuldi3_highpart_const"
976 [(set (match_operand:DI 0 "register_operand" "=r")
977 (truncate:DI
978 (lshiftrt:TI
979 (mult:TI (zero_extend:TI (match_operand:DI 1 "register_operand" "r"))
980 (match_operand:TI 2 "cint8_operand" "I"))
981 (const_int 64))))]
982 ""
983 "umulh %1,%2,%0"
984 [(set_attr "type" "imul")
985 (set_attr "opsize" "udi")])
986 \f
987 ;; The divide and remainder operations always take their inputs from
988 ;; r24 and r25, put their output in r27, and clobber r23 and r28.
989
990 ;; ??? Force sign-extension here because some versions of OSF/1 don't
991 ;; do the right thing if the inputs are not properly sign-extended.
992 ;; But Linux, for instance, does not have this problem. Is it worth
993 ;; the complication here to eliminate the sign extension?
994 ;; Interix/NT has the same sign-extension problem.
995
996 (define_expand "divsi3"
997 [(set (reg:DI 24)
998 (sign_extend:DI (match_operand:SI 1 "nonimmediate_operand" "")))
999 (set (reg:DI 25)
1000 (sign_extend:DI (match_operand:SI 2 "nonimmediate_operand" "")))
1001 (parallel [(set (reg:DI 27)
1002 (sign_extend:DI (div:SI (reg:DI 24) (reg:DI 25))))
1003 (clobber (reg:DI 23))
1004 (clobber (reg:DI 28))])
1005 (set (match_operand:SI 0 "nonimmediate_operand" "")
1006 (subreg:SI (reg:DI 27) 0))]
1007 "! TARGET_ABI_OPEN_VMS"
1008 "")
1009
1010 (define_expand "udivsi3"
1011 [(set (reg:DI 24)
1012 (sign_extend:DI (match_operand:SI 1 "nonimmediate_operand" "")))
1013 (set (reg:DI 25)
1014 (sign_extend:DI (match_operand:SI 2 "nonimmediate_operand" "")))
1015 (parallel [(set (reg:DI 27)
1016 (sign_extend:DI (udiv:SI (reg:DI 24) (reg:DI 25))))
1017 (clobber (reg:DI 23))
1018 (clobber (reg:DI 28))])
1019 (set (match_operand:SI 0 "nonimmediate_operand" "")
1020 (subreg:SI (reg:DI 27) 0))]
1021 "! TARGET_ABI_OPEN_VMS"
1022 "")
1023
1024 (define_expand "modsi3"
1025 [(set (reg:DI 24)
1026 (sign_extend:DI (match_operand:SI 1 "nonimmediate_operand" "")))
1027 (set (reg:DI 25)
1028 (sign_extend:DI (match_operand:SI 2 "nonimmediate_operand" "")))
1029 (parallel [(set (reg:DI 27)
1030 (sign_extend:DI (mod:SI (reg:DI 24) (reg:DI 25))))
1031 (clobber (reg:DI 23))
1032 (clobber (reg:DI 28))])
1033 (set (match_operand:SI 0 "nonimmediate_operand" "")
1034 (subreg:SI (reg:DI 27) 0))]
1035 "! TARGET_ABI_OPEN_VMS"
1036 "")
1037
1038 (define_expand "umodsi3"
1039 [(set (reg:DI 24)
1040 (sign_extend:DI (match_operand:SI 1 "nonimmediate_operand" "")))
1041 (set (reg:DI 25)
1042 (sign_extend:DI (match_operand:SI 2 "nonimmediate_operand" "")))
1043 (parallel [(set (reg:DI 27)
1044 (sign_extend:DI (umod:SI (reg:DI 24) (reg:DI 25))))
1045 (clobber (reg:DI 23))
1046 (clobber (reg:DI 28))])
1047 (set (match_operand:SI 0 "nonimmediate_operand" "")
1048 (subreg:SI (reg:DI 27) 0))]
1049 "! TARGET_ABI_OPEN_VMS"
1050 "")
1051
1052 (define_expand "divdi3"
1053 [(set (reg:DI 24) (match_operand:DI 1 "input_operand" ""))
1054 (set (reg:DI 25) (match_operand:DI 2 "input_operand" ""))
1055 (parallel [(set (reg:DI 27)
1056 (div:DI (reg:DI 24)
1057 (reg:DI 25)))
1058 (clobber (reg:DI 23))
1059 (clobber (reg:DI 28))])
1060 (set (match_operand:DI 0 "nonimmediate_operand" "")
1061 (reg:DI 27))]
1062 "! TARGET_ABI_OPEN_VMS"
1063 "")
1064
1065 (define_expand "udivdi3"
1066 [(set (reg:DI 24) (match_operand:DI 1 "input_operand" ""))
1067 (set (reg:DI 25) (match_operand:DI 2 "input_operand" ""))
1068 (parallel [(set (reg:DI 27)
1069 (udiv:DI (reg:DI 24)
1070 (reg:DI 25)))
1071 (clobber (reg:DI 23))
1072 (clobber (reg:DI 28))])
1073 (set (match_operand:DI 0 "nonimmediate_operand" "")
1074 (reg:DI 27))]
1075 "! TARGET_ABI_OPEN_VMS"
1076 "")
1077
1078 (define_expand "moddi3"
1079 [(set (reg:DI 24) (match_operand:DI 1 "input_operand" ""))
1080 (set (reg:DI 25) (match_operand:DI 2 "input_operand" ""))
1081 (parallel [(set (reg:DI 27)
1082 (mod:DI (reg:DI 24)
1083 (reg:DI 25)))
1084 (clobber (reg:DI 23))
1085 (clobber (reg:DI 28))])
1086 (set (match_operand:DI 0 "nonimmediate_operand" "")
1087 (reg:DI 27))]
1088 "! TARGET_ABI_OPEN_VMS"
1089 "")
1090
1091 (define_expand "umoddi3"
1092 [(set (reg:DI 24) (match_operand:DI 1 "input_operand" ""))
1093 (set (reg:DI 25) (match_operand:DI 2 "input_operand" ""))
1094 (parallel [(set (reg:DI 27)
1095 (umod:DI (reg:DI 24)
1096 (reg:DI 25)))
1097 (clobber (reg:DI 23))
1098 (clobber (reg:DI 28))])
1099 (set (match_operand:DI 0 "nonimmediate_operand" "")
1100 (reg:DI 27))]
1101 "! TARGET_ABI_OPEN_VMS"
1102 "")
1103
1104 ;; Lengths of 8 for ldq $t12,__divq($gp); jsr $t9,($t12),__divq as
1105 ;; expanded by the assembler.
1106
1107 (define_insn "*divmodsi_internal_er"
1108 [(set (reg:DI 27)
1109 (sign_extend:DI (match_operator:SI 0 "divmod_operator"
1110 [(reg:DI 24) (reg:DI 25)])))
1111 (clobber (reg:DI 23))
1112 (clobber (reg:DI 28))]
1113 "TARGET_EXPLICIT_RELOCS && ! TARGET_ABI_OPEN_VMS"
1114 "ldq $27,__%E0($29)\t\t!literal!%#\;jsr $23,($27),__%E0\t\t!lituse_jsr!%#"
1115 [(set_attr "type" "jsr")
1116 (set_attr "length" "8")])
1117
1118 (define_insn "*divmodsi_internal"
1119 [(set (reg:DI 27)
1120 (sign_extend:DI (match_operator:SI 0 "divmod_operator"
1121 [(reg:DI 24) (reg:DI 25)])))
1122 (clobber (reg:DI 23))
1123 (clobber (reg:DI 28))]
1124 "! TARGET_ABI_OPEN_VMS"
1125 "%E0 $24,$25,$27"
1126 [(set_attr "type" "jsr")
1127 (set_attr "length" "8")])
1128
1129 (define_insn "*divmoddi_internal_er"
1130 [(set (reg:DI 27)
1131 (match_operator:DI 0 "divmod_operator"
1132 [(reg:DI 24) (reg:DI 25)]))
1133 (clobber (reg:DI 23))
1134 (clobber (reg:DI 28))]
1135 "TARGET_EXPLICIT_RELOCS && ! TARGET_ABI_OPEN_VMS"
1136 "ldq $27,__%E0($29)\t\t!literal!%#\;jsr $23,($27),__%E0\t\t!lituse_jsr!%#"
1137 [(set_attr "type" "jsr")
1138 (set_attr "length" "8")])
1139
1140 (define_insn "*divmoddi_internal"
1141 [(set (reg:DI 27)
1142 (match_operator:DI 0 "divmod_operator"
1143 [(reg:DI 24) (reg:DI 25)]))
1144 (clobber (reg:DI 23))
1145 (clobber (reg:DI 28))]
1146 "! TARGET_ABI_OPEN_VMS"
1147 "%E0 $24,$25,$27"
1148 [(set_attr "type" "jsr")
1149 (set_attr "length" "8")])
1150 \f
1151 ;; Next are the basic logical operations. These only exist in DImode.
1152
1153 (define_insn "anddi3"
1154 [(set (match_operand:DI 0 "register_operand" "=r,r,r")
1155 (and:DI (match_operand:DI 1 "reg_or_0_operand" "%rJ,rJ,rJ")
1156 (match_operand:DI 2 "and_operand" "rI,N,MH")))]
1157 ""
1158 "@
1159 and %r1,%2,%0
1160 bic %r1,%N2,%0
1161 zapnot %r1,%m2,%0"
1162 [(set_attr "type" "ilog,ilog,shift")])
1163
1164 ;; There are times when we can split an AND into two AND insns. This occurs
1165 ;; when we can first clear any bytes and then clear anything else. For
1166 ;; example "I & 0xffff07" is "(I & 0xffffff) & 0xffffffffffffff07".
1167 ;; Only do this when running on 64-bit host since the computations are
1168 ;; too messy otherwise.
1169
1170 (define_split
1171 [(set (match_operand:DI 0 "register_operand" "")
1172 (and:DI (match_operand:DI 1 "register_operand" "")
1173 (match_operand:DI 2 "const_int_operand" "")))]
1174 "HOST_BITS_PER_WIDE_INT == 64 && ! and_operand (operands[2], DImode)"
1175 [(set (match_dup 0) (and:DI (match_dup 1) (match_dup 3)))
1176 (set (match_dup 0) (and:DI (match_dup 0) (match_dup 4)))]
1177 {
1178 unsigned HOST_WIDE_INT mask1 = INTVAL (operands[2]);
1179 unsigned HOST_WIDE_INT mask2 = mask1;
1180 int i;
1181
1182 /* For each byte that isn't all zeros, make it all ones. */
1183 for (i = 0; i < 64; i += 8)
1184 if ((mask1 & ((HOST_WIDE_INT) 0xff << i)) != 0)
1185 mask1 |= (HOST_WIDE_INT) 0xff << i;
1186
1187 /* Now turn on any bits we've just turned off. */
1188 mask2 |= ~ mask1;
1189
1190 operands[3] = GEN_INT (mask1);
1191 operands[4] = GEN_INT (mask2);
1192 })
1193
1194 (define_expand "zero_extendqihi2"
1195 [(set (match_operand:HI 0 "register_operand" "")
1196 (zero_extend:HI (match_operand:QI 1 "nonimmediate_operand" "")))]
1197 ""
1198 {
1199 if (! TARGET_BWX)
1200 operands[1] = force_reg (QImode, operands[1]);
1201 })
1202
1203 (define_insn "*zero_extendqihi2_bwx"
1204 [(set (match_operand:HI 0 "register_operand" "=r,r")
1205 (zero_extend:HI (match_operand:QI 1 "nonimmediate_operand" "r,m")))]
1206 "TARGET_BWX"
1207 "@
1208 and %1,0xff,%0
1209 ldbu %0,%1"
1210 [(set_attr "type" "ilog,ild")])
1211
1212 (define_insn "*zero_extendqihi2_nobwx"
1213 [(set (match_operand:HI 0 "register_operand" "=r")
1214 (zero_extend:HI (match_operand:QI 1 "register_operand" "r")))]
1215 "! TARGET_BWX"
1216 "and %1,0xff,%0"
1217 [(set_attr "type" "ilog")])
1218
1219 (define_expand "zero_extendqisi2"
1220 [(set (match_operand:SI 0 "register_operand" "")
1221 (zero_extend:SI (match_operand:QI 1 "nonimmediate_operand" "")))]
1222 ""
1223 {
1224 if (! TARGET_BWX)
1225 operands[1] = force_reg (QImode, operands[1]);
1226 })
1227
1228 (define_insn "*zero_extendqisi2_bwx"
1229 [(set (match_operand:SI 0 "register_operand" "=r,r")
1230 (zero_extend:SI (match_operand:QI 1 "nonimmediate_operand" "r,m")))]
1231 "TARGET_BWX"
1232 "@
1233 and %1,0xff,%0
1234 ldbu %0,%1"
1235 [(set_attr "type" "ilog,ild")])
1236
1237 (define_insn "*zero_extendqisi2_nobwx"
1238 [(set (match_operand:SI 0 "register_operand" "=r")
1239 (zero_extend:SI (match_operand:QI 1 "register_operand" "r")))]
1240 "! TARGET_BWX"
1241 "and %1,0xff,%0"
1242 [(set_attr "type" "ilog")])
1243
1244 (define_expand "zero_extendqidi2"
1245 [(set (match_operand:DI 0 "register_operand" "")
1246 (zero_extend:DI (match_operand:QI 1 "nonimmediate_operand" "")))]
1247 ""
1248 {
1249 if (! TARGET_BWX)
1250 operands[1] = force_reg (QImode, operands[1]);
1251 })
1252
1253 (define_insn "*zero_extendqidi2_bwx"
1254 [(set (match_operand:DI 0 "register_operand" "=r,r")
1255 (zero_extend:DI (match_operand:QI 1 "nonimmediate_operand" "r,m")))]
1256 "TARGET_BWX"
1257 "@
1258 and %1,0xff,%0
1259 ldbu %0,%1"
1260 [(set_attr "type" "ilog,ild")])
1261
1262 (define_insn "*zero_extendqidi2_nobwx"
1263 [(set (match_operand:DI 0 "register_operand" "=r")
1264 (zero_extend:DI (match_operand:QI 1 "register_operand" "r")))]
1265 "! TARGET_BWX"
1266 "and %1,0xff,%0"
1267 [(set_attr "type" "ilog")])
1268
1269 (define_expand "zero_extendhisi2"
1270 [(set (match_operand:SI 0 "register_operand" "")
1271 (zero_extend:SI (match_operand:HI 1 "nonimmediate_operand" "")))]
1272 ""
1273 {
1274 if (! TARGET_BWX)
1275 operands[1] = force_reg (HImode, operands[1]);
1276 })
1277
1278 (define_insn "*zero_extendhisi2_bwx"
1279 [(set (match_operand:SI 0 "register_operand" "=r,r")
1280 (zero_extend:SI (match_operand:HI 1 "nonimmediate_operand" "r,m")))]
1281 "TARGET_BWX"
1282 "@
1283 zapnot %1,3,%0
1284 ldwu %0,%1"
1285 [(set_attr "type" "shift,ild")])
1286
1287 (define_insn "*zero_extendhisi2_nobwx"
1288 [(set (match_operand:SI 0 "register_operand" "=r")
1289 (zero_extend:SI (match_operand:HI 1 "register_operand" "r")))]
1290 "! TARGET_BWX"
1291 "zapnot %1,3,%0"
1292 [(set_attr "type" "shift")])
1293
1294 (define_expand "zero_extendhidi2"
1295 [(set (match_operand:DI 0 "register_operand" "")
1296 (zero_extend:DI (match_operand:HI 1 "nonimmediate_operand" "")))]
1297 ""
1298 {
1299 if (! TARGET_BWX)
1300 operands[1] = force_reg (HImode, operands[1]);
1301 })
1302
1303 (define_insn "*zero_extendhidi2_bwx"
1304 [(set (match_operand:DI 0 "register_operand" "=r,r")
1305 (zero_extend:DI (match_operand:HI 1 "nonimmediate_operand" "r,m")))]
1306 "TARGET_BWX"
1307 "@
1308 zapnot %1,3,%0
1309 ldwu %0,%1"
1310 [(set_attr "type" "shift,ild")])
1311
1312 (define_insn "*zero_extendhidi2_nobwx"
1313 [(set (match_operand:DI 0 "register_operand" "=r")
1314 (zero_extend:DI (match_operand:HI 1 "register_operand" "r")))]
1315 ""
1316 "zapnot %1,3,%0"
1317 [(set_attr "type" "shift")])
1318
1319 (define_insn "zero_extendsidi2"
1320 [(set (match_operand:DI 0 "register_operand" "=r")
1321 (zero_extend:DI (match_operand:SI 1 "register_operand" "r")))]
1322 ""
1323 "zapnot %1,15,%0"
1324 [(set_attr "type" "shift")])
1325
1326 (define_insn "andnotdi3"
1327 [(set (match_operand:DI 0 "register_operand" "=r")
1328 (and:DI (not:DI (match_operand:DI 1 "reg_or_8bit_operand" "rI"))
1329 (match_operand:DI 2 "reg_or_0_operand" "rJ")))]
1330 ""
1331 "bic %r2,%1,%0"
1332 [(set_attr "type" "ilog")])
1333
1334 (define_insn "iordi3"
1335 [(set (match_operand:DI 0 "register_operand" "=r,r")
1336 (ior:DI (match_operand:DI 1 "reg_or_0_operand" "%rJ,rJ")
1337 (match_operand:DI 2 "or_operand" "rI,N")))]
1338 ""
1339 "@
1340 bis %r1,%2,%0
1341 ornot %r1,%N2,%0"
1342 [(set_attr "type" "ilog")])
1343
1344 (define_insn "one_cmpldi2"
1345 [(set (match_operand:DI 0 "register_operand" "=r")
1346 (not:DI (match_operand:DI 1 "reg_or_8bit_operand" "rI")))]
1347 ""
1348 "ornot $31,%1,%0"
1349 [(set_attr "type" "ilog")])
1350
1351 (define_insn "*iornot"
1352 [(set (match_operand:DI 0 "register_operand" "=r")
1353 (ior:DI (not:DI (match_operand:DI 1 "reg_or_8bit_operand" "rI"))
1354 (match_operand:DI 2 "reg_or_0_operand" "rJ")))]
1355 ""
1356 "ornot %r2,%1,%0"
1357 [(set_attr "type" "ilog")])
1358
1359 (define_insn "xordi3"
1360 [(set (match_operand:DI 0 "register_operand" "=r,r")
1361 (xor:DI (match_operand:DI 1 "reg_or_0_operand" "%rJ,rJ")
1362 (match_operand:DI 2 "or_operand" "rI,N")))]
1363 ""
1364 "@
1365 xor %r1,%2,%0
1366 eqv %r1,%N2,%0"
1367 [(set_attr "type" "ilog")])
1368
1369 (define_insn "*xornot"
1370 [(set (match_operand:DI 0 "register_operand" "=r")
1371 (not:DI (xor:DI (match_operand:DI 1 "register_operand" "%rJ")
1372 (match_operand:DI 2 "register_operand" "rI"))))]
1373 ""
1374 "eqv %r1,%2,%0"
1375 [(set_attr "type" "ilog")])
1376 \f
1377 ;; Handle the FFS insn iff we support CIX.
1378
1379 (define_expand "ffsdi2"
1380 [(set (match_dup 2)
1381 (unspec:DI [(match_operand:DI 1 "register_operand" "")] UNSPEC_CTTZ))
1382 (set (match_dup 3)
1383 (plus:DI (match_dup 2) (const_int 1)))
1384 (set (match_operand:DI 0 "register_operand" "")
1385 (if_then_else:DI (eq (match_dup 1) (const_int 0))
1386 (const_int 0) (match_dup 3)))]
1387 "TARGET_CIX"
1388 {
1389 operands[2] = gen_reg_rtx (DImode);
1390 operands[3] = gen_reg_rtx (DImode);
1391 })
1392
1393 (define_insn "*cttz"
1394 [(set (match_operand:DI 0 "register_operand" "=r")
1395 (unspec:DI [(match_operand:DI 1 "register_operand" "r")] UNSPEC_CTTZ))]
1396 "TARGET_CIX"
1397 "cttz %1,%0"
1398 ; EV6 calls all mvi and cttz/ctlz/popc class imisc, so just
1399 ; reuse the existing type name.
1400 [(set_attr "type" "mvi")])
1401 \f
1402 ;; Next come the shifts and the various extract and insert operations.
1403
1404 (define_insn "ashldi3"
1405 [(set (match_operand:DI 0 "register_operand" "=r,r")
1406 (ashift:DI (match_operand:DI 1 "reg_or_0_operand" "rJ,rJ")
1407 (match_operand:DI 2 "reg_or_6bit_operand" "P,rS")))]
1408 ""
1409 {
1410 switch (which_alternative)
1411 {
1412 case 0:
1413 if (operands[2] == const1_rtx)
1414 return "addq %r1,%r1,%0";
1415 else
1416 return "s%P2addq %r1,0,%0";
1417 case 1:
1418 return "sll %r1,%2,%0";
1419 default:
1420 abort();
1421 }
1422 }
1423 [(set_attr "type" "iadd,shift")])
1424
1425 ;; ??? The following pattern is made by combine, but earlier phases
1426 ;; (specifically flow) can't handle it. This occurs in jump.c. Deal
1427 ;; with this in a better way at some point.
1428 ;;(define_insn ""
1429 ;; [(set (match_operand:DI 0 "register_operand" "=r")
1430 ;; (sign_extend:DI
1431 ;; (subreg:SI (ashift:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
1432 ;; (match_operand:DI 2 "const_int_operand" "P"))
1433 ;; 0)))]
1434 ;; "INTVAL (operands[2]) >= 1 && INTVAL (operands[2]) <= 3"
1435 ;;{
1436 ;; if (operands[2] == const1_rtx)
1437 ;; return "addl %r1,%r1,%0";
1438 ;; else
1439 ;; return "s%P2addl %r1,0,%0";
1440 ;;}
1441 ;; [(set_attr "type" "iadd")])
1442
1443 (define_insn "lshrdi3"
1444 [(set (match_operand:DI 0 "register_operand" "=r")
1445 (lshiftrt:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
1446 (match_operand:DI 2 "reg_or_6bit_operand" "rS")))]
1447 ""
1448 "srl %r1,%2,%0"
1449 [(set_attr "type" "shift")])
1450
1451 (define_insn "ashrdi3"
1452 [(set (match_operand:DI 0 "register_operand" "=r")
1453 (ashiftrt:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
1454 (match_operand:DI 2 "reg_or_6bit_operand" "rS")))]
1455 ""
1456 "sra %r1,%2,%0"
1457 [(set_attr "type" "shift")])
1458
1459 (define_expand "extendqihi2"
1460 [(set (match_dup 2)
1461 (ashift:DI (match_operand:QI 1 "some_operand" "")
1462 (const_int 56)))
1463 (set (match_operand:HI 0 "register_operand" "")
1464 (ashiftrt:DI (match_dup 2)
1465 (const_int 56)))]
1466 ""
1467 {
1468 if (TARGET_BWX)
1469 {
1470 emit_insn (gen_extendqihi2x (operands[0],
1471 force_reg (QImode, operands[1])));
1472 DONE;
1473 }
1474
1475 /* If we have an unaligned MEM, extend to DImode (which we do
1476 specially) and then copy to the result. */
1477 if (unaligned_memory_operand (operands[1], HImode))
1478 {
1479 rtx temp = gen_reg_rtx (DImode);
1480
1481 emit_insn (gen_extendqidi2 (temp, operands[1]));
1482 emit_move_insn (operands[0], gen_lowpart (HImode, temp));
1483 DONE;
1484 }
1485
1486 operands[0] = gen_lowpart (DImode, operands[0]);
1487 operands[1] = gen_lowpart (DImode, force_reg (QImode, operands[1]));
1488 operands[2] = gen_reg_rtx (DImode);
1489 })
1490
1491 (define_insn "extendqidi2x"
1492 [(set (match_operand:DI 0 "register_operand" "=r")
1493 (sign_extend:DI (match_operand:QI 1 "register_operand" "r")))]
1494 "TARGET_BWX"
1495 "sextb %1,%0"
1496 [(set_attr "type" "shift")])
1497
1498 (define_insn "extendhidi2x"
1499 [(set (match_operand:DI 0 "register_operand" "=r")
1500 (sign_extend:DI (match_operand:HI 1 "register_operand" "r")))]
1501 "TARGET_BWX"
1502 "sextw %1,%0"
1503 [(set_attr "type" "shift")])
1504
1505 (define_insn "extendqisi2x"
1506 [(set (match_operand:SI 0 "register_operand" "=r")
1507 (sign_extend:SI (match_operand:QI 1 "register_operand" "r")))]
1508 "TARGET_BWX"
1509 "sextb %1,%0"
1510 [(set_attr "type" "shift")])
1511
1512 (define_insn "extendhisi2x"
1513 [(set (match_operand:SI 0 "register_operand" "=r")
1514 (sign_extend:SI (match_operand:HI 1 "register_operand" "r")))]
1515 "TARGET_BWX"
1516 "sextw %1,%0"
1517 [(set_attr "type" "shift")])
1518
1519 (define_insn "extendqihi2x"
1520 [(set (match_operand:HI 0 "register_operand" "=r")
1521 (sign_extend:HI (match_operand:QI 1 "register_operand" "r")))]
1522 "TARGET_BWX"
1523 "sextb %1,%0"
1524 [(set_attr "type" "shift")])
1525
1526 (define_expand "extendqisi2"
1527 [(set (match_dup 2)
1528 (ashift:DI (match_operand:QI 1 "some_operand" "")
1529 (const_int 56)))
1530 (set (match_operand:SI 0 "register_operand" "")
1531 (ashiftrt:DI (match_dup 2)
1532 (const_int 56)))]
1533 ""
1534 {
1535 if (TARGET_BWX)
1536 {
1537 emit_insn (gen_extendqisi2x (operands[0],
1538 force_reg (QImode, operands[1])));
1539 DONE;
1540 }
1541
1542 /* If we have an unaligned MEM, extend to a DImode form of
1543 the result (which we do specially). */
1544 if (unaligned_memory_operand (operands[1], QImode))
1545 {
1546 rtx temp = gen_reg_rtx (DImode);
1547
1548 emit_insn (gen_extendqidi2 (temp, operands[1]));
1549 emit_move_insn (operands[0], gen_lowpart (SImode, temp));
1550 DONE;
1551 }
1552
1553 operands[0] = gen_lowpart (DImode, operands[0]);
1554 operands[1] = gen_lowpart (DImode, force_reg (QImode, operands[1]));
1555 operands[2] = gen_reg_rtx (DImode);
1556 })
1557
1558 (define_expand "extendqidi2"
1559 [(set (match_dup 2)
1560 (ashift:DI (match_operand:QI 1 "some_operand" "")
1561 (const_int 56)))
1562 (set (match_operand:DI 0 "register_operand" "")
1563 (ashiftrt:DI (match_dup 2)
1564 (const_int 56)))]
1565 ""
1566 {
1567 if (TARGET_BWX)
1568 {
1569 emit_insn (gen_extendqidi2x (operands[0],
1570 force_reg (QImode, operands[1])));
1571 DONE;
1572 }
1573
1574 if (unaligned_memory_operand (operands[1], QImode))
1575 {
1576 rtx seq
1577 = gen_unaligned_extendqidi (operands[0],
1578 get_unaligned_address (operands[1], 1));
1579
1580 alpha_set_memflags (seq, operands[1]);
1581 emit_insn (seq);
1582 DONE;
1583 }
1584
1585 operands[1] = gen_lowpart (DImode, force_reg (QImode, operands[1]));
1586 operands[2] = gen_reg_rtx (DImode);
1587 })
1588
1589 (define_expand "extendhisi2"
1590 [(set (match_dup 2)
1591 (ashift:DI (match_operand:HI 1 "some_operand" "")
1592 (const_int 48)))
1593 (set (match_operand:SI 0 "register_operand" "")
1594 (ashiftrt:DI (match_dup 2)
1595 (const_int 48)))]
1596 ""
1597 {
1598 if (TARGET_BWX)
1599 {
1600 emit_insn (gen_extendhisi2x (operands[0],
1601 force_reg (HImode, operands[1])));
1602 DONE;
1603 }
1604
1605 /* If we have an unaligned MEM, extend to a DImode form of
1606 the result (which we do specially). */
1607 if (unaligned_memory_operand (operands[1], HImode))
1608 {
1609 rtx temp = gen_reg_rtx (DImode);
1610
1611 emit_insn (gen_extendhidi2 (temp, operands[1]));
1612 emit_move_insn (operands[0], gen_lowpart (SImode, temp));
1613 DONE;
1614 }
1615
1616 operands[0] = gen_lowpart (DImode, operands[0]);
1617 operands[1] = gen_lowpart (DImode, force_reg (HImode, operands[1]));
1618 operands[2] = gen_reg_rtx (DImode);
1619 })
1620
1621 (define_expand "extendhidi2"
1622 [(set (match_dup 2)
1623 (ashift:DI (match_operand:HI 1 "some_operand" "")
1624 (const_int 48)))
1625 (set (match_operand:DI 0 "register_operand" "")
1626 (ashiftrt:DI (match_dup 2)
1627 (const_int 48)))]
1628 ""
1629 {
1630 if (TARGET_BWX)
1631 {
1632 emit_insn (gen_extendhidi2x (operands[0],
1633 force_reg (HImode, operands[1])));
1634 DONE;
1635 }
1636
1637 if (unaligned_memory_operand (operands[1], HImode))
1638 {
1639 rtx seq
1640 = gen_unaligned_extendhidi (operands[0],
1641 get_unaligned_address (operands[1], 2));
1642
1643 alpha_set_memflags (seq, operands[1]);
1644 emit_insn (seq);
1645 DONE;
1646 }
1647
1648 operands[1] = gen_lowpart (DImode, force_reg (HImode, operands[1]));
1649 operands[2] = gen_reg_rtx (DImode);
1650 })
1651
1652 ;; Here's how we sign extend an unaligned byte and halfword. Doing this
1653 ;; as a pattern saves one instruction. The code is similar to that for
1654 ;; the unaligned loads (see below).
1655 ;;
1656 ;; Operand 1 is the address + 1 (+2 for HI), operand 0 is the result.
1657 (define_expand "unaligned_extendqidi"
1658 [(set (match_dup 2) (match_operand:DI 1 "address_operand" ""))
1659 (set (match_dup 3)
1660 (mem:DI (and:DI (plus:DI (match_dup 2) (const_int -1))
1661 (const_int -8))))
1662 (set (match_dup 4)
1663 (ashift:DI (match_dup 3)
1664 (minus:DI (const_int 64)
1665 (ashift:DI
1666 (and:DI (match_dup 2) (const_int 7))
1667 (const_int 3)))))
1668 (set (subreg:DI (match_operand:QI 0 "register_operand" "") 0)
1669 (ashiftrt:DI (match_dup 4) (const_int 56)))]
1670 ""
1671 {
1672 operands[2] = gen_reg_rtx (DImode);
1673 operands[3] = gen_reg_rtx (DImode);
1674 operands[4] = gen_reg_rtx (DImode);
1675 })
1676
1677 (define_expand "unaligned_extendhidi"
1678 [(set (match_dup 2) (match_operand:DI 1 "address_operand" ""))
1679 (set (match_dup 3)
1680 (mem:DI (and:DI (plus:DI (match_dup 2) (const_int -2))
1681 (const_int -8))))
1682 (set (match_dup 4)
1683 (ashift:DI (match_dup 3)
1684 (minus:DI (const_int 64)
1685 (ashift:DI
1686 (and:DI (match_dup 2) (const_int 7))
1687 (const_int 3)))))
1688 (set (subreg:DI (match_operand:QI 0 "register_operand" "") 0)
1689 (ashiftrt:DI (match_dup 4) (const_int 48)))]
1690 ""
1691 {
1692 operands[2] = gen_reg_rtx (DImode);
1693 operands[3] = gen_reg_rtx (DImode);
1694 operands[4] = gen_reg_rtx (DImode);
1695 })
1696
1697 (define_insn "*extxl_const"
1698 [(set (match_operand:DI 0 "register_operand" "=r")
1699 (zero_extract:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
1700 (match_operand:DI 2 "mode_width_operand" "n")
1701 (match_operand:DI 3 "mul8_operand" "I")))]
1702 ""
1703 "ext%M2l %r1,%s3,%0"
1704 [(set_attr "type" "shift")])
1705
1706 (define_insn "extxl"
1707 [(set (match_operand:DI 0 "register_operand" "=r")
1708 (zero_extract:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
1709 (match_operand:DI 2 "mode_width_operand" "n")
1710 (ashift:DI (match_operand:DI 3 "reg_or_8bit_operand" "rI")
1711 (const_int 3))))]
1712 ""
1713 "ext%M2l %r1,%3,%0"
1714 [(set_attr "type" "shift")])
1715
1716 ;; Combine has some strange notion of preserving existing undefined behaviour
1717 ;; in shifts larger than a word size. So capture these patterns that it
1718 ;; should have turned into zero_extracts.
1719
1720 (define_insn "*extxl_1"
1721 [(set (match_operand:DI 0 "register_operand" "=r")
1722 (and:DI (lshiftrt:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
1723 (ashift:DI (match_operand:DI 2 "reg_or_8bit_operand" "rI")
1724 (const_int 3)))
1725 (match_operand:DI 3 "mode_mask_operand" "n")))]
1726 ""
1727 "ext%U3l %1,%2,%0"
1728 [(set_attr "type" "shift")])
1729
1730 (define_insn "*extql_2"
1731 [(set (match_operand:DI 0 "register_operand" "=r")
1732 (lshiftrt:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
1733 (ashift:DI (match_operand:DI 2 "reg_or_8bit_operand" "rI")
1734 (const_int 3))))]
1735 ""
1736 "extql %1,%2,%0"
1737 [(set_attr "type" "shift")])
1738
1739 (define_insn "extqh"
1740 [(set (match_operand:DI 0 "register_operand" "=r")
1741 (ashift:DI
1742 (match_operand:DI 1 "reg_or_0_operand" "rJ")
1743 (minus:DI (const_int 64)
1744 (ashift:DI
1745 (and:DI
1746 (match_operand:DI 2 "reg_or_8bit_operand" "rI")
1747 (const_int 7))
1748 (const_int 3)))))]
1749 ""
1750 "extqh %r1,%2,%0"
1751 [(set_attr "type" "shift")])
1752
1753 (define_insn "extlh"
1754 [(set (match_operand:DI 0 "register_operand" "=r")
1755 (ashift:DI
1756 (and:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
1757 (const_int 2147483647))
1758 (minus:DI (const_int 64)
1759 (ashift:DI
1760 (and:DI
1761 (match_operand:DI 2 "reg_or_8bit_operand" "rI")
1762 (const_int 7))
1763 (const_int 3)))))]
1764 ""
1765 "extlh %r1,%2,%0"
1766 [(set_attr "type" "shift")])
1767
1768 (define_insn "extwh"
1769 [(set (match_operand:DI 0 "register_operand" "=r")
1770 (ashift:DI
1771 (and:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
1772 (const_int 65535))
1773 (minus:DI (const_int 64)
1774 (ashift:DI
1775 (and:DI
1776 (match_operand:DI 2 "reg_or_8bit_operand" "rI")
1777 (const_int 7))
1778 (const_int 3)))))]
1779 ""
1780 "extwh %r1,%2,%0"
1781 [(set_attr "type" "shift")])
1782
1783 ;; This converts an extXl into an extXh with an appropriate adjustment
1784 ;; to the address calculation.
1785
1786 ;;(define_split
1787 ;; [(set (match_operand:DI 0 "register_operand" "")
1788 ;; (ashift:DI (zero_extract:DI (match_operand:DI 1 "register_operand" "")
1789 ;; (match_operand:DI 2 "mode_width_operand" "")
1790 ;; (ashift:DI (match_operand:DI 3 "" "")
1791 ;; (const_int 3)))
1792 ;; (match_operand:DI 4 "const_int_operand" "")))
1793 ;; (clobber (match_operand:DI 5 "register_operand" ""))]
1794 ;; "INTVAL (operands[4]) == 64 - INTVAL (operands[2])"
1795 ;; [(set (match_dup 5) (match_dup 6))
1796 ;; (set (match_dup 0)
1797 ;; (ashift:DI (zero_extract:DI (match_dup 1) (match_dup 2)
1798 ;; (ashift:DI (plus:DI (match_dup 5)
1799 ;; (match_dup 7))
1800 ;; (const_int 3)))
1801 ;; (match_dup 4)))]
1802 ;; "
1803 ;;{
1804 ;; operands[6] = plus_constant (operands[3],
1805 ;; INTVAL (operands[2]) / BITS_PER_UNIT);
1806 ;; operands[7] = GEN_INT (- INTVAL (operands[2]) / BITS_PER_UNIT);
1807 ;;}")
1808
1809 (define_insn "*insbl_const"
1810 [(set (match_operand:DI 0 "register_operand" "=r")
1811 (ashift:DI (zero_extend:DI (match_operand:QI 1 "register_operand" "r"))
1812 (match_operand:DI 2 "mul8_operand" "I")))]
1813 ""
1814 "insbl %1,%s2,%0"
1815 [(set_attr "type" "shift")])
1816
1817 (define_insn "*inswl_const"
1818 [(set (match_operand:DI 0 "register_operand" "=r")
1819 (ashift:DI (zero_extend:DI (match_operand:HI 1 "register_operand" "r"))
1820 (match_operand:DI 2 "mul8_operand" "I")))]
1821 ""
1822 "inswl %1,%s2,%0"
1823 [(set_attr "type" "shift")])
1824
1825 (define_insn "*insll_const"
1826 [(set (match_operand:DI 0 "register_operand" "=r")
1827 (ashift:DI (zero_extend:DI (match_operand:SI 1 "register_operand" "r"))
1828 (match_operand:DI 2 "mul8_operand" "I")))]
1829 ""
1830 "insll %1,%s2,%0"
1831 [(set_attr "type" "shift")])
1832
1833 (define_insn "insbl"
1834 [(set (match_operand:DI 0 "register_operand" "=r")
1835 (ashift:DI (zero_extend:DI (match_operand:QI 1 "register_operand" "r"))
1836 (ashift:DI (match_operand:DI 2 "reg_or_8bit_operand" "rI")
1837 (const_int 3))))]
1838 ""
1839 "insbl %1,%2,%0"
1840 [(set_attr "type" "shift")])
1841
1842 (define_insn "inswl"
1843 [(set (match_operand:DI 0 "register_operand" "=r")
1844 (ashift:DI (zero_extend:DI (match_operand:HI 1 "register_operand" "r"))
1845 (ashift:DI (match_operand:DI 2 "reg_or_8bit_operand" "rI")
1846 (const_int 3))))]
1847 ""
1848 "inswl %1,%2,%0"
1849 [(set_attr "type" "shift")])
1850
1851 (define_insn "insll"
1852 [(set (match_operand:DI 0 "register_operand" "=r")
1853 (ashift:DI (zero_extend:DI (match_operand:SI 1 "register_operand" "r"))
1854 (ashift:DI (match_operand:DI 2 "reg_or_8bit_operand" "rI")
1855 (const_int 3))))]
1856 ""
1857 "insll %1,%2,%0"
1858 [(set_attr "type" "shift")])
1859
1860 (define_insn "insql"
1861 [(set (match_operand:DI 0 "register_operand" "=r")
1862 (ashift:DI (match_operand:DI 1 "register_operand" "r")
1863 (ashift:DI (match_operand:DI 2 "reg_or_8bit_operand" "rI")
1864 (const_int 3))))]
1865 ""
1866 "insql %1,%2,%0"
1867 [(set_attr "type" "shift")])
1868
1869 ;; Combine has this sometimes habit of moving the and outside of the
1870 ;; shift, making life more interesting.
1871
1872 (define_insn "*insxl"
1873 [(set (match_operand:DI 0 "register_operand" "=r")
1874 (and:DI (ashift:DI (match_operand:DI 1 "register_operand" "r")
1875 (match_operand:DI 2 "mul8_operand" "I"))
1876 (match_operand:DI 3 "immediate_operand" "i")))]
1877 "HOST_BITS_PER_WIDE_INT == 64
1878 && GET_CODE (operands[3]) == CONST_INT
1879 && (((unsigned HOST_WIDE_INT) 0xff << INTVAL (operands[2])
1880 == (unsigned HOST_WIDE_INT) INTVAL (operands[3]))
1881 || ((unsigned HOST_WIDE_INT) 0xffff << INTVAL (operands[2])
1882 == (unsigned HOST_WIDE_INT) INTVAL (operands[3]))
1883 || ((unsigned HOST_WIDE_INT) 0xffffffff << INTVAL (operands[2])
1884 == (unsigned HOST_WIDE_INT) INTVAL (operands[3])))"
1885 {
1886 #if HOST_BITS_PER_WIDE_INT == 64
1887 if ((unsigned HOST_WIDE_INT) 0xff << INTVAL (operands[2])
1888 == (unsigned HOST_WIDE_INT) INTVAL (operands[3]))
1889 return "insbl %1,%s2,%0";
1890 if ((unsigned HOST_WIDE_INT) 0xffff << INTVAL (operands[2])
1891 == (unsigned HOST_WIDE_INT) INTVAL (operands[3]))
1892 return "inswl %1,%s2,%0";
1893 if ((unsigned HOST_WIDE_INT) 0xffffffff << INTVAL (operands[2])
1894 == (unsigned HOST_WIDE_INT) INTVAL (operands[3]))
1895 return "insll %1,%s2,%0";
1896 #endif
1897 abort();
1898 }
1899 [(set_attr "type" "shift")])
1900
1901 ;; We do not include the insXh insns because they are complex to express
1902 ;; and it does not appear that we would ever want to generate them.
1903 ;;
1904 ;; Since we need them for block moves, though, cop out and use unspec.
1905
1906 (define_insn "insxh"
1907 [(set (match_operand:DI 0 "register_operand" "=r")
1908 (unspec:DI [(match_operand:DI 1 "register_operand" "r")
1909 (match_operand:DI 2 "mode_width_operand" "n")
1910 (match_operand:DI 3 "reg_or_8bit_operand" "rI")]
1911 UNSPEC_INSXH))]
1912 ""
1913 "ins%M2h %1,%3,%0"
1914 [(set_attr "type" "shift")])
1915
1916 (define_insn "mskxl"
1917 [(set (match_operand:DI 0 "register_operand" "=r")
1918 (and:DI (not:DI (ashift:DI
1919 (match_operand:DI 2 "mode_mask_operand" "n")
1920 (ashift:DI
1921 (match_operand:DI 3 "reg_or_8bit_operand" "rI")
1922 (const_int 3))))
1923 (match_operand:DI 1 "reg_or_0_operand" "rJ")))]
1924 ""
1925 "msk%U2l %r1,%3,%0"
1926 [(set_attr "type" "shift")])
1927
1928 ;; We do not include the mskXh insns because it does not appear we would
1929 ;; ever generate one.
1930 ;;
1931 ;; Again, we do for block moves and we use unspec again.
1932
1933 (define_insn "mskxh"
1934 [(set (match_operand:DI 0 "register_operand" "=r")
1935 (unspec:DI [(match_operand:DI 1 "register_operand" "r")
1936 (match_operand:DI 2 "mode_width_operand" "n")
1937 (match_operand:DI 3 "reg_or_8bit_operand" "rI")]
1938 UNSPEC_MSKXH))]
1939 ""
1940 "msk%M2h %1,%3,%0"
1941 [(set_attr "type" "shift")])
1942
1943 ;; Prefer AND + NE over LSHIFTRT + AND.
1944
1945 (define_insn_and_split "*ze_and_ne"
1946 [(set (match_operand:DI 0 "register_operand" "=r")
1947 (zero_extract:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
1948 (const_int 1)
1949 (match_operand 2 "const_int_operand" "I")))]
1950 "(unsigned HOST_WIDE_INT) INTVAL (operands[2]) < 8"
1951 "#"
1952 "(unsigned HOST_WIDE_INT) INTVAL (operands[2]) < 8"
1953 [(set (match_dup 0)
1954 (and:DI (match_dup 1) (match_dup 3)))
1955 (set (match_dup 0)
1956 (ne:DI (match_dup 0) (const_int 0)))]
1957 "operands[3] = GEN_INT (1 << INTVAL (operands[2]));")
1958 \f
1959 ;; Floating-point operations. All the double-precision insns can extend
1960 ;; from single, so indicate that. The exception are the ones that simply
1961 ;; play with the sign bits; it's not clear what to do there.
1962
1963 (define_insn "abssf2"
1964 [(set (match_operand:SF 0 "register_operand" "=f")
1965 (abs:SF (match_operand:SF 1 "reg_or_fp0_operand" "fG")))]
1966 "TARGET_FP"
1967 "cpys $f31,%R1,%0"
1968 [(set_attr "type" "fcpys")])
1969
1970 (define_insn "*nabssf2"
1971 [(set (match_operand:SF 0 "register_operand" "=f")
1972 (neg:SF (abs:SF (match_operand:SF 1 "reg_or_fp0_operand" "fG"))))]
1973 "TARGET_FP"
1974 "cpysn $f31,%R1,%0"
1975 [(set_attr "type" "fadd")])
1976
1977 (define_insn "absdf2"
1978 [(set (match_operand:DF 0 "register_operand" "=f")
1979 (abs:DF (match_operand:DF 1 "reg_or_fp0_operand" "fG")))]
1980 "TARGET_FP"
1981 "cpys $f31,%R1,%0"
1982 [(set_attr "type" "fcpys")])
1983
1984 (define_insn "*nabsdf2"
1985 [(set (match_operand:DF 0 "register_operand" "=f")
1986 (neg:DF (abs:DF (match_operand:DF 1 "reg_or_fp0_operand" "fG"))))]
1987 "TARGET_FP"
1988 "cpysn $f31,%R1,%0"
1989 [(set_attr "type" "fadd")])
1990
1991 (define_expand "abstf2"
1992 [(parallel [(set (match_operand:TF 0 "register_operand" "")
1993 (neg:TF (match_operand:TF 1 "reg_or_fp0_operand" "")))
1994 (use (match_dup 2))])]
1995 "TARGET_HAS_XFLOATING_LIBS"
1996 {
1997 #if HOST_BITS_PER_WIDE_INT >= 64
1998 operands[2] = force_reg (DImode, GEN_INT (0x8000000000000000));
1999 #else
2000 operands[2] = force_reg (DImode, immed_double_const (0, 0x80000000, DImode));
2001 #endif
2002 })
2003
2004 (define_insn_and_split "*abstf_internal"
2005 [(set (match_operand:TF 0 "register_operand" "=r")
2006 (abs:TF (match_operand:TF 1 "reg_or_fp0_operand" "rG")))
2007 (use (match_operand:DI 2 "register_operand" "r"))]
2008 "TARGET_HAS_XFLOATING_LIBS"
2009 "#"
2010 "&& reload_completed"
2011 [(const_int 0)]
2012 "alpha_split_tfmode_frobsign (operands, gen_andnotdi3); DONE;")
2013
2014 (define_insn "negsf2"
2015 [(set (match_operand:SF 0 "register_operand" "=f")
2016 (neg:SF (match_operand:SF 1 "reg_or_fp0_operand" "fG")))]
2017 "TARGET_FP"
2018 "cpysn %R1,%R1,%0"
2019 [(set_attr "type" "fadd")])
2020
2021 (define_insn "negdf2"
2022 [(set (match_operand:DF 0 "register_operand" "=f")
2023 (neg:DF (match_operand:DF 1 "reg_or_fp0_operand" "fG")))]
2024 "TARGET_FP"
2025 "cpysn %R1,%R1,%0"
2026 [(set_attr "type" "fadd")])
2027
2028 (define_expand "negtf2"
2029 [(parallel [(set (match_operand:TF 0 "register_operand" "")
2030 (neg:TF (match_operand:TF 1 "reg_or_fp0_operand" "")))
2031 (use (match_dup 2))])]
2032 "TARGET_HAS_XFLOATING_LIBS"
2033 {
2034 #if HOST_BITS_PER_WIDE_INT >= 64
2035 operands[2] = force_reg (DImode, GEN_INT (0x8000000000000000));
2036 #else
2037 operands[2] = force_reg (DImode, immed_double_const (0, 0x80000000, DImode));
2038 #endif
2039 })
2040
2041 (define_insn_and_split "*negtf_internal"
2042 [(set (match_operand:TF 0 "register_operand" "=r")
2043 (neg:TF (match_operand:TF 1 "reg_or_fp0_operand" "rG")))
2044 (use (match_operand:DI 2 "register_operand" "r"))]
2045 "TARGET_HAS_XFLOATING_LIBS"
2046 "#"
2047 "&& reload_completed"
2048 [(const_int 0)]
2049 "alpha_split_tfmode_frobsign (operands, gen_xordi3); DONE;")
2050
2051 (define_insn "*addsf_ieee"
2052 [(set (match_operand:SF 0 "register_operand" "=&f")
2053 (plus:SF (match_operand:SF 1 "reg_or_fp0_operand" "%fG")
2054 (match_operand:SF 2 "reg_or_fp0_operand" "fG")))]
2055 "TARGET_FP && alpha_fptm >= ALPHA_FPTM_SU"
2056 "add%,%/ %R1,%R2,%0"
2057 [(set_attr "type" "fadd")
2058 (set_attr "trap" "yes")
2059 (set_attr "round_suffix" "normal")
2060 (set_attr "trap_suffix" "u_su_sui")])
2061
2062 (define_insn "addsf3"
2063 [(set (match_operand:SF 0 "register_operand" "=f")
2064 (plus:SF (match_operand:SF 1 "reg_or_fp0_operand" "%fG")
2065 (match_operand:SF 2 "reg_or_fp0_operand" "fG")))]
2066 "TARGET_FP"
2067 "add%,%/ %R1,%R2,%0"
2068 [(set_attr "type" "fadd")
2069 (set_attr "trap" "yes")
2070 (set_attr "round_suffix" "normal")
2071 (set_attr "trap_suffix" "u_su_sui")])
2072
2073 (define_insn "*adddf_ieee"
2074 [(set (match_operand:DF 0 "register_operand" "=&f")
2075 (plus:DF (match_operand:DF 1 "reg_or_fp0_operand" "%fG")
2076 (match_operand:DF 2 "reg_or_fp0_operand" "fG")))]
2077 "TARGET_FP && alpha_fptm >= ALPHA_FPTM_SU"
2078 "add%-%/ %R1,%R2,%0"
2079 [(set_attr "type" "fadd")
2080 (set_attr "trap" "yes")
2081 (set_attr "round_suffix" "normal")
2082 (set_attr "trap_suffix" "u_su_sui")])
2083
2084 (define_insn "adddf3"
2085 [(set (match_operand:DF 0 "register_operand" "=f")
2086 (plus:DF (match_operand:DF 1 "reg_or_fp0_operand" "%fG")
2087 (match_operand:DF 2 "reg_or_fp0_operand" "fG")))]
2088 "TARGET_FP"
2089 "add%-%/ %R1,%R2,%0"
2090 [(set_attr "type" "fadd")
2091 (set_attr "trap" "yes")
2092 (set_attr "round_suffix" "normal")
2093 (set_attr "trap_suffix" "u_su_sui")])
2094
2095 (define_insn "*adddf_ext1"
2096 [(set (match_operand:DF 0 "register_operand" "=f")
2097 (plus:DF (float_extend:DF
2098 (match_operand:SF 1 "reg_or_fp0_operand" "fG"))
2099 (match_operand:DF 2 "reg_or_fp0_operand" "fG")))]
2100 "TARGET_FP && alpha_fptm < ALPHA_FPTM_SU"
2101 "add%-%/ %R1,%R2,%0"
2102 [(set_attr "type" "fadd")
2103 (set_attr "trap" "yes")
2104 (set_attr "round_suffix" "normal")
2105 (set_attr "trap_suffix" "u_su_sui")])
2106
2107 (define_insn "*adddf_ext2"
2108 [(set (match_operand:DF 0 "register_operand" "=f")
2109 (plus:DF (float_extend:DF
2110 (match_operand:SF 1 "reg_or_fp0_operand" "%fG"))
2111 (float_extend:DF
2112 (match_operand:SF 2 "reg_or_fp0_operand" "fG"))))]
2113 "TARGET_FP && alpha_fptm < ALPHA_FPTM_SU"
2114 "add%-%/ %R1,%R2,%0"
2115 [(set_attr "type" "fadd")
2116 (set_attr "trap" "yes")
2117 (set_attr "round_suffix" "normal")
2118 (set_attr "trap_suffix" "u_su_sui")])
2119
2120 (define_expand "addtf3"
2121 [(use (match_operand 0 "register_operand" ""))
2122 (use (match_operand 1 "general_operand" ""))
2123 (use (match_operand 2 "general_operand" ""))]
2124 "TARGET_HAS_XFLOATING_LIBS"
2125 "alpha_emit_xfloating_arith (PLUS, operands); DONE;")
2126
2127 ;; Define conversion operators between DFmode and SImode, using the cvtql
2128 ;; instruction. To allow combine et al to do useful things, we keep the
2129 ;; operation as a unit until after reload, at which point we split the
2130 ;; instructions.
2131 ;;
2132 ;; Note that we (attempt to) only consider this optimization when the
2133 ;; ultimate destination is memory. If we will be doing further integer
2134 ;; processing, it is cheaper to do the truncation in the int regs.
2135
2136 (define_insn "*cvtql"
2137 [(set (match_operand:SI 0 "register_operand" "=f")
2138 (unspec:SI [(match_operand:DI 1 "reg_or_fp0_operand" "fG")]
2139 UNSPEC_CVTQL))]
2140 "TARGET_FP"
2141 "cvtql%/ %R1,%0"
2142 [(set_attr "type" "fadd")
2143 (set_attr "trap" "yes")
2144 (set_attr "trap_suffix" "v_sv")])
2145
2146 (define_insn_and_split "*fix_truncdfsi_ieee"
2147 [(set (match_operand:SI 0 "memory_operand" "=m")
2148 (subreg:SI (fix:DI (match_operand:DF 1 "reg_or_fp0_operand" "fG")) 0))
2149 (clobber (match_scratch:DI 2 "=&f"))
2150 (clobber (match_scratch:SI 3 "=&f"))]
2151 "TARGET_FP && alpha_fptm >= ALPHA_FPTM_SU"
2152 "#"
2153 "&& reload_completed"
2154 [(set (match_dup 2) (fix:DI (match_dup 1)))
2155 (set (match_dup 3) (unspec:SI [(match_dup 2)] UNSPEC_CVTQL))
2156 (set (match_dup 0) (match_dup 3))]
2157 ""
2158 [(set_attr "type" "fadd")
2159 (set_attr "trap" "yes")])
2160
2161 (define_insn_and_split "*fix_truncdfsi_internal"
2162 [(set (match_operand:SI 0 "memory_operand" "=m")
2163 (subreg:SI (fix:DI (match_operand:DF 1 "reg_or_fp0_operand" "fG")) 0))
2164 (clobber (match_scratch:DI 2 "=f"))]
2165 "TARGET_FP && alpha_fptm < ALPHA_FPTM_SU"
2166 "#"
2167 "&& reload_completed"
2168 [(set (match_dup 2) (fix:DI (match_dup 1)))
2169 (set (match_dup 3) (unspec:SI [(match_dup 2)] UNSPEC_CVTQL))
2170 (set (match_dup 0) (match_dup 3))]
2171 ;; Due to REG_CANNOT_CHANGE_SIZE issues, we cannot simply use SUBREG.
2172 "operands[3] = gen_rtx_REG (SImode, REGNO (operands[2]));"
2173 [(set_attr "type" "fadd")
2174 (set_attr "trap" "yes")])
2175
2176 (define_insn "*fix_truncdfdi_ieee"
2177 [(set (match_operand:DI 0 "reg_no_subreg_operand" "=&f")
2178 (fix:DI (match_operand:DF 1 "reg_or_fp0_operand" "fG")))]
2179 "TARGET_FP && alpha_fptm >= ALPHA_FPTM_SU"
2180 "cvt%-q%/ %R1,%0"
2181 [(set_attr "type" "fadd")
2182 (set_attr "trap" "yes")
2183 (set_attr "round_suffix" "c")
2184 (set_attr "trap_suffix" "v_sv_svi")])
2185
2186 (define_insn "fix_truncdfdi2"
2187 [(set (match_operand:DI 0 "reg_no_subreg_operand" "=f")
2188 (fix:DI (match_operand:DF 1 "reg_or_fp0_operand" "fG")))]
2189 "TARGET_FP"
2190 "cvt%-q%/ %R1,%0"
2191 [(set_attr "type" "fadd")
2192 (set_attr "trap" "yes")
2193 (set_attr "round_suffix" "c")
2194 (set_attr "trap_suffix" "v_sv_svi")])
2195
2196 ;; Likewise between SFmode and SImode.
2197
2198 (define_insn_and_split "*fix_truncsfsi_ieee"
2199 [(set (match_operand:SI 0 "memory_operand" "=m")
2200 (subreg:SI (fix:DI (float_extend:DF
2201 (match_operand:SF 1 "reg_or_fp0_operand" "fG"))) 0))
2202 (clobber (match_scratch:DI 2 "=&f"))
2203 (clobber (match_scratch:SI 3 "=&f"))]
2204 "TARGET_FP && alpha_fptm >= ALPHA_FPTM_SU"
2205 "#"
2206 "&& reload_completed"
2207 [(set (match_dup 2) (fix:DI (float_extend:DF (match_dup 1))))
2208 (set (match_dup 3) (unspec:SI [(match_dup 2)] UNSPEC_CVTQL))
2209 (set (match_dup 0) (match_dup 3))]
2210 ""
2211 [(set_attr "type" "fadd")
2212 (set_attr "trap" "yes")])
2213
2214 (define_insn_and_split "*fix_truncsfsi_internal"
2215 [(set (match_operand:SI 0 "memory_operand" "=m")
2216 (subreg:SI (fix:DI (float_extend:DF
2217 (match_operand:SF 1 "reg_or_fp0_operand" "fG"))) 0))
2218 (clobber (match_scratch:DI 2 "=f"))]
2219 "TARGET_FP && alpha_fptm < ALPHA_FPTM_SU"
2220 "#"
2221 "&& reload_completed"
2222 [(set (match_dup 2) (fix:DI (float_extend:DF (match_dup 1))))
2223 (set (match_dup 3) (unspec:SI [(match_dup 2)] UNSPEC_CVTQL))
2224 (set (match_dup 0) (match_dup 3))]
2225 ;; Due to REG_CANNOT_CHANGE_SIZE issues, we cannot simply use SUBREG.
2226 "operands[3] = gen_rtx_REG (SImode, REGNO (operands[2]));"
2227 [(set_attr "type" "fadd")
2228 (set_attr "trap" "yes")])
2229
2230 (define_insn "*fix_truncsfdi_ieee"
2231 [(set (match_operand:DI 0 "reg_no_subreg_operand" "=&f")
2232 (fix:DI (float_extend:DF
2233 (match_operand:SF 1 "reg_or_fp0_operand" "fG"))))]
2234 "TARGET_FP && alpha_fptm >= ALPHA_FPTM_SU"
2235 "cvt%-q%/ %R1,%0"
2236 [(set_attr "type" "fadd")
2237 (set_attr "trap" "yes")
2238 (set_attr "round_suffix" "c")
2239 (set_attr "trap_suffix" "v_sv_svi")])
2240
2241 (define_insn "fix_truncsfdi2"
2242 [(set (match_operand:DI 0 "reg_no_subreg_operand" "=f")
2243 (fix:DI (float_extend:DF
2244 (match_operand:SF 1 "reg_or_fp0_operand" "fG"))))]
2245 "TARGET_FP"
2246 "cvt%-q%/ %R1,%0"
2247 [(set_attr "type" "fadd")
2248 (set_attr "trap" "yes")
2249 (set_attr "round_suffix" "c")
2250 (set_attr "trap_suffix" "v_sv_svi")])
2251
2252 (define_expand "fix_trunctfdi2"
2253 [(use (match_operand:DI 0 "register_operand" ""))
2254 (use (match_operand:TF 1 "general_operand" ""))]
2255 "TARGET_HAS_XFLOATING_LIBS"
2256 "alpha_emit_xfloating_cvt (FIX, operands); DONE;")
2257
2258 (define_insn "*floatdisf_ieee"
2259 [(set (match_operand:SF 0 "register_operand" "=&f")
2260 (float:SF (match_operand:DI 1 "reg_no_subreg_operand" "f")))]
2261 "TARGET_FP && alpha_fptm >= ALPHA_FPTM_SU"
2262 "cvtq%,%/ %1,%0"
2263 [(set_attr "type" "fadd")
2264 (set_attr "trap" "yes")
2265 (set_attr "round_suffix" "normal")
2266 (set_attr "trap_suffix" "sui")])
2267
2268 (define_insn "floatdisf2"
2269 [(set (match_operand:SF 0 "register_operand" "=f")
2270 (float:SF (match_operand:DI 1 "reg_no_subreg_operand" "f")))]
2271 "TARGET_FP"
2272 "cvtq%,%/ %1,%0"
2273 [(set_attr "type" "fadd")
2274 (set_attr "trap" "yes")
2275 (set_attr "round_suffix" "normal")
2276 (set_attr "trap_suffix" "sui")])
2277
2278 (define_insn "*floatdidf_ieee"
2279 [(set (match_operand:DF 0 "register_operand" "=&f")
2280 (float:DF (match_operand:DI 1 "reg_no_subreg_operand" "f")))]
2281 "TARGET_FP && alpha_fptm >= ALPHA_FPTM_SU"
2282 "cvtq%-%/ %1,%0"
2283 [(set_attr "type" "fadd")
2284 (set_attr "trap" "yes")
2285 (set_attr "round_suffix" "normal")
2286 (set_attr "trap_suffix" "sui")])
2287
2288 (define_insn "floatdidf2"
2289 [(set (match_operand:DF 0 "register_operand" "=f")
2290 (float:DF (match_operand:DI 1 "reg_no_subreg_operand" "f")))]
2291 "TARGET_FP"
2292 "cvtq%-%/ %1,%0"
2293 [(set_attr "type" "fadd")
2294 (set_attr "trap" "yes")
2295 (set_attr "round_suffix" "normal")
2296 (set_attr "trap_suffix" "sui")])
2297
2298 (define_expand "floatditf2"
2299 [(use (match_operand:TF 0 "register_operand" ""))
2300 (use (match_operand:DI 1 "general_operand" ""))]
2301 "TARGET_HAS_XFLOATING_LIBS"
2302 "alpha_emit_xfloating_cvt (FLOAT, operands); DONE;")
2303
2304 (define_expand "floatunsdisf2"
2305 [(use (match_operand:SF 0 "register_operand" ""))
2306 (use (match_operand:DI 1 "register_operand" ""))]
2307 "TARGET_FP"
2308 "alpha_emit_floatuns (operands); DONE;")
2309
2310 (define_expand "floatunsdidf2"
2311 [(use (match_operand:DF 0 "register_operand" ""))
2312 (use (match_operand:DI 1 "register_operand" ""))]
2313 "TARGET_FP"
2314 "alpha_emit_floatuns (operands); DONE;")
2315
2316 (define_expand "floatunsditf2"
2317 [(use (match_operand:TF 0 "register_operand" ""))
2318 (use (match_operand:DI 1 "general_operand" ""))]
2319 "TARGET_HAS_XFLOATING_LIBS"
2320 "alpha_emit_xfloating_cvt (UNSIGNED_FLOAT, operands); DONE;")
2321
2322 (define_expand "extendsfdf2"
2323 [(set (match_operand:DF 0 "register_operand" "")
2324 (float_extend:DF (match_operand:SF 1 "nonimmediate_operand" "")))]
2325 "TARGET_FP"
2326 {
2327 if (alpha_fptm >= ALPHA_FPTM_SU)
2328 operands[1] = force_reg (SFmode, operands[1]);
2329 })
2330
2331 (define_insn "*extendsfdf2_ieee"
2332 [(set (match_operand:DF 0 "register_operand" "=&f")
2333 (float_extend:DF (match_operand:SF 1 "register_operand" "f")))]
2334 "TARGET_FP && alpha_fptm >= ALPHA_FPTM_SU"
2335 "cvtsts %1,%0"
2336 [(set_attr "type" "fadd")
2337 (set_attr "trap" "yes")])
2338
2339 (define_insn "*extendsfdf2_internal"
2340 [(set (match_operand:DF 0 "register_operand" "=f,f,m")
2341 (float_extend:DF (match_operand:SF 1 "nonimmediate_operand" "f,m,f")))]
2342 "TARGET_FP && alpha_fptm < ALPHA_FPTM_SU"
2343 "@
2344 fmov %1,%0
2345 ld%, %0,%1
2346 st%- %1,%0"
2347 [(set_attr "type" "fcpys,fld,fst")])
2348
2349 (define_expand "extendsftf2"
2350 [(use (match_operand:TF 0 "register_operand" ""))
2351 (use (match_operand:SF 1 "general_operand" ""))]
2352 "TARGET_HAS_XFLOATING_LIBS"
2353 {
2354 rtx tmp = gen_reg_rtx (DFmode);
2355 emit_insn (gen_extendsfdf2 (tmp, operands[1]));
2356 emit_insn (gen_extenddftf2 (operands[0], tmp));
2357 DONE;
2358 })
2359
2360 (define_expand "extenddftf2"
2361 [(use (match_operand:TF 0 "register_operand" ""))
2362 (use (match_operand:DF 1 "general_operand" ""))]
2363 "TARGET_HAS_XFLOATING_LIBS"
2364 "alpha_emit_xfloating_cvt (FLOAT_EXTEND, operands); DONE;")
2365
2366 (define_insn "*truncdfsf2_ieee"
2367 [(set (match_operand:SF 0 "register_operand" "=&f")
2368 (float_truncate:SF (match_operand:DF 1 "reg_or_fp0_operand" "fG")))]
2369 "TARGET_FP && alpha_fptm >= ALPHA_FPTM_SU"
2370 "cvt%-%,%/ %R1,%0"
2371 [(set_attr "type" "fadd")
2372 (set_attr "trap" "yes")
2373 (set_attr "round_suffix" "normal")
2374 (set_attr "trap_suffix" "u_su_sui")])
2375
2376 (define_insn "truncdfsf2"
2377 [(set (match_operand:SF 0 "register_operand" "=f")
2378 (float_truncate:SF (match_operand:DF 1 "reg_or_fp0_operand" "fG")))]
2379 "TARGET_FP"
2380 "cvt%-%,%/ %R1,%0"
2381 [(set_attr "type" "fadd")
2382 (set_attr "trap" "yes")
2383 (set_attr "round_suffix" "normal")
2384 (set_attr "trap_suffix" "u_su_sui")])
2385
2386 (define_expand "trunctfdf2"
2387 [(use (match_operand:DF 0 "register_operand" ""))
2388 (use (match_operand:TF 1 "general_operand" ""))]
2389 "TARGET_HAS_XFLOATING_LIBS"
2390 "alpha_emit_xfloating_cvt (FLOAT_TRUNCATE, operands); DONE;")
2391
2392 (define_expand "trunctfsf2"
2393 [(use (match_operand:SF 0 "register_operand" ""))
2394 (use (match_operand:TF 1 "general_operand" ""))]
2395 "TARGET_FP && TARGET_HAS_XFLOATING_LIBS"
2396 {
2397 rtx tmpf, sticky, arg, lo, hi;
2398
2399 tmpf = gen_reg_rtx (DFmode);
2400 sticky = gen_reg_rtx (DImode);
2401 arg = copy_to_mode_reg (TFmode, operands[1]);
2402 lo = gen_lowpart (DImode, arg);
2403 hi = gen_highpart (DImode, arg);
2404
2405 /* Convert the low word of the TFmode value into a sticky rounding bit,
2406 then or it into the low bit of the high word. This leaves the sticky
2407 bit at bit 48 of the fraction, which is representable in DFmode,
2408 which prevents rounding error in the final conversion to SFmode. */
2409
2410 emit_insn (gen_rtx_SET (VOIDmode, sticky,
2411 gen_rtx_NE (DImode, lo, const0_rtx)));
2412 emit_insn (gen_iordi3 (hi, hi, sticky));
2413 emit_insn (gen_trunctfdf2 (tmpf, arg));
2414 emit_insn (gen_truncdfsf2 (operands[0], tmpf));
2415 DONE;
2416 })
2417
2418 (define_insn "*divsf3_ieee"
2419 [(set (match_operand:SF 0 "register_operand" "=&f")
2420 (div:SF (match_operand:SF 1 "reg_or_fp0_operand" "fG")
2421 (match_operand:SF 2 "reg_or_fp0_operand" "fG")))]
2422 "TARGET_FP && alpha_fptm >= ALPHA_FPTM_SU"
2423 "div%,%/ %R1,%R2,%0"
2424 [(set_attr "type" "fdiv")
2425 (set_attr "opsize" "si")
2426 (set_attr "trap" "yes")
2427 (set_attr "round_suffix" "normal")
2428 (set_attr "trap_suffix" "u_su_sui")])
2429
2430 (define_insn "divsf3"
2431 [(set (match_operand:SF 0 "register_operand" "=f")
2432 (div:SF (match_operand:SF 1 "reg_or_fp0_operand" "fG")
2433 (match_operand:SF 2 "reg_or_fp0_operand" "fG")))]
2434 "TARGET_FP"
2435 "div%,%/ %R1,%R2,%0"
2436 [(set_attr "type" "fdiv")
2437 (set_attr "opsize" "si")
2438 (set_attr "trap" "yes")
2439 (set_attr "round_suffix" "normal")
2440 (set_attr "trap_suffix" "u_su_sui")])
2441
2442 (define_insn "*divdf3_ieee"
2443 [(set (match_operand:DF 0 "register_operand" "=&f")
2444 (div:DF (match_operand:DF 1 "reg_or_fp0_operand" "fG")
2445 (match_operand:DF 2 "reg_or_fp0_operand" "fG")))]
2446 "TARGET_FP && alpha_fptm >= ALPHA_FPTM_SU"
2447 "div%-%/ %R1,%R2,%0"
2448 [(set_attr "type" "fdiv")
2449 (set_attr "trap" "yes")
2450 (set_attr "round_suffix" "normal")
2451 (set_attr "trap_suffix" "u_su_sui")])
2452
2453 (define_insn "divdf3"
2454 [(set (match_operand:DF 0 "register_operand" "=f")
2455 (div:DF (match_operand:DF 1 "reg_or_fp0_operand" "fG")
2456 (match_operand:DF 2 "reg_or_fp0_operand" "fG")))]
2457 "TARGET_FP"
2458 "div%-%/ %R1,%R2,%0"
2459 [(set_attr "type" "fdiv")
2460 (set_attr "trap" "yes")
2461 (set_attr "round_suffix" "normal")
2462 (set_attr "trap_suffix" "u_su_sui")])
2463
2464 (define_insn "*divdf_ext1"
2465 [(set (match_operand:DF 0 "register_operand" "=f")
2466 (div:DF (float_extend:DF (match_operand:SF 1 "reg_or_fp0_operand" "fG"))
2467 (match_operand:DF 2 "reg_or_fp0_operand" "fG")))]
2468 "TARGET_FP && alpha_fptm < ALPHA_FPTM_SU"
2469 "div%-%/ %R1,%R2,%0"
2470 [(set_attr "type" "fdiv")
2471 (set_attr "trap" "yes")
2472 (set_attr "round_suffix" "normal")
2473 (set_attr "trap_suffix" "u_su_sui")])
2474
2475 (define_insn "*divdf_ext2"
2476 [(set (match_operand:DF 0 "register_operand" "=f")
2477 (div:DF (match_operand:DF 1 "reg_or_fp0_operand" "fG")
2478 (float_extend:DF
2479 (match_operand:SF 2 "reg_or_fp0_operand" "fG"))))]
2480 "TARGET_FP && alpha_fptm < ALPHA_FPTM_SU"
2481 "div%-%/ %R1,%R2,%0"
2482 [(set_attr "type" "fdiv")
2483 (set_attr "trap" "yes")
2484 (set_attr "round_suffix" "normal")
2485 (set_attr "trap_suffix" "u_su_sui")])
2486
2487 (define_insn "*divdf_ext3"
2488 [(set (match_operand:DF 0 "register_operand" "=f")
2489 (div:DF (float_extend:DF (match_operand:SF 1 "reg_or_fp0_operand" "fG"))
2490 (float_extend:DF (match_operand:SF 2 "reg_or_fp0_operand" "fG"))))]
2491 "TARGET_FP && alpha_fptm < ALPHA_FPTM_SU"
2492 "div%-%/ %R1,%R2,%0"
2493 [(set_attr "type" "fdiv")
2494 (set_attr "trap" "yes")
2495 (set_attr "round_suffix" "normal")
2496 (set_attr "trap_suffix" "u_su_sui")])
2497
2498 (define_expand "divtf3"
2499 [(use (match_operand 0 "register_operand" ""))
2500 (use (match_operand 1 "general_operand" ""))
2501 (use (match_operand 2 "general_operand" ""))]
2502 "TARGET_HAS_XFLOATING_LIBS"
2503 "alpha_emit_xfloating_arith (DIV, operands); DONE;")
2504
2505 (define_insn "*mulsf3_ieee"
2506 [(set (match_operand:SF 0 "register_operand" "=&f")
2507 (mult:SF (match_operand:SF 1 "reg_or_fp0_operand" "%fG")
2508 (match_operand:SF 2 "reg_or_fp0_operand" "fG")))]
2509 "TARGET_FP && alpha_fptm >= ALPHA_FPTM_SU"
2510 "mul%,%/ %R1,%R2,%0"
2511 [(set_attr "type" "fmul")
2512 (set_attr "trap" "yes")
2513 (set_attr "round_suffix" "normal")
2514 (set_attr "trap_suffix" "u_su_sui")])
2515
2516 (define_insn "mulsf3"
2517 [(set (match_operand:SF 0 "register_operand" "=f")
2518 (mult:SF (match_operand:SF 1 "reg_or_fp0_operand" "%fG")
2519 (match_operand:SF 2 "reg_or_fp0_operand" "fG")))]
2520 "TARGET_FP"
2521 "mul%,%/ %R1,%R2,%0"
2522 [(set_attr "type" "fmul")
2523 (set_attr "trap" "yes")
2524 (set_attr "round_suffix" "normal")
2525 (set_attr "trap_suffix" "u_su_sui")])
2526
2527 (define_insn "*muldf3_ieee"
2528 [(set (match_operand:DF 0 "register_operand" "=&f")
2529 (mult:DF (match_operand:DF 1 "reg_or_fp0_operand" "%fG")
2530 (match_operand:DF 2 "reg_or_fp0_operand" "fG")))]
2531 "TARGET_FP && alpha_fptm >= ALPHA_FPTM_SU"
2532 "mul%-%/ %R1,%R2,%0"
2533 [(set_attr "type" "fmul")
2534 (set_attr "trap" "yes")
2535 (set_attr "round_suffix" "normal")
2536 (set_attr "trap_suffix" "u_su_sui")])
2537
2538 (define_insn "muldf3"
2539 [(set (match_operand:DF 0 "register_operand" "=f")
2540 (mult:DF (match_operand:DF 1 "reg_or_fp0_operand" "%fG")
2541 (match_operand:DF 2 "reg_or_fp0_operand" "fG")))]
2542 "TARGET_FP"
2543 "mul%-%/ %R1,%R2,%0"
2544 [(set_attr "type" "fmul")
2545 (set_attr "trap" "yes")
2546 (set_attr "round_suffix" "normal")
2547 (set_attr "trap_suffix" "u_su_sui")])
2548
2549 (define_insn "*muldf_ext1"
2550 [(set (match_operand:DF 0 "register_operand" "=f")
2551 (mult:DF (float_extend:DF
2552 (match_operand:SF 1 "reg_or_fp0_operand" "fG"))
2553 (match_operand:DF 2 "reg_or_fp0_operand" "fG")))]
2554 "TARGET_FP && alpha_fptm < ALPHA_FPTM_SU"
2555 "mul%-%/ %R1,%R2,%0"
2556 [(set_attr "type" "fmul")
2557 (set_attr "trap" "yes")
2558 (set_attr "round_suffix" "normal")
2559 (set_attr "trap_suffix" "u_su_sui")])
2560
2561 (define_insn "*muldf_ext2"
2562 [(set (match_operand:DF 0 "register_operand" "=f")
2563 (mult:DF (float_extend:DF
2564 (match_operand:SF 1 "reg_or_fp0_operand" "%fG"))
2565 (float_extend:DF
2566 (match_operand:SF 2 "reg_or_fp0_operand" "fG"))))]
2567 "TARGET_FP && alpha_fptm < ALPHA_FPTM_SU"
2568 "mul%-%/ %R1,%R2,%0"
2569 [(set_attr "type" "fmul")
2570 (set_attr "trap" "yes")
2571 (set_attr "round_suffix" "normal")
2572 (set_attr "trap_suffix" "u_su_sui")])
2573
2574 (define_expand "multf3"
2575 [(use (match_operand 0 "register_operand" ""))
2576 (use (match_operand 1 "general_operand" ""))
2577 (use (match_operand 2 "general_operand" ""))]
2578 "TARGET_HAS_XFLOATING_LIBS"
2579 "alpha_emit_xfloating_arith (MULT, operands); DONE;")
2580
2581 (define_insn "*subsf3_ieee"
2582 [(set (match_operand:SF 0 "register_operand" "=&f")
2583 (minus:SF (match_operand:SF 1 "reg_or_fp0_operand" "fG")
2584 (match_operand:SF 2 "reg_or_fp0_operand" "fG")))]
2585 "TARGET_FP && alpha_fptm >= ALPHA_FPTM_SU"
2586 "sub%,%/ %R1,%R2,%0"
2587 [(set_attr "type" "fadd")
2588 (set_attr "trap" "yes")
2589 (set_attr "round_suffix" "normal")
2590 (set_attr "trap_suffix" "u_su_sui")])
2591
2592 (define_insn "subsf3"
2593 [(set (match_operand:SF 0 "register_operand" "=f")
2594 (minus:SF (match_operand:SF 1 "reg_or_fp0_operand" "fG")
2595 (match_operand:SF 2 "reg_or_fp0_operand" "fG")))]
2596 "TARGET_FP"
2597 "sub%,%/ %R1,%R2,%0"
2598 [(set_attr "type" "fadd")
2599 (set_attr "trap" "yes")
2600 (set_attr "round_suffix" "normal")
2601 (set_attr "trap_suffix" "u_su_sui")])
2602
2603 (define_insn "*subdf3_ieee"
2604 [(set (match_operand:DF 0 "register_operand" "=&f")
2605 (minus:DF (match_operand:DF 1 "reg_or_fp0_operand" "fG")
2606 (match_operand:DF 2 "reg_or_fp0_operand" "fG")))]
2607 "TARGET_FP && alpha_fptm >= ALPHA_FPTM_SU"
2608 "sub%-%/ %R1,%R2,%0"
2609 [(set_attr "type" "fadd")
2610 (set_attr "trap" "yes")
2611 (set_attr "round_suffix" "normal")
2612 (set_attr "trap_suffix" "u_su_sui")])
2613
2614 (define_insn "subdf3"
2615 [(set (match_operand:DF 0 "register_operand" "=f")
2616 (minus:DF (match_operand:DF 1 "reg_or_fp0_operand" "fG")
2617 (match_operand:DF 2 "reg_or_fp0_operand" "fG")))]
2618 "TARGET_FP"
2619 "sub%-%/ %R1,%R2,%0"
2620 [(set_attr "type" "fadd")
2621 (set_attr "trap" "yes")
2622 (set_attr "round_suffix" "normal")
2623 (set_attr "trap_suffix" "u_su_sui")])
2624
2625 (define_insn "*subdf_ext1"
2626 [(set (match_operand:DF 0 "register_operand" "=f")
2627 (minus:DF (float_extend:DF
2628 (match_operand:SF 1 "reg_or_fp0_operand" "fG"))
2629 (match_operand:DF 2 "reg_or_fp0_operand" "fG")))]
2630 "TARGET_FP && alpha_fptm < ALPHA_FPTM_SU"
2631 "sub%-%/ %R1,%R2,%0"
2632 [(set_attr "type" "fadd")
2633 (set_attr "trap" "yes")
2634 (set_attr "round_suffix" "normal")
2635 (set_attr "trap_suffix" "u_su_sui")])
2636
2637 (define_insn "*subdf_ext2"
2638 [(set (match_operand:DF 0 "register_operand" "=f")
2639 (minus:DF (match_operand:DF 1 "reg_or_fp0_operand" "fG")
2640 (float_extend:DF
2641 (match_operand:SF 2 "reg_or_fp0_operand" "fG"))))]
2642 "TARGET_FP && alpha_fptm < ALPHA_FPTM_SU"
2643 "sub%-%/ %R1,%R2,%0"
2644 [(set_attr "type" "fadd")
2645 (set_attr "trap" "yes")
2646 (set_attr "round_suffix" "normal")
2647 (set_attr "trap_suffix" "u_su_sui")])
2648
2649 (define_insn "*subdf_ext3"
2650 [(set (match_operand:DF 0 "register_operand" "=f")
2651 (minus:DF (float_extend:DF
2652 (match_operand:SF 1 "reg_or_fp0_operand" "fG"))
2653 (float_extend:DF
2654 (match_operand:SF 2 "reg_or_fp0_operand" "fG"))))]
2655 "TARGET_FP && alpha_fptm < ALPHA_FPTM_SU"
2656 "sub%-%/ %R1,%R2,%0"
2657 [(set_attr "type" "fadd")
2658 (set_attr "trap" "yes")
2659 (set_attr "round_suffix" "normal")
2660 (set_attr "trap_suffix" "u_su_sui")])
2661
2662 (define_expand "subtf3"
2663 [(use (match_operand 0 "register_operand" ""))
2664 (use (match_operand 1 "general_operand" ""))
2665 (use (match_operand 2 "general_operand" ""))]
2666 "TARGET_HAS_XFLOATING_LIBS"
2667 "alpha_emit_xfloating_arith (MINUS, operands); DONE;")
2668
2669 (define_insn "*sqrtsf2_ieee"
2670 [(set (match_operand:SF 0 "register_operand" "=&f")
2671 (sqrt:SF (match_operand:SF 1 "reg_or_fp0_operand" "fG")))]
2672 "TARGET_FP && TARGET_FIX && alpha_fptm >= ALPHA_FPTM_SU"
2673 "sqrt%,%/ %R1,%0"
2674 [(set_attr "type" "fsqrt")
2675 (set_attr "opsize" "si")
2676 (set_attr "trap" "yes")
2677 (set_attr "round_suffix" "normal")
2678 (set_attr "trap_suffix" "u_su_sui")])
2679
2680 (define_insn "sqrtsf2"
2681 [(set (match_operand:SF 0 "register_operand" "=f")
2682 (sqrt:SF (match_operand:SF 1 "reg_or_fp0_operand" "fG")))]
2683 "TARGET_FP && TARGET_FIX"
2684 "sqrt%,%/ %R1,%0"
2685 [(set_attr "type" "fsqrt")
2686 (set_attr "opsize" "si")
2687 (set_attr "trap" "yes")
2688 (set_attr "round_suffix" "normal")
2689 (set_attr "trap_suffix" "u_su_sui")])
2690
2691 (define_insn "*sqrtdf2_ieee"
2692 [(set (match_operand:DF 0 "register_operand" "=&f")
2693 (sqrt:DF (match_operand:DF 1 "reg_or_fp0_operand" "fG")))]
2694 "TARGET_FP && TARGET_FIX && alpha_fptm >= ALPHA_FPTM_SU"
2695 "sqrt%-%/ %R1,%0"
2696 [(set_attr "type" "fsqrt")
2697 (set_attr "trap" "yes")
2698 (set_attr "round_suffix" "normal")
2699 (set_attr "trap_suffix" "u_su_sui")])
2700
2701 (define_insn "sqrtdf2"
2702 [(set (match_operand:DF 0 "register_operand" "=f")
2703 (sqrt:DF (match_operand:DF 1 "reg_or_fp0_operand" "fG")))]
2704 "TARGET_FP && TARGET_FIX"
2705 "sqrt%-%/ %1,%0"
2706 [(set_attr "type" "fsqrt")
2707 (set_attr "trap" "yes")
2708 (set_attr "round_suffix" "normal")
2709 (set_attr "trap_suffix" "u_su_sui")])
2710 \f
2711 ;; Next are all the integer comparisons, and conditional moves and branches
2712 ;; and some of the related define_expand's and define_split's.
2713
2714 (define_insn "*setcc_internal"
2715 [(set (match_operand 0 "register_operand" "=r")
2716 (match_operator 1 "alpha_comparison_operator"
2717 [(match_operand:DI 2 "register_operand" "r")
2718 (match_operand:DI 3 "reg_or_8bit_operand" "rI")]))]
2719 "GET_MODE_CLASS (GET_MODE (operands[0])) == MODE_INT
2720 && GET_MODE_SIZE (GET_MODE (operands[0])) <= 8
2721 && GET_MODE (operands[0]) == GET_MODE (operands[1])"
2722 "cmp%C1 %2,%3,%0"
2723 [(set_attr "type" "icmp")])
2724
2725 ;; Yes, we can technically support reg_or_8bit_operand in operand 2,
2726 ;; but that's non-canonical rtl and allowing that causes inefficiencies
2727 ;; from cse on.
2728 (define_insn "*setcc_swapped_internal"
2729 [(set (match_operand 0 "register_operand" "=r")
2730 (match_operator 1 "alpha_swapped_comparison_operator"
2731 [(match_operand:DI 2 "register_operand" "r")
2732 (match_operand:DI 3 "reg_or_0_operand" "rJ")]))]
2733 "GET_MODE_CLASS (GET_MODE (operands[0])) == MODE_INT
2734 && GET_MODE_SIZE (GET_MODE (operands[0])) <= 8
2735 && GET_MODE (operands[0]) == GET_MODE (operands[1])"
2736 "cmp%c1 %r3,%2,%0"
2737 [(set_attr "type" "icmp")])
2738
2739 ;; Use match_operator rather than ne directly so that we can match
2740 ;; multiple integer modes.
2741 (define_insn "*setne_internal"
2742 [(set (match_operand 0 "register_operand" "=r")
2743 (match_operator 1 "signed_comparison_operator"
2744 [(match_operand:DI 2 "register_operand" "r")
2745 (const_int 0)]))]
2746 "GET_MODE_CLASS (GET_MODE (operands[0])) == MODE_INT
2747 && GET_MODE_SIZE (GET_MODE (operands[0])) <= 8
2748 && GET_CODE (operands[1]) == NE
2749 && GET_MODE (operands[0]) == GET_MODE (operands[1])"
2750 "cmpult $31,%2,%0"
2751 [(set_attr "type" "icmp")])
2752
2753 ;; The mode folding trick can't be used with const_int operands, since
2754 ;; reload needs to know the proper mode.
2755 ;;
2756 ;; Use add_operand instead of the more seemingly natural reg_or_8bit_operand
2757 ;; in order to create more pairs of constants. As long as we're allowing
2758 ;; two constants at the same time, and will have to reload one of them...
2759
2760 (define_insn "*movqicc_internal"
2761 [(set (match_operand:QI 0 "register_operand" "=r,r,r,r")
2762 (if_then_else:QI
2763 (match_operator 2 "signed_comparison_operator"
2764 [(match_operand:DI 3 "reg_or_0_operand" "rJ,rJ,J,J")
2765 (match_operand:DI 4 "reg_or_0_operand" "J,J,rJ,rJ")])
2766 (match_operand:QI 1 "add_operand" "rI,0,rI,0")
2767 (match_operand:QI 5 "add_operand" "0,rI,0,rI")))]
2768 "(operands[3] == const0_rtx || operands[4] == const0_rtx)"
2769 "@
2770 cmov%C2 %r3,%1,%0
2771 cmov%D2 %r3,%5,%0
2772 cmov%c2 %r4,%1,%0
2773 cmov%d2 %r4,%5,%0"
2774 [(set_attr "type" "icmov")])
2775
2776 (define_insn "*movhicc_internal"
2777 [(set (match_operand:HI 0 "register_operand" "=r,r,r,r")
2778 (if_then_else:HI
2779 (match_operator 2 "signed_comparison_operator"
2780 [(match_operand:DI 3 "reg_or_0_operand" "rJ,rJ,J,J")
2781 (match_operand:DI 4 "reg_or_0_operand" "J,J,rJ,rJ")])
2782 (match_operand:HI 1 "add_operand" "rI,0,rI,0")
2783 (match_operand:HI 5 "add_operand" "0,rI,0,rI")))]
2784 "(operands[3] == const0_rtx || operands[4] == const0_rtx)"
2785 "@
2786 cmov%C2 %r3,%1,%0
2787 cmov%D2 %r3,%5,%0
2788 cmov%c2 %r4,%1,%0
2789 cmov%d2 %r4,%5,%0"
2790 [(set_attr "type" "icmov")])
2791
2792 (define_insn "*movsicc_internal"
2793 [(set (match_operand:SI 0 "register_operand" "=r,r,r,r")
2794 (if_then_else:SI
2795 (match_operator 2 "signed_comparison_operator"
2796 [(match_operand:DI 3 "reg_or_0_operand" "rJ,rJ,J,J")
2797 (match_operand:DI 4 "reg_or_0_operand" "J,J,rJ,rJ")])
2798 (match_operand:SI 1 "add_operand" "rI,0,rI,0")
2799 (match_operand:SI 5 "add_operand" "0,rI,0,rI")))]
2800 "(operands[3] == const0_rtx || operands[4] == const0_rtx)"
2801 "@
2802 cmov%C2 %r3,%1,%0
2803 cmov%D2 %r3,%5,%0
2804 cmov%c2 %r4,%1,%0
2805 cmov%d2 %r4,%5,%0"
2806 [(set_attr "type" "icmov")])
2807
2808 (define_insn "*movdicc_internal"
2809 [(set (match_operand:DI 0 "register_operand" "=r,r,r,r")
2810 (if_then_else:DI
2811 (match_operator 2 "signed_comparison_operator"
2812 [(match_operand:DI 3 "reg_or_0_operand" "rJ,rJ,J,J")
2813 (match_operand:DI 4 "reg_or_0_operand" "J,J,rJ,rJ")])
2814 (match_operand:DI 1 "add_operand" "rI,0,rI,0")
2815 (match_operand:DI 5 "add_operand" "0,rI,0,rI")))]
2816 "(operands[3] == const0_rtx || operands[4] == const0_rtx)"
2817 "@
2818 cmov%C2 %r3,%1,%0
2819 cmov%D2 %r3,%5,%0
2820 cmov%c2 %r4,%1,%0
2821 cmov%d2 %r4,%5,%0"
2822 [(set_attr "type" "icmov")])
2823
2824 (define_insn "*movqicc_lbc"
2825 [(set (match_operand:QI 0 "register_operand" "=r,r")
2826 (if_then_else:QI
2827 (eq (zero_extract:DI (match_operand:DI 2 "reg_or_0_operand" "rJ,rJ")
2828 (const_int 1)
2829 (const_int 0))
2830 (const_int 0))
2831 (match_operand:QI 1 "reg_or_8bit_operand" "rI,0")
2832 (match_operand:QI 3 "reg_or_8bit_operand" "0,rI")))]
2833 ""
2834 "@
2835 cmovlbc %r2,%1,%0
2836 cmovlbs %r2,%3,%0"
2837 [(set_attr "type" "icmov")])
2838
2839 (define_insn "*movhicc_lbc"
2840 [(set (match_operand:HI 0 "register_operand" "=r,r")
2841 (if_then_else:HI
2842 (eq (zero_extract:DI (match_operand:DI 2 "reg_or_0_operand" "rJ,rJ")
2843 (const_int 1)
2844 (const_int 0))
2845 (const_int 0))
2846 (match_operand:HI 1 "reg_or_8bit_operand" "rI,0")
2847 (match_operand:HI 3 "reg_or_8bit_operand" "0,rI")))]
2848 ""
2849 "@
2850 cmovlbc %r2,%1,%0
2851 cmovlbs %r2,%3,%0"
2852 [(set_attr "type" "icmov")])
2853
2854 (define_insn "*movsicc_lbc"
2855 [(set (match_operand:SI 0 "register_operand" "=r,r")
2856 (if_then_else:SI
2857 (eq (zero_extract:DI (match_operand:DI 2 "reg_or_0_operand" "rJ,rJ")
2858 (const_int 1)
2859 (const_int 0))
2860 (const_int 0))
2861 (match_operand:SI 1 "reg_or_8bit_operand" "rI,0")
2862 (match_operand:SI 3 "reg_or_8bit_operand" "0,rI")))]
2863 ""
2864 "@
2865 cmovlbc %r2,%1,%0
2866 cmovlbs %r2,%3,%0"
2867 [(set_attr "type" "icmov")])
2868
2869 (define_insn "*movdicc_lbc"
2870 [(set (match_operand:DI 0 "register_operand" "=r,r")
2871 (if_then_else:DI
2872 (eq (zero_extract:DI (match_operand:DI 2 "reg_or_0_operand" "rJ,rJ")
2873 (const_int 1)
2874 (const_int 0))
2875 (const_int 0))
2876 (match_operand:DI 1 "reg_or_8bit_operand" "rI,0")
2877 (match_operand:DI 3 "reg_or_8bit_operand" "0,rI")))]
2878 ""
2879 "@
2880 cmovlbc %r2,%1,%0
2881 cmovlbs %r2,%3,%0"
2882 [(set_attr "type" "icmov")])
2883
2884 (define_insn "*movqicc_lbs"
2885 [(set (match_operand:QI 0 "register_operand" "=r,r")
2886 (if_then_else:QI
2887 (ne (zero_extract:DI (match_operand:DI 2 "reg_or_0_operand" "rJ,rJ")
2888 (const_int 1)
2889 (const_int 0))
2890 (const_int 0))
2891 (match_operand:QI 1 "reg_or_8bit_operand" "rI,0")
2892 (match_operand:QI 3 "reg_or_8bit_operand" "0,rI")))]
2893 ""
2894 "@
2895 cmovlbs %r2,%1,%0
2896 cmovlbc %r2,%3,%0"
2897 [(set_attr "type" "icmov")])
2898
2899 (define_insn "*movhicc_lbs"
2900 [(set (match_operand:HI 0 "register_operand" "=r,r")
2901 (if_then_else:HI
2902 (ne (zero_extract:DI (match_operand:DI 2 "reg_or_0_operand" "rJ,rJ")
2903 (const_int 1)
2904 (const_int 0))
2905 (const_int 0))
2906 (match_operand:HI 1 "reg_or_8bit_operand" "rI,0")
2907 (match_operand:HI 3 "reg_or_8bit_operand" "0,rI")))]
2908 ""
2909 "@
2910 cmovlbs %r2,%1,%0
2911 cmovlbc %r2,%3,%0"
2912 [(set_attr "type" "icmov")])
2913
2914 (define_insn "*movsicc_lbs"
2915 [(set (match_operand:SI 0 "register_operand" "=r,r")
2916 (if_then_else:SI
2917 (ne (zero_extract:DI (match_operand:DI 2 "reg_or_0_operand" "rJ,rJ")
2918 (const_int 1)
2919 (const_int 0))
2920 (const_int 0))
2921 (match_operand:SI 1 "reg_or_8bit_operand" "rI,0")
2922 (match_operand:SI 3 "reg_or_8bit_operand" "0,rI")))]
2923 ""
2924 "@
2925 cmovlbs %r2,%1,%0
2926 cmovlbc %r2,%3,%0"
2927 [(set_attr "type" "icmov")])
2928
2929 (define_insn "*movdicc_lbs"
2930 [(set (match_operand:DI 0 "register_operand" "=r,r")
2931 (if_then_else:DI
2932 (ne (zero_extract:DI (match_operand:DI 2 "reg_or_0_operand" "rJ,rJ")
2933 (const_int 1)
2934 (const_int 0))
2935 (const_int 0))
2936 (match_operand:DI 1 "reg_or_8bit_operand" "rI,0")
2937 (match_operand:DI 3 "reg_or_8bit_operand" "0,rI")))]
2938 ""
2939 "@
2940 cmovlbs %r2,%1,%0
2941 cmovlbc %r2,%3,%0"
2942 [(set_attr "type" "icmov")])
2943
2944 ;; For ABS, we have two choices, depending on whether the input and output
2945 ;; registers are the same or not.
2946 (define_expand "absdi2"
2947 [(set (match_operand:DI 0 "register_operand" "")
2948 (abs:DI (match_operand:DI 1 "register_operand" "")))]
2949 ""
2950 {
2951 if (rtx_equal_p (operands[0], operands[1]))
2952 emit_insn (gen_absdi2_same (operands[0], gen_reg_rtx (DImode)));
2953 else
2954 emit_insn (gen_absdi2_diff (operands[0], operands[1]));
2955 DONE;
2956 })
2957
2958 (define_expand "absdi2_same"
2959 [(set (match_operand:DI 1 "register_operand" "")
2960 (neg:DI (match_operand:DI 0 "register_operand" "")))
2961 (set (match_dup 0)
2962 (if_then_else:DI (ge (match_dup 0) (const_int 0))
2963 (match_dup 0)
2964 (match_dup 1)))]
2965 ""
2966 "")
2967
2968 (define_expand "absdi2_diff"
2969 [(set (match_operand:DI 0 "register_operand" "")
2970 (neg:DI (match_operand:DI 1 "register_operand" "")))
2971 (set (match_dup 0)
2972 (if_then_else:DI (lt (match_dup 1) (const_int 0))
2973 (match_dup 0)
2974 (match_dup 1)))]
2975 ""
2976 "")
2977
2978 (define_split
2979 [(set (match_operand:DI 0 "register_operand" "")
2980 (abs:DI (match_dup 0)))
2981 (clobber (match_operand:DI 1 "register_operand" ""))]
2982 ""
2983 [(set (match_dup 1) (neg:DI (match_dup 0)))
2984 (set (match_dup 0) (if_then_else:DI (ge (match_dup 0) (const_int 0))
2985 (match_dup 0) (match_dup 1)))]
2986 "")
2987
2988 (define_split
2989 [(set (match_operand:DI 0 "register_operand" "")
2990 (abs:DI (match_operand:DI 1 "register_operand" "")))]
2991 "! rtx_equal_p (operands[0], operands[1])"
2992 [(set (match_dup 0) (neg:DI (match_dup 1)))
2993 (set (match_dup 0) (if_then_else:DI (lt (match_dup 1) (const_int 0))
2994 (match_dup 0) (match_dup 1)))]
2995 "")
2996
2997 (define_split
2998 [(set (match_operand:DI 0 "register_operand" "")
2999 (neg:DI (abs:DI (match_dup 0))))
3000 (clobber (match_operand:DI 1 "register_operand" ""))]
3001 ""
3002 [(set (match_dup 1) (neg:DI (match_dup 0)))
3003 (set (match_dup 0) (if_then_else:DI (le (match_dup 0) (const_int 0))
3004 (match_dup 0) (match_dup 1)))]
3005 "")
3006
3007 (define_split
3008 [(set (match_operand:DI 0 "register_operand" "")
3009 (neg:DI (abs:DI (match_operand:DI 1 "register_operand" ""))))]
3010 "! rtx_equal_p (operands[0], operands[1])"
3011 [(set (match_dup 0) (neg:DI (match_dup 1)))
3012 (set (match_dup 0) (if_then_else:DI (gt (match_dup 1) (const_int 0))
3013 (match_dup 0) (match_dup 1)))]
3014 "")
3015
3016 (define_insn "sminqi3"
3017 [(set (match_operand:QI 0 "register_operand" "=r")
3018 (smin:QI (match_operand:QI 1 "reg_or_0_operand" "%rJ")
3019 (match_operand:QI 2 "reg_or_8bit_operand" "rI")))]
3020 "TARGET_MAX"
3021 "minsb8 %r1,%2,%0"
3022 [(set_attr "type" "mvi")])
3023
3024 (define_insn "uminqi3"
3025 [(set (match_operand:QI 0 "register_operand" "=r")
3026 (umin:QI (match_operand:QI 1 "reg_or_0_operand" "%rJ")
3027 (match_operand:QI 2 "reg_or_8bit_operand" "rI")))]
3028 "TARGET_MAX"
3029 "minub8 %r1,%2,%0"
3030 [(set_attr "type" "mvi")])
3031
3032 (define_insn "smaxqi3"
3033 [(set (match_operand:QI 0 "register_operand" "=r")
3034 (smax:QI (match_operand:QI 1 "reg_or_0_operand" "%rJ")
3035 (match_operand:QI 2 "reg_or_8bit_operand" "rI")))]
3036 "TARGET_MAX"
3037 "maxsb8 %r1,%2,%0"
3038 [(set_attr "type" "mvi")])
3039
3040 (define_insn "umaxqi3"
3041 [(set (match_operand:QI 0 "register_operand" "=r")
3042 (umax:QI (match_operand:QI 1 "reg_or_0_operand" "%rJ")
3043 (match_operand:QI 2 "reg_or_8bit_operand" "rI")))]
3044 "TARGET_MAX"
3045 "maxub8 %r1,%2,%0"
3046 [(set_attr "type" "mvi")])
3047
3048 (define_insn "sminhi3"
3049 [(set (match_operand:HI 0 "register_operand" "=r")
3050 (smin:HI (match_operand:HI 1 "reg_or_0_operand" "%rJ")
3051 (match_operand:HI 2 "reg_or_8bit_operand" "rI")))]
3052 "TARGET_MAX"
3053 "minsw4 %r1,%2,%0"
3054 [(set_attr "type" "mvi")])
3055
3056 (define_insn "uminhi3"
3057 [(set (match_operand:HI 0 "register_operand" "=r")
3058 (umin:HI (match_operand:HI 1 "reg_or_0_operand" "%rJ")
3059 (match_operand:HI 2 "reg_or_8bit_operand" "rI")))]
3060 "TARGET_MAX"
3061 "minuw4 %r1,%2,%0"
3062 [(set_attr "type" "mvi")])
3063
3064 (define_insn "smaxhi3"
3065 [(set (match_operand:HI 0 "register_operand" "=r")
3066 (smax:HI (match_operand:HI 1 "reg_or_0_operand" "%rJ")
3067 (match_operand:HI 2 "reg_or_8bit_operand" "rI")))]
3068 "TARGET_MAX"
3069 "maxsw4 %r1,%2,%0"
3070 [(set_attr "type" "mvi")])
3071
3072 (define_insn "umaxhi3"
3073 [(set (match_operand:HI 0 "register_operand" "=r")
3074 (umax:HI (match_operand:HI 1 "reg_or_0_operand" "%rJ")
3075 (match_operand:HI 2 "reg_or_8bit_operand" "rI")))]
3076 "TARGET_MAX"
3077 "maxuw4 %r1,%2,%0"
3078 [(set_attr "type" "shift")])
3079
3080 (define_expand "smaxdi3"
3081 [(set (match_dup 3)
3082 (le:DI (match_operand:DI 1 "reg_or_0_operand" "")
3083 (match_operand:DI 2 "reg_or_8bit_operand" "")))
3084 (set (match_operand:DI 0 "register_operand" "")
3085 (if_then_else:DI (eq (match_dup 3) (const_int 0))
3086 (match_dup 1) (match_dup 2)))]
3087 ""
3088 { operands[3] = gen_reg_rtx (DImode); })
3089
3090 (define_split
3091 [(set (match_operand:DI 0 "register_operand" "")
3092 (smax:DI (match_operand:DI 1 "reg_or_0_operand" "")
3093 (match_operand:DI 2 "reg_or_8bit_operand" "")))
3094 (clobber (match_operand:DI 3 "register_operand" ""))]
3095 "operands[2] != const0_rtx"
3096 [(set (match_dup 3) (le:DI (match_dup 1) (match_dup 2)))
3097 (set (match_dup 0) (if_then_else:DI (eq (match_dup 3) (const_int 0))
3098 (match_dup 1) (match_dup 2)))]
3099 "")
3100
3101 (define_insn "*smax_const0"
3102 [(set (match_operand:DI 0 "register_operand" "=r")
3103 (smax:DI (match_operand:DI 1 "register_operand" "0")
3104 (const_int 0)))]
3105 ""
3106 "cmovlt %0,0,%0"
3107 [(set_attr "type" "icmov")])
3108
3109 (define_expand "smindi3"
3110 [(set (match_dup 3)
3111 (lt:DI (match_operand:DI 1 "reg_or_0_operand" "")
3112 (match_operand:DI 2 "reg_or_8bit_operand" "")))
3113 (set (match_operand:DI 0 "register_operand" "")
3114 (if_then_else:DI (ne (match_dup 3) (const_int 0))
3115 (match_dup 1) (match_dup 2)))]
3116 ""
3117 { operands[3] = gen_reg_rtx (DImode); })
3118
3119 (define_split
3120 [(set (match_operand:DI 0 "register_operand" "")
3121 (smin:DI (match_operand:DI 1 "reg_or_0_operand" "")
3122 (match_operand:DI 2 "reg_or_8bit_operand" "")))
3123 (clobber (match_operand:DI 3 "register_operand" ""))]
3124 "operands[2] != const0_rtx"
3125 [(set (match_dup 3) (lt:DI (match_dup 1) (match_dup 2)))
3126 (set (match_dup 0) (if_then_else:DI (ne (match_dup 3) (const_int 0))
3127 (match_dup 1) (match_dup 2)))]
3128 "")
3129
3130 (define_insn "*smin_const0"
3131 [(set (match_operand:DI 0 "register_operand" "=r")
3132 (smin:DI (match_operand:DI 1 "register_operand" "0")
3133 (const_int 0)))]
3134 ""
3135 "cmovgt %0,0,%0"
3136 [(set_attr "type" "icmov")])
3137
3138 (define_expand "umaxdi3"
3139 [(set (match_dup 3)
3140 (leu:DI (match_operand:DI 1 "reg_or_0_operand" "")
3141 (match_operand:DI 2 "reg_or_8bit_operand" "")))
3142 (set (match_operand:DI 0 "register_operand" "")
3143 (if_then_else:DI (eq (match_dup 3) (const_int 0))
3144 (match_dup 1) (match_dup 2)))]
3145 ""
3146 "operands[3] = gen_reg_rtx (DImode);")
3147
3148 (define_split
3149 [(set (match_operand:DI 0 "register_operand" "")
3150 (umax:DI (match_operand:DI 1 "reg_or_0_operand" "")
3151 (match_operand:DI 2 "reg_or_8bit_operand" "")))
3152 (clobber (match_operand:DI 3 "register_operand" ""))]
3153 "operands[2] != const0_rtx"
3154 [(set (match_dup 3) (leu:DI (match_dup 1) (match_dup 2)))
3155 (set (match_dup 0) (if_then_else:DI (eq (match_dup 3) (const_int 0))
3156 (match_dup 1) (match_dup 2)))]
3157 "")
3158
3159 (define_expand "umindi3"
3160 [(set (match_dup 3)
3161 (ltu:DI (match_operand:DI 1 "reg_or_0_operand" "")
3162 (match_operand:DI 2 "reg_or_8bit_operand" "")))
3163 (set (match_operand:DI 0 "register_operand" "")
3164 (if_then_else:DI (ne (match_dup 3) (const_int 0))
3165 (match_dup 1) (match_dup 2)))]
3166 ""
3167 "operands[3] = gen_reg_rtx (DImode);")
3168
3169 (define_split
3170 [(set (match_operand:DI 0 "register_operand" "")
3171 (umin:DI (match_operand:DI 1 "reg_or_0_operand" "")
3172 (match_operand:DI 2 "reg_or_8bit_operand" "")))
3173 (clobber (match_operand:DI 3 "register_operand" ""))]
3174 "operands[2] != const0_rtx"
3175 [(set (match_dup 3) (ltu:DI (match_dup 1) (match_dup 2)))
3176 (set (match_dup 0) (if_then_else:DI (ne (match_dup 3) (const_int 0))
3177 (match_dup 1) (match_dup 2)))]
3178 "")
3179
3180 (define_insn "*bcc_normal"
3181 [(set (pc)
3182 (if_then_else
3183 (match_operator 1 "signed_comparison_operator"
3184 [(match_operand:DI 2 "reg_or_0_operand" "rJ")
3185 (const_int 0)])
3186 (label_ref (match_operand 0 "" ""))
3187 (pc)))]
3188 ""
3189 "b%C1 %r2,%0"
3190 [(set_attr "type" "ibr")])
3191
3192 (define_insn "*bcc_reverse"
3193 [(set (pc)
3194 (if_then_else
3195 (match_operator 1 "signed_comparison_operator"
3196 [(match_operand:DI 2 "register_operand" "r")
3197 (const_int 0)])
3198
3199 (pc)
3200 (label_ref (match_operand 0 "" ""))))]
3201 ""
3202 "b%c1 %2,%0"
3203 [(set_attr "type" "ibr")])
3204
3205 (define_insn "*blbs_normal"
3206 [(set (pc)
3207 (if_then_else
3208 (ne (zero_extract:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
3209 (const_int 1)
3210 (const_int 0))
3211 (const_int 0))
3212 (label_ref (match_operand 0 "" ""))
3213 (pc)))]
3214 ""
3215 "blbs %r1,%0"
3216 [(set_attr "type" "ibr")])
3217
3218 (define_insn "*blbc_normal"
3219 [(set (pc)
3220 (if_then_else
3221 (eq (zero_extract:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
3222 (const_int 1)
3223 (const_int 0))
3224 (const_int 0))
3225 (label_ref (match_operand 0 "" ""))
3226 (pc)))]
3227 ""
3228 "blbc %r1,%0"
3229 [(set_attr "type" "ibr")])
3230
3231 (define_split
3232 [(parallel
3233 [(set (pc)
3234 (if_then_else
3235 (match_operator 1 "comparison_operator"
3236 [(zero_extract:DI (match_operand:DI 2 "register_operand" "")
3237 (const_int 1)
3238 (match_operand:DI 3 "const_int_operand" ""))
3239 (const_int 0)])
3240 (label_ref (match_operand 0 "" ""))
3241 (pc)))
3242 (clobber (match_operand:DI 4 "register_operand" ""))])]
3243 "INTVAL (operands[3]) != 0"
3244 [(set (match_dup 4)
3245 (lshiftrt:DI (match_dup 2) (match_dup 3)))
3246 (set (pc)
3247 (if_then_else (match_op_dup 1
3248 [(zero_extract:DI (match_dup 4)
3249 (const_int 1)
3250 (const_int 0))
3251 (const_int 0)])
3252 (label_ref (match_dup 0))
3253 (pc)))]
3254 "")
3255 \f
3256 ;; The following are the corresponding floating-point insns. Recall
3257 ;; we need to have variants that expand the arguments from SFmode
3258 ;; to DFmode.
3259
3260 (define_insn "*cmpdf_ieee"
3261 [(set (match_operand:DF 0 "register_operand" "=&f")
3262 (match_operator:DF 1 "alpha_fp_comparison_operator"
3263 [(match_operand:DF 2 "reg_or_fp0_operand" "fG")
3264 (match_operand:DF 3 "reg_or_fp0_operand" "fG")]))]
3265 "TARGET_FP && alpha_fptm >= ALPHA_FPTM_SU"
3266 "cmp%-%C1%/ %R2,%R3,%0"
3267 [(set_attr "type" "fadd")
3268 (set_attr "trap" "yes")
3269 (set_attr "trap_suffix" "su")])
3270
3271 (define_insn "*cmpdf_internal"
3272 [(set (match_operand:DF 0 "register_operand" "=f")
3273 (match_operator:DF 1 "alpha_fp_comparison_operator"
3274 [(match_operand:DF 2 "reg_or_fp0_operand" "fG")
3275 (match_operand:DF 3 "reg_or_fp0_operand" "fG")]))]
3276 "TARGET_FP && alpha_fptm < ALPHA_FPTM_SU"
3277 "cmp%-%C1%/ %R2,%R3,%0"
3278 [(set_attr "type" "fadd")
3279 (set_attr "trap" "yes")
3280 (set_attr "trap_suffix" "su")])
3281
3282 (define_insn "*cmpdf_ieee_ext1"
3283 [(set (match_operand:DF 0 "register_operand" "=&f")
3284 (match_operator:DF 1 "alpha_fp_comparison_operator"
3285 [(float_extend:DF
3286 (match_operand:SF 2 "reg_or_fp0_operand" "fG"))
3287 (match_operand:DF 3 "reg_or_fp0_operand" "fG")]))]
3288 "TARGET_FP && alpha_fptm >= ALPHA_FPTM_SU"
3289 "cmp%-%C1%/ %R2,%R3,%0"
3290 [(set_attr "type" "fadd")
3291 (set_attr "trap" "yes")
3292 (set_attr "trap_suffix" "su")])
3293
3294 (define_insn "*cmpdf_ext1"
3295 [(set (match_operand:DF 0 "register_operand" "=f")
3296 (match_operator:DF 1 "alpha_fp_comparison_operator"
3297 [(float_extend:DF
3298 (match_operand:SF 2 "reg_or_fp0_operand" "fG"))
3299 (match_operand:DF 3 "reg_or_fp0_operand" "fG")]))]
3300 "TARGET_FP && alpha_fptm < ALPHA_FPTM_SU"
3301 "cmp%-%C1%/ %R2,%R3,%0"
3302 [(set_attr "type" "fadd")
3303 (set_attr "trap" "yes")
3304 (set_attr "trap_suffix" "su")])
3305
3306 (define_insn "*cmpdf_ieee_ext2"
3307 [(set (match_operand:DF 0 "register_operand" "=&f")
3308 (match_operator:DF 1 "alpha_fp_comparison_operator"
3309 [(match_operand:DF 2 "reg_or_fp0_operand" "fG")
3310 (float_extend:DF
3311 (match_operand:SF 3 "reg_or_fp0_operand" "fG"))]))]
3312 "TARGET_FP && alpha_fptm >= ALPHA_FPTM_SU"
3313 "cmp%-%C1%/ %R2,%R3,%0"
3314 [(set_attr "type" "fadd")
3315 (set_attr "trap" "yes")
3316 (set_attr "trap_suffix" "su")])
3317
3318 (define_insn "*cmpdf_ext2"
3319 [(set (match_operand:DF 0 "register_operand" "=f")
3320 (match_operator:DF 1 "alpha_fp_comparison_operator"
3321 [(match_operand:DF 2 "reg_or_fp0_operand" "fG")
3322 (float_extend:DF
3323 (match_operand:SF 3 "reg_or_fp0_operand" "fG"))]))]
3324 "TARGET_FP && alpha_fptm < ALPHA_FPTM_SU"
3325 "cmp%-%C1%/ %R2,%R3,%0"
3326 [(set_attr "type" "fadd")
3327 (set_attr "trap" "yes")
3328 (set_attr "trap_suffix" "su")])
3329
3330 (define_insn "*cmpdf_ieee_ext3"
3331 [(set (match_operand:DF 0 "register_operand" "=&f")
3332 (match_operator:DF 1 "alpha_fp_comparison_operator"
3333 [(float_extend:DF
3334 (match_operand:SF 2 "reg_or_fp0_operand" "fG"))
3335 (float_extend:DF
3336 (match_operand:SF 3 "reg_or_fp0_operand" "fG"))]))]
3337 "TARGET_FP && alpha_fptm >= ALPHA_FPTM_SU"
3338 "cmp%-%C1%/ %R2,%R3,%0"
3339 [(set_attr "type" "fadd")
3340 (set_attr "trap" "yes")
3341 (set_attr "trap_suffix" "su")])
3342
3343 (define_insn "*cmpdf_ext3"
3344 [(set (match_operand:DF 0 "register_operand" "=f")
3345 (match_operator:DF 1 "alpha_fp_comparison_operator"
3346 [(float_extend:DF
3347 (match_operand:SF 2 "reg_or_fp0_operand" "fG"))
3348 (float_extend:DF
3349 (match_operand:SF 3 "reg_or_fp0_operand" "fG"))]))]
3350 "TARGET_FP && alpha_fptm < ALPHA_FPTM_SU"
3351 "cmp%-%C1%/ %R2,%R3,%0"
3352 [(set_attr "type" "fadd")
3353 (set_attr "trap" "yes")
3354 (set_attr "trap_suffix" "su")])
3355
3356 (define_insn "*movdfcc_internal"
3357 [(set (match_operand:DF 0 "register_operand" "=f,f")
3358 (if_then_else:DF
3359 (match_operator 3 "signed_comparison_operator"
3360 [(match_operand:DF 4 "reg_or_fp0_operand" "fG,fG")
3361 (match_operand:DF 2 "fp0_operand" "G,G")])
3362 (match_operand:DF 1 "reg_or_fp0_operand" "fG,0")
3363 (match_operand:DF 5 "reg_or_fp0_operand" "0,fG")))]
3364 "TARGET_FP"
3365 "@
3366 fcmov%C3 %R4,%R1,%0
3367 fcmov%D3 %R4,%R5,%0"
3368 [(set_attr "type" "fcmov")])
3369
3370 (define_insn "*movsfcc_internal"
3371 [(set (match_operand:SF 0 "register_operand" "=f,f")
3372 (if_then_else:SF
3373 (match_operator 3 "signed_comparison_operator"
3374 [(match_operand:DF 4 "reg_or_fp0_operand" "fG,fG")
3375 (match_operand:DF 2 "fp0_operand" "G,G")])
3376 (match_operand:SF 1 "reg_or_fp0_operand" "fG,0")
3377 (match_operand:SF 5 "reg_or_fp0_operand" "0,fG")))]
3378 "TARGET_FP"
3379 "@
3380 fcmov%C3 %R4,%R1,%0
3381 fcmov%D3 %R4,%R5,%0"
3382 [(set_attr "type" "fcmov")])
3383
3384 (define_insn "*movdfcc_ext1"
3385 [(set (match_operand:DF 0 "register_operand" "=f,f")
3386 (if_then_else:DF
3387 (match_operator 3 "signed_comparison_operator"
3388 [(match_operand:DF 4 "reg_or_fp0_operand" "fG,fG")
3389 (match_operand:DF 2 "fp0_operand" "G,G")])
3390 (float_extend:DF (match_operand:SF 1 "reg_or_fp0_operand" "fG,0"))
3391 (match_operand:DF 5 "reg_or_fp0_operand" "0,fG")))]
3392 "TARGET_FP"
3393 "@
3394 fcmov%C3 %R4,%R1,%0
3395 fcmov%D3 %R4,%R5,%0"
3396 [(set_attr "type" "fcmov")])
3397
3398 (define_insn "*movdfcc_ext2"
3399 [(set (match_operand:DF 0 "register_operand" "=f,f")
3400 (if_then_else:DF
3401 (match_operator 3 "signed_comparison_operator"
3402 [(float_extend:DF
3403 (match_operand:SF 4 "reg_or_fp0_operand" "fG,fG"))
3404 (match_operand:DF 2 "fp0_operand" "G,G")])
3405 (match_operand:DF 1 "reg_or_fp0_operand" "fG,0")
3406 (match_operand:DF 5 "reg_or_fp0_operand" "0,fG")))]
3407 "TARGET_FP"
3408 "@
3409 fcmov%C3 %R4,%R1,%0
3410 fcmov%D3 %R4,%R5,%0"
3411 [(set_attr "type" "fcmov")])
3412
3413 (define_insn "*movdfcc_ext3"
3414 [(set (match_operand:SF 0 "register_operand" "=f,f")
3415 (if_then_else:SF
3416 (match_operator 3 "signed_comparison_operator"
3417 [(float_extend:DF
3418 (match_operand:SF 4 "reg_or_fp0_operand" "fG,fG"))
3419 (match_operand:DF 2 "fp0_operand" "G,G")])
3420 (match_operand:SF 1 "reg_or_fp0_operand" "fG,0")
3421 (match_operand:SF 5 "reg_or_fp0_operand" "0,fG")))]
3422 "TARGET_FP"
3423 "@
3424 fcmov%C3 %R4,%R1,%0
3425 fcmov%D3 %R4,%R5,%0"
3426 [(set_attr "type" "fcmov")])
3427
3428 (define_insn "*movdfcc_ext4"
3429 [(set (match_operand:DF 0 "register_operand" "=f,f")
3430 (if_then_else:DF
3431 (match_operator 3 "signed_comparison_operator"
3432 [(float_extend:DF
3433 (match_operand:SF 4 "reg_or_fp0_operand" "fG,fG"))
3434 (match_operand:DF 2 "fp0_operand" "G,G")])
3435 (float_extend:DF (match_operand:SF 1 "reg_or_fp0_operand" "fG,0"))
3436 (match_operand:DF 5 "reg_or_fp0_operand" "0,fG")))]
3437 "TARGET_FP"
3438 "@
3439 fcmov%C3 %R4,%R1,%0
3440 fcmov%D3 %R4,%R5,%0"
3441 [(set_attr "type" "fcmov")])
3442
3443 (define_expand "maxdf3"
3444 [(set (match_dup 3)
3445 (le:DF (match_operand:DF 1 "reg_or_fp0_operand" "")
3446 (match_operand:DF 2 "reg_or_fp0_operand" "")))
3447 (set (match_operand:DF 0 "register_operand" "")
3448 (if_then_else:DF (eq (match_dup 3) (match_dup 4))
3449 (match_dup 1) (match_dup 2)))]
3450 "TARGET_FP"
3451 {
3452 operands[3] = gen_reg_rtx (DFmode);
3453 operands[4] = CONST0_RTX (DFmode);
3454 })
3455
3456 (define_expand "mindf3"
3457 [(set (match_dup 3)
3458 (lt:DF (match_operand:DF 1 "reg_or_fp0_operand" "")
3459 (match_operand:DF 2 "reg_or_fp0_operand" "")))
3460 (set (match_operand:DF 0 "register_operand" "")
3461 (if_then_else:DF (ne (match_dup 3) (match_dup 4))
3462 (match_dup 1) (match_dup 2)))]
3463 "TARGET_FP"
3464 {
3465 operands[3] = gen_reg_rtx (DFmode);
3466 operands[4] = CONST0_RTX (DFmode);
3467 })
3468
3469 (define_expand "maxsf3"
3470 [(set (match_dup 3)
3471 (le:DF (float_extend:DF (match_operand:SF 1 "reg_or_fp0_operand" ""))
3472 (float_extend:DF (match_operand:SF 2 "reg_or_fp0_operand" ""))))
3473 (set (match_operand:SF 0 "register_operand" "")
3474 (if_then_else:SF (eq (match_dup 3) (match_dup 4))
3475 (match_dup 1) (match_dup 2)))]
3476 "TARGET_FP"
3477 {
3478 operands[3] = gen_reg_rtx (DFmode);
3479 operands[4] = CONST0_RTX (DFmode);
3480 })
3481
3482 (define_expand "minsf3"
3483 [(set (match_dup 3)
3484 (lt:DF (float_extend:DF (match_operand:SF 1 "reg_or_fp0_operand" ""))
3485 (float_extend:DF (match_operand:SF 2 "reg_or_fp0_operand" ""))))
3486 (set (match_operand:SF 0 "register_operand" "")
3487 (if_then_else:SF (ne (match_dup 3) (match_dup 4))
3488 (match_dup 1) (match_dup 2)))]
3489 "TARGET_FP"
3490 {
3491 operands[3] = gen_reg_rtx (DFmode);
3492 operands[4] = CONST0_RTX (DFmode);
3493 })
3494
3495 (define_insn "*fbcc_normal"
3496 [(set (pc)
3497 (if_then_else
3498 (match_operator 1 "signed_comparison_operator"
3499 [(match_operand:DF 2 "reg_or_fp0_operand" "fG")
3500 (match_operand:DF 3 "fp0_operand" "G")])
3501 (label_ref (match_operand 0 "" ""))
3502 (pc)))]
3503 "TARGET_FP"
3504 "fb%C1 %R2,%0"
3505 [(set_attr "type" "fbr")])
3506
3507 (define_insn "*fbcc_ext_normal"
3508 [(set (pc)
3509 (if_then_else
3510 (match_operator 1 "signed_comparison_operator"
3511 [(float_extend:DF
3512 (match_operand:SF 2 "reg_or_fp0_operand" "fG"))
3513 (match_operand:DF 3 "fp0_operand" "G")])
3514 (label_ref (match_operand 0 "" ""))
3515 (pc)))]
3516 "TARGET_FP"
3517 "fb%C1 %R2,%0"
3518 [(set_attr "type" "fbr")])
3519 \f
3520 ;; These are the main define_expand's used to make conditional branches
3521 ;; and compares.
3522
3523 (define_expand "cmpdf"
3524 [(set (cc0) (compare (match_operand:DF 0 "reg_or_fp0_operand" "")
3525 (match_operand:DF 1 "reg_or_fp0_operand" "")))]
3526 "TARGET_FP"
3527 {
3528 alpha_compare.op0 = operands[0];
3529 alpha_compare.op1 = operands[1];
3530 alpha_compare.fp_p = 1;
3531 DONE;
3532 })
3533
3534 (define_expand "cmptf"
3535 [(set (cc0) (compare (match_operand:TF 0 "general_operand" "")
3536 (match_operand:TF 1 "general_operand" "")))]
3537 "TARGET_HAS_XFLOATING_LIBS"
3538 {
3539 alpha_compare.op0 = operands[0];
3540 alpha_compare.op1 = operands[1];
3541 alpha_compare.fp_p = 1;
3542 DONE;
3543 })
3544
3545 (define_expand "cmpdi"
3546 [(set (cc0) (compare (match_operand:DI 0 "general_operand" "")
3547 (match_operand:DI 1 "general_operand" "")))]
3548 ""
3549 {
3550 alpha_compare.op0 = operands[0];
3551 alpha_compare.op1 = operands[1];
3552 alpha_compare.fp_p = 0;
3553 DONE;
3554 })
3555
3556 (define_expand "beq"
3557 [(set (pc)
3558 (if_then_else (match_dup 1)
3559 (label_ref (match_operand 0 "" ""))
3560 (pc)))]
3561 ""
3562 "{ operands[1] = alpha_emit_conditional_branch (EQ); }")
3563
3564 (define_expand "bne"
3565 [(set (pc)
3566 (if_then_else (match_dup 1)
3567 (label_ref (match_operand 0 "" ""))
3568 (pc)))]
3569 ""
3570 "{ operands[1] = alpha_emit_conditional_branch (NE); }")
3571
3572 (define_expand "blt"
3573 [(set (pc)
3574 (if_then_else (match_dup 1)
3575 (label_ref (match_operand 0 "" ""))
3576 (pc)))]
3577 ""
3578 "{ operands[1] = alpha_emit_conditional_branch (LT); }")
3579
3580 (define_expand "ble"
3581 [(set (pc)
3582 (if_then_else (match_dup 1)
3583 (label_ref (match_operand 0 "" ""))
3584 (pc)))]
3585 ""
3586 "{ operands[1] = alpha_emit_conditional_branch (LE); }")
3587
3588 (define_expand "bgt"
3589 [(set (pc)
3590 (if_then_else (match_dup 1)
3591 (label_ref (match_operand 0 "" ""))
3592 (pc)))]
3593 ""
3594 "{ operands[1] = alpha_emit_conditional_branch (GT); }")
3595
3596 (define_expand "bge"
3597 [(set (pc)
3598 (if_then_else (match_dup 1)
3599 (label_ref (match_operand 0 "" ""))
3600 (pc)))]
3601 ""
3602 "{ operands[1] = alpha_emit_conditional_branch (GE); }")
3603
3604 (define_expand "bltu"
3605 [(set (pc)
3606 (if_then_else (match_dup 1)
3607 (label_ref (match_operand 0 "" ""))
3608 (pc)))]
3609 ""
3610 "{ operands[1] = alpha_emit_conditional_branch (LTU); }")
3611
3612 (define_expand "bleu"
3613 [(set (pc)
3614 (if_then_else (match_dup 1)
3615 (label_ref (match_operand 0 "" ""))
3616 (pc)))]
3617 ""
3618 "{ operands[1] = alpha_emit_conditional_branch (LEU); }")
3619
3620 (define_expand "bgtu"
3621 [(set (pc)
3622 (if_then_else (match_dup 1)
3623 (label_ref (match_operand 0 "" ""))
3624 (pc)))]
3625 ""
3626 "{ operands[1] = alpha_emit_conditional_branch (GTU); }")
3627
3628 (define_expand "bgeu"
3629 [(set (pc)
3630 (if_then_else (match_dup 1)
3631 (label_ref (match_operand 0 "" ""))
3632 (pc)))]
3633 ""
3634 "{ operands[1] = alpha_emit_conditional_branch (GEU); }")
3635
3636 (define_expand "bunordered"
3637 [(set (pc)
3638 (if_then_else (match_dup 1)
3639 (label_ref (match_operand 0 "" ""))
3640 (pc)))]
3641 ""
3642 "{ operands[1] = alpha_emit_conditional_branch (UNORDERED); }")
3643
3644 (define_expand "bordered"
3645 [(set (pc)
3646 (if_then_else (match_dup 1)
3647 (label_ref (match_operand 0 "" ""))
3648 (pc)))]
3649 ""
3650 "{ operands[1] = alpha_emit_conditional_branch (ORDERED); }")
3651
3652 (define_expand "seq"
3653 [(set (match_operand:DI 0 "register_operand" "")
3654 (match_dup 1))]
3655 ""
3656 "{ if ((operands[1] = alpha_emit_setcc (EQ)) == NULL_RTX) FAIL; }")
3657
3658 (define_expand "sne"
3659 [(set (match_operand:DI 0 "register_operand" "")
3660 (match_dup 1))]
3661 ""
3662 "{ if ((operands[1] = alpha_emit_setcc (NE)) == NULL_RTX) FAIL; }")
3663
3664 (define_expand "slt"
3665 [(set (match_operand:DI 0 "register_operand" "")
3666 (match_dup 1))]
3667 ""
3668 "{ if ((operands[1] = alpha_emit_setcc (LT)) == NULL_RTX) FAIL; }")
3669
3670 (define_expand "sle"
3671 [(set (match_operand:DI 0 "register_operand" "")
3672 (match_dup 1))]
3673 ""
3674 "{ if ((operands[1] = alpha_emit_setcc (LE)) == NULL_RTX) FAIL; }")
3675
3676 (define_expand "sgt"
3677 [(set (match_operand:DI 0 "register_operand" "")
3678 (match_dup 1))]
3679 ""
3680 "{ if ((operands[1] = alpha_emit_setcc (GT)) == NULL_RTX) FAIL; }")
3681
3682 (define_expand "sge"
3683 [(set (match_operand:DI 0 "register_operand" "")
3684 (match_dup 1))]
3685 ""
3686 "{ if ((operands[1] = alpha_emit_setcc (GE)) == NULL_RTX) FAIL; }")
3687
3688 (define_expand "sltu"
3689 [(set (match_operand:DI 0 "register_operand" "")
3690 (match_dup 1))]
3691 ""
3692 "{ if ((operands[1] = alpha_emit_setcc (LTU)) == NULL_RTX) FAIL; }")
3693
3694 (define_expand "sleu"
3695 [(set (match_operand:DI 0 "register_operand" "")
3696 (match_dup 1))]
3697 ""
3698 "{ if ((operands[1] = alpha_emit_setcc (LEU)) == NULL_RTX) FAIL; }")
3699
3700 (define_expand "sgtu"
3701 [(set (match_operand:DI 0 "register_operand" "")
3702 (match_dup 1))]
3703 ""
3704 "{ if ((operands[1] = alpha_emit_setcc (GTU)) == NULL_RTX) FAIL; }")
3705
3706 (define_expand "sgeu"
3707 [(set (match_operand:DI 0 "register_operand" "")
3708 (match_dup 1))]
3709 ""
3710 "{ if ((operands[1] = alpha_emit_setcc (GEU)) == NULL_RTX) FAIL; }")
3711
3712 (define_expand "sunordered"
3713 [(set (match_operand:DI 0 "register_operand" "")
3714 (match_dup 1))]
3715 ""
3716 "{ if ((operands[1] = alpha_emit_setcc (UNORDERED)) == NULL_RTX) FAIL; }")
3717
3718 (define_expand "sordered"
3719 [(set (match_operand:DI 0 "register_operand" "")
3720 (match_dup 1))]
3721 ""
3722 "{ if ((operands[1] = alpha_emit_setcc (ORDERED)) == NULL_RTX) FAIL; }")
3723 \f
3724 ;; These are the main define_expand's used to make conditional moves.
3725
3726 (define_expand "movsicc"
3727 [(set (match_operand:SI 0 "register_operand" "")
3728 (if_then_else:SI (match_operand 1 "comparison_operator" "")
3729 (match_operand:SI 2 "reg_or_8bit_operand" "")
3730 (match_operand:SI 3 "reg_or_8bit_operand" "")))]
3731 ""
3732 {
3733 if ((operands[1] = alpha_emit_conditional_move (operands[1], SImode)) == 0)
3734 FAIL;
3735 })
3736
3737 (define_expand "movdicc"
3738 [(set (match_operand:DI 0 "register_operand" "")
3739 (if_then_else:DI (match_operand 1 "comparison_operator" "")
3740 (match_operand:DI 2 "reg_or_8bit_operand" "")
3741 (match_operand:DI 3 "reg_or_8bit_operand" "")))]
3742 ""
3743 {
3744 if ((operands[1] = alpha_emit_conditional_move (operands[1], DImode)) == 0)
3745 FAIL;
3746 })
3747
3748 (define_expand "movsfcc"
3749 [(set (match_operand:SF 0 "register_operand" "")
3750 (if_then_else:SF (match_operand 1 "comparison_operator" "")
3751 (match_operand:SF 2 "reg_or_8bit_operand" "")
3752 (match_operand:SF 3 "reg_or_8bit_operand" "")))]
3753 ""
3754 {
3755 if ((operands[1] = alpha_emit_conditional_move (operands[1], SFmode)) == 0)
3756 FAIL;
3757 })
3758
3759 (define_expand "movdfcc"
3760 [(set (match_operand:DF 0 "register_operand" "")
3761 (if_then_else:DF (match_operand 1 "comparison_operator" "")
3762 (match_operand:DF 2 "reg_or_8bit_operand" "")
3763 (match_operand:DF 3 "reg_or_8bit_operand" "")))]
3764 ""
3765 {
3766 if ((operands[1] = alpha_emit_conditional_move (operands[1], DFmode)) == 0)
3767 FAIL;
3768 })
3769 \f
3770 ;; These define_split definitions are used in cases when comparisons have
3771 ;; not be stated in the correct way and we need to reverse the second
3772 ;; comparison. For example, x >= 7 has to be done as x < 6 with the
3773 ;; comparison that tests the result being reversed. We have one define_split
3774 ;; for each use of a comparison. They do not match valid insns and need
3775 ;; not generate valid insns.
3776 ;;
3777 ;; We can also handle equality comparisons (and inequality comparisons in
3778 ;; cases where the resulting add cannot overflow) by doing an add followed by
3779 ;; a comparison with zero. This is faster since the addition takes one
3780 ;; less cycle than a compare when feeding into a conditional move.
3781 ;; For this case, we also have an SImode pattern since we can merge the add
3782 ;; and sign extend and the order doesn't matter.
3783 ;;
3784 ;; We do not do this for floating-point, since it isn't clear how the "wrong"
3785 ;; operation could have been generated.
3786
3787 (define_split
3788 [(set (match_operand:DI 0 "register_operand" "")
3789 (if_then_else:DI
3790 (match_operator 1 "comparison_operator"
3791 [(match_operand:DI 2 "reg_or_0_operand" "")
3792 (match_operand:DI 3 "reg_or_cint_operand" "")])
3793 (match_operand:DI 4 "reg_or_cint_operand" "")
3794 (match_operand:DI 5 "reg_or_cint_operand" "")))
3795 (clobber (match_operand:DI 6 "register_operand" ""))]
3796 "operands[3] != const0_rtx"
3797 [(set (match_dup 6) (match_dup 7))
3798 (set (match_dup 0)
3799 (if_then_else:DI (match_dup 8) (match_dup 4) (match_dup 5)))]
3800 {
3801 enum rtx_code code = GET_CODE (operands[1]);
3802 int unsignedp = (code == GEU || code == LEU || code == GTU || code == LTU);
3803
3804 /* If we are comparing for equality with a constant and that constant
3805 appears in the arm when the register equals the constant, use the
3806 register since that is more likely to match (and to produce better code
3807 if both would). */
3808
3809 if (code == EQ && GET_CODE (operands[3]) == CONST_INT
3810 && rtx_equal_p (operands[4], operands[3]))
3811 operands[4] = operands[2];
3812
3813 else if (code == NE && GET_CODE (operands[3]) == CONST_INT
3814 && rtx_equal_p (operands[5], operands[3]))
3815 operands[5] = operands[2];
3816
3817 if (code == NE || code == EQ
3818 || (extended_count (operands[2], DImode, unsignedp) >= 1
3819 && extended_count (operands[3], DImode, unsignedp) >= 1))
3820 {
3821 if (GET_CODE (operands[3]) == CONST_INT)
3822 operands[7] = gen_rtx_PLUS (DImode, operands[2],
3823 GEN_INT (- INTVAL (operands[3])));
3824 else
3825 operands[7] = gen_rtx_MINUS (DImode, operands[2], operands[3]);
3826
3827 operands[8] = gen_rtx_fmt_ee (code, VOIDmode, operands[6], const0_rtx);
3828 }
3829
3830 else if (code == EQ || code == LE || code == LT
3831 || code == LEU || code == LTU)
3832 {
3833 operands[7] = gen_rtx_fmt_ee (code, DImode, operands[2], operands[3]);
3834 operands[8] = gen_rtx_NE (VOIDmode, operands[6], const0_rtx);
3835 }
3836 else
3837 {
3838 operands[7] = gen_rtx_fmt_ee (reverse_condition (code), DImode,
3839 operands[2], operands[3]);
3840 operands[8] = gen_rtx_EQ (VOIDmode, operands[6], const0_rtx);
3841 }
3842 })
3843
3844 (define_split
3845 [(set (match_operand:DI 0 "register_operand" "")
3846 (if_then_else:DI
3847 (match_operator 1 "comparison_operator"
3848 [(match_operand:SI 2 "reg_or_0_operand" "")
3849 (match_operand:SI 3 "reg_or_cint_operand" "")])
3850 (match_operand:DI 4 "reg_or_8bit_operand" "")
3851 (match_operand:DI 5 "reg_or_8bit_operand" "")))
3852 (clobber (match_operand:DI 6 "register_operand" ""))]
3853 "operands[3] != const0_rtx
3854 && (GET_CODE (operands[1]) == EQ || GET_CODE (operands[1]) == NE)"
3855 [(set (match_dup 6) (match_dup 7))
3856 (set (match_dup 0)
3857 (if_then_else:DI (match_dup 8) (match_dup 4) (match_dup 5)))]
3858 {
3859 enum rtx_code code = GET_CODE (operands[1]);
3860 int unsignedp = (code == GEU || code == LEU || code == GTU || code == LTU);
3861 rtx tem;
3862
3863 if ((code != NE && code != EQ
3864 && ! (extended_count (operands[2], DImode, unsignedp) >= 1
3865 && extended_count (operands[3], DImode, unsignedp) >= 1)))
3866 FAIL;
3867
3868 if (GET_CODE (operands[3]) == CONST_INT)
3869 tem = gen_rtx_PLUS (SImode, operands[2],
3870 GEN_INT (- INTVAL (operands[3])));
3871 else
3872 tem = gen_rtx_MINUS (SImode, operands[2], operands[3]);
3873
3874 operands[7] = gen_rtx_SIGN_EXTEND (DImode, tem);
3875 operands[8] = gen_rtx_fmt_ee (GET_CODE (operands[1]), VOIDmode,
3876 operands[6], const0_rtx);
3877 })
3878
3879 (define_split
3880 [(set (pc)
3881 (if_then_else
3882 (match_operator 1 "comparison_operator"
3883 [(match_operand:DI 2 "reg_or_0_operand" "")
3884 (match_operand:DI 3 "reg_or_cint_operand" "")])
3885 (label_ref (match_operand 0 "" ""))
3886 (pc)))
3887 (clobber (match_operand:DI 4 "register_operand" ""))]
3888 "operands[3] != const0_rtx"
3889 [(set (match_dup 4) (match_dup 5))
3890 (set (pc) (if_then_else (match_dup 6) (label_ref (match_dup 0)) (pc)))]
3891 {
3892 enum rtx_code code = GET_CODE (operands[1]);
3893 int unsignedp = (code == GEU || code == LEU || code == GTU || code == LTU);
3894
3895 if (code == NE || code == EQ
3896 || (extended_count (operands[2], DImode, unsignedp) >= 1
3897 && extended_count (operands[3], DImode, unsignedp) >= 1))
3898 {
3899 if (GET_CODE (operands[3]) == CONST_INT)
3900 operands[5] = gen_rtx_PLUS (DImode, operands[2],
3901 GEN_INT (- INTVAL (operands[3])));
3902 else
3903 operands[5] = gen_rtx_MINUS (DImode, operands[2], operands[3]);
3904
3905 operands[6] = gen_rtx_fmt_ee (code, VOIDmode, operands[4], const0_rtx);
3906 }
3907
3908 else if (code == EQ || code == LE || code == LT
3909 || code == LEU || code == LTU)
3910 {
3911 operands[5] = gen_rtx_fmt_ee (code, DImode, operands[2], operands[3]);
3912 operands[6] = gen_rtx_NE (VOIDmode, operands[4], const0_rtx);
3913 }
3914 else
3915 {
3916 operands[5] = gen_rtx_fmt_ee (reverse_condition (code), DImode,
3917 operands[2], operands[3]);
3918 operands[6] = gen_rtx_EQ (VOIDmode, operands[4], const0_rtx);
3919 }
3920 })
3921
3922 (define_split
3923 [(set (pc)
3924 (if_then_else
3925 (match_operator 1 "comparison_operator"
3926 [(match_operand:SI 2 "reg_or_0_operand" "")
3927 (match_operand:SI 3 "const_int_operand" "")])
3928 (label_ref (match_operand 0 "" ""))
3929 (pc)))
3930 (clobber (match_operand:DI 4 "register_operand" ""))]
3931 "operands[3] != const0_rtx
3932 && (GET_CODE (operands[1]) == EQ || GET_CODE (operands[1]) == NE)"
3933 [(set (match_dup 4) (match_dup 5))
3934 (set (pc) (if_then_else (match_dup 6) (label_ref (match_dup 0)) (pc)))]
3935 {
3936 rtx tem;
3937
3938 if (GET_CODE (operands[3]) == CONST_INT)
3939 tem = gen_rtx_PLUS (SImode, operands[2],
3940 GEN_INT (- INTVAL (operands[3])));
3941 else
3942 tem = gen_rtx_MINUS (SImode, operands[2], operands[3]);
3943
3944 operands[5] = gen_rtx_SIGN_EXTEND (DImode, tem);
3945 operands[6] = gen_rtx_fmt_ee (GET_CODE (operands[1]), VOIDmode,
3946 operands[4], const0_rtx);
3947 })
3948
3949 ;; We can convert such things as "a > 0xffff" to "t = a & ~ 0xffff; t != 0".
3950 ;; This eliminates one, and sometimes two, insns when the AND can be done
3951 ;; with a ZAP.
3952 (define_split
3953 [(set (match_operand:DI 0 "register_operand" "")
3954 (match_operator:DI 1 "comparison_operator"
3955 [(match_operand:DI 2 "register_operand" "")
3956 (match_operand:DI 3 "const_int_operand" "")]))
3957 (clobber (match_operand:DI 4 "register_operand" ""))]
3958 "exact_log2 (INTVAL (operands[3]) + 1) >= 0
3959 && (GET_CODE (operands[1]) == GTU
3960 || GET_CODE (operands[1]) == LEU
3961 || ((GET_CODE (operands[1]) == GT || GET_CODE (operands[1]) == LE)
3962 && extended_count (operands[2], DImode, 1) > 0))"
3963 [(set (match_dup 4) (and:DI (match_dup 2) (match_dup 5)))
3964 (set (match_dup 0) (match_dup 6))]
3965 {
3966 operands[5] = GEN_INT (~ INTVAL (operands[3]));
3967 operands[6] = gen_rtx_fmt_ee (((GET_CODE (operands[1]) == GTU
3968 || GET_CODE (operands[1]) == GT)
3969 ? NE : EQ),
3970 DImode, operands[4], const0_rtx);
3971 })
3972
3973 ;; Prefer to use cmp and arithmetic when possible instead of a cmove.
3974
3975 (define_split
3976 [(set (match_operand 0 "register_operand" "")
3977 (if_then_else (match_operator 1 "signed_comparison_operator"
3978 [(match_operand:DI 2 "reg_or_0_operand" "")
3979 (const_int 0)])
3980 (match_operand 3 "const_int_operand" "")
3981 (match_operand 4 "const_int_operand" "")))]
3982 ""
3983 [(const_int 0)]
3984 {
3985 if (alpha_split_conditional_move (GET_CODE (operands[1]), operands[0],
3986 operands[2], operands[3], operands[4]))
3987 DONE;
3988 else
3989 FAIL;
3990 })
3991
3992 ;; ??? Why combine is allowed to create such non-canonical rtl, I don't know.
3993 ;; Oh well, we match it in movcc, so it must be partially our fault.
3994 (define_split
3995 [(set (match_operand 0 "register_operand" "")
3996 (if_then_else (match_operator 1 "signed_comparison_operator"
3997 [(const_int 0)
3998 (match_operand:DI 2 "reg_or_0_operand" "")])
3999 (match_operand 3 "const_int_operand" "")
4000 (match_operand 4 "const_int_operand" "")))]
4001 ""
4002 [(const_int 0)]
4003 {
4004 if (alpha_split_conditional_move (swap_condition (GET_CODE (operands[1])),
4005 operands[0], operands[2], operands[3],
4006 operands[4]))
4007 DONE;
4008 else
4009 FAIL;
4010 })
4011
4012 (define_insn_and_split "*cmp_sadd_di"
4013 [(set (match_operand:DI 0 "register_operand" "=r")
4014 (plus:DI (if_then_else:DI
4015 (match_operator 1 "alpha_zero_comparison_operator"
4016 [(match_operand:DI 2 "reg_or_0_operand" "rJ")
4017 (const_int 0)])
4018 (match_operand:DI 3 "const48_operand" "I")
4019 (const_int 0))
4020 (match_operand:DI 4 "sext_add_operand" "rIO")))
4021 (clobber (match_scratch:DI 5 "=r"))]
4022 ""
4023 "#"
4024 "! no_new_pseudos || reload_completed"
4025 [(set (match_dup 5)
4026 (match_op_dup:DI 1 [(match_dup 2) (const_int 0)]))
4027 (set (match_dup 0)
4028 (plus:DI (mult:DI (match_dup 5) (match_dup 3))
4029 (match_dup 4)))]
4030 {
4031 if (! no_new_pseudos)
4032 operands[5] = gen_reg_rtx (DImode);
4033 else if (reg_overlap_mentioned_p (operands[5], operands[4]))
4034 operands[5] = operands[0];
4035 })
4036
4037 (define_insn_and_split "*cmp_sadd_si"
4038 [(set (match_operand:SI 0 "register_operand" "=r")
4039 (plus:SI (if_then_else:SI
4040 (match_operator 1 "alpha_zero_comparison_operator"
4041 [(match_operand:DI 2 "reg_or_0_operand" "rJ")
4042 (const_int 0)])
4043 (match_operand:SI 3 "const48_operand" "I")
4044 (const_int 0))
4045 (match_operand:SI 4 "sext_add_operand" "rIO")))
4046 (clobber (match_scratch:SI 5 "=r"))]
4047 ""
4048 "#"
4049 "! no_new_pseudos || reload_completed"
4050 [(set (match_dup 5)
4051 (match_op_dup:SI 1 [(match_dup 2) (const_int 0)]))
4052 (set (match_dup 0)
4053 (plus:SI (mult:SI (match_dup 5) (match_dup 3))
4054 (match_dup 4)))]
4055 {
4056 if (! no_new_pseudos)
4057 operands[5] = gen_reg_rtx (DImode);
4058 else if (reg_overlap_mentioned_p (operands[5], operands[4]))
4059 operands[5] = operands[0];
4060 })
4061
4062 (define_insn_and_split "*cmp_sadd_sidi"
4063 [(set (match_operand:DI 0 "register_operand" "=r")
4064 (sign_extend:DI
4065 (plus:SI (if_then_else:SI
4066 (match_operator 1 "alpha_zero_comparison_operator"
4067 [(match_operand:DI 2 "reg_or_0_operand" "rJ")
4068 (const_int 0)])
4069 (match_operand:SI 3 "const48_operand" "I")
4070 (const_int 0))
4071 (match_operand:SI 4 "sext_add_operand" "rIO"))))
4072 (clobber (match_scratch:SI 5 "=r"))]
4073 ""
4074 "#"
4075 "! no_new_pseudos || reload_completed"
4076 [(set (match_dup 5)
4077 (match_op_dup:SI 1 [(match_dup 2) (const_int 0)]))
4078 (set (match_dup 0)
4079 (sign_extend:DI (plus:SI (mult:SI (match_dup 5) (match_dup 3))
4080 (match_dup 4))))]
4081 {
4082 if (! no_new_pseudos)
4083 operands[5] = gen_reg_rtx (DImode);
4084 else if (reg_overlap_mentioned_p (operands[5], operands[4]))
4085 operands[5] = operands[0];
4086 })
4087
4088 (define_insn_and_split "*cmp_ssub_di"
4089 [(set (match_operand:DI 0 "register_operand" "=r")
4090 (minus:DI (if_then_else:DI
4091 (match_operator 1 "alpha_zero_comparison_operator"
4092 [(match_operand:DI 2 "reg_or_0_operand" "rJ")
4093 (const_int 0)])
4094 (match_operand:DI 3 "const48_operand" "I")
4095 (const_int 0))
4096 (match_operand:DI 4 "reg_or_8bit_operand" "rI")))
4097 (clobber (match_scratch:DI 5 "=r"))]
4098 ""
4099 "#"
4100 "! no_new_pseudos || reload_completed"
4101 [(set (match_dup 5)
4102 (match_op_dup:DI 1 [(match_dup 2) (const_int 0)]))
4103 (set (match_dup 0)
4104 (minus:DI (mult:DI (match_dup 5) (match_dup 3))
4105 (match_dup 4)))]
4106 {
4107 if (! no_new_pseudos)
4108 operands[5] = gen_reg_rtx (DImode);
4109 else if (reg_overlap_mentioned_p (operands[5], operands[4]))
4110 operands[5] = operands[0];
4111 })
4112
4113 (define_insn_and_split "*cmp_ssub_si"
4114 [(set (match_operand:SI 0 "register_operand" "=r")
4115 (minus:SI (if_then_else:SI
4116 (match_operator 1 "alpha_zero_comparison_operator"
4117 [(match_operand:DI 2 "reg_or_0_operand" "rJ")
4118 (const_int 0)])
4119 (match_operand:SI 3 "const48_operand" "I")
4120 (const_int 0))
4121 (match_operand:SI 4 "reg_or_8bit_operand" "rI")))
4122 (clobber (match_scratch:SI 5 "=r"))]
4123 ""
4124 "#"
4125 "! no_new_pseudos || reload_completed"
4126 [(set (match_dup 5)
4127 (match_op_dup:SI 1 [(match_dup 2) (const_int 0)]))
4128 (set (match_dup 0)
4129 (minus:SI (mult:SI (match_dup 5) (match_dup 3))
4130 (match_dup 4)))]
4131 {
4132 if (! no_new_pseudos)
4133 operands[5] = gen_reg_rtx (DImode);
4134 else if (reg_overlap_mentioned_p (operands[5], operands[4]))
4135 operands[5] = operands[0];
4136 })
4137
4138 (define_insn_and_split "*cmp_ssub_sidi"
4139 [(set (match_operand:DI 0 "register_operand" "=r")
4140 (sign_extend:DI
4141 (minus:SI (if_then_else:SI
4142 (match_operator 1 "alpha_zero_comparison_operator"
4143 [(match_operand:DI 2 "reg_or_0_operand" "rJ")
4144 (const_int 0)])
4145 (match_operand:SI 3 "const48_operand" "I")
4146 (const_int 0))
4147 (match_operand:SI 4 "reg_or_8bit_operand" "rI"))))
4148 (clobber (match_scratch:SI 5 "=r"))]
4149 ""
4150 "#"
4151 "! no_new_pseudos || reload_completed"
4152 [(set (match_dup 5)
4153 (match_op_dup:SI 1 [(match_dup 2) (const_int 0)]))
4154 (set (match_dup 0)
4155 (sign_extend:DI (minus:SI (mult:SI (match_dup 5) (match_dup 3))
4156 (match_dup 4))))]
4157 {
4158 if (! no_new_pseudos)
4159 operands[5] = gen_reg_rtx (DImode);
4160 else if (reg_overlap_mentioned_p (operands[5], operands[4]))
4161 operands[5] = operands[0];
4162 })
4163 \f
4164 ;; Here are the CALL and unconditional branch insns. Calls on NT and OSF
4165 ;; work differently, so we have different patterns for each.
4166
4167 (define_expand "call"
4168 [(use (match_operand:DI 0 "" ""))
4169 (use (match_operand 1 "" ""))
4170 (use (match_operand 2 "" ""))
4171 (use (match_operand 3 "" ""))]
4172 ""
4173 {
4174 if (TARGET_ABI_WINDOWS_NT)
4175 emit_call_insn (gen_call_nt (operands[0], operands[1]));
4176 else if (TARGET_ABI_OPEN_VMS)
4177 emit_call_insn (gen_call_vms (operands[0], operands[2]));
4178 else
4179 emit_call_insn (gen_call_osf (operands[0], operands[1]));
4180 DONE;
4181 })
4182
4183 (define_expand "sibcall"
4184 [(call (mem:DI (match_operand 0 "" ""))
4185 (match_operand 1 "" ""))]
4186 "TARGET_ABI_OSF"
4187 {
4188 if (GET_CODE (operands[0]) != MEM)
4189 abort ();
4190 operands[0] = XEXP (operands[0], 0);
4191 })
4192
4193 (define_expand "call_osf"
4194 [(parallel [(call (mem:DI (match_operand 0 "" ""))
4195 (match_operand 1 "" ""))
4196 (clobber (reg:DI 27))
4197 (clobber (reg:DI 26))])]
4198 ""
4199 {
4200 if (GET_CODE (operands[0]) != MEM)
4201 abort ();
4202
4203 operands[0] = XEXP (operands[0], 0);
4204
4205 if (GET_CODE (operands[0]) != SYMBOL_REF
4206 && ! (GET_CODE (operands[0]) == REG && REGNO (operands[0]) == 27))
4207 {
4208 rtx tem = gen_rtx_REG (DImode, 27);
4209 emit_move_insn (tem, operands[0]);
4210 operands[0] = tem;
4211 }
4212 })
4213
4214 (define_expand "call_nt"
4215 [(parallel [(call (mem:DI (match_operand 0 "" ""))
4216 (match_operand 1 "" ""))
4217 (clobber (reg:DI 26))])]
4218 ""
4219 {
4220 if (GET_CODE (operands[0]) != MEM)
4221 abort ();
4222
4223 operands[0] = XEXP (operands[0], 0);
4224 if (GET_CODE (operands[0]) != SYMBOL_REF && GET_CODE (operands[0]) != REG)
4225 operands[0] = force_reg (DImode, operands[0]);
4226 })
4227
4228 ;;
4229 ;; call openvms/alpha
4230 ;; op 0: symbol ref for called function
4231 ;; op 1: next_arg_reg (argument information value for R25)
4232 ;;
4233 (define_expand "call_vms"
4234 [(parallel [(call (mem:DI (match_operand 0 "" ""))
4235 (match_operand 1 "" ""))
4236 (use (match_dup 2))
4237 (use (reg:DI 25))
4238 (use (reg:DI 26))
4239 (clobber (reg:DI 27))])]
4240 ""
4241 {
4242 if (GET_CODE (operands[0]) != MEM)
4243 abort ();
4244
4245 operands[0] = XEXP (operands[0], 0);
4246
4247 /* Always load AI with argument information, then handle symbolic and
4248 indirect call differently. Load RA and set operands[2] to PV in
4249 both cases. */
4250
4251 emit_move_insn (gen_rtx_REG (DImode, 25), operands[1]);
4252 if (GET_CODE (operands[0]) == SYMBOL_REF)
4253 {
4254 rtx linkage = alpha_need_linkage (XSTR (operands[0], 0), 0);
4255
4256 emit_move_insn (gen_rtx_REG (Pmode, 26), gen_rtx_MEM (Pmode, linkage));
4257 operands[2]
4258 = validize_mem (gen_rtx_MEM (Pmode, plus_constant (linkage, 8)));
4259 }
4260 else
4261 {
4262 emit_move_insn (gen_rtx_REG (Pmode, 26),
4263 gen_rtx_MEM (Pmode, plus_constant (operands[0], 8)));
4264 operands[2] = operands[0];
4265 }
4266
4267 })
4268
4269 (define_expand "call_value"
4270 [(use (match_operand 0 "" ""))
4271 (use (match_operand:DI 1 "" ""))
4272 (use (match_operand 2 "" ""))
4273 (use (match_operand 3 "" ""))
4274 (use (match_operand 4 "" ""))]
4275 ""
4276 {
4277 if (TARGET_ABI_WINDOWS_NT)
4278 emit_call_insn (gen_call_value_nt (operands[0], operands[1], operands[2]));
4279 else if (TARGET_ABI_OPEN_VMS)
4280 emit_call_insn (gen_call_value_vms (operands[0], operands[1],
4281 operands[3]));
4282 else
4283 emit_call_insn (gen_call_value_osf (operands[0], operands[1],
4284 operands[2]));
4285 DONE;
4286 })
4287
4288 (define_expand "sibcall_value"
4289 [(set (match_operand 0 "" "")
4290 (call (mem:DI (match_operand 1 "" ""))
4291 (match_operand 2 "" "")))]
4292 "TARGET_ABI_OSF"
4293 {
4294 if (GET_CODE (operands[1]) != MEM)
4295 abort ();
4296 operands[1] = XEXP (operands[1], 0);
4297 })
4298
4299 (define_expand "call_value_osf"
4300 [(parallel [(set (match_operand 0 "" "")
4301 (call (mem:DI (match_operand 1 "" ""))
4302 (match_operand 2 "" "")))
4303 (clobber (reg:DI 27))
4304 (clobber (reg:DI 26))])]
4305 ""
4306 {
4307 if (GET_CODE (operands[1]) != MEM)
4308 abort ();
4309
4310 operands[1] = XEXP (operands[1], 0);
4311
4312 if (GET_CODE (operands[1]) != SYMBOL_REF
4313 && ! (GET_CODE (operands[1]) == REG && REGNO (operands[1]) == 27))
4314 {
4315 rtx tem = gen_rtx_REG (DImode, 27);
4316 emit_move_insn (tem, operands[1]);
4317 operands[1] = tem;
4318 }
4319 })
4320
4321 (define_expand "call_value_nt"
4322 [(parallel [(set (match_operand 0 "" "")
4323 (call (mem:DI (match_operand 1 "" ""))
4324 (match_operand 2 "" "")))
4325 (clobber (reg:DI 26))])]
4326 ""
4327 {
4328 if (GET_CODE (operands[1]) != MEM)
4329 abort ();
4330
4331 operands[1] = XEXP (operands[1], 0);
4332 if (GET_CODE (operands[1]) != SYMBOL_REF && GET_CODE (operands[1]) != REG)
4333 operands[1] = force_reg (DImode, operands[1]);
4334 })
4335
4336 (define_expand "call_value_vms"
4337 [(parallel [(set (match_operand 0 "" "")
4338 (call (mem:DI (match_operand:DI 1 "" ""))
4339 (match_operand 2 "" "")))
4340 (use (match_dup 3))
4341 (use (reg:DI 25))
4342 (use (reg:DI 26))
4343 (clobber (reg:DI 27))])]
4344 ""
4345 {
4346 if (GET_CODE (operands[1]) != MEM)
4347 abort ();
4348
4349 operands[1] = XEXP (operands[1], 0);
4350
4351 /* Always load AI with argument information, then handle symbolic and
4352 indirect call differently. Load RA and set operands[3] to PV in
4353 both cases. */
4354
4355 emit_move_insn (gen_rtx_REG (DImode, 25), operands[2]);
4356 if (GET_CODE (operands[1]) == SYMBOL_REF)
4357 {
4358 rtx linkage = alpha_need_linkage (XSTR (operands[1], 0), 0);
4359
4360 emit_move_insn (gen_rtx_REG (Pmode, 26), gen_rtx_MEM (Pmode, linkage));
4361 operands[3]
4362 = validize_mem (gen_rtx_MEM (Pmode, plus_constant (linkage, 8)));
4363 }
4364 else
4365 {
4366 emit_move_insn (gen_rtx_REG (Pmode, 26),
4367 gen_rtx_MEM (Pmode, plus_constant (operands[1], 8)));
4368 operands[3] = operands[1];
4369 }
4370 })
4371
4372 (define_insn "*call_osf_1_er_noreturn"
4373 [(call (mem:DI (match_operand:DI 0 "call_operand" "c,R,i"))
4374 (match_operand 1 "" ""))
4375 (clobber (reg:DI 27))
4376 (clobber (reg:DI 26))]
4377 "TARGET_EXPLICIT_RELOCS && TARGET_ABI_OSF
4378 && find_reg_note (insn, REG_NORETURN, NULL_RTX)"
4379 "@
4380 jsr $26,($27),0
4381 bsr $26,$%0..ng
4382 ldq $27,%0($29)\t\t!literal!%#\;jsr $26,($27),%0\t\t!lituse_jsr!%#"
4383 [(set_attr "type" "jsr")
4384 (set_attr "length" "*,*,8")])
4385
4386 (define_insn "*call_osf_1_er"
4387 [(call (mem:DI (match_operand:DI 0 "call_operand" "c,R,i"))
4388 (match_operand 1 "" ""))
4389 (clobber (reg:DI 27))
4390 (clobber (reg:DI 26))]
4391 "TARGET_EXPLICIT_RELOCS && TARGET_ABI_OSF"
4392 "@
4393 jsr $26,($27),0\;ldah $29,0($26)\t\t!gpdisp!%*\;lda $29,0($29)\t\t!gpdisp!%*
4394 bsr $26,$%0..ng
4395 ldq $27,%0($29)\t\t!literal!%#\;jsr $26,($27),%0\t\t!lituse_jsr!%#\;ldah $29,0($26)\t\t!gpdisp!%*\;lda $29,0($29)\t\t!gpdisp!%*"
4396 [(set_attr "type" "jsr")
4397 (set_attr "length" "12,*,16")])
4398
4399 (define_insn "*call_osf_1_noreturn"
4400 [(call (mem:DI (match_operand:DI 0 "call_operand" "c,R,i"))
4401 (match_operand 1 "" ""))
4402 (clobber (reg:DI 27))
4403 (clobber (reg:DI 26))]
4404 "TARGET_ABI_OSF && find_reg_note (insn, REG_NORETURN, NULL_RTX)"
4405 "@
4406 jsr $26,($27),0
4407 bsr $26,$%0..ng
4408 jsr $26,%0"
4409 [(set_attr "type" "jsr")
4410 (set_attr "length" "*,*,8")])
4411
4412 (define_insn "*call_osf_1"
4413 [(call (mem:DI (match_operand:DI 0 "call_operand" "c,R,i"))
4414 (match_operand 1 "" ""))
4415 (clobber (reg:DI 27))
4416 (clobber (reg:DI 26))]
4417 "TARGET_ABI_OSF"
4418 "@
4419 jsr $26,($27),0\;ldgp $29,0($26)
4420 bsr $26,$%0..ng
4421 jsr $26,%0\;ldgp $29,0($26)"
4422 [(set_attr "type" "jsr")
4423 (set_attr "length" "12,*,16")])
4424
4425 (define_insn "*sibcall_osf_1"
4426 [(call (mem:DI (match_operand:DI 0 "current_file_function_operand" "R"))
4427 (match_operand 1 "" ""))]
4428 "TARGET_ABI_OSF"
4429 "br $31,$%0..ng"
4430 [(set_attr "type" "jsr")])
4431
4432 (define_insn "*call_nt_1"
4433 [(call (mem:DI (match_operand:DI 0 "call_operand" "r,R,i"))
4434 (match_operand 1 "" ""))
4435 (clobber (reg:DI 26))]
4436 "TARGET_ABI_WINDOWS_NT"
4437 "@
4438 jsr $26,(%0)
4439 bsr $26,%0
4440 jsr $26,%0"
4441 [(set_attr "type" "jsr")
4442 (set_attr "length" "*,*,12")])
4443
4444 (define_insn "*call_vms_1"
4445 [(call (mem:DI (match_operand:DI 0 "call_operand" "r,i"))
4446 (match_operand 1 "" ""))
4447 (use (match_operand:DI 2 "nonimmediate_operand" "r,m"))
4448 (use (reg:DI 25))
4449 (use (reg:DI 26))
4450 (clobber (reg:DI 27))]
4451 "TARGET_ABI_OPEN_VMS"
4452 "@
4453 mov %2,$27\;jsr $26,0\;ldq $27,0($29)
4454 ldq $27,%2\;jsr $26,%0\;ldq $27,0($29)"
4455 [(set_attr "type" "jsr")
4456 (set_attr "length" "12,16")])
4457
4458 ;; Call subroutine returning any type.
4459
4460 (define_expand "untyped_call"
4461 [(parallel [(call (match_operand 0 "" "")
4462 (const_int 0))
4463 (match_operand 1 "" "")
4464 (match_operand 2 "" "")])]
4465 ""
4466 {
4467 int i;
4468
4469 emit_call_insn (GEN_CALL (operands[0], const0_rtx, NULL, const0_rtx));
4470
4471 for (i = 0; i < XVECLEN (operands[2], 0); i++)
4472 {
4473 rtx set = XVECEXP (operands[2], 0, i);
4474 emit_move_insn (SET_DEST (set), SET_SRC (set));
4475 }
4476
4477 /* The optimizer does not know that the call sets the function value
4478 registers we stored in the result block. We avoid problems by
4479 claiming that all hard registers are used and clobbered at this
4480 point. */
4481 emit_insn (gen_blockage ());
4482
4483 DONE;
4484 })
4485
4486 ;; UNSPEC_VOLATILE is considered to use and clobber all hard registers and
4487 ;; all of memory. This blocks insns from being moved across this point.
4488
4489 (define_insn "blockage"
4490 [(unspec_volatile [(const_int 0)] UNSPECV_BLOCKAGE)]
4491 ""
4492 ""
4493 [(set_attr "length" "0")])
4494
4495 (define_insn "jump"
4496 [(set (pc)
4497 (label_ref (match_operand 0 "" "")))]
4498 ""
4499 "br $31,%l0"
4500 [(set_attr "type" "ibr")])
4501
4502 (define_expand "return"
4503 [(return)]
4504 "direct_return ()"
4505 "")
4506
4507 (define_insn "*return_internal"
4508 [(return)]
4509 "reload_completed"
4510 "ret $31,($26),1"
4511 [(set_attr "type" "ibr")])
4512
4513 (define_insn "indirect_jump"
4514 [(set (pc) (match_operand:DI 0 "register_operand" "r"))]
4515 ""
4516 "jmp $31,(%0),0"
4517 [(set_attr "type" "ibr")])
4518
4519 (define_expand "tablejump"
4520 [(use (match_operand:SI 0 "register_operand" ""))
4521 (use (match_operand:SI 1 "" ""))]
4522 ""
4523 {
4524 if (TARGET_ABI_WINDOWS_NT)
4525 emit_jump_insn (gen_tablejump_nt (operands[0], operands[1]));
4526 else if (TARGET_ABI_OPEN_VMS)
4527 emit_jump_insn (gen_tablejump_vms (operands[0], operands[1]));
4528 else
4529 emit_jump_insn (gen_tablejump_osf (operands[0], operands[1]));
4530
4531 DONE;
4532 })
4533
4534 (define_expand "tablejump_osf"
4535 [(set (match_dup 3)
4536 (sign_extend:DI (match_operand:SI 0 "register_operand" "")))
4537 (set (match_dup 3)
4538 (plus:DI (reg:DI 29) (match_dup 3)))
4539 (parallel [(set (pc)
4540 (match_dup 3))
4541 (use (label_ref (match_operand 1 "" "")))])]
4542 ""
4543 { operands[3] = gen_reg_rtx (DImode); })
4544
4545 (define_expand "tablejump_nt"
4546 [(set (match_dup 3)
4547 (sign_extend:DI (match_operand:SI 0 "register_operand" "")))
4548 (parallel [(set (pc)
4549 (match_dup 3))
4550 (use (label_ref (match_operand 1 "" "")))])]
4551 ""
4552 { operands[3] = gen_reg_rtx (DImode); })
4553
4554 ;;
4555 ;; tablejump, openVMS way
4556 ;; op 0: offset
4557 ;; op 1: label preceding jump-table
4558 ;;
4559 (define_expand "tablejump_vms"
4560 [(set (match_dup 2)
4561 (match_operand:DI 0 "register_operand" ""))
4562 (set (pc)
4563 (plus:DI (match_dup 2)
4564 (label_ref (match_operand 1 "" ""))))]
4565 ""
4566 { operands[2] = gen_reg_rtx (DImode); })
4567
4568 (define_insn "*tablejump_osf_nt_internal"
4569 [(set (pc)
4570 (match_operand:DI 0 "register_operand" "r"))
4571 (use (label_ref (match_operand 1 "" "")))]
4572 "(TARGET_ABI_OSF || TARGET_ABI_WINDOWS_NT)
4573 && alpha_tablejump_addr_vec (insn)"
4574 {
4575 operands[2] = alpha_tablejump_best_label (insn);
4576 return "jmp $31,(%0),%2";
4577 }
4578 [(set_attr "type" "ibr")])
4579
4580 ;;
4581 ;; op 0 is table offset
4582 ;; op 1 is table label
4583 ;;
4584
4585 (define_insn "*tablejump_vms_internal"
4586 [(set (pc)
4587 (plus (match_operand:DI 0 "register_operand" "r")
4588 (label_ref (match_operand 1 "" ""))))]
4589 "TARGET_ABI_OPEN_VMS"
4590 "jmp $31,(%0),0"
4591 [(set_attr "type" "ibr")])
4592
4593 ;; Cache flush. Used by INITIALIZE_TRAMPOLINE. 0x86 is PAL_imb, but we don't
4594 ;; want to have to include pal.h in our .s file.
4595 ;;
4596 ;; Technically the type for call_pal is jsr, but we use that for determining
4597 ;; if we need a GP. Use ibr instead since it has the same EV5 scheduling
4598 ;; characteristics.
4599 (define_insn "imb"
4600 [(unspec_volatile [(const_int 0)] UNSPECV_IMB)]
4601 ""
4602 "call_pal 0x86"
4603 [(set_attr "type" "ibr")])
4604 \f
4605 ;; Finally, we have the basic data motion insns. The byte and word insns
4606 ;; are done via define_expand. Start with the floating-point insns, since
4607 ;; they are simpler.
4608
4609 (define_insn "*movsf_nofix"
4610 [(set (match_operand:SF 0 "nonimmediate_operand" "=f,f,*r,*r,m,m")
4611 (match_operand:SF 1 "input_operand" "fG,m,*rG,m,fG,*r"))]
4612 "TARGET_FPREGS && ! TARGET_FIX
4613 && (register_operand (operands[0], SFmode)
4614 || reg_or_fp0_operand (operands[1], SFmode))"
4615 "@
4616 fmov %R1,%0
4617 ld%, %0,%1
4618 mov %r1,%0
4619 ldl %0,%1
4620 st%, %R1,%0
4621 stl %r1,%0"
4622 [(set_attr "type" "fcpys,fld,ilog,ild,fst,ist")])
4623
4624 (define_insn "*movsf_fix"
4625 [(set (match_operand:SF 0 "nonimmediate_operand" "=f,f,*r,*r,m,m,f,*r")
4626 (match_operand:SF 1 "input_operand" "fG,m,*rG,m,fG,*r,*r,f"))]
4627 "TARGET_FPREGS && TARGET_FIX
4628 && (register_operand (operands[0], SFmode)
4629 || reg_or_fp0_operand (operands[1], SFmode))"
4630 "@
4631 fmov %R1,%0
4632 ld%, %0,%1
4633 mov %r1,%0
4634 ldl %0,%1
4635 st%, %R1,%0
4636 stl %r1,%0
4637 itofs %1,%0
4638 ftois %1,%0"
4639 [(set_attr "type" "fcpys,fld,ilog,ild,fst,ist,itof,ftoi")])
4640
4641 (define_insn "*movsf_nofp"
4642 [(set (match_operand:SF 0 "nonimmediate_operand" "=r,r,m")
4643 (match_operand:SF 1 "input_operand" "rG,m,r"))]
4644 "! TARGET_FPREGS
4645 && (register_operand (operands[0], SFmode)
4646 || reg_or_fp0_operand (operands[1], SFmode))"
4647 "@
4648 mov %r1,%0
4649 ldl %0,%1
4650 stl %r1,%0"
4651 [(set_attr "type" "ilog,ild,ist")])
4652
4653 (define_insn "*movdf_nofix"
4654 [(set (match_operand:DF 0 "nonimmediate_operand" "=f,f,*r,*r,m,m")
4655 (match_operand:DF 1 "input_operand" "fG,m,*rG,m,fG,*r"))]
4656 "TARGET_FPREGS && ! TARGET_FIX
4657 && (register_operand (operands[0], DFmode)
4658 || reg_or_fp0_operand (operands[1], DFmode))"
4659 "@
4660 fmov %R1,%0
4661 ld%- %0,%1
4662 mov %r1,%0
4663 ldq %0,%1
4664 st%- %R1,%0
4665 stq %r1,%0"
4666 [(set_attr "type" "fcpys,fld,ilog,ild,fst,ist")])
4667
4668 (define_insn "*movdf_fix"
4669 [(set (match_operand:DF 0 "nonimmediate_operand" "=f,f,*r,*r,m,m,f,*r")
4670 (match_operand:DF 1 "input_operand" "fG,m,*rG,m,fG,*r,*r,f"))]
4671 "TARGET_FPREGS && TARGET_FIX
4672 && (register_operand (operands[0], DFmode)
4673 || reg_or_fp0_operand (operands[1], DFmode))"
4674 "@
4675 fmov %R1,%0
4676 ld%- %0,%1
4677 mov %r1,%0
4678 ldq %0,%1
4679 st%- %R1,%0
4680 stq %r1,%0
4681 itoft %1,%0
4682 ftoit %1,%0"
4683 [(set_attr "type" "fcpys,fld,ilog,ild,fst,ist,itof,ftoi")])
4684
4685 (define_insn "*movdf_nofp"
4686 [(set (match_operand:DF 0 "nonimmediate_operand" "=r,r,m")
4687 (match_operand:DF 1 "input_operand" "rG,m,r"))]
4688 "! TARGET_FPREGS
4689 && (register_operand (operands[0], DFmode)
4690 || reg_or_fp0_operand (operands[1], DFmode))"
4691 "@
4692 mov %r1,%0
4693 ldq %0,%1
4694 stq %r1,%0"
4695 [(set_attr "type" "ilog,ild,ist")])
4696
4697 ;; Subregs suck for register allocation. Pretend we can move TFmode
4698 ;; data between general registers until after reload.
4699
4700 (define_insn_and_split "*movtf_internal"
4701 [(set (match_operand:TF 0 "nonimmediate_operand" "=r,o")
4702 (match_operand:TF 1 "input_operand" "roG,rG"))]
4703 "register_operand (operands[0], TFmode)
4704 || reg_or_fp0_operand (operands[1], TFmode)"
4705 "#"
4706 "reload_completed"
4707 [(set (match_dup 0) (match_dup 2))
4708 (set (match_dup 1) (match_dup 3))]
4709 {
4710 alpha_split_tfmode_pair (operands);
4711 if (reg_overlap_mentioned_p (operands[0], operands[3]))
4712 {
4713 rtx tmp;
4714 tmp = operands[0], operands[0] = operands[1], operands[1] = tmp;
4715 tmp = operands[2], operands[2] = operands[3], operands[3] = tmp;
4716 }
4717 })
4718
4719 (define_expand "movsf"
4720 [(set (match_operand:SF 0 "nonimmediate_operand" "")
4721 (match_operand:SF 1 "general_operand" ""))]
4722 ""
4723 {
4724 if (GET_CODE (operands[0]) == MEM
4725 && ! reg_or_fp0_operand (operands[1], SFmode))
4726 operands[1] = force_reg (SFmode, operands[1]);
4727 })
4728
4729 (define_expand "movdf"
4730 [(set (match_operand:DF 0 "nonimmediate_operand" "")
4731 (match_operand:DF 1 "general_operand" ""))]
4732 ""
4733 {
4734 if (GET_CODE (operands[0]) == MEM
4735 && ! reg_or_fp0_operand (operands[1], DFmode))
4736 operands[1] = force_reg (DFmode, operands[1]);
4737 })
4738
4739 (define_expand "movtf"
4740 [(set (match_operand:TF 0 "nonimmediate_operand" "")
4741 (match_operand:TF 1 "general_operand" ""))]
4742 ""
4743 {
4744 if (GET_CODE (operands[0]) == MEM
4745 && ! reg_or_fp0_operand (operands[1], TFmode))
4746 operands[1] = force_reg (TFmode, operands[1]);
4747 })
4748
4749 (define_insn "*movsi_nofix"
4750 [(set (match_operand:SI 0 "nonimmediate_operand" "=r,r,r,r,m,*f,*f,m")
4751 (match_operand:SI 1 "input_operand" "rJ,K,L,m,rJ,*fJ,m,*f"))]
4752 "TARGET_ABI_OSF && ! TARGET_FIX
4753 && (register_operand (operands[0], SImode)
4754 || reg_or_0_operand (operands[1], SImode))"
4755 "@
4756 mov %r1,%0
4757 lda %0,%1($31)
4758 ldah %0,%h1($31)
4759 ldl %0,%1
4760 stl %r1,%0
4761 fmov %R1,%0
4762 ld%, %0,%1
4763 st%, %R1,%0"
4764 [(set_attr "type" "ilog,iadd,iadd,ild,ist,fcpys,fld,fst")])
4765
4766 (define_insn "*movsi_fix"
4767 [(set (match_operand:SI 0 "nonimmediate_operand" "=r,r,r,r,m,*f,*f,m,r,*f")
4768 (match_operand:SI 1 "input_operand" "rJ,K,L,m,rJ,*fJ,m,*f,*f,r"))]
4769 "TARGET_ABI_OSF && TARGET_FIX
4770 && (register_operand (operands[0], SImode)
4771 || reg_or_0_operand (operands[1], SImode))"
4772 "@
4773 mov %r1,%0
4774 lda %0,%1($31)
4775 ldah %0,%h1($31)
4776 ldl %0,%1
4777 stl %r1,%0
4778 fmov %R1,%0
4779 ld%, %0,%1
4780 st%, %R1,%0
4781 ftois %1,%0
4782 itofs %1,%0"
4783 [(set_attr "type" "ilog,iadd,iadd,ild,ist,fcpys,fld,fst,ftoi,itof")])
4784
4785 (define_insn "*movsi_nt_vms"
4786 [(set (match_operand:SI 0 "nonimmediate_operand" "=r,r,r,r,r,m,*f,*f,m")
4787 (match_operand:SI 1 "input_operand" "rJ,K,L,s,m,rJ,*fJ,m,*f"))]
4788 "(TARGET_ABI_WINDOWS_NT || TARGET_ABI_OPEN_VMS)
4789 && (register_operand (operands[0], SImode)
4790 || reg_or_0_operand (operands[1], SImode))"
4791 "@
4792 mov %1,%0
4793 lda %0,%1
4794 ldah %0,%h1
4795 lda %0,%1
4796 ldl %0,%1
4797 stl %r1,%0
4798 fmov %R1,%0
4799 ld%, %0,%1
4800 st%, %R1,%0"
4801 [(set_attr "type" "ilog,iadd,iadd,ldsym,ild,ist,fcpys,fld,fst")])
4802
4803 (define_insn "*movhi_nobwx"
4804 [(set (match_operand:HI 0 "register_operand" "=r,r")
4805 (match_operand:HI 1 "input_operand" "rJ,n"))]
4806 "! TARGET_BWX
4807 && (register_operand (operands[0], HImode)
4808 || register_operand (operands[1], HImode))"
4809 "@
4810 mov %r1,%0
4811 lda %0,%L1($31)"
4812 [(set_attr "type" "ilog,iadd")])
4813
4814 (define_insn "*movhi_bwx"
4815 [(set (match_operand:HI 0 "nonimmediate_operand" "=r,r,r,m")
4816 (match_operand:HI 1 "input_operand" "rJ,n,m,rJ"))]
4817 "TARGET_BWX
4818 && (register_operand (operands[0], HImode)
4819 || reg_or_0_operand (operands[1], HImode))"
4820 "@
4821 mov %r1,%0
4822 lda %0,%L1($31)
4823 ldwu %0,%1
4824 stw %r1,%0"
4825 [(set_attr "type" "ilog,iadd,ild,ist")])
4826
4827 (define_insn "*movqi_nobwx"
4828 [(set (match_operand:QI 0 "register_operand" "=r,r")
4829 (match_operand:QI 1 "input_operand" "rJ,n"))]
4830 "! TARGET_BWX
4831 && (register_operand (operands[0], QImode)
4832 || register_operand (operands[1], QImode))"
4833 "@
4834 mov %r1,%0
4835 lda %0,%L1($31)"
4836 [(set_attr "type" "ilog,iadd")])
4837
4838 (define_insn "*movqi_bwx"
4839 [(set (match_operand:QI 0 "nonimmediate_operand" "=r,r,r,m")
4840 (match_operand:QI 1 "input_operand" "rJ,n,m,rJ"))]
4841 "TARGET_BWX
4842 && (register_operand (operands[0], QImode)
4843 || reg_or_0_operand (operands[1], QImode))"
4844 "@
4845 mov %r1,%0
4846 lda %0,%L1($31)
4847 ldbu %0,%1
4848 stb %r1,%0"
4849 [(set_attr "type" "ilog,iadd,ild,ist")])
4850
4851 ;; We do two major things here: handle mem->mem and construct long
4852 ;; constants.
4853
4854 (define_expand "movsi"
4855 [(set (match_operand:SI 0 "nonimmediate_operand" "")
4856 (match_operand:SI 1 "general_operand" ""))]
4857 ""
4858 {
4859 if (alpha_expand_mov (SImode, operands))
4860 DONE;
4861 })
4862
4863 ;; Split a load of a large constant into the appropriate two-insn
4864 ;; sequence.
4865
4866 (define_split
4867 [(set (match_operand:SI 0 "register_operand" "")
4868 (match_operand:SI 1 "const_int_operand" ""))]
4869 "! add_operand (operands[1], SImode)"
4870 [(set (match_dup 0) (match_dup 2))
4871 (set (match_dup 0) (plus:SI (match_dup 0) (match_dup 3)))]
4872 {
4873 rtx tem
4874 = alpha_emit_set_const (operands[0], SImode, INTVAL (operands[1]), 2);
4875
4876 if (tem == operands[0])
4877 DONE;
4878 else
4879 FAIL;
4880 })
4881
4882 (define_insn "*movdi_er_low"
4883 [(set (match_operand:DI 0 "register_operand" "=r")
4884 (lo_sum:DI (match_operand:DI 1 "register_operand" "r")
4885 (match_operand:DI 2 "local_symbolic_operand" "")))]
4886 "TARGET_EXPLICIT_RELOCS"
4887 "lda %0,%2(%1)\t\t!gprellow")
4888
4889 (define_insn "*movdi_er_nofix"
4890 [(set (match_operand:DI 0 "nonimmediate_operand" "=r,r,r,r,r,r,m,*f,*f,Q")
4891 (match_operand:DI 1 "input_operand" "rJ,K,L,T,s,m,rJ,*fJ,Q,*f"))]
4892 "TARGET_EXPLICIT_RELOCS && ! TARGET_FIX
4893 && (register_operand (operands[0], DImode)
4894 || reg_or_0_operand (operands[1], DImode))
4895 && ! local_symbolic_operand (operands[1], DImode)"
4896 "@
4897 mov %r1,%0
4898 lda %0,%1($31)
4899 ldah %0,%h1($31)
4900 ldah %0,%H1
4901 ldq %0,%1($29)\t\t!literal
4902 ldq%A1 %0,%1
4903 stq%A0 %r1,%0
4904 fmov %R1,%0
4905 ldt %0,%1
4906 stt %R1,%0"
4907 [(set_attr "type" "ilog,iadd,iadd,iadd,ldsym,ild,ist,fcpys,fld,fst")])
4908
4909 (define_insn "*movdi_nofix"
4910 [(set (match_operand:DI 0 "nonimmediate_operand" "=r,r,r,r,r,m,*f,*f,Q")
4911 (match_operand:DI 1 "input_operand" "rJ,K,L,s,m,rJ,*fJ,Q,*f"))]
4912 "! TARGET_EXPLICIT_RELOCS && ! TARGET_FIX
4913 && (register_operand (operands[0], DImode)
4914 || reg_or_0_operand (operands[1], DImode))"
4915 "@
4916 mov %r1,%0
4917 lda %0,%1($31)
4918 ldah %0,%h1($31)
4919 lda %0,%1
4920 ldq%A1 %0,%1
4921 stq%A0 %r1,%0
4922 fmov %R1,%0
4923 ldt %0,%1
4924 stt %R1,%0"
4925 [(set_attr "type" "ilog,iadd,iadd,ldsym,ild,ist,fcpys,fld,fst")])
4926
4927 (define_insn "*movdi_er_fix"
4928 [(set (match_operand:DI 0 "nonimmediate_operand" "=r,r,r,r,r,r,m,*f,*f,Q,r,*f")
4929 (match_operand:DI 1 "input_operand" "rJ,K,L,T,s,m,rJ,*fJ,Q,*f,*f,r"))]
4930 "TARGET_EXPLICIT_RELOCS && TARGET_FIX
4931 && (register_operand (operands[0], DImode)
4932 || reg_or_0_operand (operands[1], DImode))
4933 && ! local_symbolic_operand (operands[1], DImode)"
4934 "@
4935 mov %r1,%0
4936 lda %0,%1($31)
4937 ldah %0,%h1($31)
4938 ldah %0,%H1
4939 ldq %0,%1($29)\t\t!literal
4940 ldq%A1 %0,%1
4941 stq%A0 %r1,%0
4942 fmov %R1,%0
4943 ldt %0,%1
4944 stt %R1,%0
4945 ftoit %1,%0
4946 itoft %1,%0"
4947 [(set_attr "type" "ilog,iadd,iadd,iadd,ldsym,ild,ist,fcpys,fld,fst,ftoi,itof")])
4948
4949 (define_insn "*movdi_fix"
4950 [(set (match_operand:DI 0 "nonimmediate_operand" "=r,r,r,r,r,m,*f,*f,Q,r,*f")
4951 (match_operand:DI 1 "input_operand" "rJ,K,L,s,m,rJ,*fJ,Q,*f,*f,r"))]
4952 "! TARGET_EXPLICIT_RELOCS && TARGET_FIX
4953 && (register_operand (operands[0], DImode)
4954 || reg_or_0_operand (operands[1], DImode))"
4955 "@
4956 mov %r1,%0
4957 lda %0,%1($31)
4958 ldah %0,%h1($31)
4959 lda %0,%1
4960 ldq%A1 %0,%1
4961 stq%A0 %r1,%0
4962 fmov %R1,%0
4963 ldt %0,%1
4964 stt %R1,%0
4965 ftoit %1,%0
4966 itoft %1,%0"
4967 [(set_attr "type" "ilog,iadd,iadd,ldsym,ild,ist,fcpys,fld,fst,ftoi,itof")])
4968
4969 ;; VMS needs to set up "vms_base_regno" for unwinding. This move
4970 ;; often appears dead to the life analysis code, at which point we
4971 ;; abort for emitting dead prologue instructions. Force this live.
4972
4973 (define_insn "force_movdi"
4974 [(set (match_operand:DI 0 "register_operand" "=r")
4975 (unspec_volatile:DI [(match_operand:DI 1 "register_operand" "r")]
4976 UNSPECV_FORCE_MOV))]
4977 ""
4978 "mov %1,%0"
4979 [(set_attr "type" "ilog")])
4980
4981 ;; We do three major things here: handle mem->mem, put 64-bit constants in
4982 ;; memory, and construct long 32-bit constants.
4983
4984 (define_expand "movdi"
4985 [(set (match_operand:DI 0 "nonimmediate_operand" "")
4986 (match_operand:DI 1 "general_operand" ""))]
4987 ""
4988 {
4989 if (alpha_expand_mov (DImode, operands))
4990 DONE;
4991 })
4992
4993 ;; Split a load of a large constant into the appropriate two-insn
4994 ;; sequence.
4995
4996 (define_split
4997 [(set (match_operand:DI 0 "register_operand" "")
4998 (match_operand:DI 1 "const_int_operand" ""))]
4999 "! add_operand (operands[1], DImode)"
5000 [(set (match_dup 0) (match_dup 2))
5001 (set (match_dup 0) (plus:DI (match_dup 0) (match_dup 3)))]
5002 {
5003 rtx tem
5004 = alpha_emit_set_const (operands[0], DImode, INTVAL (operands[1]), 2);
5005
5006 if (tem == operands[0])
5007 DONE;
5008 else
5009 FAIL;
5010 })
5011
5012 ;; These are the partial-word cases.
5013 ;;
5014 ;; First we have the code to load an aligned word. Operand 0 is the register
5015 ;; in which to place the result. It's mode is QImode or HImode. Operand 1
5016 ;; is an SImode MEM at the low-order byte of the proper word. Operand 2 is the
5017 ;; number of bits within the word that the value is. Operand 3 is an SImode
5018 ;; scratch register. If operand 0 is a hard register, operand 3 may be the
5019 ;; same register. It is allowed to conflict with operand 1 as well.
5020
5021 (define_expand "aligned_loadqi"
5022 [(set (match_operand:SI 3 "register_operand" "")
5023 (match_operand:SI 1 "memory_operand" ""))
5024 (set (subreg:DI (match_operand:QI 0 "register_operand" "") 0)
5025 (zero_extract:DI (subreg:DI (match_dup 3) 0)
5026 (const_int 8)
5027 (match_operand:DI 2 "const_int_operand" "")))]
5028
5029 ""
5030 "")
5031
5032 (define_expand "aligned_loadhi"
5033 [(set (match_operand:SI 3 "register_operand" "")
5034 (match_operand:SI 1 "memory_operand" ""))
5035 (set (subreg:DI (match_operand:HI 0 "register_operand" "") 0)
5036 (zero_extract:DI (subreg:DI (match_dup 3) 0)
5037 (const_int 16)
5038 (match_operand:DI 2 "const_int_operand" "")))]
5039
5040 ""
5041 "")
5042
5043 ;; Similar for unaligned loads, where we use the sequence from the
5044 ;; Alpha Architecture manual.
5045 ;;
5046 ;; Operand 1 is the address. Operands 2 and 3 are temporaries, where
5047 ;; operand 3 can overlap the input and output registers.
5048
5049 (define_expand "unaligned_loadqi"
5050 [(set (match_operand:DI 2 "register_operand" "")
5051 (mem:DI (and:DI (match_operand:DI 1 "address_operand" "")
5052 (const_int -8))))
5053 (set (match_operand:DI 3 "register_operand" "")
5054 (match_dup 1))
5055 (set (subreg:DI (match_operand:QI 0 "register_operand" "") 0)
5056 (zero_extract:DI (match_dup 2)
5057 (const_int 8)
5058 (ashift:DI (match_dup 3) (const_int 3))))]
5059 ""
5060 "")
5061
5062 (define_expand "unaligned_loadhi"
5063 [(set (match_operand:DI 2 "register_operand" "")
5064 (mem:DI (and:DI (match_operand:DI 1 "address_operand" "")
5065 (const_int -8))))
5066 (set (match_operand:DI 3 "register_operand" "")
5067 (match_dup 1))
5068 (set (subreg:DI (match_operand:QI 0 "register_operand" "") 0)
5069 (zero_extract:DI (match_dup 2)
5070 (const_int 16)
5071 (ashift:DI (match_dup 3) (const_int 3))))]
5072 ""
5073 "")
5074
5075 ;; Storing an aligned byte or word requires two temporaries. Operand 0 is the
5076 ;; aligned SImode MEM. Operand 1 is the register containing the
5077 ;; byte or word to store. Operand 2 is the number of bits within the word that
5078 ;; the value should be placed. Operands 3 and 4 are SImode temporaries.
5079
5080 (define_expand "aligned_store"
5081 [(set (match_operand:SI 3 "register_operand" "")
5082 (match_operand:SI 0 "memory_operand" ""))
5083 (set (subreg:DI (match_dup 3) 0)
5084 (and:DI (subreg:DI (match_dup 3) 0) (match_dup 5)))
5085 (set (subreg:DI (match_operand:SI 4 "register_operand" "") 0)
5086 (ashift:DI (zero_extend:DI (match_operand 1 "register_operand" ""))
5087 (match_operand:DI 2 "const_int_operand" "")))
5088 (set (subreg:DI (match_dup 4) 0)
5089 (ior:DI (subreg:DI (match_dup 4) 0) (subreg:DI (match_dup 3) 0)))
5090 (set (match_dup 0) (match_dup 4))]
5091 ""
5092 {
5093 operands[5] = GEN_INT (~ (GET_MODE_MASK (GET_MODE (operands[1]))
5094 << INTVAL (operands[2])));
5095 })
5096
5097 ;; For the unaligned byte and halfword cases, we use code similar to that
5098 ;; in the ;; Architecture book, but reordered to lower the number of registers
5099 ;; required. Operand 0 is the address. Operand 1 is the data to store.
5100 ;; Operands 2, 3, and 4 are DImode temporaries, where operands 2 and 4 may
5101 ;; be the same temporary, if desired. If the address is in a register,
5102 ;; operand 2 can be that register.
5103
5104 (define_expand "unaligned_storeqi"
5105 [(set (match_operand:DI 3 "register_operand" "")
5106 (mem:DI (and:DI (match_operand:DI 0 "address_operand" "")
5107 (const_int -8))))
5108 (set (match_operand:DI 2 "register_operand" "")
5109 (match_dup 0))
5110 (set (match_dup 3)
5111 (and:DI (not:DI (ashift:DI (const_int 255)
5112 (ashift:DI (match_dup 2) (const_int 3))))
5113 (match_dup 3)))
5114 (set (match_operand:DI 4 "register_operand" "")
5115 (ashift:DI (zero_extend:DI (match_operand:QI 1 "register_operand" ""))
5116 (ashift:DI (match_dup 2) (const_int 3))))
5117 (set (match_dup 4) (ior:DI (match_dup 4) (match_dup 3)))
5118 (set (mem:DI (and:DI (match_dup 0) (const_int -8)))
5119 (match_dup 4))]
5120 ""
5121 "")
5122
5123 (define_expand "unaligned_storehi"
5124 [(set (match_operand:DI 3 "register_operand" "")
5125 (mem:DI (and:DI (match_operand:DI 0 "address_operand" "")
5126 (const_int -8))))
5127 (set (match_operand:DI 2 "register_operand" "")
5128 (match_dup 0))
5129 (set (match_dup 3)
5130 (and:DI (not:DI (ashift:DI (const_int 65535)
5131 (ashift:DI (match_dup 2) (const_int 3))))
5132 (match_dup 3)))
5133 (set (match_operand:DI 4 "register_operand" "")
5134 (ashift:DI (zero_extend:DI (match_operand:HI 1 "register_operand" ""))
5135 (ashift:DI (match_dup 2) (const_int 3))))
5136 (set (match_dup 4) (ior:DI (match_dup 4) (match_dup 3)))
5137 (set (mem:DI (and:DI (match_dup 0) (const_int -8)))
5138 (match_dup 4))]
5139 ""
5140 "")
5141 \f
5142 ;; Here are the define_expand's for QI and HI moves that use the above
5143 ;; patterns. We have the normal sets, plus the ones that need scratch
5144 ;; registers for reload.
5145
5146 (define_expand "movqi"
5147 [(set (match_operand:QI 0 "nonimmediate_operand" "")
5148 (match_operand:QI 1 "general_operand" ""))]
5149 ""
5150 {
5151 if (TARGET_BWX
5152 ? alpha_expand_mov (QImode, operands)
5153 : alpha_expand_mov_nobwx (QImode, operands))
5154 DONE;
5155 })
5156
5157 (define_expand "movhi"
5158 [(set (match_operand:HI 0 "nonimmediate_operand" "")
5159 (match_operand:HI 1 "general_operand" ""))]
5160 ""
5161 {
5162 if (TARGET_BWX
5163 ? alpha_expand_mov (HImode, operands)
5164 : alpha_expand_mov_nobwx (HImode, operands))
5165 DONE;
5166 })
5167
5168 ;; Here are the versions for reload. Note that in the unaligned cases
5169 ;; we know that the operand must not be a pseudo-register because stack
5170 ;; slots are always aligned references.
5171
5172 (define_expand "reload_inqi"
5173 [(parallel [(match_operand:QI 0 "register_operand" "=r")
5174 (match_operand:QI 1 "any_memory_operand" "m")
5175 (match_operand:TI 2 "register_operand" "=&r")])]
5176 "! TARGET_BWX"
5177 {
5178 rtx scratch, seq;
5179
5180 if (GET_CODE (operands[1]) != MEM)
5181 abort ();
5182
5183 if (aligned_memory_operand (operands[1], QImode))
5184 {
5185 seq = gen_reload_inqi_help (operands[0], operands[1],
5186 gen_rtx_REG (SImode, REGNO (operands[2])));
5187 }
5188 else
5189 {
5190 rtx addr;
5191
5192 /* It is possible that one of the registers we got for operands[2]
5193 might coincide with that of operands[0] (which is why we made
5194 it TImode). Pick the other one to use as our scratch. */
5195 if (REGNO (operands[0]) == REGNO (operands[2]))
5196 scratch = gen_rtx_REG (DImode, REGNO (operands[2]) + 1);
5197 else
5198 scratch = gen_rtx_REG (DImode, REGNO (operands[2]));
5199
5200 addr = get_unaligned_address (operands[1], 0);
5201 seq = gen_unaligned_loadqi (operands[0], addr, scratch,
5202 gen_rtx_REG (DImode, REGNO (operands[0])));
5203 alpha_set_memflags (seq, operands[1]);
5204 }
5205 emit_insn (seq);
5206 DONE;
5207 })
5208
5209 (define_expand "reload_inhi"
5210 [(parallel [(match_operand:HI 0 "register_operand" "=r")
5211 (match_operand:HI 1 "any_memory_operand" "m")
5212 (match_operand:TI 2 "register_operand" "=&r")])]
5213 "! TARGET_BWX"
5214 {
5215 rtx scratch, seq;
5216
5217 if (GET_CODE (operands[1]) != MEM)
5218 abort ();
5219
5220 if (aligned_memory_operand (operands[1], HImode))
5221 {
5222 seq = gen_reload_inhi_help (operands[0], operands[1],
5223 gen_rtx_REG (SImode, REGNO (operands[2])));
5224 }
5225 else
5226 {
5227 rtx addr;
5228
5229 /* It is possible that one of the registers we got for operands[2]
5230 might coincide with that of operands[0] (which is why we made
5231 it TImode). Pick the other one to use as our scratch. */
5232 if (REGNO (operands[0]) == REGNO (operands[2]))
5233 scratch = gen_rtx_REG (DImode, REGNO (operands[2]) + 1);
5234 else
5235 scratch = gen_rtx_REG (DImode, REGNO (operands[2]));
5236
5237 addr = get_unaligned_address (operands[1], 0);
5238 seq = gen_unaligned_loadhi (operands[0], addr, scratch,
5239 gen_rtx_REG (DImode, REGNO (operands[0])));
5240 alpha_set_memflags (seq, operands[1]);
5241 }
5242 emit_insn (seq);
5243 DONE;
5244 })
5245
5246 (define_expand "reload_outqi"
5247 [(parallel [(match_operand:QI 0 "any_memory_operand" "=m")
5248 (match_operand:QI 1 "register_operand" "r")
5249 (match_operand:TI 2 "register_operand" "=&r")])]
5250 "! TARGET_BWX"
5251 {
5252 if (GET_CODE (operands[0]) != MEM)
5253 abort ();
5254
5255 if (aligned_memory_operand (operands[0], QImode))
5256 {
5257 emit_insn (gen_reload_outqi_help
5258 (operands[0], operands[1],
5259 gen_rtx_REG (SImode, REGNO (operands[2])),
5260 gen_rtx_REG (SImode, REGNO (operands[2]) + 1)));
5261 }
5262 else
5263 {
5264 rtx addr = get_unaligned_address (operands[0], 0);
5265 rtx scratch1 = gen_rtx_REG (DImode, REGNO (operands[2]));
5266 rtx scratch2 = gen_rtx_REG (DImode, REGNO (operands[2]) + 1);
5267 rtx scratch3 = scratch1;
5268 rtx seq;
5269
5270 if (GET_CODE (addr) == REG)
5271 scratch1 = addr;
5272
5273 seq = gen_unaligned_storeqi (addr, operands[1], scratch1,
5274 scratch2, scratch3);
5275 alpha_set_memflags (seq, operands[0]);
5276 emit_insn (seq);
5277 }
5278 DONE;
5279 })
5280
5281 (define_expand "reload_outhi"
5282 [(parallel [(match_operand:HI 0 "any_memory_operand" "=m")
5283 (match_operand:HI 1 "register_operand" "r")
5284 (match_operand:TI 2 "register_operand" "=&r")])]
5285 "! TARGET_BWX"
5286 {
5287 if (GET_CODE (operands[0]) != MEM)
5288 abort ();
5289
5290 if (aligned_memory_operand (operands[0], HImode))
5291 {
5292 emit_insn (gen_reload_outhi_help
5293 (operands[0], operands[1],
5294 gen_rtx_REG (SImode, REGNO (operands[2])),
5295 gen_rtx_REG (SImode, REGNO (operands[2]) + 1)));
5296 }
5297 else
5298 {
5299 rtx addr = get_unaligned_address (operands[0], 0);
5300 rtx scratch1 = gen_rtx_REG (DImode, REGNO (operands[2]));
5301 rtx scratch2 = gen_rtx_REG (DImode, REGNO (operands[2]) + 1);
5302 rtx scratch3 = scratch1;
5303 rtx seq;
5304
5305 if (GET_CODE (addr) == REG)
5306 scratch1 = addr;
5307
5308 seq = gen_unaligned_storehi (addr, operands[1], scratch1,
5309 scratch2, scratch3);
5310 alpha_set_memflags (seq, operands[0]);
5311 emit_insn (seq);
5312 }
5313 DONE;
5314 })
5315
5316 ;; Helpers for the above. The way reload is structured, we can't
5317 ;; always get a proper address for a stack slot during reload_foo
5318 ;; expansion, so we must delay our address manipulations until after.
5319
5320 (define_insn "reload_inqi_help"
5321 [(set (match_operand:QI 0 "register_operand" "=r")
5322 (match_operand:QI 1 "memory_operand" "m"))
5323 (clobber (match_operand:SI 2 "register_operand" "=r"))]
5324 "! TARGET_BWX && (reload_in_progress || reload_completed)"
5325 "#")
5326
5327 (define_insn "reload_inhi_help"
5328 [(set (match_operand:HI 0 "register_operand" "=r")
5329 (match_operand:HI 1 "memory_operand" "m"))
5330 (clobber (match_operand:SI 2 "register_operand" "=r"))]
5331 "! TARGET_BWX && (reload_in_progress || reload_completed)"
5332 "#")
5333
5334 (define_insn "reload_outqi_help"
5335 [(set (match_operand:QI 0 "memory_operand" "=m")
5336 (match_operand:QI 1 "register_operand" "r"))
5337 (clobber (match_operand:SI 2 "register_operand" "=r"))
5338 (clobber (match_operand:SI 3 "register_operand" "=r"))]
5339 "! TARGET_BWX && (reload_in_progress || reload_completed)"
5340 "#")
5341
5342 (define_insn "reload_outhi_help"
5343 [(set (match_operand:HI 0 "memory_operand" "=m")
5344 (match_operand:HI 1 "register_operand" "r"))
5345 (clobber (match_operand:SI 2 "register_operand" "=r"))
5346 (clobber (match_operand:SI 3 "register_operand" "=r"))]
5347 "! TARGET_BWX && (reload_in_progress || reload_completed)"
5348 "#")
5349
5350 (define_split
5351 [(set (match_operand:QI 0 "register_operand" "")
5352 (match_operand:QI 1 "memory_operand" ""))
5353 (clobber (match_operand:SI 2 "register_operand" ""))]
5354 "! TARGET_BWX && reload_completed"
5355 [(const_int 0)]
5356 {
5357 rtx aligned_mem, bitnum;
5358 get_aligned_mem (operands[1], &aligned_mem, &bitnum);
5359 emit_insn (gen_aligned_loadqi (operands[0], aligned_mem, bitnum,
5360 operands[2]));
5361 DONE;
5362 })
5363
5364 (define_split
5365 [(set (match_operand:HI 0 "register_operand" "")
5366 (match_operand:HI 1 "memory_operand" ""))
5367 (clobber (match_operand:SI 2 "register_operand" ""))]
5368 "! TARGET_BWX && reload_completed"
5369 [(const_int 0)]
5370 {
5371 rtx aligned_mem, bitnum;
5372 get_aligned_mem (operands[1], &aligned_mem, &bitnum);
5373 emit_insn (gen_aligned_loadhi (operands[0], aligned_mem, bitnum,
5374 operands[2]));
5375 DONE;
5376 })
5377
5378 (define_split
5379 [(set (match_operand:QI 0 "memory_operand" "")
5380 (match_operand:QI 1 "register_operand" ""))
5381 (clobber (match_operand:SI 2 "register_operand" ""))
5382 (clobber (match_operand:SI 3 "register_operand" ""))]
5383 "! TARGET_BWX && reload_completed"
5384 [(const_int 0)]
5385 {
5386 rtx aligned_mem, bitnum;
5387 get_aligned_mem (operands[0], &aligned_mem, &bitnum);
5388 emit_insn (gen_aligned_store (aligned_mem, operands[1], bitnum,
5389 operands[2], operands[3]));
5390 DONE;
5391 })
5392
5393 (define_split
5394 [(set (match_operand:HI 0 "memory_operand" "")
5395 (match_operand:HI 1 "register_operand" ""))
5396 (clobber (match_operand:SI 2 "register_operand" ""))
5397 (clobber (match_operand:SI 3 "register_operand" ""))]
5398 "! TARGET_BWX && reload_completed"
5399 [(const_int 0)]
5400 {
5401 rtx aligned_mem, bitnum;
5402 get_aligned_mem (operands[0], &aligned_mem, &bitnum);
5403 emit_insn (gen_aligned_store (aligned_mem, operands[1], bitnum,
5404 operands[2], operands[3]));
5405 DONE;
5406 })
5407 \f
5408 ;; Bit field extract patterns which use ext[wlq][lh]
5409
5410 (define_expand "extv"
5411 [(set (match_operand:DI 0 "register_operand" "")
5412 (sign_extract:DI (match_operand:QI 1 "memory_operand" "")
5413 (match_operand:DI 2 "immediate_operand" "")
5414 (match_operand:DI 3 "immediate_operand" "")))]
5415 ""
5416 {
5417 /* We can do 16, 32 and 64 bit fields, if aligned on byte boundaries. */
5418 if (INTVAL (operands[3]) % 8 != 0
5419 || (INTVAL (operands[2]) != 16
5420 && INTVAL (operands[2]) != 32
5421 && INTVAL (operands[2]) != 64))
5422 FAIL;
5423
5424 /* From mips.md: extract_bit_field doesn't verify that our source
5425 matches the predicate, so we force it to be a MEM here. */
5426 if (GET_CODE (operands[1]) != MEM)
5427 FAIL;
5428
5429 alpha_expand_unaligned_load (operands[0], operands[1],
5430 INTVAL (operands[2]) / 8,
5431 INTVAL (operands[3]) / 8, 1);
5432 DONE;
5433 })
5434
5435 (define_expand "extzv"
5436 [(set (match_operand:DI 0 "register_operand" "")
5437 (zero_extract:DI (match_operand:DI 1 "nonimmediate_operand" "")
5438 (match_operand:DI 2 "immediate_operand" "")
5439 (match_operand:DI 3 "immediate_operand" "")))]
5440 ""
5441 {
5442 /* We can do 8, 16, 32 and 64 bit fields, if aligned on byte boundaries. */
5443 if (INTVAL (operands[3]) % 8 != 0
5444 || (INTVAL (operands[2]) != 8
5445 && INTVAL (operands[2]) != 16
5446 && INTVAL (operands[2]) != 32
5447 && INTVAL (operands[2]) != 64))
5448 FAIL;
5449
5450 if (GET_CODE (operands[1]) == MEM)
5451 {
5452 /* Fail 8 bit fields, falling back on a simple byte load. */
5453 if (INTVAL (operands[2]) == 8)
5454 FAIL;
5455
5456 alpha_expand_unaligned_load (operands[0], operands[1],
5457 INTVAL (operands[2]) / 8,
5458 INTVAL (operands[3]) / 8, 0);
5459 DONE;
5460 }
5461 })
5462
5463 (define_expand "insv"
5464 [(set (zero_extract:DI (match_operand:QI 0 "memory_operand" "")
5465 (match_operand:DI 1 "immediate_operand" "")
5466 (match_operand:DI 2 "immediate_operand" ""))
5467 (match_operand:DI 3 "register_operand" ""))]
5468 ""
5469 {
5470 /* We can do 16, 32 and 64 bit fields, if aligned on byte boundaries. */
5471 if (INTVAL (operands[2]) % 8 != 0
5472 || (INTVAL (operands[1]) != 16
5473 && INTVAL (operands[1]) != 32
5474 && INTVAL (operands[1]) != 64))
5475 FAIL;
5476
5477 /* From mips.md: store_bit_field doesn't verify that our source
5478 matches the predicate, so we force it to be a MEM here. */
5479 if (GET_CODE (operands[0]) != MEM)
5480 FAIL;
5481
5482 alpha_expand_unaligned_store (operands[0], operands[3],
5483 INTVAL (operands[1]) / 8,
5484 INTVAL (operands[2]) / 8);
5485 DONE;
5486 })
5487
5488 ;; Block move/clear, see alpha.c for more details.
5489 ;; Argument 0 is the destination
5490 ;; Argument 1 is the source
5491 ;; Argument 2 is the length
5492 ;; Argument 3 is the alignment
5493
5494 (define_expand "movstrqi"
5495 [(parallel [(set (match_operand:BLK 0 "memory_operand" "")
5496 (match_operand:BLK 1 "memory_operand" ""))
5497 (use (match_operand:DI 2 "immediate_operand" ""))
5498 (use (match_operand:DI 3 "immediate_operand" ""))])]
5499 ""
5500 {
5501 if (alpha_expand_block_move (operands))
5502 DONE;
5503 else
5504 FAIL;
5505 })
5506
5507 (define_expand "clrstrqi"
5508 [(parallel [(set (match_operand:BLK 0 "memory_operand" "")
5509 (const_int 0))
5510 (use (match_operand:DI 1 "immediate_operand" ""))
5511 (use (match_operand:DI 2 "immediate_operand" ""))])]
5512 ""
5513 {
5514 if (alpha_expand_block_clear (operands))
5515 DONE;
5516 else
5517 FAIL;
5518 })
5519 \f
5520 ;; Subroutine of stack space allocation. Perform a stack probe.
5521 (define_expand "probe_stack"
5522 [(set (match_dup 1) (match_operand:DI 0 "const_int_operand" ""))]
5523 ""
5524 {
5525 operands[1] = gen_rtx_MEM (DImode, plus_constant (stack_pointer_rtx,
5526 INTVAL (operands[0])));
5527 MEM_VOLATILE_P (operands[1]) = 1;
5528
5529 operands[0] = const0_rtx;
5530 })
5531
5532 ;; This is how we allocate stack space. If we are allocating a
5533 ;; constant amount of space and we know it is less than 4096
5534 ;; bytes, we need do nothing.
5535 ;;
5536 ;; If it is more than 4096 bytes, we need to probe the stack
5537 ;; periodically.
5538 (define_expand "allocate_stack"
5539 [(set (reg:DI 30)
5540 (plus:DI (reg:DI 30)
5541 (match_operand:DI 1 "reg_or_cint_operand" "")))
5542 (set (match_operand:DI 0 "register_operand" "=r")
5543 (match_dup 2))]
5544 ""
5545 {
5546 if (GET_CODE (operands[1]) == CONST_INT
5547 && INTVAL (operands[1]) < 32768)
5548 {
5549 if (INTVAL (operands[1]) >= 4096)
5550 {
5551 /* We do this the same way as in the prologue and generate explicit
5552 probes. Then we update the stack by the constant. */
5553
5554 int probed = 4096;
5555
5556 emit_insn (gen_probe_stack (GEN_INT (- probed)));
5557 while (probed + 8192 < INTVAL (operands[1]))
5558 emit_insn (gen_probe_stack (GEN_INT (- (probed += 8192))));
5559
5560 if (probed + 4096 < INTVAL (operands[1]))
5561 emit_insn (gen_probe_stack (GEN_INT (- INTVAL(operands[1]))));
5562 }
5563
5564 operands[1] = GEN_INT (- INTVAL (operands[1]));
5565 operands[2] = virtual_stack_dynamic_rtx;
5566 }
5567 else
5568 {
5569 rtx out_label = 0;
5570 rtx loop_label = gen_label_rtx ();
5571 rtx want = gen_reg_rtx (Pmode);
5572 rtx tmp = gen_reg_rtx (Pmode);
5573 rtx memref;
5574
5575 emit_insn (gen_subdi3 (want, stack_pointer_rtx,
5576 force_reg (Pmode, operands[1])));
5577 emit_insn (gen_adddi3 (tmp, stack_pointer_rtx, GEN_INT (-4096)));
5578
5579 if (GET_CODE (operands[1]) != CONST_INT)
5580 {
5581 out_label = gen_label_rtx ();
5582 emit_insn (gen_cmpdi (want, tmp));
5583 emit_jump_insn (gen_bgeu (out_label));
5584 }
5585
5586 emit_label (loop_label);
5587 memref = gen_rtx_MEM (DImode, tmp);
5588 MEM_VOLATILE_P (memref) = 1;
5589 emit_move_insn (memref, const0_rtx);
5590 emit_insn (gen_adddi3 (tmp, tmp, GEN_INT(-8192)));
5591 emit_insn (gen_cmpdi (tmp, want));
5592 emit_jump_insn (gen_bgtu (loop_label));
5593
5594 memref = gen_rtx_MEM (DImode, want);
5595 MEM_VOLATILE_P (memref) = 1;
5596 emit_move_insn (memref, const0_rtx);
5597
5598 if (out_label)
5599 emit_label (out_label);
5600
5601 emit_move_insn (stack_pointer_rtx, want);
5602 emit_move_insn (operands[0], virtual_stack_dynamic_rtx);
5603 DONE;
5604 }
5605 })
5606
5607 ;; This is used by alpha_expand_prolog to do the same thing as above,
5608 ;; except we cannot at that time generate new basic blocks, so we hide
5609 ;; the loop in this one insn.
5610
5611 (define_insn "prologue_stack_probe_loop"
5612 [(unspec_volatile [(match_operand:DI 0 "register_operand" "r")
5613 (match_operand:DI 1 "register_operand" "r")]
5614 UNSPECV_PSPL)]
5615 ""
5616 {
5617 operands[2] = gen_label_rtx ();
5618 ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, "L",
5619 CODE_LABEL_NUMBER (operands[2]));
5620
5621 return "stq $31,-8192(%1)\;subq %0,1,%0\;lda %1,-8192(%1)\;bne %0,%l2";
5622 }
5623 [(set_attr "length" "16")
5624 (set_attr "type" "multi")])
5625
5626 (define_expand "prologue"
5627 [(clobber (const_int 0))]
5628 ""
5629 {
5630 alpha_expand_prologue ();
5631 DONE;
5632 })
5633
5634 ;; These take care of emitting the ldgp insn in the prologue. This will be
5635 ;; an lda/ldah pair and we want to align them properly. So we have two
5636 ;; unspec_volatile insns, the first of which emits the ldgp assembler macro
5637 ;; and the second of which emits nothing. However, both are marked as type
5638 ;; IADD (the default) so the alignment code in alpha.c does the right thing
5639 ;; with them.
5640
5641 (define_expand "prologue_ldgp"
5642 [(unspec_volatile [(const_int 0)] UNSPECV_LDGP1)
5643 (unspec_volatile [(const_int 0)] UNSPECV_LDGP2)]
5644 ""
5645 "")
5646
5647 (define_insn "*prologue_ldgp_1_er"
5648 [(unspec_volatile [(const_int 0)] UNSPECV_LDGP1)]
5649 "TARGET_EXPLICIT_RELOCS"
5650 "ldah $29,0($27)\t\t!gpdisp!%*\;lda $29,0($29)\t\t!gpdisp!%*\n$%~..ng:")
5651
5652 (define_insn "*prologue_ldgp_1"
5653 [(unspec_volatile [(const_int 0)] UNSPECV_LDGP1)]
5654 ""
5655 "ldgp $29,0($27)\n$%~..ng:")
5656
5657 (define_insn "*prologue_ldgp_2"
5658 [(unspec_volatile [(const_int 0)] UNSPECV_LDGP2)]
5659 ""
5660 "")
5661
5662 ;; The _mcount profiling hook has special calling conventions, and
5663 ;; does not clobber all the registers that a normal call would. So
5664 ;; hide the fact this is a call at all.
5665
5666 (define_insn "prologue_mcount"
5667 [(unspec_volatile [(const_int 0)] UNSPECV_MCOUNT)]
5668 ""
5669 "lda $28,_mcount\;jsr $28,($28),_mcount"
5670 [(set_attr "type" "multi")
5671 (set_attr "length" "8")])
5672
5673 (define_insn "init_fp"
5674 [(set (match_operand:DI 0 "register_operand" "=r")
5675 (match_operand:DI 1 "register_operand" "r"))
5676 (clobber (mem:BLK (match_operand:DI 2 "register_operand" "=r")))]
5677 ""
5678 "mov %1,%0")
5679
5680 (define_expand "epilogue"
5681 [(return)]
5682 ""
5683 {
5684 alpha_expand_epilogue ();
5685 })
5686
5687 (define_expand "sibcall_epilogue"
5688 [(return)]
5689 "TARGET_ABI_OSF"
5690 {
5691 alpha_expand_epilogue ();
5692 DONE;
5693 })
5694
5695 ;; In creating a large stack frame, NT _must_ use ldah+lda to load
5696 ;; the frame size into a register. We use this pattern to ensure
5697 ;; we get lda instead of addq.
5698 (define_insn "nt_lda"
5699 [(set (match_operand:DI 0 "register_operand" "=r")
5700 (unspec:DI [(match_dup 0)
5701 (match_operand:DI 1 "const_int_operand" "n")]
5702 UNSPEC_NT_LDA))]
5703 ""
5704 "lda %0,%1(%0)")
5705
5706 (define_expand "builtin_longjmp"
5707 [(use (match_operand:DI 0 "register_operand" "r"))]
5708 "TARGET_ABI_OSF"
5709 {
5710 /* The elements of the buffer are, in order: */
5711 rtx fp = gen_rtx_MEM (Pmode, operands[0]);
5712 rtx lab = gen_rtx_MEM (Pmode, plus_constant (operands[0], 8));
5713 rtx stack = gen_rtx_MEM (Pmode, plus_constant (operands[0], 16));
5714 rtx pv = gen_rtx_REG (Pmode, 27);
5715
5716 /* This bit is the same as expand_builtin_longjmp. */
5717 emit_move_insn (hard_frame_pointer_rtx, fp);
5718 emit_move_insn (pv, lab);
5719 emit_stack_restore (SAVE_NONLOCAL, stack, NULL_RTX);
5720 emit_insn (gen_rtx_USE (VOIDmode, hard_frame_pointer_rtx));
5721 emit_insn (gen_rtx_USE (VOIDmode, stack_pointer_rtx));
5722
5723 /* Load the label we are jumping through into $27 so that we know
5724 where to look for it when we get back to setjmp's function for
5725 restoring the gp. */
5726 emit_jump_insn (gen_builtin_longjmp_internal (pv));
5727 emit_barrier ();
5728 DONE;
5729 })
5730
5731 ;; This is effectively a copy of indirect_jump, but constrained such
5732 ;; that register renaming cannot foil our cunning plan with $27.
5733 (define_insn "builtin_longjmp_internal"
5734 [(set (pc)
5735 (unspec_volatile [(match_operand:DI 0 "register_operand" "c")]
5736 UNSPECV_LONGJMP))]
5737 ""
5738 "jmp $31,(%0),0"
5739 [(set_attr "type" "ibr")])
5740
5741 (define_insn "*builtin_setjmp_receiver_sub_label_er"
5742 [(unspec_volatile [(label_ref (match_operand 0 "" ""))] UNSPECV_SETJMPR)]
5743 "TARGET_EXPLICIT_RELOCS && TARGET_ABI_OSF && TARGET_AS_CAN_SUBTRACT_LABELS"
5744 "\n$LSJ%=:\;ldah $29,0($27)\t\t!gpdisp!%*\;lda $29,$LSJ%=-%l0($29)\t\t!gpdisp!%*"
5745 [(set_attr "length" "8")
5746 (set_attr "type" "multi")])
5747
5748 (define_insn "*builtin_setjmp_receiver_sub_label"
5749 [(unspec_volatile [(label_ref (match_operand 0 "" ""))] UNSPECV_SETJMPR)]
5750 "TARGET_ABI_OSF && TARGET_AS_CAN_SUBTRACT_LABELS"
5751 "\n$LSJ%=:\;ldgp $29,$LSJ%=-%l0($27)"
5752 [(set_attr "length" "8")
5753 (set_attr "type" "multi")])
5754
5755 (define_insn "*builtin_setjmp_receiver_er"
5756 [(unspec_volatile [(label_ref (match_operand 0 "" ""))] UNSPECV_SETJMPR)]
5757 "TARGET_EXPLICIT_RELOCS && TARGET_ABI_OSF"
5758 "br $29,$LSJ%=\n$LSJ%=:\;ldah $29,0($29)\t\t!gpdisp!%*\;lda $29,0($29)\t\t!gpdisp!%*"
5759 [(set_attr "length" "12")
5760 (set_attr "type" "multi")])
5761
5762 (define_insn "builtin_setjmp_receiver"
5763 [(unspec_volatile [(label_ref (match_operand 0 "" ""))] UNSPECV_SETJMPR)]
5764 "TARGET_ABI_OSF"
5765 "br $29,$LSJ%=\n$LSJ%=:\;ldgp $29,0($29)"
5766 [(set_attr "length" "12")
5767 (set_attr "type" "multi")])
5768
5769 (define_expand "exception_receiver"
5770 [(unspec_volatile [(match_dup 0)] UNSPECV_EHR)]
5771 "TARGET_ABI_OSF"
5772 {
5773 if (TARGET_LD_BUGGY_LDGP)
5774 operands[0] = alpha_gp_save_rtx ();
5775 else
5776 operands[0] = const0_rtx;
5777 })
5778
5779 (define_insn "*exception_receiver_1_er"
5780 [(unspec_volatile [(const_int 0)] UNSPECV_EHR)]
5781 "TARGET_EXPLICIT_RELOCS && ! TARGET_LD_BUGGY_LDGP"
5782 "ldah $29,0($26)\t\t!gpdisp!%*\;lda $29,0($29)\t\t!gpdisp!%*"
5783 [(set_attr "length" "8")
5784 (set_attr "type" "multi")])
5785
5786 (define_insn "*exception_receiver_1"
5787 [(unspec_volatile [(const_int 0)] UNSPECV_EHR)]
5788 "! TARGET_LD_BUGGY_LDGP"
5789 "ldgp $29,0($26)"
5790 [(set_attr "length" "8")
5791 (set_attr "type" "multi")])
5792
5793 ;; ??? We don't represent the usage of $29 properly in address loads
5794 ;; and function calls. This leads to the following move being deleted
5795 ;; as dead code unless it is represented as a volatile unspec.
5796
5797 (define_insn "*exception_receiver_2"
5798 [(unspec_volatile [(match_operand:DI 0 "nonimmediate_operand" "r,m")]
5799 UNSPECV_EHR)]
5800 "TARGET_LD_BUGGY_LDGP"
5801 "@
5802 mov %0,$29
5803 ldq $29,%0"
5804 [(set_attr "type" "ilog,ild")])
5805
5806 (define_expand "nonlocal_goto_receiver"
5807 [(unspec_volatile [(const_int 0)] UNSPECV_BLOCKAGE)
5808 (set (reg:DI 27) (mem:DI (reg:DI 29)))
5809 (unspec_volatile [(const_int 0)] UNSPECV_BLOCKAGE)
5810 (use (reg:DI 27))]
5811 "TARGET_ABI_OPEN_VMS"
5812 "")
5813
5814 (define_insn "arg_home"
5815 [(unspec [(const_int 0)] UNSPEC_ARG_HOME)
5816 (use (reg:DI 1))
5817 (use (reg:DI 25))
5818 (use (reg:DI 16))
5819 (use (reg:DI 17))
5820 (use (reg:DI 18))
5821 (use (reg:DI 19))
5822 (use (reg:DI 20))
5823 (use (reg:DI 21))
5824 (use (reg:DI 48))
5825 (use (reg:DI 49))
5826 (use (reg:DI 50))
5827 (use (reg:DI 51))
5828 (use (reg:DI 52))
5829 (use (reg:DI 53))
5830 (clobber (mem:BLK (const_int 0)))
5831 (clobber (reg:DI 24))
5832 (clobber (reg:DI 25))
5833 (clobber (reg:DI 0))]
5834 "TARGET_ABI_OPEN_VMS"
5835 "lda $0,OTS$HOME_ARGS\;ldq $0,8($0)\;jsr $0,OTS$HOME_ARGS"
5836 [(set_attr "length" "16")
5837 (set_attr "type" "multi")])
5838
5839 ;; Close the trap shadow of preceeding instructions. This is generated
5840 ;; by alpha_reorg.
5841
5842 (define_insn "trapb"
5843 [(unspec_volatile [(const_int 0)] UNSPECV_TRAPB)]
5844 ""
5845 "trapb"
5846 [(set_attr "type" "misc")])
5847
5848 ;; No-op instructions used by machine-dependant reorg to preserve
5849 ;; alignment for instruction issue.
5850
5851 (define_insn "nop"
5852 [(const_int 0)]
5853 ""
5854 "nop"
5855 [(set_attr "type" "ilog")])
5856
5857 (define_insn "fnop"
5858 [(const_int 1)]
5859 "TARGET_FP"
5860 "fnop"
5861 [(set_attr "type" "fcpys")])
5862
5863 (define_insn "unop"
5864 [(const_int 2)]
5865 ""
5866 "unop")
5867
5868 (define_insn "realign"
5869 [(unspec_volatile [(match_operand 0 "immediate_operand" "i")]
5870 UNSPECV_REALIGN)]
5871 ""
5872 ".align %0 #realign")
5873
5874 ;; The call patterns are at the end of the file because their
5875 ;; wildcard operand0 interferes with nice recognition.
5876
5877 (define_insn "*call_value_osf_1_er"
5878 [(set (match_operand 0 "" "")
5879 (call (mem:DI (match_operand:DI 1 "call_operand" "c,R,i"))
5880 (match_operand 2 "" "")))
5881 (clobber (reg:DI 27))
5882 (clobber (reg:DI 26))]
5883 "TARGET_EXPLICIT_RELOCS && TARGET_ABI_OSF"
5884 "@
5885 jsr $26,($27),0\;ldah $29,0($26)\t\t!gpdisp!%*\;lda $29,0($29)\t\t!gpdisp!%*
5886 bsr $26,$%1..ng
5887 ldq $27,%1($29)\t\t!literal!%#\;jsr $26,($27),%1\t\t!lituse_jsr!%#\;ldah $29,0($26)\t\t!gpdisp!%*\;lda $29,0($29)\t\t!gpdisp!%*"
5888 [(set_attr "type" "jsr")
5889 (set_attr "length" "12,*,16")])
5890
5891 (define_insn "*call_value_osf_1"
5892 [(set (match_operand 0 "" "")
5893 (call (mem:DI (match_operand:DI 1 "call_operand" "c,R,i"))
5894 (match_operand 2 "" "")))
5895 (clobber (reg:DI 27))
5896 (clobber (reg:DI 26))]
5897 "TARGET_ABI_OSF"
5898 "@
5899 jsr $26,($27),0\;ldgp $29,0($26)
5900 bsr $26,$%1..ng
5901 jsr $26,%1\;ldgp $29,0($26)"
5902 [(set_attr "type" "jsr")
5903 (set_attr "length" "12,*,16")])
5904
5905 (define_insn "*sibcall_value_osf_1"
5906 [(set (match_operand 0 "" "")
5907 (call (mem:DI (match_operand:DI 1 "current_file_function_operand" "R"))
5908 (match_operand 2 "" "")))]
5909 "TARGET_ABI_OSF"
5910 "br $31,$%1..ng"
5911 [(set_attr "type" "jsr")])
5912
5913 (define_insn "*call_value_nt_1"
5914 [(set (match_operand 0 "" "")
5915 (call (mem:DI (match_operand:DI 1 "call_operand" "r,R,i"))
5916 (match_operand 2 "" "")))
5917 (clobber (reg:DI 26))]
5918 "TARGET_ABI_WINDOWS_NT"
5919 "@
5920 jsr $26,(%1)
5921 bsr $26,%1
5922 jsr $26,%1"
5923 [(set_attr "type" "jsr")
5924 (set_attr "length" "*,*,12")])
5925
5926 (define_insn "*call_value_vms_1"
5927 [(set (match_operand 0 "" "")
5928 (call (mem:DI (match_operand:DI 1 "call_operand" "r,i"))
5929 (match_operand 2 "" "")))
5930 (use (match_operand:DI 3 "nonimmediate_operand" "r,m"))
5931 (use (reg:DI 25))
5932 (use (reg:DI 26))
5933 (clobber (reg:DI 27))]
5934 "TARGET_ABI_OPEN_VMS"
5935 "@
5936 mov %3,$27\;jsr $26,0\;ldq $27,0($29)
5937 ldq $27,%3\;jsr $26,%1\;ldq $27,0($29)"
5938 [(set_attr "type" "jsr")
5939 (set_attr "length" "12,16")])