OSDN Git Service

* alpha.c (alpha_return_addr_rtx): New variable.
[pf3gnuchains/gcc-fork.git] / gcc / config / alpha / alpha.md
1 ;; Machine description for DEC Alpha for GNU C compiler
2 ;; Copyright (C) 1992, 93, 94, 95, 96, 1997 Free Software Foundation, Inc.
3 ;; Contributed by Richard Kenner (kenner@vlsi1.ultra.nyu.edu)
4
5 ;; This file is part of GNU CC.
6
7 ;; GNU CC is free software; you can redistribute it and/or modify
8 ;; it under the terms of the GNU General Public License as published by
9 ;; the Free Software Foundation; either version 2, or (at your option)
10 ;; any later version.
11
12 ;; GNU CC is distributed in the hope that it will be useful,
13 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
14 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 ;; GNU General Public License for more details.
16
17 ;; You should have received a copy of the GNU General Public License
18 ;; along with GNU CC; see the file COPYING.  If not, write to
19 ;; the Free Software Foundation, 59 Temple Place - Suite 330,
20 ;; Boston, MA 02111-1307, USA.
21
22 ;;- See file "rtl.def" for documentation on define_insn, match_*, et. al.
23 \f
24 ;; Processor type -- this attribute must exactly match the processor_type
25 ;; enumeration in alpha.h.
26
27 (define_attr "cpu" "ev4,ev5"
28   (const (symbol_ref "alpha_cpu")))
29
30 ;; Define an insn type attribute.  This is used in function unit delay
31 ;; computations, among other purposes.  For the most part, we use the names
32 ;; defined in the EV4 documentation, but add a few that we have to know about
33 ;; separately.
34
35 (define_attr "type"
36   "ld,st,ibr,fbr,jsr,iadd,ilog,shift,cmov,icmp,imull,imulq,imulh,fadd,fmul,fcpys,fdivs,fdivt,ldsym,misc"
37   (const_string "iadd"))
38
39 ;; The TRAP_TYPE attribute marks instructions that may generate traps
40 ;; (which are imprecise and may need a trapb if software complention
41 ;; is desired).
42 (define_attr "trap" "yes,no" (const_string "no"))
43
44 ;; For the EV4 we include four function units: ABOX, which computes
45 ;; the address, BBOX, used for branches, EBOX, used for integer
46 ;; operations, and FBOX, used for FP operations.
47
48 ;; Memory delivers its result in three cycles.
49 (define_function_unit "ev4_abox" 1 0
50   (and (eq_attr "cpu" "ev4")
51        (eq_attr "type" "ld,ldsym,st"))
52   3 1)
53
54 ;; Branches have no delay cost, but do tie up the unit for two cycles.
55 (define_function_unit "ev4_bbox" 1 1
56   (and (eq_attr "cpu" "ev4")
57        (eq_attr "type" "ibr,fbr,jsr"))
58   2 2)
59
60 ;; Arithmetic insns are normally have their results available after
61 ;; two cycles.  There are a number of exceptions.  They are encoded in
62 ;; ADJUST_COST.  Some of the other insns have similar exceptions.
63
64 (define_function_unit "ev4_ebox" 1 0
65   (and (eq_attr "cpu" "ev4")
66        (eq_attr "type" "iadd,ilog,shift,cmov,icmp"))
67   2 1)
68
69 ;; These really don't take up the integer pipeline, but they do occupy
70 ;; IBOX1; we approximate here.
71
72 (define_function_unit "ev4_ebox" 1 0
73   (and (eq_attr "cpu" "ev4")
74        (eq_attr "type" "imull"))
75   21 1)
76
77 (define_function_unit "ev4_ebox" 1 0
78   (and (eq_attr "cpu" "ev4")
79        (eq_attr "type" "imulq,imulh"))
80   23 1)
81
82 (define_function_unit "ev4_imult" 1 0
83   (and (eq_attr "cpu" "ev4")
84        (eq_attr "type" "imull"))
85   21 19)
86
87 (define_function_unit "ev4_imult" 1 0
88   (and (eq_attr "cpu" "ev4")
89        (eq_attr "type" "imulq,imulh"))
90   23 21)
91
92 (define_function_unit "ev4_fbox" 1 0
93   (and (eq_attr "cpu" "ev4")
94        (eq_attr "type" "fadd,fmul,fcpys"))
95   6 1)
96
97 (define_function_unit "ev4_fbox" 1 0
98   (and (eq_attr "cpu" "ev4")
99        (eq_attr "type" "fdivs"))
100   34 0)
101
102 (define_function_unit "ev4_fbox" 1 0
103   (and (eq_attr "cpu" "ev4")
104        (eq_attr "type" "fdivt"))
105   63 0)
106
107 (define_function_unit "ev4_divider" 1 0
108   (and (eq_attr "cpu" "ev4")
109        (eq_attr "type" "fdivs"))
110   34 30)
111
112 (define_function_unit "ev4_divider" 1 0
113   (and (eq_attr "cpu" "ev4")
114        (eq_attr "type" "fdivt"))
115   64 59)
116 \f
117 ;; EV5 scheduling.  EV5 can issue 4 insns per clock.
118
119 ;; EV5 has two asymetric integer units.  Model this with ebox,e0,e1.
120 ;; Everything uses ebox, and those that require particular pipes grab
121 ;; those as well.
122
123 (define_function_unit "ev5_ebox" 2 0
124   (and (eq_attr "cpu" "ev5")
125        (eq_attr "type" "iadd,ilog,icmp,st,shift,imull,imulq,imulh"))
126   1 1)
127
128 ;; Memory takes at least 2 clocks, and load cannot dual issue with stores.
129 (define_function_unit "ev5_ebox" 2 0
130   (and (eq_attr "cpu" "ev5")
131        (eq_attr "type" "ld,ldsym"))
132   2 1)
133
134 (define_function_unit "ev5_e0" 1 0
135   (and (eq_attr "cpu" "ev5")
136        (eq_attr "type" "ld,ldsym"))
137   0 1
138   [(eq_attr "type" "st")])
139
140 ;; Conditional moves always take 2 ticks.
141 (define_function_unit "ev5_ebox" 2 0
142   (and (eq_attr "cpu" "ev5")
143        (eq_attr "type" "cmov"))
144   2 1)
145
146 ;; Stores, shifts, and multiplies can only issue to E0
147 (define_function_unit "ev5_e0" 1 0
148   (and (eq_attr "cpu" "ev5")
149        (eq_attr "type" "st"))
150   1 1)
151
152 ;; But shifts and multiplies don't conflict with loads.
153 (define_function_unit "ev5_e0" 1 0
154   (and (eq_attr "cpu" "ev5")
155        (eq_attr "type" "shift,imull,imulq,imulh"))
156   1 1
157   [(eq_attr "type" "st,shift,imull,imulq,imulh")])
158
159 ;; Branches can only issue to E1
160 (define_function_unit "ev5_e1" 1 0
161   (and (eq_attr "cpu" "ev5")
162        (eq_attr "type" "ibr,jsr"))
163   1 1)
164
165 ;; Multiplies also use the integer multiplier.
166 (define_function_unit "ev5_imult" 1 0
167   (and (eq_attr "cpu" "ev5")
168        (eq_attr "type" "imull"))
169   8 4)
170
171 (define_function_unit "ev5_imult" 1 0
172   (and (eq_attr "cpu" "ev5")
173        (eq_attr "type" "imulq"))
174   12 8)
175
176 (define_function_unit "ev5_imult" 1 0
177   (and (eq_attr "cpu" "ev5")
178        (eq_attr "type" "imulh"))
179   14 8)
180
181 ;; Similarly for the FPU we have two asymetric units.  But fcpys can issue
182 ;; on either so we have to play the game again.
183
184 (define_function_unit "ev5_fpu" 2 0
185   (and (eq_attr "cpu" "ev5")
186        (eq_attr "type" "fadd,fmul,fcpys,fbr,fdivs,fdivt"))
187   4 1)
188   
189 ;; Multiplies (resp. adds) also use the fmul (resp. fadd) units.
190 (define_function_unit "ev5_fm" 1 0
191   (and (eq_attr "cpu" "ev5")
192        (eq_attr "type" "fmul"))
193   4 1)
194
195 (define_function_unit "ev5_fa" 1 0
196   (and (eq_attr "cpu" "ev5")
197        (eq_attr "type" "fadd"))
198   4 1)
199
200 (define_function_unit "ev5_fa" 1 0
201   (and (eq_attr "cpu" "ev5")
202        (eq_attr "type" "fbr"))
203   1 1)
204
205 (define_function_unit "ev5_fa" 1 0
206   (and (eq_attr "cpu" "ev5")
207        (eq_attr "type" "fdivs"))
208   15 1)
209
210 (define_function_unit "ev5_fa" 1 0
211   (and (eq_attr "cpu" "ev5")
212        (eq_attr "type" "fdivt"))
213   22 1)
214 \f
215 ;; First define the arithmetic insns.  Note that the 32-bit forms also
216 ;; sign-extend.
217
218 ;; Note that we can do sign extensions in both FP and integer registers.
219 ;; However, the result must be in the same type of register as the input.
220 ;; The register preferencing code can't handle this case very well, so, for
221 ;; now, don't let the FP case show up here for preferencing.  Also,
222 ;; sign-extends in FP registers take two instructions.
223 (define_insn "extendsidi2"
224   [(set (match_operand:DI 0 "register_operand" "=r,r,*f")
225         (sign_extend:DI (match_operand:SI 1 "nonimmediate_operand" "r,m,*f")))]
226   ""
227   "@
228    addl %1,$31,%0
229    ldl %0,%1
230    cvtql %1,%0\;cvtlq %0,%0"
231   [(set_attr "type" "iadd,ld,fadd")])
232
233 ;; Do addsi3 the way expand_binop would do if we didn't have one.  This
234 ;; generates better code.  We have the anonymous addsi3 pattern below in
235 ;; case combine wants to make it.
236 (define_expand "addsi3"
237   [(set (match_operand:SI 0 "register_operand" "")
238         (plus:SI (match_operand:SI 1 "reg_or_0_operand" "")
239                  (match_operand:SI 2 "add_operand" "")))]
240   ""
241   "
242 { emit_insn (gen_rtx (SET, VOIDmode, gen_lowpart (DImode, operands[0]),
243                       gen_rtx (PLUS, DImode,
244                                gen_lowpart (DImode, operands[1]),
245                                gen_lowpart (DImode, operands[2]))));
246   DONE;
247 } ")
248
249 (define_insn ""
250   [(set (match_operand:SI 0 "register_operand" "=r,r,r,r")
251         (plus:SI (match_operand:SI 1 "reg_or_0_operand" "%rJ,rJ,rJ,rJ")
252                  (match_operand:SI 2 "add_operand" "rI,O,K,L")))]
253   ""
254   "@
255    addl %r1,%2,%0
256    subl %r1,%n2,%0
257    lda %0,%2(%r1)
258    ldah %0,%h2(%r1)")
259
260 (define_split
261   [(set (match_operand:SI 0 "register_operand" "")
262         (plus:SI (match_operand:SI 1 "register_operand" "")
263                  (match_operand:SI 2 "const_int_operand" "")))]
264   "! add_operand (operands[2], SImode)"
265   [(set (match_dup 0) (plus:SI (match_dup 1) (match_dup 3)))
266    (set (match_dup 0) (plus:SI (match_dup 0) (match_dup 4)))]
267   "
268 {
269   HOST_WIDE_INT val = INTVAL (operands[2]);
270   HOST_WIDE_INT low = (val & 0xffff) - 2 * (val & 0x8000);
271   HOST_WIDE_INT rest = val - low;
272
273   operands[3] = GEN_INT (rest);
274   operands[4] = GEN_INT (low);
275 }")
276
277 (define_insn ""
278   [(set (match_operand:DI 0 "register_operand" "=r,r")
279         (sign_extend:DI
280          (plus:SI (match_operand:SI 1 "reg_or_0_operand" "%rJ,rJ")
281                   (match_operand:SI 2 "sext_add_operand" "rI,O"))))]
282   ""
283   "@
284    addl %r1,%2,%0
285    subl %r1,%n2,%0")
286
287 (define_split
288   [(set (match_operand:DI 0 "register_operand" "")
289         (sign_extend:DI
290          (plus:SI (match_operand:SI 1 "register_operand" "")
291                   (match_operand:SI 2 "const_int_operand" ""))))
292    (clobber (match_operand:SI 3 "register_operand" ""))]
293   "! sext_add_operand (operands[2], SImode) && INTVAL (operands[2]) > 0
294    && INTVAL (operands[2]) % 4 == 0"
295   [(set (match_dup 3) (match_dup 4))
296    (set (match_dup 0) (sign_extend:DI (plus:SI (mult:SI (match_dup 3)
297                                                         (match_dup 5))
298                                                (match_dup 1))))]
299   "
300 {
301   HOST_WIDE_INT val = INTVAL (operands[2]) / 4;
302   int mult = 4;
303
304   if (val % 2 == 0)
305     val /= 2, mult = 8;
306
307   operands[4] = GEN_INT (val);
308   operands[5] = GEN_INT (mult);
309 }")
310
311 (define_split
312   [(set (match_operand:DI 0 "register_operand" "")
313         (sign_extend:DI
314          (plus:SI (match_operator:SI 1 "comparison_operator"
315                                      [(match_operand 2 "" "")
316                                       (match_operand 3 "" "")])
317                   (match_operand:SI 4 "add_operand" ""))))
318    (clobber (match_operand:DI 5 "register_operand" ""))]
319   ""
320   [(set (match_dup 5) (match_dup 6))
321    (set (match_dup 0) (sign_extend:DI (plus:SI (match_dup 7) (match_dup 4))))]
322   "
323 {
324   operands[6] = gen_rtx (GET_CODE (operands[1]), DImode,
325                          operands[2], operands[3]);
326   operands[7] = gen_lowpart (SImode, operands[5]);
327 }")
328
329 (define_insn "adddi3"
330   [(set (match_operand:DI 0 "register_operand" "=r,r,r,r")
331         (plus:DI (match_operand:DI 1 "reg_or_0_operand" "%rJ,rJ,rJ,rJ")
332                  (match_operand:DI 2 "add_operand" "rI,O,K,L")))]
333   ""
334   "@
335    addq %r1,%2,%0
336    subq %r1,%n2,%0
337    lda %0,%2(%r1)
338    ldah %0,%h2(%r1)")
339
340 ;; Don't do this if we are adjusting SP since we don't want to do
341 ;; it in two steps. 
342 (define_split
343   [(set (match_operand:DI 0 "register_operand" "")
344         (plus:DI (match_operand:DI 1 "register_operand" "")
345                  (match_operand:DI 2 "const_int_operand" "")))]
346   "! add_operand (operands[2], DImode)
347    && REGNO (operands[0]) != STACK_POINTER_REGNUM"
348   [(set (match_dup 0) (plus:DI (match_dup 1) (match_dup 3)))
349    (set (match_dup 0) (plus:DI (match_dup 0) (match_dup 4)))]
350   "
351 {
352   HOST_WIDE_INT val = INTVAL (operands[2]);
353   HOST_WIDE_INT low = (val & 0xffff) - 2 * (val & 0x8000);
354   HOST_WIDE_INT rest = val - low;
355
356   operands[3] = GEN_INT (rest);
357   operands[4] = GEN_INT (low);
358 }")
359
360 (define_insn ""
361   [(set (match_operand:SI 0 "register_operand" "=r,r")
362         (plus:SI (mult:SI (match_operand:SI 1 "reg_or_0_operand" "rJ,rJ")
363                           (match_operand:SI 2 "const48_operand" "I,I"))
364                  (match_operand:SI 3 "sext_add_operand" "rI,O")))]
365   ""
366   "@
367    s%2addl %r1,%3,%0
368    s%2subl %r1,%n3,%0")
369
370 (define_insn ""
371   [(set (match_operand:DI 0 "register_operand" "=r,r")
372         (sign_extend:DI
373          (plus:SI (mult:SI (match_operand:SI 1 "reg_or_0_operand" "rJ,rJ")
374                            (match_operand:SI 2 "const48_operand" "I,I"))
375                   (match_operand:SI 3 "sext_add_operand" "rI,O"))))]
376   ""
377   "@
378    s%2addl %r1,%3,%0
379    s%2subl %r1,%n3,%0")
380
381 (define_split
382   [(set (match_operand:DI 0 "register_operand" "")
383         (sign_extend:DI
384          (plus:SI (mult:SI (match_operator:SI 1 "comparison_operator"
385                                               [(match_operand 2 "" "")
386                                                (match_operand 3 "" "")])
387                            (match_operand:SI 4 "const48_operand" ""))
388                   (match_operand:SI 5 "add_operand" ""))))
389    (clobber (match_operand:DI 6 "register_operand" ""))]
390   ""
391   [(set (match_dup 6) (match_dup 7))
392    (set (match_dup 0)
393         (sign_extend:DI (plus:SI (mult:SI (match_dup 8) (match_dup 4))
394                                  (match_dup 5))))]
395   "
396 {
397   operands[7] = gen_rtx (GET_CODE (operands[1]), DImode,
398                          operands[2], operands[3]);
399   operands[8] = gen_lowpart (SImode, operands[6]);
400 }")
401
402 (define_insn ""
403   [(set (match_operand:DI 0 "register_operand" "=r,r")
404         (plus:DI (mult:DI (match_operand:DI 1 "reg_or_0_operand" "rJ,rJ")
405                           (match_operand:DI 2 "const48_operand" "I,I"))
406                  (match_operand:DI 3 "reg_or_8bit_operand" "rI,O")))]
407   ""
408   "@
409    s%2addq %r1,%3,%0
410    s%2subq %1,%n3,%0")
411
412 ;; These variants of the above insns can occur if the third operand
413 ;; is the frame pointer.  This is a kludge, but there doesn't
414 ;; seem to be a way around it.  Only recognize them while reloading.
415
416 (define_insn ""
417   [(set (match_operand:DI 0 "some_operand" "=&r")
418         (plus:DI (plus:DI (match_operand:DI 1 "some_operand" "r")
419                           (match_operand:DI 2 "some_operand" "r"))
420                  (match_operand:DI 3 "some_operand" "rIOKL")))]
421   "reload_in_progress"
422   "#")
423
424 (define_split
425   [(set (match_operand:DI 0 "register_operand" "")
426         (plus:DI (plus:DI (match_operand:DI 1 "register_operand" "")
427                           (match_operand:DI 2 "register_operand" ""))
428                  (match_operand:DI 3 "add_operand" "")))]
429   "reload_completed"
430   [(set (match_dup 0) (plus:DI (match_dup 1) (match_dup 2)))
431    (set (match_dup 0) (plus:DI (match_dup 0) (match_dup 3)))]
432   "")
433                                            
434 (define_insn ""
435   [(set (match_operand:SI 0 "some_operand" "=&r")
436         (plus:SI (plus:SI (mult:SI (match_operand:SI 1 "some_operand" "rJ")
437                                    (match_operand:SI 2 "const48_operand" "I"))
438                           (match_operand:SI 3 "some_operand" "r"))
439                  (match_operand:SI 4 "some_operand" "rIOKL")))]
440   "reload_in_progress"
441   "#")
442
443 (define_split
444   [(set (match_operand:SI 0 "register_operand" "r")
445         (plus:SI (plus:SI (mult:SI (match_operand:SI 1 "reg_or_0_operand" "")
446                                    (match_operand:SI 2 "const48_operand" ""))
447                           (match_operand:SI 3 "register_operand" ""))
448                  (match_operand:SI 4 "add_operand" "rIOKL")))]
449   "reload_completed"
450   [(set (match_dup 0)
451         (plus:SI (mult:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
452    (set (match_dup 0) (plus:SI (match_dup 0) (match_dup 4)))]
453   "")
454
455 (define_insn ""
456   [(set (match_operand:DI 0 "some_operand" "=&r")
457         (sign_extend:DI
458          (plus:SI (plus:SI
459                    (mult:SI (match_operand:SI 1 "some_operand" "rJ")
460                             (match_operand:SI 2 "const48_operand" "I"))
461                    (match_operand:SI 3 "some_operand" "r"))
462                   (match_operand:SI 4 "some_operand" "rIOKL"))))]
463   "reload_in_progress"
464   "#")
465
466 (define_split
467   [(set (match_operand:DI 0 "register_operand" "")
468         (sign_extend:DI
469          (plus:SI (plus:SI
470                    (mult:SI (match_operand:SI 1 "reg_or_0_operand" "")
471                             (match_operand:SI 2 "const48_operand" ""))
472                    (match_operand:SI 3 "register_operand" ""))
473                   (match_operand:SI 4 "add_operand" ""))))]
474   "reload_completed"
475   [(set (match_dup 5)
476         (plus:SI (mult:SI (match_dup 1) (match_dup 2)) (match_dup 3)))
477    (set (match_dup 0) (sign_extend:DI (plus:SI (match_dup 5) (match_dup 4))))]
478   "
479 { operands[5] = gen_lowpart (SImode, operands[0]);
480 }")
481
482 (define_insn ""
483   [(set (match_operand:DI 0 "some_operand" "=&r")
484         (plus:DI (plus:DI (mult:DI (match_operand:DI 1 "some_operand" "rJ")
485                                    (match_operand:DI 2 "const48_operand" "I"))
486                           (match_operand:DI 3 "some_operand" "r"))
487                  (match_operand:DI 4 "some_operand" "rIOKL")))]
488   "reload_in_progress"
489   "#")
490
491 (define_split
492   [(set (match_operand:DI 0 "register_operand" "=")
493         (plus:DI (plus:DI (mult:DI (match_operand:DI 1 "reg_or_0_operand" "")
494                                    (match_operand:DI 2 "const48_operand" ""))
495                           (match_operand:DI 3 "register_operand" ""))
496                  (match_operand:DI 4 "add_operand" "")))]
497   "reload_completed"
498   [(set (match_dup 0)
499         (plus:DI (mult:DI (match_dup 1) (match_dup 2)) (match_dup 3)))
500    (set (match_dup 0) (plus:DI (match_dup 0) (match_dup 4)))]
501   "")
502
503 (define_insn "negsi2"
504   [(set (match_operand:SI 0 "register_operand" "=r")
505         (neg:SI (match_operand:SI 1 "reg_or_8bit_operand" "rI")))]
506   ""
507   "subl $31,%1,%0")
508
509 (define_insn ""
510   [(set (match_operand:DI 0 "register_operand" "=r")
511         (sign_extend:DI (neg:SI
512                          (match_operand:SI 1 "reg_or_8bit_operand" "rI"))))]
513   ""
514   "subl $31,%1,%0")
515
516 (define_insn "negdi2"
517   [(set (match_operand:DI 0 "register_operand" "=r")
518         (neg:DI (match_operand:DI 1 "reg_or_8bit_operand" "rI")))]
519   ""
520   "subq $31,%1,%0")
521
522 (define_expand "subsi3"
523   [(set (match_operand:SI 0 "register_operand" "")
524         (minus:SI (match_operand:SI 1 "reg_or_0_operand" "")
525                   (match_operand:SI 2 "reg_or_8bit_operand" "")))]
526   ""
527   "
528 { emit_insn (gen_rtx (SET, VOIDmode, gen_lowpart (DImode, operands[0]),
529                       gen_rtx (MINUS, DImode,
530                                gen_lowpart (DImode, operands[1]),
531                                gen_lowpart (DImode, operands[2]))));
532   DONE;
533
534 } ")
535
536 (define_insn ""
537   [(set (match_operand:SI 0 "register_operand" "=r")
538         (minus:SI (match_operand:SI 1 "reg_or_0_operand" "rJ")
539                   (match_operand:SI 2 "reg_or_8bit_operand" "rI")))]
540   ""
541   "subl %r1,%2,%0")
542
543 (define_insn ""
544   [(set (match_operand:DI 0 "register_operand" "=r")
545         (sign_extend:DI (minus:SI (match_operand:SI 1 "reg_or_0_operand" "rJ")
546                                   (match_operand:SI 2 "reg_or_8bit_operand" "rI"))))]
547   ""
548   "subl %r1,%2,%0")
549
550 (define_insn "subdi3"
551   [(set (match_operand:DI 0 "register_operand" "=r")
552         (minus:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
553                   (match_operand:DI 2 "reg_or_8bit_operand" "rI")))]
554   ""
555   "subq %r1,%2,%0")
556
557 (define_insn ""
558   [(set (match_operand:SI 0 "register_operand" "=r")
559         (minus:SI (mult:SI (match_operand:SI 1 "reg_or_0_operand" "rJ")
560                            (match_operand:SI 2 "const48_operand" "I"))
561                   (match_operand:SI 3 "reg_or_8bit_operand" "rI")))]
562   ""
563   "s%2subl %r1,%3,%0")
564
565 (define_insn ""
566   [(set (match_operand:DI 0 "register_operand" "=r")
567         (sign_extend:DI
568          (minus:SI (mult:SI (match_operand:SI 1 "reg_or_0_operand" "rJ")
569                             (match_operand:SI 2 "const48_operand" "I"))
570                    (match_operand:SI 3 "reg_or_8bit_operand" "rI"))))]
571   ""
572   "s%2subl %r1,%3,%0")
573
574 (define_insn ""
575   [(set (match_operand:DI 0 "register_operand" "=r")
576         (minus:DI (mult:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
577                            (match_operand:DI 2 "const48_operand" "I"))
578                   (match_operand:DI 3 "reg_or_8bit_operand" "rI")))]
579   ""
580   "s%2subq %r1,%3,%0")
581
582 (define_insn "mulsi3"
583   [(set (match_operand:SI 0 "register_operand" "=r")
584         (mult:SI (match_operand:SI 1 "reg_or_0_operand" "%rJ")
585                  (match_operand:SI 2 "reg_or_0_operand" "rJ")))]
586   ""
587   "mull %r1,%r2,%0"
588   [(set_attr "type" "imull")])
589
590 (define_insn ""
591   [(set (match_operand:DI 0 "register_operand" "=r")
592         (sign_extend:DI (mult:SI (match_operand:SI 1 "reg_or_0_operand" "%rJ")
593                                  (match_operand:SI 2 "reg_or_0_operand" "rJ"))))]
594   ""
595   "mull %r1,%r2,%0"
596   [(set_attr "type" "imull")])
597
598 (define_insn "muldi3"
599   [(set (match_operand:DI 0 "register_operand" "=r")
600         (mult:DI (match_operand:DI 1 "reg_or_0_operand" "%rJ")
601                  (match_operand:DI 2 "reg_or_0_operand" "rJ")))]
602   ""
603   "mulq %r1,%r2,%0"
604   [(set_attr "type" "imulq")])
605
606 (define_insn "umuldi3_highpart"
607   [(set (match_operand:DI 0 "register_operand" "=r")
608         (truncate:DI
609          (lshiftrt:TI
610           (mult:TI (zero_extend:TI (match_operand:DI 1 "register_operand" "r"))
611                    (zero_extend:TI (match_operand:DI 2 "register_operand" "r")))
612           (const_int 64))))]
613   ""
614   "umulh %1,%2,%0"
615   [(set_attr "type" "imulh")])
616
617 (define_insn ""
618   [(set (match_operand:DI 0 "register_operand" "=r")
619         (truncate:DI
620          (lshiftrt:TI
621           (mult:TI (zero_extend:TI (match_operand:DI 1 "register_operand" "r"))
622                    (match_operand:TI 2 "cint8_operand" "I"))
623           (const_int 64))))]
624   ""
625   "umulh %1,%2,%0"
626   [(set_attr "type" "imulh")])
627 \f
628 ;; The divide and remainder operations always take their inputs from
629 ;; r24 and r25, put their output in r27, and clobber r23 and r28.
630
631 ;; ??? comment out the divsi routines since the library functions
632 ;; don't seem to do the right thing with the high 32-bits of a
633 ;; register nonzero.
634
635 ;(define_expand "divsi3"
636 ;  [(set (reg:SI 24) (match_operand:SI 1 "input_operand" ""))
637 ;   (set (reg:SI 25) (match_operand:SI 2 "input_operand" ""))
638 ;   (parallel [(set (reg:SI 27)
639 ;                  (div:SI (reg:SI 24)
640 ;                          (reg:SI 25)))
641 ;             (clobber (reg:DI 23))
642 ;             (clobber (reg:DI 28))])
643 ;   (set (match_operand:SI 0 "general_operand" "")
644 ;       (reg:SI 27))]
645 ;  "!TARGET_OPEN_VMS"
646 ;  "")
647
648 ;(define_expand "udivsi3"
649 ;  [(set (reg:SI 24) (match_operand:SI 1 "input_operand" ""))
650 ;   (set (reg:SI 25) (match_operand:SI 2 "input_operand" ""))
651 ;   (parallel [(set (reg:SI 27)
652 ;                  (udiv:SI (reg:SI 24)
653 ;                           (reg:SI 25)))
654 ;             (clobber (reg:DI 23))
655 ;             (clobber (reg:DI 28))])
656 ;   (set (match_operand:SI 0 "general_operand" "")
657 ;       (reg:SI 27))]
658 ;  "!TARGET_OPEN_VMS"
659 ;  "")
660
661 ;(define_expand "modsi3"
662 ;  [(set (reg:SI 24) (match_operand:SI 1 "input_operand" ""))
663 ;   (set (reg:SI 25) (match_operand:SI 2 "input_operand" ""))
664 ;   (parallel [(set (reg:SI 27)
665 ;                  (mod:SI (reg:SI 24)
666 ;                          (reg:SI 25)))
667 ;             (clobber (reg:DI 23))
668 ;             (clobber (reg:DI 28))])
669 ;   (set (match_operand:SI 0 "general_operand" "")
670 ;       (reg:SI 27))]
671 ;  "!TARGET_OPEN_VMS"
672 ;  "")
673
674 ;(define_expand "umodsi3"
675 ;  [(set (reg:SI 24) (match_operand:SI 1 "input_operand" ""))
676 ;   (set (reg:SI 25) (match_operand:SI 2 "input_operand" ""))
677 ;   (parallel [(set (reg:SI 27)
678 ;                  (umod:SI (reg:SI 24)
679 ;                           (reg:SI 25)))
680 ;             (clobber (reg:DI 23))
681 ;             (clobber (reg:DI 28))])
682 ;   (set (match_operand:SI 0 "general_operand" "")
683 ;       (reg:SI 27))]
684 ;  "!TARGET_OPEN_VMS"
685 ;  "")
686
687 (define_expand "divdi3"
688   [(set (reg:DI 24) (match_operand:DI 1 "input_operand" ""))
689    (set (reg:DI 25) (match_operand:DI 2 "input_operand" ""))
690    (parallel [(set (reg:DI 27)
691                    (div:DI (reg:DI 24)
692                            (reg:DI 25)))
693               (clobber (reg:DI 23))
694               (clobber (reg:DI 28))])
695    (set (match_operand:DI 0 "general_operand" "")
696         (reg:DI 27))]
697   "!TARGET_OPEN_VMS"
698   "")
699
700 (define_expand "udivdi3"
701   [(set (reg:DI 24) (match_operand:DI 1 "input_operand" ""))
702    (set (reg:DI 25) (match_operand:DI 2 "input_operand" ""))
703    (parallel [(set (reg:DI 27)
704                    (udiv:DI (reg:DI 24)
705                             (reg:DI 25)))
706               (clobber (reg:DI 23))
707               (clobber (reg:DI 28))])
708    (set (match_operand:DI 0 "general_operand" "")
709         (reg:DI 27))]
710   "!TARGET_OPEN_VMS"
711   "")
712
713 (define_expand "moddi3"
714   [(set (reg:DI 24) (match_operand:DI 1 "input_operand" ""))
715    (set (reg:DI 25) (match_operand:DI 2 "input_operand" ""))
716    (parallel [(set (reg:DI 27)
717                    (mod:DI (reg:DI 24)
718                            (reg:DI 25)))
719               (clobber (reg:DI 23))
720               (clobber (reg:DI 28))])
721    (set (match_operand:DI 0 "general_operand" "")
722         (reg:DI 27))]
723   "!TARGET_OPEN_VMS"
724   "")
725
726 (define_expand "umoddi3"
727   [(set (reg:DI 24) (match_operand:DI 1 "input_operand" ""))
728    (set (reg:DI 25) (match_operand:DI 2 "input_operand" ""))
729    (parallel [(set (reg:DI 27)
730                    (umod:DI (reg:DI 24)
731                             (reg:DI 25)))
732               (clobber (reg:DI 23))
733               (clobber (reg:DI 28))])
734    (set (match_operand:DI 0 "general_operand" "")
735         (reg:DI 27))]
736   "!TARGET_OPEN_VMS"
737   "")
738
739 ;(define_insn ""
740 ;  [(set (reg:SI 27)
741 ;       (match_operator:SI 1 "divmod_operator"
742 ;                       [(reg:SI 24) (reg:SI 25)]))
743 ;   (clobber (reg:DI 23))
744 ;   (clobber (reg:DI 28))]
745 ;  "!TARGET_OPEN_VMS"
746 ;  "%E1 $24,$25,$27"
747 ;  [(set_attr "type" "jsr")])
748
749 (define_insn ""
750   [(set (reg:DI 27)
751         (match_operator:DI 1 "divmod_operator"
752                         [(reg:DI 24) (reg:DI 25)]))
753    (clobber (reg:DI 23))
754    (clobber (reg:DI 28))]
755   "!TARGET_OPEN_VMS"
756   "%E1 $24,$25,$27"
757   [(set_attr "type" "jsr")])
758 \f
759 ;; Next are the basic logical operations.  These only exist in DImode.
760
761 (define_insn "anddi3"
762   [(set (match_operand:DI 0 "register_operand" "=r,r,r")
763         (and:DI (match_operand:DI 1 "reg_or_0_operand" "%rJ,rJ,rJ")
764                 (match_operand:DI 2 "and_operand" "rI,N,MH")))]
765   ""
766   "@
767    and %r1,%2,%0
768    bic %r1,%N2,%0
769    zapnot %r1,%m2,%0"
770   [(set_attr "type" "ilog,ilog,shift")])
771
772 ;; There are times when we can split an AND into two AND insns.  This occurs
773 ;; when we can first clear any bytes and then clear anything else.  For
774 ;; example "I & 0xffff07" is "(I & 0xffffff) & 0xffffffffffffff07".
775 ;; Only do this when running on 64-bit host since the computations are
776 ;; too messy otherwise.
777
778 (define_split
779   [(set (match_operand:DI 0 "register_operand" "")
780         (and:DI (match_operand:DI 1 "register_operand" "")
781                 (match_operand:DI 2 "const_int_operand" "")))]
782   "HOST_BITS_PER_WIDE_INT == 64 && ! and_operand (operands[2], DImode)"
783   [(set (match_dup 0) (and:DI (match_dup 1) (match_dup 3)))
784    (set (match_dup 0) (and:DI (match_dup 0) (match_dup 4)))]
785   "
786 {
787   unsigned HOST_WIDE_INT mask1 = INTVAL (operands[2]);
788   unsigned HOST_WIDE_INT mask2 = mask1;
789   int i;
790
791   /* For each byte that isn't all zeros, make it all ones.  */
792   for (i = 0; i < 64; i += 8)
793     if ((mask1 & ((HOST_WIDE_INT) 0xff << i)) != 0)
794       mask1 |= (HOST_WIDE_INT) 0xff << i;
795
796   /* Now turn on any bits we've just turned off.  */
797   mask2 |= ~ mask1;
798
799   operands[3] = GEN_INT (mask1);
800   operands[4] = GEN_INT (mask2);
801 }")
802
803 (define_insn "zero_extendqihi2"
804   [(set (match_operand:HI 0 "register_operand" "=r")
805         (zero_extend:HI (match_operand:QI 1 "register_operand" "r")))]
806   ""
807   "zapnot %1,1,%0"
808   [(set_attr "type" "shift")])
809
810 (define_insn ""
811   [(set (match_operand:SI 0 "register_operand" "=r,r")
812         (zero_extend:SI (match_operand:QI 1 "nonimmediate_operand" "r,m")))]
813   "TARGET_BYTE_OPS"
814   "@
815    zapnot %1,1,%0
816    ldbu %0,%1"
817   [(set_attr "type" "shift,ld")])
818
819 (define_insn ""
820   [(set (match_operand:SI 0 "register_operand" "=r")
821         (zero_extend:SI (match_operand:QI 1 "register_operand" "r")))]
822   "! TARGET_BYTE_OPS"
823   "zapnot %1,1,%0"
824   [(set_attr "type" "shift")])
825
826 (define_expand "zero_extendqisi2"
827   [(set (match_operand:SI 0 "register_operand" "")
828         (zero_extend:SI (match_operand:QI 1 "register_operand" "")))]
829   ""
830   "")
831
832 (define_insn ""
833   [(set (match_operand:DI 0 "register_operand" "=r,r")
834         (zero_extend:DI (match_operand:QI 1 "nonimmediate_operand" "r,m")))]
835   "TARGET_BYTE_OPS"
836   "@
837    zapnot %1,1,%0
838    ldbu %0,%1"
839   [(set_attr "type" "shift,ld")])
840
841 (define_insn ""
842   [(set (match_operand:DI 0 "register_operand" "=r")
843         (zero_extend:DI (match_operand:QI 1 "register_operand" "r")))]
844   "! TARGET_BYTE_OPS"
845   "zapnot %1,1,%0"
846   [(set_attr "type" "shift")])
847   
848 (define_expand "zero_extendqidi2"
849   [(set (match_operand:DI 0 "register_operand" "")
850         (zero_extend:DI (match_operand:QI 1 "register_operand" "")))]
851   ""
852   "")
853   
854 (define_insn ""
855   [(set (match_operand:SI 0 "register_operand" "=r,r")
856         (zero_extend:SI (match_operand:HI 1 "nonimmediate_operand" "r,m")))]
857   "TARGET_BYTE_OPS"
858   "@
859    zapnot %1,3,%0
860    ldwu %0,%1"
861   [(set_attr "type" "shift,ld")])
862
863 (define_insn ""
864   [(set (match_operand:SI 0 "register_operand" "=r")
865         (zero_extend:SI (match_operand:HI 1 "register_operand" "r")))]
866   "! TARGET_BYTE_OPS"
867   "zapnot %1,3,%0"
868   [(set_attr "type" "shift")])
869
870 (define_expand "zero_extendhisi2"
871   [(set (match_operand:SI 0 "register_operand" "")
872         (zero_extend:SI (match_operand:HI 1 "register_operand" "")))]
873   ""
874   "")
875
876 (define_insn ""
877   [(set (match_operand:DI 0 "register_operand" "=r,r")
878         (zero_extend:DI (match_operand:HI 1 "nonimmediate_operand" "r,m")))]
879   "TARGET_BYTE_OPS"
880   "@
881    zapnot %1,3,%0
882    ldwu %0,%1"
883   [(set_attr "type" "shift,ld")])
884
885 (define_insn ""
886   [(set (match_operand:DI 0 "register_operand" "=r")
887         (zero_extend:DI (match_operand:HI 1 "register_operand" "r")))]
888   ""
889   "zapnot %1,3,%0"
890   [(set_attr "type" "shift")])
891
892 (define_expand "zero_extendhidi2"
893   [(set (match_operand:DI 0 "register_operand" "")
894         (zero_extend:DI (match_operand:HI 1 "register_operand" "")))]
895   ""
896   "")
897
898 (define_insn "zero_extendsidi2"
899   [(set (match_operand:DI 0 "register_operand" "=r")
900         (zero_extend:DI (match_operand:SI 1 "register_operand" "r")))]
901   ""
902   "zapnot %1,15,%0"
903   [(set_attr "type" "shift")])
904
905 (define_insn  ""
906   [(set (match_operand:DI 0 "register_operand" "=r")
907         (and:DI (not:DI (match_operand:DI 1 "reg_or_8bit_operand" "rI"))
908                 (match_operand:DI 2 "reg_or_0_operand" "rJ")))]
909   ""
910   "bic %r2,%1,%0"
911   [(set_attr "type" "ilog")])
912
913 (define_insn "iordi3"
914   [(set (match_operand:DI 0 "register_operand" "=r,r")
915         (ior:DI (match_operand:DI 1 "reg_or_0_operand" "%rJ,rJ")
916                 (match_operand:DI 2 "or_operand" "rI,N")))]
917   ""
918   "@
919    bis %r1,%2,%0
920    ornot %r1,%N2,%0"
921   [(set_attr "type" "ilog")])
922
923 (define_insn "one_cmpldi2"
924   [(set (match_operand:DI 0 "register_operand" "=r")
925         (not:DI (match_operand:DI 1 "reg_or_8bit_operand" "rI")))]
926   ""
927   "ornot $31,%1,%0"
928   [(set_attr "type" "ilog")])
929
930 (define_insn ""
931   [(set (match_operand:DI 0 "register_operand" "=r")
932         (ior:DI (not:DI (match_operand:DI 1 "reg_or_8bit_operand" "rI"))
933                 (match_operand:DI 2 "reg_or_0_operand" "rJ")))]
934   ""
935   "ornot %r2,%1,%0"
936   [(set_attr "type" "ilog")])
937
938 (define_insn "xordi3"
939   [(set (match_operand:DI 0 "register_operand" "=r,r")
940         (xor:DI (match_operand:DI 1 "reg_or_0_operand" "%rJ,rJ")
941                 (match_operand:DI 2 "or_operand" "rI,N")))]
942   ""
943   "@
944    xor %r1,%2,%0
945    eqv %r1,%N2,%0"
946   [(set_attr "type" "ilog")])
947
948 (define_insn ""
949   [(set (match_operand:DI 0 "register_operand" "=r")
950         (not:DI (xor:DI (match_operand:DI 1 "register_operand" "%rJ")
951                         (match_operand:DI 2 "register_operand" "rI"))))]
952   ""
953   "eqv %r1,%2,%0"
954   [(set_attr "type" "ilog")])
955 \f
956 ;; Next come the shifts and the various extract and insert operations.
957
958 (define_insn "ashldi3"
959   [(set (match_operand:DI 0 "register_operand" "=r,r")
960         (ashift:DI (match_operand:DI 1 "reg_or_0_operand" "rJ,rJ")
961                    (match_operand:DI 2 "reg_or_6bit_operand" "P,rI")))]
962   ""
963   "*
964 {
965   switch (which_alternative)
966     {
967     case 0:
968       if (operands[2] == const1_rtx)
969         return \"addq %r1,%r1,%0\";
970       else
971         return \"s%P2addq %r1,0,%0\";
972     case 1:
973       return \"sll %r1,%2,%0\";
974     }
975 }"
976   [(set_attr "type" "iadd,shift")])
977
978 ;; ??? The following pattern is made by combine, but earlier phases
979 ;; (specifically flow) can't handle it.  This occurs in jump.c.  Deal
980 ;; with this in a better way at some point.
981 ;;(define_insn ""
982 ;;  [(set (match_operand:DI 0 "register_operand" "=r")
983 ;;      (sign_extend:DI
984 ;;       (subreg:SI (ashift:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
985 ;;                             (match_operand:DI 2 "const_int_operand" "P"))
986 ;;                  0)))]
987 ;;  "INTVAL (operands[2]) >= 1 && INTVAL (operands[2]) <= 3"
988 ;;  "*
989 ;;{
990 ;;  if (operands[2] == const1_rtx)
991 ;;    return \"addl %r1,%r1,%0\";
992 ;;  else
993 ;;    return \"s%P2addl %r1,0,%0\";
994 ;; }"
995 ;;  [(set_attr "type" "iadd")])
996                           
997 (define_insn "lshrdi3"
998   [(set (match_operand:DI 0 "register_operand" "=r")
999         (lshiftrt:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
1000                      (match_operand:DI 2 "reg_or_6bit_operand" "rI")))]
1001   ""
1002   "srl %r1,%2,%0"
1003   [(set_attr "type" "shift")])
1004
1005 (define_insn "ashrdi3"
1006   [(set (match_operand:DI 0 "register_operand" "=r")
1007         (ashiftrt:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
1008                      (match_operand:DI 2 "reg_or_6bit_operand" "rI")))]
1009   ""
1010   "sra %r1,%2,%0"
1011   [(set_attr "type" "shift")])
1012
1013 (define_expand "extendqihi2"
1014   [(set (match_dup 2)
1015         (ashift:DI (match_operand:QI 1 "some_operand" "")
1016                    (const_int 56)))
1017    (set (match_operand:HI 0 "register_operand" "")
1018         (ashiftrt:DI (match_dup 2)
1019                      (const_int 56)))]
1020   ""
1021   "
1022 {
1023   if (TARGET_BYTE_OPS)
1024     {
1025       emit_insn (gen_extendqihi2x (operands[0],
1026                                    force_reg (QImode, operands[1])));
1027       DONE;
1028     }
1029  
1030  /* If we have an unaligned MEM, extend to DImode (which we do
1031      specially) and then copy to the result.  */
1032   if (unaligned_memory_operand (operands[1], HImode))
1033     {
1034       rtx temp = gen_reg_rtx (DImode);
1035
1036       emit_insn (gen_extendqidi2 (temp, operands[1]));
1037       emit_move_insn (operands[0], gen_lowpart (HImode, temp));
1038       DONE;
1039     }
1040
1041   operands[0] = gen_lowpart (DImode, operands[0]);
1042   operands[1] = gen_lowpart (DImode, force_reg (QImode, operands[1]));
1043   operands[2] = gen_reg_rtx (DImode);
1044 }")
1045
1046 (define_insn "extendqidi2x"
1047   [(set (match_operand:DI 0 "register_operand" "=r")
1048         (sign_extend:DI (match_operand:QI 1 "register_operand" "r")))]
1049   "TARGET_BYTE_OPS"
1050   "sextb %1,%0"
1051   [(set_attr "type" "shift")])
1052
1053 (define_insn "extendhidi2x"
1054   [(set (match_operand:DI 0 "register_operand" "=r")
1055         (sign_extend:DI (match_operand:HI 1 "register_operand" "r")))]
1056   "TARGET_BYTE_OPS"
1057   "sextw %1,%0"
1058   [(set_attr "type" "shift")])
1059
1060 (define_insn "extendqisi2x"
1061   [(set (match_operand:SI 0 "register_operand" "=r")
1062         (sign_extend:SI (match_operand:QI 1 "register_operand" "r")))]
1063   "TARGET_BYTE_OPS"
1064   "sextb %1,%0"
1065   [(set_attr "type" "shift")])
1066
1067 (define_insn "extendhisi2x"
1068   [(set (match_operand:SI 0 "register_operand" "=r")
1069         (sign_extend:SI (match_operand:HI 1 "register_operand" "r")))]
1070   "TARGET_BYTE_OPS"
1071   "sextw %1,%0"
1072   [(set_attr "type" "shift")])
1073
1074 (define_insn "extendqihi2x"
1075   [(set (match_operand:HI 0 "register_operand" "=r")
1076         (sign_extend:HI (match_operand:QI 1 "register_operand" "r")))]
1077   "TARGET_BYTE_OPS"
1078   "sextb %1,%0"
1079   [(set_attr "type" "shift")])
1080
1081 (define_expand "extendqisi2"
1082   [(set (match_dup 2)
1083         (ashift:DI (match_operand:QI 1 "some_operand" "")
1084                    (const_int 56)))
1085    (set (match_operand:SI 0 "register_operand" "")
1086         (ashiftrt:DI (match_dup 2)
1087                      (const_int 56)))]
1088   ""
1089   "
1090 {
1091   if (TARGET_BYTE_OPS)
1092     {
1093       emit_insn (gen_extendqisi2x (operands[0],
1094                                    force_reg (QImode, operands[1])));
1095       DONE;
1096     }
1097
1098   /* If we have an unaligned MEM, extend to a DImode form of
1099      the result (which we do specially).  */
1100   if (unaligned_memory_operand (operands[1], QImode))
1101     {
1102       rtx temp = gen_reg_rtx (DImode);
1103
1104       emit_insn (gen_extendqidi2 (temp, operands[1]));
1105       emit_move_insn (operands[0], gen_lowpart (SImode, temp));
1106       DONE;
1107     }
1108
1109   operands[0] = gen_lowpart (DImode, operands[0]);
1110   operands[1] = gen_lowpart (DImode, force_reg (QImode, operands[1]));
1111   operands[2] = gen_reg_rtx (DImode);
1112 }")
1113
1114 (define_expand "extendqidi2"
1115   [(set (match_dup 2)
1116         (ashift:DI (match_operand:QI 1 "some_operand" "")
1117                    (const_int 56)))
1118    (set (match_operand:DI 0 "register_operand" "")
1119         (ashiftrt:DI (match_dup 2)
1120                      (const_int 56)))]
1121   ""
1122   "
1123 { extern rtx get_unaligned_address ();
1124
1125   if (TARGET_BYTE_OPS)
1126     {
1127       emit_insn (gen_extendqidi2x (operands[0],
1128                                    force_reg (QImode, operands[1])));
1129       DONE;
1130     }
1131
1132   if (unaligned_memory_operand (operands[1], QImode))
1133     {
1134       rtx seq
1135         = gen_unaligned_extendqidi (operands[0],
1136                                     get_unaligned_address (operands[1], 1));
1137
1138       alpha_set_memflags (seq, operands[1]);
1139       emit_insn (seq);
1140       DONE;
1141     }
1142
1143   operands[1] = gen_lowpart (DImode, force_reg (QImode, operands[1]));
1144   operands[2] = gen_reg_rtx (DImode);
1145 }")
1146
1147 (define_expand "extendhisi2"
1148   [(set (match_dup 2)
1149         (ashift:DI (match_operand:HI 1 "some_operand" "")
1150                    (const_int 48)))
1151    (set (match_operand:SI 0 "register_operand" "")
1152         (ashiftrt:DI (match_dup 2)
1153                      (const_int 48)))]
1154   ""
1155   "
1156 {
1157   if (TARGET_BYTE_OPS)
1158     {
1159       emit_insn (gen_extendhisi2x (operands[0],
1160                                    force_reg (HImode, operands[1])));
1161       DONE;
1162     }
1163
1164   /* If we have an unaligned MEM, extend to a DImode form of
1165      the result (which we do specially).  */
1166   if (unaligned_memory_operand (operands[1], HImode))
1167     {
1168       rtx temp = gen_reg_rtx (DImode);
1169
1170       emit_insn (gen_extendhidi2 (temp, operands[1]));
1171       emit_move_insn (operands[0], gen_lowpart (SImode, temp));
1172       DONE;
1173     }
1174
1175   operands[0] = gen_lowpart (DImode, operands[0]);
1176   operands[1] = gen_lowpart (DImode, force_reg (HImode, operands[1]));
1177   operands[2] = gen_reg_rtx (DImode);
1178 }")
1179
1180 (define_expand "extendhidi2"
1181   [(set (match_dup 2)
1182         (ashift:DI (match_operand:HI 1 "some_operand" "")
1183                    (const_int 48)))
1184    (set (match_operand:DI 0 "register_operand" "")
1185         (ashiftrt:DI (match_dup 2)
1186                      (const_int 48)))]
1187   ""
1188   "
1189 { extern rtx get_unaligned_address ();
1190
1191   if (TARGET_BYTE_OPS)
1192     {
1193       emit_insn (gen_extendhidi2x (operands[0],
1194                                    force_reg (HImode, operands[1])));
1195       DONE;
1196     }
1197
1198   if (unaligned_memory_operand (operands[1], HImode))
1199     {
1200       rtx seq
1201         = gen_unaligned_extendhidi (operands[0],
1202                                     get_unaligned_address (operands[1], 2));
1203
1204       alpha_set_memflags (seq, operands[1]);
1205       emit_insn (seq);
1206       DONE;
1207     }
1208
1209   operands[1] = gen_lowpart (DImode, force_reg (HImode, operands[1]));
1210   operands[2] = gen_reg_rtx (DImode);
1211 }")
1212
1213 ;; Here's how we sign extend an unaligned byte and halfword.  Doing this
1214 ;; as a pattern saves one instruction.  The code is similar to that for
1215 ;; the unaligned loads (see below).
1216 ;;
1217 ;; Operand 1 is the address + 1 (+2 for HI), operand 0 is the result.
1218 (define_expand "unaligned_extendqidi"
1219   [(set (match_dup 2) (match_operand:DI 1 "address_operand" ""))
1220    (set (match_dup 3)
1221         (mem:DI (and:DI (plus:DI (match_dup 2) (const_int -1))
1222                         (const_int -8))))
1223    (set (match_dup 4)
1224         (ashift:DI (match_dup 3)
1225                    (minus:DI (const_int 56)
1226                              (ashift:DI
1227                               (and:DI (plus:DI (match_dup 2) (const_int -1))
1228                                       (const_int 7))
1229                               (const_int 3)))))
1230    (set (subreg:DI (match_operand:QI 0 "register_operand" "") 0)
1231         (ashiftrt:DI (match_dup 4) (const_int 56)))]
1232   ""
1233   "
1234 { operands[2] = gen_reg_rtx (DImode);
1235   operands[3] = gen_reg_rtx (DImode);
1236   operands[4] = gen_reg_rtx (DImode);
1237 }")
1238
1239 (define_expand "unaligned_extendhidi"
1240   [(set (match_dup 2) (match_operand:DI 1 "address_operand" ""))
1241    (set (match_dup 3)
1242         (mem:DI (and:DI (plus:DI (match_dup 2) (const_int -2))
1243                         (const_int -8))))
1244    (set (match_dup 4)
1245         (ashift:DI (match_dup 3)
1246                    (minus:DI (const_int 56)
1247                              (ashift:DI
1248                               (and:DI (plus:DI (match_dup 2) (const_int -1))
1249                                       (const_int 7))
1250                               (const_int 3)))))
1251    (set (subreg:DI (match_operand:QI 0 "register_operand" "") 0)
1252         (ashiftrt:DI (match_dup 4) (const_int 48)))]
1253   ""
1254   "
1255 { operands[2] = gen_reg_rtx (DImode);
1256   operands[3] = gen_reg_rtx (DImode);
1257   operands[4] = gen_reg_rtx (DImode);
1258 }")
1259
1260 (define_insn ""
1261   [(set (match_operand:DI 0 "register_operand" "=r")
1262         (zero_extract:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
1263                          (match_operand:DI 2 "mode_width_operand" "n")
1264                          (match_operand:DI 3 "mul8_operand" "I")))]
1265   ""
1266   "ext%M2l %r1,%s3,%0"
1267   [(set_attr "type" "shift")])
1268
1269 (define_insn ""
1270   [(set (match_operand:DI 0 "register_operand" "=r")
1271         (zero_extract:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
1272                          (match_operand:DI 2 "mode_width_operand" "n")
1273                          (ashift:DI (match_operand:DI 3 "reg_or_8bit_operand" "rI")
1274                                     (const_int 3))))]
1275   ""
1276   "ext%M2l %r1,%3,%0"
1277   [(set_attr "type" "shift")])
1278
1279 (define_insn ""
1280   [(set (match_operand:DI 0 "register_operand" "=r")
1281         (ashift:DI
1282          (match_operand:DI 1 "reg_or_0_operand" "rJ")
1283           (minus:DI (const_int 56)
1284                     (ashift:DI
1285                      (and:DI
1286                       (plus:DI (match_operand:DI 2 "reg_or_8bit_operand" "rI")
1287                                (const_int -1))
1288                       (const_int 7))
1289                      (const_int 3)))))]
1290   ""
1291   "extqh %r1,%2,%0"
1292   [(set_attr "type" "shift")])
1293
1294 (define_insn ""
1295   [(set (match_operand:DI 0 "register_operand" "=r")
1296         (ashift:DI
1297          (and:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
1298                  (const_int 2147483647))
1299          (minus:DI (const_int 56)
1300                     (ashift:DI
1301                      (and:DI
1302                       (plus:DI (match_operand:DI 2 "reg_or_8bit_operand" "rI")
1303                                (const_int -1))
1304                       (const_int 7))
1305                      (const_int 3)))))]
1306   ""
1307   "extlh %r1,%2,%0"
1308   [(set_attr "type" "shift")])
1309
1310 (define_insn ""
1311   [(set (match_operand:DI 0 "register_operand" "=r")
1312         (ashift:DI
1313          (and:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
1314                  (const_int 65535))
1315          (minus:DI (const_int 56)
1316                     (ashift:DI
1317                      (and:DI
1318                       (plus:DI (match_operand:DI 2 "reg_or_8bit_operand" "rI")
1319                                (const_int -1))
1320                       (const_int 7))
1321                      (const_int 3)))))]
1322   ""
1323   "extwh %r1,%2,%0"
1324   [(set_attr "type" "shift")])
1325
1326 ;; This converts an extXl into an extXh with an appropriate adjustment
1327 ;; to the address calculation.
1328
1329 ;;(define_split
1330 ;;  [(set (match_operand:DI 0 "register_operand" "")
1331 ;;      (ashift:DI (zero_extract:DI (match_operand:DI 1 "register_operand" "")
1332 ;;                                  (match_operand:DI 2 "mode_width_operand" "")
1333 ;;                                  (ashift:DI (match_operand:DI 3 "" "")
1334 ;;                                             (const_int 3)))
1335 ;;                 (match_operand:DI 4 "const_int_operand" "")))
1336 ;;   (clobber (match_operand:DI 5 "register_operand" ""))]
1337 ;;  "INTVAL (operands[4]) == 64 - INTVAL (operands[2])"
1338 ;;  [(set (match_dup 5) (match_dup 6))
1339 ;;   (set (match_dup 0)
1340 ;;      (ashift:DI (zero_extract:DI (match_dup 1) (match_dup 2)
1341 ;;                                  (ashift:DI (plus:DI (match_dup 5)
1342 ;;                                                      (match_dup 7))
1343 ;;                                             (const_int 3)))
1344 ;;                 (match_dup 4)))]
1345 ;;  "
1346 ;;{
1347 ;;  operands[6] = plus_constant (operands[3], 
1348 ;;                             INTVAL (operands[2]) / BITS_PER_UNIT);
1349 ;;  operands[7] = GEN_INT (- INTVAL (operands[2]) / BITS_PER_UNIT);
1350 ;;}")
1351   
1352 (define_insn ""
1353   [(set (match_operand:DI 0 "register_operand" "=r")
1354         (ashift:DI (zero_extend:DI (match_operand:QI 1 "register_operand" "r"))
1355                    (match_operand:DI 2 "mul8_operand" "I")))]
1356   ""
1357   "insbl %1,%s2,%0"
1358   [(set_attr "type" "shift")])
1359
1360 (define_insn ""
1361   [(set (match_operand:DI 0 "register_operand" "=r")
1362         (ashift:DI (zero_extend:DI (match_operand:HI 1 "register_operand" "r"))
1363                    (match_operand:DI 2 "mul8_operand" "I")))]
1364   ""
1365   "inswl %1,%s2,%0"
1366   [(set_attr "type" "shift")])
1367
1368 (define_insn ""
1369   [(set (match_operand:DI 0 "register_operand" "=r")
1370         (ashift:DI (zero_extend:DI (match_operand:SI 1 "register_operand" "r"))
1371                    (match_operand:DI 2 "mul8_operand" "I")))]
1372   ""
1373   "insll %1,%s2,%0"
1374   [(set_attr "type" "shift")])
1375
1376 (define_insn ""
1377   [(set (match_operand:DI 0 "register_operand" "=r")
1378         (ashift:DI (zero_extend:DI (match_operand:QI 1 "register_operand" "r"))
1379                    (ashift:DI (match_operand:DI 2 "reg_or_8bit_operand" "rI")
1380                               (const_int 3))))]
1381   ""
1382   "insbl %1,%2,%0"
1383   [(set_attr "type" "shift")])
1384
1385 (define_insn ""
1386   [(set (match_operand:DI 0 "register_operand" "=r")
1387         (ashift:DI (zero_extend:DI (match_operand:HI 1 "register_operand" "r"))
1388                    (ashift:DI (match_operand:DI 2 "reg_or_8bit_operand" "rI")
1389                               (const_int 3))))]
1390   ""
1391   "inswl %1,%2,%0"
1392   [(set_attr "type" "shift")])
1393
1394 (define_insn ""
1395   [(set (match_operand:DI 0 "register_operand" "=r")
1396         (ashift:DI (zero_extend:DI (match_operand:SI 1 "register_operand" "r"))
1397                    (ashift:DI (match_operand:DI 2 "reg_or_8bit_operand" "rI")
1398                               (const_int 3))))]
1399   ""
1400   "insll %1,%2,%0"
1401   [(set_attr "type" "shift")])
1402
1403 ;; We do not include the insXh insns because they are complex to express
1404 ;; and it does not appear that we would ever want to generate them.
1405
1406 (define_insn ""
1407   [(set (match_operand:DI 0 "register_operand" "=r")
1408         (and:DI (not:DI (ashift:DI
1409                          (match_operand:DI 2 "mode_mask_operand" "n")
1410                          (ashift:DI
1411                           (match_operand:DI 3 "reg_or_8bit_operand" "rI")
1412                           (const_int 3))))
1413                 (match_operand:DI 1 "reg_or_0_operand" "rJ")))]
1414   ""
1415   "msk%U2l %r1,%3,%0"
1416   [(set_attr "type" "shift")])
1417
1418 ;; We do not include the mskXh insns because it does not appear we would ever
1419 ;; generate one.
1420 \f
1421 ;; Floating-point operations.  All the double-precision insns can extend
1422 ;; from single, so indicate that.  The exception are the ones that simply
1423 ;; play with the sign bits; it's not clear what to do there.
1424
1425 (define_insn "abssf2"
1426   [(set (match_operand:SF 0 "register_operand" "=f")
1427         (abs:SF (match_operand:SF 1 "reg_or_fp0_operand" "fG")))]
1428   "TARGET_FP"
1429   "cpys $f31,%R1,%0"
1430   [(set_attr "type" "fcpys")])
1431
1432 (define_insn "absdf2"
1433   [(set (match_operand:DF 0 "register_operand" "=f")
1434         (abs:DF (match_operand:DF 1 "reg_or_fp0_operand" "fG")))]
1435   "TARGET_FP"
1436   "cpys $f31,%R1,%0"
1437   [(set_attr "type" "fcpys")])
1438
1439 (define_insn "negsf2"
1440   [(set (match_operand:SF 0 "register_operand" "=f")
1441         (neg:SF (match_operand:SF 1 "reg_or_fp0_operand" "fG")))]
1442   "TARGET_FP"
1443   "cpysn %R1,%R1,%0"
1444   [(set_attr "type" "fadd")])
1445
1446 (define_insn "negdf2"
1447   [(set (match_operand:DF 0 "register_operand" "=f")
1448         (neg:DF (match_operand:DF 1 "reg_or_fp0_operand" "fG")))]
1449   "TARGET_FP"
1450   "cpysn %R1,%R1,%0"
1451   [(set_attr "type" "fadd")])
1452
1453 (define_insn ""
1454   [(set (match_operand:SF 0 "register_operand" "=&f")
1455         (plus:SF (match_operand:SF 1 "reg_or_fp0_operand" "%fG")
1456                  (match_operand:SF 2 "reg_or_fp0_operand" "fG")))]
1457   "TARGET_FP && alpha_tp == ALPHA_TP_INSN"
1458   "add%,%)%& %R1,%R2,%0"
1459   [(set_attr "type" "fadd")
1460    (set_attr "trap" "yes")])
1461
1462 (define_insn "addsf3"
1463   [(set (match_operand:SF 0 "register_operand" "=f")
1464         (plus:SF (match_operand:SF 1 "reg_or_fp0_operand" "%fG")
1465                  (match_operand:SF 2 "reg_or_fp0_operand" "fG")))]
1466   "TARGET_FP"
1467   "add%,%)%& %R1,%R2,%0"
1468   [(set_attr "type" "fadd")
1469    (set_attr "trap" "yes")])
1470
1471 (define_insn ""
1472   [(set (match_operand:DF 0 "register_operand" "=&f")
1473         (plus:DF (match_operand:DF 1 "reg_or_fp0_operand" "%fG")
1474                  (match_operand:DF 2 "reg_or_fp0_operand" "fG")))]
1475   "TARGET_FP && alpha_tp == ALPHA_TP_INSN"
1476   "add%-%)%& %R1,%R2,%0"
1477   [(set_attr "type" "fadd")
1478    (set_attr "trap" "yes")])
1479
1480 (define_insn "adddf3"
1481   [(set (match_operand:DF 0 "register_operand" "=f")
1482         (plus:DF (match_operand:DF 1 "reg_or_fp0_operand" "%fG")
1483                  (match_operand:DF 2 "reg_or_fp0_operand" "fG")))]
1484   "TARGET_FP"
1485   "add%-%)%& %R1,%R2,%0"
1486   [(set_attr "type" "fadd")
1487    (set_attr "trap" "yes")])
1488
1489 (define_insn ""
1490   [(set (match_operand:DF 0 "register_operand" "=f")
1491         (plus:DF (float_extend:DF
1492                   (match_operand:SF 1 "reg_or_fp0_operand" "fG"))
1493                  (match_operand:DF 2 "reg_or_fp0_operand" "fG")))]
1494   "TARGET_FP && alpha_tp != ALPHA_TP_INSN"
1495   "add%-%)%& %R1,%R2,%0"
1496   [(set_attr "type" "fadd")
1497    (set_attr "trap" "yes")])
1498
1499 (define_insn ""
1500   [(set (match_operand:DF 0 "register_operand" "=f")
1501         (plus:DF (float_extend:DF
1502                   (match_operand:SF 1 "reg_or_fp0_operand" "%fG"))
1503                  (float_extend:DF
1504                   (match_operand:SF 2 "reg_or_fp0_operand" "fG"))))]
1505   "TARGET_FP && alpha_tp != ALPHA_TP_INSN"
1506   "add%-%)%& %R1,%R2,%0"
1507   [(set_attr "type" "fadd")
1508    (set_attr "trap" "yes")])
1509
1510 (define_insn "fix_truncdfdi2"
1511   [(set (match_operand:DI 0 "register_operand" "=f")
1512         (fix:DI (match_operand:DF 1 "reg_or_fp0_operand" "fG")))]
1513   "TARGET_FP"
1514   "cvt%-qc %R1,%0"
1515   [(set_attr "type" "fadd")])
1516
1517 (define_insn "fix_truncsfdi2"
1518   [(set (match_operand:DI 0 "register_operand" "=f")
1519         (fix:DI (float_extend:DF
1520                  (match_operand:SF 1 "reg_or_fp0_operand" "fG"))))]
1521   "TARGET_FP"
1522   "cvt%-qc %R1,%0"
1523   [(set_attr "type" "fadd")])
1524
1525 (define_insn ""
1526   [(set (match_operand:SF 0 "register_operand" "=&f")
1527         (float:SF (match_operand:DI 1 "register_operand" "f")))]
1528   "TARGET_FP && alpha_tp == ALPHA_TP_INSN"
1529   "cvtq%,%+%& %1,%0"
1530   [(set_attr "type" "fadd")
1531    (set_attr "trap" "yes")])
1532
1533 (define_insn "floatdisf2"
1534   [(set (match_operand:SF 0 "register_operand" "=f")
1535         (float:SF (match_operand:DI 1 "register_operand" "f")))]
1536   "TARGET_FP"
1537   "cvtq%,%+%& %1,%0"
1538   [(set_attr "type" "fadd")
1539    (set_attr "trap" "yes")])
1540
1541 (define_insn ""
1542   [(set (match_operand:DF 0 "register_operand" "=&f")
1543         (float:DF (match_operand:DI 1 "register_operand" "f")))]
1544   "TARGET_FP && alpha_tp == ALPHA_TP_INSN"
1545   "cvtq%-%+%& %1,%0"
1546   [(set_attr "type" "fadd")
1547    (set_attr "trap" "yes")])
1548
1549 (define_insn "floatdidf2"
1550   [(set (match_operand:DF 0 "register_operand" "=f")
1551         (float:DF (match_operand:DI 1 "register_operand" "f")))]
1552   "TARGET_FP"
1553   "cvtq%-%+%& %1,%0"
1554   [(set_attr "type" "fadd")
1555    (set_attr "trap" "yes")])
1556
1557 (define_expand "extendsfdf2"
1558   [(use (match_operand:DF 0 "register_operand" ""))
1559    (use (match_operand:SF 1 "nonimmediate_operand" ""))]
1560   "TARGET_FP"
1561 "
1562 {
1563   if (alpha_tp == ALPHA_TP_INSN)
1564     emit_insn (gen_extendsfdf2_tp (operands[0],
1565                                    force_reg (SFmode, operands[1])));
1566   else
1567     emit_insn (gen_extendsfdf2_no_tp (operands[0], operands[1]));
1568
1569   DONE;
1570 }")
1571 ;; FIXME
1572 (define_insn "extendsfdf2_tp"
1573   [(set (match_operand:DF 0 "register_operand" "=&f")
1574         (float_extend:DF (match_operand:SF 1 "register_operand" "f")))]
1575   "TARGET_FP && alpha_tp == ALPHA_TP_INSN"
1576   "cvtsts %1,%0"
1577   [(set_attr "type" "fadd")
1578    (set_attr "trap" "yes")])
1579
1580 (define_insn "extendsfdf2_no_tp"
1581   [(set (match_operand:DF 0 "register_operand" "=f,f,m")
1582         (float_extend:DF (match_operand:SF 1 "nonimmediate_operand" "f,m,f")))]
1583   "TARGET_FP && alpha_tp != ALPHA_TP_INSN"
1584   "@
1585    cpys %1,%1,%0
1586    ld%, %0,%1
1587    st%- %1,%0"
1588   [(set_attr "type" "fcpys,ld,st")
1589    (set_attr "trap" "yes")])
1590
1591 (define_insn ""
1592   [(set (match_operand:SF 0 "register_operand" "=&f")
1593         (float_truncate:SF (match_operand:DF 1 "reg_or_fp0_operand" "fG")))]
1594   "TARGET_FP && alpha_tp == ALPHA_TP_INSN"
1595   "cvt%-%,%)%& %R1,%0"
1596   [(set_attr "type" "fadd")
1597    (set_attr "trap" "yes")])
1598
1599 (define_insn "truncdfsf2"
1600   [(set (match_operand:SF 0 "register_operand" "=f")
1601         (float_truncate:SF (match_operand:DF 1 "reg_or_fp0_operand" "fG")))]
1602   "TARGET_FP"
1603   "cvt%-%,%)%& %R1,%0"
1604   [(set_attr "type" "fadd")
1605    (set_attr "trap" "yes")])
1606
1607 (define_insn ""
1608   [(set (match_operand:SF 0 "register_operand" "=&f")
1609         (div:SF (match_operand:SF 1 "reg_or_fp0_operand" "fG")
1610                 (match_operand:SF 2 "reg_or_fp0_operand" "fG")))]
1611   "TARGET_FP && alpha_tp == ALPHA_TP_INSN"
1612   "div%,%)%& %R1,%R2,%0"
1613   [(set_attr "type" "fdivs")
1614    (set_attr "trap" "yes")])
1615
1616 (define_insn "divsf3"
1617   [(set (match_operand:SF 0 "register_operand" "=f")
1618         (div:SF (match_operand:SF 1 "reg_or_fp0_operand" "fG")
1619                 (match_operand:SF 2 "reg_or_fp0_operand" "fG")))]
1620   "TARGET_FP"
1621   "div%,%)%& %R1,%R2,%0"
1622   [(set_attr "type" "fdivs")
1623    (set_attr "trap" "yes")])
1624
1625 (define_insn ""
1626   [(set (match_operand:DF 0 "register_operand" "=&f")
1627         (div:DF (match_operand:DF 1 "reg_or_fp0_operand" "fG")
1628                 (match_operand:DF 2 "reg_or_fp0_operand" "fG")))]
1629   "TARGET_FP && alpha_tp == ALPHA_TP_INSN"
1630   "div%-%)%& %R1,%R2,%0"
1631   [(set_attr "type" "fdivt")
1632    (set_attr "trap" "yes")])
1633
1634 (define_insn "divdf3"
1635   [(set (match_operand:DF 0 "register_operand" "=f")
1636         (div:DF (match_operand:DF 1 "reg_or_fp0_operand" "fG")
1637                 (match_operand:DF 2 "reg_or_fp0_operand" "fG")))]
1638   "TARGET_FP"
1639   "div%-%)%& %R1,%R2,%0"
1640   [(set_attr "type" "fdivt")
1641    (set_attr "trap" "yes")])
1642
1643 (define_insn ""
1644   [(set (match_operand:DF 0 "register_operand" "=f")
1645         (div:DF (float_extend:DF (match_operand:SF 1 "reg_or_fp0_operand" "fG"))
1646                 (match_operand:DF 2 "reg_or_fp0_operand" "fG")))]
1647   "TARGET_FP && alpha_tp != ALPHA_TP_INSN"
1648   "div%-%)%& %R1,%R2,%0"
1649   [(set_attr "type" "fdivt")
1650    (set_attr "trap" "yes")])
1651
1652 (define_insn ""
1653   [(set (match_operand:DF 0 "register_operand" "=f")
1654         (div:DF (match_operand:DF 1 "reg_or_fp0_operand" "fG")
1655                 (float_extend:DF
1656                  (match_operand:SF 2 "reg_or_fp0_operand" "fG"))))]
1657   "TARGET_FP && alpha_tp != ALPHA_TP_INSN"
1658   "div%-%)%& %R1,%R2,%0"
1659   [(set_attr "type" "fdivt")
1660    (set_attr "trap" "yes")])
1661
1662 (define_insn ""
1663   [(set (match_operand:DF 0 "register_operand" "=f")
1664         (div:DF (float_extend:DF (match_operand:SF 1 "reg_or_fp0_operand" "fG"))
1665                 (float_extend:DF (match_operand:SF 2 "reg_or_fp0_operand" "fG"))))]
1666   "TARGET_FP && alpha_tp != ALPHA_TP_INSN"
1667   "div%-%)%& %R1,%R2,%0"
1668   [(set_attr "type" "fdivt")
1669    (set_attr "trap" "yes")])
1670
1671 (define_insn ""
1672   [(set (match_operand:SF 0 "register_operand" "=&f")
1673         (mult:SF (match_operand:SF 1 "reg_or_fp0_operand" "%fG")
1674                  (match_operand:SF 2 "reg_or_fp0_operand" "fG")))]
1675   "TARGET_FP && alpha_tp == ALPHA_TP_INSN"
1676   "mul%,%)%& %R1,%R2,%0"
1677   [(set_attr "type" "fmul")
1678    (set_attr "trap" "yes")])
1679
1680 (define_insn "mulsf3"
1681   [(set (match_operand:SF 0 "register_operand" "=f")
1682         (mult:SF (match_operand:SF 1 "reg_or_fp0_operand" "%fG")
1683                  (match_operand:SF 2 "reg_or_fp0_operand" "fG")))]
1684   "TARGET_FP"
1685   "mul%,%)%& %R1,%R2,%0"
1686   [(set_attr "type" "fmul")
1687    (set_attr "trap" "yes")])
1688
1689 (define_insn ""
1690   [(set (match_operand:DF 0 "register_operand" "=&f")
1691         (mult:DF (match_operand:DF 1 "reg_or_fp0_operand" "%fG")
1692                  (match_operand:DF 2 "reg_or_fp0_operand" "fG")))]
1693   "TARGET_FP && alpha_tp == ALPHA_TP_INSN"
1694   "mul%-%)%& %R1,%R2,%0"
1695   [(set_attr "type" "fmul")
1696    (set_attr "trap" "yes")])
1697
1698 (define_insn "muldf3"
1699   [(set (match_operand:DF 0 "register_operand" "=f")
1700         (mult:DF (match_operand:DF 1 "reg_or_fp0_operand" "%fG")
1701                  (match_operand:DF 2 "reg_or_fp0_operand" "fG")))]
1702   "TARGET_FP"
1703   "mul%-%)%& %R1,%R2,%0"
1704   [(set_attr "type" "fmul")
1705    (set_attr "trap" "yes")])
1706
1707 (define_insn ""
1708   [(set (match_operand:DF 0 "register_operand" "=f")
1709         (mult:DF (float_extend:DF
1710                   (match_operand:SF 1 "reg_or_fp0_operand" "fG"))
1711                  (match_operand:DF 2 "reg_or_fp0_operand" "fG")))]
1712   "TARGET_FP && alpha_tp != ALPHA_TP_INSN"
1713   "mul%-%)%& %R1,%R2,%0"
1714   [(set_attr "type" "fmul")
1715    (set_attr "trap" "yes")])
1716
1717 (define_insn ""
1718   [(set (match_operand:DF 0 "register_operand" "=f")
1719         (mult:DF (float_extend:DF
1720                   (match_operand:SF 1 "reg_or_fp0_operand" "%fG"))
1721                  (float_extend:DF
1722                   (match_operand:SF 2 "reg_or_fp0_operand" "fG"))))]
1723   "TARGET_FP && alpha_tp != ALPHA_TP_INSN"
1724   "mul%-%)%& %R1,%R2,%0"
1725   [(set_attr "type" "fmul")
1726    (set_attr "trap" "yes")])
1727
1728 (define_insn ""
1729   [(set (match_operand:SF 0 "register_operand" "=&f")
1730         (minus:SF (match_operand:SF 1 "reg_or_fp0_operand" "fG")
1731                   (match_operand:SF 2 "reg_or_fp0_operand" "fG")))]
1732   "TARGET_FP && alpha_tp == ALPHA_TP_INSN"
1733   "sub%,%)%& %R1,%R2,%0"
1734   [(set_attr "type" "fadd")
1735    (set_attr "trap" "yes")])
1736
1737 (define_insn "subsf3"
1738   [(set (match_operand:SF 0 "register_operand" "=f")
1739         (minus:SF (match_operand:SF 1 "reg_or_fp0_operand" "fG")
1740                   (match_operand:SF 2 "reg_or_fp0_operand" "fG")))]
1741   "TARGET_FP"
1742   "sub%,%)%& %R1,%R2,%0"
1743   [(set_attr "type" "fadd")
1744    (set_attr "trap" "yes")])
1745
1746 (define_insn ""
1747   [(set (match_operand:DF 0 "register_operand" "=&f")
1748         (minus:DF (match_operand:DF 1 "reg_or_fp0_operand" "fG")
1749                   (match_operand:DF 2 "reg_or_fp0_operand" "fG")))]
1750   "TARGET_FP && alpha_tp == ALPHA_TP_INSN"
1751   "sub%-%)%& %R1,%R2,%0"
1752   [(set_attr "type" "fadd")
1753    (set_attr "trap" "yes")])
1754
1755 (define_insn "subdf3"
1756   [(set (match_operand:DF 0 "register_operand" "=f")
1757         (minus:DF (match_operand:DF 1 "reg_or_fp0_operand" "fG")
1758                   (match_operand:DF 2 "reg_or_fp0_operand" "fG")))]
1759   "TARGET_FP"
1760   "sub%-%)%& %R1,%R2,%0"
1761   [(set_attr "type" "fadd")
1762    (set_attr "trap" "yes")])
1763
1764 (define_insn ""
1765   [(set (match_operand:DF 0 "register_operand" "=f")
1766         (minus:DF (float_extend:DF
1767                    (match_operand:SF 1 "reg_or_fp0_operand" "fG"))
1768                   (match_operand:DF 2 "reg_or_fp0_operand" "fG")))]
1769   "TARGET_FP && alpha_tp != ALPHA_TP_INSN"
1770   "sub%-%)%& %R1,%R2,%0"
1771   [(set_attr "type" "fadd")
1772    (set_attr "trap" "yes")])
1773
1774 (define_insn ""
1775   [(set (match_operand:DF 0 "register_operand" "=f")
1776         (minus:DF (match_operand:DF 1 "reg_or_fp0_operand" "fG")
1777                   (float_extend:DF
1778                    (match_operand:SF 2 "reg_or_fp0_operand" "fG"))))]
1779   "TARGET_FP && alpha_tp != ALPHA_TP_INSN"
1780   "sub%-%)%& %R1,%R2,%0"
1781   [(set_attr "type" "fadd")
1782    (set_attr "trap" "yes")])
1783
1784 (define_insn ""
1785   [(set (match_operand:DF 0 "register_operand" "=f")
1786         (minus:DF (float_extend:DF
1787                    (match_operand:SF 1 "reg_or_fp0_operand" "fG"))
1788                   (float_extend:DF
1789                    (match_operand:SF 2 "reg_or_fp0_operand" "fG"))))]
1790   "TARGET_FP && alpha_tp != ALPHA_TP_INSN"
1791   "sub%-%)%& %R1,%R2,%0"
1792   [(set_attr "type" "fadd")
1793    (set_attr "trap" "yes")])
1794 \f
1795 ;; Next are all the integer comparisons, and conditional moves and branches
1796 ;; and some of the related define_expand's and define_split's.
1797
1798 (define_insn ""
1799   [(set (match_operand:DI 0 "register_operand" "=r")
1800         (match_operator:DI 1 "alpha_comparison_operator"
1801                            [(match_operand:DI 2 "reg_or_0_operand" "rJ")
1802                             (match_operand:DI 3 "reg_or_8bit_operand" "rI")]))]
1803   ""
1804   "cmp%C1 %r2,%3,%0"
1805   [(set_attr "type" "icmp")])
1806
1807 (define_insn ""
1808   [(set (match_operand:DI 0 "register_operand" "=r")
1809         (match_operator:DI 1 "alpha_swapped_comparison_operator"
1810                            [(match_operand:DI 2 "reg_or_8bit_operand" "rI")
1811                             (match_operand:DI 3 "reg_or_0_operand" "rJ")]))]
1812   ""
1813   "cmp%c1 %r3,%2,%0"
1814   [(set_attr "type" "icmp")])
1815
1816 ;; This pattern exists so conditional moves of SImode values are handled.
1817 ;; Comparisons are still done in DImode though.
1818
1819 (define_insn ""
1820   [(set (match_operand:SI 0 "register_operand" "=r,r,r,r")
1821         (if_then_else:DI
1822          (match_operator 2 "signed_comparison_operator"
1823                          [(match_operand:DI 3 "reg_or_0_operand" "rJ,rJ,J,J")
1824                           (match_operand:DI 4 "reg_or_0_operand" "J,J,rJ,rJ")])
1825          (match_operand:SI 1 "reg_or_8bit_operand" "rI,0,rI,0")
1826          (match_operand:SI 5 "reg_or_8bit_operand" "0,rI,0,rI")))]
1827   "operands[3] == const0_rtx || operands[4] == const0_rtx"
1828   "@
1829    cmov%C2 %r3,%1,%0
1830    cmov%D2 %r3,%5,%0
1831    cmov%c2 %r4,%1,%0
1832    cmov%d2 %r4,%5,%0"
1833   [(set_attr "type" "cmov")])
1834
1835 (define_insn ""
1836   [(set (match_operand:DI 0 "register_operand" "=r,r,r,r")
1837         (if_then_else:DI
1838          (match_operator 2 "signed_comparison_operator"
1839                          [(match_operand:DI 3 "reg_or_0_operand" "rJ,rJ,J,J")
1840                           (match_operand:DI 4 "reg_or_0_operand" "J,J,rJ,rJ")])
1841          (match_operand:DI 1 "reg_or_8bit_operand" "rI,0,rI,0")
1842          (match_operand:DI 5 "reg_or_8bit_operand" "0,rI,0,rI")))]
1843   "operands[3] == const0_rtx || operands[4] == const0_rtx"
1844   "@
1845    cmov%C2 %r3,%1,%0
1846    cmov%D2 %r3,%5,%0
1847    cmov%c2 %r4,%1,%0
1848    cmov%d2 %r4,%5,%0"
1849   [(set_attr "type" "cmov")])
1850
1851 (define_insn ""
1852   [(set (match_operand:DI 0 "register_operand" "=r,r")
1853         (if_then_else:DI
1854          (eq (zero_extract:DI (match_operand:DI 2 "reg_or_0_operand" "rJ,rJ")
1855                               (const_int 1)
1856                               (const_int 0))
1857              (const_int 0))
1858          (match_operand:DI 1 "reg_or_8bit_operand" "rI,0")
1859          (match_operand:DI 3 "reg_or_8bit_operand" "0,rI")))]
1860   ""
1861   "@
1862    cmovlbc %r2,%1,%0
1863    cmovlbs %r2,%3,%0"
1864   [(set_attr "type" "cmov")])
1865
1866 (define_insn ""
1867   [(set (match_operand:DI 0 "register_operand" "=r,r")
1868         (if_then_else:DI
1869          (ne (zero_extract:DI (match_operand:DI 2 "reg_or_0_operand" "rJ,rJ")
1870                               (const_int 1)
1871                               (const_int 0))
1872              (const_int 0))
1873          (match_operand:DI 1 "reg_or_8bit_operand" "rI,0")
1874          (match_operand:DI 3 "reg_or_8bit_operand" "0,rI")))]
1875   ""
1876   "@
1877    cmovlbs %r2,%1,%0
1878    cmovlbc %r2,%3,%0"
1879   [(set_attr "type" "cmov")])
1880
1881 ;; This form is added since combine thinks that an IF_THEN_ELSE with both
1882 ;; arms constant is a single insn, so it won't try to form it if combine
1883 ;; knows they are really two insns.  This occurs in divides by powers
1884 ;; of two.
1885
1886 (define_insn ""
1887   [(set (match_operand:DI 0 "register_operand" "=r")
1888         (if_then_else:DI
1889          (match_operator 2 "signed_comparison_operator"
1890                          [(match_operand:DI 3 "reg_or_0_operand" "rJ")
1891                           (const_int 0)])
1892          (plus:DI (match_dup 0)
1893                   (match_operand:DI 1 "reg_or_8bit_operand" "rI"))
1894          (match_dup 0)))
1895    (clobber (match_scratch:DI 4 "=&r"))]
1896   ""
1897   "addq %0,%1,%4\;cmov%C2 %r3,%4,%0"
1898   [(set_attr "type" "cmov")])
1899
1900 (define_split
1901   [(set (match_operand:DI 0 "register_operand" "")
1902         (if_then_else:DI
1903          (match_operator 2 "signed_comparison_operator"
1904                          [(match_operand:DI 3 "reg_or_0_operand" "")
1905                           (const_int 0)])
1906          (plus:DI (match_dup 0)
1907                   (match_operand:DI 1 "reg_or_8bit_operand" ""))
1908          (match_dup 0)))
1909    (clobber (match_operand:DI 4 "register_operand" ""))]
1910   ""
1911   [(set (match_dup 4) (plus:DI (match_dup 0) (match_dup 1)))
1912    (set (match_dup 0) (if_then_else:DI (match_op_dup 2
1913                                                      [(match_dup 3)
1914                                                       (const_int 0)])
1915                                        (match_dup 4) (match_dup 0)))]
1916   "")
1917
1918 (define_split
1919   [(parallel
1920     [(set (match_operand:DI 0 "register_operand" "")
1921           (if_then_else:DI
1922            (match_operator 1 "comparison_operator"
1923                            [(zero_extract:DI (match_operand:DI 2 "register_operand" "")
1924                                              (const_int 1)
1925                                              (match_operand:DI 3 "const_int_operand" ""))
1926                             (const_int 0)])
1927            (match_operand:DI 4 "reg_or_8bit_operand" "")
1928            (match_operand:DI 5 "reg_or_8bit_operand" "")))
1929      (clobber (match_operand:DI 6 "register_operand" ""))])]
1930   "INTVAL (operands[3]) != 0"
1931   [(set (match_dup 6)
1932         (lshiftrt:DI (match_dup 2) (match_dup 3)))
1933    (set (match_dup 0)
1934         (if_then_else:DI (match_op_dup 1
1935                                        [(zero_extract:DI (match_dup 6)
1936                                                          (const_int 1)
1937                                                          (const_int 0))
1938                                         (const_int 0)])
1939                          (match_dup 4)
1940                          (match_dup 5)))]
1941   "")
1942
1943 ;; For ABS, we have two choices, depending on whether the input and output
1944 ;; registers are the same or not.
1945 (define_expand "absdi2"
1946   [(set (match_operand:DI 0 "register_operand" "")
1947         (abs:DI (match_operand:DI 1 "register_operand" "")))]
1948   ""
1949   "
1950 { if (rtx_equal_p (operands[0], operands[1]))
1951     emit_insn (gen_absdi2_same (operands[0], gen_reg_rtx (DImode)));
1952   else
1953     emit_insn (gen_absdi2_diff (operands[0], operands[1]));
1954
1955   DONE;
1956 }")
1957
1958 (define_expand "absdi2_same"
1959   [(set (match_operand:DI 1 "register_operand" "")
1960         (neg:DI (match_operand:DI 0 "register_operand" "")))
1961    (set (match_dup 0)
1962         (if_then_else:DI (ge (match_dup 0) (const_int 0))
1963                          (match_dup 0)
1964                          (match_dup 1)))]
1965   ""
1966   "")
1967
1968 (define_expand "absdi2_diff"
1969   [(set (match_operand:DI 0 "register_operand" "")
1970         (neg:DI (match_operand:DI 1 "register_operand" "")))
1971    (set (match_dup 0)
1972         (if_then_else:DI (lt (match_dup 1) (const_int 0))
1973                          (match_dup 0)
1974                          (match_dup 1)))]
1975   ""
1976   "")
1977
1978 (define_split
1979   [(set (match_operand:DI 0 "register_operand" "")
1980         (abs:DI (match_dup 0)))
1981    (clobber (match_operand:DI 2 "register_operand" ""))]
1982   ""
1983   [(set (match_dup 1) (neg:DI (match_dup 0)))
1984    (set (match_dup 0) (if_then_else:DI (ge (match_dup 0) (const_int 0))
1985                                        (match_dup 0) (match_dup 1)))]
1986   "")
1987
1988 (define_split
1989   [(set (match_operand:DI 0 "register_operand" "")
1990         (abs:DI (match_operand:DI 1 "register_operand" "")))]
1991   "! rtx_equal_p (operands[0], operands[1])"
1992   [(set (match_dup 0) (neg:DI (match_dup 1)))
1993    (set (match_dup 0) (if_then_else:DI (lt (match_dup 1) (const_int 0))
1994                                        (match_dup 0) (match_dup 1)))]
1995   "")
1996
1997 (define_split
1998   [(set (match_operand:DI 0 "register_operand" "")
1999         (neg:DI (abs:DI (match_dup 0))))
2000    (clobber (match_operand:DI 2 "register_operand" ""))]
2001   ""
2002   [(set (match_dup 1) (neg:DI (match_dup 0)))
2003    (set (match_dup 0) (if_then_else:DI (le (match_dup 0) (const_int 0))
2004                                        (match_dup 0) (match_dup 1)))]
2005   "")
2006
2007 (define_split
2008   [(set (match_operand:DI 0 "register_operand" "")
2009         (neg:DI (abs:DI (match_operand:DI 1 "register_operand" ""))))]
2010   "! rtx_equal_p (operands[0], operands[1])"
2011   [(set (match_dup 0) (neg:DI (match_dup 1)))
2012    (set (match_dup 0) (if_then_else:DI (gt (match_dup 1) (const_int 0))
2013                                        (match_dup 0) (match_dup 1)))]
2014   "")
2015
2016 (define_expand "smaxdi3"
2017   [(set (match_dup 3)
2018         (le:DI (match_operand:DI 1 "reg_or_0_operand" "")
2019                (match_operand:DI 2 "reg_or_8bit_operand" "")))
2020    (set (match_operand:DI 0 "register_operand" "")
2021         (if_then_else:DI (eq (match_dup 3) (const_int 0))
2022                          (match_dup 1) (match_dup 2)))]
2023   ""
2024   "
2025 { operands[3] = gen_reg_rtx (DImode);
2026 }")
2027
2028 (define_split
2029   [(set (match_operand:DI 0 "register_operand" "")
2030         (smax:DI (match_operand:DI 1 "reg_or_0_operand" "")
2031                  (match_operand:DI 2 "reg_or_8bit_operand" "")))
2032    (clobber (match_operand:DI 3 "register_operand" ""))]
2033   "operands[2] != const0_rtx"
2034   [(set (match_dup 3) (le:DI (match_dup 1) (match_dup 2)))
2035    (set (match_dup 0) (if_then_else:DI (eq (match_dup 3) (const_int 0))
2036                                        (match_dup 1) (match_dup 2)))]
2037   "")
2038
2039 (define_insn ""
2040   [(set (match_operand:DI 0 "register_operand" "=r")
2041         (smax:DI (match_operand:DI 1 "register_operand" "0")
2042                  (const_int 0)))]
2043   ""
2044   "cmovlt %0,0,%0"
2045   [(set_attr "type" "cmov")])
2046
2047 (define_expand "smindi3"
2048   [(set (match_dup 3)
2049         (lt:DI (match_operand:DI 1 "reg_or_0_operand" "")
2050                (match_operand:DI 2 "reg_or_8bit_operand" "")))
2051    (set (match_operand:DI 0 "register_operand" "")
2052         (if_then_else:DI (ne (match_dup 3) (const_int 0))
2053                          (match_dup 1) (match_dup 2)))]
2054   ""
2055   "
2056 { operands[3] = gen_reg_rtx (DImode);
2057 }")
2058
2059 (define_split
2060   [(set (match_operand:DI 0 "register_operand" "")
2061         (smin:DI (match_operand:DI 1 "reg_or_0_operand" "")
2062                  (match_operand:DI 2 "reg_or_8bit_operand" "")))
2063    (clobber (match_operand:DI 3 "register_operand" ""))]
2064   "operands[2] != const0_rtx"
2065   [(set (match_dup 3) (lt:DI (match_dup 1) (match_dup 2)))
2066    (set (match_dup 0) (if_then_else:DI (ne (match_dup 3) (const_int 0))
2067                                        (match_dup 1) (match_dup 2)))]
2068   "")
2069
2070 (define_insn ""
2071   [(set (match_operand:DI 0 "register_operand" "=r")
2072         (smin:DI (match_operand:DI 1 "register_operand" "0")
2073                  (const_int 0)))]
2074   ""
2075   "cmovgt %0,0,%0"
2076   [(set_attr "type" "cmov")])
2077
2078 (define_expand "umaxdi3"
2079   [(set (match_dup 3) 
2080         (leu:DI (match_operand:DI 1 "reg_or_0_operand" "")
2081                 (match_operand:DI 2 "reg_or_8bit_operand" "")))
2082    (set (match_operand:DI 0 "register_operand" "")
2083         (if_then_else:DI (eq (match_dup 3) (const_int 0))
2084                          (match_dup 1) (match_dup 2)))]
2085   ""
2086   "
2087 { operands[3] = gen_reg_rtx (DImode);
2088 }")
2089
2090 (define_split
2091   [(set (match_operand:DI 0 "register_operand" "")
2092         (umax:DI (match_operand:DI 1 "reg_or_0_operand" "")
2093                  (match_operand:DI 2 "reg_or_8bit_operand" "")))
2094    (clobber (match_operand:DI 3 "register_operand" ""))]
2095   "operands[2] != const0_rtx"
2096   [(set (match_dup 3) (leu:DI (match_dup 1) (match_dup 2)))
2097    (set (match_dup 0) (if_then_else:DI (eq (match_dup 3) (const_int 0))
2098                                        (match_dup 1) (match_dup 2)))]
2099   "")
2100
2101 (define_expand "umindi3"
2102   [(set (match_dup 3)
2103         (ltu:DI (match_operand:DI 1 "reg_or_0_operand" "")
2104                 (match_operand:DI 2 "reg_or_8bit_operand" "")))
2105    (set (match_operand:DI 0 "register_operand" "")
2106         (if_then_else:DI (ne (match_dup 3) (const_int 0))
2107                          (match_dup 1) (match_dup 2)))]
2108   ""
2109   "
2110 { operands[3] = gen_reg_rtx (DImode);
2111 }")
2112
2113 (define_split
2114   [(set (match_operand:DI 0 "register_operand" "")
2115         (umin:DI (match_operand:DI 1 "reg_or_0_operand" "")
2116                  (match_operand:DI 2 "reg_or_8bit_operand" "")))
2117    (clobber (match_operand:DI 3 "register_operand" ""))]
2118   "operands[2] != const0_rtx"
2119   [(set (match_dup 3) (ltu:DI (match_dup 1) (match_dup 2)))
2120    (set (match_dup 0) (if_then_else:DI (ne (match_dup 3) (const_int 0))
2121                                        (match_dup 1) (match_dup 2)))]
2122   "")
2123
2124 (define_insn ""
2125   [(set (pc)
2126         (if_then_else
2127          (match_operator 1 "signed_comparison_operator"
2128                          [(match_operand:DI 2 "reg_or_0_operand" "rJ")
2129                           (const_int 0)])
2130          (label_ref (match_operand 0 "" ""))
2131          (pc)))]
2132   ""
2133   "b%C1 %r2,%0"
2134   [(set_attr "type" "ibr")])
2135
2136 (define_insn ""
2137   [(set (pc)
2138         (if_then_else
2139          (match_operator 1 "signed_comparison_operator"
2140                          [(const_int 0)
2141                           (match_operand:DI 2 "register_operand" "r")])
2142          (label_ref (match_operand 0 "" ""))
2143          (pc)))]
2144   ""
2145   "b%c1 %2,%0"
2146   [(set_attr "type" "ibr")])
2147
2148 (define_insn ""
2149   [(set (pc)
2150         (if_then_else
2151          (ne (zero_extract:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
2152                               (const_int 1)
2153                               (const_int 0))
2154              (const_int 0))
2155          (label_ref (match_operand 0 "" ""))
2156          (pc)))]
2157   ""
2158   "blbs %r1,%0"
2159   [(set_attr "type" "ibr")])
2160
2161 (define_insn ""
2162   [(set (pc)
2163         (if_then_else
2164          (eq (zero_extract:DI (match_operand:DI 1 "reg_or_0_operand" "rJ")
2165                               (const_int 1)
2166                               (const_int 0))
2167              (const_int 0))
2168          (label_ref (match_operand 0 "" ""))
2169          (pc)))]
2170   ""
2171   "blbc %r1,%0"
2172   [(set_attr "type" "ibr")])
2173
2174 (define_split
2175   [(parallel
2176     [(set (pc)
2177           (if_then_else
2178            (match_operator 1 "comparison_operator"
2179                            [(zero_extract:DI (match_operand:DI 2 "register_operand" "")
2180                                              (const_int 1)
2181                                              (match_operand:DI 3 "const_int_operand" ""))
2182                             (const_int 0)])
2183            (label_ref (match_operand 0 "" ""))
2184            (pc)))
2185      (clobber (match_operand:DI 4 "register_operand" ""))])]
2186   "INTVAL (operands[3]) != 0"
2187   [(set (match_dup 4)
2188         (lshiftrt:DI (match_dup 2) (match_dup 3)))
2189    (set (pc)
2190         (if_then_else (match_op_dup 1
2191                                     [(zero_extract:DI (match_dup 4)
2192                                                       (const_int 1)
2193                                                       (const_int 0))
2194                                      (const_int 0)])
2195                       (label_ref (match_dup 0))
2196                       (pc)))]
2197   "")
2198 \f
2199 ;; The following are the corresponding floating-point insns.  Recall
2200 ;; we need to have variants that expand the arguments from SF mode
2201 ;; to DFmode.
2202
2203 (define_insn ""
2204   [(set (match_operand:DF 0 "register_operand" "=&f")
2205         (match_operator:DF 1 "alpha_comparison_operator"
2206                            [(match_operand:DF 2 "reg_or_fp0_operand" "fG")
2207                             (match_operand:DF 3 "reg_or_fp0_operand" "fG")]))]
2208   "TARGET_FP && alpha_tp == ALPHA_TP_INSN"
2209   "cmp%-%C1%' %R2,%R3,%0"
2210   [(set_attr "type" "fadd")
2211    (set_attr "trap" "yes")])
2212
2213 (define_insn ""
2214   [(set (match_operand:DF 0 "register_operand" "=f")
2215         (match_operator:DF 1 "alpha_comparison_operator"
2216                            [(match_operand:DF 2 "reg_or_fp0_operand" "fG")
2217                             (match_operand:DF 3 "reg_or_fp0_operand" "fG")]))]
2218   "TARGET_FP && alpha_tp != ALPHA_TP_INSN"
2219   "cmp%-%C1%' %R2,%R3,%0"
2220   [(set_attr "type" "fadd")
2221    (set_attr "trap" "yes")])
2222
2223 (define_insn ""
2224   [(set (match_operand:DF 0 "register_operand" "=f")
2225         (match_operator:DF 1 "alpha_comparison_operator"
2226                            [(float_extend:DF
2227                              (match_operand:SF 2 "reg_or_fp0_operand" "fG"))
2228                             (match_operand:DF 3 "reg_or_fp0_operand" "fG")]))]
2229   "TARGET_FP && alpha_tp != ALPHA_TP_INSN"
2230   "cmp%-%C1%' %R2,%R3,%0"
2231   [(set_attr "type" "fadd")
2232    (set_attr "trap" "yes")])
2233
2234 (define_insn ""
2235   [(set (match_operand:DF 0 "register_operand" "=f")
2236         (match_operator:DF 1 "alpha_comparison_operator"
2237                            [(match_operand:DF 2 "reg_or_fp0_operand" "fG")
2238                             (float_extend:DF
2239                              (match_operand:SF 3 "reg_or_fp0_operand" "fG"))]))]
2240   "TARGET_FP && alpha_tp != ALPHA_TP_INSN"
2241   "cmp%-%C1%' %R2,%R3,%0"
2242   [(set_attr "type" "fadd")
2243    (set_attr "trap" "yes")])
2244
2245 (define_insn ""
2246   [(set (match_operand:DF 0 "register_operand" "=f")
2247         (match_operator:DF 1 "alpha_comparison_operator"
2248                            [(float_extend:DF
2249                              (match_operand:SF 2 "reg_or_fp0_operand" "fG"))
2250                             (float_extend:DF
2251                              (match_operand:SF 3 "reg_or_fp0_operand" "fG"))]))]
2252   "TARGET_FP && alpha_tp != ALPHA_TP_INSN"
2253   "cmp%-%C1%' %R2,%R3,%0"
2254   [(set_attr "type" "fadd")
2255    (set_attr "trap" "yes")])
2256
2257 (define_insn ""
2258   [(set (match_operand:DF 0 "register_operand" "=&f,f")
2259         (if_then_else:DF 
2260          (match_operator 3 "signed_comparison_operator"
2261                          [(match_operand:DF 4 "reg_or_fp0_operand" "fG,fG")
2262                           (match_operand:DF 2 "fp0_operand" "G,G")])
2263          (match_operand:DF 1 "reg_or_fp0_operand" "fG,0")
2264          (match_operand:DF 5 "reg_or_fp0_operand" "0,fG")))]
2265   "TARGET_FP && alpha_tp == ALPHA_TP_INSN"
2266   "@
2267    fcmov%C3 %R4,%R1,%0
2268    fcmov%D3 %R4,%R5,%0"
2269   [(set_attr "type" "fadd")])
2270
2271 (define_insn ""
2272   [(set (match_operand:DF 0 "register_operand" "=f,f")
2273         (if_then_else:DF 
2274          (match_operator 3 "signed_comparison_operator"
2275                          [(match_operand:DF 4 "reg_or_fp0_operand" "fG,fG")
2276                           (match_operand:DF 2 "fp0_operand" "G,G")])
2277          (match_operand:DF 1 "reg_or_fp0_operand" "fG,0")
2278          (match_operand:DF 5 "reg_or_fp0_operand" "0,fG")))]
2279   "TARGET_FP && alpha_tp != ALPHA_TP_INSN"
2280   "@
2281    fcmov%C3 %R4,%R1,%0
2282    fcmov%D3 %R4,%R5,%0"
2283   [(set_attr "type" "fadd")])
2284
2285 (define_insn ""
2286   [(set (match_operand:SF 0 "register_operand" "=&f,f")
2287         (if_then_else:SF 
2288          (match_operator 3 "signed_comparison_operator"
2289                          [(match_operand:DF 4 "reg_or_fp0_operand" "fG,fG")
2290                           (match_operand:DF 2 "fp0_operand" "G,G")])
2291          (match_operand:SF 1 "reg_or_fp0_operand" "fG,0")
2292          (match_operand:SF 5 "reg_or_fp0_operand" "0,fG")))]
2293   "TARGET_FP && alpha_tp == ALPHA_TP_INSN"
2294   "@
2295    fcmov%C3 %R4,%R1,%0
2296    fcmov%D3 %R4,%R5,%0"
2297   [(set_attr "type" "fadd")])
2298
2299 (define_insn ""
2300   [(set (match_operand:SF 0 "register_operand" "=f,f")
2301         (if_then_else:SF 
2302          (match_operator 3 "signed_comparison_operator"
2303                          [(match_operand:DF 4 "reg_or_fp0_operand" "fG,fG")
2304                           (match_operand:DF 2 "fp0_operand" "G,G")])
2305          (match_operand:SF 1 "reg_or_fp0_operand" "fG,0")
2306          (match_operand:SF 5 "reg_or_fp0_operand" "0,fG")))]
2307   "TARGET_FP && alpha_tp != ALPHA_TP_INSN"
2308   "@
2309    fcmov%C3 %R4,%R1,%0
2310    fcmov%D3 %R4,%R5,%0"
2311   [(set_attr "type" "fadd")])
2312
2313 (define_insn ""
2314   [(set (match_operand:DF 0 "register_operand" "=f,f")
2315         (if_then_else:DF 
2316          (match_operator 3 "signed_comparison_operator"
2317                          [(match_operand:DF 4 "reg_or_fp0_operand" "fG,fG")
2318                           (match_operand:DF 2 "fp0_operand" "G,G")])
2319          (float_extend:DF (match_operand:SF 1 "reg_or_fp0_operand" "fG,0"))
2320          (match_operand:DF 5 "reg_or_fp0_operand" "0,fG")))]
2321   "TARGET_FP && alpha_tp != ALPHA_TP_INSN"
2322   "@
2323    fcmov%C3 %R4,%R1,%0
2324    fcmov%D3 %R4,%R5,%0"
2325   [(set_attr "type" "fadd")])
2326
2327 (define_insn ""
2328   [(set (match_operand:DF 0 "register_operand" "=f,f")
2329         (if_then_else:DF 
2330          (match_operator 3 "signed_comparison_operator"
2331                          [(float_extend:DF 
2332                            (match_operand:SF 4 "reg_or_fp0_operand" "fG,fG"))
2333                           (match_operand:DF 2 "fp0_operand" "G,G")])
2334          (match_operand:DF 1 "reg_or_fp0_operand" "fG,0")
2335          (match_operand:DF 5 "reg_or_fp0_operand" "0,fG")))]
2336   "TARGET_FP && alpha_tp != ALPHA_TP_INSN"
2337   "@
2338    fcmov%C3 %R4,%R1,%0
2339    fcmov%D3 %R4,%R5,%0"
2340   [(set_attr "type" "fadd")])
2341
2342 (define_insn ""
2343   [(set (match_operand:SF 0 "register_operand" "=f,f")
2344         (if_then_else:SF 
2345          (match_operator 3 "signed_comparison_operator"
2346                          [(float_extend:DF
2347                            (match_operand:SF 4 "reg_or_fp0_operand" "fG,fG"))
2348                           (match_operand:DF 2 "fp0_operand" "G,G")])
2349          (match_operand:SF 1 "reg_or_fp0_operand" "fG,0")
2350          (match_operand:SF 5 "reg_or_fp0_operand" "0,fG")))]
2351   "TARGET_FP && alpha_tp != ALPHA_TP_INSN"
2352   "@
2353    fcmov%C3 %R4,%R1,%0
2354    fcmov%D3 %R4,%R5,%0"
2355   [(set_attr "type" "fadd")])
2356
2357 (define_insn ""
2358   [(set (match_operand:DF 0 "register_operand" "=f,f")
2359         (if_then_else:DF 
2360          (match_operator 3 "signed_comparison_operator"
2361                          [(float_extend:DF
2362                            (match_operand:SF 4 "reg_or_fp0_operand" "fG,fG"))
2363                           (match_operand:DF 2 "fp0_operand" "G,G")])
2364          (float_extend:DF (match_operand:SF 1 "reg_or_fp0_operand" "fG,0"))
2365          (match_operand:DF 5 "reg_or_fp0_operand" "0,fG")))]
2366   "TARGET_FP && alpha_tp != ALPHA_TP_INSN"
2367   "@
2368    fcmov%C3 %R4,%R1,%0
2369    fcmov%D3 %R4,%R5,%0"
2370   [(set_attr "type" "fadd")])
2371
2372 (define_expand "maxdf3"
2373   [(set (match_dup 3)
2374         (le:DF (match_operand:DF 1 "reg_or_fp0_operand" "")
2375                (match_operand:DF 2 "reg_or_fp0_operand" "")))
2376    (set (match_operand:DF 0 "register_operand" "")
2377         (if_then_else:DF (eq (match_dup 3) (match_dup 4))
2378                          (match_dup 1) (match_dup 2)))]
2379   "TARGET_FP"
2380   "
2381 { operands[3] = gen_reg_rtx (DFmode);
2382   operands[4] = CONST0_RTX (DFmode);
2383 }")
2384
2385 (define_expand "mindf3"
2386   [(set (match_dup 3)
2387         (lt:DF (match_operand:DF 1 "reg_or_fp0_operand" "")
2388                (match_operand:DF 2 "reg_or_fp0_operand" "")))
2389    (set (match_operand:DF 0 "register_operand" "")
2390         (if_then_else:DF (ne (match_dup 3) (match_dup 4))
2391                          (match_dup 1) (match_dup 2)))]
2392   "TARGET_FP"
2393   "
2394 { operands[3] = gen_reg_rtx (DFmode);
2395   operands[4] = CONST0_RTX (DFmode);
2396 }")
2397
2398 (define_expand "maxsf3"
2399   [(set (match_dup 3)
2400         (le:DF (float_extend:DF (match_operand:SF 1 "reg_or_fp0_operand" ""))
2401                (float_extend:DF (match_operand:SF 2 "reg_or_fp0_operand" ""))))
2402    (set (match_operand:SF 0 "register_operand" "")
2403         (if_then_else:SF (eq (match_dup 3) (match_dup 4))
2404                          (match_dup 1) (match_dup 2)))]
2405   "TARGET_FP"
2406   "
2407 { operands[3] = gen_reg_rtx (DFmode);
2408   operands[4] = CONST0_RTX (DFmode);
2409 }")
2410
2411 (define_expand "minsf3"
2412   [(set (match_dup 3)
2413         (lt:DF (float_extend:DF (match_operand:SF 1 "reg_or_fp0_operand" ""))
2414                (float_extend:DF (match_operand:SF 2 "reg_or_fp0_operand" ""))))
2415    (set (match_operand:SF 0 "register_operand" "")
2416         (if_then_else:SF (ne (match_dup 3) (match_dup 4))
2417                       (match_dup 1) (match_dup 2)))]
2418   "TARGET_FP"
2419   "
2420 { operands[3] = gen_reg_rtx (DFmode);
2421   operands[4] = CONST0_RTX (DFmode);
2422 }")
2423
2424 (define_insn ""
2425   [(set (pc)
2426         (if_then_else
2427          (match_operator 1 "signed_comparison_operator"
2428                          [(match_operand:DF 2 "reg_or_fp0_operand" "fG")
2429                           (match_operand:DF 3 "fp0_operand" "G")])
2430          (label_ref (match_operand 0 "" ""))
2431          (pc)))]
2432   "TARGET_FP"
2433   "fb%C1 %R2,%0"
2434   [(set_attr "type" "fbr")])
2435
2436 (define_insn ""
2437   [(set (pc)
2438         (if_then_else
2439          (match_operator 1 "signed_comparison_operator"
2440                          [(float_extend:DF
2441                            (match_operand:SF 2 "reg_or_fp0_operand" "fG"))
2442                           (match_operand:DF 3 "fp0_operand" "G")])
2443          (label_ref (match_operand 0 "" ""))
2444          (pc)))]
2445   "TARGET_FP"
2446   "fb%C1 %R2,%0"
2447   [(set_attr "type" "fbr")])
2448 \f
2449 ;; These are the main define_expand's used to make conditional branches
2450 ;; and compares.
2451
2452 (define_expand "cmpdf"
2453   [(set (cc0) (compare (match_operand:DF 0 "reg_or_fp0_operand" "")
2454                        (match_operand:DF 1 "reg_or_fp0_operand" "")))]
2455   "TARGET_FP"
2456   "
2457 {
2458   alpha_compare_op0 = operands[0];
2459   alpha_compare_op1 = operands[1];
2460   alpha_compare_fp_p = 1;
2461   DONE;
2462 }")
2463
2464 (define_expand "cmpdi"
2465   [(set (cc0) (compare (match_operand:DI 0 "reg_or_0_operand" "")
2466                        (match_operand:DI 1 "reg_or_8bit_operand" "")))]
2467   ""
2468   "
2469 {
2470   alpha_compare_op0 = operands[0];
2471   alpha_compare_op1 = operands[1];
2472   alpha_compare_fp_p = 0;
2473   DONE;
2474 }")
2475
2476 (define_expand "beq"
2477   [(set (match_dup 1) (match_dup 2))
2478    (set (pc)
2479         (if_then_else (match_dup 3)
2480                       (label_ref (match_operand 0 "" ""))
2481                       (pc)))]
2482   ""
2483   "
2484 {
2485   enum machine_mode mode;
2486   enum rtx_code compare_code = EQ, branch_code = NE;
2487
2488   if (alpha_compare_fp_p)
2489     mode = DFmode;
2490   else
2491     {
2492       mode = DImode;
2493       /* We want to use cmpeq/bne when we can, since there is a zero-delay
2494          bypass between logicals and br/cmov on the 21164.  But we don't
2495          want to force valid immediate constants into registers needlessly.  */
2496       if (GET_CODE (alpha_compare_op1) == CONST_INT
2497           && ((INTVAL (alpha_compare_op1) >= -0x8000
2498                && INTVAL (alpha_compare_op1) < 0)
2499               || (INTVAL (alpha_compare_op1) > 0xff
2500                   && INTVAL (alpha_compare_op1) < 0x8000)))
2501         {
2502           compare_code = PLUS, branch_code = EQ;
2503           alpha_compare_op1 = GEN_INT (- INTVAL (alpha_compare_op1));
2504         }
2505     }
2506
2507   operands[1] = gen_reg_rtx (mode);
2508   operands[2] = gen_rtx (compare_code, mode,
2509                          alpha_compare_op0, alpha_compare_op1);
2510   operands[3] = gen_rtx (branch_code, VOIDmode,
2511                          operands[1], CONST0_RTX (mode));
2512 }")
2513
2514 (define_expand "bne"
2515   [(set (match_dup 1) (match_dup 2))
2516    (set (pc)
2517         (if_then_else (match_dup 3)
2518                       (label_ref (match_operand 0 "" ""))
2519                       (pc)))]
2520   ""
2521   "
2522 {
2523   enum machine_mode mode;
2524   enum rtx_code compare_code = EQ, branch_code = EQ;
2525
2526   if (alpha_compare_fp_p)
2527     mode = DFmode;
2528   else
2529     {
2530       mode = DImode;
2531       /* We want to use cmpeq/bne when we can, since there is a zero-delay
2532          bypass between logicals and br/cmov on the 21164.  But we don't
2533          want to force valid immediate constants into registers needlessly.  */
2534       if (GET_CODE (alpha_compare_op1) == CONST_INT
2535           && ((INTVAL (alpha_compare_op1) >= -0x8000
2536                && INTVAL (alpha_compare_op1) < 0)
2537               || (INTVAL (alpha_compare_op1) > 0xff
2538                   && INTVAL (alpha_compare_op1) < 0x8000)))
2539         {
2540           compare_code = PLUS, branch_code = NE;
2541           alpha_compare_op1 = GEN_INT (- INTVAL (alpha_compare_op1));
2542         }
2543     }
2544
2545   operands[1] = gen_reg_rtx (mode);
2546   operands[2] = gen_rtx (compare_code, mode,
2547                          alpha_compare_op0, alpha_compare_op1);
2548   operands[3] = gen_rtx (branch_code, VOIDmode,
2549                          operands[1], CONST0_RTX (mode));
2550 }")
2551
2552 (define_expand "blt"
2553   [(set (match_dup 1) (match_dup 2))
2554    (set (pc)
2555         (if_then_else (match_dup 3)
2556                       (label_ref (match_operand 0 "" ""))
2557                       (pc)))]
2558   ""
2559   "
2560 {
2561   enum machine_mode mode = alpha_compare_fp_p ? DFmode : DImode;
2562   operands[1] = gen_reg_rtx (mode);
2563   operands[2] = gen_rtx (LT, mode, alpha_compare_op0, alpha_compare_op1);
2564   operands[3] = gen_rtx (NE, VOIDmode, operands[1], CONST0_RTX (mode));
2565 }")
2566
2567 (define_expand "ble"
2568   [(set (match_dup 1) (match_dup 2))
2569    (set (pc)
2570         (if_then_else (match_dup 3)
2571                       (label_ref (match_operand 0 "" ""))
2572                       (pc)))]
2573   ""
2574   "
2575 {
2576   enum machine_mode mode = alpha_compare_fp_p ? DFmode : DImode;
2577   operands[1] = gen_reg_rtx (mode);
2578   operands[2] = gen_rtx (LE, mode, alpha_compare_op0, alpha_compare_op1);
2579   operands[3] = gen_rtx (NE, VOIDmode, operands[1], CONST0_RTX (mode));
2580 }")
2581
2582 (define_expand "bgt"
2583   [(set (match_dup 1) (match_dup 2))
2584    (set (pc)
2585         (if_then_else (match_dup 3)
2586                       (label_ref (match_operand 0 "" ""))
2587                       (pc)))]
2588   ""
2589   "
2590 {
2591   if (alpha_compare_fp_p)
2592     {
2593       operands[1] = gen_reg_rtx (DFmode);
2594       operands[2] = gen_rtx (LT, DFmode, alpha_compare_op1, alpha_compare_op0);
2595       operands[3] = gen_rtx (NE, VOIDmode, operands[1], CONST0_RTX (DFmode));
2596     }
2597   else
2598     {
2599       operands[1] = gen_reg_rtx (DImode);
2600       operands[2] = gen_rtx (LE, DImode, alpha_compare_op0, alpha_compare_op1);
2601       operands[3] = gen_rtx (EQ, VOIDmode, operands[1], const0_rtx);
2602     }
2603 }")
2604
2605 (define_expand "bge"
2606   [(set (match_dup 1) (match_dup 2))
2607    (set (pc)
2608         (if_then_else (match_dup 3)
2609                       (label_ref (match_operand 0 "" ""))
2610                       (pc)))]
2611   ""
2612   "
2613 {
2614   if (alpha_compare_fp_p)
2615     {
2616       operands[1] = gen_reg_rtx (DFmode);
2617       operands[2] = gen_rtx (LE, DFmode, alpha_compare_op1, alpha_compare_op0);
2618       operands[3] = gen_rtx (NE, VOIDmode, operands[1], CONST0_RTX (DFmode));
2619     }
2620   else
2621     {
2622       operands[1] = gen_reg_rtx (DImode);
2623       operands[2] = gen_rtx (LT, DImode, alpha_compare_op0, alpha_compare_op1);
2624       operands[3] = gen_rtx (EQ, VOIDmode, operands[1], const0_rtx);
2625     }
2626 }")
2627
2628 (define_expand "bltu"
2629   [(set (match_dup 1) (match_dup 2))
2630    (set (pc)
2631         (if_then_else (match_dup 3)
2632                       (label_ref (match_operand 0 "" ""))
2633                       (pc)))]
2634   ""
2635   "
2636 {
2637   operands[1] = gen_reg_rtx (DImode);
2638   operands[2] = gen_rtx (LTU, DImode, alpha_compare_op0, alpha_compare_op1);
2639   operands[3] = gen_rtx (NE, VOIDmode, operands[1], const0_rtx);
2640 }")
2641
2642 (define_expand "bleu"
2643   [(set (match_dup 1) (match_dup 2))
2644    (set (pc)
2645         (if_then_else (match_dup 3)
2646                       (label_ref (match_operand 0 "" ""))
2647                       (pc)))]
2648   ""
2649   "
2650 {
2651   operands[1] = gen_reg_rtx (DImode);
2652   operands[2] = gen_rtx (LEU, DImode, alpha_compare_op0, alpha_compare_op1);
2653   operands[3] = gen_rtx (NE, VOIDmode, operands[1], const0_rtx);
2654 }")
2655
2656 (define_expand "bgtu"
2657   [(set (match_dup 1) (match_dup 2))
2658    (set (pc)
2659         (if_then_else (match_dup 3)
2660                       (label_ref (match_operand 0 "" ""))
2661                       (pc)))]
2662   ""
2663   "
2664 {
2665   operands[1] = gen_reg_rtx (DImode);
2666   operands[2] = gen_rtx (LEU, DImode, alpha_compare_op0, alpha_compare_op1);
2667   operands[3] = gen_rtx (EQ, VOIDmode, operands[1], const0_rtx);
2668 }")
2669
2670 (define_expand "bgeu"
2671   [(set (match_dup 1) (match_dup 2))
2672    (set (pc)
2673         (if_then_else (match_dup 3)
2674                       (label_ref (match_operand 0 "" ""))
2675                       (pc)))]
2676   ""
2677   "
2678 {
2679   operands[1] = gen_reg_rtx (DImode);
2680   operands[2] = gen_rtx (LTU, DImode, alpha_compare_op0, alpha_compare_op1);
2681   operands[3] = gen_rtx (EQ, VOIDmode, operands[1], const0_rtx);
2682 }")
2683
2684 (define_expand "seq"
2685   [(set (match_operand:DI 0 "register_operand" "")
2686         (match_dup 1))]
2687   ""
2688   "
2689 {
2690   if (alpha_compare_fp_p)
2691     FAIL;
2692
2693   operands[1] = gen_rtx (EQ, DImode, alpha_compare_op0, alpha_compare_op1);
2694 }")
2695
2696 (define_expand "sne"
2697   [(set (match_operand:DI 0 "register_operand" "")
2698         (match_dup 1))
2699    (set (match_dup 0) (xor:DI (match_dup 0) (const_int 1)))]
2700   ""
2701   "
2702 {
2703   if (alpha_compare_fp_p)
2704     FAIL;
2705
2706   operands[1] = gen_rtx (EQ, DImode, alpha_compare_op0, alpha_compare_op1);
2707 }")
2708
2709 (define_expand "slt"
2710   [(set (match_operand:DI 0 "register_operand" "")
2711         (match_dup 1))]
2712   ""
2713   "
2714 {
2715   if (alpha_compare_fp_p)
2716     FAIL;
2717
2718   operands[1] = gen_rtx (LT, DImode, alpha_compare_op0, alpha_compare_op1);
2719 }")
2720
2721 (define_expand "sle"
2722   [(set (match_operand:DI 0 "register_operand" "")
2723         (match_dup 1))]
2724   ""
2725   "
2726 {
2727   if (alpha_compare_fp_p)
2728     FAIL;
2729
2730   operands[1] = gen_rtx (LE, DImode, alpha_compare_op0, alpha_compare_op1);
2731 }")
2732
2733 (define_expand "sgt"
2734   [(set (match_operand:DI 0 "register_operand" "")
2735         (match_dup 1))]
2736   ""
2737   "
2738 {
2739   if (alpha_compare_fp_p)
2740     FAIL;
2741
2742   operands[1] = gen_rtx (LT, DImode, force_reg (DImode, alpha_compare_op1),
2743                          alpha_compare_op0);
2744 }")
2745
2746 (define_expand "sge"
2747   [(set (match_operand:DI 0 "register_operand" "")
2748         (match_dup 1))]
2749   ""
2750   "
2751 {
2752   if (alpha_compare_fp_p)
2753     FAIL;
2754
2755   operands[1] = gen_rtx (LE, DImode, force_reg (DImode, alpha_compare_op1),
2756                          alpha_compare_op0);
2757 }")
2758
2759 (define_expand "sltu"
2760   [(set (match_operand:DI 0 "register_operand" "")
2761         (match_dup 1))]
2762   ""
2763   "
2764 {
2765   if (alpha_compare_fp_p)
2766     FAIL;
2767
2768   operands[1] = gen_rtx (LTU, DImode, alpha_compare_op0, alpha_compare_op1);
2769 }")
2770
2771 (define_expand "sleu"
2772   [(set (match_operand:DI 0 "register_operand" "")
2773         (match_dup 1))]
2774   ""
2775   "
2776 {
2777   if (alpha_compare_fp_p)
2778     FAIL;
2779
2780   operands[1] = gen_rtx (LEU, DImode, alpha_compare_op0, alpha_compare_op1);
2781 }")
2782
2783 (define_expand "sgtu"
2784   [(set (match_operand:DI 0 "register_operand" "")
2785         (match_dup 1))]
2786   ""
2787   "
2788 {
2789   if (alpha_compare_fp_p)
2790     FAIL;
2791
2792   operands[1] = gen_rtx (LTU, DImode, force_reg (DImode, alpha_compare_op1),
2793                          alpha_compare_op0);
2794 }")
2795
2796 (define_expand "sgeu"
2797   [(set (match_operand:DI 0 "register_operand" "")
2798         (match_dup 1))]
2799   ""
2800   "
2801 {
2802   if (alpha_compare_fp_p)
2803     FAIL;
2804
2805   operands[1] = gen_rtx (LEU, DImode, force_reg (DImode, alpha_compare_op1),
2806                          alpha_compare_op0);
2807 }")
2808 \f
2809 ;; These are the main define_expand's used to make conditional moves.
2810
2811 (define_expand "movsicc"
2812   [(set (match_operand:SI 0 "register_operand" "")
2813         (if_then_else:DI (match_operand 1 "comparison_operator" "")
2814                          (match_operand:SI 2 "reg_or_8bit_operand" "")
2815                          (match_operand:SI 3 "reg_or_8bit_operand" "")))]
2816   ""
2817   "
2818 {
2819   if ((operands[1] = alpha_emit_conditional_move (operands[1], SImode)) == 0)
2820     FAIL;
2821 }")
2822
2823 (define_expand "movdicc"
2824   [(set (match_operand:DI 0 "register_operand" "")
2825         (if_then_else:DI (match_operand 1 "comparison_operator" "")
2826                          (match_operand:DI 2 "reg_or_8bit_operand" "")
2827                          (match_operand:DI 3 "reg_or_8bit_operand" "")))]
2828   ""
2829   "
2830 {
2831   if ((operands[1] = alpha_emit_conditional_move (operands[1], DImode)) == 0)
2832     FAIL;
2833 }")
2834
2835 (define_expand "movsfcc"
2836   [(set (match_operand:SF 0 "register_operand" "")
2837         (if_then_else:SF (match_operand 1 "comparison_operator" "")
2838                          (match_operand:SF 2 "reg_or_8bit_operand" "")
2839                          (match_operand:SF 3 "reg_or_8bit_operand" "")))]
2840   ""
2841   "
2842 {
2843   if ((operands[1] = alpha_emit_conditional_move (operands[1], SFmode)) == 0)
2844     FAIL;
2845 }")
2846
2847 (define_expand "movdfcc"
2848   [(set (match_operand:DF 0 "register_operand" "")
2849         (if_then_else:DF (match_operand 1 "comparison_operator" "")
2850                          (match_operand:DF 2 "reg_or_8bit_operand" "")
2851                          (match_operand:DF 3 "reg_or_8bit_operand" "")))]
2852   ""
2853   "
2854 {
2855   if ((operands[1] = alpha_emit_conditional_move (operands[1], DFmode)) == 0)
2856     FAIL;
2857 }")
2858 \f
2859 ;; These define_split definitions are used in cases when comparisons have
2860 ;; not be stated in the correct way and we need to reverse the second
2861 ;; comparison.  For example, x >= 7 has to be done as x < 6 with the
2862 ;; comparison that tests the result being reversed.  We have one define_split
2863 ;; for each use of a comparison.  They do not match valid insns and need
2864 ;; not generate valid insns.
2865 ;;
2866 ;; We can also handle equality comparisons (and inequality comparisons in
2867 ;; cases where the resulting add cannot overflow) by doing an add followed by
2868 ;; a comparison with zero.  This is faster since the addition takes one
2869 ;; less cycle than a compare when feeding into a conditional move.
2870 ;; For this case, we also have an SImode pattern since we can merge the add
2871 ;; and sign extend and the order doesn't matter.
2872 ;;
2873 ;; We do not do this for floating-point, since it isn't clear how the "wrong"
2874 ;; operation could have been generated.
2875
2876 (define_split
2877   [(set (match_operand:DI 0 "register_operand" "")
2878         (if_then_else:DI
2879          (match_operator 1 "comparison_operator"
2880                          [(match_operand:DI 2 "reg_or_0_operand" "")
2881                           (match_operand:DI 3 "reg_or_cint_operand" "")])
2882          (match_operand:DI 4 "reg_or_cint_operand" "")
2883          (match_operand:DI 5 "reg_or_cint_operand" "")))
2884    (clobber (match_operand:DI 6 "register_operand" ""))]
2885   "operands[3] != const0_rtx"
2886   [(set (match_dup 6) (match_dup 7))
2887    (set (match_dup 0)
2888         (if_then_else:DI (match_dup 8) (match_dup 4) (match_dup 5)))]
2889   "
2890 { enum rtx_code code = GET_CODE (operands[1]);
2891   int unsignedp = (code == GEU || code == LEU || code == GTU || code == LTU);
2892
2893   /* If we are comparing for equality with a constant and that constant
2894      appears in the arm when the register equals the constant, use the
2895      register since that is more likely to match (and to produce better code
2896      if both would).  */
2897
2898   if (code == EQ && GET_CODE (operands[3]) == CONST_INT
2899       && rtx_equal_p (operands[4], operands[3]))
2900     operands[4] = operands[2];
2901
2902   else if (code == NE && GET_CODE (operands[3]) == CONST_INT
2903            && rtx_equal_p (operands[5], operands[3]))
2904     operands[5] = operands[2];
2905
2906   if (code == NE || code == EQ
2907       || (extended_count (operands[2], DImode, unsignedp) >= 1
2908           && extended_count (operands[3], DImode, unsignedp) >= 1))
2909     {
2910       if (GET_CODE (operands[3]) == CONST_INT)
2911         operands[7] = gen_rtx (PLUS, DImode, operands[2],
2912                                GEN_INT (- INTVAL (operands[3])));
2913       else
2914         operands[7] = gen_rtx (MINUS, DImode, operands[2], operands[3]);
2915
2916       operands[8] = gen_rtx (code, VOIDmode, operands[6], const0_rtx);
2917     }
2918
2919   else if (code == EQ || code == LE || code == LT
2920            || code == LEU || code == LTU)
2921     {
2922       operands[7] = gen_rtx (code, DImode, operands[2], operands[3]);
2923       operands[8] = gen_rtx (NE, VOIDmode, operands[6], const0_rtx);
2924     }
2925   else
2926     {
2927       operands[7] = gen_rtx (reverse_condition (code), DImode, operands[2],
2928                              operands[3]);
2929       operands[8] = gen_rtx (EQ, VOIDmode, operands[6], const0_rtx);
2930     }
2931 }")
2932
2933 (define_split
2934   [(set (match_operand:DI 0 "register_operand" "")
2935         (if_then_else:DI
2936          (match_operator 1 "comparison_operator"
2937                          [(match_operand:SI 2 "reg_or_0_operand" "")
2938                           (match_operand:SI 3 "reg_or_cint_operand" "")])
2939          (match_operand:DI 4 "reg_or_8bit_operand" "")
2940          (match_operand:DI 5 "reg_or_8bit_operand" "")))
2941    (clobber (match_operand:DI 6 "register_operand" ""))]
2942   "operands[3] != const0_rtx
2943    && (GET_CODE (operands[1]) == EQ || GET_CODE (operands[1]) == NE)"
2944   [(set (match_dup 6) (match_dup 7))
2945    (set (match_dup 0)
2946         (if_then_else:DI (match_dup 8) (match_dup 4) (match_dup 5)))]
2947   "
2948 { enum rtx_code code = GET_CODE (operands[1]);
2949   int unsignedp = (code == GEU || code == LEU || code == GTU || code == LTU);
2950   rtx tem;
2951
2952   if ((code != NE && code != EQ
2953        && ! (extended_count (operands[2], DImode, unsignedp) >= 1
2954              && extended_count (operands[3], DImode, unsignedp) >= 1)))
2955     FAIL;
2956  
2957   if (GET_CODE (operands[3]) == CONST_INT)
2958     tem = gen_rtx (PLUS, SImode, operands[2],
2959                    GEN_INT (- INTVAL (operands[3])));
2960   else
2961     tem = gen_rtx (MINUS, SImode, operands[2], operands[3]);
2962
2963   operands[7] = gen_rtx (SIGN_EXTEND, DImode, tem);
2964   operands[8] = gen_rtx (GET_CODE (operands[1]), VOIDmode, operands[6],
2965                          const0_rtx);
2966 }")
2967
2968 (define_split
2969   [(set (pc)
2970         (if_then_else
2971          (match_operator 1 "comparison_operator"
2972                          [(match_operand:DI 2 "reg_or_0_operand" "")
2973                           (match_operand:DI 3 "reg_or_cint_operand" "")])
2974          (label_ref (match_operand 0 "" ""))
2975          (pc)))
2976    (clobber (match_operand:DI 4 "register_operand" ""))]
2977   "operands[3] != const0_rtx"
2978   [(set (match_dup 4) (match_dup 5))
2979    (set (pc) (if_then_else (match_dup 6) (label_ref (match_dup 0)) (pc)))]
2980   "
2981 { enum rtx_code code = GET_CODE (operands[1]);
2982   int unsignedp = (code == GEU || code == LEU || code == GTU || code == LTU);
2983
2984   if (code == NE || code == EQ
2985       || (extended_count (operands[2], DImode, unsignedp) >= 1
2986           && extended_count (operands[3], DImode, unsignedp) >= 1))
2987     {
2988       if (GET_CODE (operands[3]) == CONST_INT)
2989         operands[5] = gen_rtx (PLUS, DImode, operands[2],
2990                                GEN_INT (- INTVAL (operands[3])));
2991       else
2992         operands[5] = gen_rtx (MINUS, DImode, operands[2], operands[3]);
2993
2994       operands[6] = gen_rtx (code, VOIDmode, operands[4], const0_rtx);
2995     }
2996
2997   else if (code == EQ || code == LE || code == LT
2998            || code == LEU || code == LTU)
2999     {
3000       operands[5] = gen_rtx (code, DImode, operands[2], operands[3]);
3001       operands[6] = gen_rtx (NE, VOIDmode, operands[4], const0_rtx);
3002     }
3003   else
3004     {
3005       operands[5] = gen_rtx (reverse_condition (code), DImode, operands[2],
3006                              operands[3]);
3007       operands[6] = gen_rtx (EQ, VOIDmode, operands[4], const0_rtx);
3008     }
3009 }")
3010
3011 (define_split
3012   [(set (pc)
3013         (if_then_else
3014          (match_operator 1 "comparison_operator"
3015                          [(match_operand:SI 2 "reg_or_0_operand" "")
3016                           (match_operand:SI 3 "const_int_operand" "")])
3017          (label_ref (match_operand 0 "" ""))
3018          (pc)))
3019    (clobber (match_operand:DI 4 "register_operand" ""))]
3020   "operands[3] != const0_rtx
3021    && (GET_CODE (operands[1]) == EQ || GET_CODE (operands[1]) == NE)"
3022   [(set (match_dup 4) (match_dup 5))
3023    (set (pc) (if_then_else (match_dup 6) (label_ref (match_dup 0)) (pc)))]
3024   "
3025 { rtx tem;
3026
3027   if (GET_CODE (operands[3]) == CONST_INT)
3028     tem = gen_rtx (PLUS, SImode, operands[2],
3029                    GEN_INT (- INTVAL (operands[3])));
3030   else
3031     tem = gen_rtx (MINUS, SImode, operands[2], operands[3]);
3032   
3033   operands[5] = gen_rtx (SIGN_EXTEND, DImode, tem);
3034   operands[6] = gen_rtx (GET_CODE (operands[1]), VOIDmode,
3035                          operands[4], const0_rtx);
3036 }")
3037
3038 ;; We can convert such things as "a > 0xffff" to "t = a & ~ 0xffff; t != 0".
3039 ;; This eliminates one, and sometimes two, insns when the AND can be done
3040 ;; with a ZAP.
3041 (define_split
3042   [(set (match_operand:DI 0 "register_operand" "")
3043         (match_operator 1 "comparison_operator"
3044                         [(match_operand:DI 2 "register_operand" "")
3045                          (match_operand:DI 3 "const_int_operand" "")]))
3046    (clobber (match_operand:DI 4 "register_operand" ""))]
3047   "exact_log2 (INTVAL (operands[3]) + 1) >= 0
3048    && (GET_CODE (operands[1]) == GTU
3049        || GET_CODE (operands[1]) == LEU
3050        || ((GET_CODE (operands[1]) == GT || GET_CODE (operands[1]) == LE)
3051            && extended_count (operands[2], DImode, 1) > 0))"
3052   [(set (match_dup 4) (and:DI (match_dup 2) (match_dup 5)))
3053    (set (match_dup 0) (match_dup 6))]
3054   "
3055 {
3056   operands[5] = GEN_INT (~ INTVAL (operands[3]));
3057   operands[6] = gen_rtx (((GET_CODE (operands[1]) == GTU
3058                            || GET_CODE (operands[1]) == GT)
3059                           ? NE : EQ),
3060                          DImode, operands[4], const0_rtx);
3061 }")
3062 \f
3063 ;; Here are the CALL and unconditional branch insns.  Calls on NT and OSF
3064 ;; work differently, so we have different patterns for each.
3065
3066 (define_expand "call"
3067   [(use (match_operand:DI 0 "" ""))
3068    (use (match_operand 1 "" ""))
3069    (use (match_operand 2 "" ""))
3070    (use (match_operand 3 "" ""))]
3071   ""
3072   "
3073 { if (TARGET_WINDOWS_NT)
3074     emit_call_insn (gen_call_nt (operands[0], operands[1]));
3075   else if (TARGET_OPEN_VMS)
3076     emit_call_insn (gen_call_vms (operands[0], operands[2]));
3077   else
3078     emit_call_insn (gen_call_osf (operands[0], operands[1]));
3079
3080   DONE;
3081 }")
3082
3083 (define_expand "call_osf"
3084   [(parallel [(call (mem:DI (match_operand 0 "" ""))
3085                     (match_operand 1 "" ""))
3086               (clobber (reg:DI 27))
3087               (clobber (reg:DI 26))])]
3088   ""
3089   "
3090 { if (GET_CODE (operands[0]) != MEM)
3091     abort ();
3092
3093   operands[0] = XEXP (operands[0], 0);
3094
3095   if (GET_CODE (operands[0]) != SYMBOL_REF
3096       && ! (GET_CODE (operands[0]) == REG && REGNO (operands[0]) == 27))
3097     {
3098       rtx tem = gen_rtx (REG, DImode, 27);
3099       emit_move_insn (tem, operands[0]);
3100       operands[0] = tem;
3101     }
3102 }")
3103
3104 (define_expand "call_nt"
3105   [(parallel [(call (mem:DI (match_operand:DI 0 "" ""))
3106                     (match_operand 1 "" ""))
3107               (clobber (reg:DI 26))])]
3108   ""
3109   "
3110 { if (GET_CODE (operands[0]) != MEM)
3111     abort ();
3112   operands[0] = XEXP (operands[0], 0);
3113
3114   if (GET_CODE (operands[1]) != SYMBOL_REF
3115       && ! (GET_CODE (operands[1]) == REG && REGNO (operands[1]) == 27))
3116     {
3117       rtx tem = gen_rtx (REG, DImode, 27);
3118       emit_move_insn (tem, operands[1]);
3119       operands[1] = tem;
3120     }
3121 }")
3122
3123 ;;
3124 ;; call openvms/alpha
3125 ;; op 0: symbol ref for called function
3126 ;; op 1: next_arg_reg (argument information value for R25)
3127 ;;
3128 (define_expand "call_vms"
3129   [(parallel [(call (mem:DI (match_operand 0 "" ""))
3130                     (match_operand 1 "" ""))
3131               (use (match_dup 2))
3132               (use (reg:DI 25))
3133               (use (reg:DI 26))
3134               (clobber (reg:DI 27))])]
3135   ""
3136   "
3137 { if (GET_CODE (operands[0]) != MEM)
3138     abort ();
3139
3140   operands[0] = XEXP (operands[0], 0);
3141
3142   /* Always load AI with argument information, then handle symbolic and
3143      indirect call differently.  Load RA and set operands[2] to PV in
3144      both cases.  */
3145
3146   emit_move_insn (gen_rtx (REG, DImode, 25), operands[1]);
3147   if (GET_CODE (operands[0]) == SYMBOL_REF)
3148     {
3149       extern char *savealloc ();
3150       char *symbol = XSTR (operands[0], 0);
3151       char *linksym = savealloc (strlen (symbol) + 5);
3152       rtx linkage;
3153
3154       alpha_need_linkage (symbol, 0);
3155
3156       strcpy (linksym, symbol);
3157       strcat (linksym, \"..lk\");
3158       linkage = gen_rtx (SYMBOL_REF, Pmode, linksym);
3159
3160       emit_move_insn (gen_rtx (REG, Pmode, 26), gen_rtx (MEM, Pmode, linkage));
3161
3162       operands[2]
3163         = validize_mem (gen_rtx (MEM, Pmode, plus_constant (linkage, 8)));
3164     }
3165   else
3166     {
3167       emit_move_insn (gen_rtx (REG, Pmode, 26),
3168                       gen_rtx (MEM, Pmode, plus_constant (operands[0], 8)));
3169
3170       operands[2] = operands[0];
3171     }
3172
3173 }")
3174
3175 (define_expand "call_value"
3176   [(use (match_operand 0 "" ""))
3177    (use (match_operand:DI 1 "" ""))
3178    (use (match_operand 2 "" ""))
3179    (use (match_operand 3 "" ""))
3180    (use (match_operand 4 "" ""))]
3181   ""
3182   "
3183 { if (TARGET_WINDOWS_NT)
3184     emit_call_insn (gen_call_value_nt (operands[0], operands[1], operands[2]));
3185   else if (TARGET_OPEN_VMS)
3186     emit_call_insn (gen_call_value_vms (operands[0], operands[1],
3187                                         operands[3]));
3188   else
3189     emit_call_insn (gen_call_value_osf (operands[0], operands[1],
3190                                         operands[2]));
3191   DONE;
3192 }")
3193
3194 (define_expand "call_value_osf"
3195   [(parallel [(set (match_operand 0 "" "")
3196                    (call (mem:DI (match_operand 1 "" ""))
3197                          (match_operand 2 "" "")))
3198               (clobber (reg:DI 27))
3199               (clobber (reg:DI 26))])]
3200   ""
3201   "
3202 { if (GET_CODE (operands[1]) != MEM)
3203     abort ();
3204
3205   operands[1] = XEXP (operands[1], 0);
3206
3207   if (GET_CODE (operands[1]) != SYMBOL_REF
3208       && ! (GET_CODE (operands[1]) == REG && REGNO (operands[1]) == 27))
3209     {
3210       rtx tem = gen_rtx (REG, DImode, 27);
3211       emit_move_insn (tem, operands[1]);
3212       operands[1] = tem;
3213     }
3214 }")
3215
3216 (define_expand "call_value_nt"
3217   [(parallel [(set (match_operand 0 "" "")
3218                    (call (mem:DI (match_operand:DI 1 "" ""))
3219                          (match_operand 2 "" "")))
3220               (clobber (reg:DI 26))])]
3221   ""
3222   "
3223 { if (GET_CODE (operands[1]) != MEM)
3224     abort ();
3225
3226   operands[1] = XEXP (operands[1], 0);
3227   if (GET_CODE (operands[1]) != SYMBOL_REF
3228       && ! (GET_CODE (operands[1]) == REG && REGNO (operands[1]) == 27))
3229     {
3230       rtx tem = gen_rtx (REG, DImode, 27);
3231       emit_move_insn (tem, operands[1]);
3232       operands[1] = tem;
3233     }
3234 }")
3235
3236 (define_expand "call_value_vms"
3237   [(parallel [(set (match_operand 0 "" "")
3238                    (call (mem:DI (match_operand:DI 1 "" ""))
3239                          (match_operand 2 "" "")))
3240               (use (match_dup 3))
3241               (use (reg:DI 25))
3242               (use (reg:DI 26))
3243               (clobber (reg:DI 27))])]
3244   ""
3245   "
3246 { if (GET_CODE (operands[1]) != MEM)
3247     abort ();
3248
3249   operands[1] = XEXP (operands[1], 0);
3250
3251   /* Always load AI with argument information, then handle symbolic and
3252      indirect call differently.  Load RA and set operands[3] to PV in
3253      both cases.  */
3254
3255   emit_move_insn (gen_rtx (REG, DImode, 25), operands[2]);
3256   if (GET_CODE (operands[1]) == SYMBOL_REF)
3257     {
3258       extern char *savealloc ();
3259       char *symbol = XSTR (operands[1], 0);
3260       char *linksym = savealloc (strlen (symbol) + 5);
3261       rtx linkage;
3262
3263       alpha_need_linkage (symbol, 0);
3264       strcpy (linksym, symbol);
3265       strcat (linksym, \"..lk\");
3266       linkage = gen_rtx (SYMBOL_REF, Pmode, linksym);
3267
3268       emit_move_insn (gen_rtx (REG, Pmode, 26), gen_rtx (MEM, Pmode, linkage));
3269
3270       operands[3]
3271         = validize_mem (gen_rtx (MEM, Pmode, plus_constant (linkage, 8)));
3272     }
3273   else
3274     {
3275       emit_move_insn (gen_rtx (REG, Pmode, 26),
3276                       gen_rtx (MEM, Pmode, plus_constant (operands[1], 8)));
3277
3278       operands[3] = operands[1];
3279     }
3280 }")
3281
3282 (define_insn ""
3283   [(call (mem:DI (match_operand:DI 0 "call_operand" "r,R,i"))
3284          (match_operand 1 "" ""))
3285    (clobber (reg:DI 27))
3286    (clobber (reg:DI 26))]
3287   "! TARGET_WINDOWS_NT && ! TARGET_OPEN_VMS"
3288   "@
3289    jsr $26,($27),0\;ldgp $29,0($26)
3290    bsr $26,%0..ng
3291    jsr $26,%0\;ldgp $29,0($26)"
3292   [(set_attr "type" "jsr,ibr,jsr")])
3293       
3294 (define_insn ""
3295   [(call (mem:DI (match_operand:DI 0 "call_operand" "r,i"))
3296          (match_operand 1 "" ""))
3297    (clobber (reg:DI 26))]
3298   "TARGET_WINDOWS_NT"
3299   "@
3300    jsr $26,(%0)
3301    bsr $26,%0"
3302   [(set_attr "type" "jsr,ibr")])
3303       
3304 (define_insn ""
3305   [(call (mem:DI (match_operand:DI 0 "call_operand" "r,i"))
3306          (match_operand 1 "" ""))
3307    (use (match_operand:DI 2 "general_operand" "r,m"))
3308    (use (reg:DI 25))
3309    (use (reg:DI 26))
3310    (clobber (reg:DI 27))]
3311   "TARGET_OPEN_VMS"
3312   "@
3313    bis %2,%2,$27\;jsr $26,0\;ldq $27,0($29)
3314    ldq $27,%2\;jsr $26,%0\;ldq $27,0($29)"
3315   [(set_attr "type" "jsr")])
3316
3317 (define_insn ""
3318   [(set (match_operand 0 "register_operand" "=rf,rf,rf")
3319         (call (mem:DI (match_operand:DI 1 "call_operand" "r,R,i"))
3320               (match_operand 2 "" "")))
3321    (clobber (reg:DI 27))
3322    (clobber (reg:DI 26))]
3323   "! TARGET_WINDOWS_NT && ! TARGET_OPEN_VMS"
3324   "@
3325    jsr $26,($27),0\;ldgp $29,0($26)
3326    bsr $26,%1..ng
3327    jsr $26,%1\;ldgp $29,0($26)"
3328   [(set_attr "type" "jsr,ibr,jsr")])
3329
3330 (define_insn ""
3331   [(set (match_operand 0 "register_operand" "=rf,rf")
3332         (call (mem:DI (match_operand:DI 1 "call_operand" "r,i"))
3333               (match_operand 2 "" "")))
3334    (clobber (reg:DI 26))]
3335   "TARGET_WINDOWS_NT"
3336   "@
3337    jsr $26,(%1)
3338    bsr $26,%1"
3339   [(set_attr "type" "jsr,ibr")])
3340
3341 (define_insn ""
3342   [(set (match_operand 0 "register_operand" "")
3343         (call (mem:DI (match_operand:DI 1 "call_operand" "r,i"))
3344               (match_operand 2 "" "")))
3345    (use (match_operand:DI 3 "general_operand" "r,m"))
3346    (use (reg:DI 25))
3347    (use (reg:DI 26))
3348    (clobber (reg:DI 27))]
3349   "TARGET_OPEN_VMS"
3350   "@
3351    bis %3,%3,$27\;jsr $26,0\;ldq $27,0($29)
3352    ldq $27,%3\;jsr $26,%1\;ldq $27,0($29)"
3353   [(set_attr "type" "jsr")])
3354
3355 ;; Call subroutine returning any type.
3356
3357 (define_expand "untyped_call"
3358   [(parallel [(call (match_operand 0 "" "")
3359                     (const_int 0))
3360               (match_operand 1 "" "")
3361               (match_operand 2 "" "")])]
3362   ""
3363   "
3364 {
3365   int i;
3366
3367   emit_call_insn (gen_call (operands[0], const0_rtx, NULL, const0_rtx));
3368
3369   for (i = 0; i < XVECLEN (operands[2], 0); i++)
3370     {
3371       rtx set = XVECEXP (operands[2], 0, i);
3372       emit_move_insn (SET_DEST (set), SET_SRC (set));
3373     }
3374
3375   /* The optimizer does not know that the call sets the function value
3376      registers we stored in the result block.  We avoid problems by
3377      claiming that all hard registers are used and clobbered at this
3378      point.  */
3379   emit_insn (gen_blockage ());
3380
3381   DONE;
3382 }")
3383
3384 ;; UNSPEC_VOLATILE is considered to use and clobber all hard registers and
3385 ;; all of memory.  This blocks insns from being moved across this point.
3386
3387 (define_insn "blockage"
3388   [(unspec_volatile [(const_int 0)] 1)]
3389   ""
3390   "")
3391
3392 (define_insn "jump"
3393   [(set (pc)
3394         (label_ref (match_operand 0 "" "")))]
3395   ""
3396   "br $31,%l0"
3397   [(set_attr "type" "ibr")])
3398
3399 (define_insn "return"
3400   [(return)]
3401   "direct_return ()"
3402   "ret $31,($26),1"
3403   [(set_attr "type" "ibr")])
3404
3405 (define_insn "indirect_jump"
3406   [(set (pc) (match_operand:DI 0 "register_operand" "r"))]
3407   ""
3408   "jmp $31,(%0),0"
3409   [(set_attr "type" "ibr")])
3410
3411 (define_insn "nop"
3412   [(const_int 0)]
3413   ""
3414   "bis $31,$31,$31"
3415   [(set_attr "type" "ilog")])
3416
3417 (define_expand "tablejump"
3418   [(use (match_operand:SI 0 "register_operand" ""))
3419    (use (match_operand:SI 1 "" ""))]
3420   ""
3421   "
3422 {
3423   if (TARGET_WINDOWS_NT)
3424     emit_jump_insn (gen_tablejump_nt (operands[0], operands[1]));
3425   else if (TARGET_OPEN_VMS)
3426     emit_jump_insn (gen_tablejump_vms (operands[0], operands[1]));
3427   else
3428     emit_jump_insn (gen_tablejump_osf (operands[0], operands[1]));
3429
3430   DONE;
3431 }")
3432
3433 (define_expand "tablejump_osf"
3434   [(set (match_dup 3)
3435         (sign_extend:DI (match_operand:SI 0 "register_operand" "")))
3436    (parallel [(set (pc)
3437                    (plus:DI (match_dup 3)
3438                             (label_ref:DI (match_operand 1 "" ""))))
3439               (clobber (match_scratch:DI 2 "=r"))])]
3440   ""
3441   "
3442 { operands[3] = gen_reg_rtx (DImode); }")
3443
3444 (define_expand "tablejump_nt"
3445   [(set (match_dup 3)
3446         (sign_extend:DI (match_operand:SI 0 "register_operand" "")))
3447    (parallel [(set (pc)
3448                    (match_dup 3))
3449               (use (label_ref (match_operand 1 "" "")))])]
3450   ""
3451   "
3452 { operands[3] = gen_reg_rtx (DImode); }")
3453
3454 ;;
3455 ;; tablejump, openVMS way
3456 ;; op 0: offset
3457 ;; op 1: label preceding jump-table
3458 ;;
3459 (define_expand "tablejump_vms"
3460   [(set (match_dup 2)
3461       (match_operand:DI 0 "register_operand" ""))
3462         (set (pc)
3463         (plus:DI (match_dup 2)
3464                 (label_ref:DI (match_operand 1 "" ""))))]
3465   ""
3466   "
3467 { operands[2] = gen_reg_rtx (DImode); }")
3468
3469 (define_insn ""
3470   [(set (pc)
3471         (plus:DI (match_operand:DI 0 "register_operand" "r")
3472                  (label_ref:DI (match_operand 1 "" ""))))
3473    (clobber (match_scratch:DI 2 "=r"))]
3474   "! TARGET_WINDOWS_NT && ! TARGET_OPEN_VMS && next_active_insn (insn) != 0
3475    && GET_CODE (PATTERN (next_active_insn (insn))) == ADDR_DIFF_VEC
3476    && PREV_INSN (next_active_insn (insn)) == operands[1]"
3477   "*
3478 { rtx best_label = 0;
3479   rtx jump_table_insn = next_active_insn (operands[1]);
3480
3481   if (GET_CODE (jump_table_insn) == JUMP_INSN
3482       && GET_CODE (PATTERN (jump_table_insn)) == ADDR_DIFF_VEC)
3483     {
3484       rtx jump_table = PATTERN (jump_table_insn);
3485       int n_labels = XVECLEN (jump_table, 1);
3486       int best_count = -1;
3487       int i, j;
3488
3489       for (i = 0; i < n_labels; i++)
3490         {
3491           int count = 1;
3492
3493           for (j = i + 1; j < n_labels; j++)
3494             if (XEXP (XVECEXP (jump_table, 1, i), 0)
3495                 == XEXP (XVECEXP (jump_table, 1, j), 0))
3496               count++;
3497
3498           if (count > best_count)
3499             best_count = count, best_label = XVECEXP (jump_table, 1, i);
3500         }
3501     }
3502
3503   if (best_label)
3504     {
3505       operands[3] = best_label;
3506       return \"addq %0,$29,%2\;jmp $31,(%2),%3\";
3507     }
3508   else
3509     return \"addq %0,$29,%2\;jmp $31,(%2),0\";
3510 }"
3511   [(set_attr "type" "ibr")])
3512
3513 (define_insn ""
3514   [(set (pc)
3515         (match_operand:DI 0 "register_operand" "r"))
3516    (use (label_ref (match_operand 1 "" "")))]
3517   "TARGET_WINDOWS_NT && next_active_insn (insn) != 0
3518    && GET_CODE (PATTERN (next_active_insn (insn))) == ADDR_DIFF_VEC
3519    && PREV_INSN (next_active_insn (insn)) == operands[1]"
3520   "*
3521 { rtx best_label = 0;
3522   rtx jump_table_insn = next_active_insn (operands[1]);
3523
3524   if (GET_CODE (jump_table_insn) == JUMP_INSN
3525       && GET_CODE (PATTERN (jump_table_insn)) == ADDR_DIFF_VEC)
3526     {
3527       rtx jump_table = PATTERN (jump_table_insn);
3528       int n_labels = XVECLEN (jump_table, 1);
3529       int best_count = -1;
3530       int i, j;
3531
3532       for (i = 0; i < n_labels; i++)
3533         {
3534           int count = 1;
3535
3536           for (j = i + 1; j < n_labels; j++)
3537             if (XEXP (XVECEXP (jump_table, 1, i), 0)
3538                 == XEXP (XVECEXP (jump_table, 1, j), 0))
3539               count++;
3540
3541           if (count > best_count)
3542             best_count = count, best_label = XVECEXP (jump_table, 1, i);
3543         }
3544     }
3545
3546   if (best_label)
3547     {
3548       operands[2] = best_label;
3549       return \"jmp $31,(%0),%2\";
3550     }
3551   else
3552     return \"jmp $31,(%0),0\";
3553 }"
3554   [(set_attr "type" "ibr")])
3555
3556 ;;
3557 ;; op 0 is table offset
3558 ;; op 1 is table label
3559 ;;
3560
3561 (define_insn ""
3562   [(set (pc)
3563         (plus:DI (match_operand 0 "register_operand" "r")
3564                 (label_ref (match_operand 1 "" ""))))]
3565   "TARGET_OPEN_VMS"
3566   "jmp $31,(%0),0"
3567   [(set_attr "type" "ibr")])
3568
3569 ;; Cache flush.  Used by INITIALIZE_TRAMPOLINE.  0x86 is PAL_imb, but we don't
3570 ;; want to have to include pal.h in our .s file.
3571 ;;
3572 ;; Technically the type for call_pal is jsr, but we use that for determining
3573 ;; if we need a GP.  Use ibr instead since it has the same scheduling 
3574 ;; characteristics.
3575 (define_insn ""
3576   [(unspec_volatile [(const_int 0)] 0)]
3577   ""
3578   "call_pal 0x86"
3579   [(set_attr "type" "ibr")])
3580 \f
3581 ;; Finally, we have the basic data motion insns.  The byte and word insns
3582 ;; are done via define_expand.  Start with the floating-point insns, since
3583 ;; they are simpler.
3584
3585 (define_insn ""
3586   [(set (match_operand:SF 0 "nonimmediate_operand" "=r,r,m,f,f,f,m")
3587         (match_operand:SF 1 "input_operand" "rG,m,rG,f,G,m,fG"))]
3588   "register_operand (operands[0], SFmode)
3589    || reg_or_fp0_operand (operands[1], SFmode)"
3590   "@
3591    bis %r1,%r1,%0
3592    ldl %0,%1
3593    stl %r1,%0
3594    cpys %1,%1,%0
3595    cpys $f31,$f31,%0
3596    ld%, %0,%1
3597    st%, %R1,%0"
3598   [(set_attr "type" "ilog,ld,st,fcpys,fcpys,ld,st")])
3599
3600 (define_insn ""
3601   [(set (match_operand:DF 0 "nonimmediate_operand" "=r,r,m,f,f,f,m")
3602         (match_operand:DF 1 "input_operand" "rG,m,rG,f,G,m,fG"))]
3603   "register_operand (operands[0], DFmode)
3604    || reg_or_fp0_operand (operands[1], DFmode)"
3605   "@
3606    bis %r1,%r1,%0
3607    ldq %0,%1
3608    stq %r1,%0
3609    cpys %1,%1,%0
3610    cpys $f31,$f31,%0
3611    ld%- %0,%1
3612    st%- %R1,%0"
3613   [(set_attr "type" "ilog,ld,st,fcpys,fcpys,ld,st")])
3614
3615 (define_expand "movsf"
3616   [(set (match_operand:SF 0 "nonimmediate_operand" "")
3617         (match_operand:SF 1 "general_operand" ""))]
3618   ""
3619   "
3620 {
3621   if (GET_CODE (operands[0]) == MEM
3622       && ! reg_or_fp0_operand (operands[1], SFmode))
3623     operands[1] = force_reg (SFmode, operands[1]);
3624 }")
3625
3626 (define_expand "movdf"
3627   [(set (match_operand:DF 0 "nonimmediate_operand" "")
3628         (match_operand:DF 1 "general_operand" ""))]
3629   ""
3630   "
3631 {
3632   if (GET_CODE (operands[0]) == MEM
3633       && ! reg_or_fp0_operand (operands[1], DFmode))
3634     operands[1] = force_reg (DFmode, operands[1]);
3635 }")
3636
3637 (define_insn ""
3638   [(set (match_operand:SI 0 "nonimmediate_operand" "=r,r,r,r,r,r,m,f,f,f,m")
3639         (match_operand:SI 1 "input_operand" "r,J,I,K,L,m,rJ,f,J,m,fG"))]
3640   "! TARGET_WINDOWS_NT && ! TARGET_OPEN_VMS
3641    && (register_operand (operands[0], SImode)
3642        || reg_or_0_operand (operands[1], SImode))"
3643   "@
3644    bis %1,%1,%0
3645    bis $31,$31,%0
3646    bis $31,%1,%0
3647    lda %0,%1
3648    ldah %0,%h1
3649    ldl %0,%1
3650    stl %r1,%0
3651    cpys %1,%1,%0
3652    cpys $f31,$f31,%0
3653    lds %0,%1
3654    sts %R1,%0"
3655   [(set_attr "type" "ilog,ilog,ilog,iadd,iadd,ld,st,fcpys,fcpys,ld,st")])
3656
3657 (define_insn ""
3658   [(set (match_operand:SI 0 "nonimmediate_operand" "=r,r,r,r,r,r,r,m,f,f,f,m")
3659         (match_operand:SI 1 "input_operand" "r,J,I,K,L,s,m,rJ,f,J,m,fG"))]
3660   "(TARGET_WINDOWS_NT || TARGET_OPEN_VMS)
3661         && (register_operand (operands[0], SImode)
3662                          || reg_or_0_operand (operands[1], SImode))"
3663   "@
3664    bis %1,%1,%0
3665    bis $31,$31,%0
3666    bis $31,%1,%0
3667    lda %0,%1
3668    ldah %0,%h1
3669    lda %0,%1
3670    ldl %0,%1
3671    stl %r1,%0
3672    cpys %1,%1,%0
3673    cpys $f31,$f31,%0
3674    lds %0,%1
3675    sts %R1,%0"
3676   [(set_attr "type" "ilog,ilog,ilog,iadd,iadd,ldsym,ld,st,fcpys,fcpys,ld,st")])
3677
3678 (define_insn ""
3679   [(set (match_operand:HI 0 "nonimmediate_operand" "=r,r,r,r,f,f")
3680         (match_operand:HI 1 "input_operand" "r,J,I,n,f,J"))]
3681   "! TARGET_BYTE_OPS
3682    && (register_operand (operands[0], HImode)
3683        || register_operand (operands[1], HImode))"
3684   "@
3685    bis %1,%1,%0
3686    bis $31,$31,%0
3687    bis $31,%1,%0
3688    lda %0,%L1
3689    cpys %1,%1,%0
3690    cpys $f31,$f31,%0"
3691   [(set_attr "type" "ilog,ilog,ilog,iadd,fcpys,fcpys")])
3692
3693 (define_insn ""
3694   [(set (match_operand:HI 0 "nonimmediate_operand" "=r,r,r,r,r,m,f,f")
3695         (match_operand:HI 1 "input_operand" "r,J,I,n,m,rJ,f,J"))]
3696   "TARGET_BYTE_OPS
3697    && (register_operand (operands[0], HImode)
3698        || reg_or_0_operand (operands[1], HImode))"
3699   "@
3700    bis %1,%1,%0
3701    bis $31,$31,%0
3702    bis $31,%1,%0
3703    lda %0,%L1
3704    ldwu %0,%1
3705    stw %r1,%0
3706    cpys %1,%1,%0
3707    cpys $f31,$f31,%0"
3708   [(set_attr "type" "ilog,ilog,ilog,iadd,ld,st,fcpys,fcpys")])
3709
3710 (define_insn ""
3711   [(set (match_operand:QI 0 "nonimmediate_operand" "=r,r,r,r,f,f")
3712         (match_operand:QI 1 "input_operand" "r,J,I,n,f,J"))]
3713   "! TARGET_BYTE_OPS
3714    && (register_operand (operands[0], QImode)
3715        || register_operand (operands[1], QImode))"
3716   "@
3717    bis %1,%1,%0
3718    bis $31,$31,%0
3719    bis $31,%1,%0
3720    lda %0,%L1
3721    cpys %1,%1,%0
3722    cpys $f31,$f31,%0"
3723   [(set_attr "type" "ilog,ilog,ilog,iadd,fcpys,fcpys")])
3724
3725 (define_insn ""
3726   [(set (match_operand:QI 0 "nonimmediate_operand" "=r,r,r,r,r,m,f,f")
3727         (match_operand:QI 1 "input_operand" "r,J,I,n,m,rJ,f,J"))]
3728   "TARGET_BYTE_OPS
3729    && (register_operand (operands[0], QImode)
3730        || reg_or_0_operand (operands[1], QImode))"
3731   "@
3732    bis %1,%1,%0
3733    bis $31,$31,%0
3734    bis $31,%1,%0
3735    lda %0,%L1
3736    ldbu %0,%1
3737    stb %r1,%0
3738    cpys %1,%1,%0
3739    cpys $f31,$f31,%0"
3740   [(set_attr "type" "ilog,ilog,ilog,iadd,ld,st,fcpys,fcpys")])
3741
3742 ;; We do two major things here: handle mem->mem and construct long
3743 ;; constants.
3744
3745 (define_expand "movsi"
3746   [(set (match_operand:SI 0 "general_operand" "")
3747         (match_operand:SI 1 "general_operand" ""))]
3748   ""
3749   "
3750 {
3751   if (GET_CODE (operands[0]) == MEM
3752       && ! reg_or_0_operand (operands[1], SImode))
3753     operands[1] = force_reg (SImode, operands[1]);
3754
3755   if (! CONSTANT_P (operands[1]) || input_operand (operands[1], SImode))
3756     ;
3757   else if (GET_CODE (operands[1]) == CONST_INT)
3758     {
3759       operands[1]
3760         = alpha_emit_set_const (operands[0], SImode, INTVAL (operands[1]), 3);
3761       if (rtx_equal_p (operands[0], operands[1]))
3762         DONE;
3763     }
3764 }")
3765
3766 ;; Split a load of a large constant into the appropriate two-insn
3767 ;; sequence.
3768
3769 (define_split
3770   [(set (match_operand:SI 0 "register_operand" "")
3771         (match_operand:SI 1 "const_int_operand" ""))]
3772   "! add_operand (operands[1], SImode)"
3773   [(set (match_dup 0) (match_dup 2))
3774    (set (match_dup 0) (plus:SI (match_dup 0) (match_dup 3)))]
3775   "
3776 { rtx tem
3777     = alpha_emit_set_const (operands[0], SImode, INTVAL (operands[1]), 2);
3778
3779   if (tem == operands[0])
3780     DONE;
3781   else
3782     FAIL;
3783 }")
3784
3785 (define_insn ""
3786   [(set (match_operand:DI 0 "general_operand" "=r,r,r,r,r,r,r,m,f,f,f,Q")
3787         (match_operand:DI 1 "input_operand" "r,J,I,K,L,s,m,rJ,f,J,Q,fG"))]
3788   "register_operand (operands[0], DImode)
3789    || reg_or_0_operand (operands[1], DImode)"
3790   "@
3791    bis %1,%1,%0
3792    bis $31,$31,%0
3793    bis $31,%1,%0
3794    lda %0,%1
3795    ldah %0,%h1
3796    lda %0,%1
3797    ldq%A1 %0,%1
3798    stq%A0 %r1,%0
3799    cpys %1,%1,%0
3800    cpys $f31,$f31,%0
3801    ldt %0,%1
3802    stt %R1,%0"
3803   [(set_attr "type" "ilog,ilog,ilog,iadd,iadd,ldsym,ld,st,fcpys,fcpys,ld,st")])
3804
3805 ;; We do three major things here: handle mem->mem, put 64-bit constants in
3806 ;; memory, and construct long 32-bit constants.
3807
3808 (define_expand "movdi"
3809   [(set (match_operand:DI 0 "general_operand" "")
3810         (match_operand:DI 1 "general_operand" ""))]
3811   ""
3812   "
3813 {
3814   rtx tem;
3815
3816   if (GET_CODE (operands[0]) == MEM
3817       && ! reg_or_0_operand (operands[1], DImode))
3818     operands[1] = force_reg (DImode, operands[1]);
3819
3820   if (! CONSTANT_P (operands[1]) || input_operand (operands[1], DImode))
3821     ;
3822   else if (GET_CODE (operands[1]) == CONST_INT
3823            && (tem = alpha_emit_set_const (operands[0], DImode,
3824                                            INTVAL (operands[1]), 3)) != 0)
3825     {
3826       if (rtx_equal_p (tem, operands[0]))
3827         DONE;
3828       else
3829         operands[1] = tem;
3830     }
3831   else if (CONSTANT_P (operands[1]))
3832     {
3833       if (TARGET_BUILD_CONSTANTS)
3834         {
3835 #if HOST_BITS_PER_WIDE_INT == 64
3836           HOST_WIDE_INT i;
3837
3838           if (GET_CODE (operands[1]) == CONST_INT)
3839             i = INTVAL (operands[1]);
3840           else if (GET_CODE (operands[1]) == CONST_DOUBLE)
3841             i = CONST_DOUBLE_LOW (operands[1]);
3842           else
3843             abort();
3844           
3845           tem = alpha_emit_set_long_const (operands[0], i);
3846           if (rtx_equal_p (tem, operands[0]))
3847             DONE;
3848           else
3849             operands[1] = tem;
3850 #else
3851           abort();
3852 #endif
3853         }
3854       else
3855         {
3856           operands[1] = force_const_mem (DImode, operands[1]);
3857           if (reload_in_progress)
3858             {
3859               emit_move_insn (operands[0], XEXP (operands[1], 0));
3860               operands[1] = copy_rtx (operands[1]);
3861               XEXP (operands[1], 0) = operands[0];
3862             }
3863           else
3864             operands[1] = validize_mem (operands[1]);
3865         }
3866     }
3867   else
3868     abort ();
3869 }")
3870
3871 ;; Split a load of a large constant into the appropriate two-insn
3872 ;; sequence.
3873
3874 (define_split
3875   [(set (match_operand:DI 0 "register_operand" "")
3876         (match_operand:DI 1 "const_int_operand" ""))]
3877   "! add_operand (operands[1], DImode)"
3878   [(set (match_dup 0) (match_dup 2))
3879    (set (match_dup 0) (plus:DI (match_dup 0) (match_dup 3)))]
3880   "
3881 { rtx tem
3882     = alpha_emit_set_const (operands[0], DImode, INTVAL (operands[1]), 2);
3883
3884   if (tem == operands[0])
3885     DONE;
3886   else
3887     FAIL;
3888 }")
3889
3890 ;; These are the partial-word cases.
3891 ;;
3892 ;; First we have the code to load an aligned word.  Operand 0 is the register
3893 ;; in which to place the result.  It's mode is QImode or HImode.  Operand 1
3894 ;; is an SImode MEM at the low-order byte of the proper word.  Operand 2 is the
3895 ;; number of bits within the word that the value is.  Operand 3 is an SImode
3896 ;; scratch register.  If operand 0 is a hard register, operand 3 may be the
3897 ;; same register.  It is allowed to conflict with operand 1 as well.
3898
3899 (define_expand "aligned_loadqi"
3900   [(set (match_operand:SI 3 "register_operand" "")
3901         (match_operand:SI 1 "memory_operand" ""))
3902    (set (subreg:DI (match_operand:QI 0 "register_operand" "") 0)
3903         (zero_extract:DI (subreg:DI (match_dup 3) 0)
3904                          (const_int 8)
3905                          (match_operand:DI 2 "const_int_operand" "")))]
3906          
3907   ""
3908   "")
3909   
3910 (define_expand "aligned_loadhi"
3911   [(set (match_operand:SI 3 "register_operand" "")
3912         (match_operand:SI 1 "memory_operand" ""))
3913    (set (subreg:DI (match_operand:HI 0 "register_operand" "") 0)
3914         (zero_extract:DI (subreg:DI (match_dup 3) 0)
3915                          (const_int 16)
3916                          (match_operand:DI 2 "const_int_operand" "")))]
3917          
3918   ""
3919   "")
3920   
3921 ;; Similar for unaligned loads, where we use the sequence from the
3922 ;; Alpha Architecture manual.
3923 ;;
3924 ;; Operand 1 is the address.  Operands 2 and 3 are temporaries, where
3925 ;; operand 3 can overlap the input and output registers.
3926
3927 (define_expand "unaligned_loadqi"
3928   [(set (match_operand:DI 2 "register_operand" "")
3929         (mem:DI (and:DI (match_operand:DI 1 "address_operand" "")
3930                         (const_int -8))))
3931    (set (match_operand:DI 3 "register_operand" "")
3932         (match_dup 1))
3933    (set (subreg:DI (match_operand:QI 0 "register_operand" "") 0)
3934         (zero_extract:DI (match_dup 2)
3935                          (const_int 8)
3936                          (ashift:DI (match_dup 3) (const_int 3))))]
3937   ""
3938   "")
3939
3940 (define_expand "unaligned_loadhi"
3941   [(set (match_operand:DI 2 "register_operand" "")
3942         (mem:DI (and:DI (match_operand:DI 1 "address_operand" "")
3943                         (const_int -8))))
3944    (set (match_operand:DI 3 "register_operand" "")
3945         (match_dup 1))
3946    (set (subreg:DI (match_operand:QI 0 "register_operand" "") 0)
3947         (zero_extract:DI (match_dup 2)
3948                          (const_int 16)
3949                          (ashift:DI (match_dup 3) (const_int 3))))]
3950   ""
3951   "")
3952
3953 ;; Storing an aligned byte or word requires two temporaries.  Operand 0 is the
3954 ;; aligned SImode MEM.  Operand 1 is the register containing the 
3955 ;; byte or word to store.  Operand 2 is the number of bits within the word that
3956 ;; the value should be placed.  Operands 3 and 4 are SImode temporaries.
3957
3958 (define_expand "aligned_store"
3959   [(set (match_operand:SI 3 "register_operand" "")
3960         (match_operand:SI 0 "memory_operand" ""))
3961    (set (subreg:DI (match_dup 3) 0)
3962         (and:DI (subreg:DI (match_dup 3) 0) (match_dup 5)))
3963    (set (subreg:DI (match_operand:SI 4 "register_operand" "") 0)
3964         (ashift:DI (zero_extend:DI (match_operand 1 "register_operand" ""))
3965                    (match_operand:DI 2 "const_int_operand" "")))
3966    (set (subreg:DI (match_dup 4) 0)
3967         (ior:DI (subreg:DI (match_dup 4) 0) (subreg:DI (match_dup 3) 0)))
3968    (set (match_dup 0) (match_dup 4))]
3969   ""
3970   "
3971 { operands[5] = GEN_INT (~ (GET_MODE_MASK (GET_MODE (operands[1]))
3972                             << INTVAL (operands[2])));
3973 }")
3974
3975 ;; For the unaligned byte and halfword cases, we use code similar to that
3976 ;; in the ;; Architecture book, but reordered to lower the number of registers
3977 ;; required.  Operand 0 is the address.  Operand 1 is the data to store.
3978 ;; Operands 2, 3, and 4 are DImode temporaries, where operands 2 and 4 may
3979 ;; be the same temporary, if desired.  If the address is in a register,
3980 ;; operand 2 can be that register.
3981
3982 (define_expand "unaligned_storeqi"
3983   [(set (match_operand:DI 3 "register_operand" "")
3984         (mem:DI (and:DI (match_operand:DI 0 "address_operand" "")
3985                         (const_int -8))))
3986    (set (match_operand:DI 2 "register_operand" "")
3987         (match_dup 0))
3988    (set (match_dup 3)
3989         (and:DI (not:DI (ashift:DI (const_int 255)
3990                                    (ashift:DI (match_dup 2) (const_int 3))))
3991                 (match_dup 3)))
3992    (set (match_operand:DI 4 "register_operand" "")
3993         (ashift:DI (zero_extend:DI (match_operand:QI 1 "register_operand" ""))
3994                    (ashift:DI (match_dup 2) (const_int 3))))
3995    (set (match_dup 4) (ior:DI (match_dup 4) (match_dup 3)))
3996    (set (mem:DI (and:DI (match_dup 0) (const_int -8)))
3997         (match_dup 4))]
3998   ""
3999   "")
4000
4001 (define_expand "unaligned_storehi"
4002   [(set (match_operand:DI 3 "register_operand" "")
4003         (mem:DI (and:DI (match_operand:DI 0 "address_operand" "")
4004                         (const_int -8))))
4005    (set (match_operand:DI 2 "register_operand" "")
4006         (match_dup 0))
4007    (set (match_dup 3)
4008         (and:DI (not:DI (ashift:DI (const_int 65535)
4009                                    (ashift:DI (match_dup 2) (const_int 3))))
4010                 (match_dup 3)))
4011    (set (match_operand:DI 4 "register_operand" "")
4012         (ashift:DI (zero_extend:DI (match_operand:HI 1 "register_operand" ""))
4013                    (ashift:DI (match_dup 2) (const_int 3))))
4014    (set (match_dup 4) (ior:DI (match_dup 4) (match_dup 3)))
4015    (set (mem:DI (and:DI (match_dup 0) (const_int -8)))
4016         (match_dup 4))]
4017   ""
4018   "")
4019 \f
4020 ;; Here are the define_expand's for QI and HI moves that use the above
4021 ;; patterns.  We have the normal sets, plus the ones that need scratch
4022 ;; registers for reload.
4023
4024 (define_expand "movqi"
4025   [(set (match_operand:QI 0 "general_operand" "")
4026         (match_operand:QI 1 "general_operand" ""))]
4027   ""
4028   "
4029 { extern rtx get_unaligned_address ();
4030
4031   if (TARGET_BYTE_OPS)
4032     {
4033       if (GET_CODE (operands[0]) == MEM
4034           && ! reg_or_0_operand (operands[1], QImode))
4035         operands[1] = force_reg (QImode, operands[1]);
4036
4037       if (GET_CODE (operands[1]) == CONST_INT
4038                && ! input_operand (operands[1], QImode))
4039         {
4040           operands[1] = alpha_emit_set_const (operands[0], QImode,
4041                                               INTVAL (operands[1]), 3);
4042
4043           if (rtx_equal_p (operands[0], operands[1]))
4044             DONE;
4045         }
4046
4047       goto def;
4048     }
4049
4050   /* If the output is not a register, the input must be.  */
4051   if (GET_CODE (operands[0]) == MEM)
4052     operands[1] = force_reg (QImode, operands[1]);
4053
4054   /* Handle four memory cases, unaligned and aligned for either the input
4055      or the output.  The only case where we can be called during reload is
4056      for aligned loads; all other cases require temporaries.  */
4057
4058   if (GET_CODE (operands[1]) == MEM
4059       || (GET_CODE (operands[1]) == SUBREG
4060           && GET_CODE (SUBREG_REG (operands[1])) == MEM)
4061       || (reload_in_progress && GET_CODE (operands[1]) == REG
4062           && REGNO (operands[1]) >= FIRST_PSEUDO_REGISTER)
4063       || (reload_in_progress && GET_CODE (operands[1]) == SUBREG
4064           && GET_CODE (SUBREG_REG (operands[1])) == REG
4065           && REGNO (SUBREG_REG (operands[1])) >= FIRST_PSEUDO_REGISTER))
4066     {
4067       if (aligned_memory_operand (operands[1], QImode))
4068         {
4069           rtx aligned_mem, bitnum;
4070           rtx scratch = (reload_in_progress
4071                          ? gen_rtx (REG, SImode, REGNO (operands[0]))
4072                          : gen_reg_rtx (SImode));
4073
4074           get_aligned_mem (operands[1], &aligned_mem, &bitnum);
4075
4076           emit_insn (gen_aligned_loadqi (operands[0], aligned_mem, bitnum,
4077                                          scratch));
4078         }
4079       else
4080         {
4081           /* Don't pass these as parameters since that makes the generated
4082              code depend on parameter evaluation order which will cause
4083              bootstrap failures.  */
4084
4085           rtx temp1 = gen_reg_rtx (DImode);
4086           rtx temp2 = gen_reg_rtx (DImode);
4087           rtx seq
4088             = gen_unaligned_loadqi (operands[0],
4089                                     get_unaligned_address (operands[1], 0),
4090                                     temp1, temp2);
4091
4092           alpha_set_memflags (seq, operands[1]);
4093           emit_insn (seq);
4094         }
4095
4096       DONE;
4097     }
4098
4099   else if (GET_CODE (operands[0]) == MEM
4100            || (GET_CODE (operands[0]) == SUBREG 
4101                && GET_CODE (SUBREG_REG (operands[0])) == MEM)
4102            || (reload_in_progress && GET_CODE (operands[0]) == REG
4103                && REGNO (operands[0]) >= FIRST_PSEUDO_REGISTER)
4104            || (reload_in_progress && GET_CODE (operands[0]) == SUBREG
4105                && GET_CODE (SUBREG_REG (operands[0])) == REG
4106                && REGNO (operands[0]) >= FIRST_PSEUDO_REGISTER))
4107     {
4108       if (aligned_memory_operand (operands[0], QImode))
4109         {
4110           rtx aligned_mem, bitnum;
4111           rtx temp1 = gen_reg_rtx (SImode);
4112           rtx temp2 = gen_reg_rtx (SImode);
4113
4114           get_aligned_mem (operands[0], &aligned_mem, &bitnum);
4115
4116           emit_insn (gen_aligned_store (aligned_mem, operands[1], bitnum,
4117                                         temp1, temp2));
4118         }
4119       else
4120         {
4121           rtx temp1 = gen_reg_rtx (DImode);
4122           rtx temp2 = gen_reg_rtx (DImode);
4123           rtx temp3 = gen_reg_rtx (DImode);
4124           rtx seq
4125             = gen_unaligned_storeqi (get_unaligned_address (operands[0], 0),
4126                                            operands[1], temp1, temp2, temp3);
4127
4128           alpha_set_memflags (seq, operands[0]);
4129           emit_insn (seq);
4130         }
4131       DONE;
4132     }
4133  def:;
4134 }")
4135
4136 (define_expand "movhi"
4137   [(set (match_operand:HI 0 "general_operand" "")
4138         (match_operand:HI 1 "general_operand" ""))]
4139   ""
4140   "
4141 { extern rtx get_unaligned_address ();
4142
4143   if (TARGET_BYTE_OPS)
4144     {
4145       if (GET_CODE (operands[0]) == MEM
4146           && ! reg_or_0_operand (operands[1], HImode))
4147         operands[1] = force_reg (HImode, operands[1]);
4148
4149       if (GET_CODE (operands[1]) == CONST_INT
4150                && ! input_operand (operands[1], HImode))
4151         {
4152           operands[1] = alpha_emit_set_const (operands[0], HImode,
4153                                               INTVAL (operands[1]), 3);
4154
4155           if (rtx_equal_p (operands[0], operands[1]))
4156             DONE;
4157         }
4158
4159       goto def;
4160     }
4161
4162   /* If the output is not a register, the input must be.  */
4163   if (GET_CODE (operands[0]) == MEM)
4164     operands[1] = force_reg (HImode, operands[1]);
4165
4166   /* Handle four memory cases, unaligned and aligned for either the input
4167      or the output.  The only case where we can be called during reload is
4168      for aligned loads; all other cases require temporaries.  */
4169
4170   if (GET_CODE (operands[1]) == MEM
4171       || (GET_CODE (operands[1]) == SUBREG
4172           && GET_CODE (SUBREG_REG (operands[1])) == MEM)
4173       || (reload_in_progress && GET_CODE (operands[1]) == REG
4174           && REGNO (operands[1]) >= FIRST_PSEUDO_REGISTER)
4175       || (reload_in_progress && GET_CODE (operands[1]) == SUBREG
4176           && GET_CODE (SUBREG_REG (operands[1])) == REG
4177           && REGNO (SUBREG_REG (operands[1])) >= FIRST_PSEUDO_REGISTER))
4178     {
4179       if (aligned_memory_operand (operands[1], HImode))
4180         {
4181           rtx aligned_mem, bitnum;
4182           rtx scratch = (reload_in_progress
4183                          ? gen_rtx (REG, SImode, REGNO (operands[0]))
4184                          : gen_reg_rtx (SImode));
4185
4186           get_aligned_mem (operands[1], &aligned_mem, &bitnum);
4187
4188           emit_insn (gen_aligned_loadhi (operands[0], aligned_mem, bitnum,
4189                                          scratch));
4190         }
4191       else
4192         {
4193           /* Don't pass these as parameters since that makes the generated
4194              code depend on parameter evaluation order which will cause
4195              bootstrap failures.  */
4196
4197           rtx temp1 = gen_reg_rtx (DImode);
4198           rtx temp2 = gen_reg_rtx (DImode);
4199           rtx seq
4200             = gen_unaligned_loadhi (operands[0],
4201                                     get_unaligned_address (operands[1], 0),
4202                                     temp1, temp2);
4203
4204           alpha_set_memflags (seq, operands[1]);
4205           emit_insn (seq);
4206         }
4207
4208       DONE;
4209     }
4210
4211   else if (GET_CODE (operands[0]) == MEM
4212            || (GET_CODE (operands[0]) == SUBREG 
4213                && GET_CODE (SUBREG_REG (operands[0])) == MEM)
4214            || (reload_in_progress && GET_CODE (operands[0]) == REG
4215                && REGNO (operands[0]) >= FIRST_PSEUDO_REGISTER)
4216            || (reload_in_progress && GET_CODE (operands[0]) == SUBREG
4217                && GET_CODE (SUBREG_REG (operands[0])) == REG
4218                && REGNO (operands[0]) >= FIRST_PSEUDO_REGISTER))
4219     {
4220       if (aligned_memory_operand (operands[0], HImode))
4221         {
4222           rtx aligned_mem, bitnum;
4223           rtx temp1 = gen_reg_rtx (SImode);
4224           rtx temp2 = gen_reg_rtx (SImode);
4225
4226           get_aligned_mem (operands[0], &aligned_mem, &bitnum);
4227
4228           emit_insn (gen_aligned_store (aligned_mem, operands[1], bitnum,
4229                                         temp1, temp2));
4230         }
4231       else
4232         {
4233           rtx temp1 = gen_reg_rtx (DImode);
4234           rtx temp2 = gen_reg_rtx (DImode);
4235           rtx temp3 = gen_reg_rtx (DImode);
4236           rtx seq
4237             = gen_unaligned_storehi (get_unaligned_address (operands[0], 0),
4238                                      operands[1], temp1, temp2, temp3);
4239
4240           alpha_set_memflags (seq, operands[0]);
4241           emit_insn (seq);
4242         }
4243
4244       DONE;
4245     }
4246  def:;
4247 }")
4248
4249 ;; Here are the versions for reload.  Note that in the unaligned cases
4250 ;; we know that the operand must not be a pseudo-register because stack
4251 ;; slots are always aligned references.
4252
4253 (define_expand "reload_inqi"
4254   [(parallel [(match_operand:QI 0 "register_operand" "=r")
4255               (match_operand:QI 1 "unaligned_memory_operand" "m")
4256               (match_operand:TI 2 "register_operand" "=&r")])]
4257   "! TARGET_BYTE_OPS"
4258   "
4259 { extern rtx get_unaligned_address ();
4260   rtx addr = get_unaligned_address (operands[1], 0);
4261   /* It is possible that one of the registers we got for operands[2]
4262      might coincide with that of operands[0] (which is why we made
4263      it TImode).  Pick the other one to use as our scratch.  */
4264   rtx scratch = gen_rtx (REG, DImode,
4265                          REGNO (operands[0]) == REGNO (operands[2]) 
4266                          ? REGNO (operands[2]) + 1 : REGNO (operands[2]));
4267   rtx seq = gen_unaligned_loadqi (operands[0], addr, scratch,
4268                                   gen_rtx (REG, DImode, REGNO (operands[0])));
4269
4270   alpha_set_memflags (seq, operands[1]);
4271   emit_insn (seq);
4272   DONE;
4273 }")
4274
4275 (define_expand "reload_inhi"
4276   [(parallel [(match_operand:HI 0 "register_operand" "=r")
4277               (match_operand:HI 1 "unaligned_memory_operand" "m")
4278               (match_operand:TI 2 "register_operand" "=&r")])]
4279   "! TARGET_BYTE_OPS"
4280   "
4281 { extern rtx get_unaligned_address ();
4282   rtx addr = get_unaligned_address (operands[1], 0);
4283   /* It is possible that one of the registers we got for operands[2]
4284      might coincide with that of operands[0] (which is why we made
4285      it TImode).  Pick the other one to use as our scratch.  */
4286   rtx scratch = gen_rtx (REG, DImode,
4287                          REGNO (operands[0]) == REGNO (operands[2]) 
4288                          ? REGNO (operands[2]) + 1 : REGNO (operands[2]));
4289   rtx seq = gen_unaligned_loadhi (operands[0], addr, scratch,
4290                                   gen_rtx (REG, DImode, REGNO (operands[0])));
4291
4292   alpha_set_memflags (seq, operands[1]);
4293   emit_insn (seq);
4294   DONE;
4295 }")
4296
4297 (define_expand "reload_outqi"
4298   [(parallel [(match_operand:QI 0 "any_memory_operand" "=m")
4299               (match_operand:QI 1 "register_operand" "r")
4300               (match_operand:TI 2 "register_operand" "=&r")])]
4301   "! TARGET_BYTE_OPS"
4302   "
4303 { extern rtx get_unaligned_address ();
4304
4305   if (aligned_memory_operand (operands[0], QImode))
4306     {
4307       rtx aligned_mem, bitnum;
4308
4309       get_aligned_mem (operands[0], &aligned_mem, &bitnum);
4310
4311       emit_insn (gen_aligned_store (aligned_mem, operands[1], bitnum,
4312                                     gen_rtx (REG, SImode, REGNO (operands[2])),
4313                                     gen_rtx (REG, SImode,
4314                                              REGNO (operands[2]) + 1)));
4315     }
4316   else
4317     {
4318       rtx addr = get_unaligned_address (operands[0], 0);
4319       rtx scratch1 = gen_rtx (REG, DImode, REGNO (operands[2]));
4320       rtx scratch2 = gen_rtx (REG, DImode, REGNO (operands[2]) + 1);
4321       rtx scratch3 = scratch1;
4322       rtx seq;
4323
4324       if (GET_CODE (addr) == REG)
4325         scratch1 = addr;
4326
4327       seq = gen_unaligned_storeqi (addr, operands[1], scratch1,
4328                                    scratch2, scratch3);
4329       alpha_set_memflags (seq, operands[0]);
4330       emit_insn (seq);
4331     }
4332
4333   DONE;
4334 }")
4335
4336 (define_expand "reload_outhi"
4337   [(parallel [(match_operand:HI 0 "any_memory_operand" "=m")
4338               (match_operand:HI 1 "register_operand" "r")
4339               (match_operand:TI 2 "register_operand" "=&r")])]
4340   "! TARGET_BYTE_OPS"
4341   "
4342 { extern rtx get_unaligned_address ();
4343
4344   if (aligned_memory_operand (operands[0], HImode))
4345     {
4346       rtx aligned_mem, bitnum;
4347
4348       get_aligned_mem (operands[0], &aligned_mem, &bitnum);
4349
4350       emit_insn (gen_aligned_store (aligned_mem, operands[1], bitnum,
4351                                     gen_rtx (REG, SImode, REGNO (operands[2])),
4352                                     gen_rtx (REG, SImode,
4353                                              REGNO (operands[2]) + 1)));
4354     }
4355   else
4356     {
4357       rtx addr = get_unaligned_address (operands[0], 0);
4358       rtx scratch1 = gen_rtx (REG, DImode, REGNO (operands[2]));
4359       rtx scratch2 = gen_rtx (REG, DImode, REGNO (operands[2]) + 1);
4360       rtx scratch3 = scratch1;
4361       rtx seq;
4362
4363       if (GET_CODE (addr) == REG)
4364         scratch1 = addr;
4365
4366       seq = gen_unaligned_storehi (addr, operands[1], scratch1,
4367                                    scratch2, scratch3);
4368       alpha_set_memflags (seq, operands[0]);
4369       emit_insn (seq);
4370     }
4371
4372   DONE;
4373 }")
4374 \f
4375 ;; Subroutine of stack space allocation.  Perform a stack probe.
4376 (define_expand "probe_stack"
4377   [(set (match_dup 1) (match_operand:DI 0 "const_int_operand" ""))]
4378   ""
4379   "
4380 {
4381   operands[1] = gen_rtx (MEM, DImode, plus_constant (stack_pointer_rtx,
4382                                                      INTVAL (operands[0])));
4383   MEM_VOLATILE_P (operands[1]) = 1;
4384
4385   operands[0] = const0_rtx;
4386 }")
4387
4388 ;; This is how we allocate stack space.  If we are allocating a
4389 ;; constant amount of space and we know it is less than 4096
4390 ;; bytes, we need do nothing.
4391 ;;
4392 ;; If it is more than 4096 bytes, we need to probe the stack
4393 ;; periodically. 
4394 (define_expand "allocate_stack"
4395   [(set (reg:DI 30)
4396         (plus:DI (reg:DI 30)
4397                  (match_operand:DI 0 "reg_or_cint_operand" "")))]
4398   ""
4399   "
4400 {
4401   if (GET_CODE (operands[0]) == CONST_INT
4402            && INTVAL (operands[0]) < 32768)
4403     {
4404       if (INTVAL (operands[0]) >= 4096)
4405         {
4406           /* We do this the same way as in the prologue and generate explicit
4407              probes.  Then we update the stack by the constant.  */
4408
4409           int probed = 4096;
4410
4411           emit_insn (gen_probe_stack (GEN_INT (- probed)));
4412           while (probed + 8192 < INTVAL (operands[0]))
4413             emit_insn (gen_probe_stack (GEN_INT (- (probed += 8192))));
4414
4415           if (probed + 4096 < INTVAL (operands[0]))
4416             emit_insn (gen_probe_stack (GEN_INT (- INTVAL(operands[0]))));
4417         }
4418
4419       operands[0] = GEN_INT (- INTVAL (operands[0]));
4420     }
4421   else
4422     {
4423       rtx out_label = 0;
4424       rtx loop_label = gen_label_rtx ();
4425       rtx want = gen_reg_rtx (Pmode);
4426       rtx tmp = gen_reg_rtx (Pmode);
4427       rtx memref;
4428
4429       emit_insn (gen_subdi3 (want, stack_pointer_rtx,
4430                              force_reg (Pmode, operands[0])));
4431       emit_insn (gen_adddi3 (tmp, stack_pointer_rtx, GEN_INT (-4096)));
4432
4433       if (GET_CODE (operands[0]) != CONST_INT)
4434         {
4435           out_label = gen_label_rtx ();
4436           emit_insn (gen_cmpdi (want, tmp));
4437           emit_jump_insn (gen_bgeu (out_label));
4438         }
4439
4440       emit_label (loop_label);
4441       memref = gen_rtx (MEM, DImode, tmp);
4442       MEM_VOLATILE_P (memref) = 1;
4443       emit_move_insn (memref, const0_rtx);
4444       emit_insn (gen_adddi3 (tmp, tmp, GEN_INT(-8192)));
4445       emit_insn (gen_cmpdi (tmp, want));
4446       emit_jump_insn (gen_bgtu (loop_label));
4447       memref = gen_rtx (MEM, DImode, want);
4448       MEM_VOLATILE_P (memref) = 1;
4449       emit_move_insn (memref, const0_rtx);
4450
4451       if (out_label)
4452         emit_label (out_label);
4453
4454       emit_move_insn (stack_pointer_rtx, want);
4455
4456       DONE;
4457     }
4458 }")
4459
4460 (define_insn "exception_receiver"
4461   [(unspec_volatile [(const_int 0)] 2)]
4462   "! TARGET_OPEN_VMS && ! TARGET_WINDOWS_NT"
4463   ".long 0xc3a00000\;ldgp $29,0($29)")
4464
4465 (define_expand "nonlocal_goto_receiver"
4466   [(unspec_volatile [(const_int 0)] 1)
4467    (set (reg:DI 27) (mem:DI (reg:DI 29)))
4468    (unspec_volatile [(const_int 0)] 1)
4469    (use (reg:DI 27))]
4470   "TARGET_OPEN_VMS"
4471   "")
4472
4473 (define_insn "arg_home"
4474   [(unspec [(const_int 0)] 0)
4475    (use (reg:DI 1))
4476    (use (reg:DI 25))
4477    (use (reg:DI 16))
4478    (use (reg:DI 17))
4479    (use (reg:DI 18))
4480    (use (reg:DI 19))
4481    (use (reg:DI 20))
4482    (use (reg:DI 21))
4483    (use (reg:DI 48))
4484    (use (reg:DI 49))
4485    (use (reg:DI 50))
4486    (use (reg:DI 51))
4487    (use (reg:DI 52))
4488    (use (reg:DI 53))
4489    (clobber (mem:BLK (const_int 0)))
4490    (clobber (reg:DI 24))
4491    (clobber (reg:DI 25))
4492    (clobber (reg:DI 0))]
4493   "TARGET_OPEN_VMS"
4494   "lda $0,ots$home_args\;ldq $0,8($0)\;jsr $0,ots$home_args")
4495
4496 ;; Close the trap shadow of preceeding instructions.  This is generated
4497 ;; by alpha_reorg.
4498
4499 (define_insn "trapb"
4500   [(unspec_volatile [(const_int 0)] 3)]
4501   ""
4502   "trapb"
4503   [(set_attr "type" "misc")])