1 ;; Machine description the Motorola MCore
2 ;; Copyright (C) 1993, 1999, 2000, 2004, 2005
3 ;; Free Software Foundation, Inc.
4 ;; Contributed by Motorola.
6 ;; This file is part of GCC.
8 ;; GCC is free software; you can redistribute it and/or modify
9 ;; it under the terms of the GNU General Public License as published by
10 ;; the Free Software Foundation; either version 2, or (at your option)
13 ;; GCC is distributed in the hope that it will be useful,
14 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
15 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 ;; GNU General Public License for more details.
18 ;; You should have received a copy of the GNU General Public License
19 ;; along with GCC; see the file COPYING. If not, write to
20 ;; the Free Software Foundation, 51 Franklin Street, Fifth Floor,
21 ;; Boston, MA 02110-1301, USA.
23 ;;- See file "rtl.def" for documentation on define_insn, match_*, et. al.
27 ;; -------------------------------------------------------------------------
29 ;; -------------------------------------------------------------------------
33 (define_attr "type" "brcond,branch,jmp,load,store,move,alu,shift"
36 ;; If a branch destination is within -2048..2047 bytes away from the
37 ;; instruction it can be 2 bytes long. All other conditional branches
38 ;; are 10 bytes long, and all other unconditional branches are 8 bytes.
40 ;; the assembler handles the long-branch span case for us if we use
41 ;; the "jb*" mnemonics for jumps/branches. This pushes the span
42 ;; calculations and the literal table placement into the assembler,
43 ;; where their interactions can be managed in a single place.
45 ;; All MCORE instructions are two bytes long.
47 (define_attr "length" "" (const_int 2))
49 ;; Scheduling. We only model a simple load latency.
50 (define_insn_reservation "any_insn" 1
51 (eq_attr "type" "!load")
53 (define_insn_reservation "memory" 2
54 (eq_attr "type" "load")
57 (include "predicates.md")
59 ;; -------------------------------------------------------------------------
61 ;; -------------------------------------------------------------------------
65 (sign_extract:SI (match_operand:SI 0 "mcore_arith_reg_operand" "r")
67 (match_operand:SI 1 "mcore_literal_K_operand" "K")))]
70 [(set_attr "type" "shift")])
74 (zero_extract:SI (match_operand:SI 0 "mcore_arith_reg_operand" "r")
76 (match_operand:SI 1 "mcore_literal_K_operand" "K")))]
79 [(set_attr "type" "shift")])
81 ;;; This is created by combine.
84 (ne:CC (zero_extract:SI (match_operand:SI 0 "mcore_arith_reg_operand" "r")
86 (match_operand:SI 1 "mcore_literal_K_operand" "K"))
90 [(set_attr "type" "shift")])
93 ;; Created by combine from conditional patterns below (see sextb/btsti rx,31)
97 (ne:CC (lshiftrt:SI (match_operand:SI 0 "mcore_arith_reg_operand" "r")
100 "GET_CODE(operands[0]) == SUBREG &&
101 GET_MODE(SUBREG_REG(operands[0])) == QImode"
103 [(set_attr "type" "shift")])
107 (ne:CC (lshiftrt:SI (match_operand:SI 0 "mcore_arith_reg_operand" "r")
110 "GET_CODE(operands[0]) == SUBREG &&
111 GET_MODE(SUBREG_REG(operands[0])) == HImode"
113 [(set_attr "type" "shift")])
117 (if_then_else (ne (eq:CC (zero_extract:SI
118 (match_operand:SI 0 "mcore_arith_reg_operand" "")
120 (match_operand:SI 1 "mcore_literal_K_operand" ""))
123 (label_ref (match_operand 2 "" ""))
127 (zero_extract:SI (match_dup 0) (const_int 1) (match_dup 1)))
128 (set (pc) (if_then_else (eq (reg:CC 17) (const_int 0))
129 (label_ref (match_dup 2))
135 (if_then_else (eq (ne:CC (zero_extract:SI
136 (match_operand:SI 0 "mcore_arith_reg_operand" "")
138 (match_operand:SI 1 "mcore_literal_K_operand" ""))
141 (label_ref (match_operand 2 "" ""))
145 (zero_extract:SI (match_dup 0) (const_int 1) (match_dup 1)))
146 (set (pc) (if_then_else (eq (reg:CC 17) (const_int 0))
147 (label_ref (match_dup 2))
151 ;; XXX - disabled by nickc because it fails on libiberty/fnmatch.c
153 ;; ; Experimental - relax immediates for and, andn, or, and tst to allow
154 ;; ; any immediate value (or an immediate at all -- or, andn, & tst).
155 ;; ; This is done to allow bit field masks to fold together in combine.
156 ;; ; The reload phase will force the immediate into a register at the
157 ;; ; very end. This helps in some cases, but hurts in others: we'd
158 ;; ; really like to cse these immediates. However, there is a phase
159 ;; ; ordering problem here. cse picks up individual masks and cse's
160 ;; ; those, but not folded masks (cse happens before combine). It's
161 ;; ; not clear what the best solution is because we really want cse
162 ;; ; before combine (leaving the bit field masks alone). To pick up
163 ;; ; relaxed immediates use -mrelax-immediates. It might take some
164 ;; ; experimenting to see which does better (i.e. regular imms vs.
165 ;; ; arbitrary imms) for a particular code. BRC
169 ;; (ne:CC (and:SI (match_operand:SI 0 "mcore_arith_reg_operand" "r")
170 ;; (match_operand:SI 1 "mcore_arith_any_imm_operand" "rI"))
172 ;; "TARGET_RELAX_IMM"
177 ;; (ne:CC (and:SI (match_operand:SI 0 "mcore_arith_reg_operand" "r")
178 ;; (match_operand:SI 1 "mcore_arith_M_operand" "r"))
180 ;; "!TARGET_RELAX_IMM"
185 (ne:CC (and:SI (match_operand:SI 0 "mcore_arith_reg_operand" "r")
186 (match_operand:SI 1 "mcore_arith_M_operand" "r"))
195 (ne:CC (ne:SI (leu:CC (match_operand:SI 0 "mcore_arith_reg_operand" "r")
196 (match_operand:SI 1 "mcore_arith_reg_operand" "r"))
199 (clobber (match_operand:CC 2 "mcore_arith_reg_operand" "=r"))])]
201 [(set (reg:CC 17) (ne:SI (match_dup 0) (const_int 0)))
202 (set (reg:CC 17) (leu:CC (match_dup 0) (match_dup 1)))])
204 ;; -------------------------------------------------------------------------
205 ;; SImode signed integer comparisons
206 ;; -------------------------------------------------------------------------
208 (define_insn "decne_t"
209 [(set (reg:CC 17) (ne:CC (plus:SI (match_operand:SI 0 "mcore_arith_reg_operand" "+r")
213 (plus:SI (match_dup 0)
218 ;; The combiner seems to prefer the following to the former.
221 [(set (reg:CC 17) (ne:CC (match_operand:SI 0 "mcore_arith_reg_operand" "+r")
224 (plus:SI (match_dup 0)
229 (define_insn "cmpnesi_t"
230 [(set (reg:CC 17) (ne:CC (match_operand:SI 0 "mcore_arith_reg_operand" "r")
231 (match_operand:SI 1 "mcore_arith_reg_operand" "r")))]
235 (define_insn "cmpneisi_t"
236 [(set (reg:CC 17) (ne:CC (match_operand:SI 0 "mcore_arith_reg_operand" "r")
237 (match_operand:SI 1 "mcore_arith_K_operand" "K")))]
241 (define_insn "cmpgtsi_t"
242 [(set (reg:CC 17) (gt:CC (match_operand:SI 0 "mcore_arith_reg_operand" "r")
243 (match_operand:SI 1 "mcore_arith_reg_operand" "r")))]
248 [(set (reg:CC 17) (gt:CC (plus:SI
249 (match_operand:SI 0 "mcore_arith_reg_operand" "+r")
252 (set (match_dup 0) (plus:SI (match_dup 0) (const_int -1)))]
256 (define_insn "cmpltsi_t"
257 [(set (reg:CC 17) (lt:CC (match_operand:SI 0 "mcore_arith_reg_operand" "r")
258 (match_operand:SI 1 "mcore_arith_reg_operand" "r")))]
263 (define_insn "cmpltisi_t"
264 [(set (reg:CC 17) (lt:CC (match_operand:SI 0 "mcore_arith_reg_operand" "r")
265 (match_operand:SI 1 "mcore_arith_J_operand" "J")))]
271 [(set (reg:CC 17) (lt:CC (match_operand:SI 0 "mcore_arith_reg_operand" "r")
277 [(set (reg:CC 17) (lt:CC (plus:SI
278 (match_operand:SI 0 "mcore_arith_reg_operand" "+r")
281 (set (match_dup 0) (plus:SI (match_dup 0) (const_int -1)))]
285 ;; -------------------------------------------------------------------------
286 ;; SImode unsigned integer comparisons
287 ;; -------------------------------------------------------------------------
289 (define_insn "cmpgeusi_t"
290 [(set (reg:CC 17) (geu:CC (match_operand:SI 0 "mcore_arith_reg_operand" "r")
291 (match_operand:SI 1 "mcore_arith_reg_operand" "r")))]
295 (define_insn "cmpgeusi_0"
296 [(set (reg:CC 17) (geu:CC (match_operand:SI 0 "mcore_arith_reg_operand" "r")
301 (define_insn "cmpleusi_t"
302 [(set (reg:CC 17) (leu:CC (match_operand:SI 0 "mcore_arith_reg_operand" "r")
303 (match_operand:SI 1 "mcore_arith_reg_operand" "r")))]
307 ;; We save the compare operands in the cmpxx patterns and use them when
308 ;; we generate the branch.
310 ;; We accept constants here, in case we can modify them to ones which
311 ;; are more efficient to load. E.g. change 'x <= 62' to 'x < 63'.
313 (define_expand "cmpsi"
314 [(set (reg:CC 17) (compare:CC (match_operand:SI 0 "mcore_compare_operand" "")
315 (match_operand:SI 1 "nonmemory_operand" "")))]
318 { arch_compare_op0 = operands[0];
319 arch_compare_op1 = operands[1];
323 ;; -------------------------------------------------------------------------
324 ;; Logical operations
325 ;; -------------------------------------------------------------------------
327 ;; Logical AND clearing a single bit. andsi3 knows that we have this
328 ;; pattern and allows the constant literal pass through.
331 ;; RBE 2/97: don't need this pattern any longer...
332 ;; RBE: I don't think we need both "S" and exact_log2() clauses.
334 ;; [(set (match_operand:SI 0 "mcore_arith_reg_operand" "=r")
335 ;; (and:SI (match_operand:SI 1 "mcore_arith_reg_operand" "%0")
336 ;; (match_operand:SI 2 "const_int_operand" "S")))]
337 ;; "mcore_arith_S_operand (operands[2])"
341 (define_insn "andnsi3"
342 [(set (match_operand:SI 0 "mcore_arith_reg_operand" "=r")
343 (and:SI (not:SI (match_operand:SI 1 "mcore_arith_reg_operand" "r"))
344 (match_operand:SI 2 "mcore_arith_reg_operand" "0")))]
348 (define_expand "andsi3"
349 [(set (match_operand:SI 0 "mcore_arith_reg_operand" "")
350 (and:SI (match_operand:SI 1 "mcore_arith_reg_operand" "")
351 (match_operand:SI 2 "nonmemory_operand" "")))]
355 if (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) < 0
356 && ! mcore_arith_S_operand (operands[2]))
358 int not_value = ~ INTVAL (operands[2]);
359 if ( CONST_OK_FOR_I (not_value)
360 || CONST_OK_FOR_M (not_value)
361 || CONST_OK_FOR_N (not_value))
363 operands[2] = copy_to_mode_reg (SImode, GEN_INT (not_value));
364 emit_insn (gen_andnsi3 (operands[0], operands[2], operands[1]));
369 if (! mcore_arith_K_S_operand (operands[2], SImode))
370 operands[2] = copy_to_mode_reg (SImode, operands[2]);
374 [(set (match_operand:SI 0 "mcore_arith_reg_operand" "=r,r,r,r")
375 (and:SI (match_operand:SI 1 "mcore_arith_reg_operand" "0,0,r,0")
376 (match_operand:SI 2 "mcore_arith_any_imm_operand" "r,K,0,S")))]
380 switch (which_alternative)
382 case 0: return \"and %0,%2\";
383 case 1: return \"andi %0,%2\";
384 case 2: return \"and %0,%1\";
385 /* case -1: return \"bclri %0,%Q2\"; will not happen */
386 case 3: return mcore_output_bclri (operands[0], INTVAL (operands[2]));
387 default: gcc_unreachable ();
391 ;; This was the old "S" which was "!(2^n)" */
392 ;; case -1: return \"bclri %0,%Q2\"; will not happen */
395 [(set (match_operand:SI 0 "mcore_arith_reg_operand" "=r,r,r,r")
396 (and:SI (match_operand:SI 1 "mcore_arith_reg_operand" "0,0,r,0")
397 (match_operand:SI 2 "mcore_arith_K_S_operand" "r,K,0,S")))]
401 switch (which_alternative)
403 case 0: return \"and %0,%2\";
404 case 1: return \"andi %0,%2\";
405 case 2: return \"and %0,%1\";
406 case 3: return mcore_output_bclri (operands[0], INTVAL (operands[2]));
407 default: gcc_unreachable ();
411 ;(define_insn "iorsi3"
412 ; [(set (match_operand:SI 0 "mcore_arith_reg_operand" "=r")
413 ; (ior:SI (match_operand:SI 1 "mcore_arith_reg_operand" "%0")
414 ; (match_operand:SI 2 "mcore_arith_reg_operand" "r")))]
418 ; need an expand to resolve ambiguity betw. the two iors below.
419 (define_expand "iorsi3"
420 [(set (match_operand:SI 0 "mcore_arith_reg_operand" "")
421 (ior:SI (match_operand:SI 1 "mcore_arith_reg_operand" "")
422 (match_operand:SI 2 "nonmemory_operand" "")))]
426 if (! mcore_arith_M_operand (operands[2], SImode))
427 operands[2] = copy_to_mode_reg (SImode, operands[2]);
431 [(set (match_operand:SI 0 "mcore_arith_reg_operand" "=r,r,r")
432 (ior:SI (match_operand:SI 1 "mcore_arith_reg_operand" "%0,0,0")
433 (match_operand:SI 2 "mcore_arith_any_imm_operand" "r,M,T")))]
437 switch (which_alternative)
439 case 0: return \"or %0,%2\";
440 case 1: return \"bseti %0,%P2\";
441 case 2: return mcore_output_bseti (operands[0], INTVAL (operands[2]));
442 default: gcc_unreachable ();
447 [(set (match_operand:SI 0 "mcore_arith_reg_operand" "=r,r,r")
448 (ior:SI (match_operand:SI 1 "mcore_arith_reg_operand" "%0,0,0")
449 (match_operand:SI 2 "mcore_arith_M_operand" "r,M,T")))]
453 switch (which_alternative)
455 case 0: return \"or %0,%2\";
456 case 1: return \"bseti %0,%P2\";
457 case 2: return mcore_output_bseti (operands[0], INTVAL (operands[2]));
458 default: gcc_unreachable ();
463 ; [(set (match_operand:SI 0 "mcore_arith_reg_operand" "=r")
464 ; (ior:SI (match_operand:SI 1 "mcore_arith_reg_operand" "0")
465 ; (match_operand:SI 2 "const_int_operand" "M")))]
466 ; "exact_log2 (INTVAL (operands[2])) >= 0"
470 ; [(set (match_operand:SI 0 "mcore_arith_reg_operand" "=r")
471 ; (ior:SI (match_operand:SI 1 "mcore_arith_reg_operand" "0")
472 ; (match_operand:SI 2 "const_int_operand" "i")))]
473 ; "mcore_num_ones (INTVAL (operands[2])) < 3"
474 ; "* return mcore_output_bseti (operands[0], INTVAL (operands[2]));")
476 (define_insn "xorsi3"
477 [(set (match_operand:SI 0 "mcore_arith_reg_operand" "=r")
478 (xor:SI (match_operand:SI 1 "mcore_arith_reg_operand" "%0")
479 (match_operand:SI 2 "mcore_arith_reg_operand" "r")))]
483 ; these patterns give better code then gcc invents if
484 ; left to its own devices
486 (define_insn "anddi3"
487 [(set (match_operand:DI 0 "mcore_arith_reg_operand" "=r")
488 (and:DI (match_operand:DI 1 "mcore_arith_reg_operand" "%0")
489 (match_operand:DI 2 "mcore_arith_reg_operand" "r")))]
491 "and %0,%2\;and %R0,%R2"
492 [(set_attr "length" "4")])
494 (define_insn "iordi3"
495 [(set (match_operand:DI 0 "mcore_arith_reg_operand" "=r")
496 (ior:DI (match_operand:DI 1 "mcore_arith_reg_operand" "%0")
497 (match_operand:DI 2 "mcore_arith_reg_operand" "r")))]
499 "or %0,%2\;or %R0,%R2"
500 [(set_attr "length" "4")])
502 (define_insn "xordi3"
503 [(set (match_operand:DI 0 "mcore_arith_reg_operand" "=r")
504 (xor:DI (match_operand:DI 1 "mcore_arith_reg_operand" "%0")
505 (match_operand:DI 2 "mcore_arith_reg_operand" "r")))]
507 "xor %0,%2\;xor %R0,%R2"
508 [(set_attr "length" "4")])
510 ;; -------------------------------------------------------------------------
511 ;; Shifts and rotates
512 ;; -------------------------------------------------------------------------
514 ;; Only allow these if the shift count is a convenient constant.
515 (define_expand "rotlsi3"
516 [(set (match_operand:SI 0 "mcore_arith_reg_operand" "")
517 (rotate:SI (match_operand:SI 1 "mcore_arith_reg_operand" "")
518 (match_operand:SI 2 "nonmemory_operand" "")))]
520 "if (! mcore_literal_K_operand (operands[2], SImode))
524 ;; We can only do constant rotates, which is what this pattern provides.
525 ;; The combiner will put it together for us when we do:
526 ;; (x << N) | (x >> (32 - N))
528 [(set (match_operand:SI 0 "mcore_arith_reg_operand" "=r")
529 (rotate:SI (match_operand:SI 1 "mcore_arith_reg_operand" "0")
530 (match_operand:SI 2 "mcore_literal_K_operand" "K")))]
533 [(set_attr "type" "shift")])
535 (define_insn "ashlsi3"
536 [(set (match_operand:SI 0 "mcore_arith_reg_operand" "=r,r")
537 (ashift:SI (match_operand:SI 1 "mcore_arith_reg_operand" "0,0")
538 (match_operand:SI 2 "mcore_arith_K_operand_not_0" "r,K")))]
543 [(set_attr "type" "shift")])
546 [(set (match_operand:SI 0 "mcore_arith_reg_operand" "=r")
547 (ashift:SI (const_int 1)
548 (match_operand:SI 1 "mcore_arith_reg_operand" "r")))]
551 [(set_attr "type" "shift")])
553 (define_insn "ashrsi3"
554 [(set (match_operand:SI 0 "mcore_arith_reg_operand" "=r,r")
555 (ashiftrt:SI (match_operand:SI 1 "mcore_arith_reg_operand" "0,0")
556 (match_operand:SI 2 "mcore_arith_K_operand_not_0" "r,K")))]
561 [(set_attr "type" "shift")])
563 (define_insn "lshrsi3"
564 [(set (match_operand:SI 0 "mcore_arith_reg_operand" "=r,r")
565 (lshiftrt:SI (match_operand:SI 1 "mcore_arith_reg_operand" "0,0")
566 (match_operand:SI 2 "mcore_arith_K_operand_not_0" "r,K")))]
571 [(set_attr "type" "shift")])
573 ;(define_expand "ashldi3"
574 ; [(parallel[(set (match_operand:DI 0 "mcore_arith_reg_operand" "")
575 ; (ashift:DI (match_operand:DI 1 "mcore_arith_reg_operand" "")
576 ; (match_operand:DI 2 "immediate_operand" "")))
578 ; (clobber (reg:CC 17))])]
583 ; if (GET_CODE (operands[2]) != CONST_INT
584 ; || INTVAL (operands[2]) != 1)
589 ; [(set (match_operand:DI 0 "mcore_arith_reg_operand" "=r")
590 ; (ashift:DI (match_operand:DI 1 "mcore_arith_reg_operand" "0")
592 ; (clobber (reg:CC 17))]
594 ; "lsli %R0,0\;rotli %0,0"
595 ; [(set_attr "length" "4") (set_attr "type" "shift")])
597 ;; -------------------------------------------------------------------------
598 ;; Index instructions
599 ;; -------------------------------------------------------------------------
600 ;; The second of each set of patterns is borrowed from the alpha.md file.
601 ;; These variants of the above insns can occur if the second operand
602 ;; is the frame pointer. This is a kludge, but there doesn't
603 ;; seem to be a way around it. Only recognize them while reloading.
605 ;; We must use reload_operand for some operands in case frame pointer
606 ;; elimination put a MEM with invalid address there. Otherwise,
607 ;; the result of the substitution will not match this pattern, and reload
608 ;; will not be able to correctly fix the result.
610 ;; indexing longlongs or doubles (8 bytes)
612 (define_insn "indexdi_t"
613 [(set (match_operand:SI 0 "mcore_arith_reg_operand" "=r")
614 (plus:SI (mult:SI (match_operand:SI 1 "mcore_arith_reg_operand" "r")
616 (match_operand:SI 2 "mcore_arith_reg_operand" "0")))]
619 if (! mcore_is_same_reg (operands[1], operands[2]))
621 output_asm_insn (\"ixw\\t%0,%1\", operands);
622 output_asm_insn (\"ixw\\t%0,%1\", operands);
626 output_asm_insn (\"ixh\\t%0,%1\", operands);
627 output_asm_insn (\"ixh\\t%0,%1\", operands);
631 ;; if operands[1] == operands[2], the first option above is wrong! -- dac
632 ;; was this... -- dac
633 ;; ixw %0,%1\;ixw %0,%1"
635 [(set_attr "length" "4")])
638 [(set (match_operand:SI 0 "mcore_reload_operand" "=r,r,r")
639 (plus:SI (plus:SI (mult:SI (match_operand:SI 1 "mcore_reload_operand" "r,r,r")
641 (match_operand:SI 2 "mcore_arith_reg_operand" "0,0,0"))
642 (match_operand:SI 3 "mcore_addsub_operand" "r,J,L")))]
645 ixw %0,%1\;ixw %0,%1\;addu %0,%3
646 ixw %0,%1\;ixw %0,%1\;addi %0,%3
647 ixw %0,%1\;ixw %0,%1\;subi %0,%M3"
648 [(set_attr "length" "6")])
650 ;; indexing longs (4 bytes)
652 (define_insn "indexsi_t"
653 [(set (match_operand:SI 0 "mcore_arith_reg_operand" "=r")
654 (plus:SI (mult:SI (match_operand:SI 1 "mcore_arith_reg_operand" "r")
656 (match_operand:SI 2 "mcore_arith_reg_operand" "0")))]
661 [(set (match_operand:SI 0 "mcore_reload_operand" "=r,r,r")
662 (plus:SI (plus:SI (mult:SI (match_operand:SI 1 "mcore_reload_operand" "r,r,r")
664 (match_operand:SI 2 "mcore_arith_reg_operand" "0,0,0"))
665 (match_operand:SI 3 "mcore_addsub_operand" "r,J,L")))]
668 ixw %0,%1\;addu %0,%3
669 ixw %0,%1\;addi %0,%3
670 ixw %0,%1\;subi %0,%M3"
671 [(set_attr "length" "4")])
673 ;; indexing shorts (2 bytes)
675 (define_insn "indexhi_t"
676 [(set (match_operand:SI 0 "mcore_arith_reg_operand" "=r")
677 (plus:SI (mult:SI (match_operand:SI 1 "mcore_arith_reg_operand" "r")
679 (match_operand:SI 2 "mcore_arith_reg_operand" "0")))]
684 [(set (match_operand:SI 0 "mcore_reload_operand" "=r,r,r")
685 (plus:SI (plus:SI (mult:SI (match_operand:SI 1 "mcore_reload_operand" "r,r,r")
687 (match_operand:SI 2 "mcore_arith_reg_operand" "0,0,0"))
688 (match_operand:SI 3 "mcore_addsub_operand" "r,J,L")))]
691 ixh %0,%1\;addu %0,%3
692 ixh %0,%1\;addi %0,%3
693 ixh %0,%1\;subi %0,%M3"
694 [(set_attr "length" "4")])
697 ;; Other sizes may be handy for indexing.
698 ;; the tradeoffs to consider when adding these are
699 ;; code size, execution time [vs. mul it is easy to win],
700 ;; and register pressure -- these patterns don't use an extra
701 ;; register to build the offset from the base
702 ;; and whether the compiler will not come up with some other idiom.
705 ;; -------------------------------------------------------------------------
706 ;; Addition, Subtraction instructions
707 ;; -------------------------------------------------------------------------
709 (define_expand "addsi3"
710 [(set (match_operand:SI 0 "mcore_arith_reg_operand" "")
711 (plus:SI (match_operand:SI 1 "mcore_arith_reg_operand" "")
712 (match_operand:SI 2 "nonmemory_operand" "")))]
716 extern int flag_omit_frame_pointer;
718 /* If this is an add to the frame pointer, then accept it as is so
719 that we can later fold in the fp/sp offset from frame pointer
721 if (flag_omit_frame_pointer
722 && GET_CODE (operands[1]) == REG
723 && (REGNO (operands[1]) == VIRTUAL_STACK_VARS_REGNUM
724 || REGNO (operands[1]) == FRAME_POINTER_REGNUM))
726 emit_insn (gen_addsi3_fp (operands[0], operands[1], operands[2]));
730 /* Convert adds to subtracts if this makes loading the constant cheaper.
731 But only if we are allowed to generate new pseudos. */
732 if (! (reload_in_progress || reload_completed)
733 && GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) < -32)
735 int neg_value = - INTVAL (operands[2]);
736 if ( CONST_OK_FOR_I (neg_value)
737 || CONST_OK_FOR_M (neg_value)
738 || CONST_OK_FOR_N (neg_value))
740 operands[2] = copy_to_mode_reg (SImode, GEN_INT (neg_value));
741 emit_insn (gen_subsi3 (operands[0], operands[1], operands[2]));
746 if (! mcore_addsub_operand (operands[2], SImode))
747 operands[2] = copy_to_mode_reg (SImode, operands[2]);
750 ;; RBE: for some constants which are not in the range which allows
751 ;; us to do a single operation, we will try a paired addi/addi instead
752 ;; of a movi/addi. This relieves some register pressure at the expense
753 ;; of giving away some potential constant reuse.
755 ;; RBE 6/17/97: this didn't buy us anything, but I keep the pattern
756 ;; for later reference
758 ;; (define_insn "addsi3_i2"
759 ;; [(set (match_operand:SI 0 "mcore_arith_reg_operand" "=r")
760 ;; (plus:SI (match_operand:SI 1 "mcore_arith_reg_operand" "%0")
761 ;; (match_operand:SI 2 "const_int_operand" "g")))]
762 ;; "GET_CODE(operands[2]) == CONST_INT
763 ;; && ((INTVAL (operands[2]) > 32 && INTVAL(operands[2]) <= 64)
764 ;; || (INTVAL (operands[2]) < -32 && INTVAL(operands[2]) >= -64))"
767 ;; int n = INTVAL(operands[2]);
770 ;; operands[2] = GEN_INT(n - 32);
771 ;; return \"addi\\t%0,32\;addi\\t%0,%2\";
776 ;; operands[2] = GEN_INT(n - 32);
777 ;; return \"subi\\t%0,32\;subi\\t%0,%2\";
780 ;; [(set_attr "length" "4")])
782 (define_insn "addsi3_i"
783 [(set (match_operand:SI 0 "mcore_arith_reg_operand" "=r,r,r")
784 (plus:SI (match_operand:SI 1 "mcore_arith_reg_operand" "%0,0,0")
785 (match_operand:SI 2 "mcore_addsub_operand" "r,J,L")))]
792 ;; This exists so that address computations based on the frame pointer
793 ;; can be folded in when frame pointer elimination occurs. Ordinarily
794 ;; this would be bad because it allows insns which would require reloading,
795 ;; but without it, we get multiple adds where one would do.
797 (define_insn "addsi3_fp"
798 [(set (match_operand:SI 0 "mcore_arith_reg_operand" "=r,r,r")
799 (plus:SI (match_operand:SI 1 "mcore_arith_reg_operand" "%0,0,0")
800 (match_operand:SI 2 "immediate_operand" "r,J,L")))]
801 "flag_omit_frame_pointer
802 && (reload_in_progress || reload_completed || REGNO (operands[1]) == FRAME_POINTER_REGNUM)"
808 ;; RBE: for some constants which are not in the range which allows
809 ;; us to do a single operation, we will try a paired addi/addi instead
810 ;; of a movi/addi. This relieves some register pressure at the expense
811 ;; of giving away some potential constant reuse.
813 ;; RBE 6/17/97: this didn't buy us anything, but I keep the pattern
814 ;; for later reference
816 ;; (define_insn "subsi3_i2"
817 ;; [(set (match_operand:SI 0 "mcore_arith_reg_operand" "=r")
818 ;; (plus:SI (match_operand:SI 1 "mcore_arith_reg_operand" "%0")
819 ;; (match_operand:SI 2 "const_int_operand" "g")))]
820 ;; "TARGET_RBETEST && GET_CODE(operands[2]) == CONST_INT
821 ;; && ((INTVAL (operands[2]) > 32 && INTVAL(operands[2]) <= 64)
822 ;; || (INTVAL (operands[2]) < -32 && INTVAL(operands[2]) >= -64))"
825 ;; int n = INTVAL(operands[2]);
828 ;; operands[2] = GEN_INT( n - 32);
829 ;; return \"subi\\t%0,32\;subi\\t%0,%2\";
834 ;; operands[2] = GEN_INT(n - 32);
835 ;; return \"addi\\t%0,32\;addi\\t%0,%2\";
838 ;; [(set_attr "length" "4")])
840 ;(define_insn "subsi3"
841 ; [(set (match_operand:SI 0 "mcore_arith_reg_operand" "=r,r,r,r")
842 ; (minus:SI (match_operand:SI 1 "mcore_arith_K_operand" "0,0,r,K")
843 ; (match_operand:SI 2 "mcore_arith_J_operand" "r,J,0,0")))]
851 (define_insn "subsi3"
852 [(set (match_operand:SI 0 "mcore_arith_reg_operand" "=r,r,r")
853 (minus:SI (match_operand:SI 1 "mcore_arith_reg_operand" "0,0,r")
854 (match_operand:SI 2 "mcore_arith_J_operand" "r,J,0")))]
862 [(set (match_operand:SI 0 "mcore_arith_reg_operand" "=r")
863 (minus:SI (match_operand:SI 1 "mcore_literal_K_operand" "K")
864 (match_operand:SI 2 "mcore_arith_reg_operand" "0")))]
868 (define_insn "adddi3"
869 [(set (match_operand:DI 0 "mcore_arith_reg_operand" "=&r")
870 (plus:DI (match_operand:DI 1 "mcore_arith_reg_operand" "%0")
871 (match_operand:DI 2 "mcore_arith_reg_operand" "r")))
872 (clobber (reg:CC 17))]
876 if (TARGET_LITTLE_END)
877 return \"cmplt %0,%0\;addc %0,%2\;addc %R0,%R2\";
878 return \"cmplt %R0,%R0\;addc %R0,%R2\;addc %0,%2\";
880 [(set_attr "length" "6")])
882 ;; special case for "longlong += 1"
884 [(set (match_operand:DI 0 "mcore_arith_reg_operand" "=&r")
885 (plus:DI (match_operand:DI 1 "mcore_arith_reg_operand" "0")
887 (clobber (reg:CC 17))]
891 if (TARGET_LITTLE_END)
892 return \"addi %0,1\;cmpnei %0,0\;incf %R0\";
893 return \"addi %R0,1\;cmpnei %R0,0\;incf %0\";
895 [(set_attr "length" "6")])
897 ;; special case for "longlong -= 1"
899 [(set (match_operand:DI 0 "mcore_arith_reg_operand" "=&r")
900 (plus:DI (match_operand:DI 1 "mcore_arith_reg_operand" "0")
902 (clobber (reg:CC 17))]
906 if (TARGET_LITTLE_END)
907 return \"cmpnei %0,0\;decf %R0\;subi %0,1\";
908 return \"cmpnei %R0,0\;decf %0\;subi %R0,1\";
910 [(set_attr "length" "6")])
912 ;; special case for "longlong += const_int"
913 ;; we have to use a register for the const_int because we don't
914 ;; have an unsigned compare immediate... only +/- 1 get to
915 ;; play the no-extra register game because they compare with 0.
916 ;; This winds up working out for any literal that is synthesized
917 ;; with a single instruction. The more complicated ones look
918 ;; like the get broken into subreg's to get initialized too soon
919 ;; for us to catch here. -- RBE 4/25/96
920 ;; only allow for-sure positive values.
923 [(set (match_operand:DI 0 "mcore_arith_reg_operand" "=&r")
924 (plus:DI (match_operand:DI 1 "mcore_arith_reg_operand" "0")
925 (match_operand:SI 2 "const_int_operand" "r")))
926 (clobber (reg:CC 17))]
927 "GET_CODE (operands[2]) == CONST_INT
928 && INTVAL (operands[2]) > 0 && ! (INTVAL (operands[2]) & 0x80000000)"
931 gcc_assert (GET_MODE (operands[2]) == SImode);
932 if (TARGET_LITTLE_END)
933 return \"addu %0,%2\;cmphs %0,%2\;incf %R0\";
934 return \"addu %R0,%2\;cmphs %R0,%2\;incf %0\";
936 [(set_attr "length" "6")])
938 ;; optimize "long long" + "unsigned long"
939 ;; won't trigger because of how the extension is expanded upstream.
941 ;; [(set (match_operand:DI 0 "mcore_arith_reg_operand" "=&r")
942 ;; (plus:DI (match_operand:DI 1 "mcore_arith_reg_operand" "%0")
943 ;; (zero_extend:DI (match_operand:SI 2 "mcore_arith_reg_operand" "r"))))
944 ;; (clobber (reg:CC 17))]
946 ;; "cmplt %R0,%R0\;addc %R0,%2\;inct %0"
947 ;; [(set_attr "length" "6")])
949 ;; optimize "long long" + "signed long"
950 ;; won't trigger because of how the extension is expanded upstream.
952 ;; [(set (match_operand:DI 0 "mcore_arith_reg_operand" "=&r")
953 ;; (plus:DI (match_operand:DI 1 "mcore_arith_reg_operand" "%0")
954 ;; (sign_extend:DI (match_operand:SI 2 "mcore_arith_reg_operand" "r"))))
955 ;; (clobber (reg:CC 17))]
957 ;; "cmplt %R0,%R0\;addc %R0,%2\;inct %0\;btsti %2,31\;dect %0"
958 ;; [(set_attr "length" "6")])
960 (define_insn "subdi3"
961 [(set (match_operand:DI 0 "mcore_arith_reg_operand" "=&r")
962 (minus:DI (match_operand:DI 1 "mcore_arith_reg_operand" "0")
963 (match_operand:DI 2 "mcore_arith_reg_operand" "r")))
964 (clobber (reg:CC 17))]
968 if (TARGET_LITTLE_END)
969 return \"cmphs %0,%0\;subc %0,%2\;subc %R0,%R2\";
970 return \"cmphs %R0,%R0\;subc %R0,%R2\;subc %0,%2\";
972 [(set_attr "length" "6")])
974 ;; -------------------------------------------------------------------------
975 ;; Multiplication instructions
976 ;; -------------------------------------------------------------------------
978 (define_insn "mulsi3"
979 [(set (match_operand:SI 0 "mcore_arith_reg_operand" "=r")
980 (mult:SI (match_operand:SI 1 "mcore_arith_reg_operand" "%0")
981 (match_operand:SI 2 "mcore_arith_reg_operand" "r")))]
986 ;; 32/32 signed division -- added to the MCORE instruction set spring 1997
988 ;; Different constraints based on the architecture revision...
990 (define_expand "divsi3"
991 [(set (match_operand:SI 0 "mcore_arith_reg_operand" "")
992 (div:SI (match_operand:SI 1 "mcore_arith_reg_operand" "")
993 (match_operand:SI 2 "mcore_arith_reg_operand" "")))]
997 ;; MCORE Revision 1.50: restricts the divisor to be in r1. (6/97)
1000 [(set (match_operand:SI 0 "mcore_arith_reg_operand" "=r")
1001 (div:SI (match_operand:SI 1 "mcore_arith_reg_operand" "0")
1002 (match_operand:SI 2 "mcore_arith_reg_operand" "b")))]
1007 ;; 32/32 signed division -- added to the MCORE instruction set spring 1997
1009 ;; Different constraints based on the architecture revision...
1011 (define_expand "udivsi3"
1012 [(set (match_operand:SI 0 "mcore_arith_reg_operand" "")
1013 (udiv:SI (match_operand:SI 1 "mcore_arith_reg_operand" "")
1014 (match_operand:SI 2 "mcore_arith_reg_operand" "")))]
1018 ;; MCORE Revision 1.50: restricts the divisor to be in r1. (6/97)
1020 [(set (match_operand:SI 0 "mcore_arith_reg_operand" "=r")
1021 (udiv:SI (match_operand:SI 1 "mcore_arith_reg_operand" "0")
1022 (match_operand:SI 2 "mcore_arith_reg_operand" "b")))]
1026 ;; -------------------------------------------------------------------------
1028 ;; -------------------------------------------------------------------------
1030 (define_insn "negsi2"
1031 [(set (match_operand:SI 0 "mcore_arith_reg_operand" "=r")
1032 (neg:SI (match_operand:SI 1 "mcore_arith_reg_operand" "0")))]
1036 return \"rsubi %0,0\";
1040 (define_insn "abssi2"
1041 [(set (match_operand:SI 0 "mcore_arith_reg_operand" "=r")
1042 (abs:SI (match_operand:SI 1 "mcore_arith_reg_operand" "0")))]
1046 (define_insn "negdi2"
1047 [(set (match_operand:DI 0 "mcore_arith_reg_operand" "=&r")
1048 (neg:DI (match_operand:DI 1 "mcore_arith_reg_operand" "0")))
1049 (clobber (reg:CC 17))]
1053 if (TARGET_LITTLE_END)
1054 return \"cmpnei %0,0\\n\\trsubi %0,0\\n\\tnot %R0\\n\\tincf %R0\";
1055 return \"cmpnei %R0,0\\n\\trsubi %R0,0\\n\\tnot %0\\n\\tincf %0\";
1057 [(set_attr "length" "8")])
1059 (define_insn "one_cmplsi2"
1060 [(set (match_operand:SI 0 "mcore_arith_reg_operand" "=r")
1061 (not:SI (match_operand:SI 1 "mcore_arith_reg_operand" "0")))]
1065 ;; -------------------------------------------------------------------------
1066 ;; Zero extension instructions
1067 ;; -------------------------------------------------------------------------
1069 (define_expand "zero_extendhisi2"
1070 [(set (match_operand:SI 0 "mcore_arith_reg_operand" "")
1071 (zero_extend:SI (match_operand:HI 1 "mcore_arith_reg_operand" "")))]
1076 [(set (match_operand:SI 0 "mcore_arith_reg_operand" "=r,r")
1077 (zero_extend:SI (match_operand:HI 1 "general_operand" "0,m")))]
1082 [(set_attr "type" "shift,load")])
1084 ;; ldh gives us a free zero-extension. The combiner picks up on this.
1086 [(set (match_operand:SI 0 "mcore_arith_reg_operand" "=r")
1087 (zero_extend:SI (mem:HI (match_operand:SI 1 "mcore_arith_reg_operand" "r"))))]
1090 [(set_attr "type" "load")])
1093 [(set (match_operand:SI 0 "mcore_arith_reg_operand" "=r")
1094 (zero_extend:SI (mem:HI (plus:SI (match_operand:SI 1 "mcore_arith_reg_operand" "r")
1095 (match_operand:SI 2 "const_int_operand" "")))))]
1096 "(INTVAL (operands[2]) >= 0) &&
1097 (INTVAL (operands[2]) < 32) &&
1098 ((INTVAL (operands[2])&1) == 0)"
1100 [(set_attr "type" "load")])
1102 (define_expand "zero_extendqisi2"
1103 [(set (match_operand:SI 0 "mcore_arith_reg_operand" "")
1104 (zero_extend:SI (match_operand:QI 1 "general_operand" "")))]
1108 ;; RBE: XXX: we don't recognize that the xtrb3 kills the CC register.
1110 [(set (match_operand:SI 0 "mcore_arith_reg_operand" "=r,b,r")
1111 (zero_extend:SI (match_operand:QI 1 "general_operand" "0,r,m")))]
1117 [(set_attr "type" "shift,shift,load")])
1119 ;; ldb gives us a free zero-extension. The combiner picks up on this.
1121 [(set (match_operand:SI 0 "mcore_arith_reg_operand" "=r")
1122 (zero_extend:SI (mem:QI (match_operand:SI 1 "mcore_arith_reg_operand" "r"))))]
1125 [(set_attr "type" "load")])
1128 [(set (match_operand:SI 0 "mcore_arith_reg_operand" "=r")
1129 (zero_extend:SI (mem:QI (plus:SI (match_operand:SI 1 "mcore_arith_reg_operand" "r")
1130 (match_operand:SI 2 "const_int_operand" "")))))]
1131 "(INTVAL (operands[2]) >= 0) &&
1132 (INTVAL (operands[2]) < 16)"
1134 [(set_attr "type" "load")])
1136 (define_expand "zero_extendqihi2"
1137 [(set (match_operand:HI 0 "mcore_arith_reg_operand" "")
1138 (zero_extend:HI (match_operand:QI 1 "general_operand" "")))]
1142 ;; RBE: XXX: we don't recognize that the xtrb3 kills the CC register.
1144 [(set (match_operand:HI 0 "mcore_arith_reg_operand" "=r,b,r")
1145 (zero_extend:HI (match_operand:QI 1 "general_operand" "0,r,m")))]
1151 [(set_attr "type" "shift,shift,load")])
1153 ;; ldb gives us a free zero-extension. The combiner picks up on this.
1154 ;; this doesn't catch references that are into a structure.
1155 ;; note that normally the compiler uses the above insn, unless it turns
1156 ;; out that we're dealing with a volatile...
1158 [(set (match_operand:HI 0 "mcore_arith_reg_operand" "=r")
1159 (zero_extend:HI (mem:QI (match_operand:SI 1 "mcore_arith_reg_operand" "r"))))]
1162 [(set_attr "type" "load")])
1165 [(set (match_operand:HI 0 "mcore_arith_reg_operand" "=r")
1166 (zero_extend:HI (mem:QI (plus:SI (match_operand:SI 1 "mcore_arith_reg_operand" "r")
1167 (match_operand:SI 2 "const_int_operand" "")))))]
1168 "(INTVAL (operands[2]) >= 0) &&
1169 (INTVAL (operands[2]) < 16)"
1171 [(set_attr "type" "load")])
1174 ;; -------------------------------------------------------------------------
1175 ;; Sign extension instructions
1176 ;; -------------------------------------------------------------------------
1178 (define_expand "extendsidi2"
1179 [(set (match_operand:DI 0 "mcore_arith_reg_operand" "=r")
1180 (match_operand:SI 1 "mcore_arith_reg_operand" "r"))]
1186 if (TARGET_LITTLE_END)
1191 emit_insn (gen_rtx_SET (VOIDmode, gen_rtx_SUBREG (SImode, operands[0], low),
1193 emit_insn (gen_rtx_SET (VOIDmode, gen_rtx_SUBREG (SImode, operands[0], high),
1194 gen_rtx_ASHIFTRT (SImode,
1195 gen_rtx_SUBREG (SImode, operands[0], low),
1201 (define_insn "extendhisi2"
1202 [(set (match_operand:SI 0 "mcore_arith_reg_operand" "=r")
1203 (sign_extend:SI (match_operand:HI 1 "mcore_arith_reg_operand" "0")))]
1207 (define_insn "extendqisi2"
1208 [(set (match_operand:SI 0 "mcore_arith_reg_operand" "=r")
1209 (sign_extend:SI (match_operand:QI 1 "mcore_arith_reg_operand" "0")))]
1213 (define_insn "extendqihi2"
1214 [(set (match_operand:HI 0 "mcore_arith_reg_operand" "=r")
1215 (sign_extend:HI (match_operand:QI 1 "mcore_arith_reg_operand" "0")))]
1219 ;; -------------------------------------------------------------------------
1220 ;; Move instructions
1221 ;; -------------------------------------------------------------------------
1225 (define_expand "movsi"
1226 [(set (match_operand:SI 0 "general_operand" "")
1227 (match_operand:SI 1 "general_operand" ""))]
1231 if (GET_CODE (operands[0]) == MEM)
1232 operands[1] = force_reg (SImode, operands[1]);
1236 [(set (match_operand:SI 0 "mcore_general_movdst_operand" "=r,r,a,r,a,r,m")
1237 (match_operand:SI 1 "mcore_general_movsrc_operand" "r,P,i,c,R,m,r"))]
1238 "(register_operand (operands[0], SImode)
1239 || register_operand (operands[1], SImode))"
1240 "* return mcore_output_move (insn, operands, SImode);"
1241 [(set_attr "type" "move,move,move,move,load,load,store")])
1247 (define_expand "movhi"
1248 [(set (match_operand:HI 0 "general_operand" "")
1249 (match_operand:HI 1 "general_operand" ""))]
1253 if (GET_CODE (operands[0]) == MEM)
1254 operands[1] = force_reg (HImode, operands[1]);
1255 else if (CONSTANT_P (operands[1])
1256 && (GET_CODE (operands[1]) != CONST_INT
1257 || (! CONST_OK_FOR_I (INTVAL (operands[1]))
1258 && ! CONST_OK_FOR_M (INTVAL (operands[1]))
1259 && ! CONST_OK_FOR_N (INTVAL (operands[1]))))
1260 && ! reload_completed && ! reload_in_progress)
1262 rtx reg = gen_reg_rtx (SImode);
1263 emit_insn (gen_movsi (reg, operands[1]));
1264 operands[1] = gen_lowpart (HImode, reg);
1269 [(set (match_operand:HI 0 "mcore_general_movdst_operand" "=r,r,a,r,r,m")
1270 (match_operand:HI 1 "mcore_general_movsrc_operand" "r,P,i,c,m,r"))]
1271 "(register_operand (operands[0], HImode)
1272 || register_operand (operands[1], HImode))"
1273 "* return mcore_output_move (insn, operands, HImode);"
1274 [(set_attr "type" "move,move,move,move,load,store")])
1280 (define_expand "movqi"
1281 [(set (match_operand:QI 0 "general_operand" "")
1282 (match_operand:QI 1 "general_operand" ""))]
1286 if (GET_CODE (operands[0]) == MEM)
1287 operands[1] = force_reg (QImode, operands[1]);
1288 else if (CONSTANT_P (operands[1])
1289 && (GET_CODE (operands[1]) != CONST_INT
1290 || (! CONST_OK_FOR_I (INTVAL (operands[1]))
1291 && ! CONST_OK_FOR_M (INTVAL (operands[1]))
1292 && ! CONST_OK_FOR_N (INTVAL (operands[1]))))
1293 && ! reload_completed && ! reload_in_progress)
1295 rtx reg = gen_reg_rtx (SImode);
1296 emit_insn (gen_movsi (reg, operands[1]));
1297 operands[1] = gen_lowpart (QImode, reg);
1302 [(set (match_operand:QI 0 "mcore_general_movdst_operand" "=r,r,a,r,r,m")
1303 (match_operand:QI 1 "mcore_general_movsrc_operand" "r,P,i,c,m,r"))]
1304 "(register_operand (operands[0], QImode)
1305 || register_operand (operands[1], QImode))"
1306 "* return mcore_output_move (insn, operands, QImode);"
1307 [(set_attr "type" "move,move,move,move,load,store")])
1312 (define_expand "movdi"
1313 [(set (match_operand:DI 0 "general_operand" "")
1314 (match_operand:DI 1 "general_operand" ""))]
1318 if (GET_CODE (operands[0]) == MEM)
1319 operands[1] = force_reg (DImode, operands[1]);
1320 else if (GET_CODE (operands[1]) == CONST_INT
1321 && ! CONST_OK_FOR_I (INTVAL (operands[1]))
1322 && ! CONST_OK_FOR_M (INTVAL (operands[1]))
1323 && ! CONST_OK_FOR_N (INTVAL (operands[1])))
1326 for (i = 0; i < UNITS_PER_WORD * 2; i += UNITS_PER_WORD)
1327 emit_move_insn (simplify_gen_subreg (SImode, operands[0], DImode, i),
1328 simplify_gen_subreg (SImode, operands[1], DImode, i));
1333 (define_insn "movdi_i"
1334 [(set (match_operand:DI 0 "general_operand" "=r,r,r,r,a,r,m")
1335 (match_operand:DI 1 "mcore_general_movsrc_operand" "I,M,N,r,R,m,r"))]
1337 "* return mcore_output_movedouble (operands, DImode);"
1338 [(set_attr "length" "4") (set_attr "type" "move,move,move,move,load,load,store")])
1342 (define_expand "movsf"
1343 [(set (match_operand:SF 0 "general_operand" "")
1344 (match_operand:SF 1 "general_operand" ""))]
1348 if (GET_CODE (operands[0]) == MEM)
1349 operands[1] = force_reg (SFmode, operands[1]);
1352 (define_insn "movsf_i"
1353 [(set (match_operand:SF 0 "general_operand" "=r,r,m")
1354 (match_operand:SF 1 "general_operand" "r,m,r"))]
1360 [(set_attr "type" "move,load,store")])
1364 (define_expand "movdf"
1365 [(set (match_operand:DF 0 "general_operand" "")
1366 (match_operand:DF 1 "general_operand" ""))]
1370 if (GET_CODE (operands[0]) == MEM)
1371 operands[1] = force_reg (DFmode, operands[1]);
1374 (define_insn "movdf_k"
1375 [(set (match_operand:DF 0 "general_operand" "=r,r,m")
1376 (match_operand:DF 1 "general_operand" "r,m,r"))]
1378 "* return mcore_output_movedouble (operands, DFmode);"
1379 [(set_attr "length" "4") (set_attr "type" "move,load,store")])
1382 ;; Load/store multiple
1384 ;; ??? This is not currently used.
1386 [(set (match_operand:TI 0 "mcore_arith_reg_operand" "=r")
1387 (mem:TI (match_operand:SI 1 "mcore_arith_reg_operand" "r")))]
1391 ;; ??? This is not currently used.
1393 [(set (mem:TI (match_operand:SI 0 "mcore_arith_reg_operand" "r"))
1394 (match_operand:TI 1 "mcore_arith_reg_operand" "r"))]
1398 (define_expand "load_multiple"
1399 [(match_par_dup 3 [(set (match_operand:SI 0 "" "")
1400 (match_operand:SI 1 "" ""))
1401 (use (match_operand:SI 2 "" ""))])]
1405 int regno, count, i;
1407 /* Support only loading a constant number of registers from memory and
1408 only if at least two registers. The last register must be r15. */
1409 if (GET_CODE (operands[2]) != CONST_INT
1410 || INTVAL (operands[2]) < 2
1411 || GET_CODE (operands[1]) != MEM
1412 || XEXP (operands[1], 0) != stack_pointer_rtx
1413 || GET_CODE (operands[0]) != REG
1414 || REGNO (operands[0]) + INTVAL (operands[2]) != 16)
1417 count = INTVAL (operands[2]);
1418 regno = REGNO (operands[0]);
1420 operands[3] = gen_rtx_PARALLEL (VOIDmode, rtvec_alloc (count));
1422 for (i = 0; i < count; i++)
1423 XVECEXP (operands[3], 0, i)
1424 = gen_rtx_SET (VOIDmode,
1425 gen_rtx_REG (SImode, regno + i),
1426 gen_rtx_MEM (SImode, plus_constant (stack_pointer_rtx,
1431 [(match_parallel 0 "mcore_load_multiple_operation"
1432 [(set (match_operand:SI 1 "mcore_arith_reg_operand" "=r")
1433 (mem:SI (match_operand:SI 2 "register_operand" "r")))])]
1434 "GET_CODE (operands[2]) == REG && REGNO (operands[2]) == STACK_POINTER_REGNUM"
1437 (define_expand "store_multiple"
1438 [(match_par_dup 3 [(set (match_operand:SI 0 "" "")
1439 (match_operand:SI 1 "" ""))
1440 (use (match_operand:SI 2 "" ""))])]
1444 int regno, count, i;
1446 /* Support only storing a constant number of registers to memory and
1447 only if at least two registers. The last register must be r15. */
1448 if (GET_CODE (operands[2]) != CONST_INT
1449 || INTVAL (operands[2]) < 2
1450 || GET_CODE (operands[0]) != MEM
1451 || XEXP (operands[0], 0) != stack_pointer_rtx
1452 || GET_CODE (operands[1]) != REG
1453 || REGNO (operands[1]) + INTVAL (operands[2]) != 16)
1456 count = INTVAL (operands[2]);
1457 regno = REGNO (operands[1]);
1459 operands[3] = gen_rtx_PARALLEL (VOIDmode, rtvec_alloc (count));
1461 for (i = 0; i < count; i++)
1462 XVECEXP (operands[3], 0, i)
1463 = gen_rtx_SET (VOIDmode,
1464 gen_rtx_MEM (SImode, plus_constant (stack_pointer_rtx,
1466 gen_rtx_REG (SImode, regno + i));
1470 [(match_parallel 0 "mcore_store_multiple_operation"
1471 [(set (mem:SI (match_operand:SI 2 "register_operand" "r"))
1472 (match_operand:SI 1 "mcore_arith_reg_operand" "r"))])]
1473 "GET_CODE (operands[2]) == REG && REGNO (operands[2]) == STACK_POINTER_REGNUM"
1476 ;; ------------------------------------------------------------------------
1477 ;; Define the real conditional branch instructions.
1478 ;; ------------------------------------------------------------------------
1480 (define_insn "branch_true"
1481 [(set (pc) (if_then_else (ne (reg:CC 17) (const_int 0))
1482 (label_ref (match_operand 0 "" ""))
1486 [(set_attr "type" "brcond")])
1488 (define_insn "branch_false"
1489 [(set (pc) (if_then_else (eq (reg:CC 17) (const_int 0))
1490 (label_ref (match_operand 0 "" ""))
1494 [(set_attr "type" "brcond")])
1496 (define_insn "inverse_branch_true"
1497 [(set (pc) (if_then_else (ne (reg:CC 17) (const_int 0))
1499 (label_ref (match_operand 0 "" ""))))]
1502 [(set_attr "type" "brcond")])
1504 (define_insn "inverse_branch_false"
1505 [(set (pc) (if_then_else (eq (reg:CC 17) (const_int 0))
1507 (label_ref (match_operand 0 "" ""))))]
1510 [(set_attr "type" "brcond")])
1512 ;; Conditional branch insns
1514 ;; At top-level, condition test are eq/ne, because we
1515 ;; are comparing against the condition register (which
1516 ;; has the result of the true relational test
1518 ; There is no beq compare, so we reverse the branch arms.
1520 (define_expand "beq"
1521 [(set (pc) (if_then_else (ne (match_dup 1) (const_int 0))
1523 (label_ref (match_operand 0 "" ""))))]
1527 operands[1] = mcore_gen_compare_reg (EQ);
1530 (define_expand "bne"
1531 [(set (pc) (if_then_else (ne (match_dup 1) (const_int 0))
1532 (label_ref (match_operand 0 "" ""))
1537 operands[1] = mcore_gen_compare_reg (NE);
1540 ; check whether (GT A imm) can become (LE A imm) with the branch reversed.
1541 ; if so, emit a (LT A imm + 1) in place of the (LE A imm). BRC
1543 (define_expand "bgt"
1544 [(set (pc) (if_then_else (ne (match_dup 1) (const_int 0))
1545 (label_ref (match_operand 0 "" ""))
1550 if (mcore_modify_comparison (LE))
1552 emit_jump_insn (gen_reverse_blt (operands[0]));
1555 operands[1] = mcore_gen_compare_reg (GT);
1558 ; There is no ble compare, so we reverse the branch arms.
1559 ; reversed the condition and branch arms for ble -- the check_dbra_loop()
1560 ; transformation assumes that ble uses a branch-true with the label as
1561 ; as the target. BRC
1563 ; check whether (LE A imm) can become (LT A imm + 1).
1565 (define_expand "ble"
1566 [(set (pc) (if_then_else (eq (match_dup 1) (const_int 0))
1567 (label_ref (match_operand 0 "" ""))
1572 if (mcore_modify_comparison (LE))
1574 emit_jump_insn (gen_blt (operands[0]));
1577 operands[1] = mcore_gen_compare_reg (LE);
1580 ; make generating a reversed blt simple
1581 (define_expand "reverse_blt"
1582 [(set (pc) (if_then_else (ne (match_dup 1) (const_int 0))
1584 (label_ref (match_operand 0 "" ""))))]
1588 operands[1] = mcore_gen_compare_reg (LT);
1591 (define_expand "blt"
1592 [(set (pc) (if_then_else (ne (match_dup 1) (const_int 0))
1593 (label_ref (match_operand 0 "" ""))
1598 operands[1] = mcore_gen_compare_reg (LT);
1601 ; There is no bge compare, so we reverse the branch arms.
1603 (define_expand "bge"
1604 [(set (pc) (if_then_else (ne (match_dup 1) (const_int 0))
1606 (label_ref (match_operand 0 "" ""))))]
1610 operands[1] = mcore_gen_compare_reg (GE);
1613 ; There is no gtu compare, so we reverse the branch arms
1615 ;(define_expand "bgtu"
1616 ; [(set (pc) (if_then_else (ne (match_dup 1) (const_int 0))
1618 ; (label_ref (match_operand 0 "" ""))))]
1622 ; if (GET_CODE (arch_compare_op1) == CONST_INT
1623 ; && INTVAL (arch_compare_op1) == 0)
1624 ; operands[1] = mcore_gen_compare_reg (NE);
1626 ; { if (mcore_modify_comparison (GTU))
1628 ; emit_jump_insn (gen_bgeu (operands[0]));
1631 ; operands[1] = mcore_gen_compare_reg (LEU);
1635 (define_expand "bgtu"
1636 [(set (pc) (if_then_else (ne (match_dup 1) (const_int 0))
1638 (label_ref (match_operand 0 "" ""))))]
1642 if (GET_CODE (arch_compare_op1) == CONST_INT
1643 && INTVAL (arch_compare_op1) == 0)
1645 /* The inverse of '> 0' for an unsigned test is
1646 '== 0' but we do not have such an instruction available.
1647 Instead we must reverse the branch (back to the normal
1648 ordering) and test '!= 0'. */
1650 operands[1] = mcore_gen_compare_reg (NE);
1652 emit_jump_insn (gen_rtx_SET (VOIDmode,
1654 gen_rtx_IF_THEN_ELSE (VOIDmode,
1655 gen_rtx_NE (VOIDmode,
1658 gen_rtx_LABEL_REF (VOIDmode,operands[0]),
1662 operands[1] = mcore_gen_compare_reg (GTU);
1666 (define_expand "bleu"
1667 [(set (pc) (if_then_else (ne (match_dup 1) (const_int 0))
1668 (label_ref (match_operand 0 "" ""))
1673 operands[1] = mcore_gen_compare_reg (LEU);
1676 ; There is no bltu compare, so we reverse the branch arms
1677 (define_expand "bltu"
1678 [(set (pc) (if_then_else (ne (match_dup 1) (const_int 0))
1680 (label_ref (match_operand 0 "" ""))))]
1684 operands[1] = mcore_gen_compare_reg (LTU);
1687 (define_expand "bgeu"
1688 [(set (pc) (if_then_else (ne (match_dup 1) (const_int 0))
1689 (label_ref (match_operand 0 "" ""))
1695 operands[1] = mcore_gen_compare_reg (GEU);
1698 ;; ------------------------------------------------------------------------
1699 ;; Jump and linkage insns
1700 ;; ------------------------------------------------------------------------
1702 (define_insn "jump_real"
1704 (label_ref (match_operand 0 "" "")))]
1707 [(set_attr "type" "branch")])
1709 (define_expand "jump"
1710 [(set (pc) (label_ref (match_operand 0 "" "")))]
1714 emit_jump_insn (gen_jump_real (operand0));
1719 (define_insn "indirect_jump"
1721 (match_operand:SI 0 "mcore_arith_reg_operand" "r"))]
1724 [(set_attr "type" "jmp")])
1726 (define_expand "call"
1727 [(parallel[(call (match_operand:SI 0 "" "")
1728 (match_operand 1 "" ""))
1729 (clobber (reg:SI 15))])]
1733 if (GET_CODE (operands[0]) == MEM
1734 && ! register_operand (XEXP (operands[0], 0), SImode)
1735 && ! mcore_symbolic_address_p (XEXP (operands[0], 0)))
1736 operands[0] = gen_rtx_MEM (GET_MODE (operands[0]),
1737 force_reg (Pmode, XEXP (operands[0], 0)));
1740 (define_insn "call_internal"
1741 [(call (mem:SI (match_operand:SI 0 "mcore_call_address_operand" "riR"))
1742 (match_operand 1 "" ""))
1743 (clobber (reg:SI 15))]
1745 "* return mcore_output_call (operands, 0);")
1747 (define_expand "call_value"
1748 [(parallel[(set (match_operand 0 "register_operand" "")
1749 (call (match_operand:SI 1 "" "")
1750 (match_operand 2 "" "")))
1751 (clobber (reg:SI 15))])]
1755 if (GET_CODE (operands[0]) == MEM
1756 && ! register_operand (XEXP (operands[0], 0), SImode)
1757 && ! mcore_symbolic_address_p (XEXP (operands[0], 0)))
1758 operands[1] = gen_rtx_MEM (GET_MODE (operands[1]),
1759 force_reg (Pmode, XEXP (operands[1], 0)));
1762 (define_insn "call_value_internal"
1763 [(set (match_operand 0 "register_operand" "=r")
1764 (call (mem:SI (match_operand:SI 1 "mcore_call_address_operand" "riR"))
1765 (match_operand 2 "" "")))
1766 (clobber (reg:SI 15))]
1768 "* return mcore_output_call (operands, 1);")
1770 (define_insn "call_value_struct"
1771 [(parallel [(set (match_parallel 0 ""
1772 [(expr_list (match_operand 3 "register_operand" "") (match_operand 4 "immediate_operand" ""))
1773 (expr_list (match_operand 5 "register_operand" "") (match_operand 6 "immediate_operand" ""))])
1774 (call (match_operand:SI 1 "" "")
1775 (match_operand 2 "" "")))
1776 (clobber (reg:SI 15))])]
1778 "* return mcore_output_call (operands, 1);"
1782 ;; ------------------------------------------------------------------------
1784 ;; ------------------------------------------------------------------------
1791 (define_insn "tablejump"
1793 (match_operand:SI 0 "mcore_arith_reg_operand" "r"))
1794 (use (label_ref (match_operand 1 "" "")))]
1797 [(set_attr "type" "jmp")])
1799 (define_insn "*return"
1801 "reload_completed && ! mcore_naked_function_p ()"
1803 [(set_attr "type" "jmp")])
1805 (define_insn "*no_return"
1807 "reload_completed && mcore_naked_function_p ()"
1809 [(set_attr "length" "0")]
1812 (define_expand "prologue"
1815 "mcore_expand_prolog (); DONE;")
1817 (define_expand "epilogue"
1820 "mcore_expand_epilog ();")
1822 ;; ------------------------------------------------------------------------
1824 ;; ------------------------------------------------------------------------
1827 [(set (match_operand:SI 0 "mcore_arith_reg_operand" "=r")
1828 (ne:SI (reg:CC 17) (const_int 0)))]
1831 [(set_attr "type" "move")])
1834 [(set (match_operand:SI 0 "mcore_arith_reg_operand" "=r")
1835 (eq:SI (reg:CC 17) (const_int 0)))]
1838 [(set_attr "type" "move")])
1840 ; in 0.97 use (LE 0) with (LT 1) and complement c. BRC
1843 (set (match_operand:SI 0 "mcore_arith_reg_operand" "")
1844 (ne:SI (gt:CC (match_operand:SI 1 "mcore_arith_reg_operand" "")
1847 (clobber (reg:SI 17))])]
1850 (lt:CC (match_dup 1) (const_int 1)))
1851 (set (match_dup 0) (eq:SI (reg:CC 17) (const_int 0)))])
1854 (define_expand "seq"
1855 [(set (match_operand:SI 0 "mcore_arith_reg_operand" "")
1856 (eq:SI (match_dup 1) (const_int 0)))]
1860 operands[1] = mcore_gen_compare_reg (NE);
1863 (define_expand "sne"
1864 [(set (match_operand:SI 0 "mcore_arith_reg_operand" "")
1865 (ne:SI (match_dup 1) (const_int 0)))]
1869 operands[1] = mcore_gen_compare_reg (NE);
1872 (define_expand "slt"
1873 [(set (match_operand:SI 0 "mcore_arith_reg_operand" "")
1874 (ne:SI (match_dup 1) (const_int 0)))]
1878 operands[1] = mcore_gen_compare_reg (LT);
1881 ; make generating a LT with the comparison reversed easy. BRC
1882 (define_expand "reverse_slt"
1883 [(set (match_operand:SI 0 "mcore_arith_reg_operand" "")
1884 (eq:SI (match_dup 1) (const_int 0)))]
1888 operands[1] = mcore_gen_compare_reg (LT);
1891 (define_expand "sge"
1892 [(set (match_operand:SI 0 "mcore_arith_reg_operand" "")
1893 (eq:SI (match_dup 1) (const_int 0)))]
1897 operands[1] = mcore_gen_compare_reg (LT);
1900 ; check whether (GT A imm) can become (LE A imm) with the comparison
1901 ; reversed. if so, emit a (LT A imm + 1) in place of the (LE A imm). BRC
1903 (define_expand "sgt"
1904 [(set (match_operand:SI 0 "mcore_arith_reg_operand" "")
1905 (ne:SI (match_dup 1) (const_int 0)))]
1909 if (mcore_modify_comparison (LE))
1911 emit_insn (gen_reverse_slt (operands[0]));
1915 operands[1] = mcore_gen_compare_reg (GT);
1918 (define_expand "sle"
1919 [(set (match_operand:SI 0 "mcore_arith_reg_operand" "")
1920 (eq:SI (match_dup 1) (const_int 0)))]
1924 if (mcore_modify_comparison (LE))
1926 emit_insn (gen_slt (operands[0]));
1929 operands[1] = mcore_gen_compare_reg (GT);
1932 (define_expand "sltu"
1933 [(set (match_operand:SI 0 "mcore_arith_reg_operand" "")
1934 (eq:SI (match_dup 1) (const_int 0)))]
1938 operands[1] = mcore_gen_compare_reg (GEU);
1941 (define_expand "sgeu"
1942 [(set (match_operand:SI 0 "mcore_arith_reg_operand" "")
1943 (ne:SI (match_dup 1) (const_int 0)))]
1947 operands[1] = mcore_gen_compare_reg (GEU);
1950 (define_expand "sgtu"
1951 [(set (match_operand:SI 0 "mcore_arith_reg_operand" "")
1952 (eq:SI (match_dup 1) (const_int 0)))]
1956 operands[1] = mcore_gen_compare_reg (LEU);
1959 (define_expand "sleu"
1960 [(set (match_operand:SI 0 "mcore_arith_reg_operand" "")
1961 (ne:SI (match_dup 1) (const_int 0)))]
1965 operands[1] = mcore_gen_compare_reg (LEU);
1968 (define_insn "incscc"
1969 [(set (match_operand:SI 0 "mcore_arith_reg_operand" "=r")
1970 (plus:SI (ne (reg:CC 17) (const_int 0))
1971 (match_operand:SI 1 "mcore_arith_reg_operand" "0")))]
1975 (define_insn "incscc_false"
1976 [(set (match_operand:SI 0 "mcore_arith_reg_operand" "=r")
1977 (plus:SI (eq (reg:CC 17) (const_int 0))
1978 (match_operand:SI 1 "mcore_arith_reg_operand" "0")))]
1982 (define_insn "decscc"
1983 [(set (match_operand:SI 0 "mcore_arith_reg_operand" "=r")
1984 (minus:SI (match_operand:SI 1 "mcore_arith_reg_operand" "0")
1985 (ne (reg:CC 17) (const_int 0))))]
1989 (define_insn "decscc_false"
1990 [(set (match_operand:SI 0 "mcore_arith_reg_operand" "=r")
1991 (minus:SI (match_operand:SI 1 "mcore_arith_reg_operand" "0")
1992 (eq (reg:CC 17) (const_int 0))))]
1996 ;; ------------------------------------------------------------------------
1997 ;; Conditional move patterns.
1998 ;; ------------------------------------------------------------------------
2000 (define_expand "smaxsi3"
2002 (lt:CC (match_operand:SI 1 "mcore_arith_reg_operand" "")
2003 (match_operand:SI 2 "mcore_arith_reg_operand" "")))
2004 (set (match_operand:SI 0 "mcore_arith_reg_operand" "")
2005 (if_then_else:SI (eq (reg:CC 17) (const_int 0))
2006 (match_dup 1) (match_dup 2)))]
2011 [(set (match_operand:SI 0 "mcore_arith_reg_operand" "")
2012 (smax:SI (match_operand:SI 1 "mcore_arith_reg_operand" "")
2013 (match_operand:SI 2 "mcore_arith_reg_operand" "")))]
2016 (lt:SI (match_dup 1) (match_dup 2)))
2018 (if_then_else:SI (eq (reg:CC 17) (const_int 0))
2019 (match_dup 1) (match_dup 2)))]
2022 ; no tstgt in 0.97, so just use cmplti (btsti x,31) and reverse move
2025 [(set (match_operand:SI 0 "mcore_arith_reg_operand" "")
2026 (smax:SI (match_operand:SI 1 "mcore_arith_reg_operand" "")
2030 (lt:CC (match_dup 1) (const_int 0)))
2032 (if_then_else:SI (eq (reg:CC 17) (const_int 0))
2033 (match_dup 1) (const_int 0)))]
2036 (define_expand "sminsi3"
2038 (lt:CC (match_operand:SI 1 "mcore_arith_reg_operand" "")
2039 (match_operand:SI 2 "mcore_arith_reg_operand" "")))
2040 (set (match_operand:SI 0 "mcore_arith_reg_operand" "")
2041 (if_then_else:SI (ne (reg:CC 17) (const_int 0))
2042 (match_dup 1) (match_dup 2)))]
2047 [(set (match_operand:SI 0 "mcore_arith_reg_operand" "")
2048 (smin:SI (match_operand:SI 1 "mcore_arith_reg_operand" "")
2049 (match_operand:SI 2 "mcore_arith_reg_operand" "")))]
2052 (lt:SI (match_dup 1) (match_dup 2)))
2054 (if_then_else:SI (ne (reg:CC 17) (const_int 0))
2055 (match_dup 1) (match_dup 2)))]
2059 ; [(set (match_operand:SI 0 "mcore_arith_reg_operand" "")
2060 ; (smin:SI (match_operand:SI 1 "mcore_arith_reg_operand" "")
2064 ; (gt:CC (match_dup 1) (const_int 0)))
2065 ; (set (match_dup 0)
2066 ; (if_then_else:SI (eq (reg:CC 17) (const_int 0))
2067 ; (match_dup 1) (const_int 0)))]
2070 ; changed these unsigned patterns to use geu instead of ltu. it appears
2071 ; that the c-torture & ssrl test suites didn't catch these! only showed
2072 ; up in friedman's clib work. BRC 7/7/95
2074 (define_expand "umaxsi3"
2076 (geu:CC (match_operand:SI 1 "mcore_arith_reg_operand" "")
2077 (match_operand:SI 2 "mcore_arith_reg_operand" "")))
2078 (set (match_operand:SI 0 "mcore_arith_reg_operand" "")
2079 (if_then_else:SI (eq (reg:CC 17) (const_int 0))
2080 (match_dup 2) (match_dup 1)))]
2085 [(set (match_operand:SI 0 "mcore_arith_reg_operand" "")
2086 (umax:SI (match_operand:SI 1 "mcore_arith_reg_operand" "")
2087 (match_operand:SI 2 "mcore_arith_reg_operand" "")))]
2090 (geu:SI (match_dup 1) (match_dup 2)))
2092 (if_then_else:SI (eq (reg:CC 17) (const_int 0))
2093 (match_dup 2) (match_dup 1)))]
2096 (define_expand "uminsi3"
2098 (geu:CC (match_operand:SI 1 "mcore_arith_reg_operand" "")
2099 (match_operand:SI 2 "mcore_arith_reg_operand" "")))
2100 (set (match_operand:SI 0 "mcore_arith_reg_operand" "")
2101 (if_then_else:SI (ne (reg:CC 17) (const_int 0))
2102 (match_dup 2) (match_dup 1)))]
2107 [(set (match_operand:SI 0 "mcore_arith_reg_operand" "")
2108 (umin:SI (match_operand:SI 1 "mcore_arith_reg_operand" "")
2109 (match_operand:SI 2 "mcore_arith_reg_operand" "")))]
2112 (geu:SI (match_dup 1) (match_dup 2)))
2114 (if_then_else:SI (ne (reg:CC 17) (const_int 0))
2115 (match_dup 2) (match_dup 1)))]
2118 ;; ------------------------------------------------------------------------
2119 ;; conditional move patterns really start here
2120 ;; ------------------------------------------------------------------------
2122 ;; the "movtK" patterns are experimental. they are intended to account for
2123 ;; gcc's mucking on code such as:
2125 ;; free_ent = ((block_compress) ? 257 : 256 );
2127 ;; these patterns help to get a tstne/bgeni/inct (or equivalent) sequence
2128 ;; when both arms have constants that are +/- 1 of each other.
2130 ;; note in the following patterns that the "movtK" ones should be the first
2131 ;; one defined in each sequence. this is because the general pattern also
2132 ;; matches, so use ordering to determine priority (it's easier this way than
2133 ;; adding conditions to the general patterns). BRC
2135 ;; the U and Q constraints are necessary to ensure that reload does the
2136 ;; 'right thing'. U constrains the operand to 0 and Q to 1 for use in the
2137 ;; clrt & clrf and clrt/inct & clrf/incf patterns. BRC 6/26
2139 ;; ??? there appears to be some problems with these movtK patterns for ops
2140 ;; other than eq & ne. need to fix. 6/30 BRC
2142 ;; ------------------------------------------------------------------------
2144 ;; ------------------------------------------------------------------------
2146 ; experimental conditional move with two constants +/- 1 BRC
2148 (define_insn "movtK_1"
2149 [(set (match_operand:SI 0 "mcore_arith_reg_operand" "=r")
2151 (ne (reg:CC 17) (const_int 0))
2152 (match_operand:SI 1 "mcore_arith_O_operand" "O")
2153 (match_operand:SI 2 "mcore_arith_O_operand" "O")))]
2154 " GET_CODE (operands[1]) == CONST_INT
2155 && GET_CODE (operands[2]) == CONST_INT
2156 && ( (INTVAL (operands[1]) - INTVAL (operands[2]) == 1)
2157 || (INTVAL (operands[2]) - INTVAL (operands[1]) == 1))"
2158 "* return mcore_output_cmov (operands, 1, NULL);"
2159 [(set_attr "length" "4")])
2161 (define_insn "movt0"
2162 [(set (match_operand:SI 0 "mcore_arith_reg_operand" "=r,r,r,r")
2164 (ne (reg:CC 17) (const_int 0))
2165 (match_operand:SI 1 "mcore_arith_imm_operand" "r,0,U,0")
2166 (match_operand:SI 2 "mcore_arith_imm_operand" "0,r,0,U")))]
2174 ;; ------------------------------------------------------------------------
2176 ;; ------------------------------------------------------------------------
2178 ; experimental conditional move with two constants +/- 1 BRC
2179 (define_insn "movtK_2"
2180 [(set (match_operand:SI 0 "mcore_arith_reg_operand" "=r")
2182 (eq (reg:CC 17) (const_int 0))
2183 (match_operand:SI 1 "mcore_arith_O_operand" "O")
2184 (match_operand:SI 2 "mcore_arith_O_operand" "O")))]
2185 " GET_CODE (operands[1]) == CONST_INT
2186 && GET_CODE (operands[2]) == CONST_INT
2187 && ( (INTVAL (operands[1]) - INTVAL (operands[2]) == 1)
2188 || (INTVAL (operands[2]) - INTVAL (operands[1]) == 1))"
2189 "* return mcore_output_cmov (operands, 0, NULL);"
2190 [(set_attr "length" "4")])
2192 (define_insn "movf0"
2193 [(set (match_operand:SI 0 "mcore_arith_reg_operand" "=r,r,r,r")
2195 (eq (reg:CC 17) (const_int 0))
2196 (match_operand:SI 1 "mcore_arith_imm_operand" "r,0,U,0")
2197 (match_operand:SI 2 "mcore_arith_imm_operand" "0,r,0,U")))]
2205 ; turns lsli rx,imm/btsti rx,31 into btsti rx,imm. not done by a peephole
2206 ; because the instructions are not adjacent (peepholes are related by posn -
2207 ; not by dataflow). BRC
2210 [(set (match_operand:SI 0 "mcore_arith_reg_operand" "=r,r,r,r")
2211 (if_then_else:SI (eq (zero_extract:SI
2212 (match_operand:SI 1 "mcore_arith_reg_operand" "r,r,r,r")
2214 (match_operand:SI 2 "mcore_literal_K_operand" "K,K,K,K"))
2216 (match_operand:SI 3 "mcore_arith_imm_operand" "r,0,U,0")
2217 (match_operand:SI 4 "mcore_arith_imm_operand" "0,r,0,U")))]
2220 btsti %1,%2\;movf %0,%3
2221 btsti %1,%2\;movt %0,%4
2222 btsti %1,%2\;clrf %0
2223 btsti %1,%2\;clrt %0"
2224 [(set_attr "length" "4")])
2226 ; turns sextb rx/btsti rx,31 into btsti rx,7. must be QImode to be safe. BRC
2229 [(set (match_operand:SI 0 "mcore_arith_reg_operand" "=r,r,r,r")
2230 (if_then_else:SI (eq (lshiftrt:SI
2231 (match_operand:SI 1 "mcore_arith_reg_operand" "r,r,r,r")
2234 (match_operand:SI 2 "mcore_arith_imm_operand" "r,0,U,0")
2235 (match_operand:SI 3 "mcore_arith_imm_operand" "0,r,0,U")))]
2236 "GET_CODE (operands[1]) == SUBREG &&
2237 GET_MODE (SUBREG_REG (operands[1])) == QImode"
2239 btsti %1,7\;movf %0,%2
2240 btsti %1,7\;movt %0,%3
2242 btsti %1,7\;clrt %0"
2243 [(set_attr "length" "4")])
2246 ;; ------------------------------------------------------------------------
2248 ;; ------------------------------------------------------------------------
2250 ;; Combine creates this from an andn instruction in a scc sequence.
2251 ;; We must recognize it to get conditional moves generated.
2253 ; experimental conditional move with two constants +/- 1 BRC
2254 (define_insn "movtK_3"
2255 [(set (match_operand:SI 0 "mcore_arith_reg_operand" "=r")
2257 (ne (match_operand:SI 1 "mcore_arith_reg_operand" "r")
2259 (match_operand:SI 2 "mcore_arith_O_operand" "O")
2260 (match_operand:SI 3 "mcore_arith_O_operand" "O")))]
2261 " GET_CODE (operands[2]) == CONST_INT
2262 && GET_CODE (operands[3]) == CONST_INT
2263 && ( (INTVAL (operands[2]) - INTVAL (operands[3]) == 1)
2264 || (INTVAL (operands[3]) - INTVAL (operands[2]) == 1))"
2267 rtx out_operands[4];
2268 out_operands[0] = operands[0];
2269 out_operands[1] = operands[2];
2270 out_operands[2] = operands[3];
2271 out_operands[3] = operands[1];
2273 return mcore_output_cmov (out_operands, 1, \"cmpnei %3,0\");
2276 [(set_attr "length" "6")])
2278 (define_insn "movt2"
2279 [(set (match_operand:SI 0 "mcore_arith_reg_operand" "=r,r,r,r")
2280 (if_then_else:SI (ne (match_operand:SI 1 "mcore_arith_reg_operand" "r,r,r,r")
2282 (match_operand:SI 2 "mcore_arith_imm_operand" "r,0,U,0")
2283 (match_operand:SI 3 "mcore_arith_imm_operand" "0,r,0,U")))]
2286 cmpnei %1,0\;movt %0,%2
2287 cmpnei %1,0\;movf %0,%3
2288 cmpnei %1,0\;clrt %0
2289 cmpnei %1,0\;clrf %0"
2290 [(set_attr "length" "4")])
2292 ; turns lsli rx,imm/btsti rx,31 into btsti rx,imm. not done by a peephole
2293 ; because the instructions are not adjacent (peepholes are related by posn -
2294 ; not by dataflow). BRC
2297 [(set (match_operand:SI 0 "mcore_arith_reg_operand" "=r,r,r,r")
2298 (if_then_else:SI (ne (zero_extract:SI
2299 (match_operand:SI 1 "mcore_arith_reg_operand" "r,r,r,r")
2301 (match_operand:SI 2 "mcore_literal_K_operand" "K,K,K,K"))
2303 (match_operand:SI 3 "mcore_arith_imm_operand" "r,0,U,0")
2304 (match_operand:SI 4 "mcore_arith_imm_operand" "0,r,0,U")))]
2307 btsti %1,%2\;movt %0,%3
2308 btsti %1,%2\;movf %0,%4
2309 btsti %1,%2\;clrt %0
2310 btsti %1,%2\;clrf %0"
2311 [(set_attr "length" "4")])
2313 ; turns sextb rx/btsti rx,31 into btsti rx,7. must be QImode to be safe. BRC
2316 [(set (match_operand:SI 0 "mcore_arith_reg_operand" "=r,r,r,r")
2317 (if_then_else:SI (ne (lshiftrt:SI
2318 (match_operand:SI 1 "mcore_arith_reg_operand" "r,r,r,r")
2321 (match_operand:SI 2 "mcore_arith_imm_operand" "r,0,U,0")
2322 (match_operand:SI 3 "mcore_arith_imm_operand" "0,r,0,U")))]
2323 "GET_CODE (operands[1]) == SUBREG &&
2324 GET_MODE (SUBREG_REG (operands[1])) == QImode"
2326 btsti %1,7\;movt %0,%2
2327 btsti %1,7\;movf %0,%3
2329 btsti %1,7\;clrf %0"
2330 [(set_attr "length" "4")])
2332 ;; ------------------------------------------------------------------------
2334 ;; ------------------------------------------------------------------------
2336 ; experimental conditional move with two constants +/- 1 BRC
2337 (define_insn "movtK_4"
2338 [(set (match_operand:SI 0 "mcore_arith_reg_operand" "=r")
2340 (eq (eq:SI (reg:CC 17) (const_int 0)) (const_int 0))
2341 (match_operand:SI 1 "mcore_arith_O_operand" "O")
2342 (match_operand:SI 2 "mcore_arith_O_operand" "O")))]
2343 "GET_CODE (operands[1]) == CONST_INT &&
2344 GET_CODE (operands[2]) == CONST_INT &&
2345 ((INTVAL (operands[1]) - INTVAL (operands[2]) == 1) ||
2346 (INTVAL (operands[2]) - INTVAL (operands[1]) == 1))"
2347 "* return mcore_output_cmov(operands, 1, NULL);"
2348 [(set_attr "length" "4")])
2350 (define_insn "movt3"
2351 [(set (match_operand:SI 0 "mcore_arith_reg_operand" "=r,r,r,r")
2353 (eq (eq:SI (reg:CC 17) (const_int 0)) (const_int 0))
2354 (match_operand:SI 1 "mcore_arith_imm_operand" "r,0,U,0")
2355 (match_operand:SI 2 "mcore_arith_imm_operand" "0,r,0,U")))]
2363 ;; ------------------------------------------------------------------------
2365 ;; ------------------------------------------------------------------------
2367 ; experimental conditional move with two constants +/- 1 BRC
2368 (define_insn "movtK_5"
2369 [(set (match_operand:SI 0 "mcore_arith_reg_operand" "=r")
2371 (eq (ne:SI (reg:CC 17) (const_int 0)) (const_int 0))
2372 (match_operand:SI 1 "mcore_arith_O_operand" "O")
2373 (match_operand:SI 2 "mcore_arith_O_operand" "O")))]
2374 "GET_CODE (operands[1]) == CONST_INT &&
2375 GET_CODE (operands[2]) == CONST_INT &&
2376 ((INTVAL (operands[1]) - INTVAL (operands[2]) == 1) ||
2377 (INTVAL (operands[2]) - INTVAL (operands[1]) == 1))"
2378 "* return mcore_output_cmov (operands, 0, NULL);"
2379 [(set_attr "length" "4")])
2381 (define_insn "movf1"
2382 [(set (match_operand:SI 0 "mcore_arith_reg_operand" "=r,r,r,r")
2384 (eq (ne:SI (reg:CC 17) (const_int 0)) (const_int 0))
2385 (match_operand:SI 1 "mcore_arith_imm_operand" "r,0,U,0")
2386 (match_operand:SI 2 "mcore_arith_imm_operand" "0,r,0,U")))]
2394 ;; ------------------------------------------------------------------------
2396 ;; ------------------------------------------------------------------------
2398 ;; Combine creates this from an andn instruction in a scc sequence.
2399 ;; We must recognize it to get conditional moves generated.
2401 ; experimental conditional move with two constants +/- 1 BRC
2403 (define_insn "movtK_6"
2404 [(set (match_operand:SI 0 "mcore_arith_reg_operand" "=r")
2406 (eq (match_operand:SI 1 "mcore_arith_reg_operand" "r")
2408 (match_operand:SI 2 "mcore_arith_O_operand" "O")
2409 (match_operand:SI 3 "mcore_arith_O_operand" "O")))]
2410 "GET_CODE (operands[1]) == CONST_INT &&
2411 GET_CODE (operands[2]) == CONST_INT &&
2412 ((INTVAL (operands[2]) - INTVAL (operands[3]) == 1) ||
2413 (INTVAL (operands[3]) - INTVAL (operands[2]) == 1))"
2416 rtx out_operands[4];
2417 out_operands[0] = operands[0];
2418 out_operands[1] = operands[2];
2419 out_operands[2] = operands[3];
2420 out_operands[3] = operands[1];
2422 return mcore_output_cmov (out_operands, 0, \"cmpnei %3,0\");
2424 [(set_attr "length" "6")])
2426 (define_insn "movf3"
2427 [(set (match_operand:SI 0 "mcore_arith_reg_operand" "=r,r,r,r")
2428 (if_then_else:SI (eq (match_operand:SI 1 "mcore_arith_reg_operand" "r,r,r,r")
2430 (match_operand:SI 2 "mcore_arith_imm_operand" "r,0,U,0")
2431 (match_operand:SI 3 "mcore_arith_imm_operand" "0,r,0,U")))]
2434 cmpnei %1,0\;movf %0,%2
2435 cmpnei %1,0\;movt %0,%3
2436 cmpnei %1,0\;clrf %0
2437 cmpnei %1,0\;clrt %0"
2438 [(set_attr "length" "4")])
2440 ;; ------------------------------------------------------------------------
2442 ;; ------------------------------------------------------------------------
2444 ; experimental conditional move with two constants +/- 1 BRC
2445 (define_insn "movtK_7"
2446 [(set (match_operand:SI 0 "mcore_arith_reg_operand" "=r")
2448 (ne (eq:SI (reg:CC 17) (const_int 0)) (const_int 0))
2449 (match_operand:SI 1 "mcore_arith_O_operand" "O")
2450 (match_operand:SI 2 "mcore_arith_O_operand" "O")))]
2451 "GET_CODE (operands[1]) == CONST_INT &&
2452 GET_CODE (operands[2]) == CONST_INT &&
2453 ((INTVAL (operands[1]) - INTVAL (operands[2]) == 1) ||
2454 (INTVAL (operands[2]) - INTVAL (operands[1]) == 1))"
2455 "* return mcore_output_cmov (operands, 0, NULL);"
2456 [(set_attr "length" "4")])
2458 (define_insn "movf4"
2459 [(set (match_operand:SI 0 "mcore_arith_reg_operand" "=r,r,r,r")
2461 (ne (eq:SI (reg:CC 17) (const_int 0)) (const_int 0))
2462 (match_operand:SI 1 "mcore_arith_imm_operand" "r,0,U,0")
2463 (match_operand:SI 2 "mcore_arith_imm_operand" "0,r,0,U")))]
2471 ;; ------------------------------------------------------------------------
2473 ;; ------------------------------------------------------------------------
2475 ; experimental conditional move with two constants +/- 1 BRC
2476 (define_insn "movtK_8"
2477 [(set (match_operand:SI 0 "mcore_arith_reg_operand" "=r")
2479 (ne (ne:SI (reg:CC 17) (const_int 0)) (const_int 0))
2480 (match_operand:SI 1 "mcore_arith_O_operand" "O")
2481 (match_operand:SI 2 "mcore_arith_O_operand" "O")))]
2482 "GET_CODE (operands[1]) == CONST_INT &&
2483 GET_CODE (operands[2]) == CONST_INT &&
2484 ((INTVAL (operands[1]) - INTVAL (operands[2]) == 1) ||
2485 (INTVAL (operands[2]) - INTVAL (operands[1]) == 1))"
2486 "* return mcore_output_cmov (operands, 1, NULL);"
2487 [(set_attr "length" "4")])
2489 (define_insn "movt4"
2490 [(set (match_operand:SI 0 "mcore_arith_reg_operand" "=r,r,r,r")
2492 (ne (ne:SI (reg:CC 17) (const_int 0)) (const_int 0))
2493 (match_operand:SI 1 "mcore_arith_imm_operand" "r,0,U,0")
2494 (match_operand:SI 2 "mcore_arith_imm_operand" "0,r,0,U")))]
2502 ;; Also need patterns to recognize lt/ge, since otherwise the compiler will
2503 ;; try to output not/asri/tstne/movf.
2505 ;; ------------------------------------------------------------------------
2507 ;; ------------------------------------------------------------------------
2509 ; experimental conditional move with two constants +/- 1 BRC
2510 (define_insn "movtK_9"
2511 [(set (match_operand:SI 0 "mcore_arith_reg_operand" "=r")
2513 (lt (match_operand:SI 1 "mcore_arith_reg_operand" "r")
2515 (match_operand:SI 2 "mcore_arith_O_operand" "O")
2516 (match_operand:SI 3 "mcore_arith_O_operand" "O")))]
2517 "GET_CODE (operands[2]) == CONST_INT &&
2518 GET_CODE (operands[3]) == CONST_INT &&
2519 ((INTVAL (operands[2]) - INTVAL (operands[3]) == 1) ||
2520 (INTVAL (operands[3]) - INTVAL (operands[2]) == 1))"
2523 rtx out_operands[4];
2524 out_operands[0] = operands[0];
2525 out_operands[1] = operands[2];
2526 out_operands[2] = operands[3];
2527 out_operands[3] = operands[1];
2529 return mcore_output_cmov (out_operands, 1, \"btsti %3,31\");
2531 [(set_attr "length" "6")])
2533 (define_insn "movt5"
2534 [(set (match_operand:SI 0 "mcore_arith_reg_operand" "=r,r,r,r")
2535 (if_then_else:SI (lt (match_operand:SI 1 "mcore_arith_reg_operand" "r,r,r,r")
2537 (match_operand:SI 2 "mcore_arith_imm_operand" "r,0,U,0")
2538 (match_operand:SI 3 "mcore_arith_imm_operand" "0,r,0,U")))]
2541 btsti %1,31\;movt %0,%2
2542 btsti %1,31\;movf %0,%3
2543 btsti %1,31\;clrt %0
2544 btsti %1,31\;clrf %0"
2545 [(set_attr "length" "4")])
2548 ;; ------------------------------------------------------------------------
2550 ;; ------------------------------------------------------------------------
2552 ; experimental conditional move with two constants +/- 1 BRC
2553 (define_insn "movtK_10"
2554 [(set (match_operand:SI 0 "mcore_arith_reg_operand" "=r")
2556 (ge (match_operand:SI 1 "mcore_arith_reg_operand" "r")
2558 (match_operand:SI 2 "mcore_arith_O_operand" "O")
2559 (match_operand:SI 3 "mcore_arith_O_operand" "O")))]
2560 "GET_CODE (operands[2]) == CONST_INT &&
2561 GET_CODE (operands[3]) == CONST_INT &&
2562 ((INTVAL (operands[2]) - INTVAL (operands[3]) == 1) ||
2563 (INTVAL (operands[3]) - INTVAL (operands[2]) == 1))"
2566 rtx out_operands[4];
2567 out_operands[0] = operands[0];
2568 out_operands[1] = operands[2];
2569 out_operands[2] = operands[3];
2570 out_operands[3] = operands[1];
2572 return mcore_output_cmov (out_operands, 0, \"btsti %3,31\");
2574 [(set_attr "length" "6")])
2576 (define_insn "movf5"
2577 [(set (match_operand:SI 0 "mcore_arith_reg_operand" "=r,r,r,r")
2578 (if_then_else:SI (ge (match_operand:SI 1 "mcore_arith_reg_operand" "r,r,r,r")
2580 (match_operand:SI 2 "mcore_arith_imm_operand" "r,0,U,0")
2581 (match_operand:SI 3 "mcore_arith_imm_operand" "0,r,0,U")))]
2584 btsti %1,31\;movf %0,%2
2585 btsti %1,31\;movt %0,%3
2586 btsti %1,31\;clrf %0
2587 btsti %1,31\;clrt %0"
2588 [(set_attr "length" "4")])
2590 ;; ------------------------------------------------------------------------
2591 ;; Bitfield extract (xtrbN)
2592 ;; ------------------------------------------------------------------------
2594 ; sometimes we're better off using QI/HI mode and letting the machine indep.
2595 ; part expand insv and extv.
2597 ; e.g., sequences like:a [an insertion]
2600 ; movi r7,0x00ffffff
2602 ; stw r8,(r6) r8 dead
2607 ; stb r8,(r6) r8 dead
2609 ; it looks like always using SI mode is a win except in this type of code
2610 ; (when adjacent bit fields collapse on a byte or halfword boundary). when
2611 ; expanding with SI mode, non-adjacent bit field masks fold, but with QI/HI
2612 ; mode, they do not. one thought is to add some peepholes to cover cases
2613 ; like the above, but this is not a general solution.
2615 ; -mword-bitfields expands/inserts using SI mode. otherwise, do it with
2616 ; the smallest mode possible (using the machine indep. expansions). BRC
2618 ;(define_expand "extv"
2619 ; [(set (match_operand:SI 0 "mcore_arith_reg_operand" "")
2620 ; (sign_extract:SI (match_operand:SI 1 "mcore_arith_reg_operand" "")
2621 ; (match_operand:SI 2 "const_int_operand" "")
2622 ; (match_operand:SI 3 "const_int_operand" "")))
2623 ; (clobber (reg:CC 17))]
2627 ; if (INTVAL (operands[1]) != 8 || INTVAL (operands[2]) % 8 != 0)
2629 ; if (TARGET_W_FIELD)
2631 ; rtx lshft = GEN_INT (32 - (INTVAL (operands[2]) + INTVAL (operands[3])));
2632 ; rtx rshft = GEN_INT (32 - INTVAL (operands[2]));
2634 ; emit_insn (gen_rtx_SET (SImode, operands[0], operands[1]));
2635 ; emit_insn (gen_rtx_SET (SImode, operands[0],
2636 ; gen_rtx_ASHIFT (SImode, operands[0], lshft)));
2637 ; emit_insn (gen_rtx_SET (SImode, operands[0],
2638 ; gen_rtx_ASHIFTRT (SImode, operands[0], rshft)));
2646 (define_expand "extv"
2647 [(set (match_operand:SI 0 "mcore_arith_reg_operand" "")
2648 (sign_extract:SI (match_operand:SI 1 "mcore_arith_reg_operand" "")
2649 (match_operand:SI 2 "const_int_operand" "")
2650 (match_operand:SI 3 "const_int_operand" "")))
2651 (clobber (reg:CC 17))]
2655 if (INTVAL (operands[2]) == 8 && INTVAL (operands[3]) % 8 == 0)
2657 /* 8 bit field, aligned properly, use the xtrb[0123]+sext sequence. */
2658 /* not DONE, not FAIL, but let the RTL get generated.... */
2660 else if (TARGET_W_FIELD)
2662 /* Arbitrary placement; note that the tree->rtl generator will make
2663 something close to this if we return FAIL */
2664 rtx lshft = GEN_INT (32 - (INTVAL (operands[2]) + INTVAL (operands[3])));
2665 rtx rshft = GEN_INT (32 - INTVAL (operands[2]));
2666 rtx tmp1 = gen_reg_rtx (SImode);
2667 rtx tmp2 = gen_reg_rtx (SImode);
2669 emit_insn (gen_rtx_SET (SImode, tmp1, operands[1]));
2670 emit_insn (gen_rtx_SET (SImode, tmp2,
2671 gen_rtx_ASHIFT (SImode, tmp1, lshft)));
2672 emit_insn (gen_rtx_SET (SImode, operands[0],
2673 gen_rtx_ASHIFTRT (SImode, tmp2, rshft)));
2678 /* Let the caller choose an alternate sequence. */
2683 (define_expand "extzv"
2684 [(set (match_operand:SI 0 "mcore_arith_reg_operand" "")
2685 (zero_extract:SI (match_operand:SI 1 "mcore_arith_reg_operand" "")
2686 (match_operand:SI 2 "const_int_operand" "")
2687 (match_operand:SI 3 "const_int_operand" "")))
2688 (clobber (reg:CC 17))]
2692 if (INTVAL (operands[2]) == 8 && INTVAL (operands[3]) % 8 == 0)
2694 /* 8 bit field, aligned properly, use the xtrb[0123] sequence. */
2695 /* Let the template generate some RTL.... */
2697 else if (CONST_OK_FOR_K ((1 << INTVAL (operands[2])) - 1))
2699 /* A narrow bit-field (<=5 bits) means we can do a shift to put
2700 it in place and then use an andi to extract it.
2701 This is as good as a shiftleft/shiftright. */
2704 rtx mask = GEN_INT ((1 << INTVAL (operands[2])) - 1);
2706 if (INTVAL (operands[3]) == 0)
2708 shifted = operands[1];
2712 rtx rshft = GEN_INT (INTVAL (operands[3]));
2713 shifted = gen_reg_rtx (SImode);
2714 emit_insn (gen_rtx_SET (SImode, shifted,
2715 gen_rtx_LSHIFTRT (SImode, operands[1], rshft)));
2717 emit_insn (gen_rtx_SET (SImode, operands[0],
2718 gen_rtx_AND (SImode, shifted, mask)));
2721 else if (TARGET_W_FIELD)
2723 /* Arbitrary pattern; play shift/shift games to get it.
2724 * this is pretty much what the caller will do if we say FAIL */
2725 rtx lshft = GEN_INT (32 - (INTVAL (operands[2]) + INTVAL (operands[3])));
2726 rtx rshft = GEN_INT (32 - INTVAL (operands[2]));
2727 rtx tmp1 = gen_reg_rtx (SImode);
2728 rtx tmp2 = gen_reg_rtx (SImode);
2730 emit_insn (gen_rtx_SET (SImode, tmp1, operands[1]));
2731 emit_insn (gen_rtx_SET (SImode, tmp2,
2732 gen_rtx_ASHIFT (SImode, tmp1, lshft)));
2733 emit_insn (gen_rtx_SET (SImode, operands[0],
2734 gen_rtx_LSHIFTRT (SImode, tmp2, rshft)));
2739 /* Make the compiler figure out some alternative mechanism. */
2743 /* Emit the RTL pattern; something will match it later. */
2746 (define_expand "insv"
2747 [(set (zero_extract:SI (match_operand:SI 0 "mcore_arith_reg_operand" "")
2748 (match_operand:SI 1 "const_int_operand" "")
2749 (match_operand:SI 2 "const_int_operand" ""))
2750 (match_operand:SI 3 "general_operand" ""))
2751 (clobber (reg:CC 17))]
2755 if (mcore_expand_insv (operands))
2766 ;; the xtrb[0123] instructions handily get at 8-bit fields on nice boundaries.
2767 ;; but then, they do force you through r1.
2769 ;; the combiner will build such patterns for us, so we'll make them available
2772 ;; Note that we have both SIGNED and UNSIGNED versions of these...
2776 ;; These no longer worry about the clobbering of CC bit; not sure this is
2779 ;; the SIGNED versions of these
2782 [(set (match_operand:SI 0 "mcore_arith_reg_operand" "=r,b")
2783 (sign_extract:SI (match_operand:SI 1 "mcore_arith_reg_operand" "0,r") (const_int 8) (const_int 24)))]
2787 xtrb0 %0,%1\;sextb %0"
2788 [(set_attr "type" "shift")])
2791 [(set (match_operand:SI 0 "mcore_arith_reg_operand" "=b")
2792 (sign_extract:SI (match_operand:SI 1 "mcore_arith_reg_operand" "r") (const_int 8) (const_int 16)))]
2794 "xtrb1 %0,%1\;sextb %0"
2795 [(set_attr "type" "shift")])
2798 [(set (match_operand:SI 0 "mcore_arith_reg_operand" "=b")
2799 (sign_extract:SI (match_operand:SI 1 "mcore_arith_reg_operand" "r") (const_int 8) (const_int 8)))]
2801 "xtrb2 %0,%1\;sextb %0"
2802 [(set_attr "type" "shift")])
2805 [(set (match_operand:SI 0 "mcore_arith_reg_operand" "=r")
2806 (sign_extract:SI (match_operand:SI 1 "mcore_arith_reg_operand" "0") (const_int 8) (const_int 0)))]
2809 [(set_attr "type" "shift")])
2811 ;; the UNSIGNED uses of xtrb[0123]
2814 [(set (match_operand:SI 0 "mcore_arith_reg_operand" "=r,b")
2815 (zero_extract:SI (match_operand:SI 1 "mcore_arith_reg_operand" "0,r") (const_int 8) (const_int 24)))]
2820 [(set_attr "type" "shift")])
2823 [(set (match_operand:SI 0 "mcore_arith_reg_operand" "=b")
2824 (zero_extract:SI (match_operand:SI 1 "mcore_arith_reg_operand" "r") (const_int 8) (const_int 16)))]
2827 [(set_attr "type" "shift")])
2830 [(set (match_operand:SI 0 "mcore_arith_reg_operand" "=b")
2831 (zero_extract:SI (match_operand:SI 1 "mcore_arith_reg_operand" "r") (const_int 8) (const_int 8)))]
2834 [(set_attr "type" "shift")])
2836 ;; This can be peepholed if it follows a ldb ...
2838 [(set (match_operand:SI 0 "mcore_arith_reg_operand" "=r,b")
2839 (zero_extract:SI (match_operand:SI 1 "mcore_arith_reg_operand" "0,r") (const_int 8) (const_int 0)))]
2843 xtrb3 %0,%1\;zextb %0"
2844 [(set_attr "type" "shift")])
2847 ;; ------------------------------------------------------------------------
2848 ;; Block move - adapted from m88k.md
2849 ;; ------------------------------------------------------------------------
2851 (define_expand "movmemsi"
2852 [(parallel [(set (mem:BLK (match_operand:BLK 0 "" ""))
2853 (mem:BLK (match_operand:BLK 1 "" "")))
2854 (use (match_operand:SI 2 "general_operand" ""))
2855 (use (match_operand:SI 3 "immediate_operand" ""))])]
2859 if (mcore_expand_block_move (operands))
2865 ;; ;;; ??? These patterns are meant to be generated from expand_block_move,
2866 ;; ;;; but they currently are not.
2869 ;; [(set (match_operand:QI 0 "mcore_arith_reg_operand" "=r")
2870 ;; (match_operand:BLK 1 "mcore_general_movsrc_operand" "m"))]
2873 ;; [(set_attr "type" "load")])
2876 ;; [(set (match_operand:HI 0 "mcore_arith_reg_operand" "=r")
2877 ;; (match_operand:BLK 1 "mcore_general_movsrc_operand" "m"))]
2880 ;; [(set_attr "type" "load")])
2883 ;; [(set (match_operand:SI 0 "mcore_arith_reg_operand" "=r")
2884 ;; (match_operand:BLK 1 "mcore_general_movsrc_operand" "m"))]
2887 ;; [(set_attr "type" "load")])
2890 ;; [(set (match_operand:BLK 0 "mcore_general_movdst_operand" "=m")
2891 ;; (match_operand:QI 1 "mcore_arith_reg_operand" "r"))]
2894 ;; [(set_attr "type" "store")])
2897 ;; [(set (match_operand:BLK 0 "mcore_general_movdst_operand" "=m")
2898 ;; (match_operand:HI 1 "mcore_arith_reg_operand" "r"))]
2901 ;; [(set_attr "type" "store")])
2904 ;; [(set (match_operand:BLK 0 "mcore_general_movdst_operand" "=m")
2905 ;; (match_operand:SI 1 "mcore_arith_reg_operand" "r"))]
2908 ;; [(set_attr "type" "store")])
2910 ;; ------------------------------------------------------------------------
2911 ;; Misc Optimizing quirks
2912 ;; ------------------------------------------------------------------------
2914 ;; pair to catch constructs like: (int *)((p+=4)-4) which happen
2915 ;; in stdarg/varargs traversal. This changes a 3 insn sequence to a 2
2916 ;; insn sequence. -- RBE 11/30/95
2919 (set (match_operand:SI 0 "mcore_arith_reg_operand" "=r")
2920 (match_operand:SI 1 "mcore_arith_reg_operand" "+r"))
2921 (set (match_dup 1) (plus:SI (match_dup 1) (match_operand 2 "mcore_arith_any_imm_operand" "")))])]
2922 "GET_CODE(operands[2]) == CONST_INT"
2924 [(set_attr "length" "4")])
2928 (set (match_operand:SI 0 "mcore_arith_reg_operand" "")
2929 (match_operand:SI 1 "mcore_arith_reg_operand" ""))
2930 (set (match_dup 1) (plus:SI (match_dup 1) (match_operand 2 "mcore_arith_any_imm_operand" "")))])]
2931 "GET_CODE(operands[2]) == CONST_INT &&
2932 operands[0] != operands[1]"
2933 [(set (match_dup 0) (match_dup 1))
2934 (set (match_dup 1) (plus:SI (match_dup 1) (match_dup 2)))])
2939 ; note: in the following patterns, use mcore_is_dead() to ensure that the
2940 ; reg we may be trashing really is dead. reload doesn't always mark
2941 ; deaths, so mcore_is_dead() (see mcore.c) scans forward to find its death. BRC
2943 ;;; A peephole to convert the 3 instruction sequence generated by reload
2944 ;;; to load a FP-offset address into a 2 instruction sequence.
2945 ;;; ??? This probably never matches anymore.
2947 [(set (match_operand:SI 0 "mcore_arith_reg_operand" "r")
2948 (match_operand:SI 1 "const_int_operand" "J"))
2949 (set (match_dup 0) (neg:SI (match_dup 0)))
2951 (plus:SI (match_dup 0)
2952 (match_operand:SI 2 "mcore_arith_reg_operand" "r")))]
2953 "CONST_OK_FOR_J (INTVAL (operands[1]))"
2954 "error\;mov %0,%2\;subi %0,%1")
2956 ;; Moves of inlinable constants are done late, so when a 'not' is generated
2957 ;; it is never combined with the following 'and' to generate an 'andn' b/c
2958 ;; the combiner never sees it. use a peephole to pick up this case (happens
2959 ;; mostly with bitfields) BRC
2962 [(set (match_operand:SI 0 "mcore_arith_reg_operand" "r")
2963 (match_operand:SI 1 "const_int_operand" "i"))
2964 (set (match_operand:SI 2 "mcore_arith_reg_operand" "r")
2965 (and:SI (match_dup 2) (match_dup 0)))]
2966 "mcore_const_trick_uses_not (INTVAL (operands[1])) &&
2967 operands[0] != operands[2] &&
2968 mcore_is_dead (insn, operands[0])"
2969 "* return mcore_output_andn (insn, operands);")
2971 ; when setting or clearing just two bits, it's cheapest to use two bseti's
2972 ; or bclri's. only happens when relaxing immediates. BRC
2975 [(set (match_operand:SI 0 "mcore_arith_reg_operand" "")
2976 (match_operand:SI 1 "const_int_operand" ""))
2977 (set (match_operand:SI 2 "mcore_arith_reg_operand" "")
2978 (ior:SI (match_dup 2) (match_dup 0)))]
2979 "TARGET_HARDLIT && mcore_num_ones (INTVAL (operands[1])) == 2 &&
2980 mcore_is_dead (insn, operands[0])"
2981 "* return mcore_output_bseti (operands[2], INTVAL (operands[1]));")
2984 [(set (match_operand:SI 0 "mcore_arith_reg_operand" "")
2985 (match_operand:SI 1 "const_int_operand" ""))
2986 (set (match_operand:SI 2 "mcore_arith_reg_operand" "")
2987 (and:SI (match_dup 2) (match_dup 0)))]
2988 "TARGET_HARDLIT && mcore_num_zeros (INTVAL (operands[1])) == 2 &&
2989 mcore_is_dead (insn, operands[0])"
2990 "* return mcore_output_bclri (operands[2], INTVAL (operands[1]));")
2992 ; change an and with a mask that has a single cleared bit into a bclri. this
2993 ; handles QI and HI mode values using the knowledge that the most significant
2994 ; bits don't matter.
2997 [(set (match_operand:SI 0 "mcore_arith_reg_operand" "")
2998 (match_operand:SI 1 "const_int_operand" ""))
2999 (set (match_operand:SI 2 "mcore_arith_reg_operand" "")
3000 (and:SI (match_operand:SI 3 "mcore_arith_reg_operand" "")
3002 "GET_CODE (operands[3]) == SUBREG &&
3003 GET_MODE (SUBREG_REG (operands[3])) == QImode &&
3004 mcore_num_zeros (INTVAL (operands[1]) | 0xffffff00) == 1 &&
3005 mcore_is_dead (insn, operands[0])"
3007 if (! mcore_is_same_reg (operands[2], operands[3]))
3008 output_asm_insn (\"mov\\t%2,%3\", operands);
3009 return mcore_output_bclri (operands[2], INTVAL (operands[1]) | 0xffffff00);")
3011 /* Do not fold these together -- mode is lost at final output phase. */
3014 [(set (match_operand:SI 0 "mcore_arith_reg_operand" "")
3015 (match_operand:SI 1 "const_int_operand" ""))
3016 (set (match_operand:SI 2 "mcore_arith_reg_operand" "")
3017 (and:SI (match_operand:SI 3 "mcore_arith_reg_operand" "")
3019 "GET_CODE (operands[3]) == SUBREG &&
3020 GET_MODE (SUBREG_REG (operands[3])) == HImode &&
3021 mcore_num_zeros (INTVAL (operands[1]) | 0xffff0000) == 1 &&
3022 operands[2] == operands[3] &&
3023 mcore_is_dead (insn, operands[0])"
3025 if (! mcore_is_same_reg (operands[2], operands[3]))
3026 output_asm_insn (\"mov\\t%2,%3\", operands);
3027 return mcore_output_bclri (operands[2], INTVAL (operands[1]) | 0xffff0000);")
3029 ; This peephole helps when using -mwide-bitfields to widen fields so they
3030 ; collapse. This, however, has the effect that a narrower mode is not used
3033 ; e.g., sequences like:
3036 ; movi r7,0x00ffffff
3038 ; stw r8,(r6) r8 dead
3040 ; get peepholed to become:
3043 ; stb r8,(r6) r8 dead
3045 ; Do only easy addresses that have no offset. This peephole is also applied
3046 ; to halfwords. We need to check that the load is non-volatile before we get
3050 [(set (match_operand:SI 0 "mcore_arith_reg_operand" "")
3051 (match_operand:SI 1 "memory_operand" ""))
3052 (set (match_operand:SI 2 "mcore_arith_reg_operand" "")
3053 (match_operand:SI 3 "const_int_operand" ""))
3054 (set (match_dup 0) (and:SI (match_dup 0) (match_dup 2)))
3055 (set (match_operand:SI 4 "memory_operand" "") (match_dup 0))]
3056 "mcore_is_dead (insn, operands[0]) &&
3057 ! MEM_VOLATILE_P (operands[1]) &&
3058 mcore_is_dead (insn, operands[2]) &&
3059 (mcore_byte_offset (INTVAL (operands[3])) > -1 ||
3060 mcore_halfword_offset (INTVAL (operands[3])) > -1) &&
3061 ! MEM_VOLATILE_P (operands[4]) &&
3062 GET_CODE (XEXP (operands[4], 0)) == REG"
3066 enum machine_mode mode;
3067 rtx base_reg = XEXP (operands[4], 0);
3069 if ((ofs = mcore_byte_offset (INTVAL (operands[3]))) > -1)
3071 else if ((ofs = mcore_halfword_offset (INTVAL (operands[3]))) > -1)
3077 operands[4] = gen_rtx_MEM (mode,
3078 gen_rtx_PLUS (SImode, base_reg, GEN_INT(ofs)));
3080 operands[4] = gen_rtx_MEM (mode, base_reg);
3083 return \"movi %0,0\\n\\tst.b %0,%4\";
3085 return \"movi %0,0\\n\\tst.h %0,%4\";
3088 ; from sop11. get btsti's for (LT A 0) where A is a QI or HI value
3091 [(set (match_operand:SI 0 "mcore_arith_reg_operand" "r")
3092 (sign_extend:SI (match_operand:QI 1 "mcore_arith_reg_operand" "0")))
3094 (lt:CC (match_dup 0)
3096 "mcore_is_dead (insn, operands[0])"
3100 [(set (match_operand:SI 0 "mcore_arith_reg_operand" "r")
3101 (sign_extend:SI (match_operand:HI 1 "mcore_arith_reg_operand" "0")))
3103 (lt:CC (match_dup 0)
3105 "mcore_is_dead (insn, operands[0])"
3108 ; Pick up a tst. This combination happens because the immediate is not
3109 ; allowed to fold into one of the operands of the tst. Does not happen
3110 ; when relaxing immediates. BRC
3113 [(set (match_operand:SI 0 "mcore_arith_reg_operand" "")
3114 (match_operand:SI 1 "mcore_arith_reg_operand" ""))
3116 (and:SI (match_dup 0)
3117 (match_operand:SI 2 "mcore_literal_K_operand" "")))
3118 (set (reg:CC 17) (ne:CC (match_dup 0) (const_int 0)))]
3119 "mcore_is_dead (insn, operands[0])"
3120 "movi %0,%2\;tst %1,%0")
3123 [(set (match_operand:SI 0 "mcore_arith_reg_operand" "")
3124 (if_then_else:SI (ne (zero_extract:SI
3125 (match_operand:SI 1 "mcore_arith_reg_operand" "")
3127 (match_operand:SI 2 "mcore_literal_K_operand" ""))
3129 (match_operand:SI 3 "mcore_arith_imm_operand" "")
3130 (match_operand:SI 4 "mcore_arith_imm_operand" "")))
3131 (set (reg:CC 17) (ne:CC (match_dup 0) (const_int 0)))]
3135 unsigned int op0 = REGNO (operands[0]);
3137 if (GET_CODE (operands[3]) == REG)
3139 if (REGNO (operands[3]) == op0 && GET_CODE (operands[4]) == CONST_INT
3140 && INTVAL (operands[4]) == 0)
3141 return \"btsti %1,%2\\n\\tclrf %0\";
3142 else if (GET_CODE (operands[4]) == REG)
3144 if (REGNO (operands[4]) == op0)
3145 return \"btsti %1,%2\\n\\tmovf %0,%3\";
3146 else if (REGNO (operands[3]) == op0)
3147 return \"btsti %1,%2\\n\\tmovt %0,%4\";
3152 else if (GET_CODE (operands[3]) == CONST_INT
3153 && INTVAL (operands[3]) == 0
3154 && GET_CODE (operands[4]) == REG)
3155 return \"btsti %1,%2\\n\\tclrt %0\";
3160 ; experimental - do the constant folding ourselves. note that this isn't
3161 ; re-applied like we'd really want. i.e., four ands collapse into two
3162 ; instead of one. this is because peepholes are applied as a sliding
3163 ; window. the peephole does not generate new rtl's, but instead slides
3164 ; across the rtl's generating machine instructions. it would be nice
3165 ; if the peephole optimizer is changed to re-apply patterns and to gen
3166 ; new rtl's. this is more flexible. the pattern below helps when we're
3167 ; not using relaxed immediates. BRC
3170 ; [(set (match_operand:SI 0 "mcore_arith_reg_operand" "")
3171 ; (match_operand:SI 1 "const_int_operand" ""))
3172 ; (set (match_operand:SI 2 "mcore_arith_reg_operand" "")
3173 ; (and:SI (match_dup 2) (match_dup 0)))
3174 ; (set (match_dup 0)
3175 ; (match_operand:SI 3 "const_int_operand" ""))
3176 ; (set (match_dup 2)
3177 ; (and:SI (match_dup 2) (match_dup 0)))]
3178 ; "!TARGET_RELAX_IMM && mcore_is_dead (insn, operands[0]) &&
3179 ; mcore_const_ok_for_inline (INTVAL (operands[1]) & INTVAL (operands[3]))"
3182 ; rtx out_operands[2];
3183 ; out_operands[0] = operands[0];
3184 ; out_operands[1] = GEN_INT (INTVAL (operands[1]) & INTVAL (operands[3]));
3186 ; output_inline_const (SImode, out_operands);
3188 ; output_asm_insn (\"and %2,%0\", operands);
3193 ; BRC: for inlining get rid of extra test - experimental
3195 ; [(set (match_operand:SI 0 "mcore_arith_reg_operand" "r")
3196 ; (ne:SI (reg:CC 17) (const_int 0)))
3197 ; (set (reg:CC 17) (ne:CC (match_dup 0) (const_int 0)))
3199 ; (if_then_else (eq (reg:CC 17) (const_int 0))
3200 ; (label_ref (match_operand 1 "" ""))
3205 ; if (get_attr_length (insn) == 10)
3207 ; output_asm_insn (\"bt 2f\\n\\tjmpi [1f]\", operands);
3208 ; output_asm_insn (\".align 2\\n1:\", operands);
3209 ; output_asm_insn (\".long %1\\n2:\", operands);
3212 ; return \"bf %l1\";
3216 ;;; Special patterns for dealing with the constant pool.
3218 ;;; 4 byte integer in line.
3220 (define_insn "consttable_4"
3221 [(unspec_volatile [(match_operand:SI 0 "general_operand" "=g")] 0)]
3225 assemble_integer (operands[0], 4, BITS_PER_WORD, 1);
3228 [(set_attr "length" "4")])
3230 ;;; align to a four byte boundary.
3232 (define_insn "align_4"
3233 [(unspec_volatile [(const_int 0)] 1)]
3237 ;;; Handle extra constant pool entries created during final pass.
3239 (define_insn "consttable_end"
3240 [(unspec_volatile [(const_int 0)] 2)]
3242 "* return mcore_output_jump_label_table ();")
3245 ;; Stack allocation -- in particular, for alloca().
3246 ;; this is *not* what we use for entry into functions.
3248 ;; This is how we allocate stack space. If we are allocating a
3249 ;; constant amount of space and we know it is less than 4096
3250 ;; bytes, we need do nothing.
3252 ;; If it is more than 4096 bytes, we need to probe the stack
3255 ;; operands[1], the distance is a POSITIVE number indicating that we
3256 ;; are allocating stack space
3258 (define_expand "allocate_stack"
3261 (match_operand:SI 1 "general_operand" "")))
3262 (set (match_operand:SI 0 "register_operand" "=r")
3267 /* If he wants no probing, just do it for him. */
3268 if (mcore_stack_increment == 0)
3270 emit_insn (gen_addsi3 (stack_pointer_rtx, stack_pointer_rtx,operands[1]));
3271 ;; emit_move_insn (operands[0], virtual_stack_dynamic_rtx);
3275 /* For small constant growth, we unroll the code. */
3276 if (GET_CODE (operands[1]) == CONST_INT
3277 && INTVAL (operands[1]) < 8 * STACK_UNITS_MAXSTEP)
3279 int left = INTVAL(operands[1]);
3281 /* If it's a long way, get close enough for a last shot. */
3282 if (left >= STACK_UNITS_MAXSTEP)
3284 rtx tmp = gen_reg_rtx (Pmode);
3285 emit_insn (gen_movsi (tmp, GEN_INT (STACK_UNITS_MAXSTEP)));
3288 rtx memref = gen_rtx_MEM (SImode, stack_pointer_rtx);
3290 MEM_VOLATILE_P (memref) = 1;
3291 emit_insn (gen_subsi3 (stack_pointer_rtx, stack_pointer_rtx, tmp));
3292 emit_insn (gen_movsi (memref, stack_pointer_rtx));
3293 left -= STACK_UNITS_MAXSTEP;
3295 while (left > STACK_UNITS_MAXSTEP);
3297 /* Perform the final adjustment. */
3298 emit_insn (gen_addsi3 (stack_pointer_rtx,stack_pointer_rtx,GEN_INT(-left)));
3299 ;; emit_move_insn (operands[0], virtual_stack_dynamic_rtx);
3305 rtx loop_label = gen_label_rtx ();
3306 rtx step = gen_reg_rtx (Pmode);
3307 rtx tmp = gen_reg_rtx (Pmode);
3311 emit_insn (gen_movsi (tmp, operands[1]));
3312 emit_insn (gen_movsi (step, GEN_INT(STACK_UNITS_MAXSTEP)));
3314 if (GET_CODE (operands[1]) != CONST_INT)
3316 out_label = gen_label_rtx ();
3317 emit_insn (gen_cmpsi (step, tmp)); /* quick out */
3318 emit_jump_insn (gen_bgeu (out_label));
3321 /* Run a loop that steps it incrementally. */
3322 emit_label (loop_label);
3324 /* Extend a step, probe, and adjust remaining count. */
3325 emit_insn(gen_subsi3(stack_pointer_rtx, stack_pointer_rtx, step));
3326 memref = gen_rtx_MEM (SImode, stack_pointer_rtx);
3327 MEM_VOLATILE_P (memref) = 1;
3328 emit_insn(gen_movsi(memref, stack_pointer_rtx));
3329 emit_insn(gen_subsi3(tmp, tmp, step));
3331 /* Loop condition -- going back up. */
3332 emit_insn (gen_cmpsi (step, tmp));
3333 emit_jump_insn (gen_bltu (loop_label));
3336 emit_label (out_label);
3338 /* Bump the residual. */
3339 emit_insn (gen_subsi3 (stack_pointer_rtx, stack_pointer_rtx, tmp));
3340 ;; emit_move_insn (operands[0], virtual_stack_dynamic_rtx);
3343 /* simple one-shot -- ensure register and do a subtract.
3344 * This does NOT comply with the ABI. */
3345 emit_insn (gen_movsi (tmp, operands[1]));
3346 emit_insn (gen_subsi3 (stack_pointer_rtx, stack_pointer_rtx, tmp));
3347 ;; emit_move_insn (operands[0], virtual_stack_dynamic_rtx);