1 ;; Machine description the Motorola MCore
2 ;; Copyright (C) 1993, 1999, 2000, 2004, 2005, 2007
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 3, 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 COPYING3. If not see
20 ;; <http://www.gnu.org/licenses/>.
22 ;;- See file "rtl.def" for documentation on define_insn, match_*, et. al.
26 ;; -------------------------------------------------------------------------
28 ;; -------------------------------------------------------------------------
32 (define_attr "type" "brcond,branch,jmp,load,store,move,alu,shift"
35 ;; If a branch destination is within -2048..2047 bytes away from the
36 ;; instruction it can be 2 bytes long. All other conditional branches
37 ;; are 10 bytes long, and all other unconditional branches are 8 bytes.
39 ;; the assembler handles the long-branch span case for us if we use
40 ;; the "jb*" mnemonics for jumps/branches. This pushes the span
41 ;; calculations and the literal table placement into the assembler,
42 ;; where their interactions can be managed in a single place.
44 ;; All MCORE instructions are two bytes long.
46 (define_attr "length" "" (const_int 2))
48 ;; Scheduling. We only model a simple load latency.
49 (define_insn_reservation "any_insn" 1
50 (eq_attr "type" "!load")
52 (define_insn_reservation "memory" 2
53 (eq_attr "type" "load")
56 (include "predicates.md")
58 ;; -------------------------------------------------------------------------
60 ;; -------------------------------------------------------------------------
64 (sign_extract:SI (match_operand:SI 0 "mcore_arith_reg_operand" "r")
66 (match_operand:SI 1 "mcore_literal_K_operand" "K")))]
69 [(set_attr "type" "shift")])
73 (zero_extract:SI (match_operand:SI 0 "mcore_arith_reg_operand" "r")
75 (match_operand:SI 1 "mcore_literal_K_operand" "K")))]
78 [(set_attr "type" "shift")])
80 ;;; This is created by combine.
83 (ne:CC (zero_extract:SI (match_operand:SI 0 "mcore_arith_reg_operand" "r")
85 (match_operand:SI 1 "mcore_literal_K_operand" "K"))
89 [(set_attr "type" "shift")])
92 ;; Created by combine from conditional patterns below (see sextb/btsti rx,31)
96 (ne:CC (lshiftrt:SI (match_operand:SI 0 "mcore_arith_reg_operand" "r")
99 "GET_CODE(operands[0]) == SUBREG &&
100 GET_MODE(SUBREG_REG(operands[0])) == QImode"
102 [(set_attr "type" "shift")])
106 (ne:CC (lshiftrt:SI (match_operand:SI 0 "mcore_arith_reg_operand" "r")
109 "GET_CODE(operands[0]) == SUBREG &&
110 GET_MODE(SUBREG_REG(operands[0])) == HImode"
112 [(set_attr "type" "shift")])
116 (if_then_else (ne (eq:CC (zero_extract:SI
117 (match_operand:SI 0 "mcore_arith_reg_operand" "")
119 (match_operand:SI 1 "mcore_literal_K_operand" ""))
122 (label_ref (match_operand 2 "" ""))
126 (zero_extract:SI (match_dup 0) (const_int 1) (match_dup 1)))
127 (set (pc) (if_then_else (eq (reg:CC 17) (const_int 0))
128 (label_ref (match_dup 2))
134 (if_then_else (eq (ne:CC (zero_extract:SI
135 (match_operand:SI 0 "mcore_arith_reg_operand" "")
137 (match_operand:SI 1 "mcore_literal_K_operand" ""))
140 (label_ref (match_operand 2 "" ""))
144 (zero_extract:SI (match_dup 0) (const_int 1) (match_dup 1)))
145 (set (pc) (if_then_else (eq (reg:CC 17) (const_int 0))
146 (label_ref (match_dup 2))
150 ;; XXX - disabled by nickc because it fails on libiberty/fnmatch.c
152 ;; ; Experimental - relax immediates for and, andn, or, and tst to allow
153 ;; ; any immediate value (or an immediate at all -- or, andn, & tst).
154 ;; ; This is done to allow bit field masks to fold together in combine.
155 ;; ; The reload phase will force the immediate into a register at the
156 ;; ; very end. This helps in some cases, but hurts in others: we'd
157 ;; ; really like to cse these immediates. However, there is a phase
158 ;; ; ordering problem here. cse picks up individual masks and cse's
159 ;; ; those, but not folded masks (cse happens before combine). It's
160 ;; ; not clear what the best solution is because we really want cse
161 ;; ; before combine (leaving the bit field masks alone). To pick up
162 ;; ; relaxed immediates use -mrelax-immediates. It might take some
163 ;; ; experimenting to see which does better (i.e. regular imms vs.
164 ;; ; arbitrary imms) for a particular code. BRC
168 ;; (ne:CC (and:SI (match_operand:SI 0 "mcore_arith_reg_operand" "r")
169 ;; (match_operand:SI 1 "mcore_arith_any_imm_operand" "rI"))
171 ;; "TARGET_RELAX_IMM"
176 ;; (ne:CC (and:SI (match_operand:SI 0 "mcore_arith_reg_operand" "r")
177 ;; (match_operand:SI 1 "mcore_arith_M_operand" "r"))
179 ;; "!TARGET_RELAX_IMM"
184 (ne:CC (and:SI (match_operand:SI 0 "mcore_arith_reg_operand" "r")
185 (match_operand:SI 1 "mcore_arith_M_operand" "r"))
194 (ne:CC (ne:SI (leu:CC (match_operand:SI 0 "mcore_arith_reg_operand" "")
195 (match_operand:SI 1 "mcore_arith_reg_operand" ""))
198 (clobber (match_operand:CC 2 "mcore_arith_reg_operand" ""))])]
200 [(set (reg:CC 17) (ne:SI (match_dup 0) (const_int 0)))
201 (set (reg:CC 17) (leu:CC (match_dup 0) (match_dup 1)))])
203 ;; -------------------------------------------------------------------------
204 ;; SImode signed integer comparisons
205 ;; -------------------------------------------------------------------------
207 (define_insn "decne_t"
208 [(set (reg:CC 17) (ne:CC (plus:SI (match_operand:SI 0 "mcore_arith_reg_operand" "+r")
212 (plus:SI (match_dup 0)
217 ;; The combiner seems to prefer the following to the former.
220 [(set (reg:CC 17) (ne:CC (match_operand:SI 0 "mcore_arith_reg_operand" "+r")
223 (plus:SI (match_dup 0)
228 (define_insn "cmpnesi_t"
229 [(set (reg:CC 17) (ne:CC (match_operand:SI 0 "mcore_arith_reg_operand" "r")
230 (match_operand:SI 1 "mcore_arith_reg_operand" "r")))]
234 (define_insn "cmpneisi_t"
235 [(set (reg:CC 17) (ne:CC (match_operand:SI 0 "mcore_arith_reg_operand" "r")
236 (match_operand:SI 1 "mcore_arith_K_operand" "K")))]
240 (define_insn "cmpgtsi_t"
241 [(set (reg:CC 17) (gt:CC (match_operand:SI 0 "mcore_arith_reg_operand" "r")
242 (match_operand:SI 1 "mcore_arith_reg_operand" "r")))]
247 [(set (reg:CC 17) (gt:CC (plus:SI
248 (match_operand:SI 0 "mcore_arith_reg_operand" "+r")
251 (set (match_dup 0) (plus:SI (match_dup 0) (const_int -1)))]
255 (define_insn "cmpltsi_t"
256 [(set (reg:CC 17) (lt:CC (match_operand:SI 0 "mcore_arith_reg_operand" "r")
257 (match_operand:SI 1 "mcore_arith_reg_operand" "r")))]
262 (define_insn "cmpltisi_t"
263 [(set (reg:CC 17) (lt:CC (match_operand:SI 0 "mcore_arith_reg_operand" "r")
264 (match_operand:SI 1 "mcore_arith_J_operand" "J")))]
270 [(set (reg:CC 17) (lt:CC (match_operand:SI 0 "mcore_arith_reg_operand" "r")
276 [(set (reg:CC 17) (lt:CC (plus:SI
277 (match_operand:SI 0 "mcore_arith_reg_operand" "+r")
280 (set (match_dup 0) (plus:SI (match_dup 0) (const_int -1)))]
284 ;; -------------------------------------------------------------------------
285 ;; SImode unsigned integer comparisons
286 ;; -------------------------------------------------------------------------
288 (define_insn "cmpgeusi_t"
289 [(set (reg:CC 17) (geu:CC (match_operand:SI 0 "mcore_arith_reg_operand" "r")
290 (match_operand:SI 1 "mcore_arith_reg_operand" "r")))]
294 (define_insn "cmpgeusi_0"
295 [(set (reg:CC 17) (geu:CC (match_operand:SI 0 "mcore_arith_reg_operand" "r")
300 (define_insn "cmpleusi_t"
301 [(set (reg:CC 17) (leu:CC (match_operand:SI 0 "mcore_arith_reg_operand" "r")
302 (match_operand:SI 1 "mcore_arith_reg_operand" "r")))]
306 ;; We save the compare operands in the cmpxx patterns and use them when
307 ;; we generate the branch.
309 ;; We accept constants here, in case we can modify them to ones which
310 ;; are more efficient to load. E.g. change 'x <= 62' to 'x < 63'.
312 (define_expand "cmpsi"
313 [(set (reg:CC 17) (compare:CC (match_operand:SI 0 "mcore_compare_operand" "")
314 (match_operand:SI 1 "nonmemory_operand" "")))]
317 { arch_compare_op0 = operands[0];
318 arch_compare_op1 = operands[1];
322 ;; -------------------------------------------------------------------------
323 ;; Logical operations
324 ;; -------------------------------------------------------------------------
326 ;; Logical AND clearing a single bit. andsi3 knows that we have this
327 ;; pattern and allows the constant literal pass through.
330 ;; RBE 2/97: don't need this pattern any longer...
331 ;; RBE: I don't think we need both "S" and exact_log2() clauses.
333 ;; [(set (match_operand:SI 0 "mcore_arith_reg_operand" "=r")
334 ;; (and:SI (match_operand:SI 1 "mcore_arith_reg_operand" "%0")
335 ;; (match_operand:SI 2 "const_int_operand" "S")))]
336 ;; "mcore_arith_S_operand (operands[2])"
340 (define_insn "andnsi3"
341 [(set (match_operand:SI 0 "mcore_arith_reg_operand" "=r")
342 (and:SI (not:SI (match_operand:SI 1 "mcore_arith_reg_operand" "r"))
343 (match_operand:SI 2 "mcore_arith_reg_operand" "0")))]
347 (define_expand "andsi3"
348 [(set (match_operand:SI 0 "mcore_arith_reg_operand" "")
349 (and:SI (match_operand:SI 1 "mcore_arith_reg_operand" "")
350 (match_operand:SI 2 "nonmemory_operand" "")))]
354 if (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) < 0
355 && ! mcore_arith_S_operand (operands[2]))
357 HOST_WIDE_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
734 && INTVAL (operands[2]) < -32)
736 HOST_WIDE_INT neg_value = - INTVAL (operands[2]);
738 if ( CONST_OK_FOR_I (neg_value)
739 || CONST_OK_FOR_M (neg_value)
740 || CONST_OK_FOR_N (neg_value))
742 operands[2] = copy_to_mode_reg (SImode, GEN_INT (neg_value));
743 emit_insn (gen_subsi3 (operands[0], operands[1], operands[2]));
748 if (! mcore_addsub_operand (operands[2], SImode))
749 operands[2] = copy_to_mode_reg (SImode, operands[2]);
752 ;; RBE: for some constants which are not in the range which allows
753 ;; us to do a single operation, we will try a paired addi/addi instead
754 ;; of a movi/addi. This relieves some register pressure at the expense
755 ;; of giving away some potential constant reuse.
757 ;; RBE 6/17/97: this didn't buy us anything, but I keep the pattern
758 ;; for later reference
760 ;; (define_insn "addsi3_i2"
761 ;; [(set (match_operand:SI 0 "mcore_arith_reg_operand" "=r")
762 ;; (plus:SI (match_operand:SI 1 "mcore_arith_reg_operand" "%0")
763 ;; (match_operand:SI 2 "const_int_operand" "g")))]
764 ;; "GET_CODE(operands[2]) == CONST_INT
765 ;; && ((INTVAL (operands[2]) > 32 && INTVAL(operands[2]) <= 64)
766 ;; || (INTVAL (operands[2]) < -32 && INTVAL(operands[2]) >= -64))"
769 ;; HOST_WIDE_INT n = INTVAL(operands[2]);
772 ;; operands[2] = GEN_INT(n - 32);
773 ;; return \"addi\\t%0,32\;addi\\t%0,%2\";
778 ;; operands[2] = GEN_INT(n - 32);
779 ;; return \"subi\\t%0,32\;subi\\t%0,%2\";
782 ;; [(set_attr "length" "4")])
784 (define_insn "addsi3_i"
785 [(set (match_operand:SI 0 "mcore_arith_reg_operand" "=r,r,r")
786 (plus:SI (match_operand:SI 1 "mcore_arith_reg_operand" "%0,0,0")
787 (match_operand:SI 2 "mcore_addsub_operand" "r,J,L")))]
794 ;; This exists so that address computations based on the frame pointer
795 ;; can be folded in when frame pointer elimination occurs. Ordinarily
796 ;; this would be bad because it allows insns which would require reloading,
797 ;; but without it, we get multiple adds where one would do.
799 (define_insn "addsi3_fp"
800 [(set (match_operand:SI 0 "mcore_arith_reg_operand" "=r,r,r")
801 (plus:SI (match_operand:SI 1 "mcore_arith_reg_operand" "%0,0,0")
802 (match_operand:SI 2 "immediate_operand" "r,J,L")))]
803 "flag_omit_frame_pointer
804 && (reload_in_progress || reload_completed || REGNO (operands[1]) == FRAME_POINTER_REGNUM)"
810 ;; RBE: for some constants which are not in the range which allows
811 ;; us to do a single operation, we will try a paired addi/addi instead
812 ;; of a movi/addi. This relieves some register pressure at the expense
813 ;; of giving away some potential constant reuse.
815 ;; RBE 6/17/97: this didn't buy us anything, but I keep the pattern
816 ;; for later reference
818 ;; (define_insn "subsi3_i2"
819 ;; [(set (match_operand:SI 0 "mcore_arith_reg_operand" "=r")
820 ;; (plus:SI (match_operand:SI 1 "mcore_arith_reg_operand" "%0")
821 ;; (match_operand:SI 2 "const_int_operand" "g")))]
822 ;; "TARGET_RBETEST && GET_CODE(operands[2]) == CONST_INT
823 ;; && ((INTVAL (operands[2]) > 32 && INTVAL(operands[2]) <= 64)
824 ;; || (INTVAL (operands[2]) < -32 && INTVAL(operands[2]) >= -64))"
827 ;; HOST_WIDE_INT n = INTVAL(operands[2]);
830 ;; operands[2] = GEN_INT( n - 32);
831 ;; return \"subi\\t%0,32\;subi\\t%0,%2\";
836 ;; operands[2] = GEN_INT(n - 32);
837 ;; return \"addi\\t%0,32\;addi\\t%0,%2\";
840 ;; [(set_attr "length" "4")])
842 ;(define_insn "subsi3"
843 ; [(set (match_operand:SI 0 "mcore_arith_reg_operand" "=r,r,r,r")
844 ; (minus:SI (match_operand:SI 1 "mcore_arith_K_operand" "0,0,r,K")
845 ; (match_operand:SI 2 "mcore_arith_J_operand" "r,J,0,0")))]
853 (define_insn "subsi3"
854 [(set (match_operand:SI 0 "mcore_arith_reg_operand" "=r,r,r")
855 (minus:SI (match_operand:SI 1 "mcore_arith_reg_operand" "0,0,r")
856 (match_operand:SI 2 "mcore_arith_J_operand" "r,J,0")))]
864 [(set (match_operand:SI 0 "mcore_arith_reg_operand" "=r")
865 (minus:SI (match_operand:SI 1 "mcore_literal_K_operand" "K")
866 (match_operand:SI 2 "mcore_arith_reg_operand" "0")))]
870 (define_insn "adddi3"
871 [(set (match_operand:DI 0 "mcore_arith_reg_operand" "=&r")
872 (plus:DI (match_operand:DI 1 "mcore_arith_reg_operand" "%0")
873 (match_operand:DI 2 "mcore_arith_reg_operand" "r")))
874 (clobber (reg:CC 17))]
878 if (TARGET_LITTLE_END)
879 return \"cmplt %0,%0\;addc %0,%2\;addc %R0,%R2\";
880 return \"cmplt %R0,%R0\;addc %R0,%R2\;addc %0,%2\";
882 [(set_attr "length" "6")])
884 ;; special case for "longlong += 1"
886 [(set (match_operand:DI 0 "mcore_arith_reg_operand" "=&r")
887 (plus:DI (match_operand:DI 1 "mcore_arith_reg_operand" "0")
889 (clobber (reg:CC 17))]
893 if (TARGET_LITTLE_END)
894 return \"addi %0,1\;cmpnei %0,0\;incf %R0\";
895 return \"addi %R0,1\;cmpnei %R0,0\;incf %0\";
897 [(set_attr "length" "6")])
899 ;; special case for "longlong -= 1"
901 [(set (match_operand:DI 0 "mcore_arith_reg_operand" "=&r")
902 (plus:DI (match_operand:DI 1 "mcore_arith_reg_operand" "0")
904 (clobber (reg:CC 17))]
908 if (TARGET_LITTLE_END)
909 return \"cmpnei %0,0\;decf %R0\;subi %0,1\";
910 return \"cmpnei %R0,0\;decf %0\;subi %R0,1\";
912 [(set_attr "length" "6")])
914 ;; special case for "longlong += const_int"
915 ;; we have to use a register for the const_int because we don't
916 ;; have an unsigned compare immediate... only +/- 1 get to
917 ;; play the no-extra register game because they compare with 0.
918 ;; This winds up working out for any literal that is synthesized
919 ;; with a single instruction. The more complicated ones look
920 ;; like the get broken into subreg's to get initialized too soon
921 ;; for us to catch here. -- RBE 4/25/96
922 ;; only allow for-sure positive values.
925 [(set (match_operand:DI 0 "mcore_arith_reg_operand" "=&r")
926 (plus:DI (match_operand:DI 1 "mcore_arith_reg_operand" "0")
927 (match_operand:SI 2 "const_int_operand" "r")))
928 (clobber (reg:CC 17))]
929 "GET_CODE (operands[2]) == CONST_INT
930 && INTVAL (operands[2]) > 0 && ! (INTVAL (operands[2]) & 0x80000000)"
933 gcc_assert (GET_MODE (operands[2]) == SImode);
934 if (TARGET_LITTLE_END)
935 return \"addu %0,%2\;cmphs %0,%2\;incf %R0\";
936 return \"addu %R0,%2\;cmphs %R0,%2\;incf %0\";
938 [(set_attr "length" "6")])
940 ;; optimize "long long" + "unsigned long"
941 ;; won't trigger because of how the extension is expanded upstream.
943 ;; [(set (match_operand:DI 0 "mcore_arith_reg_operand" "=&r")
944 ;; (plus:DI (match_operand:DI 1 "mcore_arith_reg_operand" "%0")
945 ;; (zero_extend:DI (match_operand:SI 2 "mcore_arith_reg_operand" "r"))))
946 ;; (clobber (reg:CC 17))]
948 ;; "cmplt %R0,%R0\;addc %R0,%2\;inct %0"
949 ;; [(set_attr "length" "6")])
951 ;; optimize "long long" + "signed long"
952 ;; won't trigger because of how the extension is expanded upstream.
954 ;; [(set (match_operand:DI 0 "mcore_arith_reg_operand" "=&r")
955 ;; (plus:DI (match_operand:DI 1 "mcore_arith_reg_operand" "%0")
956 ;; (sign_extend:DI (match_operand:SI 2 "mcore_arith_reg_operand" "r"))))
957 ;; (clobber (reg:CC 17))]
959 ;; "cmplt %R0,%R0\;addc %R0,%2\;inct %0\;btsti %2,31\;dect %0"
960 ;; [(set_attr "length" "6")])
962 (define_insn "subdi3"
963 [(set (match_operand:DI 0 "mcore_arith_reg_operand" "=&r")
964 (minus:DI (match_operand:DI 1 "mcore_arith_reg_operand" "0")
965 (match_operand:DI 2 "mcore_arith_reg_operand" "r")))
966 (clobber (reg:CC 17))]
970 if (TARGET_LITTLE_END)
971 return \"cmphs %0,%0\;subc %0,%2\;subc %R0,%R2\";
972 return \"cmphs %R0,%R0\;subc %R0,%R2\;subc %0,%2\";
974 [(set_attr "length" "6")])
976 ;; -------------------------------------------------------------------------
977 ;; Multiplication instructions
978 ;; -------------------------------------------------------------------------
980 (define_insn "mulsi3"
981 [(set (match_operand:SI 0 "mcore_arith_reg_operand" "=r")
982 (mult:SI (match_operand:SI 1 "mcore_arith_reg_operand" "%0")
983 (match_operand:SI 2 "mcore_arith_reg_operand" "r")))]
988 ;; 32/32 signed division -- added to the MCORE instruction set spring 1997
990 ;; Different constraints based on the architecture revision...
992 (define_expand "divsi3"
993 [(set (match_operand:SI 0 "mcore_arith_reg_operand" "")
994 (div:SI (match_operand:SI 1 "mcore_arith_reg_operand" "")
995 (match_operand:SI 2 "mcore_arith_reg_operand" "")))]
999 ;; MCORE Revision 1.50: restricts the divisor to be in r1. (6/97)
1002 [(set (match_operand:SI 0 "mcore_arith_reg_operand" "=r")
1003 (div:SI (match_operand:SI 1 "mcore_arith_reg_operand" "0")
1004 (match_operand:SI 2 "mcore_arith_reg_operand" "b")))]
1009 ;; 32/32 signed division -- added to the MCORE instruction set spring 1997
1011 ;; Different constraints based on the architecture revision...
1013 (define_expand "udivsi3"
1014 [(set (match_operand:SI 0 "mcore_arith_reg_operand" "")
1015 (udiv:SI (match_operand:SI 1 "mcore_arith_reg_operand" "")
1016 (match_operand:SI 2 "mcore_arith_reg_operand" "")))]
1020 ;; MCORE Revision 1.50: restricts the divisor to be in r1. (6/97)
1022 [(set (match_operand:SI 0 "mcore_arith_reg_operand" "=r")
1023 (udiv:SI (match_operand:SI 1 "mcore_arith_reg_operand" "0")
1024 (match_operand:SI 2 "mcore_arith_reg_operand" "b")))]
1028 ;; -------------------------------------------------------------------------
1030 ;; -------------------------------------------------------------------------
1032 (define_insn "negsi2"
1033 [(set (match_operand:SI 0 "mcore_arith_reg_operand" "=r")
1034 (neg:SI (match_operand:SI 1 "mcore_arith_reg_operand" "0")))]
1038 return \"rsubi %0,0\";
1042 (define_insn "abssi2"
1043 [(set (match_operand:SI 0 "mcore_arith_reg_operand" "=r")
1044 (abs:SI (match_operand:SI 1 "mcore_arith_reg_operand" "0")))]
1048 (define_insn "negdi2"
1049 [(set (match_operand:DI 0 "mcore_arith_reg_operand" "=&r")
1050 (neg:DI (match_operand:DI 1 "mcore_arith_reg_operand" "0")))
1051 (clobber (reg:CC 17))]
1055 if (TARGET_LITTLE_END)
1056 return \"cmpnei %0,0\\n\\trsubi %0,0\\n\\tnot %R0\\n\\tincf %R0\";
1057 return \"cmpnei %R0,0\\n\\trsubi %R0,0\\n\\tnot %0\\n\\tincf %0\";
1059 [(set_attr "length" "8")])
1061 (define_insn "one_cmplsi2"
1062 [(set (match_operand:SI 0 "mcore_arith_reg_operand" "=r")
1063 (not:SI (match_operand:SI 1 "mcore_arith_reg_operand" "0")))]
1067 ;; -------------------------------------------------------------------------
1068 ;; Zero extension instructions
1069 ;; -------------------------------------------------------------------------
1071 (define_expand "zero_extendhisi2"
1072 [(set (match_operand:SI 0 "mcore_arith_reg_operand" "")
1073 (zero_extend:SI (match_operand:HI 1 "mcore_arith_reg_operand" "")))]
1078 [(set (match_operand:SI 0 "mcore_arith_reg_operand" "=r,r")
1079 (zero_extend:SI (match_operand:HI 1 "general_operand" "0,m")))]
1084 [(set_attr "type" "shift,load")])
1086 ;; ldh gives us a free zero-extension. The combiner picks up on this.
1088 [(set (match_operand:SI 0 "mcore_arith_reg_operand" "=r")
1089 (zero_extend:SI (mem:HI (match_operand:SI 1 "mcore_arith_reg_operand" "r"))))]
1092 [(set_attr "type" "load")])
1095 [(set (match_operand:SI 0 "mcore_arith_reg_operand" "=r")
1096 (zero_extend:SI (mem:HI (plus:SI (match_operand:SI 1 "mcore_arith_reg_operand" "r")
1097 (match_operand:SI 2 "const_int_operand" "")))))]
1098 "(INTVAL (operands[2]) >= 0) &&
1099 (INTVAL (operands[2]) < 32) &&
1100 ((INTVAL (operands[2])&1) == 0)"
1102 [(set_attr "type" "load")])
1104 (define_expand "zero_extendqisi2"
1105 [(set (match_operand:SI 0 "mcore_arith_reg_operand" "")
1106 (zero_extend:SI (match_operand:QI 1 "general_operand" "")))]
1110 ;; RBE: XXX: we don't recognize that the xtrb3 kills the CC register.
1112 [(set (match_operand:SI 0 "mcore_arith_reg_operand" "=r,b,r")
1113 (zero_extend:SI (match_operand:QI 1 "general_operand" "0,r,m")))]
1119 [(set_attr "type" "shift,shift,load")])
1121 ;; ldb gives us a free zero-extension. The combiner picks up on this.
1123 [(set (match_operand:SI 0 "mcore_arith_reg_operand" "=r")
1124 (zero_extend:SI (mem:QI (match_operand:SI 1 "mcore_arith_reg_operand" "r"))))]
1127 [(set_attr "type" "load")])
1130 [(set (match_operand:SI 0 "mcore_arith_reg_operand" "=r")
1131 (zero_extend:SI (mem:QI (plus:SI (match_operand:SI 1 "mcore_arith_reg_operand" "r")
1132 (match_operand:SI 2 "const_int_operand" "")))))]
1133 "(INTVAL (operands[2]) >= 0) &&
1134 (INTVAL (operands[2]) < 16)"
1136 [(set_attr "type" "load")])
1138 (define_expand "zero_extendqihi2"
1139 [(set (match_operand:HI 0 "mcore_arith_reg_operand" "")
1140 (zero_extend:HI (match_operand:QI 1 "general_operand" "")))]
1144 ;; RBE: XXX: we don't recognize that the xtrb3 kills the CC register.
1146 [(set (match_operand:HI 0 "mcore_arith_reg_operand" "=r,b,r")
1147 (zero_extend:HI (match_operand:QI 1 "general_operand" "0,r,m")))]
1153 [(set_attr "type" "shift,shift,load")])
1155 ;; ldb gives us a free zero-extension. The combiner picks up on this.
1156 ;; this doesn't catch references that are into a structure.
1157 ;; note that normally the compiler uses the above insn, unless it turns
1158 ;; out that we're dealing with a volatile...
1160 [(set (match_operand:HI 0 "mcore_arith_reg_operand" "=r")
1161 (zero_extend:HI (mem:QI (match_operand:SI 1 "mcore_arith_reg_operand" "r"))))]
1164 [(set_attr "type" "load")])
1167 [(set (match_operand:HI 0 "mcore_arith_reg_operand" "=r")
1168 (zero_extend:HI (mem:QI (plus:SI (match_operand:SI 1 "mcore_arith_reg_operand" "r")
1169 (match_operand:SI 2 "const_int_operand" "")))))]
1170 "(INTVAL (operands[2]) >= 0) &&
1171 (INTVAL (operands[2]) < 16)"
1173 [(set_attr "type" "load")])
1176 ;; -------------------------------------------------------------------------
1177 ;; Sign extension instructions
1178 ;; -------------------------------------------------------------------------
1180 (define_expand "extendsidi2"
1181 [(set (match_operand:DI 0 "mcore_arith_reg_operand" "=r")
1182 (match_operand:SI 1 "mcore_arith_reg_operand" "r"))]
1188 if (TARGET_LITTLE_END)
1193 emit_insn (gen_rtx_SET (VOIDmode, gen_rtx_SUBREG (SImode, operands[0], low),
1195 emit_insn (gen_rtx_SET (VOIDmode, gen_rtx_SUBREG (SImode, operands[0], high),
1196 gen_rtx_ASHIFTRT (SImode,
1197 gen_rtx_SUBREG (SImode, operands[0], low),
1203 (define_insn "extendhisi2"
1204 [(set (match_operand:SI 0 "mcore_arith_reg_operand" "=r")
1205 (sign_extend:SI (match_operand:HI 1 "mcore_arith_reg_operand" "0")))]
1209 (define_insn "extendqisi2"
1210 [(set (match_operand:SI 0 "mcore_arith_reg_operand" "=r")
1211 (sign_extend:SI (match_operand:QI 1 "mcore_arith_reg_operand" "0")))]
1215 (define_insn "extendqihi2"
1216 [(set (match_operand:HI 0 "mcore_arith_reg_operand" "=r")
1217 (sign_extend:HI (match_operand:QI 1 "mcore_arith_reg_operand" "0")))]
1221 ;; -------------------------------------------------------------------------
1222 ;; Move instructions
1223 ;; -------------------------------------------------------------------------
1227 (define_expand "movsi"
1228 [(set (match_operand:SI 0 "general_operand" "")
1229 (match_operand:SI 1 "general_operand" ""))]
1233 if (GET_CODE (operands[0]) == MEM)
1234 operands[1] = force_reg (SImode, operands[1]);
1238 [(set (match_operand:SI 0 "mcore_general_movdst_operand" "=r,r,a,r,a,r,m")
1239 (match_operand:SI 1 "mcore_general_movsrc_operand" "r,P,i,c,R,m,r"))]
1240 "(register_operand (operands[0], SImode)
1241 || register_operand (operands[1], SImode))"
1242 "* return mcore_output_move (insn, operands, SImode);"
1243 [(set_attr "type" "move,move,move,move,load,load,store")])
1249 (define_expand "movhi"
1250 [(set (match_operand:HI 0 "general_operand" "")
1251 (match_operand:HI 1 "general_operand" ""))]
1255 if (GET_CODE (operands[0]) == MEM)
1256 operands[1] = force_reg (HImode, operands[1]);
1257 else if (CONSTANT_P (operands[1])
1258 && (GET_CODE (operands[1]) != CONST_INT
1259 || (! CONST_OK_FOR_I (INTVAL (operands[1]))
1260 && ! CONST_OK_FOR_M (INTVAL (operands[1]))
1261 && ! CONST_OK_FOR_N (INTVAL (operands[1]))))
1262 && ! reload_completed && ! reload_in_progress)
1264 rtx reg = gen_reg_rtx (SImode);
1265 emit_insn (gen_movsi (reg, operands[1]));
1266 operands[1] = gen_lowpart (HImode, reg);
1271 [(set (match_operand:HI 0 "mcore_general_movdst_operand" "=r,r,a,r,r,m")
1272 (match_operand:HI 1 "mcore_general_movsrc_operand" "r,P,i,c,m,r"))]
1273 "(register_operand (operands[0], HImode)
1274 || register_operand (operands[1], HImode))"
1275 "* return mcore_output_move (insn, operands, HImode);"
1276 [(set_attr "type" "move,move,move,move,load,store")])
1282 (define_expand "movqi"
1283 [(set (match_operand:QI 0 "general_operand" "")
1284 (match_operand:QI 1 "general_operand" ""))]
1288 if (GET_CODE (operands[0]) == MEM)
1289 operands[1] = force_reg (QImode, operands[1]);
1290 else if (CONSTANT_P (operands[1])
1291 && (GET_CODE (operands[1]) != CONST_INT
1292 || (! CONST_OK_FOR_I (INTVAL (operands[1]))
1293 && ! CONST_OK_FOR_M (INTVAL (operands[1]))
1294 && ! CONST_OK_FOR_N (INTVAL (operands[1]))))
1295 && ! reload_completed && ! reload_in_progress)
1297 rtx reg = gen_reg_rtx (SImode);
1298 emit_insn (gen_movsi (reg, operands[1]));
1299 operands[1] = gen_lowpart (QImode, reg);
1304 [(set (match_operand:QI 0 "mcore_general_movdst_operand" "=r,r,a,r,r,m")
1305 (match_operand:QI 1 "mcore_general_movsrc_operand" "r,P,i,c,m,r"))]
1306 "(register_operand (operands[0], QImode)
1307 || register_operand (operands[1], QImode))"
1308 "* return mcore_output_move (insn, operands, QImode);"
1309 [(set_attr "type" "move,move,move,move,load,store")])
1314 (define_expand "movdi"
1315 [(set (match_operand:DI 0 "general_operand" "")
1316 (match_operand:DI 1 "general_operand" ""))]
1320 if (GET_CODE (operands[0]) == MEM)
1321 operands[1] = force_reg (DImode, operands[1]);
1322 else if (GET_CODE (operands[1]) == CONST_INT
1323 && ! CONST_OK_FOR_I (INTVAL (operands[1]))
1324 && ! CONST_OK_FOR_M (INTVAL (operands[1]))
1325 && ! CONST_OK_FOR_N (INTVAL (operands[1])))
1328 for (i = 0; i < UNITS_PER_WORD * 2; i += UNITS_PER_WORD)
1329 emit_move_insn (simplify_gen_subreg (SImode, operands[0], DImode, i),
1330 simplify_gen_subreg (SImode, operands[1], DImode, i));
1335 (define_insn "movdi_i"
1336 [(set (match_operand:DI 0 "general_operand" "=r,r,r,r,a,r,m")
1337 (match_operand:DI 1 "mcore_general_movsrc_operand" "I,M,N,r,R,m,r"))]
1339 "* return mcore_output_movedouble (operands, DImode);"
1340 [(set_attr "length" "4") (set_attr "type" "move,move,move,move,load,load,store")])
1344 (define_expand "movsf"
1345 [(set (match_operand:SF 0 "general_operand" "")
1346 (match_operand:SF 1 "general_operand" ""))]
1350 if (GET_CODE (operands[0]) == MEM)
1351 operands[1] = force_reg (SFmode, operands[1]);
1354 (define_insn "movsf_i"
1355 [(set (match_operand:SF 0 "general_operand" "=r,r,m")
1356 (match_operand:SF 1 "general_operand" "r,m,r"))]
1362 [(set_attr "type" "move,load,store")])
1366 (define_expand "movdf"
1367 [(set (match_operand:DF 0 "general_operand" "")
1368 (match_operand:DF 1 "general_operand" ""))]
1372 if (GET_CODE (operands[0]) == MEM)
1373 operands[1] = force_reg (DFmode, operands[1]);
1376 (define_insn "movdf_k"
1377 [(set (match_operand:DF 0 "general_operand" "=r,r,m")
1378 (match_operand:DF 1 "general_operand" "r,m,r"))]
1380 "* return mcore_output_movedouble (operands, DFmode);"
1381 [(set_attr "length" "4") (set_attr "type" "move,load,store")])
1384 ;; Load/store multiple
1386 ;; ??? This is not currently used.
1388 [(set (match_operand:TI 0 "mcore_arith_reg_operand" "=r")
1389 (mem:TI (match_operand:SI 1 "mcore_arith_reg_operand" "r")))]
1393 ;; ??? This is not currently used.
1395 [(set (mem:TI (match_operand:SI 0 "mcore_arith_reg_operand" "r"))
1396 (match_operand:TI 1 "mcore_arith_reg_operand" "r"))]
1400 (define_expand "load_multiple"
1401 [(match_par_dup 3 [(set (match_operand:SI 0 "" "")
1402 (match_operand:SI 1 "" ""))
1403 (use (match_operand:SI 2 "" ""))])]
1407 int regno, count, i;
1409 /* Support only loading a constant number of registers from memory and
1410 only if at least two registers. The last register must be r15. */
1411 if (GET_CODE (operands[2]) != CONST_INT
1412 || INTVAL (operands[2]) < 2
1413 || GET_CODE (operands[1]) != MEM
1414 || XEXP (operands[1], 0) != stack_pointer_rtx
1415 || GET_CODE (operands[0]) != REG
1416 || REGNO (operands[0]) + INTVAL (operands[2]) != 16)
1419 count = INTVAL (operands[2]);
1420 regno = REGNO (operands[0]);
1422 operands[3] = gen_rtx_PARALLEL (VOIDmode, rtvec_alloc (count));
1424 for (i = 0; i < count; i++)
1425 XVECEXP (operands[3], 0, i)
1426 = gen_rtx_SET (VOIDmode,
1427 gen_rtx_REG (SImode, regno + i),
1428 gen_rtx_MEM (SImode, plus_constant (stack_pointer_rtx,
1433 [(match_parallel 0 "mcore_load_multiple_operation"
1434 [(set (match_operand:SI 1 "mcore_arith_reg_operand" "=r")
1435 (mem:SI (match_operand:SI 2 "register_operand" "r")))])]
1436 "GET_CODE (operands[2]) == REG && REGNO (operands[2]) == STACK_POINTER_REGNUM"
1439 (define_expand "store_multiple"
1440 [(match_par_dup 3 [(set (match_operand:SI 0 "" "")
1441 (match_operand:SI 1 "" ""))
1442 (use (match_operand:SI 2 "" ""))])]
1446 int regno, count, i;
1448 /* Support only storing a constant number of registers to memory and
1449 only if at least two registers. The last register must be r15. */
1450 if (GET_CODE (operands[2]) != CONST_INT
1451 || INTVAL (operands[2]) < 2
1452 || GET_CODE (operands[0]) != MEM
1453 || XEXP (operands[0], 0) != stack_pointer_rtx
1454 || GET_CODE (operands[1]) != REG
1455 || REGNO (operands[1]) + INTVAL (operands[2]) != 16)
1458 count = INTVAL (operands[2]);
1459 regno = REGNO (operands[1]);
1461 operands[3] = gen_rtx_PARALLEL (VOIDmode, rtvec_alloc (count));
1463 for (i = 0; i < count; i++)
1464 XVECEXP (operands[3], 0, i)
1465 = gen_rtx_SET (VOIDmode,
1466 gen_rtx_MEM (SImode, plus_constant (stack_pointer_rtx,
1468 gen_rtx_REG (SImode, regno + i));
1472 [(match_parallel 0 "mcore_store_multiple_operation"
1473 [(set (mem:SI (match_operand:SI 2 "register_operand" "r"))
1474 (match_operand:SI 1 "mcore_arith_reg_operand" "r"))])]
1475 "GET_CODE (operands[2]) == REG && REGNO (operands[2]) == STACK_POINTER_REGNUM"
1478 ;; ------------------------------------------------------------------------
1479 ;; Define the real conditional branch instructions.
1480 ;; ------------------------------------------------------------------------
1482 (define_insn "branch_true"
1483 [(set (pc) (if_then_else (ne (reg:CC 17) (const_int 0))
1484 (label_ref (match_operand 0 "" ""))
1488 [(set_attr "type" "brcond")])
1490 (define_insn "branch_false"
1491 [(set (pc) (if_then_else (eq (reg:CC 17) (const_int 0))
1492 (label_ref (match_operand 0 "" ""))
1496 [(set_attr "type" "brcond")])
1498 (define_insn "inverse_branch_true"
1499 [(set (pc) (if_then_else (ne (reg:CC 17) (const_int 0))
1501 (label_ref (match_operand 0 "" ""))))]
1504 [(set_attr "type" "brcond")])
1506 (define_insn "inverse_branch_false"
1507 [(set (pc) (if_then_else (eq (reg:CC 17) (const_int 0))
1509 (label_ref (match_operand 0 "" ""))))]
1512 [(set_attr "type" "brcond")])
1514 ;; Conditional branch insns
1516 ;; At top-level, condition test are eq/ne, because we
1517 ;; are comparing against the condition register (which
1518 ;; has the result of the true relational test
1520 ; There is no beq compare, so we reverse the branch arms.
1522 (define_expand "beq"
1523 [(set (pc) (if_then_else (ne (match_dup 1) (const_int 0))
1525 (label_ref (match_operand 0 "" ""))))]
1529 operands[1] = mcore_gen_compare_reg (EQ);
1532 (define_expand "bne"
1533 [(set (pc) (if_then_else (ne (match_dup 1) (const_int 0))
1534 (label_ref (match_operand 0 "" ""))
1539 operands[1] = mcore_gen_compare_reg (NE);
1542 ; check whether (GT A imm) can become (LE A imm) with the branch reversed.
1543 ; if so, emit a (LT A imm + 1) in place of the (LE A imm). BRC
1545 (define_expand "bgt"
1546 [(set (pc) (if_then_else (ne (match_dup 1) (const_int 0))
1547 (label_ref (match_operand 0 "" ""))
1552 if (mcore_modify_comparison (LE))
1554 emit_jump_insn (gen_reverse_blt (operands[0]));
1557 operands[1] = mcore_gen_compare_reg (GT);
1560 ; There is no ble compare, so we reverse the branch arms.
1561 ; reversed the condition and branch arms for ble -- the check_dbra_loop()
1562 ; transformation assumes that ble uses a branch-true with the label as
1563 ; as the target. BRC
1565 ; check whether (LE A imm) can become (LT A imm + 1).
1567 (define_expand "ble"
1568 [(set (pc) (if_then_else (eq (match_dup 1) (const_int 0))
1569 (label_ref (match_operand 0 "" ""))
1574 if (mcore_modify_comparison (LE))
1576 emit_jump_insn (gen_blt (operands[0]));
1579 operands[1] = mcore_gen_compare_reg (LE);
1582 ; make generating a reversed blt simple
1583 (define_expand "reverse_blt"
1584 [(set (pc) (if_then_else (ne (match_dup 1) (const_int 0))
1586 (label_ref (match_operand 0 "" ""))))]
1590 operands[1] = mcore_gen_compare_reg (LT);
1593 (define_expand "blt"
1594 [(set (pc) (if_then_else (ne (match_dup 1) (const_int 0))
1595 (label_ref (match_operand 0 "" ""))
1600 operands[1] = mcore_gen_compare_reg (LT);
1603 ; There is no bge compare, so we reverse the branch arms.
1605 (define_expand "bge"
1606 [(set (pc) (if_then_else (ne (match_dup 1) (const_int 0))
1608 (label_ref (match_operand 0 "" ""))))]
1612 operands[1] = mcore_gen_compare_reg (GE);
1615 ; There is no gtu compare, so we reverse the branch arms
1617 ;(define_expand "bgtu"
1618 ; [(set (pc) (if_then_else (ne (match_dup 1) (const_int 0))
1620 ; (label_ref (match_operand 0 "" ""))))]
1624 ; if (GET_CODE (arch_compare_op1) == CONST_INT
1625 ; && INTVAL (arch_compare_op1) == 0)
1626 ; operands[1] = mcore_gen_compare_reg (NE);
1628 ; { if (mcore_modify_comparison (GTU))
1630 ; emit_jump_insn (gen_bgeu (operands[0]));
1633 ; operands[1] = mcore_gen_compare_reg (LEU);
1637 (define_expand "bgtu"
1638 [(set (pc) (if_then_else (ne (match_dup 1) (const_int 0))
1640 (label_ref (match_operand 0 "" ""))))]
1644 if (GET_CODE (arch_compare_op1) == CONST_INT
1645 && INTVAL (arch_compare_op1) == 0)
1647 /* The inverse of '> 0' for an unsigned test is
1648 '== 0' but we do not have such an instruction available.
1649 Instead we must reverse the branch (back to the normal
1650 ordering) and test '!= 0'. */
1652 operands[1] = mcore_gen_compare_reg (NE);
1654 emit_jump_insn (gen_rtx_SET (VOIDmode,
1656 gen_rtx_IF_THEN_ELSE (VOIDmode,
1657 gen_rtx_NE (VOIDmode,
1660 gen_rtx_LABEL_REF (VOIDmode,operands[0]),
1664 operands[1] = mcore_gen_compare_reg (GTU);
1668 (define_expand "bleu"
1669 [(set (pc) (if_then_else (ne (match_dup 1) (const_int 0))
1670 (label_ref (match_operand 0 "" ""))
1675 operands[1] = mcore_gen_compare_reg (LEU);
1678 ; There is no bltu compare, so we reverse the branch arms
1679 (define_expand "bltu"
1680 [(set (pc) (if_then_else (ne (match_dup 1) (const_int 0))
1682 (label_ref (match_operand 0 "" ""))))]
1686 operands[1] = mcore_gen_compare_reg (LTU);
1689 (define_expand "bgeu"
1690 [(set (pc) (if_then_else (ne (match_dup 1) (const_int 0))
1691 (label_ref (match_operand 0 "" ""))
1697 operands[1] = mcore_gen_compare_reg (GEU);
1700 ;; ------------------------------------------------------------------------
1701 ;; Jump and linkage insns
1702 ;; ------------------------------------------------------------------------
1704 (define_insn "jump_real"
1706 (label_ref (match_operand 0 "" "")))]
1709 [(set_attr "type" "branch")])
1711 (define_expand "jump"
1712 [(set (pc) (label_ref (match_operand 0 "" "")))]
1716 emit_jump_insn (gen_jump_real (operand0));
1721 (define_insn "indirect_jump"
1723 (match_operand:SI 0 "mcore_arith_reg_operand" "r"))]
1726 [(set_attr "type" "jmp")])
1728 (define_expand "call"
1729 [(parallel[(call (match_operand:SI 0 "" "")
1730 (match_operand 1 "" ""))
1731 (clobber (reg:SI 15))])]
1735 if (GET_CODE (operands[0]) == MEM
1736 && ! register_operand (XEXP (operands[0], 0), SImode)
1737 && ! mcore_symbolic_address_p (XEXP (operands[0], 0)))
1738 operands[0] = gen_rtx_MEM (GET_MODE (operands[0]),
1739 force_reg (Pmode, XEXP (operands[0], 0)));
1742 (define_insn "call_internal"
1743 [(call (mem:SI (match_operand:SI 0 "mcore_call_address_operand" "riR"))
1744 (match_operand 1 "" ""))
1745 (clobber (reg:SI 15))]
1747 "* return mcore_output_call (operands, 0);")
1749 (define_expand "call_value"
1750 [(parallel[(set (match_operand 0 "register_operand" "")
1751 (call (match_operand:SI 1 "" "")
1752 (match_operand 2 "" "")))
1753 (clobber (reg:SI 15))])]
1757 if (GET_CODE (operands[0]) == MEM
1758 && ! register_operand (XEXP (operands[0], 0), SImode)
1759 && ! mcore_symbolic_address_p (XEXP (operands[0], 0)))
1760 operands[1] = gen_rtx_MEM (GET_MODE (operands[1]),
1761 force_reg (Pmode, XEXP (operands[1], 0)));
1764 (define_insn "call_value_internal"
1765 [(set (match_operand 0 "register_operand" "=r")
1766 (call (mem:SI (match_operand:SI 1 "mcore_call_address_operand" "riR"))
1767 (match_operand 2 "" "")))
1768 (clobber (reg:SI 15))]
1770 "* return mcore_output_call (operands, 1);")
1772 (define_insn "call_value_struct"
1773 [(parallel [(set (match_parallel 0 ""
1774 [(expr_list (match_operand 3 "register_operand" "") (match_operand 4 "immediate_operand" ""))
1775 (expr_list (match_operand 5 "register_operand" "") (match_operand 6 "immediate_operand" ""))])
1776 (call (match_operand:SI 1 "" "")
1777 (match_operand 2 "" "")))
1778 (clobber (reg:SI 15))])]
1780 "* return mcore_output_call (operands, 1);"
1784 ;; ------------------------------------------------------------------------
1786 ;; ------------------------------------------------------------------------
1793 (define_insn "tablejump"
1795 (match_operand:SI 0 "mcore_arith_reg_operand" "r"))
1796 (use (label_ref (match_operand 1 "" "")))]
1799 [(set_attr "type" "jmp")])
1801 (define_insn "*return"
1803 "reload_completed && ! mcore_naked_function_p ()"
1805 [(set_attr "type" "jmp")])
1807 (define_insn "*no_return"
1809 "reload_completed && mcore_naked_function_p ()"
1811 [(set_attr "length" "0")]
1814 (define_expand "prologue"
1817 "mcore_expand_prolog (); DONE;")
1819 (define_expand "epilogue"
1822 "mcore_expand_epilog ();")
1824 ;; ------------------------------------------------------------------------
1826 ;; ------------------------------------------------------------------------
1829 [(set (match_operand:SI 0 "mcore_arith_reg_operand" "=r")
1830 (ne:SI (reg:CC 17) (const_int 0)))]
1833 [(set_attr "type" "move")])
1836 [(set (match_operand:SI 0 "mcore_arith_reg_operand" "=r")
1837 (eq:SI (reg:CC 17) (const_int 0)))]
1840 [(set_attr "type" "move")])
1842 ; in 0.97 use (LE 0) with (LT 1) and complement c. BRC
1845 (set (match_operand:SI 0 "mcore_arith_reg_operand" "")
1846 (ne:SI (gt:CC (match_operand:SI 1 "mcore_arith_reg_operand" "")
1849 (clobber (reg:SI 17))])]
1852 (lt:CC (match_dup 1) (const_int 1)))
1853 (set (match_dup 0) (eq:SI (reg:CC 17) (const_int 0)))])
1856 (define_expand "seq"
1857 [(set (match_operand:SI 0 "mcore_arith_reg_operand" "")
1858 (eq:SI (match_dup 1) (const_int 0)))]
1862 operands[1] = mcore_gen_compare_reg (NE);
1865 (define_expand "sne"
1866 [(set (match_operand:SI 0 "mcore_arith_reg_operand" "")
1867 (ne:SI (match_dup 1) (const_int 0)))]
1871 operands[1] = mcore_gen_compare_reg (NE);
1874 (define_expand "slt"
1875 [(set (match_operand:SI 0 "mcore_arith_reg_operand" "")
1876 (ne:SI (match_dup 1) (const_int 0)))]
1880 operands[1] = mcore_gen_compare_reg (LT);
1883 ; make generating a LT with the comparison reversed easy. BRC
1884 (define_expand "reverse_slt"
1885 [(set (match_operand:SI 0 "mcore_arith_reg_operand" "")
1886 (eq:SI (match_dup 1) (const_int 0)))]
1890 operands[1] = mcore_gen_compare_reg (LT);
1893 (define_expand "sge"
1894 [(set (match_operand:SI 0 "mcore_arith_reg_operand" "")
1895 (eq:SI (match_dup 1) (const_int 0)))]
1899 operands[1] = mcore_gen_compare_reg (LT);
1902 ; check whether (GT A imm) can become (LE A imm) with the comparison
1903 ; reversed. if so, emit a (LT A imm + 1) in place of the (LE A imm). BRC
1905 (define_expand "sgt"
1906 [(set (match_operand:SI 0 "mcore_arith_reg_operand" "")
1907 (ne:SI (match_dup 1) (const_int 0)))]
1911 if (mcore_modify_comparison (LE))
1913 emit_insn (gen_reverse_slt (operands[0]));
1917 operands[1] = mcore_gen_compare_reg (GT);
1920 (define_expand "sle"
1921 [(set (match_operand:SI 0 "mcore_arith_reg_operand" "")
1922 (eq:SI (match_dup 1) (const_int 0)))]
1926 if (mcore_modify_comparison (LE))
1928 emit_insn (gen_slt (operands[0]));
1931 operands[1] = mcore_gen_compare_reg (GT);
1934 (define_expand "sltu"
1935 [(set (match_operand:SI 0 "mcore_arith_reg_operand" "")
1936 (eq:SI (match_dup 1) (const_int 0)))]
1940 operands[1] = mcore_gen_compare_reg (GEU);
1943 (define_expand "sgeu"
1944 [(set (match_operand:SI 0 "mcore_arith_reg_operand" "")
1945 (ne:SI (match_dup 1) (const_int 0)))]
1949 operands[1] = mcore_gen_compare_reg (GEU);
1952 (define_expand "sgtu"
1953 [(set (match_operand:SI 0 "mcore_arith_reg_operand" "")
1954 (eq:SI (match_dup 1) (const_int 0)))]
1958 operands[1] = mcore_gen_compare_reg (LEU);
1961 (define_expand "sleu"
1962 [(set (match_operand:SI 0 "mcore_arith_reg_operand" "")
1963 (ne:SI (match_dup 1) (const_int 0)))]
1967 operands[1] = mcore_gen_compare_reg (LEU);
1970 (define_insn "incscc"
1971 [(set (match_operand:SI 0 "mcore_arith_reg_operand" "=r")
1972 (plus:SI (ne (reg:CC 17) (const_int 0))
1973 (match_operand:SI 1 "mcore_arith_reg_operand" "0")))]
1977 (define_insn "incscc_false"
1978 [(set (match_operand:SI 0 "mcore_arith_reg_operand" "=r")
1979 (plus:SI (eq (reg:CC 17) (const_int 0))
1980 (match_operand:SI 1 "mcore_arith_reg_operand" "0")))]
1984 (define_insn "decscc"
1985 [(set (match_operand:SI 0 "mcore_arith_reg_operand" "=r")
1986 (minus:SI (match_operand:SI 1 "mcore_arith_reg_operand" "0")
1987 (ne (reg:CC 17) (const_int 0))))]
1991 (define_insn "decscc_false"
1992 [(set (match_operand:SI 0 "mcore_arith_reg_operand" "=r")
1993 (minus:SI (match_operand:SI 1 "mcore_arith_reg_operand" "0")
1994 (eq (reg:CC 17) (const_int 0))))]
1998 ;; ------------------------------------------------------------------------
1999 ;; Conditional move patterns.
2000 ;; ------------------------------------------------------------------------
2002 (define_expand "smaxsi3"
2004 (lt:CC (match_operand:SI 1 "mcore_arith_reg_operand" "")
2005 (match_operand:SI 2 "mcore_arith_reg_operand" "")))
2006 (set (match_operand:SI 0 "mcore_arith_reg_operand" "")
2007 (if_then_else:SI (eq (reg:CC 17) (const_int 0))
2008 (match_dup 1) (match_dup 2)))]
2013 [(set (match_operand:SI 0 "mcore_arith_reg_operand" "")
2014 (smax:SI (match_operand:SI 1 "mcore_arith_reg_operand" "")
2015 (match_operand:SI 2 "mcore_arith_reg_operand" "")))]
2018 (lt:SI (match_dup 1) (match_dup 2)))
2020 (if_then_else:SI (eq (reg:CC 17) (const_int 0))
2021 (match_dup 1) (match_dup 2)))]
2024 ; no tstgt in 0.97, so just use cmplti (btsti x,31) and reverse move
2027 [(set (match_operand:SI 0 "mcore_arith_reg_operand" "")
2028 (smax:SI (match_operand:SI 1 "mcore_arith_reg_operand" "")
2032 (lt:CC (match_dup 1) (const_int 0)))
2034 (if_then_else:SI (eq (reg:CC 17) (const_int 0))
2035 (match_dup 1) (const_int 0)))]
2038 (define_expand "sminsi3"
2040 (lt:CC (match_operand:SI 1 "mcore_arith_reg_operand" "")
2041 (match_operand:SI 2 "mcore_arith_reg_operand" "")))
2042 (set (match_operand:SI 0 "mcore_arith_reg_operand" "")
2043 (if_then_else:SI (ne (reg:CC 17) (const_int 0))
2044 (match_dup 1) (match_dup 2)))]
2049 [(set (match_operand:SI 0 "mcore_arith_reg_operand" "")
2050 (smin:SI (match_operand:SI 1 "mcore_arith_reg_operand" "")
2051 (match_operand:SI 2 "mcore_arith_reg_operand" "")))]
2054 (lt:SI (match_dup 1) (match_dup 2)))
2056 (if_then_else:SI (ne (reg:CC 17) (const_int 0))
2057 (match_dup 1) (match_dup 2)))]
2061 ; [(set (match_operand:SI 0 "mcore_arith_reg_operand" "")
2062 ; (smin:SI (match_operand:SI 1 "mcore_arith_reg_operand" "")
2066 ; (gt:CC (match_dup 1) (const_int 0)))
2067 ; (set (match_dup 0)
2068 ; (if_then_else:SI (eq (reg:CC 17) (const_int 0))
2069 ; (match_dup 1) (const_int 0)))]
2072 ; changed these unsigned patterns to use geu instead of ltu. it appears
2073 ; that the c-torture & ssrl test suites didn't catch these! only showed
2074 ; up in friedman's clib work. BRC 7/7/95
2076 (define_expand "umaxsi3"
2078 (geu:CC (match_operand:SI 1 "mcore_arith_reg_operand" "")
2079 (match_operand:SI 2 "mcore_arith_reg_operand" "")))
2080 (set (match_operand:SI 0 "mcore_arith_reg_operand" "")
2081 (if_then_else:SI (eq (reg:CC 17) (const_int 0))
2082 (match_dup 2) (match_dup 1)))]
2087 [(set (match_operand:SI 0 "mcore_arith_reg_operand" "")
2088 (umax:SI (match_operand:SI 1 "mcore_arith_reg_operand" "")
2089 (match_operand:SI 2 "mcore_arith_reg_operand" "")))]
2092 (geu:SI (match_dup 1) (match_dup 2)))
2094 (if_then_else:SI (eq (reg:CC 17) (const_int 0))
2095 (match_dup 2) (match_dup 1)))]
2098 (define_expand "uminsi3"
2100 (geu:CC (match_operand:SI 1 "mcore_arith_reg_operand" "")
2101 (match_operand:SI 2 "mcore_arith_reg_operand" "")))
2102 (set (match_operand:SI 0 "mcore_arith_reg_operand" "")
2103 (if_then_else:SI (ne (reg:CC 17) (const_int 0))
2104 (match_dup 2) (match_dup 1)))]
2109 [(set (match_operand:SI 0 "mcore_arith_reg_operand" "")
2110 (umin:SI (match_operand:SI 1 "mcore_arith_reg_operand" "")
2111 (match_operand:SI 2 "mcore_arith_reg_operand" "")))]
2114 (geu:SI (match_dup 1) (match_dup 2)))
2116 (if_then_else:SI (ne (reg:CC 17) (const_int 0))
2117 (match_dup 2) (match_dup 1)))]
2120 ;; ------------------------------------------------------------------------
2121 ;; conditional move patterns really start here
2122 ;; ------------------------------------------------------------------------
2124 ;; the "movtK" patterns are experimental. they are intended to account for
2125 ;; gcc's mucking on code such as:
2127 ;; free_ent = ((block_compress) ? 257 : 256 );
2129 ;; these patterns help to get a tstne/bgeni/inct (or equivalent) sequence
2130 ;; when both arms have constants that are +/- 1 of each other.
2132 ;; note in the following patterns that the "movtK" ones should be the first
2133 ;; one defined in each sequence. this is because the general pattern also
2134 ;; matches, so use ordering to determine priority (it's easier this way than
2135 ;; adding conditions to the general patterns). BRC
2137 ;; the U and Q constraints are necessary to ensure that reload does the
2138 ;; 'right thing'. U constrains the operand to 0 and Q to 1 for use in the
2139 ;; clrt & clrf and clrt/inct & clrf/incf patterns. BRC 6/26
2141 ;; ??? there appears to be some problems with these movtK patterns for ops
2142 ;; other than eq & ne. need to fix. 6/30 BRC
2144 ;; ------------------------------------------------------------------------
2146 ;; ------------------------------------------------------------------------
2148 ; experimental conditional move with two constants +/- 1 BRC
2150 (define_insn "movtK_1"
2151 [(set (match_operand:SI 0 "mcore_arith_reg_operand" "=r")
2153 (ne (reg:CC 17) (const_int 0))
2154 (match_operand:SI 1 "mcore_arith_O_operand" "O")
2155 (match_operand:SI 2 "mcore_arith_O_operand" "O")))]
2156 " GET_CODE (operands[1]) == CONST_INT
2157 && GET_CODE (operands[2]) == CONST_INT
2158 && ( (INTVAL (operands[1]) - INTVAL (operands[2]) == 1)
2159 || (INTVAL (operands[2]) - INTVAL (operands[1]) == 1))"
2160 "* return mcore_output_cmov (operands, 1, NULL);"
2161 [(set_attr "length" "4")])
2163 (define_insn "movt0"
2164 [(set (match_operand:SI 0 "mcore_arith_reg_operand" "=r,r,r,r")
2166 (ne (reg:CC 17) (const_int 0))
2167 (match_operand:SI 1 "mcore_arith_imm_operand" "r,0,U,0")
2168 (match_operand:SI 2 "mcore_arith_imm_operand" "0,r,0,U")))]
2176 ;; ------------------------------------------------------------------------
2178 ;; ------------------------------------------------------------------------
2180 ; experimental conditional move with two constants +/- 1 BRC
2181 (define_insn "movtK_2"
2182 [(set (match_operand:SI 0 "mcore_arith_reg_operand" "=r")
2184 (eq (reg:CC 17) (const_int 0))
2185 (match_operand:SI 1 "mcore_arith_O_operand" "O")
2186 (match_operand:SI 2 "mcore_arith_O_operand" "O")))]
2187 " GET_CODE (operands[1]) == CONST_INT
2188 && GET_CODE (operands[2]) == CONST_INT
2189 && ( (INTVAL (operands[1]) - INTVAL (operands[2]) == 1)
2190 || (INTVAL (operands[2]) - INTVAL (operands[1]) == 1))"
2191 "* return mcore_output_cmov (operands, 0, NULL);"
2192 [(set_attr "length" "4")])
2194 (define_insn "movf0"
2195 [(set (match_operand:SI 0 "mcore_arith_reg_operand" "=r,r,r,r")
2197 (eq (reg:CC 17) (const_int 0))
2198 (match_operand:SI 1 "mcore_arith_imm_operand" "r,0,U,0")
2199 (match_operand:SI 2 "mcore_arith_imm_operand" "0,r,0,U")))]
2207 ; turns lsli rx,imm/btsti rx,31 into btsti rx,imm. not done by a peephole
2208 ; because the instructions are not adjacent (peepholes are related by posn -
2209 ; not by dataflow). BRC
2212 [(set (match_operand:SI 0 "mcore_arith_reg_operand" "=r,r,r,r")
2213 (if_then_else:SI (eq (zero_extract:SI
2214 (match_operand:SI 1 "mcore_arith_reg_operand" "r,r,r,r")
2216 (match_operand:SI 2 "mcore_literal_K_operand" "K,K,K,K"))
2218 (match_operand:SI 3 "mcore_arith_imm_operand" "r,0,U,0")
2219 (match_operand:SI 4 "mcore_arith_imm_operand" "0,r,0,U")))]
2222 btsti %1,%2\;movf %0,%3
2223 btsti %1,%2\;movt %0,%4
2224 btsti %1,%2\;clrf %0
2225 btsti %1,%2\;clrt %0"
2226 [(set_attr "length" "4")])
2228 ; turns sextb rx/btsti rx,31 into btsti rx,7. must be QImode to be safe. BRC
2231 [(set (match_operand:SI 0 "mcore_arith_reg_operand" "=r,r,r,r")
2232 (if_then_else:SI (eq (lshiftrt:SI
2233 (match_operand:SI 1 "mcore_arith_reg_operand" "r,r,r,r")
2236 (match_operand:SI 2 "mcore_arith_imm_operand" "r,0,U,0")
2237 (match_operand:SI 3 "mcore_arith_imm_operand" "0,r,0,U")))]
2238 "GET_CODE (operands[1]) == SUBREG &&
2239 GET_MODE (SUBREG_REG (operands[1])) == QImode"
2241 btsti %1,7\;movf %0,%2
2242 btsti %1,7\;movt %0,%3
2244 btsti %1,7\;clrt %0"
2245 [(set_attr "length" "4")])
2248 ;; ------------------------------------------------------------------------
2250 ;; ------------------------------------------------------------------------
2252 ;; Combine creates this from an andn instruction in a scc sequence.
2253 ;; We must recognize it to get conditional moves generated.
2255 ; experimental conditional move with two constants +/- 1 BRC
2256 (define_insn "movtK_3"
2257 [(set (match_operand:SI 0 "mcore_arith_reg_operand" "=r")
2259 (ne (match_operand:SI 1 "mcore_arith_reg_operand" "r")
2261 (match_operand:SI 2 "mcore_arith_O_operand" "O")
2262 (match_operand:SI 3 "mcore_arith_O_operand" "O")))]
2263 " GET_CODE (operands[2]) == CONST_INT
2264 && GET_CODE (operands[3]) == CONST_INT
2265 && ( (INTVAL (operands[2]) - INTVAL (operands[3]) == 1)
2266 || (INTVAL (operands[3]) - INTVAL (operands[2]) == 1))"
2269 rtx out_operands[4];
2270 out_operands[0] = operands[0];
2271 out_operands[1] = operands[2];
2272 out_operands[2] = operands[3];
2273 out_operands[3] = operands[1];
2275 return mcore_output_cmov (out_operands, 1, \"cmpnei %3,0\");
2278 [(set_attr "length" "6")])
2280 (define_insn "movt2"
2281 [(set (match_operand:SI 0 "mcore_arith_reg_operand" "=r,r,r,r")
2282 (if_then_else:SI (ne (match_operand:SI 1 "mcore_arith_reg_operand" "r,r,r,r")
2284 (match_operand:SI 2 "mcore_arith_imm_operand" "r,0,U,0")
2285 (match_operand:SI 3 "mcore_arith_imm_operand" "0,r,0,U")))]
2288 cmpnei %1,0\;movt %0,%2
2289 cmpnei %1,0\;movf %0,%3
2290 cmpnei %1,0\;clrt %0
2291 cmpnei %1,0\;clrf %0"
2292 [(set_attr "length" "4")])
2294 ; turns lsli rx,imm/btsti rx,31 into btsti rx,imm. not done by a peephole
2295 ; because the instructions are not adjacent (peepholes are related by posn -
2296 ; not by dataflow). BRC
2299 [(set (match_operand:SI 0 "mcore_arith_reg_operand" "=r,r,r,r")
2300 (if_then_else:SI (ne (zero_extract:SI
2301 (match_operand:SI 1 "mcore_arith_reg_operand" "r,r,r,r")
2303 (match_operand:SI 2 "mcore_literal_K_operand" "K,K,K,K"))
2305 (match_operand:SI 3 "mcore_arith_imm_operand" "r,0,U,0")
2306 (match_operand:SI 4 "mcore_arith_imm_operand" "0,r,0,U")))]
2309 btsti %1,%2\;movt %0,%3
2310 btsti %1,%2\;movf %0,%4
2311 btsti %1,%2\;clrt %0
2312 btsti %1,%2\;clrf %0"
2313 [(set_attr "length" "4")])
2315 ; turns sextb rx/btsti rx,31 into btsti rx,7. must be QImode to be safe. BRC
2318 [(set (match_operand:SI 0 "mcore_arith_reg_operand" "=r,r,r,r")
2319 (if_then_else:SI (ne (lshiftrt:SI
2320 (match_operand:SI 1 "mcore_arith_reg_operand" "r,r,r,r")
2323 (match_operand:SI 2 "mcore_arith_imm_operand" "r,0,U,0")
2324 (match_operand:SI 3 "mcore_arith_imm_operand" "0,r,0,U")))]
2325 "GET_CODE (operands[1]) == SUBREG &&
2326 GET_MODE (SUBREG_REG (operands[1])) == QImode"
2328 btsti %1,7\;movt %0,%2
2329 btsti %1,7\;movf %0,%3
2331 btsti %1,7\;clrf %0"
2332 [(set_attr "length" "4")])
2334 ;; ------------------------------------------------------------------------
2336 ;; ------------------------------------------------------------------------
2338 ; experimental conditional move with two constants +/- 1 BRC
2339 (define_insn "movtK_4"
2340 [(set (match_operand:SI 0 "mcore_arith_reg_operand" "=r")
2342 (eq (eq:SI (reg:CC 17) (const_int 0)) (const_int 0))
2343 (match_operand:SI 1 "mcore_arith_O_operand" "O")
2344 (match_operand:SI 2 "mcore_arith_O_operand" "O")))]
2345 "GET_CODE (operands[1]) == CONST_INT &&
2346 GET_CODE (operands[2]) == CONST_INT &&
2347 ((INTVAL (operands[1]) - INTVAL (operands[2]) == 1) ||
2348 (INTVAL (operands[2]) - INTVAL (operands[1]) == 1))"
2349 "* return mcore_output_cmov(operands, 1, NULL);"
2350 [(set_attr "length" "4")])
2352 (define_insn "movt3"
2353 [(set (match_operand:SI 0 "mcore_arith_reg_operand" "=r,r,r,r")
2355 (eq (eq:SI (reg:CC 17) (const_int 0)) (const_int 0))
2356 (match_operand:SI 1 "mcore_arith_imm_operand" "r,0,U,0")
2357 (match_operand:SI 2 "mcore_arith_imm_operand" "0,r,0,U")))]
2365 ;; ------------------------------------------------------------------------
2367 ;; ------------------------------------------------------------------------
2369 ; experimental conditional move with two constants +/- 1 BRC
2370 (define_insn "movtK_5"
2371 [(set (match_operand:SI 0 "mcore_arith_reg_operand" "=r")
2373 (eq (ne:SI (reg:CC 17) (const_int 0)) (const_int 0))
2374 (match_operand:SI 1 "mcore_arith_O_operand" "O")
2375 (match_operand:SI 2 "mcore_arith_O_operand" "O")))]
2376 "GET_CODE (operands[1]) == CONST_INT &&
2377 GET_CODE (operands[2]) == CONST_INT &&
2378 ((INTVAL (operands[1]) - INTVAL (operands[2]) == 1) ||
2379 (INTVAL (operands[2]) - INTVAL (operands[1]) == 1))"
2380 "* return mcore_output_cmov (operands, 0, NULL);"
2381 [(set_attr "length" "4")])
2383 (define_insn "movf1"
2384 [(set (match_operand:SI 0 "mcore_arith_reg_operand" "=r,r,r,r")
2386 (eq (ne:SI (reg:CC 17) (const_int 0)) (const_int 0))
2387 (match_operand:SI 1 "mcore_arith_imm_operand" "r,0,U,0")
2388 (match_operand:SI 2 "mcore_arith_imm_operand" "0,r,0,U")))]
2396 ;; ------------------------------------------------------------------------
2398 ;; ------------------------------------------------------------------------
2400 ;; Combine creates this from an andn instruction in a scc sequence.
2401 ;; We must recognize it to get conditional moves generated.
2403 ; experimental conditional move with two constants +/- 1 BRC
2405 (define_insn "movtK_6"
2406 [(set (match_operand:SI 0 "mcore_arith_reg_operand" "=r")
2408 (eq (match_operand:SI 1 "mcore_arith_reg_operand" "r")
2410 (match_operand:SI 2 "mcore_arith_O_operand" "O")
2411 (match_operand:SI 3 "mcore_arith_O_operand" "O")))]
2412 "GET_CODE (operands[1]) == CONST_INT &&
2413 GET_CODE (operands[2]) == CONST_INT &&
2414 ((INTVAL (operands[2]) - INTVAL (operands[3]) == 1) ||
2415 (INTVAL (operands[3]) - INTVAL (operands[2]) == 1))"
2418 rtx out_operands[4];
2419 out_operands[0] = operands[0];
2420 out_operands[1] = operands[2];
2421 out_operands[2] = operands[3];
2422 out_operands[3] = operands[1];
2424 return mcore_output_cmov (out_operands, 0, \"cmpnei %3,0\");
2426 [(set_attr "length" "6")])
2428 (define_insn "movf3"
2429 [(set (match_operand:SI 0 "mcore_arith_reg_operand" "=r,r,r,r")
2430 (if_then_else:SI (eq (match_operand:SI 1 "mcore_arith_reg_operand" "r,r,r,r")
2432 (match_operand:SI 2 "mcore_arith_imm_operand" "r,0,U,0")
2433 (match_operand:SI 3 "mcore_arith_imm_operand" "0,r,0,U")))]
2436 cmpnei %1,0\;movf %0,%2
2437 cmpnei %1,0\;movt %0,%3
2438 cmpnei %1,0\;clrf %0
2439 cmpnei %1,0\;clrt %0"
2440 [(set_attr "length" "4")])
2442 ;; ------------------------------------------------------------------------
2444 ;; ------------------------------------------------------------------------
2446 ; experimental conditional move with two constants +/- 1 BRC
2447 (define_insn "movtK_7"
2448 [(set (match_operand:SI 0 "mcore_arith_reg_operand" "=r")
2450 (ne (eq:SI (reg:CC 17) (const_int 0)) (const_int 0))
2451 (match_operand:SI 1 "mcore_arith_O_operand" "O")
2452 (match_operand:SI 2 "mcore_arith_O_operand" "O")))]
2453 "GET_CODE (operands[1]) == CONST_INT &&
2454 GET_CODE (operands[2]) == CONST_INT &&
2455 ((INTVAL (operands[1]) - INTVAL (operands[2]) == 1) ||
2456 (INTVAL (operands[2]) - INTVAL (operands[1]) == 1))"
2457 "* return mcore_output_cmov (operands, 0, NULL);"
2458 [(set_attr "length" "4")])
2460 (define_insn "movf4"
2461 [(set (match_operand:SI 0 "mcore_arith_reg_operand" "=r,r,r,r")
2463 (ne (eq:SI (reg:CC 17) (const_int 0)) (const_int 0))
2464 (match_operand:SI 1 "mcore_arith_imm_operand" "r,0,U,0")
2465 (match_operand:SI 2 "mcore_arith_imm_operand" "0,r,0,U")))]
2473 ;; ------------------------------------------------------------------------
2475 ;; ------------------------------------------------------------------------
2477 ; experimental conditional move with two constants +/- 1 BRC
2478 (define_insn "movtK_8"
2479 [(set (match_operand:SI 0 "mcore_arith_reg_operand" "=r")
2481 (ne (ne:SI (reg:CC 17) (const_int 0)) (const_int 0))
2482 (match_operand:SI 1 "mcore_arith_O_operand" "O")
2483 (match_operand:SI 2 "mcore_arith_O_operand" "O")))]
2484 "GET_CODE (operands[1]) == CONST_INT &&
2485 GET_CODE (operands[2]) == CONST_INT &&
2486 ((INTVAL (operands[1]) - INTVAL (operands[2]) == 1) ||
2487 (INTVAL (operands[2]) - INTVAL (operands[1]) == 1))"
2488 "* return mcore_output_cmov (operands, 1, NULL);"
2489 [(set_attr "length" "4")])
2491 (define_insn "movt4"
2492 [(set (match_operand:SI 0 "mcore_arith_reg_operand" "=r,r,r,r")
2494 (ne (ne:SI (reg:CC 17) (const_int 0)) (const_int 0))
2495 (match_operand:SI 1 "mcore_arith_imm_operand" "r,0,U,0")
2496 (match_operand:SI 2 "mcore_arith_imm_operand" "0,r,0,U")))]
2504 ;; Also need patterns to recognize lt/ge, since otherwise the compiler will
2505 ;; try to output not/asri/tstne/movf.
2507 ;; ------------------------------------------------------------------------
2509 ;; ------------------------------------------------------------------------
2511 ; experimental conditional move with two constants +/- 1 BRC
2512 (define_insn "movtK_9"
2513 [(set (match_operand:SI 0 "mcore_arith_reg_operand" "=r")
2515 (lt (match_operand:SI 1 "mcore_arith_reg_operand" "r")
2517 (match_operand:SI 2 "mcore_arith_O_operand" "O")
2518 (match_operand:SI 3 "mcore_arith_O_operand" "O")))]
2519 "GET_CODE (operands[2]) == CONST_INT &&
2520 GET_CODE (operands[3]) == CONST_INT &&
2521 ((INTVAL (operands[2]) - INTVAL (operands[3]) == 1) ||
2522 (INTVAL (operands[3]) - INTVAL (operands[2]) == 1))"
2525 rtx out_operands[4];
2526 out_operands[0] = operands[0];
2527 out_operands[1] = operands[2];
2528 out_operands[2] = operands[3];
2529 out_operands[3] = operands[1];
2531 return mcore_output_cmov (out_operands, 1, \"btsti %3,31\");
2533 [(set_attr "length" "6")])
2535 (define_insn "movt5"
2536 [(set (match_operand:SI 0 "mcore_arith_reg_operand" "=r,r,r,r")
2537 (if_then_else:SI (lt (match_operand:SI 1 "mcore_arith_reg_operand" "r,r,r,r")
2539 (match_operand:SI 2 "mcore_arith_imm_operand" "r,0,U,0")
2540 (match_operand:SI 3 "mcore_arith_imm_operand" "0,r,0,U")))]
2543 btsti %1,31\;movt %0,%2
2544 btsti %1,31\;movf %0,%3
2545 btsti %1,31\;clrt %0
2546 btsti %1,31\;clrf %0"
2547 [(set_attr "length" "4")])
2550 ;; ------------------------------------------------------------------------
2552 ;; ------------------------------------------------------------------------
2554 ; experimental conditional move with two constants +/- 1 BRC
2555 (define_insn "movtK_10"
2556 [(set (match_operand:SI 0 "mcore_arith_reg_operand" "=r")
2558 (ge (match_operand:SI 1 "mcore_arith_reg_operand" "r")
2560 (match_operand:SI 2 "mcore_arith_O_operand" "O")
2561 (match_operand:SI 3 "mcore_arith_O_operand" "O")))]
2562 "GET_CODE (operands[2]) == CONST_INT &&
2563 GET_CODE (operands[3]) == CONST_INT &&
2564 ((INTVAL (operands[2]) - INTVAL (operands[3]) == 1) ||
2565 (INTVAL (operands[3]) - INTVAL (operands[2]) == 1))"
2568 rtx out_operands[4];
2569 out_operands[0] = operands[0];
2570 out_operands[1] = operands[2];
2571 out_operands[2] = operands[3];
2572 out_operands[3] = operands[1];
2574 return mcore_output_cmov (out_operands, 0, \"btsti %3,31\");
2576 [(set_attr "length" "6")])
2578 (define_insn "movf5"
2579 [(set (match_operand:SI 0 "mcore_arith_reg_operand" "=r,r,r,r")
2580 (if_then_else:SI (ge (match_operand:SI 1 "mcore_arith_reg_operand" "r,r,r,r")
2582 (match_operand:SI 2 "mcore_arith_imm_operand" "r,0,U,0")
2583 (match_operand:SI 3 "mcore_arith_imm_operand" "0,r,0,U")))]
2586 btsti %1,31\;movf %0,%2
2587 btsti %1,31\;movt %0,%3
2588 btsti %1,31\;clrf %0
2589 btsti %1,31\;clrt %0"
2590 [(set_attr "length" "4")])
2592 ;; ------------------------------------------------------------------------
2593 ;; Bitfield extract (xtrbN)
2594 ;; ------------------------------------------------------------------------
2596 ; sometimes we're better off using QI/HI mode and letting the machine indep.
2597 ; part expand insv and extv.
2599 ; e.g., sequences like:a [an insertion]
2602 ; movi r7,0x00ffffff
2604 ; stw r8,(r6) r8 dead
2609 ; stb r8,(r6) r8 dead
2611 ; it looks like always using SI mode is a win except in this type of code
2612 ; (when adjacent bit fields collapse on a byte or halfword boundary). when
2613 ; expanding with SI mode, non-adjacent bit field masks fold, but with QI/HI
2614 ; mode, they do not. one thought is to add some peepholes to cover cases
2615 ; like the above, but this is not a general solution.
2617 ; -mword-bitfields expands/inserts using SI mode. otherwise, do it with
2618 ; the smallest mode possible (using the machine indep. expansions). BRC
2620 ;(define_expand "extv"
2621 ; [(set (match_operand:SI 0 "mcore_arith_reg_operand" "")
2622 ; (sign_extract:SI (match_operand:SI 1 "mcore_arith_reg_operand" "")
2623 ; (match_operand:SI 2 "const_int_operand" "")
2624 ; (match_operand:SI 3 "const_int_operand" "")))
2625 ; (clobber (reg:CC 17))]
2629 ; if (INTVAL (operands[1]) != 8 || INTVAL (operands[2]) % 8 != 0)
2631 ; if (TARGET_W_FIELD)
2633 ; rtx lshft = GEN_INT (32 - (INTVAL (operands[2]) + INTVAL (operands[3])));
2634 ; rtx rshft = GEN_INT (32 - INTVAL (operands[2]));
2636 ; emit_insn (gen_rtx_SET (SImode, operands[0], operands[1]));
2637 ; emit_insn (gen_rtx_SET (SImode, operands[0],
2638 ; gen_rtx_ASHIFT (SImode, operands[0], lshft)));
2639 ; emit_insn (gen_rtx_SET (SImode, operands[0],
2640 ; gen_rtx_ASHIFTRT (SImode, operands[0], rshft)));
2648 (define_expand "extv"
2649 [(set (match_operand:SI 0 "mcore_arith_reg_operand" "")
2650 (sign_extract:SI (match_operand:SI 1 "mcore_arith_reg_operand" "")
2651 (match_operand:SI 2 "const_int_operand" "")
2652 (match_operand:SI 3 "const_int_operand" "")))
2653 (clobber (reg:CC 17))]
2657 if (INTVAL (operands[2]) == 8 && INTVAL (operands[3]) % 8 == 0)
2659 /* 8-bit field, aligned properly, use the xtrb[0123]+sext sequence. */
2660 /* not DONE, not FAIL, but let the RTL get generated.... */
2662 else if (TARGET_W_FIELD)
2664 /* Arbitrary placement; note that the tree->rtl generator will make
2665 something close to this if we return FAIL */
2666 rtx lshft = GEN_INT (32 - (INTVAL (operands[2]) + INTVAL (operands[3])));
2667 rtx rshft = GEN_INT (32 - INTVAL (operands[2]));
2668 rtx tmp1 = gen_reg_rtx (SImode);
2669 rtx tmp2 = gen_reg_rtx (SImode);
2671 emit_insn (gen_rtx_SET (SImode, tmp1, operands[1]));
2672 emit_insn (gen_rtx_SET (SImode, tmp2,
2673 gen_rtx_ASHIFT (SImode, tmp1, lshft)));
2674 emit_insn (gen_rtx_SET (SImode, operands[0],
2675 gen_rtx_ASHIFTRT (SImode, tmp2, rshft)));
2680 /* Let the caller choose an alternate sequence. */
2685 (define_expand "extzv"
2686 [(set (match_operand:SI 0 "mcore_arith_reg_operand" "")
2687 (zero_extract:SI (match_operand:SI 1 "mcore_arith_reg_operand" "")
2688 (match_operand:SI 2 "const_int_operand" "")
2689 (match_operand:SI 3 "const_int_operand" "")))
2690 (clobber (reg:CC 17))]
2694 if (INTVAL (operands[2]) == 8 && INTVAL (operands[3]) % 8 == 0)
2696 /* 8-bit field, aligned properly, use the xtrb[0123] sequence. */
2697 /* Let the template generate some RTL.... */
2699 else if (CONST_OK_FOR_K ((1 << INTVAL (operands[2])) - 1))
2701 /* A narrow bit-field (<=5 bits) means we can do a shift to put
2702 it in place and then use an andi to extract it.
2703 This is as good as a shiftleft/shiftright. */
2706 rtx mask = GEN_INT ((1 << INTVAL (operands[2])) - 1);
2708 if (INTVAL (operands[3]) == 0)
2710 shifted = operands[1];
2714 rtx rshft = GEN_INT (INTVAL (operands[3]));
2715 shifted = gen_reg_rtx (SImode);
2716 emit_insn (gen_rtx_SET (SImode, shifted,
2717 gen_rtx_LSHIFTRT (SImode, operands[1], rshft)));
2719 emit_insn (gen_rtx_SET (SImode, operands[0],
2720 gen_rtx_AND (SImode, shifted, mask)));
2723 else if (TARGET_W_FIELD)
2725 /* Arbitrary pattern; play shift/shift games to get it.
2726 * this is pretty much what the caller will do if we say FAIL */
2727 rtx lshft = GEN_INT (32 - (INTVAL (operands[2]) + INTVAL (operands[3])));
2728 rtx rshft = GEN_INT (32 - INTVAL (operands[2]));
2729 rtx tmp1 = gen_reg_rtx (SImode);
2730 rtx tmp2 = gen_reg_rtx (SImode);
2732 emit_insn (gen_rtx_SET (SImode, tmp1, operands[1]));
2733 emit_insn (gen_rtx_SET (SImode, tmp2,
2734 gen_rtx_ASHIFT (SImode, tmp1, lshft)));
2735 emit_insn (gen_rtx_SET (SImode, operands[0],
2736 gen_rtx_LSHIFTRT (SImode, tmp2, rshft)));
2741 /* Make the compiler figure out some alternative mechanism. */
2745 /* Emit the RTL pattern; something will match it later. */
2748 (define_expand "insv"
2749 [(set (zero_extract:SI (match_operand:SI 0 "mcore_arith_reg_operand" "")
2750 (match_operand:SI 1 "const_int_operand" "")
2751 (match_operand:SI 2 "const_int_operand" ""))
2752 (match_operand:SI 3 "general_operand" ""))
2753 (clobber (reg:CC 17))]
2757 if (mcore_expand_insv (operands))
2768 ;; the xtrb[0123] instructions handily get at 8-bit fields on nice boundaries.
2769 ;; but then, they do force you through r1.
2771 ;; the combiner will build such patterns for us, so we'll make them available
2774 ;; Note that we have both SIGNED and UNSIGNED versions of these...
2778 ;; These no longer worry about the clobbering of CC bit; not sure this is
2781 ;; the SIGNED versions of these
2784 [(set (match_operand:SI 0 "mcore_arith_reg_operand" "=r,b")
2785 (sign_extract:SI (match_operand:SI 1 "mcore_arith_reg_operand" "0,r") (const_int 8) (const_int 24)))]
2789 xtrb0 %0,%1\;sextb %0"
2790 [(set_attr "type" "shift")])
2793 [(set (match_operand:SI 0 "mcore_arith_reg_operand" "=b")
2794 (sign_extract:SI (match_operand:SI 1 "mcore_arith_reg_operand" "r") (const_int 8) (const_int 16)))]
2796 "xtrb1 %0,%1\;sextb %0"
2797 [(set_attr "type" "shift")])
2800 [(set (match_operand:SI 0 "mcore_arith_reg_operand" "=b")
2801 (sign_extract:SI (match_operand:SI 1 "mcore_arith_reg_operand" "r") (const_int 8) (const_int 8)))]
2803 "xtrb2 %0,%1\;sextb %0"
2804 [(set_attr "type" "shift")])
2807 [(set (match_operand:SI 0 "mcore_arith_reg_operand" "=r")
2808 (sign_extract:SI (match_operand:SI 1 "mcore_arith_reg_operand" "0") (const_int 8) (const_int 0)))]
2811 [(set_attr "type" "shift")])
2813 ;; the UNSIGNED uses of xtrb[0123]
2816 [(set (match_operand:SI 0 "mcore_arith_reg_operand" "=r,b")
2817 (zero_extract:SI (match_operand:SI 1 "mcore_arith_reg_operand" "0,r") (const_int 8) (const_int 24)))]
2822 [(set_attr "type" "shift")])
2825 [(set (match_operand:SI 0 "mcore_arith_reg_operand" "=b")
2826 (zero_extract:SI (match_operand:SI 1 "mcore_arith_reg_operand" "r") (const_int 8) (const_int 16)))]
2829 [(set_attr "type" "shift")])
2832 [(set (match_operand:SI 0 "mcore_arith_reg_operand" "=b")
2833 (zero_extract:SI (match_operand:SI 1 "mcore_arith_reg_operand" "r") (const_int 8) (const_int 8)))]
2836 [(set_attr "type" "shift")])
2838 ;; This can be peepholed if it follows a ldb ...
2840 [(set (match_operand:SI 0 "mcore_arith_reg_operand" "=r,b")
2841 (zero_extract:SI (match_operand:SI 1 "mcore_arith_reg_operand" "0,r") (const_int 8) (const_int 0)))]
2845 xtrb3 %0,%1\;zextb %0"
2846 [(set_attr "type" "shift")])
2849 ;; ------------------------------------------------------------------------
2850 ;; Block move - adapted from m88k.md
2851 ;; ------------------------------------------------------------------------
2853 (define_expand "movmemsi"
2854 [(parallel [(set (mem:BLK (match_operand:BLK 0 "" ""))
2855 (mem:BLK (match_operand:BLK 1 "" "")))
2856 (use (match_operand:SI 2 "general_operand" ""))
2857 (use (match_operand:SI 3 "immediate_operand" ""))])]
2861 if (mcore_expand_block_move (operands))
2867 ;; ;;; ??? These patterns are meant to be generated from expand_block_move,
2868 ;; ;;; but they currently are not.
2871 ;; [(set (match_operand:QI 0 "mcore_arith_reg_operand" "=r")
2872 ;; (match_operand:BLK 1 "mcore_general_movsrc_operand" "m"))]
2875 ;; [(set_attr "type" "load")])
2878 ;; [(set (match_operand:HI 0 "mcore_arith_reg_operand" "=r")
2879 ;; (match_operand:BLK 1 "mcore_general_movsrc_operand" "m"))]
2882 ;; [(set_attr "type" "load")])
2885 ;; [(set (match_operand:SI 0 "mcore_arith_reg_operand" "=r")
2886 ;; (match_operand:BLK 1 "mcore_general_movsrc_operand" "m"))]
2889 ;; [(set_attr "type" "load")])
2892 ;; [(set (match_operand:BLK 0 "mcore_general_movdst_operand" "=m")
2893 ;; (match_operand:QI 1 "mcore_arith_reg_operand" "r"))]
2896 ;; [(set_attr "type" "store")])
2899 ;; [(set (match_operand:BLK 0 "mcore_general_movdst_operand" "=m")
2900 ;; (match_operand:HI 1 "mcore_arith_reg_operand" "r"))]
2903 ;; [(set_attr "type" "store")])
2906 ;; [(set (match_operand:BLK 0 "mcore_general_movdst_operand" "=m")
2907 ;; (match_operand:SI 1 "mcore_arith_reg_operand" "r"))]
2910 ;; [(set_attr "type" "store")])
2912 ;; ------------------------------------------------------------------------
2913 ;; Misc Optimizing quirks
2914 ;; ------------------------------------------------------------------------
2916 ;; pair to catch constructs like: (int *)((p+=4)-4) which happen
2917 ;; in stdarg/varargs traversal. This changes a 3 insn sequence to a 2
2918 ;; insn sequence. -- RBE 11/30/95
2921 (set (match_operand:SI 0 "mcore_arith_reg_operand" "=r")
2922 (match_operand:SI 1 "mcore_arith_reg_operand" "+r"))
2923 (set (match_dup 1) (plus:SI (match_dup 1) (match_operand 2 "mcore_arith_any_imm_operand" "")))])]
2924 "GET_CODE(operands[2]) == CONST_INT"
2926 [(set_attr "length" "4")])
2930 (set (match_operand:SI 0 "mcore_arith_reg_operand" "")
2931 (match_operand:SI 1 "mcore_arith_reg_operand" ""))
2932 (set (match_dup 1) (plus:SI (match_dup 1) (match_operand 2 "mcore_arith_any_imm_operand" "")))])]
2933 "GET_CODE(operands[2]) == CONST_INT &&
2934 operands[0] != operands[1]"
2935 [(set (match_dup 0) (match_dup 1))
2936 (set (match_dup 1) (plus:SI (match_dup 1) (match_dup 2)))])
2941 ; note: in the following patterns, use mcore_is_dead() to ensure that the
2942 ; reg we may be trashing really is dead. reload doesn't always mark
2943 ; deaths, so mcore_is_dead() (see mcore.c) scans forward to find its death. BRC
2945 ;;; A peephole to convert the 3 instruction sequence generated by reload
2946 ;;; to load a FP-offset address into a 2 instruction sequence.
2947 ;;; ??? This probably never matches anymore.
2949 [(set (match_operand:SI 0 "mcore_arith_reg_operand" "r")
2950 (match_operand:SI 1 "const_int_operand" "J"))
2951 (set (match_dup 0) (neg:SI (match_dup 0)))
2953 (plus:SI (match_dup 0)
2954 (match_operand:SI 2 "mcore_arith_reg_operand" "r")))]
2955 "CONST_OK_FOR_J (INTVAL (operands[1]))"
2956 "error\;mov %0,%2\;subi %0,%1")
2958 ;; Moves of inlinable constants are done late, so when a 'not' is generated
2959 ;; it is never combined with the following 'and' to generate an 'andn' b/c
2960 ;; the combiner never sees it. use a peephole to pick up this case (happens
2961 ;; mostly with bitfields) BRC
2964 [(set (match_operand:SI 0 "mcore_arith_reg_operand" "r")
2965 (match_operand:SI 1 "const_int_operand" "i"))
2966 (set (match_operand:SI 2 "mcore_arith_reg_operand" "r")
2967 (and:SI (match_dup 2) (match_dup 0)))]
2968 "mcore_const_trick_uses_not (INTVAL (operands[1])) &&
2969 operands[0] != operands[2] &&
2970 mcore_is_dead (insn, operands[0])"
2971 "* return mcore_output_andn (insn, operands);")
2973 ; when setting or clearing just two bits, it's cheapest to use two bseti's
2974 ; or bclri's. only happens when relaxing immediates. BRC
2977 [(set (match_operand:SI 0 "mcore_arith_reg_operand" "")
2978 (match_operand:SI 1 "const_int_operand" ""))
2979 (set (match_operand:SI 2 "mcore_arith_reg_operand" "")
2980 (ior:SI (match_dup 2) (match_dup 0)))]
2982 && mcore_num_ones (INTVAL (operands[1])) == 2
2983 && mcore_is_dead (insn, operands[0])"
2984 "* return mcore_output_bseti (operands[2], INTVAL (operands[1]));")
2987 [(set (match_operand:SI 0 "mcore_arith_reg_operand" "")
2988 (match_operand:SI 1 "const_int_operand" ""))
2989 (set (match_operand:SI 2 "mcore_arith_reg_operand" "")
2990 (and:SI (match_dup 2) (match_dup 0)))]
2991 "TARGET_HARDLIT && mcore_num_zeros (INTVAL (operands[1])) == 2 &&
2992 mcore_is_dead (insn, operands[0])"
2993 "* return mcore_output_bclri (operands[2], INTVAL (operands[1]));")
2995 ; change an and with a mask that has a single cleared bit into a bclri. this
2996 ; handles QI and HI mode values using the knowledge that the most significant
2997 ; bits don't matter.
3000 [(set (match_operand:SI 0 "mcore_arith_reg_operand" "")
3001 (match_operand:SI 1 "const_int_operand" ""))
3002 (set (match_operand:SI 2 "mcore_arith_reg_operand" "")
3003 (and:SI (match_operand:SI 3 "mcore_arith_reg_operand" "")
3005 "GET_CODE (operands[3]) == SUBREG &&
3006 GET_MODE (SUBREG_REG (operands[3])) == QImode &&
3007 mcore_num_zeros (INTVAL (operands[1]) | 0xffffff00) == 1 &&
3008 mcore_is_dead (insn, operands[0])"
3010 if (! mcore_is_same_reg (operands[2], operands[3]))
3011 output_asm_insn (\"mov\\t%2,%3\", operands);
3012 return mcore_output_bclri (operands[2], INTVAL (operands[1]) | 0xffffff00);")
3014 /* Do not fold these together -- mode is lost at final output phase. */
3017 [(set (match_operand:SI 0 "mcore_arith_reg_operand" "")
3018 (match_operand:SI 1 "const_int_operand" ""))
3019 (set (match_operand:SI 2 "mcore_arith_reg_operand" "")
3020 (and:SI (match_operand:SI 3 "mcore_arith_reg_operand" "")
3022 "GET_CODE (operands[3]) == SUBREG &&
3023 GET_MODE (SUBREG_REG (operands[3])) == HImode &&
3024 mcore_num_zeros (INTVAL (operands[1]) | 0xffff0000) == 1 &&
3025 operands[2] == operands[3] &&
3026 mcore_is_dead (insn, operands[0])"
3028 if (! mcore_is_same_reg (operands[2], operands[3]))
3029 output_asm_insn (\"mov\\t%2,%3\", operands);
3030 return mcore_output_bclri (operands[2], INTVAL (operands[1]) | 0xffff0000);")
3032 ; This peephole helps when using -mwide-bitfields to widen fields so they
3033 ; collapse. This, however, has the effect that a narrower mode is not used
3036 ; e.g., sequences like:
3039 ; movi r7,0x00ffffff
3041 ; stw r8,(r6) r8 dead
3043 ; get peepholed to become:
3046 ; stb r8,(r6) r8 dead
3048 ; Do only easy addresses that have no offset. This peephole is also applied
3049 ; to halfwords. We need to check that the load is non-volatile before we get
3053 [(set (match_operand:SI 0 "mcore_arith_reg_operand" "")
3054 (match_operand:SI 1 "memory_operand" ""))
3055 (set (match_operand:SI 2 "mcore_arith_reg_operand" "")
3056 (match_operand:SI 3 "const_int_operand" ""))
3057 (set (match_dup 0) (and:SI (match_dup 0) (match_dup 2)))
3058 (set (match_operand:SI 4 "memory_operand" "") (match_dup 0))]
3059 "mcore_is_dead (insn, operands[0]) &&
3060 ! MEM_VOLATILE_P (operands[1]) &&
3061 mcore_is_dead (insn, operands[2]) &&
3062 (mcore_byte_offset (INTVAL (operands[3])) > -1 ||
3063 mcore_halfword_offset (INTVAL (operands[3])) > -1) &&
3064 ! MEM_VOLATILE_P (operands[4]) &&
3065 GET_CODE (XEXP (operands[4], 0)) == REG"
3069 enum machine_mode mode;
3070 rtx base_reg = XEXP (operands[4], 0);
3072 if ((ofs = mcore_byte_offset (INTVAL (operands[3]))) > -1)
3074 else if ((ofs = mcore_halfword_offset (INTVAL (operands[3]))) > -1)
3080 operands[4] = gen_rtx_MEM (mode,
3081 gen_rtx_PLUS (SImode, base_reg, GEN_INT(ofs)));
3083 operands[4] = gen_rtx_MEM (mode, base_reg);
3086 return \"movi %0,0\\n\\tst.b %0,%4\";
3088 return \"movi %0,0\\n\\tst.h %0,%4\";
3091 ; from sop11. get btsti's for (LT A 0) where A is a QI or HI value
3094 [(set (match_operand:SI 0 "mcore_arith_reg_operand" "r")
3095 (sign_extend:SI (match_operand:QI 1 "mcore_arith_reg_operand" "0")))
3097 (lt:CC (match_dup 0)
3099 "mcore_is_dead (insn, operands[0])"
3103 [(set (match_operand:SI 0 "mcore_arith_reg_operand" "r")
3104 (sign_extend:SI (match_operand:HI 1 "mcore_arith_reg_operand" "0")))
3106 (lt:CC (match_dup 0)
3108 "mcore_is_dead (insn, operands[0])"
3111 ; Pick up a tst. This combination happens because the immediate is not
3112 ; allowed to fold into one of the operands of the tst. Does not happen
3113 ; when relaxing immediates. BRC
3116 [(set (match_operand:SI 0 "mcore_arith_reg_operand" "")
3117 (match_operand:SI 1 "mcore_arith_reg_operand" ""))
3119 (and:SI (match_dup 0)
3120 (match_operand:SI 2 "mcore_literal_K_operand" "")))
3121 (set (reg:CC 17) (ne:CC (match_dup 0) (const_int 0)))]
3122 "mcore_is_dead (insn, operands[0])"
3123 "movi %0,%2\;tst %1,%0")
3126 [(set (match_operand:SI 0 "mcore_arith_reg_operand" "")
3127 (if_then_else:SI (ne (zero_extract:SI
3128 (match_operand:SI 1 "mcore_arith_reg_operand" "")
3130 (match_operand:SI 2 "mcore_literal_K_operand" ""))
3132 (match_operand:SI 3 "mcore_arith_imm_operand" "")
3133 (match_operand:SI 4 "mcore_arith_imm_operand" "")))
3134 (set (reg:CC 17) (ne:CC (match_dup 0) (const_int 0)))]
3138 unsigned int op0 = REGNO (operands[0]);
3140 if (GET_CODE (operands[3]) == REG)
3142 if (REGNO (operands[3]) == op0 && GET_CODE (operands[4]) == CONST_INT
3143 && INTVAL (operands[4]) == 0)
3144 return \"btsti %1,%2\\n\\tclrf %0\";
3145 else if (GET_CODE (operands[4]) == REG)
3147 if (REGNO (operands[4]) == op0)
3148 return \"btsti %1,%2\\n\\tmovf %0,%3\";
3149 else if (REGNO (operands[3]) == op0)
3150 return \"btsti %1,%2\\n\\tmovt %0,%4\";
3155 else if (GET_CODE (operands[3]) == CONST_INT
3156 && INTVAL (operands[3]) == 0
3157 && GET_CODE (operands[4]) == REG)
3158 return \"btsti %1,%2\\n\\tclrt %0\";
3163 ; experimental - do the constant folding ourselves. note that this isn't
3164 ; re-applied like we'd really want. i.e., four ands collapse into two
3165 ; instead of one. this is because peepholes are applied as a sliding
3166 ; window. the peephole does not generate new rtl's, but instead slides
3167 ; across the rtl's generating machine instructions. it would be nice
3168 ; if the peephole optimizer is changed to re-apply patterns and to gen
3169 ; new rtl's. this is more flexible. the pattern below helps when we're
3170 ; not using relaxed immediates. BRC
3173 ; [(set (match_operand:SI 0 "mcore_arith_reg_operand" "")
3174 ; (match_operand:SI 1 "const_int_operand" ""))
3175 ; (set (match_operand:SI 2 "mcore_arith_reg_operand" "")
3176 ; (and:SI (match_dup 2) (match_dup 0)))
3177 ; (set (match_dup 0)
3178 ; (match_operand:SI 3 "const_int_operand" ""))
3179 ; (set (match_dup 2)
3180 ; (and:SI (match_dup 2) (match_dup 0)))]
3181 ; "!TARGET_RELAX_IMM && mcore_is_dead (insn, operands[0]) &&
3182 ; mcore_const_ok_for_inline (INTVAL (operands[1]) & INTVAL (operands[3]))"
3185 ; rtx out_operands[2];
3186 ; out_operands[0] = operands[0];
3187 ; out_operands[1] = GEN_INT (INTVAL (operands[1]) & INTVAL (operands[3]));
3189 ; output_inline_const (SImode, out_operands);
3191 ; output_asm_insn (\"and %2,%0\", operands);
3196 ; BRC: for inlining get rid of extra test - experimental
3198 ; [(set (match_operand:SI 0 "mcore_arith_reg_operand" "r")
3199 ; (ne:SI (reg:CC 17) (const_int 0)))
3200 ; (set (reg:CC 17) (ne:CC (match_dup 0) (const_int 0)))
3202 ; (if_then_else (eq (reg:CC 17) (const_int 0))
3203 ; (label_ref (match_operand 1 "" ""))
3208 ; if (get_attr_length (insn) == 10)
3210 ; output_asm_insn (\"bt 2f\\n\\tjmpi [1f]\", operands);
3211 ; output_asm_insn (\".align 2\\n1:\", operands);
3212 ; output_asm_insn (\".long %1\\n2:\", operands);
3215 ; return \"bf %l1\";
3219 ;;; Special patterns for dealing with the constant pool.
3221 ;;; 4 byte integer in line.
3223 (define_insn "consttable_4"
3224 [(unspec_volatile [(match_operand:SI 0 "general_operand" "=g")] 0)]
3228 assemble_integer (operands[0], 4, BITS_PER_WORD, 1);
3231 [(set_attr "length" "4")])
3233 ;;; align to a four byte boundary.
3235 (define_insn "align_4"
3236 [(unspec_volatile [(const_int 0)] 1)]
3240 ;;; Handle extra constant pool entries created during final pass.
3242 (define_insn "consttable_end"
3243 [(unspec_volatile [(const_int 0)] 2)]
3245 "* return mcore_output_jump_label_table ();")
3248 ;; Stack allocation -- in particular, for alloca().
3249 ;; this is *not* what we use for entry into functions.
3251 ;; This is how we allocate stack space. If we are allocating a
3252 ;; constant amount of space and we know it is less than 4096
3253 ;; bytes, we need do nothing.
3255 ;; If it is more than 4096 bytes, we need to probe the stack
3258 ;; operands[1], the distance is a POSITIVE number indicating that we
3259 ;; are allocating stack space
3261 (define_expand "allocate_stack"
3264 (match_operand:SI 1 "general_operand" "")))
3265 (set (match_operand:SI 0 "register_operand" "=r")
3270 /* If he wants no probing, just do it for him. */
3271 if (mcore_stack_increment == 0)
3273 emit_insn (gen_addsi3 (stack_pointer_rtx, stack_pointer_rtx,operands[1]));
3274 ;; emit_move_insn (operands[0], virtual_stack_dynamic_rtx);
3278 /* For small constant growth, we unroll the code. */
3279 if (GET_CODE (operands[1]) == CONST_INT
3280 && INTVAL (operands[1]) < 8 * STACK_UNITS_MAXSTEP)
3282 HOST_WIDE_INT left = INTVAL(operands[1]);
3284 /* If it's a long way, get close enough for a last shot. */
3285 if (left >= STACK_UNITS_MAXSTEP)
3287 rtx tmp = gen_reg_rtx (Pmode);
3288 emit_insn (gen_movsi (tmp, GEN_INT (STACK_UNITS_MAXSTEP)));
3291 rtx memref = gen_rtx_MEM (SImode, stack_pointer_rtx);
3293 MEM_VOLATILE_P (memref) = 1;
3294 emit_insn (gen_subsi3 (stack_pointer_rtx, stack_pointer_rtx, tmp));
3295 emit_insn (gen_movsi (memref, stack_pointer_rtx));
3296 left -= STACK_UNITS_MAXSTEP;
3298 while (left > STACK_UNITS_MAXSTEP);
3300 /* Perform the final adjustment. */
3301 emit_insn (gen_addsi3 (stack_pointer_rtx, stack_pointer_rtx, GEN_INT (-left)));
3302 ;; emit_move_insn (operands[0], virtual_stack_dynamic_rtx);
3308 rtx loop_label = gen_label_rtx ();
3309 rtx step = gen_reg_rtx (Pmode);
3310 rtx tmp = gen_reg_rtx (Pmode);
3314 emit_insn (gen_movsi (tmp, operands[1]));
3315 emit_insn (gen_movsi (step, GEN_INT (STACK_UNITS_MAXSTEP)));
3317 if (GET_CODE (operands[1]) != CONST_INT)
3319 out_label = gen_label_rtx ();
3320 emit_insn (gen_cmpsi (step, tmp)); /* quick out */
3321 emit_jump_insn (gen_bgeu (out_label));
3324 /* Run a loop that steps it incrementally. */
3325 emit_label (loop_label);
3327 /* Extend a step, probe, and adjust remaining count. */
3328 emit_insn(gen_subsi3(stack_pointer_rtx, stack_pointer_rtx, step));
3329 memref = gen_rtx_MEM (SImode, stack_pointer_rtx);
3330 MEM_VOLATILE_P (memref) = 1;
3331 emit_insn(gen_movsi(memref, stack_pointer_rtx));
3332 emit_insn(gen_subsi3(tmp, tmp, step));
3334 /* Loop condition -- going back up. */
3335 emit_insn (gen_cmpsi (step, tmp));
3336 emit_jump_insn (gen_bltu (loop_label));
3339 emit_label (out_label);
3341 /* Bump the residual. */
3342 emit_insn (gen_subsi3 (stack_pointer_rtx, stack_pointer_rtx, tmp));
3343 ;; emit_move_insn (operands[0], virtual_stack_dynamic_rtx);
3346 /* simple one-shot -- ensure register and do a subtract.
3347 * This does NOT comply with the ABI. */
3348 emit_insn (gen_movsi (tmp, operands[1]));
3349 emit_insn (gen_subsi3 (stack_pointer_rtx, stack_pointer_rtx, tmp));
3350 ;; emit_move_insn (operands[0], virtual_stack_dynamic_rtx);