1 ;;- Machine description for GNU compiler, Vax Version
2 ;; Copyright (C) 1987, 1988, 1991 Free Software Foundation, Inc.
4 ;; This file is part of GNU CC.
6 ;; GNU CC 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 2, or (at your option)
11 ;; GNU CC 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 GNU CC; see the file COPYING. If not, write to
18 ;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
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 ;; We don't want to allow a constant operand for test insns because
30 ;; (set (cc0) (const_int foo)) has no mode information. Such insns will
31 ;; be folded while optimizing anyway.
35 (match_operand:SI 0 "nonimmediate_operand" "g"))]
41 (match_operand:HI 0 "nonimmediate_operand" "g"))]
47 (match_operand:QI 0 "nonimmediate_operand" "g"))]
53 (match_operand:DF 0 "general_operand" "gF"))]
59 (match_operand:SF 0 "general_operand" "gF"))]
65 (compare (match_operand:SI 0 "nonimmediate_operand" "g")
66 (match_operand:SI 1 "general_operand" "g")))]
72 (compare (match_operand:HI 0 "nonimmediate_operand" "g")
73 (match_operand:HI 1 "general_operand" "g")))]
79 (compare (match_operand:QI 0 "nonimmediate_operand" "g")
80 (match_operand:QI 1 "general_operand" "g")))]
86 (compare (match_operand:DF 0 "general_operand" "gF,gF")
87 (match_operand:DF 1 "general_operand" "G,gF")))]
95 (compare (match_operand:SF 0 "general_operand" "gF,gF")
96 (match_operand:SF 1 "general_operand" "G,gF")))]
104 (and:SI (match_operand:SI 0 "general_operand" "g")
105 (match_operand:SI 1 "general_operand" "g")))]
111 (and:HI (match_operand:HI 0 "general_operand" "g")
112 (match_operand:HI 1 "general_operand" "g")))]
118 (and:QI (match_operand:QI 0 "general_operand" "g")
119 (match_operand:QI 1 "general_operand" "g")))]
123 ;; The vax has no sltu or sgeu patterns, but does have two-operand
124 ;; add/subtract with carry. This is still better than the alternative.
125 ;; Since the cc0-using insn cannot be separated from the cc0-setting insn,
126 ;; and the two are created independently, we can't just use a define_expand
127 ;; to try to optimize this. (The "movl" and "clrl" insns alter the cc0
128 ;; flags, but leave the carry flag alone, but that can't easily be expressed.)
130 ;; Several two-operator combinations could be added to make slightly more
131 ;; optimal code, but they'd have to cover all combinations of plus and minus
132 ;; using match_dup. If you want to do this, I'd suggest changing the "sgeu"
133 ;; pattern to something like (minus (const_int 1) (ltu ...)), so fewer
134 ;; patterns need to be recognized.
135 ;; -- Ken Raeburn (Raeburn@Watch.COM) 24 August 1991.
138 [(set (match_operand:SI 0 "general_operand" "=ro")
139 (ltu (cc0) (const_int 0)))]
141 "clrl %0\;adwc $0,%0")
144 [(set (match_operand:SI 0 "general_operand" "=ro")
145 (geu (cc0) (const_int 0)))]
147 "movl $1,%0\;sbwc $0,%0")
150 [(set (match_operand:DF 0 "general_operand" "=g,g")
151 (match_operand:DF 1 "general_operand" "G,gF"))]
158 [(set (match_operand:SF 0 "general_operand" "=g,g")
159 (match_operand:SF 1 "general_operand" "G,gF"))]
165 ;; Some vaxes don't support this instruction.
166 ;;(define_insn "movti"
167 ;; [(set (match_operand:TI 0 "general_operand" "=g")
168 ;; (match_operand:TI 1 "general_operand" "g"))]
173 [(set (match_operand:DI 0 "general_operand" "=g,g")
174 (match_operand:DI 1 "general_operand" "I,g"))]
180 ;; The VAX move instructions have space-time tradeoffs. On a microVAX
181 ;; register-register mov instructions take 3 bytes and 2 CPU cycles. clrl
182 ;; takes 2 bytes and 3 cycles. mov from constant to register takes 2 cycles
183 ;; if the constant is smaller than 4 bytes, 3 cycles for a longword
184 ;; constant. movz, mneg, and mcom are as fast as mov, so movzwl is faster
185 ;; than movl for positive constants that fit in 16 bits but not 6 bits. cvt
186 ;; instructions take 4 cycles. inc takes 3 cycles. The machine description
187 ;; is willing to trade 1 byte for 1 cycle (clrl instead of movl $0; cvtwl
190 ;; Cycle counts for other models may vary (on a VAX 750 they are similar,
191 ;; but on a VAX 9000 most move and add instructions with one constant
192 ;; operand take 1 cycle).
194 ;; Loads of constants between 64 and 128 used to be done with
195 ;; "addl3 $63,#,dst" but this is slower than movzbl and takes as much space.
198 [(set (match_operand:SI 0 "general_operand" "=g")
199 (match_operand:SI 1 "general_operand" "g"))]
204 if (operands[1] == const1_rtx
205 && (link = find_reg_note (insn, REG_WAS_0, 0))
206 /* Make sure the insn that stored the 0 is still present. */
207 && ! INSN_DELETED_P (XEXP (link, 0))
208 && GET_CODE (XEXP (link, 0)) != NOTE
209 /* Make sure cross jumping didn't happen here. */
210 && no_labels_between_p (XEXP (link, 0), insn)
211 /* Make sure the reg hasn't been clobbered. */
212 && ! reg_set_between_p (operands[0], XEXP (link, 0), insn))
214 if (GET_CODE (operands[1]) == SYMBOL_REF || GET_CODE (operands[1]) == CONST)
216 if (push_operand (operands[0], SImode))
217 return \"pushab %a1\";
218 return \"movab %a1,%0\";
220 if (operands[1] == const0_rtx)
222 if (GET_CODE (operands[1]) == CONST_INT
223 && (unsigned) INTVAL (operands[1]) >= 64)
225 int i = INTVAL (operands[1]);
226 if ((unsigned)(~i) < 64)
227 return \"mcoml %N1,%0\";
228 if ((unsigned)i < 0x100)
229 return \"movzbl %1,%0\";
230 if (i >= -0x80 && i < 0)
231 return \"cvtbl %1,%0\";
232 if ((unsigned)i < 0x10000)
233 return \"movzwl %1,%0\";
234 if (i >= -0x8000 && i < 0)
235 return \"cvtwl %1,%0\";
237 if (push_operand (operands[0], SImode))
239 return \"movl %1,%0\";
243 [(set (match_operand:HI 0 "general_operand" "=g")
244 (match_operand:HI 1 "general_operand" "g"))]
249 if (operands[1] == const1_rtx
250 && (link = find_reg_note (insn, REG_WAS_0, 0))
251 /* Make sure the insn that stored the 0 is still present. */
252 && ! INSN_DELETED_P (XEXP (link, 0))
253 && GET_CODE (XEXP (link, 0)) != NOTE
254 /* Make sure cross jumping didn't happen here. */
255 && no_labels_between_p (XEXP (link, 0), insn)
256 /* Make sure the reg hasn't been clobbered. */
257 && ! reg_set_between_p (operands[0], XEXP (link, 0), insn))
260 if (GET_CODE (operands[1]) == CONST_INT)
262 int i = INTVAL (operands[1]);
265 else if ((unsigned int)i < 64)
266 return \"movw %1,%0\";
267 else if ((unsigned int)~i < 64)
268 return \"mcomw %H1,%0\";
269 else if ((unsigned int)i < 256)
270 return \"movzbw %1,%0\";
272 return \"movw %1,%0\";
275 (define_insn "movstricthi"
276 [(set (strict_low_part (match_operand:HI 0 "register_operand" "=g"))
277 (match_operand:HI 1 "general_operand" "g"))]
281 if (GET_CODE (operands[1]) == CONST_INT)
283 int i = INTVAL (operands[1]);
286 else if ((unsigned int)i < 64)
287 return \"movw %1,%0\";
288 else if ((unsigned int)~i < 64)
289 return \"mcomw %H1,%0\";
290 else if ((unsigned int)i < 256)
291 return \"movzbw %1,%0\";
293 return \"movw %1,%0\";
297 [(set (match_operand:QI 0 "general_operand" "=g")
298 (match_operand:QI 1 "general_operand" "g"))]
303 if (operands[1] == const1_rtx
304 && (link = find_reg_note (insn, REG_WAS_0, 0))
305 /* Make sure the insn that stored the 0 is still present. */
306 && ! INSN_DELETED_P (XEXP (link, 0))
307 && GET_CODE (XEXP (link, 0)) != NOTE
308 /* Make sure cross jumping didn't happen here. */
309 && no_labels_between_p (XEXP (link, 0), insn)
310 /* Make sure the reg hasn't been clobbered. */
311 && ! reg_set_between_p (operands[0], XEXP (link, 0), insn))
314 if (GET_CODE (operands[1]) == CONST_INT)
316 int i = INTVAL (operands[1]);
319 else if ((unsigned int)~i < 64)
320 return \"mcomb %B1,%0\";
322 return \"movb %1,%0\";
325 (define_insn "movstrictqi"
326 [(set (strict_low_part (match_operand:QI 0 "register_operand" "=g"))
327 (match_operand:QI 1 "general_operand" "g"))]
331 if (GET_CODE (operands[1]) == CONST_INT)
333 int i = INTVAL (operands[1]);
336 else if ((unsigned int)~i < 64)
337 return \"mcomb %B1,%0\";
339 return \"movb %1,%0\";
342 ;; This is here to accept 4 arguments and pass the first 3 along
343 ;; to the movstrhi1 pattern that really does the work.
344 (define_expand "movstrhi"
345 [(set (match_operand:BLK 0 "general_operand" "=g")
346 (match_operand:BLK 1 "general_operand" "g"))
347 (use (match_operand:HI 2 "general_operand" "g"))
348 (match_operand 3 "" "")]
351 emit_insn (gen_movstrhi1 (operands[0], operands[1], operands[2]));
355 ;; The definition of this insn does not really explain what it does,
356 ;; but it should suffice
357 ;; that anything generated as this insn will be recognized as one
358 ;; and that it won't successfully combine with anything.
359 (define_insn "movstrhi1"
360 [(set (match_operand:BLK 0 "general_operand" "=g")
361 (match_operand:BLK 1 "general_operand" "g"))
362 (use (match_operand:HI 2 "general_operand" "g"))
368 (clobber (reg:SI 5))]
372 ;; Extension and truncation insns.
374 (define_insn "truncsiqi2"
375 [(set (match_operand:QI 0 "general_operand" "=g")
376 (truncate:QI (match_operand:SI 1 "nonimmediate_operand" "g")))]
380 (define_insn "truncsihi2"
381 [(set (match_operand:HI 0 "general_operand" "=g")
382 (truncate:HI (match_operand:SI 1 "nonimmediate_operand" "g")))]
386 (define_insn "trunchiqi2"
387 [(set (match_operand:QI 0 "general_operand" "=g")
388 (truncate:QI (match_operand:HI 1 "nonimmediate_operand" "g")))]
392 (define_insn "extendhisi2"
393 [(set (match_operand:SI 0 "general_operand" "=g")
394 (sign_extend:SI (match_operand:HI 1 "nonimmediate_operand" "g")))]
398 (define_insn "extendqihi2"
399 [(set (match_operand:HI 0 "general_operand" "=g")
400 (sign_extend:HI (match_operand:QI 1 "nonimmediate_operand" "g")))]
404 (define_insn "extendqisi2"
405 [(set (match_operand:SI 0 "general_operand" "=g")
406 (sign_extend:SI (match_operand:QI 1 "nonimmediate_operand" "g")))]
410 (define_insn "extendsfdf2"
411 [(set (match_operand:DF 0 "general_operand" "=g")
412 (float_extend:DF (match_operand:SF 1 "general_operand" "gF")))]
416 (define_insn "truncdfsf2"
417 [(set (match_operand:SF 0 "general_operand" "=g")
418 (float_truncate:SF (match_operand:DF 1 "general_operand" "gF")))]
422 (define_insn "zero_extendhisi2"
423 [(set (match_operand:SI 0 "general_operand" "=g")
424 (zero_extend:SI (match_operand:HI 1 "nonimmediate_operand" "g")))]
428 (define_insn "zero_extendqihi2"
429 [(set (match_operand:HI 0 "general_operand" "=g")
430 (zero_extend:HI (match_operand:QI 1 "nonimmediate_operand" "g")))]
434 (define_insn "zero_extendqisi2"
435 [(set (match_operand:SI 0 "general_operand" "=g")
436 (zero_extend:SI (match_operand:QI 1 "nonimmediate_operand" "g")))]
440 ;; Fix-to-float conversion insns.
442 (define_insn "floatsisf2"
443 [(set (match_operand:SF 0 "general_operand" "=g")
444 (float:SF (match_operand:SI 1 "nonimmediate_operand" "g")))]
448 (define_insn "floatsidf2"
449 [(set (match_operand:DF 0 "general_operand" "=g")
450 (float:DF (match_operand:SI 1 "nonimmediate_operand" "g")))]
454 (define_insn "floathisf2"
455 [(set (match_operand:SF 0 "general_operand" "=g")
456 (float:SF (match_operand:HI 1 "nonimmediate_operand" "g")))]
460 (define_insn "floathidf2"
461 [(set (match_operand:DF 0 "general_operand" "=g")
462 (float:DF (match_operand:HI 1 "nonimmediate_operand" "g")))]
466 (define_insn "floatqisf2"
467 [(set (match_operand:SF 0 "general_operand" "=g")
468 (float:SF (match_operand:QI 1 "nonimmediate_operand" "g")))]
472 (define_insn "floatqidf2"
473 [(set (match_operand:DF 0 "general_operand" "=g")
474 (float:DF (match_operand:QI 1 "nonimmediate_operand" "g")))]
478 ;; Float-to-fix conversion insns.
480 (define_insn "fix_truncsfqi2"
481 [(set (match_operand:QI 0 "general_operand" "=g")
482 (fix:QI (fix:SF (match_operand:SF 1 "general_operand" "gF"))))]
486 (define_insn "fix_truncsfhi2"
487 [(set (match_operand:HI 0 "general_operand" "=g")
488 (fix:HI (fix:SF (match_operand:SF 1 "general_operand" "gF"))))]
492 (define_insn "fix_truncsfsi2"
493 [(set (match_operand:SI 0 "general_operand" "=g")
494 (fix:SI (fix:SF (match_operand:SF 1 "general_operand" "gF"))))]
498 (define_insn "fix_truncdfqi2"
499 [(set (match_operand:QI 0 "general_operand" "=g")
500 (fix:QI (fix:DF (match_operand:DF 1 "general_operand" "gF"))))]
504 (define_insn "fix_truncdfhi2"
505 [(set (match_operand:HI 0 "general_operand" "=g")
506 (fix:HI (fix:DF (match_operand:DF 1 "general_operand" "gF"))))]
510 (define_insn "fix_truncdfsi2"
511 [(set (match_operand:SI 0 "general_operand" "=g")
512 (fix:SI (fix:DF (match_operand:DF 1 "general_operand" "gF"))))]
516 ;;- All kinds of add instructions.
518 (define_insn "adddf3"
519 [(set (match_operand:DF 0 "general_operand" "=g,g,g")
520 (plus:DF (match_operand:DF 1 "general_operand" "0,gF,gF")
521 (match_operand:DF 2 "general_operand" "gF,0,gF")))]
528 (define_insn "addsf3"
529 [(set (match_operand:SF 0 "general_operand" "=g,g,g")
530 (plus:SF (match_operand:SF 1 "general_operand" "0,gF,gF")
531 (match_operand:SF 2 "general_operand" "gF,0,gF")))]
538 /* The space-time-opcode tradeoffs for addition vary by model of VAX.
540 On a VAX 3 "movab (r1)[r2],r3" is faster than "addl3 r1,r2,r3",
541 but it not faster on other models.
543 "movab #(r1),r2" is usually shorter than "addl3 #,r1,r2", and is
544 faster on a VAX 3, but some VAXes (e.g. VAX 9000) will stall if
545 a register is used in an address too soon after it is set.
546 Compromise by using movab only when it is shorter than the add
547 or the base register in the address is one of sp, ap, and fp,
548 which are not modified very often. */
551 (define_insn "addsi3"
552 [(set (match_operand:SI 0 "general_operand" "=g")
553 (plus:SI (match_operand:SI 1 "general_operand" "g")
554 (match_operand:SI 2 "general_operand" "g")))]
558 if (rtx_equal_p (operands[0], operands[1]))
560 if (operands[2] == const1_rtx)
562 if (operands[2] == constm1_rtx)
564 if (GET_CODE (operands[2]) == CONST_INT
565 && (unsigned) (- INTVAL (operands[2])) < 64)
566 return \"subl2 $%n2,%0\";
567 if (GET_CODE (operands[2]) == CONST_INT
568 && (unsigned) INTVAL (operands[2]) >= 64
569 && GET_CODE (operands[1]) == REG
570 && ((INTVAL (operands[2]) < 32767 && INTVAL (operands[2]) > -32768)
571 || REGNO (operands[1]) > 11))
572 return \"movab %c2(%1),%0\";
573 return \"addl2 %2,%0\";
575 if (rtx_equal_p (operands[0], operands[2]))
576 return \"addl2 %1,%0\";
578 if (GET_CODE (operands[2]) == CONST_INT
579 && INTVAL (operands[2]) < 32767
580 && INTVAL (operands[2]) > -32768
581 && GET_CODE (operands[1]) == REG
582 && push_operand (operands[0], SImode))
583 return \"pushab %c2(%1)\";
585 if (GET_CODE (operands[2]) == CONST_INT
586 && (unsigned) (- INTVAL (operands[2])) < 64)
587 return \"subl3 $%n2,%1,%0\";
589 if (GET_CODE (operands[2]) == CONST_INT
590 && (unsigned) INTVAL (operands[2]) >= 64
591 && GET_CODE (operands[1]) == REG
592 && ((INTVAL (operands[2]) < 32767 && INTVAL (operands[2]) > -32768)
593 || REGNO (operands[1]) > 11))
594 return \"movab %c2(%1),%0\";
596 /* Add this if using gcc on a VAX 3xxx:
597 if (REG_P (operands[1]) && REG_P (operands[2]))
598 return \"movab (%1)[%2],%0\";
600 return \"addl3 %1,%2,%0\";
603 (define_insn "addhi3"
604 [(set (match_operand:HI 0 "general_operand" "=g")
605 (plus:HI (match_operand:HI 1 "general_operand" "g")
606 (match_operand:HI 2 "general_operand" "g")))]
610 if (rtx_equal_p (operands[0], operands[1]))
612 if (operands[2] == const1_rtx)
614 if (operands[2] == constm1_rtx)
616 if (GET_CODE (operands[2]) == CONST_INT
617 && (unsigned) (- INTVAL (operands[2])) < 64)
618 return \"subw2 $%n2,%0\";
619 return \"addw2 %2,%0\";
621 if (rtx_equal_p (operands[0], operands[2]))
622 return \"addw2 %1,%0\";
623 if (GET_CODE (operands[2]) == CONST_INT
624 && (unsigned) (- INTVAL (operands[2])) < 64)
625 return \"subw3 $%n2,%1,%0\";
626 return \"addw3 %1,%2,%0\";
629 (define_insn "addqi3"
630 [(set (match_operand:QI 0 "general_operand" "=g")
631 (plus:QI (match_operand:QI 1 "general_operand" "g")
632 (match_operand:QI 2 "general_operand" "g")))]
636 if (rtx_equal_p (operands[0], operands[1]))
638 if (operands[2] == const1_rtx)
640 if (operands[2] == constm1_rtx)
642 if (GET_CODE (operands[2]) == CONST_INT
643 && (unsigned) (- INTVAL (operands[2])) < 64)
644 return \"subb2 $%n2,%0\";
645 return \"addb2 %2,%0\";
647 if (rtx_equal_p (operands[0], operands[2]))
648 return \"addb2 %1,%0\";
649 if (GET_CODE (operands[2]) == CONST_INT
650 && (unsigned) (- INTVAL (operands[2])) < 64)
651 return \"subb3 $%n2,%1,%0\";
652 return \"addb3 %1,%2,%0\";
655 ;; The add-with-carry (adwc) instruction only accepts two operands.
656 (define_insn "adddi3"
657 [(set (match_operand:DI 0 "general_operand" "=ro>,ro>")
658 (plus:DI (match_operand:DI 1 "general_operand" "%0,ro>")
659 (match_operand:DI 2 "general_operand" "Fro,F")))]
667 split_quadword_operands (operands, low, 3);
669 if (rtx_equal_p (operands[0], operands[1]))
671 if (low[2] == const0_rtx)
672 /* Should examine operand, punt if not POST_INC. */
673 pattern = \"tstl %0\", carry = 0;
674 else if (low[2] == const1_rtx)
675 pattern = \"incl %0\";
677 pattern = \"addl2 %2,%0\";
681 if (low[2] == const0_rtx)
682 pattern = \"movl %1,%0\", carry = 0;
684 pattern = \"addl3 %2,%1,%0\";
687 output_asm_insn (pattern, low);
689 /* If CARRY is 0, we don't have any carry value to worry about. */
690 return OUT_FCN (CODE_FOR_addsi3) (operands, insn);
691 /* %0 = C + %1 + %2 */
692 if (!rtx_equal_p (operands[0], operands[1]))
693 output_asm_insn ((operands[1] == const0_rtx
695 : \"movl %1,%0\"), operands);
696 return \"adwc %2,%0\";
699 ;;- All kinds of subtract instructions.
701 (define_insn "subdf3"
702 [(set (match_operand:DF 0 "general_operand" "=g,g")
703 (minus:DF (match_operand:DF 1 "general_operand" "0,gF")
704 (match_operand:DF 2 "general_operand" "gF,gF")))]
710 (define_insn "subsf3"
711 [(set (match_operand:SF 0 "general_operand" "=g,g")
712 (minus:SF (match_operand:SF 1 "general_operand" "0,gF")
713 (match_operand:SF 2 "general_operand" "gF,gF")))]
719 (define_insn "subsi3"
720 [(set (match_operand:SI 0 "general_operand" "=g,g")
721 (minus:SI (match_operand:SI 1 "general_operand" "0,g")
722 (match_operand:SI 2 "general_operand" "g,g")))]
728 (define_insn "subhi3"
729 [(set (match_operand:HI 0 "general_operand" "=g,g")
730 (minus:HI (match_operand:HI 1 "general_operand" "0,g")
731 (match_operand:HI 2 "general_operand" "g,g")))]
737 (define_insn "subqi3"
738 [(set (match_operand:QI 0 "general_operand" "=g,g")
739 (minus:QI (match_operand:QI 1 "general_operand" "0,g")
740 (match_operand:QI 2 "general_operand" "g,g")))]
746 ;; The subtract-with-carry (sbwc) instruction only takes two operands.
747 (define_insn "subdi3"
748 [(set (match_operand:DI 0 "general_operand" "=or>,or>")
749 (minus:DI (match_operand:DI 1 "general_operand" "0,or>")
750 (match_operand:DI 2 "general_operand" "For,F")))]
758 split_quadword_operands (operands, low, 3);
759 /* Subtract low parts. */
760 if (rtx_equal_p (operands[0], operands[1]))
762 if (low[2] == const0_rtx)
763 pattern = 0, carry = 0;
764 else if (low[2] == constm1_rtx)
765 pattern = \"decl %0\";
767 pattern = \"subl2 %2,%0\";
771 if (low[2] == constm1_rtx)
772 pattern = \"decl %0\";
773 else if (low[2] == const0_rtx)
774 pattern = OUT_FCN (CODE_FOR_movsi) (low, insn), carry = 0;
776 pattern = \"subl3 %2,%1,%0\";
779 output_asm_insn (pattern, low);
782 if (!rtx_equal_p (operands[0], operands[1]))
783 return \"movl %1,%0\;sbwc %2,%0\";
784 return \"sbwc %2,%0\";
785 /* %0 = %2 - %1 - C */
787 return OUT_FCN (CODE_FOR_subsi3) (operands, insn);
790 ;;- Multiply instructions.
792 (define_insn "muldf3"
793 [(set (match_operand:DF 0 "general_operand" "=g,g,g")
794 (mult:DF (match_operand:DF 1 "general_operand" "0,gF,gF")
795 (match_operand:DF 2 "general_operand" "gF,0,gF")))]
802 (define_insn "mulsf3"
803 [(set (match_operand:SF 0 "general_operand" "=g,g,g")
804 (mult:SF (match_operand:SF 1 "general_operand" "0,gF,gF")
805 (match_operand:SF 2 "general_operand" "gF,0,gF")))]
812 (define_insn "mulsi3"
813 [(set (match_operand:SI 0 "general_operand" "=g,g,g")
814 (mult:SI (match_operand:SI 1 "general_operand" "0,g,g")
815 (match_operand:SI 2 "general_operand" "g,0,g")))]
822 (define_insn "mulhi3"
823 [(set (match_operand:HI 0 "general_operand" "=g,g,")
824 (mult:HI (match_operand:HI 1 "general_operand" "0,g,g")
825 (match_operand:HI 2 "general_operand" "g,0,g")))]
832 (define_insn "mulqi3"
833 [(set (match_operand:QI 0 "general_operand" "=g,g,g")
834 (mult:QI (match_operand:QI 1 "general_operand" "0,g,g")
835 (match_operand:QI 2 "general_operand" "g,0,g")))]
842 (define_insn "mulsidi3"
843 [(set (match_operand:DI 0 "general_operand" "=g")
844 (mult:DI (sign_extend:DI
845 (match_operand:SI 1 "nonimmediate_operand" "g"))
847 (match_operand:SI 2 "nonimmediate_operand" "g"))))]
852 [(set (match_operand:DI 0 "general_operand" "=g")
854 (mult:DI (sign_extend:DI
855 (match_operand:SI 1 "nonimmediate_operand" "g"))
857 (match_operand:SI 2 "nonimmediate_operand" "g")))
858 (sign_extend:DI (match_operand:SI 3 "nonimmediate_operand" "g"))))]
862 ;; 'F' constraint means type CONST_DOUBLE
864 [(set (match_operand:DI 0 "general_operand" "=g")
866 (mult:DI (sign_extend:DI
867 (match_operand:SI 1 "nonimmediate_operand" "g"))
869 (match_operand:SI 2 "nonimmediate_operand" "g")))
870 (match_operand:DI 3 "immediate_operand" "F")))]
871 "GET_CODE (operands[3]) == CONST_DOUBLE
872 && CONST_DOUBLE_HIGH (operands[3]) == (CONST_DOUBLE_LOW (operands[3]) >> 31)"
875 if (CONST_DOUBLE_HIGH (operands[3]))
876 operands[3] = gen_rtx (CONST_INT, VOIDmode, CONST_DOUBLE_LOW (operands[3]));
877 return \"emul %1,%2,%3,%0\";
880 ;;- Divide instructions.
882 (define_insn "divdf3"
883 [(set (match_operand:DF 0 "general_operand" "=g,g")
884 (div:DF (match_operand:DF 1 "general_operand" "0,gF")
885 (match_operand:DF 2 "general_operand" "gF,gF")))]
891 (define_insn "divsf3"
892 [(set (match_operand:SF 0 "general_operand" "=g,g")
893 (div:SF (match_operand:SF 1 "general_operand" "0,gF")
894 (match_operand:SF 2 "general_operand" "gF,gF")))]
900 (define_insn "divsi3"
901 [(set (match_operand:SI 0 "general_operand" "=g,g")
902 (div:SI (match_operand:SI 1 "general_operand" "0,g")
903 (match_operand:SI 2 "general_operand" "g,g")))]
909 (define_insn "divhi3"
910 [(set (match_operand:HI 0 "general_operand" "=g,g")
911 (div:HI (match_operand:HI 1 "general_operand" "0,g")
912 (match_operand:HI 2 "general_operand" "g,g")))]
918 (define_insn "divqi3"
919 [(set (match_operand:QI 0 "general_operand" "=g,g")
920 (div:QI (match_operand:QI 1 "general_operand" "0,g")
921 (match_operand:QI 2 "general_operand" "g,g")))]
927 ;This is left out because it is very slow;
928 ;we are better off programming around the "lack" of this insn.
929 ;(define_insn "divmoddisi4"
930 ; [(set (match_operand:SI 0 "general_operand" "=g")
931 ; (div:SI (match_operand:DI 1 "general_operand" "g")
932 ; (match_operand:SI 2 "general_operand" "g")))
933 ; (set (match_operand:SI 3 "general_operand" "=g")
934 ; (mod:SI (match_operand:DI 1 "general_operand" "g")
935 ; (match_operand:SI 2 "general_operand" "g")))]
937 ; "ediv %2,%1,%0,%3")
939 ;; Bit-and on the vax is done with a clear-bits insn.
940 (define_expand "andsi3"
941 [(set (match_operand:SI 0 "general_operand" "=g")
942 (and:SI (not:SI (match_operand:SI 1 "general_operand" "g"))
943 (match_operand:SI 2 "general_operand" "g")))]
947 rtx op1 = operands[1];
949 /* If there is a constant argument, complement that one. */
950 if (GET_CODE (operands[2]) == CONST_INT && GET_CODE (op1) != CONST_INT)
952 operands[1] = operands[2];
957 if (GET_CODE (op1) == CONST_INT)
958 operands[1] = gen_rtx (CONST_INT, VOIDmode, ~INTVAL (op1));
960 operands[1] = expand_unop (SImode, one_cmpl_optab, op1, 0, 1);
963 (define_expand "andhi3"
964 [(set (match_operand:HI 0 "general_operand" "=g")
965 (and:HI (not:HI (match_operand:HI 1 "general_operand" "g"))
966 (match_operand:HI 2 "general_operand" "g")))]
970 rtx op1 = operands[1];
972 if (GET_CODE (operands[2]) == CONST_INT && GET_CODE (op1) != CONST_INT)
974 operands[1] = operands[2];
979 if (GET_CODE (op1) == CONST_INT)
980 operands[1] = gen_rtx (CONST_INT, VOIDmode, 65535 & ~INTVAL (op1));
982 operands[1] = expand_unop (HImode, one_cmpl_optab, op1, 0, 1);
985 (define_expand "andqi3"
986 [(set (match_operand:QI 0 "general_operand" "=g")
987 (and:QI (not:QI (match_operand:QI 1 "general_operand" "g"))
988 (match_operand:QI 2 "general_operand" "g")))]
992 rtx op1 = operands[1];
994 if (GET_CODE (operands[2]) == CONST_INT && GET_CODE (op1) != CONST_INT)
996 operands[1] = operands[2];
1001 if (GET_CODE (op1) == CONST_INT)
1002 operands[1] = gen_rtx (CONST_INT, VOIDmode, 255 & ~INTVAL (op1));
1004 operands[1] = expand_unop (QImode, one_cmpl_optab, op1, 0, 1);
1008 [(set (match_operand:SI 0 "general_operand" "=g,g")
1009 (and:SI (not:SI (match_operand:SI 1 "general_operand" "g,g"))
1010 (match_operand:SI 2 "general_operand" "0,g")))]
1017 [(set (match_operand:HI 0 "general_operand" "=g,g")
1018 (and:HI (not:HI (match_operand:HI 1 "general_operand" "g,g"))
1019 (match_operand:HI 2 "general_operand" "0,g")))]
1026 [(set (match_operand:QI 0 "general_operand" "=g,g")
1027 (and:QI (not:QI (match_operand:QI 1 "general_operand" "g,g"))
1028 (match_operand:QI 2 "general_operand" "0,g")))]
1034 ;; The following used to be needed because constant propagation can
1035 ;; create them starting from the bic insn patterns above. This is no
1036 ;; longer a problem. However, having these patterns allows optimization
1037 ;; opportunities in combine.c.
1040 [(set (match_operand:SI 0 "general_operand" "=g,g")
1041 (and:SI (match_operand:SI 1 "general_operand" "0,g")
1042 (match_operand:SI 2 "const_int_operand" "n,n")))]
1049 [(set (match_operand:HI 0 "general_operand" "=g,g")
1050 (and:HI (match_operand:HI 1 "general_operand" "0,g")
1051 (match_operand:HI 2 "const_int_operand" "n,n")))]
1058 [(set (match_operand:QI 0 "general_operand" "=g,g")
1059 (and:QI (match_operand:QI 1 "general_operand" "0,g")
1060 (match_operand:QI 2 "const_int_operand" "n,n")))]
1066 ;;- Bit set instructions.
1068 (define_insn "iorsi3"
1069 [(set (match_operand:SI 0 "general_operand" "=g,g,g")
1070 (ior:SI (match_operand:SI 1 "general_operand" "0,g,g")
1071 (match_operand:SI 2 "general_operand" "g,0,g")))]
1078 (define_insn "iorhi3"
1079 [(set (match_operand:HI 0 "general_operand" "=g,g,g")
1080 (ior:HI (match_operand:HI 1 "general_operand" "0,g,g")
1081 (match_operand:HI 2 "general_operand" "g,0,g")))]
1088 (define_insn "iorqi3"
1089 [(set (match_operand:QI 0 "general_operand" "=g,g,g")
1090 (ior:QI (match_operand:QI 1 "general_operand" "0,g,g")
1091 (match_operand:QI 2 "general_operand" "g,0,g")))]
1098 ;;- xor instructions.
1100 (define_insn "xorsi3"
1101 [(set (match_operand:SI 0 "general_operand" "=g,g,g")
1102 (xor:SI (match_operand:SI 1 "general_operand" "0,g,g")
1103 (match_operand:SI 2 "general_operand" "g,0,g")))]
1110 (define_insn "xorhi3"
1111 [(set (match_operand:HI 0 "general_operand" "=g,g,g")
1112 (xor:HI (match_operand:HI 1 "general_operand" "0,g,g")
1113 (match_operand:HI 2 "general_operand" "g,0,g")))]
1120 (define_insn "xorqi3"
1121 [(set (match_operand:QI 0 "general_operand" "=g,g,g")
1122 (xor:QI (match_operand:QI 1 "general_operand" "0,g,g")
1123 (match_operand:QI 2 "general_operand" "g,0,g")))]
1130 (define_insn "negdf2"
1131 [(set (match_operand:DF 0 "general_operand" "=g")
1132 (neg:DF (match_operand:DF 1 "general_operand" "gF")))]
1136 (define_insn "negsf2"
1137 [(set (match_operand:SF 0 "general_operand" "=g")
1138 (neg:SF (match_operand:SF 1 "general_operand" "gF")))]
1142 (define_insn "negsi2"
1143 [(set (match_operand:SI 0 "general_operand" "=g")
1144 (neg:SI (match_operand:SI 1 "general_operand" "g")))]
1148 (define_insn "neghi2"
1149 [(set (match_operand:HI 0 "general_operand" "=g")
1150 (neg:HI (match_operand:HI 1 "general_operand" "g")))]
1154 (define_insn "negqi2"
1155 [(set (match_operand:QI 0 "general_operand" "=g")
1156 (neg:QI (match_operand:QI 1 "general_operand" "g")))]
1160 (define_insn "one_cmplsi2"
1161 [(set (match_operand:SI 0 "general_operand" "=g")
1162 (not:SI (match_operand:SI 1 "general_operand" "g")))]
1166 (define_insn "one_cmplhi2"
1167 [(set (match_operand:HI 0 "general_operand" "=g")
1168 (not:HI (match_operand:HI 1 "general_operand" "g")))]
1172 (define_insn "one_cmplqi2"
1173 [(set (match_operand:QI 0 "general_operand" "=g")
1174 (not:QI (match_operand:QI 1 "general_operand" "g")))]
1178 ;; Arithmetic right shift on the vax works by negating the shift count,
1179 ;; then emitting a right shift with the shift count negated. This means
1180 ;; that all actual shift counts in the RTL will be positive. This
1181 ;; prevents converting shifts to ZERO_EXTRACTs with negative positions,
1182 ;; which isn't valid.
1183 (define_expand "ashrsi3"
1184 [(set (match_operand:SI 0 "general_operand" "=g")
1185 (ashiftrt:SI (match_operand:SI 1 "general_operand" "g")
1186 (match_operand:QI 2 "general_operand" "g")))]
1190 if (GET_CODE (operands[2]) != CONST_INT)
1191 operands[2] = gen_rtx (NEG, QImode, negate_rtx (QImode, operands[2]));
1195 [(set (match_operand:SI 0 "general_operand" "=g")
1196 (ashiftrt:SI (match_operand:SI 1 "general_operand" "g")
1197 (match_operand:QI 2 "const_int_operand" "n")))]
1202 [(set (match_operand:SI 0 "general_operand" "=g")
1203 (ashiftrt:SI (match_operand:SI 1 "general_operand" "g")
1204 (neg:QI (match_operand:QI 2 "general_operand" "g"))))]
1208 (define_insn "ashlsi3"
1209 [(set (match_operand:SI 0 "general_operand" "=g")
1210 (ashift:SI (match_operand:SI 1 "general_operand" "g")
1211 (match_operand:QI 2 "general_operand" "g")))]
1215 if (operands[2] == const1_rtx && rtx_equal_p (operands[0], operands[1]))
1216 return \"addl2 %0,%0\";
1217 if (GET_CODE (operands[1]) == REG
1218 && GET_CODE (operands[2]) == CONST_INT)
1220 int i = INTVAL (operands[2]);
1222 return \"addl3 %1,%1,%0\";
1224 return \"moval 0[%1],%0\";
1226 return \"movad 0[%1],%0\";
1228 return \"ashl %2,%1,%0\";
1231 ;; Arithmetic right shift on the vax works by negating the shift count.
1232 (define_expand "ashrdi3"
1233 [(set (match_operand:DI 0 "general_operand" "=g")
1234 (ashiftrt:DI (match_operand:DI 1 "general_operand" "g")
1235 (match_operand:QI 2 "general_operand" "g")))]
1239 operands[2] = gen_rtx (NEG, QImode, negate_rtx (QImode, operands[2]));
1242 (define_insn "ashldi3"
1243 [(set (match_operand:DI 0 "general_operand" "=g")
1244 (ashift:DI (match_operand:DI 1 "general_operand" "g")
1245 (match_operand:QI 2 "general_operand" "g")))]
1250 [(set (match_operand:DI 0 "general_operand" "=g")
1251 (ashiftrt:DI (match_operand:DI 1 "general_operand" "g")
1252 (neg:QI (match_operand:QI 2 "general_operand" "g"))))]
1256 ;; Rotate right on the vax works by negating the shift count.
1257 (define_expand "rotrsi3"
1258 [(set (match_operand:SI 0 "general_operand" "=g")
1259 (rotatert:SI (match_operand:SI 1 "general_operand" "g")
1260 (match_operand:QI 2 "general_operand" "g")))]
1264 if (GET_CODE (operands[2]) != CONST_INT)
1265 operands[2] = gen_rtx (NEG, QImode, negate_rtx (QImode, operands[2]));
1268 (define_insn "rotlsi3"
1269 [(set (match_operand:SI 0 "general_operand" "=g")
1270 (rotate:SI (match_operand:SI 1 "general_operand" "g")
1271 (match_operand:QI 2 "general_operand" "g")))]
1276 [(set (match_operand:SI 0 "general_operand" "=g")
1277 (rotatert:SI (match_operand:SI 1 "general_operand" "g")
1278 (match_operand:QI 2 "const_int_operand" "n")))]
1283 [(set (match_operand:SI 0 "general_operand" "=g")
1284 (rotatert:SI (match_operand:SI 1 "general_operand" "g")
1285 (neg:QI (match_operand:QI 2 "general_operand" "g"))))]
1289 ;This insn is probably slower than a multiply and an add.
1291 ; [(set (match_operand:SI 0 "general_operand" "=g")
1292 ; (mult:SI (plus:SI (match_operand:SI 1 "general_operand" "g")
1293 ; (match_operand:SI 2 "general_operand" "g"))
1294 ; (match_operand:SI 3 "general_operand" "g")))]
1296 ; "index %1,$0x80000000,$0x7fffffff,%3,%2,%0")
1298 ;; Special cases of bit-field insns which we should
1299 ;; recognize in preference to the general case.
1300 ;; These handle aligned 8-bit and 16-bit fields,
1301 ;; which can usually be done with move instructions.
1304 [(set (zero_extract:SI (match_operand:SI 0 "general_operand" "+ro")
1305 (match_operand:QI 1 "const_int_operand" "n")
1306 (match_operand:SI 2 "const_int_operand" "n"))
1307 (match_operand:SI 3 "general_operand" "g"))]
1308 "(INTVAL (operands[1]) == 8 || INTVAL (operands[1]) == 16)
1309 && INTVAL (operands[2]) % INTVAL (operands[1]) == 0
1310 && (GET_CODE (operands[0]) == REG
1311 || ! mode_dependent_address_p (XEXP (operands[0], 0)))"
1314 if (REG_P (operands[0]))
1316 if (INTVAL (operands[2]) != 0)
1317 return \"insv %3,%2,%1,%0\";
1321 = adj_offsettable_operand (operands[0], INTVAL (operands[2]) / 8);
1323 if (INTVAL (operands[1]) == 8)
1324 return \"movb %3,%0\";
1325 return \"movw %3,%0\";
1329 [(set (match_operand:SI 0 "general_operand" "=&g")
1330 (zero_extract:SI (match_operand:SI 1 "general_operand" "ro")
1331 (match_operand:QI 2 "const_int_operand" "n")
1332 (match_operand:SI 3 "const_int_operand" "n")))]
1333 "(INTVAL (operands[2]) == 8 || INTVAL (operands[2]) == 16)
1334 && INTVAL (operands[3]) % INTVAL (operands[2]) == 0
1335 && (GET_CODE (operands[1]) == REG
1336 || ! mode_dependent_address_p (XEXP (operands[1], 0)))"
1339 if (REG_P (operands[1]))
1341 if (INTVAL (operands[3]) != 0)
1342 return \"extzv %3,%2,%1,%0\";
1346 = adj_offsettable_operand (operands[1], INTVAL (operands[3]) / 8);
1348 if (INTVAL (operands[2]) == 8)
1349 return \"movzbl %1,%0\";
1350 return \"movzwl %1,%0\";
1354 [(set (match_operand:SI 0 "general_operand" "=g")
1355 (sign_extract:SI (match_operand:SI 1 "general_operand" "ro")
1356 (match_operand:QI 2 "const_int_operand" "n")
1357 (match_operand:SI 3 "const_int_operand" "n")))]
1358 "(INTVAL (operands[2]) == 8 || INTVAL (operands[2]) == 16)
1359 && INTVAL (operands[3]) % INTVAL (operands[2]) == 0
1360 && (GET_CODE (operands[1]) == REG
1361 || ! mode_dependent_address_p (XEXP (operands[1], 0)))"
1364 if (REG_P (operands[1]))
1366 if (INTVAL (operands[3]) != 0)
1367 return \"extv %3,%2,%1,%0\";
1371 = adj_offsettable_operand (operands[1], INTVAL (operands[3]) / 8);
1373 if (INTVAL (operands[2]) == 8)
1374 return \"cvtbl %1,%0\";
1375 return \"cvtwl %1,%0\";
1378 ;; Register-only SImode cases of bit-field insns.
1383 (sign_extract:SI (match_operand:SI 0 "nonmemory_operand" "r")
1384 (match_operand:QI 1 "general_operand" "g")
1385 (match_operand:SI 2 "general_operand" "g"))
1386 (match_operand:SI 3 "general_operand" "g")))]
1393 (zero_extract:SI (match_operand:SI 0 "nonmemory_operand" "r")
1394 (match_operand:QI 1 "general_operand" "g")
1395 (match_operand:SI 2 "general_operand" "g"))
1396 (match_operand:SI 3 "general_operand" "g")))]
1398 "cmpzv %2,%1,%0,%3")
1400 ;; When the field position and size are constant and the destination
1401 ;; is a register, extv and extzv are much slower than a rotate followed
1402 ;; by a bicl or sign extension.
1405 [(set (match_operand:SI 0 "general_operand" "=g")
1406 (sign_extract:SI (match_operand:SI 1 "nonmemory_operand" "r")
1407 (match_operand:QI 2 "general_operand" "g")
1408 (match_operand:SI 3 "general_operand" "g")))]
1412 if (GET_CODE (operands[3]) != CONST_INT || GET_CODE (operands[2]) != CONST_INT
1413 || GET_CODE (operands[0]) != REG
1414 || (INTVAL (operands[2]) != 8 && INTVAL (operands[2]) != 16))
1415 return \"extv %3,%2,%1,%0\";
1416 if (INTVAL (operands[2]) == 8)
1417 return \"rotl %R3,%1,%0\;cvtbl %0,%0\";
1418 return \"rotl %R3,%1,%0\;cvtwl %0,%0\";
1422 [(set (match_operand:SI 0 "general_operand" "=g")
1423 (zero_extract:SI (match_operand:SI 1 "nonmemory_operand" "r")
1424 (match_operand:QI 2 "general_operand" "g")
1425 (match_operand:SI 3 "general_operand" "g")))]
1429 if (GET_CODE (operands[3]) != CONST_INT || GET_CODE (operands[2]) != CONST_INT
1430 || GET_CODE (operands[0]) != REG)
1431 return \"extzv %3,%2,%1,%0\";
1432 if (INTVAL (operands[2]) == 8)
1433 return \"rotl %R3,%1,%0\;movzbl %0,%0\";
1434 if (INTVAL (operands[2]) == 16)
1435 return \"rotl %R3,%1,%0\;movzwl %0,%0\";
1436 if (INTVAL (operands[3]) & 31)
1437 return \"rotl %R3,%1,%0\;bicl2 %M2,%0\";
1438 if (rtx_equal_p (operands[0], operands[1]))
1439 return \"bicl2 %M2,%0\";
1440 return \"bicl3 %M2,%1,%0\";
1443 ;; Non-register cases.
1444 ;; nonimmediate_operand is used to make sure that mode-ambiguous cases
1445 ;; don't match these (and therefore match the cases above instead).
1450 (sign_extract:SI (match_operand:QI 0 "nonimmediate_operand" "rm")
1451 (match_operand:QI 1 "general_operand" "g")
1452 (match_operand:SI 2 "general_operand" "g"))
1453 (match_operand:SI 3 "general_operand" "g")))]
1460 (zero_extract:SI (match_operand:QI 0 "nonimmediate_operand" "rm")
1461 (match_operand:QI 1 "general_operand" "g")
1462 (match_operand:SI 2 "general_operand" "g"))
1463 (match_operand:SI 3 "general_operand" "g")))]
1465 "cmpzv %2,%1,%0,%3")
1468 [(set (match_operand:SI 0 "general_operand" "=g")
1469 (sign_extract:SI (match_operand:QI 1 "nonimmediate_operand" "rm")
1470 (match_operand:QI 2 "general_operand" "g")
1471 (match_operand:SI 3 "general_operand" "g")))]
1475 if (GET_CODE (operands[0]) != REG || GET_CODE (operands[2]) != CONST_INT
1476 || GET_CODE (operands[3]) != CONST_INT
1477 || (INTVAL (operands[2]) != 8 && INTVAL (operands[2]) != 16)
1478 || side_effects_p (operands[1])
1479 || (GET_CODE (operands[1]) == MEM
1480 && mode_dependent_address_p (XEXP (operands[1], 0))))
1481 return \"extv %3,%2,%1,%0\";
1482 if (INTVAL (operands[2]) == 8)
1483 return \"rotl %R3,%1,%0\;cvtbl %0,%0\";
1484 return \"rotl %R3,%1,%0\;cvtwl %0,%0\";
1487 (define_insn "extzv"
1488 [(set (match_operand:SI 0 "general_operand" "=g")
1489 (zero_extract:SI (match_operand:QI 1 "nonimmediate_operand" "rm")
1490 (match_operand:QI 2 "general_operand" "g")
1491 (match_operand:SI 3 "general_operand" "g")))]
1495 if (GET_CODE (operands[0]) != REG || GET_CODE (operands[2]) != CONST_INT
1496 || GET_CODE (operands[3]) != CONST_INT
1497 || side_effects_p (operands[1])
1498 || (GET_CODE (operands[1]) == MEM
1499 && mode_dependent_address_p (XEXP (operands[1], 0))))
1500 return \"extzv %3,%2,%1,%0\";
1501 if (INTVAL (operands[2]) == 8)
1502 return \"rotl %R3,%1,%0\;movzbl %0,%0\";
1503 if (INTVAL (operands[2]) == 16)
1504 return \"rotl %R3,%1,%0\;movzwl %0,%0\";
1505 return \"rotl %R3,%1,%0\;bicl2 %M2,%0\";
1509 [(set (zero_extract:SI (match_operand:QI 0 "general_operand" "+g")
1510 (match_operand:QI 1 "general_operand" "g")
1511 (match_operand:SI 2 "general_operand" "g"))
1512 (match_operand:SI 3 "general_operand" "g"))]
1517 [(set (zero_extract:SI (match_operand:SI 0 "register_operand" "+r")
1518 (match_operand:QI 1 "general_operand" "g")
1519 (match_operand:SI 2 "general_operand" "g"))
1520 (match_operand:SI 3 "general_operand" "g"))]
1526 (label_ref (match_operand 0 "" "")))]
1532 (if_then_else (eq (cc0)
1534 (label_ref (match_operand 0 "" ""))
1541 (if_then_else (ne (cc0)
1543 (label_ref (match_operand 0 "" ""))
1550 (if_then_else (gt (cc0)
1552 (label_ref (match_operand 0 "" ""))
1559 (if_then_else (gtu (cc0)
1561 (label_ref (match_operand 0 "" ""))
1568 (if_then_else (lt (cc0)
1570 (label_ref (match_operand 0 "" ""))
1577 (if_then_else (ltu (cc0)
1579 (label_ref (match_operand 0 "" ""))
1586 (if_then_else (ge (cc0)
1588 (label_ref (match_operand 0 "" ""))
1595 (if_then_else (geu (cc0)
1597 (label_ref (match_operand 0 "" ""))
1604 (if_then_else (le (cc0)
1606 (label_ref (match_operand 0 "" ""))
1613 (if_then_else (leu (cc0)
1615 (label_ref (match_operand 0 "" ""))
1620 ;; Recognize reversed jumps.
1623 (if_then_else (match_operator 0 "comparison_operator"
1627 (label_ref (match_operand 1 "" ""))))]
1629 "j%C0 %l1") ; %C0 negates condition
1631 ;; Recognize jbs, jlbs, jbc and jlbc instructions. Note that the operand
1632 ;; of jlbs and jlbc insns are SImode in the hardware. However, if it is
1633 ;; memory, we use QImode in the insn. So we can't use those instructions
1634 ;; for mode-dependent addresses.
1639 (ne (zero_extract:SI (match_operand:QI 0 "nonimmediate_operand" "rQ,g")
1641 (match_operand:SI 1 "general_operand" "I,g"))
1643 (label_ref (match_operand 2 "" ""))
1653 (eq (zero_extract:SI (match_operand:QI 0 "nonimmediate_operand" "rQ,g")
1655 (match_operand:SI 1 "general_operand" "I,g"))
1657 (label_ref (match_operand 2 "" ""))
1667 (ne (zero_extract:SI (match_operand:SI 0 "register_operand" "r,r")
1669 (match_operand:SI 1 "general_operand" "I,g"))
1671 (label_ref (match_operand 2 "" ""))
1681 (eq (zero_extract:SI (match_operand:SI 0 "register_operand" "r,r")
1683 (match_operand:SI 1 "general_operand" "I,g"))
1685 (label_ref (match_operand 2 "" ""))
1692 ;; Subtract-and-jump and Add-and-jump insns.
1693 ;; These are not used when output is for the Unix assembler
1694 ;; because it does not know how to modify them to reach far.
1696 ;; Normal sob insns.
1701 (gt (plus:SI (match_operand:SI 0 "general_operand" "+g")
1704 (label_ref (match_operand 1 "" ""))
1707 (plus:SI (match_dup 0)
1715 (ge (plus:SI (match_operand:SI 0 "general_operand" "+g")
1718 (label_ref (match_operand 1 "" ""))
1721 (plus:SI (match_dup 0)
1726 ;; Normal aob insns. Define a version for when operands[1] is a constant.
1730 (lt (plus:SI (match_operand:SI 0 "general_operand" "+g")
1732 (match_operand:SI 1 "general_operand" "g"))
1733 (label_ref (match_operand 2 "" ""))
1736 (plus:SI (match_dup 0)
1739 "jaoblss %1,%0,%l2")
1744 (lt (match_operand:SI 0 "general_operand" "+g")
1745 (match_operand:SI 1 "general_operand" "g"))
1746 (label_ref (match_operand 2 "" ""))
1749 (plus:SI (match_dup 0)
1751 "!TARGET_UNIX_ASM && GET_CODE (operands[1]) == CONST_INT"
1752 "jaoblss %P1,%0,%l2")
1757 (le (plus:SI (match_operand:SI 0 "general_operand" "+g")
1759 (match_operand:SI 1 "general_operand" "g"))
1760 (label_ref (match_operand 2 "" ""))
1763 (plus:SI (match_dup 0)
1766 "jaobleq %1,%0,%l2")
1771 (le (match_operand:SI 0 "general_operand" "+g")
1772 (match_operand:SI 1 "general_operand" "g"))
1773 (label_ref (match_operand 2 "" ""))
1776 (plus:SI (match_dup 0)
1778 "!TARGET_UNIX_ASM && GET_CODE (operands[1]) == CONST_INT"
1779 "jaobleq %P1,%0,%l2")
1781 ;; Something like a sob insn, but compares against -1.
1782 ;; This finds `while (foo--)' which was changed to `while (--foo != -1)'.
1787 (ne (match_operand:SI 0 "general_operand" "g")
1789 (label_ref (match_operand 1 "" ""))
1792 (plus:SI (match_dup 0)
1795 "decl %0\;jgequ %l1")
1797 ;; Note that operand 1 is total size of args, in bytes,
1798 ;; and what the call insn wants is the number of words.
1799 (define_insn "call_pop"
1800 [(call (match_operand:QI 0 "memory_operand" "m")
1801 (match_operand:QI 1 "general_operand" "g"))
1802 (set (reg:SI 14) (plus:SI (reg:SI 14)
1803 (match_operand:SI 3 "immediate_operand" "i")))]
1806 if (GET_CODE (operands[1]) != CONST_INT || INTVAL (operands[1]) > 255 * 4)
1807 /* Vax `calls' really uses only one byte of #args, so pop explicitly. */
1808 return \"calls $0,%0\;addl2 %1,sp\";
1809 operands[1] = gen_rtx (CONST_INT, VOIDmode, (INTVAL (operands[1]) + 3)/ 4);
1810 return \"calls %1,%0\";
1813 (define_insn "call_value_pop"
1814 [(set (match_operand 0 "" "=g")
1815 (call (match_operand:QI 1 "memory_operand" "m")
1816 (match_operand:QI 2 "general_operand" "g")))
1817 (set (reg:SI 14) (plus:SI (reg:SI 14)
1818 (match_operand:SI 4 "immediate_operand" "i")))]
1821 if (GET_CODE (operands[2]) != CONST_INT || INTVAL (operands[2]) > 255 * 4)
1822 /* Vax `calls' really uses only one byte of #args, so pop explicitly. */
1823 return \"calls $0,%1\;addl2 %2,sp\";
1824 operands[2] = gen_rtx (CONST_INT, VOIDmode, (INTVAL (operands[2]) + 3)/ 4);
1825 return \"calls %2,%1\";
1828 ;; Define another set of these for the case of functions with no
1829 ;; operands. In that case, combine may simplify the adjustment of sp.
1831 [(call (match_operand:QI 0 "memory_operand" "m")
1832 (match_operand:QI 1 "general_operand" "g"))
1833 (set (reg:SI 14) (reg:SI 14))]
1836 if (GET_CODE (operands[1]) != CONST_INT || INTVAL (operands[1]) > 255 * 4)
1837 /* Vax `calls' really uses only one byte of #args, so pop explicitly. */
1838 return \"calls $0,%0\;addl2 %1,sp\";
1839 operands[1] = gen_rtx (CONST_INT, VOIDmode, (INTVAL (operands[1]) + 3)/ 4);
1840 return \"calls %1,%0\";
1844 [(set (match_operand 0 "" "=g")
1845 (call (match_operand:QI 1 "memory_operand" "m")
1846 (match_operand:QI 2 "general_operand" "g")))
1847 (set (reg:SI 14) (reg:SI 14))]
1850 if (GET_CODE (operands[2]) != CONST_INT || INTVAL (operands[2]) > 255 * 4)
1851 /* Vax `calls' really uses only one byte of #args, so pop explicitly. */
1852 return \"calls $0,%1\;addl2 %2,sp\";
1853 operands[2] = gen_rtx (CONST_INT, VOIDmode, (INTVAL (operands[2]) + 3)/ 4);
1854 return \"calls %2,%1\";
1857 (define_insn "return"
1867 ;; This had a wider constraint once, and it had trouble.
1868 ;; If you are tempted to try `g', please don't--it's not worth
1869 ;; the risk we will reopen the same bug.
1870 (define_insn "indirect_jump"
1871 [(set (pc) (match_operand:SI 0 "general_operand" "r"))]
1875 ;; This is here to accept 5 arguments (as passed by expand_end_case)
1876 ;; and pass the first 4 along to the casesi1 pattern that really does the work.
1877 (define_expand "casesi"
1879 (if_then_else (leu (minus:SI (match_operand:SI 0 "general_operand" "g")
1880 (match_operand:SI 1 "general_operand" "g"))
1881 (match_operand:SI 2 "general_operand" "g"))
1882 (plus:SI (sign_extend:SI
1885 (mult:SI (minus:SI (match_dup 0)
1888 (label_ref:SI (match_operand 3 "" "")))
1890 (match_operand 4 "" "")]
1893 emit_insn (gen_casesi1 (operands[0], operands[1], operands[2], operands[3]));
1897 (define_insn "casesi1"
1899 (if_then_else (leu (minus:SI (match_operand:SI 0 "general_operand" "g")
1900 (match_operand:SI 1 "general_operand" "g"))
1901 (match_operand:SI 2 "general_operand" "g"))
1902 (plus:SI (sign_extend:SI
1905 (mult:SI (minus:SI (match_dup 0)
1908 (label_ref:SI (match_operand 3 "" "")))
1913 ;; This used to arise from the preceding by simplification
1914 ;; if operand 1 is zero. Perhaps it is no longer necessary.
1917 (if_then_else (leu (match_operand:SI 0 "general_operand" "g")
1918 (match_operand:SI 1 "general_operand" "g"))
1919 (plus:SI (sign_extend:SI
1922 (mult:SI (minus:SI (match_dup 0)
1925 (label_ref:SI (match_operand 3 "" "")))
1930 ;;- load or push effective address
1931 ;; These come after the move and add/sub patterns
1932 ;; because we don't want pushl $1 turned into pushad 1.
1933 ;; or addl3 r1,r2,r3 turned into movab 0(r1)[r2],r3.
1935 ;; It does not work to use constraints to distinguish pushes from moves,
1936 ;; because < matches any autodecrement, not just a push.
1939 [(set (match_operand:SI 0 "general_operand" "=g")
1940 (match_operand:QI 1 "address_operand" "p"))]
1944 if (push_operand (operands[0], SImode))
1945 return \"pushab %a1\";
1947 return \"movab %a1,%0\";
1951 [(set (match_operand:SI 0 "general_operand" "=g")
1952 (match_operand:HI 1 "address_operand" "p"))]
1956 if (push_operand (operands[0], SImode))
1957 return \"pushaw %a1\";
1959 return \"movaw %a1,%0\";
1963 [(set (match_operand:SI 0 "general_operand" "=g")
1964 (match_operand:SI 1 "address_operand" "p"))]
1968 if (push_operand (operands[0], SImode))
1969 return \"pushal %a1\";
1971 return \"moval %a1,%0\";
1975 [(set (match_operand:SI 0 "general_operand" "=g")
1976 (match_operand:DI 1 "address_operand" "p"))]
1980 if (push_operand (operands[0], SImode))
1981 return \"pushaq %a1\";
1983 return \"movaq %a1,%0\";
1987 [(set (match_operand:SI 0 "general_operand" "=g")
1988 (match_operand:SF 1 "address_operand" "p"))]
1992 if (push_operand (operands[0], SImode))
1993 return \"pushaf %a1\";
1995 return \"movaf %a1,%0\";
1999 [(set (match_operand:SI 0 "general_operand" "=g")
2000 (match_operand:DF 1 "address_operand" "p"))]
2004 if (push_operand (operands[0], SImode))
2005 return \"pushad %a1\";
2007 return \"movad %a1,%0\";
2010 ;; These used to be peepholes, but it is more straightforward to do them
2011 ;; as single insns. However, we must force the output to be a register
2012 ;; if it is not an offsettable address so that we know that we can assign
2015 ;; If we had a good way of evaluating the relative costs, these could be
2016 ;; machine-independent.
2018 ;; Optimize extzv ...,z; andl2 ...,z
2019 ;; or ashl ...,z; andl2 ...,z
2020 ;; with other operands constant. This is what the combiner converts the
2021 ;; above sequences to before attempting to recognize the new insn.
2024 [(set (match_operand:SI 0 "general_operand" "=ro")
2025 (and:SI (ashiftrt:SI (match_operand:SI 1 "general_operand" "g")
2026 (match_operand:QI 2 "const_int_operand" "n"))
2027 (match_operand:SI 3 "const_int_operand" "n")))]
2028 "(INTVAL (operands[3]) & ~((1 << (32 - INTVAL (operands[2]))) - 1)) == 0"
2031 unsigned long mask1 = INTVAL (operands[3]);
2032 unsigned long mask2 = (1 << (32 - INTVAL (operands[2]))) - 1;
2034 if ((mask1 & mask2) != mask1)
2035 operands[3] = gen_rtx (CONST_INT, VOIDmode, mask1 & mask2);
2037 return \"rotl %R2,%1,%0\;bicl2 %N3,%0\";
2040 ;; left-shift and mask
2041 ;; The only case where `ashl' is better is if the mask only turns off
2042 ;; bits that the ashl would anyways, in which case it should have been
2046 [(set (match_operand:SI 0 "general_operand" "=ro")
2047 (and:SI (ashift:SI (match_operand:SI 1 "general_operand" "g")
2048 (match_operand:QI 2 "const_int_operand" "n"))
2049 (match_operand:SI 3 "const_int_operand" "n")))]
2053 operands[3] = gen_rtx (CONST_INT, VOIDmode,
2054 INTVAL (operands[3]) & ~((1 << INTVAL (operands[2])) - 1));
2055 return \"rotl %2,%1,%0\;bicl2 %N3,%0\";