1 ;; Machine description for GNU compiler, VAX Version
2 ;; Copyright (C) 1987-2017 Free Software Foundation, Inc.
4 ;; This file is part of GCC.
6 ;; GCC is free software; you can redistribute it and/or modify
7 ;; it under the terms of the GNU General Public License as published by
8 ;; the Free Software Foundation; either version 3, or (at your option)
11 ;; GCC is distributed in the hope that it will be useful,
12 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
13 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 ;; GNU General Public License for more details.
16 ;; You should have received a copy of the GNU General Public License
17 ;; along with GCC; see the file COPYING3. If not see
18 ;; <http://www.gnu.org/licenses/>.
21 ;;- Instruction patterns. When multiple patterns apply,
22 ;;- the first one in the file is chosen.
24 ;;- See file "rtl.def" for documentation on define_insn, match_*, et al.
26 ;;- cpp macro #define NOTICE_UPDATE_CC in file tm.h handles condition code
27 ;;- updates for most instructions.
29 ;; UNSPEC_VOLATILE usage:
31 (define_c_enum "unspecv" [
32 VUNSPEC_BLOCKAGE ; 'blockage' insn to prevent scheduling across an
34 VUNSPEC_SYNC_ISTREAM ; sequence of insns to sync the I-stream
35 VUNSPEC_PEM ; 'procedure_entry_mask' insn.
39 [(VAX_AP_REGNUM 12) ; Register 12 contains the argument pointer
40 (VAX_FP_REGNUM 13) ; Register 13 contains the frame pointer
41 (VAX_SP_REGNUM 14) ; Register 14 contains the stack pointer
42 (VAX_PC_REGNUM 15) ; Register 15 contains the program counter
46 ;; Integer modes supported on VAX, with a mapping from machine mode
47 ;; to mnemonic suffix. DImode is always a special case.
48 (define_mode_iterator VAXint [QI HI SI])
49 (define_mode_iterator VAXintQH [QI HI])
50 (define_mode_iterator VAXintQHSD [QI HI SI DI])
51 (define_mode_attr isfx [(QI "b") (HI "w") (SI "l") (DI "q")])
53 ;; Similar for float modes supported on VAX.
54 (define_mode_iterator VAXfp [SF DF])
55 (define_mode_attr fsfx [(SF "f") (DF "%#")])
57 ;; Some output patterns want integer immediates with a prefix...
58 (define_mode_attr iprefx [(QI "B") (HI "H") (SI "N")])
61 (include "constraints.md")
62 (include "predicates.md")
64 (define_insn "*cmp<mode>"
66 (compare (match_operand:VAXint 0 "nonimmediate_operand" "nrmT,nrmT")
67 (match_operand:VAXint 1 "general_operand" "I,nrmT")))]
71 cmp<VAXint:isfx> %0,%1")
73 (define_insn "*cmp<mode>"
75 (compare (match_operand:VAXfp 0 "general_operand" "gF,gF")
76 (match_operand:VAXfp 1 "general_operand" "G,gF")))]
80 cmp<VAXfp:fsfx> %0,%1")
82 (define_insn "*bit<mode>"
84 (compare (and:VAXint (match_operand:VAXint 0 "general_operand" "nrmT")
85 (match_operand:VAXint 1 "general_operand" "nrmT"))
88 "bit<VAXint:isfx> %0,%1")
90 ;; The VAX has no sCOND insns. It does have add/subtract with carry
91 ;; which could be used to implement the sltu and sgeu patterns. However,
92 ;; to do this properly requires a complete rewrite of the compare insns
93 ;; to keep them together with the sltu/sgeu insns until after the
94 ;; reload pass is complete. The previous implementation didn't do this
95 ;; and has been deleted.
98 (define_insn "mov<mode>"
99 [(set (match_operand:VAXfp 0 "nonimmediate_operand" "=g,g")
100 (match_operand:VAXfp 1 "general_operand" "G,gF"))]
104 mov<VAXfp:fsfx> %1,%0")
106 ;; Some VAXen don't support this instruction.
107 ;;(define_insn "movti"
108 ;; [(set (match_operand:TI 0 "general_operand" "=g")
109 ;; (match_operand:TI 1 "general_operand" "g"))]
114 [(set (match_operand:DI 0 "nonimmediate_operand" "=g")
115 (match_operand:DI 1 "general_operand" "g"))]
117 "* return vax_output_int_move (insn, operands, DImode);")
119 ;; The VAX move instructions have space-time tradeoffs. On a MicroVAX
120 ;; register-register mov instructions take 3 bytes and 2 CPU cycles. clrl
121 ;; takes 2 bytes and 3 cycles. mov from constant to register takes 2 cycles
122 ;; if the constant is smaller than 4 bytes, 3 cycles for a longword
123 ;; constant. movz, mneg, and mcom are as fast as mov, so movzwl is faster
124 ;; than movl for positive constants that fit in 16 bits but not 6 bits. cvt
125 ;; instructions take 4 cycles. inc takes 3 cycles. The machine description
126 ;; is willing to trade 1 byte for 1 cycle (clrl instead of movl $0; cvtwl
129 ;; Cycle counts for other models may vary (on a VAX 750 they are similar,
130 ;; but on a VAX 9000 most move and add instructions with one constant
131 ;; operand take 1 cycle).
133 ;; Loads of constants between 64 and 128 used to be done with
134 ;; "addl3 $63,#,dst" but this is slower than movzbl and takes as much space.
136 (define_expand "movsi"
137 [(set (match_operand:SI 0 "nonimmediate_operand" "")
138 (match_operand:SI 1 "general_operand" ""))]
142 #ifdef NO_EXTERNAL_INDIRECT_ADDRESS
144 && GET_CODE (operands[1]) == CONST
145 && GET_CODE (XEXP (XEXP (operands[1], 0), 0)) == SYMBOL_REF
146 && !SYMBOL_REF_LOCAL_P (XEXP (XEXP (operands[1], 0), 0)))
148 rtx symbol_ref = XEXP (XEXP (operands[1], 0), 0);
149 rtx const_int = XEXP (XEXP (operands[1], 0), 1);
150 rtx temp = reload_in_progress ? operands[0] : gen_reg_rtx (Pmode);
151 emit_move_insn (temp, symbol_ref);
152 emit_move_insn (operands[0], gen_rtx_PLUS (SImode, temp, const_int));
158 (define_insn "movsi_2"
159 [(set (match_operand:SI 0 "nonimmediate_operand" "=g")
160 (match_operand:SI 1 "nonsymbolic_operand" "nrmT"))]
162 "* return vax_output_int_move (insn, operands, SImode);")
164 (define_insn "mov<mode>"
165 [(set (match_operand:VAXintQH 0 "nonimmediate_operand" "=g")
166 (match_operand:VAXintQH 1 "general_operand" "g"))]
168 "* return vax_output_int_move (insn, operands, <MODE>mode);")
170 (define_insn "movstricthi"
171 [(set (strict_low_part (match_operand:HI 0 "register_operand" "+g"))
172 (match_operand:HI 1 "general_operand" "g"))]
176 if (CONST_INT_P (operands[1]))
178 int i = INTVAL (operands[1]);
181 else if ((unsigned int)i < 64)
182 return \"movw %1,%0\";
183 else if ((unsigned int)~i < 64)
184 return \"mcomw %H1,%0\";
185 else if ((unsigned int)i < 256)
186 return \"movzbw %1,%0\";
188 return \"movw %1,%0\";
191 (define_insn "movstrictqi"
192 [(set (strict_low_part (match_operand:QI 0 "register_operand" "+g"))
193 (match_operand:QI 1 "general_operand" "g"))]
197 if (CONST_INT_P (operands[1]))
199 int i = INTVAL (operands[1]);
202 else if ((unsigned int)~i < 64)
203 return \"mcomb %B1,%0\";
205 return \"movb %1,%0\";
208 ;; This is here to accept 4 arguments and pass the first 3 along
209 ;; to the movmemhi1 pattern that really does the work.
210 (define_expand "movmemhi"
211 [(set (match_operand:BLK 0 "general_operand" "=g")
212 (match_operand:BLK 1 "general_operand" "g"))
213 (use (match_operand:HI 2 "general_operand" "g"))
214 (match_operand 3 "" "")]
218 emit_insn (gen_movmemhi1 (operands[0], operands[1], operands[2]));
222 ;; The definition of this insn does not really explain what it does,
223 ;; but it should suffice
224 ;; that anything generated as this insn will be recognized as one
225 ;; and that it won't successfully combine with anything.
227 (define_insn "movmemhi1"
228 [(set (match_operand:BLK 0 "memory_operand" "=o")
229 (match_operand:BLK 1 "memory_operand" "o"))
230 (use (match_operand:HI 2 "general_operand" "g"))
236 (clobber (reg:SI 5))]
240 ;; Extension and truncation insns.
242 (define_insn "truncsiqi2"
243 [(set (match_operand:QI 0 "nonimmediate_operand" "=g")
244 (truncate:QI (match_operand:SI 1 "nonimmediate_operand" "nrmT")))]
248 (define_insn "truncsihi2"
249 [(set (match_operand:HI 0 "nonimmediate_operand" "=g")
250 (truncate:HI (match_operand:SI 1 "nonimmediate_operand" "nrmT")))]
254 (define_insn "trunchiqi2"
255 [(set (match_operand:QI 0 "nonimmediate_operand" "=g")
256 (truncate:QI (match_operand:HI 1 "nonimmediate_operand" "g")))]
260 (define_insn "extendhisi2"
261 [(set (match_operand:SI 0 "nonimmediate_operand" "=g")
262 (sign_extend:SI (match_operand:HI 1 "nonimmediate_operand" "g")))]
266 (define_insn "extendqihi2"
267 [(set (match_operand:HI 0 "nonimmediate_operand" "=g")
268 (sign_extend:HI (match_operand:QI 1 "nonimmediate_operand" "g")))]
272 (define_insn "extendqisi2"
273 [(set (match_operand:SI 0 "nonimmediate_operand" "=g")
274 (sign_extend:SI (match_operand:QI 1 "nonimmediate_operand" "g")))]
278 (define_insn "extendsfdf2"
279 [(set (match_operand:DF 0 "nonimmediate_operand" "=g")
280 (float_extend:DF (match_operand:SF 1 "general_operand" "gF")))]
284 (define_insn "truncdfsf2"
285 [(set (match_operand:SF 0 "nonimmediate_operand" "=g")
286 (float_truncate:SF (match_operand:DF 1 "general_operand" "gF")))]
290 (define_insn "zero_extendhisi2"
291 [(set (match_operand:SI 0 "nonimmediate_operand" "=g")
292 (zero_extend:SI (match_operand:HI 1 "nonimmediate_operand" "g")))]
296 (define_insn "zero_extendqihi2"
297 [(set (match_operand:HI 0 "nonimmediate_operand" "=g")
298 (zero_extend:HI (match_operand:QI 1 "nonimmediate_operand" "g")))]
302 (define_insn "zero_extendqisi2"
303 [(set (match_operand:SI 0 "nonimmediate_operand" "=g")
304 (zero_extend:SI (match_operand:QI 1 "nonimmediate_operand" "g")))]
308 ;; Fix-to-float conversion insns.
310 (define_insn "float<VAXint:mode><VAXfp:mode>2"
311 [(set (match_operand:VAXfp 0 "nonimmediate_operand" "=g")
312 (float:VAXfp (match_operand:VAXint 1 "nonimmediate_operand" "g")))]
314 "cvt<VAXint:isfx><VAXfp:fsfx> %1,%0")
316 ;; Float-to-fix conversion insns.
318 (define_insn "fix_trunc<VAXfp:mode><VAXint:mode>2"
319 [(set (match_operand:VAXint 0 "nonimmediate_operand" "=g")
320 (fix:VAXint (match_operand:VAXfp 1 "general_operand" "gF")))]
322 "cvt<VAXfp:fsfx><VAXint:isfx> %1,%0")
324 (define_expand "fixuns_trunc<VAXfp:mode><VAXint:mode>2"
325 [(set (match_operand:VAXint 0 "nonimmediate_operand" "")
326 (fix:VAXint (match_operand:VAXfp 1 "general_operand")))]
329 ;;- All kinds of add instructions.
331 (define_insn "add<mode>3"
332 [(set (match_operand:VAXfp 0 "nonimmediate_operand" "=g,g,g")
333 (plus:VAXfp (match_operand:VAXfp 1 "general_operand" "0,gF,gF")
334 (match_operand:VAXfp 2 "general_operand" "gF,0,gF")))]
337 add<VAXfp:fsfx>2 %2,%0
338 add<VAXfp:fsfx>2 %1,%0
339 add<VAXfp:fsfx>3 %1,%2,%0")
341 (define_insn "pushlclsymreg"
342 [(set (match_operand:SI 0 "push_operand" "=g")
343 (plus:SI (match_operand:SI 1 "register_operand" "%r")
344 (match_operand:SI 2 "local_symbolic_operand" "i")))]
348 (define_insn "pushextsymreg"
349 [(set (match_operand:SI 0 "push_operand" "=g")
350 (plus:SI (match_operand:SI 1 "register_operand" "%r")
351 (match_operand:SI 2 "external_symbolic_operand" "i")))]
355 (define_insn "movlclsymreg"
356 [(set (match_operand:SI 0 "nonimmediate_operand" "=g")
357 (plus:SI (match_operand:SI 1 "register_operand" "%r")
358 (match_operand:SI 2 "local_symbolic_operand" "i")))]
362 (define_insn "movextsymreg"
363 [(set (match_operand:SI 0 "nonimmediate_operand" "=g")
364 (plus:SI (match_operand:SI 1 "register_operand" "%r")
365 (match_operand:SI 2 "external_symbolic_operand" "i")))]
369 (define_insn "add<mode>3"
370 [(set (match_operand:VAXint 0 "nonimmediate_operand" "=g")
371 (plus:VAXint (match_operand:VAXint 1 "general_operand" "nrmT")
372 (match_operand:VAXint 2 "general_operand" "nrmT")))]
374 "* return vax_output_int_add (insn, operands, <MODE>mode);")
376 (define_expand "adddi3"
377 [(set (match_operand:DI 0 "nonimmediate_operand" "=g")
378 (plus:DI (match_operand:DI 1 "general_operand" "g")
379 (match_operand:DI 2 "general_operand" "g")))]
380 "!reload_in_progress"
381 "vax_expand_addsub_di_operands (operands, PLUS); DONE;")
383 (define_insn "adcdi3"
384 [(set (match_operand:DI 0 "nonimmediate_addsub_di_operand" "=Rr")
385 (plus:DI (match_operand:DI 1 "general_addsub_di_operand" "%0")
386 (match_operand:DI 2 "general_addsub_di_operand" "nRr")))]
388 "* return vax_output_int_add (insn, operands, DImode);")
390 ;; The add-with-carry (adwc) instruction only accepts two operands.
391 (define_insn "adddi3_old"
392 [(set (match_operand:DI 0 "nonimmediate_operand" "=ro>,ro>")
393 (plus:DI (match_operand:DI 1 "general_operand" "%0,ro>")
394 (match_operand:DI 2 "general_operand" "Fsro,Fs")))]
396 "* return vax_output_int_add (insn, operands, DImode);")
398 ;;- All kinds of subtract instructions.
400 (define_insn "sub<mode>3"
401 [(set (match_operand:VAXfp 0 "nonimmediate_operand" "=g,g")
402 (minus:VAXfp (match_operand:VAXfp 1 "general_operand" "0,gF")
403 (match_operand:VAXfp 2 "general_operand" "gF,gF")))]
406 sub<VAXfp:fsfx>2 %2,%0
407 sub<VAXfp:fsfx>3 %2,%1,%0")
409 (define_insn "sub<mode>3"
410 [(set (match_operand:VAXint 0 "nonimmediate_operand" "=g,g")
411 (minus:VAXint (match_operand:VAXint 1 "general_operand" "0,nrmT")
412 (match_operand:VAXint 2 "general_operand" "nrmT,nrmT")))]
415 sub<VAXint:isfx>2 %2,%0
416 sub<VAXint:isfx>3 %2,%1,%0")
418 (define_expand "subdi3"
419 [(set (match_operand:DI 0 "nonimmediate_operand" "=g")
420 (minus:DI (match_operand:DI 1 "general_operand" "g")
421 (match_operand:DI 2 "general_operand" "g")))]
422 "!reload_in_progress"
423 "vax_expand_addsub_di_operands (operands, MINUS); DONE;")
425 (define_insn "sbcdi3"
426 [(set (match_operand:DI 0 "nonimmediate_addsub_di_operand" "=Rr,Rr")
427 (minus:DI (match_operand:DI 1 "general_addsub_di_operand" "0,I")
428 (match_operand:DI 2 "general_addsub_di_operand" "nRr,Rr")))]
430 "* return vax_output_int_subtract (insn, operands, DImode);")
432 ;; The subtract-with-carry (sbwc) instruction only takes two operands.
433 (define_insn "subdi3_old"
434 [(set (match_operand:DI 0 "nonimmediate_operand" "=or>,or>")
435 (minus:DI (match_operand:DI 1 "general_operand" "0,or>")
436 (match_operand:DI 2 "general_operand" "Fsor,Fs")))]
438 "* return vax_output_int_subtract (insn, operands, DImode);")
440 ;;- Multiply instructions.
442 (define_insn "mul<mode>3"
443 [(set (match_operand:VAXfp 0 "nonimmediate_operand" "=g,g,g")
444 (mult:VAXfp (match_operand:VAXfp 1 "general_operand" "0,gF,gF")
445 (match_operand:VAXfp 2 "general_operand" "gF,0,gF")))]
448 mul<VAXfp:fsfx>2 %2,%0
449 mul<VAXfp:fsfx>2 %1,%0
450 mul<VAXfp:fsfx>3 %1,%2,%0")
452 (define_insn "mul<mode>3"
453 [(set (match_operand:VAXint 0 "nonimmediate_operand" "=g,g,g")
454 (mult:VAXint (match_operand:VAXint 1 "general_operand" "0,nrmT,nrmT")
455 (match_operand:VAXint 2 "general_operand" "nrmT,0,nrmT")))]
458 mul<VAXint:isfx>2 %2,%0
459 mul<VAXint:isfx>2 %1,%0
460 mul<VAXint:isfx>3 %1,%2,%0")
462 (define_insn "mulsidi3"
463 [(set (match_operand:DI 0 "nonimmediate_operand" "=g")
464 (mult:DI (sign_extend:DI
465 (match_operand:SI 1 "nonimmediate_operand" "nrmT"))
467 (match_operand:SI 2 "nonimmediate_operand" "nrmT"))))]
472 [(set (match_operand:DI 0 "nonimmediate_operand" "=g")
474 (mult:DI (sign_extend:DI
475 (match_operand:SI 1 "nonimmediate_operand" "nrmT"))
477 (match_operand:SI 2 "nonimmediate_operand" "nrmT")))
478 (sign_extend:DI (match_operand:SI 3 "nonimmediate_operand" "g"))))]
482 ;; 'F' constraint means type CONST_DOUBLE
484 [(set (match_operand:DI 0 "nonimmediate_operand" "=g")
486 (mult:DI (sign_extend:DI
487 (match_operand:SI 1 "nonimmediate_operand" "nrmT"))
489 (match_operand:SI 2 "nonimmediate_operand" "nrmT")))
490 (match_operand:DI 3 "immediate_operand" "F")))]
491 "GET_CODE (operands[3]) == CONST_DOUBLE
492 && CONST_DOUBLE_HIGH (operands[3]) == (CONST_DOUBLE_LOW (operands[3]) >> 31)"
495 if (CONST_DOUBLE_HIGH (operands[3]))
496 operands[3] = GEN_INT (CONST_DOUBLE_LOW (operands[3]));
497 return \"emul %1,%2,%3,%0\";
500 ;;- Divide instructions.
502 (define_insn "div<mode>3"
503 [(set (match_operand:VAXfp 0 "nonimmediate_operand" "=g,g")
504 (div:VAXfp (match_operand:VAXfp 1 "general_operand" "0,gF")
505 (match_operand:VAXfp 2 "general_operand" "gF,gF")))]
508 div<VAXfp:fsfx>2 %2,%0
509 div<VAXfp:fsfx>3 %2,%1,%0")
511 (define_insn "div<mode>3"
512 [(set (match_operand:VAXint 0 "nonimmediate_operand" "=g,g")
513 (div:VAXint (match_operand:VAXint 1 "general_operand" "0,nrmT")
514 (match_operand:VAXint 2 "general_operand" "nrmT,nrmT")))]
517 div<VAXint:isfx>2 %2,%0
518 div<VAXint:isfx>3 %2,%1,%0")
520 ;This is left out because it is very slow;
521 ;we are better off programming around the "lack" of this insn.
522 ;(define_insn "divmoddisi4"
523 ; [(set (match_operand:SI 0 "general_operand" "=g")
524 ; (div:SI (match_operand:DI 1 "general_operand" "g")
525 ; (match_operand:SI 2 "general_operand" "g")))
526 ; (set (match_operand:SI 3 "general_operand" "=g")
527 ; (mod:SI (match_operand:DI 1 "general_operand" "g")
528 ; (match_operand:SI 2 "general_operand" "g")))]
530 ; "ediv %2,%1,%0,%3")
532 ;; Bit-and on the VAX is done with a clear-bits insn.
533 (define_expand "and<mode>3"
534 [(set (match_operand:VAXint 0 "nonimmediate_operand" "")
535 (and:VAXint (not:VAXint (match_operand:VAXint 1 "general_operand" ""))
536 (match_operand:VAXint 2 "general_operand" "")))]
540 rtx op1 = operands[1];
542 /* If there is a constant argument, complement that one. */
543 if (CONST_INT_P (operands[2]) && ! CONST_INT_P (op1))
545 operands[1] = operands[2];
550 if (CONST_INT_P (op1))
551 operands[1] = GEN_INT (~INTVAL (op1));
553 operands[1] = expand_unop (<MODE>mode, one_cmpl_optab, op1, 0, 1);
556 (define_insn "*and<mode>"
557 [(set (match_operand:VAXint 0 "nonimmediate_operand" "=g,g")
558 (and:VAXint (not:VAXint (match_operand:VAXint 1 "general_operand" "nrmT,nrmT"))
559 (match_operand:VAXint 2 "general_operand" "0,nrmT")))]
562 bic<VAXint:isfx>2 %1,%0
563 bic<VAXint:isfx>3 %1,%2,%0")
565 ;; The following used to be needed because constant propagation can
566 ;; create them starting from the bic insn patterns above. This is no
567 ;; longer a problem. However, having these patterns allows optimization
568 ;; opportunities in combine.c.
570 (define_insn "*and<mode>_const_int"
571 [(set (match_operand:VAXint 0 "nonimmediate_operand" "=g,g")
572 (and:VAXint (match_operand:VAXint 1 "general_operand" "0,nrmT")
573 (match_operand:VAXint 2 "const_int_operand" "n,n")))]
576 bic<VAXint:isfx>2 %<VAXint:iprefx>2,%0
577 bic<VAXint:isfx>3 %<VAXint:iprefx>2,%1,%0")
580 ;;- Bit set instructions.
582 (define_insn "ior<mode>3"
583 [(set (match_operand:VAXint 0 "nonimmediate_operand" "=g,g,g")
584 (ior:VAXint (match_operand:VAXint 1 "general_operand" "0,nrmT,nrmT")
585 (match_operand:VAXint 2 "general_operand" "nrmT,0,nrmT")))]
588 bis<VAXint:isfx>2 %2,%0
589 bis<VAXint:isfx>2 %1,%0
590 bis<VAXint:isfx>3 %2,%1,%0")
592 ;;- xor instructions.
594 (define_insn "xor<mode>3"
595 [(set (match_operand:VAXint 0 "nonimmediate_operand" "=g,g,g")
596 (xor:VAXint (match_operand:VAXint 1 "general_operand" "0,nrmT,nrmT")
597 (match_operand:VAXint 2 "general_operand" "nrmT,0,nrmT")))]
600 xor<VAXint:isfx>2 %2,%0
601 xor<VAXint:isfx>2 %1,%0
602 xor<VAXint:isfx>3 %2,%1,%0")
605 (define_insn "neg<mode>2"
606 [(set (match_operand:VAXfp 0 "nonimmediate_operand" "=g")
607 (neg:VAXfp (match_operand:VAXfp 1 "general_operand" "gF")))]
609 "mneg<VAXfp:fsfx> %1,%0")
611 (define_insn "neg<mode>2"
612 [(set (match_operand:VAXint 0 "nonimmediate_operand" "=g")
613 (neg:VAXint (match_operand:VAXint 1 "general_operand" "nrmT")))]
615 "mneg<VAXint:isfx> %1,%0")
617 (define_insn "one_cmpl<mode>2"
618 [(set (match_operand:VAXint 0 "nonimmediate_operand" "=g")
619 (not:VAXint (match_operand:VAXint 1 "general_operand" "nrmT")))]
621 "mcom<VAXint:isfx> %1,%0")
624 ;; Arithmetic right shift on the VAX works by negating the shift count,
625 ;; then emitting a right shift with the shift count negated. This means
626 ;; that all actual shift counts in the RTL will be positive. This
627 ;; prevents converting shifts to ZERO_EXTRACTs with negative positions,
628 ;; which isn't valid.
629 (define_expand "ashrsi3"
630 [(set (match_operand:SI 0 "general_operand" "=g")
631 (ashiftrt:SI (match_operand:SI 1 "general_operand" "g")
632 (match_operand:QI 2 "general_operand" "g")))]
636 if (! CONST_INT_P(operands[2]))
637 operands[2] = gen_rtx_NEG (QImode, negate_rtx (QImode, operands[2]));
641 [(set (match_operand:SI 0 "nonimmediate_operand" "=g")
642 (ashiftrt:SI (match_operand:SI 1 "general_operand" "nrmT")
643 (match_operand:QI 2 "const_int_operand" "n")))]
648 [(set (match_operand:SI 0 "nonimmediate_operand" "=g")
649 (ashiftrt:SI (match_operand:SI 1 "general_operand" "nrmT")
650 (neg:QI (match_operand:QI 2 "general_operand" "g"))))]
654 (define_insn "ashlsi3"
655 [(set (match_operand:SI 0 "nonimmediate_operand" "=g")
656 (ashift:SI (match_operand:SI 1 "general_operand" "nrmT")
657 (match_operand:QI 2 "general_operand" "g")))]
661 if (operands[2] == const1_rtx && rtx_equal_p (operands[0], operands[1]))
662 return \"addl2 %0,%0\";
663 if (REG_P (operands[1]) && CONST_INT_P (operands[2]))
665 int i = INTVAL (operands[2]);
667 return \"addl3 %1,%1,%0\";
668 if (i == 2 && !optimize_size)
670 if (push_operand (operands[0], SImode))
671 return \"pushal 0[%1]\";
672 return \"moval 0[%1],%0\";
674 if (i == 3 && !optimize_size)
676 if (push_operand (operands[0], SImode))
677 return \"pushaq 0[%1]\";
678 return \"movaq 0[%1],%0\";
681 return \"ashl %2,%1,%0\";
684 ;; Arithmetic right shift on the VAX works by negating the shift count.
685 (define_expand "ashrdi3"
686 [(set (match_operand:DI 0 "general_operand" "=g")
687 (ashiftrt:DI (match_operand:DI 1 "general_operand" "g")
688 (match_operand:QI 2 "general_operand" "g")))]
692 operands[2] = gen_rtx_NEG (QImode, negate_rtx (QImode, operands[2]));
695 (define_insn "ashldi3"
696 [(set (match_operand:DI 0 "nonimmediate_operand" "=g")
697 (ashift:DI (match_operand:DI 1 "general_operand" "g")
698 (match_operand:QI 2 "general_operand" "g")))]
703 [(set (match_operand:DI 0 "nonimmediate_operand" "=g")
704 (ashiftrt:DI (match_operand:DI 1 "general_operand" "g")
705 (neg:QI (match_operand:QI 2 "general_operand" "g"))))]
709 ;; We used to have expand_shift handle logical right shifts by using extzv,
710 ;; but this make it very difficult to do lshrdi3. Since the VAX is the
711 ;; only machine with this kludge, it's better to just do this with a
712 ;; define_expand and remove that case from expand_shift.
714 (define_expand "lshrsi3"
716 (minus:QI (const_int 32)
718 (set (match_operand:SI 0 "nonimmediate_operand" "=g")
719 (zero_extract:SI (match_operand:SI 1 "register_operand" "r")
721 (match_operand:SI 2 "register_operand" "g")))]
725 operands[3] = gen_reg_rtx (QImode);
726 operands[4] = gen_lowpart (QImode, operands[2]);
729 ;; Rotate right on the VAX works by negating the shift count.
730 (define_expand "rotrsi3"
731 [(set (match_operand:SI 0 "general_operand" "=g")
732 (rotatert:SI (match_operand:SI 1 "general_operand" "g")
733 (match_operand:QI 2 "general_operand" "g")))]
737 if (! CONST_INT_P (operands[2]))
738 operands[2] = gen_rtx_NEG (QImode, negate_rtx (QImode, operands[2]));
741 (define_insn "rotlsi3"
742 [(set (match_operand:SI 0 "nonimmediate_operand" "=g")
743 (rotate:SI (match_operand:SI 1 "general_operand" "nrmT")
744 (match_operand:QI 2 "general_operand" "g")))]
749 [(set (match_operand:SI 0 "nonimmediate_operand" "=g")
750 (rotatert:SI (match_operand:SI 1 "general_operand" "nrmT")
751 (match_operand:QI 2 "const_int_operand" "n")))]
756 [(set (match_operand:SI 0 "nonimmediate_operand" "=g")
757 (rotatert:SI (match_operand:SI 1 "general_operand" "nrmT")
758 (neg:QI (match_operand:QI 2 "general_operand" "g"))))]
762 ;This insn is probably slower than a multiply and an add.
764 ; [(set (match_operand:SI 0 "general_operand" "=g")
765 ; (mult:SI (plus:SI (match_operand:SI 1 "general_operand" "g")
766 ; (match_operand:SI 2 "general_operand" "g"))
767 ; (match_operand:SI 3 "general_operand" "g")))]
769 ; "index %1,$0x80000000,$0x7fffffff,%3,%2,%0")
771 ;; Special cases of bit-field insns which we should
772 ;; recognize in preference to the general case.
773 ;; These handle aligned 8-bit and 16-bit fields,
774 ;; which can usually be done with move instructions.
777 [(set (zero_extract:SI (match_operand:SI 0 "register_operand" "+ro")
778 (match_operand:QI 1 "const_int_operand" "n")
779 (match_operand:SI 2 "const_int_operand" "n"))
780 (match_operand:SI 3 "general_operand" "g"))]
781 "(INTVAL (operands[1]) == 8 || INTVAL (operands[1]) == 16)
782 && INTVAL (operands[2]) % INTVAL (operands[1]) == 0
783 && (!MEM_P (operands[0])
784 || ! mode_dependent_address_p (XEXP (operands[0], 0),
785 MEM_ADDR_SPACE (operands[0])))"
788 if (REG_P (operands[0]))
790 if (INTVAL (operands[2]) != 0)
791 return \"insv %3,%2,%1,%0\";
795 = adjust_address (operands[0],
796 INTVAL (operands[1]) == 8 ? QImode : HImode,
797 INTVAL (operands[2]) / 8);
800 if (INTVAL (operands[1]) == 8)
801 return \"movb %3,%0\";
802 return \"movw %3,%0\";
806 [(set (match_operand:SI 0 "nonimmediate_operand" "=&g")
807 (zero_extract:SI (match_operand:SI 1 "register_operand" "ro")
808 (match_operand:QI 2 "const_int_operand" "n")
809 (match_operand:SI 3 "const_int_operand" "n")))]
810 "(INTVAL (operands[2]) == 8 || INTVAL (operands[2]) == 16)
811 && INTVAL (operands[3]) % INTVAL (operands[2]) == 0
812 && (!MEM_P (operands[1])
813 || ! mode_dependent_address_p (XEXP (operands[1], 0),
814 MEM_ADDR_SPACE (operands[1])))"
817 if (REG_P (operands[1]))
819 if (INTVAL (operands[3]) != 0)
820 return \"extzv %3,%2,%1,%0\";
824 = adjust_address (operands[1],
825 INTVAL (operands[2]) == 8 ? QImode : HImode,
826 INTVAL (operands[3]) / 8);
828 if (INTVAL (operands[2]) == 8)
829 return \"movzbl %1,%0\";
830 return \"movzwl %1,%0\";
834 [(set (match_operand:SI 0 "nonimmediate_operand" "=g")
835 (sign_extract:SI (match_operand:SI 1 "register_operand" "ro")
836 (match_operand:QI 2 "const_int_operand" "n")
837 (match_operand:SI 3 "const_int_operand" "n")))]
838 "(INTVAL (operands[2]) == 8 || INTVAL (operands[2]) == 16)
839 && INTVAL (operands[3]) % INTVAL (operands[2]) == 0
840 && (!MEM_P (operands[1])
841 || ! mode_dependent_address_p (XEXP (operands[1], 0),
842 MEM_ADDR_SPACE (operands[1])))"
845 if (REG_P (operands[1]))
847 if (INTVAL (operands[3]) != 0)
848 return \"extv %3,%2,%1,%0\";
852 = adjust_address (operands[1],
853 INTVAL (operands[2]) == 8 ? QImode : HImode,
854 INTVAL (operands[3]) / 8);
856 if (INTVAL (operands[2]) == 8)
857 return \"cvtbl %1,%0\";
858 return \"cvtwl %1,%0\";
861 ;; Register-only SImode cases of bit-field insns.
866 (sign_extract:SI (match_operand:SI 0 "register_operand" "r")
867 (match_operand:QI 1 "general_operand" "g")
868 (match_operand:SI 2 "general_operand" "nrmT"))
869 (match_operand:SI 3 "general_operand" "nrmT")))]
876 (zero_extract:SI (match_operand:SI 0 "register_operand" "r")
877 (match_operand:QI 1 "general_operand" "g")
878 (match_operand:SI 2 "general_operand" "nrmT"))
879 (match_operand:SI 3 "general_operand" "nrmT")))]
883 ;; When the field position and size are constant and the destination
884 ;; is a register, extv and extzv are much slower than a rotate followed
885 ;; by a bicl or sign extension. Because we might end up choosing ext[z]v
886 ;; anyway, we can't allow immediate values for the primary source operand.
889 [(set (match_operand:SI 0 "nonimmediate_operand" "=g")
890 (sign_extract:SI (match_operand:SI 1 "register_operand" "ro")
891 (match_operand:QI 2 "general_operand" "g")
892 (match_operand:SI 3 "general_operand" "nrmT")))]
896 if (! CONST_INT_P (operands[3]) || ! CONST_INT_P (operands[2])
897 || ! REG_P (operands[0])
898 || (INTVAL (operands[2]) != 8 && INTVAL (operands[2]) != 16))
899 return \"extv %3,%2,%1,%0\";
900 if (INTVAL (operands[2]) == 8)
901 return \"rotl %R3,%1,%0\;cvtbl %0,%0\";
902 return \"rotl %R3,%1,%0\;cvtwl %0,%0\";
906 [(set (match_operand:SI 0 "nonimmediate_operand" "=g")
907 (zero_extract:SI (match_operand:SI 1 "register_operand" "ro")
908 (match_operand:QI 2 "general_operand" "g")
909 (match_operand:SI 3 "general_operand" "nrmT")))]
913 if (! CONST_INT_P (operands[3]) || ! CONST_INT_P (operands[2])
914 || ! REG_P (operands[0]))
915 return \"extzv %3,%2,%1,%0\";
916 if (INTVAL (operands[2]) == 8)
917 return \"rotl %R3,%1,%0\;movzbl %0,%0\";
918 if (INTVAL (operands[2]) == 16)
919 return \"rotl %R3,%1,%0\;movzwl %0,%0\";
920 if (INTVAL (operands[3]) & 31)
921 return \"rotl %R3,%1,%0\;bicl2 %M2,%0\";
922 if (rtx_equal_p (operands[0], operands[1]))
923 return \"bicl2 %M2,%0\";
924 return \"bicl3 %M2,%1,%0\";
927 ;; Non-register cases.
928 ;; nonimmediate_operand is used to make sure that mode-ambiguous cases
929 ;; don't match these (and therefore match the cases above instead).
934 (sign_extract:SI (match_operand:QI 0 "memory_operand" "m")
935 (match_operand:QI 1 "general_operand" "g")
936 (match_operand:SI 2 "general_operand" "nrmT"))
937 (match_operand:SI 3 "general_operand" "nrmT")))]
944 (zero_extract:SI (match_operand:QI 0 "nonimmediate_operand" "rm")
945 (match_operand:QI 1 "general_operand" "g")
946 (match_operand:SI 2 "general_operand" "nrmT"))
947 (match_operand:SI 3 "general_operand" "nrmT")))]
952 [(set (match_operand:SI 0 "nonimmediate_operand" "=g")
953 (sign_extract:SI (match_operand:QI 1 "memory_operand" "m")
954 (match_operand:QI 2 "general_operand" "g")
955 (match_operand:SI 3 "general_operand" "nrmT")))]
959 if (!REG_P (operands[0]) || !CONST_INT_P (operands[2])
960 || !CONST_INT_P (operands[3])
961 || (INTVAL (operands[2]) != 8 && INTVAL (operands[2]) != 16)
962 || INTVAL (operands[2]) + INTVAL (operands[3]) > 32
963 || side_effects_p (operands[1])
964 || (MEM_P (operands[1])
965 && mode_dependent_address_p (XEXP (operands[1], 0),
966 MEM_ADDR_SPACE (operands[1]))))
967 return \"extv %3,%2,%1,%0\";
968 if (INTVAL (operands[2]) == 8)
969 return \"rotl %R3,%1,%0\;cvtbl %0,%0\";
970 return \"rotl %R3,%1,%0\;cvtwl %0,%0\";
973 (define_expand "extzv"
974 [(set (match_operand:SI 0 "general_operand" "")
975 (zero_extract:SI (match_operand:SI 1 "general_operand" "")
976 (match_operand:QI 2 "general_operand" "")
977 (match_operand:SI 3 "general_operand" "")))]
982 [(set (match_operand:SI 0 "nonimmediate_operand" "=g")
983 (zero_extract:SI (match_operand:QI 1 "memory_operand" "m")
984 (match_operand:QI 2 "general_operand" "g")
985 (match_operand:SI 3 "general_operand" "nrmT")))]
989 if (!REG_P (operands[0]) || !CONST_INT_P (operands[2])
990 || !CONST_INT_P (operands[3])
991 || INTVAL (operands[2]) + INTVAL (operands[3]) > 32
992 || side_effects_p (operands[1])
993 || (MEM_P (operands[1])
994 && mode_dependent_address_p (XEXP (operands[1], 0),
995 MEM_ADDR_SPACE (operands[1]))))
996 return \"extzv %3,%2,%1,%0\";
997 if (INTVAL (operands[2]) == 8)
998 return \"rotl %R3,%1,%0\;movzbl %0,%0\";
999 if (INTVAL (operands[2]) == 16)
1000 return \"rotl %R3,%1,%0\;movzwl %0,%0\";
1001 if (MEM_P (operands[1])
1002 && GET_CODE (XEXP (operands[1], 0)) == PLUS
1003 && REG_P (XEXP (XEXP (operands[1], 0), 0))
1004 && CONST_INT_P (XEXP (XEXP (operands[1], 0), 1))
1005 && CONST_INT_P (operands[2])
1006 && CONST_INT_P (operands[3]))
1008 HOST_WIDE_INT o = INTVAL (XEXP (XEXP (operands[1], 0), 1));
1009 HOST_WIDE_INT l = INTVAL (operands[2]);
1010 HOST_WIDE_INT v = INTVAL (operands[3]);
1011 if ((o & 3) && (o & 3) * 8 + v + l <= 32)
1014 tmp = XEXP (XEXP (operands[1], 0), 0);
1016 tmp = gen_rtx_PLUS (SImode, tmp, GEN_INT (o & ~3));
1017 operands[1] = gen_rtx_MEM (QImode, tmp);
1018 operands[3] = GEN_INT (v + (o & 3) * 8);
1021 return \"extzv %3,%2,%1,%0\";
1023 return \"rotl %R3,%1,%0\;bicl2 %M2,%0\";
1026 (define_expand "insv"
1027 [(set (zero_extract:SI (match_operand:SI 0 "general_operand" "")
1028 (match_operand:QI 1 "general_operand" "")
1029 (match_operand:SI 2 "general_operand" ""))
1030 (match_operand:SI 3 "general_operand" ""))]
1035 [(set (zero_extract:SI (match_operand:QI 0 "memory_operand" "+g")
1036 (match_operand:QI 1 "general_operand" "g")
1037 (match_operand:SI 2 "general_operand" "nrmT"))
1038 (match_operand:SI 3 "general_operand" "nrmT"))]
1042 if (MEM_P (operands[0])
1043 && GET_CODE (XEXP (operands[0], 0)) == PLUS
1044 && REG_P (XEXP (XEXP (operands[0], 0), 0))
1045 && CONST_INT_P (XEXP (XEXP (operands[0], 0), 1))
1046 && CONST_INT_P (operands[1])
1047 && CONST_INT_P (operands[2]))
1049 HOST_WIDE_INT o = INTVAL (XEXP (XEXP (operands[0], 0), 1));
1050 HOST_WIDE_INT v = INTVAL (operands[2]);
1051 HOST_WIDE_INT l = INTVAL (operands[1]);
1052 if ((o & 3) && (o & 3) * 8 + v + l <= 32)
1055 tmp = XEXP (XEXP (operands[0], 0), 0);
1057 tmp = gen_rtx_PLUS (SImode, tmp, GEN_INT (o & ~3));
1058 operands[0] = gen_rtx_MEM (QImode, tmp);
1059 operands[2] = GEN_INT (v + (o & 3) * 8);
1062 return \"insv %3,%2,%1,%0\";
1066 [(set (zero_extract:SI (match_operand:SI 0 "register_operand" "+r")
1067 (match_operand:QI 1 "general_operand" "g")
1068 (match_operand:SI 2 "general_operand" "nrmT"))
1069 (match_operand:SI 3 "general_operand" "nrmT"))]
1073 ;; Unconditional jump
1076 (label_ref (match_operand 0 "" "")))]
1080 ;; Conditional jumps
1082 (define_expand "cbranch<mode>4"
1084 (compare (match_operand:VAXint 1 "nonimmediate_operand" "")
1085 (match_operand:VAXint 2 "general_operand" "")))
1088 (match_operator 0 "ordered_comparison_operator" [(cc0)
1090 (label_ref (match_operand 3 "" ""))
1094 (define_expand "cbranch<mode>4"
1096 (compare (match_operand:VAXfp 1 "general_operand" "")
1097 (match_operand:VAXfp 2 "general_operand" "")))
1100 (match_operator 0 "ordered_comparison_operator" [(cc0)
1102 (label_ref (match_operand 3 "" ""))
1106 (define_insn "*branch"
1108 (if_then_else (match_operator 0 "ordered_comparison_operator"
1111 (label_ref (match_operand 1 "" ""))
1116 ;; Recognize reversed jumps.
1117 (define_insn "*branch_reversed"
1119 (if_then_else (match_operator 0 "ordered_comparison_operator"
1123 (label_ref (match_operand 1 "" ""))))]
1125 "j%C0 %l1") ; %C0 negates condition
1127 ;; Recognize jbs, jlbs, jbc and jlbc instructions. Note that the operand
1128 ;; of jlbs and jlbc insns are SImode in the hardware. However, if it is
1129 ;; memory, we use QImode in the insn. So we can't use those instructions
1130 ;; for mode-dependent addresses.
1135 (ne (zero_extract:SI (match_operand:QI 0 "memory_operand" "Q,g")
1137 (match_operand:SI 1 "general_operand" "I,nrmT"))
1139 (label_ref (match_operand 2 "" ""))
1149 (eq (zero_extract:SI (match_operand:QI 0 "memory_operand" "Q,g")
1151 (match_operand:SI 1 "general_operand" "I,nrmT"))
1153 (label_ref (match_operand 2 "" ""))
1163 (ne (zero_extract:SI (match_operand:SI 0 "register_operand" "r,r")
1165 (match_operand:SI 1 "general_operand" "I,nrmT"))
1167 (label_ref (match_operand 2 "" ""))
1177 (eq (zero_extract:SI (match_operand:SI 0 "register_operand" "r,r")
1179 (match_operand:SI 1 "general_operand" "I,nrmT"))
1181 (label_ref (match_operand 2 "" ""))
1188 ;; Subtract-and-jump and Add-and-jump insns.
1189 ;; These are not used when output is for the Unix assembler
1190 ;; because it does not know how to modify them to reach far.
1192 ;; Normal sob insns.
1197 (gt (plus:SI (match_operand:SI 0 "nonimmediate_operand" "+g")
1200 (label_ref (match_operand 1 "" ""))
1203 (plus:SI (match_dup 0)
1211 (ge (plus:SI (match_operand:SI 0 "nonimmediate_operand" "+g")
1214 (label_ref (match_operand 1 "" ""))
1217 (plus:SI (match_dup 0)
1222 ;; Normal aob insns. Define a version for when operands[1] is a constant.
1226 (lt (plus:SI (match_operand:SI 0 "nonimmediate_operand" "+g")
1228 (match_operand:SI 1 "general_operand" "nrmT"))
1229 (label_ref (match_operand 2 "" ""))
1232 (plus:SI (match_dup 0)
1235 "jaoblss %1,%0,%l2")
1240 (lt (match_operand:SI 0 "nonimmediate_operand" "+g")
1241 (match_operand:SI 1 "general_operand" "nrmT"))
1242 (label_ref (match_operand 2 "" ""))
1245 (plus:SI (match_dup 0)
1247 "!TARGET_UNIX_ASM && CONST_INT_P (operands[1])"
1248 "jaoblss %P1,%0,%l2")
1253 (le (plus:SI (match_operand:SI 0 "nonimmediate_operand" "+g")
1255 (match_operand:SI 1 "general_operand" "nrmT"))
1256 (label_ref (match_operand 2 "" ""))
1259 (plus:SI (match_dup 0)
1262 "jaobleq %1,%0,%l2")
1267 (le (match_operand:SI 0 "nonimmediate_operand" "+g")
1268 (match_operand:SI 1 "general_operand" "nrmT"))
1269 (label_ref (match_operand 2 "" ""))
1272 (plus:SI (match_dup 0)
1274 "!TARGET_UNIX_ASM && CONST_INT_P (operands[1])"
1275 "jaobleq %P1,%0,%l2")
1277 ;; Something like a sob insn, but compares against -1.
1278 ;; This finds `while (foo--)' which was changed to `while (--foo != -1)'.
1283 (ne (match_operand:SI 0 "nonimmediate_operand" "+g")
1285 (label_ref (match_operand 1 "" ""))
1288 (plus:SI (match_dup 0)
1291 "decl %0\;jgequ %l1")
1293 (define_expand "call_pop"
1294 [(parallel [(call (match_operand:QI 0 "memory_operand" "")
1295 (match_operand:SI 1 "const_int_operand" ""))
1296 (set (reg:SI VAX_SP_REGNUM)
1297 (plus:SI (reg:SI VAX_SP_REGNUM)
1298 (match_operand:SI 3 "immediate_operand" "")))])]
1301 gcc_assert (INTVAL (operands[3]) <= 255 * 4 && INTVAL (operands[3]) % 4 == 0);
1303 /* Operand 1 is the number of bytes to be popped by DW_CFA_GNU_args_size
1304 during EH unwinding. We must include the argument count pushed by
1305 the calls instruction. */
1306 operands[1] = GEN_INT (INTVAL (operands[3]) + 4);
1309 (define_insn "*call_pop"
1310 [(call (match_operand:QI 0 "memory_operand" "m")
1311 (match_operand:SI 1 "const_int_operand" "n"))
1312 (set (reg:SI VAX_SP_REGNUM) (plus:SI (reg:SI VAX_SP_REGNUM)
1313 (match_operand:SI 2 "immediate_operand" "i")))]
1316 operands[1] = GEN_INT ((INTVAL (operands[1]) - 4) / 4);
1317 return "calls %1,%0";
1320 (define_expand "call_value_pop"
1321 [(parallel [(set (match_operand 0 "" "")
1322 (call (match_operand:QI 1 "memory_operand" "")
1323 (match_operand:SI 2 "const_int_operand" "")))
1324 (set (reg:SI VAX_SP_REGNUM)
1325 (plus:SI (reg:SI VAX_SP_REGNUM)
1326 (match_operand:SI 4 "immediate_operand" "")))])]
1329 gcc_assert (INTVAL (operands[4]) <= 255 * 4 && INTVAL (operands[4]) % 4 == 0);
1331 /* Operand 2 is the number of bytes to be popped by DW_CFA_GNU_args_size
1332 during EH unwinding. We must include the argument count pushed by
1333 the calls instruction. */
1334 operands[2] = GEN_INT (INTVAL (operands[4]) + 4);
1337 (define_insn "*call_value_pop"
1338 [(set (match_operand 0 "" "")
1339 (call (match_operand:QI 1 "memory_operand" "m")
1340 (match_operand:SI 2 "const_int_operand" "n")))
1341 (set (reg:SI VAX_SP_REGNUM) (plus:SI (reg:SI VAX_SP_REGNUM)
1342 (match_operand:SI 3 "immediate_operand" "i")))]
1346 operands[2] = GEN_INT ((INTVAL (operands[2]) - 4) / 4);
1347 return \"calls %2,%1\";
1350 (define_expand "call"
1351 [(call (match_operand:QI 0 "memory_operand" "")
1352 (match_operand:SI 1 "const_int_operand" ""))]
1356 /* Operand 1 is the number of bytes to be popped by DW_CFA_GNU_args_size
1357 during EH unwinding. We must include the argument count pushed by
1358 the calls instruction. */
1359 operands[1] = GEN_INT (INTVAL (operands[1]) + 4);
1362 (define_insn "*call"
1363 [(call (match_operand:QI 0 "memory_operand" "m")
1364 (match_operand:SI 1 "const_int_operand" ""))]
1368 (define_expand "call_value"
1369 [(set (match_operand 0 "" "")
1370 (call (match_operand:QI 1 "memory_operand" "")
1371 (match_operand:SI 2 "const_int_operand" "")))]
1375 /* Operand 2 is the number of bytes to be popped by DW_CFA_GNU_args_size
1376 during EH unwinding. We must include the argument count pushed by
1377 the calls instruction. */
1378 operands[2] = GEN_INT (INTVAL (operands[2]) + 4);
1381 (define_insn "*call_value"
1382 [(set (match_operand 0 "" "")
1383 (call (match_operand:QI 1 "memory_operand" "m")
1384 (match_operand:SI 2 "const_int_operand" "")))]
1388 ;; Call subroutine returning any type.
1390 (define_expand "untyped_call"
1391 [(parallel [(call (match_operand 0 "" "")
1393 (match_operand 1 "" "")
1394 (match_operand 2 "" "")])]
1400 emit_call_insn (gen_call_pop (operands[0], const0_rtx, NULL, const0_rtx));
1402 for (i = 0; i < XVECLEN (operands[2], 0); i++)
1404 rtx set = XVECEXP (operands[2], 0, i);
1405 emit_move_insn (SET_DEST (set), SET_SRC (set));
1408 /* The optimizer does not know that the call sets the function value
1409 registers we stored in the result block. We avoid problems by
1410 claiming that all hard registers are used and clobbered at this
1412 emit_insn (gen_blockage ());
1417 ;; UNSPEC_VOLATILE is considered to use and clobber all hard registers and
1418 ;; all of memory. This blocks insns from being moved across this point.
1420 (define_insn "blockage"
1421 [(unspec_volatile [(const_int 0)] VUNSPEC_BLOCKAGE)]
1425 (define_insn "procedure_entry_mask"
1426 [(unspec_volatile [(match_operand 0 "const_int_operand")] VUNSPEC_PEM)]
1430 (define_insn "return"
1435 (define_expand "prologue"
1439 vax_expand_prologue ();
1443 (define_expand "epilogue"
1448 emit_jump_insn (gen_return ());
1457 ;; This had a wider constraint once, and it had trouble.
1458 ;; If you are tempted to try `g', please don't--it's not worth
1459 ;; the risk we will reopen the same bug.
1460 (define_insn "indirect_jump"
1461 [(set (pc) (match_operand:SI 0 "register_operand" "r"))]
1465 ;; This is here to accept 5 arguments (as passed by expand_end_case)
1466 ;; and pass the first 4 along to the casesi1 pattern that really does
1467 ;; the actual casesi work. We emit a jump here to the default label
1468 ;; _before_ the casesi so that we can be sure that the casesi never
1470 ;; This is suboptimal perhaps, but so is much of the rest of this
1471 ;; machine description. For what it's worth, HPPA uses the same trick.
1473 ;; operand 0 is index
1474 ;; operand 1 is the minimum bound (a const_int)
1475 ;; operand 2 is the maximum bound - minimum bound + 1 (also a const_int)
1476 ;; operand 3 is CODE_LABEL for the table;
1477 ;; operand 4 is the CODE_LABEL to go to if index out of range (ie. default).
1480 ;; i = index - minimum_bound
1481 ;; if (i > (maximum_bound - minimum_bound + 1) goto default;
1482 ;; casesi (i, 0, table);
1484 (define_expand "casesi"
1485 [(match_operand:SI 0 "general_operand" "")
1486 (match_operand:SI 1 "general_operand" "")
1487 (match_operand:SI 2 "general_operand" "")
1488 (match_operand 3 "" "")
1489 (match_operand 4 "" "")]
1494 /* i = index - minimum_bound;
1495 But only if the lower bound is not already zero. */
1496 if (operands[1] != const0_rtx)
1498 rtx index = gen_reg_rtx (SImode);
1499 emit_insn (gen_addsi3 (index,
1501 GEN_INT (-INTVAL (operands[1]))));
1502 operands[0] = index;
1505 /* if (i > (maximum_bound - minimum_bound + 1)) goto default; */
1506 test = gen_rtx_fmt_ee (GTU, VOIDmode, operands[0], operands[2]);
1507 emit_jump_insn (gen_cbranchsi4 (test, operands[0], operands[2], operands[4]));
1509 /* casesi (i, 0, table); */
1510 emit_jump_insn (gen_casesi1 (operands[0], operands[2], operands[3]));
1514 ;; This insn is a bit of a lier. It actually falls through if no case
1515 ;; matches. But, we prevent that from ever happening by emitting a jump
1516 ;; before this, see the define_expand above.
1517 (define_insn "casesi1"
1518 [(match_operand:SI 1 "const_int_operand" "n")
1520 (plus:SI (sign_extend:SI
1521 (mem:HI (plus:SI (mult:SI (match_operand:SI 0 "general_operand" "nrmT")
1524 (label_ref:SI (match_operand 2 "" ""))))]
1528 (define_insn "pushextsym"
1529 [(set (match_operand:SI 0 "push_operand" "=g")
1530 (match_operand:SI 1 "external_symbolic_operand" "i"))]
1534 (define_insn "movextsym"
1535 [(set (match_operand:SI 0 "nonimmediate_operand" "=g")
1536 (match_operand:SI 1 "external_symbolic_operand" "i"))]
1540 (define_insn "pushlclsym"
1541 [(set (match_operand:SI 0 "push_operand" "=g")
1542 (match_operand:SI 1 "local_symbolic_operand" "i"))]
1546 (define_insn "movlclsym"
1547 [(set (match_operand:SI 0 "nonimmediate_operand" "=g")
1548 (match_operand:SI 1 "local_symbolic_operand" "i"))]
1552 ;;- load or push effective address
1553 ;; These come after the move and add/sub patterns
1554 ;; because we don't want pushl $1 turned into pushad 1.
1555 ;; or addl3 r1,r2,r3 turned into movab 0(r1)[r2],r3.
1557 ;; It does not work to use constraints to distinguish pushes from moves,
1558 ;; because < matches any autodecrement, not just a push.
1560 (define_insn "pushaddr<mode>"
1561 [(set (match_operand:SI 0 "push_operand" "=g")
1562 (match_operand:VAXintQHSD 1 "address_operand" "p"))]
1564 "pusha<VAXintQHSD:isfx> %a1")
1566 (define_insn "movaddr<mode>"
1567 [(set (match_operand:SI 0 "nonimmediate_operand" "=g")
1568 (match_operand:VAXintQHSD 1 "address_operand" "p"))]
1570 "mova<VAXintQHSD:isfx> %a1,%0")
1572 (define_insn "pushaddr<mode>"
1573 [(set (match_operand:SI 0 "push_operand" "=g")
1574 (match_operand:VAXfp 1 "address_operand" "p"))]
1576 "pusha<VAXfp:fsfx> %a1")
1578 (define_insn "movaddr<mode>"
1579 [(set (match_operand:SI 0 "nonimmediate_operand" "=g")
1580 (match_operand:VAXfp 1 "address_operand" "p"))]
1582 "mova<VAXfp:fsfx> %a1,%0")
1584 ;; These used to be peepholes, but it is more straightforward to do them
1585 ;; as single insns. However, we must force the output to be a register
1586 ;; if it is not an offsettable address so that we know that we can assign
1589 ;; If we had a good way of evaluating the relative costs, these could be
1590 ;; machine-independent.
1592 ;; Optimize extzv ...,z; andl2 ...,z
1593 ;; or ashl ...,z; andl2 ...,z
1594 ;; with other operands constant. This is what the combiner converts the
1595 ;; above sequences to before attempting to recognize the new insn.
1598 [(set (match_operand:SI 0 "nonimmediate_operand" "=ro")
1599 (and:SI (ashiftrt:SI (match_operand:SI 1 "general_operand" "nrmT")
1600 (match_operand:QI 2 "const_int_operand" "n"))
1601 (match_operand:SI 3 "const_int_operand" "n")))]
1602 "(INTVAL (operands[3]) & ~((1 << (32 - INTVAL (operands[2]))) - 1)) == 0"
1605 unsigned long mask1 = INTVAL (operands[3]);
1606 unsigned long mask2 = (1 << (32 - INTVAL (operands[2]))) - 1;
1608 if ((mask1 & mask2) != mask1)
1609 operands[3] = GEN_INT (mask1 & mask2);
1611 return \"rotl %R2,%1,%0\;bicl2 %N3,%0\";
1614 ;; left-shift and mask
1615 ;; The only case where `ashl' is better is if the mask only turns off
1616 ;; bits that the ashl would anyways, in which case it should have been
1620 [(set (match_operand:SI 0 "nonimmediate_operand" "=ro")
1621 (and:SI (ashift:SI (match_operand:SI 1 "general_operand" "nrmT")
1622 (match_operand:QI 2 "const_int_operand" "n"))
1623 (match_operand:SI 3 "const_int_operand" "n")))]
1628 = GEN_INT (INTVAL (operands[3]) & ~((1 << INTVAL (operands[2])) - 1));
1629 return \"rotl %2,%1,%0\;bicl2 %N3,%0\";
1632 ;; Instruction sequence to sync the VAX instruction stream.
1633 (define_insn "sync_istream"
1634 [(unspec_volatile [(const_int 0)] VUNSPEC_SYNC_ISTREAM)]
1636 "movpsl -(%|sp)\;pushal 1(%|pc)\;rei")
1638 (define_expand "nonlocal_goto"
1639 [(use (match_operand 0 "general_operand" ""))
1640 (use (match_operand 1 "general_operand" ""))
1641 (use (match_operand 2 "general_operand" ""))
1642 (use (match_operand 3 "general_operand" ""))]
1645 rtx lab = operands[1];
1646 rtx stack = operands[2];
1647 rtx fp = operands[3];
1649 emit_clobber (gen_rtx_MEM (BLKmode, gen_rtx_SCRATCH (VOIDmode)));
1650 emit_clobber (gen_rtx_MEM (BLKmode, hard_frame_pointer_rtx));
1652 emit_move_insn (hard_frame_pointer_rtx, fp);
1653 emit_stack_restore (SAVE_NONLOCAL, stack);
1655 emit_use (hard_frame_pointer_rtx);
1656 emit_use (stack_pointer_rtx);
1658 /* We'll convert this to direct jump via a peephole optimization. */
1659 emit_indirect_jump (copy_to_reg (lab));