fortran frontend:
[official-gcc.git] / gcc / config / vax / vax.md
blobdd448007452bc4388fed81a61edd2bb539e3d2e4
1 ;; Machine description for GNU compiler, VAX Version
2 ;; Copyright (C) 1987, 1988, 1991, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
3 ;; 2002, 2004, 2005 Free Software Foundation, Inc.
5 ;; This file is part of GCC.
7 ;; GCC 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.
12 ;; GCC is distributed in the hope that it will be useful,
13 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
14 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 ;; GNU General Public License for more details.
17 ;; You should have received a copy of the GNU General Public License
18 ;; along with GCC; see the file COPYING.  If not, write to
19 ;; the Free Software Foundation, 51 Franklin Street, Fifth Floor,
20 ;; Boston, MA 02110-1301, USA.
23 ;;- Instruction patterns.  When multiple patterns apply,
24 ;;- the first one in the file is chosen.
25 ;;-
26 ;;- See file "rtl.def" for documentation on define_insn, match_*, et al.
27 ;;-
28 ;;- cpp macro #define NOTICE_UPDATE_CC in file tm.h handles condition code
29 ;;- updates for most instructions.
31 ;; UNSPEC_VOLATILE usage:
33 (define_constants
34   [(VUNSPEC_BLOCKAGE 0)     ; `blockage' insn to prevent scheduling across an
35                             ; insn in the code.
36    (VUNSPEC_SYNC_ISTREAM 1) ; sequence of insns to sync the I-stream
37    (VAX_AP_REGNUM 12)       ; Register 12 contains the argument pointer
38    (VAX_FP_REGNUM 13)       ; Register 13 contains the frame pointer
39    (VAX_SP_REGNUM 14)       ; Register 14 contains the stack pointer
40    (VAX_PC_REGNUM 15)       ; Register 15 contains the program counter
41   ]
44 ;; Integer modes supported on VAX, with a mapping from machine mode
45 ;; to mnemonic suffix.  DImode is always a special case.
46 (define_mode_macro VAXint [QI HI SI])
47 (define_mode_attr  isfx [(QI "b") (HI "w") (SI "l")])
49 ;; Similar for float modes supported on VAX.
50 (define_mode_macro VAXfp [SF DF])
51 (define_mode_attr  fsfx [(SF "f") (DF "%#")])
53 ;; Some output patterns want integer immediates with a prefix...
54 (define_mode_attr  iprefx [(QI "B") (HI "H") (SI "N")])
56 ;; We don't want to allow a constant operand for test insns because
57 ;; (set (cc0) (const_int foo)) has no mode information.  Such insns will
58 ;; be folded while optimizing anyway.
60 (define_insn "tst<mode>"
61   [(set (cc0)
62         (match_operand:VAXint 0 "nonimmediate_operand" "g"))]
63   ""
64   "tst<VAXint:isfx> %0")
66 (define_insn "tst<mode>"
67   [(set (cc0)
68         (match_operand:VAXfp 0 "general_operand" "gF"))]
69   ""
70   "tst<VAXfp:fsfx> %0")
72 (define_insn "cmp<mode>"
73   [(set (cc0)
74         (compare (match_operand:VAXint 0 "nonimmediate_operand" "g")
75                  (match_operand:VAXint 1 "general_operand" "g")))]
76   ""
77   "cmp<VAXint:isfx> %0,%1")
79 (define_insn "cmp<mode>"
80   [(set (cc0)
81         (compare (match_operand:VAXfp 0 "general_operand" "gF,gF")
82                  (match_operand:VAXfp 1 "general_operand" "G,gF")))]
83   ""
84   "@
85    tst<VAXfp:fsfx> %0
86    cmp<VAXfp:fsfx> %0,%1")
88 (define_insn "*bit<mode>"
89   [(set (cc0)
90         (and:VAXint (match_operand:VAXint 0 "general_operand" "g")
91                    (match_operand:VAXint 1 "general_operand" "g")))]
92   ""
93   "bit<VAXint:isfx> %0,%1")
95 ;; The VAX has no sCOND insns.  It does have add/subtract with carry
96 ;; which could be used to implement the sltu and sgeu patterns.  However,
97 ;; to do this properly requires a complete rewrite of the compare insns
98 ;; to keep them together with the sltu/sgeu insns until after the
99 ;; reload pass is complete.  The previous implementation didn't do this
100 ;; and has been deleted.
103 (define_insn "mov<mode>"
104   [(set (match_operand:VAXfp 0 "nonimmediate_operand" "=g,g")
105         (match_operand:VAXfp 1 "general_operand" "G,gF"))]
106   ""
107   "@
108    clr<VAXfp:fsfx> %0
109    mov<VAXfp:fsfx> %1,%0")
111 ;; Some VAXen don't support this instruction.
112 ;;(define_insn "movti"
113 ;;  [(set (match_operand:TI 0 "general_operand" "=g")
114 ;;      (match_operand:TI 1 "general_operand" "g"))]
115 ;;  ""
116 ;;  "movh %1,%0")
118 (define_insn "movdi"
119   [(set (match_operand:DI 0 "nonimmediate_operand" "=g,g")
120         (match_operand:DI 1 "general_operand" "I,g"))]
121   ""
122   "@
123    clrq %0
124    movq %D1,%0")
126 ;; The VAX move instructions have space-time tradeoffs.  On a MicroVAX
127 ;; register-register mov instructions take 3 bytes and 2 CPU cycles.  clrl
128 ;; takes 2 bytes and 3 cycles.  mov from constant to register takes 2 cycles
129 ;; if the constant is smaller than 4 bytes, 3 cycles for a longword
130 ;; constant.  movz, mneg, and mcom are as fast as mov, so movzwl is faster
131 ;; than movl for positive constants that fit in 16 bits but not 6 bits.  cvt
132 ;; instructions take 4 cycles.  inc takes 3 cycles.  The machine description
133 ;; is willing to trade 1 byte for 1 cycle (clrl instead of movl $0; cvtwl
134 ;; instead of movl).
136 ;; Cycle counts for other models may vary (on a VAX 750 they are similar,
137 ;; but on a VAX 9000 most move and add instructions with one constant
138 ;; operand take 1 cycle).
140 ;;  Loads of constants between 64 and 128 used to be done with
141 ;; "addl3 $63,#,dst" but this is slower than movzbl and takes as much space.
143 (define_insn "mov<mode>"
144   [(set (match_operand:VAXint 0 "nonimmediate_operand" "=g")
145         (match_operand:VAXint 1 "general_operand" "g"))]
146   ""
147   "* return vax_output_int_move (insn, operands, <MODE>mode);")
149 (define_insn "movstricthi"
150   [(set (strict_low_part (match_operand:HI 0 "register_operand" "+g"))
151         (match_operand:HI 1 "general_operand" "g"))]
152   ""
153   "*
155   if (CONST_INT_P (operands[1]))
156     {
157       int i = INTVAL (operands[1]);
158       if (i == 0)
159         return \"clrw %0\";
160       else if ((unsigned int)i < 64)
161         return \"movw %1,%0\";
162       else if ((unsigned int)~i < 64)
163         return \"mcomw %H1,%0\";
164       else if ((unsigned int)i < 256)
165         return \"movzbw %1,%0\";
166     }
167   return \"movw %1,%0\";
170 (define_insn "movstrictqi"
171   [(set (strict_low_part (match_operand:QI 0 "register_operand" "+g"))
172         (match_operand:QI 1 "general_operand" "g"))]
173   ""
174   "*
176   if (CONST_INT_P (operands[1]))
177     {
178       int i = INTVAL (operands[1]);
179       if (i == 0)
180         return \"clrb %0\";
181       else if ((unsigned int)~i < 64)
182         return \"mcomb %B1,%0\";
183     }
184   return \"movb %1,%0\";
187 ;; This is here to accept 4 arguments and pass the first 3 along
188 ;; to the movmemhi1 pattern that really does the work.
189 (define_expand "movmemhi"
190   [(set (match_operand:BLK 0 "general_operand" "=g")
191         (match_operand:BLK 1 "general_operand" "g"))
192    (use (match_operand:HI 2 "general_operand" "g"))
193    (match_operand 3 "" "")]
194   ""
195   "
196   emit_insn (gen_movmemhi1 (operands[0], operands[1], operands[2]));
197   DONE;
200 ;; The definition of this insn does not really explain what it does,
201 ;; but it should suffice
202 ;; that anything generated as this insn will be recognized as one
203 ;; and that it won't successfully combine with anything.
204 (define_insn "movmemhi1"
205   [(set (match_operand:BLK 0 "memory_operand" "=m")
206         (match_operand:BLK 1 "memory_operand" "m"))
207    (use (match_operand:HI 2 "general_operand" "g"))
208    (clobber (reg:SI 0))
209    (clobber (reg:SI 1))
210    (clobber (reg:SI 2))
211    (clobber (reg:SI 3))
212    (clobber (reg:SI 4))
213    (clobber (reg:SI 5))]
214   ""
215   "movc3 %2,%1,%0")
217 ;; Extension and truncation insns.
219 (define_insn "truncsiqi2"
220   [(set (match_operand:QI 0 "nonimmediate_operand" "=g")
221         (truncate:QI (match_operand:SI 1 "nonimmediate_operand" "g")))]
222   ""
223   "cvtlb %1,%0")
225 (define_insn "truncsihi2"
226   [(set (match_operand:HI 0 "nonimmediate_operand" "=g")
227         (truncate:HI (match_operand:SI 1 "nonimmediate_operand" "g")))]
228   ""
229   "cvtlw %1,%0")
231 (define_insn "trunchiqi2"
232   [(set (match_operand:QI 0 "nonimmediate_operand" "=g")
233         (truncate:QI (match_operand:HI 1 "nonimmediate_operand" "g")))]
234   ""
235   "cvtwb %1,%0")
237 (define_insn "extendhisi2"
238   [(set (match_operand:SI 0 "nonimmediate_operand" "=g")
239         (sign_extend:SI (match_operand:HI 1 "nonimmediate_operand" "g")))]
240   ""
241   "cvtwl %1,%0")
243 (define_insn "extendqihi2"
244   [(set (match_operand:HI 0 "nonimmediate_operand" "=g")
245         (sign_extend:HI (match_operand:QI 1 "nonimmediate_operand" "g")))]
246   ""
247   "cvtbw %1,%0")
249 (define_insn "extendqisi2"
250   [(set (match_operand:SI 0 "nonimmediate_operand" "=g")
251         (sign_extend:SI (match_operand:QI 1 "nonimmediate_operand" "g")))]
252   ""
253   "cvtbl %1,%0")
255 (define_insn "extendsfdf2"
256   [(set (match_operand:DF 0 "nonimmediate_operand" "=g")
257         (float_extend:DF (match_operand:SF 1 "general_operand" "gF")))]
258   ""
259   "cvtf%# %1,%0")
261 (define_insn "truncdfsf2"
262   [(set (match_operand:SF 0 "nonimmediate_operand" "=g")
263         (float_truncate:SF (match_operand:DF 1 "general_operand" "gF")))]
264   ""
265   "cvt%#f %1,%0")
267 (define_insn "zero_extendhisi2"
268   [(set (match_operand:SI 0 "nonimmediate_operand" "=g")
269         (zero_extend:SI (match_operand:HI 1 "nonimmediate_operand" "g")))]
270   ""
271   "movzwl %1,%0")
273 (define_insn "zero_extendqihi2"
274   [(set (match_operand:HI 0 "nonimmediate_operand" "=g")
275         (zero_extend:HI (match_operand:QI 1 "nonimmediate_operand" "g")))]
276   ""
277   "movzbw %1,%0")
279 (define_insn "zero_extendqisi2"
280   [(set (match_operand:SI 0 "nonimmediate_operand" "=g")
281         (zero_extend:SI (match_operand:QI 1 "nonimmediate_operand" "g")))]
282   ""
283   "movzbl %1,%0")
285 ;; Fix-to-float conversion insns.
287 (define_insn "float<VAXint:mode><VAXfp:mode>2"
288   [(set (match_operand:VAXfp 0 "nonimmediate_operand" "=g")
289         (float:VAXfp (match_operand:VAXint 1 "nonimmediate_operand" "g")))]
290   ""
291   "cvt<VAXint:isfx><VAXfp:fsfx> %1,%0")
293 ;; Float-to-fix conversion insns.
295 (define_insn "fix_trunc<VAXfp:mode><VAXint:mode>2"
296   [(set (match_operand:VAXint 0 "nonimmediate_operand" "=g")
297         (fix:VAXint (fix:VAXfp (match_operand:VAXfp 1 "general_operand" "gF"))))]
298   ""
299   "cvt<VAXfp:fsfx><VAXint:isfx> %1,%0")
301 ;;- All kinds of add instructions.
303 (define_insn "add<mode>3"
304   [(set (match_operand:VAXfp 0 "nonimmediate_operand" "=g,g,g")
305         (plus:VAXfp (match_operand:VAXfp 1 "general_operand" "0,gF,gF")
306                     (match_operand:VAXfp 2 "general_operand" "gF,0,gF")))]
307   ""
308   "@
309    add<VAXfp:fsfx>2 %2,%0
310    add<VAXfp:fsfx>2 %1,%0
311    add<VAXfp:fsfx>3 %1,%2,%0")
313 (define_insn "add<mode>3"
314   [(set (match_operand:VAXint 0 "nonimmediate_operand" "=g")
315         (plus:VAXint (match_operand:VAXint 1 "general_operand" "g")
316                     (match_operand:VAXint 2 "general_operand" "g")))]
317   ""
318   "* return vax_output_int_add (insn, operands, <MODE>mode);")
320 ;; The add-with-carry (adwc) instruction only accepts two operands.
321 (define_insn "adddi3"
322   [(set (match_operand:DI 0 "nonimmediate_operand" "=ro>,ro>")
323         (plus:DI (match_operand:DI 1 "general_operand" "%0,ro>")
324                  (match_operand:DI 2 "general_operand" "Fro,F")))]
325   ""
326   "*
328   rtx low[3];
329   const char *pattern;
330   int carry = 1;
332   split_quadword_operands (operands, low, 3);
333   /* Add low parts.  */
334   if (rtx_equal_p (operands[0], operands[1]))
335     {
336       if (low[2] == const0_rtx)
337         /* Should examine operand, punt if not POST_INC.  */
338         pattern = \"tstl %0\", carry = 0;
339       else if (low[2] == const1_rtx)
340         pattern = \"incl %0\";
341       else
342         pattern = \"addl2 %2,%0\";
343     }
344   else
345     {
346       if (low[2] == const0_rtx)
347         pattern = \"movl %1,%0\", carry = 0;
348       else
349         pattern = \"addl3 %2,%1,%0\";
350     }
351   if (pattern)
352     output_asm_insn (pattern, low);
353   if (!carry)
354     /* If CARRY is 0, we don't have any carry value to worry about.  */
355     return get_insn_template (CODE_FOR_addsi3, insn);
356   /* %0 = C + %1 + %2 */
357   if (!rtx_equal_p (operands[0], operands[1]))
358     output_asm_insn ((operands[1] == const0_rtx
359                       ? \"clrl %0\"
360                       : \"movl %1,%0\"), operands);
361   return \"adwc %2,%0\";
364 ;;- All kinds of subtract instructions.
366 (define_insn "sub<mode>3"
367   [(set (match_operand:VAXfp 0 "nonimmediate_operand" "=g,g")
368         (minus:VAXfp (match_operand:VAXfp 1 "general_operand" "0,gF")
369                      (match_operand:VAXfp 2 "general_operand" "gF,gF")))]
370   ""
371   "@
372    sub<VAXfp:fsfx>2 %2,%0
373    sub<VAXfp:fsfx>3 %2,%1,%0")
375 (define_insn "sub<mode>3"
376   [(set (match_operand:VAXint 0 "nonimmediate_operand" "=g,g")
377         (minus:VAXint (match_operand:VAXint 1 "general_operand" "0,g")
378                      (match_operand:VAXint 2 "general_operand" "g,g")))]
379   ""
380   "@
381    sub<VAXint:isfx>2 %2,%0
382    sub<VAXint:isfx>3 %2,%1,%0")
384 ;; The subtract-with-carry (sbwc) instruction only takes two operands.
385 (define_insn "subdi3"
386   [(set (match_operand:DI 0 "nonimmediate_operand" "=or>,or>")
387         (minus:DI (match_operand:DI 1 "general_operand" "0,or>")
388                   (match_operand:DI 2 "general_operand" "For,F")))]
389   ""
390   "*
392   rtx low[3];
393   const char *pattern;
394   int carry = 1;
396   split_quadword_operands (operands, low, 3);
397   /* Subtract low parts.  */
398   if (rtx_equal_p (operands[0], operands[1]))
399     {
400       if (low[2] == const0_rtx)
401         pattern = 0, carry = 0;
402       else if (low[2] == constm1_rtx)
403         pattern = \"decl %0\";
404       else
405         pattern = \"subl2 %2,%0\";
406     }
407   else
408     {
409       if (low[2] == constm1_rtx)
410         pattern = \"decl %0\";
411       else if (low[2] == const0_rtx)
412         pattern = get_insn_template (CODE_FOR_movsi, insn), carry = 0;
413       else
414         pattern = \"subl3 %2,%1,%0\";
415     }
416   if (pattern)
417     output_asm_insn (pattern, low);
418   if (carry)
419     {
420       if (!rtx_equal_p (operands[0], operands[1]))
421         return \"movl %1,%0\;sbwc %2,%0\";
422       return \"sbwc %2,%0\";
423       /* %0 = %2 - %1 - C */
424     }
425   return get_insn_template (CODE_FOR_subsi3, insn);
428 ;;- Multiply instructions.
430 (define_insn "mul<mode>3"
431   [(set (match_operand:VAXfp 0 "nonimmediate_operand" "=g,g,g")
432         (mult:VAXfp (match_operand:VAXfp 1 "general_operand" "0,gF,gF")
433                     (match_operand:VAXfp 2 "general_operand" "gF,0,gF")))]
434   ""
435   "@
436    mul<VAXfp:fsfx>2 %2,%0
437    mul<VAXfp:fsfx>2 %1,%0
438    mul<VAXfp:fsfx>3 %1,%2,%0")
440 (define_insn "mul<mode>3"
441   [(set (match_operand:VAXint 0 "nonimmediate_operand" "=g,g,g")
442         (mult:VAXint (match_operand:VAXint 1 "general_operand" "0,g,g")
443                     (match_operand:VAXint 2 "general_operand" "g,0,g")))]
444   ""
445   "@
446    mul<VAXint:isfx>2 %2,%0
447    mul<VAXint:isfx>2 %1,%0
448    mul<VAXint:isfx>3 %1,%2,%0")
450 (define_insn "mulsidi3"
451   [(set (match_operand:DI 0 "nonimmediate_operand" "=g")
452         (mult:DI (sign_extend:DI
453                   (match_operand:SI 1 "nonimmediate_operand" "g"))
454                  (sign_extend:DI
455                   (match_operand:SI 2 "nonimmediate_operand" "g"))))]
456   ""
457   "emul %1,%2,$0,%0")
459 (define_insn ""
460   [(set (match_operand:DI 0 "nonimmediate_operand" "=g")
461         (plus:DI
462          (mult:DI (sign_extend:DI
463                    (match_operand:SI 1 "nonimmediate_operand" "g"))
464                   (sign_extend:DI
465                    (match_operand:SI 2 "nonimmediate_operand" "g")))
466          (sign_extend:DI (match_operand:SI 3 "nonimmediate_operand" "g"))))]
467   ""
468   "emul %1,%2,%3,%0")
470 ;; 'F' constraint means type CONST_DOUBLE
471 (define_insn ""
472   [(set (match_operand:DI 0 "nonimmediate_operand" "=g")
473         (plus:DI
474          (mult:DI (sign_extend:DI
475                    (match_operand:SI 1 "nonimmediate_operand" "g"))
476                   (sign_extend:DI
477                    (match_operand:SI 2 "nonimmediate_operand" "g")))
478          (match_operand:DI 3 "immediate_operand" "F")))]
479   "GET_CODE (operands[3]) == CONST_DOUBLE
480     && CONST_DOUBLE_HIGH (operands[3]) == (CONST_DOUBLE_LOW (operands[3]) >> 31)"
481   "*
483   if (CONST_DOUBLE_HIGH (operands[3]))
484     operands[3] = GEN_INT (CONST_DOUBLE_LOW (operands[3]));
485   return \"emul %1,%2,%3,%0\";
488 ;;- Divide instructions.
490 (define_insn "div<mode>3"
491   [(set (match_operand:VAXfp 0 "nonimmediate_operand" "=g,g")
492         (div:VAXfp (match_operand:VAXfp 1 "general_operand" "0,gF")
493                    (match_operand:VAXfp 2 "general_operand" "gF,gF")))]
494   ""
495   "@
496    div<VAXfp:fsfx>2 %2,%0
497    div<VAXfp:fsfx>3 %2,%1,%0")
499 (define_insn "div<mode>3"
500   [(set (match_operand:VAXint 0 "nonimmediate_operand" "=g,g")
501         (div:VAXint (match_operand:VAXint 1 "general_operand" "0,g")
502                    (match_operand:VAXint 2 "general_operand" "g,g")))]
503   ""
504   "@
505    div<VAXint:isfx>2 %2,%0
506    div<VAXint:isfx>3 %2,%1,%0")
508 ;This is left out because it is very slow;
509 ;we are better off programming around the "lack" of this insn.
510 ;(define_insn "divmoddisi4"
511 ;  [(set (match_operand:SI 0 "general_operand" "=g")
512 ;       (div:SI (match_operand:DI 1 "general_operand" "g")
513 ;               (match_operand:SI 2 "general_operand" "g")))
514 ;   (set (match_operand:SI 3 "general_operand" "=g")
515 ;       (mod:SI (match_operand:DI 1 "general_operand" "g")
516 ;               (match_operand:SI 2 "general_operand" "g")))]
517 ;  ""
518 ;  "ediv %2,%1,%0,%3")
520 ;; Bit-and on the VAX is done with a clear-bits insn.
521 (define_expand "and<mode>3"
522   [(set (match_operand:VAXint 0 "nonimmediate_operand" "")
523         (and:VAXint (not:VAXint (match_operand:VAXint 1 "general_operand" ""))
524                    (match_operand:VAXint 2 "general_operand" "")))]
525   ""
526   "
528   rtx op1 = operands[1];
530   /* If there is a constant argument, complement that one.  */
531   if (CONST_INT_P (operands[2]) && !CONST_INT_P (op1))
532     {
533       operands[1] = operands[2];
534       operands[2] = op1;
535       op1 = operands[1];
536     }
538   if (CONST_INT_P (op1))
539     operands[1] = GEN_INT (~INTVAL (op1));
540   else
541     operands[1] = expand_unop (<MODE>mode, one_cmpl_optab, op1, 0, 1);
544 (define_insn "*and<mode>"
545   [(set (match_operand:VAXint 0 "nonimmediate_operand" "=g,g")
546         (and:VAXint (not:VAXint (match_operand:VAXint 1 "general_operand" "g,g"))
547                     (match_operand:VAXint 2 "general_operand" "0,g")))]
548   ""
549   "@
550    bic<VAXint:isfx>2 %1,%0
551    bic<VAXint:isfx>3 %1,%2,%0")
553 ;; The following used to be needed because constant propagation can
554 ;; create them starting from the bic insn patterns above.  This is no
555 ;; longer a problem.  However, having these patterns allows optimization
556 ;; opportunities in combine.c.
558 (define_insn "*and<mode>_const_int"
559   [(set (match_operand:VAXint 0 "nonimmediate_operand" "=g,g")
560         (and:VAXint (match_operand:VAXint 1 "general_operand" "0,g")
561                    (match_operand:VAXint 2 "const_int_operand" "n,n")))]
562   ""
563   "@
564    bic<VAXint:isfx>2 %<VAXint:iprefx>2,%0
565    bic<VAXint:isfx>3 %<VAXint:iprefx>2,%1,%0")
568 ;;- Bit set instructions.
570 (define_insn "ior<mode>3"
571   [(set (match_operand:VAXint 0 "nonimmediate_operand" "=g,g,g")
572         (ior:VAXint (match_operand:VAXint 1 "general_operand" "0,g,g")
573                    (match_operand:VAXint 2 "general_operand" "g,0,g")))]
574   ""
575   "@
576    bis<VAXint:isfx>2 %2,%0
577    bis<VAXint:isfx>2 %1,%0
578    bis<VAXint:isfx>3 %2,%1,%0")
580 ;;- xor instructions.
582 (define_insn "xor<mode>3"
583   [(set (match_operand:VAXint 0 "nonimmediate_operand" "=g,g,g")
584         (xor:VAXint (match_operand:VAXint 1 "general_operand" "0,g,g")
585                    (match_operand:VAXint 2 "general_operand" "g,0,g")))]
586   ""
587   "@
588    xor<VAXint:isfx>2 %2,%0
589    xor<VAXint:isfx>2 %1,%0
590    xor<VAXint:isfx>3 %2,%1,%0")
593 (define_insn "neg<mode>2"
594   [(set (match_operand:VAXfp 0 "nonimmediate_operand" "=g")
595         (neg:VAXfp (match_operand:VAXfp 1 "general_operand" "gF")))]
596   ""
597   "mneg<VAXfp:fsfx> %1,%0")
599 (define_insn "neg<mode>2"
600   [(set (match_operand:VAXint 0 "nonimmediate_operand" "=g")
601         (neg:VAXint (match_operand:VAXint 1 "general_operand" "g")))]
602   ""
603   "mneg<VAXint:isfx> %1,%0")
605 (define_insn "one_cmpl<mode>2"
606   [(set (match_operand:VAXint 0 "nonimmediate_operand" "=g")
607         (not:VAXint (match_operand:VAXint 1 "general_operand" "g")))]
608   ""
609   "mcom<VAXint:isfx> %1,%0")
612 ;; Arithmetic right shift on the VAX works by negating the shift count,
613 ;; then emitting a right shift with the shift count negated.  This means
614 ;; that all actual shift counts in the RTL will be positive.  This
615 ;; prevents converting shifts to ZERO_EXTRACTs with negative positions,
616 ;; which isn't valid.
617 (define_expand "ashrsi3"
618   [(set (match_operand:SI 0 "general_operand" "=g")
619         (ashiftrt:SI (match_operand:SI 1 "general_operand" "g")
620                    (match_operand:QI 2 "general_operand" "g")))]
621   ""
622   "
624   if (!CONST_INT_P (operands[2]))
625     operands[2] = gen_rtx_NEG (QImode, negate_rtx (QImode, operands[2]));
628 (define_insn ""
629   [(set (match_operand:SI 0 "nonimmediate_operand" "=g")
630         (ashiftrt:SI (match_operand:SI 1 "general_operand" "g")
631                      (match_operand:QI 2 "const_int_operand" "n")))]
632   ""
633   "ashl $%n2,%1,%0")
635 (define_insn ""
636   [(set (match_operand:SI 0 "nonimmediate_operand" "=g")
637         (ashiftrt:SI (match_operand:SI 1 "general_operand" "g")
638                      (neg:QI (match_operand:QI 2 "general_operand" "g"))))]
639   ""
640   "ashl %2,%1,%0")
642 (define_insn "ashlsi3"
643   [(set (match_operand:SI 0 "nonimmediate_operand" "=g")
644         (ashift:SI (match_operand:SI 1 "general_operand" "g")
645                    (match_operand:QI 2 "general_operand" "g")))]
646   ""
647   "*
649   if (operands[2] == const1_rtx && rtx_equal_p (operands[0], operands[1]))
650     return \"addl2 %0,%0\";
651   if (REG_P (operands[1])
652       && CONST_INT_P (operands[2]))
653     {
654       int i = INTVAL (operands[2]);
655       if (i == 1)
656         return \"addl3 %1,%1,%0\";
657       if (i == 2)
658         return \"moval 0[%1],%0\";
659       if (i == 3)
660         return \"movad 0[%1],%0\";
661     }
662   return \"ashl %2,%1,%0\";
665 ;; Arithmetic right shift on the VAX works by negating the shift count.
666 (define_expand "ashrdi3"
667   [(set (match_operand:DI 0 "general_operand" "=g")
668         (ashiftrt:DI (match_operand:DI 1 "general_operand" "g")
669                      (match_operand:QI 2 "general_operand" "g")))]
670   ""
671   "
673   operands[2] = gen_rtx_NEG (QImode, negate_rtx (QImode, operands[2]));
676 (define_insn "ashldi3"
677   [(set (match_operand:DI 0 "nonimmediate_operand" "=g")
678         (ashift:DI (match_operand:DI 1 "general_operand" "g")
679                    (match_operand:QI 2 "general_operand" "g")))]
680   ""
681   "ashq %2,%1,%0")
683 (define_insn ""
684   [(set (match_operand:DI 0 "nonimmediate_operand" "=g")
685         (ashiftrt:DI (match_operand:DI 1 "general_operand" "g")
686                      (neg:QI (match_operand:QI 2 "general_operand" "g"))))]
687   ""
688   "ashq %2,%1,%0")
690 ;; We used to have expand_shift handle logical right shifts by using extzv,
691 ;; but this make it very difficult to do lshrdi3.  Since the VAX is the
692 ;; only machine with this kludge, it's better to just do this with a
693 ;; define_expand and remove that case from expand_shift.
695 (define_expand "lshrsi3"
696   [(set (match_dup 3)
697         (minus:QI (const_int 32)
698                   (match_dup 4)))
699    (set (match_operand:SI 0 "general_operand" "=g")
700         (zero_extract:SI (match_operand:SI 1 "register_operand" "r")
701                          (match_dup 3)
702                          (match_operand:SI 2 "register_operand" "g")))]
703   ""
704   "
706   operands[3] = gen_reg_rtx (QImode);
707   operands[4] = gen_lowpart (QImode, operands[2]);
710 ;; Rotate right on the VAX works by negating the shift count.
711 (define_expand "rotrsi3"
712   [(set (match_operand:SI 0 "general_operand" "=g")
713         (rotatert:SI (match_operand:SI 1 "general_operand" "g")
714                      (match_operand:QI 2 "general_operand" "g")))]
715   ""
716   "
718   if (!CONST_INT_P (operands[2]))
719     operands[2] = gen_rtx_NEG (QImode, negate_rtx (QImode, operands[2]));
722 (define_insn "rotlsi3"
723   [(set (match_operand:SI 0 "nonimmediate_operand" "=g")
724         (rotate:SI (match_operand:SI 1 "general_operand" "g")
725                    (match_operand:QI 2 "general_operand" "g")))]
726   ""
727   "rotl %2,%1,%0")
729 (define_insn ""
730   [(set (match_operand:SI 0 "nonimmediate_operand" "=g")
731         (rotatert:SI (match_operand:SI 1 "general_operand" "g")
732                      (match_operand:QI 2 "const_int_operand" "n")))]
733   ""
734   "rotl %R2,%1,%0")
736 (define_insn ""
737   [(set (match_operand:SI 0 "nonimmediate_operand" "=g")
738         (rotatert:SI (match_operand:SI 1 "general_operand" "g")
739                      (neg:QI (match_operand:QI 2 "general_operand" "g"))))]
740   ""
741   "rotl %2,%1,%0")
743 ;This insn is probably slower than a multiply and an add.
744 ;(define_insn ""
745 ;  [(set (match_operand:SI 0 "general_operand" "=g")
746 ;       (mult:SI (plus:SI (match_operand:SI 1 "general_operand" "g")
747 ;                         (match_operand:SI 2 "general_operand" "g"))
748 ;                (match_operand:SI 3 "general_operand" "g")))]
749 ;  ""
750 ;  "index %1,$0x80000000,$0x7fffffff,%3,%2,%0")
752 ;; Special cases of bit-field insns which we should
753 ;; recognize in preference to the general case.
754 ;; These handle aligned 8-bit and 16-bit fields,
755 ;; which can usually be done with move instructions.
757 (define_insn ""
758   [(set (zero_extract:SI (match_operand:SI 0 "register_operand" "+ro")
759                          (match_operand:QI 1 "const_int_operand" "n")
760                          (match_operand:SI 2 "const_int_operand" "n"))
761         (match_operand:SI 3 "general_operand" "g"))]
762    "(INTVAL (operands[1]) == 8 || INTVAL (operands[1]) == 16)
763    && INTVAL (operands[2]) % INTVAL (operands[1]) == 0
764    && (REG_P (operands[0])
765        || !mode_dependent_address_p (XEXP (operands[0], 0)))"
766   "*
768   if (REG_P (operands[0]))
769     {
770       if (INTVAL (operands[2]) != 0)
771         return \"insv %3,%2,%1,%0\";
772     }
773   else
774     operands[0]
775       = adjust_address (operands[0],
776                         INTVAL (operands[1]) == 8 ? QImode : HImode,
777                         INTVAL (operands[2]) / 8);
779   CC_STATUS_INIT;
780   if (INTVAL (operands[1]) == 8)
781     return \"movb %3,%0\";
782   return \"movw %3,%0\";
785 (define_insn ""
786   [(set (match_operand:SI 0 "nonimmediate_operand" "=&g")
787         (zero_extract:SI (match_operand:SI 1 "register_operand" "ro")
788                          (match_operand:QI 2 "const_int_operand" "n")
789                          (match_operand:SI 3 "const_int_operand" "n")))]
790   "(INTVAL (operands[2]) == 8 || INTVAL (operands[2]) == 16)
791    && INTVAL (operands[3]) % INTVAL (operands[2]) == 0
792    && (REG_P (operands[1])
793        || !mode_dependent_address_p (XEXP (operands[1], 0)))"
794   "*
796   if (REG_P (operands[1]))
797     {
798       if (INTVAL (operands[3]) != 0)
799         return \"extzv %3,%2,%1,%0\";
800     }
801   else
802     operands[1]
803       = adjust_address (operands[1],
804                         INTVAL (operands[2]) == 8 ? QImode : HImode,
805                         INTVAL (operands[3]) / 8);
807   if (INTVAL (operands[2]) == 8)
808     return \"movzbl %1,%0\";
809   return \"movzwl %1,%0\";
812 (define_insn ""
813   [(set (match_operand:SI 0 "nonimmediate_operand" "=g")
814         (sign_extract:SI (match_operand:SI 1 "register_operand" "ro")
815                          (match_operand:QI 2 "const_int_operand" "n")
816                          (match_operand:SI 3 "const_int_operand" "n")))]
817   "(INTVAL (operands[2]) == 8 || INTVAL (operands[2]) == 16)
818    && INTVAL (operands[3]) % INTVAL (operands[2]) == 0
819    && (REG_P (operands[1])
820        || !mode_dependent_address_p (XEXP (operands[1], 0)))"
821   "*
823   if (REG_P (operands[1]))
824     {
825       if (INTVAL (operands[3]) != 0)
826         return \"extv %3,%2,%1,%0\";
827     }
828   else
829     operands[1]
830       = adjust_address (operands[1],
831                         INTVAL (operands[2]) == 8 ? QImode : HImode,
832                         INTVAL (operands[3]) / 8);
834   if (INTVAL (operands[2]) == 8)
835     return \"cvtbl %1,%0\";
836   return \"cvtwl %1,%0\";
839 ;; Register-only SImode cases of bit-field insns.
841 (define_insn ""
842   [(set (cc0)
843         (compare
844          (sign_extract:SI (match_operand:SI 0 "register_operand" "r")
845                           (match_operand:QI 1 "general_operand" "g")
846                           (match_operand:SI 2 "general_operand" "g"))
847          (match_operand:SI 3 "general_operand" "g")))]
848   ""
849   "cmpv %2,%1,%0,%3")
851 (define_insn ""
852   [(set (cc0)
853         (compare
854          (zero_extract:SI (match_operand:SI 0 "register_operand" "r")
855                           (match_operand:QI 1 "general_operand" "g")
856                           (match_operand:SI 2 "general_operand" "g"))
857          (match_operand:SI 3 "general_operand" "g")))]
858   ""
859   "cmpzv %2,%1,%0,%3")
861 ;; When the field position and size are constant and the destination
862 ;; is a register, extv and extzv are much slower than a rotate followed
863 ;; by a bicl or sign extension.  Because we might end up choosing ext[z]v
864 ;; anyway, we can't allow immediate values for the primary source operand.
866 (define_insn ""
867   [(set (match_operand:SI 0 "nonimmediate_operand" "=g")
868         (sign_extract:SI (match_operand:SI 1 "register_operand" "ro")
869                          (match_operand:QI 2 "general_operand" "g")
870                          (match_operand:SI 3 "general_operand" "g")))]
871   ""
872   "*
874   if (!CONST_INT_P (operands[3])
875       || !CONST_INT_P (operands[2])
876       || !REG_P (operands[0])
877       || (INTVAL (operands[2]) != 8 && INTVAL (operands[2]) != 16))
878     return \"extv %3,%2,%1,%0\";
879   if (INTVAL (operands[2]) == 8)
880     return \"rotl %R3,%1,%0\;cvtbl %0,%0\";
881   return \"rotl %R3,%1,%0\;cvtwl %0,%0\";
884 (define_insn ""
885   [(set (match_operand:SI 0 "nonimmediate_operand" "=g")
886         (zero_extract:SI (match_operand:SI 1 "register_operand" "ro")
887                          (match_operand:QI 2 "general_operand" "g")
888                          (match_operand:SI 3 "general_operand" "g")))]
889   ""
890   "*
892   if (!CONST_INT_P (operands[3])
893       || !CONST_INT_P (operands[2])
894       || !REG_P (operands[0]))
895     return \"extzv %3,%2,%1,%0\";
896   if (INTVAL (operands[2]) == 8)
897     return \"rotl %R3,%1,%0\;movzbl %0,%0\";
898   if (INTVAL (operands[2]) == 16)
899     return \"rotl %R3,%1,%0\;movzwl %0,%0\";
900   if (INTVAL (operands[3]) & 31)
901     return \"rotl %R3,%1,%0\;bicl2 %M2,%0\";
902   if (rtx_equal_p (operands[0], operands[1]))
903     return \"bicl2 %M2,%0\";
904   return \"bicl3 %M2,%1,%0\";
907 ;; Non-register cases.
908 ;; nonimmediate_operand is used to make sure that mode-ambiguous cases
909 ;; don't match these (and therefore match the cases above instead).
911 (define_insn ""
912   [(set (cc0)
913         (compare
914          (sign_extract:SI (match_operand:QI 0 "memory_operand" "m")
915                           (match_operand:QI 1 "general_operand" "g")
916                           (match_operand:SI 2 "general_operand" "g"))
917          (match_operand:SI 3 "general_operand" "g")))]
918   ""
919   "cmpv %2,%1,%0,%3")
921 (define_insn ""
922   [(set (cc0)
923         (compare
924          (zero_extract:SI (match_operand:QI 0 "nonimmediate_operand" "rm")
925                           (match_operand:QI 1 "general_operand" "g")
926                           (match_operand:SI 2 "general_operand" "g"))
927          (match_operand:SI 3 "general_operand" "g")))]
928   ""
929   "cmpzv %2,%1,%0,%3")
931 (define_insn "extv"
932   [(set (match_operand:SI 0 "nonimmediate_operand" "=g")
933         (sign_extract:SI (match_operand:QI 1 "memory_operand" "m")
934                          (match_operand:QI 2 "general_operand" "g")
935                          (match_operand:SI 3 "general_operand" "g")))]
936   ""
937   "*
939   if (!REG_P (operands[0])
940       || !CONST_INT_P (operands[2])
941       || !CONST_INT_P (operands[3])
942       || (INTVAL (operands[2]) != 8 && INTVAL (operands[2]) != 16)
943       || INTVAL (operands[2]) + INTVAL (operands[3]) > 32
944       || side_effects_p (operands[1])
945       || (MEM_P (operands[1])
946           && mode_dependent_address_p (XEXP (operands[1], 0))))
947     return \"extv %3,%2,%1,%0\";
948   if (INTVAL (operands[2]) == 8)
949     return \"rotl %R3,%1,%0\;cvtbl %0,%0\";
950   return \"rotl %R3,%1,%0\;cvtwl %0,%0\";
953 (define_expand "extzv"
954   [(set (match_operand:SI 0 "general_operand" "")
955         (zero_extract:SI (match_operand:SI 1 "general_operand" "")
956                          (match_operand:QI 2 "general_operand" "")
957                          (match_operand:SI 3 "general_operand" "")))]
958   ""
959   "")
961 (define_insn ""
962   [(set (match_operand:SI 0 "nonimmediate_operand" "=g")
963         (zero_extract:SI (match_operand:QI 1 "memory_operand" "m")
964                          (match_operand:QI 2 "general_operand" "g")
965                          (match_operand:SI 3 "general_operand" "g")))]
966   ""
967   "*
969   if (!REG_P (operands[0])
970       || !CONST_INT_P (operands[2])
971       || !CONST_INT_P (operands[3])
972       || INTVAL (operands[2]) + INTVAL (operands[3]) > 32
973       || side_effects_p (operands[1])
974       || (MEM_P (operands[1])
975           && mode_dependent_address_p (XEXP (operands[1], 0))))
976     return \"extzv %3,%2,%1,%0\";
977   if (INTVAL (operands[2]) == 8)
978     return \"rotl %R3,%1,%0\;movzbl %0,%0\";
979   if (INTVAL (operands[2]) == 16)
980     return \"rotl %R3,%1,%0\;movzwl %0,%0\";
981   return \"rotl %R3,%1,%0\;bicl2 %M2,%0\";
984 (define_expand "insv"
985   [(set (zero_extract:SI (match_operand:SI 0 "general_operand" "")
986                          (match_operand:QI 1 "general_operand" "")
987                          (match_operand:SI 2 "general_operand" ""))
988         (match_operand:SI 3 "general_operand" ""))]
989   ""
990   "")
992 (define_insn ""
993   [(set (zero_extract:SI (match_operand:QI 0 "memory_operand" "+g")
994                          (match_operand:QI 1 "general_operand" "g")
995                          (match_operand:SI 2 "general_operand" "g"))
996         (match_operand:SI 3 "general_operand" "g"))]
997   ""
998   "insv %3,%2,%1,%0")
1000 (define_insn ""
1001   [(set (zero_extract:SI (match_operand:SI 0 "register_operand" "+r")
1002                          (match_operand:QI 1 "general_operand" "g")
1003                          (match_operand:SI 2 "general_operand" "g"))
1004         (match_operand:SI 3 "general_operand" "g"))]
1005   ""
1006   "insv %3,%2,%1,%0")
1008 ;; Unconditional jump
1009 (define_insn "jump"
1010   [(set (pc)
1011         (label_ref (match_operand 0 "" "")))]
1012   ""
1013   "jbr %l0")
1015 ;; Conditional jumps
1016 (define_code_macro any_cond [eq ne gt lt gtu ltu ge le geu leu])
1018 (define_insn "b<code>"
1019   [(set (pc)
1020         (if_then_else (any_cond (cc0)
1021                                 (const_int 0))
1022                       (label_ref (match_operand 0 "" ""))
1023                       (pc)))]
1024   ""
1025   "* return vax_output_conditional_branch (<CODE>);")
1027 ;; Recognize reversed jumps.
1028 (define_insn ""
1029   [(set (pc)
1030         (if_then_else (match_operator 0 "comparison_operator"
1031                                       [(cc0)
1032                                        (const_int 0)])
1033                       (pc)
1034                       (label_ref (match_operand 1 "" ""))))]
1035   ""
1036   "j%C0 %l1") ; %C0 negates condition
1038 ;; Recognize jbs, jlbs, jbc and jlbc instructions.  Note that the operand
1039 ;; of jlbs and jlbc insns are SImode in the hardware.  However, if it is
1040 ;; memory, we use QImode in the insn.  So we can't use those instructions
1041 ;; for mode-dependent addresses.
1043 (define_insn ""
1044   [(set (pc)
1045         (if_then_else
1046          (ne (zero_extract:SI (match_operand:QI 0 "memory_operand" "Q,g")
1047                               (const_int 1)
1048                               (match_operand:SI 1 "general_operand" "I,g"))
1049              (const_int 0))
1050          (label_ref (match_operand 2 "" ""))
1051          (pc)))]
1052   ""
1053   "@
1054    jlbs %0,%l2
1055    jbs %1,%0,%l2")
1057 (define_insn ""
1058   [(set (pc)
1059         (if_then_else
1060          (eq (zero_extract:SI (match_operand:QI 0 "memory_operand" "Q,g")
1061                               (const_int 1)
1062                               (match_operand:SI 1 "general_operand" "I,g"))
1063              (const_int 0))
1064          (label_ref (match_operand 2 "" ""))
1065          (pc)))]
1066   ""
1067   "@
1068    jlbc %0,%l2
1069    jbc %1,%0,%l2")
1071 (define_insn ""
1072   [(set (pc)
1073         (if_then_else
1074          (ne (zero_extract:SI (match_operand:SI 0 "register_operand" "r,r")
1075                               (const_int 1)
1076                               (match_operand:SI 1 "general_operand" "I,g"))
1077              (const_int 0))
1078          (label_ref (match_operand 2 "" ""))
1079          (pc)))]
1080   ""
1081   "@
1082    jlbs %0,%l2
1083    jbs %1,%0,%l2")
1085 (define_insn ""
1086   [(set (pc)
1087         (if_then_else
1088          (eq (zero_extract:SI (match_operand:SI 0 "register_operand" "r,r")
1089                               (const_int 1)
1090                               (match_operand:SI 1 "general_operand" "I,g"))
1091              (const_int 0))
1092          (label_ref (match_operand 2 "" ""))
1093          (pc)))]
1094   ""
1095   "@
1096    jlbc %0,%l2
1097    jbc %1,%0,%l2")
1099 ;; Subtract-and-jump and Add-and-jump insns.
1100 ;; These are not used when output is for the Unix assembler
1101 ;; because it does not know how to modify them to reach far.
1103 ;; Normal sob insns.
1105 (define_insn ""
1106   [(set (pc)
1107         (if_then_else
1108          (gt (plus:SI (match_operand:SI 0 "nonimmediate_operand" "+g")
1109                       (const_int -1))
1110              (const_int 0))
1111          (label_ref (match_operand 1 "" ""))
1112          (pc)))
1113    (set (match_dup 0)
1114         (plus:SI (match_dup 0)
1115                  (const_int -1)))]
1116   "!TARGET_UNIX_ASM"
1117   "jsobgtr %0,%l1")
1119 (define_insn ""
1120   [(set (pc)
1121         (if_then_else
1122          (ge (plus:SI (match_operand:SI 0 "nonimmediate_operand" "+g")
1123                       (const_int -1))
1124              (const_int 0))
1125          (label_ref (match_operand 1 "" ""))
1126          (pc)))
1127    (set (match_dup 0)
1128         (plus:SI (match_dup 0)
1129                  (const_int -1)))]
1130   "!TARGET_UNIX_ASM"
1131   "jsobgeq %0,%l1")
1133 ;; Normal aob insns.  Define a version for when operands[1] is a constant.
1134 (define_insn ""
1135   [(set (pc)
1136         (if_then_else
1137          (lt (plus:SI (match_operand:SI 0 "nonimmediate_operand" "+g")
1138                       (const_int 1))
1139              (match_operand:SI 1 "general_operand" "g"))
1140          (label_ref (match_operand 2 "" ""))
1141          (pc)))
1142    (set (match_dup 0)
1143         (plus:SI (match_dup 0)
1144                  (const_int 1)))]
1145   "!TARGET_UNIX_ASM"
1146   "jaoblss %1,%0,%l2")
1148 (define_insn ""
1149   [(set (pc)
1150         (if_then_else
1151          (lt (match_operand:SI 0 "nonimmediate_operand" "+g")
1152              (match_operand:SI 1 "general_operand" "g"))
1153          (label_ref (match_operand 2 "" ""))
1154          (pc)))
1155    (set (match_dup 0)
1156         (plus:SI (match_dup 0)
1157                  (const_int 1)))]
1158   "!TARGET_UNIX_ASM && CONST_INT_P (operands[1])"
1159   "jaoblss %P1,%0,%l2")
1161 (define_insn ""
1162   [(set (pc)
1163         (if_then_else
1164          (le (plus:SI (match_operand:SI 0 "nonimmediate_operand" "+g")
1165                       (const_int 1))
1166              (match_operand:SI 1 "general_operand" "g"))
1167          (label_ref (match_operand 2 "" ""))
1168          (pc)))
1169    (set (match_dup 0)
1170         (plus:SI (match_dup 0)
1171                  (const_int 1)))]
1172   "!TARGET_UNIX_ASM"
1173   "jaobleq %1,%0,%l2")
1175 (define_insn ""
1176   [(set (pc)
1177         (if_then_else
1178          (le (match_operand:SI 0 "nonimmediate_operand" "+g")
1179              (match_operand:SI 1 "general_operand" "g"))
1180          (label_ref (match_operand 2 "" ""))
1181          (pc)))
1182    (set (match_dup 0)
1183         (plus:SI (match_dup 0)
1184                  (const_int 1)))]
1185   "!TARGET_UNIX_ASM && CONST_INT_P (operands[1])"
1186   "jaobleq %P1,%0,%l2")
1188 ;; Something like a sob insn, but compares against -1.
1189 ;; This finds `while (foo--)' which was changed to `while (--foo != -1)'.
1191 (define_insn ""
1192   [(set (pc)
1193         (if_then_else
1194          (ne (match_operand:SI 0 "nonimmediate_operand" "+g")
1195              (const_int 0))
1196          (label_ref (match_operand 1 "" ""))
1197          (pc)))
1198    (set (match_dup 0)
1199         (plus:SI (match_dup 0)
1200                  (const_int -1)))]
1201   ""
1202   "decl %0\;jgequ %l1")
1204 (define_expand "call_pop"
1205   [(parallel [(call (match_operand:QI 0 "memory_operand" "")
1206                     (match_operand:SI 1 "const_int_operand" ""))
1207               (set (reg:SI VAX_SP_REGNUM)
1208                    (plus:SI (reg:SI VAX_SP_REGNUM)
1209                             (match_operand:SI 3 "immediate_operand" "")))])]
1210   ""
1212   gcc_assert (INTVAL (operands[3]) <= 255 * 4 && INTVAL (operands[3]) % 4 == 0);
1214   /* Operand 1 is the number of bytes to be popped by DW_CFA_GNU_args_size
1215      during EH unwinding.  We must include the argument count pushed by
1216      the calls instruction.  */
1217   operands[1] = GEN_INT (INTVAL (operands[3]) + 4);
1220 (define_insn "*call_pop"
1221   [(call (match_operand:QI 0 "memory_operand" "m")
1222          (match_operand:SI 1 "const_int_operand" "n"))
1223    (set (reg:SI VAX_SP_REGNUM) (plus:SI (reg:SI VAX_SP_REGNUM)
1224                                         (match_operand:SI 2 "immediate_operand" "i")))]
1225   ""
1227   operands[1] = GEN_INT ((INTVAL (operands[1]) - 4) / 4);
1228   return "calls %1,%0";
1231 (define_expand "call_value_pop"
1232   [(parallel [(set (match_operand 0 "" "")
1233                    (call (match_operand:QI 1 "memory_operand" "")
1234                          (match_operand:SI 2 "const_int_operand" "")))
1235               (set (reg:SI VAX_SP_REGNUM)
1236                    (plus:SI (reg:SI VAX_SP_REGNUM)
1237                             (match_operand:SI 4 "immediate_operand" "")))])]
1238   ""
1240   gcc_assert (INTVAL (operands[4]) <= 255 * 4 && INTVAL (operands[4]) % 4 == 0);
1242   /* Operand 2 is the number of bytes to be popped by DW_CFA_GNU_args_size
1243      during EH unwinding.  We must include the argument count pushed by
1244      the calls instruction.  */
1245   operands[2] = GEN_INT (INTVAL (operands[4]) + 4);
1248 (define_insn "*call_value_pop"
1249   [(set (match_operand 0 "" "")
1250         (call (match_operand:QI 1 "memory_operand" "m")
1251               (match_operand:SI 2 "const_int_operand" "n")))
1252    (set (reg:SI VAX_SP_REGNUM) (plus:SI (reg:SI VAX_SP_REGNUM)
1253                                         (match_operand:SI 3 "immediate_operand" "i")))]
1254   ""
1255   "*
1257   operands[2] = GEN_INT ((INTVAL (operands[2]) - 4) / 4);
1258   return \"calls %2,%1\";
1261 (define_expand "call"
1262   [(call (match_operand:QI 0 "memory_operand" "")
1263       (match_operand:SI 1 "const_int_operand" ""))]
1264   ""
1265   "
1267   /* Operand 1 is the number of bytes to be popped by DW_CFA_GNU_args_size
1268      during EH unwinding.  We must include the argument count pushed by
1269      the calls instruction.  */
1270   operands[1] = GEN_INT (INTVAL (operands[1]) + 4);
1273 (define_insn "*call"
1274    [(call (match_operand:QI 0 "memory_operand" "m")
1275        (match_operand:SI 1 "const_int_operand" ""))]
1276   ""
1277   "calls $0,%0")
1279 (define_expand "call_value"
1280   [(set (match_operand 0 "" "")
1281       (call (match_operand:QI 1 "memory_operand" "")
1282             (match_operand:SI 2 "const_int_operand" "")))]
1283   ""
1284   "
1286   /* Operand 2 is the number of bytes to be popped by DW_CFA_GNU_args_size
1287      during EH unwinding.  We must include the argument count pushed by
1288      the calls instruction.  */
1289   operands[2] = GEN_INT (INTVAL (operands[2]) + 4);
1292 (define_insn "*call_value"
1293   [(set (match_operand 0 "" "")
1294         (call (match_operand:QI 1 "memory_operand" "m")
1295               (match_operand:SI 2 "const_int_operand" "")))]
1296   ""
1297   "calls $0,%1")
1299 ;; Call subroutine returning any type.
1301 (define_expand "untyped_call"
1302   [(parallel [(call (match_operand 0 "" "")
1303                   (const_int 0))
1304             (match_operand 1 "" "")
1305             (match_operand 2 "" "")])]
1306   ""
1307   "
1309   int i;
1311   emit_call_insn (gen_call_pop (operands[0], const0_rtx, NULL, const0_rtx));
1313   for (i = 0; i < XVECLEN (operands[2], 0); i++)
1314     {
1315       rtx set = XVECEXP (operands[2], 0, i);
1316       emit_move_insn (SET_DEST (set), SET_SRC (set));
1317     }
1319   /* The optimizer does not know that the call sets the function value
1320      registers we stored in the result block.  We avoid problems by
1321      claiming that all hard registers are used and clobbered at this
1322      point.  */
1323   emit_insn (gen_blockage ());
1325   DONE;
1328 ;; UNSPEC_VOLATILE is considered to use and clobber all hard registers and
1329 ;; all of memory.  This blocks insns from being moved across this point.
1331 (define_insn "blockage"
1332   [(unspec_volatile [(const_int 0)] VUNSPEC_BLOCKAGE)]
1333   ""
1334   "")
1336 (define_insn "return"
1337   [(return)]
1338   ""
1339   "ret")
1341 (define_expand "epilogue"
1342   [(return)]
1343   ""
1344   "
1346   emit_jump_insn (gen_return ());
1347   DONE;
1350 (define_insn "nop"
1351   [(const_int 0)]
1352   ""
1353   "nop")
1355 ;; This had a wider constraint once, and it had trouble.
1356 ;; If you are tempted to try `g', please don't--it's not worth
1357 ;; the risk we will reopen the same bug.
1358 (define_insn "indirect_jump"
1359   [(set (pc) (match_operand:SI 0 "register_operand" "r"))]
1360   ""
1361   "jmp (%0)")
1363 ;; This is here to accept 5 arguments (as passed by expand_end_case)
1364 ;; and pass the first 4 along to the casesi1 pattern that really does
1365 ;; the actual casesi work.  We emit a jump here to the default label
1366 ;; _before_ the casesi so that we can be sure that the casesi never
1367 ;; drops through.
1368 ;; This is suboptimal perhaps, but so is much of the rest of this
1369 ;; machine description.  For what it's worth, HPPA uses the same trick.
1371 ;; operand 0 is index
1372 ;; operand 1 is the minimum bound (a const_int)
1373 ;; operand 2 is the maximum bound - minimum bound + 1 (also a const_int)
1374 ;; operand 3 is CODE_LABEL for the table;
1375 ;; operand 4 is the CODE_LABEL to go to if index out of range (ie. default).
1377 ;; We emit:
1378 ;;      i = index - minimum_bound
1379 ;;      if (i > (maximum_bound - minimum_bound + 1) goto default;
1380 ;;      casesi (i, 0, table);
1382 (define_expand "casesi"
1383   [(match_operand:SI 0 "general_operand" "")
1384    (match_operand:SI 1 "general_operand" "")
1385    (match_operand:SI 2 "general_operand" "")
1386    (match_operand 3 "" "")
1387    (match_operand 4 "" "")]
1388   ""
1390   /* i = index - minimum_bound;
1391      But only if the lower bound is not already zero.  */
1392   if (operands[1] != const0_rtx)
1393     {
1394       rtx index = gen_reg_rtx (SImode);
1395       emit_insn (gen_addsi3 (index,
1396                              operands[0],
1397                              GEN_INT (-INTVAL (operands[1]))));
1398       operands[0] = index;
1399     }
1401   /* if (i > (maximum_bound - minimum_bound + 1) goto default;  */
1402   emit_insn (gen_cmpsi (operands[0], operands[2]));
1403   emit_jump_insn (gen_bgtu (operands[4]));
1405   /* casesi (i, 0, table);  */
1406   emit_jump_insn (gen_casesi1 (operands[0], operands[2], operands[3]));
1407   DONE;
1410 ;; This insn is a bit of a lier.  It actually falls through if no case
1411 ;; matches.  But, we prevent that from ever happening by emitting a jump
1412 ;; before this, see the define_expand above.
1413 (define_insn "casesi1"
1414   [(match_operand:SI 1 "const_int_operand" "n")
1415    (set (pc)
1416         (plus:SI (sign_extend:SI
1417                   (mem:HI (plus:SI (mult:SI (match_operand:SI 0 "general_operand" "g")
1418                                             (const_int 2))
1419                           (pc))))
1420                  (label_ref:SI (match_operand 2 "" ""))))]
1421   ""
1422   "casel %0,$0,%1")
1424 ;;- load or push effective address
1425 ;; These come after the move and add/sub patterns
1426 ;; because we don't want pushl $1 turned into pushad 1.
1427 ;; or addl3 r1,r2,r3 turned into movab 0(r1)[r2],r3.
1429 ;; It does not work to use constraints to distinguish pushes from moves,
1430 ;; because < matches any autodecrement, not just a push.
1432 (define_insn ""
1433   [(set (match_operand:SI 0 "nonimmediate_operand" "=g")
1434         (match_operand:QI 1 "address_operand" "p"))]
1435   ""
1436   "*
1438   if (push_operand (operands[0], SImode))
1439     return \"pushab %a1\";
1440   else
1441     return \"movab %a1,%0\";
1444 (define_insn ""
1445   [(set (match_operand:SI 0 "nonimmediate_operand" "=g")
1446         (match_operand:HI 1 "address_operand" "p"))]
1447   ""
1448   "*
1450   if (push_operand (operands[0], SImode))
1451     return \"pushaw %a1\";
1452   else
1453     return \"movaw %a1,%0\";
1456 (define_insn ""
1457   [(set (match_operand:SI 0 "nonimmediate_operand" "=g")
1458         (match_operand:SI 1 "address_operand" "p"))]
1459   ""
1460   "*
1462   if (push_operand (operands[0], SImode))
1463     return \"pushal %a1\";
1464   else
1465     return \"moval %a1,%0\";
1468 (define_insn ""
1469   [(set (match_operand:SI 0 "nonimmediate_operand" "=g")
1470         (match_operand:DI 1 "address_operand" "p"))]
1471   ""
1472   "*
1474   if (push_operand (operands[0], SImode))
1475     return \"pushaq %a1\";
1476   else
1477     return \"movaq %a1,%0\";
1480 (define_insn ""
1481   [(set (match_operand:SI 0 "nonimmediate_operand" "=g")
1482         (match_operand:SF 1 "address_operand" "p"))]
1483   ""
1484   "*
1486   if (push_operand (operands[0], SImode))
1487     return \"pushaf %a1\";
1488   else
1489     return \"movaf %a1,%0\";
1492 (define_insn ""
1493   [(set (match_operand:SI 0 "nonimmediate_operand" "=g")
1494         (match_operand:DF 1 "address_operand" "p"))]
1495   ""
1496   "*
1498   if (push_operand (operands[0], SImode))
1499     return \"pushad %a1\";
1500   else
1501     return \"movad %a1,%0\";
1504 ;; These used to be peepholes, but it is more straightforward to do them
1505 ;; as single insns.  However, we must force the output to be a register
1506 ;; if it is not an offsettable address so that we know that we can assign
1507 ;; to it twice.
1509 ;; If we had a good way of evaluating the relative costs, these could be
1510 ;; machine-independent.
1512 ;; Optimize   extzv ...,z;    andl2 ...,z
1513 ;; or         ashl ...,z;     andl2 ...,z
1514 ;; with other operands constant.  This is what the combiner converts the
1515 ;; above sequences to before attempting to recognize the new insn.
1517 (define_insn ""
1518   [(set (match_operand:SI 0 "nonimmediate_operand" "=ro")
1519         (and:SI (ashiftrt:SI (match_operand:SI 1 "general_operand" "g")
1520                              (match_operand:QI 2 "const_int_operand" "n"))
1521                 (match_operand:SI 3 "const_int_operand" "n")))]
1522   "(INTVAL (operands[3]) & ~((1 << (32 - INTVAL (operands[2]))) - 1)) == 0"
1523   "*
1525   unsigned long mask1 = INTVAL (operands[3]);
1526   unsigned long mask2 = (1 << (32 - INTVAL (operands[2]))) - 1;
1528   if ((mask1 & mask2) != mask1)
1529     operands[3] = GEN_INT (mask1 & mask2);
1531   return \"rotl %R2,%1,%0\;bicl2 %N3,%0\";
1534 ;; left-shift and mask
1535 ;; The only case where `ashl' is better is if the mask only turns off
1536 ;; bits that the ashl would anyways, in which case it should have been
1537 ;; optimized away.
1539 (define_insn ""
1540   [(set (match_operand:SI 0 "nonimmediate_operand" "=ro")
1541         (and:SI (ashift:SI (match_operand:SI 1 "general_operand" "g")
1542                            (match_operand:QI 2 "const_int_operand" "n"))
1543                 (match_operand:SI 3 "const_int_operand" "n")))]
1544   ""
1545   "*
1547   operands[3]
1548     = GEN_INT (INTVAL (operands[3]) & ~((1 << INTVAL (operands[2])) - 1));
1549   return \"rotl %2,%1,%0\;bicl2 %N3,%0\";
1552 ;; Instruction sequence to sync the VAX instruction stream.
1553 (define_insn "sync_istream"
1554   [(unspec_volatile [(const_int 0)] VUNSPEC_SYNC_ISTREAM)]
1555   ""
1556   "movpsl -(%|sp)\;pushal 1(%|pc)\;rei")